From: support Date: Fri, 15 Jul 2022 13:22:32 +0000 (+0000) Subject: Built motion from commit 9d0783e6.|2.6.13 X-Git-Tag: 2.6.14~1 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/www.w3.org/TR//%27?a=commitdiff_plain;h=0fe7d63fdd24ac799f5260a5b10b06097955b09f;p=motion2.git Built motion from commit 9d0783e6.|2.6.13 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index dd93e42..ad51c56 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-07-15T12:41:16.416Z", + "time": "2022-07-15T13:15:52.909Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 2d10272..f2e04f3 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-15T12:41:16.416Z", + "time": "2022-07-15T13:15:52.909Z", "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 a068999..4d61090 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 _0x7fcf=['action','contactManager','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0x7fcf,0xce));var _0xf7fc=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7fcf[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require('sequelize');module[_0xf7fc('0x0')]={'name':{'type':Sequelize[_0xf7fc('0x1')],'get':function(_0x340c94){return this['getDataValue'](_0xf7fc('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xf7fc('0x3'),'integration','motionbar',_0xf7fc('0x4'),_0xf7fc('0x5'),_0xf7fc('0x6'),'bot',_0xf7fc('0x7')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xf7fc('0x8')},'data1':{'type':Sequelize[_0xf7fc('0x9')](0x1000),'comment':_0xf7fc('0xa')},'data2':{'type':Sequelize[_0xf7fc('0x9')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xf7fc('0x9')](0x1000),'comment':_0xf7fc('0xb')},'data4':{'type':Sequelize[_0xf7fc('0x9')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xf7fc('0x9')](0x1000),'comments':_0xf7fc('0xc')},'data6':{'type':Sequelize[_0xf7fc('0x9')],'comments':_0xf7fc('0xd')},'data7':{'type':Sequelize[_0xf7fc('0xe')],'comments':_0xf7fc('0xf')}}; \ No newline at end of file +var _0xea78=['urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','action','STRING','contactManager','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'];(function(_0x5c2c72,_0x22cf09){var _0x11c44c=function(_0x37bcca){while(--_0x37bcca){_0x5c2c72['push'](_0x5c2c72['shift']());}};_0x11c44c(++_0x22cf09);}(_0xea78,0x162));var _0x8ea7=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0xea78[_0x2fee96];return _0x2e6ad1;};'use strict';var Sequelize=require(_0x8ea7('0x0'));module[_0x8ea7('0x1')]={'name':{'type':Sequelize[_0x8ea7('0x2')],'get':function(_0x53977f){return this['getDataValue'](_0x8ea7('0x3'));}},'action':{'type':Sequelize[_0x8ea7('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8ea7('0x5'),'integration',_0x8ea7('0x6'),_0x8ea7('0x7'),'urlForward',_0x8ea7('0x8'),'bot',_0x8ea7('0x9')]],'msg':_0x8ea7('0xa')}},'comment':_0x8ea7('0xa')},'data1':{'type':Sequelize[_0x8ea7('0x4')](0x1000),'comment':_0x8ea7('0xb')},'data2':{'type':Sequelize[_0x8ea7('0x4')](0x1000),'comment':_0x8ea7('0xc')},'data3':{'type':Sequelize[_0x8ea7('0x4')](0x1000),'comment':_0x8ea7('0xd')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x8ea7('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x8ea7('0x4')],'comments':_0x8ea7('0xe')},'data7':{'type':Sequelize[_0x8ea7('0xf')],'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 c1b432c..c06d7ca 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 _0xd7b9=['mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','body','Action','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x308b5c,_0x31bf56){var _0x2de469=function(_0x298e66){while(--_0x298e66){_0x308b5c['push'](_0x308b5c['shift']());}};_0x2de469(++_0x31bf56);}(_0xd7b9,0x12c));var _0x9d7b=function(_0x1c22f0,_0x1924e2){_0x1c22f0=_0x1c22f0-0x0;var _0x5a32d8=_0xd7b9[_0x1c22f0];return _0x5a32d8;};'use strict';var emlformat=require(_0x9d7b('0x0'));var rimraf=require(_0x9d7b('0x1'));var zipdir=require(_0x9d7b('0x2'));var jsonpatch=require(_0x9d7b('0x3'));var rp=require(_0x9d7b('0x4'));var moment=require(_0x9d7b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9d7b('0x6'));var util=require(_0x9d7b('0x7'));var path=require(_0x9d7b('0x8'));var sox=require('sox');var csv=require(_0x9d7b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d7b('0xa'));var _=require('lodash');var squel=require(_0x9d7b('0xb'));var crypto=require(_0x9d7b('0xc'));var jsforce=require(_0x9d7b('0xd'));var deskjs=require(_0x9d7b('0xe'));var toCsv=require(_0x9d7b('0x9'));var querystring=require(_0x9d7b('0xf'));var Papa=require(_0x9d7b('0x10'));var Redis=require(_0x9d7b('0x11'));var authService=require(_0x9d7b('0x12'));var qs=require(_0x9d7b('0x13'));var as=require(_0x9d7b('0x14'));var hardwareService=require(_0x9d7b('0x15'));var logger=require(_0x9d7b('0x16'))(_0x9d7b('0x17'));var utils=require('../../config/utils');var config=require(_0x9d7b('0x18'));var licenseUtil=require(_0x9d7b('0x19'));var db=require(_0x9d7b('0x1a'))['db'];function respondWithStatusCode(_0x12fc68,_0x4bb5b3){_0x4bb5b3=_0x4bb5b3||0xcc;return function(_0x5c70f1){if(_0x5c70f1){return _0x12fc68[_0x9d7b('0x1b')](_0x4bb5b3);}return _0x12fc68[_0x9d7b('0x1c')](_0x4bb5b3)[_0x9d7b('0x1d')]();};}function respondWithResult(_0x3cb368,_0x329255){_0x329255=_0x329255||0xc8;return function(_0x5905b4){if(_0x5905b4){return _0x3cb368[_0x9d7b('0x1c')](_0x329255)['json'](_0x5905b4);}};}function respondWithFilteredResult(_0x3d19c1,_0x58209e){return function(_0x4a1fea){if(_0x4a1fea){var _0x4ab7d0=typeof _0x58209e[_0x9d7b('0x1e')]==='undefined'&&typeof _0x58209e[_0x9d7b('0x1f')]===_0x9d7b('0x20');var _0x5b74a4=_0x4a1fea[_0x9d7b('0x21')];var _0x1d1a7f=_0x4ab7d0?0x0:_0x58209e['offset'];var _0x3800da=_0x4ab7d0?_0x4a1fea[_0x9d7b('0x21')]:_0x58209e[_0x9d7b('0x1e')]+_0x58209e[_0x9d7b('0x1f')];var _0x4a9e18;if(_0x3800da>=_0x5b74a4){_0x3800da=_0x5b74a4;_0x4a9e18=0xc8;}else{_0x4a9e18=0xce;}_0x3d19c1['status'](_0x4a9e18);return _0x3d19c1[_0x9d7b('0x22')]('Content-Range',_0x1d1a7f+'-'+_0x3800da+'/'+_0x5b74a4)[_0x9d7b('0x23')](_0x4a1fea);}return null;};}function patchUpdates(_0x4fd040){return function(_0x139d4b){try{jsonpatch[_0x9d7b('0x24')](_0x139d4b,_0x4fd040,!![]);}catch(_0x27cdc8){return BPromise[_0x9d7b('0x25')](_0x27cdc8);}return _0x139d4b[_0x9d7b('0x26')]();};}function saveUpdates(_0x464abb,_0x261880){return function(_0x4f7d7e){if(_0x4f7d7e){return _0x4f7d7e[_0x9d7b('0x27')](_0x464abb)['then'](function(_0x340d78){return _0x340d78;});}return null;};}function removeEntity(_0x25b510,_0x1fabd4){return function(_0x2a404e){if(_0x2a404e){return _0x2a404e[_0x9d7b('0x28')]()[_0x9d7b('0x29')](function(){_0x25b510[_0x9d7b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53b741,_0x524ad0){return function(_0x1e5fdd){if(!_0x1e5fdd){_0x53b741[_0x9d7b('0x1b')](0x194);}return _0x1e5fdd;};}function handleError(_0x2f9d43,_0x3ba0a0){_0x3ba0a0=_0x3ba0a0||0x1f4;return function(_0x9aa3eb){logger[_0x9d7b('0x2a')](_0x9aa3eb[_0x9d7b('0x2b')]);if(_0x9aa3eb[_0x9d7b('0x2c')]){delete _0x9aa3eb['name'];}_0x2f9d43[_0x9d7b('0x1c')](_0x3ba0a0)[_0x9d7b('0x2d')](_0x9aa3eb);};}exports[_0x9d7b('0x27')]=function(_0x16d1d0,_0x5d374d){if(_0x16d1d0[_0x9d7b('0x2e')]['id']){delete _0x16d1d0['body']['id'];}return db[_0x9d7b('0x2f')][_0x9d7b('0x30')]({'where':{'id':_0x16d1d0['params']['id']}})[_0x9d7b('0x29')](handleEntityNotFound(_0x5d374d,null))[_0x9d7b('0x29')](saveUpdates(_0x16d1d0[_0x9d7b('0x2e')],null))[_0x9d7b('0x29')](respondWithResult(_0x5d374d,null))[_0x9d7b('0x31')](handleError(_0x5d374d,null));};exports[_0x9d7b('0x28')]=function(_0x423de2,_0xa14b67){return db[_0x9d7b('0x2f')][_0x9d7b('0x30')]({'where':{'id':_0x423de2[_0x9d7b('0x32')]['id']}})[_0x9d7b('0x29')](handleEntityNotFound(_0xa14b67,null))[_0x9d7b('0x29')](removeEntity(_0xa14b67,null))[_0x9d7b('0x31')](handleError(_0xa14b67,null));}; \ No newline at end of file +var _0xeeb3=['util','sox','to-csv','fs-extra','lodash','querystring','papaparse','ioredis','../../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','then','destroy','error','name','send','Action','find','params','body','catch','rimraf','zip-dir','request-promise','moment'];(function(_0x37dbf9,_0x529eb5){var _0x40e897=function(_0x10fbcf){while(--_0x10fbcf){_0x37dbf9['push'](_0x37dbf9['shift']());}};_0x40e897(++_0x529eb5);}(_0xeeb3,0x74));var _0x3eeb=function(_0xaa0720,_0x12e8fa){_0xaa0720=_0xaa0720-0x0;var _0x79ec4c=_0xeeb3[_0xaa0720];return _0x79ec4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3eeb('0x0'));var zipdir=require(_0x3eeb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3eeb('0x2'));var moment=require(_0x3eeb('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3eeb('0x4'));var path=require('path');var sox=require(_0x3eeb('0x5'));var csv=require(_0x3eeb('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3eeb('0x7'));var _=require(_0x3eeb('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3eeb('0x9'));var Papa=require(_0x3eeb('0xa'));var Redis=require(_0x3eeb('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x3eeb('0xc'));var as=require(_0x3eeb('0xd'));var hardwareService=require(_0x3eeb('0xe'));var logger=require(_0x3eeb('0xf'))(_0x3eeb('0x10'));var utils=require('../../config/utils');var config=require(_0x3eeb('0x11'));var licenseUtil=require(_0x3eeb('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x111174,_0x421cf6){_0x421cf6=_0x421cf6||0xcc;return function(_0xeea686){if(_0xeea686){return _0x111174[_0x3eeb('0x13')](_0x421cf6);}return _0x111174[_0x3eeb('0x14')](_0x421cf6)[_0x3eeb('0x15')]();};}function respondWithResult(_0x2f4562,_0x304e57){_0x304e57=_0x304e57||0xc8;return function(_0x1b8aaf){if(_0x1b8aaf){return _0x2f4562[_0x3eeb('0x14')](_0x304e57)[_0x3eeb('0x16')](_0x1b8aaf);}};}function respondWithFilteredResult(_0x19c2bb,_0x146c03){return function(_0x7cfc3){if(_0x7cfc3){var _0x5465a0=typeof _0x146c03[_0x3eeb('0x17')]===_0x3eeb('0x18')&&typeof _0x146c03[_0x3eeb('0x19')]===_0x3eeb('0x18');var _0x3843d3=_0x7cfc3['count'];var _0x443d5a=_0x5465a0?0x0:_0x146c03['offset'];var _0x25bbe6=_0x5465a0?_0x7cfc3[_0x3eeb('0x1a')]:_0x146c03[_0x3eeb('0x17')]+_0x146c03['limit'];var _0x3dbc4a;if(_0x25bbe6>=_0x3843d3){_0x25bbe6=_0x3843d3;_0x3dbc4a=0xc8;}else{_0x3dbc4a=0xce;}_0x19c2bb[_0x3eeb('0x14')](_0x3dbc4a);return _0x19c2bb[_0x3eeb('0x1b')](_0x3eeb('0x1c'),_0x443d5a+'-'+_0x25bbe6+'/'+_0x3843d3)[_0x3eeb('0x16')](_0x7cfc3);}return null;};}function patchUpdates(_0x40c04e){return function(_0x2768bf){try{jsonpatch[_0x3eeb('0x1d')](_0x2768bf,_0x40c04e,!![]);}catch(_0x316c18){return BPromise['reject'](_0x316c18);}return _0x2768bf['save']();};}function saveUpdates(_0x3507c4,_0x35674c){return function(_0x344bd7){if(_0x344bd7){return _0x344bd7['update'](_0x3507c4)[_0x3eeb('0x1e')](function(_0x43b5d3){return _0x43b5d3;});}return null;};}function removeEntity(_0x468e5a,_0x2b08f1){return function(_0x65bebe){if(_0x65bebe){return _0x65bebe[_0x3eeb('0x1f')]()[_0x3eeb('0x1e')](function(){_0x468e5a[_0x3eeb('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x371585,_0x5bc1f3){return function(_0xce0236){if(!_0xce0236){_0x371585[_0x3eeb('0x13')](0x194);}return _0xce0236;};}function handleError(_0x3de58f,_0x3ee9c5){_0x3ee9c5=_0x3ee9c5||0x1f4;return function(_0x53ba13){logger[_0x3eeb('0x20')](_0x53ba13['stack']);if(_0x53ba13['name']){delete _0x53ba13[_0x3eeb('0x21')];}_0x3de58f[_0x3eeb('0x14')](_0x3ee9c5)[_0x3eeb('0x22')](_0x53ba13);};}exports['update']=function(_0x54f80c,_0x371ff2){if(_0x54f80c['body']['id']){delete _0x54f80c['body']['id'];}return db[_0x3eeb('0x23')][_0x3eeb('0x24')]({'where':{'id':_0x54f80c[_0x3eeb('0x25')]['id']}})[_0x3eeb('0x1e')](handleEntityNotFound(_0x371ff2,null))[_0x3eeb('0x1e')](saveUpdates(_0x54f80c[_0x3eeb('0x26')],null))['then'](respondWithResult(_0x371ff2,null))['catch'](handleError(_0x371ff2,null));};exports[_0x3eeb('0x1f')]=function(_0x5b119d,_0x3768fa){return db['Action'][_0x3eeb('0x24')]({'where':{'id':_0x5b119d[_0x3eeb('0x25')]['id']}})[_0x3eeb('0x1e')](handleEntityNotFound(_0x3768fa,null))[_0x3eeb('0x1e')](removeEntity(_0x3768fa,null))[_0x3eeb('0x27')](handleError(_0x3768fa,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9fecbc4..405fd15 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 _0x8d03=['Action','../../config/logger','api','bluebird','rimraf','../../config/environment','./action.attributes','exports','define'];(function(_0x126895,_0x468fb0){var _0x2df6da=function(_0x3d1ee1){while(--_0x3d1ee1){_0x126895['push'](_0x126895['shift']());}};_0x2df6da(++_0x468fb0);}(_0x8d03,0xd0));var _0x38d0=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x8d03[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x38d0('0x0'))(_0x38d0('0x1'));var moment=require('moment');var BPromise=require(_0x38d0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x38d0('0x3'));var config=require(_0x38d0('0x4'));var attributes=require(_0x38d0('0x5'));module[_0x38d0('0x6')]=function(_0x1f9c92,_0x2289fc){return _0x1f9c92[_0x38d0('0x7')](_0x38d0('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a28=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions'];(function(_0xe55e2c,_0x1e0152){var _0x315d02=function(_0x1d7c9e){while(--_0x1d7c9e){_0xe55e2c['push'](_0xe55e2c['shift']());}};_0x315d02(++_0x1e0152);}(_0x5a28,0x1c7));var _0x85a2=function(_0x159468,_0x19e94c){_0x159468=_0x159468-0x0;var _0x2d9008=_0x5a28[_0x159468];return _0x2d9008;};'use strict';var _=require(_0x85a2('0x0'));var util=require(_0x85a2('0x1'));var logger=require(_0x85a2('0x2'))(_0x85a2('0x3'));var moment=require(_0x85a2('0x4'));var BPromise=require('bluebird');var rp=require(_0x85a2('0x5'));var fs=require('fs');var path=require(_0x85a2('0x6'));var rimraf=require(_0x85a2('0x7'));var config=require(_0x85a2('0x8'));var attributes=require(_0x85a2('0x9'));module['exports']=function(_0x147531,_0x2f8e92){return _0x147531[_0x85a2('0xa')](_0x85a2('0xb'),attributes,{'tableName':_0x85a2('0xc'),'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 711f593..ff13ce0 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x3528e1,_0x3a7c02){var _0x1e0216=function(_0x4bd7fa){while(--_0x4bd7fa){_0x3528e1['push'](_0x3528e1['shift']());}};_0x1e0216(++_0x3a7c02);}(_0xabce,0x103));var _0xeabc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xabce[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x231bba,_0x5eb1ac){var _0x446c0e=function(_0x51f4f6){while(--_0x51f4f6){_0x231bba['push'](_0x231bba['shift']());}};_0x446c0e(++_0x5eb1ac);}(_0xe14b,0x93));var _0xbe14=function(_0xcf42ea,_0x377d94){_0xcf42ea=_0xcf42ea-0x0;var _0x33dde6=_0xe14b[_0xcf42ea];return _0x33dde6;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7f5d092..515a16a 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 _0x3ffc=['/:id','isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put'];(function(_0x57fb1f,_0x2ff657){var _0x3330bd=function(_0xc31e1d){while(--_0xc31e1d){_0x57fb1f['push'](_0x57fb1f['shift']());}};_0x3330bd(++_0x2ff657);}(_0x3ffc,0xb8));var _0xc3ff=function(_0x425d5e,_0x3b9040){_0x425d5e=_0x425d5e-0x0;var _0x3cc67b=_0x3ffc[_0x425d5e];return _0x3cc67b;};'use strict';var multer=require('multer');var util=require(_0xc3ff('0x0'));var path=require(_0xc3ff('0x1'));var timeout=require(_0xc3ff('0x2'));var express=require(_0xc3ff('0x3'));var router=express[_0xc3ff('0x4')]();var fs_extra=require(_0xc3ff('0x5'));var auth=require(_0xc3ff('0x6'));var interaction=require(_0xc3ff('0x7'));var config=require(_0xc3ff('0x8'));var controller=require(_0xc3ff('0x9'));router[_0xc3ff('0xa')](_0xc3ff('0xb'),auth[_0xc3ff('0xc')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc3ff('0xd')]);module[_0xc3ff('0xe')]=router; \ No newline at end of file +var _0xe3c9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x57390d,_0x5746a0){var _0x59bd6a=function(_0x14effb){while(--_0x14effb){_0x57390d['push'](_0x57390d['shift']());}};_0x59bd6a(++_0x5746a0);}(_0xe3c9,0x14a));var _0x9e3c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe3c9[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x9e3c('0x0'));var util=require(_0x9e3c('0x1'));var path=require('path');var timeout=require(_0x9e3c('0x2'));var express=require(_0x9e3c('0x3'));var router=express[_0x9e3c('0x4')]();var fs_extra=require(_0x9e3c('0x5'));var auth=require(_0x9e3c('0x6'));var interaction=require(_0x9e3c('0x7'));var config=require(_0x9e3c('0x8'));var controller=require(_0x9e3c('0x9'));router['put'](_0x9e3c('0xa'),auth[_0x9e3c('0xb')](),controller[_0x9e3c('0xc')]);router[_0x9e3c('0xd')](_0x9e3c('0xa'),auth[_0x9e3c('0xb')](),controller[_0x9e3c('0xe')]);module[_0x9e3c('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 7dfeb81..2337d51 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 _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0xad3b12,_0xdffe90){var _0x2b9872=function(_0x49439b){while(--_0x49439b){_0xad3b12['push'](_0xad3b12['shift']());}};_0x2b9872(++_0xdffe90);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','TEXT'];(function(_0x5f1d74,_0x33e095){var _0xab75f5=function(_0x1765f1){while(--_0x1765f1){_0x5f1d74['push'](_0x5f1d74['shift']());}};_0xab75f5(++_0x33e095);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0x24ca[_0x4a82ac];return _0x58ee97;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 9361620..061f09a 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 _0xabe1=['query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','model','keys','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','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)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','group','DESC','alias','joins','includes','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','IS\x20NULL','operator','ValidationErrorItem','orderBy','output','web','fullPath','%s-%s.%s','generate','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','get','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','filters','intersection','attributes','fields'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xabe1,0x1c2));var _0x1abe=function(_0x4ddcec,_0x42870a){_0x4ddcec=_0x4ddcec-0x0;var _0x47fb0f=_0xabe1[_0x4ddcec];return _0x47fb0f;};'use strict';var emlformat=require(_0x1abe('0x0'));var rimraf=require(_0x1abe('0x1'));var zipdir=require(_0x1abe('0x2'));var jsonpatch=require(_0x1abe('0x3'));var rp=require(_0x1abe('0x4'));var moment=require(_0x1abe('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1abe('0x6'));var sox=require(_0x1abe('0x7'));var csv=require(_0x1abe('0x8'));var ejs=require(_0x1abe('0x9'));var fs=require('fs');var fs_extra=require(_0x1abe('0xa'));var _=require(_0x1abe('0xb'));var squel=require(_0x1abe('0xc'));var crypto=require(_0x1abe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1abe('0xe'));var toCsv=require(_0x1abe('0x8'));var querystring=require('querystring');var Papa=require(_0x1abe('0xf'));var Redis=require(_0x1abe('0x10'));var authService=require(_0x1abe('0x11'));var qs=require(_0x1abe('0x12'));var as=require(_0x1abe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1abe('0x14'))(_0x1abe('0x15'));var utils=require(_0x1abe('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1abe('0x17'))['db'];var dbH=require('../../mysqldb')[_0x1abe('0x18')];function respondWithStatusCode(_0x37d53d,_0x19d66b){_0x19d66b=_0x19d66b||0xcc;return function(_0x4f3ad1){if(_0x4f3ad1){return _0x37d53d[_0x1abe('0x19')](_0x19d66b);}return _0x37d53d[_0x1abe('0x1a')](_0x19d66b)[_0x1abe('0x1b')]();};}function respondWithResult(_0x4b809f,_0x3829f2){_0x3829f2=_0x3829f2||0xc8;return function(_0x225314){if(_0x225314){return _0x4b809f[_0x1abe('0x1a')](_0x3829f2)['json'](_0x225314);}};}function respondWithFilteredResult(_0x477fcf,_0x1ce694){return function(_0x1d0bba){if(_0x1d0bba){var _0x33478b=typeof _0x1ce694[_0x1abe('0x1c')]==='undefined'&&typeof _0x1ce694[_0x1abe('0x1d')]===_0x1abe('0x1e');var _0x18b6e3=_0x1d0bba['count'];var _0x39f6fc=_0x33478b?0x0:_0x1ce694[_0x1abe('0x1c')];var _0x35e7ee=_0x33478b?_0x1d0bba[_0x1abe('0x1f')]:_0x1ce694[_0x1abe('0x1c')]+_0x1ce694[_0x1abe('0x1d')];var _0x1c4ff0;if(_0x35e7ee>=_0x18b6e3){_0x35e7ee=_0x18b6e3;_0x1c4ff0=0xc8;}else{_0x1c4ff0=0xce;}_0x477fcf[_0x1abe('0x1a')](_0x1c4ff0);return _0x477fcf[_0x1abe('0x20')](_0x1abe('0x21'),_0x39f6fc+'-'+_0x35e7ee+'/'+_0x18b6e3)[_0x1abe('0x22')](_0x1d0bba);}return null;};}function patchUpdates(_0x56f2f9){return function(_0x572a6f){try{jsonpatch[_0x1abe('0x23')](_0x572a6f,_0x56f2f9,!![]);}catch(_0x28dc76){return BPromise[_0x1abe('0x24')](_0x28dc76);}return _0x572a6f[_0x1abe('0x25')]();};}function saveUpdates(_0xedf367,_0x11eecc){return function(_0x272911){if(_0x272911){return _0x272911['update'](_0xedf367)[_0x1abe('0x26')](function(_0x262107){return _0x262107;});}return null;};}function removeEntity(_0x4b9c5d,_0x1bcaa6){return function(_0x373bb1){if(_0x373bb1){return _0x373bb1[_0x1abe('0x27')]()[_0x1abe('0x26')](function(){var _0x5db149=_0x373bb1[_0x1abe('0x28')]({'plain':!![]});var _0x57c938=_0x1abe('0x29');return db['UserProfileResource'][_0x1abe('0x27')]({'where':{'type':_0x57c938,'resourceId':_0x5db149['id']}})[_0x1abe('0x26')](function(){return _0x373bb1;});})['then'](function(){_0x4b9c5d[_0x1abe('0x1a')](0xcc)[_0x1abe('0x1b')]();});}};}function handleEntityNotFound(_0x301248,_0x949016){return function(_0x548840){if(!_0x548840){_0x301248[_0x1abe('0x19')](0x194);}return _0x548840;};}function handleError(_0x265050,_0x298911){_0x298911=_0x298911||0x1f4;return function(_0x22be9b){logger[_0x1abe('0x2a')](_0x22be9b[_0x1abe('0x2b')]);if(_0x22be9b[_0x1abe('0x2c')]){delete _0x22be9b[_0x1abe('0x2c')];}_0x265050['status'](_0x298911)[_0x1abe('0x2d')](_0x22be9b);};}exports[_0x1abe('0x2e')]=function(_0x2d1f78,_0x149bda){var _0x5289d0={},_0xa632d4={},_0x168f8b={'count':0x0,'rows':[]};var _0xa1b8e9=_[_0x1abe('0x2f')](db[_0x1abe('0x30')][_0x1abe('0x31')],function(_0xd4ba27){return{'name':_0xd4ba27[_0x1abe('0x32')],'type':_0xd4ba27[_0x1abe('0x33')][_0x1abe('0x34')]};});_0xa632d4['model']=_[_0x1abe('0x2f')](_0xa1b8e9,_0x1abe('0x2c'));_0xa632d4['query']=_['keys'](_0x2d1f78['query']);_0xa632d4[_0x1abe('0x35')]=_[_0x1abe('0x36')](_0xa632d4['model'],_0xa632d4['query']);_0x5289d0[_0x1abe('0x37')]=_[_0x1abe('0x36')](_0xa632d4['model'],qs[_0x1abe('0x38')](_0x2d1f78[_0x1abe('0x39')][_0x1abe('0x38')]));_0x5289d0[_0x1abe('0x37')]=_0x5289d0['attributes']['length']?_0x5289d0[_0x1abe('0x37')]:_0xa632d4['model'];if(!_0x2d1f78['query'][_0x1abe('0x3a')](_0x1abe('0x3b'))){_0x5289d0['limit']=qs['limit'](_0x2d1f78[_0x1abe('0x39')]['limit']);_0x5289d0['offset']=qs[_0x1abe('0x1c')](_0x2d1f78[_0x1abe('0x39')][_0x1abe('0x1c')]);}_0x5289d0[_0x1abe('0x3c')]=qs[_0x1abe('0x3d')](_0x2d1f78[_0x1abe('0x39')][_0x1abe('0x3d')]);_0x5289d0[_0x1abe('0x3e')]=qs[_0x1abe('0x35')](_[_0x1abe('0x3f')](_0x2d1f78[_0x1abe('0x39')],_0xa632d4[_0x1abe('0x35')]),_0xa1b8e9);if(_0x2d1f78[_0x1abe('0x39')][_0x1abe('0x40')]){_0x5289d0[_0x1abe('0x3e')]=_[_0x1abe('0x41')](_0x5289d0[_0x1abe('0x3e')],{'$or':_[_0x1abe('0x2f')](_0xa1b8e9,function(_0x58b5d8){if(_0x58b5d8[_0x1abe('0x33')]!=='VIRTUAL'){var _0x11cf84={};_0x11cf84[_0x58b5d8['name']]={'$like':'%'+_0x2d1f78[_0x1abe('0x39')][_0x1abe('0x40')]+'%'};return _0x11cf84;}})});}_0x5289d0=_[_0x1abe('0x41')]({},_0x5289d0,_0x2d1f78[_0x1abe('0x42')]);var _0x5046eb={'where':_0x5289d0[_0x1abe('0x3e')]};return db[_0x1abe('0x30')][_0x1abe('0x1f')](_0x5046eb)['then'](function(_0x27e788){_0x168f8b['count']=_0x27e788;if(_0x2d1f78[_0x1abe('0x39')]['includeAll']){_0x5289d0[_0x1abe('0x43')]=[{'all':!![]}];}return db[_0x1abe('0x30')][_0x1abe('0x44')](_0x5289d0);})[_0x1abe('0x26')](function(_0x515395){_0x168f8b['rows']=_0x515395;return _0x168f8b;})[_0x1abe('0x26')](respondWithFilteredResult(_0x149bda,_0x5289d0))[_0x1abe('0x45')](handleError(_0x149bda,null));};exports[_0x1abe('0x46')]=function(_0x3e1c8a,_0x28eda0){var _0xb0e576={'raw':![],'where':{'id':_0x3e1c8a['params']['id']}},_0x59a749={};_0x59a749[_0x1abe('0x47')]=_[_0x1abe('0x48')](db[_0x1abe('0x30')]['rawAttributes']);_0x59a749[_0x1abe('0x39')]=_[_0x1abe('0x48')](_0x3e1c8a[_0x1abe('0x39')]);_0x59a749[_0x1abe('0x35')]=_[_0x1abe('0x36')](_0x59a749[_0x1abe('0x47')],_0x59a749[_0x1abe('0x39')]);_0xb0e576[_0x1abe('0x37')]=_['intersection'](_0x59a749['model'],qs['fields'](_0x3e1c8a[_0x1abe('0x39')][_0x1abe('0x38')]));_0xb0e576[_0x1abe('0x37')]=_0xb0e576[_0x1abe('0x37')][_0x1abe('0x49')]?_0xb0e576[_0x1abe('0x37')]:_0x59a749[_0x1abe('0x47')];if(_0x3e1c8a[_0x1abe('0x39')][_0x1abe('0x4a')]){_0xb0e576[_0x1abe('0x43')]=[{'all':!![]}];}_0xb0e576=_[_0x1abe('0x41')]({},_0xb0e576,_0x3e1c8a[_0x1abe('0x42')]);return db['AnalyticCustomReport'][_0x1abe('0x4b')](_0xb0e576)[_0x1abe('0x26')](handleEntityNotFound(_0x28eda0,null))[_0x1abe('0x26')](respondWithResult(_0x28eda0,null))['catch'](handleError(_0x28eda0,null));};exports['create']=function(_0x3c5038,_0x1f75ee){return db[_0x1abe('0x30')][_0x1abe('0x4c')](_0x3c5038[_0x1abe('0x4d')],{})[_0x1abe('0x26')](function(_0x582997){var _0xac1ba8=_0x3c5038[_0x1abe('0x4e')][_0x1abe('0x28')]({'plain':!![]});if(!_0xac1ba8)throw new Error(_0x1abe('0x4f'));if(_0xac1ba8[_0x1abe('0x50')]===_0x1abe('0x4e')){var _0x5aed68=_0x582997[_0x1abe('0x28')]({'plain':!![]});var _0x3f9930='Reports';return db[_0x1abe('0x51')][_0x1abe('0x4b')]({'where':{'name':_0x3f9930,'userProfileId':_0xac1ba8[_0x1abe('0x52')]},'raw':!![]})[_0x1abe('0x26')](function(_0x58803a){if(_0x58803a&&_0x58803a[_0x1abe('0x53')]===0x0){return db[_0x1abe('0x54')][_0x1abe('0x4c')]({'name':_0x5aed68['name'],'resourceId':_0x5aed68['id'],'type':_0x1abe('0x29'),'sectionId':_0x58803a['id']},{})[_0x1abe('0x26')](function(){return _0x582997;});}else{return _0x582997;}})['catch'](function(_0xbebd93){logger[_0x1abe('0x2a')](_0x1abe('0x55'),_0xbebd93);throw _0xbebd93;});}return _0x582997;})[_0x1abe('0x26')](respondWithResult(_0x1f75ee,0xc9))[_0x1abe('0x45')](handleError(_0x1f75ee,null));};exports[_0x1abe('0x56')]=function(_0x2ec980,_0x2ea6de){if(_0x2ec980[_0x1abe('0x4d')]['id']){delete _0x2ec980[_0x1abe('0x4d')]['id'];}return db['AnalyticCustomReport'][_0x1abe('0x4b')]({'where':{'id':_0x2ec980[_0x1abe('0x57')]['id']}})[_0x1abe('0x26')](handleEntityNotFound(_0x2ea6de,null))['then'](saveUpdates(_0x2ec980[_0x1abe('0x4d')],null))['then'](respondWithResult(_0x2ea6de,null))[_0x1abe('0x45')](handleError(_0x2ea6de,null));};exports[_0x1abe('0x27')]=function(_0x18ca08,_0x51ead5){return db[_0x1abe('0x30')][_0x1abe('0x4b')]({'where':{'id':_0x18ca08[_0x1abe('0x57')]['id']}})[_0x1abe('0x26')](handleEntityNotFound(_0x51ead5,null))[_0x1abe('0x26')](removeEntity(_0x51ead5,null))[_0x1abe('0x45')](handleError(_0x51ead5,null));};exports[_0x1abe('0x58')]=function(_0xe8529f,_0x137204){var _0x2e9f94=0xa;var _0x1ce8e6=[_0x1abe('0x59'),_0x1abe('0x5a'),_0x1abe('0x5b'),_0x1abe('0x5c')];var _0x4b14c5={'SUM':_0x1abe('0x5d'),'COUNT':_0x1abe('0x5e'),'COUNT DISTINCT':_0x1abe('0x5f'),'MAX':_0x1abe('0x60'),'MIN':_0x1abe('0x61'),'AVG':_0x1abe('0x62'),'GROUP_CONCAT':_0x1abe('0x63'),'GROUP_CONCAT ASC':_0x1abe('0x64'),'GROUP_CONCAT DESC':_0x1abe('0x65')};var _0x43924a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x1abe('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1abe('0x67')};var _0x282743=function(_0x8615f){return!_['includes'](['IS\x20NULL',_0x1abe('0x68'),_0x1abe('0x69'),_0x1abe('0x6a')],_0x8615f);};var _0x5b7d01=function(_0x591f3a){if(!_0x591f3a||!_0x591f3a[_0x1abe('0x6b')][_0x1abe('0x49')]){return'';}for(var _0xd1cbc0='(',_0x5c9d36=0x0;_0x5c9d36<_0x591f3a[_0x1abe('0x6b')][_0x1abe('0x49')];_0x5c9d36+=0x1){_0x5c9d36>0x0&&(_0xd1cbc0+='\x20'+_0x591f3a['operator']+'\x20');_0xd1cbc0+=_0x591f3a[_0x1abe('0x6b')][_0x5c9d36]['group']?_0x5b7d01(_0x591f3a[_0x1abe('0x6b')][_0x5c9d36]['group']):_0x591f3a['rules'][_0x5c9d36][_0x1abe('0x6c')]+'\x20'+_0x591f3a[_0x1abe('0x6b')][_0x5c9d36][_0x1abe('0x6d')]+(_0x282743(_0x591f3a['rules'][_0x5c9d36]['condition'])?'\x20'+_0x591f3a[_0x1abe('0x6b')][_0x5c9d36][_0x1abe('0x6e')]:'');}return _0xd1cbc0+')';};var _0x4e12e6={'where':{'id':_0xe8529f[_0x1abe('0x57')]['id']}},_0x54b36c,_0x567424,_0x22404f,_0x285968,_0x33ab1b;_0x4e12e6=_[_0x1abe('0x41')]({},_0x4e12e6,_0xe8529f['options']);return db[_0x1abe('0x30')]['find'](_0x4e12e6)['then'](function(_0xb78939){if(_0xb78939){_0x54b36c=_0xb78939;return _0xb78939[_0x1abe('0x6f')]();}return null;})[_0x1abe('0x26')](function(_0x418093){if(_0x418093){if(!_0x418093['length']){throw new db[(_0x1abe('0x70'))]['ValidationErrorItem'](_0x1abe('0x71'),0x193);}_0x567424=_0x418093;return db[_0x1abe('0x72')][_0x1abe('0x44')]({'raw':!![]});}return null;})[_0x1abe('0x26')](function(_0x1c9648){if(_0x1c9648){_0x22404f=_[_0x1abe('0x73')](_0x1c9648,'id');var _0x13457;var _0x20308b=squel[_0x1abe('0x74')]();_0x20308b[_0x1abe('0x75')](_0x54b36c[_0x1abe('0x76')]);for(var _0x5fefd1=0x0;_0x5fefd1<_0x567424['length'];_0x5fefd1+=0x1){_0x13457=_0x567424[_0x5fefd1][_0x1abe('0x77')]?_0x22404f[_0x567424[_0x5fefd1][_0x1abe('0x77')]][_0x1abe('0x78')]:_0x567424[_0x5fefd1][_0x1abe('0x6c')];_0x13457=_0x567424[_0x5fefd1][_0x1abe('0x79')]?_[_0x1abe('0x7a')](_0x4b14c5[_0x567424[_0x5fefd1]['function']],'%s',_0x13457):_0x13457;_0x13457=_0x567424[_0x5fefd1][_0x1abe('0x7b')]?_['replace'](_0x43924a[_0x567424[_0x5fefd1][_0x1abe('0x7b')]],'%s',_0x13457):_0x13457;if(_0x567424[_0x5fefd1][_0x1abe('0x7c')]){_0x20308b[_0x1abe('0x7d')](_0x13457);}_0x567424[_0x5fefd1]['orderBy']&&_0x20308b['order'](_0x13457,_0x567424[_0x5fefd1]['orderBy']===_0x1abe('0x7e')?![]:!![]);_0x20308b[_0x1abe('0x6c')](_0x13457,_0x567424[_0x5fefd1][_0x1abe('0x7f')]||_0x13457);}if(_0x54b36c[_0x1abe('0x80')]){_0x54b36c['joins']=JSON['parse'](_0x54b36c[_0x1abe('0x80')]);for(var _0x559ebf=0x0;_0x559ebf<_0x54b36c[_0x1abe('0x80')][_0x1abe('0x49')];_0x559ebf+=0x1){if(_0x54b36c[_0x1abe('0x80')][_0x559ebf][_0x1abe('0x33')]&&_[_0x1abe('0x81')](_0x1ce8e6,_0x54b36c[_0x1abe('0x80')][_0x559ebf][_0x1abe('0x33')])&&_0x54b36c[_0x1abe('0x80')][_0x559ebf][_0x1abe('0x82')]&&_0x54b36c['joins'][_0x559ebf]['foreignTable']&&_0x54b36c[_0x1abe('0x80')][_0x559ebf][_0x1abe('0x83')]){_0x20308b[_0x54b36c[_0x1abe('0x80')][_0x559ebf][_0x1abe('0x33')]](_0x54b36c['joins'][_0x559ebf][_0x1abe('0x84')],null,util[_0x1abe('0x7b')](_0x1abe('0x85'),_0x54b36c[_0x1abe('0x76')],_0x54b36c['joins'][_0x559ebf]['parentKey'],_0x54b36c[_0x1abe('0x80')][_0x559ebf][_0x1abe('0x84')],_0x54b36c[_0x1abe('0x80')][_0x559ebf][_0x1abe('0x83')]));}}}if(_0x54b36c[_0x1abe('0x86')]){_0x54b36c[_0x1abe('0x86')]=JSON[_0x1abe('0x87')](_0x54b36c[_0x1abe('0x86')]);_0x20308b[_0x1abe('0x3e')](_0x5b7d01(_0x54b36c[_0x1abe('0x86')][_0x1abe('0x7d')]));}_0x33ab1b=_0x20308b[_0x1abe('0x88')]();_0x20308b[_0x1abe('0x1d')](_0x2e9f94);_0x20308b[_0x1abe('0x1c')](0x0);logger[_0x1abe('0x89')](_0x1abe('0x8a'),_0x20308b[_0x1abe('0x8b')]());return dbH[_0x1abe('0x8c')][_0x1abe('0x39')](_0x20308b[_0x1abe('0x8b')](),{'type':dbH['sequelize']['QueryTypes'][_0x1abe('0x8d')]});}})[_0x1abe('0x26')](respondWithResult(_0x137204,null))[_0x1abe('0x45')](handleError(_0x137204,null));};function runReport(_0x5f5b96,_0xcd81d3,_0x23fb87){var _0x200bbf=_0xcd81d3[_0x1abe('0x2c')];var _0x40c856=0xa;var _0x5a9d90=[_0x1abe('0x59'),_0x1abe('0x5a'),'right_join','cross_join'];var _0xfcc419={'SUM':_0x1abe('0x5d'),'COUNT':_0x1abe('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1abe('0x60'),'MIN':_0x1abe('0x61'),'AVG':_0x1abe('0x62'),'GROUP_CONCAT':_0x1abe('0x63'),'GROUP_CONCAT ASC':_0x1abe('0x64'),'GROUP_CONCAT DESC':_0x1abe('0x65')};var _0x3b1621={'SEC_TO_TIME':_0x1abe('0x8e'),'DATE':_0x1abe('0x8f'),'HOUR':_0x1abe('0x66'),'ROUND':_0x1abe('0x90'),'UNIX_TIMESTAMP':_0x1abe('0x67')};var _0x33a025=function(_0x1700c9){return!_['includes']([_0x1abe('0x91'),_0x1abe('0x68'),_0x1abe('0x69'),_0x1abe('0x6a')],_0x1700c9);};var _0xb6fd3f=function(_0x49836f){if(!_0x49836f||!_0x49836f[_0x1abe('0x6b')][_0x1abe('0x49')]){return'';}for(var _0x5a3652='(',_0x447f23=0x0;_0x447f23<_0x49836f['rules']['length'];_0x447f23+=0x1){_0x447f23>0x0&&(_0x5a3652+='\x20'+_0x49836f[_0x1abe('0x92')]+'\x20');_0x5a3652+=_0x49836f[_0x1abe('0x6b')][_0x447f23][_0x1abe('0x7d')]?_0xb6fd3f(_0x49836f[_0x1abe('0x6b')][_0x447f23][_0x1abe('0x7d')]):_0x49836f[_0x1abe('0x6b')][_0x447f23][_0x1abe('0x6c')]+'\x20'+_0x49836f['rules'][_0x447f23][_0x1abe('0x6d')]+(_0x33a025(_0x49836f['rules'][_0x447f23]['condition'])?'\x20'+_0x49836f[_0x1abe('0x6b')][_0x447f23]['value']:'');}return _0x5a3652+')';};var _0x43e1ad={'where':{'id':_0x5f5b96['id']}},_0x1673d2,_0x4d84b5,_0x2bb08d,_0x49bf0a,_0x344f78;_0x43e1ad=_[_0x1abe('0x41')]({},_0x43e1ad,_0x23fb87);return db[_0x1abe('0x30')]['find'](_0x43e1ad)[_0x1abe('0x26')](function(_0x2abe49){if(_0x2abe49){_0x1673d2=_0x2abe49;return _0x2abe49[_0x1abe('0x6f')]();}return null;})[_0x1abe('0x26')](function(_0xe6d4c5){if(_0xe6d4c5){if(!_0xe6d4c5[_0x1abe('0x49')]){throw new db['Sequelize'][(_0x1abe('0x93'))](_0x1abe('0x71'),0x193);}_0x4d84b5=_0xe6d4c5;return db[_0x1abe('0x72')][_0x1abe('0x44')]({'raw':!![]});}return null;})[_0x1abe('0x26')](function(_0x343dde){if(_0x343dde){_0x2bb08d=_[_0x1abe('0x73')](_0x343dde,'id');var _0x438024;var _0x24b360=squel['select']();_0x24b360['from'](_0x1673d2[_0x1abe('0x76')]);for(var _0x1a1a9d=0x0;_0x1a1a9d<_0x4d84b5[_0x1abe('0x49')];_0x1a1a9d+=0x1){_0x438024=_0x4d84b5[_0x1a1a9d]['MetricId']?_0x2bb08d[_0x4d84b5[_0x1a1a9d][_0x1abe('0x77')]][_0x1abe('0x78')]:_0x4d84b5[_0x1a1a9d][_0x1abe('0x6c')];_0x438024=_0x4d84b5[_0x1a1a9d][_0x1abe('0x79')]?_['replace'](_0xfcc419[_0x4d84b5[_0x1a1a9d][_0x1abe('0x79')]],'%s',_0x438024):_0x438024;_0x438024=_0x4d84b5[_0x1a1a9d][_0x1abe('0x7b')]?_['replace'](_0x3b1621[_0x4d84b5[_0x1a1a9d][_0x1abe('0x7b')]],'%s',_0x438024):_0x438024;if(_0x4d84b5[_0x1a1a9d][_0x1abe('0x7c')]){_0x24b360['group'](_0x438024);}_0x4d84b5[_0x1a1a9d][_0x1abe('0x94')]&&_0x24b360['order'](_0x438024,_0x4d84b5[_0x1a1a9d][_0x1abe('0x94')]===_0x1abe('0x7e')?![]:!![]);_0x24b360['field'](_0x438024,_0x4d84b5[_0x1a1a9d][_0x1abe('0x7f')]||_0x438024);}if(_0x1673d2[_0x1abe('0x80')]){_0x1673d2[_0x1abe('0x80')]=JSON['parse'](_0x1673d2['joins']);for(var _0x4197ee=0x0;_0x4197ee<_0x1673d2['joins'][_0x1abe('0x49')];_0x4197ee+=0x1){if(_0x1673d2[_0x1abe('0x80')][_0x4197ee][_0x1abe('0x33')]&&_[_0x1abe('0x81')](_0x5a9d90,_0x1673d2[_0x1abe('0x80')][_0x4197ee]['type'])&&_0x1673d2[_0x1abe('0x80')][_0x4197ee][_0x1abe('0x82')]&&_0x1673d2[_0x1abe('0x80')][_0x4197ee]['foreignTable']&&_0x1673d2[_0x1abe('0x80')][_0x4197ee][_0x1abe('0x83')]){_0x24b360[_0x1673d2[_0x1abe('0x80')][_0x4197ee][_0x1abe('0x33')]](_0x1673d2[_0x1abe('0x80')][_0x4197ee][_0x1abe('0x84')],null,util[_0x1abe('0x7b')](_0x1abe('0x85'),_0x1673d2[_0x1abe('0x76')],_0x1673d2[_0x1abe('0x80')][_0x4197ee][_0x1abe('0x82')],_0x1673d2[_0x1abe('0x80')][_0x4197ee][_0x1abe('0x84')],_0x1673d2[_0x1abe('0x80')][_0x4197ee][_0x1abe('0x83')]));}}}if(_0x1673d2[_0x1abe('0x86')]){_0x1673d2['conditions']=JSON['parse'](_0x1673d2['conditions']);_0x24b360[_0x1abe('0x3e')](_0xb6fd3f(_0x1673d2[_0x1abe('0x86')]['group']));}_0x344f78=_0x24b360['clone']();_0x24b360[_0x1abe('0x1d')](_0x40c856);_0x24b360['offset'](0x0);return;}})[_0x1abe('0x26')](function(){if(_0xcd81d3[_0x1abe('0x95')]===_0x1abe('0x96')){return null;}var _0x23432b=_[_0x1abe('0x41')](_0xcd81d3,{'name':_0xcd81d3[_0x1abe('0x97')]||_0xcd81d3[_0x1abe('0x2c')]||_0x1673d2[_0x1abe('0x2c')],'basename':_0x200bbf,'savename':util[_0x1abe('0x7b')](_0x1abe('0x98'),_0xcd81d3[_0x1abe('0x2c')]||_0x1673d2['name'],require('randomstring')[_0x1abe('0x99')](0x4),_0xcd81d3[_0x1abe('0x95')]||'csv'),'reportId':_0x1673d2['id'],'reportType':'custom'});return db[_0x1abe('0x9a')][_0x1abe('0x4c')](_0x23432b,{'raw':!![]});})['then'](function(_0xda1f04){if(_0x1673d2[_0x1abe('0x76')]===_0x1abe('0x9b')){_0x344f78[_0x1abe('0x3e')](_0x1673d2[_0x1abe('0x76')]+_0x1abe('0x9c'),_0xcd81d3[_0x1abe('0x9d')],_0xcd81d3['endDate']);}else{_0x344f78['where'](_0x1673d2[_0x1abe('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xcd81d3[_0x1abe('0x9d')],_0xcd81d3[_0x1abe('0x9e')]);}if(_0xda1f04){logger[_0x1abe('0x9f')]('Run\x20Query:',_0x344f78['toString']());require('child_process')[_0x1abe('0xa0')](path['join'](__dirname,_0x1abe('0xa1'),_0xda1f04[_0x1abe('0x95')]),[_0xda1f04['id'],_0x344f78['toString'](),path['join'](__dirname,_0x1abe('0xa2'),_0xda1f04[_0x1abe('0xa3')]),_0x200bbf]);return _0xda1f04;}else{var _0x21760e=squel['select']();_0x21760e[_0x1abe('0x75')]('('+_0x344f78[_0x1abe('0x8b')]()+')',_0x1abe('0xa4'));_0x21760e['field'](_0x1abe('0xa5'),_0x1abe('0x1f'));_0x344f78['limit'](_0xcd81d3[_0x1abe('0x1d')]||_0x40c856);_0x344f78[_0x1abe('0x1c')](_0xcd81d3['offset']||0x0);return dbH[_0x1abe('0x8c')][_0x1abe('0x39')](_0x21760e[_0x1abe('0x8b')](),{'type':dbH['sequelize'][_0x1abe('0xa6')][_0x1abe('0x8d')]})[_0x1abe('0x26')](function(_0x4962bb){if(!_0x4962bb['length']){_0x49bf0a=0x0;}else{_0x49bf0a=_0x4962bb[0x0][_0x1abe('0x1f')]||0x0;}return dbH[_0x1abe('0x8c')][_0x1abe('0x39')](_0x344f78['toString'](),{'type':dbH[_0x1abe('0x8c')]['QueryTypes'][_0x1abe('0x8d')]});})[_0x1abe('0x26')](function(_0x3ca21a){return{'rows':_0x3ca21a||[],'count':_0x49bf0a};});}});}exports[_0x1abe('0xa7')]=function(_0x3421bd,_0x35b1db){return runReport(_0x3421bd[_0x1abe('0x57')],_0x3421bd['query'],_0x3421bd[_0x1abe('0x42')])[_0x1abe('0x26')](respondWithResult(_0x35b1db,null))[_0x1abe('0x45')](handleError(_0x35b1db,null));};exports[_0x1abe('0xa8')]=runReport;exports[_0x1abe('0x39')]=function(_0x3d5137,_0x225fa){var _0x37e76f=0xa;var _0x2ede05=[_0x1abe('0x59'),_0x1abe('0x5a'),'right_join',_0x1abe('0x5c')];var _0x13a5f1={'SUM':_0x1abe('0x5d'),'COUNT':_0x1abe('0x5e'),'COUNT DISTINCT':_0x1abe('0x5f'),'MAX':_0x1abe('0x60'),'MIN':_0x1abe('0x61'),'AVG':_0x1abe('0x62'),'GROUP_CONCAT':_0x1abe('0x63'),'GROUP_CONCAT ASC':_0x1abe('0x64'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xa17df7={'SEC_TO_TIME':_0x1abe('0x8e'),'DATE':_0x1abe('0x8f'),'HOUR':_0x1abe('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1abe('0x67')};var _0x2d2ed0=function(_0x3e305e){return!_[_0x1abe('0x81')]([_0x1abe('0x91'),_0x1abe('0x68'),_0x1abe('0x69'),_0x1abe('0x6a')],_0x3e305e);};var _0x9fcafd=function(_0x57d328){if(!_0x57d328||!_0x57d328[_0x1abe('0x6b')][_0x1abe('0x49')]){return'';}for(var _0x4e3eab='(',_0x4bb1d9=0x0;_0x4bb1d9<_0x57d328['rules']['length'];_0x4bb1d9+=0x1){_0x4bb1d9>0x0&&(_0x4e3eab+='\x20'+_0x57d328[_0x1abe('0x92')]+'\x20');_0x4e3eab+=_0x57d328['rules'][_0x4bb1d9]['group']?_0x9fcafd(_0x57d328[_0x1abe('0x6b')][_0x4bb1d9]['group']):_0x57d328[_0x1abe('0x6b')][_0x4bb1d9]['field']+'\x20'+_0x57d328['rules'][_0x4bb1d9]['condition']+(_0x2d2ed0(_0x57d328[_0x1abe('0x6b')][_0x4bb1d9][_0x1abe('0x6d')])?'\x20'+_0x57d328[_0x1abe('0x6b')][_0x4bb1d9][_0x1abe('0x6e')]:'');}return _0x4e3eab+')';};var _0xd013d4={'where':{'id':_0x3d5137['params']['id']}},_0xf2660,_0xb7ef29,_0x4036f7,_0x4d58da,_0x4884cd;_0xd013d4=_[_0x1abe('0x41')]({},_0xd013d4,_0x3d5137[_0x1abe('0x42')]);return db[_0x1abe('0x30')][_0x1abe('0x4b')](_0xd013d4)[_0x1abe('0x26')](function(_0x4ee4be){if(_0x4ee4be){_0xf2660=_0x4ee4be;return _0x4ee4be['getFields']();}return null;})[_0x1abe('0x26')](function(_0x24aa67){if(_0x24aa67){if(!_0x24aa67['length']){throw new db[(_0x1abe('0x70'))][(_0x1abe('0x93'))](_0x1abe('0x71'),0x193);}_0xb7ef29=_0x24aa67;return db[_0x1abe('0x72')][_0x1abe('0x44')]({'raw':!![]});}return null;})[_0x1abe('0x26')](function(_0x5a6039){if(_0x5a6039){_0x4036f7=_[_0x1abe('0x73')](_0x5a6039,'id');var _0x3c9d64;var _0x43321c=squel[_0x1abe('0x74')]();_0x43321c['from'](_0xf2660['table']);for(var _0x4a7788=0x0;_0x4a7788<_0xb7ef29[_0x1abe('0x49')];_0x4a7788+=0x1){_0x3c9d64=_0xb7ef29[_0x4a7788]['MetricId']?_0x4036f7[_0xb7ef29[_0x4a7788]['MetricId']][_0x1abe('0x78')]:_0xb7ef29[_0x4a7788][_0x1abe('0x6c')];_0x3c9d64=_0xb7ef29[_0x4a7788][_0x1abe('0x79')]?_['replace'](_0x13a5f1[_0xb7ef29[_0x4a7788][_0x1abe('0x79')]],'%s',_0x3c9d64):_0x3c9d64;_0x3c9d64=_0xb7ef29[_0x4a7788][_0x1abe('0x7b')]?_[_0x1abe('0x7a')](_0xa17df7[_0xb7ef29[_0x4a7788]['format']],'%s',_0x3c9d64):_0x3c9d64;if(_0xb7ef29[_0x4a7788]['groupBy']){_0x43321c[_0x1abe('0x7d')](_0x3c9d64);}_0xb7ef29[_0x4a7788][_0x1abe('0x94')]&&_0x43321c['order'](_0x3c9d64,_0xb7ef29[_0x4a7788][_0x1abe('0x94')]==='DESC'?![]:!![]);_0x43321c[_0x1abe('0x6c')](_0x3c9d64,_0xb7ef29[_0x4a7788][_0x1abe('0x7f')]||_0x3c9d64);}if(_0xf2660[_0x1abe('0x80')]){_0xf2660[_0x1abe('0x80')]=JSON[_0x1abe('0x87')](_0xf2660[_0x1abe('0x80')]);for(var _0xd2fc1=0x0;_0xd2fc1<_0xf2660[_0x1abe('0x80')]['length'];_0xd2fc1+=0x1){if(_0xf2660['joins'][_0xd2fc1][_0x1abe('0x33')]&&_['includes'](_0x2ede05,_0xf2660[_0x1abe('0x80')][_0xd2fc1]['type'])&&_0xf2660['joins'][_0xd2fc1]['parentKey']&&_0xf2660[_0x1abe('0x80')][_0xd2fc1][_0x1abe('0x84')]&&_0xf2660[_0x1abe('0x80')][_0xd2fc1]['foreignKey']){_0x43321c[_0xf2660['joins'][_0xd2fc1][_0x1abe('0x33')]](_0xf2660[_0x1abe('0x80')][_0xd2fc1][_0x1abe('0x84')],null,util[_0x1abe('0x7b')](_0x1abe('0x85'),_0xf2660[_0x1abe('0x76')],_0xf2660[_0x1abe('0x80')][_0xd2fc1][_0x1abe('0x82')],_0xf2660[_0x1abe('0x80')][_0xd2fc1][_0x1abe('0x84')],_0xf2660['joins'][_0xd2fc1][_0x1abe('0x83')]));}}}if(_0xf2660[_0x1abe('0x86')]){_0xf2660['conditions']=JSON[_0x1abe('0x87')](_0xf2660['conditions']);_0x43321c[_0x1abe('0x3e')](_0x9fcafd(_0xf2660[_0x1abe('0x86')][_0x1abe('0x7d')]));}_0x4884cd=_0x43321c['clone']();_0x43321c['limit'](_0x37e76f);_0x43321c[_0x1abe('0x1c')](0x0);logger[_0x1abe('0x89')](_0x1abe('0x8a'),_0x43321c[_0x1abe('0x8b')]());return dbH[_0x1abe('0x8c')][_0x1abe('0x39')](_0x43321c[_0x1abe('0x8b')](),{'type':dbH['sequelize'][_0x1abe('0xa6')][_0x1abe('0x8d')]});}})[_0x1abe('0x26')](function(){return{'sql':_0x4884cd[_0x1abe('0x8b')]()};})[_0x1abe('0x26')](respondWithResult(_0x225fa,null))['catch'](handleError(_0x225fa,null));}; \ No newline at end of file +var _0xd978=['IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','sequelize','toString','QueryTypes','SELECT','MIN(%s)','UNIX_TIMESTAMP(%s)','value','ValidationErrorItem','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','fork','../../components/export/','savename','from','countTable','COUNT(*)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','offset','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','get','CustomReports','sendStatus','error','stack','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','params','preview','join','left_join','right_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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd978,0x186));var _0x8d97=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xd978[_0x269ee8];return _0x4d98bd;};'use strict';var emlformat=require(_0x8d97('0x0'));var rimraf=require(_0x8d97('0x1'));var zipdir=require(_0x8d97('0x2'));var jsonpatch=require(_0x8d97('0x3'));var rp=require(_0x8d97('0x4'));var moment=require(_0x8d97('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8d97('0x6'));var util=require(_0x8d97('0x7'));var path=require('path');var sox=require(_0x8d97('0x8'));var csv=require(_0x8d97('0x9'));var ejs=require(_0x8d97('0xa'));var fs=require('fs');var fs_extra=require(_0x8d97('0xb'));var _=require(_0x8d97('0xc'));var squel=require('squel');var crypto=require(_0x8d97('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8d97('0xe'));var toCsv=require(_0x8d97('0x9'));var querystring=require(_0x8d97('0xf'));var Papa=require(_0x8d97('0x10'));var Redis=require('ioredis');var authService=require(_0x8d97('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8d97('0x12'));var hardwareService=require(_0x8d97('0x13'));var logger=require(_0x8d97('0x14'))(_0x8d97('0x15'));var utils=require(_0x8d97('0x16'));var config=require(_0x8d97('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x8d97('0x18'))[_0x8d97('0x19')];function respondWithStatusCode(_0x1273d9,_0x47031d){_0x47031d=_0x47031d||0xcc;return function(_0x537838){if(_0x537838){return _0x1273d9['sendStatus'](_0x47031d);}return _0x1273d9[_0x8d97('0x1a')](_0x47031d)[_0x8d97('0x1b')]();};}function respondWithResult(_0x4a45fd,_0x4c77dd){_0x4c77dd=_0x4c77dd||0xc8;return function(_0x201443){if(_0x201443){return _0x4a45fd[_0x8d97('0x1a')](_0x4c77dd)['json'](_0x201443);}};}function respondWithFilteredResult(_0x2fb49c,_0xf30378){return function(_0x2df358){if(_0x2df358){var _0x46462b=typeof _0xf30378[_0x8d97('0x1c')]==='undefined'&&typeof _0xf30378[_0x8d97('0x1d')]==='undefined';var _0x35425c=_0x2df358[_0x8d97('0x1e')];var _0x4130aa=_0x46462b?0x0:_0xf30378['offset'];var _0x2e73b5=_0x46462b?_0x2df358[_0x8d97('0x1e')]:_0xf30378[_0x8d97('0x1c')]+_0xf30378[_0x8d97('0x1d')];var _0x39a833;if(_0x2e73b5>=_0x35425c){_0x2e73b5=_0x35425c;_0x39a833=0xc8;}else{_0x39a833=0xce;}_0x2fb49c[_0x8d97('0x1a')](_0x39a833);return _0x2fb49c['set'](_0x8d97('0x1f'),_0x4130aa+'-'+_0x2e73b5+'/'+_0x35425c)[_0x8d97('0x20')](_0x2df358);}return null;};}function patchUpdates(_0x194161){return function(_0x1210fa){try{jsonpatch[_0x8d97('0x21')](_0x1210fa,_0x194161,!![]);}catch(_0x5e31e5){return BPromise[_0x8d97('0x22')](_0x5e31e5);}return _0x1210fa[_0x8d97('0x23')]();};}function saveUpdates(_0x2b90f7,_0x1fa54d){return function(_0x1d2623){if(_0x1d2623){return _0x1d2623[_0x8d97('0x24')](_0x2b90f7)['then'](function(_0x720d0d){return _0x720d0d;});}return null;};}function removeEntity(_0x1ba65b,_0x20962a){return function(_0x127e39){if(_0x127e39){return _0x127e39[_0x8d97('0x25')]()[_0x8d97('0x26')](function(){var _0x59bf41=_0x127e39[_0x8d97('0x27')]({'plain':!![]});var _0x11ac11=_0x8d97('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x11ac11,'resourceId':_0x59bf41['id']}})[_0x8d97('0x26')](function(){return _0x127e39;});})[_0x8d97('0x26')](function(){_0x1ba65b['status'](0xcc)[_0x8d97('0x1b')]();});}};}function handleEntityNotFound(_0x39593e,_0x31c914){return function(_0x3751f5){if(!_0x3751f5){_0x39593e[_0x8d97('0x29')](0x194);}return _0x3751f5;};}function handleError(_0x20ffa3,_0x8282c6){_0x8282c6=_0x8282c6||0x1f4;return function(_0x40744d){logger[_0x8d97('0x2a')](_0x40744d[_0x8d97('0x2b')]);if(_0x40744d['name']){delete _0x40744d['name'];}_0x20ffa3[_0x8d97('0x1a')](_0x8282c6)[_0x8d97('0x2c')](_0x40744d);};}exports[_0x8d97('0x2d')]=function(_0x257a77,_0x120e3b){var _0x2bf51d={},_0x42a5eb={},_0x45828b={'count':0x0,'rows':[]};var _0x8e37ec=_[_0x8d97('0x2e')](db[_0x8d97('0x2f')][_0x8d97('0x30')],function(_0x4c0f88){return{'name':_0x4c0f88[_0x8d97('0x31')],'type':_0x4c0f88[_0x8d97('0x32')]['key']};});_0x42a5eb[_0x8d97('0x33')]=_[_0x8d97('0x2e')](_0x8e37ec,_0x8d97('0x34'));_0x42a5eb[_0x8d97('0x35')]=_[_0x8d97('0x36')](_0x257a77[_0x8d97('0x35')]);_0x42a5eb[_0x8d97('0x37')]=_[_0x8d97('0x38')](_0x42a5eb['model'],_0x42a5eb['query']);_0x2bf51d['attributes']=_[_0x8d97('0x38')](_0x42a5eb[_0x8d97('0x33')],qs[_0x8d97('0x39')](_0x257a77[_0x8d97('0x35')][_0x8d97('0x39')]));_0x2bf51d['attributes']=_0x2bf51d[_0x8d97('0x3a')][_0x8d97('0x3b')]?_0x2bf51d[_0x8d97('0x3a')]:_0x42a5eb[_0x8d97('0x33')];if(!_0x257a77[_0x8d97('0x35')][_0x8d97('0x3c')](_0x8d97('0x3d'))){_0x2bf51d[_0x8d97('0x1d')]=qs[_0x8d97('0x1d')](_0x257a77['query'][_0x8d97('0x1d')]);_0x2bf51d['offset']=qs[_0x8d97('0x1c')](_0x257a77[_0x8d97('0x35')][_0x8d97('0x1c')]);}_0x2bf51d[_0x8d97('0x3e')]=qs[_0x8d97('0x3f')](_0x257a77[_0x8d97('0x35')][_0x8d97('0x3f')]);_0x2bf51d[_0x8d97('0x40')]=qs['filters'](_[_0x8d97('0x41')](_0x257a77[_0x8d97('0x35')],_0x42a5eb['filters']),_0x8e37ec);if(_0x257a77['query'][_0x8d97('0x42')]){_0x2bf51d[_0x8d97('0x40')]=_[_0x8d97('0x43')](_0x2bf51d[_0x8d97('0x40')],{'$or':_[_0x8d97('0x2e')](_0x8e37ec,function(_0x32fb7d){if(_0x32fb7d[_0x8d97('0x32')]!==_0x8d97('0x44')){var _0x3294a6={};_0x3294a6[_0x32fb7d[_0x8d97('0x34')]]={'$like':'%'+_0x257a77['query'][_0x8d97('0x42')]+'%'};return _0x3294a6;}})});}_0x2bf51d=_[_0x8d97('0x43')]({},_0x2bf51d,_0x257a77[_0x8d97('0x45')]);var _0x11212f={'where':_0x2bf51d[_0x8d97('0x40')]};return db[_0x8d97('0x2f')]['count'](_0x11212f)['then'](function(_0xda83b0){_0x45828b[_0x8d97('0x1e')]=_0xda83b0;if(_0x257a77[_0x8d97('0x35')][_0x8d97('0x46')]){_0x2bf51d[_0x8d97('0x47')]=[{'all':!![]}];}return db[_0x8d97('0x2f')][_0x8d97('0x48')](_0x2bf51d);})['then'](function(_0x428540){_0x45828b['rows']=_0x428540;return _0x45828b;})[_0x8d97('0x26')](respondWithFilteredResult(_0x120e3b,_0x2bf51d))[_0x8d97('0x49')](handleError(_0x120e3b,null));};exports[_0x8d97('0x4a')]=function(_0x2688be,_0x408c22){var _0xe431a2={'raw':![],'where':{'id':_0x2688be['params']['id']}},_0x1a883e={};_0x1a883e['model']=_[_0x8d97('0x36')](db[_0x8d97('0x2f')]['rawAttributes']);_0x1a883e[_0x8d97('0x35')]=_[_0x8d97('0x36')](_0x2688be[_0x8d97('0x35')]);_0x1a883e[_0x8d97('0x37')]=_['intersection'](_0x1a883e[_0x8d97('0x33')],_0x1a883e[_0x8d97('0x35')]);_0xe431a2[_0x8d97('0x3a')]=_[_0x8d97('0x38')](_0x1a883e[_0x8d97('0x33')],qs[_0x8d97('0x39')](_0x2688be[_0x8d97('0x35')][_0x8d97('0x39')]));_0xe431a2[_0x8d97('0x3a')]=_0xe431a2[_0x8d97('0x3a')][_0x8d97('0x3b')]?_0xe431a2[_0x8d97('0x3a')]:_0x1a883e[_0x8d97('0x33')];if(_0x2688be['query'][_0x8d97('0x46')]){_0xe431a2[_0x8d97('0x47')]=[{'all':!![]}];}_0xe431a2=_[_0x8d97('0x43')]({},_0xe431a2,_0x2688be[_0x8d97('0x45')]);return db['AnalyticCustomReport'][_0x8d97('0x4b')](_0xe431a2)[_0x8d97('0x26')](handleEntityNotFound(_0x408c22,null))[_0x8d97('0x26')](respondWithResult(_0x408c22,null))[_0x8d97('0x49')](handleError(_0x408c22,null));};exports['create']=function(_0x21bce2,_0x36a086){return db[_0x8d97('0x2f')][_0x8d97('0x4c')](_0x21bce2[_0x8d97('0x4d')],{})[_0x8d97('0x26')](function(_0x35ae34){var _0x3dcfc9=_0x21bce2[_0x8d97('0x4e')]['get']({'plain':!![]});if(!_0x3dcfc9)throw new Error(_0x8d97('0x4f'));if(_0x3dcfc9[_0x8d97('0x50')]===_0x8d97('0x4e')){var _0x1ae33f=_0x35ae34[_0x8d97('0x27')]({'plain':!![]});var _0x2548b3=_0x8d97('0x51');return db[_0x8d97('0x52')][_0x8d97('0x4b')]({'where':{'name':_0x2548b3,'userProfileId':_0x3dcfc9[_0x8d97('0x53')]},'raw':!![]})[_0x8d97('0x26')](function(_0x8ad7ee){if(_0x8ad7ee&&_0x8ad7ee['autoAssociation']===0x0){return db[_0x8d97('0x54')][_0x8d97('0x4c')]({'name':_0x1ae33f[_0x8d97('0x34')],'resourceId':_0x1ae33f['id'],'type':_0x8d97('0x28'),'sectionId':_0x8ad7ee['id']},{})['then'](function(){return _0x35ae34;});}else{return _0x35ae34;}})[_0x8d97('0x49')](function(_0x1c2f11){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c2f11);throw _0x1c2f11;});}return _0x35ae34;})['then'](respondWithResult(_0x36a086,0xc9))[_0x8d97('0x49')](handleError(_0x36a086,null));};exports[_0x8d97('0x24')]=function(_0x26a804,_0x4d8aba){if(_0x26a804[_0x8d97('0x4d')]['id']){delete _0x26a804[_0x8d97('0x4d')]['id'];}return db['AnalyticCustomReport'][_0x8d97('0x4b')]({'where':{'id':_0x26a804[_0x8d97('0x55')]['id']}})[_0x8d97('0x26')](handleEntityNotFound(_0x4d8aba,null))[_0x8d97('0x26')](saveUpdates(_0x26a804[_0x8d97('0x4d')],null))[_0x8d97('0x26')](respondWithResult(_0x4d8aba,null))['catch'](handleError(_0x4d8aba,null));};exports[_0x8d97('0x25')]=function(_0x208765,_0x576d9a){return db[_0x8d97('0x2f')][_0x8d97('0x4b')]({'where':{'id':_0x208765[_0x8d97('0x55')]['id']}})[_0x8d97('0x26')](handleEntityNotFound(_0x576d9a,null))['then'](removeEntity(_0x576d9a,null))[_0x8d97('0x49')](handleError(_0x576d9a,null));};exports[_0x8d97('0x56')]=function(_0x572bdb,_0x37796a){var _0x4c50cd=0xa;var _0x20a667=[_0x8d97('0x57'),_0x8d97('0x58'),_0x8d97('0x59'),_0x8d97('0x5a')];var _0x29f256={'SUM':_0x8d97('0x5b'),'COUNT':_0x8d97('0x5c'),'COUNT DISTINCT':_0x8d97('0x5d'),'MAX':_0x8d97('0x5e'),'MIN':'MIN(%s)','AVG':_0x8d97('0x5f'),'GROUP_CONCAT':_0x8d97('0x60'),'GROUP_CONCAT ASC':_0x8d97('0x61'),'GROUP_CONCAT DESC':_0x8d97('0x62')};var _0x255c0b={'SEC_TO_TIME':_0x8d97('0x63'),'DATE':_0x8d97('0x64'),'HOUR':_0x8d97('0x65'),'ROUND':_0x8d97('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x361db1=function(_0x8759bd){return!_[_0x8d97('0x67')]([_0x8d97('0x68'),'IS\x20NOT\x20NULL',_0x8d97('0x69'),_0x8d97('0x6a')],_0x8759bd);};var _0x4f84b0=function(_0x1bff9d){if(!_0x1bff9d||!_0x1bff9d[_0x8d97('0x6b')][_0x8d97('0x3b')]){return'';}for(var _0xabf76c='(',_0x3fb655=0x0;_0x3fb655<_0x1bff9d['rules'][_0x8d97('0x3b')];_0x3fb655+=0x1){_0x3fb655>0x0&&(_0xabf76c+='\x20'+_0x1bff9d[_0x8d97('0x6c')]+'\x20');_0xabf76c+=_0x1bff9d[_0x8d97('0x6b')][_0x3fb655][_0x8d97('0x6d')]?_0x4f84b0(_0x1bff9d[_0x8d97('0x6b')][_0x3fb655][_0x8d97('0x6d')]):_0x1bff9d[_0x8d97('0x6b')][_0x3fb655]['field']+'\x20'+_0x1bff9d['rules'][_0x3fb655][_0x8d97('0x6e')]+(_0x361db1(_0x1bff9d[_0x8d97('0x6b')][_0x3fb655][_0x8d97('0x6e')])?'\x20'+_0x1bff9d[_0x8d97('0x6b')][_0x3fb655]['value']:'');}return _0xabf76c+')';};var _0x2e6f3d={'where':{'id':_0x572bdb['params']['id']}},_0x1e3934,_0x4c9748,_0x258512,_0x49aa7e,_0x12b0f3;_0x2e6f3d=_[_0x8d97('0x43')]({},_0x2e6f3d,_0x572bdb[_0x8d97('0x45')]);return db[_0x8d97('0x2f')][_0x8d97('0x4b')](_0x2e6f3d)[_0x8d97('0x26')](function(_0x4d17f2){if(_0x4d17f2){_0x1e3934=_0x4d17f2;return _0x4d17f2[_0x8d97('0x6f')]();}return null;})[_0x8d97('0x26')](function(_0x588471){if(_0x588471){if(!_0x588471[_0x8d97('0x3b')]){throw new db[(_0x8d97('0x70'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4c9748=_0x588471;return db[_0x8d97('0x71')][_0x8d97('0x48')]({'raw':!![]});}return null;})[_0x8d97('0x26')](function(_0x4b5cf6){if(_0x4b5cf6){_0x258512=_[_0x8d97('0x72')](_0x4b5cf6,'id');var _0x2dfda0;var _0x50dfc4=squel[_0x8d97('0x73')]();_0x50dfc4['from'](_0x1e3934[_0x8d97('0x74')]);for(var _0x4743b3=0x0;_0x4743b3<_0x4c9748['length'];_0x4743b3+=0x1){_0x2dfda0=_0x4c9748[_0x4743b3][_0x8d97('0x75')]?_0x258512[_0x4c9748[_0x4743b3][_0x8d97('0x75')]][_0x8d97('0x76')]:_0x4c9748[_0x4743b3][_0x8d97('0x77')];_0x2dfda0=_0x4c9748[_0x4743b3][_0x8d97('0x78')]?_[_0x8d97('0x79')](_0x29f256[_0x4c9748[_0x4743b3]['function']],'%s',_0x2dfda0):_0x2dfda0;_0x2dfda0=_0x4c9748[_0x4743b3][_0x8d97('0x7a')]?_[_0x8d97('0x79')](_0x255c0b[_0x4c9748[_0x4743b3]['format']],'%s',_0x2dfda0):_0x2dfda0;if(_0x4c9748[_0x4743b3][_0x8d97('0x7b')]){_0x50dfc4[_0x8d97('0x6d')](_0x2dfda0);}_0x4c9748[_0x4743b3][_0x8d97('0x7c')]&&_0x50dfc4[_0x8d97('0x3e')](_0x2dfda0,_0x4c9748[_0x4743b3]['orderBy']===_0x8d97('0x7d')?![]:!![]);_0x50dfc4[_0x8d97('0x77')](_0x2dfda0,_0x4c9748[_0x4743b3][_0x8d97('0x7e')]||_0x2dfda0);}if(_0x1e3934[_0x8d97('0x7f')]){_0x1e3934[_0x8d97('0x7f')]=JSON[_0x8d97('0x80')](_0x1e3934[_0x8d97('0x7f')]);for(var _0x11355a=0x0;_0x11355a<_0x1e3934[_0x8d97('0x7f')][_0x8d97('0x3b')];_0x11355a+=0x1){if(_0x1e3934[_0x8d97('0x7f')][_0x11355a][_0x8d97('0x32')]&&_[_0x8d97('0x67')](_0x20a667,_0x1e3934['joins'][_0x11355a]['type'])&&_0x1e3934[_0x8d97('0x7f')][_0x11355a]['parentKey']&&_0x1e3934[_0x8d97('0x7f')][_0x11355a][_0x8d97('0x81')]&&_0x1e3934[_0x8d97('0x7f')][_0x11355a][_0x8d97('0x82')]){_0x50dfc4[_0x1e3934['joins'][_0x11355a]['type']](_0x1e3934[_0x8d97('0x7f')][_0x11355a][_0x8d97('0x81')],null,util[_0x8d97('0x7a')](_0x8d97('0x83'),_0x1e3934[_0x8d97('0x74')],_0x1e3934[_0x8d97('0x7f')][_0x11355a][_0x8d97('0x84')],_0x1e3934[_0x8d97('0x7f')][_0x11355a]['foreignTable'],_0x1e3934[_0x8d97('0x7f')][_0x11355a][_0x8d97('0x82')]));}}}if(_0x1e3934[_0x8d97('0x85')]){_0x1e3934[_0x8d97('0x85')]=JSON[_0x8d97('0x80')](_0x1e3934[_0x8d97('0x85')]);_0x50dfc4['where'](_0x4f84b0(_0x1e3934[_0x8d97('0x85')]['group']));}_0x12b0f3=_0x50dfc4[_0x8d97('0x86')]();_0x50dfc4[_0x8d97('0x1d')](_0x4c50cd);_0x50dfc4[_0x8d97('0x1c')](0x0);logger[_0x8d97('0x87')]('Limited\x20Query:',_0x50dfc4['toString']());return dbH[_0x8d97('0x88')]['query'](_0x50dfc4[_0x8d97('0x89')](),{'type':dbH[_0x8d97('0x88')][_0x8d97('0x8a')][_0x8d97('0x8b')]});}})[_0x8d97('0x26')](respondWithResult(_0x37796a,null))[_0x8d97('0x49')](handleError(_0x37796a,null));};function runReport(_0x3f23f7,_0x2d65a5,_0x5dce26){var _0x493eca=_0x2d65a5['name'];var _0x242ccb=0xa;var _0x548826=['join',_0x8d97('0x58'),_0x8d97('0x59'),'cross_join'];var _0x34c973={'SUM':_0x8d97('0x5b'),'COUNT':_0x8d97('0x5c'),'COUNT DISTINCT':_0x8d97('0x5d'),'MAX':_0x8d97('0x5e'),'MIN':_0x8d97('0x8c'),'AVG':_0x8d97('0x5f'),'GROUP_CONCAT':_0x8d97('0x60'),'GROUP_CONCAT ASC':_0x8d97('0x61'),'GROUP_CONCAT DESC':_0x8d97('0x62')};var _0x3a5257={'SEC_TO_TIME':_0x8d97('0x63'),'DATE':'DATE(%s)','HOUR':_0x8d97('0x65'),'ROUND':_0x8d97('0x66'),'UNIX_TIMESTAMP':_0x8d97('0x8d')};var _0x1198ff=function(_0x41e35f){return!_[_0x8d97('0x67')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x8d97('0x69'),_0x8d97('0x6a')],_0x41e35f);};var _0x3a1c59=function(_0x453911){if(!_0x453911||!_0x453911['rules']['length']){return'';}for(var _0xa5f12d='(',_0x7e358e=0x0;_0x7e358e<_0x453911[_0x8d97('0x6b')]['length'];_0x7e358e+=0x1){_0x7e358e>0x0&&(_0xa5f12d+='\x20'+_0x453911[_0x8d97('0x6c')]+'\x20');_0xa5f12d+=_0x453911[_0x8d97('0x6b')][_0x7e358e][_0x8d97('0x6d')]?_0x3a1c59(_0x453911['rules'][_0x7e358e][_0x8d97('0x6d')]):_0x453911[_0x8d97('0x6b')][_0x7e358e][_0x8d97('0x77')]+'\x20'+_0x453911['rules'][_0x7e358e][_0x8d97('0x6e')]+(_0x1198ff(_0x453911[_0x8d97('0x6b')][_0x7e358e]['condition'])?'\x20'+_0x453911[_0x8d97('0x6b')][_0x7e358e][_0x8d97('0x8e')]:'');}return _0xa5f12d+')';};var _0x5456ed={'where':{'id':_0x3f23f7['id']}},_0x481b3d,_0x1bafd2,_0x2682ed,_0x47f649,_0xa81e1a;_0x5456ed=_[_0x8d97('0x43')]({},_0x5456ed,_0x5dce26);return db[_0x8d97('0x2f')][_0x8d97('0x4b')](_0x5456ed)[_0x8d97('0x26')](function(_0xe4f28c){if(_0xe4f28c){_0x481b3d=_0xe4f28c;return _0xe4f28c[_0x8d97('0x6f')]();}return null;})[_0x8d97('0x26')](function(_0x32c8d0){if(_0x32c8d0){if(!_0x32c8d0[_0x8d97('0x3b')]){throw new db['Sequelize'][(_0x8d97('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bafd2=_0x32c8d0;return db['AnalyticMetric'][_0x8d97('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1bad57){if(_0x1bad57){_0x2682ed=_[_0x8d97('0x72')](_0x1bad57,'id');var _0x2990a2;var _0x7c589a=squel[_0x8d97('0x73')]();_0x7c589a['from'](_0x481b3d[_0x8d97('0x74')]);for(var _0x58a316=0x0;_0x58a316<_0x1bafd2[_0x8d97('0x3b')];_0x58a316+=0x1){_0x2990a2=_0x1bafd2[_0x58a316][_0x8d97('0x75')]?_0x2682ed[_0x1bafd2[_0x58a316]['MetricId']][_0x8d97('0x76')]:_0x1bafd2[_0x58a316]['field'];_0x2990a2=_0x1bafd2[_0x58a316][_0x8d97('0x78')]?_[_0x8d97('0x79')](_0x34c973[_0x1bafd2[_0x58a316]['function']],'%s',_0x2990a2):_0x2990a2;_0x2990a2=_0x1bafd2[_0x58a316][_0x8d97('0x7a')]?_[_0x8d97('0x79')](_0x3a5257[_0x1bafd2[_0x58a316][_0x8d97('0x7a')]],'%s',_0x2990a2):_0x2990a2;if(_0x1bafd2[_0x58a316]['groupBy']){_0x7c589a[_0x8d97('0x6d')](_0x2990a2);}_0x1bafd2[_0x58a316][_0x8d97('0x7c')]&&_0x7c589a[_0x8d97('0x3e')](_0x2990a2,_0x1bafd2[_0x58a316][_0x8d97('0x7c')]===_0x8d97('0x7d')?![]:!![]);_0x7c589a['field'](_0x2990a2,_0x1bafd2[_0x58a316]['alias']||_0x2990a2);}if(_0x481b3d[_0x8d97('0x7f')]){_0x481b3d['joins']=JSON['parse'](_0x481b3d['joins']);for(var _0x1f8301=0x0;_0x1f8301<_0x481b3d[_0x8d97('0x7f')][_0x8d97('0x3b')];_0x1f8301+=0x1){if(_0x481b3d[_0x8d97('0x7f')][_0x1f8301][_0x8d97('0x32')]&&_[_0x8d97('0x67')](_0x548826,_0x481b3d[_0x8d97('0x7f')][_0x1f8301][_0x8d97('0x32')])&&_0x481b3d['joins'][_0x1f8301]['parentKey']&&_0x481b3d[_0x8d97('0x7f')][_0x1f8301][_0x8d97('0x81')]&&_0x481b3d[_0x8d97('0x7f')][_0x1f8301][_0x8d97('0x82')]){_0x7c589a[_0x481b3d[_0x8d97('0x7f')][_0x1f8301]['type']](_0x481b3d[_0x8d97('0x7f')][_0x1f8301][_0x8d97('0x81')],null,util[_0x8d97('0x7a')]('%s.%s\x20=\x20%s.%s',_0x481b3d[_0x8d97('0x74')],_0x481b3d[_0x8d97('0x7f')][_0x1f8301]['parentKey'],_0x481b3d['joins'][_0x1f8301]['foreignTable'],_0x481b3d[_0x8d97('0x7f')][_0x1f8301]['foreignKey']));}}}if(_0x481b3d[_0x8d97('0x85')]){_0x481b3d[_0x8d97('0x85')]=JSON[_0x8d97('0x80')](_0x481b3d[_0x8d97('0x85')]);_0x7c589a['where'](_0x3a1c59(_0x481b3d[_0x8d97('0x85')][_0x8d97('0x6d')]));}_0xa81e1a=_0x7c589a[_0x8d97('0x86')]();_0x7c589a['limit'](_0x242ccb);_0x7c589a[_0x8d97('0x1c')](0x0);return;}})['then'](function(){if(_0x2d65a5[_0x8d97('0x90')]===_0x8d97('0x91')){return null;}var _0x3ece5e=_[_0x8d97('0x43')](_0x2d65a5,{'name':_0x2d65a5[_0x8d97('0x92')]||_0x2d65a5['name']||_0x481b3d[_0x8d97('0x34')],'basename':_0x493eca,'savename':util[_0x8d97('0x7a')](_0x8d97('0x93'),_0x2d65a5[_0x8d97('0x34')]||_0x481b3d[_0x8d97('0x34')],require(_0x8d97('0x94'))[_0x8d97('0x95')](0x4),_0x2d65a5[_0x8d97('0x90')]||_0x8d97('0x96')),'reportId':_0x481b3d['id'],'reportType':_0x8d97('0x97')});return db[_0x8d97('0x98')][_0x8d97('0x4c')](_0x3ece5e,{'raw':!![]});})[_0x8d97('0x26')](function(_0x378df0){if(_0x481b3d[_0x8d97('0x74')]==='cdr'){_0xa81e1a['where'](_0x481b3d[_0x8d97('0x74')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x2d65a5['startDate'],_0x2d65a5[_0x8d97('0x99')]);}else{_0xa81e1a[_0x8d97('0x40')](_0x481b3d[_0x8d97('0x74')]+_0x8d97('0x9a'),_0x2d65a5[_0x8d97('0x9b')],_0x2d65a5['endDate']);}if(_0x378df0){logger[_0x8d97('0x9c')](_0x8d97('0x9d'),_0xa81e1a['toString']());require('child_process')[_0x8d97('0x9e')](path[_0x8d97('0x57')](__dirname,_0x8d97('0x9f'),_0x378df0[_0x8d97('0x90')]),[_0x378df0['id'],_0xa81e1a[_0x8d97('0x89')](),path[_0x8d97('0x57')](__dirname,'../../files/reports',_0x378df0[_0x8d97('0xa0')]),_0x493eca]);return _0x378df0;}else{var _0x18ffc9=squel[_0x8d97('0x73')]();_0x18ffc9[_0x8d97('0xa1')]('('+_0xa81e1a[_0x8d97('0x89')]()+')',_0x8d97('0xa2'));_0x18ffc9[_0x8d97('0x77')](_0x8d97('0xa3'),_0x8d97('0x1e'));_0xa81e1a['limit'](_0x2d65a5['limit']||_0x242ccb);_0xa81e1a[_0x8d97('0x1c')](_0x2d65a5[_0x8d97('0x1c')]||0x0);return dbH[_0x8d97('0x88')][_0x8d97('0x35')](_0x18ffc9[_0x8d97('0x89')](),{'type':dbH[_0x8d97('0x88')][_0x8d97('0x8a')][_0x8d97('0x8b')]})[_0x8d97('0x26')](function(_0x309b42){if(!_0x309b42[_0x8d97('0x3b')]){_0x47f649=0x0;}else{_0x47f649=_0x309b42[0x0]['count']||0x0;}return dbH[_0x8d97('0x88')][_0x8d97('0x35')](_0xa81e1a[_0x8d97('0x89')](),{'type':dbH[_0x8d97('0x88')][_0x8d97('0x8a')][_0x8d97('0x8b')]});})[_0x8d97('0x26')](function(_0x552a52){return{'rows':_0x552a52||[],'count':_0x47f649};});}});}exports['run']=function(_0x52191c,_0x128cfb){return runReport(_0x52191c['params'],_0x52191c['query'],_0x52191c['options'])[_0x8d97('0x26')](respondWithResult(_0x128cfb,null))[_0x8d97('0x49')](handleError(_0x128cfb,null));};exports['runReport']=runReport;exports[_0x8d97('0x35')]=function(_0x5ec9e0,_0x1a9fc0){var _0x3812d7=0xa;var _0x4a626d=[_0x8d97('0x57'),_0x8d97('0x58'),'right_join',_0x8d97('0x5a')];var _0x27a903={'SUM':'SUM(%s)','COUNT':_0x8d97('0x5c'),'COUNT DISTINCT':_0x8d97('0x5d'),'MAX':_0x8d97('0x5e'),'MIN':_0x8d97('0x8c'),'AVG':_0x8d97('0x5f'),'GROUP_CONCAT':_0x8d97('0x60'),'GROUP_CONCAT ASC':_0x8d97('0x61'),'GROUP_CONCAT DESC':_0x8d97('0x62')};var _0x439d78={'SEC_TO_TIME':_0x8d97('0x63'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x8d97('0x66'),'UNIX_TIMESTAMP':_0x8d97('0x8d')};var _0x1eaab6=function(_0x5a103e){return!_[_0x8d97('0x67')]([_0x8d97('0x68'),'IS\x20NOT\x20NULL',_0x8d97('0x69'),_0x8d97('0x6a')],_0x5a103e);};var _0x3b6b38=function(_0x50d093){if(!_0x50d093||!_0x50d093[_0x8d97('0x6b')][_0x8d97('0x3b')]){return'';}for(var _0x2fba3a='(',_0x32dfb9=0x0;_0x32dfb9<_0x50d093['rules'][_0x8d97('0x3b')];_0x32dfb9+=0x1){_0x32dfb9>0x0&&(_0x2fba3a+='\x20'+_0x50d093[_0x8d97('0x6c')]+'\x20');_0x2fba3a+=_0x50d093[_0x8d97('0x6b')][_0x32dfb9][_0x8d97('0x6d')]?_0x3b6b38(_0x50d093[_0x8d97('0x6b')][_0x32dfb9]['group']):_0x50d093[_0x8d97('0x6b')][_0x32dfb9][_0x8d97('0x77')]+'\x20'+_0x50d093[_0x8d97('0x6b')][_0x32dfb9]['condition']+(_0x1eaab6(_0x50d093['rules'][_0x32dfb9][_0x8d97('0x6e')])?'\x20'+_0x50d093['rules'][_0x32dfb9]['value']:'');}return _0x2fba3a+')';};var _0x36d50a={'where':{'id':_0x5ec9e0[_0x8d97('0x55')]['id']}},_0x5824b4,_0x1261a3,_0x307f65,_0x4920d6,_0x9452b1;_0x36d50a=_[_0x8d97('0x43')]({},_0x36d50a,_0x5ec9e0[_0x8d97('0x45')]);return db[_0x8d97('0x2f')][_0x8d97('0x4b')](_0x36d50a)['then'](function(_0x39cc07){if(_0x39cc07){_0x5824b4=_0x39cc07;return _0x39cc07[_0x8d97('0x6f')]();}return null;})['then'](function(_0x29ebc){if(_0x29ebc){if(!_0x29ebc[_0x8d97('0x3b')]){throw new db['Sequelize']['ValidationErrorItem'](_0x8d97('0xa4'),0x193);}_0x1261a3=_0x29ebc;return db[_0x8d97('0x71')][_0x8d97('0x48')]({'raw':!![]});}return null;})[_0x8d97('0x26')](function(_0x106f4c){if(_0x106f4c){_0x307f65=_[_0x8d97('0x72')](_0x106f4c,'id');var _0x7af445;var _0x3f4464=squel['select']();_0x3f4464[_0x8d97('0xa1')](_0x5824b4[_0x8d97('0x74')]);for(var _0xc8c3a7=0x0;_0xc8c3a7<_0x1261a3[_0x8d97('0x3b')];_0xc8c3a7+=0x1){_0x7af445=_0x1261a3[_0xc8c3a7]['MetricId']?_0x307f65[_0x1261a3[_0xc8c3a7]['MetricId']]['metric']:_0x1261a3[_0xc8c3a7][_0x8d97('0x77')];_0x7af445=_0x1261a3[_0xc8c3a7]['function']?_['replace'](_0x27a903[_0x1261a3[_0xc8c3a7][_0x8d97('0x78')]],'%s',_0x7af445):_0x7af445;_0x7af445=_0x1261a3[_0xc8c3a7][_0x8d97('0x7a')]?_['replace'](_0x439d78[_0x1261a3[_0xc8c3a7]['format']],'%s',_0x7af445):_0x7af445;if(_0x1261a3[_0xc8c3a7]['groupBy']){_0x3f4464['group'](_0x7af445);}_0x1261a3[_0xc8c3a7]['orderBy']&&_0x3f4464[_0x8d97('0x3e')](_0x7af445,_0x1261a3[_0xc8c3a7][_0x8d97('0x7c')]==='DESC'?![]:!![]);_0x3f4464[_0x8d97('0x77')](_0x7af445,_0x1261a3[_0xc8c3a7][_0x8d97('0x7e')]||_0x7af445);}if(_0x5824b4[_0x8d97('0x7f')]){_0x5824b4[_0x8d97('0x7f')]=JSON[_0x8d97('0x80')](_0x5824b4['joins']);for(var _0xa568c3=0x0;_0xa568c3<_0x5824b4[_0x8d97('0x7f')][_0x8d97('0x3b')];_0xa568c3+=0x1){if(_0x5824b4[_0x8d97('0x7f')][_0xa568c3][_0x8d97('0x32')]&&_[_0x8d97('0x67')](_0x4a626d,_0x5824b4[_0x8d97('0x7f')][_0xa568c3][_0x8d97('0x32')])&&_0x5824b4[_0x8d97('0x7f')][_0xa568c3][_0x8d97('0x84')]&&_0x5824b4[_0x8d97('0x7f')][_0xa568c3][_0x8d97('0x81')]&&_0x5824b4['joins'][_0xa568c3][_0x8d97('0x82')]){_0x3f4464[_0x5824b4['joins'][_0xa568c3][_0x8d97('0x32')]](_0x5824b4[_0x8d97('0x7f')][_0xa568c3]['foreignTable'],null,util['format'](_0x8d97('0x83'),_0x5824b4[_0x8d97('0x74')],_0x5824b4['joins'][_0xa568c3][_0x8d97('0x84')],_0x5824b4[_0x8d97('0x7f')][_0xa568c3][_0x8d97('0x81')],_0x5824b4[_0x8d97('0x7f')][_0xa568c3][_0x8d97('0x82')]));}}}if(_0x5824b4[_0x8d97('0x85')]){_0x5824b4['conditions']=JSON[_0x8d97('0x80')](_0x5824b4[_0x8d97('0x85')]);_0x3f4464[_0x8d97('0x40')](_0x3b6b38(_0x5824b4['conditions']['group']));}_0x9452b1=_0x3f4464[_0x8d97('0x86')]();_0x3f4464[_0x8d97('0x1d')](_0x3812d7);_0x3f4464[_0x8d97('0x1c')](0x0);logger[_0x8d97('0x87')]('Limited\x20Query:',_0x3f4464[_0x8d97('0x89')]());return dbH['sequelize'][_0x8d97('0x35')](_0x3f4464[_0x8d97('0x89')](),{'type':dbH[_0x8d97('0x88')][_0x8d97('0x8a')]['SELECT']});}})[_0x8d97('0x26')](function(){return{'sql':_0x9452b1[_0x8d97('0x89')]()};})[_0x8d97('0x26')](respondWithResult(_0x1a9fc0,null))[_0x8d97('0x49')](handleError(_0x1a9fc0,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index d66eea9..14bef16 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 _0x76de=['../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x485cba,_0x38a03a){var _0x5cdc63=function(_0x1abd9e){while(--_0x1abd9e){_0x485cba['push'](_0x485cba['shift']());}};_0x5cdc63(++_0x38a03a);}(_0x76de,0x1e9));var _0xe76d=function(_0x19afdd,_0x4f9937){_0x19afdd=_0x19afdd-0x0;var _0x1d44dc=_0x76de[_0x19afdd];return _0x1d44dc;};'use strict';var _=require(_0xe76d('0x0'));var util=require('util');var logger=require(_0xe76d('0x1'))(_0xe76d('0x2'));var moment=require(_0xe76d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe76d('0x4'));var rimraf=require(_0xe76d('0x5'));var config=require(_0xe76d('0x6'));var attributes=require(_0xe76d('0x7'));module[_0xe76d('0x8')]=function(_0x4ed8ee,_0x1eb55b){return _0x4ed8ee[_0xe76d('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0xe76d('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab02=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports'];(function(_0x56497c,_0x2ad77f){var _0x18f66f=function(_0x460598){while(--_0x460598){_0x56497c['push'](_0x56497c['shift']());}};_0x18f66f(++_0x2ad77f);}(_0xab02,0x12c));var _0x2ab0=function(_0xeb450f,_0x483ac6){_0xeb450f=_0xeb450f-0x0;var _0xfad79f=_0xab02[_0xeb450f];return _0xfad79f;};'use strict';var _=require(_0x2ab0('0x0'));var util=require(_0x2ab0('0x1'));var logger=require(_0x2ab0('0x2'))(_0x2ab0('0x3'));var moment=require('moment');var BPromise=require(_0x2ab0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ab0('0x5'));var rimraf=require(_0x2ab0('0x6'));var config=require(_0x2ab0('0x7'));var attributes=require(_0x2ab0('0x8'));module[_0x2ab0('0x9')]=function(_0xab9099,_0x3f6462){return _0xab9099[_0x2ab0('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x2ab0('0xb'),'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 6d31736..cbc7786 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 _0xcd11=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x190308,_0x503649){var _0x3a50c1=function(_0x59711f){while(--_0x59711f){_0x190308['push'](_0x190308['shift']());}};_0x3a50c1(++_0x503649);}(_0xcd11,0x1a2));var _0x1cd1=function(_0x2e8955,_0x26f82a){_0x2e8955=_0x2e8955-0x0;var _0x4eb8ff=_0xcd11[_0x2e8955];return _0x4eb8ff;};'use strict';var _=require(_0x1cd1('0x0'));var util=require(_0x1cd1('0x1'));var moment=require(_0x1cd1('0x2'));var BPromise=require(_0x1cd1('0x3'));var rs=require(_0x1cd1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cd1('0x5'))['db'];var utils=require(_0x1cd1('0x6'));var logger=require(_0x1cd1('0x7'))(_0x1cd1('0x8'));var config=require(_0x1cd1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1cd1('0xa')][_0x1cd1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f37ef,_0x59b8d7,_0xd08e84){return new BPromise(function(_0xf6463e,_0x54b99f){return client['request'](_0x4f37ef,_0xd08e84)['then'](function(_0x409ac7){logger[_0x1cd1('0xc')](_0x1cd1('0xd'),_0x59b8d7,_0x1cd1('0xe'));logger[_0x1cd1('0xf')](_0x1cd1('0x10'),_0x59b8d7,_0x1cd1('0xe'),JSON[_0x1cd1('0x11')](_0x409ac7));if(_0x409ac7[_0x1cd1('0x12')]){if(_0x409ac7['error'][_0x1cd1('0x13')]===0x1f4){logger[_0x1cd1('0x12')](_0x1cd1('0xd'),_0x59b8d7,_0x409ac7[_0x1cd1('0x12')]['message']);return _0x54b99f(_0x409ac7['error']['message']);}logger[_0x1cd1('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x59b8d7,_0x409ac7[_0x1cd1('0x12')][_0x1cd1('0x14')]);return _0xf6463e(_0x409ac7['error'][_0x1cd1('0x14')]);}else{logger[_0x1cd1('0xc')](_0x1cd1('0xd'),_0x59b8d7,'request\x20sent');_0xf6463e(_0x409ac7[_0x1cd1('0x15')]['message']);}})['catch'](function(_0x24dfd1){logger['error'](_0x1cd1('0xd'),_0x59b8d7,_0x24dfd1);_0x54b99f(_0x24dfd1);});});} \ No newline at end of file +var _0xdc8c=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x517763,_0x3648a2){var _0x46d6f0=function(_0x9332e9){while(--_0x9332e9){_0x517763['push'](_0x517763['shift']());}};_0x46d6f0(++_0x3648a2);}(_0xdc8c,0x6d));var _0xcdc8=function(_0x8ae2ad,_0x5dece2){_0x8ae2ad=_0x8ae2ad-0x0;var _0xf971d3=_0xdc8c[_0x8ae2ad];return _0xf971d3;};'use strict';var _=require(_0xcdc8('0x0'));var util=require(_0xcdc8('0x1'));var moment=require(_0xcdc8('0x2'));var BPromise=require(_0xcdc8('0x3'));var rs=require(_0xcdc8('0x4'));var fs=require('fs');var Redis=require(_0xcdc8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdc8('0x6'));var logger=require(_0xcdc8('0x7'))(_0xcdc8('0x8'));var config=require(_0xcdc8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcdc8('0xa')][_0xcdc8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30d893,_0x559013,_0x514224){return new BPromise(function(_0xdf8c00,_0x4c4b9c){return client[_0xcdc8('0xc')](_0x30d893,_0x514224)[_0xcdc8('0xd')](function(_0x2d90a7){logger[_0xcdc8('0xe')](_0xcdc8('0xf'),_0x559013,'request\x20sent');logger[_0xcdc8('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x559013,_0xcdc8('0x11'),JSON[_0xcdc8('0x12')](_0x2d90a7));if(_0x2d90a7[_0xcdc8('0x13')]){if(_0x2d90a7[_0xcdc8('0x13')][_0xcdc8('0x14')]===0x1f4){logger[_0xcdc8('0x13')](_0xcdc8('0xf'),_0x559013,_0x2d90a7[_0xcdc8('0x13')]['message']);return _0x4c4b9c(_0x2d90a7['error'][_0xcdc8('0x15')]);}logger[_0xcdc8('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x559013,_0x2d90a7['error']['message']);return _0xdf8c00(_0x2d90a7[_0xcdc8('0x13')][_0xcdc8('0x15')]);}else{logger[_0xcdc8('0xe')](_0xcdc8('0xf'),_0x559013,'request\x20sent');_0xdf8c00(_0x2d90a7[_0xcdc8('0x16')]['message']);}})[_0xcdc8('0x17')](function(_0x121f2d){logger[_0xcdc8('0x13')](_0xcdc8('0xf'),_0x559013,_0x121f2d);_0x4c4b9c(_0x121f2d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 6e2424a..b17e033 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 _0x8bc8=['../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','preview','/:id/run','run','query','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x54a7d8,_0x1817db){var _0x5425aa=function(_0x383909){while(--_0x383909){_0x54a7d8['push'](_0x54a7d8['shift']());}};_0x5425aa(++_0x1817db);}(_0x8bc8,0x99));var _0x88bc=function(_0x283b55,_0x279bee){_0x283b55=_0x283b55-0x0;var _0x192e58=_0x8bc8[_0x283b55];return _0x192e58;};'use strict';var multer=require(_0x88bc('0x0'));var util=require('util');var path=require(_0x88bc('0x1'));var timeout=require(_0x88bc('0x2'));var express=require(_0x88bc('0x3'));var router=express[_0x88bc('0x4')]();var fs_extra=require(_0x88bc('0x5'));var auth=require(_0x88bc('0x6'));var interaction=require(_0x88bc('0x7'));var config=require(_0x88bc('0x8'));var controller=require(_0x88bc('0x9'));router[_0x88bc('0xa')]('/',auth['isAuthenticated'](),controller[_0x88bc('0xb')]);router['get'](_0x88bc('0xc'),auth[_0x88bc('0xd')](),controller['show']);router['get']('/:id/preview',auth['isAuthenticated'](),controller[_0x88bc('0xe')]);router[_0x88bc('0xa')](_0x88bc('0xf'),auth[_0x88bc('0xd')](),controller[_0x88bc('0x10')]);router[_0x88bc('0xa')]('/:id/query',auth[_0x88bc('0xd')](),controller[_0x88bc('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x88bc('0x12')]);router[_0x88bc('0x13')](_0x88bc('0xc'),auth[_0x88bc('0xd')](),controller[_0x88bc('0x14')]);router['delete'](_0x88bc('0xc'),auth[_0x88bc('0xd')](),controller[_0x88bc('0x15')]);module[_0x88bc('0x16')]=router; \ No newline at end of file +var _0x6d5b=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','preview','/:id/run','run','create','delete','destroy'];(function(_0x1ac052,_0x3f8942){var _0x17dfe7=function(_0xec078b){while(--_0xec078b){_0x1ac052['push'](_0x1ac052['shift']());}};_0x17dfe7(++_0x3f8942);}(_0x6d5b,0xb5));var _0xb6d5=function(_0x3e10dc,_0x230393){_0x3e10dc=_0x3e10dc-0x0;var _0x20020c=_0x6d5b[_0x3e10dc];return _0x20020c;};'use strict';var multer=require('multer');var util=require(_0xb6d5('0x0'));var path=require(_0xb6d5('0x1'));var timeout=require(_0xb6d5('0x2'));var express=require(_0xb6d5('0x3'));var router=express[_0xb6d5('0x4')]();var fs_extra=require(_0xb6d5('0x5'));var auth=require(_0xb6d5('0x6'));var interaction=require(_0xb6d5('0x7'));var config=require(_0xb6d5('0x8'));var controller=require('./analyticCustomReport.controller');router[_0xb6d5('0x9')]('/',auth[_0xb6d5('0xa')](),controller['index']);router[_0xb6d5('0x9')](_0xb6d5('0xb'),auth[_0xb6d5('0xa')](),controller[_0xb6d5('0xc')]);router['get']('/:id/preview',auth[_0xb6d5('0xa')](),controller[_0xb6d5('0xd')]);router[_0xb6d5('0x9')](_0xb6d5('0xe'),auth[_0xb6d5('0xa')](),controller[_0xb6d5('0xf')]);router[_0xb6d5('0x9')]('/:id/query',auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0xb6d5('0xa')](),controller[_0xb6d5('0x10')]);router['put'](_0xb6d5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xb6d5('0x11')](_0xb6d5('0xb'),auth[_0xb6d5('0xa')](),controller[_0xb6d5('0x12')]);module[_0xb6d5('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 3cefcf8..cfcd9c2 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x46ed,0x168));var _0xd46e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46ed[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x1652c9,_0x19e14d){var _0x14666e=function(_0x2567db){while(--_0x2567db){_0x1652c9['push'](_0x1652c9['shift']());}};_0x14666e(++_0x19e14d);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5c12c4,_0x3bb03e){_0x5c12c4=_0x5c12c4-0x0;var _0x185df2=_0x3eea[_0x5c12c4];return _0x185df2;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 2af764c..f75afb9 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 _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x1d480a,_0x5277fe){var _0x51f043=function(_0x524f20){while(--_0x524f20){_0x1d480a['push'](_0x1d480a['shift']());}};_0x51f043(++_0x5277fe);}(_0xba34,0x119));var _0x4ba3=function(_0x148fcb,_0x3e8c58){_0x148fcb=_0x148fcb-0x0;var _0x4dfb3a=_0xba34[_0x148fcb];return _0x4dfb3a;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file +var _0x2542=['getFields','ValidationErrorItem','metric','format','DESC','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','sequelize','SELECT','run','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','save','destroy','then','get','end','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_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)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','field','replace','function','groupBy','orderBy','alias','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','value'];(function(_0x3c74d7,_0x328e0f){var _0xf2cb29=function(_0x2f8675){while(--_0x2f8675){_0x3c74d7['push'](_0x3c74d7['shift']());}};_0xf2cb29(++_0x328e0f);}(_0x2542,0x169));var _0x2254=function(_0x2bf999,_0x4645b1){_0x2bf999=_0x2bf999-0x0;var _0x4cf8f8=_0x2542[_0x2bf999];return _0x4cf8f8;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];var dbH=require(_0x2254('0x19'))[_0x2254('0x1a')];function respondWithStatusCode(_0x3c326b,_0x381efe){_0x381efe=_0x381efe||0xcc;return function(_0x592a4f){if(_0x592a4f){return _0x3c326b[_0x2254('0x1b')](_0x381efe);}return _0x3c326b[_0x2254('0x1c')](_0x381efe)['end']();};}function respondWithResult(_0x2f4de,_0x1e582d){_0x1e582d=_0x1e582d||0xc8;return function(_0xfb23cb){if(_0xfb23cb){return _0x2f4de[_0x2254('0x1c')](_0x1e582d)[_0x2254('0x1d')](_0xfb23cb);}};}function respondWithFilteredResult(_0xbc5548,_0x50f137){return function(_0x18baf4){if(_0x18baf4){var _0x57247a=typeof _0x50f137[_0x2254('0x1e')]===_0x2254('0x1f')&&typeof _0x50f137[_0x2254('0x20')]===_0x2254('0x1f');var _0x1ae11e=_0x18baf4[_0x2254('0x21')];var _0x497724=_0x57247a?0x0:_0x50f137['offset'];var _0x5ec98d=_0x57247a?_0x18baf4[_0x2254('0x21')]:_0x50f137[_0x2254('0x1e')]+_0x50f137[_0x2254('0x20')];var _0x1f1163;if(_0x5ec98d>=_0x1ae11e){_0x5ec98d=_0x1ae11e;_0x1f1163=0xc8;}else{_0x1f1163=0xce;}_0xbc5548[_0x2254('0x1c')](_0x1f1163);return _0xbc5548[_0x2254('0x22')]('Content-Range',_0x497724+'-'+_0x5ec98d+'/'+_0x1ae11e)[_0x2254('0x1d')](_0x18baf4);}return null;};}function patchUpdates(_0x16148d){return function(_0x906cde){try{jsonpatch['apply'](_0x906cde,_0x16148d,!![]);}catch(_0x52fedc){return BPromise['reject'](_0x52fedc);}return _0x906cde[_0x2254('0x23')]();};}function saveUpdates(_0x559af4,_0xf88b56){return function(_0x56b91e){if(_0x56b91e){return _0x56b91e['update'](_0x559af4)['then'](function(_0x540020){return _0x540020;});}return null;};}function removeEntity(_0x5e5edb,_0x4f797d){return function(_0x1aa71f){if(_0x1aa71f){return _0x1aa71f[_0x2254('0x24')]()[_0x2254('0x25')](function(){var _0x265467=_0x1aa71f[_0x2254('0x26')]({'plain':!![]});var _0x1349c9='DefaultReports';return db['UserProfileResource'][_0x2254('0x24')]({'where':{'type':_0x1349c9,'resourceId':_0x265467['id']}})['then'](function(){return _0x1aa71f;});})[_0x2254('0x25')](function(){_0x5e5edb[_0x2254('0x1c')](0xcc)[_0x2254('0x27')]();});}};}function handleEntityNotFound(_0x3aa0bd,_0x19043b){return function(_0x482688){if(!_0x482688){_0x3aa0bd[_0x2254('0x1b')](0x194);}return _0x482688;};}function handleError(_0x2a789b,_0x21285d){_0x21285d=_0x21285d||0x1f4;return function(_0x37af8b){logger[_0x2254('0x28')](_0x37af8b[_0x2254('0x29')]);if(_0x37af8b[_0x2254('0x2a')]){delete _0x37af8b[_0x2254('0x2a')];}_0x2a789b[_0x2254('0x1c')](_0x21285d)[_0x2254('0x2b')](_0x37af8b);};}exports[_0x2254('0x2c')]=function(_0xad7774,_0x220f2a){var _0x27d30a={},_0x4577f4={},_0x1b16c8={'count':0x0,'rows':[]};var _0x2c929f=_[_0x2254('0x2d')](db[_0x2254('0x2e')]['rawAttributes'],function(_0xe29526){return{'name':_0xe29526[_0x2254('0x2f')],'type':_0xe29526[_0x2254('0x30')][_0x2254('0x31')]};});_0x4577f4[_0x2254('0x32')]=_[_0x2254('0x2d')](_0x2c929f,_0x2254('0x2a'));_0x4577f4[_0x2254('0x33')]=_[_0x2254('0x34')](_0xad7774['query']);_0x4577f4[_0x2254('0x35')]=_[_0x2254('0x36')](_0x4577f4['model'],_0x4577f4[_0x2254('0x33')]);_0x27d30a[_0x2254('0x37')]=_[_0x2254('0x36')](_0x4577f4[_0x2254('0x32')],qs['fields'](_0xad7774['query'][_0x2254('0x38')]));_0x27d30a['attributes']=_0x27d30a[_0x2254('0x37')][_0x2254('0x39')]?_0x27d30a[_0x2254('0x37')]:_0x4577f4[_0x2254('0x32')];if(!_0xad7774[_0x2254('0x33')][_0x2254('0x3a')](_0x2254('0x3b'))){_0x27d30a['limit']=qs[_0x2254('0x20')](_0xad7774[_0x2254('0x33')][_0x2254('0x20')]);_0x27d30a[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0xad7774[_0x2254('0x33')][_0x2254('0x1e')]);}_0x27d30a[_0x2254('0x3c')]=qs[_0x2254('0x3d')](_0xad7774[_0x2254('0x33')]['sort']);_0x27d30a[_0x2254('0x3e')]=qs[_0x2254('0x35')](_[_0x2254('0x3f')](_0xad7774[_0x2254('0x33')],_0x4577f4['filters']),_0x2c929f);if(_0xad7774[_0x2254('0x33')][_0x2254('0x40')]){_0x27d30a[_0x2254('0x3e')]=_[_0x2254('0x41')](_0x27d30a[_0x2254('0x3e')],{'$or':_[_0x2254('0x2d')](_0x2c929f,function(_0x423377){if(_0x423377[_0x2254('0x30')]!=='VIRTUAL'){var _0x362ad1={};_0x362ad1[_0x423377['name']]={'$like':'%'+_0xad7774[_0x2254('0x33')][_0x2254('0x40')]+'%'};return _0x362ad1;}})});}_0x27d30a=_[_0x2254('0x41')]({},_0x27d30a,_0xad7774[_0x2254('0x42')]);var _0x460bb3={'where':_0x27d30a[_0x2254('0x3e')]};return db[_0x2254('0x2e')]['count'](_0x460bb3)[_0x2254('0x25')](function(_0x2f1ff9){_0x1b16c8[_0x2254('0x21')]=_0x2f1ff9;if(_0xad7774[_0x2254('0x33')][_0x2254('0x43')]){_0x27d30a['include']=[{'all':!![]}];}return db[_0x2254('0x2e')][_0x2254('0x44')](_0x27d30a);})[_0x2254('0x25')](function(_0x135ed8){_0x1b16c8[_0x2254('0x45')]=_0x135ed8;return _0x1b16c8;})['then'](respondWithFilteredResult(_0x220f2a,_0x27d30a))[_0x2254('0x46')](handleError(_0x220f2a,null));};exports['show']=function(_0x91e091,_0x1ded9a){var _0xb4d042={'raw':!![],'where':{'id':_0x91e091[_0x2254('0x47')]['id']}},_0x31c31e={};_0x31c31e[_0x2254('0x32')]=_[_0x2254('0x34')](db[_0x2254('0x2e')][_0x2254('0x48')]);_0x31c31e[_0x2254('0x33')]=_[_0x2254('0x34')](_0x91e091[_0x2254('0x33')]);_0x31c31e[_0x2254('0x35')]=_['intersection'](_0x31c31e[_0x2254('0x32')],_0x31c31e[_0x2254('0x33')]);_0xb4d042[_0x2254('0x37')]=_['intersection'](_0x31c31e[_0x2254('0x32')],qs[_0x2254('0x38')](_0x91e091[_0x2254('0x33')][_0x2254('0x38')]));_0xb4d042[_0x2254('0x37')]=_0xb4d042[_0x2254('0x37')][_0x2254('0x39')]?_0xb4d042[_0x2254('0x37')]:_0x31c31e[_0x2254('0x32')];if(_0x91e091['query'][_0x2254('0x43')]){_0xb4d042[_0x2254('0x49')]=[{'all':!![]}];}_0xb4d042=_[_0x2254('0x41')]({},_0xb4d042,_0x91e091[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0xb4d042)[_0x2254('0x25')](handleEntityNotFound(_0x1ded9a,null))[_0x2254('0x25')](respondWithResult(_0x1ded9a,null))[_0x2254('0x46')](handleError(_0x1ded9a,null));};exports[_0x2254('0x4b')]=function(_0x5b14c5,_0x36b977){return db[_0x2254('0x2e')]['create'](_0x5b14c5[_0x2254('0x4c')],{})[_0x2254('0x25')](function(_0x12e2ff){var _0x4331a9=_0x5b14c5['user'][_0x2254('0x26')]({'plain':!![]});if(!_0x4331a9)throw new Error(_0x2254('0x4d'));if(_0x4331a9['role']===_0x2254('0x4e')){var _0x3f0670=_0x12e2ff[_0x2254('0x26')]({'plain':!![]});var _0x43bb88='Reports';return db[_0x2254('0x4f')][_0x2254('0x4a')]({'where':{'name':_0x43bb88,'userProfileId':_0x4331a9[_0x2254('0x50')]},'raw':!![]})['then'](function(_0x4cc18a){if(_0x4cc18a&&_0x4cc18a[_0x2254('0x51')]===0x0){return db[_0x2254('0x52')]['create']({'name':_0x3f0670[_0x2254('0x2a')],'resourceId':_0x3f0670['id'],'type':'DefaultReports','sectionId':_0x4cc18a['id']},{})['then'](function(){return _0x12e2ff;});}else{return _0x12e2ff;}})[_0x2254('0x46')](function(_0x135962){logger[_0x2254('0x28')](_0x2254('0x53'),_0x135962);throw _0x135962;});}return _0x12e2ff;})[_0x2254('0x25')](respondWithResult(_0x36b977,0xc9))['catch'](handleError(_0x36b977,null));};exports['update']=function(_0x1bd988,_0x5e3fbc){if(_0x1bd988[_0x2254('0x4c')]['id']){delete _0x1bd988[_0x2254('0x4c')]['id'];}return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x1bd988['params']['id']}})[_0x2254('0x25')](handleEntityNotFound(_0x5e3fbc,null))[_0x2254('0x25')](saveUpdates(_0x1bd988['body'],null))['then'](respondWithResult(_0x5e3fbc,null))[_0x2254('0x46')](handleError(_0x5e3fbc,null));};exports['destroy']=function(_0x2cc59c,_0x305ace){return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x2cc59c[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x305ace,null))['then'](removeEntity(_0x305ace,null))[_0x2254('0x46')](handleError(_0x305ace,null));};exports['preview']=function(_0x335c66,_0x510fe0){var _0x4da493=0xa;var _0x5999c8=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x13606e={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':_0x2254('0x5b'),'MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f391d={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x329378=function(_0xae171c){return!_[_0x2254('0x65')]([_0x2254('0x66'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2254('0x67')],_0xae171c);};var _0x423c17=function(_0x1d73a3){if(!_0x1d73a3||!_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x53b55b='(',_0x45b7bd=0x0;_0x45b7bd<_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')];_0x45b7bd+=0x1){_0x45b7bd>0x0&&(_0x53b55b+='\x20'+_0x1d73a3['operator']+'\x20');_0x53b55b+=_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]?_0x423c17(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]):_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['field']+'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd][_0x2254('0x6a')]+(_0x329378(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x6a')])?'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['value']:'');}return _0x53b55b+')';};var _0x5cc6bd={'where':{'id':_0x335c66['params']['id']}},_0xde4e7,_0xa159a4,_0x486b82,_0x506d95,_0x48406e;_0x5cc6bd=_[_0x2254('0x41')]({},_0x5cc6bd,_0x335c66['options']);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x5cc6bd)[_0x2254('0x25')](function(_0x1ed6b9){if(_0x1ed6b9){_0xde4e7=_0x1ed6b9;return _0x1ed6b9['getFields']();}return null;})[_0x2254('0x25')](function(_0x5ecf82){if(_0x5ecf82){if(!_0x5ecf82[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xa159a4=_0x5ecf82;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x3b3b20){if(_0x3b3b20){_0x486b82=_[_0x2254('0x6e')](_0x3b3b20,'id');var _0x3cefbe;var _0x4f77e5=squel[_0x2254('0x6f')]();_0x4f77e5[_0x2254('0x70')](_0xde4e7['table']);for(var _0x1ac8ff=0x0;_0x1ac8ff<_0xa159a4[_0x2254('0x39')];_0x1ac8ff+=0x1){_0x3cefbe=_0xa159a4[_0x1ac8ff]['MetricId']?_0x486b82[_0xa159a4[_0x1ac8ff][_0x2254('0x71')]]['metric']:_0xa159a4[_0x1ac8ff][_0x2254('0x72')];_0x3cefbe=_0xa159a4[_0x1ac8ff]['function']?_[_0x2254('0x73')](_0x13606e[_0xa159a4[_0x1ac8ff][_0x2254('0x74')]],'%s',_0x3cefbe):_0x3cefbe;_0x3cefbe=_0xa159a4[_0x1ac8ff]['format']?_[_0x2254('0x73')](_0x2f391d[_0xa159a4[_0x1ac8ff]['format']],'%s',_0x3cefbe):_0x3cefbe;if(_0xa159a4[_0x1ac8ff][_0x2254('0x75')]){_0x4f77e5[_0x2254('0x69')](_0x3cefbe);}_0xa159a4[_0x1ac8ff][_0x2254('0x76')]&&_0x4f77e5['order'](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x76')]==='DESC'?![]:!![]);_0x4f77e5[_0x2254('0x72')](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x77')]||_0x3cefbe);}if(_0xde4e7['joins']){_0xde4e7['joins']=JSON[_0x2254('0x78')](_0xde4e7[_0x2254('0x79')]);for(var _0x451520=0x0;_0x451520<_0xde4e7[_0x2254('0x79')]['length'];_0x451520+=0x1){if(_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x5999c8,_0xde4e7[_0x2254('0x79')][_0x451520]['type'])&&_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7a')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7b')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7c')]){_0x4f77e5[_0xde4e7['joins'][_0x451520]['type']](_0xde4e7['joins'][_0x451520][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0xde4e7[_0x2254('0x7e')],_0xde4e7['joins'][_0x451520][_0x2254('0x7a')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7b')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7c')]));}}}if(_0xde4e7[_0x2254('0x7f')]){_0xde4e7['conditions']=JSON['parse'](_0xde4e7[_0x2254('0x7f')]);_0x4f77e5[_0x2254('0x3e')](_0x423c17(_0xde4e7[_0x2254('0x7f')][_0x2254('0x69')]));}_0x48406e=_0x4f77e5[_0x2254('0x80')]();_0x4f77e5[_0x2254('0x20')](_0x4da493);_0x4f77e5[_0x2254('0x1e')](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4f77e5[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4f77e5[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')]['SELECT']});}})[_0x2254('0x25')](respondWithResult(_0x510fe0,null))[_0x2254('0x46')](handleError(_0x510fe0,null));};function runReport(_0x4dfcb4,_0x1c317b,_0x4e699c){var _0x2ad519=_0x1c317b[_0x2254('0x2a')];var _0x30f2c9=0xa;var _0x1f7a48=['join',_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x3a8d4f={'SUM':'SUM(%s)','COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f3650={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x251d70=function(_0x2c7705){return!_['includes']([_0x2254('0x66'),'IS\x20NOT\x20NULL',_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x2c7705);};var _0x36d121=function(_0x207a09){if(!_0x207a09||!_0x207a09[_0x2254('0x68')]['length']){return'';}for(var _0x8a3656='(',_0x1554f1=0x0;_0x1554f1<_0x207a09[_0x2254('0x68')][_0x2254('0x39')];_0x1554f1+=0x1){_0x1554f1>0x0&&(_0x8a3656+='\x20'+_0x207a09[_0x2254('0x87')]+'\x20');_0x8a3656+=_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]?_0x36d121(_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]):_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x72')]+'\x20'+_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x6a')]+(_0x251d70(_0x207a09['rules'][_0x1554f1][_0x2254('0x6a')])?'\x20'+_0x207a09['rules'][_0x1554f1][_0x2254('0x88')]:'');}return _0x8a3656+')';};var _0xb98b40={'where':{'id':_0x4dfcb4['id']}},_0x3b1d5c,_0x2c907a,_0x23b78c,_0x2b5dba,_0x30307a;_0xb98b40=_['merge']({},_0xb98b40,_0x4e699c);return db[_0x2254('0x2e')]['find'](_0xb98b40)[_0x2254('0x25')](function(_0x52712d){if(_0x52712d){_0x3b1d5c=_0x52712d;return _0x52712d[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x1d0c8f){if(_0x1d0c8f){if(!_0x1d0c8f['length']){throw new db[(_0x2254('0x6b'))][(_0x2254('0x8a'))](_0x2254('0x6c'),0x193);}_0x2c907a=_0x1d0c8f;return db[_0x2254('0x6d')][_0x2254('0x44')]({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x34185c){if(_0x34185c){_0x23b78c=_[_0x2254('0x6e')](_0x34185c,'id');var _0x5e94b6;var _0x56239e=squel[_0x2254('0x6f')]();_0x56239e['from'](_0x3b1d5c[_0x2254('0x7e')]);for(var _0x3a1365=0x0;_0x3a1365<_0x2c907a[_0x2254('0x39')];_0x3a1365+=0x1){_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x71')]?_0x23b78c[_0x2c907a[_0x3a1365][_0x2254('0x71')]][_0x2254('0x8b')]:_0x2c907a[_0x3a1365][_0x2254('0x72')];_0x5e94b6=_0x2c907a[_0x3a1365]['function']?_[_0x2254('0x73')](_0x3a8d4f[_0x2c907a[_0x3a1365][_0x2254('0x74')]],'%s',_0x5e94b6):_0x5e94b6;_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x8c')]?_['replace'](_0x2f3650[_0x2c907a[_0x3a1365][_0x2254('0x8c')]],'%s',_0x5e94b6):_0x5e94b6;if(_0x2c907a[_0x3a1365][_0x2254('0x75')]){_0x56239e[_0x2254('0x69')](_0x5e94b6);}_0x2c907a[_0x3a1365][_0x2254('0x76')]&&_0x56239e[_0x2254('0x3c')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x56239e[_0x2254('0x72')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x77')]||_0x5e94b6);}if(_0x3b1d5c['joins']){_0x3b1d5c[_0x2254('0x79')]=JSON[_0x2254('0x78')](_0x3b1d5c['joins']);for(var _0x4cec5b=0x0;_0x4cec5b<_0x3b1d5c[_0x2254('0x79')]['length'];_0x4cec5b+=0x1){if(_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x1f7a48,_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')])&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7a')]&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b]['foreignTable']&&_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7c')]){_0x56239e[_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]](_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3b1d5c[_0x2254('0x7e')],_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7a')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7c')]));}}}if(_0x3b1d5c[_0x2254('0x7f')]){_0x3b1d5c[_0x2254('0x7f')]=JSON['parse'](_0x3b1d5c[_0x2254('0x7f')]);_0x56239e[_0x2254('0x3e')](_0x36d121(_0x3b1d5c['conditions'][_0x2254('0x69')]));}_0x30307a=_0x56239e[_0x2254('0x80')]();_0x56239e[_0x2254('0x20')](_0x30f2c9);_0x56239e[_0x2254('0x1e')](0x0);return;}})[_0x2254('0x25')](function(){if(_0x1c317b[_0x2254('0x8e')]===_0x2254('0x8f')){return null;}var _0x38e2df=_[_0x2254('0x41')](_0x1c317b,{'name':_0x1c317b[_0x2254('0x90')]||_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c['name'],'basename':_0x2ad519,'savename':util[_0x2254('0x8c')](_0x2254('0x91'),_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c[_0x2254('0x2a')],require(_0x2254('0x92'))[_0x2254('0x93')](0x4),_0x1c317b[_0x2254('0x8e')]||'csv'),'reportId':_0x3b1d5c['id'],'reportType':_0x2254('0x94')});return db[_0x2254('0x95')][_0x2254('0x4b')](_0x38e2df,{'raw':!![]});})['then'](function(_0x60f5ac){if(_0x3b1d5c[_0x2254('0x7e')]===_0x2254('0x96')){_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x97'),_0x1c317b['startDate'],_0x1c317b[_0x2254('0x98')]);}else{_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x99'),_0x1c317b[_0x2254('0x9a')],_0x1c317b['endDate']);}if(_0x60f5ac){logger['info'](_0x2254('0x9b'),_0x30307a['toString']());require(_0x2254('0x9c'))[_0x2254('0x9d')](path[_0x2254('0x54')](__dirname,_0x2254('0x9e'),_0x60f5ac[_0x2254('0x8e')]),[_0x60f5ac['id'],_0x30307a[_0x2254('0x83')](),path['join'](__dirname,'../../files/reports',_0x60f5ac[_0x2254('0x9f')]),_0x2ad519]);return _0x60f5ac;}else{var _0x3317d4=squel[_0x2254('0x6f')]();_0x3317d4[_0x2254('0x70')]('('+_0x30307a['toString']()+')',_0x2254('0xa0'));_0x3317d4[_0x2254('0x72')](_0x2254('0xa1'),_0x2254('0x21'));_0x30307a[_0x2254('0x20')](_0x1c317b[_0x2254('0x20')]||_0x30f2c9);_0x30307a[_0x2254('0x1e')](_0x1c317b[_0x2254('0x1e')]||0x0);return dbH[_0x2254('0xa2')]['query'](_0x3317d4[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')]['SELECT']})[_0x2254('0x25')](function(_0xe38a28){if(!_0xe38a28[_0x2254('0x39')]){_0x2b5dba=0x0;}else{_0x2b5dba=_0xe38a28[0x0]['count']||0x0;}return dbH['sequelize'][_0x2254('0x33')](_0x30307a[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')][_0x2254('0xa3')]});})[_0x2254('0x25')](function(_0x4011de){return{'rows':_0x4011de||[],'count':_0x2b5dba};});}});}exports[_0x2254('0xa4')]=function(_0x5cb3d1,_0x1d8238){return runReport(_0x5cb3d1[_0x2254('0x47')],_0x5cb3d1[_0x2254('0x33')],_0x5cb3d1[_0x2254('0x42')])[_0x2254('0x25')](respondWithResult(_0x1d8238,null))[_0x2254('0x46')](handleError(_0x1d8238,null));};exports['runReport']=runReport;exports['query']=function(_0x40339d,_0x4b3b96){var _0x59b8af=0xa;var _0x408695=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),'cross_join'];var _0x596eae={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x739a29={'SEC_TO_TIME':_0x2254('0x61'),'DATE':'DATE(%s)','HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x243466=function(_0x1b8587){return!_[_0x2254('0x65')]([_0x2254('0x66'),_0x2254('0xa5'),_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x1b8587);};var _0xbec5d0=function(_0x18f841){if(!_0x18f841||!_0x18f841[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x275b56='(',_0x315add=0x0;_0x315add<_0x18f841['rules']['length'];_0x315add+=0x1){_0x315add>0x0&&(_0x275b56+='\x20'+_0x18f841[_0x2254('0x87')]+'\x20');_0x275b56+=_0x18f841['rules'][_0x315add][_0x2254('0x69')]?_0xbec5d0(_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x69')]):_0x18f841[_0x2254('0x68')][_0x315add]['field']+'\x20'+_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x6a')]+(_0x243466(_0x18f841[_0x2254('0x68')][_0x315add]['condition'])?'\x20'+_0x18f841['rules'][_0x315add][_0x2254('0x88')]:'');}return _0x275b56+')';};var _0x51b02a={'where':{'id':_0x40339d[_0x2254('0x47')]['id']}},_0x3e7642,_0xe1abb6,_0x1a44d0,_0x4af6a7,_0x539aba;_0x51b02a=_[_0x2254('0x41')]({},_0x51b02a,_0x40339d[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x51b02a)['then'](function(_0x34e28b){if(_0x34e28b){_0x3e7642=_0x34e28b;return _0x34e28b[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x5d373){if(_0x5d373){if(!_0x5d373[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xe1abb6=_0x5d373;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x56a7ce){if(_0x56a7ce){_0x1a44d0=_[_0x2254('0x6e')](_0x56a7ce,'id');var _0x34bf19;var _0x4965c7=squel[_0x2254('0x6f')]();_0x4965c7[_0x2254('0x70')](_0x3e7642[_0x2254('0x7e')]);for(var _0x45541b=0x0;_0x45541b<_0xe1abb6[_0x2254('0x39')];_0x45541b+=0x1){_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x71')]?_0x1a44d0[_0xe1abb6[_0x45541b][_0x2254('0x71')]][_0x2254('0x8b')]:_0xe1abb6[_0x45541b][_0x2254('0x72')];_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x74')]?_[_0x2254('0x73')](_0x596eae[_0xe1abb6[_0x45541b][_0x2254('0x74')]],'%s',_0x34bf19):_0x34bf19;_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x8c')]?_[_0x2254('0x73')](_0x739a29[_0xe1abb6[_0x45541b]['format']],'%s',_0x34bf19):_0x34bf19;if(_0xe1abb6[_0x45541b][_0x2254('0x75')]){_0x4965c7[_0x2254('0x69')](_0x34bf19);}_0xe1abb6[_0x45541b]['orderBy']&&_0x4965c7['order'](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x4965c7[_0x2254('0x72')](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x77')]||_0x34bf19);}if(_0x3e7642['joins']){_0x3e7642[_0x2254('0x79')]=JSON['parse'](_0x3e7642['joins']);for(var _0x40fec0=0x0;_0x40fec0<_0x3e7642[_0x2254('0x79')][_0x2254('0x39')];_0x40fec0+=0x1){if(_0x3e7642[_0x2254('0x79')][_0x40fec0]['type']&&_[_0x2254('0x65')](_0x408695,_0x3e7642['joins'][_0x40fec0][_0x2254('0x30')])&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]){_0x4965c7[_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x30')]](_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0x3e7642[_0x2254('0x7e')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]));}}}if(_0x3e7642['conditions']){_0x3e7642[_0x2254('0x7f')]=JSON[_0x2254('0x78')](_0x3e7642[_0x2254('0x7f')]);_0x4965c7[_0x2254('0x3e')](_0xbec5d0(_0x3e7642[_0x2254('0x7f')]['group']));}_0x539aba=_0x4965c7[_0x2254('0x80')]();_0x4965c7[_0x2254('0x20')](_0x59b8af);_0x4965c7['offset'](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4965c7[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4965c7[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')][_0x2254('0xa3')]});}})[_0x2254('0x25')](function(){return{'sql':_0x539aba[_0x2254('0x83')]()};})['then'](respondWithResult(_0x4b3b96,null))[_0x2254('0x46')](handleError(_0x4b3b96,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 48e63fc..74af804 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 _0x6dc5=['define','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x4e2ce2,_0x5d96b4){var _0x5a8d91=function(_0x3aefd1){while(--_0x3aefd1){_0x4e2ce2['push'](_0x4e2ce2['shift']());}};_0x5a8d91(++_0x5d96b4);}(_0x6dc5,0x1f0));var _0x56dc=function(_0x2f9a10,_0x234107){_0x2f9a10=_0x2f9a10-0x0;var _0x20d9bb=_0x6dc5[_0x2f9a10];return _0x20d9bb;};'use strict';var _=require(_0x56dc('0x0'));var util=require(_0x56dc('0x1'));var logger=require(_0x56dc('0x2'))(_0x56dc('0x3'));var moment=require(_0x56dc('0x4'));var BPromise=require(_0x56dc('0x5'));var rp=require(_0x56dc('0x6'));var fs=require('fs');var path=require(_0x56dc('0x7'));var rimraf=require('rimraf');var config=require(_0x56dc('0x8'));var attributes=require(_0x56dc('0x9'));module[_0x56dc('0xa')]=function(_0x308d34,_0x7a58fe){return _0x308d34[_0x56dc('0xb')](_0x56dc('0xc'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4335=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x1c8c45,_0x4c18b0){var _0x1e139a=function(_0x4b5719){while(--_0x4b5719){_0x1c8c45['push'](_0x1c8c45['shift']());}};_0x1e139a(++_0x4c18b0);}(_0x4335,0x108));var _0x5433=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x4335[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require(_0x5433('0x0'));var util=require('util');var logger=require(_0x5433('0x1'))('api');var moment=require(_0x5433('0x2'));var BPromise=require(_0x5433('0x3'));var rp=require(_0x5433('0x4'));var fs=require('fs');var path=require(_0x5433('0x5'));var rimraf=require(_0x5433('0x6'));var config=require('../../config/environment');var attributes=require(_0x5433('0x7'));module['exports']=function(_0x11bb70,_0x2644b1){return _0x11bb70[_0x5433('0x8')](_0x5433('0x9'),attributes,{'tableName':_0x5433('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 52601c2..a1ff986 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 _0x92f1=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b4aea,_0x19d8ae){var _0x164b9d=function(_0x4c8d4c){while(--_0x4c8d4c){_0x2b4aea['push'](_0x2b4aea['shift']());}};_0x164b9d(++_0x19d8ae);}(_0x92f1,0x149));var _0x192f=function(_0x5c0b91,_0x547a6d){_0x5c0b91=_0x5c0b91-0x0;var _0x106490=_0x92f1[_0x5c0b91];return _0x106490;};'use strict';var _=require(_0x192f('0x0'));var util=require('util');var moment=require(_0x192f('0x1'));var BPromise=require(_0x192f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x192f('0x3'));var db=require(_0x192f('0x4'))['db'];var utils=require(_0x192f('0x5'));var logger=require(_0x192f('0x6'))(_0x192f('0x7'));var config=require(_0x192f('0x8'));var jayson=require(_0x192f('0x9'));var client=jayson[_0x192f('0xa')][_0x192f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27c290,_0x141247,_0x18a67b){return new BPromise(function(_0x8bcbf2,_0x3d454c){return client['request'](_0x27c290,_0x18a67b)[_0x192f('0xc')](function(_0x4d6cc7){logger[_0x192f('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x141247,_0x192f('0xe'));logger[_0x192f('0xf')](_0x192f('0x10'),_0x141247,_0x192f('0xe'),JSON[_0x192f('0x11')](_0x4d6cc7));if(_0x4d6cc7['error']){if(_0x4d6cc7[_0x192f('0x12')][_0x192f('0x13')]===0x1f4){logger[_0x192f('0x12')](_0x192f('0x14'),_0x141247,_0x4d6cc7[_0x192f('0x12')][_0x192f('0x15')]);return _0x3d454c(_0x4d6cc7[_0x192f('0x12')][_0x192f('0x15')]);}logger['error'](_0x192f('0x14'),_0x141247,_0x4d6cc7[_0x192f('0x12')]['message']);return _0x8bcbf2(_0x4d6cc7[_0x192f('0x12')][_0x192f('0x15')]);}else{logger[_0x192f('0xd')](_0x192f('0x14'),_0x141247,'request\x20sent');_0x8bcbf2(_0x4d6cc7[_0x192f('0x16')][_0x192f('0x15')]);}})[_0x192f('0x17')](function(_0x5ae832){logger[_0x192f('0x12')](_0x192f('0x14'),_0x141247,_0x5ae832);_0x3d454c(_0x5ae832);});});} \ No newline at end of file +var _0xcaa7=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x586837,_0x4f9ed1){var _0xea18c3=function(_0x3682a6){while(--_0x3682a6){_0x586837['push'](_0x586837['shift']());}};_0xea18c3(++_0x4f9ed1);}(_0xcaa7,0x13e));var _0x7caa=function(_0x8e12a1,_0x1c6949){_0x8e12a1=_0x8e12a1-0x0;var _0x4ffbc7=_0xcaa7[_0x8e12a1];return _0x4ffbc7;};'use strict';var _=require(_0x7caa('0x0'));var util=require(_0x7caa('0x1'));var moment=require('moment');var BPromise=require(_0x7caa('0x2'));var rs=require(_0x7caa('0x3'));var fs=require('fs');var Redis=require(_0x7caa('0x4'));var db=require(_0x7caa('0x5'))['db'];var utils=require(_0x7caa('0x6'));var logger=require(_0x7caa('0x7'))(_0x7caa('0x8'));var config=require(_0x7caa('0x9'));var jayson=require(_0x7caa('0xa'));var client=jayson[_0x7caa('0xb')][_0x7caa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x503509,_0x49fe5b,_0x267f47){return new BPromise(function(_0x3318e7,_0x3c7d8c){return client[_0x7caa('0xd')](_0x503509,_0x267f47)[_0x7caa('0xe')](function(_0x531c5f){logger['info'](_0x7caa('0xf'),_0x49fe5b,_0x7caa('0x10'));logger[_0x7caa('0x11')](_0x7caa('0x12'),_0x49fe5b,_0x7caa('0x10'),JSON[_0x7caa('0x13')](_0x531c5f));if(_0x531c5f['error']){if(_0x531c5f[_0x7caa('0x14')][_0x7caa('0x15')]===0x1f4){logger[_0x7caa('0x14')](_0x7caa('0xf'),_0x49fe5b,_0x531c5f['error'][_0x7caa('0x16')]);return _0x3c7d8c(_0x531c5f[_0x7caa('0x14')]['message']);}logger[_0x7caa('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x49fe5b,_0x531c5f[_0x7caa('0x14')][_0x7caa('0x16')]);return _0x3318e7(_0x531c5f[_0x7caa('0x14')][_0x7caa('0x16')]);}else{logger[_0x7caa('0x17')](_0x7caa('0xf'),_0x49fe5b,_0x7caa('0x10'));_0x3318e7(_0x531c5f[_0x7caa('0x18')]['message']);}})[_0x7caa('0x19')](function(_0x3c800f){logger[_0x7caa('0x14')](_0x7caa('0xf'),_0x49fe5b,_0x3c800f);_0x3c7d8c(_0x3c800f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index c2b86f7..83b9f8b 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 _0xa070=['update','delete','/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/preview','preview','run','/:id/query','query','post','create','put'];(function(_0xddf23b,_0x3b3b77){var _0x100b75=function(_0x413058){while(--_0x413058){_0xddf23b['push'](_0xddf23b['shift']());}};_0x100b75(++_0x3b3b77);}(_0xa070,0x94));var _0x0a07=function(_0x1185e9,_0x34e1a5){_0x1185e9=_0x1185e9-0x0;var _0x91cf24=_0xa070[_0x1185e9];return _0x91cf24;};'use strict';var multer=require(_0x0a07('0x0'));var util=require(_0x0a07('0x1'));var path=require('path');var timeout=require(_0x0a07('0x2'));var express=require(_0x0a07('0x3'));var router=express[_0x0a07('0x4')]();var fs_extra=require(_0x0a07('0x5'));var auth=require(_0x0a07('0x6'));var interaction=require(_0x0a07('0x7'));var config=require(_0x0a07('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0x0a07('0x9')]('/',auth[_0x0a07('0xa')](),controller['index']);router[_0x0a07('0x9')]('/:id',auth[_0x0a07('0xa')](),controller[_0x0a07('0xb')]);router[_0x0a07('0x9')](_0x0a07('0xc'),auth['isAuthenticated'](),controller[_0x0a07('0xd')]);router['get']('/:id/run',auth[_0x0a07('0xa')](),controller[_0x0a07('0xe')]);router['get'](_0x0a07('0xf'),auth[_0x0a07('0xa')](),controller[_0x0a07('0x10')]);router[_0x0a07('0x11')]('/',auth[_0x0a07('0xa')](),controller[_0x0a07('0x12')]);router[_0x0a07('0x13')]('/:id',auth[_0x0a07('0xa')](),controller[_0x0a07('0x14')]);router[_0x0a07('0x15')](_0x0a07('0x16'),auth[_0x0a07('0xa')](),controller[_0x0a07('0x17')]);module['exports']=router; \ No newline at end of file +var _0x3139=['get','isAuthenticated','index','show','preview','/:id/run','run','query','post','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./analyticDefaultReport.controller'];(function(_0xedbd17,_0x2d79af){var _0x18b70e=function(_0x5f52d6){while(--_0x5f52d6){_0xedbd17['push'](_0xedbd17['shift']());}};_0x18b70e(++_0x2d79af);}(_0x3139,0x138));var _0x9313=function(_0x4ba1bf,_0x37cbdb){_0x4ba1bf=_0x4ba1bf-0x0;var _0x160d78=_0x3139[_0x4ba1bf];return _0x160d78;};'use strict';var multer=require(_0x9313('0x0'));var util=require(_0x9313('0x1'));var path=require(_0x9313('0x2'));var timeout=require(_0x9313('0x3'));var express=require('express');var router=express[_0x9313('0x4')]();var fs_extra=require(_0x9313('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9313('0x6'));var config=require('../../config/environment');var controller=require(_0x9313('0x7'));router[_0x9313('0x8')]('/',auth[_0x9313('0x9')](),controller[_0x9313('0xa')]);router['get']('/:id',auth[_0x9313('0x9')](),controller[_0x9313('0xb')]);router['get']('/:id/preview',auth[_0x9313('0x9')](),controller[_0x9313('0xc')]);router['get'](_0x9313('0xd'),auth[_0x9313('0x9')](),controller[_0x9313('0xe')]);router[_0x9313('0x8')]('/:id/query',auth[_0x9313('0x9')](),controller[_0x9313('0xf')]);router[_0x9313('0x10')]('/',auth[_0x9313('0x9')](),controller['create']);router['put'](_0x9313('0x11'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9313('0x11'),auth[_0x9313('0x9')](),controller[_0x9313('0x12')]);module[_0x9313('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 59c88a5..0fc65dc 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 _0xa6f4=['manual','scheduled','INTEGER','sequelize','moment','exports','STRING','ENUM','csv','xlsx','DATE'];(function(_0x2764a4,_0xe2816d){var _0x1100ed=function(_0x1b3794){while(--_0x1b3794){_0x2764a4['push'](_0x2764a4['shift']());}};_0x1100ed(++_0xe2816d);}(_0xa6f4,0x1f2));var _0x4a6f=function(_0x589fab,_0x114e95){_0x589fab=_0x589fab-0x0;var _0x454a2e=_0xa6f4[_0x589fab];return _0x454a2e;};'use strict';var Sequelize=require(_0x4a6f('0x0'));var moment=require(_0x4a6f('0x1'));module[_0x4a6f('0x2')]={'name':{'type':Sequelize[_0x4a6f('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x4a6f('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x4a6f('0x4')](_0x4a6f('0x5'),'pdf',_0x4a6f('0x6')),'allowNull':![],'defaultValue':_0x4a6f('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x4a6f('0x7')]},'endDate':{'type':Sequelize[_0x4a6f('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x4a6f('0x8'),_0x4a6f('0x9')),'allowNull':![],'defaultValue':_0x4a6f('0x8')},'reportId':{'type':Sequelize[_0x4a6f('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f6e=['DATE','scheduled','INTEGER','UNSIGNED','sequelize','STRING','csv'];(function(_0xafa717,_0x597a44){var _0x2614b6=function(_0x289f64){while(--_0x289f64){_0xafa717['push'](_0xafa717['shift']());}};_0x2614b6(++_0x597a44);}(_0x6f6e,0x115));var _0xe6f6=function(_0x2aa886,_0x16b6a4){_0x2aa886=_0x2aa886-0x0;var _0xd6ff3a=_0x6f6e[_0x2aa886];return _0xd6ff3a;};'use strict';var Sequelize=require(_0xe6f6('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0xe6f6('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xe6f6('0x2'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xe6f6('0x3')]},'endDate':{'type':Sequelize[_0xe6f6('0x3')]},'status':{'type':Sequelize[_0xe6f6('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM']('manual',_0xe6f6('0x4')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xe6f6('0x5')](0xb)[_0xe6f6('0x6')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index b03d9e4..81e33c1 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 _0x2bea=['mustache','sox','to-csv','ejs','fs-extra','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','AnalyticExtractedReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','savename','output','existsSync','join','server/files/reports','Sequelize','root','format','%s.%s','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x438207,_0x525a5b){var _0x106e22=function(_0x24bd32){while(--_0x24bd32){_0x438207['push'](_0x438207['shift']());}};_0x106e22(++_0x525a5b);}(_0x2bea,0x10d));var _0xa2be=function(_0x3bd9ed,_0x4d40b6){_0x3bd9ed=_0x3bd9ed-0x0;var _0x18e6c5=_0x2bea[_0x3bd9ed];return _0x18e6c5;};'use strict';var emlformat=require(_0xa2be('0x0'));var rimraf=require(_0xa2be('0x1'));var zipdir=require(_0xa2be('0x2'));var jsonpatch=require(_0xa2be('0x3'));var rp=require(_0xa2be('0x4'));var moment=require(_0xa2be('0x5'));var BPromise=require(_0xa2be('0x6'));var Mustache=require(_0xa2be('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa2be('0x8'));var csv=require(_0xa2be('0x9'));var ejs=require(_0xa2be('0xa'));var fs=require('fs');var fs_extra=require(_0xa2be('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa2be('0xc'));var toCsv=require(_0xa2be('0x9'));var querystring=require(_0xa2be('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa2be('0xe'));var as=require(_0xa2be('0xf'));var hardwareService=require(_0xa2be('0x10'));var logger=require(_0xa2be('0x11'))(_0xa2be('0x12'));var utils=require(_0xa2be('0x13'));var config=require(_0xa2be('0x14'));var licenseUtil=require(_0xa2be('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1976db,_0x10c072){_0x10c072=_0x10c072||0xcc;return function(_0x1b5086){if(_0x1b5086){return _0x1976db[_0xa2be('0x16')](_0x10c072);}return _0x1976db[_0xa2be('0x17')](_0x10c072)[_0xa2be('0x18')]();};}function respondWithResult(_0x5797a6,_0x4de4a3){_0x4de4a3=_0x4de4a3||0xc8;return function(_0xcd2fb8){if(_0xcd2fb8){return _0x5797a6[_0xa2be('0x17')](_0x4de4a3)[_0xa2be('0x19')](_0xcd2fb8);}};}function respondWithFilteredResult(_0x46fa89,_0x500e0d){return function(_0x4cec0c){if(_0x4cec0c){var _0x57c3ac=typeof _0x500e0d['offset']===_0xa2be('0x1a')&&typeof _0x500e0d[_0xa2be('0x1b')]===_0xa2be('0x1a');var _0x360098=_0x4cec0c['count'];var _0x88d53=_0x57c3ac?0x0:_0x500e0d['offset'];var _0x3497e2=_0x57c3ac?_0x4cec0c[_0xa2be('0x1c')]:_0x500e0d[_0xa2be('0x1d')]+_0x500e0d[_0xa2be('0x1b')];var _0x52b678;if(_0x3497e2>=_0x360098){_0x3497e2=_0x360098;_0x52b678=0xc8;}else{_0x52b678=0xce;}_0x46fa89[_0xa2be('0x17')](_0x52b678);return _0x46fa89['set'](_0xa2be('0x1e'),_0x88d53+'-'+_0x3497e2+'/'+_0x360098)[_0xa2be('0x19')](_0x4cec0c);}return null;};}function patchUpdates(_0x3bc248){return function(_0x5456f9){try{jsonpatch[_0xa2be('0x1f')](_0x5456f9,_0x3bc248,!![]);}catch(_0x334c93){return BPromise[_0xa2be('0x20')](_0x334c93);}return _0x5456f9[_0xa2be('0x21')]();};}function saveUpdates(_0x58975b,_0x1c0ecb){return function(_0x3999ca){if(_0x3999ca){return _0x3999ca[_0xa2be('0x22')](_0x58975b)[_0xa2be('0x23')](function(_0x3ffdcb){return _0x3ffdcb;});}return null;};}function removeEntity(_0x1944ee,_0x56d8c9){return function(_0x32afc6){if(_0x32afc6){return _0x32afc6[_0xa2be('0x24')]()[_0xa2be('0x23')](function(){var _0x4e9486=_0x32afc6[_0xa2be('0x25')]({'plain':!![]});var _0x5c2109='ExtractedReports';return db[_0xa2be('0x26')][_0xa2be('0x24')]({'where':{'type':_0x5c2109,'resourceId':_0x4e9486['id']}})[_0xa2be('0x23')](function(){return _0x32afc6;});})[_0xa2be('0x23')](function(){_0x1944ee[_0xa2be('0x17')](0xcc)[_0xa2be('0x18')]();});}};}function handleEntityNotFound(_0x56e465,_0x3b40a4){return function(_0x2fadec){if(!_0x2fadec){_0x56e465[_0xa2be('0x16')](0x194);}return _0x2fadec;};}function handleError(_0x26dd6d,_0x79ce88){_0x79ce88=_0x79ce88||0x1f4;return function(_0x1abcfa){logger[_0xa2be('0x27')](_0x1abcfa[_0xa2be('0x28')]);if(_0x1abcfa[_0xa2be('0x29')]){delete _0x1abcfa['name'];}_0x26dd6d['status'](_0x79ce88)[_0xa2be('0x2a')](_0x1abcfa);};}exports['index']=function(_0x4648fd,_0x5250d2){var _0x218ef0={},_0x423e29={},_0x2b3100={'count':0x0,'rows':[]};var _0x488bf8=_[_0xa2be('0x2b')](db[_0xa2be('0x2c')]['rawAttributes'],function(_0x2a25e2){return{'name':_0x2a25e2[_0xa2be('0x2d')],'type':_0x2a25e2[_0xa2be('0x2e')][_0xa2be('0x2f')]};});_0x423e29[_0xa2be('0x30')]=_[_0xa2be('0x2b')](_0x488bf8,'name');_0x423e29[_0xa2be('0x31')]=_['keys'](_0x4648fd[_0xa2be('0x31')]);_0x423e29[_0xa2be('0x32')]=_[_0xa2be('0x33')](_0x423e29[_0xa2be('0x30')],_0x423e29[_0xa2be('0x31')]);_0x218ef0[_0xa2be('0x34')]=_['intersection'](_0x423e29[_0xa2be('0x30')],qs['fields'](_0x4648fd[_0xa2be('0x31')][_0xa2be('0x35')]));_0x218ef0[_0xa2be('0x34')]=_0x218ef0[_0xa2be('0x34')][_0xa2be('0x36')]?_0x218ef0['attributes']:_0x423e29['model'];if(!_0x4648fd[_0xa2be('0x31')]['hasOwnProperty'](_0xa2be('0x37'))){_0x218ef0[_0xa2be('0x1b')]=qs[_0xa2be('0x1b')](_0x4648fd[_0xa2be('0x31')][_0xa2be('0x1b')]);_0x218ef0[_0xa2be('0x1d')]=qs[_0xa2be('0x1d')](_0x4648fd[_0xa2be('0x31')][_0xa2be('0x1d')]);}_0x218ef0[_0xa2be('0x38')]=qs[_0xa2be('0x39')](_0x4648fd['query'][_0xa2be('0x39')]);_0x218ef0['where']=qs[_0xa2be('0x32')](_[_0xa2be('0x3a')](_0x4648fd[_0xa2be('0x31')],_0x423e29[_0xa2be('0x32')]),_0x488bf8);if(_0x4648fd[_0xa2be('0x31')][_0xa2be('0x3b')]){_0x218ef0[_0xa2be('0x3c')]=_[_0xa2be('0x3d')](_0x218ef0[_0xa2be('0x3c')],{'$or':_['map'](_0x488bf8,function(_0x34578d){if(_0x34578d['type']!==_0xa2be('0x3e')){var _0x5bb0a6={};_0x5bb0a6[_0x34578d['name']]={'$like':'%'+_0x4648fd['query'][_0xa2be('0x3b')]+'%'};return _0x5bb0a6;}})});}_0x218ef0=_[_0xa2be('0x3d')]({},_0x218ef0,_0x4648fd[_0xa2be('0x3f')]);var _0x24dc88={'where':_0x218ef0[_0xa2be('0x3c')]};return db[_0xa2be('0x2c')][_0xa2be('0x1c')](_0x24dc88)[_0xa2be('0x23')](function(_0x263473){_0x2b3100[_0xa2be('0x1c')]=_0x263473;if(_0x4648fd[_0xa2be('0x31')]['includeAll']){_0x218ef0[_0xa2be('0x40')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xa2be('0x41')](_0x218ef0);})[_0xa2be('0x23')](function(_0x434133){_0x2b3100[_0xa2be('0x42')]=_0x434133;return _0x2b3100;})['then'](respondWithFilteredResult(_0x5250d2,_0x218ef0))[_0xa2be('0x43')](handleError(_0x5250d2,null));};exports[_0xa2be('0x44')]=function(_0x2cf4d7,_0x4eefd4){var _0x43614a={'raw':!![],'where':{'id':_0x2cf4d7['params']['id']}},_0x4c081b={};_0x4c081b['model']=_[_0xa2be('0x45')](db[_0xa2be('0x2c')][_0xa2be('0x46')]);_0x4c081b[_0xa2be('0x31')]=_[_0xa2be('0x45')](_0x2cf4d7[_0xa2be('0x31')]);_0x4c081b[_0xa2be('0x32')]=_[_0xa2be('0x33')](_0x4c081b['model'],_0x4c081b[_0xa2be('0x31')]);_0x43614a['attributes']=_['intersection'](_0x4c081b[_0xa2be('0x30')],qs['fields'](_0x2cf4d7[_0xa2be('0x31')][_0xa2be('0x35')]));_0x43614a['attributes']=_0x43614a['attributes']['length']?_0x43614a[_0xa2be('0x34')]:_0x4c081b[_0xa2be('0x30')];if(_0x2cf4d7[_0xa2be('0x31')]['includeAll']){_0x43614a[_0xa2be('0x40')]=[{'all':!![]}];}_0x43614a=_[_0xa2be('0x3d')]({},_0x43614a,_0x2cf4d7['options']);return db['AnalyticExtractedReport'][_0xa2be('0x47')](_0x43614a)[_0xa2be('0x23')](handleEntityNotFound(_0x4eefd4,null))['then'](respondWithResult(_0x4eefd4,null))[_0xa2be('0x43')](handleError(_0x4eefd4,null));};exports[_0xa2be('0x48')]=function(_0x174669,_0x31bb10){return db[_0xa2be('0x2c')]['create'](_0x174669[_0xa2be('0x49')],{})['then'](function(_0x5ed893){var _0xc75b70=_0x174669['user'][_0xa2be('0x25')]({'plain':!![]});if(!_0xc75b70)throw new Error(_0xa2be('0x4a'));if(_0xc75b70[_0xa2be('0x4b')]===_0xa2be('0x4c')){var _0x5a1202=_0x5ed893['get']({'plain':!![]});var _0x3f7686=_0xa2be('0x4d');return db[_0xa2be('0x4e')]['find']({'where':{'name':_0x3f7686,'userProfileId':_0xc75b70['userProfileId']},'raw':!![]})[_0xa2be('0x23')](function(_0x41e2ce){if(_0x41e2ce&&_0x41e2ce['autoAssociation']===0x0){return db['UserProfileResource'][_0xa2be('0x48')]({'name':_0x5a1202[_0xa2be('0x29')],'resourceId':_0x5a1202['id'],'type':_0x41e2ce['name'],'sectionId':_0x41e2ce['id']},{})['then'](function(){return _0x5ed893;});}else{return _0x5ed893;}})['catch'](function(_0x5edca7){logger[_0xa2be('0x27')](_0xa2be('0x4f'),_0x5edca7);throw _0x5edca7;});}return _0x5ed893;})[_0xa2be('0x23')](respondWithResult(_0x31bb10,0xc9))[_0xa2be('0x43')](handleError(_0x31bb10,null));};exports[_0xa2be('0x22')]=function(_0xe37b11,_0x46f635){if(_0xe37b11['body']['id']){delete _0xe37b11[_0xa2be('0x49')]['id'];}return db[_0xa2be('0x2c')][_0xa2be('0x47')]({'where':{'id':_0xe37b11[_0xa2be('0x50')]['id']}})[_0xa2be('0x23')](handleEntityNotFound(_0x46f635,null))[_0xa2be('0x23')](saveUpdates(_0xe37b11[_0xa2be('0x49')],null))[_0xa2be('0x23')](respondWithResult(_0x46f635,null))[_0xa2be('0x43')](handleError(_0x46f635,null));};exports[_0xa2be('0x24')]=function(_0x2fa181,_0x18c7db){return db['AnalyticExtractedReport'][_0xa2be('0x47')]({'where':{'id':_0x2fa181[_0xa2be('0x50')]['id']}})['then'](handleEntityNotFound(_0x18c7db,null))['then'](removeEntity(_0x18c7db,null))['catch'](handleError(_0x18c7db,null));};exports[_0xa2be('0x51')]=function(_0x1712ed,_0x28ae8c,_0x709b74){return db['AnalyticExtractedReport'][_0xa2be('0x47')]({'where':{'id':_0x1712ed[_0xa2be('0x50')]['id']},'attributes':[_0xa2be('0x29'),'basename',_0xa2be('0x52'),_0xa2be('0x53')],'raw':!![]})[_0xa2be('0x23')](handleEntityNotFound(_0x28ae8c,null))[_0xa2be('0x23')](function(_0x11b64e){if(_0x11b64e){if(!fs[_0xa2be('0x54')](path[_0xa2be('0x55')](config['root'],_0xa2be('0x56'),_0x11b64e['savename']))){throw new db[(_0xa2be('0x57'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x1712ed[_0xa2be('0x31')]['exists']){return _0x28ae8c['sendStatus'](0xc8);}return _0x28ae8c[_0xa2be('0x51')](path[_0xa2be('0x55')](config[_0xa2be('0x58')],'server/files/reports',_0x11b64e[_0xa2be('0x52')]),util[_0xa2be('0x59')](_0xa2be('0x5a'),_0x11b64e[_0xa2be('0x5b')]||_0x11b64e[_0xa2be('0x29')],_0x11b64e['output']['toLowerCase']()));}})[_0xa2be('0x43')](handleError(_0x28ae8c,null));}; \ No newline at end of file +var _0xa828=['eml-format','rimraf','zip-dir','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase'];(function(_0x9f709c,_0x4e4f4d){var _0x4d1c7c=function(_0x2ce156){while(--_0x2ce156){_0x9f709c['push'](_0x9f709c['shift']());}};_0x4d1c7c(++_0x4e4f4d);}(_0xa828,0x126));var _0x8a82=function(_0x49f42e,_0x4a370d){_0x49f42e=_0x49f42e-0x0;var _0xbb9128=_0xa828[_0x49f42e];return _0xbb9128;};'use strict';var emlformat=require(_0x8a82('0x0'));var rimraf=require(_0x8a82('0x1'));var zipdir=require(_0x8a82('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a82('0x3'));var Mustache=require(_0x8a82('0x4'));var util=require(_0x8a82('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8a82('0x6'));var ejs=require(_0x8a82('0x7'));var fs=require('fs');var fs_extra=require(_0x8a82('0x8'));var _=require(_0x8a82('0x9'));var squel=require(_0x8a82('0xa'));var crypto=require(_0x8a82('0xb'));var jsforce=require(_0x8a82('0xc'));var deskjs=require(_0x8a82('0xd'));var toCsv=require(_0x8a82('0x6'));var querystring=require('querystring');var Papa=require(_0x8a82('0xe'));var Redis=require(_0x8a82('0xf'));var authService=require(_0x8a82('0x10'));var qs=require(_0x8a82('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a82('0x12'));var logger=require(_0x8a82('0x13'))('api');var utils=require(_0x8a82('0x14'));var config=require(_0x8a82('0x15'));var licenseUtil=require(_0x8a82('0x16'));var db=require(_0x8a82('0x17'))['db'];function respondWithStatusCode(_0x48be57,_0x1b105e){_0x1b105e=_0x1b105e||0xcc;return function(_0x37dba6){if(_0x37dba6){return _0x48be57[_0x8a82('0x18')](_0x1b105e);}return _0x48be57['status'](_0x1b105e)[_0x8a82('0x19')]();};}function respondWithResult(_0x40d8ef,_0x36b379){_0x36b379=_0x36b379||0xc8;return function(_0x10477b){if(_0x10477b){return _0x40d8ef[_0x8a82('0x1a')](_0x36b379)[_0x8a82('0x1b')](_0x10477b);}};}function respondWithFilteredResult(_0xd4b1f4,_0x51751b){return function(_0x4023eb){if(_0x4023eb){var _0x414a74=typeof _0x51751b['offset']==='undefined'&&typeof _0x51751b['limit']==='undefined';var _0xf94f21=_0x4023eb['count'];var _0x1a058e=_0x414a74?0x0:_0x51751b[_0x8a82('0x1c')];var _0xae790f=_0x414a74?_0x4023eb[_0x8a82('0x1d')]:_0x51751b['offset']+_0x51751b['limit'];var _0x5e9a95;if(_0xae790f>=_0xf94f21){_0xae790f=_0xf94f21;_0x5e9a95=0xc8;}else{_0x5e9a95=0xce;}_0xd4b1f4[_0x8a82('0x1a')](_0x5e9a95);return _0xd4b1f4[_0x8a82('0x1e')](_0x8a82('0x1f'),_0x1a058e+'-'+_0xae790f+'/'+_0xf94f21)[_0x8a82('0x1b')](_0x4023eb);}return null;};}function patchUpdates(_0x16e831){return function(_0x545d14){try{jsonpatch[_0x8a82('0x20')](_0x545d14,_0x16e831,!![]);}catch(_0x4bb49c){return BPromise[_0x8a82('0x21')](_0x4bb49c);}return _0x545d14[_0x8a82('0x22')]();};}function saveUpdates(_0x4a940a,_0x202cb8){return function(_0x286af5){if(_0x286af5){return _0x286af5[_0x8a82('0x23')](_0x4a940a)[_0x8a82('0x24')](function(_0x530dad){return _0x530dad;});}return null;};}function removeEntity(_0x250241,_0x1b5e76){return function(_0x11e66c){if(_0x11e66c){return _0x11e66c[_0x8a82('0x25')]()[_0x8a82('0x24')](function(){var _0x433e65=_0x11e66c[_0x8a82('0x26')]({'plain':!![]});var _0x55597b=_0x8a82('0x27');return db[_0x8a82('0x28')]['destroy']({'where':{'type':_0x55597b,'resourceId':_0x433e65['id']}})['then'](function(){return _0x11e66c;});})['then'](function(){_0x250241[_0x8a82('0x1a')](0xcc)[_0x8a82('0x19')]();});}};}function handleEntityNotFound(_0x2f7378,_0x3d2baf){return function(_0x50012d){if(!_0x50012d){_0x2f7378[_0x8a82('0x18')](0x194);}return _0x50012d;};}function handleError(_0xb3d2cc,_0x2a1df7){_0x2a1df7=_0x2a1df7||0x1f4;return function(_0xf060d0){logger['error'](_0xf060d0[_0x8a82('0x29')]);if(_0xf060d0[_0x8a82('0x2a')]){delete _0xf060d0[_0x8a82('0x2a')];}_0xb3d2cc[_0x8a82('0x1a')](_0x2a1df7)['send'](_0xf060d0);};}exports['index']=function(_0x3edf47,_0x254284){var _0x5356e1={},_0x3882d1={},_0x53657c={'count':0x0,'rows':[]};var _0x5043c8=_[_0x8a82('0x2b')](db[_0x8a82('0x2c')][_0x8a82('0x2d')],function(_0x38de7e){return{'name':_0x38de7e[_0x8a82('0x2e')],'type':_0x38de7e[_0x8a82('0x2f')][_0x8a82('0x30')]};});_0x3882d1['model']=_[_0x8a82('0x2b')](_0x5043c8,'name');_0x3882d1[_0x8a82('0x31')]=_[_0x8a82('0x32')](_0x3edf47[_0x8a82('0x31')]);_0x3882d1[_0x8a82('0x33')]=_['intersection'](_0x3882d1[_0x8a82('0x34')],_0x3882d1['query']);_0x5356e1[_0x8a82('0x35')]=_[_0x8a82('0x36')](_0x3882d1[_0x8a82('0x34')],qs[_0x8a82('0x37')](_0x3edf47[_0x8a82('0x31')][_0x8a82('0x37')]));_0x5356e1[_0x8a82('0x35')]=_0x5356e1[_0x8a82('0x35')][_0x8a82('0x38')]?_0x5356e1[_0x8a82('0x35')]:_0x3882d1['model'];if(!_0x3edf47[_0x8a82('0x31')][_0x8a82('0x39')](_0x8a82('0x3a'))){_0x5356e1[_0x8a82('0x3b')]=qs['limit'](_0x3edf47[_0x8a82('0x31')][_0x8a82('0x3b')]);_0x5356e1['offset']=qs[_0x8a82('0x1c')](_0x3edf47[_0x8a82('0x31')][_0x8a82('0x1c')]);}_0x5356e1[_0x8a82('0x3c')]=qs[_0x8a82('0x3d')](_0x3edf47[_0x8a82('0x31')][_0x8a82('0x3d')]);_0x5356e1[_0x8a82('0x3e')]=qs['filters'](_[_0x8a82('0x3f')](_0x3edf47[_0x8a82('0x31')],_0x3882d1[_0x8a82('0x33')]),_0x5043c8);if(_0x3edf47[_0x8a82('0x31')][_0x8a82('0x40')]){_0x5356e1[_0x8a82('0x3e')]=_[_0x8a82('0x41')](_0x5356e1[_0x8a82('0x3e')],{'$or':_[_0x8a82('0x2b')](_0x5043c8,function(_0x4c8a12){if(_0x4c8a12['type']!==_0x8a82('0x42')){var _0x5049af={};_0x5049af[_0x4c8a12[_0x8a82('0x2a')]]={'$like':'%'+_0x3edf47[_0x8a82('0x31')][_0x8a82('0x40')]+'%'};return _0x5049af;}})});}_0x5356e1=_[_0x8a82('0x41')]({},_0x5356e1,_0x3edf47[_0x8a82('0x43')]);var _0x3838e9={'where':_0x5356e1[_0x8a82('0x3e')]};return db[_0x8a82('0x2c')][_0x8a82('0x1d')](_0x3838e9)['then'](function(_0x4094bf){_0x53657c['count']=_0x4094bf;if(_0x3edf47['query'][_0x8a82('0x44')]){_0x5356e1[_0x8a82('0x45')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x8a82('0x46')](_0x5356e1);})[_0x8a82('0x24')](function(_0x4278a9){_0x53657c[_0x8a82('0x47')]=_0x4278a9;return _0x53657c;})['then'](respondWithFilteredResult(_0x254284,_0x5356e1))['catch'](handleError(_0x254284,null));};exports[_0x8a82('0x48')]=function(_0x523e97,_0x4ce275){var _0x4e252a={'raw':!![],'where':{'id':_0x523e97[_0x8a82('0x49')]['id']}},_0x1906c7={};_0x1906c7[_0x8a82('0x34')]=_['keys'](db['AnalyticExtractedReport'][_0x8a82('0x2d')]);_0x1906c7[_0x8a82('0x31')]=_[_0x8a82('0x32')](_0x523e97['query']);_0x1906c7['filters']=_[_0x8a82('0x36')](_0x1906c7['model'],_0x1906c7[_0x8a82('0x31')]);_0x4e252a[_0x8a82('0x35')]=_[_0x8a82('0x36')](_0x1906c7[_0x8a82('0x34')],qs[_0x8a82('0x37')](_0x523e97[_0x8a82('0x31')][_0x8a82('0x37')]));_0x4e252a['attributes']=_0x4e252a['attributes'][_0x8a82('0x38')]?_0x4e252a[_0x8a82('0x35')]:_0x1906c7['model'];if(_0x523e97['query'][_0x8a82('0x44')]){_0x4e252a[_0x8a82('0x45')]=[{'all':!![]}];}_0x4e252a=_[_0x8a82('0x41')]({},_0x4e252a,_0x523e97[_0x8a82('0x43')]);return db[_0x8a82('0x2c')][_0x8a82('0x4a')](_0x4e252a)[_0x8a82('0x24')](handleEntityNotFound(_0x4ce275,null))[_0x8a82('0x24')](respondWithResult(_0x4ce275,null))['catch'](handleError(_0x4ce275,null));};exports[_0x8a82('0x4b')]=function(_0x1df856,_0x16d2a1){return db['AnalyticExtractedReport'][_0x8a82('0x4b')](_0x1df856[_0x8a82('0x4c')],{})[_0x8a82('0x24')](function(_0x47ba21){var _0x2d1c6d=_0x1df856[_0x8a82('0x4d')][_0x8a82('0x26')]({'plain':!![]});if(!_0x2d1c6d)throw new Error(_0x8a82('0x4e'));if(_0x2d1c6d['role']===_0x8a82('0x4d')){var _0x4e7783=_0x47ba21['get']({'plain':!![]});var _0x3dc236=_0x8a82('0x27');return db['UserProfileSection'][_0x8a82('0x4a')]({'where':{'name':_0x3dc236,'userProfileId':_0x2d1c6d[_0x8a82('0x4f')]},'raw':!![]})[_0x8a82('0x24')](function(_0x5d7c7c){if(_0x5d7c7c&&_0x5d7c7c[_0x8a82('0x50')]===0x0){return db['UserProfileResource'][_0x8a82('0x4b')]({'name':_0x4e7783[_0x8a82('0x2a')],'resourceId':_0x4e7783['id'],'type':_0x5d7c7c[_0x8a82('0x2a')],'sectionId':_0x5d7c7c['id']},{})[_0x8a82('0x24')](function(){return _0x47ba21;});}else{return _0x47ba21;}})[_0x8a82('0x51')](function(_0x5799b0){logger['error'](_0x8a82('0x52'),_0x5799b0);throw _0x5799b0;});}return _0x47ba21;})[_0x8a82('0x24')](respondWithResult(_0x16d2a1,0xc9))[_0x8a82('0x51')](handleError(_0x16d2a1,null));};exports[_0x8a82('0x23')]=function(_0x469c94,_0x41eaf4){if(_0x469c94[_0x8a82('0x4c')]['id']){delete _0x469c94[_0x8a82('0x4c')]['id'];}return db[_0x8a82('0x2c')]['find']({'where':{'id':_0x469c94[_0x8a82('0x49')]['id']}})[_0x8a82('0x24')](handleEntityNotFound(_0x41eaf4,null))[_0x8a82('0x24')](saveUpdates(_0x469c94[_0x8a82('0x4c')],null))[_0x8a82('0x24')](respondWithResult(_0x41eaf4,null))[_0x8a82('0x51')](handleError(_0x41eaf4,null));};exports[_0x8a82('0x25')]=function(_0x14f9a6,_0x5e44ef){return db[_0x8a82('0x2c')][_0x8a82('0x4a')]({'where':{'id':_0x14f9a6[_0x8a82('0x49')]['id']}})[_0x8a82('0x24')](handleEntityNotFound(_0x5e44ef,null))[_0x8a82('0x24')](removeEntity(_0x5e44ef,null))['catch'](handleError(_0x5e44ef,null));};exports[_0x8a82('0x53')]=function(_0x2799d5,_0x327440,_0x1f08f7){return db['AnalyticExtractedReport'][_0x8a82('0x4a')]({'where':{'id':_0x2799d5[_0x8a82('0x49')]['id']},'attributes':['name',_0x8a82('0x54'),_0x8a82('0x55'),_0x8a82('0x56')],'raw':!![]})[_0x8a82('0x24')](handleEntityNotFound(_0x327440,null))[_0x8a82('0x24')](function(_0x34a0df){if(_0x34a0df){if(!fs[_0x8a82('0x57')](path[_0x8a82('0x58')](config[_0x8a82('0x59')],_0x8a82('0x5a'),_0x34a0df[_0x8a82('0x55')]))){throw new db[(_0x8a82('0x5b'))][(_0x8a82('0x5c'))](_0x8a82('0x5d'));}if(_0x2799d5[_0x8a82('0x31')][_0x8a82('0x5e')]){return _0x327440[_0x8a82('0x18')](0xc8);}return _0x327440[_0x8a82('0x53')](path[_0x8a82('0x58')](config['root'],_0x8a82('0x5a'),_0x34a0df[_0x8a82('0x55')]),util[_0x8a82('0x5f')](_0x8a82('0x60'),_0x34a0df[_0x8a82('0x54')]||_0x34a0df[_0x8a82('0x2a')],_0x34a0df['output'][_0x8a82('0x61')]()));}})[_0x8a82('0x51')](handleError(_0x327440,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 2730b4d..9d5e50a 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 _0x8878=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x254dc4,_0x32c927){var _0x21901a=function(_0x54f55a){while(--_0x54f55a){_0x254dc4['push'](_0x254dc4['shift']());}};_0x21901a(++_0x32c927);}(_0x8878,0xea));var _0x8887=function(_0xf3897e,_0x3ac8b7){_0xf3897e=_0xf3897e-0x0;var _0x26b187=_0x8878[_0xf3897e];return _0x26b187;};'use strict';var _=require('lodash');var util=require(_0x8887('0x0'));var logger=require('../../config/logger')(_0x8887('0x1'));var moment=require(_0x8887('0x2'));var BPromise=require(_0x8887('0x3'));var rp=require(_0x8887('0x4'));var fs=require('fs');var path=require(_0x8887('0x5'));var rimraf=require(_0x8887('0x6'));var config=require(_0x8887('0x7'));var attributes=require(_0x8887('0x8'));module[_0x8887('0x9')]=function(_0x5f2c25,_0x148d01){return _0x5f2c25[_0x8887('0xa')](_0x8887('0xb'),attributes,{'tableName':_0x8887('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84cb=['analytics_extracted_reports','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0x84cb,0x90));var _0xb84c=function(_0x5ccfa9,_0x415e4d){_0x5ccfa9=_0x5ccfa9-0x0;var _0x228ced=_0x84cb[_0x5ccfa9];return _0x228ced;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb84c('0x0'))(_0xb84c('0x1'));var moment=require(_0xb84c('0x2'));var BPromise=require(_0xb84c('0x3'));var rp=require(_0xb84c('0x4'));var fs=require('fs');var path=require(_0xb84c('0x5'));var rimraf=require(_0xb84c('0x6'));var config=require(_0xb84c('0x7'));var attributes=require(_0xb84c('0x8'));module[_0xb84c('0x9')]=function(_0x7753a4,_0xc7f346){return _0x7753a4[_0xb84c('0xa')](_0xb84c('0xb'),attributes,{'tableName':_0xb84c('0xc'),'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 4530bd6..ee5b0bc 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 _0x4ac7=['http','request','then','request\x20sent','debug','stringify','code','AnalyticExtractedReport,\x20%s,\x20%s','error','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ac7,0x13b));var _0x74ac=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x4ac7[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x74ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x74ac('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74ac('0x2'));var db=require(_0x74ac('0x3'))['db'];var utils=require(_0x74ac('0x4'));var logger=require('../../config/logger')(_0x74ac('0x5'));var config=require(_0x74ac('0x6'));var jayson=require(_0x74ac('0x7'));var client=jayson['client'][_0x74ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50e63c,_0x23e389,_0x28de45){return new BPromise(function(_0x3cc349,_0x6fcdcd){return client[_0x74ac('0x9')](_0x50e63c,_0x28de45)[_0x74ac('0xa')](function(_0x57d2f6){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x23e389,_0x74ac('0xb'));logger[_0x74ac('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x23e389,_0x74ac('0xb'),JSON[_0x74ac('0xd')](_0x57d2f6));if(_0x57d2f6['error']){if(_0x57d2f6['error'][_0x74ac('0xe')]===0x1f4){logger['error'](_0x74ac('0xf'),_0x23e389,_0x57d2f6[_0x74ac('0x10')]['message']);return _0x6fcdcd(_0x57d2f6[_0x74ac('0x10')]['message']);}logger[_0x74ac('0x10')](_0x74ac('0xf'),_0x23e389,_0x57d2f6['error'][_0x74ac('0x11')]);return _0x3cc349(_0x57d2f6[_0x74ac('0x10')]['message']);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x23e389,_0x74ac('0xb'));_0x3cc349(_0x57d2f6['result']['message']);}})[_0x74ac('0x12')](function(_0x3ece0d){logger[_0x74ac('0x10')](_0x74ac('0xf'),_0x23e389,_0x3ece0d);_0x6fcdcd(_0x3ece0d);});});} \ No newline at end of file +var _0x326a=['then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x5f51d9,_0x1d3214){var _0x2d05c7=function(_0x53fa2d){while(--_0x53fa2d){_0x5f51d9['push'](_0x5f51d9['shift']());}};_0x2d05c7(++_0x1d3214);}(_0x326a,0x136));var _0xa326=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x326a[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xa326('0x0'));var util=require(_0xa326('0x1'));var moment=require(_0xa326('0x2'));var BPromise=require('bluebird');var rs=require(_0xa326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa326('0x4'));var logger=require(_0xa326('0x5'))('rpc');var config=require(_0xa326('0x6'));var jayson=require(_0xa326('0x7'));var client=jayson['client'][_0xa326('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d4185,_0x41c447,_0x7ee3ea){return new BPromise(function(_0x4af70d,_0x499388){return client[_0xa326('0x9')](_0x3d4185,_0x7ee3ea)[_0xa326('0xa')](function(_0x5247f7){logger['info'](_0xa326('0xb'),_0x41c447,_0xa326('0xc'));logger['debug'](_0xa326('0xd'),_0x41c447,_0xa326('0xc'),JSON[_0xa326('0xe')](_0x5247f7));if(_0x5247f7[_0xa326('0xf')]){if(_0x5247f7['error'][_0xa326('0x10')]===0x1f4){logger[_0xa326('0xf')](_0xa326('0xb'),_0x41c447,_0x5247f7[_0xa326('0xf')]['message']);return _0x499388(_0x5247f7[_0xa326('0xf')]['message']);}logger[_0xa326('0xf')](_0xa326('0xb'),_0x41c447,_0x5247f7['error'][_0xa326('0x11')]);return _0x4af70d(_0x5247f7[_0xa326('0xf')][_0xa326('0x11')]);}else{logger['info'](_0xa326('0xb'),_0x41c447,_0xa326('0xc'));_0x4af70d(_0x5247f7[_0xa326('0x12')][_0xa326('0x11')]);}})[_0xa326('0x13')](function(_0x578973){logger[_0xa326('0xf')](_0xa326('0xb'),_0x41c447,_0x578973);_0x499388(_0x578973);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e2fec4f..92d7282 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 _0x9753=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download'];(function(_0x3d5155,_0x159577){var _0xe38622=function(_0x936eba){while(--_0x936eba){_0x3d5155['push'](_0x3d5155['shift']());}};_0xe38622(++_0x159577);}(_0x9753,0x71));var _0x3975=function(_0x3211e8,_0x18da74){_0x3211e8=_0x3211e8-0x0;var _0x3db240=_0x9753[_0x3211e8];return _0x3db240;};'use strict';var multer=require(_0x3975('0x0'));var util=require(_0x3975('0x1'));var path=require(_0x3975('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3975('0x3')]();var fs_extra=require(_0x3975('0x4'));var auth=require(_0x3975('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3975('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x3975('0x7')]('/',auth[_0x3975('0x8')](),controller[_0x3975('0x9')]);router[_0x3975('0x7')]('/:id',auth[_0x3975('0x8')](),controller[_0x3975('0xa')]);router[_0x3975('0x7')](_0x3975('0xb'),auth[_0x3975('0x8')](),controller[_0x3975('0xc')]);router[_0x3975('0xd')]('/',auth[_0x3975('0x8')](),controller[_0x3975('0xe')]);router[_0x3975('0xf')](_0x3975('0x10'),auth[_0x3975('0x8')](),controller[_0x3975('0x11')]);router[_0x3975('0x12')](_0x3975('0x10'),auth['isAuthenticated'](),controller[_0x3975('0x13')]);module[_0x3975('0x14')]=router; \ No newline at end of file +var _0x393f=['index','/:id','show','post','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated'];(function(_0x14442e,_0x39111d){var _0x53b3d8=function(_0x277d0e){while(--_0x277d0e){_0x14442e['push'](_0x14442e['shift']());}};_0x53b3d8(++_0x39111d);}(_0x393f,0x114));var _0xf393=function(_0x5e1b44,_0x34006b){_0x5e1b44=_0x5e1b44-0x0;var _0x5cd72d=_0x393f[_0x5e1b44];return _0x5cd72d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf393('0x0'));var timeout=require('connect-timeout');var express=require(_0xf393('0x1'));var router=express[_0xf393('0x2')]();var fs_extra=require(_0xf393('0x3'));var auth=require(_0xf393('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf393('0x5'));var controller=require(_0xf393('0x6'));router[_0xf393('0x7')]('/',auth[_0xf393('0x8')](),controller[_0xf393('0x9')]);router[_0xf393('0x7')](_0xf393('0xa'),auth['isAuthenticated'](),controller[_0xf393('0xb')]);router[_0xf393('0x7')]('/:id/download',auth[_0xf393('0x8')](),controller['download']);router[_0xf393('0xc')]('/',auth['isAuthenticated'](),controller[_0xf393('0xd')]);router[_0xf393('0xe')](_0xf393('0xa'),auth[_0xf393('0x8')](),controller[_0xf393('0xf')]);router[_0xf393('0x10')](_0xf393('0xa'),auth[_0xf393('0x8')](),controller[_0xf393('0x11')]);module[_0xf393('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 69aa6ba..48d748c 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 _0x1558=['sequelize','STRING','BOOLEAN'];(function(_0x3064a3,_0x20e71a){var _0x4319b6=function(_0x2e5240){while(--_0x2e5240){_0x3064a3['push'](_0x3064a3['shift']());}};_0x4319b6(++_0x20e71a);}(_0x1558,0x1bc));var _0x8155=function(_0xee4c5f,_0x1bf72d){_0xee4c5f=_0xee4c5f-0x0;var _0x5accbc=_0x1558[_0xee4c5f];return _0x5accbc;};'use strict';var Sequelize=require(_0x8155('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x8155('0x1')]},'function':{'type':Sequelize[_0x8155('0x1')]},'format':{'type':Sequelize[_0x8155('0x1')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8155('0x1')]},'custom':{'type':Sequelize[_0x8155('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0118=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x0118,0x1b5));var _0x8011=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0118[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8011('0x0'));module['exports']={'field':{'type':Sequelize[_0x8011('0x1')]},'alias':{'type':Sequelize[_0x8011('0x2')]},'function':{'type':Sequelize[_0x8011('0x2')]},'format':{'type':Sequelize[_0x8011('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8011('0x2')]},'custom':{'type':Sequelize[_0x8011('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 d831432..0a22c85 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 _0x579c=['includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','ejs','fs-extra','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options'];(function(_0x547aa1,_0x2d2853){var _0x316512=function(_0x3012b8){while(--_0x3012b8){_0x547aa1['push'](_0x547aa1['shift']());}};_0x316512(++_0x2d2853);}(_0x579c,0x1dc));var _0xc579=function(_0x15bdd0,_0x12ff09){_0x15bdd0=_0x15bdd0-0x0;var _0x276d52=_0x579c[_0x15bdd0];return _0x276d52;};'use strict';var emlformat=require(_0xc579('0x0'));var rimraf=require(_0xc579('0x1'));var zipdir=require(_0xc579('0x2'));var jsonpatch=require(_0xc579('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc579('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc579('0x5'));var csv=require('to-csv');var ejs=require(_0xc579('0x6'));var fs=require('fs');var fs_extra=require(_0xc579('0x7'));var _=require('lodash');var squel=require(_0xc579('0x8'));var crypto=require(_0xc579('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc579('0xa'));var authService=require(_0xc579('0xb'));var qs=require(_0xc579('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc579('0xd'));var logger=require(_0xc579('0xe'))(_0xc579('0xf'));var utils=require(_0xc579('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57a41e,_0x484b3f){_0x484b3f=_0x484b3f||0xcc;return function(_0x57c92f){if(_0x57c92f){return _0x57a41e[_0xc579('0x11')](_0x484b3f);}return _0x57a41e[_0xc579('0x12')](_0x484b3f)[_0xc579('0x13')]();};}function respondWithResult(_0x3e1c5a,_0x585638){_0x585638=_0x585638||0xc8;return function(_0x28add6){if(_0x28add6){return _0x3e1c5a[_0xc579('0x12')](_0x585638)[_0xc579('0x14')](_0x28add6);}};}function respondWithFilteredResult(_0x1ef05a,_0x5b27e5){return function(_0x250423){if(_0x250423){var _0x10ed1e=typeof _0x5b27e5[_0xc579('0x15')]===_0xc579('0x16')&&typeof _0x5b27e5[_0xc579('0x17')]===_0xc579('0x16');var _0x57fddf=_0x250423['count'];var _0x2e68ed=_0x10ed1e?0x0:_0x5b27e5[_0xc579('0x15')];var _0x23a9eb=_0x10ed1e?_0x250423[_0xc579('0x18')]:_0x5b27e5[_0xc579('0x15')]+_0x5b27e5[_0xc579('0x17')];var _0x29ffb6;if(_0x23a9eb>=_0x57fddf){_0x23a9eb=_0x57fddf;_0x29ffb6=0xc8;}else{_0x29ffb6=0xce;}_0x1ef05a[_0xc579('0x12')](_0x29ffb6);return _0x1ef05a['set']('Content-Range',_0x2e68ed+'-'+_0x23a9eb+'/'+_0x57fddf)['json'](_0x250423);}return null;};}function patchUpdates(_0x5c44e3){return function(_0x303392){try{jsonpatch[_0xc579('0x19')](_0x303392,_0x5c44e3,!![]);}catch(_0x550959){return BPromise[_0xc579('0x1a')](_0x550959);}return _0x303392[_0xc579('0x1b')]();};}function saveUpdates(_0x59baa2,_0x1e7171){return function(_0x472759){if(_0x472759){return _0x472759['update'](_0x59baa2)[_0xc579('0x1c')](function(_0x467270){return _0x467270;});}return null;};}function removeEntity(_0x1ddd05,_0x2e83d4){return function(_0x453ef8){if(_0x453ef8){return _0x453ef8[_0xc579('0x1d')]()[_0xc579('0x1c')](function(){_0x1ddd05[_0xc579('0x12')](0xcc)[_0xc579('0x13')]();});}};}function handleEntityNotFound(_0x3df194,_0x222dd3){return function(_0x3f9c46){if(!_0x3f9c46){_0x3df194['sendStatus'](0x194);}return _0x3f9c46;};}function handleError(_0x4ca3b2,_0x532264){_0x532264=_0x532264||0x1f4;return function(_0x89bd7e){logger[_0xc579('0x1e')](_0x89bd7e['stack']);if(_0x89bd7e[_0xc579('0x1f')]){delete _0x89bd7e[_0xc579('0x1f')];}_0x4ca3b2['status'](_0x532264)[_0xc579('0x20')](_0x89bd7e);};}exports[_0xc579('0x21')]=function(_0x2a6851,_0x3db780){var _0x44651d={},_0x275ddf={},_0x37c9a8={'count':0x0,'rows':[]};var _0x329ada=_[_0xc579('0x22')](db[_0xc579('0x23')][_0xc579('0x24')],function(_0x8b0015){return{'name':_0x8b0015[_0xc579('0x25')],'type':_0x8b0015['type'][_0xc579('0x26')]};});_0x275ddf['model']=_[_0xc579('0x22')](_0x329ada,_0xc579('0x1f'));_0x275ddf[_0xc579('0x27')]=_[_0xc579('0x28')](_0x2a6851[_0xc579('0x27')]);_0x275ddf[_0xc579('0x29')]=_[_0xc579('0x2a')](_0x275ddf[_0xc579('0x2b')],_0x275ddf['query']);_0x44651d[_0xc579('0x2c')]=_[_0xc579('0x2a')](_0x275ddf[_0xc579('0x2b')],qs['fields'](_0x2a6851[_0xc579('0x27')][_0xc579('0x2d')]));_0x44651d['attributes']=_0x44651d[_0xc579('0x2c')][_0xc579('0x2e')]?_0x44651d[_0xc579('0x2c')]:_0x275ddf[_0xc579('0x2b')];if(!_0x2a6851[_0xc579('0x27')][_0xc579('0x2f')](_0xc579('0x30'))){_0x44651d[_0xc579('0x17')]=qs['limit'](_0x2a6851['query'][_0xc579('0x17')]);_0x44651d['offset']=qs[_0xc579('0x15')](_0x2a6851['query']['offset']);}_0x44651d[_0xc579('0x31')]=qs['sort'](_0x2a6851['query']['sort']);_0x44651d[_0xc579('0x32')]=qs[_0xc579('0x29')](_[_0xc579('0x33')](_0x2a6851[_0xc579('0x27')],_0x275ddf[_0xc579('0x29')]),_0x329ada);if(_0x2a6851[_0xc579('0x27')]['filter']){_0x44651d[_0xc579('0x32')]=_[_0xc579('0x34')](_0x44651d[_0xc579('0x32')],{'$or':_[_0xc579('0x22')](_0x329ada,function(_0x31acfd){if(_0x31acfd['type']!==_0xc579('0x35')){var _0x1f18f8={};_0x1f18f8[_0x31acfd[_0xc579('0x1f')]]={'$like':'%'+_0x2a6851[_0xc579('0x27')][_0xc579('0x36')]+'%'};return _0x1f18f8;}})});}_0x44651d=_[_0xc579('0x34')]({},_0x44651d,_0x2a6851[_0xc579('0x37')]);var _0x35e274={'where':_0x44651d[_0xc579('0x32')]};return db[_0xc579('0x23')][_0xc579('0x18')](_0x35e274)[_0xc579('0x1c')](function(_0x50c2c4){_0x37c9a8[_0xc579('0x18')]=_0x50c2c4;if(_0x2a6851[_0xc579('0x27')][_0xc579('0x38')]){_0x44651d[_0xc579('0x39')]=[{'all':!![]}];}return db[_0xc579('0x23')][_0xc579('0x3a')](_0x44651d);})[_0xc579('0x1c')](function(_0x1d5acc){_0x37c9a8[_0xc579('0x3b')]=_0x1d5acc;return _0x37c9a8;})[_0xc579('0x1c')](respondWithFilteredResult(_0x3db780,_0x44651d))[_0xc579('0x3c')](handleError(_0x3db780,null));};exports[_0xc579('0x3d')]=function(_0x4abdb1,_0x3145e6){var _0x36b7bc={'raw':![],'where':{'id':_0x4abdb1[_0xc579('0x3e')]['id']}},_0x29b363={};_0x29b363[_0xc579('0x2b')]=_[_0xc579('0x28')](db[_0xc579('0x23')][_0xc579('0x24')]);_0x29b363['query']=_[_0xc579('0x28')](_0x4abdb1[_0xc579('0x27')]);_0x29b363[_0xc579('0x29')]=_[_0xc579('0x2a')](_0x29b363[_0xc579('0x2b')],_0x29b363['query']);_0x36b7bc[_0xc579('0x2c')]=_[_0xc579('0x2a')](_0x29b363[_0xc579('0x2b')],qs[_0xc579('0x2d')](_0x4abdb1[_0xc579('0x27')][_0xc579('0x2d')]));_0x36b7bc[_0xc579('0x2c')]=_0x36b7bc[_0xc579('0x2c')][_0xc579('0x2e')]?_0x36b7bc['attributes']:_0x29b363['model'];if(_0x4abdb1['query']['includeAll']){_0x36b7bc[_0xc579('0x39')]=[{'all':!![]}];}_0x36b7bc=_[_0xc579('0x34')]({},_0x36b7bc,_0x4abdb1[_0xc579('0x37')]);return db[_0xc579('0x23')][_0xc579('0x3f')](_0x36b7bc)[_0xc579('0x1c')](handleEntityNotFound(_0x3145e6,null))[_0xc579('0x1c')](respondWithResult(_0x3145e6,null))['catch'](handleError(_0x3145e6,null));};exports[_0xc579('0x40')]=function(_0x52d82d,_0x1127e2){return db['AnalyticFieldReport'][_0xc579('0x40')](_0x52d82d[_0xc579('0x41')],{})[_0xc579('0x1c')](respondWithResult(_0x1127e2,0xc9))['catch'](handleError(_0x1127e2,null));};exports[_0xc579('0x42')]=function(_0x29d924,_0x2bbe01){return db[_0xc579('0x23')][_0xc579('0x42')](_0x29d924[_0xc579('0x41')],{'raw':![],'individualHooks':!![]})[_0xc579('0x1c')](respondWithResult(_0x2bbe01,0xc9))[_0xc579('0x3c')](handleError(_0x2bbe01,null));};exports[_0xc579('0x43')]=function(_0x2cbebc,_0x265cbe){if(_0x2cbebc[_0xc579('0x41')]['id']){delete _0x2cbebc[_0xc579('0x41')]['id'];}return db[_0xc579('0x23')][_0xc579('0x3f')]({'where':{'id':_0x2cbebc['params']['id']}})[_0xc579('0x1c')](handleEntityNotFound(_0x265cbe,null))[_0xc579('0x1c')](saveUpdates(_0x2cbebc[_0xc579('0x41')],null))[_0xc579('0x1c')](respondWithResult(_0x265cbe,null))[_0xc579('0x3c')](handleError(_0x265cbe,null));};exports[_0xc579('0x1d')]=function(_0x53152b,_0x55e11c){return db['AnalyticFieldReport']['find']({'where':{'id':_0x53152b[_0xc579('0x3e')]['id']}})[_0xc579('0x1c')](handleEntityNotFound(_0x55e11c,null))[_0xc579('0x1c')](removeEntity(_0x55e11c,null))[_0xc579('0x3c')](handleError(_0x55e11c,null));};exports[_0xc579('0x44')]=function(_0x31adee,_0x317d8e){return db['AnalyticFieldReport'][_0xc579('0x1d')]({'where':{'id':_0x31adee[_0xc579('0x27')][_0xc579('0x45')]||[]},'raw':![],'individualHooks':!![]})[_0xc579('0x1c')](respondWithResult(_0x317d8e,0xcc))[_0xc579('0x3c')](handleError(_0x317d8e,null));};exports[_0xc579('0x46')]=function(_0x4f9940,_0xa51059,_0x2d8d7d){return db[_0xc579('0x47')][_0xc579('0x48')]({'where':{'id':_0x4f9940[_0xc579('0x3e')]['id']}})[_0xc579('0x1c')](handleEntityNotFound(_0xa51059,null))[_0xc579('0x1c')](function(_0x2371b5){if(_0x2371b5){return db[_0xc579('0x49')][_0xc579('0x4a')](function(_0x1f2c5e){return db[_0xc579('0x23')][_0xc579('0x1d')]({'where':{'CustomReportId':_0x4f9940[_0xc579('0x3e')]['id']},'transaction':_0x1f2c5e})[_0xc579('0x1c')](function(_0x49764c){var _0x2853dc=_['map'](_0x4f9940[_0xc579('0x41')],function(_0x68c160){delete _0x68c160['id'];_0x68c160[_0xc579('0x4b')]=_0x4f9940['params']['id'];return _0x68c160;});return db[_0xc579('0x23')][_0xc579('0x42')](_0x2853dc,{'transaction':_0x1f2c5e});});})[_0xc579('0x1c')](function(){return db['AnalyticFieldReport'][_0xc579('0x3a')]({'where':{'CustomReportId':_0x4f9940[_0xc579('0x3e')]['id']}});});}})['then'](respondWithResult(_0xa51059,null))[_0xc579('0x3c')](handleError(_0xa51059,null));}; \ No newline at end of file +var _0x85e7=['map','rawAttributes','fieldName','type','model','filters','intersection','attributes','fields','query','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','AnalyticFieldReport','findAll','rows','catch','show','params','keys','include','find','create','body','bulkCreate','destroy','bulkDestroy','ids','addFields','findOne','sequelize','CustomReportId','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','end','error','stack','name','index'];(function(_0x17be49,_0x48e399){var _0x1c9411=function(_0x2ff174){while(--_0x2ff174){_0x17be49['push'](_0x17be49['shift']());}};_0x1c9411(++_0x48e399);}(_0x85e7,0xcc));var _0x785e=function(_0x215488,_0x497875){_0x215488=_0x215488-0x0;var _0x13db01=_0x85e7[_0x215488];return _0x13db01;};'use strict';var emlformat=require(_0x785e('0x0'));var rimraf=require(_0x785e('0x1'));var zipdir=require(_0x785e('0x2'));var jsonpatch=require(_0x785e('0x3'));var rp=require(_0x785e('0x4'));var moment=require(_0x785e('0x5'));var BPromise=require(_0x785e('0x6'));var Mustache=require(_0x785e('0x7'));var util=require(_0x785e('0x8'));var path=require(_0x785e('0x9'));var sox=require(_0x785e('0xa'));var csv=require(_0x785e('0xb'));var ejs=require(_0x785e('0xc'));var fs=require('fs');var fs_extra=require(_0x785e('0xd'));var _=require(_0x785e('0xe'));var squel=require('squel');var crypto=require(_0x785e('0xf'));var jsforce=require(_0x785e('0x10'));var deskjs=require(_0x785e('0x11'));var toCsv=require(_0x785e('0xb'));var querystring=require(_0x785e('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x785e('0x13'));var qs=require(_0x785e('0x14'));var as=require(_0x785e('0x15'));var hardwareService=require(_0x785e('0x16'));var logger=require(_0x785e('0x17'))('api');var utils=require(_0x785e('0x18'));var config=require(_0x785e('0x19'));var licenseUtil=require(_0x785e('0x1a'));var db=require(_0x785e('0x1b'))['db'];function respondWithStatusCode(_0x141ec4,_0x4cbdc7){_0x4cbdc7=_0x4cbdc7||0xcc;return function(_0x12dd94){if(_0x12dd94){return _0x141ec4[_0x785e('0x1c')](_0x4cbdc7);}return _0x141ec4[_0x785e('0x1d')](_0x4cbdc7)['end']();};}function respondWithResult(_0x174b4f,_0x59497e){_0x59497e=_0x59497e||0xc8;return function(_0x17610f){if(_0x17610f){return _0x174b4f['status'](_0x59497e)[_0x785e('0x1e')](_0x17610f);}};}function respondWithFilteredResult(_0x32fe3f,_0x5dedcb){return function(_0x46b295){if(_0x46b295){var _0x2d77cf=typeof _0x5dedcb[_0x785e('0x1f')]==='undefined'&&typeof _0x5dedcb[_0x785e('0x20')]===_0x785e('0x21');var _0x25d86d=_0x46b295[_0x785e('0x22')];var _0x72066b=_0x2d77cf?0x0:_0x5dedcb['offset'];var _0x52b92a=_0x2d77cf?_0x46b295['count']:_0x5dedcb[_0x785e('0x1f')]+_0x5dedcb[_0x785e('0x20')];var _0xeb34cf;if(_0x52b92a>=_0x25d86d){_0x52b92a=_0x25d86d;_0xeb34cf=0xc8;}else{_0xeb34cf=0xce;}_0x32fe3f[_0x785e('0x1d')](_0xeb34cf);return _0x32fe3f[_0x785e('0x23')](_0x785e('0x24'),_0x72066b+'-'+_0x52b92a+'/'+_0x25d86d)[_0x785e('0x1e')](_0x46b295);}return null;};}function patchUpdates(_0x54f10b){return function(_0x565ee6){try{jsonpatch[_0x785e('0x25')](_0x565ee6,_0x54f10b,!![]);}catch(_0x538828){return BPromise['reject'](_0x538828);}return _0x565ee6['save']();};}function saveUpdates(_0x154870,_0x13cf70){return function(_0x5aadf9){if(_0x5aadf9){return _0x5aadf9[_0x785e('0x26')](_0x154870)[_0x785e('0x27')](function(_0xd7ec06){return _0xd7ec06;});}return null;};}function removeEntity(_0x1bf307,_0x18198c){return function(_0x498ed4){if(_0x498ed4){return _0x498ed4['destroy']()[_0x785e('0x27')](function(){_0x1bf307['status'](0xcc)[_0x785e('0x28')]();});}};}function handleEntityNotFound(_0x249af1,_0x254b54){return function(_0xffa6b3){if(!_0xffa6b3){_0x249af1[_0x785e('0x1c')](0x194);}return _0xffa6b3;};}function handleError(_0x2f9522,_0x34e906){_0x34e906=_0x34e906||0x1f4;return function(_0x40a2c4){logger[_0x785e('0x29')](_0x40a2c4[_0x785e('0x2a')]);if(_0x40a2c4['name']){delete _0x40a2c4[_0x785e('0x2b')];}_0x2f9522['status'](_0x34e906)['send'](_0x40a2c4);};}exports[_0x785e('0x2c')]=function(_0x256d0d,_0x2081d5){var _0x4aa5a4={},_0x43b850={},_0x14a09c={'count':0x0,'rows':[]};var _0x5753a0=_[_0x785e('0x2d')](db['AnalyticFieldReport'][_0x785e('0x2e')],function(_0x4761c6){return{'name':_0x4761c6[_0x785e('0x2f')],'type':_0x4761c6[_0x785e('0x30')]['key']};});_0x43b850[_0x785e('0x31')]=_['map'](_0x5753a0,_0x785e('0x2b'));_0x43b850['query']=_['keys'](_0x256d0d['query']);_0x43b850[_0x785e('0x32')]=_[_0x785e('0x33')](_0x43b850[_0x785e('0x31')],_0x43b850['query']);_0x4aa5a4[_0x785e('0x34')]=_[_0x785e('0x33')](_0x43b850[_0x785e('0x31')],qs[_0x785e('0x35')](_0x256d0d['query'][_0x785e('0x35')]));_0x4aa5a4[_0x785e('0x34')]=_0x4aa5a4[_0x785e('0x34')]['length']?_0x4aa5a4[_0x785e('0x34')]:_0x43b850[_0x785e('0x31')];if(!_0x256d0d[_0x785e('0x36')][_0x785e('0x37')]('nolimit')){_0x4aa5a4[_0x785e('0x20')]=qs['limit'](_0x256d0d[_0x785e('0x36')][_0x785e('0x20')]);_0x4aa5a4['offset']=qs[_0x785e('0x1f')](_0x256d0d[_0x785e('0x36')]['offset']);}_0x4aa5a4[_0x785e('0x38')]=qs[_0x785e('0x39')](_0x256d0d[_0x785e('0x36')][_0x785e('0x39')]);_0x4aa5a4[_0x785e('0x3a')]=qs[_0x785e('0x32')](_['pick'](_0x256d0d['query'],_0x43b850['filters']),_0x5753a0);if(_0x256d0d[_0x785e('0x36')][_0x785e('0x3b')]){_0x4aa5a4[_0x785e('0x3a')]=_[_0x785e('0x3c')](_0x4aa5a4[_0x785e('0x3a')],{'$or':_[_0x785e('0x2d')](_0x5753a0,function(_0x197f56){if(_0x197f56[_0x785e('0x30')]!==_0x785e('0x3d')){var _0x172061={};_0x172061[_0x197f56['name']]={'$like':'%'+_0x256d0d[_0x785e('0x36')][_0x785e('0x3b')]+'%'};return _0x172061;}})});}_0x4aa5a4=_[_0x785e('0x3c')]({},_0x4aa5a4,_0x256d0d[_0x785e('0x3e')]);var _0x204b47={'where':_0x4aa5a4[_0x785e('0x3a')]};return db['AnalyticFieldReport'][_0x785e('0x22')](_0x204b47)[_0x785e('0x27')](function(_0x4104b2){_0x14a09c['count']=_0x4104b2;if(_0x256d0d[_0x785e('0x36')][_0x785e('0x3f')]){_0x4aa5a4['include']=[{'all':!![]}];}return db[_0x785e('0x40')][_0x785e('0x41')](_0x4aa5a4);})['then'](function(_0x3d735e){_0x14a09c[_0x785e('0x42')]=_0x3d735e;return _0x14a09c;})[_0x785e('0x27')](respondWithFilteredResult(_0x2081d5,_0x4aa5a4))[_0x785e('0x43')](handleError(_0x2081d5,null));};exports[_0x785e('0x44')]=function(_0x2e92b8,_0x328624){var _0x11929f={'raw':![],'where':{'id':_0x2e92b8[_0x785e('0x45')]['id']}},_0x489905={};_0x489905[_0x785e('0x31')]=_[_0x785e('0x46')](db['AnalyticFieldReport'][_0x785e('0x2e')]);_0x489905['query']=_['keys'](_0x2e92b8['query']);_0x489905[_0x785e('0x32')]=_[_0x785e('0x33')](_0x489905['model'],_0x489905[_0x785e('0x36')]);_0x11929f['attributes']=_[_0x785e('0x33')](_0x489905['model'],qs['fields'](_0x2e92b8[_0x785e('0x36')][_0x785e('0x35')]));_0x11929f['attributes']=_0x11929f[_0x785e('0x34')]['length']?_0x11929f[_0x785e('0x34')]:_0x489905[_0x785e('0x31')];if(_0x2e92b8[_0x785e('0x36')][_0x785e('0x3f')]){_0x11929f[_0x785e('0x47')]=[{'all':!![]}];}_0x11929f=_['merge']({},_0x11929f,_0x2e92b8['options']);return db[_0x785e('0x40')][_0x785e('0x48')](_0x11929f)[_0x785e('0x27')](handleEntityNotFound(_0x328624,null))[_0x785e('0x27')](respondWithResult(_0x328624,null))['catch'](handleError(_0x328624,null));};exports[_0x785e('0x49')]=function(_0x3a9e3e,_0x57bb16){return db[_0x785e('0x40')][_0x785e('0x49')](_0x3a9e3e[_0x785e('0x4a')],{})[_0x785e('0x27')](respondWithResult(_0x57bb16,0xc9))[_0x785e('0x43')](handleError(_0x57bb16,null));};exports['bulkCreate']=function(_0x469f74,_0x498fd9){return db[_0x785e('0x40')][_0x785e('0x4b')](_0x469f74[_0x785e('0x4a')],{'raw':![],'individualHooks':!![]})[_0x785e('0x27')](respondWithResult(_0x498fd9,0xc9))[_0x785e('0x43')](handleError(_0x498fd9,null));};exports['update']=function(_0x3a6fbf,_0x26e56a){if(_0x3a6fbf[_0x785e('0x4a')]['id']){delete _0x3a6fbf[_0x785e('0x4a')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x3a6fbf[_0x785e('0x45')]['id']}})[_0x785e('0x27')](handleEntityNotFound(_0x26e56a,null))['then'](saveUpdates(_0x3a6fbf[_0x785e('0x4a')],null))[_0x785e('0x27')](respondWithResult(_0x26e56a,null))[_0x785e('0x43')](handleError(_0x26e56a,null));};exports[_0x785e('0x4c')]=function(_0x3b09ba,_0x40fea8){return db[_0x785e('0x40')]['find']({'where':{'id':_0x3b09ba[_0x785e('0x45')]['id']}})[_0x785e('0x27')](handleEntityNotFound(_0x40fea8,null))[_0x785e('0x27')](removeEntity(_0x40fea8,null))[_0x785e('0x43')](handleError(_0x40fea8,null));};exports[_0x785e('0x4d')]=function(_0xbd09a,_0x479c5e){return db[_0x785e('0x40')][_0x785e('0x4c')]({'where':{'id':_0xbd09a[_0x785e('0x36')][_0x785e('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x785e('0x27')](respondWithResult(_0x479c5e,0xcc))[_0x785e('0x43')](handleError(_0x479c5e,null));};exports[_0x785e('0x4f')]=function(_0x30f038,_0x24e51f,_0x188d7a){return db['AnalyticCustomReport'][_0x785e('0x50')]({'where':{'id':_0x30f038[_0x785e('0x45')]['id']}})['then'](handleEntityNotFound(_0x24e51f,null))['then'](function(_0x3a3120){if(_0x3a3120){return db[_0x785e('0x51')]['transaction'](function(_0x3e7536){return db[_0x785e('0x40')][_0x785e('0x4c')]({'where':{'CustomReportId':_0x30f038[_0x785e('0x45')]['id']},'transaction':_0x3e7536})[_0x785e('0x27')](function(_0x4c7b73){var _0x3f021d=_[_0x785e('0x2d')](_0x30f038[_0x785e('0x4a')],function(_0x1dc654){delete _0x1dc654['id'];_0x1dc654[_0x785e('0x52')]=_0x30f038[_0x785e('0x45')]['id'];return _0x1dc654;});return db[_0x785e('0x40')]['bulkCreate'](_0x3f021d,{'transaction':_0x3e7536});});})[_0x785e('0x27')](function(){return db['AnalyticFieldReport'][_0x785e('0x41')]({'where':{'CustomReportId':_0x30f038[_0x785e('0x45')]['id']}});});}})[_0x785e('0x27')](respondWithResult(_0x24e51f,null))['catch'](handleError(_0x24e51f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 0eed0ce..05a3f2a 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 _0xff1a=['path','./analyticFieldReport.attributes','exports','define','analytics_report_fields','util','../../config/logger','api','moment','request-promise'];(function(_0x506a86,_0x41e1c9){var _0x5e1960=function(_0xbc7559){while(--_0xbc7559){_0x506a86['push'](_0x506a86['shift']());}};_0x5e1960(++_0x41e1c9);}(_0xff1a,0x18b));var _0xaff1=function(_0x2c45d8,_0x3c2ea6){_0x2c45d8=_0x2c45d8-0x0;var _0xe57dee=_0xff1a[_0x2c45d8];return _0xe57dee;};'use strict';var _=require('lodash');var util=require(_0xaff1('0x0'));var logger=require(_0xaff1('0x1'))(_0xaff1('0x2'));var moment=require(_0xaff1('0x3'));var BPromise=require('bluebird');var rp=require(_0xaff1('0x4'));var fs=require('fs');var path=require(_0xaff1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaff1('0x6'));module[_0xaff1('0x7')]=function(_0x179201,_0x297c40){return _0x179201[_0xaff1('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0xaff1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dd5=['request-promise','path','rimraf','./analyticFieldReport.attributes','exports','analytics_report_fields','util','../../config/logger','bluebird'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x1dd5,0xde));var _0x51dd=function(_0xcc4532,_0x40cc5c){_0xcc4532=_0xcc4532-0x0;var _0x46c5bc=_0x1dd5[_0xcc4532];return _0x46c5bc;};'use strict';var _=require('lodash');var util=require(_0x51dd('0x0'));var logger=require(_0x51dd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x51dd('0x2'));var rp=require(_0x51dd('0x3'));var fs=require('fs');var path=require(_0x51dd('0x4'));var rimraf=require(_0x51dd('0x5'));var config=require('../../config/environment');var attributes=require(_0x51dd('0x6'));module[_0x51dd('0x7')]=function(_0x96b23d,_0x1170de){return _0x96b23d['define']('AnalyticFieldReport',attributes,{'tableName':_0x51dd('0x8'),'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 1a55492..289d505 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 _0x09e4=['jayson/promise','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','AnalyticFieldReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x487bd5,_0x15f486){var _0x3e32bf=function(_0x3a4d49){while(--_0x3a4d49){_0x487bd5['push'](_0x487bd5['shift']());}};_0x3e32bf(++_0x15f486);}(_0x09e4,0x127));var _0x409e=function(_0x2a60c0,_0x5f49db){_0x2a60c0=_0x2a60c0-0x0;var _0x1fdb20=_0x09e4[_0x2a60c0];return _0x1fdb20;};'use strict';var _=require('lodash');var util=require(_0x409e('0x0'));var moment=require(_0x409e('0x1'));var BPromise=require(_0x409e('0x2'));var rs=require(_0x409e('0x3'));var fs=require('fs');var Redis=require(_0x409e('0x4'));var db=require(_0x409e('0x5'))['db'];var utils=require(_0x409e('0x6'));var logger=require(_0x409e('0x7'))(_0x409e('0x8'));var config=require('../../config/environment');var jayson=require(_0x409e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x516942,_0x1f0e4a,_0x16f9c8){return new BPromise(function(_0x50f4fb,_0xf016b3){return client['request'](_0x516942,_0x16f9c8)[_0x409e('0xa')](function(_0x4b3004){logger[_0x409e('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1f0e4a,_0x409e('0xc'));logger[_0x409e('0xd')](_0x409e('0xe'),_0x1f0e4a,'request\x20sent',JSON['stringify'](_0x4b3004));if(_0x4b3004[_0x409e('0xf')]){if(_0x4b3004[_0x409e('0xf')]['code']===0x1f4){logger[_0x409e('0xf')](_0x409e('0x10'),_0x1f0e4a,_0x4b3004['error'][_0x409e('0x11')]);return _0xf016b3(_0x4b3004['error'][_0x409e('0x11')]);}logger[_0x409e('0xf')](_0x409e('0x10'),_0x1f0e4a,_0x4b3004[_0x409e('0xf')][_0x409e('0x11')]);return _0x50f4fb(_0x4b3004['error']['message']);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x1f0e4a,_0x409e('0xc'));_0x50f4fb(_0x4b3004['result']['message']);}})[_0x409e('0x12')](function(_0x56a482){logger[_0x409e('0xf')](_0x409e('0x10'),_0x1f0e4a,_0x56a482);_0xf016b3(_0x56a482);});});} \ No newline at end of file +var _0x3deb=['message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1be79f,_0x4d5d55){var _0x3c58a9=function(_0x4b2137){while(--_0x4b2137){_0x1be79f['push'](_0x1be79f['shift']());}};_0x3c58a9(++_0x4d5d55);}(_0x3deb,0xdf));var _0xb3de=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x3deb[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xb3de('0x0'));var util=require(_0xb3de('0x1'));var moment=require(_0xb3de('0x2'));var BPromise=require(_0xb3de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3de('0x4'));var db=require(_0xb3de('0x5'))['db'];var utils=require(_0xb3de('0x6'));var logger=require(_0xb3de('0x7'))(_0xb3de('0x8'));var config=require('../../config/environment');var jayson=require(_0xb3de('0x9'));var client=jayson[_0xb3de('0xa')][_0xb3de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18c6ce,_0x4183f7,_0xb752c7){return new BPromise(function(_0x2beb9c,_0x24ebd7){return client[_0xb3de('0xc')](_0x18c6ce,_0xb752c7)['then'](function(_0x3d2a6a){logger[_0xb3de('0xd')](_0xb3de('0xe'),_0x4183f7,'request\x20sent');logger['debug'](_0xb3de('0xf'),_0x4183f7,'request\x20sent',JSON[_0xb3de('0x10')](_0x3d2a6a));if(_0x3d2a6a[_0xb3de('0x11')]){if(_0x3d2a6a['error'][_0xb3de('0x12')]===0x1f4){logger[_0xb3de('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4183f7,_0x3d2a6a[_0xb3de('0x11')][_0xb3de('0x13')]);return _0x24ebd7(_0x3d2a6a[_0xb3de('0x11')][_0xb3de('0x13')]);}logger[_0xb3de('0x11')](_0xb3de('0xe'),_0x4183f7,_0x3d2a6a[_0xb3de('0x11')]['message']);return _0x2beb9c(_0x3d2a6a[_0xb3de('0x11')][_0xb3de('0x13')]);}else{logger['info'](_0xb3de('0xe'),_0x4183f7,_0xb3de('0x14'));_0x2beb9c(_0x3d2a6a['result'][_0xb3de('0x13')]);}})[_0xb3de('0x15')](function(_0x31b950){logger[_0xb3de('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4183f7,_0x31b950);_0x24ebd7(_0x31b950);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 612e037..a335f0e 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(_0x34e06e,_0x156409){var _0x7b8b3e=function(_0x4267aa){while(--_0x4267aa){_0x34e06e['push'](_0x34e06e['shift']());}};_0x7b8b3e(++_0x156409);}(_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'));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(_0x5a40a1,_0x355774){var _0x4b1a7e=function(_0x4c1663){while(--_0x4c1663){_0x5a40a1['push'](_0x5a40a1['shift']());}};_0x4b1a7e(++_0x355774);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 236c012..8d2df7d 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 _0x1ebd=['sequelize','exports','STRING','TEXT'];(function(_0x29b100,_0x46e95f){var _0x341736=function(_0x232b3e){while(--_0x232b3e){_0x29b100['push'](_0x29b100['shift']());}};_0x341736(++_0x46e95f);}(_0x1ebd,0x64));var _0xd1eb=function(_0x33c04a,_0x15ffa0){_0x33c04a=_0x33c04a-0x0;var _0x1d87d0=_0x1ebd[_0x33c04a];return _0x1d87d0;};'use strict';var Sequelize=require(_0xd1eb('0x0'));module[_0xd1eb('0x1')]={'name':{'type':Sequelize[_0xd1eb('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xd1eb('0x2')]},'metric':{'type':Sequelize[_0xd1eb('0x3')]},'description':{'type':Sequelize[_0xd1eb('0x2')]}}; \ No newline at end of file +var _0x976a=['sequelize','exports','STRING','TEXT'];(function(_0x23322e,_0x2cf32f){var _0x3ec2b4=function(_0x3c7321){while(--_0x3c7321){_0x23322e['push'](_0x23322e['shift']());}};_0x3ec2b4(++_0x2cf32f);}(_0x976a,0xf4));var _0xa976=function(_0x53afa6,_0x59e786){_0x53afa6=_0x53afa6-0x0;var _0x51f86a=_0x976a[_0x53afa6];return _0x51f86a;};'use strict';var Sequelize=require(_0xa976('0x0'));module[_0xa976('0x1')]={'name':{'type':Sequelize[_0xa976('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xa976('0x2')]},'metric':{'type':Sequelize[_0xa976('0x3')]},'description':{'type':Sequelize[_0xa976('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 6daf7dc..cc9124f 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 _0x4b84=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x449747,_0x3e0aed){var _0x230544=function(_0x2ece94){while(--_0x2ece94){_0x449747['push'](_0x449747['shift']());}};_0x230544(++_0x3e0aed);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x4b84[_0x1aba25];return _0x47d997;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){var _0x41a922=_0x51a34a[_0x44b8('0x22')]({'plain':!![]});var _0x25a0c1=_0x44b8('0x23');return db[_0x44b8('0x24')]['destroy']({'where':{'type':_0x25a0c1,'resourceId':_0x41a922['id']}})[_0x44b8('0x20')](function(){return _0x51a34a;});})['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x549a26,_0x17ac44){return function(_0x470f49){if(!_0x470f49){_0x549a26[_0x44b8('0x25')](0x194);}return _0x470f49;};}function handleError(_0x59c1bf,_0xb22107){_0xb22107=_0xb22107||0x1f4;return function(_0x242342){logger['error'](_0x242342[_0x44b8('0x26')]);if(_0x242342['name']){delete _0x242342[_0x44b8('0x27')];}_0x59c1bf['status'](_0xb22107)['send'](_0x242342);};}exports['index']=function(_0x387293,_0x29b18d){var _0x44ce5a={},_0x1bd1be={},_0x38cd17={'count':0x0,'rows':[]};var _0xc3f667=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x28f918){return{'name':_0x28f918[_0x44b8('0x2b')],'type':_0x28f918[_0x44b8('0x2c')][_0x44b8('0x2d')]};});_0x1bd1be['model']=_[_0x44b8('0x28')](_0xc3f667,'name');_0x1bd1be[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x387293[_0x44b8('0x2e')]);_0x1bd1be[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x1bd1be['model'],_0x1bd1be[_0x44b8('0x2e')]);_0x44ce5a[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1bd1be[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x387293['query'][_0x44b8('0x34')]));_0x44ce5a[_0x44b8('0x32')]=_0x44ce5a[_0x44b8('0x32')][_0x44b8('0x35')]?_0x44ce5a[_0x44b8('0x32')]:_0x1bd1be[_0x44b8('0x33')];if(!_0x387293[_0x44b8('0x2e')][_0x44b8('0x36')](_0x44b8('0x37'))){_0x44ce5a[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x17')]);_0x44ce5a[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x44ce5a[_0x44b8('0x38')]=qs[_0x44b8('0x39')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x39')]);_0x44ce5a[_0x44b8('0x3a')]=qs['filters'](_[_0x44b8('0x3b')](_0x387293[_0x44b8('0x2e')],_0x1bd1be['filters']),_0xc3f667);if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]){_0x44ce5a[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](_0x44ce5a['where'],{'$or':_[_0x44b8('0x28')](_0xc3f667,function(_0x11e4e3){if(_0x11e4e3[_0x44b8('0x2c')]!==_0x44b8('0x3e')){var _0x9cb2a={};_0x9cb2a[_0x11e4e3[_0x44b8('0x27')]]={'$like':'%'+_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]+'%'};return _0x9cb2a;}})});}_0x44ce5a=_[_0x44b8('0x3d')]({},_0x44ce5a,_0x387293[_0x44b8('0x3f')]);var _0x1c9983={'where':_0x44ce5a[_0x44b8('0x3a')]};return db[_0x44b8('0x29')][_0x44b8('0x18')](_0x1c9983)[_0x44b8('0x20')](function(_0x29b43f){_0x38cd17['count']=_0x29b43f;if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x44ce5a[_0x44b8('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x44b8('0x42')](_0x44ce5a);})[_0x44b8('0x20')](function(_0x229cc9){_0x38cd17['rows']=_0x229cc9;return _0x38cd17;})[_0x44b8('0x20')](respondWithFilteredResult(_0x29b18d,_0x44ce5a))[_0x44b8('0x43')](handleError(_0x29b18d,null));};exports[_0x44b8('0x44')]=function(_0x334f86,_0xfd590a){var _0x499a3e={'raw':!![],'where':{'id':_0x334f86[_0x44b8('0x45')]['id']}},_0x5ae5f9={};_0x5ae5f9[_0x44b8('0x33')]=_[_0x44b8('0x2f')](db[_0x44b8('0x29')][_0x44b8('0x2a')]);_0x5ae5f9[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x334f86[_0x44b8('0x2e')]);_0x5ae5f9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],_0x5ae5f9[_0x44b8('0x2e')]);_0x499a3e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x334f86[_0x44b8('0x2e')][_0x44b8('0x34')]));_0x499a3e[_0x44b8('0x32')]=_0x499a3e['attributes']['length']?_0x499a3e[_0x44b8('0x32')]:_0x5ae5f9[_0x44b8('0x33')];if(_0x334f86[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x499a3e[_0x44b8('0x41')]=[{'all':!![]}];}_0x499a3e=_[_0x44b8('0x3d')]({},_0x499a3e,_0x334f86[_0x44b8('0x3f')]);return db['AnalyticMetric'][_0x44b8('0x46')](_0x499a3e)['then'](handleEntityNotFound(_0xfd590a,null))[_0x44b8('0x20')](respondWithResult(_0xfd590a,null))[_0x44b8('0x43')](handleError(_0xfd590a,null));};exports[_0x44b8('0x47')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x29')]['create'](_0x9207bf[_0x44b8('0x48')],{})[_0x44b8('0x20')](function(_0x10602c){var _0x25d266=_0x9207bf['user'][_0x44b8('0x22')]({'plain':!![]});if(!_0x25d266)throw new Error(_0x44b8('0x49'));if(_0x25d266[_0x44b8('0x4a')]===_0x44b8('0x4b')){var _0x44ec23=_0x10602c[_0x44b8('0x22')]({'plain':!![]});var _0x500bad=_0x44b8('0x23');return db[_0x44b8('0x4c')][_0x44b8('0x46')]({'where':{'name':_0x500bad,'userProfileId':_0x25d266[_0x44b8('0x4d')]},'raw':!![]})[_0x44b8('0x20')](function(_0x57d0e2){if(_0x57d0e2&&_0x57d0e2['autoAssociation']===0x0){return db[_0x44b8('0x24')]['create']({'name':_0x44ec23[_0x44b8('0x27')],'resourceId':_0x44ec23['id'],'type':_0x57d0e2['name'],'sectionId':_0x57d0e2['id']},{})[_0x44b8('0x20')](function(){return _0x10602c;});}else{return _0x10602c;}})[_0x44b8('0x43')](function(_0x1a29f6){logger[_0x44b8('0x4e')](_0x44b8('0x4f'),_0x1a29f6);throw _0x1a29f6;});}return _0x10602c;})[_0x44b8('0x20')](respondWithResult(_0x103d57,0xc9))[_0x44b8('0x43')](handleError(_0x103d57,null));};exports['update']=function(_0x3ad278,_0x37b2c2){if(_0x3ad278[_0x44b8('0x48')]['id']){delete _0x3ad278['body']['id'];}return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x3ad278[_0x44b8('0x45')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x37b2c2,null))['then'](saveUpdates(_0x3ad278[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x37b2c2,null))['catch'](handleError(_0x37b2c2,null));};exports[_0x44b8('0x21')]=function(_0x19f22b,_0x35136e){return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x19f22b['params']['id']}})['then'](handleEntityNotFound(_0x35136e,null))[_0x44b8('0x20')](removeEntity(_0x35136e,null))[_0x44b8('0x43')](handleError(_0x35136e,null));}; \ No newline at end of file +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x15570d,_0x3bdc08){var _0xbeffca=function(_0x4b5dbb){while(--_0x4b5dbb){_0x15570d['push'](_0x15570d['shift']());}};_0xbeffca(++_0x3bdc08);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0xf2ca[_0x21b706];return _0x13b94a;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 414dfe4..60da42d 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 _0x2eb2=['moment','bluebird','request-promise','rimraf','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api'];(function(_0x451372,_0x49abd5){var _0x33fef3=function(_0x5b6215){while(--_0x5b6215){_0x451372['push'](_0x451372['shift']());}};_0x33fef3(++_0x49abd5);}(_0x2eb2,0x19f));var _0x22eb=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x2eb2[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b47=['bluebird','request-promise','path','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment'];(function(_0x4debf0,_0x34404b){var _0x37959d=function(_0x379f3d){while(--_0x379f3d){_0x4debf0['push'](_0x4debf0['shift']());}};_0x37959d(++_0x34404b);}(_0x4b47,0x1b4));var _0x74b4=function(_0x38c509,_0xd5e48b){_0x38c509=_0x38c509-0x0;var _0xfdfb73=_0x4b47[_0x38c509];return _0xfdfb73;};'use strict';var _=require(_0x74b4('0x0'));var util=require('util');var logger=require(_0x74b4('0x1'))(_0x74b4('0x2'));var moment=require(_0x74b4('0x3'));var BPromise=require(_0x74b4('0x4'));var rp=require(_0x74b4('0x5'));var fs=require('fs');var path=require(_0x74b4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x74b4('0x7'));module[_0x74b4('0x8')]=function(_0x4dc737,_0x4cd397){return _0x4dc737['define'](_0x74b4('0x9'),attributes,{'tableName':_0x74b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 2eb075d..b47e520 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 _0xeca4=['info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x565228,_0x8d5181){var _0x11570f=function(_0x949dc0){while(--_0x949dc0){_0x565228['push'](_0x565228['shift']());}};_0x11570f(++_0x8d5181);}(_0xeca4,0x1b7));var _0x4eca=function(_0x42e15e,_0x267b5d){_0x42e15e=_0x42e15e-0x0;var _0x1fd377=_0xeca4[_0x42e15e];return _0x1fd377;};'use strict';var _=require(_0x4eca('0x0'));var util=require(_0x4eca('0x1'));var moment=require(_0x4eca('0x2'));var BPromise=require(_0x4eca('0x3'));var rs=require(_0x4eca('0x4'));var fs=require('fs');var Redis=require(_0x4eca('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4eca('0x6'));var config=require(_0x4eca('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4eca('0x8')][_0x4eca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45bb29,_0xecd238,_0x2d725e){return new BPromise(function(_0x12164c,_0x50842e){return client[_0x4eca('0xa')](_0x45bb29,_0x2d725e)[_0x4eca('0xb')](function(_0xe8663a){logger['info'](_0x4eca('0xc'),_0xecd238,_0x4eca('0xd'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0xecd238,'request\x20sent',JSON[_0x4eca('0xe')](_0xe8663a));if(_0xe8663a['error']){if(_0xe8663a[_0x4eca('0xf')]['code']===0x1f4){logger[_0x4eca('0xf')](_0x4eca('0xc'),_0xecd238,_0xe8663a['error'][_0x4eca('0x10')]);return _0x50842e(_0xe8663a[_0x4eca('0xf')][_0x4eca('0x10')]);}logger[_0x4eca('0xf')](_0x4eca('0xc'),_0xecd238,_0xe8663a['error'][_0x4eca('0x10')]);return _0x12164c(_0xe8663a[_0x4eca('0xf')][_0x4eca('0x10')]);}else{logger[_0x4eca('0x11')](_0x4eca('0xc'),_0xecd238,'request\x20sent');_0x12164c(_0xe8663a[_0x4eca('0x12')][_0x4eca('0x10')]);}})['catch'](function(_0xac73a0){logger[_0x4eca('0xf')](_0x4eca('0xc'),_0xecd238,_0xac73a0);_0x50842e(_0xac73a0);});});} \ No newline at end of file +var _0xcf52=['error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4105d7,_0x2d1769){var _0x24b0f8=function(_0x4a8d52){while(--_0x4a8d52){_0x4105d7['push'](_0x4105d7['shift']());}};_0x24b0f8(++_0x2d1769);}(_0xcf52,0xf5));var _0x2cf5=function(_0x2175ca,_0x336f20){_0x2175ca=_0x2175ca-0x0;var _0x2b3b76=_0xcf52[_0x2175ca];return _0x2b3b76;};'use strict';var _=require(_0x2cf5('0x0'));var util=require('util');var moment=require(_0x2cf5('0x1'));var BPromise=require(_0x2cf5('0x2'));var rs=require(_0x2cf5('0x3'));var fs=require('fs');var Redis=require(_0x2cf5('0x4'));var db=require(_0x2cf5('0x5'))['db'];var utils=require(_0x2cf5('0x6'));var logger=require(_0x2cf5('0x7'))(_0x2cf5('0x8'));var config=require(_0x2cf5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2cf5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a9501,_0x10fdf3,_0x645c8c){return new BPromise(function(_0x411d86,_0x5dbc1c){return client[_0x2cf5('0xb')](_0x5a9501,_0x645c8c)[_0x2cf5('0xc')](function(_0xf5e23c){logger[_0x2cf5('0xd')](_0x2cf5('0xe'),_0x10fdf3,_0x2cf5('0xf'));logger[_0x2cf5('0x10')](_0x2cf5('0x11'),_0x10fdf3,'request\x20sent',JSON[_0x2cf5('0x12')](_0xf5e23c));if(_0xf5e23c['error']){if(_0xf5e23c[_0x2cf5('0x13')]['code']===0x1f4){logger['error'](_0x2cf5('0xe'),_0x10fdf3,_0xf5e23c['error'][_0x2cf5('0x14')]);return _0x5dbc1c(_0xf5e23c[_0x2cf5('0x13')][_0x2cf5('0x14')]);}logger['error'](_0x2cf5('0xe'),_0x10fdf3,_0xf5e23c[_0x2cf5('0x13')]['message']);return _0x411d86(_0xf5e23c['error'][_0x2cf5('0x14')]);}else{logger[_0x2cf5('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x10fdf3,_0x2cf5('0xf'));_0x411d86(_0xf5e23c['result'][_0x2cf5('0x14')]);}})[_0x2cf5('0x15')](function(_0x1e27ca){logger[_0x2cf5('0x13')](_0x2cf5('0xe'),_0x10fdf3,_0x1e27ca);_0x5dbc1c(_0x1e27ca);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c11366d..c96e349 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 _0x46cb=['./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e7b66,_0x5d1f12){var _0x49b719=function(_0x29c685){while(--_0x29c685){_0x2e7b66['push'](_0x2e7b66['shift']());}};_0x49b719(++_0x5d1f12);}(_0x46cb,0xd6));var _0xb46c=function(_0x2cd068,_0x7a0a83){_0x2cd068=_0x2cd068-0x0;var _0x1f2d00=_0x46cb[_0x2cd068];return _0x1f2d00;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb46c('0x0'));var express=require(_0xb46c('0x1'));var router=express[_0xb46c('0x2')]();var fs_extra=require(_0xb46c('0x3'));var auth=require(_0xb46c('0x4'));var interaction=require(_0xb46c('0x5'));var config=require(_0xb46c('0x6'));var controller=require(_0xb46c('0x7'));router[_0xb46c('0x8')]('/',auth[_0xb46c('0x9')](),controller[_0xb46c('0xa')]);router[_0xb46c('0x8')](_0xb46c('0xb'),auth[_0xb46c('0x9')](),controller['show']);router[_0xb46c('0xc')]('/',auth[_0xb46c('0x9')](),controller[_0xb46c('0xd')]);router[_0xb46c('0xe')](_0xb46c('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb46c('0xb'),auth[_0xb46c('0x9')](),controller[_0xb46c('0xf')]);module[_0xb46c('0x10')]=router; \ No newline at end of file +var _0xd9c8=['post','isAuthenticated','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd9c8[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var path=require('path');var timeout=require(_0x8d9c('0x2'));var express=require(_0x8d9c('0x3'));var router=express[_0x8d9c('0x4')]();var fs_extra=require(_0x8d9c('0x5'));var auth=require(_0x8d9c('0x6'));var interaction=require(_0x8d9c('0x7'));var config=require(_0x8d9c('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8d9c('0x9')]);router[_0x8d9c('0xa')](_0x8d9c('0xb'),auth['isAuthenticated'](),controller[_0x8d9c('0xc')]);router[_0x8d9c('0xd')]('/',auth[_0x8d9c('0xe')](),controller[_0x8d9c('0xf')]);router[_0x8d9c('0x10')](_0x8d9c('0xb'),auth[_0x8d9c('0xe')](),controller[_0x8d9c('0x11')]);router['delete'](_0x8d9c('0xb'),auth['isAuthenticated'](),controller[_0x8d9c('0x12')]);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 336a149..2bb4afd 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 _0x3a3c=['sequelize','exports','TEXT'];(function(_0x4e897b,_0x269c21){var _0x484a27=function(_0x26d361){while(--_0x26d361){_0x4e897b['push'](_0x4e897b['shift']());}};_0x484a27(++_0x269c21);}(_0x3a3c,0x102));var _0xc3a3=function(_0x238148,_0x29ca2d){_0x238148=_0x238148-0x0;var _0x42ab56=_0x3a3c[_0x238148];return _0x42ab56;};'use strict';var Sequelize=require(_0xc3a3('0x0'));module[_0xc3a3('0x1')]={'tree':{'type':Sequelize[_0xc3a3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa11e=['TEXT','sequelize','exports'];(function(_0x19cd6c,_0x46de98){var _0x196b4e=function(_0x10e0e4){while(--_0x10e0e4){_0x19cd6c['push'](_0x19cd6c['shift']());}};_0x196b4e(++_0x46de98);}(_0xa11e,0xfa));var _0xea11=function(_0x58006e,_0x6c6cc1){_0x58006e=_0x58006e-0x0;var _0x2c07de=_0xa11e[_0x58006e];return _0x2c07de;};'use strict';var Sequelize=require(_0xea11('0x0'));module[_0xea11('0x1')]={'tree':{'type':Sequelize[_0xea11('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 64ae6c2..305c737 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 _0x134c=['jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','apply','reject','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rawAttributes','create','body','catch','find','params','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x134c,0x1d1));var _0xc134=function(_0x50aea5,_0x5dd077){_0x50aea5=_0x50aea5-0x0;var _0x4657f1=_0x134c[_0x50aea5];return _0x4657f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc134('0x0'));var jsonpatch=require(_0xc134('0x1'));var rp=require(_0xc134('0x2'));var moment=require('moment');var BPromise=require(_0xc134('0x3'));var Mustache=require('mustache');var util=require(_0xc134('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc134('0x5'));var ejs=require(_0xc134('0x6'));var fs=require('fs');var fs_extra=require(_0xc134('0x7'));var _=require(_0xc134('0x8'));var squel=require(_0xc134('0x9'));var crypto=require(_0xc134('0xa'));var jsforce=require(_0xc134('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc134('0x5'));var querystring=require(_0xc134('0xc'));var Papa=require('papaparse');var Redis=require(_0xc134('0xd'));var authService=require(_0xc134('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc134('0xf'));var logger=require(_0xc134('0x10'))(_0xc134('0x11'));var utils=require(_0xc134('0x12'));var config=require(_0xc134('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc134('0x14'))['db'];function respondWithStatusCode(_0x58affe,_0x162892){_0x162892=_0x162892||0xcc;return function(_0x5d21bd){if(_0x5d21bd){return _0x58affe[_0xc134('0x15')](_0x162892);}return _0x58affe[_0xc134('0x16')](_0x162892)[_0xc134('0x17')]();};}function respondWithResult(_0x249fe9,_0x3629fb){_0x3629fb=_0x3629fb||0xc8;return function(_0x4f07ff){if(_0x4f07ff){return _0x249fe9[_0xc134('0x16')](_0x3629fb)[_0xc134('0x18')](_0x4f07ff);}};}function respondWithFilteredResult(_0x2ccb4f,_0x5a4a62){return function(_0x54629f){if(_0x54629f){var _0xfd2f4f=typeof _0x5a4a62['offset']==='undefined'&&typeof _0x5a4a62[_0xc134('0x19')]==='undefined';var _0xf225c4=_0x54629f[_0xc134('0x1a')];var _0x31dd0e=_0xfd2f4f?0x0:_0x5a4a62[_0xc134('0x1b')];var _0x2ae860=_0xfd2f4f?_0x54629f['count']:_0x5a4a62[_0xc134('0x1b')]+_0x5a4a62['limit'];var _0x3750bc;if(_0x2ae860>=_0xf225c4){_0x2ae860=_0xf225c4;_0x3750bc=0xc8;}else{_0x3750bc=0xce;}_0x2ccb4f[_0xc134('0x16')](_0x3750bc);return _0x2ccb4f[_0xc134('0x1c')]('Content-Range',_0x31dd0e+'-'+_0x2ae860+'/'+_0xf225c4)[_0xc134('0x18')](_0x54629f);}return null;};}function patchUpdates(_0x42133e){return function(_0x24e8ee){try{jsonpatch[_0xc134('0x1d')](_0x24e8ee,_0x42133e,!![]);}catch(_0xf83754){return BPromise[_0xc134('0x1e')](_0xf83754);}return _0x24e8ee['save']();};}function saveUpdates(_0x2cc862,_0x471eaf){return function(_0x460552){if(_0x460552){return _0x460552[_0xc134('0x1f')](_0x2cc862)[_0xc134('0x20')](function(_0x47a37f){return _0x47a37f;});}return null;};}function removeEntity(_0x5c21e0,_0x3374c3){return function(_0xb0b3ff){if(_0xb0b3ff){return _0xb0b3ff[_0xc134('0x21')]()[_0xc134('0x20')](function(){_0x5c21e0['status'](0xcc)[_0xc134('0x17')]();});}};}function handleEntityNotFound(_0xd4354e,_0x21fe6f){return function(_0x455156){if(!_0x455156){_0xd4354e[_0xc134('0x15')](0x194);}return _0x455156;};}function handleError(_0x5b284a,_0x1715d1){_0x1715d1=_0x1715d1||0x1f4;return function(_0x30b862){logger[_0xc134('0x22')](_0x30b862['stack']);if(_0x30b862[_0xc134('0x23')]){delete _0x30b862[_0xc134('0x23')];}_0x5b284a[_0xc134('0x16')](_0x1715d1)[_0xc134('0x24')](_0x30b862);};}exports[_0xc134('0x25')]=function(_0x5f1845,_0x3702ac){var _0xa84c6b={},_0x229ab3={},_0x298c06={'count':0x0,'rows':[]};var _0x59825d=_[_0xc134('0x26')](db[_0xc134('0x27')]['rawAttributes'],function(_0x5a2024){return{'name':_0x5a2024[_0xc134('0x28')],'type':_0x5a2024['type']['key']};});_0x229ab3[_0xc134('0x29')]=_[_0xc134('0x26')](_0x59825d,_0xc134('0x23'));_0x229ab3[_0xc134('0x2a')]=_[_0xc134('0x2b')](_0x5f1845[_0xc134('0x2a')]);_0x229ab3['filters']=_[_0xc134('0x2c')](_0x229ab3[_0xc134('0x29')],_0x229ab3[_0xc134('0x2a')]);_0xa84c6b[_0xc134('0x2d')]=_['intersection'](_0x229ab3[_0xc134('0x29')],qs[_0xc134('0x2e')](_0x5f1845['query'][_0xc134('0x2e')]));_0xa84c6b['attributes']=_0xa84c6b['attributes'][_0xc134('0x2f')]?_0xa84c6b[_0xc134('0x2d')]:_0x229ab3[_0xc134('0x29')];if(!_0x5f1845[_0xc134('0x2a')][_0xc134('0x30')](_0xc134('0x31'))){_0xa84c6b[_0xc134('0x19')]=qs[_0xc134('0x19')](_0x5f1845['query']['limit']);_0xa84c6b[_0xc134('0x1b')]=qs[_0xc134('0x1b')](_0x5f1845[_0xc134('0x2a')][_0xc134('0x1b')]);}_0xa84c6b['order']=qs[_0xc134('0x32')](_0x5f1845[_0xc134('0x2a')][_0xc134('0x32')]);_0xa84c6b[_0xc134('0x33')]=qs[_0xc134('0x34')](_[_0xc134('0x35')](_0x5f1845[_0xc134('0x2a')],_0x229ab3[_0xc134('0x34')]),_0x59825d);if(_0x5f1845[_0xc134('0x2a')][_0xc134('0x36')]){_0xa84c6b['where']=_[_0xc134('0x37')](_0xa84c6b[_0xc134('0x33')],{'$or':_[_0xc134('0x26')](_0x59825d,function(_0x391d4e){if(_0x391d4e[_0xc134('0x38')]!==_0xc134('0x39')){var _0x3c5e0c={};_0x3c5e0c[_0x391d4e[_0xc134('0x23')]]={'$like':'%'+_0x5f1845[_0xc134('0x2a')][_0xc134('0x36')]+'%'};return _0x3c5e0c;}})});}_0xa84c6b=_[_0xc134('0x37')]({},_0xa84c6b,_0x5f1845[_0xc134('0x3a')]);var _0x94a661={'where':_0xa84c6b[_0xc134('0x33')]};return db[_0xc134('0x27')][_0xc134('0x1a')](_0x94a661)[_0xc134('0x20')](function(_0x2ba6e7){_0x298c06['count']=_0x2ba6e7;if(_0x5f1845[_0xc134('0x2a')][_0xc134('0x3b')]){_0xa84c6b[_0xc134('0x3c')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xc134('0x3d')](_0xa84c6b);})[_0xc134('0x20')](function(_0x2b17ae){_0x298c06['rows']=_0x2b17ae;return _0x298c06;})['then'](respondWithFilteredResult(_0x3702ac,_0xa84c6b))['catch'](handleError(_0x3702ac,null));};exports['show']=function(_0x5b765a,_0x1d8c09){var _0x41f74a={'raw':!![],'where':{'id':_0x5b765a['params']['id']}},_0x4cc19b={};_0x4cc19b['model']=_[_0xc134('0x2b')](db['AnalyticTreeReport'][_0xc134('0x3e')]);_0x4cc19b[_0xc134('0x2a')]=_[_0xc134('0x2b')](_0x5b765a[_0xc134('0x2a')]);_0x4cc19b[_0xc134('0x34')]=_[_0xc134('0x2c')](_0x4cc19b[_0xc134('0x29')],_0x4cc19b[_0xc134('0x2a')]);_0x41f74a[_0xc134('0x2d')]=_['intersection'](_0x4cc19b[_0xc134('0x29')],qs['fields'](_0x5b765a[_0xc134('0x2a')][_0xc134('0x2e')]));_0x41f74a[_0xc134('0x2d')]=_0x41f74a[_0xc134('0x2d')]['length']?_0x41f74a[_0xc134('0x2d')]:_0x4cc19b[_0xc134('0x29')];if(_0x5b765a[_0xc134('0x2a')][_0xc134('0x3b')]){_0x41f74a[_0xc134('0x3c')]=[{'all':!![]}];}_0x41f74a=_[_0xc134('0x37')]({},_0x41f74a,_0x5b765a['options']);return db[_0xc134('0x27')]['find'](_0x41f74a)[_0xc134('0x20')](handleEntityNotFound(_0x1d8c09,null))[_0xc134('0x20')](respondWithResult(_0x1d8c09,null))['catch'](handleError(_0x1d8c09,null));};exports[_0xc134('0x3f')]=function(_0x16442e,_0x2a7bb5){return db[_0xc134('0x27')][_0xc134('0x3f')](_0x16442e[_0xc134('0x40')],{})['then'](respondWithResult(_0x2a7bb5,0xc9))[_0xc134('0x41')](handleError(_0x2a7bb5,null));};exports[_0xc134('0x1f')]=function(_0x3b4e78,_0x587d8d){if(_0x3b4e78['body']['id']){delete _0x3b4e78[_0xc134('0x40')]['id'];}return db[_0xc134('0x27')][_0xc134('0x42')]({'where':{'id':_0x3b4e78[_0xc134('0x43')]['id']}})[_0xc134('0x20')](handleEntityNotFound(_0x587d8d,null))[_0xc134('0x20')](saveUpdates(_0x3b4e78[_0xc134('0x40')],null))[_0xc134('0x20')](respondWithResult(_0x587d8d,null))[_0xc134('0x41')](handleError(_0x587d8d,null));};exports['destroy']=function(_0x8d17ed,_0x23b24a){return db[_0xc134('0x27')]['find']({'where':{'id':_0x8d17ed[_0xc134('0x43')]['id']}})['then'](handleEntityNotFound(_0x23b24a,null))[_0xc134('0x20')](removeEntity(_0x23b24a,null))[_0xc134('0x41')](handleError(_0x23b24a,null));}; \ No newline at end of file +var _0x44e8=['sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x34b3c1,_0x1ec405){var _0x4c72f0=function(_0xcf8d2e){while(--_0xcf8d2e){_0x34b3c1['push'](_0x34b3c1['shift']());}};_0x4c72f0(++_0x1ec405);}(_0x44e8,0xf5));var _0x844e=function(_0x565957,_0x53c91a){_0x565957=_0x565957-0x0;var _0x4706b7=_0x44e8[_0x565957];return _0x4706b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x844e('0x0'));var zipdir=require(_0x844e('0x1'));var jsonpatch=require(_0x844e('0x2'));var rp=require(_0x844e('0x3'));var moment=require(_0x844e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x844e('0x5'));var util=require(_0x844e('0x6'));var path=require(_0x844e('0x7'));var sox=require(_0x844e('0x8'));var csv=require(_0x844e('0x9'));var ejs=require(_0x844e('0xa'));var fs=require('fs');var fs_extra=require(_0x844e('0xb'));var _=require(_0x844e('0xc'));var squel=require(_0x844e('0xd'));var crypto=require('crypto');var jsforce=require(_0x844e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x844e('0x9'));var querystring=require(_0x844e('0xf'));var Papa=require('papaparse');var Redis=require(_0x844e('0x10'));var authService=require(_0x844e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x844e('0x12'));var hardwareService=require(_0x844e('0x13'));var logger=require('../../config/logger')(_0x844e('0x14'));var utils=require(_0x844e('0x15'));var config=require(_0x844e('0x16'));var licenseUtil=require(_0x844e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1bf5,_0xafbbf5){_0xafbbf5=_0xafbbf5||0xcc;return function(_0x512bea){if(_0x512bea){return _0x3c1bf5[_0x844e('0x18')](_0xafbbf5);}return _0x3c1bf5[_0x844e('0x19')](_0xafbbf5)[_0x844e('0x1a')]();};}function respondWithResult(_0x34d5f9,_0x27f7dd){_0x27f7dd=_0x27f7dd||0xc8;return function(_0x59347a){if(_0x59347a){return _0x34d5f9['status'](_0x27f7dd)[_0x844e('0x1b')](_0x59347a);}};}function respondWithFilteredResult(_0x828ab3,_0x598cb3){return function(_0x3f3a7f){if(_0x3f3a7f){var _0x2ac2a5=typeof _0x598cb3[_0x844e('0x1c')]==='undefined'&&typeof _0x598cb3[_0x844e('0x1d')]==='undefined';var _0x2638a9=_0x3f3a7f[_0x844e('0x1e')];var _0x1a7785=_0x2ac2a5?0x0:_0x598cb3[_0x844e('0x1c')];var _0x301788=_0x2ac2a5?_0x3f3a7f[_0x844e('0x1e')]:_0x598cb3['offset']+_0x598cb3[_0x844e('0x1d')];var _0x101cbe;if(_0x301788>=_0x2638a9){_0x301788=_0x2638a9;_0x101cbe=0xc8;}else{_0x101cbe=0xce;}_0x828ab3[_0x844e('0x19')](_0x101cbe);return _0x828ab3[_0x844e('0x1f')]('Content-Range',_0x1a7785+'-'+_0x301788+'/'+_0x2638a9)[_0x844e('0x1b')](_0x3f3a7f);}return null;};}function patchUpdates(_0x5214c9){return function(_0x1b6f32){try{jsonpatch[_0x844e('0x20')](_0x1b6f32,_0x5214c9,!![]);}catch(_0x3157b7){return BPromise[_0x844e('0x21')](_0x3157b7);}return _0x1b6f32[_0x844e('0x22')]();};}function saveUpdates(_0x4336a5,_0x4bf909){return function(_0x9c796c){if(_0x9c796c){return _0x9c796c[_0x844e('0x23')](_0x4336a5)[_0x844e('0x24')](function(_0x430c56){return _0x430c56;});}return null;};}function removeEntity(_0x6ff083,_0x1b6615){return function(_0xe7c01f){if(_0xe7c01f){return _0xe7c01f[_0x844e('0x25')]()['then'](function(){_0x6ff083[_0x844e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38ae5c,_0x4149c7){return function(_0x28dc84){if(!_0x28dc84){_0x38ae5c['sendStatus'](0x194);}return _0x28dc84;};}function handleError(_0x1b83f9,_0x49a20a){_0x49a20a=_0x49a20a||0x1f4;return function(_0x5591be){logger[_0x844e('0x26')](_0x5591be[_0x844e('0x27')]);if(_0x5591be['name']){delete _0x5591be[_0x844e('0x28')];}_0x1b83f9[_0x844e('0x19')](_0x49a20a)[_0x844e('0x29')](_0x5591be);};}exports[_0x844e('0x2a')]=function(_0x4dfc7e,_0x1826f5){var _0x163f95={},_0x47d5c8={},_0x3867e8={'count':0x0,'rows':[]};var _0x4af8bb=_[_0x844e('0x2b')](db[_0x844e('0x2c')][_0x844e('0x2d')],function(_0x3e7e93){return{'name':_0x3e7e93[_0x844e('0x2e')],'type':_0x3e7e93[_0x844e('0x2f')][_0x844e('0x30')]};});_0x47d5c8[_0x844e('0x31')]=_[_0x844e('0x2b')](_0x4af8bb,_0x844e('0x28'));_0x47d5c8[_0x844e('0x32')]=_[_0x844e('0x33')](_0x4dfc7e[_0x844e('0x32')]);_0x47d5c8[_0x844e('0x34')]=_[_0x844e('0x35')](_0x47d5c8[_0x844e('0x31')],_0x47d5c8[_0x844e('0x32')]);_0x163f95[_0x844e('0x36')]=_['intersection'](_0x47d5c8[_0x844e('0x31')],qs[_0x844e('0x37')](_0x4dfc7e[_0x844e('0x32')][_0x844e('0x37')]));_0x163f95[_0x844e('0x36')]=_0x163f95['attributes']['length']?_0x163f95[_0x844e('0x36')]:_0x47d5c8[_0x844e('0x31')];if(!_0x4dfc7e[_0x844e('0x32')][_0x844e('0x38')](_0x844e('0x39'))){_0x163f95[_0x844e('0x1d')]=qs[_0x844e('0x1d')](_0x4dfc7e['query'][_0x844e('0x1d')]);_0x163f95[_0x844e('0x1c')]=qs[_0x844e('0x1c')](_0x4dfc7e[_0x844e('0x32')][_0x844e('0x1c')]);}_0x163f95[_0x844e('0x3a')]=qs[_0x844e('0x3b')](_0x4dfc7e[_0x844e('0x32')]['sort']);_0x163f95[_0x844e('0x3c')]=qs['filters'](_[_0x844e('0x3d')](_0x4dfc7e[_0x844e('0x32')],_0x47d5c8[_0x844e('0x34')]),_0x4af8bb);if(_0x4dfc7e[_0x844e('0x32')][_0x844e('0x3e')]){_0x163f95[_0x844e('0x3c')]=_[_0x844e('0x3f')](_0x163f95[_0x844e('0x3c')],{'$or':_[_0x844e('0x2b')](_0x4af8bb,function(_0x2a2679){if(_0x2a2679[_0x844e('0x2f')]!==_0x844e('0x40')){var _0x211d36={};_0x211d36[_0x2a2679[_0x844e('0x28')]]={'$like':'%'+_0x4dfc7e[_0x844e('0x32')][_0x844e('0x3e')]+'%'};return _0x211d36;}})});}_0x163f95=_[_0x844e('0x3f')]({},_0x163f95,_0x4dfc7e[_0x844e('0x41')]);var _0x4a2579={'where':_0x163f95[_0x844e('0x3c')]};return db['AnalyticTreeReport']['count'](_0x4a2579)[_0x844e('0x24')](function(_0x3ab978){_0x3867e8['count']=_0x3ab978;if(_0x4dfc7e[_0x844e('0x32')]['includeAll']){_0x163f95[_0x844e('0x42')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x844e('0x43')](_0x163f95);})[_0x844e('0x24')](function(_0x459ccd){_0x3867e8[_0x844e('0x44')]=_0x459ccd;return _0x3867e8;})[_0x844e('0x24')](respondWithFilteredResult(_0x1826f5,_0x163f95))[_0x844e('0x45')](handleError(_0x1826f5,null));};exports[_0x844e('0x46')]=function(_0x18071e,_0x5a97d7){var _0x11b519={'raw':!![],'where':{'id':_0x18071e[_0x844e('0x47')]['id']}},_0x823bd2={};_0x823bd2['model']=_[_0x844e('0x33')](db[_0x844e('0x2c')]['rawAttributes']);_0x823bd2[_0x844e('0x32')]=_[_0x844e('0x33')](_0x18071e['query']);_0x823bd2[_0x844e('0x34')]=_[_0x844e('0x35')](_0x823bd2[_0x844e('0x31')],_0x823bd2['query']);_0x11b519[_0x844e('0x36')]=_['intersection'](_0x823bd2['model'],qs[_0x844e('0x37')](_0x18071e['query'][_0x844e('0x37')]));_0x11b519['attributes']=_0x11b519['attributes'][_0x844e('0x48')]?_0x11b519[_0x844e('0x36')]:_0x823bd2[_0x844e('0x31')];if(_0x18071e[_0x844e('0x32')]['includeAll']){_0x11b519['include']=[{'all':!![]}];}_0x11b519=_[_0x844e('0x3f')]({},_0x11b519,_0x18071e[_0x844e('0x41')]);return db['AnalyticTreeReport'][_0x844e('0x49')](_0x11b519)[_0x844e('0x24')](handleEntityNotFound(_0x5a97d7,null))['then'](respondWithResult(_0x5a97d7,null))[_0x844e('0x45')](handleError(_0x5a97d7,null));};exports[_0x844e('0x4a')]=function(_0x3c9164,_0x5442ef){return db[_0x844e('0x2c')]['create'](_0x3c9164[_0x844e('0x4b')],{})[_0x844e('0x24')](respondWithResult(_0x5442ef,0xc9))[_0x844e('0x45')](handleError(_0x5442ef,null));};exports[_0x844e('0x23')]=function(_0x174a62,_0x598dae){if(_0x174a62[_0x844e('0x4b')]['id']){delete _0x174a62['body']['id'];}return db[_0x844e('0x2c')][_0x844e('0x49')]({'where':{'id':_0x174a62['params']['id']}})[_0x844e('0x24')](handleEntityNotFound(_0x598dae,null))['then'](saveUpdates(_0x174a62[_0x844e('0x4b')],null))[_0x844e('0x24')](respondWithResult(_0x598dae,null))[_0x844e('0x45')](handleError(_0x598dae,null));};exports['destroy']=function(_0x2acbef,_0x4e85f7){return db[_0x844e('0x2c')][_0x844e('0x49')]({'where':{'id':_0x2acbef[_0x844e('0x47')]['id']}})[_0x844e('0x24')](handleEntityNotFound(_0x4e85f7,null))[_0x844e('0x24')](removeEntity(_0x4e85f7,null))['catch'](handleError(_0x4e85f7,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index f3c3f50..7d68ba6 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 _0x4231=['api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x4231,0x82));var _0x1423=function(_0xe5d54f,_0x143d93){_0xe5d54f=_0xe5d54f-0x0;var _0x2a74bf=_0x4231[_0xe5d54f];return _0x2a74bf;};'use strict';var _=require('lodash');var util=require(_0x1423('0x0'));var logger=require(_0x1423('0x1'))(_0x1423('0x2'));var moment=require('moment');var BPromise=require(_0x1423('0x3'));var rp=require(_0x1423('0x4'));var fs=require('fs');var path=require(_0x1423('0x5'));var rimraf=require(_0x1423('0x6'));var config=require(_0x1423('0x7'));var attributes=require(_0x1423('0x8'));module[_0x1423('0x9')]=function(_0x21fe37,_0x4f315e){return _0x21fe37['define'](_0x1423('0xa'),attributes,{'tableName':_0x1423('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf37d=['exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./analyticTreeReport.attributes'];(function(_0xf273f9,_0x486198){var _0xb4abcc=function(_0x2f9418){while(--_0x2f9418){_0xf273f9['push'](_0xf273f9['shift']());}};_0xb4abcc(++_0x486198);}(_0xf37d,0x16e));var _0xdf37=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0xf37d[_0x7791d5];return _0x5ce288;};'use strict';var _=require(_0xdf37('0x0'));var util=require(_0xdf37('0x1'));var logger=require(_0xdf37('0x2'))(_0xdf37('0x3'));var moment=require(_0xdf37('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf37('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf37('0x6'));var config=require('../../config/environment');var attributes=require(_0xdf37('0x7'));module[_0xdf37('0x8')]=function(_0x47b56c,_0x39c272){return _0x47b56c['define'](_0xdf37('0x9'),attributes,{'tableName':_0xdf37('0xa'),'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 d2d2d2e..fb0c082 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0xadb5,0xad));var _0x5adb=function(_0x28a760,_0x2ddce5){_0x28a760=_0x28a760-0x0;var _0x3bf44f=_0xadb5[_0x28a760];return _0x3bf44f;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +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(_0xf1ad4d,_0x6c476b){var _0x1275d4=function(_0x225a9d){while(--_0x225a9d){_0xf1ad4d['push'](_0xf1ad4d['shift']());}};_0x1275d4(++_0x6c476b);}(_0x2ef3,0xba));var _0x32ef=function(_0x145fdb,_0x47c911){_0x145fdb=_0x145fdb-0x0;var _0x4a6351=_0x2ef3[_0x145fdb];return _0x4a6351;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c36d985..e864d9d 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 _0xee40=['put','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee40,0x147));var _0x0ee4=function(_0xed5501,_0x49643e){_0xed5501=_0xed5501-0x0;var _0x54dda5=_0xee40[_0xed5501];return _0x54dda5;};'use strict';var multer=require(_0x0ee4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0ee4('0x1'));var express=require(_0x0ee4('0x2'));var router=express[_0x0ee4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0ee4('0x4'));var interaction=require(_0x0ee4('0x5'));var config=require(_0x0ee4('0x6'));var controller=require(_0x0ee4('0x7'));router[_0x0ee4('0x8')]('/',auth[_0x0ee4('0x9')](),controller[_0x0ee4('0xa')]);router[_0x0ee4('0x8')](_0x0ee4('0xb'),auth[_0x0ee4('0x9')](),controller[_0x0ee4('0xc')]);router[_0x0ee4('0xd')]('/',auth[_0x0ee4('0x9')](),controller[_0x0ee4('0xe')]);router[_0x0ee4('0xf')]('/:id',auth[_0x0ee4('0x9')](),controller[_0x0ee4('0x10')]);router[_0x0ee4('0x11')](_0x0ee4('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x0ee4('0x12')]=router; \ No newline at end of file +var _0x555a=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x862827,_0x47138b){var _0x4bea04=function(_0x2536bf){while(--_0x2536bf){_0x862827['push'](_0x862827['shift']());}};_0x4bea04(++_0x47138b);}(_0x555a,0x1d4));var _0xa555=function(_0x368a7d,_0x190e80){_0x368a7d=_0x368a7d-0x0;var _0x271079=_0x555a[_0x368a7d];return _0x271079;};'use strict';var multer=require(_0xa555('0x0'));var util=require(_0xa555('0x1'));var path=require('path');var timeout=require(_0xa555('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa555('0x3'));var auth=require(_0xa555('0x4'));var interaction=require(_0xa555('0x5'));var config=require('../../config/environment');var controller=require(_0xa555('0x6'));router[_0xa555('0x7')]('/',auth[_0xa555('0x8')](),controller[_0xa555('0x9')]);router[_0xa555('0x7')](_0xa555('0xa'),auth[_0xa555('0x8')](),controller[_0xa555('0xb')]);router['post']('/',auth[_0xa555('0x8')](),controller[_0xa555('0xc')]);router[_0xa555('0xd')](_0xa555('0xa'),auth[_0xa555('0x8')](),controller[_0xa555('0xe')]);router[_0xa555('0xf')](_0xa555('0xa'),auth['isAuthenticated'](),controller[_0xa555('0x10')]);module[_0xa555('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8420f8e..a3222ae 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 _0xa3e6=['sequelize','STRING'];(function(_0x3c9159,_0x58f463){var _0x3a6f26=function(_0x57c4f7){while(--_0x57c4f7){_0x3c9159['push'](_0x3c9159['shift']());}};_0x3a6f26(++_0x58f463);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x58cabf,_0x1bc95f){_0x58cabf=_0x58cabf-0x0;var _0x33bfe4=_0xa3e6[_0x58cabf];return _0x33bfe4;};'use strict';var Sequelize=require(_0x6a3e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a3e('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6a3e('0x1')]}}; \ No newline at end of file +var _0x54da=['STRING','sequelize'];(function(_0x56de0b,_0x1c39c1){var _0x1c05f0=function(_0x5a6e7d){while(--_0x5a6e7d){_0x56de0b['push'](_0x56de0b['shift']());}};_0x1c05f0(++_0x1c39c1);}(_0x54da,0x9d));var _0xa54d=function(_0x5ba6e2,_0x48e57b){_0x5ba6e2=_0x5ba6e2-0x0;var _0x51c376=_0x54da[_0x5ba6e2];return _0x51c376;};'use strict';var Sequelize=require(_0xa54d('0x0'));module['exports']={'name':{'type':Sequelize[_0xa54d('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index afc8992..d4c2f3d 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 _0x08af=['mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','map','Attachment','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','clone','get','omit','updatedAt','body','createdAt','create','file','originalname','basename','filename'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x08af,0xb7));var _0xf08a=function(_0x1d850e,_0x723bc4){_0x1d850e=_0x1d850e-0x0;var _0x2efd1f=_0x08af[_0x1d850e];return _0x2efd1f;};'use strict';var emlformat=require(_0xf08a('0x0'));var rimraf=require(_0xf08a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf08a('0x2'));var rp=require(_0xf08a('0x3'));var moment=require(_0xf08a('0x4'));var BPromise=require(_0xf08a('0x5'));var Mustache=require('mustache');var util=require(_0xf08a('0x6'));var path=require('path');var sox=require(_0xf08a('0x7'));var csv=require(_0xf08a('0x8'));var ejs=require(_0xf08a('0x9'));var fs=require('fs');var fs_extra=require(_0xf08a('0xa'));var _=require(_0xf08a('0xb'));var squel=require(_0xf08a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf08a('0xd'));var toCsv=require(_0xf08a('0x8'));var querystring=require(_0xf08a('0xe'));var Papa=require(_0xf08a('0xf'));var Redis=require(_0xf08a('0x10'));var authService=require(_0xf08a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf08a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf08a('0x13'));var utils=require(_0xf08a('0x14'));var config=require(_0xf08a('0x15'));var licenseUtil=require(_0xf08a('0x16'));var db=require(_0xf08a('0x17'))['db'];function respondWithStatusCode(_0x48a7aa,_0x19ff42){_0x19ff42=_0x19ff42||0xcc;return function(_0x143751){if(_0x143751){return _0x48a7aa[_0xf08a('0x18')](_0x19ff42);}return _0x48a7aa[_0xf08a('0x19')](_0x19ff42)['end']();};}function respondWithResult(_0x307f77,_0x18df6e){_0x18df6e=_0x18df6e||0xc8;return function(_0x37dfa7){if(_0x37dfa7){return _0x307f77[_0xf08a('0x19')](_0x18df6e)[_0xf08a('0x1a')](_0x37dfa7);}};}function respondWithFilteredResult(_0x2e9a66,_0x1a9f6c){return function(_0x257309){if(_0x257309){var _0x23c301=typeof _0x1a9f6c['offset']===_0xf08a('0x1b')&&typeof _0x1a9f6c[_0xf08a('0x1c')]==='undefined';var _0x5c0572=_0x257309[_0xf08a('0x1d')];var _0x254c9d=_0x23c301?0x0:_0x1a9f6c[_0xf08a('0x1e')];var _0x30c6d0=_0x23c301?_0x257309['count']:_0x1a9f6c['offset']+_0x1a9f6c['limit'];var _0x5a02d8;if(_0x30c6d0>=_0x5c0572){_0x30c6d0=_0x5c0572;_0x5a02d8=0xc8;}else{_0x5a02d8=0xce;}_0x2e9a66[_0xf08a('0x19')](_0x5a02d8);return _0x2e9a66[_0xf08a('0x1f')](_0xf08a('0x20'),_0x254c9d+'-'+_0x30c6d0+'/'+_0x5c0572)[_0xf08a('0x1a')](_0x257309);}return null;};}function patchUpdates(_0xfa57b8){return function(_0x5c6e81){try{jsonpatch[_0xf08a('0x21')](_0x5c6e81,_0xfa57b8,!![]);}catch(_0x3000d4){return BPromise[_0xf08a('0x22')](_0x3000d4);}return _0x5c6e81['save']();};}function saveUpdates(_0x2c7413,_0x1812a6){return function(_0x24163e){if(_0x24163e){return _0x24163e[_0xf08a('0x23')](_0x2c7413)['then'](function(_0x253357){return _0x253357;});}return null;};}function removeEntity(_0x3031b7,_0x131507){return function(_0xccf5bc){if(_0xccf5bc){return _0xccf5bc[_0xf08a('0x24')]()[_0xf08a('0x25')](function(){_0x3031b7[_0xf08a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbfc6e8,_0x15b653){return function(_0xc47e86){if(!_0xc47e86){_0xbfc6e8['sendStatus'](0x194);}return _0xc47e86;};}function handleError(_0x3a6d7c,_0x1bf680){_0x1bf680=_0x1bf680||0x1f4;return function(_0x2df195){logger[_0xf08a('0x26')](_0x2df195[_0xf08a('0x27')]);if(_0x2df195[_0xf08a('0x28')]){delete _0x2df195[_0xf08a('0x28')];}_0x3a6d7c[_0xf08a('0x19')](_0x1bf680)['send'](_0x2df195);};}exports['index']=function(_0xb6a203,_0x1a3a54){var _0x1f192a={},_0x15df7c={},_0xf5c80e={'count':0x0,'rows':[]};var _0x5d71b8=_[_0xf08a('0x29')](db[_0xf08a('0x2a')][_0xf08a('0x2b')],function(_0x3de322){return{'name':_0x3de322['fieldName'],'type':_0x3de322[_0xf08a('0x2c')][_0xf08a('0x2d')]};});_0x15df7c[_0xf08a('0x2e')]=_[_0xf08a('0x29')](_0x5d71b8,_0xf08a('0x28'));_0x15df7c[_0xf08a('0x2f')]=_[_0xf08a('0x30')](_0xb6a203['query']);_0x15df7c['filters']=_[_0xf08a('0x31')](_0x15df7c['model'],_0x15df7c[_0xf08a('0x2f')]);_0x1f192a[_0xf08a('0x32')]=_[_0xf08a('0x31')](_0x15df7c[_0xf08a('0x2e')],qs[_0xf08a('0x33')](_0xb6a203['query'][_0xf08a('0x33')]));_0x1f192a[_0xf08a('0x32')]=_0x1f192a[_0xf08a('0x32')]['length']?_0x1f192a[_0xf08a('0x32')]:_0x15df7c[_0xf08a('0x2e')];if(!_0xb6a203[_0xf08a('0x2f')][_0xf08a('0x34')](_0xf08a('0x35'))){_0x1f192a[_0xf08a('0x1c')]=qs[_0xf08a('0x1c')](_0xb6a203[_0xf08a('0x2f')][_0xf08a('0x1c')]);_0x1f192a[_0xf08a('0x1e')]=qs[_0xf08a('0x1e')](_0xb6a203[_0xf08a('0x2f')][_0xf08a('0x1e')]);}_0x1f192a[_0xf08a('0x36')]=qs[_0xf08a('0x37')](_0xb6a203['query'][_0xf08a('0x37')]);_0x1f192a[_0xf08a('0x38')]=qs['filters'](_[_0xf08a('0x39')](_0xb6a203[_0xf08a('0x2f')],_0x15df7c['filters']),_0x5d71b8);if(_0xb6a203[_0xf08a('0x2f')][_0xf08a('0x3a')]){_0x1f192a[_0xf08a('0x38')]=_[_0xf08a('0x3b')](_0x1f192a[_0xf08a('0x38')],{'$or':_[_0xf08a('0x29')](_0x5d71b8,function(_0x105d31){if(_0x105d31['type']!=='VIRTUAL'){var _0x39d291={};_0x39d291[_0x105d31[_0xf08a('0x28')]]={'$like':'%'+_0xb6a203['query'][_0xf08a('0x3a')]+'%'};return _0x39d291;}})});}_0x1f192a=_['merge']({},_0x1f192a,_0xb6a203[_0xf08a('0x3c')]);var _0x339162={'where':_0x1f192a[_0xf08a('0x38')]};return db[_0xf08a('0x2a')][_0xf08a('0x1d')](_0x339162)['then'](function(_0x3cf1db){_0xf5c80e[_0xf08a('0x1d')]=_0x3cf1db;if(_0xb6a203[_0xf08a('0x2f')][_0xf08a('0x3d')]){_0x1f192a['include']=[{'all':!![]}];}return db[_0xf08a('0x2a')][_0xf08a('0x3e')](_0x1f192a);})[_0xf08a('0x25')](function(_0x5268d2){_0xf5c80e[_0xf08a('0x3f')]=_0x5268d2;return _0xf5c80e;})['then'](respondWithFilteredResult(_0x1a3a54,_0x1f192a))[_0xf08a('0x40')](handleError(_0x1a3a54,null));};exports[_0xf08a('0x41')]=function(_0x4f03f6,_0x4e8897){var _0x2e717e={'raw':!![],'where':{'id':_0x4f03f6[_0xf08a('0x42')]['id']}},_0x1c50aa={};_0x1c50aa[_0xf08a('0x2e')]=_[_0xf08a('0x30')](db[_0xf08a('0x2a')][_0xf08a('0x2b')]);_0x1c50aa['query']=_['keys'](_0x4f03f6['query']);_0x1c50aa['filters']=_[_0xf08a('0x31')](_0x1c50aa[_0xf08a('0x2e')],_0x1c50aa[_0xf08a('0x2f')]);_0x2e717e[_0xf08a('0x32')]=_[_0xf08a('0x31')](_0x1c50aa[_0xf08a('0x2e')],qs['fields'](_0x4f03f6['query'][_0xf08a('0x33')]));_0x2e717e[_0xf08a('0x32')]=_0x2e717e[_0xf08a('0x32')][_0xf08a('0x43')]?_0x2e717e[_0xf08a('0x32')]:_0x1c50aa[_0xf08a('0x2e')];if(_0x4f03f6[_0xf08a('0x2f')][_0xf08a('0x3d')]){_0x2e717e[_0xf08a('0x44')]=[{'all':!![]}];}_0x2e717e=_['merge']({},_0x2e717e,_0x4f03f6['options']);return db[_0xf08a('0x2a')][_0xf08a('0x45')](_0x2e717e)[_0xf08a('0x25')](handleEntityNotFound(_0x4e8897,null))['then'](respondWithResult(_0x4e8897,null))[_0xf08a('0x40')](handleError(_0x4e8897,null));};exports[_0xf08a('0x46')]=function(_0x458c75,_0x51b04e){var _0x3275db={'where':{'id':_0x458c75[_0xf08a('0x42')]['id']}},_0x3b3227={};_0x3b3227[_0xf08a('0x2e')]=_[_0xf08a('0x30')](db[_0xf08a('0x2a')][_0xf08a('0x2b')]);_0x3275db[_0xf08a('0x32')]=_[_0xf08a('0x31')](_0x3b3227[_0xf08a('0x2e')],qs[_0xf08a('0x33')](_0x458c75[_0xf08a('0x2f')]['fields']));_0x3275db[_0xf08a('0x32')]=_0x3275db[_0xf08a('0x32')][_0xf08a('0x43')]?_0x3275db[_0xf08a('0x32')]:_0x3b3227[_0xf08a('0x2e')];if(_0x458c75[_0xf08a('0x2f')][_0xf08a('0x3d')]){_0x3275db[_0xf08a('0x44')]=[{'all':!![]}];}_0x3275db=_[_0xf08a('0x3b')]({},_0x3275db,_0x458c75[_0xf08a('0x3c')]);return db[_0xf08a('0x2a')][_0xf08a('0x45')](_0x3275db)[_0xf08a('0x25')](handleEntityNotFound(_0x51b04e,null))['then'](function(_0x487222){if(_0x487222){var _0x312759=_0x487222[_0xf08a('0x47')]({'plain':!![]});_0x312759=qs[_0xf08a('0x48')](_0x312759,['id','createdAt',_0xf08a('0x49')]);_0x458c75[_0xf08a('0x4a')]=_[_0xf08a('0x48')](_0x458c75['body'],['id',_0xf08a('0x4b'),_0xf08a('0x49')]);return db[_0xf08a('0x2a')][_0xf08a('0x4c')](_[_0xf08a('0x3b')](_0x312759,_0x458c75[_0xf08a('0x4a')]),{'include':_0x458c75[_0xf08a('0x2f')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xf08a('0x25')](respondWithResult(_0x51b04e,0xc9))['catch'](handleError(_0x51b04e,null));};exports['update']=function(_0x1b095c,_0x53db28){if(_0x1b095c[_0xf08a('0x4a')]['id']){delete _0x1b095c[_0xf08a('0x4a')]['id'];}return db[_0xf08a('0x2a')][_0xf08a('0x45')]({'where':{'id':_0x1b095c[_0xf08a('0x42')]['id']}})[_0xf08a('0x25')](handleEntityNotFound(_0x53db28,null))[_0xf08a('0x25')](saveUpdates(_0x1b095c[_0xf08a('0x4a')],null))[_0xf08a('0x25')](respondWithResult(_0x53db28,null))[_0xf08a('0x40')](handleError(_0x53db28,null));};exports[_0xf08a('0x24')]=function(_0x13221d,_0x5b555a){return db[_0xf08a('0x2a')][_0xf08a('0x45')]({'where':{'id':_0x13221d[_0xf08a('0x42')]['id']}})[_0xf08a('0x25')](handleEntityNotFound(_0x5b555a,null))[_0xf08a('0x25')](removeEntity(_0x5b555a,null))['catch'](handleError(_0x5b555a,null));};exports[_0xf08a('0x4c')]=function(_0xe0307b,_0x33f2d6,_0x45b265){_0xe0307b[_0xf08a('0x4a')][_0xf08a('0x28')]=_0xe0307b[_0xf08a('0x4d')][_0xf08a('0x4e')];_0xe0307b['body'][_0xf08a('0x4f')]=_0xe0307b['file'][_0xf08a('0x50')];_0xe0307b[_0xf08a('0x4a')][_0xf08a('0x2c')]=_0xe0307b[_0xf08a('0x4d')][_0xf08a('0x51')];return db[_0xf08a('0x2a')][_0xf08a('0x4c')](_0xe0307b['body'])[_0xf08a('0x25')](respondWithResult(_0x33f2d6,0xc9))[_0xf08a('0x40')](handleError(_0x33f2d6,null));};exports[_0xf08a('0x52')]=function(_0x1a80bd,_0x2a77a8,_0x3c0526){return db[_0xf08a('0x2a')][_0xf08a('0x53')]({'where':{'id':_0x1a80bd[_0xf08a('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2a77a8,null))[_0xf08a('0x25')](function(_0x36b547){if(_0x36b547){var _0x118b48=_0x36b547[_0xf08a('0x54')]!==null;var _0x5122bd=path[_0xf08a('0x55')](config['root'],_0xf08a('0x56'));if(_0x118b48){_0x5122bd=path['join'](_0x5122bd,_0xf08a('0x57'));}var _0x42ff14=path[_0xf08a('0x55')](_0x5122bd,_0x36b547[_0xf08a('0x4f')]);return _0x2a77a8['download'](_0x42ff14);}})[_0xf08a('0x40')](handleError(_0x2a77a8,null));}; \ No newline at end of file +var _0xed9e=['set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','Attachment','findAll','rows','catch','show','length','include','options','params','get','omit','updatedAt','body','createdAt','create','find','file','originalname','basename','filename','type','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count'];(function(_0x3fca6b,_0x2414eb){var _0x1fd4b5=function(_0x4331c8){while(--_0x4331c8){_0x3fca6b['push'](_0x3fca6b['shift']());}};_0x1fd4b5(++_0x2414eb);}(_0xed9e,0xf5));var _0xeed9=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xed9e[_0x4c06a3];return _0x7ff53c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeed9('0x0'));var jsonpatch=require(_0xeed9('0x1'));var rp=require(_0xeed9('0x2'));var moment=require('moment');var BPromise=require(_0xeed9('0x3'));var Mustache=require(_0xeed9('0x4'));var util=require('util');var path=require(_0xeed9('0x5'));var sox=require(_0xeed9('0x6'));var csv=require(_0xeed9('0x7'));var ejs=require(_0xeed9('0x8'));var fs=require('fs');var fs_extra=require(_0xeed9('0x9'));var _=require(_0xeed9('0xa'));var squel=require(_0xeed9('0xb'));var crypto=require(_0xeed9('0xc'));var jsforce=require(_0xeed9('0xd'));var deskjs=require(_0xeed9('0xe'));var toCsv=require(_0xeed9('0x7'));var querystring=require('querystring');var Papa=require(_0xeed9('0xf'));var Redis=require('ioredis');var authService=require(_0xeed9('0x10'));var qs=require(_0xeed9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeed9('0x12'))(_0xeed9('0x13'));var utils=require(_0xeed9('0x14'));var config=require(_0xeed9('0x15'));var licenseUtil=require(_0xeed9('0x16'));var db=require(_0xeed9('0x17'))['db'];function respondWithStatusCode(_0x4dcaf9,_0x267b56){_0x267b56=_0x267b56||0xcc;return function(_0x2b5966){if(_0x2b5966){return _0x4dcaf9['sendStatus'](_0x267b56);}return _0x4dcaf9[_0xeed9('0x18')](_0x267b56)[_0xeed9('0x19')]();};}function respondWithResult(_0x5b205c,_0x5e4baf){_0x5e4baf=_0x5e4baf||0xc8;return function(_0x4d3224){if(_0x4d3224){return _0x5b205c[_0xeed9('0x18')](_0x5e4baf)[_0xeed9('0x1a')](_0x4d3224);}};}function respondWithFilteredResult(_0x41e6bf,_0x28b483){return function(_0x1f7e27){if(_0x1f7e27){var _0x5ee5ae=typeof _0x28b483[_0xeed9('0x1b')]==='undefined'&&typeof _0x28b483[_0xeed9('0x1c')]===_0xeed9('0x1d');var _0x4b3db6=_0x1f7e27[_0xeed9('0x1e')];var _0x2887a7=_0x5ee5ae?0x0:_0x28b483[_0xeed9('0x1b')];var _0x3b623b=_0x5ee5ae?_0x1f7e27[_0xeed9('0x1e')]:_0x28b483[_0xeed9('0x1b')]+_0x28b483[_0xeed9('0x1c')];var _0x53c4e4;if(_0x3b623b>=_0x4b3db6){_0x3b623b=_0x4b3db6;_0x53c4e4=0xc8;}else{_0x53c4e4=0xce;}_0x41e6bf['status'](_0x53c4e4);return _0x41e6bf[_0xeed9('0x1f')](_0xeed9('0x20'),_0x2887a7+'-'+_0x3b623b+'/'+_0x4b3db6)[_0xeed9('0x1a')](_0x1f7e27);}return null;};}function patchUpdates(_0x5a49de){return function(_0x1713f5){try{jsonpatch[_0xeed9('0x21')](_0x1713f5,_0x5a49de,!![]);}catch(_0x107d5e){return BPromise['reject'](_0x107d5e);}return _0x1713f5[_0xeed9('0x22')]();};}function saveUpdates(_0x209426,_0x30b56e){return function(_0x49fd35){if(_0x49fd35){return _0x49fd35[_0xeed9('0x23')](_0x209426)[_0xeed9('0x24')](function(_0x4f7f27){return _0x4f7f27;});}return null;};}function removeEntity(_0xe46346,_0x2dff0){return function(_0x5b6069){if(_0x5b6069){return _0x5b6069[_0xeed9('0x25')]()[_0xeed9('0x24')](function(){_0xe46346[_0xeed9('0x18')](0xcc)[_0xeed9('0x19')]();});}};}function handleEntityNotFound(_0x247d1a,_0xc40b1d){return function(_0xe40997){if(!_0xe40997){_0x247d1a[_0xeed9('0x26')](0x194);}return _0xe40997;};}function handleError(_0x50b074,_0x5435e1){_0x5435e1=_0x5435e1||0x1f4;return function(_0x43fed1){logger[_0xeed9('0x27')](_0x43fed1[_0xeed9('0x28')]);if(_0x43fed1[_0xeed9('0x29')]){delete _0x43fed1[_0xeed9('0x29')];}_0x50b074['status'](_0x5435e1)[_0xeed9('0x2a')](_0x43fed1);};}exports[_0xeed9('0x2b')]=function(_0x3dcc33,_0x2b0dec){var _0x113358={},_0x4ad7ce={},_0x3746aa={'count':0x0,'rows':[]};var _0x27cc14=_[_0xeed9('0x2c')](db['Attachment'][_0xeed9('0x2d')],function(_0x4f9fec){return{'name':_0x4f9fec[_0xeed9('0x2e')],'type':_0x4f9fec['type'][_0xeed9('0x2f')]};});_0x4ad7ce[_0xeed9('0x30')]=_['map'](_0x27cc14,'name');_0x4ad7ce[_0xeed9('0x31')]=_[_0xeed9('0x32')](_0x3dcc33[_0xeed9('0x31')]);_0x4ad7ce[_0xeed9('0x33')]=_['intersection'](_0x4ad7ce[_0xeed9('0x30')],_0x4ad7ce[_0xeed9('0x31')]);_0x113358[_0xeed9('0x34')]=_[_0xeed9('0x35')](_0x4ad7ce[_0xeed9('0x30')],qs['fields'](_0x3dcc33[_0xeed9('0x31')][_0xeed9('0x36')]));_0x113358[_0xeed9('0x34')]=_0x113358[_0xeed9('0x34')]['length']?_0x113358['attributes']:_0x4ad7ce[_0xeed9('0x30')];if(!_0x3dcc33[_0xeed9('0x31')]['hasOwnProperty']('nolimit')){_0x113358['limit']=qs[_0xeed9('0x1c')](_0x3dcc33[_0xeed9('0x31')][_0xeed9('0x1c')]);_0x113358['offset']=qs[_0xeed9('0x1b')](_0x3dcc33['query'][_0xeed9('0x1b')]);}_0x113358[_0xeed9('0x37')]=qs[_0xeed9('0x38')](_0x3dcc33[_0xeed9('0x31')]['sort']);_0x113358['where']=qs[_0xeed9('0x33')](_[_0xeed9('0x39')](_0x3dcc33['query'],_0x4ad7ce['filters']),_0x27cc14);if(_0x3dcc33[_0xeed9('0x31')][_0xeed9('0x3a')]){_0x113358[_0xeed9('0x3b')]=_[_0xeed9('0x3c')](_0x113358[_0xeed9('0x3b')],{'$or':_[_0xeed9('0x2c')](_0x27cc14,function(_0xa8a1b7){if(_0xa8a1b7['type']!==_0xeed9('0x3d')){var _0x5efa6f={};_0x5efa6f[_0xa8a1b7[_0xeed9('0x29')]]={'$like':'%'+_0x3dcc33[_0xeed9('0x31')][_0xeed9('0x3a')]+'%'};return _0x5efa6f;}})});}_0x113358=_[_0xeed9('0x3c')]({},_0x113358,_0x3dcc33['options']);var _0x39294c={'where':_0x113358[_0xeed9('0x3b')]};return db['Attachment'][_0xeed9('0x1e')](_0x39294c)[_0xeed9('0x24')](function(_0x8880a8){_0x3746aa['count']=_0x8880a8;if(_0x3dcc33['query'][_0xeed9('0x3e')]){_0x113358['include']=[{'all':!![]}];}return db[_0xeed9('0x3f')][_0xeed9('0x40')](_0x113358);})[_0xeed9('0x24')](function(_0x3c73c5){_0x3746aa[_0xeed9('0x41')]=_0x3c73c5;return _0x3746aa;})[_0xeed9('0x24')](respondWithFilteredResult(_0x2b0dec,_0x113358))[_0xeed9('0x42')](handleError(_0x2b0dec,null));};exports[_0xeed9('0x43')]=function(_0x1467c3,_0x178bf2){var _0x1ad890={'raw':!![],'where':{'id':_0x1467c3['params']['id']}},_0x4f7f95={};_0x4f7f95['model']=_['keys'](db['Attachment'][_0xeed9('0x2d')]);_0x4f7f95[_0xeed9('0x31')]=_[_0xeed9('0x32')](_0x1467c3[_0xeed9('0x31')]);_0x4f7f95[_0xeed9('0x33')]=_[_0xeed9('0x35')](_0x4f7f95[_0xeed9('0x30')],_0x4f7f95['query']);_0x1ad890[_0xeed9('0x34')]=_[_0xeed9('0x35')](_0x4f7f95[_0xeed9('0x30')],qs[_0xeed9('0x36')](_0x1467c3[_0xeed9('0x31')][_0xeed9('0x36')]));_0x1ad890[_0xeed9('0x34')]=_0x1ad890[_0xeed9('0x34')][_0xeed9('0x44')]?_0x1ad890[_0xeed9('0x34')]:_0x4f7f95['model'];if(_0x1467c3[_0xeed9('0x31')]['includeAll']){_0x1ad890[_0xeed9('0x45')]=[{'all':!![]}];}_0x1ad890=_[_0xeed9('0x3c')]({},_0x1ad890,_0x1467c3[_0xeed9('0x46')]);return db[_0xeed9('0x3f')]['find'](_0x1ad890)[_0xeed9('0x24')](handleEntityNotFound(_0x178bf2,null))[_0xeed9('0x24')](respondWithResult(_0x178bf2,null))['catch'](handleError(_0x178bf2,null));};exports['clone']=function(_0x3f3584,_0x4a229f){var _0x2dbd59={'where':{'id':_0x3f3584[_0xeed9('0x47')]['id']}},_0x478502={};_0x478502[_0xeed9('0x30')]=_[_0xeed9('0x32')](db[_0xeed9('0x3f')][_0xeed9('0x2d')]);_0x2dbd59[_0xeed9('0x34')]=_[_0xeed9('0x35')](_0x478502[_0xeed9('0x30')],qs['fields'](_0x3f3584[_0xeed9('0x31')]['fields']));_0x2dbd59[_0xeed9('0x34')]=_0x2dbd59['attributes'][_0xeed9('0x44')]?_0x2dbd59[_0xeed9('0x34')]:_0x478502[_0xeed9('0x30')];if(_0x3f3584[_0xeed9('0x31')]['includeAll']){_0x2dbd59['include']=[{'all':!![]}];}_0x2dbd59=_[_0xeed9('0x3c')]({},_0x2dbd59,_0x3f3584[_0xeed9('0x46')]);return db[_0xeed9('0x3f')]['find'](_0x2dbd59)[_0xeed9('0x24')](handleEntityNotFound(_0x4a229f,null))['then'](function(_0x3975e3){if(_0x3975e3){var _0x201ba8=_0x3975e3[_0xeed9('0x48')]({'plain':!![]});_0x201ba8=qs[_0xeed9('0x49')](_0x201ba8,['id','createdAt',_0xeed9('0x4a')]);_0x3f3584[_0xeed9('0x4b')]=_['omit'](_0x3f3584[_0xeed9('0x4b')],['id',_0xeed9('0x4c'),'updatedAt']);return db['Attachment'][_0xeed9('0x4d')](_[_0xeed9('0x3c')](_0x201ba8,_0x3f3584['body']),{'include':_0x3f3584[_0xeed9('0x31')][_0xeed9('0x3e')]?[{'all':!![]}]:undefined});}})[_0xeed9('0x24')](respondWithResult(_0x4a229f,0xc9))[_0xeed9('0x42')](handleError(_0x4a229f,null));};exports[_0xeed9('0x23')]=function(_0x5628bb,_0x32b3be){if(_0x5628bb['body']['id']){delete _0x5628bb[_0xeed9('0x4b')]['id'];}return db[_0xeed9('0x3f')][_0xeed9('0x4e')]({'where':{'id':_0x5628bb[_0xeed9('0x47')]['id']}})[_0xeed9('0x24')](handleEntityNotFound(_0x32b3be,null))['then'](saveUpdates(_0x5628bb[_0xeed9('0x4b')],null))[_0xeed9('0x24')](respondWithResult(_0x32b3be,null))[_0xeed9('0x42')](handleError(_0x32b3be,null));};exports[_0xeed9('0x25')]=function(_0x12f009,_0x2b0fe3){return db[_0xeed9('0x3f')]['find']({'where':{'id':_0x12f009[_0xeed9('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b0fe3,null))[_0xeed9('0x24')](removeEntity(_0x2b0fe3,null))[_0xeed9('0x42')](handleError(_0x2b0fe3,null));};exports['create']=function(_0x52836e,_0x57cf6d,_0x33f99a){_0x52836e[_0xeed9('0x4b')][_0xeed9('0x29')]=_0x52836e[_0xeed9('0x4f')][_0xeed9('0x50')];_0x52836e[_0xeed9('0x4b')][_0xeed9('0x51')]=_0x52836e['file'][_0xeed9('0x52')];_0x52836e[_0xeed9('0x4b')][_0xeed9('0x53')]=_0x52836e[_0xeed9('0x4f')][_0xeed9('0x54')];return db[_0xeed9('0x3f')][_0xeed9('0x4d')](_0x52836e[_0xeed9('0x4b')])[_0xeed9('0x24')](respondWithResult(_0x57cf6d,0xc9))['catch'](handleError(_0x57cf6d,null));};exports[_0xeed9('0x55')]=function(_0x2515a0,_0x195d3e,_0x1972d5){return db['Attachment'][_0xeed9('0x56')]({'where':{'id':_0x2515a0['params']['id']},'raw':!![]})[_0xeed9('0x24')](handleEntityNotFound(_0x195d3e,null))['then'](function(_0x4d1d4f){if(_0x4d1d4f){var _0x1fc151=_0x4d1d4f[_0xeed9('0x57')]!==null;var _0x4e24a1=path[_0xeed9('0x58')](config[_0xeed9('0x59')],_0xeed9('0x5a'));if(_0x1fc151){_0x4e24a1=path[_0xeed9('0x58')](_0x4e24a1,_0xeed9('0x5b'));}var _0xd454ee=path[_0xeed9('0x58')](_0x4e24a1,_0x4d1d4f['basename']);return _0x195d3e[_0xeed9('0x55')](_0xd454ee);}})[_0xeed9('0x42')](handleError(_0x195d3e,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 1956fb4..a8e7e84 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 _0x8c5d=['./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1268f3,_0x581d88){var _0x27789e=function(_0x5ec676){while(--_0x5ec676){_0x1268f3['push'](_0x1268f3['shift']());}};_0x27789e(++_0x581d88);}(_0x8c5d,0xad));var _0xd8c5=function(_0x14c945,_0x11d713){_0x14c945=_0x14c945-0x0;var _0x3ed9be=_0x8c5d[_0x14c945];return _0x3ed9be;};'use strict';var _=require(_0xd8c5('0x0'));var util=require(_0xd8c5('0x1'));var logger=require(_0xd8c5('0x2'))(_0xd8c5('0x3'));var moment=require(_0xd8c5('0x4'));var BPromise=require(_0xd8c5('0x5'));var rp=require(_0xd8c5('0x6'));var fs=require('fs');var path=require(_0xd8c5('0x7'));var rimraf=require(_0xd8c5('0x8'));var config=require('../../config/environment');var attributes=require(_0xd8c5('0x9'));module[_0xd8c5('0xa')]=function(_0x3811de,_0x5baa6d){return _0x3811de[_0xd8c5('0xb')](_0xd8c5('0xc'),attributes,{'tableName':_0xd8c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe022=['attachments','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','define','Attachment'];(function(_0x668d5b,_0x47e921){var _0x26b714=function(_0x50261a){while(--_0x50261a){_0x668d5b['push'](_0x668d5b['shift']());}};_0x26b714(++_0x47e921);}(_0xe022,0x6d));var _0x2e02=function(_0x4f6c83,_0x4cec92){_0x4f6c83=_0x4f6c83-0x0;var _0x33cb29=_0xe022[_0x4f6c83];return _0x33cb29;};'use strict';var _=require(_0x2e02('0x0'));var util=require('util');var logger=require(_0x2e02('0x1'))(_0x2e02('0x2'));var moment=require('moment');var BPromise=require(_0x2e02('0x3'));var rp=require(_0x2e02('0x4'));var fs=require('fs');var path=require(_0x2e02('0x5'));var rimraf=require('rimraf');var config=require(_0x2e02('0x6'));var attributes=require(_0x2e02('0x7'));module[_0x2e02('0x8')]=function(_0x2bb714,_0x4b2b70){return _0x2bb714[_0x2e02('0x9')](_0x2e02('0xa'),attributes,{'tableName':_0x2e02('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 b34f797..2c36d9d 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 _0xb377=['catch','CreateAttachment','Attachment','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4c94d1,_0x573a4f){var _0x48c2c3=function(_0x326bcc){while(--_0x326bcc){_0x4c94d1['push'](_0x4c94d1['shift']());}};_0x48c2c3(++_0x573a4f);}(_0xb377,0x1b6));var _0x7b37=function(_0x54986a,_0x1bbed2){_0x54986a=_0x54986a-0x0;var _0x4ac7d9=_0xb377[_0x54986a];return _0x4ac7d9;};'use strict';var _=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var moment=require(_0x7b37('0x2'));var BPromise=require(_0x7b37('0x3'));var rs=require(_0x7b37('0x4'));var fs=require('fs');var Redis=require(_0x7b37('0x5'));var db=require(_0x7b37('0x6'))['db'];var utils=require(_0x7b37('0x7'));var logger=require(_0x7b37('0x8'))(_0x7b37('0x9'));var config=require(_0x7b37('0xa'));var jayson=require(_0x7b37('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x409d34,_0x4cb89b,_0x5afdb8){return new BPromise(function(_0x3de992,_0x3df40f){return client[_0x7b37('0xc')](_0x409d34,_0x5afdb8)[_0x7b37('0xd')](function(_0x1d435b){logger[_0x7b37('0xe')](_0x7b37('0xf'),_0x4cb89b,_0x7b37('0x10'));logger['debug'](_0x7b37('0x11'),_0x4cb89b,_0x7b37('0x10'),JSON['stringify'](_0x1d435b));if(_0x1d435b['error']){if(_0x1d435b[_0x7b37('0x12')][_0x7b37('0x13')]===0x1f4){logger[_0x7b37('0x12')](_0x7b37('0xf'),_0x4cb89b,_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);return _0x3df40f(_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);}logger[_0x7b37('0x12')](_0x7b37('0xf'),_0x4cb89b,_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);return _0x3de992(_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);}else{logger[_0x7b37('0xe')](_0x7b37('0xf'),_0x4cb89b,_0x7b37('0x10'));_0x3de992(_0x1d435b['result']['message']);}})[_0x7b37('0x15')](function(_0x5b06f9){logger['error'](_0x7b37('0xf'),_0x4cb89b,_0x5b06f9);_0x3df40f(_0x5b06f9);});});}exports[_0x7b37('0x16')]=function(_0x1447aa){var _0x487f5c=this;return new Promise(function(_0x29a9dd,_0x46955a){return db[_0x7b37('0x17')]['create'](_0x1447aa['body'],{'raw':_0x1447aa[_0x7b37('0x18')]?_0x1447aa[_0x7b37('0x18')][_0x7b37('0x19')]===undefined?!![]:![]:!![]})[_0x7b37('0xd')](function(_0x30bf66){logger['info']('CreateAttachment',_0x1447aa);logger['debug'](_0x7b37('0x16'),_0x1447aa,JSON[_0x7b37('0x1a')](_0x30bf66));_0x29a9dd(_0x30bf66);})[_0x7b37('0x15')](function(_0x200f17){logger[_0x7b37('0x12')](_0x7b37('0x16'),_0x200f17[_0x7b37('0x14')],_0x1447aa);_0x46955a(_0x487f5c['error'](0x1f4,_0x200f17[_0x7b37('0x14')]));});});}; \ No newline at end of file +var _0xe13a=['request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateAttachment','Attachment','body','options','raw','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x119260,_0x565904){var _0x341137=function(_0x488905){while(--_0x488905){_0x119260['push'](_0x119260['shift']());}};_0x341137(++_0x565904);}(_0xe13a,0x178));var _0xae13=function(_0x59c7f3,_0x4f5e95){_0x59c7f3=_0x59c7f3-0x0;var _0x2c6aa0=_0xe13a[_0x59c7f3];return _0x2c6aa0;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var BPromise=require(_0xae13('0x2'));var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae13('0x4'))['db'];var utils=require(_0xae13('0x5'));var logger=require(_0xae13('0x6'))(_0xae13('0x7'));var config=require(_0xae13('0x8'));var jayson=require(_0xae13('0x9'));var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341ba4,_0x4ae51f,_0x2f6d10){return new BPromise(function(_0x2b2e1f,_0x27fefd){return client[_0xae13('0xc')](_0x341ba4,_0x2f6d10)[_0xae13('0xd')](function(_0x41bf44){logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));logger['debug'](_0xae13('0x11'),_0x4ae51f,_0xae13('0x10'),JSON[_0xae13('0x12')](_0x41bf44));if(_0x41bf44[_0xae13('0x13')]){if(_0x41bf44[_0xae13('0x13')][_0xae13('0x14')]===0x1f4){logger[_0xae13('0x13')]('Attachment,\x20%s,\x20%s',_0x4ae51f,_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);return _0x27fefd(_0x41bf44['error']['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x4ae51f,_0x41bf44['error'][_0xae13('0x15')]);return _0x2b2e1f(_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);}else{logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));_0x2b2e1f(_0x41bf44['result'][_0xae13('0x15')]);}})['catch'](function(_0xe10aab){logger[_0xae13('0x13')](_0xae13('0xf'),_0x4ae51f,_0xe10aab);_0x27fefd(_0xe10aab);});});}exports[_0xae13('0x16')]=function(_0x1a9c07){var _0x1b33b7=this;return new Promise(function(_0x32dcbe,_0x326471){return db[_0xae13('0x17')]['create'](_0x1a9c07[_0xae13('0x18')],{'raw':_0x1a9c07['options']?_0x1a9c07[_0xae13('0x19')][_0xae13('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x25a195){logger[_0xae13('0xe')](_0xae13('0x16'),_0x1a9c07);logger[_0xae13('0x1b')](_0xae13('0x16'),_0x1a9c07,JSON[_0xae13('0x12')](_0x25a195));_0x32dcbe(_0x25a195);})['catch'](function(_0x520692){logger[_0xae13('0x13')](_0xae13('0x16'),_0x520692['message'],_0x1a9c07);_0x326471(_0x1b33b7[_0xae13('0x13')](0x1f4,_0x520692['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3299c91..aeb59f0 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5dc97b,_0x511ec5){var _0xb3c53d=function(_0x1b9c64){while(--_0x1b9c64){_0x5dc97b['push'](_0x5dc97b['shift']());}};_0xb3c53d(++_0x511ec5);}(_0x2032,0xd9));var _0x2203=function(_0x35e3e7,_0x39f60a){_0x35e3e7=_0x35e3e7-0x0;var _0x4bc020=_0x2032[_0x35e3e7];return _0x4bc020;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x3b708e,_0x35fbbc){var _0x268e60=function(_0x240369){while(--_0x240369){_0x3b708e['push'](_0x3b708e['shift']());}};_0x268e60(++_0x35fbbc);}(_0xb10b,0x12a));var _0xbb10=function(_0x521e8d,_0x23a290){_0x521e8d=_0x521e8d-0x0;var _0x518bbd=_0xb10b[_0x521e8d];return _0x518bbd;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 9cd4d98..b2d3111 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 _0x5b47=['util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','blockedAt','online','admin','agent','name','clearBlockUser','getLicense','catch','status','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','User','passport','passport-local','activedirectory2','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b47,0x11c));var _0x75b4=function(_0xcfff55,_0x38cf58){_0xcfff55=_0xcfff55-0x0;var _0x4513f6=_0x5b47[_0xcfff55];return _0x4513f6;};'use strict';var passport=require(_0x75b4('0x0'));var LocalStrategy=require(_0x75b4('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0x75b4('0x2'));var BPromise=require(_0x75b4('0x3'));var util=require(_0x75b4('0x4'));var db=require(_0x75b4('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x75b4('0x6'));var config=require(_0x75b4('0x7'));var logger=require(_0x75b4('0x8'))(_0x75b4('0x9'));function isActiveDirectoryConfigured(_0x3f0cc9){var _0x4ecc87=![];if(typeof _0x3f0cc9['activedirectory']!==_0x75b4('0xa')){_0x4ecc87=_0x3f0cc9[_0x75b4('0xb')][_0x75b4('0xc')]&&_0x3f0cc9['activedirectory'][_0x75b4('0xd')]&&_0x3f0cc9[_0x75b4('0xb')][_0x75b4('0xe')];}return _0x4ecc87;}function adAuthenticate(_0x306bb7,_0x28a122,_0x26dbef){return new BPromise(function(_0x7a0784,_0x3f9944){try{var _0x1cb5bb=new ActiveDirectory(_0x306bb7);_0x1cb5bb['authenticate'](_0x28a122,_0x26dbef,function(_0x379e05,_0x4a7ca2){if(_0x379e05){logger[_0x75b4('0xf')](_0x75b4('0x10'),_0x28a122,util[_0x75b4('0x11')](_0x379e05,{'showHidden':![],'depth':null}));_0x3f9944(_0x75b4('0x12'));}else if(!_0x4a7ca2){logger[_0x75b4('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x28a122);_0x3f9944(_0x75b4('0x12'));}else{_0x7a0784(_0x4a7ca2);}});}catch(_0x655eef){_0x3f9944(_0x655eef);}});}function ActiveDirectoryAuthenticate(_0x4a3c44,_0x401fb4,_0x3c0673,_0x116bc4){var _0x3d373a,_0x27617d;if(!isActiveDirectoryConfigured(config)){logger[_0x75b4('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x401fb4);return _0x116bc4(null,![],{'message':_0x75b4('0x12')});}return db[_0x75b4('0x13')][_0x75b4('0x14')]({'where':{'id':0x1},'attributes':[_0x75b4('0x15'),_0x75b4('0x16')],'raw':!![]})[_0x75b4('0x17')](function(_0x43213b){_0x3d373a=_0x43213b;if(!_0x3d373a[_0x75b4('0x15')]){logger[_0x75b4('0xf')](_0x75b4('0x18'),_0x401fb4);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x4a3c44[_0x75b4('0x14')]({'attributes':['id','name',_0x75b4('0x19'),_0x75b4('0x1a'),_0x75b4('0x1b'),_0x75b4('0x1c'),_0x75b4('0x1d'),_0x75b4('0x1e'),_0x75b4('0x1f')],'where':{'name':_0x401fb4,'role':{'$or':[_0x75b4('0x20'),'user',_0x75b4('0x21')]},'adSsoEnabled':!![]}});})[_0x75b4('0x17')](function(_0x44e223){if(!_0x44e223||_0x44e223&&_0x44e223[_0x75b4('0x22')]!==_0x401fb4){throw new Error(_0x75b4('0x12'));}_0x27617d=_0x44e223;var _0x2bba8f=_0x27617d[_0x75b4('0x22')]+'@'+config['activedirectory'][_0x75b4('0xe')];return adAuthenticate(config[_0x75b4('0xb')],_0x2bba8f,_0x3c0673);})[_0x75b4('0x17')](function(_0x3e9194){if(_0x27617d[_0x75b4('0x1c')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x3d373a['blockDuration']>0x0){if(_0x27617d[_0x75b4('0x1d')]){if(moment(_0x27617d[_0x75b4('0x1e')])['add'](_0x3d373a[_0x75b4('0x16')],'minutes')>moment()){throw new Error(_0x75b4('0x12'));}return utils[_0x75b4('0x23')](_0x27617d,0x0,![],null)[_0x75b4('0x17')](function(){return utils[_0x75b4('0x24')](_0x27617d);})[_0x75b4('0x17')](function(){return _0x116bc4(null,_0x27617d);});}else{return utils[_0x75b4('0x24')](_0x27617d)[_0x75b4('0x17')](function(){return _0x116bc4(null,_0x27617d);});}}else{return utils['getLicense'](_0x27617d)['then'](function(){return _0x116bc4(null,_0x27617d);});}})[_0x75b4('0x25')](function(_0x509a9e){return _0x116bc4(null,![],_0x509a9e);});}function handleError(_0x26f831,_0x54880b,_0x10c47e){return _0x26f831[_0x75b4('0x26')](_0x54880b||0x1f4)[_0x75b4('0x27')]({'message':_0x10c47e?_0x10c47e[_0x75b4('0x28')]||_0x10c47e:''});}exports[_0x75b4('0x29')]=function(_0x90b082,_0x17bd95,_0x5a5f24){passport[_0x75b4('0x2a')](_0x75b4('0x2b'),function(_0x22db87,_0x235a8e,_0x13e253){var _0x53681f=_0x22db87||_0x13e253;if(_0x53681f){return handleError(_0x17bd95,0x191,_0x53681f);}if(!_0x235a8e){return handleError(_0x17bd95,0x194,{'message':_0x75b4('0x2c')});}else{var _0x22b3d9={'payload':{'id':_0x235a8e['id'],'role':_0x235a8e[_0x75b4('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x75b4('0x2d')](_0x22b3d9)['then'](function(_0x156708){_0x17bd95['json']({'id':_0x235a8e['id'],'token':_0x156708,'statusCall':'','isAlreadyLogged':_0x235a8e[_0x75b4('0x1f')]});});}})(_0x90b082,_0x17bd95,_0x5a5f24);};passport[_0x75b4('0x2e')](_0x75b4('0x2b'),new LocalStrategy({'usernameField':_0x75b4('0x22'),'passwordField':_0x75b4('0x19')},function(_0x299063,_0x2989c6,_0x356177){return ActiveDirectoryAuthenticate(db[_0x75b4('0x2f')],_0x299063,_0x2989c6,_0x356177);})); \ No newline at end of file +var _0x98d8=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','minutes','getLicense','catch','send','message','login','signToken','use','ad-login','passport','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','adSsoEnabled','blockDuration','then'];(function(_0x1f223b,_0x2c8afd){var _0x2ed524=function(_0x3b527d){while(--_0x3b527d){_0x1f223b['push'](_0x1f223b['shift']());}};_0x2ed524(++_0x2c8afd);}(_0x98d8,0xcd));var _0x898d=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0x98d8[_0x2a453b];return _0x132f79;};'use strict';var passport=require(_0x898d('0x0'));var LocalStrategy=require('passport-local')[_0x898d('0x1')];var moment=require(_0x898d('0x2'));var ActiveDirectory=require(_0x898d('0x3'));var BPromise=require(_0x898d('0x4'));var util=require('util');var db=require(_0x898d('0x5'))['db'];var authService=require(_0x898d('0x6'));var utils=require('../../config/utils');var config=require(_0x898d('0x7'));var logger=require(_0x898d('0x8'))(_0x898d('0x9'));function isActiveDirectoryConfigured(_0x474b36){var _0xc7814c=![];if(typeof _0x474b36[_0x898d('0xa')]!==_0x898d('0xb')){_0xc7814c=_0x474b36[_0x898d('0xa')][_0x898d('0xc')]&&_0x474b36[_0x898d('0xa')][_0x898d('0xd')]&&_0x474b36[_0x898d('0xa')][_0x898d('0xe')];}return _0xc7814c;}function adAuthenticate(_0xd4a544,_0xe201f9,_0x4615f9){return new BPromise(function(_0x195422,_0x49970b){try{var _0x24abbd=new ActiveDirectory(_0xd4a544);_0x24abbd[_0x898d('0xf')](_0xe201f9,_0x4615f9,function(_0x2adebb,_0xfd905){if(_0x2adebb){logger[_0x898d('0x10')](_0x898d('0x11'),_0xe201f9,util[_0x898d('0x12')](_0x2adebb,{'showHidden':![],'depth':null}));_0x49970b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0xfd905){logger[_0x898d('0x10')](_0x898d('0x13'),_0xe201f9);_0x49970b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x195422(_0xfd905);}});}catch(_0x5e2b6b){_0x49970b(_0x5e2b6b);}});}function ActiveDirectoryAuthenticate(_0xeb81f0,_0x436d27,_0x5d17ea,_0x2a7e2f){var _0x162e8f,_0x1d92c2;if(!isActiveDirectoryConfigured(config)){logger[_0x898d('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x436d27);return _0x2a7e2f(null,![],{'message':_0x898d('0x14')});}return db[_0x898d('0x15')]['findOne']({'where':{'id':0x1},'attributes':[_0x898d('0x16'),_0x898d('0x17')],'raw':!![]})[_0x898d('0x18')](function(_0x192de9){_0x162e8f=_0x192de9;if(!_0x162e8f[_0x898d('0x16')]){logger['error'](_0x898d('0x19'),_0x436d27);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0xeb81f0[_0x898d('0x1a')]({'attributes':['id',_0x898d('0x1b'),_0x898d('0x1c'),_0x898d('0x1d'),_0x898d('0x1e'),_0x898d('0x1f'),_0x898d('0x20'),_0x898d('0x21'),_0x898d('0x22')],'where':{'name':_0x436d27,'role':{'$or':[_0x898d('0x23'),_0x898d('0x24'),'agent']},'adSsoEnabled':!![]}});})[_0x898d('0x18')](function(_0x2ce81a){if(!_0x2ce81a||_0x2ce81a&&_0x2ce81a[_0x898d('0x1b')]!==_0x436d27){throw new Error(_0x898d('0x14'));}_0x1d92c2=_0x2ce81a;var _0x17d1eb=_0x1d92c2[_0x898d('0x1b')]+'@'+config['activedirectory'][_0x898d('0xe')];return adAuthenticate(config['activedirectory'],_0x17d1eb,_0x5d17ea);})[_0x898d('0x18')](function(_0x48181a){if(_0x1d92c2[_0x898d('0x1f')]){throw new Error(_0x898d('0x14'));}if(_0x162e8f[_0x898d('0x17')]>0x0){if(_0x1d92c2[_0x898d('0x20')]){if(moment(_0x1d92c2[_0x898d('0x21')])['add'](_0x162e8f[_0x898d('0x17')],_0x898d('0x25'))>moment()){throw new Error(_0x898d('0x14'));}return utils['clearBlockUser'](_0x1d92c2,0x0,![],null)['then'](function(){return utils[_0x898d('0x26')](_0x1d92c2);})[_0x898d('0x18')](function(){return _0x2a7e2f(null,_0x1d92c2);});}else{return utils[_0x898d('0x26')](_0x1d92c2)['then'](function(){return _0x2a7e2f(null,_0x1d92c2);});}}else{return utils[_0x898d('0x26')](_0x1d92c2)[_0x898d('0x18')](function(){return _0x2a7e2f(null,_0x1d92c2);});}})[_0x898d('0x27')](function(_0x43a5b3){return _0x2a7e2f(null,![],_0x43a5b3);});}function handleError(_0x53f2e5,_0x4bf267,_0x1fdb06){return _0x53f2e5['status'](_0x4bf267||0x1f4)[_0x898d('0x28')]({'message':_0x1fdb06?_0x1fdb06[_0x898d('0x29')]||_0x1fdb06:''});}exports[_0x898d('0x2a')]=function(_0x4e09b4,_0x1b1be5,_0x4c91dd){passport[_0x898d('0xf')]('ad-login',function(_0x55dae8,_0x45d2e3,_0x376530){var _0x4ca995=_0x55dae8||_0x376530;if(_0x4ca995){return handleError(_0x1b1be5,0x191,_0x4ca995);}if(!_0x45d2e3){return handleError(_0x1b1be5,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3a0ac5={'payload':{'id':_0x45d2e3['id'],'role':_0x45d2e3[_0x898d('0x1e')]},'options':{'expiresIn':0x15180}};return authService[_0x898d('0x2b')](_0x3a0ac5)[_0x898d('0x18')](function(_0x324f46){_0x1b1be5['json']({'id':_0x45d2e3['id'],'token':_0x324f46,'statusCall':'','isAlreadyLogged':_0x45d2e3['online']});});}})(_0x4e09b4,_0x1b1be5,_0x4c91dd);};passport[_0x898d('0x2c')](_0x898d('0x2d'),new LocalStrategy({'usernameField':_0x898d('0x1b'),'passwordField':_0x898d('0x1c')},function(_0x54b2f9,_0x3e6348,_0x26c605){return ActiveDirectoryAuthenticate(db['User'],_0x54b2f9,_0x3e6348,_0x26c605);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 9512d87..1b890dc 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 _0xed14=['express','post','login'];(function(_0x4622c0,_0xd0eeec){var _0x23d32b=function(_0x539eae){while(--_0x539eae){_0x4622c0['push'](_0x4622c0['shift']());}};_0x23d32b(++_0xd0eeec);}(_0xed14,0x1e6));var _0x4ed1=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xed14[_0x2dadb9];return _0x2f0097;};'use strict';var express=require(_0x4ed1('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router[_0x4ed1('0x1')]('/',controller[_0x4ed1('0x2')]);module['exports']=router; \ No newline at end of file +var _0x2c27=['./authActiveDirectory.controller','post','login','exports','Router'];(function(_0x33e5d1,_0x55e417){var _0x418fe0=function(_0x4ce8b8){while(--_0x4ce8b8){_0x33e5d1['push'](_0x33e5d1['shift']());}};_0x418fe0(++_0x55e417);}(_0x2c27,0x117));var _0x72c2=function(_0x6af9c4,_0x3ac976){_0x6af9c4=_0x6af9c4-0x0;var _0x573dce=_0x2c27[_0x6af9c4];return _0x573dce;};'use strict';var express=require('express');var router=express[_0x72c2('0x0')]();var controller=require(_0x72c2('0x1'));router[_0x72c2('0x2')]('/',controller[_0x72c2('0x3')]);module[_0x72c2('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 f2969ac..699628e 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(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x7a54,0x106));var _0x47a5=function(_0x14acc9,_0x186477){_0x14acc9=_0x14acc9-0x0;var _0x3b2efb=_0x7a54[_0x14acc9];return _0x3b2efb;};'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 _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x902e0b,_0x1aa5fa){var _0x9696a8=function(_0x3abe1d){while(--_0x3abe1d){_0x902e0b['push'](_0x902e0b['shift']());}};_0x9696a8(++_0x1aa5fa);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 6b2c71c..4e5afd3 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 _0x6214=['isMiddleware','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback'];(function(_0x1584a1,_0x34371a){var _0x14fb5e=function(_0x2c9ce3){while(--_0x2c9ce3){_0x1584a1['push'](_0x1584a1['shift']());}};_0x14fb5e(++_0x34371a);}(_0x6214,0xda));var _0x4621=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x6214[_0x45bf86];return _0x1f02b7;};'use strict';var express=require(_0x4621('0x0'));var passport=require(_0x4621('0x1'));var router=express[_0x4621('0x2')]();var controller=require(_0x4621('0x3'));var userController=require(_0x4621('0x4'));var authService=require(_0x4621('0x5'));router['get']('/',controller[_0x4621('0x6')]);router[_0x4621('0x7')](_0x4621('0x8'),controller[_0x4621('0x9')],authService[_0x4621('0xa')],userController[_0x4621('0x6')],authService[_0x4621('0xb')]);module['exports']=router; \ No newline at end of file +var _0xe78c=['setTokenCookie','exports','passport','../user/user.controller.js','get','login'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xe78c,0xaa));var _0xce78=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe78c[_0x57b54c];return _0x59cc19;};'use strict';var express=require('express');var passport=require(_0xce78('0x0'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0xce78('0x1'));var authService=require('../../components/auth/service');router[_0xce78('0x2')]('/',controller[_0xce78('0x3')]);router['get']('/callback',controller['callback'],authService['isMiddleware'],userController[_0xce78('0x3')],authService[_0xce78('0x4')]);module[_0xce78('0x5')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index deb68be..bb5ede4 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 _0x9860=['The\x20user\x20is\x20blocked.\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','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','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordExpires','save','Password\x20reset!','util','passport','passport-local','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','password','salt','disabled','blocked','loginAttempts','admin','user','then','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','message','status','send','login','local-login','role','signToken','online','forgot','body','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x2ce307,_0x26f21d){var _0x54cda2=function(_0x382935){while(--_0x382935){_0x2ce307['push'](_0x2ce307['shift']());}};_0x54cda2(++_0x26f21d);}(_0x9860,0x117));var _0x0986=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9860[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x0986('0x0'));var passport=require(_0x0986('0x1'));var LocalStrategy=require(_0x0986('0x2'))['Strategy'];var jayson=require(_0x0986('0x3'));var _=require('lodash');var rs=require(_0x0986('0x4'));var moment=require(_0x0986('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x0986('0x6'));var utils=require(_0x0986('0x7'));var client=jayson[_0x0986('0x8')][_0x0986('0x9')]({'port':0x232b});function localAuthenticate(_0x1de4f4,_0x3fe208,_0x1ccd41,_0x487407){var _0x3b7e9f,_0xda0ee7;return db['Setting'][_0x0986('0xa')]({'where':{'id':0x1},'attributes':[_0x0986('0xb'),_0x0986('0xc')],'raw':!![]})['then'](function(_0x4c3d13){_0x3b7e9f=_0x4c3d13;return _0x1de4f4['findOne']({'attributes':['id','name',_0x0986('0xd'),_0x0986('0xe'),'role',_0x0986('0xf'),_0x0986('0x10'),'blockedAt',_0x0986('0x11')],'where':{'name':_0x3fe208,'role':{'$or':[_0x0986('0x12'),_0x0986('0x13'),'agent']}}});})[_0x0986('0x14')](function(_0x118ff2){if(!_0x118ff2||_0x118ff2&&_0x118ff2[_0x0986('0x15')]!==_0x3fe208){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xda0ee7=_0x118ff2;return _0xda0ee7;}})[_0x0986('0x14')](function(){_0xda0ee7[_0x0986('0x16')](_0x1ccd41,function(_0x2c9f75,_0x37f77c){var _0x5e6ecf=_0xda0ee7[_0x0986('0x11')]+0x1;if(_0x2c9f75){return _0x487407(_0x2c9f75);}else if(!_0x37f77c){if(_0xda0ee7['disabled']){return _0x487407(null,![],{'message':_0x0986('0x17')});}else if(_0x3b7e9f[_0x0986('0xb')]>0x0){if(_0xda0ee7[_0x0986('0x10')]){if(_0x3b7e9f[_0x0986('0xc')]>0x0){if(moment(_0xda0ee7[_0x0986('0x18')])[_0x0986('0x19')](_0x3b7e9f['blockDuration'],_0x0986('0x1a'))>moment()){return _0x487407(null,![],{'message':_0x0986('0x17')});}else{return utils[_0x0986('0x1b')](_0xda0ee7,_0x5e6ecf,![],null)[_0x0986('0x14')](function(){return _0x487407(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x487407(null,![],{'message':_0x0986('0x17')});}}else{if(_0x5e6ecf>=_0x3b7e9f[_0x0986('0xb')]){return utils[_0x0986('0x1b')](_0xda0ee7,0x0,!![],moment())[_0x0986('0x14')](function(){return _0x487407(null,![],{'message':_0x0986('0x17')});});}else{return utils['clearBlockUser'](_0xda0ee7,_0x5e6ecf,![],null)[_0x0986('0x14')](function(){return _0x487407(null,![],{'message':_0x0986('0x17')});});}}}else{return _0x487407(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xda0ee7[_0x0986('0xf')]){return _0x487407(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3b7e9f[_0x0986('0xb')]>0x0){if(_0xda0ee7[_0x0986('0x10')]){if(_0x3b7e9f[_0x0986('0xc')]>0x0){if(moment(_0xda0ee7[_0x0986('0x18')])['add'](_0x3b7e9f[_0x0986('0xc')],'minutes')>moment()){return _0x487407(null,![],{'message':_0x0986('0x17')});}else{return utils[_0x0986('0x1b')](_0xda0ee7,0x0,![],null)[_0x0986('0x14')](function(){return utils[_0x0986('0x1c')](_0xda0ee7);})['then'](function(){return _0x487407(null,_0xda0ee7);});}}else{return _0x487407(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x0986('0x1b')](_0xda0ee7,0x0,![],null)['then'](function(){return utils['getLicense'](_0xda0ee7);})['then'](function(){return _0x487407(null,_0xda0ee7);})[_0x0986('0x1d')](function(_0x2dae62){return _0x487407(null,![],_0x2dae62);});}}else{if(_0xda0ee7[_0x0986('0x10')]){return _0x487407(null,![],{'message':_0x0986('0x17')});}else{return utils[_0x0986('0x1c')](_0xda0ee7)[_0x0986('0x14')](function(){return _0x487407(null,_0xda0ee7);});}}}});})['catch'](function(_0x547991){return _0x487407(null,![],_0x547991);});}function sendServiceMail(_0x1c6d2e){return db[_0x0986('0x1e')][_0x0986('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0x0986('0x20')],'include':[{'model':db[_0x0986('0x21')],'as':_0x0986('0x22'),'include':[{'model':db[_0x0986('0x23')],'as':'CloudProvider'}]}]})['then'](function(_0x584563){if(!_0x584563){throw new Error(_0x0986('0x24'));}var _0x57ab3c=_0x584563[_0x0986('0x25')]();var _0x51a59b={'account':_0x57ab3c,'message':_[_0x0986('0x26')]({'from':util['format'](_0x0986('0x27'),_0x584563[_0x0986('0x15')],_0x584563[_0x0986('0x20')]||_0x584563[_0x0986('0x22')][_0x0986('0x13')])},_0x1c6d2e)};return client[_0x0986('0x28')](_0x0986('0x29'),_0x51a59b);})[_0x0986('0x14')](function(_0x2aa445){if(_0x2aa445[_0x0986('0x2a')]){throw new Error(util[_0x0986('0x2b')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x2aa445['error'][_0x0986('0x2c')]||JSON['stringify'](_0x2aa445[_0x0986('0x2a')])));}return!![];});}function handleError(_0x444df9,_0x160751,_0x43644e){return _0x444df9[_0x0986('0x2d')](_0x160751||0x1f4)[_0x0986('0x2e')]({'message':_0x43644e?_0x43644e[_0x0986('0x2c')]||_0x43644e:''});}exports[_0x0986('0x2f')]=function(_0xb48c46,_0x5d3d5d,_0x49fe25){passport[_0x0986('0x16')](_0x0986('0x30'),function(_0x4e18c0,_0x58b3d9,_0x543e27){var _0x31fd56=_0x4e18c0||_0x543e27;if(_0x31fd56){return handleError(_0x5d3d5d,0x191,_0x31fd56);}if(!_0x58b3d9){return handleError(_0x5d3d5d,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x32ee69={'payload':{'id':_0x58b3d9['id'],'role':_0x58b3d9[_0x0986('0x31')]},'options':{'expiresIn':0x15180}};return authService[_0x0986('0x32')](_0x32ee69)[_0x0986('0x14')](function(_0x321965){_0x5d3d5d['json']({'id':_0x58b3d9['id'],'token':_0x321965,'statusCall':'','isAlreadyLogged':_0x58b3d9[_0x0986('0x33')]});});}})(_0xb48c46,_0x5d3d5d,_0x49fe25);};exports[_0x0986('0x34')]=function(_0x52cd5c,_0x3e2b15){if(!_0x52cd5c[_0x0986('0x35')][_0x0986('0x20')]){return handleError(_0x3e2b15,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x186a97=rs[_0x0986('0x36')]();_0x52cd5c[_0x0986('0x35')]['email']=_0x52cd5c['body']['email'][_0x0986('0x37')]()[_0x0986('0x38')]();var _0x20bf1b;return db[_0x0986('0x39')][_0x0986('0xa')]({'where':{'id':0x1},'attributes':[_0x0986('0xb'),_0x0986('0xc')],'raw':!![]})[_0x0986('0x14')](function(_0x29a259){_0x20bf1b=_0x29a259;return db[_0x0986('0x3a')][_0x0986('0x1f')]({'where':{'email':_0x52cd5c[_0x0986('0x35')]['email']}});})[_0x0986('0x14')](function(_0x2b5db3){if(!_0x2b5db3){throw new Error(_0x0986('0x3b'));}if(_0x2b5db3[_0x0986('0xf')]){throw new Error(_0x0986('0x3c'));}if(_0x2b5db3[_0x0986('0x10')]){if(moment(_0x2b5db3['blockedAt'])[_0x0986('0x19')](_0x20bf1b[_0x0986('0xc')],_0x0986('0x1a'))>moment()){throw new Error(_0x0986('0x3d'));}else{_0x2b5db3['blocked']=![];_0x2b5db3[_0x0986('0x18')]=null;}}_0x2b5db3[_0x0986('0x3e')]=_0x186a97;_0x2b5db3['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x2b5db3['save']();})[_0x0986('0x14')](function(){return sendServiceMail({'to':_0x52cd5c[_0x0986('0x35')][_0x0986('0x20')],'subject':_0x0986('0x3f'),'text':_0x0986('0x40')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x0986('0x41')+_0x52cd5c[_0x0986('0x42')][_0x0986('0x43')]+_0x0986('0x44')+_0x186a97+'\x0a\x0a'+_0x0986('0x45')});})[_0x0986('0x14')](function(){_0x3e2b15['status'](0xc8)[_0x0986('0x2e')]({'message':_0x0986('0x46')});})[_0x0986('0x1d')](function(_0x386dfe){return handleError(_0x3e2b15,0x1f4,_0x386dfe);});};exports[_0x0986('0x47')]=function(_0x344e10,_0x58d1a4){return db['User'][_0x0986('0x1f')]({'where':{'resetPasswordToken':_0x344e10[_0x0986('0x48')][_0x0986('0x49')],'resetPasswordExpires':{'$gt':Date[_0x0986('0x4a')]()}}})[_0x0986('0x14')](function(_0x4ec42c){if(!_0x4ec42c){throw new Error(_0x0986('0x4b'));}return db[_0x0986('0x39')][_0x0986('0xa')]({'attributes':['id',_0x0986('0x4c'),_0x0986('0x4d'),_0x0986('0x4e')]})[_0x0986('0x14')](function(_0x25a3b3){if(_0x25a3b3[_0x0986('0x4c')])authService[_0x0986('0x4f')](_0x344e10[_0x0986('0x35')][_0x0986('0xd')]);if(!_0x25a3b3[_0x0986('0x4d')]||!_0x4ec42c[_0x0986('0x50')])return _0x4ec42c;authService[_0x0986('0x51')](_0x344e10['body'][_0x0986('0xd')],_0x4ec42c[_0x0986('0x50')],_0x25a3b3['passwordHistoryLimit']);return _0x4ec42c;})[_0x0986('0x14')](function(){_0x4ec42c[_0x0986('0xd')]=_0x344e10[_0x0986('0x35')][_0x0986('0xd')];_0x4ec42c[_0x0986('0x3e')]=null;_0x4ec42c[_0x0986('0x52')]=null;return _0x4ec42c[_0x0986('0x53')]();});})[_0x0986('0x14')](function(){_0x58d1a4[_0x0986('0x2d')](0xc8)[_0x0986('0x2e')]({'message':_0x0986('0x54')});})[_0x0986('0x1d')](function(_0x57688f){return handleError(_0x58d1a4,0x1f4,_0x57688f);});};passport['use'](_0x0986('0x30'),new LocalStrategy({'usernameField':_0x0986('0x15'),'passwordField':_0x0986('0xd')},function(_0xc1af0c,_0x45bae8,_0x2002db){return localAuthenticate(db['User'],_0xc1af0c,_0x45bae8,_0x2002db);})); \ No newline at end of file +var _0xdcfd=['name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','user','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','getSmtpOptions','merge','format','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','This\x20email\x20is\x20not\x20registered.','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/','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordToken','resetPasswordExpires','use','local-login','passport','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','Setting','findOne','allowedLoginAttempts','blockDuration'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xdcfd,0x1ce));var _0xddcf=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0xdcfd[_0x34b87f];return _0x449805;};'use strict';var util=require('util');var passport=require(_0xddcf('0x0'));var LocalStrategy=require('passport-local')[_0xddcf('0x1')];var jayson=require(_0xddcf('0x2'));var _=require('lodash');var rs=require(_0xddcf('0x3'));var moment=require(_0xddcf('0x4'));var db=require(_0xddcf('0x5'))['db'];var authService=require(_0xddcf('0x6'));var utils=require(_0xddcf('0x7'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x2b4324,_0x54b285,_0x5bdd1c,_0x54d408){var _0x5a3129,_0x33c460;return db[_0xddcf('0x8')][_0xddcf('0x9')]({'where':{'id':0x1},'attributes':[_0xddcf('0xa'),_0xddcf('0xb')],'raw':!![]})['then'](function(_0x2500b5){_0x5a3129=_0x2500b5;return _0x2b4324['findOne']({'attributes':['id',_0xddcf('0xc'),_0xddcf('0xd'),_0xddcf('0xe'),_0xddcf('0xf'),_0xddcf('0x10'),_0xddcf('0x11'),_0xddcf('0x12'),_0xddcf('0x13')],'where':{'name':_0x54b285,'role':{'$or':['admin',_0xddcf('0x14'),'agent']}}});})[_0xddcf('0x15')](function(_0x170eba){if(!_0x170eba||_0x170eba&&_0x170eba[_0xddcf('0xc')]!==_0x54b285){throw new Error(_0xddcf('0x16'));}else{_0x33c460=_0x170eba;return _0x33c460;}})[_0xddcf('0x15')](function(){_0x33c460['authenticate'](_0x5bdd1c,function(_0x1ef5fc,_0x4f5d01){var _0x31cf5e=_0x33c460['loginAttempts']+0x1;if(_0x1ef5fc){return _0x54d408(_0x1ef5fc);}else if(!_0x4f5d01){if(_0x33c460[_0xddcf('0x10')]){return _0x54d408(null,![],{'message':_0xddcf('0x16')});}else if(_0x5a3129['allowedLoginAttempts']>0x0){if(_0x33c460[_0xddcf('0x11')]){if(_0x5a3129[_0xddcf('0xb')]>0x0){if(moment(_0x33c460[_0xddcf('0x12')])['add'](_0x5a3129[_0xddcf('0xb')],_0xddcf('0x17'))>moment()){return _0x54d408(null,![],{'message':_0xddcf('0x16')});}else{return utils[_0xddcf('0x18')](_0x33c460,_0x31cf5e,![],null)[_0xddcf('0x15')](function(){return _0x54d408(null,![],{'message':_0xddcf('0x16')});});}}else{return _0x54d408(null,![],{'message':_0xddcf('0x16')});}}else{if(_0x31cf5e>=_0x5a3129[_0xddcf('0xa')]){return utils[_0xddcf('0x18')](_0x33c460,0x0,!![],moment())[_0xddcf('0x15')](function(){return _0x54d408(null,![],{'message':_0xddcf('0x16')});});}else{return utils[_0xddcf('0x18')](_0x33c460,_0x31cf5e,![],null)[_0xddcf('0x15')](function(){return _0x54d408(null,![],{'message':_0xddcf('0x16')});});}}}else{return _0x54d408(null,![],{'message':_0xddcf('0x16')});}}else{if(_0x33c460[_0xddcf('0x10')]){return _0x54d408(null,![],{'message':_0xddcf('0x16')});}else if(_0x5a3129[_0xddcf('0xa')]>0x0){if(_0x33c460[_0xddcf('0x11')]){if(_0x5a3129['blockDuration']>0x0){if(moment(_0x33c460[_0xddcf('0x12')])[_0xddcf('0x19')](_0x5a3129[_0xddcf('0xb')],_0xddcf('0x17'))>moment()){return _0x54d408(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xddcf('0x18')](_0x33c460,0x0,![],null)['then'](function(){return utils[_0xddcf('0x1a')](_0x33c460);})[_0xddcf('0x15')](function(){return _0x54d408(null,_0x33c460);});}}else{return _0x54d408(null,![],{'message':_0xddcf('0x16')});}}else{return utils[_0xddcf('0x18')](_0x33c460,0x0,![],null)['then'](function(){return utils[_0xddcf('0x1a')](_0x33c460);})['then'](function(){return _0x54d408(null,_0x33c460);})[_0xddcf('0x1b')](function(_0x386960){return _0x54d408(null,![],_0x386960);});}}else{if(_0x33c460[_0xddcf('0x11')]){return _0x54d408(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xddcf('0x1a')](_0x33c460)[_0xddcf('0x15')](function(){return _0x54d408(null,_0x33c460);});}}}});})[_0xddcf('0x1b')](function(_0x3a04e3){return _0x54d408(null,![],_0x3a04e3);});}function sendServiceMail(_0x2c2cfe){return db[_0xddcf('0x1c')][_0xddcf('0x1d')]({'where':{'service':!![]},'attributes':['id','name',_0xddcf('0x1e')],'include':[{'model':db[_0xddcf('0x1f')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xddcf('0x20')}]}]})[_0xddcf('0x15')](function(_0x49e9e6){if(!_0x49e9e6){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3d68fb=_0x49e9e6[_0xddcf('0x21')]();var _0x311304={'account':_0x3d68fb,'message':_[_0xddcf('0x22')]({'from':util[_0xddcf('0x23')]('\x22%s\x22\x20<%s>',_0x49e9e6[_0xddcf('0xc')],_0x49e9e6['email']||_0x49e9e6[_0xddcf('0x24')]['user'])},_0x2c2cfe)};return client[_0xddcf('0x25')](_0xddcf('0x26'),_0x311304);})[_0xddcf('0x15')](function(_0xa9c7be){if(_0xa9c7be[_0xddcf('0x27')]){throw new Error(util[_0xddcf('0x23')](_0xddcf('0x28'),_0xa9c7be[_0xddcf('0x27')][_0xddcf('0x29')]||JSON[_0xddcf('0x2a')](_0xa9c7be[_0xddcf('0x27')])));}return!![];});}function handleError(_0x54d3e2,_0x35de1a,_0x19f52a){return _0x54d3e2[_0xddcf('0x2b')](_0x35de1a||0x1f4)[_0xddcf('0x2c')]({'message':_0x19f52a?_0x19f52a[_0xddcf('0x29')]||_0x19f52a:''});}exports[_0xddcf('0x2d')]=function(_0x33a487,_0x1eff80,_0x4d8fa4){passport['authenticate']('local-login',function(_0x5d3119,_0x22be19,_0x13f140){var _0x32a599=_0x5d3119||_0x13f140;if(_0x32a599){return handleError(_0x1eff80,0x191,_0x32a599);}if(!_0x22be19){return handleError(_0x1eff80,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2d0501={'payload':{'id':_0x22be19['id'],'role':_0x22be19[_0xddcf('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xddcf('0x2e')](_0x2d0501)['then'](function(_0x4b1b92){_0x1eff80[_0xddcf('0x2f')]({'id':_0x22be19['id'],'token':_0x4b1b92,'statusCall':'','isAlreadyLogged':_0x22be19[_0xddcf('0x30')]});});}})(_0x33a487,_0x1eff80,_0x4d8fa4);};exports[_0xddcf('0x31')]=function(_0x1fc746,_0x40bfc7){if(!_0x1fc746[_0xddcf('0x32')][_0xddcf('0x1e')]){return handleError(_0x40bfc7,0x1f4,{'message':_0xddcf('0x33')});}var _0x1d89e6=rs[_0xddcf('0x34')]();_0x1fc746[_0xddcf('0x32')][_0xddcf('0x1e')]=_0x1fc746[_0xddcf('0x32')]['email'][_0xddcf('0x35')]()['toLowerCase']();var _0x1466c5;return db[_0xddcf('0x8')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xddcf('0x15')](function(_0x243b65){_0x1466c5=_0x243b65;return db[_0xddcf('0x36')][_0xddcf('0x1d')]({'where':{'email':_0x1fc746['body'][_0xddcf('0x1e')]}});})[_0xddcf('0x15')](function(_0x2dfc46){if(!_0x2dfc46){throw new Error(_0xddcf('0x37'));}if(_0x2dfc46['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x2dfc46[_0xddcf('0x11')]){if(moment(_0x2dfc46['blockedAt'])[_0xddcf('0x19')](_0x1466c5[_0xddcf('0xb')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2dfc46[_0xddcf('0x11')]=![];_0x2dfc46[_0xddcf('0x12')]=null;}}_0x2dfc46['resetPasswordToken']=_0x1d89e6;_0x2dfc46['resetPasswordExpires']=Date[_0xddcf('0x38')]()+0x36ee80;return _0x2dfc46[_0xddcf('0x39')]();})['then'](function(){return sendServiceMail({'to':_0x1fc746['body'][_0xddcf('0x1e')],'subject':_0xddcf('0x3a'),'text':_0xddcf('0x3b')+_0xddcf('0x3c')+_0xddcf('0x3d')+_0x1fc746[_0xddcf('0x3e')][_0xddcf('0x3f')]+_0xddcf('0x40')+_0x1d89e6+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xddcf('0x15')](function(){_0x40bfc7[_0xddcf('0x2b')](0xc8)['send']({'message':_0xddcf('0x41')});})[_0xddcf('0x1b')](function(_0x372616){return handleError(_0x40bfc7,0x1f4,_0x372616);});};exports[_0xddcf('0x42')]=function(_0x363ac8,_0x5afb49){return db[_0xddcf('0x36')][_0xddcf('0x1d')]({'where':{'resetPasswordToken':_0x363ac8[_0xddcf('0x43')]['token'],'resetPasswordExpires':{'$gt':Date[_0xddcf('0x38')]()}}})['then'](function(_0x1c9499){if(!_0x1c9499){throw new Error(_0xddcf('0x44'));}return db[_0xddcf('0x8')][_0xddcf('0x9')]({'attributes':['id',_0xddcf('0x45'),'enforcePasswordHistory',_0xddcf('0x46')]})[_0xddcf('0x15')](function(_0x42af7d){if(_0x42af7d[_0xddcf('0x45')])authService[_0xddcf('0x47')](_0x363ac8['body'][_0xddcf('0xd')]);if(!_0x42af7d[_0xddcf('0x48')]||!_0x1c9499[_0xddcf('0x49')])return _0x1c9499;authService[_0xddcf('0x4a')](_0x363ac8[_0xddcf('0x32')][_0xddcf('0xd')],_0x1c9499['previousPasswords'],_0x42af7d[_0xddcf('0x46')]);return _0x1c9499;})[_0xddcf('0x15')](function(){_0x1c9499[_0xddcf('0xd')]=_0x363ac8[_0xddcf('0x32')][_0xddcf('0xd')];_0x1c9499[_0xddcf('0x4b')]=null;_0x1c9499[_0xddcf('0x4c')]=null;return _0x1c9499[_0xddcf('0x39')]();});})[_0xddcf('0x15')](function(){_0x5afb49['status'](0xc8)[_0xddcf('0x2c')]({'message':'Password\x20reset!'});})[_0xddcf('0x1b')](function(_0x4e60e8){return handleError(_0x5afb49,0x1f4,_0x4e60e8);});};passport[_0xddcf('0x4d')](_0xddcf('0x4e'),new LocalStrategy({'usernameField':_0xddcf('0xc'),'passwordField':_0xddcf('0xd')},function(_0x4f7649,_0x38e808,_0xc135c7){return localAuthenticate(db[_0xddcf('0x36')],_0x4f7649,_0x38e808,_0xc135c7);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 545543f..d75c258 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 _0xedc1=['login','/forgot','forgot','/reset/:token','reset','exports','Router','./authLocal.controller','post'];(function(_0x598996,_0x2670b6){var _0x427d39=function(_0x104fc7){while(--_0x104fc7){_0x598996['push'](_0x598996['shift']());}};_0x427d39(++_0x2670b6);}(_0xedc1,0x177));var _0x1edc=function(_0x2924d3,_0x43216b){_0x2924d3=_0x2924d3-0x0;var _0x4be4e4=_0xedc1[_0x2924d3];return _0x4be4e4;};'use strict';var express=require('express');var router=express[_0x1edc('0x0')]();var controller=require(_0x1edc('0x1'));router[_0x1edc('0x2')]('/',controller[_0x1edc('0x3')]);router[_0x1edc('0x2')](_0x1edc('0x4'),controller[_0x1edc('0x5')]);router[_0x1edc('0x2')](_0x1edc('0x6'),controller[_0x1edc('0x7')]);module[_0x1edc('0x8')]=router; \ No newline at end of file +var _0x7688=['post','login','/forgot','/reset/:token','reset','Router','./authLocal.controller'];(function(_0xf6bb70,_0x3b21a1){var _0x46ed1d=function(_0x4a1ba3){while(--_0x4a1ba3){_0xf6bb70['push'](_0xf6bb70['shift']());}};_0x46ed1d(++_0x3b21a1);}(_0x7688,0x155));var _0x8768=function(_0x41fcd7,_0xca7c47){_0x41fcd7=_0x41fcd7-0x0;var _0x326630=_0x7688[_0x41fcd7];return _0x326630;};'use strict';var express=require('express');var router=express[_0x8768('0x0')]();var controller=require(_0x8768('0x1'));router[_0x8768('0x2')]('/',controller[_0x8768('0x3')]);router['post'](_0x8768('0x4'),controller['forgot']);router[_0x8768('0x2')](_0x8768('0x5'),controller[_0x8768('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4332419..737cdaa 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 _0x857f=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x857f,0x16c));var _0xf857=function(_0x427cb4,_0x3c154b){_0x427cb4=_0x427cb4-0x0;var _0x43f775=_0x857f[_0x427cb4];return _0x43f775;};'use strict';var Sequelize=require(_0xf857('0x0'));module[_0xf857('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xf857('0x2')]},'description':{'type':Sequelize[_0xf857('0x2')]},'status':{'type':Sequelize[_0xf857('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf857('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x169b=['INTEGER','sequelize','exports','STRING'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x169b,0x159));var _0xb169=function(_0x2a7b20,_0x1faf56){_0x2a7b20=_0x2a7b20-0x0;var _0x591f38=_0x169b[_0x2a7b20];return _0x591f38;};'use strict';var Sequelize=require(_0xb169('0x0'));module[_0xb169('0x1')]={'name':{'type':Sequelize[_0xb169('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xb169('0x2')]},'description':{'type':Sequelize[_0xb169('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb169('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 8bf90dd..c67f3c9 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 _0x17cd=['Automation','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','catch','show','params','keys','find','create','body','addConditions','ids','getConditions','findOne','hasOwnProperty','addActions','omit','getActions','Action','eml-format','rimraf','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','name','index','map'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x17cd,0x16b));var _0xd17c=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x17cd[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xd17c('0x0'));var rimraf=require(_0xd17c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd17c('0x2'));var moment=require(_0xd17c('0x3'));var BPromise=require(_0xd17c('0x4'));var Mustache=require('mustache');var util=require(_0xd17c('0x5'));var path=require(_0xd17c('0x6'));var sox=require('sox');var csv=require(_0xd17c('0x7'));var ejs=require(_0xd17c('0x8'));var fs=require('fs');var fs_extra=require(_0xd17c('0x9'));var _=require(_0xd17c('0xa'));var squel=require(_0xd17c('0xb'));var crypto=require(_0xd17c('0xc'));var jsforce=require(_0xd17c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd17c('0x7'));var querystring=require(_0xd17c('0xe'));var Papa=require(_0xd17c('0xf'));var Redis=require(_0xd17c('0x10'));var authService=require(_0xd17c('0x11'));var qs=require(_0xd17c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd17c('0x13'));var logger=require(_0xd17c('0x14'))('api');var utils=require(_0xd17c('0x15'));var config=require(_0xd17c('0x16'));var licenseUtil=require(_0xd17c('0x17'));var db=require(_0xd17c('0x18'))['db'];function respondWithStatusCode(_0xc2271b,_0x3316be){_0x3316be=_0x3316be||0xcc;return function(_0x15642b){if(_0x15642b){return _0xc2271b[_0xd17c('0x19')](_0x3316be);}return _0xc2271b[_0xd17c('0x1a')](_0x3316be)[_0xd17c('0x1b')]();};}function respondWithResult(_0xd64a7c,_0x4cd737){_0x4cd737=_0x4cd737||0xc8;return function(_0x5814de){if(_0x5814de){return _0xd64a7c[_0xd17c('0x1a')](_0x4cd737)[_0xd17c('0x1c')](_0x5814de);}};}function respondWithFilteredResult(_0x4bcf67,_0x146e74){return function(_0x32dc7e){if(_0x32dc7e){var _0x25698c=typeof _0x146e74[_0xd17c('0x1d')]===_0xd17c('0x1e')&&typeof _0x146e74['limit']===_0xd17c('0x1e');var _0x5e5880=_0x32dc7e[_0xd17c('0x1f')];var _0x8121e8=_0x25698c?0x0:_0x146e74[_0xd17c('0x1d')];var _0xfb0519=_0x25698c?_0x32dc7e[_0xd17c('0x1f')]:_0x146e74[_0xd17c('0x1d')]+_0x146e74[_0xd17c('0x20')];var _0x4306f9;if(_0xfb0519>=_0x5e5880){_0xfb0519=_0x5e5880;_0x4306f9=0xc8;}else{_0x4306f9=0xce;}_0x4bcf67['status'](_0x4306f9);return _0x4bcf67[_0xd17c('0x21')]('Content-Range',_0x8121e8+'-'+_0xfb0519+'/'+_0x5e5880)['json'](_0x32dc7e);}return null;};}function patchUpdates(_0x4ecd27){return function(_0x160f9c){try{jsonpatch[_0xd17c('0x22')](_0x160f9c,_0x4ecd27,!![]);}catch(_0x149640){return BPromise['reject'](_0x149640);}return _0x160f9c[_0xd17c('0x23')]();};}function saveUpdates(_0x162155,_0x62efc0){return function(_0x34f677){if(_0x34f677){return _0x34f677[_0xd17c('0x24')](_0x162155)['then'](function(_0x125926){return _0x125926;});}return null;};}function removeEntity(_0x5763d0,_0x2c66b4){return function(_0x392ae9){if(_0x392ae9){return _0x392ae9[_0xd17c('0x25')]()[_0xd17c('0x26')](function(){_0x5763d0[_0xd17c('0x1a')](0xcc)[_0xd17c('0x1b')]();});}};}function handleEntityNotFound(_0x3f0e3f,_0x7830c9){return function(_0x2d3734){if(!_0x2d3734){_0x3f0e3f['sendStatus'](0x194);}return _0x2d3734;};}function handleError(_0x504252,_0x28c532){_0x28c532=_0x28c532||0x1f4;return function(_0x2c3983){logger['error'](_0x2c3983['stack']);if(_0x2c3983[_0xd17c('0x27')]){delete _0x2c3983['name'];}_0x504252[_0xd17c('0x1a')](_0x28c532)['send'](_0x2c3983);};}exports[_0xd17c('0x28')]=function(_0x5b6047,_0x56083c){var _0x45605b={},_0x5e7e89={},_0x23c109={'count':0x0,'rows':[]};var _0x27e2b3=_[_0xd17c('0x29')](db[_0xd17c('0x2a')][_0xd17c('0x2b')],function(_0x4be1f8){return{'name':_0x4be1f8[_0xd17c('0x2c')],'type':_0x4be1f8['type'][_0xd17c('0x2d')]};});_0x5e7e89[_0xd17c('0x2e')]=_[_0xd17c('0x29')](_0x27e2b3,_0xd17c('0x27'));_0x5e7e89[_0xd17c('0x2f')]=_['keys'](_0x5b6047['query']);_0x5e7e89[_0xd17c('0x30')]=_[_0xd17c('0x31')](_0x5e7e89[_0xd17c('0x2e')],_0x5e7e89[_0xd17c('0x2f')]);_0x45605b[_0xd17c('0x32')]=_[_0xd17c('0x31')](_0x5e7e89['model'],qs['fields'](_0x5b6047[_0xd17c('0x2f')][_0xd17c('0x33')]));_0x45605b[_0xd17c('0x32')]=_0x45605b['attributes'][_0xd17c('0x34')]?_0x45605b[_0xd17c('0x32')]:_0x5e7e89[_0xd17c('0x2e')];if(!_0x5b6047[_0xd17c('0x2f')]['hasOwnProperty'](_0xd17c('0x35'))){_0x45605b['limit']=qs[_0xd17c('0x20')](_0x5b6047['query'][_0xd17c('0x20')]);_0x45605b['offset']=qs[_0xd17c('0x1d')](_0x5b6047[_0xd17c('0x2f')][_0xd17c('0x1d')]);}_0x45605b[_0xd17c('0x36')]=qs[_0xd17c('0x37')](_0x5b6047[_0xd17c('0x2f')]['sort']);_0x45605b[_0xd17c('0x38')]=qs['filters'](_[_0xd17c('0x39')](_0x5b6047[_0xd17c('0x2f')],_0x5e7e89[_0xd17c('0x30')]),_0x27e2b3);if(_0x5b6047['query']['filter']){_0x45605b[_0xd17c('0x38')]=_[_0xd17c('0x3a')](_0x45605b[_0xd17c('0x38')],{'$or':_[_0xd17c('0x29')](_0x27e2b3,function(_0x1f00da){if(_0x1f00da[_0xd17c('0x3b')]!==_0xd17c('0x3c')){var _0x27be42={};_0x27be42[_0x1f00da['name']]={'$like':'%'+_0x5b6047['query'][_0xd17c('0x3d')]+'%'};return _0x27be42;}})});}_0x45605b=_['merge']({},_0x45605b,_0x5b6047[_0xd17c('0x3e')]);var _0xe00c08={'where':_0x45605b[_0xd17c('0x38')]};return db[_0xd17c('0x2a')][_0xd17c('0x1f')](_0xe00c08)[_0xd17c('0x26')](function(_0x296177){_0x23c109[_0xd17c('0x1f')]=_0x296177;if(_0x5b6047[_0xd17c('0x2f')][_0xd17c('0x3f')]){_0x45605b[_0xd17c('0x40')]=[{'all':!![]}];}return db[_0xd17c('0x2a')]['findAll'](_0x45605b);})[_0xd17c('0x26')](function(_0x462734){_0x23c109['rows']=_0x462734;return _0x23c109;})['then'](respondWithFilteredResult(_0x56083c,_0x45605b))[_0xd17c('0x41')](handleError(_0x56083c,null));};exports[_0xd17c('0x42')]=function(_0x114a09,_0x589509){var _0x5126e1={'raw':![],'where':{'id':_0x114a09[_0xd17c('0x43')]['id']}},_0x2d13d4={};_0x2d13d4[_0xd17c('0x2e')]=_[_0xd17c('0x44')](db[_0xd17c('0x2a')]['rawAttributes']);_0x2d13d4[_0xd17c('0x2f')]=_[_0xd17c('0x44')](_0x114a09[_0xd17c('0x2f')]);_0x2d13d4[_0xd17c('0x30')]=_[_0xd17c('0x31')](_0x2d13d4[_0xd17c('0x2e')],_0x2d13d4[_0xd17c('0x2f')]);_0x5126e1[_0xd17c('0x32')]=_[_0xd17c('0x31')](_0x2d13d4[_0xd17c('0x2e')],qs['fields'](_0x114a09[_0xd17c('0x2f')][_0xd17c('0x33')]));_0x5126e1[_0xd17c('0x32')]=_0x5126e1[_0xd17c('0x32')]['length']?_0x5126e1[_0xd17c('0x32')]:_0x2d13d4[_0xd17c('0x2e')];if(_0x114a09[_0xd17c('0x2f')][_0xd17c('0x3f')]){_0x5126e1[_0xd17c('0x40')]=[{'all':!![]}];}_0x5126e1=_['merge']({},_0x5126e1,_0x114a09[_0xd17c('0x3e')]);return db[_0xd17c('0x2a')][_0xd17c('0x45')](_0x5126e1)['then'](handleEntityNotFound(_0x589509,null))['then'](respondWithResult(_0x589509,null))[_0xd17c('0x41')](handleError(_0x589509,null));};exports[_0xd17c('0x46')]=function(_0x2ea574,_0x3a2298){return db[_0xd17c('0x2a')][_0xd17c('0x46')](_0x2ea574[_0xd17c('0x47')],{})[_0xd17c('0x26')](respondWithResult(_0x3a2298,0xc9))[_0xd17c('0x41')](handleError(_0x3a2298,null));};exports[_0xd17c('0x24')]=function(_0x1e035b,_0x582cfc){if(_0x1e035b[_0xd17c('0x47')]['id']){delete _0x1e035b[_0xd17c('0x47')]['id'];}return db[_0xd17c('0x2a')][_0xd17c('0x45')]({'where':{'id':_0x1e035b['params']['id']}})[_0xd17c('0x26')](handleEntityNotFound(_0x582cfc,null))[_0xd17c('0x26')](saveUpdates(_0x1e035b[_0xd17c('0x47')],null))[_0xd17c('0x26')](respondWithResult(_0x582cfc,null))[_0xd17c('0x41')](handleError(_0x582cfc,null));};exports[_0xd17c('0x25')]=function(_0x5cddc5,_0x4e5a13){return db[_0xd17c('0x2a')]['find']({'where':{'id':_0x5cddc5[_0xd17c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e5a13,null))['then'](removeEntity(_0x4e5a13,null))[_0xd17c('0x41')](handleError(_0x4e5a13,null));};exports[_0xd17c('0x48')]=function(_0x48f093,_0x14a987,_0x23e0b1){return db['Condition'][_0xd17c('0x45')]({'where':{'id':_0x48f093[_0xd17c('0x43')]['id']}})[_0xd17c('0x26')](handleEntityNotFound(_0x14a987,null))['then'](function(_0x461f84){if(_0x461f84){return _0x461f84[_0xd17c('0x48')](_0x48f093[_0xd17c('0x47')][_0xd17c('0x49')],_['omit'](_0x48f093[_0xd17c('0x47')],[_0xd17c('0x49'),'id'])||{});}})[_0xd17c('0x26')](respondWithResult(_0x14a987,null))[_0xd17c('0x41')](handleError(_0x14a987,null));};exports[_0xd17c('0x4a')]=function(_0x2df753,_0x3a9f41,_0x5e21d3){var _0x42edc4={};var _0x18f3ca={};var _0x4d5cb2;var _0x2d8f38;return db[_0xd17c('0x2a')][_0xd17c('0x4b')]({'where':{'id':_0x2df753[_0xd17c('0x43')]['id']}})[_0xd17c('0x26')](handleEntityNotFound(_0x3a9f41,null))[_0xd17c('0x26')](function(_0x47200f){if(_0x47200f){_0x4d5cb2=_0x47200f;_0x18f3ca[_0xd17c('0x2e')]=_[_0xd17c('0x44')](db['Condition'][_0xd17c('0x2b')]);_0x18f3ca[_0xd17c('0x2f')]=_[_0xd17c('0x44')](_0x2df753[_0xd17c('0x2f')]);_0x18f3ca[_0xd17c('0x30')]=_['intersection'](_0x18f3ca[_0xd17c('0x2e')],_0x18f3ca[_0xd17c('0x2f')]);_0x42edc4[_0xd17c('0x32')]=_[_0xd17c('0x31')](_0x18f3ca['model'],qs[_0xd17c('0x33')](_0x2df753[_0xd17c('0x2f')][_0xd17c('0x33')]));_0x42edc4[_0xd17c('0x32')]=_0x42edc4[_0xd17c('0x32')][_0xd17c('0x34')]?_0x42edc4[_0xd17c('0x32')]:_0x18f3ca[_0xd17c('0x2e')];_0x42edc4[_0xd17c('0x36')]=qs['sort'](_0x2df753[_0xd17c('0x2f')][_0xd17c('0x37')]);_0x42edc4[_0xd17c('0x38')]=qs[_0xd17c('0x30')](_['pick'](_0x2df753[_0xd17c('0x2f')],_0x18f3ca['filters']));if(_0x2df753[_0xd17c('0x2f')][_0xd17c('0x3d')]){_0x42edc4[_0xd17c('0x38')]=_['merge'](_0x42edc4[_0xd17c('0x38')],{'$or':_[_0xd17c('0x29')](_0x42edc4[_0xd17c('0x32')],function(_0x211f77){var _0x3fdd1e={};_0x3fdd1e[_0x211f77]={'$like':'%'+_0x2df753['query'][_0xd17c('0x3d')]+'%'};return _0x3fdd1e;})});}_0x42edc4=_[_0xd17c('0x3a')]({},_0x42edc4,_0x2df753[_0xd17c('0x3e')]);return _0x4d5cb2[_0xd17c('0x4a')](_0x42edc4);}})[_0xd17c('0x26')](function(_0x201915){if(_0x201915){_0x2d8f38=_0x201915['length'];if(!_0x2df753['query'][_0xd17c('0x4c')](_0xd17c('0x35'))){_0x42edc4[_0xd17c('0x20')]=qs[_0xd17c('0x20')](_0x2df753[_0xd17c('0x2f')]['limit']);_0x42edc4[_0xd17c('0x1d')]=qs[_0xd17c('0x1d')](_0x2df753[_0xd17c('0x2f')][_0xd17c('0x1d')]);}return _0x4d5cb2[_0xd17c('0x4a')](_0x42edc4);}})[_0xd17c('0x26')](function(_0x33c1ae){if(_0x33c1ae){return _0x33c1ae?{'count':_0x2d8f38,'rows':_0x33c1ae}:null;}})[_0xd17c('0x26')](respondWithResult(_0x3a9f41,null))['catch'](handleError(_0x3a9f41,null));};exports[_0xd17c('0x4d')]=function(_0x55cc4c,_0x87b6b2,_0x5d99be){return db['Action'][_0xd17c('0x45')]({'where':{'id':_0x55cc4c[_0xd17c('0x43')]['id']}})[_0xd17c('0x26')](handleEntityNotFound(_0x87b6b2,null))['then'](function(_0x221676){if(_0x221676){return _0x221676[_0xd17c('0x4d')](_0x55cc4c['body'][_0xd17c('0x49')],_[_0xd17c('0x4e')](_0x55cc4c[_0xd17c('0x47')],['ids','id'])||{});}})['then'](respondWithResult(_0x87b6b2,null))[_0xd17c('0x41')](handleError(_0x87b6b2,null));};exports[_0xd17c('0x4f')]=function(_0x4dc3d4,_0xd7a66a,_0x57f535){var _0x22b8b2={};var _0x4c8678={};var _0x28e904;var _0x5d34e8;return db[_0xd17c('0x2a')]['findOne']({'where':{'id':_0x4dc3d4[_0xd17c('0x43')]['id']}})[_0xd17c('0x26')](handleEntityNotFound(_0xd7a66a,null))[_0xd17c('0x26')](function(_0x118436){if(_0x118436){_0x28e904=_0x118436;_0x4c8678[_0xd17c('0x2e')]=_['keys'](db[_0xd17c('0x50')][_0xd17c('0x2b')]);_0x4c8678['query']=_[_0xd17c('0x44')](_0x4dc3d4[_0xd17c('0x2f')]);_0x4c8678[_0xd17c('0x30')]=_[_0xd17c('0x31')](_0x4c8678[_0xd17c('0x2e')],_0x4c8678[_0xd17c('0x2f')]);_0x22b8b2['attributes']=_[_0xd17c('0x31')](_0x4c8678['model'],qs[_0xd17c('0x33')](_0x4dc3d4[_0xd17c('0x2f')][_0xd17c('0x33')]));_0x22b8b2[_0xd17c('0x32')]=_0x22b8b2['attributes']['length']?_0x22b8b2['attributes']:_0x4c8678['model'];_0x22b8b2[_0xd17c('0x36')]=qs[_0xd17c('0x37')](_0x4dc3d4['query'][_0xd17c('0x37')]);_0x22b8b2['where']=qs[_0xd17c('0x30')](_['pick'](_0x4dc3d4[_0xd17c('0x2f')],_0x4c8678['filters']));if(_0x4dc3d4[_0xd17c('0x2f')]['filter']){_0x22b8b2['where']=_[_0xd17c('0x3a')](_0x22b8b2[_0xd17c('0x38')],{'$or':_[_0xd17c('0x29')](_0x22b8b2[_0xd17c('0x32')],function(_0x8c700f){var _0x4451c4={};_0x4451c4[_0x8c700f]={'$like':'%'+_0x4dc3d4['query'][_0xd17c('0x3d')]+'%'};return _0x4451c4;})});}_0x22b8b2=_[_0xd17c('0x3a')]({},_0x22b8b2,_0x4dc3d4[_0xd17c('0x3e')]);return _0x28e904[_0xd17c('0x4f')](_0x22b8b2);}})[_0xd17c('0x26')](function(_0x4f8a2a){if(_0x4f8a2a){_0x5d34e8=_0x4f8a2a[_0xd17c('0x34')];if(!_0x4dc3d4[_0xd17c('0x2f')][_0xd17c('0x4c')](_0xd17c('0x35'))){_0x22b8b2[_0xd17c('0x20')]=qs['limit'](_0x4dc3d4[_0xd17c('0x2f')][_0xd17c('0x20')]);_0x22b8b2[_0xd17c('0x1d')]=qs['offset'](_0x4dc3d4[_0xd17c('0x2f')][_0xd17c('0x1d')]);}return _0x28e904[_0xd17c('0x4f')](_0x22b8b2);}})['then'](function(_0x360a62){if(_0x360a62){return _0x360a62?{'count':_0x5d34e8,'rows':_0x360a62}:null;}})[_0xd17c('0x26')](respondWithResult(_0xd7a66a,null))[_0xd17c('0x41')](handleError(_0xd7a66a,null));}; \ No newline at end of file +var _0x96e4=['ids','omit','findOne','options','getConditions','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','map','Automation','rawAttributes','type','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','includeAll','find','create','body','params','addConditions','Condition'];(function(_0x507018,_0x3f8257){var _0x34d677=function(_0x17e529){while(--_0x17e529){_0x507018['push'](_0x507018['shift']());}};_0x34d677(++_0x3f8257);}(_0x96e4,0x144));var _0x496e=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x96e4[_0x43776a];return _0x18eb8f;};'use strict';var emlformat=require(_0x496e('0x0'));var rimraf=require(_0x496e('0x1'));var zipdir=require(_0x496e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x496e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x496e('0x4'));var path=require(_0x496e('0x5'));var sox=require(_0x496e('0x6'));var csv=require(_0x496e('0x7'));var ejs=require(_0x496e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x496e('0x9'));var squel=require(_0x496e('0xa'));var crypto=require(_0x496e('0xb'));var jsforce=require(_0x496e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x496e('0x7'));var querystring=require(_0x496e('0xd'));var Papa=require(_0x496e('0xe'));var Redis=require('ioredis');var authService=require(_0x496e('0xf'));var qs=require(_0x496e('0x10'));var as=require(_0x496e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x496e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x496e('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x496e('0x14'))['db'];function respondWithStatusCode(_0x42f815,_0x56d36d){_0x56d36d=_0x56d36d||0xcc;return function(_0x45349c){if(_0x45349c){return _0x42f815['sendStatus'](_0x56d36d);}return _0x42f815[_0x496e('0x15')](_0x56d36d)[_0x496e('0x16')]();};}function respondWithResult(_0x45ab4f,_0x152197){_0x152197=_0x152197||0xc8;return function(_0x32851e){if(_0x32851e){return _0x45ab4f[_0x496e('0x15')](_0x152197)[_0x496e('0x17')](_0x32851e);}};}function respondWithFilteredResult(_0x474689,_0x495599){return function(_0x2f5bba){if(_0x2f5bba){var _0x56c218=typeof _0x495599[_0x496e('0x18')]===_0x496e('0x19')&&typeof _0x495599[_0x496e('0x1a')]===_0x496e('0x19');var _0x37d0ab=_0x2f5bba[_0x496e('0x1b')];var _0xd155a=_0x56c218?0x0:_0x495599['offset'];var _0x452b7f=_0x56c218?_0x2f5bba['count']:_0x495599[_0x496e('0x18')]+_0x495599['limit'];var _0x33202d;if(_0x452b7f>=_0x37d0ab){_0x452b7f=_0x37d0ab;_0x33202d=0xc8;}else{_0x33202d=0xce;}_0x474689[_0x496e('0x15')](_0x33202d);return _0x474689[_0x496e('0x1c')](_0x496e('0x1d'),_0xd155a+'-'+_0x452b7f+'/'+_0x37d0ab)[_0x496e('0x17')](_0x2f5bba);}return null;};}function patchUpdates(_0x195c07){return function(_0x11b8d6){try{jsonpatch[_0x496e('0x1e')](_0x11b8d6,_0x195c07,!![]);}catch(_0x40eb1d){return BPromise[_0x496e('0x1f')](_0x40eb1d);}return _0x11b8d6['save']();};}function saveUpdates(_0x57af2d,_0x16753e){return function(_0x12eb62){if(_0x12eb62){return _0x12eb62[_0x496e('0x20')](_0x57af2d)[_0x496e('0x21')](function(_0x58ab8b){return _0x58ab8b;});}return null;};}function removeEntity(_0x25b058,_0x4dad6b){return function(_0xa8dd78){if(_0xa8dd78){return _0xa8dd78[_0x496e('0x22')]()[_0x496e('0x21')](function(){_0x25b058[_0x496e('0x15')](0xcc)[_0x496e('0x16')]();});}};}function handleEntityNotFound(_0x23be52,_0x4f689a){return function(_0x3edb3d){if(!_0x3edb3d){_0x23be52[_0x496e('0x23')](0x194);}return _0x3edb3d;};}function handleError(_0x4245e9,_0x17ed92){_0x17ed92=_0x17ed92||0x1f4;return function(_0x31a5f4){logger['error'](_0x31a5f4[_0x496e('0x24')]);if(_0x31a5f4['name']){delete _0x31a5f4['name'];}_0x4245e9['status'](_0x17ed92)['send'](_0x31a5f4);};}exports['index']=function(_0x9098ec,_0x35145e){var _0x5d2ca7={},_0x19f286={},_0x3fe068={'count':0x0,'rows':[]};var _0x2db3da=_[_0x496e('0x25')](db[_0x496e('0x26')][_0x496e('0x27')],function(_0x398bb2){return{'name':_0x398bb2['fieldName'],'type':_0x398bb2[_0x496e('0x28')][_0x496e('0x29')]};});_0x19f286['model']=_['map'](_0x2db3da,_0x496e('0x2a'));_0x19f286[_0x496e('0x2b')]=_[_0x496e('0x2c')](_0x9098ec[_0x496e('0x2b')]);_0x19f286['filters']=_[_0x496e('0x2d')](_0x19f286[_0x496e('0x2e')],_0x19f286[_0x496e('0x2b')]);_0x5d2ca7[_0x496e('0x2f')]=_[_0x496e('0x2d')](_0x19f286[_0x496e('0x2e')],qs[_0x496e('0x30')](_0x9098ec[_0x496e('0x2b')][_0x496e('0x30')]));_0x5d2ca7['attributes']=_0x5d2ca7[_0x496e('0x2f')][_0x496e('0x31')]?_0x5d2ca7[_0x496e('0x2f')]:_0x19f286[_0x496e('0x2e')];if(!_0x9098ec[_0x496e('0x2b')][_0x496e('0x32')](_0x496e('0x33'))){_0x5d2ca7[_0x496e('0x1a')]=qs['limit'](_0x9098ec[_0x496e('0x2b')][_0x496e('0x1a')]);_0x5d2ca7[_0x496e('0x18')]=qs[_0x496e('0x18')](_0x9098ec['query'][_0x496e('0x18')]);}_0x5d2ca7[_0x496e('0x34')]=qs[_0x496e('0x35')](_0x9098ec[_0x496e('0x2b')][_0x496e('0x35')]);_0x5d2ca7['where']=qs[_0x496e('0x36')](_[_0x496e('0x37')](_0x9098ec['query'],_0x19f286[_0x496e('0x36')]),_0x2db3da);if(_0x9098ec[_0x496e('0x2b')][_0x496e('0x38')]){_0x5d2ca7[_0x496e('0x39')]=_[_0x496e('0x3a')](_0x5d2ca7[_0x496e('0x39')],{'$or':_['map'](_0x2db3da,function(_0xb48bc9){if(_0xb48bc9[_0x496e('0x28')]!==_0x496e('0x3b')){var _0x51f5b4={};_0x51f5b4[_0xb48bc9[_0x496e('0x2a')]]={'$like':'%'+_0x9098ec['query'][_0x496e('0x38')]+'%'};return _0x51f5b4;}})});}_0x5d2ca7=_[_0x496e('0x3a')]({},_0x5d2ca7,_0x9098ec['options']);var _0xbab247={'where':_0x5d2ca7['where']};return db[_0x496e('0x26')]['count'](_0xbab247)[_0x496e('0x21')](function(_0x3e21e7){_0x3fe068[_0x496e('0x1b')]=_0x3e21e7;if(_0x9098ec[_0x496e('0x2b')]['includeAll']){_0x5d2ca7[_0x496e('0x3c')]=[{'all':!![]}];}return db[_0x496e('0x26')]['findAll'](_0x5d2ca7);})[_0x496e('0x21')](function(_0x4c97b8){_0x3fe068[_0x496e('0x3d')]=_0x4c97b8;return _0x3fe068;})[_0x496e('0x21')](respondWithFilteredResult(_0x35145e,_0x5d2ca7))[_0x496e('0x3e')](handleError(_0x35145e,null));};exports[_0x496e('0x3f')]=function(_0x495460,_0x584c70){var _0xdf20b3={'raw':![],'where':{'id':_0x495460['params']['id']}},_0x1c5fb8={};_0x1c5fb8['model']=_[_0x496e('0x2c')](db['Automation']['rawAttributes']);_0x1c5fb8[_0x496e('0x2b')]=_['keys'](_0x495460[_0x496e('0x2b')]);_0x1c5fb8[_0x496e('0x36')]=_[_0x496e('0x2d')](_0x1c5fb8['model'],_0x1c5fb8[_0x496e('0x2b')]);_0xdf20b3['attributes']=_['intersection'](_0x1c5fb8['model'],qs[_0x496e('0x30')](_0x495460[_0x496e('0x2b')][_0x496e('0x30')]));_0xdf20b3[_0x496e('0x2f')]=_0xdf20b3[_0x496e('0x2f')][_0x496e('0x31')]?_0xdf20b3[_0x496e('0x2f')]:_0x1c5fb8[_0x496e('0x2e')];if(_0x495460[_0x496e('0x2b')][_0x496e('0x40')]){_0xdf20b3[_0x496e('0x3c')]=[{'all':!![]}];}_0xdf20b3=_[_0x496e('0x3a')]({},_0xdf20b3,_0x495460['options']);return db[_0x496e('0x26')][_0x496e('0x41')](_0xdf20b3)[_0x496e('0x21')](handleEntityNotFound(_0x584c70,null))[_0x496e('0x21')](respondWithResult(_0x584c70,null))[_0x496e('0x3e')](handleError(_0x584c70,null));};exports[_0x496e('0x42')]=function(_0x450988,_0x4fbd6a){return db[_0x496e('0x26')]['create'](_0x450988['body'],{})[_0x496e('0x21')](respondWithResult(_0x4fbd6a,0xc9))[_0x496e('0x3e')](handleError(_0x4fbd6a,null));};exports['update']=function(_0x351b1c,_0x3bef51){if(_0x351b1c['body']['id']){delete _0x351b1c[_0x496e('0x43')]['id'];}return db[_0x496e('0x26')][_0x496e('0x41')]({'where':{'id':_0x351b1c[_0x496e('0x44')]['id']}})[_0x496e('0x21')](handleEntityNotFound(_0x3bef51,null))[_0x496e('0x21')](saveUpdates(_0x351b1c[_0x496e('0x43')],null))[_0x496e('0x21')](respondWithResult(_0x3bef51,null))['catch'](handleError(_0x3bef51,null));};exports[_0x496e('0x22')]=function(_0x305006,_0x4a0f60){return db[_0x496e('0x26')][_0x496e('0x41')]({'where':{'id':_0x305006[_0x496e('0x44')]['id']}})[_0x496e('0x21')](handleEntityNotFound(_0x4a0f60,null))[_0x496e('0x21')](removeEntity(_0x4a0f60,null))['catch'](handleError(_0x4a0f60,null));};exports[_0x496e('0x45')]=function(_0x163285,_0x435984,_0x56809d){return db[_0x496e('0x46')][_0x496e('0x41')]({'where':{'id':_0x163285[_0x496e('0x44')]['id']}})[_0x496e('0x21')](handleEntityNotFound(_0x435984,null))['then'](function(_0x20aa6f){if(_0x20aa6f){return _0x20aa6f[_0x496e('0x45')](_0x163285['body'][_0x496e('0x47')],_[_0x496e('0x48')](_0x163285[_0x496e('0x43')],['ids','id'])||{});}})[_0x496e('0x21')](respondWithResult(_0x435984,null))[_0x496e('0x3e')](handleError(_0x435984,null));};exports['getConditions']=function(_0x628b82,_0x33a623,_0x2d1c23){var _0x1d4e19={};var _0x19e5db={};var _0x24fd29;var _0x13c646;return db[_0x496e('0x26')][_0x496e('0x49')]({'where':{'id':_0x628b82[_0x496e('0x44')]['id']}})[_0x496e('0x21')](handleEntityNotFound(_0x33a623,null))[_0x496e('0x21')](function(_0x5939b5){if(_0x5939b5){_0x24fd29=_0x5939b5;_0x19e5db[_0x496e('0x2e')]=_[_0x496e('0x2c')](db[_0x496e('0x46')][_0x496e('0x27')]);_0x19e5db[_0x496e('0x2b')]=_['keys'](_0x628b82['query']);_0x19e5db[_0x496e('0x36')]=_[_0x496e('0x2d')](_0x19e5db['model'],_0x19e5db['query']);_0x1d4e19[_0x496e('0x2f')]=_[_0x496e('0x2d')](_0x19e5db[_0x496e('0x2e')],qs[_0x496e('0x30')](_0x628b82[_0x496e('0x2b')][_0x496e('0x30')]));_0x1d4e19[_0x496e('0x2f')]=_0x1d4e19[_0x496e('0x2f')]['length']?_0x1d4e19['attributes']:_0x19e5db['model'];_0x1d4e19[_0x496e('0x34')]=qs[_0x496e('0x35')](_0x628b82[_0x496e('0x2b')]['sort']);_0x1d4e19[_0x496e('0x39')]=qs[_0x496e('0x36')](_[_0x496e('0x37')](_0x628b82[_0x496e('0x2b')],_0x19e5db[_0x496e('0x36')]));if(_0x628b82[_0x496e('0x2b')][_0x496e('0x38')]){_0x1d4e19[_0x496e('0x39')]=_[_0x496e('0x3a')](_0x1d4e19[_0x496e('0x39')],{'$or':_[_0x496e('0x25')](_0x1d4e19[_0x496e('0x2f')],function(_0x404e17){var _0x10c7b3={};_0x10c7b3[_0x404e17]={'$like':'%'+_0x628b82[_0x496e('0x2b')]['filter']+'%'};return _0x10c7b3;})});}_0x1d4e19=_['merge']({},_0x1d4e19,_0x628b82[_0x496e('0x4a')]);return _0x24fd29[_0x496e('0x4b')](_0x1d4e19);}})[_0x496e('0x21')](function(_0x4b62c3){if(_0x4b62c3){_0x13c646=_0x4b62c3[_0x496e('0x31')];if(!_0x628b82[_0x496e('0x2b')][_0x496e('0x32')]('nolimit')){_0x1d4e19[_0x496e('0x1a')]=qs[_0x496e('0x1a')](_0x628b82[_0x496e('0x2b')][_0x496e('0x1a')]);_0x1d4e19[_0x496e('0x18')]=qs[_0x496e('0x18')](_0x628b82[_0x496e('0x2b')][_0x496e('0x18')]);}return _0x24fd29[_0x496e('0x4b')](_0x1d4e19);}})['then'](function(_0x266e9c){if(_0x266e9c){return _0x266e9c?{'count':_0x13c646,'rows':_0x266e9c}:null;}})[_0x496e('0x21')](respondWithResult(_0x33a623,null))[_0x496e('0x3e')](handleError(_0x33a623,null));};exports[_0x496e('0x4c')]=function(_0x3757e7,_0x387ad4,_0x2f7a4f){return db[_0x496e('0x4d')][_0x496e('0x41')]({'where':{'id':_0x3757e7[_0x496e('0x44')]['id']}})[_0x496e('0x21')](handleEntityNotFound(_0x387ad4,null))[_0x496e('0x21')](function(_0x5b47eb){if(_0x5b47eb){return _0x5b47eb[_0x496e('0x4c')](_0x3757e7[_0x496e('0x43')][_0x496e('0x47')],_[_0x496e('0x48')](_0x3757e7['body'],[_0x496e('0x47'),'id'])||{});}})['then'](respondWithResult(_0x387ad4,null))['catch'](handleError(_0x387ad4,null));};exports[_0x496e('0x4e')]=function(_0x51fdfc,_0x1bc498,_0xff5695){var _0x8fbff6={};var _0x255639={};var _0x118a51;var _0x413734;return db['Automation'][_0x496e('0x49')]({'where':{'id':_0x51fdfc[_0x496e('0x44')]['id']}})[_0x496e('0x21')](handleEntityNotFound(_0x1bc498,null))[_0x496e('0x21')](function(_0x20cdac){if(_0x20cdac){_0x118a51=_0x20cdac;_0x255639[_0x496e('0x2e')]=_['keys'](db[_0x496e('0x4d')]['rawAttributes']);_0x255639[_0x496e('0x2b')]=_[_0x496e('0x2c')](_0x51fdfc[_0x496e('0x2b')]);_0x255639[_0x496e('0x36')]=_[_0x496e('0x2d')](_0x255639[_0x496e('0x2e')],_0x255639[_0x496e('0x2b')]);_0x8fbff6[_0x496e('0x2f')]=_[_0x496e('0x2d')](_0x255639[_0x496e('0x2e')],qs['fields'](_0x51fdfc['query'][_0x496e('0x30')]));_0x8fbff6[_0x496e('0x2f')]=_0x8fbff6[_0x496e('0x2f')][_0x496e('0x31')]?_0x8fbff6[_0x496e('0x2f')]:_0x255639[_0x496e('0x2e')];_0x8fbff6[_0x496e('0x34')]=qs[_0x496e('0x35')](_0x51fdfc[_0x496e('0x2b')][_0x496e('0x35')]);_0x8fbff6[_0x496e('0x39')]=qs[_0x496e('0x36')](_[_0x496e('0x37')](_0x51fdfc[_0x496e('0x2b')],_0x255639[_0x496e('0x36')]));if(_0x51fdfc[_0x496e('0x2b')][_0x496e('0x38')]){_0x8fbff6[_0x496e('0x39')]=_[_0x496e('0x3a')](_0x8fbff6[_0x496e('0x39')],{'$or':_['map'](_0x8fbff6[_0x496e('0x2f')],function(_0x34a50a){var _0x5920a0={};_0x5920a0[_0x34a50a]={'$like':'%'+_0x51fdfc[_0x496e('0x2b')]['filter']+'%'};return _0x5920a0;})});}_0x8fbff6=_[_0x496e('0x3a')]({},_0x8fbff6,_0x51fdfc[_0x496e('0x4a')]);return _0x118a51[_0x496e('0x4e')](_0x8fbff6);}})['then'](function(_0x56445b){if(_0x56445b){_0x413734=_0x56445b[_0x496e('0x31')];if(!_0x51fdfc[_0x496e('0x2b')][_0x496e('0x32')](_0x496e('0x33'))){_0x8fbff6[_0x496e('0x1a')]=qs[_0x496e('0x1a')](_0x51fdfc[_0x496e('0x2b')]['limit']);_0x8fbff6[_0x496e('0x18')]=qs['offset'](_0x51fdfc['query'][_0x496e('0x18')]);}return _0x118a51[_0x496e('0x4e')](_0x8fbff6);}})['then'](function(_0x50ae72){if(_0x50ae72){return _0x50ae72?{'count':_0x413734,'rows':_0x50ae72}:null;}})[_0x496e('0x21')](respondWithResult(_0x1bc498,null))[_0x496e('0x3e')](handleError(_0x1bc498,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 7c45bd7..d2b251c 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 _0x438e=['path','rimraf','../../config/environment','./automation.attributes','exports','define','tools_automations','util','../../config/logger','api','bluebird','request-promise'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x438e,0x1f3));var _0xe438=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x438e[_0x3b56c0];return _0x377efe;};'use strict';var _=require('lodash');var util=require(_0xe438('0x0'));var logger=require(_0xe438('0x1'))(_0xe438('0x2'));var moment=require('moment');var BPromise=require(_0xe438('0x3'));var rp=require(_0xe438('0x4'));var fs=require('fs');var path=require(_0xe438('0x5'));var rimraf=require(_0xe438('0x6'));var config=require(_0xe438('0x7'));var attributes=require(_0xe438('0x8'));module[_0xe438('0x9')]=function(_0x309d97,_0x2655c7){return _0x309d97[_0xe438('0xa')]('Automation',attributes,{'tableName':_0xe438('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa991=['api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation','util'];(function(_0x398447,_0x18df90){var _0x5d2094=function(_0x3c42a8){while(--_0x3c42a8){_0x398447['push'](_0x398447['shift']());}};_0x5d2094(++_0x18df90);}(_0xa991,0x6d));var _0x1a99=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xa991[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require(_0x1a99('0x0'));var logger=require('../../config/logger')(_0x1a99('0x1'));var moment=require(_0x1a99('0x2'));var BPromise=require(_0x1a99('0x3'));var rp=require(_0x1a99('0x4'));var fs=require('fs');var path=require(_0x1a99('0x5'));var rimraf=require('rimraf');var config=require(_0x1a99('0x6'));var attributes=require(_0x1a99('0x7'));module[_0x1a99('0x8')]=function(_0x5dea29,_0x19c92d){return _0x5dea29[_0x1a99('0x9')](_0x1a99('0xa'),attributes,{'tableName':'tools_automations','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 f954ca9..49c9ed9 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 _0x6372=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch'];(function(_0x360cc7,_0x2373f4){var _0x36c3b7=function(_0x112d09){while(--_0x112d09){_0x360cc7['push'](_0x360cc7['shift']());}};_0x36c3b7(++_0x2373f4);}(_0x6372,0x1b8));var _0x2637=function(_0x24b876,_0x38534c){_0x24b876=_0x24b876-0x0;var _0x8e7099=_0x6372[_0x24b876];return _0x8e7099;};'use strict';var _=require(_0x2637('0x0'));var util=require('util');var moment=require(_0x2637('0x1'));var BPromise=require('bluebird');var rs=require(_0x2637('0x2'));var fs=require('fs');var Redis=require(_0x2637('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2637('0x4'));var logger=require(_0x2637('0x5'))(_0x2637('0x6'));var config=require(_0x2637('0x7'));var jayson=require(_0x2637('0x8'));var client=jayson['client'][_0x2637('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54bdd1,_0x4f8521,_0x49383d){return new BPromise(function(_0x30abde,_0x5a4748){return client['request'](_0x54bdd1,_0x49383d)[_0x2637('0xa')](function(_0x2dbcb5){logger[_0x2637('0xb')]('Automation,\x20%s,\x20%s',_0x4f8521,'request\x20sent');logger[_0x2637('0xc')](_0x2637('0xd'),_0x4f8521,_0x2637('0xe'),JSON[_0x2637('0xf')](_0x2dbcb5));if(_0x2dbcb5[_0x2637('0x10')]){if(_0x2dbcb5[_0x2637('0x10')][_0x2637('0x11')]===0x1f4){logger[_0x2637('0x10')](_0x2637('0x12'),_0x4f8521,_0x2dbcb5['error'][_0x2637('0x13')]);return _0x5a4748(_0x2dbcb5[_0x2637('0x10')][_0x2637('0x13')]);}logger['error'](_0x2637('0x12'),_0x4f8521,_0x2dbcb5[_0x2637('0x10')][_0x2637('0x13')]);return _0x30abde(_0x2dbcb5[_0x2637('0x10')]['message']);}else{logger[_0x2637('0xb')](_0x2637('0x12'),_0x4f8521,_0x2637('0xe'));_0x30abde(_0x2dbcb5[_0x2637('0x14')][_0x2637('0x13')]);}})[_0x2637('0x15')](function(_0x567d3c){logger['error'](_0x2637('0x12'),_0x4f8521,_0x567d3c);_0x5a4748(_0x567d3c);});});} \ No newline at end of file +var _0x2272=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch'];(function(_0x2b72d8,_0x2fd8bf){var _0x1ec104=function(_0x7af0ec){while(--_0x7af0ec){_0x2b72d8['push'](_0x2b72d8['shift']());}};_0x1ec104(++_0x2fd8bf);}(_0x2272,0xd8));var _0x2227=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2272[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('Automation,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 55fee2d..55505db 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 _0x9efb=['getActions','post','addConditions','/:id/actions','addActions','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id/conditions','getConditions'];(function(_0x3f08ca,_0x10bca6){var _0x4bdd9c=function(_0x2bc9a9){while(--_0x2bc9a9){_0x3f08ca['push'](_0x3f08ca['shift']());}};_0x4bdd9c(++_0x10bca6);}(_0x9efb,0x143));var _0xb9ef=function(_0x306950,_0x1d665d){_0x306950=_0x306950-0x0;var _0x5df637=_0x9efb[_0x306950];return _0x5df637;};'use strict';var multer=require('multer');var util=require(_0xb9ef('0x0'));var path=require(_0xb9ef('0x1'));var timeout=require('connect-timeout');var express=require(_0xb9ef('0x2'));var router=express[_0xb9ef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb9ef('0x4'));var interaction=require(_0xb9ef('0x5'));var config=require(_0xb9ef('0x6'));var controller=require(_0xb9ef('0x7'));router[_0xb9ef('0x8')]('/',auth[_0xb9ef('0x9')](),controller[_0xb9ef('0xa')]);router['get']('/:id',auth[_0xb9ef('0x9')](),controller['show']);router['get'](_0xb9ef('0xb'),auth[_0xb9ef('0x9')](),controller[_0xb9ef('0xc')]);router[_0xb9ef('0x8')]('/:id/actions',auth[_0xb9ef('0x9')](),controller[_0xb9ef('0xd')]);router[_0xb9ef('0xe')]('/',auth[_0xb9ef('0x9')](),controller['create']);router[_0xb9ef('0xe')](_0xb9ef('0xb'),auth[_0xb9ef('0x9')](),controller[_0xb9ef('0xf')]);router[_0xb9ef('0xe')](_0xb9ef('0x10'),auth[_0xb9ef('0x9')](),controller[_0xb9ef('0x11')]);router[_0xb9ef('0x12')](_0xb9ef('0x13'),auth['isAuthenticated'](),controller[_0xb9ef('0x14')]);router[_0xb9ef('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb9ef('0x16')]);module[_0xb9ef('0x17')]=router; \ No newline at end of file +var _0x48ea=['../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x48ea,0x9c));var _0xa48e=function(_0x19950d,_0x448522){_0x19950d=_0x19950d-0x0;var _0x44d84f=_0x48ea[_0x19950d];return _0x44d84f;};'use strict';var multer=require(_0xa48e('0x0'));var util=require('util');var path=require(_0xa48e('0x1'));var timeout=require(_0xa48e('0x2'));var express=require(_0xa48e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa48e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa48e('0x5'));var controller=require(_0xa48e('0x6'));router[_0xa48e('0x7')]('/',auth[_0xa48e('0x8')](),controller[_0xa48e('0x9')]);router[_0xa48e('0x7')](_0xa48e('0xa'),auth[_0xa48e('0x8')](),controller[_0xa48e('0xb')]);router[_0xa48e('0x7')](_0xa48e('0xc'),auth[_0xa48e('0x8')](),controller[_0xa48e('0xd')]);router[_0xa48e('0x7')](_0xa48e('0xe'),auth['isAuthenticated'](),controller[_0xa48e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa48e('0x10')](_0xa48e('0xc'),auth[_0xa48e('0x8')](),controller[_0xa48e('0x11')]);router['post'](_0xa48e('0xe'),auth[_0xa48e('0x8')](),controller[_0xa48e('0x12')]);router[_0xa48e('0x13')](_0xa48e('0xa'),auth[_0xa48e('0x8')](),controller[_0xa48e('0x14')]);router['delete'](_0xa48e('0xa'),auth[_0xa48e('0x8')](),controller[_0xa48e('0x15')]);module[_0xa48e('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e83a912..856a7be 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 _0x8e70=['sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x9bef43,_0x22812d){var _0x68828d=function(_0x1cae7){while(--_0x1cae7){_0x9bef43['push'](_0x9bef43['shift']());}};_0x68828d(++_0x22812d);}(_0x8e70,0xa0));var _0x08e7=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x8e70[_0x3e44fa];return _0x2a0aba;};'use strict';var Sequelize=require(_0x08e7('0x0'));module[_0x08e7('0x1')]={'name':{'type':Sequelize[_0x08e7('0x2')],'unique':_0x08e7('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x08e7('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x08e7('0x5')},'description':{'type':Sequelize[_0x08e7('0x2')]},'active':{'type':Sequelize[_0x08e7('0x6')],'defaultValue':0x0,'comment':_0x08e7('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x08e7('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x08e7('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x08e7('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x08e7('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x08e7('0xa')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x08e7('0xa')](0x3)[_0x08e7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08e7('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x08e7('0xa')](0x5)[_0x08e7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08e7('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x08e7('0xa')](0x3)[_0x08e7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08e7('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x08e7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x08e7('0xa')](0x3)[_0x08e7('0x8')],'defaultValue':0x3,'comment':_0x08e7('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x08e7('0xa')](0x5)[_0x08e7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x08e7('0xa')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x08e7('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x08e7('0x2')],'defaultValue':_0x08e7('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x08e7('0x4')](_0x08e7('0x11'),_0x08e7('0x12'),_0x08e7('0x13')),'defaultValue':_0x08e7('0x11')},'dialAMDActive':{'type':Sequelize[_0x08e7('0x6')],'defaultValue':0x0,'comment':_0x08e7('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x08e7('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x08e7('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x08e7('0xa')](0x9)[_0x08e7('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x08e7('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x08e7('0xa')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x08e7('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x08e7('0xa')](0x9)[_0x08e7('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x08e7('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x08e7('0xa')](0x9)[_0x08e7('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x08e7('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x08e7('0xa')](0x5)[_0x08e7('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x08e7('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x08e7('0xa')](0x9)[_0x08e7('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x08e7('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x08e7('0x4')]('DESC',_0x08e7('0x1c')),'defaultValue':_0x08e7('0x1d')},'dialPrefix':{'type':Sequelize[_0x08e7('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x08e7('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x08e7('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x08e7('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x08e7('0xa')](0x3)[_0x08e7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08e7('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x08e7('0xa')](0x5)[_0x08e7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08e7('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x08e7('0xa')](0x3)[_0x08e7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08e7('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x08e7('0xa')](0x5)[_0x08e7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08e7('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x08e7('0xa')](0x3)[_0x08e7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08e7('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x08e7('0xa')](0x5)[_0x08e7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x08e7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08e7('0x25')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x08e7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08e7('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x08e7('0xa')](0x3)[_0x08e7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x08e7('0xa')](0x5)[_0x08e7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08e7('0x27')}}; \ No newline at end of file +var _0xe386=['NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x140240,_0x101ef5){var _0x54fe10=function(_0x38fca4){while(--_0x38fca4){_0x140240['push'](_0x140240['shift']());}};_0x54fe10(++_0x101ef5);}(_0xe386,0x1db));var _0x6e38=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe386[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0x6e38('0x0')]={'name':{'type':Sequelize[_0x6e38('0x1')],'unique':_0x6e38('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x6e38('0x3')),'allowNull':![],'defaultValue':_0x6e38('0x3')},'description':{'type':Sequelize[_0x6e38('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6e38('0x4')},'limitCalls':{'type':Sequelize[_0x6e38('0x5')](0x4)[_0x6e38('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6e38('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6e38('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6e38('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x6e38('0x5')](0x3)[_0x6e38('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e38('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e38('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6e38('0x5')](0x5)[_0x6e38('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e38('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x6e38('0x5')](0x3)[_0x6e38('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e38('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6e38('0x5')](0x5)[_0x6e38('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e38('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6e38('0x6')],'defaultValue':0x3,'comment':_0x6e38('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6e38('0x5')](0x5)[_0x6e38('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x6e38('0x5')](0x3)[_0x6e38('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6e38('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x6e38('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x6e38('0x10')]('always',_0x6e38('0x11'),_0x6e38('0x12')),'defaultValue':_0x6e38('0x13')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x6e38('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6e38('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x6e38('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6e38('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6e38('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6e38('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6e38('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6e38('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6e38('0x5')](0x9)[_0x6e38('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6e38('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6e38('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6e38('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6e38('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6e38('0x5')](0x9)[_0x6e38('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6e38('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6e38('0x10')]('DESC',_0x6e38('0x1c')),'defaultValue':_0x6e38('0x1d')},'dialPrefix':{'type':Sequelize[_0x6e38('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6e38('0x5')](0x3)[_0x6e38('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6e38('0x1e')},'dialCutDigit':{'type':Sequelize[_0x6e38('0x5')](0x3)[_0x6e38('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6e38('0x5')](0x3)[_0x6e38('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e38('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6e38('0x5')](0x5)[_0x6e38('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e38('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x6e38('0x5')](0x3)[_0x6e38('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e38('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x6e38('0x5')](0x5)[_0x6e38('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6e38('0x5')](0x3)[_0x6e38('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e38('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e38('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e38('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x6e38('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e38('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6e38('0x5')](0x5)[_0x6e38('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6e38('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e38('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6e38('0x5')](0x5)[_0x6e38('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e38('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index b7de1bc..90b067b 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 _0x0427=['insert','into','ContactId','NOW()','cm_contacts','CampaignId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','Campaign','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','update','getHoppers','CmHopper','order','CampaignId','rows','getHopperHistories','findOne','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','cm_hopper','fromQuery','ListId','select','field','phone','scheduledAt','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x0427,0x137));var _0x7042=function(_0x3fb462,_0x5ae278){_0x3fb462=_0x3fb462-0x0;var _0x1b3ebb=_0x0427[_0x3fb462];return _0x1b3ebb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7042('0x0'));var jsonpatch=require(_0x7042('0x1'));var rp=require('request-promise');var moment=require(_0x7042('0x2'));var BPromise=require(_0x7042('0x3'));var Mustache=require(_0x7042('0x4'));var util=require(_0x7042('0x5'));var path=require(_0x7042('0x6'));var sox=require(_0x7042('0x7'));var csv=require(_0x7042('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7042('0x9'));var _=require(_0x7042('0xa'));var squel=require(_0x7042('0xb'));var crypto=require(_0x7042('0xc'));var jsforce=require(_0x7042('0xd'));var deskjs=require(_0x7042('0xe'));var toCsv=require(_0x7042('0x8'));var querystring=require(_0x7042('0xf'));var Papa=require(_0x7042('0x10'));var Redis=require('ioredis');var authService=require(_0x7042('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7042('0x12'));var utils=require('../../config/utils');var config=require(_0x7042('0x13'));var licenseUtil=require(_0x7042('0x14'));var db=require(_0x7042('0x15'))['db'];function respondWithStatusCode(_0x5629f2,_0x5c06f0){_0x5c06f0=_0x5c06f0||0xcc;return function(_0x292c4a){if(_0x292c4a){return _0x5629f2[_0x7042('0x16')](_0x5c06f0);}return _0x5629f2[_0x7042('0x17')](_0x5c06f0)[_0x7042('0x18')]();};}function respondWithResult(_0x25dfe5,_0xee4c2){_0xee4c2=_0xee4c2||0xc8;return function(_0x5def25){if(_0x5def25){return _0x25dfe5[_0x7042('0x17')](_0xee4c2)[_0x7042('0x19')](_0x5def25);}};}function respondWithFilteredResult(_0x6ed505,_0x5c1ef0){return function(_0x4c68c4){if(_0x4c68c4){var _0xc7e44e=typeof _0x5c1ef0['offset']===_0x7042('0x1a')&&typeof _0x5c1ef0['limit']==='undefined';var _0x28add7=_0x4c68c4[_0x7042('0x1b')];var _0x1e69aa=_0xc7e44e?0x0:_0x5c1ef0[_0x7042('0x1c')];var _0x6e18fb=_0xc7e44e?_0x4c68c4['count']:_0x5c1ef0[_0x7042('0x1c')]+_0x5c1ef0[_0x7042('0x1d')];var _0x34fda6;if(_0x6e18fb>=_0x28add7){_0x6e18fb=_0x28add7;_0x34fda6=0xc8;}else{_0x34fda6=0xce;}_0x6ed505[_0x7042('0x17')](_0x34fda6);return _0x6ed505[_0x7042('0x1e')]('Content-Range',_0x1e69aa+'-'+_0x6e18fb+'/'+_0x28add7)[_0x7042('0x19')](_0x4c68c4);}return null;};}function patchUpdates(_0x580f84){return function(_0x363f3c){try{jsonpatch['apply'](_0x363f3c,_0x580f84,!![]);}catch(_0x3b8203){return BPromise[_0x7042('0x1f')](_0x3b8203);}return _0x363f3c[_0x7042('0x20')]();};}function saveUpdates(_0x456dfc,_0x484c82){return function(_0x5a224b){if(_0x5a224b){return _0x5a224b['update'](_0x456dfc)[_0x7042('0x21')](function(_0x30a722){return _0x30a722;});}return null;};}function removeEntity(_0x3af8bc,_0x1949fe){return function(_0x48d529){if(_0x48d529){return _0x48d529[_0x7042('0x22')]()[_0x7042('0x21')](function(){var _0x4611f9=_0x48d529[_0x7042('0x23')]({'plain':!![]});var _0x459ff6='IvrCampaigns';return db[_0x7042('0x24')][_0x7042('0x22')]({'where':{'type':_0x459ff6,'resourceId':_0x4611f9['id']}})[_0x7042('0x21')](function(){return _0x48d529;});})[_0x7042('0x21')](function(){_0x3af8bc[_0x7042('0x17')](0xcc)[_0x7042('0x18')]();});}};}function handleEntityNotFound(_0x162ac7,_0x26543a){return function(_0x4568ec){if(!_0x4568ec){_0x162ac7[_0x7042('0x16')](0x194);}return _0x4568ec;};}function handleError(_0xa9ca06,_0x36fec4){_0x36fec4=_0x36fec4||0x1f4;return function(_0x88c156){logger[_0x7042('0x25')](_0x88c156[_0x7042('0x26')]);if(_0x88c156[_0x7042('0x27')]){delete _0x88c156[_0x7042('0x27')];}_0xa9ca06[_0x7042('0x17')](_0x36fec4)[_0x7042('0x28')](_0x88c156);};}exports['index']=function(_0x519e79,_0x37cf52){var _0x160af6={},_0x300be2={},_0x253a8b={'count':0x0,'rows':[]};var _0x2620c3=_[_0x7042('0x29')](db[_0x7042('0x2a')]['rawAttributes'],function(_0x4823c3){return{'name':_0x4823c3[_0x7042('0x2b')],'type':_0x4823c3[_0x7042('0x2c')]['key']};});_0x300be2[_0x7042('0x2d')]=_[_0x7042('0x29')](_0x2620c3,'name');_0x300be2[_0x7042('0x2e')]=_[_0x7042('0x2f')](_0x519e79[_0x7042('0x2e')]);_0x300be2[_0x7042('0x30')]=_[_0x7042('0x31')](_0x300be2['model'],_0x300be2[_0x7042('0x2e')]);_0x160af6['attributes']=_['intersection'](_0x300be2[_0x7042('0x2d')],qs['fields'](_0x519e79[_0x7042('0x2e')][_0x7042('0x32')]));_0x160af6['attributes']=_0x160af6[_0x7042('0x33')]['length']?_0x160af6[_0x7042('0x33')]:_0x300be2[_0x7042('0x2d')];if(!_0x519e79[_0x7042('0x2e')][_0x7042('0x34')](_0x7042('0x35'))){_0x160af6[_0x7042('0x1d')]=qs[_0x7042('0x1d')](_0x519e79[_0x7042('0x2e')][_0x7042('0x1d')]);_0x160af6['offset']=qs[_0x7042('0x1c')](_0x519e79[_0x7042('0x2e')][_0x7042('0x1c')]);}_0x160af6['order']=qs['sort'](_0x519e79[_0x7042('0x2e')][_0x7042('0x36')]);_0x160af6['where']=qs[_0x7042('0x30')](_[_0x7042('0x37')](_0x519e79[_0x7042('0x2e')],_0x300be2[_0x7042('0x30')]),_0x2620c3);if(_0x519e79[_0x7042('0x2e')][_0x7042('0x38')]){_0x160af6[_0x7042('0x39')]=_[_0x7042('0x3a')](_0x160af6[_0x7042('0x39')],{'$or':_[_0x7042('0x29')](_0x2620c3,function(_0x2b8669){if(_0x2b8669[_0x7042('0x2c')]!==_0x7042('0x3b')){var _0x53a424={};_0x53a424[_0x2b8669['name']]={'$like':'%'+_0x519e79[_0x7042('0x2e')][_0x7042('0x38')]+'%'};return _0x53a424;}})});}_0x160af6=_[_0x7042('0x3a')]({},_0x160af6,_0x519e79[_0x7042('0x3c')]);var _0x4b138b={'where':_0x160af6[_0x7042('0x39')]};return db[_0x7042('0x2a')]['count'](_0x4b138b)['then'](function(_0x1f8e68){_0x253a8b[_0x7042('0x1b')]=_0x1f8e68;if(_0x519e79[_0x7042('0x2e')][_0x7042('0x3d')]){_0x160af6[_0x7042('0x3e')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x160af6);})[_0x7042('0x21')](function(_0x3897fc){_0x253a8b['rows']=_0x3897fc;return _0x253a8b;})[_0x7042('0x21')](respondWithFilteredResult(_0x37cf52,_0x160af6))[_0x7042('0x3f')](handleError(_0x37cf52,null));};exports[_0x7042('0x40')]=function(_0x59568d,_0x5cffc0){var _0x9c4981={'raw':![],'where':{'id':_0x59568d[_0x7042('0x41')]['id']}},_0x44413e={};_0x44413e['model']=_[_0x7042('0x2f')](db[_0x7042('0x2a')]['rawAttributes']);_0x44413e[_0x7042('0x2e')]=_[_0x7042('0x2f')](_0x59568d[_0x7042('0x2e')]);_0x44413e[_0x7042('0x30')]=_[_0x7042('0x31')](_0x44413e[_0x7042('0x2d')],_0x44413e[_0x7042('0x2e')]);_0x9c4981['attributes']=_[_0x7042('0x31')](_0x44413e[_0x7042('0x2d')],qs['fields'](_0x59568d[_0x7042('0x2e')][_0x7042('0x32')]));_0x9c4981[_0x7042('0x33')]=_0x9c4981[_0x7042('0x33')][_0x7042('0x42')]?_0x9c4981[_0x7042('0x33')]:_0x44413e['model'];if(_0x59568d['query']['includeAll']){_0x9c4981[_0x7042('0x3e')]=[{'all':!![]}];}_0x9c4981=_['merge']({},_0x9c4981,_0x59568d['options']);return db[_0x7042('0x2a')]['find'](_0x9c4981)[_0x7042('0x21')](handleEntityNotFound(_0x5cffc0,null))[_0x7042('0x21')](respondWithResult(_0x5cffc0,null))[_0x7042('0x3f')](handleError(_0x5cffc0,null));};exports[_0x7042('0x43')]=function(_0x1a22d5,_0x11e7ce){return db[_0x7042('0x2a')][_0x7042('0x43')](_0x1a22d5[_0x7042('0x44')],{})[_0x7042('0x21')](function(_0x103d68){var _0x14d11a=_0x1a22d5[_0x7042('0x45')]['get']({'plain':!![]});if(!_0x14d11a)throw new Error(_0x7042('0x46'));if(_0x14d11a[_0x7042('0x47')]===_0x7042('0x45')){var _0x81b898=_0x103d68[_0x7042('0x23')]({'plain':!![]});var _0x288a11=_0x7042('0x48');return db[_0x7042('0x49')][_0x7042('0x4a')]({'where':{'name':_0x288a11,'userProfileId':_0x14d11a[_0x7042('0x4b')]},'raw':!![]})[_0x7042('0x21')](function(_0x445689){if(_0x445689&&_0x445689[_0x7042('0x4c')]===0x0){return db['UserProfileResource'][_0x7042('0x43')]({'name':_0x81b898['name'],'resourceId':_0x81b898['id'],'type':_0x445689[_0x7042('0x27')],'sectionId':_0x445689['id']},{})[_0x7042('0x21')](function(){return _0x103d68;});}else{return _0x103d68;}})[_0x7042('0x3f')](function(_0x5a0c85){logger['error'](_0x7042('0x4d'),_0x5a0c85);throw _0x5a0c85;});}return _0x103d68;})[_0x7042('0x21')](respondWithResult(_0x11e7ce,0xc9))[_0x7042('0x3f')](handleError(_0x11e7ce,null));};exports[_0x7042('0x4e')]=function(_0x58f2f2,_0x497188){var _0x280a41={'where':{'id':_0x58f2f2['params']['id']}},_0x3b4d27={};_0x3b4d27[_0x7042('0x2d')]=_[_0x7042('0x2f')](db['Campaign'][_0x7042('0x4f')]);_0x280a41[_0x7042('0x33')]=_['intersection'](_0x3b4d27[_0x7042('0x2d')],qs[_0x7042('0x32')](_0x58f2f2[_0x7042('0x2e')]['fields']));_0x280a41[_0x7042('0x33')]=_0x280a41[_0x7042('0x33')][_0x7042('0x42')]?_0x280a41[_0x7042('0x33')]:_0x3b4d27[_0x7042('0x2d')];if(_0x58f2f2[_0x7042('0x2e')][_0x7042('0x3d')]){_0x280a41[_0x7042('0x3e')]=[{'all':!![]}];}_0x280a41=_[_0x7042('0x3a')]({},_0x280a41,_0x58f2f2[_0x7042('0x3c')]);return db[_0x7042('0x2a')][_0x7042('0x4a')](_0x280a41)['then'](handleEntityNotFound(_0x497188,null))[_0x7042('0x21')](function(_0x318fd5){if(_0x318fd5){var _0x5d41f6=_0x318fd5[_0x7042('0x23')]({'plain':!![]});_0x5d41f6=qs[_0x7042('0x50')](_0x5d41f6,['id',_0x7042('0x51'),'updatedAt']);_0x58f2f2[_0x7042('0x44')]=_[_0x7042('0x50')](_0x58f2f2[_0x7042('0x44')],['id','createdAt',_0x7042('0x52')]);return db[_0x7042('0x2a')][_0x7042('0x43')](_[_0x7042('0x3a')](_0x5d41f6,_0x58f2f2[_0x7042('0x44')]),{'include':_0x58f2f2[_0x7042('0x2e')][_0x7042('0x3d')]?[{'all':!![]}]:undefined})[_0x7042('0x21')](function(_0x4bc8e9){var _0x2d7dbc=_0x58f2f2[_0x7042('0x45')][_0x7042('0x23')]({'plain':!![]});if(!_0x2d7dbc)throw new Error(_0x7042('0x46'));if(_0x2d7dbc[_0x7042('0x47')]===_0x7042('0x45')){var _0x253936=_0x4bc8e9['get']({'plain':!![]});var _0x1872c7='IvrCampaigns';return db[_0x7042('0x49')][_0x7042('0x4a')]({'where':{'name':_0x1872c7,'userProfileId':_0x2d7dbc[_0x7042('0x4b')]},'raw':!![]})[_0x7042('0x21')](function(_0x50f7c5){if(_0x50f7c5&&_0x50f7c5['autoAssociation']===0x0){return db[_0x7042('0x24')][_0x7042('0x43')]({'name':_0x253936['name'],'resourceId':_0x253936['id'],'type':_0x50f7c5[_0x7042('0x27')],'sectionId':_0x50f7c5['id']},{})[_0x7042('0x21')](function(){return _0x4bc8e9;});}else{return _0x4bc8e9;}})[_0x7042('0x3f')](function(_0x195f08){logger[_0x7042('0x25')](_0x7042('0x4d'),_0x195f08);throw _0x195f08;});}return _0x4bc8e9;});}})[_0x7042('0x21')](respondWithResult(_0x497188,0xc9))[_0x7042('0x3f')](handleError(_0x497188,null));};exports[_0x7042('0x53')]=function(_0x5c14ca,_0x2185f3){if(_0x5c14ca[_0x7042('0x44')]['id']){delete _0x5c14ca[_0x7042('0x44')]['id'];}return db[_0x7042('0x2a')]['find']({'where':{'id':_0x5c14ca[_0x7042('0x41')]['id']}})['then'](handleEntityNotFound(_0x2185f3,null))[_0x7042('0x21')](saveUpdates(_0x5c14ca[_0x7042('0x44')],null))['then'](respondWithResult(_0x2185f3,null))['catch'](handleError(_0x2185f3,null));};exports[_0x7042('0x22')]=function(_0x5ba91e,_0xc51212){return db[_0x7042('0x2a')][_0x7042('0x4a')]({'where':{'id':_0x5ba91e['params']['id']}})['then'](handleEntityNotFound(_0xc51212,null))['then'](removeEntity(_0xc51212,null))[_0x7042('0x3f')](handleError(_0xc51212,null));};exports[_0x7042('0x54')]=function(_0x5158b6,_0x2256d3,_0x10d2d8){var _0x331b54={'raw':!![],'where':{}};var _0x4c70f4={};var _0x245201={'count':0x0,'rows':[]};return db[_0x7042('0x2a')]['findOne']({'where':{'id':_0x5158b6['params']['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x2256d3,null))['then'](function(_0x59bb93){if(_0x59bb93){_0x4c70f4[_0x7042('0x2d')]=_[_0x7042('0x2f')](db[_0x7042('0x55')][_0x7042('0x4f')]);_0x4c70f4[_0x7042('0x2e')]=_[_0x7042('0x2f')](_0x5158b6[_0x7042('0x2e')]);_0x4c70f4[_0x7042('0x30')]=_['intersection'](_0x4c70f4['model'],_0x4c70f4[_0x7042('0x2e')]);_0x331b54[_0x7042('0x33')]=_[_0x7042('0x31')](_0x4c70f4['model'],qs['fields'](_0x5158b6[_0x7042('0x2e')]['fields']));_0x331b54[_0x7042('0x33')]=_0x331b54[_0x7042('0x33')][_0x7042('0x42')]?_0x331b54['attributes']:_0x4c70f4[_0x7042('0x2d')];if(!_0x5158b6[_0x7042('0x2e')]['hasOwnProperty'](_0x7042('0x35'))){_0x331b54[_0x7042('0x1d')]=qs['limit'](_0x5158b6['query'][_0x7042('0x1d')]);_0x331b54[_0x7042('0x1c')]=qs['offset'](_0x5158b6[_0x7042('0x2e')][_0x7042('0x1c')]);}_0x331b54[_0x7042('0x56')]=qs[_0x7042('0x36')](_0x5158b6[_0x7042('0x2e')][_0x7042('0x36')]);_0x331b54[_0x7042('0x39')]=qs[_0x7042('0x30')](_[_0x7042('0x37')](_0x5158b6[_0x7042('0x2e')],_0x4c70f4['filters']));_0x331b54[_0x7042('0x39')][_0x7042('0x57')]=_0x59bb93['id'];if(_0x5158b6[_0x7042('0x2e')][_0x7042('0x38')]){_0x331b54['where']=_[_0x7042('0x3a')](_0x331b54[_0x7042('0x39')],{'$or':_[_0x7042('0x29')](_0x331b54[_0x7042('0x33')],function(_0x5e758c){var _0x10bb7a={};_0x10bb7a[_0x5e758c]={'$like':'%'+_0x5158b6[_0x7042('0x2e')][_0x7042('0x38')]+'%'};return _0x10bb7a;})});}_0x331b54=_[_0x7042('0x3a')]({},_0x331b54,_0x5158b6[_0x7042('0x3c')]);return db['CmHopper']['count']({'where':_0x331b54[_0x7042('0x39')]})['then'](function(_0x29fa20){_0x245201[_0x7042('0x1b')]=_0x29fa20;if(_0x5158b6[_0x7042('0x2e')][_0x7042('0x3d')]){_0x331b54[_0x7042('0x3e')]=[{'all':!![]}];}return db[_0x7042('0x55')]['findAll'](_0x331b54);})[_0x7042('0x21')](function(_0x5317c0){_0x245201[_0x7042('0x58')]=_0x5317c0;return _0x245201;});}})[_0x7042('0x21')](respondWithFilteredResult(_0x2256d3,_0x331b54))['catch'](handleError(_0x2256d3,null));};exports[_0x7042('0x59')]=function(_0x400004,_0x29c861,_0x271a62){var _0x54a65a={'raw':!![],'where':{}};var _0x2b3fb1={};var _0x462bb5={'count':0x0,'rows':[]};return db[_0x7042('0x2a')][_0x7042('0x5a')]({'where':{'id':_0x400004[_0x7042('0x41')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x29c861,null))[_0x7042('0x21')](function(_0x356841){if(_0x356841){_0x2b3fb1[_0x7042('0x2d')]=_['keys'](db[_0x7042('0x5b')][_0x7042('0x4f')]);_0x2b3fb1[_0x7042('0x2e')]=_['keys'](_0x400004[_0x7042('0x2e')]);_0x2b3fb1['filters']=_['intersection'](_0x2b3fb1[_0x7042('0x2d')],_0x2b3fb1[_0x7042('0x2e')]);_0x54a65a[_0x7042('0x33')]=_['intersection'](_0x2b3fb1[_0x7042('0x2d')],qs[_0x7042('0x32')](_0x400004[_0x7042('0x2e')]['fields']));_0x54a65a[_0x7042('0x33')]=_0x54a65a[_0x7042('0x33')][_0x7042('0x42')]?_0x54a65a[_0x7042('0x33')]:_0x2b3fb1[_0x7042('0x2d')];if(!_0x400004[_0x7042('0x2e')][_0x7042('0x34')]('nolimit')){_0x54a65a['limit']=qs[_0x7042('0x1d')](_0x400004['query'][_0x7042('0x1d')]);_0x54a65a[_0x7042('0x1c')]=qs['offset'](_0x400004['query'][_0x7042('0x1c')]);}_0x54a65a[_0x7042('0x56')]=qs['sort'](_0x400004[_0x7042('0x2e')][_0x7042('0x36')]);_0x54a65a[_0x7042('0x39')]=qs[_0x7042('0x30')](_[_0x7042('0x37')](_0x400004[_0x7042('0x2e')],_0x2b3fb1['filters']));_0x54a65a[_0x7042('0x39')][_0x7042('0x57')]=_0x356841['id'];if(_0x400004['query']['filter']){_0x54a65a[_0x7042('0x39')]=_['merge'](_0x54a65a[_0x7042('0x39')],{'$or':_[_0x7042('0x29')](_0x54a65a[_0x7042('0x33')],function(_0x5dd90d){var _0x5e8535={};_0x5e8535[_0x5dd90d]={'$like':'%'+_0x400004['query']['filter']+'%'};return _0x5e8535;})});}_0x54a65a=_[_0x7042('0x3a')]({},_0x54a65a,_0x400004[_0x7042('0x3c')]);return db[_0x7042('0x5b')][_0x7042('0x1b')]({'where':_0x54a65a[_0x7042('0x39')]})[_0x7042('0x21')](function(_0x392343){_0x462bb5['count']=_0x392343;if(_0x400004[_0x7042('0x2e')][_0x7042('0x3d')]){_0x54a65a['include']=[{'all':!![]}];}return db[_0x7042('0x5b')][_0x7042('0x5c')](_0x54a65a);})[_0x7042('0x21')](function(_0xfc46ac){_0x462bb5['rows']=_0xfc46ac;return _0x462bb5;});}})['then'](respondWithFilteredResult(_0x29c861,_0x54a65a))['catch'](handleError(_0x29c861,null));};exports[_0x7042('0x5d')]=function(_0x501a3e,_0x234cba,_0x2314fc){var _0x1ce11d={'raw':!![],'where':{}};var _0x50058b={};var _0x94ea96={'count':0x0,'rows':[]};return db[_0x7042('0x2a')][_0x7042('0x5a')]({'where':{'id':_0x501a3e[_0x7042('0x41')]['id']}})['then'](handleEntityNotFound(_0x234cba,null))[_0x7042('0x21')](function(_0x3bdb8b){if(_0x3bdb8b){_0x50058b['model']=_['keys'](db[_0x7042('0x5e')][_0x7042('0x4f')]);_0x50058b[_0x7042('0x2e')]=_['keys'](_0x501a3e[_0x7042('0x2e')]);_0x50058b['filters']=_[_0x7042('0x31')](_0x50058b[_0x7042('0x2d')],_0x50058b[_0x7042('0x2e')]);_0x1ce11d[_0x7042('0x33')]=_[_0x7042('0x31')](_0x50058b[_0x7042('0x2d')],qs[_0x7042('0x32')](_0x501a3e[_0x7042('0x2e')]['fields']));_0x1ce11d[_0x7042('0x33')]=_0x1ce11d[_0x7042('0x33')][_0x7042('0x42')]?_0x1ce11d[_0x7042('0x33')]:_0x50058b[_0x7042('0x2d')];if(!_0x501a3e[_0x7042('0x2e')]['hasOwnProperty']('nolimit')){_0x1ce11d[_0x7042('0x1d')]=qs[_0x7042('0x1d')](_0x501a3e[_0x7042('0x2e')][_0x7042('0x1d')]);_0x1ce11d[_0x7042('0x1c')]=qs[_0x7042('0x1c')](_0x501a3e[_0x7042('0x2e')][_0x7042('0x1c')]);}_0x1ce11d[_0x7042('0x56')]=qs['sort'](_0x501a3e[_0x7042('0x2e')][_0x7042('0x36')]);_0x1ce11d['where']=qs[_0x7042('0x30')](_[_0x7042('0x37')](_0x501a3e[_0x7042('0x2e')],_0x50058b[_0x7042('0x30')]));_0x1ce11d[_0x7042('0x39')][_0x7042('0x57')]=_0x3bdb8b['id'];if(_0x501a3e['query'][_0x7042('0x38')]){_0x1ce11d[_0x7042('0x39')]=_['merge'](_0x1ce11d[_0x7042('0x39')],{'$or':_[_0x7042('0x29')](_0x1ce11d[_0x7042('0x33')],function(_0x25dd26){var _0x28dbdc={};_0x28dbdc[_0x25dd26]={'$like':'%'+_0x501a3e['query'][_0x7042('0x38')]+'%'};return _0x28dbdc;})});}_0x1ce11d=_[_0x7042('0x3a')]({},_0x1ce11d,_0x501a3e['options']);return db[_0x7042('0x5e')][_0x7042('0x1b')]({'where':_0x1ce11d[_0x7042('0x39')]})[_0x7042('0x21')](function(_0xf85af2){_0x94ea96['count']=_0xf85af2;if(_0x501a3e[_0x7042('0x2e')][_0x7042('0x3d')]){_0x1ce11d[_0x7042('0x3e')]=[{'all':!![]}];}return db[_0x7042('0x5e')][_0x7042('0x5c')](_0x1ce11d);})[_0x7042('0x21')](function(_0x3e2077){_0x94ea96[_0x7042('0x58')]=_0x3e2077;return _0x94ea96;});}})[_0x7042('0x21')](respondWithFilteredResult(_0x234cba,_0x1ce11d))[_0x7042('0x3f')](handleError(_0x234cba,null));};exports[_0x7042('0x5f')]=function(_0x34a64d,_0x39c85e,_0x5b5f1a){var _0x4a834e={'raw':!![],'where':{}};var _0x5ab8b5={};var _0x60717c={'count':0x0,'rows':[]};return db[_0x7042('0x2a')]['findOne']({'where':{'id':_0x34a64d[_0x7042('0x41')]['id']}})['then'](handleEntityNotFound(_0x39c85e,null))[_0x7042('0x21')](function(_0x5a3095){if(_0x5a3095){_0x5ab8b5[_0x7042('0x2d')]=_[_0x7042('0x2f')](db[_0x7042('0x60')][_0x7042('0x4f')]);_0x5ab8b5['query']=_['keys'](_0x34a64d[_0x7042('0x2e')]);_0x5ab8b5[_0x7042('0x30')]=_[_0x7042('0x31')](_0x5ab8b5[_0x7042('0x2d')],_0x5ab8b5[_0x7042('0x2e')]);_0x4a834e['attributes']=_[_0x7042('0x31')](_0x5ab8b5[_0x7042('0x2d')],qs['fields'](_0x34a64d['query'][_0x7042('0x32')]));_0x4a834e[_0x7042('0x33')]=_0x4a834e[_0x7042('0x33')][_0x7042('0x42')]?_0x4a834e[_0x7042('0x33')]:_0x5ab8b5[_0x7042('0x2d')];if(!_0x34a64d[_0x7042('0x2e')][_0x7042('0x34')](_0x7042('0x35'))){_0x4a834e['limit']=qs[_0x7042('0x1d')](_0x34a64d[_0x7042('0x2e')][_0x7042('0x1d')]);_0x4a834e[_0x7042('0x1c')]=qs[_0x7042('0x1c')](_0x34a64d['query']['offset']);}_0x4a834e['order']=qs[_0x7042('0x36')](_0x34a64d[_0x7042('0x2e')]['sort']);_0x4a834e[_0x7042('0x39')]=qs[_0x7042('0x30')](_[_0x7042('0x37')](_0x34a64d[_0x7042('0x2e')],_0x5ab8b5['filters']));_0x4a834e[_0x7042('0x39')][_0x7042('0x57')]=_0x5a3095['id'];if(_0x34a64d[_0x7042('0x2e')][_0x7042('0x38')]){_0x4a834e['where']=_[_0x7042('0x3a')](_0x4a834e[_0x7042('0x39')],{'$or':_['map'](_0x4a834e['attributes'],function(_0x31f374){var _0x34dd15={};_0x34dd15[_0x31f374]={'$like':'%'+_0x34a64d[_0x7042('0x2e')][_0x7042('0x38')]+'%'};return _0x34dd15;})});}_0x4a834e=_[_0x7042('0x3a')]({},_0x4a834e,_0x34a64d[_0x7042('0x3c')]);return db[_0x7042('0x60')][_0x7042('0x1b')]({'where':_0x4a834e[_0x7042('0x39')]})[_0x7042('0x21')](function(_0x333ea4){_0x60717c[_0x7042('0x1b')]=_0x333ea4;if(_0x34a64d[_0x7042('0x2e')][_0x7042('0x3d')]){_0x4a834e[_0x7042('0x3e')]=[{'all':!![]}];}return db[_0x7042('0x60')][_0x7042('0x5c')](_0x4a834e);})[_0x7042('0x21')](function(_0x2935dc){_0x60717c[_0x7042('0x58')]=_0x2935dc;return _0x60717c;});}})[_0x7042('0x21')](respondWithFilteredResult(_0x39c85e,_0x4a834e))[_0x7042('0x3f')](handleError(_0x39c85e,null));};exports['getLists']=function(_0x3f3cd1,_0x268042,_0x60ba4f){var _0x5c9a48={};var _0x75fbfe={};var _0x11d0d8;var _0x44d4b6;return db['Campaign'][_0x7042('0x5a')]({'where':{'id':_0x3f3cd1[_0x7042('0x41')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x268042,null))[_0x7042('0x21')](function(_0x56ad5b){if(_0x56ad5b){_0x11d0d8=_0x56ad5b;_0x75fbfe[_0x7042('0x2d')]=_[_0x7042('0x2f')](db[_0x7042('0x61')][_0x7042('0x4f')]);_0x75fbfe[_0x7042('0x2e')]=_[_0x7042('0x2f')](_0x3f3cd1[_0x7042('0x2e')]);_0x75fbfe[_0x7042('0x30')]=_[_0x7042('0x31')](_0x75fbfe[_0x7042('0x2d')],_0x75fbfe[_0x7042('0x2e')]);_0x5c9a48[_0x7042('0x33')]=_['intersection'](_0x75fbfe[_0x7042('0x2d')],qs[_0x7042('0x32')](_0x3f3cd1[_0x7042('0x2e')][_0x7042('0x32')]));_0x5c9a48[_0x7042('0x33')]=_0x5c9a48['attributes'][_0x7042('0x42')]?_0x5c9a48[_0x7042('0x33')]:_0x75fbfe['model'];_0x5c9a48[_0x7042('0x56')]=qs[_0x7042('0x36')](_0x3f3cd1[_0x7042('0x2e')]['sort']);_0x5c9a48[_0x7042('0x39')]=qs[_0x7042('0x30')](_['pick'](_0x3f3cd1[_0x7042('0x2e')],_0x75fbfe[_0x7042('0x30')]));if(_0x3f3cd1[_0x7042('0x2e')]['filter']){_0x5c9a48[_0x7042('0x39')]=_[_0x7042('0x3a')](_0x5c9a48[_0x7042('0x39')],{'$or':_['map'](_0x5c9a48[_0x7042('0x33')],function(_0x15226f){var _0x51c9da={};_0x51c9da[_0x15226f]={'$like':'%'+_0x3f3cd1[_0x7042('0x2e')]['filter']+'%'};return _0x51c9da;})});}_0x5c9a48=_[_0x7042('0x3a')]({},_0x5c9a48,_0x3f3cd1['options']);return _0x11d0d8['getLists'](_0x5c9a48);}})['then'](function(_0xf0ff98){if(_0xf0ff98){_0x44d4b6=_0xf0ff98['length'];if(!_0x3f3cd1[_0x7042('0x2e')][_0x7042('0x34')](_0x7042('0x35'))){_0x5c9a48[_0x7042('0x1d')]=qs['limit'](_0x3f3cd1[_0x7042('0x2e')][_0x7042('0x1d')]);_0x5c9a48[_0x7042('0x1c')]=qs[_0x7042('0x1c')](_0x3f3cd1[_0x7042('0x2e')][_0x7042('0x1c')]);}return _0x11d0d8[_0x7042('0x62')](_0x5c9a48);}})[_0x7042('0x21')](function(_0x1a4da8){if(_0x1a4da8){return _0x1a4da8?{'count':_0x44d4b6,'rows':_0x1a4da8}:null;}})[_0x7042('0x21')](respondWithResult(_0x268042,null))[_0x7042('0x3f')](handleError(_0x268042,null));};exports[_0x7042('0x63')]=function(_0x484a5e,_0x1ffa4a,_0x29cc7e){var _0x59fe22,_0x5b5c52;var _0x9dfcce=[];var _0x241ef6=moment()[_0x7042('0x64')](_0x7042('0x65'));return db[_0x7042('0x2a')][_0x7042('0x4a')]({'where':{'id':_0x484a5e[_0x7042('0x41')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x1ffa4a,null))[_0x7042('0x21')](function(_0x2502fe){if(_0x2502fe){_0x5b5c52=_0x2502fe;return _0x2502fe[_0x7042('0x63')](_0x484a5e['body'][_0x7042('0x66')],_['omit'](_0x484a5e[_0x7042('0x44')],[_0x7042('0x66'),'id'])||{});}return null;})['spread'](function(_0x526699){var _0x305f11;var _0x112e5c;_0x59fe22=_0x526699||[];var _0x291172=[];if(_0x526699){for(var _0x564e1e=0x0;_0x564e1e<_0x526699[_0x7042('0x42')];_0x564e1e+=0x1){var _0x13f8ec=_0x526699[_0x564e1e][_0x7042('0x23')]({'plain':!![]});_0x5b5c52[_0x7042('0x67')]=_0x484a5e[_0x7042('0x44')][_0x7042('0x67')]?_0x484a5e[_0x7042('0x44')]['dialCheckDuplicateType']:_0x5b5c52[_0x7042('0x67')];switch(_0x5b5c52[_0x7042('0x67')]){case _0x7042('0x68'):_0x305f11=squel['insert']()['into'](_0x7042('0x69'))[_0x7042('0x6a')](['phone','scheduledAt','ContactId',_0x7042('0x6b'),_0x7042('0x57'),_0x7042('0x51'),_0x7042('0x52')],squel[_0x7042('0x6c')]()[_0x7042('0x6d')](_0x7042('0x6e'),_0x7042('0x6e'))[_0x7042('0x6d')]('NOW()',_0x7042('0x6f'))[_0x7042('0x6d')]('id','ContactId')[_0x7042('0x6d')](_0x13f8ec['CmListId'][_0x7042('0x70')](),'ListId')[_0x7042('0x6d')](_0x484a5e[_0x7042('0x41')]['id'][_0x7042('0x70')](),_0x7042('0x57'))['field']('\x27'+_0x241ef6+'\x27',_0x7042('0x51'))[_0x7042('0x6d')]('\x27'+_0x241ef6+'\x27',_0x7042('0x52'))[_0x7042('0x71')]('cm_contacts')[_0x7042('0x39')](_0x7042('0x72'))[_0x7042('0x39')](_0x7042('0x73'),_0x13f8ec[_0x7042('0x74')][_0x7042('0x70')]())[_0x7042('0x39')](_0x7042('0x75'))[_0x7042('0x39')](_0x7042('0x76'),squel[_0x7042('0x6c')]()['field'](_0x7042('0x77'))[_0x7042('0x71')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x484a5e['params']['id']['toString']()))['where'](_0x7042('0x76'),squel['select']()[_0x7042('0x6d')](_0x7042('0x78'))[_0x7042('0x71')](_0x7042('0x69'))[_0x7042('0x39')]('CampaignId\x20=\x20?',_0x484a5e[_0x7042('0x41')]['id'][_0x7042('0x70')]())))[_0x7042('0x70')]();break;case'onlyIfOpen':_0x305f11=squel[_0x7042('0x79')]()[_0x7042('0x7a')]('cm_hopper')[_0x7042('0x6a')]([_0x7042('0x6e'),_0x7042('0x6f'),_0x7042('0x7b'),_0x7042('0x6b'),_0x7042('0x57'),_0x7042('0x51'),'updatedAt'],squel[_0x7042('0x6c')]()[_0x7042('0x6d')](_0x7042('0x6e'),'phone')['field'](_0x7042('0x7c'),_0x7042('0x6f'))['field']('id','ContactId')[_0x7042('0x6d')](_0x13f8ec[_0x7042('0x74')][_0x7042('0x70')](),_0x7042('0x6b'))['field'](_0x484a5e[_0x7042('0x41')]['id'][_0x7042('0x70')](),_0x7042('0x57'))[_0x7042('0x6d')]('\x27'+_0x241ef6+'\x27',_0x7042('0x51'))[_0x7042('0x6d')]('\x27'+_0x241ef6+'\x27','updatedAt')[_0x7042('0x71')](_0x7042('0x7d'))[_0x7042('0x39')](_0x7042('0x72'))[_0x7042('0x39')](_0x7042('0x73'),_0x13f8ec[_0x7042('0x74')][_0x7042('0x70')]())['where'](_0x7042('0x75'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x7042('0x6c')]()['field'](_0x7042('0x78'))[_0x7042('0x71')](_0x7042('0x69'))[_0x7042('0x39')](_0x7042('0x7e'),_0x484a5e[_0x7042('0x41')]['id'][_0x7042('0x70')]())))[_0x7042('0x70')]();break;default:_0x305f11=squel[_0x7042('0x79')]()['into'](_0x7042('0x69'))[_0x7042('0x6a')]([_0x7042('0x6e'),'scheduledAt',_0x7042('0x7b'),'ListId','CampaignId',_0x7042('0x51'),_0x7042('0x52')],squel['select']()[_0x7042('0x6d')]('phone',_0x7042('0x6e'))[_0x7042('0x6d')](_0x7042('0x7c'),_0x7042('0x6f'))[_0x7042('0x6d')]('id',_0x7042('0x7b'))[_0x7042('0x6d')](_0x13f8ec[_0x7042('0x74')][_0x7042('0x70')](),'ListId')['field'](_0x484a5e[_0x7042('0x41')]['id']['toString'](),_0x7042('0x57'))[_0x7042('0x6d')]('\x27'+_0x241ef6+'\x27',_0x7042('0x51'))[_0x7042('0x6d')]('\x27'+_0x241ef6+'\x27',_0x7042('0x52'))['from']('cm_contacts')['where'](_0x7042('0x72'))['where'](_0x7042('0x73'),_0x13f8ec['CmListId']['toString']())['where'](_0x7042('0x75')))[_0x7042('0x70')]();}_0x112e5c=squel[_0x7042('0x79')]()[_0x7042('0x7a')](_0x7042('0x7f'))[_0x7042('0x6a')]([_0x7042('0x80'),_0x7042('0x6f'),_0x7042('0x6e'),'OrderBy',_0x7042('0x51'),_0x7042('0x52')],squel[_0x7042('0x6c')]()[_0x7042('0x6d')]('h.id','id')[_0x7042('0x6d')]('NOW()',_0x7042('0x6f'))[_0x7042('0x6d')]('ci.item',_0x7042('0x6e'))[_0x7042('0x6d')](_0x7042('0x81'),'OrderBy')[_0x7042('0x6d')]('\x27'+_0x241ef6+'\x27',_0x7042('0x51'))[_0x7042('0x6d')]('\x27'+_0x241ef6+'\x27',_0x7042('0x52'))[_0x7042('0x71')](_0x7042('0x82'),'ci')[_0x7042('0x83')](_0x7042('0x69'),'h',_0x7042('0x84'))[_0x7042('0x39')]('h.ListId\x20=\x20?',_0x13f8ec['CmListId'][_0x7042('0x70')]())[_0x7042('0x39')](_0x7042('0x85'),_0x484a5e[_0x7042('0x41')]['id'][_0x7042('0x70')]())[_0x7042('0x39')](_0x7042('0x86'),_0x241ef6))[_0x7042('0x70')]();_0x291172[_0x7042('0x87')](db[_0x7042('0x88')][_0x7042('0x2e')](_0x305f11));_0x9dfcce[_0x7042('0x87')](db[_0x7042('0x88')][_0x7042('0x2e')](_0x112e5c));}return BPromise[_0x7042('0x89')](_0x291172);}})[_0x7042('0x21')](function(){return BPromise[_0x7042('0x89')](_0x9dfcce);})['then'](function(){return _0x59fe22;})['then'](respondWithResult(_0x1ffa4a,null))[_0x7042('0x3f')](handleError(_0x1ffa4a,null));};exports['removeLists']=function(_0x3b407b,_0x3432f7,_0x314db7){return db[_0x7042('0x2a')][_0x7042('0x4a')]({'where':{'id':_0x3b407b[_0x7042('0x41')]['id']}})['then'](handleEntityNotFound(_0x3432f7,null))[_0x7042('0x21')](function(_0x43162e){if(_0x43162e){return _0x43162e[_0x7042('0x8a')](_0x3b407b[_0x7042('0x2e')][_0x7042('0x66')]);}})[_0x7042('0x21')](function(_0x5c66fa){if(_0x5c66fa){return db[_0x7042('0x55')]['destroy']({'where':{'ListId':_0x3b407b['query'][_0x7042('0x66')],'CampaignId':_0x3b407b[_0x7042('0x41')]['id']}})[_0x7042('0x21')](function(){return _0x5c66fa;});}})[_0x7042('0x21')](respondWithStatusCode(_0x3432f7,null))[_0x7042('0x3f')](handleError(_0x3432f7,null));};exports[_0x7042('0x8b')]=function(_0x302339,_0x2ab49a,_0x3b37e9){var _0x218b75={};var _0x4fc9e7={};var _0x392ab5;var _0x591d6d;return db[_0x7042('0x2a')][_0x7042('0x5a')]({'where':{'id':_0x302339[_0x7042('0x41')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x2ab49a,null))['then'](function(_0x10a106){if(_0x10a106){_0x392ab5=_0x10a106;_0x4fc9e7[_0x7042('0x2d')]=_['keys'](db[_0x7042('0x61')][_0x7042('0x4f')]);_0x4fc9e7[_0x7042('0x2e')]=_[_0x7042('0x2f')](_0x302339[_0x7042('0x2e')]);_0x4fc9e7['filters']=_['intersection'](_0x4fc9e7['model'],_0x4fc9e7[_0x7042('0x2e')]);_0x218b75[_0x7042('0x33')]=_[_0x7042('0x31')](_0x4fc9e7['model'],qs['fields'](_0x302339[_0x7042('0x2e')]['fields']));_0x218b75['attributes']=_0x218b75[_0x7042('0x33')][_0x7042('0x42')]?_0x218b75[_0x7042('0x33')]:_0x4fc9e7[_0x7042('0x2d')];_0x218b75[_0x7042('0x56')]=qs[_0x7042('0x36')](_0x302339['query'][_0x7042('0x36')]);_0x218b75[_0x7042('0x39')]=qs[_0x7042('0x30')](_[_0x7042('0x37')](_0x302339[_0x7042('0x2e')],_0x4fc9e7[_0x7042('0x30')]));if(_0x302339['query'][_0x7042('0x38')]){_0x218b75[_0x7042('0x39')]=_[_0x7042('0x3a')](_0x218b75[_0x7042('0x39')],{'$or':_[_0x7042('0x29')](_0x218b75[_0x7042('0x33')],function(_0x5a4529){var _0x57357e={};_0x57357e[_0x5a4529]={'$like':'%'+_0x302339[_0x7042('0x2e')][_0x7042('0x38')]+'%'};return _0x57357e;})});}_0x218b75=_[_0x7042('0x3a')]({},_0x218b75,_0x302339[_0x7042('0x3c')]);return _0x392ab5['getBlackLists'](_0x218b75);}})[_0x7042('0x21')](function(_0xfba18d){if(_0xfba18d){_0x591d6d=_0xfba18d['length'];if(!_0x302339[_0x7042('0x2e')][_0x7042('0x34')]('nolimit')){_0x218b75[_0x7042('0x1d')]=qs[_0x7042('0x1d')](_0x302339[_0x7042('0x2e')]['limit']);_0x218b75['offset']=qs[_0x7042('0x1c')](_0x302339[_0x7042('0x2e')][_0x7042('0x1c')]);}return _0x392ab5['getBlackLists'](_0x218b75);}})['then'](function(_0x55c18b){if(_0x55c18b){return _0x55c18b?{'count':_0x591d6d,'rows':_0x55c18b}:null;}})[_0x7042('0x21')](respondWithResult(_0x2ab49a,null))[_0x7042('0x3f')](handleError(_0x2ab49a,null));};exports[_0x7042('0x8c')]=function(_0x3239cd,_0x14d90e,_0x310266){var _0x589aed,_0x426ba5;var _0x4fce5a=[];var _0x567233=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0x7042('0x2a')]['find']({'where':{'id':_0x3239cd[_0x7042('0x41')]['id']}})['then'](handleEntityNotFound(_0x14d90e,null))[_0x7042('0x21')](function(_0x3e7c8e){if(_0x3e7c8e){_0x426ba5=_0x3e7c8e;return _0x3e7c8e[_0x7042('0x8c')](_0x3239cd[_0x7042('0x44')][_0x7042('0x66')],_[_0x7042('0x50')](_0x3239cd['body'],[_0x7042('0x66'),'id'])||{});}return null;})[_0x7042('0x8d')](function(_0x109a24){var _0x464080;var _0x42242b;_0x589aed=_0x109a24||[];var _0x295a93=[];if(_0x109a24){for(var _0x59b1ef=0x0;_0x59b1ef<_0x109a24[_0x7042('0x42')];_0x59b1ef+=0x1){var _0x1aeb73=_0x109a24[_0x59b1ef][_0x7042('0x23')]({'plain':!![]});_0x464080=squel['insert']()['into'](_0x7042('0x8e'))['fromQuery'](['phone',_0x7042('0x7b'),'ListId',_0x7042('0x57'),_0x7042('0x51'),_0x7042('0x52')],squel[_0x7042('0x6c')]()['field']('phone','phone')[_0x7042('0x6d')]('id',_0x7042('0x7b'))[_0x7042('0x6d')](_0x1aeb73[_0x7042('0x74')][_0x7042('0x70')](),_0x7042('0x6b'))[_0x7042('0x6d')](_0x3239cd[_0x7042('0x41')]['id'][_0x7042('0x70')](),_0x7042('0x57'))[_0x7042('0x6d')](_0x7042('0x7c'),_0x7042('0x51'))[_0x7042('0x6d')](_0x7042('0x7c'),_0x7042('0x52'))[_0x7042('0x71')](_0x7042('0x7d'))['where'](_0x7042('0x72'))['where']('ListId\x20=\x20?',_0x1aeb73[_0x7042('0x74')][_0x7042('0x70')]())[_0x7042('0x39')](_0x7042('0x75')))[_0x7042('0x70')]();_0x295a93[_0x7042('0x87')](db[_0x7042('0x88')][_0x7042('0x2e')](_0x464080));}return BPromise[_0x7042('0x89')](_0x295a93);}})['then'](function(){return _0x589aed;})[_0x7042('0x21')](respondWithResult(_0x14d90e,null))[_0x7042('0x3f')](handleError(_0x14d90e,null));};exports['removeBlackLists']=function(_0x18b18d,_0x4aed19,_0x36d558){return db[_0x7042('0x2a')][_0x7042('0x4a')]({'where':{'id':_0x18b18d[_0x7042('0x41')]['id']}})['then'](handleEntityNotFound(_0x4aed19,null))[_0x7042('0x21')](function(_0x5cfdaf){if(_0x5cfdaf){return _0x5cfdaf[_0x7042('0x8f')](_0x18b18d['query']['ids']);}})[_0x7042('0x21')](function(_0x3929db){if(_0x3929db){return db[_0x7042('0x60')][_0x7042('0x22')]({'where':{'ListId':_0x18b18d[_0x7042('0x2e')][_0x7042('0x66')],'CampaignId':_0x18b18d[_0x7042('0x41')]['id']}})[_0x7042('0x21')](function(){return _0x3929db;});}})['then'](respondWithStatusCode(_0x4aed19,null))['catch'](handleError(_0x4aed19,null));}; \ No newline at end of file +var _0xf269=['params','omit','createdAt','updatedAt','body','getHoppers','CampaignId','CmHopper','findOne','CmHopperHistory','filter','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','spread','removeBlackLists','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone'];(function(_0x9fce47,_0x38c3e6){var _0x29e671=function(_0x1f4a62){while(--_0x1f4a62){_0x9fce47['push'](_0x9fce47['shift']());}};_0x29e671(++_0x38c3e6);}(_0xf269,0xd2));var _0x9f26=function(_0x34ed48,_0x2cc995){_0x34ed48=_0x34ed48-0x0;var _0x37da5c=_0xf269[_0x34ed48];return _0x37da5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f26('0x0'));var zipdir=require(_0x9f26('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f26('0x2'));var moment=require(_0x9f26('0x3'));var BPromise=require(_0x9f26('0x4'));var Mustache=require('mustache');var util=require(_0x9f26('0x5'));var path=require('path');var sox=require(_0x9f26('0x6'));var csv=require(_0x9f26('0x7'));var ejs=require(_0x9f26('0x8'));var fs=require('fs');var fs_extra=require(_0x9f26('0x9'));var _=require(_0x9f26('0xa'));var squel=require(_0x9f26('0xb'));var crypto=require(_0x9f26('0xc'));var jsforce=require(_0x9f26('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9f26('0xe'));var Redis=require(_0x9f26('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f26('0x10'));var hardwareService=require(_0x9f26('0x11'));var logger=require(_0x9f26('0x12'))(_0x9f26('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9f26('0x14'))['db'];function respondWithStatusCode(_0x2f2c78,_0x4f24f4){_0x4f24f4=_0x4f24f4||0xcc;return function(_0xc464ee){if(_0xc464ee){return _0x2f2c78[_0x9f26('0x15')](_0x4f24f4);}return _0x2f2c78[_0x9f26('0x16')](_0x4f24f4)[_0x9f26('0x17')]();};}function respondWithResult(_0x1718f8,_0x511228){_0x511228=_0x511228||0xc8;return function(_0x259395){if(_0x259395){return _0x1718f8[_0x9f26('0x16')](_0x511228)[_0x9f26('0x18')](_0x259395);}};}function respondWithFilteredResult(_0x5f2dfa,_0x307cb4){return function(_0x71944f){if(_0x71944f){var _0x212c4e=typeof _0x307cb4[_0x9f26('0x19')]===_0x9f26('0x1a')&&typeof _0x307cb4['limit']===_0x9f26('0x1a');var _0x25c021=_0x71944f[_0x9f26('0x1b')];var _0x126996=_0x212c4e?0x0:_0x307cb4[_0x9f26('0x19')];var _0x2a0f6d=_0x212c4e?_0x71944f['count']:_0x307cb4['offset']+_0x307cb4[_0x9f26('0x1c')];var _0x573636;if(_0x2a0f6d>=_0x25c021){_0x2a0f6d=_0x25c021;_0x573636=0xc8;}else{_0x573636=0xce;}_0x5f2dfa[_0x9f26('0x16')](_0x573636);return _0x5f2dfa[_0x9f26('0x1d')](_0x9f26('0x1e'),_0x126996+'-'+_0x2a0f6d+'/'+_0x25c021)[_0x9f26('0x18')](_0x71944f);}return null;};}function patchUpdates(_0xa2a523){return function(_0x2c9bb3){try{jsonpatch[_0x9f26('0x1f')](_0x2c9bb3,_0xa2a523,!![]);}catch(_0x5a7ace){return BPromise[_0x9f26('0x20')](_0x5a7ace);}return _0x2c9bb3[_0x9f26('0x21')]();};}function saveUpdates(_0x12defd,_0x38af34){return function(_0x4503c9){if(_0x4503c9){return _0x4503c9[_0x9f26('0x22')](_0x12defd)[_0x9f26('0x23')](function(_0x1d47e7){return _0x1d47e7;});}return null;};}function removeEntity(_0xd38c5,_0x298510){return function(_0xe9d254){if(_0xe9d254){return _0xe9d254[_0x9f26('0x24')]()['then'](function(){var _0x3e7b54=_0xe9d254[_0x9f26('0x25')]({'plain':!![]});var _0x6da052=_0x9f26('0x26');return db[_0x9f26('0x27')][_0x9f26('0x24')]({'where':{'type':_0x6da052,'resourceId':_0x3e7b54['id']}})['then'](function(){return _0xe9d254;});})[_0x9f26('0x23')](function(){_0xd38c5[_0x9f26('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1973,_0x100fb5){return function(_0x53f00d){if(!_0x53f00d){_0x5f1973[_0x9f26('0x15')](0x194);}return _0x53f00d;};}function handleError(_0x55e50f,_0x44a51e){_0x44a51e=_0x44a51e||0x1f4;return function(_0x25168b){logger[_0x9f26('0x28')](_0x25168b[_0x9f26('0x29')]);if(_0x25168b[_0x9f26('0x2a')]){delete _0x25168b[_0x9f26('0x2a')];}_0x55e50f[_0x9f26('0x16')](_0x44a51e)[_0x9f26('0x2b')](_0x25168b);};}exports[_0x9f26('0x2c')]=function(_0x2ad80b,_0x2cc229){var _0x3844ab={},_0x2dbdf9={},_0x24fcec={'count':0x0,'rows':[]};var _0x1ad5d5=_[_0x9f26('0x2d')](db[_0x9f26('0x2e')][_0x9f26('0x2f')],function(_0x41bc57){return{'name':_0x41bc57[_0x9f26('0x30')],'type':_0x41bc57[_0x9f26('0x31')][_0x9f26('0x32')]};});_0x2dbdf9[_0x9f26('0x33')]=_[_0x9f26('0x2d')](_0x1ad5d5,'name');_0x2dbdf9[_0x9f26('0x34')]=_[_0x9f26('0x35')](_0x2ad80b[_0x9f26('0x34')]);_0x2dbdf9[_0x9f26('0x36')]=_[_0x9f26('0x37')](_0x2dbdf9[_0x9f26('0x33')],_0x2dbdf9['query']);_0x3844ab['attributes']=_['intersection'](_0x2dbdf9[_0x9f26('0x33')],qs[_0x9f26('0x38')](_0x2ad80b['query'][_0x9f26('0x38')]));_0x3844ab[_0x9f26('0x39')]=_0x3844ab[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x3844ab[_0x9f26('0x39')]:_0x2dbdf9[_0x9f26('0x33')];if(!_0x2ad80b['query'][_0x9f26('0x3b')](_0x9f26('0x3c'))){_0x3844ab['limit']=qs[_0x9f26('0x1c')](_0x2ad80b['query'][_0x9f26('0x1c')]);_0x3844ab[_0x9f26('0x19')]=qs[_0x9f26('0x19')](_0x2ad80b[_0x9f26('0x34')]['offset']);}_0x3844ab[_0x9f26('0x3d')]=qs[_0x9f26('0x3e')](_0x2ad80b[_0x9f26('0x34')]['sort']);_0x3844ab[_0x9f26('0x3f')]=qs[_0x9f26('0x36')](_[_0x9f26('0x40')](_0x2ad80b[_0x9f26('0x34')],_0x2dbdf9[_0x9f26('0x36')]),_0x1ad5d5);if(_0x2ad80b[_0x9f26('0x34')]['filter']){_0x3844ab[_0x9f26('0x3f')]=_['merge'](_0x3844ab[_0x9f26('0x3f')],{'$or':_[_0x9f26('0x2d')](_0x1ad5d5,function(_0x4aa8a7){if(_0x4aa8a7[_0x9f26('0x31')]!=='VIRTUAL'){var _0xaf8c0f={};_0xaf8c0f[_0x4aa8a7['name']]={'$like':'%'+_0x2ad80b[_0x9f26('0x34')]['filter']+'%'};return _0xaf8c0f;}})});}_0x3844ab=_[_0x9f26('0x41')]({},_0x3844ab,_0x2ad80b[_0x9f26('0x42')]);var _0x34e1f6={'where':_0x3844ab[_0x9f26('0x3f')]};return db[_0x9f26('0x2e')]['count'](_0x34e1f6)[_0x9f26('0x23')](function(_0x2c5245){_0x24fcec['count']=_0x2c5245;if(_0x2ad80b['query'][_0x9f26('0x43')]){_0x3844ab[_0x9f26('0x44')]=[{'all':!![]}];}return db[_0x9f26('0x2e')][_0x9f26('0x45')](_0x3844ab);})['then'](function(_0x343801){_0x24fcec[_0x9f26('0x46')]=_0x343801;return _0x24fcec;})[_0x9f26('0x23')](respondWithFilteredResult(_0x2cc229,_0x3844ab))[_0x9f26('0x47')](handleError(_0x2cc229,null));};exports['show']=function(_0x433d25,_0x57cb8e){var _0x5d54ef={'raw':![],'where':{'id':_0x433d25['params']['id']}},_0x5ef94a={};_0x5ef94a[_0x9f26('0x33')]=_[_0x9f26('0x35')](db[_0x9f26('0x2e')]['rawAttributes']);_0x5ef94a['query']=_[_0x9f26('0x35')](_0x433d25['query']);_0x5ef94a['filters']=_['intersection'](_0x5ef94a[_0x9f26('0x33')],_0x5ef94a[_0x9f26('0x34')]);_0x5d54ef[_0x9f26('0x39')]=_[_0x9f26('0x37')](_0x5ef94a[_0x9f26('0x33')],qs[_0x9f26('0x38')](_0x433d25['query']['fields']));_0x5d54ef[_0x9f26('0x39')]=_0x5d54ef[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x5d54ef[_0x9f26('0x39')]:_0x5ef94a['model'];if(_0x433d25[_0x9f26('0x34')][_0x9f26('0x43')]){_0x5d54ef['include']=[{'all':!![]}];}_0x5d54ef=_['merge']({},_0x5d54ef,_0x433d25[_0x9f26('0x42')]);return db[_0x9f26('0x2e')][_0x9f26('0x48')](_0x5d54ef)[_0x9f26('0x23')](handleEntityNotFound(_0x57cb8e,null))[_0x9f26('0x23')](respondWithResult(_0x57cb8e,null))[_0x9f26('0x47')](handleError(_0x57cb8e,null));};exports['create']=function(_0x1861dc,_0x2504f){return db[_0x9f26('0x2e')]['create'](_0x1861dc['body'],{})[_0x9f26('0x23')](function(_0x3ac946){var _0x1b6468=_0x1861dc[_0x9f26('0x49')][_0x9f26('0x25')]({'plain':!![]});if(!_0x1b6468)throw new Error(_0x9f26('0x4a'));if(_0x1b6468[_0x9f26('0x4b')]==='user'){var _0x3e0c28=_0x3ac946['get']({'plain':!![]});var _0x4722ad=_0x9f26('0x26');return db[_0x9f26('0x4c')][_0x9f26('0x48')]({'where':{'name':_0x4722ad,'userProfileId':_0x1b6468[_0x9f26('0x4d')]},'raw':!![]})[_0x9f26('0x23')](function(_0x1c024b){if(_0x1c024b&&_0x1c024b[_0x9f26('0x4e')]===0x0){return db[_0x9f26('0x27')][_0x9f26('0x4f')]({'name':_0x3e0c28['name'],'resourceId':_0x3e0c28['id'],'type':_0x1c024b[_0x9f26('0x2a')],'sectionId':_0x1c024b['id']},{})[_0x9f26('0x23')](function(){return _0x3ac946;});}else{return _0x3ac946;}})[_0x9f26('0x47')](function(_0x31566a){logger[_0x9f26('0x28')](_0x9f26('0x50'),_0x31566a);throw _0x31566a;});}return _0x3ac946;})['then'](respondWithResult(_0x2504f,0xc9))[_0x9f26('0x47')](handleError(_0x2504f,null));};exports[_0x9f26('0x51')]=function(_0x2dbf08,_0x110750){var _0x121685={'where':{'id':_0x2dbf08[_0x9f26('0x52')]['id']}},_0x416fa5={};_0x416fa5[_0x9f26('0x33')]=_['keys'](db[_0x9f26('0x2e')][_0x9f26('0x2f')]);_0x121685['attributes']=_[_0x9f26('0x37')](_0x416fa5['model'],qs[_0x9f26('0x38')](_0x2dbf08['query'][_0x9f26('0x38')]));_0x121685[_0x9f26('0x39')]=_0x121685[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x121685['attributes']:_0x416fa5['model'];if(_0x2dbf08[_0x9f26('0x34')][_0x9f26('0x43')]){_0x121685['include']=[{'all':!![]}];}_0x121685=_[_0x9f26('0x41')]({},_0x121685,_0x2dbf08[_0x9f26('0x42')]);return db[_0x9f26('0x2e')][_0x9f26('0x48')](_0x121685)[_0x9f26('0x23')](handleEntityNotFound(_0x110750,null))['then'](function(_0x448c58){if(_0x448c58){var _0x25c1ba=_0x448c58[_0x9f26('0x25')]({'plain':!![]});_0x25c1ba=qs[_0x9f26('0x53')](_0x25c1ba,['id',_0x9f26('0x54'),_0x9f26('0x55')]);_0x2dbf08['body']=_[_0x9f26('0x53')](_0x2dbf08[_0x9f26('0x56')],['id',_0x9f26('0x54'),_0x9f26('0x55')]);return db['Campaign'][_0x9f26('0x4f')](_[_0x9f26('0x41')](_0x25c1ba,_0x2dbf08[_0x9f26('0x56')]),{'include':_0x2dbf08[_0x9f26('0x34')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x171cec){var _0x200020=_0x2dbf08['user'][_0x9f26('0x25')]({'plain':!![]});if(!_0x200020)throw new Error(_0x9f26('0x4a'));if(_0x200020[_0x9f26('0x4b')]===_0x9f26('0x49')){var _0x320950=_0x171cec['get']({'plain':!![]});var _0x271c83=_0x9f26('0x26');return db[_0x9f26('0x4c')]['find']({'where':{'name':_0x271c83,'userProfileId':_0x200020['userProfileId']},'raw':!![]})[_0x9f26('0x23')](function(_0x39c1e5){if(_0x39c1e5&&_0x39c1e5[_0x9f26('0x4e')]===0x0){return db[_0x9f26('0x27')]['create']({'name':_0x320950[_0x9f26('0x2a')],'resourceId':_0x320950['id'],'type':_0x39c1e5[_0x9f26('0x2a')],'sectionId':_0x39c1e5['id']},{})[_0x9f26('0x23')](function(){return _0x171cec;});}else{return _0x171cec;}})[_0x9f26('0x47')](function(_0x175293){logger[_0x9f26('0x28')](_0x9f26('0x50'),_0x175293);throw _0x175293;});}return _0x171cec;});}})[_0x9f26('0x23')](respondWithResult(_0x110750,0xc9))[_0x9f26('0x47')](handleError(_0x110750,null));};exports[_0x9f26('0x22')]=function(_0x281a61,_0x3c2926){if(_0x281a61[_0x9f26('0x56')]['id']){delete _0x281a61[_0x9f26('0x56')]['id'];}return db['Campaign'][_0x9f26('0x48')]({'where':{'id':_0x281a61[_0x9f26('0x52')]['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x3c2926,null))[_0x9f26('0x23')](saveUpdates(_0x281a61[_0x9f26('0x56')],null))[_0x9f26('0x23')](respondWithResult(_0x3c2926,null))['catch'](handleError(_0x3c2926,null));};exports['destroy']=function(_0x27fd0f,_0x5aba94){return db[_0x9f26('0x2e')][_0x9f26('0x48')]({'where':{'id':_0x27fd0f[_0x9f26('0x52')]['id']}})['then'](handleEntityNotFound(_0x5aba94,null))[_0x9f26('0x23')](removeEntity(_0x5aba94,null))[_0x9f26('0x47')](handleError(_0x5aba94,null));};exports[_0x9f26('0x57')]=function(_0x5e91da,_0x455859,_0x412dd8){var _0x4655b8={'raw':!![],'where':{}};var _0x244c89={};var _0x240306={'count':0x0,'rows':[]};return db[_0x9f26('0x2e')]['findOne']({'where':{'id':_0x5e91da[_0x9f26('0x52')]['id']}})['then'](handleEntityNotFound(_0x455859,null))['then'](function(_0x267a33){if(_0x267a33){_0x244c89[_0x9f26('0x33')]=_[_0x9f26('0x35')](db['CmHopper'][_0x9f26('0x2f')]);_0x244c89[_0x9f26('0x34')]=_[_0x9f26('0x35')](_0x5e91da[_0x9f26('0x34')]);_0x244c89[_0x9f26('0x36')]=_[_0x9f26('0x37')](_0x244c89[_0x9f26('0x33')],_0x244c89[_0x9f26('0x34')]);_0x4655b8[_0x9f26('0x39')]=_[_0x9f26('0x37')](_0x244c89['model'],qs['fields'](_0x5e91da[_0x9f26('0x34')][_0x9f26('0x38')]));_0x4655b8[_0x9f26('0x39')]=_0x4655b8[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x4655b8['attributes']:_0x244c89[_0x9f26('0x33')];if(!_0x5e91da[_0x9f26('0x34')][_0x9f26('0x3b')]('nolimit')){_0x4655b8[_0x9f26('0x1c')]=qs['limit'](_0x5e91da[_0x9f26('0x34')][_0x9f26('0x1c')]);_0x4655b8['offset']=qs[_0x9f26('0x19')](_0x5e91da[_0x9f26('0x34')]['offset']);}_0x4655b8[_0x9f26('0x3d')]=qs[_0x9f26('0x3e')](_0x5e91da[_0x9f26('0x34')]['sort']);_0x4655b8[_0x9f26('0x3f')]=qs[_0x9f26('0x36')](_[_0x9f26('0x40')](_0x5e91da[_0x9f26('0x34')],_0x244c89['filters']));_0x4655b8[_0x9f26('0x3f')][_0x9f26('0x58')]=_0x267a33['id'];if(_0x5e91da[_0x9f26('0x34')]['filter']){_0x4655b8[_0x9f26('0x3f')]=_['merge'](_0x4655b8['where'],{'$or':_[_0x9f26('0x2d')](_0x4655b8['attributes'],function(_0x3fb2c3){var _0x3639c4={};_0x3639c4[_0x3fb2c3]={'$like':'%'+_0x5e91da[_0x9f26('0x34')]['filter']+'%'};return _0x3639c4;})});}_0x4655b8=_['merge']({},_0x4655b8,_0x5e91da['options']);return db[_0x9f26('0x59')]['count']({'where':_0x4655b8[_0x9f26('0x3f')]})[_0x9f26('0x23')](function(_0x40e736){_0x240306['count']=_0x40e736;if(_0x5e91da['query'][_0x9f26('0x43')]){_0x4655b8[_0x9f26('0x44')]=[{'all':!![]}];}return db[_0x9f26('0x59')]['findAll'](_0x4655b8);})[_0x9f26('0x23')](function(_0x4c7a80){_0x240306[_0x9f26('0x46')]=_0x4c7a80;return _0x240306;});}})[_0x9f26('0x23')](respondWithFilteredResult(_0x455859,_0x4655b8))[_0x9f26('0x47')](handleError(_0x455859,null));};exports['getHopperHistories']=function(_0x147f6d,_0x3e9309,_0x490c1a){var _0x495341={'raw':!![],'where':{}};var _0x31921f={};var _0x16d8ca={'count':0x0,'rows':[]};return db['Campaign'][_0x9f26('0x5a')]({'where':{'id':_0x147f6d['params']['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x3e9309,null))[_0x9f26('0x23')](function(_0x591713){if(_0x591713){_0x31921f[_0x9f26('0x33')]=_[_0x9f26('0x35')](db[_0x9f26('0x5b')]['rawAttributes']);_0x31921f[_0x9f26('0x34')]=_['keys'](_0x147f6d[_0x9f26('0x34')]);_0x31921f[_0x9f26('0x36')]=_[_0x9f26('0x37')](_0x31921f[_0x9f26('0x33')],_0x31921f[_0x9f26('0x34')]);_0x495341['attributes']=_[_0x9f26('0x37')](_0x31921f[_0x9f26('0x33')],qs[_0x9f26('0x38')](_0x147f6d[_0x9f26('0x34')][_0x9f26('0x38')]));_0x495341['attributes']=_0x495341[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x495341[_0x9f26('0x39')]:_0x31921f['model'];if(!_0x147f6d[_0x9f26('0x34')][_0x9f26('0x3b')](_0x9f26('0x3c'))){_0x495341[_0x9f26('0x1c')]=qs[_0x9f26('0x1c')](_0x147f6d[_0x9f26('0x34')]['limit']);_0x495341[_0x9f26('0x19')]=qs['offset'](_0x147f6d[_0x9f26('0x34')][_0x9f26('0x19')]);}_0x495341[_0x9f26('0x3d')]=qs[_0x9f26('0x3e')](_0x147f6d[_0x9f26('0x34')][_0x9f26('0x3e')]);_0x495341[_0x9f26('0x3f')]=qs[_0x9f26('0x36')](_[_0x9f26('0x40')](_0x147f6d[_0x9f26('0x34')],_0x31921f[_0x9f26('0x36')]));_0x495341['where']['CampaignId']=_0x591713['id'];if(_0x147f6d[_0x9f26('0x34')][_0x9f26('0x5c')]){_0x495341[_0x9f26('0x3f')]=_['merge'](_0x495341['where'],{'$or':_[_0x9f26('0x2d')](_0x495341[_0x9f26('0x39')],function(_0xe5f90){var _0x5c77b4={};_0x5c77b4[_0xe5f90]={'$like':'%'+_0x147f6d[_0x9f26('0x34')]['filter']+'%'};return _0x5c77b4;})});}_0x495341=_[_0x9f26('0x41')]({},_0x495341,_0x147f6d['options']);return db[_0x9f26('0x5b')][_0x9f26('0x1b')]({'where':_0x495341[_0x9f26('0x3f')]})[_0x9f26('0x23')](function(_0x14301a){_0x16d8ca[_0x9f26('0x1b')]=_0x14301a;if(_0x147f6d['query'][_0x9f26('0x43')]){_0x495341[_0x9f26('0x44')]=[{'all':!![]}];}return db[_0x9f26('0x5b')]['findAll'](_0x495341);})[_0x9f26('0x23')](function(_0x10182){_0x16d8ca[_0x9f26('0x46')]=_0x10182;return _0x16d8ca;});}})['then'](respondWithFilteredResult(_0x3e9309,_0x495341))[_0x9f26('0x47')](handleError(_0x3e9309,null));};exports[_0x9f26('0x5d')]=function(_0x265bfe,_0x4cd276,_0xca1075){var _0x191c8d={'raw':!![],'where':{}};var _0x362da3={};var _0x5b6383={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x265bfe['params']['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x4cd276,null))[_0x9f26('0x23')](function(_0x3a78cc){if(_0x3a78cc){_0x362da3[_0x9f26('0x33')]=_['keys'](db[_0x9f26('0x5e')][_0x9f26('0x2f')]);_0x362da3['query']=_[_0x9f26('0x35')](_0x265bfe[_0x9f26('0x34')]);_0x362da3[_0x9f26('0x36')]=_[_0x9f26('0x37')](_0x362da3[_0x9f26('0x33')],_0x362da3[_0x9f26('0x34')]);_0x191c8d['attributes']=_[_0x9f26('0x37')](_0x362da3[_0x9f26('0x33')],qs[_0x9f26('0x38')](_0x265bfe['query'][_0x9f26('0x38')]));_0x191c8d['attributes']=_0x191c8d[_0x9f26('0x39')]['length']?_0x191c8d[_0x9f26('0x39')]:_0x362da3[_0x9f26('0x33')];if(!_0x265bfe[_0x9f26('0x34')][_0x9f26('0x3b')](_0x9f26('0x3c'))){_0x191c8d[_0x9f26('0x1c')]=qs[_0x9f26('0x1c')](_0x265bfe[_0x9f26('0x34')]['limit']);_0x191c8d['offset']=qs[_0x9f26('0x19')](_0x265bfe[_0x9f26('0x34')]['offset']);}_0x191c8d[_0x9f26('0x3d')]=qs[_0x9f26('0x3e')](_0x265bfe[_0x9f26('0x34')][_0x9f26('0x3e')]);_0x191c8d[_0x9f26('0x3f')]=qs[_0x9f26('0x36')](_[_0x9f26('0x40')](_0x265bfe[_0x9f26('0x34')],_0x362da3['filters']));_0x191c8d['where'][_0x9f26('0x58')]=_0x3a78cc['id'];if(_0x265bfe['query']['filter']){_0x191c8d[_0x9f26('0x3f')]=_[_0x9f26('0x41')](_0x191c8d[_0x9f26('0x3f')],{'$or':_[_0x9f26('0x2d')](_0x191c8d[_0x9f26('0x39')],function(_0x4d2719){var _0x261a04={};_0x261a04[_0x4d2719]={'$like':'%'+_0x265bfe['query'][_0x9f26('0x5c')]+'%'};return _0x261a04;})});}_0x191c8d=_[_0x9f26('0x41')]({},_0x191c8d,_0x265bfe[_0x9f26('0x42')]);return db[_0x9f26('0x5e')]['count']({'where':_0x191c8d[_0x9f26('0x3f')]})[_0x9f26('0x23')](function(_0x595f35){_0x5b6383['count']=_0x595f35;if(_0x265bfe[_0x9f26('0x34')][_0x9f26('0x43')]){_0x191c8d[_0x9f26('0x44')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x9f26('0x45')](_0x191c8d);})[_0x9f26('0x23')](function(_0x16c281){_0x5b6383[_0x9f26('0x46')]=_0x16c281;return _0x5b6383;});}})[_0x9f26('0x23')](respondWithFilteredResult(_0x4cd276,_0x191c8d))['catch'](handleError(_0x4cd276,null));};exports['getHopperBlacks']=function(_0x40e8b5,_0x10fca9,_0x12d63a){var _0x379749={'raw':!![],'where':{}};var _0x40b9fd={};var _0x121968={'count':0x0,'rows':[]};return db['Campaign'][_0x9f26('0x5a')]({'where':{'id':_0x40e8b5['params']['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x10fca9,null))[_0x9f26('0x23')](function(_0x22da40){if(_0x22da40){_0x40b9fd['model']=_[_0x9f26('0x35')](db[_0x9f26('0x5f')][_0x9f26('0x2f')]);_0x40b9fd['query']=_[_0x9f26('0x35')](_0x40e8b5[_0x9f26('0x34')]);_0x40b9fd[_0x9f26('0x36')]=_[_0x9f26('0x37')](_0x40b9fd[_0x9f26('0x33')],_0x40b9fd['query']);_0x379749[_0x9f26('0x39')]=_[_0x9f26('0x37')](_0x40b9fd[_0x9f26('0x33')],qs['fields'](_0x40e8b5[_0x9f26('0x34')][_0x9f26('0x38')]));_0x379749['attributes']=_0x379749[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x379749[_0x9f26('0x39')]:_0x40b9fd[_0x9f26('0x33')];if(!_0x40e8b5['query']['hasOwnProperty']('nolimit')){_0x379749['limit']=qs[_0x9f26('0x1c')](_0x40e8b5[_0x9f26('0x34')][_0x9f26('0x1c')]);_0x379749[_0x9f26('0x19')]=qs[_0x9f26('0x19')](_0x40e8b5[_0x9f26('0x34')][_0x9f26('0x19')]);}_0x379749[_0x9f26('0x3d')]=qs['sort'](_0x40e8b5[_0x9f26('0x34')][_0x9f26('0x3e')]);_0x379749[_0x9f26('0x3f')]=qs[_0x9f26('0x36')](_[_0x9f26('0x40')](_0x40e8b5[_0x9f26('0x34')],_0x40b9fd['filters']));_0x379749[_0x9f26('0x3f')][_0x9f26('0x58')]=_0x22da40['id'];if(_0x40e8b5[_0x9f26('0x34')][_0x9f26('0x5c')]){_0x379749[_0x9f26('0x3f')]=_[_0x9f26('0x41')](_0x379749[_0x9f26('0x3f')],{'$or':_[_0x9f26('0x2d')](_0x379749[_0x9f26('0x39')],function(_0x369fcd){var _0x567a48={};_0x567a48[_0x369fcd]={'$like':'%'+_0x40e8b5[_0x9f26('0x34')][_0x9f26('0x5c')]+'%'};return _0x567a48;})});}_0x379749=_[_0x9f26('0x41')]({},_0x379749,_0x40e8b5[_0x9f26('0x42')]);return db['CmHopperBlack'][_0x9f26('0x1b')]({'where':_0x379749['where']})[_0x9f26('0x23')](function(_0x160367){_0x121968[_0x9f26('0x1b')]=_0x160367;if(_0x40e8b5['query']['includeAll']){_0x379749[_0x9f26('0x44')]=[{'all':!![]}];}return db[_0x9f26('0x5f')][_0x9f26('0x45')](_0x379749);})[_0x9f26('0x23')](function(_0x3d5f0d){_0x121968[_0x9f26('0x46')]=_0x3d5f0d;return _0x121968;});}})[_0x9f26('0x23')](respondWithFilteredResult(_0x10fca9,_0x379749))[_0x9f26('0x47')](handleError(_0x10fca9,null));};exports[_0x9f26('0x60')]=function(_0x3fdeb3,_0x136c4a,_0xffa336){var _0xa8cc10={};var _0x167a2f={};var _0x12be76;var _0x5bc39c;return db['Campaign']['findOne']({'where':{'id':_0x3fdeb3[_0x9f26('0x52')]['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x136c4a,null))[_0x9f26('0x23')](function(_0x1f4be5){if(_0x1f4be5){_0x12be76=_0x1f4be5;_0x167a2f[_0x9f26('0x33')]=_[_0x9f26('0x35')](db[_0x9f26('0x61')][_0x9f26('0x2f')]);_0x167a2f[_0x9f26('0x34')]=_['keys'](_0x3fdeb3[_0x9f26('0x34')]);_0x167a2f[_0x9f26('0x36')]=_['intersection'](_0x167a2f[_0x9f26('0x33')],_0x167a2f['query']);_0xa8cc10[_0x9f26('0x39')]=_['intersection'](_0x167a2f[_0x9f26('0x33')],qs[_0x9f26('0x38')](_0x3fdeb3['query'][_0x9f26('0x38')]));_0xa8cc10['attributes']=_0xa8cc10[_0x9f26('0x39')][_0x9f26('0x3a')]?_0xa8cc10[_0x9f26('0x39')]:_0x167a2f[_0x9f26('0x33')];_0xa8cc10[_0x9f26('0x3d')]=qs[_0x9f26('0x3e')](_0x3fdeb3[_0x9f26('0x34')]['sort']);_0xa8cc10[_0x9f26('0x3f')]=qs[_0x9f26('0x36')](_['pick'](_0x3fdeb3[_0x9f26('0x34')],_0x167a2f['filters']));if(_0x3fdeb3['query'][_0x9f26('0x5c')]){_0xa8cc10[_0x9f26('0x3f')]=_[_0x9f26('0x41')](_0xa8cc10[_0x9f26('0x3f')],{'$or':_[_0x9f26('0x2d')](_0xa8cc10[_0x9f26('0x39')],function(_0x4ec9e5){var _0x40d9b8={};_0x40d9b8[_0x4ec9e5]={'$like':'%'+_0x3fdeb3[_0x9f26('0x34')][_0x9f26('0x5c')]+'%'};return _0x40d9b8;})});}_0xa8cc10=_[_0x9f26('0x41')]({},_0xa8cc10,_0x3fdeb3['options']);return _0x12be76['getLists'](_0xa8cc10);}})[_0x9f26('0x23')](function(_0x176243){if(_0x176243){_0x5bc39c=_0x176243['length'];if(!_0x3fdeb3[_0x9f26('0x34')][_0x9f26('0x3b')](_0x9f26('0x3c'))){_0xa8cc10[_0x9f26('0x1c')]=qs[_0x9f26('0x1c')](_0x3fdeb3[_0x9f26('0x34')][_0x9f26('0x1c')]);_0xa8cc10['offset']=qs[_0x9f26('0x19')](_0x3fdeb3[_0x9f26('0x34')][_0x9f26('0x19')]);}return _0x12be76[_0x9f26('0x60')](_0xa8cc10);}})['then'](function(_0xe6d1d5){if(_0xe6d1d5){return _0xe6d1d5?{'count':_0x5bc39c,'rows':_0xe6d1d5}:null;}})[_0x9f26('0x23')](respondWithResult(_0x136c4a,null))[_0x9f26('0x47')](handleError(_0x136c4a,null));};exports[_0x9f26('0x62')]=function(_0x53c5cb,_0x46c0d6,_0x199287){var _0x12d09e,_0x5b3419;var _0x1a6551=[];var _0x23d8a3=moment()[_0x9f26('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x9f26('0x2e')][_0x9f26('0x48')]({'where':{'id':_0x53c5cb[_0x9f26('0x52')]['id']}})['then'](handleEntityNotFound(_0x46c0d6,null))[_0x9f26('0x23')](function(_0x434dd4){if(_0x434dd4){_0x5b3419=_0x434dd4;return _0x434dd4[_0x9f26('0x62')](_0x53c5cb[_0x9f26('0x56')][_0x9f26('0x64')],_[_0x9f26('0x53')](_0x53c5cb[_0x9f26('0x56')],[_0x9f26('0x64'),'id'])||{});}return null;})['spread'](function(_0x2ca1bf){var _0x2d2ce0;var _0x416300;_0x12d09e=_0x2ca1bf||[];var _0x241145=[];if(_0x2ca1bf){for(var _0x4a88e3=0x0;_0x4a88e3<_0x2ca1bf[_0x9f26('0x3a')];_0x4a88e3+=0x1){var _0x18429a=_0x2ca1bf[_0x4a88e3]['get']({'plain':!![]});_0x5b3419[_0x9f26('0x65')]=_0x53c5cb['body']['dialCheckDuplicateType']?_0x53c5cb[_0x9f26('0x56')][_0x9f26('0x65')]:_0x5b3419[_0x9f26('0x65')];switch(_0x5b3419['dialCheckDuplicateType']){case'always':_0x2d2ce0=squel[_0x9f26('0x66')]()[_0x9f26('0x67')](_0x9f26('0x68'))[_0x9f26('0x69')]([_0x9f26('0x6a'),_0x9f26('0x6b'),_0x9f26('0x6c'),_0x9f26('0x6d'),_0x9f26('0x58'),_0x9f26('0x54'),_0x9f26('0x55')],squel[_0x9f26('0x6e')]()[_0x9f26('0x6f')](_0x9f26('0x6a'),'phone')[_0x9f26('0x6f')](_0x9f26('0x70'),_0x9f26('0x6b'))[_0x9f26('0x6f')]('id','ContactId')[_0x9f26('0x6f')](_0x18429a['CmListId'][_0x9f26('0x71')](),'ListId')[_0x9f26('0x6f')](_0x53c5cb[_0x9f26('0x52')]['id']['toString'](),_0x9f26('0x58'))[_0x9f26('0x6f')]('\x27'+_0x23d8a3+'\x27',_0x9f26('0x54'))[_0x9f26('0x6f')]('\x27'+_0x23d8a3+'\x27','updatedAt')[_0x9f26('0x72')](_0x9f26('0x73'))[_0x9f26('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0x9f26('0x74'),_0x18429a[_0x9f26('0x75')]['toString']())[_0x9f26('0x3f')](_0x9f26('0x76'))[_0x9f26('0x3f')](_0x9f26('0x77'),squel['select']()[_0x9f26('0x6f')](_0x9f26('0x78'))['from']('cm_hopper_final')[_0x9f26('0x3f')](_0x9f26('0x79'),_0x53c5cb[_0x9f26('0x52')]['id'][_0x9f26('0x71')]()))[_0x9f26('0x3f')](_0x9f26('0x77'),squel[_0x9f26('0x6e')]()[_0x9f26('0x6f')](_0x9f26('0x7a'))[_0x9f26('0x72')](_0x9f26('0x68'))['where'](_0x9f26('0x79'),_0x53c5cb['params']['id']['toString']())))[_0x9f26('0x71')]();break;case _0x9f26('0x7b'):_0x2d2ce0=squel[_0x9f26('0x66')]()['into'](_0x9f26('0x68'))[_0x9f26('0x69')](['phone','scheduledAt',_0x9f26('0x6c'),'ListId','CampaignId',_0x9f26('0x54'),_0x9f26('0x55')],squel[_0x9f26('0x6e')]()[_0x9f26('0x6f')]('phone',_0x9f26('0x6a'))[_0x9f26('0x6f')](_0x9f26('0x70'),_0x9f26('0x6b'))[_0x9f26('0x6f')]('id','ContactId')[_0x9f26('0x6f')](_0x18429a[_0x9f26('0x75')][_0x9f26('0x71')](),_0x9f26('0x6d'))[_0x9f26('0x6f')](_0x53c5cb[_0x9f26('0x52')]['id'][_0x9f26('0x71')](),_0x9f26('0x58'))[_0x9f26('0x6f')]('\x27'+_0x23d8a3+'\x27',_0x9f26('0x54'))[_0x9f26('0x6f')]('\x27'+_0x23d8a3+'\x27',_0x9f26('0x55'))[_0x9f26('0x72')]('cm_contacts')[_0x9f26('0x3f')](_0x9f26('0x7c'))['where'](_0x9f26('0x74'),_0x18429a['CmListId'][_0x9f26('0x71')]())[_0x9f26('0x3f')](_0x9f26('0x76'))[_0x9f26('0x3f')](_0x9f26('0x77'),squel[_0x9f26('0x6e')]()['field'](_0x9f26('0x7a'))[_0x9f26('0x72')]('cm_hopper')[_0x9f26('0x3f')](_0x9f26('0x79'),_0x53c5cb[_0x9f26('0x52')]['id'][_0x9f26('0x71')]())))[_0x9f26('0x71')]();break;default:_0x2d2ce0=squel[_0x9f26('0x66')]()['into'](_0x9f26('0x68'))[_0x9f26('0x69')]([_0x9f26('0x6a'),_0x9f26('0x6b'),_0x9f26('0x6c'),'ListId',_0x9f26('0x58'),_0x9f26('0x54'),_0x9f26('0x55')],squel[_0x9f26('0x6e')]()[_0x9f26('0x6f')](_0x9f26('0x6a'),'phone')['field'](_0x9f26('0x70'),_0x9f26('0x6b'))[_0x9f26('0x6f')]('id','ContactId')['field'](_0x18429a[_0x9f26('0x75')][_0x9f26('0x71')](),_0x9f26('0x6d'))[_0x9f26('0x6f')](_0x53c5cb[_0x9f26('0x52')]['id'][_0x9f26('0x71')](),_0x9f26('0x58'))[_0x9f26('0x6f')]('\x27'+_0x23d8a3+'\x27',_0x9f26('0x54'))[_0x9f26('0x6f')]('\x27'+_0x23d8a3+'\x27',_0x9f26('0x55'))[_0x9f26('0x72')](_0x9f26('0x73'))[_0x9f26('0x3f')](_0x9f26('0x7c'))[_0x9f26('0x3f')](_0x9f26('0x74'),_0x18429a[_0x9f26('0x75')][_0x9f26('0x71')]())[_0x9f26('0x3f')](_0x9f26('0x76')))['toString']();}_0x416300=squel[_0x9f26('0x66')]()[_0x9f26('0x67')](_0x9f26('0x7d'))[_0x9f26('0x69')]([_0x9f26('0x7e'),_0x9f26('0x6b'),_0x9f26('0x6a'),_0x9f26('0x7f'),_0x9f26('0x54'),_0x9f26('0x55')],squel['select']()[_0x9f26('0x6f')](_0x9f26('0x80'),'id')[_0x9f26('0x6f')](_0x9f26('0x70'),_0x9f26('0x6b'))['field'](_0x9f26('0x81'),_0x9f26('0x6a'))['field'](_0x9f26('0x82'),_0x9f26('0x7f'))[_0x9f26('0x6f')]('\x27'+_0x23d8a3+'\x27',_0x9f26('0x54'))['field']('\x27'+_0x23d8a3+'\x27',_0x9f26('0x55'))[_0x9f26('0x72')](_0x9f26('0x83'),'ci')[_0x9f26('0x84')]('cm_hopper','h',_0x9f26('0x85'))[_0x9f26('0x3f')](_0x9f26('0x86'),_0x18429a[_0x9f26('0x75')][_0x9f26('0x71')]())[_0x9f26('0x3f')](_0x9f26('0x87'),_0x53c5cb[_0x9f26('0x52')]['id'][_0x9f26('0x71')]())[_0x9f26('0x3f')](_0x9f26('0x88'),_0x23d8a3))['toString']();_0x241145['push'](db[_0x9f26('0x89')][_0x9f26('0x34')](_0x2d2ce0));_0x1a6551[_0x9f26('0x8a')](db[_0x9f26('0x89')][_0x9f26('0x34')](_0x416300));}return BPromise[_0x9f26('0x8b')](_0x241145);}})[_0x9f26('0x23')](function(){return BPromise['all'](_0x1a6551);})['then'](function(){return _0x12d09e;})[_0x9f26('0x23')](respondWithResult(_0x46c0d6,null))['catch'](handleError(_0x46c0d6,null));};exports[_0x9f26('0x8c')]=function(_0x52e353,_0x5da317,_0x430476){return db['Campaign'][_0x9f26('0x48')]({'where':{'id':_0x52e353[_0x9f26('0x52')]['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x5da317,null))[_0x9f26('0x23')](function(_0x571e36){if(_0x571e36){return _0x571e36['removeLists'](_0x52e353[_0x9f26('0x34')][_0x9f26('0x64')]);}})[_0x9f26('0x23')](function(_0x44e8ee){if(_0x44e8ee){return db['CmHopper'][_0x9f26('0x24')]({'where':{'ListId':_0x52e353[_0x9f26('0x34')][_0x9f26('0x64')],'CampaignId':_0x52e353[_0x9f26('0x52')]['id']}})['then'](function(){return _0x44e8ee;});}})[_0x9f26('0x23')](respondWithStatusCode(_0x5da317,null))[_0x9f26('0x47')](handleError(_0x5da317,null));};exports[_0x9f26('0x8d')]=function(_0x161591,_0x42b360,_0x1f8191){var _0x34d7f5={};var _0x275450={};var _0x5704d1;var _0x48d436;return db['Campaign'][_0x9f26('0x5a')]({'where':{'id':_0x161591[_0x9f26('0x52')]['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x42b360,null))[_0x9f26('0x23')](function(_0x37a50e){if(_0x37a50e){_0x5704d1=_0x37a50e;_0x275450[_0x9f26('0x33')]=_[_0x9f26('0x35')](db['CmList'][_0x9f26('0x2f')]);_0x275450['query']=_['keys'](_0x161591[_0x9f26('0x34')]);_0x275450['filters']=_[_0x9f26('0x37')](_0x275450[_0x9f26('0x33')],_0x275450[_0x9f26('0x34')]);_0x34d7f5['attributes']=_[_0x9f26('0x37')](_0x275450['model'],qs['fields'](_0x161591[_0x9f26('0x34')][_0x9f26('0x38')]));_0x34d7f5['attributes']=_0x34d7f5[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x34d7f5[_0x9f26('0x39')]:_0x275450[_0x9f26('0x33')];_0x34d7f5[_0x9f26('0x3d')]=qs[_0x9f26('0x3e')](_0x161591['query'][_0x9f26('0x3e')]);_0x34d7f5[_0x9f26('0x3f')]=qs[_0x9f26('0x36')](_[_0x9f26('0x40')](_0x161591[_0x9f26('0x34')],_0x275450['filters']));if(_0x161591[_0x9f26('0x34')][_0x9f26('0x5c')]){_0x34d7f5['where']=_[_0x9f26('0x41')](_0x34d7f5[_0x9f26('0x3f')],{'$or':_[_0x9f26('0x2d')](_0x34d7f5[_0x9f26('0x39')],function(_0x27ee68){var _0x181ffb={};_0x181ffb[_0x27ee68]={'$like':'%'+_0x161591[_0x9f26('0x34')][_0x9f26('0x5c')]+'%'};return _0x181ffb;})});}_0x34d7f5=_[_0x9f26('0x41')]({},_0x34d7f5,_0x161591[_0x9f26('0x42')]);return _0x5704d1['getBlackLists'](_0x34d7f5);}})[_0x9f26('0x23')](function(_0x1a99e0){if(_0x1a99e0){_0x48d436=_0x1a99e0[_0x9f26('0x3a')];if(!_0x161591[_0x9f26('0x34')][_0x9f26('0x3b')](_0x9f26('0x3c'))){_0x34d7f5[_0x9f26('0x1c')]=qs['limit'](_0x161591['query'][_0x9f26('0x1c')]);_0x34d7f5[_0x9f26('0x19')]=qs[_0x9f26('0x19')](_0x161591[_0x9f26('0x34')][_0x9f26('0x19')]);}return _0x5704d1[_0x9f26('0x8d')](_0x34d7f5);}})[_0x9f26('0x23')](function(_0x58a6a8){if(_0x58a6a8){return _0x58a6a8?{'count':_0x48d436,'rows':_0x58a6a8}:null;}})[_0x9f26('0x23')](respondWithResult(_0x42b360,null))[_0x9f26('0x47')](handleError(_0x42b360,null));};exports[_0x9f26('0x8e')]=function(_0x4315c8,_0x1adcec,_0x33676b){var _0xbb3531,_0x3f880e;var _0x437a7c=[];var _0x1bf17b=moment()[_0x9f26('0x63')](_0x9f26('0x8f'));return db[_0x9f26('0x2e')][_0x9f26('0x48')]({'where':{'id':_0x4315c8[_0x9f26('0x52')]['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x1adcec,null))[_0x9f26('0x23')](function(_0x59ea7a){if(_0x59ea7a){_0x3f880e=_0x59ea7a;return _0x59ea7a[_0x9f26('0x8e')](_0x4315c8[_0x9f26('0x56')][_0x9f26('0x64')],_[_0x9f26('0x53')](_0x4315c8[_0x9f26('0x56')],[_0x9f26('0x64'),'id'])||{});}return null;})[_0x9f26('0x90')](function(_0x2e4ba9){var _0x451109;var _0x398950;_0xbb3531=_0x2e4ba9||[];var _0x2dec34=[];if(_0x2e4ba9){for(var _0x1e9320=0x0;_0x1e9320<_0x2e4ba9[_0x9f26('0x3a')];_0x1e9320+=0x1){var _0x5ba09f=_0x2e4ba9[_0x1e9320][_0x9f26('0x25')]({'plain':!![]});_0x451109=squel[_0x9f26('0x66')]()['into']('cm_hopper_black')[_0x9f26('0x69')]([_0x9f26('0x6a'),_0x9f26('0x6c'),_0x9f26('0x6d'),_0x9f26('0x58'),_0x9f26('0x54'),'updatedAt'],squel['select']()[_0x9f26('0x6f')](_0x9f26('0x6a'),'phone')[_0x9f26('0x6f')]('id',_0x9f26('0x6c'))['field'](_0x5ba09f['CmListId'][_0x9f26('0x71')](),_0x9f26('0x6d'))[_0x9f26('0x6f')](_0x4315c8[_0x9f26('0x52')]['id'][_0x9f26('0x71')](),_0x9f26('0x58'))[_0x9f26('0x6f')](_0x9f26('0x70'),_0x9f26('0x54'))[_0x9f26('0x6f')](_0x9f26('0x70'),_0x9f26('0x55'))[_0x9f26('0x72')](_0x9f26('0x73'))[_0x9f26('0x3f')](_0x9f26('0x7c'))['where'](_0x9f26('0x74'),_0x5ba09f[_0x9f26('0x75')][_0x9f26('0x71')]())[_0x9f26('0x3f')](_0x9f26('0x76')))[_0x9f26('0x71')]();_0x2dec34[_0x9f26('0x8a')](db[_0x9f26('0x89')][_0x9f26('0x34')](_0x451109));}return BPromise[_0x9f26('0x8b')](_0x2dec34);}})[_0x9f26('0x23')](function(){return _0xbb3531;})['then'](respondWithResult(_0x1adcec,null))[_0x9f26('0x47')](handleError(_0x1adcec,null));};exports[_0x9f26('0x91')]=function(_0x5560df,_0x21a298,_0x32d4ed){return db[_0x9f26('0x2e')][_0x9f26('0x48')]({'where':{'id':_0x5560df[_0x9f26('0x52')]['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x21a298,null))['then'](function(_0x3e09e9){if(_0x3e09e9){return _0x3e09e9[_0x9f26('0x91')](_0x5560df['query'][_0x9f26('0x64')]);}})[_0x9f26('0x23')](function(_0x233ce0){if(_0x233ce0){return db[_0x9f26('0x5f')][_0x9f26('0x24')]({'where':{'ListId':_0x5560df[_0x9f26('0x34')][_0x9f26('0x64')],'CampaignId':_0x5560df[_0x9f26('0x52')]['id']}})[_0x9f26('0x23')](function(){return _0x233ce0;});}})[_0x9f26('0x23')](respondWithStatusCode(_0x21a298,null))[_0x9f26('0x47')](handleError(_0x21a298,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b217381..80030c4 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(_0x49a3b7,_0x5d2586){var _0x569e43=function(_0x4ddf94){while(--_0x4ddf94){_0x49a3b7['push'](_0x49a3b7['shift']());}};_0x569e43(++_0x5d2586);}(_0x7a54,0x106));var _0x47a5=function(_0x2417c1,_0x4205c5){_0x2417c1=_0x2417c1-0x0;var _0x49ed2a=_0x7a54[_0x2417c1];return _0x49ed2a;};'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(_0x13724c,_0x4f92b2){var _0x1866d0=function(_0x5e4628){while(--_0x5e4628){_0x13724c['push'](_0x13724c['shift']());}};_0x1866d0(++_0x4f92b2);}(_0x7a54,0x106));var _0x47a5=function(_0x3cef50,_0x3c5227){_0x3cef50=_0x3cef50-0x0;var _0x5a2bfb=_0x7a54[_0x3cef50];return _0x5a2bfb;};'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 c98a7ef..ed8e6d7 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 _0x8fed=['include','model','map','then','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetCampaign','options','where','attributes','limit'];(function(_0x2a878c,_0x18d5a9){var _0x5f53af=function(_0x51006f){while(--_0x51006f){_0x2a878c['push'](_0x2a878c['shift']());}};_0x5f53af(++_0x18d5a9);}(_0x8fed,0xf5));var _0xd8fe=function(_0x52863c,_0x1498a6){_0x52863c=_0x52863c-0x0;var _0x21872d=_0x8fed[_0x52863c];return _0x21872d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8fe('0x0'));var BPromise=require(_0xd8fe('0x1'));var rs=require(_0xd8fe('0x2'));var fs=require('fs');var Redis=require(_0xd8fe('0x3'));var db=require(_0xd8fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8fe('0x5'))(_0xd8fe('0x6'));var config=require(_0xd8fe('0x7'));var jayson=require(_0xd8fe('0x8'));var client=jayson[_0xd8fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e3b94,_0x1747b3,_0xa33e22){return new BPromise(function(_0x26d33d,_0x5e48f9){return client[_0xd8fe('0xa')](_0x7e3b94,_0xa33e22)['then'](function(_0x410d44){logger[_0xd8fe('0xb')](_0xd8fe('0xc'),_0x1747b3,_0xd8fe('0xd'));logger[_0xd8fe('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1747b3,_0xd8fe('0xd'),JSON[_0xd8fe('0xf')](_0x410d44));if(_0x410d44[_0xd8fe('0x10')]){if(_0x410d44['error'][_0xd8fe('0x11')]===0x1f4){logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);return _0x5e48f9(_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);}logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x410d44[_0xd8fe('0x10')]['message']);return _0x26d33d(_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);}else{logger[_0xd8fe('0xb')](_0xd8fe('0xc'),_0x1747b3,_0xd8fe('0xd'));_0x26d33d(_0x410d44[_0xd8fe('0x13')][_0xd8fe('0x12')]);}})['catch'](function(_0x260a7f){logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x260a7f);_0x5e48f9(_0x260a7f);});});}exports[_0xd8fe('0x14')]=function(_0x4cfb98){var _0x31a5d7=this;return new Promise(function(_0x4b7d9e,_0x52a8b6){return db['Campaign']['findAll']({'raw':_0x4cfb98['options']?_0x4cfb98[_0xd8fe('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4cfb98[_0xd8fe('0x15')]?_0x4cfb98['options'][_0xd8fe('0x16')]||null:null,'attributes':_0x4cfb98['options']?_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x17')]||null:null,'limit':_0x4cfb98[_0xd8fe('0x15')]?_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x18')]||null:null,'include':_0x4cfb98[_0xd8fe('0x15')]?_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x19')]?_['map'](_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x19')],function(_0x19d4d1){return{'model':db[_0x19d4d1[_0xd8fe('0x1a')]],'as':_0x19d4d1['as'],'attributes':_0x19d4d1['attributes'],'include':_0x19d4d1[_0xd8fe('0x19')]?_[_0xd8fe('0x1b')](_0x19d4d1[_0xd8fe('0x19')],function(_0x130c16){return{'model':db[_0x130c16[_0xd8fe('0x1a')]],'as':_0x130c16['as'],'attributes':_0x130c16[_0xd8fe('0x17')],'include':_0x130c16['include']?_['map'](_0x130c16[_0xd8fe('0x19')],function(_0x22ef87){return{'model':db[_0x22ef87[_0xd8fe('0x1a')]],'as':_0x22ef87['as'],'attributes':_0x22ef87[_0xd8fe('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd8fe('0x1c')](function(_0x1666e4){logger[_0xd8fe('0xb')](_0xd8fe('0x14'),_0x4cfb98);logger[_0xd8fe('0xe')](_0xd8fe('0x14'),_0x4cfb98,JSON[_0xd8fe('0xf')](_0x1666e4));_0x4b7d9e(_0x1666e4);})[_0xd8fe('0x1d')](function(_0x2c2767){logger[_0xd8fe('0x10')]('GetCampaign',_0x2c2767[_0xd8fe('0x12')],_0x4cfb98);_0x52a8b6(_0x31a5d7[_0xd8fe('0x10')](0x1f4,_0x2c2767[_0xd8fe('0x12')]));});});}; \ No newline at end of file +var _0x9234=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','findAll','options','raw','where','attributes','map','include','model','lodash','moment','bluebird'];(function(_0x377c42,_0xa66fd5){var _0x597ae5=function(_0x37e8c6){while(--_0x37e8c6){_0x377c42['push'](_0x377c42['shift']());}};_0x597ae5(++_0xa66fd5);}(_0x9234,0x1bd));var _0x4923=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x9234[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0x4923('0x0'));var util=require('util');var moment=require(_0x4923('0x1'));var BPromise=require(_0x4923('0x2'));var rs=require(_0x4923('0x3'));var fs=require('fs');var Redis=require(_0x4923('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4923('0x5'));var logger=require(_0x4923('0x6'))('rpc');var config=require(_0x4923('0x7'));var jayson=require(_0x4923('0x8'));var client=jayson[_0x4923('0x9')][_0x4923('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17b854,_0x133b0d,_0x2de396){return new BPromise(function(_0x548676,_0x1fffc2){return client['request'](_0x17b854,_0x2de396)[_0x4923('0xb')](function(_0x2c4057){logger[_0x4923('0xc')]('Campaign,\x20%s,\x20%s',_0x133b0d,_0x4923('0xd'));logger[_0x4923('0xe')](_0x4923('0xf'),_0x133b0d,_0x4923('0xd'),JSON[_0x4923('0x10')](_0x2c4057));if(_0x2c4057[_0x4923('0x11')]){if(_0x2c4057[_0x4923('0x11')][_0x4923('0x12')]===0x1f4){logger[_0x4923('0x11')](_0x4923('0x13'),_0x133b0d,_0x2c4057['error']['message']);return _0x1fffc2(_0x2c4057[_0x4923('0x11')][_0x4923('0x14')]);}logger[_0x4923('0x11')]('Campaign,\x20%s,\x20%s',_0x133b0d,_0x2c4057[_0x4923('0x11')][_0x4923('0x14')]);return _0x548676(_0x2c4057[_0x4923('0x11')][_0x4923('0x14')]);}else{logger[_0x4923('0xc')](_0x4923('0x13'),_0x133b0d,_0x4923('0xd'));_0x548676(_0x2c4057[_0x4923('0x15')][_0x4923('0x14')]);}})[_0x4923('0x16')](function(_0x559e4a){logger[_0x4923('0x11')](_0x4923('0x13'),_0x133b0d,_0x559e4a);_0x1fffc2(_0x559e4a);});});}exports[_0x4923('0x17')]=function(_0x1be04d){var _0x517b95=this;return new Promise(function(_0x50fd18,_0x16955b){return db['Campaign'][_0x4923('0x18')]({'raw':_0x1be04d[_0x4923('0x19')]?_0x1be04d['options'][_0x4923('0x1a')]===undefined?!![]:![]:!![],'where':_0x1be04d[_0x4923('0x19')]?_0x1be04d[_0x4923('0x19')][_0x4923('0x1b')]||null:null,'attributes':_0x1be04d['options']?_0x1be04d[_0x4923('0x19')][_0x4923('0x1c')]||null:null,'limit':_0x1be04d['options']?_0x1be04d[_0x4923('0x19')]['limit']||null:null,'include':_0x1be04d[_0x4923('0x19')]?_0x1be04d[_0x4923('0x19')]['include']?_[_0x4923('0x1d')](_0x1be04d[_0x4923('0x19')][_0x4923('0x1e')],function(_0x161cf9){return{'model':db[_0x161cf9[_0x4923('0x1f')]],'as':_0x161cf9['as'],'attributes':_0x161cf9[_0x4923('0x1c')],'include':_0x161cf9[_0x4923('0x1e')]?_['map'](_0x161cf9['include'],function(_0x23ec97){return{'model':db[_0x23ec97[_0x4923('0x1f')]],'as':_0x23ec97['as'],'attributes':_0x23ec97[_0x4923('0x1c')],'include':_0x23ec97[_0x4923('0x1e')]?_[_0x4923('0x1d')](_0x23ec97[_0x4923('0x1e')],function(_0x13681b){return{'model':db[_0x13681b[_0x4923('0x1f')]],'as':_0x13681b['as'],'attributes':_0x13681b[_0x4923('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4923('0xb')](function(_0x3a7852){logger['info'](_0x4923('0x17'),_0x1be04d);logger[_0x4923('0xe')](_0x4923('0x17'),_0x1be04d,JSON[_0x4923('0x10')](_0x3a7852));_0x50fd18(_0x3a7852);})[_0x4923('0x16')](function(_0x47158c){logger[_0x4923('0x11')](_0x4923('0x17'),_0x47158c[_0x4923('0x14')],_0x1be04d);_0x16955b(_0x517b95[_0x4923('0x11')](0x1f4,_0x47158c[_0x4923('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 2ab36fa..b364a2c 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 _0x8d59=['getHopperFinals','/:id/hopper_black','/:id/lists','getLists','create','post','/:id/clone','/:id/blacklists','addBlackLists','put','update','destroy','delete','removeBlackLists','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals'];(function(_0x569d52,_0x251a54){var _0x1f38e1=function(_0x544f5c){while(--_0x544f5c){_0x569d52['push'](_0x569d52['shift']());}};_0x1f38e1(++_0x251a54);}(_0x8d59,0xa5));var _0x98d5=function(_0x31c4cc,_0x21af89){_0x31c4cc=_0x31c4cc-0x0;var _0x28950d=_0x8d59[_0x31c4cc];return _0x28950d;};'use strict';var multer=require('multer');var util=require(_0x98d5('0x0'));var path=require(_0x98d5('0x1'));var timeout=require(_0x98d5('0x2'));var express=require('express');var router=express[_0x98d5('0x3')]();var fs_extra=require(_0x98d5('0x4'));var auth=require(_0x98d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x98d5('0x6'));var controller=require(_0x98d5('0x7'));router[_0x98d5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x98d5('0x8')](_0x98d5('0x9'),auth[_0x98d5('0xa')](),controller['show']);router[_0x98d5('0x8')](_0x98d5('0xb'),auth[_0x98d5('0xa')](),controller[_0x98d5('0xc')]);router[_0x98d5('0x8')](_0x98d5('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x98d5('0x8')](_0x98d5('0xe'),auth['isAuthenticated'](),controller[_0x98d5('0xf')]);router[_0x98d5('0x8')](_0x98d5('0x10'),auth[_0x98d5('0xa')](),controller['getHopperBlacks']);router['get'](_0x98d5('0x11'),auth['isAuthenticated'](),controller[_0x98d5('0x12')]);router['get']('/:id/blacklists',auth[_0x98d5('0xa')](),controller['getBlackLists']);router['post']('/',auth[_0x98d5('0xa')](),controller[_0x98d5('0x13')]);router[_0x98d5('0x14')](_0x98d5('0x15'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x98d5('0x11'),auth['isAuthenticated'](),controller['addLists']);router[_0x98d5('0x14')](_0x98d5('0x16'),auth[_0x98d5('0xa')](),controller[_0x98d5('0x17')]);router[_0x98d5('0x18')]('/:id',auth[_0x98d5('0xa')](),controller[_0x98d5('0x19')]);router['delete'](_0x98d5('0x9'),auth[_0x98d5('0xa')](),controller[_0x98d5('0x1a')]);router['delete'](_0x98d5('0x11'),auth[_0x98d5('0xa')](),controller['removeLists']);router[_0x98d5('0x1b')](_0x98d5('0x16'),auth[_0x98d5('0xa')](),controller[_0x98d5('0x1c')]);module[_0x98d5('0x1d')]=router; \ No newline at end of file +var _0x7c60=['util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','addLists','addBlackLists','update','delete','destroy','removeBlackLists','exports','multer'];(function(_0x85da9e,_0x5efac3){var _0x17ec6c=function(_0x24a652){while(--_0x24a652){_0x85da9e['push'](_0x85da9e['shift']());}};_0x17ec6c(++_0x5efac3);}(_0x7c60,0xad));var _0x07c6=function(_0x2d91e2,_0x4238e1){_0x2d91e2=_0x2d91e2-0x0;var _0x4db27f=_0x7c60[_0x2d91e2];return _0x4db27f;};'use strict';var multer=require(_0x07c6('0x0'));var util=require(_0x07c6('0x1'));var path=require(_0x07c6('0x2'));var timeout=require('connect-timeout');var express=require(_0x07c6('0x3'));var router=express[_0x07c6('0x4')]();var fs_extra=require(_0x07c6('0x5'));var auth=require(_0x07c6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x07c6('0x7')]('/',auth[_0x07c6('0x8')](),controller['index']);router[_0x07c6('0x7')](_0x07c6('0x9'),auth[_0x07c6('0x8')](),controller['show']);router[_0x07c6('0x7')](_0x07c6('0xa'),auth[_0x07c6('0x8')](),controller['getHoppers']);router[_0x07c6('0x7')](_0x07c6('0xb'),auth[_0x07c6('0x8')](),controller[_0x07c6('0xc')]);router[_0x07c6('0x7')](_0x07c6('0xd'),auth['isAuthenticated'](),controller[_0x07c6('0xe')]);router[_0x07c6('0x7')](_0x07c6('0xf'),auth[_0x07c6('0x8')](),controller[_0x07c6('0x10')]);router['get'](_0x07c6('0x11'),auth[_0x07c6('0x8')](),controller[_0x07c6('0x12')]);router[_0x07c6('0x7')](_0x07c6('0x13'),auth[_0x07c6('0x8')](),controller['getBlackLists']);router[_0x07c6('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x07c6('0x14')](_0x07c6('0x15'),auth[_0x07c6('0x8')](),controller['clone']);router[_0x07c6('0x14')](_0x07c6('0x11'),auth[_0x07c6('0x8')](),controller[_0x07c6('0x16')]);router['post'](_0x07c6('0x13'),auth['isAuthenticated'](),controller[_0x07c6('0x17')]);router['put'](_0x07c6('0x9'),auth[_0x07c6('0x8')](),controller[_0x07c6('0x18')]);router[_0x07c6('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x07c6('0x1a')]);router[_0x07c6('0x19')](_0x07c6('0x11'),auth[_0x07c6('0x8')](),controller['removeLists']);router[_0x07c6('0x19')](_0x07c6('0x13'),auth[_0x07c6('0x8')](),controller[_0x07c6('0x1b')]);module[_0x07c6('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index fc11433..92e4354 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 _0x4c7b=['getDataValue','key','exports','STRING','TEXT','VIRTUAL'];(function(_0x28a281,_0x3fc022){var _0x2e2068=function(_0x2e56af){while(--_0x2e56af){_0x28a281['push'](_0x28a281['shift']());}};_0x2e2068(++_0x3fc022);}(_0x4c7b,0x13a));var _0xb4c7=function(_0x42048,_0x79762d){_0x42048=_0x42048-0x0;var _0x4e7f69=_0x4c7b[_0x42048];return _0x4e7f69;};'use strict';var Sequelize=require('sequelize');module[_0xb4c7('0x0')]={'key':{'type':Sequelize[_0xb4c7('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xb4c7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb4c7('0x1')]},'name':{'type':Sequelize[_0xb4c7('0x3')],'get':function(){return this[_0xb4c7('0x4')](_0xb4c7('0x5'));}}}; \ No newline at end of file +var _0x9812=['key','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x1c4cca,_0x398ea1){var _0x2dedda=function(_0x10904b){while(--_0x10904b){_0x1c4cca['push'](_0x1c4cca['shift']());}};_0x2dedda(++_0x398ea1);}(_0x9812,0x1b7));var _0x2981=function(_0x42bd0e,_0x157bfa){_0x42bd0e=_0x42bd0e-0x0;var _0x4a5e2f=_0x9812[_0x42bd0e];return _0x4a5e2f;};'use strict';var Sequelize=require('sequelize');module[_0x2981('0x0')]={'key':{'type':Sequelize[_0x2981('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x2981('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2981('0x1')]},'name':{'type':Sequelize[_0x2981('0x3')],'get':function(){return this[_0x2981('0x4')](_0x2981('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index aea6ec4..ccae57e 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 _0xd195=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','body','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','CannedAnswers','userProfileId'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0xd195,0x172));var _0x5d19=function(_0x539b90,_0x57ce81){_0x539b90=_0x539b90-0x0;var _0xad8bd2=_0xd195[_0x539b90];return _0xad8bd2;};'use strict';var emlformat=require(_0x5d19('0x0'));var rimraf=require(_0x5d19('0x1'));var zipdir=require(_0x5d19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5d19('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5d19('0x4'));var util=require(_0x5d19('0x5'));var path=require(_0x5d19('0x6'));var sox=require('sox');var csv=require(_0x5d19('0x7'));var ejs=require(_0x5d19('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d19('0x9'));var squel=require(_0x5d19('0xa'));var crypto=require('crypto');var jsforce=require(_0x5d19('0xb'));var deskjs=require(_0x5d19('0xc'));var toCsv=require(_0x5d19('0x7'));var querystring=require(_0x5d19('0xd'));var Papa=require(_0x5d19('0xe'));var Redis=require(_0x5d19('0xf'));var authService=require(_0x5d19('0x10'));var qs=require(_0x5d19('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d19('0x12'));var logger=require(_0x5d19('0x13'))(_0x5d19('0x14'));var utils=require('../../config/utils');var config=require(_0x5d19('0x15'));var licenseUtil=require(_0x5d19('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15e3a0,_0xc061e3){_0xc061e3=_0xc061e3||0xcc;return function(_0x55abac){if(_0x55abac){return _0x15e3a0[_0x5d19('0x17')](_0xc061e3);}return _0x15e3a0[_0x5d19('0x18')](_0xc061e3)[_0x5d19('0x19')]();};}function respondWithResult(_0x24fcbd,_0xbd486a){_0xbd486a=_0xbd486a||0xc8;return function(_0x3afd45){if(_0x3afd45){return _0x24fcbd[_0x5d19('0x18')](_0xbd486a)[_0x5d19('0x1a')](_0x3afd45);}};}function respondWithFilteredResult(_0x4e1095,_0x46335e){return function(_0x2d99a3){if(_0x2d99a3){var _0x3d527d=typeof _0x46335e[_0x5d19('0x1b')]===_0x5d19('0x1c')&&typeof _0x46335e[_0x5d19('0x1d')]===_0x5d19('0x1c');var _0x2a92bd=_0x2d99a3[_0x5d19('0x1e')];var _0xce703c=_0x3d527d?0x0:_0x46335e[_0x5d19('0x1b')];var _0x183bd2=_0x3d527d?_0x2d99a3[_0x5d19('0x1e')]:_0x46335e[_0x5d19('0x1b')]+_0x46335e['limit'];var _0x4a5b9f;if(_0x183bd2>=_0x2a92bd){_0x183bd2=_0x2a92bd;_0x4a5b9f=0xc8;}else{_0x4a5b9f=0xce;}_0x4e1095['status'](_0x4a5b9f);return _0x4e1095[_0x5d19('0x1f')](_0x5d19('0x20'),_0xce703c+'-'+_0x183bd2+'/'+_0x2a92bd)[_0x5d19('0x1a')](_0x2d99a3);}return null;};}function patchUpdates(_0x15e706){return function(_0x131872){try{jsonpatch['apply'](_0x131872,_0x15e706,!![]);}catch(_0x37881c){return BPromise[_0x5d19('0x21')](_0x37881c);}return _0x131872[_0x5d19('0x22')]();};}function saveUpdates(_0x5ff331,_0x505654){return function(_0x3a9758){if(_0x3a9758){return _0x3a9758[_0x5d19('0x23')](_0x5ff331)[_0x5d19('0x24')](function(_0x4d7254){return _0x4d7254;});}return null;};}function removeEntity(_0x5ca5a2,_0x431fd5){return function(_0x31dac3){if(_0x31dac3){return _0x31dac3[_0x5d19('0x25')]()[_0x5d19('0x24')](function(){var _0x583915=_0x31dac3['get']({'plain':!![]});var _0x356108='CannedAnswers';return db[_0x5d19('0x26')][_0x5d19('0x25')]({'where':{'type':_0x356108,'resourceId':_0x583915['id']}})[_0x5d19('0x24')](function(){return _0x31dac3;});})[_0x5d19('0x24')](function(){_0x5ca5a2[_0x5d19('0x18')](0xcc)[_0x5d19('0x19')]();});}};}function handleEntityNotFound(_0x57c445,_0x101123){return function(_0x5c2a32){if(!_0x5c2a32){_0x57c445[_0x5d19('0x17')](0x194);}return _0x5c2a32;};}function handleError(_0x7dbece,_0x4ecb5a){_0x4ecb5a=_0x4ecb5a||0x1f4;return function(_0x3c6bf4){logger[_0x5d19('0x27')](_0x3c6bf4[_0x5d19('0x28')]);if(_0x3c6bf4[_0x5d19('0x29')]){delete _0x3c6bf4['name'];}_0x7dbece[_0x5d19('0x18')](_0x4ecb5a)[_0x5d19('0x2a')](_0x3c6bf4);};}exports[_0x5d19('0x2b')]=function(_0x12a924,_0x1b1bff){var _0x332668={},_0x1d565e={},_0x59f192={'count':0x0,'rows':[]};var _0x441528=_[_0x5d19('0x2c')](db[_0x5d19('0x2d')][_0x5d19('0x2e')],function(_0x32e5c5){return{'name':_0x32e5c5[_0x5d19('0x2f')],'type':_0x32e5c5[_0x5d19('0x30')]['key']};});_0x1d565e[_0x5d19('0x31')]=_[_0x5d19('0x2c')](_0x441528,'name');_0x1d565e[_0x5d19('0x32')]=_[_0x5d19('0x33')](_0x12a924[_0x5d19('0x32')]);_0x1d565e[_0x5d19('0x34')]=_[_0x5d19('0x35')](_0x1d565e[_0x5d19('0x31')],_0x1d565e[_0x5d19('0x32')]);_0x332668['attributes']=_[_0x5d19('0x35')](_0x1d565e[_0x5d19('0x31')],qs[_0x5d19('0x36')](_0x12a924['query']['fields']));_0x332668['attributes']=_0x332668[_0x5d19('0x37')]['length']?_0x332668[_0x5d19('0x37')]:_0x1d565e['model'];if(!_0x12a924['query'][_0x5d19('0x38')](_0x5d19('0x39'))){_0x332668['limit']=qs[_0x5d19('0x1d')](_0x12a924[_0x5d19('0x32')]['limit']);_0x332668[_0x5d19('0x1b')]=qs[_0x5d19('0x1b')](_0x12a924['query'][_0x5d19('0x1b')]);}_0x332668[_0x5d19('0x3a')]=qs[_0x5d19('0x3b')](_0x12a924[_0x5d19('0x32')][_0x5d19('0x3b')]);_0x332668[_0x5d19('0x3c')]=qs[_0x5d19('0x34')](_[_0x5d19('0x3d')](_0x12a924[_0x5d19('0x32')],_0x1d565e[_0x5d19('0x34')]),_0x441528);if(_0x12a924[_0x5d19('0x32')][_0x5d19('0x3e')]){_0x332668[_0x5d19('0x3c')]=_['merge'](_0x332668[_0x5d19('0x3c')],{'$or':[{'key':{'$like':'%'+_0x12a924[_0x5d19('0x32')][_0x5d19('0x3e')]+'%'}},{'value':{'$like':'%'+_0x12a924[_0x5d19('0x32')][_0x5d19('0x3e')]+'%'}}]});}_0x332668=_[_0x5d19('0x3f')]({},_0x332668,_0x12a924[_0x5d19('0x40')]);var _0x248e9b={'where':_0x332668[_0x5d19('0x3c')]};return db['CannedAnswer'][_0x5d19('0x1e')](_0x248e9b)[_0x5d19('0x24')](function(_0x154c0d){_0x59f192[_0x5d19('0x1e')]=_0x154c0d;if(_0x12a924['query'][_0x5d19('0x41')]){_0x332668[_0x5d19('0x42')]=[{'all':!![]}];}return db[_0x5d19('0x2d')]['findAll'](_0x332668);})[_0x5d19('0x24')](function(_0x429169){_0x59f192[_0x5d19('0x43')]=_0x429169;return _0x59f192;})[_0x5d19('0x24')](respondWithFilteredResult(_0x1b1bff,_0x332668))[_0x5d19('0x44')](handleError(_0x1b1bff,null));};exports[_0x5d19('0x45')]=function(_0x16f44e,_0x369f27){var _0x254d4d={'raw':!![],'where':{'id':_0x16f44e[_0x5d19('0x46')]['id']}},_0x5308b1={};_0x5308b1[_0x5d19('0x31')]=_[_0x5d19('0x33')](db[_0x5d19('0x2d')][_0x5d19('0x2e')]);_0x5308b1[_0x5d19('0x32')]=_[_0x5d19('0x33')](_0x16f44e[_0x5d19('0x32')]);_0x5308b1[_0x5d19('0x34')]=_[_0x5d19('0x35')](_0x5308b1[_0x5d19('0x31')],_0x5308b1[_0x5d19('0x32')]);_0x254d4d[_0x5d19('0x37')]=_['intersection'](_0x5308b1[_0x5d19('0x31')],qs['fields'](_0x16f44e[_0x5d19('0x32')][_0x5d19('0x36')]));_0x254d4d[_0x5d19('0x37')]=_0x254d4d['attributes'][_0x5d19('0x47')]?_0x254d4d['attributes']:_0x5308b1[_0x5d19('0x31')];if(_0x16f44e[_0x5d19('0x32')][_0x5d19('0x41')]){_0x254d4d[_0x5d19('0x42')]=[{'all':!![]}];}_0x254d4d=_[_0x5d19('0x3f')]({},_0x254d4d,_0x16f44e[_0x5d19('0x40')]);return db[_0x5d19('0x2d')]['find'](_0x254d4d)['then'](handleEntityNotFound(_0x369f27,null))[_0x5d19('0x24')](respondWithResult(_0x369f27,null))[_0x5d19('0x44')](handleError(_0x369f27,null));};exports[_0x5d19('0x23')]=function(_0xd232d5,_0x2f0428){if(_0xd232d5['body']['id']){delete _0xd232d5['body']['id'];}return db['CannedAnswer'][_0x5d19('0x48')]({'where':{'id':_0xd232d5['params']['id']}})[_0x5d19('0x24')](handleEntityNotFound(_0x2f0428,null))[_0x5d19('0x24')](saveUpdates(_0xd232d5[_0x5d19('0x49')],null))[_0x5d19('0x24')](respondWithResult(_0x2f0428,null))[_0x5d19('0x44')](handleError(_0x2f0428,null));};exports[_0x5d19('0x25')]=function(_0xbb26dd,_0x19cb8c){return db['CannedAnswer'][_0x5d19('0x48')]({'where':{'id':_0xbb26dd['params']['id']}})['then'](handleEntityNotFound(_0x19cb8c,null))[_0x5d19('0x24')](removeEntity(_0x19cb8c,null))[_0x5d19('0x44')](handleError(_0x19cb8c,null));};exports['create']=function(_0x549a98,_0x43f48a){var _0x6a07e8={'key':_0x549a98[_0x5d19('0x49')][_0x5d19('0x4a')]};if(_0x549a98[_0x5d19('0x49')][_0x5d19('0x4b')]){_0x6a07e8[_0x5d19('0x4b')]=_0x549a98['body'][_0x5d19('0x4b')];}else if(_0x549a98[_0x5d19('0x49')][_0x5d19('0x4c')]){_0x6a07e8[_0x5d19('0x4c')]=_0x549a98[_0x5d19('0x49')][_0x5d19('0x4c')];}else if(_0x549a98['body']['OpenchannelAccountId']){_0x6a07e8[_0x5d19('0x4d')]=_0x549a98['body'][_0x5d19('0x4d')];}else if(_0x549a98[_0x5d19('0x49')]['ChatWebsiteId']){_0x6a07e8['ChatWebsiteId']=_0x549a98[_0x5d19('0x49')][_0x5d19('0x4e')];}return db[_0x5d19('0x2d')][_0x5d19('0x48')]({'where':_0x6a07e8})[_0x5d19('0x24')](function(_0x2144a1){if(_0x2144a1){throw new db[(_0x5d19('0x4f'))][(_0x5d19('0x50'))](_0x5d19('0x51'));}return db['CannedAnswer'][_0x5d19('0x52')](_0x549a98[_0x5d19('0x49')]);})[_0x5d19('0x24')](function(_0x45b35a){var _0x5ae929=_0x549a98[_0x5d19('0x53')]['get']({'plain':!![]});if(!_0x5ae929)throw new Error(_0x5d19('0x54'));if(_0x5ae929[_0x5d19('0x55')]===_0x5d19('0x53')){var _0x4a915f=_0x45b35a[_0x5d19('0x56')]({'plain':!![]});return db[_0x5d19('0x57')]['find']({'where':{'name':_0x5d19('0x58'),'userProfileId':_0x5ae929[_0x5d19('0x59')]},'raw':!![]})[_0x5d19('0x24')](function(_0x47c06c){if(_0x47c06c&&_0x47c06c[_0x5d19('0x5a')]===0x0){return db[_0x5d19('0x26')][_0x5d19('0x52')]({'name':_0x4a915f['name'],'resourceId':_0x4a915f['id'],'type':_0x47c06c[_0x5d19('0x29')],'sectionId':_0x47c06c['id']},{})['then'](function(){return _0x45b35a;});}else{return _0x45b35a;}})['catch'](function(_0xf6fa8b){logger[_0x5d19('0x27')](_0x5d19('0x5b'),_0xf6fa8b);throw _0xf6fa8b;});}return _0x45b35a;})[_0x5d19('0x24')](respondWithResult(_0x43f48a,0xc9))[_0x5d19('0x44')](handleError(_0x43f48a,null));}; \ No newline at end of file +var _0xeb19=['undefined','limit','count','Content-Range','apply','reject','save','then','get','CannedAnswers','UserProfileResource','end','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x234761,_0x598fff){var _0x501944=function(_0x310d44){while(--_0x310d44){_0x234761['push'](_0x234761['shift']());}};_0x501944(++_0x598fff);}(_0xeb19,0x14b));var _0x9eb1=function(_0x280405,_0x274b31){_0x280405=_0x280405-0x0;var _0x2db04d=_0xeb19[_0x280405];return _0x2db04d;};'use strict';var emlformat=require(_0x9eb1('0x0'));var rimraf=require(_0x9eb1('0x1'));var zipdir=require(_0x9eb1('0x2'));var jsonpatch=require(_0x9eb1('0x3'));var rp=require(_0x9eb1('0x4'));var moment=require(_0x9eb1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9eb1('0x6'));var util=require(_0x9eb1('0x7'));var path=require(_0x9eb1('0x8'));var sox=require(_0x9eb1('0x9'));var csv=require(_0x9eb1('0xa'));var ejs=require(_0x9eb1('0xb'));var fs=require('fs');var fs_extra=require(_0x9eb1('0xc'));var _=require(_0x9eb1('0xd'));var squel=require(_0x9eb1('0xe'));var crypto=require(_0x9eb1('0xf'));var jsforce=require(_0x9eb1('0x10'));var deskjs=require(_0x9eb1('0x11'));var toCsv=require(_0x9eb1('0xa'));var querystring=require(_0x9eb1('0x12'));var Papa=require('papaparse');var Redis=require(_0x9eb1('0x13'));var authService=require(_0x9eb1('0x14'));var qs=require(_0x9eb1('0x15'));var as=require(_0x9eb1('0x16'));var hardwareService=require(_0x9eb1('0x17'));var logger=require('../../config/logger')(_0x9eb1('0x18'));var utils=require(_0x9eb1('0x19'));var config=require(_0x9eb1('0x1a'));var licenseUtil=require(_0x9eb1('0x1b'));var db=require(_0x9eb1('0x1c'))['db'];function respondWithStatusCode(_0x5afc1c,_0x389d74){_0x389d74=_0x389d74||0xcc;return function(_0x294b4e){if(_0x294b4e){return _0x5afc1c[_0x9eb1('0x1d')](_0x389d74);}return _0x5afc1c[_0x9eb1('0x1e')](_0x389d74)['end']();};}function respondWithResult(_0x41e4a6,_0x454fd7){_0x454fd7=_0x454fd7||0xc8;return function(_0x42d7ce){if(_0x42d7ce){return _0x41e4a6[_0x9eb1('0x1e')](_0x454fd7)[_0x9eb1('0x1f')](_0x42d7ce);}};}function respondWithFilteredResult(_0x359983,_0xeb84fe){return function(_0x5ea477){if(_0x5ea477){var _0x26532f=typeof _0xeb84fe[_0x9eb1('0x20')]===_0x9eb1('0x21')&&typeof _0xeb84fe[_0x9eb1('0x22')]===_0x9eb1('0x21');var _0x44a7da=_0x5ea477[_0x9eb1('0x23')];var _0x5a7ab0=_0x26532f?0x0:_0xeb84fe[_0x9eb1('0x20')];var _0x1b9d55=_0x26532f?_0x5ea477[_0x9eb1('0x23')]:_0xeb84fe[_0x9eb1('0x20')]+_0xeb84fe[_0x9eb1('0x22')];var _0x233e5a;if(_0x1b9d55>=_0x44a7da){_0x1b9d55=_0x44a7da;_0x233e5a=0xc8;}else{_0x233e5a=0xce;}_0x359983[_0x9eb1('0x1e')](_0x233e5a);return _0x359983['set'](_0x9eb1('0x24'),_0x5a7ab0+'-'+_0x1b9d55+'/'+_0x44a7da)[_0x9eb1('0x1f')](_0x5ea477);}return null;};}function patchUpdates(_0x1ff109){return function(_0x432b33){try{jsonpatch[_0x9eb1('0x25')](_0x432b33,_0x1ff109,!![]);}catch(_0x5723b8){return BPromise[_0x9eb1('0x26')](_0x5723b8);}return _0x432b33[_0x9eb1('0x27')]();};}function saveUpdates(_0x455472,_0x33b3db){return function(_0x5e1c65){if(_0x5e1c65){return _0x5e1c65['update'](_0x455472)['then'](function(_0x4db916){return _0x4db916;});}return null;};}function removeEntity(_0x186b7b,_0xf948ab){return function(_0x2d0903){if(_0x2d0903){return _0x2d0903['destroy']()[_0x9eb1('0x28')](function(){var _0x10cd18=_0x2d0903[_0x9eb1('0x29')]({'plain':!![]});var _0x27fc4d=_0x9eb1('0x2a');return db[_0x9eb1('0x2b')]['destroy']({'where':{'type':_0x27fc4d,'resourceId':_0x10cd18['id']}})[_0x9eb1('0x28')](function(){return _0x2d0903;});})[_0x9eb1('0x28')](function(){_0x186b7b[_0x9eb1('0x1e')](0xcc)[_0x9eb1('0x2c')]();});}};}function handleEntityNotFound(_0x37950b,_0x1eac12){return function(_0x28d5bf){if(!_0x28d5bf){_0x37950b[_0x9eb1('0x1d')](0x194);}return _0x28d5bf;};}function handleError(_0x178670,_0x10b5be){_0x10b5be=_0x10b5be||0x1f4;return function(_0x23f41a){logger[_0x9eb1('0x2d')](_0x23f41a[_0x9eb1('0x2e')]);if(_0x23f41a[_0x9eb1('0x2f')]){delete _0x23f41a['name'];}_0x178670['status'](_0x10b5be)[_0x9eb1('0x30')](_0x23f41a);};}exports[_0x9eb1('0x31')]=function(_0x42c87a,_0x19861a){var _0x285997={},_0x46a3b3={},_0xa0e27f={'count':0x0,'rows':[]};var _0x19fba1=_['map'](db[_0x9eb1('0x32')][_0x9eb1('0x33')],function(_0x535f97){return{'name':_0x535f97[_0x9eb1('0x34')],'type':_0x535f97[_0x9eb1('0x35')]['key']};});_0x46a3b3[_0x9eb1('0x36')]=_[_0x9eb1('0x37')](_0x19fba1,'name');_0x46a3b3[_0x9eb1('0x38')]=_[_0x9eb1('0x39')](_0x42c87a[_0x9eb1('0x38')]);_0x46a3b3[_0x9eb1('0x3a')]=_[_0x9eb1('0x3b')](_0x46a3b3[_0x9eb1('0x36')],_0x46a3b3[_0x9eb1('0x38')]);_0x285997[_0x9eb1('0x3c')]=_['intersection'](_0x46a3b3[_0x9eb1('0x36')],qs[_0x9eb1('0x3d')](_0x42c87a[_0x9eb1('0x38')][_0x9eb1('0x3d')]));_0x285997[_0x9eb1('0x3c')]=_0x285997[_0x9eb1('0x3c')][_0x9eb1('0x3e')]?_0x285997['attributes']:_0x46a3b3[_0x9eb1('0x36')];if(!_0x42c87a[_0x9eb1('0x38')]['hasOwnProperty'](_0x9eb1('0x3f'))){_0x285997['limit']=qs[_0x9eb1('0x22')](_0x42c87a[_0x9eb1('0x38')][_0x9eb1('0x22')]);_0x285997[_0x9eb1('0x20')]=qs['offset'](_0x42c87a[_0x9eb1('0x38')][_0x9eb1('0x20')]);}_0x285997[_0x9eb1('0x40')]=qs['sort'](_0x42c87a['query']['sort']);_0x285997[_0x9eb1('0x41')]=qs['filters'](_[_0x9eb1('0x42')](_0x42c87a[_0x9eb1('0x38')],_0x46a3b3['filters']),_0x19fba1);if(_0x42c87a[_0x9eb1('0x38')][_0x9eb1('0x43')]){_0x285997['where']=_[_0x9eb1('0x44')](_0x285997['where'],{'$or':[{'key':{'$like':'%'+_0x42c87a['query'][_0x9eb1('0x43')]+'%'}},{'value':{'$like':'%'+_0x42c87a[_0x9eb1('0x38')][_0x9eb1('0x43')]+'%'}}]});}_0x285997=_[_0x9eb1('0x44')]({},_0x285997,_0x42c87a[_0x9eb1('0x45')]);var _0x194b45={'where':_0x285997[_0x9eb1('0x41')]};return db[_0x9eb1('0x32')]['count'](_0x194b45)['then'](function(_0x4c4c58){_0xa0e27f['count']=_0x4c4c58;if(_0x42c87a[_0x9eb1('0x38')][_0x9eb1('0x46')]){_0x285997[_0x9eb1('0x47')]=[{'all':!![]}];}return db[_0x9eb1('0x32')][_0x9eb1('0x48')](_0x285997);})[_0x9eb1('0x28')](function(_0x5b7ce1){_0xa0e27f[_0x9eb1('0x49')]=_0x5b7ce1;return _0xa0e27f;})[_0x9eb1('0x28')](respondWithFilteredResult(_0x19861a,_0x285997))[_0x9eb1('0x4a')](handleError(_0x19861a,null));};exports['show']=function(_0x282592,_0x3e91c1){var _0x230cca={'raw':!![],'where':{'id':_0x282592[_0x9eb1('0x4b')]['id']}},_0x19db26={};_0x19db26['model']=_[_0x9eb1('0x39')](db[_0x9eb1('0x32')]['rawAttributes']);_0x19db26[_0x9eb1('0x38')]=_[_0x9eb1('0x39')](_0x282592['query']);_0x19db26[_0x9eb1('0x3a')]=_[_0x9eb1('0x3b')](_0x19db26[_0x9eb1('0x36')],_0x19db26['query']);_0x230cca[_0x9eb1('0x3c')]=_[_0x9eb1('0x3b')](_0x19db26[_0x9eb1('0x36')],qs['fields'](_0x282592[_0x9eb1('0x38')][_0x9eb1('0x3d')]));_0x230cca[_0x9eb1('0x3c')]=_0x230cca['attributes']['length']?_0x230cca[_0x9eb1('0x3c')]:_0x19db26['model'];if(_0x282592[_0x9eb1('0x38')][_0x9eb1('0x46')]){_0x230cca['include']=[{'all':!![]}];}_0x230cca=_[_0x9eb1('0x44')]({},_0x230cca,_0x282592[_0x9eb1('0x45')]);return db[_0x9eb1('0x32')][_0x9eb1('0x4c')](_0x230cca)['then'](handleEntityNotFound(_0x3e91c1,null))[_0x9eb1('0x28')](respondWithResult(_0x3e91c1,null))[_0x9eb1('0x4a')](handleError(_0x3e91c1,null));};exports[_0x9eb1('0x4d')]=function(_0x52b4ab,_0x11635f){if(_0x52b4ab[_0x9eb1('0x4e')]['id']){delete _0x52b4ab[_0x9eb1('0x4e')]['id'];}return db[_0x9eb1('0x32')]['find']({'where':{'id':_0x52b4ab[_0x9eb1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11635f,null))['then'](saveUpdates(_0x52b4ab[_0x9eb1('0x4e')],null))[_0x9eb1('0x28')](respondWithResult(_0x11635f,null))['catch'](handleError(_0x11635f,null));};exports['destroy']=function(_0x892d12,_0xfc8016){return db[_0x9eb1('0x32')][_0x9eb1('0x4c')]({'where':{'id':_0x892d12[_0x9eb1('0x4b')]['id']}})[_0x9eb1('0x28')](handleEntityNotFound(_0xfc8016,null))['then'](removeEntity(_0xfc8016,null))['catch'](handleError(_0xfc8016,null));};exports[_0x9eb1('0x4f')]=function(_0x17f8ce,_0x1b75f0){var _0x1fbf03={'key':_0x17f8ce[_0x9eb1('0x4e')][_0x9eb1('0x50')]};if(_0x17f8ce[_0x9eb1('0x4e')][_0x9eb1('0x51')]){_0x1fbf03[_0x9eb1('0x51')]=_0x17f8ce[_0x9eb1('0x4e')]['MailAccountId'];}else if(_0x17f8ce[_0x9eb1('0x4e')][_0x9eb1('0x52')]){_0x1fbf03[_0x9eb1('0x52')]=_0x17f8ce[_0x9eb1('0x4e')][_0x9eb1('0x52')];}else if(_0x17f8ce[_0x9eb1('0x4e')][_0x9eb1('0x53')]){_0x1fbf03['OpenchannelAccountId']=_0x17f8ce['body'][_0x9eb1('0x53')];}else if(_0x17f8ce[_0x9eb1('0x4e')][_0x9eb1('0x54')]){_0x1fbf03[_0x9eb1('0x54')]=_0x17f8ce[_0x9eb1('0x4e')]['ChatWebsiteId'];}return db[_0x9eb1('0x32')][_0x9eb1('0x4c')]({'where':_0x1fbf03})[_0x9eb1('0x28')](function(_0xff2305){if(_0xff2305){throw new db['Sequelize'][(_0x9eb1('0x55'))](_0x9eb1('0x56'));}return db['CannedAnswer'][_0x9eb1('0x4f')](_0x17f8ce[_0x9eb1('0x4e')]);})[_0x9eb1('0x28')](function(_0x41fc49){var _0x62ccd=_0x17f8ce[_0x9eb1('0x57')][_0x9eb1('0x29')]({'plain':!![]});if(!_0x62ccd)throw new Error(_0x9eb1('0x58'));if(_0x62ccd['role']==='user'){var _0xa619bb=_0x41fc49[_0x9eb1('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x9eb1('0x4c')]({'where':{'name':'CannedAnswers','userProfileId':_0x62ccd[_0x9eb1('0x59')]},'raw':!![]})[_0x9eb1('0x28')](function(_0x4fca89){if(_0x4fca89&&_0x4fca89['autoAssociation']===0x0){return db[_0x9eb1('0x2b')][_0x9eb1('0x4f')]({'name':_0xa619bb['name'],'resourceId':_0xa619bb['id'],'type':_0x4fca89[_0x9eb1('0x2f')],'sectionId':_0x4fca89['id']},{})['then'](function(){return _0x41fc49;});}else{return _0x41fc49;}})['catch'](function(_0xdeb372){logger[_0x9eb1('0x2d')](_0x9eb1('0x5a'),_0xdeb372);throw _0xdeb372;});}return _0x41fc49;})['then'](respondWithResult(_0x1b75f0,0xc9))[_0x9eb1('0x4a')](handleError(_0x1b75f0,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index e0bcbc3..a580360 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 _0x16c5=['exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x1f766a,_0x4415b9){var _0x1136cb=function(_0x56d98b){while(--_0x56d98b){_0x1f766a['push'](_0x1f766a['shift']());}};_0x1136cb(++_0x4415b9);}(_0x16c5,0x112));var _0x516c=function(_0xc48e6e,_0x3b961e){_0xc48e6e=_0xc48e6e-0x0;var _0x4d9a0d=_0x16c5[_0xc48e6e];return _0x4d9a0d;};'use strict';var _=require(_0x516c('0x0'));var util=require(_0x516c('0x1'));var logger=require(_0x516c('0x2'))(_0x516c('0x3'));var moment=require(_0x516c('0x4'));var BPromise=require(_0x516c('0x5'));var rp=require(_0x516c('0x6'));var fs=require('fs');var path=require(_0x516c('0x7'));var rimraf=require(_0x516c('0x8'));var config=require(_0x516c('0x9'));var attributes=require(_0x516c('0xa'));module[_0x516c('0xb')]=function(_0x4e8217,_0x13ee9d){return _0x4e8217['define'](_0x516c('0xc'),attributes,{'tableName':_0x516c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x516c('0xe')});}; \ No newline at end of file +var _0xbefe=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','tools_canned_answers','utf8mb4'];(function(_0x2f3852,_0x18fb67){var _0x4ce88e=function(_0xb22dcf){while(--_0xb22dcf){_0x2f3852['push'](_0x2f3852['shift']());}};_0x4ce88e(++_0x18fb67);}(_0xbefe,0x168));var _0xebef=function(_0x288371,_0x35f999){_0x288371=_0x288371-0x0;var _0x5a1ad1=_0xbefe[_0x288371];return _0x5a1ad1;};'use strict';var _=require('lodash');var util=require(_0xebef('0x0'));var logger=require('../../config/logger')(_0xebef('0x1'));var moment=require(_0xebef('0x2'));var BPromise=require(_0xebef('0x3'));var rp=require(_0xebef('0x4'));var fs=require('fs');var path=require(_0xebef('0x5'));var rimraf=require(_0xebef('0x6'));var config=require(_0xebef('0x7'));var attributes=require(_0xebef('0x8'));module['exports']=function(_0x3fe404,_0x39de80){return _0x3fe404[_0xebef('0x9')]('CannedAnswer',attributes,{'tableName':_0xebef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xebef('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5856507..4e97799 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(_0x2a6990,_0x22b68a){var _0x1afd70=function(_0x113a00){while(--_0x113a00){_0x2a6990['push'](_0x2a6990['shift']());}};_0x1afd70(++_0x22b68a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x2367aa,_0x48a675){var _0x2e50a5=function(_0x474496){while(--_0x474496){_0x2367aa['push'](_0x2367aa['shift']());}};_0x2e50a5(++_0x48a675);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 363758e..6a6f152 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 _0x803d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x1784d2,_0x1ba5ba){var _0x4784f3=function(_0x3c6fd0){while(--_0x3c6fd0){_0x1784d2['push'](_0x1784d2['shift']());}};_0x4784f3(++_0x1ba5ba);}(_0x803d,0x149));var _0xd803=function(_0x363a95,_0x4fc2ae){_0x363a95=_0x363a95-0x0;var _0x4c9aca=_0x803d[_0x363a95];return _0x4c9aca;};'use strict';var multer=require(_0xd803('0x0'));var util=require(_0xd803('0x1'));var path=require(_0xd803('0x2'));var timeout=require(_0xd803('0x3'));var express=require(_0xd803('0x4'));var router=express[_0xd803('0x5')]();var fs_extra=require(_0xd803('0x6'));var auth=require(_0xd803('0x7'));var interaction=require(_0xd803('0x8'));var config=require(_0xd803('0x9'));var controller=require(_0xd803('0xa'));router['get']('/',auth[_0xd803('0xb')](),controller[_0xd803('0xc')]);router[_0xd803('0xd')](_0xd803('0xe'),auth[_0xd803('0xb')](),controller[_0xd803('0xf')]);router[_0xd803('0x10')]('/',auth[_0xd803('0xb')](),controller[_0xd803('0x11')]);router[_0xd803('0x12')]('/:id',auth[_0xd803('0xb')](),controller[_0xd803('0x13')]);router[_0xd803('0x14')](_0xd803('0xe'),auth[_0xd803('0xb')](),controller['destroy']);module[_0xd803('0x15')]=router; \ No newline at end of file +var _0xe61f=['Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','put','update','destroy','exports','multer','util','path'];(function(_0x38ec07,_0x5d430a){var _0x322f99=function(_0x2745e7){while(--_0x2745e7){_0x38ec07['push'](_0x38ec07['shift']());}};_0x322f99(++_0x5d430a);}(_0xe61f,0xeb));var _0xfe61=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe61f[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xfe61('0x0'));var util=require(_0xfe61('0x1'));var path=require(_0xfe61('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfe61('0x3')]();var fs_extra=require(_0xfe61('0x4'));var auth=require(_0xfe61('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfe61('0x6'));var controller=require(_0xfe61('0x7'));router[_0xfe61('0x8')]('/',auth[_0xfe61('0x9')](),controller['index']);router['get'](_0xfe61('0xa'),auth[_0xfe61('0x9')](),controller[_0xfe61('0xb')]);router[_0xfe61('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfe61('0xd')](_0xfe61('0xa'),auth[_0xfe61('0x9')](),controller[_0xfe61('0xe')]);router['delete'](_0xfe61('0xa'),auth[_0xfe61('0x9')](),controller[_0xfe61('0xf')]);module[_0xfe61('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 57f41b7..9f38bd4 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 _0x502a=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x470b24,_0x58a01e){var _0xde9b3d=function(_0x445f8c){while(--_0x445f8c){_0x470b24['push'](_0x470b24['shift']());}};_0xde9b3d(++_0x58a01e);}(_0x502a,0xd8));var _0xa502=function(_0x403cd5,_0x2695bb){_0x403cd5=_0x403cd5-0x0;var _0x470e7b=_0x502a[_0x403cd5];return _0x470e7b;};'use strict';var Sequelize=require(_0xa502('0x0'));module[_0xa502('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xa502('0x2')},'clid':{'type':Sequelize[_0xa502('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xa502('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xa502('0x3')]},'lastapp':{'type':Sequelize[_0xa502('0x3')]},'lastdata':{'type':Sequelize[_0xa502('0x3')]},'duration':{'type':Sequelize[_0xa502('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa502('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xa502('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xa502('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa502('0x3')]},'sequence':{'type':Sequelize[_0xa502('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa502('0x3')]},'tag':{'type':Sequelize[_0xa502('0x3')]}}; \ No newline at end of file +var _0x7a72=['STRING','INTEGER','exports','DATE'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0x7a72,0x1be));var _0x27a7=function(_0x5e6943,_0x2e59da){_0x5e6943=_0x5e6943-0x0;var _0x7f52f2=_0x7a72[_0x5e6943];return _0x7f52f2;};'use strict';var Sequelize=require('sequelize');module[_0x27a7('0x0')]={'calldate':{'type':Sequelize[_0x27a7('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x27a7('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x27a7('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x27a7('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x27a7('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x27a7('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x27a7('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x27a7('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x27a7('0x2')]},'linkedid':{'type':Sequelize[_0x27a7('0x2')]},'sequence':{'type':Sequelize[_0x27a7('0x2')]},'peeraccount':{'type':Sequelize[_0x27a7('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x27a7('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 6a7d668..0059bff 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 _0x9009=['stack','name','index','Cdr','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','map','VIRTUAL','catch','show','params','includeAll','include','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','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','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x9009,0x1d4));var _0x9900=function(_0x26891e,_0x53401c){_0x26891e=_0x26891e-0x0;var _0x23a288=_0x9009[_0x26891e];return _0x23a288;};'use strict';var emlformat=require(_0x9900('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9900('0x1'));var jsonpatch=require(_0x9900('0x2'));var rp=require('request-promise');var moment=require(_0x9900('0x3'));var BPromise=require(_0x9900('0x4'));var Mustache=require(_0x9900('0x5'));var util=require(_0x9900('0x6'));var path=require('path');var sox=require(_0x9900('0x7'));var csv=require(_0x9900('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9900('0x9'));var squel=require(_0x9900('0xa'));var crypto=require('crypto');var jsforce=require(_0x9900('0xb'));var deskjs=require(_0x9900('0xc'));var toCsv=require(_0x9900('0x8'));var querystring=require(_0x9900('0xd'));var Papa=require('papaparse');var Redis=require(_0x9900('0xe'));var authService=require(_0x9900('0xf'));var qs=require(_0x9900('0x10'));var as=require(_0x9900('0x11'));var hardwareService=require(_0x9900('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9900('0x13'));var config=require(_0x9900('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17070a,_0x4e8312){_0x4e8312=_0x4e8312||0xcc;return function(_0x6bd4da){if(_0x6bd4da){return _0x17070a[_0x9900('0x15')](_0x4e8312);}return _0x17070a[_0x9900('0x16')](_0x4e8312)[_0x9900('0x17')]();};}function respondWithResult(_0x318fa5,_0x1014e8){_0x1014e8=_0x1014e8||0xc8;return function(_0x2eaf32){if(_0x2eaf32){return _0x318fa5[_0x9900('0x16')](_0x1014e8)[_0x9900('0x18')](_0x2eaf32);}};}function respondWithFilteredResult(_0x209b4d,_0x375ee0){return function(_0xce2dd6){if(_0xce2dd6){var _0x154e22=typeof _0x375ee0[_0x9900('0x19')]===_0x9900('0x1a')&&typeof _0x375ee0[_0x9900('0x1b')]===_0x9900('0x1a');var _0x5d9ec9=_0xce2dd6['count'];var _0x1017a5=_0x154e22?0x0:_0x375ee0[_0x9900('0x19')];var _0x1bd7a3=_0x154e22?_0xce2dd6[_0x9900('0x1c')]:_0x375ee0['offset']+_0x375ee0[_0x9900('0x1b')];var _0x57ae85;if(_0x1bd7a3>=_0x5d9ec9){_0x1bd7a3=_0x5d9ec9;_0x57ae85=0xc8;}else{_0x57ae85=0xce;}_0x209b4d['status'](_0x57ae85);return _0x209b4d[_0x9900('0x1d')]('Content-Range',_0x1017a5+'-'+_0x1bd7a3+'/'+_0x5d9ec9)[_0x9900('0x18')](_0xce2dd6);}return null;};}function patchUpdates(_0x596eff){return function(_0x48d6df){try{jsonpatch[_0x9900('0x1e')](_0x48d6df,_0x596eff,!![]);}catch(_0x2892ce){return BPromise[_0x9900('0x1f')](_0x2892ce);}return _0x48d6df[_0x9900('0x20')]();};}function saveUpdates(_0x5ee4ad,_0x215bd4){return function(_0x3e4cee){if(_0x3e4cee){return _0x3e4cee[_0x9900('0x21')](_0x5ee4ad)[_0x9900('0x22')](function(_0x45c0d0){return _0x45c0d0;});}return null;};}function removeEntity(_0x5368bf,_0x37842b){return function(_0x218d7e){if(_0x218d7e){return _0x218d7e['destroy']()[_0x9900('0x22')](function(){_0x5368bf[_0x9900('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a015,_0x43ed24){return function(_0x2ac147){if(!_0x2ac147){_0x54a015['sendStatus'](0x194);}return _0x2ac147;};}function handleError(_0x285d51,_0x4507a9){_0x4507a9=_0x4507a9||0x1f4;return function(_0x5e3e21){logger[_0x9900('0x23')](_0x5e3e21[_0x9900('0x24')]);if(_0x5e3e21[_0x9900('0x25')]){delete _0x5e3e21[_0x9900('0x25')];}_0x285d51[_0x9900('0x16')](_0x4507a9)['send'](_0x5e3e21);};}exports[_0x9900('0x26')]=function(_0x44d775,_0x10fbae){var _0x32e343={},_0x3b1b94={},_0x50f16a={'count':0x0,'rows':[]};var _0x4cef1f=_['map'](db[_0x9900('0x27')][_0x9900('0x28')],function(_0x4ef405){return{'name':_0x4ef405[_0x9900('0x29')],'type':_0x4ef405[_0x9900('0x2a')][_0x9900('0x2b')]};});_0x3b1b94['model']=_['map'](_0x4cef1f,_0x9900('0x25'));_0x3b1b94[_0x9900('0x2c')]=_[_0x9900('0x2d')](_0x44d775[_0x9900('0x2c')]);_0x3b1b94['filters']=_['intersection'](_0x3b1b94[_0x9900('0x2e')],_0x3b1b94[_0x9900('0x2c')]);_0x32e343[_0x9900('0x2f')]=_[_0x9900('0x30')](_0x3b1b94[_0x9900('0x2e')],qs[_0x9900('0x31')](_0x44d775[_0x9900('0x2c')][_0x9900('0x31')]));_0x32e343[_0x9900('0x2f')]=_0x32e343[_0x9900('0x2f')][_0x9900('0x32')]?_0x32e343[_0x9900('0x2f')]:_0x3b1b94[_0x9900('0x2e')];if(!_0x44d775['query']['hasOwnProperty'](_0x9900('0x33'))){_0x32e343['limit']=qs[_0x9900('0x1b')](_0x44d775[_0x9900('0x2c')][_0x9900('0x1b')]);_0x32e343[_0x9900('0x19')]=qs[_0x9900('0x19')](_0x44d775[_0x9900('0x2c')][_0x9900('0x19')]);}_0x32e343[_0x9900('0x34')]=qs[_0x9900('0x35')](_0x44d775['query']['sort']);_0x32e343['where']=qs[_0x9900('0x36')](_[_0x9900('0x37')](_0x44d775['query'],_0x3b1b94[_0x9900('0x36')]),_0x4cef1f);if(_0x44d775[_0x9900('0x2c')][_0x9900('0x38')]){_0x32e343['where']=_[_0x9900('0x39')](_0x32e343[_0x9900('0x3a')],{'$or':_[_0x9900('0x3b')](_0x4cef1f,function(_0x141131){if(_0x141131[_0x9900('0x2a')]!==_0x9900('0x3c')){var _0x510d6a={};_0x510d6a[_0x141131[_0x9900('0x25')]]={'$like':'%'+_0x44d775[_0x9900('0x2c')]['filter']+'%'};return _0x510d6a;}})});}_0x32e343=_[_0x9900('0x39')]({},_0x32e343,_0x44d775['options']);var _0x2cee90={'where':_0x32e343[_0x9900('0x3a')]};return db['Cdr'][_0x9900('0x1c')](_0x2cee90)[_0x9900('0x22')](function(_0x2595cc){_0x50f16a[_0x9900('0x1c')]=_0x2595cc;if(_0x44d775[_0x9900('0x2c')]['includeAll']){_0x32e343['include']=[{'all':!![]}];}return db[_0x9900('0x27')]['findAll'](_0x32e343);})['then'](function(_0x5e2765){_0x50f16a['rows']=_0x5e2765;return _0x50f16a;})['then'](respondWithFilteredResult(_0x10fbae,_0x32e343))[_0x9900('0x3d')](handleError(_0x10fbae,null));};exports[_0x9900('0x3e')]=function(_0x3c8f30,_0x42849a){var _0x31c003={'raw':!![],'where':{'id':_0x3c8f30[_0x9900('0x3f')]['id']}},_0xb94a40={};_0xb94a40[_0x9900('0x2e')]=_['keys'](db[_0x9900('0x27')][_0x9900('0x28')]);_0xb94a40['query']=_['keys'](_0x3c8f30[_0x9900('0x2c')]);_0xb94a40[_0x9900('0x36')]=_[_0x9900('0x30')](_0xb94a40[_0x9900('0x2e')],_0xb94a40[_0x9900('0x2c')]);_0x31c003[_0x9900('0x2f')]=_[_0x9900('0x30')](_0xb94a40[_0x9900('0x2e')],qs['fields'](_0x3c8f30[_0x9900('0x2c')][_0x9900('0x31')]));_0x31c003['attributes']=_0x31c003[_0x9900('0x2f')][_0x9900('0x32')]?_0x31c003[_0x9900('0x2f')]:_0xb94a40[_0x9900('0x2e')];if(_0x3c8f30['query'][_0x9900('0x40')]){_0x31c003[_0x9900('0x41')]=[{'all':!![]}];}_0x31c003=_['merge']({},_0x31c003,_0x3c8f30[_0x9900('0x42')]);return db[_0x9900('0x27')][_0x9900('0x43')](_0x31c003)['then'](handleEntityNotFound(_0x42849a,null))[_0x9900('0x22')](respondWithResult(_0x42849a,null))['catch'](handleError(_0x42849a,null));};exports[_0x9900('0x44')]=function(_0x5ea06a,_0x1409a0){return db[_0x9900('0x27')][_0x9900('0x44')](_0x5ea06a['body'],{})[_0x9900('0x22')](respondWithResult(_0x1409a0,0xc9))['catch'](handleError(_0x1409a0,null));};exports[_0x9900('0x21')]=function(_0x11be07,_0x5ac239){if(_0x11be07[_0x9900('0x45')]['id']){delete _0x11be07[_0x9900('0x45')]['id'];}return db['Cdr'][_0x9900('0x43')]({'where':{'id':_0x11be07[_0x9900('0x3f')]['id']}})[_0x9900('0x22')](handleEntityNotFound(_0x5ac239,null))[_0x9900('0x22')](saveUpdates(_0x11be07[_0x9900('0x45')],null))['then'](respondWithResult(_0x5ac239,null))['catch'](handleError(_0x5ac239,null));};exports[_0x9900('0x46')]=function(_0x43cf2c,_0x2aa081){return db[_0x9900('0x27')][_0x9900('0x43')]({'where':{'id':_0x43cf2c['params']['id']}})[_0x9900('0x22')](handleEntityNotFound(_0x2aa081,null))[_0x9900('0x22')](removeEntity(_0x2aa081,null))[_0x9900('0x3d')](handleError(_0x2aa081,null));};exports[_0x9900('0x47')]=function(_0x2f7f74,_0xb5512f){return db[_0x9900('0x27')]['describe']()[_0x9900('0x22')](respondWithResult(_0xb5512f,null))['catch'](handleError(_0xb5512f,null));}; \ No newline at end of file +var _0xab86=['fieldName','type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','filters','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','moment','mustache','path','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','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','map','Cdr','rawAttributes'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xab86,0x13e));var _0x6ab8=function(_0x179a64,_0x443ab2){_0x179a64=_0x179a64-0x0;var _0x34a105=_0xab86[_0x179a64];return _0x34a105;};'use strict';var emlformat=require(_0x6ab8('0x0'));var rimraf=require(_0x6ab8('0x1'));var zipdir=require(_0x6ab8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ab8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ab8('0x4'));var util=require('util');var path=require(_0x6ab8('0x5'));var sox=require(_0x6ab8('0x6'));var csv=require(_0x6ab8('0x7'));var ejs=require(_0x6ab8('0x8'));var fs=require('fs');var fs_extra=require(_0x6ab8('0x9'));var _=require(_0x6ab8('0xa'));var squel=require(_0x6ab8('0xb'));var crypto=require(_0x6ab8('0xc'));var jsforce=require(_0x6ab8('0xd'));var deskjs=require(_0x6ab8('0xe'));var toCsv=require(_0x6ab8('0x7'));var querystring=require(_0x6ab8('0xf'));var Papa=require(_0x6ab8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6ab8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ab8('0x12'));var logger=require(_0x6ab8('0x13'))(_0x6ab8('0x14'));var utils=require('../../config/utils');var config=require(_0x6ab8('0x15'));var licenseUtil=require(_0x6ab8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d1d9,_0x1b9b34){_0x1b9b34=_0x1b9b34||0xcc;return function(_0x408ce1){if(_0x408ce1){return _0x44d1d9['sendStatus'](_0x1b9b34);}return _0x44d1d9[_0x6ab8('0x17')](_0x1b9b34)[_0x6ab8('0x18')]();};}function respondWithResult(_0x60b50,_0x968bac){_0x968bac=_0x968bac||0xc8;return function(_0x1c83a1){if(_0x1c83a1){return _0x60b50[_0x6ab8('0x17')](_0x968bac)[_0x6ab8('0x19')](_0x1c83a1);}};}function respondWithFilteredResult(_0x2043bb,_0x293389){return function(_0x5218e9){if(_0x5218e9){var _0x1f64a3=typeof _0x293389[_0x6ab8('0x1a')]===_0x6ab8('0x1b')&&typeof _0x293389['limit']===_0x6ab8('0x1b');var _0x35b790=_0x5218e9['count'];var _0x543726=_0x1f64a3?0x0:_0x293389[_0x6ab8('0x1a')];var _0x57cd18=_0x1f64a3?_0x5218e9[_0x6ab8('0x1c')]:_0x293389[_0x6ab8('0x1a')]+_0x293389[_0x6ab8('0x1d')];var _0x4e0fbd;if(_0x57cd18>=_0x35b790){_0x57cd18=_0x35b790;_0x4e0fbd=0xc8;}else{_0x4e0fbd=0xce;}_0x2043bb[_0x6ab8('0x17')](_0x4e0fbd);return _0x2043bb[_0x6ab8('0x1e')](_0x6ab8('0x1f'),_0x543726+'-'+_0x57cd18+'/'+_0x35b790)[_0x6ab8('0x19')](_0x5218e9);}return null;};}function patchUpdates(_0x5227c6){return function(_0x301004){try{jsonpatch[_0x6ab8('0x20')](_0x301004,_0x5227c6,!![]);}catch(_0x520cd8){return BPromise['reject'](_0x520cd8);}return _0x301004['save']();};}function saveUpdates(_0x190af2,_0x46cfdc){return function(_0xe2d5d8){if(_0xe2d5d8){return _0xe2d5d8['update'](_0x190af2)[_0x6ab8('0x21')](function(_0x433f37){return _0x433f37;});}return null;};}function removeEntity(_0x50fc50,_0x503f94){return function(_0x8af7e9){if(_0x8af7e9){return _0x8af7e9[_0x6ab8('0x22')]()['then'](function(){_0x50fc50[_0x6ab8('0x17')](0xcc)[_0x6ab8('0x18')]();});}};}function handleEntityNotFound(_0x24e400,_0x3d614b){return function(_0x3ddaeb){if(!_0x3ddaeb){_0x24e400[_0x6ab8('0x23')](0x194);}return _0x3ddaeb;};}function handleError(_0x2e098f,_0x1e26ed){_0x1e26ed=_0x1e26ed||0x1f4;return function(_0x5a1be3){logger['error'](_0x5a1be3[_0x6ab8('0x24')]);if(_0x5a1be3['name']){delete _0x5a1be3[_0x6ab8('0x25')];}_0x2e098f[_0x6ab8('0x17')](_0x1e26ed)[_0x6ab8('0x26')](_0x5a1be3);};}exports['index']=function(_0x525687,_0x4871e3){var _0x79dbd3={},_0x14e822={},_0x3723a7={'count':0x0,'rows':[]};var _0x2f14ea=_[_0x6ab8('0x27')](db[_0x6ab8('0x28')][_0x6ab8('0x29')],function(_0x4eda0b){return{'name':_0x4eda0b[_0x6ab8('0x2a')],'type':_0x4eda0b[_0x6ab8('0x2b')][_0x6ab8('0x2c')]};});_0x14e822[_0x6ab8('0x2d')]=_[_0x6ab8('0x27')](_0x2f14ea,'name');_0x14e822['query']=_[_0x6ab8('0x2e')](_0x525687['query']);_0x14e822['filters']=_[_0x6ab8('0x2f')](_0x14e822[_0x6ab8('0x2d')],_0x14e822['query']);_0x79dbd3[_0x6ab8('0x30')]=_['intersection'](_0x14e822[_0x6ab8('0x2d')],qs[_0x6ab8('0x31')](_0x525687['query']['fields']));_0x79dbd3[_0x6ab8('0x30')]=_0x79dbd3[_0x6ab8('0x30')][_0x6ab8('0x32')]?_0x79dbd3[_0x6ab8('0x30')]:_0x14e822[_0x6ab8('0x2d')];if(!_0x525687[_0x6ab8('0x33')][_0x6ab8('0x34')](_0x6ab8('0x35'))){_0x79dbd3['limit']=qs[_0x6ab8('0x1d')](_0x525687[_0x6ab8('0x33')][_0x6ab8('0x1d')]);_0x79dbd3[_0x6ab8('0x1a')]=qs[_0x6ab8('0x1a')](_0x525687[_0x6ab8('0x33')]['offset']);}_0x79dbd3[_0x6ab8('0x36')]=qs[_0x6ab8('0x37')](_0x525687[_0x6ab8('0x33')]['sort']);_0x79dbd3['where']=qs[_0x6ab8('0x38')](_[_0x6ab8('0x39')](_0x525687[_0x6ab8('0x33')],_0x14e822[_0x6ab8('0x38')]),_0x2f14ea);if(_0x525687[_0x6ab8('0x33')]['filter']){_0x79dbd3['where']=_[_0x6ab8('0x3a')](_0x79dbd3['where'],{'$or':_[_0x6ab8('0x27')](_0x2f14ea,function(_0x9ca6ed){if(_0x9ca6ed['type']!=='VIRTUAL'){var _0x8d76aa={};_0x8d76aa[_0x9ca6ed[_0x6ab8('0x25')]]={'$like':'%'+_0x525687[_0x6ab8('0x33')][_0x6ab8('0x3b')]+'%'};return _0x8d76aa;}})});}_0x79dbd3=_[_0x6ab8('0x3a')]({},_0x79dbd3,_0x525687[_0x6ab8('0x3c')]);var _0xef0ce5={'where':_0x79dbd3['where']};return db['Cdr'][_0x6ab8('0x1c')](_0xef0ce5)[_0x6ab8('0x21')](function(_0x146f43){_0x3723a7[_0x6ab8('0x1c')]=_0x146f43;if(_0x525687['query'][_0x6ab8('0x3d')]){_0x79dbd3['include']=[{'all':!![]}];}return db['Cdr'][_0x6ab8('0x3e')](_0x79dbd3);})[_0x6ab8('0x21')](function(_0x45735d){_0x3723a7[_0x6ab8('0x3f')]=_0x45735d;return _0x3723a7;})[_0x6ab8('0x21')](respondWithFilteredResult(_0x4871e3,_0x79dbd3))[_0x6ab8('0x40')](handleError(_0x4871e3,null));};exports[_0x6ab8('0x41')]=function(_0xf3abb8,_0x2494c3){var _0x45c70d={'raw':!![],'where':{'id':_0xf3abb8[_0x6ab8('0x42')]['id']}},_0xc32c6e={};_0xc32c6e['model']=_[_0x6ab8('0x2e')](db[_0x6ab8('0x28')][_0x6ab8('0x29')]);_0xc32c6e[_0x6ab8('0x33')]=_['keys'](_0xf3abb8[_0x6ab8('0x33')]);_0xc32c6e['filters']=_[_0x6ab8('0x2f')](_0xc32c6e[_0x6ab8('0x2d')],_0xc32c6e['query']);_0x45c70d[_0x6ab8('0x30')]=_[_0x6ab8('0x2f')](_0xc32c6e['model'],qs[_0x6ab8('0x31')](_0xf3abb8[_0x6ab8('0x33')][_0x6ab8('0x31')]));_0x45c70d[_0x6ab8('0x30')]=_0x45c70d[_0x6ab8('0x30')]['length']?_0x45c70d['attributes']:_0xc32c6e['model'];if(_0xf3abb8[_0x6ab8('0x33')][_0x6ab8('0x3d')]){_0x45c70d['include']=[{'all':!![]}];}_0x45c70d=_[_0x6ab8('0x3a')]({},_0x45c70d,_0xf3abb8[_0x6ab8('0x3c')]);return db[_0x6ab8('0x28')][_0x6ab8('0x43')](_0x45c70d)[_0x6ab8('0x21')](handleEntityNotFound(_0x2494c3,null))[_0x6ab8('0x21')](respondWithResult(_0x2494c3,null))['catch'](handleError(_0x2494c3,null));};exports[_0x6ab8('0x44')]=function(_0x74de32,_0x4b00cc){return db[_0x6ab8('0x28')][_0x6ab8('0x44')](_0x74de32[_0x6ab8('0x45')],{})['then'](respondWithResult(_0x4b00cc,0xc9))['catch'](handleError(_0x4b00cc,null));};exports[_0x6ab8('0x46')]=function(_0x4c27fa,_0x31965e){if(_0x4c27fa['body']['id']){delete _0x4c27fa[_0x6ab8('0x45')]['id'];}return db[_0x6ab8('0x28')][_0x6ab8('0x43')]({'where':{'id':_0x4c27fa[_0x6ab8('0x42')]['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0x31965e,null))[_0x6ab8('0x21')](saveUpdates(_0x4c27fa['body'],null))['then'](respondWithResult(_0x31965e,null))['catch'](handleError(_0x31965e,null));};exports[_0x6ab8('0x22')]=function(_0x54708b,_0xce83a3){return db[_0x6ab8('0x28')][_0x6ab8('0x43')]({'where':{'id':_0x54708b[_0x6ab8('0x42')]['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0xce83a3,null))[_0x6ab8('0x21')](removeEntity(_0xce83a3,null))[_0x6ab8('0x40')](handleError(_0xce83a3,null));};exports[_0x6ab8('0x47')]=function(_0x4d4e88,_0x1a372b){return db[_0x6ab8('0x28')][_0x6ab8('0x47')]()[_0x6ab8('0x21')](respondWithResult(_0x1a372b,null))['catch'](handleError(_0x1a372b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 574f518..839bfd6 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x12220f,_0x24cfb5){var _0x31f5f2=function(_0x5f0af6){while(--_0x5f0af6){_0x12220f['push'](_0x12220f['shift']());}};_0x31f5f2(++_0x24cfb5);}(_0x7a54,0x106));var _0x47a5=function(_0x1ca3c6,_0x574b0e){_0x1ca3c6=_0x1ca3c6-0x0;var _0x53c04c=_0x7a54[_0x1ca3c6];return _0x53c04c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x63416d,_0xc47f1){var _0x27b160=function(_0x3191cb){while(--_0x3191cb){_0x63416d['push'](_0x63416d['shift']());}};_0x27b160(++_0xc47f1);}(_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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index dfac075..2bb5ef1 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 _0x97d5=['util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','catch'];(function(_0x1db0ee,_0x3e8d0a){var _0x2af57b=function(_0x51338e){while(--_0x51338e){_0x1db0ee['push'](_0x1db0ee['shift']());}};_0x2af57b(++_0x3e8d0a);}(_0x97d5,0x150));var _0x597d=function(_0x35e7f5,_0x505458){_0x35e7f5=_0x35e7f5-0x0;var _0x21327e=_0x97d5[_0x35e7f5];return _0x21327e;};'use strict';var _=require('lodash');var util=require(_0x597d('0x0'));var moment=require(_0x597d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x597d('0x2'));var logger=require(_0x597d('0x3'))(_0x597d('0x4'));var config=require(_0x597d('0x5'));var jayson=require(_0x597d('0x6'));var client=jayson[_0x597d('0x7')][_0x597d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47e663,_0x10d917,_0x39c005){return new BPromise(function(_0x8d847,_0x4678c1){return client[_0x597d('0x9')](_0x47e663,_0x39c005)[_0x597d('0xa')](function(_0x3c8c91){logger[_0x597d('0xb')]('Cdr,\x20%s,\x20%s',_0x10d917,_0x597d('0xc'));logger[_0x597d('0xd')](_0x597d('0xe'),_0x10d917,_0x597d('0xc'),JSON[_0x597d('0xf')](_0x3c8c91));if(_0x3c8c91[_0x597d('0x10')]){if(_0x3c8c91['error'][_0x597d('0x11')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x10d917,_0x3c8c91[_0x597d('0x10')][_0x597d('0x12')]);return _0x4678c1(_0x3c8c91[_0x597d('0x10')][_0x597d('0x12')]);}logger[_0x597d('0x10')]('Cdr,\x20%s,\x20%s',_0x10d917,_0x3c8c91[_0x597d('0x10')][_0x597d('0x12')]);return _0x8d847(_0x3c8c91['error'][_0x597d('0x12')]);}else{logger[_0x597d('0xb')](_0x597d('0x13'),_0x10d917,'request\x20sent');_0x8d847(_0x3c8c91['result'][_0x597d('0x12')]);}})[_0x597d('0x14')](function(_0x1959c2){logger[_0x597d('0x10')](_0x597d('0x13'),_0x10d917,_0x1959c2);_0x4678c1(_0x1959c2);});});} \ No newline at end of file +var _0x5110=['error','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','message'];(function(_0x25d32f,_0xa94269){var _0x925e6e=function(_0x570a3a){while(--_0x570a3a){_0x25d32f['push'](_0x25d32f['shift']());}};_0x925e6e(++_0xa94269);}(_0x5110,0x16b));var _0x0511=function(_0x2311df,_0x55a309){_0x2311df=_0x2311df-0x0;var _0x1eece9=_0x5110[_0x2311df];return _0x1eece9;};'use strict';var _=require(_0x0511('0x0'));var util=require(_0x0511('0x1'));var moment=require('moment');var BPromise=require(_0x0511('0x2'));var rs=require(_0x0511('0x3'));var fs=require('fs');var Redis=require(_0x0511('0x4'));var db=require(_0x0511('0x5'))['db'];var utils=require(_0x0511('0x6'));var logger=require('../../config/logger')(_0x0511('0x7'));var config=require(_0x0511('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x315fa3,_0x4ab067,_0x43f88e){return new BPromise(function(_0x2d9d84,_0x1afade){return client[_0x0511('0x9')](_0x315fa3,_0x43f88e)['then'](function(_0x406baa){logger[_0x0511('0xa')](_0x0511('0xb'),_0x4ab067,_0x0511('0xc'));logger[_0x0511('0xd')](_0x0511('0xe'),_0x4ab067,_0x0511('0xc'),JSON[_0x0511('0xf')](_0x406baa));if(_0x406baa['error']){if(_0x406baa['error']['code']===0x1f4){logger['error'](_0x0511('0xb'),_0x4ab067,_0x406baa['error'][_0x0511('0x10')]);return _0x1afade(_0x406baa[_0x0511('0x11')][_0x0511('0x10')]);}logger[_0x0511('0x11')]('Cdr,\x20%s,\x20%s',_0x4ab067,_0x406baa[_0x0511('0x11')][_0x0511('0x10')]);return _0x2d9d84(_0x406baa['error'][_0x0511('0x10')]);}else{logger[_0x0511('0xa')](_0x0511('0xb'),_0x4ab067,_0x0511('0xc'));_0x2d9d84(_0x406baa[_0x0511('0x12')][_0x0511('0x10')]);}})['catch'](function(_0x44f5db){logger[_0x0511('0x11')](_0x0511('0xb'),_0x4ab067,_0x44f5db);_0x1afade(_0x44f5db);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 40835e5..dfefb91 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _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(_0x31659b,_0x3f07a1){var _0x48b140=function(_0x3b295c){while(--_0x3b295c){_0x31659b['push'](_0x31659b['shift']());}};_0x48b140(++_0x3f07a1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c5ffc73..c5709ac 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 _0x5575=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x26d252,_0x5593bc){var _0x489f95=function(_0x3d751d){while(--_0x3d751d){_0x26d252['push'](_0x26d252['shift']());}};_0x489f95(++_0x5593bc);}(_0x5575,0xd3));var _0x5557=function(_0x295103,_0x3de66d){_0x295103=_0x295103-0x0;var _0x5e6c4c=_0x5575[_0x295103];return _0x5e6c4c;};'use strict';var Sequelize=require(_0x5557('0x0'));module[_0x5557('0x1')]={'priority':{'type':Sequelize[_0x5557('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5557('0x3')],'allowNull':![],'defaultValue':_0x5557('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5557('0x3')],'defaultValue':_0x5557('0x5')}}; \ No newline at end of file +var _0xa2a8=['STRING','TEXT','sequelize','exports','INTEGER'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xa2a8,0x89));var _0x8a2a=function(_0x5d6494,_0x1f6d6a){_0x5d6494=_0x5d6494-0x0;var _0x1bde5e=_0xa2a8[_0x5d6494];return _0x1bde5e;};'use strict';var Sequelize=require(_0x8a2a('0x0'));module[_0x8a2a('0x1')]={'priority':{'type':Sequelize[_0x8a2a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8a2a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8a2a('0x4')]()},'description':{'type':Sequelize[_0x8a2a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 826430c..5bc1034 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 _0x6e16=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','catch','body','find','zip-dir','request-promise','bluebird','mustache','path'];(function(_0x1c0280,_0xeef5a3){var _0x45f8a0=function(_0x590d3b){while(--_0x590d3b){_0x1c0280['push'](_0x1c0280['shift']());}};_0x45f8a0(++_0xeef5a3);}(_0x6e16,0x1d3));var _0x66e1=function(_0x12c5ab,_0x5cb466){_0x12c5ab=_0x12c5ab-0x0;var _0x1248fd=_0x6e16[_0x12c5ab];return _0x1248fd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66e1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66e1('0x1'));var moment=require('moment');var BPromise=require(_0x66e1('0x2'));var Mustache=require(_0x66e1('0x3'));var util=require('util');var path=require(_0x66e1('0x4'));var sox=require('sox');var csv=require(_0x66e1('0x5'));var ejs=require(_0x66e1('0x6'));var fs=require('fs');var fs_extra=require(_0x66e1('0x7'));var _=require('lodash');var squel=require(_0x66e1('0x8'));var crypto=require(_0x66e1('0x9'));var jsforce=require(_0x66e1('0xa'));var deskjs=require(_0x66e1('0xb'));var toCsv=require(_0x66e1('0x5'));var querystring=require(_0x66e1('0xc'));var Papa=require(_0x66e1('0xd'));var Redis=require(_0x66e1('0xe'));var authService=require(_0x66e1('0xf'));var qs=require(_0x66e1('0x10'));var as=require(_0x66e1('0x11'));var hardwareService=require(_0x66e1('0x12'));var logger=require(_0x66e1('0x13'))(_0x66e1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x66e1('0x15'));var db=require(_0x66e1('0x16'))['db'];function respondWithStatusCode(_0x23e018,_0x497712){_0x497712=_0x497712||0xcc;return function(_0x58c184){if(_0x58c184){return _0x23e018[_0x66e1('0x17')](_0x497712);}return _0x23e018['status'](_0x497712)[_0x66e1('0x18')]();};}function respondWithResult(_0x3e36ff,_0x5b802b){_0x5b802b=_0x5b802b||0xc8;return function(_0x9c17f9){if(_0x9c17f9){return _0x3e36ff[_0x66e1('0x19')](_0x5b802b)['json'](_0x9c17f9);}};}function respondWithFilteredResult(_0x137f52,_0x12ca0b){return function(_0x18e2ab){if(_0x18e2ab){var _0x3a68b3=typeof _0x12ca0b['offset']===_0x66e1('0x1a')&&typeof _0x12ca0b[_0x66e1('0x1b')]===_0x66e1('0x1a');var _0x28e236=_0x18e2ab[_0x66e1('0x1c')];var _0x4f3276=_0x3a68b3?0x0:_0x12ca0b['offset'];var _0x2b5585=_0x3a68b3?_0x18e2ab['count']:_0x12ca0b[_0x66e1('0x1d')]+_0x12ca0b[_0x66e1('0x1b')];var _0x260e87;if(_0x2b5585>=_0x28e236){_0x2b5585=_0x28e236;_0x260e87=0xc8;}else{_0x260e87=0xce;}_0x137f52[_0x66e1('0x19')](_0x260e87);return _0x137f52[_0x66e1('0x1e')]('Content-Range',_0x4f3276+'-'+_0x2b5585+'/'+_0x28e236)[_0x66e1('0x1f')](_0x18e2ab);}return null;};}function patchUpdates(_0x23c6ce){return function(_0xe2822e){try{jsonpatch[_0x66e1('0x20')](_0xe2822e,_0x23c6ce,!![]);}catch(_0x28f6cf){return BPromise[_0x66e1('0x21')](_0x28f6cf);}return _0xe2822e[_0x66e1('0x22')]();};}function saveUpdates(_0x38cf5b,_0x11232c){return function(_0x350b81){if(_0x350b81){return _0x350b81[_0x66e1('0x23')](_0x38cf5b)[_0x66e1('0x24')](function(_0x43686e){return _0x43686e;});}return null;};}function removeEntity(_0x2ea42d,_0x756840){return function(_0x11b7f0){if(_0x11b7f0){return _0x11b7f0[_0x66e1('0x25')]()['then'](function(){_0x2ea42d[_0x66e1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x203919,_0x414c30){return function(_0x181a7b){if(!_0x181a7b){_0x203919[_0x66e1('0x17')](0x194);}return _0x181a7b;};}function handleError(_0x1e0dfe,_0x4f500e){_0x4f500e=_0x4f500e||0x1f4;return function(_0x5c416d){logger[_0x66e1('0x26')](_0x5c416d[_0x66e1('0x27')]);if(_0x5c416d['name']){delete _0x5c416d[_0x66e1('0x28')];}_0x1e0dfe['status'](_0x4f500e)['send'](_0x5c416d);};}exports[_0x66e1('0x29')]=function(_0x3fcc99,_0xdd2360){var _0x2720af={'raw':!![],'where':{'id':_0x3fcc99[_0x66e1('0x2a')]['id']}},_0x218902={};_0x218902[_0x66e1('0x2b')]=_[_0x66e1('0x2c')](db[_0x66e1('0x2d')][_0x66e1('0x2e')]);_0x218902[_0x66e1('0x2f')]=_[_0x66e1('0x2c')](_0x3fcc99['query']);_0x218902[_0x66e1('0x30')]=_[_0x66e1('0x31')](_0x218902['model'],_0x218902[_0x66e1('0x2f')]);_0x2720af[_0x66e1('0x32')]=_[_0x66e1('0x31')](_0x218902[_0x66e1('0x2b')],qs['fields'](_0x3fcc99[_0x66e1('0x2f')][_0x66e1('0x33')]));_0x2720af[_0x66e1('0x32')]=_0x2720af['attributes'][_0x66e1('0x34')]?_0x2720af['attributes']:_0x218902['model'];if(_0x3fcc99['query'][_0x66e1('0x35')]){_0x2720af[_0x66e1('0x36')]=[{'all':!![]}];}_0x2720af=_['merge']({},_0x2720af,_0x3fcc99[_0x66e1('0x37')]);return db[_0x66e1('0x2d')]['find'](_0x2720af)['then'](handleEntityNotFound(_0xdd2360,null))[_0x66e1('0x24')](respondWithResult(_0xdd2360,null))[_0x66e1('0x38')](handleError(_0xdd2360,null));};exports[_0x66e1('0x23')]=function(_0x4a91b9,_0x364053){if(_0x4a91b9[_0x66e1('0x39')]['id']){delete _0x4a91b9[_0x66e1('0x39')]['id'];}return db[_0x66e1('0x2d')]['find']({'where':{'id':_0x4a91b9[_0x66e1('0x2a')]['id']}})[_0x66e1('0x24')](handleEntityNotFound(_0x364053,null))[_0x66e1('0x24')](saveUpdates(_0x4a91b9[_0x66e1('0x39')],null))[_0x66e1('0x24')](respondWithResult(_0x364053,null))[_0x66e1('0x38')](handleError(_0x364053,null));};exports[_0x66e1('0x25')]=function(_0x361f71,_0xb17802){return db[_0x66e1('0x2d')][_0x66e1('0x3a')]({'where':{'id':_0x361f71[_0x66e1('0x2a')]['id']}})[_0x66e1('0x24')](handleEntityNotFound(_0xb17802,null))[_0x66e1('0x24')](removeEntity(_0xb17802,null))[_0x66e1('0x38')](handleError(_0xb17802,null));}; \ No newline at end of file +var _0x33d2=['fields','length','includeAll','merge','options','find','catch','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','show','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33d2,0x7f));var _0x233d=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0x33d2[_0x37e845];return _0x59e55b;};'use strict';var emlformat=require(_0x233d('0x0'));var rimraf=require(_0x233d('0x1'));var zipdir=require(_0x233d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x233d('0x3'));var moment=require(_0x233d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x233d('0x5'));var util=require(_0x233d('0x6'));var path=require(_0x233d('0x7'));var sox=require(_0x233d('0x8'));var csv=require(_0x233d('0x9'));var ejs=require(_0x233d('0xa'));var fs=require('fs');var fs_extra=require(_0x233d('0xb'));var _=require(_0x233d('0xc'));var squel=require('squel');var crypto=require(_0x233d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x233d('0xe'));var toCsv=require(_0x233d('0x9'));var querystring=require(_0x233d('0xf'));var Papa=require('papaparse');var Redis=require(_0x233d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x233d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x233d('0x12'));var logger=require(_0x233d('0x13'))(_0x233d('0x14'));var utils=require('../../config/utils');var config=require(_0x233d('0x15'));var licenseUtil=require(_0x233d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d36d3,_0x19f04c){_0x19f04c=_0x19f04c||0xcc;return function(_0x51c461){if(_0x51c461){return _0x2d36d3[_0x233d('0x17')](_0x19f04c);}return _0x2d36d3[_0x233d('0x18')](_0x19f04c)[_0x233d('0x19')]();};}function respondWithResult(_0x50a166,_0x36627d){_0x36627d=_0x36627d||0xc8;return function(_0x294703){if(_0x294703){return _0x50a166[_0x233d('0x18')](_0x36627d)[_0x233d('0x1a')](_0x294703);}};}function respondWithFilteredResult(_0xda6da2,_0x59b818){return function(_0xd7624c){if(_0xd7624c){var _0x552bbd=typeof _0x59b818[_0x233d('0x1b')]===_0x233d('0x1c')&&typeof _0x59b818[_0x233d('0x1d')]===_0x233d('0x1c');var _0x2b5bb0=_0xd7624c['count'];var _0x4f96c8=_0x552bbd?0x0:_0x59b818[_0x233d('0x1b')];var _0x409637=_0x552bbd?_0xd7624c[_0x233d('0x1e')]:_0x59b818[_0x233d('0x1b')]+_0x59b818[_0x233d('0x1d')];var _0x1b70da;if(_0x409637>=_0x2b5bb0){_0x409637=_0x2b5bb0;_0x1b70da=0xc8;}else{_0x1b70da=0xce;}_0xda6da2[_0x233d('0x18')](_0x1b70da);return _0xda6da2[_0x233d('0x1f')](_0x233d('0x20'),_0x4f96c8+'-'+_0x409637+'/'+_0x2b5bb0)[_0x233d('0x1a')](_0xd7624c);}return null;};}function patchUpdates(_0x3fa180){return function(_0x3ff3e3){try{jsonpatch[_0x233d('0x21')](_0x3ff3e3,_0x3fa180,!![]);}catch(_0x5aa707){return BPromise[_0x233d('0x22')](_0x5aa707);}return _0x3ff3e3[_0x233d('0x23')]();};}function saveUpdates(_0x5dd0e0,_0x12f8e8){return function(_0x19f575){if(_0x19f575){return _0x19f575[_0x233d('0x24')](_0x5dd0e0)[_0x233d('0x25')](function(_0x4f4c2a){return _0x4f4c2a;});}return null;};}function removeEntity(_0xe38aea,_0x19749f){return function(_0x3c3cba){if(_0x3c3cba){return _0x3c3cba[_0x233d('0x26')]()[_0x233d('0x25')](function(){_0xe38aea[_0x233d('0x18')](0xcc)[_0x233d('0x19')]();});}};}function handleEntityNotFound(_0x586f62,_0x517d61){return function(_0x507b5a){if(!_0x507b5a){_0x586f62['sendStatus'](0x194);}return _0x507b5a;};}function handleError(_0x24087a,_0x14cda3){_0x14cda3=_0x14cda3||0x1f4;return function(_0x1609ed){logger['error'](_0x1609ed[_0x233d('0x27')]);if(_0x1609ed[_0x233d('0x28')]){delete _0x1609ed[_0x233d('0x28')];}_0x24087a[_0x233d('0x18')](_0x14cda3)['send'](_0x1609ed);};}exports[_0x233d('0x29')]=function(_0xf10fbe,_0x3db64c){var _0x332962={'raw':!![],'where':{'id':_0xf10fbe['params']['id']}},_0x23f4a0={};_0x23f4a0['model']=_[_0x233d('0x2a')](db[_0x233d('0x2b')][_0x233d('0x2c')]);_0x23f4a0[_0x233d('0x2d')]=_[_0x233d('0x2a')](_0xf10fbe[_0x233d('0x2d')]);_0x23f4a0[_0x233d('0x2e')]=_[_0x233d('0x2f')](_0x23f4a0[_0x233d('0x30')],_0x23f4a0['query']);_0x332962[_0x233d('0x31')]=_[_0x233d('0x2f')](_0x23f4a0[_0x233d('0x30')],qs['fields'](_0xf10fbe['query'][_0x233d('0x32')]));_0x332962['attributes']=_0x332962['attributes'][_0x233d('0x33')]?_0x332962[_0x233d('0x31')]:_0x23f4a0[_0x233d('0x30')];if(_0xf10fbe[_0x233d('0x2d')][_0x233d('0x34')]){_0x332962['include']=[{'all':!![]}];}_0x332962=_[_0x233d('0x35')]({},_0x332962,_0xf10fbe[_0x233d('0x36')]);return db[_0x233d('0x2b')][_0x233d('0x37')](_0x332962)['then'](handleEntityNotFound(_0x3db64c,null))[_0x233d('0x25')](respondWithResult(_0x3db64c,null))[_0x233d('0x38')](handleError(_0x3db64c,null));};exports[_0x233d('0x24')]=function(_0xa82d72,_0x116578){if(_0xa82d72[_0x233d('0x39')]['id']){delete _0xa82d72[_0x233d('0x39')]['id'];}return db[_0x233d('0x2b')][_0x233d('0x37')]({'where':{'id':_0xa82d72[_0x233d('0x3a')]['id']}})[_0x233d('0x25')](handleEntityNotFound(_0x116578,null))[_0x233d('0x25')](saveUpdates(_0xa82d72[_0x233d('0x39')],null))[_0x233d('0x25')](respondWithResult(_0x116578,null))[_0x233d('0x38')](handleError(_0x116578,null));};exports[_0x233d('0x26')]=function(_0x573921,_0x5ec9a3){return db[_0x233d('0x2b')][_0x233d('0x37')]({'where':{'id':_0x573921[_0x233d('0x3a')]['id']}})[_0x233d('0x25')](handleEntityNotFound(_0x5ec9a3,null))[_0x233d('0x25')](removeEntity(_0x5ec9a3,null))[_0x233d('0x38')](handleError(_0x5ec9a3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index b6ffef7..93d7290 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 _0xad86=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','lodash','util'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xad86,0x194));var _0x6ad8=function(_0x41c2ee,_0x17f698){_0x41c2ee=_0x41c2ee-0x0;var _0x539d23=_0xad86[_0x41c2ee];return _0x539d23;};'use strict';var _=require(_0x6ad8('0x0'));var util=require(_0x6ad8('0x1'));var logger=require(_0x6ad8('0x2'))(_0x6ad8('0x3'));var moment=require(_0x6ad8('0x4'));var BPromise=require(_0x6ad8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6ad8('0x6'));var config=require(_0x6ad8('0x7'));var attributes=require(_0x6ad8('0x8'));module[_0x6ad8('0x9')]=function(_0x59fb87,_0x4d498c){return _0x59fb87[_0x6ad8('0xa')](_0x6ad8('0xb'),attributes,{'tableName':_0x6ad8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6ad8('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x901c=['exports','define','ChatApplication','chat_applications','utf8mb4','lodash','../../config/logger','moment','bluebird','path','rimraf','./chatApplication.attributes'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x901c,0x119));var _0xc901=function(_0x336af7,_0x198a11){_0x336af7=_0x336af7-0x0;var _0x29469a=_0x901c[_0x336af7];return _0x29469a;};'use strict';var _=require(_0xc901('0x0'));var util=require('util');var logger=require(_0xc901('0x1'))('api');var moment=require(_0xc901('0x2'));var BPromise=require(_0xc901('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc901('0x4'));var rimraf=require(_0xc901('0x5'));var config=require('../../config/environment');var attributes=require(_0xc901('0x6'));module[_0xc901('0x7')]=function(_0x29e64d,_0x5cad1b){return _0x29e64d[_0xc901('0x8')](_0xc901('0x9'),attributes,{'tableName':_0xc901('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc901('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 1da67c3..28cafd1 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 _0x603d=['../../config/environment','jayson/promise','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x603d,0x92));var _0xd603=function(_0x442ab2,_0x2f1fbb){_0x442ab2=_0x442ab2-0x0;var _0x24f5de=_0x603d[_0x442ab2];return _0x24f5de;};'use strict';var _=require(_0xd603('0x0'));var util=require(_0xd603('0x1'));var moment=require(_0xd603('0x2'));var BPromise=require('bluebird');var rs=require(_0xd603('0x3'));var fs=require('fs');var Redis=require(_0xd603('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd603('0x5'));var logger=require(_0xd603('0x6'))(_0xd603('0x7'));var config=require(_0xd603('0x8'));var jayson=require(_0xd603('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c5774,_0x450cbd,_0x321b8d){return new BPromise(function(_0x2f0de5,_0x2c6ef0){return client[_0xd603('0xa')](_0x2c5774,_0x321b8d)[_0xd603('0xb')](function(_0x11b4e7){logger['info'](_0xd603('0xc'),_0x450cbd,_0xd603('0xd'));logger[_0xd603('0xe')](_0xd603('0xf'),_0x450cbd,_0xd603('0xd'),JSON[_0xd603('0x10')](_0x11b4e7));if(_0x11b4e7[_0xd603('0x11')]){if(_0x11b4e7[_0xd603('0x11')]['code']===0x1f4){logger[_0xd603('0x11')]('ChatApplication,\x20%s,\x20%s',_0x450cbd,_0x11b4e7[_0xd603('0x11')][_0xd603('0x12')]);return _0x2c6ef0(_0x11b4e7[_0xd603('0x11')]['message']);}logger[_0xd603('0x11')](_0xd603('0xc'),_0x450cbd,_0x11b4e7[_0xd603('0x11')][_0xd603('0x12')]);return _0x2f0de5(_0x11b4e7['error'][_0xd603('0x12')]);}else{logger[_0xd603('0x13')](_0xd603('0xc'),_0x450cbd,_0xd603('0xd'));_0x2f0de5(_0x11b4e7[_0xd603('0x14')][_0xd603('0x12')]);}})[_0xd603('0x15')](function(_0x178f4d){logger['error'](_0xd603('0xc'),_0x450cbd,_0x178f4d);_0x2c6ef0(_0x178f4d);});});} \ No newline at end of file +var _0x59cf=['request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x59cf,0x12c));var _0xf59c=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0x59cf[_0x4bd67a];return _0x2be5fb;};'use strict';var _=require(_0xf59c('0x0'));var util=require(_0xf59c('0x1'));var moment=require('moment');var BPromise=require(_0xf59c('0x2'));var rs=require(_0xf59c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf59c('0x4'))['db'];var utils=require(_0xf59c('0x5'));var logger=require('../../config/logger')(_0xf59c('0x6'));var config=require(_0xf59c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf59c('0x8')][_0xf59c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cfa4d,_0x26e042,_0x44587a){return new BPromise(function(_0x38f546,_0x227094){return client[_0xf59c('0xa')](_0x2cfa4d,_0x44587a)[_0xf59c('0xb')](function(_0x2417f9){logger[_0xf59c('0xc')](_0xf59c('0xd'),_0x26e042,'request\x20sent');logger['debug'](_0xf59c('0xe'),_0x26e042,_0xf59c('0xf'),JSON['stringify'](_0x2417f9));if(_0x2417f9['error']){if(_0x2417f9[_0xf59c('0x10')][_0xf59c('0x11')]===0x1f4){logger[_0xf59c('0x10')](_0xf59c('0xd'),_0x26e042,_0x2417f9[_0xf59c('0x10')][_0xf59c('0x12')]);return _0x227094(_0x2417f9[_0xf59c('0x10')]['message']);}logger[_0xf59c('0x10')](_0xf59c('0xd'),_0x26e042,_0x2417f9[_0xf59c('0x10')][_0xf59c('0x12')]);return _0x38f546(_0x2417f9[_0xf59c('0x10')][_0xf59c('0x12')]);}else{logger[_0xf59c('0xc')](_0xf59c('0xd'),_0x26e042,_0xf59c('0xf'));_0x38f546(_0x2417f9[_0xf59c('0x13')]['message']);}})[_0xf59c('0x14')](function(_0x4caa83){logger[_0xf59c('0x10')](_0xf59c('0xd'),_0x26e042,_0x4caa83);_0x227094(_0x4caa83);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3fb4742..9b5ac0b 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 _0xd78e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','isAuthenticated','put','update','delete','/:id','exports','util','path'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0xd78e,0xce));var _0xed78=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd78e[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0xed78('0x0'));var path=require(_0xed78('0x1'));var timeout=require(_0xed78('0x2'));var express=require(_0xed78('0x3'));var router=express[_0xed78('0x4')]();var fs_extra=require(_0xed78('0x5'));var auth=require(_0xed78('0x6'));var interaction=require(_0xed78('0x7'));var config=require(_0xed78('0x8'));var controller=require(_0xed78('0x9'));router['get']('/:id',auth[_0xed78('0xa')](),controller['show']);router[_0xed78('0xb')]('/:id',auth[_0xed78('0xa')](),controller[_0xed78('0xc')]);router[_0xed78('0xd')](_0xed78('0xe'),auth[_0xed78('0xa')](),controller['destroy']);module[_0xed78('0xf')]=router; \ No newline at end of file +var _0xf8e5=['isAuthenticated','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id'];(function(_0x3305b5,_0x50a1a8){var _0x41fea1=function(_0x3c1fa5){while(--_0x3c1fa5){_0x3305b5['push'](_0x3305b5['shift']());}};_0x41fea1(++_0x50a1a8);}(_0xf8e5,0x170));var _0x5f8e=function(_0x441eda,_0x5af144){_0x441eda=_0x441eda-0x0;var _0x47f045=_0xf8e5[_0x441eda];return _0x47f045;};'use strict';var multer=require(_0x5f8e('0x0'));var util=require(_0x5f8e('0x1'));var path=require(_0x5f8e('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f8e('0x3'));var router=express['Router']();var fs_extra=require(_0x5f8e('0x4'));var auth=require(_0x5f8e('0x5'));var interaction=require(_0x5f8e('0x6'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0x5f8e('0x7')](_0x5f8e('0x8'),auth[_0x5f8e('0x9')](),controller['show']);router['put'](_0x5f8e('0x8'),auth['isAuthenticated'](),controller[_0x5f8e('0xa')]);router[_0x5f8e('0xb')]('/:id',auth[_0x5f8e('0x9')](),controller['destroy']);module[_0x5f8e('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index cf2967f..d8194cc 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 _0xcd03=['STRING','BOOLEAN','sequelize'];(function(_0x302b5f,_0x394748){var _0x2ffb2b=function(_0xdc024e){while(--_0xdc024e){_0x302b5f['push'](_0x302b5f['shift']());}};_0x2ffb2b(++_0x394748);}(_0xcd03,0x14f));var _0x3cd0=function(_0xdf0c09,_0x8fbdd5){_0xdf0c09=_0xdf0c09-0x0;var _0x48f3c6=_0xcd03[_0xdf0c09];return _0x48f3c6;};'use strict';var Sequelize=require(_0x3cd0('0x0'));module['exports']={'name':{'type':Sequelize[_0x3cd0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x3cd0('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x41ec=['STRING','BOOLEAN','exports'];(function(_0x2f384e,_0x237f8b){var _0x56f0dd=function(_0x5087ff){while(--_0x5087ff){_0x2f384e['push'](_0x2f384e['shift']());}};_0x56f0dd(++_0x237f8b);}(_0x41ec,0x143));var _0xc41e=function(_0x14d800,_0x4a67bb){_0x14d800=_0x14d800-0x0;var _0x4e5d3a=_0x41ec[_0x14d800];return _0x4e5d3a;};'use strict';var Sequelize=require('sequelize');module[_0xc41e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc41e('0x1')]},'write':{'type':Sequelize[_0xc41e('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 7b1cc9c..4038a98 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 _0x654c=['where','filters','merge','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','addMembers','ids','findOne','User','pick','getMembers','removeMembers','addMessage','ChatInternalMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x49f19e,_0x1c3aa3){var _0x280b5a=function(_0x277203){while(--_0x277203){_0x49f19e['push'](_0x49f19e['shift']());}};_0x280b5a(++_0x1c3aa3);}(_0x654c,0x1f3));var _0xc654=function(_0x18010c,_0x7352e3){_0x18010c=_0x18010c-0x0;var _0x237628=_0x654c[_0x18010c];return _0x237628;};'use strict';var emlformat=require(_0xc654('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc654('0x1'));var moment=require(_0xc654('0x2'));var BPromise=require(_0xc654('0x3'));var Mustache=require(_0xc654('0x4'));var util=require(_0xc654('0x5'));var path=require(_0xc654('0x6'));var sox=require(_0xc654('0x7'));var csv=require(_0xc654('0x8'));var ejs=require(_0xc654('0x9'));var fs=require('fs');var fs_extra=require(_0xc654('0xa'));var _=require(_0xc654('0xb'));var squel=require(_0xc654('0xc'));var crypto=require(_0xc654('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc654('0xe'));var toCsv=require(_0xc654('0x8'));var querystring=require('querystring');var Papa=require(_0xc654('0xf'));var Redis=require(_0xc654('0x10'));var authService=require(_0xc654('0x11'));var qs=require(_0xc654('0x12'));var as=require(_0xc654('0x13'));var hardwareService=require(_0xc654('0x14'));var logger=require(_0xc654('0x15'))(_0xc654('0x16'));var utils=require(_0xc654('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc654('0x18'))['db'];config['redis']=_['defaults'](config[_0xc654('0x19')],{'host':_0xc654('0x1a'),'port':0x18eb});var socket=require(_0xc654('0x1b'))(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x5ed23f,_0x2deedc){_0x2deedc=_0x2deedc||0xcc;return function(_0x4113af){if(_0x4113af){return _0x5ed23f[_0xc654('0x1c')](_0x2deedc);}return _0x5ed23f[_0xc654('0x1d')](_0x2deedc)[_0xc654('0x1e')]();};}function respondWithResult(_0x44b582,_0x14bd47){_0x14bd47=_0x14bd47||0xc8;return function(_0x2a2ef2){if(_0x2a2ef2){return _0x44b582[_0xc654('0x1d')](_0x14bd47)[_0xc654('0x1f')](_0x2a2ef2);}};}function respondWithFilteredResult(_0x21e40e,_0x49475c){return function(_0x5a2012){if(_0x5a2012){var _0x4be672=typeof _0x49475c[_0xc654('0x20')]===_0xc654('0x21')&&typeof _0x49475c[_0xc654('0x22')]==='undefined';var _0xe167b6=_0x5a2012[_0xc654('0x23')];var _0x3c5d2d=_0x4be672?0x0:_0x49475c['offset'];var _0x3fb6a8=_0x4be672?_0x5a2012[_0xc654('0x23')]:_0x49475c[_0xc654('0x20')]+_0x49475c[_0xc654('0x22')];var _0xc16cdc;if(_0x3fb6a8>=_0xe167b6){_0x3fb6a8=_0xe167b6;_0xc16cdc=0xc8;}else{_0xc16cdc=0xce;}_0x21e40e[_0xc654('0x1d')](_0xc16cdc);return _0x21e40e[_0xc654('0x24')](_0xc654('0x25'),_0x3c5d2d+'-'+_0x3fb6a8+'/'+_0xe167b6)[_0xc654('0x1f')](_0x5a2012);}return null;};}function patchUpdates(_0x29610e){return function(_0x2f58d4){try{jsonpatch[_0xc654('0x26')](_0x2f58d4,_0x29610e,!![]);}catch(_0xef3517){return BPromise[_0xc654('0x27')](_0xef3517);}return _0x2f58d4['save']();};}function saveUpdates(_0x119cda,_0x40c37e){return function(_0x133669){if(_0x133669){return _0x133669[_0xc654('0x28')](_0x119cda)[_0xc654('0x29')](function(_0x317fa4){return _0x317fa4;});}return null;};}function removeEntity(_0x2176fd,_0x21817a){return function(_0xe5a328){if(_0xe5a328){return _0xe5a328[_0xc654('0x2a')]()[_0xc654('0x29')](function(){_0x2176fd[_0xc654('0x1d')](0xcc)[_0xc654('0x1e')]();});}};}function handleEntityNotFound(_0x3c3fde,_0x20f235){return function(_0xdcbde3){if(!_0xdcbde3){_0x3c3fde[_0xc654('0x1c')](0x194);}return _0xdcbde3;};}function handleError(_0x4a08d2,_0x111616){_0x111616=_0x111616||0x1f4;return function(_0x26cac0){logger[_0xc654('0x2b')](_0x26cac0[_0xc654('0x2c')]);if(_0x26cac0[_0xc654('0x2d')]){delete _0x26cac0[_0xc654('0x2d')];}_0x4a08d2[_0xc654('0x1d')](_0x111616)[_0xc654('0x2e')](_0x26cac0);};}exports[_0xc654('0x2f')]=function(_0x440504,_0x547df1){var _0x55680e={},_0x102c01={},_0x40e233={'count':0x0,'rows':[]};var _0x3e4921=_[_0xc654('0x30')](db[_0xc654('0x31')][_0xc654('0x32')],function(_0x38d409){return{'name':_0x38d409[_0xc654('0x33')],'type':_0x38d409[_0xc654('0x34')][_0xc654('0x35')]};});_0x102c01['model']=_[_0xc654('0x30')](_0x3e4921,'name');_0x102c01[_0xc654('0x36')]=_[_0xc654('0x37')](_0x440504[_0xc654('0x36')]);_0x102c01['filters']=_[_0xc654('0x38')](_0x102c01[_0xc654('0x39')],_0x102c01['query']);_0x55680e['attributes']=_[_0xc654('0x38')](_0x102c01[_0xc654('0x39')],qs['fields'](_0x440504[_0xc654('0x36')][_0xc654('0x3a')]));_0x55680e[_0xc654('0x3b')]=_0x55680e[_0xc654('0x3b')][_0xc654('0x3c')]?_0x55680e['attributes']:_0x102c01[_0xc654('0x39')];if(!_0x440504['query'][_0xc654('0x3d')](_0xc654('0x3e'))){_0x55680e['limit']=qs[_0xc654('0x22')](_0x440504['query'][_0xc654('0x22')]);_0x55680e[_0xc654('0x20')]=qs[_0xc654('0x20')](_0x440504[_0xc654('0x36')][_0xc654('0x20')]);}_0x55680e[_0xc654('0x3f')]=qs['sort'](_0x440504[_0xc654('0x36')][_0xc654('0x40')]);_0x55680e[_0xc654('0x41')]=qs[_0xc654('0x42')](_['pick'](_0x440504['query'],_0x102c01['filters']),_0x3e4921);if(_0x440504['query']['filter']){_0x55680e[_0xc654('0x41')]=_[_0xc654('0x43')](_0x55680e[_0xc654('0x41')],{'$or':_[_0xc654('0x30')](_0x3e4921,function(_0x1d711e){if(_0x1d711e[_0xc654('0x34')]!=='VIRTUAL'){var _0x506753={};_0x506753[_0x1d711e[_0xc654('0x2d')]]={'$like':'%'+_0x440504[_0xc654('0x36')][_0xc654('0x44')]+'%'};return _0x506753;}})});}_0x55680e=_[_0xc654('0x43')]({},_0x55680e,_0x440504[_0xc654('0x45')]);var _0x2b50b9={'where':_0x55680e['where']};return db[_0xc654('0x31')]['count'](_0x2b50b9)[_0xc654('0x29')](function(_0x19be0f){_0x40e233[_0xc654('0x23')]=_0x19be0f;if(_0x440504[_0xc654('0x36')]['includeAll']){_0x55680e['include']=[{'all':!![]}];}return db[_0xc654('0x31')][_0xc654('0x46')](_0x55680e);})[_0xc654('0x29')](function(_0xfd2168){_0x40e233[_0xc654('0x47')]=_0xfd2168;return _0x40e233;})[_0xc654('0x29')](respondWithFilteredResult(_0x547df1,_0x55680e))[_0xc654('0x48')](handleError(_0x547df1,null));};exports[_0xc654('0x49')]=function(_0x3d231d,_0x5b3e10){var _0x5bed86={'raw':!![],'where':{'id':_0x3d231d[_0xc654('0x4a')]['id']}},_0x18231c={};_0x18231c['model']=_[_0xc654('0x37')](db[_0xc654('0x31')][_0xc654('0x32')]);_0x18231c[_0xc654('0x36')]=_[_0xc654('0x37')](_0x3d231d['query']);_0x18231c[_0xc654('0x42')]=_[_0xc654('0x38')](_0x18231c[_0xc654('0x39')],_0x18231c['query']);_0x5bed86['attributes']=_[_0xc654('0x38')](_0x18231c['model'],qs[_0xc654('0x3a')](_0x3d231d[_0xc654('0x36')][_0xc654('0x3a')]));_0x5bed86['attributes']=_0x5bed86[_0xc654('0x3b')][_0xc654('0x3c')]?_0x5bed86[_0xc654('0x3b')]:_0x18231c[_0xc654('0x39')];if(_0x3d231d[_0xc654('0x36')][_0xc654('0x4b')]){_0x5bed86[_0xc654('0x4c')]=[{'all':!![]}];}_0x5bed86=_[_0xc654('0x43')]({},_0x5bed86,_0x3d231d['options']);return db[_0xc654('0x31')][_0xc654('0x4d')](_0x5bed86)['then'](handleEntityNotFound(_0x5b3e10,null))[_0xc654('0x29')](respondWithResult(_0x5b3e10,null))[_0xc654('0x48')](handleError(_0x5b3e10,null));};exports[_0xc654('0x4e')]=function(_0x572d59,_0x4be449){return db[_0xc654('0x31')][_0xc654('0x4e')](_0x572d59[_0xc654('0x4f')],{})[_0xc654('0x29')](respondWithResult(_0x4be449,0xc9))[_0xc654('0x48')](handleError(_0x4be449,null));};exports['update']=function(_0x4af9ab,_0x5972c6){if(_0x4af9ab[_0xc654('0x4f')]['id']){delete _0x4af9ab[_0xc654('0x4f')]['id'];}return db[_0xc654('0x31')]['find']({'where':{'id':_0x4af9ab['params']['id']}})['then'](handleEntityNotFound(_0x5972c6,null))[_0xc654('0x29')](saveUpdates(_0x4af9ab[_0xc654('0x4f')],null))[_0xc654('0x29')](respondWithResult(_0x5972c6,null))[_0xc654('0x48')](handleError(_0x5972c6,null));};exports[_0xc654('0x2a')]=function(_0x5abd01,_0x5142d5){return db[_0xc654('0x31')][_0xc654('0x4d')]({'where':{'id':_0x5abd01['params']['id']}})[_0xc654('0x29')](handleEntityNotFound(_0x5142d5,null))[_0xc654('0x29')](removeEntity(_0x5142d5,null))[_0xc654('0x48')](handleError(_0x5142d5,null));};exports[_0xc654('0x50')]=function(_0x4f02bf,_0x248610){return db[_0xc654('0x31')][_0xc654('0x50')]()[_0xc654('0x29')](respondWithResult(_0x248610,null))[_0xc654('0x48')](handleError(_0x248610,null));};exports['getUnread']=function(_0x12d7e7,_0x4e3499,_0x347013){return db['ChatInternalMessage'][_0xc654('0x23')]({'where':{'ChatGroupId':_0x12d7e7[_0xc654('0x4a')]['id'],'ToId':_0x12d7e7['user']['id'],'read':![]}})[_0xc654('0x29')](function(_0x306ce4){return{'id':_['toInteger'](_0x12d7e7[_0xc654('0x4a')]['id']),'count':_0x306ce4};})[_0xc654('0x29')](respondWithResult(_0x4e3499,null))[_0xc654('0x48')](handleError(_0x4e3499,null));};exports[_0xc654('0x51')]=function(_0x4ce9a5,_0xe0aa77,_0x36e954){return db['ChatGroup'][_0xc654('0x4d')]({'where':{'id':_0x4ce9a5[_0xc654('0x4a')]['id']}})[_0xc654('0x29')](handleEntityNotFound(_0xe0aa77,null))[_0xc654('0x29')](function(_0x326842){if(_0x326842){return _0x326842[_0xc654('0x51')](_0x4ce9a5['body'][_0xc654('0x52')],_['omit'](_0x4ce9a5['body'],['ids','id'])||{});}})[_0xc654('0x29')](respondWithResult(_0xe0aa77,null))[_0xc654('0x48')](handleError(_0xe0aa77,null));};exports['getMembers']=function(_0xc01edf,_0x4b8c97,_0x41186b){var _0x235d50={};var _0x3ae335={};var _0x140882;var _0x545ac9;return db['ChatGroup'][_0xc654('0x53')]({'where':{'id':_0xc01edf[_0xc654('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b8c97,null))['then'](function(_0x35fd6c){if(_0x35fd6c){_0x140882=_0x35fd6c;_0x3ae335['model']=_[_0xc654('0x37')](db[_0xc654('0x54')][_0xc654('0x32')]);_0x3ae335[_0xc654('0x36')]=_[_0xc654('0x37')](_0xc01edf[_0xc654('0x36')]);_0x3ae335[_0xc654('0x42')]=_['intersection'](_0x3ae335[_0xc654('0x39')],_0x3ae335[_0xc654('0x36')]);_0x235d50['attributes']=_[_0xc654('0x38')](_0x3ae335[_0xc654('0x39')],qs[_0xc654('0x3a')](_0xc01edf[_0xc654('0x36')][_0xc654('0x3a')]));_0x235d50[_0xc654('0x3b')]=_0x235d50['attributes']['length']?_0x235d50[_0xc654('0x3b')]:_0x3ae335[_0xc654('0x39')];_0x235d50[_0xc654('0x3f')]=qs[_0xc654('0x40')](_0xc01edf[_0xc654('0x36')][_0xc654('0x40')]);_0x235d50[_0xc654('0x41')]=qs[_0xc654('0x42')](_[_0xc654('0x55')](_0xc01edf[_0xc654('0x36')],_0x3ae335['filters']));if(_0xc01edf[_0xc654('0x36')][_0xc654('0x44')]){_0x235d50[_0xc654('0x41')]=_[_0xc654('0x43')](_0x235d50[_0xc654('0x41')],{'$or':_[_0xc654('0x30')](_0x235d50[_0xc654('0x3b')],function(_0x3e771a){var _0x2740f2={};_0x2740f2[_0x3e771a]={'$like':'%'+_0xc01edf['query'][_0xc654('0x44')]+'%'};return _0x2740f2;})});}_0x235d50=_[_0xc654('0x43')]({},_0x235d50,_0xc01edf[_0xc654('0x45')]);return _0x140882[_0xc654('0x56')](_0x235d50);}})['then'](function(_0x18b552){if(_0x18b552){_0x545ac9=_0x18b552['length'];if(!_0xc01edf['query'][_0xc654('0x3d')](_0xc654('0x3e'))){_0x235d50[_0xc654('0x22')]=qs['limit'](_0xc01edf['query'][_0xc654('0x22')]);_0x235d50[_0xc654('0x20')]=qs[_0xc654('0x20')](_0xc01edf[_0xc654('0x36')]['offset']);}return _0x140882[_0xc654('0x56')](_0x235d50);}})[_0xc654('0x29')](function(_0x798a6b){if(_0x798a6b){return _0x798a6b?{'count':_0x545ac9,'rows':_0x798a6b}:null;}})[_0xc654('0x29')](respondWithResult(_0x4b8c97,null))[_0xc654('0x48')](handleError(_0x4b8c97,null));};exports['removeMembers']=function(_0x141e53,_0x5ce5fc,_0x1cadd2){return db[_0xc654('0x31')][_0xc654('0x4d')]({'where':{'id':_0x141e53['params']['id']}})[_0xc654('0x29')](handleEntityNotFound(_0x5ce5fc,null))['then'](function(_0x452cef){if(_0x452cef){return _0x452cef[_0xc654('0x57')](_0x141e53['query'][_0xc654('0x52')]);}})[_0xc654('0x29')](respondWithStatusCode(_0x5ce5fc,null))['catch'](handleError(_0x5ce5fc,null));};exports[_0xc654('0x58')]=function(_0x4b1ded,_0x1887f0,_0x1edff4){if(_0x4b1ded[_0xc654('0x4f')]['id']){delete _0x4b1ded[_0xc654('0x4f')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x4b1ded[_0xc654('0x4a')]['id']}})[_0xc654('0x29')](handleEntityNotFound(_0x1887f0,null))['then'](function(_0x177561){if(_0x177561){_0x4b1ded[_0xc654('0x4f')]['ChatGroupId']=_0x177561['id'];return db[_0xc654('0x59')]['create'](_0x4b1ded['body']);}})[_0xc654('0x29')](respondWithResult(_0x1887f0,null))['catch'](handleError(_0x1887f0,null));};exports[_0xc654('0x5a')]=function(_0x55453b,_0x5522c3,_0x25a28f){var _0x3b0c54={};var _0x58cb9a={};var _0x5680c8;var _0x1e3723;return db['ChatGroup'][_0xc654('0x53')]({'where':{'id':_0x55453b['params']['id']}})[_0xc654('0x29')](handleEntityNotFound(_0x5522c3,null))[_0xc654('0x29')](function(_0x263df3){if(_0x263df3){_0x5680c8=_0x263df3;_0x58cb9a['model']=_[_0xc654('0x37')](db['ChatInternalMessage']['rawAttributes']);_0x58cb9a[_0xc654('0x36')]=_[_0xc654('0x37')](_0x55453b[_0xc654('0x36')]);_0x58cb9a[_0xc654('0x42')]=_[_0xc654('0x38')](_0x58cb9a[_0xc654('0x39')],_0x58cb9a['query']);_0x3b0c54['attributes']=_['intersection'](_0x58cb9a[_0xc654('0x39')],qs[_0xc654('0x3a')](_0x55453b[_0xc654('0x36')]['fields']));_0x3b0c54[_0xc654('0x3b')]=_0x3b0c54[_0xc654('0x3b')][_0xc654('0x3c')]?_0x3b0c54[_0xc654('0x3b')]:_0x58cb9a[_0xc654('0x39')];_0x3b0c54[_0xc654('0x3f')]=qs[_0xc654('0x40')](_0x55453b['query'][_0xc654('0x40')]);_0x3b0c54[_0xc654('0x41')]=qs[_0xc654('0x42')](_['pick'](_0x55453b[_0xc654('0x36')],_0x58cb9a[_0xc654('0x42')]));if(_0x55453b['query'][_0xc654('0x44')]){_0x3b0c54[_0xc654('0x41')]=_[_0xc654('0x43')](_0x3b0c54[_0xc654('0x41')],{'$or':_[_0xc654('0x30')](_0x3b0c54[_0xc654('0x3b')],function(_0x2a6308){var _0x211ab7={};_0x211ab7[_0x2a6308]={'$like':'%'+_0x55453b[_0xc654('0x36')][_0xc654('0x44')]+'%'};return _0x211ab7;})});}if(_0x55453b[_0xc654('0x36')][_0xc654('0x5b')]){var _0x229f41=_0x55453b[_0xc654('0x36')][_0xc654('0x5b')][_0xc654('0x5c')](',');var _0x5a2884={};_0x5a2884[_0x229f41[0x0]]={'$gte':moment(_0x229f41[0x1])['format'](_0xc654('0x5d'))};_0x3b0c54[_0xc654('0x41')]=_[_0xc654('0x43')](_0x3b0c54[_0xc654('0x41')],_0x5a2884);}_0x3b0c54=_[_0xc654('0x43')]({},_0x3b0c54,_0x55453b['options']);return _0x5680c8[_0xc654('0x5a')](_0x3b0c54);}})[_0xc654('0x29')](function(_0x4e0dfd){if(_0x4e0dfd){_0x1e3723=_0x4e0dfd[_0xc654('0x3c')];if(!_0x55453b['query'][_0xc654('0x3d')](_0xc654('0x3e'))){_0x3b0c54[_0xc654('0x22')]=qs[_0xc654('0x22')](_0x55453b['query']['limit']);_0x3b0c54['offset']=qs[_0xc654('0x20')](_0x55453b[_0xc654('0x36')][_0xc654('0x20')]);}return _0x5680c8[_0xc654('0x5a')](_0x3b0c54);}})[_0xc654('0x29')](function(_0x42aa39){if(_0x42aa39){return _0x42aa39?{'count':_0x1e3723,'rows':_0x42aa39}:null;}})[_0xc654('0x29')](respondWithResult(_0x5522c3,null))['catch'](handleError(_0x5522c3,null));}; \ No newline at end of file +var _0xa826=['User','getMembers','nolimit','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','ChatGroup','includeAll','findAll','rows','catch','include','find','create','body','params','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','findOne'];(function(_0x5b88c4,_0x4dd8a2){var _0x1a5de0=function(_0x40b3cf){while(--_0x40b3cf){_0x5b88c4['push'](_0x5b88c4['shift']());}};_0x1a5de0(++_0x4dd8a2);}(_0xa826,0x6a));var _0x6a82=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa826[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x6a82('0x0'));var rimraf=require(_0x6a82('0x1'));var zipdir=require(_0x6a82('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a82('0x3'));var moment=require(_0x6a82('0x4'));var BPromise=require(_0x6a82('0x5'));var Mustache=require(_0x6a82('0x6'));var util=require(_0x6a82('0x7'));var path=require('path');var sox=require(_0x6a82('0x8'));var csv=require('to-csv');var ejs=require(_0x6a82('0x9'));var fs=require('fs');var fs_extra=require(_0x6a82('0xa'));var _=require(_0x6a82('0xb'));var squel=require(_0x6a82('0xc'));var crypto=require(_0x6a82('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6a82('0xe'));var authService=require(_0x6a82('0xf'));var qs=require(_0x6a82('0x10'));var as=require(_0x6a82('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a82('0x12'))(_0x6a82('0x13'));var utils=require(_0x6a82('0x14'));var config=require(_0x6a82('0x15'));var licenseUtil=require(_0x6a82('0x16'));var db=require(_0x6a82('0x17'))['db'];config[_0x6a82('0x18')]=_[_0x6a82('0x19')](config[_0x6a82('0x18')],{'host':_0x6a82('0x1a'),'port':0x18eb});var socket=require(_0x6a82('0x1b'))(new Redis(config[_0x6a82('0x18')]));require(_0x6a82('0x1c'))[_0x6a82('0x1d')](socket);function respondWithStatusCode(_0x37b0ad,_0x3007bf){_0x3007bf=_0x3007bf||0xcc;return function(_0x731fcc){if(_0x731fcc){return _0x37b0ad[_0x6a82('0x1e')](_0x3007bf);}return _0x37b0ad[_0x6a82('0x1f')](_0x3007bf)[_0x6a82('0x20')]();};}function respondWithResult(_0x18c2a6,_0x5d09a5){_0x5d09a5=_0x5d09a5||0xc8;return function(_0x102fb7){if(_0x102fb7){return _0x18c2a6[_0x6a82('0x1f')](_0x5d09a5)['json'](_0x102fb7);}};}function respondWithFilteredResult(_0x224aa3,_0x35fb25){return function(_0x6fc7fc){if(_0x6fc7fc){var _0x2c6a20=typeof _0x35fb25[_0x6a82('0x21')]===_0x6a82('0x22')&&typeof _0x35fb25['limit']==='undefined';var _0x341490=_0x6fc7fc[_0x6a82('0x23')];var _0x2c303f=_0x2c6a20?0x0:_0x35fb25['offset'];var _0x587649=_0x2c6a20?_0x6fc7fc[_0x6a82('0x23')]:_0x35fb25[_0x6a82('0x21')]+_0x35fb25[_0x6a82('0x24')];var _0x4e2ddd;if(_0x587649>=_0x341490){_0x587649=_0x341490;_0x4e2ddd=0xc8;}else{_0x4e2ddd=0xce;}_0x224aa3['status'](_0x4e2ddd);return _0x224aa3['set'](_0x6a82('0x25'),_0x2c303f+'-'+_0x587649+'/'+_0x341490)[_0x6a82('0x26')](_0x6fc7fc);}return null;};}function patchUpdates(_0x17e96e){return function(_0x331d9e){try{jsonpatch['apply'](_0x331d9e,_0x17e96e,!![]);}catch(_0x22fe7f){return BPromise['reject'](_0x22fe7f);}return _0x331d9e[_0x6a82('0x27')]();};}function saveUpdates(_0x900645,_0x3964e4){return function(_0x356e61){if(_0x356e61){return _0x356e61[_0x6a82('0x28')](_0x900645)[_0x6a82('0x29')](function(_0x4710ce){return _0x4710ce;});}return null;};}function removeEntity(_0x4a874f,_0x15f0a5){return function(_0x3a7424){if(_0x3a7424){return _0x3a7424['destroy']()[_0x6a82('0x29')](function(){_0x4a874f[_0x6a82('0x1f')](0xcc)[_0x6a82('0x20')]();});}};}function handleEntityNotFound(_0x37a211,_0x1b1d3f){return function(_0x955a04){if(!_0x955a04){_0x37a211[_0x6a82('0x1e')](0x194);}return _0x955a04;};}function handleError(_0x435776,_0x177f18){_0x177f18=_0x177f18||0x1f4;return function(_0x255b18){logger['error'](_0x255b18[_0x6a82('0x2a')]);if(_0x255b18[_0x6a82('0x2b')]){delete _0x255b18[_0x6a82('0x2b')];}_0x435776[_0x6a82('0x1f')](_0x177f18)[_0x6a82('0x2c')](_0x255b18);};}exports[_0x6a82('0x2d')]=function(_0x25111b,_0x329f8c){var _0x3c3270={},_0x3c9ce6={},_0x25c30c={'count':0x0,'rows':[]};var _0xf35037=_[_0x6a82('0x2e')](db['ChatGroup'][_0x6a82('0x2f')],function(_0x2f06ef){return{'name':_0x2f06ef[_0x6a82('0x30')],'type':_0x2f06ef[_0x6a82('0x31')][_0x6a82('0x32')]};});_0x3c9ce6[_0x6a82('0x33')]=_[_0x6a82('0x2e')](_0xf35037,'name');_0x3c9ce6['query']=_[_0x6a82('0x34')](_0x25111b[_0x6a82('0x35')]);_0x3c9ce6[_0x6a82('0x36')]=_[_0x6a82('0x37')](_0x3c9ce6[_0x6a82('0x33')],_0x3c9ce6[_0x6a82('0x35')]);_0x3c3270[_0x6a82('0x38')]=_['intersection'](_0x3c9ce6[_0x6a82('0x33')],qs[_0x6a82('0x39')](_0x25111b[_0x6a82('0x35')][_0x6a82('0x39')]));_0x3c3270[_0x6a82('0x38')]=_0x3c3270[_0x6a82('0x38')][_0x6a82('0x3a')]?_0x3c3270[_0x6a82('0x38')]:_0x3c9ce6[_0x6a82('0x33')];if(!_0x25111b[_0x6a82('0x35')][_0x6a82('0x3b')]('nolimit')){_0x3c3270[_0x6a82('0x24')]=qs['limit'](_0x25111b['query'][_0x6a82('0x24')]);_0x3c3270['offset']=qs[_0x6a82('0x21')](_0x25111b[_0x6a82('0x35')][_0x6a82('0x21')]);}_0x3c3270[_0x6a82('0x3c')]=qs[_0x6a82('0x3d')](_0x25111b[_0x6a82('0x35')][_0x6a82('0x3d')]);_0x3c3270['where']=qs[_0x6a82('0x36')](_[_0x6a82('0x3e')](_0x25111b[_0x6a82('0x35')],_0x3c9ce6[_0x6a82('0x36')]),_0xf35037);if(_0x25111b[_0x6a82('0x35')][_0x6a82('0x3f')]){_0x3c3270[_0x6a82('0x40')]=_[_0x6a82('0x41')](_0x3c3270[_0x6a82('0x40')],{'$or':_[_0x6a82('0x2e')](_0xf35037,function(_0x380b3d){if(_0x380b3d['type']!=='VIRTUAL'){var _0x50fc18={};_0x50fc18[_0x380b3d['name']]={'$like':'%'+_0x25111b[_0x6a82('0x35')][_0x6a82('0x3f')]+'%'};return _0x50fc18;}})});}_0x3c3270=_[_0x6a82('0x41')]({},_0x3c3270,_0x25111b[_0x6a82('0x42')]);var _0x39bae7={'where':_0x3c3270['where']};return db[_0x6a82('0x43')][_0x6a82('0x23')](_0x39bae7)[_0x6a82('0x29')](function(_0x54701b){_0x25c30c[_0x6a82('0x23')]=_0x54701b;if(_0x25111b[_0x6a82('0x35')][_0x6a82('0x44')]){_0x3c3270['include']=[{'all':!![]}];}return db[_0x6a82('0x43')][_0x6a82('0x45')](_0x3c3270);})['then'](function(_0x2d5064){_0x25c30c[_0x6a82('0x46')]=_0x2d5064;return _0x25c30c;})[_0x6a82('0x29')](respondWithFilteredResult(_0x329f8c,_0x3c3270))[_0x6a82('0x47')](handleError(_0x329f8c,null));};exports['show']=function(_0x143559,_0x5526a5){var _0x17df8e={'raw':!![],'where':{'id':_0x143559['params']['id']}},_0x147c14={};_0x147c14[_0x6a82('0x33')]=_[_0x6a82('0x34')](db[_0x6a82('0x43')]['rawAttributes']);_0x147c14[_0x6a82('0x35')]=_['keys'](_0x143559[_0x6a82('0x35')]);_0x147c14[_0x6a82('0x36')]=_['intersection'](_0x147c14[_0x6a82('0x33')],_0x147c14[_0x6a82('0x35')]);_0x17df8e[_0x6a82('0x38')]=_[_0x6a82('0x37')](_0x147c14[_0x6a82('0x33')],qs[_0x6a82('0x39')](_0x143559[_0x6a82('0x35')][_0x6a82('0x39')]));_0x17df8e[_0x6a82('0x38')]=_0x17df8e[_0x6a82('0x38')]['length']?_0x17df8e[_0x6a82('0x38')]:_0x147c14[_0x6a82('0x33')];if(_0x143559[_0x6a82('0x35')][_0x6a82('0x44')]){_0x17df8e[_0x6a82('0x48')]=[{'all':!![]}];}_0x17df8e=_['merge']({},_0x17df8e,_0x143559[_0x6a82('0x42')]);return db[_0x6a82('0x43')][_0x6a82('0x49')](_0x17df8e)[_0x6a82('0x29')](handleEntityNotFound(_0x5526a5,null))[_0x6a82('0x29')](respondWithResult(_0x5526a5,null))[_0x6a82('0x47')](handleError(_0x5526a5,null));};exports[_0x6a82('0x4a')]=function(_0x5e561b,_0x10b53f){return db[_0x6a82('0x43')][_0x6a82('0x4a')](_0x5e561b[_0x6a82('0x4b')],{})[_0x6a82('0x29')](respondWithResult(_0x10b53f,0xc9))['catch'](handleError(_0x10b53f,null));};exports[_0x6a82('0x28')]=function(_0x23000e,_0x41f47c){if(_0x23000e[_0x6a82('0x4b')]['id']){delete _0x23000e[_0x6a82('0x4b')]['id'];}return db[_0x6a82('0x43')][_0x6a82('0x49')]({'where':{'id':_0x23000e[_0x6a82('0x4c')]['id']}})[_0x6a82('0x29')](handleEntityNotFound(_0x41f47c,null))[_0x6a82('0x29')](saveUpdates(_0x23000e['body'],null))[_0x6a82('0x29')](respondWithResult(_0x41f47c,null))[_0x6a82('0x47')](handleError(_0x41f47c,null));};exports[_0x6a82('0x4d')]=function(_0x25bd0b,_0x45378a){return db[_0x6a82('0x43')][_0x6a82('0x49')]({'where':{'id':_0x25bd0b[_0x6a82('0x4c')]['id']}})[_0x6a82('0x29')](handleEntityNotFound(_0x45378a,null))[_0x6a82('0x29')](removeEntity(_0x45378a,null))['catch'](handleError(_0x45378a,null));};exports['describe']=function(_0x127daf,_0x439771){return db[_0x6a82('0x43')][_0x6a82('0x4e')]()['then'](respondWithResult(_0x439771,null))[_0x6a82('0x47')](handleError(_0x439771,null));};exports[_0x6a82('0x4f')]=function(_0x1abf9f,_0x48c1ba,_0xb76a13){return db[_0x6a82('0x50')][_0x6a82('0x23')]({'where':{'ChatGroupId':_0x1abf9f[_0x6a82('0x4c')]['id'],'ToId':_0x1abf9f[_0x6a82('0x51')]['id'],'read':![]}})[_0x6a82('0x29')](function(_0x454021){return{'id':_[_0x6a82('0x52')](_0x1abf9f[_0x6a82('0x4c')]['id']),'count':_0x454021};})['then'](respondWithResult(_0x48c1ba,null))['catch'](handleError(_0x48c1ba,null));};exports[_0x6a82('0x53')]=function(_0x4b7f9d,_0x37648d,_0x46831b){return db[_0x6a82('0x43')][_0x6a82('0x49')]({'where':{'id':_0x4b7f9d[_0x6a82('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37648d,null))[_0x6a82('0x29')](function(_0xdc75a5){if(_0xdc75a5){return _0xdc75a5['addMembers'](_0x4b7f9d['body'][_0x6a82('0x54')],_['omit'](_0x4b7f9d[_0x6a82('0x4b')],[_0x6a82('0x54'),'id'])||{});}})[_0x6a82('0x29')](respondWithResult(_0x37648d,null))[_0x6a82('0x47')](handleError(_0x37648d,null));};exports['getMembers']=function(_0x58ea78,_0x236c2d,_0x5dbb7d){var _0x247b93={};var _0x551ef4={};var _0xd597cd;var _0x14f0f5;return db[_0x6a82('0x43')][_0x6a82('0x55')]({'where':{'id':_0x58ea78[_0x6a82('0x4c')]['id']}})[_0x6a82('0x29')](handleEntityNotFound(_0x236c2d,null))[_0x6a82('0x29')](function(_0x1e4644){if(_0x1e4644){_0xd597cd=_0x1e4644;_0x551ef4[_0x6a82('0x33')]=_[_0x6a82('0x34')](db[_0x6a82('0x56')][_0x6a82('0x2f')]);_0x551ef4['query']=_[_0x6a82('0x34')](_0x58ea78['query']);_0x551ef4[_0x6a82('0x36')]=_[_0x6a82('0x37')](_0x551ef4[_0x6a82('0x33')],_0x551ef4[_0x6a82('0x35')]);_0x247b93[_0x6a82('0x38')]=_[_0x6a82('0x37')](_0x551ef4[_0x6a82('0x33')],qs[_0x6a82('0x39')](_0x58ea78['query'][_0x6a82('0x39')]));_0x247b93[_0x6a82('0x38')]=_0x247b93[_0x6a82('0x38')][_0x6a82('0x3a')]?_0x247b93[_0x6a82('0x38')]:_0x551ef4[_0x6a82('0x33')];_0x247b93[_0x6a82('0x3c')]=qs['sort'](_0x58ea78[_0x6a82('0x35')][_0x6a82('0x3d')]);_0x247b93[_0x6a82('0x40')]=qs[_0x6a82('0x36')](_[_0x6a82('0x3e')](_0x58ea78[_0x6a82('0x35')],_0x551ef4['filters']));if(_0x58ea78[_0x6a82('0x35')][_0x6a82('0x3f')]){_0x247b93[_0x6a82('0x40')]=_[_0x6a82('0x41')](_0x247b93[_0x6a82('0x40')],{'$or':_[_0x6a82('0x2e')](_0x247b93['attributes'],function(_0x1a8d0b){var _0x3b5968={};_0x3b5968[_0x1a8d0b]={'$like':'%'+_0x58ea78[_0x6a82('0x35')][_0x6a82('0x3f')]+'%'};return _0x3b5968;})});}_0x247b93=_[_0x6a82('0x41')]({},_0x247b93,_0x58ea78[_0x6a82('0x42')]);return _0xd597cd[_0x6a82('0x57')](_0x247b93);}})[_0x6a82('0x29')](function(_0x16cee0){if(_0x16cee0){_0x14f0f5=_0x16cee0[_0x6a82('0x3a')];if(!_0x58ea78[_0x6a82('0x35')]['hasOwnProperty'](_0x6a82('0x58'))){_0x247b93['limit']=qs[_0x6a82('0x24')](_0x58ea78[_0x6a82('0x35')][_0x6a82('0x24')]);_0x247b93[_0x6a82('0x21')]=qs[_0x6a82('0x21')](_0x58ea78[_0x6a82('0x35')][_0x6a82('0x21')]);}return _0xd597cd['getMembers'](_0x247b93);}})['then'](function(_0x285090){if(_0x285090){return _0x285090?{'count':_0x14f0f5,'rows':_0x285090}:null;}})[_0x6a82('0x29')](respondWithResult(_0x236c2d,null))[_0x6a82('0x47')](handleError(_0x236c2d,null));};exports['removeMembers']=function(_0x27cca5,_0x155f96,_0x4ddd45){return db[_0x6a82('0x43')][_0x6a82('0x49')]({'where':{'id':_0x27cca5[_0x6a82('0x4c')]['id']}})[_0x6a82('0x29')](handleEntityNotFound(_0x155f96,null))[_0x6a82('0x29')](function(_0x4ad215){if(_0x4ad215){return _0x4ad215[_0x6a82('0x59')](_0x27cca5[_0x6a82('0x35')][_0x6a82('0x54')]);}})['then'](respondWithStatusCode(_0x155f96,null))['catch'](handleError(_0x155f96,null));};exports['addMessage']=function(_0x1cb14a,_0xdece64,_0x138dc4){if(_0x1cb14a[_0x6a82('0x4b')]['id']){delete _0x1cb14a[_0x6a82('0x4b')]['id'];}return db['ChatGroup'][_0x6a82('0x49')]({'where':{'id':_0x1cb14a[_0x6a82('0x4c')]['id']}})['then'](handleEntityNotFound(_0xdece64,null))[_0x6a82('0x29')](function(_0x3c1547){if(_0x3c1547){_0x1cb14a[_0x6a82('0x4b')][_0x6a82('0x5a')]=_0x3c1547['id'];return db['ChatInternalMessage'][_0x6a82('0x4a')](_0x1cb14a[_0x6a82('0x4b')]);}})[_0x6a82('0x29')](respondWithResult(_0xdece64,null))[_0x6a82('0x47')](handleError(_0xdece64,null));};exports[_0x6a82('0x5b')]=function(_0x54dfbb,_0x43ea46,_0x3a5ab6){var _0x9233b8={};var _0x18aff1={};var _0x29de5a;var _0x78b79a;return db[_0x6a82('0x43')]['findOne']({'where':{'id':_0x54dfbb['params']['id']}})['then'](handleEntityNotFound(_0x43ea46,null))[_0x6a82('0x29')](function(_0x596b37){if(_0x596b37){_0x29de5a=_0x596b37;_0x18aff1['model']=_[_0x6a82('0x34')](db[_0x6a82('0x50')][_0x6a82('0x2f')]);_0x18aff1[_0x6a82('0x35')]=_['keys'](_0x54dfbb['query']);_0x18aff1[_0x6a82('0x36')]=_['intersection'](_0x18aff1[_0x6a82('0x33')],_0x18aff1[_0x6a82('0x35')]);_0x9233b8[_0x6a82('0x38')]=_[_0x6a82('0x37')](_0x18aff1[_0x6a82('0x33')],qs[_0x6a82('0x39')](_0x54dfbb[_0x6a82('0x35')][_0x6a82('0x39')]));_0x9233b8['attributes']=_0x9233b8[_0x6a82('0x38')][_0x6a82('0x3a')]?_0x9233b8['attributes']:_0x18aff1[_0x6a82('0x33')];_0x9233b8[_0x6a82('0x3c')]=qs['sort'](_0x54dfbb[_0x6a82('0x35')]['sort']);_0x9233b8[_0x6a82('0x40')]=qs[_0x6a82('0x36')](_[_0x6a82('0x3e')](_0x54dfbb[_0x6a82('0x35')],_0x18aff1['filters']));if(_0x54dfbb['query'][_0x6a82('0x3f')]){_0x9233b8[_0x6a82('0x40')]=_[_0x6a82('0x41')](_0x9233b8[_0x6a82('0x40')],{'$or':_[_0x6a82('0x2e')](_0x9233b8[_0x6a82('0x38')],function(_0x16dad2){var _0x4613f4={};_0x4613f4[_0x16dad2]={'$like':'%'+_0x54dfbb[_0x6a82('0x35')]['filter']+'%'};return _0x4613f4;})});}if(_0x54dfbb[_0x6a82('0x35')]['$gte']){var _0xf77ced=_0x54dfbb[_0x6a82('0x35')][_0x6a82('0x5c')][_0x6a82('0x5d')](',');var _0x391a40={};_0x391a40[_0xf77ced[0x0]]={'$gte':moment(_0xf77ced[0x1])[_0x6a82('0x5e')](_0x6a82('0x5f'))};_0x9233b8[_0x6a82('0x40')]=_[_0x6a82('0x41')](_0x9233b8[_0x6a82('0x40')],_0x391a40);}_0x9233b8=_[_0x6a82('0x41')]({},_0x9233b8,_0x54dfbb[_0x6a82('0x42')]);return _0x29de5a[_0x6a82('0x5b')](_0x9233b8);}})['then'](function(_0x2e296f){if(_0x2e296f){_0x78b79a=_0x2e296f['length'];if(!_0x54dfbb[_0x6a82('0x35')][_0x6a82('0x3b')](_0x6a82('0x58'))){_0x9233b8['limit']=qs[_0x6a82('0x24')](_0x54dfbb[_0x6a82('0x35')][_0x6a82('0x24')]);_0x9233b8[_0x6a82('0x21')]=qs[_0x6a82('0x21')](_0x54dfbb['query'][_0x6a82('0x21')]);}return _0x29de5a[_0x6a82('0x5b')](_0x9233b8);}})['then'](function(_0x5c29f2){if(_0x5c29f2){return _0x5c29f2?{'count':_0x78b79a,'rows':_0x5c29f2}:null;}})[_0x6a82('0x29')](respondWithResult(_0x43ea46,null))['catch'](handleError(_0x43ea46,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 12f36ab..b12564d 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 _0x3d65=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3d65,0x8c));var _0x53d6=function(_0x208749,_0x2b7b66){_0x208749=_0x208749-0x0;var _0x3e0042=_0x3d65[_0x208749];return _0x3e0042;};'use strict';var EventEmitter=require(_0x53d6('0x0'));var ChatGroup=require(_0x53d6('0x1'))['db'][_0x53d6('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x53d6('0x3')](0x0);var events={'afterCreate':_0x53d6('0x4'),'afterUpdate':_0x53d6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x237396){return function(_0x732f30,_0x2d04d7,_0x2946ea){ChatGroupEvents[_0x53d6('0x6')](_0x237396+':'+_0x732f30['id'],_0x732f30);ChatGroupEvents['emit'](_0x237396,_0x732f30);_0x2946ea(null);};}for(var e in events){if(events[_0x53d6('0x7')](e)){var event=events[e];ChatGroup[_0x53d6('0x8')](e,emitEvent(event));}}module[_0x53d6('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0xcd7f=['ChatGroup','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x10b4f4,_0x4f1ca0){var _0x187294=function(_0x342ed2){while(--_0x342ed2){_0x10b4f4['push'](_0x10b4f4['shift']());}};_0x187294(++_0x4f1ca0);}(_0xcd7f,0x16e));var _0xfcd7=function(_0x9d380f,_0x47dd5d){_0x9d380f=_0x9d380f-0x0;var _0x216a52=_0xcd7f[_0x9d380f];return _0x216a52;};'use strict';var EventEmitter=require(_0xfcd7('0x0'));var ChatGroup=require(_0xfcd7('0x1'))['db'][_0xfcd7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfcd7('0x3')};function emitEvent(_0x355263){return function(_0x2555a3,_0x45208c,_0x22d95c){ChatGroupEvents['emit'](_0x355263+':'+_0x2555a3['id'],_0x2555a3);ChatGroupEvents[_0xfcd7('0x4')](_0x355263,_0x2555a3);_0x22d95c(null);};}for(var e in events){if(events[_0xfcd7('0x5')](e)){var event=events[e];ChatGroup[_0xfcd7('0x6')](e,emitEvent(event));}}module[_0xfcd7('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 2fdf7de..9f07794 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 _0x974b=['define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes'];(function(_0x54f415,_0x52be28){var _0xaca73b=function(_0x5937ce){while(--_0x5937ce){_0x54f415['push'](_0x54f415['shift']());}};_0xaca73b(++_0x52be28);}(_0x974b,0xb7));var _0xb974=function(_0x1943d9,_0x245bb8){_0x1943d9=_0x1943d9-0x0;var _0x4b4f3f=_0x974b[_0x1943d9];return _0x4b4f3f;};'use strict';var _=require('lodash');var util=require(_0xb974('0x0'));var logger=require(_0xb974('0x1'))(_0xb974('0x2'));var moment=require(_0xb974('0x3'));var BPromise=require(_0xb974('0x4'));var rp=require(_0xb974('0x5'));var fs=require('fs');var path=require(_0xb974('0x6'));var rimraf=require('rimraf');var config=require(_0xb974('0x7'));var attributes=require(_0xb974('0x8'));module['exports']=function(_0x3530cb,_0x1987a9){return _0x3530cb[_0xb974('0x9')](_0xb974('0xa'),attributes,{'tableName':_0xb974('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ddf=['ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports'];(function(_0x50516e,_0x464fe1){var _0x2e34b5=function(_0x9c889c){while(--_0x9c889c){_0x50516e['push'](_0x50516e['shift']());}};_0x2e34b5(++_0x464fe1);}(_0x9ddf,0x142));var _0xf9dd=function(_0x4e248c,_0x3dba6e){_0x4e248c=_0x4e248c-0x0;var _0x311f49=_0x9ddf[_0x4e248c];return _0x311f49;};'use strict';var _=require(_0xf9dd('0x0'));var util=require(_0xf9dd('0x1'));var logger=require(_0xf9dd('0x2'))(_0xf9dd('0x3'));var moment=require(_0xf9dd('0x4'));var BPromise=require('bluebird');var rp=require(_0xf9dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf9dd('0x6'));var attributes=require('./chatGroup.attributes');module[_0xf9dd('0x7')]=function(_0x2f17ff,_0x5b0d34){return _0x2f17ff['define'](_0xf9dd('0x8'),attributes,{'tableName':_0xf9dd('0x9'),'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 4768600..ef5cf64 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 _0x06f4=['request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatGroup.socket','request','info'];(function(_0x2acfed,_0x1526b3){var _0x5b7b43=function(_0x20f95d){while(--_0x20f95d){_0x2acfed['push'](_0x2acfed['shift']());}};_0x5b7b43(++_0x1526b3);}(_0x06f4,0x136));var _0x406f=function(_0x10946b,_0x415d73){_0x10946b=_0x10946b-0x0;var _0x4351ef=_0x06f4[_0x10946b];return _0x4351ef;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var moment=require('moment');var BPromise=require(_0x406f('0x2'));var rs=require(_0x406f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x406f('0x4'));var logger=require('../../config/logger')(_0x406f('0x5'));var config=require(_0x406f('0x6'));var jayson=require(_0x406f('0x7'));var client=jayson[_0x406f('0x8')]['http']({'port':0x232a});config[_0x406f('0x9')]=_['defaults'](config[_0x406f('0x9')],{'host':_0x406f('0xa'),'port':0x18eb});var socket=require(_0x406f('0xb'))(new Redis(config['redis']));require(_0x406f('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b46bf,_0xd817eb,_0x56edc2){return new BPromise(function(_0x28c5a5,_0x4e0e96){return client[_0x406f('0xd')](_0x5b46bf,_0x56edc2)['then'](function(_0xb2c62d){logger[_0x406f('0xe')]('ChatGroup,\x20%s,\x20%s',_0xd817eb,_0x406f('0xf'));logger[_0x406f('0x10')](_0x406f('0x11'),_0xd817eb,_0x406f('0xf'),JSON[_0x406f('0x12')](_0xb2c62d));if(_0xb2c62d[_0x406f('0x13')]){if(_0xb2c62d[_0x406f('0x13')][_0x406f('0x14')]===0x1f4){logger[_0x406f('0x13')](_0x406f('0x15'),_0xd817eb,_0xb2c62d[_0x406f('0x13')]['message']);return _0x4e0e96(_0xb2c62d[_0x406f('0x13')][_0x406f('0x16')]);}logger[_0x406f('0x13')]('ChatGroup,\x20%s,\x20%s',_0xd817eb,_0xb2c62d[_0x406f('0x13')][_0x406f('0x16')]);return _0x28c5a5(_0xb2c62d['error']['message']);}else{logger[_0x406f('0xe')](_0x406f('0x15'),_0xd817eb,'request\x20sent');_0x28c5a5(_0xb2c62d[_0x406f('0x17')]['message']);}})[_0x406f('0x18')](function(_0x3ad3fe){logger[_0x406f('0x13')](_0x406f('0x15'),_0xd817eb,_0x3ad3fe);_0x4e0e96(_0x3ad3fe);});});} \ No newline at end of file +var _0x3468=['message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x553e3a,_0xf08208){var _0x3988f6=function(_0x4f1930){while(--_0x4f1930){_0x553e3a['push'](_0x553e3a['shift']());}};_0x3988f6(++_0xf08208);}(_0x3468,0x8d));var _0x8346=function(_0x157614,_0x1aba89){_0x157614=_0x157614-0x0;var _0x383bc8=_0x3468[_0x157614];return _0x383bc8;};'use strict';var _=require(_0x8346('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8346('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8346('0x2'))['db'];var utils=require(_0x8346('0x3'));var logger=require(_0x8346('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8346('0x5')]['http']({'port':0x232a});config[_0x8346('0x6')]=_[_0x8346('0x7')](config[_0x8346('0x6')],{'host':_0x8346('0x8'),'port':0x18eb});var socket=require(_0x8346('0x9'))(new Redis(config[_0x8346('0x6')]));require(_0x8346('0xa'))[_0x8346('0xb')](socket);function respondWithRpcPromise(_0xa9c056,_0x2bc2a4,_0x35b247){return new BPromise(function(_0x3caac8,_0x461116){return client['request'](_0xa9c056,_0x35b247)[_0x8346('0xc')](function(_0x265c06){logger[_0x8346('0xd')](_0x8346('0xe'),_0x2bc2a4,_0x8346('0xf'));logger[_0x8346('0x10')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2bc2a4,_0x8346('0xf'),JSON[_0x8346('0x11')](_0x265c06));if(_0x265c06[_0x8346('0x12')]){if(_0x265c06[_0x8346('0x12')][_0x8346('0x13')]===0x1f4){logger[_0x8346('0x12')](_0x8346('0xe'),_0x2bc2a4,_0x265c06['error'][_0x8346('0x14')]);return _0x461116(_0x265c06['error'][_0x8346('0x14')]);}logger['error'](_0x8346('0xe'),_0x2bc2a4,_0x265c06['error'][_0x8346('0x14')]);return _0x3caac8(_0x265c06['error']['message']);}else{logger[_0x8346('0xd')](_0x8346('0xe'),_0x2bc2a4,'request\x20sent');_0x3caac8(_0x265c06[_0x8346('0x15')][_0x8346('0x14')]);}})[_0x8346('0x16')](function(_0x4dc342){logger[_0x8346('0x12')](_0x8346('0xe'),_0x2bc2a4,_0x4dc342);_0x461116(_0x4dc342);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 3c8f3d4..6296762 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 _0x63de=['remove','emit','removeListener','length','chatGroup:','./chatGroup.events','save'];(function(_0x5b5af1,_0x1db01b){var _0x45ab7b=function(_0x1e353a){while(--_0x1e353a){_0x5b5af1['push'](_0x5b5af1['shift']());}};_0x45ab7b(++_0x1db01b);}(_0x63de,0xe5));var _0xe63d=function(_0x50f6af,_0x1726d0){_0x50f6af=_0x50f6af-0x0;var _0x434ab1=_0x63de[_0x50f6af];return _0x434ab1;};'use strict';var ChatGroupEvents=require(_0xe63d('0x0'));var events=[_0xe63d('0x1'),_0xe63d('0x2'),'update'];function createListener(_0x5c6358,_0x5d316e){return function(_0x46a0e5){_0x5d316e[_0xe63d('0x3')](_0x5c6358,_0x46a0e5);};}function removeListener(_0xf00d1e,_0xf7a67){return function(){ChatGroupEvents[_0xe63d('0x4')](_0xf00d1e,_0xf7a67);};}exports['register']=function(_0x3abb40){for(var _0x3d4182=0x0,_0x4e66b8=events[_0xe63d('0x5')];_0x3d4182<_0x4e66b8;_0x3d4182++){var _0x2d39e9=events[_0x3d4182];var _0x291d36=createListener(_0xe63d('0x6')+_0x2d39e9,_0x3abb40);ChatGroupEvents['on'](_0x2d39e9,_0x291d36);}}; \ No newline at end of file +var _0xe351=['chatGroup:','remove','update','removeListener','register'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0xe351,0x182));var _0x1e35=function(_0xd86d0c,_0x2391ef){_0xd86d0c=_0xd86d0c-0x0;var _0x16c264=_0xe351[_0xd86d0c];return _0x16c264;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x1e35('0x0'),_0x1e35('0x1')];function createListener(_0x3356c8,_0x596b28){return function(_0x5e2828){_0x596b28['emit'](_0x3356c8,_0x5e2828);};}function removeListener(_0x23bbaf,_0x4e7b35){return function(){ChatGroupEvents[_0x1e35('0x2')](_0x23bbaf,_0x4e7b35);};}exports[_0x1e35('0x3')]=function(_0x831927){for(var _0x4a0d92=0x0,_0x133971=events['length'];_0x4a0d92<_0x133971;_0x4a0d92++){var _0x19fff4=events[_0x4a0d92];var _0x5c5ea9=createListener(_0x1e35('0x4')+_0x19fff4,_0x831927);ChatGroupEvents['on'](_0x19fff4,_0x5c5ea9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e927adc..a148483 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 _0x3c55=['isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get'];(function(_0x4d3726,_0xbec3ae){var _0x51b610=function(_0x3698dc){while(--_0x3698dc){_0x4d3726['push'](_0x4d3726['shift']());}};_0x51b610(++_0xbec3ae);}(_0x3c55,0x123));var _0x53c5=function(_0x50b54b,_0xba911d){_0x50b54b=_0x50b54b-0x0;var _0x1859c1=_0x3c55[_0x50b54b];return _0x1859c1;};'use strict';var multer=require('multer');var util=require(_0x53c5('0x0'));var path=require(_0x53c5('0x1'));var timeout=require(_0x53c5('0x2'));var express=require(_0x53c5('0x3'));var router=express['Router']();var fs_extra=require(_0x53c5('0x4'));var auth=require(_0x53c5('0x5'));var interaction=require(_0x53c5('0x6'));var config=require('../../config/environment');var controller=require(_0x53c5('0x7'));router[_0x53c5('0x8')]('/',auth[_0x53c5('0x9')](),controller[_0x53c5('0xa')]);router[_0x53c5('0x8')](_0x53c5('0xb'),auth['isAuthenticated'](),controller[_0x53c5('0xc')]);router[_0x53c5('0x8')](_0x53c5('0xd'),auth[_0x53c5('0x9')](),controller[_0x53c5('0xe')]);router['get'](_0x53c5('0xf'),auth[_0x53c5('0x9')](),controller[_0x53c5('0x10')]);router[_0x53c5('0x8')]('/:id/members',auth[_0x53c5('0x9')](),controller['getMembers']);router[_0x53c5('0x8')](_0x53c5('0x11'),auth[_0x53c5('0x9')](),controller[_0x53c5('0x12')]);router[_0x53c5('0x13')]('/',auth[_0x53c5('0x9')](),controller[_0x53c5('0x14')]);router[_0x53c5('0x13')](_0x53c5('0x15'),auth[_0x53c5('0x9')](),controller[_0x53c5('0x16')]);router['post'](_0x53c5('0x11'),auth[_0x53c5('0x9')](),controller[_0x53c5('0x17')]);router[_0x53c5('0x18')](_0x53c5('0xd'),auth[_0x53c5('0x9')](),controller[_0x53c5('0x19')]);router[_0x53c5('0x1a')](_0x53c5('0xd'),auth['isAuthenticated'](),controller[_0x53c5('0x1b')]);router[_0x53c5('0x1a')]('/:id/members',auth[_0x53c5('0x9')](),controller[_0x53c5('0x1c')]);module[_0x53c5('0x1d')]=router; \ No newline at end of file +var _0x9fdc=['post','/:id/messages','addMessage','put','update','destroy','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','getMembers','getMessages'];(function(_0x5ce4a1,_0x15f338){var _0x437272=function(_0x39d353){while(--_0x39d353){_0x5ce4a1['push'](_0x5ce4a1['shift']());}};_0x437272(++_0x15f338);}(_0x9fdc,0x164));var _0xc9fd=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x9fdc[_0x4eafed];return _0x159c85;};'use strict';var multer=require(_0xc9fd('0x0'));var util=require(_0xc9fd('0x1'));var path=require(_0xc9fd('0x2'));var timeout=require('connect-timeout');var express=require(_0xc9fd('0x3'));var router=express[_0xc9fd('0x4')]();var fs_extra=require(_0xc9fd('0x5'));var auth=require(_0xc9fd('0x6'));var interaction=require(_0xc9fd('0x7'));var config=require(_0xc9fd('0x8'));var controller=require(_0xc9fd('0x9'));router[_0xc9fd('0xa')]('/',auth[_0xc9fd('0xb')](),controller[_0xc9fd('0xc')]);router[_0xc9fd('0xa')](_0xc9fd('0xd'),auth[_0xc9fd('0xb')](),controller[_0xc9fd('0xe')]);router[_0xc9fd('0xa')](_0xc9fd('0xf'),auth[_0xc9fd('0xb')](),controller[_0xc9fd('0x10')]);router[_0xc9fd('0xa')](_0xc9fd('0x11'),auth['isAuthenticated'](),controller[_0xc9fd('0x12')]);router['get']('/:id/members',auth[_0xc9fd('0xb')](),controller[_0xc9fd('0x13')]);router[_0xc9fd('0xa')]('/:id/messages',auth[_0xc9fd('0xb')](),controller[_0xc9fd('0x14')]);router[_0xc9fd('0x15')]('/',auth[_0xc9fd('0xb')](),controller['create']);router[_0xc9fd('0x15')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0xc9fd('0x15')](_0xc9fd('0x16'),auth[_0xc9fd('0xb')](),controller[_0xc9fd('0x17')]);router[_0xc9fd('0x18')](_0xc9fd('0xf'),auth['isAuthenticated'](),controller[_0xc9fd('0x19')]);router['delete'](_0xc9fd('0xf'),auth[_0xc9fd('0xb')](),controller[_0xc9fd('0x1a')]);router[_0xc9fd('0x1b')]('/:id/members',auth[_0xc9fd('0xb')](),controller['removeMembers']);module[_0xc9fd('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index f0a835a..40e7b46 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 _0xdb94=['long','DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','thumb','star','STRING','TEXT'];(function(_0x27fc00,_0x5c0310){var _0x18e581=function(_0x147f3d){while(--_0x147f3d){_0x27fc00['push'](_0x27fc00['shift']());}};_0x18e581(++_0x5c0310);}(_0xdb94,0xab));var _0x4db9=function(_0x24dbf7,_0x101d78){_0x24dbf7=_0x24dbf7-0x0;var _0xd42ec8=_0xdb94[_0x24dbf7];return _0xd42ec8;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'closed':{'type':Sequelize[_0x4db9('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4db9('0x3')]},'ratingType':{'type':Sequelize[_0x4db9('0x4')]('star',_0x4db9('0x5')),'defaultValue':_0x4db9('0x6')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x4db9('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4db9('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4db9('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x4db9('0x7')]},'osName':{'type':Sequelize[_0x4db9('0x7')]},'osVersion':{'type':Sequelize[_0x4db9('0x7')]},'deviceModel':{'type':Sequelize[_0x4db9('0x7')]},'deviceVendor':{'type':Sequelize[_0x4db9('0x7')]},'deviceType':{'type':Sequelize[_0x4db9('0x7')]},'referer':{'type':Sequelize[_0x4db9('0x8')]},'customerIp':{'type':Sequelize[_0x4db9('0x7')]},'formData':{'type':Sequelize[_0x4db9('0x8')](_0x4db9('0x9'))},'read1stAt':{'type':Sequelize[_0x4db9('0xa')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4db9('0x4')]('in',_0x4db9('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x4db9('0x8')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x80ed=['INTEGER','ENUM','thumb','star','TEXT','DATE','STRING','long','out','sequelize','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80ed,0x11c));var _0xd80e=function(_0x1d1cb5,_0x298f33){_0x1d1cb5=_0x1d1cb5-0x0;var _0x332fbe=_0x80ed[_0x1d1cb5];return _0x332fbe;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'closed':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd80e('0x2')]},'ratingType':{'type':Sequelize[_0xd80e('0x3')]('star',_0xd80e('0x4')),'defaultValue':_0xd80e('0x5')},'ratingMessage':{'type':Sequelize[_0xd80e('0x6')]},'pathTranscript':{'type':Sequelize[_0xd80e('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd80e('0x7')]},'disposition':{'type':Sequelize[_0xd80e('0x8')]},'secondDisposition':{'type':Sequelize[_0xd80e('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd80e('0x8')]},'browserName':{'type':Sequelize[_0xd80e('0x8')]},'browserVersion':{'type':Sequelize[_0xd80e('0x8')]},'osName':{'type':Sequelize[_0xd80e('0x8')]},'osVersion':{'type':Sequelize[_0xd80e('0x8')]},'deviceModel':{'type':Sequelize[_0xd80e('0x8')]},'deviceVendor':{'type':Sequelize[_0xd80e('0x8')]},'deviceType':{'type':Sequelize[_0xd80e('0x8')]},'referer':{'type':Sequelize[_0xd80e('0x6')]},'customerIp':{'type':Sequelize[_0xd80e('0x8')]},'formData':{'type':Sequelize['TEXT'](_0xd80e('0x9'))},'read1stAt':{'type':Sequelize[_0xd80e('0x7')]},'lastMsgAt':{'type':Sequelize[_0xd80e('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xd80e('0x3')]('in',_0xd80e('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd80e('0x8')]},'customerPort':{'type':Sequelize[_0xd80e('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xd80e('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e254f38..bf13f21 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 _0x7a33=['options','include','getMyMessages','hasOwnProperty','ChatInteractionId','push','rows','addTags','omit','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','get','mkdirSync','Chat','Owner','N.A.','createdAt','browserName','osName','customerPort','tail','createReadStream','read','value','renderFile','views','transcript-','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','destroy','name','render','merge','body','agent','interaction','account','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','query','user','params','model','keys','filters','intersection','fields','attributes','includeAll','find','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','parse','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','json','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','User','ChatWebsiteId','ContactId','length','UserId','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','rawAttributes','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a33,0xff));var _0x37a3=function(_0x263810,_0x35827a){_0x263810=_0x263810-0x0;var _0x2c90bd=_0x7a33[_0x263810];return _0x2c90bd;};'use strict';var rimraf=require(_0x37a3('0x0'));var zipdir=require('zip-dir');var rp=require(_0x37a3('0x1'));var moment=require(_0x37a3('0x2'));var BPromise=require(_0x37a3('0x3'));var Mustache=require(_0x37a3('0x4'));var util=require(_0x37a3('0x5'));var path=require(_0x37a3('0x6'));var ejs=require(_0x37a3('0x7'));var fs=require('fs');var _=require(_0x37a3('0x8'));var Redis=require(_0x37a3('0x9'));var interaction=require(_0x37a3('0xa'));var qs=require(_0x37a3('0xb'));var pdf=require(_0x37a3('0xc'));var logger=require(_0x37a3('0xd'))(_0x37a3('0xe'));var config=require(_0x37a3('0xf'));var db=require(_0x37a3('0x10'))['db'];config[_0x37a3('0x11')]=_[_0x37a3('0x12')](config[_0x37a3('0x11')],{'host':_0x37a3('0x13'),'port':0x18eb});var socket=require(_0x37a3('0x14'))(new Redis(config[_0x37a3('0x11')]));require(_0x37a3('0x15'))[_0x37a3('0x16')](socket);var jayson=require(_0x37a3('0x17'));var client=jayson[_0x37a3('0x18')][_0x37a3('0x19')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x35b47b,_0x22ffbf,_0x26be59,_0x5c4f45){return new BPromise(function(_0x21bdf4,_0x38271e){var _0x1101d3=_0x5c4f45||client;return _0x1101d3['request'](_0x35b47b,_0x26be59)[_0x37a3('0x1a')](function(_0x29f687){logger[_0x37a3('0x1b')](_0x37a3('0x1c'),_0x22ffbf,_0x37a3('0x1d'));logger[_0x37a3('0x1e')](_0x37a3('0x1f'),_0x22ffbf,_0x37a3('0x1d'),JSON[_0x37a3('0x20')](_0x29f687));if(_0x29f687[_0x37a3('0x21')]){if(_0x29f687[_0x37a3('0x21')][_0x37a3('0x22')]===0x1f4){logger[_0x37a3('0x21')](_0x37a3('0x1c'),_0x22ffbf,_0x29f687[_0x37a3('0x21')][_0x37a3('0x23')]);return _0x38271e(_0x29f687['error'][_0x37a3('0x23')]);}logger[_0x37a3('0x21')](_0x37a3('0x1c'),_0x22ffbf,_0x29f687[_0x37a3('0x21')][_0x37a3('0x23')]);return _0x21bdf4(_0x29f687[_0x37a3('0x21')][_0x37a3('0x23')]);}else{logger[_0x37a3('0x1b')](_0x37a3('0x1c'),_0x22ffbf,_0x37a3('0x1d'));_0x21bdf4(_0x29f687[_0x37a3('0x24')]['message']);}})[_0x37a3('0x25')](function(_0x4a38fa){logger[_0x37a3('0x21')](_0x37a3('0x1c'),_0x22ffbf,_0x4a38fa);_0x38271e(_0x4a38fa);});});}function respondWithStatusCode(_0x4f8927,_0x41d4e3){_0x41d4e3=_0x41d4e3||0xcc;return function(_0x240075){if(_0x240075){return _0x4f8927[_0x37a3('0x26')](_0x41d4e3);}return _0x4f8927[_0x37a3('0x27')](_0x41d4e3)[_0x37a3('0x28')]();};}function respondWithResult(_0x1f92f0,_0x174e23){_0x174e23=_0x174e23||0xc8;return function(_0x5837d5){if(_0x5837d5){return _0x1f92f0[_0x37a3('0x27')](_0x174e23)['json'](_0x5837d5);}};}function respondWithFilteredResult(_0x46c53a,_0x8eb52d){return function(_0x3d9cf){if(_0x3d9cf){var _0x3802d3=typeof _0x8eb52d[_0x37a3('0x29')]===_0x37a3('0x2a')&&typeof _0x8eb52d[_0x37a3('0x2b')]===_0x37a3('0x2a');var _0x2f379b=_0x3d9cf[_0x37a3('0x2c')];var _0x18ba47=_0x3802d3?0x0:_0x8eb52d[_0x37a3('0x29')];var _0x2f5440=_0x3802d3?_0x3d9cf[_0x37a3('0x2c')]:_0x8eb52d[_0x37a3('0x29')]+_0x8eb52d['limit'];var _0xa62da0;if(_0x2f5440>=_0x2f379b){_0x2f5440=_0x2f379b;_0xa62da0=0xc8;}else{_0xa62da0=0xce;}_0x46c53a[_0x37a3('0x27')](_0xa62da0);return _0x46c53a[_0x37a3('0x2d')](_0x37a3('0x2e'),_0x18ba47+'-'+_0x2f5440+'/'+_0x2f379b)['json'](_0x3d9cf);}return null;};}function saveUpdates(_0x1cff55){return function(_0x4daa07){if(_0x4daa07){return _0x4daa07[_0x37a3('0x2f')](_0x1cff55)[_0x37a3('0x1a')](function(_0x4ed719){return _0x4ed719;});}return null;};}function removeEntity(_0x187e41){return function(_0x1657c1){if(_0x1657c1){return _0x1657c1[_0x37a3('0x30')]()[_0x37a3('0x1a')](function(){_0x187e41['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf84672){return function(_0x41edc3){if(!_0x41edc3){_0xf84672[_0x37a3('0x26')](0x194);}return _0x41edc3;};}function handleError(_0x13bf46,_0xc2f5e2){_0xc2f5e2=_0xc2f5e2||0x1f4;return function(_0x4e629c){logger[_0x37a3('0x21')](_0x4e629c['stack']);if(_0x4e629c[_0x37a3('0x31')]){delete _0x4e629c[_0x37a3('0x31')];}_0x13bf46[_0x37a3('0x27')](_0xc2f5e2)['send'](_0x4e629c);};}function getMustacheRender(_0x249e88,_0x2a9050){return Mustache[_0x37a3('0x32')](_0x249e88,_[_0x37a3('0x33')](_0x2a9050[_0x37a3('0x34')],{'contact':_0x2a9050['contact'],'message':_0x2a9050[_0x37a3('0x23')],'agent':_0x2a9050[_0x37a3('0x35')],'interaction':_0x2a9050[_0x37a3('0x36')],'account':_0x2a9050[_0x37a3('0x37')]}))||'';}exports[_0x37a3('0x38')]=function(_0x296a1d,_0x3fddc8){var _0x573a16={};var _0x216703=_[_0x37a3('0x39')](db[_0x37a3('0x3a')]['rawAttributes'],function(_0xfd04a9){return{'name':_0xfd04a9[_0x37a3('0x3b')],'type':_0xfd04a9[_0x37a3('0x3c')][_0x37a3('0x3d')]};});_0x573a16=qs[_0x37a3('0x3e')](_0x216703,_0x296a1d);return interaction[_0x37a3('0x3f')]('chat',_0x296a1d[_0x37a3('0x40')],_0x296a1d[_0x37a3('0x41')],_0x573a16,_0x216703)[_0x37a3('0x1a')](respondWithFilteredResult(_0x3fddc8,_0x573a16))['catch'](handleError(_0x3fddc8,null));};exports['show']=function(_0x42e3e9,_0x2ef847){var _0x1a5973={'raw':![],'where':{'id':_0x42e3e9[_0x37a3('0x42')]['id']}},_0xf0b539={};_0xf0b539[_0x37a3('0x43')]=_[_0x37a3('0x44')](db['ChatInteraction']['rawAttributes']);_0xf0b539[_0x37a3('0x40')]=_[_0x37a3('0x44')](_0x42e3e9['query']);_0xf0b539[_0x37a3('0x45')]=_[_0x37a3('0x46')](_0xf0b539['model'],_0xf0b539['query']);_0x1a5973['attributes']=_[_0x37a3('0x46')](_0xf0b539[_0x37a3('0x43')],qs[_0x37a3('0x47')](_0x42e3e9['query'][_0x37a3('0x47')]));_0x1a5973['attributes']=_0x1a5973[_0x37a3('0x48')]['length']?_0x1a5973[_0x37a3('0x48')]:_0xf0b539['model'];if(_0x42e3e9[_0x37a3('0x40')][_0x37a3('0x49')]){_0x1a5973['include']=[{'all':!![]}];}_0x1a5973=_[_0x37a3('0x33')]({},_0x1a5973,_0x42e3e9['options']);return db[_0x37a3('0x3a')][_0x37a3('0x4a')](_0x1a5973)[_0x37a3('0x1a')](handleEntityNotFound(_0x2ef847,null))[_0x37a3('0x1a')](respondWithResult(_0x2ef847,null))[_0x37a3('0x25')](handleError(_0x2ef847,null));};exports[_0x37a3('0x4b')]=function(_0x5e6ce0,_0x45b4d6){return db['ChatInteraction'][_0x37a3('0x4b')](_0x5e6ce0[_0x37a3('0x34')],{})[_0x37a3('0x1a')](respondWithResult(_0x45b4d6,0xc9))[_0x37a3('0x25')](handleError(_0x45b4d6,null));};exports[_0x37a3('0x2f')]=function(_0x1ba8f7,_0x370f7e){if(_0x1ba8f7[_0x37a3('0x34')]['id']){delete _0x1ba8f7[_0x37a3('0x34')]['id'];}return db['ChatInteraction'][_0x37a3('0x4a')]({'where':{'id':_0x1ba8f7[_0x37a3('0x42')]['id']}})[_0x37a3('0x1a')](handleEntityNotFound(_0x370f7e,null))['then'](saveUpdates(_0x1ba8f7['body'],null))[_0x37a3('0x1a')](respondWithResult(_0x370f7e,null))['catch'](handleError(_0x370f7e,null));};exports[_0x37a3('0x30')]=function(_0x432d0e,_0x20f3a0){return db[_0x37a3('0x3a')][_0x37a3('0x4a')]({'where':{'id':_0x432d0e[_0x37a3('0x42')]['id']}})[_0x37a3('0x1a')](handleEntityNotFound(_0x20f3a0,null))[_0x37a3('0x1a')](removeEntity(_0x20f3a0,null))[_0x37a3('0x25')](handleError(_0x20f3a0,null));};exports[_0x37a3('0x4c')]=function(_0x5cecba,_0x2c7cfd){return db[_0x37a3('0x3a')][_0x37a3('0x4c')]()[_0x37a3('0x1a')](respondWithResult(_0x2c7cfd,null))[_0x37a3('0x25')](handleError(_0x2c7cfd,null));};exports[_0x37a3('0x4d')]=function(_0x36ab79,_0x3c57ba){var _0x5f1b2d=_0x36ab79[_0x37a3('0x42')]['id'];var _0x43627c;var _0x804ed6;var _0x538dd1;return db[_0x37a3('0x3a')][_0x37a3('0x4e')]({'where':{'id':_0x5f1b2d}})[_0x37a3('0x1a')](function(_0x6a664){_0x43627c=_0x6a664;return db[_0x37a3('0x4f')]['findOne']({'where':{'id':_0x6a664['ChatWebsiteId']},'attributes':['id',_0x37a3('0x50'),_0x37a3('0x51'),_0x37a3('0x52'),_0x37a3('0x53'),'vidaooMetadata'],'raw':!![]});})[_0x37a3('0x1a')](function(_0x79240e){if(_0x79240e&&_0x79240e[_0x37a3('0x50')]&&_0x79240e[_0x37a3('0x51')]){_0x804ed6=_0x79240e;var _0x275e46={'interaction':{'id':_0x5f1b2d},'agent':{'id':_0x36ab79[_0x37a3('0x41')]['id'],'name':_0x36ab79['user'][_0x37a3('0x31')],'fullname':_0x36ab79[_0x37a3('0x41')][_0x37a3('0x54')],'email':_0x36ab79['user'][_0x37a3('0x55')]},'contact':_0x36ab79[_0x37a3('0x34')][_0x37a3('0x56')],'account':_0x36ab79[_0x37a3('0x34')][_0x37a3('0x37')]};var _0x5e9305={'rejectUnauthorized':![],'method':_0x37a3('0x57'),'url':_0x37a3('0x58'),'headers':{'X-APIKEY':_0x79240e[_0x37a3('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x36ab79['user'][_0x37a3('0x55')]],'buttons':null,'topic':_0x804ed6[_0x37a3('0x52')],'note':_[_0x37a3('0x59')](_0x804ed6[_0x37a3('0x53')])?null:getMustacheRender(_0x804ed6[_0x37a3('0x53')],_0x275e46),'metadata':null},'redirect':_0x37a3('0x5a'),'json':!![]};try{if(!_['isNull'](_0x804ed6[_0x37a3('0x5b')])){var _0xb4910a=getMustacheRender(_0x804ed6[_0x37a3('0x5b')],_0x275e46);var _0x30031c=JSON[_0x37a3('0x5c')](_0xb4910a);_0x5e9305[_0x37a3('0x34')]['metadata']=_0x30031c;}}catch(_0x2d07e8){throw new db[(_0x37a3('0x5d'))]['ValidationError'](_0x37a3('0x5e'));}return rp(_0x5e9305);}else{throw new db[(_0x37a3('0x5d'))][(_0x37a3('0x5f'))](_0x37a3('0x60'));}})['then'](function(_0x23748a){_0x538dd1=_0x23748a;if(_0x538dd1['id']){var _0x5bb242={'body':_0x538dd1[_0x37a3('0x61')],'ChatWebsiteId':_0x804ed6['id'],'ChatInteractionId':_0x43627c['id'],'direction':_0x37a3('0x62'),'UserId':_0x36ab79[_0x37a3('0x41')]['id']};return db[_0x37a3('0x63')][_0x37a3('0x4b')](_0x5bb242,{});}else{throw new db[(_0x37a3('0x5d'))][(_0x37a3('0x5f'))](_0x37a3('0x64'));}})[_0x37a3('0x1a')](function(){return _0x43627c[_0x37a3('0x65')]({'vidaooSessionId':_0x538dd1['id']});})['then'](respondWithResult(_0x3c57ba,null))[_0x37a3('0x25')](handleError(_0x3c57ba,null));};exports[_0x37a3('0x66')]=function(_0x5e98af,_0x5516cf){if(_0x5e98af[_0x37a3('0x34')]['id']){delete _0x5e98af[_0x37a3('0x34')]['id'];}return db[_0x37a3('0x3a')][_0x37a3('0x4a')]({'where':{'id':_0x5e98af[_0x37a3('0x42')]['id']},'include':[{'model':db[_0x37a3('0x67')],'as':_0x37a3('0x68')}]})[_0x37a3('0x1a')](handleEntityNotFound(_0x5516cf,null))[_0x37a3('0x1a')](saveUpdates(_0x5e98af[_0x37a3('0x34')],null))[_0x37a3('0x1a')](respondWithResult(_0x5516cf,null))['catch'](handleError(_0x5516cf,null));};exports[_0x37a3('0x69')]=function(_0x2d20e9,_0x109a87){if(_0x2d20e9[_0x37a3('0x34')]['id']){delete _0x2d20e9[_0x37a3('0x34')]['id'];}return db[_0x37a3('0x3a')]['find']({'where':{'id':_0x2d20e9['params']['id']}})[_0x37a3('0x1a')](function(_0x17e0d6){if(!_0x17e0d6){logger['error'](_0x37a3('0x6a'),_0x37a3('0x69'),0x194,_0x37a3('0x6b'));_0x109a87['sendStatus'](0x194);}else{if(_0x17e0d6['UserId']){throw new db[(_0x37a3('0x5d'))][(_0x37a3('0x5f'))](_0x37a3('0x6c'));}}return _0x17e0d6;})['then'](function(_0xaf13f0){if(_0xaf13f0){return _0xaf13f0[_0x37a3('0x2f')]({'closed':_0x2d20e9[_0x37a3('0x34')][_0x37a3('0x6d')],'disposition':_0x2d20e9[_0x37a3('0x34')][_0x37a3('0x6e')]})[_0x37a3('0x1a')](function(_0x214025){return _0x214025;});}})[_0x37a3('0x1a')](function(){return respondWithRpcPromise(_0x37a3('0x6f'),'abandon',_0x2d20e9[_0x37a3('0x34')],client9004);})[_0x37a3('0x1a')](respondWithResult(_0x109a87,null))[_0x37a3('0x25')](handleError(_0x109a87,null));};exports[_0x37a3('0x70')]=function(_0x47e134,_0x1e5dfe){_0x47e134[_0x37a3('0x34')][_0x37a3('0x31')]=_0x47e134[_0x37a3('0x71')]['originalname'];_0x47e134[_0x37a3('0x34')]['basename']=_0x47e134[_0x37a3('0x71')][_0x37a3('0x72')];_0x47e134[_0x37a3('0x34')][_0x37a3('0x3c')]=_0x47e134[_0x37a3('0x71')][_0x37a3('0x73')];return db[_0x37a3('0x74')]['create'](_0x47e134[_0x37a3('0x34')])[_0x37a3('0x1a')](respondWithResult(_0x1e5dfe,0xc9))['catch'](handleError(_0x1e5dfe,null));};exports[_0x37a3('0x75')]=function(_0x13daa8,_0x17fb7d){return db[_0x37a3('0x3a')][_0x37a3('0x4e')]({'where':{'id':_0x13daa8[_0x37a3('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x17fb7d,null))[_0x37a3('0x1a')](function(_0x38d723){if(_0x38d723){if(_0x38d723['closed']){return _0x17fb7d['status'](0x193)[_0x37a3('0x76')]({'status':0x193,'message':_0x37a3('0x77')});}return db['Attachment'][_0x37a3('0x4e')]({'where':{'id':_0x13daa8['query'][_0x37a3('0x78')]},'raw':!![]})[_0x37a3('0x1a')](handleEntityNotFound(_0x17fb7d,null));}})[_0x37a3('0x1a')](function(_0xb35335){if(_0xb35335){var _0x2f5fce=_0xb35335[_0x37a3('0x79')]!==null;var _0x141167=path[_0x37a3('0x7a')](config[_0x37a3('0x7b')],'server/files/attachments/');if(_0x2f5fce){_0x141167=path[_0x37a3('0x7a')](_0x141167,_0x37a3('0x7c'));}var _0x50f7c5=path['join'](_0x141167,_0xb35335[_0x37a3('0x7d')]);return _0x17fb7d[_0x37a3('0x7e')](_0x50f7c5);}})['catch'](handleError(_0x17fb7d,null));};exports[_0x37a3('0x7f')]=function(_0x564381,_0x41100c){var _0x1fa757=null;var _0x3335f4=null;var _0x59b2a2=null;if(_0x564381[_0x37a3('0x34')]['id']){delete _0x564381['body']['id'];}if(_0x564381[_0x37a3('0x34')][_0x37a3('0x80')]){_0x59b2a2=path['join'](config[_0x37a3('0x7b')],_0x37a3('0x81'),util[_0x37a3('0x82')]('transcript-%s.txt',Date[_0x37a3('0x83')]()));_0x564381['body'][_0x37a3('0x84')]=_0x59b2a2;}return db['ChatInteraction'][_0x37a3('0x4a')]({'where':{'id':_0x564381['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x37a3('0x85'),'include':[{'model':db[_0x37a3('0x86')],'as':'User'}]}]})[_0x37a3('0x1a')](handleEntityNotFound(_0x41100c,null))[_0x37a3('0x1a')](saveUpdates(_0x564381[_0x37a3('0x34')],null))['then'](function(_0x35348f){if(_0x35348f){_0x1fa757=_0x35348f;return db['ChatWebsite']['find']({'where':{'id':_0x1fa757[_0x37a3('0x87')]}});}})[_0x37a3('0x1a')](function(_0x488211){if(_0x488211){_0x3335f4=_0x488211;return db['CmContact'][_0x37a3('0x4a')]({'where':{'id':_0x1fa757[_0x37a3('0x88')]}});}})['then'](function(_0x3396cb){if(_0x3396cb){if(_0x59b2a2){var _0x261328=null;for(var _0x3c41d2=0x1;_0x3c41d2<_0x1fa757[_0x37a3('0x85')][_0x37a3('0x89')];++_0x3c41d2){_0x261328=_0x1fa757[_0x37a3('0x85')][_0x3c41d2];var _0x5d23e0=_0x261328[_0x37a3('0x8a')]?util[_0x37a3('0x82')](_0x37a3('0x8b'),_0x3335f4[_0x37a3('0x8c')],_0x261328['UserId']):'System';var _0x8dc9c2=_0x564381[_0x37a3('0x34')][_0x37a3('0x8d')]||util[_0x37a3('0x82')]('%s%d',_0x37a3('0x8e'),_0x261328[_0x37a3('0x88')]);switch(_0x3335f4[_0x37a3('0x8f')]){case _0x37a3('0x90'):_0x5d23e0=_0x261328[_0x37a3('0x8a')]?util[_0x37a3('0x82')]('%s%d',_0x3335f4[_0x37a3('0x8c')],_0x261328[_0x37a3('0x8a')]):_0x37a3('0x91');break;case'agent_alias':_0x5d23e0=_0x261328['UserId']?_0x261328['User'][_0x37a3('0x92')]||_0x261328['User'][_0x37a3('0x54')]:_0x37a3('0x91');break;case'agent_fullname':_0x5d23e0=_0x261328[_0x37a3('0x8a')]?_0x261328[_0x37a3('0x86')][_0x37a3('0x54')]:_0x37a3('0x91');break;default:_0x5d23e0=_0x261328[_0x37a3('0x8a')]?util[_0x37a3('0x82')](_0x37a3('0x8b'),_0x3335f4[_0x37a3('0x8c')],_0x261328['UserId']):_0x37a3('0x91');}var _0x3fec82=util[_0x37a3('0x82')](_0x37a3('0x93'),moment(_0x261328['createdAt'])[_0x37a3('0x82')](_0x37a3('0x94')),_0x261328[_0x37a3('0x95')]==='in'?_0x8dc9c2:_0x5d23e0,_0x261328[_0x37a3('0x34')]);if(!_0x261328['secret']){fs[_0x37a3('0x96')](_0x59b2a2,_0x3fec82);}}return db[_0x37a3('0x97')][_0x37a3('0x4e')]({'where':{'service':!![]},'include':[{'model':db[_0x37a3('0x98')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x37a3('0x99')],'as':_0x37a3('0x99'),'raw':!![]}]}]});}}})['then'](function(_0x5e91b1){if(!_0x5e91b1||!_0x5e91b1[_0x37a3('0x9a')]||!_0x564381[_0x37a3('0x34')])return _0x1fa757;var _0x2af499=_0x5e91b1[_0x37a3('0x9b')]();return respondWithRpcPromise(_0x37a3('0x9c'),'sendMail',{'account':_0x2af499,'message':{'from':util[_0x37a3('0x82')](_0x37a3('0x9d'),_0x5e91b1['name'],_0x5e91b1[_0x37a3('0x55')]||_0x5e91b1['Smtp'][_0x37a3('0x41')]),'to':_0x564381[_0x37a3('0x34')][_0x37a3('0x80')],'subject':_0x37a3('0x9e'),'text':util[_0x37a3('0x82')](_0x37a3('0x9f'),_0x564381[_0x37a3('0x34')]['mailTranscript']),'attachments':[{'path':_0x59b2a2}]}})[_0x37a3('0x1a')](function(){return _0x1fa757;})[_0x37a3('0x25')](function(_0x3cc452){logger['error'](_0x3cc452);});})[_0x37a3('0x1a')](respondWithStatusCode(_0x41100c,0xc8))[_0x37a3('0x25')](handleError(_0x41100c,null));};exports['addMessage']=function(_0x27fec8,_0x3fa772){return db[_0x37a3('0x63')][_0x37a3('0x4a')]({'where':{'id':_0x27fec8['params']['id']}})[_0x37a3('0x1a')](handleEntityNotFound(_0x3fa772,null))[_0x37a3('0x1a')](function(_0x25daf2){if(_0x25daf2){return _0x25daf2[_0x37a3('0xa0')](_0x27fec8[_0x37a3('0x34')]['ids'],_['omit'](_0x27fec8[_0x37a3('0x34')],[_0x37a3('0xa1'),'id'])||{});}})[_0x37a3('0x1a')](respondWithResult(_0x3fa772,null))[_0x37a3('0x25')](handleError(_0x3fa772,null));};exports[_0x37a3('0xa2')]=function(_0x400594,_0x143f75){var _0x320808={'raw':![],'where':{}};var _0x3a7e12={};var _0x3fd048={'count':0x0,'rows':[]};return db[_0x37a3('0x3a')]['findOne']({'where':{'id':_0x400594['params']['id']}})[_0x37a3('0x1a')](handleEntityNotFound(_0x143f75,null))['then'](function(_0x480f69){if(_0x480f69){_0x3a7e12[_0x37a3('0x43')]=_[_0x37a3('0x44')](db['ChatMessage'][_0x37a3('0xa3')]);_0x3a7e12[_0x37a3('0x40')]=_[_0x37a3('0x44')](_0x400594[_0x37a3('0x40')]);_0x3a7e12['filters']=_[_0x37a3('0x46')](_0x3a7e12[_0x37a3('0x43')],_0x3a7e12[_0x37a3('0x40')]);_0x320808['attributes']=_[_0x37a3('0x46')](_0x3a7e12['model'],qs[_0x37a3('0x47')](_0x400594[_0x37a3('0x40')][_0x37a3('0x47')]));_0x320808[_0x37a3('0x48')]=_0x320808['attributes'][_0x37a3('0x89')]?_0x320808[_0x37a3('0x48')]:_0x3a7e12[_0x37a3('0x43')];if(!_0x400594[_0x37a3('0x40')]['hasOwnProperty'](_0x37a3('0xa4'))){_0x320808[_0x37a3('0x2b')]=qs[_0x37a3('0x2b')](_0x400594[_0x37a3('0x40')][_0x37a3('0x2b')]);_0x320808[_0x37a3('0x29')]=qs[_0x37a3('0x29')](_0x400594['query'][_0x37a3('0x29')]);}_0x320808[_0x37a3('0xa5')]=qs[_0x37a3('0xa6')](_0x400594[_0x37a3('0x40')][_0x37a3('0xa6')]);_0x320808[_0x37a3('0xa7')]=qs[_0x37a3('0x45')](_[_0x37a3('0xa8')](_0x400594[_0x37a3('0x40')],_0x3a7e12['filters']));_0x320808['where']['ChatInteractionId']=_0x480f69['id'];if(_0x400594[_0x37a3('0x40')][_0x37a3('0xa9')]){_0x320808[_0x37a3('0xa7')]=_[_0x37a3('0x33')](_0x320808[_0x37a3('0xa7')],{'$or':_[_0x37a3('0x39')](_0x320808[_0x37a3('0x48')],function(_0x371f74){var _0x479e75={};_0x479e75[_0x371f74]={'$like':'%'+_0x400594[_0x37a3('0x40')][_0x37a3('0xa9')]+'%'};return _0x479e75;})});}if(_0x400594['query'][_0x37a3('0xaa')]){var _0x453147=_0x400594[_0x37a3('0x40')][_0x37a3('0xaa')][_0x37a3('0xab')](',');var _0x83e5e3={};_0x83e5e3[_0x453147[0x0]]={'$gte':moment(_0x453147[0x1])['format'](_0x37a3('0xac'))};_0x320808[_0x37a3('0xa7')]=_[_0x37a3('0x33')](_0x320808['where'],_0x83e5e3);}_0x320808=_['merge']({},_0x320808,_0x400594[_0x37a3('0xad')]);return db[_0x37a3('0x63')]['count']({'where':_0x320808[_0x37a3('0xa7')]})['then'](function(_0x588237){_0x3fd048['count']=_0x588237;if(_0x400594[_0x37a3('0x40')][_0x37a3('0x49')]){_0x320808[_0x37a3('0xae')]=[{'all':!![]}];}return db[_0x37a3('0x63')][_0x37a3('0x3f')](_0x320808);})[_0x37a3('0x1a')](function(_0x1ba6f0){_0x3fd048['rows']=_0x1ba6f0;return _0x3fd048;});}})[_0x37a3('0x1a')](respondWithFilteredResult(_0x143f75,_0x320808))[_0x37a3('0x25')](handleError(_0x143f75,null));};exports[_0x37a3('0xaf')]=function(_0x1c8bc7,_0x5787c7){var _0x5c1fd4={'where':{}},_0x5e75c7={},_0x4d1100={'count':0x0,'rows':[]};return db[_0x37a3('0x3a')][_0x37a3('0x4e')]({'where':{'id':_0x1c8bc7[_0x37a3('0x42')]['id']}})[_0x37a3('0x1a')](handleEntityNotFound(_0x5787c7,null))['then'](function(_0x4b820d){if(_0x4b820d){_0x5e75c7[_0x37a3('0x43')]=_['keys'](db[_0x37a3('0x63')]['rawAttributes']);_0x5e75c7[_0x37a3('0x40')]=_[_0x37a3('0x44')](_0x1c8bc7[_0x37a3('0x40')]);_0x5e75c7[_0x37a3('0x45')]=_['intersection'](_0x5e75c7[_0x37a3('0x43')],_0x5e75c7['query']);_0x5c1fd4[_0x37a3('0x48')]=_[_0x37a3('0x46')](_0x5e75c7[_0x37a3('0x43')],qs[_0x37a3('0x47')](_0x1c8bc7[_0x37a3('0x40')][_0x37a3('0x47')]));_0x5c1fd4['attributes']=_0x5c1fd4[_0x37a3('0x48')][_0x37a3('0x89')]?_0x5c1fd4['attributes']:_0x5e75c7[_0x37a3('0x43')];if(!_0x1c8bc7[_0x37a3('0x40')][_0x37a3('0xb0')](_0x37a3('0xa4'))){_0x5c1fd4[_0x37a3('0x2b')]=qs[_0x37a3('0x2b')](_0x1c8bc7[_0x37a3('0x40')]['limit']);_0x5c1fd4['offset']=qs[_0x37a3('0x29')](_0x1c8bc7[_0x37a3('0x40')][_0x37a3('0x29')]);}_0x5c1fd4[_0x37a3('0xa5')]=qs['sort'](_0x1c8bc7[_0x37a3('0x40')]['sort']);_0x5c1fd4['where']=qs[_0x37a3('0x45')](_[_0x37a3('0xa8')](_0x1c8bc7[_0x37a3('0x40')],_0x5e75c7[_0x37a3('0x45')]));_0x5c1fd4[_0x37a3('0xa7')][_0x37a3('0xb1')]=_0x4b820d['id'];if(_0x1c8bc7[_0x37a3('0x40')][_0x37a3('0xa9')]){_0x5c1fd4[_0x37a3('0xa7')]=_[_0x37a3('0x33')](_0x5c1fd4[_0x37a3('0xa7')],{'$or':_['map'](_0x5c1fd4[_0x37a3('0x48')],function(_0x49d765){var _0x380260={};_0x380260[_0x49d765]={'$like':'%'+_0x1c8bc7[_0x37a3('0x40')][_0x37a3('0xa9')]+'%'};return _0x380260;})});}_0x5c1fd4[_0x37a3('0xa7')]['secret']=![];if(_0x1c8bc7[_0x37a3('0x40')]['id']){_0x5c1fd4[_0x37a3('0xa7')]['id']={'$gt':_0x1c8bc7[_0x37a3('0x40')]['id']};}_0x5c1fd4=_[_0x37a3('0x33')]({},_0x5c1fd4,_0x1c8bc7[_0x37a3('0xad')]);return db[_0x37a3('0x63')][_0x37a3('0x2c')]({'where':_0x5c1fd4[_0x37a3('0xa7')]})['then'](function(_0x25c400){_0x4d1100['count']=_0x25c400;_0x5c1fd4[_0x37a3('0xae')]=[];if(_0x1c8bc7[_0x37a3('0x40')]['includeAgent']){_0x5c1fd4[_0x37a3('0xae')][_0x37a3('0xb2')]({'model':db[_0x37a3('0x86')],'as':_0x37a3('0x86'),'attributes':['id',_0x37a3('0x54'),'alias']});}if(_0x1c8bc7['query'][_0x37a3('0x49')]){_0x5c1fd4[_0x37a3('0xae')]=[{'all':!![]}];}return db[_0x37a3('0x63')][_0x37a3('0x3f')](_0x5c1fd4);})[_0x37a3('0x1a')](function(_0x10344f){_0x4d1100[_0x37a3('0xb3')]=_0x10344f;return _0x4d1100;});}})[_0x37a3('0x1a')](respondWithFilteredResult(_0x5787c7,_0x5c1fd4))[_0x37a3('0x25')](handleError(_0x5787c7,null));};exports[_0x37a3('0xb4')]=function(_0x1eaed7,_0x19f72f){return db[_0x37a3('0x3a')][_0x37a3('0x4a')]({'where':{'id':_0x1eaed7[_0x37a3('0x42')]['id']}})[_0x37a3('0x1a')](handleEntityNotFound(_0x19f72f,null))[_0x37a3('0x1a')](function(_0x18f87d){if(_0x18f87d){return _0x18f87d['setTags'](_0x1eaed7['body']['ids'],_[_0x37a3('0xb5')](_0x1eaed7[_0x37a3('0x34')],['ids','id'])||{})[_0x37a3('0xb6')](function(){return db[_0x37a3('0xb7')][_0x37a3('0x3f')]({'attributes':['id',_0x37a3('0x31'),'color'],'where':{'id':_0x1eaed7[_0x37a3('0x34')][_0x37a3('0xa1')]}});})[_0x37a3('0x1a')](function(_0x422351){socket[_0x37a3('0xb8')](_0x37a3('0xb9'),{'id':Number(_0x1eaed7[_0x37a3('0x42')]['id']),'tags':_0x422351||[]});return{'id':Number(_0x1eaed7[_0x37a3('0x42')]['id']),'tags':_0x422351||[]};});}})[_0x37a3('0x1a')](respondWithResult(_0x19f72f,null))[_0x37a3('0x25')](handleError(_0x19f72f,null));};exports['removeTags']=function(_0x91ecae,_0x5c3a3d){return db[_0x37a3('0x3a')][_0x37a3('0x4a')]({'where':{'id':_0x91ecae[_0x37a3('0x42')]['id']}})[_0x37a3('0x1a')](handleEntityNotFound(_0x5c3a3d,null))[_0x37a3('0x1a')](function(_0x5e06be){if(_0x5e06be){return _0x5e06be[_0x37a3('0xba')](_0x91ecae[_0x37a3('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x5c3a3d,null))[_0x37a3('0x25')](handleError(_0x5c3a3d,null));};exports[_0x37a3('0x7e')]=function(_0x5f4443,_0x3a9369){var _0x3a03ab=moment()[_0x37a3('0xbb')]()[_0x37a3('0xbc')]();var _0x3eed9b=path[_0x37a3('0x7a')](config[_0x37a3('0x7b')],_0x37a3('0xbd'),_0x37a3('0xbe'),_0x37a3('0xbf'));var _0x3ce612=path[_0x37a3('0x7a')](config[_0x37a3('0x7b')],_0x37a3('0xbd'),_0x37a3('0xbe'),_0x37a3('0xc0'));var _0x5bcfc2=path[_0x37a3('0x7a')](_0x3eed9b,_0x3a03ab);var _0x19008=util[_0x37a3('0x82')](_0x37a3('0xc1'),_0x5f4443[_0x37a3('0x42')]['id'],_0x3a03ab);var _0x19ad17=path[_0x37a3('0x7a')](_0x3eed9b,_0x19008);var _0x409c65=[];_0x409c65[_0x37a3('0xb2')]({'model':db[_0x37a3('0x86')],'as':_0x37a3('0x86'),'attributes':['id',_0x37a3('0x54')],'raw':!![]});_0x409c65[_0x37a3('0xb2')]({'model':db[_0x37a3('0x67')],'as':_0x37a3('0x68'),'attributes':['id',_0x37a3('0xc2'),_0x37a3('0xc3')],'raw':!![]});if(_0x5f4443[_0x37a3('0x40')][_0x37a3('0xc0')]){_0x409c65['push']({'model':db[_0x37a3('0x74')],'as':_0x37a3('0x74'),'raw':!![]});}var _0x50178e=[{'model':db['ChatMessage'],'as':_0x37a3('0x85'),'attributes':['id',_0x37a3('0x34'),'createdAt',_0x37a3('0x95'),'secret','read'],'include':_0x409c65}];_0x50178e[_0x37a3('0xb2')]({'model':db[_0x37a3('0x4f')],'as':_0x37a3('0xc4'),'attributes':['id','name']});_0x50178e['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x37a3('0x54')]});return db[_0x37a3('0x3a')]['find']({'where':{'id':_0x5f4443[_0x37a3('0x42')]['id']},'include':_0x50178e})['then'](handleEntityNotFound(_0x3a9369,null))['then'](function(_0x4b78a4){if(_0x4b78a4){var _0x476141=_0x4b78a4[_0x37a3('0xc5')]({'plain':!![]});fs[_0x37a3('0xc6')](_0x5bcfc2);var _0x5a1dea={'channel':_0x37a3('0xc7'),'account':_0x476141[_0x37a3('0xc4')][_0x37a3('0x31')],'agent':_0x476141[_0x37a3('0xc8')]?_0x476141['Owner'][_0x37a3('0x54')]:_0x37a3('0xc9'),'createdAt':moment(_0x476141[_0x37a3('0xca')])[_0x37a3('0x82')](_0x37a3('0xac'))[_0x37a3('0xbc')](),'closedAt':_0x476141['closed']?moment(_0x476141['closedAt'])[_0x37a3('0x82')](_0x37a3('0xac'))[_0x37a3('0xbc')]():'','disposition':_0x476141['disposition'],'chatInfo':{'browser':_0x476141[_0x37a3('0xcb')],'os':_0x476141[_0x37a3('0xcc')],'referer':_0x476141['referer'],'customerIp':_0x476141['customerIp'],'customerPort':_0x476141[_0x37a3('0xcd')]?_0x476141['customerPort']:_0x37a3('0xc9')},'messages':_(_0x476141[_0x37a3('0x85')])[_0x37a3('0xce')]()[_0x37a3('0xa9')]({'secret':![]})[_0x37a3('0x39')](function(_0x17b789){if(_0x17b789[_0x37a3('0x74')]){var _0x4839a8=path[_0x37a3('0x7a')](_0x3ce612,_0x17b789[_0x37a3('0x74')][_0x37a3('0x7d')]);if(fs['existsSync'](_0x4839a8)){fs[_0x37a3('0xcf')](_0x4839a8)['pipe'](fs['createWriteStream'](path[_0x37a3('0x7a')](_0x5bcfc2,_0x17b789[_0x37a3('0x74')]['basename'])));}}return{'date':moment(_0x17b789['createdAt'])[_0x37a3('0x82')](_0x37a3('0xac'))[_0x37a3('0xbc')](),'sender':_0x17b789[_0x37a3('0x95')]==='out'?_0x17b789[_0x37a3('0x86')]?_0x17b789[_0x37a3('0x86')][_0x37a3('0x54')]:'System':_0x17b789[_0x37a3('0x68')][_0x37a3('0xc2')]+(_0x17b789[_0x37a3('0x68')][_0x37a3('0xc3')]?'\x20'+_0x17b789[_0x37a3('0x68')]['lastName']:''),'body':_0x17b789['Attachment']?_0x17b789[_0x37a3('0x74')][_0x37a3('0x7d')]:_0x17b789[_0x37a3('0x34')],'direction':_0x17b789[_0x37a3('0x95')]==='out'?'A':'C','secret':_0x17b789['secret'],'read':_0x17b789[_0x37a3('0xd0')],'attachment':_0x17b789[_0x37a3('0x74')]};})[_0x37a3('0xd1')]()};return ejs[_0x37a3('0xd2')](path[_0x37a3('0x7a')](config[_0x37a3('0x7b')],'server',_0x37a3('0xd3'),'downloadInteraction.ejs'),{'interaction':_0x5a1dea})[_0x37a3('0x1a')](function(_0x64199d){var _0x408f1c=path[_0x37a3('0x7a')](_0x5bcfc2,_0x37a3('0xd4')+_0x476141['id']+'-'+_0x3a03ab+'.pdf');var _0x5a7cfb={'path':_0x408f1c,'channel':_0x37a3('0xc7'),'interactionId':_0x476141['id']};return pdf['createPdfFromHTML'](_0x64199d,_0x5a7cfb);})[_0x37a3('0x1a')](function(){return new Promise(function(_0x4b63ea,_0x9147e7){zipdir(_0x5bcfc2,{'saveTo':_0x19ad17},function(_0x2cf557,_0x5f48e4){if(_0x2cf557)return _0x9147e7(_0x2cf557);return _0x4b63ea(_0x5f48e4);});})[_0x37a3('0x1a')](function(){return new BPromise(function(_0x55fc60,_0x285eeb){rimraf(_0x5bcfc2,function(_0x5a08b0){if(_0x5a08b0)_0x285eeb(_0x5a08b0);return _0x55fc60();});});})[_0x37a3('0x1a')](function(){return _0x3a9369[_0x37a3('0x7e')](_0x19ad17,_0x19008,function(_0x4d805b){if(_0x4d805b){logger[_0x37a3('0x21')]('err',_0x4d805b);}else{fs[_0x37a3('0xd5')](_0x19ad17);}});});});}else{return _0x3a9369['sendStatus'](0xc8);}})[_0x37a3('0x25')](handleError(_0x3a9369,null));}; \ No newline at end of file +var _0xc013=['toString','server','tmp','files','attachments','transcript-%d-%s.zip','push','Contact','firstName','read','Account','Owner','get','mkdirSync','createdAt','closedAt','browserName','referer','customerIp','customerPort','existsSync','createWriteStream','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','stack','name','send','render','body','contact','account','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','rawAttributes','filters','attributes','intersection','fields','includeAll','include','merge','create','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','parse','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','closed','disposition','AbandonInteraction','originalname','basename','file','mimetype','attachmentDownload','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','transcript-%s.txt','pathTranscript','Messages','User','length','agentAlias','System','customer','format','Visitor','ContactId','website_alias','%s%d','agent_alias','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','hasOwnProperty','nolimit','order','alias','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix'];(function(_0x1ada47,_0x93420b){var _0x35d6c3=function(_0x5d3d56){while(--_0x5d3d56){_0x1ada47['push'](_0x1ada47['shift']());}};_0x35d6c3(++_0x93420b);}(_0xc013,0xf5));var _0x3c01=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0xc013[_0x91d019];return _0x19de1f;};'use strict';var rimraf=require(_0x3c01('0x0'));var zipdir=require(_0x3c01('0x1'));var rp=require(_0x3c01('0x2'));var moment=require('moment');var BPromise=require(_0x3c01('0x3'));var Mustache=require('mustache');var util=require(_0x3c01('0x4'));var path=require(_0x3c01('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3c01('0x6'));var Redis=require(_0x3c01('0x7'));var interaction=require(_0x3c01('0x8'));var qs=require(_0x3c01('0x9'));var pdf=require(_0x3c01('0xa'));var logger=require(_0x3c01('0xb'))(_0x3c01('0xc'));var config=require(_0x3c01('0xd'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3c01('0xe')](config[_0x3c01('0xf')],{'host':_0x3c01('0x10'),'port':0x18eb});var socket=require(_0x3c01('0x11'))(new Redis(config[_0x3c01('0xf')]));require(_0x3c01('0x12'))['register'](socket);var jayson=require(_0x3c01('0x13'));var client=jayson[_0x3c01('0x14')][_0x3c01('0x15')]({'port':0x232b});var client9004=jayson['client'][_0x3c01('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x59dabb,_0x282b16,_0x49b967,_0x4dd4b9){return new BPromise(function(_0x36272d,_0x5ae76a){var _0x46a485=_0x4dd4b9||client;return _0x46a485[_0x3c01('0x16')](_0x59dabb,_0x49b967)['then'](function(_0x38e459){logger[_0x3c01('0x17')](_0x3c01('0x18'),_0x282b16,'request\x20sent');logger[_0x3c01('0x19')](_0x3c01('0x1a'),_0x282b16,'request\x20sent',JSON['stringify'](_0x38e459));if(_0x38e459[_0x3c01('0x1b')]){if(_0x38e459[_0x3c01('0x1b')][_0x3c01('0x1c')]===0x1f4){logger[_0x3c01('0x1b')](_0x3c01('0x18'),_0x282b16,_0x38e459[_0x3c01('0x1b')][_0x3c01('0x1d')]);return _0x5ae76a(_0x38e459[_0x3c01('0x1b')][_0x3c01('0x1d')]);}logger[_0x3c01('0x1b')](_0x3c01('0x18'),_0x282b16,_0x38e459['error'][_0x3c01('0x1d')]);return _0x36272d(_0x38e459[_0x3c01('0x1b')][_0x3c01('0x1d')]);}else{logger[_0x3c01('0x17')](_0x3c01('0x18'),_0x282b16,_0x3c01('0x1e'));_0x36272d(_0x38e459[_0x3c01('0x1f')][_0x3c01('0x1d')]);}})[_0x3c01('0x20')](function(_0x12cc45){logger[_0x3c01('0x1b')](_0x3c01('0x18'),_0x282b16,_0x12cc45);_0x5ae76a(_0x12cc45);});});}function respondWithStatusCode(_0x31dea6,_0x784f98){_0x784f98=_0x784f98||0xcc;return function(_0x494339){if(_0x494339){return _0x31dea6[_0x3c01('0x21')](_0x784f98);}return _0x31dea6[_0x3c01('0x22')](_0x784f98)[_0x3c01('0x23')]();};}function respondWithResult(_0x1aa5c9,_0x16f376){_0x16f376=_0x16f376||0xc8;return function(_0x965374){if(_0x965374){return _0x1aa5c9[_0x3c01('0x22')](_0x16f376)[_0x3c01('0x24')](_0x965374);}};}function respondWithFilteredResult(_0x57c0c6,_0x5589ca){return function(_0x1b3006){if(_0x1b3006){var _0x5e2273=typeof _0x5589ca['offset']===_0x3c01('0x25')&&typeof _0x5589ca['limit']===_0x3c01('0x25');var _0x460994=_0x1b3006['count'];var _0x4dab2e=_0x5e2273?0x0:_0x5589ca['offset'];var _0x48b25d=_0x5e2273?_0x1b3006[_0x3c01('0x26')]:_0x5589ca[_0x3c01('0x27')]+_0x5589ca[_0x3c01('0x28')];var _0x42c6a8;if(_0x48b25d>=_0x460994){_0x48b25d=_0x460994;_0x42c6a8=0xc8;}else{_0x42c6a8=0xce;}_0x57c0c6['status'](_0x42c6a8);return _0x57c0c6[_0x3c01('0x29')](_0x3c01('0x2a'),_0x4dab2e+'-'+_0x48b25d+'/'+_0x460994)['json'](_0x1b3006);}return null;};}function saveUpdates(_0x15786e){return function(_0x47931f){if(_0x47931f){return _0x47931f[_0x3c01('0x2b')](_0x15786e)[_0x3c01('0x2c')](function(_0x5a3e56){return _0x5a3e56;});}return null;};}function removeEntity(_0x35be7d){return function(_0x198683){if(_0x198683){return _0x198683[_0x3c01('0x2d')]()['then'](function(){_0x35be7d[_0x3c01('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x552580){return function(_0x3f25c6){if(!_0x3f25c6){_0x552580[_0x3c01('0x21')](0x194);}return _0x3f25c6;};}function handleError(_0x5decd7,_0x574ea0){_0x574ea0=_0x574ea0||0x1f4;return function(_0x237a79){logger[_0x3c01('0x1b')](_0x237a79[_0x3c01('0x2e')]);if(_0x237a79['name']){delete _0x237a79[_0x3c01('0x2f')];}_0x5decd7[_0x3c01('0x22')](_0x574ea0)[_0x3c01('0x30')](_0x237a79);};}function getMustacheRender(_0x5904dc,_0x2dbbcb){return Mustache[_0x3c01('0x31')](_0x5904dc,_['merge'](_0x2dbbcb[_0x3c01('0x32')],{'contact':_0x2dbbcb[_0x3c01('0x33')],'message':_0x2dbbcb[_0x3c01('0x1d')],'agent':_0x2dbbcb['agent'],'interaction':_0x2dbbcb['interaction'],'account':_0x2dbbcb[_0x3c01('0x34')]}))||'';}exports[_0x3c01('0x35')]=function(_0xf9b7eb,_0x5d30c7){var _0x5acb39={};var _0x299d16=_[_0x3c01('0x36')](db[_0x3c01('0x37')]['rawAttributes'],function(_0x4001d2){return{'name':_0x4001d2[_0x3c01('0x38')],'type':_0x4001d2[_0x3c01('0x39')][_0x3c01('0x3a')]};});_0x5acb39=qs[_0x3c01('0x3b')](_0x299d16,_0xf9b7eb);return interaction[_0x3c01('0x3c')](_0x3c01('0x3d'),_0xf9b7eb[_0x3c01('0x3e')],_0xf9b7eb[_0x3c01('0x3f')],_0x5acb39,_0x299d16)[_0x3c01('0x2c')](respondWithFilteredResult(_0x5d30c7,_0x5acb39))[_0x3c01('0x20')](handleError(_0x5d30c7,null));};exports[_0x3c01('0x40')]=function(_0xf46328,_0x63e081){var _0x248982={'raw':![],'where':{'id':_0xf46328[_0x3c01('0x41')]['id']}},_0x37d08a={};_0x37d08a[_0x3c01('0x42')]=_[_0x3c01('0x43')](db['ChatInteraction'][_0x3c01('0x44')]);_0x37d08a[_0x3c01('0x3e')]=_[_0x3c01('0x43')](_0xf46328[_0x3c01('0x3e')]);_0x37d08a[_0x3c01('0x45')]=_['intersection'](_0x37d08a['model'],_0x37d08a[_0x3c01('0x3e')]);_0x248982[_0x3c01('0x46')]=_[_0x3c01('0x47')](_0x37d08a[_0x3c01('0x42')],qs[_0x3c01('0x48')](_0xf46328[_0x3c01('0x3e')][_0x3c01('0x48')]));_0x248982[_0x3c01('0x46')]=_0x248982[_0x3c01('0x46')]['length']?_0x248982[_0x3c01('0x46')]:_0x37d08a[_0x3c01('0x42')];if(_0xf46328['query'][_0x3c01('0x49')]){_0x248982[_0x3c01('0x4a')]=[{'all':!![]}];}_0x248982=_[_0x3c01('0x4b')]({},_0x248982,_0xf46328['options']);return db['ChatInteraction']['find'](_0x248982)[_0x3c01('0x2c')](handleEntityNotFound(_0x63e081,null))[_0x3c01('0x2c')](respondWithResult(_0x63e081,null))['catch'](handleError(_0x63e081,null));};exports[_0x3c01('0x4c')]=function(_0x458cd9,_0x3cad3f){return db[_0x3c01('0x37')][_0x3c01('0x4c')](_0x458cd9[_0x3c01('0x32')],{})['then'](respondWithResult(_0x3cad3f,0xc9))['catch'](handleError(_0x3cad3f,null));};exports[_0x3c01('0x2b')]=function(_0x36ddeb,_0x1e4b29){if(_0x36ddeb[_0x3c01('0x32')]['id']){delete _0x36ddeb[_0x3c01('0x32')]['id'];}return db[_0x3c01('0x37')][_0x3c01('0x4d')]({'where':{'id':_0x36ddeb['params']['id']}})[_0x3c01('0x2c')](handleEntityNotFound(_0x1e4b29,null))[_0x3c01('0x2c')](saveUpdates(_0x36ddeb[_0x3c01('0x32')],null))['then'](respondWithResult(_0x1e4b29,null))['catch'](handleError(_0x1e4b29,null));};exports[_0x3c01('0x2d')]=function(_0xee08f7,_0x512019){return db[_0x3c01('0x37')]['find']({'where':{'id':_0xee08f7[_0x3c01('0x41')]['id']}})[_0x3c01('0x2c')](handleEntityNotFound(_0x512019,null))['then'](removeEntity(_0x512019,null))[_0x3c01('0x20')](handleError(_0x512019,null));};exports[_0x3c01('0x4e')]=function(_0x2948e0,_0x4507a8){return db['ChatInteraction']['describe']()[_0x3c01('0x2c')](respondWithResult(_0x4507a8,null))[_0x3c01('0x20')](handleError(_0x4507a8,null));};exports[_0x3c01('0x4f')]=function(_0xdedbe5,_0x262ec7){var _0x50fa46=_0xdedbe5['params']['id'];var _0x1b6ccd;var _0x15a318;var _0x5ca2ac;return db[_0x3c01('0x37')][_0x3c01('0x50')]({'where':{'id':_0x50fa46}})[_0x3c01('0x2c')](function(_0x1eb7a7){_0x1b6ccd=_0x1eb7a7;return db[_0x3c01('0x51')][_0x3c01('0x50')]({'where':{'id':_0x1eb7a7[_0x3c01('0x52')]},'attributes':['id',_0x3c01('0x53'),_0x3c01('0x54'),_0x3c01('0x55'),_0x3c01('0x56'),_0x3c01('0x57')],'raw':!![]});})[_0x3c01('0x2c')](function(_0x497ad6){if(_0x497ad6&&_0x497ad6[_0x3c01('0x53')]&&_0x497ad6[_0x3c01('0x54')]){_0x15a318=_0x497ad6;var _0x2d7e49={'interaction':{'id':_0x50fa46},'agent':{'id':_0xdedbe5[_0x3c01('0x3f')]['id'],'name':_0xdedbe5[_0x3c01('0x3f')][_0x3c01('0x2f')],'fullname':_0xdedbe5['user'][_0x3c01('0x58')],'email':_0xdedbe5[_0x3c01('0x3f')]['email']},'contact':_0xdedbe5[_0x3c01('0x32')][_0x3c01('0x33')],'account':_0xdedbe5[_0x3c01('0x32')][_0x3c01('0x34')]};var _0x49d170={'rejectUnauthorized':![],'method':_0x3c01('0x59'),'url':_0x3c01('0x5a'),'headers':{'X-APIKEY':_0x497ad6['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0xdedbe5[_0x3c01('0x3f')][_0x3c01('0x5b')]],'buttons':null,'topic':_0x15a318[_0x3c01('0x55')],'note':_[_0x3c01('0x5c')](_0x15a318[_0x3c01('0x56')])?null:getMustacheRender(_0x15a318[_0x3c01('0x56')],_0x2d7e49),'metadata':null},'redirect':_0x3c01('0x5d'),'json':!![]};try{if(!_['isNull'](_0x15a318[_0x3c01('0x57')])){var _0x20d59c=getMustacheRender(_0x15a318[_0x3c01('0x57')],_0x2d7e49);var _0xaed906=JSON[_0x3c01('0x5e')](_0x20d59c);_0x49d170[_0x3c01('0x32')]['metadata']=_0xaed906;}}catch(_0x22d74e){throw new db[(_0x3c01('0x5f'))]['ValidationError'](_0x3c01('0x60'));}return rp(_0x49d170);}else{throw new db[(_0x3c01('0x5f'))][(_0x3c01('0x61'))](_0x3c01('0x62'));}})[_0x3c01('0x2c')](function(_0x1e1225){_0x5ca2ac=_0x1e1225;if(_0x5ca2ac['id']){var _0x2c51d0={'body':_0x5ca2ac[_0x3c01('0x63')],'ChatWebsiteId':_0x15a318['id'],'ChatInteractionId':_0x1b6ccd['id'],'direction':_0x3c01('0x64'),'UserId':_0xdedbe5[_0x3c01('0x3f')]['id']};return db[_0x3c01('0x65')]['create'](_0x2c51d0,{});}else{throw new db['Sequelize'][(_0x3c01('0x61'))](_0x3c01('0x66'));}})[_0x3c01('0x2c')](function(){return _0x1b6ccd[_0x3c01('0x67')]({'vidaooSessionId':_0x5ca2ac['id']});})['then'](respondWithResult(_0x262ec7,null))[_0x3c01('0x20')](handleError(_0x262ec7,null));};exports[_0x3c01('0x68')]=function(_0x2e7c76,_0x3db599){if(_0x2e7c76[_0x3c01('0x32')]['id']){delete _0x2e7c76[_0x3c01('0x32')]['id'];}return db[_0x3c01('0x37')][_0x3c01('0x4d')]({'where':{'id':_0x2e7c76[_0x3c01('0x41')]['id']},'include':[{'model':db[_0x3c01('0x69')],'as':'Contact'}]})[_0x3c01('0x2c')](handleEntityNotFound(_0x3db599,null))['then'](saveUpdates(_0x2e7c76[_0x3c01('0x32')],null))[_0x3c01('0x2c')](respondWithResult(_0x3db599,null))[_0x3c01('0x20')](handleError(_0x3db599,null));};exports[_0x3c01('0x6a')]=function(_0x26d134,_0x573013){if(_0x26d134[_0x3c01('0x32')]['id']){delete _0x26d134[_0x3c01('0x32')]['id'];}return db['ChatInteraction'][_0x3c01('0x4d')]({'where':{'id':_0x26d134[_0x3c01('0x41')]['id']}})['then'](function(_0x9e52f6){if(!_0x9e52f6){logger[_0x3c01('0x1b')](_0x3c01('0x6b'),_0x3c01('0x6a'),0x194,'entity\x20not\x20found');_0x573013[_0x3c01('0x21')](0x194);}else{if(_0x9e52f6[_0x3c01('0x6c')]){throw new db['Sequelize'][(_0x3c01('0x61'))]('Interaction\x20already\x20assigned');}}return _0x9e52f6;})['then'](function(_0x5e4135){if(_0x5e4135){return _0x5e4135[_0x3c01('0x2b')]({'closed':_0x26d134[_0x3c01('0x32')][_0x3c01('0x6d')],'disposition':_0x26d134[_0x3c01('0x32')][_0x3c01('0x6e')]})['then'](function(_0x563cfa){return _0x563cfa;});}})[_0x3c01('0x2c')](function(){return respondWithRpcPromise(_0x3c01('0x6f'),_0x3c01('0x6a'),_0x26d134[_0x3c01('0x32')],client9004);})[_0x3c01('0x2c')](respondWithResult(_0x573013,null))['catch'](handleError(_0x573013,null));};exports['attachmentUpload']=function(_0x25a1f1,_0x530562){_0x25a1f1[_0x3c01('0x32')]['name']=_0x25a1f1['file'][_0x3c01('0x70')];_0x25a1f1[_0x3c01('0x32')][_0x3c01('0x71')]=_0x25a1f1[_0x3c01('0x72')]['filename'];_0x25a1f1[_0x3c01('0x32')]['type']=_0x25a1f1[_0x3c01('0x72')][_0x3c01('0x73')];return db['Attachment'][_0x3c01('0x4c')](_0x25a1f1[_0x3c01('0x32')])[_0x3c01('0x2c')](respondWithResult(_0x530562,0xc9))[_0x3c01('0x20')](handleError(_0x530562,null));};exports[_0x3c01('0x74')]=function(_0x1bd383,_0xc85382){return db[_0x3c01('0x37')][_0x3c01('0x50')]({'where':{'id':_0x1bd383['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0xc85382,null))[_0x3c01('0x2c')](function(_0x590b5d){if(_0x590b5d){if(_0x590b5d[_0x3c01('0x6d')]){return _0xc85382[_0x3c01('0x22')](0x193)[_0x3c01('0x24')]({'status':0x193,'message':'Unauthorized'});}return db[_0x3c01('0x75')]['findOne']({'where':{'id':_0x1bd383[_0x3c01('0x3e')][_0x3c01('0x76')]},'raw':!![]})[_0x3c01('0x2c')](handleEntityNotFound(_0xc85382,null));}})['then'](function(_0x5bba60){if(_0x5bba60){var _0x4d6722=_0x5bba60[_0x3c01('0x77')]!==null;var _0x2b3407=path[_0x3c01('0x78')](config[_0x3c01('0x79')],'server/files/attachments/');if(_0x4d6722){_0x2b3407=path[_0x3c01('0x78')](_0x2b3407,_0x3c01('0x7a'));}var _0x558d7a=path['join'](_0x2b3407,_0x5bba60[_0x3c01('0x71')]);return _0xc85382[_0x3c01('0x7b')](_0x558d7a);}})[_0x3c01('0x20')](handleError(_0xc85382,null));};exports[_0x3c01('0x7c')]=function(_0x3f5720,_0x2d24b4){var _0x39d379=null;var _0x575077=null;var _0xa776d2=null;if(_0x3f5720['body']['id']){delete _0x3f5720[_0x3c01('0x32')]['id'];}if(_0x3f5720['body'][_0x3c01('0x7d')]){_0xa776d2=path[_0x3c01('0x78')](config[_0x3c01('0x79')],'server/files/chat/upload/',util['format'](_0x3c01('0x7e'),Date['now']()));_0x3f5720[_0x3c01('0x32')][_0x3c01('0x7f')]=_0xa776d2;}return db['ChatInteraction']['find']({'where':{'id':_0x3f5720[_0x3c01('0x41')]['id']},'include':[{'model':db[_0x3c01('0x65')],'as':_0x3c01('0x80'),'include':[{'model':db[_0x3c01('0x81')],'as':_0x3c01('0x81')}]}]})[_0x3c01('0x2c')](handleEntityNotFound(_0x2d24b4,null))[_0x3c01('0x2c')](saveUpdates(_0x3f5720[_0x3c01('0x32')],null))[_0x3c01('0x2c')](function(_0x27cd91){if(_0x27cd91){_0x39d379=_0x27cd91;return db[_0x3c01('0x51')][_0x3c01('0x4d')]({'where':{'id':_0x39d379[_0x3c01('0x52')]}});}})[_0x3c01('0x2c')](function(_0x530753){if(_0x530753){_0x575077=_0x530753;return db[_0x3c01('0x69')][_0x3c01('0x4d')]({'where':{'id':_0x39d379['ContactId']}});}})['then'](function(_0x57a548){if(_0x57a548){if(_0xa776d2){var _0x2184fe=null;for(var _0x57a728=0x1;_0x57a728<_0x39d379[_0x3c01('0x80')][_0x3c01('0x82')];++_0x57a728){_0x2184fe=_0x39d379[_0x3c01('0x80')][_0x57a728];var _0x17d30e=_0x2184fe[_0x3c01('0x6c')]?util['format']('%s%d',_0x575077[_0x3c01('0x83')],_0x2184fe[_0x3c01('0x6c')]):_0x3c01('0x84');var _0x21b330=_0x3f5720[_0x3c01('0x32')][_0x3c01('0x85')]||util[_0x3c01('0x86')]('%s%d',_0x3c01('0x87'),_0x2184fe[_0x3c01('0x88')]);switch(_0x575077['agentIdentifier']){case _0x3c01('0x89'):_0x17d30e=_0x2184fe[_0x3c01('0x6c')]?util['format'](_0x3c01('0x8a'),_0x575077[_0x3c01('0x83')],_0x2184fe[_0x3c01('0x6c')]):_0x3c01('0x84');break;case _0x3c01('0x8b'):_0x17d30e=_0x2184fe[_0x3c01('0x6c')]?_0x2184fe[_0x3c01('0x81')]['alias']||_0x2184fe[_0x3c01('0x81')][_0x3c01('0x58')]:'System';break;case'agent_fullname':_0x17d30e=_0x2184fe['UserId']?_0x2184fe[_0x3c01('0x81')][_0x3c01('0x58')]:'System';break;default:_0x17d30e=_0x2184fe['UserId']?util['format'](_0x3c01('0x8a'),_0x575077['agentAlias'],_0x2184fe[_0x3c01('0x6c')]):_0x3c01('0x84');}var _0x26a691=util[_0x3c01('0x86')](_0x3c01('0x8c'),moment(_0x2184fe['createdAt'])[_0x3c01('0x86')]('MM/DD/YYYY\x20HH:mm:ss'),_0x2184fe[_0x3c01('0x8d')]==='in'?_0x21b330:_0x17d30e,_0x2184fe['body']);if(!_0x2184fe[_0x3c01('0x8e')]){fs[_0x3c01('0x8f')](_0xa776d2,_0x26a691);}}return db[_0x3c01('0x90')][_0x3c01('0x50')]({'where':{'service':!![]},'include':[{'model':db[_0x3c01('0x91')],'as':_0x3c01('0x92'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x3c01('0x93'),'raw':!![]}]}]});}}})[_0x3c01('0x2c')](function(_0x35ad81){if(!_0x35ad81||!_0x35ad81['Smtp']||!_0x3f5720['body'])return _0x39d379;var _0x305a6b=_0x35ad81[_0x3c01('0x94')]();return respondWithRpcPromise('SendMail',_0x3c01('0x95'),{'account':_0x305a6b,'message':{'from':util[_0x3c01('0x86')](_0x3c01('0x96'),_0x35ad81[_0x3c01('0x2f')],_0x35ad81[_0x3c01('0x5b')]||_0x35ad81[_0x3c01('0x92')][_0x3c01('0x3f')]),'to':_0x3f5720[_0x3c01('0x32')]['mailTranscript'],'subject':_0x3c01('0x97'),'text':util['format'](_0x3c01('0x98'),_0x3f5720[_0x3c01('0x32')][_0x3c01('0x7d')]),'attachments':[{'path':_0xa776d2}]}})[_0x3c01('0x2c')](function(){return _0x39d379;})['catch'](function(_0x252f68){logger['error'](_0x252f68);});})[_0x3c01('0x2c')](respondWithStatusCode(_0x2d24b4,0xc8))[_0x3c01('0x20')](handleError(_0x2d24b4,null));};exports[_0x3c01('0x99')]=function(_0x310e83,_0x42ebd0){return db['ChatMessage'][_0x3c01('0x4d')]({'where':{'id':_0x310e83['params']['id']}})[_0x3c01('0x2c')](handleEntityNotFound(_0x42ebd0,null))[_0x3c01('0x2c')](function(_0x3cf14a){if(_0x3cf14a){return _0x3cf14a[_0x3c01('0x99')](_0x310e83['body']['ids'],_['omit'](_0x310e83[_0x3c01('0x32')],[_0x3c01('0x9a'),'id'])||{});}})['then'](respondWithResult(_0x42ebd0,null))['catch'](handleError(_0x42ebd0,null));};exports[_0x3c01('0x9b')]=function(_0x41c44b,_0x4f8b05){var _0x5ef6ad={'raw':![],'where':{}};var _0x2dbe11={};var _0x12bdb8={'count':0x0,'rows':[]};return db[_0x3c01('0x37')]['findOne']({'where':{'id':_0x41c44b[_0x3c01('0x41')]['id']}})[_0x3c01('0x2c')](handleEntityNotFound(_0x4f8b05,null))[_0x3c01('0x2c')](function(_0x1f9a74){if(_0x1f9a74){_0x2dbe11[_0x3c01('0x42')]=_[_0x3c01('0x43')](db[_0x3c01('0x65')][_0x3c01('0x44')]);_0x2dbe11[_0x3c01('0x3e')]=_['keys'](_0x41c44b['query']);_0x2dbe11[_0x3c01('0x45')]=_[_0x3c01('0x47')](_0x2dbe11['model'],_0x2dbe11[_0x3c01('0x3e')]);_0x5ef6ad['attributes']=_[_0x3c01('0x47')](_0x2dbe11[_0x3c01('0x42')],qs[_0x3c01('0x48')](_0x41c44b[_0x3c01('0x3e')][_0x3c01('0x48')]));_0x5ef6ad[_0x3c01('0x46')]=_0x5ef6ad[_0x3c01('0x46')][_0x3c01('0x82')]?_0x5ef6ad['attributes']:_0x2dbe11[_0x3c01('0x42')];if(!_0x41c44b[_0x3c01('0x3e')]['hasOwnProperty']('nolimit')){_0x5ef6ad[_0x3c01('0x28')]=qs[_0x3c01('0x28')](_0x41c44b[_0x3c01('0x3e')]['limit']);_0x5ef6ad[_0x3c01('0x27')]=qs[_0x3c01('0x27')](_0x41c44b['query'][_0x3c01('0x27')]);}_0x5ef6ad['order']=qs[_0x3c01('0x9c')](_0x41c44b[_0x3c01('0x3e')][_0x3c01('0x9c')]);_0x5ef6ad[_0x3c01('0x9d')]=qs[_0x3c01('0x45')](_[_0x3c01('0x9e')](_0x41c44b['query'],_0x2dbe11['filters']));_0x5ef6ad['where'][_0x3c01('0x9f')]=_0x1f9a74['id'];if(_0x41c44b[_0x3c01('0x3e')][_0x3c01('0xa0')]){_0x5ef6ad[_0x3c01('0x9d')]=_[_0x3c01('0x4b')](_0x5ef6ad[_0x3c01('0x9d')],{'$or':_[_0x3c01('0x36')](_0x5ef6ad[_0x3c01('0x46')],function(_0x2c9a8d){var _0x11c427={};_0x11c427[_0x2c9a8d]={'$like':'%'+_0x41c44b[_0x3c01('0x3e')][_0x3c01('0xa0')]+'%'};return _0x11c427;})});}if(_0x41c44b[_0x3c01('0x3e')][_0x3c01('0xa1')]){var _0x520682=_0x41c44b[_0x3c01('0x3e')][_0x3c01('0xa1')][_0x3c01('0xa2')](',');var _0x1c4f95={};_0x1c4f95[_0x520682[0x0]]={'$gte':moment(_0x520682[0x1])[_0x3c01('0x86')](_0x3c01('0xa3'))};_0x5ef6ad[_0x3c01('0x9d')]=_['merge'](_0x5ef6ad[_0x3c01('0x9d')],_0x1c4f95);}_0x5ef6ad=_[_0x3c01('0x4b')]({},_0x5ef6ad,_0x41c44b[_0x3c01('0xa4')]);return db[_0x3c01('0x65')][_0x3c01('0x26')]({'where':_0x5ef6ad[_0x3c01('0x9d')]})[_0x3c01('0x2c')](function(_0x1ce110){_0x12bdb8['count']=_0x1ce110;if(_0x41c44b[_0x3c01('0x3e')]['includeAll']){_0x5ef6ad[_0x3c01('0x4a')]=[{'all':!![]}];}return db[_0x3c01('0x65')][_0x3c01('0x3c')](_0x5ef6ad);})[_0x3c01('0x2c')](function(_0x59bcad){_0x12bdb8[_0x3c01('0xa5')]=_0x59bcad;return _0x12bdb8;});}})[_0x3c01('0x2c')](respondWithFilteredResult(_0x4f8b05,_0x5ef6ad))[_0x3c01('0x20')](handleError(_0x4f8b05,null));};exports['getMyMessages']=function(_0x47efdf,_0x1e905e){var _0x2b4881={'where':{}},_0x26c4db={},_0x3b5f91={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x3c01('0x50')]({'where':{'id':_0x47efdf['params']['id']}})[_0x3c01('0x2c')](handleEntityNotFound(_0x1e905e,null))[_0x3c01('0x2c')](function(_0x34fb1d){if(_0x34fb1d){_0x26c4db[_0x3c01('0x42')]=_['keys'](db[_0x3c01('0x65')][_0x3c01('0x44')]);_0x26c4db['query']=_[_0x3c01('0x43')](_0x47efdf[_0x3c01('0x3e')]);_0x26c4db[_0x3c01('0x45')]=_[_0x3c01('0x47')](_0x26c4db[_0x3c01('0x42')],_0x26c4db['query']);_0x2b4881[_0x3c01('0x46')]=_[_0x3c01('0x47')](_0x26c4db['model'],qs[_0x3c01('0x48')](_0x47efdf[_0x3c01('0x3e')][_0x3c01('0x48')]));_0x2b4881[_0x3c01('0x46')]=_0x2b4881[_0x3c01('0x46')][_0x3c01('0x82')]?_0x2b4881[_0x3c01('0x46')]:_0x26c4db[_0x3c01('0x42')];if(!_0x47efdf['query'][_0x3c01('0xa6')](_0x3c01('0xa7'))){_0x2b4881[_0x3c01('0x28')]=qs[_0x3c01('0x28')](_0x47efdf[_0x3c01('0x3e')][_0x3c01('0x28')]);_0x2b4881[_0x3c01('0x27')]=qs['offset'](_0x47efdf[_0x3c01('0x3e')]['offset']);}_0x2b4881[_0x3c01('0xa8')]=qs['sort'](_0x47efdf[_0x3c01('0x3e')][_0x3c01('0x9c')]);_0x2b4881[_0x3c01('0x9d')]=qs[_0x3c01('0x45')](_['pick'](_0x47efdf[_0x3c01('0x3e')],_0x26c4db[_0x3c01('0x45')]));_0x2b4881[_0x3c01('0x9d')][_0x3c01('0x9f')]=_0x34fb1d['id'];if(_0x47efdf['query'][_0x3c01('0xa0')]){_0x2b4881[_0x3c01('0x9d')]=_[_0x3c01('0x4b')](_0x2b4881[_0x3c01('0x9d')],{'$or':_['map'](_0x2b4881['attributes'],function(_0x37e448){var _0x15cdcb={};_0x15cdcb[_0x37e448]={'$like':'%'+_0x47efdf[_0x3c01('0x3e')][_0x3c01('0xa0')]+'%'};return _0x15cdcb;})});}_0x2b4881[_0x3c01('0x9d')][_0x3c01('0x8e')]=![];if(_0x47efdf['query']['id']){_0x2b4881['where']['id']={'$gt':_0x47efdf[_0x3c01('0x3e')]['id']};}_0x2b4881=_['merge']({},_0x2b4881,_0x47efdf[_0x3c01('0xa4')]);return db['ChatMessage'][_0x3c01('0x26')]({'where':_0x2b4881[_0x3c01('0x9d')]})['then'](function(_0x19fc25){_0x3b5f91[_0x3c01('0x26')]=_0x19fc25;_0x2b4881[_0x3c01('0x4a')]=[];if(_0x47efdf[_0x3c01('0x3e')]['includeAgent']){_0x2b4881[_0x3c01('0x4a')]['push']({'model':db['User'],'as':_0x3c01('0x81'),'attributes':['id',_0x3c01('0x58'),_0x3c01('0xa9')]});}if(_0x47efdf['query'][_0x3c01('0x49')]){_0x2b4881['include']=[{'all':!![]}];}return db[_0x3c01('0x65')]['findAll'](_0x2b4881);})[_0x3c01('0x2c')](function(_0x5c7a9d){_0x3b5f91[_0x3c01('0xa5')]=_0x5c7a9d;return _0x3b5f91;});}})[_0x3c01('0x2c')](respondWithFilteredResult(_0x1e905e,_0x2b4881))[_0x3c01('0x20')](handleError(_0x1e905e,null));};exports['addTags']=function(_0xac8a93,_0x100ae1){return db[_0x3c01('0x37')][_0x3c01('0x4d')]({'where':{'id':_0xac8a93[_0x3c01('0x41')]['id']}})[_0x3c01('0x2c')](handleEntityNotFound(_0x100ae1,null))[_0x3c01('0x2c')](function(_0x37524c){if(_0x37524c){return _0x37524c[_0x3c01('0xaa')](_0xac8a93[_0x3c01('0x32')]['ids'],_[_0x3c01('0xab')](_0xac8a93['body'],['ids','id'])||{})[_0x3c01('0xac')](function(){return db[_0x3c01('0xad')]['findAll']({'attributes':['id',_0x3c01('0x2f'),_0x3c01('0xae')],'where':{'id':_0xac8a93[_0x3c01('0x32')][_0x3c01('0x9a')]}});})[_0x3c01('0x2c')](function(_0x3ccbb5){socket[_0x3c01('0xaf')](_0x3c01('0xb0'),{'id':Number(_0xac8a93[_0x3c01('0x41')]['id']),'tags':_0x3ccbb5||[]});return{'id':Number(_0xac8a93[_0x3c01('0x41')]['id']),'tags':_0x3ccbb5||[]};});}})[_0x3c01('0x2c')](respondWithResult(_0x100ae1,null))[_0x3c01('0x20')](handleError(_0x100ae1,null));};exports[_0x3c01('0xb1')]=function(_0x54f7fa,_0x2dba4d){return db[_0x3c01('0x37')][_0x3c01('0x4d')]({'where':{'id':_0x54f7fa[_0x3c01('0x41')]['id']}})['then'](handleEntityNotFound(_0x2dba4d,null))[_0x3c01('0x2c')](function(_0x3240a7){if(_0x3240a7){return _0x3240a7['removeTags'](_0x54f7fa[_0x3c01('0x3e')]['ids']);}})[_0x3c01('0x2c')](respondWithStatusCode(_0x2dba4d,null))[_0x3c01('0x20')](handleError(_0x2dba4d,null));};exports[_0x3c01('0x7b')]=function(_0xa49e4e,_0x5b404b){var _0x429f7d=moment()[_0x3c01('0xb2')]()[_0x3c01('0xb3')]();var _0x4ebb68=path['join'](config[_0x3c01('0x79')],_0x3c01('0xb4'),'files',_0x3c01('0xb5'));var _0x464346=path['join'](config['root'],_0x3c01('0xb4'),_0x3c01('0xb6'),_0x3c01('0xb7'));var _0x50480e=path['join'](_0x4ebb68,_0x429f7d);var _0x32800f=util[_0x3c01('0x86')](_0x3c01('0xb8'),_0xa49e4e[_0x3c01('0x41')]['id'],_0x429f7d);var _0x592986=path['join'](_0x4ebb68,_0x32800f);var _0x5a063c=[];_0x5a063c[_0x3c01('0xb9')]({'model':db[_0x3c01('0x81')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5a063c['push']({'model':db[_0x3c01('0x69')],'as':_0x3c01('0xba'),'attributes':['id',_0x3c01('0xbb'),'lastName'],'raw':!![]});if(_0xa49e4e[_0x3c01('0x3e')][_0x3c01('0xb7')]){_0x5a063c['push']({'model':db[_0x3c01('0x75')],'as':_0x3c01('0x75'),'raw':!![]});}var _0x2035e1=[{'model':db[_0x3c01('0x65')],'as':_0x3c01('0x80'),'attributes':['id','body','createdAt','direction',_0x3c01('0x8e'),_0x3c01('0xbc')],'include':_0x5a063c}];_0x2035e1[_0x3c01('0xb9')]({'model':db[_0x3c01('0x51')],'as':_0x3c01('0xbd'),'attributes':['id',_0x3c01('0x2f')]});_0x2035e1[_0x3c01('0xb9')]({'model':db[_0x3c01('0x81')],'as':_0x3c01('0xbe'),'attributes':['id','fullname']});return db[_0x3c01('0x37')]['find']({'where':{'id':_0xa49e4e[_0x3c01('0x41')]['id']},'include':_0x2035e1})[_0x3c01('0x2c')](handleEntityNotFound(_0x5b404b,null))[_0x3c01('0x2c')](function(_0x5e7db6){if(_0x5e7db6){var _0x4b3cdc=_0x5e7db6[_0x3c01('0xbf')]({'plain':!![]});fs[_0x3c01('0xc0')](_0x50480e);var _0xe8e2af={'channel':'Chat','account':_0x4b3cdc[_0x3c01('0xbd')]['name'],'agent':_0x4b3cdc[_0x3c01('0xbe')]?_0x4b3cdc['Owner'][_0x3c01('0x58')]:'N.A.','createdAt':moment(_0x4b3cdc[_0x3c01('0xc1')])[_0x3c01('0x86')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3c01('0xb3')](),'closedAt':_0x4b3cdc[_0x3c01('0x6d')]?moment(_0x4b3cdc[_0x3c01('0xc2')])[_0x3c01('0x86')](_0x3c01('0xa3'))[_0x3c01('0xb3')]():'','disposition':_0x4b3cdc[_0x3c01('0x6e')],'chatInfo':{'browser':_0x4b3cdc[_0x3c01('0xc3')],'os':_0x4b3cdc['osName'],'referer':_0x4b3cdc[_0x3c01('0xc4')],'customerIp':_0x4b3cdc[_0x3c01('0xc5')],'customerPort':_0x4b3cdc[_0x3c01('0xc6')]?_0x4b3cdc[_0x3c01('0xc6')]:'N.A.'},'messages':_(_0x4b3cdc[_0x3c01('0x80')])['tail']()[_0x3c01('0xa0')]({'secret':![]})['map'](function(_0x54a50b){if(_0x54a50b['Attachment']){var _0x4a4c68=path[_0x3c01('0x78')](_0x464346,_0x54a50b[_0x3c01('0x75')][_0x3c01('0x71')]);if(fs[_0x3c01('0xc7')](_0x4a4c68)){fs['createReadStream'](_0x4a4c68)['pipe'](fs[_0x3c01('0xc8')](path['join'](_0x50480e,_0x54a50b[_0x3c01('0x75')]['basename'])));}}return{'date':moment(_0x54a50b[_0x3c01('0xc1')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3c01('0xb3')](),'sender':_0x54a50b[_0x3c01('0x8d')]===_0x3c01('0x64')?_0x54a50b[_0x3c01('0x81')]?_0x54a50b[_0x3c01('0x81')][_0x3c01('0x58')]:_0x3c01('0x84'):_0x54a50b[_0x3c01('0xba')][_0x3c01('0xbb')]+(_0x54a50b[_0x3c01('0xba')][_0x3c01('0xc9')]?'\x20'+_0x54a50b['Contact'][_0x3c01('0xc9')]:''),'body':_0x54a50b[_0x3c01('0x75')]?_0x54a50b['Attachment'][_0x3c01('0x71')]:_0x54a50b['body'],'direction':_0x54a50b['direction']===_0x3c01('0x64')?'A':'C','secret':_0x54a50b[_0x3c01('0x8e')],'read':_0x54a50b[_0x3c01('0xbc')],'attachment':_0x54a50b[_0x3c01('0x75')]};})[_0x3c01('0xca')]()};return ejs[_0x3c01('0xcb')](path[_0x3c01('0x78')](config['root'],_0x3c01('0xb4'),_0x3c01('0xcc'),_0x3c01('0xcd')),{'interaction':_0xe8e2af})[_0x3c01('0x2c')](function(_0x152bec){var _0x52a09b=path[_0x3c01('0x78')](_0x50480e,_0x3c01('0xce')+_0x4b3cdc['id']+'-'+_0x429f7d+_0x3c01('0xcf'));var _0x5bd457={'path':_0x52a09b,'channel':_0x3c01('0xd0'),'interactionId':_0x4b3cdc['id']};return pdf[_0x3c01('0xd1')](_0x152bec,_0x5bd457);})[_0x3c01('0x2c')](function(){return new Promise(function(_0x554836,_0x1685f1){zipdir(_0x50480e,{'saveTo':_0x592986},function(_0x215551,_0x491be5){if(_0x215551)return _0x1685f1(_0x215551);return _0x554836(_0x491be5);});})[_0x3c01('0x2c')](function(){return new BPromise(function(_0x56fad1,_0xa7371){rimraf(_0x50480e,function(_0x9ebc12){if(_0x9ebc12)_0xa7371(_0x9ebc12);return _0x56fad1();});});})[_0x3c01('0x2c')](function(){return _0x5b404b['download'](_0x592986,_0x32800f,function(_0x44f2e8){if(_0x44f2e8){logger['error'](_0x3c01('0xd2'),_0x44f2e8);}else{fs[_0x3c01('0xd3')](_0x592986);}});});});}else{return _0x5b404b[_0x3c01('0x21')](0xc8);}})[_0x3c01('0x20')](handleError(_0x5b404b,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 780538b..6a6a700 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 _0x630e=['setMaxListeners','save','remove','getUsers','setDataValue','Users','map','then','emit','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x57510a,_0x63f368){var _0x15200b=function(_0x27d48a){while(--_0x27d48a){_0x57510a['push'](_0x57510a['shift']());}};_0x15200b(++_0x63f368);}(_0x630e,0x1a0));var _0xe630=function(_0x44fa99,_0x2a8f2a){_0x44fa99=_0x44fa99-0x0;var _0x2c4123=_0x630e[_0x44fa99];return _0x2c4123;};'use strict';var EventEmitter=require(_0xe630('0x0'));var ChatInteraction=require(_0xe630('0x1'))['db'][_0xe630('0x2')];var ChatMessage=require(_0xe630('0x1'))['db'][_0xe630('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe630('0x4')](0x0);var events={'afterCreate':_0xe630('0x5'),'afterUpdate':'update','afterDestroy':_0xe630('0x6')};function emitEvent(_0x160a04){return function(_0x6fb47e,_0x759d3c,_0x11b0bc){_0x6fb47e[_0xe630('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3e864c){_0x6fb47e[_0xe630('0x8')](_0xe630('0x9'),_0x3e864c[_0xe630('0xa')](function(_0x1f23c1){return{'id':_0x1f23c1['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x6fb47e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe630('0xb')](function(_0x2a1f05){_0x6fb47e[_0xe630('0x8')]('unreadMessages',_0x2a1f05['length']);ChatInteractionEvents[_0xe630('0xc')](_0x160a04+':'+_0x6fb47e['id'],_0x6fb47e);ChatInteractionEvents[_0xe630('0xc')](_0x160a04,_0x6fb47e);_0x11b0bc(null);})['catch'](_0x11b0bc(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xe630('0xd')](e,emitEvent(event));}}module[_0xe630('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x804e=['update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save'];(function(_0x242ecf,_0xcbeb0){var _0x5c8971=function(_0x234cfd){while(--_0x234cfd){_0x242ecf['push'](_0x242ecf['shift']());}};_0x5c8971(++_0xcbeb0);}(_0x804e,0x79));var _0xe804=function(_0x535bf6,_0x43a5ae){_0x535bf6=_0x535bf6-0x0;var _0x5d764c=_0x804e[_0x535bf6];return _0x5d764c;};'use strict';var EventEmitter=require(_0xe804('0x0'));var ChatInteraction=require(_0xe804('0x1'))['db'][_0xe804('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xe804('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe804('0x4'),'afterUpdate':_0xe804('0x5'),'afterDestroy':_0xe804('0x6')};function emitEvent(_0x19e812){return function(_0x5e52ab,_0x15cbaf,_0xe4d772){_0x5e52ab[_0xe804('0x7')]({'attributes':['id'],'raw':!![]})[_0xe804('0x8')](function(_0x274ce){_0x5e52ab[_0xe804('0x9')](_0xe804('0xa'),_0x274ce[_0xe804('0xb')](function(_0x813e3f){return{'id':_0x813e3f['id']};}));return ChatMessage[_0xe804('0xc')]({'where':{'ChatInteractionId':_0x5e52ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe804('0x8')](function(_0x311139){_0x5e52ab[_0xe804('0x9')]('unreadMessages',_0x311139[_0xe804('0xd')]);ChatInteractionEvents[_0xe804('0xe')](_0x19e812+':'+_0x5e52ab['id'],_0x5e52ab);ChatInteractionEvents[_0xe804('0xe')](_0x19e812,_0x5e52ab);_0xe4d772(null);})[_0xe804('0xf')](_0xe4d772(null));};}for(var e in events){if(events[_0xe804('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xe804('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b0a79c5..0c36e3f 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 _0xe4f6=['changed','closed','format','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions'];(function(_0x49309b,_0x4b048d){var _0x2e6d7e=function(_0x897b09){while(--_0x897b09){_0x49309b['push'](_0x49309b['shift']());}};_0x2e6d7e(++_0x4b048d);}(_0xe4f6,0xb4));var _0x6e4f=function(_0x3cfb9e,_0x103c95){_0x3cfb9e=_0x3cfb9e-0x0;var _0x446856=_0xe4f6[_0x3cfb9e];return _0x446856;};'use strict';var _=require(_0x6e4f('0x0'));var util=require('util');var logger=require(_0x6e4f('0x1'))(_0x6e4f('0x2'));var moment=require('moment');var BPromise=require(_0x6e4f('0x3'));var rp=require(_0x6e4f('0x4'));var fs=require('fs');var path=require(_0x6e4f('0x5'));var rimraf=require(_0x6e4f('0x6'));var config=require(_0x6e4f('0x7'));var attributes=require(_0x6e4f('0x8'));module['exports']=function(_0xdfb230,_0x33db06){return _0xdfb230[_0x6e4f('0x9')](_0x6e4f('0xa'),attributes,{'tableName':_0x6e4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32e3c2,_0x19cdc8,_0x4ac024){if(_0x32e3c2[_0x6e4f('0xc')](_0x6e4f('0xd'))){_0x32e3c2['closedAt']=moment()[_0x6e4f('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4ac024(null,_0x32e3c2);}},'charset':'utf8mb4','collate':_0x6e4f('0xf')});}; \ No newline at end of file +var _0xd7af=['moment','bluebird','request-promise','path','rimraf','define','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util'];(function(_0xaca408,_0x5663b4){var _0x23f079=function(_0x230c77){while(--_0x230c77){_0xaca408['push'](_0xaca408['shift']());}};_0x23f079(++_0x5663b4);}(_0xd7af,0x8a));var _0xfd7a=function(_0x27ddfb,_0x2ae31f){_0x27ddfb=_0x27ddfb-0x0;var _0x3a3efd=_0xd7af[_0x27ddfb];return _0x3a3efd;};'use strict';var _=require(_0xfd7a('0x0'));var util=require(_0xfd7a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfd7a('0x2'));var BPromise=require(_0xfd7a('0x3'));var rp=require(_0xfd7a('0x4'));var fs=require('fs');var path=require(_0xfd7a('0x5'));var rimraf=require(_0xfd7a('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x3bd028,_0x202f29){return _0x3bd028[_0xfd7a('0x7')]('ChatInteraction',attributes,{'tableName':_0xfd7a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x262deb,_0x3ccb31,_0x38e44b){if(_0x262deb[_0xfd7a('0x9')](_0xfd7a('0xa'))){_0x262deb[_0xfd7a('0xb')]=moment()['format'](_0xfd7a('0xc'));}_0x38e44b(null,_0x262deb);}},'charset':'utf8mb4','collate':_0xfd7a('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b271ee2..01002c8 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 _0x8f4c=['ChatInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction'];(function(_0x4f750d,_0x4a9ec4){var _0x3d3d31=function(_0x30fd7a){while(--_0x30fd7a){_0x4f750d['push'](_0x4f750d['shift']());}};_0x3d3d31(++_0x4a9ec4);}(_0x8f4c,0x65));var _0xc8f4=function(_0x2f8b0f,_0x532d7c){_0x2f8b0f=_0x2f8b0f-0x0;var _0x34273d=_0x8f4c[_0x2f8b0f];return _0x34273d;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require('moment');var BPromise=require(_0xc8f4('0x2'));var rs=require(_0xc8f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8f4('0x4'))['db'];var utils=require(_0xc8f4('0x5'));var logger=require(_0xc8f4('0x6'))(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc8f4('0x9')][_0xc8f4('0xa')]({'port':0x232a});config[_0xc8f4('0xb')]=_[_0xc8f4('0xc')](config[_0xc8f4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc8f4('0xd'))(new Redis(config[_0xc8f4('0xb')]));require(_0xc8f4('0xe'))[_0xc8f4('0xf')](socket);function respondWithRpcPromise(_0x38e948,_0x4e9ce1,_0x1af77e){return new BPromise(function(_0x4d4be5,_0x42120e){return client['request'](_0x38e948,_0x1af77e)[_0xc8f4('0x10')](function(_0x54ec06){logger[_0xc8f4('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x4e9ce1,_0xc8f4('0x12'));logger['debug'](_0xc8f4('0x13'),_0x4e9ce1,_0xc8f4('0x12'),JSON[_0xc8f4('0x14')](_0x54ec06));if(_0x54ec06[_0xc8f4('0x15')]){if(_0x54ec06[_0xc8f4('0x15')][_0xc8f4('0x16')]===0x1f4){logger[_0xc8f4('0x15')](_0xc8f4('0x17'),_0x4e9ce1,_0x54ec06[_0xc8f4('0x15')][_0xc8f4('0x18')]);return _0x42120e(_0x54ec06[_0xc8f4('0x15')]['message']);}logger[_0xc8f4('0x15')](_0xc8f4('0x17'),_0x4e9ce1,_0x54ec06[_0xc8f4('0x15')][_0xc8f4('0x18')]);return _0x4d4be5(_0x54ec06[_0xc8f4('0x15')][_0xc8f4('0x18')]);}else{logger[_0xc8f4('0x11')](_0xc8f4('0x17'),_0x4e9ce1,_0xc8f4('0x12'));_0x4d4be5(_0x54ec06[_0xc8f4('0x19')][_0xc8f4('0x18')]);}})[_0xc8f4('0x1a')](function(_0x5be566){logger[_0xc8f4('0x15')](_0xc8f4('0x17'),_0x4e9ce1,_0x5be566);_0x42120e(_0x5be566);});});}exports[_0xc8f4('0x1b')]=function(_0x8595ab){var _0x34edfe=this;return new Promise(function(_0x44a3a7,_0x4f608a){return db[_0xc8f4('0x1c')][_0xc8f4('0x1d')](_0x8595ab[_0xc8f4('0x1e')],{'raw':_0x8595ab[_0xc8f4('0x1f')]?_0x8595ab[_0xc8f4('0x1f')][_0xc8f4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8595ab[_0xc8f4('0x1f')]?_0x8595ab[_0xc8f4('0x1f')]['where']||null:null,'attributes':_0x8595ab[_0xc8f4('0x1f')]?_0x8595ab[_0xc8f4('0x1f')][_0xc8f4('0x21')]||null:null,'limit':_0x8595ab[_0xc8f4('0x1f')]?_0x8595ab['options'][_0xc8f4('0x22')]||null:null})[_0xc8f4('0x10')](function(_0x3a4b73){logger['info'](_0xc8f4('0x1b'),_0x8595ab);logger[_0xc8f4('0x23')](_0xc8f4('0x1b'),_0x8595ab,JSON[_0xc8f4('0x14')](_0x3a4b73));_0x44a3a7(_0x3a4b73);})[_0xc8f4('0x1a')](function(_0x37d60f){logger[_0xc8f4('0x15')](_0xc8f4('0x1b'),_0x37d60f[_0xc8f4('0x18')],_0x8595ab);_0x4f608a(_0x34edfe[_0xc8f4('0x15')](0x1f4,_0x37d60f['message']));});});};exports[_0xc8f4('0x24')]=function(_0x3205a4){return new Promise(function(_0x357cc7,_0x4e9ecc){return db['ChatInteraction'][_0xc8f4('0x25')]({'where':_0x3205a4['options']?_0x3205a4[_0xc8f4('0x1f')]['where']||null:null})[_0xc8f4('0x10')](function(_0x3066f0){if(_0x3066f0){return _0x3066f0[_0xc8f4('0x26')](_0x3205a4[_0xc8f4('0x1e')][_0xc8f4('0x27')],_[_0xc8f4('0x28')](_0x3205a4[_0xc8f4('0x1e')],[_0xc8f4('0x27'),'id'])||{});}})[_0xc8f4('0x29')](function(_0x41a17e){logger[_0xc8f4('0x11')](_0xc8f4('0x2a'),_0x3205a4);logger['debug'](_0xc8f4('0x2a'),_0x3205a4,JSON['stringify'](_0x41a17e));_0x357cc7(_0x41a17e);})[_0xc8f4('0x1a')](function(_0x4af131){logger['error'](_0xc8f4('0x2a'),_0x4af131[_0xc8f4('0x18')],_0x3205a4);_0x4e9ecc(_this[_0xc8f4('0x15')](0x1f4,_0x4af131[_0xc8f4('0x18')]));});});}; \ No newline at end of file +var _0x7060=['request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','ChatInteraction','update','options','raw','where','attributes','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','omit','body','spread','AddTags','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket'];(function(_0x5b366f,_0x46ba68){var _0x536f9b=function(_0x3214c7){while(--_0x3214c7){_0x5b366f['push'](_0x5b366f['shift']());}};_0x536f9b(++_0x46ba68);}(_0x7060,0x1d4));var _0x0706=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7060[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0706('0x0'));var util=require(_0x0706('0x1'));var moment=require('moment');var BPromise=require(_0x0706('0x2'));var rs=require(_0x0706('0x3'));var fs=require('fs');var Redis=require(_0x0706('0x4'));var db=require(_0x0706('0x5'))['db'];var utils=require(_0x0706('0x6'));var logger=require(_0x0706('0x7'))(_0x0706('0x8'));var config=require(_0x0706('0x9'));var jayson=require(_0x0706('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x0706('0xb')]=_[_0x0706('0xc')](config['redis'],{'host':_0x0706('0xd'),'port':0x18eb});var socket=require(_0x0706('0xe'))(new Redis(config[_0x0706('0xb')]));require(_0x0706('0xf'))['register'](socket);function respondWithRpcPromise(_0x1373a4,_0x3031ea,_0x165522){return new BPromise(function(_0x547693,_0x9dde63){return client[_0x0706('0x10')](_0x1373a4,_0x165522)[_0x0706('0x11')](function(_0xdcf7f2){logger[_0x0706('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x3031ea,_0x0706('0x13'));logger[_0x0706('0x14')](_0x0706('0x15'),_0x3031ea,'request\x20sent',JSON['stringify'](_0xdcf7f2));if(_0xdcf7f2[_0x0706('0x16')]){if(_0xdcf7f2['error'][_0x0706('0x17')]===0x1f4){logger['error'](_0x0706('0x18'),_0x3031ea,_0xdcf7f2[_0x0706('0x16')][_0x0706('0x19')]);return _0x9dde63(_0xdcf7f2[_0x0706('0x16')]['message']);}logger[_0x0706('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x3031ea,_0xdcf7f2[_0x0706('0x16')]['message']);return _0x547693(_0xdcf7f2['error'][_0x0706('0x19')]);}else{logger[_0x0706('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x3031ea,_0x0706('0x13'));_0x547693(_0xdcf7f2[_0x0706('0x1a')][_0x0706('0x19')]);}})[_0x0706('0x1b')](function(_0x4b81ec){logger[_0x0706('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x3031ea,_0x4b81ec);_0x9dde63(_0x4b81ec);});});}exports['UpdateChatInteraction']=function(_0xe69205){var _0x507676=this;return new Promise(function(_0x182bec,_0x44eb67){return db[_0x0706('0x1c')][_0x0706('0x1d')](_0xe69205['body'],{'raw':_0xe69205['options']?_0xe69205[_0x0706('0x1e')][_0x0706('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe69205[_0x0706('0x1e')]?_0xe69205[_0x0706('0x1e')][_0x0706('0x20')]||null:null,'attributes':_0xe69205[_0x0706('0x1e')]?_0xe69205[_0x0706('0x1e')][_0x0706('0x21')]||null:null,'limit':_0xe69205[_0x0706('0x1e')]?_0xe69205['options']['limit']||null:null})[_0x0706('0x11')](function(_0x1b2856){logger['info'](_0x0706('0x22'),_0xe69205);logger[_0x0706('0x14')](_0x0706('0x22'),_0xe69205,JSON['stringify'](_0x1b2856));_0x182bec(_0x1b2856);})[_0x0706('0x1b')](function(_0x3cf10b){logger[_0x0706('0x16')](_0x0706('0x22'),_0x3cf10b[_0x0706('0x19')],_0xe69205);_0x44eb67(_0x507676['error'](0x1f4,_0x3cf10b[_0x0706('0x19')]));});});};exports[_0x0706('0x23')]=function(_0x4e0bdf){return new Promise(function(_0x56ab89,_0x48f008){return db['ChatInteraction'][_0x0706('0x24')]({'where':_0x4e0bdf[_0x0706('0x1e')]?_0x4e0bdf[_0x0706('0x1e')]['where']||null:null})[_0x0706('0x11')](function(_0x244deb){if(_0x244deb){return _0x244deb[_0x0706('0x25')](_0x4e0bdf['body'][_0x0706('0x26')],_[_0x0706('0x27')](_0x4e0bdf[_0x0706('0x28')],[_0x0706('0x26'),'id'])||{});}})[_0x0706('0x29')](function(_0x572208){logger[_0x0706('0x12')](_0x0706('0x2a'),_0x4e0bdf);logger['debug'](_0x0706('0x2a'),_0x4e0bdf,JSON[_0x0706('0x2b')](_0x572208));_0x56ab89(_0x572208);})[_0x0706('0x1b')](function(_0x5ac10f){logger[_0x0706('0x16')](_0x0706('0x2a'),_0x5ac10f[_0x0706('0x19')],_0x4e0bdf);_0x48f008(_this[_0x0706('0x16')](0x1f4,_0x5ac10f[_0x0706('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index e08297f..c725530 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 _0xc3a8=['chatInteraction:','./chatInteraction.events','save','remove','emit','register','length'];(function(_0x4f77ab,_0x3bc032){var _0x12d696=function(_0x3dd31c){while(--_0x3dd31c){_0x4f77ab['push'](_0x4f77ab['shift']());}};_0x12d696(++_0x3bc032);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0xc3a8[_0x507403];return _0x1327c;};'use strict';var ChatInteractionEvents=require(_0x8c3a('0x0'));var events=[_0x8c3a('0x1'),_0x8c3a('0x2'),'update'];function createListener(_0x1790e6,_0x5b6a76){return function(_0x3142c7){_0x5b6a76[_0x8c3a('0x3')](_0x1790e6,_0x3142c7);};}function removeListener(_0x3585d1,_0x1d993b){return function(){ChatInteractionEvents['removeListener'](_0x3585d1,_0x1d993b);};}exports[_0x8c3a('0x4')]=function(_0x2477f9){for(var _0x18a92a=0x0,_0x170999=events[_0x8c3a('0x5')];_0x18a92a<_0x170999;_0x18a92a++){var _0x37047e=events[_0x18a92a];var _0x58a9b0=createListener(_0x8c3a('0x6')+_0x37047e,_0x2477f9);ChatInteractionEvents['on'](_0x37047e,_0x58a9b0);}}; \ No newline at end of file +var _0xdb67=['emit','removeListener','register','chatInteraction:','./chatInteraction.events'];(function(_0x4587d6,_0x1d1523){var _0x393d9e=function(_0x3bd6cd){while(--_0x3bd6cd){_0x4587d6['push'](_0x4587d6['shift']());}};_0x393d9e(++_0x1d1523);}(_0xdb67,0x90));var _0x7db6=function(_0x11b764,_0x1ecfe5){_0x11b764=_0x11b764-0x0;var _0x24f0ac=_0xdb67[_0x11b764];return _0x24f0ac;};'use strict';var ChatInteractionEvents=require(_0x7db6('0x0'));var events=['save','remove','update'];function createListener(_0x51d5ef,_0x3b4855){return function(_0x1b9867){_0x3b4855[_0x7db6('0x1')](_0x51d5ef,_0x1b9867);};}function removeListener(_0x5386e0,_0x4b02cb){return function(){ChatInteractionEvents[_0x7db6('0x2')](_0x5386e0,_0x4b02cb);};}exports[_0x7db6('0x3')]=function(_0x114dbd){for(var _0x590232=0x0,_0x59b1f6=events['length'];_0x590232<_0x59b1f6;_0x590232++){var _0x1dc63d=events[_0x590232];var _0x269d7d=createListener(_0x7db6('0x4')+_0x1dc63d,_0x114dbd);ChatInteractionEvents['on'](_0x1dc63d,_0x269d7d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d9f424f..2775ae7 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 _0x6aba=['/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','addMessage','/:id/tags','tracked','chat','addTags','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','/:id','chatinteraction:destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','describe','get','show','/:id/attachment_download','isChatInteractionAuthorized','/:id/messages','getMessages'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0x6aba,0x1ec));var _0xa6ab=function(_0x2794ab,_0x1044b5){_0x2794ab=_0x2794ab-0x0;var _0x3fd145=_0x6aba[_0x2794ab];return _0x3fd145;};'use strict';var multer=require(_0xa6ab('0x0'));var util=require('util');var path=require(_0xa6ab('0x1'));var timeout=require('connect-timeout');var express=require(_0xa6ab('0x2'));var router=express[_0xa6ab('0x3')]();var fs_extra=require(_0xa6ab('0x4'));var auth=require(_0xa6ab('0x5'));var interaction=require(_0xa6ab('0x6'));var config=require(_0xa6ab('0x7'));var controller=require(_0xa6ab('0x8'));router['get']('/',auth[_0xa6ab('0x9')](),controller[_0xa6ab('0xa')]);router['get']('/describe',auth[_0xa6ab('0x9')](),controller[_0xa6ab('0xb')]);router[_0xa6ab('0xc')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0xa6ab('0xd')]);router['get'](_0xa6ab('0xe'),auth[_0xa6ab('0xf')](),controller['attachmentDownload']);router['get'](_0xa6ab('0x10'),auth[_0xa6ab('0x9')](),controller[_0xa6ab('0x11')]);router[_0xa6ab('0xc')](_0xa6ab('0x12'),auth['isChatInteractionAuthorized'](),controller[_0xa6ab('0x13')]);router[_0xa6ab('0xc')](_0xa6ab('0x14'),auth[_0xa6ab('0x9')](),controller[_0xa6ab('0x15')]);router[_0xa6ab('0x16')]('/',auth['isAuthenticated'](),controller[_0xa6ab('0x17')]);router['post'](_0xa6ab('0x18'),auth[_0xa6ab('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xa6ab('0x19')]({'destination':function(_0x89d0fd,_0x387ecc,_0x3741c3){_0x3741c3(null,path[_0xa6ab('0x1a')](config['root'],_0xa6ab('0x1b')));},'filename':function(_0x47ab64,_0x2de710,_0x539a8c){_0x539a8c(null,util[_0xa6ab('0x1c')]('%s-%s',Date[_0xa6ab('0x1d')](),_0x2de710[_0xa6ab('0x1e')][_0xa6ab('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa6ab('0x16')](_0xa6ab('0x20'),upload[_0xa6ab('0x21')]('file'),controller['attachmentUpload']);router[_0xa6ab('0x16')]('/:id/messages',auth[_0xa6ab('0xf')](),controller[_0xa6ab('0x22')]);router['post'](_0xa6ab('0x23'),auth[_0xa6ab('0x9')](),interaction[_0xa6ab('0x24')](_0xa6ab('0x25'),'chatinteraction:addtags'),controller[_0xa6ab('0x26')]);router['put']('/:id',auth[_0xa6ab('0x9')](),interaction['tracked'](_0xa6ab('0x25'),'chatinteraction:update'),controller[_0xa6ab('0x27')]);router[_0xa6ab('0x28')](_0xa6ab('0x29'),controller[_0xa6ab('0x2a')]);router['put'](_0xa6ab('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0xa6ab('0x2c')]);router['put'](_0xa6ab('0x2d'),controller[_0xa6ab('0x2e')]);router[_0xa6ab('0x2f')](_0xa6ab('0x30'),auth[_0xa6ab('0x9')](),interaction[_0xa6ab('0x24')](_0xa6ab('0x25'),_0xa6ab('0x31')),controller['destroy']);router[_0xa6ab('0x2f')](_0xa6ab('0x23'),auth[_0xa6ab('0x9')](),controller['removeTags']);module[_0xa6ab('0x32')]=router; \ No newline at end of file +var _0x8fc5=['getMessages','/:id/my_messages','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','/:id/custom_update','customUpdate','abandon','/:id/close','close','destroy','delete','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages'];(function(_0x2e5167,_0x1cef92){var _0xfd5324=function(_0x1b5427){while(--_0x1b5427){_0x2e5167['push'](_0x2e5167['shift']());}};_0xfd5324(++_0x1cef92);}(_0x8fc5,0xce));var _0x58fc=function(_0x130b53,_0x30924b){_0x130b53=_0x130b53-0x0;var _0x358070=_0x8fc5[_0x130b53];return _0x358070;};'use strict';var multer=require('multer');var util=require(_0x58fc('0x0'));var path=require(_0x58fc('0x1'));var timeout=require(_0x58fc('0x2'));var express=require(_0x58fc('0x3'));var router=express['Router']();var fs_extra=require(_0x58fc('0x4'));var auth=require(_0x58fc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x58fc('0x6'));var controller=require(_0x58fc('0x7'));router[_0x58fc('0x8')]('/',auth[_0x58fc('0x9')](),controller[_0x58fc('0xa')]);router['get'](_0x58fc('0xb'),auth[_0x58fc('0x9')](),controller[_0x58fc('0xc')]);router[_0x58fc('0x8')]('/:id',auth[_0x58fc('0xd')](),controller[_0x58fc('0xe')]);router['get'](_0x58fc('0xf'),auth[_0x58fc('0xd')](),controller[_0x58fc('0x10')]);router[_0x58fc('0x8')](_0x58fc('0x11'),auth[_0x58fc('0x9')](),controller[_0x58fc('0x12')]);router[_0x58fc('0x8')](_0x58fc('0x13'),auth[_0x58fc('0xd')](),controller[_0x58fc('0x14')]);router[_0x58fc('0x8')](_0x58fc('0x15'),auth[_0x58fc('0x9')](),controller['download']);router[_0x58fc('0x16')]('/',auth[_0x58fc('0x9')](),controller['create']);router[_0x58fc('0x16')](_0x58fc('0x17'),auth[_0x58fc('0x9')](),controller[_0x58fc('0x18')]);var upload=multer({'storage':multer[_0x58fc('0x19')]({'destination':function(_0x33a7b8,_0x17ff5f,_0x1e4170){_0x1e4170(null,path[_0x58fc('0x1a')](config[_0x58fc('0x1b')],_0x58fc('0x1c')));},'filename':function(_0x1e85f1,_0x1f2711,_0x2febae){_0x2febae(null,util[_0x58fc('0x1d')](_0x58fc('0x1e'),Date[_0x58fc('0x1f')](),_0x1f2711[_0x58fc('0x20')][_0x58fc('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x58fc('0x16')](_0x58fc('0x22'),upload[_0x58fc('0x23')](_0x58fc('0x24')),controller[_0x58fc('0x25')]);router['post'](_0x58fc('0x11'),auth[_0x58fc('0xd')](),controller[_0x58fc('0x26')]);router[_0x58fc('0x16')](_0x58fc('0x27'),auth[_0x58fc('0x9')](),interaction[_0x58fc('0x28')](_0x58fc('0x29'),_0x58fc('0x2a')),controller[_0x58fc('0x2b')]);router[_0x58fc('0x2c')](_0x58fc('0x2d'),auth[_0x58fc('0x9')](),interaction[_0x58fc('0x28')](_0x58fc('0x29'),_0x58fc('0x2e')),controller['update']);router['put'](_0x58fc('0x2f'),controller[_0x58fc('0x30')]);router[_0x58fc('0x2c')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x58fc('0x31')]);router[_0x58fc('0x2c')](_0x58fc('0x32'),controller[_0x58fc('0x33')]);router['delete'](_0x58fc('0x2d'),auth[_0x58fc('0x9')](),interaction['tracked'](_0x58fc('0x29'),'chatinteraction:destroy'),controller[_0x58fc('0x34')]);router[_0x58fc('0x35')](_0x58fc('0x27'),auth[_0x58fc('0x9')](),controller[_0x58fc('0x36')]);module[_0x58fc('0x37')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 0a8d861..7214b21 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 _0x5066=['BOOLEAN','INTEGER','exports','TEXT','medium'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x5066,0x98));var _0x6506=function(_0xe1bdfa,_0x5371ce){_0xe1bdfa=_0xe1bdfa-0x0;var _0x28daee=_0x5066[_0xe1bdfa];return _0x28daee;};'use strict';var Sequelize=require('sequelize');module[_0x6506('0x0')]={'body':{'type':Sequelize[_0x6506('0x1')](_0x6506('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6506('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6506('0x4')]}}; \ No newline at end of file +var _0xe493=['sequelize','exports','medium','BOOLEAN'];(function(_0x2b53d0,_0x46dfb4){var _0x5b59d9=function(_0x1bfff4){while(--_0x1bfff4){_0x2b53d0['push'](_0x2b53d0['shift']());}};_0x5b59d9(++_0x46dfb4);}(_0xe493,0x158));var _0x3e49=function(_0x2feb4c,_0x488e1f){_0x2feb4c=_0x2feb4c-0x0;var _0x594db6=_0xe493[_0x2feb4c];return _0x594db6;};'use strict';var Sequelize=require(_0x3e49('0x0'));module[_0x3e49('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3e49('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3e49('0x3')],'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 9400014..1d60282 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 _0xea20=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','ChatInternalMessage','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','then','rows','catch','show','keys','rawAttributes','find','create','body','params','describe','get','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','fullname','role','internal','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','push','createdAt','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xea20,0x144));var _0x0ea2=function(_0x5e67f1,_0x18774c){_0x5e67f1=_0x5e67f1-0x0;var _0x567754=_0xea20[_0x5e67f1];return _0x567754;};'use strict';var emlformat=require(_0x0ea2('0x0'));var rimraf=require(_0x0ea2('0x1'));var zipdir=require(_0x0ea2('0x2'));var jsonpatch=require(_0x0ea2('0x3'));var rp=require(_0x0ea2('0x4'));var moment=require(_0x0ea2('0x5'));var BPromise=require(_0x0ea2('0x6'));var Mustache=require(_0x0ea2('0x7'));var util=require(_0x0ea2('0x8'));var path=require(_0x0ea2('0x9'));var sox=require(_0x0ea2('0xa'));var csv=require(_0x0ea2('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ea2('0xc'));var squel=require(_0x0ea2('0xd'));var crypto=require(_0x0ea2('0xe'));var jsforce=require(_0x0ea2('0xf'));var deskjs=require(_0x0ea2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0ea2('0x11'));var Papa=require(_0x0ea2('0x12'));var Redis=require(_0x0ea2('0x13'));var authService=require(_0x0ea2('0x14'));var qs=require(_0x0ea2('0x15'));var as=require(_0x0ea2('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0ea2('0x17'));var licenseUtil=require(_0x0ea2('0x18'));var db=require(_0x0ea2('0x19'))['db'];config[_0x0ea2('0x1a')]=_[_0x0ea2('0x1b')](config[_0x0ea2('0x1a')],{'host':_0x0ea2('0x1c'),'port':0x18eb});var socket=require(_0x0ea2('0x1d'))(new Redis(config[_0x0ea2('0x1a')]));require(_0x0ea2('0x1e'))[_0x0ea2('0x1f')](socket);function respondWithStatusCode(_0x58e075,_0x3788aa){_0x3788aa=_0x3788aa||0xcc;return function(_0x1971d9){if(_0x1971d9){return _0x58e075[_0x0ea2('0x20')](_0x3788aa);}return _0x58e075[_0x0ea2('0x21')](_0x3788aa)[_0x0ea2('0x22')]();};}function respondWithResult(_0x3729e5,_0x560d79){_0x560d79=_0x560d79||0xc8;return function(_0x187a31){if(_0x187a31){return _0x3729e5[_0x0ea2('0x21')](_0x560d79)[_0x0ea2('0x23')](_0x187a31);}};}function respondWithFilteredResult(_0x1dc811,_0x3c0292){return function(_0x2ee782){if(_0x2ee782){var _0x328cc1=typeof _0x3c0292['offset']==='undefined'&&typeof _0x3c0292[_0x0ea2('0x24')]===_0x0ea2('0x25');var _0x2aa570=_0x2ee782[_0x0ea2('0x26')];var _0x452535=_0x328cc1?0x0:_0x3c0292[_0x0ea2('0x27')];var _0x2dcc87=_0x328cc1?_0x2ee782['count']:_0x3c0292['offset']+_0x3c0292['limit'];var _0x493747;if(_0x2dcc87>=_0x2aa570){_0x2dcc87=_0x2aa570;_0x493747=0xc8;}else{_0x493747=0xce;}_0x1dc811[_0x0ea2('0x21')](_0x493747);return _0x1dc811[_0x0ea2('0x28')](_0x0ea2('0x29'),_0x452535+'-'+_0x2dcc87+'/'+_0x2aa570)[_0x0ea2('0x23')](_0x2ee782);}return null;};}function patchUpdates(_0x396725){return function(_0x3fd1d0){try{jsonpatch[_0x0ea2('0x2a')](_0x3fd1d0,_0x396725,!![]);}catch(_0x30a63f){return BPromise[_0x0ea2('0x2b')](_0x30a63f);}return _0x3fd1d0[_0x0ea2('0x2c')]();};}function saveUpdates(_0xf96111,_0x521e99){return function(_0x30cbb8){if(_0x30cbb8){return _0x30cbb8[_0x0ea2('0x2d')](_0xf96111)['then'](function(_0x4c94fa){return _0x4c94fa;});}return null;};}function removeEntity(_0x11b1e7,_0x195b6){return function(_0x71381f){if(_0x71381f){return _0x71381f[_0x0ea2('0x2e')]()['then'](function(){_0x11b1e7[_0x0ea2('0x21')](0xcc)[_0x0ea2('0x22')]();});}};}function handleEntityNotFound(_0x1ca167,_0x3c8cf3){return function(_0xdccb9a){if(!_0xdccb9a){_0x1ca167[_0x0ea2('0x20')](0x194);}return _0xdccb9a;};}function handleError(_0x53c905,_0x4b28a5){_0x4b28a5=_0x4b28a5||0x1f4;return function(_0x2dcbad){logger[_0x0ea2('0x2f')](_0x2dcbad[_0x0ea2('0x30')]);if(_0x2dcbad['name']){delete _0x2dcbad[_0x0ea2('0x31')];}_0x53c905[_0x0ea2('0x21')](_0x4b28a5)[_0x0ea2('0x32')](_0x2dcbad);};}exports['index']=function(_0x4d592f,_0x1bc6a6){var _0x2d6dd1={},_0x31d504={},_0x140997={'count':0x0,'rows':[]};var _0x9d5040=_['map'](db[_0x0ea2('0x33')]['rawAttributes'],function(_0x207f6f){return{'name':_0x207f6f[_0x0ea2('0x34')],'type':_0x207f6f['type'][_0x0ea2('0x35')]};});_0x31d504[_0x0ea2('0x36')]=_[_0x0ea2('0x37')](_0x9d5040,_0x0ea2('0x31'));_0x31d504[_0x0ea2('0x38')]=_['keys'](_0x4d592f[_0x0ea2('0x38')]);_0x31d504[_0x0ea2('0x39')]=_[_0x0ea2('0x3a')](_0x31d504[_0x0ea2('0x36')],_0x31d504[_0x0ea2('0x38')]);_0x2d6dd1[_0x0ea2('0x3b')]=_['intersection'](_0x31d504[_0x0ea2('0x36')],qs['fields'](_0x4d592f[_0x0ea2('0x38')][_0x0ea2('0x3c')]));_0x2d6dd1[_0x0ea2('0x3b')]=_0x2d6dd1['attributes'][_0x0ea2('0x3d')]?_0x2d6dd1['attributes']:_0x31d504[_0x0ea2('0x36')];if(!_0x4d592f[_0x0ea2('0x38')][_0x0ea2('0x3e')](_0x0ea2('0x3f'))){_0x2d6dd1[_0x0ea2('0x24')]=qs[_0x0ea2('0x24')](_0x4d592f[_0x0ea2('0x38')][_0x0ea2('0x24')]);_0x2d6dd1[_0x0ea2('0x27')]=qs[_0x0ea2('0x27')](_0x4d592f[_0x0ea2('0x38')][_0x0ea2('0x27')]);}_0x2d6dd1[_0x0ea2('0x40')]=qs[_0x0ea2('0x41')](_0x4d592f[_0x0ea2('0x38')][_0x0ea2('0x41')]);_0x2d6dd1[_0x0ea2('0x42')]=qs[_0x0ea2('0x39')](_[_0x0ea2('0x43')](_0x4d592f[_0x0ea2('0x38')],_0x31d504[_0x0ea2('0x39')]),_0x9d5040);if(_0x4d592f[_0x0ea2('0x38')]['filter']){_0x2d6dd1[_0x0ea2('0x42')]=_[_0x0ea2('0x44')](_0x2d6dd1[_0x0ea2('0x42')],{'$or':_['map'](_0x9d5040,function(_0x2cfd55){if(_0x2cfd55[_0x0ea2('0x45')]!==_0x0ea2('0x46')){var _0x192178={};_0x192178[_0x2cfd55[_0x0ea2('0x31')]]={'$like':'%'+_0x4d592f[_0x0ea2('0x38')][_0x0ea2('0x47')]+'%'};return _0x192178;}})});}_0x2d6dd1=_[_0x0ea2('0x44')]({},_0x2d6dd1,_0x4d592f['options']);var _0x2377f2={'where':_0x2d6dd1['where']};return db['ChatInternalMessage'][_0x0ea2('0x26')](_0x2377f2)['then'](function(_0x13b45e){_0x140997['count']=_0x13b45e;if(_0x4d592f[_0x0ea2('0x38')][_0x0ea2('0x48')]){_0x2d6dd1[_0x0ea2('0x49')]=[{'all':!![]}];}return db[_0x0ea2('0x33')][_0x0ea2('0x4a')](_0x2d6dd1);})[_0x0ea2('0x4b')](function(_0xd6a58d){_0x140997[_0x0ea2('0x4c')]=_0xd6a58d;return _0x140997;})[_0x0ea2('0x4b')](respondWithFilteredResult(_0x1bc6a6,_0x2d6dd1))[_0x0ea2('0x4d')](handleError(_0x1bc6a6,null));};exports[_0x0ea2('0x4e')]=function(_0x406a1d,_0x43313a){var _0x23c530={'raw':!![],'where':{'id':_0x406a1d['params']['id']}},_0x379705={};_0x379705[_0x0ea2('0x36')]=_[_0x0ea2('0x4f')](db[_0x0ea2('0x33')][_0x0ea2('0x50')]);_0x379705[_0x0ea2('0x38')]=_[_0x0ea2('0x4f')](_0x406a1d[_0x0ea2('0x38')]);_0x379705[_0x0ea2('0x39')]=_[_0x0ea2('0x3a')](_0x379705['model'],_0x379705['query']);_0x23c530['attributes']=_['intersection'](_0x379705[_0x0ea2('0x36')],qs[_0x0ea2('0x3c')](_0x406a1d[_0x0ea2('0x38')]['fields']));_0x23c530[_0x0ea2('0x3b')]=_0x23c530[_0x0ea2('0x3b')][_0x0ea2('0x3d')]?_0x23c530[_0x0ea2('0x3b')]:_0x379705[_0x0ea2('0x36')];if(_0x406a1d[_0x0ea2('0x38')][_0x0ea2('0x48')]){_0x23c530['include']=[{'all':!![]}];}_0x23c530=_[_0x0ea2('0x44')]({},_0x23c530,_0x406a1d['options']);return db[_0x0ea2('0x33')][_0x0ea2('0x51')](_0x23c530)[_0x0ea2('0x4b')](handleEntityNotFound(_0x43313a,null))[_0x0ea2('0x4b')](respondWithResult(_0x43313a,null))['catch'](handleError(_0x43313a,null));};exports['create']=function(_0x2207d7,_0x3716fb){return db[_0x0ea2('0x33')][_0x0ea2('0x52')](_0x2207d7['body'],{})[_0x0ea2('0x4b')](respondWithResult(_0x3716fb,0xc9))['catch'](handleError(_0x3716fb,null));};exports[_0x0ea2('0x2d')]=function(_0x25bf84,_0x43ebca){if(_0x25bf84['body']['id']){delete _0x25bf84[_0x0ea2('0x53')]['id'];}return db[_0x0ea2('0x33')][_0x0ea2('0x51')]({'where':{'id':_0x25bf84[_0x0ea2('0x54')]['id']}})[_0x0ea2('0x4b')](handleEntityNotFound(_0x43ebca,null))[_0x0ea2('0x4b')](saveUpdates(_0x25bf84[_0x0ea2('0x53')],null))[_0x0ea2('0x4b')](respondWithResult(_0x43ebca,null))[_0x0ea2('0x4d')](handleError(_0x43ebca,null));};exports[_0x0ea2('0x2e')]=function(_0x46092d,_0x2141c6){return db[_0x0ea2('0x33')][_0x0ea2('0x51')]({'where':{'id':_0x46092d['params']['id']}})[_0x0ea2('0x4b')](handleEntityNotFound(_0x2141c6,null))[_0x0ea2('0x4b')](removeEntity(_0x2141c6,null))[_0x0ea2('0x4d')](handleError(_0x2141c6,null));};exports[_0x0ea2('0x55')]=function(_0x190fcf,_0x42fe90){return db[_0x0ea2('0x33')]['describe']()['then'](respondWithResult(_0x42fe90,null))[_0x0ea2('0x4d')](handleError(_0x42fe90,null));};function wrapUser(_0x1ded64){return function(_0x377170){var _0x1cd381=_0x1ded64[_0x0ea2('0x56')]({'plain':!![]});_0x1cd381[_0x0ea2('0x57')]=[];if(_0x377170){_0x1cd381[_0x0ea2('0x58')]=_0x377170['createdAt'];_0x1cd381[_0x0ea2('0x59')]=_0x377170;}else{_0x1cd381[_0x0ea2('0x58')]=moment(0x0)['format'](_0x0ea2('0x5a'));_0x1cd381[_0x0ea2('0x59')]={};}return _0x1cd381;};}exports['getUsers']=function(_0x96e8c2,_0x40921d,_0x1a2b25){var _0x48e72a=[];return db[_0x0ea2('0x5b')][_0x0ea2('0x4a')]({'where':{'role':[_0x0ea2('0x5c'),_0x0ea2('0x5d'),'user']},'attributes':['id',_0x0ea2('0x5e'),_0x0ea2('0x31'),_0x0ea2('0x5f'),'userpic',_0x0ea2('0x60'),'online',_0x0ea2('0x61'),_0x0ea2('0x62'),'showWebBar'],'order':qs[_0x0ea2('0x41')](_0x0ea2('0x63')),'include':[{'model':db[_0x0ea2('0x64')],'as':_0x0ea2('0x65'),'attributes':['id','name',_0x0ea2('0x45')],'through':{'attributes':[]}}]})['then'](function(_0x5e1005){if(_0x5e1005){var _0x34d9b6=_0x96e8c2['user'][_0x0ea2('0x56')]({'plain':!![]});if(!_0x34d9b6)throw new Error(_0x0ea2('0x66'));if(_0x34d9b6[_0x0ea2('0x5f')]===_0x0ea2('0x67')){return db[_0x0ea2('0x68')]['find']({'where':{'name':_0x0ea2('0x69'),'userProfileId':_0x34d9b6['userProfileId']},'raw':!![]})[_0x0ea2('0x4b')](function(_0x300271){if(_0x300271){if(_0x300271[_0x0ea2('0x6a')]===0x0){return db[_0x0ea2('0x6b')][_0x0ea2('0x4a')]({'where':{'sectionId':_0x300271['id']},'raw':!![]})['then'](function(_0x5aad87){var _0x4f134d=[];if(_[_0x0ea2('0x6c')](_0x5aad87)){_0x4f134d=_[_0x0ea2('0x47')](_0x5e1005,function(_0x2c6621){if(_0x2c6621[_0x0ea2('0x5f')]!==_0x0ea2('0x5c')){return _0x2c6621;}});return _0x4f134d;}else{for(var _0x8b8a35=0x0;_0x8b8a35<_0x5e1005[_0x0ea2('0x3d')];_0x8b8a35++){var _0x634b17=_0x5e1005[_0x8b8a35];if(_0x634b17[_0x0ea2('0x5f')]===_0x0ea2('0x5c')){var _0x559ae3=_['find'](_0x5aad87,function(_0x15f88b){return _0x15f88b['resourceId']===_0x634b17['id'];});if(_0x559ae3)_0x4f134d[_0x0ea2('0x6d')](_0x634b17);}else{_0x4f134d[_0x0ea2('0x6d')](_0x634b17);}}return _0x4f134d;}});}else{return _0x5e1005;}}else{var _0x516117=_[_0x0ea2('0x47')](_0x5e1005,function(_0x58462a){if(_0x58462a['role']!==_0x0ea2('0x5c')){return _0x58462a;}});return _0x516117;}});}else{return _0x5e1005;}}})['then'](function(_0x5eb9fb){var _0x7c4ac8=[];if(_0x5eb9fb){_0x48e72a=_0x5eb9fb;for(var _0x216690=0x0;_0x216690<_0x5eb9fb['length'];_0x216690+=0x1){_0x48e72a[_0x216690][_0x0ea2('0x57')]=[];_0x7c4ac8[_0x0ea2('0x6d')](db[_0x0ea2('0x33')][_0x0ea2('0x51')]({'where':{'FromId':[_0x96e8c2[_0x0ea2('0x67')]['id'],_0x5eb9fb[_0x216690]['id']],'ToId':[_0x96e8c2['user']['id'],_0x5eb9fb[_0x216690]['id']],'ChatGroupId':null},'attributes':['id',_0x0ea2('0x6e'),_0x0ea2('0x6f'),_0x0ea2('0x70'),_0x0ea2('0x71'),_0x0ea2('0x53')],'order':qs[_0x0ea2('0x41')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0ea2('0x4b')](wrapUser(_0x5eb9fb[_0x216690])));}return BPromise[_0x0ea2('0x72')](_0x7c4ac8);}return[];})['then'](function(_0x4b9592){return{'rows':_0x4b9592,'count':_0x4b9592['length']};})[_0x0ea2('0x4b')](respondWithResult(_0x40921d,null))['catch'](handleError(_0x40921d,null));}; \ No newline at end of file +var _0xc406=['FromId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','end','error','name','send','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','rows','catch','show','params','intersection','includeAll','find','create','body','describe','get','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','findAll','admin','user','fullname','role','internal','allowmessenger','showWebBar','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc406,0xd0));var _0x6c40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc406[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c40('0x0'));var zipdir=require(_0x6c40('0x1'));var jsonpatch=require(_0x6c40('0x2'));var rp=require(_0x6c40('0x3'));var moment=require(_0x6c40('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c40('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6c40('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c40('0x7'));var _=require(_0x6c40('0x8'));var squel=require(_0x6c40('0x9'));var crypto=require(_0x6c40('0xa'));var jsforce=require(_0x6c40('0xb'));var deskjs=require(_0x6c40('0xc'));var toCsv=require(_0x6c40('0x6'));var querystring=require('querystring');var Papa=require(_0x6c40('0xd'));var Redis=require(_0x6c40('0xe'));var authService=require(_0x6c40('0xf'));var qs=require(_0x6c40('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6c40('0x11'));var config=require(_0x6c40('0x12'));var licenseUtil=require(_0x6c40('0x13'));var db=require('../../mysqldb')['db'];config[_0x6c40('0x14')]=_['defaults'](config['redis'],{'host':_0x6c40('0x15'),'port':0x18eb});var socket=require(_0x6c40('0x16'))(new Redis(config['redis']));require(_0x6c40('0x17'))[_0x6c40('0x18')](socket);function respondWithStatusCode(_0x40f170,_0x4776ad){_0x4776ad=_0x4776ad||0xcc;return function(_0x1fe556){if(_0x1fe556){return _0x40f170[_0x6c40('0x19')](_0x4776ad);}return _0x40f170[_0x6c40('0x1a')](_0x4776ad)['end']();};}function respondWithResult(_0x360cb8,_0x13327b){_0x13327b=_0x13327b||0xc8;return function(_0x559ba4){if(_0x559ba4){return _0x360cb8[_0x6c40('0x1a')](_0x13327b)[_0x6c40('0x1b')](_0x559ba4);}};}function respondWithFilteredResult(_0xdec5d7,_0x254425){return function(_0x421372){if(_0x421372){var _0x1122d7=typeof _0x254425[_0x6c40('0x1c')]===_0x6c40('0x1d')&&typeof _0x254425[_0x6c40('0x1e')]===_0x6c40('0x1d');var _0x32a7ea=_0x421372[_0x6c40('0x1f')];var _0x1ae4fc=_0x1122d7?0x0:_0x254425[_0x6c40('0x1c')];var _0x3d855=_0x1122d7?_0x421372[_0x6c40('0x1f')]:_0x254425[_0x6c40('0x1c')]+_0x254425[_0x6c40('0x1e')];var _0x414104;if(_0x3d855>=_0x32a7ea){_0x3d855=_0x32a7ea;_0x414104=0xc8;}else{_0x414104=0xce;}_0xdec5d7[_0x6c40('0x1a')](_0x414104);return _0xdec5d7['set'](_0x6c40('0x20'),_0x1ae4fc+'-'+_0x3d855+'/'+_0x32a7ea)[_0x6c40('0x1b')](_0x421372);}return null;};}function patchUpdates(_0x5aa342){return function(_0x293dfa){try{jsonpatch['apply'](_0x293dfa,_0x5aa342,!![]);}catch(_0x2f8549){return BPromise[_0x6c40('0x21')](_0x2f8549);}return _0x293dfa[_0x6c40('0x22')]();};}function saveUpdates(_0x2397d5,_0x36bd21){return function(_0x48bc5c){if(_0x48bc5c){return _0x48bc5c['update'](_0x2397d5)[_0x6c40('0x23')](function(_0x16700c){return _0x16700c;});}return null;};}function removeEntity(_0x2bc969,_0x74427){return function(_0x1ccb84){if(_0x1ccb84){return _0x1ccb84[_0x6c40('0x24')]()['then'](function(){_0x2bc969[_0x6c40('0x1a')](0xcc)[_0x6c40('0x25')]();});}};}function handleEntityNotFound(_0x4fa07a,_0x2c9a06){return function(_0x3187f6){if(!_0x3187f6){_0x4fa07a[_0x6c40('0x19')](0x194);}return _0x3187f6;};}function handleError(_0x561e86,_0x34fecb){_0x34fecb=_0x34fecb||0x1f4;return function(_0xabf85a){logger[_0x6c40('0x26')](_0xabf85a['stack']);if(_0xabf85a[_0x6c40('0x27')]){delete _0xabf85a['name'];}_0x561e86[_0x6c40('0x1a')](_0x34fecb)[_0x6c40('0x28')](_0xabf85a);};}exports['index']=function(_0x4d0b27,_0x54db30){var _0x3ad78b={},_0x5204e3={},_0x53cda7={'count':0x0,'rows':[]};var _0x1d6775=_[_0x6c40('0x29')](db[_0x6c40('0x2a')][_0x6c40('0x2b')],function(_0x520a38){return{'name':_0x520a38[_0x6c40('0x2c')],'type':_0x520a38['type'][_0x6c40('0x2d')]};});_0x5204e3[_0x6c40('0x2e')]=_[_0x6c40('0x29')](_0x1d6775,_0x6c40('0x27'));_0x5204e3[_0x6c40('0x2f')]=_[_0x6c40('0x30')](_0x4d0b27[_0x6c40('0x2f')]);_0x5204e3['filters']=_['intersection'](_0x5204e3['model'],_0x5204e3[_0x6c40('0x2f')]);_0x3ad78b[_0x6c40('0x31')]=_['intersection'](_0x5204e3[_0x6c40('0x2e')],qs['fields'](_0x4d0b27[_0x6c40('0x2f')][_0x6c40('0x32')]));_0x3ad78b[_0x6c40('0x31')]=_0x3ad78b[_0x6c40('0x31')][_0x6c40('0x33')]?_0x3ad78b['attributes']:_0x5204e3[_0x6c40('0x2e')];if(!_0x4d0b27['query']['hasOwnProperty']('nolimit')){_0x3ad78b[_0x6c40('0x1e')]=qs[_0x6c40('0x1e')](_0x4d0b27['query']['limit']);_0x3ad78b[_0x6c40('0x1c')]=qs[_0x6c40('0x1c')](_0x4d0b27['query']['offset']);}_0x3ad78b[_0x6c40('0x34')]=qs[_0x6c40('0x35')](_0x4d0b27[_0x6c40('0x2f')]['sort']);_0x3ad78b['where']=qs[_0x6c40('0x36')](_[_0x6c40('0x37')](_0x4d0b27[_0x6c40('0x2f')],_0x5204e3[_0x6c40('0x36')]),_0x1d6775);if(_0x4d0b27['query'][_0x6c40('0x38')]){_0x3ad78b[_0x6c40('0x39')]=_[_0x6c40('0x3a')](_0x3ad78b[_0x6c40('0x39')],{'$or':_[_0x6c40('0x29')](_0x1d6775,function(_0x2e2833){if(_0x2e2833[_0x6c40('0x3b')]!==_0x6c40('0x3c')){var _0x1c0162={};_0x1c0162[_0x2e2833['name']]={'$like':'%'+_0x4d0b27['query'][_0x6c40('0x38')]+'%'};return _0x1c0162;}})});}_0x3ad78b=_[_0x6c40('0x3a')]({},_0x3ad78b,_0x4d0b27[_0x6c40('0x3d')]);var _0x44e80e={'where':_0x3ad78b['where']};return db['ChatInternalMessage'][_0x6c40('0x1f')](_0x44e80e)[_0x6c40('0x23')](function(_0x480f32){_0x53cda7[_0x6c40('0x1f')]=_0x480f32;if(_0x4d0b27[_0x6c40('0x2f')]['includeAll']){_0x3ad78b[_0x6c40('0x3e')]=[{'all':!![]}];}return db[_0x6c40('0x2a')]['findAll'](_0x3ad78b);})[_0x6c40('0x23')](function(_0x15476b){_0x53cda7[_0x6c40('0x3f')]=_0x15476b;return _0x53cda7;})[_0x6c40('0x23')](respondWithFilteredResult(_0x54db30,_0x3ad78b))[_0x6c40('0x40')](handleError(_0x54db30,null));};exports[_0x6c40('0x41')]=function(_0x163d4f,_0x4cf967){var _0x40e4a5={'raw':!![],'where':{'id':_0x163d4f[_0x6c40('0x42')]['id']}},_0x4b703d={};_0x4b703d[_0x6c40('0x2e')]=_[_0x6c40('0x30')](db[_0x6c40('0x2a')][_0x6c40('0x2b')]);_0x4b703d[_0x6c40('0x2f')]=_[_0x6c40('0x30')](_0x163d4f[_0x6c40('0x2f')]);_0x4b703d['filters']=_[_0x6c40('0x43')](_0x4b703d[_0x6c40('0x2e')],_0x4b703d[_0x6c40('0x2f')]);_0x40e4a5[_0x6c40('0x31')]=_[_0x6c40('0x43')](_0x4b703d[_0x6c40('0x2e')],qs[_0x6c40('0x32')](_0x163d4f[_0x6c40('0x2f')]['fields']));_0x40e4a5[_0x6c40('0x31')]=_0x40e4a5[_0x6c40('0x31')][_0x6c40('0x33')]?_0x40e4a5[_0x6c40('0x31')]:_0x4b703d[_0x6c40('0x2e')];if(_0x163d4f[_0x6c40('0x2f')][_0x6c40('0x44')]){_0x40e4a5[_0x6c40('0x3e')]=[{'all':!![]}];}_0x40e4a5=_[_0x6c40('0x3a')]({},_0x40e4a5,_0x163d4f[_0x6c40('0x3d')]);return db[_0x6c40('0x2a')][_0x6c40('0x45')](_0x40e4a5)[_0x6c40('0x23')](handleEntityNotFound(_0x4cf967,null))[_0x6c40('0x23')](respondWithResult(_0x4cf967,null))[_0x6c40('0x40')](handleError(_0x4cf967,null));};exports[_0x6c40('0x46')]=function(_0x2614b3,_0x2cd259){return db['ChatInternalMessage'][_0x6c40('0x46')](_0x2614b3['body'],{})['then'](respondWithResult(_0x2cd259,0xc9))[_0x6c40('0x40')](handleError(_0x2cd259,null));};exports['update']=function(_0x4b38e3,_0x1a8ff8){if(_0x4b38e3['body']['id']){delete _0x4b38e3[_0x6c40('0x47')]['id'];}return db[_0x6c40('0x2a')][_0x6c40('0x45')]({'where':{'id':_0x4b38e3[_0x6c40('0x42')]['id']}})[_0x6c40('0x23')](handleEntityNotFound(_0x1a8ff8,null))['then'](saveUpdates(_0x4b38e3[_0x6c40('0x47')],null))[_0x6c40('0x23')](respondWithResult(_0x1a8ff8,null))['catch'](handleError(_0x1a8ff8,null));};exports['destroy']=function(_0x41f669,_0x53521e){return db[_0x6c40('0x2a')][_0x6c40('0x45')]({'where':{'id':_0x41f669['params']['id']}})[_0x6c40('0x23')](handleEntityNotFound(_0x53521e,null))[_0x6c40('0x23')](removeEntity(_0x53521e,null))[_0x6c40('0x40')](handleError(_0x53521e,null));};exports[_0x6c40('0x48')]=function(_0x22c132,_0x4ddbc6){return db[_0x6c40('0x2a')][_0x6c40('0x48')]()[_0x6c40('0x23')](respondWithResult(_0x4ddbc6,null))[_0x6c40('0x40')](handleError(_0x4ddbc6,null));};function wrapUser(_0xd06380){return function(_0x410201){var _0x390339=_0xd06380[_0x6c40('0x49')]({'plain':!![]});_0x390339[_0x6c40('0x4a')]=[];if(_0x410201){_0x390339[_0x6c40('0x4b')]=_0x410201[_0x6c40('0x4c')];_0x390339['lastMessage']=_0x410201;}else{_0x390339[_0x6c40('0x4b')]=moment(0x0)[_0x6c40('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x390339[_0x6c40('0x4e')]={};}return _0x390339;};}exports[_0x6c40('0x4f')]=function(_0x20e3a9,_0x424d08,_0x4bda57){var _0x1f3d01=[];return db[_0x6c40('0x50')][_0x6c40('0x51')]({'where':{'role':['agent',_0x6c40('0x52'),_0x6c40('0x53')]},'attributes':['id',_0x6c40('0x54'),_0x6c40('0x27'),_0x6c40('0x55'),'userpic',_0x6c40('0x56'),'online','lastLoginAt',_0x6c40('0x57'),_0x6c40('0x58')],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x6c40('0x59'),'attributes':['id',_0x6c40('0x27'),_0x6c40('0x3b')],'through':{'attributes':[]}}]})[_0x6c40('0x23')](function(_0x43a830){if(_0x43a830){var _0x3eb26b=_0x20e3a9['user'][_0x6c40('0x49')]({'plain':!![]});if(!_0x3eb26b)throw new Error(_0x6c40('0x5a'));if(_0x3eb26b[_0x6c40('0x55')]===_0x6c40('0x53')){return db[_0x6c40('0x5b')][_0x6c40('0x45')]({'where':{'name':'Agents','userProfileId':_0x3eb26b['userProfileId']},'raw':!![]})[_0x6c40('0x23')](function(_0x3d8cf9){if(_0x3d8cf9){if(_0x3d8cf9[_0x6c40('0x5c')]===0x0){return db[_0x6c40('0x5d')][_0x6c40('0x51')]({'where':{'sectionId':_0x3d8cf9['id']},'raw':!![]})[_0x6c40('0x23')](function(_0x29854f){var _0x460d5d=[];if(_[_0x6c40('0x5e')](_0x29854f)){_0x460d5d=_['filter'](_0x43a830,function(_0x5b448e){if(_0x5b448e[_0x6c40('0x55')]!==_0x6c40('0x5f')){return _0x5b448e;}});return _0x460d5d;}else{for(var _0x592e1b=0x0;_0x592e1b<_0x43a830['length'];_0x592e1b++){var _0x5afa37=_0x43a830[_0x592e1b];if(_0x5afa37[_0x6c40('0x55')]==='agent'){var _0x4fd117=_['find'](_0x29854f,function(_0x3f7a16){return _0x3f7a16[_0x6c40('0x60')]===_0x5afa37['id'];});if(_0x4fd117)_0x460d5d[_0x6c40('0x61')](_0x5afa37);}else{_0x460d5d['push'](_0x5afa37);}}return _0x460d5d;}});}else{return _0x43a830;}}else{var _0x58094f=_['filter'](_0x43a830,function(_0x55570b){if(_0x55570b[_0x6c40('0x55')]!==_0x6c40('0x5f')){return _0x55570b;}});return _0x58094f;}});}else{return _0x43a830;}}})[_0x6c40('0x23')](function(_0x1e67da){var _0xd05077=[];if(_0x1e67da){_0x1f3d01=_0x1e67da;for(var _0x5eae2d=0x0;_0x5eae2d<_0x1e67da['length'];_0x5eae2d+=0x1){_0x1f3d01[_0x5eae2d][_0x6c40('0x4a')]=[];_0xd05077[_0x6c40('0x61')](db['ChatInternalMessage'][_0x6c40('0x45')]({'where':{'FromId':[_0x20e3a9['user']['id'],_0x1e67da[_0x5eae2d]['id']],'ToId':[_0x20e3a9[_0x6c40('0x53')]['id'],_0x1e67da[_0x5eae2d]['id']],'ChatGroupId':null},'attributes':['id',_0x6c40('0x4c'),_0x6c40('0x62'),'ToId',_0x6c40('0x63'),_0x6c40('0x47')],'order':qs[_0x6c40('0x35')](_0x6c40('0x64')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6c40('0x23')](wrapUser(_0x1e67da[_0x5eae2d])));}return BPromise[_0x6c40('0x65')](_0xd05077);}return[];})[_0x6c40('0x23')](function(_0x4d4676){return{'rows':_0x4d4676,'count':_0x4d4676['length']};})[_0x6c40('0x23')](respondWithResult(_0x424d08,null))[_0x6c40('0x40')](handleError(_0x424d08,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f18c11e..e37a7ce 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 _0x3c94=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x3308b7,_0x73df9c){var _0x3f89bd=function(_0x4da01a){while(--_0x4da01a){_0x3308b7['push'](_0x3308b7['shift']());}};_0x3f89bd(++_0x73df9c);}(_0x3c94,0x111));var _0x43c9=function(_0x56d1b7,_0x1d88f5){_0x56d1b7=_0x56d1b7-0x0;var _0x184d91=_0x3c94[_0x56d1b7];return _0x184d91;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x43c9('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x43c9('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x43c9('0x2'),'afterDestroy':_0x43c9('0x3')};function emitEvent(_0x388344){return function(_0x37eb74,_0x1b8725,_0x5e6c3e){ChatInternalMessageEvents[_0x43c9('0x4')](_0x388344+':'+_0x37eb74['id'],_0x37eb74);ChatInternalMessageEvents[_0x43c9('0x4')](_0x388344,_0x37eb74);_0x5e6c3e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x43c9('0x5')](e,emitEvent(event));}}module[_0x43c9('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xf064=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xf064,0xcc));var _0x4f06=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xf064[_0x58afd5];return _0x3e503b;};'use strict';var EventEmitter=require(_0x4f06('0x0'));var ChatInternalMessage=require(_0x4f06('0x1'))['db'][_0x4f06('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4f06('0x3'),'afterUpdate':_0x4f06('0x4'),'afterDestroy':'remove'};function emitEvent(_0x48764c){return function(_0x43a57a,_0x377693,_0x4d3478){ChatInternalMessageEvents[_0x4f06('0x5')](_0x48764c+':'+_0x43a57a['id'],_0x43a57a);ChatInternalMessageEvents[_0x4f06('0x5')](_0x48764c,_0x43a57a);_0x4d3478(null);};}for(var e in events){if(events[_0x4f06('0x6')](e)){var event=events[e];ChatInternalMessage[_0x4f06('0x7')](e,emitEvent(event));}}module[_0x4f06('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index ec9add0..6f5021e 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 _0xd916=['./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','../../config/environment'];(function(_0x23d1c8,_0x4a7fd2){var _0x1055ee=function(_0x5c27d7){while(--_0x5c27d7){_0x23d1c8['push'](_0x23d1c8['shift']());}};_0x1055ee(++_0x4a7fd2);}(_0xd916,0x165));var _0x6d91=function(_0x3647b6,_0x3a0d67){_0x3647b6=_0x3647b6-0x0;var _0x4b1ea9=_0xd916[_0x3647b6];return _0x4b1ea9;};'use strict';var _=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var logger=require(_0x6d91('0x2'))('api');var moment=require(_0x6d91('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d91('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6d91('0x5'));var attributes=require(_0x6d91('0x6'));module[_0x6d91('0x7')]=function(_0x412a98,_0x507890){return _0x412a98['define']('ChatInternalMessage',attributes,{'tableName':_0x6d91('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d91('0x9'),'collate':_0x6d91('0xa')});}; \ No newline at end of file +var _0xc1e4=['exports','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','bluebird','../../config/environment','./chatInternalMessage.attributes'];(function(_0x496bb7,_0x32b9fa){var _0x589721=function(_0x4ca56b){while(--_0x4ca56b){_0x496bb7['push'](_0x496bb7['shift']());}};_0x589721(++_0x32b9fa);}(_0xc1e4,0x1a2));var _0x4c1e=function(_0x4e654d,_0x4565aa){_0x4e654d=_0x4e654d-0x0;var _0x261d8f=_0xc1e4[_0x4e654d];return _0x261d8f;};'use strict';var _=require(_0x4c1e('0x0'));var util=require(_0x4c1e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4c1e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4c1e('0x3'));var attributes=require(_0x4c1e('0x4'));module[_0x4c1e('0x5')]=function(_0x5f2687,_0x43bbcc){return _0x5f2687['define'](_0x4c1e('0x6'),attributes,{'tableName':_0x4c1e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4c1e('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 6fe2307..4ded27d 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 _0x673f=['http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x107dec,_0x59bac7){var _0x596053=function(_0x29d744){while(--_0x29d744){_0x107dec['push'](_0x107dec['shift']());}};_0x596053(++_0x59bac7);}(_0x673f,0x64));var _0xf673=function(_0x23a24d,_0x42d93b){_0x23a24d=_0x23a24d-0x0;var _0x386294=_0x673f[_0x23a24d];return _0x386294;};'use strict';var _=require(_0xf673('0x0'));var util=require(_0xf673('0x1'));var moment=require(_0xf673('0x2'));var BPromise=require(_0xf673('0x3'));var rs=require(_0xf673('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf673('0x5'))['db'];var utils=require(_0xf673('0x6'));var logger=require(_0xf673('0x7'))(_0xf673('0x8'));var config=require(_0xf673('0x9'));var jayson=require(_0xf673('0xa'));var client=jayson[_0xf673('0xb')][_0xf673('0xc')]({'port':0x232a});config[_0xf673('0xd')]=_['defaults'](config[_0xf673('0xd')],{'host':_0xf673('0xe'),'port':0x18eb});var socket=require(_0xf673('0xf'))(new Redis(config[_0xf673('0xd')]));require(_0xf673('0x10'))[_0xf673('0x11')](socket);function respondWithRpcPromise(_0x2c0185,_0x53b65d,_0x379248){return new BPromise(function(_0x27d518,_0xa4ae22){return client[_0xf673('0x12')](_0x2c0185,_0x379248)['then'](function(_0x3ced76){logger['info'](_0xf673('0x13'),_0x53b65d,_0xf673('0x14'));logger[_0xf673('0x15')](_0xf673('0x16'),_0x53b65d,_0xf673('0x14'),JSON['stringify'](_0x3ced76));if(_0x3ced76[_0xf673('0x17')]){if(_0x3ced76['error'][_0xf673('0x18')]===0x1f4){logger['error'](_0xf673('0x13'),_0x53b65d,_0x3ced76[_0xf673('0x17')][_0xf673('0x19')]);return _0xa4ae22(_0x3ced76[_0xf673('0x17')][_0xf673('0x19')]);}logger['error'](_0xf673('0x13'),_0x53b65d,_0x3ced76[_0xf673('0x17')][_0xf673('0x19')]);return _0x27d518(_0x3ced76[_0xf673('0x17')]['message']);}else{logger[_0xf673('0x1a')]('ChatInternalMessage,\x20%s,\x20%s',_0x53b65d,_0xf673('0x14'));_0x27d518(_0x3ced76[_0xf673('0x1b')][_0xf673('0x19')]);}})['catch'](function(_0xa59a76){logger[_0xf673('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x53b65d,_0xa59a76);_0xa4ae22(_0xa59a76);});});} \ No newline at end of file +var _0xc343=['client','http','redis','./chatInternalMessage.socket','register','request','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','ChatInternalMessage,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x24919a,_0x1f9540){var _0x4e8c1d=function(_0x57b5a6){while(--_0x57b5a6){_0x24919a['push'](_0x24919a['shift']());}};_0x4e8c1d(++_0x1f9540);}(_0xc343,0x1bf));var _0x3c34=function(_0x516874,_0x3f436c){_0x516874=_0x516874-0x0;var _0x32c810=_0xc343[_0x516874];return _0x32c810;};'use strict';var _=require('lodash');var util=require(_0x3c34('0x0'));var moment=require(_0x3c34('0x1'));var BPromise=require(_0x3c34('0x2'));var rs=require(_0x3c34('0x3'));var fs=require('fs');var Redis=require(_0x3c34('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c34('0x5'));var logger=require('../../config/logger')(_0x3c34('0x6'));var config=require(_0x3c34('0x7'));var jayson=require(_0x3c34('0x8'));var client=jayson[_0x3c34('0x9')][_0x3c34('0xa')]({'port':0x232a});config[_0x3c34('0xb')]=_['defaults'](config[_0x3c34('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3c34('0xc'))[_0x3c34('0xd')](socket);function respondWithRpcPromise(_0x45fc65,_0x43a119,_0x1ffde5){return new BPromise(function(_0x51b7cc,_0x55ba3c){return client[_0x3c34('0xe')](_0x45fc65,_0x1ffde5)['then'](function(_0x323f65){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x43a119,_0x3c34('0xf'));logger[_0x3c34('0x10')](_0x3c34('0x11'),_0x43a119,_0x3c34('0xf'),JSON['stringify'](_0x323f65));if(_0x323f65[_0x3c34('0x12')]){if(_0x323f65[_0x3c34('0x12')][_0x3c34('0x13')]===0x1f4){logger[_0x3c34('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x43a119,_0x323f65[_0x3c34('0x12')][_0x3c34('0x14')]);return _0x55ba3c(_0x323f65[_0x3c34('0x12')][_0x3c34('0x14')]);}logger[_0x3c34('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x43a119,_0x323f65[_0x3c34('0x12')][_0x3c34('0x14')]);return _0x51b7cc(_0x323f65[_0x3c34('0x12')][_0x3c34('0x14')]);}else{logger[_0x3c34('0x15')](_0x3c34('0x16'),_0x43a119,_0x3c34('0xf'));_0x51b7cc(_0x323f65['result'][_0x3c34('0x14')]);}})[_0x3c34('0x17')](function(_0x46a203){logger['error'](_0x3c34('0x16'),_0x43a119,_0x46a203);_0x55ba3c(_0x46a203);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 5078ccb..eef25e8 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 _0xbe24=['emit','removeListener','chatInternalMessage:','./chatInternalMessage.events','save','update'];(function(_0x4c359a,_0x104871){var _0x2b4038=function(_0x582ee1){while(--_0x582ee1){_0x4c359a['push'](_0x4c359a['shift']());}};_0x2b4038(++_0x104871);}(_0xbe24,0x18f));var _0x4be2=function(_0x2cc09d,_0x23dede){_0x2cc09d=_0x2cc09d-0x0;var _0x38b9cf=_0xbe24[_0x2cc09d];return _0x38b9cf;};'use strict';var ChatInternalMessageEvents=require(_0x4be2('0x0'));var events=[_0x4be2('0x1'),'remove',_0x4be2('0x2')];function createListener(_0x566dc6,_0xbabfd6){return function(_0x56c89c){_0xbabfd6[_0x4be2('0x3')](_0x566dc6,_0x56c89c);};}function removeListener(_0x9050e7,_0x2b8c84){return function(){ChatInternalMessageEvents[_0x4be2('0x4')](_0x9050e7,_0x2b8c84);};}exports['register']=function(_0x2c2c4c){for(var _0x402366=0x0,_0x32541d=events['length'];_0x402366<_0x32541d;_0x402366++){var _0x4c9f2e=events[_0x402366];var _0x104c39=createListener(_0x4be2('0x5')+_0x4c9f2e,_0x2c2c4c);ChatInternalMessageEvents['on'](_0x4c9f2e,_0x104c39);}}; \ No newline at end of file +var _0xf3aa=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','update','emit'];(function(_0x500470,_0x592fe9){var _0x4764df=function(_0x5f98b8){while(--_0x5f98b8){_0x500470['push'](_0x500470['shift']());}};_0x4764df(++_0x592fe9);}(_0xf3aa,0x9e));var _0xaf3a=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0xf3aa[_0x1fa381];return _0x47eefe;};'use strict';var ChatInternalMessageEvents=require(_0xaf3a('0x0'));var events=['save','remove',_0xaf3a('0x1')];function createListener(_0x403964,_0x536336){return function(_0x59e89){_0x536336[_0xaf3a('0x2')](_0x403964,_0x59e89);};}function removeListener(_0x283c2b,_0x285be8){return function(){ChatInternalMessageEvents[_0xaf3a('0x3')](_0x283c2b,_0x285be8);};}exports[_0xaf3a('0x4')]=function(_0x1c3850){for(var _0x42e2f7=0x0,_0xb6e3fd=events[_0xaf3a('0x5')];_0x42e2f7<_0xb6e3fd;_0x42e2f7++){var _0x3efbe4=events[_0x42e2f7];var _0x43d188=createListener(_0xaf3a('0x6')+_0x3efbe4,_0x1c3850);ChatInternalMessageEvents['on'](_0x3efbe4,_0x43d188);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index fc8eae3..6dd5be8 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 _0xbf15=['put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','show','post'];(function(_0x1d10b3,_0x292510){var _0x216b02=function(_0xe1615e){while(--_0xe1615e){_0x1d10b3['push'](_0x1d10b3['shift']());}};_0x216b02(++_0x292510);}(_0xbf15,0xa7));var _0x5bf1=function(_0x583abd,_0x3bed69){_0x583abd=_0x583abd-0x0;var _0x4721d4=_0xbf15[_0x583abd];return _0x4721d4;};'use strict';var multer=require(_0x5bf1('0x0'));var util=require('util');var path=require(_0x5bf1('0x1'));var timeout=require('connect-timeout');var express=require(_0x5bf1('0x2'));var router=express[_0x5bf1('0x3')]();var fs_extra=require(_0x5bf1('0x4'));var auth=require(_0x5bf1('0x5'));var interaction=require(_0x5bf1('0x6'));var config=require(_0x5bf1('0x7'));var controller=require(_0x5bf1('0x8'));router[_0x5bf1('0x9')]('/',auth[_0x5bf1('0xa')](),controller[_0x5bf1('0xb')]);router[_0x5bf1('0x9')](_0x5bf1('0xc'),auth[_0x5bf1('0xa')](),controller[_0x5bf1('0xd')]);router[_0x5bf1('0x9')](_0x5bf1('0xe'),auth[_0x5bf1('0xa')](),controller['getUsers']);router[_0x5bf1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5bf1('0xf')]);router[_0x5bf1('0x10')]('/',auth[_0x5bf1('0xa')](),controller['create']);router[_0x5bf1('0x11')](_0x5bf1('0x12'),controller[_0x5bf1('0x13')]);router[_0x5bf1('0x14')]('/:id',auth[_0x5bf1('0xa')](),controller[_0x5bf1('0x15')]);module[_0x5bf1('0x16')]=router; \ No newline at end of file +var _0x82ed=['show','post','create','update','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','describe','getUsers'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0x82ed,0xcf));var _0xd82e=function(_0x2d3629,_0x2aa9c1){_0x2d3629=_0x2d3629-0x0;var _0x399933=_0x82ed[_0x2d3629];return _0x399933;};'use strict';var multer=require(_0xd82e('0x0'));var util=require(_0xd82e('0x1'));var path=require(_0xd82e('0x2'));var timeout=require(_0xd82e('0x3'));var express=require('express');var router=express[_0xd82e('0x4')]();var fs_extra=require(_0xd82e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd82e('0x6'));var controller=require(_0xd82e('0x7'));router[_0xd82e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd82e('0x8')](_0xd82e('0x9'),auth[_0xd82e('0xa')](),controller[_0xd82e('0xb')]);router[_0xd82e('0x8')]('/users',auth['isAuthenticated'](),controller[_0xd82e('0xc')]);router[_0xd82e('0x8')]('/:id',auth[_0xd82e('0xa')](),controller[_0xd82e('0xd')]);router[_0xd82e('0xe')]('/',auth[_0xd82e('0xa')](),controller[_0xd82e('0xf')]);router['put']('/:id',controller[_0xd82e('0x10')]);router['delete'](_0xd82e('0x11'),auth[_0xd82e('0xa')](),controller[_0xd82e('0x12')]);module[_0xd82e('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 432717c..ab79919 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 _0x7462=['out','STRING','TEXT','sequelize','exports','BOOLEAN'];(function(_0x159af8,_0x19d870){var _0x5bb6cd=function(_0x51d044){while(--_0x51d044){_0x159af8['push'](_0x159af8['shift']());}};_0x5bb6cd(++_0x19d870);}(_0x7462,0x165));var _0x2746=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0x7462[_0x216428];return _0x313dd4;};'use strict';var Sequelize=require(_0x2746('0x0'));module[_0x2746('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2746('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2746('0x3')),'defaultValue':_0x2746('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x2746('0x4')]},'providerResponse':{'type':Sequelize[_0x2746('0x5')]}}; \ No newline at end of file +var _0x81cb=['DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x2e7325,_0x5cfde7){var _0x3430de=function(_0x5cee86){while(--_0x5cee86){_0x2e7325['push'](_0x2e7325['shift']());}};_0x3430de(++_0x5cfde7);}(_0x81cb,0xaa));var _0xb81c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81cb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb81c('0x0'));module[_0xb81c('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb81c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb81c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb81c('0x4')]('in',_0xb81c('0x5')),'defaultValue':_0xb81c('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb81c('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb81c('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5c4ac3f..974fc06 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 _0x25ae=['body','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','motionChannel','event','EventManager','acceptmessage','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','channel','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','sendStatus','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','status','name','send','index','map','ChatMessage','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','length','include','find','create'];(function(_0x387a82,_0x5bde2a){var _0x1aa008=function(_0x1902d){while(--_0x1902d){_0x387a82['push'](_0x387a82['shift']());}};_0x1aa008(++_0x5bde2a);}(_0x25ae,0x1c3));var _0xe25a=function(_0x6174c3,_0x1cd49a){_0x6174c3=_0x6174c3-0x0;var _0x5a9008=_0x25ae[_0x6174c3];return _0x5a9008;};'use strict';var emlformat=require(_0xe25a('0x0'));var rimraf=require(_0xe25a('0x1'));var zipdir=require(_0xe25a('0x2'));var jsonpatch=require(_0xe25a('0x3'));var rp=require(_0xe25a('0x4'));var moment=require('moment');var BPromise=require(_0xe25a('0x5'));var Mustache=require(_0xe25a('0x6'));var util=require(_0xe25a('0x7'));var path=require(_0xe25a('0x8'));var sox=require(_0xe25a('0x9'));var csv=require('to-csv');var ejs=require(_0xe25a('0xa'));var fs=require('fs');var fs_extra=require(_0xe25a('0xb'));var _=require(_0xe25a('0xc'));var squel=require(_0xe25a('0xd'));var crypto=require(_0xe25a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe25a('0xf'));var toCsv=require(_0xe25a('0x10'));var querystring=require(_0xe25a('0x11'));var Papa=require(_0xe25a('0x12'));var Redis=require('ioredis');var authService=require(_0xe25a('0x13'));var qs=require(_0xe25a('0x14'));var as=require(_0xe25a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe25a('0x16'))(_0xe25a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe25a('0x18'))['db'];config['redis']=_[_0xe25a('0x19')](config[_0xe25a('0x1a')],{'host':_0xe25a('0x1b'),'port':0x18eb});var socket=require(_0xe25a('0x1c'))(new Redis(config[_0xe25a('0x1a')]));require('./chatMessage.socket')[_0xe25a('0x1d')](socket);var jayson=require(_0xe25a('0x1e'));var client=jayson[_0xe25a('0x1f')][_0xe25a('0x20')]({'port':0x232c});var client9002=jayson[_0xe25a('0x1f')][_0xe25a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4f365f,_0x538b1e,_0x1f93e7,_0x335555){return new BPromise(function(_0x42fb5d,_0x1effb2){var _0x5151fb=_0x335555||client;return _0x5151fb['request'](_0x4f365f,_0x1f93e7)[_0xe25a('0x21')](function(_0x139f61){logger[_0xe25a('0x22')](_0xe25a('0x23'),_0x538b1e,'request\x20sent');logger['debug'](_0xe25a('0x24'),_0x538b1e,_0xe25a('0x25'),JSON['stringify'](_0x139f61));if(_0x139f61['error']){if(_0x139f61['error'][_0xe25a('0x26')]===0x1f4){logger[_0xe25a('0x27')]('ChatMessage,\x20%s,\x20%s',_0x538b1e,_0x139f61['error'][_0xe25a('0x28')]);return _0x1effb2(_0x139f61[_0xe25a('0x27')][_0xe25a('0x28')]);}logger[_0xe25a('0x27')](_0xe25a('0x23'),_0x538b1e,_0x139f61['error'][_0xe25a('0x28')]);return _0x42fb5d(_0x139f61[_0xe25a('0x27')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x538b1e,_0xe25a('0x25'));_0x42fb5d(_0x139f61[_0xe25a('0x29')][_0xe25a('0x28')]);}})[_0xe25a('0x2a')](function(_0x43cd56){logger[_0xe25a('0x27')](_0xe25a('0x23'),_0x538b1e,_0x43cd56);_0x1effb2(_0x43cd56);});});}function respondWithStatusCode(_0xe9750,_0x439031){_0x439031=_0x439031||0xcc;return function(_0x40b65c){if(_0x40b65c){return _0xe9750[_0xe25a('0x2b')](_0x439031);}return _0xe9750['status'](_0x439031)[_0xe25a('0x2c')]();};}function respondWithResult(_0x292d98,_0x5c3465){_0x5c3465=_0x5c3465||0xc8;return function(_0x13d09e){if(_0x13d09e){return _0x292d98['status'](_0x5c3465)[_0xe25a('0x2d')](_0x13d09e);}};}function respondWithFilteredResult(_0x5e5a8c,_0x4e2b25){return function(_0x307864){if(_0x307864){var _0x4d8e3c=typeof _0x4e2b25[_0xe25a('0x2e')]==='undefined'&&typeof _0x4e2b25[_0xe25a('0x2f')]===_0xe25a('0x30');var _0x135ea4=_0x307864[_0xe25a('0x31')];var _0xbcceb6=_0x4d8e3c?0x0:_0x4e2b25[_0xe25a('0x2e')];var _0x349b5b=_0x4d8e3c?_0x307864['count']:_0x4e2b25[_0xe25a('0x2e')]+_0x4e2b25[_0xe25a('0x2f')];var _0x3e8ab8;if(_0x349b5b>=_0x135ea4){_0x349b5b=_0x135ea4;_0x3e8ab8=0xc8;}else{_0x3e8ab8=0xce;}_0x5e5a8c['status'](_0x3e8ab8);return _0x5e5a8c['set'](_0xe25a('0x32'),_0xbcceb6+'-'+_0x349b5b+'/'+_0x135ea4)[_0xe25a('0x2d')](_0x307864);}return null;};}function patchUpdates(_0x279b6f){return function(_0x286861){try{jsonpatch[_0xe25a('0x33')](_0x286861,_0x279b6f,!![]);}catch(_0xccb5f6){return BPromise['reject'](_0xccb5f6);}return _0x286861[_0xe25a('0x34')]();};}function saveUpdates(_0x19fdc8,_0x557809){return function(_0x500f20){if(_0x500f20){return _0x500f20[_0xe25a('0x35')](_0x19fdc8)[_0xe25a('0x21')](function(_0x33548f){return _0x33548f;});}return null;};}function removeEntity(_0x110a0c,_0x3ca95c){return function(_0x25fc77){if(_0x25fc77){return _0x25fc77[_0xe25a('0x36')]()[_0xe25a('0x21')](function(){_0x110a0c[_0xe25a('0x37')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24bf08,_0x5e659d){return function(_0x53ed80){if(!_0x53ed80){_0x24bf08[_0xe25a('0x2b')](0x194);}return _0x53ed80;};}function handleError(_0xfedac3,_0x48b013){_0x48b013=_0x48b013||0x1f4;return function(_0x1c4bd0){logger[_0xe25a('0x27')](_0x1c4bd0['stack']);if(_0x1c4bd0[_0xe25a('0x38')]){delete _0x1c4bd0[_0xe25a('0x38')];}_0xfedac3[_0xe25a('0x37')](_0x48b013)[_0xe25a('0x39')](_0x1c4bd0);};}exports[_0xe25a('0x3a')]=function(_0xab45ac,_0x267481){var _0x5629b3={},_0x4891d3={},_0x30d2bd={'count':0x0,'rows':[]};var _0x508a27=_[_0xe25a('0x3b')](db[_0xe25a('0x3c')]['rawAttributes'],function(_0xaf7b44){return{'name':_0xaf7b44[_0xe25a('0x3d')],'type':_0xaf7b44['type'][_0xe25a('0x3e')]};});_0x4891d3[_0xe25a('0x3f')]=_[_0xe25a('0x3b')](_0x508a27,_0xe25a('0x38'));_0x4891d3[_0xe25a('0x40')]=_[_0xe25a('0x41')](_0xab45ac[_0xe25a('0x40')]);_0x4891d3['filters']=_[_0xe25a('0x42')](_0x4891d3['model'],_0x4891d3['query']);_0x5629b3['attributes']=_[_0xe25a('0x42')](_0x4891d3['model'],qs[_0xe25a('0x43')](_0xab45ac[_0xe25a('0x40')][_0xe25a('0x43')]));_0x5629b3[_0xe25a('0x44')]=_0x5629b3[_0xe25a('0x44')]['length']?_0x5629b3[_0xe25a('0x44')]:_0x4891d3[_0xe25a('0x3f')];if(!_0xab45ac[_0xe25a('0x40')][_0xe25a('0x45')]('nolimit')){_0x5629b3[_0xe25a('0x2f')]=qs[_0xe25a('0x2f')](_0xab45ac['query']['limit']);_0x5629b3[_0xe25a('0x2e')]=qs[_0xe25a('0x2e')](_0xab45ac['query'][_0xe25a('0x2e')]);}_0x5629b3[_0xe25a('0x46')]=qs[_0xe25a('0x47')](_0xab45ac[_0xe25a('0x40')][_0xe25a('0x47')]);_0x5629b3[_0xe25a('0x48')]=qs[_0xe25a('0x49')](_[_0xe25a('0x4a')](_0xab45ac[_0xe25a('0x40')],_0x4891d3[_0xe25a('0x49')]),_0x508a27);if(_0xab45ac['query'][_0xe25a('0x4b')]){_0x5629b3[_0xe25a('0x48')]=_[_0xe25a('0x4c')](_0x5629b3['where'],{'$or':_[_0xe25a('0x3b')](_0x508a27,function(_0x5c75ac){if(_0x5c75ac[_0xe25a('0x4d')]!==_0xe25a('0x4e')){var _0x267a31={};_0x267a31[_0x5c75ac['name']]={'$like':'%'+_0xab45ac[_0xe25a('0x40')][_0xe25a('0x4b')]+'%'};return _0x267a31;}})});}_0x5629b3=_[_0xe25a('0x4c')]({},_0x5629b3,_0xab45ac[_0xe25a('0x4f')]);var _0x7a5975={'where':_0x5629b3[_0xe25a('0x48')]};return db['ChatMessage'][_0xe25a('0x31')](_0x7a5975)['then'](function(_0x48a4e6){_0x30d2bd[_0xe25a('0x31')]=_0x48a4e6;if(_0xab45ac[_0xe25a('0x40')][_0xe25a('0x50')]){_0x5629b3['include']=[{'all':!![]}];}return db[_0xe25a('0x3c')][_0xe25a('0x51')](_0x5629b3);})[_0xe25a('0x21')](function(_0x290d0c){_0x30d2bd[_0xe25a('0x52')]=_0x290d0c;return _0x30d2bd;})['then'](respondWithFilteredResult(_0x267481,_0x5629b3))[_0xe25a('0x2a')](handleError(_0x267481,null));};exports['show']=function(_0x3b0745,_0x16f93e){var _0x514538={'raw':!![],'where':{'id':_0x3b0745[_0xe25a('0x53')]['id']}},_0x3e1e9b={};_0x3e1e9b[_0xe25a('0x3f')]=_[_0xe25a('0x41')](db[_0xe25a('0x3c')][_0xe25a('0x54')]);_0x3e1e9b[_0xe25a('0x40')]=_[_0xe25a('0x41')](_0x3b0745[_0xe25a('0x40')]);_0x3e1e9b[_0xe25a('0x49')]=_[_0xe25a('0x42')](_0x3e1e9b[_0xe25a('0x3f')],_0x3e1e9b[_0xe25a('0x40')]);_0x514538[_0xe25a('0x44')]=_[_0xe25a('0x42')](_0x3e1e9b[_0xe25a('0x3f')],qs[_0xe25a('0x43')](_0x3b0745[_0xe25a('0x40')][_0xe25a('0x43')]));_0x514538[_0xe25a('0x44')]=_0x514538['attributes'][_0xe25a('0x55')]?_0x514538['attributes']:_0x3e1e9b[_0xe25a('0x3f')];if(_0x3b0745['query'][_0xe25a('0x50')]){_0x514538[_0xe25a('0x56')]=[{'all':!![]}];}_0x514538=_[_0xe25a('0x4c')]({},_0x514538,_0x3b0745['options']);return db[_0xe25a('0x3c')][_0xe25a('0x57')](_0x514538)[_0xe25a('0x21')](handleEntityNotFound(_0x16f93e,null))['then'](respondWithResult(_0x16f93e,null))[_0xe25a('0x2a')](handleError(_0x16f93e,null));};exports[_0xe25a('0x58')]=function(_0x30cbe5,_0x16da52){return db[_0xe25a('0x3c')][_0xe25a('0x58')](_0x30cbe5[_0xe25a('0x59')],{})[_0xe25a('0x21')](respondWithResult(_0x16da52,0xc9))['catch'](handleError(_0x16da52,null));};exports[_0xe25a('0x35')]=function(_0xe5d118,_0x35c84f){if(_0xe5d118[_0xe25a('0x59')]['id']){delete _0xe5d118[_0xe25a('0x59')]['id'];}return db[_0xe25a('0x3c')][_0xe25a('0x57')]({'where':{'id':_0xe5d118['params']['id']}})[_0xe25a('0x21')](handleEntityNotFound(_0x35c84f,null))[_0xe25a('0x21')](saveUpdates(_0xe5d118['body'],null))[_0xe25a('0x21')](respondWithResult(_0x35c84f,null))[_0xe25a('0x2a')](handleError(_0x35c84f,null));};exports[_0xe25a('0x36')]=function(_0x2633aa,_0x17db81){return db[_0xe25a('0x3c')][_0xe25a('0x57')]({'where':{'id':_0x2633aa['params']['id']}})[_0xe25a('0x21')](handleEntityNotFound(_0x17db81,null))[_0xe25a('0x21')](removeEntity(_0x17db81,null))['catch'](handleError(_0x17db81,null));};exports[_0xe25a('0x5a')]=function(_0x1b030a,_0x584961){return db[_0xe25a('0x3c')]['describe']()[_0xe25a('0x21')](respondWithResult(_0x584961,null))['catch'](handleError(_0x584961,null));};var interaction_log=require(_0xe25a('0x16'))(_0xe25a('0x5b'));exports['accept']=function(_0x444b25,_0x57a5ba,_0x48fa47){var _0x1f92d7={'agent':{},'channel':_0xe25a('0x5c')};if(_0x444b25['body']['id']){delete _0x444b25['body']['id'];}_0x444b25[_0xe25a('0x59')][_0xe25a('0x5d')]=!![];_0x444b25[_0xe25a('0x59')][_0xe25a('0x5e')]=moment()[_0xe25a('0x5f')](_0xe25a('0x60'));_0x444b25[_0xe25a('0x59')]['UserId']=_0x444b25[_0xe25a('0x59')][_0xe25a('0x61')]||_0x444b25[_0xe25a('0x62')]['id'];_0x1f92d7[_0xe25a('0x63')]['id']=_0x444b25[_0xe25a('0x59')][_0xe25a('0x61')];return db[_0xe25a('0x3c')][_0xe25a('0x57')]({'where':{'id':_0x444b25[_0xe25a('0x53')]['id'],'UserId':null}})[_0xe25a('0x21')](handleEntityNotFound(_0x57a5ba,null))[_0xe25a('0x21')](saveUpdates(_0x444b25[_0xe25a('0x59')],null))[_0xe25a('0x21')](function(_0x42669c){if(_0x42669c){_0x1f92d7[_0xe25a('0x28')]=_0x42669c[_0xe25a('0x64')]({'plain':!![]});return db[_0xe25a('0x65')][_0xe25a('0x57')]({'where':{'id':_0x42669c[_0xe25a('0x66')]}});}return null;})[_0xe25a('0x21')](handleEntityNotFound(_0x57a5ba,null))[_0xe25a('0x21')](function(_0x34a6e2){if(_0x34a6e2){return _0x34a6e2[_0xe25a('0x35')]({'UserId':_0x444b25['body']['UserId'],'read1stAt':_[_0xe25a('0x67')](_0x34a6e2[_0xe25a('0x68')])?moment()[_0xe25a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe25a('0x21')](function(_0x5e0907){if(_0x5e0907){_0x1f92d7[_0xe25a('0x69')]=_0x5e0907[_0xe25a('0x64')]({'plain':!![]});interaction_log[_0xe25a('0x22')](_0xe25a('0x6a'),_0x444b25['user']['id'],_0x444b25[_0xe25a('0x62')][_0xe25a('0x38')],_0x444b25[_0xe25a('0x62')][_0xe25a('0x6b')],_0x1f92d7[_0xe25a('0x69')]['id'],_0x444b25[_0xe25a('0x59')]?JSON[_0xe25a('0x6c')](_0x444b25[_0xe25a('0x59')]):'null');return respondWithRpcPromise(_0xe25a('0x6d'),'acceptMessage',_0x1f92d7);}return null;})[_0xe25a('0x21')](function(_0x49e1c9){var _0x4f4d10=_0xe25a('0x6e')+_0x49e1c9[_0xe25a('0x28')][_0xe25a('0x6f')];return db[_0xe25a('0x70')][_0xe25a('0x40')](_0x4f4d10,{'type':db['Sequelize'][_0xe25a('0x71')][_0xe25a('0x72')],'raw':!![]})[_0xe25a('0x21')](function(_0x4b1978){return _0x4b1978;});})['then'](function(_0x2c5c40){if(_0x2c5c40){_0x1f92d7[_0xe25a('0x28')][_0xe25a('0x73')]=_0x2c5c40[0x0];if(!_0x444b25[_0xe25a('0x59')][_0xe25a('0x61')])return;return db[_0xe25a('0x74')][_0xe25a('0x57')]({'where':{'id':_0x444b25[_0xe25a('0x59')][_0xe25a('0x61')],'role':_0xe25a('0x63')},'attributes':['id',_0xe25a('0x38'),'fullname',_0xe25a('0x75'),_0xe25a('0x76')],'raw':!![]});}return null;})[_0xe25a('0x21')](function(_0x43bdf6){if(!_0x43bdf6)return null;_0x1f92d7[_0xe25a('0x28')][_0xe25a('0x63')]=_0x43bdf6;return _0x1f92d7;})[_0xe25a('0x21')](function(_0xf26ba9){if(_0xf26ba9){if(_0x444b25[_0xe25a('0x59')][_0xe25a('0x77')]){_0x1f92d7[_0xe25a('0x28')][_0xe25a('0x78')]=util[_0xe25a('0x5f')](_0xe25a('0x79'),_0x444b25[_0xe25a('0x62')][_0xe25a('0x38')]);_0x1f92d7[_0xe25a('0x28')]['channel']=_0x1f92d7['channel'];_0x1f92d7[_0xe25a('0x28')][_0xe25a('0x7a')]=_0x1f92d7['channel'];_0x1f92d7['message'][_0xe25a('0x7b')]='accept';return respondWithRpcPromise(_0xe25a('0x7c'),_0xe25a('0x7c'),{'event':_0xe25a('0x7d'),'message':_[_0xe25a('0x4c')](_0x1f92d7[_0xe25a('0x28')],JSON['parse'](_0x1f92d7['interaction'][_0xe25a('0x7e')]))},client9002)['then'](function(){return _0x1f92d7;});}return _0x1f92d7;}return null;})['then'](respondWithResult(_0x57a5ba,null))[_0xe25a('0x2a')](handleError(_0x57a5ba,null));};var interaction_log=require(_0xe25a('0x16'))(_0xe25a('0x5b'));exports[_0xe25a('0x7f')]=function(_0x3acaa4,_0x19104f,_0x31394d){var _0x242993={'agent':{},'channel':_0xe25a('0x5c')};if(_0x3acaa4[_0xe25a('0x59')]['id']){delete _0x3acaa4['body']['id'];}_0x3acaa4[_0xe25a('0x59')][_0xe25a('0x61')]=_0x3acaa4[_0xe25a('0x59')][_0xe25a('0x61')]||_0x3acaa4[_0xe25a('0x62')]['id'];_0x242993[_0xe25a('0x63')]['id']=_0x3acaa4[_0xe25a('0x59')][_0xe25a('0x61')];return db['ChatMessage']['find']({'where':{'id':_0x3acaa4[_0xe25a('0x53')]['id'],'UserId':null}})[_0xe25a('0x21')](handleEntityNotFound(_0x19104f,null))[_0xe25a('0x21')](function(_0x5a8291){if(_0x5a8291){_0x242993[_0xe25a('0x28')]=_0x5a8291[_0xe25a('0x64')]({'plain':!![]});return db[_0xe25a('0x65')][_0xe25a('0x57')]({'where':{'id':_0x5a8291[_0xe25a('0x66')]}});}return null;})[_0xe25a('0x21')](handleEntityNotFound(_0x19104f,null))['then'](function(_0x1a8be6){if(_0x1a8be6){_0x242993['interaction']=_0x1a8be6[_0xe25a('0x64')]({'plain':!![]});interaction_log[_0xe25a('0x22')](_0xe25a('0x80'),_0x3acaa4[_0xe25a('0x62')]['id'],_0x3acaa4[_0xe25a('0x62')]['name'],_0x3acaa4[_0xe25a('0x62')][_0xe25a('0x6b')],_0x242993[_0xe25a('0x69')]['id'],_0x3acaa4[_0xe25a('0x59')]?JSON[_0xe25a('0x6c')](_0x3acaa4[_0xe25a('0x59')]):_0xe25a('0x81'));return respondWithRpcPromise(_0xe25a('0x82'),_0xe25a('0x83'),_0x242993);}return null;})['then'](function(_0x2af5f4){var _0x22a586='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2af5f4[_0xe25a('0x28')]['ContactId'];return db[_0xe25a('0x70')][_0xe25a('0x40')](_0x22a586,{'type':db['Sequelize']['QueryTypes'][_0xe25a('0x72')],'raw':!![]})[_0xe25a('0x21')](function(_0x1e2648){return _0x1e2648;});})[_0xe25a('0x21')](function(_0x14b804){if(_0x14b804){_0x242993['message'][_0xe25a('0x73')]=_0x14b804[0x0];if(!_0x3acaa4['body'][_0xe25a('0x61')])return;return db['User'][_0xe25a('0x57')]({'where':{'id':_0x3acaa4[_0xe25a('0x59')][_0xe25a('0x61')],'role':_0xe25a('0x63')},'attributes':['id',_0xe25a('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xe25a('0x21')](function(_0x3acc08){if(!_0x3acc08)return null;_0x242993[_0xe25a('0x28')][_0xe25a('0x63')]=_0x3acc08;return _0x242993;})[_0xe25a('0x21')](function(_0x135580){if(_0x135580){_0x135580[_0xe25a('0x28')][_0xe25a('0x78')]=util['format'](_0xe25a('0x79'),_0x3acaa4[_0xe25a('0x62')][_0xe25a('0x38')]);_0x135580[_0xe25a('0x28')][_0xe25a('0x84')]=_0x242993[_0xe25a('0x84')];_0x135580['message'][_0xe25a('0x7a')]=_0x242993['channel'];_0x135580['message'][_0xe25a('0x7b')]=_0xe25a('0x7f');respondWithRpcPromise('EventManager',_0xe25a('0x7c'),{'event':_0xe25a('0x85'),'message':_[_0xe25a('0x4c')](_0x242993[_0xe25a('0x28')],JSON[_0xe25a('0x86')](_0x242993['interaction']['formData']))},client9002);return _0x242993;}return null;})['then'](respondWithResult(_0x19104f,null))[_0xe25a('0x2a')](handleError(_0x19104f,null));}; \ No newline at end of file +var _0x9c46=['destroy','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','merge','where','VIRTUAL','name','filter','options','include','findAll','rows','params','keys','includeAll','find','create','body','describe','chat-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','fullname','event','reject','rejectmessage','formData','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save'];(function(_0x316413,_0x5b54e7){var _0xf2984e=function(_0x47d42d){while(--_0x47d42d){_0x316413['push'](_0x316413['shift']());}};_0xf2984e(++_0x5b54e7);}(_0x9c46,0x1e1));var _0x69c4=function(_0x10fa8d,_0x4d6063){_0x10fa8d=_0x10fa8d-0x0;var _0x5d49cb=_0x9c46[_0x10fa8d];return _0x5d49cb;};'use strict';var emlformat=require(_0x69c4('0x0'));var rimraf=require(_0x69c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69c4('0x2'));var rp=require('request-promise');var moment=require(_0x69c4('0x3'));var BPromise=require(_0x69c4('0x4'));var Mustache=require(_0x69c4('0x5'));var util=require('util');var path=require(_0x69c4('0x6'));var sox=require(_0x69c4('0x7'));var csv=require(_0x69c4('0x8'));var ejs=require(_0x69c4('0x9'));var fs=require('fs');var fs_extra=require(_0x69c4('0xa'));var _=require('lodash');var squel=require(_0x69c4('0xb'));var crypto=require(_0x69c4('0xc'));var jsforce=require(_0x69c4('0xd'));var deskjs=require(_0x69c4('0xe'));var toCsv=require(_0x69c4('0x8'));var querystring=require(_0x69c4('0xf'));var Papa=require(_0x69c4('0x10'));var Redis=require(_0x69c4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x69c4('0x12'));var as=require(_0x69c4('0x13'));var hardwareService=require(_0x69c4('0x14'));var logger=require(_0x69c4('0x15'))(_0x69c4('0x16'));var utils=require(_0x69c4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x69c4('0x18'));var db=require(_0x69c4('0x19'))['db'];config[_0x69c4('0x1a')]=_[_0x69c4('0x1b')](config[_0x69c4('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x69c4('0x1c'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x69c4('0x1d')](socket);var jayson=require(_0x69c4('0x1e'));var client=jayson[_0x69c4('0x1f')][_0x69c4('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x69c4('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5d7b60,_0x1bbf8d,_0x168760,_0x243630){return new BPromise(function(_0x50fd75,_0x3b5007){var _0x2be021=_0x243630||client;return _0x2be021[_0x69c4('0x21')](_0x5d7b60,_0x168760)[_0x69c4('0x22')](function(_0x36b26e){logger[_0x69c4('0x23')](_0x69c4('0x24'),_0x1bbf8d,_0x69c4('0x25'));logger[_0x69c4('0x26')](_0x69c4('0x27'),_0x1bbf8d,_0x69c4('0x25'),JSON[_0x69c4('0x28')](_0x36b26e));if(_0x36b26e[_0x69c4('0x29')]){if(_0x36b26e[_0x69c4('0x29')][_0x69c4('0x2a')]===0x1f4){logger['error'](_0x69c4('0x24'),_0x1bbf8d,_0x36b26e[_0x69c4('0x29')][_0x69c4('0x2b')]);return _0x3b5007(_0x36b26e[_0x69c4('0x29')][_0x69c4('0x2b')]);}logger[_0x69c4('0x29')]('ChatMessage,\x20%s,\x20%s',_0x1bbf8d,_0x36b26e[_0x69c4('0x29')][_0x69c4('0x2b')]);return _0x50fd75(_0x36b26e[_0x69c4('0x29')][_0x69c4('0x2b')]);}else{logger[_0x69c4('0x23')](_0x69c4('0x24'),_0x1bbf8d,_0x69c4('0x25'));_0x50fd75(_0x36b26e['result'][_0x69c4('0x2b')]);}})[_0x69c4('0x2c')](function(_0x403471){logger[_0x69c4('0x29')]('ChatMessage,\x20%s,\x20%s',_0x1bbf8d,_0x403471);_0x3b5007(_0x403471);});});}function respondWithStatusCode(_0x3967ba,_0x3fa5e4){_0x3fa5e4=_0x3fa5e4||0xcc;return function(_0x4ddd19){if(_0x4ddd19){return _0x3967ba[_0x69c4('0x2d')](_0x3fa5e4);}return _0x3967ba[_0x69c4('0x2e')](_0x3fa5e4)['end']();};}function respondWithResult(_0x5f1b00,_0x42c8f3){_0x42c8f3=_0x42c8f3||0xc8;return function(_0xf4e5f5){if(_0xf4e5f5){return _0x5f1b00[_0x69c4('0x2e')](_0x42c8f3)[_0x69c4('0x2f')](_0xf4e5f5);}};}function respondWithFilteredResult(_0x41a9ec,_0x127fa2){return function(_0x4cb0b3){if(_0x4cb0b3){var _0x38985b=typeof _0x127fa2['offset']===_0x69c4('0x30')&&typeof _0x127fa2[_0x69c4('0x31')]===_0x69c4('0x30');var _0x43be9d=_0x4cb0b3[_0x69c4('0x32')];var _0x404d1e=_0x38985b?0x0:_0x127fa2[_0x69c4('0x33')];var _0x5c1b94=_0x38985b?_0x4cb0b3[_0x69c4('0x32')]:_0x127fa2[_0x69c4('0x33')]+_0x127fa2[_0x69c4('0x31')];var _0x2aaa60;if(_0x5c1b94>=_0x43be9d){_0x5c1b94=_0x43be9d;_0x2aaa60=0xc8;}else{_0x2aaa60=0xce;}_0x41a9ec[_0x69c4('0x2e')](_0x2aaa60);return _0x41a9ec['set'](_0x69c4('0x34'),_0x404d1e+'-'+_0x5c1b94+'/'+_0x43be9d)[_0x69c4('0x2f')](_0x4cb0b3);}return null;};}function patchUpdates(_0x21a5f8){return function(_0x21816d){try{jsonpatch[_0x69c4('0x35')](_0x21816d,_0x21a5f8,!![]);}catch(_0x36f3f6){return BPromise['reject'](_0x36f3f6);}return _0x21816d[_0x69c4('0x36')]();};}function saveUpdates(_0x6bd519,_0x1be93c){return function(_0x3a3d6d){if(_0x3a3d6d){return _0x3a3d6d['update'](_0x6bd519)[_0x69c4('0x22')](function(_0x2dc15b){return _0x2dc15b;});}return null;};}function removeEntity(_0x2d6aa0,_0x4c9dc2){return function(_0x34331d){if(_0x34331d){return _0x34331d[_0x69c4('0x37')]()[_0x69c4('0x22')](function(){_0x2d6aa0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ce007,_0x37c48d){return function(_0x2c5e1d){if(!_0x2c5e1d){_0x4ce007[_0x69c4('0x2d')](0x194);}return _0x2c5e1d;};}function handleError(_0x56ff53,_0xf9b6b7){_0xf9b6b7=_0xf9b6b7||0x1f4;return function(_0xe2185d){logger[_0x69c4('0x29')](_0xe2185d['stack']);if(_0xe2185d['name']){delete _0xe2185d['name'];}_0x56ff53[_0x69c4('0x2e')](_0xf9b6b7)['send'](_0xe2185d);};}exports[_0x69c4('0x38')]=function(_0x1b3626,_0x54ad62){var _0x692e77={},_0xdc628f={},_0x14043f={'count':0x0,'rows':[]};var _0x473cd1=_[_0x69c4('0x39')](db[_0x69c4('0x3a')][_0x69c4('0x3b')],function(_0x5d8e13){return{'name':_0x5d8e13[_0x69c4('0x3c')],'type':_0x5d8e13['type'][_0x69c4('0x3d')]};});_0xdc628f[_0x69c4('0x3e')]=_[_0x69c4('0x39')](_0x473cd1,'name');_0xdc628f[_0x69c4('0x3f')]=_['keys'](_0x1b3626['query']);_0xdc628f['filters']=_[_0x69c4('0x40')](_0xdc628f[_0x69c4('0x3e')],_0xdc628f['query']);_0x692e77[_0x69c4('0x41')]=_[_0x69c4('0x40')](_0xdc628f[_0x69c4('0x3e')],qs[_0x69c4('0x42')](_0x1b3626[_0x69c4('0x3f')][_0x69c4('0x42')]));_0x692e77[_0x69c4('0x41')]=_0x692e77['attributes'][_0x69c4('0x43')]?_0x692e77[_0x69c4('0x41')]:_0xdc628f[_0x69c4('0x3e')];if(!_0x1b3626[_0x69c4('0x3f')][_0x69c4('0x44')](_0x69c4('0x45'))){_0x692e77['limit']=qs[_0x69c4('0x31')](_0x1b3626[_0x69c4('0x3f')][_0x69c4('0x31')]);_0x692e77[_0x69c4('0x33')]=qs[_0x69c4('0x33')](_0x1b3626[_0x69c4('0x3f')][_0x69c4('0x33')]);}_0x692e77['order']=qs[_0x69c4('0x46')](_0x1b3626[_0x69c4('0x3f')]['sort']);_0x692e77['where']=qs[_0x69c4('0x47')](_[_0x69c4('0x48')](_0x1b3626['query'],_0xdc628f[_0x69c4('0x47')]),_0x473cd1);if(_0x1b3626['query']['filter']){_0x692e77['where']=_[_0x69c4('0x49')](_0x692e77[_0x69c4('0x4a')],{'$or':_['map'](_0x473cd1,function(_0x790ba6){if(_0x790ba6['type']!==_0x69c4('0x4b')){var _0x404254={};_0x404254[_0x790ba6[_0x69c4('0x4c')]]={'$like':'%'+_0x1b3626[_0x69c4('0x3f')][_0x69c4('0x4d')]+'%'};return _0x404254;}})});}_0x692e77=_[_0x69c4('0x49')]({},_0x692e77,_0x1b3626[_0x69c4('0x4e')]);var _0x54797d={'where':_0x692e77[_0x69c4('0x4a')]};return db[_0x69c4('0x3a')][_0x69c4('0x32')](_0x54797d)[_0x69c4('0x22')](function(_0x558da3){_0x14043f[_0x69c4('0x32')]=_0x558da3;if(_0x1b3626[_0x69c4('0x3f')]['includeAll']){_0x692e77[_0x69c4('0x4f')]=[{'all':!![]}];}return db[_0x69c4('0x3a')][_0x69c4('0x50')](_0x692e77);})[_0x69c4('0x22')](function(_0x976831){_0x14043f[_0x69c4('0x51')]=_0x976831;return _0x14043f;})['then'](respondWithFilteredResult(_0x54ad62,_0x692e77))['catch'](handleError(_0x54ad62,null));};exports['show']=function(_0x43f033,_0xd5c7f7){var _0x429ac1={'raw':!![],'where':{'id':_0x43f033[_0x69c4('0x52')]['id']}},_0x3beca1={};_0x3beca1[_0x69c4('0x3e')]=_['keys'](db['ChatMessage'][_0x69c4('0x3b')]);_0x3beca1[_0x69c4('0x3f')]=_[_0x69c4('0x53')](_0x43f033[_0x69c4('0x3f')]);_0x3beca1['filters']=_[_0x69c4('0x40')](_0x3beca1[_0x69c4('0x3e')],_0x3beca1['query']);_0x429ac1[_0x69c4('0x41')]=_['intersection'](_0x3beca1[_0x69c4('0x3e')],qs[_0x69c4('0x42')](_0x43f033['query'][_0x69c4('0x42')]));_0x429ac1['attributes']=_0x429ac1[_0x69c4('0x41')][_0x69c4('0x43')]?_0x429ac1[_0x69c4('0x41')]:_0x3beca1['model'];if(_0x43f033[_0x69c4('0x3f')][_0x69c4('0x54')]){_0x429ac1[_0x69c4('0x4f')]=[{'all':!![]}];}_0x429ac1=_[_0x69c4('0x49')]({},_0x429ac1,_0x43f033[_0x69c4('0x4e')]);return db['ChatMessage'][_0x69c4('0x55')](_0x429ac1)['then'](handleEntityNotFound(_0xd5c7f7,null))['then'](respondWithResult(_0xd5c7f7,null))[_0x69c4('0x2c')](handleError(_0xd5c7f7,null));};exports[_0x69c4('0x56')]=function(_0x15610a,_0x1e14b2){return db[_0x69c4('0x3a')][_0x69c4('0x56')](_0x15610a[_0x69c4('0x57')],{})['then'](respondWithResult(_0x1e14b2,0xc9))['catch'](handleError(_0x1e14b2,null));};exports['update']=function(_0x4293ea,_0x18c907){if(_0x4293ea[_0x69c4('0x57')]['id']){delete _0x4293ea[_0x69c4('0x57')]['id'];}return db[_0x69c4('0x3a')][_0x69c4('0x55')]({'where':{'id':_0x4293ea[_0x69c4('0x52')]['id']}})[_0x69c4('0x22')](handleEntityNotFound(_0x18c907,null))[_0x69c4('0x22')](saveUpdates(_0x4293ea[_0x69c4('0x57')],null))[_0x69c4('0x22')](respondWithResult(_0x18c907,null))['catch'](handleError(_0x18c907,null));};exports[_0x69c4('0x37')]=function(_0x5ea9ca,_0x512722){return db[_0x69c4('0x3a')][_0x69c4('0x55')]({'where':{'id':_0x5ea9ca[_0x69c4('0x52')]['id']}})[_0x69c4('0x22')](handleEntityNotFound(_0x512722,null))[_0x69c4('0x22')](removeEntity(_0x512722,null))[_0x69c4('0x2c')](handleError(_0x512722,null));};exports[_0x69c4('0x58')]=function(_0x27c0b6,_0x2a2460){return db[_0x69c4('0x3a')]['describe']()[_0x69c4('0x22')](respondWithResult(_0x2a2460,null))['catch'](handleError(_0x2a2460,null));};var interaction_log=require(_0x69c4('0x15'))(_0x69c4('0x59'));exports[_0x69c4('0x5a')]=function(_0x51c474,_0x302969,_0x4a1768){var _0x5dfd7f={'agent':{},'channel':'chat'};if(_0x51c474['body']['id']){delete _0x51c474[_0x69c4('0x57')]['id'];}_0x51c474[_0x69c4('0x57')][_0x69c4('0x5b')]=!![];_0x51c474[_0x69c4('0x57')][_0x69c4('0x5c')]=moment()['format'](_0x69c4('0x5d'));_0x51c474[_0x69c4('0x57')][_0x69c4('0x5e')]=_0x51c474[_0x69c4('0x57')][_0x69c4('0x5e')]||_0x51c474[_0x69c4('0x5f')]['id'];_0x5dfd7f['agent']['id']=_0x51c474['body'][_0x69c4('0x5e')];return db[_0x69c4('0x3a')][_0x69c4('0x55')]({'where':{'id':_0x51c474[_0x69c4('0x52')]['id'],'UserId':null}})[_0x69c4('0x22')](handleEntityNotFound(_0x302969,null))[_0x69c4('0x22')](saveUpdates(_0x51c474['body'],null))[_0x69c4('0x22')](function(_0x3264b7){if(_0x3264b7){_0x5dfd7f[_0x69c4('0x2b')]=_0x3264b7[_0x69c4('0x60')]({'plain':!![]});return db[_0x69c4('0x61')][_0x69c4('0x55')]({'where':{'id':_0x3264b7[_0x69c4('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x302969,null))[_0x69c4('0x22')](function(_0x5dae80){if(_0x5dae80){return _0x5dae80['update']({'UserId':_0x51c474['body']['UserId'],'read1stAt':_[_0x69c4('0x63')](_0x5dae80[_0x69c4('0x64')])?moment()[_0x69c4('0x65')](_0x69c4('0x5d')):undefined});}return null;})[_0x69c4('0x22')](function(_0xb8d6f1){if(_0xb8d6f1){_0x5dfd7f[_0x69c4('0x66')]=_0xb8d6f1['get']({'plain':!![]});interaction_log[_0x69c4('0x23')](_0x69c4('0x67'),_0x51c474[_0x69c4('0x5f')]['id'],_0x51c474['user'][_0x69c4('0x4c')],_0x51c474[_0x69c4('0x5f')][_0x69c4('0x68')],_0x5dfd7f['interaction']['id'],_0x51c474[_0x69c4('0x57')]?JSON['stringify'](_0x51c474[_0x69c4('0x57')]):_0x69c4('0x69'));return respondWithRpcPromise(_0x69c4('0x6a'),_0x69c4('0x6b'),_0x5dfd7f);}return null;})['then'](function(_0x36d14a){var _0x136787=_0x69c4('0x6c')+_0x36d14a[_0x69c4('0x2b')][_0x69c4('0x6d')];return db[_0x69c4('0x6e')]['query'](_0x136787,{'type':db[_0x69c4('0x6f')][_0x69c4('0x70')][_0x69c4('0x71')],'raw':!![]})[_0x69c4('0x22')](function(_0x27abaa){return _0x27abaa;});})[_0x69c4('0x22')](function(_0x58b3bd){if(_0x58b3bd){_0x5dfd7f['message'][_0x69c4('0x72')]=_0x58b3bd[0x0];if(!_0x51c474[_0x69c4('0x57')][_0x69c4('0x5e')])return;return db[_0x69c4('0x73')][_0x69c4('0x55')]({'where':{'id':_0x51c474[_0x69c4('0x57')][_0x69c4('0x5e')],'role':_0x69c4('0x74')},'attributes':['id',_0x69c4('0x4c'),'fullname',_0x69c4('0x75'),_0x69c4('0x76')],'raw':!![]});}return null;})['then'](function(_0x4ece6b){if(!_0x4ece6b)return null;_0x5dfd7f[_0x69c4('0x2b')][_0x69c4('0x74')]=_0x4ece6b;return _0x5dfd7f;})[_0x69c4('0x22')](function(_0x1516bf){if(_0x1516bf){if(_0x51c474[_0x69c4('0x57')][_0x69c4('0x77')]){_0x5dfd7f[_0x69c4('0x2b')][_0x69c4('0x78')]=util[_0x69c4('0x65')](_0x69c4('0x79'),_0x51c474['user'][_0x69c4('0x4c')]);_0x5dfd7f[_0x69c4('0x2b')]['channel']=_0x5dfd7f[_0x69c4('0x7a')];_0x5dfd7f['message'][_0x69c4('0x7b')]=_0x5dfd7f[_0x69c4('0x7a')];_0x5dfd7f['message']['event']=_0x69c4('0x5a');return respondWithRpcPromise(_0x69c4('0x7c'),_0x69c4('0x7c'),{'event':_0x69c4('0x7d'),'message':_[_0x69c4('0x49')](_0x5dfd7f[_0x69c4('0x2b')],JSON[_0x69c4('0x7e')](_0x5dfd7f['interaction']['formData']))},client9002)[_0x69c4('0x22')](function(){return _0x5dfd7f;});}return _0x5dfd7f;}return null;})[_0x69c4('0x22')](respondWithResult(_0x302969,null))['catch'](handleError(_0x302969,null));};var interaction_log=require('../../config/logger')(_0x69c4('0x59'));exports['reject']=function(_0x537418,_0x6755c9,_0x32c9bb){var _0xd7917a={'agent':{},'channel':'chat'};if(_0x537418['body']['id']){delete _0x537418['body']['id'];}_0x537418[_0x69c4('0x57')][_0x69c4('0x5e')]=_0x537418[_0x69c4('0x57')][_0x69c4('0x5e')]||_0x537418[_0x69c4('0x5f')]['id'];_0xd7917a[_0x69c4('0x74')]['id']=_0x537418[_0x69c4('0x57')][_0x69c4('0x5e')];return db[_0x69c4('0x3a')][_0x69c4('0x55')]({'where':{'id':_0x537418['params']['id'],'UserId':null}})[_0x69c4('0x22')](handleEntityNotFound(_0x6755c9,null))[_0x69c4('0x22')](function(_0x40bda6){if(_0x40bda6){_0xd7917a['message']=_0x40bda6[_0x69c4('0x60')]({'plain':!![]});return db[_0x69c4('0x61')][_0x69c4('0x55')]({'where':{'id':_0x40bda6[_0x69c4('0x62')]}});}return null;})[_0x69c4('0x22')](handleEntityNotFound(_0x6755c9,null))[_0x69c4('0x22')](function(_0x3f62ee){if(_0x3f62ee){_0xd7917a[_0x69c4('0x66')]=_0x3f62ee['get']({'plain':!![]});interaction_log[_0x69c4('0x23')](_0x69c4('0x7f'),_0x537418['user']['id'],_0x537418[_0x69c4('0x5f')][_0x69c4('0x4c')],_0x537418[_0x69c4('0x5f')][_0x69c4('0x68')],_0xd7917a[_0x69c4('0x66')]['id'],_0x537418[_0x69c4('0x57')]?JSON[_0x69c4('0x28')](_0x537418['body']):'null');return respondWithRpcPromise('RejectMessage',_0x69c4('0x80'),_0xd7917a);}return null;})['then'](function(_0x3c5bfb){var _0x204183='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c5bfb[_0x69c4('0x2b')][_0x69c4('0x6d')];return db[_0x69c4('0x6e')][_0x69c4('0x3f')](_0x204183,{'type':db[_0x69c4('0x6f')][_0x69c4('0x70')][_0x69c4('0x71')],'raw':!![]})['then'](function(_0x1c153f){return _0x1c153f;});})[_0x69c4('0x22')](function(_0x277be8){if(_0x277be8){_0xd7917a[_0x69c4('0x2b')][_0x69c4('0x72')]=_0x277be8[0x0];if(!_0x537418['body'][_0x69c4('0x5e')])return;return db[_0x69c4('0x73')]['find']({'where':{'id':_0x537418['body'][_0x69c4('0x5e')],'role':_0x69c4('0x74')},'attributes':['id',_0x69c4('0x4c'),_0x69c4('0x81'),_0x69c4('0x75'),_0x69c4('0x76')],'raw':!![]});}return null;})['then'](function(_0x5129d1){if(!_0x5129d1)return null;_0xd7917a['message'][_0x69c4('0x74')]=_0x5129d1;return _0xd7917a;})['then'](function(_0xce400a){if(_0xce400a){_0xce400a[_0x69c4('0x2b')][_0x69c4('0x78')]=util[_0x69c4('0x65')](_0x69c4('0x79'),_0x537418[_0x69c4('0x5f')][_0x69c4('0x4c')]);_0xce400a[_0x69c4('0x2b')][_0x69c4('0x7a')]=_0xd7917a['channel'];_0xce400a[_0x69c4('0x2b')][_0x69c4('0x7b')]=_0xd7917a['channel'];_0xce400a[_0x69c4('0x2b')][_0x69c4('0x82')]=_0x69c4('0x83');respondWithRpcPromise(_0x69c4('0x7c'),'EventManager',{'event':_0x69c4('0x84'),'message':_[_0x69c4('0x49')](_0xd7917a[_0x69c4('0x2b')],JSON[_0x69c4('0x7e')](_0xd7917a[_0x69c4('0x66')][_0x69c4('0x85')]))},client9002);return _0xd7917a;}return null;})[_0x69c4('0x22')](respondWithResult(_0x6755c9,null))[_0x69c4('0x2c')](handleError(_0x6755c9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 8aff5d0..386fdd2 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 _0x3dba=['hook','exports','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1b18e7,_0x5d06ca){var _0x2c435a=function(_0x2140da){while(--_0x2140da){_0x1b18e7['push'](_0x1b18e7['shift']());}};_0x2c435a(++_0x5d06ca);}(_0x3dba,0xe2));var _0xa3db=function(_0x2c4949,_0x2476d2){_0x2c4949=_0x2c4949-0x0;var _0x5e9161=_0x3dba[_0x2c4949];return _0x5e9161;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0xa3db('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa3db('0x1')](0x0);var events={'afterCreate':_0xa3db('0x2'),'afterUpdate':_0xa3db('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3f4bc0){return function(_0x41cf89,_0x5f1113,_0x515c62){ChatMessageEvents[_0xa3db('0x4')](_0x3f4bc0+':'+_0x41cf89['id'],_0x41cf89);ChatMessageEvents[_0xa3db('0x4')](_0x3f4bc0,_0x41cf89);_0x515c62(null);};}for(var e in events){if(events[_0xa3db('0x5')](e)){var event=events[e];ChatMessage[_0xa3db('0x6')](e,emitEvent(event));}}module[_0xa3db('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xd6b7=['hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0xd6b7,0x1ec));var _0x7d6b=function(_0x41fb84,_0x3770b8){_0x41fb84=_0x41fb84-0x0;var _0x231304=_0xd6b7[_0x41fb84];return _0x231304;};'use strict';var EventEmitter=require(_0x7d6b('0x0'));var ChatMessage=require(_0x7d6b('0x1'))['db'][_0x7d6b('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7d6b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7d6b('0x4'),'afterDestroy':_0x7d6b('0x5')};function emitEvent(_0x23801e){return function(_0x1b6809,_0xa42e4f,_0x2690a0){ChatMessageEvents['emit'](_0x23801e+':'+_0x1b6809['id'],_0x1b6809);ChatMessageEvents[_0x7d6b('0x6')](_0x23801e,_0x1b6809);_0x2690a0(null);};}for(var e in events){if(events[_0x7d6b('0x7')](e)){var event=events[e];ChatMessage[_0x7d6b('0x8')](e,emitEvent(event));}}module[_0x7d6b('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 3c141ec..45cc632 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 _0x854a=['update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','./chatMessage.attributes','exports','define','body','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then'];(function(_0x517839,_0x317183){var _0x4b89d1=function(_0x18f9ca){while(--_0x18f9ca){_0x517839['push'](_0x517839['shift']());}};_0x4b89d1(++_0x317183);}(_0x854a,0x1e8));var _0xa854=function(_0xe18a4d,_0x290e52){_0xe18a4d=_0xe18a4d-0x0;var _0x41b211=_0x854a[_0xe18a4d];return _0x41b211;};'use strict';var _=require(_0xa854('0x0'));var util=require(_0xa854('0x1'));var logger=require('../../config/logger')(_0xa854('0x2'));var moment=require(_0xa854('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('../../config/environment');var attributes=require(_0xa854('0x4'));module[_0xa854('0x5')]=function(_0x10050d,_0x3456f2){return _0x10050d[_0xa854('0x6')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xa854('0x7')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x359e15,_0x52b63d,_0x54477b){var _0x6d36a9=_0x10050d['models'];var _0x3c185d=_0x359e15[_0xa854('0x8')]({'plain':!![]});if(_0x3c185d[_0xa854('0x9')][_0xa854('0xa')]()==='in'||_0x3c185d[_0xa854('0x9')]['toLowerCase']()===_0xa854('0xb')&&!_0x3c185d[_0xa854('0xc')]&&!_[_0xa854('0xd')](_0x3c185d[_0xa854('0xe')])){_0x6d36a9[_0xa854('0xf')]['findOne']({'where':{'id':_0x3c185d[_0xa854('0x10')]}})[_0xa854('0x11')](function(_0x4f7153){if(_0x4f7153){_0x4f7153[_0xa854('0x12')]({'lastMsgAt':_0x3c185d['createdAt'],'lastMsgDirection':_0x3c185d[_0xa854('0x9')]['toLowerCase']()});}})[_0xa854('0x13')](function(_0x17be9e){console['error'](_0x17be9e);});}_0x54477b();}},'charset':_0xa854('0x14'),'collate':_0xa854('0x15')});}; \ No newline at end of file +var _0xc300=['../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xc300,0x132));var _0x0c30=function(_0x302b27,_0x26d927){_0x302b27=_0x302b27-0x0;var _0x2b2193=_0xc300[_0x302b27];return _0x2b2193;};'use strict';var _=require(_0x0c30('0x0'));var util=require(_0x0c30('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c30('0x2'));var BPromise=require(_0x0c30('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c30('0x4'));var rimraf=require(_0x0c30('0x5'));var config=require(_0x0c30('0x6'));var attributes=require(_0x0c30('0x7'));module[_0x0c30('0x8')]=function(_0x99afcb,_0xc8f529){return _0x99afcb[_0x0c30('0x9')]('ChatMessage',attributes,{'tableName':_0x0c30('0xa'),'paranoid':![],'indexes':[{'name':_0x0c30('0xb'),'fields':['body'],'type':_0x0c30('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39417c,_0x56d44a,_0x351cca){var _0x2d077e=_0x99afcb[_0x0c30('0xd')];var _0x104032=_0x39417c[_0x0c30('0xe')]({'plain':!![]});if(_0x104032['direction']['toLowerCase']()==='in'||_0x104032[_0x0c30('0xf')][_0x0c30('0x10')]()==='out'&&!_0x104032['secret']&&!_[_0x0c30('0x11')](_0x104032[_0x0c30('0x12')])){_0x2d077e[_0x0c30('0x13')][_0x0c30('0x14')]({'where':{'id':_0x104032[_0x0c30('0x15')]}})['then'](function(_0x11c0ae){if(_0x11c0ae){_0x11c0ae['update']({'lastMsgAt':_0x104032[_0x0c30('0x16')],'lastMsgDirection':_0x104032[_0x0c30('0xf')][_0x0c30('0x10')]()});}})[_0x0c30('0x17')](function(_0x295efb){console[_0x0c30('0x18')](_0x295efb);});}_0x351cca();}},'charset':'utf8mb4','collate':_0x0c30('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9a38134..149397f 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 _0x6d88=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','ChatMessage','body','options','CreateChatMessage','lodash','util','moment','randomstring'];(function(_0x4538f6,_0x50f153){var _0x3e771e=function(_0x2dd558){while(--_0x2dd558){_0x4538f6['push'](_0x4538f6['shift']());}};_0x3e771e(++_0x50f153);}(_0x6d88,0x9c));var _0x86d8=function(_0x1804ae,_0x33570b){_0x1804ae=_0x1804ae-0x0;var _0x5e5161=_0x6d88[_0x1804ae];return _0x5e5161;};'use strict';var _=require(_0x86d8('0x0'));var util=require(_0x86d8('0x1'));var moment=require(_0x86d8('0x2'));var BPromise=require('bluebird');var rs=require(_0x86d8('0x3'));var fs=require('fs');var Redis=require(_0x86d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x86d8('0x5'));var logger=require(_0x86d8('0x6'))(_0x86d8('0x7'));var config=require('../../config/environment');var jayson=require(_0x86d8('0x8'));var client=jayson[_0x86d8('0x9')][_0x86d8('0xa')]({'port':0x232a});config[_0x86d8('0xb')]=_[_0x86d8('0xc')](config[_0x86d8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x86d8('0xd'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x86d8('0xe')](socket);function respondWithRpcPromise(_0x5639d6,_0x3e51bf,_0xaf5a5f){return new BPromise(function(_0x3f8ca6,_0x542474){return client[_0x86d8('0xf')](_0x5639d6,_0xaf5a5f)[_0x86d8('0x10')](function(_0x3cb003){logger[_0x86d8('0x11')]('ChatMessage,\x20%s,\x20%s',_0x3e51bf,'request\x20sent');logger[_0x86d8('0x12')](_0x86d8('0x13'),_0x3e51bf,_0x86d8('0x14'),JSON[_0x86d8('0x15')](_0x3cb003));if(_0x3cb003['error']){if(_0x3cb003[_0x86d8('0x16')][_0x86d8('0x17')]===0x1f4){logger['error'](_0x86d8('0x18'),_0x3e51bf,_0x3cb003[_0x86d8('0x16')][_0x86d8('0x19')]);return _0x542474(_0x3cb003[_0x86d8('0x16')][_0x86d8('0x19')]);}logger[_0x86d8('0x16')]('ChatMessage,\x20%s,\x20%s',_0x3e51bf,_0x3cb003[_0x86d8('0x16')][_0x86d8('0x19')]);return _0x3f8ca6(_0x3cb003[_0x86d8('0x16')][_0x86d8('0x19')]);}else{logger[_0x86d8('0x11')](_0x86d8('0x18'),_0x3e51bf,'request\x20sent');_0x3f8ca6(_0x3cb003[_0x86d8('0x1a')][_0x86d8('0x19')]);}})[_0x86d8('0x1b')](function(_0x7b3a41){logger['error'](_0x86d8('0x18'),_0x3e51bf,_0x7b3a41);_0x542474(_0x7b3a41);});});}exports['CreateChatMessage']=function(_0xbc88e6){var _0x2c790a=this;return new Promise(function(_0x41ee44,_0x168410){return db[_0x86d8('0x1c')]['create'](_0xbc88e6[_0x86d8('0x1d')],{'raw':_0xbc88e6[_0x86d8('0x1e')]?_0xbc88e6[_0x86d8('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x32fa55){logger[_0x86d8('0x11')]('CreateChatMessage',_0xbc88e6);logger[_0x86d8('0x12')]('CreateChatMessage',_0xbc88e6,JSON[_0x86d8('0x15')](_0x32fa55));_0x41ee44(_0x32fa55);})[_0x86d8('0x1b')](function(_0x5a80d2){logger['error'](_0x86d8('0x1f'),_0x5a80d2['message'],_0xbc88e6);_0x168410(_0x2c790a[_0x86d8('0x16')](0x1f4,_0x5a80d2[_0x86d8('0x19')]));});});}; \ No newline at end of file +var _0x7166=['request\x20sent','error','code','ChatMessage,\x20%s,\x20%s','message','catch','ChatMessage','body','options','raw','CreateChatMessage','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register','request','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x382ed9,_0x523c26){var _0x20028c=function(_0x19580d){while(--_0x19580d){_0x382ed9['push'](_0x382ed9['shift']());}};_0x20028c(++_0x523c26);}(_0x7166,0x90));var _0x6716=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x7166[_0x4bd06e];return _0x85ebb;};'use strict';var _=require(_0x6716('0x0'));var util=require(_0x6716('0x1'));var moment=require(_0x6716('0x2'));var BPromise=require('bluebird');var rs=require(_0x6716('0x3'));var fs=require('fs');var Redis=require(_0x6716('0x4'));var db=require(_0x6716('0x5'))['db'];var utils=require(_0x6716('0x6'));var logger=require('../../config/logger')(_0x6716('0x7'));var config=require(_0x6716('0x8'));var jayson=require(_0x6716('0x9'));var client=jayson[_0x6716('0xa')][_0x6716('0xb')]({'port':0x232a});config[_0x6716('0xc')]=_[_0x6716('0xd')](config[_0x6716('0xc')],{'host':_0x6716('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6716('0xc')]));require(_0x6716('0xf'))[_0x6716('0x10')](socket);function respondWithRpcPromise(_0x392a19,_0x5d3e14,_0x3dbc74){return new BPromise(function(_0x42864c,_0x78d90d){return client[_0x6716('0x11')](_0x392a19,_0x3dbc74)['then'](function(_0x5a9a33){logger[_0x6716('0x12')]('ChatMessage,\x20%s,\x20%s',_0x5d3e14,'request\x20sent');logger[_0x6716('0x13')](_0x6716('0x14'),_0x5d3e14,_0x6716('0x15'),JSON['stringify'](_0x5a9a33));if(_0x5a9a33[_0x6716('0x16')]){if(_0x5a9a33[_0x6716('0x16')][_0x6716('0x17')]===0x1f4){logger[_0x6716('0x16')](_0x6716('0x18'),_0x5d3e14,_0x5a9a33[_0x6716('0x16')]['message']);return _0x78d90d(_0x5a9a33['error']['message']);}logger[_0x6716('0x16')](_0x6716('0x18'),_0x5d3e14,_0x5a9a33[_0x6716('0x16')][_0x6716('0x19')]);return _0x42864c(_0x5a9a33[_0x6716('0x16')][_0x6716('0x19')]);}else{logger[_0x6716('0x12')](_0x6716('0x18'),_0x5d3e14,'request\x20sent');_0x42864c(_0x5a9a33['result']['message']);}})[_0x6716('0x1a')](function(_0x200f3b){logger[_0x6716('0x16')](_0x6716('0x18'),_0x5d3e14,_0x200f3b);_0x78d90d(_0x200f3b);});});}exports['CreateChatMessage']=function(_0x340455){var _0x509843=this;return new Promise(function(_0x20053d,_0x497334){return db[_0x6716('0x1b')]['create'](_0x340455[_0x6716('0x1c')],{'raw':_0x340455[_0x6716('0x1d')]?_0x340455[_0x6716('0x1d')][_0x6716('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x289cb6){logger[_0x6716('0x12')](_0x6716('0x1f'),_0x340455);logger[_0x6716('0x13')](_0x6716('0x1f'),_0x340455,JSON[_0x6716('0x20')](_0x289cb6));_0x20053d(_0x289cb6);})[_0x6716('0x1a')](function(_0x35487f){logger[_0x6716('0x16')]('CreateChatMessage',_0x35487f['message'],_0x340455);_0x497334(_0x509843[_0x6716('0x16')](0x1f4,_0x35487f[_0x6716('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 0cf625e..ddf2e05 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 _0x7217=['chatMessage:','./chatMessage.events','remove','update','removeListener','register','length'];(function(_0x485feb,_0x4687f9){var _0x3013fd=function(_0x247283){while(--_0x247283){_0x485feb['push'](_0x485feb['shift']());}};_0x3013fd(++_0x4687f9);}(_0x7217,0x19e));var _0x7721=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x7217[_0x220dbb];return _0x2b77de;};'use strict';var ChatMessageEvents=require(_0x7721('0x0'));var events=['save',_0x7721('0x1'),_0x7721('0x2')];function createListener(_0x1de988,_0x2a78d8){return function(_0x115ab3){_0x2a78d8['emit'](_0x1de988,_0x115ab3);};}function removeListener(_0x5bf160,_0x472a96){return function(){ChatMessageEvents[_0x7721('0x3')](_0x5bf160,_0x472a96);};}exports[_0x7721('0x4')]=function(_0x3fe47c){for(var _0xb239e0=0x0,_0xf7ff37=events[_0x7721('0x5')];_0xb239e0<_0xf7ff37;_0xb239e0++){var _0x21f680=events[_0xb239e0];var _0x225610=createListener(_0x7721('0x6')+_0x21f680,_0x3fe47c);ChatMessageEvents['on'](_0x21f680,_0x225610);}}; \ No newline at end of file +var _0xcea5=['save','remove','update','emit','register','chatMessage:','./chatMessage.events'];(function(_0x1bc18a,_0x3b586d){var _0x2f9358=function(_0x34fcac){while(--_0x34fcac){_0x1bc18a['push'](_0x1bc18a['shift']());}};_0x2f9358(++_0x3b586d);}(_0xcea5,0xed));var _0x5cea=function(_0x3177f0,_0x5142dc){_0x3177f0=_0x3177f0-0x0;var _0x55414d=_0xcea5[_0x3177f0];return _0x55414d;};'use strict';var ChatMessageEvents=require(_0x5cea('0x0'));var events=[_0x5cea('0x1'),_0x5cea('0x2'),_0x5cea('0x3')];function createListener(_0x2c6970,_0x52a9b8){return function(_0x20a2d9){_0x52a9b8[_0x5cea('0x4')](_0x2c6970,_0x20a2d9);};}function removeListener(_0x382c21,_0x319dba){return function(){ChatMessageEvents['removeListener'](_0x382c21,_0x319dba);};}exports[_0x5cea('0x5')]=function(_0x31e6f3){for(var _0x599bc5=0x0,_0x49db13=events['length'];_0x599bc5<_0x49db13;_0x599bc5++){var _0x502d95=events[_0x599bc5];var _0x3b6fbc=createListener(_0x5cea('0x6')+_0x502d95,_0x31e6f3);ChatMessageEvents['on'](_0x502d95,_0x3b6fbc);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 715d022..1c4b178 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 _0xa82c=['fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x3908df,_0x5b8c1a){var _0x17a7ce=function(_0x469c30){while(--_0x469c30){_0x3908df['push'](_0x3908df['shift']());}};_0x17a7ce(++_0x5b8c1a);}(_0xa82c,0x182));var _0xca82=function(_0x130fb2,_0x2c76dc){_0x130fb2=_0x130fb2-0x0;var _0x3ffb77=_0xa82c[_0x130fb2];return _0x3ffb77;};'use strict';var multer=require(_0xca82('0x0'));var util=require(_0xca82('0x1'));var path=require(_0xca82('0x2'));var timeout=require(_0xca82('0x3'));var express=require(_0xca82('0x4'));var router=express[_0xca82('0x5')]();var fs_extra=require(_0xca82('0x6'));var auth=require(_0xca82('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xca82('0x8'));var controller=require(_0xca82('0x9'));router[_0xca82('0xa')]('/',auth[_0xca82('0xb')](),controller[_0xca82('0xc')]);router[_0xca82('0xa')](_0xca82('0xd'),auth['isAuthenticated'](),controller[_0xca82('0xe')]);router[_0xca82('0xa')](_0xca82('0xf'),auth['isAuthenticated'](),controller[_0xca82('0x10')]);router[_0xca82('0x11')]('/',auth[_0xca82('0xb')](),interaction[_0xca82('0x12')](_0xca82('0x13'),_0xca82('0x14')),controller[_0xca82('0x15')]);router[_0xca82('0x16')]('/:id',controller['update']);router[_0xca82('0x16')](_0xca82('0x17'),auth['isAuthenticated'](),controller[_0xca82('0x18')]);router['put']('/:id/reject',auth[_0xca82('0xb')](),controller[_0xca82('0x19')]);router[_0xca82('0x1a')](_0xca82('0xf'),auth[_0xca82('0xb')](),controller[_0xca82('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x5484=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','accept','reject','delete','destroy','exports'];(function(_0x4d901b,_0x5f4055){var _0x37166b=function(_0x4b47c6){while(--_0x4b47c6){_0x4d901b['push'](_0x4d901b['shift']());}};_0x37166b(++_0x5f4055);}(_0x5484,0x1ba));var _0x4548=function(_0x189e27,_0x3e45f2){_0x189e27=_0x189e27-0x0;var _0x49e893=_0x5484[_0x189e27];return _0x49e893;};'use strict';var multer=require(_0x4548('0x0'));var util=require('util');var path=require(_0x4548('0x1'));var timeout=require(_0x4548('0x2'));var express=require(_0x4548('0x3'));var router=express[_0x4548('0x4')]();var fs_extra=require(_0x4548('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4548('0x6'));var config=require('../../config/environment');var controller=require(_0x4548('0x7'));router[_0x4548('0x8')]('/',auth[_0x4548('0x9')](),controller[_0x4548('0xa')]);router[_0x4548('0x8')]('/describe',auth[_0x4548('0x9')](),controller[_0x4548('0xb')]);router[_0x4548('0x8')](_0x4548('0xc'),auth['isAuthenticated'](),controller[_0x4548('0xd')]);router[_0x4548('0xe')]('/',auth[_0x4548('0x9')](),interaction[_0x4548('0xf')](_0x4548('0x10'),_0x4548('0x11')),controller[_0x4548('0x12')]);router[_0x4548('0x13')](_0x4548('0xc'),controller[_0x4548('0x14')]);router['put']('/:id/accept',auth[_0x4548('0x9')](),controller[_0x4548('0x15')]);router[_0x4548('0x13')]('/:id/reject',auth[_0x4548('0x9')](),controller[_0x4548('0x16')]);router[_0x4548('0x17')](_0x4548('0xc'),auth[_0x4548('0x9')](),controller[_0x4548('0x18')]);module[_0x4548('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c7772bf..a0eae74 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 _0x5f66=['medium','TEXT','exports'];(function(_0xa910d4,_0x4a33b9){var _0x3eb349=function(_0x1d628b){while(--_0x1d628b){_0xa910d4['push'](_0xa910d4['shift']());}};_0x3eb349(++_0x4a33b9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x4908cb,_0xa5f2fe){var _0x5bd163=function(_0x514a8d){while(--_0x514a8d){_0x4908cb['push'](_0x4908cb['shift']());}};_0x5bd163(++_0xa5f2fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32c259,_0x101e64){_0x32c259=_0x32c259-0x0;var _0x4206bf=_0x5f2f[_0x32c259];return _0x4206bf;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index e14468e..99bcbb0 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(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x7a54,0x106));var _0x47a5=function(_0x33c957,_0x1bb267){_0x33c957=_0x33c957-0x0;var _0x3339c4=_0x7a54[_0x33c957];return _0x3339c4;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3d96e2,_0x6f46c6){var _0x459f64=function(_0x5414a2){while(--_0x5414a2){_0x3d96e2['push'](_0x3d96e2['shift']());}};_0x459f64(++_0x6f46c6);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index ce6114c..9bbbfb9 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 _0x0e50=['events','../../mysqldb','ChatOfflineMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x805b5,_0x210dd2){var _0x259373=function(_0x484f64){while(--_0x484f64){_0x805b5['push'](_0x805b5['shift']());}};_0x259373(++_0x210dd2);}(_0x0e50,0x168));var _0x00e5=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x0e50[_0x4ff09b];return _0x3f5c2e;};'use strict';var EventEmitter=require(_0x00e5('0x0'));var ChatOfflineMessage=require(_0x00e5('0x1'))['db'][_0x00e5('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x00e5('0x3'),'afterUpdate':_0x00e5('0x4'),'afterDestroy':_0x00e5('0x5')};function emitEvent(_0x12c933){return function(_0x3d2263,_0x4f38ad,_0x203d0e){ChatOfflineMessageEvents['emit'](_0x12c933+':'+_0x3d2263['id'],_0x3d2263);ChatOfflineMessageEvents[_0x00e5('0x6')](_0x12c933,_0x3d2263);_0x203d0e(null);};}for(var e in events){if(events[_0x00e5('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x00e5('0x8')](e,emitEvent(event));}}module[_0x00e5('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x72a4=['exports','../../mysqldb','ChatOfflineMessage','setMaxListeners','update','remove','emit','hook'];(function(_0x99a9dc,_0x35849c){var _0x49b9ab=function(_0x1419a5){while(--_0x1419a5){_0x99a9dc['push'](_0x99a9dc['shift']());}};_0x49b9ab(++_0x35849c);}(_0x72a4,0x191));var _0x472a=function(_0x31f2dc,_0x4b13bd){_0x31f2dc=_0x31f2dc-0x0;var _0x2359b2=_0x72a4[_0x31f2dc];return _0x2359b2;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x472a('0x0'))['db'][_0x472a('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x472a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x472a('0x3'),'afterDestroy':_0x472a('0x4')};function emitEvent(_0x1b5fc6){return function(_0x3c5f39,_0x3a238b,_0x40e22c){ChatOfflineMessageEvents[_0x472a('0x5')](_0x1b5fc6+':'+_0x3c5f39['id'],_0x3c5f39);ChatOfflineMessageEvents[_0x472a('0x5')](_0x1b5fc6,_0x3c5f39);_0x40e22c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x472a('0x6')](e,emitEvent(event));}}module[_0x472a('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index ef2bd48..234a53e 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 _0x652a=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x557945,_0x111c6a){var _0x45f23a=function(_0x5cba71){while(--_0x5cba71){_0x557945['push'](_0x557945['shift']());}};_0x45f23a(++_0x111c6a);}(_0x652a,0x1d5));var _0xa652=function(_0x448246,_0xc4bd77){_0x448246=_0x448246-0x0;var _0x99837d=_0x652a[_0x448246];return _0x99837d;};'use strict';var attributes=require(_0xa652('0x0'));module[_0xa652('0x1')]=function(_0xce64dd){return _0xce64dd[_0xa652('0x2')](_0xa652('0x3'),attributes,{'tableName':_0xa652('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa652('0x5'),'collate':_0xa652('0x6')});}; \ No newline at end of file +var _0x5fb6=['utf8mb4','./chatOfflineMessage.attributes','exports','define','chat_offline_messages'];(function(_0x56b878,_0x4be9aa){var _0x32b9ec=function(_0x1511ea){while(--_0x1511ea){_0x56b878['push'](_0x56b878['shift']());}};_0x32b9ec(++_0x4be9aa);}(_0x5fb6,0x178));var _0x65fb=function(_0x2761c5,_0x2587af){_0x2761c5=_0x2761c5-0x0;var _0x378f89=_0x5fb6[_0x2761c5];return _0x378f89;};'use strict';var attributes=require(_0x65fb('0x0'));module[_0x65fb('0x1')]=function(_0x5e470d){return _0x5e470d[_0x65fb('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x65fb('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x65fb('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 64366bb..e89a55c 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 _0x220b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util'];(function(_0x4b1b49,_0x5deb64){var _0x2329a9=function(_0x1a5fab){while(--_0x1a5fab){_0x4b1b49['push'](_0x4b1b49['shift']());}};_0x2329a9(++_0x5deb64);}(_0x220b,0x1b7));var _0xb220=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x220b[_0x494d1f];return _0x457b6e;};'use strict';var _=require('lodash');var util=require(_0xb220('0x0'));var moment=require(_0xb220('0x1'));var BPromise=require(_0xb220('0x2'));var rs=require(_0xb220('0x3'));var fs=require('fs');var Redis=require(_0xb220('0x4'));var db=require(_0xb220('0x5'))['db'];var utils=require(_0xb220('0x6'));var logger=require(_0xb220('0x7'))(_0xb220('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb220('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5943d3,_0x588e99,_0x4bde5e){return new BPromise(function(_0x49c4ea,_0x3dfe0a){return client[_0xb220('0xa')](_0x5943d3,_0x4bde5e)[_0xb220('0xb')](function(_0x11769a){logger['info'](_0xb220('0xc'),_0x588e99,_0xb220('0xd'));logger[_0xb220('0xe')](_0xb220('0xf'),_0x588e99,_0xb220('0xd'),JSON[_0xb220('0x10')](_0x11769a));if(_0x11769a['error']){if(_0x11769a[_0xb220('0x11')]['code']===0x1f4){logger[_0xb220('0x11')](_0xb220('0xc'),_0x588e99,_0x11769a[_0xb220('0x11')][_0xb220('0x12')]);return _0x3dfe0a(_0x11769a['error']['message']);}logger[_0xb220('0x11')](_0xb220('0xc'),_0x588e99,_0x11769a[_0xb220('0x11')][_0xb220('0x12')]);return _0x49c4ea(_0x11769a[_0xb220('0x11')][_0xb220('0x12')]);}else{logger[_0xb220('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x588e99,_0xb220('0xd'));_0x49c4ea(_0x11769a[_0xb220('0x14')][_0xb220('0x12')]);}})[_0xb220('0x15')](function(_0x1b5fcd){logger[_0xb220('0x11')](_0xb220('0xc'),_0x588e99,_0x1b5fcd);_0x3dfe0a(_0x1b5fcd);});});} \ No newline at end of file +var _0x400b=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2c5f78,_0x1a7b3c){var _0x2616c2=function(_0x5b9151){while(--_0x5b9151){_0x2c5f78['push'](_0x2c5f78['shift']());}};_0x2616c2(++_0x1a7b3c);}(_0x400b,0x1e5));var _0xb400=function(_0x2cbe3e,_0x398788){_0x2cbe3e=_0x2cbe3e-0x0;var _0x49d320=_0x400b[_0x2cbe3e];return _0x49d320;};'use strict';var _=require(_0xb400('0x0'));var util=require(_0xb400('0x1'));var moment=require(_0xb400('0x2'));var BPromise=require(_0xb400('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb400('0x4'));var db=require(_0xb400('0x5'))['db'];var utils=require(_0xb400('0x6'));var logger=require(_0xb400('0x7'))(_0xb400('0x8'));var config=require(_0xb400('0x9'));var jayson=require(_0xb400('0xa'));var client=jayson['client'][_0xb400('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x482574,_0xbb632c,_0x2c6b59){return new BPromise(function(_0x30e37c,_0x17c034){return client['request'](_0x482574,_0x2c6b59)['then'](function(_0x3e1b97){logger[_0xb400('0xc')](_0xb400('0xd'),_0xbb632c,'request\x20sent');logger[_0xb400('0xe')](_0xb400('0xf'),_0xbb632c,_0xb400('0x10'),JSON[_0xb400('0x11')](_0x3e1b97));if(_0x3e1b97[_0xb400('0x12')]){if(_0x3e1b97[_0xb400('0x12')][_0xb400('0x13')]===0x1f4){logger['error'](_0xb400('0xd'),_0xbb632c,_0x3e1b97[_0xb400('0x12')][_0xb400('0x14')]);return _0x17c034(_0x3e1b97[_0xb400('0x12')]['message']);}logger[_0xb400('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0xbb632c,_0x3e1b97[_0xb400('0x12')][_0xb400('0x14')]);return _0x30e37c(_0x3e1b97[_0xb400('0x12')][_0xb400('0x14')]);}else{logger[_0xb400('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0xbb632c,_0xb400('0x10'));_0x30e37c(_0x3e1b97['result'][_0xb400('0x14')]);}})[_0xb400('0x15')](function(_0x2f2de4){logger[_0xb400('0x12')](_0xb400('0xd'),_0xbb632c,_0x2f2de4);_0x17c034(_0x2f2de4);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 06b207b..8813270 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 _0x1a10=['/:id','show','post','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1a10,0x1e4));var _0x01a1=function(_0x372447,_0x192a78){_0x372447=_0x372447-0x0;var _0x4bbae2=_0x1a10[_0x372447];return _0x4bbae2;};'use strict';var multer=require(_0x01a1('0x0'));var util=require(_0x01a1('0x1'));var path=require(_0x01a1('0x2'));var timeout=require(_0x01a1('0x3'));var express=require(_0x01a1('0x4'));var router=express[_0x01a1('0x5')]();var fs_extra=require(_0x01a1('0x6'));var auth=require(_0x01a1('0x7'));var interaction=require(_0x01a1('0x8'));var config=require(_0x01a1('0x9'));var controller=require(_0x01a1('0xa'));router['get']('/',auth[_0x01a1('0xb')](),controller[_0x01a1('0xc')]);router[_0x01a1('0xd')](_0x01a1('0xe'),auth[_0x01a1('0xb')](),controller[_0x01a1('0xf')]);router[_0x01a1('0xd')](_0x01a1('0x10'),auth[_0x01a1('0xb')](),controller[_0x01a1('0x11')]);router[_0x01a1('0x12')]('/',auth[_0x01a1('0xb')](),controller['create']);router[_0x01a1('0x13')](_0x01a1('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x01a1('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x087a=['describe','/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x1cc364,_0x3f62b5){var _0x11bd5e=function(_0x35a21f){while(--_0x35a21f){_0x1cc364['push'](_0x1cc364['shift']());}};_0x11bd5e(++_0x3f62b5);}(_0x087a,0xd0));var _0xa087=function(_0x4e6e63,_0x46d1e6){_0x4e6e63=_0x4e6e63-0x0;var _0x52f08e=_0x087a[_0x4e6e63];return _0x52f08e;};'use strict';var multer=require(_0xa087('0x0'));var util=require('util');var path=require(_0xa087('0x1'));var timeout=require(_0xa087('0x2'));var express=require(_0xa087('0x3'));var router=express[_0xa087('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa087('0x5'));var config=require(_0xa087('0x6'));var controller=require(_0xa087('0x7'));router[_0xa087('0x8')]('/',auth[_0xa087('0x9')](),controller[_0xa087('0xa')]);router[_0xa087('0x8')](_0xa087('0xb'),auth[_0xa087('0x9')](),controller[_0xa087('0xc')]);router[_0xa087('0x8')](_0xa087('0xd'),auth[_0xa087('0x9')](),controller[_0xa087('0xe')]);router['post']('/',auth[_0xa087('0x9')](),controller[_0xa087('0xf')]);router[_0xa087('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa087('0x11')](_0xa087('0xd'),auth[_0xa087('0x9')](),controller[_0xa087('0x12')]);module[_0xa087('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 5bf5c9c..6262894 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 _0xb6c0=['mouseOver','timeout','exports','STRING','ENUM'];(function(_0x239cee,_0xf786c8){var _0x4fe6b6=function(_0x2d6a20){while(--_0x2d6a20){_0x239cee['push'](_0x239cee['shift']());}};_0x4fe6b6(++_0xf786c8);}(_0xb6c0,0x165));var _0x0b6c=function(_0x38f23b,_0xcda1a8){_0x38f23b=_0x38f23b-0x0;var _0x18cc03=_0xb6c0[_0x38f23b];return _0x18cc03;};'use strict';var Sequelize=require('sequelize');module[_0x0b6c('0x0')]={'name':{'type':Sequelize[_0x0b6c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0b6c('0x2')](_0x0b6c('0x3'),_0x0b6c('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x0b6c('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6cdd=['exports','STRING','timeout','mouseOver','INTEGER'];(function(_0x1b9d8c,_0x32ed07){var _0x4d09d0=function(_0xa5b28d){while(--_0xa5b28d){_0x1b9d8c['push'](_0x1b9d8c['shift']());}};_0x4d09d0(++_0x32ed07);}(_0x6cdd,0x195));var _0xd6cd=function(_0x5a8b5c,_0x333cc2){_0x5a8b5c=_0x5a8b5c-0x0;var _0x50fc5f=_0x6cdd[_0x5a8b5c];return _0x50fc5f;};'use strict';var Sequelize=require('sequelize');module[_0xd6cd('0x0')]={'name':{'type':Sequelize[_0xd6cd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0xd6cd('0x2')),'defaultValue':_0xd6cd('0x3')},'selector':{'type':Sequelize[_0xd6cd('0x1')]},'timeout':{'type':Sequelize[_0xd6cd('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 805e89b..df04516 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 _0x5900=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','find','catch','create','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash'];(function(_0x47eaba,_0x14825c){var _0x4ce103=function(_0x15988f){while(--_0x15988f){_0x47eaba['push'](_0x47eaba['shift']());}};_0x4ce103(++_0x14825c);}(_0x5900,0xd2));var _0x0590=function(_0x149653,_0x3bcd29){_0x149653=_0x149653-0x0;var _0x12bfff=_0x5900[_0x149653];return _0x12bfff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0590('0x0'));var zipdir=require(_0x0590('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0590('0x2'));var moment=require(_0x0590('0x3'));var BPromise=require(_0x0590('0x4'));var Mustache=require('mustache');var util=require(_0x0590('0x5'));var path=require(_0x0590('0x6'));var sox=require('sox');var csv=require(_0x0590('0x7'));var ejs=require(_0x0590('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0590('0x9'));var squel=require(_0x0590('0xa'));var crypto=require(_0x0590('0xb'));var jsforce=require(_0x0590('0xc'));var deskjs=require(_0x0590('0xd'));var toCsv=require(_0x0590('0x7'));var querystring=require(_0x0590('0xe'));var Papa=require(_0x0590('0xf'));var Redis=require(_0x0590('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0590('0x11'));var as=require(_0x0590('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0590('0x13'))(_0x0590('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0590('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd1125,_0x3af081){_0x3af081=_0x3af081||0xcc;return function(_0xbd1743){if(_0xbd1743){return _0xd1125[_0x0590('0x16')](_0x3af081);}return _0xd1125[_0x0590('0x17')](_0x3af081)['end']();};}function respondWithResult(_0x3e3847,_0x29a79f){_0x29a79f=_0x29a79f||0xc8;return function(_0x50e005){if(_0x50e005){return _0x3e3847[_0x0590('0x17')](_0x29a79f)[_0x0590('0x18')](_0x50e005);}};}function respondWithFilteredResult(_0x9568fb,_0x49ffd1){return function(_0x22d6e2){if(_0x22d6e2){var _0x492f85=typeof _0x49ffd1[_0x0590('0x19')]===_0x0590('0x1a')&&typeof _0x49ffd1[_0x0590('0x1b')]===_0x0590('0x1a');var _0x4b1bf2=_0x22d6e2[_0x0590('0x1c')];var _0x3ab6f8=_0x492f85?0x0:_0x49ffd1['offset'];var _0x5d3f4e=_0x492f85?_0x22d6e2[_0x0590('0x1c')]:_0x49ffd1[_0x0590('0x19')]+_0x49ffd1['limit'];var _0x7543c;if(_0x5d3f4e>=_0x4b1bf2){_0x5d3f4e=_0x4b1bf2;_0x7543c=0xc8;}else{_0x7543c=0xce;}_0x9568fb[_0x0590('0x17')](_0x7543c);return _0x9568fb[_0x0590('0x1d')]('Content-Range',_0x3ab6f8+'-'+_0x5d3f4e+'/'+_0x4b1bf2)['json'](_0x22d6e2);}return null;};}function patchUpdates(_0x2c2d31){return function(_0x5779bb){try{jsonpatch['apply'](_0x5779bb,_0x2c2d31,!![]);}catch(_0x659794){return BPromise[_0x0590('0x1e')](_0x659794);}return _0x5779bb[_0x0590('0x1f')]();};}function saveUpdates(_0x58b396,_0x58f498){return function(_0x470936){if(_0x470936){return _0x470936[_0x0590('0x20')](_0x58b396)[_0x0590('0x21')](function(_0x594e6e){return _0x594e6e;});}return null;};}function removeEntity(_0x2cd67e,_0x2921f9){return function(_0x3861b5){if(_0x3861b5){return _0x3861b5[_0x0590('0x22')]()[_0x0590('0x21')](function(){_0x2cd67e[_0x0590('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58f29d,_0x3fe7d6){return function(_0x50a76d){if(!_0x50a76d){_0x58f29d[_0x0590('0x16')](0x194);}return _0x50a76d;};}function handleError(_0x19dd3d,_0x318f2e){_0x318f2e=_0x318f2e||0x1f4;return function(_0x352b2a){logger['error'](_0x352b2a[_0x0590('0x23')]);if(_0x352b2a[_0x0590('0x24')]){delete _0x352b2a[_0x0590('0x24')];}_0x19dd3d[_0x0590('0x17')](_0x318f2e)[_0x0590('0x25')](_0x352b2a);};}exports['show']=function(_0xc5b3e6,_0x3c7677){var _0x26c110={'raw':!![],'where':{'id':_0xc5b3e6[_0x0590('0x26')]['id']}},_0x2c2e3a={};_0x2c2e3a[_0x0590('0x27')]=_[_0x0590('0x28')](db[_0x0590('0x29')][_0x0590('0x2a')]);_0x2c2e3a[_0x0590('0x2b')]=_[_0x0590('0x28')](_0xc5b3e6[_0x0590('0x2b')]);_0x2c2e3a['filters']=_[_0x0590('0x2c')](_0x2c2e3a[_0x0590('0x27')],_0x2c2e3a[_0x0590('0x2b')]);_0x26c110[_0x0590('0x2d')]=_[_0x0590('0x2c')](_0x2c2e3a[_0x0590('0x27')],qs[_0x0590('0x2e')](_0xc5b3e6[_0x0590('0x2b')][_0x0590('0x2e')]));_0x26c110[_0x0590('0x2d')]=_0x26c110[_0x0590('0x2d')][_0x0590('0x2f')]?_0x26c110[_0x0590('0x2d')]:_0x2c2e3a['model'];if(_0xc5b3e6[_0x0590('0x2b')][_0x0590('0x30')]){_0x26c110[_0x0590('0x31')]=[{'all':!![]}];}_0x26c110=_[_0x0590('0x32')]({},_0x26c110,_0xc5b3e6['options']);return db[_0x0590('0x29')][_0x0590('0x33')](_0x26c110)['then'](handleEntityNotFound(_0x3c7677,null))[_0x0590('0x21')](respondWithResult(_0x3c7677,null))[_0x0590('0x34')](handleError(_0x3c7677,null));};exports[_0x0590('0x35')]=function(_0x168399,_0x84baea){return db['ChatProactiveAction']['create'](_0x168399[_0x0590('0x36')],{})[_0x0590('0x21')](respondWithResult(_0x84baea,0xc9))['catch'](handleError(_0x84baea,null));};exports[_0x0590('0x20')]=function(_0xe89460,_0x3bb916){if(_0xe89460[_0x0590('0x36')]['id']){delete _0xe89460[_0x0590('0x36')]['id'];}return db['ChatProactiveAction'][_0x0590('0x33')]({'where':{'id':_0xe89460[_0x0590('0x26')]['id']}})[_0x0590('0x21')](handleEntityNotFound(_0x3bb916,null))[_0x0590('0x21')](saveUpdates(_0xe89460[_0x0590('0x36')],null))[_0x0590('0x21')](respondWithResult(_0x3bb916,null))[_0x0590('0x34')](handleError(_0x3bb916,null));};exports[_0x0590('0x22')]=function(_0x505db4,_0xe5a94a){return db[_0x0590('0x29')][_0x0590('0x33')]({'where':{'id':_0x505db4[_0x0590('0x26')]['id']}})[_0x0590('0x21')](handleEntityNotFound(_0xe5a94a,null))[_0x0590('0x21')](removeEntity(_0xe5a94a,null))[_0x0590('0x34')](handleError(_0xe5a94a,null));}; \ No newline at end of file +var _0xa3e6=['offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','ChatProactiveAction','keys','query','attributes','intersection','fields','merge','options','find','catch','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x49de28,_0x2751c){var _0x2ac8ed=function(_0x2ce603){while(--_0x2ce603){_0x49de28['push'](_0x49de28['shift']());}};_0x2ac8ed(++_0x2751c);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x50aa06,_0x3ec2de){_0x50aa06=_0x50aa06-0x0;var _0x2dc6d9=_0xa3e6[_0x50aa06];return _0x2dc6d9;};'use strict';var emlformat=require(_0x6a3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a3e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a3e('0x2'));var moment=require(_0x6a3e('0x3'));var BPromise=require(_0x6a3e('0x4'));var Mustache=require('mustache');var util=require(_0x6a3e('0x5'));var path=require('path');var sox=require(_0x6a3e('0x6'));var csv=require(_0x6a3e('0x7'));var ejs=require(_0x6a3e('0x8'));var fs=require('fs');var fs_extra=require(_0x6a3e('0x9'));var _=require(_0x6a3e('0xa'));var squel=require('squel');var crypto=require(_0x6a3e('0xb'));var jsforce=require(_0x6a3e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a3e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a3e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6a3e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a3e('0x10'))(_0x6a3e('0x11'));var utils=require(_0x6a3e('0x12'));var config=require(_0x6a3e('0x13'));var licenseUtil=require(_0x6a3e('0x14'));var db=require(_0x6a3e('0x15'))['db'];function respondWithStatusCode(_0x4a3a97,_0x27e169){_0x27e169=_0x27e169||0xcc;return function(_0x385c29){if(_0x385c29){return _0x4a3a97[_0x6a3e('0x16')](_0x27e169);}return _0x4a3a97[_0x6a3e('0x17')](_0x27e169)[_0x6a3e('0x18')]();};}function respondWithResult(_0x31aefa,_0x222f7c){_0x222f7c=_0x222f7c||0xc8;return function(_0x4bd05f){if(_0x4bd05f){return _0x31aefa[_0x6a3e('0x17')](_0x222f7c)[_0x6a3e('0x19')](_0x4bd05f);}};}function respondWithFilteredResult(_0x8ed74b,_0x2a62a8){return function(_0x500ccd){if(_0x500ccd){var _0x462b8d=typeof _0x2a62a8[_0x6a3e('0x1a')]==='undefined'&&typeof _0x2a62a8['limit']==='undefined';var _0x58b221=_0x500ccd['count'];var _0x3693a2=_0x462b8d?0x0:_0x2a62a8[_0x6a3e('0x1a')];var _0x31a190=_0x462b8d?_0x500ccd[_0x6a3e('0x1b')]:_0x2a62a8[_0x6a3e('0x1a')]+_0x2a62a8[_0x6a3e('0x1c')];var _0x1d6ccc;if(_0x31a190>=_0x58b221){_0x31a190=_0x58b221;_0x1d6ccc=0xc8;}else{_0x1d6ccc=0xce;}_0x8ed74b[_0x6a3e('0x17')](_0x1d6ccc);return _0x8ed74b['set'](_0x6a3e('0x1d'),_0x3693a2+'-'+_0x31a190+'/'+_0x58b221)['json'](_0x500ccd);}return null;};}function patchUpdates(_0xc0452f){return function(_0x5ae73b){try{jsonpatch[_0x6a3e('0x1e')](_0x5ae73b,_0xc0452f,!![]);}catch(_0x131d80){return BPromise[_0x6a3e('0x1f')](_0x131d80);}return _0x5ae73b[_0x6a3e('0x20')]();};}function saveUpdates(_0x58721c,_0x4f7507){return function(_0x215ac1){if(_0x215ac1){return _0x215ac1[_0x6a3e('0x21')](_0x58721c)[_0x6a3e('0x22')](function(_0x4687d0){return _0x4687d0;});}return null;};}function removeEntity(_0x4e5a25,_0x1ae966){return function(_0x21b5aa){if(_0x21b5aa){return _0x21b5aa[_0x6a3e('0x23')]()[_0x6a3e('0x22')](function(){_0x4e5a25[_0x6a3e('0x17')](0xcc)[_0x6a3e('0x18')]();});}};}function handleEntityNotFound(_0x359460,_0x83e681){return function(_0x25fc14){if(!_0x25fc14){_0x359460[_0x6a3e('0x16')](0x194);}return _0x25fc14;};}function handleError(_0x5b1ed9,_0x4ec834){_0x4ec834=_0x4ec834||0x1f4;return function(_0x150992){logger[_0x6a3e('0x24')](_0x150992[_0x6a3e('0x25')]);if(_0x150992[_0x6a3e('0x26')]){delete _0x150992[_0x6a3e('0x26')];}_0x5b1ed9[_0x6a3e('0x17')](_0x4ec834)[_0x6a3e('0x27')](_0x150992);};}exports[_0x6a3e('0x28')]=function(_0xd87198,_0x436169){var _0x3a831b={'raw':!![],'where':{'id':_0xd87198['params']['id']}},_0x508a55={};_0x508a55[_0x6a3e('0x29')]=_['keys'](db[_0x6a3e('0x2a')]['rawAttributes']);_0x508a55['query']=_[_0x6a3e('0x2b')](_0xd87198[_0x6a3e('0x2c')]);_0x508a55['filters']=_['intersection'](_0x508a55[_0x6a3e('0x29')],_0x508a55[_0x6a3e('0x2c')]);_0x3a831b[_0x6a3e('0x2d')]=_[_0x6a3e('0x2e')](_0x508a55['model'],qs['fields'](_0xd87198[_0x6a3e('0x2c')][_0x6a3e('0x2f')]));_0x3a831b[_0x6a3e('0x2d')]=_0x3a831b[_0x6a3e('0x2d')]['length']?_0x3a831b[_0x6a3e('0x2d')]:_0x508a55[_0x6a3e('0x29')];if(_0xd87198['query']['includeAll']){_0x3a831b['include']=[{'all':!![]}];}_0x3a831b=_[_0x6a3e('0x30')]({},_0x3a831b,_0xd87198[_0x6a3e('0x31')]);return db[_0x6a3e('0x2a')][_0x6a3e('0x32')](_0x3a831b)[_0x6a3e('0x22')](handleEntityNotFound(_0x436169,null))[_0x6a3e('0x22')](respondWithResult(_0x436169,null))[_0x6a3e('0x33')](handleError(_0x436169,null));};exports[_0x6a3e('0x34')]=function(_0x4044d0,_0x377226){return db[_0x6a3e('0x2a')][_0x6a3e('0x34')](_0x4044d0[_0x6a3e('0x35')],{})[_0x6a3e('0x22')](respondWithResult(_0x377226,0xc9))[_0x6a3e('0x33')](handleError(_0x377226,null));};exports['update']=function(_0x19d873,_0x38deb6){if(_0x19d873[_0x6a3e('0x35')]['id']){delete _0x19d873['body']['id'];}return db[_0x6a3e('0x2a')][_0x6a3e('0x32')]({'where':{'id':_0x19d873['params']['id']}})[_0x6a3e('0x22')](handleEntityNotFound(_0x38deb6,null))[_0x6a3e('0x22')](saveUpdates(_0x19d873[_0x6a3e('0x35')],null))['then'](respondWithResult(_0x38deb6,null))[_0x6a3e('0x33')](handleError(_0x38deb6,null));};exports[_0x6a3e('0x23')]=function(_0x37e523,_0x3e604c){return db[_0x6a3e('0x2a')][_0x6a3e('0x32')]({'where':{'id':_0x37e523['params']['id']}})[_0x6a3e('0x22')](handleEntityNotFound(_0x3e604c,null))['then'](removeEntity(_0x3e604c,null))['catch'](handleError(_0x3e604c,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6735c2e..2402d5f 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 _0xd80e=['moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api'];(function(_0x3aa9c7,_0x629939){var _0x4ed413=function(_0x496ac8){while(--_0x496ac8){_0x3aa9c7['push'](_0x3aa9c7['shift']());}};_0x4ed413(++_0x629939);}(_0xd80e,0x11d));var _0xed80=function(_0x1c8959,_0x128e5b){_0x1c8959=_0x1c8959-0x0;var _0x2888b8=_0xd80e[_0x1c8959];return _0x2888b8;};'use strict';var _=require('lodash');var util=require(_0xed80('0x0'));var logger=require(_0xed80('0x1'))(_0xed80('0x2'));var moment=require(_0xed80('0x3'));var BPromise=require(_0xed80('0x4'));var rp=require(_0xed80('0x5'));var fs=require('fs');var path=require(_0xed80('0x6'));var rimraf=require('rimraf');var config=require(_0xed80('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0xed80('0x8')]=function(_0x481a46,_0x25a499){return _0x481a46[_0xed80('0x9')](_0xed80('0xa'),attributes,{'tableName':_0xed80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac35=['../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xac35,0x10c));var _0x5ac3=function(_0x2d79be,_0x3e7c70){_0x2d79be=_0x2d79be-0x0;var _0x3e6c80=_0xac35[_0x2d79be];return _0x3e6c80;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var logger=require(_0x5ac3('0x2'))(_0x5ac3('0x3'));var moment=require(_0x5ac3('0x4'));var BPromise=require('bluebird');var rp=require(_0x5ac3('0x5'));var fs=require('fs');var path=require(_0x5ac3('0x6'));var rimraf=require('rimraf');var config=require(_0x5ac3('0x7'));var attributes=require(_0x5ac3('0x8'));module[_0x5ac3('0x9')]=function(_0x1e224c,_0x5462b3){return _0x1e224c['define'](_0x5ac3('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index bfcae42..9f08b45 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 _0x5e7f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x62b58e,_0x46fe1e){var _0x37fe84=function(_0x12a2ca){while(--_0x12a2ca){_0x62b58e['push'](_0x62b58e['shift']());}};_0x37fe84(++_0x46fe1e);}(_0x5e7f,0xb3));var _0xf5e7=function(_0x46387d,_0x492ba4){_0x46387d=_0x46387d-0x0;var _0x5c6f88=_0x5e7f[_0x46387d];return _0x5c6f88;};'use strict';var _=require(_0xf5e7('0x0'));var util=require(_0xf5e7('0x1'));var moment=require(_0xf5e7('0x2'));var BPromise=require(_0xf5e7('0x3'));var rs=require(_0xf5e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5e7('0x5'))['db'];var utils=require(_0xf5e7('0x6'));var logger=require(_0xf5e7('0x7'))(_0xf5e7('0x8'));var config=require(_0xf5e7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf5e7('0xa')][_0xf5e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6dd9,_0x2f2536,_0x96e6e3){return new BPromise(function(_0x324802,_0x4a4abf){return client['request'](_0x4c6dd9,_0x96e6e3)[_0xf5e7('0xc')](function(_0x456514){logger['info'](_0xf5e7('0xd'),_0x2f2536,'request\x20sent');logger[_0xf5e7('0xe')](_0xf5e7('0xf'),_0x2f2536,_0xf5e7('0x10'),JSON[_0xf5e7('0x11')](_0x456514));if(_0x456514[_0xf5e7('0x12')]){if(_0x456514[_0xf5e7('0x12')][_0xf5e7('0x13')]===0x1f4){logger[_0xf5e7('0x12')](_0xf5e7('0xd'),_0x2f2536,_0x456514[_0xf5e7('0x12')][_0xf5e7('0x14')]);return _0x4a4abf(_0x456514['error'][_0xf5e7('0x14')]);}logger[_0xf5e7('0x12')](_0xf5e7('0xd'),_0x2f2536,_0x456514[_0xf5e7('0x12')][_0xf5e7('0x14')]);return _0x324802(_0x456514['error'][_0xf5e7('0x14')]);}else{logger[_0xf5e7('0x15')]('ChatProactiveAction,\x20%s,\x20%s',_0x2f2536,_0xf5e7('0x10'));_0x324802(_0x456514[_0xf5e7('0x16')][_0xf5e7('0x14')]);}})['catch'](function(_0xc327c8){logger['error'](_0xf5e7('0xd'),_0x2f2536,_0xc327c8);_0x4a4abf(_0xc327c8);});});} \ No newline at end of file +var _0x62e3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','util','moment'];(function(_0x2f4748,_0x24af55){var _0x18eece=function(_0x489dd6){while(--_0x489dd6){_0x2f4748['push'](_0x2f4748['shift']());}};_0x18eece(++_0x24af55);}(_0x62e3,0x174));var _0x362e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x362e('0x0'));var moment=require(_0x362e('0x1'));var BPromise=require(_0x362e('0x2'));var rs=require(_0x362e('0x3'));var fs=require('fs');var Redis=require(_0x362e('0x4'));var db=require(_0x362e('0x5'))['db'];var utils=require(_0x362e('0x6'));var logger=require('../../config/logger')(_0x362e('0x7'));var config=require(_0x362e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x362e('0x9')][_0x362e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c984,_0x28d705,_0x3e5843){return new BPromise(function(_0x47745f,_0x3be5e0){return client['request'](_0x16c984,_0x3e5843)[_0x362e('0xb')](function(_0x3b5485){logger['info'](_0x362e('0xc'),_0x28d705,_0x362e('0xd'));logger[_0x362e('0xe')](_0x362e('0xf'),_0x28d705,_0x362e('0xd'),JSON[_0x362e('0x10')](_0x3b5485));if(_0x3b5485['error']){if(_0x3b5485['error'][_0x362e('0x11')]===0x1f4){logger[_0x362e('0x12')](_0x362e('0xc'),_0x28d705,_0x3b5485[_0x362e('0x12')]['message']);return _0x3be5e0(_0x3b5485[_0x362e('0x12')]['message']);}logger[_0x362e('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x28d705,_0x3b5485[_0x362e('0x12')][_0x362e('0x13')]);return _0x47745f(_0x3b5485[_0x362e('0x12')][_0x362e('0x13')]);}else{logger[_0x362e('0x14')](_0x362e('0xc'),_0x28d705,_0x362e('0xd'));_0x47745f(_0x3b5485['result'][_0x362e('0x13')]);}})[_0x362e('0x15')](function(_0x47a7f8){logger[_0x362e('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x28d705,_0x47a7f8);_0x3be5e0(_0x47a7f8);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 021931a..10b6307 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 _0xc4aa=['show','post','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x3c82e2,_0x4e376a){var _0x12a043=function(_0x4ccef5){while(--_0x4ccef5){_0x3c82e2['push'](_0x3c82e2['shift']());}};_0x12a043(++_0x4e376a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller[_0xac4a('0xb')]);router[_0xac4a('0xc')]('/',auth[_0xac4a('0xa')](),controller['create']);router['put'](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller[_0xac4a('0xd')]);router['delete'](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller[_0xac4a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','exports'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x2bd8,0x130));var _0x82bd=function(_0x419a15,_0x265401){_0x419a15=_0x419a15-0x0;var _0x22a0d8=_0x2bd8[_0x419a15];return _0x22a0d8;};'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')](_0x82bd('0xa'),auth['isAuthenticated'](),controller[_0x82bd('0xb')]);router[_0x82bd('0xc')]('/',auth[_0x82bd('0xd')](),controller[_0x82bd('0xe')]);router['put'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x82bd('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ecdc9fb..c67b73c 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 _0xddbb=['name','STRING','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x2d9579,_0x427cdf){var _0x3fb28c=function(_0x3fee20){while(--_0x3fee20){_0x2d9579['push'](_0x2d9579['shift']());}};_0x3fb28c(++_0x427cdf);}(_0xddbb,0x19b));var _0xbddb=function(_0x183872,_0x42fd36){_0x183872=_0x183872-0x0;var _0x15a657=_0xddbb[_0x183872];return _0x15a657;};'use strict';var Sequelize=require(_0xbddb('0x0'));module[_0xbddb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbddb('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbddb('0x3')]},'timeout':{'type':Sequelize[_0xbddb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbddb('0x5')](_0xbddb('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x1fca=['sequelize','STRING','INTEGER','ENUM','beepall','roundrobin'];(function(_0x286fbe,_0x48085b){var _0x16114e=function(_0x33bd6d){while(--_0x33bd6d){_0x286fbe['push'](_0x286fbe['shift']());}};_0x16114e(++_0x48085b);}(_0x1fca,0xde));var _0xa1fc=function(_0x492fcf,_0x3f025b){_0x492fcf=_0x492fcf-0x0;var _0x41007b=_0x1fca[_0x492fcf];return _0x41007b;};'use strict';var Sequelize=require(_0xa1fc('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1fc('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa1fc('0x1')]},'timeout':{'type':Sequelize[_0xa1fc('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa1fc('0x3')]('rrmemory',_0xa1fc('0x4'),_0xa1fc('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c02a018..3795f1c 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 _0xfa03=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserChatQueue','nolimit','order','ChatQueueId','User','chatPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','removeAgents','getAgents','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','destroy','ChatQueues','end','name','send','index','ChatQueue','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','keys','find','create'];(function(_0x17dffb,_0x365d85){var _0x36dc9b=function(_0x4b8de7){while(--_0x4b8de7){_0x17dffb['push'](_0x17dffb['shift']());}};_0x36dc9b(++_0x365d85);}(_0xfa03,0xe3));var _0x3fa0=function(_0x55b64f,_0x1a0650){_0x55b64f=_0x55b64f-0x0;var _0x1eeea5=_0xfa03[_0x55b64f];return _0x1eeea5;};'use strict';var emlformat=require(_0x3fa0('0x0'));var rimraf=require(_0x3fa0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fa0('0x2'));var rp=require(_0x3fa0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3fa0('0x4'));var util=require(_0x3fa0('0x5'));var path=require(_0x3fa0('0x6'));var sox=require(_0x3fa0('0x7'));var csv=require('to-csv');var ejs=require(_0x3fa0('0x8'));var fs=require('fs');var fs_extra=require(_0x3fa0('0x9'));var _=require(_0x3fa0('0xa'));var squel=require(_0x3fa0('0xb'));var crypto=require(_0x3fa0('0xc'));var jsforce=require(_0x3fa0('0xd'));var deskjs=require(_0x3fa0('0xe'));var toCsv=require(_0x3fa0('0xf'));var querystring=require(_0x3fa0('0x10'));var Papa=require(_0x3fa0('0x11'));var Redis=require(_0x3fa0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3fa0('0x13'));var as=require(_0x3fa0('0x14'));var hardwareService=require(_0x3fa0('0x15'));var logger=require(_0x3fa0('0x16'))(_0x3fa0('0x17'));var utils=require('../../config/utils');var config=require(_0x3fa0('0x18'));var licenseUtil=require(_0x3fa0('0x19'));var db=require(_0x3fa0('0x1a'))['db'];config[_0x3fa0('0x1b')]=_[_0x3fa0('0x1c')](config[_0x3fa0('0x1b')],{'host':_0x3fa0('0x1d'),'port':0x18eb});var socket=require(_0x3fa0('0x1e'))(new Redis(config['redis']));require(_0x3fa0('0x1f'))[_0x3fa0('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3fa0('0x21')][_0x3fa0('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3f123f,_0x19e420,_0x48e875,_0x8bf61f){return new BPromise(function(_0x252044,_0x251d0d){var _0x2c1543=_0x8bf61f||client;return _0x2c1543[_0x3fa0('0x23')](_0x3f123f,_0x48e875)[_0x3fa0('0x24')](function(_0x3c5845){logger[_0x3fa0('0x25')](_0x3fa0('0x26'),_0x19e420,_0x3fa0('0x27'));logger[_0x3fa0('0x28')](_0x3fa0('0x29'),_0x19e420,_0x3fa0('0x27'),JSON['stringify'](_0x3c5845));if(_0x3c5845[_0x3fa0('0x2a')]){if(_0x3c5845['error'][_0x3fa0('0x2b')]===0x1f4){logger[_0x3fa0('0x2a')](_0x3fa0('0x26'),_0x19e420,_0x3c5845[_0x3fa0('0x2a')][_0x3fa0('0x2c')]);return _0x251d0d(_0x3c5845['error'][_0x3fa0('0x2c')]);}logger[_0x3fa0('0x2a')](_0x3fa0('0x26'),_0x19e420,_0x3c5845[_0x3fa0('0x2a')]['message']);return _0x252044(_0x3c5845['error']['message']);}else{logger['info'](_0x3fa0('0x26'),_0x19e420,_0x3fa0('0x27'));_0x252044(_0x3c5845[_0x3fa0('0x2d')][_0x3fa0('0x2c')]);}})[_0x3fa0('0x2e')](function(_0x374843){logger[_0x3fa0('0x2a')](_0x3fa0('0x26'),_0x19e420,_0x374843);_0x251d0d(_0x374843);});});}function respondWithStatusCode(_0xfc77f2,_0x21ac0b){_0x21ac0b=_0x21ac0b||0xcc;return function(_0x588b8f){if(_0x588b8f){return _0xfc77f2[_0x3fa0('0x2f')](_0x21ac0b);}return _0xfc77f2[_0x3fa0('0x30')](_0x21ac0b)['end']();};}function respondWithResult(_0x4478b9,_0xdec09f){_0xdec09f=_0xdec09f||0xc8;return function(_0x3899a5){if(_0x3899a5){return _0x4478b9[_0x3fa0('0x30')](_0xdec09f)[_0x3fa0('0x31')](_0x3899a5);}};}function respondWithFilteredResult(_0x134b8b,_0x1f810c){return function(_0x574e61){if(_0x574e61){var _0x82f589=typeof _0x1f810c[_0x3fa0('0x32')]===_0x3fa0('0x33')&&typeof _0x1f810c['limit']==='undefined';var _0xc123bd=_0x574e61['count'];var _0xa9b1cd=_0x82f589?0x0:_0x1f810c['offset'];var _0x29629f=_0x82f589?_0x574e61[_0x3fa0('0x34')]:_0x1f810c[_0x3fa0('0x32')]+_0x1f810c['limit'];var _0x3152be;if(_0x29629f>=_0xc123bd){_0x29629f=_0xc123bd;_0x3152be=0xc8;}else{_0x3152be=0xce;}_0x134b8b['status'](_0x3152be);return _0x134b8b[_0x3fa0('0x35')](_0x3fa0('0x36'),_0xa9b1cd+'-'+_0x29629f+'/'+_0xc123bd)['json'](_0x574e61);}return null;};}function patchUpdates(_0xd0d16){return function(_0xf658e7){try{jsonpatch['apply'](_0xf658e7,_0xd0d16,!![]);}catch(_0x1256c4){return BPromise['reject'](_0x1256c4);}return _0xf658e7[_0x3fa0('0x37')]();};}function saveUpdates(_0x556613,_0x2cd5d7){return function(_0x2b27a2){if(_0x2b27a2){return _0x2b27a2[_0x3fa0('0x38')](_0x556613)[_0x3fa0('0x24')](function(_0xfbc291){return _0xfbc291;});}return null;};}function removeEntity(_0x560842,_0x33b22e){return function(_0x4c6a61){if(_0x4c6a61){return _0x4c6a61[_0x3fa0('0x39')]()[_0x3fa0('0x24')](function(){var _0x396d4d=_0x4c6a61['get']({'plain':!![]});var _0x4b606d=_0x3fa0('0x3a');return db['UserProfileResource'][_0x3fa0('0x39')]({'where':{'type':_0x4b606d,'resourceId':_0x396d4d['id']}})[_0x3fa0('0x24')](function(){return _0x4c6a61;});})[_0x3fa0('0x24')](function(){_0x560842['status'](0xcc)[_0x3fa0('0x3b')]();});}};}function handleEntityNotFound(_0x1969db,_0x3e1fee){return function(_0x1305fb){if(!_0x1305fb){_0x1969db[_0x3fa0('0x2f')](0x194);}return _0x1305fb;};}function handleError(_0x562642,_0x4ef6f){_0x4ef6f=_0x4ef6f||0x1f4;return function(_0x2e9de0){logger['error'](_0x2e9de0['stack']);if(_0x2e9de0[_0x3fa0('0x3c')]){delete _0x2e9de0[_0x3fa0('0x3c')];}_0x562642[_0x3fa0('0x30')](_0x4ef6f)[_0x3fa0('0x3d')](_0x2e9de0);};}exports[_0x3fa0('0x3e')]=function(_0x33fb3b,_0x169831){var _0x3964f7={},_0x46aeae={},_0x6dbdb2={'count':0x0,'rows':[]};var _0x4e3bdf=_['map'](db[_0x3fa0('0x3f')][_0x3fa0('0x40')],function(_0xc9ed09){return{'name':_0xc9ed09[_0x3fa0('0x41')],'type':_0xc9ed09['type'][_0x3fa0('0x42')]};});_0x46aeae[_0x3fa0('0x43')]=_[_0x3fa0('0x44')](_0x4e3bdf,_0x3fa0('0x3c'));_0x46aeae[_0x3fa0('0x45')]=_['keys'](_0x33fb3b['query']);_0x46aeae[_0x3fa0('0x46')]=_[_0x3fa0('0x47')](_0x46aeae[_0x3fa0('0x43')],_0x46aeae[_0x3fa0('0x45')]);_0x3964f7[_0x3fa0('0x48')]=_[_0x3fa0('0x47')](_0x46aeae[_0x3fa0('0x43')],qs['fields'](_0x33fb3b[_0x3fa0('0x45')][_0x3fa0('0x49')]));_0x3964f7[_0x3fa0('0x48')]=_0x3964f7[_0x3fa0('0x48')][_0x3fa0('0x4a')]?_0x3964f7[_0x3fa0('0x48')]:_0x46aeae[_0x3fa0('0x43')];if(!_0x33fb3b[_0x3fa0('0x45')][_0x3fa0('0x4b')]('nolimit')){_0x3964f7[_0x3fa0('0x4c')]=qs[_0x3fa0('0x4c')](_0x33fb3b[_0x3fa0('0x45')]['limit']);_0x3964f7['offset']=qs['offset'](_0x33fb3b[_0x3fa0('0x45')][_0x3fa0('0x32')]);}_0x3964f7['order']=qs[_0x3fa0('0x4d')](_0x33fb3b[_0x3fa0('0x45')][_0x3fa0('0x4d')]);_0x3964f7['where']=qs[_0x3fa0('0x46')](_[_0x3fa0('0x4e')](_0x33fb3b[_0x3fa0('0x45')],_0x46aeae[_0x3fa0('0x46')]),_0x4e3bdf);if(_0x33fb3b[_0x3fa0('0x45')][_0x3fa0('0x4f')]){_0x3964f7['where']=_['merge'](_0x3964f7[_0x3fa0('0x50')],{'$or':_['map'](_0x4e3bdf,function(_0xb2644){if(_0xb2644['type']!=='VIRTUAL'){var _0x3eb941={};_0x3eb941[_0xb2644['name']]={'$like':'%'+_0x33fb3b[_0x3fa0('0x45')][_0x3fa0('0x4f')]+'%'};return _0x3eb941;}})});}_0x3964f7=_[_0x3fa0('0x51')]({},_0x3964f7,_0x33fb3b[_0x3fa0('0x52')]);var _0x151c6b={'where':_0x3964f7[_0x3fa0('0x50')]};return db[_0x3fa0('0x3f')][_0x3fa0('0x34')](_0x151c6b)[_0x3fa0('0x24')](function(_0x2db895){_0x6dbdb2['count']=_0x2db895;if(_0x33fb3b[_0x3fa0('0x45')][_0x3fa0('0x53')]){_0x3964f7[_0x3fa0('0x54')]=[{'all':!![]}];}return db[_0x3fa0('0x3f')][_0x3fa0('0x55')](_0x3964f7);})[_0x3fa0('0x24')](function(_0x826152){_0x6dbdb2[_0x3fa0('0x56')]=_0x826152;return _0x6dbdb2;})[_0x3fa0('0x24')](respondWithFilteredResult(_0x169831,_0x3964f7))[_0x3fa0('0x2e')](handleError(_0x169831,null));};exports[_0x3fa0('0x57')]=function(_0x373330,_0x50d606){var _0x10a3d0={'raw':!![],'where':{'id':_0x373330['params']['id']}},_0x3074e6={};_0x3074e6['model']=_[_0x3fa0('0x58')](db['ChatQueue']['rawAttributes']);_0x3074e6['query']=_[_0x3fa0('0x58')](_0x373330[_0x3fa0('0x45')]);_0x3074e6[_0x3fa0('0x46')]=_['intersection'](_0x3074e6[_0x3fa0('0x43')],_0x3074e6[_0x3fa0('0x45')]);_0x10a3d0[_0x3fa0('0x48')]=_[_0x3fa0('0x47')](_0x3074e6[_0x3fa0('0x43')],qs[_0x3fa0('0x49')](_0x373330[_0x3fa0('0x45')]['fields']));_0x10a3d0[_0x3fa0('0x48')]=_0x10a3d0[_0x3fa0('0x48')][_0x3fa0('0x4a')]?_0x10a3d0[_0x3fa0('0x48')]:_0x3074e6[_0x3fa0('0x43')];if(_0x373330[_0x3fa0('0x45')]['includeAll']){_0x10a3d0[_0x3fa0('0x54')]=[{'all':!![]}];}_0x10a3d0=_[_0x3fa0('0x51')]({},_0x10a3d0,_0x373330[_0x3fa0('0x52')]);return db[_0x3fa0('0x3f')][_0x3fa0('0x59')](_0x10a3d0)[_0x3fa0('0x24')](handleEntityNotFound(_0x50d606,null))[_0x3fa0('0x24')](respondWithResult(_0x50d606,null))['catch'](handleError(_0x50d606,null));};exports['create']=function(_0x215f95,_0x96c88){return db['ChatQueue'][_0x3fa0('0x5a')](_0x215f95['body'],{})[_0x3fa0('0x24')](function(_0xcf5276){var _0x16144b=_0x215f95[_0x3fa0('0x5b')]['get']({'plain':!![]});if(!_0x16144b)throw new Error(_0x3fa0('0x5c'));if(_0x16144b[_0x3fa0('0x5d')]===_0x3fa0('0x5b')){var _0x4620f8=_0xcf5276[_0x3fa0('0x5e')]({'plain':!![]});var _0x39c5c9=_0x3fa0('0x3a');return db[_0x3fa0('0x5f')]['find']({'where':{'name':_0x39c5c9,'userProfileId':_0x16144b[_0x3fa0('0x60')]},'raw':!![]})[_0x3fa0('0x24')](function(_0x114628){if(_0x114628&&_0x114628[_0x3fa0('0x61')]===0x0){return db[_0x3fa0('0x62')][_0x3fa0('0x5a')]({'name':_0x4620f8[_0x3fa0('0x3c')],'resourceId':_0x4620f8['id'],'type':_0x114628[_0x3fa0('0x3c')],'sectionId':_0x114628['id']},{})['then'](function(){return _0xcf5276;});}else{return _0xcf5276;}})['catch'](function(_0x2da37f){logger[_0x3fa0('0x2a')](_0x3fa0('0x63'),_0x2da37f);throw _0x2da37f;});}return _0xcf5276;})['then'](respondWithResult(_0x96c88,0xc9))[_0x3fa0('0x2e')](handleError(_0x96c88,null));};exports[_0x3fa0('0x38')]=function(_0x47c868,_0x379392){if(_0x47c868[_0x3fa0('0x64')]['id']){delete _0x47c868[_0x3fa0('0x64')]['id'];}return db['ChatQueue'][_0x3fa0('0x59')]({'where':{'id':_0x47c868[_0x3fa0('0x65')]['id']}})[_0x3fa0('0x24')](handleEntityNotFound(_0x379392,null))['then'](saveUpdates(_0x47c868['body'],null))[_0x3fa0('0x24')](respondWithResult(_0x379392,null))[_0x3fa0('0x2e')](handleError(_0x379392,null));};exports[_0x3fa0('0x39')]=function(_0x420793,_0x483fdf){return db[_0x3fa0('0x3f')][_0x3fa0('0x59')]({'where':{'id':_0x420793[_0x3fa0('0x65')]['id']}})[_0x3fa0('0x24')](handleEntityNotFound(_0x483fdf,null))['then'](removeEntity(_0x483fdf,null))['catch'](handleError(_0x483fdf,null));};exports[_0x3fa0('0x66')]=function(_0x4a219e,_0x4a779f){return db['ChatQueue'][_0x3fa0('0x66')]()[_0x3fa0('0x24')](respondWithResult(_0x4a779f,null))[_0x3fa0('0x2e')](handleError(_0x4a779f,null));};exports[_0x3fa0('0x67')]=function(_0x17d96b,_0x5c954d,_0x48ab58){var _0x3b2a41={'raw':!![],'where':{}},_0x28adea={},_0x56d7f2;return db['ChatQueue'][_0x3fa0('0x68')]({'where':{'id':_0x17d96b[_0x3fa0('0x65')]['id']}})[_0x3fa0('0x24')](handleEntityNotFound(_0x5c954d,null))[_0x3fa0('0x24')](function(_0x552470){if(_0x552470){_0x56d7f2=_0x552470[_0x3fa0('0x5e')]({'plain':!![]});_0x28adea[_0x3fa0('0x43')]=_[_0x3fa0('0x58')](db[_0x3fa0('0x69')][_0x3fa0('0x40')]);_0x28adea[_0x3fa0('0x45')]=_[_0x3fa0('0x58')](_0x17d96b[_0x3fa0('0x45')]);_0x28adea[_0x3fa0('0x46')]=_['intersection'](_0x28adea[_0x3fa0('0x43')],_0x28adea[_0x3fa0('0x45')]);_0x3b2a41['attributes']=_['intersection'](_0x28adea[_0x3fa0('0x43')],qs[_0x3fa0('0x49')](_0x17d96b[_0x3fa0('0x45')][_0x3fa0('0x49')]));_0x3b2a41[_0x3fa0('0x48')]=_0x3b2a41[_0x3fa0('0x48')][_0x3fa0('0x4a')]?_0x3b2a41[_0x3fa0('0x48')]:_0x28adea[_0x3fa0('0x43')];if(!_0x17d96b[_0x3fa0('0x45')][_0x3fa0('0x4b')](_0x3fa0('0x6a'))){_0x3b2a41[_0x3fa0('0x4c')]=qs[_0x3fa0('0x4c')](_0x17d96b[_0x3fa0('0x45')]['limit']);_0x3b2a41[_0x3fa0('0x32')]=qs['offset'](_0x17d96b['query'][_0x3fa0('0x32')]);}_0x3b2a41[_0x3fa0('0x6b')]=qs[_0x3fa0('0x4d')](_0x17d96b[_0x3fa0('0x45')][_0x3fa0('0x4d')]);_0x3b2a41[_0x3fa0('0x50')]=qs[_0x3fa0('0x46')](_[_0x3fa0('0x4e')](_0x17d96b[_0x3fa0('0x45')],_0x28adea[_0x3fa0('0x46')]));_0x3b2a41[_0x3fa0('0x50')][_0x3fa0('0x6c')]=_0x552470['id'];if(_0x17d96b[_0x3fa0('0x45')][_0x3fa0('0x4f')]){_0x3b2a41[_0x3fa0('0x50')]=_[_0x3fa0('0x51')](_0x3b2a41[_0x3fa0('0x50')],{'$or':_[_0x3fa0('0x44')](_0x3b2a41[_0x3fa0('0x48')],function(_0x2d9150){var _0x3059f8={};_0x3059f8[_0x2d9150]={'$like':'%'+_0x17d96b[_0x3fa0('0x45')][_0x3fa0('0x4f')]+'%'};return _0x3059f8;})});}_0x3b2a41=_[_0x3fa0('0x51')]({},_0x3b2a41,_0x17d96b[_0x3fa0('0x52')]);return db['UserChatQueue'][_0x3fa0('0x55')](_0x3b2a41);}})[_0x3fa0('0x24')](function(_0x40d374){if(_0x40d374){return db[_0x3fa0('0x6d')]['findAndCountAll']({'where':{'id':_[_0x3fa0('0x44')](_0x40d374,'UserId'),'role':'agent'},'attributes':['id',_0x3fa0('0x3c'),_0x3fa0('0x6e'),_0x3fa0('0x6f'),_0x3fa0('0x70')]});}})['then'](function(_0x5324ab){if(_0x5324ab){return{'count':_0x5324ab['count'],'rows':_[_0x3fa0('0x44')](_0x5324ab[_0x3fa0('0x56')],function(_0x32ab3a){return{'membername':_0x32ab3a['name'],'UserId':_0x32ab3a['id'],'queue_name':_0x56d7f2[_0x3fa0('0x3c')],'ChatQueueId':_0x56d7f2['id'],'interface':util[_0x3fa0('0x71')](_0x3fa0('0x72'),_0x3fa0('0x73'),_0x32ab3a['name']),'penalty':0x0,'paused':_0x32ab3a['chatPause'],'createdAt':_0x32ab3a[_0x3fa0('0x70')],'updatedAt':_0x32ab3a[_0x3fa0('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3fa0('0x24')](respondWithFilteredResult(_0x5c954d,_0x3b2a41))['catch'](handleError(_0x5c954d,null));};exports['getTeams']=function(_0x5cae98,_0xd70ac7,_0x7f32f4){var _0x1ecf7e={};var _0x9fda1d={};var _0xd59d74;var _0x17f64d;return db[_0x3fa0('0x3f')]['findOne']({'where':{'id':_0x5cae98[_0x3fa0('0x65')]['id']}})['then'](handleEntityNotFound(_0xd70ac7,null))['then'](function(_0x15a29e){if(_0x15a29e){_0xd59d74=_0x15a29e;_0x9fda1d['model']=_[_0x3fa0('0x58')](db[_0x3fa0('0x74')][_0x3fa0('0x40')]);_0x9fda1d['query']=_[_0x3fa0('0x58')](_0x5cae98[_0x3fa0('0x45')]);_0x9fda1d[_0x3fa0('0x46')]=_[_0x3fa0('0x47')](_0x9fda1d[_0x3fa0('0x43')],_0x9fda1d[_0x3fa0('0x45')]);_0x1ecf7e[_0x3fa0('0x48')]=_[_0x3fa0('0x47')](_0x9fda1d[_0x3fa0('0x43')],qs[_0x3fa0('0x49')](_0x5cae98[_0x3fa0('0x45')][_0x3fa0('0x49')]));_0x1ecf7e['attributes']=_0x1ecf7e['attributes'][_0x3fa0('0x4a')]?_0x1ecf7e[_0x3fa0('0x48')]:_0x9fda1d['model'];_0x1ecf7e[_0x3fa0('0x6b')]=qs[_0x3fa0('0x4d')](_0x5cae98['query'][_0x3fa0('0x4d')]);_0x1ecf7e[_0x3fa0('0x50')]=qs[_0x3fa0('0x46')](_[_0x3fa0('0x4e')](_0x5cae98[_0x3fa0('0x45')],_0x9fda1d['filters']));if(_0x5cae98[_0x3fa0('0x45')]['filter']){_0x1ecf7e[_0x3fa0('0x50')]=_[_0x3fa0('0x51')](_0x1ecf7e['where'],{'$or':_['map'](_0x1ecf7e[_0x3fa0('0x48')],function(_0x4018e7){var _0x4094e1={};_0x4094e1[_0x4018e7]={'$like':'%'+_0x5cae98[_0x3fa0('0x45')][_0x3fa0('0x4f')]+'%'};return _0x4094e1;})});}_0x1ecf7e=_[_0x3fa0('0x51')]({},_0x1ecf7e,_0x5cae98['options']);return _0xd59d74[_0x3fa0('0x75')](_0x1ecf7e);}})[_0x3fa0('0x24')](function(_0x42a858){if(_0x42a858){_0x17f64d=_0x42a858[_0x3fa0('0x4a')];if(!_0x5cae98[_0x3fa0('0x45')]['hasOwnProperty'](_0x3fa0('0x6a'))){_0x1ecf7e[_0x3fa0('0x4c')]=qs[_0x3fa0('0x4c')](_0x5cae98[_0x3fa0('0x45')]['limit']);_0x1ecf7e[_0x3fa0('0x32')]=qs[_0x3fa0('0x32')](_0x5cae98['query'][_0x3fa0('0x32')]);}return _0xd59d74['getTeams'](_0x1ecf7e);}})['then'](function(_0x428650){if(_0x428650){return _0x428650?{'count':_0x17f64d,'rows':_0x428650}:null;}})['then'](respondWithResult(_0xd70ac7,null))['catch'](handleError(_0xd70ac7,null));};exports['addTeams']=function(_0x5841e3,_0x374108,_0x501d4c){var _0x23752e=_0x5841e3['body']['ids'];return db['Team'][_0x3fa0('0x55')]({'where':{'id':_0x23752e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3fa0('0x76'),'attributes':['id',_0x3fa0('0x3c'),_0x3fa0('0x77'),_0x3fa0('0x78'),_0x3fa0('0x79')],'raw':!![]}]})[_0x3fa0('0x24')](function(_0x1c7d28){if(_0x1c7d28){var _0x56a3b6=_[_0x3fa0('0x7a')](_0x1c7d28,function(_0x451cfe){var _0x4798d3=_0x451cfe[_0x3fa0('0x5e')]({'plain':!![]});return _0x4798d3[_0x3fa0('0x76')];});return db[_0x3fa0('0x3f')]['find']({'where':{'id':_0x5841e3[_0x3fa0('0x65')]['id']}})[_0x3fa0('0x24')](function(_0x583b4f){return db[_0x3fa0('0x7b')][_0x3fa0('0x7c')](function(_0x14dfc5){return _0x583b4f['addTeams'](_0x23752e,{'transaction':_0x14dfc5})[_0x3fa0('0x24')](function(){return BPromise[_0x3fa0('0x7d')](_0x56a3b6,function(_0x492b73){return db[_0x3fa0('0x69')][_0x3fa0('0x7e')]({'where':{'UserId':_0x492b73['id'],'ChatQueueId':_0x5841e3[_0x3fa0('0x65')]['id']},'transaction':_0x14dfc5});});})['then'](function(){_0x56a3b6[_0x3fa0('0x7f')](function(_0x1808b4){socket[_0x3fa0('0x80')]('userChatQueue:save',{'UserId':_0x1808b4['id'],'ChatQueueId':_0x583b4f['id']});});});});});}})[_0x3fa0('0x24')](respondWithStatusCode(_0x374108,null))['catch'](handleError(_0x374108,null));};exports[_0x3fa0('0x81')]=function(_0x341022,_0x2b359d,_0x47be59){return db['Team'][_0x3fa0('0x55')]({'where':{'id':_0x341022[_0x3fa0('0x45')][_0x3fa0('0x82')]},'attributes':['id'],'include':[{'model':db[_0x3fa0('0x6d')],'as':_0x3fa0('0x76'),'attributes':['id'],'raw':!![]}]})[_0x3fa0('0x24')](handleEntityNotFound(_0x2b359d,null))['then'](function(_0x6120dc){var _0x34b0e6=_['map'](_0x6120dc,'id');var _0x2291ba=[];var _0x5ef7d8=[];var _0x36de56=squel[_0x3fa0('0x83')]();_0x36de56[_0x3fa0('0x84')](_0x3fa0('0x85'))[_0x3fa0('0x86')](_0x3fa0('0x87'),'tq')[_0x3fa0('0x88')]('user_has_teams','ut',_0x3fa0('0x89'))[_0x3fa0('0x50')](_0x3fa0('0x8a'),_0x341022['params']['id']);for(var _0x1d79a8=0x0;_0x1d79a8<_0x6120dc[_0x3fa0('0x4a')];_0x1d79a8+=0x1){let _0x5359cc=_0x6120dc[_0x1d79a8];for(var _0x362e95=0x0;_0x362e95<_0x5359cc[_0x3fa0('0x76')][_0x3fa0('0x4a')];_0x362e95+=0x1){let _0x34df42=_0x5359cc[_0x3fa0('0x76')][_0x362e95];var _0x4429d4=_0x36de56[_0x3fa0('0x8b')]();_0x4429d4[_0x3fa0('0x50')](_0x3fa0('0x8c'),_0x34df42['id']);_0x5ef7d8[_0x3fa0('0x8d')](db[_0x3fa0('0x7b')]['query'](_0x4429d4[_0x3fa0('0x8e')](),{'type':db[_0x3fa0('0x7b')][_0x3fa0('0x8f')][_0x3fa0('0x90')]})[_0x3fa0('0x24')](function(_0xcc7895){if(_0xcc7895['length']===0x1){return _0x34df42['id'];}else{var _0x24c5a1=_[_0x3fa0('0x91')](_[_0x3fa0('0x44')](_0xcc7895,_0x3fa0('0x92')),function(_0x41b724){return _['includes'](_0x34b0e6,_0x41b724);});if(_0x24c5a1){return _0x34df42['id'];}}}));}}return BPromise[_0x3fa0('0x93')](_0x5ef7d8)['then'](function(_0x173a89){_0x2291ba=_(_0x2291ba)[_0x3fa0('0x94')](_0x173a89)[_0x3fa0('0x95')]()[_0x3fa0('0x96')]();return db[_0x3fa0('0x3f')]['find']({'where':{'id':_0x341022['params']['id']}})[_0x3fa0('0x24')](function(_0xc0c00d){return db[_0x3fa0('0x7b')][_0x3fa0('0x7c')](function(_0x3fcc34){return _0xc0c00d['removeTeams'](_0x341022[_0x3fa0('0x45')]['ids'],{'transaction':_0x3fcc34})['then'](function(){if(!_[_0x3fa0('0x97')](_0x2291ba)){return _0xc0c00d['removeAgents'](_0x2291ba,{'transaction':_0x3fcc34});}})[_0x3fa0('0x24')](function(){_0x2291ba[_0x3fa0('0x7f')](function(_0x17d202){socket[_0x3fa0('0x80')](_0x3fa0('0x98'),{'UserId':_0x17d202,'ChatQueueId':_0xc0c00d['id']});});});});});});})[_0x3fa0('0x24')](respondWithStatusCode(_0x2b359d,null))[_0x3fa0('0x2e')](handleError(_0x2b359d,null));};exports['addAgents']=function(_0x28a4a6,_0x4cb6b1,_0x264cc6){return db[_0x3fa0('0x3f')][_0x3fa0('0x59')]({'where':{'id':_0x28a4a6[_0x3fa0('0x65')]['id']}})['then'](handleEntityNotFound(_0x4cb6b1,null))[_0x3fa0('0x24')](function(_0x56fa86){if(_0x56fa86){return _0x56fa86[_0x3fa0('0x99')](_0x28a4a6[_0x3fa0('0x64')][_0x3fa0('0x82')],_[_0x3fa0('0x9a')](_0x28a4a6[_0x3fa0('0x64')],[_0x3fa0('0x82'),'id'])||{})[_0x3fa0('0x9b')](function(_0xb0213c){for(var _0x22b99e=0x0;_0x22b99e<_0x28a4a6[_0x3fa0('0x64')][_0x3fa0('0x82')][_0x3fa0('0x4a')];_0x22b99e+=0x1){socket[_0x3fa0('0x80')](_0x3fa0('0x9c'),{'UserId':Number(_0x28a4a6[_0x3fa0('0x64')][_0x3fa0('0x82')][_0x22b99e]),'ChatQueueId':Number(_0x28a4a6[_0x3fa0('0x65')]['id'])});}return _0xb0213c;});}})[_0x3fa0('0x24')](respondWithResult(_0x4cb6b1,null))[_0x3fa0('0x2e')](handleError(_0x4cb6b1,null));};exports[_0x3fa0('0x9d')]=function(_0x279b5a,_0x5b6d15,_0x1ad83f){return db['ChatQueue'][_0x3fa0('0x59')]({'where':{'id':_0x279b5a['params']['id']}})['then'](handleEntityNotFound(_0x5b6d15,null))[_0x3fa0('0x24')](function(_0x1c142f){if(_0x1c142f){return _0x1c142f['removeAgents'](_0x279b5a[_0x3fa0('0x45')][_0x3fa0('0x82')])[_0x3fa0('0x24')](function(){if(_['isArray'](_0x279b5a[_0x3fa0('0x45')][_0x3fa0('0x82')])){for(var _0x44a1f8=0x0;_0x44a1f8<_0x279b5a[_0x3fa0('0x45')]['ids']['length'];_0x44a1f8+=0x1){socket[_0x3fa0('0x80')](_0x3fa0('0x98'),{'UserId':Number(_0x279b5a['query'][_0x3fa0('0x82')][_0x44a1f8]),'ChatQueueId':Number(_0x279b5a[_0x3fa0('0x65')]['id'])});}}else{socket['emit'](_0x3fa0('0x98'),{'UserId':Number(_0x279b5a[_0x3fa0('0x45')][_0x3fa0('0x82')]),'ChatQueueId':Number(_0x279b5a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5b6d15,null))[_0x3fa0('0x2e')](handleError(_0x5b6d15,null));};exports[_0x3fa0('0x9e')]=function(_0x3587bd,_0x402035,_0x39fa2e){var _0x6e408f={};var _0x2e8739={};var _0x4b5c38;var _0x816468;return db[_0x3fa0('0x3f')]['findOne']({'where':{'id':_0x3587bd['params']['id']}})[_0x3fa0('0x24')](handleEntityNotFound(_0x402035,null))[_0x3fa0('0x24')](function(_0x32ceb2){if(_0x32ceb2){_0x4b5c38=_0x32ceb2;_0x2e8739[_0x3fa0('0x43')]=_['keys'](db[_0x3fa0('0x6d')][_0x3fa0('0x40')]);_0x2e8739[_0x3fa0('0x45')]=_['keys'](_0x3587bd[_0x3fa0('0x45')]);_0x2e8739['filters']=_[_0x3fa0('0x47')](_0x2e8739[_0x3fa0('0x43')],_0x2e8739[_0x3fa0('0x45')]);_0x6e408f[_0x3fa0('0x48')]=_[_0x3fa0('0x47')](_0x2e8739[_0x3fa0('0x43')],qs[_0x3fa0('0x49')](_0x3587bd['query'][_0x3fa0('0x49')]));_0x6e408f[_0x3fa0('0x48')]=_0x6e408f[_0x3fa0('0x48')][_0x3fa0('0x4a')]?_0x6e408f[_0x3fa0('0x48')]:_0x2e8739['model'];_0x6e408f['order']=qs[_0x3fa0('0x4d')](_0x3587bd[_0x3fa0('0x45')][_0x3fa0('0x4d')]);_0x6e408f[_0x3fa0('0x50')]=qs[_0x3fa0('0x46')](_[_0x3fa0('0x4e')](_0x3587bd['query'],_0x2e8739[_0x3fa0('0x46')]));if(_0x3587bd['query'][_0x3fa0('0x4f')]){_0x6e408f[_0x3fa0('0x50')]=_[_0x3fa0('0x51')](_0x6e408f['where'],{'$or':_[_0x3fa0('0x44')](_0x6e408f[_0x3fa0('0x48')],function(_0x14dabf){var _0x523e32={};_0x523e32[_0x14dabf]={'$like':'%'+_0x3587bd[_0x3fa0('0x45')][_0x3fa0('0x4f')]+'%'};return _0x523e32;})});}_0x6e408f=_[_0x3fa0('0x51')]({},_0x6e408f,_0x3587bd[_0x3fa0('0x52')]);return _0x4b5c38[_0x3fa0('0x9e')](_0x6e408f);}})[_0x3fa0('0x24')](function(_0x19bc5e){if(_0x19bc5e){_0x816468=_0x19bc5e[_0x3fa0('0x4a')];if(!_0x3587bd[_0x3fa0('0x45')]['hasOwnProperty'](_0x3fa0('0x6a'))){_0x6e408f[_0x3fa0('0x4c')]=qs[_0x3fa0('0x4c')](_0x3587bd[_0x3fa0('0x45')][_0x3fa0('0x4c')]);_0x6e408f[_0x3fa0('0x32')]=qs['offset'](_0x3587bd[_0x3fa0('0x45')][_0x3fa0('0x32')]);}return _0x4b5c38['getAgents'](_0x6e408f);}})[_0x3fa0('0x24')](function(_0x1463d9){if(_0x1463d9){return _0x1463d9?{'count':_0x816468,'rows':_0x1463d9}:null;}})['then'](respondWithResult(_0x402035,null))[_0x3fa0('0x2e')](handleError(_0x402035,null));}; \ No newline at end of file +var _0x9a21=['value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatQueue','includeAll','include','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','UserChatQueue','hasOwnProperty','ChatQueueId','options','User','UserId','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','findAll','Agents','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','union'];(function(_0x451052,_0x211e27){var _0x50df1b=function(_0x315764){while(--_0x315764){_0x451052['push'](_0x451052['shift']());}};_0x50df1b(++_0x211e27);}(_0x9a21,0x12f));var _0x19a2=function(_0x4f0b22,_0x586aa8){_0x4f0b22=_0x4f0b22-0x0;var _0x5c545e=_0x9a21[_0x4f0b22];return _0x5c545e;};'use strict';var emlformat=require(_0x19a2('0x0'));var rimraf=require(_0x19a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x19a2('0x2'));var moment=require('moment');var BPromise=require(_0x19a2('0x3'));var Mustache=require(_0x19a2('0x4'));var util=require(_0x19a2('0x5'));var path=require(_0x19a2('0x6'));var sox=require(_0x19a2('0x7'));var csv=require('to-csv');var ejs=require(_0x19a2('0x8'));var fs=require('fs');var fs_extra=require(_0x19a2('0x9'));var _=require('lodash');var squel=require(_0x19a2('0xa'));var crypto=require('crypto');var jsforce=require(_0x19a2('0xb'));var deskjs=require(_0x19a2('0xc'));var toCsv=require(_0x19a2('0xd'));var querystring=require(_0x19a2('0xe'));var Papa=require(_0x19a2('0xf'));var Redis=require(_0x19a2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19a2('0x11'));var logger=require(_0x19a2('0x12'))(_0x19a2('0x13'));var utils=require('../../config/utils');var config=require(_0x19a2('0x14'));var licenseUtil=require(_0x19a2('0x15'));var db=require(_0x19a2('0x16'))['db'];config['redis']=_[_0x19a2('0x17')](config[_0x19a2('0x18')],{'host':_0x19a2('0x19'),'port':0x18eb});var socket=require(_0x19a2('0x1a'))(new Redis(config[_0x19a2('0x18')]));require(_0x19a2('0x1b'))[_0x19a2('0x1c')](socket);var jayson=require(_0x19a2('0x1d'));var client=jayson[_0x19a2('0x1e')][_0x19a2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1fd343,_0x38c9d6,_0x1b4dd3,_0x7bccf7){return new BPromise(function(_0x1178cf,_0x1672fd){var _0x5afed7=_0x7bccf7||client;return _0x5afed7['request'](_0x1fd343,_0x1b4dd3)['then'](function(_0x36bf41){logger[_0x19a2('0x20')](_0x19a2('0x21'),_0x38c9d6,_0x19a2('0x22'));logger[_0x19a2('0x23')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x38c9d6,'request\x20sent',JSON['stringify'](_0x36bf41));if(_0x36bf41[_0x19a2('0x24')]){if(_0x36bf41[_0x19a2('0x24')][_0x19a2('0x25')]===0x1f4){logger[_0x19a2('0x24')](_0x19a2('0x21'),_0x38c9d6,_0x36bf41[_0x19a2('0x24')]['message']);return _0x1672fd(_0x36bf41['error'][_0x19a2('0x26')]);}logger[_0x19a2('0x24')](_0x19a2('0x21'),_0x38c9d6,_0x36bf41['error']['message']);return _0x1178cf(_0x36bf41['error'][_0x19a2('0x26')]);}else{logger[_0x19a2('0x20')](_0x19a2('0x21'),_0x38c9d6,_0x19a2('0x22'));_0x1178cf(_0x36bf41['result']['message']);}})[_0x19a2('0x27')](function(_0x18717b){logger[_0x19a2('0x24')](_0x19a2('0x21'),_0x38c9d6,_0x18717b);_0x1672fd(_0x18717b);});});}function respondWithStatusCode(_0x10216f,_0x445194){_0x445194=_0x445194||0xcc;return function(_0x1bb75d){if(_0x1bb75d){return _0x10216f[_0x19a2('0x28')](_0x445194);}return _0x10216f['status'](_0x445194)['end']();};}function respondWithResult(_0x4808b9,_0x2b5695){_0x2b5695=_0x2b5695||0xc8;return function(_0x11d3c2){if(_0x11d3c2){return _0x4808b9[_0x19a2('0x29')](_0x2b5695)[_0x19a2('0x2a')](_0x11d3c2);}};}function respondWithFilteredResult(_0x441a96,_0x33ba56){return function(_0x4b1a56){if(_0x4b1a56){var _0x41a8f1=typeof _0x33ba56['offset']==='undefined'&&typeof _0x33ba56[_0x19a2('0x2b')]===_0x19a2('0x2c');var _0x5d031d=_0x4b1a56[_0x19a2('0x2d')];var _0xe06d6c=_0x41a8f1?0x0:_0x33ba56[_0x19a2('0x2e')];var _0x1d4b3b=_0x41a8f1?_0x4b1a56[_0x19a2('0x2d')]:_0x33ba56[_0x19a2('0x2e')]+_0x33ba56[_0x19a2('0x2b')];var _0x15d179;if(_0x1d4b3b>=_0x5d031d){_0x1d4b3b=_0x5d031d;_0x15d179=0xc8;}else{_0x15d179=0xce;}_0x441a96['status'](_0x15d179);return _0x441a96[_0x19a2('0x2f')](_0x19a2('0x30'),_0xe06d6c+'-'+_0x1d4b3b+'/'+_0x5d031d)[_0x19a2('0x2a')](_0x4b1a56);}return null;};}function patchUpdates(_0x5a94e9){return function(_0x486030){try{jsonpatch['apply'](_0x486030,_0x5a94e9,!![]);}catch(_0x5254c1){return BPromise[_0x19a2('0x31')](_0x5254c1);}return _0x486030[_0x19a2('0x32')]();};}function saveUpdates(_0x2c4583,_0x36e8c5){return function(_0x6b5a01){if(_0x6b5a01){return _0x6b5a01[_0x19a2('0x33')](_0x2c4583)[_0x19a2('0x34')](function(_0x16d0b5){return _0x16d0b5;});}return null;};}function removeEntity(_0x5d68ac,_0x31d4dc){return function(_0x529e6b){if(_0x529e6b){return _0x529e6b[_0x19a2('0x35')]()['then'](function(){var _0x2fa11a=_0x529e6b[_0x19a2('0x36')]({'plain':!![]});var _0x32c417=_0x19a2('0x37');return db[_0x19a2('0x38')][_0x19a2('0x35')]({'where':{'type':_0x32c417,'resourceId':_0x2fa11a['id']}})[_0x19a2('0x34')](function(){return _0x529e6b;});})['then'](function(){_0x5d68ac[_0x19a2('0x29')](0xcc)[_0x19a2('0x39')]();});}};}function handleEntityNotFound(_0x5ea584,_0x43b8a0){return function(_0x471535){if(!_0x471535){_0x5ea584['sendStatus'](0x194);}return _0x471535;};}function handleError(_0xbacec5,_0x271da1){_0x271da1=_0x271da1||0x1f4;return function(_0x1480ea){logger['error'](_0x1480ea[_0x19a2('0x3a')]);if(_0x1480ea[_0x19a2('0x3b')]){delete _0x1480ea['name'];}_0xbacec5[_0x19a2('0x29')](_0x271da1)[_0x19a2('0x3c')](_0x1480ea);};}exports[_0x19a2('0x3d')]=function(_0x3bb662,_0x2725f1){var _0x524b5f={},_0x47e617={},_0x34b099={'count':0x0,'rows':[]};var _0x58ae3d=_[_0x19a2('0x3e')](db['ChatQueue'][_0x19a2('0x3f')],function(_0x54c847){return{'name':_0x54c847[_0x19a2('0x40')],'type':_0x54c847[_0x19a2('0x41')]['key']};});_0x47e617[_0x19a2('0x42')]=_[_0x19a2('0x3e')](_0x58ae3d,'name');_0x47e617[_0x19a2('0x43')]=_[_0x19a2('0x44')](_0x3bb662[_0x19a2('0x43')]);_0x47e617[_0x19a2('0x45')]=_[_0x19a2('0x46')](_0x47e617[_0x19a2('0x42')],_0x47e617[_0x19a2('0x43')]);_0x524b5f[_0x19a2('0x47')]=_[_0x19a2('0x46')](_0x47e617['model'],qs['fields'](_0x3bb662[_0x19a2('0x43')][_0x19a2('0x48')]));_0x524b5f[_0x19a2('0x47')]=_0x524b5f[_0x19a2('0x47')][_0x19a2('0x49')]?_0x524b5f[_0x19a2('0x47')]:_0x47e617['model'];if(!_0x3bb662[_0x19a2('0x43')]['hasOwnProperty'](_0x19a2('0x4a'))){_0x524b5f[_0x19a2('0x2b')]=qs[_0x19a2('0x2b')](_0x3bb662[_0x19a2('0x43')][_0x19a2('0x2b')]);_0x524b5f['offset']=qs['offset'](_0x3bb662['query'][_0x19a2('0x2e')]);}_0x524b5f[_0x19a2('0x4b')]=qs[_0x19a2('0x4c')](_0x3bb662[_0x19a2('0x43')][_0x19a2('0x4c')]);_0x524b5f[_0x19a2('0x4d')]=qs[_0x19a2('0x45')](_[_0x19a2('0x4e')](_0x3bb662[_0x19a2('0x43')],_0x47e617[_0x19a2('0x45')]),_0x58ae3d);if(_0x3bb662[_0x19a2('0x43')][_0x19a2('0x4f')]){_0x524b5f['where']=_[_0x19a2('0x50')](_0x524b5f[_0x19a2('0x4d')],{'$or':_[_0x19a2('0x3e')](_0x58ae3d,function(_0x51f663){if(_0x51f663[_0x19a2('0x41')]!==_0x19a2('0x51')){var _0x125b9e={};_0x125b9e[_0x51f663[_0x19a2('0x3b')]]={'$like':'%'+_0x3bb662[_0x19a2('0x43')][_0x19a2('0x4f')]+'%'};return _0x125b9e;}})});}_0x524b5f=_[_0x19a2('0x50')]({},_0x524b5f,_0x3bb662['options']);var _0x13ecd3={'where':_0x524b5f['where']};return db[_0x19a2('0x52')][_0x19a2('0x2d')](_0x13ecd3)[_0x19a2('0x34')](function(_0x3349c4){_0x34b099[_0x19a2('0x2d')]=_0x3349c4;if(_0x3bb662[_0x19a2('0x43')][_0x19a2('0x53')]){_0x524b5f[_0x19a2('0x54')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x524b5f);})[_0x19a2('0x34')](function(_0x96bad6){_0x34b099[_0x19a2('0x55')]=_0x96bad6;return _0x34b099;})[_0x19a2('0x34')](respondWithFilteredResult(_0x2725f1,_0x524b5f))['catch'](handleError(_0x2725f1,null));};exports[_0x19a2('0x56')]=function(_0x87edb6,_0x55b523){var _0x43d612={'raw':!![],'where':{'id':_0x87edb6[_0x19a2('0x57')]['id']}},_0x3565ca={};_0x3565ca['model']=_[_0x19a2('0x44')](db[_0x19a2('0x52')][_0x19a2('0x3f')]);_0x3565ca[_0x19a2('0x43')]=_[_0x19a2('0x44')](_0x87edb6[_0x19a2('0x43')]);_0x3565ca[_0x19a2('0x45')]=_[_0x19a2('0x46')](_0x3565ca[_0x19a2('0x42')],_0x3565ca[_0x19a2('0x43')]);_0x43d612[_0x19a2('0x47')]=_[_0x19a2('0x46')](_0x3565ca[_0x19a2('0x42')],qs[_0x19a2('0x48')](_0x87edb6[_0x19a2('0x43')][_0x19a2('0x48')]));_0x43d612['attributes']=_0x43d612['attributes'][_0x19a2('0x49')]?_0x43d612[_0x19a2('0x47')]:_0x3565ca[_0x19a2('0x42')];if(_0x87edb6[_0x19a2('0x43')][_0x19a2('0x53')]){_0x43d612[_0x19a2('0x54')]=[{'all':!![]}];}_0x43d612=_[_0x19a2('0x50')]({},_0x43d612,_0x87edb6['options']);return db[_0x19a2('0x52')][_0x19a2('0x58')](_0x43d612)['then'](handleEntityNotFound(_0x55b523,null))[_0x19a2('0x34')](respondWithResult(_0x55b523,null))[_0x19a2('0x27')](handleError(_0x55b523,null));};exports[_0x19a2('0x59')]=function(_0x32c4ed,_0x54c95b){return db['ChatQueue'][_0x19a2('0x59')](_0x32c4ed['body'],{})['then'](function(_0x5c6b98){var _0x41e484=_0x32c4ed[_0x19a2('0x5a')][_0x19a2('0x36')]({'plain':!![]});if(!_0x41e484)throw new Error(_0x19a2('0x5b'));if(_0x41e484[_0x19a2('0x5c')]===_0x19a2('0x5a')){var _0x22ae3a=_0x5c6b98[_0x19a2('0x36')]({'plain':!![]});var _0x41655e='ChatQueues';return db[_0x19a2('0x5d')]['find']({'where':{'name':_0x41655e,'userProfileId':_0x41e484[_0x19a2('0x5e')]},'raw':!![]})[_0x19a2('0x34')](function(_0x547628){if(_0x547628&&_0x547628['autoAssociation']===0x0){return db['UserProfileResource'][_0x19a2('0x59')]({'name':_0x22ae3a[_0x19a2('0x3b')],'resourceId':_0x22ae3a['id'],'type':_0x547628['name'],'sectionId':_0x547628['id']},{})[_0x19a2('0x34')](function(){return _0x5c6b98;});}else{return _0x5c6b98;}})['catch'](function(_0x460cb6){logger[_0x19a2('0x24')](_0x19a2('0x5f'),_0x460cb6);throw _0x460cb6;});}return _0x5c6b98;})[_0x19a2('0x34')](respondWithResult(_0x54c95b,0xc9))[_0x19a2('0x27')](handleError(_0x54c95b,null));};exports['update']=function(_0x107a87,_0x12298e){if(_0x107a87[_0x19a2('0x60')]['id']){delete _0x107a87[_0x19a2('0x60')]['id'];}return db[_0x19a2('0x52')][_0x19a2('0x58')]({'where':{'id':_0x107a87['params']['id']}})[_0x19a2('0x34')](handleEntityNotFound(_0x12298e,null))[_0x19a2('0x34')](saveUpdates(_0x107a87['body'],null))['then'](respondWithResult(_0x12298e,null))[_0x19a2('0x27')](handleError(_0x12298e,null));};exports[_0x19a2('0x35')]=function(_0x3cc5b7,_0x1bd64c){return db['ChatQueue'][_0x19a2('0x58')]({'where':{'id':_0x3cc5b7[_0x19a2('0x57')]['id']}})[_0x19a2('0x34')](handleEntityNotFound(_0x1bd64c,null))[_0x19a2('0x34')](removeEntity(_0x1bd64c,null))[_0x19a2('0x27')](handleError(_0x1bd64c,null));};exports[_0x19a2('0x61')]=function(_0x5d42f5,_0x5a83cf){return db[_0x19a2('0x52')][_0x19a2('0x61')]()[_0x19a2('0x34')](respondWithResult(_0x5a83cf,null))[_0x19a2('0x27')](handleError(_0x5a83cf,null));};exports['getMembers']=function(_0x3b03d8,_0x140ba6,_0x5d1e50){var _0x41b471={'raw':!![],'where':{}},_0x486b50={},_0x214299;return db[_0x19a2('0x52')]['findOne']({'where':{'id':_0x3b03d8[_0x19a2('0x57')]['id']}})[_0x19a2('0x34')](handleEntityNotFound(_0x140ba6,null))[_0x19a2('0x34')](function(_0x1da01f){if(_0x1da01f){_0x214299=_0x1da01f[_0x19a2('0x36')]({'plain':!![]});_0x486b50[_0x19a2('0x42')]=_[_0x19a2('0x44')](db[_0x19a2('0x62')][_0x19a2('0x3f')]);_0x486b50[_0x19a2('0x43')]=_[_0x19a2('0x44')](_0x3b03d8[_0x19a2('0x43')]);_0x486b50[_0x19a2('0x45')]=_[_0x19a2('0x46')](_0x486b50[_0x19a2('0x42')],_0x486b50['query']);_0x41b471[_0x19a2('0x47')]=_[_0x19a2('0x46')](_0x486b50['model'],qs[_0x19a2('0x48')](_0x3b03d8['query'][_0x19a2('0x48')]));_0x41b471[_0x19a2('0x47')]=_0x41b471[_0x19a2('0x47')][_0x19a2('0x49')]?_0x41b471[_0x19a2('0x47')]:_0x486b50[_0x19a2('0x42')];if(!_0x3b03d8['query'][_0x19a2('0x63')](_0x19a2('0x4a'))){_0x41b471[_0x19a2('0x2b')]=qs[_0x19a2('0x2b')](_0x3b03d8[_0x19a2('0x43')][_0x19a2('0x2b')]);_0x41b471[_0x19a2('0x2e')]=qs[_0x19a2('0x2e')](_0x3b03d8[_0x19a2('0x43')]['offset']);}_0x41b471[_0x19a2('0x4b')]=qs[_0x19a2('0x4c')](_0x3b03d8[_0x19a2('0x43')][_0x19a2('0x4c')]);_0x41b471['where']=qs[_0x19a2('0x45')](_['pick'](_0x3b03d8[_0x19a2('0x43')],_0x486b50['filters']));_0x41b471[_0x19a2('0x4d')][_0x19a2('0x64')]=_0x1da01f['id'];if(_0x3b03d8[_0x19a2('0x43')]['filter']){_0x41b471[_0x19a2('0x4d')]=_[_0x19a2('0x50')](_0x41b471[_0x19a2('0x4d')],{'$or':_['map'](_0x41b471[_0x19a2('0x47')],function(_0x2921d1){var _0x2863e2={};_0x2863e2[_0x2921d1]={'$like':'%'+_0x3b03d8['query'][_0x19a2('0x4f')]+'%'};return _0x2863e2;})});}_0x41b471=_[_0x19a2('0x50')]({},_0x41b471,_0x3b03d8[_0x19a2('0x65')]);return db['UserChatQueue']['findAll'](_0x41b471);}})[_0x19a2('0x34')](function(_0x1df4b3){if(_0x1df4b3){return db[_0x19a2('0x66')]['findAndCountAll']({'where':{'id':_['map'](_0x1df4b3,_0x19a2('0x67')),'role':'agent'},'attributes':['id',_0x19a2('0x3b'),'chatPause',_0x19a2('0x68'),_0x19a2('0x69')]});}})[_0x19a2('0x34')](function(_0x3b600f){if(_0x3b600f){return{'count':_0x3b600f['count'],'rows':_['map'](_0x3b600f[_0x19a2('0x55')],function(_0x4a5be6){return{'membername':_0x4a5be6[_0x19a2('0x3b')],'UserId':_0x4a5be6['id'],'queue_name':_0x214299[_0x19a2('0x3b')],'ChatQueueId':_0x214299['id'],'interface':util['format'](_0x19a2('0x6a'),_0x19a2('0x6b'),_0x4a5be6[_0x19a2('0x3b')]),'penalty':0x0,'paused':_0x4a5be6['chatPause'],'createdAt':_0x4a5be6['createdAt'],'updatedAt':_0x4a5be6[_0x19a2('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x140ba6,_0x41b471))[_0x19a2('0x27')](handleError(_0x140ba6,null));};exports[_0x19a2('0x6c')]=function(_0x123a32,_0x4a40fb,_0x32694e){var _0x509392={};var _0x24984a={};var _0x2a56f0;var _0x1fed33;return db[_0x19a2('0x52')][_0x19a2('0x6d')]({'where':{'id':_0x123a32['params']['id']}})['then'](handleEntityNotFound(_0x4a40fb,null))[_0x19a2('0x34')](function(_0x5ccaac){if(_0x5ccaac){_0x2a56f0=_0x5ccaac;_0x24984a[_0x19a2('0x42')]=_[_0x19a2('0x44')](db[_0x19a2('0x6e')][_0x19a2('0x3f')]);_0x24984a[_0x19a2('0x43')]=_[_0x19a2('0x44')](_0x123a32[_0x19a2('0x43')]);_0x24984a[_0x19a2('0x45')]=_[_0x19a2('0x46')](_0x24984a[_0x19a2('0x42')],_0x24984a[_0x19a2('0x43')]);_0x509392[_0x19a2('0x47')]=_['intersection'](_0x24984a[_0x19a2('0x42')],qs['fields'](_0x123a32[_0x19a2('0x43')][_0x19a2('0x48')]));_0x509392[_0x19a2('0x47')]=_0x509392[_0x19a2('0x47')][_0x19a2('0x49')]?_0x509392[_0x19a2('0x47')]:_0x24984a[_0x19a2('0x42')];_0x509392[_0x19a2('0x4b')]=qs[_0x19a2('0x4c')](_0x123a32[_0x19a2('0x43')][_0x19a2('0x4c')]);_0x509392[_0x19a2('0x4d')]=qs[_0x19a2('0x45')](_[_0x19a2('0x4e')](_0x123a32['query'],_0x24984a[_0x19a2('0x45')]));if(_0x123a32[_0x19a2('0x43')]['filter']){_0x509392[_0x19a2('0x4d')]=_[_0x19a2('0x50')](_0x509392[_0x19a2('0x4d')],{'$or':_[_0x19a2('0x3e')](_0x509392[_0x19a2('0x47')],function(_0x11ffeb){var _0x5b1ea6={};_0x5b1ea6[_0x11ffeb]={'$like':'%'+_0x123a32['query'][_0x19a2('0x4f')]+'%'};return _0x5b1ea6;})});}_0x509392=_[_0x19a2('0x50')]({},_0x509392,_0x123a32[_0x19a2('0x65')]);return _0x2a56f0['getTeams'](_0x509392);}})[_0x19a2('0x34')](function(_0x496626){if(_0x496626){_0x1fed33=_0x496626['length'];if(!_0x123a32[_0x19a2('0x43')]['hasOwnProperty'](_0x19a2('0x4a'))){_0x509392[_0x19a2('0x2b')]=qs[_0x19a2('0x2b')](_0x123a32[_0x19a2('0x43')][_0x19a2('0x2b')]);_0x509392[_0x19a2('0x2e')]=qs[_0x19a2('0x2e')](_0x123a32['query'][_0x19a2('0x2e')]);}return _0x2a56f0['getTeams'](_0x509392);}})[_0x19a2('0x34')](function(_0x58ae10){if(_0x58ae10){return _0x58ae10?{'count':_0x1fed33,'rows':_0x58ae10}:null;}})[_0x19a2('0x34')](respondWithResult(_0x4a40fb,null))[_0x19a2('0x27')](handleError(_0x4a40fb,null));};exports[_0x19a2('0x6f')]=function(_0x219957,_0x382dcf,_0x1a20c5){var _0x3ecb0c=_0x219957[_0x19a2('0x60')][_0x19a2('0x70')];return db[_0x19a2('0x6e')][_0x19a2('0x71')]({'where':{'id':_0x3ecb0c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x19a2('0x72'),'attributes':['id',_0x19a2('0x3b'),'online','voicePause',_0x19a2('0x73')],'raw':!![]}]})['then'](function(_0x4f217b){if(_0x4f217b){var _0xe6876b=_['flatMap'](_0x4f217b,function(_0x4423f0){var _0x3b1381=_0x4423f0[_0x19a2('0x36')]({'plain':!![]});return _0x3b1381['Agents'];});return db[_0x19a2('0x52')]['find']({'where':{'id':_0x219957[_0x19a2('0x57')]['id']}})['then'](function(_0x72d337){return db[_0x19a2('0x74')][_0x19a2('0x75')](function(_0x241db7){return _0x72d337[_0x19a2('0x6f')](_0x3ecb0c,{'transaction':_0x241db7})[_0x19a2('0x34')](function(){return BPromise[_0x19a2('0x76')](_0xe6876b,function(_0x6f1ce4){return db['UserChatQueue'][_0x19a2('0x77')]({'where':{'UserId':_0x6f1ce4['id'],'ChatQueueId':_0x219957[_0x19a2('0x57')]['id']},'transaction':_0x241db7});});})[_0x19a2('0x34')](function(){_0xe6876b[_0x19a2('0x78')](function(_0x3bb7b0){socket[_0x19a2('0x79')](_0x19a2('0x7a'),{'UserId':_0x3bb7b0['id'],'ChatQueueId':_0x72d337['id']});});});});});}})[_0x19a2('0x34')](respondWithStatusCode(_0x382dcf,null))[_0x19a2('0x27')](handleError(_0x382dcf,null));};exports[_0x19a2('0x7b')]=function(_0x1f1de8,_0x39f30c,_0x4f5e9a){return db[_0x19a2('0x6e')][_0x19a2('0x71')]({'where':{'id':_0x1f1de8[_0x19a2('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0x19a2('0x66')],'as':_0x19a2('0x72'),'attributes':['id'],'raw':!![]}]})[_0x19a2('0x34')](handleEntityNotFound(_0x39f30c,null))[_0x19a2('0x34')](function(_0x31344e){var _0x3e584a=_['map'](_0x31344e,'id');var _0x20f5bb=[];var _0x1c14b7=[];var _0xe5836c=squel[_0x19a2('0x7c')]();_0xe5836c[_0x19a2('0x7d')](_0x19a2('0x7e'))[_0x19a2('0x7f')](_0x19a2('0x80'),'tq')[_0x19a2('0x81')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x19a2('0x4d')](_0x19a2('0x82'),_0x1f1de8['params']['id']);for(var _0x6e5519=0x0;_0x6e5519<_0x31344e['length'];_0x6e5519+=0x1){let _0x404683=_0x31344e[_0x6e5519];for(var _0x5c9ec0=0x0;_0x5c9ec0<_0x404683[_0x19a2('0x72')][_0x19a2('0x49')];_0x5c9ec0+=0x1){let _0x63c4c7=_0x404683[_0x19a2('0x72')][_0x5c9ec0];var _0x105133=_0xe5836c[_0x19a2('0x83')]();_0x105133['where']('ut.UserId\x20=\x20?',_0x63c4c7['id']);_0x1c14b7['push'](db[_0x19a2('0x74')][_0x19a2('0x43')](_0x105133[_0x19a2('0x84')](),{'type':db[_0x19a2('0x74')][_0x19a2('0x85')][_0x19a2('0x86')]})[_0x19a2('0x34')](function(_0x2a23f3){if(_0x2a23f3['length']===0x1){return _0x63c4c7['id'];}else{var _0x5491e9=_['every'](_[_0x19a2('0x3e')](_0x2a23f3,_0x19a2('0x87')),function(_0x5ca18d){return _['includes'](_0x3e584a,_0x5ca18d);});if(_0x5491e9){return _0x63c4c7['id'];}}}));}}return BPromise[_0x19a2('0x88')](_0x1c14b7)[_0x19a2('0x34')](function(_0x3892af){_0x20f5bb=_(_0x20f5bb)[_0x19a2('0x89')](_0x3892af)['compact']()[_0x19a2('0x8a')]();return db[_0x19a2('0x52')][_0x19a2('0x58')]({'where':{'id':_0x1f1de8['params']['id']}})['then'](function(_0x13ca6c){return db[_0x19a2('0x74')][_0x19a2('0x75')](function(_0x44d833){return _0x13ca6c['removeTeams'](_0x1f1de8[_0x19a2('0x43')]['ids'],{'transaction':_0x44d833})[_0x19a2('0x34')](function(){if(!_[_0x19a2('0x8b')](_0x20f5bb)){return _0x13ca6c[_0x19a2('0x8c')](_0x20f5bb,{'transaction':_0x44d833});}})[_0x19a2('0x34')](function(){_0x20f5bb[_0x19a2('0x78')](function(_0x387a4a){socket['emit'](_0x19a2('0x8d'),{'UserId':_0x387a4a,'ChatQueueId':_0x13ca6c['id']});});});});});});})[_0x19a2('0x34')](respondWithStatusCode(_0x39f30c,null))[_0x19a2('0x27')](handleError(_0x39f30c,null));};exports[_0x19a2('0x8e')]=function(_0x4146e2,_0x4ea9ee,_0x230f17){return db['ChatQueue'][_0x19a2('0x58')]({'where':{'id':_0x4146e2[_0x19a2('0x57')]['id']}})[_0x19a2('0x34')](handleEntityNotFound(_0x4ea9ee,null))[_0x19a2('0x34')](function(_0x33bb7d){if(_0x33bb7d){return _0x33bb7d['addAgents'](_0x4146e2[_0x19a2('0x60')][_0x19a2('0x70')],_[_0x19a2('0x8f')](_0x4146e2[_0x19a2('0x60')],[_0x19a2('0x70'),'id'])||{})[_0x19a2('0x90')](function(_0x5be906){for(var _0x1ffce1=0x0;_0x1ffce1<_0x4146e2['body'][_0x19a2('0x70')]['length'];_0x1ffce1+=0x1){socket[_0x19a2('0x79')](_0x19a2('0x7a'),{'UserId':Number(_0x4146e2[_0x19a2('0x60')][_0x19a2('0x70')][_0x1ffce1]),'ChatQueueId':Number(_0x4146e2[_0x19a2('0x57')]['id'])});}return _0x5be906;});}})['then'](respondWithResult(_0x4ea9ee,null))['catch'](handleError(_0x4ea9ee,null));};exports[_0x19a2('0x8c')]=function(_0x475aed,_0x4713c0,_0x589fd0){return db['ChatQueue']['find']({'where':{'id':_0x475aed[_0x19a2('0x57')]['id']}})[_0x19a2('0x34')](handleEntityNotFound(_0x4713c0,null))['then'](function(_0x25afc9){if(_0x25afc9){return _0x25afc9[_0x19a2('0x8c')](_0x475aed[_0x19a2('0x43')][_0x19a2('0x70')])[_0x19a2('0x34')](function(){if(_[_0x19a2('0x91')](_0x475aed[_0x19a2('0x43')][_0x19a2('0x70')])){for(var _0x3d2f5e=0x0;_0x3d2f5e<_0x475aed[_0x19a2('0x43')][_0x19a2('0x70')]['length'];_0x3d2f5e+=0x1){socket[_0x19a2('0x79')]('userChatQueue:remove',{'UserId':Number(_0x475aed[_0x19a2('0x43')][_0x19a2('0x70')][_0x3d2f5e]),'ChatQueueId':Number(_0x475aed['params']['id'])});}}else{socket[_0x19a2('0x79')](_0x19a2('0x8d'),{'UserId':Number(_0x475aed[_0x19a2('0x43')]['ids']),'ChatQueueId':Number(_0x475aed[_0x19a2('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x4713c0,null))['catch'](handleError(_0x4713c0,null));};exports[_0x19a2('0x92')]=function(_0x235aba,_0x21dcf0,_0x322821){var _0x33279f={};var _0x361dc6={};var _0x2c8683;var _0x3730d3;return db[_0x19a2('0x52')][_0x19a2('0x6d')]({'where':{'id':_0x235aba[_0x19a2('0x57')]['id']}})[_0x19a2('0x34')](handleEntityNotFound(_0x21dcf0,null))[_0x19a2('0x34')](function(_0x861e6c){if(_0x861e6c){_0x2c8683=_0x861e6c;_0x361dc6[_0x19a2('0x42')]=_[_0x19a2('0x44')](db[_0x19a2('0x66')]['rawAttributes']);_0x361dc6[_0x19a2('0x43')]=_[_0x19a2('0x44')](_0x235aba[_0x19a2('0x43')]);_0x361dc6[_0x19a2('0x45')]=_[_0x19a2('0x46')](_0x361dc6[_0x19a2('0x42')],_0x361dc6['query']);_0x33279f[_0x19a2('0x47')]=_[_0x19a2('0x46')](_0x361dc6[_0x19a2('0x42')],qs[_0x19a2('0x48')](_0x235aba[_0x19a2('0x43')]['fields']));_0x33279f[_0x19a2('0x47')]=_0x33279f['attributes']['length']?_0x33279f[_0x19a2('0x47')]:_0x361dc6[_0x19a2('0x42')];_0x33279f['order']=qs[_0x19a2('0x4c')](_0x235aba['query'][_0x19a2('0x4c')]);_0x33279f['where']=qs[_0x19a2('0x45')](_[_0x19a2('0x4e')](_0x235aba[_0x19a2('0x43')],_0x361dc6[_0x19a2('0x45')]));if(_0x235aba['query'][_0x19a2('0x4f')]){_0x33279f[_0x19a2('0x4d')]=_['merge'](_0x33279f[_0x19a2('0x4d')],{'$or':_['map'](_0x33279f[_0x19a2('0x47')],function(_0x22c6b8){var _0x44157a={};_0x44157a[_0x22c6b8]={'$like':'%'+_0x235aba['query'][_0x19a2('0x4f')]+'%'};return _0x44157a;})});}_0x33279f=_[_0x19a2('0x50')]({},_0x33279f,_0x235aba['options']);return _0x2c8683[_0x19a2('0x92')](_0x33279f);}})[_0x19a2('0x34')](function(_0x170f5a){if(_0x170f5a){_0x3730d3=_0x170f5a[_0x19a2('0x49')];if(!_0x235aba[_0x19a2('0x43')]['hasOwnProperty'](_0x19a2('0x4a'))){_0x33279f[_0x19a2('0x2b')]=qs[_0x19a2('0x2b')](_0x235aba[_0x19a2('0x43')][_0x19a2('0x2b')]);_0x33279f[_0x19a2('0x2e')]=qs['offset'](_0x235aba[_0x19a2('0x43')][_0x19a2('0x2e')]);}return _0x2c8683[_0x19a2('0x92')](_0x33279f);}})[_0x19a2('0x34')](function(_0x11c1a5){if(_0x11c1a5){return _0x11c1a5?{'count':_0x3730d3,'rows':_0x11c1a5}:null;}})[_0x19a2('0x34')](respondWithResult(_0x21dcf0,null))[_0x19a2('0x27')](handleError(_0x21dcf0,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 96186ed..f0ca3b8 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 _0x05c2=['update','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x05c2,0x174));var _0x205c=function(_0xaf3b1a,_0x8a3a33){_0xaf3b1a=_0xaf3b1a-0x0;var _0x1aeaae=_0x05c2[_0xaf3b1a];return _0x1aeaae;};'use strict';var EventEmitter=require(_0x205c('0x0'));var ChatQueue=require(_0x205c('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x205c('0x2')](0x0);var events={'afterCreate':_0x205c('0x3'),'afterUpdate':_0x205c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x200cb3){return function(_0x3ac35e,_0x1a34fc,_0xa6a803){ChatQueueEvents[_0x205c('0x5')](_0x200cb3+':'+_0x3ac35e['id'],_0x3ac35e);ChatQueueEvents[_0x205c('0x5')](_0x200cb3,_0x3ac35e);_0xa6a803(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x205c('0x6')](e,emitEvent(event));}}module[_0x205c('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xf8fa=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatQueue'];(function(_0x3fe77c,_0xb71097){var _0x1be0cb=function(_0x14ea84){while(--_0x14ea84){_0x3fe77c['push'](_0x3fe77c['shift']());}};_0x1be0cb(++_0xb71097);}(_0xf8fa,0x1ec));var _0xaf8f=function(_0x4d8524,_0x1e8925){_0x4d8524=_0x4d8524-0x0;var _0xbdb413=_0xf8fa[_0x4d8524];return _0xbdb413;};'use strict';var EventEmitter=require(_0xaf8f('0x0'));var ChatQueue=require(_0xaf8f('0x1'))['db'][_0xaf8f('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xaf8f('0x3')](0x0);var events={'afterCreate':_0xaf8f('0x4'),'afterUpdate':'update','afterDestroy':_0xaf8f('0x5')};function emitEvent(_0x339b84){return function(_0x2ac6ff,_0x34d773,_0x15d05f){ChatQueueEvents[_0xaf8f('0x6')](_0x339b84+':'+_0x2ac6ff['id'],_0x2ac6ff);ChatQueueEvents['emit'](_0x339b84,_0x2ac6ff);_0x15d05f(null);};}for(var e in events){if(events[_0xaf8f('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xaf8f('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 63425c2..d30904b 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 _0xb9a7=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','ChatQueue','chat_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9a7,0x96));var _0x7b9a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xb9a7[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x7b9a('0x0'));var util=require('util');var logger=require(_0x7b9a('0x1'))(_0x7b9a('0x2'));var moment=require(_0x7b9a('0x3'));var BPromise=require('bluebird');var rp=require(_0x7b9a('0x4'));var fs=require('fs');var path=require(_0x7b9a('0x5'));var rimraf=require(_0x7b9a('0x6'));var config=require(_0x7b9a('0x7'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0xd49b0,_0x31574b){return _0xd49b0['define'](_0x7b9a('0x8'),attributes,{'tableName':_0x7b9a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77f5=['moment','bluebird','path','exports','define','ChatQueue','chat_queues','../../config/logger','api'];(function(_0x5cc203,_0x229868){var _0x13cdf5=function(_0x38f94e){while(--_0x38f94e){_0x5cc203['push'](_0x5cc203['shift']());}};_0x13cdf5(++_0x229868);}(_0x77f5,0x154));var _0x577f=function(_0x473b3a,_0x4889de){_0x473b3a=_0x473b3a-0x0;var _0x557b97=_0x77f5[_0x473b3a];return _0x557b97;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x577f('0x0'))(_0x577f('0x1'));var moment=require(_0x577f('0x2'));var BPromise=require(_0x577f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x577f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x577f('0x5')]=function(_0x2eb541,_0x2e86e8){return _0x2eb541[_0x577f('0x6')](_0x577f('0x7'),attributes,{'tableName':_0x577f('0x8'),'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 ac56618..632100f 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 _0x98d4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','ChatQueue','findAll','options','where','attributes','limit','include','model','map','GetChatQueue','stringify','ShowChatQueue','find','raw','lodash'];(function(_0x528651,_0x85fecd){var _0x425450=function(_0x438f0d){while(--_0x438f0d){_0x528651['push'](_0x528651['shift']());}};_0x425450(++_0x85fecd);}(_0x98d4,0xa3));var _0x498d=function(_0x1b6ce0,_0x23dd4d){_0x1b6ce0=_0x1b6ce0-0x0;var _0x4d724f=_0x98d4[_0x1b6ce0];return _0x4d724f;};'use strict';var _=require(_0x498d('0x0'));var util=require(_0x498d('0x1'));var moment=require(_0x498d('0x2'));var BPromise=require(_0x498d('0x3'));var rs=require(_0x498d('0x4'));var fs=require('fs');var Redis=require(_0x498d('0x5'));var db=require(_0x498d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x498d('0x7'))(_0x498d('0x8'));var config=require('../../config/environment');var jayson=require(_0x498d('0x9'));var client=jayson[_0x498d('0xa')][_0x498d('0xb')]({'port':0x232a});config[_0x498d('0xc')]=_[_0x498d('0xd')](config[_0x498d('0xc')],{'host':_0x498d('0xe'),'port':0x18eb});var socket=require(_0x498d('0xf'))(new Redis(config[_0x498d('0xc')]));require(_0x498d('0x10'))[_0x498d('0x11')](socket);function respondWithRpcPromise(_0x2763bf,_0x42e4d0,_0x4db366){return new BPromise(function(_0x23b8d0,_0x33c956){return client[_0x498d('0x12')](_0x2763bf,_0x4db366)[_0x498d('0x13')](function(_0x54c8c1){logger[_0x498d('0x14')](_0x498d('0x15'),_0x42e4d0,'request\x20sent');logger[_0x498d('0x16')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x42e4d0,_0x498d('0x17'),JSON['stringify'](_0x54c8c1));if(_0x54c8c1[_0x498d('0x18')]){if(_0x54c8c1['error']['code']===0x1f4){logger[_0x498d('0x18')](_0x498d('0x15'),_0x42e4d0,_0x54c8c1[_0x498d('0x18')][_0x498d('0x19')]);return _0x33c956(_0x54c8c1['error'][_0x498d('0x19')]);}logger[_0x498d('0x18')](_0x498d('0x15'),_0x42e4d0,_0x54c8c1[_0x498d('0x18')][_0x498d('0x19')]);return _0x23b8d0(_0x54c8c1[_0x498d('0x18')][_0x498d('0x19')]);}else{logger[_0x498d('0x14')](_0x498d('0x15'),_0x42e4d0,_0x498d('0x17'));_0x23b8d0(_0x54c8c1['result'][_0x498d('0x19')]);}})[_0x498d('0x1a')](function(_0x16ed1e){logger[_0x498d('0x18')](_0x498d('0x15'),_0x42e4d0,_0x16ed1e);_0x33c956(_0x16ed1e);});});}exports['GetChatQueue']=function(_0x421fbe){var _0x22e393=this;return new Promise(function(_0x4f04db,_0x2a820c){return db[_0x498d('0x1b')][_0x498d('0x1c')]({'raw':_0x421fbe[_0x498d('0x1d')]?_0x421fbe[_0x498d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x421fbe[_0x498d('0x1d')]?_0x421fbe['options'][_0x498d('0x1e')]||null:null,'attributes':_0x421fbe[_0x498d('0x1d')]?_0x421fbe[_0x498d('0x1d')][_0x498d('0x1f')]||null:null,'limit':_0x421fbe[_0x498d('0x1d')]?_0x421fbe[_0x498d('0x1d')][_0x498d('0x20')]||null:null,'include':_0x421fbe[_0x498d('0x1d')]?_0x421fbe[_0x498d('0x1d')][_0x498d('0x21')]?_['map'](_0x421fbe['options'][_0x498d('0x21')],function(_0x2656a2){return{'model':db[_0x2656a2[_0x498d('0x22')]],'as':_0x2656a2['as'],'attributes':_0x2656a2[_0x498d('0x1f')],'include':_0x2656a2[_0x498d('0x21')]?_[_0x498d('0x23')](_0x2656a2['include'],function(_0x2d590a){return{'model':db[_0x2d590a[_0x498d('0x22')]],'as':_0x2d590a['as'],'attributes':_0x2d590a[_0x498d('0x1f')],'include':_0x2d590a['include']?_[_0x498d('0x23')](_0x2d590a[_0x498d('0x21')],function(_0x257b59){return{'model':db[_0x257b59[_0x498d('0x22')]],'as':_0x257b59['as'],'attributes':_0x257b59[_0x498d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b75a2){logger[_0x498d('0x14')](_0x498d('0x24'),_0x421fbe);logger[_0x498d('0x16')]('GetChatQueue',_0x421fbe,JSON[_0x498d('0x25')](_0x1b75a2));_0x4f04db(_0x1b75a2);})[_0x498d('0x1a')](function(_0x277734){logger[_0x498d('0x18')]('GetChatQueue',_0x277734[_0x498d('0x19')],_0x421fbe);_0x2a820c(_0x22e393[_0x498d('0x18')](0x1f4,_0x277734['message']));});});};exports[_0x498d('0x26')]=function(_0x321296){var _0x41b9af=this;return new Promise(function(_0x492bb1,_0x360cfc){return db[_0x498d('0x1b')][_0x498d('0x27')]({'raw':_0x321296['options']?_0x321296[_0x498d('0x1d')][_0x498d('0x28')]===undefined?!![]:![]:!![],'where':_0x321296[_0x498d('0x1d')]?_0x321296[_0x498d('0x1d')][_0x498d('0x1e')]||null:null,'attributes':_0x321296[_0x498d('0x1d')]?_0x321296[_0x498d('0x1d')][_0x498d('0x1f')]||null:null,'include':_0x321296['options']?_0x321296[_0x498d('0x1d')][_0x498d('0x21')]?_[_0x498d('0x23')](_0x321296['options'][_0x498d('0x21')],function(_0x5be43b){return{'model':db[_0x5be43b[_0x498d('0x22')]],'as':_0x5be43b['as'],'attributes':_0x5be43b[_0x498d('0x1f')],'include':_0x5be43b[_0x498d('0x21')]?_['map'](_0x5be43b[_0x498d('0x21')],function(_0x5d8e48){return{'model':db[_0x5d8e48[_0x498d('0x22')]],'as':_0x5d8e48['as'],'attributes':_0x5d8e48[_0x498d('0x1f')],'include':_0x5d8e48[_0x498d('0x21')]?_[_0x498d('0x23')](_0x5d8e48['include'],function(_0x19ea2c){return{'model':db[_0x19ea2c[_0x498d('0x22')]],'as':_0x19ea2c['as'],'attributes':_0x19ea2c['attributes']};}):[]};}):[]};}):[]:[]})[_0x498d('0x13')](function(_0x3df946){logger[_0x498d('0x14')](_0x498d('0x26'),_0x321296);logger[_0x498d('0x16')]('ShowChatQueue',_0x321296,JSON[_0x498d('0x25')](_0x3df946));_0x492bb1(_0x3df946);})['catch'](function(_0x2492c3){logger[_0x498d('0x18')](_0x498d('0x26'),_0x2492c3['message'],_0x321296);_0x360cfc(_0x41b9af[_0x498d('0x18')](0x1f4,_0x2492c3[_0x498d('0x19')]));});});}; \ No newline at end of file +var _0xdb2b=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ChatQueue','findAll','options','raw','include','attributes','map','model','then','catch','GetChatQueue','ShowChatQueue','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0xdb2b,0xa2));var _0xbdb2=function(_0x137ef8,_0x3384dc){_0x137ef8=_0x137ef8-0x0;var _0x3b7d28=_0xdb2b[_0x137ef8];return _0x3b7d28;};'use strict';var _=require(_0xbdb2('0x0'));var util=require('util');var moment=require(_0xbdb2('0x1'));var BPromise=require(_0xbdb2('0x2'));var rs=require(_0xbdb2('0x3'));var fs=require('fs');var Redis=require(_0xbdb2('0x4'));var db=require(_0xbdb2('0x5'))['db'];var utils=require(_0xbdb2('0x6'));var logger=require(_0xbdb2('0x7'))(_0xbdb2('0x8'));var config=require(_0xbdb2('0x9'));var jayson=require(_0xbdb2('0xa'));var client=jayson[_0xbdb2('0xb')][_0xbdb2('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbdb2('0xd')],{'host':_0xbdb2('0xe'),'port':0x18eb});var socket=require(_0xbdb2('0xf'))(new Redis(config[_0xbdb2('0xd')]));require(_0xbdb2('0x10'))[_0xbdb2('0x11')](socket);function respondWithRpcPromise(_0x4cbf3b,_0xeae40,_0x4582bf){return new BPromise(function(_0x493c97,_0x209b90){return client[_0xbdb2('0x12')](_0x4cbf3b,_0x4582bf)['then'](function(_0x3fcedd){logger[_0xbdb2('0x13')](_0xbdb2('0x14'),_0xeae40,'request\x20sent');logger[_0xbdb2('0x15')](_0xbdb2('0x16'),_0xeae40,_0xbdb2('0x17'),JSON[_0xbdb2('0x18')](_0x3fcedd));if(_0x3fcedd['error']){if(_0x3fcedd[_0xbdb2('0x19')][_0xbdb2('0x1a')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0xeae40,_0x3fcedd[_0xbdb2('0x19')][_0xbdb2('0x1b')]);return _0x209b90(_0x3fcedd[_0xbdb2('0x19')][_0xbdb2('0x1b')]);}logger[_0xbdb2('0x19')](_0xbdb2('0x14'),_0xeae40,_0x3fcedd[_0xbdb2('0x19')][_0xbdb2('0x1b')]);return _0x493c97(_0x3fcedd['error'][_0xbdb2('0x1b')]);}else{logger['info'](_0xbdb2('0x14'),_0xeae40,_0xbdb2('0x17'));_0x493c97(_0x3fcedd[_0xbdb2('0x1c')]['message']);}})['catch'](function(_0xd912eb){logger[_0xbdb2('0x19')]('ChatQueue,\x20%s,\x20%s',_0xeae40,_0xd912eb);_0x209b90(_0xd912eb);});});}exports['GetChatQueue']=function(_0x59ac40){var _0x2bb1ed=this;return new Promise(function(_0x20a754,_0x3a9629){return db[_0xbdb2('0x1d')][_0xbdb2('0x1e')]({'raw':_0x59ac40[_0xbdb2('0x1f')]?_0x59ac40['options'][_0xbdb2('0x20')]===undefined?!![]:![]:!![],'where':_0x59ac40['options']?_0x59ac40[_0xbdb2('0x1f')]['where']||null:null,'attributes':_0x59ac40[_0xbdb2('0x1f')]?_0x59ac40[_0xbdb2('0x1f')]['attributes']||null:null,'limit':_0x59ac40[_0xbdb2('0x1f')]?_0x59ac40[_0xbdb2('0x1f')]['limit']||null:null,'include':_0x59ac40[_0xbdb2('0x1f')]?_0x59ac40[_0xbdb2('0x1f')][_0xbdb2('0x21')]?_['map'](_0x59ac40['options'][_0xbdb2('0x21')],function(_0x386af6){return{'model':db[_0x386af6['model']],'as':_0x386af6['as'],'attributes':_0x386af6[_0xbdb2('0x22')],'include':_0x386af6[_0xbdb2('0x21')]?_['map'](_0x386af6['include'],function(_0x4bb221){return{'model':db[_0x4bb221['model']],'as':_0x4bb221['as'],'attributes':_0x4bb221['attributes'],'include':_0x4bb221[_0xbdb2('0x21')]?_[_0xbdb2('0x23')](_0x4bb221[_0xbdb2('0x21')],function(_0x49aace){return{'model':db[_0x49aace[_0xbdb2('0x24')]],'as':_0x49aace['as'],'attributes':_0x49aace[_0xbdb2('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbdb2('0x25')](function(_0x3c3bae){logger['info']('GetChatQueue',_0x59ac40);logger['debug']('GetChatQueue',_0x59ac40,JSON[_0xbdb2('0x18')](_0x3c3bae));_0x20a754(_0x3c3bae);})[_0xbdb2('0x26')](function(_0xcc2e74){logger[_0xbdb2('0x19')](_0xbdb2('0x27'),_0xcc2e74[_0xbdb2('0x1b')],_0x59ac40);_0x3a9629(_0x2bb1ed['error'](0x1f4,_0xcc2e74['message']));});});};exports[_0xbdb2('0x28')]=function(_0x13ad0e){var _0x41c264=this;return new Promise(function(_0x2d8969,_0x58a686){return db[_0xbdb2('0x1d')][_0xbdb2('0x29')]({'raw':_0x13ad0e[_0xbdb2('0x1f')]?_0x13ad0e[_0xbdb2('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x13ad0e[_0xbdb2('0x1f')]?_0x13ad0e[_0xbdb2('0x1f')][_0xbdb2('0x2a')]||null:null,'attributes':_0x13ad0e[_0xbdb2('0x1f')]?_0x13ad0e[_0xbdb2('0x1f')][_0xbdb2('0x22')]||null:null,'include':_0x13ad0e[_0xbdb2('0x1f')]?_0x13ad0e['options'][_0xbdb2('0x21')]?_['map'](_0x13ad0e[_0xbdb2('0x1f')][_0xbdb2('0x21')],function(_0x3ccdec){return{'model':db[_0x3ccdec[_0xbdb2('0x24')]],'as':_0x3ccdec['as'],'attributes':_0x3ccdec[_0xbdb2('0x22')],'include':_0x3ccdec[_0xbdb2('0x21')]?_['map'](_0x3ccdec[_0xbdb2('0x21')],function(_0xc53a09){return{'model':db[_0xc53a09[_0xbdb2('0x24')]],'as':_0xc53a09['as'],'attributes':_0xc53a09['attributes'],'include':_0xc53a09['include']?_[_0xbdb2('0x23')](_0xc53a09[_0xbdb2('0x21')],function(_0x58b83c){return{'model':db[_0x58b83c[_0xbdb2('0x24')]],'as':_0x58b83c['as'],'attributes':_0x58b83c[_0xbdb2('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbdb2('0x25')](function(_0x364290){logger['info']('ShowChatQueue',_0x13ad0e);logger[_0xbdb2('0x15')](_0xbdb2('0x28'),_0x13ad0e,JSON['stringify'](_0x364290));_0x2d8969(_0x364290);})[_0xbdb2('0x26')](function(_0x36e957){logger[_0xbdb2('0x19')](_0xbdb2('0x28'),_0x36e957['message'],_0x13ad0e);_0x58a686(_0x41c264[_0xbdb2('0x19')](0x1f4,_0x36e957[_0xbdb2('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 5929468..8218e1e 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(_0xe2a8ca,_0x16c7c5){var _0x40ea0d=function(_0x2666d8){while(--_0x2666d8){_0xe2a8ca['push'](_0xe2a8ca['shift']());}};_0x40ea0d(++_0x16c7c5);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'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 _0x4b19=['remove','update','emit','removeListener','register','chatQueue:','./chatQueue.events'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0x4b19,0x195));var _0x94b1=function(_0x12e32a,_0x27eb0a){_0x12e32a=_0x12e32a-0x0;var _0xb907ba=_0x4b19[_0x12e32a];return _0xb907ba;};'use strict';var ChatQueueEvents=require(_0x94b1('0x0'));var events=['save',_0x94b1('0x1'),_0x94b1('0x2')];function createListener(_0x221ab3,_0x577f52){return function(_0x1ffdb7){_0x577f52[_0x94b1('0x3')](_0x221ab3,_0x1ffdb7);};}function removeListener(_0x2240b9,_0x4f607f){return function(){ChatQueueEvents[_0x94b1('0x4')](_0x2240b9,_0x4f607f);};}exports[_0x94b1('0x5')]=function(_0x52d6c1){for(var _0x24df76=0x0,_0x110a52=events['length'];_0x24df76<_0x110a52;_0x24df76++){var _0x40c69c=events[_0x24df76];var _0x201a02=createListener(_0x94b1('0x6')+_0x40c69c,_0x52d6c1);ChatQueueEvents['on'](_0x40c69c,_0x201a02);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index f35201f..321587d 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x5fc3[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x5fc3,0xa8));var _0x35fc=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x5fc3[_0x409deb];return _0x15a4f7;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 48aa493..419f998 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 _0x2353=['STRING','DATE','moment'];(function(_0xd7f799,_0x749051){var _0x587c44=function(_0x466581){while(--_0x466581){_0xd7f799['push'](_0xd7f799['shift']());}};_0x587c44(++_0x749051);}(_0x2353,0xe3));var _0x3235=function(_0x519a4b,_0x1dac0a){_0x519a4b=_0x519a4b-0x0;var _0x17c925=_0x2353[_0x519a4b];return _0x17c925;};'use strict';var moment=require(_0x3235('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3235('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x3235('0x1')]},'joinAt':{'type':Sequelize[_0x3235('0x2')]},'leaveAt':{'type':Sequelize[_0x3235('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3235('0x2')]},'reason':{'type':Sequelize[_0x3235('0x1')]}}; \ No newline at end of file +var _0x1672=['sequelize','exports','STRING','DATE','moment'];(function(_0x167516,_0x24d7ff){var _0x177343=function(_0x35d192){while(--_0x35d192){_0x167516['push'](_0x167516['shift']());}};_0x177343(++_0x24d7ff);}(_0x1672,0x121));var _0x2167=function(_0x57a8f,_0x490836){_0x57a8f=_0x57a8f-0x0;var _0x3d67aa=_0x1672[_0x57a8f];return _0x3d67aa;};'use strict';var moment=require(_0x2167('0x0'));var Sequelize=require(_0x2167('0x1'));module[_0x2167('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2167('0x3')]},'joinAt':{'type':Sequelize[_0x2167('0x4')]},'leaveAt':{'type':Sequelize[_0x2167('0x4')]},'acceptAt':{'type':Sequelize[_0x2167('0x4')]},'exitAt':{'type':Sequelize[_0x2167('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 9dd8062..e9ee5e2 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 _0x869e=['undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatQueueReport','includeAll','findAll','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x869e,0x15c));var _0xe869=function(_0x9bb804,_0x47d494){_0x9bb804=_0x9bb804-0x0;var _0x2f6536=_0x869e[_0x9bb804];return _0x2f6536;};'use strict';var emlformat=require(_0xe869('0x0'));var rimraf=require(_0xe869('0x1'));var zipdir=require(_0xe869('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe869('0x3'));var moment=require(_0xe869('0x4'));var BPromise=require(_0xe869('0x5'));var Mustache=require(_0xe869('0x6'));var util=require(_0xe869('0x7'));var path=require('path');var sox=require(_0xe869('0x8'));var csv=require(_0xe869('0x9'));var ejs=require(_0xe869('0xa'));var fs=require('fs');var fs_extra=require(_0xe869('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe869('0xc'));var jsforce=require(_0xe869('0xd'));var deskjs=require(_0xe869('0xe'));var toCsv=require(_0xe869('0x9'));var querystring=require(_0xe869('0xf'));var Papa=require(_0xe869('0x10'));var Redis=require(_0xe869('0x11'));var authService=require(_0xe869('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe869('0x13'));var logger=require(_0xe869('0x14'))(_0xe869('0x15'));var utils=require(_0xe869('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe869('0x17'))['db'];function respondWithStatusCode(_0x5a5197,_0x907d3f){_0x907d3f=_0x907d3f||0xcc;return function(_0x412429){if(_0x412429){return _0x5a5197['sendStatus'](_0x907d3f);}return _0x5a5197[_0xe869('0x18')](_0x907d3f)[_0xe869('0x19')]();};}function respondWithResult(_0x3239d1,_0x17ee8f){_0x17ee8f=_0x17ee8f||0xc8;return function(_0x4046e4){if(_0x4046e4){return _0x3239d1['status'](_0x17ee8f)['json'](_0x4046e4);}};}function respondWithFilteredResult(_0x52fd40,_0x262f2f){return function(_0x4ed173){if(_0x4ed173){var _0x201091=typeof _0x262f2f[_0xe869('0x1a')]===_0xe869('0x1b')&&typeof _0x262f2f['limit']===_0xe869('0x1b');var _0x10f5e1=_0x4ed173['count'];var _0x33f5a7=_0x201091?0x0:_0x262f2f['offset'];var _0x26c67c=_0x201091?_0x4ed173[_0xe869('0x1c')]:_0x262f2f['offset']+_0x262f2f['limit'];var _0x40692c;if(_0x26c67c>=_0x10f5e1){_0x26c67c=_0x10f5e1;_0x40692c=0xc8;}else{_0x40692c=0xce;}_0x52fd40['status'](_0x40692c);return _0x52fd40[_0xe869('0x1d')](_0xe869('0x1e'),_0x33f5a7+'-'+_0x26c67c+'/'+_0x10f5e1)[_0xe869('0x1f')](_0x4ed173);}return null;};}function patchUpdates(_0x3e8c47){return function(_0x171c18){try{jsonpatch[_0xe869('0x20')](_0x171c18,_0x3e8c47,!![]);}catch(_0xa13c53){return BPromise[_0xe869('0x21')](_0xa13c53);}return _0x171c18[_0xe869('0x22')]();};}function saveUpdates(_0x10de1e,_0x59e73f){return function(_0x1a30e8){if(_0x1a30e8){return _0x1a30e8[_0xe869('0x23')](_0x10de1e)[_0xe869('0x24')](function(_0x342640){return _0x342640;});}return null;};}function removeEntity(_0x9c22cd,_0x4ddc31){return function(_0x429301){if(_0x429301){return _0x429301[_0xe869('0x25')]()[_0xe869('0x24')](function(){_0x9c22cd[_0xe869('0x18')](0xcc)[_0xe869('0x19')]();});}};}function handleEntityNotFound(_0x42320b,_0x311be8){return function(_0x44efa3){if(!_0x44efa3){_0x42320b[_0xe869('0x26')](0x194);}return _0x44efa3;};}function handleError(_0x30df68,_0x2775bc){_0x2775bc=_0x2775bc||0x1f4;return function(_0x31fec7){logger[_0xe869('0x27')](_0x31fec7['stack']);if(_0x31fec7[_0xe869('0x28')]){delete _0x31fec7[_0xe869('0x28')];}_0x30df68[_0xe869('0x18')](_0x2775bc)[_0xe869('0x29')](_0x31fec7);};}exports[_0xe869('0x2a')]=function(_0x22a823,_0x4f0e7f){var _0x367969={},_0x3f3574={},_0x57e22c={'count':0x0,'rows':[]};var _0x558c32=_[_0xe869('0x2b')](db['ChatQueueReport'][_0xe869('0x2c')],function(_0x4ed370){return{'name':_0x4ed370['fieldName'],'type':_0x4ed370[_0xe869('0x2d')][_0xe869('0x2e')]};});_0x3f3574[_0xe869('0x2f')]=_['map'](_0x558c32,_0xe869('0x28'));_0x3f3574['query']=_[_0xe869('0x30')](_0x22a823[_0xe869('0x31')]);_0x3f3574[_0xe869('0x32')]=_[_0xe869('0x33')](_0x3f3574[_0xe869('0x2f')],_0x3f3574[_0xe869('0x31')]);_0x367969[_0xe869('0x34')]=_['intersection'](_0x3f3574[_0xe869('0x2f')],qs[_0xe869('0x35')](_0x22a823[_0xe869('0x31')]['fields']));_0x367969['attributes']=_0x367969[_0xe869('0x34')]['length']?_0x367969['attributes']:_0x3f3574[_0xe869('0x2f')];if(!_0x22a823[_0xe869('0x31')]['hasOwnProperty'](_0xe869('0x36'))){_0x367969[_0xe869('0x37')]=qs[_0xe869('0x37')](_0x22a823[_0xe869('0x31')]['limit']);_0x367969[_0xe869('0x1a')]=qs[_0xe869('0x1a')](_0x22a823[_0xe869('0x31')]['offset']);}_0x367969[_0xe869('0x38')]=qs[_0xe869('0x39')](_0x22a823['query'][_0xe869('0x39')]);_0x367969[_0xe869('0x3a')]=qs['filters'](_[_0xe869('0x3b')](_0x22a823['query'],_0x3f3574[_0xe869('0x32')]),_0x558c32);if(_0x22a823[_0xe869('0x31')]['filter']){_0x367969[_0xe869('0x3a')]=_[_0xe869('0x3c')](_0x367969[_0xe869('0x3a')],{'$or':_[_0xe869('0x2b')](_0x558c32,function(_0x15502e){if(_0x15502e['type']!==_0xe869('0x3d')){var _0xee8898={};_0xee8898[_0x15502e[_0xe869('0x28')]]={'$like':'%'+_0x22a823['query'][_0xe869('0x3e')]+'%'};return _0xee8898;}})});}_0x367969=_[_0xe869('0x3c')]({},_0x367969,_0x22a823[_0xe869('0x3f')]);var _0x3bf052={'where':_0x367969[_0xe869('0x3a')]};return db[_0xe869('0x40')]['count'](_0x3bf052)[_0xe869('0x24')](function(_0x3352a7){_0x57e22c[_0xe869('0x1c')]=_0x3352a7;if(_0x22a823['query'][_0xe869('0x41')]){_0x367969['include']=[{'all':!![]}];}return db[_0xe869('0x40')][_0xe869('0x42')](_0x367969);})[_0xe869('0x24')](function(_0x14398a){_0x57e22c['rows']=_0x14398a;return _0x57e22c;})[_0xe869('0x24')](respondWithFilteredResult(_0x4f0e7f,_0x367969))[_0xe869('0x43')](handleError(_0x4f0e7f,null));};exports['show']=function(_0x1e550e,_0x3d55df){var _0x26ebd8={'raw':!![],'where':{'id':_0x1e550e[_0xe869('0x44')]['id']}},_0x4130a6={};_0x4130a6[_0xe869('0x2f')]=_['keys'](db[_0xe869('0x40')]['rawAttributes']);_0x4130a6[_0xe869('0x31')]=_[_0xe869('0x30')](_0x1e550e[_0xe869('0x31')]);_0x4130a6[_0xe869('0x32')]=_[_0xe869('0x33')](_0x4130a6[_0xe869('0x2f')],_0x4130a6[_0xe869('0x31')]);_0x26ebd8[_0xe869('0x34')]=_[_0xe869('0x33')](_0x4130a6[_0xe869('0x2f')],qs[_0xe869('0x35')](_0x1e550e[_0xe869('0x31')][_0xe869('0x35')]));_0x26ebd8[_0xe869('0x34')]=_0x26ebd8['attributes'][_0xe869('0x45')]?_0x26ebd8[_0xe869('0x34')]:_0x4130a6['model'];if(_0x1e550e[_0xe869('0x31')]['includeAll']){_0x26ebd8[_0xe869('0x46')]=[{'all':!![]}];}_0x26ebd8=_[_0xe869('0x3c')]({},_0x26ebd8,_0x1e550e[_0xe869('0x3f')]);return db[_0xe869('0x40')][_0xe869('0x47')](_0x26ebd8)[_0xe869('0x24')](handleEntityNotFound(_0x3d55df,null))[_0xe869('0x24')](respondWithResult(_0x3d55df,null))[_0xe869('0x43')](handleError(_0x3d55df,null));};exports[_0xe869('0x48')]=function(_0x39e5e9,_0x5d5349){return db[_0xe869('0x40')][_0xe869('0x48')](_0x39e5e9[_0xe869('0x49')],{})[_0xe869('0x24')](respondWithResult(_0x5d5349,0xc9))[_0xe869('0x43')](handleError(_0x5d5349,null));};exports[_0xe869('0x23')]=function(_0x5aa2b5,_0x1976c0){if(_0x5aa2b5['body']['id']){delete _0x5aa2b5[_0xe869('0x49')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5aa2b5[_0xe869('0x44')]['id']}})['then'](handleEntityNotFound(_0x1976c0,null))['then'](saveUpdates(_0x5aa2b5[_0xe869('0x49')],null))[_0xe869('0x24')](respondWithResult(_0x1976c0,null))[_0xe869('0x43')](handleError(_0x1976c0,null));};exports[_0xe869('0x25')]=function(_0x2acfee,_0x59bae1){return db['ChatQueueReport']['find']({'where':{'id':_0x2acfee[_0xe869('0x44')]['id']}})['then'](handleEntityNotFound(_0x59bae1,null))[_0xe869('0x24')](removeEntity(_0x59bae1,null))[_0xe869('0x43')](handleError(_0x59bae1,null));};exports['describe']=function(_0x98ee8f,_0x5ec184){return db[_0xe869('0x40')][_0xe869('0x4a')]()[_0xe869('0x24')](respondWithResult(_0x5ec184,null))[_0xe869('0x43')](handleError(_0x5ec184,null));}; \ No newline at end of file +var _0x07d7=['undefined','limit','status','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatQueueReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','offset'];(function(_0x145520,_0xaa3c75){var _0x1ae3e3=function(_0x1532da){while(--_0x1532da){_0x145520['push'](_0x145520['shift']());}};_0x1ae3e3(++_0xaa3c75);}(_0x07d7,0x85));var _0x707d=function(_0x3d27ba,_0x2671a3){_0x3d27ba=_0x3d27ba-0x0;var _0xf01885=_0x07d7[_0x3d27ba];return _0xf01885;};'use strict';var emlformat=require(_0x707d('0x0'));var rimraf=require(_0x707d('0x1'));var zipdir=require(_0x707d('0x2'));var jsonpatch=require(_0x707d('0x3'));var rp=require(_0x707d('0x4'));var moment=require(_0x707d('0x5'));var BPromise=require(_0x707d('0x6'));var Mustache=require(_0x707d('0x7'));var util=require(_0x707d('0x8'));var path=require(_0x707d('0x9'));var sox=require(_0x707d('0xa'));var csv=require(_0x707d('0xb'));var ejs=require(_0x707d('0xc'));var fs=require('fs');var fs_extra=require(_0x707d('0xd'));var _=require(_0x707d('0xe'));var squel=require(_0x707d('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x707d('0x10'));var toCsv=require(_0x707d('0xb'));var querystring=require(_0x707d('0x11'));var Papa=require(_0x707d('0x12'));var Redis=require(_0x707d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x707d('0x14'));var as=require(_0x707d('0x15'));var hardwareService=require(_0x707d('0x16'));var logger=require('../../config/logger')(_0x707d('0x17'));var utils=require(_0x707d('0x18'));var config=require(_0x707d('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aabfe,_0x252e8c){_0x252e8c=_0x252e8c||0xcc;return function(_0x7cd32b){if(_0x7cd32b){return _0x5aabfe[_0x707d('0x1a')](_0x252e8c);}return _0x5aabfe['status'](_0x252e8c)[_0x707d('0x1b')]();};}function respondWithResult(_0x52c447,_0x1c18a6){_0x1c18a6=_0x1c18a6||0xc8;return function(_0x42e27f){if(_0x42e27f){return _0x52c447['status'](_0x1c18a6)['json'](_0x42e27f);}};}function respondWithFilteredResult(_0x30d583,_0x5b4700){return function(_0x2f993c){if(_0x2f993c){var _0x2c63c9=typeof _0x5b4700[_0x707d('0x1c')]===_0x707d('0x1d')&&typeof _0x5b4700[_0x707d('0x1e')]===_0x707d('0x1d');var _0x318251=_0x2f993c['count'];var _0x1d3fe6=_0x2c63c9?0x0:_0x5b4700[_0x707d('0x1c')];var _0x3617c3=_0x2c63c9?_0x2f993c['count']:_0x5b4700[_0x707d('0x1c')]+_0x5b4700[_0x707d('0x1e')];var _0xf5375f;if(_0x3617c3>=_0x318251){_0x3617c3=_0x318251;_0xf5375f=0xc8;}else{_0xf5375f=0xce;}_0x30d583[_0x707d('0x1f')](_0xf5375f);return _0x30d583[_0x707d('0x20')](_0x707d('0x21'),_0x1d3fe6+'-'+_0x3617c3+'/'+_0x318251)[_0x707d('0x22')](_0x2f993c);}return null;};}function patchUpdates(_0x446629){return function(_0x33a726){try{jsonpatch[_0x707d('0x23')](_0x33a726,_0x446629,!![]);}catch(_0x2da0c0){return BPromise[_0x707d('0x24')](_0x2da0c0);}return _0x33a726[_0x707d('0x25')]();};}function saveUpdates(_0x3dc9c9,_0xd97d6b){return function(_0x30d175){if(_0x30d175){return _0x30d175[_0x707d('0x26')](_0x3dc9c9)['then'](function(_0x24ba23){return _0x24ba23;});}return null;};}function removeEntity(_0x487a9c,_0xe548a4){return function(_0x139ad5){if(_0x139ad5){return _0x139ad5[_0x707d('0x27')]()[_0x707d('0x28')](function(){_0x487a9c[_0x707d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x115e5c,_0x5b2db7){return function(_0x3760bb){if(!_0x3760bb){_0x115e5c[_0x707d('0x1a')](0x194);}return _0x3760bb;};}function handleError(_0x2d8830,_0x26d4ee){_0x26d4ee=_0x26d4ee||0x1f4;return function(_0x40551d){logger[_0x707d('0x29')](_0x40551d[_0x707d('0x2a')]);if(_0x40551d[_0x707d('0x2b')]){delete _0x40551d[_0x707d('0x2b')];}_0x2d8830[_0x707d('0x1f')](_0x26d4ee)[_0x707d('0x2c')](_0x40551d);};}exports[_0x707d('0x2d')]=function(_0x38b44b,_0xeb85df){var _0x2102e6={},_0x309ded={},_0x599ba6={'count':0x0,'rows':[]};var _0x17bb4e=_[_0x707d('0x2e')](db[_0x707d('0x2f')]['rawAttributes'],function(_0x5e0ff9){return{'name':_0x5e0ff9['fieldName'],'type':_0x5e0ff9[_0x707d('0x30')][_0x707d('0x31')]};});_0x309ded[_0x707d('0x32')]=_[_0x707d('0x2e')](_0x17bb4e,_0x707d('0x2b'));_0x309ded[_0x707d('0x33')]=_[_0x707d('0x34')](_0x38b44b[_0x707d('0x33')]);_0x309ded[_0x707d('0x35')]=_[_0x707d('0x36')](_0x309ded[_0x707d('0x32')],_0x309ded[_0x707d('0x33')]);_0x2102e6['attributes']=_[_0x707d('0x36')](_0x309ded[_0x707d('0x32')],qs[_0x707d('0x37')](_0x38b44b[_0x707d('0x33')][_0x707d('0x37')]));_0x2102e6['attributes']=_0x2102e6[_0x707d('0x38')][_0x707d('0x39')]?_0x2102e6['attributes']:_0x309ded[_0x707d('0x32')];if(!_0x38b44b[_0x707d('0x33')][_0x707d('0x3a')](_0x707d('0x3b'))){_0x2102e6[_0x707d('0x1e')]=qs[_0x707d('0x1e')](_0x38b44b[_0x707d('0x33')][_0x707d('0x1e')]);_0x2102e6[_0x707d('0x1c')]=qs['offset'](_0x38b44b[_0x707d('0x33')][_0x707d('0x1c')]);}_0x2102e6[_0x707d('0x3c')]=qs[_0x707d('0x3d')](_0x38b44b[_0x707d('0x33')]['sort']);_0x2102e6[_0x707d('0x3e')]=qs[_0x707d('0x35')](_[_0x707d('0x3f')](_0x38b44b['query'],_0x309ded[_0x707d('0x35')]),_0x17bb4e);if(_0x38b44b['query'][_0x707d('0x40')]){_0x2102e6[_0x707d('0x3e')]=_[_0x707d('0x41')](_0x2102e6[_0x707d('0x3e')],{'$or':_['map'](_0x17bb4e,function(_0x5b3260){if(_0x5b3260[_0x707d('0x30')]!==_0x707d('0x42')){var _0x48d8e6={};_0x48d8e6[_0x5b3260['name']]={'$like':'%'+_0x38b44b[_0x707d('0x33')]['filter']+'%'};return _0x48d8e6;}})});}_0x2102e6=_['merge']({},_0x2102e6,_0x38b44b[_0x707d('0x43')]);var _0x35d3a0={'where':_0x2102e6[_0x707d('0x3e')]};return db[_0x707d('0x2f')][_0x707d('0x44')](_0x35d3a0)['then'](function(_0x59aba7){_0x599ba6[_0x707d('0x44')]=_0x59aba7;if(_0x38b44b[_0x707d('0x33')][_0x707d('0x45')]){_0x2102e6[_0x707d('0x46')]=[{'all':!![]}];}return db[_0x707d('0x2f')][_0x707d('0x47')](_0x2102e6);})[_0x707d('0x28')](function(_0x6553d2){_0x599ba6[_0x707d('0x48')]=_0x6553d2;return _0x599ba6;})[_0x707d('0x28')](respondWithFilteredResult(_0xeb85df,_0x2102e6))['catch'](handleError(_0xeb85df,null));};exports[_0x707d('0x49')]=function(_0x1b5acb,_0x483ecf){var _0xd27541={'raw':!![],'where':{'id':_0x1b5acb[_0x707d('0x4a')]['id']}},_0x186035={};_0x186035[_0x707d('0x32')]=_[_0x707d('0x34')](db['ChatQueueReport'][_0x707d('0x4b')]);_0x186035[_0x707d('0x33')]=_[_0x707d('0x34')](_0x1b5acb[_0x707d('0x33')]);_0x186035[_0x707d('0x35')]=_[_0x707d('0x36')](_0x186035[_0x707d('0x32')],_0x186035[_0x707d('0x33')]);_0xd27541[_0x707d('0x38')]=_['intersection'](_0x186035[_0x707d('0x32')],qs['fields'](_0x1b5acb[_0x707d('0x33')][_0x707d('0x37')]));_0xd27541[_0x707d('0x38')]=_0xd27541[_0x707d('0x38')][_0x707d('0x39')]?_0xd27541[_0x707d('0x38')]:_0x186035[_0x707d('0x32')];if(_0x1b5acb[_0x707d('0x33')]['includeAll']){_0xd27541[_0x707d('0x46')]=[{'all':!![]}];}_0xd27541=_[_0x707d('0x41')]({},_0xd27541,_0x1b5acb[_0x707d('0x43')]);return db[_0x707d('0x2f')][_0x707d('0x4c')](_0xd27541)[_0x707d('0x28')](handleEntityNotFound(_0x483ecf,null))['then'](respondWithResult(_0x483ecf,null))[_0x707d('0x4d')](handleError(_0x483ecf,null));};exports[_0x707d('0x4e')]=function(_0x39843d,_0x3986d4){return db[_0x707d('0x2f')][_0x707d('0x4e')](_0x39843d['body'],{})['then'](respondWithResult(_0x3986d4,0xc9))[_0x707d('0x4d')](handleError(_0x3986d4,null));};exports[_0x707d('0x26')]=function(_0x5e1c34,_0x31ac73){if(_0x5e1c34[_0x707d('0x4f')]['id']){delete _0x5e1c34[_0x707d('0x4f')]['id'];}return db[_0x707d('0x2f')]['find']({'where':{'id':_0x5e1c34[_0x707d('0x4a')]['id']}})[_0x707d('0x28')](handleEntityNotFound(_0x31ac73,null))[_0x707d('0x28')](saveUpdates(_0x5e1c34['body'],null))[_0x707d('0x28')](respondWithResult(_0x31ac73,null))[_0x707d('0x4d')](handleError(_0x31ac73,null));};exports['destroy']=function(_0xe8a696,_0x4fa0f8){return db['ChatQueueReport']['find']({'where':{'id':_0xe8a696[_0x707d('0x4a')]['id']}})[_0x707d('0x28')](handleEntityNotFound(_0x4fa0f8,null))[_0x707d('0x28')](removeEntity(_0x4fa0f8,null))[_0x707d('0x4d')](handleError(_0x4fa0f8,null));};exports[_0x707d('0x50')]=function(_0x19c741,_0x4d85a9){return db[_0x707d('0x2f')][_0x707d('0x50')]()['then'](respondWithResult(_0x4d85a9,null))['catch'](handleError(_0x4d85a9,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 11cd3aa..47b0cac 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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x2881d2,_0x1787a0){var _0x683ce3=function(_0x1095a1){while(--_0x1095a1){_0x2881d2['push'](_0x2881d2['shift']());}};_0x683ce3(++_0x1787a0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x277889,_0x15b424){var _0x505e98=function(_0x3b48d7){while(--_0x3b48d7){_0x277889['push'](_0x277889['shift']());}};_0x505e98(++_0x15b424);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 6944ff2..b8265b6 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 _0xa552=['UpdateChatQueueReport','update','body','where','attributes','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateChatQueueReport','ChatQueueReport','create','options','raw'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0xa552,0x147));var _0x2a55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa552[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2a55('0x0'));var util=require(_0x2a55('0x1'));var moment=require(_0x2a55('0x2'));var BPromise=require(_0x2a55('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a55('0x4'));var db=require(_0x2a55('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a55('0x6'));var config=require(_0x2a55('0x7'));var jayson=require(_0x2a55('0x8'));var client=jayson[_0x2a55('0x9')][_0x2a55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa94c5,_0x2a996f,_0x54e0b5){return new BPromise(function(_0x1b87fb,_0x39118d){return client['request'](_0xa94c5,_0x54e0b5)[_0x2a55('0xb')](function(_0x36dbfb){logger['info'](_0x2a55('0xc'),_0x2a996f,_0x2a55('0xd'));logger[_0x2a55('0xe')](_0x2a55('0xf'),_0x2a996f,_0x2a55('0xd'),JSON[_0x2a55('0x10')](_0x36dbfb));if(_0x36dbfb[_0x2a55('0x11')]){if(_0x36dbfb[_0x2a55('0x11')]['code']===0x1f4){logger[_0x2a55('0x11')](_0x2a55('0xc'),_0x2a996f,_0x36dbfb['error'][_0x2a55('0x12')]);return _0x39118d(_0x36dbfb['error']['message']);}logger[_0x2a55('0x11')](_0x2a55('0xc'),_0x2a996f,_0x36dbfb[_0x2a55('0x11')]['message']);return _0x1b87fb(_0x36dbfb[_0x2a55('0x11')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x2a996f,_0x2a55('0xd'));_0x1b87fb(_0x36dbfb[_0x2a55('0x13')][_0x2a55('0x12')]);}})['catch'](function(_0x1986d9){logger[_0x2a55('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x2a996f,_0x1986d9);_0x39118d(_0x1986d9);});});}exports[_0x2a55('0x14')]=function(_0x537a2b){var _0x284337=this;return new Promise(function(_0x540350,_0x1628f0){return db[_0x2a55('0x15')][_0x2a55('0x16')](_0x537a2b['body'],{'raw':_0x537a2b[_0x2a55('0x17')]?_0x537a2b[_0x2a55('0x17')][_0x2a55('0x18')]===undefined?!![]:![]:!![]})[_0x2a55('0xb')](function(_0x4b1cc5){logger['info'](_0x2a55('0x14'),_0x537a2b);logger[_0x2a55('0xe')]('CreateChatQueueReport',_0x537a2b,JSON[_0x2a55('0x10')](_0x4b1cc5));_0x540350(_0x4b1cc5);})['catch'](function(_0x2c4617){logger[_0x2a55('0x11')](_0x2a55('0x14'),_0x2c4617['message'],_0x537a2b);_0x1628f0(_0x284337[_0x2a55('0x11')](0x1f4,_0x2c4617[_0x2a55('0x12')]));});});};exports[_0x2a55('0x19')]=function(_0x3619cf){var _0x580057=this;return new Promise(function(_0x5425ac,_0x47d6ff){return db[_0x2a55('0x15')][_0x2a55('0x1a')](_0x3619cf[_0x2a55('0x1b')],{'raw':_0x3619cf[_0x2a55('0x17')]?_0x3619cf['options'][_0x2a55('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3619cf[_0x2a55('0x17')]?_0x3619cf[_0x2a55('0x17')][_0x2a55('0x1c')]||null:null,'attributes':_0x3619cf[_0x2a55('0x17')]?_0x3619cf[_0x2a55('0x17')][_0x2a55('0x1d')]||null:null,'limit':_0x3619cf[_0x2a55('0x17')]?_0x3619cf[_0x2a55('0x17')]['limit']||null:null})['then'](function(_0x4eec64){logger[_0x2a55('0x1e')]('UpdateChatQueueReport',_0x3619cf);logger[_0x2a55('0xe')]('UpdateChatQueueReport',_0x3619cf,JSON[_0x2a55('0x10')](_0x4eec64));_0x5425ac(_0x4eec64);})[_0x2a55('0x1f')](function(_0x14feb9){logger[_0x2a55('0x11')](_0x2a55('0x19'),_0x14feb9[_0x2a55('0x12')],_0x3619cf);_0x47d6ff(_0x580057[_0x2a55('0x11')](0x1f4,_0x14feb9[_0x2a55('0x12')]));});});}; \ No newline at end of file +var _0x6146=['attributes','limit','UpdateChatQueueReport','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','options','raw','update','body','where'];(function(_0x1e123b,_0x2482e5){var _0x31b527=function(_0x166e1a){while(--_0x166e1a){_0x1e123b['push'](_0x1e123b['shift']());}};_0x31b527(++_0x2482e5);}(_0x6146,0x111));var _0x6614=function(_0x590b72,_0x2f603e){_0x590b72=_0x590b72-0x0;var _0x37df5b=_0x6146[_0x590b72];return _0x37df5b;};'use strict';var _=require('lodash');var util=require(_0x6614('0x0'));var moment=require('moment');var BPromise=require(_0x6614('0x1'));var rs=require(_0x6614('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6614('0x3'))['db'];var utils=require(_0x6614('0x4'));var logger=require(_0x6614('0x5'))(_0x6614('0x6'));var config=require(_0x6614('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d9fce,_0x23d03a,_0x46224e){return new BPromise(function(_0x41725f,_0x181fdd){return client[_0x6614('0x8')](_0x1d9fce,_0x46224e)[_0x6614('0x9')](function(_0x1e4be8){logger[_0x6614('0xa')](_0x6614('0xb'),_0x23d03a,_0x6614('0xc'));logger[_0x6614('0xd')](_0x6614('0xe'),_0x23d03a,_0x6614('0xc'),JSON[_0x6614('0xf')](_0x1e4be8));if(_0x1e4be8[_0x6614('0x10')]){if(_0x1e4be8[_0x6614('0x10')][_0x6614('0x11')]===0x1f4){logger[_0x6614('0x10')](_0x6614('0xb'),_0x23d03a,_0x1e4be8[_0x6614('0x10')]['message']);return _0x181fdd(_0x1e4be8[_0x6614('0x10')]['message']);}logger[_0x6614('0x10')](_0x6614('0xb'),_0x23d03a,_0x1e4be8[_0x6614('0x10')][_0x6614('0x12')]);return _0x41725f(_0x1e4be8['error'][_0x6614('0x12')]);}else{logger[_0x6614('0xa')](_0x6614('0xb'),_0x23d03a,_0x6614('0xc'));_0x41725f(_0x1e4be8['result'][_0x6614('0x12')]);}})[_0x6614('0x13')](function(_0x11ab1a){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x23d03a,_0x11ab1a);_0x181fdd(_0x11ab1a);});});}exports[_0x6614('0x14')]=function(_0x4d1496){var _0x30e2d6=this;return new Promise(function(_0x5529fc,_0x4ead5a){return db[_0x6614('0x15')]['create'](_0x4d1496['body'],{'raw':_0x4d1496[_0x6614('0x16')]?_0x4d1496['options'][_0x6614('0x17')]===undefined?!![]:![]:!![]})[_0x6614('0x9')](function(_0x675ee6){logger[_0x6614('0xa')](_0x6614('0x14'),_0x4d1496);logger[_0x6614('0xd')](_0x6614('0x14'),_0x4d1496,JSON[_0x6614('0xf')](_0x675ee6));_0x5529fc(_0x675ee6);})[_0x6614('0x13')](function(_0x40ee29){logger[_0x6614('0x10')](_0x6614('0x14'),_0x40ee29[_0x6614('0x12')],_0x4d1496);_0x4ead5a(_0x30e2d6[_0x6614('0x10')](0x1f4,_0x40ee29[_0x6614('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x285a35){var _0x1c2d69=this;return new Promise(function(_0x205c71,_0x2bb1f8){return db[_0x6614('0x15')][_0x6614('0x18')](_0x285a35[_0x6614('0x19')],{'raw':_0x285a35[_0x6614('0x16')]?_0x285a35[_0x6614('0x16')][_0x6614('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285a35[_0x6614('0x16')]?_0x285a35[_0x6614('0x16')][_0x6614('0x1a')]||null:null,'attributes':_0x285a35[_0x6614('0x16')]?_0x285a35['options'][_0x6614('0x1b')]||null:null,'limit':_0x285a35[_0x6614('0x16')]?_0x285a35[_0x6614('0x16')][_0x6614('0x1c')]||null:null})['then'](function(_0x45c15d){logger[_0x6614('0xa')](_0x6614('0x1d'),_0x285a35);logger[_0x6614('0xd')](_0x6614('0x1d'),_0x285a35,JSON[_0x6614('0xf')](_0x45c15d));_0x205c71(_0x45c15d);})[_0x6614('0x13')](function(_0x37975d){logger[_0x6614('0x10')]('UpdateChatQueueReport',_0x37975d[_0x6614('0x12')],_0x285a35);_0x2bb1f8(_0x1c2d69[_0x6614('0x10')](0x1f4,_0x37975d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c3383db..0c9a5c4 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 _0x7444=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','/describe','isAuthenticated','describe','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x7444,0x112));var _0x4744=function(_0x4723e3,_0x2f7530){_0x4723e3=_0x4723e3-0x0;var _0x47ec31=_0x7444[_0x4723e3];return _0x47ec31;};'use strict';var multer=require(_0x4744('0x0'));var util=require(_0x4744('0x1'));var path=require(_0x4744('0x2'));var timeout=require(_0x4744('0x3'));var express=require(_0x4744('0x4'));var router=express[_0x4744('0x5')]();var fs_extra=require(_0x4744('0x6'));var auth=require(_0x4744('0x7'));var interaction=require(_0x4744('0x8'));var config=require(_0x4744('0x9'));var controller=require(_0x4744('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x4744('0xb')]);router[_0x4744('0xc')](_0x4744('0xd'),auth[_0x4744('0xe')](),controller[_0x4744('0xf')]);router['get']('/:id',auth[_0x4744('0xe')](),controller[_0x4744('0x10')]);router[_0x4744('0x11')]('/',auth[_0x4744('0xe')](),controller['create']);router['put'](_0x4744('0x12'),auth[_0x4744('0xe')](),controller[_0x4744('0x13')]);router[_0x4744('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4744('0x15')]);module[_0x4744('0x16')]=router; \ No newline at end of file +var _0x54be=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x4bdbf3,_0xc32415){var _0xa54c8b=function(_0x2a2f60){while(--_0x2a2f60){_0x4bdbf3['push'](_0x4bdbf3['shift']());}};_0xa54c8b(++_0xc32415);}(_0x54be,0x18e));var _0xe54b=function(_0x1ee65d,_0x13e80f){_0x1ee65d=_0x1ee65d-0x0;var _0x2eb5bb=_0x54be[_0x1ee65d];return _0x2eb5bb;};'use strict';var multer=require(_0xe54b('0x0'));var util=require(_0xe54b('0x1'));var path=require(_0xe54b('0x2'));var timeout=require(_0xe54b('0x3'));var express=require('express');var router=express[_0xe54b('0x4')]();var fs_extra=require(_0xe54b('0x5'));var auth=require(_0xe54b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe54b('0x7'));var controller=require(_0xe54b('0x8'));router['get']('/',auth[_0xe54b('0x9')](),controller[_0xe54b('0xa')]);router[_0xe54b('0xb')](_0xe54b('0xc'),auth[_0xe54b('0x9')](),controller[_0xe54b('0xd')]);router[_0xe54b('0xb')](_0xe54b('0xe'),auth[_0xe54b('0x9')](),controller[_0xe54b('0xf')]);router[_0xe54b('0x10')]('/',auth[_0xe54b('0x9')](),controller[_0xe54b('0x11')]);router['put'](_0xe54b('0xe'),auth['isAuthenticated'](),controller[_0xe54b('0x12')]);router[_0xe54b('0x13')]('/:id',auth[_0xe54b('0x9')](),controller[_0xe54b('0x14')]);module[_0xe54b('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index f0ba842..84e3a23 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x2c1164,_0x420c4d){var _0xee3b5a=function(_0x5d4355){while(--_0x5d4355){_0x2c1164['push'](_0x2c1164['shift']());}};_0xee3b5a(++_0x420c4d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xf3cd[_0x3042c5];return _0x7cd140;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xf866c5,_0x23111f){var _0x3f70c1=function(_0x141b04){while(--_0x141b04){_0xf866c5['push'](_0xf866c5['shift']());}};_0x3f70c1(++_0x23111f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1fa841,_0x37a70c){_0x1fa841=_0x1fa841-0x0;var _0x384b67=_0xf3cd[_0x1fa841];return _0x384b67;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index a14c25e..34ee7e9 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 _0x3bc7=['request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','include','rows','show','params','keys','fields','length','includeAll','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bc7,0x16f));var _0x73bc=function(_0x3b199a,_0x37a6a3){_0x3b199a=_0x3b199a-0x0;var _0x3716bb=_0x3bc7[_0x3b199a];return _0x3716bb;};'use strict';var emlformat=require(_0x73bc('0x0'));var rimraf=require(_0x73bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73bc('0x2'));var rp=require(_0x73bc('0x3'));var moment=require('moment');var BPromise=require(_0x73bc('0x4'));var Mustache=require(_0x73bc('0x5'));var util=require(_0x73bc('0x6'));var path=require(_0x73bc('0x7'));var sox=require('sox');var csv=require(_0x73bc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73bc('0x9'));var _=require(_0x73bc('0xa'));var squel=require(_0x73bc('0xb'));var crypto=require(_0x73bc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x73bc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x73bc('0xe'));var Papa=require(_0x73bc('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x73bc('0x10'));var as=require(_0x73bc('0x11'));var hardwareService=require(_0x73bc('0x12'));var logger=require(_0x73bc('0x13'))(_0x73bc('0x14'));var utils=require('../../config/utils');var config=require(_0x73bc('0x15'));var licenseUtil=require(_0x73bc('0x16'));var db=require(_0x73bc('0x17'))['db'];function respondWithStatusCode(_0x11af65,_0x41609a){_0x41609a=_0x41609a||0xcc;return function(_0x5d5f8b){if(_0x5d5f8b){return _0x11af65[_0x73bc('0x18')](_0x41609a);}return _0x11af65[_0x73bc('0x19')](_0x41609a)[_0x73bc('0x1a')]();};}function respondWithResult(_0x48111e,_0x4f41ac){_0x4f41ac=_0x4f41ac||0xc8;return function(_0x33fc2d){if(_0x33fc2d){return _0x48111e['status'](_0x4f41ac)['json'](_0x33fc2d);}};}function respondWithFilteredResult(_0x35dc66,_0x2a0426){return function(_0x1e44d2){if(_0x1e44d2){var _0x59ed17=typeof _0x2a0426['offset']===_0x73bc('0x1b')&&typeof _0x2a0426[_0x73bc('0x1c')]===_0x73bc('0x1b');var _0x2a9517=_0x1e44d2['count'];var _0x34a30c=_0x59ed17?0x0:_0x2a0426[_0x73bc('0x1d')];var _0x272fb6=_0x59ed17?_0x1e44d2[_0x73bc('0x1e')]:_0x2a0426[_0x73bc('0x1d')]+_0x2a0426['limit'];var _0x10ffae;if(_0x272fb6>=_0x2a9517){_0x272fb6=_0x2a9517;_0x10ffae=0xc8;}else{_0x10ffae=0xce;}_0x35dc66['status'](_0x10ffae);return _0x35dc66[_0x73bc('0x1f')](_0x73bc('0x20'),_0x34a30c+'-'+_0x272fb6+'/'+_0x2a9517)[_0x73bc('0x21')](_0x1e44d2);}return null;};}function patchUpdates(_0x5a2c6b){return function(_0x384a26){try{jsonpatch[_0x73bc('0x22')](_0x384a26,_0x5a2c6b,!![]);}catch(_0x7f5907){return BPromise[_0x73bc('0x23')](_0x7f5907);}return _0x384a26['save']();};}function saveUpdates(_0x1095c7,_0x2632f7){return function(_0xf0cc53){if(_0xf0cc53){return _0xf0cc53[_0x73bc('0x24')](_0x1095c7)[_0x73bc('0x25')](function(_0xa804fe){return _0xa804fe;});}return null;};}function removeEntity(_0x4f26a9,_0x46fbf3){return function(_0x328bd4){if(_0x328bd4){return _0x328bd4[_0x73bc('0x26')]()[_0x73bc('0x25')](function(){_0x4f26a9['status'](0xcc)[_0x73bc('0x1a')]();});}};}function handleEntityNotFound(_0x4166e1,_0xefd034){return function(_0x458a35){if(!_0x458a35){_0x4166e1[_0x73bc('0x18')](0x194);}return _0x458a35;};}function handleError(_0x261678,_0x95ee6f){_0x95ee6f=_0x95ee6f||0x1f4;return function(_0x35fbb6){logger['error'](_0x35fbb6[_0x73bc('0x27')]);if(_0x35fbb6[_0x73bc('0x28')]){delete _0x35fbb6[_0x73bc('0x28')];}_0x261678['status'](_0x95ee6f)[_0x73bc('0x29')](_0x35fbb6);};}exports['index']=function(_0x191c61,_0x23e333){var _0x39986e={},_0x13c363={},_0x3f7808={'count':0x0,'rows':[]};var _0x1afbec=_[_0x73bc('0x2a')](db[_0x73bc('0x2b')][_0x73bc('0x2c')],function(_0x125e8f){return{'name':_0x125e8f[_0x73bc('0x2d')],'type':_0x125e8f[_0x73bc('0x2e')][_0x73bc('0x2f')]};});_0x13c363[_0x73bc('0x30')]=_[_0x73bc('0x2a')](_0x1afbec,_0x73bc('0x28'));_0x13c363[_0x73bc('0x31')]=_['keys'](_0x191c61[_0x73bc('0x31')]);_0x13c363['filters']=_['intersection'](_0x13c363[_0x73bc('0x30')],_0x13c363[_0x73bc('0x31')]);_0x39986e['attributes']=_[_0x73bc('0x32')](_0x13c363['model'],qs['fields'](_0x191c61[_0x73bc('0x31')]['fields']));_0x39986e[_0x73bc('0x33')]=_0x39986e[_0x73bc('0x33')]['length']?_0x39986e[_0x73bc('0x33')]:_0x13c363[_0x73bc('0x30')];if(!_0x191c61['query'][_0x73bc('0x34')](_0x73bc('0x35'))){_0x39986e[_0x73bc('0x1c')]=qs[_0x73bc('0x1c')](_0x191c61[_0x73bc('0x31')]['limit']);_0x39986e[_0x73bc('0x1d')]=qs[_0x73bc('0x1d')](_0x191c61['query'][_0x73bc('0x1d')]);}_0x39986e[_0x73bc('0x36')]=qs['sort'](_0x191c61['query'][_0x73bc('0x37')]);_0x39986e[_0x73bc('0x38')]=qs['filters'](_[_0x73bc('0x39')](_0x191c61[_0x73bc('0x31')],_0x13c363[_0x73bc('0x3a')]),_0x1afbec);if(_0x191c61['query']['filter']){_0x39986e[_0x73bc('0x38')]=_[_0x73bc('0x3b')](_0x39986e[_0x73bc('0x38')],{'$or':_[_0x73bc('0x2a')](_0x1afbec,function(_0x357939){if(_0x357939[_0x73bc('0x2e')]!==_0x73bc('0x3c')){var _0x26a2de={};_0x26a2de[_0x357939[_0x73bc('0x28')]]={'$like':'%'+_0x191c61[_0x73bc('0x31')]['filter']+'%'};return _0x26a2de;}})});}_0x39986e=_[_0x73bc('0x3b')]({},_0x39986e,_0x191c61['options']);var _0x45da5c={'where':_0x39986e[_0x73bc('0x38')]};return db[_0x73bc('0x2b')][_0x73bc('0x1e')](_0x45da5c)[_0x73bc('0x25')](function(_0x92d780){_0x3f7808[_0x73bc('0x1e')]=_0x92d780;if(_0x191c61[_0x73bc('0x31')]['includeAll']){_0x39986e[_0x73bc('0x3d')]=[{'all':!![]}];}return db[_0x73bc('0x2b')]['findAll'](_0x39986e);})['then'](function(_0x260426){_0x3f7808[_0x73bc('0x3e')]=_0x260426;return _0x3f7808;})[_0x73bc('0x25')](respondWithFilteredResult(_0x23e333,_0x39986e))['catch'](handleError(_0x23e333,null));};exports[_0x73bc('0x3f')]=function(_0x180c02,_0x2f2a81){var _0x4be710={'raw':!![],'where':{'id':_0x180c02[_0x73bc('0x40')]['id']}},_0x17b808={};_0x17b808['model']=_[_0x73bc('0x41')](db[_0x73bc('0x2b')]['rawAttributes']);_0x17b808[_0x73bc('0x31')]=_[_0x73bc('0x41')](_0x180c02[_0x73bc('0x31')]);_0x17b808[_0x73bc('0x3a')]=_[_0x73bc('0x32')](_0x17b808[_0x73bc('0x30')],_0x17b808['query']);_0x4be710[_0x73bc('0x33')]=_[_0x73bc('0x32')](_0x17b808[_0x73bc('0x30')],qs[_0x73bc('0x42')](_0x180c02['query'][_0x73bc('0x42')]));_0x4be710[_0x73bc('0x33')]=_0x4be710['attributes'][_0x73bc('0x43')]?_0x4be710[_0x73bc('0x33')]:_0x17b808[_0x73bc('0x30')];if(_0x180c02['query'][_0x73bc('0x44')]){_0x4be710[_0x73bc('0x3d')]=[{'all':!![]}];}_0x4be710=_[_0x73bc('0x3b')]({},_0x4be710,_0x180c02['options']);return db[_0x73bc('0x2b')][_0x73bc('0x45')](_0x4be710)[_0x73bc('0x25')](handleEntityNotFound(_0x2f2a81,null))['then'](respondWithResult(_0x2f2a81,null))[_0x73bc('0x46')](handleError(_0x2f2a81,null));};exports['create']=function(_0x336fd3,_0x264bf5){return db[_0x73bc('0x2b')][_0x73bc('0x47')](_0x336fd3[_0x73bc('0x48')],{})[_0x73bc('0x25')](respondWithResult(_0x264bf5,0xc9))[_0x73bc('0x46')](handleError(_0x264bf5,null));};exports[_0x73bc('0x24')]=function(_0x2f1dcd,_0x243d11){if(_0x2f1dcd[_0x73bc('0x48')]['id']){delete _0x2f1dcd['body']['id'];}return db['ChatTransferReport'][_0x73bc('0x45')]({'where':{'id':_0x2f1dcd[_0x73bc('0x40')]['id']}})[_0x73bc('0x25')](handleEntityNotFound(_0x243d11,null))[_0x73bc('0x25')](saveUpdates(_0x2f1dcd['body'],null))[_0x73bc('0x25')](respondWithResult(_0x243d11,null))[_0x73bc('0x46')](handleError(_0x243d11,null));};exports[_0x73bc('0x26')]=function(_0x1e7168,_0x50e6fa){return db[_0x73bc('0x2b')]['find']({'where':{'id':_0x1e7168[_0x73bc('0x40')]['id']}})[_0x73bc('0x25')](handleEntityNotFound(_0x50e6fa,null))[_0x73bc('0x25')](removeEntity(_0x50e6fa,null))[_0x73bc('0x46')](handleError(_0x50e6fa,null));};exports[_0x73bc('0x49')]=function(_0x1d4b86,_0x5cd31f){return db['ChatTransferReport']['describe']()[_0x73bc('0x25')](respondWithResult(_0x5cd31f,null))[_0x73bc('0x46')](handleError(_0x5cd31f,null));}; \ No newline at end of file +var _0x856c=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','fs-extra','crypto','jsforce'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x856c,0x171));var _0xc856=function(_0x2c6535,_0x3ad8ca){_0x2c6535=_0x2c6535-0x0;var _0x4f3575=_0x856c[_0x2c6535];return _0x4f3575;};'use strict';var emlformat=require(_0xc856('0x0'));var rimraf=require(_0xc856('0x1'));var zipdir=require(_0xc856('0x2'));var jsonpatch=require(_0xc856('0x3'));var rp=require('request-promise');var moment=require(_0xc856('0x4'));var BPromise=require(_0xc856('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc856('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc856('0x7'));var fs=require('fs');var fs_extra=require(_0xc856('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc856('0x9'));var jsforce=require(_0xc856('0xa'));var deskjs=require(_0xc856('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc856('0xc'));var Papa=require(_0xc856('0xd'));var Redis=require(_0xc856('0xe'));var authService=require(_0xc856('0xf'));var qs=require(_0xc856('0x10'));var as=require(_0xc856('0x11'));var hardwareService=require(_0xc856('0x12'));var logger=require(_0xc856('0x13'))(_0xc856('0x14'));var utils=require(_0xc856('0x15'));var config=require(_0xc856('0x16'));var licenseUtil=require(_0xc856('0x17'));var db=require(_0xc856('0x18'))['db'];function respondWithStatusCode(_0x40b0a9,_0x472f6d){_0x472f6d=_0x472f6d||0xcc;return function(_0x1ad7e4){if(_0x1ad7e4){return _0x40b0a9[_0xc856('0x19')](_0x472f6d);}return _0x40b0a9[_0xc856('0x1a')](_0x472f6d)[_0xc856('0x1b')]();};}function respondWithResult(_0x51edf3,_0xeb83c){_0xeb83c=_0xeb83c||0xc8;return function(_0x147330){if(_0x147330){return _0x51edf3[_0xc856('0x1a')](_0xeb83c)[_0xc856('0x1c')](_0x147330);}};}function respondWithFilteredResult(_0x5ae5b6,_0x20601f){return function(_0x115a88){if(_0x115a88){var _0x52342c=typeof _0x20601f[_0xc856('0x1d')]===_0xc856('0x1e')&&typeof _0x20601f['limit']===_0xc856('0x1e');var _0x57ee9e=_0x115a88[_0xc856('0x1f')];var _0x5b805d=_0x52342c?0x0:_0x20601f[_0xc856('0x1d')];var _0x35735f=_0x52342c?_0x115a88['count']:_0x20601f[_0xc856('0x1d')]+_0x20601f['limit'];var _0xe04962;if(_0x35735f>=_0x57ee9e){_0x35735f=_0x57ee9e;_0xe04962=0xc8;}else{_0xe04962=0xce;}_0x5ae5b6[_0xc856('0x1a')](_0xe04962);return _0x5ae5b6['set'](_0xc856('0x20'),_0x5b805d+'-'+_0x35735f+'/'+_0x57ee9e)[_0xc856('0x1c')](_0x115a88);}return null;};}function patchUpdates(_0x2e9237){return function(_0x268e61){try{jsonpatch[_0xc856('0x21')](_0x268e61,_0x2e9237,!![]);}catch(_0x2cf990){return BPromise[_0xc856('0x22')](_0x2cf990);}return _0x268e61[_0xc856('0x23')]();};}function saveUpdates(_0x9133cf,_0x269f92){return function(_0x2da829){if(_0x2da829){return _0x2da829[_0xc856('0x24')](_0x9133cf)[_0xc856('0x25')](function(_0x5a37f5){return _0x5a37f5;});}return null;};}function removeEntity(_0x1994f5,_0x6421e7){return function(_0x5e6e13){if(_0x5e6e13){return _0x5e6e13[_0xc856('0x26')]()['then'](function(){_0x1994f5[_0xc856('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c81e,_0x1b7a6f){return function(_0x259f76){if(!_0x259f76){_0x58c81e[_0xc856('0x19')](0x194);}return _0x259f76;};}function handleError(_0x501055,_0x340d50){_0x340d50=_0x340d50||0x1f4;return function(_0x1b2162){logger['error'](_0x1b2162[_0xc856('0x27')]);if(_0x1b2162[_0xc856('0x28')]){delete _0x1b2162[_0xc856('0x28')];}_0x501055['status'](_0x340d50)[_0xc856('0x29')](_0x1b2162);};}exports[_0xc856('0x2a')]=function(_0x1e246f,_0x554768){var _0x3ed6bc={},_0x431b27={},_0x3158d7={'count':0x0,'rows':[]};var _0x352f13=_[_0xc856('0x2b')](db[_0xc856('0x2c')][_0xc856('0x2d')],function(_0x15f315){return{'name':_0x15f315[_0xc856('0x2e')],'type':_0x15f315[_0xc856('0x2f')]['key']};});_0x431b27[_0xc856('0x30')]=_[_0xc856('0x2b')](_0x352f13,_0xc856('0x28'));_0x431b27[_0xc856('0x31')]=_[_0xc856('0x32')](_0x1e246f[_0xc856('0x31')]);_0x431b27['filters']=_[_0xc856('0x33')](_0x431b27[_0xc856('0x30')],_0x431b27[_0xc856('0x31')]);_0x3ed6bc[_0xc856('0x34')]=_[_0xc856('0x33')](_0x431b27[_0xc856('0x30')],qs[_0xc856('0x35')](_0x1e246f[_0xc856('0x31')][_0xc856('0x35')]));_0x3ed6bc['attributes']=_0x3ed6bc[_0xc856('0x34')][_0xc856('0x36')]?_0x3ed6bc[_0xc856('0x34')]:_0x431b27[_0xc856('0x30')];if(!_0x1e246f[_0xc856('0x31')][_0xc856('0x37')]('nolimit')){_0x3ed6bc[_0xc856('0x38')]=qs['limit'](_0x1e246f[_0xc856('0x31')]['limit']);_0x3ed6bc[_0xc856('0x1d')]=qs[_0xc856('0x1d')](_0x1e246f[_0xc856('0x31')][_0xc856('0x1d')]);}_0x3ed6bc[_0xc856('0x39')]=qs[_0xc856('0x3a')](_0x1e246f[_0xc856('0x31')]['sort']);_0x3ed6bc[_0xc856('0x3b')]=qs[_0xc856('0x3c')](_[_0xc856('0x3d')](_0x1e246f['query'],_0x431b27[_0xc856('0x3c')]),_0x352f13);if(_0x1e246f['query'][_0xc856('0x3e')]){_0x3ed6bc['where']=_[_0xc856('0x3f')](_0x3ed6bc['where'],{'$or':_[_0xc856('0x2b')](_0x352f13,function(_0x3f8ec6){if(_0x3f8ec6[_0xc856('0x2f')]!==_0xc856('0x40')){var _0x460ce2={};_0x460ce2[_0x3f8ec6[_0xc856('0x28')]]={'$like':'%'+_0x1e246f[_0xc856('0x31')][_0xc856('0x3e')]+'%'};return _0x460ce2;}})});}_0x3ed6bc=_[_0xc856('0x3f')]({},_0x3ed6bc,_0x1e246f[_0xc856('0x41')]);var _0x4f73ca={'where':_0x3ed6bc[_0xc856('0x3b')]};return db[_0xc856('0x2c')]['count'](_0x4f73ca)[_0xc856('0x25')](function(_0x44dc8f){_0x3158d7[_0xc856('0x1f')]=_0x44dc8f;if(_0x1e246f[_0xc856('0x31')]['includeAll']){_0x3ed6bc[_0xc856('0x42')]=[{'all':!![]}];}return db[_0xc856('0x2c')][_0xc856('0x43')](_0x3ed6bc);})[_0xc856('0x25')](function(_0x432f20){_0x3158d7[_0xc856('0x44')]=_0x432f20;return _0x3158d7;})[_0xc856('0x25')](respondWithFilteredResult(_0x554768,_0x3ed6bc))[_0xc856('0x45')](handleError(_0x554768,null));};exports[_0xc856('0x46')]=function(_0x188b0a,_0x19c5e6){var _0xabf2b8={'raw':!![],'where':{'id':_0x188b0a[_0xc856('0x47')]['id']}},_0x561267={};_0x561267[_0xc856('0x30')]=_[_0xc856('0x32')](db['ChatTransferReport'][_0xc856('0x2d')]);_0x561267[_0xc856('0x31')]=_[_0xc856('0x32')](_0x188b0a[_0xc856('0x31')]);_0x561267[_0xc856('0x3c')]=_[_0xc856('0x33')](_0x561267[_0xc856('0x30')],_0x561267['query']);_0xabf2b8['attributes']=_[_0xc856('0x33')](_0x561267[_0xc856('0x30')],qs[_0xc856('0x35')](_0x188b0a[_0xc856('0x31')][_0xc856('0x35')]));_0xabf2b8[_0xc856('0x34')]=_0xabf2b8[_0xc856('0x34')][_0xc856('0x36')]?_0xabf2b8[_0xc856('0x34')]:_0x561267[_0xc856('0x30')];if(_0x188b0a[_0xc856('0x31')]['includeAll']){_0xabf2b8[_0xc856('0x42')]=[{'all':!![]}];}_0xabf2b8=_[_0xc856('0x3f')]({},_0xabf2b8,_0x188b0a[_0xc856('0x41')]);return db['ChatTransferReport'][_0xc856('0x48')](_0xabf2b8)['then'](handleEntityNotFound(_0x19c5e6,null))[_0xc856('0x25')](respondWithResult(_0x19c5e6,null))[_0xc856('0x45')](handleError(_0x19c5e6,null));};exports[_0xc856('0x49')]=function(_0x1a72f2,_0x232e67){return db[_0xc856('0x2c')][_0xc856('0x49')](_0x1a72f2[_0xc856('0x4a')],{})[_0xc856('0x25')](respondWithResult(_0x232e67,0xc9))[_0xc856('0x45')](handleError(_0x232e67,null));};exports[_0xc856('0x24')]=function(_0x3821b3,_0xb32852){if(_0x3821b3['body']['id']){delete _0x3821b3[_0xc856('0x4a')]['id'];}return db[_0xc856('0x2c')][_0xc856('0x48')]({'where':{'id':_0x3821b3[_0xc856('0x47')]['id']}})[_0xc856('0x25')](handleEntityNotFound(_0xb32852,null))[_0xc856('0x25')](saveUpdates(_0x3821b3[_0xc856('0x4a')],null))[_0xc856('0x25')](respondWithResult(_0xb32852,null))[_0xc856('0x45')](handleError(_0xb32852,null));};exports[_0xc856('0x26')]=function(_0x48868e,_0x38b3bc){return db['ChatTransferReport']['find']({'where':{'id':_0x48868e[_0xc856('0x47')]['id']}})[_0xc856('0x25')](handleEntityNotFound(_0x38b3bc,null))['then'](removeEntity(_0x38b3bc,null))['catch'](handleError(_0x38b3bc,null));};exports[_0xc856('0x4b')]=function(_0x2fe959,_0x2cbe01){return db[_0xc856('0x2c')][_0xc856('0x4b')]()['then'](respondWithResult(_0x2cbe01,null))[_0xc856('0x45')](handleError(_0x2cbe01,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3502795..638ca40 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 _0x7037=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','moment','request-promise'];(function(_0x305e0a,_0x461a01){var _0x2b31f6=function(_0x3d6eb6){while(--_0x3d6eb6){_0x305e0a['push'](_0x305e0a['shift']());}};_0x2b31f6(++_0x461a01);}(_0x7037,0x19e));var _0x7703=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7037[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x7703('0x0'));var util=require(_0x7703('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7703('0x2'));var BPromise=require('bluebird');var rp=require(_0x7703('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7703('0x4'));var config=require(_0x7703('0x5'));var attributes=require(_0x7703('0x6'));module[_0x7703('0x7')]=function(_0x230234,_0x83b115){return _0x230234[_0x7703('0x8')]('ChatTransferReport',attributes,{'tableName':_0x7703('0x9'),'paranoid':![],'indexes':[{'name':_0x7703('0xa'),'fields':[_0x7703('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67ad=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5eb6e0,_0x3cf0aa){var _0x3b5419=function(_0x3f8a86){while(--_0x3f8a86){_0x5eb6e0['push'](_0x5eb6e0['shift']());}};_0x3b5419(++_0x3cf0aa);}(_0x67ad,0x179));var _0xd67a=function(_0x18a80a,_0x5cbf2f){_0x18a80a=_0x18a80a-0x0;var _0x4eed55=_0x67ad[_0x18a80a];return _0x4eed55;};'use strict';var _=require(_0xd67a('0x0'));var util=require(_0xd67a('0x1'));var logger=require(_0xd67a('0x2'))(_0xd67a('0x3'));var moment=require('moment');var BPromise=require(_0xd67a('0x4'));var rp=require(_0xd67a('0x5'));var fs=require('fs');var path=require(_0xd67a('0x6'));var rimraf=require(_0xd67a('0x7'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x31ed92,_0x59ab4e){return _0x31ed92['define'](_0xd67a('0x8'),attributes,{'tableName':_0xd67a('0x9'),'paranoid':![],'indexes':[{'name':_0xd67a('0xa'),'fields':[_0xd67a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 8108c04..63fbd5c 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 _0x030d=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','randomstring','ioredis'];(function(_0xa76940,_0x1b9ee1){var _0x32d671=function(_0x3cdb2b){while(--_0x3cdb2b){_0xa76940['push'](_0xa76940['shift']());}};_0x32d671(++_0x1b9ee1);}(_0x030d,0x123));var _0xd030=function(_0x4b3d88,_0x49a095){_0x4b3d88=_0x4b3d88-0x0;var _0x11dbf5=_0x030d[_0x4b3d88];return _0x11dbf5;};'use strict';var _=require('lodash');var util=require(_0xd030('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd030('0x1'));var fs=require('fs');var Redis=require(_0xd030('0x2'));var db=require(_0xd030('0x3'))['db'];var utils=require(_0xd030('0x4'));var logger=require('../../config/logger')(_0xd030('0x5'));var config=require(_0xd030('0x6'));var jayson=require(_0xd030('0x7'));var client=jayson[_0xd030('0x8')][_0xd030('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x101410,_0x2b1d4a,_0x10f66a){return new BPromise(function(_0x2b1743,_0x4ff280){return client[_0xd030('0xa')](_0x101410,_0x10f66a)[_0xd030('0xb')](function(_0x5c57f0){logger['info'](_0xd030('0xc'),_0x2b1d4a,_0xd030('0xd'));logger['debug'](_0xd030('0xe'),_0x2b1d4a,_0xd030('0xd'),JSON[_0xd030('0xf')](_0x5c57f0));if(_0x5c57f0['error']){if(_0x5c57f0['error']['code']===0x1f4){logger['error'](_0xd030('0xc'),_0x2b1d4a,_0x5c57f0[_0xd030('0x10')][_0xd030('0x11')]);return _0x4ff280(_0x5c57f0[_0xd030('0x10')][_0xd030('0x11')]);}logger[_0xd030('0x10')](_0xd030('0xc'),_0x2b1d4a,_0x5c57f0[_0xd030('0x10')][_0xd030('0x11')]);return _0x2b1743(_0x5c57f0['error'][_0xd030('0x11')]);}else{logger[_0xd030('0x12')](_0xd030('0xc'),_0x2b1d4a,_0xd030('0xd'));_0x2b1743(_0x5c57f0[_0xd030('0x13')][_0xd030('0x11')]);}})[_0xd030('0x14')](function(_0x51b72c){logger[_0xd030('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x2b1d4a,_0x51b72c);_0x4ff280(_0x51b72c);});});} \ No newline at end of file +var _0x35e5=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','ChatTransferReport,\x20%s,\x20%s','message','request\x20sent'];(function(_0x5d34d5,_0x4f1b38){var _0xa0ac47=function(_0x54f959){while(--_0x54f959){_0x5d34d5['push'](_0x5d34d5['shift']());}};_0xa0ac47(++_0x4f1b38);}(_0x35e5,0x1cf));var _0x535e=function(_0x4ea598,_0x43d6c4){_0x4ea598=_0x4ea598-0x0;var _0x553d08=_0x35e5[_0x4ea598];return _0x553d08;};'use strict';var _=require(_0x535e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x535e('0x1'));var rs=require(_0x535e('0x2'));var fs=require('fs');var Redis=require(_0x535e('0x3'));var db=require(_0x535e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x535e('0x5'))(_0x535e('0x6'));var config=require(_0x535e('0x7'));var jayson=require(_0x535e('0x8'));var client=jayson[_0x535e('0x9')][_0x535e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50ab57,_0x28efee,_0x37a08c){return new BPromise(function(_0x2b1c18,_0x32a0b6){return client[_0x535e('0xb')](_0x50ab57,_0x37a08c)[_0x535e('0xc')](function(_0x52ad5a){logger[_0x535e('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x28efee,'request\x20sent');logger[_0x535e('0xe')](_0x535e('0xf'),_0x28efee,'request\x20sent',JSON['stringify'](_0x52ad5a));if(_0x52ad5a[_0x535e('0x10')]){if(_0x52ad5a[_0x535e('0x10')]['code']===0x1f4){logger[_0x535e('0x10')](_0x535e('0x11'),_0x28efee,_0x52ad5a[_0x535e('0x10')][_0x535e('0x12')]);return _0x32a0b6(_0x52ad5a[_0x535e('0x10')][_0x535e('0x12')]);}logger['error'](_0x535e('0x11'),_0x28efee,_0x52ad5a[_0x535e('0x10')][_0x535e('0x12')]);return _0x2b1c18(_0x52ad5a[_0x535e('0x10')][_0x535e('0x12')]);}else{logger['info'](_0x535e('0x11'),_0x28efee,_0x535e('0x13'));_0x2b1c18(_0x52ad5a[_0x535e('0x14')]['message']);}})['catch'](function(_0x7d1e2f){logger[_0x535e('0x10')](_0x535e('0x11'),_0x28efee,_0x7d1e2f);_0x32a0b6(_0x7d1e2f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b83736d..7eb4e7a 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 _0x891e=['get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0x891e,0xff));var _0xe891=function(_0x575a31,_0x56336f){_0x575a31=_0x575a31-0x0;var _0x5d7dad=_0x891e[_0x575a31];return _0x5d7dad;};'use strict';var multer=require(_0xe891('0x0'));var util=require(_0xe891('0x1'));var path=require(_0xe891('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe891('0x3')]();var fs_extra=require(_0xe891('0x4'));var auth=require(_0xe891('0x5'));var interaction=require(_0xe891('0x6'));var config=require(_0xe891('0x7'));var controller=require(_0xe891('0x8'));router[_0xe891('0x9')]('/',auth[_0xe891('0xa')](),controller[_0xe891('0xb')]);router[_0xe891('0x9')](_0xe891('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe891('0x9')]('/:id',auth[_0xe891('0xa')](),controller[_0xe891('0xd')]);router[_0xe891('0xe')]('/',auth[_0xe891('0xa')](),controller[_0xe891('0xf')]);router[_0xe891('0x10')](_0xe891('0x11'),auth[_0xe891('0xa')](),controller[_0xe891('0x12')]);router[_0xe891('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xe891('0x14')]);module[_0xe891('0x15')]=router; \ No newline at end of file +var _0xd149=['exports','multer','util','connect-timeout','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','delete','destroy'];(function(_0x3b3bbc,_0x5c0e75){var _0x32d1f2=function(_0x449c0b){while(--_0x449c0b){_0x3b3bbc['push'](_0x3b3bbc['shift']());}};_0x32d1f2(++_0x5c0e75);}(_0xd149,0x1d1));var _0x9d14=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xd149[_0xfa634c];return _0x73e478;};'use strict';var multer=require(_0x9d14('0x0'));var util=require(_0x9d14('0x1'));var path=require('path');var timeout=require(_0x9d14('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9d14('0x3'));var controller=require(_0x9d14('0x4'));router['get']('/',auth[_0x9d14('0x5')](),controller[_0x9d14('0x6')]);router[_0x9d14('0x7')](_0x9d14('0x8'),auth[_0x9d14('0x5')](),controller[_0x9d14('0x9')]);router['get'](_0x9d14('0xa'),auth[_0x9d14('0x5')](),controller[_0x9d14('0xb')]);router[_0x9d14('0xc')]('/',auth[_0x9d14('0x5')](),controller['create']);router['put'](_0x9d14('0xa'),auth[_0x9d14('0x5')](),controller['update']);router[_0x9d14('0xd')](_0x9d14('0xa'),auth['isAuthenticated'](),controller[_0x9d14('0xe')]);module[_0x9d14('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 3ced09d..5e727f5 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 _0xaa88=['#011F6A','#ffffff','BOOLEAN','ENUM','rounded','Chat','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Send','Skip','Feedback','star','thumb','input','text','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','INTEGER','CHAT','#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','randomstring','exports','STRING','address','email','Agent'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xaa88,0x137));var _0x8aa8=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0xaa88[_0x3ee1fe];return _0x1ae57a;};'use strict';var Sequelize=require(_0x8aa8('0x0'));var rs=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'name':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8aa8('0x4')},'description':{'type':Sequelize[_0x8aa8('0x3')]},'mapKey':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x5')},'mapKeyOffline':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8aa8('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8aa8('0x3')]},'animation':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8aa8('0xa')](_0x8aa8('0xb'),'squared'),'defaultValue':_0x8aa8('0xb')},'header_online':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0xc')},'offline_chat_button':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0xd')},'download_transcript':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8aa8('0xe')]},'closingQuestion':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x11')},'noteTitle':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x13')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x14')},'conditionAgreement':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x15')},'ratingType':{'type':Sequelize[_0x8aa8('0xa')](_0x8aa8('0x16'),_0x8aa8('0x17')),'defaultValue':_0x8aa8('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8aa8('0x18'),'variable':null,'config':{'placeholder':'name','type':_0x8aa8('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x8aa8('0x18'),'props':{'title':_0x8aa8('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x8aa8('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8aa8('0x1a')](_0x8aa8('0x1b'))?JSON[_0x8aa8('0x1c')](this['getDataValue']('onlineForm')):{};},'set':function(_0x2d1508){return this[_0x8aa8('0x1d')](_0x8aa8('0x1b'),JSON[_0x8aa8('0x1e')](_0x2d1508));}},'offlineForm':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8aa8('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x8aa8('0x5'),'type':_0x8aa8('0x5')},'variable':null},{'type':_0x8aa8('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x8aa8('0x20')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x8aa8('0x21'))?JSON[_0x8aa8('0x1c')](this[_0x8aa8('0x1a')](_0x8aa8('0x21'))):{};},'set':function(_0xe07a83){return this['setDataValue'](_0x8aa8('0x21'),JSON[_0x8aa8('0x1e')](_0xe07a83));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8aa8('0x22')]();}},'autoclose':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8aa8('0x3')]},'forwardOffline':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8aa8('0x3')]},'waitingTitle':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x23')},'waitingMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x25')},'offlineMessageBody':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x27')},'skipUnmanaged':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x14')},'sendUnmanaged':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x13')},'enableCustomerAttachment':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':function(){return _0x8aa8('0x28');}},'notificationSound':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x2a')},'verticalAlignment':{'type':Sequelize[_0x8aa8('0x2b')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x2c')},'messagesAlignment':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x8aa8('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8aa8('0x2b')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8aa8('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8aa8('0x2b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8aa8('0x2b')],'comment':_0x8aa8('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8aa8('0x30'),'set':function(_0x3c6115){if(!_0x3c6115)this[_0x8aa8('0x1d')](_0x8aa8('0x31'),null);this[_0x8aa8('0x1d')](_0x8aa8('0x32'),_0x3c6115);}},'vidaooEscalation':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8aa8('0x3')]},'vidaooTopic':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x33')},'vidaooNote':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':function(){return _0x8aa8('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8aa8('0xe')]}}; \ No newline at end of file +var _0xd2ea=['Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','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','#011F6A','INTEGER','BOOLEAN','ENUM','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea'];(function(_0xd933cf,_0x1d96c7){var _0xd88807=function(_0x3422ab){while(--_0x3422ab){_0xd933cf['push'](_0xd933cf['shift']());}};_0xd88807(++_0x1d96c7);}(_0xd2ea,0x15f));var _0xad2e=function(_0x241b5b,_0x388051){_0x241b5b=_0x241b5b-0x0;var _0x28b94b=_0xd2ea[_0x241b5b];return _0x28b94b;};'use strict';var Sequelize=require(_0xad2e('0x0'));var rs=require(_0xad2e('0x1'));module[_0xad2e('0x2')]={'name':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xad2e('0x3')]},'mapKey':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x4')},'mapKeyOffline':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x4')},'key':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':_0xad2e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad2e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xad2e('0x3')]},'animation':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xad2e('0x8')]('rounded',_0xad2e('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xa')},'start_chat_button':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xad2e('0xe')]},'closingQuestion':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x11')},'noteTitle':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x12')},'placeholderMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x13')},'closingMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x14')},'closingMessageButton':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x16')},'ratingType':{'type':Sequelize[_0xad2e('0x8')](_0xad2e('0x17'),_0xad2e('0x18')),'defaultValue':_0xad2e('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xad2e('0xe')],'defaultValue':function(){return JSON[_0xad2e('0x19')]({'items':[{'type':_0xad2e('0x1a'),'variable':null,'config':{'placeholder':_0xad2e('0x1b'),'type':_0xad2e('0x1c'),'required':!![]},'props':{'title':_0xad2e('0x1b'),'helpText':''}},{'type':_0xad2e('0x1a'),'props':{'title':_0xad2e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xad2e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xad2e('0x1d')](_0xad2e('0x1e'))?JSON[_0xad2e('0x1f')](this[_0xad2e('0x1d')](_0xad2e('0x1e'))):{};},'set':function(_0x58acc8){return this[_0xad2e('0x20')](_0xad2e('0x1e'),JSON[_0xad2e('0x19')](_0x58acc8));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xad2e('0x19')]({'items':[{'type':'input','props':{'title':_0xad2e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xad2e('0x4'),'type':_0xad2e('0x4')},'variable':null},{'type':_0xad2e('0x21'),'config':{'placeholder':_0xad2e('0x22')},'props':{'title':_0xad2e('0x22'),'helpText':_0xad2e('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xad2e('0x1d')](_0xad2e('0x24'))?JSON[_0xad2e('0x1f')](this['getDataValue'](_0xad2e('0x24'))):{};},'set':function(_0xfd2087){return this[_0xad2e('0x20')](_0xad2e('0x24'),JSON[_0xad2e('0x19')](_0xfd2087));}},'token':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':function(){return rs[_0xad2e('0x25')]();}},'autoclose':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xad2e('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xad2e('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x26')},'waitingMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xad2e('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xad2e('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xad2e('0x2b');}},'notificationSound':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xad2e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2e')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2f')},'defaultTitle':{'type':Sequelize[_0xad2e('0x3')]},'customerAvatar':{'type':Sequelize[_0xad2e('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad2e('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xad2e('0x6')],'comment':_0xad2e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![],'comment':_0xad2e('0x32'),'set':function(_0x6f4fbc){if(!_0x6f4fbc)this[_0xad2e('0x20')](_0xad2e('0x33'),null);this['setDataValue'](_0xad2e('0x34'),_0x6f4fbc);}},'vidaooEscalation':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xad2e('0x3')]},'vidaooTopic':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':_0xad2e('0x35')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xad2e('0x36');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xad2e('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index a713838..ce4c68e 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 _0xb490=['x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','offline','no\x20available\x20attributes','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','fromString','originalname','mimetype','server','files','attachments','offline-chat','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','readFileSync','URL','address','origin','3.1.0','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachments','addAgents','removeAgents','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','html-to-text','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','set','json','update','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','count','includeAll','include','show','params','keys','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','filter','findAll','removeDispositions','CannedAnswer','getAnswers','rows','removeAnswers','ids','addLogo','sitepic','filename','addCustomerAvatar','customerAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','getResult','chat','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','ChatApplication','Applications','account','applications','priority','asc','contact','cf-connecting-ip','headers','x-forwarded-for','first','firstName'];(function(_0x30f2a1,_0x18304f){var _0x56c1f1=function(_0x543611){while(--_0x543611){_0x30f2a1['push'](_0x30f2a1['shift']());}};_0x56c1f1(++_0x18304f);}(_0xb490,0x1af));var _0x0b49=function(_0x11b23d,_0x47a519){_0x11b23d=_0x11b23d-0x0;var _0x1553e1=_0xb490[_0x11b23d];return _0x1553e1;};'use strict';var BPromise=require(_0x0b49('0x0'));var Mustache=require(_0x0b49('0x1'));var util=require(_0x0b49('0x2'));var path=require(_0x0b49('0x3'));var ejs=require(_0x0b49('0x4'));var fs=require('fs');var fs_extra=require(_0x0b49('0x5'));var _=require(_0x0b49('0x6'));var querystring=require(_0x0b49('0x7'));var Redis=require(_0x0b49('0x8'));var qs=require(_0x0b49('0x9'));var logger=require(_0x0b49('0xa'))(_0x0b49('0xb'));var config=require(_0x0b49('0xc'));var url=require(_0x0b49('0xd'));var db=require(_0x0b49('0xe'))['db'];config[_0x0b49('0xf')]=_[_0x0b49('0x10')](config[_0x0b49('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b49('0x11'))(new Redis(config[_0x0b49('0xf')]));require(_0x0b49('0x12'))['register'](socket);var htmlToText=require(_0x0b49('0x13'));var jayson=require('jayson/promise');var client=jayson[_0x0b49('0x14')][_0x0b49('0x15')]({'port':0x232c});var client9002=jayson[_0x0b49('0x14')]['http']({'port':0x232a});var client9003=jayson[_0x0b49('0x14')][_0x0b49('0x15')]({'port':0x232b});var client9001=jayson[_0x0b49('0x14')]['http']({'port':0x2329});function respondWithRpcPromise(_0x4129,_0x2f34d8,_0x4fec4a,_0x5dbef2){return new BPromise(function(_0x325206,_0x20d872){var _0x1af11b=_0x5dbef2||client;return _0x1af11b[_0x0b49('0x16')](_0x4129,_0x4fec4a)[_0x0b49('0x17')](function(_0x1b803e){logger['info'](_0x0b49('0x18'),_0x2f34d8,_0x0b49('0x19'));logger[_0x0b49('0x1a')](_0x0b49('0x1b'),_0x2f34d8,'request\x20sent',JSON['stringify'](_0x1b803e));if(_0x1b803e[_0x0b49('0x1c')]){if(_0x1b803e['error'][_0x0b49('0x1d')]===0x1f4){logger[_0x0b49('0x1c')](_0x0b49('0x18'),_0x2f34d8,_0x1b803e[_0x0b49('0x1c')][_0x0b49('0x1e')]);return _0x20d872(_0x1b803e[_0x0b49('0x1c')][_0x0b49('0x1e')]);}logger[_0x0b49('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x2f34d8,_0x1b803e[_0x0b49('0x1c')][_0x0b49('0x1e')]);return _0x325206(_0x1b803e[_0x0b49('0x1c')]['message']);}else{logger['info'](_0x0b49('0x18'),_0x2f34d8,_0x0b49('0x19'));_0x325206(_0x1b803e[_0x0b49('0x1f')]['message']);}})[_0x0b49('0x20')](function(_0x4461ff){logger[_0x0b49('0x1c')](_0x0b49('0x18'),_0x2f34d8,_0x4461ff);_0x20d872(_0x4461ff);});});}function respondWithStatusCode(_0x2247ce,_0x237c31){_0x237c31=_0x237c31||0xcc;return function(_0x3802b2){if(_0x3802b2){return _0x2247ce[_0x0b49('0x21')](_0x237c31);}return _0x2247ce[_0x0b49('0x22')](_0x237c31)['end']();};}function respondWithResult(_0x586fc6,_0x14bfc0){_0x14bfc0=_0x14bfc0||0xc8;return function(_0x295163){if(_0x295163){return _0x586fc6[_0x0b49('0x22')](_0x14bfc0)['json'](_0x295163);}};}function respondWithFilteredResult(_0x1bd810,_0x517904){return function(_0x4493ac){if(_0x4493ac){var _0x2feb62=typeof _0x517904[_0x0b49('0x23')]===_0x0b49('0x24')&&typeof _0x517904['limit']===_0x0b49('0x24');var _0x5ea894=_0x4493ac['count'];var _0x49acd1=_0x2feb62?0x0:_0x517904[_0x0b49('0x23')];var _0x4e55d9=_0x2feb62?_0x4493ac['count']:_0x517904[_0x0b49('0x23')]+_0x517904[_0x0b49('0x25')];var _0xcb7b68;if(_0x4e55d9>=_0x5ea894){_0x4e55d9=_0x5ea894;_0xcb7b68=0xc8;}else{_0xcb7b68=0xce;}_0x1bd810[_0x0b49('0x22')](_0xcb7b68);return _0x1bd810[_0x0b49('0x26')]('Content-Range',_0x49acd1+'-'+_0x4e55d9+'/'+_0x5ea894)[_0x0b49('0x27')](_0x4493ac);}return null;};}function saveUpdates(_0x200269){return function(_0x5696e4){if(_0x5696e4){return _0x5696e4[_0x0b49('0x28')](_0x200269)['then'](function(_0x3c819e){return _0x3c819e;});}return null;};}function removeEntity(_0x52e696){return function(_0x4060a9){if(_0x4060a9){return _0x4060a9['destroy']()[_0x0b49('0x17')](function(){var _0x3d01af=_0x4060a9['get']({'plain':!![]});var _0x4bfa79='ChatWebsites';return db['UserProfileResource']['destroy']({'where':{'type':_0x4bfa79,'resourceId':_0x3d01af['id']}})[_0x0b49('0x17')](function(){return _0x4060a9;});})['then'](function(){_0x52e696['status'](0xcc)[_0x0b49('0x29')]();});}};}function handleEntityNotFound(_0x39c3b4){return function(_0x1e2d1a){if(!_0x1e2d1a){_0x39c3b4[_0x0b49('0x21')](0x194);}return _0x1e2d1a;};}function handleError(_0x591096,_0xbfdc88){_0xbfdc88=_0xbfdc88||0x1f4;return function(_0x4a9587){logger[_0x0b49('0x1c')](_0x4a9587[_0x0b49('0x2a')]);if(_0x4a9587[_0x0b49('0x2b')]){delete _0x4a9587[_0x0b49('0x2b')];}_0x591096[_0x0b49('0x22')](_0xbfdc88)[_0x0b49('0x2c')](_0x4a9587);};}exports[_0x0b49('0x2d')]=function(_0x58ef46,_0x1fa3f3){var _0x47f103={'include':[{'model':db[_0x0b49('0x2e')],'as':_0x0b49('0x2f')}]},_0x1999da={},_0x4914aa={'count':0x0,'rows':[]};var _0x127d65=_[_0x0b49('0x30')](db[_0x0b49('0x31')][_0x0b49('0x32')],function(_0x9bffd3){return{'name':_0x9bffd3[_0x0b49('0x33')],'type':_0x9bffd3[_0x0b49('0x34')][_0x0b49('0x35')]};});_0x1999da[_0x0b49('0x36')]=_['map'](_0x127d65,_0x0b49('0x2b'));_0x1999da['query']=_['keys'](_0x58ef46[_0x0b49('0x37')]);_0x1999da[_0x0b49('0x38')]=_[_0x0b49('0x39')](_0x1999da[_0x0b49('0x36')],_0x1999da[_0x0b49('0x37')]);_0x47f103[_0x0b49('0x3a')]=_['intersection'](_0x1999da[_0x0b49('0x36')],qs[_0x0b49('0x3b')](_0x58ef46['query'][_0x0b49('0x3b')]));_0x47f103[_0x0b49('0x3a')]=_0x47f103[_0x0b49('0x3a')]['length']?_0x47f103[_0x0b49('0x3a')]:_0x1999da[_0x0b49('0x36')];if(!_0x58ef46['query'][_0x0b49('0x3c')]('nolimit')){_0x47f103[_0x0b49('0x25')]=qs['limit'](_0x58ef46[_0x0b49('0x37')]['limit']);_0x47f103['offset']=qs[_0x0b49('0x23')](_0x58ef46[_0x0b49('0x37')][_0x0b49('0x23')]);}_0x47f103[_0x0b49('0x3d')]=qs['sort'](_0x58ef46[_0x0b49('0x37')][_0x0b49('0x3e')]);_0x47f103[_0x0b49('0x3f')]=qs[_0x0b49('0x38')](_[_0x0b49('0x40')](_0x58ef46['query'],_0x1999da[_0x0b49('0x38')]),_0x127d65);if(_0x58ef46['query']['filter']){_0x47f103[_0x0b49('0x3f')]=_['merge'](_0x47f103[_0x0b49('0x3f')],{'$or':_[_0x0b49('0x30')](_0x127d65,function(_0xd2d9b2){if(_0xd2d9b2[_0x0b49('0x34')]!==_0x0b49('0x41')){var _0x33da0c={};_0x33da0c[_0xd2d9b2[_0x0b49('0x2b')]]={'$like':'%'+_0x58ef46[_0x0b49('0x37')]['filter']+'%'};return _0x33da0c;}})});}_0x47f103=_[_0x0b49('0x42')]({},_0x47f103,_0x58ef46[_0x0b49('0x43')]);var _0x26407b={'where':_0x47f103[_0x0b49('0x3f')]};return db['ChatWebsite'][_0x0b49('0x44')](_0x26407b)['then'](function(_0x46d2db){_0x4914aa[_0x0b49('0x44')]=_0x46d2db;if(_0x58ef46['query'][_0x0b49('0x45')]){_0x47f103[_0x0b49('0x46')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x47f103);})['then'](function(_0x56a485){_0x4914aa['rows']=_0x56a485;return _0x4914aa;})[_0x0b49('0x17')](respondWithFilteredResult(_0x1fa3f3,_0x47f103))[_0x0b49('0x20')](handleError(_0x1fa3f3,null));};exports[_0x0b49('0x47')]=function(_0x37212b,_0xbce6bc){var _0x37c015={'raw':![],'where':{'id':_0x37212b[_0x0b49('0x48')]['id']},'include':[{'model':db['Pause'],'as':_0x0b49('0x2f')}]},_0x86d9e8={};_0x86d9e8[_0x0b49('0x36')]=_['keys'](db['ChatWebsite']['rawAttributes']);_0x86d9e8[_0x0b49('0x37')]=_[_0x0b49('0x49')](_0x37212b[_0x0b49('0x37')]);_0x86d9e8[_0x0b49('0x38')]=_['intersection'](_0x86d9e8[_0x0b49('0x36')],_0x86d9e8[_0x0b49('0x37')]);_0x37c015[_0x0b49('0x3a')]=_[_0x0b49('0x39')](_0x86d9e8[_0x0b49('0x36')],qs[_0x0b49('0x3b')](_0x37212b[_0x0b49('0x37')]['fields']));_0x37c015[_0x0b49('0x3a')]=_0x37c015['attributes'][_0x0b49('0x4a')]?_0x37c015[_0x0b49('0x3a')]:_0x86d9e8[_0x0b49('0x36')];if(_0x37212b[_0x0b49('0x37')][_0x0b49('0x45')]){_0x37c015[_0x0b49('0x46')]=[{'all':!![]}];}_0x37c015=_[_0x0b49('0x42')]({},_0x37c015,_0x37212b[_0x0b49('0x43')]);return db[_0x0b49('0x31')]['find'](_0x37c015)[_0x0b49('0x17')](handleEntityNotFound(_0xbce6bc,null))[_0x0b49('0x17')](respondWithResult(_0xbce6bc,null))[_0x0b49('0x20')](handleError(_0xbce6bc,null));};exports[_0x0b49('0x4b')]=function(_0x2cf4ba,_0x2da6ba){return db[_0x0b49('0x31')][_0x0b49('0x4b')](_0x2cf4ba[_0x0b49('0x4c')],{})['then'](function(_0x169e08){var _0x10c0fe=_0x2cf4ba[_0x0b49('0x4d')][_0x0b49('0x4e')]({'plain':!![]});if(!_0x10c0fe)throw new Error(_0x0b49('0x4f'));if(_0x10c0fe['role']==='user'){var _0x1dc091=_0x169e08[_0x0b49('0x4e')]({'plain':!![]});var _0x5e8a62=_0x0b49('0x50');return db['UserProfileSection'][_0x0b49('0x51')]({'where':{'name':_0x5e8a62,'userProfileId':_0x10c0fe['userProfileId']},'raw':!![]})[_0x0b49('0x17')](function(_0x40fc75){if(_0x40fc75&&_0x40fc75['autoAssociation']===0x0){return db[_0x0b49('0x52')]['create']({'name':_0x1dc091['name'],'resourceId':_0x1dc091['id'],'type':_0x40fc75['name'],'sectionId':_0x40fc75['id']},{})[_0x0b49('0x17')](function(){return _0x169e08;});}else{return _0x169e08;}})[_0x0b49('0x20')](function(_0x129344){logger[_0x0b49('0x1c')](_0x0b49('0x53'),_0x129344);throw _0x129344;});}return _0x169e08;})[_0x0b49('0x17')](respondWithResult(_0x2da6ba,0xc9))[_0x0b49('0x20')](handleError(_0x2da6ba,null));};exports['update']=function(_0x4b38a3,_0xf8bede){if(_0x4b38a3[_0x0b49('0x4c')]['id']){delete _0x4b38a3[_0x0b49('0x4c')]['id'];}return db[_0x0b49('0x31')][_0x0b49('0x51')]({'where':{'id':_0x4b38a3[_0x0b49('0x48')]['id']},'include':[{'model':db[_0x0b49('0x2e')],'as':_0x0b49('0x2f')}]})[_0x0b49('0x17')](handleEntityNotFound(_0xf8bede,null))[_0x0b49('0x17')](saveUpdates(_0x4b38a3['body'],null))[_0x0b49('0x17')](respondWithResult(_0xf8bede,null))[_0x0b49('0x20')](handleError(_0xf8bede,null));};exports[_0x0b49('0x54')]=function(_0x222ed9,_0x11161d){return db['ChatWebsite']['find']({'where':{'id':_0x222ed9[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x11161d,null))[_0x0b49('0x17')](removeEntity(_0x11161d,null))[_0x0b49('0x20')](handleError(_0x11161d,null));};exports[_0x0b49('0x55')]=function(_0x270567,_0x5004c5){return db['ChatWebsite']['describe']()['then'](respondWithResult(_0x5004c5,null))[_0x0b49('0x20')](handleError(_0x5004c5,null));};exports[_0x0b49('0x56')]=function(_0x402e79,_0x11d048){if(_0x402e79[_0x0b49('0x4c')]['id']){delete _0x402e79[_0x0b49('0x4c')]['id'];}return db[_0x0b49('0x31')][_0x0b49('0x51')]({'where':{'id':_0x402e79['params']['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x11d048,null))[_0x0b49('0x17')](function(_0x3cfb6b){if(_0x3cfb6b){_0x402e79[_0x0b49('0x4c')][_0x0b49('0x57')]=_0x3cfb6b['id'];return db[_0x0b49('0x58')]['create'](_0x402e79['body']);}})[_0x0b49('0x17')](respondWithResult(_0x11d048,null))['catch'](handleError(_0x11d048,null));};exports[_0x0b49('0x59')]=function(_0x49f4a8,_0x573d0b){var _0x2b033c={'raw':![],'where':{}};var _0x55f494={};var _0x58d53f={'count':0x0,'rows':[]};return db[_0x0b49('0x31')][_0x0b49('0x5a')]({'where':{'id':_0x49f4a8[_0x0b49('0x48')]['id']}})['then'](handleEntityNotFound(_0x573d0b,null))[_0x0b49('0x17')](function(_0x37ef8f){if(_0x37ef8f){_0x55f494['model']=_[_0x0b49('0x49')](db[_0x0b49('0x58')][_0x0b49('0x32')]);_0x55f494['query']=_[_0x0b49('0x49')](_0x49f4a8['query']);_0x55f494['filters']=_[_0x0b49('0x39')](_0x55f494['model'],_0x55f494[_0x0b49('0x37')]);_0x2b033c[_0x0b49('0x3a')]=_[_0x0b49('0x39')](_0x55f494[_0x0b49('0x36')],qs[_0x0b49('0x3b')](_0x49f4a8[_0x0b49('0x37')]['fields']));_0x2b033c[_0x0b49('0x3a')]=_0x2b033c[_0x0b49('0x3a')][_0x0b49('0x4a')]?_0x2b033c[_0x0b49('0x3a')]:_0x55f494[_0x0b49('0x36')];if(!_0x49f4a8[_0x0b49('0x37')][_0x0b49('0x3c')](_0x0b49('0x5b'))){_0x2b033c[_0x0b49('0x25')]=qs['limit'](_0x49f4a8['query'][_0x0b49('0x25')]);_0x2b033c['offset']=qs[_0x0b49('0x23')](_0x49f4a8['query'][_0x0b49('0x23')]);}_0x2b033c[_0x0b49('0x3d')]=qs[_0x0b49('0x3e')](_0x49f4a8[_0x0b49('0x37')][_0x0b49('0x3e')]);_0x2b033c['where']=qs[_0x0b49('0x38')](_[_0x0b49('0x40')](_0x49f4a8[_0x0b49('0x37')],_0x55f494['filters']));_0x2b033c[_0x0b49('0x3f')][_0x0b49('0x57')]=_0x37ef8f['id'];if(_0x49f4a8[_0x0b49('0x37')][_0x0b49('0x5c')]){_0x2b033c[_0x0b49('0x3f')]=_['merge'](_0x2b033c[_0x0b49('0x3f')],{'$or':_['map'](_0x2b033c['attributes'],function(_0x4e3f7c){var _0x15a885={};_0x15a885[_0x4e3f7c]={'$like':'%'+_0x49f4a8[_0x0b49('0x37')]['filter']+'%'};return _0x15a885;})});}_0x2b033c=_['merge']({},_0x2b033c,_0x49f4a8[_0x0b49('0x43')]);return db['Disposition'][_0x0b49('0x44')]({'where':_0x2b033c[_0x0b49('0x3f')]})[_0x0b49('0x17')](function(_0x9a2991){_0x58d53f['count']=_0x9a2991;if(_0x49f4a8['query'][_0x0b49('0x45')]){_0x2b033c['include']=[{'all':!![]}];}return db[_0x0b49('0x58')][_0x0b49('0x5d')](_0x2b033c);})[_0x0b49('0x17')](function(_0x56a2bc){_0x58d53f['rows']=_0x56a2bc;return _0x58d53f;});}})[_0x0b49('0x17')](respondWithFilteredResult(_0x573d0b,_0x2b033c))[_0x0b49('0x20')](handleError(_0x573d0b,null));};exports[_0x0b49('0x5e')]=function(_0x57ef35,_0xb597f8){return db[_0x0b49('0x31')][_0x0b49('0x51')]({'where':{'id':_0x57ef35[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0xb597f8,null))[_0x0b49('0x17')](function(_0x439c37){if(_0x439c37){return _0x439c37[_0x0b49('0x5e')](_0x57ef35[_0x0b49('0x37')]['ids']);}})[_0x0b49('0x17')](respondWithStatusCode(_0xb597f8,null))['catch'](handleError(_0xb597f8,null));};exports['addAnswer']=function(_0x4cd537,_0x498c3d){if(_0x4cd537['body']['id']){delete _0x4cd537[_0x0b49('0x4c')]['id'];}return db[_0x0b49('0x31')][_0x0b49('0x51')]({'where':{'id':_0x4cd537[_0x0b49('0x48')]['id']}})['then'](handleEntityNotFound(_0x498c3d,null))[_0x0b49('0x17')](function(_0x44b4dc){if(_0x44b4dc){_0x4cd537[_0x0b49('0x4c')][_0x0b49('0x57')]=_0x44b4dc['id'];return db[_0x0b49('0x5f')][_0x0b49('0x4b')](_0x4cd537[_0x0b49('0x4c')]);}})['then'](respondWithResult(_0x498c3d,null))[_0x0b49('0x20')](handleError(_0x498c3d,null));};exports[_0x0b49('0x60')]=function(_0x11e0e6,_0x3cbe7d){var _0x5e2c0c={'raw':![],'where':{}};var _0x3e0b02={};var _0x276292={'count':0x0,'rows':[]};return db[_0x0b49('0x31')][_0x0b49('0x5a')]({'where':{'id':_0x11e0e6['params']['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x3cbe7d,null))[_0x0b49('0x17')](function(_0x3d199d){if(_0x3d199d){_0x3e0b02[_0x0b49('0x36')]=_[_0x0b49('0x49')](db[_0x0b49('0x5f')][_0x0b49('0x32')]);_0x3e0b02['query']=_[_0x0b49('0x49')](_0x11e0e6['query']);_0x3e0b02[_0x0b49('0x38')]=_[_0x0b49('0x39')](_0x3e0b02[_0x0b49('0x36')],_0x3e0b02[_0x0b49('0x37')]);_0x5e2c0c[_0x0b49('0x3a')]=_[_0x0b49('0x39')](_0x3e0b02['model'],qs[_0x0b49('0x3b')](_0x11e0e6[_0x0b49('0x37')][_0x0b49('0x3b')]));_0x5e2c0c[_0x0b49('0x3a')]=_0x5e2c0c[_0x0b49('0x3a')][_0x0b49('0x4a')]?_0x5e2c0c['attributes']:_0x3e0b02[_0x0b49('0x36')];if(!_0x11e0e6[_0x0b49('0x37')][_0x0b49('0x3c')](_0x0b49('0x5b'))){_0x5e2c0c[_0x0b49('0x25')]=qs[_0x0b49('0x25')](_0x11e0e6[_0x0b49('0x37')][_0x0b49('0x25')]);_0x5e2c0c[_0x0b49('0x23')]=qs['offset'](_0x11e0e6['query'][_0x0b49('0x23')]);}_0x5e2c0c[_0x0b49('0x3d')]=qs[_0x0b49('0x3e')](_0x11e0e6[_0x0b49('0x37')]['sort']);_0x5e2c0c[_0x0b49('0x3f')]=qs[_0x0b49('0x38')](_[_0x0b49('0x40')](_0x11e0e6[_0x0b49('0x37')],_0x3e0b02[_0x0b49('0x38')]));_0x5e2c0c[_0x0b49('0x3f')][_0x0b49('0x57')]=_0x3d199d['id'];if(_0x11e0e6[_0x0b49('0x37')][_0x0b49('0x5c')]){_0x5e2c0c[_0x0b49('0x3f')]=_[_0x0b49('0x42')](_0x5e2c0c[_0x0b49('0x3f')],{'$or':_['map'](_0x5e2c0c[_0x0b49('0x3a')],function(_0x50114d){var _0x55e1b9={};_0x55e1b9[_0x50114d]={'$like':'%'+_0x11e0e6[_0x0b49('0x37')]['filter']+'%'};return _0x55e1b9;})});}_0x5e2c0c=_[_0x0b49('0x42')]({},_0x5e2c0c,_0x11e0e6[_0x0b49('0x43')]);return db[_0x0b49('0x5f')][_0x0b49('0x44')]({'where':_0x5e2c0c[_0x0b49('0x3f')]})[_0x0b49('0x17')](function(_0x28abcb){_0x276292[_0x0b49('0x44')]=_0x28abcb;if(_0x11e0e6[_0x0b49('0x37')][_0x0b49('0x45')]){_0x5e2c0c['include']=[{'all':!![]}];}return db[_0x0b49('0x5f')][_0x0b49('0x5d')](_0x5e2c0c);})['then'](function(_0x428316){_0x276292[_0x0b49('0x61')]=_0x428316;return _0x276292;});}})[_0x0b49('0x17')](respondWithFilteredResult(_0x3cbe7d,_0x5e2c0c))[_0x0b49('0x20')](handleError(_0x3cbe7d,null));};exports[_0x0b49('0x62')]=function(_0x1fb625,_0x382fe4){return db[_0x0b49('0x31')]['find']({'where':{'id':_0x1fb625[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x382fe4,null))[_0x0b49('0x17')](function(_0x3b101e){if(_0x3b101e){return _0x3b101e['removeAnswers'](_0x1fb625[_0x0b49('0x37')][_0x0b49('0x63')]);}})[_0x0b49('0x17')](respondWithStatusCode(_0x382fe4,null))['catch'](handleError(_0x382fe4,null));};exports[_0x0b49('0x64')]=function(_0x34abda,_0xf9730a){_0x34abda[_0x0b49('0x4c')][_0x0b49('0x65')]=_0x34abda['file'][_0x0b49('0x66')];return db[_0x0b49('0x31')][_0x0b49('0x51')]({'where':{'id':_0x34abda['params']['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0xf9730a,null))[_0x0b49('0x17')](saveUpdates(_0x34abda['body'],null))[_0x0b49('0x17')](respondWithResult(_0xf9730a,null))[_0x0b49('0x20')](handleError(_0xf9730a,null));};exports['addAvatar']=function(_0x24bf29,_0x5a0ab7){_0x24bf29[_0x0b49('0x4c')]['agentAvatar']=_0x24bf29['file']['filename'];return db[_0x0b49('0x31')]['find']({'where':{'id':_0x24bf29['params']['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x5a0ab7,null))[_0x0b49('0x17')](saveUpdates(_0x24bf29[_0x0b49('0x4c')],null))[_0x0b49('0x17')](respondWithResult(_0x5a0ab7,null))['catch'](handleError(_0x5a0ab7,null));};exports[_0x0b49('0x67')]=function(_0x26f0a8,_0x5ba80a){_0x26f0a8['body'][_0x0b49('0x68')]=_0x26f0a8[_0x0b49('0x69')][_0x0b49('0x66')];return db[_0x0b49('0x31')][_0x0b49('0x51')]({'where':{'id':_0x26f0a8[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x5ba80a,null))[_0x0b49('0x17')](saveUpdates(_0x26f0a8['body'],null))[_0x0b49('0x17')](respondWithResult(_0x5ba80a,null))[_0x0b49('0x20')](handleError(_0x5ba80a,null));};exports[_0x0b49('0x6a')]=function(_0x35542c,_0x446319){_0x35542c[_0x0b49('0x4c')][_0x0b49('0x6b')]=_0x35542c[_0x0b49('0x69')]['filename'];return db['ChatWebsite'][_0x0b49('0x51')]({'where':{'id':_0x35542c['params']['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x446319,null))[_0x0b49('0x17')](saveUpdates(_0x35542c['body'],null))[_0x0b49('0x17')](respondWithResult(_0x446319,null))['catch'](handleError(_0x446319,null));};exports[_0x0b49('0x6c')]=function(_0x17685f,_0x5682ac){var _0x203283=path[_0x0b49('0x6d')](config['root'],_0x0b49('0x6e'));var _0x27d9c3={'where':{'id':_0x17685f[_0x0b49('0x48')]['id']},'attributes':['id',_0x0b49('0x65')],'raw':!![]};var _0x571288=![];return require(_0x0b49('0x6f'))[_0x0b49('0x70')]()[_0x0b49('0x17')](function(_0x1a35c8){if(_0x1a35c8){_0x571288=_0x1a35c8[_0x0b49('0x71')];}})[_0x0b49('0x17')](function(){return db[_0x0b49('0x31')]['find'](_0x27d9c3);})['then'](handleEntityNotFound(_0x5682ac,null))[_0x0b49('0x17')](function(_0x5a7874){if(_0x5a7874){if(!_['isNil'](_0x5a7874[_0x0b49('0x65')])){if(fs[_0x0b49('0x72')](path[_0x0b49('0x6d')](config[_0x0b49('0x73')],'server/files/images/logos/',_0x5a7874[_0x0b49('0x65')]))&&_0x571288){_0x203283=path['join'](config[_0x0b49('0x73')],_0x0b49('0x74'),_0x5a7874[_0x0b49('0x65')]);}}return _0x5682ac[_0x0b49('0x75')](_0x203283);}})['catch'](handleError(_0x5682ac,null));};exports[_0x0b49('0x76')]=function(_0x2b6583,_0x101f14){var _0x850288=path['join'](config[_0x0b49('0x73')],_0x0b49('0x77'));var _0xb9d69f={'where':{'id':_0x2b6583[_0x0b49('0x48')]['id']},'attributes':['id',_0x0b49('0x78')],'raw':!![]};return db[_0x0b49('0x31')][_0x0b49('0x51')](_0xb9d69f)[_0x0b49('0x17')](handleEntityNotFound(_0x101f14,null))[_0x0b49('0x17')](function(_0x37263f){if(_0x37263f){if(!_[_0x0b49('0x79')](_0x37263f[_0x0b49('0x78')])){if(fs[_0x0b49('0x72')](path[_0x0b49('0x6d')](config[_0x0b49('0x73')],_0x0b49('0x7a'),_0x37263f[_0x0b49('0x78')]))){_0x850288=path['join'](config[_0x0b49('0x73')],_0x0b49('0x7a'),_0x37263f[_0x0b49('0x78')]);}}return _0x101f14[_0x0b49('0x75')](_0x850288);}})[_0x0b49('0x20')](handleError(_0x101f14,null));};exports[_0x0b49('0x7b')]=function(_0x269fe6,_0x44786e){var _0x28b870=path[_0x0b49('0x6d')](config['root'],_0x0b49('0x7c'));var _0x200c26={'where':{'id':_0x269fe6[_0x0b49('0x48')]['id']},'attributes':['id',_0x0b49('0x68'),'showCustomerAvatar'],'raw':!![]};return db[_0x0b49('0x31')]['find'](_0x200c26)[_0x0b49('0x17')](handleEntityNotFound(_0x44786e,null))['then'](function(_0x33f0b1){if(_0x33f0b1){if(!_[_0x0b49('0x79')](_0x33f0b1[_0x0b49('0x68')])){if(fs[_0x0b49('0x72')](path['join'](config[_0x0b49('0x73')],_0x0b49('0x7a'),_0x33f0b1['customerAvatar']))&&_0x33f0b1[_0x0b49('0x7d')]){_0x28b870=path[_0x0b49('0x6d')](config[_0x0b49('0x73')],_0x0b49('0x7a'),_0x33f0b1[_0x0b49('0x68')]);}}return _0x44786e[_0x0b49('0x75')](_0x28b870);}})[_0x0b49('0x20')](handleError(_0x44786e,null));};exports[_0x0b49('0x7e')]=function(_0x39258c,_0x554308){var _0x5c8557=path[_0x0b49('0x6d')](config['root'],_0x0b49('0x7f'));var _0x1ddcac={'where':{'id':_0x39258c[_0x0b49('0x48')]['id']},'attributes':['id',_0x0b49('0x6b')],'raw':!![]};return db[_0x0b49('0x31')]['find'](_0x1ddcac)[_0x0b49('0x17')](handleEntityNotFound(_0x554308,null))['then'](function(_0x3df20f){if(_0x3df20f){if(!_[_0x0b49('0x79')](_0x3df20f[_0x0b49('0x6b')])){if(fs[_0x0b49('0x72')](path[_0x0b49('0x6d')](config[_0x0b49('0x73')],_0x0b49('0x7a'),_0x3df20f[_0x0b49('0x6b')]))){_0x5c8557=path[_0x0b49('0x6d')](config[_0x0b49('0x73')],_0x0b49('0x7a'),_0x3df20f[_0x0b49('0x6b')]);}}return _0x554308[_0x0b49('0x75')](_0x5c8557);}})[_0x0b49('0x20')](handleError(_0x554308,null));};exports[_0x0b49('0x80')]=function(_0x40f6eb,_0x146b96){var _0x429989=require(_0x0b49('0x81'));var _0x30284a=new _0x429989();var _0x32249d=_0x30284a[_0x0b49('0x82')](_0x40f6eb['headers']['user-agent'])[_0x0b49('0x83')]();var _0x5cf27e={'body':_0x40f6eb['body'],'channel':_0x0b49('0x84')};var _0x134e82=[];var _0x398429=[];var _0x976c81={};var _0x471a7f=![];return db[_0x0b49('0x85')]['describe']()[_0x0b49('0x17')](function(_0x363893){if(!_0x363893){throw new db[(_0x0b49('0x86'))]['ValidationError']('no\x20available\x20attributes');}_0x134e82=_[_0x0b49('0x87')](_['keys'](_0x363893),[_0x0b49('0x88'),'updatedAt']);_0x398429=_['difference'](_['keys'](_0x363893),['createdAt',_0x0b49('0x89'),'CompanyId',_0x0b49('0x8a')]);if(_0x40f6eb['body']['id']){delete _0x40f6eb['body']['id'];}if(_['isNil'](_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0x8b')])){throw new db[(_0x0b49('0x86'))][(_0x0b49('0x8c'))](_0x0b49('0x8d'));}if(_[_0x0b49('0x79')](_0x40f6eb[_0x0b49('0x4c')]['body'])||_0x40f6eb['body'][_0x0b49('0x4c')]===''){throw new db['Sequelize'][(_0x0b49('0x8c'))](_0x0b49('0x8e'));}if(_[_0x0b49('0x79')](_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0x8f')])){throw new db[(_0x0b49('0x86'))]['ValidationError'](_0x0b49('0x90')+_0x398429);}if(!_[_0x0b49('0x91')](_0x398429,_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0x8f')])){throw new db[(_0x0b49('0x86'))][(_0x0b49('0x8c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x398429);}_0x976c81[_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0x8f')]]=_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0x8b')];})[_0x0b49('0x17')](function(){return db[_0x0b49('0x31')][_0x0b49('0x51')]({'where':{'id':_0x40f6eb['params']['id']},'include':[{'model':db[_0x0b49('0x92')],'as':_0x0b49('0x93'),'include':[{'model':db[_0x0b49('0x85')],'as':_0x0b49('0x94'),'where':_0x976c81,'limit':0x1,'order':[[_0x0b49('0x89'),'DESC']]}]},{'model':db[_0x0b49('0x95')],'as':_0x0b49('0x96')}]});})['then'](handleEntityNotFound(_0x146b96,null))[_0x0b49('0x17')](function(_0x4a064c){if(_0x4a064c&&_0x4a064c[_0x0b49('0x93')]){_0x5cf27e[_0x0b49('0x97')]=_0x4a064c;_0x5cf27e[_0x0b49('0x98')]=_0x4a064c['Applications'];_0x5cf27e['list']=_0x4a064c[_0x0b49('0x93')];_0x5cf27e[_0x0b49('0x98')]=_['orderBy'](_0x5cf27e[_0x0b49('0x98')],[_0x0b49('0x99')],[_0x0b49('0x9a')]);if(_0x5cf27e[_0x0b49('0x97')][_0x0b49('0x96')]){delete _0x5cf27e[_0x0b49('0x97')][_0x0b49('0x96')];}if(_0x5cf27e[_0x0b49('0x97')]['List']&&_0x5cf27e[_0x0b49('0x97')][_0x0b49('0x93')][_0x0b49('0x94')][_0x0b49('0x4a')]){return _0x5cf27e[_0x0b49('0x97')]['List'][_0x0b49('0x94')][0x0];}var _0x175208=_[_0x0b49('0x10')](_0x40f6eb[_0x0b49('0x4c')],{'firstName':_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0x8b')],'ListId':_0x4a064c['ListId']});_0x175208[_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0x8f')]]=_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0x8b')];return db[_0x0b49('0x85')]['create'](_0x175208,{'fields':_0x134e82,'raw':!![]});}})[_0x0b49('0x17')](handleEntityNotFound(_0x146b96,null))['then'](function(_0x4ad0e8){_0x5cf27e[_0x0b49('0x9b')]=_0x4ad0e8;var _0x4a3eda=_0x40f6eb[_0x0b49('0x4c')]['customerIp'];if(_0x40f6eb['headers']['cf-connecting-ip']){_0x4a3eda=_0x40f6eb['headers'][_0x0b49('0x9c')];}else if(_0x40f6eb[_0x0b49('0x9d')][_0x0b49('0x9e')]){_0x4a3eda=_[_0x0b49('0x9f')](_0x40f6eb['headers'][_0x0b49('0x9e')]['split'](','));}if(_0x4ad0e8){var _0x336e2b={'ContactId':_0x4ad0e8['id'],'ChatWebsiteId':_0x40f6eb[_0x0b49('0x48')]['id'],'from':(_0x4ad0e8[_0x0b49('0xa0')]||'')+'\x20'+(_0x4ad0e8['lastName']||''),'customerIp':_0x4a3eda,'customerPort':_0x40f6eb[_0x0b49('0x9d')][_0x0b49('0xa1')]?_0x40f6eb[_0x0b49('0x9d')]['x-real-port']:null,'referer':_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0xa2')],'browserName':_0x32249d['browser'][_0x0b49('0x2b')]&&_0x32249d[_0x0b49('0xa3')][_0x0b49('0xa4')]?util[_0x0b49('0xa5')](_0x0b49('0xa6'),_0x32249d[_0x0b49('0xa3')][_0x0b49('0x2b')],_0x32249d[_0x0b49('0xa3')][_0x0b49('0xa4')]):_0x0b49('0xa7'),'browserVersion':_0x32249d[_0x0b49('0xa3')][_0x0b49('0xa4')]||_0x0b49('0xa7'),'osName':util[_0x0b49('0xa5')]('%s\x20%s',_0x32249d['os']['name'],_0x32249d['os'][_0x0b49('0xa4')]),'osVersion':_0x32249d['os'][_0x0b49('0xa4')],'deviceModel':_0x32249d[_0x0b49('0xa8')]['model']&&_0x32249d[_0x0b49('0xa8')]['vendor']?util[_0x0b49('0xa5')](_0x0b49('0xa9'),_0x32249d[_0x0b49('0xa8')][_0x0b49('0x36')],_0x32249d['device'][_0x0b49('0xaa')],_0x32249d[_0x0b49('0xa8')]['type']):null,'deviceVendor':_0x32249d['device']['vendor'],'deviceType':_0x32249d[_0x0b49('0xa8')][_0x0b49('0x34')],'formData':JSON[_0x0b49('0xab')](_0x40f6eb[_0x0b49('0x4c')])};var _0x2574c3={'ChatWebsiteId':_0x40f6eb['params']['id'],'closed':![]};if(_0x40f6eb['body'][_0x0b49('0xac')]){_0x2574c3['threadId']=_0x40f6eb[_0x0b49('0x4c')]['threadId'];return db[_0x0b49('0xad')][_0x0b49('0x51')]({'where':_0x2574c3})['then'](function(_0x27a9bd){if(_0x27a9bd){return[_0x27a9bd,![]];}_0x336e2b[_0x0b49('0xac')]=_0x40f6eb[_0x0b49('0x4c')]['threadId'];_0x336e2b[_0x0b49('0xae')]=_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0xae')];return db[_0x0b49('0xad')][_0x0b49('0x4b')](_0x336e2b)[_0x0b49('0x17')](function(_0x48f08f){return[_0x48f08f,!![]];});});}_0x2574c3[_0x0b49('0xaf')]=_0x4ad0e8['id'];if(_0x40f6eb[_0x0b49('0x4c')]['interaction']&&_0x40f6eb['body'][_0x0b49('0xb0')]['id']){_0x2574c3['id']=_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0xb0')]['id'];return db[_0x0b49('0xad')][_0x0b49('0x51')]({'where':_0x2574c3})[_0x0b49('0x17')](function(_0x3d2235){if(_0x3d2235){return[_0x3d2235,![]];}return db[_0x0b49('0xad')][_0x0b49('0x4b')](_0x336e2b)[_0x0b49('0x17')](function(_0x40f0c3){return[_0x40f0c3,!![]];});});}return db[_0x0b49('0xad')]['create'](_0x336e2b)[_0x0b49('0x17')](function(_0x105f10){return[_0x105f10,!![]];});}})[_0x0b49('0xb1')](function(_0x4f7faf,_0x187e68){if(_0x4f7faf){_0x471a7f=_0x187e68;if(!_0x187e68){var _0x53da61={'from':(_0x5cf27e[_0x0b49('0x9b')][_0x0b49('0xa0')]||'')+'\x20'+(_0x5cf27e['contact'][_0x0b49('0xb2')]||'')};if(_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0xac')]&&_0x40f6eb[_0x0b49('0x4c')]['messageId']&&_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0xac')]!=_0x40f6eb['body']['messageId']){_0x53da61['threadId']=_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0xb3')];}return _0x4f7faf[_0x0b49('0x28')](_0x53da61);}else{return _0x4f7faf;}}})['then'](function(_0x360c1f){_0x5cf27e['interaction']=_0x360c1f[_0x0b49('0x4e')]({'plain':!![]});_0x5cf27e[_0x0b49('0xb0')]['created']=_0x471a7f;if(_0x5cf27e[_0x0b49('0xb0')][_0x0b49('0xb4')]){if(_0x5cf27e[_0x0b49('0x97')][_0x0b49('0xb5')]){_0x5cf27e[_0x0b49('0x98')][_0x0b49('0xb6')]({'id':0x0,'priority':_0x5cf27e[_0x0b49('0x98')][_0x0b49('0x4a')]+0x1,'app':_0x0b49('0xb7'),'appdata':_0x0b49('0xb8'),'interval':_0x0b49('0xb9')});}}return db[_0x0b49('0xba')][_0x0b49('0x4b')]({'body':_0x40f6eb[_0x0b49('0x4c')][_0x0b49('0x4c')],'ChatWebsiteId':_0x40f6eb[_0x0b49('0x48')]['id'],'ChatInteractionId':_0x360c1f['id'],'direction':'in','ContactId':_0x5cf27e[_0x0b49('0x9b')]['id'],'AttachmentId':_0x40f6eb['body'][_0x0b49('0xbb')]});})[_0x0b49('0x17')](function(_0x3ff8e4){_0x5cf27e['message']=_0x3ff8e4;if(_0x5cf27e[_0x0b49('0xb0')][_0x0b49('0xbc')]){return db[_0x0b49('0xbd')][_0x0b49('0x51')]({'attributes':['id',_0x0b49('0x2b')],'where':{'id':_0x5cf27e[_0x0b49('0xb0')]['UserId']}})[_0x0b49('0x17')](function(_0x1e4670){if(_0x1e4670){_0x5cf27e[_0x0b49('0x98')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0b49('0xbe'),'appdata':_0x1e4670['name']+','+(_0x5cf27e['account'][_0x0b49('0xbf')]||0xa),'interval':_0x0b49('0xb9')});_0x5cf27e[_0x0b49('0xc0')]=!![];}return respondWithRpcPromise(_0x0b49('0xc1'),_0x0b49('0xc2'),_0x5cf27e);});}return respondWithRpcPromise(_0x0b49('0xc1'),_0x0b49('0xc2'),_0x5cf27e);})['then'](function(_0x14a139){respondWithRpcPromise('EventManager','EventManager',{'event':_0x0b49('0x80'),'message':_0x14a139},client9002);return _0x14a139;})[_0x0b49('0x17')](respondWithResult(_0x146b96,null))[_0x0b49('0x20')](handleError(_0x146b96,null));};exports[_0x0b49('0xc3')]=function(_0x31c47b,_0x3262e1){var _0x38cd77,_0x598974,_0xeb47de;var _0x16c3d4=[];var _0x14a17e={};var _0xe59207=_0x31c47b['files']||[];var _0x2fd488=[];var _0xf299b3;return db['CmContact']['describe']()[_0x0b49('0x17')](function(_0x4c4e61){if(!_0x4c4e61){throw new db[(_0x0b49('0x86'))][(_0x0b49('0x8c'))](_0x0b49('0xc4'));}_0x16c3d4=_[_0x0b49('0x87')](_[_0x0b49('0x49')](_0x4c4e61),[_0x0b49('0x88'),'updatedAt',_0x0b49('0xc5'),_0x0b49('0x8a')]);if(_0x31c47b[_0x0b49('0x4c')]['id']){delete _0x31c47b['body']['id'];}if(_['isNil'](_0x31c47b[_0x0b49('0x4c')][_0x0b49('0x8b')])){throw _0x3262e1['status'](0x1f4)[_0x0b49('0x2c')](new db[(_0x0b49('0x86'))]['ValidationError'](_0x0b49('0x8d')));}if(_['isNil'](_0x31c47b['body']['body'])||_0x31c47b[_0x0b49('0x4c')][_0x0b49('0x4c')]===''){throw _0x3262e1[_0x0b49('0x22')](0x1f4)['send'](new db[(_0x0b49('0x86'))][(_0x0b49('0x8c'))](_0x0b49('0x8e')));}if(_[_0x0b49('0x79')](_0x31c47b[_0x0b49('0x4c')][_0x0b49('0xc6')])){throw _0x3262e1[_0x0b49('0x22')](0x1f4)[_0x0b49('0x2c')](new db[(_0x0b49('0x86'))][(_0x0b49('0x8c'))](_0x0b49('0xc7')+_0x16c3d4));}if(!_[_0x0b49('0x91')](_0x16c3d4,_0x31c47b['body'][_0x0b49('0xc6')])){throw _0x3262e1[_0x0b49('0x22')](0x1f4)[_0x0b49('0x2c')](new db[(_0x0b49('0x86'))][(_0x0b49('0x8c'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x16c3d4));}_0x14a17e[_0x31c47b[_0x0b49('0x4c')][_0x0b49('0xc6')]]=_0x31c47b[_0x0b49('0x4c')][_0x0b49('0x8b')];})[_0x0b49('0x17')](function(){return db[_0x0b49('0x31')]['find']({'where':{'id':_0x31c47b['params']['id']},'include':[{'model':db[_0x0b49('0x92')],'as':'List'},{'model':db[_0x0b49('0xc8')],'as':_0x0b49('0xc8')}]});})[_0x0b49('0x17')](handleEntityNotFound(_0x3262e1,null))[_0x0b49('0x17')](function(_0x15f94f){if(_0x15f94f&&_0x15f94f['List']){_0x598974=_0x15f94f;var _0x4d385a=_[_0x0b49('0x10')](_0x31c47b[_0x0b49('0x4c')],{'firstName':_0x31c47b[_0x0b49('0x4c')][_0x0b49('0x8b')],'phone':_0x31c47b['body'][_0x0b49('0x8b')],'ListId':_0x15f94f[_0x0b49('0x8a')]});_0x4d385a[_0x31c47b[_0x0b49('0x4c')][_0x0b49('0xc6')]]=_0x31c47b['body'][_0x0b49('0x8b')];return db[_0x0b49('0x85')][_0x0b49('0xc9')]({'where':_0x14a17e,'defaults':_0x4d385a});}})[_0x0b49('0xb1')](function(_0x24d1b6){if(_0x24d1b6){_0xeb47de=_0x24d1b6;var _0x452106=fs['readFileSync'](path['join'](config[_0x0b49('0x73')],_0x0b49('0xca')),_0x0b49('0xcb'));var _0x38698d=ejs[_0x0b49('0xcc')](_0x452106,{'body':_['toPairs'](_0x31c47b[_0x0b49('0x4c')][_0x0b49('0x4c')]),'bodyTitle':_0x598974[_0x0b49('0xcd')]});return db['ChatOfflineMessage'][_0x0b49('0x4b')]({'body':_0x38698d,'plainBody':htmlToText[_0x0b49('0xce')](_0x38698d),'ContactId':_0x24d1b6['id'],'ChatWebsiteId':_0x598974['id']});}})[_0x0b49('0x17')](function(_0x1b8297){_0xf299b3=_0x1b8297;if(_0xe59207[_0x0b49('0x4a')]){var _0x4c9393=_0xe59207[_0x0b49('0x30')](function(_0x37c1a0){return{'name':_0x37c1a0[_0x0b49('0xcf')],'basename':_0x37c1a0[_0x0b49('0x66')],'type':_0x37c1a0[_0x0b49('0xd0')],'ChatOfflineMessageId':_0x1b8297['id']};});_0x2fd488=_0x4c9393['map'](_0x557752=>{var _0x4d247f={'filename':_0x557752[_0x0b49('0x2b')],'path':path[_0x0b49('0x6d')](config[_0x0b49('0x73')],_0x0b49('0xd1'),_0x0b49('0xd2'),_0x0b49('0xd3'),_0x0b49('0xd4'),_0x557752['basename'])};return _0x4d247f;});if(!_0x598974['openNewInteraction']){return db['sequelize'][_0x0b49('0xd5')](function(_0x26a234){return db[_0x0b49('0xd6')][_0x0b49('0xd7')](_0x4c9393,{'transaction':_0x26a234});});}}})[_0x0b49('0x17')](function(){if(_0xf299b3){_0x38cd77=_0xf299b3;return db[_0x0b49('0xc8')][_0x0b49('0x5a')]({'where':{'service':!![]},'include':[{'model':db[_0x0b49('0xd8')],'as':_0x0b49('0xd9'),'raw':!![],'include':[{'model':db[_0x0b49('0xda')],'as':_0x0b49('0xda'),'raw':!![]}]}]});}})['then'](function(_0x10917e){if(_0x10917e&&_0x10917e[_0x0b49('0xd9')]&&_0x598974[_0x0b49('0xdb')]&&_0x598974[_0x0b49('0xdc')]){var _0xb1444c=_0x10917e[_0x0b49('0xdd')]();return respondWithRpcPromise(_0x0b49('0xde'),_0x0b49('0xdf'),{'account':_0xb1444c,'message':{'from':util[_0x0b49('0xa5')](_0x0b49('0xe0'),_0x10917e['name'],_0x10917e[_0x0b49('0xe1')]||_0x10917e[_0x0b49('0xd9')][_0x0b49('0x4d')]),'to':_0x598974[_0x0b49('0xdc')],'subject':_0x598974[_0x0b49('0xe2')],'html':_0x38cd77['body'],'attachments':_0x2fd488}},client9003)['then'](function(){return _0x38cd77;})[_0x0b49('0x20')](function(_0x3e310b){logger[_0x0b49('0x1c')](_0x3e310b);});}})[_0x0b49('0x17')](function(){if(_0x598974&&_0x598974['openNewInteraction']&&_0x598974[_0x0b49('0xe3')]){var _0x37be73=[];if(_0xe59207['length']){_0x37be73=_0xe59207['map'](function(_0x428ca6){return{'name':_0x428ca6['originalname'],'basename':_0x428ca6['filename'],'type':_0x428ca6[_0x0b49('0xd0')],'ChatOfflineMessageId':_0xf299b3['id']};});}var _0x2fceec;if(!_['isNil'](_0x598974[_0x0b49('0xe4')])){var _0xb01ee5=_[_0x0b49('0x30')](_0x31c47b[_0x0b49('0x4c')],function(_0x29d846){return _0x29d846;});var _0x3bef7e=_[_0x0b49('0xe5')](_0xb01ee5)[0x0];var _0x2666d9=_['mapValues'](_0x3bef7e,function(_0x147911){return _0x147911;});_0x2fceec=_0x2666d9[0x1][_0x598974[_0x0b49('0xe4')]];}var _0x15bb17={'from':_0xeb47de[_0x0b49('0xe1')],'firstName':_0xeb47de['firstName'],'lastName':_0xeb47de[_0x0b49('0xb2')],'mapKey':_0x0b49('0xe1'),'message':{'from':_0xeb47de[_0x0b49('0xe1')],'to':_0x598974[_0x0b49('0xc8')][_0x0b49('0xe1')],'cc':'','subject':_[_0x0b49('0x79')](_0x2fceec)?_0x598974[_0x0b49('0xe2')]:_0x2fceec,'messageId':'','sentAt':new Date(),'attach':_0x37be73[_0x0b49('0x4a')],'attachments':_0x37be73,'originChannel':_0x0b49('0xe6'),'ChatWebsiteId':_0x598974['id'],'ChatOfflineMessageId':_0x38cd77['id'],'originTo':_0x598974[_0x0b49('0xc8')]['email']},'body':_0x38cd77[_0x0b49('0x4c')]};var _0xb1b32b={'account':{'id':_0x598974[_0x0b49('0xe3')]},'body':_0x15bb17,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x0b49('0xe7'),'notifyMail',_0xb1b32b,client9001)[_0x0b49('0x17')](function(){return _0x38cd77;})[_0x0b49('0x20')](function(_0x16cf68){logger[_0x0b49('0x1c')](_0x16cf68);});}return;})[_0x0b49('0x17')](function(){if(_0x38cd77){return _0x38cd77;}})[_0x0b49('0x17')](respondWithResult(_0x3262e1,null))[_0x0b49('0x20')](function(_0x467156){logger[_0x0b49('0x1c')]('catch',_0x467156);for(var _0x11bf45 of _0xe59207){var _0x50d27c=path[_0x0b49('0x6d')](config[_0x0b49('0x73')],'server','files','attachments',_0x0b49('0xd4'),_0x11bf45[_0x0b49('0x66')]);fs_extra[_0x0b49('0xe8')](_0x50d27c)[_0x0b49('0x20')](function(_0xed00fc){logger[_0x0b49('0x1c')](_0x0b49('0xe9'),_0x50d27c,_0xed00fc);});}});};exports[_0x0b49('0xea')]=function(_0x4c9d12,_0x15f7cd){return db[_0x0b49('0xad')][_0x0b49('0x51')]({'where':{'id':_0x4c9d12[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x15f7cd,null))[_0x0b49('0x17')](function(_0x28e46f){if(_0x28e46f){return _0x28e46f[_0x0b49('0xea')](_0x4c9d12[_0x0b49('0x4c')][_0x0b49('0x63')],_[_0x0b49('0xeb')](_0x4c9d12[_0x0b49('0x4c')],['ids','id'])||{});}})[_0x0b49('0x17')](respondWithResult(_0x15f7cd,null))[_0x0b49('0x20')](handleError(_0x15f7cd,null));};exports[_0x0b49('0xec')]=function(_0x1029f2,_0x37a307){var _0x44ffa4={'raw':![],'where':{}};var _0x366323={};var _0xac4fed={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0b49('0x5a')]({'where':{'id':_0x1029f2[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x37a307,null))['then'](function(_0x57b6af){if(_0x57b6af){_0x366323[_0x0b49('0x36')]=_[_0x0b49('0x49')](db[_0x0b49('0xad')][_0x0b49('0x32')]);_0x366323[_0x0b49('0x37')]=_[_0x0b49('0x49')](_0x1029f2[_0x0b49('0x37')]);_0x366323['filters']=_[_0x0b49('0x39')](_0x366323[_0x0b49('0x36')],_0x366323[_0x0b49('0x37')]);_0x44ffa4[_0x0b49('0x3a')]=_[_0x0b49('0x39')](_0x366323[_0x0b49('0x36')],qs[_0x0b49('0x3b')](_0x1029f2[_0x0b49('0x37')][_0x0b49('0x3b')]));_0x44ffa4[_0x0b49('0x3a')]=_0x44ffa4[_0x0b49('0x3a')][_0x0b49('0x4a')]?_0x44ffa4['attributes']:_0x366323[_0x0b49('0x36')];if(!_0x1029f2[_0x0b49('0x37')][_0x0b49('0x3c')]('nolimit')){_0x44ffa4[_0x0b49('0x25')]=qs[_0x0b49('0x25')](_0x1029f2['query'][_0x0b49('0x25')]);_0x44ffa4[_0x0b49('0x23')]=qs['offset'](_0x1029f2[_0x0b49('0x37')][_0x0b49('0x23')]);}_0x44ffa4[_0x0b49('0x3d')]=qs[_0x0b49('0x3e')](_0x1029f2[_0x0b49('0x37')][_0x0b49('0x3e')]);_0x44ffa4[_0x0b49('0x3f')]=qs[_0x0b49('0x38')](_[_0x0b49('0x40')](_0x1029f2['query'],_0x366323[_0x0b49('0x38')]));_0x44ffa4['where'][_0x0b49('0x57')]=_0x57b6af['id'];if(_0x1029f2[_0x0b49('0x37')][_0x0b49('0x5c')]){_0x44ffa4[_0x0b49('0x3f')]=_['merge'](_0x44ffa4[_0x0b49('0x3f')],{'$or':_[_0x0b49('0x30')](_0x44ffa4['attributes'],function(_0x38cfd){var _0x2e4383={};_0x2e4383[_0x38cfd]={'$like':'%'+_0x1029f2[_0x0b49('0x37')][_0x0b49('0x5c')]+'%'};return _0x2e4383;})});}_0x44ffa4=_['merge']({},_0x44ffa4,_0x1029f2[_0x0b49('0x43')]);return db[_0x0b49('0xad')][_0x0b49('0x44')]({'where':_0x44ffa4[_0x0b49('0x3f')]})['then'](function(_0xa0700){_0xac4fed['count']=_0xa0700;if(_0x1029f2[_0x0b49('0x37')]['includeAll']){_0x44ffa4[_0x0b49('0x46')]=[{'model':db[_0x0b49('0x85')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x0b49('0xed'),'attributes':['name',_0x0b49('0xee'),_0x0b49('0xef')],'required':![]},{'model':db['Tag'],'as':_0x0b49('0xf0'),'attributes':['id','name',_0x0b49('0xf1')],'where':_0x1029f2[_0x0b49('0x37')][_0x0b49('0xf2')]?{'id':_0x1029f2['query']['tag']}:undefined,'required':_0x1029f2[_0x0b49('0x37')][_0x0b49('0xf2')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x44ffa4);})[_0x0b49('0x17')](function(_0x214b83){_0xac4fed[_0x0b49('0x61')]=_0x214b83;return _0xac4fed;});}})['then'](respondWithFilteredResult(_0x37a307,_0x44ffa4))[_0x0b49('0x20')](handleError(_0x37a307,null));};function iftimePromise(_0x59368b,_0x44f19d){return respondWithRpcPromise('Command',_0x0b49('0xf3'),{'command':_0x44f19d[_0x0b49('0xf4')]?util[_0x0b49('0xa5')](_0x0b49('0xf5'),_0x59368b[_0x0b49('0xf6')],_0x44f19d[_0x0b49('0xf4')]):util[_0x0b49('0xa5')](_0x0b49('0xf7'),_0x59368b[_0x0b49('0xf6')])},client9002)[_0x0b49('0x17')](function(_0x16329e){var _0x4c3f3d=_0x16329e&&_0x16329e['indexOf'](_0x0b49('0xf8'))>=0x0?!![]:![];logger[_0x0b49('0xf9')](_0x0b49('0xfa'),_0x44f19d['id'],_0x59368b['id'],_0x59368b['interval'],_0x4c3f3d?_0x0b49('0xfb'):'OFFLINE',_0x44f19d[_0x0b49('0xf4')]?_0x44f19d[_0x0b49('0xf4')]:_0x0b49('0xfc'));return _0x4c3f3d;})[_0x0b49('0x20')](function(_0x9bb969){logger[_0x0b49('0x1c')](_0x0b49('0xfa'),_0x44f19d['id'],_0x59368b['id'],_0x59368b['interval'],util['inspect'](_0x9bb969,{'showHidden':![],'depth':null}),_0x44f19d[_0x0b49('0xf4')]?_0x44f19d[_0x0b49('0xf4')]:_0x0b49('0xfc'));return![];});}exports['getSnippet']=function(_0xb3a02a,_0x560820){var _0x44d9c9=0x0;var _0x141736=0x0;var _0x40b87d=![];var _0x1d02bd;var _0x1a2586;return db[_0x0b49('0x31')]['find']({'where':{'id':_0xb3a02a[_0x0b49('0x48')]['id']},'include':[{'model':db['Interval'],'as':_0x0b49('0xfd'),'include':[{'model':db['Interval'],'as':_0x0b49('0xfe'),'attributes':['id',_0x0b49('0xf6')],'raw':!![]}]}]})[_0x0b49('0x17')](handleEntityNotFound(_0x560820,null))[_0x0b49('0x17')](function(_0x58c8f2){if(_0x58c8f2){_0x1d02bd=_0x58c8f2;return _0x58c8f2[_0x0b49('0xff')]({'raw':!![]});}})[_0x0b49('0x17')](function(_0x2d0bc9){if(_0x1d02bd){if(_0x2d0bc9){_0x1a2586=_0x2d0bc9;}}return require(_0x0b49('0x6f'))[_0x0b49('0x70')]();})['then'](function(_0x233e7f){if(_0x233e7f){_0x141736=_0x233e7f[_0x0b49('0x100')];_0x40b87d=_0x233e7f[_0x0b49('0x71')];}})[_0x0b49('0x17')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x0b49('0x17')](function(_0x24ae45){_0x44d9c9=_0x24ae45;if(_0x141736&&_0x24ae45>_0x141736){return db['License'][_0x0b49('0x5a')]({'where':{'id':0x1}})[_0x0b49('0x17')](function(_0x32c703){if(_0x32c703){_0x32c703[_0x0b49('0x101')](_0x0b49('0x102'));}});}})[_0x0b49('0x17')](function(){if(_0x1d02bd['Interval']&&_0x1d02bd[_0x0b49('0xfd')][_0x0b49('0xfe')]){var _0x95d2b5=[];for(var _0x539176=0x0;_0x539176<_0x1d02bd[_0x0b49('0xfd')][_0x0b49('0xfe')]['length'];_0x539176++){var _0x381a11=_0x1d02bd['Interval'][_0x0b49('0xfe')][_0x539176]['get']({'plain':!![]});_0x95d2b5['push'](iftimePromise(_0x381a11,_0x1d02bd));}return BPromise['all'](_0x95d2b5)[_0x0b49('0x17')](function(_0x5034f5){return _['some'](_0x5034f5);});}else{return!![];}})[_0x0b49('0x17')](function(_0x336ae6){var _0x2a7393=fs[_0x0b49('0x103')](path[_0x0b49('0x6d')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x943157=new url[(_0x0b49('0x104'))](_0x1d02bd[_0x0b49('0x105')])[_0x0b49('0x106')];var _0x57d6cc=_0x0b49('0x107');var _0x248ba5=![];var _0x2a57fa={'chatVersion':_0x57d6cc,'chatWebsiteAddressOrigin':_0x943157,'remote':_0x1d02bd[_0x0b49('0x108')],'query':querystring[_0x0b49('0xab')](_['merge'](_0x1d02bd[_0x0b49('0x4e')]({'plain':!![]}),{'customerIp':_0xb3a02a[_0x0b49('0x9d')]['x-forwarded-for']||_0xb3a02a['headers'][_0x0b49('0x109')]||_0xb3a02a[_0x0b49('0x10a')][_0x0b49('0x10b')]||_0xb3a02a['ip'],'referer':_0xb3a02a[_0x0b49('0x9d')][_0x0b49('0xa2')],'openedInteractions':_0x44d9c9,'maxInteractions':_0x141736,'virtual':_0x40b87d['virtual'],'online':_0x336ae6,'custom':_0x40b87d}))['replace'](/'/g,'\x5c\x27')};_0x560820[_0x0b49('0x2c')](ejs['render'](Mustache['render'](_0x2a7393,_0x2a57fa),{'proactiveActions':_0x1a2586,'alignment':_0x1d02bd[_0x0b49('0x10c')],'verticalAlignment':_0x1d02bd[_0x0b49('0x10d')],'div_color':_0x1d02bd['color'],'labelText':_0x1d02bd[_0x0b49('0x10e')],'text_color':_0x1d02bd[_0x0b49('0x10f')],'text_button_color':_0x1d02bd['textButtonColor'],'button_color':_0x1d02bd[_0x0b49('0x110')],'background_color':_0x1d02bd[_0x0b49('0x111')],'hideWhenOffline':_0x1d02bd['hideWhenOffline'],'intervalId':_0x1d02bd[_0x0b49('0x112')],'isDevelopment':_0x248ba5,'chatVersion':_0x57d6cc}));})[_0x0b49('0x20')](handleError(_0x560820,null));};exports['addApplications']=function(_0x5ce587,_0x1ee899){var _0x26282c=_0x5ce587['params']['id'];var _0x29d7a2=_0x5ce587['body'];var _0x373a94=0xc8;var _0x4fbc8a=null;return db['sequelize'][_0x0b49('0xd5')]({'isolationLevel':db['sequelize'][_0x0b49('0x113')][_0x0b49('0x114')][_0x0b49('0x115')]},function(_0x6ca91f){return db[_0x0b49('0x31')][_0x0b49('0x5a')]({'where':{'id':_0x26282c},'transaction':_0x6ca91f})[_0x0b49('0x17')](function(_0x1fcaa8){if(_0x1fcaa8){return db[_0x0b49('0x95')]['destroy']({'where':{'ChatWebsiteId':_0x26282c},'transaction':_0x6ca91f})[_0x0b49('0x17')](function(){var _0x5334de=_[_0x0b49('0x30')](_0x29d7a2,function(_0x825f){_0x825f['ChatWebsiteId']=_0x26282c;return _0x825f;});return db[_0x0b49('0x95')]['bulkCreate'](_0x5334de,{'transaction':_0x6ca91f});});}else{_0x373a94=0x194;_0x4fbc8a=[];}});})[_0x0b49('0x17')](function(){if(_0x373a94!==0x194){return db[_0x0b49('0x95')][_0x0b49('0x116')]({'where':{'ChatWebsiteId':_0x26282c},'order':_0x0b49('0x99')})[_0x0b49('0x17')](function(_0x1bb125){_0x4fbc8a=_0x1bb125;});}})[_0x0b49('0x20')](function(_0x549762){_0x373a94=0x1f4;logger[_0x0b49('0x1c')](_0x549762[_0x0b49('0x2a')]);if(_0x549762[_0x0b49('0x2b')]){delete _0x549762[_0x0b49('0x2b')];}_0x4fbc8a=_0x549762;})['finally'](function(){if(_0x4fbc8a===null){_0x1ee899['sendStatus'](_0x373a94);}else{if(_0x373a94===0x1f4){_0x1ee899[_0x0b49('0x22')](_0x373a94)[_0x0b49('0x2c')](_0x4fbc8a);}else{_0x1ee899[_0x0b49('0x22')](_0x373a94)[_0x0b49('0x27')](_0x4fbc8a);}}});};exports[_0x0b49('0x117')]=function(_0x284390,_0x4ccc35){var _0x5620cd={};var _0x4f48c8={};var _0x726973;var _0xb835ac;return db[_0x0b49('0x31')]['findOne']({'where':{'id':_0x284390[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x4ccc35,null))[_0x0b49('0x17')](function(_0x4320a0){if(_0x4320a0){_0x726973=_0x4320a0;_0x4f48c8['model']=_[_0x0b49('0x49')](db[_0x0b49('0x95')]['rawAttributes']);_0x4f48c8['query']=_[_0x0b49('0x49')](_0x284390[_0x0b49('0x37')]);_0x4f48c8[_0x0b49('0x38')]=_[_0x0b49('0x39')](_0x4f48c8[_0x0b49('0x36')],_0x4f48c8[_0x0b49('0x37')]);_0x5620cd[_0x0b49('0x3a')]=_['intersection'](_0x4f48c8[_0x0b49('0x36')],qs[_0x0b49('0x3b')](_0x284390[_0x0b49('0x37')]['fields']));_0x5620cd[_0x0b49('0x3a')]=_0x5620cd[_0x0b49('0x3a')][_0x0b49('0x4a')]?_0x5620cd[_0x0b49('0x3a')]:_0x4f48c8[_0x0b49('0x36')];_0x5620cd['order']=qs[_0x0b49('0x3e')](_0x284390['query'][_0x0b49('0x3e')]);_0x5620cd[_0x0b49('0x3f')]=qs[_0x0b49('0x38')](_['pick'](_0x284390[_0x0b49('0x37')],_0x4f48c8[_0x0b49('0x38')]));if(_0x284390['query'][_0x0b49('0x5c')]){_0x5620cd['where']=_['merge'](_0x5620cd[_0x0b49('0x3f')],{'$or':_['map'](_0x5620cd['attributes'],function(_0x4f2adb){var _0x4f8602={};_0x4f8602[_0x4f2adb]={'$like':'%'+_0x284390[_0x0b49('0x37')][_0x0b49('0x5c')]+'%'};return _0x4f8602;})});}_0x5620cd=_['merge']({},_0x5620cd,_0x284390['options']);return _0x726973[_0x0b49('0x117')](_0x5620cd);}})[_0x0b49('0x17')](function(_0x339e16){if(_0x339e16){_0xb835ac=_0x339e16[_0x0b49('0x4a')];if(!_0x284390['query'][_0x0b49('0x3c')](_0x0b49('0x5b'))){_0x5620cd[_0x0b49('0x25')]=qs[_0x0b49('0x25')](_0x284390['query'][_0x0b49('0x25')]);_0x5620cd[_0x0b49('0x23')]=qs[_0x0b49('0x23')](_0x284390['query'][_0x0b49('0x23')]);}return _0x726973[_0x0b49('0x117')](_0x5620cd);}})[_0x0b49('0x17')](function(_0x3cf089){if(_0x3cf089){return _0x3cf089?{'count':_0xb835ac,'rows':_0x3cf089}:null;}})[_0x0b49('0x17')](respondWithResult(_0x4ccc35,null))[_0x0b49('0x20')](handleError(_0x4ccc35,null));};exports[_0x0b49('0x118')]=function(_0x328d90,_0x2ef888){return db[_0x0b49('0x119')][_0x0b49('0x51')]({'where':{'id':_0x328d90['params']['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x2ef888,null))[_0x0b49('0x17')](function(_0x5324ec){if(_0x5324ec){return _0x5324ec[_0x0b49('0x118')](_0x328d90['body']['ids'],_[_0x0b49('0xeb')](_0x328d90[_0x0b49('0x4c')],['ids','id'])||{});}})['then'](respondWithResult(_0x2ef888,null))[_0x0b49('0x20')](handleError(_0x2ef888,null));};exports[_0x0b49('0xff')]=function(_0x3e3460,_0x105b40){var _0x3b75b6={};var _0x4c6418={};var _0x3cd517;var _0x681834;return db[_0x0b49('0x31')][_0x0b49('0x5a')]({'where':{'id':_0x3e3460[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x105b40,null))['then'](function(_0x1d97f0){if(_0x1d97f0){_0x3cd517=_0x1d97f0;_0x4c6418['model']=_['keys'](db[_0x0b49('0x11a')][_0x0b49('0x32')]);_0x4c6418[_0x0b49('0x37')]=_['keys'](_0x3e3460[_0x0b49('0x37')]);_0x4c6418['filters']=_[_0x0b49('0x39')](_0x4c6418['model'],_0x4c6418[_0x0b49('0x37')]);_0x3b75b6[_0x0b49('0x3a')]=_[_0x0b49('0x39')](_0x4c6418[_0x0b49('0x36')],qs[_0x0b49('0x3b')](_0x3e3460[_0x0b49('0x37')][_0x0b49('0x3b')]));_0x3b75b6['attributes']=_0x3b75b6[_0x0b49('0x3a')][_0x0b49('0x4a')]?_0x3b75b6[_0x0b49('0x3a')]:_0x4c6418['model'];_0x3b75b6['order']=qs[_0x0b49('0x3e')](_0x3e3460[_0x0b49('0x37')]['sort']);_0x3b75b6['where']=qs[_0x0b49('0x38')](_[_0x0b49('0x40')](_0x3e3460[_0x0b49('0x37')],_0x4c6418[_0x0b49('0x38')]));if(_0x3e3460['query'][_0x0b49('0x5c')]){_0x3b75b6[_0x0b49('0x3f')]=_[_0x0b49('0x42')](_0x3b75b6[_0x0b49('0x3f')],{'$or':_['map'](_0x3b75b6[_0x0b49('0x3a')],function(_0x3b3e95){var _0x289736={};_0x289736[_0x3b3e95]={'$like':'%'+_0x3e3460['query'][_0x0b49('0x5c')]+'%'};return _0x289736;})});}_0x3b75b6=_['merge']({},_0x3b75b6,_0x3e3460[_0x0b49('0x43')]);return _0x3cd517[_0x0b49('0xff')](_0x3b75b6);}})['then'](function(_0x1acb1b){if(_0x1acb1b){_0x681834=_0x1acb1b[_0x0b49('0x4a')];if(!_0x3e3460[_0x0b49('0x37')][_0x0b49('0x3c')](_0x0b49('0x5b'))){_0x3b75b6[_0x0b49('0x25')]=qs[_0x0b49('0x25')](_0x3e3460[_0x0b49('0x37')][_0x0b49('0x25')]);_0x3b75b6[_0x0b49('0x23')]=qs[_0x0b49('0x23')](_0x3e3460['query'][_0x0b49('0x23')]);}return _0x3cd517[_0x0b49('0xff')](_0x3b75b6);}})[_0x0b49('0x17')](function(_0x110273){if(_0x110273){return _0x110273?{'count':_0x681834,'rows':_0x110273}:null;}})['then'](respondWithResult(_0x105b40,null))[_0x0b49('0x20')](handleError(_0x105b40,null));};exports['getFields']=function(_0x30aa62,_0x427957){var _0xe206d8=_0x30aa62[_0x0b49('0x37')]['online']==='false'?_0x0b49('0x11b'):_0x0b49('0x11c');return db['ChatWebsite'][_0x0b49('0x51')]({'attributes':['id',_0xe206d8],'where':{'id':_0x30aa62['params']['id']}})['then'](handleEntityNotFound(_0x427957,null))['then'](function(_0x12c232){if(_0x12c232){var _0xc9305b=_0x12c232[_0xe206d8];var _0x23c111=_0xc9305b&&_0xc9305b['items']?_0xc9305b[_0x0b49('0x11d')]:[];_0x427957[_0x0b49('0x2c')]({'fromKey':_[_0x0b49('0x79')](_0xc9305b[_0x0b49('0x11e')])?undefined:_0xc9305b[_0x0b49('0x11e')],'count':_0x23c111[_0x0b49('0x4a')],'rows':_0x23c111});}})[_0x0b49('0x20')](handleError(_0x427957,null));};exports[_0x0b49('0x11f')]=function(_0x53e747,_0x40c504){var _0xd317c0={'raw':![],'where':{}};var _0x4867f3={};var _0xa27233={'count':0x0,'rows':[]};return db[_0x0b49('0x31')][_0x0b49('0x5a')]({'where':{'id':_0x53e747[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x40c504,null))['then'](function(_0x28faf6){if(_0x28faf6){_0x4867f3[_0x0b49('0x36')]=_['keys'](db[_0x0b49('0x120')]['rawAttributes']);_0x4867f3['query']=_[_0x0b49('0x49')](_0x53e747[_0x0b49('0x37')]);_0x4867f3[_0x0b49('0x38')]=_[_0x0b49('0x39')](_0x4867f3['model'],_0x4867f3[_0x0b49('0x37')]);_0xd317c0[_0x0b49('0x3a')]=_[_0x0b49('0x39')](_0x4867f3['model'],qs[_0x0b49('0x3b')](_0x53e747[_0x0b49('0x37')]['fields']));_0xd317c0['attributes']=_0xd317c0[_0x0b49('0x3a')][_0x0b49('0x4a')]?_0xd317c0[_0x0b49('0x3a')]:_0x4867f3[_0x0b49('0x36')];if(!_0x53e747[_0x0b49('0x37')][_0x0b49('0x3c')](_0x0b49('0x5b'))){_0xd317c0[_0x0b49('0x25')]=qs[_0x0b49('0x25')](_0x53e747[_0x0b49('0x37')]['limit']);_0xd317c0['offset']=qs[_0x0b49('0x23')](_0x53e747['query'][_0x0b49('0x23')]);}_0xd317c0['order']=qs[_0x0b49('0x3e')](_0x53e747[_0x0b49('0x37')][_0x0b49('0x3e')]);_0xd317c0[_0x0b49('0x3f')]=qs[_0x0b49('0x38')](_['pick'](_0x53e747[_0x0b49('0x37')],_0x4867f3[_0x0b49('0x38')]));_0xd317c0[_0x0b49('0x3f')][_0x0b49('0x57')]=_0x28faf6['id'];if(_0x53e747[_0x0b49('0x37')][_0x0b49('0x5c')]){_0xd317c0[_0x0b49('0x3f')]=_['merge'](_0xd317c0['where'],{'$or':_[_0x0b49('0x30')](_0xd317c0[_0x0b49('0x3a')],function(_0xb63d45){var _0x2c6d55={};_0x2c6d55[_0xb63d45]={'$like':'%'+_0x53e747[_0x0b49('0x37')][_0x0b49('0x5c')]+'%'};return _0x2c6d55;})});}_0xd317c0=_[_0x0b49('0x42')]({},_0xd317c0,_0x53e747['options']);return db[_0x0b49('0x120')][_0x0b49('0x44')]({'where':_0xd317c0[_0x0b49('0x3f')]})[_0x0b49('0x17')](function(_0x2d0eff){_0xa27233[_0x0b49('0x44')]=_0x2d0eff;if(_0x53e747[_0x0b49('0x37')]['includeAll']){_0xd317c0[_0x0b49('0x46')]=[{'all':!![]}];}else{_0xd317c0[_0x0b49('0x46')]=[{'model':db[_0x0b49('0x85')],'as':_0x0b49('0x121'),'required':![]},{'model':db[_0x0b49('0xd6')],'as':_0x0b49('0x122'),'required':![]}];}return db[_0x0b49('0x120')][_0x0b49('0x5d')](_0xd317c0);})[_0x0b49('0x17')](function(_0x8db4ea){_0xa27233[_0x0b49('0x61')]=_0x8db4ea;return _0xa27233;});}})[_0x0b49('0x17')](respondWithFilteredResult(_0x40c504,_0xd317c0))[_0x0b49('0x20')](handleError(_0x40c504,null));};exports[_0x0b49('0x123')]=function(_0x113146,_0x3a0d3a){return db[_0x0b49('0x31')][_0x0b49('0x51')]({'where':{'id':_0x113146['params']['id']}})['then'](handleEntityNotFound(_0x3a0d3a,null))[_0x0b49('0x17')](function(_0x1d7003){if(_0x1d7003){return _0x1d7003[_0x0b49('0x123')](_0x113146[_0x0b49('0x4c')][_0x0b49('0x63')],_[_0x0b49('0xeb')](_0x113146[_0x0b49('0x4c')],[_0x0b49('0x63'),'id'])||{})[_0x0b49('0xb1')](function(_0x49640d){for(var _0x445c07=0x0;_0x445c07<_0x113146[_0x0b49('0x4c')]['ids'][_0x0b49('0x4a')];_0x445c07+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x113146[_0x0b49('0x4c')][_0x0b49('0x63')][_0x445c07]),'ChatWebsiteId':Number(_0x113146['params']['id'])});}return _0x49640d;});}})[_0x0b49('0x17')](respondWithResult(_0x3a0d3a,null))[_0x0b49('0x20')](handleError(_0x3a0d3a,null));};exports['removeAgents']=function(_0x262316,_0x36e63d){return db[_0x0b49('0x31')][_0x0b49('0x51')]({'where':{'id':_0x262316[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x36e63d,null))[_0x0b49('0x17')](function(_0x320c49){if(_0x320c49){return _0x320c49[_0x0b49('0x124')](_0x262316[_0x0b49('0x37')][_0x0b49('0x63')])['then'](function(){if(_['isArray'](_0x262316[_0x0b49('0x37')][_0x0b49('0x63')])){for(var _0xe1e810=0x0;_0xe1e810<_0x262316[_0x0b49('0x37')][_0x0b49('0x63')]['length'];_0xe1e810+=0x1){socket[_0x0b49('0x125')]('userChatWebsite:remove',{'UserId':Number(_0x262316[_0x0b49('0x37')][_0x0b49('0x63')][_0xe1e810]),'ChatWebsiteId':Number(_0x262316[_0x0b49('0x48')]['id'])});}}else{socket[_0x0b49('0x125')](_0x0b49('0x126'),{'UserId':Number(_0x262316[_0x0b49('0x37')][_0x0b49('0x63')]),'ChatWebsiteId':Number(_0x262316[_0x0b49('0x48')]['id'])});}});}})[_0x0b49('0x17')](respondWithStatusCode(_0x36e63d,null))['catch'](handleError(_0x36e63d,null));};exports[_0x0b49('0x127')]=function(_0xa69331,_0x5b0a8b){var _0x4c7f75={};var _0x5ddc73={};var _0xe584a;var _0xc68a69;return db[_0x0b49('0x31')][_0x0b49('0x5a')]({'where':{'id':_0xa69331[_0x0b49('0x48')]['id']}})[_0x0b49('0x17')](handleEntityNotFound(_0x5b0a8b,null))[_0x0b49('0x17')](function(_0xd3169e){if(_0xd3169e){_0xe584a=_0xd3169e;_0x5ddc73[_0x0b49('0x36')]=_['keys'](db[_0x0b49('0xbd')][_0x0b49('0x32')]);_0x5ddc73['query']=_[_0x0b49('0x49')](_0xa69331[_0x0b49('0x37')]);_0x5ddc73['filters']=_[_0x0b49('0x39')](_0x5ddc73[_0x0b49('0x36')],_0x5ddc73[_0x0b49('0x37')]);_0x4c7f75[_0x0b49('0x3a')]=_[_0x0b49('0x39')](_0x5ddc73[_0x0b49('0x36')],qs[_0x0b49('0x3b')](_0xa69331[_0x0b49('0x37')][_0x0b49('0x3b')]));_0x4c7f75[_0x0b49('0x3a')]=_0x4c7f75[_0x0b49('0x3a')][_0x0b49('0x4a')]?_0x4c7f75[_0x0b49('0x3a')]:_0x5ddc73[_0x0b49('0x36')];_0x4c7f75['order']=qs[_0x0b49('0x3e')](_0xa69331[_0x0b49('0x37')][_0x0b49('0x3e')]);_0x4c7f75[_0x0b49('0x3f')]=qs[_0x0b49('0x38')](_[_0x0b49('0x40')](_0xa69331[_0x0b49('0x37')],_0x5ddc73['filters']));if(_0xa69331['query'][_0x0b49('0x5c')]){_0x4c7f75[_0x0b49('0x3f')]=_[_0x0b49('0x42')](_0x4c7f75[_0x0b49('0x3f')],{'$or':_['map'](_0x4c7f75['attributes'],function(_0x492a39){var _0x583bc0={};_0x583bc0[_0x492a39]={'$like':'%'+_0xa69331[_0x0b49('0x37')]['filter']+'%'};return _0x583bc0;})});}_0x4c7f75=_[_0x0b49('0x42')]({},_0x4c7f75,_0xa69331[_0x0b49('0x43')]);return _0xe584a[_0x0b49('0x127')](_0x4c7f75);}})['then'](function(_0x33fde1){if(_0x33fde1){_0xc68a69=_0x33fde1[_0x0b49('0x4a')];if(!_0xa69331['query'][_0x0b49('0x3c')](_0x0b49('0x5b'))){_0x4c7f75[_0x0b49('0x25')]=qs[_0x0b49('0x25')](_0xa69331[_0x0b49('0x37')]['limit']);_0x4c7f75[_0x0b49('0x23')]=qs[_0x0b49('0x23')](_0xa69331[_0x0b49('0x37')]['offset']);}return _0xe584a['getAgents'](_0x4c7f75);}})['then'](function(_0x207f59){if(_0x207f59){return _0x207f59?{'count':_0xc68a69,'rows':_0x207f59}:null;}})[_0x0b49('0x17')](respondWithResult(_0x5b0a8b,null))['catch'](handleError(_0x5b0a8b,null));}; \ No newline at end of file +var _0x53a4=['MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','ChatOfflineMessage','fromString','originalname','mimetype','server','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','No\x20timezone','Interval','Intervals','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','url','../../mysqldb','redis','localhost','register','html-to-text','jayson/promise','http','client','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','set','json','update','destroy','ChatWebsites','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','pick','ChatWebsiteId','filter','rows','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','join','download','root','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','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','from','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','List','Contacts','DESC','ChatApplication','Applications','applications','orderBy','priority','asc','account','defaults','contact','cf-connecting-ip','x-forwarded-for','first','firstName','x-real-port','referer','browser','version','unknown','format','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','files','no\x20available\x20attributes','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x53a4,0x19d));var _0x453a=function(_0x22ea80,_0x2e80ca){_0x22ea80=_0x22ea80-0x0;var _0x4adadf=_0x53a4[_0x22ea80];return _0x4adadf;};'use strict';var BPromise=require(_0x453a('0x0'));var Mustache=require(_0x453a('0x1'));var util=require(_0x453a('0x2'));var path=require(_0x453a('0x3'));var ejs=require(_0x453a('0x4'));var fs=require('fs');var fs_extra=require(_0x453a('0x5'));var _=require(_0x453a('0x6'));var querystring=require('querystring');var Redis=require(_0x453a('0x7'));var qs=require(_0x453a('0x8'));var logger=require(_0x453a('0x9'))('api');var config=require(_0x453a('0xa'));var url=require(_0x453a('0xb'));var db=require(_0x453a('0xc'))['db'];config[_0x453a('0xd')]=_['defaults'](config['redis'],{'host':_0x453a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x453a('0xf')](socket);var htmlToText=require(_0x453a('0x10'));var jayson=require(_0x453a('0x11'));var client=jayson['client'][_0x453a('0x12')]({'port':0x232c});var client9002=jayson[_0x453a('0x13')][_0x453a('0x12')]({'port':0x232a});var client9003=jayson[_0x453a('0x13')][_0x453a('0x12')]({'port':0x232b});var client9001=jayson[_0x453a('0x13')][_0x453a('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x118c36,_0x347f27,_0x20acef,_0x5ab583){return new BPromise(function(_0x33e339,_0x49d1dd){var _0x517258=_0x5ab583||client;return _0x517258[_0x453a('0x14')](_0x118c36,_0x20acef)[_0x453a('0x15')](function(_0x17c0a7){logger['info'](_0x453a('0x16'),_0x347f27,_0x453a('0x17'));logger['debug'](_0x453a('0x18'),_0x347f27,_0x453a('0x17'),JSON[_0x453a('0x19')](_0x17c0a7));if(_0x17c0a7['error']){if(_0x17c0a7['error'][_0x453a('0x1a')]===0x1f4){logger[_0x453a('0x1b')](_0x453a('0x16'),_0x347f27,_0x17c0a7['error']['message']);return _0x49d1dd(_0x17c0a7[_0x453a('0x1b')][_0x453a('0x1c')]);}logger[_0x453a('0x1b')](_0x453a('0x16'),_0x347f27,_0x17c0a7[_0x453a('0x1b')]['message']);return _0x33e339(_0x17c0a7[_0x453a('0x1b')][_0x453a('0x1c')]);}else{logger[_0x453a('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x347f27,'request\x20sent');_0x33e339(_0x17c0a7[_0x453a('0x1e')][_0x453a('0x1c')]);}})[_0x453a('0x1f')](function(_0x36ba87){logger[_0x453a('0x1b')](_0x453a('0x16'),_0x347f27,_0x36ba87);_0x49d1dd(_0x36ba87);});});}function respondWithStatusCode(_0x1aa74c,_0x180b1f){_0x180b1f=_0x180b1f||0xcc;return function(_0x1b230a){if(_0x1b230a){return _0x1aa74c[_0x453a('0x20')](_0x180b1f);}return _0x1aa74c[_0x453a('0x21')](_0x180b1f)['end']();};}function respondWithResult(_0x26b3c2,_0x415353){_0x415353=_0x415353||0xc8;return function(_0x208dac){if(_0x208dac){return _0x26b3c2['status'](_0x415353)['json'](_0x208dac);}};}function respondWithFilteredResult(_0x14d9d2,_0x3a0dd8){return function(_0x2e78e4){if(_0x2e78e4){var _0x6a5bca=typeof _0x3a0dd8[_0x453a('0x22')]===_0x453a('0x23')&&typeof _0x3a0dd8[_0x453a('0x24')]===_0x453a('0x23');var _0x3686c5=_0x2e78e4['count'];var _0x10433d=_0x6a5bca?0x0:_0x3a0dd8['offset'];var _0x7b6795=_0x6a5bca?_0x2e78e4[_0x453a('0x25')]:_0x3a0dd8[_0x453a('0x22')]+_0x3a0dd8[_0x453a('0x24')];var _0x30c977;if(_0x7b6795>=_0x3686c5){_0x7b6795=_0x3686c5;_0x30c977=0xc8;}else{_0x30c977=0xce;}_0x14d9d2[_0x453a('0x21')](_0x30c977);return _0x14d9d2[_0x453a('0x26')]('Content-Range',_0x10433d+'-'+_0x7b6795+'/'+_0x3686c5)[_0x453a('0x27')](_0x2e78e4);}return null;};}function saveUpdates(_0x35437c){return function(_0x3b42f8){if(_0x3b42f8){return _0x3b42f8[_0x453a('0x28')](_0x35437c)[_0x453a('0x15')](function(_0x51ec9e){return _0x51ec9e;});}return null;};}function removeEntity(_0x4c3bd8){return function(_0x23b0f0){if(_0x23b0f0){return _0x23b0f0[_0x453a('0x29')]()[_0x453a('0x15')](function(){var _0x128245=_0x23b0f0['get']({'plain':!![]});var _0x2ccb22=_0x453a('0x2a');return db[_0x453a('0x2b')][_0x453a('0x29')]({'where':{'type':_0x2ccb22,'resourceId':_0x128245['id']}})['then'](function(){return _0x23b0f0;});})[_0x453a('0x15')](function(){_0x4c3bd8['status'](0xcc)[_0x453a('0x2c')]();});}};}function handleEntityNotFound(_0x56c7fa){return function(_0x5abe84){if(!_0x5abe84){_0x56c7fa[_0x453a('0x20')](0x194);}return _0x5abe84;};}function handleError(_0x4f2c73,_0x1c7867){_0x1c7867=_0x1c7867||0x1f4;return function(_0xfe7463){logger['error'](_0xfe7463['stack']);if(_0xfe7463[_0x453a('0x2d')]){delete _0xfe7463[_0x453a('0x2d')];}_0x4f2c73['status'](_0x1c7867)[_0x453a('0x2e')](_0xfe7463);};}exports[_0x453a('0x2f')]=function(_0x35184c,_0xa2becd){var _0x7ce78={'include':[{'model':db[_0x453a('0x30')],'as':_0x453a('0x31')}]},_0x2e8438={},_0x2f7991={'count':0x0,'rows':[]};var _0x1beef2=_['map'](db[_0x453a('0x32')][_0x453a('0x33')],function(_0x3db016){return{'name':_0x3db016[_0x453a('0x34')],'type':_0x3db016[_0x453a('0x35')][_0x453a('0x36')]};});_0x2e8438[_0x453a('0x37')]=_['map'](_0x1beef2,_0x453a('0x2d'));_0x2e8438['query']=_[_0x453a('0x38')](_0x35184c[_0x453a('0x39')]);_0x2e8438[_0x453a('0x3a')]=_[_0x453a('0x3b')](_0x2e8438[_0x453a('0x37')],_0x2e8438[_0x453a('0x39')]);_0x7ce78[_0x453a('0x3c')]=_[_0x453a('0x3b')](_0x2e8438[_0x453a('0x37')],qs[_0x453a('0x3d')](_0x35184c[_0x453a('0x39')][_0x453a('0x3d')]));_0x7ce78['attributes']=_0x7ce78[_0x453a('0x3c')][_0x453a('0x3e')]?_0x7ce78[_0x453a('0x3c')]:_0x2e8438['model'];if(!_0x35184c[_0x453a('0x39')][_0x453a('0x3f')]('nolimit')){_0x7ce78['limit']=qs[_0x453a('0x24')](_0x35184c['query'][_0x453a('0x24')]);_0x7ce78['offset']=qs['offset'](_0x35184c['query'][_0x453a('0x22')]);}_0x7ce78[_0x453a('0x40')]=qs[_0x453a('0x41')](_0x35184c[_0x453a('0x39')][_0x453a('0x41')]);_0x7ce78[_0x453a('0x42')]=qs[_0x453a('0x3a')](_['pick'](_0x35184c[_0x453a('0x39')],_0x2e8438[_0x453a('0x3a')]),_0x1beef2);if(_0x35184c[_0x453a('0x39')]['filter']){_0x7ce78['where']=_[_0x453a('0x43')](_0x7ce78[_0x453a('0x42')],{'$or':_[_0x453a('0x44')](_0x1beef2,function(_0x2afd82){if(_0x2afd82[_0x453a('0x35')]!==_0x453a('0x45')){var _0xbc6e59={};_0xbc6e59[_0x2afd82[_0x453a('0x2d')]]={'$like':'%'+_0x35184c[_0x453a('0x39')]['filter']+'%'};return _0xbc6e59;}})});}_0x7ce78=_[_0x453a('0x43')]({},_0x7ce78,_0x35184c['options']);var _0x1219b0={'where':_0x7ce78['where']};return db[_0x453a('0x32')][_0x453a('0x25')](_0x1219b0)[_0x453a('0x15')](function(_0x5bd1a6){_0x2f7991[_0x453a('0x25')]=_0x5bd1a6;if(_0x35184c[_0x453a('0x39')][_0x453a('0x46')]){_0x7ce78[_0x453a('0x47')]=[{'all':!![]}];}return db[_0x453a('0x32')][_0x453a('0x48')](_0x7ce78);})[_0x453a('0x15')](function(_0x177552){_0x2f7991['rows']=_0x177552;return _0x2f7991;})[_0x453a('0x15')](respondWithFilteredResult(_0xa2becd,_0x7ce78))[_0x453a('0x1f')](handleError(_0xa2becd,null));};exports[_0x453a('0x49')]=function(_0x2e77f5,_0x46284c){var _0x4aa129={'raw':![],'where':{'id':_0x2e77f5[_0x453a('0x4a')]['id']},'include':[{'model':db[_0x453a('0x30')],'as':_0x453a('0x31')}]},_0x56a17e={};_0x56a17e[_0x453a('0x37')]=_[_0x453a('0x38')](db[_0x453a('0x32')][_0x453a('0x33')]);_0x56a17e[_0x453a('0x39')]=_[_0x453a('0x38')](_0x2e77f5['query']);_0x56a17e[_0x453a('0x3a')]=_[_0x453a('0x3b')](_0x56a17e[_0x453a('0x37')],_0x56a17e[_0x453a('0x39')]);_0x4aa129[_0x453a('0x3c')]=_[_0x453a('0x3b')](_0x56a17e['model'],qs[_0x453a('0x3d')](_0x2e77f5[_0x453a('0x39')][_0x453a('0x3d')]));_0x4aa129[_0x453a('0x3c')]=_0x4aa129[_0x453a('0x3c')][_0x453a('0x3e')]?_0x4aa129[_0x453a('0x3c')]:_0x56a17e[_0x453a('0x37')];if(_0x2e77f5[_0x453a('0x39')][_0x453a('0x46')]){_0x4aa129[_0x453a('0x47')]=[{'all':!![]}];}_0x4aa129=_[_0x453a('0x43')]({},_0x4aa129,_0x2e77f5[_0x453a('0x4b')]);return db['ChatWebsite'][_0x453a('0x4c')](_0x4aa129)['then'](handleEntityNotFound(_0x46284c,null))[_0x453a('0x15')](respondWithResult(_0x46284c,null))[_0x453a('0x1f')](handleError(_0x46284c,null));};exports[_0x453a('0x4d')]=function(_0x5576f1,_0x2b472e){return db[_0x453a('0x32')][_0x453a('0x4d')](_0x5576f1[_0x453a('0x4e')],{})[_0x453a('0x15')](function(_0x5eb883){var _0x356bb2=_0x5576f1[_0x453a('0x4f')][_0x453a('0x50')]({'plain':!![]});if(!_0x356bb2)throw new Error(_0x453a('0x51'));if(_0x356bb2[_0x453a('0x52')]===_0x453a('0x4f')){var _0x28d4ff=_0x5eb883[_0x453a('0x50')]({'plain':!![]});var _0x45eff4=_0x453a('0x2a');return db[_0x453a('0x53')][_0x453a('0x4c')]({'where':{'name':_0x45eff4,'userProfileId':_0x356bb2[_0x453a('0x54')]},'raw':!![]})[_0x453a('0x15')](function(_0x3c733c){if(_0x3c733c&&_0x3c733c[_0x453a('0x55')]===0x0){return db['UserProfileResource'][_0x453a('0x4d')]({'name':_0x28d4ff[_0x453a('0x2d')],'resourceId':_0x28d4ff['id'],'type':_0x3c733c[_0x453a('0x2d')],'sectionId':_0x3c733c['id']},{})['then'](function(){return _0x5eb883;});}else{return _0x5eb883;}})[_0x453a('0x1f')](function(_0x7dd73f){logger[_0x453a('0x1b')](_0x453a('0x56'),_0x7dd73f);throw _0x7dd73f;});}return _0x5eb883;})['then'](respondWithResult(_0x2b472e,0xc9))['catch'](handleError(_0x2b472e,null));};exports[_0x453a('0x28')]=function(_0x24154f,_0x11e154){if(_0x24154f[_0x453a('0x4e')]['id']){delete _0x24154f[_0x453a('0x4e')]['id'];}return db[_0x453a('0x32')]['find']({'where':{'id':_0x24154f[_0x453a('0x4a')]['id']},'include':[{'model':db['Pause'],'as':_0x453a('0x31')}]})[_0x453a('0x15')](handleEntityNotFound(_0x11e154,null))[_0x453a('0x15')](saveUpdates(_0x24154f[_0x453a('0x4e')],null))['then'](respondWithResult(_0x11e154,null))[_0x453a('0x1f')](handleError(_0x11e154,null));};exports[_0x453a('0x29')]=function(_0x1db30c,_0x3fa2a1){return db[_0x453a('0x32')]['find']({'where':{'id':_0x1db30c[_0x453a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3fa2a1,null))[_0x453a('0x15')](removeEntity(_0x3fa2a1,null))['catch'](handleError(_0x3fa2a1,null));};exports[_0x453a('0x57')]=function(_0x315b45,_0x41d527){return db[_0x453a('0x32')]['describe']()[_0x453a('0x15')](respondWithResult(_0x41d527,null))[_0x453a('0x1f')](handleError(_0x41d527,null));};exports[_0x453a('0x58')]=function(_0x5e7457,_0x30361d){if(_0x5e7457[_0x453a('0x4e')]['id']){delete _0x5e7457['body']['id'];}return db[_0x453a('0x32')][_0x453a('0x4c')]({'where':{'id':_0x5e7457[_0x453a('0x4a')]['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x30361d,null))[_0x453a('0x15')](function(_0xb866b9){if(_0xb866b9){_0x5e7457['body']['ChatWebsiteId']=_0xb866b9['id'];return db['Disposition'][_0x453a('0x4d')](_0x5e7457[_0x453a('0x4e')]);}})[_0x453a('0x15')](respondWithResult(_0x30361d,null))[_0x453a('0x1f')](handleError(_0x30361d,null));};exports[_0x453a('0x59')]=function(_0x1210f1,_0x5ccef4){var _0x16cbb1={'raw':![],'where':{}};var _0x3990a8={};var _0x133d62={'count':0x0,'rows':[]};return db[_0x453a('0x32')][_0x453a('0x5a')]({'where':{'id':_0x1210f1['params']['id']}})['then'](handleEntityNotFound(_0x5ccef4,null))[_0x453a('0x15')](function(_0x4fca76){if(_0x4fca76){_0x3990a8[_0x453a('0x37')]=_['keys'](db[_0x453a('0x5b')]['rawAttributes']);_0x3990a8[_0x453a('0x39')]=_[_0x453a('0x38')](_0x1210f1['query']);_0x3990a8['filters']=_[_0x453a('0x3b')](_0x3990a8['model'],_0x3990a8[_0x453a('0x39')]);_0x16cbb1[_0x453a('0x3c')]=_[_0x453a('0x3b')](_0x3990a8[_0x453a('0x37')],qs['fields'](_0x1210f1['query'][_0x453a('0x3d')]));_0x16cbb1['attributes']=_0x16cbb1[_0x453a('0x3c')][_0x453a('0x3e')]?_0x16cbb1[_0x453a('0x3c')]:_0x3990a8['model'];if(!_0x1210f1[_0x453a('0x39')][_0x453a('0x3f')](_0x453a('0x5c'))){_0x16cbb1[_0x453a('0x24')]=qs['limit'](_0x1210f1['query'][_0x453a('0x24')]);_0x16cbb1[_0x453a('0x22')]=qs[_0x453a('0x22')](_0x1210f1['query'][_0x453a('0x22')]);}_0x16cbb1['order']=qs[_0x453a('0x41')](_0x1210f1[_0x453a('0x39')][_0x453a('0x41')]);_0x16cbb1['where']=qs[_0x453a('0x3a')](_[_0x453a('0x5d')](_0x1210f1[_0x453a('0x39')],_0x3990a8[_0x453a('0x3a')]));_0x16cbb1[_0x453a('0x42')][_0x453a('0x5e')]=_0x4fca76['id'];if(_0x1210f1['query'][_0x453a('0x5f')]){_0x16cbb1[_0x453a('0x42')]=_[_0x453a('0x43')](_0x16cbb1[_0x453a('0x42')],{'$or':_['map'](_0x16cbb1['attributes'],function(_0x436f32){var _0x498752={};_0x498752[_0x436f32]={'$like':'%'+_0x1210f1[_0x453a('0x39')][_0x453a('0x5f')]+'%'};return _0x498752;})});}_0x16cbb1=_[_0x453a('0x43')]({},_0x16cbb1,_0x1210f1[_0x453a('0x4b')]);return db[_0x453a('0x5b')][_0x453a('0x25')]({'where':_0x16cbb1[_0x453a('0x42')]})[_0x453a('0x15')](function(_0xbdf14c){_0x133d62[_0x453a('0x25')]=_0xbdf14c;if(_0x1210f1['query']['includeAll']){_0x16cbb1[_0x453a('0x47')]=[{'all':!![]}];}return db['Disposition'][_0x453a('0x48')](_0x16cbb1);})[_0x453a('0x15')](function(_0x500fc5){_0x133d62[_0x453a('0x60')]=_0x500fc5;return _0x133d62;});}})[_0x453a('0x15')](respondWithFilteredResult(_0x5ccef4,_0x16cbb1))[_0x453a('0x1f')](handleError(_0x5ccef4,null));};exports[_0x453a('0x61')]=function(_0x29de34,_0x394c60){return db['ChatWebsite']['find']({'where':{'id':_0x29de34[_0x453a('0x4a')]['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x394c60,null))[_0x453a('0x15')](function(_0x58bb96){if(_0x58bb96){return _0x58bb96[_0x453a('0x61')](_0x29de34[_0x453a('0x39')][_0x453a('0x62')]);}})[_0x453a('0x15')](respondWithStatusCode(_0x394c60,null))[_0x453a('0x1f')](handleError(_0x394c60,null));};exports['addAnswer']=function(_0x2933e0,_0x135667){if(_0x2933e0[_0x453a('0x4e')]['id']){delete _0x2933e0[_0x453a('0x4e')]['id'];}return db[_0x453a('0x32')][_0x453a('0x4c')]({'where':{'id':_0x2933e0[_0x453a('0x4a')]['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x135667,null))[_0x453a('0x15')](function(_0x24857c){if(_0x24857c){_0x2933e0[_0x453a('0x4e')][_0x453a('0x5e')]=_0x24857c['id'];return db['CannedAnswer'][_0x453a('0x4d')](_0x2933e0[_0x453a('0x4e')]);}})[_0x453a('0x15')](respondWithResult(_0x135667,null))[_0x453a('0x1f')](handleError(_0x135667,null));};exports[_0x453a('0x63')]=function(_0x362fe3,_0x4a5fb0){var _0x3d98b6={'raw':![],'where':{}};var _0x10e604={};var _0x1e832e={'count':0x0,'rows':[]};return db[_0x453a('0x32')][_0x453a('0x5a')]({'where':{'id':_0x362fe3[_0x453a('0x4a')]['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x4a5fb0,null))[_0x453a('0x15')](function(_0xd079b3){if(_0xd079b3){_0x10e604[_0x453a('0x37')]=_[_0x453a('0x38')](db['CannedAnswer'][_0x453a('0x33')]);_0x10e604[_0x453a('0x39')]=_[_0x453a('0x38')](_0x362fe3['query']);_0x10e604[_0x453a('0x3a')]=_[_0x453a('0x3b')](_0x10e604[_0x453a('0x37')],_0x10e604[_0x453a('0x39')]);_0x3d98b6[_0x453a('0x3c')]=_[_0x453a('0x3b')](_0x10e604[_0x453a('0x37')],qs['fields'](_0x362fe3[_0x453a('0x39')][_0x453a('0x3d')]));_0x3d98b6[_0x453a('0x3c')]=_0x3d98b6[_0x453a('0x3c')][_0x453a('0x3e')]?_0x3d98b6[_0x453a('0x3c')]:_0x10e604[_0x453a('0x37')];if(!_0x362fe3['query'][_0x453a('0x3f')](_0x453a('0x5c'))){_0x3d98b6['limit']=qs['limit'](_0x362fe3[_0x453a('0x39')][_0x453a('0x24')]);_0x3d98b6[_0x453a('0x22')]=qs[_0x453a('0x22')](_0x362fe3[_0x453a('0x39')][_0x453a('0x22')]);}_0x3d98b6[_0x453a('0x40')]=qs['sort'](_0x362fe3[_0x453a('0x39')][_0x453a('0x41')]);_0x3d98b6[_0x453a('0x42')]=qs['filters'](_[_0x453a('0x5d')](_0x362fe3[_0x453a('0x39')],_0x10e604[_0x453a('0x3a')]));_0x3d98b6[_0x453a('0x42')][_0x453a('0x5e')]=_0xd079b3['id'];if(_0x362fe3['query'][_0x453a('0x5f')]){_0x3d98b6[_0x453a('0x42')]=_[_0x453a('0x43')](_0x3d98b6[_0x453a('0x42')],{'$or':_['map'](_0x3d98b6[_0x453a('0x3c')],function(_0xd2be9){var _0x5bc533={};_0x5bc533[_0xd2be9]={'$like':'%'+_0x362fe3[_0x453a('0x39')]['filter']+'%'};return _0x5bc533;})});}_0x3d98b6=_[_0x453a('0x43')]({},_0x3d98b6,_0x362fe3[_0x453a('0x4b')]);return db[_0x453a('0x64')][_0x453a('0x25')]({'where':_0x3d98b6[_0x453a('0x42')]})[_0x453a('0x15')](function(_0x5e2187){_0x1e832e[_0x453a('0x25')]=_0x5e2187;if(_0x362fe3[_0x453a('0x39')][_0x453a('0x46')]){_0x3d98b6[_0x453a('0x47')]=[{'all':!![]}];}return db[_0x453a('0x64')][_0x453a('0x48')](_0x3d98b6);})[_0x453a('0x15')](function(_0x5e1253){_0x1e832e['rows']=_0x5e1253;return _0x1e832e;});}})['then'](respondWithFilteredResult(_0x4a5fb0,_0x3d98b6))[_0x453a('0x1f')](handleError(_0x4a5fb0,null));};exports[_0x453a('0x65')]=function(_0x221535,_0x166c3b){return db[_0x453a('0x32')]['find']({'where':{'id':_0x221535['params']['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x166c3b,null))['then'](function(_0x500a43){if(_0x500a43){return _0x500a43[_0x453a('0x65')](_0x221535[_0x453a('0x39')][_0x453a('0x62')]);}})[_0x453a('0x15')](respondWithStatusCode(_0x166c3b,null))[_0x453a('0x1f')](handleError(_0x166c3b,null));};exports['addLogo']=function(_0x546da1,_0x5009d6){_0x546da1[_0x453a('0x4e')][_0x453a('0x66')]=_0x546da1[_0x453a('0x67')][_0x453a('0x68')];return db[_0x453a('0x32')][_0x453a('0x4c')]({'where':{'id':_0x546da1[_0x453a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5009d6,null))[_0x453a('0x15')](saveUpdates(_0x546da1['body'],null))[_0x453a('0x15')](respondWithResult(_0x5009d6,null))['catch'](handleError(_0x5009d6,null));};exports[_0x453a('0x69')]=function(_0x1b9b91,_0x4c58da){_0x1b9b91['body'][_0x453a('0x6a')]=_0x1b9b91['file']['filename'];return db[_0x453a('0x32')][_0x453a('0x4c')]({'where':{'id':_0x1b9b91[_0x453a('0x4a')]['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x4c58da,null))[_0x453a('0x15')](saveUpdates(_0x1b9b91[_0x453a('0x4e')],null))['then'](respondWithResult(_0x4c58da,null))[_0x453a('0x1f')](handleError(_0x4c58da,null));};exports['addCustomerAvatar']=function(_0x5d2632,_0x485a86){_0x5d2632[_0x453a('0x4e')][_0x453a('0x6b')]=_0x5d2632[_0x453a('0x67')][_0x453a('0x68')];return db['ChatWebsite'][_0x453a('0x4c')]({'where':{'id':_0x5d2632['params']['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x485a86,null))['then'](saveUpdates(_0x5d2632[_0x453a('0x4e')],null))[_0x453a('0x15')](respondWithResult(_0x485a86,null))[_0x453a('0x1f')](handleError(_0x485a86,null));};exports[_0x453a('0x6c')]=function(_0x553c7b,_0x2dd440){_0x553c7b[_0x453a('0x4e')][_0x453a('0x6d')]=_0x553c7b[_0x453a('0x67')][_0x453a('0x68')];return db[_0x453a('0x32')]['find']({'where':{'id':_0x553c7b['params']['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x2dd440,null))[_0x453a('0x15')](saveUpdates(_0x553c7b[_0x453a('0x4e')],null))[_0x453a('0x15')](respondWithResult(_0x2dd440,null))['catch'](handleError(_0x2dd440,null));};exports['getLogo']=function(_0x20dbb0,_0x2ffa37){var _0x4027a3=path['join'](config['root'],_0x453a('0x6e'));var _0x206614={'where':{'id':_0x20dbb0['params']['id']},'attributes':['id',_0x453a('0x66')],'raw':!![]};var _0x1fad9c=![];return require(_0x453a('0x6f'))[_0x453a('0x70')]()[_0x453a('0x15')](function(_0x4d707d){if(_0x4d707d){_0x1fad9c=_0x4d707d[_0x453a('0x71')];}})[_0x453a('0x15')](function(){return db[_0x453a('0x32')][_0x453a('0x4c')](_0x206614);})[_0x453a('0x15')](handleEntityNotFound(_0x2ffa37,null))['then'](function(_0x3cd5d8){if(_0x3cd5d8){if(!_[_0x453a('0x72')](_0x3cd5d8[_0x453a('0x66')])){if(fs[_0x453a('0x73')](path['join'](config['root'],_0x453a('0x74'),_0x3cd5d8[_0x453a('0x66')]))&&_0x1fad9c){_0x4027a3=path[_0x453a('0x75')](config['root'],_0x453a('0x74'),_0x3cd5d8[_0x453a('0x66')]);}}return _0x2ffa37[_0x453a('0x76')](_0x4027a3);}})['catch'](handleError(_0x2ffa37,null));};exports['getAvatar']=function(_0x3465c8,_0x5b2bc5){var _0x15b287=path[_0x453a('0x75')](config[_0x453a('0x77')],_0x453a('0x78'));var _0xcaefcd={'where':{'id':_0x3465c8[_0x453a('0x4a')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x453a('0x32')]['find'](_0xcaefcd)[_0x453a('0x15')](handleEntityNotFound(_0x5b2bc5,null))[_0x453a('0x15')](function(_0x2ec4a4){if(_0x2ec4a4){if(!_[_0x453a('0x72')](_0x2ec4a4[_0x453a('0x6a')])){if(fs[_0x453a('0x73')](path[_0x453a('0x75')](config['root'],_0x453a('0x79'),_0x2ec4a4[_0x453a('0x6a')]))){_0x15b287=path[_0x453a('0x75')](config[_0x453a('0x77')],'server/files/images/avatars/',_0x2ec4a4[_0x453a('0x6a')]);}}return _0x5b2bc5[_0x453a('0x76')](_0x15b287);}})[_0x453a('0x1f')](handleError(_0x5b2bc5,null));};exports[_0x453a('0x7a')]=function(_0x4cf273,_0x372af8){var _0x4abafc=path[_0x453a('0x75')](config[_0x453a('0x77')],_0x453a('0x7b'));var _0x682c7c={'where':{'id':_0x4cf273[_0x453a('0x4a')]['id']},'attributes':['id',_0x453a('0x6b'),_0x453a('0x7c')],'raw':!![]};return db['ChatWebsite'][_0x453a('0x4c')](_0x682c7c)[_0x453a('0x15')](handleEntityNotFound(_0x372af8,null))[_0x453a('0x15')](function(_0x44f8be){if(_0x44f8be){if(!_[_0x453a('0x72')](_0x44f8be[_0x453a('0x6b')])){if(fs[_0x453a('0x73')](path[_0x453a('0x75')](config[_0x453a('0x77')],'server/files/images/avatars/',_0x44f8be['customerAvatar']))&&_0x44f8be[_0x453a('0x7c')]){_0x4abafc=path[_0x453a('0x75')](config[_0x453a('0x77')],'server/files/images/avatars/',_0x44f8be[_0x453a('0x6b')]);}}return _0x372af8[_0x453a('0x76')](_0x4abafc);}})[_0x453a('0x1f')](handleError(_0x372af8,null));};exports[_0x453a('0x7d')]=function(_0x422e1e,_0x50c3ff){var _0x54e29d=path[_0x453a('0x75')](config[_0x453a('0x77')],_0x453a('0x7e'));var _0x33892={'where':{'id':_0x422e1e[_0x453a('0x4a')]['id']},'attributes':['id',_0x453a('0x6d')],'raw':!![]};return db[_0x453a('0x32')][_0x453a('0x4c')](_0x33892)['then'](handleEntityNotFound(_0x50c3ff,null))['then'](function(_0x492504){if(_0x492504){if(!_[_0x453a('0x72')](_0x492504['systemAvatar'])){if(fs[_0x453a('0x73')](path[_0x453a('0x75')](config[_0x453a('0x77')],_0x453a('0x79'),_0x492504['systemAvatar']))){_0x54e29d=path[_0x453a('0x75')](config[_0x453a('0x77')],_0x453a('0x79'),_0x492504[_0x453a('0x6d')]);}}return _0x50c3ff[_0x453a('0x76')](_0x54e29d);}})[_0x453a('0x1f')](handleError(_0x50c3ff,null));};exports['notify']=function(_0x263751,_0x25728d){var _0x34dd8a=require(_0x453a('0x7f'));var _0x3313ba=new _0x34dd8a();var _0x22dce7=_0x3313ba[_0x453a('0x80')](_0x263751[_0x453a('0x81')][_0x453a('0x82')])['getResult']();var _0x29ef2a={'body':_0x263751[_0x453a('0x4e')],'channel':_0x453a('0x83')};var _0x287566=[];var _0xa76ba7=[];var _0x2c24ce={};var _0x543f44=![];return db[_0x453a('0x84')][_0x453a('0x57')]()[_0x453a('0x15')](function(_0x5cb76c){if(!_0x5cb76c){throw new db[(_0x453a('0x85'))][(_0x453a('0x86'))]('no\x20available\x20attributes');}_0x287566=_['difference'](_['keys'](_0x5cb76c),[_0x453a('0x87'),_0x453a('0x88')]);_0xa76ba7=_['difference'](_[_0x453a('0x38')](_0x5cb76c),[_0x453a('0x87'),_0x453a('0x88'),_0x453a('0x89'),_0x453a('0x8a')]);if(_0x263751[_0x453a('0x4e')]['id']){delete _0x263751['body']['id'];}if(_[_0x453a('0x72')](_0x263751['body'][_0x453a('0x8b')])){throw new db['Sequelize']['ValidationError'](_0x453a('0x8c'));}if(_[_0x453a('0x72')](_0x263751[_0x453a('0x4e')][_0x453a('0x4e')])||_0x263751['body']['body']===''){throw new db[(_0x453a('0x85'))][(_0x453a('0x86'))](_0x453a('0x8d'));}if(_[_0x453a('0x72')](_0x263751['body'][_0x453a('0x8e')])){throw new db[(_0x453a('0x85'))][(_0x453a('0x86'))](_0x453a('0x8f')+_0xa76ba7);}if(!_['includes'](_0xa76ba7,_0x263751[_0x453a('0x4e')][_0x453a('0x8e')])){throw new db[(_0x453a('0x85'))][(_0x453a('0x86'))](_0x453a('0x90')+_0xa76ba7);}_0x2c24ce[_0x263751[_0x453a('0x4e')]['mapKey']]=_0x263751[_0x453a('0x4e')][_0x453a('0x8b')];})['then'](function(){return db[_0x453a('0x32')][_0x453a('0x4c')]({'where':{'id':_0x263751[_0x453a('0x4a')]['id']},'include':[{'model':db[_0x453a('0x91')],'as':_0x453a('0x92'),'include':[{'model':db[_0x453a('0x84')],'as':_0x453a('0x93'),'where':_0x2c24ce,'limit':0x1,'order':[[_0x453a('0x88'),_0x453a('0x94')]]}]},{'model':db[_0x453a('0x95')],'as':_0x453a('0x96')}]});})[_0x453a('0x15')](handleEntityNotFound(_0x25728d,null))['then'](function(_0x4e6ace){if(_0x4e6ace&&_0x4e6ace[_0x453a('0x92')]){_0x29ef2a['account']=_0x4e6ace;_0x29ef2a[_0x453a('0x97')]=_0x4e6ace[_0x453a('0x96')];_0x29ef2a['list']=_0x4e6ace['List'];_0x29ef2a['applications']=_[_0x453a('0x98')](_0x29ef2a['applications'],[_0x453a('0x99')],[_0x453a('0x9a')]);if(_0x29ef2a['account'][_0x453a('0x96')]){delete _0x29ef2a[_0x453a('0x9b')][_0x453a('0x96')];}if(_0x29ef2a[_0x453a('0x9b')][_0x453a('0x92')]&&_0x29ef2a['account']['List']['Contacts'][_0x453a('0x3e')]){return _0x29ef2a['account'][_0x453a('0x92')][_0x453a('0x93')][0x0];}var _0x2e66d3=_[_0x453a('0x9c')](_0x263751[_0x453a('0x4e')],{'firstName':_0x263751[_0x453a('0x4e')][_0x453a('0x8b')],'ListId':_0x4e6ace[_0x453a('0x8a')]});_0x2e66d3[_0x263751[_0x453a('0x4e')][_0x453a('0x8e')]]=_0x263751['body'][_0x453a('0x8b')];return db[_0x453a('0x84')][_0x453a('0x4d')](_0x2e66d3,{'fields':_0x287566,'raw':!![]});}})[_0x453a('0x15')](handleEntityNotFound(_0x25728d,null))[_0x453a('0x15')](function(_0x5c78e9){_0x29ef2a[_0x453a('0x9d')]=_0x5c78e9;var _0x1d4092=_0x263751[_0x453a('0x4e')]['customerIp'];if(_0x263751[_0x453a('0x81')]['cf-connecting-ip']){_0x1d4092=_0x263751[_0x453a('0x81')][_0x453a('0x9e')];}else if(_0x263751[_0x453a('0x81')][_0x453a('0x9f')]){_0x1d4092=_[_0x453a('0xa0')](_0x263751[_0x453a('0x81')][_0x453a('0x9f')]['split'](','));}if(_0x5c78e9){var _0x3fd6={'ContactId':_0x5c78e9['id'],'ChatWebsiteId':_0x263751[_0x453a('0x4a')]['id'],'from':(_0x5c78e9[_0x453a('0xa1')]||'')+'\x20'+(_0x5c78e9['lastName']||''),'customerIp':_0x1d4092,'customerPort':_0x263751[_0x453a('0x81')][_0x453a('0xa2')]?_0x263751[_0x453a('0x81')][_0x453a('0xa2')]:null,'referer':_0x263751[_0x453a('0x4e')][_0x453a('0xa3')],'browserName':_0x22dce7[_0x453a('0xa4')]['name']&&_0x22dce7[_0x453a('0xa4')][_0x453a('0xa5')]?util['format']('%s\x20%s',_0x22dce7['browser'][_0x453a('0x2d')],_0x22dce7[_0x453a('0xa4')]['version']):_0x453a('0xa6'),'browserVersion':_0x22dce7[_0x453a('0xa4')][_0x453a('0xa5')]||_0x453a('0xa6'),'osName':util[_0x453a('0xa7')](_0x453a('0xa8'),_0x22dce7['os'][_0x453a('0x2d')],_0x22dce7['os']['version']),'osVersion':_0x22dce7['os']['version'],'deviceModel':_0x22dce7[_0x453a('0xa9')]['model']&&_0x22dce7[_0x453a('0xa9')][_0x453a('0xaa')]?util[_0x453a('0xa7')]('%s\x20%s\x20%s',_0x22dce7[_0x453a('0xa9')][_0x453a('0x37')],_0x22dce7[_0x453a('0xa9')][_0x453a('0xaa')],_0x22dce7[_0x453a('0xa9')][_0x453a('0x35')]):null,'deviceVendor':_0x22dce7[_0x453a('0xa9')][_0x453a('0xaa')],'deviceType':_0x22dce7[_0x453a('0xa9')]['type'],'formData':JSON[_0x453a('0x19')](_0x263751['body'])};var _0x2d9189={'ChatWebsiteId':_0x263751[_0x453a('0x4a')]['id'],'closed':![]};if(_0x263751[_0x453a('0x4e')]['threadId']){_0x2d9189[_0x453a('0xab')]=_0x263751['body']['threadId'];return db[_0x453a('0xac')][_0x453a('0x4c')]({'where':_0x2d9189})[_0x453a('0x15')](function(_0x56fea5){if(_0x56fea5){return[_0x56fea5,![]];}_0x3fd6['threadId']=_0x263751[_0x453a('0x4e')][_0x453a('0xab')];_0x3fd6[_0x453a('0xad')]=_0x263751[_0x453a('0x4e')][_0x453a('0xad')];return db[_0x453a('0xac')]['create'](_0x3fd6)[_0x453a('0x15')](function(_0x3a99d8){return[_0x3a99d8,!![]];});});}_0x2d9189[_0x453a('0xae')]=_0x5c78e9['id'];if(_0x263751[_0x453a('0x4e')]['interaction']&&_0x263751[_0x453a('0x4e')][_0x453a('0xaf')]['id']){_0x2d9189['id']=_0x263751['body']['interaction']['id'];return db[_0x453a('0xac')][_0x453a('0x4c')]({'where':_0x2d9189})[_0x453a('0x15')](function(_0xcb85e6){if(_0xcb85e6){return[_0xcb85e6,![]];}return db[_0x453a('0xac')][_0x453a('0x4d')](_0x3fd6)[_0x453a('0x15')](function(_0x8a868e){return[_0x8a868e,!![]];});});}return db[_0x453a('0xac')]['create'](_0x3fd6)[_0x453a('0x15')](function(_0x5bcad1){return[_0x5bcad1,!![]];});}})[_0x453a('0xb0')](function(_0x354211,_0x3a502a){if(_0x354211){_0x543f44=_0x3a502a;if(!_0x3a502a){var _0x396875={'from':(_0x29ef2a[_0x453a('0x9d')][_0x453a('0xa1')]||'')+'\x20'+(_0x29ef2a[_0x453a('0x9d')][_0x453a('0xb1')]||'')};if(_0x263751[_0x453a('0x4e')][_0x453a('0xab')]&&_0x263751[_0x453a('0x4e')][_0x453a('0xb2')]&&_0x263751[_0x453a('0x4e')][_0x453a('0xab')]!=_0x263751[_0x453a('0x4e')][_0x453a('0xb2')]){_0x396875['threadId']=_0x263751[_0x453a('0x4e')][_0x453a('0xb2')];}return _0x354211[_0x453a('0x28')](_0x396875);}else{return _0x354211;}}})[_0x453a('0x15')](function(_0x429cef){_0x29ef2a[_0x453a('0xaf')]=_0x429cef[_0x453a('0x50')]({'plain':!![]});_0x29ef2a[_0x453a('0xaf')][_0x453a('0xb3')]=_0x543f44;if(_0x29ef2a[_0x453a('0xaf')][_0x453a('0xb3')]){if(_0x29ef2a[_0x453a('0x9b')][_0x453a('0xb4')]){_0x29ef2a['applications'][_0x453a('0xb5')]({'id':0x0,'priority':_0x29ef2a['applications'][_0x453a('0x3e')]+0x1,'app':_0x453a('0xb6'),'appdata':_0x453a('0xb7'),'interval':_0x453a('0xb8')});}}return db[_0x453a('0xb9')][_0x453a('0x4d')]({'body':_0x263751[_0x453a('0x4e')]['body'],'ChatWebsiteId':_0x263751['params']['id'],'ChatInteractionId':_0x429cef['id'],'direction':'in','ContactId':_0x29ef2a[_0x453a('0x9d')]['id'],'AttachmentId':_0x263751[_0x453a('0x4e')]['AttachmentId']});})[_0x453a('0x15')](function(_0x566255){_0x29ef2a[_0x453a('0x1c')]=_0x566255;if(_0x29ef2a[_0x453a('0xaf')][_0x453a('0xba')]){return db[_0x453a('0xbb')][_0x453a('0x4c')]({'attributes':['id','name'],'where':{'id':_0x29ef2a[_0x453a('0xaf')][_0x453a('0xba')]}})['then'](function(_0x10b583){if(_0x10b583){_0x29ef2a[_0x453a('0x97')][_0x453a('0xbc')]({'id':0x0,'priority':0x0,'app':_0x453a('0xbd'),'appdata':_0x10b583[_0x453a('0x2d')]+','+(_0x29ef2a[_0x453a('0x9b')][_0x453a('0xbe')]||0xa),'interval':_0x453a('0xb8')});_0x29ef2a[_0x453a('0xbf')]=!![];}return respondWithRpcPromise(_0x453a('0xc0'),_0x453a('0xc1'),_0x29ef2a);});}return respondWithRpcPromise('Start',_0x453a('0xc1'),_0x29ef2a);})['then'](function(_0x2d1de4){respondWithRpcPromise(_0x453a('0xc2'),_0x453a('0xc2'),{'event':_0x453a('0xc3'),'message':_0x2d1de4},client9002);return _0x2d1de4;})['then'](respondWithResult(_0x25728d,null))[_0x453a('0x1f')](handleError(_0x25728d,null));};exports['offline']=function(_0xd7b74e,_0x60c0a8){var _0x2152fe,_0x1d7dc0,_0x27e805;var _0x5900cb=[];var _0x49425b={};var _0x503757=_0xd7b74e[_0x453a('0xc4')]||[];var _0x157db4=[];var _0x2960e6;return db[_0x453a('0x84')][_0x453a('0x57')]()['then'](function(_0x19754b){if(!_0x19754b){throw new db['Sequelize'][(_0x453a('0x86'))](_0x453a('0xc5'));}_0x5900cb=_['difference'](_[_0x453a('0x38')](_0x19754b),[_0x453a('0x87'),_0x453a('0x88'),'CompanyId','ListId']);if(_0xd7b74e['body']['id']){delete _0xd7b74e[_0x453a('0x4e')]['id'];}if(_[_0x453a('0x72')](_0xd7b74e['body']['from'])){throw _0x60c0a8[_0x453a('0x21')](0x1f4)['send'](new db[(_0x453a('0x85'))][(_0x453a('0x86'))](_0x453a('0x8c')));}if(_['isNil'](_0xd7b74e['body'][_0x453a('0x4e')])||_0xd7b74e[_0x453a('0x4e')][_0x453a('0x4e')]===''){throw _0x60c0a8[_0x453a('0x21')](0x1f4)[_0x453a('0x2e')](new db[(_0x453a('0x85'))][(_0x453a('0x86'))](_0x453a('0x8d')));}if(_[_0x453a('0x72')](_0xd7b74e[_0x453a('0x4e')]['mapKeyOffline'])){throw _0x60c0a8[_0x453a('0x21')](0x1f4)['send'](new db[(_0x453a('0x85'))]['ValidationError'](_0x453a('0xc6')+_0x5900cb));}if(!_[_0x453a('0xc7')](_0x5900cb,_0xd7b74e[_0x453a('0x4e')][_0x453a('0xc8')])){throw _0x60c0a8[_0x453a('0x21')](0x1f4)[_0x453a('0x2e')](new db[(_0x453a('0x85'))][(_0x453a('0x86'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5900cb));}_0x49425b[_0xd7b74e['body'][_0x453a('0xc8')]]=_0xd7b74e['body'][_0x453a('0x8b')];})[_0x453a('0x15')](function(){return db[_0x453a('0x32')][_0x453a('0x4c')]({'where':{'id':_0xd7b74e[_0x453a('0x4a')]['id']},'include':[{'model':db[_0x453a('0x91')],'as':'List'},{'model':db[_0x453a('0xc9')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x60c0a8,null))[_0x453a('0x15')](function(_0x2df5d4){if(_0x2df5d4&&_0x2df5d4[_0x453a('0x92')]){_0x1d7dc0=_0x2df5d4;var _0x26a8b9=_[_0x453a('0x9c')](_0xd7b74e['body'],{'firstName':_0xd7b74e[_0x453a('0x4e')]['from'],'phone':_0xd7b74e[_0x453a('0x4e')][_0x453a('0x8b')],'ListId':_0x2df5d4[_0x453a('0x8a')]});_0x26a8b9[_0xd7b74e['body'][_0x453a('0xc8')]]=_0xd7b74e['body'][_0x453a('0x8b')];return db[_0x453a('0x84')][_0x453a('0xca')]({'where':_0x49425b,'defaults':_0x26a8b9});}})['spread'](function(_0x1f3f16){if(_0x1f3f16){_0x27e805=_0x1f3f16;var _0x3db39b=fs[_0x453a('0xcb')](path[_0x453a('0x75')](config[_0x453a('0x77')],_0x453a('0xcc')),_0x453a('0xcd'));var _0x111d87=ejs[_0x453a('0xce')](_0x3db39b,{'body':_['toPairs'](_0xd7b74e['body'][_0x453a('0x4e')]),'bodyTitle':_0x1d7dc0['offlineMessageBody']});return db[_0x453a('0xcf')][_0x453a('0x4d')]({'body':_0x111d87,'plainBody':htmlToText[_0x453a('0xd0')](_0x111d87),'ContactId':_0x1f3f16['id'],'ChatWebsiteId':_0x1d7dc0['id']});}})[_0x453a('0x15')](function(_0x39ca46){_0x2960e6=_0x39ca46;if(_0x503757[_0x453a('0x3e')]){var _0x45aaf8=_0x503757['map'](function(_0x5d000a){return{'name':_0x5d000a[_0x453a('0xd1')],'basename':_0x5d000a[_0x453a('0x68')],'type':_0x5d000a[_0x453a('0xd2')],'ChatOfflineMessageId':_0x39ca46['id']};});_0x157db4=_0x45aaf8[_0x453a('0x44')](_0x1a0ae0=>{var _0xc79bf1={'filename':_0x1a0ae0['name'],'path':path[_0x453a('0x75')](config[_0x453a('0x77')],_0x453a('0xd3'),_0x453a('0xc4'),'attachments','offline-chat',_0x1a0ae0[_0x453a('0xd4')])};return _0xc79bf1;});if(!_0x1d7dc0[_0x453a('0xd5')]){return db[_0x453a('0xd6')]['transaction'](function(_0x17c124){return db[_0x453a('0xd7')][_0x453a('0xd8')](_0x45aaf8,{'transaction':_0x17c124});});}}})[_0x453a('0x15')](function(){if(_0x2960e6){_0x2152fe=_0x2960e6;return db[_0x453a('0xc9')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x453a('0xd9')],'as':_0x453a('0xda'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x453a('0xdb'),'raw':!![]}]}]});}})[_0x453a('0x15')](function(_0x3e435a){if(_0x3e435a&&_0x3e435a['Smtp']&&_0x1d7dc0[_0x453a('0xdc')]&&_0x1d7dc0[_0x453a('0xdd')]){var _0xa7e127=_0x3e435a[_0x453a('0xde')]();return respondWithRpcPromise(_0x453a('0xdf'),_0x453a('0xe0'),{'account':_0xa7e127,'message':{'from':util[_0x453a('0xa7')](_0x453a('0xe1'),_0x3e435a[_0x453a('0x2d')],_0x3e435a[_0x453a('0xe2')]||_0x3e435a['Smtp'][_0x453a('0x4f')]),'to':_0x1d7dc0[_0x453a('0xdd')],'subject':_0x1d7dc0[_0x453a('0xe3')],'html':_0x2152fe['body'],'attachments':_0x157db4}},client9003)[_0x453a('0x15')](function(){return _0x2152fe;})[_0x453a('0x1f')](function(_0x5ca414){logger[_0x453a('0x1b')](_0x5ca414);});}})[_0x453a('0x15')](function(){if(_0x1d7dc0&&_0x1d7dc0[_0x453a('0xd5')]&&_0x1d7dc0['MailAccountId']){var _0x199d28=[];if(_0x503757[_0x453a('0x3e')]){_0x199d28=_0x503757[_0x453a('0x44')](function(_0x121c1e){return{'name':_0x121c1e[_0x453a('0xd1')],'basename':_0x121c1e[_0x453a('0x68')],'type':_0x121c1e[_0x453a('0xd2')],'ChatOfflineMessageId':_0x2960e6['id']};});}var _0x470065;if(!_[_0x453a('0x72')](_0x1d7dc0[_0x453a('0xe4')])){var _0x3507db=_[_0x453a('0x44')](_0xd7b74e[_0x453a('0x4e')],function(_0x1c176d){return _0x1c176d;});var _0x116c37=_[_0x453a('0xe5')](_0x3507db)[0x0];var _0x32458d=_[_0x453a('0xe6')](_0x116c37,function(_0xefb33e){return _0xefb33e;});_0x470065=_0x32458d[0x1][_0x1d7dc0[_0x453a('0xe4')]];}var _0xb9b44c={'from':_0x27e805[_0x453a('0xe2')],'firstName':_0x27e805[_0x453a('0xa1')],'lastName':_0x27e805['lastName'],'mapKey':'email','message':{'from':_0x27e805[_0x453a('0xe2')],'to':_0x1d7dc0['MailAccount'][_0x453a('0xe2')],'cc':'','subject':_[_0x453a('0x72')](_0x470065)?_0x1d7dc0['offlineMessageSubject']:_0x470065,'messageId':'','sentAt':new Date(),'attach':_0x199d28[_0x453a('0x3e')],'attachments':_0x199d28,'originChannel':_0x453a('0xe7'),'ChatWebsiteId':_0x1d7dc0['id'],'ChatOfflineMessageId':_0x2152fe['id'],'originTo':_0x1d7dc0[_0x453a('0xc9')]['email']},'body':_0x2152fe[_0x453a('0x4e')]};var _0xf26067={'account':{'id':_0x1d7dc0[_0x453a('0xe8')]},'body':_0xb9b44c,'log':_0x453a('0xe9')};return respondWithRpcPromise(_0x453a('0xe9'),_0x453a('0xea'),_0xf26067,client9001)[_0x453a('0x15')](function(){return _0x2152fe;})['catch'](function(_0x412566){logger[_0x453a('0x1b')](_0x412566);});}return;})[_0x453a('0x15')](function(){if(_0x2152fe){return _0x2152fe;}})[_0x453a('0x15')](respondWithResult(_0x60c0a8,null))[_0x453a('0x1f')](function(_0x40a2b3){logger[_0x453a('0x1b')](_0x453a('0x1f'),_0x40a2b3);for(var _0xb30d92 of _0x503757){var _0x4b8b18=path['join'](config['root'],_0x453a('0xd3'),_0x453a('0xc4'),'attachments',_0x453a('0xeb'),_0xb30d92[_0x453a('0x68')]);fs_extra[_0x453a('0xec')](_0x4b8b18)[_0x453a('0x1f')](function(_0x135e5c){logger[_0x453a('0x1b')](_0x453a('0xed'),_0x4b8b18,_0x135e5c);});}});};exports[_0x453a('0xee')]=function(_0x381112,_0x45138f){return db[_0x453a('0xac')]['find']({'where':{'id':_0x381112[_0x453a('0x4a')]['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x45138f,null))[_0x453a('0x15')](function(_0x2ccec2){if(_0x2ccec2){return _0x2ccec2[_0x453a('0xee')](_0x381112[_0x453a('0x4e')][_0x453a('0x62')],_[_0x453a('0xef')](_0x381112['body'],[_0x453a('0x62'),'id'])||{});}})[_0x453a('0x15')](respondWithResult(_0x45138f,null))['catch'](handleError(_0x45138f,null));};exports[_0x453a('0xf0')]=function(_0x291e4b,_0x38d114){var _0x440789={'raw':![],'where':{}};var _0x253c07={};var _0x5ed466={'count':0x0,'rows':[]};return db[_0x453a('0x32')][_0x453a('0x5a')]({'where':{'id':_0x291e4b[_0x453a('0x4a')]['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x38d114,null))[_0x453a('0x15')](function(_0x41c4f7){if(_0x41c4f7){_0x253c07[_0x453a('0x37')]=_[_0x453a('0x38')](db[_0x453a('0xac')][_0x453a('0x33')]);_0x253c07[_0x453a('0x39')]=_[_0x453a('0x38')](_0x291e4b[_0x453a('0x39')]);_0x253c07['filters']=_[_0x453a('0x3b')](_0x253c07[_0x453a('0x37')],_0x253c07[_0x453a('0x39')]);_0x440789['attributes']=_[_0x453a('0x3b')](_0x253c07[_0x453a('0x37')],qs['fields'](_0x291e4b['query'][_0x453a('0x3d')]));_0x440789[_0x453a('0x3c')]=_0x440789[_0x453a('0x3c')][_0x453a('0x3e')]?_0x440789[_0x453a('0x3c')]:_0x253c07[_0x453a('0x37')];if(!_0x291e4b[_0x453a('0x39')][_0x453a('0x3f')]('nolimit')){_0x440789[_0x453a('0x24')]=qs['limit'](_0x291e4b['query']['limit']);_0x440789[_0x453a('0x22')]=qs['offset'](_0x291e4b[_0x453a('0x39')][_0x453a('0x22')]);}_0x440789[_0x453a('0x40')]=qs[_0x453a('0x41')](_0x291e4b['query'][_0x453a('0x41')]);_0x440789[_0x453a('0x42')]=qs['filters'](_['pick'](_0x291e4b[_0x453a('0x39')],_0x253c07[_0x453a('0x3a')]));_0x440789[_0x453a('0x42')][_0x453a('0x5e')]=_0x41c4f7['id'];if(_0x291e4b[_0x453a('0x39')][_0x453a('0x5f')]){_0x440789[_0x453a('0x42')]=_[_0x453a('0x43')](_0x440789[_0x453a('0x42')],{'$or':_[_0x453a('0x44')](_0x440789[_0x453a('0x3c')],function(_0x2b2137){var _0x5e4afc={};_0x5e4afc[_0x2b2137]={'$like':'%'+_0x291e4b['query'][_0x453a('0x5f')]+'%'};return _0x5e4afc;})});}_0x440789=_[_0x453a('0x43')]({},_0x440789,_0x291e4b[_0x453a('0x4b')]);return db[_0x453a('0xac')]['count']({'where':_0x440789[_0x453a('0x42')]})['then'](function(_0x4ebf88){_0x5ed466[_0x453a('0x25')]=_0x4ebf88;if(_0x291e4b[_0x453a('0x39')][_0x453a('0x46')]){_0x440789[_0x453a('0x47')]=[{'model':db[_0x453a('0x84')],'as':'Contact','required':![]},{'model':db[_0x453a('0xbb')],'as':_0x453a('0xf1'),'attributes':[_0x453a('0x2d'),_0x453a('0xf2'),_0x453a('0xf3')],'required':![]},{'model':db[_0x453a('0xf4')],'as':_0x453a('0xf5'),'attributes':['id','name',_0x453a('0xf6')],'where':_0x291e4b[_0x453a('0x39')]['tag']?{'id':_0x291e4b[_0x453a('0x39')]['tag']}:undefined,'required':_0x291e4b[_0x453a('0x39')][_0x453a('0xf7')]?!![]:![]}];}return db[_0x453a('0xac')]['findAll'](_0x440789);})[_0x453a('0x15')](function(_0x3656ef){_0x5ed466[_0x453a('0x60')]=_0x3656ef;return _0x5ed466;});}})[_0x453a('0x15')](respondWithFilteredResult(_0x38d114,_0x440789))[_0x453a('0x1f')](handleError(_0x38d114,null));};function iftimePromise(_0x54dd36,_0x1ff128){return respondWithRpcPromise(_0x453a('0xf8'),_0x453a('0xf9'),{'command':_0x1ff128[_0x453a('0xfa')]?util[_0x453a('0xa7')]('iftime\x20%s,%s',_0x54dd36['interval'],_0x1ff128[_0x453a('0xfa')]):util['format'](_0x453a('0xfb'),_0x54dd36[_0x453a('0xfc')])},client9002)[_0x453a('0x15')](function(_0x5bf365){var _0x235aa4=_0x5bf365&&_0x5bf365[_0x453a('0xfd')]('true')>=0x0?!![]:![];logger[_0x453a('0x1d')](_0x453a('0xfe'),_0x1ff128['id'],_0x54dd36['id'],_0x54dd36[_0x453a('0xfc')],_0x235aa4?'ONLINE':_0x453a('0xff'),_0x1ff128['timezone']?_0x1ff128[_0x453a('0xfa')]:'No\x20timezone');return _0x235aa4;})[_0x453a('0x1f')](function(_0x1e336f){logger[_0x453a('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1ff128['id'],_0x54dd36['id'],_0x54dd36[_0x453a('0xfc')],util[_0x453a('0x100')](_0x1e336f,{'showHidden':![],'depth':null}),_0x1ff128[_0x453a('0xfa')]?_0x1ff128[_0x453a('0xfa')]:_0x453a('0x101'));return![];});}exports['getSnippet']=function(_0x28301d,_0x3b6b19){var _0x44352c=0x0;var _0x56f3e8=0x0;var _0x51c95a=![];var _0x21ace3;var _0x2ac643;return db[_0x453a('0x32')][_0x453a('0x4c')]({'where':{'id':_0x28301d[_0x453a('0x4a')]['id']},'include':[{'model':db[_0x453a('0x102')],'as':'Interval','include':[{'model':db[_0x453a('0x102')],'as':_0x453a('0x103'),'attributes':['id',_0x453a('0xfc')],'raw':!![]}]}]})[_0x453a('0x15')](handleEntityNotFound(_0x3b6b19,null))[_0x453a('0x15')](function(_0x526ca0){if(_0x526ca0){_0x21ace3=_0x526ca0;return _0x526ca0['getProactiveActions']({'raw':!![]});}})[_0x453a('0x15')](function(_0x34b1a7){if(_0x21ace3){if(_0x34b1a7){_0x2ac643=_0x34b1a7;}}return require(_0x453a('0x6f'))[_0x453a('0x70')]();})[_0x453a('0x15')](function(_0x307bf2){if(_0x307bf2){_0x56f3e8=_0x307bf2[_0x453a('0x104')];_0x51c95a=_0x307bf2[_0x453a('0x71')];}})['then'](function(){return db[_0x453a('0xac')]['count']({'where':{'closed':![]}});})[_0x453a('0x15')](function(_0x3484b4){_0x44352c=_0x3484b4;if(_0x56f3e8&&_0x3484b4>_0x56f3e8){return db[_0x453a('0x105')][_0x453a('0x5a')]({'where':{'id':0x1}})[_0x453a('0x15')](function(_0x41e25c){if(_0x41e25c){_0x41e25c[_0x453a('0x106')](_0x453a('0x107'));}});}})[_0x453a('0x15')](function(){if(_0x21ace3['Interval']&&_0x21ace3['Interval'][_0x453a('0x103')]){var _0x5d58d3=[];for(var _0x2231c2=0x0;_0x2231c2<_0x21ace3[_0x453a('0x102')][_0x453a('0x103')]['length'];_0x2231c2++){var _0x216e19=_0x21ace3[_0x453a('0x102')][_0x453a('0x103')][_0x2231c2]['get']({'plain':!![]});_0x5d58d3['push'](iftimePromise(_0x216e19,_0x21ace3));}return BPromise[_0x453a('0x108')](_0x5d58d3)[_0x453a('0x15')](function(_0x573944){return _[_0x453a('0x109')](_0x573944);});}else{return!![];}})[_0x453a('0x15')](function(_0x58d099){var _0xfef048=fs[_0x453a('0xcb')](path['join'](config[_0x453a('0x77')],_0x453a('0x10a')),_0x453a('0xcd'));var _0x2417ee=new url[(_0x453a('0x10b'))](_0x21ace3[_0x453a('0x10c')])[_0x453a('0x10d')];var _0x4cc71d=_0x453a('0x10e');var _0x4de4ee=![];var _0x1c4aae={'chatVersion':_0x4cc71d,'chatWebsiteAddressOrigin':_0x2417ee,'remote':_0x21ace3[_0x453a('0x10f')],'query':querystring[_0x453a('0x19')](_[_0x453a('0x43')](_0x21ace3[_0x453a('0x50')]({'plain':!![]}),{'customerIp':_0x28301d[_0x453a('0x81')][_0x453a('0x9f')]||_0x28301d[_0x453a('0x81')][_0x453a('0x110')]||_0x28301d[_0x453a('0x111')][_0x453a('0x112')]||_0x28301d['ip'],'referer':_0x28301d[_0x453a('0x81')]['referer'],'openedInteractions':_0x44352c,'maxInteractions':_0x56f3e8,'virtual':_0x51c95a[_0x453a('0x104')],'online':_0x58d099,'custom':_0x51c95a}))[_0x453a('0x113')](/'/g,'\x5c\x27')};_0x3b6b19[_0x453a('0x2e')](ejs['render'](Mustache[_0x453a('0xce')](_0xfef048,_0x1c4aae),{'proactiveActions':_0x2ac643,'alignment':_0x21ace3[_0x453a('0x114')],'verticalAlignment':_0x21ace3[_0x453a('0x115')],'div_color':_0x21ace3[_0x453a('0xf6')],'labelText':_0x21ace3[_0x453a('0x116')],'text_color':_0x21ace3[_0x453a('0x117')],'text_button_color':_0x21ace3[_0x453a('0x118')],'button_color':_0x21ace3[_0x453a('0x119')],'background_color':_0x21ace3[_0x453a('0x11a')],'hideWhenOffline':_0x21ace3['hideWhenOffline'],'intervalId':_0x21ace3['IntervalId'],'isDevelopment':_0x4de4ee,'chatVersion':_0x4cc71d}));})[_0x453a('0x1f')](handleError(_0x3b6b19,null));};exports[_0x453a('0x11b')]=function(_0x47d2ea,_0x3fd330){var _0x30ad99=_0x47d2ea['params']['id'];var _0x453e6c=_0x47d2ea[_0x453a('0x4e')];var _0xc8c833=0xc8;var _0x56c4b3=null;return db[_0x453a('0xd6')]['transaction']({'isolationLevel':db['sequelize'][_0x453a('0x11c')][_0x453a('0x11d')][_0x453a('0x11e')]},function(_0x242e12){return db[_0x453a('0x32')]['findOne']({'where':{'id':_0x30ad99},'transaction':_0x242e12})['then'](function(_0x2d61a5){if(_0x2d61a5){return db[_0x453a('0x95')][_0x453a('0x29')]({'where':{'ChatWebsiteId':_0x30ad99},'transaction':_0x242e12})[_0x453a('0x15')](function(){var _0x713f12=_[_0x453a('0x44')](_0x453e6c,function(_0x2e6dd5){_0x2e6dd5[_0x453a('0x5e')]=_0x30ad99;return _0x2e6dd5;});return db[_0x453a('0x95')][_0x453a('0xd8')](_0x713f12,{'transaction':_0x242e12});});}else{_0xc8c833=0x194;_0x56c4b3=[];}});})[_0x453a('0x15')](function(){if(_0xc8c833!==0x194){return db[_0x453a('0x95')][_0x453a('0x11f')]({'where':{'ChatWebsiteId':_0x30ad99},'order':_0x453a('0x99')})[_0x453a('0x15')](function(_0x4ac145){_0x56c4b3=_0x4ac145;});}})[_0x453a('0x1f')](function(_0x433dd8){_0xc8c833=0x1f4;logger[_0x453a('0x1b')](_0x433dd8[_0x453a('0x120')]);if(_0x433dd8[_0x453a('0x2d')]){delete _0x433dd8[_0x453a('0x2d')];}_0x56c4b3=_0x433dd8;})[_0x453a('0x121')](function(){if(_0x56c4b3===null){_0x3fd330[_0x453a('0x20')](_0xc8c833);}else{if(_0xc8c833===0x1f4){_0x3fd330[_0x453a('0x21')](_0xc8c833)[_0x453a('0x2e')](_0x56c4b3);}else{_0x3fd330[_0x453a('0x21')](_0xc8c833)['json'](_0x56c4b3);}}});};exports['getApplications']=function(_0x2cf1cb,_0x15a9fb){var _0x1f0cc0={};var _0x82ab8b={};var _0x17f1ff;var _0x577d55;return db[_0x453a('0x32')][_0x453a('0x5a')]({'where':{'id':_0x2cf1cb[_0x453a('0x4a')]['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x15a9fb,null))['then'](function(_0x26e9dc){if(_0x26e9dc){_0x17f1ff=_0x26e9dc;_0x82ab8b['model']=_['keys'](db[_0x453a('0x95')]['rawAttributes']);_0x82ab8b[_0x453a('0x39')]=_[_0x453a('0x38')](_0x2cf1cb[_0x453a('0x39')]);_0x82ab8b[_0x453a('0x3a')]=_[_0x453a('0x3b')](_0x82ab8b[_0x453a('0x37')],_0x82ab8b['query']);_0x1f0cc0['attributes']=_[_0x453a('0x3b')](_0x82ab8b[_0x453a('0x37')],qs[_0x453a('0x3d')](_0x2cf1cb[_0x453a('0x39')][_0x453a('0x3d')]));_0x1f0cc0[_0x453a('0x3c')]=_0x1f0cc0[_0x453a('0x3c')][_0x453a('0x3e')]?_0x1f0cc0['attributes']:_0x82ab8b[_0x453a('0x37')];_0x1f0cc0[_0x453a('0x40')]=qs[_0x453a('0x41')](_0x2cf1cb[_0x453a('0x39')]['sort']);_0x1f0cc0[_0x453a('0x42')]=qs[_0x453a('0x3a')](_[_0x453a('0x5d')](_0x2cf1cb['query'],_0x82ab8b[_0x453a('0x3a')]));if(_0x2cf1cb[_0x453a('0x39')]['filter']){_0x1f0cc0['where']=_[_0x453a('0x43')](_0x1f0cc0[_0x453a('0x42')],{'$or':_['map'](_0x1f0cc0[_0x453a('0x3c')],function(_0x485128){var _0x1d3541={};_0x1d3541[_0x485128]={'$like':'%'+_0x2cf1cb[_0x453a('0x39')][_0x453a('0x5f')]+'%'};return _0x1d3541;})});}_0x1f0cc0=_[_0x453a('0x43')]({},_0x1f0cc0,_0x2cf1cb[_0x453a('0x4b')]);return _0x17f1ff[_0x453a('0x122')](_0x1f0cc0);}})['then'](function(_0x2b6dc5){if(_0x2b6dc5){_0x577d55=_0x2b6dc5['length'];if(!_0x2cf1cb['query'][_0x453a('0x3f')](_0x453a('0x5c'))){_0x1f0cc0['limit']=qs['limit'](_0x2cf1cb[_0x453a('0x39')][_0x453a('0x24')]);_0x1f0cc0[_0x453a('0x22')]=qs['offset'](_0x2cf1cb['query'][_0x453a('0x22')]);}return _0x17f1ff[_0x453a('0x122')](_0x1f0cc0);}})[_0x453a('0x15')](function(_0x4055a4){if(_0x4055a4){return _0x4055a4?{'count':_0x577d55,'rows':_0x4055a4}:null;}})['then'](respondWithResult(_0x15a9fb,null))[_0x453a('0x1f')](handleError(_0x15a9fb,null));};exports[_0x453a('0x123')]=function(_0x3fae40,_0x330412){return db['chatProactiveAction'][_0x453a('0x4c')]({'where':{'id':_0x3fae40['params']['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x330412,null))[_0x453a('0x15')](function(_0x7009a4){if(_0x7009a4){return _0x7009a4[_0x453a('0x123')](_0x3fae40[_0x453a('0x4e')][_0x453a('0x62')],_[_0x453a('0xef')](_0x3fae40['body'],[_0x453a('0x62'),'id'])||{});}})[_0x453a('0x15')](respondWithResult(_0x330412,null))[_0x453a('0x1f')](handleError(_0x330412,null));};exports[_0x453a('0x124')]=function(_0x1a1a38,_0x55caca){var _0x4cd115={};var _0x20f951={};var _0xbc6bea;var _0x13481f;return db[_0x453a('0x32')][_0x453a('0x5a')]({'where':{'id':_0x1a1a38[_0x453a('0x4a')]['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x55caca,null))[_0x453a('0x15')](function(_0x3f90b3){if(_0x3f90b3){_0xbc6bea=_0x3f90b3;_0x20f951[_0x453a('0x37')]=_[_0x453a('0x38')](db[_0x453a('0x125')][_0x453a('0x33')]);_0x20f951[_0x453a('0x39')]=_[_0x453a('0x38')](_0x1a1a38[_0x453a('0x39')]);_0x20f951[_0x453a('0x3a')]=_[_0x453a('0x3b')](_0x20f951['model'],_0x20f951[_0x453a('0x39')]);_0x4cd115['attributes']=_[_0x453a('0x3b')](_0x20f951[_0x453a('0x37')],qs[_0x453a('0x3d')](_0x1a1a38[_0x453a('0x39')][_0x453a('0x3d')]));_0x4cd115[_0x453a('0x3c')]=_0x4cd115[_0x453a('0x3c')][_0x453a('0x3e')]?_0x4cd115[_0x453a('0x3c')]:_0x20f951[_0x453a('0x37')];_0x4cd115['order']=qs[_0x453a('0x41')](_0x1a1a38[_0x453a('0x39')]['sort']);_0x4cd115[_0x453a('0x42')]=qs[_0x453a('0x3a')](_[_0x453a('0x5d')](_0x1a1a38[_0x453a('0x39')],_0x20f951[_0x453a('0x3a')]));if(_0x1a1a38[_0x453a('0x39')][_0x453a('0x5f')]){_0x4cd115[_0x453a('0x42')]=_[_0x453a('0x43')](_0x4cd115[_0x453a('0x42')],{'$or':_[_0x453a('0x44')](_0x4cd115[_0x453a('0x3c')],function(_0xb9583e){var _0x51ec83={};_0x51ec83[_0xb9583e]={'$like':'%'+_0x1a1a38['query']['filter']+'%'};return _0x51ec83;})});}_0x4cd115=_[_0x453a('0x43')]({},_0x4cd115,_0x1a1a38[_0x453a('0x4b')]);return _0xbc6bea['getProactiveActions'](_0x4cd115);}})[_0x453a('0x15')](function(_0x4e9528){if(_0x4e9528){_0x13481f=_0x4e9528[_0x453a('0x3e')];if(!_0x1a1a38[_0x453a('0x39')][_0x453a('0x3f')](_0x453a('0x5c'))){_0x4cd115[_0x453a('0x24')]=qs[_0x453a('0x24')](_0x1a1a38[_0x453a('0x39')]['limit']);_0x4cd115['offset']=qs['offset'](_0x1a1a38[_0x453a('0x39')][_0x453a('0x22')]);}return _0xbc6bea[_0x453a('0x124')](_0x4cd115);}})[_0x453a('0x15')](function(_0xa154b0){if(_0xa154b0){return _0xa154b0?{'count':_0x13481f,'rows':_0xa154b0}:null;}})[_0x453a('0x15')](respondWithResult(_0x55caca,null))[_0x453a('0x1f')](handleError(_0x55caca,null));};exports['getFields']=function(_0x19bbb1,_0x39ae2e){var _0x6eee22=_0x19bbb1[_0x453a('0x39')]['online']===_0x453a('0x126')?_0x453a('0x127'):_0x453a('0x128');return db[_0x453a('0x32')][_0x453a('0x4c')]({'attributes':['id',_0x6eee22],'where':{'id':_0x19bbb1[_0x453a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39ae2e,null))[_0x453a('0x15')](function(_0x3546e2){if(_0x3546e2){var _0x5e0ffc=_0x3546e2[_0x6eee22];var _0x1a5024=_0x5e0ffc&&_0x5e0ffc[_0x453a('0x129')]?_0x5e0ffc[_0x453a('0x129')]:[];_0x39ae2e[_0x453a('0x2e')]({'fromKey':_[_0x453a('0x72')](_0x5e0ffc['fromKey'])?undefined:_0x5e0ffc[_0x453a('0x12a')],'count':_0x1a5024[_0x453a('0x3e')],'rows':_0x1a5024});}})['catch'](handleError(_0x39ae2e,null));};exports[_0x453a('0x12b')]=function(_0x1117fc,_0x29c4f3){var _0x38a199={'raw':![],'where':{}};var _0x37629c={};var _0x1739c1={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1117fc[_0x453a('0x4a')]['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x29c4f3,null))['then'](function(_0x466bb7){if(_0x466bb7){_0x37629c['model']=_[_0x453a('0x38')](db[_0x453a('0xcf')][_0x453a('0x33')]);_0x37629c[_0x453a('0x39')]=_[_0x453a('0x38')](_0x1117fc['query']);_0x37629c[_0x453a('0x3a')]=_['intersection'](_0x37629c[_0x453a('0x37')],_0x37629c[_0x453a('0x39')]);_0x38a199[_0x453a('0x3c')]=_[_0x453a('0x3b')](_0x37629c[_0x453a('0x37')],qs[_0x453a('0x3d')](_0x1117fc[_0x453a('0x39')][_0x453a('0x3d')]));_0x38a199[_0x453a('0x3c')]=_0x38a199[_0x453a('0x3c')][_0x453a('0x3e')]?_0x38a199['attributes']:_0x37629c[_0x453a('0x37')];if(!_0x1117fc[_0x453a('0x39')]['hasOwnProperty'](_0x453a('0x5c'))){_0x38a199[_0x453a('0x24')]=qs['limit'](_0x1117fc[_0x453a('0x39')][_0x453a('0x24')]);_0x38a199['offset']=qs[_0x453a('0x22')](_0x1117fc[_0x453a('0x39')][_0x453a('0x22')]);}_0x38a199['order']=qs[_0x453a('0x41')](_0x1117fc[_0x453a('0x39')][_0x453a('0x41')]);_0x38a199[_0x453a('0x42')]=qs[_0x453a('0x3a')](_[_0x453a('0x5d')](_0x1117fc[_0x453a('0x39')],_0x37629c['filters']));_0x38a199[_0x453a('0x42')][_0x453a('0x5e')]=_0x466bb7['id'];if(_0x1117fc[_0x453a('0x39')][_0x453a('0x5f')]){_0x38a199[_0x453a('0x42')]=_[_0x453a('0x43')](_0x38a199['where'],{'$or':_[_0x453a('0x44')](_0x38a199[_0x453a('0x3c')],function(_0x1f4a6e){var _0x216645={};_0x216645[_0x1f4a6e]={'$like':'%'+_0x1117fc['query']['filter']+'%'};return _0x216645;})});}_0x38a199=_['merge']({},_0x38a199,_0x1117fc[_0x453a('0x4b')]);return db[_0x453a('0xcf')]['count']({'where':_0x38a199['where']})[_0x453a('0x15')](function(_0x46b79e){_0x1739c1[_0x453a('0x25')]=_0x46b79e;if(_0x1117fc[_0x453a('0x39')][_0x453a('0x46')]){_0x38a199[_0x453a('0x47')]=[{'all':!![]}];}else{_0x38a199[_0x453a('0x47')]=[{'model':db['CmContact'],'as':_0x453a('0x12c'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x453a('0x48')](_0x38a199);})[_0x453a('0x15')](function(_0xdc43f5){_0x1739c1[_0x453a('0x60')]=_0xdc43f5;return _0x1739c1;});}})[_0x453a('0x15')](respondWithFilteredResult(_0x29c4f3,_0x38a199))[_0x453a('0x1f')](handleError(_0x29c4f3,null));};exports[_0x453a('0x12d')]=function(_0x5c37e7,_0x5c2898){return db[_0x453a('0x32')][_0x453a('0x4c')]({'where':{'id':_0x5c37e7['params']['id']}})[_0x453a('0x15')](handleEntityNotFound(_0x5c2898,null))[_0x453a('0x15')](function(_0x16568e){if(_0x16568e){return _0x16568e[_0x453a('0x12d')](_0x5c37e7[_0x453a('0x4e')][_0x453a('0x62')],_[_0x453a('0xef')](_0x5c37e7['body'],['ids','id'])||{})[_0x453a('0xb0')](function(_0x2a7978){for(var _0x1198d5=0x0;_0x1198d5<_0x5c37e7[_0x453a('0x4e')][_0x453a('0x62')][_0x453a('0x3e')];_0x1198d5+=0x1){socket[_0x453a('0x12e')](_0x453a('0x12f'),{'UserId':Number(_0x5c37e7[_0x453a('0x4e')]['ids'][_0x1198d5]),'ChatWebsiteId':Number(_0x5c37e7['params']['id'])});}return _0x2a7978;});}})['then'](respondWithResult(_0x5c2898,null))[_0x453a('0x1f')](handleError(_0x5c2898,null));};exports[_0x453a('0x130')]=function(_0xa75ca5,_0x51949a){return db[_0x453a('0x32')]['find']({'where':{'id':_0xa75ca5[_0x453a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51949a,null))[_0x453a('0x15')](function(_0x4ce464){if(_0x4ce464){return _0x4ce464[_0x453a('0x130')](_0xa75ca5['query'][_0x453a('0x62')])[_0x453a('0x15')](function(){if(_['isArray'](_0xa75ca5['query'][_0x453a('0x62')])){for(var _0x1a275d=0x0;_0x1a275d<_0xa75ca5['query'][_0x453a('0x62')][_0x453a('0x3e')];_0x1a275d+=0x1){socket['emit'](_0x453a('0x131'),{'UserId':Number(_0xa75ca5['query']['ids'][_0x1a275d]),'ChatWebsiteId':Number(_0xa75ca5[_0x453a('0x4a')]['id'])});}}else{socket[_0x453a('0x12e')](_0x453a('0x131'),{'UserId':Number(_0xa75ca5[_0x453a('0x39')]['ids']),'ChatWebsiteId':Number(_0xa75ca5[_0x453a('0x4a')]['id'])});}});}})[_0x453a('0x15')](respondWithStatusCode(_0x51949a,null))[_0x453a('0x1f')](handleError(_0x51949a,null));};exports[_0x453a('0x132')]=function(_0x96dccb,_0xd5af15){var _0x151997={};var _0x1f58bf={};var _0xbe29d2;var _0x1606cf;return db[_0x453a('0x32')][_0x453a('0x5a')]({'where':{'id':_0x96dccb['params']['id']}})[_0x453a('0x15')](handleEntityNotFound(_0xd5af15,null))[_0x453a('0x15')](function(_0x37fb68){if(_0x37fb68){_0xbe29d2=_0x37fb68;_0x1f58bf['model']=_[_0x453a('0x38')](db[_0x453a('0xbb')][_0x453a('0x33')]);_0x1f58bf[_0x453a('0x39')]=_['keys'](_0x96dccb['query']);_0x1f58bf[_0x453a('0x3a')]=_[_0x453a('0x3b')](_0x1f58bf[_0x453a('0x37')],_0x1f58bf['query']);_0x151997[_0x453a('0x3c')]=_['intersection'](_0x1f58bf['model'],qs[_0x453a('0x3d')](_0x96dccb[_0x453a('0x39')][_0x453a('0x3d')]));_0x151997['attributes']=_0x151997[_0x453a('0x3c')][_0x453a('0x3e')]?_0x151997[_0x453a('0x3c')]:_0x1f58bf[_0x453a('0x37')];_0x151997[_0x453a('0x40')]=qs[_0x453a('0x41')](_0x96dccb[_0x453a('0x39')][_0x453a('0x41')]);_0x151997['where']=qs[_0x453a('0x3a')](_['pick'](_0x96dccb['query'],_0x1f58bf[_0x453a('0x3a')]));if(_0x96dccb[_0x453a('0x39')][_0x453a('0x5f')]){_0x151997[_0x453a('0x42')]=_['merge'](_0x151997[_0x453a('0x42')],{'$or':_[_0x453a('0x44')](_0x151997[_0x453a('0x3c')],function(_0xbf11ef){var _0x5b029f={};_0x5b029f[_0xbf11ef]={'$like':'%'+_0x96dccb[_0x453a('0x39')]['filter']+'%'};return _0x5b029f;})});}_0x151997=_['merge']({},_0x151997,_0x96dccb[_0x453a('0x4b')]);return _0xbe29d2[_0x453a('0x132')](_0x151997);}})[_0x453a('0x15')](function(_0x45e79a){if(_0x45e79a){_0x1606cf=_0x45e79a[_0x453a('0x3e')];if(!_0x96dccb[_0x453a('0x39')][_0x453a('0x3f')](_0x453a('0x5c'))){_0x151997[_0x453a('0x24')]=qs[_0x453a('0x24')](_0x96dccb[_0x453a('0x39')]['limit']);_0x151997['offset']=qs[_0x453a('0x22')](_0x96dccb[_0x453a('0x39')][_0x453a('0x22')]);}return _0xbe29d2[_0x453a('0x132')](_0x151997);}})[_0x453a('0x15')](function(_0x537878){if(_0x537878){return _0x537878?{'count':_0x1606cf,'rows':_0x537878}:null;}})['then'](respondWithResult(_0xd5af15,null))[_0x453a('0x1f')](handleError(_0xd5af15,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e33ae08..8e4f9e5 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 _0xc01b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x582844,_0x5c2c02){var _0x3ae71f=function(_0x5241f5){while(--_0x5241f5){_0x582844['push'](_0x582844['shift']());}};_0x3ae71f(++_0x5c2c02);}(_0xc01b,0x74));var _0xbc01=function(_0x652582,_0x6c6679){_0x652582=_0x652582-0x0;var _0x320a26=_0xc01b[_0x652582];return _0x320a26;};'use strict';var EventEmitter=require(_0xbc01('0x0'));var ChatWebsite=require(_0xbc01('0x1'))['db'][_0xbc01('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbc01('0x3')](0x0);var events={'afterCreate':_0xbc01('0x4'),'afterUpdate':_0xbc01('0x5'),'afterDestroy':_0xbc01('0x6')};function emitEvent(_0x5ede59){return function(_0x2c35d0,_0x133078,_0x222fa3){ChatWebsiteEvents[_0xbc01('0x7')](_0x5ede59+':'+_0x2c35d0['id'],_0x2c35d0);ChatWebsiteEvents[_0xbc01('0x7')](_0x5ede59,_0x2c35d0);_0x222fa3(null);};}for(var e in events){if(events[_0xbc01('0x8')](e)){var event=events[e];ChatWebsite[_0xbc01('0x9')](e,emitEvent(event));}}module[_0xbc01('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x9221=['hasOwnProperty','exports','../../mysqldb','ChatWebsite','save','update','emit'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9221,0x64));var _0x1922=function(_0x995f33,_0x17fdce){_0x995f33=_0x995f33-0x0;var _0x587aec=_0x9221[_0x995f33];return _0x587aec;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x1922('0x0'))['db'][_0x1922('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1922('0x2'),'afterUpdate':_0x1922('0x3'),'afterDestroy':'remove'};function emitEvent(_0x309b6b){return function(_0x43c8a3,_0x459eee,_0xa19ed6){ChatWebsiteEvents[_0x1922('0x4')](_0x309b6b+':'+_0x43c8a3['id'],_0x43c8a3);ChatWebsiteEvents[_0x1922('0x4')](_0x309b6b,_0x43c8a3);_0xa19ed6(null);};}for(var e in events){if(events[_0x1922('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x1922('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d38e26b..775bcc2 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 _0xeca6=['path','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','api','moment','bluebird','request-promise'];(function(_0x13baf8,_0x3c906a){var _0x5545d1=function(_0xa738e4){while(--_0xa738e4){_0x13baf8['push'](_0x13baf8['shift']());}};_0x5545d1(++_0x3c906a);}(_0xeca6,0x1b6));var _0x6eca=function(_0x56238b,_0x29de3d){_0x56238b=_0x56238b-0x0;var _0x3d9acf=_0xeca6[_0x56238b];return _0x3d9acf;};'use strict';var _=require(_0x6eca('0x0'));var util=require(_0x6eca('0x1'));var logger=require('../../config/logger')(_0x6eca('0x2'));var moment=require(_0x6eca('0x3'));var BPromise=require(_0x6eca('0x4'));var rp=require(_0x6eca('0x5'));var fs=require('fs');var path=require(_0x6eca('0x6'));var rimraf=require('rimraf');var config=require(_0x6eca('0x7'));var attributes=require(_0x6eca('0x8'));module[_0x6eca('0x9')]=function(_0x2805c0,_0x75096b){return _0x2805c0['define'](_0x6eca('0xa'),attributes,{'tableName':_0x6eca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89fa=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','lodash'];(function(_0xedcdc0,_0x224c29){var _0xbeac85=function(_0x3f333b){while(--_0x3f333b){_0xedcdc0['push'](_0xedcdc0['shift']());}};_0xbeac85(++_0x224c29);}(_0x89fa,0x6b));var _0xa89f=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x89fa[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0xa89f('0x0'));var util=require(_0xa89f('0x1'));var logger=require(_0xa89f('0x2'))('api');var moment=require(_0xa89f('0x3'));var BPromise=require(_0xa89f('0x4'));var rp=require(_0xa89f('0x5'));var fs=require('fs');var path=require(_0xa89f('0x6'));var rimraf=require(_0xa89f('0x7'));var config=require(_0xa89f('0x8'));var attributes=require(_0xa89f('0x9'));module[_0xa89f('0xa')]=function(_0x2612bd,_0x5db5f4){return _0x2612bd[_0xa89f('0xb')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index dd60d3e..aef1ac9 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 _0xcab2=['info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message'];(function(_0x3da85d,_0xafd4fa){var _0x40bb54=function(_0x42214d){while(--_0x42214d){_0x3da85d['push'](_0x3da85d['shift']());}};_0x40bb54(++_0xafd4fa);}(_0xcab2,0x199));var _0x2cab=function(_0x1895a7,_0x25e599){_0x1895a7=_0x1895a7-0x0;var _0xaab4ee=_0xcab2[_0x1895a7];return _0xaab4ee;};'use strict';var _=require(_0x2cab('0x0'));var util=require('util');var moment=require(_0x2cab('0x1'));var BPromise=require(_0x2cab('0x2'));var rs=require(_0x2cab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cab('0x4'))['db'];var utils=require(_0x2cab('0x5'));var logger=require(_0x2cab('0x6'))(_0x2cab('0x7'));var config=require(_0x2cab('0x8'));var jayson=require(_0x2cab('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x2cab('0xa')]=_[_0x2cab('0xb')](config[_0x2cab('0xa')],{'host':_0x2cab('0xc'),'port':0x18eb});var socket=require(_0x2cab('0xd'))(new Redis(config[_0x2cab('0xa')]));require(_0x2cab('0xe'))[_0x2cab('0xf')](socket);function respondWithRpcPromise(_0x5b55f3,_0xe5c01e,_0xd0c0d2){return new BPromise(function(_0x2eef6e,_0x171504){return client[_0x2cab('0x10')](_0x5b55f3,_0xd0c0d2)[_0x2cab('0x11')](function(_0x324f0f){logger['info']('ChatWebsite,\x20%s,\x20%s',_0xe5c01e,_0x2cab('0x12'));logger[_0x2cab('0x13')](_0x2cab('0x14'),_0xe5c01e,_0x2cab('0x12'),JSON[_0x2cab('0x15')](_0x324f0f));if(_0x324f0f[_0x2cab('0x16')]){if(_0x324f0f[_0x2cab('0x16')][_0x2cab('0x17')]===0x1f4){logger[_0x2cab('0x16')](_0x2cab('0x18'),_0xe5c01e,_0x324f0f[_0x2cab('0x16')]['message']);return _0x171504(_0x324f0f[_0x2cab('0x16')][_0x2cab('0x19')]);}logger[_0x2cab('0x16')](_0x2cab('0x18'),_0xe5c01e,_0x324f0f[_0x2cab('0x16')]['message']);return _0x2eef6e(_0x324f0f[_0x2cab('0x16')][_0x2cab('0x19')]);}else{logger[_0x2cab('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0xe5c01e,_0x2cab('0x12'));_0x2eef6e(_0x324f0f[_0x2cab('0x1b')][_0x2cab('0x19')]);}})[_0x2cab('0x1c')](function(_0x1474e5){logger[_0x2cab('0x16')]('ChatWebsite,\x20%s,\x20%s',_0xe5c01e,_0x1474e5);_0x171504(_0x1474e5);});});} \ No newline at end of file +var _0x44cd=['redis','defaults','localhost','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3957c6,_0x1c9858){var _0x257618=function(_0x2411f2){while(--_0x2411f2){_0x3957c6['push'](_0x3957c6['shift']());}};_0x257618(++_0x1c9858);}(_0x44cd,0x1d1));var _0xd44c=function(_0xa3400,_0x3a980a){_0xa3400=_0xa3400-0x0;var _0x33dba2=_0x44cd[_0xa3400];return _0x33dba2;};'use strict';var _=require(_0xd44c('0x0'));var util=require(_0xd44c('0x1'));var moment=require(_0xd44c('0x2'));var BPromise=require('bluebird');var rs=require(_0xd44c('0x3'));var fs=require('fs');var Redis=require(_0xd44c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd44c('0x5'))(_0xd44c('0x6'));var config=require(_0xd44c('0x7'));var jayson=require(_0xd44c('0x8'));var client=jayson['client'][_0xd44c('0x9')]({'port':0x232a});config[_0xd44c('0xa')]=_[_0xd44c('0xb')](config['redis'],{'host':_0xd44c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd44c('0xa')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x1803d2,_0x2efd7a,_0x3fc3a6){return new BPromise(function(_0x59495e,_0x228774){return client[_0xd44c('0xd')](_0x1803d2,_0x3fc3a6)[_0xd44c('0xe')](function(_0x5b3516){logger[_0xd44c('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x2efd7a,'request\x20sent');logger[_0xd44c('0x10')](_0xd44c('0x11'),_0x2efd7a,_0xd44c('0x12'),JSON[_0xd44c('0x13')](_0x5b3516));if(_0x5b3516[_0xd44c('0x14')]){if(_0x5b3516['error'][_0xd44c('0x15')]===0x1f4){logger[_0xd44c('0x14')](_0xd44c('0x16'),_0x2efd7a,_0x5b3516['error'][_0xd44c('0x17')]);return _0x228774(_0x5b3516[_0xd44c('0x14')]['message']);}logger[_0xd44c('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x2efd7a,_0x5b3516[_0xd44c('0x14')]['message']);return _0x59495e(_0x5b3516[_0xd44c('0x14')][_0xd44c('0x17')]);}else{logger[_0xd44c('0xf')](_0xd44c('0x16'),_0x2efd7a,_0xd44c('0x12'));_0x59495e(_0x5b3516['result'][_0xd44c('0x17')]);}})[_0xd44c('0x18')](function(_0x5612ce){logger[_0xd44c('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x2efd7a,_0x5612ce);_0x228774(_0x5612ce);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 3700335..35af651 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 _0xe073=['length','./chatWebsite.events','save','remove','update','emit','register'];(function(_0x4cf8d4,_0x5aee73){var _0x2c1beb=function(_0x39b0a4){while(--_0x39b0a4){_0x4cf8d4['push'](_0x4cf8d4['shift']());}};_0x2c1beb(++_0x5aee73);}(_0xe073,0x1e4));var _0x3e07=function(_0x5f0225,_0x52631a){_0x5f0225=_0x5f0225-0x0;var _0x2cef4b=_0xe073[_0x5f0225];return _0x2cef4b;};'use strict';var ChatWebsiteEvents=require(_0x3e07('0x0'));var events=[_0x3e07('0x1'),_0x3e07('0x2'),_0x3e07('0x3')];function createListener(_0x455f45,_0xd66d6e){return function(_0x1080fb){_0xd66d6e[_0x3e07('0x4')](_0x455f45,_0x1080fb);};}function removeListener(_0x1d1d8b,_0x535454){return function(){ChatWebsiteEvents['removeListener'](_0x1d1d8b,_0x535454);};}exports[_0x3e07('0x5')]=function(_0x3b6679){for(var _0x340fc1=0x0,_0xb31f3a=events[_0x3e07('0x6')];_0x340fc1<_0xb31f3a;_0x340fc1++){var _0x23e75d=events[_0x340fc1];var _0x852b8=createListener('chatWebsite:'+_0x23e75d,_0x3b6679);ChatWebsiteEvents['on'](_0x23e75d,_0x852b8);}}; \ No newline at end of file +var _0x3680=['length','./chatWebsite.events','save','register'];(function(_0x263b5d,_0x30caa4){var _0x450eb6=function(_0x25e1ee){while(--_0x25e1ee){_0x263b5d['push'](_0x263b5d['shift']());}};_0x450eb6(++_0x30caa4);}(_0x3680,0x1d1));var _0x0368=function(_0x5caa0d,_0x15b8d7){_0x5caa0d=_0x5caa0d-0x0;var _0x41656a=_0x3680[_0x5caa0d];return _0x41656a;};'use strict';var ChatWebsiteEvents=require(_0x0368('0x0'));var events=[_0x0368('0x1'),'remove','update'];function createListener(_0x5ab689,_0xdc73fb){return function(_0xf7b87c){_0xdc73fb['emit'](_0x5ab689,_0xf7b87c);};}function removeListener(_0x51a8bb,_0x33f60c){return function(){ChatWebsiteEvents['removeListener'](_0x51a8bb,_0x33f60c);};}exports[_0x0368('0x2')]=function(_0x237603){for(var _0x332d3a=0x0,_0x491938=events[_0x0368('0x3')];_0x332d3a<_0x491938;_0x332d3a++){var _0xdf1607=events[_0x332d3a];var _0x1bfce3=createListener('chatWebsite:'+_0xdf1607,_0x237603);ChatWebsiteEvents['on'](_0xdf1607,_0x1bfce3);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 1cdf22f..eeeafc2 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 _0x7352=['/:id/avatar','getAvatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','server/files/images/avatars/','originalname','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo'];(function(_0x2426a2,_0x46da0d){var _0x5cedd1=function(_0x26e52e){while(--_0x26e52e){_0x2426a2['push'](_0x2426a2['shift']());}};_0x5cedd1(++_0x46da0d);}(_0x7352,0x10d));var _0x2735=function(_0x136e11,_0x29bd0b){_0x136e11=_0x136e11-0x0;var _0x36d346=_0x7352[_0x136e11];return _0x36d346;};'use strict';var multer=require(_0x2735('0x0'));var util=require(_0x2735('0x1'));var path=require(_0x2735('0x2'));var timeout=require('connect-timeout');var express=require(_0x2735('0x3'));var router=express[_0x2735('0x4')]();var fs_extra=require(_0x2735('0x5'));var auth=require(_0x2735('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2735('0x7'));var controller=require(_0x2735('0x8'));router[_0x2735('0x9')]('/',auth['isAuthenticated'](),controller[_0x2735('0xa')]);router['get']('/describe',auth[_0x2735('0xb')](),controller[_0x2735('0xc')]);router['get'](_0x2735('0xd'),auth['isAuthenticated'](),controller[_0x2735('0xe')]);router['get'](_0x2735('0xf'),auth[_0x2735('0xb')](),controller['getDispositions']);router[_0x2735('0x9')](_0x2735('0x10'),auth[_0x2735('0xb')](),controller[_0x2735('0x11')]);router['get'](_0x2735('0x12'),controller['getLogo']);router[_0x2735('0x9')](_0x2735('0x13'),controller[_0x2735('0x14')]);router[_0x2735('0x9')]('/:id/customer_avatar',controller[_0x2735('0x15')]);router['get']('/:id/system_avatar',controller[_0x2735('0x16')]);router['get'](_0x2735('0x17'),auth[_0x2735('0xb')](),controller[_0x2735('0x18')]);router[_0x2735('0x9')](_0x2735('0x19'),controller[_0x2735('0x1a')]);router[_0x2735('0x9')](_0x2735('0x1b'),auth[_0x2735('0xb')](),controller['getApplications']);router['get'](_0x2735('0x1c'),auth[_0x2735('0xb')](),controller['getProactiveActions']);router['get'](_0x2735('0x1d'),controller[_0x2735('0x1e')]);router[_0x2735('0x9')](_0x2735('0x1f'),auth[_0x2735('0xb')](),controller[_0x2735('0x20')]);router[_0x2735('0x9')]('/:id/users',auth[_0x2735('0xb')](),controller[_0x2735('0x21')]);router[_0x2735('0x22')]('/',auth[_0x2735('0xb')](),controller[_0x2735('0x23')]);router[_0x2735('0x22')](_0x2735('0xf'),auth[_0x2735('0xb')](),controller['addDisposition']);router[_0x2735('0x22')](_0x2735('0x10'),auth[_0x2735('0xb')](),controller[_0x2735('0x24')]);var upload=multer({'storage':multer[_0x2735('0x25')]({'destination':function(_0x52dc57,_0x57cf0b,_0x562f76){_0x562f76(null,path[_0x2735('0x26')](config[_0x2735('0x27')],_0x2735('0x28')));},'filename':function(_0x4b52e3,_0x91d68d,_0x3299a0){_0x3299a0(null,util[_0x2735('0x29')](_0x2735('0x2a'),Date[_0x2735('0x2b')](),_0x91d68d['originalname']));}})});router[_0x2735('0x22')](_0x2735('0x12'),upload[_0x2735('0x2c')](_0x2735('0x2d')),controller[_0x2735('0x2e')]);var upload=multer({'storage':multer[_0x2735('0x25')]({'destination':function(_0x401598,_0x1fd969,_0xa63d39){_0xa63d39(null,path[_0x2735('0x26')](config[_0x2735('0x27')],_0x2735('0x2f')));},'filename':function(_0xdff0a,_0x4418b0,_0x1258c2){_0x1258c2(null,util[_0x2735('0x29')](_0x2735('0x2a'),Date[_0x2735('0x2b')](),_0x4418b0[_0x2735('0x30')]));}})});router['post'](_0x2735('0x13'),upload[_0x2735('0x2c')](_0x2735('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x2735('0x25')]({'destination':function(_0x48b6f9,_0x201be3,_0x1af84d){_0x1af84d(null,path[_0x2735('0x26')](config[_0x2735('0x27')],_0x2735('0x2f')));},'filename':function(_0x21fd4b,_0x5e7f10,_0xdab324){_0xdab324(null,util['format']('%s-%s',Date[_0x2735('0x2b')](),_0x5e7f10[_0x2735('0x30')]));}})});router['post'](_0x2735('0x31'),upload[_0x2735('0x2c')](_0x2735('0x2d')),controller[_0x2735('0x32')]);var upload=multer({'storage':multer[_0x2735('0x25')]({'destination':function(_0x74bb9a,_0x336135,_0x122df1){_0x122df1(null,path[_0x2735('0x26')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x493887,_0x75ea87,_0x563e3e){_0x563e3e(null,util[_0x2735('0x29')](_0x2735('0x2a'),Date[_0x2735('0x2b')](),_0x75ea87['originalname']));}})});router[_0x2735('0x22')](_0x2735('0x33'),upload[_0x2735('0x2c')]('file'),controller[_0x2735('0x34')]);router[_0x2735('0x22')](_0x2735('0x35'),controller[_0x2735('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x28410a,_0x3c1291,_0x190679){const _0x3e137f=path[_0x2735('0x26')](config[_0x2735('0x27')],'server/files',_0x2735('0x37'),_0x2735('0x38'));fs_extra[_0x2735('0x39')](_0x3e137f,function(){_0x190679(null,_0x3e137f);});},'filename':function(_0x415943,_0x421385,_0x55616c){const _0xcebd1a=_0x421385[_0x2735('0x30')][_0x2735('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5e2f04=path[_0x2735('0x3b')](_0xcebd1a);const _0x3680f4=Date[_0x2735('0x2b')]()+'-'+_0xcebd1a[_0x2735('0x3a')](_0x5e2f04,'')+_0x5e2f04;_0x55616c(null,_0x3680f4);}})});router['post'](_0x2735('0x3c'),offlineUploadMulter[_0x2735('0x3d')](),controller[_0x2735('0x3e')]);router[_0x2735('0x22')](_0x2735('0x17'),auth[_0x2735('0xb')](),controller[_0x2735('0x3f')]);router['post']('/:id/applications',auth[_0x2735('0xb')](),controller[_0x2735('0x40')]);router[_0x2735('0x22')](_0x2735('0x1c'),auth[_0x2735('0xb')](),controller[_0x2735('0x41')]);router[_0x2735('0x22')]('/:id/users',auth[_0x2735('0xb')](),controller[_0x2735('0x42')]);router[_0x2735('0x43')](_0x2735('0xd'),auth['isAuthenticated'](),controller[_0x2735('0x44')]);router['delete'](_0x2735('0xd'),auth[_0x2735('0xb')](),controller['destroy']);router['delete'](_0x2735('0xf'),auth[_0x2735('0xb')](),controller['removeDispositions']);router['delete'](_0x2735('0x10'),auth[_0x2735('0xb')](),controller[_0x2735('0x45')]);router['delete']('/:id/users',auth[_0x2735('0xb')](),controller[_0x2735('0x46')]);module[_0x2735('0x47')]=router; \ No newline at end of file +var _0xe827=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','diskStorage','server/files/images/logos/','format','%s-%s','now','file','join','root','server/files/images/avatars/','originalname','single','addAvatar','addCustomerAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer'];(function(_0x3bc298,_0x583d14){var _0x31bf58=function(_0x24563b){while(--_0x24563b){_0x3bc298['push'](_0x3bc298['shift']());}};_0x31bf58(++_0x583d14);}(_0xe827,0x1c6));var _0x7e82=function(_0x20e2f9,_0x49bf77){_0x20e2f9=_0x20e2f9-0x0;var _0x431048=_0xe827[_0x20e2f9];return _0x431048;};'use strict';var multer=require(_0x7e82('0x0'));var util=require('util');var path=require(_0x7e82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7e82('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7e82('0x3'));var interaction=require(_0x7e82('0x4'));var config=require(_0x7e82('0x5'));var controller=require(_0x7e82('0x6'));router[_0x7e82('0x7')]('/',auth[_0x7e82('0x8')](),controller[_0x7e82('0x9')]);router[_0x7e82('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x7e82('0xa')]);router[_0x7e82('0x7')](_0x7e82('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7e82('0x7')](_0x7e82('0xc'),auth[_0x7e82('0x8')](),controller[_0x7e82('0xd')]);router[_0x7e82('0x7')](_0x7e82('0xe'),auth[_0x7e82('0x8')](),controller['getAnswers']);router[_0x7e82('0x7')](_0x7e82('0xf'),controller['getLogo']);router[_0x7e82('0x7')](_0x7e82('0x10'),controller['getAvatar']);router[_0x7e82('0x7')](_0x7e82('0x11'),controller['getCustomerAvatar']);router[_0x7e82('0x7')](_0x7e82('0x12'),controller['getSystemAvatar']);router[_0x7e82('0x7')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x7e82('0x13')]);router['get'](_0x7e82('0x14'),controller[_0x7e82('0x15')]);router[_0x7e82('0x7')](_0x7e82('0x16'),auth['isAuthenticated'](),controller['getApplications']);router[_0x7e82('0x7')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x7e82('0x17')]);router['get']('/:id/fields',controller[_0x7e82('0x18')]);router[_0x7e82('0x7')](_0x7e82('0x19'),auth[_0x7e82('0x8')](),controller[_0x7e82('0x1a')]);router['get'](_0x7e82('0x1b'),auth[_0x7e82('0x8')](),controller[_0x7e82('0x1c')]);router[_0x7e82('0x1d')]('/',auth[_0x7e82('0x8')](),controller[_0x7e82('0x1e')]);router[_0x7e82('0x1d')](_0x7e82('0xc'),auth[_0x7e82('0x8')](),controller['addDisposition']);router['post'](_0x7e82('0xe'),auth[_0x7e82('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x7e82('0x1f')]({'destination':function(_0x5c1d2e,_0x3fc6fb,_0x12c2fc){_0x12c2fc(null,path['join'](config['root'],_0x7e82('0x20')));},'filename':function(_0x16a3a1,_0x2c9bec,_0x4190b3){_0x4190b3(null,util[_0x7e82('0x21')](_0x7e82('0x22'),Date[_0x7e82('0x23')](),_0x2c9bec['originalname']));}})});router[_0x7e82('0x1d')](_0x7e82('0xf'),upload['single'](_0x7e82('0x24')),controller['addLogo']);var upload=multer({'storage':multer[_0x7e82('0x1f')]({'destination':function(_0x4df028,_0x6d2194,_0x1769ce){_0x1769ce(null,path[_0x7e82('0x25')](config[_0x7e82('0x26')],_0x7e82('0x27')));},'filename':function(_0x198c3e,_0x52050d,_0x5b8c77){_0x5b8c77(null,util[_0x7e82('0x21')](_0x7e82('0x22'),Date[_0x7e82('0x23')](),_0x52050d[_0x7e82('0x28')]));}})});router[_0x7e82('0x1d')]('/:id/avatar',upload[_0x7e82('0x29')](_0x7e82('0x24')),controller[_0x7e82('0x2a')]);var upload=multer({'storage':multer[_0x7e82('0x1f')]({'destination':function(_0x15d54a,_0x145fab,_0x21db76){_0x21db76(null,path[_0x7e82('0x25')](config['root'],_0x7e82('0x27')));},'filename':function(_0x4b8a21,_0x196217,_0x4c8994){_0x4c8994(null,util['format'](_0x7e82('0x22'),Date[_0x7e82('0x23')](),_0x196217[_0x7e82('0x28')]));}})});router[_0x7e82('0x1d')](_0x7e82('0x11'),upload['single']('file'),controller[_0x7e82('0x2b')]);var upload=multer({'storage':multer[_0x7e82('0x1f')]({'destination':function(_0x1e309d,_0x44e4cf,_0x5c1858){_0x5c1858(null,path[_0x7e82('0x25')](config[_0x7e82('0x26')],_0x7e82('0x27')));},'filename':function(_0x65c638,_0xc5c87,_0x163810){_0x163810(null,util['format'](_0x7e82('0x22'),Date[_0x7e82('0x23')](),_0xc5c87[_0x7e82('0x28')]));}})});router['post']('/:id/system_avatar',upload[_0x7e82('0x29')]('file'),controller['addSystemAvatar']);router['post'](_0x7e82('0x2c'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x7e82('0x1f')]({'destination':function(_0x3f5edf,_0x381b4d,_0x302520){const _0x266b96=path[_0x7e82('0x25')](config[_0x7e82('0x26')],_0x7e82('0x2d'),_0x7e82('0x2e'),_0x7e82('0x2f'));fs_extra[_0x7e82('0x30')](_0x266b96,function(){_0x302520(null,_0x266b96);});},'filename':function(_0x402c20,_0x3e4500,_0x477ab9){const _0x293b25=_0x3e4500['originalname'][_0x7e82('0x31')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x373d65=path[_0x7e82('0x32')](_0x293b25);const _0x4f3d80=Date[_0x7e82('0x23')]()+'-'+_0x293b25[_0x7e82('0x31')](_0x373d65,'')+_0x373d65;_0x477ab9(null,_0x4f3d80);}})});router[_0x7e82('0x1d')](_0x7e82('0x33'),offlineUploadMulter[_0x7e82('0x34')](),controller[_0x7e82('0x35')]);router['post'](_0x7e82('0x36'),auth[_0x7e82('0x8')](),controller[_0x7e82('0x37')]);router[_0x7e82('0x1d')](_0x7e82('0x16'),auth[_0x7e82('0x8')](),controller['addApplications']);router[_0x7e82('0x1d')](_0x7e82('0x38'),auth['isAuthenticated'](),controller[_0x7e82('0x39')]);router['post'](_0x7e82('0x1b'),auth[_0x7e82('0x8')](),controller[_0x7e82('0x3a')]);router[_0x7e82('0x3b')]('/:id',auth['isAuthenticated'](),controller[_0x7e82('0x3c')]);router[_0x7e82('0x3d')](_0x7e82('0xb'),auth[_0x7e82('0x8')](),controller[_0x7e82('0x3e')]);router[_0x7e82('0x3d')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7e82('0x3f')]);router[_0x7e82('0x3d')]('/:id/canned_answers',auth[_0x7e82('0x8')](),controller['removeAnswers']);router[_0x7e82('0x3d')]('/:id/users',auth['isAuthenticated'](),controller[_0x7e82('0x40')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 44fd433..d12ef3f 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 _0x491e=['isAuthenticated','express','../components/auth/service','../config/environment','env','production','app','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x491e,0x140));var _0xe491=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x491e[_0x15876a];return _0xbd900f;};var beaverLogger=require('beaver-logger/server');var express=require(_0xe491('0x0'));var auth=require(_0xe491('0x1'));var config=require(_0xe491('0x2'));var router=express['Router']();var isProduction=config[_0xe491('0x3')]===_0xe491('0x4')||![];function clientSideLogs(_0x11ff5b,_0x4ceac0,_0x1ca6ff){var _0x481313=_0x11ff5b[_0xe491('0x5')]['get']('client-side-logger');if(!_0x481313){throw new Error(_0xe491('0x6'));}return beaverLogger[_0xe491('0x7')]({'uri':_0xe491('0x8'),'logger':_0x481313,'enableCors':!isProduction})(_0x11ff5b,_0x4ceac0,_0x1ca6ff);}router[_0xe491('0x9')](auth[_0xe491('0xa')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0xcf9d=['express','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs'];(function(_0x596dc6,_0x20d6ca){var _0x635c55=function(_0x4fc4f5){while(--_0x4fc4f5){_0x596dc6['push'](_0x596dc6['shift']());}};_0x635c55(++_0x20d6ca);}(_0xcf9d,0x1b8));var _0xdcf9=function(_0xf2e8fc,_0x350b4f){_0xf2e8fc=_0xf2e8fc-0x0;var _0x4c0466=_0xcf9d[_0xf2e8fc];return _0x4c0466;};var beaverLogger=require('beaver-logger/server');var express=require(_0xdcf9('0x0'));var auth=require('../components/auth/service');var config=require(_0xdcf9('0x1'));var router=express[_0xdcf9('0x2')]();var isProduction=config[_0xdcf9('0x3')]===_0xdcf9('0x4')||![];function clientSideLogs(_0x43e82d,_0x3cbc44,_0x4fa76b){var _0x50ab87=_0x43e82d[_0xdcf9('0x5')][_0xdcf9('0x6')](_0xdcf9('0x7'));if(!_0x50ab87){throw new Error(_0xdcf9('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0xdcf9('0x9'),'logger':_0x50ab87,'enableCors':!isProduction})(_0x43e82d,_0x3cbc44,_0x4fa76b);}router['use'](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 013d8d2..2a1f71e 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 _0x3c30=['ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports'];(function(_0x48d240,_0x422c9b){var _0x52e0bf=function(_0x483e61){while(--_0x483e61){_0x48d240['push'](_0x48d240['shift']());}};_0x52e0bf(++_0x422c9b);}(_0x3c30,0x13e));var _0x03c3=function(_0x4c3b31,_0x29f892){_0x4c3b31=_0x4c3b31-0x0;var _0x1e531a=_0x3c30[_0x4c3b31];return _0x1e531a;};'use strict';var Sequelize=require(_0x03c3('0x0'));module[_0x03c3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x03c3('0x2')](_0x03c3('0x3'),_0x03c3('0x4'),_0x03c3('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x03c3('0x6'),_0x03c3('0x7'))},'data1':{'type':Sequelize[_0x03c3('0x8')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x03c3('0x8')],'comment':_0x03c3('0x9')},'data3':{'type':Sequelize[_0x03c3('0x8')],'comment':_0x03c3('0xa')},'data4':{'type':Sequelize[_0x03c3('0x8')],'comment':_0x03c3('0xb')},'data5':{'type':Sequelize[_0x03c3('0xc')],'comment':_0x03c3('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':_0x03c3('0xe')},'data7':{'type':Sequelize[_0x03c3('0xc')],'comment':_0x03c3('0xf')}}; \ No newline at end of file +var _0xd9e3=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365'];(function(_0x3a4544,_0x107e33){var _0x448249=function(_0x2c61cc){while(--_0x2c61cc){_0x3a4544['push'](_0x3a4544['shift']());}};_0x448249(++_0x107e33);}(_0xd9e3,0xb8));var _0x3d9e=function(_0x5199d7,_0x62502c){_0x5199d7=_0x5199d7-0x0;var _0x3d77e5=_0xd9e3[_0x5199d7];return _0x3d77e5;};'use strict';var Sequelize=require(_0x3d9e('0x0'));module[_0x3d9e('0x1')]={'name':{'type':Sequelize[_0x3d9e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3d9e('0x3')](_0x3d9e('0x4'),_0x3d9e('0x5'),_0x3d9e('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x3d9e('0x3')](_0x3d9e('0x7'),_0x3d9e('0x8'))},'data1':{'type':Sequelize[_0x3d9e('0x2')],'comment':_0x3d9e('0x9')},'data2':{'type':Sequelize[_0x3d9e('0x2')],'comment':_0x3d9e('0xa')},'data3':{'type':Sequelize[_0x3d9e('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x3d9e('0x2')],'comment':_0x3d9e('0xb')},'data5':{'type':Sequelize[_0x3d9e('0xc')],'comment':_0x3d9e('0xd')},'data6':{'type':Sequelize[_0x3d9e('0xc')],'comment':_0x3d9e('0xe')},'data7':{'type':Sequelize[_0x3d9e('0xc')],'comment':_0x3d9e('0xf')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 71610f3..e6a0d9d 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 _0x3a7b=['options','include','findAll','rows','MicrosoftAzure','decryptString','data3','params','intersection','includeAll','find','catch','create','body','Name\x20parameter\x20not\x20specified','service','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','slice','index','map','CloudProvider','rawAttributes','fieldName','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3a7b,0x152));var _0xb3a7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3a7b[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xb3a7('0x0'));var Redis=require(_0xb3a7('0x1'));var qs=require(_0xb3a7('0x2'));var encryptor=require(_0xb3a7('0x3'));var config=require('../../config/environment');var logger=require(_0xb3a7('0x4'))('api');var db=require(_0xb3a7('0x5'))['db'];var oauth=require(_0xb3a7('0x6'));config[_0xb3a7('0x7')]=_[_0xb3a7('0x8')](config[_0xb3a7('0x7')],{'host':_0xb3a7('0x9'),'port':0x18eb});var socket=require(_0xb3a7('0xa'))(new Redis(config[_0xb3a7('0x7')]));var redis=new Redis(config[_0xb3a7('0x7')]);function respondWithStatusCode(_0x364df8,_0x4d1af7){_0x4d1af7=_0x4d1af7||0xcc;return function(_0x2f3997){if(_0x2f3997){return _0x364df8[_0xb3a7('0xb')](_0x4d1af7);}return _0x364df8[_0xb3a7('0xc')](_0x4d1af7)[_0xb3a7('0xd')]();};}function respondWithResult(_0x11eca2,_0x13f911){_0x13f911=_0x13f911||0xc8;return function(_0x12bb9c){if(_0x12bb9c){return _0x11eca2[_0xb3a7('0xc')](_0x13f911)['json'](_0x12bb9c);}};}function respondWithFilteredResult(_0x419833,_0x383346){return function(_0x5a904f){if(_0x5a904f){var _0x28419b=typeof _0x383346[_0xb3a7('0xe')]===_0xb3a7('0xf')&&typeof _0x383346[_0xb3a7('0x10')]===_0xb3a7('0xf');var _0x3c8ca0=_0x5a904f[_0xb3a7('0x11')];var _0x864201=_0x28419b?0x0:_0x383346['offset'];var _0x3d9e65=_0x28419b?_0x5a904f['count']:_0x383346[_0xb3a7('0xe')]+_0x383346[_0xb3a7('0x10')];var _0x578e00;if(_0x3d9e65>=_0x3c8ca0){_0x3d9e65=_0x3c8ca0;_0x578e00=0xc8;}else{_0x578e00=0xce;}_0x419833[_0xb3a7('0xc')](_0x578e00);return _0x419833[_0xb3a7('0x12')](_0xb3a7('0x13'),_0x864201+'-'+_0x3d9e65+'/'+_0x3c8ca0)[_0xb3a7('0x14')](_0x5a904f);}return null;};}function saveUpdates(_0x1716ed){return function(_0x39b847){if(_0x39b847){return _0x39b847[_0xb3a7('0x15')](_0x1716ed)[_0xb3a7('0x16')](function(_0x36fa78){return _0x36fa78;});}return null;};}function removeEntity(_0x4689ed){return function(_0x36b25e){if(_0x36b25e){return _0x36b25e[_0xb3a7('0x17')]()['then'](function(){_0x4689ed['status'](0xcc)[_0xb3a7('0xd')]();});}};}function handleEntityNotFound(_0x58840b){return function(_0x536058){if(!_0x536058){_0x58840b[_0xb3a7('0xb')](0x194);}return _0x536058;};}function handleError(_0x1d4738,_0x234a98){_0x234a98=_0x234a98||0x1f4;return function(_0x372d90){logger[_0xb3a7('0x18')](_0x372d90[_0xb3a7('0x19')]);if(_0x372d90[_0xb3a7('0x1a')]){delete _0x372d90[_0xb3a7('0x1a')];}_0x1d4738[_0xb3a7('0xc')](_0x234a98)[_0xb3a7('0x1b')](_0x372d90);};}function maskClientSecret(_0x5d15f8){return _['padEnd'](_0x5d15f8[_0xb3a7('0x1c')](0x0,0x3),0x14,'*');}exports[_0xb3a7('0x1d')]=function(_0x323de0,_0x18b85d){var _0x19bb3e={},_0x327067={},_0x485a39={'count':0x0,'rows':[]};var _0x2fc217=_[_0xb3a7('0x1e')](db[_0xb3a7('0x1f')][_0xb3a7('0x20')],function(_0x1e36ac){return{'name':_0x1e36ac[_0xb3a7('0x21')],'type':_0x1e36ac['type']['key']};});_0x327067[_0xb3a7('0x22')]=_['map'](_0x2fc217,_0xb3a7('0x1a'));_0x327067['query']=_[_0xb3a7('0x23')](_0x323de0[_0xb3a7('0x24')]);_0x327067['filters']=_['intersection'](_0x327067[_0xb3a7('0x22')],_0x327067[_0xb3a7('0x24')]);_0x19bb3e[_0xb3a7('0x25')]=_['intersection'](_0x327067['model'],qs[_0xb3a7('0x26')](_0x323de0['query']['fields']));_0x19bb3e[_0xb3a7('0x25')]=_0x19bb3e[_0xb3a7('0x25')][_0xb3a7('0x27')]?_0x19bb3e['attributes']:_0x327067['model'];if(!_0x323de0[_0xb3a7('0x24')][_0xb3a7('0x28')](_0xb3a7('0x29'))){_0x19bb3e[_0xb3a7('0x10')]=qs[_0xb3a7('0x10')](_0x323de0['query'][_0xb3a7('0x10')]);_0x19bb3e[_0xb3a7('0xe')]=qs[_0xb3a7('0xe')](_0x323de0[_0xb3a7('0x24')][_0xb3a7('0xe')]);}_0x19bb3e[_0xb3a7('0x2a')]=qs[_0xb3a7('0x2b')](_0x323de0['query'][_0xb3a7('0x2b')]);_0x19bb3e[_0xb3a7('0x2c')]=qs[_0xb3a7('0x2d')](_[_0xb3a7('0x2e')](_0x323de0[_0xb3a7('0x24')],_0x327067['filters']),_0x2fc217);if(_0x323de0[_0xb3a7('0x24')]['filter']){_0x19bb3e[_0xb3a7('0x2c')]=_[_0xb3a7('0x2f')](_0x19bb3e['where'],{'$or':_[_0xb3a7('0x1e')](_0x2fc217,function(_0x2990c4){if(_0x2990c4[_0xb3a7('0x30')]!==_0xb3a7('0x31')){var _0x320a72={};_0x320a72[_0x2990c4[_0xb3a7('0x1a')]]={'$like':'%'+_0x323de0['query']['filter']+'%'};return _0x320a72;}})});}_0x19bb3e=_[_0xb3a7('0x2f')]({},_0x19bb3e,_0x323de0[_0xb3a7('0x32')]);var _0x2a6ed8={'where':_0x19bb3e[_0xb3a7('0x2c')]};return db[_0xb3a7('0x1f')]['count'](_0x2a6ed8)[_0xb3a7('0x16')](function(_0x547965){_0x485a39['count']=_0x547965;if(_0x323de0[_0xb3a7('0x24')]['includeAll']){_0x19bb3e[_0xb3a7('0x33')]=[{'all':!![]}];}return db['CloudProvider'][_0xb3a7('0x34')](_0x19bb3e);})[_0xb3a7('0x16')](function(_0x582ea7){_0x485a39[_0xb3a7('0x35')]=_['map'](_0x582ea7,function(_0x1b562e){if(_0x1b562e['service']===_0xb3a7('0x36')){var _0x402d1f=encryptor[_0xb3a7('0x37')](_0x1b562e['data3']);_0x1b562e[_0xb3a7('0x38')]=maskClientSecret(_0x402d1f);}return _0x1b562e;});return _0x485a39;})[_0xb3a7('0x16')](respondWithFilteredResult(_0x18b85d,_0x19bb3e))['catch'](handleError(_0x18b85d,null));};exports['show']=function(_0x30173f,_0x36cb85){var _0x25a444={'raw':!![],'where':{'id':_0x30173f[_0xb3a7('0x39')]['id']}},_0x502a8b={};_0x502a8b[_0xb3a7('0x22')]=_[_0xb3a7('0x23')](db['CloudProvider'][_0xb3a7('0x20')]);_0x502a8b[_0xb3a7('0x24')]=_[_0xb3a7('0x23')](_0x30173f[_0xb3a7('0x24')]);_0x502a8b[_0xb3a7('0x2d')]=_[_0xb3a7('0x3a')](_0x502a8b[_0xb3a7('0x22')],_0x502a8b['query']);_0x25a444[_0xb3a7('0x25')]=_[_0xb3a7('0x3a')](_0x502a8b[_0xb3a7('0x22')],qs[_0xb3a7('0x26')](_0x30173f[_0xb3a7('0x24')]['fields']));_0x25a444[_0xb3a7('0x25')]=_0x25a444[_0xb3a7('0x25')]['length']?_0x25a444['attributes']:_0x502a8b[_0xb3a7('0x22')];if(_0x30173f[_0xb3a7('0x24')][_0xb3a7('0x3b')]){_0x25a444[_0xb3a7('0x33')]=[{'all':!![]}];}_0x25a444=_[_0xb3a7('0x2f')]({},_0x25a444,_0x30173f[_0xb3a7('0x32')]);return db[_0xb3a7('0x1f')][_0xb3a7('0x3c')](_0x25a444)[_0xb3a7('0x16')](handleEntityNotFound(_0x36cb85,null))[_0xb3a7('0x16')](function(_0x59275a){if(_0x59275a['service']==='MicrosoftAzure'){var _0x59a2f6=encryptor[_0xb3a7('0x37')](_0x59275a['data3']);_0x59275a['data3']=maskClientSecret(_0x59a2f6);}return _0x59275a;})[_0xb3a7('0x16')](respondWithResult(_0x36cb85,null))[_0xb3a7('0x3d')](handleError(_0x36cb85,null));};exports[_0xb3a7('0x3e')]=function(_0x3b6dc8,_0x5e0c63){if(!_0x3b6dc8[_0xb3a7('0x3f')][_0xb3a7('0x1a')])throw new Error(_0xb3a7('0x40'));if(!_0x3b6dc8[_0xb3a7('0x3f')][_0xb3a7('0x41')])throw new Error(_0xb3a7('0x42'));var _0x12a83a=db[_0xb3a7('0x1f')][_0xb3a7('0x20')][_0xb3a7('0x41')][_0xb3a7('0x43')];if(!_0x12a83a[_0xb3a7('0x44')](_0x3b6dc8[_0xb3a7('0x3f')][_0xb3a7('0x41')]))throw new Error(_0xb3a7('0x45')+_0x12a83a[_0xb3a7('0x46')](',\x20'));if(_0x3b6dc8[_0xb3a7('0x3f')][_0xb3a7('0x41')]===_0xb3a7('0x36')&&_0x3b6dc8['body'][_0xb3a7('0x38')]){_0x3b6dc8[_0xb3a7('0x3f')][_0xb3a7('0x38')]=encryptor[_0xb3a7('0x47')](_0x3b6dc8[_0xb3a7('0x3f')][_0xb3a7('0x38')]);}return db[_0xb3a7('0x1f')][_0xb3a7('0x3e')](_0x3b6dc8[_0xb3a7('0x3f')],{})[_0xb3a7('0x16')](respondWithResult(_0x5e0c63,0xc9))[_0xb3a7('0x3d')](handleError(_0x5e0c63,null));};exports[_0xb3a7('0x15')]=function(_0x32f96f,_0x338bc3){if(_0x32f96f[_0xb3a7('0x3f')]['id']){delete _0x32f96f[_0xb3a7('0x3f')]['id'];}return db[_0xb3a7('0x1f')][_0xb3a7('0x3c')]({'where':{'id':_0x32f96f[_0xb3a7('0x39')]['id']}})[_0xb3a7('0x16')](handleEntityNotFound(_0x338bc3,null))[_0xb3a7('0x16')](function(_0x1544d5){if(_0x1544d5['service']==='MicrosoftAzure'&&_0x32f96f[_0xb3a7('0x3f')][_0xb3a7('0x38')]){_0x32f96f[_0xb3a7('0x3f')]['data3']=encryptor[_0xb3a7('0x47')](_0x32f96f[_0xb3a7('0x3f')][_0xb3a7('0x38')]);}return _0x1544d5;})[_0xb3a7('0x16')](saveUpdates(_0x32f96f['body'],null))['then'](respondWithResult(_0x338bc3,null))[_0xb3a7('0x3d')](handleError(_0x338bc3,null));};exports[_0xb3a7('0x17')]=function(_0x4ece00,_0x1b3f9e){return db[_0xb3a7('0x1f')][_0xb3a7('0x3c')]({'where':{'id':_0x4ece00['params']['id']}})[_0xb3a7('0x16')](handleEntityNotFound(_0x1b3f9e,null))[_0xb3a7('0x16')](removeEntity(_0x1b3f9e,null))[_0xb3a7('0x3d')](handleError(_0x1b3f9e,null));};exports[_0xb3a7('0x48')]=function(_0x5230b1,_0x476235){return db[_0xb3a7('0x1f')][_0xb3a7('0x49')]({'where':{'id':_0x5230b1[_0xb3a7('0x39')]['id']},'raw':!![]})[_0xb3a7('0x16')](function(_0x1d1464){if(!_0x1d1464)return _0x476235[_0xb3a7('0xb')](0x194);return{'url':oauth[_0xb3a7('0x4a')](_0x1d1464,_0x5230b1[_0xb3a7('0x4b')]['id'])};})[_0xb3a7('0x16')](respondWithResult(_0x476235,null))[_0xb3a7('0x3d')](handleError(_0x476235,null));};exports['oauth2MicrosoftCallback']=function(_0x44906b,_0x4fc235){var _0x35a5eb=_0x44906b['body'];var _0x1594c4;var _0x112533;if(_0x35a5eb[_0xb3a7('0x18')])throw _0x35a5eb;redis['get'](_0x35a5eb[_0xb3a7('0x4c')])['then'](function(_0x4b19d5){if(!_0x4b19d5)throw new Error(_0xb3a7('0x4d'));_0x1594c4=JSON[_0xb3a7('0x4e')](_0x4b19d5);var _0x421806=Buffer[_0xb3a7('0x4f')](_0x35a5eb[_0xb3a7('0x4c')],'base64')[_0xb3a7('0x50')](_0xb3a7('0x51'));_0x112533=JSON[_0xb3a7('0x4e')](_0x421806);if(!oauth[_0xb3a7('0x52')](_0x35a5eb['id_token'],_0x1594c4['oauth2Claims']))throw new Error(_0xb3a7('0x53'));redis[_0xb3a7('0x54')](_0x35a5eb[_0xb3a7('0x4c')]);return oauth[_0xb3a7('0x55')](_0x35a5eb[_0xb3a7('0x56')],_0x1594c4);})['then'](function(_0x5bc515){_0x1594c4['data5']=_0x5bc515[_0xb3a7('0x57')];_0x1594c4[_0xb3a7('0x58')]=_0x5bc515['refresh_token'];return db[_0xb3a7('0x1f')][_0xb3a7('0x15')]({'data5':_0x1594c4[_0xb3a7('0x59')],'data6':_0x1594c4[_0xb3a7('0x58')]},{'where':{'id':_0x1594c4['id']}});})[_0xb3a7('0x16')](function(){oauth[_0xb3a7('0x5a')](_0x1594c4);socket[_0xb3a7('0x5b')](_0xb3a7('0x5c'),{'id':_0x112533['id']});return;})[_0xb3a7('0x16')](respondWithStatusCode(_0x4fc235,null))['catch'](function(_0x320860){if(_0x112533){socket['emit'](_0xb3a7('0x5d'),{'id':_0x112533['id']});}if(!_0x1594c4){logger[_0xb3a7('0x18')]('Invalid\x20authentication\x20state\x20parameter',_0x320860);return _0x4fc235[_0xb3a7('0xc')](0x1f4)['send'](_0x320860[_0xb3a7('0x5e')]);}logger[_0xb3a7('0x18')](_0xb3a7('0x5f'),_0x1594c4['id'],JSON[_0xb3a7('0x60')](_0x320860));});}; \ No newline at end of file +var _0xc3d1=['type','options','count','includeAll','CloudProvider','findAll','service','MicrosoftAzure','data3','catch','params','keys','length','include','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','Invalid\x20state\x20parameter','parse','state','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','code','data5','access_token','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/encryptor','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','update','then','destroy','stack','name','send','padEnd','slice','index','rawAttributes','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map'];(function(_0x15e634,_0x28558e){var _0x4d5d95=function(_0x5c3a6f){while(--_0x5c3a6f){_0x15e634['push'](_0x15e634['shift']());}};_0x4d5d95(++_0x28558e);}(_0xc3d1,0xf1));var _0x1c3d=function(_0x333800,_0x4b804f){_0x333800=_0x333800-0x0;var _0x378ac8=_0xc3d1[_0x333800];return _0x378ac8;};'use strict';var _=require(_0x1c3d('0x0'));var Redis=require(_0x1c3d('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x1c3d('0x2'));var config=require(_0x1c3d('0x3'));var logger=require('../../config/logger')('api');var db=require(_0x1c3d('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_['defaults'](config[_0x1c3d('0x5')],{'host':_0x1c3d('0x6'),'port':0x18eb});var socket=require(_0x1c3d('0x7'))(new Redis(config[_0x1c3d('0x5')]));var redis=new Redis(config[_0x1c3d('0x5')]);function respondWithStatusCode(_0x6842c1,_0x431dfd){_0x431dfd=_0x431dfd||0xcc;return function(_0x4b2aaa){if(_0x4b2aaa){return _0x6842c1[_0x1c3d('0x8')](_0x431dfd);}return _0x6842c1[_0x1c3d('0x9')](_0x431dfd)[_0x1c3d('0xa')]();};}function respondWithResult(_0x2d5917,_0x2ae053){_0x2ae053=_0x2ae053||0xc8;return function(_0xbc05af){if(_0xbc05af){return _0x2d5917[_0x1c3d('0x9')](_0x2ae053)[_0x1c3d('0xb')](_0xbc05af);}};}function respondWithFilteredResult(_0x2f0110,_0x147a1b){return function(_0x34358f){if(_0x34358f){var _0x43b4be=typeof _0x147a1b['offset']==='undefined'&&typeof _0x147a1b[_0x1c3d('0xc')]===_0x1c3d('0xd');var _0x1a7a06=_0x34358f['count'];var _0x3a1829=_0x43b4be?0x0:_0x147a1b[_0x1c3d('0xe')];var _0x1a7376=_0x43b4be?_0x34358f['count']:_0x147a1b[_0x1c3d('0xe')]+_0x147a1b[_0x1c3d('0xc')];var _0x137f65;if(_0x1a7376>=_0x1a7a06){_0x1a7376=_0x1a7a06;_0x137f65=0xc8;}else{_0x137f65=0xce;}_0x2f0110[_0x1c3d('0x9')](_0x137f65);return _0x2f0110[_0x1c3d('0xf')](_0x1c3d('0x10'),_0x3a1829+'-'+_0x1a7376+'/'+_0x1a7a06)[_0x1c3d('0xb')](_0x34358f);}return null;};}function saveUpdates(_0x201346){return function(_0x5ef8a8){if(_0x5ef8a8){return _0x5ef8a8[_0x1c3d('0x11')](_0x201346)[_0x1c3d('0x12')](function(_0x1c42db){return _0x1c42db;});}return null;};}function removeEntity(_0xb916fb){return function(_0x3ec20f){if(_0x3ec20f){return _0x3ec20f[_0x1c3d('0x13')]()['then'](function(){_0xb916fb[_0x1c3d('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ba60a){return function(_0x7c872f){if(!_0x7c872f){_0x2ba60a['sendStatus'](0x194);}return _0x7c872f;};}function handleError(_0x54c338,_0x1f7023){_0x1f7023=_0x1f7023||0x1f4;return function(_0x17cdc4){logger['error'](_0x17cdc4[_0x1c3d('0x14')]);if(_0x17cdc4[_0x1c3d('0x15')]){delete _0x17cdc4[_0x1c3d('0x15')];}_0x54c338[_0x1c3d('0x9')](_0x1f7023)[_0x1c3d('0x16')](_0x17cdc4);};}function maskClientSecret(_0x3f9dd4){return _[_0x1c3d('0x17')](_0x3f9dd4[_0x1c3d('0x18')](0x0,0x3),0x14,'*');}exports[_0x1c3d('0x19')]=function(_0x1e8e45,_0x58896c){var _0x4ff226={},_0x3ce43={},_0x4f0c84={'count':0x0,'rows':[]};var _0x222751=_['map'](db['CloudProvider'][_0x1c3d('0x1a')],function(_0x433ce4){return{'name':_0x433ce4['fieldName'],'type':_0x433ce4['type']['key']};});_0x3ce43[_0x1c3d('0x1b')]=_['map'](_0x222751,'name');_0x3ce43[_0x1c3d('0x1c')]=_['keys'](_0x1e8e45[_0x1c3d('0x1c')]);_0x3ce43['filters']=_[_0x1c3d('0x1d')](_0x3ce43['model'],_0x3ce43[_0x1c3d('0x1c')]);_0x4ff226[_0x1c3d('0x1e')]=_[_0x1c3d('0x1d')](_0x3ce43['model'],qs[_0x1c3d('0x1f')](_0x1e8e45['query']['fields']));_0x4ff226['attributes']=_0x4ff226[_0x1c3d('0x1e')]['length']?_0x4ff226[_0x1c3d('0x1e')]:_0x3ce43[_0x1c3d('0x1b')];if(!_0x1e8e45['query'][_0x1c3d('0x20')](_0x1c3d('0x21'))){_0x4ff226[_0x1c3d('0xc')]=qs[_0x1c3d('0xc')](_0x1e8e45['query'][_0x1c3d('0xc')]);_0x4ff226['offset']=qs[_0x1c3d('0xe')](_0x1e8e45[_0x1c3d('0x1c')]['offset']);}_0x4ff226[_0x1c3d('0x22')]=qs[_0x1c3d('0x23')](_0x1e8e45[_0x1c3d('0x1c')][_0x1c3d('0x23')]);_0x4ff226[_0x1c3d('0x24')]=qs[_0x1c3d('0x25')](_[_0x1c3d('0x26')](_0x1e8e45[_0x1c3d('0x1c')],_0x3ce43[_0x1c3d('0x25')]),_0x222751);if(_0x1e8e45[_0x1c3d('0x1c')][_0x1c3d('0x27')]){_0x4ff226[_0x1c3d('0x24')]=_['merge'](_0x4ff226['where'],{'$or':_[_0x1c3d('0x28')](_0x222751,function(_0x347b78){if(_0x347b78[_0x1c3d('0x29')]!=='VIRTUAL'){var _0x3e3dbb={};_0x3e3dbb[_0x347b78[_0x1c3d('0x15')]]={'$like':'%'+_0x1e8e45['query'][_0x1c3d('0x27')]+'%'};return _0x3e3dbb;}})});}_0x4ff226=_['merge']({},_0x4ff226,_0x1e8e45[_0x1c3d('0x2a')]);var _0xc0e4c8={'where':_0x4ff226[_0x1c3d('0x24')]};return db['CloudProvider'][_0x1c3d('0x2b')](_0xc0e4c8)[_0x1c3d('0x12')](function(_0x14db9e){_0x4f0c84[_0x1c3d('0x2b')]=_0x14db9e;if(_0x1e8e45[_0x1c3d('0x1c')][_0x1c3d('0x2c')]){_0x4ff226['include']=[{'all':!![]}];}return db[_0x1c3d('0x2d')][_0x1c3d('0x2e')](_0x4ff226);})[_0x1c3d('0x12')](function(_0x26e1c3){_0x4f0c84['rows']=_['map'](_0x26e1c3,function(_0x8bc85c){if(_0x8bc85c[_0x1c3d('0x2f')]===_0x1c3d('0x30')){var _0x4f89c1=encryptor['decryptString'](_0x8bc85c[_0x1c3d('0x31')]);_0x8bc85c[_0x1c3d('0x31')]=maskClientSecret(_0x4f89c1);}return _0x8bc85c;});return _0x4f0c84;})[_0x1c3d('0x12')](respondWithFilteredResult(_0x58896c,_0x4ff226))[_0x1c3d('0x32')](handleError(_0x58896c,null));};exports['show']=function(_0xfca041,_0x1a0b02){var _0x2b2143={'raw':!![],'where':{'id':_0xfca041[_0x1c3d('0x33')]['id']}},_0x2f422b={};_0x2f422b[_0x1c3d('0x1b')]=_[_0x1c3d('0x34')](db[_0x1c3d('0x2d')][_0x1c3d('0x1a')]);_0x2f422b[_0x1c3d('0x1c')]=_['keys'](_0xfca041[_0x1c3d('0x1c')]);_0x2f422b[_0x1c3d('0x25')]=_[_0x1c3d('0x1d')](_0x2f422b['model'],_0x2f422b[_0x1c3d('0x1c')]);_0x2b2143[_0x1c3d('0x1e')]=_['intersection'](_0x2f422b[_0x1c3d('0x1b')],qs[_0x1c3d('0x1f')](_0xfca041[_0x1c3d('0x1c')]['fields']));_0x2b2143[_0x1c3d('0x1e')]=_0x2b2143[_0x1c3d('0x1e')][_0x1c3d('0x35')]?_0x2b2143[_0x1c3d('0x1e')]:_0x2f422b[_0x1c3d('0x1b')];if(_0xfca041[_0x1c3d('0x1c')]['includeAll']){_0x2b2143[_0x1c3d('0x36')]=[{'all':!![]}];}_0x2b2143=_['merge']({},_0x2b2143,_0xfca041[_0x1c3d('0x2a')]);return db[_0x1c3d('0x2d')][_0x1c3d('0x37')](_0x2b2143)['then'](handleEntityNotFound(_0x1a0b02,null))[_0x1c3d('0x12')](function(_0xa3608a){if(_0xa3608a[_0x1c3d('0x2f')]===_0x1c3d('0x30')){var _0xe4680f=encryptor[_0x1c3d('0x38')](_0xa3608a['data3']);_0xa3608a[_0x1c3d('0x31')]=maskClientSecret(_0xe4680f);}return _0xa3608a;})[_0x1c3d('0x12')](respondWithResult(_0x1a0b02,null))[_0x1c3d('0x32')](handleError(_0x1a0b02,null));};exports[_0x1c3d('0x39')]=function(_0x50cb3b,_0x535d59){if(!_0x50cb3b[_0x1c3d('0x3a')][_0x1c3d('0x15')])throw new Error(_0x1c3d('0x3b'));if(!_0x50cb3b[_0x1c3d('0x3a')][_0x1c3d('0x2f')])throw new Error(_0x1c3d('0x3c'));var _0x315058=db[_0x1c3d('0x2d')][_0x1c3d('0x1a')][_0x1c3d('0x2f')][_0x1c3d('0x3d')];if(!_0x315058[_0x1c3d('0x3e')](_0x50cb3b[_0x1c3d('0x3a')]['service']))throw new Error(_0x1c3d('0x3f')+_0x315058[_0x1c3d('0x40')](',\x20'));if(_0x50cb3b['body'][_0x1c3d('0x2f')]===_0x1c3d('0x30')&&_0x50cb3b[_0x1c3d('0x3a')][_0x1c3d('0x31')]){_0x50cb3b['body'][_0x1c3d('0x31')]=encryptor[_0x1c3d('0x41')](_0x50cb3b[_0x1c3d('0x3a')][_0x1c3d('0x31')]);}return db['CloudProvider'][_0x1c3d('0x39')](_0x50cb3b[_0x1c3d('0x3a')],{})[_0x1c3d('0x12')](respondWithResult(_0x535d59,0xc9))[_0x1c3d('0x32')](handleError(_0x535d59,null));};exports[_0x1c3d('0x11')]=function(_0x4a3d0b,_0xd74f8e){if(_0x4a3d0b[_0x1c3d('0x3a')]['id']){delete _0x4a3d0b[_0x1c3d('0x3a')]['id'];}return db['CloudProvider'][_0x1c3d('0x37')]({'where':{'id':_0x4a3d0b[_0x1c3d('0x33')]['id']}})[_0x1c3d('0x12')](handleEntityNotFound(_0xd74f8e,null))['then'](function(_0x2a424e){if(_0x2a424e[_0x1c3d('0x2f')]===_0x1c3d('0x30')&&_0x4a3d0b[_0x1c3d('0x3a')][_0x1c3d('0x31')]){_0x4a3d0b[_0x1c3d('0x3a')][_0x1c3d('0x31')]=encryptor[_0x1c3d('0x41')](_0x4a3d0b['body'][_0x1c3d('0x31')]);}return _0x2a424e;})[_0x1c3d('0x12')](saveUpdates(_0x4a3d0b[_0x1c3d('0x3a')],null))[_0x1c3d('0x12')](respondWithResult(_0xd74f8e,null))[_0x1c3d('0x32')](handleError(_0xd74f8e,null));};exports[_0x1c3d('0x13')]=function(_0x56908f,_0x25fc9f){return db[_0x1c3d('0x2d')][_0x1c3d('0x37')]({'where':{'id':_0x56908f[_0x1c3d('0x33')]['id']}})[_0x1c3d('0x12')](handleEntityNotFound(_0x25fc9f,null))['then'](removeEntity(_0x25fc9f,null))[_0x1c3d('0x32')](handleError(_0x25fc9f,null));};exports[_0x1c3d('0x42')]=function(_0xaaf2ae,_0x308df9){return db[_0x1c3d('0x2d')][_0x1c3d('0x43')]({'where':{'id':_0xaaf2ae[_0x1c3d('0x33')]['id']},'raw':!![]})[_0x1c3d('0x12')](function(_0x2fd95b){if(!_0x2fd95b)return _0x308df9[_0x1c3d('0x8')](0x194);return{'url':oauth[_0x1c3d('0x44')](_0x2fd95b,_0xaaf2ae[_0x1c3d('0x45')]['id'])};})[_0x1c3d('0x12')](respondWithResult(_0x308df9,null))[_0x1c3d('0x32')](handleError(_0x308df9,null));};exports[_0x1c3d('0x46')]=function(_0x48aa54,_0x329443){var _0x3c83bd=_0x48aa54[_0x1c3d('0x3a')];var _0x59cd32;var _0x4ccbc6;if(_0x3c83bd[_0x1c3d('0x47')])throw _0x3c83bd;redis[_0x1c3d('0x48')](_0x3c83bd['state'])[_0x1c3d('0x12')](function(_0x4739ba){if(!_0x4739ba)throw new Error(_0x1c3d('0x49'));_0x59cd32=JSON[_0x1c3d('0x4a')](_0x4739ba);var _0xbdafb9=Buffer['from'](_0x3c83bd[_0x1c3d('0x4b')],_0x1c3d('0x4c'))[_0x1c3d('0x4d')](_0x1c3d('0x4e'));_0x4ccbc6=JSON[_0x1c3d('0x4a')](_0xbdafb9);if(!oauth[_0x1c3d('0x4f')](_0x3c83bd[_0x1c3d('0x50')],_0x59cd32[_0x1c3d('0x51')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x1c3d('0x52')](_0x3c83bd[_0x1c3d('0x4b')]);return oauth['getOauth2MicrosoftAccessToken'](_0x3c83bd[_0x1c3d('0x53')],_0x59cd32);})['then'](function(_0x42d3d9){_0x59cd32[_0x1c3d('0x54')]=_0x42d3d9[_0x1c3d('0x55')];_0x59cd32['data6']=_0x42d3d9[_0x1c3d('0x56')];return db[_0x1c3d('0x2d')][_0x1c3d('0x11')]({'data5':_0x59cd32[_0x1c3d('0x54')],'data6':_0x59cd32[_0x1c3d('0x57')]},{'where':{'id':_0x59cd32['id']}});})['then'](function(){oauth[_0x1c3d('0x58')](_0x59cd32);socket[_0x1c3d('0x59')](_0x1c3d('0x5a'),{'id':_0x4ccbc6['id']});return;})[_0x1c3d('0x12')](respondWithStatusCode(_0x329443,null))[_0x1c3d('0x32')](function(_0x7df9c){if(_0x4ccbc6){socket['emit']('microsoftAuthorization:error',{'id':_0x4ccbc6['id']});}if(!_0x59cd32){logger[_0x1c3d('0x47')](_0x1c3d('0x5b'),_0x7df9c);return _0x329443[_0x1c3d('0x9')](0x1f4)[_0x1c3d('0x16')](_0x7df9c[_0x1c3d('0x5c')]);}logger['error'](_0x1c3d('0x5d'),_0x59cd32['id'],JSON['stringify'](_0x7df9c));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 8400ecd..3757695 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 _0xdc52=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x5c96eb,_0x5404da){var _0x4ddbad=function(_0x5a1225){while(--_0x5a1225){_0x5c96eb['push'](_0x5c96eb['shift']());}};_0x4ddbad(++_0x5404da);}(_0xdc52,0xc6));var _0x2dc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dc5('0x0'));var util=require('util');var logger=require(_0x2dc5('0x1'))('api');var moment=require(_0x2dc5('0x2'));var BPromise=require(_0x2dc5('0x3'));var rp=require(_0x2dc5('0x4'));var fs=require('fs');var path=require(_0x2dc5('0x5'));var rimraf=require(_0x2dc5('0x6'));var config=require('../../config/environment');var attributes=require(_0x2dc5('0x7'));module[_0x2dc5('0x8')]=function(_0x32013d,_0xeaf7c0){return _0x32013d[_0x2dc5('0x9')](_0x2dc5('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa6a=['./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa6a,0x94));var _0xafa6=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xfa6a[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xafa6('0x0'));var util=require('util');var logger=require(_0xafa6('0x1'))('api');var moment=require(_0xafa6('0x2'));var BPromise=require(_0xafa6('0x3'));var rp=require(_0xafa6('0x4'));var fs=require('fs');var path=require(_0xafa6('0x5'));var rimraf=require(_0xafa6('0x6'));var config=require(_0xafa6('0x7'));var attributes=require(_0xafa6('0x8'));module[_0xafa6('0x9')]=function(_0x4d32e5,_0x450309){return _0x4d32e5[_0xafa6('0xa')](_0xafa6('0xb'),attributes,{'tableName':_0xafa6('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 a6cf30f..4814925 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 _0x7754=['form_post','state','prompt','login','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','nonce','exp','then','CloudProvider','refresh_token','data6','data1','data3','POST','replace','access_token','data5','authorization_code','decryptString','bind','intervals','findAll','all','catch','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','data4','response_mode'];(function(_0x41dfab,_0x4034a2){var _0x9a9b72=function(_0x3e7619){while(--_0x3e7619){_0x41dfab['push'](_0x41dfab['shift']());}};_0x9a9b72(++_0x4034a2);}(_0x7754,0xbf));var _0x4775=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x7754[_0x1e6db3];return _0x1de886;};'use strict';var _=require('lodash');var crypto=require(_0x4775('0x0'));var jwt=require(_0x4775('0x1'));var moment=require(_0x4775('0x2'));var Redis=require(_0x4775('0x3'));var rp=require(_0x4775('0x4'));var util=require(_0x4775('0x5'));var encryptor=require(_0x4775('0x6'));var config=require(_0x4775('0x7'));var logger=require('../../config/logger')('api');var schedule=require(_0x4775('0x8'));var db=require(_0x4775('0x9'))['db'];config['redis']=_[_0x4775('0xa')](config[_0x4775('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x4775('0xb')]);var MICROSOFT_AUTH_URL=_0x4775('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x4775('0xd'),'profile',_0x4775('0xe'),_0x4775('0xf'),_0x4775('0x10'),_0x4775('0x11'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x4775('0xd'),_0x4775('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x4775('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x4775('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5bbf62){var _0x583ece=_[_0x4775('0x14')](AZURE_AUTH_SCOPES[_0x5bbf62[_0x4775('0x15')]]);if(_0x5bbf62[_0x4775('0x15')]===_0x4775('0x16'))_0x583ece[_0x4775('0x17')](_0x5bbf62[_0x4775('0x18')]+_0x4775('0x19'));return _0x583ece[_0x4775('0x1a')]('\x20');}function getAccessTokenScope(_0x5db2db){if(_0x5db2db[_0x4775('0x15')]===_0x4775('0x1b'))return _0x4775('0x10');if(_0x5db2db[_0x4775('0x15')]===_0x4775('0x16'))return _0x5db2db[_0x4775('0x18')]+_0x4775('0x19');}function generateMicrosoftAuthorizationUrl(_0x421dd7,_0xb3daa9){var _0x17ec5f=MICROSOFT_AUTH_URL['replace'](_0x4775('0x1c'),_0x421dd7[_0x4775('0x1d')]);var _0x1de488=[_0x4775('0x1e'),_0x4775('0x1f')];var _0x1e5c07=Buffer[_0x4775('0x20')](JSON[_0x4775('0x21')]({'id':_0xb3daa9}))[_0x4775('0x22')](_0x4775('0x23'));var _0x2b293f=crypto[_0x4775('0x24')](0x10)[_0x4775('0x22')](_0x4775('0x25'));var _0x44745a=getAuthorizationScopes(_0x421dd7);var _0x1537eb=[{'key':'client_id','value':_0x421dd7['data1']},{'key':'response_type','value':encodeURIComponent(_0x1de488['join']('\x20'))},{'key':'redirect_uri','value':_0x421dd7[_0x4775('0x26')]},{'key':_0x4775('0x27'),'value':_0x4775('0x28')},{'key':'scope','value':encodeURIComponent(_0x44745a)},{'key':_0x4775('0x29'),'value':_0x1e5c07},{'key':'nonce','value':_0x2b293f},{'key':_0x4775('0x2a'),'value':_0x4775('0x2b')}];var _0x4fa538=_0x17ec5f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x4775('0x14')](_0x1537eb,function(_0x52ab9c){return _0x52ab9c['key']+'='+_0x52ab9c[_0x4775('0x2c')];})[_0x4775('0x1a')]('&');_0x421dd7[_0x4775('0x2d')]={'issuer':_0x17ec5f['replace'](_0x4775('0x2e'),''),'audience':_0x421dd7['data1'],'state':_0x1e5c07,'nonce':_0x2b293f};redis[_0x4775('0x2f')](_0x1e5c07,JSON['stringify'](_0x421dd7));return _0x4fa538;}function isValidIdToken(_0x264e8a,_0x1700af){try{var _0x40fafd=jwt[_0x4775('0x30')](_0x264e8a,{'complete':!![]});var _0x497cf9=_0x40fafd[_0x4775('0x31')];if(_0x497cf9[_0x4775('0x32')]!==_0x1700af[_0x4775('0x33')])return![];if(_0x497cf9[_0x4775('0x34')]!==_0x1700af[_0x4775('0x35')])return![];if(_0x497cf9[_0x4775('0x36')]!==_0x1700af[_0x4775('0x36')])return![];if(moment()['isAfter'](moment['unix'](_0x497cf9[_0x4775('0x37')])))return![];return!![];}catch(_0x1c8c1d){throw _0x1c8c1d;}}function refreshOauth2MicrosoftAccessToken(_0x397293){return Promise['resolve']()[_0x4775('0x38')](function(){if(_0x397293['data3'])return _0x397293;return db[_0x4775('0x39')]['findOne']({'where':{'id':_0x397293['id']},'raw':!![]});})[_0x4775('0x38')](function(_0x536d6c){var _0x451a6e={'grant_type':_0x4775('0x3a'),'refresh_token':_0x536d6c[_0x4775('0x3b')],'scope':getAccessTokenScope(_0x536d6c),'redirect_uri':_0x536d6c['data4'],'client_id':_0x536d6c[_0x4775('0x3c')],'client_secret':encryptor['decryptString'](_0x536d6c[_0x4775('0x3d')])};var _0x517e98={'method':_0x4775('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x4775('0x3f')](_0x4775('0x1c'),_0x536d6c['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x451a6e,'json':!![]};return rp(_0x517e98);})['then'](function(_0x21f23b){_0x397293['data5']=_0x21f23b[_0x4775('0x40')];_0x397293[_0x4775('0x3b')]=_0x21f23b[_0x4775('0x3a')];return db[_0x4775('0x39')]['update']({'data5':_0x397293[_0x4775('0x41')],'data6':_0x397293['data6']},{'where':{'id':_0x397293['id']}});})['then'](function(){return _0x397293;})['catch'](function(_0x512374){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x397293['id'],_0x512374);});}function getOauth2MicrosoftAccessToken(_0x28cc42,_0x404fd3){var _0x2a15f5={'grant_type':_0x4775('0x42'),'code':_0x28cc42,'scope':getAccessTokenScope(_0x404fd3),'redirect_uri':_0x404fd3[_0x4775('0x26')],'client_id':_0x404fd3[_0x4775('0x3c')],'client_secret':encryptor[_0x4775('0x43')](_0x404fd3['data3'])};var _0xe18f94={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x4775('0x3f')](_0x4775('0x1c'),_0x404fd3['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2a15f5,'json':!![]};return rp(_0xe18f94);}function startRefreshInterval(_0x5576dc){var _0xec9fb1=schedule['intervals'];if(_0xec9fb1[_0x5576dc['id']])clearInterval(_0xec9fb1[_0x5576dc['id']]);_0xec9fb1[_0x5576dc['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x4775('0x44')](this,{'id':_0x5576dc['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x4775('0x45')]=_0xec9fb1;}function startAllRefreshIntervals(){return db[_0x4775('0x39')][_0x4775('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x4775('0x38')](function(_0x92a5d7){var _0x3b46d3=_0x92a5d7[_0x4775('0x14')](function(_0x5dfe29){return refreshOauth2MicrosoftAccessToken(_0x5dfe29)[_0x4775('0x38')](function(_0x1d8de6){startRefreshInterval(_0x1d8de6);});});return Promise[_0x4775('0x47')](_0x3b46d3);})[_0x4775('0x48')](function(_0x5cd088){var _0x145e9f=_0x5cd088?util[_0x4775('0x49')](_0x5cd088,{'showHidden':![],'depth':null}):'';logger[_0x4775('0x4a')](_0x4775('0x4b'),_0x145e9f);});}module[_0x4775('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xde47=['util','../../components/encryptor','../../config/environment','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','push','/.default','Outlook365','Dynamics365','data7','replace','{TENANT_ID}','data2','code','id_token','from','stringify','base64','hex','join','redirect_uri','response_mode','scope','state','nonce','login','key','value','oauth2Claims','data1','set','decode','payload','iss','issuer','audience','exp','then','data3','CloudProvider','findOne','refresh_token','data4','decryptString','POST','data5','access_token','data6','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','catch','error','exports','lodash','crypto','ioredis','request-promise'];(function(_0x365ea9,_0x17ec94){var _0xb7a188=function(_0x5028c2){while(--_0x5028c2){_0x365ea9['push'](_0x365ea9['shift']());}};_0xb7a188(++_0x17ec94);}(_0xde47,0x1f4));var _0x7de4=function(_0x8a917c,_0x19c5f6){_0x8a917c=_0x8a917c-0x0;var _0x2c704e=_0xde47[_0x8a917c];return _0x2c704e;};'use strict';var _=require(_0x7de4('0x0'));var crypto=require(_0x7de4('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0x7de4('0x2'));var rp=require(_0x7de4('0x3'));var util=require(_0x7de4('0x4'));var encryptor=require(_0x7de4('0x5'));var config=require(_0x7de4('0x6'));var logger=require('../../config/logger')('api');var schedule=require(_0x7de4('0x7'));var db=require(_0x7de4('0x8'))['db'];config[_0x7de4('0x9')]=_[_0x7de4('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x7de4('0xb'),_0x7de4('0xc'),_0x7de4('0xd'),_0x7de4('0xe'),_0x7de4('0xf'),_0x7de4('0x10'),_0x7de4('0x11')],'Dynamics365':[_0x7de4('0xb'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x7de4('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3142db){var _0x272a19=_[_0x7de4('0x13')](AZURE_AUTH_SCOPES[_0x3142db[_0x7de4('0x14')]]);if(_0x3142db[_0x7de4('0x14')]==='Dynamics365')_0x272a19[_0x7de4('0x15')](_0x3142db['data7']+_0x7de4('0x16'));return _0x272a19['join']('\x20');}function getAccessTokenScope(_0x1f362a){if(_0x1f362a[_0x7de4('0x14')]===_0x7de4('0x17'))return _0x7de4('0xf');if(_0x1f362a['type']===_0x7de4('0x18'))return _0x1f362a[_0x7de4('0x19')]+_0x7de4('0x16');}function generateMicrosoftAuthorizationUrl(_0x5a9fb6,_0x3601a9){var _0x4fe245=MICROSOFT_AUTH_URL[_0x7de4('0x1a')](_0x7de4('0x1b'),_0x5a9fb6[_0x7de4('0x1c')]);var _0x51cbd9=[_0x7de4('0x1d'),_0x7de4('0x1e')];var _0x9c4e2b=Buffer[_0x7de4('0x1f')](JSON[_0x7de4('0x20')]({'id':_0x3601a9}))['toString'](_0x7de4('0x21'));var _0x579b76=crypto['randomBytes'](0x10)['toString'](_0x7de4('0x22'));var _0xc4d2a9=getAuthorizationScopes(_0x5a9fb6);var _0x4bb550=[{'key':'client_id','value':_0x5a9fb6['data1']},{'key':'response_type','value':encodeURIComponent(_0x51cbd9[_0x7de4('0x23')]('\x20'))},{'key':_0x7de4('0x24'),'value':_0x5a9fb6['data4']},{'key':_0x7de4('0x25'),'value':'form_post'},{'key':_0x7de4('0x26'),'value':encodeURIComponent(_0xc4d2a9)},{'key':_0x7de4('0x27'),'value':_0x9c4e2b},{'key':_0x7de4('0x28'),'value':_0x579b76},{'key':'prompt','value':_0x7de4('0x29')}];var _0x36c4ba=_0x4fe245+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7de4('0x13')](_0x4bb550,function(_0xd5c92c){return _0xd5c92c[_0x7de4('0x2a')]+'='+_0xd5c92c[_0x7de4('0x2b')];})[_0x7de4('0x23')]('&');_0x5a9fb6[_0x7de4('0x2c')]={'issuer':_0x4fe245[_0x7de4('0x1a')]('oauth2/',''),'audience':_0x5a9fb6[_0x7de4('0x2d')],'state':_0x9c4e2b,'nonce':_0x579b76};redis[_0x7de4('0x2e')](_0x9c4e2b,JSON[_0x7de4('0x20')](_0x5a9fb6));return _0x36c4ba;}function isValidIdToken(_0x4ab4d9,_0xb83994){try{var _0x1e2069=jwt[_0x7de4('0x2f')](_0x4ab4d9,{'complete':!![]});var _0x2b9ed8=_0x1e2069[_0x7de4('0x30')];if(_0x2b9ed8[_0x7de4('0x31')]!==_0xb83994[_0x7de4('0x32')])return![];if(_0x2b9ed8['aud']!==_0xb83994[_0x7de4('0x33')])return![];if(_0x2b9ed8[_0x7de4('0x28')]!==_0xb83994[_0x7de4('0x28')])return![];if(moment()['isAfter'](moment['unix'](_0x2b9ed8[_0x7de4('0x34')])))return![];return!![];}catch(_0x36ffbc){throw _0x36ffbc;}}function refreshOauth2MicrosoftAccessToken(_0x566e85){return Promise['resolve']()[_0x7de4('0x35')](function(){if(_0x566e85[_0x7de4('0x36')])return _0x566e85;return db[_0x7de4('0x37')][_0x7de4('0x38')]({'where':{'id':_0x566e85['id']},'raw':!![]});})['then'](function(_0x355d16){var _0x153160={'grant_type':_0x7de4('0x39'),'refresh_token':_0x355d16['data6'],'scope':getAccessTokenScope(_0x355d16),'redirect_uri':_0x355d16[_0x7de4('0x3a')],'client_id':_0x355d16[_0x7de4('0x2d')],'client_secret':encryptor[_0x7de4('0x3b')](_0x355d16[_0x7de4('0x36')])};var _0x1c604e={'method':_0x7de4('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x7de4('0x1a')](_0x7de4('0x1b'),_0x355d16[_0x7de4('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x153160,'json':!![]};return rp(_0x1c604e);})[_0x7de4('0x35')](function(_0x1aa77f){_0x566e85[_0x7de4('0x3d')]=_0x1aa77f[_0x7de4('0x3e')];_0x566e85[_0x7de4('0x3f')]=_0x1aa77f[_0x7de4('0x39')];return db[_0x7de4('0x37')][_0x7de4('0x40')]({'data5':_0x566e85[_0x7de4('0x3d')],'data6':_0x566e85['data6']},{'where':{'id':_0x566e85['id']}});})['then'](function(){return _0x566e85;})['catch'](function(_0x258366){logger['error'](_0x7de4('0x41'),_0x566e85['id'],_0x258366);});}function getOauth2MicrosoftAccessToken(_0x452b2f,_0x506707){var _0x4c3618={'grant_type':'authorization_code','code':_0x452b2f,'scope':getAccessTokenScope(_0x506707),'redirect_uri':_0x506707[_0x7de4('0x3a')],'client_id':_0x506707['data1'],'client_secret':encryptor[_0x7de4('0x3b')](_0x506707[_0x7de4('0x36')])};var _0x4cbca8={'method':_0x7de4('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x7de4('0x1a')](_0x7de4('0x1b'),_0x506707[_0x7de4('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4c3618,'json':!![]};return rp(_0x4cbca8);}function startRefreshInterval(_0x1e8257){var _0x4078ef=schedule[_0x7de4('0x42')];if(_0x4078ef[_0x1e8257['id']])clearInterval(_0x4078ef[_0x1e8257['id']]);_0x4078ef[_0x1e8257['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7de4('0x43')](this,{'id':_0x1e8257['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7de4('0x42')]=_0x4078ef;}function startAllRefreshIntervals(){return db[_0x7de4('0x37')][_0x7de4('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x4872bb){var _0x56e8d1=_0x4872bb['map'](function(_0x3d4116){return refreshOauth2MicrosoftAccessToken(_0x3d4116)[_0x7de4('0x35')](function(_0x96c52f){startRefreshInterval(_0x96c52f);});});return Promise['all'](_0x56e8d1);})[_0x7de4('0x45')](function(_0x129214){var _0x2c7579=_0x129214?util['inspect'](_0x129214,{'showHidden':![],'depth':null}):'';logger[_0x7de4('0x46')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x2c7579);});}module[_0x7de4('0x47')]={'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 c7f5a7a..974ffcd 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 _0x6dc0=['rpc','../../config/environment','client','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x8f1bec,_0x50cc92){var _0x16f764=function(_0x46e4b6){while(--_0x46e4b6){_0x8f1bec['push'](_0x8f1bec['shift']());}};_0x16f764(++_0x50cc92);}(_0x6dc0,0xb6));var _0x06dc=function(_0x3b5450,_0x3b7706){_0x3b5450=_0x3b5450-0x0;var _0xf5b86d=_0x6dc0[_0x3b5450];return _0xf5b86d;};'use strict';var _=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var moment=require(_0x06dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x06dc('0x3'));var fs=require('fs');var Redis=require(_0x06dc('0x4'));var db=require(_0x06dc('0x5'))['db'];var utils=require(_0x06dc('0x6'));var logger=require('../../config/logger')(_0x06dc('0x7'));var config=require(_0x06dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x419534,_0x3212ca,_0x14c15b){return new BPromise(function(_0x10e23b,_0x140eef){return client['request'](_0x419534,_0x14c15b)['then'](function(_0x480f30){logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,'request\x20sent');logger[_0x06dc('0xc')](_0x06dc('0xd'),_0x3212ca,_0x06dc('0xe'),JSON[_0x06dc('0xf')](_0x480f30));if(_0x480f30['error']){if(_0x480f30[_0x06dc('0x10')][_0x06dc('0x11')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x3212ca,_0x480f30['error']['message']);return _0x140eef(_0x480f30[_0x06dc('0x10')]['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x3212ca,_0x480f30[_0x06dc('0x10')][_0x06dc('0x12')]);return _0x10e23b(_0x480f30[_0x06dc('0x10')]['message']);}else{logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,_0x06dc('0xe'));_0x10e23b(_0x480f30[_0x06dc('0x13')]['message']);}})[_0x06dc('0x14')](function(_0x30c1c5){logger[_0x06dc('0x10')](_0x06dc('0xb'),_0x3212ca,_0x30c1c5);_0x140eef(_0x30c1c5);});});} \ No newline at end of file +var _0xac35=['request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CloudProvider,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x37a5a7,_0x55aa32){var _0x2f8744=function(_0x41faac){while(--_0x41faac){_0x37a5a7['push'](_0x37a5a7['shift']());}};_0x2f8744(++_0x55aa32);}(_0xac35,0x141));var _0x5ac3=function(_0x37c2ba,_0x57bd44){_0x37c2ba=_0x37c2ba-0x0;var _0x1d8220=_0xac35[_0x37c2ba];return _0x1d8220;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var moment=require(_0x5ac3('0x2'));var BPromise=require(_0x5ac3('0x3'));var rs=require(_0x5ac3('0x4'));var fs=require('fs');var Redis=require(_0x5ac3('0x5'));var db=require(_0x5ac3('0x6'))['db'];var utils=require(_0x5ac3('0x7'));var logger=require(_0x5ac3('0x8'))(_0x5ac3('0x9'));var config=require(_0x5ac3('0xa'));var jayson=require(_0x5ac3('0xb'));var client=jayson[_0x5ac3('0xc')][_0x5ac3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c9a16,_0x77dc9f,_0x5e96cb){return new BPromise(function(_0x2a19b9,_0x1754d2){return client[_0x5ac3('0xe')](_0x4c9a16,_0x5e96cb)[_0x5ac3('0xf')](function(_0x378900){logger[_0x5ac3('0x10')]('CloudProvider,\x20%s,\x20%s',_0x77dc9f,_0x5ac3('0x11'));logger['debug'](_0x5ac3('0x12'),_0x77dc9f,_0x5ac3('0x11'),JSON[_0x5ac3('0x13')](_0x378900));if(_0x378900[_0x5ac3('0x14')]){if(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x15')]===0x1f4){logger[_0x5ac3('0x14')]('CloudProvider,\x20%s,\x20%s',_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x1754d2(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);}logger[_0x5ac3('0x14')](_0x5ac3('0x17'),_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x2a19b9(_0x378900['error']['message']);}else{logger[_0x5ac3('0x10')](_0x5ac3('0x17'),_0x77dc9f,'request\x20sent');_0x2a19b9(_0x378900[_0x5ac3('0x18')]['message']);}})[_0x5ac3('0x19')](function(_0x18cad4){logger[_0x5ac3('0x14')]('CloudProvider,\x20%s,\x20%s',_0x77dc9f,_0x18cad4);_0x1754d2(_0x18cad4);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b30e569..290d01e 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 _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x7a54,0x106));var _0x47a5=function(_0x502d51,_0x193c5f){_0x502d51=_0x502d51-0x0;var _0x5bdc68=_0x7a54[_0x502d51];return _0x5bdc68;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=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(_0x516792,_0x4a6f77){var _0x572f41=function(_0x593c29){while(--_0x593c29){_0x516792['push'](_0x516792['shift']());}};_0x572f41(++_0x4a6f77);}(_0xdb28,0x106));var _0x8db2=function(_0x5677a2,_0x492eaf){_0x5677a2=_0x5677a2-0x0;var _0x483d36=_0xdb28[_0x5677a2];return _0x483d36;};'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 99e2087..124b2eb 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 _0x5541=['STRING','name','sequelize'];(function(_0x37ca5f,_0x7b93d4){var _0x4b0676=function(_0x5e9dbe){while(--_0x5e9dbe){_0x37ca5f['push'](_0x37ca5f['shift']());}};_0x4b0676(++_0x7b93d4);}(_0x5541,0x1df));var _0x1554=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x5541[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x1554('0x0'));module['exports']={'name':{'type':Sequelize[_0x1554('0x1')],'unique':_0x1554('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x1554('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x1554('0x1')]},'type':{'type':Sequelize[_0x1554('0x1')]},'street':{'type':Sequelize[_0x1554('0x1')]},'postalCode':{'type':Sequelize[_0x1554('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1554('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x1554('0x1')]},'sCity':{'type':Sequelize[_0x1554('0x1')]},'sCountry':{'type':Sequelize[_0x1554('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc123=['name','exports','STRING'];(function(_0x59e7e0,_0x3ec148){var _0x26b058=function(_0x212ee2){while(--_0x212ee2){_0x59e7e0['push'](_0x59e7e0['shift']());}};_0x26b058(++_0x3ec148);}(_0xc123,0x193));var _0x3c12=function(_0x35ef6b,_0x4f9e69){_0x35ef6b=_0x35ef6b-0x0;var _0x44127e=_0xc123[_0x35ef6b];return _0x44127e;};'use strict';var Sequelize=require('sequelize');module[_0x3c12('0x0')]={'name':{'type':Sequelize[_0x3c12('0x1')],'unique':_0x3c12('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3c12('0x1')]},'companyId':{'type':Sequelize[_0x3c12('0x1')]},'website':{'type':Sequelize[_0x3c12('0x1')]},'phone':{'type':Sequelize[_0x3c12('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3c12('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3c12('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3c12('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x3c12('0x1')]},'description':{'type':Sequelize[_0x3c12('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 57b53fc..d7651fb 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 _0x035d=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Companies','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','getContacts','findOne','rawAttributes','map','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','send','index','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','length','find','body','user'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x035d,0x11a));var _0xd035=function(_0x4bc84a,_0xbcba3c){_0x4bc84a=_0x4bc84a-0x0;var _0x3f11dd=_0x035d[_0x4bc84a];return _0x3f11dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd035('0x0'));var zipdir=require(_0xd035('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd035('0x2'));var moment=require('moment');var BPromise=require(_0xd035('0x3'));var Mustache=require('mustache');var util=require(_0xd035('0x4'));var path=require('path');var sox=require(_0xd035('0x5'));var csv=require(_0xd035('0x6'));var ejs=require(_0xd035('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd035('0x8'));var squel=require(_0xd035('0x9'));var crypto=require(_0xd035('0xa'));var jsforce=require(_0xd035('0xb'));var deskjs=require(_0xd035('0xc'));var toCsv=require(_0xd035('0x6'));var querystring=require(_0xd035('0xd'));var Papa=require(_0xd035('0xe'));var Redis=require(_0xd035('0xf'));var authService=require(_0xd035('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd035('0x11'));var hardwareService=require(_0xd035('0x12'));var logger=require(_0xd035('0x13'))(_0xd035('0x14'));var utils=require(_0xd035('0x15'));var config=require(_0xd035('0x16'));var licenseUtil=require(_0xd035('0x17'));var db=require(_0xd035('0x18'))['db'];function respondWithStatusCode(_0x58225d,_0x5512ef){_0x5512ef=_0x5512ef||0xcc;return function(_0x20f930){if(_0x20f930){return _0x58225d['sendStatus'](_0x5512ef);}return _0x58225d[_0xd035('0x19')](_0x5512ef)['end']();};}function respondWithResult(_0x54f307,_0x49b13e){_0x49b13e=_0x49b13e||0xc8;return function(_0x2a3470){if(_0x2a3470){return _0x54f307[_0xd035('0x19')](_0x49b13e)[_0xd035('0x1a')](_0x2a3470);}};}function respondWithFilteredResult(_0xcd19c4,_0x4665f9){return function(_0x436876){if(_0x436876){var _0x413e27=typeof _0x4665f9[_0xd035('0x1b')]===_0xd035('0x1c')&&typeof _0x4665f9['limit']==='undefined';var _0x18fca5=_0x436876[_0xd035('0x1d')];var _0x5b811c=_0x413e27?0x0:_0x4665f9[_0xd035('0x1b')];var _0x486e55=_0x413e27?_0x436876['count']:_0x4665f9[_0xd035('0x1b')]+_0x4665f9[_0xd035('0x1e')];var _0x1f248a;if(_0x486e55>=_0x18fca5){_0x486e55=_0x18fca5;_0x1f248a=0xc8;}else{_0x1f248a=0xce;}_0xcd19c4[_0xd035('0x19')](_0x1f248a);return _0xcd19c4[_0xd035('0x1f')](_0xd035('0x20'),_0x5b811c+'-'+_0x486e55+'/'+_0x18fca5)[_0xd035('0x1a')](_0x436876);}return null;};}function patchUpdates(_0x4295ef){return function(_0x459e40){try{jsonpatch[_0xd035('0x21')](_0x459e40,_0x4295ef,!![]);}catch(_0x232283){return BPromise[_0xd035('0x22')](_0x232283);}return _0x459e40['save']();};}function saveUpdates(_0xab851,_0x55371a){return function(_0x15b42b){if(_0x15b42b){return _0x15b42b[_0xd035('0x23')](_0xab851)[_0xd035('0x24')](function(_0x3a63eb){return _0x3a63eb;});}return null;};}function removeEntity(_0x37dd62,_0x3cb8d0){return function(_0x511092){if(_0x511092){return _0x511092[_0xd035('0x25')]()[_0xd035('0x24')](function(){var _0x49e226=_0x511092['get']({'plain':!![]});var _0x32a429='Companies';return db[_0xd035('0x26')][_0xd035('0x25')]({'where':{'type':_0x32a429,'resourceId':_0x49e226['id']}})['then'](function(){return _0x511092;});})[_0xd035('0x24')](function(){_0x37dd62['status'](0xcc)[_0xd035('0x27')]();});}};}function handleEntityNotFound(_0x2b9fb0,_0x573247){return function(_0x177c2c){if(!_0x177c2c){_0x2b9fb0[_0xd035('0x28')](0x194);}return _0x177c2c;};}function handleError(_0x189cf2,_0x4e8138){_0x4e8138=_0x4e8138||0x1f4;return function(_0x31ff69){logger[_0xd035('0x29')](_0x31ff69[_0xd035('0x2a')]);if(_0x31ff69[_0xd035('0x2b')]){delete _0x31ff69[_0xd035('0x2b')];}_0x189cf2[_0xd035('0x19')](_0x4e8138)[_0xd035('0x2c')](_0x31ff69);};}exports[_0xd035('0x2d')]=function(_0x56d0e1,_0x271ae4){var _0x7aaefb={},_0x18ff94={},_0x1511c7={'count':0x0,'rows':[]};return db['CmCompany']['describe']()['then'](function(_0x33f0d0){_0x18ff94[_0xd035('0x2e')]=_[_0xd035('0x2f')](_0x33f0d0);_0x18ff94[_0xd035('0x30')]=_[_0xd035('0x2f')](_0x56d0e1[_0xd035('0x30')]);_0x18ff94[_0xd035('0x31')]=_[_0xd035('0x32')](_0x18ff94[_0xd035('0x2e')],_0x18ff94['query']);_0x7aaefb[_0xd035('0x33')]=_['intersection'](_0x18ff94[_0xd035('0x2e')],qs[_0xd035('0x34')](_0x56d0e1[_0xd035('0x30')][_0xd035('0x34')]));_0x7aaefb[_0xd035('0x33')]=_0x7aaefb[_0xd035('0x33')]['length']?_0x7aaefb['attributes']:_0x18ff94[_0xd035('0x2e')];if(!_0x56d0e1['query'][_0xd035('0x35')](_0xd035('0x36'))){_0x7aaefb[_0xd035('0x1e')]=qs[_0xd035('0x1e')](_0x56d0e1[_0xd035('0x30')][_0xd035('0x1e')]);_0x7aaefb['offset']=qs[_0xd035('0x1b')](_0x56d0e1['query'][_0xd035('0x1b')]);}_0x7aaefb[_0xd035('0x37')]=qs[_0xd035('0x38')](_0x56d0e1[_0xd035('0x30')][_0xd035('0x38')]);_0x7aaefb[_0xd035('0x39')]=qs[_0xd035('0x31')](_[_0xd035('0x3a')](_0x56d0e1[_0xd035('0x30')],_0x18ff94['filters']),_0x33f0d0);if(_0x56d0e1[_0xd035('0x30')][_0xd035('0x3b')]){_0x7aaefb[_0xd035('0x39')]=_[_0xd035('0x3c')](_0x7aaefb['where'],{'$or':_['map'](_0x7aaefb[_0xd035('0x33')],function(_0x5f2f23){var _0x21c90e={};_0x21c90e[_0x5f2f23]={'$like':'%'+_0x56d0e1[_0xd035('0x30')][_0xd035('0x3b')]+'%'};return _0x21c90e;})});}_0x7aaefb=_[_0xd035('0x3c')]({},_0x7aaefb,_0x56d0e1[_0xd035('0x3d')]);var _0x1686f2={'where':_0x7aaefb['where']};return db[_0xd035('0x3e')][_0xd035('0x1d')](_0x1686f2)[_0xd035('0x24')](function(_0x425cde){_0x1511c7[_0xd035('0x1d')]=_0x425cde;if(_0x56d0e1[_0xd035('0x30')][_0xd035('0x3f')]){_0x7aaefb[_0xd035('0x40')]=[{'all':!![]}];}return db[_0xd035('0x3e')][_0xd035('0x41')](_0x7aaefb);})[_0xd035('0x24')](function(_0x3340a9){_0x1511c7[_0xd035('0x42')]=_0x3340a9;return _0x1511c7;})[_0xd035('0x24')](respondWithFilteredResult(_0x271ae4,_0x7aaefb))[_0xd035('0x43')](handleError(_0x271ae4,null));})[_0xd035('0x43')](handleError(_0x271ae4,null));};exports[_0xd035('0x44')]=function(_0x4512b2,_0x7d732f){var _0x5589a4={'raw':![],'where':{'id':_0x4512b2[_0xd035('0x45')]['id']}},_0x190262={};_0x190262[_0xd035('0x2e')]=_['keys'](db[_0xd035('0x3e')]['rawAttributes']);_0x190262['query']=_[_0xd035('0x2f')](_0x4512b2[_0xd035('0x30')]);_0x190262[_0xd035('0x31')]=_[_0xd035('0x32')](_0x190262[_0xd035('0x2e')],_0x190262[_0xd035('0x30')]);_0x5589a4[_0xd035('0x33')]=_[_0xd035('0x32')](_0x190262['model'],qs[_0xd035('0x34')](_0x4512b2[_0xd035('0x30')]['fields']));_0x5589a4['attributes']=_0x5589a4[_0xd035('0x33')][_0xd035('0x46')]?_0x5589a4['attributes']:_0x190262['model'];if(_0x4512b2[_0xd035('0x30')][_0xd035('0x3f')]){_0x5589a4[_0xd035('0x40')]=[{'all':!![]}];}_0x5589a4=_['merge']({},_0x5589a4,_0x4512b2[_0xd035('0x3d')]);return db[_0xd035('0x3e')][_0xd035('0x47')](_0x5589a4)[_0xd035('0x24')](handleEntityNotFound(_0x7d732f,null))[_0xd035('0x24')](respondWithResult(_0x7d732f,null))[_0xd035('0x43')](handleError(_0x7d732f,null));};exports['create']=function(_0x398490,_0x18310f){return db['CmCompany']['create'](_0x398490[_0xd035('0x48')],{})['then'](function(_0x592482){var _0x29dd20=_0x398490[_0xd035('0x49')]['get']({'plain':!![]});if(!_0x29dd20)throw new Error(_0xd035('0x4a'));if(_0x29dd20[_0xd035('0x4b')]===_0xd035('0x49')){var _0x421cc3=_0x592482[_0xd035('0x4c')]({'plain':!![]});var _0x417c27=_0xd035('0x4d');return db['UserProfileSection'][_0xd035('0x47')]({'where':{'name':_0x417c27,'userProfileId':_0x29dd20[_0xd035('0x4e')]},'raw':!![]})['then'](function(_0x1ce94a){if(_0x1ce94a&&_0x1ce94a['autoAssociation']===0x0){return db[_0xd035('0x26')][_0xd035('0x4f')]({'name':_0x421cc3['name'],'resourceId':_0x421cc3['id'],'type':_0x1ce94a['name'],'sectionId':_0x1ce94a['id']},{})[_0xd035('0x24')](function(){return _0x592482;});}else{return _0x592482;}})['catch'](function(_0x476883){logger[_0xd035('0x29')](_0xd035('0x50'),_0x476883);throw _0x476883;});}return _0x592482;})[_0xd035('0x24')](respondWithResult(_0x18310f,0xc9))['catch'](handleError(_0x18310f,null));};exports[_0xd035('0x23')]=function(_0x5915f0,_0x46b41e){if(_0x5915f0[_0xd035('0x48')]['id']){delete _0x5915f0[_0xd035('0x48')]['id'];}return db[_0xd035('0x3e')][_0xd035('0x47')]({'where':{'id':_0x5915f0[_0xd035('0x45')]['id']}})[_0xd035('0x24')](handleEntityNotFound(_0x46b41e,null))['then'](saveUpdates(_0x5915f0[_0xd035('0x48')],null))['then'](respondWithResult(_0x46b41e,null))[_0xd035('0x43')](handleError(_0x46b41e,null));};exports[_0xd035('0x25')]=function(_0x3a472f,_0x467001){return db['CmCompany'][_0xd035('0x47')]({'where':{'id':_0x3a472f[_0xd035('0x45')]['id']}})['then'](handleEntityNotFound(_0x467001,null))[_0xd035('0x24')](removeEntity(_0x467001,null))[_0xd035('0x43')](handleError(_0x467001,null));};exports[_0xd035('0x51')]=function(_0x44b3ca,_0x45ef19){return db[_0xd035('0x3e')][_0xd035('0x51')]()[_0xd035('0x24')](respondWithResult(_0x45ef19,null))['catch'](handleError(_0x45ef19,null));};exports[_0xd035('0x52')]=function(_0x2e57c3,_0x674ce1,_0x215d57){return db[_0xd035('0x53')][_0xd035('0x47')]({'where':{'id':_0x2e57c3[_0xd035('0x45')]['id']}})[_0xd035('0x24')](handleEntityNotFound(_0x674ce1,null))[_0xd035('0x24')](function(_0x56701d){if(_0x56701d){return _0x56701d[_0xd035('0x52')](_0x2e57c3['body'][_0xd035('0x54')],_['omit'](_0x2e57c3['body'],['ids','id'])||{});}})[_0xd035('0x24')](respondWithResult(_0x674ce1,null))[_0xd035('0x43')](handleError(_0x674ce1,null));};exports[_0xd035('0x55')]=function(_0x388c60,_0xc30da8,_0x10da8e){var _0x374f8c={};var _0x470735={};var _0x51bf89;var _0x21cd1f;return db[_0xd035('0x3e')][_0xd035('0x56')]({'where':{'id':_0x388c60[_0xd035('0x45')]['id']}})[_0xd035('0x24')](handleEntityNotFound(_0xc30da8,null))['then'](function(_0x5f5d10){if(_0x5f5d10){_0x51bf89=_0x5f5d10;_0x470735[_0xd035('0x2e')]=_[_0xd035('0x2f')](db[_0xd035('0x53')][_0xd035('0x57')]);_0x470735[_0xd035('0x30')]=_[_0xd035('0x2f')](_0x388c60[_0xd035('0x30')]);_0x470735[_0xd035('0x31')]=_[_0xd035('0x32')](_0x470735[_0xd035('0x2e')],_0x470735[_0xd035('0x30')]);_0x374f8c[_0xd035('0x33')]=_[_0xd035('0x32')](_0x470735[_0xd035('0x2e')],qs['fields'](_0x388c60['query']['fields']));_0x374f8c['attributes']=_0x374f8c[_0xd035('0x33')]['length']?_0x374f8c['attributes']:_0x470735['model'];_0x374f8c['order']=qs[_0xd035('0x38')](_0x388c60[_0xd035('0x30')][_0xd035('0x38')]);_0x374f8c[_0xd035('0x39')]=qs[_0xd035('0x31')](_[_0xd035('0x3a')](_0x388c60['query'],_0x470735['filters']));if(_0x388c60[_0xd035('0x30')]['filter']){_0x374f8c[_0xd035('0x39')]=_[_0xd035('0x3c')](_0x374f8c[_0xd035('0x39')],{'$or':_[_0xd035('0x58')](_0x374f8c['attributes'],function(_0x1a2321){var _0x47bfa4={};_0x47bfa4[_0x1a2321]={'$like':'%'+_0x388c60[_0xd035('0x30')]['filter']+'%'};return _0x47bfa4;})});}_0x374f8c=_['merge']({},_0x374f8c,_0x388c60[_0xd035('0x3d')]);return _0x51bf89['getContacts'](_0x374f8c);}})[_0xd035('0x24')](function(_0x6b6aad){if(_0x6b6aad){_0x21cd1f=_0x6b6aad[_0xd035('0x46')];if(!_0x388c60[_0xd035('0x30')][_0xd035('0x35')](_0xd035('0x36'))){_0x374f8c[_0xd035('0x1e')]=qs[_0xd035('0x1e')](_0x388c60[_0xd035('0x30')][_0xd035('0x1e')]);_0x374f8c[_0xd035('0x1b')]=qs[_0xd035('0x1b')](_0x388c60['query'][_0xd035('0x1b')]);}return _0x51bf89[_0xd035('0x55')](_0x374f8c);}})['then'](function(_0x283395){if(_0x283395){return _0x283395?{'count':_0x21cd1f,'rows':_0x283395}:null;}})[_0xd035('0x24')](respondWithResult(_0xc30da8,null))[_0xd035('0x43')](handleError(_0xc30da8,null));}; \ No newline at end of file +var _0xa405=['length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','addContacts','ids','getContacts','findOne','CmContact','pick','map','options','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','count','offset','status','set','apply','reject','then','get','Companies','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','CmCompany','describe','query','keys','filters','intersection','model','attributes','fields'];(function(_0x2b24d0,_0x49b3d7){var _0x1a2482=function(_0x4c22ad){while(--_0x4c22ad){_0x2b24d0['push'](_0x2b24d0['shift']());}};_0x1a2482(++_0x49b3d7);}(_0xa405,0x17a));var _0x5a40=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa405[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5a40('0x0'));var jsonpatch=require(_0x5a40('0x1'));var rp=require(_0x5a40('0x2'));var moment=require(_0x5a40('0x3'));var BPromise=require(_0x5a40('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5a40('0x5'));var sox=require('sox');var csv=require(_0x5a40('0x6'));var ejs=require(_0x5a40('0x7'));var fs=require('fs');var fs_extra=require(_0x5a40('0x8'));var _=require(_0x5a40('0x9'));var squel=require('squel');var crypto=require(_0x5a40('0xa'));var jsforce=require(_0x5a40('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5a40('0x6'));var querystring=require(_0x5a40('0xc'));var Papa=require(_0x5a40('0xd'));var Redis=require('ioredis');var authService=require(_0x5a40('0xe'));var qs=require(_0x5a40('0xf'));var as=require(_0x5a40('0x10'));var hardwareService=require(_0x5a40('0x11'));var logger=require('../../config/logger')(_0x5a40('0x12'));var utils=require(_0x5a40('0x13'));var config=require(_0x5a40('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a40('0x15'))['db'];function respondWithStatusCode(_0x45e1d4,_0x210d6f){_0x210d6f=_0x210d6f||0xcc;return function(_0x3d3667){if(_0x3d3667){return _0x45e1d4['sendStatus'](_0x210d6f);}return _0x45e1d4['status'](_0x210d6f)[_0x5a40('0x16')]();};}function respondWithResult(_0x30ed53,_0x8e46ed){_0x8e46ed=_0x8e46ed||0xc8;return function(_0x1fb40d){if(_0x1fb40d){return _0x30ed53['status'](_0x8e46ed)[_0x5a40('0x17')](_0x1fb40d);}};}function respondWithFilteredResult(_0x34b51d,_0x26af94){return function(_0x427057){if(_0x427057){var _0xb5fa95=typeof _0x26af94['offset']===_0x5a40('0x18')&&typeof _0x26af94[_0x5a40('0x19')]===_0x5a40('0x18');var _0x2c4162=_0x427057[_0x5a40('0x1a')];var _0x55cf33=_0xb5fa95?0x0:_0x26af94[_0x5a40('0x1b')];var _0x5c0dc1=_0xb5fa95?_0x427057['count']:_0x26af94[_0x5a40('0x1b')]+_0x26af94[_0x5a40('0x19')];var _0x53de0b;if(_0x5c0dc1>=_0x2c4162){_0x5c0dc1=_0x2c4162;_0x53de0b=0xc8;}else{_0x53de0b=0xce;}_0x34b51d[_0x5a40('0x1c')](_0x53de0b);return _0x34b51d[_0x5a40('0x1d')]('Content-Range',_0x55cf33+'-'+_0x5c0dc1+'/'+_0x2c4162)['json'](_0x427057);}return null;};}function patchUpdates(_0x14fa97){return function(_0xc3253d){try{jsonpatch[_0x5a40('0x1e')](_0xc3253d,_0x14fa97,!![]);}catch(_0x548166){return BPromise[_0x5a40('0x1f')](_0x548166);}return _0xc3253d['save']();};}function saveUpdates(_0x42bc67,_0x22a35f){return function(_0x185005){if(_0x185005){return _0x185005['update'](_0x42bc67)[_0x5a40('0x20')](function(_0x131947){return _0x131947;});}return null;};}function removeEntity(_0x3334d1,_0x3121cd){return function(_0x57d253){if(_0x57d253){return _0x57d253['destroy']()[_0x5a40('0x20')](function(){var _0x1d1921=_0x57d253[_0x5a40('0x21')]({'plain':!![]});var _0x9eab1c=_0x5a40('0x22');return db[_0x5a40('0x23')][_0x5a40('0x24')]({'where':{'type':_0x9eab1c,'resourceId':_0x1d1921['id']}})[_0x5a40('0x20')](function(){return _0x57d253;});})[_0x5a40('0x20')](function(){_0x3334d1[_0x5a40('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18cd35,_0x1e80bc){return function(_0x3d9bb9){if(!_0x3d9bb9){_0x18cd35[_0x5a40('0x25')](0x194);}return _0x3d9bb9;};}function handleError(_0x1902e0,_0x2f40c7){_0x2f40c7=_0x2f40c7||0x1f4;return function(_0x2d1f29){logger[_0x5a40('0x26')](_0x2d1f29[_0x5a40('0x27')]);if(_0x2d1f29[_0x5a40('0x28')]){delete _0x2d1f29['name'];}_0x1902e0[_0x5a40('0x1c')](_0x2f40c7)[_0x5a40('0x29')](_0x2d1f29);};}exports[_0x5a40('0x2a')]=function(_0x17046b,_0x162a7c){var _0x5cd22a={},_0x19b0a2={},_0x1ae9ee={'count':0x0,'rows':[]};return db[_0x5a40('0x2b')][_0x5a40('0x2c')]()[_0x5a40('0x20')](function(_0x4f44f2){_0x19b0a2['model']=_['keys'](_0x4f44f2);_0x19b0a2[_0x5a40('0x2d')]=_[_0x5a40('0x2e')](_0x17046b[_0x5a40('0x2d')]);_0x19b0a2[_0x5a40('0x2f')]=_[_0x5a40('0x30')](_0x19b0a2[_0x5a40('0x31')],_0x19b0a2['query']);_0x5cd22a[_0x5a40('0x32')]=_[_0x5a40('0x30')](_0x19b0a2['model'],qs['fields'](_0x17046b[_0x5a40('0x2d')][_0x5a40('0x33')]));_0x5cd22a['attributes']=_0x5cd22a[_0x5a40('0x32')][_0x5a40('0x34')]?_0x5cd22a['attributes']:_0x19b0a2[_0x5a40('0x31')];if(!_0x17046b['query'][_0x5a40('0x35')](_0x5a40('0x36'))){_0x5cd22a[_0x5a40('0x19')]=qs[_0x5a40('0x19')](_0x17046b['query'][_0x5a40('0x19')]);_0x5cd22a[_0x5a40('0x1b')]=qs[_0x5a40('0x1b')](_0x17046b[_0x5a40('0x2d')]['offset']);}_0x5cd22a[_0x5a40('0x37')]=qs[_0x5a40('0x38')](_0x17046b[_0x5a40('0x2d')]['sort']);_0x5cd22a[_0x5a40('0x39')]=qs[_0x5a40('0x2f')](_['pick'](_0x17046b[_0x5a40('0x2d')],_0x19b0a2['filters']),_0x4f44f2);if(_0x17046b['query'][_0x5a40('0x3a')]){_0x5cd22a['where']=_[_0x5a40('0x3b')](_0x5cd22a[_0x5a40('0x39')],{'$or':_['map'](_0x5cd22a[_0x5a40('0x32')],function(_0x20a1a6){var _0x491281={};_0x491281[_0x20a1a6]={'$like':'%'+_0x17046b[_0x5a40('0x2d')][_0x5a40('0x3a')]+'%'};return _0x491281;})});}_0x5cd22a=_[_0x5a40('0x3b')]({},_0x5cd22a,_0x17046b['options']);var _0x16e05c={'where':_0x5cd22a[_0x5a40('0x39')]};return db[_0x5a40('0x2b')][_0x5a40('0x1a')](_0x16e05c)[_0x5a40('0x20')](function(_0x8762fa){_0x1ae9ee[_0x5a40('0x1a')]=_0x8762fa;if(_0x17046b[_0x5a40('0x2d')][_0x5a40('0x3c')]){_0x5cd22a[_0x5a40('0x3d')]=[{'all':!![]}];}return db[_0x5a40('0x2b')][_0x5a40('0x3e')](_0x5cd22a);})['then'](function(_0x183a9e){_0x1ae9ee[_0x5a40('0x3f')]=_0x183a9e;return _0x1ae9ee;})[_0x5a40('0x20')](respondWithFilteredResult(_0x162a7c,_0x5cd22a))[_0x5a40('0x40')](handleError(_0x162a7c,null));})[_0x5a40('0x40')](handleError(_0x162a7c,null));};exports[_0x5a40('0x41')]=function(_0x15fa3a,_0x2ad417){var _0x2f369e={'raw':![],'where':{'id':_0x15fa3a[_0x5a40('0x42')]['id']}},_0x1e7541={};_0x1e7541[_0x5a40('0x31')]=_[_0x5a40('0x2e')](db[_0x5a40('0x2b')][_0x5a40('0x43')]);_0x1e7541[_0x5a40('0x2d')]=_['keys'](_0x15fa3a['query']);_0x1e7541[_0x5a40('0x2f')]=_['intersection'](_0x1e7541['model'],_0x1e7541['query']);_0x2f369e[_0x5a40('0x32')]=_['intersection'](_0x1e7541[_0x5a40('0x31')],qs[_0x5a40('0x33')](_0x15fa3a[_0x5a40('0x2d')][_0x5a40('0x33')]));_0x2f369e[_0x5a40('0x32')]=_0x2f369e[_0x5a40('0x32')]['length']?_0x2f369e['attributes']:_0x1e7541[_0x5a40('0x31')];if(_0x15fa3a[_0x5a40('0x2d')][_0x5a40('0x3c')]){_0x2f369e[_0x5a40('0x3d')]=[{'all':!![]}];}_0x2f369e=_['merge']({},_0x2f369e,_0x15fa3a['options']);return db['CmCompany']['find'](_0x2f369e)[_0x5a40('0x20')](handleEntityNotFound(_0x2ad417,null))[_0x5a40('0x20')](respondWithResult(_0x2ad417,null))[_0x5a40('0x40')](handleError(_0x2ad417,null));};exports[_0x5a40('0x44')]=function(_0x16debb,_0xa6c571){return db[_0x5a40('0x2b')][_0x5a40('0x44')](_0x16debb[_0x5a40('0x45')],{})['then'](function(_0x4ea44f){var _0x21317f=_0x16debb[_0x5a40('0x46')][_0x5a40('0x21')]({'plain':!![]});if(!_0x21317f)throw new Error(_0x5a40('0x47'));if(_0x21317f[_0x5a40('0x48')]==='user'){var _0x308f95=_0x4ea44f['get']({'plain':!![]});var _0x4e7e70=_0x5a40('0x22');return db[_0x5a40('0x49')][_0x5a40('0x4a')]({'where':{'name':_0x4e7e70,'userProfileId':_0x21317f[_0x5a40('0x4b')]},'raw':!![]})[_0x5a40('0x20')](function(_0x40ee41){if(_0x40ee41&&_0x40ee41[_0x5a40('0x4c')]===0x0){return db[_0x5a40('0x23')][_0x5a40('0x44')]({'name':_0x308f95[_0x5a40('0x28')],'resourceId':_0x308f95['id'],'type':_0x40ee41[_0x5a40('0x28')],'sectionId':_0x40ee41['id']},{})[_0x5a40('0x20')](function(){return _0x4ea44f;});}else{return _0x4ea44f;}})[_0x5a40('0x40')](function(_0x5e2364){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e2364);throw _0x5e2364;});}return _0x4ea44f;})[_0x5a40('0x20')](respondWithResult(_0xa6c571,0xc9))[_0x5a40('0x40')](handleError(_0xa6c571,null));};exports[_0x5a40('0x4d')]=function(_0x24cadb,_0x28f277){if(_0x24cadb[_0x5a40('0x45')]['id']){delete _0x24cadb[_0x5a40('0x45')]['id'];}return db[_0x5a40('0x2b')][_0x5a40('0x4a')]({'where':{'id':_0x24cadb[_0x5a40('0x42')]['id']}})['then'](handleEntityNotFound(_0x28f277,null))['then'](saveUpdates(_0x24cadb[_0x5a40('0x45')],null))[_0x5a40('0x20')](respondWithResult(_0x28f277,null))[_0x5a40('0x40')](handleError(_0x28f277,null));};exports['destroy']=function(_0x375e22,_0x50bb3a){return db[_0x5a40('0x2b')][_0x5a40('0x4a')]({'where':{'id':_0x375e22['params']['id']}})[_0x5a40('0x20')](handleEntityNotFound(_0x50bb3a,null))[_0x5a40('0x20')](removeEntity(_0x50bb3a,null))['catch'](handleError(_0x50bb3a,null));};exports[_0x5a40('0x2c')]=function(_0x2d8359,_0x3ad27c){return db[_0x5a40('0x2b')][_0x5a40('0x2c')]()['then'](respondWithResult(_0x3ad27c,null))[_0x5a40('0x40')](handleError(_0x3ad27c,null));};exports[_0x5a40('0x4e')]=function(_0x587e00,_0x4b08f6,_0x35cd92){return db['CmContact'][_0x5a40('0x4a')]({'where':{'id':_0x587e00['params']['id']}})[_0x5a40('0x20')](handleEntityNotFound(_0x4b08f6,null))[_0x5a40('0x20')](function(_0x302d9a){if(_0x302d9a){return _0x302d9a['addContacts'](_0x587e00[_0x5a40('0x45')][_0x5a40('0x4f')],_['omit'](_0x587e00['body'],[_0x5a40('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x4b08f6,null))[_0x5a40('0x40')](handleError(_0x4b08f6,null));};exports[_0x5a40('0x50')]=function(_0x4eab13,_0x1d16da,_0x5d7ba7){var _0x152344={};var _0x3692c8={};var _0x294495;var _0x40652f;return db[_0x5a40('0x2b')][_0x5a40('0x51')]({'where':{'id':_0x4eab13[_0x5a40('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d16da,null))[_0x5a40('0x20')](function(_0x3af824){if(_0x3af824){_0x294495=_0x3af824;_0x3692c8[_0x5a40('0x31')]=_['keys'](db[_0x5a40('0x52')][_0x5a40('0x43')]);_0x3692c8[_0x5a40('0x2d')]=_[_0x5a40('0x2e')](_0x4eab13['query']);_0x3692c8['filters']=_[_0x5a40('0x30')](_0x3692c8['model'],_0x3692c8[_0x5a40('0x2d')]);_0x152344[_0x5a40('0x32')]=_[_0x5a40('0x30')](_0x3692c8[_0x5a40('0x31')],qs[_0x5a40('0x33')](_0x4eab13[_0x5a40('0x2d')]['fields']));_0x152344[_0x5a40('0x32')]=_0x152344[_0x5a40('0x32')][_0x5a40('0x34')]?_0x152344[_0x5a40('0x32')]:_0x3692c8[_0x5a40('0x31')];_0x152344['order']=qs[_0x5a40('0x38')](_0x4eab13['query'][_0x5a40('0x38')]);_0x152344[_0x5a40('0x39')]=qs[_0x5a40('0x2f')](_[_0x5a40('0x53')](_0x4eab13[_0x5a40('0x2d')],_0x3692c8[_0x5a40('0x2f')]));if(_0x4eab13['query']['filter']){_0x152344['where']=_[_0x5a40('0x3b')](_0x152344[_0x5a40('0x39')],{'$or':_[_0x5a40('0x54')](_0x152344[_0x5a40('0x32')],function(_0x3acc50){var _0xbf46e2={};_0xbf46e2[_0x3acc50]={'$like':'%'+_0x4eab13[_0x5a40('0x2d')]['filter']+'%'};return _0xbf46e2;})});}_0x152344=_['merge']({},_0x152344,_0x4eab13[_0x5a40('0x55')]);return _0x294495['getContacts'](_0x152344);}})['then'](function(_0x55a7cf){if(_0x55a7cf){_0x40652f=_0x55a7cf['length'];if(!_0x4eab13['query'][_0x5a40('0x35')](_0x5a40('0x36'))){_0x152344[_0x5a40('0x19')]=qs[_0x5a40('0x19')](_0x4eab13[_0x5a40('0x2d')][_0x5a40('0x19')]);_0x152344[_0x5a40('0x1b')]=qs[_0x5a40('0x1b')](_0x4eab13[_0x5a40('0x2d')]['offset']);}return _0x294495['getContacts'](_0x152344);}})['then'](function(_0x3a1692){if(_0x3a1692){return _0x3a1692?{'count':_0x40652f,'rows':_0x3a1692}:null;}})[_0x5a40('0x20')](respondWithResult(_0x1d16da,null))['catch'](handleError(_0x1d16da,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 2952051..c6c5609 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 _0xd8ac=['api','moment','bluebird','request-promise','path','exports','define','CmCompany','cm_companies','../../config/logger'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd8ac,0x10d));var _0xcd8a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcd8a('0x0'))(_0xcd8a('0x1'));var moment=require(_0xcd8a('0x2'));var BPromise=require(_0xcd8a('0x3'));var rp=require(_0xcd8a('0x4'));var fs=require('fs');var path=require(_0xcd8a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0xcd8a('0x6')]=function(_0x13c5d2,_0x4519d0){return _0x13c5d2[_0xcd8a('0x7')](_0xcd8a('0x8'),attributes,{'tableName':_0xcd8a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6069=['../../config/logger','moment','request-promise','path','rimraf','./cmCompany.attributes','CmCompany','cm_companies','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6069,0x116));var _0x9606=function(_0x33b10b,_0x4e2125){_0x33b10b=_0x33b10b-0x0;var _0x1c360f=_0x6069[_0x33b10b];return _0x1c360f;};'use strict';var _=require(_0x9606('0x0'));var util=require(_0x9606('0x1'));var logger=require(_0x9606('0x2'))('api');var moment=require(_0x9606('0x3'));var BPromise=require('bluebird');var rp=require(_0x9606('0x4'));var fs=require('fs');var path=require(_0x9606('0x5'));var rimraf=require(_0x9606('0x6'));var config=require('../../config/environment');var attributes=require(_0x9606('0x7'));module['exports']=function(_0x578d5b,_0x4c7d1d){return _0x578d5b['define'](_0x9606('0x8'),attributes,{'tableName':_0x9606('0x9'),'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 e3e57c2..4ed91d8 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 _0xbc4b=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','debug'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbc4b,0x98));var _0xbbc4=function(_0x37a02f,_0x570d8e){_0x37a02f=_0x37a02f-0x0;var _0x2a9b39=_0xbc4b[_0x37a02f];return _0x2a9b39;};'use strict';var _=require(_0xbbc4('0x0'));var util=require(_0xbbc4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbbc4('0x2'));var fs=require('fs');var Redis=require(_0xbbc4('0x3'));var db=require(_0xbbc4('0x4'))['db'];var utils=require(_0xbbc4('0x5'));var logger=require(_0xbbc4('0x6'))(_0xbbc4('0x7'));var config=require(_0xbbc4('0x8'));var jayson=require(_0xbbc4('0x9'));var client=jayson[_0xbbc4('0xa')][_0xbbc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x510ea6,_0x59c8e0,_0x523001){return new BPromise(function(_0x215464,_0x2cd34a){return client[_0xbbc4('0xc')](_0x510ea6,_0x523001)[_0xbbc4('0xd')](function(_0x44a866){logger['info'](_0xbbc4('0xe'),_0x59c8e0,'request\x20sent');logger[_0xbbc4('0xf')](_0xbbc4('0x10'),_0x59c8e0,_0xbbc4('0x11'),JSON['stringify'](_0x44a866));if(_0x44a866[_0xbbc4('0x12')]){if(_0x44a866[_0xbbc4('0x12')][_0xbbc4('0x13')]===0x1f4){logger['error'](_0xbbc4('0xe'),_0x59c8e0,_0x44a866[_0xbbc4('0x12')][_0xbbc4('0x14')]);return _0x2cd34a(_0x44a866[_0xbbc4('0x12')]['message']);}logger[_0xbbc4('0x12')](_0xbbc4('0xe'),_0x59c8e0,_0x44a866[_0xbbc4('0x12')]['message']);return _0x215464(_0x44a866[_0xbbc4('0x12')][_0xbbc4('0x14')]);}else{logger[_0xbbc4('0x15')](_0xbbc4('0xe'),_0x59c8e0,_0xbbc4('0x11'));_0x215464(_0x44a866[_0xbbc4('0x16')][_0xbbc4('0x14')]);}})[_0xbbc4('0x17')](function(_0x50853e){logger[_0xbbc4('0x12')](_0xbbc4('0xe'),_0x59c8e0,_0x50853e);_0x2cd34a(_0x50853e);});});} \ No newline at end of file +var _0xb1c4=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x28ea2f,_0x4dd834){var _0x5f3a70=function(_0x4a0b8f){while(--_0x4a0b8f){_0x28ea2f['push'](_0x28ea2f['shift']());}};_0x5f3a70(++_0x4dd834);}(_0xb1c4,0x13d));var _0x4b1c=function(_0x3b2899,_0x39ea95){_0x3b2899=_0x3b2899-0x0;var _0x3baf72=_0xb1c4[_0x3b2899];return _0x3baf72;};'use strict';var _=require(_0x4b1c('0x0'));var util=require(_0x4b1c('0x1'));var moment=require(_0x4b1c('0x2'));var BPromise=require(_0x4b1c('0x3'));var rs=require(_0x4b1c('0x4'));var fs=require('fs');var Redis=require(_0x4b1c('0x5'));var db=require(_0x4b1c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b1c('0x7'))(_0x4b1c('0x8'));var config=require(_0x4b1c('0x9'));var jayson=require(_0x4b1c('0xa'));var client=jayson['client'][_0x4b1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x154c2f,_0x3d9084,_0x24a4af){return new BPromise(function(_0x52112a,_0x51c5ad){return client['request'](_0x154c2f,_0x24a4af)[_0x4b1c('0xc')](function(_0x22b25b){logger[_0x4b1c('0xd')](_0x4b1c('0xe'),_0x3d9084,_0x4b1c('0xf'));logger[_0x4b1c('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x3d9084,_0x4b1c('0xf'),JSON[_0x4b1c('0x11')](_0x22b25b));if(_0x22b25b[_0x4b1c('0x12')]){if(_0x22b25b[_0x4b1c('0x12')][_0x4b1c('0x13')]===0x1f4){logger[_0x4b1c('0x12')](_0x4b1c('0xe'),_0x3d9084,_0x22b25b['error'][_0x4b1c('0x14')]);return _0x51c5ad(_0x22b25b[_0x4b1c('0x12')][_0x4b1c('0x14')]);}logger[_0x4b1c('0x12')](_0x4b1c('0xe'),_0x3d9084,_0x22b25b[_0x4b1c('0x12')][_0x4b1c('0x14')]);return _0x52112a(_0x22b25b[_0x4b1c('0x12')][_0x4b1c('0x14')]);}else{logger[_0x4b1c('0xd')]('CmCompany,\x20%s,\x20%s',_0x3d9084,'request\x20sent');_0x52112a(_0x22b25b[_0x4b1c('0x15')][_0x4b1c('0x14')]);}})['catch'](function(_0x45b44e){logger[_0x4b1c('0x12')]('CmCompany,\x20%s,\x20%s',_0x3d9084,_0x45b44e);_0x51c5ad(_0x45b44e);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ca2b9b7..477fb67 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 _0x0767=['delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update'];(function(_0x1d3a1c,_0x4fb972){var _0x27a392=function(_0x2d5908){while(--_0x2d5908){_0x1d3a1c['push'](_0x1d3a1c['shift']());}};_0x27a392(++_0x4fb972);}(_0x0767,0x75));var _0x7076=function(_0x61eb10,_0x316ffa){_0x61eb10=_0x61eb10-0x0;var _0x369464=_0x0767[_0x61eb10];return _0x369464;};'use strict';var multer=require(_0x7076('0x0'));var util=require(_0x7076('0x1'));var path=require('path');var timeout=require(_0x7076('0x2'));var express=require('express');var router=express[_0x7076('0x3')]();var fs_extra=require(_0x7076('0x4'));var auth=require(_0x7076('0x5'));var interaction=require(_0x7076('0x6'));var config=require(_0x7076('0x7'));var controller=require('./cmCompany.controller');router[_0x7076('0x8')]('/',auth['isAuthenticated'](),controller[_0x7076('0x9')]);router[_0x7076('0x8')](_0x7076('0xa'),auth[_0x7076('0xb')](),controller[_0x7076('0xc')]);router[_0x7076('0x8')](_0x7076('0xd'),auth['isAuthenticated'](),controller[_0x7076('0xe')]);router[_0x7076('0x8')](_0x7076('0xf'),auth[_0x7076('0xb')](),controller[_0x7076('0x10')]);router[_0x7076('0x11')]('/',auth[_0x7076('0xb')](),controller['create']);router[_0x7076('0x11')]('/:id/contacts',auth[_0x7076('0xb')](),controller[_0x7076('0x12')]);router[_0x7076('0x13')]('/:id',auth[_0x7076('0xb')](),controller[_0x7076('0x14')]);router[_0x7076('0x15')](_0x7076('0xd'),auth[_0x7076('0xb')](),controller['destroy']);module[_0x7076('0x16')]=router; \ No newline at end of file +var _0x0517=['update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','post','create','addContacts'];(function(_0x5402e5,_0x1a70bf){var _0x5b216f=function(_0x3afff8){while(--_0x3afff8){_0x5402e5['push'](_0x5402e5['shift']());}};_0x5b216f(++_0x1a70bf);}(_0x0517,0x168));var _0x7051=function(_0x533326,_0xe6c046){_0x533326=_0x533326-0x0;var _0x206839=_0x0517[_0x533326];return _0x206839;};'use strict';var multer=require(_0x7051('0x0'));var util=require(_0x7051('0x1'));var path=require(_0x7051('0x2'));var timeout=require(_0x7051('0x3'));var express=require(_0x7051('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7051('0x5'));var interaction=require(_0x7051('0x6'));var config=require('../../config/environment');var controller=require(_0x7051('0x7'));router[_0x7051('0x8')]('/',auth[_0x7051('0x9')](),controller[_0x7051('0xa')]);router[_0x7051('0x8')]('/describe',auth[_0x7051('0x9')](),controller[_0x7051('0xb')]);router['get'](_0x7051('0xc'),auth[_0x7051('0x9')](),controller[_0x7051('0xd')]);router[_0x7051('0x8')](_0x7051('0xe'),auth[_0x7051('0x9')](),controller['getContacts']);router[_0x7051('0xf')]('/',auth[_0x7051('0x9')](),controller[_0x7051('0x10')]);router['post'](_0x7051('0xe'),auth['isAuthenticated'](),controller[_0x7051('0x11')]);router['put']('/:id',auth[_0x7051('0x9')](),controller[_0x7051('0x12')]);router[_0x7051('0x13')](_0x7051('0xc'),auth['isAuthenticated'](),controller[_0x7051('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 16ecf00..6785cd2 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 _0x71f4=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x2b8278,_0x3c8e43){var _0x13a7e3=function(_0x98c1cc){while(--_0x98c1cc){_0x2b8278['push'](_0x2b8278['shift']());}};_0x13a7e3(++_0x3c8e43);}(_0x71f4,0x1ce));var _0x471f=function(_0x48e1ae,_0x2aa4b2){_0x48e1ae=_0x48e1ae-0x0;var _0x4a8776=_0x71f4[_0x48e1ae];return _0x4a8776;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x471f('0x0')]={'firstName':{'type':Sequelize[_0x471f('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x471f('0x1')]},'postalCode':{'type':Sequelize[_0x471f('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x471f('0x1')]},'dateOfBirth':{'type':Sequelize[_0x471f('0x1')]},'description':{'type':Sequelize[_0x471f('0x2')]},'phone':{'type':Sequelize[_0x471f('0x1')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x471f('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x471f('0x1')]},'fb_data':{'type':Sequelize[_0x471f('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x471f('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x471f('0x1')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x471f('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x471f('0x1')]},'priority':{'type':Sequelize[_0x471f('0x3')](0x2)[_0x471f('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x471f('0x5')],'defaultValue':Sequelize[_0x471f('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x471f('0x3')]}}; \ No newline at end of file +var _0x2170=['STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports'];(function(_0x44f7a9,_0xbbd4a6){var _0x203e5f=function(_0x149df7){while(--_0x149df7){_0x44f7a9['push'](_0x44f7a9['shift']());}};_0x203e5f(++_0xbbd4a6);}(_0x2170,0xcd));var _0x0217=function(_0x4712ef,_0x3622c8){_0x4712ef=_0x4712ef-0x0;var _0x18d2a8=_0x2170[_0x4712ef];return _0x18d2a8;};'use strict';var _=require(_0x0217('0x0'));var Sequelize=require(_0x0217('0x1'));module[_0x0217('0x2')]={'firstName':{'type':Sequelize[_0x0217('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0217('0x3')]},'street':{'type':Sequelize[_0x0217('0x3')]},'postalCode':{'type':Sequelize[_0x0217('0x3')]},'city':{'type':Sequelize[_0x0217('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x0217('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x0217('0x3')]},'mobile':{'type':Sequelize[_0x0217('0x3')]},'fax':{'type':Sequelize[_0x0217('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x0217('0x3')]},'facebook':{'type':Sequelize[_0x0217('0x3')]},'fb_data':{'type':Sequelize[_0x0217('0x3')]},'twitter':{'type':Sequelize[_0x0217('0x3')]},'skype':{'type':Sequelize[_0x0217('0x3')]},'teams':{'type':Sequelize[_0x0217('0x3')]},'viber':{'type':Sequelize[_0x0217('0x3')]},'line':{'type':Sequelize[_0x0217('0x3')]},'wechat':{'type':Sequelize[_0x0217('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x0217('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x0217('0x3')]},'priority':{'type':Sequelize[_0x0217('0x4')](0x2)[_0x0217('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0217('0x6')],'defaultValue':Sequelize[_0x0217('0x7')]},'dialTimezone':{'type':Sequelize[_0x0217('0x3')]},'utcOffset':{'type':Sequelize[_0x0217('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index cbcb5c5..e41e048 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(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 a853f0f..5b61858 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 _0x0815=['hasOwnProperty','hook','exports','../../mysqldb','CmContact','update'];(function(_0x41f02b,_0x342053){var _0x2e7a1e=function(_0x80cb2b){while(--_0x80cb2b){_0x41f02b['push'](_0x41f02b['shift']());}};_0x2e7a1e(++_0x342053);}(_0x0815,0xb1));var _0x5081=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0815[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x5081('0x0'))['db'][_0x5081('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5081('0x2'),'afterDestroy':'remove'};function emitEvent(_0x21bf75){return function(_0x536ce6,_0x17d336,_0x3456bd){CmContactEvents['emit'](_0x21bf75+':'+_0x536ce6['id'],_0x536ce6);CmContactEvents['emit'](_0x21bf75,_0x536ce6);_0x3456bd(null);};}for(var e in events){if(events[_0x5081('0x3')](e)){var event=events[e];CmContact[_0x5081('0x4')](e,emitEvent(event));}}module[_0x5081('0x5')]=CmContactEvents; \ No newline at end of file +var _0xdeac=['events','update','emit','hook'];(function(_0x38fff7,_0x3d2f6f){var _0x335292=function(_0x2c2470){while(--_0x2c2470){_0x38fff7['push'](_0x38fff7['shift']());}};_0x335292(++_0x3d2f6f);}(_0xdeac,0x108));var _0xcdea=function(_0x38448c,_0xf81883){_0x38448c=_0x38448c-0x0;var _0x441f82=_0xdeac[_0x38448c];return _0x441f82;};'use strict';var EventEmitter=require(_0xcdea('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcdea('0x1'),'afterDestroy':'remove'};function emitEvent(_0x561e29){return function(_0x4eb266,_0x34debe,_0x71d53){CmContactEvents[_0xcdea('0x2')](_0x561e29+':'+_0x4eb266['id'],_0x4eb266);CmContactEvents['emit'](_0x561e29,_0x4eb266);_0x71d53(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xcdea('0x3')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 4506de0..0857d04 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 _0x538d=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','dialCheckDuplicateType','Lists','length','always','onlyIfOpen','findAll','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','CmList','List\x20not\x20found','destroy','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','then','timezones','utcOffset','minutes','format','CmHopper','findOne','cmContact,\x20afterCreate\x20','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','Campaign','add'];(function(_0x1e15f9,_0x35b77d){var _0x36acbd=function(_0x5d4609){while(--_0x5d4609){_0x1e15f9['push'](_0x1e15f9['shift']());}};_0x36acbd(++_0x35b77d);}(_0x538d,0x13d));var _0xd538=function(_0x353611,_0x5cb6ef){_0x353611=_0x353611-0x0;var _0x5dc32f=_0x538d[_0x353611];return _0x5dc32f;};'use strict';var _=require(_0xd538('0x0'));var util=require(_0xd538('0x1'));var logger=require(_0xd538('0x2'))(_0xd538('0x3'));var moment=require(_0xd538('0x4'));var BPromise=require(_0xd538('0x5'));var rp=require(_0xd538('0x6'));var fs=require('fs');var path=require(_0xd538('0x7'));var rimraf=require(_0xd538('0x8'));var config=require(_0xd538('0x9'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module['exports']=function(_0x50baa7,_0x432a77){return _0x50baa7['define'](_0xd538('0xa'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xd538('0xb'),'fields':[_0xd538('0xb')]},{'name':_0xd538('0xc'),'fields':[_0xd538('0xd'),_0xd538('0xe'),_0xd538('0xb'),_0xd538('0xf'),_0xd538('0x10'),'email'],'type':_0xd538('0x11')}],'timestamps':!![],'charset':_0xd538('0x12'),'collate':_0xd538('0x13'),'hooks':{'afterCreate':function(_0x2aad0f,_0x3e56ed,_0x205479){var _0x278a64=_0x50baa7[_0xd538('0x14')];var _0x46da79=_0x2aad0f[_0xd538('0x15')]({'plain':!![]});function _0x487962(){return function(_0x3ca4de){logger[_0xd538('0x16')](_0xd538('0x17'),_0xd538('0x18'),util['inspect'](_0x3ca4de,{'showHidden':![],'depth':null}));};}function _0x844971(_0x2992a3,_0x452424){var _0x5e93ab=_0x452424[_0xd538('0x19')]?_0x452424[_0xd538('0x19')]:moment()['format'](_0xd538('0x1a'));return new BPromise(function(_0x5a3b38,_0x17aad2){if(_[_0xd538('0x1b')](_0x452424[_0xd538('0x1c')])){_0x5a3b38({'ret':_0x5e93ab});}else{_0x278a64['VoiceQueue']['findOne']({'where':{'id':_0x2992a3['id']}})[_0xd538('0x1d')](function(_0x1476be){if(!_['isNil'](_0x1476be)){var _0x20a311=_0x1476be[_0xd538('0x1c')];if(!_[_0xd538('0x1b')](_0x20a311)){var _0x4eb4e5=shared[_0xd538('0x1e')];var _0x566d43=_0x4eb4e5[_0x20a311];var _0x536374=_0x4eb4e5[_0x452424[_0xd538('0x1c')]];if(!_['isNil'](_0x566d43)&&!_[_0xd538('0x1b')](_0x536374)){var _0x342321=_0x566d43[_0xd538('0x1f')]-_0x536374['utcOffset'];_0x5e93ab=_0x452424[_0xd538('0x19')]?_0x452424[_0xd538('0x19')]:moment();var _0x6ad233=moment(_0x5e93ab)['add'](_0x342321,_0xd538('0x20'));_0x5a3b38({'ret':_0x6ad233[_0xd538('0x21')](_0xd538('0x1a'))});}else _0x5a3b38({'ret':_0x5e93ab});}else _0x5a3b38({'ret':_0x5e93ab});}else{_0x5a3b38({'ret':_0x5e93ab});}});}});return 0xa;}var _0x48fb41=function(_0x5a7ddc){return new BPromise(function(_0x2ed024,_0x1a6159){_0x844971(_0x5a7ddc,_0x46da79)[_0xd538('0x1d')](function(_0x4ac558){_0x46da79['scheduledat']=_0x4ac558['ret'];_0x278a64[_0xd538('0x22')][_0xd538('0x23')]({'where':{'phone':_0x46da79['phone'],'VoiceQueueId':_0x5a7ddc['id']}})['then'](function(_0x12f5c2){if(!_['isNil'](_0x12f5c2)){throw new Error(_0xd538('0x24')+_0x46da79[_0xd538('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5a7ddc['id']);}return _0x278a64[_0xd538('0x22')]['create']({'phone':_0x46da79[_0xd538('0xb')],'ContactId':_0x46da79['id'],'ListId':_0x46da79['ListId'],'priority':_0x46da79[_0xd538('0x25')]?_0x46da79[_0xd538('0x25')]:0x2,'scheduledat':_0x46da79['scheduledat']?_0x46da79['scheduledat']:moment()[_0xd538('0x21')](_0xd538('0x1a')),'callback':_0x46da79['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x46da79[_0xd538('0x26')]?_0x46da79[_0xd538('0x26')]:undefined,'callbackat':_0x46da79['callbackUniqueid']?moment()[_0xd538('0x21')](_0xd538('0x1a')):undefined,'VoiceQueueId':_0x5a7ddc['id']});})[_0xd538('0x27')](function(_0x3c5bcd){_0x1a6159(_0x3c5bcd);});});});};var _0x3d66a4=function(_0x4d0df9){return new BPromise(function(_0x2add22,_0x24e9b3){_0x844971(_0x4d0df9,_0x46da79)[_0xd538('0x1d')](function(_0x3d87b2){_0x46da79[_0xd538('0x19')]=_0x3d87b2[_0xd538('0x28')];_0x278a64[_0xd538('0x22')][_0xd538('0x23')]({'where':{'phone':_0x46da79[_0xd538('0xb')],'VoiceQueueId':_0x4d0df9['id']}})['then'](function(_0x1295f2){if(!_['isNil'](_0x1295f2)){throw new Error('cmContact,\x20afterCreate\x20'+_0x46da79['phone']+_0xd538('0x29')+_0x4d0df9['id']);}return _0x278a64[_0xd538('0x2a')][_0xd538('0x23')]({'where':{'calleridnum':_0x46da79[_0xd538('0xb')],'VoiceQueueId':_0x4d0df9['id']}});})['then'](function(_0x2d3a3c){if(!_['isNil'](_0x2d3a3c)){throw new Error(_0xd538('0x2b')+_0x46da79['phone']+_0xd538('0x2c')+_0x4d0df9['id']);}return _0x278a64[_0xd538('0x22')][_0xd538('0x2d')]({'phone':_0x46da79[_0xd538('0xb')],'ContactId':_0x46da79['id'],'ListId':_0x46da79['ListId'],'priority':_0x46da79['priority']?_0x46da79[_0xd538('0x25')]:0x2,'scheduledat':_0x46da79['scheduledat']?_0x46da79['scheduledat']:moment()['format'](_0xd538('0x1a')),'callback':_0x46da79[_0xd538('0x26')]?!![]:![],'callbackuniqueid':_0x46da79[_0xd538('0x26')]?_0x46da79[_0xd538('0x26')]:undefined,'callbackat':_0x46da79[_0xd538('0x26')]?moment()[_0xd538('0x21')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4d0df9['id']});})[_0xd538('0x27')](function(_0x14dc54){_0x24e9b3(_0x14dc54);});});});};function _0x10fe2f(){return function(_0x688840){logger[_0xd538('0x16')](_0xd538('0x17'),_0xd538('0x18'),util['inspect'](_0x688840,{'showHidden':![],'depth':null}));};}function _0x5c88b1(_0x1e6ce4,_0x42cab4){var _0x770bd0=_0x42cab4[_0xd538('0x19')]?_0x42cab4['scheduledat']:moment()[_0xd538('0x21')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0xb10dd9,_0x55a77a){if(_[_0xd538('0x1b')](_0x42cab4['dialTimezone'])){_0xb10dd9({'ret':_0x770bd0});}else{_0x278a64[_0xd538('0x2e')][_0xd538('0x23')]({'where':{'id':_0x1e6ce4['id']}})[_0xd538('0x1d')](function(_0x21ffff){if(!_[_0xd538('0x1b')](_0x21ffff)){var _0x7305dd=_0x21ffff[_0xd538('0x1c')];if(!_[_0xd538('0x1b')](_0x7305dd)){var _0x78c7da=shared['timezones'];var _0x33b9d0=_0x78c7da[_0x7305dd];var _0x5927b6=_0x78c7da[_0x42cab4[_0xd538('0x1c')]];if(!_[_0xd538('0x1b')](_0x33b9d0)&&!_[_0xd538('0x1b')](_0x5927b6)){var _0x31080a=_0x33b9d0[_0xd538('0x1f')]-_0x5927b6['utcOffset'];_0x770bd0=_0x42cab4[_0xd538('0x19')]?_0x42cab4['scheduledat']:moment();var _0x8abc0a=moment(_0x770bd0)[_0xd538('0x2f')](_0x31080a,_0xd538('0x20'));_0xb10dd9({'ret':_0x8abc0a[_0xd538('0x21')](_0xd538('0x1a'))});}else _0xb10dd9({'ret':_0x770bd0});}else _0xb10dd9({'ret':_0x770bd0});}else{_0xb10dd9({'ret':_0x770bd0});}});}});return 0xa;}var _0xa0b6e2=function(_0x2cd567){return new BPromise(function(_0x37090a,_0x46880c){_0x5c88b1(_0x2cd567,_0x46da79)[_0xd538('0x1d')](function(_0xd6fd2e){_0x46da79[_0xd538('0x19')]=_0xd6fd2e['ret'];_0x278a64[_0xd538('0x22')]['findOne']({'where':{'phone':_0x46da79[_0xd538('0xb')],'CampaignId':_0x2cd567['id']}})['then'](function(_0x4b7b09){if(!_[_0xd538('0x1b')](_0x4b7b09)){throw new Error(_0xd538('0x24')+_0x46da79[_0xd538('0xb')]+_0xd538('0x30')+_0x2cd567['id']);}return _0x278a64[_0xd538('0x22')][_0xd538('0x2d')]({'phone':_0x46da79[_0xd538('0xb')],'ContactId':_0x46da79['id'],'ListId':_0x46da79[_0xd538('0x31')],'priority':_0x46da79[_0xd538('0x25')]?_0x46da79[_0xd538('0x25')]:0x2,'scheduledat':_0x46da79[_0xd538('0x19')]?_0x46da79['scheduledat']:moment()[_0xd538('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x46da79['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x46da79['callbackUniqueid']?_0x46da79['callbackUniqueid']:undefined,'callbackat':_0x46da79[_0xd538('0x26')]?moment()['format'](_0xd538('0x1a')):undefined,'CampaignId':_0x2cd567['id']});})['catch'](function(_0x4bc489){_0x46880c(_0x4bc489);});});});};var _0x52dea7=function(_0x5de67f){return new BPromise(function(_0x323646,_0x472ecf){_0x5c88b1(_0x5de67f,_0x46da79)[_0xd538('0x1d')](function(_0x515186){_0x46da79[_0xd538('0x19')]=_0x515186[_0xd538('0x28')];_0x278a64['CmHopper'][_0xd538('0x23')]({'where':{'phone':_0x46da79[_0xd538('0xb')],'CampaignId':_0x5de67f['id']}})[_0xd538('0x1d')](function(_0x629bdb){if(!_[_0xd538('0x1b')](_0x629bdb)){throw new Error('cmContact,\x20afterCreate\x20'+_0x46da79['phone']+_0xd538('0x32')+_0x5de67f['id']);}return _0x278a64[_0xd538('0x2a')][_0xd538('0x23')]({'where':{'calleridnum':_0x46da79['phone'],'CampaignId':_0x5de67f['id']}});})['then'](function(_0x300c47){if(!_['isNil'](_0x300c47)){throw new Error(_0xd538('0x2b')+_0x46da79['phone']+_0xd538('0x33')+_0x5de67f['id']);}return _0x278a64['CmHopper'][_0xd538('0x2d')]({'phone':_0x46da79[_0xd538('0xb')],'ContactId':_0x46da79['id'],'ListId':_0x46da79['ListId'],'priority':_0x46da79['priority']?_0x46da79['priority']:0x2,'scheduledat':_0x46da79['scheduledat']?_0x46da79[_0xd538('0x19')]:moment()[_0xd538('0x21')](_0xd538('0x1a')),'callback':_0x46da79[_0xd538('0x26')]?!![]:![],'callbackuniqueid':_0x46da79[_0xd538('0x26')]?_0x46da79[_0xd538('0x26')]:undefined,'callbackat':_0x46da79[_0xd538('0x26')]?moment()[_0xd538('0x21')](_0xd538('0x1a')):undefined,'CampaignId':_0x5de67f['id']});})['catch'](function(_0xbe615f){_0x472ecf(_0xbe615f);});});});};if(_0x46da79['ListId']){_0x278a64[_0xd538('0x34')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0xd538('0x35'),_0xd538('0x1c')],'include':[{'model':_0x278a64['CmList'],'as':_0xd538('0x36'),'where':{'id':_0x46da79['ListId']}}]})[_0xd538('0x1d')](function(_0x3b05a0){if(_0x3b05a0){var _0x546940=[];for(var _0x22d4c2=0x0,_0x505e71;_0x22d4c2<_0x3b05a0[_0xd538('0x37')];_0x22d4c2+=0x1){_0x505e71=_0x3b05a0[_0x22d4c2][_0xd538('0x15')]({'plain':!![]});switch(_0x505e71[_0xd538('0x35')]){case _0xd538('0x38'):_0x3d66a4(_0x505e71)['catch'](_0x487962());break;case _0xd538('0x39'):_0x48fb41(_0x505e71)[_0xd538('0x27')](_0x487962());break;default:_0x5c88b1(_0x505e71,_0x46da79)[_0xd538('0x1d')](function(_0x16c4a3){_0x46da79[_0xd538('0x19')]=_0x16c4a3[_0xd538('0x28')];_0x278a64[_0xd538('0x22')]['create']({'phone':_0x46da79[_0xd538('0xb')],'ContactId':_0x46da79['id'],'ListId':_0x46da79[_0xd538('0x31')],'scheduledat':_0x46da79[_0xd538('0x19')]?_0x46da79['scheduledat']:moment()[_0xd538('0x21')](_0xd538('0x1a')),'priority':_0x46da79[_0xd538('0x25')]?_0x46da79[_0xd538('0x25')]:0x2,'callback':_0x46da79['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x46da79[_0xd538('0x26')]?_0x46da79[_0xd538('0x26')]:undefined,'callbackat':_0x46da79['callbackUniqueid']?moment()[_0xd538('0x21')](_0xd538('0x1a')):undefined,'VoiceQueueId':_0x505e71['id']})[_0xd538('0x27')](_0x487962());});}}}})[_0xd538('0x1d')](function(){return _0x278a64['VoiceQueue'][_0xd538('0x3a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x278a64['CmList'],'as':_0xd538('0x3b'),'where':{'id':_0x46da79[_0xd538('0x31')]}}]})[_0xd538('0x1d')](function(_0x1917dc){if(_0x1917dc){var _0x1666ad=[];for(var _0x3d9add=0x0,_0x373981;_0x3d9add<_0x1917dc[_0xd538('0x37')];_0x3d9add+=0x1){_0x373981=_0x1917dc[_0x3d9add][_0xd538('0x15')]({'plain':!![]});_0x278a64[_0xd538('0x3c')]['create']({'phone':_0x46da79[_0xd538('0xb')],'ContactId':_0x46da79['id'],'ListId':_0x46da79[_0xd538('0x31')],'VoiceQueueId':_0x373981['id']})[_0xd538('0x27')](function(_0x4e1746){logger[_0xd538('0x16')](_0xd538('0x3d'),_0xd538('0x18'),_0x4e1746[_0xd538('0x3e')]);});}}});})[_0xd538('0x1d')](function(){return _0x278a64[_0xd538('0x2e')]['findAll']({'attributes':['id',_0xd538('0x35'),_0xd538('0x1c')],'include':[{'model':_0x278a64[_0xd538('0x3f')],'as':_0xd538('0x36'),'where':{'id':_0x46da79[_0xd538('0x31')]}}]})[_0xd538('0x1d')](function(_0x38d6ea){if(_0x38d6ea){var _0x3778a1=[];for(var _0x27cbee=0x0,_0x13701c;_0x27cbee<_0x38d6ea[_0xd538('0x37')];_0x27cbee+=0x1){_0x13701c=_0x38d6ea[_0x27cbee][_0xd538('0x15')]({'plain':!![]});switch(_0x13701c['dialCheckDuplicateType']){case _0xd538('0x38'):_0x52dea7(_0x13701c)['catch'](_0x10fe2f());break;case _0xd538('0x39'):_0xa0b6e2(_0x13701c)[_0xd538('0x27')](_0x10fe2f());break;default:_0x278a64[_0xd538('0x22')][_0xd538('0x2d')]({'phone':_0x46da79['phone'],'ContactId':_0x46da79['id'],'ListId':_0x46da79['ListId'],'scheduledat':_0x46da79['scheduledat']?_0x46da79[_0xd538('0x19')]:moment()[_0xd538('0x21')](_0xd538('0x1a')),'priority':_0x46da79[_0xd538('0x25')]?_0x46da79[_0xd538('0x25')]:0x2,'callback':_0x46da79['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x46da79[_0xd538('0x26')]?_0x46da79[_0xd538('0x26')]:undefined,'callbackat':_0x46da79[_0xd538('0x26')]?moment()[_0xd538('0x21')](_0xd538('0x1a')):undefined,'CampaignId':_0x13701c['id']})[_0xd538('0x27')](_0x10fe2f());}}}});})[_0xd538('0x1d')](function(){return _0x278a64[_0xd538('0x2e')]['findAll']({'attributes':['id'],'include':[{'model':_0x278a64[_0xd538('0x3f')],'as':'BlackLists','where':{'id':_0x46da79[_0xd538('0x31')]}}]})[_0xd538('0x1d')](function(_0x14dcc3){if(_0x14dcc3){var _0x1244d0=[];for(var _0x374892=0x0,_0xd32b48;_0x374892<_0x14dcc3[_0xd538('0x37')];_0x374892+=0x1){_0xd32b48=_0x14dcc3[_0x374892][_0xd538('0x15')]({'plain':!![]});_0x278a64[_0xd538('0x3c')][_0xd538('0x2d')]({'phone':_0x46da79[_0xd538('0xb')],'ContactId':_0x46da79['id'],'ListId':_0x46da79[_0xd538('0x31')],'CampaignId':_0xd32b48['id']})['catch'](function(_0x397194){logger[_0xd538('0x16')](_0xd538('0x3d'),_0xd538('0x18'),_0x397194[_0xd538('0x3e')]);});}}});})['then'](function(){_0x205479();})['catch'](function(_0x5a42a5){logger[_0xd538('0x16')](_0xd538('0x3d'),_0xd538('0x18'),_0x5a42a5[_0xd538('0x3e')]);_0x205479(_0x5a42a5);});}else{_0x205479(new Error(_0xd538('0x40')));}},'afterDestroy':function(_0x2b5655,_0x58230b,_0x3ce961){var _0x1ae544=_0x50baa7[_0xd538('0x14')];var _0xcda249=_0x2b5655[_0xd538('0x15')]({'plain':!![]});return _0x1ae544[_0xd538('0x22')][_0xd538('0x3a')]({'raw':!![],'where':{'ListId':_0xcda249[_0xd538('0x31')],'ContactId':_0xcda249['id']}})[_0xd538('0x1d')](function(_0x3023b5){if(!_['isEmpty'](_0x3023b5)){var _0x561483=[];for(var _0x5d87b3=0x0;_0x5d87b3<_0x3023b5[_0xd538('0x37')];_0x5d87b3+=0x1){var _0x46f10b=_0x1ae544[_0xd538('0x22')][_0xd538('0x41')]({'where':{'ListId':_0x3023b5[_0x5d87b3]['ListId'],'ContactId':_0x3023b5[_0x5d87b3]['ContactId'],'VoiceQueueId':_0x3023b5[_0x5d87b3][_0xd538('0x42')],'CampaignId':_0x3023b5[_0x5d87b3][_0xd538('0x43')]}});_0x561483[_0xd538('0x44')](_0x46f10b);}return BPromise[_0xd538('0x45')](_0x561483);}})['then'](function(_0x20cf23){logger['info'](_0xd538('0x46'),util[_0xd538('0x47')](_0x20cf23,{'showHidden':![],'depth':null}));_0x3ce961();})[_0xd538('0x27')](function(_0x12e552){logger[_0xd538('0x16')](_0xd538('0x48'),util[_0xd538('0x47')](_0x12e552,{'showHidden':![],'depth':null}));_0x3ce961(_0x12e552);});}}});}; \ No newline at end of file +var _0x250a=['info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','error','cmContact','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','add','minutes','format','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','CmHopperFinal','create','afterCreate','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','get','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','always','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','all'];(function(_0x284f84,_0x1cfd9b){var _0x50a516=function(_0x382884){while(--_0x382884){_0x284f84['push'](_0x284f84['shift']());}};_0x50a516(++_0x1cfd9b);}(_0x250a,0xd2));var _0xa250=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x250a[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xa250('0x0'));var logger=require(_0xa250('0x1'))('api');var moment=require(_0xa250('0x2'));var BPromise=require(_0xa250('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa250('0x4'));var rimraf=require(_0xa250('0x5'));var config=require(_0xa250('0x6'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module[_0xa250('0x7')]=function(_0x476e7f,_0x14a06d){return _0x476e7f[_0xa250('0x8')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xa250('0x9'),'fields':[_0xa250('0x9')]},{'name':'fti_cm_contacts','fields':[_0xa250('0xa'),_0xa250('0xb'),'phone',_0xa250('0xc'),_0xa250('0xd'),_0xa250('0xe')],'type':_0xa250('0xf')}],'timestamps':!![],'charset':_0xa250('0x10'),'collate':_0xa250('0x11'),'hooks':{'afterCreate':function(_0xac7c49,_0x3cf47f,_0x36575e){var _0x198574=_0x476e7f['models'];var _0x1f32d0=_0xac7c49['get']({'plain':!![]});function _0x392bbc(){return function(_0x870b0d){logger[_0xa250('0x12')](_0xa250('0x13'),'afterCreate',util[_0xa250('0x14')](_0x870b0d,{'showHidden':![],'depth':null}));};}function _0x57599e(_0x8fdbd1,_0x81fef2){var _0x30ab44=_0x81fef2[_0xa250('0x15')]?_0x81fef2['scheduledat']:moment()['format'](_0xa250('0x16'));return new BPromise(function(_0x40771a,_0x7d7ddb){if(_['isNil'](_0x81fef2[_0xa250('0x17')])){_0x40771a({'ret':_0x30ab44});}else{_0x198574[_0xa250('0x18')][_0xa250('0x19')]({'where':{'id':_0x8fdbd1['id']}})[_0xa250('0x1a')](function(_0x4fd745){if(!_[_0xa250('0x1b')](_0x4fd745)){var _0x34ceec=_0x4fd745[_0xa250('0x17')];if(!_[_0xa250('0x1b')](_0x34ceec)){var _0x4f2cf6=shared[_0xa250('0x1c')];var _0x43f513=_0x4f2cf6[_0x34ceec];var _0x3e4fd5=_0x4f2cf6[_0x81fef2['dialTimezone']];if(!_[_0xa250('0x1b')](_0x43f513)&&!_[_0xa250('0x1b')](_0x3e4fd5)){var _0x5cb228=_0x43f513[_0xa250('0x1d')]-_0x3e4fd5[_0xa250('0x1d')];_0x30ab44=_0x81fef2['scheduledat']?_0x81fef2[_0xa250('0x15')]:moment();var _0x32aca9=moment(_0x30ab44)[_0xa250('0x1e')](_0x5cb228,_0xa250('0x1f'));_0x40771a({'ret':_0x32aca9[_0xa250('0x20')](_0xa250('0x16'))});}else _0x40771a({'ret':_0x30ab44});}else _0x40771a({'ret':_0x30ab44});}else{_0x40771a({'ret':_0x30ab44});}});}});return 0xa;}var _0xb6122e=function(_0x19e4a0){return new BPromise(function(_0x3a3bce,_0x737238){_0x57599e(_0x19e4a0,_0x1f32d0)[_0xa250('0x1a')](function(_0x3ac8fd){_0x1f32d0[_0xa250('0x15')]=_0x3ac8fd[_0xa250('0x21')];_0x198574[_0xa250('0x22')][_0xa250('0x19')]({'where':{'phone':_0x1f32d0[_0xa250('0x9')],'VoiceQueueId':_0x19e4a0['id']}})[_0xa250('0x1a')](function(_0x4d8e08){if(!_[_0xa250('0x1b')](_0x4d8e08)){throw new Error(_0xa250('0x23')+_0x1f32d0['phone']+_0xa250('0x24')+_0x19e4a0['id']);}return _0x198574['CmHopper']['create']({'phone':_0x1f32d0[_0xa250('0x9')],'ContactId':_0x1f32d0['id'],'ListId':_0x1f32d0[_0xa250('0x25')],'priority':_0x1f32d0[_0xa250('0x26')]?_0x1f32d0['priority']:0x2,'scheduledat':_0x1f32d0[_0xa250('0x15')]?_0x1f32d0['scheduledat']:moment()[_0xa250('0x20')](_0xa250('0x16')),'callback':_0x1f32d0[_0xa250('0x27')]?!![]:![],'callbackuniqueid':_0x1f32d0[_0xa250('0x27')]?_0x1f32d0['callbackUniqueid']:undefined,'callbackat':_0x1f32d0[_0xa250('0x27')]?moment()['format'](_0xa250('0x16')):undefined,'VoiceQueueId':_0x19e4a0['id']});})[_0xa250('0x28')](function(_0x416ad8){_0x737238(_0x416ad8);});});});};var _0x48eadc=function(_0xeaebcf){return new BPromise(function(_0x57dbd4,_0x52b07d){_0x57599e(_0xeaebcf,_0x1f32d0)['then'](function(_0x3468e4){_0x1f32d0[_0xa250('0x15')]=_0x3468e4[_0xa250('0x21')];_0x198574[_0xa250('0x22')]['findOne']({'where':{'phone':_0x1f32d0[_0xa250('0x9')],'VoiceQueueId':_0xeaebcf['id']}})['then'](function(_0x48baa3){if(!_['isNil'](_0x48baa3)){throw new Error(_0xa250('0x23')+_0x1f32d0[_0xa250('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xeaebcf['id']);}return _0x198574[_0xa250('0x29')][_0xa250('0x19')]({'where':{'calleridnum':_0x1f32d0[_0xa250('0x9')],'VoiceQueueId':_0xeaebcf['id']}});})[_0xa250('0x1a')](function(_0x27f369){if(!_[_0xa250('0x1b')](_0x27f369)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x1f32d0[_0xa250('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0xeaebcf['id']);}return _0x198574[_0xa250('0x22')][_0xa250('0x2a')]({'phone':_0x1f32d0[_0xa250('0x9')],'ContactId':_0x1f32d0['id'],'ListId':_0x1f32d0['ListId'],'priority':_0x1f32d0['priority']?_0x1f32d0[_0xa250('0x26')]:0x2,'scheduledat':_0x1f32d0[_0xa250('0x15')]?_0x1f32d0[_0xa250('0x15')]:moment()[_0xa250('0x20')](_0xa250('0x16')),'callback':_0x1f32d0['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1f32d0[_0xa250('0x27')]?_0x1f32d0[_0xa250('0x27')]:undefined,'callbackat':_0x1f32d0['callbackUniqueid']?moment()[_0xa250('0x20')](_0xa250('0x16')):undefined,'VoiceQueueId':_0xeaebcf['id']});})['catch'](function(_0x1ac57d){_0x52b07d(_0x1ac57d);});});});};function _0x47a2dd(){return function(_0x1dd813){logger['error'](_0xa250('0x13'),_0xa250('0x2b'),util[_0xa250('0x14')](_0x1dd813,{'showHidden':![],'depth':null}));};}function _0x5726a5(_0x40f97c,_0x3c58f0){var _0x325a09=_0x3c58f0[_0xa250('0x15')]?_0x3c58f0[_0xa250('0x15')]:moment()[_0xa250('0x20')](_0xa250('0x16'));return new BPromise(function(_0x1b3191,_0x398e99){if(_['isNil'](_0x3c58f0['dialTimezone'])){_0x1b3191({'ret':_0x325a09});}else{_0x198574[_0xa250('0x2c')][_0xa250('0x19')]({'where':{'id':_0x40f97c['id']}})[_0xa250('0x1a')](function(_0x3b0d63){if(!_[_0xa250('0x1b')](_0x3b0d63)){var _0x56c4cf=_0x3b0d63[_0xa250('0x17')];if(!_[_0xa250('0x1b')](_0x56c4cf)){var _0x10971c=shared[_0xa250('0x1c')];var _0x49d696=_0x10971c[_0x56c4cf];var _0x53175e=_0x10971c[_0x3c58f0[_0xa250('0x17')]];if(!_[_0xa250('0x1b')](_0x49d696)&&!_[_0xa250('0x1b')](_0x53175e)){var _0x6a48aa=_0x49d696[_0xa250('0x1d')]-_0x53175e[_0xa250('0x1d')];_0x325a09=_0x3c58f0[_0xa250('0x15')]?_0x3c58f0[_0xa250('0x15')]:moment();var _0x1a3c1f=moment(_0x325a09)['add'](_0x6a48aa,_0xa250('0x1f'));_0x1b3191({'ret':_0x1a3c1f[_0xa250('0x20')](_0xa250('0x16'))});}else _0x1b3191({'ret':_0x325a09});}else _0x1b3191({'ret':_0x325a09});}else{_0x1b3191({'ret':_0x325a09});}});}});return 0xa;}var _0x234e0c=function(_0x5db52a){return new BPromise(function(_0x45e2be,_0x5279e3){_0x5726a5(_0x5db52a,_0x1f32d0)[_0xa250('0x1a')](function(_0x3568ea){_0x1f32d0[_0xa250('0x15')]=_0x3568ea[_0xa250('0x21')];_0x198574['CmHopper'][_0xa250('0x19')]({'where':{'phone':_0x1f32d0[_0xa250('0x9')],'CampaignId':_0x5db52a['id']}})[_0xa250('0x1a')](function(_0x1c602c){if(!_[_0xa250('0x1b')](_0x1c602c)){throw new Error(_0xa250('0x23')+_0x1f32d0['phone']+_0xa250('0x2d')+_0x5db52a['id']);}return _0x198574[_0xa250('0x22')]['create']({'phone':_0x1f32d0[_0xa250('0x9')],'ContactId':_0x1f32d0['id'],'ListId':_0x1f32d0[_0xa250('0x25')],'priority':_0x1f32d0[_0xa250('0x26')]?_0x1f32d0[_0xa250('0x26')]:0x2,'scheduledat':_0x1f32d0[_0xa250('0x15')]?_0x1f32d0[_0xa250('0x15')]:moment()[_0xa250('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1f32d0['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1f32d0[_0xa250('0x27')]?_0x1f32d0[_0xa250('0x27')]:undefined,'callbackat':_0x1f32d0[_0xa250('0x27')]?moment()[_0xa250('0x20')](_0xa250('0x16')):undefined,'CampaignId':_0x5db52a['id']});})[_0xa250('0x28')](function(_0x3472e1){_0x5279e3(_0x3472e1);});});});};var _0x5b674a=function(_0x16f773){return new BPromise(function(_0x195d76,_0x12007f){_0x5726a5(_0x16f773,_0x1f32d0)[_0xa250('0x1a')](function(_0x144c9a){_0x1f32d0[_0xa250('0x15')]=_0x144c9a['ret'];_0x198574['CmHopper'][_0xa250('0x19')]({'where':{'phone':_0x1f32d0[_0xa250('0x9')],'CampaignId':_0x16f773['id']}})[_0xa250('0x1a')](function(_0x3bd797){if(!_[_0xa250('0x1b')](_0x3bd797)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1f32d0[_0xa250('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x16f773['id']);}return _0x198574[_0xa250('0x29')][_0xa250('0x19')]({'where':{'calleridnum':_0x1f32d0[_0xa250('0x9')],'CampaignId':_0x16f773['id']}});})[_0xa250('0x1a')](function(_0xfb293f){if(!_[_0xa250('0x1b')](_0xfb293f)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x1f32d0['phone']+_0xa250('0x2e')+_0x16f773['id']);}return _0x198574[_0xa250('0x22')]['create']({'phone':_0x1f32d0[_0xa250('0x9')],'ContactId':_0x1f32d0['id'],'ListId':_0x1f32d0['ListId'],'priority':_0x1f32d0[_0xa250('0x26')]?_0x1f32d0[_0xa250('0x26')]:0x2,'scheduledat':_0x1f32d0[_0xa250('0x15')]?_0x1f32d0[_0xa250('0x15')]:moment()[_0xa250('0x20')](_0xa250('0x16')),'callback':_0x1f32d0['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1f32d0[_0xa250('0x27')]?_0x1f32d0[_0xa250('0x27')]:undefined,'callbackat':_0x1f32d0[_0xa250('0x27')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x16f773['id']});})[_0xa250('0x28')](function(_0x17c74b){_0x12007f(_0x17c74b);});});});};if(_0x1f32d0['ListId']){_0x198574[_0xa250('0x18')][_0xa250('0x2f')]({'where':{'type':_0xa250('0x30')},'attributes':['id',_0xa250('0x31'),_0xa250('0x17')],'include':[{'model':_0x198574[_0xa250('0x32')],'as':_0xa250('0x33'),'where':{'id':_0x1f32d0[_0xa250('0x25')]}}]})['then'](function(_0x2d8f70){if(_0x2d8f70){var _0x24a729=[];for(var _0x23a500=0x0,_0x3c5f8b;_0x23a500<_0x2d8f70[_0xa250('0x34')];_0x23a500+=0x1){_0x3c5f8b=_0x2d8f70[_0x23a500][_0xa250('0x35')]({'plain':!![]});switch(_0x3c5f8b['dialCheckDuplicateType']){case'always':_0x48eadc(_0x3c5f8b)['catch'](_0x392bbc());break;case _0xa250('0x36'):_0xb6122e(_0x3c5f8b)[_0xa250('0x28')](_0x392bbc());break;default:_0x5726a5(_0x3c5f8b,_0x1f32d0)['then'](function(_0x5b049e){_0x1f32d0[_0xa250('0x15')]=_0x5b049e[_0xa250('0x21')];_0x198574[_0xa250('0x22')][_0xa250('0x2a')]({'phone':_0x1f32d0[_0xa250('0x9')],'ContactId':_0x1f32d0['id'],'ListId':_0x1f32d0['ListId'],'scheduledat':_0x1f32d0['scheduledat']?_0x1f32d0[_0xa250('0x15')]:moment()[_0xa250('0x20')](_0xa250('0x16')),'priority':_0x1f32d0[_0xa250('0x26')]?_0x1f32d0['priority']:0x2,'callback':_0x1f32d0[_0xa250('0x27')]?!![]:![],'callbackuniqueid':_0x1f32d0[_0xa250('0x27')]?_0x1f32d0[_0xa250('0x27')]:undefined,'callbackat':_0x1f32d0['callbackUniqueid']?moment()[_0xa250('0x20')](_0xa250('0x16')):undefined,'VoiceQueueId':_0x3c5f8b['id']})[_0xa250('0x28')](_0x392bbc());});}}}})[_0xa250('0x1a')](function(){return _0x198574[_0xa250('0x18')]['findAll']({'where':{'type':_0xa250('0x30')},'attributes':['id'],'include':[{'model':_0x198574[_0xa250('0x32')],'as':_0xa250('0x37'),'where':{'id':_0x1f32d0[_0xa250('0x25')]}}]})['then'](function(_0x21d7c9){if(_0x21d7c9){var _0x340940=[];for(var _0x1ec0af=0x0,_0x3af576;_0x1ec0af<_0x21d7c9[_0xa250('0x34')];_0x1ec0af+=0x1){_0x3af576=_0x21d7c9[_0x1ec0af][_0xa250('0x35')]({'plain':!![]});_0x198574[_0xa250('0x38')][_0xa250('0x2a')]({'phone':_0x1f32d0['phone'],'ContactId':_0x1f32d0['id'],'ListId':_0x1f32d0['ListId'],'VoiceQueueId':_0x3af576['id']})[_0xa250('0x28')](function(_0x238a12){logger['error'](_0xa250('0x39'),_0xa250('0x2b'),_0x238a12[_0xa250('0x3a')]);});}}});})[_0xa250('0x1a')](function(){return _0x198574['Campaign'][_0xa250('0x2f')]({'attributes':['id',_0xa250('0x31'),_0xa250('0x17')],'include':[{'model':_0x198574[_0xa250('0x32')],'as':'Lists','where':{'id':_0x1f32d0['ListId']}}]})[_0xa250('0x1a')](function(_0x64790b){if(_0x64790b){var _0xfe2bc2=[];for(var _0x36fe3d=0x0,_0x459704;_0x36fe3d<_0x64790b[_0xa250('0x34')];_0x36fe3d+=0x1){_0x459704=_0x64790b[_0x36fe3d][_0xa250('0x35')]({'plain':!![]});switch(_0x459704[_0xa250('0x31')]){case _0xa250('0x3b'):_0x5b674a(_0x459704)['catch'](_0x47a2dd());break;case _0xa250('0x36'):_0x234e0c(_0x459704)[_0xa250('0x28')](_0x47a2dd());break;default:_0x198574[_0xa250('0x22')][_0xa250('0x2a')]({'phone':_0x1f32d0[_0xa250('0x9')],'ContactId':_0x1f32d0['id'],'ListId':_0x1f32d0['ListId'],'scheduledat':_0x1f32d0[_0xa250('0x15')]?_0x1f32d0[_0xa250('0x15')]:moment()[_0xa250('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1f32d0[_0xa250('0x26')]?_0x1f32d0[_0xa250('0x26')]:0x2,'callback':_0x1f32d0[_0xa250('0x27')]?!![]:![],'callbackuniqueid':_0x1f32d0[_0xa250('0x27')]?_0x1f32d0[_0xa250('0x27')]:undefined,'callbackat':_0x1f32d0[_0xa250('0x27')]?moment()[_0xa250('0x20')](_0xa250('0x16')):undefined,'CampaignId':_0x459704['id']})[_0xa250('0x28')](_0x47a2dd());}}}});})[_0xa250('0x1a')](function(){return _0x198574['Campaign'][_0xa250('0x2f')]({'attributes':['id'],'include':[{'model':_0x198574[_0xa250('0x32')],'as':_0xa250('0x37'),'where':{'id':_0x1f32d0[_0xa250('0x25')]}}]})[_0xa250('0x1a')](function(_0x25e7db){if(_0x25e7db){var _0x19c836=[];for(var _0x5690ba=0x0,_0x3aa657;_0x5690ba<_0x25e7db[_0xa250('0x34')];_0x5690ba+=0x1){_0x3aa657=_0x25e7db[_0x5690ba][_0xa250('0x35')]({'plain':!![]});_0x198574['CmHopperBlack']['create']({'phone':_0x1f32d0[_0xa250('0x9')],'ContactId':_0x1f32d0['id'],'ListId':_0x1f32d0[_0xa250('0x25')],'CampaignId':_0x3aa657['id']})[_0xa250('0x28')](function(_0x36f808){logger[_0xa250('0x12')](_0xa250('0x39'),_0xa250('0x2b'),_0x36f808[_0xa250('0x3a')]);});}}});})[_0xa250('0x1a')](function(){_0x36575e();})[_0xa250('0x28')](function(_0xe7b44d){logger[_0xa250('0x12')](_0xa250('0x39'),'afterCreate',_0xe7b44d['message']);_0x36575e(_0xe7b44d);});}else{_0x36575e(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x18dc67,_0x1371ff,_0x76993a){var _0x546aeb=_0x476e7f['models'];var _0x5dfa6a=_0x18dc67[_0xa250('0x35')]({'plain':!![]});return _0x546aeb[_0xa250('0x22')]['findAll']({'raw':!![],'where':{'ListId':_0x5dfa6a[_0xa250('0x25')],'ContactId':_0x5dfa6a['id']}})[_0xa250('0x1a')](function(_0x1e2e60){if(!_[_0xa250('0x3c')](_0x1e2e60)){var _0x2e57e4=[];for(var _0x3c9e36=0x0;_0x3c9e36<_0x1e2e60[_0xa250('0x34')];_0x3c9e36+=0x1){var _0x144032=_0x546aeb['CmHopper'][_0xa250('0x3d')]({'where':{'ListId':_0x1e2e60[_0x3c9e36][_0xa250('0x25')],'ContactId':_0x1e2e60[_0x3c9e36][_0xa250('0x3e')],'VoiceQueueId':_0x1e2e60[_0x3c9e36][_0xa250('0x3f')],'CampaignId':_0x1e2e60[_0x3c9e36][_0xa250('0x40')]}});_0x2e57e4['push'](_0x144032);}return BPromise[_0xa250('0x41')](_0x2e57e4);}})[_0xa250('0x1a')](function(_0x4c67d5){logger[_0xa250('0x42')](_0xa250('0x43'),util['inspect'](_0x4c67d5,{'showHidden':![],'depth':null}));_0x76993a();})['catch'](function(_0x2acd9b){logger['error'](_0xa250('0x44'),util[_0xa250('0x14')](_0x2acd9b,{'showHidden':![],'depth':null}));_0x76993a(_0x2acd9b);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 86f349b..493d96e 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x5ef02a,_0x2f045e){var _0x1973c7=function(_0xbafc46){while(--_0xbafc46){_0x5ef02a['push'](_0x5ef02a['shift']());}};_0x1973c7(++_0x2f045e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3694fd,_0x25fdb4){var _0x4fd162=function(_0x5444ff){while(--_0x5444ff){_0x3694fd['push'](_0x3694fd['shift']());}};_0x4fd162(++_0x25fdb4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 1d25270..5ec2c2b 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 _0x9234=['STRING','sequelize','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9234,0x1bd));var _0x4923=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0x9234[_0x3877c1];return _0x59056a;};'use strict';var Sequelize=require(_0x4923('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x4923('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x4923('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4923('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4923('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x4923('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x4923('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xd816=['INTEGER','sequelize','exports','STRING'];(function(_0x217e0a,_0x540c57){var _0xb30d91=function(_0xedb6d1){while(--_0xedb6d1){_0x217e0a['push'](_0x217e0a['shift']());}};_0xb30d91(++_0x540c57);}(_0xd816,0xd5));var _0x6d81=function(_0x267511,_0x2aeeda){_0x267511=_0x267511-0x0;var _0x24fcb7=_0xd816[_0x267511];return _0x24fcb7;};'use strict';var Sequelize=require(_0x6d81('0x0'));module[_0x6d81('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x6d81('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x6d81('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x6d81('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 73ba17e..884e17d 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 _0x6714=['map','CmContactHasItem','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','name','index'];(function(_0x24717a,_0x33d4a9){var _0x2f4e35=function(_0x21704a){while(--_0x21704a){_0x24717a['push'](_0x24717a['shift']());}};_0x2f4e35(++_0x33d4a9);}(_0x6714,0x1be));var _0x4671=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0x6714[_0x2a8c21];return _0x5f3061;};'use strict';var emlformat=require(_0x4671('0x0'));var rimraf=require(_0x4671('0x1'));var zipdir=require(_0x4671('0x2'));var jsonpatch=require(_0x4671('0x3'));var rp=require(_0x4671('0x4'));var moment=require(_0x4671('0x5'));var BPromise=require(_0x4671('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4671('0x7'));var sox=require('sox');var csv=require(_0x4671('0x8'));var ejs=require(_0x4671('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4671('0xa'));var squel=require(_0x4671('0xb'));var crypto=require('crypto');var jsforce=require(_0x4671('0xc'));var deskjs=require(_0x4671('0xd'));var toCsv=require(_0x4671('0x8'));var querystring=require(_0x4671('0xe'));var Papa=require('papaparse');var Redis=require(_0x4671('0xf'));var authService=require(_0x4671('0x10'));var qs=require(_0x4671('0x11'));var as=require(_0x4671('0x12'));var hardwareService=require(_0x4671('0x13'));var logger=require(_0x4671('0x14'))(_0x4671('0x15'));var utils=require(_0x4671('0x16'));var config=require(_0x4671('0x17'));var licenseUtil=require(_0x4671('0x18'));var db=require(_0x4671('0x19'))['db'];function respondWithStatusCode(_0x57059a,_0x138051){_0x138051=_0x138051||0xcc;return function(_0x4d6ae3){if(_0x4d6ae3){return _0x57059a[_0x4671('0x1a')](_0x138051);}return _0x57059a['status'](_0x138051)[_0x4671('0x1b')]();};}function respondWithResult(_0x8ffb85,_0xdf94f1){_0xdf94f1=_0xdf94f1||0xc8;return function(_0x41f1d0){if(_0x41f1d0){return _0x8ffb85[_0x4671('0x1c')](_0xdf94f1)[_0x4671('0x1d')](_0x41f1d0);}};}function respondWithFilteredResult(_0x559dff,_0x34a2c5){return function(_0x170554){if(_0x170554){var _0x44805e=typeof _0x34a2c5[_0x4671('0x1e')]==='undefined'&&typeof _0x34a2c5[_0x4671('0x1f')]==='undefined';var _0x1163df=_0x170554['count'];var _0x217991=_0x44805e?0x0:_0x34a2c5['offset'];var _0xc11673=_0x44805e?_0x170554[_0x4671('0x20')]:_0x34a2c5['offset']+_0x34a2c5[_0x4671('0x1f')];var _0x29b60e;if(_0xc11673>=_0x1163df){_0xc11673=_0x1163df;_0x29b60e=0xc8;}else{_0x29b60e=0xce;}_0x559dff['status'](_0x29b60e);return _0x559dff[_0x4671('0x21')](_0x4671('0x22'),_0x217991+'-'+_0xc11673+'/'+_0x1163df)[_0x4671('0x1d')](_0x170554);}return null;};}function patchUpdates(_0x276114){return function(_0x48d2e2){try{jsonpatch[_0x4671('0x23')](_0x48d2e2,_0x276114,!![]);}catch(_0x3370bd){return BPromise[_0x4671('0x24')](_0x3370bd);}return _0x48d2e2[_0x4671('0x25')]();};}function saveUpdates(_0x1acba7,_0x6c4594){return function(_0xaf5b8f){if(_0xaf5b8f){return _0xaf5b8f[_0x4671('0x26')](_0x1acba7)[_0x4671('0x27')](function(_0x3528a7){return _0x3528a7;});}return null;};}function removeEntity(_0x22d04e,_0xca7e45){return function(_0x3dc2f5){if(_0x3dc2f5){return _0x3dc2f5['destroy']()[_0x4671('0x27')](function(){var _0x37919f=_0x3dc2f5[_0x4671('0x28')]({'plain':!![]});var _0x329cec=_0x4671('0x29');return db[_0x4671('0x2a')][_0x4671('0x2b')]({'where':{'type':_0x329cec,'resourceId':_0x37919f['id']}})['then'](function(){return _0x3dc2f5;});})['then'](function(){_0x22d04e[_0x4671('0x1c')](0xcc)[_0x4671('0x1b')]();});}};}function handleEntityNotFound(_0x554344,_0x334254){return function(_0x12f77e){if(!_0x12f77e){_0x554344[_0x4671('0x1a')](0x194);}return _0x12f77e;};}function handleError(_0xd3cb16,_0x2c5ea6){_0x2c5ea6=_0x2c5ea6||0x1f4;return function(_0x3c6e98){logger['error'](_0x3c6e98['stack']);if(_0x3c6e98[_0x4671('0x2c')]){delete _0x3c6e98[_0x4671('0x2c')];}_0xd3cb16[_0x4671('0x1c')](_0x2c5ea6)['send'](_0x3c6e98);};}exports[_0x4671('0x2d')]=function(_0x574e7a,_0x25e992){var _0x486b3b={},_0x13514f={},_0x432af5={'count':0x0,'rows':[]};var _0x177c51=_[_0x4671('0x2e')](db[_0x4671('0x2f')][_0x4671('0x30')],function(_0x40fa16){return{'name':_0x40fa16['fieldName'],'type':_0x40fa16[_0x4671('0x31')]['key']};});_0x13514f[_0x4671('0x32')]=_[_0x4671('0x2e')](_0x177c51,'name');_0x13514f['query']=_['keys'](_0x574e7a[_0x4671('0x33')]);_0x13514f[_0x4671('0x34')]=_[_0x4671('0x35')](_0x13514f['model'],_0x13514f[_0x4671('0x33')]);_0x486b3b[_0x4671('0x36')]=_['intersection'](_0x13514f[_0x4671('0x32')],qs[_0x4671('0x37')](_0x574e7a[_0x4671('0x33')]['fields']));_0x486b3b['attributes']=_0x486b3b[_0x4671('0x36')][_0x4671('0x38')]?_0x486b3b[_0x4671('0x36')]:_0x13514f['model'];if(!_0x574e7a[_0x4671('0x33')]['hasOwnProperty'](_0x4671('0x39'))){_0x486b3b[_0x4671('0x1f')]=qs[_0x4671('0x1f')](_0x574e7a['query'][_0x4671('0x1f')]);_0x486b3b[_0x4671('0x1e')]=qs[_0x4671('0x1e')](_0x574e7a[_0x4671('0x33')][_0x4671('0x1e')]);}_0x486b3b[_0x4671('0x3a')]=qs['sort'](_0x574e7a[_0x4671('0x33')][_0x4671('0x3b')]);_0x486b3b['where']=qs[_0x4671('0x34')](_[_0x4671('0x3c')](_0x574e7a[_0x4671('0x33')],_0x13514f[_0x4671('0x34')]),_0x177c51);if(_0x574e7a[_0x4671('0x33')]['filter']){_0x486b3b[_0x4671('0x3d')]=_[_0x4671('0x3e')](_0x486b3b['where'],{'$or':_[_0x4671('0x2e')](_0x177c51,function(_0x315fab){if(_0x315fab[_0x4671('0x31')]!==_0x4671('0x3f')){var _0x48c3fd={};_0x48c3fd[_0x315fab[_0x4671('0x2c')]]={'$like':'%'+_0x574e7a[_0x4671('0x33')]['filter']+'%'};return _0x48c3fd;}})});}_0x486b3b=_['merge']({},_0x486b3b,_0x574e7a[_0x4671('0x40')]);var _0x18327a={'where':_0x486b3b['where']};return db[_0x4671('0x2f')][_0x4671('0x20')](_0x18327a)['then'](function(_0x18bfbb){_0x432af5['count']=_0x18bfbb;if(_0x574e7a[_0x4671('0x33')]['includeAll']){_0x486b3b[_0x4671('0x41')]=[{'all':!![]}];}return db[_0x4671('0x2f')][_0x4671('0x42')](_0x486b3b);})[_0x4671('0x27')](function(_0x2a0306){_0x432af5[_0x4671('0x43')]=_0x2a0306;return _0x432af5;})['then'](respondWithFilteredResult(_0x25e992,_0x486b3b))['catch'](handleError(_0x25e992,null));};exports['show']=function(_0x25465d,_0x18785c){var _0x5ad755={'raw':!![],'where':{'id':_0x25465d[_0x4671('0x44')]['id']}},_0x139ffd={};_0x139ffd[_0x4671('0x32')]=_[_0x4671('0x45')](db[_0x4671('0x2f')][_0x4671('0x30')]);_0x139ffd[_0x4671('0x33')]=_[_0x4671('0x45')](_0x25465d[_0x4671('0x33')]);_0x139ffd['filters']=_['intersection'](_0x139ffd[_0x4671('0x32')],_0x139ffd[_0x4671('0x33')]);_0x5ad755[_0x4671('0x36')]=_['intersection'](_0x139ffd[_0x4671('0x32')],qs['fields'](_0x25465d['query']['fields']));_0x5ad755[_0x4671('0x36')]=_0x5ad755[_0x4671('0x36')][_0x4671('0x38')]?_0x5ad755[_0x4671('0x36')]:_0x139ffd[_0x4671('0x32')];if(_0x25465d[_0x4671('0x33')][_0x4671('0x46')]){_0x5ad755[_0x4671('0x41')]=[{'all':!![]}];}_0x5ad755=_['merge']({},_0x5ad755,_0x25465d['options']);return db['CmContactHasItem'][_0x4671('0x47')](_0x5ad755)[_0x4671('0x27')](handleEntityNotFound(_0x18785c,null))[_0x4671('0x27')](respondWithResult(_0x18785c,null))[_0x4671('0x48')](handleError(_0x18785c,null));};exports[_0x4671('0x49')]=function(_0x2da1c1,_0x1aaa66){return db[_0x4671('0x2f')][_0x4671('0x49')](_0x2da1c1[_0x4671('0x4a')],{})[_0x4671('0x27')](function(_0x2b35af){var _0x144419=_0x2da1c1[_0x4671('0x4b')]['get']({'plain':!![]});if(!_0x144419)throw new Error(_0x4671('0x4c'));if(_0x144419[_0x4671('0x4d')]===_0x4671('0x4b')){var _0x4198ca=_0x2b35af[_0x4671('0x28')]({'plain':!![]});var _0x124aaa='CmContactHasItems';return db[_0x4671('0x4e')][_0x4671('0x47')]({'where':{'name':_0x124aaa,'userProfileId':_0x144419['userProfileId']},'raw':!![]})[_0x4671('0x27')](function(_0x2af6ca){if(_0x2af6ca&&_0x2af6ca[_0x4671('0x4f')]===0x0){return db[_0x4671('0x2a')][_0x4671('0x49')]({'name':_0x4198ca[_0x4671('0x2c')],'resourceId':_0x4198ca['id'],'type':_0x2af6ca[_0x4671('0x2c')],'sectionId':_0x2af6ca['id']},{})['then'](function(){return _0x2b35af;});}else{return _0x2b35af;}})[_0x4671('0x48')](function(_0x58c543){logger[_0x4671('0x50')](_0x4671('0x51'),_0x58c543);throw _0x58c543;});}return _0x2b35af;})[_0x4671('0x27')](respondWithResult(_0x1aaa66,0xc9))['catch'](handleError(_0x1aaa66,null));};exports[_0x4671('0x26')]=function(_0x10a9c1,_0x5a65ac){if(_0x10a9c1[_0x4671('0x4a')]['id']){delete _0x10a9c1[_0x4671('0x4a')]['id'];}return db[_0x4671('0x2f')][_0x4671('0x47')]({'where':{'id':_0x10a9c1[_0x4671('0x44')]['id']}})[_0x4671('0x27')](handleEntityNotFound(_0x5a65ac,null))[_0x4671('0x27')](saveUpdates(_0x10a9c1[_0x4671('0x4a')],null))['then'](respondWithResult(_0x5a65ac,null))[_0x4671('0x48')](handleError(_0x5a65ac,null));};exports[_0x4671('0x2b')]=function(_0x10a785,_0x91ab28){return db[_0x4671('0x2f')][_0x4671('0x47')]({'where':{'id':_0x10a785[_0x4671('0x44')]['id']}})[_0x4671('0x27')](handleEntityNotFound(_0x91ab28,null))[_0x4671('0x27')](removeEntity(_0x91ab28,null))[_0x4671('0x48')](handleError(_0x91ab28,null));}; \ No newline at end of file +var _0x0203=['pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','save','then','get','CmContactHasItems','destroy','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','filters'];(function(_0x5b65fd,_0x2af41d){var _0x1de987=function(_0x2b2cbd){while(--_0x2b2cbd){_0x5b65fd['push'](_0x5b65fd['shift']());}};_0x1de987(++_0x2af41d);}(_0x0203,0x1b8));var _0x3020=function(_0x502cf9,_0x5c720c){_0x502cf9=_0x502cf9-0x0;var _0x1ed877=_0x0203[_0x502cf9];return _0x1ed877;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3020('0x0'));var zipdir=require(_0x3020('0x1'));var jsonpatch=require(_0x3020('0x2'));var rp=require('request-promise');var moment=require(_0x3020('0x3'));var BPromise=require(_0x3020('0x4'));var Mustache=require('mustache');var util=require(_0x3020('0x5'));var path=require(_0x3020('0x6'));var sox=require(_0x3020('0x7'));var csv=require(_0x3020('0x8'));var ejs=require(_0x3020('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3020('0xa'));var crypto=require(_0x3020('0xb'));var jsforce=require(_0x3020('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3020('0x8'));var querystring=require(_0x3020('0xd'));var Papa=require(_0x3020('0xe'));var Redis=require(_0x3020('0xf'));var authService=require(_0x3020('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3020('0x11'));var hardwareService=require(_0x3020('0x12'));var logger=require(_0x3020('0x13'))(_0x3020('0x14'));var utils=require(_0x3020('0x15'));var config=require(_0x3020('0x16'));var licenseUtil=require(_0x3020('0x17'));var db=require(_0x3020('0x18'))['db'];function respondWithStatusCode(_0x1ea312,_0x588369){_0x588369=_0x588369||0xcc;return function(_0x13871f){if(_0x13871f){return _0x1ea312[_0x3020('0x19')](_0x588369);}return _0x1ea312[_0x3020('0x1a')](_0x588369)[_0x3020('0x1b')]();};}function respondWithResult(_0x4b6225,_0x253762){_0x253762=_0x253762||0xc8;return function(_0x2c9e79){if(_0x2c9e79){return _0x4b6225[_0x3020('0x1a')](_0x253762)['json'](_0x2c9e79);}};}function respondWithFilteredResult(_0x39de74,_0x7844fc){return function(_0x3ff288){if(_0x3ff288){var _0xbc8447=typeof _0x7844fc[_0x3020('0x1c')]===_0x3020('0x1d')&&typeof _0x7844fc['limit']===_0x3020('0x1d');var _0x2f7bac=_0x3ff288[_0x3020('0x1e')];var _0x33efa5=_0xbc8447?0x0:_0x7844fc[_0x3020('0x1c')];var _0x4fc8ec=_0xbc8447?_0x3ff288['count']:_0x7844fc[_0x3020('0x1c')]+_0x7844fc[_0x3020('0x1f')];var _0x4ab0eb;if(_0x4fc8ec>=_0x2f7bac){_0x4fc8ec=_0x2f7bac;_0x4ab0eb=0xc8;}else{_0x4ab0eb=0xce;}_0x39de74[_0x3020('0x1a')](_0x4ab0eb);return _0x39de74[_0x3020('0x20')]('Content-Range',_0x33efa5+'-'+_0x4fc8ec+'/'+_0x2f7bac)[_0x3020('0x21')](_0x3ff288);}return null;};}function patchUpdates(_0x2e022c){return function(_0x561bfe){try{jsonpatch['apply'](_0x561bfe,_0x2e022c,!![]);}catch(_0x4af145){return BPromise[_0x3020('0x22')](_0x4af145);}return _0x561bfe[_0x3020('0x23')]();};}function saveUpdates(_0x2c7063,_0x1c7629){return function(_0x19591e){if(_0x19591e){return _0x19591e['update'](_0x2c7063)[_0x3020('0x24')](function(_0x5643c5){return _0x5643c5;});}return null;};}function removeEntity(_0x2789db,_0xfb8fb9){return function(_0x495d1e){if(_0x495d1e){return _0x495d1e['destroy']()[_0x3020('0x24')](function(){var _0x163bde=_0x495d1e[_0x3020('0x25')]({'plain':!![]});var _0x5fb6dd=_0x3020('0x26');return db['UserProfileResource'][_0x3020('0x27')]({'where':{'type':_0x5fb6dd,'resourceId':_0x163bde['id']}})[_0x3020('0x24')](function(){return _0x495d1e;});})[_0x3020('0x24')](function(){_0x2789db[_0x3020('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a67fb,_0x23e3c0){return function(_0x41b784){if(!_0x41b784){_0x5a67fb[_0x3020('0x19')](0x194);}return _0x41b784;};}function handleError(_0x643890,_0x3462a4){_0x3462a4=_0x3462a4||0x1f4;return function(_0x4d8393){logger['error'](_0x4d8393['stack']);if(_0x4d8393[_0x3020('0x28')]){delete _0x4d8393[_0x3020('0x28')];}_0x643890[_0x3020('0x1a')](_0x3462a4)['send'](_0x4d8393);};}exports[_0x3020('0x29')]=function(_0xfb16e8,_0x1dcec8){var _0x1dff4b={},_0x422be0={},_0x183220={'count':0x0,'rows':[]};var _0x597968=_[_0x3020('0x2a')](db[_0x3020('0x2b')][_0x3020('0x2c')],function(_0x5c4040){return{'name':_0x5c4040[_0x3020('0x2d')],'type':_0x5c4040[_0x3020('0x2e')][_0x3020('0x2f')]};});_0x422be0['model']=_[_0x3020('0x2a')](_0x597968,_0x3020('0x28'));_0x422be0[_0x3020('0x30')]=_[_0x3020('0x31')](_0xfb16e8['query']);_0x422be0['filters']=_[_0x3020('0x32')](_0x422be0[_0x3020('0x33')],_0x422be0['query']);_0x1dff4b['attributes']=_['intersection'](_0x422be0[_0x3020('0x33')],qs[_0x3020('0x34')](_0xfb16e8['query'][_0x3020('0x34')]));_0x1dff4b[_0x3020('0x35')]=_0x1dff4b[_0x3020('0x35')]['length']?_0x1dff4b['attributes']:_0x422be0['model'];if(!_0xfb16e8[_0x3020('0x30')][_0x3020('0x36')](_0x3020('0x37'))){_0x1dff4b['limit']=qs[_0x3020('0x1f')](_0xfb16e8['query'][_0x3020('0x1f')]);_0x1dff4b[_0x3020('0x1c')]=qs[_0x3020('0x1c')](_0xfb16e8[_0x3020('0x30')][_0x3020('0x1c')]);}_0x1dff4b['order']=qs['sort'](_0xfb16e8['query'][_0x3020('0x38')]);_0x1dff4b['where']=qs[_0x3020('0x39')](_[_0x3020('0x3a')](_0xfb16e8['query'],_0x422be0[_0x3020('0x39')]),_0x597968);if(_0xfb16e8[_0x3020('0x30')][_0x3020('0x3b')]){_0x1dff4b[_0x3020('0x3c')]=_['merge'](_0x1dff4b[_0x3020('0x3c')],{'$or':_[_0x3020('0x2a')](_0x597968,function(_0x16fd81){if(_0x16fd81[_0x3020('0x2e')]!==_0x3020('0x3d')){var _0x12b08e={};_0x12b08e[_0x16fd81[_0x3020('0x28')]]={'$like':'%'+_0xfb16e8[_0x3020('0x30')]['filter']+'%'};return _0x12b08e;}})});}_0x1dff4b=_['merge']({},_0x1dff4b,_0xfb16e8[_0x3020('0x3e')]);var _0x43dcec={'where':_0x1dff4b[_0x3020('0x3c')]};return db[_0x3020('0x2b')][_0x3020('0x1e')](_0x43dcec)[_0x3020('0x24')](function(_0x4718b8){_0x183220[_0x3020('0x1e')]=_0x4718b8;if(_0xfb16e8[_0x3020('0x30')][_0x3020('0x3f')]){_0x1dff4b[_0x3020('0x40')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x3020('0x41')](_0x1dff4b);})[_0x3020('0x24')](function(_0xa7a722){_0x183220[_0x3020('0x42')]=_0xa7a722;return _0x183220;})['then'](respondWithFilteredResult(_0x1dcec8,_0x1dff4b))[_0x3020('0x43')](handleError(_0x1dcec8,null));};exports[_0x3020('0x44')]=function(_0x2f5b7b,_0x21c9bb){var _0x4a6f96={'raw':!![],'where':{'id':_0x2f5b7b[_0x3020('0x45')]['id']}},_0x29365a={};_0x29365a[_0x3020('0x33')]=_[_0x3020('0x31')](db[_0x3020('0x2b')][_0x3020('0x2c')]);_0x29365a['query']=_['keys'](_0x2f5b7b['query']);_0x29365a[_0x3020('0x39')]=_['intersection'](_0x29365a[_0x3020('0x33')],_0x29365a['query']);_0x4a6f96[_0x3020('0x35')]=_['intersection'](_0x29365a[_0x3020('0x33')],qs[_0x3020('0x34')](_0x2f5b7b[_0x3020('0x30')][_0x3020('0x34')]));_0x4a6f96[_0x3020('0x35')]=_0x4a6f96[_0x3020('0x35')][_0x3020('0x46')]?_0x4a6f96['attributes']:_0x29365a[_0x3020('0x33')];if(_0x2f5b7b[_0x3020('0x30')]['includeAll']){_0x4a6f96[_0x3020('0x40')]=[{'all':!![]}];}_0x4a6f96=_[_0x3020('0x47')]({},_0x4a6f96,_0x2f5b7b[_0x3020('0x3e')]);return db[_0x3020('0x2b')][_0x3020('0x48')](_0x4a6f96)['then'](handleEntityNotFound(_0x21c9bb,null))['then'](respondWithResult(_0x21c9bb,null))[_0x3020('0x43')](handleError(_0x21c9bb,null));};exports['create']=function(_0x419c48,_0x2565d5){return db[_0x3020('0x2b')][_0x3020('0x49')](_0x419c48[_0x3020('0x4a')],{})[_0x3020('0x24')](function(_0x5e35a1){var _0x2163ae=_0x419c48[_0x3020('0x4b')][_0x3020('0x25')]({'plain':!![]});if(!_0x2163ae)throw new Error(_0x3020('0x4c'));if(_0x2163ae[_0x3020('0x4d')]===_0x3020('0x4b')){var _0x2aba8e=_0x5e35a1[_0x3020('0x25')]({'plain':!![]});var _0x3697d9=_0x3020('0x26');return db[_0x3020('0x4e')][_0x3020('0x48')]({'where':{'name':_0x3697d9,'userProfileId':_0x2163ae[_0x3020('0x4f')]},'raw':!![]})['then'](function(_0x7aade2){if(_0x7aade2&&_0x7aade2[_0x3020('0x50')]===0x0){return db['UserProfileResource'][_0x3020('0x49')]({'name':_0x2aba8e['name'],'resourceId':_0x2aba8e['id'],'type':_0x7aade2[_0x3020('0x28')],'sectionId':_0x7aade2['id']},{})['then'](function(){return _0x5e35a1;});}else{return _0x5e35a1;}})[_0x3020('0x43')](function(_0x34e85c){logger[_0x3020('0x51')](_0x3020('0x52'),_0x34e85c);throw _0x34e85c;});}return _0x5e35a1;})[_0x3020('0x24')](respondWithResult(_0x2565d5,0xc9))[_0x3020('0x43')](handleError(_0x2565d5,null));};exports['update']=function(_0x220a99,_0x721b8a){if(_0x220a99[_0x3020('0x4a')]['id']){delete _0x220a99[_0x3020('0x4a')]['id'];}return db[_0x3020('0x2b')][_0x3020('0x48')]({'where':{'id':_0x220a99[_0x3020('0x45')]['id']}})[_0x3020('0x24')](handleEntityNotFound(_0x721b8a,null))[_0x3020('0x24')](saveUpdates(_0x220a99['body'],null))[_0x3020('0x24')](respondWithResult(_0x721b8a,null))[_0x3020('0x43')](handleError(_0x721b8a,null));};exports[_0x3020('0x27')]=function(_0x5813c5,_0x2e88fc){return db['CmContactHasItem'][_0x3020('0x48')]({'where':{'id':_0x5813c5[_0x3020('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e88fc,null))['then'](removeEntity(_0x2e88fc,null))[_0x3020('0x43')](handleError(_0x2e88fc,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index d199e2c..300362a 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 _0xb968=['moment','bluebird','path','../../config/environment','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api'];(function(_0x5cdfd6,_0x2e80b7){var _0x452357=function(_0x557d74){while(--_0x557d74){_0x5cdfd6['push'](_0x5cdfd6['shift']());}};_0x452357(++_0x2e80b7);}(_0xb968,0x1b4));var _0x8b96=function(_0x392ee2,_0x305028){_0x392ee2=_0x392ee2-0x0;var _0x475060=_0xb968[_0x392ee2];return _0x475060;};'use strict';var _=require(_0x8b96('0x0'));var util=require(_0x8b96('0x1'));var logger=require(_0x8b96('0x2'))(_0x8b96('0x3'));var moment=require(_0x8b96('0x4'));var BPromise=require(_0x8b96('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b96('0x6'));var rimraf=require('rimraf');var config=require(_0x8b96('0x7'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x1b2a95,_0x37afc1){return _0x1b2a95[_0x8b96('0x8')](_0x8b96('0x9'),attributes,{'tableName':_0x8b96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97ec=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x513e37,_0x206c2c){var _0x55a2dd=function(_0x42f17d){while(--_0x42f17d){_0x513e37['push'](_0x513e37['shift']());}};_0x55a2dd(++_0x206c2c);}(_0x97ec,0x192));var _0xc97e=function(_0x55a5a5,_0x476f9b){_0x55a5a5=_0x55a5a5-0x0;var _0x330dfd=_0x97ec[_0x55a5a5];return _0x330dfd;};'use strict';var _=require(_0xc97e('0x0'));var util=require(_0xc97e('0x1'));var logger=require(_0xc97e('0x2'))(_0xc97e('0x3'));var moment=require(_0xc97e('0x4'));var BPromise=require(_0xc97e('0x5'));var rp=require(_0xc97e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc97e('0x7'));var config=require('../../config/environment');var attributes=require(_0xc97e('0x8'));module[_0xc97e('0x9')]=function(_0x626bfe,_0x1ce9e0){return _0x626bfe[_0xc97e('0xa')](_0xc97e('0xb'),attributes,{'tableName':_0xc97e('0xc'),'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 defee70..193608d 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 _0x8f3b=['ioredis','../../config/logger','rpc','jayson/promise','http','request','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','randomstring'];(function(_0x519027,_0x26636d){var _0x1a6f9e=function(_0x2ad431){while(--_0x2ad431){_0x519027['push'](_0x519027['shift']());}};_0x1a6f9e(++_0x26636d);}(_0x8f3b,0x1d9));var _0xb8f3=function(_0x2b7fa5,_0x222569){_0x2b7fa5=_0x2b7fa5-0x0;var _0x33bb32=_0x8f3b[_0x2b7fa5];return _0x33bb32;};'use strict';var _=require(_0xb8f3('0x0'));var util=require('util');var moment=require(_0xb8f3('0x1'));var BPromise=require('bluebird');var rs=require(_0xb8f3('0x2'));var fs=require('fs');var Redis=require(_0xb8f3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb8f3('0x4'))(_0xb8f3('0x5'));var config=require('../../config/environment');var jayson=require(_0xb8f3('0x6'));var client=jayson['client'][_0xb8f3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4cb9e8,_0x2dec4e,_0x581845){return new BPromise(function(_0x2f375f,_0x45238e){return client[_0xb8f3('0x8')](_0x4cb9e8,_0x581845)['then'](function(_0x306ad4){logger['info'](_0xb8f3('0x9'),_0x2dec4e,_0xb8f3('0xa'));logger['debug'](_0xb8f3('0xb'),_0x2dec4e,_0xb8f3('0xa'),JSON['stringify'](_0x306ad4));if(_0x306ad4[_0xb8f3('0xc')]){if(_0x306ad4['error'][_0xb8f3('0xd')]===0x1f4){logger['error'](_0xb8f3('0x9'),_0x2dec4e,_0x306ad4[_0xb8f3('0xc')]['message']);return _0x45238e(_0x306ad4[_0xb8f3('0xc')]['message']);}logger[_0xb8f3('0xc')](_0xb8f3('0x9'),_0x2dec4e,_0x306ad4[_0xb8f3('0xc')][_0xb8f3('0xe')]);return _0x2f375f(_0x306ad4[_0xb8f3('0xc')]['message']);}else{logger[_0xb8f3('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x2dec4e,_0xb8f3('0xa'));_0x2f375f(_0x306ad4['result'][_0xb8f3('0xe')]);}})[_0xb8f3('0x10')](function(_0x256605){logger[_0xb8f3('0xc')](_0xb8f3('0x9'),_0x2dec4e,_0x256605);_0x45238e(_0x256605);});});} \ No newline at end of file +var _0x744b=['CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmContactHasItem,\x20%s,\x20%s','request\x20sent'];(function(_0x3b71f3,_0x32cac5){var _0x51789f=function(_0x53b0f5){while(--_0x53b0f5){_0x3b71f3['push'](_0x3b71f3['shift']());}};_0x51789f(++_0x32cac5);}(_0x744b,0x1eb));var _0xb744=function(_0x288602,_0x56f26f){_0x288602=_0x288602-0x0;var _0x46420c=_0x744b[_0x288602];return _0x46420c;};'use strict';var _=require(_0xb744('0x0'));var util=require(_0xb744('0x1'));var moment=require(_0xb744('0x2'));var BPromise=require(_0xb744('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb744('0x4'))['db'];var utils=require(_0xb744('0x5'));var logger=require(_0xb744('0x6'))(_0xb744('0x7'));var config=require(_0xb744('0x8'));var jayson=require(_0xb744('0x9'));var client=jayson[_0xb744('0xa')][_0xb744('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51bbde,_0x14c8b8,_0x3d1613){return new BPromise(function(_0x46f8fb,_0x5ee4be){return client[_0xb744('0xc')](_0x51bbde,_0x3d1613)['then'](function(_0x509322){logger['info'](_0xb744('0xd'),_0x14c8b8,_0xb744('0xe'));logger['debug'](_0xb744('0xf'),_0x14c8b8,'request\x20sent',JSON[_0xb744('0x10')](_0x509322));if(_0x509322['error']){if(_0x509322[_0xb744('0x11')][_0xb744('0x12')]===0x1f4){logger[_0xb744('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x14c8b8,_0x509322['error'][_0xb744('0x13')]);return _0x5ee4be(_0x509322[_0xb744('0x11')]['message']);}logger[_0xb744('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x14c8b8,_0x509322[_0xb744('0x11')][_0xb744('0x13')]);return _0x46f8fb(_0x509322[_0xb744('0x11')][_0xb744('0x13')]);}else{logger[_0xb744('0x14')]('CmContactHasItem,\x20%s,\x20%s',_0x14c8b8,_0xb744('0xe'));_0x46f8fb(_0x509322[_0xb744('0x15')][_0xb744('0x13')]);}})[_0xb744('0x16')](function(_0x4e07f6){logger[_0xb744('0x11')](_0xb744('0xd'),_0x14c8b8,_0x4e07f6);_0x5ee4be(_0x4e07f6);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 77c64a0..923ba65 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 _0x269b=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','delete','destroy','exports','multer','path'];(function(_0x348067,_0x282343){var _0x5534f7=function(_0x59abd8){while(--_0x59abd8){_0x348067['push'](_0x348067['shift']());}};_0x5534f7(++_0x282343);}(_0x269b,0x1be));var _0xb269=function(_0x2c0931,_0x503573){_0x2c0931=_0x2c0931-0x0;var _0x3d781f=_0x269b[_0x2c0931];return _0x3d781f;};'use strict';var multer=require(_0xb269('0x0'));var util=require('util');var path=require(_0xb269('0x1'));var timeout=require('connect-timeout');var express=require(_0xb269('0x2'));var router=express[_0xb269('0x3')]();var fs_extra=require(_0xb269('0x4'));var auth=require(_0xb269('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb269('0x6'));var controller=require('./cmContactHasItem.controller');router[_0xb269('0x7')]('/',auth[_0xb269('0x8')](),controller[_0xb269('0x9')]);router[_0xb269('0x7')](_0xb269('0xa'),auth[_0xb269('0x8')](),controller['show']);router[_0xb269('0xb')]('/',auth[_0xb269('0x8')](),controller['create']);router[_0xb269('0xc')](_0xb269('0xa'),auth[_0xb269('0x8')](),controller['update']);router[_0xb269('0xd')](_0xb269('0xa'),auth[_0xb269('0x8')](),controller[_0xb269('0xe')]);module[_0xb269('0xf')]=router; \ No newline at end of file +var _0xc933=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0xc933,0xf9));var _0x3c93=function(_0x12b3f1,_0x9becd3){_0x12b3f1=_0x12b3f1-0x0;var _0x1c3577=_0xc933[_0x12b3f1];return _0x1c3577;};'use strict';var multer=require(_0x3c93('0x0'));var util=require(_0x3c93('0x1'));var path=require(_0x3c93('0x2'));var timeout=require(_0x3c93('0x3'));var express=require(_0x3c93('0x4'));var router=express['Router']();var fs_extra=require(_0x3c93('0x5'));var auth=require(_0x3c93('0x6'));var interaction=require(_0x3c93('0x7'));var config=require(_0x3c93('0x8'));var controller=require(_0x3c93('0x9'));router['get']('/',auth[_0x3c93('0xa')](),controller[_0x3c93('0xb')]);router['get'](_0x3c93('0xc'),auth['isAuthenticated'](),controller[_0x3c93('0xd')]);router[_0x3c93('0xe')]('/',auth[_0x3c93('0xa')](),controller[_0x3c93('0xf')]);router[_0x3c93('0x10')](_0x3c93('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3c93('0xc'),auth[_0x3c93('0xa')](),controller[_0x3c93('0x11')]);module[_0x3c93('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3324fb6..8e3f2a1 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 _0xdde1=['stringify','setDataValue','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','TEXT','type','select','parse','values'];(function(_0x5db569,_0x25707b){var _0x247b44=function(_0x4b7dfd){while(--_0x4b7dfd){_0x5db569['push'](_0x5db569['shift']());}};_0x247b44(++_0x25707b);}(_0xdde1,0xe2));var _0x1dde=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xdde1[_0x4a8bad];return _0x30cf32;};'use strict';var Sequelize=require(_0x1dde('0x0'));var _=require(_0x1dde('0x1'));module[_0x1dde('0x2')]={'name':{'type':Sequelize[_0x1dde('0x3')],'get':function(_0x505c05){return this[_0x1dde('0x4')](_0x1dde('0x5'));}},'alias':{'type':Sequelize[_0x1dde('0x6')],'allowNull':![],'set':function(_0x379ed9){this['setDataValue'](_0x1dde('0x5'),_0x379ed9?_0x379ed9:this[_0x1dde('0x4')]('name'));}},'type':{'type':Sequelize[_0x1dde('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x1dde('0x7')]('long'),'get':function(){if(this[_0x1dde('0x4')](_0x1dde('0x8'))===_0x1dde('0x9')){return JSON[_0x1dde('0xa')](this[_0x1dde('0x4')](_0x1dde('0xb')));}else{return this['getDataValue']('values');}},'set':function(_0x97cd46){if(Array['isArray'](_0x97cd46)){this['setDataValue']('values',JSON[_0x1dde('0xc')](_0x97cd46));}else{this[_0x1dde('0xd')](_0x1dde('0xb'),_0x97cd46);}}},'required':{'type':Sequelize[_0x1dde('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1dde('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1dde('0xf')](_0x1dde('0x10'))}}; \ No newline at end of file +var _0x959f=['getDataValue','type','select','parse','values','isArray','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','alias','STRING','setDataValue'];(function(_0x40cbce,_0x45870f){var _0x41dfd4=function(_0x4f832f){while(--_0x4f832f){_0x40cbce['push'](_0x40cbce['shift']());}};_0x41dfd4(++_0x45870f);}(_0x959f,0xcc));var _0xf959=function(_0x5df8cb,_0x354497){_0x5df8cb=_0x5df8cb-0x0;var _0x21f113=_0x959f[_0x5df8cb];return _0x21f113;};'use strict';var Sequelize=require(_0xf959('0x0'));var _=require('lodash');module[_0xf959('0x1')]={'name':{'type':Sequelize[_0xf959('0x2')],'get':function(_0x579150){return this['getDataValue'](_0xf959('0x3'));}},'alias':{'type':Sequelize[_0xf959('0x4')],'allowNull':![],'set':function(_0x39bd6a){this[_0xf959('0x5')](_0xf959('0x3'),_0x39bd6a?_0x39bd6a:this[_0xf959('0x6')]('name'));}},'type':{'type':Sequelize[_0xf959('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xf959('0x6')](_0xf959('0x7'))===_0xf959('0x8')){return JSON[_0xf959('0x9')](this[_0xf959('0x6')](_0xf959('0xa')));}else{return this[_0xf959('0x6')](_0xf959('0xa'));}},'set':function(_0x5281a7){if(Array[_0xf959('0xb')](_0x5281a7)){this['setDataValue'](_0xf959('0xa'),JSON['stringify'](_0x5281a7));}else{this['setDataValue'](_0xf959('0xa'),_0x5281a7);}}},'required':{'type':Sequelize[_0xf959('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf959('0xd')](_0xf959('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 2d06853..fb8e97b 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 _0xf75f=['sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','destroy','create','sequelize','transaction','TEXT','text','Sequelize','INTEGER','switch','queryInterface','cm_contacts','format','cf_%d','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x3789c7,_0x3a156d){var _0x3b58ca=function(_0x146600){while(--_0x146600){_0x3789c7['push'](_0x3789c7['shift']());}};_0x3b58ca(++_0x3a156d);}(_0xf75f,0x1ca));var _0xff75=function(_0x109072,_0x1a7c92){_0x109072=_0x109072-0x0;var _0x25a30e=_0xf75f[_0x109072];return _0x25a30e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff75('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff75('0x1'));var rp=require(_0xff75('0x2'));var moment=require(_0xff75('0x3'));var BPromise=require(_0xff75('0x4'));var Mustache=require(_0xff75('0x5'));var util=require(_0xff75('0x6'));var path=require(_0xff75('0x7'));var sox=require(_0xff75('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff75('0x9'));var _=require(_0xff75('0xa'));var squel=require(_0xff75('0xb'));var crypto=require(_0xff75('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff75('0xd'));var querystring=require('querystring');var Papa=require(_0xff75('0xe'));var Redis=require(_0xff75('0xf'));var authService=require(_0xff75('0x10'));var qs=require(_0xff75('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff75('0x12'));var logger=require(_0xff75('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xff75('0x14'));var licenseUtil=require(_0xff75('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x393c62,_0x352846){_0x352846=_0x352846||0xcc;return function(_0x5575a1){if(_0x5575a1){return _0x393c62[_0xff75('0x16')](_0x352846);}return _0x393c62['status'](_0x352846)[_0xff75('0x17')]();};}function respondWithResult(_0x3a4587,_0x4ccac9){_0x4ccac9=_0x4ccac9||0xc8;return function(_0x5f149f){if(_0x5f149f){return _0x3a4587[_0xff75('0x18')](_0x4ccac9)[_0xff75('0x19')](_0x5f149f);}};}function respondWithFilteredResult(_0x5d049c,_0x15bcc5){return function(_0x167357){if(_0x167357){var _0x583d19=typeof _0x15bcc5[_0xff75('0x1a')]==='undefined'&&typeof _0x15bcc5[_0xff75('0x1b')]==='undefined';var _0x13d01b=_0x167357['count'];var _0x5a9789=_0x583d19?0x0:_0x15bcc5['offset'];var _0x20065e=_0x583d19?_0x167357[_0xff75('0x1c')]:_0x15bcc5[_0xff75('0x1a')]+_0x15bcc5[_0xff75('0x1b')];var _0x3915ea;if(_0x20065e>=_0x13d01b){_0x20065e=_0x13d01b;_0x3915ea=0xc8;}else{_0x3915ea=0xce;}_0x5d049c['status'](_0x3915ea);return _0x5d049c[_0xff75('0x1d')](_0xff75('0x1e'),_0x5a9789+'-'+_0x20065e+'/'+_0x13d01b)[_0xff75('0x19')](_0x167357);}return null;};}function patchUpdates(_0x35a59d){return function(_0x57fbdd){try{jsonpatch[_0xff75('0x1f')](_0x57fbdd,_0x35a59d,!![]);}catch(_0x47b2aa){return BPromise['reject'](_0x47b2aa);}return _0x57fbdd[_0xff75('0x20')]();};}function saveUpdates(_0x5a78e1,_0x58e89a){return function(_0x332d5f){if(_0x332d5f){return _0x332d5f[_0xff75('0x21')](_0x5a78e1)[_0xff75('0x22')](function(_0x5e5e59){return _0x5e5e59;});}return null;};}function removeEntity(_0x405755,_0x5bf075){return function(_0x56d738){if(_0x56d738){return _0x56d738['destroy']()[_0xff75('0x22')](function(){_0x405755[_0xff75('0x18')](0xcc)[_0xff75('0x17')]();});}};}function handleEntityNotFound(_0x4e294c,_0x3e8c7c){return function(_0x369593){if(!_0x369593){_0x4e294c[_0xff75('0x16')](0x194);}return _0x369593;};}function handleError(_0x1608fa,_0x52bf4c){_0x52bf4c=_0x52bf4c||0x1f4;return function(_0x34768c){logger[_0xff75('0x23')](_0x34768c[_0xff75('0x24')]);if(_0x34768c['name']){delete _0x34768c[_0xff75('0x25')];}_0x1608fa[_0xff75('0x18')](_0x52bf4c)[_0xff75('0x26')](_0x34768c);};}exports[_0xff75('0x27')]=function(_0x48070c,_0xda428d){var _0x176488={},_0x18b63b={},_0x5ed173={'count':0x0,'rows':[]};var _0x14a752=_[_0xff75('0x28')](db[_0xff75('0x29')][_0xff75('0x2a')],function(_0x101286){return{'name':_0x101286[_0xff75('0x2b')],'type':_0x101286[_0xff75('0x2c')][_0xff75('0x2d')]};});_0x18b63b[_0xff75('0x2e')]=_[_0xff75('0x2f')](_[_0xff75('0x28')](_0x14a752,'name'),['name']);_0x18b63b[_0xff75('0x30')]=_[_0xff75('0x31')](_0x48070c[_0xff75('0x30')]);_0x18b63b[_0xff75('0x32')]=_[_0xff75('0x33')](_0x18b63b[_0xff75('0x2e')],_0x18b63b['query']);_0x176488[_0xff75('0x34')]=_[_0xff75('0x33')](_0x18b63b[_0xff75('0x2e')],qs[_0xff75('0x35')](_0x48070c[_0xff75('0x30')][_0xff75('0x35')]));_0x176488[_0xff75('0x34')]=_0x176488[_0xff75('0x34')][_0xff75('0x36')]?_0x176488[_0xff75('0x34')]:_0x18b63b['model'];if(!_0x48070c['query'][_0xff75('0x37')](_0xff75('0x38'))){_0x176488[_0xff75('0x1b')]=qs['limit'](_0x48070c[_0xff75('0x30')][_0xff75('0x1b')]);_0x176488[_0xff75('0x1a')]=qs[_0xff75('0x1a')](_0x48070c[_0xff75('0x30')]['offset']);}_0x176488[_0xff75('0x39')]=qs[_0xff75('0x3a')](_0x48070c[_0xff75('0x30')][_0xff75('0x3a')]);_0x176488[_0xff75('0x3b')]=qs[_0xff75('0x32')](_[_0xff75('0x3c')](_0x48070c[_0xff75('0x30')],_0x18b63b[_0xff75('0x32')]),_0x14a752);if(_0x48070c[_0xff75('0x30')][_0xff75('0x3d')]){_0x176488[_0xff75('0x3b')]=_['merge'](_0x176488[_0xff75('0x3b')],{'$or':_[_0xff75('0x28')](_0x14a752,function(_0x57fd31){if(_0x57fd31[_0xff75('0x2c')]!=='VIRTUAL'){var _0x2a5845={};_0x2a5845[_0x57fd31[_0xff75('0x25')]]={'$like':'%'+_0x48070c[_0xff75('0x30')][_0xff75('0x3d')]+'%'};return _0x2a5845;}})});}_0x176488=_[_0xff75('0x3e')]({},_0x176488,_0x48070c[_0xff75('0x3f')]);var _0x293547={'where':_0x176488[_0xff75('0x3b')]};return db[_0xff75('0x29')][_0xff75('0x1c')](_0x293547)[_0xff75('0x22')](function(_0x32c234){_0x5ed173[_0xff75('0x1c')]=_0x32c234;if(_0x48070c[_0xff75('0x30')][_0xff75('0x40')]){_0x176488['include']=[{'all':!![]}];}return db[_0xff75('0x29')][_0xff75('0x41')](_0x176488);})[_0xff75('0x22')](function(_0x13e62c){_0x5ed173[_0xff75('0x42')]=_0x13e62c;return _0x5ed173;})['then'](respondWithFilteredResult(_0xda428d,_0x176488))[_0xff75('0x43')](handleError(_0xda428d,null));};exports[_0xff75('0x44')]=function(_0x128f97,_0x4a1b51){var _0x35228a={'raw':!![],'where':{'id':_0x128f97[_0xff75('0x45')]['id']}},_0x3d627f={};_0x3d627f['model']=_[_0xff75('0x31')](db[_0xff75('0x29')][_0xff75('0x2a')]);_0x3d627f['query']=_[_0xff75('0x31')](_0x128f97['query']);_0x3d627f[_0xff75('0x32')]=_[_0xff75('0x33')](_0x3d627f['model'],_0x3d627f[_0xff75('0x30')]);_0x35228a[_0xff75('0x34')]=_[_0xff75('0x33')](_0x3d627f[_0xff75('0x2e')],qs[_0xff75('0x35')](_0x128f97[_0xff75('0x30')][_0xff75('0x35')]));_0x35228a['attributes']=_0x35228a[_0xff75('0x34')]['length']?_0x35228a[_0xff75('0x34')]:_0x3d627f[_0xff75('0x2e')];if(_0x128f97['query'][_0xff75('0x40')]){_0x35228a[_0xff75('0x46')]=[{'all':!![]}];}_0x35228a=_['merge']({},_0x35228a,_0x128f97[_0xff75('0x3f')]);return db['CmCustomField'][_0xff75('0x47')](_0x35228a)[_0xff75('0x22')](handleEntityNotFound(_0x4a1b51,null))[_0xff75('0x22')](respondWithResult(_0x4a1b51,null))[_0xff75('0x43')](handleError(_0x4a1b51,null));};exports[_0xff75('0x21')]=function(_0x44646d,_0x45ab1e){if(_0x44646d[_0xff75('0x48')]['id']){delete _0x44646d[_0xff75('0x48')]['id'];}return db['CmCustomField'][_0xff75('0x47')]({'where':{'id':_0x44646d[_0xff75('0x45')]['id']}})[_0xff75('0x22')](handleEntityNotFound(_0x45ab1e,null))['then'](saveUpdates(_0x44646d[_0xff75('0x48')],null))[_0xff75('0x22')](respondWithResult(_0x45ab1e,null))[_0xff75('0x43')](handleError(_0x45ab1e,null));};exports[_0xff75('0x49')]=function(_0x33e040,_0x162c46){return db['CmCustomField']['find']({'where':{'id':_0x33e040[_0xff75('0x45')]['id']}})[_0xff75('0x22')](handleEntityNotFound(_0x162c46,null))[_0xff75('0x22')](removeEntity(_0x162c46,null))[_0xff75('0x43')](handleError(_0x162c46,null));};exports[_0xff75('0x4a')]=function(_0x1e3c9e,_0x4c5514){var _0x1a5cff;return db[_0xff75('0x4b')][_0xff75('0x4c')](function(_0x5324b8){return db['CmCustomField'][_0xff75('0x4a')](_0x1e3c9e[_0xff75('0x48')],{'transaction':_0x5324b8})['then'](function(_0xbacb41){_0x1a5cff=_0xbacb41;var _0x292c8a={'type':db['Sequelize'][_0xff75('0x4d')],'transaction':_0x5324b8};switch(_0x1e3c9e[_0xff75('0x48')][_0xff75('0x2c')]){case _0xff75('0x4e'):_0x292c8a[_0xff75('0x2c')]=db[_0xff75('0x4f')][_0xff75('0x4d')];break;case'number':_0x292c8a[_0xff75('0x2c')]=db[_0xff75('0x4f')][_0xff75('0x50')];break;case _0xff75('0x51'):_0x292c8a[_0xff75('0x2c')]=db['Sequelize']['BOOLEAN'];_0x292c8a['defaultValue']=![];break;default:}return db[_0xff75('0x4b')][_0xff75('0x52')]['addColumn'](_0xff75('0x53'),util[_0xff75('0x54')](_0xff75('0x55'),_0x1a5cff['id']),_0x292c8a);})[_0xff75('0x22')](function(){return _0x1a5cff;});})[_0xff75('0x22')](respondWithResult(_0x4c5514,0xc9))[_0xff75('0x43')](handleError(_0x4c5514,null));}; \ No newline at end of file +var _0x962b=['params','include','body','find','create','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','then','error','name','index','rawAttributes','fieldName','type','model','differenceBy','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','map','VIRTUAL','filter','CmCustomField','includeAll','findAll','rows','catch','show'];(function(_0x2cd99c,_0x1ee4ff){var _0x192867=function(_0x19dc87){while(--_0x19dc87){_0x2cd99c['push'](_0x2cd99c['shift']());}};_0x192867(++_0x1ee4ff);}(_0x962b,0xba));var _0xb962=function(_0x31f5f4,_0x3f177){_0x31f5f4=_0x31f5f4-0x0;var _0x432fd2=_0x962b[_0x31f5f4];return _0x432fd2;};'use strict';var emlformat=require(_0xb962('0x0'));var rimraf=require(_0xb962('0x1'));var zipdir=require(_0xb962('0x2'));var jsonpatch=require(_0xb962('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb962('0x4'));var util=require(_0xb962('0x5'));var path=require('path');var sox=require(_0xb962('0x6'));var csv=require(_0xb962('0x7'));var ejs=require(_0xb962('0x8'));var fs=require('fs');var fs_extra=require(_0xb962('0x9'));var _=require(_0xb962('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb962('0xb'));var deskjs=require(_0xb962('0xc'));var toCsv=require(_0xb962('0x7'));var querystring=require('querystring');var Papa=require(_0xb962('0xd'));var Redis=require(_0xb962('0xe'));var authService=require(_0xb962('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb962('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb962('0x11'))('api');var utils=require(_0xb962('0x12'));var config=require(_0xb962('0x13'));var licenseUtil=require(_0xb962('0x14'));var db=require(_0xb962('0x15'))['db'];function respondWithStatusCode(_0x30f0cb,_0x8c3772){_0x8c3772=_0x8c3772||0xcc;return function(_0x5aba87){if(_0x5aba87){return _0x30f0cb[_0xb962('0x16')](_0x8c3772);}return _0x30f0cb[_0xb962('0x17')](_0x8c3772)[_0xb962('0x18')]();};}function respondWithResult(_0x3c1994,_0x26c597){_0x26c597=_0x26c597||0xc8;return function(_0x3805c8){if(_0x3805c8){return _0x3c1994[_0xb962('0x17')](_0x26c597)['json'](_0x3805c8);}};}function respondWithFilteredResult(_0x37f2fd,_0x54f063){return function(_0xec1af1){if(_0xec1af1){var _0xfa36b0=typeof _0x54f063[_0xb962('0x19')]===_0xb962('0x1a')&&typeof _0x54f063[_0xb962('0x1b')]===_0xb962('0x1a');var _0x24e63c=_0xec1af1[_0xb962('0x1c')];var _0x152dff=_0xfa36b0?0x0:_0x54f063[_0xb962('0x19')];var _0x4885b6=_0xfa36b0?_0xec1af1[_0xb962('0x1c')]:_0x54f063[_0xb962('0x19')]+_0x54f063[_0xb962('0x1b')];var _0x3ff531;if(_0x4885b6>=_0x24e63c){_0x4885b6=_0x24e63c;_0x3ff531=0xc8;}else{_0x3ff531=0xce;}_0x37f2fd[_0xb962('0x17')](_0x3ff531);return _0x37f2fd['set']('Content-Range',_0x152dff+'-'+_0x4885b6+'/'+_0x24e63c)[_0xb962('0x1d')](_0xec1af1);}return null;};}function patchUpdates(_0x4acb02){return function(_0xfc7ffd){try{jsonpatch[_0xb962('0x1e')](_0xfc7ffd,_0x4acb02,!![]);}catch(_0x48d7e9){return BPromise[_0xb962('0x1f')](_0x48d7e9);}return _0xfc7ffd[_0xb962('0x20')]();};}function saveUpdates(_0x7e6c17,_0x101869){return function(_0x37bc5a){if(_0x37bc5a){return _0x37bc5a[_0xb962('0x21')](_0x7e6c17)['then'](function(_0x2ca1a1){return _0x2ca1a1;});}return null;};}function removeEntity(_0x152983,_0x28b33c){return function(_0x3f99de){if(_0x3f99de){return _0x3f99de[_0xb962('0x22')]()[_0xb962('0x23')](function(){_0x152983[_0xb962('0x17')](0xcc)[_0xb962('0x18')]();});}};}function handleEntityNotFound(_0x530900,_0xee399){return function(_0x5f5ab2){if(!_0x5f5ab2){_0x530900[_0xb962('0x16')](0x194);}return _0x5f5ab2;};}function handleError(_0x49a4ea,_0x5a3028){_0x5a3028=_0x5a3028||0x1f4;return function(_0x52348f){logger[_0xb962('0x24')](_0x52348f['stack']);if(_0x52348f[_0xb962('0x25')]){delete _0x52348f[_0xb962('0x25')];}_0x49a4ea['status'](_0x5a3028)['send'](_0x52348f);};}exports[_0xb962('0x26')]=function(_0x1c4423,_0x3d0b0f){var _0x5c6a06={},_0x36a949={},_0x4e6b28={'count':0x0,'rows':[]};var _0x2b7ccb=_['map'](db['CmCustomField'][_0xb962('0x27')],function(_0x3b23b4){return{'name':_0x3b23b4[_0xb962('0x28')],'type':_0x3b23b4[_0xb962('0x29')]['key']};});_0x36a949[_0xb962('0x2a')]=_[_0xb962('0x2b')](_['map'](_0x2b7ccb,_0xb962('0x25')),[_0xb962('0x25')]);_0x36a949[_0xb962('0x2c')]=_[_0xb962('0x2d')](_0x1c4423['query']);_0x36a949['filters']=_['intersection'](_0x36a949[_0xb962('0x2a')],_0x36a949[_0xb962('0x2c')]);_0x5c6a06['attributes']=_[_0xb962('0x2e')](_0x36a949[_0xb962('0x2a')],qs[_0xb962('0x2f')](_0x1c4423['query'][_0xb962('0x2f')]));_0x5c6a06[_0xb962('0x30')]=_0x5c6a06[_0xb962('0x30')][_0xb962('0x31')]?_0x5c6a06[_0xb962('0x30')]:_0x36a949[_0xb962('0x2a')];if(!_0x1c4423[_0xb962('0x2c')][_0xb962('0x32')](_0xb962('0x33'))){_0x5c6a06[_0xb962('0x1b')]=qs['limit'](_0x1c4423[_0xb962('0x2c')][_0xb962('0x1b')]);_0x5c6a06[_0xb962('0x19')]=qs['offset'](_0x1c4423[_0xb962('0x2c')][_0xb962('0x19')]);}_0x5c6a06[_0xb962('0x34')]=qs[_0xb962('0x35')](_0x1c4423[_0xb962('0x2c')][_0xb962('0x35')]);_0x5c6a06[_0xb962('0x36')]=qs[_0xb962('0x37')](_['pick'](_0x1c4423[_0xb962('0x2c')],_0x36a949[_0xb962('0x37')]),_0x2b7ccb);if(_0x1c4423['query']['filter']){_0x5c6a06[_0xb962('0x36')]=_[_0xb962('0x38')](_0x5c6a06['where'],{'$or':_[_0xb962('0x39')](_0x2b7ccb,function(_0x6cd023){if(_0x6cd023[_0xb962('0x29')]!==_0xb962('0x3a')){var _0x2aec8a={};_0x2aec8a[_0x6cd023[_0xb962('0x25')]]={'$like':'%'+_0x1c4423['query'][_0xb962('0x3b')]+'%'};return _0x2aec8a;}})});}_0x5c6a06=_[_0xb962('0x38')]({},_0x5c6a06,_0x1c4423['options']);var _0x2015c8={'where':_0x5c6a06['where']};return db[_0xb962('0x3c')]['count'](_0x2015c8)[_0xb962('0x23')](function(_0x48e0de){_0x4e6b28[_0xb962('0x1c')]=_0x48e0de;if(_0x1c4423['query'][_0xb962('0x3d')]){_0x5c6a06['include']=[{'all':!![]}];}return db['CmCustomField'][_0xb962('0x3e')](_0x5c6a06);})[_0xb962('0x23')](function(_0x4e892c){_0x4e6b28[_0xb962('0x3f')]=_0x4e892c;return _0x4e6b28;})['then'](respondWithFilteredResult(_0x3d0b0f,_0x5c6a06))[_0xb962('0x40')](handleError(_0x3d0b0f,null));};exports[_0xb962('0x41')]=function(_0x4c3d0b,_0x5bdeba){var _0x35c0f8={'raw':!![],'where':{'id':_0x4c3d0b[_0xb962('0x42')]['id']}},_0x34ed19={};_0x34ed19[_0xb962('0x2a')]=_['keys'](db[_0xb962('0x3c')][_0xb962('0x27')]);_0x34ed19[_0xb962('0x2c')]=_[_0xb962('0x2d')](_0x4c3d0b[_0xb962('0x2c')]);_0x34ed19['filters']=_[_0xb962('0x2e')](_0x34ed19[_0xb962('0x2a')],_0x34ed19[_0xb962('0x2c')]);_0x35c0f8['attributes']=_[_0xb962('0x2e')](_0x34ed19[_0xb962('0x2a')],qs[_0xb962('0x2f')](_0x4c3d0b['query'][_0xb962('0x2f')]));_0x35c0f8[_0xb962('0x30')]=_0x35c0f8['attributes'][_0xb962('0x31')]?_0x35c0f8['attributes']:_0x34ed19[_0xb962('0x2a')];if(_0x4c3d0b[_0xb962('0x2c')][_0xb962('0x3d')]){_0x35c0f8[_0xb962('0x43')]=[{'all':!![]}];}_0x35c0f8=_['merge']({},_0x35c0f8,_0x4c3d0b['options']);return db[_0xb962('0x3c')]['find'](_0x35c0f8)[_0xb962('0x23')](handleEntityNotFound(_0x5bdeba,null))['then'](respondWithResult(_0x5bdeba,null))[_0xb962('0x40')](handleError(_0x5bdeba,null));};exports[_0xb962('0x21')]=function(_0x5ba0a7,_0x513875){if(_0x5ba0a7[_0xb962('0x44')]['id']){delete _0x5ba0a7[_0xb962('0x44')]['id'];}return db[_0xb962('0x3c')][_0xb962('0x45')]({'where':{'id':_0x5ba0a7[_0xb962('0x42')]['id']}})[_0xb962('0x23')](handleEntityNotFound(_0x513875,null))['then'](saveUpdates(_0x5ba0a7[_0xb962('0x44')],null))['then'](respondWithResult(_0x513875,null))['catch'](handleError(_0x513875,null));};exports[_0xb962('0x22')]=function(_0xd90f12,_0x2b576c){return db[_0xb962('0x3c')][_0xb962('0x45')]({'where':{'id':_0xd90f12['params']['id']}})[_0xb962('0x23')](handleEntityNotFound(_0x2b576c,null))[_0xb962('0x23')](removeEntity(_0x2b576c,null))[_0xb962('0x40')](handleError(_0x2b576c,null));};exports[_0xb962('0x46')]=function(_0x624ceb,_0x2e9338){var _0x29b57d;return db['sequelize']['transaction'](function(_0x80655){return db['CmCustomField'][_0xb962('0x46')](_0x624ceb[_0xb962('0x44')],{'transaction':_0x80655})[_0xb962('0x23')](function(_0x38a4a6){_0x29b57d=_0x38a4a6;var _0x1f990e={'type':db[_0xb962('0x47')][_0xb962('0x48')],'transaction':_0x80655};switch(_0x624ceb[_0xb962('0x44')][_0xb962('0x29')]){case _0xb962('0x49'):_0x1f990e['type']=db[_0xb962('0x47')][_0xb962('0x48')];break;case _0xb962('0x4a'):_0x1f990e[_0xb962('0x29')]=db[_0xb962('0x47')][_0xb962('0x4b')];break;case _0xb962('0x4c'):_0x1f990e[_0xb962('0x29')]=db[_0xb962('0x47')][_0xb962('0x4d')];_0x1f990e[_0xb962('0x4e')]=![];break;default:}return db[_0xb962('0x4f')][_0xb962('0x50')][_0xb962('0x51')](_0xb962('0x52'),util['format'](_0xb962('0x53'),_0x29b57d['id']),_0x1f990e);})['then'](function(){return _0x29b57d;});})[_0xb962('0x23')](respondWithResult(_0x2e9338,0xc9))[_0xb962('0x40')](handleError(_0x2e9338,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index bc8b19d..b0607f8 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 _0xd42b=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','cm_custom_fields','lodash'];(function(_0x1ba697,_0x186781){var _0x433b23=function(_0xe5df67){while(--_0xe5df67){_0x1ba697['push'](_0x1ba697['shift']());}};_0x433b23(++_0x186781);}(_0xd42b,0x1a1));var _0xbd42=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xd42b[_0x519756];return _0x37047e;};'use strict';var _=require(_0xbd42('0x0'));var util=require(_0xbd42('0x1'));var logger=require(_0xbd42('0x2'))(_0xbd42('0x3'));var moment=require(_0xbd42('0x4'));var BPromise=require('bluebird');var rp=require(_0xbd42('0x5'));var fs=require('fs');var path=require(_0xbd42('0x6'));var rimraf=require(_0xbd42('0x7'));var config=require(_0xbd42('0x8'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x4a6f7d,_0x49fc61){return _0x4a6f7d[_0xbd42('0x9')]('CmCustomField',attributes,{'tableName':_0xbd42('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb722=['../../config/logger','api','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','util'];(function(_0x3ce937,_0x568d7d){var _0x41d2fa=function(_0x19a409){while(--_0x19a409){_0x3ce937['push'](_0x3ce937['shift']());}};_0x41d2fa(++_0x568d7d);}(_0xb722,0x1a1));var _0x2b72=function(_0x273174,_0x4b5928){_0x273174=_0x273174-0x0;var _0x46c43d=_0xb722[_0x273174];return _0x46c43d;};'use strict';var _=require('lodash');var util=require(_0x2b72('0x0'));var logger=require(_0x2b72('0x1'))(_0x2b72('0x2'));var moment=require('moment');var BPromise=require(_0x2b72('0x3'));var rp=require(_0x2b72('0x4'));var fs=require('fs');var path=require(_0x2b72('0x5'));var rimraf=require(_0x2b72('0x6'));var config=require('../../config/environment');var attributes=require(_0x2b72('0x7'));module[_0x2b72('0x8')]=function(_0x370b0d,_0x5b51c6){return _0x370b0d[_0x2b72('0x9')](_0x2b72('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index fc21c05..b67dafc 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 _0x2baf=['then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','ioredis','../../mysqldb','jayson/promise','client','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2baf,0x119));var _0xf2ba=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0x2baf[_0x31dde9];return _0x1fbf2d;};'use strict';var _=require('lodash');var util=require(_0xf2ba('0x0'));var moment=require(_0xf2ba('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2ba('0x2'));var db=require(_0xf2ba('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf2ba('0x4'));var client=jayson[_0xf2ba('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b8d67,_0x4cf2f2,_0x2dd520){return new BPromise(function(_0xd9744c,_0x18849a){return client[_0xf2ba('0x6')](_0x2b8d67,_0x2dd520)[_0xf2ba('0x7')](function(_0x2b10dd){logger[_0xf2ba('0x8')](_0xf2ba('0x9'),_0x4cf2f2,_0xf2ba('0xa'));logger['debug'](_0xf2ba('0xb'),_0x4cf2f2,_0xf2ba('0xa'),JSON['stringify'](_0x2b10dd));if(_0x2b10dd[_0xf2ba('0xc')]){if(_0x2b10dd[_0xf2ba('0xc')][_0xf2ba('0xd')]===0x1f4){logger['error'](_0xf2ba('0x9'),_0x4cf2f2,_0x2b10dd[_0xf2ba('0xc')]['message']);return _0x18849a(_0x2b10dd[_0xf2ba('0xc')][_0xf2ba('0xe')]);}logger[_0xf2ba('0xc')](_0xf2ba('0x9'),_0x4cf2f2,_0x2b10dd['error'][_0xf2ba('0xe')]);return _0xd9744c(_0x2b10dd[_0xf2ba('0xc')][_0xf2ba('0xe')]);}else{logger['info'](_0xf2ba('0x9'),_0x4cf2f2,'request\x20sent');_0xd9744c(_0x2b10dd['result'][_0xf2ba('0xe')]);}})[_0xf2ba('0xf')](function(_0xeb095d){logger['error'](_0xf2ba('0x9'),_0x4cf2f2,_0xeb095d);_0x18849a(_0xeb095d);});});} \ No newline at end of file +var _0x4e39=['message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4a8d49,_0x56de5b){var _0x18aa2a=function(_0x18f998){while(--_0x18f998){_0x4a8d49['push'](_0x4a8d49['shift']());}};_0x18aa2a(++_0x56de5b);}(_0x4e39,0x14d));var _0x94e3=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0x4e39[_0x4702ee];return _0x62ca7d;};'use strict';var _=require(_0x94e3('0x0'));var util=require(_0x94e3('0x1'));var moment=require('moment');var BPromise=require(_0x94e3('0x2'));var rs=require(_0x94e3('0x3'));var fs=require('fs');var Redis=require(_0x94e3('0x4'));var db=require(_0x94e3('0x5'))['db'];var utils=require(_0x94e3('0x6'));var logger=require(_0x94e3('0x7'))(_0x94e3('0x8'));var config=require('../../config/environment');var jayson=require(_0x94e3('0x9'));var client=jayson['client'][_0x94e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2754e8,_0xd1cb6f,_0x5f55a9){return new BPromise(function(_0x103b2b,_0x8f229c){return client[_0x94e3('0xb')](_0x2754e8,_0x5f55a9)[_0x94e3('0xc')](function(_0x2cc24f){logger['info'](_0x94e3('0xd'),_0xd1cb6f,'request\x20sent');logger['debug'](_0x94e3('0xe'),_0xd1cb6f,_0x94e3('0xf'),JSON[_0x94e3('0x10')](_0x2cc24f));if(_0x2cc24f[_0x94e3('0x11')]){if(_0x2cc24f[_0x94e3('0x11')][_0x94e3('0x12')]===0x1f4){logger[_0x94e3('0x11')](_0x94e3('0xd'),_0xd1cb6f,_0x2cc24f[_0x94e3('0x11')][_0x94e3('0x13')]);return _0x8f229c(_0x2cc24f[_0x94e3('0x11')][_0x94e3('0x13')]);}logger[_0x94e3('0x11')](_0x94e3('0xd'),_0xd1cb6f,_0x2cc24f[_0x94e3('0x11')]['message']);return _0x103b2b(_0x2cc24f[_0x94e3('0x11')]['message']);}else{logger[_0x94e3('0x14')]('CmCustomField,\x20%s,\x20%s',_0xd1cb6f,_0x94e3('0xf'));_0x103b2b(_0x2cc24f['result'][_0x94e3('0x13')]);}})[_0x94e3('0x15')](function(_0x3c59e1){logger[_0x94e3('0x11')](_0x94e3('0xd'),_0xd1cb6f,_0x3c59e1);_0x8f229c(_0x3c59e1);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 41e15e0..196d312 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 _0x0e50=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','/:id','post','create','put','delete','destroy','exports','multer'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0x0e50,0x168));var _0x00e5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0e50[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x00e5('0x0'));var util=require(_0x00e5('0x1'));var path=require(_0x00e5('0x2'));var timeout=require('connect-timeout');var express=require(_0x00e5('0x3'));var router=express[_0x00e5('0x4')]();var fs_extra=require(_0x00e5('0x5'));var auth=require(_0x00e5('0x6'));var interaction=require(_0x00e5('0x7'));var config=require('../../config/environment');var controller=require(_0x00e5('0x8'));router['get']('/',auth[_0x00e5('0x9')](),controller[_0x00e5('0xa')]);router[_0x00e5('0xb')](_0x00e5('0xc'),auth[_0x00e5('0x9')](),controller['show']);router[_0x00e5('0xd')]('/',auth[_0x00e5('0x9')](),controller[_0x00e5('0xe')]);router[_0x00e5('0xf')](_0x00e5('0xc'),auth[_0x00e5('0x9')](),controller['update']);router[_0x00e5('0x10')](_0x00e5('0xc'),auth['isAuthenticated'](),controller[_0x00e5('0x11')]);module[_0x00e5('0x12')]=router; \ No newline at end of file +var _0xb39f=['get','/:id','post','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xb39f,0x1e6));var _0xfb39=function(_0x24b2ac,_0x254ba8){_0x24b2ac=_0x24b2ac-0x0;var _0x51a158=_0xb39f[_0x24b2ac];return _0x51a158;};'use strict';var multer=require(_0xfb39('0x0'));var util=require(_0xfb39('0x1'));var path=require(_0xfb39('0x2'));var timeout=require(_0xfb39('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfb39('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfb39('0x5'));var controller=require(_0xfb39('0x6'));router['get']('/',auth[_0xfb39('0x7')](),controller[_0xfb39('0x8')]);router[_0xfb39('0x9')](_0xfb39('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xfb39('0xb')]('/',auth[_0xfb39('0x7')](),controller['create']);router['put']('/:id',auth[_0xfb39('0x7')](),controller[_0xfb39('0xc')]);router[_0xfb39('0xd')](_0xfb39('0xa'),auth[_0xfb39('0x7')](),controller['destroy']);module[_0xfb39('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7df4cf5..14800bd 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 _0x8f3c=['contactListQueue','DATE','moment','sequelize','exports','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING'];(function(_0x5536ae,_0x39646c){var _0x6c37fe=function(_0x55e386){while(--_0x55e386){_0x5536ae['push'](_0x5536ae['shift']());}};_0x6c37fe(++_0x39646c);}(_0x8f3c,0x188));var _0xc8f3=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x8f3c[_0x2aea9e];return _0x430b92;};'use strict';var moment=require(_0xc8f3('0x0'));var Sequelize=require(_0xc8f3('0x1'));module[_0xc8f3('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xc8f3('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xc8f3('0x4')](_0xc8f3('0x5'))},'countbusyretry':{'type':Sequelize[_0xc8f3('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc8f3('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc8f3('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc8f3('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc8f3('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xc8f3('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xc8f3('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xc8f3('0x8')},'ListId':{'type':Sequelize[_0xc8f3('0x6')],'unique':_0xc8f3('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xc8f3('0x6')],'unique':_0xc8f3('0x8')},'CampaignId':{'type':Sequelize[_0xc8f3('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc8f3('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc8f3('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xc8f3('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc8f3('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0xc8f3('0x9')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa744=['moment','BOOLEAN','DATE','format','INTEGER','STRING','UNSIGNED','contactListQueue'];(function(_0x205e83,_0x2df5a4){var _0x10bb19=function(_0x41a375){while(--_0x41a375){_0x205e83['push'](_0x205e83['shift']());}};_0x10bb19(++_0x2df5a4);}(_0xa744,0x150));var _0x4a74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa744[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x4a74('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x4a74('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4a74('0x2')],'defaultValue':moment()[_0x4a74('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x4a74('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4a74('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4a74('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4a74('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4a74('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4a74('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4a74('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4a74('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4a74('0x7')},'UserId':{'type':Sequelize[_0x4a74('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x4a74('0x4')],'unique':_0x4a74('0x7')},'CampaignId':{'type':Sequelize[_0x4a74('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x4a74('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4a74('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4a74('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4a74('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x4a74('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4a74('0x5')]},'recallmeNotifiedDate':{'type':Sequelize[_0x4a74('0x2')],'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 33ecb9d..cc8f875 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 _0x9f5a=['omit','dataValues','state','statedesc','campaign','membername','user','UserId','deleted','calleridnum','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','finally','CmHopperFinal','end','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','phone','LOCK','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','findOne','scheduledat','UPDATE','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','update','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$between','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','rows','catch','params','length','includeAll','include','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue'];(function(_0x2c3411,_0x1f1e70){var _0x58db4e=function(_0x5363b0){while(--_0x5363b0){_0x2c3411['push'](_0x2c3411['shift']());}};_0x58db4e(++_0x1f1e70);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x5bee75,_0x5a88c5){_0x5bee75=_0x5bee75-0x0;var _0x62351d=_0x9f5a[_0x5bee75];return _0x62351d;};'use strict';var moment=require(_0xa9f5('0x0'));var _=require(_0xa9f5('0x1'));var qs=require(_0xa9f5('0x2'));var logger=require(_0xa9f5('0x3'))('api');var shared=require(_0xa9f5('0x4'));var db=require(_0xa9f5('0x5'))['db'];function respondWithResult(_0x3cdf79,_0x4eeedd){_0x4eeedd=_0x4eeedd||0xc8;return function(_0x20f51f){if(_0x20f51f){return _0x3cdf79['status'](_0x4eeedd)[_0xa9f5('0x6')](_0x20f51f);}};}function respondWithFilteredResult(_0x219e89,_0x49e337){return function(_0x6c040d){if(_0x6c040d){var _0x285dad=typeof _0x49e337[_0xa9f5('0x7')]===_0xa9f5('0x8')&&typeof _0x49e337[_0xa9f5('0x9')]===_0xa9f5('0x8');var _0x189ef8=_0x6c040d['count'];var _0x2e0ff8=_0x285dad?0x0:_0x49e337[_0xa9f5('0x7')];var _0x4bb362=_0x285dad?_0x6c040d[_0xa9f5('0xa')]:_0x49e337[_0xa9f5('0x7')]+_0x49e337['limit'];var _0x5866a1;if(_0x4bb362>=_0x189ef8){_0x4bb362=_0x189ef8;_0x5866a1=0xc8;}else{_0x5866a1=0xce;}_0x219e89[_0xa9f5('0xb')](_0x5866a1);return _0x219e89[_0xa9f5('0xc')](_0xa9f5('0xd'),_0x2e0ff8+'-'+_0x4bb362+'/'+_0x189ef8)[_0xa9f5('0x6')](_0x6c040d);}return null;};}function saveUpdates(_0x4c26a8,_0x788dec){return function(_0x24ce85){if(_0x24ce85){return _0x24ce85[_0xa9f5('0xe')](_0x4c26a8)['then'](function(_0xc78de5){return _0xc78de5;});}return null;};}function handleEntityNotFound(_0x899513,_0x5a5653){return function(_0x58609c){if(!_0x58609c){_0x899513['sendStatus'](0x194);}return _0x58609c;};}function handleError(_0x100e72,_0x48bfdc){_0x48bfdc=_0x48bfdc||0x1f4;return function(_0x5f2b6a){logger[_0xa9f5('0xf')](_0x5f2b6a[_0xa9f5('0x10')]);if(_0x5f2b6a[_0xa9f5('0x11')]){delete _0x5f2b6a[_0xa9f5('0x11')];}_0x100e72['status'](_0x48bfdc)[_0xa9f5('0x12')](_0x5f2b6a);};}exports[_0xa9f5('0x13')]=function(_0x230fc2,_0x45af85){var _0x2fe6a7={},_0x1ee027={},_0x3b706b={'count':0x0,'rows':[]};var _0x430acb=_[_0xa9f5('0x14')](db[_0xa9f5('0x15')][_0xa9f5('0x16')],function(_0x27a7b0){return{'name':_0x27a7b0['fieldName'],'type':_0x27a7b0[_0xa9f5('0x17')][_0xa9f5('0x18')]};});_0x1ee027[_0xa9f5('0x19')]=_[_0xa9f5('0x14')](_0x430acb,_0xa9f5('0x11'));_0x1ee027[_0xa9f5('0x1a')]=_[_0xa9f5('0x1b')](_0x230fc2['query']);_0x1ee027[_0xa9f5('0x1c')]=_[_0xa9f5('0x1d')](_0x1ee027[_0xa9f5('0x19')],_0x1ee027[_0xa9f5('0x1a')]);_0x1ee027[_0xa9f5('0x1c')]=_[_0xa9f5('0x1e')](_0x1ee027[_0xa9f5('0x1c')],[_0xa9f5('0x1f'),'$or',_0xa9f5('0x20'),_0xa9f5('0x21'),_0xa9f5('0x22'),_0xa9f5('0x23'),_0xa9f5('0x24'),_0xa9f5('0x25'),'$not',_0xa9f5('0x26'),'$notBetween','$in','$notIn',_0xa9f5('0x27'),_0xa9f5('0x28'),_0xa9f5('0x29'),_0xa9f5('0x2a'),_0xa9f5('0x27'),_0xa9f5('0x2b'),'$contains',_0xa9f5('0x2c'),_0xa9f5('0x2d')]);_0x2fe6a7[_0xa9f5('0x2e')]=_[_0xa9f5('0x1d')](_0x1ee027[_0xa9f5('0x19')],qs[_0xa9f5('0x2f')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x2f')]));_0x2fe6a7['attributes']=_0x2fe6a7['attributes']['length']?_0x2fe6a7[_0xa9f5('0x2e')]:_0x1ee027[_0xa9f5('0x19')];if(!_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x30')](_0xa9f5('0x31'))){_0x2fe6a7[_0xa9f5('0x9')]=qs[_0xa9f5('0x9')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x9')]);_0x2fe6a7[_0xa9f5('0x7')]=qs[_0xa9f5('0x7')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x7')]);}_0x2fe6a7['order']=qs[_0xa9f5('0x32')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x32')]);_0x2fe6a7[_0xa9f5('0x33')]=qs[_0xa9f5('0x1c')](_[_0xa9f5('0x34')](_0x230fc2[_0xa9f5('0x1a')],_0x1ee027[_0xa9f5('0x1c')]),_0x430acb);if(_0x230fc2['query'][_0xa9f5('0x35')]){_0x2fe6a7['where']=_[_0xa9f5('0x36')](_0x2fe6a7[_0xa9f5('0x33')],{'$or':_['map'](_0x430acb,function(_0x11cc39){if(_0x11cc39[_0xa9f5('0x17')]!==_0xa9f5('0x37')){var _0x2cbd28={};_0x2cbd28[_0x11cc39['name']]={'$like':'%'+_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x35')]+'%'};return _0x2cbd28;}})});}_0x2fe6a7=_['merge']({},_0x2fe6a7,_0x230fc2[_0xa9f5('0x38')]);var _0x23232b={'where':_0x2fe6a7[_0xa9f5('0x33')]};return db[_0xa9f5('0x15')][_0xa9f5('0xa')](_0x23232b)[_0xa9f5('0x39')](function(_0x1d71f8){_0x3b706b[_0xa9f5('0xa')]=_0x1d71f8;if(_0x230fc2[_0xa9f5('0x1a')]['includeAll']){_0x2fe6a7['include']=[{'all':!![]}];}return db[_0xa9f5('0x15')][_0xa9f5('0x3a')](_0x2fe6a7);})['then'](function(_0x90b200){_0x3b706b[_0xa9f5('0x3b')]=_0x90b200;return _0x3b706b;})[_0xa9f5('0x39')](respondWithFilteredResult(_0x45af85,_0x2fe6a7))[_0xa9f5('0x3c')](handleError(_0x45af85,null));};exports['show']=function(_0x2bc650,_0x39f83f){var _0x5a4715={'raw':!![],'where':{'id':_0x2bc650[_0xa9f5('0x3d')]['id']}},_0x1d856f={};_0x1d856f['model']=_[_0xa9f5('0x1b')](db[_0xa9f5('0x15')]['rawAttributes']);_0x1d856f[_0xa9f5('0x1a')]=_[_0xa9f5('0x1b')](_0x2bc650['query']);_0x1d856f[_0xa9f5('0x1c')]=_[_0xa9f5('0x1d')](_0x1d856f['model'],_0x1d856f[_0xa9f5('0x1a')]);_0x5a4715['attributes']=_[_0xa9f5('0x1d')](_0x1d856f[_0xa9f5('0x19')],qs['fields'](_0x2bc650[_0xa9f5('0x1a')]['fields']));_0x5a4715['attributes']=_0x5a4715[_0xa9f5('0x2e')][_0xa9f5('0x3e')]?_0x5a4715[_0xa9f5('0x2e')]:_0x1d856f[_0xa9f5('0x19')];if(_0x2bc650[_0xa9f5('0x1a')][_0xa9f5('0x3f')]){_0x5a4715[_0xa9f5('0x40')]=[{'all':!![]}];}_0x5a4715=_[_0xa9f5('0x36')]({},_0x5a4715,_0x2bc650[_0xa9f5('0x38')]);return db['CmHopper'][_0xa9f5('0x41')](_0x5a4715)[_0xa9f5('0x39')](handleEntityNotFound(_0x39f83f,null))[_0xa9f5('0x39')](respondWithResult(_0x39f83f,null))[_0xa9f5('0x3c')](handleError(_0x39f83f,null));};exports[_0xa9f5('0x42')]=function(_0x2b00db,_0x11c1d4){return db[_0xa9f5('0x15')][_0xa9f5('0x42')](_0x2b00db[_0xa9f5('0x43')],{})[_0xa9f5('0x39')](respondWithResult(_0x11c1d4,0xc9))[_0xa9f5('0x3c')](handleError(_0x11c1d4,null));};exports[_0xa9f5('0xe')]=function(_0xd95e3,_0x2dc190){if(_0xd95e3[_0xa9f5('0x43')]['id']){delete _0xd95e3[_0xa9f5('0x43')]['id'];}return db[_0xa9f5('0x15')][_0xa9f5('0x41')]({'where':{'id':_0xd95e3['params']['id']}})['then'](handleEntityNotFound(_0x2dc190,null))[_0xa9f5('0x39')](saveUpdates(_0xd95e3[_0xa9f5('0x43')],null))['then'](respondWithResult(_0x2dc190,null))[_0xa9f5('0x3c')](handleError(_0x2dc190,null));};exports[_0xa9f5('0x44')]=function(_0x44ee96,_0x59e5b7){return db[_0xa9f5('0x15')]['describe']()[_0xa9f5('0x39')](respondWithResult(_0x59e5b7,null))[_0xa9f5('0x3c')](handleError(_0x59e5b7,null));};exports[_0xa9f5('0x45')]=function(_0x836a8d,_0x102ed8){var _0x57c877;var _0x4e17a9=_0x836a8d[_0xa9f5('0x3d')]['id'];return db['CmHopper']['find']({'where':{'id':_0x836a8d[_0xa9f5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x102ed8,null))[_0xa9f5('0x39')](function(_0x56fe65){if(_0x56fe65){return _0x56fe65[_0xa9f5('0x45')]()[_0xa9f5('0x39')](function(_0xafeecc){return _0xafeecc;});}})['then'](function(_0x2cc06e){_0x57c877=_0x2cc06e;if(_0x2cc06e){if(_0x2cc06e[_0xa9f5('0x46')]||_0x2cc06e[_0xa9f5('0x47')]){return db[_0x2cc06e['VoiceQueueId']?_0xa9f5('0x48'):'Campaign']['find']({'where':{'id':_0x2cc06e[_0xa9f5('0x46')]?_0x2cc06e[_0xa9f5('0x46')]:_0x2cc06e[_0xa9f5('0x47')]},'attributes':['id',_0xa9f5('0x11')],'raw':!![]});}}})['then'](function(_0x31cf70){var _0x58b278={};if(_0x31cf70){_[_0xa9f5('0x36')](_0x58b278,_[_0xa9f5('0x49')](_0x57c877[_0xa9f5('0x4a')],['createdAt','updatedAt','id']));_0x58b278[_0xa9f5('0x4b')]=0x15;_0x58b278[_0xa9f5('0x4c')]='deleted';_0x58b278[_0xa9f5('0x4d')]=_0x31cf70[_0xa9f5('0x11')];_0x58b278[_0xa9f5('0x4e')]=_0x836a8d[_0xa9f5('0x4f')][_0xa9f5('0x11')];_0x58b278[_0xa9f5('0x50')]=_0x836a8d[_0xa9f5('0x4f')]['id'];_0x58b278[_0xa9f5('0x51')]=!![];_0x58b278['deletedat']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58b278[_0xa9f5('0x52')]=_0x57c877['phone'];_0x58b278[_0xa9f5('0x53')]=_0x57c877[_0xa9f5('0x46')]?_0xa9f5('0x54'):_0xa9f5('0x55');return db[_0xa9f5('0x56')][_0xa9f5('0x41')]({'where':{'id':_0x58b278['ContactId']},'attributes':[_0xa9f5('0x57'),_0xa9f5('0x58')]})[_0xa9f5('0x39')](function(_0x19dad6){if(!_[_0xa9f5('0x59')](_0x102ed8)&&!_['isNil'](_0x19dad6[_0xa9f5('0x57')])){_0x58b278['calleridname']=_0x19dad6['firstName'];if(!_['isNil'](_0x19dad6[_0xa9f5('0x58')])){_0x58b278['calleridname']+='\x20'+_0x19dad6[_0xa9f5('0x58')];}}})[_0xa9f5('0x5a')](function(){return db[_0xa9f5('0x5b')]['create'](_0x58b278);});}})['then'](function(_0x2ee9cf){return db['CmHopperAdditionalPhone'][_0xa9f5('0x45')]({'where':{'CmHopperId':_0x4e17a9}});})[_0xa9f5('0x39')](function(){return _0x102ed8[_0xa9f5('0xb')](0xcc)[_0xa9f5('0x5c')]();})[_0xa9f5('0x3c')](handleError(_0x102ed8,null));};exports[_0xa9f5('0x5d')]=function(_0x34c6cb,_0x28ee02){var _0x326a87=[];return db['CmContact']['describe']()[_0xa9f5('0x39')](function(_0x51bd6f){_0x326a87=_[_0xa9f5('0x1b')](_0x51bd6f);return _0x34c6cb[_0xa9f5('0x4f')]['getVoiceQueues']({'where':{'type':_0xa9f5('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa9f5('0x5f'),_0xa9f5('0x60')],'raw':!![]});})[_0xa9f5('0x39')](function(_0x5c661e){if(_0x5c661e&&_0x5c661e[_0xa9f5('0x3e')]){return db[_0xa9f5('0x61')][_0xa9f5('0x62')](function(_0x5ab4c0){var _0x2eaa8c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa9f5('0x63')](_0xa9f5('0x64'))},'VoiceQueueId':{'$in':_[_0xa9f5('0x14')](_0x5c661e,'id')},'$or':[{'UserId':null},{'UserId':_0x34c6cb[_0xa9f5('0x4f')]['id']}]};var _0x5f0986={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5c661e)[_0xa9f5('0x35')](['dialPreviewAutoRecallMe',0x0])[_0xa9f5('0x14')]('id')[_0xa9f5('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x34c6cb[_0xa9f5('0x4f')]['id']}]};var _0x272c19={'$or':[_0x2eaa8c,_0x5f0986]};var _0x3a79f1=[];if(_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x66')]&&_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x66')]===_0xa9f5('0x67')){if(!_[_0xa9f5('0x68')](_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x69')])){_0x272c19['id']={'$in':_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x69')]};}_0x3a79f1=[['priority',_0xa9f5('0x6a')],[_0xa9f5('0x6b'),_0x5c661e[0x0][_0xa9f5('0x5f')]===_0xa9f5('0x6a')?'DESC':_0xa9f5('0x6a')],db[_0xa9f5('0x61')][_0xa9f5('0x6c')](_0xa9f5('0x6d')),['id','DESC']];}else{if(!_[_0xa9f5('0x68')](_0x34c6cb[_0xa9f5('0x43')]['hopperIds'])){_0x272c19['id']={'$notIn':_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x69')]};}_0x3a79f1=[['priority','DESC'],[_0xa9f5('0x6b'),_0x5c661e[0x0][_0xa9f5('0x5f')]],db[_0xa9f5('0x61')][_0xa9f5('0x6c')](_0xa9f5('0x6e')),['id',_0xa9f5('0x6a')]];}return db[_0xa9f5('0x15')]['findOne']({'attributes':['id','scheduledat',_0xa9f5('0x6f'),'recallme'],'where':_0x272c19,'order':_0x3a79f1,'transaction':_0x5ab4c0,'lock':_0x5ab4c0[_0xa9f5('0x70')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa9f5('0x71'),'attributes':_0x326a87,'include':[{'model':db[_0xa9f5('0x72')],'as':_0xa9f5('0x73'),'attributes':['id',_0xa9f5('0x11')]}]},{'model':db['CmList'],'as':_0xa9f5('0x74'),'attributes':['id',_0xa9f5('0x11')]},{'model':db[_0xa9f5('0x48')],'as':_0xa9f5('0x75'),'attributes':['id',_0xa9f5('0x11'),_0xa9f5('0x76')]}]})[_0xa9f5('0x39')](function(_0x25da3e){if(_0x25da3e){return _0x25da3e[_0xa9f5('0xe')]({'UserId':_0x34c6cb[_0xa9f5('0x4f')]['id']},{'transaction':_0x5ab4c0});}});});}})['then'](handleEntityNotFound(_0x28ee02,null))['then'](respondWithResult(_0x28ee02,null))[_0xa9f5('0x3c')](handleError(_0x28ee02,null));};exports[_0xa9f5('0x77')]=function(_0x53875e,_0x52cae4,_0x3c754a){var _0x18647f=[];var _0x36b1a0=_0x53875e[_0xa9f5('0x3d')]['id'];var _0x26a27a=_0x53875e[_0xa9f5('0x4f')]['id'];return db[_0xa9f5('0x56')][_0xa9f5('0x44')]()[_0xa9f5('0x39')](function(_0x56d603){_0x18647f=_['keys'](_0x56d603);return db[_0xa9f5('0x61')][_0xa9f5('0x62')](function(_0x5a8788){const _0x5e7a9b={'id':_0x36b1a0};return db[_0xa9f5('0x15')][_0xa9f5('0x78')]({'attributes':['id',_0xa9f5('0x79'),'recallme'],'where':_0x5e7a9b,'transaction':_0x5a8788,'lock':_0x5a8788[_0xa9f5('0x70')][_0xa9f5('0x7a')],'include':[{'model':db[_0xa9f5('0x56')],'as':'Contact','attributes':_0x18647f,'include':[{'model':db[_0xa9f5('0x72')],'as':_0xa9f5('0x73'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xa9f5('0x74'),'attributes':['id','name']},{'model':db[_0xa9f5('0x48')],'as':_0xa9f5('0x75'),'attributes':['id',_0xa9f5('0x11'),'dialActive']}]})[_0xa9f5('0x39')](function(_0x4b61e5){if(_0x4b61e5){return _0x4b61e5['update']({'UserId':_0x26a27a},{'transaction':_0x5a8788});}});});})[_0xa9f5('0x39')](handleEntityNotFound(_0x52cae4,null))[_0xa9f5('0x39')](respondWithResult(_0x52cae4,null))[_0xa9f5('0x3c')](handleError(_0x52cae4,null));};exports[_0xa9f5('0x7b')]=function(_0x4e874b,_0x2ba0c2){return _0x4e874b[_0xa9f5('0x4f')]['getVoiceQueues']({'where':{'type':_0xa9f5('0x5e'),'dialActive':!![],'dialMethod':_0xa9f5('0x7c')},'attributes':['id'],'raw':!![]})['then'](function(_0x5effe9){if(_0x5effe9&&_0x5effe9[_0xa9f5('0x3e')]){return db[_0xa9f5('0x15')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa9f5('0x63')](_0xa9f5('0x64'))},'VoiceQueueId':{'$in':_[_0xa9f5('0x14')](_0x5effe9,'id')},'$or':[{'UserId':null},{'UserId':_0x4e874b[_0xa9f5('0x4f')]['id']}]}});}return 0x0;})[_0xa9f5('0x39')](function(_0x413ad5){if(!_[_0xa9f5('0x59')](_0x413ad5)&&_[_0xa9f5('0x7d')](_0x413ad5)){return _0x2ba0c2[_0xa9f5('0xb')](0xc8)[_0xa9f5('0x6')]({'contacts':_0x413ad5});}else{logger[_0xa9f5('0xf')](_0xa9f5('0x7e'),_0xa9f5('0x7b'),0x194,_0xa9f5('0x7f'));_0x2ba0c2[_0xa9f5('0x80')](0x194);}})['catch'](handleError(_0x2ba0c2,null));};exports[_0xa9f5('0x81')]=function(_0x32e2d5,_0x5662ce){var _0x2b44c0=shared[_0xa9f5('0x82')];var _0x314942=[];_[_0xa9f5('0x14')](_0x2b44c0,function(_0x2e5e6c){_0x314942['push']({'id':_0x2e5e6c['name'],'name':_0x2e5e6c[_0xa9f5('0x11')],'utcOffset':_0x2e5e6c['utcOffset']});});return _0x5662ce[_0xa9f5('0xb')](0xc8)[_0xa9f5('0x6')]({'tz':_0x314942});};exports['getTimezone']=function(_0xabacab,_0x4ebc6e){var _0x3afef3=shared[_0xa9f5('0x82')];var _0x37be26={};if(!_[_0xa9f5('0x59')](_0x3afef3[_0xabacab['body']['id']]))_0x37be26=_0x3afef3[_0xabacab[_0xa9f5('0x43')]['id']];return _0x4ebc6e[_0xa9f5('0xb')](0xc8)[_0xa9f5('0x6')](_0x37be26);}; \ No newline at end of file +var _0x4ab0=['find','catch','create','body','update','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','finally','CmHopperFinal','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','prev','isEmpty','hopperIds','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','LOCK','UPDATE','Contact','Company','CmList','List','dialActive','recallme','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','json','offset','limit','undefined','count','status','set','Content-Range','then','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','key','query','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$contains','$contained','$any','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','includeAll','include','findAll','rows','show','params','keys','options'];(function(_0x11d5a1,_0x560e85){var _0x4c1187=function(_0x455411){while(--_0x455411){_0x11d5a1['push'](_0x11d5a1['shift']());}};_0x4c1187(++_0x560e85);}(_0x4ab0,0xd5));var _0x04ab=function(_0xe21d41,_0x4ffb1a){_0xe21d41=_0xe21d41-0x0;var _0x204834=_0x4ab0[_0xe21d41];return _0x204834;};'use strict';var moment=require('moment');var _=require(_0x04ab('0x0'));var qs=require(_0x04ab('0x1'));var logger=require(_0x04ab('0x2'))(_0x04ab('0x3'));var shared=require(_0x04ab('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x4c3a53,_0x45dfee){_0x45dfee=_0x45dfee||0xc8;return function(_0xb1bf2d){if(_0xb1bf2d){return _0x4c3a53['status'](_0x45dfee)[_0x04ab('0x5')](_0xb1bf2d);}};}function respondWithFilteredResult(_0x2c5730,_0x4edd2e){return function(_0x3f5901){if(_0x3f5901){var _0x293f1d=typeof _0x4edd2e[_0x04ab('0x6')]==='undefined'&&typeof _0x4edd2e[_0x04ab('0x7')]===_0x04ab('0x8');var _0x13fde9=_0x3f5901[_0x04ab('0x9')];var _0x4dc264=_0x293f1d?0x0:_0x4edd2e[_0x04ab('0x6')];var _0x3608b7=_0x293f1d?_0x3f5901[_0x04ab('0x9')]:_0x4edd2e[_0x04ab('0x6')]+_0x4edd2e['limit'];var _0x3f91fe;if(_0x3608b7>=_0x13fde9){_0x3608b7=_0x13fde9;_0x3f91fe=0xc8;}else{_0x3f91fe=0xce;}_0x2c5730[_0x04ab('0xa')](_0x3f91fe);return _0x2c5730[_0x04ab('0xb')](_0x04ab('0xc'),_0x4dc264+'-'+_0x3608b7+'/'+_0x13fde9)[_0x04ab('0x5')](_0x3f5901);}return null;};}function saveUpdates(_0x386d0a,_0x4a6b39){return function(_0x710503){if(_0x710503){return _0x710503['update'](_0x386d0a)[_0x04ab('0xd')](function(_0xef8710){return _0xef8710;});}return null;};}function handleEntityNotFound(_0x2abdf8,_0x428798){return function(_0x4f0da1){if(!_0x4f0da1){_0x2abdf8['sendStatus'](0x194);}return _0x4f0da1;};}function handleError(_0x58aef3,_0x103ca8){_0x103ca8=_0x103ca8||0x1f4;return function(_0x3cee44){logger[_0x04ab('0xe')](_0x3cee44[_0x04ab('0xf')]);if(_0x3cee44[_0x04ab('0x10')]){delete _0x3cee44[_0x04ab('0x10')];}_0x58aef3[_0x04ab('0xa')](_0x103ca8)[_0x04ab('0x11')](_0x3cee44);};}exports[_0x04ab('0x12')]=function(_0x205600,_0x5ce43c){var _0x45c328={},_0x83ab27={},_0x292eae={'count':0x0,'rows':[]};var _0xea243f=_[_0x04ab('0x13')](db[_0x04ab('0x14')][_0x04ab('0x15')],function(_0x1d3210){return{'name':_0x1d3210[_0x04ab('0x16')],'type':_0x1d3210['type'][_0x04ab('0x17')]};});_0x83ab27['model']=_[_0x04ab('0x13')](_0xea243f,_0x04ab('0x10'));_0x83ab27[_0x04ab('0x18')]=_['keys'](_0x205600[_0x04ab('0x18')]);_0x83ab27[_0x04ab('0x19')]=_[_0x04ab('0x1a')](_0x83ab27['model'],_0x83ab27['query']);_0x83ab27[_0x04ab('0x19')]=_[_0x04ab('0x1b')](_0x83ab27['filters'],['$and',_0x04ab('0x1c'),_0x04ab('0x1d'),_0x04ab('0x1e'),_0x04ab('0x1f'),_0x04ab('0x20'),_0x04ab('0x21'),_0x04ab('0x22'),_0x04ab('0x23'),_0x04ab('0x24'),'$notBetween',_0x04ab('0x25'),_0x04ab('0x26'),_0x04ab('0x27'),_0x04ab('0x28'),'$iLike','$notILike',_0x04ab('0x27'),'$overlap',_0x04ab('0x29'),_0x04ab('0x2a'),_0x04ab('0x2b')]);_0x45c328[_0x04ab('0x2c')]=_[_0x04ab('0x1a')](_0x83ab27['model'],qs['fields'](_0x205600[_0x04ab('0x18')][_0x04ab('0x2d')]));_0x45c328[_0x04ab('0x2c')]=_0x45c328[_0x04ab('0x2c')][_0x04ab('0x2e')]?_0x45c328[_0x04ab('0x2c')]:_0x83ab27[_0x04ab('0x2f')];if(!_0x205600[_0x04ab('0x18')][_0x04ab('0x30')](_0x04ab('0x31'))){_0x45c328[_0x04ab('0x7')]=qs[_0x04ab('0x7')](_0x205600[_0x04ab('0x18')]['limit']);_0x45c328[_0x04ab('0x6')]=qs[_0x04ab('0x6')](_0x205600['query'][_0x04ab('0x6')]);}_0x45c328[_0x04ab('0x32')]=qs['sort'](_0x205600[_0x04ab('0x18')][_0x04ab('0x33')]);_0x45c328['where']=qs[_0x04ab('0x19')](_[_0x04ab('0x34')](_0x205600[_0x04ab('0x18')],_0x83ab27[_0x04ab('0x19')]),_0xea243f);if(_0x205600[_0x04ab('0x18')][_0x04ab('0x35')]){_0x45c328['where']=_[_0x04ab('0x36')](_0x45c328[_0x04ab('0x37')],{'$or':_[_0x04ab('0x13')](_0xea243f,function(_0x4fb442){if(_0x4fb442[_0x04ab('0x38')]!=='VIRTUAL'){var _0x53c52b={};_0x53c52b[_0x4fb442[_0x04ab('0x10')]]={'$like':'%'+_0x205600[_0x04ab('0x18')]['filter']+'%'};return _0x53c52b;}})});}_0x45c328=_[_0x04ab('0x36')]({},_0x45c328,_0x205600['options']);var _0x3c66a8={'where':_0x45c328[_0x04ab('0x37')]};return db[_0x04ab('0x14')][_0x04ab('0x9')](_0x3c66a8)[_0x04ab('0xd')](function(_0x4018fa){_0x292eae[_0x04ab('0x9')]=_0x4018fa;if(_0x205600[_0x04ab('0x18')][_0x04ab('0x39')]){_0x45c328[_0x04ab('0x3a')]=[{'all':!![]}];}return db[_0x04ab('0x14')][_0x04ab('0x3b')](_0x45c328);})['then'](function(_0x574c6e){_0x292eae[_0x04ab('0x3c')]=_0x574c6e;return _0x292eae;})['then'](respondWithFilteredResult(_0x5ce43c,_0x45c328))['catch'](handleError(_0x5ce43c,null));};exports[_0x04ab('0x3d')]=function(_0x206f0d,_0x369e03){var _0x4327b9={'raw':!![],'where':{'id':_0x206f0d[_0x04ab('0x3e')]['id']}},_0x5b6937={};_0x5b6937[_0x04ab('0x2f')]=_[_0x04ab('0x3f')](db[_0x04ab('0x14')]['rawAttributes']);_0x5b6937[_0x04ab('0x18')]=_[_0x04ab('0x3f')](_0x206f0d[_0x04ab('0x18')]);_0x5b6937[_0x04ab('0x19')]=_[_0x04ab('0x1a')](_0x5b6937[_0x04ab('0x2f')],_0x5b6937[_0x04ab('0x18')]);_0x4327b9[_0x04ab('0x2c')]=_['intersection'](_0x5b6937['model'],qs[_0x04ab('0x2d')](_0x206f0d[_0x04ab('0x18')][_0x04ab('0x2d')]));_0x4327b9[_0x04ab('0x2c')]=_0x4327b9[_0x04ab('0x2c')]['length']?_0x4327b9[_0x04ab('0x2c')]:_0x5b6937[_0x04ab('0x2f')];if(_0x206f0d[_0x04ab('0x18')]['includeAll']){_0x4327b9[_0x04ab('0x3a')]=[{'all':!![]}];}_0x4327b9=_[_0x04ab('0x36')]({},_0x4327b9,_0x206f0d[_0x04ab('0x40')]);return db[_0x04ab('0x14')][_0x04ab('0x41')](_0x4327b9)[_0x04ab('0xd')](handleEntityNotFound(_0x369e03,null))[_0x04ab('0xd')](respondWithResult(_0x369e03,null))[_0x04ab('0x42')](handleError(_0x369e03,null));};exports[_0x04ab('0x43')]=function(_0x183464,_0x49999e){return db[_0x04ab('0x14')][_0x04ab('0x43')](_0x183464[_0x04ab('0x44')],{})[_0x04ab('0xd')](respondWithResult(_0x49999e,0xc9))[_0x04ab('0x42')](handleError(_0x49999e,null));};exports[_0x04ab('0x45')]=function(_0x4b4536,_0x272689){if(_0x4b4536[_0x04ab('0x44')]['id']){delete _0x4b4536[_0x04ab('0x44')]['id'];}return db[_0x04ab('0x14')]['find']({'where':{'id':_0x4b4536[_0x04ab('0x3e')]['id']}})[_0x04ab('0xd')](handleEntityNotFound(_0x272689,null))[_0x04ab('0xd')](saveUpdates(_0x4b4536[_0x04ab('0x44')],null))[_0x04ab('0xd')](respondWithResult(_0x272689,null))['catch'](handleError(_0x272689,null));};exports[_0x04ab('0x46')]=function(_0x15b995,_0x551f94){return db['CmHopper'][_0x04ab('0x46')]()[_0x04ab('0xd')](respondWithResult(_0x551f94,null))[_0x04ab('0x42')](handleError(_0x551f94,null));};exports[_0x04ab('0x47')]=function(_0x1c4aa2,_0x3a9056){var _0xae46c7;var _0x5d528f=_0x1c4aa2[_0x04ab('0x3e')]['id'];return db[_0x04ab('0x14')][_0x04ab('0x41')]({'where':{'id':_0x1c4aa2['params']['id']}})[_0x04ab('0xd')](handleEntityNotFound(_0x3a9056,null))[_0x04ab('0xd')](function(_0x4e92f5){if(_0x4e92f5){return _0x4e92f5[_0x04ab('0x47')]()['then'](function(_0xc9db25){return _0xc9db25;});}})['then'](function(_0x117963){_0xae46c7=_0x117963;if(_0x117963){if(_0x117963['VoiceQueueId']||_0x117963['CampaignId']){return db[_0x117963[_0x04ab('0x48')]?_0x04ab('0x49'):_0x04ab('0x4a')]['find']({'where':{'id':_0x117963['VoiceQueueId']?_0x117963[_0x04ab('0x48')]:_0x117963[_0x04ab('0x4b')]},'attributes':['id',_0x04ab('0x10')],'raw':!![]});}}})['then'](function(_0x2907b1){var _0x58e7d4={};if(_0x2907b1){_[_0x04ab('0x36')](_0x58e7d4,_[_0x04ab('0x4c')](_0xae46c7[_0x04ab('0x4d')],['createdAt',_0x04ab('0x4e'),'id']));_0x58e7d4[_0x04ab('0x4f')]=0x15;_0x58e7d4[_0x04ab('0x50')]=_0x04ab('0x51');_0x58e7d4[_0x04ab('0x52')]=_0x2907b1[_0x04ab('0x10')];_0x58e7d4[_0x04ab('0x53')]=_0x1c4aa2[_0x04ab('0x54')][_0x04ab('0x10')];_0x58e7d4[_0x04ab('0x55')]=_0x1c4aa2[_0x04ab('0x54')]['id'];_0x58e7d4['deleted']=!![];_0x58e7d4[_0x04ab('0x56')]=moment()['format'](_0x04ab('0x57'));_0x58e7d4[_0x04ab('0x58')]=_0xae46c7['phone'];_0x58e7d4['campaigntype']=_0xae46c7[_0x04ab('0x48')]?_0x04ab('0x59'):_0x04ab('0x5a');return db[_0x04ab('0x5b')][_0x04ab('0x41')]({'where':{'id':_0x58e7d4[_0x04ab('0x5c')]},'attributes':[_0x04ab('0x5d'),_0x04ab('0x5e')]})[_0x04ab('0xd')](function(_0x4936cf){if(!_[_0x04ab('0x5f')](_0x3a9056)&&!_[_0x04ab('0x5f')](_0x4936cf[_0x04ab('0x5d')])){_0x58e7d4['calleridname']=_0x4936cf[_0x04ab('0x5d')];if(!_[_0x04ab('0x5f')](_0x4936cf[_0x04ab('0x5e')])){_0x58e7d4['calleridname']+='\x20'+_0x4936cf[_0x04ab('0x5e')];}}})[_0x04ab('0x60')](function(){return db[_0x04ab('0x61')][_0x04ab('0x43')](_0x58e7d4);});}})['then'](function(_0x40cfb2){return db['CmHopperAdditionalPhone'][_0x04ab('0x47')]({'where':{'CmHopperId':_0x5d528f}});})[_0x04ab('0xd')](function(){return _0x3a9056['status'](0xcc)[_0x04ab('0x62')]();})['catch'](handleError(_0x3a9056,null));};exports[_0x04ab('0x63')]=function(_0x161e3f,_0x451ad5){var _0x275287=[];return db['CmContact'][_0x04ab('0x46')]()[_0x04ab('0xd')](function(_0x452529){_0x275287=_[_0x04ab('0x3f')](_0x452529);return _0x161e3f[_0x04ab('0x54')][_0x04ab('0x64')]({'where':{'type':_0x04ab('0x65'),'dialActive':!![],'dialMethod':_0x04ab('0x66')},'attributes':['id',_0x04ab('0x67'),_0x04ab('0x68')],'raw':!![]});})[_0x04ab('0xd')](function(_0x2a4f59){if(_0x2a4f59&&_0x2a4f59[_0x04ab('0x2e')]){return db[_0x04ab('0x69')][_0x04ab('0x6a')](function(_0xf83cf4){var _0x439d7f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x04ab('0x6b')](_0x04ab('0x57'))},'VoiceQueueId':{'$in':_[_0x04ab('0x13')](_0x2a4f59,'id')},'$or':[{'UserId':null},{'UserId':_0x161e3f[_0x04ab('0x54')]['id']}]};var _0x192dae={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2a4f59)['filter']([_0x04ab('0x68'),0x0])['map']('id')[_0x04ab('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x161e3f[_0x04ab('0x54')]['id']}]};var _0x2e6521={'$or':[_0x439d7f,_0x192dae]};var _0x596c41=[];if(_0x161e3f[_0x04ab('0x44')][_0x04ab('0x6d')]&&_0x161e3f[_0x04ab('0x44')]['direction']===_0x04ab('0x6e')){if(!_[_0x04ab('0x6f')](_0x161e3f[_0x04ab('0x44')]['hopperIds'])){_0x2e6521['id']={'$in':_0x161e3f[_0x04ab('0x44')][_0x04ab('0x70')]};}_0x596c41=[['priority',_0x04ab('0x71')],['scheduledAt',_0x2a4f59[0x0]['dialOrderByScheduledAt']===_0x04ab('0x71')?_0x04ab('0x72'):_0x04ab('0x71')],db[_0x04ab('0x69')][_0x04ab('0x73')](_0x04ab('0x74')),['id',_0x04ab('0x72')]];}else{if(!_['isEmpty'](_0x161e3f['body'][_0x04ab('0x70')])){_0x2e6521['id']={'$notIn':_0x161e3f[_0x04ab('0x44')][_0x04ab('0x70')]};}_0x596c41=[['priority',_0x04ab('0x72')],[_0x04ab('0x75'),_0x2a4f59[0x0][_0x04ab('0x67')]],db[_0x04ab('0x69')]['literal'](_0x04ab('0x76')),['id','ASC']];}return db[_0x04ab('0x14')][_0x04ab('0x77')]({'attributes':['id',_0x04ab('0x78'),_0x04ab('0x79'),'recallme'],'where':_0x2e6521,'order':_0x596c41,'transaction':_0xf83cf4,'lock':_0xf83cf4[_0x04ab('0x7a')][_0x04ab('0x7b')],'include':[{'model':db[_0x04ab('0x5b')],'as':_0x04ab('0x7c'),'attributes':_0x275287,'include':[{'model':db['CmCompany'],'as':_0x04ab('0x7d'),'attributes':['id','name']}]},{'model':db[_0x04ab('0x7e')],'as':_0x04ab('0x7f'),'attributes':['id','name']},{'model':db[_0x04ab('0x49')],'as':'Queue','attributes':['id',_0x04ab('0x10'),_0x04ab('0x80')]}]})['then'](function(_0x2c2894){if(_0x2c2894){return _0x2c2894[_0x04ab('0x45')]({'UserId':_0x161e3f[_0x04ab('0x54')]['id']},{'transaction':_0xf83cf4});}});});}})[_0x04ab('0xd')](handleEntityNotFound(_0x451ad5,null))['then'](respondWithResult(_0x451ad5,null))[_0x04ab('0x42')](handleError(_0x451ad5,null));};exports['getPreviewRecall']=function(_0x114b38,_0x24c6b9,_0x4a7e20){var _0x4ee4c8=[];var _0x15b182=_0x114b38[_0x04ab('0x3e')]['id'];var _0x5a9dbf=_0x114b38[_0x04ab('0x54')]['id'];return db[_0x04ab('0x5b')][_0x04ab('0x46')]()['then'](function(_0x161014){_0x4ee4c8=_[_0x04ab('0x3f')](_0x161014);return db[_0x04ab('0x69')]['transaction'](function(_0x3d81d4){const _0x434340={'id':_0x15b182};return db[_0x04ab('0x14')][_0x04ab('0x77')]({'attributes':['id',_0x04ab('0x78'),_0x04ab('0x81')],'where':_0x434340,'transaction':_0x3d81d4,'lock':_0x3d81d4[_0x04ab('0x7a')]['UPDATE'],'include':[{'model':db[_0x04ab('0x5b')],'as':_0x04ab('0x7c'),'attributes':_0x4ee4c8,'include':[{'model':db['CmCompany'],'as':_0x04ab('0x7d'),'attributes':['id',_0x04ab('0x10')]}]},{'model':db['CmList'],'as':_0x04ab('0x7f'),'attributes':['id',_0x04ab('0x10')]},{'model':db[_0x04ab('0x49')],'as':'Queue','attributes':['id','name',_0x04ab('0x80')]}]})['then'](function(_0x2f778a){if(_0x2f778a){return _0x2f778a[_0x04ab('0x45')]({'UserId':_0x5a9dbf},{'transaction':_0x3d81d4});}});});})[_0x04ab('0xd')](handleEntityNotFound(_0x24c6b9,null))['then'](respondWithResult(_0x24c6b9,null))[_0x04ab('0x42')](handleError(_0x24c6b9,null));};exports['getOpenContacts']=function(_0x2af9ce,_0x31879a){return _0x2af9ce['user'][_0x04ab('0x64')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x04ab('0x66')},'attributes':['id'],'raw':!![]})[_0x04ab('0xd')](function(_0x11cb01){if(_0x11cb01&&_0x11cb01['length']){return db[_0x04ab('0x14')][_0x04ab('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x04ab('0x6b')](_0x04ab('0x57'))},'VoiceQueueId':{'$in':_['map'](_0x11cb01,'id')},'$or':[{'UserId':null},{'UserId':_0x2af9ce[_0x04ab('0x54')]['id']}]}});}return 0x0;})[_0x04ab('0xd')](function(_0x34cff9){if(!_[_0x04ab('0x5f')](_0x34cff9)&&_[_0x04ab('0x82')](_0x34cff9)){return _0x31879a['status'](0xc8)['json']({'contacts':_0x34cff9});}else{logger['error'](_0x04ab('0x83'),_0x04ab('0x84'),0x194,_0x04ab('0x85'));_0x31879a['sendStatus'](0x194);}})[_0x04ab('0x42')](handleError(_0x31879a,null));};exports[_0x04ab('0x86')]=function(_0x2949f5,_0x5bf83b){var _0x1c321b=shared['timezones'];var _0x539620=[];_[_0x04ab('0x13')](_0x1c321b,function(_0xb707e1){_0x539620[_0x04ab('0x87')]({'id':_0xb707e1[_0x04ab('0x10')],'name':_0xb707e1['name'],'utcOffset':_0xb707e1[_0x04ab('0x88')]});});return _0x5bf83b[_0x04ab('0xa')](0xc8)[_0x04ab('0x5')]({'tz':_0x539620});};exports[_0x04ab('0x89')]=function(_0x3c081d,_0x120da6){var _0x1331af=shared[_0x04ab('0x8a')];var _0x12b7d3={};if(!_[_0x04ab('0x5f')](_0x1331af[_0x3c081d[_0x04ab('0x44')]['id']]))_0x12b7d3=_0x1331af[_0x3c081d[_0x04ab('0x44')]['id']];return _0x120da6[_0x04ab('0xa')](0xc8)[_0x04ab('0x5')](_0x12b7d3);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 2e3ae3b..22f8a55 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 _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','priority','lodash','util','../../config/logger'];(function(_0x4b3107,_0x188993){var _0x492163=function(_0x11c46a){while(--_0x11c46a){_0x4b3107['push'](_0x4b3107['shift']());}};_0x492163(++_0x188993);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]},{'name':'phone','fields':['phone']},{'name':_0xae3d('0xf'),'fields':[_0xae3d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['priority','lodash','../../config/logger','moment','bluebird','request-promise','path','exports','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x5103fd,_0x34e218){var _0x18d94f=function(_0x19aaa6){while(--_0x19aaa6){_0x5103fd['push'](_0x5103fd['shift']());}};_0x18d94f(++_0x34e218);}(_0xafc4,0x69));var _0x4afc=function(_0x2efe4d,_0x522754){_0x2efe4d=_0x2efe4d-0x0;var _0x386b0e=_0xafc4[_0x2efe4d];return _0x386b0e;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x4afc('0xa')]},{'name':_0x4afc('0xb'),'fields':[_0x4afc('0xb')]},{'name':_0x4afc('0xc'),'fields':[_0x4afc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ac305e6..eb8d7f7 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 _0xecaf=['include','model','map','then','info','debug','stringify','error','message','ShowCmHopper','find','catch','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','Agent','name','voicePause','length','UserId','includes','push','GetContactDialer','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','all','GetCmHopperPreview','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','\x20MINUTE','NOW()','User','CmList','List','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit'];(function(_0x3319a2,_0x44cc26){var _0x103aeb=function(_0x513d6d){while(--_0x513d6d){_0x3319a2['push'](_0x3319a2['shift']());}};_0x103aeb(++_0x44cc26);}(_0xecaf,0x127));var _0xfeca=function(_0x2f36ab,_0x3be90a){_0x2f36ab=_0x2f36ab-0x0;var _0x5e81de=_0xecaf[_0x2f36ab];return _0x5e81de;};'use strict';var _=require('lodash');var util=require(_0xfeca('0x0'));var moment=require(_0xfeca('0x1'));var BPromise=require(_0xfeca('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xfeca('0x3'))(_0xfeca('0x4'));exports[_0xfeca('0x5')]=function(_0x3d2b93){var _0x4c3289=this;return new Promise(function(_0x197ff4,_0x29b9b6){return db[_0xfeca('0x6')][_0xfeca('0x7')]({'raw':_0x3d2b93[_0xfeca('0x8')]?_0x3d2b93[_0xfeca('0x8')][_0xfeca('0x9')]===undefined?!![]:![]:!![],'where':_0x3d2b93[_0xfeca('0x8')]?_0x3d2b93[_0xfeca('0x8')][_0xfeca('0xa')]||null:null,'attributes':_0x3d2b93['options']?_0x3d2b93[_0xfeca('0x8')][_0xfeca('0xb')]||null:null,'limit':_0x3d2b93[_0xfeca('0x8')]?_0x3d2b93['options'][_0xfeca('0xc')]||null:null,'include':_0x3d2b93[_0xfeca('0x8')]?_0x3d2b93[_0xfeca('0x8')][_0xfeca('0xd')]?_['map'](_0x3d2b93[_0xfeca('0x8')][_0xfeca('0xd')],function(_0x9811db){return{'model':db[_0x9811db[_0xfeca('0xe')]],'as':_0x9811db['as'],'attributes':_0x9811db[_0xfeca('0xb')],'include':_0x9811db['include']?_[_0xfeca('0xf')](_0x9811db[_0xfeca('0xd')],function(_0x79193a){return{'model':db[_0x79193a[_0xfeca('0xe')]],'as':_0x79193a['as'],'attributes':_0x79193a['attributes'],'include':_0x79193a[_0xfeca('0xd')]?_['map'](_0x79193a['include'],function(_0x3b7b80){return{'model':db[_0x3b7b80[_0xfeca('0xe')]],'as':_0x3b7b80['as'],'attributes':_0x3b7b80[_0xfeca('0xb')]};}):[]};}):[]};}):[]:[]})[_0xfeca('0x10')](function(_0x4119c1){logger[_0xfeca('0x11')]('GetCmHopper',_0x3d2b93);logger[_0xfeca('0x12')](_0xfeca('0x5'),_0x3d2b93,JSON[_0xfeca('0x13')](_0x4119c1));_0x197ff4(_0x4119c1);})['catch'](function(_0x5791c1){logger[_0xfeca('0x14')]('GetCmHopper',_0x5791c1[_0xfeca('0x15')],_0x3d2b93);_0x29b9b6(_0x4c3289['error'](0x1f4,_0x5791c1['message']));});});};exports[_0xfeca('0x16')]=function(_0x1586c4){var _0x5534bf=this;return new Promise(function(_0x2c7e0c,_0x4c14b2){return db[_0xfeca('0x6')][_0xfeca('0x17')]({'raw':_0x1586c4[_0xfeca('0x8')]?_0x1586c4['options'][_0xfeca('0x9')]===undefined?!![]:![]:!![],'where':_0x1586c4['options']?_0x1586c4[_0xfeca('0x8')]['where']||null:null,'attributes':_0x1586c4[_0xfeca('0x8')]?_0x1586c4['options'][_0xfeca('0xb')]||null:null,'include':_0x1586c4[_0xfeca('0x8')]?_0x1586c4[_0xfeca('0x8')][_0xfeca('0xd')]?_['map'](_0x1586c4[_0xfeca('0x8')][_0xfeca('0xd')],function(_0x124df0){return{'model':db[_0x124df0['model']],'as':_0x124df0['as'],'attributes':_0x124df0['attributes'],'include':_0x124df0[_0xfeca('0xd')]?_[_0xfeca('0xf')](_0x124df0['include'],function(_0x537505){return{'model':db[_0x537505[_0xfeca('0xe')]],'as':_0x537505['as'],'attributes':_0x537505[_0xfeca('0xb')],'include':_0x537505['include']?_[_0xfeca('0xf')](_0x537505[_0xfeca('0xd')],function(_0x23da6c){return{'model':db[_0x23da6c[_0xfeca('0xe')]],'as':_0x23da6c['as'],'attributes':_0x23da6c[_0xfeca('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37cca){logger[_0xfeca('0x11')](_0xfeca('0x16'),_0x1586c4);logger[_0xfeca('0x12')](_0xfeca('0x16'),_0x1586c4,JSON[_0xfeca('0x13')](_0x37cca));_0x2c7e0c(_0x37cca);})[_0xfeca('0x18')](function(_0x10d592){logger[_0xfeca('0x14')]('ShowCmHopper',_0x10d592['message'],_0x1586c4);_0x4c14b2(_0x5534bf['error'](0x1f4,_0x10d592['message']));});});};exports['CreateCmHopper']=function(_0x1e322e){var _0x72c812=this;return new Promise(function(_0x340161,_0x5ddbf){return db[_0xfeca('0x6')][_0xfeca('0x19')](_0x1e322e[_0xfeca('0x1a')],{'raw':_0x1e322e[_0xfeca('0x8')]?_0x1e322e['options'][_0xfeca('0x9')]===undefined?!![]:![]:!![]})[_0xfeca('0x10')](function(_0x284e1e){logger[_0xfeca('0x11')]('CreateCmHopper',_0x1e322e);logger[_0xfeca('0x12')](_0xfeca('0x1b'),_0x1e322e,JSON['stringify'](_0x284e1e));_0x340161(_0x284e1e);})['catch'](function(_0x464956){logger[_0xfeca('0x14')](_0xfeca('0x1b'),_0x464956[_0xfeca('0x15')],_0x1e322e);_0x5ddbf(_0x72c812[_0xfeca('0x14')](0x1f4,_0x464956[_0xfeca('0x15')]));});});};exports[_0xfeca('0x1c')]=function(_0xa2b1e3){var _0x22481e=this;return new Promise(function(_0x46023c,_0x1845ac){return db[_0xfeca('0x6')][_0xfeca('0x1d')](_0xa2b1e3[_0xfeca('0x1a')],{'raw':_0xa2b1e3['options']?_0xa2b1e3['options'][_0xfeca('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa2b1e3[_0xfeca('0x8')]?_0xa2b1e3['options']['where']||null:null,'attributes':_0xa2b1e3[_0xfeca('0x8')]?_0xa2b1e3[_0xfeca('0x8')][_0xfeca('0xb')]||null:null,'limit':_0xa2b1e3['options']?_0xa2b1e3[_0xfeca('0x8')][_0xfeca('0xc')]||null:null})[_0xfeca('0x10')](function(_0x30490d){logger[_0xfeca('0x11')](_0xfeca('0x1c'),_0xa2b1e3);logger[_0xfeca('0x11')](_0xfeca('0x1e'),JSON['stringify'](_0xa2b1e3[_0xfeca('0x8')]['where']),_0xa2b1e3['body'][_0xfeca('0x1f')]);logger[_0xfeca('0x12')](_0xfeca('0x1c'),_0xa2b1e3,JSON[_0xfeca('0x13')](_0x30490d));_0x46023c(_0x30490d);})[_0xfeca('0x18')](function(_0x38a3bb){logger[_0xfeca('0x14')]('UpdateCmHopper',_0x38a3bb[_0xfeca('0x15')],_0xa2b1e3);_0x1845ac(_0x22481e['error'](0x1f4,_0x38a3bb[_0xfeca('0x15')]));});});};exports[_0xfeca('0x20')]=function(_0x2ed4af){var _0x40a992=this;return new Promise(function(_0x571deb,_0x4de7b4){return db['CmHopper'][_0xfeca('0x21')]({'where':_0x2ed4af[_0xfeca('0x8')]?_0x2ed4af[_0xfeca('0x8')][_0xfeca('0xa')]||null:null})[_0xfeca('0x10')](function(_0x34d2c8){logger[_0xfeca('0x11')](_0xfeca('0x20'),_0x2ed4af);logger[_0xfeca('0x12')](_0xfeca('0x20'),_0x2ed4af,JSON[_0xfeca('0x13')](_0x34d2c8));_0x571deb(_0x34d2c8);})[_0xfeca('0x18')](function(_0x1cb03b){logger[_0xfeca('0x14')](_0xfeca('0x20'),_0x1cb03b[_0xfeca('0x15')],_0x2ed4af);_0x4de7b4(_0x40a992[_0xfeca('0x14')](0x1f4,_0x1cb03b[_0xfeca('0x15')]));});});};exports['GetContactDialer']=function(_0x2084fc){var _0x3561eb=this;return new Promise(function(_0x3d5f3a,_0x4dcd9c){return db[_0xfeca('0x22')][_0xfeca('0x23')]()['then'](function(_0x212400){return db[_0xfeca('0x24')][_0xfeca('0x25')](function(_0x5a20b8){return db['CmHopper']['findAll']({'where':_0x2084fc['options']?_0x2084fc[_0xfeca('0x8')][_0xfeca('0xa')]||null:null,'attributes':_0x2084fc[_0xfeca('0x8')]?_0x2084fc[_0xfeca('0x8')]['attributes']||null:null,'limit':_0x2084fc[_0xfeca('0x8')]?_0x2084fc['options'][_0xfeca('0xc')]||null:null,'order':_0x2084fc['options']?_0x2084fc[_0xfeca('0x8')][_0xfeca('0x26')]||null:null,'transaction':_0x5a20b8,'lock':_0x5a20b8[_0xfeca('0x27')][_0xfeca('0x28')],'include':[{'model':db[_0xfeca('0x22')],'as':_0xfeca('0x29'),'attributes':_[_0xfeca('0x2a')](_0x212400)},{'model':db['User'],'as':_0xfeca('0x2b'),'attributes':['id',_0xfeca('0x2c'),_0xfeca('0x2d')]}]})['then'](function(_0x117ef5){var _0x18baa0=[];var _0x1eddd8=[];for(var _0x575b76=0x0;_0x575b76<_0x117ef5[_0xfeca('0x2e')];_0x575b76+=0x1){var _0x15d599=_0x117ef5[_0x575b76][_0xfeca('0x2f')];if(_0x15d599===null){_0x18baa0['push'](_0x117ef5[_0x575b76][_0xfeca('0x1d')](_0x2084fc[_0xfeca('0x1a')],{'transaction':_0x5a20b8}));}else if(!_0x1eddd8[_0xfeca('0x30')](_0x15d599)){_0x1eddd8[_0xfeca('0x31')](_0x15d599);_0x18baa0[_0xfeca('0x31')](_0x117ef5[_0x575b76][_0xfeca('0x1d')](_0x2084fc['body'],{'transaction':_0x5a20b8}));}}return BPromise['all'](_0x18baa0);});})['then'](function(_0x44b620){logger[_0xfeca('0x11')](_0xfeca('0x32'),_0x2084fc);if(_0x44b620['length']>0x0){logger[_0xfeca('0x11')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x44b620[0x0][_0xfeca('0x33')]['id'],_0x44b620[0x0]['dataValues'][_0xfeca('0x34')],_0x44b620[0x0]['dataValues'][_0xfeca('0x1f')]);}logger[_0xfeca('0x12')]('GetContactDialer',_0x2084fc,JSON['stringify'](_0x44b620));_0x3d5f3a(_0x44b620);})[_0xfeca('0x18')](function(_0x1cf472){logger[_0xfeca('0x14')](_0xfeca('0x32'),_0x1cf472['message'],_0x2084fc);_0x4dcd9c(_0x3561eb[_0xfeca('0x14')](0x1f4,_0x1cf472[_0xfeca('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x36a4c5){var _0xc35ca1=this;return new Promise(function(_0x7e94f0,_0x122b2f){return db[_0xfeca('0x24')][_0xfeca('0x25')](function(_0x314cbf){return db[_0xfeca('0x35')][_0xfeca('0x19')](_0x36a4c5[_0xfeca('0x1a')],{'raw':_0x36a4c5['options']?_0x36a4c5['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x314cbf})['then'](function(){logger['info'](_0xfeca('0x36'),JSON[_0xfeca('0x13')](_0x36a4c5[_0xfeca('0x8')]['where']),_0x36a4c5[_0xfeca('0x8')][_0xfeca('0xa')][_0xfeca('0x1f')]);return db['CmHopper'][_0xfeca('0x21')]({'where':_0x36a4c5[_0xfeca('0x8')]?_0x36a4c5[_0xfeca('0x8')][_0xfeca('0xa')]||null:null,'transaction':_0x314cbf});});})[_0xfeca('0x10')](function(_0x68f5ce){logger[_0xfeca('0x11')](_0xfeca('0x37'),_0x36a4c5);logger[_0xfeca('0x12')]('MoveContactManagedDialer',_0x36a4c5,JSON[_0xfeca('0x13')](_0x68f5ce));_0x7e94f0(_0x68f5ce);})[_0xfeca('0x18')](function(_0x21ed36){logger[_0xfeca('0x14')]('MoveContactManagedDialer',_0x21ed36[_0xfeca('0x15')],_0x36a4c5);_0x122b2f(_0xc35ca1[_0xfeca('0x14')](0x1f4,_0x21ed36['message']));});});};exports[_0xfeca('0x38')]=function(_0x394e9c){var _0x58432d=this;return new Promise(function(_0x459f1f,_0x3bff02){return db['CmHopper'][_0xfeca('0x7')]({'raw':_0x394e9c[_0xfeca('0x8')]?_0x394e9c[_0xfeca('0x8')][_0xfeca('0x9')]===undefined?!![]:![]:!![],'where':_0x394e9c[_0xfeca('0x8')]?_0x394e9c[_0xfeca('0x8')][_0xfeca('0xa')]||null:null,'attributes':[[db[_0xfeca('0x24')]['fn']('COUNT',db[_0xfeca('0x24')]['fn']('IF',db[_0xfeca('0x24')][_0xfeca('0x39')](_0xfeca('0x3a')+util['format']('\x22%s\x22',moment()['format'](_0xfeca('0x3b')))+_0xfeca('0x3c')))),'contactsRescheduled']]})[_0xfeca('0x10')](function(_0x1f668c){logger[_0xfeca('0x11')](_0xfeca('0x38'),_0x394e9c);logger[_0xfeca('0x12')](_0xfeca('0x38'),_0x394e9c,JSON[_0xfeca('0x13')](_0x1f668c));_0x459f1f(_0x1f668c);})[_0xfeca('0x18')](function(_0x57ba6c){logger['error'](_0xfeca('0x38'),_0x57ba6c['message'],_0x394e9c);_0x3bff02(_0x58432d[_0xfeca('0x14')](0x1f4,_0x57ba6c['message']));});});};exports[_0xfeca('0x3d')]=function(_0x4db382){var _0x27b6b1=this;return new Promise(function(_0x5a4e23,_0x5264cc){return db['CmContact'][_0xfeca('0x23')]()[_0xfeca('0x10')](function(){return db[_0xfeca('0x24')][_0xfeca('0x25')](function(_0xfca809){return db[_0xfeca('0x6')][_0xfeca('0x7')]({'where':_0x4db382[_0xfeca('0x8')]?_0x4db382[_0xfeca('0x8')][_0xfeca('0xa')]||null:null,'attributes':_0x4db382['options']?_0x4db382['options'][_0xfeca('0xb')]||null:null,'limit':0x1,'order':_0x4db382['options']?_0x4db382[_0xfeca('0x8')][_0xfeca('0x26')]||null:null,'group':db[_0xfeca('0x6')]['UserId'],'transaction':_0xfca809,'lock':_0xfca809[_0xfeca('0x27')][_0xfeca('0x28')],'include':_0x4db382[_0xfeca('0x8')]?_0x4db382[_0xfeca('0x8')][_0xfeca('0xd')]?_['map'](_0x4db382[_0xfeca('0x8')]['include'],function(_0x5a7c6){return{'model':db[_0x5a7c6['model']],'as':_0x5a7c6['as'],'attributes':_0x5a7c6[_0xfeca('0xb')],'include':_0x5a7c6['include']?_[_0xfeca('0xf')](_0x5a7c6['include'],function(_0x5bef51){return{'model':db[_0x5bef51[_0xfeca('0xe')]],'as':_0x5bef51['as'],'attributes':_0x5bef51[_0xfeca('0xb')],'include':_0x5bef51[_0xfeca('0xd')]?_[_0xfeca('0xf')](_0x5bef51[_0xfeca('0xd')],function(_0x4bab3e){return{'model':db[_0x4bab3e[_0xfeca('0xe')]],'as':_0x4bab3e['as'],'attributes':_0x4bab3e[_0xfeca('0xb')]};}):[]};}):[]};}):[]:[]})[_0xfeca('0x10')](function(_0x373a1f){var _0x36ddb6=[];for(var _0xbee236=0x0;_0xbee236<_0x373a1f[_0xfeca('0x2e')];_0xbee236+=0x1){_0x36ddb6[_0xfeca('0x31')](_0x373a1f[_0xbee236][_0xfeca('0x1d')](_0x4db382[_0xfeca('0x1a')],{'transaction':_0xfca809}));}return BPromise[_0xfeca('0x3e')](_0x36ddb6);});})['then'](function(_0x1299cb){logger['info'](_0xfeca('0x3d'),_0x4db382);logger[_0xfeca('0x12')](_0xfeca('0x3d'),_0x4db382,JSON[_0xfeca('0x13')](_0x1299cb));_0x5a4e23(_0x1299cb);})[_0xfeca('0x18')](function(_0x435b48){logger[_0xfeca('0x14')](_0xfeca('0x3d'),_0x435b48[_0xfeca('0x15')],_0x4db382);_0x5264cc(_0x27b6b1[_0xfeca('0x14')](0x1f4,_0x435b48['message']));});});});};exports[_0xfeca('0x3f')]=function(_0x471dec){var _0x317f01=this;return new Promise(function(_0x3106fb,_0x3a0352){db[_0xfeca('0x22')][_0xfeca('0x23')]()['then'](function(_0x14b6b9){return db[_0xfeca('0x6')]['findAll']({'raw':_0x471dec[_0xfeca('0x8')]?_0x471dec[_0xfeca('0x8')][_0xfeca('0x9')]===undefined?!![]:![]:!![],'where':_0x471dec[_0xfeca('0x8')]?_0x471dec[_0xfeca('0x8')][_0xfeca('0xa')]||null:null,'attributes':_0x471dec['options']?_0x471dec[_0xfeca('0x8')]['attributes']||null:null,'limit':_0x471dec[_0xfeca('0x8')]?_0x471dec[_0xfeca('0x8')]['limit']||null:null,'include':_0x471dec[_0xfeca('0x8')]?_0x471dec['options'][_0xfeca('0xd')]?_[_0xfeca('0xf')](_0x471dec[_0xfeca('0x8')][_0xfeca('0xd')],function(_0x10b9ff){return{'model':db[_0x10b9ff[_0xfeca('0xe')]],'as':_0x10b9ff['as'],'attributes':_0x10b9ff['as']===_0xfeca('0x29')?_[_0xfeca('0x2a')](_0x14b6b9):_0x10b9ff[_0xfeca('0xb')],'include':_0x10b9ff[_0xfeca('0xd')]?_['map'](_0x10b9ff[_0xfeca('0xd')],function(_0x52dc75){return{'model':db[_0x52dc75[_0xfeca('0xe')]],'as':_0x52dc75['as'],'attributes':_0x52dc75['attributes'],'include':_0x52dc75[_0xfeca('0xd')]?_[_0xfeca('0xf')](_0x52dc75['include'],function(_0x4872f8){return{'model':db[_0x4872f8[_0xfeca('0xe')]],'as':_0x4872f8['as'],'attributes':_0x4872f8[_0xfeca('0xb')]};}):[]};}):[]};}):[]:[]})[_0xfeca('0x10')](function(_0x56aa46){logger[_0xfeca('0x11')](_0xfeca('0x5'),_0x471dec);logger['debug'](_0xfeca('0x5'),_0x471dec,JSON[_0xfeca('0x13')](_0x56aa46));_0x3106fb(_0x56aa46);})['catch'](function(_0x25f72d){logger[_0xfeca('0x14')](_0xfeca('0x5'),_0x25f72d[_0xfeca('0x15')],_0x471dec);_0x3a0352(_0x317f01[_0xfeca('0x14')](0x1f4,_0x25f72d[_0xfeca('0x15')]));});});});};exports['GetContactByPhone']=function(_0x431a96){var _0x514fe9=this;return new Promise(function(_0x3aac6d,_0x20e967){return db['CmContact'][_0xfeca('0x40')]({'raw':!![],'where':{'phone':_0x431a96['options']['where'][_0xfeca('0x41')]},'attributes':['id','dialTimezone'],'order':[['id',_0xfeca('0x42')]]})[_0xfeca('0x10')](function(_0x73189b){logger[_0xfeca('0x11')](_0xfeca('0x43'),_0x431a96);logger['debug'](_0xfeca('0x43'),_0x431a96,JSON[_0xfeca('0x13')](_0x73189b));_0x3aac6d(_0x73189b);})['catch'](function(_0x3b27a8){logger[_0xfeca('0x14')](_0xfeca('0x43'),_0x3b27a8[_0xfeca('0x15')],_0x431a96);_0x20e967(_0x514fe9[_0xfeca('0x14')](0x1f4,_0x3b27a8[_0xfeca('0x15')]));});});};exports[_0xfeca('0x44')]=function(_0x588dab){var _0x365062=this;return new Promise(function(_0x46413b,_0x51e2e6){return db[_0xfeca('0x24')][_0xfeca('0x25')](function(_0x1e8bff){var _0x444eee=_0x588dab[_0xfeca('0x8')]&&_0x588dab[_0xfeca('0x8')]['where']?_0x588dab[_0xfeca('0x8')][_0xfeca('0xa')]:{};return db[_0xfeca('0x6')][_0xfeca('0x1d')](_0x588dab[_0xfeca('0x1a')],{'where':_0x444eee,'transaction':_0x1e8bff})[_0xfeca('0x10')](function(_0x50936c){logger[_0xfeca('0x11')](_0xfeca('0x44'),_0x588dab);logger[_0xfeca('0x12')](_0xfeca('0x44'),_0x588dab,JSON[_0xfeca('0x13')](_0x50936c));_0x46413b(_0x50936c);})[_0xfeca('0x18')](function(_0x543b6c){logger[_0xfeca('0x14')](_0xfeca('0x44'),_0x543b6c[_0xfeca('0x15')],_0x588dab);_0x51e2e6(_0x365062['error'](0x1f4,_0x543b6c[_0xfeca('0x15')]));});});});};exports[_0xfeca('0x45')]=function(_0x16f842){var _0x5de7b4=this;var _0x229e75=_0x16f842['body']['where'][_0xfeca('0x46')];var _0x4102d8=_0x16f842[_0xfeca('0x1a')][_0xfeca('0xa')]['interval'];var _0x4a076d=_0x16f842[_0xfeca('0x1a')][_0xfeca('0xa')][_0xfeca('0x47')];return new Promise(function(_0x328758,_0x37b82d){return db['CmHopper'][_0xfeca('0x7')]({'where':{'voiceQueueId':{'$in':_0x229e75},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xfeca('0x24')][_0xfeca('0x39')]('NOW()\x20+\x20INTERVAL\x20'+_0x4102d8+_0xfeca('0x48')),'$gt':db[_0xfeca('0x24')]['literal'](_0xfeca('0x49'))}},'UserId':{'$in':_0x4a076d}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0xfeca('0x4a')],'as':_0xfeca('0x2b'),'attributes':['id',_0xfeca('0x2c'),_0xfeca('0x2d')]},{'model':db[_0xfeca('0x4b')],'as':_0xfeca('0x4c')}]})[_0xfeca('0x10')](function(_0x4b1101){if(_0x4b1101[_0xfeca('0x2e')]>0x0){return db[_0xfeca('0x24')][_0xfeca('0x25')](function(_0x4cf0ed){return db['CmHopper'][_0xfeca('0x1d')]({'recallmeNotifiedDate':db['sequelize'][_0xfeca('0x39')]('NOW()')},{'where':{'id':{'$in':_[_0xfeca('0xf')](_0x4b1101,'id')}},'transaction':_0x4cf0ed})[_0xfeca('0x10')](function(){_0x328758(_0x4b1101);})[_0xfeca('0x18')](function(_0x535317){logger[_0xfeca('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x535317[_0xfeca('0x15')],_0x16f842);_0x37b82d(_0x5de7b4['error'](0x1f4,_0x535317[_0xfeca('0x15')]));});})[_0xfeca('0x18')](function(_0x3d5ad3){logger[_0xfeca('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x3d5ad3[_0xfeca('0x15')],_0x16f842);_0x37b82d(_0x5de7b4[_0xfeca('0x14')](0x1f4,_0x3d5ad3[_0xfeca('0x15')]));});}else{_0x328758(_0x4b1101);}});});}; \ No newline at end of file +var _0x54ce=['Agent','name','length','UserId','push','includes','all','dataValues','ContactId','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','order','GetCmHopperPreview','describe','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','User','voicePause','CmList','NOW()','lodash','util','moment','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','debug','catch','error','message','ShowCmHopper','find','raw','info','stringify','create','then','CreateCmHopper','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','LOCK','UPDATE','Contact','keys'];(function(_0x263bc1,_0x875094){var _0x12431f=function(_0x51cb68){while(--_0x51cb68){_0x263bc1['push'](_0x263bc1['shift']());}};_0x12431f(++_0x875094);}(_0x54ce,0x19e));var _0xe54c=function(_0x7bf64d,_0x494cb){_0x7bf64d=_0x7bf64d-0x0;var _0x2b44b1=_0x54ce[_0x7bf64d];return _0x2b44b1;};'use strict';var _=require(_0xe54c('0x0'));var util=require(_0xe54c('0x1'));var moment=require(_0xe54c('0x2'));var BPromise=require('bluebird');var db=require(_0xe54c('0x3'))['db'];var logger=require('../../config/logger')(_0xe54c('0x4'));exports[_0xe54c('0x5')]=function(_0x3f7f6a){var _0x6ec0f4=this;return new Promise(function(_0x3d4da7,_0x3b1bd3){return db[_0xe54c('0x6')][_0xe54c('0x7')]({'raw':_0x3f7f6a['options']?_0x3f7f6a[_0xe54c('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x3f7f6a['options']?_0x3f7f6a[_0xe54c('0x8')][_0xe54c('0x9')]||null:null,'attributes':_0x3f7f6a[_0xe54c('0x8')]?_0x3f7f6a['options'][_0xe54c('0xa')]||null:null,'limit':_0x3f7f6a[_0xe54c('0x8')]?_0x3f7f6a[_0xe54c('0x8')][_0xe54c('0xb')]||null:null,'include':_0x3f7f6a[_0xe54c('0x8')]?_0x3f7f6a[_0xe54c('0x8')][_0xe54c('0xc')]?_[_0xe54c('0xd')](_0x3f7f6a[_0xe54c('0x8')][_0xe54c('0xc')],function(_0x2c8026){return{'model':db[_0x2c8026['model']],'as':_0x2c8026['as'],'attributes':_0x2c8026[_0xe54c('0xa')],'include':_0x2c8026[_0xe54c('0xc')]?_[_0xe54c('0xd')](_0x2c8026[_0xe54c('0xc')],function(_0x3e8016){return{'model':db[_0x3e8016['model']],'as':_0x3e8016['as'],'attributes':_0x3e8016['attributes'],'include':_0x3e8016['include']?_[_0xe54c('0xd')](_0x3e8016[_0xe54c('0xc')],function(_0x2fb032){return{'model':db[_0x2fb032[_0xe54c('0xe')]],'as':_0x2fb032['as'],'attributes':_0x2fb032[_0xe54c('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ff2bd){logger['info'](_0xe54c('0x5'),_0x3f7f6a);logger[_0xe54c('0xf')](_0xe54c('0x5'),_0x3f7f6a,JSON['stringify'](_0x4ff2bd));_0x3d4da7(_0x4ff2bd);})[_0xe54c('0x10')](function(_0x1ff5cb){logger[_0xe54c('0x11')]('GetCmHopper',_0x1ff5cb[_0xe54c('0x12')],_0x3f7f6a);_0x3b1bd3(_0x6ec0f4['error'](0x1f4,_0x1ff5cb[_0xe54c('0x12')]));});});};exports[_0xe54c('0x13')]=function(_0x2bf554){var _0x4cac0d=this;return new Promise(function(_0x3d9614,_0x185b6a){return db['CmHopper'][_0xe54c('0x14')]({'raw':_0x2bf554['options']?_0x2bf554['options'][_0xe54c('0x15')]===undefined?!![]:![]:!![],'where':_0x2bf554[_0xe54c('0x8')]?_0x2bf554['options'][_0xe54c('0x9')]||null:null,'attributes':_0x2bf554['options']?_0x2bf554[_0xe54c('0x8')]['attributes']||null:null,'include':_0x2bf554[_0xe54c('0x8')]?_0x2bf554['options'][_0xe54c('0xc')]?_[_0xe54c('0xd')](_0x2bf554['options'][_0xe54c('0xc')],function(_0xc76bde){return{'model':db[_0xc76bde[_0xe54c('0xe')]],'as':_0xc76bde['as'],'attributes':_0xc76bde[_0xe54c('0xa')],'include':_0xc76bde[_0xe54c('0xc')]?_[_0xe54c('0xd')](_0xc76bde['include'],function(_0x40d27f){return{'model':db[_0x40d27f[_0xe54c('0xe')]],'as':_0x40d27f['as'],'attributes':_0x40d27f['attributes'],'include':_0x40d27f[_0xe54c('0xc')]?_['map'](_0x40d27f[_0xe54c('0xc')],function(_0x3c10ef){return{'model':db[_0x3c10ef[_0xe54c('0xe')]],'as':_0x3c10ef['as'],'attributes':_0x3c10ef[_0xe54c('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bb47c){logger[_0xe54c('0x16')]('ShowCmHopper',_0x2bf554);logger['debug'](_0xe54c('0x13'),_0x2bf554,JSON[_0xe54c('0x17')](_0x1bb47c));_0x3d9614(_0x1bb47c);})[_0xe54c('0x10')](function(_0x4f61da){logger[_0xe54c('0x11')](_0xe54c('0x13'),_0x4f61da[_0xe54c('0x12')],_0x2bf554);_0x185b6a(_0x4cac0d[_0xe54c('0x11')](0x1f4,_0x4f61da['message']));});});};exports['CreateCmHopper']=function(_0xe40a02){var _0x1ebcbf=this;return new Promise(function(_0x279e98,_0x3b150a){return db[_0xe54c('0x6')][_0xe54c('0x18')](_0xe40a02['body'],{'raw':_0xe40a02[_0xe54c('0x8')]?_0xe40a02[_0xe54c('0x8')][_0xe54c('0x15')]===undefined?!![]:![]:!![]})[_0xe54c('0x19')](function(_0x8579ef){logger[_0xe54c('0x16')](_0xe54c('0x1a'),_0xe40a02);logger['debug'](_0xe54c('0x1a'),_0xe40a02,JSON[_0xe54c('0x17')](_0x8579ef));_0x279e98(_0x8579ef);})['catch'](function(_0x57ef1e){logger[_0xe54c('0x11')](_0xe54c('0x1a'),_0x57ef1e['message'],_0xe40a02);_0x3b150a(_0x1ebcbf[_0xe54c('0x11')](0x1f4,_0x57ef1e['message']));});});};exports[_0xe54c('0x1b')]=function(_0x573239){var _0x54c0a9=this;return new Promise(function(_0x3deed1,_0x44cf31){return db[_0xe54c('0x6')][_0xe54c('0x1c')](_0x573239[_0xe54c('0x1d')],{'raw':_0x573239['options']?_0x573239['options'][_0xe54c('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x573239['options']?_0x573239[_0xe54c('0x8')]['where']||null:null,'attributes':_0x573239['options']?_0x573239[_0xe54c('0x8')][_0xe54c('0xa')]||null:null,'limit':_0x573239['options']?_0x573239['options'][_0xe54c('0xb')]||null:null})[_0xe54c('0x19')](function(_0x2b32e5){logger[_0xe54c('0x16')](_0xe54c('0x1b'),_0x573239);logger[_0xe54c('0x16')](_0xe54c('0x1e'),JSON['stringify'](_0x573239['options'][_0xe54c('0x9')]),_0x573239['body'][_0xe54c('0x1f')]);logger[_0xe54c('0xf')]('UpdateCmHopper',_0x573239,JSON[_0xe54c('0x17')](_0x2b32e5));_0x3deed1(_0x2b32e5);})[_0xe54c('0x10')](function(_0xdb3049){logger[_0xe54c('0x11')](_0xe54c('0x1b'),_0xdb3049['message'],_0x573239);_0x44cf31(_0x54c0a9[_0xe54c('0x11')](0x1f4,_0xdb3049[_0xe54c('0x12')]));});});};exports['DestroyCmHopper']=function(_0x3448fe){var _0x4acb77=this;return new Promise(function(_0x1f3663,_0xa2aed2){return db[_0xe54c('0x6')][_0xe54c('0x20')]({'where':_0x3448fe[_0xe54c('0x8')]?_0x3448fe[_0xe54c('0x8')][_0xe54c('0x9')]||null:null})[_0xe54c('0x19')](function(_0x551bb2){logger['info'](_0xe54c('0x21'),_0x3448fe);logger[_0xe54c('0xf')](_0xe54c('0x21'),_0x3448fe,JSON[_0xe54c('0x17')](_0x551bb2));_0x1f3663(_0x551bb2);})[_0xe54c('0x10')](function(_0x451bef){logger[_0xe54c('0x11')]('DestroyCmHopper',_0x451bef[_0xe54c('0x12')],_0x3448fe);_0xa2aed2(_0x4acb77[_0xe54c('0x11')](0x1f4,_0x451bef[_0xe54c('0x12')]));});});};exports[_0xe54c('0x22')]=function(_0x3bc256){var _0x5d5200=this;return new Promise(function(_0x57e37f,_0x48b5a6){return db[_0xe54c('0x23')]['describe']()['then'](function(_0x436289){return db[_0xe54c('0x24')][_0xe54c('0x25')](function(_0x177067){return db[_0xe54c('0x6')][_0xe54c('0x7')]({'where':_0x3bc256[_0xe54c('0x8')]?_0x3bc256[_0xe54c('0x8')][_0xe54c('0x9')]||null:null,'attributes':_0x3bc256[_0xe54c('0x8')]?_0x3bc256[_0xe54c('0x8')][_0xe54c('0xa')]||null:null,'limit':_0x3bc256[_0xe54c('0x8')]?_0x3bc256[_0xe54c('0x8')][_0xe54c('0xb')]||null:null,'order':_0x3bc256[_0xe54c('0x8')]?_0x3bc256[_0xe54c('0x8')]['order']||null:null,'transaction':_0x177067,'lock':_0x177067[_0xe54c('0x26')][_0xe54c('0x27')],'include':[{'model':db['CmContact'],'as':_0xe54c('0x28'),'attributes':_[_0xe54c('0x29')](_0x436289)},{'model':db['User'],'as':_0xe54c('0x2a'),'attributes':['id',_0xe54c('0x2b'),'voicePause']}]})[_0xe54c('0x19')](function(_0x17cf92){var _0x45bd38=[];var _0x137451=[];for(var _0x26180b=0x0;_0x26180b<_0x17cf92[_0xe54c('0x2c')];_0x26180b+=0x1){var _0x4b5215=_0x17cf92[_0x26180b][_0xe54c('0x2d')];if(_0x4b5215===null){_0x45bd38[_0xe54c('0x2e')](_0x17cf92[_0x26180b][_0xe54c('0x1c')](_0x3bc256[_0xe54c('0x1d')],{'transaction':_0x177067}));}else if(!_0x137451[_0xe54c('0x2f')](_0x4b5215)){_0x137451[_0xe54c('0x2e')](_0x4b5215);_0x45bd38[_0xe54c('0x2e')](_0x17cf92[_0x26180b][_0xe54c('0x1c')](_0x3bc256[_0xe54c('0x1d')],{'transaction':_0x177067}));}}return BPromise[_0xe54c('0x30')](_0x45bd38);});})[_0xe54c('0x19')](function(_0x1f8697){logger[_0xe54c('0x16')]('GetContactDialer',_0x3bc256);if(_0x1f8697[_0xe54c('0x2c')]>0x0){logger[_0xe54c('0x16')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x1f8697[0x0][_0xe54c('0x31')]['id'],_0x1f8697[0x0][_0xe54c('0x31')][_0xe54c('0x32')],_0x1f8697[0x0][_0xe54c('0x31')]['active']);}logger[_0xe54c('0xf')](_0xe54c('0x22'),_0x3bc256,JSON['stringify'](_0x1f8697));_0x57e37f(_0x1f8697);})[_0xe54c('0x10')](function(_0x3403a4){logger['error'](_0xe54c('0x22'),_0x3403a4[_0xe54c('0x12')],_0x3bc256);_0x48b5a6(_0x5d5200[_0xe54c('0x11')](0x1f4,_0x3403a4[_0xe54c('0x12')]));});});});};exports[_0xe54c('0x33')]=function(_0x28af84){var _0x2aa431=this;return new Promise(function(_0x30cf39,_0x4089e0){return db[_0xe54c('0x24')][_0xe54c('0x25')](function(_0x427bd7){return db['CmHopperFinal']['create'](_0x28af84[_0xe54c('0x1d')],{'raw':_0x28af84['options']?_0x28af84[_0xe54c('0x8')][_0xe54c('0x15')]===undefined?!![]:![]:!![],'transaction':_0x427bd7})['then'](function(){logger['info'](_0xe54c('0x34'),JSON[_0xe54c('0x17')](_0x28af84['options']['where']),_0x28af84[_0xe54c('0x8')][_0xe54c('0x9')][_0xe54c('0x1f')]);return db['CmHopper']['destroy']({'where':_0x28af84[_0xe54c('0x8')]?_0x28af84['options']['where']||null:null,'transaction':_0x427bd7});});})[_0xe54c('0x19')](function(_0x683714){logger['info'](_0xe54c('0x33'),_0x28af84);logger['debug'](_0xe54c('0x33'),_0x28af84,JSON[_0xe54c('0x17')](_0x683714));_0x30cf39(_0x683714);})['catch'](function(_0x3e4357){logger[_0xe54c('0x11')]('MoveContactManagedDialer',_0x3e4357[_0xe54c('0x12')],_0x28af84);_0x4089e0(_0x2aa431[_0xe54c('0x11')](0x1f4,_0x3e4357[_0xe54c('0x12')]));});});};exports[_0xe54c('0x35')]=function(_0x69c3ba){var _0x3960c5=this;return new Promise(function(_0x141d30,_0x14823d){return db[_0xe54c('0x6')][_0xe54c('0x7')]({'raw':_0x69c3ba[_0xe54c('0x8')]?_0x69c3ba[_0xe54c('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x69c3ba[_0xe54c('0x8')]?_0x69c3ba[_0xe54c('0x8')][_0xe54c('0x9')]||null:null,'attributes':[[db[_0xe54c('0x24')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe54c('0x24')]['literal']('`scheduledat`\x20>=\x20'+util['format']('\x22%s\x22',moment()[_0xe54c('0x36')](_0xe54c('0x37')))+_0xe54c('0x38')))),'contactsRescheduled']]})[_0xe54c('0x19')](function(_0x45ab59){logger[_0xe54c('0x16')]('CountReScheduled',_0x69c3ba);logger[_0xe54c('0xf')]('CountReScheduled',_0x69c3ba,JSON[_0xe54c('0x17')](_0x45ab59));_0x141d30(_0x45ab59);})[_0xe54c('0x10')](function(_0x4845ef){logger[_0xe54c('0x11')](_0xe54c('0x35'),_0x4845ef[_0xe54c('0x12')],_0x69c3ba);_0x14823d(_0x3960c5[_0xe54c('0x11')](0x1f4,_0x4845ef[_0xe54c('0x12')]));});});};exports[_0xe54c('0x39')]=function(_0x47583a){var _0x4a5472=this;return new Promise(function(_0x2577de,_0x296e07){return db[_0xe54c('0x23')]['describe']()[_0xe54c('0x19')](function(){return db[_0xe54c('0x24')][_0xe54c('0x25')](function(_0x1df6e1){return db['CmHopper']['findAll']({'where':_0x47583a[_0xe54c('0x8')]?_0x47583a[_0xe54c('0x8')][_0xe54c('0x9')]||null:null,'attributes':_0x47583a[_0xe54c('0x8')]?_0x47583a['options'][_0xe54c('0xa')]||null:null,'limit':0x1,'order':_0x47583a['options']?_0x47583a[_0xe54c('0x8')][_0xe54c('0x3a')]||null:null,'group':db['CmHopper'][_0xe54c('0x2d')],'transaction':_0x1df6e1,'lock':_0x1df6e1[_0xe54c('0x26')][_0xe54c('0x27')],'include':_0x47583a['options']?_0x47583a[_0xe54c('0x8')][_0xe54c('0xc')]?_[_0xe54c('0xd')](_0x47583a[_0xe54c('0x8')][_0xe54c('0xc')],function(_0x3df01b){return{'model':db[_0x3df01b[_0xe54c('0xe')]],'as':_0x3df01b['as'],'attributes':_0x3df01b['attributes'],'include':_0x3df01b[_0xe54c('0xc')]?_[_0xe54c('0xd')](_0x3df01b[_0xe54c('0xc')],function(_0x128a1e){return{'model':db[_0x128a1e[_0xe54c('0xe')]],'as':_0x128a1e['as'],'attributes':_0x128a1e[_0xe54c('0xa')],'include':_0x128a1e[_0xe54c('0xc')]?_['map'](_0x128a1e[_0xe54c('0xc')],function(_0x582f59){return{'model':db[_0x582f59[_0xe54c('0xe')]],'as':_0x582f59['as'],'attributes':_0x582f59[_0xe54c('0xa')]};}):[]};}):[]};}):[]:[]})[_0xe54c('0x19')](function(_0x2de0f8){var _0x2d0f5b=[];for(var _0x56e24c=0x0;_0x56e24c<_0x2de0f8[_0xe54c('0x2c')];_0x56e24c+=0x1){_0x2d0f5b[_0xe54c('0x2e')](_0x2de0f8[_0x56e24c][_0xe54c('0x1c')](_0x47583a[_0xe54c('0x1d')],{'transaction':_0x1df6e1}));}return BPromise[_0xe54c('0x30')](_0x2d0f5b);});})[_0xe54c('0x19')](function(_0x221667){logger['info']('GetContactRecallMe',_0x47583a);logger[_0xe54c('0xf')](_0xe54c('0x39'),_0x47583a,JSON[_0xe54c('0x17')](_0x221667));_0x2577de(_0x221667);})[_0xe54c('0x10')](function(_0x6688b8){logger[_0xe54c('0x11')](_0xe54c('0x39'),_0x6688b8[_0xe54c('0x12')],_0x47583a);_0x296e07(_0x4a5472[_0xe54c('0x11')](0x1f4,_0x6688b8['message']));});});});};exports[_0xe54c('0x3b')]=function(_0x3f3107){var _0x3d8d7c=this;return new Promise(function(_0x2ca333,_0x463d6c){db[_0xe54c('0x23')][_0xe54c('0x3c')]()[_0xe54c('0x19')](function(_0x2926dd){return db[_0xe54c('0x6')][_0xe54c('0x7')]({'raw':_0x3f3107[_0xe54c('0x8')]?_0x3f3107[_0xe54c('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x3f3107['options']?_0x3f3107[_0xe54c('0x8')]['where']||null:null,'attributes':_0x3f3107[_0xe54c('0x8')]?_0x3f3107[_0xe54c('0x8')][_0xe54c('0xa')]||null:null,'limit':_0x3f3107[_0xe54c('0x8')]?_0x3f3107[_0xe54c('0x8')][_0xe54c('0xb')]||null:null,'include':_0x3f3107[_0xe54c('0x8')]?_0x3f3107[_0xe54c('0x8')][_0xe54c('0xc')]?_['map'](_0x3f3107['options'][_0xe54c('0xc')],function(_0x3c547b){return{'model':db[_0x3c547b['model']],'as':_0x3c547b['as'],'attributes':_0x3c547b['as']==='Contact'?_[_0xe54c('0x29')](_0x2926dd):_0x3c547b['attributes'],'include':_0x3c547b[_0xe54c('0xc')]?_[_0xe54c('0xd')](_0x3c547b[_0xe54c('0xc')],function(_0x33542f){return{'model':db[_0x33542f[_0xe54c('0xe')]],'as':_0x33542f['as'],'attributes':_0x33542f[_0xe54c('0xa')],'include':_0x33542f['include']?_[_0xe54c('0xd')](_0x33542f[_0xe54c('0xc')],function(_0x519a4b){return{'model':db[_0x519a4b['model']],'as':_0x519a4b['as'],'attributes':_0x519a4b[_0xe54c('0xa')]};}):[]};}):[]};}):[]:[]})[_0xe54c('0x19')](function(_0x2cf7ce){logger['info'](_0xe54c('0x5'),_0x3f3107);logger[_0xe54c('0xf')](_0xe54c('0x5'),_0x3f3107,JSON['stringify'](_0x2cf7ce));_0x2ca333(_0x2cf7ce);})[_0xe54c('0x10')](function(_0x505251){logger[_0xe54c('0x11')](_0xe54c('0x5'),_0x505251[_0xe54c('0x12')],_0x3f3107);_0x463d6c(_0x3d8d7c['error'](0x1f4,_0x505251[_0xe54c('0x12')]));});});});};exports['GetContactByPhone']=function(_0x43b716){var _0x4ec1bf=this;return new Promise(function(_0xf529c3,_0x1b30cb){return db['CmContact'][_0xe54c('0x3d')]({'raw':!![],'where':{'phone':_0x43b716[_0xe54c('0x8')][_0xe54c('0x9')][_0xe54c('0x3e')]},'attributes':['id',_0xe54c('0x3f')],'order':[['id','DESC']]})[_0xe54c('0x19')](function(_0x437a9b){logger[_0xe54c('0x16')](_0xe54c('0x40'),_0x43b716);logger['debug'](_0xe54c('0x40'),_0x43b716,JSON[_0xe54c('0x17')](_0x437a9b));_0xf529c3(_0x437a9b);})[_0xe54c('0x10')](function(_0x24dd8d){logger[_0xe54c('0x11')](_0xe54c('0x40'),_0x24dd8d[_0xe54c('0x12')],_0x43b716);_0x1b30cb(_0x4ec1bf[_0xe54c('0x11')](0x1f4,_0x24dd8d['message']));});});};exports['ResetActiveCalls']=function(_0x2f4a86){var _0x3e50c7=this;return new Promise(function(_0x2138e2,_0x139572){return db[_0xe54c('0x24')][_0xe54c('0x25')](function(_0x3f7162){var _0x82af18=_0x2f4a86[_0xe54c('0x8')]&&_0x2f4a86[_0xe54c('0x8')][_0xe54c('0x9')]?_0x2f4a86['options'][_0xe54c('0x9')]:{};return db['CmHopper'][_0xe54c('0x1c')](_0x2f4a86[_0xe54c('0x1d')],{'where':_0x82af18,'transaction':_0x3f7162})[_0xe54c('0x19')](function(_0x1d38c9){logger[_0xe54c('0x16')](_0xe54c('0x41'),_0x2f4a86);logger[_0xe54c('0xf')]('ResetActiveCalls',_0x2f4a86,JSON[_0xe54c('0x17')](_0x1d38c9));_0x2138e2(_0x1d38c9);})[_0xe54c('0x10')](function(_0xa42b2){logger[_0xe54c('0x11')](_0xe54c('0x41'),_0xa42b2['message'],_0x2f4a86);_0x139572(_0x3e50c7[_0xe54c('0x11')](0x1f4,_0xa42b2[_0xe54c('0x12')]));});});});};exports[_0xe54c('0x42')]=function(_0x585697){var _0x5f52fe=this;var _0x2388b3=_0x585697[_0xe54c('0x1d')][_0xe54c('0x9')][_0xe54c('0x43')];var _0x215298=_0x585697['body'][_0xe54c('0x9')][_0xe54c('0x44')];var _0x1ffc57=_0x585697[_0xe54c('0x1d')][_0xe54c('0x9')][_0xe54c('0x45')];return new Promise(function(_0x3fd06c,_0x55f63b){return db['CmHopper'][_0xe54c('0x7')]({'where':{'voiceQueueId':{'$in':_0x2388b3},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe54c('0x24')][_0xe54c('0x46')](_0xe54c('0x47')+_0x215298+'\x20MINUTE'),'$gt':db[_0xe54c('0x24')][_0xe54c('0x46')]('NOW()')}},'UserId':{'$in':_0x1ffc57}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0xe54c('0x48')],'as':_0xe54c('0x2a'),'attributes':['id',_0xe54c('0x2b'),_0xe54c('0x49')]},{'model':db[_0xe54c('0x4a')],'as':'List'}]})['then'](function(_0x4e790c){if(_0x4e790c[_0xe54c('0x2c')]>0x0){return db[_0xe54c('0x24')][_0xe54c('0x25')](function(_0x1c6555){return db[_0xe54c('0x6')][_0xe54c('0x1c')]({'recallmeNotifiedDate':db[_0xe54c('0x24')][_0xe54c('0x46')](_0xe54c('0x4b'))},{'where':{'id':{'$in':_[_0xe54c('0xd')](_0x4e790c,'id')}},'transaction':_0x1c6555})['then'](function(){_0x3fd06c(_0x4e790c);})[_0xe54c('0x10')](function(_0x1d8915){logger[_0xe54c('0x11')](_0xe54c('0x42'),_0x1d8915[_0xe54c('0x12')],_0x585697);_0x55f63b(_0x5f52fe['error'](0x1f4,_0x1d8915[_0xe54c('0x12')]));});})[_0xe54c('0x10')](function(_0x5bd41c){logger[_0xe54c('0x11')](_0xe54c('0x42'),_0x5bd41c[_0xe54c('0x12')],_0x585697);_0x55f63b(_0x5f52fe['error'](0x1f4,_0x5bd41c[_0xe54c('0x12')]));});}else{_0x3fd06c(_0x4e790c);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c6c9795..875f14b 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 _0xf378=['../../components/auth/service','./cmHopper.controller','get','/describe','isAuthenticated','describe','/opencontacts','/timezones','/:id','show','/:id/previewrecall','post','create','/preview','/timezone','getTimezone','put','update','destroy','exports','express'];(function(_0x4e7b01,_0x5c31bf){var _0x521e73=function(_0x4ac1f2){while(--_0x4ac1f2){_0x4e7b01['push'](_0x4e7b01['shift']());}};_0x521e73(++_0x5c31bf);}(_0xf378,0xfb));var _0x8f37=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf378[_0x42cae2];return _0x5f256f;};'use strict';var express=require(_0x8f37('0x0'));var router=express['Router']();var auth=require(_0x8f37('0x1'));var controller=require(_0x8f37('0x2'));router[_0x8f37('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8f37('0x3')](_0x8f37('0x4'),auth[_0x8f37('0x5')](),controller[_0x8f37('0x6')]);router[_0x8f37('0x3')](_0x8f37('0x7'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x8f37('0x3')](_0x8f37('0x8'),auth[_0x8f37('0x5')](),controller['getTimezones']);router['get'](_0x8f37('0x9'),auth[_0x8f37('0x5')](),controller[_0x8f37('0xa')]);router[_0x8f37('0x3')](_0x8f37('0xb'),auth[_0x8f37('0x5')](),controller['getPreviewRecall']);router[_0x8f37('0xc')]('/',auth[_0x8f37('0x5')](),controller[_0x8f37('0xd')]);router[_0x8f37('0xc')](_0x8f37('0xe'),auth[_0x8f37('0x5')](),controller['getPreview']);router['post'](_0x8f37('0xf'),auth[_0x8f37('0x5')](),controller[_0x8f37('0x10')]);router[_0x8f37('0x11')](_0x8f37('0x9'),auth[_0x8f37('0x5')](),controller[_0x8f37('0x12')]);router['delete']('/:id',auth[_0x8f37('0x5')](),controller[_0x8f37('0x13')]);module[_0x8f37('0x14')]=router; \ No newline at end of file +var _0xd258=['create','/preview','getPreview','/timezone','put','delete','/:id','destroy','exports','Router','isAuthenticated','index','get','/describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','getPreviewRecall'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd258,0x185));var _0x8d25=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd258[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x8d25('0x0')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router['get']('/',auth[_0x8d25('0x1')](),controller[_0x8d25('0x2')]);router[_0x8d25('0x3')](_0x8d25('0x4'),auth[_0x8d25('0x1')](),controller['describe']);router['get'](_0x8d25('0x5'),auth[_0x8d25('0x1')](),controller[_0x8d25('0x6')]);router[_0x8d25('0x3')](_0x8d25('0x7'),auth['isAuthenticated'](),controller[_0x8d25('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8d25('0x9')]);router[_0x8d25('0x3')]('/:id/previewrecall',auth[_0x8d25('0x1')](),controller[_0x8d25('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8d25('0xb')]);router['post'](_0x8d25('0xc'),auth[_0x8d25('0x1')](),controller[_0x8d25('0xd')]);router['post'](_0x8d25('0xe'),auth[_0x8d25('0x1')](),controller['getTimezone']);router[_0x8d25('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8d25('0x10')](_0x8d25('0x11'),auth[_0x8d25('0x1')](),controller[_0x8d25('0x12')]);module[_0x8d25('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index c46af18..c4cbc9b 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 _0xb3b3=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment','INTEGER'];(function(_0x1f951b,_0x654997){var _0x503af0=function(_0x40a7d9){while(--_0x40a7d9){_0x1f951b['push'](_0x1f951b['shift']());}};_0x503af0(++_0x654997);}(_0xb3b3,0xb7));var _0x3b3b=function(_0x5466f7,_0x4df454){_0x5466f7=_0x5466f7-0x0;var _0x5cf097=_0xb3b3[_0x5466f7];return _0x5cf097;};'use strict';var moment=require(_0x3b3b('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0x3b3b('0x1')]},'phone':{'type':Sequelize[_0x3b3b('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3b3b('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x3b3b('0x3')](_0x3b3b('0x4'))},'countbusyretry':{'type':Sequelize[_0x3b3b('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3b3b('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3b3b('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3b3b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3b3b('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3b3b('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3b3b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe9aa=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x261940,_0x1a3504){var _0x20a8ad=function(_0x22023e){while(--_0x22023e){_0x261940['push'](_0x261940['shift']());}};_0x20a8ad(++_0x1a3504);}(_0xe9aa,0x1b5));var _0xae9a=function(_0xa9797d,_0x18c051){_0xa9797d=_0xa9797d-0x0;var _0x49a3c6=_0xe9aa[_0xa9797d];return _0x49a3c6;};'use strict';var moment=require(_0xae9a('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0xae9a('0x1')]},'phone':{'type':Sequelize[_0xae9a('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xae9a('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xae9a('0x3')],'defaultValue':moment()[_0xae9a('0x4')](_0xae9a('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xae9a('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xae9a('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xae9a('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xae9a('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xae9a('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xae9a('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 b0a11d6..105099d 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 _0xcd12=['then','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','params','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x19435b,_0x999dbf){var _0x4f5bfd=function(_0x1b3299){while(--_0x1b3299){_0x19435b['push'](_0x19435b['shift']());}};_0x4f5bfd(++_0x999dbf);}(_0xcd12,0xd7));var _0x2cd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd12[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2cd1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cd1('0x1'));var jsonpatch=require(_0x2cd1('0x2'));var rp=require(_0x2cd1('0x3'));var moment=require(_0x2cd1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2cd1('0x5'));var util=require(_0x2cd1('0x6'));var path=require(_0x2cd1('0x7'));var sox=require(_0x2cd1('0x8'));var csv=require(_0x2cd1('0x9'));var ejs=require(_0x2cd1('0xa'));var fs=require('fs');var fs_extra=require(_0x2cd1('0xb'));var _=require(_0x2cd1('0xc'));var squel=require(_0x2cd1('0xd'));var crypto=require(_0x2cd1('0xe'));var jsforce=require(_0x2cd1('0xf'));var deskjs=require(_0x2cd1('0x10'));var toCsv=require(_0x2cd1('0x9'));var querystring=require(_0x2cd1('0x11'));var Papa=require(_0x2cd1('0x12'));var Redis=require('ioredis');var authService=require(_0x2cd1('0x13'));var qs=require(_0x2cd1('0x14'));var as=require(_0x2cd1('0x15'));var hardwareService=require(_0x2cd1('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2cd1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2cd1('0x18'));var db=require(_0x2cd1('0x19'))['db'];function respondWithStatusCode(_0x2dfed0,_0x2159f3){_0x2159f3=_0x2159f3||0xcc;return function(_0x34df5e){if(_0x34df5e){return _0x2dfed0[_0x2cd1('0x1a')](_0x2159f3);}return _0x2dfed0[_0x2cd1('0x1b')](_0x2159f3)['end']();};}function respondWithResult(_0x8b13b2,_0x507fb2){_0x507fb2=_0x507fb2||0xc8;return function(_0xae24d0){if(_0xae24d0){return _0x8b13b2[_0x2cd1('0x1b')](_0x507fb2)[_0x2cd1('0x1c')](_0xae24d0);}};}function respondWithFilteredResult(_0x5ab8c3,_0xc0e533){return function(_0x40bac2){if(_0x40bac2){var _0xed91ea=typeof _0xc0e533['offset']===_0x2cd1('0x1d')&&typeof _0xc0e533[_0x2cd1('0x1e')]==='undefined';var _0x2b2541=_0x40bac2[_0x2cd1('0x1f')];var _0x18a1c2=_0xed91ea?0x0:_0xc0e533[_0x2cd1('0x20')];var _0x17162c=_0xed91ea?_0x40bac2['count']:_0xc0e533[_0x2cd1('0x20')]+_0xc0e533[_0x2cd1('0x1e')];var _0x354247;if(_0x17162c>=_0x2b2541){_0x17162c=_0x2b2541;_0x354247=0xc8;}else{_0x354247=0xce;}_0x5ab8c3[_0x2cd1('0x1b')](_0x354247);return _0x5ab8c3[_0x2cd1('0x21')](_0x2cd1('0x22'),_0x18a1c2+'-'+_0x17162c+'/'+_0x2b2541)[_0x2cd1('0x1c')](_0x40bac2);}return null;};}function patchUpdates(_0x2636bd){return function(_0x3748cc){try{jsonpatch[_0x2cd1('0x23')](_0x3748cc,_0x2636bd,!![]);}catch(_0x54878f){return BPromise[_0x2cd1('0x24')](_0x54878f);}return _0x3748cc[_0x2cd1('0x25')]();};}function saveUpdates(_0x38c76c,_0x196814){return function(_0x8bfec5){if(_0x8bfec5){return _0x8bfec5[_0x2cd1('0x26')](_0x38c76c)['then'](function(_0x5ef542){return _0x5ef542;});}return null;};}function removeEntity(_0x7928d9,_0xec27f5){return function(_0x556f3b){if(_0x556f3b){return _0x556f3b[_0x2cd1('0x27')]()[_0x2cd1('0x28')](function(){var _0x2852eb=_0x556f3b[_0x2cd1('0x29')]({'plain':!![]});var _0x3a9f06=_0x2cd1('0x2a');return db[_0x2cd1('0x2b')][_0x2cd1('0x27')]({'where':{'type':_0x3a9f06,'resourceId':_0x2852eb['id']}})[_0x2cd1('0x28')](function(){return _0x556f3b;});})['then'](function(){_0x7928d9[_0x2cd1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a17f,_0x89fb34){return function(_0x4af888){if(!_0x4af888){_0x38a17f[_0x2cd1('0x1a')](0x194);}return _0x4af888;};}function handleError(_0x5e791c,_0x2f95f2){_0x2f95f2=_0x2f95f2||0x1f4;return function(_0x1454a5){logger[_0x2cd1('0x2c')](_0x1454a5[_0x2cd1('0x2d')]);if(_0x1454a5[_0x2cd1('0x2e')]){delete _0x1454a5['name'];}_0x5e791c[_0x2cd1('0x1b')](_0x2f95f2)[_0x2cd1('0x2f')](_0x1454a5);};}exports[_0x2cd1('0x30')]=function(_0x31be9b,_0x5a0ea0){var _0x279d09={},_0x171352={},_0xb5bf92={'count':0x0,'rows':[]};var _0x3eb076=_[_0x2cd1('0x31')](db[_0x2cd1('0x32')]['rawAttributes'],function(_0x4339c8){return{'name':_0x4339c8[_0x2cd1('0x33')],'type':_0x4339c8[_0x2cd1('0x34')][_0x2cd1('0x35')]};});_0x171352[_0x2cd1('0x36')]=_['map'](_0x3eb076,_0x2cd1('0x2e'));_0x171352['query']=_['keys'](_0x31be9b[_0x2cd1('0x37')]);_0x171352[_0x2cd1('0x38')]=_[_0x2cd1('0x39')](_0x171352[_0x2cd1('0x36')],_0x171352['query']);_0x279d09[_0x2cd1('0x3a')]=_['intersection'](_0x171352[_0x2cd1('0x36')],qs[_0x2cd1('0x3b')](_0x31be9b[_0x2cd1('0x37')][_0x2cd1('0x3b')]));_0x279d09['attributes']=_0x279d09[_0x2cd1('0x3a')][_0x2cd1('0x3c')]?_0x279d09[_0x2cd1('0x3a')]:_0x171352[_0x2cd1('0x36')];if(!_0x31be9b['query'][_0x2cd1('0x3d')](_0x2cd1('0x3e'))){_0x279d09[_0x2cd1('0x1e')]=qs[_0x2cd1('0x1e')](_0x31be9b['query'][_0x2cd1('0x1e')]);_0x279d09[_0x2cd1('0x20')]=qs[_0x2cd1('0x20')](_0x31be9b[_0x2cd1('0x37')][_0x2cd1('0x20')]);}_0x279d09[_0x2cd1('0x3f')]=qs[_0x2cd1('0x40')](_0x31be9b[_0x2cd1('0x37')][_0x2cd1('0x40')]);_0x279d09['where']=qs[_0x2cd1('0x38')](_[_0x2cd1('0x41')](_0x31be9b[_0x2cd1('0x37')],_0x171352[_0x2cd1('0x38')]),_0x3eb076);if(_0x31be9b['query'][_0x2cd1('0x42')]){_0x279d09['where']=_[_0x2cd1('0x43')](_0x279d09[_0x2cd1('0x44')],{'$or':_['map'](_0x3eb076,function(_0x239bd0){if(_0x239bd0[_0x2cd1('0x34')]!==_0x2cd1('0x45')){var _0x118fdb={};_0x118fdb[_0x239bd0[_0x2cd1('0x2e')]]={'$like':'%'+_0x31be9b[_0x2cd1('0x37')]['filter']+'%'};return _0x118fdb;}})});}_0x279d09=_[_0x2cd1('0x43')]({},_0x279d09,_0x31be9b['options']);var _0x4735c3={'where':_0x279d09[_0x2cd1('0x44')]};return db[_0x2cd1('0x32')][_0x2cd1('0x1f')](_0x4735c3)[_0x2cd1('0x28')](function(_0xe0a02b){_0xb5bf92['count']=_0xe0a02b;if(_0x31be9b[_0x2cd1('0x37')]['includeAll']){_0x279d09[_0x2cd1('0x46')]=[{'all':!![]}];}return db[_0x2cd1('0x32')][_0x2cd1('0x47')](_0x279d09);})['then'](function(_0x5c1fbe){_0xb5bf92[_0x2cd1('0x48')]=_0x5c1fbe;return _0xb5bf92;})[_0x2cd1('0x28')](respondWithFilteredResult(_0x5a0ea0,_0x279d09))['catch'](handleError(_0x5a0ea0,null));};exports['show']=function(_0x434d6e,_0x10ff19){var _0x34f96c={'raw':!![],'where':{'id':_0x434d6e[_0x2cd1('0x49')]['id']}},_0x31031b={};_0x31031b[_0x2cd1('0x36')]=_[_0x2cd1('0x4a')](db[_0x2cd1('0x32')]['rawAttributes']);_0x31031b[_0x2cd1('0x37')]=_['keys'](_0x434d6e['query']);_0x31031b['filters']=_[_0x2cd1('0x39')](_0x31031b['model'],_0x31031b[_0x2cd1('0x37')]);_0x34f96c[_0x2cd1('0x3a')]=_[_0x2cd1('0x39')](_0x31031b[_0x2cd1('0x36')],qs[_0x2cd1('0x3b')](_0x434d6e[_0x2cd1('0x37')][_0x2cd1('0x3b')]));_0x34f96c['attributes']=_0x34f96c[_0x2cd1('0x3a')][_0x2cd1('0x3c')]?_0x34f96c[_0x2cd1('0x3a')]:_0x31031b[_0x2cd1('0x36')];if(_0x434d6e[_0x2cd1('0x37')]['includeAll']){_0x34f96c[_0x2cd1('0x46')]=[{'all':!![]}];}_0x34f96c=_[_0x2cd1('0x43')]({},_0x34f96c,_0x434d6e['options']);return db[_0x2cd1('0x32')][_0x2cd1('0x4b')](_0x34f96c)[_0x2cd1('0x28')](handleEntityNotFound(_0x10ff19,null))[_0x2cd1('0x28')](respondWithResult(_0x10ff19,null))[_0x2cd1('0x4c')](handleError(_0x10ff19,null));};exports[_0x2cd1('0x4d')]=function(_0x1e14b4,_0x37901e){return db['CmHopperAdditionalPhone'][_0x2cd1('0x4d')](_0x1e14b4[_0x2cd1('0x4e')],{})[_0x2cd1('0x28')](function(_0x53bd99){var _0xce8d5=_0x1e14b4['user'][_0x2cd1('0x29')]({'plain':!![]});if(!_0xce8d5)throw new Error(_0x2cd1('0x4f'));if(_0xce8d5[_0x2cd1('0x50')]===_0x2cd1('0x51')){var _0x3517cd=_0x53bd99[_0x2cd1('0x29')]({'plain':!![]});var _0x13920c=_0x2cd1('0x2a');return db['UserProfileSection'][_0x2cd1('0x4b')]({'where':{'name':_0x13920c,'userProfileId':_0xce8d5[_0x2cd1('0x52')]},'raw':!![]})[_0x2cd1('0x28')](function(_0x5ce768){if(_0x5ce768&&_0x5ce768[_0x2cd1('0x53')]===0x0){return db['UserProfileResource'][_0x2cd1('0x4d')]({'name':_0x3517cd[_0x2cd1('0x2e')],'resourceId':_0x3517cd['id'],'type':_0x5ce768[_0x2cd1('0x2e')],'sectionId':_0x5ce768['id']},{})[_0x2cd1('0x28')](function(){return _0x53bd99;});}else{return _0x53bd99;}})[_0x2cd1('0x4c')](function(_0x50e6e8){logger[_0x2cd1('0x2c')](_0x2cd1('0x54'),_0x50e6e8);throw _0x50e6e8;});}return _0x53bd99;})[_0x2cd1('0x28')](respondWithResult(_0x37901e,0xc9))[_0x2cd1('0x4c')](handleError(_0x37901e,null));};exports[_0x2cd1('0x26')]=function(_0x52ca23,_0x3b1bf6){if(_0x52ca23['body']['id']){delete _0x52ca23[_0x2cd1('0x4e')]['id'];}return db[_0x2cd1('0x32')][_0x2cd1('0x4b')]({'where':{'id':_0x52ca23['params']['id']}})[_0x2cd1('0x28')](handleEntityNotFound(_0x3b1bf6,null))['then'](saveUpdates(_0x52ca23[_0x2cd1('0x4e')],null))[_0x2cd1('0x28')](respondWithResult(_0x3b1bf6,null))[_0x2cd1('0x4c')](handleError(_0x3b1bf6,null));};exports[_0x2cd1('0x27')]=function(_0x9707a8,_0xd3b5c9){return db[_0x2cd1('0x32')][_0x2cd1('0x4b')]({'where':{'id':_0x9707a8[_0x2cd1('0x49')]['id']}})[_0x2cd1('0x28')](handleEntityNotFound(_0xd3b5c9,null))['then'](removeEntity(_0xd3b5c9,null))[_0x2cd1('0x4c')](handleError(_0xd3b5c9,null));}; \ No newline at end of file +var _0xd5a5=['findAll','show','params','keys','include','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','offset','undefined','limit','count','status','Content-Range','apply','reject','save','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','end','sendStatus','stack','name','index','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','type','VIRTUAL','filter','options','includeAll'];(function(_0x5a98b1,_0x348ab8){var _0x394b02=function(_0x4fa0b9){while(--_0x4fa0b9){_0x5a98b1['push'](_0x5a98b1['shift']());}};_0x394b02(++_0x348ab8);}(_0xd5a5,0xab));var _0x5d5a=function(_0x1a08b8,_0x85e678){_0x1a08b8=_0x1a08b8-0x0;var _0x5ccf5c=_0xd5a5[_0x1a08b8];return _0x5ccf5c;};'use strict';var emlformat=require(_0x5d5a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d5a('0x1'));var jsonpatch=require(_0x5d5a('0x2'));var rp=require(_0x5d5a('0x3'));var moment=require('moment');var BPromise=require(_0x5d5a('0x4'));var Mustache=require(_0x5d5a('0x5'));var util=require(_0x5d5a('0x6'));var path=require(_0x5d5a('0x7'));var sox=require(_0x5d5a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d5a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5d5a('0xa'));var jsforce=require(_0x5d5a('0xb'));var deskjs=require(_0x5d5a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5d5a('0xd'));var Papa=require(_0x5d5a('0xe'));var Redis=require(_0x5d5a('0xf'));var authService=require(_0x5d5a('0x10'));var qs=require(_0x5d5a('0x11'));var as=require(_0x5d5a('0x12'));var hardwareService=require(_0x5d5a('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5d5a('0x14'))['db'];function respondWithStatusCode(_0x2934fd,_0x251a1e){_0x251a1e=_0x251a1e||0xcc;return function(_0xd16615){if(_0xd16615){return _0x2934fd['sendStatus'](_0x251a1e);}return _0x2934fd['status'](_0x251a1e)['end']();};}function respondWithResult(_0x1ac89e,_0x5520eb){_0x5520eb=_0x5520eb||0xc8;return function(_0x591bf9){if(_0x591bf9){return _0x1ac89e['status'](_0x5520eb)['json'](_0x591bf9);}};}function respondWithFilteredResult(_0x43ed8a,_0x3dead4){return function(_0x2a13a6){if(_0x2a13a6){var _0x39e668=typeof _0x3dead4[_0x5d5a('0x15')]===_0x5d5a('0x16')&&typeof _0x3dead4[_0x5d5a('0x17')]==='undefined';var _0x3f1e29=_0x2a13a6[_0x5d5a('0x18')];var _0x4dd362=_0x39e668?0x0:_0x3dead4['offset'];var _0x438775=_0x39e668?_0x2a13a6[_0x5d5a('0x18')]:_0x3dead4[_0x5d5a('0x15')]+_0x3dead4[_0x5d5a('0x17')];var _0x5a87d5;if(_0x438775>=_0x3f1e29){_0x438775=_0x3f1e29;_0x5a87d5=0xc8;}else{_0x5a87d5=0xce;}_0x43ed8a[_0x5d5a('0x19')](_0x5a87d5);return _0x43ed8a['set'](_0x5d5a('0x1a'),_0x4dd362+'-'+_0x438775+'/'+_0x3f1e29)['json'](_0x2a13a6);}return null;};}function patchUpdates(_0x37515e){return function(_0x15f8f1){try{jsonpatch[_0x5d5a('0x1b')](_0x15f8f1,_0x37515e,!![]);}catch(_0x10d8f1){return BPromise[_0x5d5a('0x1c')](_0x10d8f1);}return _0x15f8f1[_0x5d5a('0x1d')]();};}function saveUpdates(_0x1b0070,_0x4cc4a3){return function(_0x341a4b){if(_0x341a4b){return _0x341a4b['update'](_0x1b0070)['then'](function(_0x5254e7){return _0x5254e7;});}return null;};}function removeEntity(_0x48bbaa,_0x1e2274){return function(_0x539e45){if(_0x539e45){return _0x539e45[_0x5d5a('0x1e')]()[_0x5d5a('0x1f')](function(){var _0x91dd8f=_0x539e45[_0x5d5a('0x20')]({'plain':!![]});var _0x431b6c=_0x5d5a('0x21');return db[_0x5d5a('0x22')][_0x5d5a('0x1e')]({'where':{'type':_0x431b6c,'resourceId':_0x91dd8f['id']}})[_0x5d5a('0x1f')](function(){return _0x539e45;});})[_0x5d5a('0x1f')](function(){_0x48bbaa[_0x5d5a('0x19')](0xcc)[_0x5d5a('0x23')]();});}};}function handleEntityNotFound(_0x4eb4a6,_0x2aa6f5){return function(_0xeab790){if(!_0xeab790){_0x4eb4a6[_0x5d5a('0x24')](0x194);}return _0xeab790;};}function handleError(_0x37f9e2,_0x4ce1e7){_0x4ce1e7=_0x4ce1e7||0x1f4;return function(_0x30e2ef){logger['error'](_0x30e2ef[_0x5d5a('0x25')]);if(_0x30e2ef[_0x5d5a('0x26')]){delete _0x30e2ef[_0x5d5a('0x26')];}_0x37f9e2['status'](_0x4ce1e7)['send'](_0x30e2ef);};}exports[_0x5d5a('0x27')]=function(_0x4f2f16,_0x5420ff){var _0x3f6bb3={},_0x5990f6={},_0x2c64e0={'count':0x0,'rows':[]};var _0x213b86=_['map'](db[_0x5d5a('0x28')][_0x5d5a('0x29')],function(_0x4ca156){return{'name':_0x4ca156[_0x5d5a('0x2a')],'type':_0x4ca156['type'][_0x5d5a('0x2b')]};});_0x5990f6[_0x5d5a('0x2c')]=_['map'](_0x213b86,_0x5d5a('0x26'));_0x5990f6['query']=_['keys'](_0x4f2f16[_0x5d5a('0x2d')]);_0x5990f6[_0x5d5a('0x2e')]=_[_0x5d5a('0x2f')](_0x5990f6[_0x5d5a('0x2c')],_0x5990f6[_0x5d5a('0x2d')]);_0x3f6bb3[_0x5d5a('0x30')]=_['intersection'](_0x5990f6['model'],qs[_0x5d5a('0x31')](_0x4f2f16[_0x5d5a('0x2d')][_0x5d5a('0x31')]));_0x3f6bb3[_0x5d5a('0x30')]=_0x3f6bb3[_0x5d5a('0x30')][_0x5d5a('0x32')]?_0x3f6bb3[_0x5d5a('0x30')]:_0x5990f6[_0x5d5a('0x2c')];if(!_0x4f2f16['query'][_0x5d5a('0x33')](_0x5d5a('0x34'))){_0x3f6bb3[_0x5d5a('0x17')]=qs[_0x5d5a('0x17')](_0x4f2f16[_0x5d5a('0x2d')][_0x5d5a('0x17')]);_0x3f6bb3[_0x5d5a('0x15')]=qs[_0x5d5a('0x15')](_0x4f2f16[_0x5d5a('0x2d')]['offset']);}_0x3f6bb3[_0x5d5a('0x35')]=qs[_0x5d5a('0x36')](_0x4f2f16['query'][_0x5d5a('0x36')]);_0x3f6bb3[_0x5d5a('0x37')]=qs['filters'](_[_0x5d5a('0x38')](_0x4f2f16[_0x5d5a('0x2d')],_0x5990f6[_0x5d5a('0x2e')]),_0x213b86);if(_0x4f2f16[_0x5d5a('0x2d')]['filter']){_0x3f6bb3[_0x5d5a('0x37')]=_['merge'](_0x3f6bb3[_0x5d5a('0x37')],{'$or':_[_0x5d5a('0x39')](_0x213b86,function(_0x47e6e2){if(_0x47e6e2[_0x5d5a('0x3a')]!==_0x5d5a('0x3b')){var _0x84d52b={};_0x84d52b[_0x47e6e2[_0x5d5a('0x26')]]={'$like':'%'+_0x4f2f16[_0x5d5a('0x2d')][_0x5d5a('0x3c')]+'%'};return _0x84d52b;}})});}_0x3f6bb3=_['merge']({},_0x3f6bb3,_0x4f2f16[_0x5d5a('0x3d')]);var _0x23438d={'where':_0x3f6bb3[_0x5d5a('0x37')]};return db[_0x5d5a('0x28')][_0x5d5a('0x18')](_0x23438d)['then'](function(_0xac3b95){_0x2c64e0['count']=_0xac3b95;if(_0x4f2f16[_0x5d5a('0x2d')][_0x5d5a('0x3e')]){_0x3f6bb3['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x5d5a('0x3f')](_0x3f6bb3);})['then'](function(_0x887781){_0x2c64e0['rows']=_0x887781;return _0x2c64e0;})[_0x5d5a('0x1f')](respondWithFilteredResult(_0x5420ff,_0x3f6bb3))['catch'](handleError(_0x5420ff,null));};exports[_0x5d5a('0x40')]=function(_0x1da4dc,_0x263906){var _0x5462d1={'raw':!![],'where':{'id':_0x1da4dc[_0x5d5a('0x41')]['id']}},_0x5d82df={};_0x5d82df[_0x5d5a('0x2c')]=_[_0x5d5a('0x42')](db['CmHopperAdditionalPhone'][_0x5d5a('0x29')]);_0x5d82df[_0x5d5a('0x2d')]=_[_0x5d5a('0x42')](_0x1da4dc[_0x5d5a('0x2d')]);_0x5d82df['filters']=_['intersection'](_0x5d82df[_0x5d5a('0x2c')],_0x5d82df[_0x5d5a('0x2d')]);_0x5462d1[_0x5d5a('0x30')]=_[_0x5d5a('0x2f')](_0x5d82df[_0x5d5a('0x2c')],qs[_0x5d5a('0x31')](_0x1da4dc[_0x5d5a('0x2d')][_0x5d5a('0x31')]));_0x5462d1[_0x5d5a('0x30')]=_0x5462d1[_0x5d5a('0x30')][_0x5d5a('0x32')]?_0x5462d1['attributes']:_0x5d82df[_0x5d5a('0x2c')];if(_0x1da4dc[_0x5d5a('0x2d')][_0x5d5a('0x3e')]){_0x5462d1[_0x5d5a('0x43')]=[{'all':!![]}];}_0x5462d1=_[_0x5d5a('0x44')]({},_0x5462d1,_0x1da4dc[_0x5d5a('0x3d')]);return db[_0x5d5a('0x28')][_0x5d5a('0x45')](_0x5462d1)[_0x5d5a('0x1f')](handleEntityNotFound(_0x263906,null))[_0x5d5a('0x1f')](respondWithResult(_0x263906,null))[_0x5d5a('0x46')](handleError(_0x263906,null));};exports[_0x5d5a('0x47')]=function(_0x326b5e,_0x3f57bd){return db[_0x5d5a('0x28')]['create'](_0x326b5e[_0x5d5a('0x48')],{})[_0x5d5a('0x1f')](function(_0x192428){var _0x3c193c=_0x326b5e[_0x5d5a('0x49')]['get']({'plain':!![]});if(!_0x3c193c)throw new Error(_0x5d5a('0x4a'));if(_0x3c193c['role']==='user'){var _0x594c14=_0x192428['get']({'plain':!![]});var _0xf3cb74=_0x5d5a('0x21');return db[_0x5d5a('0x4b')][_0x5d5a('0x45')]({'where':{'name':_0xf3cb74,'userProfileId':_0x3c193c[_0x5d5a('0x4c')]},'raw':!![]})[_0x5d5a('0x1f')](function(_0x11ca14){if(_0x11ca14&&_0x11ca14['autoAssociation']===0x0){return db[_0x5d5a('0x22')][_0x5d5a('0x47')]({'name':_0x594c14[_0x5d5a('0x26')],'resourceId':_0x594c14['id'],'type':_0x11ca14[_0x5d5a('0x26')],'sectionId':_0x11ca14['id']},{})[_0x5d5a('0x1f')](function(){return _0x192428;});}else{return _0x192428;}})[_0x5d5a('0x46')](function(_0x2143ad){logger['error'](_0x5d5a('0x4d'),_0x2143ad);throw _0x2143ad;});}return _0x192428;})['then'](respondWithResult(_0x3f57bd,0xc9))[_0x5d5a('0x46')](handleError(_0x3f57bd,null));};exports['update']=function(_0x14139f,_0x6a8fba){if(_0x14139f[_0x5d5a('0x48')]['id']){delete _0x14139f['body']['id'];}return db['CmHopperAdditionalPhone'][_0x5d5a('0x45')]({'where':{'id':_0x14139f[_0x5d5a('0x41')]['id']}})['then'](handleEntityNotFound(_0x6a8fba,null))[_0x5d5a('0x1f')](saveUpdates(_0x14139f[_0x5d5a('0x48')],null))[_0x5d5a('0x1f')](respondWithResult(_0x6a8fba,null))[_0x5d5a('0x46')](handleError(_0x6a8fba,null));};exports[_0x5d5a('0x1e')]=function(_0x30a152,_0x20aabe){return db[_0x5d5a('0x28')]['find']({'where':{'id':_0x30a152[_0x5d5a('0x41')]['id']}})[_0x5d5a('0x1f')](handleEntityNotFound(_0x20aabe,null))[_0x5d5a('0x1f')](removeEntity(_0x20aabe,null))[_0x5d5a('0x46')](handleError(_0x20aabe,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 7a4a6ae..13957f9 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 _0xdb9a=['exports','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x39e2ef,_0x107570){var _0x322d36=function(_0x40828e){while(--_0x40828e){_0x39e2ef['push'](_0x39e2ef['shift']());}};_0x322d36(++_0x107570);}(_0xdb9a,0x106));var _0xadb9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb9a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xadb9('0x0'));var logger=require(_0xadb9('0x1'))(_0xadb9('0x2'));var moment=require(_0xadb9('0x3'));var BPromise=require(_0xadb9('0x4'));var rp=require(_0xadb9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadb9('0x6'));var config=require(_0xadb9('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xadb9('0x8')]=function(_0x49a380,_0x3b3825){return _0x49a380['define']('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38f5=['moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api'];(function(_0x2daad4,_0x3b183f){var _0x8dcec6=function(_0x7caeef){while(--_0x7caeef){_0x2daad4['push'](_0x2daad4['shift']());}};_0x8dcec6(++_0x3b183f);}(_0x38f5,0x171));var _0x538f=function(_0x4d2c6f,_0x84b084){_0x4d2c6f=_0x4d2c6f-0x0;var _0x5df277=_0x38f5[_0x4d2c6f];return _0x5df277;};'use strict';var _=require(_0x538f('0x0'));var util=require(_0x538f('0x1'));var logger=require('../../config/logger')(_0x538f('0x2'));var moment=require(_0x538f('0x3'));var BPromise=require(_0x538f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x538f('0x5'));var rimraf=require(_0x538f('0x6'));var config=require(_0x538f('0x7'));var attributes=require(_0x538f('0x8'));module[_0x538f('0x9')]=function(_0x32d71f,_0x338bb4){return _0x32d71f['define'](_0x538f('0xa'),attributes,{'tableName':_0x538f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 9137fb5..cf0d7fb 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 _0xb4c2=['countnosuchnumberretry','countdropretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countabandonedretry','countmachineretry','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x8d692,_0x16d6a2){var _0x22b7be=function(_0x5cb4f0){while(--_0x5cb4f0){_0x8d692['push'](_0x8d692['shift']());}};_0x22b7be(++_0x16d6a2);}(_0xb4c2,0x1d5));var _0x2b4c=function(_0x4847c6,_0x1b4ee2){_0x4847c6=_0x4847c6-0x0;var _0xbc4019=_0xb4c2[_0x4847c6];return _0xbc4019;};'use strict';var _=require(_0x2b4c('0x0'));var util=require('util');var moment=require(_0x2b4c('0x1'));var BPromise=require(_0x2b4c('0x2'));var rs=require(_0x2b4c('0x3'));var fs=require('fs');var Redis=require(_0x2b4c('0x4'));var db=require(_0x2b4c('0x5'))['db'];var utils=require(_0x2b4c('0x6'));var logger=require('../../config/logger')(_0x2b4c('0x7'));var config=require(_0x2b4c('0x8'));var jayson=require(_0x2b4c('0x9'));var client=jayson['client'][_0x2b4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7d184e,_0x3e2c41,_0x9d9b59){return new BPromise(function(_0x22fc98,_0x314814){return client['request'](_0x7d184e,_0x9d9b59)[_0x2b4c('0xb')](function(_0xedc4e6){logger[_0x2b4c('0xc')](_0x2b4c('0xd'),_0x3e2c41,_0x2b4c('0xe'));logger[_0x2b4c('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x3e2c41,_0x2b4c('0xe'),JSON[_0x2b4c('0x10')](_0xedc4e6));if(_0xedc4e6[_0x2b4c('0x11')]){if(_0xedc4e6[_0x2b4c('0x11')][_0x2b4c('0x12')]===0x1f4){logger['error'](_0x2b4c('0xd'),_0x3e2c41,_0xedc4e6['error'][_0x2b4c('0x13')]);return _0x314814(_0xedc4e6[_0x2b4c('0x11')][_0x2b4c('0x13')]);}logger[_0x2b4c('0x11')](_0x2b4c('0xd'),_0x3e2c41,_0xedc4e6[_0x2b4c('0x11')]['message']);return _0x22fc98(_0xedc4e6[_0x2b4c('0x11')][_0x2b4c('0x13')]);}else{logger['info'](_0x2b4c('0xd'),_0x3e2c41,_0x2b4c('0xe'));_0x22fc98(_0xedc4e6[_0x2b4c('0x14')][_0x2b4c('0x13')]);}})[_0x2b4c('0x15')](function(_0x502e13){logger[_0x2b4c('0x11')](_0x2b4c('0xd'),_0x3e2c41,_0x502e13);_0x314814(_0x502e13);});});}exports[_0x2b4c('0x16')]=function(_0x526d5a){var _0xb707ca=this;return new Promise(function(_0x36ee51,_0x3db9ed){return db[_0x2b4c('0x17')][_0x2b4c('0x18')]({'raw':!![],'where':{'ContactId':_0x526d5a[_0x2b4c('0x19')][_0x2b4c('0x1a')],'ListId':_0x526d5a[_0x2b4c('0x19')][_0x2b4c('0x1b')],'VoiceQueueId':_0x526d5a[_0x2b4c('0x19')][_0x2b4c('0x1c')]===undefined?null:_0x526d5a['body']['VoiceQueueId'],'CampaignId':_0x526d5a[_0x2b4c('0x19')][_0x2b4c('0x1d')]===undefined?null:_0x526d5a[_0x2b4c('0x19')]['CampaignId']}})[_0x2b4c('0xb')](function(_0xd029b9){if(_0xd029b9!=null){return db[_0x2b4c('0x1e')][_0x2b4c('0x18')]({'raw':!![],'where':{'CmHopperId':_0xd029b9['id'],'OrderBy':{'$gt':_0xd029b9[_0x2b4c('0x1f')]}},'order':[[_0x2b4c('0x1f'),'ASC']]})[_0x2b4c('0xb')](function(_0x2b81b0){var _0x50877d=0x0;if(_0x2b81b0){if(_0x2b81b0[_0x2b4c('0x20')]+_0x2b81b0[_0x2b4c('0x21')]+_0x2b81b0[_0x2b4c('0x22')]+_0x2b81b0[_0x2b4c('0x23')]+_0x2b81b0[_0x2b4c('0x24')]+_0x2b81b0['countabandonedretry']+_0x2b81b0['countmachineretry']+_0x2b81b0[_0x2b4c('0x25')]<_0x526d5a[_0x2b4c('0x26')][_0x2b4c('0x27')])_0x50877d=0x1;_0x36ee51({'additional':_0x50877d});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xd029b9['id']},'order':[[_0x2b4c('0x1f'),_0x2b4c('0x28')]]})[_0x2b4c('0xb')](function(_0x914098){var _0x174249=0x0;if(_0x914098){if(_0x914098['countbusyretry']+_0x914098['countcongestionretry']+_0x914098[_0x2b4c('0x22')]+_0x914098[_0x2b4c('0x23')]+_0x914098[_0x2b4c('0x24')]+_0x914098[_0x2b4c('0x29')]+_0x914098[_0x2b4c('0x2a')]+_0x914098['countagentrejectretry']<_0x526d5a[_0x2b4c('0x26')]['dialGlobalMaxRetry'])_0x174249=0x1;_0x36ee51({'additional':_0x174249});}else{_0x36ee51({'additional':0x0});}})[_0x2b4c('0x15')](function(_0xf79c1){logger[_0x2b4c('0x11')](_0x2b4c('0x16'),_0xf79c1[_0x2b4c('0x13')]);_0x3db9ed(_0xb707ca[_0x2b4c('0x11')](0x1f4,_0xf79c1[_0x2b4c('0x13')]));});}})[_0x2b4c('0x15')](function(_0x15fd2f){logger[_0x2b4c('0x11')](_0x2b4c('0x16'),_0x15fd2f[_0x2b4c('0x13')]);_0x3db9ed(_0xb707ca['error'](0x1f4,_0x15fd2f[_0x2b4c('0x13')]));});}else _0x36ee51({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x5596b5){var _0x54e962=this;return new Promise(function(_0x5b9ad4,_0x1a80cc){return db[_0x2b4c('0x17')][_0x2b4c('0x18')]({'raw':!![],'where':{'ContactId':_0x5596b5['body'][_0x2b4c('0x1a')],'ListId':_0x5596b5[_0x2b4c('0x19')][_0x2b4c('0x1b')],'VoiceQueueId':_0x5596b5[_0x2b4c('0x19')][_0x2b4c('0x1c')]===undefined?null:_0x5596b5[_0x2b4c('0x19')][_0x2b4c('0x1c')],'CampaignId':_0x5596b5['body'][_0x2b4c('0x1d')]===undefined?null:_0x5596b5[_0x2b4c('0x19')][_0x2b4c('0x1d')]}})[_0x2b4c('0xb')](function(_0x33dc09){if(_0x33dc09!=null){return db[_0x2b4c('0x1e')][_0x2b4c('0x18')]({'raw':!![],'where':{'CmHopperId':_0x33dc09['id'],'OrderBy':{'$gte':_0x33dc09[_0x2b4c('0x1f')]}},'order':[[_0x2b4c('0x1f'),_0x2b4c('0x28')]]})[_0x2b4c('0xb')](function(_0x40524f){if(_0x40524f)return activateAdditionalPhone(_0x33dc09,_0x5596b5['body'],_0x40524f,_0x5596b5[_0x2b4c('0x2b')],_0x5596b5[_0x2b4c('0x2c')])['then'](function(_0x102838){_0x5b9ad4(_0x102838);});else{return db[_0x2b4c('0x1e')][_0x2b4c('0x18')]({'raw':!![],'where':{'CmHopperId':_0x33dc09['id']},'order':[[_0x2b4c('0x1f'),_0x2b4c('0x28')]]})[_0x2b4c('0xb')](function(_0x56a803){if(_0x56a803)return activateAdditionalPhone(_0x33dc09,_0x5596b5[_0x2b4c('0x19')],_0x56a803,_0x5596b5['duration'],_0x5596b5[_0x2b4c('0x2c')])[_0x2b4c('0xb')](function(_0x281c30){_0x5b9ad4(_0x281c30);});else{_0x5b9ad4({'id':_0x33dc09['id'],'phone':''});}})[_0x2b4c('0x15')](function(_0x428bf4){logger[_0x2b4c('0x11')](_0x2b4c('0x16'),_0x428bf4['message']);_0x1a80cc(_0x54e962[_0x2b4c('0x11')](0x1f4,_0x428bf4['message']));});}})['catch'](function(_0x4fb39e){logger[_0x2b4c('0x11')](_0x2b4c('0x16'),_0x4fb39e[_0x2b4c('0x13')]);_0x1a80cc(_0x54e962[_0x2b4c('0x11')](0x1f4,_0x4fb39e[_0x2b4c('0x13')]));});}else _0x5b9ad4(0x1);});});};function activateAdditionalPhone(_0x2caa3b,_0x4e8c45,_0x972f20,_0x30f2fe,_0x38e3cc){return new Promise(function(_0x45cb6d,_0x14659c){var _0x47dbf4;if(_[_0x2b4c('0x2d')](_0x972f20[_0x2b4c('0x2e')])){_0x972f20['scheduledat']=moment();}if(moment()>moment(_0x972f20['scheduledat'])){_0x47dbf4=moment()[_0x2b4c('0x2f')](_0x38e3cc||0x3,'minutes');}else{if(_0x972f20[_0x2b4c('0x1f')]==0x0){_0x47dbf4=moment(_0x972f20[_0x2b4c('0x2e')]);}else{_0x47dbf4=moment()[_0x2b4c('0x2f')](_0x38e3cc||0x3,'minutes');}}if(_[_0x2b4c('0x2d')](_0x47dbf4)){_0x47dbf4=moment()[_0x2b4c('0x2f')](_0x38e3cc||0x3,_0x2b4c('0x30'));}var _0x2d02be={'phone':_0x2caa3b['phone'],'active':0x0,'OrderBy':_[_0x2b4c('0x2d')](_0x2caa3b[_0x2b4c('0x1f')])?0x0:_0x2caa3b['OrderBy'],'scheduledat':moment()[_0x2b4c('0x2f')](_0x30f2fe||0x1,_0x2b4c('0x30')),'countbusyretry':_0x4e8c45[_0x2b4c('0x20')],'countcongestionretry':_0x4e8c45['countcongestionretry'],'countnoanswerretry':_0x4e8c45[_0x2b4c('0x22')],'countnosuchnumberretry':_0x4e8c45[_0x2b4c('0x23')],'countdropretry':_0x4e8c45[_0x2b4c('0x24')],'countabandonedretry':_0x4e8c45[_0x2b4c('0x29')],'countmachineretry':_0x4e8c45[_0x2b4c('0x2a')],'countagentrejectretry':_0x4e8c45[_0x2b4c('0x25')],'createdAt':_0x4e8c45[_0x2b4c('0x31')],'updatedAt':_0x4e8c45[_0x2b4c('0x32')]};var _0x3a1038={'CmHopperId':_0x2caa3b['id'],'phone':_0x972f20[_0x2b4c('0x33')],'active':0x0,'OrderBy':_[_0x2b4c('0x2d')](_0x972f20['OrderBy'])?0x0:_0x972f20['OrderBy'],'scheduledat':_0x47dbf4,'countbusyretry':_0x972f20[_0x2b4c('0x20')],'countcongestionretry':_0x972f20[_0x2b4c('0x21')],'countnoanswerretry':_0x972f20[_0x2b4c('0x22')],'countnosuchnumberretry':_0x972f20[_0x2b4c('0x23')],'countdropretry':_0x972f20[_0x2b4c('0x24')],'countabandonedretry':_0x972f20[_0x2b4c('0x29')],'countmachineretry':_0x972f20['countmachineretry'],'countagentrejectretry':_0x972f20[_0x2b4c('0x25')],'createdAt':_0x972f20[_0x2b4c('0x31')],'updatedAt':_0x972f20['updatedAt']};return db[_0x2b4c('0x34')]['transaction'](function(_0xc10d22){return db[_0x2b4c('0x1e')][_0x2b4c('0x35')](_0x2d02be,{'where':{'id':_0x972f20['id']}},{'transaction':_0xc10d22})[_0x2b4c('0xb')](function(){return db['CmHopper'][_0x2b4c('0x35')](_0x3a1038,{'where':{'id':_0x2caa3b['id']}},{'transaction':_0xc10d22});});})[_0x2b4c('0xb')](function(_0x588235){_0x45cb6d({'id':_0x2caa3b['id'],'phone':_0x972f20['phone']});})['catch'](function(_0x202aed){logger['error'](_0x2b4c('0x36'),_0x202aed[_0x2b4c('0x13')]);_0x14659c({'error':_0x202aed[_0x2b4c('0x13')]});});});}exports[_0x2b4c('0x37')]=function(_0x51dabe){var _0xc9b80b=this;return new Promise(function(_0x47e6b5,_0x13a1d6){return db['CmHopper'][_0x2b4c('0x35')](_0x51dabe[_0x2b4c('0x19')]['field'],{'where':{'id':_0x51dabe[_0x2b4c('0x19')]['id']}})[_0x2b4c('0xb')](function(_0x14e816){_0x47e6b5(_0x14e816);})[_0x2b4c('0x15')](function(_0x51dc37){logger['error'](_0x2b4c('0x37'),_0x51dc37['message']);_0x13a1d6(_0xc9b80b['error'](0x1f4,_0x51dc37[_0x2b4c('0x13')]));});});}; \ No newline at end of file +var _0x3cac=['countagentrejectretry','VerifyAdditionalPhones','SwapAdditionalPhones','ListId','duration','waitTime','isNil','scheduledat','add','minutes','phone','countnoanswerretry','countnosuchnumberretry','countdropretry','createdAt','updatedAt','sequelize','transaction','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CmHopper','ContactId','body','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countabandonedretry','entity','dialGlobalMaxRetry','countmachineretry'];(function(_0x8935ce,_0x3621c3){var _0x1a422f=function(_0x35cb66){while(--_0x35cb66){_0x8935ce['push'](_0x8935ce['shift']());}};_0x1a422f(++_0x3621c3);}(_0x3cac,0x176));var _0xc3ca=function(_0x2db621,_0x427ff0){_0x2db621=_0x2db621-0x0;var _0x54633d=_0x3cac[_0x2db621];return _0x54633d;};'use strict';var _=require(_0xc3ca('0x0'));var util=require(_0xc3ca('0x1'));var moment=require('moment');var BPromise=require(_0xc3ca('0x2'));var rs=require(_0xc3ca('0x3'));var fs=require('fs');var Redis=require(_0xc3ca('0x4'));var db=require(_0xc3ca('0x5'))['db'];var utils=require(_0xc3ca('0x6'));var logger=require('../../config/logger')(_0xc3ca('0x7'));var config=require(_0xc3ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc3ca('0x9')][_0xc3ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46639b,_0x2ceb1a,_0x39cac2){return new BPromise(function(_0x20e477,_0x38e6ed){return client[_0xc3ca('0xb')](_0x46639b,_0x39cac2)['then'](function(_0x2e9347){logger[_0xc3ca('0xc')](_0xc3ca('0xd'),_0x2ceb1a,_0xc3ca('0xe'));logger[_0xc3ca('0xf')](_0xc3ca('0x10'),_0x2ceb1a,'request\x20sent',JSON[_0xc3ca('0x11')](_0x2e9347));if(_0x2e9347['error']){if(_0x2e9347['error'][_0xc3ca('0x12')]===0x1f4){logger[_0xc3ca('0x13')](_0xc3ca('0xd'),_0x2ceb1a,_0x2e9347['error'][_0xc3ca('0x14')]);return _0x38e6ed(_0x2e9347[_0xc3ca('0x13')][_0xc3ca('0x14')]);}logger[_0xc3ca('0x13')](_0xc3ca('0xd'),_0x2ceb1a,_0x2e9347['error'][_0xc3ca('0x14')]);return _0x20e477(_0x2e9347[_0xc3ca('0x13')][_0xc3ca('0x14')]);}else{logger[_0xc3ca('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2ceb1a,_0xc3ca('0xe'));_0x20e477(_0x2e9347[_0xc3ca('0x15')][_0xc3ca('0x14')]);}})[_0xc3ca('0x16')](function(_0x3cde3b){logger['error'](_0xc3ca('0xd'),_0x2ceb1a,_0x3cde3b);_0x38e6ed(_0x3cde3b);});});}exports['VerifyAdditionalPhones']=function(_0x57ee3d){var _0x5e0d15=this;return new Promise(function(_0x5cd01c,_0x3fe16b){return db[_0xc3ca('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x57ee3d['body'][_0xc3ca('0x18')],'ListId':_0x57ee3d['body']['ListId'],'VoiceQueueId':_0x57ee3d[_0xc3ca('0x19')]['VoiceQueueId']===undefined?null:_0x57ee3d['body'][_0xc3ca('0x1a')],'CampaignId':_0x57ee3d[_0xc3ca('0x19')][_0xc3ca('0x1b')]===undefined?null:_0x57ee3d[_0xc3ca('0x19')][_0xc3ca('0x1b')]}})[_0xc3ca('0x1c')](function(_0x4f656d){if(_0x4f656d!=null){return db[_0xc3ca('0x1d')][_0xc3ca('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x4f656d['id'],'OrderBy':{'$gt':_0x4f656d['OrderBy']}},'order':[[_0xc3ca('0x1f'),_0xc3ca('0x20')]]})[_0xc3ca('0x1c')](function(_0x4f4537){var _0x19c23c=0x0;if(_0x4f4537){if(_0x4f4537[_0xc3ca('0x21')]+_0x4f4537[_0xc3ca('0x22')]+_0x4f4537['countnoanswerretry']+_0x4f4537['countnosuchnumberretry']+_0x4f4537['countdropretry']+_0x4f4537[_0xc3ca('0x23')]+_0x4f4537['countmachineretry']+_0x4f4537['countagentrejectretry']<_0x57ee3d[_0xc3ca('0x24')][_0xc3ca('0x25')])_0x19c23c=0x1;_0x5cd01c({'additional':_0x19c23c});}else{return db[_0xc3ca('0x1d')][_0xc3ca('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x4f656d['id']},'order':[[_0xc3ca('0x1f'),_0xc3ca('0x20')]]})['then'](function(_0x2c20cb){var _0x27cf48=0x0;if(_0x2c20cb){if(_0x2c20cb[_0xc3ca('0x21')]+_0x2c20cb[_0xc3ca('0x22')]+_0x2c20cb['countnoanswerretry']+_0x2c20cb['countnosuchnumberretry']+_0x2c20cb['countdropretry']+_0x2c20cb['countabandonedretry']+_0x2c20cb[_0xc3ca('0x26')]+_0x2c20cb[_0xc3ca('0x27')]<_0x57ee3d['entity'][_0xc3ca('0x25')])_0x27cf48=0x1;_0x5cd01c({'additional':_0x27cf48});}else{_0x5cd01c({'additional':0x0});}})['catch'](function(_0x55e577){logger[_0xc3ca('0x13')](_0xc3ca('0x28'),_0x55e577['message']);_0x3fe16b(_0x5e0d15['error'](0x1f4,_0x55e577[_0xc3ca('0x14')]));});}})[_0xc3ca('0x16')](function(_0x4bc385){logger['error'](_0xc3ca('0x28'),_0x4bc385['message']);_0x3fe16b(_0x5e0d15[_0xc3ca('0x13')](0x1f4,_0x4bc385[_0xc3ca('0x14')]));});}else _0x5cd01c({'additional':0x0});});});};exports[_0xc3ca('0x29')]=function(_0x5a7db0){var _0x4360eb=this;return new Promise(function(_0x282aa5,_0x27c6f8){return db[_0xc3ca('0x17')][_0xc3ca('0x1e')]({'raw':!![],'where':{'ContactId':_0x5a7db0[_0xc3ca('0x19')]['ContactId'],'ListId':_0x5a7db0[_0xc3ca('0x19')][_0xc3ca('0x2a')],'VoiceQueueId':_0x5a7db0[_0xc3ca('0x19')][_0xc3ca('0x1a')]===undefined?null:_0x5a7db0['body'][_0xc3ca('0x1a')],'CampaignId':_0x5a7db0[_0xc3ca('0x19')][_0xc3ca('0x1b')]===undefined?null:_0x5a7db0[_0xc3ca('0x19')][_0xc3ca('0x1b')]}})[_0xc3ca('0x1c')](function(_0x2b0fae){if(_0x2b0fae!=null){return db[_0xc3ca('0x1d')][_0xc3ca('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x2b0fae['id'],'OrderBy':{'$gte':_0x2b0fae[_0xc3ca('0x1f')]}},'order':[[_0xc3ca('0x1f'),_0xc3ca('0x20')]]})[_0xc3ca('0x1c')](function(_0xbd245d){if(_0xbd245d)return activateAdditionalPhone(_0x2b0fae,_0x5a7db0[_0xc3ca('0x19')],_0xbd245d,_0x5a7db0[_0xc3ca('0x2b')],_0x5a7db0[_0xc3ca('0x2c')])[_0xc3ca('0x1c')](function(_0x4ddf3c){_0x282aa5(_0x4ddf3c);});else{return db[_0xc3ca('0x1d')][_0xc3ca('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x2b0fae['id']},'order':[['OrderBy',_0xc3ca('0x20')]]})[_0xc3ca('0x1c')](function(_0x347186){if(_0x347186)return activateAdditionalPhone(_0x2b0fae,_0x5a7db0[_0xc3ca('0x19')],_0x347186,_0x5a7db0[_0xc3ca('0x2b')],_0x5a7db0['waitTime'])[_0xc3ca('0x1c')](function(_0x46de7a){_0x282aa5(_0x46de7a);});else{_0x282aa5({'id':_0x2b0fae['id'],'phone':''});}})[_0xc3ca('0x16')](function(_0x1cfd86){logger[_0xc3ca('0x13')](_0xc3ca('0x28'),_0x1cfd86[_0xc3ca('0x14')]);_0x27c6f8(_0x4360eb[_0xc3ca('0x13')](0x1f4,_0x1cfd86[_0xc3ca('0x14')]));});}})['catch'](function(_0x588311){logger[_0xc3ca('0x13')](_0xc3ca('0x28'),_0x588311['message']);_0x27c6f8(_0x4360eb[_0xc3ca('0x13')](0x1f4,_0x588311[_0xc3ca('0x14')]));});}else _0x282aa5(0x1);});});};function activateAdditionalPhone(_0xa6c974,_0x1496a3,_0x5b9f87,_0x423b53,_0x2b9453){return new Promise(function(_0x4b5145,_0x53a6a6){var _0x444634;if(_[_0xc3ca('0x2d')](_0x5b9f87[_0xc3ca('0x2e')])){_0x5b9f87[_0xc3ca('0x2e')]=moment();}if(moment()>moment(_0x5b9f87['scheduledat'])){_0x444634=moment()[_0xc3ca('0x2f')](_0x2b9453||0x3,'minutes');}else{if(_0x5b9f87[_0xc3ca('0x1f')]==0x0){_0x444634=moment(_0x5b9f87[_0xc3ca('0x2e')]);}else{_0x444634=moment()[_0xc3ca('0x2f')](_0x2b9453||0x3,_0xc3ca('0x30'));}}if(_[_0xc3ca('0x2d')](_0x444634)){_0x444634=moment()[_0xc3ca('0x2f')](_0x2b9453||0x3,_0xc3ca('0x30'));}var _0x5dee8e={'phone':_0xa6c974[_0xc3ca('0x31')],'active':0x0,'OrderBy':_['isNil'](_0xa6c974[_0xc3ca('0x1f')])?0x0:_0xa6c974[_0xc3ca('0x1f')],'scheduledat':moment()[_0xc3ca('0x2f')](_0x423b53||0x1,_0xc3ca('0x30')),'countbusyretry':_0x1496a3[_0xc3ca('0x21')],'countcongestionretry':_0x1496a3['countcongestionretry'],'countnoanswerretry':_0x1496a3[_0xc3ca('0x32')],'countnosuchnumberretry':_0x1496a3[_0xc3ca('0x33')],'countdropretry':_0x1496a3[_0xc3ca('0x34')],'countabandonedretry':_0x1496a3[_0xc3ca('0x23')],'countmachineretry':_0x1496a3[_0xc3ca('0x26')],'countagentrejectretry':_0x1496a3[_0xc3ca('0x27')],'createdAt':_0x1496a3[_0xc3ca('0x35')],'updatedAt':_0x1496a3[_0xc3ca('0x36')]};var _0x1aa59f={'CmHopperId':_0xa6c974['id'],'phone':_0x5b9f87['phone'],'active':0x0,'OrderBy':_['isNil'](_0x5b9f87[_0xc3ca('0x1f')])?0x0:_0x5b9f87[_0xc3ca('0x1f')],'scheduledat':_0x444634,'countbusyretry':_0x5b9f87['countbusyretry'],'countcongestionretry':_0x5b9f87[_0xc3ca('0x22')],'countnoanswerretry':_0x5b9f87[_0xc3ca('0x32')],'countnosuchnumberretry':_0x5b9f87[_0xc3ca('0x33')],'countdropretry':_0x5b9f87[_0xc3ca('0x34')],'countabandonedretry':_0x5b9f87[_0xc3ca('0x23')],'countmachineretry':_0x5b9f87['countmachineretry'],'countagentrejectretry':_0x5b9f87[_0xc3ca('0x27')],'createdAt':_0x5b9f87[_0xc3ca('0x35')],'updatedAt':_0x5b9f87[_0xc3ca('0x36')]};return db[_0xc3ca('0x37')][_0xc3ca('0x38')](function(_0x199e5a){return db[_0xc3ca('0x1d')]['update'](_0x5dee8e,{'where':{'id':_0x5b9f87['id']}},{'transaction':_0x199e5a})['then'](function(){return db[_0xc3ca('0x17')]['update'](_0x1aa59f,{'where':{'id':_0xa6c974['id']}},{'transaction':_0x199e5a});});})[_0xc3ca('0x1c')](function(_0x202b98){_0x4b5145({'id':_0xa6c974['id'],'phone':_0x5b9f87['phone']});})[_0xc3ca('0x16')](function(_0x3a5cfd){logger['error'](_0xc3ca('0x39'),_0x3a5cfd[_0xc3ca('0x14')]);_0x53a6a6({'error':_0x3a5cfd[_0xc3ca('0x14')]});});});}exports[_0xc3ca('0x3a')]=function(_0x103825){var _0x1b6b4c=this;return new Promise(function(_0xb7f706,_0x4dd58b){return db[_0xc3ca('0x17')]['update'](_0x103825[_0xc3ca('0x19')]['field'],{'where':{'id':_0x103825[_0xc3ca('0x19')]['id']}})[_0xc3ca('0x1c')](function(_0x156e4c){_0xb7f706(_0x156e4c);})[_0xc3ca('0x16')](function(_0x3a645e){logger[_0xc3ca('0x13')]('IncrementPreviewCounters',_0x3a645e[_0xc3ca('0x14')]);_0x4dd58b(_0x1b6b4c[_0xc3ca('0x13')](0x1f4,_0x3a645e['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index f93e8d8..e1762d9 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 _0xbbf6=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer'];(function(_0x497fbb,_0x6e07b3){var _0x896437=function(_0x51a661){while(--_0x51a661){_0x497fbb['push'](_0x497fbb['shift']());}};_0x896437(++_0x6e07b3);}(_0xbbf6,0x143));var _0x6bbf=function(_0x16daa0,_0x592ec6){_0x16daa0=_0x16daa0-0x0;var _0x4d2a45=_0xbbf6[_0x16daa0];return _0x4d2a45;};'use strict';var multer=require(_0x6bbf('0x0'));var util=require('util');var path=require(_0x6bbf('0x1'));var timeout=require(_0x6bbf('0x2'));var express=require(_0x6bbf('0x3'));var router=express[_0x6bbf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6bbf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6bbf('0x6'));var controller=require(_0x6bbf('0x7'));router[_0x6bbf('0x8')]('/',auth[_0x6bbf('0x9')](),controller[_0x6bbf('0xa')]);router[_0x6bbf('0x8')]('/:id',auth[_0x6bbf('0x9')](),controller[_0x6bbf('0xb')]);router[_0x6bbf('0xc')]('/',auth['isAuthenticated'](),controller[_0x6bbf('0xd')]);router['put'](_0x6bbf('0xe'),auth[_0x6bbf('0x9')](),controller['update']);router[_0x6bbf('0xf')]('/:id',auth[_0x6bbf('0x9')](),controller[_0x6bbf('0x10')]);module[_0x6bbf('0x11')]=router; \ No newline at end of file +var _0x7a02=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x543770,_0x5b9f3e){var _0x366292=function(_0x46cee7){while(--_0x46cee7){_0x543770['push'](_0x543770['shift']());}};_0x366292(++_0x5b9f3e);}(_0x7a02,0x14d));var _0x27a0=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7a02[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x27a0('0x0'));var util=require(_0x27a0('0x1'));var path=require('path');var timeout=require(_0x27a0('0x2'));var express=require('express');var router=express[_0x27a0('0x3')]();var fs_extra=require(_0x27a0('0x4'));var auth=require(_0x27a0('0x5'));var interaction=require(_0x27a0('0x6'));var config=require(_0x27a0('0x7'));var controller=require(_0x27a0('0x8'));router[_0x27a0('0x9')]('/',auth['isAuthenticated'](),controller[_0x27a0('0xa')]);router[_0x27a0('0x9')](_0x27a0('0xb'),auth[_0x27a0('0xc')](),controller[_0x27a0('0xd')]);router[_0x27a0('0xe')]('/',auth[_0x27a0('0xc')](),controller[_0x27a0('0xf')]);router[_0x27a0('0x10')](_0x27a0('0xb'),auth[_0x27a0('0xc')](),controller[_0x27a0('0x11')]);router['delete'](_0x27a0('0xb'),auth[_0x27a0('0xc')](),controller[_0x27a0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 12a364b..c07a5eb 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 _0xe5a6=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x360dba,_0x44726b){var _0x339374=function(_0x37e995){while(--_0x37e995){_0x360dba['push'](_0x360dba['shift']());}};_0x339374(++_0x44726b);}(_0xe5a6,0x104));var _0x6e5a=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xe5a6[_0x3ba924];return _0x4cc1df;};'use strict';var moment=require(_0x6e5a('0x0'));var Sequelize=require(_0x6e5a('0x1'));module[_0x6e5a('0x2')]={'phone':{'type':Sequelize[_0x6e5a('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6e5a('0x4')],'unique':_0x6e5a('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x6e5a('0x5')},'VoiceQueueId':{'type':Sequelize[_0x6e5a('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xfa45=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x341765,_0x46ac8a){var _0x14b7a0=function(_0x4de69c){while(--_0x4de69c){_0x341765['push'](_0x341765['shift']());}};_0x14b7a0(++_0x46ac8a);}(_0xfa45,0x11b));var _0x5fa4=function(_0x33aed8,_0x5361f8){_0x33aed8=_0x33aed8-0x0;var _0x32c974=_0xfa45[_0x33aed8];return _0x32c974;};'use strict';var moment=require(_0x5fa4('0x0'));var Sequelize=require(_0x5fa4('0x1'));module[_0x5fa4('0x2')]={'phone':{'type':Sequelize[_0x5fa4('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5fa4('0x4')],'unique':_0x5fa4('0x5')},'ListId':{'type':Sequelize[_0x5fa4('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x5fa4('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2598c2c..c457680 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 _0x7ea9=['length','includeAll','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params'];(function(_0x175374,_0x3c2440){var _0x4e1f61=function(_0x23e306){while(--_0x23e306){_0x175374['push'](_0x175374['shift']());}};_0x4e1f61(++_0x3c2440);}(_0x7ea9,0xec));var _0x97ea=function(_0x4917bc,_0x39a348){_0x4917bc=_0x4917bc-0x0;var _0x4196c9=_0x7ea9[_0x4917bc];return _0x4196c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97ea('0x0'));var zipdir=require(_0x97ea('0x1'));var jsonpatch=require(_0x97ea('0x2'));var rp=require(_0x97ea('0x3'));var moment=require(_0x97ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x97ea('0x5'));var util=require(_0x97ea('0x6'));var path=require(_0x97ea('0x7'));var sox=require('sox');var csv=require(_0x97ea('0x8'));var ejs=require(_0x97ea('0x9'));var fs=require('fs');var fs_extra=require(_0x97ea('0xa'));var _=require(_0x97ea('0xb'));var squel=require('squel');var crypto=require(_0x97ea('0xc'));var jsforce=require(_0x97ea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x97ea('0x8'));var querystring=require('querystring');var Papa=require(_0x97ea('0xe'));var Redis=require('ioredis');var authService=require(_0x97ea('0xf'));var qs=require(_0x97ea('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97ea('0x11'));var logger=require(_0x97ea('0x12'))(_0x97ea('0x13'));var utils=require(_0x97ea('0x14'));var config=require(_0x97ea('0x15'));var licenseUtil=require(_0x97ea('0x16'));var db=require(_0x97ea('0x17'))['db'];function respondWithStatusCode(_0xc9d2a5,_0x35831b){_0x35831b=_0x35831b||0xcc;return function(_0x18629c){if(_0x18629c){return _0xc9d2a5['sendStatus'](_0x35831b);}return _0xc9d2a5[_0x97ea('0x18')](_0x35831b)[_0x97ea('0x19')]();};}function respondWithResult(_0x514608,_0x2a5d6e){_0x2a5d6e=_0x2a5d6e||0xc8;return function(_0x2879fd){if(_0x2879fd){return _0x514608[_0x97ea('0x18')](_0x2a5d6e)['json'](_0x2879fd);}};}function respondWithFilteredResult(_0x1db904,_0x47727a){return function(_0x5df49d){if(_0x5df49d){var _0x68b624=typeof _0x47727a['offset']===_0x97ea('0x1a')&&typeof _0x47727a[_0x97ea('0x1b')]===_0x97ea('0x1a');var _0x391664=_0x5df49d[_0x97ea('0x1c')];var _0x2e9f07=_0x68b624?0x0:_0x47727a[_0x97ea('0x1d')];var _0x59f558=_0x68b624?_0x5df49d[_0x97ea('0x1c')]:_0x47727a[_0x97ea('0x1d')]+_0x47727a[_0x97ea('0x1b')];var _0x28149a;if(_0x59f558>=_0x391664){_0x59f558=_0x391664;_0x28149a=0xc8;}else{_0x28149a=0xce;}_0x1db904[_0x97ea('0x18')](_0x28149a);return _0x1db904[_0x97ea('0x1e')](_0x97ea('0x1f'),_0x2e9f07+'-'+_0x59f558+'/'+_0x391664)[_0x97ea('0x20')](_0x5df49d);}return null;};}function patchUpdates(_0x10c346){return function(_0x2a7107){try{jsonpatch[_0x97ea('0x21')](_0x2a7107,_0x10c346,!![]);}catch(_0x3c0c42){return BPromise['reject'](_0x3c0c42);}return _0x2a7107[_0x97ea('0x22')]();};}function saveUpdates(_0x2618b7,_0x54479f){return function(_0x10a3cf){if(_0x10a3cf){return _0x10a3cf[_0x97ea('0x23')](_0x2618b7)['then'](function(_0x5a7e85){return _0x5a7e85;});}return null;};}function removeEntity(_0x22e81e,_0x2690ba){return function(_0x22a8e0){if(_0x22a8e0){return _0x22a8e0[_0x97ea('0x24')]()[_0x97ea('0x25')](function(){_0x22e81e['status'](0xcc)[_0x97ea('0x19')]();});}};}function handleEntityNotFound(_0x29e9e,_0x55bc91){return function(_0x55da9e){if(!_0x55da9e){_0x29e9e[_0x97ea('0x26')](0x194);}return _0x55da9e;};}function handleError(_0x2e82d9,_0x44fa98){_0x44fa98=_0x44fa98||0x1f4;return function(_0x2c69aa){logger[_0x97ea('0x27')](_0x2c69aa[_0x97ea('0x28')]);if(_0x2c69aa[_0x97ea('0x29')]){delete _0x2c69aa[_0x97ea('0x29')];}_0x2e82d9[_0x97ea('0x18')](_0x44fa98)[_0x97ea('0x2a')](_0x2c69aa);};}exports[_0x97ea('0x2b')]=function(_0x1d1a15,_0x8dfdd9){var _0x57dc1e={},_0x334464={},_0x31615e={'count':0x0,'rows':[]};var _0x56c2a6=_['map'](db[_0x97ea('0x2c')][_0x97ea('0x2d')],function(_0x41af05){return{'name':_0x41af05[_0x97ea('0x2e')],'type':_0x41af05[_0x97ea('0x2f')][_0x97ea('0x30')]};});_0x334464[_0x97ea('0x31')]=_[_0x97ea('0x32')](_0x56c2a6,_0x97ea('0x29'));_0x334464[_0x97ea('0x33')]=_[_0x97ea('0x34')](_0x1d1a15[_0x97ea('0x33')]);_0x334464[_0x97ea('0x35')]=_[_0x97ea('0x36')](_0x334464[_0x97ea('0x31')],_0x334464[_0x97ea('0x33')]);_0x57dc1e['attributes']=_[_0x97ea('0x36')](_0x334464[_0x97ea('0x31')],qs['fields'](_0x1d1a15[_0x97ea('0x33')][_0x97ea('0x37')]));_0x57dc1e[_0x97ea('0x38')]=_0x57dc1e[_0x97ea('0x38')]['length']?_0x57dc1e['attributes']:_0x334464[_0x97ea('0x31')];if(!_0x1d1a15[_0x97ea('0x33')][_0x97ea('0x39')](_0x97ea('0x3a'))){_0x57dc1e[_0x97ea('0x1b')]=qs[_0x97ea('0x1b')](_0x1d1a15['query'][_0x97ea('0x1b')]);_0x57dc1e[_0x97ea('0x1d')]=qs['offset'](_0x1d1a15[_0x97ea('0x33')][_0x97ea('0x1d')]);}_0x57dc1e[_0x97ea('0x3b')]=qs['sort'](_0x1d1a15[_0x97ea('0x33')][_0x97ea('0x3c')]);_0x57dc1e[_0x97ea('0x3d')]=qs['filters'](_['pick'](_0x1d1a15[_0x97ea('0x33')],_0x334464[_0x97ea('0x35')]),_0x56c2a6);if(_0x1d1a15[_0x97ea('0x33')][_0x97ea('0x3e')]){_0x57dc1e['where']=_[_0x97ea('0x3f')](_0x57dc1e[_0x97ea('0x3d')],{'$or':_[_0x97ea('0x32')](_0x56c2a6,function(_0x1fe0e5){if(_0x1fe0e5[_0x97ea('0x2f')]!==_0x97ea('0x40')){var _0x3026a5={};_0x3026a5[_0x1fe0e5[_0x97ea('0x29')]]={'$like':'%'+_0x1d1a15[_0x97ea('0x33')]['filter']+'%'};return _0x3026a5;}})});}_0x57dc1e=_[_0x97ea('0x3f')]({},_0x57dc1e,_0x1d1a15[_0x97ea('0x41')]);var _0x1339b7={'where':_0x57dc1e[_0x97ea('0x3d')]};return db[_0x97ea('0x2c')][_0x97ea('0x1c')](_0x1339b7)[_0x97ea('0x25')](function(_0x5eb1be){_0x31615e[_0x97ea('0x1c')]=_0x5eb1be;if(_0x1d1a15[_0x97ea('0x33')]['includeAll']){_0x57dc1e[_0x97ea('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x97ea('0x43')](_0x57dc1e);})[_0x97ea('0x25')](function(_0x155571){_0x31615e[_0x97ea('0x44')]=_0x155571;return _0x31615e;})[_0x97ea('0x25')](respondWithFilteredResult(_0x8dfdd9,_0x57dc1e))[_0x97ea('0x45')](handleError(_0x8dfdd9,null));};exports[_0x97ea('0x46')]=function(_0x37426e,_0x458b24){var _0x37e802={'raw':!![],'where':{'id':_0x37426e[_0x97ea('0x47')]['id']}},_0x378e38={};_0x378e38[_0x97ea('0x31')]=_[_0x97ea('0x34')](db[_0x97ea('0x2c')][_0x97ea('0x2d')]);_0x378e38['query']=_[_0x97ea('0x34')](_0x37426e['query']);_0x378e38['filters']=_[_0x97ea('0x36')](_0x378e38[_0x97ea('0x31')],_0x378e38[_0x97ea('0x33')]);_0x37e802[_0x97ea('0x38')]=_[_0x97ea('0x36')](_0x378e38[_0x97ea('0x31')],qs[_0x97ea('0x37')](_0x37426e[_0x97ea('0x33')][_0x97ea('0x37')]));_0x37e802[_0x97ea('0x38')]=_0x37e802['attributes'][_0x97ea('0x48')]?_0x37e802[_0x97ea('0x38')]:_0x378e38[_0x97ea('0x31')];if(_0x37426e[_0x97ea('0x33')][_0x97ea('0x49')]){_0x37e802[_0x97ea('0x42')]=[{'all':!![]}];}_0x37e802=_[_0x97ea('0x3f')]({},_0x37e802,_0x37426e[_0x97ea('0x41')]);return db['CmHopperBlack'][_0x97ea('0x4a')](_0x37e802)[_0x97ea('0x25')](handleEntityNotFound(_0x458b24,null))[_0x97ea('0x25')](respondWithResult(_0x458b24,null))[_0x97ea('0x45')](handleError(_0x458b24,null));};exports[_0x97ea('0x23')]=function(_0x38ee7d,_0x5544da){if(_0x38ee7d[_0x97ea('0x4b')]['id']){delete _0x38ee7d[_0x97ea('0x4b')]['id'];}return db[_0x97ea('0x2c')][_0x97ea('0x4a')]({'where':{'id':_0x38ee7d[_0x97ea('0x47')]['id']}})[_0x97ea('0x25')](handleEntityNotFound(_0x5544da,null))['then'](saveUpdates(_0x38ee7d[_0x97ea('0x4b')],null))[_0x97ea('0x25')](respondWithResult(_0x5544da,null))[_0x97ea('0x45')](handleError(_0x5544da,null));};exports[_0x97ea('0x24')]=function(_0x2ad321,_0x5dd908){return db['CmHopperBlack'][_0x97ea('0x4a')]({'where':{'id':_0x2ad321['params']['id']}})[_0x97ea('0x25')](handleEntityNotFound(_0x5dd908,null))[_0x97ea('0x25')](removeEntity(_0x5dd908,null))[_0x97ea('0x45')](handleError(_0x5dd908,null));};exports[_0x97ea('0x4c')]=function(_0x3dcd26,_0x131ac9){return db[_0x97ea('0x2c')]['describe']()[_0x97ea('0x25')](respondWithResult(_0x131ac9,null))[_0x97ea('0x45')](handleError(_0x131ac9,null));}; \ No newline at end of file +var _0xc3a1=['body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','send','index','map','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','CmHopperBlack','includeAll','include','rows','catch','show','params','keys','rawAttributes'];(function(_0xac6f8,_0x31fbbc){var _0x1e193f=function(_0x53b2a9){while(--_0x53b2a9){_0xac6f8['push'](_0xac6f8['shift']());}};_0x1e193f(++_0x31fbbc);}(_0xc3a1,0xd9));var _0x1c3a=function(_0x36e2fb,_0x1b53ba){_0x36e2fb=_0x36e2fb-0x0;var _0x3fb405=_0xc3a1[_0x36e2fb];return _0x3fb405;};'use strict';var emlformat=require(_0x1c3a('0x0'));var rimraf=require(_0x1c3a('0x1'));var zipdir=require(_0x1c3a('0x2'));var jsonpatch=require(_0x1c3a('0x3'));var rp=require(_0x1c3a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1c3a('0x5'));var path=require('path');var sox=require(_0x1c3a('0x6'));var csv=require(_0x1c3a('0x7'));var ejs=require(_0x1c3a('0x8'));var fs=require('fs');var fs_extra=require(_0x1c3a('0x9'));var _=require('lodash');var squel=require(_0x1c3a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1c3a('0xb'));var toCsv=require(_0x1c3a('0x7'));var querystring=require('querystring');var Papa=require(_0x1c3a('0xc'));var Redis=require(_0x1c3a('0xd'));var authService=require(_0x1c3a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1c3a('0xf'));var hardwareService=require(_0x1c3a('0x10'));var logger=require(_0x1c3a('0x11'))('api');var utils=require(_0x1c3a('0x12'));var config=require(_0x1c3a('0x13'));var licenseUtil=require(_0x1c3a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48dbf6,_0x1ef107){_0x1ef107=_0x1ef107||0xcc;return function(_0x4a1380){if(_0x4a1380){return _0x48dbf6[_0x1c3a('0x15')](_0x1ef107);}return _0x48dbf6[_0x1c3a('0x16')](_0x1ef107)[_0x1c3a('0x17')]();};}function respondWithResult(_0x4886f8,_0x173635){_0x173635=_0x173635||0xc8;return function(_0x22b7cc){if(_0x22b7cc){return _0x4886f8['status'](_0x173635)[_0x1c3a('0x18')](_0x22b7cc);}};}function respondWithFilteredResult(_0x47cd9b,_0xad2586){return function(_0xda7bb9){if(_0xda7bb9){var _0xd1dc85=typeof _0xad2586[_0x1c3a('0x19')]===_0x1c3a('0x1a')&&typeof _0xad2586[_0x1c3a('0x1b')]===_0x1c3a('0x1a');var _0x481161=_0xda7bb9[_0x1c3a('0x1c')];var _0x166dd6=_0xd1dc85?0x0:_0xad2586[_0x1c3a('0x19')];var _0x3a7b6a=_0xd1dc85?_0xda7bb9['count']:_0xad2586['offset']+_0xad2586['limit'];var _0xd72f01;if(_0x3a7b6a>=_0x481161){_0x3a7b6a=_0x481161;_0xd72f01=0xc8;}else{_0xd72f01=0xce;}_0x47cd9b[_0x1c3a('0x16')](_0xd72f01);return _0x47cd9b[_0x1c3a('0x1d')]('Content-Range',_0x166dd6+'-'+_0x3a7b6a+'/'+_0x481161)[_0x1c3a('0x18')](_0xda7bb9);}return null;};}function patchUpdates(_0x52e64f){return function(_0x127b50){try{jsonpatch['apply'](_0x127b50,_0x52e64f,!![]);}catch(_0xa57fc3){return BPromise[_0x1c3a('0x1e')](_0xa57fc3);}return _0x127b50[_0x1c3a('0x1f')]();};}function saveUpdates(_0x25bcad,_0x404bcc){return function(_0x30bd95){if(_0x30bd95){return _0x30bd95[_0x1c3a('0x20')](_0x25bcad)[_0x1c3a('0x21')](function(_0x537ace){return _0x537ace;});}return null;};}function removeEntity(_0x26cb4e,_0x991d72){return function(_0x193ffd){if(_0x193ffd){return _0x193ffd['destroy']()[_0x1c3a('0x21')](function(){_0x26cb4e[_0x1c3a('0x16')](0xcc)[_0x1c3a('0x17')]();});}};}function handleEntityNotFound(_0x2d2b54,_0x38211b){return function(_0x181a2e){if(!_0x181a2e){_0x2d2b54[_0x1c3a('0x15')](0x194);}return _0x181a2e;};}function handleError(_0x2645b5,_0x4f8dfb){_0x4f8dfb=_0x4f8dfb||0x1f4;return function(_0xe475ae){logger[_0x1c3a('0x22')](_0xe475ae['stack']);if(_0xe475ae[_0x1c3a('0x23')]){delete _0xe475ae[_0x1c3a('0x23')];}_0x2645b5[_0x1c3a('0x16')](_0x4f8dfb)[_0x1c3a('0x24')](_0xe475ae);};}exports[_0x1c3a('0x25')]=function(_0x37f535,_0x269fa8){var _0x524803={},_0x533451={},_0x49e87d={'count':0x0,'rows':[]};var _0x14f38c=_[_0x1c3a('0x26')](db['CmHopperBlack']['rawAttributes'],function(_0x5a7665){return{'name':_0x5a7665[_0x1c3a('0x27')],'type':_0x5a7665[_0x1c3a('0x28')][_0x1c3a('0x29')]};});_0x533451['model']=_[_0x1c3a('0x26')](_0x14f38c,_0x1c3a('0x23'));_0x533451[_0x1c3a('0x2a')]=_['keys'](_0x37f535[_0x1c3a('0x2a')]);_0x533451[_0x1c3a('0x2b')]=_[_0x1c3a('0x2c')](_0x533451[_0x1c3a('0x2d')],_0x533451['query']);_0x524803['attributes']=_[_0x1c3a('0x2c')](_0x533451[_0x1c3a('0x2d')],qs['fields'](_0x37f535['query'][_0x1c3a('0x2e')]));_0x524803[_0x1c3a('0x2f')]=_0x524803['attributes'][_0x1c3a('0x30')]?_0x524803['attributes']:_0x533451[_0x1c3a('0x2d')];if(!_0x37f535[_0x1c3a('0x2a')][_0x1c3a('0x31')](_0x1c3a('0x32'))){_0x524803[_0x1c3a('0x1b')]=qs[_0x1c3a('0x1b')](_0x37f535[_0x1c3a('0x2a')]['limit']);_0x524803[_0x1c3a('0x19')]=qs['offset'](_0x37f535[_0x1c3a('0x2a')][_0x1c3a('0x19')]);}_0x524803[_0x1c3a('0x33')]=qs['sort'](_0x37f535[_0x1c3a('0x2a')][_0x1c3a('0x34')]);_0x524803['where']=qs['filters'](_[_0x1c3a('0x35')](_0x37f535[_0x1c3a('0x2a')],_0x533451[_0x1c3a('0x2b')]),_0x14f38c);if(_0x37f535['query'][_0x1c3a('0x36')]){_0x524803['where']=_[_0x1c3a('0x37')](_0x524803[_0x1c3a('0x38')],{'$or':_[_0x1c3a('0x26')](_0x14f38c,function(_0xb490c4){if(_0xb490c4['type']!==_0x1c3a('0x39')){var _0x4cc3c6={};_0x4cc3c6[_0xb490c4[_0x1c3a('0x23')]]={'$like':'%'+_0x37f535[_0x1c3a('0x2a')]['filter']+'%'};return _0x4cc3c6;}})});}_0x524803=_[_0x1c3a('0x37')]({},_0x524803,_0x37f535['options']);var _0x1ee740={'where':_0x524803['where']};return db[_0x1c3a('0x3a')][_0x1c3a('0x1c')](_0x1ee740)[_0x1c3a('0x21')](function(_0x58f3c6){_0x49e87d[_0x1c3a('0x1c')]=_0x58f3c6;if(_0x37f535[_0x1c3a('0x2a')][_0x1c3a('0x3b')]){_0x524803[_0x1c3a('0x3c')]=[{'all':!![]}];}return db[_0x1c3a('0x3a')]['findAll'](_0x524803);})[_0x1c3a('0x21')](function(_0xe44f15){_0x49e87d[_0x1c3a('0x3d')]=_0xe44f15;return _0x49e87d;})[_0x1c3a('0x21')](respondWithFilteredResult(_0x269fa8,_0x524803))[_0x1c3a('0x3e')](handleError(_0x269fa8,null));};exports[_0x1c3a('0x3f')]=function(_0x3dae16,_0x5af911){var _0x22ab3f={'raw':!![],'where':{'id':_0x3dae16[_0x1c3a('0x40')]['id']}},_0x5f1ab7={};_0x5f1ab7['model']=_[_0x1c3a('0x41')](db['CmHopperBlack'][_0x1c3a('0x42')]);_0x5f1ab7['query']=_['keys'](_0x3dae16[_0x1c3a('0x2a')]);_0x5f1ab7[_0x1c3a('0x2b')]=_[_0x1c3a('0x2c')](_0x5f1ab7[_0x1c3a('0x2d')],_0x5f1ab7[_0x1c3a('0x2a')]);_0x22ab3f['attributes']=_[_0x1c3a('0x2c')](_0x5f1ab7['model'],qs[_0x1c3a('0x2e')](_0x3dae16[_0x1c3a('0x2a')][_0x1c3a('0x2e')]));_0x22ab3f['attributes']=_0x22ab3f[_0x1c3a('0x2f')][_0x1c3a('0x30')]?_0x22ab3f[_0x1c3a('0x2f')]:_0x5f1ab7[_0x1c3a('0x2d')];if(_0x3dae16[_0x1c3a('0x2a')]['includeAll']){_0x22ab3f[_0x1c3a('0x3c')]=[{'all':!![]}];}_0x22ab3f=_['merge']({},_0x22ab3f,_0x3dae16['options']);return db['CmHopperBlack']['find'](_0x22ab3f)[_0x1c3a('0x21')](handleEntityNotFound(_0x5af911,null))[_0x1c3a('0x21')](respondWithResult(_0x5af911,null))[_0x1c3a('0x3e')](handleError(_0x5af911,null));};exports['update']=function(_0x498782,_0x4e5660){if(_0x498782[_0x1c3a('0x43')]['id']){delete _0x498782[_0x1c3a('0x43')]['id'];}return db[_0x1c3a('0x3a')][_0x1c3a('0x44')]({'where':{'id':_0x498782[_0x1c3a('0x40')]['id']}})[_0x1c3a('0x21')](handleEntityNotFound(_0x4e5660,null))['then'](saveUpdates(_0x498782[_0x1c3a('0x43')],null))[_0x1c3a('0x21')](respondWithResult(_0x4e5660,null))['catch'](handleError(_0x4e5660,null));};exports[_0x1c3a('0x45')]=function(_0x11a770,_0x4914d0){return db['CmHopperBlack'][_0x1c3a('0x44')]({'where':{'id':_0x11a770[_0x1c3a('0x40')]['id']}})[_0x1c3a('0x21')](handleEntityNotFound(_0x4914d0,null))[_0x1c3a('0x21')](removeEntity(_0x4914d0,null))['catch'](handleError(_0x4914d0,null));};exports[_0x1c3a('0x46')]=function(_0x4fb4cc,_0x9e1871){return db['CmHopperBlack'][_0x1c3a('0x46')]()[_0x1c3a('0x21')](respondWithResult(_0x9e1871,null))[_0x1c3a('0x3e')](handleError(_0x9e1871,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 4b11184..dbbfc22 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 _0x27df=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes'];(function(_0x3d0aaf,_0x4c1810){var _0x3c9569=function(_0x5428f1){while(--_0x5428f1){_0x3d0aaf['push'](_0x3d0aaf['shift']());}};_0x3c9569(++_0x4c1810);}(_0x27df,0x1a8));var _0xf27d=function(_0x3a92e5,_0x387d8e){_0x3a92e5=_0x3a92e5-0x0;var _0x11b991=_0x27df[_0x3a92e5];return _0x11b991;};'use strict';var _=require(_0xf27d('0x0'));var util=require(_0xf27d('0x1'));var logger=require(_0xf27d('0x2'))(_0xf27d('0x3'));var moment=require(_0xf27d('0x4'));var BPromise=require(_0xf27d('0x5'));var rp=require(_0xf27d('0x6'));var fs=require('fs');var path=require(_0xf27d('0x7'));var rimraf=require(_0xf27d('0x8'));var config=require('../../config/environment');var attributes=require(_0xf27d('0x9'));module[_0xf27d('0xa')]=function(_0x2c328a,_0x2e17c6){return _0x2c328a[_0xf27d('0xb')](_0xf27d('0xc'),attributes,{'tableName':_0xf27d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87f7=['../../config/logger','api','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','lodash'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x87f7,0xef));var _0x787f=function(_0x4deeb4,_0x52ce5d){_0x4deeb4=_0x4deeb4-0x0;var _0x319d28=_0x87f7[_0x4deeb4];return _0x319d28;};'use strict';var _=require(_0x787f('0x0'));var util=require('util');var logger=require(_0x787f('0x1'))(_0x787f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x787f('0x3'));var rimraf=require(_0x787f('0x4'));var config=require(_0x787f('0x5'));var attributes=require(_0x787f('0x6'));module[_0x787f('0x7')]=function(_0x26561c,_0x1dc1be){return _0x26561c['define']('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 2d35806..c5dbd38 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 _0x0ded=['where','attributes','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CmHopperBlack','findAll','options','raw'];(function(_0xb4a678,_0x19f787){var _0x271c04=function(_0x207648){while(--_0x207648){_0xb4a678['push'](_0xb4a678['shift']());}};_0x271c04(++_0x19f787);}(_0x0ded,0x7b));var _0xd0de=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x0ded[_0x5de532];return _0x4e9192;};'use strict';var _=require(_0xd0de('0x0'));var util=require(_0xd0de('0x1'));var moment=require(_0xd0de('0x2'));var BPromise=require('bluebird');var rs=require(_0xd0de('0x3'));var fs=require('fs');var Redis=require(_0xd0de('0x4'));var db=require(_0xd0de('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0de('0x6'))(_0xd0de('0x7'));var config=require('../../config/environment');var jayson=require(_0xd0de('0x8'));var client=jayson['client'][_0xd0de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5211ba,_0x64843e,_0x38221f){return new BPromise(function(_0x399419,_0x142bad){return client['request'](_0x5211ba,_0x38221f)[_0xd0de('0xa')](function(_0x1a5e85){logger['info'](_0xd0de('0xb'),_0x64843e,_0xd0de('0xc'));logger[_0xd0de('0xd')](_0xd0de('0xe'),_0x64843e,_0xd0de('0xc'),JSON[_0xd0de('0xf')](_0x1a5e85));if(_0x1a5e85[_0xd0de('0x10')]){if(_0x1a5e85[_0xd0de('0x10')]['code']===0x1f4){logger[_0xd0de('0x10')](_0xd0de('0xb'),_0x64843e,_0x1a5e85[_0xd0de('0x10')][_0xd0de('0x11')]);return _0x142bad(_0x1a5e85[_0xd0de('0x10')]['message']);}logger[_0xd0de('0x10')](_0xd0de('0xb'),_0x64843e,_0x1a5e85[_0xd0de('0x10')][_0xd0de('0x11')]);return _0x399419(_0x1a5e85[_0xd0de('0x10')]['message']);}else{logger[_0xd0de('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x64843e,_0xd0de('0xc'));_0x399419(_0x1a5e85[_0xd0de('0x13')][_0xd0de('0x11')]);}})[_0xd0de('0x14')](function(_0x8c5f2f){logger[_0xd0de('0x10')](_0xd0de('0xb'),_0x64843e,_0x8c5f2f);_0x142bad(_0x8c5f2f);});});}exports['GetCmHopperBlack']=function(_0x2cac3a){var _0x1d0286=this;return new Promise(function(_0x2fba4d,_0x526e86){return db[_0xd0de('0x15')][_0xd0de('0x16')]({'raw':_0x2cac3a[_0xd0de('0x17')]?_0x2cac3a[_0xd0de('0x17')][_0xd0de('0x18')]===undefined?!![]:![]:!![],'where':_0x2cac3a['options']?_0x2cac3a[_0xd0de('0x17')][_0xd0de('0x19')]||null:null,'attributes':_0x2cac3a['options']?_0x2cac3a[_0xd0de('0x17')][_0xd0de('0x1a')]||null:null,'limit':_0x2cac3a[_0xd0de('0x17')]?_0x2cac3a['options']['limit']||null:null,'include':_0x2cac3a[_0xd0de('0x17')]?_0x2cac3a[_0xd0de('0x17')][_0xd0de('0x1b')]?_[_0xd0de('0x1c')](_0x2cac3a[_0xd0de('0x17')][_0xd0de('0x1b')],function(_0xc58e71){return{'model':db[_0xc58e71['model']],'as':_0xc58e71['as'],'attributes':_0xc58e71[_0xd0de('0x1a')],'include':_0xc58e71[_0xd0de('0x1b')]?_[_0xd0de('0x1c')](_0xc58e71['include'],function(_0x366f9b){return{'model':db[_0x366f9b[_0xd0de('0x1d')]],'as':_0x366f9b['as'],'attributes':_0x366f9b[_0xd0de('0x1a')],'include':_0x366f9b[_0xd0de('0x1b')]?_[_0xd0de('0x1c')](_0x366f9b[_0xd0de('0x1b')],function(_0x306bc4){return{'model':db[_0x306bc4[_0xd0de('0x1d')]],'as':_0x306bc4['as'],'attributes':_0x306bc4[_0xd0de('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x483bc5){logger[_0xd0de('0x12')]('GetCmHopperBlack',_0x2cac3a);logger[_0xd0de('0xd')](_0xd0de('0x1e'),_0x2cac3a,JSON['stringify'](_0x483bc5));_0x2fba4d(_0x483bc5);})[_0xd0de('0x14')](function(_0x56e0fd){logger['error']('GetCmHopperBlack',_0x56e0fd[_0xd0de('0x11')],_0x2cac3a);_0x526e86(_0x1d0286[_0xd0de('0x10')](0x1f4,_0x56e0fd[_0xd0de('0x11')]));});});};exports[_0xd0de('0x1f')]=function(_0x802f76){var _0x5bcf39=this;return new Promise(function(_0xae4759,_0x138570){return db[_0xd0de('0x15')][_0xd0de('0x20')](_0x802f76[_0xd0de('0x21')],{'raw':_0x802f76[_0xd0de('0x17')]?_0x802f76[_0xd0de('0x17')][_0xd0de('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x802f76[_0xd0de('0x17')]?_0x802f76['options'][_0xd0de('0x19')]||null:null,'attributes':_0x802f76[_0xd0de('0x17')]?_0x802f76[_0xd0de('0x17')][_0xd0de('0x1a')]||null:null,'limit':_0x802f76['options']?_0x802f76[_0xd0de('0x17')][_0xd0de('0x22')]||null:null})[_0xd0de('0xa')](function(_0x280faa){logger[_0xd0de('0x12')](_0xd0de('0x1f'),_0x802f76);logger['debug']('UpdateCmHopperBlack',_0x802f76,JSON[_0xd0de('0xf')](_0x280faa));_0xae4759(_0x280faa);})['catch'](function(_0x25d3c8){logger[_0xd0de('0x10')](_0xd0de('0x1f'),_0x25d3c8[_0xd0de('0x11')],_0x802f76);_0x138570(_0x5bcf39[_0xd0de('0x10')](0x1f4,_0x25d3c8['message']));});});};exports[_0xd0de('0x23')]=function(_0x3f5ead){var _0xbb1ec1=this;return new Promise(function(_0xf823ce,_0xd738dc){return db['CmHopperBlack'][_0xd0de('0x24')]({'where':_0x3f5ead[_0xd0de('0x17')]?_0x3f5ead[_0xd0de('0x17')][_0xd0de('0x19')]||null:null})[_0xd0de('0xa')](function(_0x338a06){logger['info'](_0xd0de('0x23'),_0x3f5ead);logger[_0xd0de('0xd')](_0xd0de('0x23'),_0x3f5ead,JSON[_0xd0de('0xf')](_0x338a06));_0xf823ce(_0x338a06);})[_0xd0de('0x14')](function(_0x2441c9){logger[_0xd0de('0x10')](_0xd0de('0x23'),_0x2441c9[_0xd0de('0x11')],_0x3f5ead);_0xd738dc(_0xbb1ec1[_0xd0de('0x10')](0x1f4,_0x2441c9[_0xd0de('0x11')]));});});}; \ No newline at end of file +var _0xb265=['UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','map','include','attributes','model','debug','catch'];(function(_0x59233e,_0x5833dc){var _0xe06e55=function(_0x217ca3){while(--_0x217ca3){_0x59233e['push'](_0x59233e['shift']());}};_0xe06e55(++_0x5833dc);}(_0xb265,0x10f));var _0x5b26=function(_0x3897ac,_0x26b799){_0x3897ac=_0x3897ac-0x0;var _0x54569a=_0xb265[_0x3897ac];return _0x54569a;};'use strict';var _=require(_0x5b26('0x0'));var util=require(_0x5b26('0x1'));var moment=require(_0x5b26('0x2'));var BPromise=require(_0x5b26('0x3'));var rs=require(_0x5b26('0x4'));var fs=require('fs');var Redis=require(_0x5b26('0x5'));var db=require(_0x5b26('0x6'))['db'];var utils=require(_0x5b26('0x7'));var logger=require(_0x5b26('0x8'))(_0x5b26('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5b26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33cae0,_0x1cdbaf,_0x223f90){return new BPromise(function(_0x40f1b7,_0x297200){return client['request'](_0x33cae0,_0x223f90)[_0x5b26('0xb')](function(_0x49bca9){logger[_0x5b26('0xc')](_0x5b26('0xd'),_0x1cdbaf,_0x5b26('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x1cdbaf,_0x5b26('0xe'),JSON[_0x5b26('0xf')](_0x49bca9));if(_0x49bca9[_0x5b26('0x10')]){if(_0x49bca9[_0x5b26('0x10')][_0x5b26('0x11')]===0x1f4){logger[_0x5b26('0x10')](_0x5b26('0xd'),_0x1cdbaf,_0x49bca9[_0x5b26('0x10')]['message']);return _0x297200(_0x49bca9['error']['message']);}logger[_0x5b26('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x1cdbaf,_0x49bca9['error'][_0x5b26('0x12')]);return _0x40f1b7(_0x49bca9['error'][_0x5b26('0x12')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x1cdbaf,_0x5b26('0xe'));_0x40f1b7(_0x49bca9[_0x5b26('0x13')][_0x5b26('0x12')]);}})['catch'](function(_0x4c9132){logger['error'](_0x5b26('0xd'),_0x1cdbaf,_0x4c9132);_0x297200(_0x4c9132);});});}exports[_0x5b26('0x14')]=function(_0x59080d){var _0x417a14=this;return new Promise(function(_0x46e8e3,_0x2a3e78){return db[_0x5b26('0x15')][_0x5b26('0x16')]({'raw':_0x59080d[_0x5b26('0x17')]?_0x59080d[_0x5b26('0x17')][_0x5b26('0x18')]===undefined?!![]:![]:!![],'where':_0x59080d['options']?_0x59080d[_0x5b26('0x17')][_0x5b26('0x19')]||null:null,'attributes':_0x59080d[_0x5b26('0x17')]?_0x59080d[_0x5b26('0x17')]['attributes']||null:null,'limit':_0x59080d[_0x5b26('0x17')]?_0x59080d[_0x5b26('0x17')][_0x5b26('0x1a')]||null:null,'include':_0x59080d[_0x5b26('0x17')]?_0x59080d[_0x5b26('0x17')]['include']?_[_0x5b26('0x1b')](_0x59080d[_0x5b26('0x17')][_0x5b26('0x1c')],function(_0x53ef05){return{'model':db[_0x53ef05['model']],'as':_0x53ef05['as'],'attributes':_0x53ef05[_0x5b26('0x1d')],'include':_0x53ef05[_0x5b26('0x1c')]?_[_0x5b26('0x1b')](_0x53ef05[_0x5b26('0x1c')],function(_0x14e0cd){return{'model':db[_0x14e0cd[_0x5b26('0x1e')]],'as':_0x14e0cd['as'],'attributes':_0x14e0cd['attributes'],'include':_0x14e0cd[_0x5b26('0x1c')]?_[_0x5b26('0x1b')](_0x14e0cd['include'],function(_0x2eeabe){return{'model':db[_0x2eeabe[_0x5b26('0x1e')]],'as':_0x2eeabe['as'],'attributes':_0x2eeabe[_0x5b26('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5b26('0xb')](function(_0x4f7571){logger['info']('GetCmHopperBlack',_0x59080d);logger[_0x5b26('0x1f')](_0x5b26('0x14'),_0x59080d,JSON[_0x5b26('0xf')](_0x4f7571));_0x46e8e3(_0x4f7571);})[_0x5b26('0x20')](function(_0x3ac81b){logger[_0x5b26('0x10')](_0x5b26('0x14'),_0x3ac81b[_0x5b26('0x12')],_0x59080d);_0x2a3e78(_0x417a14['error'](0x1f4,_0x3ac81b[_0x5b26('0x12')]));});});};exports[_0x5b26('0x21')]=function(_0x897f9f){var _0x459111=this;return new Promise(function(_0x48ab1a,_0xe13f69){return db[_0x5b26('0x15')][_0x5b26('0x22')](_0x897f9f[_0x5b26('0x23')],{'raw':_0x897f9f[_0x5b26('0x17')]?_0x897f9f[_0x5b26('0x17')][_0x5b26('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x897f9f[_0x5b26('0x17')]?_0x897f9f[_0x5b26('0x17')]['where']||null:null,'attributes':_0x897f9f['options']?_0x897f9f[_0x5b26('0x17')][_0x5b26('0x1d')]||null:null,'limit':_0x897f9f['options']?_0x897f9f[_0x5b26('0x17')][_0x5b26('0x1a')]||null:null})[_0x5b26('0xb')](function(_0x4613f4){logger[_0x5b26('0xc')]('UpdateCmHopperBlack',_0x897f9f);logger[_0x5b26('0x1f')]('UpdateCmHopperBlack',_0x897f9f,JSON['stringify'](_0x4613f4));_0x48ab1a(_0x4613f4);})[_0x5b26('0x20')](function(_0x2f5d52){logger[_0x5b26('0x10')](_0x5b26('0x21'),_0x2f5d52[_0x5b26('0x12')],_0x897f9f);_0xe13f69(_0x459111[_0x5b26('0x10')](0x1f4,_0x2f5d52[_0x5b26('0x12')]));});});};exports[_0x5b26('0x24')]=function(_0x85541){var _0x1330dd=this;return new Promise(function(_0x1f0297,_0x52deb5){return db[_0x5b26('0x15')][_0x5b26('0x25')]({'where':_0x85541[_0x5b26('0x17')]?_0x85541['options']['where']||null:null})['then'](function(_0x323e05){logger[_0x5b26('0xc')](_0x5b26('0x24'),_0x85541);logger[_0x5b26('0x1f')]('DestroyCmHopperBlack',_0x85541,JSON[_0x5b26('0xf')](_0x323e05));_0x1f0297(_0x323e05);})[_0x5b26('0x20')](function(_0x2fe3c1){logger[_0x5b26('0x10')](_0x5b26('0x24'),_0x2fe3c1['message'],_0x85541);_0x52deb5(_0x1330dd[_0x5b26('0x10')](0x1f4,_0x2fe3c1['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 0014f44..7e6db1f 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 _0xa6b0=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','put'];(function(_0x21774b,_0x4a6d2b){var _0x4675b2=function(_0xca7eb3){while(--_0xca7eb3){_0x21774b['push'](_0x21774b['shift']());}};_0x4675b2(++_0x4a6d2b);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x4098b5,_0x53c9bb){_0x4098b5=_0x4098b5-0x0;var _0x21a8b6=_0xa6b0[_0x4098b5];return _0x21a8b6;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0a6b('0xe')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);module[_0x0a6b('0x12')]=router; \ No newline at end of file +var _0xed1c=['describe','/:id','show','put','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x52e0e7,_0x1080d1){var _0xacb536=function(_0x35ed8c){while(--_0x35ed8c){_0x52e0e7['push'](_0x52e0e7['shift']());}};_0xacb536(++_0x1080d1);}(_0xed1c,0xe4));var _0xced1=function(_0x2e155d,_0x41186a){_0x2e155d=_0x2e155d-0x0;var _0x1a1df1=_0xed1c[_0x2e155d];return _0x1a1df1;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/:id',auth[_0xced1('0x7')](),controller['update']);router[_0xced1('0xe')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);module[_0xced1('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index b6d0214..d24e16d 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 _0xb91e=['BOOLEAN','sequelize','moment','STRING','INTEGER','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x5b329d,_0x32716a){var _0x3369fc=function(_0x1ccbea){while(--_0x1ccbea){_0x5b329d['push'](_0x5b329d['shift']());}};_0x3369fc(++_0x32716a);}(_0xb91e,0xb5));var _0xeb91=function(_0x103dbf,_0x1eb9f1){_0x103dbf=_0x103dbf-0x0;var _0x41906c=_0xb91e[_0x103dbf];return _0x41906c;};'use strict';var Sequelize=require(_0xeb91('0x0'));var moment=require(_0xeb91('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xeb91('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xeb91('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xeb91('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xeb91('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xeb91('0x2')]},'starttime':{'type':Sequelize[_0xeb91('0x4')]},'responsetime':{'type':Sequelize[_0xeb91('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xeb91('0x4')]},'endtime':{'type':Sequelize[_0xeb91('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xeb91('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xeb91('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xeb91('0x2')]},'campaign':{'type':Sequelize[_0xeb91('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xeb91('0x2')]},'disposition':{'type':Sequelize[_0xeb91('0x2')]},'secondDisposition':{'type':Sequelize[_0xeb91('0x2')]},'thirdDisposition':{'type':Sequelize[_0xeb91('0x2')]},'dispositionat':{'type':Sequelize[_0xeb91('0x4')],'set':function(_0x23ef05){var _0x4af950=this[_0xeb91('0x5')](_0xeb91('0x6'));if(_0x4af950&&_0x23ef05){this[_0xeb91('0x7')](_0xeb91('0x8'),moment(_0x23ef05)[_0xeb91('0x9')](moment(_0x4af950),_0xeb91('0xa')));}}},'amd':{'type':Sequelize[_0xeb91('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xeb91('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xeb91('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xeb91('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xeb91('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xeb91('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xeb91('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xeb91('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xeb91('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xeb91('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeb91('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeb91('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xeb91('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x06a6=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds'];(function(_0x5b65b9,_0x499fa0){var _0x2fd6bd=function(_0x18c17f){while(--_0x18c17f){_0x5b65b9['push'](_0x5b65b9['shift']());}};_0x2fd6bd(++_0x499fa0);}(_0x06a6,0x1e5));var _0x606a=function(_0x16d8d9,_0x2be9a4){_0x16d8d9=_0x16d8d9-0x0;var _0x274705=_0x06a6[_0x16d8d9];return _0x274705;};'use strict';var Sequelize=require(_0x606a('0x0'));var moment=require('moment');module[_0x606a('0x1')]={'state':{'type':Sequelize[_0x606a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x606a('0x3')]},'scheduledat':{'type':Sequelize[_0x606a('0x4')]},'countbusyretry':{'type':Sequelize[_0x606a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x606a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x606a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x606a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x606a('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x606a('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x606a('0x3')]},'calleridname':{'type':Sequelize[_0x606a('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x606a('0x4')]},'droptime':{'type':Sequelize[_0x606a('0x4')]},'endtime':{'type':Sequelize[_0x606a('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x606a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x606a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x606a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x606a('0x3')]},'campaign':{'type':Sequelize[_0x606a('0x3')]},'campaigntype':{'type':Sequelize[_0x606a('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x606a('0x3')]},'disposition':{'type':Sequelize[_0x606a('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x606a('0x3')]},'dispositionat':{'type':Sequelize[_0x606a('0x4')],'set':function(_0x4f174c){var _0x994a86=this[_0x606a('0x5')](_0x606a('0x6'));if(_0x994a86&&_0x4f174c){this[_0x606a('0x7')]('followuptime',moment(_0x4f174c)[_0x606a('0x8')](moment(_0x994a86),_0x606a('0x9')));}}},'amd':{'type':Sequelize[_0x606a('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x606a('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x606a('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x606a('0x4')]},'deleted':{'type':Sequelize[_0x606a('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x606a('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x606a('0x2')],'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 bfa9428..9aaafbe 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 _0xc6ac=['key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','CmHopperFinal','rawAttributes','fieldName','type'];(function(_0x269767,_0x2457bf){var _0x19b075=function(_0x10abab){while(--_0x10abab){_0x269767['push'](_0x269767['shift']());}};_0x19b075(++_0x2457bf);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xc2dc45,_0x453824){_0xc2dc45=_0xc2dc45-0x0;var _0x2b931a=_0xc6ac[_0xc2dc45];return _0x2b931a;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':!![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['describe']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')]()[_0xcc6a('0x27')](respondWithResult(_0x47c999,null))[_0xcc6a('0x4b')](handleError(_0x47c999,null));};exports['update']=function(_0x1c3bb8,_0x5e7bab){if(_0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')]){delete _0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'uniqueid':_0x1c3bb8['params']['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5e7bab,null))[_0xcc6a('0x27')](saveUpdates(_0x1c3bb8[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x5e7bab,null))[_0xcc6a('0x4b')](handleError(_0x5e7bab,null));};exports[_0xcc6a('0x4f')]=function(_0x431684,_0x392805,_0x31987f){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x431684[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db['sequelize']['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal'](_0xcc6a('0x59')))),'abandonedContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})[_0xcc6a('0x27')](handleEntityNotFound(_0x392805,null))[_0xcc6a('0x27')](respondWithResult(_0x392805,null))[_0xcc6a('0x4b')](handleError(_0x392805,null));};exports[_0xcc6a('0x5d')]=function(_0x3e76d7,_0x42bbc7,_0x2ad9a6){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'CampaignId':_0x3e76d7[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x5e')))),_0xcc6a('0x5f')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x59')))),_0xcc6a('0x60')],[db[_0xcc6a('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x61')))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})['then'](handleEntityNotFound(_0x42bbc7,null))[_0xcc6a('0x27')](respondWithResult(_0x42bbc7,null))[_0xcc6a('0x4b')](handleError(_0x42bbc7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x72e53a,_0x5b61df,_0x3b4ce0){return db['VoiceQueue'][_0xcc6a('0x4a')]({'where':{'id':_0x72e53a[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5b61df,null))['then'](function(_0x3ce1eb){var _0x51390a;if(_0x3ce1eb){_0x51390a=squel[_0xcc6a('0x62')]()['into'](_0xcc6a('0x63'))[_0xcc6a('0x64')]([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'VoiceQueueId',_0xcc6a('0x69'),_0xcc6a('0x6a')],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),'phone')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'scheduledAt')['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(VoiceQueueId)',_0xcc6a('0x71'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x69'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'updatedAt')['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x72e53a['body'][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x65'))[_0xcc6a('0x79')]('cm_hopper')[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())['where'](_0xcc6a('0x7b')))[_0xcc6a('0x7c')](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0x51390a);}return[];})['then'](respondWithResult(_0x5b61df,null))['catch'](handleError(_0x5b61df,null));};exports[_0xcc6a('0x7d')]=function(_0x5be65b,_0xb42e9,_0x35a798){return db[_0xcc6a('0x7e')][_0xcc6a('0x4a')]({'where':{'id':_0x5be65b[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0xb42e9,null))[_0xcc6a('0x27')](function(_0x1746d8){var _0xc0d194;if(_0x1746d8){_0xc0d194=squel[_0xcc6a('0x62')]()[_0xcc6a('0x7f')](_0xcc6a('0x63'))['fromQuery']([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'CampaignId',_0xcc6a('0x69'),'updatedAt'],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),_0xcc6a('0x65'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x66'))['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(CampaignId)',_0xcc6a('0x80'))[_0xcc6a('0x6c')]('NOW()','createdAt')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x6a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))['where'](_0xcc6a('0x81'),_0x5be65b['params']['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x5be65b[_0xcc6a('0x4d')][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))['where'](_0xcc6a('0x78'),squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')]('phone')[_0xcc6a('0x79')](_0xcc6a('0x63'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id']['toString']())['where'](_0xcc6a('0x7b')))['group'](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0xc0d194);}return[];})[_0xcc6a('0x27')](respondWithResult(_0xb42e9,null))[_0xcc6a('0x4b')](handleError(_0xb42e9,null));};exports[_0xcc6a('0x82')]=function(_0x48b6e3,_0x10d731,_0x537e2b){return db['CmHopper'][_0xcc6a('0x83')]({'where':{'VoiceQueueId':_0x48b6e3['body'][_0xcc6a('0x71')],'CampaignId':_0x48b6e3[_0xcc6a('0x4d')]['CampaignId'],'ContactId':_0x48b6e3['body'][_0xcc6a('0x67')]}})['then'](handleEntityNotFound(_0x10d731,null))[_0xcc6a('0x27')](function(_0x3df510){if(_0x3df510){return _0x3df510;}return null;})[_0xcc6a('0x27')](respondWithResult(_0x10d731,null))[_0xcc6a('0x4b')](handleError(_0x10d731,null));}; \ No newline at end of file +var _0xfdbd=['status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','length','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','params','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','checkContactHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x586319,_0xf3ac9a){var _0x2127d2=function(_0x543805){while(--_0x543805){_0x586319['push'](_0x586319['shift']());}};_0x2127d2(++_0xf3ac9a);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2efe86,_0x4b6c3f){_0x2efe86=_0x2efe86-0x0;var _0x48e01c=_0xfdbd[_0x2efe86];return _0x48e01c;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':!![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['CmHopperFinal']['describe']()[_0xdfdb('0x26')](respondWithResult(_0x273477,null))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports[_0xdfdb('0x24')]=function(_0x4bbb88,_0x36149e){if(_0x4bbb88[_0xdfdb('0x4b')][_0xdfdb('0x4c')]){delete _0x4bbb88[_0xdfdb('0x4b')]['uniqueid'];}return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'uniqueid':_0x4bbb88['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x36149e,null))[_0xdfdb('0x26')](saveUpdates(_0x4bbb88[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x36149e,null))[_0xdfdb('0x49')](handleError(_0x36149e,null));};exports[_0xdfdb('0x4d')]=function(_0x17dfdb,_0x1f5b88,_0x1da7af){return db['CmHopperFinal'][_0xdfdb('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x17dfdb['params']['id']},'attributes':[[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x53')))),'noAnswerContacts'],[db[_0xdfdb('0x4e')]['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x54')))),_0xdfdb('0x55')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x56')))),_0xdfdb('0x57')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x58')))),_0xdfdb('0x59')],[db['sequelize']['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5b')))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')]['literal'](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x1f5b88,null))['then'](respondWithResult(_0x1f5b88,null))[_0xdfdb('0x49')](handleError(_0x1f5b88,null));};exports[_0xdfdb('0x5f')]=function(_0x349cf7,_0x2f69a8,_0x424212){return db[_0xdfdb('0x2d')][_0xdfdb('0x44')]({'raw':![],'where':{'CampaignId':_0x349cf7[_0xdfdb('0x60')]['id']},'attributes':[[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0xdfdb('0x61')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x54')))),'busyContacts'],[db['sequelize']['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xdfdb('0x57')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xdfdb('0x59')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x2f69a8,null))[_0xdfdb('0x26')](respondWithResult(_0x2f69a8,null))['catch'](handleError(_0x2f69a8,null));};exports[_0xdfdb('0x62')]=function(_0x198cfa,_0x2831d6,_0x45bfc0){return db[_0xdfdb('0x63')]['find']({'where':{'id':_0x198cfa[_0xdfdb('0x60')]['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x2831d6,null))[_0xdfdb('0x26')](function(_0x1a31b9){var _0x4999c4;if(_0x1a31b9){_0x4999c4=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')](_0xdfdb('0x66'))[_0xdfdb('0x67')]([_0xdfdb('0x68'),_0xdfdb('0x69'),_0xdfdb('0x6a'),_0xdfdb('0x6b'),_0xdfdb('0x6c'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel['select']()[_0xdfdb('0x6f')](_0xdfdb('0x70'),'phone')[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)','ContactId')[_0xdfdb('0x6f')](_0xdfdb('0x72'),_0xdfdb('0x6b'))[_0xdfdb('0x6f')](_0xdfdb('0x73'),_0xdfdb('0x6c'))[_0xdfdb('0x6f')]('NOW()',_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')]('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id'][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x77'),_0x198cfa[_0xdfdb('0x4b')]['state'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')]('phone')[_0xdfdb('0x74')](_0xdfdb('0x66'))['where']('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id']['toString']()))['where'](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x7c'),_0x198cfa['params']['id'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x7d')))[_0xdfdb('0x7e')](_0xdfdb('0x6a')))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x4999c4);}return[];})[_0xdfdb('0x26')](respondWithResult(_0x2831d6,null))[_0xdfdb('0x49')](handleError(_0x2831d6,null));};exports[_0xdfdb('0x7f')]=function(_0x1b6445,_0x36241c,_0x4c833f){return db['Campaign'][_0xdfdb('0x48')]({'where':{'id':_0x1b6445[_0xdfdb('0x60')]['id']}})['then'](handleEntityNotFound(_0x36241c,null))[_0xdfdb('0x26')](function(_0x50d5d4){var _0x158454;if(_0x50d5d4){_0x158454=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')]('cm_hopper')[_0xdfdb('0x67')](['phone','scheduledAt',_0xdfdb('0x6a'),'ListId',_0xdfdb('0x80'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x70'),_0xdfdb('0x68'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)',_0xdfdb('0x6a'))['field']('ANY_VALUE(ListId)','ListId')['field'](_0xdfdb('0x81'),_0xdfdb('0x80'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x77'),_0x1b6445[_0xdfdb('0x4b')][_0xdfdb('0x83')][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()['field'](_0xdfdb('0x68'))[_0xdfdb('0x74')](_0xdfdb('0x66'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']()))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')]('cm_hopper_final')[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x7d')))['group']('ContactId'))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x158454);}return[];})['then'](respondWithResult(_0x36241c,null))[_0xdfdb('0x49')](handleError(_0x36241c,null));};exports[_0xdfdb('0x84')]=function(_0x1f87d3,_0x1bc293,_0x36b01e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x1f87d3[_0xdfdb('0x4b')]['VoiceQueueId'],'CampaignId':_0x1f87d3[_0xdfdb('0x4b')][_0xdfdb('0x80')],'ContactId':_0x1f87d3[_0xdfdb('0x4b')]['ContactId']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x1bc293,null))[_0xdfdb('0x26')](function(_0x3e0208){if(_0x3e0208){return _0x3e0208;}return null;})[_0xdfdb('0x26')](respondWithResult(_0x1bc293,null))['catch'](handleError(_0x1bc293,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 64b0142..adb2fa2 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 _0x0002=['./cmHopperFinal.attributes','exports','CmHopperFinal','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x24c980,_0x44524c){var _0x491877=function(_0x2eb3fe){while(--_0x2eb3fe){_0x24c980['push'](_0x24c980['shift']());}};_0x491877(++_0x44524c);}(_0x0002,0x162));var _0x2000=function(_0x289bec,_0x4c19a2){_0x289bec=_0x289bec-0x0;var _0x5a2942=_0x0002[_0x289bec];return _0x5a2942;};'use strict';var _=require(_0x2000('0x0'));var util=require(_0x2000('0x1'));var logger=require(_0x2000('0x2'))(_0x2000('0x3'));var moment=require(_0x2000('0x4'));var BPromise=require(_0x2000('0x5'));var rp=require(_0x2000('0x6'));var fs=require('fs');var path=require(_0x2000('0x7'));var rimraf=require(_0x2000('0x8'));var config=require(_0x2000('0x9'));var attributes=require(_0x2000('0xa'));module[_0x2000('0xb')]=function(_0x52104e,_0x2d69a2){return _0x52104e['define'](_0x2000('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x2000('0xd'),'fields':[_0x2000('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x689f=['./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','../../config/environment'];(function(_0x3d01ec,_0x484744){var _0x134254=function(_0x33ee3e){while(--_0x33ee3e){_0x3d01ec['push'](_0x3d01ec['shift']());}};_0x134254(++_0x484744);}(_0x689f,0x1e6));var _0xf689=function(_0x505173,_0x26561a){_0x505173=_0x505173-0x0;var _0x28aaa6=_0x689f[_0x505173];return _0x28aaa6;};'use strict';var _=require(_0xf689('0x0'));var util=require('util');var logger=require(_0xf689('0x1'))(_0xf689('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf689('0x3'));var attributes=require(_0xf689('0x4'));module[_0xf689('0x5')]=function(_0xe40cf5,_0x2e987f){return _0xe40cf5[_0xf689('0x6')]('CmHopperFinal',attributes,{'tableName':_0xf689('0x7'),'paranoid':![],'indexes':[{'name':_0xf689('0x8'),'fields':[_0xf689('0x8')]},{'name':_0xf689('0x9'),'fields':[_0xf689('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 6c203a9..cb649c7 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(_0x53d7ed,_0x19aec7){var _0x522c9b=function(_0x4ddc68){while(--_0x4ddc68){_0x53d7ed['push'](_0x53d7ed['shift']());}};_0x522c9b(++_0x19aec7);}(_0xb10b,0x12a));var _0xbb10=function(_0x133968,_0x5ca58b){_0x133968=_0x133968-0x0;var _0x14a75a=_0xb10b[_0x133968];return _0x14a75a;};'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 _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(_0x364274,_0x19fce3){var _0xe7e89a=function(_0x32830f){while(--_0x32830f){_0x364274['push'](_0x364274['shift']());}};_0xe7e89a(++_0x19fce3);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ec65f,_0x871c26){_0x4ec65f=_0x4ec65f-0x0;var _0x5d1143=_0xb10b[_0x4ec65f];return _0x5d1143;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 1bafb8b..a3962ee 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 _0x7717=['put','update','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x7717,0x6f));var _0x7771=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7717[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7771('0x0'));var util=require(_0x7771('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7771('0x2'));var router=express[_0x7771('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7771('0x4'));var interaction=require(_0x7771('0x5'));var config=require(_0x7771('0x6'));var controller=require(_0x7771('0x7'));router['get']('/',auth[_0x7771('0x8')](),controller['index']);router[_0x7771('0x9')](_0x7771('0xa'),auth['isAuthenticated'](),controller[_0x7771('0xb')]);router[_0x7771('0x9')](_0x7771('0xc'),auth[_0x7771('0x8')](),controller[_0x7771('0xd')]);router[_0x7771('0x9')](_0x7771('0xe'),auth[_0x7771('0x8')](),controller[_0x7771('0xf')]);router['get'](_0x7771('0x10'),auth[_0x7771('0x8')](),controller[_0x7771('0x11')]);router[_0x7771('0x12')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x7771('0x13')]);router[_0x7771('0x12')](_0x7771('0x14'),auth[_0x7771('0x8')](),controller[_0x7771('0x15')]);router[_0x7771('0x12')](_0x7771('0x16'),auth[_0x7771('0x8')](),controller[_0x7771('0x17')]);router[_0x7771('0x18')](_0x7771('0xc'),auth['isAuthenticated'](),controller[_0x7771('0x19')]);module[_0x7771('0x1a')]=router; \ No newline at end of file +var _0x8be9=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x8be9,0x8f));var _0x98be=function(_0x40a0db,_0x9ff6f2){_0x40a0db=_0x40a0db-0x0;var _0x37c453=_0x8be9[_0x40a0db];return _0x37c453;};'use strict';var multer=require(_0x98be('0x0'));var util=require('util');var path=require(_0x98be('0x1'));var timeout=require(_0x98be('0x2'));var express=require(_0x98be('0x3'));var router=express[_0x98be('0x4')]();var fs_extra=require(_0x98be('0x5'));var auth=require(_0x98be('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x98be('0x7'));var controller=require('./cmHopperFinal.controller');router[_0x98be('0x8')]('/',auth[_0x98be('0x9')](),controller[_0x98be('0xa')]);router['get'](_0x98be('0xb'),auth[_0x98be('0x9')](),controller[_0x98be('0xc')]);router[_0x98be('0x8')](_0x98be('0xd'),auth[_0x98be('0x9')](),controller['show']);router[_0x98be('0x8')]('/voice/queue/countAttributes/:id',auth[_0x98be('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x98be('0x8')]('/campaign/countAttributes/:id',auth[_0x98be('0x9')](),controller[_0x98be('0xe')]);router['post'](_0x98be('0xf'),auth[_0x98be('0x9')](),controller[_0x98be('0x10')]);router[_0x98be('0x11')]('/voice/campaign/moveContacts/:id',auth[_0x98be('0x9')](),controller[_0x98be('0x12')]);router[_0x98be('0x11')](_0x98be('0x13'),auth['isAuthenticated'](),controller[_0x98be('0x14')]);router[_0x98be('0x15')](_0x98be('0xd'),auth[_0x98be('0x9')](),controller['update']);module[_0x98be('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 208ee6b..450a9a5 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 _0xdafd=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x5d043c,_0xff15e4){var _0x422b57=function(_0x4fa905){while(--_0x4fa905){_0x5d043c['push'](_0x5d043c['shift']());}};_0x422b57(++_0xff15e4);}(_0xdafd,0x1be));var _0xddaf=function(_0x10e848,_0x1e5c1e){_0x10e848=_0x10e848-0x0;var _0x30ecf3=_0xdafd[_0x10e848];return _0x30ecf3;};'use strict';var Sequelize=require(_0xddaf('0x0'));module[_0xddaf('0x1')]={'state':{'type':Sequelize[_0xddaf('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xddaf('0x3')]},'scheduledat':{'type':Sequelize[_0xddaf('0x4')]},'countbusyretry':{'type':Sequelize[_0xddaf('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xddaf('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xddaf('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xddaf('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xddaf('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xddaf('0x3')]},'starttime':{'type':Sequelize[_0xddaf('0x4')]},'responsetime':{'type':Sequelize[_0xddaf('0x4')]},'answertime':{'type':Sequelize[_0xddaf('0x4')]},'droptime':{'type':Sequelize[_0xddaf('0x4')]},'endtime':{'type':Sequelize[_0xddaf('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xddaf('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xddaf('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xddaf('0x3')]},'campaign':{'type':Sequelize[_0xddaf('0x3')]},'campaigntype':{'type':Sequelize[_0xddaf('0x3')]},'membername':{'type':Sequelize[_0xddaf('0x3')]},'reason':{'type':Sequelize[_0xddaf('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xddaf('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xddaf('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xddaf('0x4')]},'recallme':{'type':Sequelize[_0xddaf('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xddaf('0x4')]},'edited':{'type':Sequelize[_0xddaf('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xddaf('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xddaf('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xddaf('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xddaf('0x3')]}}; \ No newline at end of file +var _0xcf30=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x7fab38,_0x501063){var _0xb5c718=function(_0x471181){while(--_0x471181){_0x7fab38['push'](_0x7fab38['shift']());}};_0xb5c718(++_0x501063);}(_0xcf30,0xcb));var _0x0cf3=function(_0x158d27,_0x3ca007){_0x158d27=_0x158d27-0x0;var _0x473f15=_0xcf30[_0x158d27];return _0x473f15;};'use strict';var Sequelize=require(_0x0cf3('0x0'));module[_0x0cf3('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x0cf3('0x2')]},'scheduledat':{'type':Sequelize[_0x0cf3('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0cf3('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0cf3('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0cf3('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0cf3('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x0cf3('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0cf3('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0cf3('0x3')]},'answertime':{'type':Sequelize[_0x0cf3('0x3')]},'droptime':{'type':Sequelize[_0x0cf3('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0cf3('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0cf3('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0cf3('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0cf3('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0cf3('0x2')]},'campaign':{'type':Sequelize[_0x0cf3('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0cf3('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0cf3('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0cf3('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0cf3('0x3')]},'recallme':{'type':Sequelize[_0x0cf3('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0cf3('0x3')]},'edited':{'type':Sequelize[_0x0cf3('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0cf3('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0cf3('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0cf3('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0cf3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 336edf8..ead16ad 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 _0xaaba=['../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','reject','save','then','sendStatus','error','stack','name','send','CmHopperHistory','fieldName','type','key','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','rawAttributes','includeAll','find','catch','create','describe','update','body','uniqueid','eml-format','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xaaba,0x10f));var _0xaaab=function(_0x120e72,_0x5a0548){_0x120e72=_0x120e72-0x0;var _0x56e1a2=_0xaaba[_0x120e72];return _0x56e1a2;};'use strict';var emlformat=require(_0xaaab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaaab('0x1'));var rp=require('request-promise');var moment=require(_0xaaab('0x2'));var BPromise=require(_0xaaab('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaaab('0x4'));var sox=require(_0xaaab('0x5'));var csv=require('to-csv');var ejs=require(_0xaaab('0x6'));var fs=require('fs');var fs_extra=require(_0xaaab('0x7'));var _=require(_0xaaab('0x8'));var squel=require(_0xaaab('0x9'));var crypto=require(_0xaaab('0xa'));var jsforce=require(_0xaaab('0xb'));var deskjs=require(_0xaaab('0xc'));var toCsv=require(_0xaaab('0xd'));var querystring=require(_0xaaab('0xe'));var Papa=require(_0xaaab('0xf'));var Redis=require(_0xaaab('0x10'));var authService=require(_0xaaab('0x11'));var qs=require(_0xaaab('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaaab('0x13'));var logger=require(_0xaaab('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xaaab('0x15'));var licenseUtil=require(_0xaaab('0x16'));var db=require(_0xaaab('0x17'))['db'];function respondWithStatusCode(_0x877737,_0x30ade6){_0x30ade6=_0x30ade6||0xcc;return function(_0x50b987){if(_0x50b987){return _0x877737['sendStatus'](_0x30ade6);}return _0x877737[_0xaaab('0x18')](_0x30ade6)[_0xaaab('0x19')]();};}function respondWithResult(_0x2069f9,_0x5ce752){_0x5ce752=_0x5ce752||0xc8;return function(_0x31e2ad){if(_0x31e2ad){return _0x2069f9[_0xaaab('0x18')](_0x5ce752)['json'](_0x31e2ad);}};}function respondWithFilteredResult(_0x5c5208,_0x14bcf1){return function(_0x376a2a){if(_0x376a2a){var _0xa231e0=typeof _0x14bcf1[_0xaaab('0x1a')]===_0xaaab('0x1b')&&typeof _0x14bcf1['limit']===_0xaaab('0x1b');var _0x2f24fd=_0x376a2a[_0xaaab('0x1c')];var _0x4f18ef=_0xa231e0?0x0:_0x14bcf1['offset'];var _0x7ce94=_0xa231e0?_0x376a2a[_0xaaab('0x1c')]:_0x14bcf1[_0xaaab('0x1a')]+_0x14bcf1['limit'];var _0x2f7492;if(_0x7ce94>=_0x2f24fd){_0x7ce94=_0x2f24fd;_0x2f7492=0xc8;}else{_0x2f7492=0xce;}_0x5c5208[_0xaaab('0x18')](_0x2f7492);return _0x5c5208['set']('Content-Range',_0x4f18ef+'-'+_0x7ce94+'/'+_0x2f24fd)['json'](_0x376a2a);}return null;};}function patchUpdates(_0x424cb8){return function(_0x31e280){try{jsonpatch['apply'](_0x31e280,_0x424cb8,!![]);}catch(_0x108ae1){return BPromise[_0xaaab('0x1d')](_0x108ae1);}return _0x31e280[_0xaaab('0x1e')]();};}function saveUpdates(_0x3d1fa4,_0xf8384f){return function(_0x4239bf){if(_0x4239bf){return _0x4239bf['update'](_0x3d1fa4)['then'](function(_0x2feb4b){return _0x2feb4b;});}return null;};}function removeEntity(_0x4b4eb5,_0x23f9fa){return function(_0x320f01){if(_0x320f01){return _0x320f01['destroy']()[_0xaaab('0x1f')](function(){_0x4b4eb5[_0xaaab('0x18')](0xcc)[_0xaaab('0x19')]();});}};}function handleEntityNotFound(_0x3acde9,_0x1869fa){return function(_0x382f22){if(!_0x382f22){_0x3acde9[_0xaaab('0x20')](0x194);}return _0x382f22;};}function handleError(_0x158120,_0x175921){_0x175921=_0x175921||0x1f4;return function(_0x384030){logger[_0xaaab('0x21')](_0x384030[_0xaaab('0x22')]);if(_0x384030[_0xaaab('0x23')]){delete _0x384030[_0xaaab('0x23')];}_0x158120[_0xaaab('0x18')](_0x175921)[_0xaaab('0x24')](_0x384030);};}exports['index']=function(_0x1de23f,_0x265f17){var _0x4a9118={},_0x233413={},_0x44dfb2={'count':0x0,'rows':[]};var _0xe76516=_['map'](db[_0xaaab('0x25')]['rawAttributes'],function(_0x41724c){return{'name':_0x41724c[_0xaaab('0x26')],'type':_0x41724c[_0xaaab('0x27')][_0xaaab('0x28')]};});_0x233413['model']=_[_0xaaab('0x29')](_0xe76516,_0xaaab('0x23'));_0x233413[_0xaaab('0x2a')]=_[_0xaaab('0x2b')](_0x1de23f['query']);_0x233413[_0xaaab('0x2c')]=_['intersection'](_0x233413['model'],_0x233413['query']);_0x4a9118[_0xaaab('0x2d')]=_[_0xaaab('0x2e')](_0x233413[_0xaaab('0x2f')],qs[_0xaaab('0x30')](_0x1de23f['query'][_0xaaab('0x30')]));_0x4a9118[_0xaaab('0x2d')]=_0x4a9118['attributes'][_0xaaab('0x31')]?_0x4a9118[_0xaaab('0x2d')]:_0x233413['model'];if(!_0x1de23f[_0xaaab('0x2a')][_0xaaab('0x32')](_0xaaab('0x33'))){_0x4a9118[_0xaaab('0x34')]=qs[_0xaaab('0x34')](_0x1de23f[_0xaaab('0x2a')][_0xaaab('0x34')]);_0x4a9118[_0xaaab('0x1a')]=qs[_0xaaab('0x1a')](_0x1de23f[_0xaaab('0x2a')][_0xaaab('0x1a')]);}_0x4a9118[_0xaaab('0x35')]=qs['sort'](_0x1de23f[_0xaaab('0x2a')][_0xaaab('0x36')]);_0x4a9118[_0xaaab('0x37')]=qs['filters'](_[_0xaaab('0x38')](_0x1de23f[_0xaaab('0x2a')],_0x233413[_0xaaab('0x2c')]),_0xe76516);if(_0x1de23f[_0xaaab('0x2a')][_0xaaab('0x39')]){_0x4a9118[_0xaaab('0x37')]=_['merge'](_0x4a9118[_0xaaab('0x37')],{'$or':_[_0xaaab('0x29')](_0xe76516,function(_0xd10e0e){if(_0xd10e0e['type']!=='VIRTUAL'){var _0x51860a={};_0x51860a[_0xd10e0e['name']]={'$like':'%'+_0x1de23f[_0xaaab('0x2a')][_0xaaab('0x39')]+'%'};return _0x51860a;}})});}_0x4a9118=_[_0xaaab('0x3a')]({},_0x4a9118,_0x1de23f[_0xaaab('0x3b')]);var _0x6bd0d6={'where':_0x4a9118[_0xaaab('0x37')]};return db[_0xaaab('0x25')][_0xaaab('0x1c')](_0x6bd0d6)[_0xaaab('0x1f')](function(_0x195d72){_0x44dfb2['count']=_0x195d72;if(_0x1de23f[_0xaaab('0x2a')]['includeAll']){_0x4a9118[_0xaaab('0x3c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xaaab('0x3d')](_0x4a9118);})['then'](function(_0x334c6d){_0x44dfb2[_0xaaab('0x3e')]=_0x334c6d;return _0x44dfb2;})[_0xaaab('0x1f')](respondWithFilteredResult(_0x265f17,_0x4a9118))['catch'](handleError(_0x265f17,null));};exports['show']=function(_0x36a548,_0x47cda0){var _0x5a8789={'raw':!![],'where':{'id':_0x36a548[_0xaaab('0x3f')]['id']}},_0x5d602b={};_0x5d602b[_0xaaab('0x2f')]=_[_0xaaab('0x2b')](db['CmHopperHistory'][_0xaaab('0x40')]);_0x5d602b[_0xaaab('0x2a')]=_[_0xaaab('0x2b')](_0x36a548['query']);_0x5d602b[_0xaaab('0x2c')]=_[_0xaaab('0x2e')](_0x5d602b[_0xaaab('0x2f')],_0x5d602b['query']);_0x5a8789[_0xaaab('0x2d')]=_['intersection'](_0x5d602b[_0xaaab('0x2f')],qs[_0xaaab('0x30')](_0x36a548[_0xaaab('0x2a')][_0xaaab('0x30')]));_0x5a8789['attributes']=_0x5a8789[_0xaaab('0x2d')][_0xaaab('0x31')]?_0x5a8789[_0xaaab('0x2d')]:_0x5d602b[_0xaaab('0x2f')];if(_0x36a548['query'][_0xaaab('0x41')]){_0x5a8789['include']=[{'all':!![]}];}_0x5a8789=_[_0xaaab('0x3a')]({},_0x5a8789,_0x36a548[_0xaaab('0x3b')]);return db[_0xaaab('0x25')][_0xaaab('0x42')](_0x5a8789)[_0xaaab('0x1f')](handleEntityNotFound(_0x47cda0,null))['then'](respondWithResult(_0x47cda0,null))[_0xaaab('0x43')](handleError(_0x47cda0,null));};exports[_0xaaab('0x44')]=function(_0x2fe4bf,_0x2f1798){return db['CmHopperHistory'][_0xaaab('0x44')](_0x2fe4bf['body'],{})[_0xaaab('0x1f')](respondWithResult(_0x2f1798,0xc9))['catch'](handleError(_0x2f1798,null));};exports[_0xaaab('0x45')]=function(_0x21bdc6,_0x44af84){return db[_0xaaab('0x25')][_0xaaab('0x45')]()[_0xaaab('0x1f')](respondWithResult(_0x44af84,null))[_0xaaab('0x43')](handleError(_0x44af84,null));};exports[_0xaaab('0x46')]=function(_0x1f8ce4,_0x575d04){if(_0x1f8ce4['body']['uniqueid']){delete _0x1f8ce4[_0xaaab('0x47')][_0xaaab('0x48')];}return db[_0xaaab('0x25')][_0xaaab('0x42')]({'where':{'uniqueid':_0x1f8ce4[_0xaaab('0x3f')]['id']}})[_0xaaab('0x1f')](handleEntityNotFound(_0x575d04,null))[_0xaaab('0x1f')](saveUpdates(_0x1f8ce4['body'],null))[_0xaaab('0x1f')](respondWithResult(_0x575d04,null))[_0xaaab('0x43')](handleError(_0x575d04,null));}; \ No newline at end of file +var _0x21e0=['then','destroy','error','stack','name','map','CmHopperHistory','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update'];(function(_0x2ee7cc,_0x4f0ef1){var _0x3488b7=function(_0x20fb82){while(--_0x20fb82){_0x2ee7cc['push'](_0x2ee7cc['shift']());}};_0x3488b7(++_0x4f0ef1);}(_0x21e0,0xbc));var _0x021e=function(_0x21531c,_0x2adebf){_0x21531c=_0x21531c-0x0;var _0x87f052=_0x21e0[_0x21531c];return _0x87f052;};'use strict';var emlformat=require(_0x021e('0x0'));var rimraf=require(_0x021e('0x1'));var zipdir=require(_0x021e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x021e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x021e('0x4'));var util=require(_0x021e('0x5'));var path=require(_0x021e('0x6'));var sox=require(_0x021e('0x7'));var csv=require(_0x021e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x021e('0x9'));var _=require(_0x021e('0xa'));var squel=require(_0x021e('0xb'));var crypto=require('crypto');var jsforce=require(_0x021e('0xc'));var deskjs=require(_0x021e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x021e('0xe'));var Papa=require(_0x021e('0xf'));var Redis=require(_0x021e('0x10'));var authService=require(_0x021e('0x11'));var qs=require(_0x021e('0x12'));var as=require(_0x021e('0x13'));var hardwareService=require(_0x021e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x021e('0x15'));var config=require(_0x021e('0x16'));var licenseUtil=require(_0x021e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x364f6d,_0x8d1be8){_0x8d1be8=_0x8d1be8||0xcc;return function(_0x5c9645){if(_0x5c9645){return _0x364f6d[_0x021e('0x18')](_0x8d1be8);}return _0x364f6d[_0x021e('0x19')](_0x8d1be8)[_0x021e('0x1a')]();};}function respondWithResult(_0x358216,_0xde87f5){_0xde87f5=_0xde87f5||0xc8;return function(_0x11ab87){if(_0x11ab87){return _0x358216[_0x021e('0x19')](_0xde87f5)['json'](_0x11ab87);}};}function respondWithFilteredResult(_0x9e487d,_0x37318a){return function(_0x4b3b37){if(_0x4b3b37){var _0x289428=typeof _0x37318a[_0x021e('0x1b')]===_0x021e('0x1c')&&typeof _0x37318a[_0x021e('0x1d')]==='undefined';var _0x162a7e=_0x4b3b37[_0x021e('0x1e')];var _0x30ce4e=_0x289428?0x0:_0x37318a[_0x021e('0x1b')];var _0x19e193=_0x289428?_0x4b3b37[_0x021e('0x1e')]:_0x37318a['offset']+_0x37318a['limit'];var _0x280096;if(_0x19e193>=_0x162a7e){_0x19e193=_0x162a7e;_0x280096=0xc8;}else{_0x280096=0xce;}_0x9e487d[_0x021e('0x19')](_0x280096);return _0x9e487d[_0x021e('0x1f')](_0x021e('0x20'),_0x30ce4e+'-'+_0x19e193+'/'+_0x162a7e)[_0x021e('0x21')](_0x4b3b37);}return null;};}function patchUpdates(_0x5237d4){return function(_0x35298b){try{jsonpatch['apply'](_0x35298b,_0x5237d4,!![]);}catch(_0x201833){return BPromise[_0x021e('0x22')](_0x201833);}return _0x35298b[_0x021e('0x23')]();};}function saveUpdates(_0x58ae6d,_0x55a287){return function(_0xb468bf){if(_0xb468bf){return _0xb468bf[_0x021e('0x24')](_0x58ae6d)[_0x021e('0x25')](function(_0x17edf8){return _0x17edf8;});}return null;};}function removeEntity(_0x41ccf5,_0x39acf8){return function(_0x56d05e){if(_0x56d05e){return _0x56d05e[_0x021e('0x26')]()['then'](function(){_0x41ccf5[_0x021e('0x19')](0xcc)[_0x021e('0x1a')]();});}};}function handleEntityNotFound(_0x4227c9,_0x504035){return function(_0x4929ab){if(!_0x4929ab){_0x4227c9[_0x021e('0x18')](0x194);}return _0x4929ab;};}function handleError(_0x177211,_0x1e2420){_0x1e2420=_0x1e2420||0x1f4;return function(_0x19e399){logger[_0x021e('0x27')](_0x19e399[_0x021e('0x28')]);if(_0x19e399[_0x021e('0x29')]){delete _0x19e399[_0x021e('0x29')];}_0x177211[_0x021e('0x19')](_0x1e2420)['send'](_0x19e399);};}exports['index']=function(_0xfd32f4,_0x2e7a1e){var _0xb01977={},_0x2a2ef3={},_0xb3565e={'count':0x0,'rows':[]};var _0x1f74e0=_[_0x021e('0x2a')](db[_0x021e('0x2b')][_0x021e('0x2c')],function(_0x2593d0){return{'name':_0x2593d0[_0x021e('0x2d')],'type':_0x2593d0['type'][_0x021e('0x2e')]};});_0x2a2ef3[_0x021e('0x2f')]=_[_0x021e('0x2a')](_0x1f74e0,_0x021e('0x29'));_0x2a2ef3['query']=_[_0x021e('0x30')](_0xfd32f4['query']);_0x2a2ef3[_0x021e('0x31')]=_[_0x021e('0x32')](_0x2a2ef3['model'],_0x2a2ef3[_0x021e('0x33')]);_0xb01977['attributes']=_['intersection'](_0x2a2ef3[_0x021e('0x2f')],qs['fields'](_0xfd32f4[_0x021e('0x33')][_0x021e('0x34')]));_0xb01977[_0x021e('0x35')]=_0xb01977[_0x021e('0x35')][_0x021e('0x36')]?_0xb01977['attributes']:_0x2a2ef3[_0x021e('0x2f')];if(!_0xfd32f4[_0x021e('0x33')]['hasOwnProperty'](_0x021e('0x37'))){_0xb01977[_0x021e('0x1d')]=qs[_0x021e('0x1d')](_0xfd32f4['query'][_0x021e('0x1d')]);_0xb01977[_0x021e('0x1b')]=qs[_0x021e('0x1b')](_0xfd32f4[_0x021e('0x33')]['offset']);}_0xb01977[_0x021e('0x38')]=qs[_0x021e('0x39')](_0xfd32f4[_0x021e('0x33')]['sort']);_0xb01977[_0x021e('0x3a')]=qs[_0x021e('0x31')](_[_0x021e('0x3b')](_0xfd32f4['query'],_0x2a2ef3[_0x021e('0x31')]),_0x1f74e0);if(_0xfd32f4[_0x021e('0x33')][_0x021e('0x3c')]){_0xb01977[_0x021e('0x3a')]=_['merge'](_0xb01977[_0x021e('0x3a')],{'$or':_[_0x021e('0x2a')](_0x1f74e0,function(_0x343e68){if(_0x343e68[_0x021e('0x3d')]!==_0x021e('0x3e')){var _0x381ae5={};_0x381ae5[_0x343e68[_0x021e('0x29')]]={'$like':'%'+_0xfd32f4['query'][_0x021e('0x3c')]+'%'};return _0x381ae5;}})});}_0xb01977=_[_0x021e('0x3f')]({},_0xb01977,_0xfd32f4[_0x021e('0x40')]);var _0x30c885={'where':_0xb01977[_0x021e('0x3a')]};return db['CmHopperHistory'][_0x021e('0x1e')](_0x30c885)['then'](function(_0x386c1b){_0xb3565e[_0x021e('0x1e')]=_0x386c1b;if(_0xfd32f4[_0x021e('0x33')][_0x021e('0x41')]){_0xb01977[_0x021e('0x42')]=[{'all':!![]}];}return db[_0x021e('0x2b')][_0x021e('0x43')](_0xb01977);})[_0x021e('0x25')](function(_0x1a84e4){_0xb3565e['rows']=_0x1a84e4;return _0xb3565e;})[_0x021e('0x25')](respondWithFilteredResult(_0x2e7a1e,_0xb01977))[_0x021e('0x44')](handleError(_0x2e7a1e,null));};exports[_0x021e('0x45')]=function(_0xe3f481,_0x366827){var _0x2a8d05={'raw':!![],'where':{'id':_0xe3f481[_0x021e('0x46')]['id']}},_0x44e1ea={};_0x44e1ea[_0x021e('0x2f')]=_[_0x021e('0x30')](db[_0x021e('0x2b')]['rawAttributes']);_0x44e1ea[_0x021e('0x33')]=_['keys'](_0xe3f481['query']);_0x44e1ea['filters']=_[_0x021e('0x32')](_0x44e1ea['model'],_0x44e1ea[_0x021e('0x33')]);_0x2a8d05['attributes']=_[_0x021e('0x32')](_0x44e1ea[_0x021e('0x2f')],qs['fields'](_0xe3f481[_0x021e('0x33')][_0x021e('0x34')]));_0x2a8d05[_0x021e('0x35')]=_0x2a8d05[_0x021e('0x35')][_0x021e('0x36')]?_0x2a8d05['attributes']:_0x44e1ea[_0x021e('0x2f')];if(_0xe3f481[_0x021e('0x33')][_0x021e('0x41')]){_0x2a8d05[_0x021e('0x42')]=[{'all':!![]}];}_0x2a8d05=_['merge']({},_0x2a8d05,_0xe3f481[_0x021e('0x40')]);return db['CmHopperHistory']['find'](_0x2a8d05)[_0x021e('0x25')](handleEntityNotFound(_0x366827,null))[_0x021e('0x25')](respondWithResult(_0x366827,null))['catch'](handleError(_0x366827,null));};exports[_0x021e('0x47')]=function(_0x182a25,_0x14334d){return db[_0x021e('0x2b')][_0x021e('0x47')](_0x182a25[_0x021e('0x48')],{})[_0x021e('0x25')](respondWithResult(_0x14334d,0xc9))['catch'](handleError(_0x14334d,null));};exports['describe']=function(_0x4880cc,_0x1a1e89){return db[_0x021e('0x2b')][_0x021e('0x49')]()['then'](respondWithResult(_0x1a1e89,null))[_0x021e('0x44')](handleError(_0x1a1e89,null));};exports[_0x021e('0x24')]=function(_0x50a41a,_0xe47b30){if(_0x50a41a['body'][_0x021e('0x4a')]){delete _0x50a41a[_0x021e('0x48')][_0x021e('0x4a')];}return db[_0x021e('0x2b')]['find']({'where':{'uniqueid':_0x50a41a[_0x021e('0x46')]['id']}})[_0x021e('0x25')](handleEntityNotFound(_0xe47b30,null))[_0x021e('0x25')](saveUpdates(_0x50a41a[_0x021e('0x48')],null))[_0x021e('0x25')](respondWithResult(_0xe47b30,null))[_0x021e('0x44')](handleError(_0xe47b30,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 2fd74ed..b573db0 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 _0xbc95=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','CmHopperHistory','endtime','uniqueid'];(function(_0x12c81b,_0x31f563){var _0x50e5ad=function(_0x1230e9){while(--_0x1230e9){_0x12c81b['push'](_0x12c81b['shift']());}};_0x50e5ad(++_0x31f563);}(_0xbc95,0x1f4));var _0x5bc9=function(_0x2484c6,_0x17dbbd){_0x2484c6=_0x2484c6-0x0;var _0x3d09a6=_0xbc95[_0x2484c6];return _0x3d09a6;};'use strict';var _=require(_0x5bc9('0x0'));var util=require(_0x5bc9('0x1'));var logger=require(_0x5bc9('0x2'))(_0x5bc9('0x3'));var moment=require(_0x5bc9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5bc9('0x5'));var config=require(_0x5bc9('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x5cca07,_0x889a0e){return _0x5cca07['define'](_0x5bc9('0x7'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x5bc9('0x8')]},{'name':_0x5bc9('0x9'),'fields':[_0x5bc9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb03e=['request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3b3f01,_0x1d15a2){_0x3b3f01=_0x3b3f01-0x0;var _0x3ddde4=_0xb03e[_0x3b3f01];return _0x3ddde4;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'paranoid':![],'indexes':[{'name':_0xeb03('0xe'),'fields':[_0xeb03('0xe')]},{'name':_0xeb03('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 2d881df..943fea8 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 _0xeec3=['predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','debug','GetCampaignHopperHistory','where','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperHistory,\x20%s,\x20%s','CreateCmHopperHistory','CmHopperHistory','body','options','AvgHandleTime','findAll','raw','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0x234f2c,_0x2027a9){var _0x41c831=function(_0x5e1962){while(--_0x5e1962){_0x234f2c['push'](_0x234f2c['shift']());}};_0x41c831(++_0x2027a9);}(_0xeec3,0x1c3));var _0x3eec=function(_0xf64090,_0x4d6d01){_0xf64090=_0xf64090-0x0;var _0x57cee1=_0xeec3[_0xf64090];return _0x57cee1;};'use strict';var _=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3eec('0x2'));var logger=require(_0x3eec('0x3'))('rpc');var config=require(_0x3eec('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x3eec('0x5')][_0x3eec('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x57be71,_0x3a019f,_0x3b8171){return new BPromise(function(_0xa6821e,_0x3dcfdb){return client[_0x3eec('0x7')](_0x57be71,_0x3b8171)[_0x3eec('0x8')](function(_0xd06d6c){logger[_0x3eec('0x9')]('CmHopperHistory,\x20%s,\x20%s',_0x3a019f,_0x3eec('0xa'));logger['debug'](_0x3eec('0xb'),_0x3a019f,_0x3eec('0xa'),JSON[_0x3eec('0xc')](_0xd06d6c));if(_0xd06d6c[_0x3eec('0xd')]){if(_0xd06d6c['error'][_0x3eec('0xe')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x3a019f,_0xd06d6c['error'][_0x3eec('0xf')]);return _0x3dcfdb(_0xd06d6c[_0x3eec('0xd')][_0x3eec('0xf')]);}logger[_0x3eec('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x3a019f,_0xd06d6c[_0x3eec('0xd')]['message']);return _0xa6821e(_0xd06d6c['error']['message']);}else{logger[_0x3eec('0x9')]('CmHopperHistory,\x20%s,\x20%s',_0x3a019f,'request\x20sent');_0xa6821e(_0xd06d6c[_0x3eec('0x10')][_0x3eec('0xf')]);}})[_0x3eec('0x11')](function(_0x48b170){logger['error'](_0x3eec('0x12'),_0x3a019f,_0x48b170);_0x3dcfdb(_0x48b170);});});}exports[_0x3eec('0x13')]=function(_0x500109){var _0x1c1251=this;return new Promise(function(_0x497d60,_0x140639){return db[_0x3eec('0x14')]['create'](_0x500109[_0x3eec('0x15')],{'raw':_0x500109['options']?_0x500109[_0x3eec('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x3eec('0x8')](function(_0x2dd282){logger['info'](_0x3eec('0x13'),_0x500109);logger['debug']('CreateCmHopperHistory',_0x500109,JSON[_0x3eec('0xc')](_0x2dd282));_0x497d60(_0x2dd282);})[_0x3eec('0x11')](function(_0x4847b3){logger[_0x3eec('0xd')]('CreateCmHopperHistory',_0x4847b3[_0x3eec('0xf')],_0x500109);_0x140639(_0x1c1251[_0x3eec('0xd')](0x1f4,_0x4847b3[_0x3eec('0xf')]));});});};exports[_0x3eec('0x17')]=function(_0x3cda64){var _0x203b3f=this;return new Promise(function(_0x34fbe4,_0x1023a0){return db[_0x3eec('0x14')][_0x3eec('0x18')]({'raw':_0x3cda64[_0x3eec('0x16')]?_0x3cda64[_0x3eec('0x16')][_0x3eec('0x19')]===undefined?!![]:![]:!![],'where':_0x3cda64['options']?_0x3cda64[_0x3eec('0x16')]['where']||null:null,'attributes':[[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')][_0x3eec('0x1c')]('id')),_0x3eec('0x1d')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')][_0x3eec('0x1e')](_0x3eec('0x1f')))),_0x3eec('0x20')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')]['literal'](_0x3eec('0x21')))),_0x3eec('0x22')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x3eec('0x23')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x24'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')][_0x3eec('0x1e')](_0x3eec('0x25')))),_0x3eec('0x26')],[db['sequelize']['fn'](_0x3eec('0x24'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3eec('0x27')]]})[_0x3eec('0x8')](function(_0x5e4efe){logger['info'](_0x3eec('0x17'),_0x3cda64);logger['debug'](_0x3eec('0x17'),_0x3cda64,JSON[_0x3eec('0xc')](_0x5e4efe));_0x34fbe4(_0x5e4efe);})['catch'](function(_0x1cf03a){logger[_0x3eec('0xd')]('AvgHandleTime',_0x1cf03a['message'],_0x3cda64);_0x1023a0(_0x203b3f[_0x3eec('0xd')](0x1f4,_0x1cf03a[_0x3eec('0xf')]));});});};exports[_0x3eec('0x28')]=function(_0x4f5c6e){var _0x2a8297=this;return new Promise(function(_0x5f4b3f,_0x5c1b5e){return db['CmHopperHistory'][_0x3eec('0x18')]({'raw':_0x4f5c6e[_0x3eec('0x16')]?_0x4f5c6e[_0x3eec('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4f5c6e[_0x3eec('0x16')]?_0x4f5c6e[_0x3eec('0x16')]['where']||null:null,'attributes':[[_0x3eec('0x29'),'name'],[db['sequelize']['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')][_0x3eec('0x1e')]('`state`\x20=\x200,\x201,\x20null'))),_0x3eec('0x2a')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x3eec('0x2b')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')][_0x3eec('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0x3eec('0x2c')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')][_0x3eec('0x1e')]('`state`\x20=\x205,\x201,\x20null'))),_0x3eec('0x2d')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')][_0x3eec('0x1e')](_0x3eec('0x2e')))),_0x3eec('0x2f')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')][_0x3eec('0x1e')](_0x3eec('0x30')))),_0x3eec('0x31')],[db['sequelize']['fn'](_0x3eec('0x1b'),db['sequelize']['fn']('IF',db[_0x3eec('0x1a')]['literal'](_0x3eec('0x32')))),_0x3eec('0x33')],[db['sequelize']['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db['sequelize'][_0x3eec('0x1e')](_0x3eec('0x34')))),_0x3eec('0x35')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x3eec('0x36')))),_0x3eec('0x37')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db['sequelize'][_0x3eec('0x1e')](_0x3eec('0x38')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db['sequelize'][_0x3eec('0x1e')](_0x3eec('0x39')))),_0x3eec('0x3a')],[db['sequelize']['fn'](_0x3eec('0x1b'),db['sequelize']['fn']('IF',db[_0x3eec('0x1a')][_0x3eec('0x1e')](_0x3eec('0x3b')))),_0x3eec('0x3c')],[db['sequelize']['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')][_0x3eec('0x1e')](_0x3eec('0x3d')))),_0x3eec('0x3a')],[db['sequelize']['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db['sequelize'][_0x3eec('0x1e')](_0x3eec('0x3e')))),_0x3eec('0x3f')]],'group':[_0x3eec('0x29')]})['then'](function(_0xae7b70){logger[_0x3eec('0x9')](_0x3eec('0x28'),_0x4f5c6e);logger[_0x3eec('0x40')](_0x3eec('0x28'),_0x4f5c6e,JSON[_0x3eec('0xc')](_0xae7b70));_0x5f4b3f(_0xae7b70);})['catch'](function(_0x22a8ce){logger[_0x3eec('0xd')](_0x3eec('0x28'),_0x22a8ce['message'],_0x4f5c6e);_0x5c1b5e(_0x2a8297[_0x3eec('0xd')](0x1f4,_0x22a8ce['message']));});});};exports[_0x3eec('0x41')]=function(_0x4b390a){var _0x10cb90=this;return new Promise(function(_0x4da4fa,_0x11ab79){return db[_0x3eec('0x14')][_0x3eec('0x18')]({'raw':_0x4b390a[_0x3eec('0x16')]?_0x4b390a['options'][_0x3eec('0x19')]===undefined?!![]:![]:!![],'where':_0x4b390a[_0x3eec('0x16')]?_0x4b390a[_0x3eec('0x16')][_0x3eec('0x42')]||null:null,'attributes':[[_0x3eec('0x29'),_0x3eec('0x43')],[db['sequelize']['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')][_0x3eec('0x1c')]('id')),_0x3eec('0x44')],[db[_0x3eec('0x1a')]['fn'](_0x3eec('0x1b'),db[_0x3eec('0x1a')]['fn']('IF',db[_0x3eec('0x1a')][_0x3eec('0x1e')](_0x3eec('0x1f')))),_0x3eec('0x45')]],'group':[_0x3eec('0x29')]})['then'](function(_0x2030e8){logger[_0x3eec('0x9')](_0x3eec('0x41'),_0x4b390a);logger[_0x3eec('0x40')](_0x3eec('0x41'),_0x4b390a,JSON[_0x3eec('0xc')](_0x2030e8));_0x4da4fa(_0x2030e8);})[_0x3eec('0x11')](function(_0x53a0e5){logger['error'](_0x3eec('0x41'),_0x53a0e5[_0x3eec('0xf')],_0x4b390a);_0x11ab79(_0x10cb90['error'](0x1f4,_0x53a0e5['message']));});});}; \ No newline at end of file +var _0x3238=['info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateCmHopperHistory','CmHopperHistory','body','options','raw','catch','AvgHandleTime','findAll','where','sequelize','col','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x284e6c,_0x1ddcd8){var _0xec719f=function(_0x504cbe){while(--_0x504cbe){_0x284e6c['push'](_0x284e6c['shift']());}};_0xec719f(++_0x1ddcd8);}(_0x3238,0x13e));var _0x8323=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3238[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8323('0x0'));var util=require('util');var moment=require(_0x8323('0x1'));var BPromise=require(_0x8323('0x2'));var rs=require(_0x8323('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8323('0x4'))['db'];var utils=require(_0x8323('0x5'));var logger=require(_0x8323('0x6'))(_0x8323('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8323('0x8')][_0x8323('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40b1f0,_0x14b3b5,_0x4ddf1f){return new BPromise(function(_0x232f4b,_0x5950e2){return client[_0x8323('0xa')](_0x40b1f0,_0x4ddf1f)[_0x8323('0xb')](function(_0x1577a6){logger[_0x8323('0xc')](_0x8323('0xd'),_0x14b3b5,_0x8323('0xe'));logger[_0x8323('0xf')](_0x8323('0x10'),_0x14b3b5,'request\x20sent',JSON[_0x8323('0x11')](_0x1577a6));if(_0x1577a6[_0x8323('0x12')]){if(_0x1577a6[_0x8323('0x12')]['code']===0x1f4){logger[_0x8323('0x12')](_0x8323('0xd'),_0x14b3b5,_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);return _0x5950e2(_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);}logger[_0x8323('0x12')](_0x8323('0xd'),_0x14b3b5,_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);return _0x232f4b(_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);}else{logger[_0x8323('0xc')](_0x8323('0xd'),_0x14b3b5,'request\x20sent');_0x232f4b(_0x1577a6[_0x8323('0x14')][_0x8323('0x13')]);}})['catch'](function(_0x320e7f){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x14b3b5,_0x320e7f);_0x5950e2(_0x320e7f);});});}exports[_0x8323('0x15')]=function(_0x3bb436){var _0x2bb7c5=this;return new Promise(function(_0x46a42c,_0x3b3ba9){return db[_0x8323('0x16')]['create'](_0x3bb436[_0x8323('0x17')],{'raw':_0x3bb436['options']?_0x3bb436[_0x8323('0x18')][_0x8323('0x19')]===undefined?!![]:![]:!![]})[_0x8323('0xb')](function(_0x4d1ef3){logger[_0x8323('0xc')]('CreateCmHopperHistory',_0x3bb436);logger['debug'](_0x8323('0x15'),_0x3bb436,JSON[_0x8323('0x11')](_0x4d1ef3));_0x46a42c(_0x4d1ef3);})[_0x8323('0x1a')](function(_0x49fdb1){logger['error'](_0x8323('0x15'),_0x49fdb1[_0x8323('0x13')],_0x3bb436);_0x3b3ba9(_0x2bb7c5[_0x8323('0x12')](0x1f4,_0x49fdb1[_0x8323('0x13')]));});});};exports[_0x8323('0x1b')]=function(_0x372ce6){var _0x3185d3=this;return new Promise(function(_0xe839b3,_0x2ded41){return db['CmHopperHistory'][_0x8323('0x1c')]({'raw':_0x372ce6['options']?_0x372ce6['options']['raw']===undefined?!![]:![]:!![],'where':_0x372ce6[_0x8323('0x18')]?_0x372ce6[_0x8323('0x18')][_0x8323('0x1d')]||null:null,'attributes':[[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')][_0x8323('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x22')))),_0x8323('0x23')],[db['sequelize']['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db['sequelize'][_0x8323('0x21')](_0x8323('0x24')))),_0x8323('0x25')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x8323('0x26')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x27'),db['sequelize']['fn']('IF',db['sequelize'][_0x8323('0x21')](_0x8323('0x28')))),_0x8323('0x29')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x27'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')]['literal'](_0x8323('0x2a')))),_0x8323('0x2b')]]})['then'](function(_0x20a582){logger[_0x8323('0xc')](_0x8323('0x1b'),_0x372ce6);logger[_0x8323('0xf')](_0x8323('0x1b'),_0x372ce6,JSON[_0x8323('0x11')](_0x20a582));_0xe839b3(_0x20a582);})[_0x8323('0x1a')](function(_0x52b01b){logger[_0x8323('0x12')](_0x8323('0x1b'),_0x52b01b[_0x8323('0x13')],_0x372ce6);_0x2ded41(_0x3185d3[_0x8323('0x12')](0x1f4,_0x52b01b[_0x8323('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x580d06){var _0x41efea=this;return new Promise(function(_0x2d6c39,_0xada275){return db[_0x8323('0x16')][_0x8323('0x1c')]({'raw':_0x580d06[_0x8323('0x18')]?_0x580d06['options'][_0x8323('0x19')]===undefined?!![]:![]:!![],'where':_0x580d06[_0x8323('0x18')]?_0x580d06['options'][_0x8323('0x1d')]||null:null,'attributes':[[_0x8323('0x2c'),_0x8323('0x2d')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8323('0x21')](_0x8323('0x2e')))),'outboundNoSuchCallsDay'],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x2f')))),_0x8323('0x30')],[db['sequelize']['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x8323('0x31')],[db[_0x8323('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x32')))),_0x8323('0x33')],[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x34')))),'outboundCongestionCallsDay'],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8323('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')]['fn']('IF',db['sequelize'][_0x8323('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x35')))),_0x8323('0x36')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8323('0x21')](_0x8323('0x37')))),_0x8323('0x38')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')]['literal'](_0x8323('0x39')))),'outboundOriginateFailureCallsDay'],[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x3a')))),_0x8323('0x3b')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x8323('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x3d')))),'outboundRejectCallsDay'],[db[_0x8323('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x8323('0x2c')]})[_0x8323('0xb')](function(_0x16b073){logger[_0x8323('0xc')](_0x8323('0x3e'),_0x580d06);logger[_0x8323('0xf')](_0x8323('0x3e'),_0x580d06,JSON[_0x8323('0x11')](_0x16b073));_0x2d6c39(_0x16b073);})[_0x8323('0x1a')](function(_0x14d0b1){logger[_0x8323('0x12')](_0x8323('0x3e'),_0x14d0b1[_0x8323('0x13')],_0x580d06);_0xada275(_0x41efea['error'](0x1f4,_0x14d0b1[_0x8323('0x13')]));});});};exports[_0x8323('0x3f')]=function(_0x20637e){var _0xa10750=this;return new Promise(function(_0x3b37ca,_0xd6f24){return db['CmHopperHistory']['findAll']({'raw':_0x20637e['options']?_0x20637e['options']['raw']===undefined?!![]:![]:!![],'where':_0x20637e[_0x8323('0x18')]?_0x20637e[_0x8323('0x18')][_0x8323('0x1d')]||null:null,'attributes':[[_0x8323('0x2c'),'name'],[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')][_0x8323('0x1f')]('id')),_0x8323('0x40')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x22')))),_0x8323('0x41')]],'group':['campaign']})[_0x8323('0xb')](function(_0x46cf89){logger[_0x8323('0xc')](_0x8323('0x3f'),_0x20637e);logger[_0x8323('0xf')](_0x8323('0x3f'),_0x20637e,JSON[_0x8323('0x11')](_0x46cf89));_0x3b37ca(_0x46cf89);})[_0x8323('0x1a')](function(_0x1a8a0c){logger['error'](_0x8323('0x3f'),_0x1a8a0c['message'],_0x20637e);_0xd6f24(_0xa10750[_0x8323('0x12')](0x1f4,_0x1a8a0c['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 4a82efb..5aad093 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 _0x9177=['index','describe','/:id','show','post','create','put','update','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x228af8,_0x107526){var _0x4be170=function(_0x44446a){while(--_0x44446a){_0x228af8['push'](_0x228af8['shift']());}};_0x4be170(++_0x107526);}(_0x9177,0x7b));var _0x7917=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x9177[_0xd511d];return _0x3f148e;};'use strict';var multer=require(_0x7917('0x0'));var util=require('util');var path=require(_0x7917('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7917('0x2')]();var fs_extra=require(_0x7917('0x3'));var auth=require(_0x7917('0x4'));var interaction=require(_0x7917('0x5'));var config=require(_0x7917('0x6'));var controller=require(_0x7917('0x7'));router[_0x7917('0x8')]('/',auth[_0x7917('0x9')](),controller[_0x7917('0xa')]);router['get']('/describe',auth[_0x7917('0x9')](),controller[_0x7917('0xb')]);router[_0x7917('0x8')](_0x7917('0xc'),auth[_0x7917('0x9')](),controller[_0x7917('0xd')]);router[_0x7917('0xe')]('/',auth[_0x7917('0x9')](),controller[_0x7917('0xf')]);router[_0x7917('0x10')](_0x7917('0xc'),auth[_0x7917('0x9')](),controller[_0x7917('0x11')]);module[_0x7917('0x12')]=router; \ No newline at end of file +var _0xe92d=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x5e206a,_0xe54632){var _0x530568=function(_0x22fa04){while(--_0x22fa04){_0x5e206a['push'](_0x5e206a['shift']());}};_0x530568(++_0xe54632);}(_0xe92d,0x86));var _0xde92=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe92d[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde92('0x0'));var timeout=require(_0xde92('0x1'));var express=require(_0xde92('0x2'));var router=express[_0xde92('0x3')]();var fs_extra=require(_0xde92('0x4'));var auth=require(_0xde92('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde92('0x6'));var controller=require(_0xde92('0x7'));router[_0xde92('0x8')]('/',auth[_0xde92('0x9')](),controller[_0xde92('0xa')]);router[_0xde92('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xde92('0xb')]);router[_0xde92('0x8')](_0xde92('0xc'),auth[_0xde92('0x9')](),controller[_0xde92('0xd')]);router[_0xde92('0xe')]('/',auth['isAuthenticated'](),controller[_0xde92('0xf')]);router[_0xde92('0x10')](_0xde92('0xc'),auth[_0xde92('0x9')](),controller[_0xde92('0x11')]);module[_0xde92('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index b4e141a..908f6c7 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 _0x8135=['exports','STRING','name'];(function(_0x442030,_0x6ba458){var _0x52417d=function(_0x2b157b){while(--_0x2b157b){_0x442030['push'](_0x442030['shift']());}};_0x52417d(++_0x6ba458);}(_0x8135,0x99));var _0x5813=function(_0x50cbb4,_0x196b3b){_0x50cbb4=_0x50cbb4-0x0;var _0x246938=_0x8135[_0x50cbb4];return _0x246938;};'use strict';var Sequelize=require('sequelize');module[_0x5813('0x0')]={'name':{'type':Sequelize[_0x5813('0x1')],'unique':_0x5813('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5813('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5a2a=['exports','STRING','name','sequelize'];(function(_0x4014e5,_0x125e6a){var _0x4ee8b7=function(_0x2475da){while(--_0x2475da){_0x4014e5['push'](_0x4014e5['shift']());}};_0x4ee8b7(++_0x125e6a);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x531022,_0x512cde){_0x531022=_0x531022-0x0;var _0xfc9427=_0x5a2a[_0x531022];return _0xfc9427;};'use strict';var Sequelize=require(_0xa5a2('0x0'));module[_0xa5a2('0x1')]={'name':{'type':Sequelize[_0xa5a2('0x2')],'unique':_0xa5a2('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 3755f03..55072cd 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 _0x7921=['offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','CmList','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','pick','ListId','rows','addContacts','CmContact','tags','join','isArray','push','each','ids','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','raw','getContactsCsv','ContactItemType','OrderBy','alias','cm_contacts','c.deletedAt\x20is\x20null','c.cf_','field','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','select','description','description_additionalPhone_','toString','now','writeFileSync','format','/tmp/list_%d_%s.csv','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json'];(function(_0x1b880b,_0x258000){var _0x2fcfa7=function(_0x55d934){while(--_0x55d934){_0x1b880b['push'](_0x1b880b['shift']());}};_0x2fcfa7(++_0x258000);}(_0x7921,0x82));var _0x1792=function(_0x10020f,_0x52eda9){_0x10020f=_0x10020f-0x0;var _0x35fdc2=_0x7921[_0x10020f];return _0x35fdc2;};'use strict';var emlformat=require(_0x1792('0x0'));var rimraf=require(_0x1792('0x1'));var zipdir=require(_0x1792('0x2'));var jsonpatch=require(_0x1792('0x3'));var rp=require(_0x1792('0x4'));var moment=require(_0x1792('0x5'));var BPromise=require(_0x1792('0x6'));var Mustache=require(_0x1792('0x7'));var util=require(_0x1792('0x8'));var path=require('path');var sox=require(_0x1792('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1792('0xa'));var squel=require(_0x1792('0xb'));var crypto=require(_0x1792('0xc'));var jsforce=require(_0x1792('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1792('0xe'));var Papa=require(_0x1792('0xf'));var Redis=require('ioredis');var authService=require(_0x1792('0x10'));var qs=require(_0x1792('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1792('0x12'));var logger=require('../../config/logger')(_0x1792('0x13'));var utils=require(_0x1792('0x14'));var config=require(_0x1792('0x15'));var licenseUtil=require(_0x1792('0x16'));var db=require(_0x1792('0x17'))['db'];var csv_results;config[_0x1792('0x18')]=_[_0x1792('0x19')](config[_0x1792('0x18')],{'host':_0x1792('0x1a'),'port':0x18eb});var socket=require(_0x1792('0x1b'))(new Redis(config['redis']));require(_0x1792('0x1c'))[_0x1792('0x1d')](socket);function respondWithStatusCode(_0xd930ef,_0x5cf690){_0x5cf690=_0x5cf690||0xcc;return function(_0x595cf2){if(_0x595cf2){return _0xd930ef[_0x1792('0x1e')](_0x5cf690);}return _0xd930ef[_0x1792('0x1f')](_0x5cf690)[_0x1792('0x20')]();};}function respondWithResult(_0xc95725,_0x4f64ca){_0x4f64ca=_0x4f64ca||0xc8;return function(_0xf3a64c){if(_0xf3a64c){return _0xc95725[_0x1792('0x1f')](_0x4f64ca)[_0x1792('0x21')](_0xf3a64c);}};}function respondWithFilteredResult(_0x1e7b42,_0x188999){return function(_0x351041){if(_0x351041){var _0x27ccc2=typeof _0x188999[_0x1792('0x22')]===_0x1792('0x23')&&typeof _0x188999[_0x1792('0x24')]===_0x1792('0x23');var _0xf9316=_0x351041[_0x1792('0x25')];var _0x239799=_0x27ccc2?0x0:_0x188999['offset'];var _0x2f29bc=_0x27ccc2?_0x351041[_0x1792('0x25')]:_0x188999[_0x1792('0x22')]+_0x188999[_0x1792('0x24')];var _0x35693f;if(_0x2f29bc>=_0xf9316){_0x2f29bc=_0xf9316;_0x35693f=0xc8;}else{_0x35693f=0xce;}_0x1e7b42['status'](_0x35693f);return _0x1e7b42[_0x1792('0x26')](_0x1792('0x27'),_0x239799+'-'+_0x2f29bc+'/'+_0xf9316)[_0x1792('0x21')](_0x351041);}return null;};}function patchUpdates(_0x54c88f){return function(_0x3d8450){try{jsonpatch[_0x1792('0x28')](_0x3d8450,_0x54c88f,!![]);}catch(_0x375493){return BPromise['reject'](_0x375493);}return _0x3d8450['save']();};}function saveUpdates(_0x48f6f4,_0x106d46){return function(_0x30bddf){if(_0x30bddf){return _0x30bddf[_0x1792('0x29')](_0x48f6f4)['then'](function(_0x467aa8){return _0x467aa8;});}return null;};}function removeEntity(_0x290145,_0x32970a){return function(_0x132d1e){if(_0x132d1e){return _0x132d1e[_0x1792('0x2a')]()[_0x1792('0x2b')](function(){var _0x45c5fa=_0x132d1e[_0x1792('0x2c')]({'plain':!![]});var _0x3a29fd=_0x1792('0x2d');return db[_0x1792('0x2e')][_0x1792('0x2a')]({'where':{'type':_0x3a29fd,'resourceId':_0x45c5fa['id']}})[_0x1792('0x2b')](function(){return _0x132d1e;});})['then'](function(){_0x290145[_0x1792('0x1f')](0xcc)[_0x1792('0x20')]();});}};}function handleEntityNotFound(_0x4bbdfb,_0x4444e9){return function(_0x44328d){if(!_0x44328d){_0x4bbdfb[_0x1792('0x1e')](0x194);}return _0x44328d;};}function handleError(_0x5d8c1c,_0x113965){_0x113965=_0x113965||0x1f4;return function(_0x15da0a){logger[_0x1792('0x2f')](_0x15da0a[_0x1792('0x30')]);if(_0x15da0a[_0x1792('0x31')]){delete _0x15da0a[_0x1792('0x31')];}_0x5d8c1c['status'](_0x113965)[_0x1792('0x32')](_0x15da0a);};}exports[_0x1792('0x33')]=function(_0x45093e,_0xe6c80b){var _0x449962={},_0x5414ce={},_0xad9e28={'count':0x0,'rows':[]};var _0x17e05a=_[_0x1792('0x34')](db['CmList'][_0x1792('0x35')],function(_0x568cce){return{'name':_0x568cce[_0x1792('0x36')],'type':_0x568cce[_0x1792('0x37')][_0x1792('0x38')]};});_0x5414ce[_0x1792('0x39')]=_[_0x1792('0x34')](_0x17e05a,_0x1792('0x31'));_0x5414ce['query']=_[_0x1792('0x3a')](_0x45093e['query']);_0x5414ce[_0x1792('0x3b')]=_['intersection'](_0x5414ce[_0x1792('0x39')],_0x5414ce[_0x1792('0x3c')]);_0x449962[_0x1792('0x3d')]=_[_0x1792('0x3e')](_0x5414ce[_0x1792('0x39')],qs['fields'](_0x45093e[_0x1792('0x3c')][_0x1792('0x3f')]));_0x449962[_0x1792('0x3d')]=_0x449962[_0x1792('0x3d')][_0x1792('0x40')]?_0x449962[_0x1792('0x3d')]:_0x5414ce[_0x1792('0x39')];if(!_0x45093e[_0x1792('0x3c')][_0x1792('0x41')](_0x1792('0x42'))){_0x449962['limit']=qs['limit'](_0x45093e[_0x1792('0x3c')][_0x1792('0x24')]);_0x449962[_0x1792('0x22')]=qs[_0x1792('0x22')](_0x45093e[_0x1792('0x3c')][_0x1792('0x22')]);}_0x449962[_0x1792('0x43')]=qs[_0x1792('0x44')](_0x45093e[_0x1792('0x3c')][_0x1792('0x44')]);_0x449962['where']=qs['filters'](_['pick'](_0x45093e['query'],_0x5414ce[_0x1792('0x3b')]),_0x17e05a);if(_0x45093e[_0x1792('0x3c')][_0x1792('0x45')]){_0x449962[_0x1792('0x46')]=_[_0x1792('0x47')](_0x449962[_0x1792('0x46')],{'$or':_[_0x1792('0x34')](_0x17e05a,function(_0x587bf3){if(_0x587bf3['type']!==_0x1792('0x48')){var _0x5c54f6={};_0x5c54f6[_0x587bf3[_0x1792('0x31')]]={'$like':'%'+_0x45093e[_0x1792('0x3c')][_0x1792('0x45')]+'%'};return _0x5c54f6;}})});}_0x449962=_[_0x1792('0x47')]({},_0x449962,_0x45093e[_0x1792('0x49')]);var _0x4827c6={'where':_0x449962[_0x1792('0x46')]};return db[_0x1792('0x4a')]['count'](_0x4827c6)[_0x1792('0x2b')](function(_0x4d1837){_0xad9e28['count']=_0x4d1837;if(_0x45093e[_0x1792('0x3c')][_0x1792('0x4b')]){_0x449962[_0x1792('0x4c')]=[{'all':!![]}];}return db[_0x1792('0x4a')][_0x1792('0x4d')](_0x449962);})[_0x1792('0x2b')](function(_0x1ae23b){_0xad9e28['rows']=_0x1ae23b;return _0xad9e28;})[_0x1792('0x2b')](respondWithFilteredResult(_0xe6c80b,_0x449962))[_0x1792('0x4e')](handleError(_0xe6c80b,null));};exports[_0x1792('0x4f')]=function(_0x22657a,_0xf5aec5){var _0x3ea84d={'raw':![],'where':{'id':_0x22657a[_0x1792('0x50')]['id']}},_0x4f2abe={};_0x4f2abe[_0x1792('0x39')]=_['keys'](db[_0x1792('0x4a')][_0x1792('0x35')]);_0x4f2abe[_0x1792('0x3c')]=_[_0x1792('0x3a')](_0x22657a[_0x1792('0x3c')]);_0x4f2abe[_0x1792('0x3b')]=_['intersection'](_0x4f2abe[_0x1792('0x39')],_0x4f2abe[_0x1792('0x3c')]);_0x3ea84d['attributes']=_[_0x1792('0x3e')](_0x4f2abe[_0x1792('0x39')],qs[_0x1792('0x3f')](_0x22657a[_0x1792('0x3c')][_0x1792('0x3f')]));_0x3ea84d[_0x1792('0x3d')]=_0x3ea84d[_0x1792('0x3d')][_0x1792('0x40')]?_0x3ea84d[_0x1792('0x3d')]:_0x4f2abe[_0x1792('0x39')];if(_0x22657a[_0x1792('0x3c')]['includeAll']){_0x3ea84d[_0x1792('0x4c')]=[{'all':!![]}];}_0x3ea84d=_[_0x1792('0x47')]({},_0x3ea84d,_0x22657a[_0x1792('0x49')]);return db[_0x1792('0x4a')]['find'](_0x3ea84d)[_0x1792('0x2b')](handleEntityNotFound(_0xf5aec5,null))[_0x1792('0x2b')](respondWithResult(_0xf5aec5,null))[_0x1792('0x4e')](handleError(_0xf5aec5,null));};exports['create']=function(_0x5435a0,_0x1f263b){return db[_0x1792('0x4a')][_0x1792('0x51')](_0x5435a0[_0x1792('0x52')],{})[_0x1792('0x2b')](function(_0x1b8585){var _0xad3439=_0x5435a0[_0x1792('0x53')][_0x1792('0x2c')]({'plain':!![]});if(!_0xad3439)throw new Error(_0x1792('0x54'));if(_0xad3439[_0x1792('0x55')]===_0x1792('0x53')){var _0x2be304=_0x1b8585[_0x1792('0x2c')]({'plain':!![]});var _0x1fba58=_0x1792('0x2d');return db[_0x1792('0x56')][_0x1792('0x57')]({'where':{'name':_0x1fba58,'userProfileId':_0xad3439[_0x1792('0x58')]},'raw':!![]})[_0x1792('0x2b')](function(_0x1bb477){if(_0x1bb477&&_0x1bb477[_0x1792('0x59')]===0x0){return db['UserProfileResource'][_0x1792('0x51')]({'name':_0x2be304[_0x1792('0x31')],'resourceId':_0x2be304['id'],'type':_0x1bb477[_0x1792('0x31')],'sectionId':_0x1bb477['id']},{})['then'](function(){return _0x1b8585;});}else{return _0x1b8585;}})['catch'](function(_0x3d0ffc){logger[_0x1792('0x2f')](_0x1792('0x5a'),_0x3d0ffc);throw _0x3d0ffc;});}return _0x1b8585;})['then'](respondWithResult(_0x1f263b,0xc9))['catch'](handleError(_0x1f263b,null));};exports['update']=function(_0x22421e,_0x155b67){if(_0x22421e['body']['id']){delete _0x22421e['body']['id'];}return db[_0x1792('0x4a')]['find']({'where':{'id':_0x22421e['params']['id']}})[_0x1792('0x2b')](handleEntityNotFound(_0x155b67,null))[_0x1792('0x2b')](saveUpdates(_0x22421e['body'],null))[_0x1792('0x2b')](respondWithResult(_0x155b67,null))['catch'](handleError(_0x155b67,null));};exports['destroy']=function(_0x1879aa,_0x503653){return db['CmList'][_0x1792('0x57')]({'where':{'id':_0x1879aa[_0x1792('0x50')]['id']}})[_0x1792('0x2b')](handleEntityNotFound(_0x503653,null))['then'](removeEntity(_0x503653,null))[_0x1792('0x4e')](handleError(_0x503653,null));};exports[_0x1792('0x5b')]=function(_0x59995d,_0x1f8ac5){return db[_0x1792('0x4a')][_0x1792('0x5b')]()[_0x1792('0x2b')](respondWithResult(_0x1f8ac5,null))['catch'](handleError(_0x1f8ac5,null));};exports[_0x1792('0x5c')]=function(_0x341e63,_0x573147,_0x42199b){if(_0x341e63['body']['id']){delete _0x341e63[_0x1792('0x52')]['id'];}return db['CmList'][_0x1792('0x57')]({'where':{'id':_0x341e63[_0x1792('0x50')]['id']}})['then'](handleEntityNotFound(_0x573147,null))[_0x1792('0x2b')](function(_0x5cc081){if(_0x5cc081){_0x341e63[_0x1792('0x52')]['ListId']=_0x5cc081['id'];return db[_0x1792('0x5d')][_0x1792('0x51')](_0x341e63[_0x1792('0x52')]);}})['then'](respondWithResult(_0x573147,null))['catch'](handleError(_0x573147,null));};exports[_0x1792('0x5e')]=function(_0x30cbfd,_0x50dec1,_0x3ee421){var _0x263390={'raw':![],'where':{}};var _0x4dd74e={};var _0x3b68aa={'count':0x0,'rows':[]};return db[_0x1792('0x4a')][_0x1792('0x5f')]({'where':{'id':_0x30cbfd['params']['id']}})[_0x1792('0x2b')](handleEntityNotFound(_0x50dec1,null))[_0x1792('0x2b')](function(_0x422ea9){if(_0x422ea9){_0x4dd74e[_0x1792('0x39')]=_[_0x1792('0x3a')](db[_0x1792('0x5d')]['rawAttributes']);_0x4dd74e[_0x1792('0x3c')]=_[_0x1792('0x3a')](_0x30cbfd[_0x1792('0x3c')]);_0x4dd74e[_0x1792('0x3b')]=_[_0x1792('0x3e')](_0x4dd74e[_0x1792('0x39')],_0x4dd74e[_0x1792('0x3c')]);_0x263390[_0x1792('0x3d')]=_[_0x1792('0x3e')](_0x4dd74e[_0x1792('0x39')],qs[_0x1792('0x3f')](_0x30cbfd[_0x1792('0x3c')]['fields']));_0x263390['attributes']=_0x263390['attributes'][_0x1792('0x40')]?_0x263390[_0x1792('0x3d')]:_0x4dd74e[_0x1792('0x39')];if(!_0x30cbfd[_0x1792('0x3c')][_0x1792('0x41')]('nolimit')){_0x263390['limit']=qs['limit'](_0x30cbfd['query'][_0x1792('0x24')]);_0x263390['offset']=qs[_0x1792('0x22')](_0x30cbfd[_0x1792('0x3c')][_0x1792('0x22')]);}_0x263390['order']=qs[_0x1792('0x44')](_0x30cbfd[_0x1792('0x3c')][_0x1792('0x44')]);_0x263390[_0x1792('0x46')]=qs[_0x1792('0x3b')](_[_0x1792('0x60')](_0x30cbfd['query'],_0x4dd74e[_0x1792('0x3b')]));_0x263390[_0x1792('0x46')][_0x1792('0x61')]=_0x422ea9['id'];if(_0x30cbfd[_0x1792('0x3c')][_0x1792('0x45')]){_0x263390['where']=_[_0x1792('0x47')](_0x263390['where'],{'$or':_['map'](_0x263390[_0x1792('0x3d')],function(_0x19a12f){var _0x28b689={};_0x28b689[_0x19a12f]={'$like':'%'+_0x30cbfd[_0x1792('0x3c')][_0x1792('0x45')]+'%'};return _0x28b689;})});}_0x263390=_[_0x1792('0x47')]({},_0x263390,_0x30cbfd[_0x1792('0x49')]);return db[_0x1792('0x5d')][_0x1792('0x25')]({'where':_0x263390[_0x1792('0x46')]})['then'](function(_0x3b3194){_0x3b68aa[_0x1792('0x25')]=_0x3b3194;if(_0x30cbfd['query'][_0x1792('0x4b')]){_0x263390[_0x1792('0x4c')]=[{'all':!![]}];}return db[_0x1792('0x5d')][_0x1792('0x4d')](_0x263390);})[_0x1792('0x2b')](function(_0x4f0f74){_0x3b68aa[_0x1792('0x62')]=_0x4f0f74;return _0x3b68aa;});}})[_0x1792('0x2b')](respondWithFilteredResult(_0x50dec1,_0x263390))[_0x1792('0x4e')](handleError(_0x50dec1,null));};exports['removeDispositions']=function(_0x73780e,_0x28925d,_0x3c98e6){return db[_0x1792('0x4a')][_0x1792('0x57')]({'where':{'id':_0x73780e['params']['id']}})[_0x1792('0x2b')](handleEntityNotFound(_0x28925d,null))[_0x1792('0x2b')](function(_0x24fd7d){if(_0x24fd7d){return _0x24fd7d['removeDispositions'](_0x73780e[_0x1792('0x3c')]['ids']);}})[_0x1792('0x2b')](respondWithStatusCode(_0x28925d,null))['catch'](handleError(_0x28925d,null));};exports[_0x1792('0x63')]=function(_0x17dde3,_0x254769,_0x402dfb){return db[_0x1792('0x4a')][_0x1792('0x57')]({'where':{'id':_0x17dde3[_0x1792('0x50')]['id']}})[_0x1792('0x2b')](handleEntityNotFound(_0x254769,null))[_0x1792('0x2b')](function(_0x3b1729){if(_0x3b1729){var _0x50bc6b=[];var _0x3a2854={'success':[],'errors':[]};return db[_0x1792('0x64')][_0x1792('0x5b')]()[_0x1792('0x2b')](function(_0x29cb10){if(_0x17dde3[_0x1792('0x52')][_0x1792('0x65')]&&_['isArray'](_0x17dde3[_0x1792('0x52')][_0x1792('0x65')])){if(_0x17dde3[_0x1792('0x52')][_0x1792('0x65')]['length']){_0x17dde3['body'][_0x1792('0x65')]=_0x17dde3[_0x1792('0x52')]['tags'][_0x1792('0x66')](';')+';';}else{_0x17dde3[_0x1792('0x52')]['tags']=null;}}else{_0x17dde3[_0x1792('0x52')]['tags']=null;}if(_0x17dde3['body']&&_[_0x1792('0x67')](_0x17dde3['body'])){for(var _0x16eba7=0x0;_0x16eba7<_0x17dde3[_0x1792('0x52')][_0x1792('0x40')];_0x16eba7+=0x1){_0x17dde3['body'][_0x16eba7][_0x1792('0x61')]=_0x17dde3[_0x1792('0x50')]['id'];_0x50bc6b[_0x1792('0x68')](_0x17dde3[_0x1792('0x52')][_0x16eba7]);}return BPromise[_0x1792('0x69')](_0x50bc6b,function(_0x5b6efe){return db['CmContact']['create'](_['omit'](_0x5b6efe,[_0x1792('0x6a'),'id'])||{},{'fields':_[_0x1792('0x3a')](_0x29cb10),'raw':!![]})[_0x1792('0x2b')](function(_0x1f3514){_0x3a2854[_0x1792('0x6b')]['push'](_0x1f3514[_0x1792('0x6c')]);})['catch'](function(_0x46ec0a){_0x3a2854[_0x1792('0x6d')][_0x1792('0x68')]({'data':_0x5b6efe,'error':_0x46ec0a['message']});});})[_0x1792('0x2b')](function(_0x2b194c){return _0x3a2854;})[_0x1792('0x4e')](function(_0x1230a9){return _0x1230a9;});}else{_0x254769[_0x1792('0x1f')](0x190)[_0x1792('0x21')]({'message':_0x1792('0x6e')});}});}})[_0x1792('0x2b')](respondWithResult(_0x254769,null))[_0x1792('0x4e')](handleError(_0x254769,null));};exports[_0x1792('0x6f')]=function(_0x43c330,_0x5069a3,_0x31c4a3){var _0xdfd7af;return db[_0x1792('0x4a')][_0x1792('0x57')]({'where':{'id':_0x43c330[_0x1792('0x50')]['id']},'include':[{'model':db[_0x1792('0x70')],'as':_0x1792('0x71')}]})[_0x1792('0x2b')](handleEntityNotFound(_0x5069a3,null))[_0x1792('0x2b')](function(_0x34196b){if(_0x34196b){_0xdfd7af=_0x34196b;return db['CmContact']['rawAttributes'];}})[_0x1792('0x2b')](function(_0x5dd8a9){if(_0x5dd8a9){var _0x5d99af={};var _0x37b8b4={};_0x37b8b4['model']=_[_0x1792('0x72')](_[_0x1792('0x3a')](_0x5dd8a9),_[_0x1792('0x34')](_0xdfd7af[_0x1792('0x71')],function(_0x14dc5c){return util['format']('cf_%d',_0x14dc5c['id']);}));_0x37b8b4[_0x1792('0x3c')]=_[_0x1792('0x3a')](_0x43c330[_0x1792('0x3c')]);_0x37b8b4['filters']=_['intersection'](_0x37b8b4['model'],_0x37b8b4[_0x1792('0x3c')]);_0x5d99af[_0x1792('0x3d')]=_[_0x1792('0x3e')](_0x37b8b4['model'],qs['fields'](_0x43c330['query'][_0x1792('0x3f')]));_0x5d99af[_0x1792('0x3d')]=_0x5d99af[_0x1792('0x3d')][_0x1792('0x40')]?_0x5d99af[_0x1792('0x3d')]:_0x37b8b4['model'];if(!_0x43c330[_0x1792('0x3c')][_0x1792('0x41')](_0x1792('0x42'))){_0x5d99af[_0x1792('0x24')]=qs[_0x1792('0x24')](_0x43c330[_0x1792('0x3c')][_0x1792('0x24')]);_0x5d99af[_0x1792('0x22')]=qs['offset'](_0x43c330[_0x1792('0x3c')][_0x1792('0x22')]);}_0x5d99af[_0x1792('0x43')]=qs['sort'](_0x43c330[_0x1792('0x3c')][_0x1792('0x44')]);_0x5d99af[_0x1792('0x46')]=qs[_0x1792('0x3b')](_['pick'](_0x43c330[_0x1792('0x3c')],_0x37b8b4[_0x1792('0x3b')]));_0x5d99af[_0x1792('0x73')]=!![];if(_0x43c330[_0x1792('0x3c')][_0x1792('0x45')]){_0x5d99af[_0x1792('0x46')]=_[_0x1792('0x47')](_0x5d99af['where'],{'$or':_['map'](_0x5d99af[_0x1792('0x3d')],function(_0x10d4d8){var _0x2ad6ae={};_0x2ad6ae[_0x10d4d8]={'$like':'%'+_0x43c330[_0x1792('0x3c')][_0x1792('0x45')]+'%'};return _0x2ad6ae;})});}_0x5d99af=_['merge']({},_0x5d99af,_0x43c330[_0x1792('0x49')]);return _0xdfd7af[_0x1792('0x6f')](_0x5d99af);}})[_0x1792('0x2b')](respondWithResult(_0x5069a3,null))[_0x1792('0x4e')](handleError(_0x5069a3,null));};exports[_0x1792('0x74')]=function(_0x22699e,_0x52b186,_0x22b4fa){var _0x51c77;var _0x2deddc;var _0x46f2c1;var _0xa41164=_0x22699e[_0x1792('0x50')]['id'];csv_results=[];return db[_0x1792('0x75')][_0x1792('0x4d')]({'attributes':['id',_0x1792('0x31')],'raw':!![],'order':[_0x1792('0x76')]})['then'](function(_0x4ad13f){_0x51c77=_0x4ad13f;var _0xb52060=_[_0x1792('0x3a')](db['CmContact'][_0x1792('0x35')]);return db['CmCustomField'][_0x1792('0x4d')]({'raw':!![],'attributes':['id',_0x1792('0x77')]})[_0x1792('0x2b')](function(_0x288ca5){_0x2deddc=_0x288ca5;var _0x3974ab=squel['select']()['fields'](_0xb52060)['from'](_0x1792('0x78'),'c')[_0x1792('0x46')]('c.ListId\x20=\x20?',_0xa41164)['where'](_0x1792('0x79'))['distinct']();for(var _0x2bbc=0x0;_0x2bbc<_0x2deddc[_0x1792('0x40')];_0x2bbc++){_0x3974ab['field'](_0x1792('0x7a')+_0x2deddc[_0x2bbc]['id'],'customField_'+_0x2deddc[_0x2bbc][_0x1792('0x77')]);}for(var _0x2bbc=0x0;_0x2bbc<_0x51c77[_0x1792('0x40')];_0x2bbc++){_0x3974ab[_0x1792('0x7b')](squel['select']()[_0x1792('0x7b')](_0x1792('0x7c'))[_0x1792('0x7d')](_0x1792('0x7e'))['where'](_0x1792('0x7f'),_0x51c77[_0x2bbc]['id'])[_0x1792('0x46')](_0x1792('0x80')),'additionalPhone_'+_0x51c77[_0x2bbc][_0x1792('0x31')]);_0x3974ab[_0x1792('0x7b')](squel[_0x1792('0x81')]()[_0x1792('0x7b')](_0x1792('0x82'))[_0x1792('0x7d')]('cm_contact_has_items')['where'](_0x1792('0x7f'),_0x51c77[_0x2bbc]['id'])[_0x1792('0x46')](_0x1792('0x80')),_0x1792('0x83')+_0x51c77[_0x2bbc][_0x1792('0x31')]);}var _0x1eed1d=[];_0x1eed1d[_0x1792('0x68')](_0x3974ab[_0x1792('0x84')]());BPromise['each'](_0x1eed1d,handleQuery)[_0x1792('0x2b')](function(_0x1691a7){handleQuery(_0x3974ab[_0x1792('0x84')]());var _0x2edd19=csv_results[0x0];if(!_['isEmpty'](_0x2edd19)){var _0x28379c=toCsv(_0x2edd19);var _0x5a0744=Date[_0x1792('0x85')]();fs[_0x1792('0x86')](util[_0x1792('0x87')](_0x1792('0x88'),_0xa41164,_0x5a0744),_0x28379c);_0x52b186['setHeader']('Content-disposition',_0x1792('0x89')+util[_0x1792('0x87')](_0x1792('0x8a'),_0xa41164,_0x5a0744));_0x52b186['setHeader']('Content-type',_0x1792('0x8b'));return _0x52b186['download'](util['format']('/tmp/list_%d_%s.csv',_0xa41164,_0x5a0744));}else{return _0x52b186[_0x1792('0x1e')](0xcc);}});});});};exports[_0x1792('0x8c')]=function(_0x1973cf,_0x1b4d31,_0x1ebc4b){var _0x47a498;delete _0x1973cf[_0x1792('0x52')]['id'];return db[_0x1792('0x4a')][_0x1792('0x5f')]({'where':{'id':_0x1973cf['params']['id']}})[_0x1792('0x2b')](handleEntityNotFound(_0x1b4d31,null))['then'](function(_0x1d8bc1){if(_0x1d8bc1){return db[_0x1792('0x8d')][_0x1792('0x8e')](function(_0xeefd2c){return db[_0x1792('0x70')][_0x1792('0x51')](_0x1973cf[_0x1792('0x52')],{'transaction':_0xeefd2c})['then'](function(_0x3d4eda){_0x47a498=_0x3d4eda;return _0x1d8bc1[_0x1792('0x8f')](_0x3d4eda,{'transaction':_0xeefd2c});})[_0x1792('0x2b')](function(){var _0x3bf68a={'type':db[_0x1792('0x90')][_0x1792('0x91')],'transaction':_0xeefd2c};switch(_0x1973cf['body'][_0x1792('0x37')]){case _0x1792('0x92'):_0x3bf68a[_0x1792('0x37')]=db[_0x1792('0x90')]['TEXT'];break;case _0x1792('0x93'):_0x3bf68a['type']=db['Sequelize'][_0x1792('0x94')];break;case _0x1792('0x95'):_0x3bf68a[_0x1792('0x37')]=db[_0x1792('0x90')]['BOOLEAN'];_0x3bf68a[_0x1792('0x96')]=![];break;default:}return db['sequelize'][_0x1792('0x97')][_0x1792('0x98')]('cm_contacts',util[_0x1792('0x87')](_0x1792('0x99'),_0x47a498['id']),_0x3bf68a);})[_0x1792('0x2b')](function(){return _0x47a498;});});}})['then'](respondWithResult(_0x1b4d31,null))[_0x1792('0x4e')](handleError(_0x1b4d31,null));};exports['getCustomFields']=function(_0x5cc688,_0x4cb4e1,_0x52269c){var _0x9e5f5d={};var _0x36fa7d={};var _0xe3aec3;var _0x1d113c;return db[_0x1792('0x4a')]['findOne']({'where':{'id':_0x5cc688[_0x1792('0x50')]['id']}})[_0x1792('0x2b')](handleEntityNotFound(_0x4cb4e1,null))['then'](function(_0xdb8d2b){if(_0xdb8d2b){_0xe3aec3=_0xdb8d2b;_0x36fa7d[_0x1792('0x39')]=_['keys'](db[_0x1792('0x70')][_0x1792('0x35')]);_0x36fa7d[_0x1792('0x3c')]=_[_0x1792('0x3a')](_0x5cc688[_0x1792('0x3c')]);_0x36fa7d[_0x1792('0x3b')]=_[_0x1792('0x3e')](_0x36fa7d[_0x1792('0x39')],_0x36fa7d[_0x1792('0x3c')]);_0x9e5f5d[_0x1792('0x3d')]=_[_0x1792('0x3e')](_0x36fa7d[_0x1792('0x39')],qs[_0x1792('0x3f')](_0x5cc688[_0x1792('0x3c')]['fields']));_0x9e5f5d[_0x1792('0x3d')]=_0x9e5f5d['attributes'][_0x1792('0x40')]?_0x9e5f5d['attributes']:_0x36fa7d[_0x1792('0x39')];_0x9e5f5d[_0x1792('0x43')]=qs[_0x1792('0x44')](_0x5cc688['query'][_0x1792('0x44')]);_0x9e5f5d[_0x1792('0x46')]=qs['filters'](_[_0x1792('0x60')](_0x5cc688[_0x1792('0x3c')],_0x36fa7d['filters']));_0x9e5f5d[_0x1792('0x46')]=_[_0x1792('0x47')](_0x9e5f5d['where'],{'$or':[{'ListId':_0xdb8d2b['id']},{'ListId':null}]});if(_0x5cc688[_0x1792('0x3c')][_0x1792('0x45')]){_0x9e5f5d[_0x1792('0x46')]=_[_0x1792('0x47')](_0x9e5f5d[_0x1792('0x46')],{'$or':_[_0x1792('0x34')](_0x9e5f5d[_0x1792('0x3d')],function(_0x482276){var _0x33768b={};_0x33768b[_0x482276]={'$like':'%'+_0x5cc688[_0x1792('0x3c')][_0x1792('0x45')]+'%'};return _0x33768b;})});}_0x9e5f5d=_['merge']({},_0x9e5f5d,_0x5cc688[_0x1792('0x49')]);return db['CmCustomField'][_0x1792('0x9a')](_0x9e5f5d);}})[_0x1792('0x2b')](respondWithResult(_0x4cb4e1,null))[_0x1792('0x4e')](handleError(_0x4cb4e1,null));};exports[_0x1792('0x9b')]=function(_0x196142,_0x3df176){return db[_0x1792('0x70')][_0x1792('0x9a')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x3df176,null))[_0x1792('0x2b')](function(_0x212b6c){return _0x212b6c;})['then'](respondWithResult(_0x3df176,null))[_0x1792('0x4e')](handleError(_0x3df176,null));};exports['addAgents']=function(_0x3e5d20,_0x284117,_0x5a031c){return db[_0x1792('0x4a')][_0x1792('0x57')]({'where':{'id':_0x3e5d20['params']['id']}})[_0x1792('0x2b')](handleEntityNotFound(_0x284117,null))['then'](function(_0xf0f1fe){if(_0xf0f1fe){return _0xf0f1fe['addAgents'](_0x3e5d20[_0x1792('0x52')][_0x1792('0x6a')],_['omit'](_0x3e5d20[_0x1792('0x52')],[_0x1792('0x6a'),'id'])||{})[_0x1792('0x9c')](function(_0xf01aed){for(var _0x4805c8=0x0;_0x4805c8<_0x3e5d20['body']['ids']['length'];_0x4805c8+=0x1){socket[_0x1792('0x9d')](_0x1792('0x9e'),{'UserId':Number(_0x3e5d20[_0x1792('0x52')][_0x1792('0x6a')][_0x4805c8]),'CmListId':Number(_0x3e5d20[_0x1792('0x50')]['id'])});}return _0xf01aed;});}})[_0x1792('0x2b')](respondWithResult(_0x284117,null))[_0x1792('0x4e')](handleError(_0x284117,null));};exports[_0x1792('0x9f')]=function(_0x2dd02e,_0x102476,_0x19945a){return db[_0x1792('0x4a')][_0x1792('0x57')]({'where':{'id':_0x2dd02e[_0x1792('0x50')]['id']}})[_0x1792('0x2b')](handleEntityNotFound(_0x102476,null))['then'](function(_0x5dc146){if(_0x5dc146){return _0x5dc146[_0x1792('0x9f')](_0x2dd02e[_0x1792('0x3c')][_0x1792('0x6a')])[_0x1792('0x2b')](function(){if(_[_0x1792('0x67')](_0x2dd02e[_0x1792('0x3c')][_0x1792('0x6a')])){for(var _0x28602d=0x0;_0x28602d<_0x2dd02e[_0x1792('0x3c')]['ids']['length'];_0x28602d+=0x1){socket[_0x1792('0x9d')](_0x1792('0xa0'),{'UserId':Number(_0x2dd02e[_0x1792('0x3c')][_0x1792('0x6a')][_0x28602d]),'CmListId':Number(_0x2dd02e[_0x1792('0x50')]['id'])});}}else{socket['emit'](_0x1792('0xa0'),{'UserId':Number(_0x2dd02e[_0x1792('0x3c')][_0x1792('0x6a')]),'CmListId':Number(_0x2dd02e['params']['id'])});}});}})[_0x1792('0x2b')](respondWithStatusCode(_0x102476,null))[_0x1792('0x4e')](handleError(_0x102476,null));};exports[_0x1792('0xa1')]=function(_0xc51975,_0x2713a7,_0x4c8092){var _0x637f4e={};var _0x17b624={};var _0x2ab8fa;var _0xc3bdf1;return db['CmList'][_0x1792('0x5f')]({'where':{'id':_0xc51975[_0x1792('0x50')]['id']}})[_0x1792('0x2b')](handleEntityNotFound(_0x2713a7,null))['then'](function(_0x2bf8ab){if(_0x2bf8ab){_0x2ab8fa=_0x2bf8ab;_0x17b624[_0x1792('0x39')]=_[_0x1792('0x3a')](db['User'][_0x1792('0x35')]);_0x17b624[_0x1792('0x3c')]=_['keys'](_0xc51975[_0x1792('0x3c')]);_0x17b624['filters']=_[_0x1792('0x3e')](_0x17b624[_0x1792('0x39')],_0x17b624['query']);_0x637f4e['attributes']=_['intersection'](_0x17b624[_0x1792('0x39')],qs[_0x1792('0x3f')](_0xc51975['query'][_0x1792('0x3f')]));_0x637f4e[_0x1792('0x3d')]=_0x637f4e['attributes']['length']?_0x637f4e[_0x1792('0x3d')]:_0x17b624[_0x1792('0x39')];_0x637f4e[_0x1792('0x43')]=qs[_0x1792('0x44')](_0xc51975[_0x1792('0x3c')][_0x1792('0x44')]);_0x637f4e[_0x1792('0x46')]=qs[_0x1792('0x3b')](_[_0x1792('0x60')](_0xc51975[_0x1792('0x3c')],_0x17b624[_0x1792('0x3b')]));if(_0xc51975[_0x1792('0x3c')][_0x1792('0x45')]){_0x637f4e[_0x1792('0x46')]=_[_0x1792('0x47')](_0x637f4e[_0x1792('0x46')],{'$or':_[_0x1792('0x34')](_0x637f4e[_0x1792('0x3d')],function(_0x1ab498){var _0x47ca19={};_0x47ca19[_0x1ab498]={'$like':'%'+_0xc51975['query'][_0x1792('0x45')]+'%'};return _0x47ca19;})});}_0x637f4e=_[_0x1792('0x47')]({},_0x637f4e,_0xc51975[_0x1792('0x49')]);return _0x2ab8fa[_0x1792('0xa1')](_0x637f4e);}})[_0x1792('0x2b')](function(_0x3bfb41){if(_0x3bfb41){_0xc3bdf1=_0x3bfb41['length'];if(!_0xc51975[_0x1792('0x3c')][_0x1792('0x41')](_0x1792('0x42'))){_0x637f4e[_0x1792('0x24')]=qs[_0x1792('0x24')](_0xc51975[_0x1792('0x3c')][_0x1792('0x24')]);_0x637f4e['offset']=qs[_0x1792('0x22')](_0xc51975[_0x1792('0x3c')][_0x1792('0x22')]);}return _0x2ab8fa[_0x1792('0xa1')](_0x637f4e);}})[_0x1792('0x2b')](function(_0x1925a5){if(_0x1925a5){return _0x1925a5?{'count':_0xc3bdf1,'rows':_0x1925a5}:null;}})['then'](respondWithResult(_0x2713a7,null))[_0x1792('0x4e')](handleError(_0x2713a7,null));};function handleQuery(_0x542132){logger[_0x1792('0xa2')](_0x542132);return db[_0x1792('0x8d')][_0x1792('0x3c')](_0x542132)[_0x1792('0x9c')](function(_0x188416){csv_results['push'](_0x188416);})[_0x1792('0x4e')](function(_0x8d72fc){logger[_0x1792('0x2f')](_0x8d72fc[_0x1792('0xa3')]);});} \ No newline at end of file +var _0xaa5d=['cf_%d','hasOwnProperty','raw','getContactsCsv','findAll','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','toString','writeFileSync','format','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','omit','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','bluebird','mustache','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','get','UserProfileResource','then','error','name','send','index','map','CmList','rawAttributes','fieldName','query','keys','intersection','model','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','show','params','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','ListId','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat'];(function(_0x131e60,_0x5352ce){var _0x4bc497=function(_0x2a758e){while(--_0x2a758e){_0x131e60['push'](_0x131e60['shift']());}};_0x4bc497(++_0x5352ce);}(_0xaa5d,0xd2));var _0xdaa5=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0xaa5d[_0x16dbfd];return _0x382254;};'use strict';var emlformat=require(_0xdaa5('0x0'));var rimraf=require(_0xdaa5('0x1'));var zipdir=require(_0xdaa5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdaa5('0x3'));var Mustache=require(_0xdaa5('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdaa5('0x5'));var fs=require('fs');var fs_extra=require(_0xdaa5('0x6'));var _=require(_0xdaa5('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdaa5('0x8'));var deskjs=require(_0xdaa5('0x9'));var toCsv=require(_0xdaa5('0xa'));var querystring=require(_0xdaa5('0xb'));var Papa=require(_0xdaa5('0xc'));var Redis=require(_0xdaa5('0xd'));var authService=require(_0xdaa5('0xe'));var qs=require(_0xdaa5('0xf'));var as=require(_0xdaa5('0x10'));var hardwareService=require(_0xdaa5('0x11'));var logger=require(_0xdaa5('0x12'))('api');var utils=require(_0xdaa5('0x13'));var config=require(_0xdaa5('0x14'));var licenseUtil=require(_0xdaa5('0x15'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xdaa5('0x16')]=_[_0xdaa5('0x17')](config[_0xdaa5('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xdaa5('0x18'))(new Redis(config[_0xdaa5('0x16')]));require(_0xdaa5('0x19'))['register'](socket);function respondWithStatusCode(_0x16e7b5,_0x3747d4){_0x3747d4=_0x3747d4||0xcc;return function(_0x319009){if(_0x319009){return _0x16e7b5[_0xdaa5('0x1a')](_0x3747d4);}return _0x16e7b5['status'](_0x3747d4)[_0xdaa5('0x1b')]();};}function respondWithResult(_0x32577d,_0x2710b2){_0x2710b2=_0x2710b2||0xc8;return function(_0x3d3ffd){if(_0x3d3ffd){return _0x32577d[_0xdaa5('0x1c')](_0x2710b2)[_0xdaa5('0x1d')](_0x3d3ffd);}};}function respondWithFilteredResult(_0x39d970,_0x399f6b){return function(_0x34e249){if(_0x34e249){var _0x42b7fd=typeof _0x399f6b[_0xdaa5('0x1e')]==='undefined'&&typeof _0x399f6b[_0xdaa5('0x1f')]===_0xdaa5('0x20');var _0x1f89b4=_0x34e249[_0xdaa5('0x21')];var _0x534de0=_0x42b7fd?0x0:_0x399f6b[_0xdaa5('0x1e')];var _0x4af002=_0x42b7fd?_0x34e249['count']:_0x399f6b[_0xdaa5('0x1e')]+_0x399f6b[_0xdaa5('0x1f')];var _0x93a9ea;if(_0x4af002>=_0x1f89b4){_0x4af002=_0x1f89b4;_0x93a9ea=0xc8;}else{_0x93a9ea=0xce;}_0x39d970[_0xdaa5('0x1c')](_0x93a9ea);return _0x39d970[_0xdaa5('0x22')]('Content-Range',_0x534de0+'-'+_0x4af002+'/'+_0x1f89b4)[_0xdaa5('0x1d')](_0x34e249);}return null;};}function patchUpdates(_0x5d3c67){return function(_0x5ae7ae){try{jsonpatch[_0xdaa5('0x23')](_0x5ae7ae,_0x5d3c67,!![]);}catch(_0x1f6342){return BPromise[_0xdaa5('0x24')](_0x1f6342);}return _0x5ae7ae[_0xdaa5('0x25')]();};}function saveUpdates(_0x7fdbc8,_0x22eaba){return function(_0x45a3b3){if(_0x45a3b3){return _0x45a3b3[_0xdaa5('0x26')](_0x7fdbc8)['then'](function(_0x1063b0){return _0x1063b0;});}return null;};}function removeEntity(_0xe0d95,_0x3ea751){return function(_0x2550ed){if(_0x2550ed){return _0x2550ed[_0xdaa5('0x27')]()['then'](function(){var _0x270969=_0x2550ed[_0xdaa5('0x28')]({'plain':!![]});var _0x1f8bbe='Lists';return db[_0xdaa5('0x29')][_0xdaa5('0x27')]({'where':{'type':_0x1f8bbe,'resourceId':_0x270969['id']}})[_0xdaa5('0x2a')](function(){return _0x2550ed;});})[_0xdaa5('0x2a')](function(){_0xe0d95[_0xdaa5('0x1c')](0xcc)[_0xdaa5('0x1b')]();});}};}function handleEntityNotFound(_0x48c0e3,_0x327f38){return function(_0x41e522){if(!_0x41e522){_0x48c0e3[_0xdaa5('0x1a')](0x194);}return _0x41e522;};}function handleError(_0x1f55a1,_0xc167fb){_0xc167fb=_0xc167fb||0x1f4;return function(_0x26ea04){logger[_0xdaa5('0x2b')](_0x26ea04['stack']);if(_0x26ea04[_0xdaa5('0x2c')]){delete _0x26ea04[_0xdaa5('0x2c')];}_0x1f55a1[_0xdaa5('0x1c')](_0xc167fb)[_0xdaa5('0x2d')](_0x26ea04);};}exports[_0xdaa5('0x2e')]=function(_0x2d08c6,_0x4723e0){var _0x13cdf8={},_0x22416e={},_0x4703f8={'count':0x0,'rows':[]};var _0x5a37bd=_[_0xdaa5('0x2f')](db[_0xdaa5('0x30')][_0xdaa5('0x31')],function(_0x339620){return{'name':_0x339620[_0xdaa5('0x32')],'type':_0x339620['type']['key']};});_0x22416e['model']=_[_0xdaa5('0x2f')](_0x5a37bd,_0xdaa5('0x2c'));_0x22416e[_0xdaa5('0x33')]=_[_0xdaa5('0x34')](_0x2d08c6['query']);_0x22416e['filters']=_[_0xdaa5('0x35')](_0x22416e[_0xdaa5('0x36')],_0x22416e[_0xdaa5('0x33')]);_0x13cdf8[_0xdaa5('0x37')]=_[_0xdaa5('0x35')](_0x22416e[_0xdaa5('0x36')],qs['fields'](_0x2d08c6[_0xdaa5('0x33')]['fields']));_0x13cdf8[_0xdaa5('0x37')]=_0x13cdf8[_0xdaa5('0x37')][_0xdaa5('0x38')]?_0x13cdf8[_0xdaa5('0x37')]:_0x22416e['model'];if(!_0x2d08c6[_0xdaa5('0x33')]['hasOwnProperty'](_0xdaa5('0x39'))){_0x13cdf8[_0xdaa5('0x1f')]=qs[_0xdaa5('0x1f')](_0x2d08c6[_0xdaa5('0x33')][_0xdaa5('0x1f')]);_0x13cdf8[_0xdaa5('0x1e')]=qs[_0xdaa5('0x1e')](_0x2d08c6[_0xdaa5('0x33')]['offset']);}_0x13cdf8[_0xdaa5('0x3a')]=qs[_0xdaa5('0x3b')](_0x2d08c6[_0xdaa5('0x33')]['sort']);_0x13cdf8[_0xdaa5('0x3c')]=qs[_0xdaa5('0x3d')](_[_0xdaa5('0x3e')](_0x2d08c6[_0xdaa5('0x33')],_0x22416e['filters']),_0x5a37bd);if(_0x2d08c6['query'][_0xdaa5('0x3f')]){_0x13cdf8[_0xdaa5('0x3c')]=_[_0xdaa5('0x40')](_0x13cdf8[_0xdaa5('0x3c')],{'$or':_[_0xdaa5('0x2f')](_0x5a37bd,function(_0x128d75){if(_0x128d75[_0xdaa5('0x41')]!=='VIRTUAL'){var _0x5d07d6={};_0x5d07d6[_0x128d75['name']]={'$like':'%'+_0x2d08c6[_0xdaa5('0x33')][_0xdaa5('0x3f')]+'%'};return _0x5d07d6;}})});}_0x13cdf8=_[_0xdaa5('0x40')]({},_0x13cdf8,_0x2d08c6[_0xdaa5('0x42')]);var _0x492867={'where':_0x13cdf8[_0xdaa5('0x3c')]};return db['CmList'][_0xdaa5('0x21')](_0x492867)['then'](function(_0x468c7a){_0x4703f8[_0xdaa5('0x21')]=_0x468c7a;if(_0x2d08c6['query'][_0xdaa5('0x43')]){_0x13cdf8[_0xdaa5('0x44')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x13cdf8);})[_0xdaa5('0x2a')](function(_0x2c5e14){_0x4703f8[_0xdaa5('0x45')]=_0x2c5e14;return _0x4703f8;})[_0xdaa5('0x2a')](respondWithFilteredResult(_0x4723e0,_0x13cdf8))['catch'](handleError(_0x4723e0,null));};exports[_0xdaa5('0x46')]=function(_0x3785a2,_0x3a0480){var _0x40f4c3={'raw':![],'where':{'id':_0x3785a2[_0xdaa5('0x47')]['id']}},_0x37743f={};_0x37743f[_0xdaa5('0x36')]=_[_0xdaa5('0x34')](db[_0xdaa5('0x30')][_0xdaa5('0x31')]);_0x37743f[_0xdaa5('0x33')]=_[_0xdaa5('0x34')](_0x3785a2[_0xdaa5('0x33')]);_0x37743f[_0xdaa5('0x3d')]=_[_0xdaa5('0x35')](_0x37743f[_0xdaa5('0x36')],_0x37743f[_0xdaa5('0x33')]);_0x40f4c3[_0xdaa5('0x37')]=_[_0xdaa5('0x35')](_0x37743f[_0xdaa5('0x36')],qs[_0xdaa5('0x48')](_0x3785a2[_0xdaa5('0x33')][_0xdaa5('0x48')]));_0x40f4c3[_0xdaa5('0x37')]=_0x40f4c3[_0xdaa5('0x37')]['length']?_0x40f4c3[_0xdaa5('0x37')]:_0x37743f[_0xdaa5('0x36')];if(_0x3785a2[_0xdaa5('0x33')][_0xdaa5('0x43')]){_0x40f4c3[_0xdaa5('0x44')]=[{'all':!![]}];}_0x40f4c3=_[_0xdaa5('0x40')]({},_0x40f4c3,_0x3785a2[_0xdaa5('0x42')]);return db['CmList'][_0xdaa5('0x49')](_0x40f4c3)[_0xdaa5('0x2a')](handleEntityNotFound(_0x3a0480,null))[_0xdaa5('0x2a')](respondWithResult(_0x3a0480,null))[_0xdaa5('0x4a')](handleError(_0x3a0480,null));};exports[_0xdaa5('0x4b')]=function(_0x12ff29,_0x4611b4){return db['CmList'][_0xdaa5('0x4b')](_0x12ff29[_0xdaa5('0x4c')],{})['then'](function(_0xf6ec7){var _0x564e77=_0x12ff29[_0xdaa5('0x4d')]['get']({'plain':!![]});if(!_0x564e77)throw new Error(_0xdaa5('0x4e'));if(_0x564e77[_0xdaa5('0x4f')]===_0xdaa5('0x4d')){var _0x55328e=_0xf6ec7[_0xdaa5('0x28')]({'plain':!![]});var _0x25a018='Lists';return db[_0xdaa5('0x50')][_0xdaa5('0x49')]({'where':{'name':_0x25a018,'userProfileId':_0x564e77[_0xdaa5('0x51')]},'raw':!![]})[_0xdaa5('0x2a')](function(_0x1e05ed){if(_0x1e05ed&&_0x1e05ed[_0xdaa5('0x52')]===0x0){return db[_0xdaa5('0x29')][_0xdaa5('0x4b')]({'name':_0x55328e['name'],'resourceId':_0x55328e['id'],'type':_0x1e05ed['name'],'sectionId':_0x1e05ed['id']},{})['then'](function(){return _0xf6ec7;});}else{return _0xf6ec7;}})[_0xdaa5('0x4a')](function(_0x2ac640){logger[_0xdaa5('0x2b')](_0xdaa5('0x53'),_0x2ac640);throw _0x2ac640;});}return _0xf6ec7;})[_0xdaa5('0x2a')](respondWithResult(_0x4611b4,0xc9))[_0xdaa5('0x4a')](handleError(_0x4611b4,null));};exports[_0xdaa5('0x26')]=function(_0x302acd,_0x21eb19){if(_0x302acd['body']['id']){delete _0x302acd['body']['id'];}return db[_0xdaa5('0x30')][_0xdaa5('0x49')]({'where':{'id':_0x302acd[_0xdaa5('0x47')]['id']}})[_0xdaa5('0x2a')](handleEntityNotFound(_0x21eb19,null))[_0xdaa5('0x2a')](saveUpdates(_0x302acd[_0xdaa5('0x4c')],null))[_0xdaa5('0x2a')](respondWithResult(_0x21eb19,null))[_0xdaa5('0x4a')](handleError(_0x21eb19,null));};exports['destroy']=function(_0x31d294,_0x31c00b){return db[_0xdaa5('0x30')]['find']({'where':{'id':_0x31d294['params']['id']}})[_0xdaa5('0x2a')](handleEntityNotFound(_0x31c00b,null))['then'](removeEntity(_0x31c00b,null))[_0xdaa5('0x4a')](handleError(_0x31c00b,null));};exports['describe']=function(_0xbe4b16,_0x14fb82){return db['CmList'][_0xdaa5('0x54')]()[_0xdaa5('0x2a')](respondWithResult(_0x14fb82,null))[_0xdaa5('0x4a')](handleError(_0x14fb82,null));};exports[_0xdaa5('0x55')]=function(_0x3e82cb,_0x2e4b87,_0x4dd66d){if(_0x3e82cb['body']['id']){delete _0x3e82cb['body']['id'];}return db[_0xdaa5('0x30')][_0xdaa5('0x49')]({'where':{'id':_0x3e82cb[_0xdaa5('0x47')]['id']}})[_0xdaa5('0x2a')](handleEntityNotFound(_0x2e4b87,null))[_0xdaa5('0x2a')](function(_0x3ce7fe){if(_0x3ce7fe){_0x3e82cb[_0xdaa5('0x4c')]['ListId']=_0x3ce7fe['id'];return db[_0xdaa5('0x56')][_0xdaa5('0x4b')](_0x3e82cb[_0xdaa5('0x4c')]);}})[_0xdaa5('0x2a')](respondWithResult(_0x2e4b87,null))['catch'](handleError(_0x2e4b87,null));};exports[_0xdaa5('0x57')]=function(_0x22b370,_0x37bef9,_0x276ec2){var _0x19780f={'raw':![],'where':{}};var _0x4101ee={};var _0x30af0c={'count':0x0,'rows':[]};return db[_0xdaa5('0x30')]['findOne']({'where':{'id':_0x22b370[_0xdaa5('0x47')]['id']}})[_0xdaa5('0x2a')](handleEntityNotFound(_0x37bef9,null))['then'](function(_0x658574){if(_0x658574){_0x4101ee[_0xdaa5('0x36')]=_[_0xdaa5('0x34')](db[_0xdaa5('0x56')][_0xdaa5('0x31')]);_0x4101ee[_0xdaa5('0x33')]=_[_0xdaa5('0x34')](_0x22b370[_0xdaa5('0x33')]);_0x4101ee[_0xdaa5('0x3d')]=_['intersection'](_0x4101ee[_0xdaa5('0x36')],_0x4101ee['query']);_0x19780f['attributes']=_['intersection'](_0x4101ee[_0xdaa5('0x36')],qs[_0xdaa5('0x48')](_0x22b370[_0xdaa5('0x33')][_0xdaa5('0x48')]));_0x19780f[_0xdaa5('0x37')]=_0x19780f['attributes']['length']?_0x19780f[_0xdaa5('0x37')]:_0x4101ee[_0xdaa5('0x36')];if(!_0x22b370[_0xdaa5('0x33')]['hasOwnProperty'](_0xdaa5('0x39'))){_0x19780f['limit']=qs[_0xdaa5('0x1f')](_0x22b370['query'][_0xdaa5('0x1f')]);_0x19780f[_0xdaa5('0x1e')]=qs[_0xdaa5('0x1e')](_0x22b370[_0xdaa5('0x33')]['offset']);}_0x19780f['order']=qs[_0xdaa5('0x3b')](_0x22b370[_0xdaa5('0x33')][_0xdaa5('0x3b')]);_0x19780f[_0xdaa5('0x3c')]=qs[_0xdaa5('0x3d')](_['pick'](_0x22b370['query'],_0x4101ee[_0xdaa5('0x3d')]));_0x19780f[_0xdaa5('0x3c')][_0xdaa5('0x58')]=_0x658574['id'];if(_0x22b370['query'][_0xdaa5('0x3f')]){_0x19780f[_0xdaa5('0x3c')]=_[_0xdaa5('0x40')](_0x19780f[_0xdaa5('0x3c')],{'$or':_['map'](_0x19780f[_0xdaa5('0x37')],function(_0x2e7f16){var _0x298648={};_0x298648[_0x2e7f16]={'$like':'%'+_0x22b370[_0xdaa5('0x33')][_0xdaa5('0x3f')]+'%'};return _0x298648;})});}_0x19780f=_['merge']({},_0x19780f,_0x22b370['options']);return db[_0xdaa5('0x56')][_0xdaa5('0x21')]({'where':_0x19780f['where']})[_0xdaa5('0x2a')](function(_0x3f52c2){_0x30af0c[_0xdaa5('0x21')]=_0x3f52c2;if(_0x22b370[_0xdaa5('0x33')][_0xdaa5('0x43')]){_0x19780f['include']=[{'all':!![]}];}return db[_0xdaa5('0x56')]['findAll'](_0x19780f);})[_0xdaa5('0x2a')](function(_0x185f12){_0x30af0c['rows']=_0x185f12;return _0x30af0c;});}})[_0xdaa5('0x2a')](respondWithFilteredResult(_0x37bef9,_0x19780f))['catch'](handleError(_0x37bef9,null));};exports[_0xdaa5('0x59')]=function(_0x14ccd6,_0x4b58b6,_0x52453e){return db[_0xdaa5('0x30')]['find']({'where':{'id':_0x14ccd6['params']['id']}})[_0xdaa5('0x2a')](handleEntityNotFound(_0x4b58b6,null))[_0xdaa5('0x2a')](function(_0x4f9585){if(_0x4f9585){return _0x4f9585['removeDispositions'](_0x14ccd6[_0xdaa5('0x33')][_0xdaa5('0x5a')]);}})[_0xdaa5('0x2a')](respondWithStatusCode(_0x4b58b6,null))[_0xdaa5('0x4a')](handleError(_0x4b58b6,null));};exports[_0xdaa5('0x5b')]=function(_0x9207ba,_0xf60bab,_0x50fb5d){return db[_0xdaa5('0x30')][_0xdaa5('0x49')]({'where':{'id':_0x9207ba[_0xdaa5('0x47')]['id']}})['then'](handleEntityNotFound(_0xf60bab,null))['then'](function(_0xff6b11){if(_0xff6b11){var _0x7cb9f5=[];var _0x55d0e6={'success':[],'errors':[]};return db[_0xdaa5('0x5c')][_0xdaa5('0x54')]()[_0xdaa5('0x2a')](function(_0x2bc50d){if(_0x9207ba[_0xdaa5('0x4c')]['tags']&&_['isArray'](_0x9207ba[_0xdaa5('0x4c')][_0xdaa5('0x5d')])){if(_0x9207ba[_0xdaa5('0x4c')][_0xdaa5('0x5d')]['length']){_0x9207ba['body']['tags']=_0x9207ba['body'][_0xdaa5('0x5d')][_0xdaa5('0x5e')](';')+';';}else{_0x9207ba[_0xdaa5('0x4c')][_0xdaa5('0x5d')]=null;}}else{_0x9207ba[_0xdaa5('0x4c')][_0xdaa5('0x5d')]=null;}if(_0x9207ba[_0xdaa5('0x4c')]&&_[_0xdaa5('0x5f')](_0x9207ba[_0xdaa5('0x4c')])){for(var _0x5aade2=0x0;_0x5aade2<_0x9207ba[_0xdaa5('0x4c')][_0xdaa5('0x38')];_0x5aade2+=0x1){_0x9207ba[_0xdaa5('0x4c')][_0x5aade2]['ListId']=_0x9207ba[_0xdaa5('0x47')]['id'];_0x7cb9f5[_0xdaa5('0x60')](_0x9207ba[_0xdaa5('0x4c')][_0x5aade2]);}return BPromise[_0xdaa5('0x61')](_0x7cb9f5,function(_0x11eaae){return db[_0xdaa5('0x5c')][_0xdaa5('0x4b')](_['omit'](_0x11eaae,['ids','id'])||{},{'fields':_['keys'](_0x2bc50d),'raw':!![]})[_0xdaa5('0x2a')](function(_0x5c7102){_0x55d0e6[_0xdaa5('0x62')][_0xdaa5('0x60')](_0x5c7102['dataValues']);})[_0xdaa5('0x4a')](function(_0x522409){_0x55d0e6[_0xdaa5('0x63')][_0xdaa5('0x60')]({'data':_0x11eaae,'error':_0x522409[_0xdaa5('0x64')]});});})[_0xdaa5('0x2a')](function(_0x3c4538){return _0x55d0e6;})[_0xdaa5('0x4a')](function(_0x109597){return _0x109597;});}else{_0xf60bab[_0xdaa5('0x1c')](0x190)[_0xdaa5('0x1d')]({'message':_0xdaa5('0x65')});}});}})[_0xdaa5('0x2a')](respondWithResult(_0xf60bab,null))[_0xdaa5('0x4a')](handleError(_0xf60bab,null));};exports[_0xdaa5('0x66')]=function(_0x1cde18,_0x1b6860,_0x52c4ef){var _0x20b794;return db['CmList']['find']({'where':{'id':_0x1cde18[_0xdaa5('0x47')]['id']},'include':[{'model':db[_0xdaa5('0x67')],'as':_0xdaa5('0x68')}]})[_0xdaa5('0x2a')](handleEntityNotFound(_0x1b6860,null))['then'](function(_0x4151d9){if(_0x4151d9){_0x20b794=_0x4151d9;return db[_0xdaa5('0x5c')][_0xdaa5('0x31')];}})[_0xdaa5('0x2a')](function(_0x47ffdf){if(_0x47ffdf){var _0x408bae={};var _0x4c78bf={};_0x4c78bf['model']=_[_0xdaa5('0x69')](_[_0xdaa5('0x34')](_0x47ffdf),_['map'](_0x20b794[_0xdaa5('0x68')],function(_0xd0dd9e){return util['format'](_0xdaa5('0x6a'),_0xd0dd9e['id']);}));_0x4c78bf['query']=_[_0xdaa5('0x34')](_0x1cde18[_0xdaa5('0x33')]);_0x4c78bf[_0xdaa5('0x3d')]=_[_0xdaa5('0x35')](_0x4c78bf['model'],_0x4c78bf[_0xdaa5('0x33')]);_0x408bae[_0xdaa5('0x37')]=_[_0xdaa5('0x35')](_0x4c78bf[_0xdaa5('0x36')],qs[_0xdaa5('0x48')](_0x1cde18[_0xdaa5('0x33')]['fields']));_0x408bae[_0xdaa5('0x37')]=_0x408bae[_0xdaa5('0x37')][_0xdaa5('0x38')]?_0x408bae[_0xdaa5('0x37')]:_0x4c78bf[_0xdaa5('0x36')];if(!_0x1cde18[_0xdaa5('0x33')][_0xdaa5('0x6b')](_0xdaa5('0x39'))){_0x408bae['limit']=qs[_0xdaa5('0x1f')](_0x1cde18[_0xdaa5('0x33')]['limit']);_0x408bae[_0xdaa5('0x1e')]=qs[_0xdaa5('0x1e')](_0x1cde18[_0xdaa5('0x33')][_0xdaa5('0x1e')]);}_0x408bae[_0xdaa5('0x3a')]=qs[_0xdaa5('0x3b')](_0x1cde18['query'][_0xdaa5('0x3b')]);_0x408bae[_0xdaa5('0x3c')]=qs[_0xdaa5('0x3d')](_['pick'](_0x1cde18['query'],_0x4c78bf['filters']));_0x408bae[_0xdaa5('0x6c')]=!![];if(_0x1cde18[_0xdaa5('0x33')][_0xdaa5('0x3f')]){_0x408bae[_0xdaa5('0x3c')]=_[_0xdaa5('0x40')](_0x408bae[_0xdaa5('0x3c')],{'$or':_[_0xdaa5('0x2f')](_0x408bae[_0xdaa5('0x37')],function(_0x47be7e){var _0x7be962={};_0x7be962[_0x47be7e]={'$like':'%'+_0x1cde18[_0xdaa5('0x33')]['filter']+'%'};return _0x7be962;})});}_0x408bae=_[_0xdaa5('0x40')]({},_0x408bae,_0x1cde18[_0xdaa5('0x42')]);return _0x20b794['getContacts'](_0x408bae);}})['then'](respondWithResult(_0x1b6860,null))[_0xdaa5('0x4a')](handleError(_0x1b6860,null));};exports[_0xdaa5('0x6d')]=function(_0xe63fb4,_0x57a9f8,_0x5a015e){var _0x3d5c49;var _0x5ba852;var _0x3af45b;var _0xbc70c6=_0xe63fb4[_0xdaa5('0x47')]['id'];csv_results=[];return db['ContactItemType'][_0xdaa5('0x6e')]({'attributes':['id',_0xdaa5('0x2c')],'raw':!![],'order':[_0xdaa5('0x6f')]})[_0xdaa5('0x2a')](function(_0x1326b3){_0x3d5c49=_0x1326b3;var _0x1f8f2d=_['keys'](db['CmContact']['rawAttributes']);return db['CmCustomField'][_0xdaa5('0x6e')]({'raw':!![],'attributes':['id',_0xdaa5('0x70')]})[_0xdaa5('0x2a')](function(_0x84ffaf){_0x5ba852=_0x84ffaf;var _0x1a76d6=squel[_0xdaa5('0x71')]()[_0xdaa5('0x48')](_0x1f8f2d)['from'](_0xdaa5('0x72'),'c')['where'](_0xdaa5('0x73'),_0xbc70c6)[_0xdaa5('0x3c')](_0xdaa5('0x74'))['distinct']();for(var _0x56c2b3=0x0;_0x56c2b3<_0x5ba852[_0xdaa5('0x38')];_0x56c2b3++){_0x1a76d6[_0xdaa5('0x75')](_0xdaa5('0x76')+_0x5ba852[_0x56c2b3]['id'],_0xdaa5('0x77')+_0x5ba852[_0x56c2b3][_0xdaa5('0x70')]);}for(var _0x56c2b3=0x0;_0x56c2b3<_0x3d5c49[_0xdaa5('0x38')];_0x56c2b3++){_0x1a76d6[_0xdaa5('0x75')](squel[_0xdaa5('0x71')]()[_0xdaa5('0x75')](_0xdaa5('0x78'))[_0xdaa5('0x79')](_0xdaa5('0x7a'))[_0xdaa5('0x3c')](_0xdaa5('0x7b'),_0x3d5c49[_0x56c2b3]['id'])[_0xdaa5('0x3c')](_0xdaa5('0x7c')),'additionalPhone_'+_0x3d5c49[_0x56c2b3]['name']);_0x1a76d6[_0xdaa5('0x75')](squel[_0xdaa5('0x71')]()[_0xdaa5('0x75')](_0xdaa5('0x7d'))[_0xdaa5('0x79')](_0xdaa5('0x7a'))[_0xdaa5('0x3c')]('ItemTypeId\x20=\x20?',_0x3d5c49[_0x56c2b3]['id'])[_0xdaa5('0x3c')](_0xdaa5('0x7c')),_0xdaa5('0x7e')+_0x3d5c49[_0x56c2b3][_0xdaa5('0x2c')]);}var _0x39fe17=[];_0x39fe17[_0xdaa5('0x60')](_0x1a76d6['toString']());BPromise[_0xdaa5('0x61')](_0x39fe17,handleQuery)[_0xdaa5('0x2a')](function(_0x3e8847){handleQuery(_0x1a76d6[_0xdaa5('0x7f')]());var _0x4b8da3=csv_results[0x0];if(!_['isEmpty'](_0x4b8da3)){var _0x4bac21=toCsv(_0x4b8da3);var _0xd71c39=Date['now']();fs[_0xdaa5('0x80')](util[_0xdaa5('0x81')]('/tmp/list_%d_%s.csv',_0xbc70c6,_0xd71c39),_0x4bac21);_0x57a9f8['setHeader'](_0xdaa5('0x82'),_0xdaa5('0x83')+util[_0xdaa5('0x81')]('list_%d_%s.csv',_0xbc70c6,_0xd71c39));_0x57a9f8[_0xdaa5('0x84')](_0xdaa5('0x85'),_0xdaa5('0x86'));return _0x57a9f8[_0xdaa5('0x87')](util[_0xdaa5('0x81')]('/tmp/list_%d_%s.csv',_0xbc70c6,_0xd71c39));}else{return _0x57a9f8[_0xdaa5('0x1a')](0xcc);}});});});};exports['addCustomField']=function(_0x5de997,_0x360ed8,_0xac19e0){var _0x5252cf;delete _0x5de997[_0xdaa5('0x4c')]['id'];return db[_0xdaa5('0x30')][_0xdaa5('0x88')]({'where':{'id':_0x5de997[_0xdaa5('0x47')]['id']}})[_0xdaa5('0x2a')](handleEntityNotFound(_0x360ed8,null))[_0xdaa5('0x2a')](function(_0x4c5ab5){if(_0x4c5ab5){return db[_0xdaa5('0x89')]['transaction'](function(_0x12187b){return db[_0xdaa5('0x67')]['create'](_0x5de997[_0xdaa5('0x4c')],{'transaction':_0x12187b})[_0xdaa5('0x2a')](function(_0x407b00){_0x5252cf=_0x407b00;return _0x4c5ab5[_0xdaa5('0x8a')](_0x407b00,{'transaction':_0x12187b});})[_0xdaa5('0x2a')](function(){var _0x130544={'type':db[_0xdaa5('0x8b')][_0xdaa5('0x8c')],'transaction':_0x12187b};switch(_0x5de997[_0xdaa5('0x4c')]['type']){case _0xdaa5('0x8d'):_0x130544[_0xdaa5('0x41')]=db['Sequelize'][_0xdaa5('0x8c')];break;case _0xdaa5('0x8e'):_0x130544[_0xdaa5('0x41')]=db[_0xdaa5('0x8b')]['INTEGER'];break;case'switch':_0x130544[_0xdaa5('0x41')]=db[_0xdaa5('0x8b')][_0xdaa5('0x8f')];_0x130544[_0xdaa5('0x90')]=![];break;default:}return db[_0xdaa5('0x89')][_0xdaa5('0x91')][_0xdaa5('0x92')]('cm_contacts',util[_0xdaa5('0x81')](_0xdaa5('0x93'),_0x5252cf['id']),_0x130544);})[_0xdaa5('0x2a')](function(){return _0x5252cf;});});}})['then'](respondWithResult(_0x360ed8,null))['catch'](handleError(_0x360ed8,null));};exports[_0xdaa5('0x94')]=function(_0x3dddb5,_0x1e838e,_0x1d65cc){var _0x5d5a8e={};var _0x31bf04={};var _0x4a62d4;var _0x192b8d;return db[_0xdaa5('0x30')]['findOne']({'where':{'id':_0x3dddb5[_0xdaa5('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e838e,null))['then'](function(_0x3998ec){if(_0x3998ec){_0x4a62d4=_0x3998ec;_0x31bf04['model']=_[_0xdaa5('0x34')](db[_0xdaa5('0x67')][_0xdaa5('0x31')]);_0x31bf04[_0xdaa5('0x33')]=_[_0xdaa5('0x34')](_0x3dddb5['query']);_0x31bf04['filters']=_[_0xdaa5('0x35')](_0x31bf04[_0xdaa5('0x36')],_0x31bf04['query']);_0x5d5a8e[_0xdaa5('0x37')]=_[_0xdaa5('0x35')](_0x31bf04[_0xdaa5('0x36')],qs[_0xdaa5('0x48')](_0x3dddb5['query'][_0xdaa5('0x48')]));_0x5d5a8e['attributes']=_0x5d5a8e[_0xdaa5('0x37')][_0xdaa5('0x38')]?_0x5d5a8e[_0xdaa5('0x37')]:_0x31bf04['model'];_0x5d5a8e[_0xdaa5('0x3a')]=qs['sort'](_0x3dddb5[_0xdaa5('0x33')][_0xdaa5('0x3b')]);_0x5d5a8e[_0xdaa5('0x3c')]=qs['filters'](_[_0xdaa5('0x3e')](_0x3dddb5[_0xdaa5('0x33')],_0x31bf04['filters']));_0x5d5a8e[_0xdaa5('0x3c')]=_['merge'](_0x5d5a8e[_0xdaa5('0x3c')],{'$or':[{'ListId':_0x3998ec['id']},{'ListId':null}]});if(_0x3dddb5['query'][_0xdaa5('0x3f')]){_0x5d5a8e[_0xdaa5('0x3c')]=_['merge'](_0x5d5a8e['where'],{'$or':_[_0xdaa5('0x2f')](_0x5d5a8e[_0xdaa5('0x37')],function(_0x3f62fb){var _0x65faf={};_0x65faf[_0x3f62fb]={'$like':'%'+_0x3dddb5[_0xdaa5('0x33')][_0xdaa5('0x3f')]+'%'};return _0x65faf;})});}_0x5d5a8e=_[_0xdaa5('0x40')]({},_0x5d5a8e,_0x3dddb5[_0xdaa5('0x42')]);return db['CmCustomField'][_0xdaa5('0x95')](_0x5d5a8e);}})[_0xdaa5('0x2a')](respondWithResult(_0x1e838e,null))['catch'](handleError(_0x1e838e,null));};exports[_0xdaa5('0x96')]=function(_0x480a43,_0x8d3009){return db[_0xdaa5('0x67')][_0xdaa5('0x95')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x8d3009,null))[_0xdaa5('0x2a')](function(_0x2700e3){return _0x2700e3;})[_0xdaa5('0x2a')](respondWithResult(_0x8d3009,null))[_0xdaa5('0x4a')](handleError(_0x8d3009,null));};exports['addAgents']=function(_0x3275a5,_0x335e2c,_0x1b7b0e){return db['CmList'][_0xdaa5('0x49')]({'where':{'id':_0x3275a5[_0xdaa5('0x47')]['id']}})['then'](handleEntityNotFound(_0x335e2c,null))[_0xdaa5('0x2a')](function(_0x2ba3d8){if(_0x2ba3d8){return _0x2ba3d8['addAgents'](_0x3275a5[_0xdaa5('0x4c')][_0xdaa5('0x5a')],_[_0xdaa5('0x97')](_0x3275a5[_0xdaa5('0x4c')],[_0xdaa5('0x5a'),'id'])||{})['spread'](function(_0x293391){for(var _0x574cd2=0x0;_0x574cd2<_0x3275a5[_0xdaa5('0x4c')][_0xdaa5('0x5a')][_0xdaa5('0x38')];_0x574cd2+=0x1){socket[_0xdaa5('0x98')](_0xdaa5('0x99'),{'UserId':Number(_0x3275a5['body'][_0xdaa5('0x5a')][_0x574cd2]),'CmListId':Number(_0x3275a5[_0xdaa5('0x47')]['id'])});}return _0x293391;});}})[_0xdaa5('0x2a')](respondWithResult(_0x335e2c,null))['catch'](handleError(_0x335e2c,null));};exports[_0xdaa5('0x9a')]=function(_0x3e0c17,_0x227a40,_0xbf5f53){return db[_0xdaa5('0x30')][_0xdaa5('0x49')]({'where':{'id':_0x3e0c17[_0xdaa5('0x47')]['id']}})[_0xdaa5('0x2a')](handleEntityNotFound(_0x227a40,null))[_0xdaa5('0x2a')](function(_0x3c249f){if(_0x3c249f){return _0x3c249f['removeAgents'](_0x3e0c17[_0xdaa5('0x33')][_0xdaa5('0x5a')])[_0xdaa5('0x2a')](function(){if(_['isArray'](_0x3e0c17[_0xdaa5('0x33')]['ids'])){for(var _0xbb71ba=0x0;_0xbb71ba<_0x3e0c17[_0xdaa5('0x33')][_0xdaa5('0x5a')]['length'];_0xbb71ba+=0x1){socket[_0xdaa5('0x98')](_0xdaa5('0x9b'),{'UserId':Number(_0x3e0c17[_0xdaa5('0x33')]['ids'][_0xbb71ba]),'CmListId':Number(_0x3e0c17['params']['id'])});}}else{socket[_0xdaa5('0x98')](_0xdaa5('0x9b'),{'UserId':Number(_0x3e0c17[_0xdaa5('0x33')]['ids']),'CmListId':Number(_0x3e0c17['params']['id'])});}});}})[_0xdaa5('0x2a')](respondWithStatusCode(_0x227a40,null))[_0xdaa5('0x4a')](handleError(_0x227a40,null));};exports[_0xdaa5('0x9c')]=function(_0x3f017f,_0x49cd2c,_0x5d573e){var _0x113a10={};var _0x5aeb2b={};var _0x443445;var _0x25d197;return db['CmList'][_0xdaa5('0x88')]({'where':{'id':_0x3f017f[_0xdaa5('0x47')]['id']}})[_0xdaa5('0x2a')](handleEntityNotFound(_0x49cd2c,null))['then'](function(_0x1b812e){if(_0x1b812e){_0x443445=_0x1b812e;_0x5aeb2b['model']=_[_0xdaa5('0x34')](db[_0xdaa5('0x9d')][_0xdaa5('0x31')]);_0x5aeb2b['query']=_[_0xdaa5('0x34')](_0x3f017f[_0xdaa5('0x33')]);_0x5aeb2b['filters']=_[_0xdaa5('0x35')](_0x5aeb2b['model'],_0x5aeb2b[_0xdaa5('0x33')]);_0x113a10[_0xdaa5('0x37')]=_['intersection'](_0x5aeb2b[_0xdaa5('0x36')],qs[_0xdaa5('0x48')](_0x3f017f[_0xdaa5('0x33')]['fields']));_0x113a10[_0xdaa5('0x37')]=_0x113a10[_0xdaa5('0x37')][_0xdaa5('0x38')]?_0x113a10['attributes']:_0x5aeb2b['model'];_0x113a10[_0xdaa5('0x3a')]=qs[_0xdaa5('0x3b')](_0x3f017f[_0xdaa5('0x33')][_0xdaa5('0x3b')]);_0x113a10[_0xdaa5('0x3c')]=qs[_0xdaa5('0x3d')](_[_0xdaa5('0x3e')](_0x3f017f[_0xdaa5('0x33')],_0x5aeb2b['filters']));if(_0x3f017f[_0xdaa5('0x33')]['filter']){_0x113a10[_0xdaa5('0x3c')]=_[_0xdaa5('0x40')](_0x113a10[_0xdaa5('0x3c')],{'$or':_[_0xdaa5('0x2f')](_0x113a10[_0xdaa5('0x37')],function(_0x23a7d5){var _0x3ddcdf={};_0x3ddcdf[_0x23a7d5]={'$like':'%'+_0x3f017f[_0xdaa5('0x33')][_0xdaa5('0x3f')]+'%'};return _0x3ddcdf;})});}_0x113a10=_['merge']({},_0x113a10,_0x3f017f[_0xdaa5('0x42')]);return _0x443445[_0xdaa5('0x9c')](_0x113a10);}})[_0xdaa5('0x2a')](function(_0x2138fd){if(_0x2138fd){_0x25d197=_0x2138fd[_0xdaa5('0x38')];if(!_0x3f017f['query'][_0xdaa5('0x6b')]('nolimit')){_0x113a10[_0xdaa5('0x1f')]=qs['limit'](_0x3f017f[_0xdaa5('0x33')][_0xdaa5('0x1f')]);_0x113a10[_0xdaa5('0x1e')]=qs[_0xdaa5('0x1e')](_0x3f017f[_0xdaa5('0x33')]['offset']);}return _0x443445[_0xdaa5('0x9c')](_0x113a10);}})[_0xdaa5('0x2a')](function(_0x243936){if(_0x243936){return _0x243936?{'count':_0x25d197,'rows':_0x243936}:null;}})[_0xdaa5('0x2a')](respondWithResult(_0x49cd2c,null))['catch'](handleError(_0x49cd2c,null));};function handleQuery(_0x1d66c2){logger['info'](_0x1d66c2);return db[_0xdaa5('0x89')]['query'](_0x1d66c2)['spread'](function(_0x519dca){csv_results[_0xdaa5('0x60')](_0x519dca);})[_0xdaa5('0x4a')](function(_0x217b90){logger[_0xdaa5('0x2b')](_0x217b90[_0xdaa5('0x64')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 98c4d96..54d1b3f 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x5fc3[_0x1cd47d];return _0x29d52f;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0xd2811e,_0x168a67){var _0x9a2a53=function(_0x14d24b){while(--_0x14d24b){_0xd2811e['push'](_0xd2811e['shift']());}};_0x9a2a53(++_0x168a67);}(_0x814b,0x1a2));var _0xb814=function(_0x571d85,_0xda439c){_0x571d85=_0x571d85-0x0;var _0x3c2e07=_0x814b[_0x571d85];return _0x3c2e07;};'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 757395e..716c0cd 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 _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20b953,_0x21188c){var _0x3c11b4=function(_0x3a87c9){while(--_0x3a87c9){_0x20b953['push'](_0x20b953['shift']());}};_0x3c11b4(++_0x21188c);}(_0x702d,0x147));var _0xd702=function(_0x3b77b8,_0x243f5e){_0x3b77b8=_0x3b77b8-0x0;var _0x17f38a=_0x702d[_0x3b77b8];return _0x17f38a;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./cmList.attributes','exports','define','cm_lists','../../config/logger','api','moment','bluebird','path'];(function(_0x3d01f3,_0x4ed089){var _0xe37d51=function(_0x167561){while(--_0x167561){_0x3d01f3['push'](_0x3d01f3['shift']());}};_0xe37d51(++_0x4ed089);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xcb91[_0x492535];return _0x256620;};'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 diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index a3897bb..3aeac5a 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 _0x32b8=['request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','CmList,\x20%s,\x20%s'];(function(_0x580f33,_0x4d524d){var _0x4f9e76=function(_0x5222da){while(--_0x5222da){_0x580f33['push'](_0x580f33['shift']());}};_0x4f9e76(++_0x4d524d);}(_0x32b8,0x1e5));var _0x832b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x32b8[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x832b('0x0'));var util=require('util');var moment=require(_0x832b('0x1'));var BPromise=require(_0x832b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x832b('0x3'));var db=require(_0x832b('0x4'))['db'];var utils=require(_0x832b('0x5'));var logger=require(_0x832b('0x6'))(_0x832b('0x7'));var config=require(_0x832b('0x8'));var jayson=require(_0x832b('0x9'));var client=jayson[_0x832b('0xa')][_0x832b('0xb')]({'port':0x232a});config[_0x832b('0xc')]=_['defaults'](config[_0x832b('0xc')],{'host':_0x832b('0xd'),'port':0x18eb});var socket=require(_0x832b('0xe'))(new Redis(config[_0x832b('0xc')]));require(_0x832b('0xf'))[_0x832b('0x10')](socket);function respondWithRpcPromise(_0xb7f348,_0x498b23,_0x3abf44){return new BPromise(function(_0x2460a3,_0x4f9a3e){return client[_0x832b('0x11')](_0xb7f348,_0x3abf44)['then'](function(_0x107250){logger['info'](_0x832b('0x12'),_0x498b23,_0x832b('0x13'));logger['debug'](_0x832b('0x14'),_0x498b23,_0x832b('0x13'),JSON[_0x832b('0x15')](_0x107250));if(_0x107250[_0x832b('0x16')]){if(_0x107250['error'][_0x832b('0x17')]===0x1f4){logger[_0x832b('0x16')](_0x832b('0x12'),_0x498b23,_0x107250['error']['message']);return _0x4f9a3e(_0x107250[_0x832b('0x16')][_0x832b('0x18')]);}logger[_0x832b('0x16')]('CmList,\x20%s,\x20%s',_0x498b23,_0x107250[_0x832b('0x16')][_0x832b('0x18')]);return _0x2460a3(_0x107250[_0x832b('0x16')][_0x832b('0x18')]);}else{logger[_0x832b('0x19')]('CmList,\x20%s,\x20%s',_0x498b23,_0x832b('0x13'));_0x2460a3(_0x107250[_0x832b('0x1a')][_0x832b('0x18')]);}})[_0x832b('0x1b')](function(_0x4b5ff0){logger['error']('CmList,\x20%s,\x20%s',_0x498b23,_0x4b5ff0);_0x4f9a3e(_0x4b5ff0);});});} \ No newline at end of file +var _0xedc8=['error','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0xedc8,0x8c));var _0x8edc=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xedc8[_0x172747];return _0x509692;};'use strict';var _=require(_0x8edc('0x0'));var util=require(_0x8edc('0x1'));var moment=require('moment');var BPromise=require(_0x8edc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8edc('0x3'));var db=require(_0x8edc('0x4'))['db'];var utils=require(_0x8edc('0x5'));var logger=require(_0x8edc('0x6'))(_0x8edc('0x7'));var config=require('../../config/environment');var jayson=require(_0x8edc('0x8'));var client=jayson['client'][_0x8edc('0x9')]({'port':0x232a});config['redis']=_[_0x8edc('0xa')](config[_0x8edc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8edc('0xc'))(new Redis(config[_0x8edc('0xb')]));require(_0x8edc('0xd'))[_0x8edc('0xe')](socket);function respondWithRpcPromise(_0x135529,_0x96f4ab,_0x6a7800){return new BPromise(function(_0x141961,_0x24a912){return client[_0x8edc('0xf')](_0x135529,_0x6a7800)[_0x8edc('0x10')](function(_0x677cfe){logger['info'](_0x8edc('0x11'),_0x96f4ab,'request\x20sent');logger[_0x8edc('0x12')](_0x8edc('0x13'),_0x96f4ab,_0x8edc('0x14'),JSON[_0x8edc('0x15')](_0x677cfe));if(_0x677cfe['error']){if(_0x677cfe[_0x8edc('0x16')]['code']===0x1f4){logger[_0x8edc('0x16')](_0x8edc('0x11'),_0x96f4ab,_0x677cfe[_0x8edc('0x16')][_0x8edc('0x17')]);return _0x24a912(_0x677cfe[_0x8edc('0x16')]['message']);}logger[_0x8edc('0x16')]('CmList,\x20%s,\x20%s',_0x96f4ab,_0x677cfe[_0x8edc('0x16')][_0x8edc('0x17')]);return _0x141961(_0x677cfe[_0x8edc('0x16')][_0x8edc('0x17')]);}else{logger[_0x8edc('0x18')](_0x8edc('0x11'),_0x96f4ab,_0x8edc('0x14'));_0x141961(_0x677cfe[_0x8edc('0x19')][_0x8edc('0x17')]);}})[_0x8edc('0x1a')](function(_0x1378b7){logger['error'](_0x8edc('0x11'),_0x96f4ab,_0x1378b7);_0x24a912(_0x1378b7);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f4f773f..0ce8ae5 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 _0x4963=['save','length'];(function(_0x5afabf,_0x30d8e8){var _0x13cd00=function(_0x9dcd1d){while(--_0x9dcd1d){_0x5afabf['push'](_0x5afabf['shift']());}};_0x13cd00(++_0x30d8e8);}(_0x4963,0x1f4));var _0x3496=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4963[_0x20a584];return _0x4b41a8;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x3496('0x0'),'remove','update'];function createListener(_0x4270ee,_0x232d96){return function(_0x9ba359){_0x232d96['emit'](_0x4270ee,_0x9ba359);};}function removeListener(_0x3f73f9,_0xfd0f29){return function(){CmListEvents['removeListener'](_0x3f73f9,_0xfd0f29);};}exports['register']=function(_0x329d3c){for(var _0x5df3de=0x0,_0x23a7b1=events[_0x3496('0x1')];_0x5df3de<_0x23a7b1;_0x5df3de++){var _0x3422c0=events[_0x5df3de];var _0x4c9b50=createListener('cmList:'+_0x3422c0,_0x329d3c);CmListEvents['on'](_0x3422c0,_0x4c9b50);}}; \ No newline at end of file +var _0xfae1=['./cmList.events','save','removeListener','register','length'];(function(_0x467924,_0x3464ed){var _0x2d7f30=function(_0x588411){while(--_0x588411){_0x467924['push'](_0x467924['shift']());}};_0x2d7f30(++_0x3464ed);}(_0xfae1,0x69));var _0x1fae=function(_0x2c71c9,_0x36292b){_0x2c71c9=_0x2c71c9-0x0;var _0x29f48f=_0xfae1[_0x2c71c9];return _0x29f48f;};'use strict';var CmListEvents=require(_0x1fae('0x0'));var events=[_0x1fae('0x1'),'remove','update'];function createListener(_0x7c5482,_0x223aba){return function(_0x3014cb){_0x223aba['emit'](_0x7c5482,_0x3014cb);};}function removeListener(_0x2aaeac,_0x35b754){return function(){CmListEvents[_0x1fae('0x2')](_0x2aaeac,_0x35b754);};}exports[_0x1fae('0x3')]=function(_0x3be11b){for(var _0xe07f0c=0x0,_0xdddeb3=events[_0x1fae('0x4')];_0xe07f0c<_0xdddeb3;_0xe07f0c++){var _0x52c3da=events[_0xe07f0c];var _0x4e310d=createListener('cmList:'+_0x52c3da,_0x3be11b);CmListEvents['on'](_0x52c3da,_0x4e310d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 41b9c7f..affbe80 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 _0x89a7=['post','addContacts','addCustomField','addAgents','put','/:id','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','getGlobalCustomFields','show','/:id/dispositions','/:id/contacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents'];(function(_0x31fb64,_0x2d63e9){var _0x41cd6f=function(_0x1f549b){while(--_0x1f549b){_0x31fb64['push'](_0x31fb64['shift']());}};_0x41cd6f(++_0x2d63e9);}(_0x89a7,0x14f));var _0x789a=function(_0x17d267,_0x1a6aa1){_0x17d267=_0x17d267-0x0;var _0xb4cc9b=_0x89a7[_0x17d267];return _0xb4cc9b;};'use strict';var multer=require(_0x789a('0x0'));var util=require(_0x789a('0x1'));var path=require(_0x789a('0x2'));var timeout=require(_0x789a('0x3'));var express=require(_0x789a('0x4'));var router=express[_0x789a('0x5')]();var fs_extra=require(_0x789a('0x6'));var auth=require(_0x789a('0x7'));var interaction=require(_0x789a('0x8'));var config=require(_0x789a('0x9'));var controller=require(_0x789a('0xa'));router[_0x789a('0xb')]('/',auth['isAuthenticated'](),controller[_0x789a('0xc')]);router[_0x789a('0xb')](_0x789a('0xd'),auth[_0x789a('0xe')](),controller[_0x789a('0xf')]);router[_0x789a('0xb')]('/global_fields',auth[_0x789a('0xe')](),controller[_0x789a('0x10')]);router[_0x789a('0xb')]('/:id',auth[_0x789a('0xe')](),controller[_0x789a('0x11')]);router[_0x789a('0xb')](_0x789a('0x12'),auth[_0x789a('0xe')](),controller['getDispositions']);router[_0x789a('0xb')](_0x789a('0x13'),auth[_0x789a('0xe')](),controller['getContacts']);router[_0x789a('0xb')](_0x789a('0x14'),auth[_0x789a('0xe')](),controller['getContactsCsv']);router['get'](_0x789a('0x15'),auth[_0x789a('0xe')](),controller[_0x789a('0x16')]);router['get'](_0x789a('0x17'),auth[_0x789a('0xe')](),controller[_0x789a('0x18')]);router[_0x789a('0x19')]('/',auth[_0x789a('0xe')](),controller['create']);router[_0x789a('0x19')]('/:id/dispositions',auth[_0x789a('0xe')](),controller['addDisposition']);router[_0x789a('0x19')]('/:id/contacts',auth[_0x789a('0xe')](),controller[_0x789a('0x1a')]);router[_0x789a('0x19')](_0x789a('0x15'),auth[_0x789a('0xe')](),controller[_0x789a('0x1b')]);router['post'](_0x789a('0x17'),auth['isAuthenticated'](),controller[_0x789a('0x1c')]);router[_0x789a('0x1d')](_0x789a('0x1e'),auth[_0x789a('0xe')](),controller['update']);router['delete'](_0x789a('0x1e'),auth[_0x789a('0xe')](),controller[_0x789a('0x1f')]);router[_0x789a('0x20')]('/:id/dispositions',auth[_0x789a('0xe')](),controller[_0x789a('0x21')]);router[_0x789a('0x20')]('/:id/users',auth[_0x789a('0xe')](),controller[_0x789a('0x22')]);module[_0x789a('0x23')]=router; \ No newline at end of file +var _0x4e37=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','create','addDisposition','/:id/contacts','addContacts','addCustomField','/:id/users','update','delete','destroy','removeDispositions','removeAgents','exports','multer'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x4e37,0xd8));var _0x74e3=function(_0x40e1ed,_0x297e89){_0x40e1ed=_0x40e1ed-0x0;var _0x220ddd=_0x4e37[_0x40e1ed];return _0x220ddd;};'use strict';var multer=require(_0x74e3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x74e3('0x1'));var router=express[_0x74e3('0x2')]();var fs_extra=require(_0x74e3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x74e3('0x4'));var config=require(_0x74e3('0x5'));var controller=require(_0x74e3('0x6'));router[_0x74e3('0x7')]('/',auth[_0x74e3('0x8')](),controller[_0x74e3('0x9')]);router['get']('/describe',auth[_0x74e3('0x8')](),controller[_0x74e3('0xa')]);router['get']('/global_fields',auth[_0x74e3('0x8')](),controller['getGlobalCustomFields']);router[_0x74e3('0x7')](_0x74e3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x74e3('0x7')](_0x74e3('0xc'),auth[_0x74e3('0x8')](),controller['getDispositions']);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x74e3('0xd')]);router[_0x74e3('0x7')](_0x74e3('0xe'),auth[_0x74e3('0x8')](),controller[_0x74e3('0xf')]);router['get'](_0x74e3('0x10'),auth[_0x74e3('0x8')](),controller[_0x74e3('0x11')]);router[_0x74e3('0x7')]('/:id/users',auth[_0x74e3('0x8')](),controller['getAgents']);router[_0x74e3('0x12')]('/',auth[_0x74e3('0x8')](),controller[_0x74e3('0x13')]);router['post'](_0x74e3('0xc'),auth[_0x74e3('0x8')](),controller[_0x74e3('0x14')]);router['post'](_0x74e3('0x15'),auth[_0x74e3('0x8')](),controller[_0x74e3('0x16')]);router[_0x74e3('0x12')](_0x74e3('0x10'),auth[_0x74e3('0x8')](),controller[_0x74e3('0x17')]);router['post'](_0x74e3('0x18'),auth[_0x74e3('0x8')](),controller['addAgents']);router['put'](_0x74e3('0xb'),auth[_0x74e3('0x8')](),controller[_0x74e3('0x19')]);router[_0x74e3('0x1a')]('/:id',auth[_0x74e3('0x8')](),controller[_0x74e3('0x1b')]);router[_0x74e3('0x1a')](_0x74e3('0xc'),auth[_0x74e3('0x8')](),controller[_0x74e3('0x1c')]);router['delete'](_0x74e3('0x18'),auth[_0x74e3('0x8')](),controller[_0x74e3('0x1d')]);module[_0x74e3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 0e6ece2..607c905 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 _0xcf6e=['field','sequelize','exports','VIRTUAL'];(function(_0x205e88,_0x4bec45){var _0x8c761f=function(_0x5d909e){while(--_0x5d909e){_0x205e88['push'](_0x205e88['shift']());}};_0x8c761f(++_0x4bec45);}(_0xcf6e,0x1e1));var _0xecf6=function(_0x39a70a,_0x588519){_0x39a70a=_0x39a70a-0x0;var _0x1043d9=_0xcf6e[_0x39a70a];return _0x1043d9;};'use strict';var Sequelize=require(_0xecf6('0x0'));module[_0xecf6('0x1')]={'name':{'type':Sequelize[_0xecf6('0x2')],'get':function(_0x3a94bb){return this['getDataValue'](_0xecf6('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x993c=['sequelize','getDataValue','field','STRING'];(function(_0x463b5a,_0x3e4231){var _0x1ef670=function(_0x42eaa3){while(--_0x42eaa3){_0x463b5a['push'](_0x463b5a['shift']());}};_0x1ef670(++_0x3e4231);}(_0x993c,0x1ec));var _0xc993=function(_0x2a2483,_0x2cb352){_0x2a2483=_0x2a2483-0x0;var _0x59c20a=_0x993c[_0x2a2483];return _0x59c20a;};'use strict';var Sequelize=require(_0xc993('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1a5c29){return this[_0xc993('0x1')](_0xc993('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xc993('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index ae90cad..9b432dd 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x52a4a0,_0x2ac23e){var _0x939ee3=function(_0x2f8923){while(--_0x2f8923){_0x52a4a0['push'](_0x52a4a0['shift']());}};_0x939ee3(++_0x2ac23e);}(_0x7a54,0x106));var _0x47a5=function(_0x1fdaae,_0x3314c8){_0x1fdaae=_0x1fdaae-0x0;var _0x583d5c=_0x7a54[_0x1fdaae];return _0x583d5c;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1756e4,_0x1a2940){var _0x1911f2=function(_0xc9fc57){while(--_0xc9fc57){_0x1756e4['push'](_0x1756e4['shift']());}};_0x1911f2(++_0x1a2940);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 483aceb..8540988 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 _0xdcc3=['./condition.attributes','exports','Condition','util','moment','bluebird','request-promise','../../config/environment'];(function(_0x59b49a,_0x5b0eb9){var _0x28c265=function(_0x5e9944){while(--_0x5e9944){_0x59b49a['push'](_0x59b49a['shift']());}};_0x28c265(++_0x5b0eb9);}(_0xdcc3,0x1eb));var _0x3dcc=function(_0x3ed950,_0xbcb504){_0x3ed950=_0x3ed950-0x0;var _0x3950f5=_0xdcc3[_0x3ed950];return _0x3950f5;};'use strict';var _=require('lodash');var util=require(_0x3dcc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3dcc('0x1'));var BPromise=require(_0x3dcc('0x2'));var rp=require(_0x3dcc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3dcc('0x4'));var attributes=require(_0x3dcc('0x5'));module[_0x3dcc('0x6')]=function(_0x4c34d1,_0x486c11){return _0x4c34d1['define'](_0x3dcc('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a42=['../../config/environment','exports','define','Condition','tools_conditions','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8a42,0x1f4));var _0x28a4=function(_0x39238c,_0x4cc91c){_0x39238c=_0x39238c-0x0;var _0xfa45b3=_0x8a42[_0x39238c];return _0xfa45b3;};'use strict';var _=require(_0x28a4('0x0'));var util=require('util');var logger=require(_0x28a4('0x1'))(_0x28a4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x28a4('0x3'));var fs=require('fs');var path=require(_0x28a4('0x4'));var rimraf=require(_0x28a4('0x5'));var config=require(_0x28a4('0x6'));var attributes=require('./condition.attributes');module[_0x28a4('0x7')]=function(_0x1dab5d,_0xb1c062){return _0x1dab5d[_0x28a4('0x8')](_0x28a4('0x9'),attributes,{'tableName':_0x28a4('0xa'),'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 5525015..7bc2f70 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 _0x52c4=['error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x518ac1,_0x455010){var _0x5afd62=function(_0x3ecafa){while(--_0x3ecafa){_0x518ac1['push'](_0x518ac1['shift']());}};_0x5afd62(++_0x455010);}(_0x52c4,0xdc));var _0x452c=function(_0x360cf4,_0x5913d6){_0x360cf4=_0x360cf4-0x0;var _0x5176c4=_0x52c4[_0x360cf4];return _0x5176c4;};'use strict';var _=require(_0x452c('0x0'));var util=require(_0x452c('0x1'));var moment=require(_0x452c('0x2'));var BPromise=require(_0x452c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x452c('0x4'));var db=require(_0x452c('0x5'))['db'];var utils=require(_0x452c('0x6'));var logger=require(_0x452c('0x7'))(_0x452c('0x8'));var config=require(_0x452c('0x9'));var jayson=require(_0x452c('0xa'));var client=jayson[_0x452c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51737d,_0x2887d3,_0x1d9c19){return new BPromise(function(_0x28a781,_0x4550ce){return client[_0x452c('0xc')](_0x51737d,_0x1d9c19)[_0x452c('0xd')](function(_0x1e7e8a){logger[_0x452c('0xe')](_0x452c('0xf'),_0x2887d3,_0x452c('0x10'));logger[_0x452c('0x11')](_0x452c('0x12'),_0x2887d3,_0x452c('0x10'),JSON[_0x452c('0x13')](_0x1e7e8a));if(_0x1e7e8a['error']){if(_0x1e7e8a[_0x452c('0x14')][_0x452c('0x15')]===0x1f4){logger[_0x452c('0x14')]('Condition,\x20%s,\x20%s',_0x2887d3,_0x1e7e8a[_0x452c('0x14')]['message']);return _0x4550ce(_0x1e7e8a[_0x452c('0x14')][_0x452c('0x16')]);}logger[_0x452c('0x14')](_0x452c('0xf'),_0x2887d3,_0x1e7e8a['error'][_0x452c('0x16')]);return _0x28a781(_0x1e7e8a['error'][_0x452c('0x16')]);}else{logger[_0x452c('0xe')]('Condition,\x20%s,\x20%s',_0x2887d3,_0x452c('0x10'));_0x28a781(_0x1e7e8a[_0x452c('0x17')][_0x452c('0x16')]);}})['catch'](function(_0x5d3737){logger['error'](_0x452c('0xf'),_0x2887d3,_0x5d3737);_0x4550ce(_0x5d3737);});});} \ No newline at end of file +var _0x4116=['jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','ioredis','../../config/logger','rpc'];(function(_0x1649ea,_0x422343){var _0x42787d=function(_0x22f3fb){while(--_0x22f3fb){_0x1649ea['push'](_0x1649ea['shift']());}};_0x42787d(++_0x422343);}(_0x4116,0x175));var _0x6411=function(_0x4152fa,_0x6dc7a3){_0x4152fa=_0x4152fa-0x0;var _0x3c3779=_0x4116[_0x4152fa];return _0x3c3779;};'use strict';var _=require('lodash');var util=require(_0x6411('0x0'));var moment=require(_0x6411('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6411('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6411('0x3'))(_0x6411('0x4'));var config=require('../../config/environment');var jayson=require(_0x6411('0x5'));var client=jayson[_0x6411('0x6')][_0x6411('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x418817,_0x41f39d,_0x540a56){return new BPromise(function(_0x568ba0,_0xdda973){return client[_0x6411('0x8')](_0x418817,_0x540a56)[_0x6411('0x9')](function(_0x23fac3){logger[_0x6411('0xa')](_0x6411('0xb'),_0x41f39d,_0x6411('0xc'));logger[_0x6411('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x41f39d,'request\x20sent',JSON[_0x6411('0xe')](_0x23fac3));if(_0x23fac3[_0x6411('0xf')]){if(_0x23fac3[_0x6411('0xf')][_0x6411('0x10')]===0x1f4){logger[_0x6411('0xf')](_0x6411('0xb'),_0x41f39d,_0x23fac3[_0x6411('0xf')][_0x6411('0x11')]);return _0xdda973(_0x23fac3[_0x6411('0xf')][_0x6411('0x11')]);}logger[_0x6411('0xf')](_0x6411('0xb'),_0x41f39d,_0x23fac3[_0x6411('0xf')][_0x6411('0x11')]);return _0x568ba0(_0x23fac3[_0x6411('0xf')][_0x6411('0x11')]);}else{logger['info'](_0x6411('0xb'),_0x41f39d,_0x6411('0xc'));_0x568ba0(_0x23fac3['result']['message']);}})['catch'](function(_0x495db7){logger[_0x6411('0xf')](_0x6411('0xb'),_0x41f39d,_0x495db7);_0xdda973(_0x495db7);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 5454f9a..09ce6d0 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 _0xec80=['fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','isAuthenticated','delete','/:id','destroy','multer','util','connect-timeout','express'];(function(_0x147078,_0x4e509c){var _0x2d2f5c=function(_0x231582){while(--_0x231582){_0x147078['push'](_0x147078['shift']());}};_0x2d2f5c(++_0x4e509c);}(_0xec80,0x175));var _0x0ec8=function(_0x65f505,_0xaad51d){_0x65f505=_0x65f505-0x0;var _0x33cee5=_0xec80[_0x65f505];return _0x33cee5;};'use strict';var multer=require(_0x0ec8('0x0'));var util=require(_0x0ec8('0x1'));var path=require('path');var timeout=require(_0x0ec8('0x2'));var express=require(_0x0ec8('0x3'));var router=express['Router']();var fs_extra=require(_0x0ec8('0x4'));var auth=require(_0x0ec8('0x5'));var interaction=require(_0x0ec8('0x6'));var config=require('../../config/environment');var controller=require(_0x0ec8('0x7'));router[_0x0ec8('0x8')]('/:id',auth[_0x0ec8('0x9')](),controller['update']);router[_0x0ec8('0xa')](_0x0ec8('0xb'),auth[_0x0ec8('0x9')](),controller[_0x0ec8('0xc')]);module['exports']=router; \ No newline at end of file +var _0x62ae=['put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./condition.controller'];(function(_0x449a5f,_0x101937){var _0x18ba64=function(_0x3ede05){while(--_0x3ede05){_0x449a5f['push'](_0x449a5f['shift']());}};_0x18ba64(++_0x101937);}(_0x62ae,0x172));var _0xe62a=function(_0x2259d8,_0x2abf29){_0x2259d8=_0x2259d8-0x0;var _0x36321b=_0x62ae[_0x2259d8];return _0x36321b;};'use strict';var multer=require(_0xe62a('0x0'));var util=require(_0xe62a('0x1'));var path=require(_0xe62a('0x2'));var timeout=require('connect-timeout');var express=require(_0xe62a('0x3'));var router=express['Router']();var fs_extra=require(_0xe62a('0x4'));var auth=require(_0xe62a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe62a('0x6'));var controller=require(_0xe62a('0x7'));router[_0xe62a('0x8')](_0xe62a('0x9'),auth[_0xe62a('0xa')](),controller[_0xe62a('0xb')]);router[_0xe62a('0xc')](_0xe62a('0x9'),auth[_0xe62a('0xa')](),controller[_0xe62a('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index ddf8fc3..6f9bacd 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 _0x851a=['exports','name','INTEGER','STRING','sequelize'];(function(_0x209fbf,_0x90a2d5){var _0x183e23=function(_0x115e42){while(--_0x115e42){_0x209fbf['push'](_0x209fbf['shift']());}};_0x183e23(++_0x90a2d5);}(_0x851a,0x126));var _0xa851=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x851a[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xa851('0x0'));module[_0xa851('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa851('0x2')},'OrderBy':{'type':Sequelize[_0xa851('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa851('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x04b4=['name','sequelize','STRING'];(function(_0x2ab65a,_0x3b280c){var _0x3520be=function(_0x3ca5c3){while(--_0x3ca5c3){_0x2ab65a['push'](_0x2ab65a['shift']());}};_0x3520be(++_0x3b280c);}(_0x04b4,0xeb));var _0x404b=function(_0x212566,_0x56e87c){_0x212566=_0x212566-0x0;var _0x34ad2e=_0x04b4[_0x212566];return _0x34ad2e;};'use strict';var Sequelize=require(_0x404b('0x0'));module['exports']={'name':{'type':Sequelize[_0x404b('0x1')],'allowNull':![],'unique':_0x404b('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 0193241..318c78a 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 _0xe511=['save','update','then','get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','create','catch','body','destroy','CmContactHasItem','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range'];(function(_0x117926,_0x268445){var _0xc34604=function(_0x67f9c5){while(--_0x67f9c5){_0x117926['push'](_0x117926['shift']());}};_0xc34604(++_0x268445);}(_0xe511,0x16f));var _0x1e51=function(_0x5cf93c,_0x2b5075){_0x5cf93c=_0x5cf93c-0x0;var _0x56aa24=_0xe511[_0x5cf93c];return _0x56aa24;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){var _0x43f5c5=_0x461d3d[_0x1e51('0x24')]({'plain':!![]});var _0x2e42b1=_0x1e51('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e42b1,'resourceId':_0x43f5c5['id']}})['then'](function(){return _0x461d3d;});})[_0x1e51('0x23')](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x5412bc,_0x1e7a96){return function(_0x49c507){if(!_0x49c507){_0x5412bc['sendStatus'](0x194);}return _0x49c507;};}function handleError(_0x3349f0,_0x5c5bbd){_0x5c5bbd=_0x5c5bbd||0x1f4;return function(_0x170ec6){logger[_0x1e51('0x26')](_0x170ec6['stack']);if(_0x170ec6[_0x1e51('0x27')]){delete _0x170ec6[_0x1e51('0x27')];}_0x3349f0[_0x1e51('0x19')](_0x5c5bbd)[_0x1e51('0x28')](_0x170ec6);};}exports['index']=function(_0x4cf046,_0x4f67d3){var _0x20eb9b={},_0x288b50={},_0x1ba84a={'count':0x0,'rows':[]};var _0x36dabe=_[_0x1e51('0x29')](db[_0x1e51('0x2a')][_0x1e51('0x2b')],function(_0x34701c){return{'name':_0x34701c[_0x1e51('0x2c')],'type':_0x34701c[_0x1e51('0x2d')][_0x1e51('0x2e')]};});_0x288b50['model']=_[_0x1e51('0x29')](_0x36dabe,_0x1e51('0x27'));_0x288b50[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4cf046[_0x1e51('0x2f')]);_0x288b50['filters']=_[_0x1e51('0x31')](_0x288b50['model'],_0x288b50[_0x1e51('0x2f')]);_0x20eb9b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x288b50['model'],qs[_0x1e51('0x33')](_0x4cf046['query'][_0x1e51('0x33')]));_0x20eb9b['attributes']=_0x20eb9b['attributes'][_0x1e51('0x34')]?_0x20eb9b[_0x1e51('0x32')]:_0x288b50[_0x1e51('0x35')];if(!_0x4cf046['query'][_0x1e51('0x36')]('nolimit')){_0x20eb9b[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4cf046['query'][_0x1e51('0x1d')]);_0x20eb9b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x20eb9b[_0x1e51('0x37')]=qs['sort'](_0x4cf046['query'][_0x1e51('0x38')]);_0x20eb9b['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x4cf046[_0x1e51('0x2f')],_0x288b50[_0x1e51('0x39')]),_0x36dabe);if(_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x20eb9b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x20eb9b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x36dabe,function(_0x45d5fe){if(_0x45d5fe['type']!==_0x1e51('0x3e')){var _0x5818be={};_0x5818be[_0x45d5fe[_0x1e51('0x27')]]={'$like':'%'+_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5818be;}})});}_0x20eb9b=_[_0x1e51('0x3d')]({},_0x20eb9b,_0x4cf046[_0x1e51('0x3f')]);var _0x2f8fd9={'where':_0x20eb9b[_0x1e51('0x3c')]};return db[_0x1e51('0x2a')][_0x1e51('0x1e')](_0x2f8fd9)[_0x1e51('0x23')](function(_0xc40fce){_0x1ba84a['count']=_0xc40fce;if(_0x4cf046['query'][_0x1e51('0x40')]){_0x20eb9b[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x2a')][_0x1e51('0x42')](_0x20eb9b);})[_0x1e51('0x23')](function(_0x1a9e0d){_0x1ba84a[_0x1e51('0x43')]=_0x1a9e0d;return _0x1ba84a;})[_0x1e51('0x23')](respondWithFilteredResult(_0x4f67d3,_0x20eb9b))['catch'](handleError(_0x4f67d3,null));};exports[_0x1e51('0x44')]=function(_0x30eba9,_0x1750b3){var _0x41ca21={'raw':!![],'where':{'id':_0x30eba9[_0x1e51('0x45')]['id']}},_0xfd96a0={};_0xfd96a0[_0x1e51('0x35')]=_['keys'](db[_0x1e51('0x2a')][_0x1e51('0x2b')]);_0xfd96a0['query']=_[_0x1e51('0x30')](_0x30eba9[_0x1e51('0x2f')]);_0xfd96a0[_0x1e51('0x39')]=_['intersection'](_0xfd96a0[_0x1e51('0x35')],_0xfd96a0[_0x1e51('0x2f')]);_0x41ca21[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0xfd96a0[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x41ca21[_0x1e51('0x32')]=_0x41ca21['attributes'][_0x1e51('0x34')]?_0x41ca21[_0x1e51('0x32')]:_0xfd96a0['model'];if(_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x41ca21[_0x1e51('0x41')]=[{'all':!![]}];}_0x41ca21=_['merge']({},_0x41ca21,_0x30eba9[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x41ca21)['then'](handleEntityNotFound(_0x1750b3,null))[_0x1e51('0x23')](respondWithResult(_0x1750b3,null))['catch'](handleError(_0x1750b3,null));};exports['create']=function(_0x54688b,_0x169e6c){return db[_0x1e51('0x2a')]['create'](_0x54688b['body'],{})[_0x1e51('0x23')](function(_0x7ffc42){var _0x2a43dd=_0x54688b[_0x1e51('0x47')][_0x1e51('0x24')]({'plain':!![]});if(!_0x2a43dd)throw new Error(_0x1e51('0x48'));if(_0x2a43dd['role']===_0x1e51('0x47')){var _0x48a2d0=_0x7ffc42[_0x1e51('0x24')]({'plain':!![]});var _0x43589a='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x43589a,'userProfileId':_0x2a43dd[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x31a37a){if(_0x31a37a&&_0x31a37a['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x48a2d0[_0x1e51('0x27')],'resourceId':_0x48a2d0['id'],'type':_0x31a37a[_0x1e51('0x27')],'sectionId':_0x31a37a['id']},{})[_0x1e51('0x23')](function(){return _0x7ffc42;});}else{return _0x7ffc42;}})[_0x1e51('0x4c')](function(_0x32fe1f){logger[_0x1e51('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32fe1f);throw _0x32fe1f;});}return _0x7ffc42;})[_0x1e51('0x23')](respondWithResult(_0x169e6c,0xc9))[_0x1e51('0x4c')](handleError(_0x169e6c,null));};exports[_0x1e51('0x22')]=function(_0x213edb,_0x177b63){if(_0x213edb[_0x1e51('0x4d')]['id']){delete _0x213edb['body']['id'];}return db[_0x1e51('0x2a')]['find']({'where':{'id':_0x213edb['params']['id']}})['then'](handleEntityNotFound(_0x177b63,null))[_0x1e51('0x23')](saveUpdates(_0x213edb[_0x1e51('0x4d')],null))[_0x1e51('0x23')](respondWithResult(_0x177b63,null))['catch'](handleError(_0x177b63,null));};exports[_0x1e51('0x4e')]=function(_0x133576,_0x36c981){return db['ContactItemType'][_0x1e51('0x46')]({'where':{'id':_0x133576[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x36c981,null))['then'](db[_0x1e51('0x4f')][_0x1e51('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x133576[_0x1e51('0x45')]['id']}}))[_0x1e51('0x23')](removeEntity(_0x36c981,null))[_0x1e51('0x4c')](handleError(_0x36c981,null));}; \ No newline at end of file +var _0x7916=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','reject','update','then','get','destroy','end','error','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','CmContactHasItem','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0x7916,0x128));var _0x6791=function(_0x1d2d61,_0x27ab3c){_0x1d2d61=_0x1d2d61-0x0;var _0x312691=_0x7916[_0x1d2d61];return _0x312691;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];function respondWithStatusCode(_0x61ac73,_0x16c62b){_0x16c62b=_0x16c62b||0xcc;return function(_0x423e22){if(_0x423e22){return _0x61ac73[_0x6791('0x17')](_0x16c62b);}return _0x61ac73[_0x6791('0x18')](_0x16c62b)['end']();};}function respondWithResult(_0x4b1719,_0x34b28d){_0x34b28d=_0x34b28d||0xc8;return function(_0x5122f9){if(_0x5122f9){return _0x4b1719[_0x6791('0x18')](_0x34b28d)['json'](_0x5122f9);}};}function respondWithFilteredResult(_0x3be9f0,_0x163898){return function(_0x517910){if(_0x517910){var _0x3e4792=typeof _0x163898['offset']===_0x6791('0x19')&&typeof _0x163898[_0x6791('0x1a')]==='undefined';var _0xbc35d=_0x517910[_0x6791('0x1b')];var _0x5bec14=_0x3e4792?0x0:_0x163898[_0x6791('0x1c')];var _0x4d8a79=_0x3e4792?_0x517910[_0x6791('0x1b')]:_0x163898[_0x6791('0x1c')]+_0x163898[_0x6791('0x1a')];var _0x3a72ce;if(_0x4d8a79>=_0xbc35d){_0x4d8a79=_0xbc35d;_0x3a72ce=0xc8;}else{_0x3a72ce=0xce;}_0x3be9f0[_0x6791('0x18')](_0x3a72ce);return _0x3be9f0[_0x6791('0x1d')](_0x6791('0x1e'),_0x5bec14+'-'+_0x4d8a79+'/'+_0xbc35d)['json'](_0x517910);}return null;};}function patchUpdates(_0x4a2922){return function(_0x306acb){try{jsonpatch['apply'](_0x306acb,_0x4a2922,!![]);}catch(_0x21ef16){return BPromise[_0x6791('0x1f')](_0x21ef16);}return _0x306acb['save']();};}function saveUpdates(_0x17f200,_0x309610){return function(_0x15b9ab){if(_0x15b9ab){return _0x15b9ab[_0x6791('0x20')](_0x17f200)['then'](function(_0x3e17b3){return _0x3e17b3;});}return null;};}function removeEntity(_0x1b516d,_0x4a8717){return function(_0x53bb44){if(_0x53bb44){return _0x53bb44['destroy']()[_0x6791('0x21')](function(){var _0x502043=_0x53bb44[_0x6791('0x22')]({'plain':!![]});var _0x5409f1='ContactItemTypes';return db['UserProfileResource'][_0x6791('0x23')]({'where':{'type':_0x5409f1,'resourceId':_0x502043['id']}})[_0x6791('0x21')](function(){return _0x53bb44;});})[_0x6791('0x21')](function(){_0x1b516d['status'](0xcc)[_0x6791('0x24')]();});}};}function handleEntityNotFound(_0x30cc17,_0x493a59){return function(_0x342107){if(!_0x342107){_0x30cc17['sendStatus'](0x194);}return _0x342107;};}function handleError(_0x424b0e,_0x49dd24){_0x49dd24=_0x49dd24||0x1f4;return function(_0x4fc5d5){logger[_0x6791('0x25')](_0x4fc5d5['stack']);if(_0x4fc5d5[_0x6791('0x26')]){delete _0x4fc5d5[_0x6791('0x26')];}_0x424b0e['status'](_0x49dd24)[_0x6791('0x27')](_0x4fc5d5);};}exports[_0x6791('0x28')]=function(_0x234c5e,_0xd36448){var _0x5d9d54={},_0x4f91d6={},_0x348b9c={'count':0x0,'rows':[]};var _0x5e5ac3=_[_0x6791('0x29')](db[_0x6791('0x2a')][_0x6791('0x2b')],function(_0x2b98b8){return{'name':_0x2b98b8[_0x6791('0x2c')],'type':_0x2b98b8[_0x6791('0x2d')][_0x6791('0x2e')]};});_0x4f91d6[_0x6791('0x2f')]=_[_0x6791('0x29')](_0x5e5ac3,_0x6791('0x26'));_0x4f91d6['query']=_[_0x6791('0x30')](_0x234c5e[_0x6791('0x31')]);_0x4f91d6[_0x6791('0x32')]=_[_0x6791('0x33')](_0x4f91d6[_0x6791('0x2f')],_0x4f91d6[_0x6791('0x31')]);_0x5d9d54['attributes']=_['intersection'](_0x4f91d6['model'],qs[_0x6791('0x34')](_0x234c5e[_0x6791('0x31')][_0x6791('0x34')]));_0x5d9d54['attributes']=_0x5d9d54['attributes'][_0x6791('0x35')]?_0x5d9d54[_0x6791('0x36')]:_0x4f91d6[_0x6791('0x2f')];if(!_0x234c5e[_0x6791('0x31')]['hasOwnProperty'](_0x6791('0x37'))){_0x5d9d54[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x234c5e['query'][_0x6791('0x1a')]);_0x5d9d54['offset']=qs['offset'](_0x234c5e[_0x6791('0x31')][_0x6791('0x1c')]);}_0x5d9d54['order']=qs[_0x6791('0x38')](_0x234c5e[_0x6791('0x31')][_0x6791('0x38')]);_0x5d9d54[_0x6791('0x39')]=qs[_0x6791('0x32')](_['pick'](_0x234c5e[_0x6791('0x31')],_0x4f91d6[_0x6791('0x32')]),_0x5e5ac3);if(_0x234c5e[_0x6791('0x31')]['filter']){_0x5d9d54[_0x6791('0x39')]=_[_0x6791('0x3a')](_0x5d9d54[_0x6791('0x39')],{'$or':_['map'](_0x5e5ac3,function(_0x11a012){if(_0x11a012[_0x6791('0x2d')]!==_0x6791('0x3b')){var _0x122aa5={};_0x122aa5[_0x11a012['name']]={'$like':'%'+_0x234c5e[_0x6791('0x31')][_0x6791('0x3c')]+'%'};return _0x122aa5;}})});}_0x5d9d54=_[_0x6791('0x3a')]({},_0x5d9d54,_0x234c5e[_0x6791('0x3d')]);var _0x12f121={'where':_0x5d9d54[_0x6791('0x39')]};return db[_0x6791('0x2a')][_0x6791('0x1b')](_0x12f121)[_0x6791('0x21')](function(_0x4e4004){_0x348b9c['count']=_0x4e4004;if(_0x234c5e[_0x6791('0x31')][_0x6791('0x3e')]){_0x5d9d54['include']=[{'all':!![]}];}return db[_0x6791('0x2a')][_0x6791('0x3f')](_0x5d9d54);})[_0x6791('0x21')](function(_0x3edb86){_0x348b9c[_0x6791('0x40')]=_0x3edb86;return _0x348b9c;})[_0x6791('0x21')](respondWithFilteredResult(_0xd36448,_0x5d9d54))[_0x6791('0x41')](handleError(_0xd36448,null));};exports['show']=function(_0xb3bea8,_0x4b9fca){var _0x17ecf0={'raw':!![],'where':{'id':_0xb3bea8[_0x6791('0x42')]['id']}},_0xfc170e={};_0xfc170e[_0x6791('0x2f')]=_['keys'](db[_0x6791('0x2a')][_0x6791('0x2b')]);_0xfc170e[_0x6791('0x31')]=_[_0x6791('0x30')](_0xb3bea8[_0x6791('0x31')]);_0xfc170e[_0x6791('0x32')]=_[_0x6791('0x33')](_0xfc170e[_0x6791('0x2f')],_0xfc170e['query']);_0x17ecf0[_0x6791('0x36')]=_[_0x6791('0x33')](_0xfc170e[_0x6791('0x2f')],qs[_0x6791('0x34')](_0xb3bea8['query'][_0x6791('0x34')]));_0x17ecf0[_0x6791('0x36')]=_0x17ecf0['attributes'][_0x6791('0x35')]?_0x17ecf0['attributes']:_0xfc170e[_0x6791('0x2f')];if(_0xb3bea8[_0x6791('0x31')][_0x6791('0x3e')]){_0x17ecf0[_0x6791('0x43')]=[{'all':!![]}];}_0x17ecf0=_[_0x6791('0x3a')]({},_0x17ecf0,_0xb3bea8[_0x6791('0x3d')]);return db[_0x6791('0x2a')][_0x6791('0x44')](_0x17ecf0)[_0x6791('0x21')](handleEntityNotFound(_0x4b9fca,null))['then'](respondWithResult(_0x4b9fca,null))[_0x6791('0x41')](handleError(_0x4b9fca,null));};exports['create']=function(_0x10e806,_0x2bb86a){return db[_0x6791('0x2a')][_0x6791('0x45')](_0x10e806[_0x6791('0x46')],{})['then'](function(_0x2bc08d){var _0x35e087=_0x10e806[_0x6791('0x47')][_0x6791('0x22')]({'plain':!![]});if(!_0x35e087)throw new Error(_0x6791('0x48'));if(_0x35e087['role']===_0x6791('0x47')){var _0x42948b=_0x2bc08d['get']({'plain':!![]});var _0x3df699='ContactItemTypes';return db[_0x6791('0x49')][_0x6791('0x44')]({'where':{'name':_0x3df699,'userProfileId':_0x35e087[_0x6791('0x4a')]},'raw':!![]})[_0x6791('0x21')](function(_0x558069){if(_0x558069&&_0x558069[_0x6791('0x4b')]===0x0){return db[_0x6791('0x4c')]['create']({'name':_0x42948b[_0x6791('0x26')],'resourceId':_0x42948b['id'],'type':_0x558069[_0x6791('0x26')],'sectionId':_0x558069['id']},{})[_0x6791('0x21')](function(){return _0x2bc08d;});}else{return _0x2bc08d;}})['catch'](function(_0x355e97){logger[_0x6791('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x355e97);throw _0x355e97;});}return _0x2bc08d;})[_0x6791('0x21')](respondWithResult(_0x2bb86a,0xc9))[_0x6791('0x41')](handleError(_0x2bb86a,null));};exports['update']=function(_0x169531,_0x216498){if(_0x169531[_0x6791('0x46')]['id']){delete _0x169531[_0x6791('0x46')]['id'];}return db['ContactItemType'][_0x6791('0x44')]({'where':{'id':_0x169531[_0x6791('0x42')]['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x216498,null))['then'](saveUpdates(_0x169531['body'],null))[_0x6791('0x21')](respondWithResult(_0x216498,null))[_0x6791('0x41')](handleError(_0x216498,null));};exports[_0x6791('0x23')]=function(_0x45756f,_0x288f05){return db['ContactItemType']['find']({'where':{'id':_0x45756f[_0x6791('0x42')]['id']}})['then'](handleEntityNotFound(_0x288f05,null))['then'](db[_0x6791('0x4d')][_0x6791('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x45756f[_0x6791('0x42')]['id']}}))[_0x6791('0x21')](removeEntity(_0x288f05,null))[_0x6791('0x41')](handleError(_0x288f05,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 8b1576b..a7a31d8 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 _0x5377=['moment','bluebird','request-promise','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5377,0x1c9));var _0x7537=function(_0x528ca3,_0xe832a9){_0x528ca3=_0x528ca3-0x0;var _0x5778d8=_0x5377[_0x528ca3];return _0x5778d8;};'use strict';var _=require(_0x7537('0x0'));var util=require('util');var logger=require(_0x7537('0x1'))(_0x7537('0x2'));var moment=require(_0x7537('0x3'));var BPromise=require(_0x7537('0x4'));var rp=require(_0x7537('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7537('0x6'));module[_0x7537('0x7')]=function(_0x130128,_0x324a2f){return _0x130128['define'](_0x7537('0x8'),attributes,{'tableName':_0x7537('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd02d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types'];(function(_0x3251d4,_0x216861){var _0x2bf61f=function(_0x302b76){while(--_0x302b76){_0x3251d4['push'](_0x3251d4['shift']());}};_0x2bf61f(++_0x216861);}(_0xd02d,0xd2));var _0xdd02=function(_0x3c8c80,_0x4d47cc){_0x3c8c80=_0x3c8c80-0x0;var _0x479a99=_0xd02d[_0x3c8c80];return _0x479a99;};'use strict';var _=require(_0xdd02('0x0'));var util=require(_0xdd02('0x1'));var logger=require(_0xdd02('0x2'))(_0xdd02('0x3'));var moment=require(_0xdd02('0x4'));var BPromise=require(_0xdd02('0x5'));var rp=require(_0xdd02('0x6'));var fs=require('fs');var path=require(_0xdd02('0x7'));var rimraf=require(_0xdd02('0x8'));var config=require(_0xdd02('0x9'));var attributes=require(_0xdd02('0xa'));module[_0xdd02('0xb')]=function(_0x5c33bc,_0x5420f3){return _0x5c33bc[_0xdd02('0xc')](_0xdd02('0xd'),attributes,{'tableName':_0xdd02('0xe'),'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 a8c9967..003e2db 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 _0x094c=['http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x51d86f,_0x35a556){var _0x6a5b09=function(_0x3fe969){while(--_0x3fe969){_0x51d86f['push'](_0x51d86f['shift']());}};_0x6a5b09(++_0x35a556);}(_0x094c,0x131));var _0xc094=function(_0x22cdda,_0x35cf94){_0x22cdda=_0x22cdda-0x0;var _0x307321=_0x094c[_0x22cdda];return _0x307321;};'use strict';var _=require('lodash');var util=require(_0xc094('0x0'));var moment=require(_0xc094('0x1'));var BPromise=require('bluebird');var rs=require(_0xc094('0x2'));var fs=require('fs');var Redis=require(_0xc094('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc094('0x4'));var logger=require(_0xc094('0x5'))(_0xc094('0x6'));var config=require(_0xc094('0x7'));var jayson=require(_0xc094('0x8'));var client=jayson[_0xc094('0x9')][_0xc094('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x479a30,_0x79fdd8,_0x54926c){return new BPromise(function(_0x699fb7,_0x2ae581){return client['request'](_0x479a30,_0x54926c)[_0xc094('0xb')](function(_0x1b3382){logger[_0xc094('0xc')](_0xc094('0xd'),_0x79fdd8,_0xc094('0xe'));logger[_0xc094('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x79fdd8,_0xc094('0xe'),JSON[_0xc094('0x10')](_0x1b3382));if(_0x1b3382[_0xc094('0x11')]){if(_0x1b3382['error']['code']===0x1f4){logger[_0xc094('0x11')](_0xc094('0xd'),_0x79fdd8,_0x1b3382[_0xc094('0x11')][_0xc094('0x12')]);return _0x2ae581(_0x1b3382[_0xc094('0x11')][_0xc094('0x12')]);}logger['error'](_0xc094('0xd'),_0x79fdd8,_0x1b3382['error'][_0xc094('0x12')]);return _0x699fb7(_0x1b3382[_0xc094('0x11')][_0xc094('0x12')]);}else{logger[_0xc094('0xc')](_0xc094('0xd'),_0x79fdd8,_0xc094('0xe'));_0x699fb7(_0x1b3382[_0xc094('0x13')][_0xc094('0x12')]);}})[_0xc094('0x14')](function(_0x464d16){logger['error']('ContactItemType,\x20%s,\x20%s',_0x79fdd8,_0x464d16);_0x2ae581(_0x464d16);});});} \ No newline at end of file +var _0x5242=['stringify','error','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x5d5ab2,_0x1d3681){var _0xb8fe37=function(_0x29a76c){while(--_0x29a76c){_0x5d5ab2['push'](_0x5d5ab2['shift']());}};_0xb8fe37(++_0x1d3681);}(_0x5242,0x148));var _0x2524=function(_0x3d6349,_0x24b8b4){_0x3d6349=_0x3d6349-0x0;var _0x1be0b8=_0x5242[_0x3d6349];return _0x1be0b8;};'use strict';var _=require(_0x2524('0x0'));var util=require(_0x2524('0x1'));var moment=require(_0x2524('0x2'));var BPromise=require(_0x2524('0x3'));var rs=require(_0x2524('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2524('0x5'))['db'];var utils=require(_0x2524('0x6'));var logger=require(_0x2524('0x7'))(_0x2524('0x8'));var config=require(_0x2524('0x9'));var jayson=require(_0x2524('0xa'));var client=jayson[_0x2524('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b070c,_0x1eca6b,_0x91975b){return new BPromise(function(_0x9f927c,_0x5729dd){return client['request'](_0x2b070c,_0x91975b)[_0x2524('0xc')](function(_0x2ecd8f){logger[_0x2524('0xd')]('ContactItemType,\x20%s,\x20%s',_0x1eca6b,_0x2524('0xe'));logger[_0x2524('0xf')](_0x2524('0x10'),_0x1eca6b,_0x2524('0xe'),JSON[_0x2524('0x11')](_0x2ecd8f));if(_0x2ecd8f[_0x2524('0x12')]){if(_0x2ecd8f[_0x2524('0x12')]['code']===0x1f4){logger['error'](_0x2524('0x13'),_0x1eca6b,_0x2ecd8f[_0x2524('0x12')][_0x2524('0x14')]);return _0x5729dd(_0x2ecd8f[_0x2524('0x12')][_0x2524('0x14')]);}logger[_0x2524('0x12')](_0x2524('0x13'),_0x1eca6b,_0x2ecd8f[_0x2524('0x12')][_0x2524('0x14')]);return _0x9f927c(_0x2ecd8f[_0x2524('0x12')][_0x2524('0x14')]);}else{logger[_0x2524('0xd')](_0x2524('0x13'),_0x1eca6b,_0x2524('0xe'));_0x9f927c(_0x2ecd8f[_0x2524('0x15')][_0x2524('0x14')]);}})[_0x2524('0x16')](function(_0x14c347){logger[_0x2524('0x12')]('ContactItemType,\x20%s,\x20%s',_0x1eca6b,_0x14c347);_0x5729dd(_0x14c347);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 6f7f842..9c61162 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 _0xbb93=['../../config/environment','./contactItemType.controller','get','isAuthenticated','index','show','post','put','/:id','update','destroy','util','path','express','Router','../../components/auth/service'];(function(_0x186abc,_0x4010a2){var _0x4e8456=function(_0x5d3f93){while(--_0x5d3f93){_0x186abc['push'](_0x186abc['shift']());}};_0x4e8456(++_0x4010a2);}(_0xbb93,0x1ab));var _0x3bb9=function(_0x3158fa,_0x3de97f){_0x3158fa=_0x3158fa-0x0;var _0x2cd043=_0xbb93[_0x3158fa];return _0x2cd043;};'use strict';var multer=require('multer');var util=require(_0x3bb9('0x0'));var path=require(_0x3bb9('0x1'));var timeout=require('connect-timeout');var express=require(_0x3bb9('0x2'));var router=express[_0x3bb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3bb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3bb9('0x5'));var controller=require(_0x3bb9('0x6'));router[_0x3bb9('0x7')]('/',auth[_0x3bb9('0x8')](),controller[_0x3bb9('0x9')]);router[_0x3bb9('0x7')]('/:id',auth[_0x3bb9('0x8')](),controller[_0x3bb9('0xa')]);router[_0x3bb9('0xb')]('/',auth[_0x3bb9('0x8')](),controller['create']);router[_0x3bb9('0xc')](_0x3bb9('0xd'),auth['isAuthenticated'](),controller[_0x3bb9('0xe')]);router['delete'](_0x3bb9('0xd'),auth[_0x3bb9('0x8')](),controller[_0x3bb9('0xf')]);module['exports']=router; \ No newline at end of file +var _0x46a1=['get','isAuthenticated','index','/:id','show','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x453282,_0x3acebb){var _0x387e74=function(_0x23b54f){while(--_0x23b54f){_0x453282['push'](_0x453282['shift']());}};_0x387e74(++_0x3acebb);}(_0x46a1,0x177));var _0x146a=function(_0x496071,_0xa515e9){_0x496071=_0x496071-0x0;var _0x299733=_0x46a1[_0x496071];return _0x299733;};'use strict';var multer=require(_0x146a('0x0'));var util=require(_0x146a('0x1'));var path=require('path');var timeout=require(_0x146a('0x2'));var express=require(_0x146a('0x3'));var router=express[_0x146a('0x4')]();var fs_extra=require(_0x146a('0x5'));var auth=require(_0x146a('0x6'));var interaction=require(_0x146a('0x7'));var config=require(_0x146a('0x8'));var controller=require('./contactItemType.controller');router[_0x146a('0x9')]('/',auth[_0x146a('0xa')](),controller[_0x146a('0xb')]);router[_0x146a('0x9')](_0x146a('0xc'),auth['isAuthenticated'](),controller[_0x146a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x146a('0xc'),auth[_0x146a('0xa')](),controller[_0x146a('0xe')]);router[_0x146a('0xf')](_0x146a('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 0494d46..c20d110 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 _0xd8b0=['exports','sequelize'];(function(_0x5e4353,_0x876e0b){var _0x27a4a0=function(_0x32aba3){while(--_0x32aba3){_0x5e4353['push'](_0x5e4353['shift']());}};_0x27a4a0(++_0x876e0b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x1e73e2,_0x2068d9){var _0x3694ea=function(_0x1b6ab6){while(--_0x1b6ab6){_0x1e73e2['push'](_0x1e73e2['shift']());}};_0x3694ea(++_0x2068d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x459baf,_0x332707){_0x459baf=_0x459baf-0x0;var _0x4a5970=_0xb10b[_0x459baf];return _0x4a5970;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c936392..e1b4939 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 _0xa5d9=['attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./dashboard.socket','register','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xa5d9,0x190));var _0x9a5d=function(_0x5a081e,_0x252d58){_0x5a081e=_0x5a081e-0x0;var _0x405998=_0xa5d9[_0x5a081e];return _0x405998;};'use strict';var emlformat=require(_0x9a5d('0x0'));var rimraf=require(_0x9a5d('0x1'));var zipdir=require(_0x9a5d('0x2'));var jsonpatch=require(_0x9a5d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9a5d('0x4'));var Mustache=require(_0x9a5d('0x5'));var util=require(_0x9a5d('0x6'));var path=require(_0x9a5d('0x7'));var sox=require('sox');var csv=require(_0x9a5d('0x8'));var ejs=require(_0x9a5d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a5d('0xa'));var squel=require(_0x9a5d('0xb'));var crypto=require(_0x9a5d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9a5d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9a5d('0xe'));var Papa=require(_0x9a5d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9a5d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a5d('0x11'))(_0x9a5d('0x12'));var utils=require(_0x9a5d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9a5d('0x14'));var db=require('../../mysqldb')['db'];config[_0x9a5d('0x15')]=_[_0x9a5d('0x16')](config['redis'],{'host':_0x9a5d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9a5d('0x18'))[_0x9a5d('0x19')](socket);function respondWithStatusCode(_0x360fb9,_0x55828c){_0x55828c=_0x55828c||0xcc;return function(_0x13e2f6){if(_0x13e2f6){return _0x360fb9[_0x9a5d('0x1a')](_0x55828c);}return _0x360fb9['status'](_0x55828c)[_0x9a5d('0x1b')]();};}function respondWithResult(_0x2b428a,_0x2470f7){_0x2470f7=_0x2470f7||0xc8;return function(_0x4bc09b){if(_0x4bc09b){return _0x2b428a[_0x9a5d('0x1c')](_0x2470f7)['json'](_0x4bc09b);}};}function respondWithFilteredResult(_0x3c86a6,_0x550164){return function(_0x4b3c5d){if(_0x4b3c5d){var _0x42f985=typeof _0x550164[_0x9a5d('0x1d')]===_0x9a5d('0x1e')&&typeof _0x550164['limit']==='undefined';var _0x1555b9=_0x4b3c5d[_0x9a5d('0x1f')];var _0x56748a=_0x42f985?0x0:_0x550164[_0x9a5d('0x1d')];var _0x27a1f3=_0x42f985?_0x4b3c5d[_0x9a5d('0x1f')]:_0x550164['offset']+_0x550164['limit'];var _0x34008d;if(_0x27a1f3>=_0x1555b9){_0x27a1f3=_0x1555b9;_0x34008d=0xc8;}else{_0x34008d=0xce;}_0x3c86a6[_0x9a5d('0x1c')](_0x34008d);return _0x3c86a6[_0x9a5d('0x20')](_0x9a5d('0x21'),_0x56748a+'-'+_0x27a1f3+'/'+_0x1555b9)[_0x9a5d('0x22')](_0x4b3c5d);}return null;};}function patchUpdates(_0x14b5b5){return function(_0x6fa541){try{jsonpatch[_0x9a5d('0x23')](_0x6fa541,_0x14b5b5,!![]);}catch(_0x9023f6){return BPromise[_0x9a5d('0x24')](_0x9023f6);}return _0x6fa541[_0x9a5d('0x25')]();};}function saveUpdates(_0x14fe28,_0x3c71e1){return function(_0x18b0b9){if(_0x18b0b9){return _0x18b0b9[_0x9a5d('0x26')](_0x14fe28)[_0x9a5d('0x27')](function(_0x216ef4){return _0x216ef4;});}return null;};}function removeEntity(_0x301890,_0x4b88bb){return function(_0x581476){if(_0x581476){return _0x581476[_0x9a5d('0x28')]()['then'](function(){var _0x24bd48=_0x581476[_0x9a5d('0x29')]({'plain':!![]});var _0x5cbd40='CustomDashboards';return db[_0x9a5d('0x2a')]['destroy']({'where':{'type':_0x5cbd40,'resourceId':_0x24bd48['id']}})['then'](function(){return _0x581476;});})[_0x9a5d('0x27')](function(){_0x301890[_0x9a5d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6d95,_0x4bd045){return function(_0x5bf163){if(!_0x5bf163){_0x3c6d95['sendStatus'](0x194);}return _0x5bf163;};}function handleError(_0x5201d8,_0x45bacd){_0x45bacd=_0x45bacd||0x1f4;return function(_0x580c54){logger['error'](_0x580c54[_0x9a5d('0x2b')]);if(_0x580c54[_0x9a5d('0x2c')]){delete _0x580c54[_0x9a5d('0x2c')];}_0x5201d8[_0x9a5d('0x1c')](_0x45bacd)[_0x9a5d('0x2d')](_0x580c54);};}exports[_0x9a5d('0x2e')]=function(_0x4aea56,_0x5e1a76){var _0x173bfa={},_0xebb329={},_0x328440={'count':0x0,'rows':[]};var _0x430182=_[_0x9a5d('0x2f')](db[_0x9a5d('0x30')][_0x9a5d('0x31')],function(_0x202647){return{'name':_0x202647[_0x9a5d('0x32')],'type':_0x202647[_0x9a5d('0x33')][_0x9a5d('0x34')]};});_0xebb329[_0x9a5d('0x35')]=_[_0x9a5d('0x2f')](_0x430182,_0x9a5d('0x2c'));_0xebb329[_0x9a5d('0x36')]=_[_0x9a5d('0x37')](_0x4aea56[_0x9a5d('0x36')]);_0xebb329[_0x9a5d('0x38')]=_[_0x9a5d('0x39')](_0xebb329['model'],_0xebb329[_0x9a5d('0x36')]);_0x173bfa[_0x9a5d('0x3a')]=_[_0x9a5d('0x39')](_0xebb329['model'],qs[_0x9a5d('0x3b')](_0x4aea56['query'][_0x9a5d('0x3b')]));_0x173bfa[_0x9a5d('0x3a')]=_0x173bfa[_0x9a5d('0x3a')][_0x9a5d('0x3c')]?_0x173bfa[_0x9a5d('0x3a')]:_0xebb329[_0x9a5d('0x35')];if(!_0x4aea56[_0x9a5d('0x36')][_0x9a5d('0x3d')](_0x9a5d('0x3e'))){_0x173bfa[_0x9a5d('0x3f')]=qs['limit'](_0x4aea56['query']['limit']);_0x173bfa[_0x9a5d('0x1d')]=qs[_0x9a5d('0x1d')](_0x4aea56['query'][_0x9a5d('0x1d')]);}_0x173bfa[_0x9a5d('0x40')]=qs['sort'](_0x4aea56[_0x9a5d('0x36')][_0x9a5d('0x41')]);_0x173bfa[_0x9a5d('0x42')]=qs['filters'](_[_0x9a5d('0x43')](_0x4aea56[_0x9a5d('0x36')],_0xebb329['filters']),_0x430182);if(_0x4aea56[_0x9a5d('0x36')]['filter']){_0x173bfa[_0x9a5d('0x42')]=_['merge'](_0x173bfa[_0x9a5d('0x42')],{'$or':_[_0x9a5d('0x2f')](_0x430182,function(_0x40bd2b){if(_0x40bd2b[_0x9a5d('0x33')]!==_0x9a5d('0x44')){var _0x419af1={};_0x419af1[_0x40bd2b[_0x9a5d('0x2c')]]={'$like':'%'+_0x4aea56[_0x9a5d('0x36')][_0x9a5d('0x45')]+'%'};return _0x419af1;}})});}_0x173bfa=_[_0x9a5d('0x46')]({},_0x173bfa,_0x4aea56[_0x9a5d('0x47')]);var _0x1f6a26={'where':_0x173bfa['where']};return db[_0x9a5d('0x30')][_0x9a5d('0x1f')](_0x1f6a26)[_0x9a5d('0x27')](function(_0x5f43ca){_0x328440[_0x9a5d('0x1f')]=_0x5f43ca;if(_0x4aea56[_0x9a5d('0x36')][_0x9a5d('0x48')]){_0x173bfa[_0x9a5d('0x49')]=[{'all':!![]}];}return db[_0x9a5d('0x30')][_0x9a5d('0x4a')](_0x173bfa);})[_0x9a5d('0x27')](function(_0x8cb22){_0x328440[_0x9a5d('0x4b')]=_0x8cb22;return _0x328440;})['then'](respondWithFilteredResult(_0x5e1a76,_0x173bfa))[_0x9a5d('0x4c')](handleError(_0x5e1a76,null));};exports['show']=function(_0x32f451,_0x291da1){var _0x189528={'raw':![],'where':{'id':_0x32f451[_0x9a5d('0x4d')]['id']}},_0x35f654={};_0x35f654[_0x9a5d('0x35')]=_['keys'](db[_0x9a5d('0x30')][_0x9a5d('0x31')]);_0x35f654[_0x9a5d('0x36')]=_[_0x9a5d('0x37')](_0x32f451[_0x9a5d('0x36')]);_0x35f654['filters']=_[_0x9a5d('0x39')](_0x35f654[_0x9a5d('0x35')],_0x35f654[_0x9a5d('0x36')]);_0x189528[_0x9a5d('0x3a')]=_[_0x9a5d('0x39')](_0x35f654[_0x9a5d('0x35')],qs[_0x9a5d('0x3b')](_0x32f451[_0x9a5d('0x36')][_0x9a5d('0x3b')]));_0x189528[_0x9a5d('0x3a')]=_0x189528[_0x9a5d('0x3a')][_0x9a5d('0x3c')]?_0x189528['attributes']:_0x35f654[_0x9a5d('0x35')];if(_0x32f451[_0x9a5d('0x36')]['includeAll']){_0x189528['include']=[{'all':!![]}];}_0x189528=_['merge']({},_0x189528,_0x32f451[_0x9a5d('0x47')]);return db['Dashboard'][_0x9a5d('0x4e')](_0x189528)['then'](handleEntityNotFound(_0x291da1,null))[_0x9a5d('0x27')](respondWithResult(_0x291da1,null))['catch'](handleError(_0x291da1,null));};exports[_0x9a5d('0x4f')]=function(_0x571d3e,_0x24aa21){return db[_0x9a5d('0x30')][_0x9a5d('0x4f')](_0x571d3e[_0x9a5d('0x50')],{})[_0x9a5d('0x27')](function(_0x53e995){var _0x4a8aa9=_0x571d3e[_0x9a5d('0x51')][_0x9a5d('0x29')]({'plain':!![]});if(!_0x4a8aa9)throw new Error(_0x9a5d('0x52'));if(_0x4a8aa9[_0x9a5d('0x53')]==='user'){var _0x36ac97=_0x53e995[_0x9a5d('0x29')]({'plain':!![]});var _0x28f033='CustomDashboards';return db[_0x9a5d('0x54')][_0x9a5d('0x4e')]({'where':{'name':_0x28f033,'userProfileId':_0x4a8aa9[_0x9a5d('0x55')]},'raw':!![]})['then'](function(_0x44e912){if(_0x44e912&&_0x44e912[_0x9a5d('0x56')]===0x0){return db[_0x9a5d('0x2a')][_0x9a5d('0x4f')]({'name':_0x36ac97[_0x9a5d('0x2c')],'resourceId':_0x36ac97['id'],'type':_0x44e912[_0x9a5d('0x2c')],'sectionId':_0x44e912['id']},{})['then'](function(){return _0x53e995;});}else{return _0x53e995;}})[_0x9a5d('0x4c')](function(_0x6efa2f){logger[_0x9a5d('0x57')](_0x9a5d('0x58'),_0x6efa2f);throw _0x6efa2f;});}return _0x53e995;})[_0x9a5d('0x27')](respondWithResult(_0x24aa21,0xc9))[_0x9a5d('0x4c')](handleError(_0x24aa21,null));};exports[_0x9a5d('0x59')]=function(_0x475618,_0x24d85f){var _0x2fb3f4={'where':{'id':_0x475618[_0x9a5d('0x4d')]['id']}},_0x45f433={};_0x45f433[_0x9a5d('0x35')]=_[_0x9a5d('0x37')](db[_0x9a5d('0x30')][_0x9a5d('0x31')]);_0x2fb3f4[_0x9a5d('0x3a')]=_['intersection'](_0x45f433[_0x9a5d('0x35')],qs[_0x9a5d('0x3b')](_0x475618['query'][_0x9a5d('0x3b')]));_0x2fb3f4[_0x9a5d('0x3a')]=_0x2fb3f4[_0x9a5d('0x3a')][_0x9a5d('0x3c')]?_0x2fb3f4[_0x9a5d('0x3a')]:_0x45f433[_0x9a5d('0x35')];if(_0x475618['query'][_0x9a5d('0x48')]){_0x2fb3f4[_0x9a5d('0x49')]=[{'all':!![]}];}_0x2fb3f4=_[_0x9a5d('0x46')]({},_0x2fb3f4,_0x475618['options']);return db[_0x9a5d('0x30')]['find'](_0x2fb3f4)[_0x9a5d('0x27')](handleEntityNotFound(_0x24d85f,null))[_0x9a5d('0x27')](function(_0x3aa98e){if(_0x3aa98e){var _0x4977af=_0x3aa98e['get']({'plain':!![]});_0x4977af=qs['omit'](_0x4977af,['id',_0x9a5d('0x5a'),'updatedAt']);_0x475618[_0x9a5d('0x50')]=_['omit'](_0x475618[_0x9a5d('0x50')],['id','createdAt',_0x9a5d('0x5b')]);return db[_0x9a5d('0x30')][_0x9a5d('0x4f')](_[_0x9a5d('0x46')](_0x4977af,_0x475618['body']),{'include':_0x475618['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2f3928){var _0x29553b=_0x475618[_0x9a5d('0x51')]['get']({'plain':!![]});if(!_0x29553b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29553b[_0x9a5d('0x53')]===_0x9a5d('0x51')){var _0x4bceb9=_0x2f3928[_0x9a5d('0x29')]({'plain':!![]});var _0x27d008='CustomDashboards';return db[_0x9a5d('0x54')][_0x9a5d('0x4e')]({'where':{'name':_0x27d008,'userProfileId':_0x29553b['userProfileId']},'raw':!![]})[_0x9a5d('0x27')](function(_0x7ef1c6){if(_0x7ef1c6&&_0x7ef1c6['autoAssociation']===0x0){return db[_0x9a5d('0x2a')][_0x9a5d('0x4f')]({'name':_0x4bceb9['name'],'resourceId':_0x4bceb9['id'],'type':_0x7ef1c6['name'],'sectionId':_0x7ef1c6['id']},{})['then'](function(){return _0x2f3928;});}else{return _0x2f3928;}})[_0x9a5d('0x4c')](function(_0x142878){logger[_0x9a5d('0x57')](_0x9a5d('0x58'),_0x142878);throw _0x142878;});}return _0x2f3928;});}})[_0x9a5d('0x27')](respondWithResult(_0x24d85f,0xc9))[_0x9a5d('0x4c')](handleError(_0x24d85f,null));};exports[_0x9a5d('0x26')]=function(_0x4bd79a,_0x30eadb){if(_0x4bd79a[_0x9a5d('0x50')]['id']){delete _0x4bd79a[_0x9a5d('0x50')]['id'];}return db['Dashboard'][_0x9a5d('0x4e')]({'where':{'id':_0x4bd79a[_0x9a5d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x30eadb,null))[_0x9a5d('0x27')](saveUpdates(_0x4bd79a['body'],null))[_0x9a5d('0x27')](respondWithResult(_0x30eadb,null))[_0x9a5d('0x4c')](handleError(_0x30eadb,null));};exports[_0x9a5d('0x28')]=function(_0x21d5f9,_0x1f62e3){return db[_0x9a5d('0x30')]['find']({'where':{'id':_0x21d5f9[_0x9a5d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f62e3,null))[_0x9a5d('0x27')](removeEntity(_0x1f62e3,null))[_0x9a5d('0x4c')](handleError(_0x1f62e3,null));};function widgetAttributes(_0x4a37bf){try{switch(_0x4a37bf[_0x9a5d('0x33')]){case _0x9a5d('0x5c'):return[{'name':_0x9a5d('0x5d'),'value':_0x4a37bf[_0x9a5d('0x5d')]||(_0x4a37bf['attrs']&&_0x4a37bf['attrs'][0x0]?_0x4a37bf[_0x9a5d('0x5e')][0x0][_0x9a5d('0x5f')]:undefined)||_0x9a5d('0x60')}];case _0x9a5d('0x61'):return[{'name':_0x9a5d('0x62'),'value':_0x4a37bf[_0x9a5d('0x62')]||(_0x4a37bf['attrs']&&_0x4a37bf[_0x9a5d('0x5e')][0x0]?_0x4a37bf[_0x9a5d('0x5e')][0x0][_0x9a5d('0x5f')]:undefined)||''}];case _0x9a5d('0x63'):return[{'name':_0x9a5d('0x64'),'value':_0x4a37bf[_0x9a5d('0x64')]||(_0x4a37bf['attrs']&&_0x4a37bf[_0x9a5d('0x5e')][0x0]?_0x4a37bf[_0x9a5d('0x5e')][0x0][_0x9a5d('0x5f')]:undefined)||_0x9a5d('0x65')},{'name':_0x9a5d('0x66'),'value':_0x4a37bf[_0x9a5d('0x66')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x1]?_0x4a37bf[_0x9a5d('0x5e')][0x1]['value']:undefined)||_0x9a5d('0x67')},{'name':_0x9a5d('0x68'),'value':_0x4a37bf[_0x9a5d('0x68')]||(_0x4a37bf['attrs']&&_0x4a37bf[_0x9a5d('0x5e')][0x2]?_0x4a37bf[_0x9a5d('0x5e')][0x2][_0x9a5d('0x5f')]:undefined)||0xc}];case'counter':return[{'name':_0x9a5d('0x69'),'value':_0x4a37bf[_0x9a5d('0x69')]||(_0x4a37bf['attrs']&&_0x4a37bf[_0x9a5d('0x5e')][0x0]?_0x4a37bf['attrs'][0x0]['value']:undefined)||_0x9a5d('0x6a')},{'name':_0x9a5d('0x6b'),'value':_0x4a37bf[_0x9a5d('0x6b')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x1]?_0x4a37bf[_0x9a5d('0x5e')][0x1][_0x9a5d('0x5f')]:undefined)||[]},{'name':_0x9a5d('0x68'),'value':_0x4a37bf[_0x9a5d('0x68')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x2]?_0x4a37bf[_0x9a5d('0x5e')][0x2][_0x9a5d('0x5f')]:undefined)||0x14},{'name':_0x9a5d('0x6c'),'value':_0x4a37bf[_0x9a5d('0x6c')]||(_0x4a37bf['attrs']&&_0x4a37bf[_0x9a5d('0x5e')][0x3]?_0x4a37bf['attrs'][0x3]['value']:undefined)||_0x9a5d('0x6d')},{'name':'attrEmailAccounts','value':_0x4a37bf[_0x9a5d('0x6e')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x4]?_0x4a37bf[_0x9a5d('0x5e')][0x4][_0x9a5d('0x5f')]:undefined)||''},{'name':_0x9a5d('0x6f'),'value':_0x4a37bf[_0x9a5d('0x6f')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf['attrs'][0x5]?_0x4a37bf[_0x9a5d('0x5e')][0x5][_0x9a5d('0x5f')]:undefined)||''},{'name':_0x9a5d('0x70'),'value':_0x4a37bf[_0x9a5d('0x70')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x6]?_0x4a37bf['attrs'][0x6][_0x9a5d('0x5f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4a37bf[_0x9a5d('0x71')]||(_0x4a37bf['attrs']&&_0x4a37bf[_0x9a5d('0x5e')][0x7]?_0x4a37bf[_0x9a5d('0x5e')][0x7][_0x9a5d('0x5f')]:undefined)||''},{'name':_0x9a5d('0x72'),'value':_0x4a37bf['attrWhatsappAccounts']||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf['attrs'][0x8]?_0x4a37bf[_0x9a5d('0x5e')][0x8][_0x9a5d('0x5f')]:undefined)||''},{'name':_0x9a5d('0x73'),'value':_0x4a37bf[_0x9a5d('0x73')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x9]?_0x4a37bf[_0x9a5d('0x5e')][0x9][_0x9a5d('0x5f')]:undefined)||''}];case _0x9a5d('0x74'):case _0x9a5d('0x75'):return[{'name':'attrSerie1','value':_0x4a37bf[_0x9a5d('0x76')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf['attrs'][0x0]?_0x4a37bf[_0x9a5d('0x5e')][0x0][_0x9a5d('0x5f')]:undefined)||_0x9a5d('0x6a')},{'name':_0x9a5d('0x77'),'value':_0x4a37bf[_0x9a5d('0x77')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x1]?_0x4a37bf[_0x9a5d('0x5e')][0x1]['value']:undefined)||null},{'name':_0x9a5d('0x78'),'value':_0x4a37bf[_0x9a5d('0x78')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf['attrs'][0x2]?_0x4a37bf[_0x9a5d('0x5e')][0x2]['value']:undefined)||null},{'name':_0x9a5d('0x6b'),'value':_0x4a37bf['attrVoiceQueues']||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x3]?_0x4a37bf['attrs'][0x3][_0x9a5d('0x5f')]:undefined)||[]},{'name':_0x9a5d('0x6c'),'value':_0x4a37bf[_0x9a5d('0x6c')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x4]?_0x4a37bf[_0x9a5d('0x5e')][0x4]['value']:undefined)||_0x9a5d('0x6d')},{'name':_0x9a5d('0x6e'),'value':_0x4a37bf[_0x9a5d('0x6e')]||(_0x4a37bf['attrs']&&_0x4a37bf['attrs'][0x5]?_0x4a37bf['attrs'][0x5]['value']:undefined)||''},{'name':_0x9a5d('0x6f'),'value':_0x4a37bf['attrFaxAccounts']||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x6]?_0x4a37bf[_0x9a5d('0x5e')][0x6][_0x9a5d('0x5f')]:undefined)||''},{'name':_0x9a5d('0x70'),'value':_0x4a37bf[_0x9a5d('0x70')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf['attrs'][0x7]?_0x4a37bf[_0x9a5d('0x5e')][0x7][_0x9a5d('0x5f')]:undefined)||''},{'name':_0x9a5d('0x71'),'value':_0x4a37bf[_0x9a5d('0x71')]||(_0x4a37bf['attrs']&&_0x4a37bf[_0x9a5d('0x5e')][0x8]?_0x4a37bf[_0x9a5d('0x5e')][0x8]['value']:undefined)||''},{'name':_0x9a5d('0x72'),'value':_0x4a37bf[_0x9a5d('0x72')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x9]?_0x4a37bf[_0x9a5d('0x5e')][0x9][_0x9a5d('0x5f')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4a37bf[_0x9a5d('0x73')]||(_0x4a37bf['attrs']&&_0x4a37bf[_0x9a5d('0x5e')][0xa]?_0x4a37bf[_0x9a5d('0x5e')][0xa][_0x9a5d('0x5f')]:undefined)||''}];case _0x9a5d('0x79'):return[{'name':_0x9a5d('0x7a'),'type':_0x4a37bf['reportType']||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x0]?_0x4a37bf[_0x9a5d('0x5e')][0x0][_0x9a5d('0x33')]:undefined)||null,'value':_0x4a37bf[_0x9a5d('0x7a')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf[_0x9a5d('0x5e')][0x0]?_0x4a37bf[_0x9a5d('0x5e')][0x0][_0x9a5d('0x5f')]:undefined)||null},{'name':_0x9a5d('0x7b'),'value':_0x4a37bf[_0x9a5d('0x7b')]||(_0x4a37bf[_0x9a5d('0x5e')]&&_0x4a37bf['attrs'][0x1]?_0x4a37bf[_0x9a5d('0x5e')][0x1][_0x9a5d('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x476673){logger['error'](_0x9a5d('0x7c'),JSON[_0x9a5d('0x7d')](_0x476673));return[];}}exports['addItem']=function(_0x1aee3a,_0x3be7dc,_0x58e69d){if(_0x1aee3a['body']['id']){delete _0x1aee3a[_0x9a5d('0x50')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x1aee3a[_0x9a5d('0x4d')]['id']}})[_0x9a5d('0x27')](handleEntityNotFound(_0x3be7dc,null))[_0x9a5d('0x27')](function(_0x3ff621){if(_0x3ff621){_0x1aee3a[_0x9a5d('0x50')][_0x9a5d('0x7e')]=_0x3ff621['id'];_0x1aee3a[_0x9a5d('0x50')][_0x9a5d('0x5e')]=widgetAttributes(_0x1aee3a[_0x9a5d('0x50')]);return db[_0x9a5d('0x7f')][_0x9a5d('0x4f')](_0x1aee3a[_0x9a5d('0x50')]);}})[_0x9a5d('0x27')](respondWithResult(_0x3be7dc,null))[_0x9a5d('0x4c')](handleError(_0x3be7dc,null));};exports[_0x9a5d('0x80')]=function(_0x2374ef,_0x3da880,_0x15c6a5){var _0x1655b9={};var _0x2ad926={};var _0xda2d06;var _0x52d340;return db[_0x9a5d('0x30')][_0x9a5d('0x81')]({'where':{'id':_0x2374ef[_0x9a5d('0x4d')]['id']}})[_0x9a5d('0x27')](handleEntityNotFound(_0x3da880,null))[_0x9a5d('0x27')](function(_0x1c3097){if(_0x1c3097){_0xda2d06=_0x1c3097;_0x2ad926['model']=_[_0x9a5d('0x37')](db[_0x9a5d('0x7f')]['rawAttributes']);_0x2ad926[_0x9a5d('0x36')]=_['keys'](_0x2374ef['query']);_0x2ad926[_0x9a5d('0x38')]=_[_0x9a5d('0x39')](_0x2ad926[_0x9a5d('0x35')],_0x2ad926[_0x9a5d('0x36')]);_0x1655b9['attributes']=_[_0x9a5d('0x39')](_0x2ad926[_0x9a5d('0x35')],qs[_0x9a5d('0x3b')](_0x2374ef[_0x9a5d('0x36')]['fields']));_0x1655b9[_0x9a5d('0x3a')]=_0x1655b9['attributes'][_0x9a5d('0x3c')]?_0x1655b9[_0x9a5d('0x3a')]:_0x2ad926[_0x9a5d('0x35')];_0x1655b9[_0x9a5d('0x40')]=qs['sort'](_0x2374ef['query'][_0x9a5d('0x41')]);_0x1655b9[_0x9a5d('0x42')]=qs[_0x9a5d('0x38')](_[_0x9a5d('0x43')](_0x2374ef['query'],_0x2ad926[_0x9a5d('0x38')]));if(_0x2374ef[_0x9a5d('0x36')]['filter']){_0x1655b9[_0x9a5d('0x42')]=_[_0x9a5d('0x46')](_0x1655b9['where'],{'$or':_[_0x9a5d('0x2f')](_0x1655b9[_0x9a5d('0x3a')],function(_0x557dc4){var _0x56715e={};_0x56715e[_0x557dc4]={'$like':'%'+_0x2374ef[_0x9a5d('0x36')][_0x9a5d('0x45')]+'%'};return _0x56715e;})});}_0x1655b9=_['merge']({},_0x1655b9,_0x2374ef['options']);return _0xda2d06[_0x9a5d('0x80')](_0x1655b9);}})[_0x9a5d('0x27')](function(_0x537f0f){if(_0x537f0f){_0x52d340=_0x537f0f[_0x9a5d('0x3c')];if(!_0x2374ef[_0x9a5d('0x36')]['hasOwnProperty'](_0x9a5d('0x3e'))){_0x1655b9['limit']=qs[_0x9a5d('0x3f')](_0x2374ef['query'][_0x9a5d('0x3f')]);_0x1655b9[_0x9a5d('0x1d')]=qs[_0x9a5d('0x1d')](_0x2374ef['query'][_0x9a5d('0x1d')]);}return _0xda2d06[_0x9a5d('0x80')](_0x1655b9);}})[_0x9a5d('0x27')](function(_0x3e99fe){if(_0x3e99fe){return _0x3e99fe?{'count':_0x52d340,'rows':_0x3e99fe}:null;}})[_0x9a5d('0x27')](respondWithResult(_0x3da880,null))[_0x9a5d('0x4c')](handleError(_0x3da880,null));}; \ No newline at end of file +var _0x9a8e=['update','then','UserProfileResource','destroy','sendStatus','error','name','send','index','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','where','pick','merge','map','VIRTUAL','filter','include','findAll','catch','show','params','fields','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','clone','rawAttributes','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','sort','nolimit','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save'];(function(_0x2410f0,_0x3b2cf2){var _0x4c643e=function(_0x1248a8){while(--_0x1248a8){_0x2410f0['push'](_0x2410f0['shift']());}};_0x4c643e(++_0x3b2cf2);}(_0x9a8e,0x1ea));var _0xe9a8=function(_0x3d2e1e,_0x2672c8){_0x3d2e1e=_0x3d2e1e-0x0;var _0x297116=_0x9a8e[_0x3d2e1e];return _0x297116;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe9a8('0x0'));var jsonpatch=require(_0xe9a8('0x1'));var rp=require('request-promise');var moment=require(_0xe9a8('0x2'));var BPromise=require(_0xe9a8('0x3'));var Mustache=require(_0xe9a8('0x4'));var util=require(_0xe9a8('0x5'));var path=require(_0xe9a8('0x6'));var sox=require(_0xe9a8('0x7'));var csv=require('to-csv');var ejs=require(_0xe9a8('0x8'));var fs=require('fs');var fs_extra=require(_0xe9a8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe9a8('0xa'));var jsforce=require(_0xe9a8('0xb'));var deskjs=require(_0xe9a8('0xc'));var toCsv=require(_0xe9a8('0xd'));var querystring=require(_0xe9a8('0xe'));var Papa=require('papaparse');var Redis=require(_0xe9a8('0xf'));var authService=require(_0xe9a8('0x10'));var qs=require(_0xe9a8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9a8('0x12'));var logger=require(_0xe9a8('0x13'))(_0xe9a8('0x14'));var utils=require(_0xe9a8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe9a8('0x16'));var db=require(_0xe9a8('0x17'))['db'];config[_0xe9a8('0x18')]=_[_0xe9a8('0x19')](config[_0xe9a8('0x18')],{'host':_0xe9a8('0x1a'),'port':0x18eb});var socket=require(_0xe9a8('0x1b'))(new Redis(config[_0xe9a8('0x18')]));require(_0xe9a8('0x1c'))[_0xe9a8('0x1d')](socket);function respondWithStatusCode(_0x59957b,_0x2b6db7){_0x2b6db7=_0x2b6db7||0xcc;return function(_0x343eaf){if(_0x343eaf){return _0x59957b['sendStatus'](_0x2b6db7);}return _0x59957b[_0xe9a8('0x1e')](_0x2b6db7)[_0xe9a8('0x1f')]();};}function respondWithResult(_0x3e31b1,_0x579262){_0x579262=_0x579262||0xc8;return function(_0xf69953){if(_0xf69953){return _0x3e31b1['status'](_0x579262)[_0xe9a8('0x20')](_0xf69953);}};}function respondWithFilteredResult(_0x7d04b9,_0x2ef73b){return function(_0x52c2fc){if(_0x52c2fc){var _0x24e5d2=typeof _0x2ef73b['offset']==='undefined'&&typeof _0x2ef73b['limit']===_0xe9a8('0x21');var _0x1121cd=_0x52c2fc['count'];var _0x276d75=_0x24e5d2?0x0:_0x2ef73b[_0xe9a8('0x22')];var _0x44fb28=_0x24e5d2?_0x52c2fc[_0xe9a8('0x23')]:_0x2ef73b[_0xe9a8('0x22')]+_0x2ef73b[_0xe9a8('0x24')];var _0x2b6932;if(_0x44fb28>=_0x1121cd){_0x44fb28=_0x1121cd;_0x2b6932=0xc8;}else{_0x2b6932=0xce;}_0x7d04b9['status'](_0x2b6932);return _0x7d04b9[_0xe9a8('0x25')](_0xe9a8('0x26'),_0x276d75+'-'+_0x44fb28+'/'+_0x1121cd)[_0xe9a8('0x20')](_0x52c2fc);}return null;};}function patchUpdates(_0xa4d0df){return function(_0x1c6380){try{jsonpatch[_0xe9a8('0x27')](_0x1c6380,_0xa4d0df,!![]);}catch(_0x6d20bc){return BPromise[_0xe9a8('0x28')](_0x6d20bc);}return _0x1c6380[_0xe9a8('0x29')]();};}function saveUpdates(_0x47c80c,_0x140234){return function(_0x3e49f1){if(_0x3e49f1){return _0x3e49f1[_0xe9a8('0x2a')](_0x47c80c)[_0xe9a8('0x2b')](function(_0x17668b){return _0x17668b;});}return null;};}function removeEntity(_0x15be1d,_0x131180){return function(_0x473b34){if(_0x473b34){return _0x473b34['destroy']()[_0xe9a8('0x2b')](function(){var _0x3fbf69=_0x473b34['get']({'plain':!![]});var _0xac69d5='CustomDashboards';return db[_0xe9a8('0x2c')][_0xe9a8('0x2d')]({'where':{'type':_0xac69d5,'resourceId':_0x3fbf69['id']}})[_0xe9a8('0x2b')](function(){return _0x473b34;});})[_0xe9a8('0x2b')](function(){_0x15be1d[_0xe9a8('0x1e')](0xcc)[_0xe9a8('0x1f')]();});}};}function handleEntityNotFound(_0x48d6cf,_0x2da72f){return function(_0xa97c88){if(!_0xa97c88){_0x48d6cf[_0xe9a8('0x2e')](0x194);}return _0xa97c88;};}function handleError(_0x79a775,_0x145b98){_0x145b98=_0x145b98||0x1f4;return function(_0x5850b8){logger[_0xe9a8('0x2f')](_0x5850b8['stack']);if(_0x5850b8[_0xe9a8('0x30')]){delete _0x5850b8[_0xe9a8('0x30')];}_0x79a775['status'](_0x145b98)[_0xe9a8('0x31')](_0x5850b8);};}exports[_0xe9a8('0x32')]=function(_0x324e6d,_0x307898){var _0xeccfe5={},_0x29609c={},_0x3a7ea6={'count':0x0,'rows':[]};var _0x516742=_['map'](db[_0xe9a8('0x33')]['rawAttributes'],function(_0x45551c){return{'name':_0x45551c[_0xe9a8('0x34')],'type':_0x45551c[_0xe9a8('0x35')][_0xe9a8('0x36')]};});_0x29609c[_0xe9a8('0x37')]=_['map'](_0x516742,_0xe9a8('0x30'));_0x29609c[_0xe9a8('0x38')]=_[_0xe9a8('0x39')](_0x324e6d[_0xe9a8('0x38')]);_0x29609c[_0xe9a8('0x3a')]=_[_0xe9a8('0x3b')](_0x29609c[_0xe9a8('0x37')],_0x29609c['query']);_0xeccfe5[_0xe9a8('0x3c')]=_['intersection'](_0x29609c[_0xe9a8('0x37')],qs['fields'](_0x324e6d[_0xe9a8('0x38')]['fields']));_0xeccfe5[_0xe9a8('0x3c')]=_0xeccfe5[_0xe9a8('0x3c')]['length']?_0xeccfe5['attributes']:_0x29609c[_0xe9a8('0x37')];if(!_0x324e6d[_0xe9a8('0x38')][_0xe9a8('0x3d')]('nolimit')){_0xeccfe5[_0xe9a8('0x24')]=qs['limit'](_0x324e6d[_0xe9a8('0x38')][_0xe9a8('0x24')]);_0xeccfe5[_0xe9a8('0x22')]=qs['offset'](_0x324e6d[_0xe9a8('0x38')][_0xe9a8('0x22')]);}_0xeccfe5[_0xe9a8('0x3e')]=qs['sort'](_0x324e6d['query']['sort']);_0xeccfe5[_0xe9a8('0x3f')]=qs['filters'](_[_0xe9a8('0x40')](_0x324e6d[_0xe9a8('0x38')],_0x29609c['filters']),_0x516742);if(_0x324e6d[_0xe9a8('0x38')]['filter']){_0xeccfe5[_0xe9a8('0x3f')]=_[_0xe9a8('0x41')](_0xeccfe5[_0xe9a8('0x3f')],{'$or':_[_0xe9a8('0x42')](_0x516742,function(_0x5cd38c){if(_0x5cd38c[_0xe9a8('0x35')]!==_0xe9a8('0x43')){var _0x25576c={};_0x25576c[_0x5cd38c[_0xe9a8('0x30')]]={'$like':'%'+_0x324e6d[_0xe9a8('0x38')][_0xe9a8('0x44')]+'%'};return _0x25576c;}})});}_0xeccfe5=_[_0xe9a8('0x41')]({},_0xeccfe5,_0x324e6d['options']);var _0x2a09f6={'where':_0xeccfe5[_0xe9a8('0x3f')]};return db[_0xe9a8('0x33')]['count'](_0x2a09f6)[_0xe9a8('0x2b')](function(_0xe6526d){_0x3a7ea6[_0xe9a8('0x23')]=_0xe6526d;if(_0x324e6d['query']['includeAll']){_0xeccfe5[_0xe9a8('0x45')]=[{'all':!![]}];}return db[_0xe9a8('0x33')][_0xe9a8('0x46')](_0xeccfe5);})[_0xe9a8('0x2b')](function(_0x3aa214){_0x3a7ea6['rows']=_0x3aa214;return _0x3a7ea6;})[_0xe9a8('0x2b')](respondWithFilteredResult(_0x307898,_0xeccfe5))[_0xe9a8('0x47')](handleError(_0x307898,null));};exports[_0xe9a8('0x48')]=function(_0x13c4d4,_0x4d482d){var _0x2043b1={'raw':![],'where':{'id':_0x13c4d4[_0xe9a8('0x49')]['id']}},_0x27f463={};_0x27f463[_0xe9a8('0x37')]=_['keys'](db['Dashboard']['rawAttributes']);_0x27f463[_0xe9a8('0x38')]=_[_0xe9a8('0x39')](_0x13c4d4[_0xe9a8('0x38')]);_0x27f463[_0xe9a8('0x3a')]=_[_0xe9a8('0x3b')](_0x27f463[_0xe9a8('0x37')],_0x27f463['query']);_0x2043b1[_0xe9a8('0x3c')]=_[_0xe9a8('0x3b')](_0x27f463['model'],qs[_0xe9a8('0x4a')](_0x13c4d4['query']['fields']));_0x2043b1[_0xe9a8('0x3c')]=_0x2043b1['attributes'][_0xe9a8('0x4b')]?_0x2043b1[_0xe9a8('0x3c')]:_0x27f463['model'];if(_0x13c4d4[_0xe9a8('0x38')][_0xe9a8('0x4c')]){_0x2043b1[_0xe9a8('0x45')]=[{'all':!![]}];}_0x2043b1=_[_0xe9a8('0x41')]({},_0x2043b1,_0x13c4d4[_0xe9a8('0x4d')]);return db[_0xe9a8('0x33')][_0xe9a8('0x4e')](_0x2043b1)['then'](handleEntityNotFound(_0x4d482d,null))[_0xe9a8('0x2b')](respondWithResult(_0x4d482d,null))[_0xe9a8('0x47')](handleError(_0x4d482d,null));};exports[_0xe9a8('0x4f')]=function(_0x32a6b7,_0x568afd){return db[_0xe9a8('0x33')][_0xe9a8('0x4f')](_0x32a6b7[_0xe9a8('0x50')],{})[_0xe9a8('0x2b')](function(_0x543bb0){var _0x413014=_0x32a6b7[_0xe9a8('0x51')]['get']({'plain':!![]});if(!_0x413014)throw new Error(_0xe9a8('0x52'));if(_0x413014[_0xe9a8('0x53')]===_0xe9a8('0x51')){var _0x3ec315=_0x543bb0[_0xe9a8('0x54')]({'plain':!![]});var _0x280ee4=_0xe9a8('0x55');return db[_0xe9a8('0x56')]['find']({'where':{'name':_0x280ee4,'userProfileId':_0x413014[_0xe9a8('0x57')]},'raw':!![]})[_0xe9a8('0x2b')](function(_0x4626d3){if(_0x4626d3&&_0x4626d3[_0xe9a8('0x58')]===0x0){return db[_0xe9a8('0x2c')][_0xe9a8('0x4f')]({'name':_0x3ec315[_0xe9a8('0x30')],'resourceId':_0x3ec315['id'],'type':_0x4626d3[_0xe9a8('0x30')],'sectionId':_0x4626d3['id']},{})[_0xe9a8('0x2b')](function(){return _0x543bb0;});}else{return _0x543bb0;}})[_0xe9a8('0x47')](function(_0x1bcb2c){logger[_0xe9a8('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bcb2c);throw _0x1bcb2c;});}return _0x543bb0;})[_0xe9a8('0x2b')](respondWithResult(_0x568afd,0xc9))[_0xe9a8('0x47')](handleError(_0x568afd,null));};exports[_0xe9a8('0x59')]=function(_0x260f2c,_0x405fcf){var _0x6ceb54={'where':{'id':_0x260f2c[_0xe9a8('0x49')]['id']}},_0x27cb84={};_0x27cb84[_0xe9a8('0x37')]=_[_0xe9a8('0x39')](db[_0xe9a8('0x33')][_0xe9a8('0x5a')]);_0x6ceb54[_0xe9a8('0x3c')]=_[_0xe9a8('0x3b')](_0x27cb84[_0xe9a8('0x37')],qs[_0xe9a8('0x4a')](_0x260f2c[_0xe9a8('0x38')][_0xe9a8('0x4a')]));_0x6ceb54[_0xe9a8('0x3c')]=_0x6ceb54[_0xe9a8('0x3c')][_0xe9a8('0x4b')]?_0x6ceb54[_0xe9a8('0x3c')]:_0x27cb84[_0xe9a8('0x37')];if(_0x260f2c[_0xe9a8('0x38')][_0xe9a8('0x4c')]){_0x6ceb54['include']=[{'all':!![]}];}_0x6ceb54=_['merge']({},_0x6ceb54,_0x260f2c[_0xe9a8('0x4d')]);return db[_0xe9a8('0x33')][_0xe9a8('0x4e')](_0x6ceb54)[_0xe9a8('0x2b')](handleEntityNotFound(_0x405fcf,null))[_0xe9a8('0x2b')](function(_0x1745b1){if(_0x1745b1){var _0x382b79=_0x1745b1[_0xe9a8('0x54')]({'plain':!![]});_0x382b79=qs[_0xe9a8('0x5b')](_0x382b79,['id',_0xe9a8('0x5c'),_0xe9a8('0x5d')]);_0x260f2c[_0xe9a8('0x50')]=_[_0xe9a8('0x5b')](_0x260f2c[_0xe9a8('0x50')],['id',_0xe9a8('0x5c'),_0xe9a8('0x5d')]);return db[_0xe9a8('0x33')][_0xe9a8('0x4f')](_[_0xe9a8('0x41')](_0x382b79,_0x260f2c[_0xe9a8('0x50')]),{'include':_0x260f2c[_0xe9a8('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0xe9a8('0x2b')](function(_0x20b4c7){var _0xad42e0=_0x260f2c[_0xe9a8('0x51')]['get']({'plain':!![]});if(!_0xad42e0)throw new Error(_0xe9a8('0x52'));if(_0xad42e0[_0xe9a8('0x53')]===_0xe9a8('0x51')){var _0x2cda16=_0x20b4c7[_0xe9a8('0x54')]({'plain':!![]});var _0x271c81=_0xe9a8('0x55');return db[_0xe9a8('0x56')][_0xe9a8('0x4e')]({'where':{'name':_0x271c81,'userProfileId':_0xad42e0[_0xe9a8('0x57')]},'raw':!![]})[_0xe9a8('0x2b')](function(_0x3bec3b){if(_0x3bec3b&&_0x3bec3b[_0xe9a8('0x58')]===0x0){return db['UserProfileResource'][_0xe9a8('0x4f')]({'name':_0x2cda16['name'],'resourceId':_0x2cda16['id'],'type':_0x3bec3b['name'],'sectionId':_0x3bec3b['id']},{})[_0xe9a8('0x2b')](function(){return _0x20b4c7;});}else{return _0x20b4c7;}})['catch'](function(_0x426bed){logger[_0xe9a8('0x2f')](_0xe9a8('0x5e'),_0x426bed);throw _0x426bed;});}return _0x20b4c7;});}})[_0xe9a8('0x2b')](respondWithResult(_0x405fcf,0xc9))[_0xe9a8('0x47')](handleError(_0x405fcf,null));};exports[_0xe9a8('0x2a')]=function(_0x1434cf,_0x2c993f){if(_0x1434cf['body']['id']){delete _0x1434cf[_0xe9a8('0x50')]['id'];}return db['Dashboard'][_0xe9a8('0x4e')]({'where':{'id':_0x1434cf['params']['id']}})[_0xe9a8('0x2b')](handleEntityNotFound(_0x2c993f,null))[_0xe9a8('0x2b')](saveUpdates(_0x1434cf['body'],null))[_0xe9a8('0x2b')](respondWithResult(_0x2c993f,null))['catch'](handleError(_0x2c993f,null));};exports[_0xe9a8('0x2d')]=function(_0x47ac05,_0x1bfcc9){return db[_0xe9a8('0x33')][_0xe9a8('0x4e')]({'where':{'id':_0x47ac05['params']['id']}})[_0xe9a8('0x2b')](handleEntityNotFound(_0x1bfcc9,null))[_0xe9a8('0x2b')](removeEntity(_0x1bfcc9,null))['catch'](handleError(_0x1bfcc9,null));};function widgetAttributes(_0xf5ad19){try{switch(_0xf5ad19['type']){case _0xe9a8('0x5f'):return[{'name':'attrUrl','value':_0xf5ad19['attrUrl']||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x0]?_0xf5ad19[_0xe9a8('0x60')][0x0][_0xe9a8('0x61')]:undefined)||_0xe9a8('0x62')}];case'custom':return[{'name':_0xe9a8('0x63'),'value':_0xf5ad19[_0xe9a8('0x63')]||(_0xf5ad19['attrs']&&_0xf5ad19[_0xe9a8('0x60')][0x0]?_0xf5ad19['attrs'][0x0][_0xe9a8('0x61')]:undefined)||''}];case'clock':return[{'name':_0xe9a8('0x64'),'value':_0xf5ad19[_0xe9a8('0x64')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x0]?_0xf5ad19['attrs'][0x0][_0xe9a8('0x61')]:undefined)||_0xe9a8('0x65')},{'name':_0xe9a8('0x66'),'value':_0xf5ad19[_0xe9a8('0x66')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19['attrs'][0x1]?_0xf5ad19[_0xe9a8('0x60')][0x1][_0xe9a8('0x61')]:undefined)||_0xe9a8('0x67')},{'name':_0xe9a8('0x68'),'value':_0xf5ad19[_0xe9a8('0x68')]||(_0xf5ad19['attrs']&&_0xf5ad19[_0xe9a8('0x60')][0x2]?_0xf5ad19[_0xe9a8('0x60')][0x2][_0xe9a8('0x61')]:undefined)||0xc}];case _0xe9a8('0x69'):return[{'name':'attrMetric','value':_0xf5ad19['attrMetric']||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x0]?_0xf5ad19[_0xe9a8('0x60')][0x0][_0xe9a8('0x61')]:undefined)||_0xe9a8('0x6a')},{'name':'attrVoiceQueues','value':_0xf5ad19[_0xe9a8('0x6b')]||(_0xf5ad19['attrs']&&_0xf5ad19[_0xe9a8('0x60')][0x1]?_0xf5ad19[_0xe9a8('0x60')][0x1][_0xe9a8('0x61')]:undefined)||[]},{'name':'attrFontSize','value':_0xf5ad19['attrFontSize']||(_0xf5ad19['attrs']&&_0xf5ad19[_0xe9a8('0x60')][0x2]?_0xf5ad19['attrs'][0x2][_0xe9a8('0x61')]:undefined)||0x14},{'name':_0xe9a8('0x6c'),'value':_0xf5ad19['attrChannel']||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x3]?_0xf5ad19[_0xe9a8('0x60')][0x3]['value']:undefined)||_0xe9a8('0x6d')},{'name':'attrEmailAccounts','value':_0xf5ad19[_0xe9a8('0x6e')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x4]?_0xf5ad19[_0xe9a8('0x60')][0x4][_0xe9a8('0x61')]:undefined)||''},{'name':_0xe9a8('0x6f'),'value':_0xf5ad19[_0xe9a8('0x6f')]||(_0xf5ad19['attrs']&&_0xf5ad19[_0xe9a8('0x60')][0x5]?_0xf5ad19['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0xf5ad19['attrSmsAccounts']||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x6]?_0xf5ad19[_0xe9a8('0x60')][0x6]['value']:undefined)||''},{'name':_0xe9a8('0x70'),'value':_0xf5ad19[_0xe9a8('0x70')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x7]?_0xf5ad19['attrs'][0x7][_0xe9a8('0x61')]:undefined)||''},{'name':_0xe9a8('0x71'),'value':_0xf5ad19[_0xe9a8('0x71')]||(_0xf5ad19['attrs']&&_0xf5ad19[_0xe9a8('0x60')][0x8]?_0xf5ad19[_0xe9a8('0x60')][0x8][_0xe9a8('0x61')]:undefined)||''},{'name':_0xe9a8('0x72'),'value':_0xf5ad19[_0xe9a8('0x72')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19['attrs'][0x9]?_0xf5ad19[_0xe9a8('0x60')][0x9][_0xe9a8('0x61')]:undefined)||''}];case _0xe9a8('0x73'):case _0xe9a8('0x74'):return[{'name':_0xe9a8('0x75'),'value':_0xf5ad19[_0xe9a8('0x75')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x0]?_0xf5ad19[_0xe9a8('0x60')][0x0][_0xe9a8('0x61')]:undefined)||'total'},{'name':_0xe9a8('0x76'),'value':_0xf5ad19[_0xe9a8('0x76')]||(_0xf5ad19['attrs']&&_0xf5ad19['attrs'][0x1]?_0xf5ad19[_0xe9a8('0x60')][0x1][_0xe9a8('0x61')]:undefined)||null},{'name':'attrSerie3','value':_0xf5ad19[_0xe9a8('0x77')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x2]?_0xf5ad19['attrs'][0x2][_0xe9a8('0x61')]:undefined)||null},{'name':_0xe9a8('0x6b'),'value':_0xf5ad19[_0xe9a8('0x6b')]||(_0xf5ad19['attrs']&&_0xf5ad19[_0xe9a8('0x60')][0x3]?_0xf5ad19[_0xe9a8('0x60')][0x3]['value']:undefined)||[]},{'name':_0xe9a8('0x6c'),'value':_0xf5ad19[_0xe9a8('0x6c')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x4]?_0xf5ad19['attrs'][0x4][_0xe9a8('0x61')]:undefined)||'voice'},{'name':_0xe9a8('0x6e'),'value':_0xf5ad19['attrEmailAccounts']||(_0xf5ad19['attrs']&&_0xf5ad19[_0xe9a8('0x60')][0x5]?_0xf5ad19['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0xf5ad19[_0xe9a8('0x6f')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x6]?_0xf5ad19['attrs'][0x6]['value']:undefined)||''},{'name':_0xe9a8('0x78'),'value':_0xf5ad19[_0xe9a8('0x78')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x7]?_0xf5ad19[_0xe9a8('0x60')][0x7][_0xe9a8('0x61')]:undefined)||''},{'name':_0xe9a8('0x70'),'value':_0xf5ad19[_0xe9a8('0x70')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19['attrs'][0x8]?_0xf5ad19['attrs'][0x8][_0xe9a8('0x61')]:undefined)||''},{'name':_0xe9a8('0x71'),'value':_0xf5ad19['attrWhatsappAccounts']||(_0xf5ad19['attrs']&&_0xf5ad19[_0xe9a8('0x60')][0x9]?_0xf5ad19[_0xe9a8('0x60')][0x9][_0xe9a8('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0xf5ad19[_0xe9a8('0x72')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0xa]?_0xf5ad19[_0xe9a8('0x60')][0xa][_0xe9a8('0x61')]:undefined)||''}];case _0xe9a8('0x79'):return[{'name':_0xe9a8('0x7a'),'type':_0xf5ad19[_0xe9a8('0x7b')]||(_0xf5ad19['attrs']&&_0xf5ad19[_0xe9a8('0x60')][0x0]?_0xf5ad19['attrs'][0x0][_0xe9a8('0x35')]:undefined)||null,'value':_0xf5ad19[_0xe9a8('0x7a')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19[_0xe9a8('0x60')][0x0]?_0xf5ad19[_0xe9a8('0x60')][0x0][_0xe9a8('0x61')]:undefined)||null},{'name':_0xe9a8('0x7c'),'value':_0xf5ad19[_0xe9a8('0x7c')]||(_0xf5ad19[_0xe9a8('0x60')]&&_0xf5ad19['attrs'][0x1]?_0xf5ad19['attrs'][0x1][_0xe9a8('0x61')]:undefined)||0x0}];default:return[];}}catch(_0xd49367){logger[_0xe9a8('0x2f')](_0xe9a8('0x7d'),JSON['stringify'](_0xd49367));return[];}}exports[_0xe9a8('0x7e')]=function(_0x1c0e79,_0x413c65,_0x30f928){if(_0x1c0e79[_0xe9a8('0x50')]['id']){delete _0x1c0e79[_0xe9a8('0x50')]['id'];}return db['Dashboard'][_0xe9a8('0x4e')]({'where':{'id':_0x1c0e79[_0xe9a8('0x49')]['id']}})[_0xe9a8('0x2b')](handleEntityNotFound(_0x413c65,null))[_0xe9a8('0x2b')](function(_0x3643ef){if(_0x3643ef){_0x1c0e79[_0xe9a8('0x50')][_0xe9a8('0x7f')]=_0x3643ef['id'];_0x1c0e79[_0xe9a8('0x50')]['attrs']=widgetAttributes(_0x1c0e79[_0xe9a8('0x50')]);return db[_0xe9a8('0x80')][_0xe9a8('0x4f')](_0x1c0e79[_0xe9a8('0x50')]);}})[_0xe9a8('0x2b')](respondWithResult(_0x413c65,null))['catch'](handleError(_0x413c65,null));};exports[_0xe9a8('0x81')]=function(_0x5ef114,_0x1c4a9e,_0x42dd3e){var _0x3636c9={};var _0x29feb5={};var _0x22967e;var _0x4ad73f;return db[_0xe9a8('0x33')][_0xe9a8('0x82')]({'where':{'id':_0x5ef114[_0xe9a8('0x49')]['id']}})[_0xe9a8('0x2b')](handleEntityNotFound(_0x1c4a9e,null))[_0xe9a8('0x2b')](function(_0x505ea7){if(_0x505ea7){_0x22967e=_0x505ea7;_0x29feb5['model']=_['keys'](db['DashboardItem'][_0xe9a8('0x5a')]);_0x29feb5[_0xe9a8('0x38')]=_[_0xe9a8('0x39')](_0x5ef114[_0xe9a8('0x38')]);_0x29feb5['filters']=_[_0xe9a8('0x3b')](_0x29feb5[_0xe9a8('0x37')],_0x29feb5[_0xe9a8('0x38')]);_0x3636c9[_0xe9a8('0x3c')]=_['intersection'](_0x29feb5[_0xe9a8('0x37')],qs[_0xe9a8('0x4a')](_0x5ef114[_0xe9a8('0x38')]['fields']));_0x3636c9[_0xe9a8('0x3c')]=_0x3636c9[_0xe9a8('0x3c')][_0xe9a8('0x4b')]?_0x3636c9[_0xe9a8('0x3c')]:_0x29feb5[_0xe9a8('0x37')];_0x3636c9[_0xe9a8('0x3e')]=qs[_0xe9a8('0x83')](_0x5ef114['query'][_0xe9a8('0x83')]);_0x3636c9[_0xe9a8('0x3f')]=qs['filters'](_['pick'](_0x5ef114['query'],_0x29feb5[_0xe9a8('0x3a')]));if(_0x5ef114[_0xe9a8('0x38')][_0xe9a8('0x44')]){_0x3636c9[_0xe9a8('0x3f')]=_[_0xe9a8('0x41')](_0x3636c9[_0xe9a8('0x3f')],{'$or':_[_0xe9a8('0x42')](_0x3636c9[_0xe9a8('0x3c')],function(_0x1f8293){var _0x35a670={};_0x35a670[_0x1f8293]={'$like':'%'+_0x5ef114[_0xe9a8('0x38')][_0xe9a8('0x44')]+'%'};return _0x35a670;})});}_0x3636c9=_[_0xe9a8('0x41')]({},_0x3636c9,_0x5ef114['options']);return _0x22967e[_0xe9a8('0x81')](_0x3636c9);}})['then'](function(_0x470b47){if(_0x470b47){_0x4ad73f=_0x470b47['length'];if(!_0x5ef114[_0xe9a8('0x38')][_0xe9a8('0x3d')](_0xe9a8('0x84'))){_0x3636c9['limit']=qs[_0xe9a8('0x24')](_0x5ef114['query'][_0xe9a8('0x24')]);_0x3636c9[_0xe9a8('0x22')]=qs[_0xe9a8('0x22')](_0x5ef114[_0xe9a8('0x38')][_0xe9a8('0x22')]);}return _0x22967e['getItems'](_0x3636c9);}})[_0xe9a8('0x2b')](function(_0xa22930){if(_0xa22930){return _0xa22930?{'count':_0x4ad73f,'rows':_0xa22930}:null;}})[_0xe9a8('0x2b')](respondWithResult(_0x1c4a9e,null))['catch'](handleError(_0x1c4a9e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 770a735..aea5d19 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 _0x2713=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x3a5c98,_0x2027ab){var _0x5ba098=function(_0x4706e3){while(--_0x4706e3){_0x3a5c98['push'](_0x3a5c98['shift']());}};_0x5ba098(++_0x2027ab);}(_0x2713,0x164));var _0x3271=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2713[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x3271('0x0'));var Dashboard=require(_0x3271('0x1'))['db'][_0x3271('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3271('0x3')](0x0);var events={'afterCreate':_0x3271('0x4'),'afterUpdate':_0x3271('0x5'),'afterDestroy':_0x3271('0x6')};function emitEvent(_0x28369e){return function(_0x45946c,_0x472478,_0x94bace){DashboardEvents[_0x3271('0x7')](_0x28369e+':'+_0x45946c['id'],_0x45946c);DashboardEvents[_0x3271('0x7')](_0x28369e,_0x45946c);_0x94bace(null);};}for(var e in events){if(events[_0x3271('0x8')](e)){var event=events[e];Dashboard[_0x3271('0x9')](e,emitEvent(event));}}module[_0x3271('0xa')]=DashboardEvents; \ No newline at end of file +var _0xbf3e=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbf3e,0xee));var _0xebf3=function(_0x359d99,_0x4d30fe){_0x359d99=_0x359d99-0x0;var _0xe9831e=_0xbf3e[_0x359d99];return _0xe9831e;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xebf3('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xebf3('0x1')](0x0);var events={'afterCreate':_0xebf3('0x2'),'afterUpdate':_0xebf3('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4aa4bf){return function(_0x3f9330,_0xcbde2b,_0x3bf2f9){DashboardEvents[_0xebf3('0x4')](_0x4aa4bf+':'+_0x3f9330['id'],_0x3f9330);DashboardEvents['emit'](_0x4aa4bf,_0x3f9330);_0x3bf2f9(null);};}for(var e in events){if(events[_0xebf3('0x5')](e)){var event=events[e];Dashboard[_0xebf3('0x6')](e,emitEvent(event));}}module[_0xebf3('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 99238a6..e54d7b3 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 _0x8b25=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash'];(function(_0x51e897,_0x3d9a7e){var _0x54a1b8=function(_0x32089d){while(--_0x32089d){_0x51e897['push'](_0x51e897['shift']());}};_0x54a1b8(++_0x3d9a7e);}(_0x8b25,0x109));var _0x58b2=function(_0x26a234,_0x1458cf){_0x26a234=_0x26a234-0x0;var _0x118131=_0x8b25[_0x26a234];return _0x118131;};'use strict';var _=require(_0x58b2('0x0'));var util=require(_0x58b2('0x1'));var logger=require(_0x58b2('0x2'))(_0x58b2('0x3'));var moment=require(_0x58b2('0x4'));var BPromise=require(_0x58b2('0x5'));var rp=require(_0x58b2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58b2('0x7'));var config=require(_0x58b2('0x8'));var attributes=require(_0x58b2('0x9'));module[_0x58b2('0xa')]=function(_0xa21fc7,_0x55a538){return _0xa21fc7[_0x58b2('0xb')](_0x58b2('0xc'),attributes,{'tableName':_0x58b2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3669=['request-promise','path','rimraf','./dashboard.attributes','exports','define','lodash','util'];(function(_0x1524f7,_0x274e8c){var _0x1b045a=function(_0x47f096){while(--_0x47f096){_0x1524f7['push'](_0x1524f7['shift']());}};_0x1b045a(++_0x274e8c);}(_0x3669,0x166));var _0x9366=function(_0x5b315a,_0x5cd905){_0x5b315a=_0x5b315a-0x0;var _0x45300e=_0x3669[_0x5b315a];return _0x45300e;};'use strict';var _=require(_0x9366('0x0'));var util=require(_0x9366('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9366('0x2'));var fs=require('fs');var path=require(_0x9366('0x3'));var rimraf=require(_0x9366('0x4'));var config=require('../../config/environment');var attributes=require(_0x9366('0x5'));module[_0x9366('0x6')]=function(_0x4abc52,_0x1acb9d){return _0x4abc52[_0x9366('0x7')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 809e860..0528f36 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 _0xd0c2=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2abb8e,_0x10dae9){var _0x449948=function(_0x497eee){while(--_0x497eee){_0x2abb8e['push'](_0x2abb8e['shift']());}};_0x449948(++_0x10dae9);}(_0xd0c2,0x90));var _0x2d0c=function(_0x10e557,_0xfb23c8){_0x10e557=_0x10e557-0x0;var _0x3e4e93=_0xd0c2[_0x10e557];return _0x3e4e93;};'use strict';var _=require(_0x2d0c('0x0'));var util=require('util');var moment=require(_0x2d0c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d0c('0x2'));var db=require(_0x2d0c('0x3'))['db'];var utils=require(_0x2d0c('0x4'));var logger=require(_0x2d0c('0x5'))(_0x2d0c('0x6'));var config=require(_0x2d0c('0x7'));var jayson=require(_0x2d0c('0x8'));var client=jayson[_0x2d0c('0x9')][_0x2d0c('0xa')]({'port':0x232a});config[_0x2d0c('0xb')]=_[_0x2d0c('0xc')](config[_0x2d0c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d0c('0xd'))(new Redis(config['redis']));require(_0x2d0c('0xe'))['register'](socket);function respondWithRpcPromise(_0x4d78b1,_0x517db5,_0xe08423){return new BPromise(function(_0x237e20,_0x324e95){return client[_0x2d0c('0xf')](_0x4d78b1,_0xe08423)['then'](function(_0x28a5e7){logger[_0x2d0c('0x10')](_0x2d0c('0x11'),_0x517db5,_0x2d0c('0x12'));logger[_0x2d0c('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x517db5,_0x2d0c('0x12'),JSON[_0x2d0c('0x14')](_0x28a5e7));if(_0x28a5e7[_0x2d0c('0x15')]){if(_0x28a5e7['error'][_0x2d0c('0x16')]===0x1f4){logger[_0x2d0c('0x15')](_0x2d0c('0x11'),_0x517db5,_0x28a5e7[_0x2d0c('0x15')][_0x2d0c('0x17')]);return _0x324e95(_0x28a5e7[_0x2d0c('0x15')][_0x2d0c('0x17')]);}logger[_0x2d0c('0x15')](_0x2d0c('0x11'),_0x517db5,_0x28a5e7[_0x2d0c('0x15')][_0x2d0c('0x17')]);return _0x237e20(_0x28a5e7[_0x2d0c('0x15')][_0x2d0c('0x17')]);}else{logger[_0x2d0c('0x10')](_0x2d0c('0x11'),_0x517db5,_0x2d0c('0x12'));_0x237e20(_0x28a5e7[_0x2d0c('0x18')][_0x2d0c('0x17')]);}})['catch'](function(_0xdb4a6f){logger[_0x2d0c('0x15')](_0x2d0c('0x11'),_0x517db5,_0xdb4a6f);_0x324e95(_0xdb4a6f);});});} \ No newline at end of file +var _0x38fb=['register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket'];(function(_0x14ad69,_0xf76368){var _0x218722=function(_0x210f59){while(--_0x210f59){_0x14ad69['push'](_0x14ad69['shift']());}};_0x218722(++_0xf76368);}(_0x38fb,0x1b0));var _0xb38f=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x38fb[_0x556927];return _0x5f1235;};'use strict';var _=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var moment=require(_0xb38f('0x2'));var BPromise=require(_0xb38f('0x3'));var rs=require(_0xb38f('0x4'));var fs=require('fs');var Redis=require(_0xb38f('0x5'));var db=require(_0xb38f('0x6'))['db'];var utils=require(_0xb38f('0x7'));var logger=require(_0xb38f('0x8'))(_0xb38f('0x9'));var config=require(_0xb38f('0xa'));var jayson=require(_0xb38f('0xb'));var client=jayson[_0xb38f('0xc')][_0xb38f('0xd')]({'port':0x232a});config[_0xb38f('0xe')]=_[_0xb38f('0xf')](config[_0xb38f('0xe')],{'host':_0xb38f('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb38f('0xe')]));require(_0xb38f('0x11'))[_0xb38f('0x12')](socket);function respondWithRpcPromise(_0x5e037a,_0x3a5441,_0x1252b6){return new BPromise(function(_0xc17932,_0x331549){return client[_0xb38f('0x13')](_0x5e037a,_0x1252b6)[_0xb38f('0x14')](function(_0x3eb027){logger[_0xb38f('0x15')](_0xb38f('0x16'),_0x3a5441,_0xb38f('0x17'));logger[_0xb38f('0x18')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x3a5441,'request\x20sent',JSON['stringify'](_0x3eb027));if(_0x3eb027['error']){if(_0x3eb027[_0xb38f('0x19')][_0xb38f('0x1a')]===0x1f4){logger[_0xb38f('0x19')](_0xb38f('0x16'),_0x3a5441,_0x3eb027[_0xb38f('0x19')][_0xb38f('0x1b')]);return _0x331549(_0x3eb027[_0xb38f('0x19')][_0xb38f('0x1b')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x3a5441,_0x3eb027[_0xb38f('0x19')]['message']);return _0xc17932(_0x3eb027[_0xb38f('0x19')][_0xb38f('0x1b')]);}else{logger[_0xb38f('0x15')](_0xb38f('0x16'),_0x3a5441,_0xb38f('0x17'));_0xc17932(_0x3eb027[_0xb38f('0x1c')][_0xb38f('0x1b')]);}})[_0xb38f('0x1d')](function(_0x57c380){logger[_0xb38f('0x19')](_0xb38f('0x16'),_0x3a5441,_0x57c380);_0x331549(_0x57c380);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a6471a6..60f44de 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 _0xfdd8=['emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xfdd8,0xcd));var _0x8fdd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfdd8[_0x167cc1];return _0x10bc4b;};'use strict';var DashboardEvents=require(_0x8fdd('0x0'));var events=[_0x8fdd('0x1'),_0x8fdd('0x2'),'update'];function createListener(_0x47e18b,_0x42b927){return function(_0xbfc975){_0x42b927[_0x8fdd('0x3')](_0x47e18b,_0xbfc975);};}function removeListener(_0xe72109,_0x4a215c){return function(){DashboardEvents[_0x8fdd('0x4')](_0xe72109,_0x4a215c);};}exports[_0x8fdd('0x5')]=function(_0x70a0b2){for(var _0x1c99e8=0x0,_0x50968d=events[_0x8fdd('0x6')];_0x1c99e8<_0x50968d;_0x1c99e8++){var _0x3e5eb7=events[_0x1c99e8];var _0x3bb3ac=createListener(_0x8fdd('0x7')+_0x3e5eb7,_0x70a0b2);DashboardEvents['on'](_0x3e5eb7,_0x3bb3ac);}}; \ No newline at end of file +var _0x9fa5=['dashboard:','./dashboard.events','save','remove','update','removeListener','register'];(function(_0x55a08d,_0x4b9a17){var _0x1ef93d=function(_0x21210b){while(--_0x21210b){_0x55a08d['push'](_0x55a08d['shift']());}};_0x1ef93d(++_0x4b9a17);}(_0x9fa5,0xf6));var _0x59fa=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x9fa5[_0xf0bcac];return _0x4e4c65;};'use strict';var DashboardEvents=require(_0x59fa('0x0'));var events=[_0x59fa('0x1'),_0x59fa('0x2'),_0x59fa('0x3')];function createListener(_0x1da24b,_0x86c9f){return function(_0x24f414){_0x86c9f['emit'](_0x1da24b,_0x24f414);};}function removeListener(_0x44047e,_0x2478bf){return function(){DashboardEvents[_0x59fa('0x4')](_0x44047e,_0x2478bf);};}exports[_0x59fa('0x5')]=function(_0x4e8ea3){for(var _0x4e8abf=0x0,_0x21d12a=events['length'];_0x4e8abf<_0x21d12a;_0x4e8abf++){var _0x4b13f6=events[_0x4e8abf];var _0x56a722=createListener(_0x59fa('0x6')+_0x4b13f6,_0x4e8ea3);DashboardEvents['on'](_0x4b13f6,_0x56a722);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b4a7e21..7036204 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 _0xae68=['getItems','post','addItem','put','/:id','delete','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated','show','/:id/items'];(function(_0x264806,_0x10d7f9){var _0x9027f0=function(_0x762cc5){while(--_0x762cc5){_0x264806['push'](_0x264806['shift']());}};_0x9027f0(++_0x10d7f9);}(_0xae68,0x8f));var _0x8ae6=function(_0x4b71ac,_0xe6bc04){_0x4b71ac=_0x4b71ac-0x0;var _0x2ab8c1=_0xae68[_0x4b71ac];return _0x2ab8c1;};'use strict';var multer=require(_0x8ae6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8ae6('0x1'));var router=express['Router']();var fs_extra=require(_0x8ae6('0x2'));var auth=require(_0x8ae6('0x3'));var interaction=require(_0x8ae6('0x4'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8ae6('0x5')]);router[_0x8ae6('0x6')]('/:id',auth[_0x8ae6('0x7')](),controller[_0x8ae6('0x8')]);router[_0x8ae6('0x6')](_0x8ae6('0x9'),auth['isAuthenticated'](),controller[_0x8ae6('0xa')]);router[_0x8ae6('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8ae6('0xb')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x8ae6('0xb')]('/:id/items',auth[_0x8ae6('0x7')](),controller[_0x8ae6('0xc')]);router[_0x8ae6('0xd')](_0x8ae6('0xe'),auth[_0x8ae6('0x7')](),controller['update']);router[_0x8ae6('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8ae6('0x10')]=router; \ No newline at end of file +var _0xe8ec=['show','getItems','post','/:id/clone','clone','/:id/items','addItem','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id'];(function(_0x4dc8cf,_0x32708f){var _0x107654=function(_0x1e8a52){while(--_0x1e8a52){_0x4dc8cf['push'](_0x4dc8cf['shift']());}};_0x107654(++_0x32708f);}(_0xe8ec,0x17b));var _0xce8e=function(_0x463f08,_0x56e4cf){_0x463f08=_0x463f08-0x0;var _0x9b4b3a=_0xe8ec[_0x463f08];return _0x9b4b3a;};'use strict';var multer=require(_0xce8e('0x0'));var util=require(_0xce8e('0x1'));var path=require(_0xce8e('0x2'));var timeout=require('connect-timeout');var express=require(_0xce8e('0x3'));var router=express[_0xce8e('0x4')]();var fs_extra=require(_0xce8e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xce8e('0x6'));var controller=require(_0xce8e('0x7'));router['get']('/',auth[_0xce8e('0x8')](),controller[_0xce8e('0x9')]);router[_0xce8e('0xa')](_0xce8e('0xb'),auth[_0xce8e('0x8')](),controller[_0xce8e('0xc')]);router[_0xce8e('0xa')]('/:id/items',auth[_0xce8e('0x8')](),controller[_0xce8e('0xd')]);router[_0xce8e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xce8e('0xe')](_0xce8e('0xf'),auth[_0xce8e('0x8')](),controller[_0xce8e('0x10')]);router['post'](_0xce8e('0x11'),auth[_0xce8e('0x8')](),controller[_0xce8e('0x12')]);router[_0xce8e('0x13')](_0xce8e('0xb'),auth['isAuthenticated'](),controller[_0xce8e('0x14')]);router[_0xce8e('0x15')](_0xce8e('0xb'),auth['isAuthenticated'](),controller[_0xce8e('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 2e77150..c717fb1 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 _0x1623=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','exports','STRING','TEXT','long'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0x1623,0xab));var _0x3162=function(_0x17fcab,_0x12063e){_0x17fcab=_0x17fcab-0x0;var _0x3856ce=_0x1623[_0x17fcab];return _0x3856ce;};'use strict';var Sequelize=require(_0x3162('0x0'));var squel=require('squel');var _=require('lodash');module[_0x3162('0x1')]={'title':{'type':Sequelize[_0x3162('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3162('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3162('0x3')](_0x3162('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x3162('0x5')));}catch(_0x4b77c4){return[];}},'set':function(_0x1b55f2){try{this[_0x3162('0x6')]('attrs',JSON[_0x3162('0x7')](_0x1b55f2));}catch(_0x2dc07e){this[_0x3162('0x6')](_0x3162('0x5'),JSON[_0x3162('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3162('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3162('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3162('0x2')],'allowNull':![],'defaultValue':_0x3162('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3162('0x2')]},'titleFontSize':{'type':Sequelize[_0x3162('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0x90b1=['#2196f3','sequelize','squel','lodash','STRING','TEXT','long','parse','setDataValue','attrs','stringify','INTEGER','#ffffff'];(function(_0x136e17,_0x4cc300){var _0x5099c9=function(_0xbbbb80){while(--_0xbbbb80){_0x136e17['push'](_0x136e17['shift']());}};_0x5099c9(++_0x4cc300);}(_0x90b1,0x1bb));var _0x190b=function(_0x3236be,_0x47eb9b){_0x3236be=_0x3236be-0x0;var _0x40a904=_0x90b1[_0x3236be];return _0x40a904;};'use strict';var Sequelize=require(_0x190b('0x0'));var squel=require(_0x190b('0x1'));var _=require(_0x190b('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x190b('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x190b('0x4')](_0x190b('0x5')),'get':function(){try{return JSON[_0x190b('0x6')](this['getDataValue']('attrs'));}catch(_0x5cbebb){return[];}},'set':function(_0x5da9c1){try{this[_0x190b('0x7')](_0x190b('0x8'),JSON[_0x190b('0x9')](_0x5da9c1));}catch(_0x626aa1){this[_0x190b('0x7')](_0x190b('0x8'),JSON[_0x190b('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x190b('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x190b('0xa')]},'col':{'type':Sequelize[_0x190b('0xa')]},'background':{'type':Sequelize[_0x190b('0x3')],'allowNull':![],'defaultValue':_0x190b('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x190b('0x3')],'allowNull':![],'defaultValue':_0x190b('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x190b('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'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 c2a1127..f2efbcf 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 _0x77d4=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','type','attrReport','widgetAttributes:\x20%s','stringify','body','create','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0x77d4,0x108));var _0x477d=function(_0x49f118,_0x5138e4){_0x49f118=_0x49f118-0x0;var _0x3a0443=_0x77d4[_0x49f118];return _0x3a0443;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x477d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x477d('0x1'));var rp=require('request-promise');var moment=require(_0x477d('0x2'));var BPromise=require(_0x477d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x477d('0x4'));var sox=require(_0x477d('0x5'));var csv=require(_0x477d('0x6'));var ejs=require(_0x477d('0x7'));var fs=require('fs');var fs_extra=require(_0x477d('0x8'));var _=require(_0x477d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x477d('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x477d('0xb'));var Papa=require(_0x477d('0xc'));var Redis=require(_0x477d('0xd'));var authService=require(_0x477d('0xe'));var qs=require(_0x477d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x477d('0x10'));var logger=require('../../config/logger')(_0x477d('0x11'));var utils=require(_0x477d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x477d('0x13'));var db=require(_0x477d('0x14'))['db'];config['redis']=_['defaults'](config[_0x477d('0x15')],{'host':_0x477d('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x477d('0x15')]));require(_0x477d('0x17'))['register'](socket);function respondWithStatusCode(_0x4b2021,_0x38a0a8){_0x38a0a8=_0x38a0a8||0xcc;return function(_0x4bbfef){if(_0x4bbfef){return _0x4b2021[_0x477d('0x18')](_0x38a0a8);}return _0x4b2021[_0x477d('0x19')](_0x38a0a8)[_0x477d('0x1a')]();};}function respondWithResult(_0x5985b5,_0x116aa7){_0x116aa7=_0x116aa7||0xc8;return function(_0x78d1f2){if(_0x78d1f2){return _0x5985b5[_0x477d('0x19')](_0x116aa7)[_0x477d('0x1b')](_0x78d1f2);}};}function respondWithFilteredResult(_0x57b38e,_0x28f17a){return function(_0x5d5553){if(_0x5d5553){var _0x367965=typeof _0x28f17a[_0x477d('0x1c')]===_0x477d('0x1d')&&typeof _0x28f17a[_0x477d('0x1e')]===_0x477d('0x1d');var _0x2145ce=_0x5d5553['count'];var _0x33db7a=_0x367965?0x0:_0x28f17a['offset'];var _0xe934a7=_0x367965?_0x5d5553[_0x477d('0x1f')]:_0x28f17a[_0x477d('0x1c')]+_0x28f17a[_0x477d('0x1e')];var _0x27b3aa;if(_0xe934a7>=_0x2145ce){_0xe934a7=_0x2145ce;_0x27b3aa=0xc8;}else{_0x27b3aa=0xce;}_0x57b38e[_0x477d('0x19')](_0x27b3aa);return _0x57b38e[_0x477d('0x20')](_0x477d('0x21'),_0x33db7a+'-'+_0xe934a7+'/'+_0x2145ce)[_0x477d('0x1b')](_0x5d5553);}return null;};}function patchUpdates(_0x5981a){return function(_0x3d2943){try{jsonpatch[_0x477d('0x22')](_0x3d2943,_0x5981a,!![]);}catch(_0x43c845){return BPromise[_0x477d('0x23')](_0x43c845);}return _0x3d2943['save']();};}function saveUpdates(_0x4481b0,_0x583444){return function(_0x239b56){if(_0x239b56){return _0x239b56[_0x477d('0x24')](_0x4481b0)[_0x477d('0x25')](function(_0x2287b4){return _0x2287b4;});}return null;};}function removeEntity(_0x4bb50e,_0xd6dca5){return function(_0x2dfa90){if(_0x2dfa90){return _0x2dfa90[_0x477d('0x26')]()['then'](function(){_0x4bb50e['status'](0xcc)[_0x477d('0x1a')]();});}};}function handleEntityNotFound(_0x3c6270,_0x386df5){return function(_0x5c8ef1){if(!_0x5c8ef1){_0x3c6270[_0x477d('0x18')](0x194);}return _0x5c8ef1;};}function handleError(_0x297d15,_0x74ebb4){_0x74ebb4=_0x74ebb4||0x1f4;return function(_0xe4dd40){logger[_0x477d('0x27')](_0xe4dd40['stack']);if(_0xe4dd40[_0x477d('0x28')]){delete _0xe4dd40[_0x477d('0x28')];}_0x297d15[_0x477d('0x19')](_0x74ebb4)[_0x477d('0x29')](_0xe4dd40);};}exports[_0x477d('0x2a')]=function(_0x385eb4,_0x180046){var _0x98b5d9={'raw':![],'where':{'id':_0x385eb4[_0x477d('0x2b')]['id']}},_0x204541={};_0x204541[_0x477d('0x2c')]=_[_0x477d('0x2d')](db[_0x477d('0x2e')][_0x477d('0x2f')]);_0x204541[_0x477d('0x30')]=_[_0x477d('0x2d')](_0x385eb4[_0x477d('0x30')]);_0x204541[_0x477d('0x31')]=_[_0x477d('0x32')](_0x204541[_0x477d('0x2c')],_0x204541['query']);_0x98b5d9[_0x477d('0x33')]=_['intersection'](_0x204541[_0x477d('0x2c')],qs[_0x477d('0x34')](_0x385eb4[_0x477d('0x30')]['fields']));_0x98b5d9[_0x477d('0x33')]=_0x98b5d9[_0x477d('0x33')][_0x477d('0x35')]?_0x98b5d9[_0x477d('0x33')]:_0x204541[_0x477d('0x2c')];if(_0x385eb4[_0x477d('0x30')][_0x477d('0x36')]){_0x98b5d9[_0x477d('0x37')]=[{'all':!![]}];}_0x98b5d9=_[_0x477d('0x38')]({},_0x98b5d9,_0x385eb4[_0x477d('0x39')]);return db['DashboardItem'][_0x477d('0x3a')](_0x98b5d9)[_0x477d('0x25')](handleEntityNotFound(_0x180046,null))[_0x477d('0x25')](respondWithResult(_0x180046,null))['catch'](handleError(_0x180046,null));};exports[_0x477d('0x26')]=function(_0x2daf87,_0x1b0410){return db['DashboardItem']['find']({'where':{'id':_0x2daf87[_0x477d('0x2b')]['id']}})[_0x477d('0x25')](handleEntityNotFound(_0x1b0410,null))[_0x477d('0x25')](removeEntity(_0x1b0410,null))[_0x477d('0x3b')](handleError(_0x1b0410,null));};function widgetAttributes(_0x1c0d86){try{switch(_0x1c0d86['type']){case _0x477d('0x3c'):return[{'name':'attrUrl','value':_0x1c0d86[_0x477d('0x3d')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x0]?_0x1c0d86['attrs'][0x0]['value']:undefined)||_0x477d('0x3f')}];case _0x477d('0x40'):return[{'name':_0x477d('0x41'),'value':_0x1c0d86[_0x477d('0x41')]||(_0x1c0d86['attrs']&&_0x1c0d86[_0x477d('0x3e')][0x0]?_0x1c0d86[_0x477d('0x3e')][0x0][_0x477d('0x42')]:undefined)||''}];case _0x477d('0x43'):return[{'name':_0x477d('0x44'),'value':_0x1c0d86['attrHourFormat']||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x0]?_0x1c0d86['attrs'][0x0][_0x477d('0x42')]:undefined)||'HH:mm:ss'},{'name':_0x477d('0x45'),'value':_0x1c0d86[_0x477d('0x45')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x1]?_0x1c0d86[_0x477d('0x3e')][0x1][_0x477d('0x42')]:undefined)||_0x477d('0x46')},{'name':_0x477d('0x47'),'value':_0x1c0d86[_0x477d('0x47')]||(_0x1c0d86['attrs']&&_0x1c0d86[_0x477d('0x3e')][0x2]?_0x1c0d86[_0x477d('0x3e')][0x2][_0x477d('0x42')]:undefined)||0xc}];case _0x477d('0x48'):return[{'name':'attrMetric','value':_0x1c0d86['attrMetric']||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x0]?_0x1c0d86['attrs'][0x0][_0x477d('0x42')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x1c0d86[_0x477d('0x49')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x1]?_0x1c0d86[_0x477d('0x3e')][0x1][_0x477d('0x42')]:undefined)||[]},{'name':_0x477d('0x47'),'value':_0x1c0d86['attrFontSize']||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x2]?_0x1c0d86[_0x477d('0x3e')][0x2][_0x477d('0x42')]:undefined)||0x14},{'name':_0x477d('0x4a'),'value':_0x1c0d86['attrChannel']||(_0x1c0d86['attrs']&&_0x1c0d86[_0x477d('0x3e')][0x3]?_0x1c0d86[_0x477d('0x3e')][0x3][_0x477d('0x42')]:undefined)||'voice'},{'name':_0x477d('0x4b'),'value':_0x1c0d86[_0x477d('0x4b')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x4]?_0x1c0d86[_0x477d('0x3e')][0x4][_0x477d('0x42')]:undefined)||''},{'name':_0x477d('0x4c'),'value':_0x1c0d86['attrFaxAccounts']||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x5]?_0x1c0d86[_0x477d('0x3e')][0x5][_0x477d('0x42')]:undefined)||''},{'name':_0x477d('0x4d'),'value':_0x1c0d86[_0x477d('0x4d')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x6]?_0x1c0d86[_0x477d('0x3e')][0x6][_0x477d('0x42')]:undefined)||''},{'name':_0x477d('0x4e'),'value':_0x1c0d86[_0x477d('0x4e')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x7]?_0x1c0d86[_0x477d('0x3e')][0x7]['value']:undefined)||''},{'name':_0x477d('0x4f'),'value':_0x1c0d86[_0x477d('0x4f')]||(_0x1c0d86['attrs']&&_0x1c0d86['attrs'][0x8]?_0x1c0d86['attrs'][0x8][_0x477d('0x42')]:undefined)||''},{'name':_0x477d('0x50'),'value':_0x1c0d86[_0x477d('0x50')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x9]?_0x1c0d86[_0x477d('0x3e')][0x9][_0x477d('0x42')]:undefined)||''}];case _0x477d('0x51'):case'pie-chart':return[{'name':_0x477d('0x52'),'value':_0x1c0d86[_0x477d('0x52')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x0]?_0x1c0d86[_0x477d('0x3e')][0x0][_0x477d('0x42')]:undefined)||_0x477d('0x53')},{'name':_0x477d('0x54'),'value':_0x1c0d86['attrSerie2']||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x1]?_0x1c0d86[_0x477d('0x3e')][0x1][_0x477d('0x42')]:undefined)||null},{'name':_0x477d('0x55'),'value':_0x1c0d86['attrSerie3']||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x2]?_0x1c0d86[_0x477d('0x3e')][0x2][_0x477d('0x42')]:undefined)||null},{'name':_0x477d('0x49'),'value':_0x1c0d86['attrVoiceQueues']||(_0x1c0d86['attrs']&&_0x1c0d86[_0x477d('0x3e')][0x3]?_0x1c0d86[_0x477d('0x3e')][0x3][_0x477d('0x42')]:undefined)||[]},{'name':_0x477d('0x4a'),'value':_0x1c0d86[_0x477d('0x4a')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x4]?_0x1c0d86[_0x477d('0x3e')][0x4]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x1c0d86['attrEmailAccounts']||(_0x1c0d86['attrs']&&_0x1c0d86[_0x477d('0x3e')][0x5]?_0x1c0d86['attrs'][0x5][_0x477d('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1c0d86[_0x477d('0x4c')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86['attrs'][0x6]?_0x1c0d86[_0x477d('0x3e')][0x6][_0x477d('0x42')]:undefined)||''},{'name':_0x477d('0x4d'),'value':_0x1c0d86[_0x477d('0x4d')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86['attrs'][0x7]?_0x1c0d86[_0x477d('0x3e')][0x7][_0x477d('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1c0d86[_0x477d('0x4e')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x8]?_0x1c0d86[_0x477d('0x3e')][0x8][_0x477d('0x42')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1c0d86['attrWhatsappAccounts']||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x9]?_0x1c0d86['attrs'][0x9][_0x477d('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1c0d86['attrChatWebsites']||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0xa]?_0x1c0d86[_0x477d('0x3e')][0xa][_0x477d('0x42')]:undefined)||''}];case _0x477d('0x56'):return[{'name':'attrReport','type':_0x1c0d86['reportType']||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x0]?_0x1c0d86[_0x477d('0x3e')][0x0][_0x477d('0x57')]:undefined)||null,'value':_0x1c0d86[_0x477d('0x58')]||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86[_0x477d('0x3e')][0x0]?_0x1c0d86[_0x477d('0x3e')][0x0][_0x477d('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x1c0d86['attrRefresh']||(_0x1c0d86[_0x477d('0x3e')]&&_0x1c0d86['attrs'][0x1]?_0x1c0d86[_0x477d('0x3e')][0x1][_0x477d('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x360655){logger['error'](_0x477d('0x59'),JSON[_0x477d('0x5a')](_0x360655));return[];}}exports['create']=function(_0x2d1e6d,_0x3ab693){if(_0x2d1e6d[_0x477d('0x5b')]){_0x2d1e6d[_0x477d('0x5b')][_0x477d('0x3e')]=widgetAttributes(_0x2d1e6d[_0x477d('0x5b')]);}return db['DashboardItem'][_0x477d('0x5c')](_0x2d1e6d[_0x477d('0x5b')],{})[_0x477d('0x25')](respondWithResult(_0x3ab693,0xc9))[_0x477d('0x3b')](handleError(_0x3ab693,null));};exports['update']=function(_0x2e39f7,_0x543673){if(_0x2e39f7[_0x477d('0x5b')]['id']){delete _0x2e39f7[_0x477d('0x5b')]['id'];}_0x2e39f7['body'][_0x477d('0x3e')]=widgetAttributes(_0x2e39f7[_0x477d('0x5b')]);return db[_0x477d('0x2e')]['find']({'where':{'id':_0x2e39f7['params']['id']}})[_0x477d('0x25')](handleEntityNotFound(_0x543673,null))[_0x477d('0x25')](saveUpdates(_0x2e39f7[_0x477d('0x5b')],null))[_0x477d('0x25')](respondWithResult(_0x543673,null))['catch'](handleError(_0x543673,null));}; \ No newline at end of file +var _0xbf25=['offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','options','catch','DashboardItem','attrUrl','attrs','value','https://','custom','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrFaxAccounts','attrSmsAccounts','web-report','reportType','type','attrRefresh','widgetAttributes:\x20%s','body','create','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json'];(function(_0xade4c4,_0x314e6b){var _0x5ee0b2=function(_0x5a7c1d){while(--_0x5a7c1d){_0xade4c4['push'](_0xade4c4['shift']());}};_0x5ee0b2(++_0x314e6b);}(_0xbf25,0x15e));var _0x5bf2=function(_0x23e9d3,_0x3f0b85){_0x23e9d3=_0x23e9d3-0x0;var _0x5084e6=_0xbf25[_0x23e9d3];return _0x5084e6;};'use strict';var emlformat=require(_0x5bf2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bf2('0x1'));var jsonpatch=require(_0x5bf2('0x2'));var rp=require(_0x5bf2('0x3'));var moment=require(_0x5bf2('0x4'));var BPromise=require(_0x5bf2('0x5'));var Mustache=require(_0x5bf2('0x6'));var util=require('util');var path=require(_0x5bf2('0x7'));var sox=require('sox');var csv=require(_0x5bf2('0x8'));var ejs=require(_0x5bf2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bf2('0xa'));var squel=require(_0x5bf2('0xb'));var crypto=require(_0x5bf2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5bf2('0xd'));var toCsv=require(_0x5bf2('0x8'));var querystring=require(_0x5bf2('0xe'));var Papa=require('papaparse');var Redis=require(_0x5bf2('0xf'));var authService=require(_0x5bf2('0x10'));var qs=require(_0x5bf2('0x11'));var as=require(_0x5bf2('0x12'));var hardwareService=require(_0x5bf2('0x13'));var logger=require(_0x5bf2('0x14'))(_0x5bf2('0x15'));var utils=require(_0x5bf2('0x16'));var config=require(_0x5bf2('0x17'));var licenseUtil=require(_0x5bf2('0x18'));var db=require(_0x5bf2('0x19'))['db'];config[_0x5bf2('0x1a')]=_[_0x5bf2('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5bf2('0x1c'))(new Redis(config[_0x5bf2('0x1a')]));require('./dashboardItem.socket')[_0x5bf2('0x1d')](socket);function respondWithStatusCode(_0x43a83b,_0x1bdb56){_0x1bdb56=_0x1bdb56||0xcc;return function(_0x21a3a1){if(_0x21a3a1){return _0x43a83b[_0x5bf2('0x1e')](_0x1bdb56);}return _0x43a83b[_0x5bf2('0x1f')](_0x1bdb56)[_0x5bf2('0x20')]();};}function respondWithResult(_0xff9397,_0x214752){_0x214752=_0x214752||0xc8;return function(_0x326cea){if(_0x326cea){return _0xff9397[_0x5bf2('0x1f')](_0x214752)[_0x5bf2('0x21')](_0x326cea);}};}function respondWithFilteredResult(_0x4d1990,_0x4fc7c7){return function(_0x2f87ff){if(_0x2f87ff){var _0x4af54a=typeof _0x4fc7c7[_0x5bf2('0x22')]===_0x5bf2('0x23')&&typeof _0x4fc7c7['limit']==='undefined';var _0x3adc26=_0x2f87ff[_0x5bf2('0x24')];var _0x3602b8=_0x4af54a?0x0:_0x4fc7c7[_0x5bf2('0x22')];var _0x22f35a=_0x4af54a?_0x2f87ff[_0x5bf2('0x24')]:_0x4fc7c7[_0x5bf2('0x22')]+_0x4fc7c7[_0x5bf2('0x25')];var _0x44bedc;if(_0x22f35a>=_0x3adc26){_0x22f35a=_0x3adc26;_0x44bedc=0xc8;}else{_0x44bedc=0xce;}_0x4d1990['status'](_0x44bedc);return _0x4d1990['set'](_0x5bf2('0x26'),_0x3602b8+'-'+_0x22f35a+'/'+_0x3adc26)[_0x5bf2('0x21')](_0x2f87ff);}return null;};}function patchUpdates(_0x161ec2){return function(_0x2d2b7e){try{jsonpatch[_0x5bf2('0x27')](_0x2d2b7e,_0x161ec2,!![]);}catch(_0x1cb9e1){return BPromise[_0x5bf2('0x28')](_0x1cb9e1);}return _0x2d2b7e[_0x5bf2('0x29')]();};}function saveUpdates(_0x239206,_0x2825c7){return function(_0x2d9a12){if(_0x2d9a12){return _0x2d9a12[_0x5bf2('0x2a')](_0x239206)[_0x5bf2('0x2b')](function(_0x5ae161){return _0x5ae161;});}return null;};}function removeEntity(_0x1a90e7,_0x4d3067){return function(_0x36cab3){if(_0x36cab3){return _0x36cab3[_0x5bf2('0x2c')]()['then'](function(){_0x1a90e7[_0x5bf2('0x1f')](0xcc)[_0x5bf2('0x20')]();});}};}function handleEntityNotFound(_0x5cefb3,_0x5426f9){return function(_0x8c54cd){if(!_0x8c54cd){_0x5cefb3[_0x5bf2('0x1e')](0x194);}return _0x8c54cd;};}function handleError(_0x3ceabf,_0x43c2f7){_0x43c2f7=_0x43c2f7||0x1f4;return function(_0x5ca619){logger[_0x5bf2('0x2d')](_0x5ca619[_0x5bf2('0x2e')]);if(_0x5ca619[_0x5bf2('0x2f')]){delete _0x5ca619[_0x5bf2('0x2f')];}_0x3ceabf[_0x5bf2('0x1f')](_0x43c2f7)[_0x5bf2('0x30')](_0x5ca619);};}exports['show']=function(_0x3edba7,_0x2ea937){var _0x44a6a3={'raw':![],'where':{'id':_0x3edba7[_0x5bf2('0x31')]['id']}},_0x59ac8b={};_0x59ac8b[_0x5bf2('0x32')]=_[_0x5bf2('0x33')](db['DashboardItem']['rawAttributes']);_0x59ac8b['query']=_[_0x5bf2('0x33')](_0x3edba7[_0x5bf2('0x34')]);_0x59ac8b[_0x5bf2('0x35')]=_[_0x5bf2('0x36')](_0x59ac8b[_0x5bf2('0x32')],_0x59ac8b['query']);_0x44a6a3['attributes']=_[_0x5bf2('0x36')](_0x59ac8b[_0x5bf2('0x32')],qs[_0x5bf2('0x37')](_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x37')]));_0x44a6a3[_0x5bf2('0x38')]=_0x44a6a3[_0x5bf2('0x38')][_0x5bf2('0x39')]?_0x44a6a3[_0x5bf2('0x38')]:_0x59ac8b[_0x5bf2('0x32')];if(_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x3a')]){_0x44a6a3[_0x5bf2('0x3b')]=[{'all':!![]}];}_0x44a6a3=_['merge']({},_0x44a6a3,_0x3edba7[_0x5bf2('0x3c')]);return db['DashboardItem']['find'](_0x44a6a3)['then'](handleEntityNotFound(_0x2ea937,null))['then'](respondWithResult(_0x2ea937,null))[_0x5bf2('0x3d')](handleError(_0x2ea937,null));};exports[_0x5bf2('0x2c')]=function(_0x23e82c,_0xcdee4c){return db[_0x5bf2('0x3e')]['find']({'where':{'id':_0x23e82c['params']['id']}})['then'](handleEntityNotFound(_0xcdee4c,null))[_0x5bf2('0x2b')](removeEntity(_0xcdee4c,null))[_0x5bf2('0x3d')](handleError(_0xcdee4c,null));};function widgetAttributes(_0x541d7f){try{switch(_0x541d7f['type']){case'iframe':return[{'name':'attrUrl','value':_0x541d7f[_0x5bf2('0x3f')]||(_0x541d7f['attrs']&&_0x541d7f[_0x5bf2('0x40')][0x0]?_0x541d7f[_0x5bf2('0x40')][0x0][_0x5bf2('0x41')]:undefined)||_0x5bf2('0x42')}];case _0x5bf2('0x43'):return[{'name':'attrPath','value':_0x541d7f['attrPath']||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x0]?_0x541d7f[_0x5bf2('0x40')][0x0][_0x5bf2('0x41')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x541d7f[_0x5bf2('0x44')]||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x0]?_0x541d7f['attrs'][0x0][_0x5bf2('0x41')]:undefined)||'HH:mm:ss'},{'name':_0x5bf2('0x45'),'value':_0x541d7f['attrTimezone']||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x1]?_0x541d7f[_0x5bf2('0x40')][0x1][_0x5bf2('0x41')]:undefined)||_0x5bf2('0x46')},{'name':_0x5bf2('0x47'),'value':_0x541d7f[_0x5bf2('0x47')]||(_0x541d7f['attrs']&&_0x541d7f['attrs'][0x2]?_0x541d7f[_0x5bf2('0x40')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x5bf2('0x48'),'value':_0x541d7f[_0x5bf2('0x48')]||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x0]?_0x541d7f[_0x5bf2('0x40')][0x0]['value']:undefined)||_0x5bf2('0x49')},{'name':_0x5bf2('0x4a'),'value':_0x541d7f[_0x5bf2('0x4a')]||(_0x541d7f['attrs']&&_0x541d7f[_0x5bf2('0x40')][0x1]?_0x541d7f['attrs'][0x1][_0x5bf2('0x41')]:undefined)||[]},{'name':_0x5bf2('0x47'),'value':_0x541d7f['attrFontSize']||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f['attrs'][0x2]?_0x541d7f['attrs'][0x2][_0x5bf2('0x41')]:undefined)||0x14},{'name':'attrChannel','value':_0x541d7f['attrChannel']||(_0x541d7f['attrs']&&_0x541d7f[_0x5bf2('0x40')][0x3]?_0x541d7f[_0x5bf2('0x40')][0x3]['value']:undefined)||_0x5bf2('0x4b')},{'name':_0x5bf2('0x4c'),'value':_0x541d7f[_0x5bf2('0x4c')]||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f['attrs'][0x4]?_0x541d7f[_0x5bf2('0x40')][0x4][_0x5bf2('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x541d7f['attrFaxAccounts']||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f['attrs'][0x5]?_0x541d7f[_0x5bf2('0x40')][0x5][_0x5bf2('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x541d7f['attrSmsAccounts']||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f['attrs'][0x6]?_0x541d7f[_0x5bf2('0x40')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x541d7f[_0x5bf2('0x4d')]||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x7]?_0x541d7f['attrs'][0x7][_0x5bf2('0x41')]:undefined)||''},{'name':_0x5bf2('0x4e'),'value':_0x541d7f['attrWhatsappAccounts']||(_0x541d7f['attrs']&&_0x541d7f[_0x5bf2('0x40')][0x8]?_0x541d7f['attrs'][0x8][_0x5bf2('0x41')]:undefined)||''},{'name':_0x5bf2('0x4f'),'value':_0x541d7f['attrChatWebsites']||(_0x541d7f['attrs']&&_0x541d7f[_0x5bf2('0x40')][0x9]?_0x541d7f[_0x5bf2('0x40')][0x9][_0x5bf2('0x41')]:undefined)||''}];case _0x5bf2('0x50'):case _0x5bf2('0x51'):return[{'name':_0x5bf2('0x52'),'value':_0x541d7f[_0x5bf2('0x52')]||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x0]?_0x541d7f['attrs'][0x0]['value']:undefined)||_0x5bf2('0x49')},{'name':_0x5bf2('0x53'),'value':_0x541d7f[_0x5bf2('0x53')]||(_0x541d7f['attrs']&&_0x541d7f['attrs'][0x1]?_0x541d7f['attrs'][0x1]['value']:undefined)||null},{'name':_0x5bf2('0x54'),'value':_0x541d7f['attrSerie3']||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x2]?_0x541d7f['attrs'][0x2][_0x5bf2('0x41')]:undefined)||null},{'name':_0x5bf2('0x4a'),'value':_0x541d7f[_0x5bf2('0x4a')]||(_0x541d7f['attrs']&&_0x541d7f[_0x5bf2('0x40')][0x3]?_0x541d7f[_0x5bf2('0x40')][0x3][_0x5bf2('0x41')]:undefined)||[]},{'name':'attrChannel','value':_0x541d7f[_0x5bf2('0x55')]||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x4]?_0x541d7f[_0x5bf2('0x40')][0x4]['value']:undefined)||_0x5bf2('0x4b')},{'name':'attrEmailAccounts','value':_0x541d7f['attrEmailAccounts']||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x5]?_0x541d7f[_0x5bf2('0x40')][0x5]['value']:undefined)||''},{'name':_0x5bf2('0x56'),'value':_0x541d7f['attrFaxAccounts']||(_0x541d7f['attrs']&&_0x541d7f[_0x5bf2('0x40')][0x6]?_0x541d7f[_0x5bf2('0x40')][0x6][_0x5bf2('0x41')]:undefined)||''},{'name':_0x5bf2('0x57'),'value':_0x541d7f['attrSmsAccounts']||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x7]?_0x541d7f[_0x5bf2('0x40')][0x7][_0x5bf2('0x41')]:undefined)||''},{'name':_0x5bf2('0x4d'),'value':_0x541d7f[_0x5bf2('0x4d')]||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x8]?_0x541d7f[_0x5bf2('0x40')][0x8][_0x5bf2('0x41')]:undefined)||''},{'name':_0x5bf2('0x4e'),'value':_0x541d7f[_0x5bf2('0x4e')]||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x9]?_0x541d7f[_0x5bf2('0x40')][0x9][_0x5bf2('0x41')]:undefined)||''},{'name':_0x5bf2('0x4f'),'value':_0x541d7f[_0x5bf2('0x4f')]||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0xa]?_0x541d7f[_0x5bf2('0x40')][0xa][_0x5bf2('0x41')]:undefined)||''}];case _0x5bf2('0x58'):return[{'name':'attrReport','type':_0x541d7f[_0x5bf2('0x59')]||(_0x541d7f['attrs']&&_0x541d7f[_0x5bf2('0x40')][0x0]?_0x541d7f[_0x5bf2('0x40')][0x0][_0x5bf2('0x5a')]:undefined)||null,'value':_0x541d7f['attrReport']||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x0]?_0x541d7f[_0x5bf2('0x40')][0x0][_0x5bf2('0x41')]:undefined)||null},{'name':_0x5bf2('0x5b'),'value':_0x541d7f[_0x5bf2('0x5b')]||(_0x541d7f[_0x5bf2('0x40')]&&_0x541d7f[_0x5bf2('0x40')][0x1]?_0x541d7f[_0x5bf2('0x40')][0x1][_0x5bf2('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x376f3d){logger[_0x5bf2('0x2d')](_0x5bf2('0x5c'),JSON['stringify'](_0x376f3d));return[];}}exports['create']=function(_0x12a55e,_0x100e65){if(_0x12a55e[_0x5bf2('0x5d')]){_0x12a55e[_0x5bf2('0x5d')]['attrs']=widgetAttributes(_0x12a55e[_0x5bf2('0x5d')]);}return db[_0x5bf2('0x3e')][_0x5bf2('0x5e')](_0x12a55e[_0x5bf2('0x5d')],{})['then'](respondWithResult(_0x100e65,0xc9))[_0x5bf2('0x3d')](handleError(_0x100e65,null));};exports[_0x5bf2('0x2a')]=function(_0x555b77,_0x3e3e16){if(_0x555b77['body']['id']){delete _0x555b77[_0x5bf2('0x5d')]['id'];}_0x555b77['body'][_0x5bf2('0x40')]=widgetAttributes(_0x555b77[_0x5bf2('0x5d')]);return db['DashboardItem'][_0x5bf2('0x5f')]({'where':{'id':_0x555b77[_0x5bf2('0x31')]['id']}})[_0x5bf2('0x2b')](handleEntityNotFound(_0x3e3e16,null))[_0x5bf2('0x2b')](saveUpdates(_0x555b77[_0x5bf2('0x5d')],null))['then'](respondWithResult(_0x3e3e16,null))[_0x5bf2('0x3d')](handleError(_0x3e3e16,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d3b70ca..186461a 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 _0x5a41=['hook','events','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x52b418,_0x5c9758){var _0x4f7eb=function(_0x24929c){while(--_0x24929c){_0x52b418['push'](_0x52b418['shift']());}};_0x4f7eb(++_0x5c9758);}(_0x5a41,0x1b1));var _0x15a4=function(_0x3c7ae2,_0x5504e3){_0x3c7ae2=_0x3c7ae2-0x0;var _0x39f0d7=_0x5a41[_0x3c7ae2];return _0x39f0d7;};'use strict';var EventEmitter=require(_0x15a4('0x0'));var DashboardItem=require(_0x15a4('0x1'))['db'][_0x15a4('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x15a4('0x3')](0x0);var events={'afterCreate':_0x15a4('0x4'),'afterUpdate':'update','afterDestroy':_0x15a4('0x5')};function emitEvent(_0x1d4fb1){return function(_0x263e8a,_0x40cf0b,_0x242bbc){DashboardItemEvents['emit'](_0x1d4fb1+':'+_0x263e8a['id'],_0x263e8a);DashboardItemEvents[_0x15a4('0x6')](_0x1d4fb1,_0x263e8a);_0x242bbc(null);};}for(var e in events){if(events[_0x15a4('0x7')](e)){var event=events[e];DashboardItem[_0x15a4('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xde74=['remove','emit','hook','events','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x31be28,_0x598de7){var _0x4d23f2=function(_0x53828e){while(--_0x53828e){_0x31be28['push'](_0x31be28['shift']());}};_0x4d23f2(++_0x598de7);}(_0xde74,0xc0));var _0x4de7=function(_0x2027ee,_0x3a8043){_0x2027ee=_0x2027ee-0x0;var _0x50af71=_0xde74[_0x2027ee];return _0x50af71;};'use strict';var EventEmitter=require(_0x4de7('0x0'));var DashboardItem=require(_0x4de7('0x1'))['db'][_0x4de7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4de7('0x3')](0x0);var events={'afterCreate':_0x4de7('0x4'),'afterUpdate':_0x4de7('0x5'),'afterDestroy':_0x4de7('0x6')};function emitEvent(_0x173208){return function(_0xb144c5,_0x17b578,_0x5d724c){DashboardItemEvents[_0x4de7('0x7')](_0x173208+':'+_0xb144c5['id'],_0xb144c5);DashboardItemEvents[_0x4de7('0x7')](_0x173208,_0xb144c5);_0x5d724c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x4de7('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d565c6d..0fca7f1 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 _0xb2e3=['DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x457162,_0x2afd4c){var _0xa6a7d4=function(_0x420049){while(--_0x420049){_0x457162['push'](_0x457162['shift']());}};_0xa6a7d4(++_0x2afd4c);}(_0xb2e3,0xf9));var _0x3b2e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb2e3[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x3b2e('0x0'));var util=require(_0x3b2e('0x1'));var logger=require(_0x3b2e('0x2'))(_0x3b2e('0x3'));var moment=require(_0x3b2e('0x4'));var BPromise=require(_0x3b2e('0x5'));var rp=require(_0x3b2e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b2e('0x7'));var config=require(_0x3b2e('0x8'));var attributes=require(_0x3b2e('0x9'));module[_0x3b2e('0xa')]=function(_0x1c0672,_0x44a2f2){return _0x1c0672['define'](_0x3b2e('0xb'),attributes,{'tableName':_0x3b2e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e16=['api','request-promise','rimraf','../../config/environment','exports','define','DashboardItem','lodash','util','../../config/logger'];(function(_0x29c0e5,_0x18336a){var _0x21391e=function(_0x1e290f){while(--_0x1e290f){_0x29c0e5['push'](_0x29c0e5['shift']());}};_0x21391e(++_0x18336a);}(_0x7e16,0x16f));var _0x67e1=function(_0x474dd7,_0x2f266d){_0x474dd7=_0x474dd7-0x0;var _0x523eac=_0x7e16[_0x474dd7];return _0x523eac;};'use strict';var _=require(_0x67e1('0x0'));var util=require(_0x67e1('0x1'));var logger=require(_0x67e1('0x2'))(_0x67e1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x67e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67e1('0x5'));var config=require(_0x67e1('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x67e1('0x7')]=function(_0x3b5769,_0x2e0cb9){return _0x3b5769[_0x67e1('0x8')](_0x67e1('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 0a0d352..fcd79d0 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 _0xfb49=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util'];(function(_0x4c3a7b,_0x41453a){var _0x21fbb8=function(_0x46eccd){while(--_0x46eccd){_0x4c3a7b['push'](_0x4c3a7b['shift']());}};_0x21fbb8(++_0x41453a);}(_0xfb49,0x81));var _0x9fb4=function(_0x419ffd,_0x10bdfe){_0x419ffd=_0x419ffd-0x0;var _0xb0b19d=_0xfb49[_0x419ffd];return _0xb0b19d;};'use strict';var _=require('lodash');var util=require(_0x9fb4('0x0'));var moment=require('moment');var BPromise=require(_0x9fb4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fb4('0x2'))['db'];var utils=require(_0x9fb4('0x3'));var logger=require(_0x9fb4('0x4'))(_0x9fb4('0x5'));var config=require(_0x9fb4('0x6'));var jayson=require(_0x9fb4('0x7'));var client=jayson[_0x9fb4('0x8')][_0x9fb4('0x9')]({'port':0x232a});config[_0x9fb4('0xa')]=_[_0x9fb4('0xb')](config[_0x9fb4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9fb4('0xc'))(new Redis(config['redis']));require(_0x9fb4('0xd'))[_0x9fb4('0xe')](socket);function respondWithRpcPromise(_0x165aaa,_0x3bbea1,_0x3e870f){return new BPromise(function(_0x35ba51,_0x2fc261){return client[_0x9fb4('0xf')](_0x165aaa,_0x3e870f)['then'](function(_0xbb308a){logger[_0x9fb4('0x10')](_0x9fb4('0x11'),_0x3bbea1,'request\x20sent');logger[_0x9fb4('0x12')](_0x9fb4('0x13'),_0x3bbea1,_0x9fb4('0x14'),JSON[_0x9fb4('0x15')](_0xbb308a));if(_0xbb308a[_0x9fb4('0x16')]){if(_0xbb308a[_0x9fb4('0x16')]['code']===0x1f4){logger[_0x9fb4('0x16')](_0x9fb4('0x11'),_0x3bbea1,_0xbb308a[_0x9fb4('0x16')][_0x9fb4('0x17')]);return _0x2fc261(_0xbb308a[_0x9fb4('0x16')]['message']);}logger[_0x9fb4('0x16')](_0x9fb4('0x11'),_0x3bbea1,_0xbb308a['error'][_0x9fb4('0x17')]);return _0x35ba51(_0xbb308a[_0x9fb4('0x16')][_0x9fb4('0x17')]);}else{logger['info'](_0x9fb4('0x11'),_0x3bbea1,_0x9fb4('0x14'));_0x35ba51(_0xbb308a[_0x9fb4('0x18')]['message']);}})[_0x9fb4('0x19')](function(_0x538bfa){logger[_0x9fb4('0x16')](_0x9fb4('0x11'),_0x3bbea1,_0x538bfa);_0x2fc261(_0x538bfa);});});} \ No newline at end of file +var _0x10ed=['stringify','error','code','DashboardItem,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','localhost','request','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x10ed,0x10f));var _0xd10e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x10ed[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xd10e('0x0'));var util=require(_0xd10e('0x1'));var moment=require('moment');var BPromise=require(_0xd10e('0x2'));var rs=require(_0xd10e('0x3'));var fs=require('fs');var Redis=require(_0xd10e('0x4'));var db=require(_0xd10e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd10e('0x6'))('rpc');var config=require(_0xd10e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd10e('0x8')]({'port':0x232a});config[_0xd10e('0x9')]=_[_0xd10e('0xa')](config['redis'],{'host':_0xd10e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x38b3c8,_0x329087,_0x3b0839){return new BPromise(function(_0x13b233,_0x4bdc65){return client[_0xd10e('0xc')](_0x38b3c8,_0x3b0839)['then'](function(_0x53e0f0){logger['info']('DashboardItem,\x20%s,\x20%s',_0x329087,_0xd10e('0xd'));logger['debug'](_0xd10e('0xe'),_0x329087,_0xd10e('0xd'),JSON[_0xd10e('0xf')](_0x53e0f0));if(_0x53e0f0['error']){if(_0x53e0f0[_0xd10e('0x10')][_0xd10e('0x11')]===0x1f4){logger[_0xd10e('0x10')]('DashboardItem,\x20%s,\x20%s',_0x329087,_0x53e0f0[_0xd10e('0x10')]['message']);return _0x4bdc65(_0x53e0f0[_0xd10e('0x10')]['message']);}logger[_0xd10e('0x10')](_0xd10e('0x12'),_0x329087,_0x53e0f0[_0xd10e('0x10')][_0xd10e('0x13')]);return _0x13b233(_0x53e0f0[_0xd10e('0x10')][_0xd10e('0x13')]);}else{logger[_0xd10e('0x14')](_0xd10e('0x12'),_0x329087,_0xd10e('0xd'));_0x13b233(_0x53e0f0[_0xd10e('0x15')][_0xd10e('0x13')]);}})['catch'](function(_0x42ef8f){logger['error'](_0xd10e('0x12'),_0x329087,_0x42ef8f);_0x4bdc65(_0x42ef8f);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index fbc59c0..1d102fc 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 _0xa96a=['remove','update','emit','removeListener','register','./dashboardItem.events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa96a,0x15b));var _0xaa96=function(_0x296026,_0x5b1511){_0x296026=_0x296026-0x0;var _0x22e022=_0xa96a[_0x296026];return _0x22e022;};'use strict';var DashboardItemEvents=require(_0xaa96('0x0'));var events=['save',_0xaa96('0x1'),_0xaa96('0x2')];function createListener(_0x2586a3,_0x5511fd){return function(_0x36c14f){_0x5511fd[_0xaa96('0x3')](_0x2586a3,_0x36c14f);};}function removeListener(_0x289c92,_0x47b666){return function(){DashboardItemEvents[_0xaa96('0x4')](_0x289c92,_0x47b666);};}exports[_0xaa96('0x5')]=function(_0x4bfb2b){for(var _0xd4a0b4=0x0,_0x1f7285=events['length'];_0xd4a0b4<_0x1f7285;_0xd4a0b4++){var _0x4efc01=events[_0xd4a0b4];var _0x1be1e5=createListener('dashboardItem:'+_0x4efc01,_0x4bfb2b);DashboardItemEvents['on'](_0x4efc01,_0x1be1e5);}}; \ No newline at end of file +var _0xb582=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x47b887,_0x42934d){var _0x1153d0=function(_0x5c79bb){while(--_0x5c79bb){_0x47b887['push'](_0x47b887['shift']());}};_0x1153d0(++_0x42934d);}(_0xb582,0x1a9));var _0x2b58=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb582[_0x1035c1];return _0x308d67;};'use strict';var DashboardItemEvents=require(_0x2b58('0x0'));var events=[_0x2b58('0x1'),_0x2b58('0x2'),_0x2b58('0x3')];function createListener(_0x2f5f5d,_0x55470c){return function(_0x227450){_0x55470c[_0x2b58('0x4')](_0x2f5f5d,_0x227450);};}function removeListener(_0x907408,_0x34d3e4){return function(){DashboardItemEvents[_0x2b58('0x5')](_0x907408,_0x34d3e4);};}exports[_0x2b58('0x6')]=function(_0x35a3d7){for(var _0x285729=0x0,_0x3c97b6=events['length'];_0x285729<_0x3c97b6;_0x285729++){var _0x5f550d=events[_0x285729];var _0x2d12fd=createListener(_0x2b58('0x7')+_0x5f550d,_0x35a3d7);DashboardItemEvents['on'](_0x5f550d,_0x2d12fd);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 91ba94b..7a62544 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 _0x578e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x578e,0x1be));var _0xe578=function(_0x3a0172,_0x2e73e3){_0x3a0172=_0x3a0172-0x0;var _0x13ea5e=_0x578e[_0x3a0172];return _0x13ea5e;};'use strict';var multer=require('multer');var util=require(_0xe578('0x0'));var path=require(_0xe578('0x1'));var timeout=require(_0xe578('0x2'));var express=require(_0xe578('0x3'));var router=express['Router']();var fs_extra=require(_0xe578('0x4'));var auth=require(_0xe578('0x5'));var interaction=require(_0xe578('0x6'));var config=require(_0xe578('0x7'));var controller=require(_0xe578('0x8'));router['get'](_0xe578('0x9'),auth['isAuthenticated'](),controller[_0xe578('0xa')]);router[_0xe578('0xb')]('/',auth[_0xe578('0xc')](),controller[_0xe578('0xd')]);router['put'](_0xe578('0x9'),auth[_0xe578('0xc')](),controller[_0xe578('0xe')]);router[_0xe578('0xf')](_0xe578('0x9'),auth[_0xe578('0xc')](),controller[_0xe578('0x10')]);module[_0xe578('0x11')]=router; \ No newline at end of file +var _0x4c1a=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x5441b0,_0x50032d){var _0x1dda5e=function(_0x1ee0a9){while(--_0x1ee0a9){_0x5441b0['push'](_0x5441b0['shift']());}};_0x1dda5e(++_0x50032d);}(_0x4c1a,0x6d));var _0xa4c1=function(_0x439c4a,_0x138ca8){_0x439c4a=_0x439c4a-0x0;var _0x5309a1=_0x4c1a[_0x439c4a];return _0x5309a1;};'use strict';var multer=require(_0xa4c1('0x0'));var util=require(_0xa4c1('0x1'));var path=require(_0xa4c1('0x2'));var timeout=require(_0xa4c1('0x3'));var express=require('express');var router=express[_0xa4c1('0x4')]();var fs_extra=require(_0xa4c1('0x5'));var auth=require(_0xa4c1('0x6'));var interaction=require(_0xa4c1('0x7'));var config=require(_0xa4c1('0x8'));var controller=require(_0xa4c1('0x9'));router[_0xa4c1('0xa')](_0xa4c1('0xb'),auth[_0xa4c1('0xc')](),controller[_0xa4c1('0xd')]);router[_0xa4c1('0xe')]('/',auth[_0xa4c1('0xc')](),controller[_0xa4c1('0xf')]);router[_0xa4c1('0x10')](_0xa4c1('0xb'),auth[_0xa4c1('0xc')](),controller[_0xa4c1('0x11')]);router[_0xa4c1('0x12')](_0xa4c1('0xb'),auth[_0xa4c1('0xc')](),controller[_0xa4c1('0x13')]);module[_0xa4c1('0x14')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index fa3dbcb..316f2a4 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 _0x1942=['STRING','ENUM','second','third','first','exports'];(function(_0x783ce7,_0x4e52a6){var _0x3a1a83=function(_0x3a95cc){while(--_0x3a95cc){_0x783ce7['push'](_0x783ce7['shift']());}};_0x3a1a83(++_0x4e52a6);}(_0x1942,0x1af));var _0x2194=function(_0x5f4841,_0x5aee92){_0x5f4841=_0x5f4841-0x0;var _0x4fe27f=_0x1942[_0x5f4841];return _0x4fe27f;};'use strict';var Sequelize=require('sequelize');module[_0x2194('0x0')]={'name':{'type':Sequelize[_0x2194('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x2194('0x2')]('first',_0x2194('0x3'),_0x2194('0x4')),'allowNull':![],'defaultValue':_0x2194('0x5')},'description':{'type':Sequelize[_0x2194('0x1')]}}; \ No newline at end of file +var _0xb91f=['sequelize','STRING','ENUM','first','second'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb91f,0x9b));var _0xfb91=function(_0x416cc0,_0x40a68b){_0x416cc0=_0x416cc0-0x0;var _0x468958=_0xb91f[_0x416cc0];return _0x468958;};'use strict';var Sequelize=require(_0xfb91('0x0'));module['exports']={'name':{'type':Sequelize[_0xfb91('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xfb91('0x2')](_0xfb91('0x3'),_0xfb91('0x4'),'third'),'allowNull':![],'defaultValue':_0xfb91('0x3')},'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 0338986..8d3e414 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 _0x950a=['intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','Disposition','fieldName','key','model','map','keys','filters'];(function(_0x3ad291,_0x4fe346){var _0x22bd17=function(_0x5ac08e){while(--_0x5ac08e){_0x3ad291['push'](_0x3ad291['shift']());}};_0x22bd17(++_0x4fe346);}(_0x950a,0x111));var _0xa950=function(_0x2e1ee7,_0x1cb9aa){_0x2e1ee7=_0x2e1ee7-0x0;var _0x2029e4=_0x950a[_0x2e1ee7];return _0x2029e4;};'use strict';var emlformat=require(_0xa950('0x0'));var rimraf=require(_0xa950('0x1'));var zipdir=require(_0xa950('0x2'));var jsonpatch=require(_0xa950('0x3'));var rp=require('request-promise');var moment=require(_0xa950('0x4'));var BPromise=require(_0xa950('0x5'));var Mustache=require(_0xa950('0x6'));var util=require(_0xa950('0x7'));var path=require('path');var sox=require(_0xa950('0x8'));var csv=require(_0xa950('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa950('0xa'));var _=require(_0xa950('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa950('0xc'));var deskjs=require(_0xa950('0xd'));var toCsv=require(_0xa950('0x9'));var querystring=require(_0xa950('0xe'));var Papa=require(_0xa950('0xf'));var Redis=require(_0xa950('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa950('0x11'));var logger=require('../../config/logger')(_0xa950('0x12'));var utils=require(_0xa950('0x13'));var config=require(_0xa950('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa950('0x15'))['db'];function respondWithStatusCode(_0x4f9c04,_0x10e64a){_0x10e64a=_0x10e64a||0xcc;return function(_0x439097){if(_0x439097){return _0x4f9c04[_0xa950('0x16')](_0x10e64a);}return _0x4f9c04['status'](_0x10e64a)[_0xa950('0x17')]();};}function respondWithResult(_0x2aed6a,_0x1c7adb){_0x1c7adb=_0x1c7adb||0xc8;return function(_0x4ba74f){if(_0x4ba74f){return _0x2aed6a[_0xa950('0x18')](_0x1c7adb)[_0xa950('0x19')](_0x4ba74f);}};}function respondWithFilteredResult(_0x425201,_0x5d5f4c){return function(_0x31b25b){if(_0x31b25b){var _0x46fca7=typeof _0x5d5f4c[_0xa950('0x1a')]==='undefined'&&typeof _0x5d5f4c[_0xa950('0x1b')]===_0xa950('0x1c');var _0x162586=_0x31b25b[_0xa950('0x1d')];var _0x16aabc=_0x46fca7?0x0:_0x5d5f4c[_0xa950('0x1a')];var _0x2b0e44=_0x46fca7?_0x31b25b[_0xa950('0x1d')]:_0x5d5f4c[_0xa950('0x1a')]+_0x5d5f4c[_0xa950('0x1b')];var _0x28fedf;if(_0x2b0e44>=_0x162586){_0x2b0e44=_0x162586;_0x28fedf=0xc8;}else{_0x28fedf=0xce;}_0x425201[_0xa950('0x18')](_0x28fedf);return _0x425201[_0xa950('0x1e')]('Content-Range',_0x16aabc+'-'+_0x2b0e44+'/'+_0x162586)[_0xa950('0x19')](_0x31b25b);}return null;};}function patchUpdates(_0x1a10fe){return function(_0x50abe1){try{jsonpatch[_0xa950('0x1f')](_0x50abe1,_0x1a10fe,!![]);}catch(_0x41c405){return BPromise['reject'](_0x41c405);}return _0x50abe1[_0xa950('0x20')]();};}function saveUpdates(_0x5ad191,_0x2eda79){return function(_0x14ada5){if(_0x14ada5){return _0x14ada5[_0xa950('0x21')](_0x5ad191)[_0xa950('0x22')](function(_0x5617cd){return _0x5617cd;});}return null;};}function removeEntity(_0x11b8af,_0x3f4633){return function(_0x31c135){if(_0x31c135){return _0x31c135[_0xa950('0x23')]()[_0xa950('0x22')](function(){var _0x22e2c1=_0x31c135[_0xa950('0x24')]({'plain':!![]});var _0x23cb20=_0xa950('0x25');return db[_0xa950('0x26')][_0xa950('0x23')]({'where':{'type':_0x23cb20,'resourceId':_0x22e2c1['id']}})[_0xa950('0x22')](function(){return _0x31c135;});})[_0xa950('0x22')](function(){_0x11b8af['status'](0xcc)[_0xa950('0x17')]();});}};}function handleEntityNotFound(_0x288934,_0x3f37f8){return function(_0x1aa96a){if(!_0x1aa96a){_0x288934[_0xa950('0x16')](0x194);}return _0x1aa96a;};}function handleError(_0x186f35,_0x2891ba){_0x2891ba=_0x2891ba||0x1f4;return function(_0x52e133){logger[_0xa950('0x27')](_0x52e133[_0xa950('0x28')]);if(_0x52e133['name']){delete _0x52e133[_0xa950('0x29')];}_0x186f35[_0xa950('0x18')](_0x2891ba)[_0xa950('0x2a')](_0x52e133);};}exports[_0xa950('0x2b')]=function(_0x152f53,_0x1945ca){var _0x1d6e91={},_0x2d0c59={},_0x203703={'count':0x0,'rows':[]};var _0x3c6ea8=_['map'](db[_0xa950('0x2c')]['rawAttributes'],function(_0x565933){return{'name':_0x565933[_0xa950('0x2d')],'type':_0x565933['type'][_0xa950('0x2e')]};});_0x2d0c59[_0xa950('0x2f')]=_[_0xa950('0x30')](_0x3c6ea8,_0xa950('0x29'));_0x2d0c59['query']=_[_0xa950('0x31')](_0x152f53['query']);_0x2d0c59[_0xa950('0x32')]=_[_0xa950('0x33')](_0x2d0c59['model'],_0x2d0c59['query']);_0x1d6e91[_0xa950('0x34')]=_[_0xa950('0x33')](_0x2d0c59[_0xa950('0x2f')],qs[_0xa950('0x35')](_0x152f53[_0xa950('0x36')][_0xa950('0x35')]));_0x1d6e91['attributes']=_0x1d6e91['attributes'][_0xa950('0x37')]?_0x1d6e91['attributes']:_0x2d0c59[_0xa950('0x2f')];if(!_0x152f53[_0xa950('0x36')][_0xa950('0x38')](_0xa950('0x39'))){_0x1d6e91[_0xa950('0x1b')]=qs[_0xa950('0x1b')](_0x152f53[_0xa950('0x36')][_0xa950('0x1b')]);_0x1d6e91[_0xa950('0x1a')]=qs[_0xa950('0x1a')](_0x152f53['query'][_0xa950('0x1a')]);}_0x1d6e91['order']=qs[_0xa950('0x3a')](_0x152f53[_0xa950('0x36')]['sort']);_0x1d6e91['where']=qs[_0xa950('0x32')](_[_0xa950('0x3b')](_0x152f53['query'],_0x2d0c59[_0xa950('0x32')]),_0x3c6ea8);if(_0x152f53[_0xa950('0x36')]['filter']){_0x1d6e91[_0xa950('0x3c')]=_[_0xa950('0x3d')](_0x1d6e91[_0xa950('0x3c')],{'$or':_[_0xa950('0x30')](_0x3c6ea8,function(_0x926d8a){if(_0x926d8a[_0xa950('0x3e')]!==_0xa950('0x3f')){var _0x9b2a5b={};_0x9b2a5b[_0x926d8a['name']]={'$like':'%'+_0x152f53[_0xa950('0x36')][_0xa950('0x40')]+'%'};return _0x9b2a5b;}})});}_0x1d6e91=_['merge']({},_0x1d6e91,_0x152f53[_0xa950('0x41')]);var _0x115b35={'where':_0x1d6e91[_0xa950('0x3c')]};return db['Disposition'][_0xa950('0x1d')](_0x115b35)[_0xa950('0x22')](function(_0x8bdd37){_0x203703['count']=_0x8bdd37;if(_0x152f53['query'][_0xa950('0x42')]){_0x1d6e91[_0xa950('0x43')]=[{'all':!![]}];}return db[_0xa950('0x2c')]['findAll'](_0x1d6e91);})['then'](function(_0x51f5a5){_0x203703[_0xa950('0x44')]=_0x51f5a5;return _0x203703;})[_0xa950('0x22')](respondWithFilteredResult(_0x1945ca,_0x1d6e91))[_0xa950('0x45')](handleError(_0x1945ca,null));};exports[_0xa950('0x46')]=function(_0x4036ef,_0x5c25fd){var _0x40a1e8={'raw':!![],'where':{'id':_0x4036ef['params']['id']}},_0x208063={};_0x208063['model']=_[_0xa950('0x31')](db[_0xa950('0x2c')]['rawAttributes']);_0x208063['query']=_['keys'](_0x4036ef['query']);_0x208063[_0xa950('0x32')]=_[_0xa950('0x33')](_0x208063['model'],_0x208063['query']);_0x40a1e8[_0xa950('0x34')]=_['intersection'](_0x208063[_0xa950('0x2f')],qs[_0xa950('0x35')](_0x4036ef[_0xa950('0x36')][_0xa950('0x35')]));_0x40a1e8[_0xa950('0x34')]=_0x40a1e8[_0xa950('0x34')][_0xa950('0x37')]?_0x40a1e8[_0xa950('0x34')]:_0x208063['model'];if(_0x4036ef[_0xa950('0x36')]['includeAll']){_0x40a1e8[_0xa950('0x43')]=[{'all':!![]}];}_0x40a1e8=_[_0xa950('0x3d')]({},_0x40a1e8,_0x4036ef[_0xa950('0x41')]);return db[_0xa950('0x2c')][_0xa950('0x47')](_0x40a1e8)[_0xa950('0x22')](handleEntityNotFound(_0x5c25fd,null))[_0xa950('0x22')](respondWithResult(_0x5c25fd,null))[_0xa950('0x45')](handleError(_0x5c25fd,null));};exports[_0xa950('0x48')]=function(_0x4f777a,_0x3cf01c){return db[_0xa950('0x2c')][_0xa950('0x48')](_0x4f777a[_0xa950('0x49')],{})[_0xa950('0x22')](function(_0x5a2b2f){var _0x237152=_0x4f777a[_0xa950('0x4a')][_0xa950('0x24')]({'plain':!![]});if(!_0x237152)throw new Error(_0xa950('0x4b'));if(_0x237152[_0xa950('0x4c')]===_0xa950('0x4a')){var _0x2752e7=_0x5a2b2f['get']({'plain':!![]});var _0xc00de4=_0xa950('0x25');return db[_0xa950('0x4d')]['find']({'where':{'name':_0xc00de4,'userProfileId':_0x237152['userProfileId']},'raw':!![]})[_0xa950('0x22')](function(_0x26216c){if(_0x26216c&&_0x26216c[_0xa950('0x4e')]===0x0){return db[_0xa950('0x26')][_0xa950('0x48')]({'name':_0x2752e7[_0xa950('0x29')],'resourceId':_0x2752e7['id'],'type':_0x26216c[_0xa950('0x29')],'sectionId':_0x26216c['id']},{})[_0xa950('0x22')](function(){return _0x5a2b2f;});}else{return _0x5a2b2f;}})['catch'](function(_0x2d658d){logger[_0xa950('0x27')](_0xa950('0x4f'),_0x2d658d);throw _0x2d658d;});}return _0x5a2b2f;})[_0xa950('0x22')](respondWithResult(_0x3cf01c,0xc9))[_0xa950('0x45')](handleError(_0x3cf01c,null));};exports['update']=function(_0x200183,_0x5cd88b){if(_0x200183[_0xa950('0x49')]['id']){delete _0x200183[_0xa950('0x49')]['id'];}return db[_0xa950('0x2c')][_0xa950('0x47')]({'where':{'id':_0x200183[_0xa950('0x50')]['id']}})[_0xa950('0x22')](handleEntityNotFound(_0x5cd88b,null))['then'](saveUpdates(_0x200183['body'],null))['then'](respondWithResult(_0x5cd88b,null))[_0xa950('0x45')](handleError(_0x5cd88b,null));};exports[_0xa950('0x23')]=function(_0x1303a9,_0x109b9b){return db[_0xa950('0x2c')][_0xa950('0x47')]({'where':{'id':_0x1303a9[_0xa950('0x50')]['id']}})[_0xa950('0x22')](handleEntityNotFound(_0x109b9b,null))['then'](removeEntity(_0x109b9b,null))[_0xa950('0x45')](handleError(_0x109b9b,null));}; \ No newline at end of file +var _0x12c2=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','Disposition','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','role','user','Dispositions','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset'];(function(_0x57c2b5,_0x28f98a){var _0x2ad3ff=function(_0x2d96c5){while(--_0x2d96c5){_0x57c2b5['push'](_0x57c2b5['shift']());}};_0x2ad3ff(++_0x28f98a);}(_0x12c2,0xdc));var _0x212c=function(_0x144d5b,_0xc6249f){_0x144d5b=_0x144d5b-0x0;var _0xccdcf4=_0x12c2[_0x144d5b];return _0xccdcf4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x212c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x212c('0x1'));var rp=require(_0x212c('0x2'));var moment=require(_0x212c('0x3'));var BPromise=require(_0x212c('0x4'));var Mustache=require(_0x212c('0x5'));var util=require(_0x212c('0x6'));var path=require(_0x212c('0x7'));var sox=require(_0x212c('0x8'));var csv=require(_0x212c('0x9'));var ejs=require(_0x212c('0xa'));var fs=require('fs');var fs_extra=require(_0x212c('0xb'));var _=require(_0x212c('0xc'));var squel=require('squel');var crypto=require(_0x212c('0xd'));var jsforce=require(_0x212c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x212c('0x9'));var querystring=require(_0x212c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x212c('0x10'));var qs=require(_0x212c('0x11'));var as=require(_0x212c('0x12'));var hardwareService=require(_0x212c('0x13'));var logger=require(_0x212c('0x14'))(_0x212c('0x15'));var utils=require(_0x212c('0x16'));var config=require(_0x212c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe9c21c,_0x1ff515){_0x1ff515=_0x1ff515||0xcc;return function(_0x6f2902){if(_0x6f2902){return _0xe9c21c[_0x212c('0x18')](_0x1ff515);}return _0xe9c21c[_0x212c('0x19')](_0x1ff515)[_0x212c('0x1a')]();};}function respondWithResult(_0x34e27b,_0x56affb){_0x56affb=_0x56affb||0xc8;return function(_0x3e30f5){if(_0x3e30f5){return _0x34e27b[_0x212c('0x19')](_0x56affb)[_0x212c('0x1b')](_0x3e30f5);}};}function respondWithFilteredResult(_0x44f224,_0x2b6bdc){return function(_0x86b703){if(_0x86b703){var _0xddfb8a=typeof _0x2b6bdc[_0x212c('0x1c')]===_0x212c('0x1d')&&typeof _0x2b6bdc[_0x212c('0x1e')]===_0x212c('0x1d');var _0x14d443=_0x86b703[_0x212c('0x1f')];var _0x14ef56=_0xddfb8a?0x0:_0x2b6bdc[_0x212c('0x1c')];var _0x41abda=_0xddfb8a?_0x86b703['count']:_0x2b6bdc[_0x212c('0x1c')]+_0x2b6bdc['limit'];var _0x42a278;if(_0x41abda>=_0x14d443){_0x41abda=_0x14d443;_0x42a278=0xc8;}else{_0x42a278=0xce;}_0x44f224[_0x212c('0x19')](_0x42a278);return _0x44f224['set'](_0x212c('0x20'),_0x14ef56+'-'+_0x41abda+'/'+_0x14d443)[_0x212c('0x1b')](_0x86b703);}return null;};}function patchUpdates(_0x5a65da){return function(_0x1c9f1b){try{jsonpatch[_0x212c('0x21')](_0x1c9f1b,_0x5a65da,!![]);}catch(_0x5d0863){return BPromise[_0x212c('0x22')](_0x5d0863);}return _0x1c9f1b[_0x212c('0x23')]();};}function saveUpdates(_0x20f77a,_0x4e536e){return function(_0x5eefab){if(_0x5eefab){return _0x5eefab[_0x212c('0x24')](_0x20f77a)[_0x212c('0x25')](function(_0x3e84ba){return _0x3e84ba;});}return null;};}function removeEntity(_0x3857db,_0x33fe6d){return function(_0x14ee86){if(_0x14ee86){return _0x14ee86[_0x212c('0x26')]()[_0x212c('0x25')](function(){var _0x35834a=_0x14ee86[_0x212c('0x27')]({'plain':!![]});var _0x3de5b4='Dispositions';return db[_0x212c('0x28')]['destroy']({'where':{'type':_0x3de5b4,'resourceId':_0x35834a['id']}})['then'](function(){return _0x14ee86;});})[_0x212c('0x25')](function(){_0x3857db['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1590a8,_0x50bfa0){return function(_0x2ee8bc){if(!_0x2ee8bc){_0x1590a8['sendStatus'](0x194);}return _0x2ee8bc;};}function handleError(_0x19469e,_0x173684){_0x173684=_0x173684||0x1f4;return function(_0x43ba5a){logger['error'](_0x43ba5a[_0x212c('0x29')]);if(_0x43ba5a[_0x212c('0x2a')]){delete _0x43ba5a['name'];}_0x19469e['status'](_0x173684)[_0x212c('0x2b')](_0x43ba5a);};}exports[_0x212c('0x2c')]=function(_0x49f841,_0x4cb1ed){var _0x2c90ab={},_0xeff53a={},_0x3c875f={'count':0x0,'rows':[]};var _0x26054f=_['map'](db[_0x212c('0x2d')]['rawAttributes'],function(_0x100732){return{'name':_0x100732[_0x212c('0x2e')],'type':_0x100732['type'][_0x212c('0x2f')]};});_0xeff53a[_0x212c('0x30')]=_[_0x212c('0x31')](_0x26054f,_0x212c('0x2a'));_0xeff53a[_0x212c('0x32')]=_['keys'](_0x49f841[_0x212c('0x32')]);_0xeff53a[_0x212c('0x33')]=_[_0x212c('0x34')](_0xeff53a[_0x212c('0x30')],_0xeff53a[_0x212c('0x32')]);_0x2c90ab[_0x212c('0x35')]=_[_0x212c('0x34')](_0xeff53a[_0x212c('0x30')],qs[_0x212c('0x36')](_0x49f841[_0x212c('0x32')][_0x212c('0x36')]));_0x2c90ab[_0x212c('0x35')]=_0x2c90ab[_0x212c('0x35')][_0x212c('0x37')]?_0x2c90ab[_0x212c('0x35')]:_0xeff53a[_0x212c('0x30')];if(!_0x49f841[_0x212c('0x32')][_0x212c('0x38')]('nolimit')){_0x2c90ab[_0x212c('0x1e')]=qs[_0x212c('0x1e')](_0x49f841[_0x212c('0x32')]['limit']);_0x2c90ab[_0x212c('0x1c')]=qs[_0x212c('0x1c')](_0x49f841['query'][_0x212c('0x1c')]);}_0x2c90ab['order']=qs[_0x212c('0x39')](_0x49f841[_0x212c('0x32')][_0x212c('0x39')]);_0x2c90ab[_0x212c('0x3a')]=qs['filters'](_[_0x212c('0x3b')](_0x49f841[_0x212c('0x32')],_0xeff53a['filters']),_0x26054f);if(_0x49f841['query'][_0x212c('0x3c')]){_0x2c90ab[_0x212c('0x3a')]=_[_0x212c('0x3d')](_0x2c90ab[_0x212c('0x3a')],{'$or':_['map'](_0x26054f,function(_0x45745a){if(_0x45745a[_0x212c('0x3e')]!==_0x212c('0x3f')){var _0x40a663={};_0x40a663[_0x45745a[_0x212c('0x2a')]]={'$like':'%'+_0x49f841['query'][_0x212c('0x3c')]+'%'};return _0x40a663;}})});}_0x2c90ab=_[_0x212c('0x3d')]({},_0x2c90ab,_0x49f841[_0x212c('0x40')]);var _0x3001cd={'where':_0x2c90ab[_0x212c('0x3a')]};return db[_0x212c('0x2d')][_0x212c('0x1f')](_0x3001cd)['then'](function(_0x2a289e){_0x3c875f[_0x212c('0x1f')]=_0x2a289e;if(_0x49f841['query'][_0x212c('0x41')]){_0x2c90ab[_0x212c('0x42')]=[{'all':!![]}];}return db[_0x212c('0x2d')][_0x212c('0x43')](_0x2c90ab);})[_0x212c('0x25')](function(_0x1ae0ad){_0x3c875f[_0x212c('0x44')]=_0x1ae0ad;return _0x3c875f;})[_0x212c('0x25')](respondWithFilteredResult(_0x4cb1ed,_0x2c90ab))[_0x212c('0x45')](handleError(_0x4cb1ed,null));};exports[_0x212c('0x46')]=function(_0x2ba412,_0xd8e890){var _0x2fb0b7={'raw':!![],'where':{'id':_0x2ba412[_0x212c('0x47')]['id']}},_0x5981e5={};_0x5981e5[_0x212c('0x30')]=_[_0x212c('0x48')](db[_0x212c('0x2d')][_0x212c('0x49')]);_0x5981e5['query']=_['keys'](_0x2ba412[_0x212c('0x32')]);_0x5981e5['filters']=_[_0x212c('0x34')](_0x5981e5['model'],_0x5981e5[_0x212c('0x32')]);_0x2fb0b7[_0x212c('0x35')]=_[_0x212c('0x34')](_0x5981e5['model'],qs[_0x212c('0x36')](_0x2ba412[_0x212c('0x32')][_0x212c('0x36')]));_0x2fb0b7[_0x212c('0x35')]=_0x2fb0b7[_0x212c('0x35')][_0x212c('0x37')]?_0x2fb0b7[_0x212c('0x35')]:_0x5981e5['model'];if(_0x2ba412[_0x212c('0x32')][_0x212c('0x41')]){_0x2fb0b7['include']=[{'all':!![]}];}_0x2fb0b7=_[_0x212c('0x3d')]({},_0x2fb0b7,_0x2ba412[_0x212c('0x40')]);return db[_0x212c('0x2d')][_0x212c('0x4a')](_0x2fb0b7)[_0x212c('0x25')](handleEntityNotFound(_0xd8e890,null))[_0x212c('0x25')](respondWithResult(_0xd8e890,null))[_0x212c('0x45')](handleError(_0xd8e890,null));};exports[_0x212c('0x4b')]=function(_0x1c3e93,_0xd65927){return db['Disposition']['create'](_0x1c3e93[_0x212c('0x4c')],{})[_0x212c('0x25')](function(_0x19f194){var _0x2abbd8=_0x1c3e93['user'][_0x212c('0x27')]({'plain':!![]});if(!_0x2abbd8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2abbd8[_0x212c('0x4d')]===_0x212c('0x4e')){var _0x4f6041=_0x19f194[_0x212c('0x27')]({'plain':!![]});var _0x35031a=_0x212c('0x4f');return db[_0x212c('0x50')][_0x212c('0x4a')]({'where':{'name':_0x35031a,'userProfileId':_0x2abbd8[_0x212c('0x51')]},'raw':!![]})[_0x212c('0x25')](function(_0x3c2390){if(_0x3c2390&&_0x3c2390['autoAssociation']===0x0){return db['UserProfileResource'][_0x212c('0x4b')]({'name':_0x4f6041[_0x212c('0x2a')],'resourceId':_0x4f6041['id'],'type':_0x3c2390['name'],'sectionId':_0x3c2390['id']},{})[_0x212c('0x25')](function(){return _0x19f194;});}else{return _0x19f194;}})[_0x212c('0x45')](function(_0x5b94dc){logger['error'](_0x212c('0x52'),_0x5b94dc);throw _0x5b94dc;});}return _0x19f194;})['then'](respondWithResult(_0xd65927,0xc9))[_0x212c('0x45')](handleError(_0xd65927,null));};exports[_0x212c('0x24')]=function(_0x480e50,_0x154e3f){if(_0x480e50['body']['id']){delete _0x480e50['body']['id'];}return db[_0x212c('0x2d')][_0x212c('0x4a')]({'where':{'id':_0x480e50[_0x212c('0x47')]['id']}})[_0x212c('0x25')](handleEntityNotFound(_0x154e3f,null))['then'](saveUpdates(_0x480e50[_0x212c('0x4c')],null))['then'](respondWithResult(_0x154e3f,null))[_0x212c('0x45')](handleError(_0x154e3f,null));};exports[_0x212c('0x26')]=function(_0x5b4b69,_0x570ec9){return db['Disposition']['find']({'where':{'id':_0x5b4b69[_0x212c('0x47')]['id']}})[_0x212c('0x25')](handleEntityNotFound(_0x570ec9,null))[_0x212c('0x25')](removeEntity(_0x570ec9,null))[_0x212c('0x45')](handleError(_0x570ec9,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index bd2b13a..ee32e13 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 _0x4f59=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x4f59,0x81));var _0x94f5=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x4f59[_0x1e05c1];return _0x15f1ca;};'use strict';var _=require(_0x94f5('0x0'));var util=require(_0x94f5('0x1'));var logger=require(_0x94f5('0x2'))(_0x94f5('0x3'));var moment=require(_0x94f5('0x4'));var BPromise=require(_0x94f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94f5('0x6'));var rimraf=require(_0x94f5('0x7'));var config=require(_0x94f5('0x8'));var attributes=require(_0x94f5('0x9'));module[_0x94f5('0xa')]=function(_0x2db52c,_0x58459d){return _0x2db52c['define'](_0x94f5('0xb'),attributes,{'tableName':_0x94f5('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x94f5('0xd'),_0x94f5('0xe')]},{'unique':!![],'name':_0x94f5('0xf'),'fields':[_0x94f5('0xd'),_0x94f5('0x10')]},{'unique':!![],'name':_0x94f5('0x11'),'fields':[_0x94f5('0xd'),_0x94f5('0x12')]},{'unique':!![],'name':_0x94f5('0x13'),'fields':[_0x94f5('0xd'),_0x94f5('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0x94f5('0xd'),_0x94f5('0x15')]},{'unique':!![],'name':_0x94f5('0x16'),'fields':[_0x94f5('0xd'),_0x94f5('0x17')]},{'unique':!![],'name':_0x94f5('0x18'),'fields':['name',_0x94f5('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa5d=['WhatsappAccountId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xaa5d,0xb7));var _0xdaa5=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0xaa5d[_0x34b1b8];return _0x542dd8;};'use strict';var _=require('lodash');var util=require(_0xdaa5('0x0'));var logger=require(_0xdaa5('0x1'))(_0xdaa5('0x2'));var moment=require(_0xdaa5('0x3'));var BPromise=require(_0xdaa5('0x4'));var rp=require(_0xdaa5('0x5'));var fs=require('fs');var path=require(_0xdaa5('0x6'));var rimraf=require('rimraf');var config=require(_0xdaa5('0x7'));var attributes=require(_0xdaa5('0x8'));module[_0xdaa5('0x9')]=function(_0x5a57d8,_0x167baf){return _0x5a57d8[_0xdaa5('0xa')](_0xdaa5('0xb'),attributes,{'tableName':_0xdaa5('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xdaa5('0xd'),'fields':[_0xdaa5('0xe'),_0xdaa5('0xf')]},{'unique':!![],'name':_0xdaa5('0x10'),'fields':[_0xdaa5('0xe'),_0xdaa5('0x11')]},{'unique':!![],'name':_0xdaa5('0x12'),'fields':['name',_0xdaa5('0x13')]},{'unique':!![],'name':'name_sms','fields':[_0xdaa5('0xe'),_0xdaa5('0x14')]},{'unique':!![],'name':_0xdaa5('0x15'),'fields':[_0xdaa5('0xe'),_0xdaa5('0x16')]},{'unique':!![],'name':_0xdaa5('0x17'),'fields':[_0xdaa5('0xe'),_0xdaa5('0x18')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xdaa5('0xe'),_0xdaa5('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f460e04..2376db9 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(_0x3b741f,_0x49ae49){var _0x30dd94=function(_0x4b74a0){while(--_0x4b74a0){_0x3b741f['push'](_0x3b741f['shift']());}};_0x30dd94(++_0x49ae49);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x3dea87,_0x395002){var _0x457f76=function(_0x346053){while(--_0x346053){_0x3dea87['push'](_0x3dea87['shift']());}};_0x457f76(++_0x395002);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 f78b7b1..8d256f2 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 _0xb8bd=['Router','fs-extra','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout','express'];(function(_0x29a91c,_0x5ac2c5){var _0x2ab4ff=function(_0x47fee7){while(--_0x47fee7){_0x29a91c['push'](_0x29a91c['shift']());}};_0x2ab4ff(++_0x5ac2c5);}(_0xb8bd,0xfc));var _0xdb8b=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xb8bd[_0x2d34d6];return _0x1d3d12;};'use strict';var multer=require(_0xdb8b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdb8b('0x1'));var express=require(_0xdb8b('0x2'));var router=express[_0xdb8b('0x3')]();var fs_extra=require(_0xdb8b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdb8b('0x5'));var controller=require(_0xdb8b('0x6'));router[_0xdb8b('0x7')]('/',auth[_0xdb8b('0x8')](),controller[_0xdb8b('0x9')]);router[_0xdb8b('0x7')](_0xdb8b('0xa'),auth['isAuthenticated'](),controller[_0xdb8b('0xb')]);router[_0xdb8b('0xc')]('/',auth[_0xdb8b('0x8')](),controller['create']);router[_0xdb8b('0xd')](_0xdb8b('0xa'),auth[_0xdb8b('0x8')](),controller[_0xdb8b('0xe')]);router[_0xdb8b('0xf')](_0xdb8b('0xa'),auth['isAuthenticated'](),controller[_0xdb8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x734e=['path','express','Router','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','/:id','create','put','delete','destroy','exports','multer','util'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x734e,0x1be));var _0xe734=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0x734e[_0x3725ee];return _0x399c71;};'use strict';var multer=require(_0xe734('0x0'));var util=require(_0xe734('0x1'));var path=require(_0xe734('0x2'));var timeout=require('connect-timeout');var express=require(_0xe734('0x3'));var router=express[_0xe734('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe734('0x5'));var interaction=require(_0xe734('0x6'));var config=require('../../config/environment');var controller=require(_0xe734('0x7'));router[_0xe734('0x8')]('/',auth[_0xe734('0x9')](),controller['index']);router[_0xe734('0x8')](_0xe734('0xa'),auth[_0xe734('0x9')](),controller['show']);router['post']('/',auth[_0xe734('0x9')](),controller[_0xe734('0xb')]);router[_0xe734('0xc')](_0xe734('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe734('0xd')](_0xe734('0xa'),auth[_0xe734('0x9')](),controller[_0xe734('0xe')]);module[_0xe734('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 5097c9d..d07e68e 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 _0xf696=['IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','setDataValue','mandatoryDispositionPauseId','exports','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM','2400','7200','9600','12000','4800','14400','v17,v27,v29','INTEGER','SIP'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xf696,0x110));var _0x6f69=function(_0xef234c,_0x1370d2){_0xef234c=_0xef234c-0x0;var _0x1c7ee5=_0xf696[_0xef234c];return _0x1c7ee5;};'use strict';var Sequelize=require('sequelize');module[_0x6f69('0x0')]={'name':{'type':Sequelize[_0x6f69('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6f69('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x6f69('0x2'),'no'),'defaultValue':_0x6f69('0x2')},'headerinfo':{'type':Sequelize[_0x6f69('0x1')],'defaultValue':_0x6f69('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x6f69('0x4')](_0x6f69('0x5'),'4800',_0x6f69('0x6'),_0x6f69('0x7'),_0x6f69('0x8'),'14400'),'defaultValue':_0x6f69('0x9')},'maxrate':{'type':Sequelize[_0x6f69('0x4')](_0x6f69('0x5'),'4800','7200',_0x6f69('0x7'),'12000',_0x6f69('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x6f69('0x1')],'defaultValue':_0x6f69('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6f69('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6f69('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6f69('0x4')](_0x6f69('0xd'),_0x6f69('0xe'),_0x6f69('0xf'),_0x6f69('0x10')),'defaultValue':_0x6f69('0xd')},'key':{'type':Sequelize[_0x6f69('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6f69('0x11')],'defaultValue':function(){return _0x6f69('0x12');}},'notificationSound':{'type':Sequelize[_0x6f69('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6f69('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6f69('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6f69('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6f69('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6f69('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3237fc){if(!_0x3237fc)this[_0x6f69('0x14')](_0x6f69('0x15'),null);this[_0x6f69('0x14')]('mandatoryDisposition',_0x3237fc);}}}; \ No newline at end of file +var _0x5cc4=['mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x9bb4e1,_0x3870c8){var _0x38b73e=function(_0x499f13){while(--_0x499f13){_0x9bb4e1['push'](_0x9bb4e1['shift']());}};_0x38b73e(++_0x3870c8);}(_0x5cc4,0xf3));var _0x45cc=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x5cc4[_0x2f0057];return _0x17f2c3;};'use strict';var Sequelize=require('sequelize');module[_0x45cc('0x0')]={'name':{'type':Sequelize[_0x45cc('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x45cc('0x1')]},'ecm':{'type':Sequelize[_0x45cc('0x2')](_0x45cc('0x3'),'no'),'defaultValue':_0x45cc('0x3')},'headerinfo':{'type':Sequelize[_0x45cc('0x1')],'defaultValue':_0x45cc('0x4')},'localstationid':{'type':Sequelize[_0x45cc('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x45cc('0x2')](_0x45cc('0x5'),_0x45cc('0x6'),_0x45cc('0x7'),_0x45cc('0x8'),'12000',_0x45cc('0x9')),'defaultValue':_0x45cc('0x6')},'maxrate':{'type':Sequelize[_0x45cc('0x2')](_0x45cc('0x5'),_0x45cc('0x6'),_0x45cc('0x7'),_0x45cc('0x8'),_0x45cc('0xa'),_0x45cc('0x9')),'defaultValue':_0x45cc('0x9')},'modem':{'type':Sequelize[_0x45cc('0x1')],'defaultValue':_0x45cc('0xb')},'gateway':{'type':Sequelize[_0x45cc('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x45cc('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x45cc('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x45cc('0x2')](_0x45cc('0xd'),_0x45cc('0xe'),_0x45cc('0xf'),_0x45cc('0x10')),'defaultValue':_0x45cc('0xd')},'key':{'type':Sequelize[_0x45cc('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x45cc('0x11')],'defaultValue':function(){return _0x45cc('0x12');}},'notificationSound':{'type':Sequelize[_0x45cc('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x45cc('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x45cc('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x45cc('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x45cc('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x45cc('0x14'),'set':function(_0x23d187){if(!_0x23d187)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x45cc('0x15'),_0x23d187);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index a1a3507..5c36ea9 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 _0xd517=['socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','FaxAccounts','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','FaxAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','Owner','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','FaxApplication','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','Answer','ecm','gateway','faxdetect','minrate','modem','push','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','Contacts','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','format','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0xfeb5d4,_0x211945){var _0x167b53=function(_0x10f15d){while(--_0x10f15d){_0xfeb5d4['push'](_0xfeb5d4['shift']());}};_0x167b53(++_0x211945);}(_0xd517,0xa6));var _0x7d51=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xd517[_0x5d4f12];return _0x4eb577;};'use strict';var emlformat=require(_0x7d51('0x0'));var rimraf=require(_0x7d51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7d51('0x2'));var moment=require(_0x7d51('0x3'));var BPromise=require(_0x7d51('0x4'));var Mustache=require(_0x7d51('0x5'));var util=require(_0x7d51('0x6'));var path=require(_0x7d51('0x7'));var sox=require('sox');var csv=require(_0x7d51('0x8'));var ejs=require(_0x7d51('0x9'));var fs=require('fs');var fs_extra=require(_0x7d51('0xa'));var _=require(_0x7d51('0xb'));var squel=require('squel');var crypto=require(_0x7d51('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7d51('0xd'));var toCsv=require(_0x7d51('0x8'));var querystring=require(_0x7d51('0xe'));var Papa=require(_0x7d51('0xf'));var Redis=require(_0x7d51('0x10'));var authService=require(_0x7d51('0x11'));var qs=require(_0x7d51('0x12'));var as=require(_0x7d51('0x13'));var hardwareService=require(_0x7d51('0x14'));var logger=require(_0x7d51('0x15'))(_0x7d51('0x16'));var utils=require(_0x7d51('0x17'));var config=require(_0x7d51('0x18'));var licenseUtil=require(_0x7d51('0x19'));var db=require(_0x7d51('0x1a'))['db'];config[_0x7d51('0x1b')]=_[_0x7d51('0x1c')](config[_0x7d51('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d51('0x1d'))(new Redis(config[_0x7d51('0x1b')]));require(_0x7d51('0x1e'))[_0x7d51('0x1f')](socket);var jayson=require(_0x7d51('0x20'));var client=jayson[_0x7d51('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x7d51('0x21')][_0x7d51('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x271fb5,_0x19e78a,_0x3ca3ba,_0x295f7a){return new BPromise(function(_0x28f3a0,_0x5b0352){var _0x5d4e20=_0x295f7a||client;return _0x5d4e20[_0x7d51('0x23')](_0x271fb5,_0x3ca3ba)['then'](function(_0x3b1146){logger[_0x7d51('0x24')](_0x7d51('0x25'),_0x19e78a,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x19e78a,_0x7d51('0x26'),JSON['stringify'](_0x3b1146));if(_0x3b1146[_0x7d51('0x27')]){if(_0x3b1146[_0x7d51('0x27')][_0x7d51('0x28')]===0x1f4){logger[_0x7d51('0x27')](_0x7d51('0x25'),_0x19e78a,_0x3b1146[_0x7d51('0x27')][_0x7d51('0x29')]);return _0x5b0352(_0x3b1146[_0x7d51('0x27')][_0x7d51('0x29')]);}logger['error'](_0x7d51('0x25'),_0x19e78a,_0x3b1146['error'][_0x7d51('0x29')]);return _0x28f3a0(_0x3b1146[_0x7d51('0x27')][_0x7d51('0x29')]);}else{logger[_0x7d51('0x24')]('FaxAccount,\x20%s,\x20%s',_0x19e78a,'request\x20sent');_0x28f3a0(_0x3b1146[_0x7d51('0x2a')][_0x7d51('0x29')]);}})[_0x7d51('0x2b')](function(_0x575d2a){logger[_0x7d51('0x27')](_0x7d51('0x25'),_0x19e78a,_0x575d2a);_0x5b0352(_0x575d2a);});});}function respondWithStatusCode(_0x31b52e,_0x22e413){_0x22e413=_0x22e413||0xcc;return function(_0x418b8b){if(_0x418b8b){return _0x31b52e['sendStatus'](_0x22e413);}return _0x31b52e[_0x7d51('0x2c')](_0x22e413)['end']();};}function respondWithResult(_0x11b807,_0x20f6d9){_0x20f6d9=_0x20f6d9||0xc8;return function(_0x335e85){if(_0x335e85){return _0x11b807[_0x7d51('0x2c')](_0x20f6d9)[_0x7d51('0x2d')](_0x335e85);}};}function respondWithFilteredResult(_0x5f43df,_0x42bcee){return function(_0x5b79c0){if(_0x5b79c0){var _0x377c55=typeof _0x42bcee[_0x7d51('0x2e')]===_0x7d51('0x2f')&&typeof _0x42bcee[_0x7d51('0x30')]===_0x7d51('0x2f');var _0x50eaef=_0x5b79c0[_0x7d51('0x31')];var _0x407bdf=_0x377c55?0x0:_0x42bcee['offset'];var _0xf40543=_0x377c55?_0x5b79c0[_0x7d51('0x31')]:_0x42bcee[_0x7d51('0x2e')]+_0x42bcee['limit'];var _0x408fc9;if(_0xf40543>=_0x50eaef){_0xf40543=_0x50eaef;_0x408fc9=0xc8;}else{_0x408fc9=0xce;}_0x5f43df[_0x7d51('0x2c')](_0x408fc9);return _0x5f43df[_0x7d51('0x32')](_0x7d51('0x33'),_0x407bdf+'-'+_0xf40543+'/'+_0x50eaef)['json'](_0x5b79c0);}return null;};}function patchUpdates(_0x1483a6){return function(_0x31aebf){try{jsonpatch['apply'](_0x31aebf,_0x1483a6,!![]);}catch(_0x23833c){return BPromise[_0x7d51('0x34')](_0x23833c);}return _0x31aebf[_0x7d51('0x35')]();};}function saveUpdates(_0x45ff6d,_0x4a7f4a){return function(_0x69bdb5){if(_0x69bdb5){return _0x69bdb5[_0x7d51('0x36')](_0x45ff6d)['then'](function(_0xf68665){return _0xf68665;});}return null;};}function removeEntity(_0x18321f,_0x52a104){return function(_0x363fe5){if(_0x363fe5){return _0x363fe5['destroy']()[_0x7d51('0x37')](function(){var _0x48734a=_0x363fe5[_0x7d51('0x38')]({'plain':!![]});var _0x406670=_0x7d51('0x39');return db[_0x7d51('0x3a')][_0x7d51('0x3b')]({'where':{'type':_0x406670,'resourceId':_0x48734a['id']}})[_0x7d51('0x37')](function(){return _0x363fe5;});})[_0x7d51('0x37')](function(){_0x18321f[_0x7d51('0x2c')](0xcc)[_0x7d51('0x3c')]();});}};}function handleEntityNotFound(_0x2e4e9d,_0x3ba6d9){return function(_0x552a0f){if(!_0x552a0f){_0x2e4e9d[_0x7d51('0x3d')](0x194);}return _0x552a0f;};}function handleError(_0x27a55c,_0x40cd03){_0x40cd03=_0x40cd03||0x1f4;return function(_0x382436){logger[_0x7d51('0x27')](_0x382436[_0x7d51('0x3e')]);if(_0x382436[_0x7d51('0x3f')]){delete _0x382436['name'];}_0x27a55c[_0x7d51('0x2c')](_0x40cd03)[_0x7d51('0x40')](_0x382436);};}exports[_0x7d51('0x41')]=function(_0x1da5a5,_0x4d8330){var _0xfa96c9={'include':[{'model':db[_0x7d51('0x42')],'as':_0x7d51('0x43')}]},_0x8cd4a2={},_0x48aeb7={'count':0x0,'rows':[]};var _0x50a7f7=_[_0x7d51('0x44')](db[_0x7d51('0x45')][_0x7d51('0x46')],function(_0x4352e5){return{'name':_0x4352e5['fieldName'],'type':_0x4352e5[_0x7d51('0x47')][_0x7d51('0x48')]};});_0x8cd4a2[_0x7d51('0x49')]=_['map'](_0x50a7f7,_0x7d51('0x3f'));_0x8cd4a2['query']=_[_0x7d51('0x4a')](_0x1da5a5[_0x7d51('0x4b')]);_0x8cd4a2[_0x7d51('0x4c')]=_[_0x7d51('0x4d')](_0x8cd4a2['model'],_0x8cd4a2[_0x7d51('0x4b')]);_0xfa96c9['attributes']=_[_0x7d51('0x4d')](_0x8cd4a2[_0x7d51('0x49')],qs[_0x7d51('0x4e')](_0x1da5a5[_0x7d51('0x4b')][_0x7d51('0x4e')]));_0xfa96c9[_0x7d51('0x4f')]=_0xfa96c9[_0x7d51('0x4f')]['length']?_0xfa96c9[_0x7d51('0x4f')]:_0x8cd4a2[_0x7d51('0x49')];if(!_0x1da5a5[_0x7d51('0x4b')][_0x7d51('0x50')](_0x7d51('0x51'))){_0xfa96c9[_0x7d51('0x30')]=qs[_0x7d51('0x30')](_0x1da5a5[_0x7d51('0x4b')]['limit']);_0xfa96c9['offset']=qs[_0x7d51('0x2e')](_0x1da5a5['query']['offset']);}_0xfa96c9[_0x7d51('0x52')]=qs['sort'](_0x1da5a5[_0x7d51('0x4b')][_0x7d51('0x53')]);_0xfa96c9[_0x7d51('0x54')]=qs[_0x7d51('0x4c')](_[_0x7d51('0x55')](_0x1da5a5[_0x7d51('0x4b')],_0x8cd4a2[_0x7d51('0x4c')]),_0x50a7f7);if(_0x1da5a5[_0x7d51('0x4b')][_0x7d51('0x56')]){_0xfa96c9[_0x7d51('0x54')]=_[_0x7d51('0x57')](_0xfa96c9[_0x7d51('0x54')],{'$or':_[_0x7d51('0x44')](_0x50a7f7,function(_0x52bf75){if(_0x52bf75[_0x7d51('0x47')]!=='VIRTUAL'){var _0x6ad6f6={};_0x6ad6f6[_0x52bf75[_0x7d51('0x3f')]]={'$like':'%'+_0x1da5a5[_0x7d51('0x4b')][_0x7d51('0x56')]+'%'};return _0x6ad6f6;}})});}_0xfa96c9=_[_0x7d51('0x57')]({},_0xfa96c9,_0x1da5a5[_0x7d51('0x58')]);var _0x1e641d={'where':_0xfa96c9[_0x7d51('0x54')]};return db['FaxAccount'][_0x7d51('0x31')](_0x1e641d)[_0x7d51('0x37')](function(_0x37cb50){_0x48aeb7[_0x7d51('0x31')]=_0x37cb50;if(_0x1da5a5[_0x7d51('0x4b')][_0x7d51('0x59')]){_0xfa96c9[_0x7d51('0x5a')]=[{'all':!![]}];}return db['FaxAccount'][_0x7d51('0x5b')](_0xfa96c9);})[_0x7d51('0x37')](function(_0x2b2ba8){_0x48aeb7[_0x7d51('0x5c')]=_0x2b2ba8;return _0x48aeb7;})[_0x7d51('0x37')](respondWithFilteredResult(_0x4d8330,_0xfa96c9))[_0x7d51('0x2b')](handleError(_0x4d8330,null));};exports['show']=function(_0x2b3c45,_0x3f4f86){var _0x2b528b={'raw':![],'where':{'id':_0x2b3c45[_0x7d51('0x5d')]['id']},'include':[{'model':db[_0x7d51('0x42')],'as':_0x7d51('0x43')}]},_0x577788={};_0x577788[_0x7d51('0x49')]=_[_0x7d51('0x4a')](db[_0x7d51('0x45')][_0x7d51('0x46')]);_0x577788['query']=_[_0x7d51('0x4a')](_0x2b3c45['query']);_0x577788[_0x7d51('0x4c')]=_[_0x7d51('0x4d')](_0x577788[_0x7d51('0x49')],_0x577788[_0x7d51('0x4b')]);_0x2b528b[_0x7d51('0x4f')]=_[_0x7d51('0x4d')](_0x577788[_0x7d51('0x49')],qs[_0x7d51('0x4e')](_0x2b3c45[_0x7d51('0x4b')]['fields']));_0x2b528b[_0x7d51('0x4f')]=_0x2b528b[_0x7d51('0x4f')][_0x7d51('0x5e')]?_0x2b528b['attributes']:_0x577788[_0x7d51('0x49')];if(_0x2b3c45[_0x7d51('0x4b')][_0x7d51('0x59')]){_0x2b528b[_0x7d51('0x5a')]=[{'all':!![]}];}_0x2b528b=_[_0x7d51('0x57')]({},_0x2b528b,_0x2b3c45[_0x7d51('0x58')]);return db[_0x7d51('0x45')][_0x7d51('0x5f')](_0x2b528b)[_0x7d51('0x37')](handleEntityNotFound(_0x3f4f86,null))[_0x7d51('0x37')](respondWithResult(_0x3f4f86,null))['catch'](handleError(_0x3f4f86,null));};exports[_0x7d51('0x60')]=function(_0x4f2ef8,_0x2394d5){return db[_0x7d51('0x45')][_0x7d51('0x60')](_0x4f2ef8[_0x7d51('0x61')],{})[_0x7d51('0x37')](function(_0x410701){var _0x18fc3e=_0x4f2ef8[_0x7d51('0x62')][_0x7d51('0x38')]({'plain':!![]});if(!_0x18fc3e)throw new Error(_0x7d51('0x63'));if(_0x18fc3e[_0x7d51('0x64')]===_0x7d51('0x62')){var _0x418ff6=_0x410701[_0x7d51('0x38')]({'plain':!![]});var _0x39a6a9='FaxAccounts';return db[_0x7d51('0x65')]['find']({'where':{'name':_0x39a6a9,'userProfileId':_0x18fc3e[_0x7d51('0x66')]},'raw':!![]})[_0x7d51('0x37')](function(_0x4b9d43){if(_0x4b9d43&&_0x4b9d43[_0x7d51('0x67')]===0x0){return db[_0x7d51('0x3a')][_0x7d51('0x60')]({'name':_0x418ff6[_0x7d51('0x3f')],'resourceId':_0x418ff6['id'],'type':_0x4b9d43['name'],'sectionId':_0x4b9d43['id']},{})['then'](function(){return _0x410701;});}else{return _0x410701;}})['catch'](function(_0x358f26){logger[_0x7d51('0x27')](_0x7d51('0x68'),_0x358f26);throw _0x358f26;});}return _0x410701;})[_0x7d51('0x37')](respondWithResult(_0x2394d5,0xc9))['catch'](handleError(_0x2394d5,null));};exports[_0x7d51('0x36')]=function(_0x4dacaa,_0x4510cf){if(_0x4dacaa['body']['id']){delete _0x4dacaa[_0x7d51('0x61')]['id'];}return db[_0x7d51('0x45')]['find']({'where':{'id':_0x4dacaa[_0x7d51('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x7d51('0x43')}]})[_0x7d51('0x37')](handleEntityNotFound(_0x4510cf,null))[_0x7d51('0x37')](saveUpdates(_0x4dacaa[_0x7d51('0x61')],null))[_0x7d51('0x37')](respondWithResult(_0x4510cf,null))[_0x7d51('0x2b')](handleError(_0x4510cf,null));};exports[_0x7d51('0x3b')]=function(_0x199290,_0x3d7e42){return db['FaxAccount'][_0x7d51('0x5f')]({'where':{'id':_0x199290[_0x7d51('0x5d')]['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0x3d7e42,null))[_0x7d51('0x37')](removeEntity(_0x3d7e42,null))[_0x7d51('0x2b')](handleError(_0x3d7e42,null));};exports[_0x7d51('0x69')]=function(_0x139599,_0xf44412){return db[_0x7d51('0x45')][_0x7d51('0x69')]()[_0x7d51('0x37')](respondWithResult(_0xf44412,null))['catch'](handleError(_0xf44412,null));};exports[_0x7d51('0x6a')]=function(_0x208de4,_0x3870f3,_0x4fa73d){if(_0x208de4[_0x7d51('0x61')]['id']){delete _0x208de4['body']['id'];}return db[_0x7d51('0x45')][_0x7d51('0x5f')]({'where':{'id':_0x208de4['params']['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0x3870f3,null))['then'](function(_0x46fbb5){if(_0x46fbb5){_0x208de4[_0x7d51('0x61')]['FaxAccountId']=_0x46fbb5['id'];return db['Disposition']['create'](_0x208de4[_0x7d51('0x61')]);}})['then'](respondWithResult(_0x3870f3,null))[_0x7d51('0x2b')](handleError(_0x3870f3,null));};exports[_0x7d51('0x6b')]=function(_0x16af7c,_0x3f40fa,_0x17e2fe){var _0x58a067={'raw':![],'where':{}};var _0x434dde={};var _0x32f01b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7d51('0x6c')]({'where':{'id':_0x16af7c['params']['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0x3f40fa,null))[_0x7d51('0x37')](function(_0x124d7e){if(_0x124d7e){_0x434dde['model']=_[_0x7d51('0x4a')](db[_0x7d51('0x6d')][_0x7d51('0x46')]);_0x434dde['query']=_[_0x7d51('0x4a')](_0x16af7c['query']);_0x434dde[_0x7d51('0x4c')]=_[_0x7d51('0x4d')](_0x434dde[_0x7d51('0x49')],_0x434dde[_0x7d51('0x4b')]);_0x58a067[_0x7d51('0x4f')]=_['intersection'](_0x434dde['model'],qs[_0x7d51('0x4e')](_0x16af7c[_0x7d51('0x4b')][_0x7d51('0x4e')]));_0x58a067[_0x7d51('0x4f')]=_0x58a067['attributes'][_0x7d51('0x5e')]?_0x58a067[_0x7d51('0x4f')]:_0x434dde[_0x7d51('0x49')];if(!_0x16af7c[_0x7d51('0x4b')]['hasOwnProperty'](_0x7d51('0x51'))){_0x58a067['limit']=qs[_0x7d51('0x30')](_0x16af7c[_0x7d51('0x4b')]['limit']);_0x58a067[_0x7d51('0x2e')]=qs['offset'](_0x16af7c['query'][_0x7d51('0x2e')]);}_0x58a067[_0x7d51('0x52')]=qs['sort'](_0x16af7c[_0x7d51('0x4b')]['sort']);_0x58a067[_0x7d51('0x54')]=qs[_0x7d51('0x4c')](_[_0x7d51('0x55')](_0x16af7c['query'],_0x434dde[_0x7d51('0x4c')]));_0x58a067['where'][_0x7d51('0x6e')]=_0x124d7e['id'];if(_0x16af7c[_0x7d51('0x4b')]['filter']){_0x58a067['where']=_[_0x7d51('0x57')](_0x58a067['where'],{'$or':_[_0x7d51('0x44')](_0x58a067[_0x7d51('0x4f')],function(_0x33c9b5){var _0x440943={};_0x440943[_0x33c9b5]={'$like':'%'+_0x16af7c[_0x7d51('0x4b')][_0x7d51('0x56')]+'%'};return _0x440943;})});}_0x58a067=_[_0x7d51('0x57')]({},_0x58a067,_0x16af7c[_0x7d51('0x58')]);return db[_0x7d51('0x6d')][_0x7d51('0x31')]({'where':_0x58a067['where']})[_0x7d51('0x37')](function(_0x42abb8){_0x32f01b[_0x7d51('0x31')]=_0x42abb8;if(_0x16af7c[_0x7d51('0x4b')][_0x7d51('0x59')]){_0x58a067[_0x7d51('0x5a')]=[{'all':!![]}];}return db[_0x7d51('0x6d')][_0x7d51('0x5b')](_0x58a067);})[_0x7d51('0x37')](function(_0x5b1208){_0x32f01b[_0x7d51('0x5c')]=_0x5b1208;return _0x32f01b;});}})[_0x7d51('0x37')](respondWithFilteredResult(_0x3f40fa,_0x58a067))[_0x7d51('0x2b')](handleError(_0x3f40fa,null));};exports[_0x7d51('0x6f')]=function(_0xc079b6,_0x23e3a0,_0x4fe8c2){return db[_0x7d51('0x45')]['find']({'where':{'id':_0xc079b6[_0x7d51('0x5d')]['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0x23e3a0,null))[_0x7d51('0x37')](function(_0x5d428f){if(_0x5d428f){return _0x5d428f[_0x7d51('0x6f')](_0xc079b6[_0x7d51('0x4b')][_0x7d51('0x70')]);}})[_0x7d51('0x37')](respondWithStatusCode(_0x23e3a0,null))[_0x7d51('0x2b')](handleError(_0x23e3a0,null));};exports['addAnswer']=function(_0x474053,_0x4cf822,_0x2488ba){if(_0x474053['body']['id']){delete _0x474053['body']['id'];}return db[_0x7d51('0x45')][_0x7d51('0x5f')]({'where':{'id':_0x474053[_0x7d51('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4cf822,null))[_0x7d51('0x37')](function(_0x3b6a6a){if(_0x3b6a6a){_0x474053[_0x7d51('0x61')][_0x7d51('0x6e')]=_0x3b6a6a['id'];return db[_0x7d51('0x71')][_0x7d51('0x60')](_0x474053[_0x7d51('0x61')]);}})[_0x7d51('0x37')](respondWithResult(_0x4cf822,null))['catch'](handleError(_0x4cf822,null));};exports[_0x7d51('0x72')]=function(_0x4e07d1,_0x2902e2,_0x395f0d){var _0x1f73d4={'raw':![],'where':{}};var _0x4a5661={};var _0x42a0f2={'count':0x0,'rows':[]};return db[_0x7d51('0x45')]['findOne']({'where':{'id':_0x4e07d1[_0x7d51('0x5d')]['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0x2902e2,null))[_0x7d51('0x37')](function(_0xa19cb6){if(_0xa19cb6){_0x4a5661['model']=_[_0x7d51('0x4a')](db[_0x7d51('0x71')][_0x7d51('0x46')]);_0x4a5661[_0x7d51('0x4b')]=_[_0x7d51('0x4a')](_0x4e07d1[_0x7d51('0x4b')]);_0x4a5661[_0x7d51('0x4c')]=_['intersection'](_0x4a5661[_0x7d51('0x49')],_0x4a5661[_0x7d51('0x4b')]);_0x1f73d4[_0x7d51('0x4f')]=_['intersection'](_0x4a5661[_0x7d51('0x49')],qs[_0x7d51('0x4e')](_0x4e07d1[_0x7d51('0x4b')][_0x7d51('0x4e')]));_0x1f73d4[_0x7d51('0x4f')]=_0x1f73d4[_0x7d51('0x4f')][_0x7d51('0x5e')]?_0x1f73d4[_0x7d51('0x4f')]:_0x4a5661[_0x7d51('0x49')];if(!_0x4e07d1[_0x7d51('0x4b')][_0x7d51('0x50')](_0x7d51('0x51'))){_0x1f73d4['limit']=qs[_0x7d51('0x30')](_0x4e07d1[_0x7d51('0x4b')][_0x7d51('0x30')]);_0x1f73d4['offset']=qs[_0x7d51('0x2e')](_0x4e07d1[_0x7d51('0x4b')][_0x7d51('0x2e')]);}_0x1f73d4[_0x7d51('0x52')]=qs['sort'](_0x4e07d1[_0x7d51('0x4b')]['sort']);_0x1f73d4[_0x7d51('0x54')]=qs[_0x7d51('0x4c')](_[_0x7d51('0x55')](_0x4e07d1[_0x7d51('0x4b')],_0x4a5661['filters']));_0x1f73d4[_0x7d51('0x54')][_0x7d51('0x6e')]=_0xa19cb6['id'];if(_0x4e07d1[_0x7d51('0x4b')][_0x7d51('0x56')]){_0x1f73d4['where']=_['merge'](_0x1f73d4[_0x7d51('0x54')],{'$or':_[_0x7d51('0x44')](_0x1f73d4['attributes'],function(_0x4ef9fd){var _0x5f0f2b={};_0x5f0f2b[_0x4ef9fd]={'$like':'%'+_0x4e07d1['query'][_0x7d51('0x56')]+'%'};return _0x5f0f2b;})});}_0x1f73d4=_[_0x7d51('0x57')]({},_0x1f73d4,_0x4e07d1[_0x7d51('0x58')]);return db['CannedAnswer'][_0x7d51('0x31')]({'where':_0x1f73d4[_0x7d51('0x54')]})['then'](function(_0x3d7e68){_0x42a0f2[_0x7d51('0x31')]=_0x3d7e68;if(_0x4e07d1[_0x7d51('0x4b')][_0x7d51('0x59')]){_0x1f73d4[_0x7d51('0x5a')]=[{'all':!![]}];}return db[_0x7d51('0x71')][_0x7d51('0x5b')](_0x1f73d4);})[_0x7d51('0x37')](function(_0x426eba){_0x42a0f2['rows']=_0x426eba;return _0x42a0f2;});}})['then'](respondWithFilteredResult(_0x2902e2,_0x1f73d4))[_0x7d51('0x2b')](handleError(_0x2902e2,null));};exports[_0x7d51('0x73')]=function(_0x129703,_0x108753,_0x2f6e96){return db[_0x7d51('0x45')]['find']({'where':{'id':_0x129703[_0x7d51('0x5d')]['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0x108753,null))[_0x7d51('0x37')](function(_0x33d0e6){if(_0x33d0e6){return _0x33d0e6[_0x7d51('0x73')](_0x129703[_0x7d51('0x4b')][_0x7d51('0x70')]);}})[_0x7d51('0x37')](respondWithStatusCode(_0x108753,null))[_0x7d51('0x2b')](handleError(_0x108753,null));};exports[_0x7d51('0x74')]=function(_0x2c04c9,_0x3fe16b,_0x21f4d5){return db[_0x7d51('0x75')][_0x7d51('0x5f')]({'where':{'id':_0x2c04c9['params']['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0x3fe16b,null))[_0x7d51('0x37')](function(_0x324991){if(_0x324991){return _0x324991[_0x7d51('0x74')](_0x2c04c9[_0x7d51('0x61')]['ids'],_['omit'](_0x2c04c9[_0x7d51('0x61')],[_0x7d51('0x70'),'id'])||{});}})[_0x7d51('0x37')](respondWithResult(_0x3fe16b,null))[_0x7d51('0x2b')](handleError(_0x3fe16b,null));};exports[_0x7d51('0x76')]=function(_0x1f19ff,_0x5a6c06,_0x20caad){var _0x12496c={'raw':![],'where':{}};var _0x16fbca={};var _0x27663e={'count':0x0,'rows':[]};return db[_0x7d51('0x45')][_0x7d51('0x6c')]({'where':{'id':_0x1f19ff[_0x7d51('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5a6c06,null))[_0x7d51('0x37')](function(_0x3d92fb){if(_0x3d92fb){_0x16fbca[_0x7d51('0x49')]=_[_0x7d51('0x4a')](db[_0x7d51('0x75')][_0x7d51('0x46')]);_0x16fbca[_0x7d51('0x4b')]=_[_0x7d51('0x4a')](_0x1f19ff[_0x7d51('0x4b')]);_0x16fbca[_0x7d51('0x4c')]=_[_0x7d51('0x4d')](_0x16fbca[_0x7d51('0x49')],_0x16fbca[_0x7d51('0x4b')]);_0x12496c[_0x7d51('0x4f')]=_[_0x7d51('0x4d')](_0x16fbca['model'],qs['fields'](_0x1f19ff[_0x7d51('0x4b')][_0x7d51('0x4e')]));_0x12496c[_0x7d51('0x4f')]=_0x12496c[_0x7d51('0x4f')][_0x7d51('0x5e')]?_0x12496c[_0x7d51('0x4f')]:_0x16fbca[_0x7d51('0x49')];if(!_0x1f19ff[_0x7d51('0x4b')][_0x7d51('0x50')](_0x7d51('0x51'))){_0x12496c[_0x7d51('0x30')]=qs['limit'](_0x1f19ff[_0x7d51('0x4b')]['limit']);_0x12496c[_0x7d51('0x2e')]=qs['offset'](_0x1f19ff[_0x7d51('0x4b')][_0x7d51('0x2e')]);}_0x12496c[_0x7d51('0x52')]=qs[_0x7d51('0x53')](_0x1f19ff[_0x7d51('0x4b')][_0x7d51('0x53')]);_0x12496c[_0x7d51('0x54')]=qs[_0x7d51('0x4c')](_['pick'](_0x1f19ff[_0x7d51('0x4b')],_0x16fbca[_0x7d51('0x4c')]));_0x12496c['where']['FaxAccountId']=_0x3d92fb['id'];if(_0x1f19ff['query'][_0x7d51('0x56')]){_0x12496c[_0x7d51('0x54')]=_[_0x7d51('0x57')](_0x12496c[_0x7d51('0x54')],{'$or':_['map'](_0x12496c[_0x7d51('0x4f')],function(_0x3357a8){var _0x4c4f11={};_0x4c4f11[_0x3357a8]={'$like':'%'+_0x1f19ff[_0x7d51('0x4b')][_0x7d51('0x56')]+'%'};return _0x4c4f11;})});}_0x12496c=_[_0x7d51('0x57')]({},_0x12496c,_0x1f19ff[_0x7d51('0x58')]);return db[_0x7d51('0x75')]['count']({'where':_0x12496c[_0x7d51('0x54')]})[_0x7d51('0x37')](function(_0x116438){_0x27663e[_0x7d51('0x31')]=_0x116438;if(_0x1f19ff['query'][_0x7d51('0x59')]){_0x12496c[_0x7d51('0x5a')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x7d51('0x77'),'attributes':[_0x7d51('0x3f'),'fullname','internal'],'required':![]},{'model':db[_0x7d51('0x78')],'as':_0x7d51('0x79'),'attributes':['id',_0x7d51('0x3f'),_0x7d51('0x7a')],'where':_0x1f19ff['query'][_0x7d51('0x7b')]?{'id':_0x1f19ff['query'][_0x7d51('0x7b')]}:undefined,'required':_0x1f19ff[_0x7d51('0x4b')][_0x7d51('0x7b')]?!![]:![]}];}return db[_0x7d51('0x75')]['findAll'](_0x12496c);})[_0x7d51('0x37')](function(_0x216130){_0x27663e[_0x7d51('0x5c')]=_0x216130;return _0x27663e;});}})[_0x7d51('0x37')](respondWithFilteredResult(_0x5a6c06,_0x12496c))[_0x7d51('0x2b')](handleError(_0x5a6c06,null));};exports['addApplications']=function(_0x19947f,_0x4a91ce){var _0x661cac=_0x19947f[_0x7d51('0x5d')]['id'];var _0x20ee59=_0x19947f['body'];var _0x47c5f7=0xc8;var _0x3b76c3=null;return db[_0x7d51('0x7c')][_0x7d51('0x7d')]({'isolationLevel':db[_0x7d51('0x7c')][_0x7d51('0x7e')][_0x7d51('0x7f')][_0x7d51('0x80')]},function(_0xae60bd){return db[_0x7d51('0x45')][_0x7d51('0x6c')]({'where':{'id':_0x661cac},'transaction':_0xae60bd})[_0x7d51('0x37')](function(_0x1c1bc1){if(_0x1c1bc1){return db['FaxApplication'][_0x7d51('0x3b')]({'where':{'FaxAccountId':_0x661cac},'transaction':_0xae60bd})[_0x7d51('0x37')](function(){var _0x597d2e=_[_0x7d51('0x44')](_0x20ee59,function(_0x23b84a){_0x23b84a[_0x7d51('0x6e')]=_0x661cac;return _0x23b84a;});return db['FaxApplication'][_0x7d51('0x81')](_0x597d2e,{'transaction':_0xae60bd});});}else{_0x47c5f7=0x194;_0x3b76c3=[];}});})[_0x7d51('0x37')](function(){if(_0x47c5f7!==0x194){return db[_0x7d51('0x82')][_0x7d51('0x83')]({'where':{'FaxAccountId':_0x661cac},'order':_0x7d51('0x84')})['then'](function(_0x393218){_0x3b76c3=_0x393218;});}})[_0x7d51('0x2b')](function(_0x3e80fa){_0x47c5f7=0x1f4;logger['error'](_0x3e80fa[_0x7d51('0x3e')]);if(_0x3e80fa[_0x7d51('0x3f')]){delete _0x3e80fa[_0x7d51('0x3f')];}_0x3b76c3=_0x3e80fa;})[_0x7d51('0x85')](function(){if(_0x3b76c3===null){_0x4a91ce[_0x7d51('0x3d')](_0x47c5f7);}else{if(_0x47c5f7===0x1f4){_0x4a91ce['status'](_0x47c5f7)[_0x7d51('0x40')](_0x3b76c3);}else{_0x4a91ce[_0x7d51('0x2c')](_0x47c5f7)[_0x7d51('0x2d')](_0x3b76c3);}}});};exports[_0x7d51('0x86')]=function(_0x30b6fe,_0x3f170f,_0x4dccd2){var _0x195304={};var _0x55a034={};var _0x13787c;var _0x5d5101;return db['FaxAccount'][_0x7d51('0x6c')]({'where':{'id':_0x30b6fe[_0x7d51('0x5d')]['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0x3f170f,null))['then'](function(_0x304af3){if(_0x304af3){_0x13787c=_0x304af3;_0x55a034[_0x7d51('0x49')]=_[_0x7d51('0x4a')](db[_0x7d51('0x82')][_0x7d51('0x46')]);_0x55a034['query']=_['keys'](_0x30b6fe['query']);_0x55a034['filters']=_[_0x7d51('0x4d')](_0x55a034[_0x7d51('0x49')],_0x55a034[_0x7d51('0x4b')]);_0x195304[_0x7d51('0x4f')]=_[_0x7d51('0x4d')](_0x55a034['model'],qs['fields'](_0x30b6fe[_0x7d51('0x4b')]['fields']));_0x195304[_0x7d51('0x4f')]=_0x195304[_0x7d51('0x4f')][_0x7d51('0x5e')]?_0x195304['attributes']:_0x55a034[_0x7d51('0x49')];_0x195304[_0x7d51('0x52')]=qs[_0x7d51('0x53')](_0x30b6fe[_0x7d51('0x4b')][_0x7d51('0x53')]);_0x195304[_0x7d51('0x54')]=qs['filters'](_[_0x7d51('0x55')](_0x30b6fe['query'],_0x55a034[_0x7d51('0x4c')]));if(_0x30b6fe[_0x7d51('0x4b')]['filter']){_0x195304[_0x7d51('0x54')]=_[_0x7d51('0x57')](_0x195304[_0x7d51('0x54')],{'$or':_[_0x7d51('0x44')](_0x195304[_0x7d51('0x4f')],function(_0x350676){var _0x2bfbdb={};_0x2bfbdb[_0x350676]={'$like':'%'+_0x30b6fe['query'][_0x7d51('0x56')]+'%'};return _0x2bfbdb;})});}_0x195304=_[_0x7d51('0x57')]({},_0x195304,_0x30b6fe[_0x7d51('0x58')]);return _0x13787c[_0x7d51('0x86')](_0x195304);}})[_0x7d51('0x37')](function(_0x12bd4f){if(_0x12bd4f){_0x5d5101=_0x12bd4f[_0x7d51('0x5e')];if(!_0x30b6fe['query'][_0x7d51('0x50')]('nolimit')){_0x195304[_0x7d51('0x30')]=qs[_0x7d51('0x30')](_0x30b6fe['query'][_0x7d51('0x30')]);_0x195304[_0x7d51('0x2e')]=qs['offset'](_0x30b6fe[_0x7d51('0x4b')][_0x7d51('0x2e')]);}return _0x13787c[_0x7d51('0x86')](_0x195304);}})[_0x7d51('0x37')](function(_0x12800e){if(_0x12800e){return _0x12800e?{'count':_0x5d5101,'rows':_0x12800e}:null;}})[_0x7d51('0x37')](respondWithResult(_0x3f170f,null))['catch'](handleError(_0x3f170f,null));};function Extension(_0x2d1617,_0x47f1c4,_0x14322d,_0x505829){this[_0x7d51('0x87')]=_0x7d51('0x88');this[_0x7d51('0x89')]=_0x2d1617[_0x7d51('0x8a')];this['app']=_0x505829;this[_0x7d51('0x47')]=_0x7d51('0x8b');this[_0x7d51('0x8c')]=_0x7d51('0x8d');this[_0x7d51('0x6e')]=_0x2d1617['id'];this[_0x7d51('0x84')]=_0x47f1c4;this['appdata']=_0x14322d;}function createExtensionsReciveFax(_0x37aee6){var _0x2482a9=0x1;var _0x2b3b85=[];_0x2b3b85['push'](new Extension(_0x37aee6,_0x2482a9,'',_0x7d51('0x8e')));_0x2482a9+=0x1;_0x2b3b85['push'](new Extension(_0x37aee6,_0x2482a9,'CDR(type)=inbound-fax','Set'));_0x2482a9+=0x1;for(var _0x65ce59 in _0x37aee6){if(_0x37aee6['hasOwnProperty'](_0x65ce59)&&(_0x65ce59===_0x7d51('0x8f')||_0x65ce59===_0x7d51('0x8a')||_0x65ce59===_0x7d51('0x90')||_0x65ce59===_0x7d51('0x91')||_0x65ce59==='headerinfo'||_0x65ce59==='maxrate'||_0x65ce59===_0x7d51('0x92')||_0x65ce59===_0x7d51('0x93')||_0x65ce59==='t38timeout')){_0x2b3b85[_0x7d51('0x94')](new Extension(_0x37aee6,_0x2482a9,'FAXOPT('+_0x65ce59+')='+_0x37aee6[_0x65ce59],_0x7d51('0x95')));_0x2482a9+=0x1;}}_0x2b3b85[_0x7d51('0x94')](new Extension(_0x37aee6,_0x2482a9,'6',_0x7d51('0x96')));_0x2482a9+=0x1;_0x2b3b85['push'](new Extension(_0x37aee6,_0x2482a9,_0x7d51('0x97'),'ReceiveFax'));_0x2482a9=0x0;return _0x2b3b85;}exports[_0x7d51('0x98')]=function(_0x18fc82,_0x491c5c,_0x1df8ac){var _0x4a0687;return db[_0x7d51('0x7c')][_0x7d51('0x7d')](function(_0x1d758c){return db[_0x7d51('0x45')]['create'](_0x18fc82[_0x7d51('0x61')],{'transaction':_0x1d758c})[_0x7d51('0x37')](function(_0x3d870c){_0x4a0687=_0x3d870c[_0x7d51('0x38')]({'plain':!![]});return db[_0x7d51('0x99')][_0x7d51('0x81')](createExtensionsReciveFax(_0x4a0687),{'transaction':_0x1d758c});});})[_0x7d51('0x37')](function(){return _0x4a0687;})[_0x7d51('0x37')](respondWithResult(_0x491c5c,null))[_0x7d51('0x2b')](handleError(_0x491c5c,null));};exports[_0x7d51('0x9a')]=function(_0x2a4532,_0x8b5663,_0x273f32){var _0x1891c2;return db[_0x7d51('0x7c')][_0x7d51('0x7d')](function(_0x7764e8){return db['FaxAccount'][_0x7d51('0x36')](_0x2a4532['body'],{'where':{'id':_0x2a4532[_0x7d51('0x61')]['id']},'transaction':_0x7764e8})[_0x7d51('0x37')](function(_0x76d1d4){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x2a4532[_0x7d51('0x61')]['id']},'transaction':_0x7764e8})['then'](function(_0x5eda95){return db['VoiceExtension'][_0x7d51('0x81')](createExtensionsReciveFax(_['omit'](_0x2a4532['body'],[_0x7d51('0x9b'),_0x7d51('0x48'),_0x7d51('0x9c'),_0x7d51('0x9d'),'TrunkId',_0x7d51('0x9e')])),{'transaction':_0x7764e8});});});})[_0x7d51('0x37')](function(){return db[_0x7d51('0x45')]['findById'](_0x2a4532[_0x7d51('0x61')]['id']);})['then'](respondWithResult(_0x8b5663,null))[_0x7d51('0x2b')](handleError(_0x8b5663,null));};exports[_0x7d51('0x9f')]=function(_0x443475,_0x2dad70,_0x3f8cd2){var _0x21dbe5={'raw':!![],'where':{}};var _0x1c9412={};var _0x50c258={'count':0x0,'rows':[]};return db[_0x7d51('0x45')][_0x7d51('0x6c')]({'where':{'id':_0x443475[_0x7d51('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2dad70,null))[_0x7d51('0x37')](function(_0x4f07ec){if(_0x4f07ec){_0x1c9412[_0x7d51('0x49')]=_[_0x7d51('0x4a')](db[_0x7d51('0xa0')][_0x7d51('0x46')]);_0x1c9412[_0x7d51('0x4b')]=_['keys'](_0x443475[_0x7d51('0x4b')]);_0x1c9412['filters']=_[_0x7d51('0x4d')](_0x1c9412[_0x7d51('0x49')],_0x1c9412['query']);_0x21dbe5[_0x7d51('0x4f')]=_[_0x7d51('0x4d')](_0x1c9412['model'],qs['fields'](_0x443475[_0x7d51('0x4b')][_0x7d51('0x4e')]));_0x21dbe5[_0x7d51('0x4f')]=_0x21dbe5['attributes'][_0x7d51('0x5e')]?_0x21dbe5[_0x7d51('0x4f')]:_0x1c9412[_0x7d51('0x49')];if(!_0x443475['query'][_0x7d51('0x50')]('nolimit')){_0x21dbe5[_0x7d51('0x30')]=qs[_0x7d51('0x30')](_0x443475[_0x7d51('0x4b')][_0x7d51('0x30')]);_0x21dbe5[_0x7d51('0x2e')]=qs['offset'](_0x443475[_0x7d51('0x4b')]['offset']);}_0x21dbe5['order']=qs[_0x7d51('0x53')](_0x443475[_0x7d51('0x4b')]['sort']);_0x21dbe5[_0x7d51('0x54')]=qs[_0x7d51('0x4c')](_['pick'](_0x443475[_0x7d51('0x4b')],_0x1c9412[_0x7d51('0x4c')]));_0x21dbe5[_0x7d51('0x54')][_0x7d51('0x6e')]=_0x4f07ec['id'];if(_0x443475[_0x7d51('0x4b')]['filter']){_0x21dbe5[_0x7d51('0x54')]=_[_0x7d51('0x57')](_0x21dbe5[_0x7d51('0x54')],{'$or':_['map'](_0x21dbe5[_0x7d51('0x4f')],function(_0x4bfdf9){var _0x2d6b0f={};_0x2d6b0f[_0x4bfdf9]={'$like':'%'+_0x443475[_0x7d51('0x4b')][_0x7d51('0x56')]+'%'};return _0x2d6b0f;})});}if(_0x443475[_0x7d51('0x4b')]['$gte']){var _0x44a554=_0x443475['query'][_0x7d51('0xa1')]['split'](',');var _0xc8a3f5={};_0xc8a3f5[_0x44a554[0x0]]={'$gte':moment(_0x44a554[0x1])['format'](_0x7d51('0xa2'))};_0x21dbe5[_0x7d51('0x54')]=_[_0x7d51('0x57')](_0x21dbe5['where'],_0xc8a3f5);}_0x21dbe5=_['merge']({},_0x21dbe5,_0x443475[_0x7d51('0x58')]);return db[_0x7d51('0xa0')][_0x7d51('0x31')]({'where':_0x21dbe5[_0x7d51('0x54')]})[_0x7d51('0x37')](function(_0x4e6d5c){_0x50c258['count']=_0x4e6d5c;if(_0x443475[_0x7d51('0x4b')]['includeAll']){_0x21dbe5[_0x7d51('0x5a')]=[{'all':!![]}];}return db[_0x7d51('0xa0')]['findAll'](_0x21dbe5);})[_0x7d51('0x37')](function(_0x26a22e){_0x50c258[_0x7d51('0x5c')]=_0x26a22e;return _0x50c258;});}})['then'](respondWithFilteredResult(_0x2dad70,_0x21dbe5))[_0x7d51('0x2b')](handleError(_0x2dad70,null));};exports[_0x7d51('0x40')]=function(_0x58dd3d,_0x3e583d,_0x331c9f){var _0xa78dd8,_0x5e5a35={},_0x2e25a8;if(_0x58dd3d[_0x7d51('0x61')]['to']){_0x2e25a8=_0x58dd3d[_0x7d51('0x61')]['to'][0x0];}return db['FaxAccount'][_0x7d51('0x5f')]({'where':{'id':_0x58dd3d[_0x7d51('0x5d')]['id']},'include':[{'model':db[_0x7d51('0xa3')],'as':'List','include':[{'model':db[_0x7d51('0xa4')],'as':_0x7d51('0xa5'),'where':{'fax':_0x2e25a8},'limit':0x1,'order':[[_0x7d51('0x9d'),_0x7d51('0xa6')]]}]}]})[_0x7d51('0x37')](handleEntityNotFound(_0x3e583d,null))[_0x7d51('0x37')](function(_0x36820b){_0xa78dd8=_0x36820b;if(_0x58dd3d['body'][_0x7d51('0xa7')]&&_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xa7')]['length']){for(var _0x41f0a5=0x0;_0x41f0a5<_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xa7')][_0x7d51('0x5e')];_0x41f0a5+=0x1){_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xa7')][_0x41f0a5]={'filename':_0x58dd3d['body'][_0x7d51('0xa7')][_0x41f0a5][_0x7d51('0x3f')],'id':_0x58dd3d['body'][_0x7d51('0xa7')][_0x41f0a5]['id'],'path':path[_0x7d51('0xa8')](config['root'],_0x7d51('0xa9'),_0x58dd3d['body'][_0x7d51('0xa7')][_0x41f0a5]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x7d51('0xaa'),{'FaxAccountId':_[_0x7d51('0xab')](_0x58dd3d[_0x7d51('0x5d')]['id'])?undefined:_0x58dd3d['params']['id'],'path':_['isNil'](_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xa7')][0x0][_0x7d51('0x7')])?undefined:_0x58dd3d['body'][_0x7d51('0xa7')][0x0][_0x7d51('0x7')],'fax':_['isNil'](_0x58dd3d[_0x7d51('0x61')]['to'][0x0])?undefined:_0x58dd3d[_0x7d51('0x61')]['to'][0x0]},client9002);})['then'](function(){if(_0xa78dd8){if(_[_0x7d51('0xab')](_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xac')])){_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xac')]=util[_0x7d51('0xad')]('\x22%s\x22\x20<%s>',_0xa78dd8[_0x7d51('0x3f')],_0xa78dd8[_0x7d51('0xae')]);}if(_0xa78dd8['List']){if(_0xa78dd8['List'][_0x7d51('0xa5')][_0x7d51('0x5e')]){return _0xa78dd8[_0x7d51('0xaf')]['Contacts'][0x0];}else{return db[_0x7d51('0xa4')]['create'](_[_0x7d51('0x1c')](_0x58dd3d[_0x7d51('0x61')],{'firstName':_0x58dd3d[_0x7d51('0x61')]['to'][0x0],'phone':_0x58dd3d[_0x7d51('0x61')]['to'][0x0],'fax':_0x58dd3d[_0x7d51('0x61')]['to'][0x0],'ListId':_0xa78dd8[_0x7d51('0x9e')]}));}}else{throw new Error(_0x7d51('0xb0'));}}else{throw new Error(_0x7d51('0xb1'));}})[_0x7d51('0x37')](function(_0x516788){if(_0x516788){return db[_0x7d51('0x75')][_0x7d51('0x5f')]({'where':{'ContactId':_0x516788['id'],'closed':![],'FaxAccountId':_0xa78dd8['id']}})[_0x7d51('0x37')](function(_0x429764){if(_0x429764){return[_0x429764,![]];}return db[_0x7d51('0x75')][_0x7d51('0x60')]({'UserId':_0x58dd3d[_0x7d51('0x62')]['id'],'ContactId':_0x516788['id'],'FaxAccountId':_0xa78dd8['id'],'fax':_0x58dd3d[_0x7d51('0x61')]['to'][0x0],'firstMsgDirection':_0x7d51('0xb2'),'Messages':[_[_0x7d51('0x57')](_0x58dd3d[_0x7d51('0x61')],{'read':![],'body':_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xa7')][0x0][_0x7d51('0xb3')],'FaxAccountId':_0xa78dd8['id'],'UserId':_0x58dd3d[_0x7d51('0x62')]['id'],'ContactId':_0x516788['id'],'AttachmentId':_0x58dd3d['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x7d51('0xa0')],'as':_0x7d51('0xb4')}]})[_0x7d51('0x37')](function(_0x47aa7f){return[_0x47aa7f,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2fea5d,_0x2ad268){if(_0x2ad268){return _0x2fea5d;}return db[_0x7d51('0xa0')][_0x7d51('0x60')]({'direction':_0x7d51('0xb2'),'read':![],'body':_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xa7')][0x0][_0x7d51('0xb3')],'FaxAccountId':_0xa78dd8['id'],'FaxInteractionId':_0x2fea5d['id'],'UserId':_0x58dd3d[_0x7d51('0x62')]['id'],'ContactId':_0x2fea5d[_0x7d51('0xb5')],'AttachmentId':_0x58dd3d['body'][_0x7d51('0xa7')][0x0]['id']})[_0x7d51('0x37')](function(_0x5b7d81){_0x2fea5d['dataValues'][_0x7d51('0xb4')]=[];_0x2fea5d['dataValues'][_0x7d51('0xb4')][_0x7d51('0x94')](_0x5b7d81[_0x7d51('0xb6')]);return _0x2fea5d;});})['then'](function(_0x5def74){respondWithRpcPromise(_0x7d51('0xb7'),_0x7d51('0xb7'),{'FaxAccountId':_['isNil'](_0x58dd3d['params']['id'])?undefined:_0x58dd3d[_0x7d51('0x5d')]['id'],'path':_[_0x7d51('0xab')](_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xa7')][0x0]['path'])?undefined:_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xa7')][0x0]['path'],'fax':_['isNil'](_0x58dd3d[_0x7d51('0x61')]['to'][0x0])?undefined:_0x58dd3d[_0x7d51('0x61')]['to'][0x0],'AttachmentId':_0x58dd3d[_0x7d51('0x61')][_0x7d51('0xa7')][0x0]['id']},client9002)[_0x7d51('0x37')](function(_0x14bd02){logger[_0x7d51('0x24')](_0x7d51('0xb8'),_0x14bd02);})[_0x7d51('0x2b')](function(_0x21bb53){logger[_0x7d51('0x24')](_0x7d51('0xb8'),_0x21bb53);});return _0x5def74;})[_0x7d51('0x37')](respondWithResult(_0x3e583d,null))[_0x7d51('0x2b')](handleError(_0x3e583d,null));};exports[_0x7d51('0xb9')]=function(_0x2b2c6e,_0xd2f005,_0x538eca){return db['FaxAccount'][_0x7d51('0x5f')]({'where':{'id':_0x2b2c6e[_0x7d51('0x5d')]['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0xd2f005,null))[_0x7d51('0x37')](function(_0x4181ff){if(_0x4181ff){return _0x4181ff[_0x7d51('0xb9')](_0x2b2c6e['body'][_0x7d51('0x70')],_[_0x7d51('0xba')](_0x2b2c6e[_0x7d51('0x61')],[_0x7d51('0x70'),'id'])||{})[_0x7d51('0xbb')](function(_0x1dca61){for(var _0x31315e=0x0;_0x31315e<_0x2b2c6e[_0x7d51('0x61')][_0x7d51('0x70')][_0x7d51('0x5e')];_0x31315e+=0x1){socket[_0x7d51('0xbc')](_0x7d51('0xbd'),{'UserId':Number(_0x2b2c6e[_0x7d51('0x61')][_0x7d51('0x70')][_0x31315e]),'FaxAccountId':Number(_0x2b2c6e[_0x7d51('0x5d')]['id'])});}return _0x1dca61;});}})[_0x7d51('0x37')](respondWithResult(_0xd2f005,null))[_0x7d51('0x2b')](handleError(_0xd2f005,null));};exports[_0x7d51('0xbe')]=function(_0xf01633,_0x21e2a8,_0x101749){return db[_0x7d51('0x45')][_0x7d51('0x5f')]({'where':{'id':_0xf01633[_0x7d51('0x5d')]['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0x21e2a8,null))[_0x7d51('0x37')](function(_0x5dbf6f){if(_0x5dbf6f){return _0x5dbf6f[_0x7d51('0xbe')](_0xf01633['query'][_0x7d51('0x70')])[_0x7d51('0x37')](function(){if(_[_0x7d51('0xbf')](_0xf01633[_0x7d51('0x4b')][_0x7d51('0x70')])){for(var _0x1a3bc6=0x0;_0x1a3bc6<_0xf01633['query'][_0x7d51('0x70')]['length'];_0x1a3bc6+=0x1){socket[_0x7d51('0xbc')](_0x7d51('0xc0'),{'UserId':Number(_0xf01633[_0x7d51('0x4b')]['ids'][_0x1a3bc6]),'FaxAccountId':Number(_0xf01633['params']['id'])});}}else{socket[_0x7d51('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0xf01633[_0x7d51('0x4b')]['ids']),'FaxAccountId':Number(_0xf01633[_0x7d51('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x21e2a8,null))[_0x7d51('0x2b')](handleError(_0x21e2a8,null));};exports[_0x7d51('0xc1')]=function(_0x4b2a28,_0x37f327,_0x1215d3){var _0x55424e={};var _0x5aabd1={};var _0x4dd436;var _0x19b346;return db[_0x7d51('0x45')][_0x7d51('0x6c')]({'where':{'id':_0x4b2a28[_0x7d51('0x5d')]['id']}})[_0x7d51('0x37')](handleEntityNotFound(_0x37f327,null))['then'](function(_0x1d75b0){if(_0x1d75b0){_0x4dd436=_0x1d75b0;_0x5aabd1[_0x7d51('0x49')]=_['keys'](db[_0x7d51('0xc2')][_0x7d51('0x46')]);_0x5aabd1['query']=_[_0x7d51('0x4a')](_0x4b2a28[_0x7d51('0x4b')]);_0x5aabd1[_0x7d51('0x4c')]=_['intersection'](_0x5aabd1[_0x7d51('0x49')],_0x5aabd1[_0x7d51('0x4b')]);_0x55424e[_0x7d51('0x4f')]=_['intersection'](_0x5aabd1[_0x7d51('0x49')],qs['fields'](_0x4b2a28[_0x7d51('0x4b')][_0x7d51('0x4e')]));_0x55424e[_0x7d51('0x4f')]=_0x55424e[_0x7d51('0x4f')]['length']?_0x55424e[_0x7d51('0x4f')]:_0x5aabd1[_0x7d51('0x49')];_0x55424e[_0x7d51('0x52')]=qs[_0x7d51('0x53')](_0x4b2a28[_0x7d51('0x4b')]['sort']);_0x55424e[_0x7d51('0x54')]=qs[_0x7d51('0x4c')](_[_0x7d51('0x55')](_0x4b2a28[_0x7d51('0x4b')],_0x5aabd1[_0x7d51('0x4c')]));if(_0x4b2a28[_0x7d51('0x4b')][_0x7d51('0x56')]){_0x55424e[_0x7d51('0x54')]=_[_0x7d51('0x57')](_0x55424e['where'],{'$or':_[_0x7d51('0x44')](_0x55424e[_0x7d51('0x4f')],function(_0x4dea40){var _0x5a7370={};_0x5a7370[_0x4dea40]={'$like':'%'+_0x4b2a28[_0x7d51('0x4b')]['filter']+'%'};return _0x5a7370;})});}_0x55424e=_['merge']({},_0x55424e,_0x4b2a28[_0x7d51('0x58')]);return _0x4dd436['getAgents'](_0x55424e);}})[_0x7d51('0x37')](function(_0x3ddcfe){if(_0x3ddcfe){_0x19b346=_0x3ddcfe[_0x7d51('0x5e')];if(!_0x4b2a28[_0x7d51('0x4b')]['hasOwnProperty']('nolimit')){_0x55424e['limit']=qs[_0x7d51('0x30')](_0x4b2a28[_0x7d51('0x4b')][_0x7d51('0x30')]);_0x55424e[_0x7d51('0x2e')]=qs[_0x7d51('0x2e')](_0x4b2a28[_0x7d51('0x4b')][_0x7d51('0x2e')]);}return _0x4dd436[_0x7d51('0xc1')](_0x55424e);}})['then'](function(_0x38f0f3){if(_0x38f0f3){return _0x38f0f3?{'count':_0x19b346,'rows':_0x38f0f3}:null;}})[_0x7d51('0x37')](respondWithResult(_0x37f327,null))[_0x7d51('0x2b')](handleError(_0x37f327,null));}; \ No newline at end of file +var _0xfffd=['undefined','count','set','apply','reject','save','update','then','destroy','get','FaxAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','FaxAccount','includeAll','include','findAll','rows','show','params','keys','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','getDispositions','findOne','FaxAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','gateway','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','Set','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','root','basename','CheckAfterSend','isNil','from','fax','defaults','Send\x20Fax\x20failed','out','filename','Messages','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./faxAccount.socket','register','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','offset','limit'];(function(_0x41ba6a,_0x42c5d9){var _0x315f92=function(_0x1cd96b){while(--_0x1cd96b){_0x41ba6a['push'](_0x41ba6a['shift']());}};_0x315f92(++_0x42c5d9);}(_0xfffd,0x15f));var _0xdfff=function(_0x11c6ba,_0x15a8e1){_0x11c6ba=_0x11c6ba-0x0;var _0x42a979=_0xfffd[_0x11c6ba];return _0x42a979;};'use strict';var emlformat=require(_0xdfff('0x0'));var rimraf=require(_0xdfff('0x1'));var zipdir=require(_0xdfff('0x2'));var jsonpatch=require(_0xdfff('0x3'));var rp=require(_0xdfff('0x4'));var moment=require(_0xdfff('0x5'));var BPromise=require(_0xdfff('0x6'));var Mustache=require(_0xdfff('0x7'));var util=require('util');var path=require(_0xdfff('0x8'));var sox=require(_0xdfff('0x9'));var csv=require(_0xdfff('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfff('0xb'));var _=require(_0xdfff('0xc'));var squel=require('squel');var crypto=require(_0xdfff('0xd'));var jsforce=require(_0xdfff('0xe'));var deskjs=require(_0xdfff('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdfff('0x10'));var Papa=require(_0xdfff('0x11'));var Redis=require(_0xdfff('0x12'));var authService=require(_0xdfff('0x13'));var qs=require(_0xdfff('0x14'));var as=require(_0xdfff('0x15'));var hardwareService=require(_0xdfff('0x16'));var logger=require(_0xdfff('0x17'))(_0xdfff('0x18'));var utils=require(_0xdfff('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xdfff('0x1a'));var db=require(_0xdfff('0x1b'))['db'];config[_0xdfff('0x1c')]=_['defaults'](config[_0xdfff('0x1c')],{'host':_0xdfff('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfff('0x1c')]));require(_0xdfff('0x1e'))[_0xdfff('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdfff('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xdfff('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c480f,_0x40d990,_0x54c2ba,_0x5065fa){return new BPromise(function(_0x206b2e,_0x399b3d){var _0x1d3937=_0x5065fa||client;return _0x1d3937[_0xdfff('0x21')](_0x4c480f,_0x54c2ba)['then'](function(_0x1278cb){logger[_0xdfff('0x22')](_0xdfff('0x23'),_0x40d990,_0xdfff('0x24'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x40d990,_0xdfff('0x24'),JSON['stringify'](_0x1278cb));if(_0x1278cb[_0xdfff('0x25')]){if(_0x1278cb['error'][_0xdfff('0x26')]===0x1f4){logger[_0xdfff('0x25')](_0xdfff('0x23'),_0x40d990,_0x1278cb[_0xdfff('0x25')][_0xdfff('0x27')]);return _0x399b3d(_0x1278cb['error']['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x40d990,_0x1278cb[_0xdfff('0x25')][_0xdfff('0x27')]);return _0x206b2e(_0x1278cb[_0xdfff('0x25')][_0xdfff('0x27')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x40d990,'request\x20sent');_0x206b2e(_0x1278cb[_0xdfff('0x28')]['message']);}})[_0xdfff('0x29')](function(_0x4d8770){logger[_0xdfff('0x25')](_0xdfff('0x23'),_0x40d990,_0x4d8770);_0x399b3d(_0x4d8770);});});}function respondWithStatusCode(_0x51421b,_0x3b8057){_0x3b8057=_0x3b8057||0xcc;return function(_0x1aef81){if(_0x1aef81){return _0x51421b[_0xdfff('0x2a')](_0x3b8057);}return _0x51421b[_0xdfff('0x2b')](_0x3b8057)['end']();};}function respondWithResult(_0x1af191,_0x490152){_0x490152=_0x490152||0xc8;return function(_0x51340b){if(_0x51340b){return _0x1af191['status'](_0x490152)[_0xdfff('0x2c')](_0x51340b);}};}function respondWithFilteredResult(_0x37276d,_0x108ce2){return function(_0x8a09a3){if(_0x8a09a3){var _0x224cab=typeof _0x108ce2[_0xdfff('0x2d')]==='undefined'&&typeof _0x108ce2[_0xdfff('0x2e')]===_0xdfff('0x2f');var _0x43453d=_0x8a09a3[_0xdfff('0x30')];var _0x352f14=_0x224cab?0x0:_0x108ce2['offset'];var _0x4c4da9=_0x224cab?_0x8a09a3[_0xdfff('0x30')]:_0x108ce2['offset']+_0x108ce2['limit'];var _0x417efa;if(_0x4c4da9>=_0x43453d){_0x4c4da9=_0x43453d;_0x417efa=0xc8;}else{_0x417efa=0xce;}_0x37276d[_0xdfff('0x2b')](_0x417efa);return _0x37276d[_0xdfff('0x31')]('Content-Range',_0x352f14+'-'+_0x4c4da9+'/'+_0x43453d)[_0xdfff('0x2c')](_0x8a09a3);}return null;};}function patchUpdates(_0x1df756){return function(_0x1c9755){try{jsonpatch[_0xdfff('0x32')](_0x1c9755,_0x1df756,!![]);}catch(_0xce00d5){return BPromise[_0xdfff('0x33')](_0xce00d5);}return _0x1c9755[_0xdfff('0x34')]();};}function saveUpdates(_0x50da87,_0x178153){return function(_0x149d5b){if(_0x149d5b){return _0x149d5b[_0xdfff('0x35')](_0x50da87)[_0xdfff('0x36')](function(_0x329510){return _0x329510;});}return null;};}function removeEntity(_0x263482,_0x21491e){return function(_0x21191f){if(_0x21191f){return _0x21191f[_0xdfff('0x37')]()[_0xdfff('0x36')](function(){var _0x4b8a62=_0x21191f[_0xdfff('0x38')]({'plain':!![]});var _0x1c4f59=_0xdfff('0x39');return db[_0xdfff('0x3a')][_0xdfff('0x37')]({'where':{'type':_0x1c4f59,'resourceId':_0x4b8a62['id']}})['then'](function(){return _0x21191f;});})[_0xdfff('0x36')](function(){_0x263482[_0xdfff('0x2b')](0xcc)[_0xdfff('0x3b')]();});}};}function handleEntityNotFound(_0x5bab1e,_0x13d9ca){return function(_0x1124ba){if(!_0x1124ba){_0x5bab1e[_0xdfff('0x2a')](0x194);}return _0x1124ba;};}function handleError(_0x56ce23,_0x3c2814){_0x3c2814=_0x3c2814||0x1f4;return function(_0x1ebc22){logger['error'](_0x1ebc22[_0xdfff('0x3c')]);if(_0x1ebc22[_0xdfff('0x3d')]){delete _0x1ebc22[_0xdfff('0x3d')];}_0x56ce23[_0xdfff('0x2b')](_0x3c2814)[_0xdfff('0x3e')](_0x1ebc22);};}exports[_0xdfff('0x3f')]=function(_0x29e1ef,_0xf96f0c){var _0x43ff6f={'include':[{'model':db[_0xdfff('0x40')],'as':_0xdfff('0x41')}]},_0x33f8bb={},_0x27c660={'count':0x0,'rows':[]};var _0x2aa4af=_[_0xdfff('0x42')](db['FaxAccount'][_0xdfff('0x43')],function(_0x510c19){return{'name':_0x510c19[_0xdfff('0x44')],'type':_0x510c19[_0xdfff('0x45')][_0xdfff('0x46')]};});_0x33f8bb[_0xdfff('0x47')]=_[_0xdfff('0x42')](_0x2aa4af,_0xdfff('0x3d'));_0x33f8bb[_0xdfff('0x48')]=_['keys'](_0x29e1ef['query']);_0x33f8bb['filters']=_[_0xdfff('0x49')](_0x33f8bb[_0xdfff('0x47')],_0x33f8bb[_0xdfff('0x48')]);_0x43ff6f[_0xdfff('0x4a')]=_[_0xdfff('0x49')](_0x33f8bb[_0xdfff('0x47')],qs[_0xdfff('0x4b')](_0x29e1ef['query'][_0xdfff('0x4b')]));_0x43ff6f[_0xdfff('0x4a')]=_0x43ff6f['attributes'][_0xdfff('0x4c')]?_0x43ff6f['attributes']:_0x33f8bb[_0xdfff('0x47')];if(!_0x29e1ef[_0xdfff('0x48')][_0xdfff('0x4d')](_0xdfff('0x4e'))){_0x43ff6f[_0xdfff('0x2e')]=qs['limit'](_0x29e1ef[_0xdfff('0x48')][_0xdfff('0x2e')]);_0x43ff6f[_0xdfff('0x2d')]=qs['offset'](_0x29e1ef[_0xdfff('0x48')][_0xdfff('0x2d')]);}_0x43ff6f[_0xdfff('0x4f')]=qs[_0xdfff('0x50')](_0x29e1ef[_0xdfff('0x48')]['sort']);_0x43ff6f[_0xdfff('0x51')]=qs[_0xdfff('0x52')](_[_0xdfff('0x53')](_0x29e1ef[_0xdfff('0x48')],_0x33f8bb[_0xdfff('0x52')]),_0x2aa4af);if(_0x29e1ef[_0xdfff('0x48')][_0xdfff('0x54')]){_0x43ff6f[_0xdfff('0x51')]=_[_0xdfff('0x55')](_0x43ff6f[_0xdfff('0x51')],{'$or':_[_0xdfff('0x42')](_0x2aa4af,function(_0x458a85){if(_0x458a85[_0xdfff('0x45')]!==_0xdfff('0x56')){var _0x40a19c={};_0x40a19c[_0x458a85[_0xdfff('0x3d')]]={'$like':'%'+_0x29e1ef[_0xdfff('0x48')][_0xdfff('0x54')]+'%'};return _0x40a19c;}})});}_0x43ff6f=_[_0xdfff('0x55')]({},_0x43ff6f,_0x29e1ef['options']);var _0x1cc72c={'where':_0x43ff6f[_0xdfff('0x51')]};return db[_0xdfff('0x57')]['count'](_0x1cc72c)['then'](function(_0x1e2200){_0x27c660[_0xdfff('0x30')]=_0x1e2200;if(_0x29e1ef[_0xdfff('0x48')][_0xdfff('0x58')]){_0x43ff6f[_0xdfff('0x59')]=[{'all':!![]}];}return db[_0xdfff('0x57')][_0xdfff('0x5a')](_0x43ff6f);})[_0xdfff('0x36')](function(_0x18d05d){_0x27c660[_0xdfff('0x5b')]=_0x18d05d;return _0x27c660;})[_0xdfff('0x36')](respondWithFilteredResult(_0xf96f0c,_0x43ff6f))[_0xdfff('0x29')](handleError(_0xf96f0c,null));};exports[_0xdfff('0x5c')]=function(_0x2d7263,_0x2c0fe4){var _0x211898={'raw':![],'where':{'id':_0x2d7263[_0xdfff('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xdfff('0x41')}]},_0x40f272={};_0x40f272[_0xdfff('0x47')]=_['keys'](db[_0xdfff('0x57')][_0xdfff('0x43')]);_0x40f272[_0xdfff('0x48')]=_[_0xdfff('0x5e')](_0x2d7263['query']);_0x40f272[_0xdfff('0x52')]=_[_0xdfff('0x49')](_0x40f272['model'],_0x40f272[_0xdfff('0x48')]);_0x211898[_0xdfff('0x4a')]=_['intersection'](_0x40f272['model'],qs[_0xdfff('0x4b')](_0x2d7263[_0xdfff('0x48')][_0xdfff('0x4b')]));_0x211898[_0xdfff('0x4a')]=_0x211898[_0xdfff('0x4a')]['length']?_0x211898[_0xdfff('0x4a')]:_0x40f272['model'];if(_0x2d7263['query']['includeAll']){_0x211898[_0xdfff('0x59')]=[{'all':!![]}];}_0x211898=_[_0xdfff('0x55')]({},_0x211898,_0x2d7263[_0xdfff('0x5f')]);return db[_0xdfff('0x57')][_0xdfff('0x60')](_0x211898)[_0xdfff('0x36')](handleEntityNotFound(_0x2c0fe4,null))[_0xdfff('0x36')](respondWithResult(_0x2c0fe4,null))[_0xdfff('0x29')](handleError(_0x2c0fe4,null));};exports[_0xdfff('0x61')]=function(_0x37e683,_0x44b7ac){return db['FaxAccount'][_0xdfff('0x61')](_0x37e683['body'],{})[_0xdfff('0x36')](function(_0x1710f5){var _0x4fd109=_0x37e683[_0xdfff('0x62')]['get']({'plain':!![]});if(!_0x4fd109)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fd109[_0xdfff('0x63')]===_0xdfff('0x62')){var _0x5d42ca=_0x1710f5[_0xdfff('0x38')]({'plain':!![]});var _0x21289a=_0xdfff('0x39');return db[_0xdfff('0x64')]['find']({'where':{'name':_0x21289a,'userProfileId':_0x4fd109[_0xdfff('0x65')]},'raw':!![]})[_0xdfff('0x36')](function(_0x132eca){if(_0x132eca&&_0x132eca[_0xdfff('0x66')]===0x0){return db['UserProfileResource'][_0xdfff('0x61')]({'name':_0x5d42ca[_0xdfff('0x3d')],'resourceId':_0x5d42ca['id'],'type':_0x132eca[_0xdfff('0x3d')],'sectionId':_0x132eca['id']},{})[_0xdfff('0x36')](function(){return _0x1710f5;});}else{return _0x1710f5;}})[_0xdfff('0x29')](function(_0x1bb54d){logger[_0xdfff('0x25')](_0xdfff('0x67'),_0x1bb54d);throw _0x1bb54d;});}return _0x1710f5;})[_0xdfff('0x36')](respondWithResult(_0x44b7ac,0xc9))[_0xdfff('0x29')](handleError(_0x44b7ac,null));};exports[_0xdfff('0x35')]=function(_0x21d341,_0x52f99b){if(_0x21d341[_0xdfff('0x68')]['id']){delete _0x21d341['body']['id'];}return db[_0xdfff('0x57')][_0xdfff('0x60')]({'where':{'id':_0x21d341['params']['id']},'include':[{'model':db[_0xdfff('0x40')],'as':_0xdfff('0x41')}]})['then'](handleEntityNotFound(_0x52f99b,null))[_0xdfff('0x36')](saveUpdates(_0x21d341[_0xdfff('0x68')],null))[_0xdfff('0x36')](respondWithResult(_0x52f99b,null))[_0xdfff('0x29')](handleError(_0x52f99b,null));};exports[_0xdfff('0x37')]=function(_0x14084f,_0x16298c){return db[_0xdfff('0x57')][_0xdfff('0x60')]({'where':{'id':_0x14084f[_0xdfff('0x5d')]['id']}})['then'](handleEntityNotFound(_0x16298c,null))[_0xdfff('0x36')](removeEntity(_0x16298c,null))[_0xdfff('0x29')](handleError(_0x16298c,null));};exports[_0xdfff('0x69')]=function(_0x3ff62e,_0xc9ed5){return db['FaxAccount']['describe']()['then'](respondWithResult(_0xc9ed5,null))[_0xdfff('0x29')](handleError(_0xc9ed5,null));};exports[_0xdfff('0x6a')]=function(_0x187f05,_0x51cbfa,_0x570ddd){if(_0x187f05[_0xdfff('0x68')]['id']){delete _0x187f05['body']['id'];}return db[_0xdfff('0x57')][_0xdfff('0x60')]({'where':{'id':_0x187f05[_0xdfff('0x5d')]['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x51cbfa,null))[_0xdfff('0x36')](function(_0xeab90){if(_0xeab90){_0x187f05[_0xdfff('0x68')]['FaxAccountId']=_0xeab90['id'];return db['Disposition'][_0xdfff('0x61')](_0x187f05[_0xdfff('0x68')]);}})['then'](respondWithResult(_0x51cbfa,null))[_0xdfff('0x29')](handleError(_0x51cbfa,null));};exports[_0xdfff('0x6b')]=function(_0x130604,_0x1017c5,_0x5b85ff){var _0x5cd3d2={'raw':![],'where':{}};var _0x414dd3={};var _0x29f92d={'count':0x0,'rows':[]};return db[_0xdfff('0x57')][_0xdfff('0x6c')]({'where':{'id':_0x130604[_0xdfff('0x5d')]['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x1017c5,null))[_0xdfff('0x36')](function(_0xdeadf2){if(_0xdeadf2){_0x414dd3['model']=_[_0xdfff('0x5e')](db['Disposition'][_0xdfff('0x43')]);_0x414dd3['query']=_['keys'](_0x130604[_0xdfff('0x48')]);_0x414dd3[_0xdfff('0x52')]=_[_0xdfff('0x49')](_0x414dd3[_0xdfff('0x47')],_0x414dd3[_0xdfff('0x48')]);_0x5cd3d2['attributes']=_[_0xdfff('0x49')](_0x414dd3[_0xdfff('0x47')],qs[_0xdfff('0x4b')](_0x130604[_0xdfff('0x48')]['fields']));_0x5cd3d2[_0xdfff('0x4a')]=_0x5cd3d2[_0xdfff('0x4a')][_0xdfff('0x4c')]?_0x5cd3d2[_0xdfff('0x4a')]:_0x414dd3[_0xdfff('0x47')];if(!_0x130604[_0xdfff('0x48')][_0xdfff('0x4d')](_0xdfff('0x4e'))){_0x5cd3d2['limit']=qs[_0xdfff('0x2e')](_0x130604[_0xdfff('0x48')]['limit']);_0x5cd3d2[_0xdfff('0x2d')]=qs[_0xdfff('0x2d')](_0x130604[_0xdfff('0x48')]['offset']);}_0x5cd3d2[_0xdfff('0x4f')]=qs[_0xdfff('0x50')](_0x130604['query']['sort']);_0x5cd3d2[_0xdfff('0x51')]=qs['filters'](_[_0xdfff('0x53')](_0x130604[_0xdfff('0x48')],_0x414dd3[_0xdfff('0x52')]));_0x5cd3d2[_0xdfff('0x51')][_0xdfff('0x6d')]=_0xdeadf2['id'];if(_0x130604[_0xdfff('0x48')][_0xdfff('0x54')]){_0x5cd3d2[_0xdfff('0x51')]=_[_0xdfff('0x55')](_0x5cd3d2[_0xdfff('0x51')],{'$or':_['map'](_0x5cd3d2[_0xdfff('0x4a')],function(_0x45c9ca){var _0x330c8a={};_0x330c8a[_0x45c9ca]={'$like':'%'+_0x130604['query'][_0xdfff('0x54')]+'%'};return _0x330c8a;})});}_0x5cd3d2=_[_0xdfff('0x55')]({},_0x5cd3d2,_0x130604[_0xdfff('0x5f')]);return db[_0xdfff('0x6e')][_0xdfff('0x30')]({'where':_0x5cd3d2[_0xdfff('0x51')]})[_0xdfff('0x36')](function(_0xc3a8d9){_0x29f92d['count']=_0xc3a8d9;if(_0x130604[_0xdfff('0x48')][_0xdfff('0x58')]){_0x5cd3d2['include']=[{'all':!![]}];}return db[_0xdfff('0x6e')]['findAll'](_0x5cd3d2);})[_0xdfff('0x36')](function(_0x4b01eb){_0x29f92d[_0xdfff('0x5b')]=_0x4b01eb;return _0x29f92d;});}})[_0xdfff('0x36')](respondWithFilteredResult(_0x1017c5,_0x5cd3d2))['catch'](handleError(_0x1017c5,null));};exports[_0xdfff('0x6f')]=function(_0x5d678a,_0x2e3a57,_0x2e889b){return db[_0xdfff('0x57')][_0xdfff('0x60')]({'where':{'id':_0x5d678a[_0xdfff('0x5d')]['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x2e3a57,null))['then'](function(_0x253a08){if(_0x253a08){return _0x253a08[_0xdfff('0x6f')](_0x5d678a[_0xdfff('0x48')][_0xdfff('0x70')]);}})[_0xdfff('0x36')](respondWithStatusCode(_0x2e3a57,null))[_0xdfff('0x29')](handleError(_0x2e3a57,null));};exports['addAnswer']=function(_0x37954b,_0x51b703,_0x369e79){if(_0x37954b[_0xdfff('0x68')]['id']){delete _0x37954b[_0xdfff('0x68')]['id'];}return db['FaxAccount'][_0xdfff('0x60')]({'where':{'id':_0x37954b['params']['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x51b703,null))['then'](function(_0x297199){if(_0x297199){_0x37954b['body']['FaxAccountId']=_0x297199['id'];return db[_0xdfff('0x71')][_0xdfff('0x61')](_0x37954b[_0xdfff('0x68')]);}})[_0xdfff('0x36')](respondWithResult(_0x51b703,null))[_0xdfff('0x29')](handleError(_0x51b703,null));};exports[_0xdfff('0x72')]=function(_0x3c07d7,_0x3a0071,_0x10b46c){var _0x580eb7={'raw':![],'where':{}};var _0x218549={};var _0x4f4af6={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3c07d7['params']['id']}})['then'](handleEntityNotFound(_0x3a0071,null))[_0xdfff('0x36')](function(_0xa581d9){if(_0xa581d9){_0x218549['model']=_[_0xdfff('0x5e')](db[_0xdfff('0x71')]['rawAttributes']);_0x218549[_0xdfff('0x48')]=_['keys'](_0x3c07d7['query']);_0x218549['filters']=_[_0xdfff('0x49')](_0x218549[_0xdfff('0x47')],_0x218549['query']);_0x580eb7[_0xdfff('0x4a')]=_['intersection'](_0x218549[_0xdfff('0x47')],qs['fields'](_0x3c07d7[_0xdfff('0x48')][_0xdfff('0x4b')]));_0x580eb7[_0xdfff('0x4a')]=_0x580eb7['attributes'][_0xdfff('0x4c')]?_0x580eb7[_0xdfff('0x4a')]:_0x218549[_0xdfff('0x47')];if(!_0x3c07d7[_0xdfff('0x48')][_0xdfff('0x4d')](_0xdfff('0x4e'))){_0x580eb7[_0xdfff('0x2e')]=qs[_0xdfff('0x2e')](_0x3c07d7[_0xdfff('0x48')][_0xdfff('0x2e')]);_0x580eb7[_0xdfff('0x2d')]=qs[_0xdfff('0x2d')](_0x3c07d7[_0xdfff('0x48')]['offset']);}_0x580eb7[_0xdfff('0x4f')]=qs[_0xdfff('0x50')](_0x3c07d7[_0xdfff('0x48')][_0xdfff('0x50')]);_0x580eb7[_0xdfff('0x51')]=qs[_0xdfff('0x52')](_[_0xdfff('0x53')](_0x3c07d7[_0xdfff('0x48')],_0x218549[_0xdfff('0x52')]));_0x580eb7['where']['FaxAccountId']=_0xa581d9['id'];if(_0x3c07d7[_0xdfff('0x48')][_0xdfff('0x54')]){_0x580eb7[_0xdfff('0x51')]=_[_0xdfff('0x55')](_0x580eb7[_0xdfff('0x51')],{'$or':_['map'](_0x580eb7[_0xdfff('0x4a')],function(_0x14b52a){var _0x2cffbd={};_0x2cffbd[_0x14b52a]={'$like':'%'+_0x3c07d7[_0xdfff('0x48')][_0xdfff('0x54')]+'%'};return _0x2cffbd;})});}_0x580eb7=_[_0xdfff('0x55')]({},_0x580eb7,_0x3c07d7[_0xdfff('0x5f')]);return db[_0xdfff('0x71')][_0xdfff('0x30')]({'where':_0x580eb7[_0xdfff('0x51')]})[_0xdfff('0x36')](function(_0x562771){_0x4f4af6[_0xdfff('0x30')]=_0x562771;if(_0x3c07d7['query']['includeAll']){_0x580eb7[_0xdfff('0x59')]=[{'all':!![]}];}return db[_0xdfff('0x71')][_0xdfff('0x5a')](_0x580eb7);})[_0xdfff('0x36')](function(_0x3eb848){_0x4f4af6['rows']=_0x3eb848;return _0x4f4af6;});}})[_0xdfff('0x36')](respondWithFilteredResult(_0x3a0071,_0x580eb7))[_0xdfff('0x29')](handleError(_0x3a0071,null));};exports[_0xdfff('0x73')]=function(_0x5cece5,_0x47e6cf,_0x172dba){return db[_0xdfff('0x57')][_0xdfff('0x60')]({'where':{'id':_0x5cece5['params']['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x47e6cf,null))[_0xdfff('0x36')](function(_0x36a24b){if(_0x36a24b){return _0x36a24b[_0xdfff('0x73')](_0x5cece5[_0xdfff('0x48')][_0xdfff('0x70')]);}})[_0xdfff('0x36')](respondWithStatusCode(_0x47e6cf,null))[_0xdfff('0x29')](handleError(_0x47e6cf,null));};exports[_0xdfff('0x74')]=function(_0x40c51e,_0x3d5e69,_0x385425){return db['FaxInteraction'][_0xdfff('0x60')]({'where':{'id':_0x40c51e[_0xdfff('0x5d')]['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x3d5e69,null))['then'](function(_0x192878){if(_0x192878){return _0x192878[_0xdfff('0x74')](_0x40c51e[_0xdfff('0x68')]['ids'],_[_0xdfff('0x75')](_0x40c51e[_0xdfff('0x68')],[_0xdfff('0x70'),'id'])||{});}})[_0xdfff('0x36')](respondWithResult(_0x3d5e69,null))['catch'](handleError(_0x3d5e69,null));};exports[_0xdfff('0x76')]=function(_0x16aae1,_0x14fb1b,_0x4bec70){var _0x260880={'raw':![],'where':{}};var _0x47dc3f={};var _0x5a5bf8={'count':0x0,'rows':[]};return db['FaxAccount'][_0xdfff('0x6c')]({'where':{'id':_0x16aae1[_0xdfff('0x5d')]['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x14fb1b,null))[_0xdfff('0x36')](function(_0x29285e){if(_0x29285e){_0x47dc3f['model']=_['keys'](db['FaxInteraction'][_0xdfff('0x43')]);_0x47dc3f[_0xdfff('0x48')]=_[_0xdfff('0x5e')](_0x16aae1[_0xdfff('0x48')]);_0x47dc3f[_0xdfff('0x52')]=_[_0xdfff('0x49')](_0x47dc3f['model'],_0x47dc3f[_0xdfff('0x48')]);_0x260880[_0xdfff('0x4a')]=_[_0xdfff('0x49')](_0x47dc3f[_0xdfff('0x47')],qs[_0xdfff('0x4b')](_0x16aae1[_0xdfff('0x48')][_0xdfff('0x4b')]));_0x260880[_0xdfff('0x4a')]=_0x260880[_0xdfff('0x4a')][_0xdfff('0x4c')]?_0x260880[_0xdfff('0x4a')]:_0x47dc3f[_0xdfff('0x47')];if(!_0x16aae1[_0xdfff('0x48')][_0xdfff('0x4d')](_0xdfff('0x4e'))){_0x260880[_0xdfff('0x2e')]=qs['limit'](_0x16aae1['query'][_0xdfff('0x2e')]);_0x260880[_0xdfff('0x2d')]=qs['offset'](_0x16aae1[_0xdfff('0x48')][_0xdfff('0x2d')]);}_0x260880[_0xdfff('0x4f')]=qs[_0xdfff('0x50')](_0x16aae1['query'][_0xdfff('0x50')]);_0x260880['where']=qs[_0xdfff('0x52')](_[_0xdfff('0x53')](_0x16aae1[_0xdfff('0x48')],_0x47dc3f['filters']));_0x260880['where'][_0xdfff('0x6d')]=_0x29285e['id'];if(_0x16aae1[_0xdfff('0x48')][_0xdfff('0x54')]){_0x260880['where']=_[_0xdfff('0x55')](_0x260880[_0xdfff('0x51')],{'$or':_['map'](_0x260880[_0xdfff('0x4a')],function(_0x2289f6){var _0x2a6b69={};_0x2a6b69[_0x2289f6]={'$like':'%'+_0x16aae1[_0xdfff('0x48')][_0xdfff('0x54')]+'%'};return _0x2a6b69;})});}_0x260880=_['merge']({},_0x260880,_0x16aae1[_0xdfff('0x5f')]);return db[_0xdfff('0x77')][_0xdfff('0x30')]({'where':_0x260880[_0xdfff('0x51')]})[_0xdfff('0x36')](function(_0x3697b9){_0x5a5bf8[_0xdfff('0x30')]=_0x3697b9;if(_0x16aae1[_0xdfff('0x48')]['includeAll']){_0x260880[_0xdfff('0x59')]=[{'model':db[_0xdfff('0x78')],'as':_0xdfff('0x79'),'required':![]},{'model':db[_0xdfff('0x7a')],'as':_0xdfff('0x7b'),'attributes':[_0xdfff('0x3d'),'fullname',_0xdfff('0x7c')],'required':![]},{'model':db[_0xdfff('0x7d')],'as':_0xdfff('0x7e'),'attributes':['id',_0xdfff('0x3d'),_0xdfff('0x7f')],'where':_0x16aae1[_0xdfff('0x48')][_0xdfff('0x80')]?{'id':_0x16aae1['query']['tag']}:undefined,'required':_0x16aae1['query']['tag']?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x260880);})[_0xdfff('0x36')](function(_0x49988){_0x5a5bf8[_0xdfff('0x5b')]=_0x49988;return _0x5a5bf8;});}})[_0xdfff('0x36')](respondWithFilteredResult(_0x14fb1b,_0x260880))['catch'](handleError(_0x14fb1b,null));};exports[_0xdfff('0x81')]=function(_0x1bf53b,_0x3c32b0){var _0x4d835b=_0x1bf53b[_0xdfff('0x5d')]['id'];var _0x1322fc=_0x1bf53b[_0xdfff('0x68')];var _0x47063f=0xc8;var _0x2f03e1=null;return db[_0xdfff('0x82')][_0xdfff('0x83')]({'isolationLevel':db['sequelize']['Transaction'][_0xdfff('0x84')][_0xdfff('0x85')]},function(_0x1e0028){return db['FaxAccount'][_0xdfff('0x6c')]({'where':{'id':_0x4d835b},'transaction':_0x1e0028})[_0xdfff('0x36')](function(_0x126624){if(_0x126624){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x4d835b},'transaction':_0x1e0028})['then'](function(){var _0x1bc54e=_['map'](_0x1322fc,function(_0x375fec){_0x375fec[_0xdfff('0x6d')]=_0x4d835b;return _0x375fec;});return db[_0xdfff('0x86')][_0xdfff('0x87')](_0x1bc54e,{'transaction':_0x1e0028});});}else{_0x47063f=0x194;_0x2f03e1=[];}});})[_0xdfff('0x36')](function(){if(_0x47063f!==0x194){return db[_0xdfff('0x86')][_0xdfff('0x88')]({'where':{'FaxAccountId':_0x4d835b},'order':_0xdfff('0x89')})[_0xdfff('0x36')](function(_0x3aa07f){_0x2f03e1=_0x3aa07f;});}})[_0xdfff('0x29')](function(_0x369c7c){_0x47063f=0x1f4;logger['error'](_0x369c7c['stack']);if(_0x369c7c[_0xdfff('0x3d')]){delete _0x369c7c['name'];}_0x2f03e1=_0x369c7c;})[_0xdfff('0x8a')](function(){if(_0x2f03e1===null){_0x3c32b0['sendStatus'](_0x47063f);}else{if(_0x47063f===0x1f4){_0x3c32b0[_0xdfff('0x2b')](_0x47063f)[_0xdfff('0x3e')](_0x2f03e1);}else{_0x3c32b0[_0xdfff('0x2b')](_0x47063f)[_0xdfff('0x2c')](_0x2f03e1);}}});};exports[_0xdfff('0x8b')]=function(_0x2c8cfc,_0xf3da6d,_0x5da244){var _0x15e241={};var _0x55744b={};var _0x15b059;var _0x882718;return db['FaxAccount'][_0xdfff('0x6c')]({'where':{'id':_0x2c8cfc[_0xdfff('0x5d')]['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0xf3da6d,null))['then'](function(_0x319134){if(_0x319134){_0x15b059=_0x319134;_0x55744b['model']=_[_0xdfff('0x5e')](db[_0xdfff('0x86')][_0xdfff('0x43')]);_0x55744b[_0xdfff('0x48')]=_[_0xdfff('0x5e')](_0x2c8cfc['query']);_0x55744b[_0xdfff('0x52')]=_[_0xdfff('0x49')](_0x55744b[_0xdfff('0x47')],_0x55744b['query']);_0x15e241[_0xdfff('0x4a')]=_[_0xdfff('0x49')](_0x55744b[_0xdfff('0x47')],qs[_0xdfff('0x4b')](_0x2c8cfc['query'][_0xdfff('0x4b')]));_0x15e241[_0xdfff('0x4a')]=_0x15e241['attributes'][_0xdfff('0x4c')]?_0x15e241['attributes']:_0x55744b[_0xdfff('0x47')];_0x15e241[_0xdfff('0x4f')]=qs[_0xdfff('0x50')](_0x2c8cfc[_0xdfff('0x48')][_0xdfff('0x50')]);_0x15e241['where']=qs[_0xdfff('0x52')](_[_0xdfff('0x53')](_0x2c8cfc[_0xdfff('0x48')],_0x55744b['filters']));if(_0x2c8cfc[_0xdfff('0x48')][_0xdfff('0x54')]){_0x15e241[_0xdfff('0x51')]=_[_0xdfff('0x55')](_0x15e241['where'],{'$or':_['map'](_0x15e241['attributes'],function(_0x4b992e){var _0x11d1f9={};_0x11d1f9[_0x4b992e]={'$like':'%'+_0x2c8cfc[_0xdfff('0x48')][_0xdfff('0x54')]+'%'};return _0x11d1f9;})});}_0x15e241=_[_0xdfff('0x55')]({},_0x15e241,_0x2c8cfc[_0xdfff('0x5f')]);return _0x15b059[_0xdfff('0x8b')](_0x15e241);}})[_0xdfff('0x36')](function(_0x3f9a6e){if(_0x3f9a6e){_0x882718=_0x3f9a6e['length'];if(!_0x2c8cfc[_0xdfff('0x48')][_0xdfff('0x4d')](_0xdfff('0x4e'))){_0x15e241['limit']=qs[_0xdfff('0x2e')](_0x2c8cfc['query'][_0xdfff('0x2e')]);_0x15e241[_0xdfff('0x2d')]=qs['offset'](_0x2c8cfc['query'][_0xdfff('0x2d')]);}return _0x15b059['getApplications'](_0x15e241);}})[_0xdfff('0x36')](function(_0x37b67b){if(_0x37b67b){return _0x37b67b?{'count':_0x882718,'rows':_0x37b67b}:null;}})[_0xdfff('0x36')](respondWithResult(_0xf3da6d,null))['catch'](handleError(_0xf3da6d,null));};function Extension(_0x31732f,_0x399302,_0x2612fe,_0x55a167){this[_0xdfff('0x8c')]=_0xdfff('0x8d');this[_0xdfff('0x8e')]=_0x31732f[_0xdfff('0x8f')];this['app']=_0x55a167;this['type']=_0xdfff('0x90');this[_0xdfff('0x91')]=_0xdfff('0x92');this[_0xdfff('0x6d')]=_0x31732f['id'];this[_0xdfff('0x89')]=_0x399302;this[_0xdfff('0x93')]=_0x2612fe;}function createExtensionsReciveFax(_0xaedf3c){var _0x46f6bd=0x1;var _0x2829b9=[];_0x2829b9['push'](new Extension(_0xaedf3c,_0x46f6bd,'','Answer'));_0x46f6bd+=0x1;_0x2829b9[_0xdfff('0x94')](new Extension(_0xaedf3c,_0x46f6bd,_0xdfff('0x95'),'Set'));_0x46f6bd+=0x1;for(var _0x5357de in _0xaedf3c){if(_0xaedf3c[_0xdfff('0x4d')](_0x5357de)&&(_0x5357de==='ecm'||_0x5357de==='localstationid'||_0x5357de===_0xdfff('0x96')||_0x5357de===_0xdfff('0x97')||_0x5357de==='headerinfo'||_0x5357de===_0xdfff('0x98')||_0x5357de===_0xdfff('0x99')||_0x5357de==='modem'||_0x5357de===_0xdfff('0x9a'))){_0x2829b9[_0xdfff('0x94')](new Extension(_0xaedf3c,_0x46f6bd,_0xdfff('0x9b')+_0x5357de+')='+_0xaedf3c[_0x5357de],_0xdfff('0x9c')));_0x46f6bd+=0x1;}}_0x2829b9['push'](new Extension(_0xaedf3c,_0x46f6bd,'6',_0xdfff('0x9d')));_0x46f6bd+=0x1;_0x2829b9['push'](new Extension(_0xaedf3c,_0x46f6bd,'/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',_0xdfff('0x9e')));_0x46f6bd=0x0;return _0x2829b9;}exports[_0xdfff('0x9f')]=function(_0x95cf05,_0x1f33e6,_0x50a9ab){var _0x36a3a7;return db[_0xdfff('0x82')][_0xdfff('0x83')](function(_0x4f357b){return db['FaxAccount']['create'](_0x95cf05[_0xdfff('0x68')],{'transaction':_0x4f357b})[_0xdfff('0x36')](function(_0x566792){_0x36a3a7=_0x566792[_0xdfff('0x38')]({'plain':!![]});return db[_0xdfff('0xa0')][_0xdfff('0x87')](createExtensionsReciveFax(_0x36a3a7),{'transaction':_0x4f357b});});})[_0xdfff('0x36')](function(){return _0x36a3a7;})[_0xdfff('0x36')](respondWithResult(_0x1f33e6,null))['catch'](handleError(_0x1f33e6,null));};exports[_0xdfff('0xa1')]=function(_0x1b09fd,_0x4626d1,_0x23e9be){var _0x4016ba;return db[_0xdfff('0x82')][_0xdfff('0x83')](function(_0x40dda6){return db[_0xdfff('0x57')][_0xdfff('0x35')](_0x1b09fd[_0xdfff('0x68')],{'where':{'id':_0x1b09fd[_0xdfff('0x68')]['id']},'transaction':_0x40dda6})[_0xdfff('0x36')](function(_0x5ca19e){return db[_0xdfff('0xa0')][_0xdfff('0x37')]({'where':{'FaxAccountId':_0x1b09fd['body']['id']},'transaction':_0x40dda6})['then'](function(_0x196ca8){return db[_0xdfff('0xa0')]['bulkCreate'](createExtensionsReciveFax(_[_0xdfff('0x75')](_0x1b09fd['body'],['tech',_0xdfff('0x46'),_0xdfff('0xa2'),_0xdfff('0xa3'),_0xdfff('0xa4'),_0xdfff('0xa5')])),{'transaction':_0x40dda6});});});})[_0xdfff('0x36')](function(){return db[_0xdfff('0x57')][_0xdfff('0xa6')](_0x1b09fd[_0xdfff('0x68')]['id']);})[_0xdfff('0x36')](respondWithResult(_0x4626d1,null))[_0xdfff('0x29')](handleError(_0x4626d1,null));};exports['getMessages']=function(_0x51e274,_0x747ab6,_0x2b1f71){var _0x577505={'raw':!![],'where':{}};var _0xadf81e={};var _0x32eda8={'count':0x0,'rows':[]};return db[_0xdfff('0x57')][_0xdfff('0x6c')]({'where':{'id':_0x51e274[_0xdfff('0x5d')]['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x747ab6,null))[_0xdfff('0x36')](function(_0x20f2ea){if(_0x20f2ea){_0xadf81e[_0xdfff('0x47')]=_[_0xdfff('0x5e')](db[_0xdfff('0xa7')][_0xdfff('0x43')]);_0xadf81e[_0xdfff('0x48')]=_[_0xdfff('0x5e')](_0x51e274[_0xdfff('0x48')]);_0xadf81e['filters']=_[_0xdfff('0x49')](_0xadf81e[_0xdfff('0x47')],_0xadf81e[_0xdfff('0x48')]);_0x577505[_0xdfff('0x4a')]=_[_0xdfff('0x49')](_0xadf81e[_0xdfff('0x47')],qs[_0xdfff('0x4b')](_0x51e274[_0xdfff('0x48')][_0xdfff('0x4b')]));_0x577505[_0xdfff('0x4a')]=_0x577505[_0xdfff('0x4a')]['length']?_0x577505['attributes']:_0xadf81e[_0xdfff('0x47')];if(!_0x51e274[_0xdfff('0x48')][_0xdfff('0x4d')](_0xdfff('0x4e'))){_0x577505[_0xdfff('0x2e')]=qs[_0xdfff('0x2e')](_0x51e274['query'][_0xdfff('0x2e')]);_0x577505[_0xdfff('0x2d')]=qs[_0xdfff('0x2d')](_0x51e274[_0xdfff('0x48')][_0xdfff('0x2d')]);}_0x577505[_0xdfff('0x4f')]=qs[_0xdfff('0x50')](_0x51e274[_0xdfff('0x48')]['sort']);_0x577505['where']=qs[_0xdfff('0x52')](_['pick'](_0x51e274[_0xdfff('0x48')],_0xadf81e['filters']));_0x577505[_0xdfff('0x51')][_0xdfff('0x6d')]=_0x20f2ea['id'];if(_0x51e274[_0xdfff('0x48')][_0xdfff('0x54')]){_0x577505['where']=_[_0xdfff('0x55')](_0x577505[_0xdfff('0x51')],{'$or':_[_0xdfff('0x42')](_0x577505[_0xdfff('0x4a')],function(_0x4c5869){var _0x18c596={};_0x18c596[_0x4c5869]={'$like':'%'+_0x51e274[_0xdfff('0x48')][_0xdfff('0x54')]+'%'};return _0x18c596;})});}if(_0x51e274['query'][_0xdfff('0xa8')]){var _0x46f9b5=_0x51e274[_0xdfff('0x48')][_0xdfff('0xa8')][_0xdfff('0xa9')](',');var _0x9e39b6={};_0x9e39b6[_0x46f9b5[0x0]]={'$gte':moment(_0x46f9b5[0x1])[_0xdfff('0xaa')](_0xdfff('0xab'))};_0x577505[_0xdfff('0x51')]=_['merge'](_0x577505['where'],_0x9e39b6);}_0x577505=_[_0xdfff('0x55')]({},_0x577505,_0x51e274[_0xdfff('0x5f')]);return db[_0xdfff('0xa7')][_0xdfff('0x30')]({'where':_0x577505['where']})['then'](function(_0x5be817){_0x32eda8['count']=_0x5be817;if(_0x51e274['query']['includeAll']){_0x577505[_0xdfff('0x59')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x577505);})[_0xdfff('0x36')](function(_0x144a0e){_0x32eda8['rows']=_0x144a0e;return _0x32eda8;});}})['then'](respondWithFilteredResult(_0x747ab6,_0x577505))[_0xdfff('0x29')](handleError(_0x747ab6,null));};exports['send']=function(_0x789046,_0x2261b1,_0x305658){var _0x1a1ed3,_0x3f6985={},_0x380b97;if(_0x789046[_0xdfff('0x68')]['to']){_0x380b97=_0x789046[_0xdfff('0x68')]['to'][0x0];}return db[_0xdfff('0x57')][_0xdfff('0x60')]({'where':{'id':_0x789046[_0xdfff('0x5d')]['id']},'include':[{'model':db[_0xdfff('0xac')],'as':_0xdfff('0xad'),'include':[{'model':db[_0xdfff('0x78')],'as':_0xdfff('0xae'),'where':{'fax':_0x380b97},'limit':0x1,'order':[[_0xdfff('0xa3'),_0xdfff('0xaf')]]}]}]})['then'](handleEntityNotFound(_0x2261b1,null))['then'](function(_0x18d8a4){_0x1a1ed3=_0x18d8a4;if(_0x789046[_0xdfff('0x68')][_0xdfff('0xb0')]&&_0x789046[_0xdfff('0x68')]['attachments']['length']){for(var _0x46b4b0=0x0;_0x46b4b0<_0x789046['body'][_0xdfff('0xb0')][_0xdfff('0x4c')];_0x46b4b0+=0x1){_0x789046[_0xdfff('0x68')]['attachments'][_0x46b4b0]={'filename':_0x789046[_0xdfff('0x68')][_0xdfff('0xb0')][_0x46b4b0][_0xdfff('0x3d')],'id':_0x789046[_0xdfff('0x68')][_0xdfff('0xb0')][_0x46b4b0]['id'],'path':path['join'](config[_0xdfff('0xb1')],'server/files/attachments',_0x789046[_0xdfff('0x68')][_0xdfff('0xb0')][_0x46b4b0][_0xdfff('0xb2')])};}}return respondWithRpcPromise(_0xdfff('0xb3'),_0xdfff('0xb3'),{'FaxAccountId':_['isNil'](_0x789046[_0xdfff('0x5d')]['id'])?undefined:_0x789046[_0xdfff('0x5d')]['id'],'path':_[_0xdfff('0xb4')](_0x789046[_0xdfff('0x68')]['attachments'][0x0][_0xdfff('0x8')])?undefined:_0x789046[_0xdfff('0x68')][_0xdfff('0xb0')][0x0][_0xdfff('0x8')],'fax':_[_0xdfff('0xb4')](_0x789046['body']['to'][0x0])?undefined:_0x789046[_0xdfff('0x68')]['to'][0x0]},client9002);})['then'](function(){if(_0x1a1ed3){if(_[_0xdfff('0xb4')](_0x789046[_0xdfff('0x68')][_0xdfff('0xb5')])){_0x789046[_0xdfff('0x68')][_0xdfff('0xb5')]=util[_0xdfff('0xaa')]('\x22%s\x22\x20<%s>',_0x1a1ed3[_0xdfff('0x3d')],_0x1a1ed3[_0xdfff('0xb6')]);}if(_0x1a1ed3['List']){if(_0x1a1ed3[_0xdfff('0xad')][_0xdfff('0xae')][_0xdfff('0x4c')]){return _0x1a1ed3['List']['Contacts'][0x0];}else{return db[_0xdfff('0x78')][_0xdfff('0x61')](_[_0xdfff('0xb7')](_0x789046['body'],{'firstName':_0x789046[_0xdfff('0x68')]['to'][0x0],'phone':_0x789046[_0xdfff('0x68')]['to'][0x0],'fax':_0x789046['body']['to'][0x0],'ListId':_0x1a1ed3[_0xdfff('0xa5')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xdfff('0xb8'));}})[_0xdfff('0x36')](function(_0x24e5ce){if(_0x24e5ce){return db[_0xdfff('0x77')][_0xdfff('0x60')]({'where':{'ContactId':_0x24e5ce['id'],'closed':![],'FaxAccountId':_0x1a1ed3['id']}})[_0xdfff('0x36')](function(_0x3d783c){if(_0x3d783c){return[_0x3d783c,![]];}return db[_0xdfff('0x77')][_0xdfff('0x61')]({'UserId':_0x789046['user']['id'],'ContactId':_0x24e5ce['id'],'FaxAccountId':_0x1a1ed3['id'],'fax':_0x789046[_0xdfff('0x68')]['to'][0x0],'firstMsgDirection':_0xdfff('0xb9'),'Messages':[_[_0xdfff('0x55')](_0x789046[_0xdfff('0x68')],{'read':![],'body':_0x789046[_0xdfff('0x68')]['attachments'][0x0][_0xdfff('0xba')],'FaxAccountId':_0x1a1ed3['id'],'UserId':_0x789046[_0xdfff('0x62')]['id'],'ContactId':_0x24e5ce['id'],'AttachmentId':_0x789046['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xdfff('0xa7')],'as':_0xdfff('0xbb')}]})[_0xdfff('0x36')](function(_0x2089a7){return[_0x2089a7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xdfff('0xbc')](function(_0x21725f,_0x5519f6){if(_0x5519f6){return _0x21725f;}return db[_0xdfff('0xa7')]['create']({'direction':_0xdfff('0xb9'),'read':![],'body':_0x789046[_0xdfff('0x68')][_0xdfff('0xb0')][0x0][_0xdfff('0xba')],'FaxAccountId':_0x1a1ed3['id'],'FaxInteractionId':_0x21725f['id'],'UserId':_0x789046[_0xdfff('0x62')]['id'],'ContactId':_0x21725f['ContactId'],'AttachmentId':_0x789046['body'][_0xdfff('0xb0')][0x0]['id']})[_0xdfff('0x36')](function(_0x2cfd0a){_0x21725f[_0xdfff('0xbd')][_0xdfff('0xbb')]=[];_0x21725f[_0xdfff('0xbd')][_0xdfff('0xbb')]['push'](_0x2cfd0a[_0xdfff('0xbd')]);return _0x21725f;});})[_0xdfff('0x36')](function(_0x2c832e){respondWithRpcPromise(_0xdfff('0xbe'),_0xdfff('0xbe'),{'FaxAccountId':_['isNil'](_0x789046['params']['id'])?undefined:_0x789046['params']['id'],'path':_[_0xdfff('0xb4')](_0x789046[_0xdfff('0x68')][_0xdfff('0xb0')][0x0][_0xdfff('0x8')])?undefined:_0x789046['body']['attachments'][0x0]['path'],'fax':_['isNil'](_0x789046[_0xdfff('0x68')]['to'][0x0])?undefined:_0x789046[_0xdfff('0x68')]['to'][0x0],'AttachmentId':_0x789046['body'][_0xdfff('0xb0')][0x0]['id']},client9002)[_0xdfff('0x36')](function(_0x17a617){logger['info'](_0xdfff('0xbf'),_0x17a617);})[_0xdfff('0x29')](function(_0x2af31c){logger[_0xdfff('0x22')](_0xdfff('0xbf'),_0x2af31c);});return _0x2c832e;})[_0xdfff('0x36')](respondWithResult(_0x2261b1,null))[_0xdfff('0x29')](handleError(_0x2261b1,null));};exports[_0xdfff('0xc0')]=function(_0x5c36b3,_0x5ba25d,_0x23bb8b){return db[_0xdfff('0x57')][_0xdfff('0x60')]({'where':{'id':_0x5c36b3[_0xdfff('0x5d')]['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x5ba25d,null))[_0xdfff('0x36')](function(_0x3f095b){if(_0x3f095b){return _0x3f095b[_0xdfff('0xc0')](_0x5c36b3[_0xdfff('0x68')]['ids'],_['omit'](_0x5c36b3[_0xdfff('0x68')],['ids','id'])||{})[_0xdfff('0xbc')](function(_0x43aaa7){for(var _0x5d66b1=0x0;_0x5d66b1<_0x5c36b3[_0xdfff('0x68')][_0xdfff('0x70')]['length'];_0x5d66b1+=0x1){socket[_0xdfff('0xc1')](_0xdfff('0xc2'),{'UserId':Number(_0x5c36b3[_0xdfff('0x68')]['ids'][_0x5d66b1]),'FaxAccountId':Number(_0x5c36b3['params']['id'])});}return _0x43aaa7;});}})['then'](respondWithResult(_0x5ba25d,null))['catch'](handleError(_0x5ba25d,null));};exports[_0xdfff('0xc3')]=function(_0x23277a,_0x55305b,_0x55783b){return db[_0xdfff('0x57')][_0xdfff('0x60')]({'where':{'id':_0x23277a[_0xdfff('0x5d')]['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x55305b,null))['then'](function(_0x12d06){if(_0x12d06){return _0x12d06[_0xdfff('0xc3')](_0x23277a[_0xdfff('0x48')]['ids'])[_0xdfff('0x36')](function(){if(_[_0xdfff('0xc4')](_0x23277a['query']['ids'])){for(var _0x556e28=0x0;_0x556e28<_0x23277a[_0xdfff('0x48')][_0xdfff('0x70')][_0xdfff('0x4c')];_0x556e28+=0x1){socket[_0xdfff('0xc1')](_0xdfff('0xc5'),{'UserId':Number(_0x23277a[_0xdfff('0x48')]['ids'][_0x556e28]),'FaxAccountId':Number(_0x23277a[_0xdfff('0x5d')]['id'])});}}else{socket[_0xdfff('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x23277a[_0xdfff('0x48')][_0xdfff('0x70')]),'FaxAccountId':Number(_0x23277a['params']['id'])});}});}})[_0xdfff('0x36')](respondWithStatusCode(_0x55305b,null))[_0xdfff('0x29')](handleError(_0x55305b,null));};exports[_0xdfff('0xc6')]=function(_0xdcac68,_0x3f9064,_0x17b854){var _0x5dd68d={};var _0x4d6680={};var _0x386542;var _0x5c0b7d;return db[_0xdfff('0x57')]['findOne']({'where':{'id':_0xdcac68['params']['id']}})[_0xdfff('0x36')](handleEntityNotFound(_0x3f9064,null))[_0xdfff('0x36')](function(_0x10f54f){if(_0x10f54f){_0x386542=_0x10f54f;_0x4d6680[_0xdfff('0x47')]=_[_0xdfff('0x5e')](db[_0xdfff('0x7a')][_0xdfff('0x43')]);_0x4d6680[_0xdfff('0x48')]=_['keys'](_0xdcac68[_0xdfff('0x48')]);_0x4d6680[_0xdfff('0x52')]=_['intersection'](_0x4d6680[_0xdfff('0x47')],_0x4d6680[_0xdfff('0x48')]);_0x5dd68d[_0xdfff('0x4a')]=_[_0xdfff('0x49')](_0x4d6680['model'],qs[_0xdfff('0x4b')](_0xdcac68['query'][_0xdfff('0x4b')]));_0x5dd68d[_0xdfff('0x4a')]=_0x5dd68d[_0xdfff('0x4a')][_0xdfff('0x4c')]?_0x5dd68d[_0xdfff('0x4a')]:_0x4d6680[_0xdfff('0x47')];_0x5dd68d['order']=qs[_0xdfff('0x50')](_0xdcac68['query'][_0xdfff('0x50')]);_0x5dd68d['where']=qs[_0xdfff('0x52')](_[_0xdfff('0x53')](_0xdcac68['query'],_0x4d6680['filters']));if(_0xdcac68[_0xdfff('0x48')][_0xdfff('0x54')]){_0x5dd68d['where']=_[_0xdfff('0x55')](_0x5dd68d[_0xdfff('0x51')],{'$or':_[_0xdfff('0x42')](_0x5dd68d['attributes'],function(_0x4d99bd){var _0x301c96={};_0x301c96[_0x4d99bd]={'$like':'%'+_0xdcac68[_0xdfff('0x48')][_0xdfff('0x54')]+'%'};return _0x301c96;})});}_0x5dd68d=_[_0xdfff('0x55')]({},_0x5dd68d,_0xdcac68[_0xdfff('0x5f')]);return _0x386542[_0xdfff('0xc6')](_0x5dd68d);}})['then'](function(_0x544188){if(_0x544188){_0x5c0b7d=_0x544188[_0xdfff('0x4c')];if(!_0xdcac68[_0xdfff('0x48')][_0xdfff('0x4d')](_0xdfff('0x4e'))){_0x5dd68d['limit']=qs['limit'](_0xdcac68[_0xdfff('0x48')][_0xdfff('0x2e')]);_0x5dd68d[_0xdfff('0x2d')]=qs[_0xdfff('0x2d')](_0xdcac68[_0xdfff('0x48')]['offset']);}return _0x386542['getAgents'](_0x5dd68d);}})[_0xdfff('0x36')](function(_0x7f6785){if(_0x7f6785){return _0x7f6785?{'count':_0x5c0b7d,'rows':_0x7f6785}:null;}})[_0xdfff('0x36')](respondWithResult(_0x3f9064,null))[_0xdfff('0x29')](handleError(_0x3f9064,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index cdf4af0..94a5836 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 _0x7d62=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','remove'];(function(_0xcb8db6,_0x2cf36f){var _0x243c2b=function(_0x4534e9){while(--_0x4534e9){_0xcb8db6['push'](_0xcb8db6['shift']());}};_0x243c2b(++_0x2cf36f);}(_0x7d62,0x123));var _0x27d6=function(_0x57e18a,_0x199383){_0x57e18a=_0x57e18a-0x0;var _0x1181c7=_0x7d62[_0x57e18a];return _0x1181c7;};'use strict';var EventEmitter=require(_0x27d6('0x0'));var FaxAccount=require(_0x27d6('0x1'))['db'][_0x27d6('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x27d6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x27d6('0x4')};function emitEvent(_0x297ae2){return function(_0x7bcdac,_0x4d3b2b,_0x1953ca){FaxAccountEvents['emit'](_0x297ae2+':'+_0x7bcdac['id'],_0x7bcdac);FaxAccountEvents['emit'](_0x297ae2,_0x7bcdac);_0x1953ca(null);};}for(var e in events){if(events[_0x27d6('0x5')](e)){var event=events[e];FaxAccount[_0x27d6('0x6')](e,emitEvent(event));}}module[_0x27d6('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x7d87=['events','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x38cbdf,_0x4eb95f){var _0x20ebce=function(_0x2e9721){while(--_0x2e9721){_0x38cbdf['push'](_0x38cbdf['shift']());}};_0x20ebce(++_0x4eb95f);}(_0x7d87,0x178));var _0x77d8=function(_0xfdb2df,_0x5517ff){_0xfdb2df=_0xfdb2df-0x0;var _0x42dc28=_0x7d87[_0xfdb2df];return _0x42dc28;};'use strict';var EventEmitter=require(_0x77d8('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x77d8('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x77d8('0x2')](0x0);var events={'afterCreate':_0x77d8('0x3'),'afterUpdate':_0x77d8('0x4'),'afterDestroy':_0x77d8('0x5')};function emitEvent(_0xdd5dd2){return function(_0x539778,_0x3da7cd,_0x1e9096){FaxAccountEvents[_0x77d8('0x6')](_0xdd5dd2+':'+_0x539778['id'],_0x539778);FaxAccountEvents[_0x77d8('0x6')](_0xdd5dd2,_0x539778);_0x1e9096(null);};}for(var e in events){if(events[_0x77d8('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 14277e1..ddda2b5 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 _0xf811=['bluebird','request-promise','path','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','api'];(function(_0x33c875,_0x323b26){var _0x7a322d=function(_0x483e97){while(--_0x483e97){_0x33c875['push'](_0x33c875['shift']());}};_0x7a322d(++_0x323b26);}(_0xf811,0x126));var _0x1f81=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xf811[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x1f81('0x0'));var util=require('util');var logger=require(_0x1f81('0x1'))(_0x1f81('0x2'));var moment=require('moment');var BPromise=require(_0x1f81('0x3'));var rp=require(_0x1f81('0x4'));var fs=require('fs');var path=require(_0x1f81('0x5'));var rimraf=require('rimraf');var config=require(_0x1f81('0x6'));var attributes=require('./faxAccount.attributes');module[_0x1f81('0x7')]=function(_0x381c55,_0x30248f){return _0x381c55[_0x1f81('0x8')](_0x1f81('0x9'),attributes,{'tableName':_0x1f81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf80=['api','moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','../../config/logger'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xaf80,0x17e));var _0x0af8=function(_0x4a0740,_0x31d136){_0x4a0740=_0x4a0740-0x0;var _0x52e7e8=_0xaf80[_0x4a0740];return _0x52e7e8;};'use strict';var _=require(_0x0af8('0x0'));var util=require('util');var logger=require(_0x0af8('0x1'))(_0x0af8('0x2'));var moment=require(_0x0af8('0x3'));var BPromise=require('bluebird');var rp=require(_0x0af8('0x4'));var fs=require('fs');var path=require(_0x0af8('0x5'));var rimraf=require(_0x0af8('0x6'));var config=require(_0x0af8('0x7'));var attributes=require(_0x0af8('0x8'));module['exports']=function(_0x1e8c72,_0x5537aa){return _0x1e8c72[_0x0af8('0x9')](_0x0af8('0xa'),attributes,{'tableName':_0x0af8('0xb'),'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 15fa17c..ae45f9f 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 _0xcd38=['raw','where','attributes','limit','include','map','model','GetFaxAccount','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','body','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','Contacts','DESC','FaxApplication','Applications','applications','list','List','orderBy','priority','asc','length','create','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','close','unmanaged','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','catch','FaxAccount','options'];(function(_0x51f3e1,_0x57feab){var _0x2a09f7=function(_0xbc5955){while(--_0xbc5955){_0x51f3e1['push'](_0x51f3e1['shift']());}};_0x2a09f7(++_0x57feab);}(_0xcd38,0x14e));var _0x8cd3=function(_0x3e8ffb,_0x2e48a2){_0x3e8ffb=_0x3e8ffb-0x0;var _0x1d5d20=_0xcd38[_0x3e8ffb];return _0x1d5d20;};'use strict';var _=require(_0x8cd3('0x0'));var util=require(_0x8cd3('0x1'));var moment=require('moment');var BPromise=require(_0x8cd3('0x2'));var rs=require(_0x8cd3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cd3('0x4'))['db'];var utils=require(_0x8cd3('0x5'));var logger=require('../../config/logger')(_0x8cd3('0x6'));var config=require(_0x8cd3('0x7'));var jayson=require(_0x8cd3('0x8'));var client=jayson['client'][_0x8cd3('0x9')]({'port':0x232c});config[_0x8cd3('0xa')]=_[_0x8cd3('0xb')](config[_0x8cd3('0xa')],{'host':_0x8cd3('0xc'),'port':0x18eb});var socket=require(_0x8cd3('0xd'))(new Redis(config['redis']));require(_0x8cd3('0xe'))[_0x8cd3('0xf')](socket);function respondWithRpcPromise(_0x5141b3,_0xe5fde5,_0x4f5eeb){return new BPromise(function(_0x53bfec,_0x178b94){return client['request'](_0x5141b3,_0x4f5eeb)[_0x8cd3('0x10')](function(_0x1742e6){logger['info'](_0x8cd3('0x11'),_0xe5fde5,_0x8cd3('0x12'));logger[_0x8cd3('0x13')](_0x8cd3('0x14'),_0xe5fde5,_0x8cd3('0x12'),JSON['stringify'](_0x1742e6));if(_0x1742e6[_0x8cd3('0x15')]){if(_0x1742e6[_0x8cd3('0x15')]['code']===0x1f4){logger[_0x8cd3('0x15')](_0x8cd3('0x11'),_0xe5fde5,_0x1742e6['error']['message']);return _0x178b94(_0x1742e6[_0x8cd3('0x15')][_0x8cd3('0x16')]);}logger[_0x8cd3('0x15')](_0x8cd3('0x11'),_0xe5fde5,_0x1742e6[_0x8cd3('0x15')][_0x8cd3('0x16')]);return _0x53bfec(_0x1742e6['error'][_0x8cd3('0x16')]);}else{logger['info'](_0x8cd3('0x11'),_0xe5fde5,_0x8cd3('0x12'));_0x53bfec(_0x1742e6['result'][_0x8cd3('0x16')]);}})[_0x8cd3('0x17')](function(_0x54974a){logger[_0x8cd3('0x15')](_0x8cd3('0x11'),_0xe5fde5,_0x54974a);_0x178b94(_0x54974a);});});}exports['GetFaxAccount']=function(_0x454b22){var _0x134fe7=this;return new Promise(function(_0x167d3e,_0x2e1f8d){return db[_0x8cd3('0x18')]['findAll']({'raw':_0x454b22['options']?_0x454b22[_0x8cd3('0x19')][_0x8cd3('0x1a')]===undefined?!![]:![]:!![],'where':_0x454b22[_0x8cd3('0x19')]?_0x454b22[_0x8cd3('0x19')][_0x8cd3('0x1b')]||null:null,'attributes':_0x454b22['options']?_0x454b22[_0x8cd3('0x19')][_0x8cd3('0x1c')]||null:null,'limit':_0x454b22['options']?_0x454b22[_0x8cd3('0x19')][_0x8cd3('0x1d')]||null:null,'include':_0x454b22[_0x8cd3('0x19')]?_0x454b22[_0x8cd3('0x19')][_0x8cd3('0x1e')]?_[_0x8cd3('0x1f')](_0x454b22[_0x8cd3('0x19')][_0x8cd3('0x1e')],function(_0x1bc468){return{'model':db[_0x1bc468['model']],'as':_0x1bc468['as'],'attributes':_0x1bc468[_0x8cd3('0x1c')],'include':_0x1bc468['include']?_['map'](_0x1bc468[_0x8cd3('0x1e')],function(_0x294306){return{'model':db[_0x294306[_0x8cd3('0x20')]],'as':_0x294306['as'],'attributes':_0x294306[_0x8cd3('0x1c')],'include':_0x294306[_0x8cd3('0x1e')]?_[_0x8cd3('0x1f')](_0x294306[_0x8cd3('0x1e')],function(_0xa42bde){return{'model':db[_0xa42bde[_0x8cd3('0x20')]],'as':_0xa42bde['as'],'attributes':_0xa42bde[_0x8cd3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8cd3('0x10')](function(_0x544e24){logger['info']('GetFaxAccount',_0x454b22);logger['debug'](_0x8cd3('0x21'),_0x454b22,JSON[_0x8cd3('0x22')](_0x544e24));_0x167d3e(_0x544e24);})['catch'](function(_0x3809be){logger['error'](_0x8cd3('0x21'),_0x3809be[_0x8cd3('0x16')],_0x454b22);_0x2e1f8d(_0x134fe7[_0x8cd3('0x15')](0x1f4,_0x3809be['message']));});});};exports[_0x8cd3('0x23')]=function(_0x5427fc,_0x1da240,_0x597812){var _0x32d8bf=this;return new Promise(function(_0x546498,_0x2d795e){var _0x3208e3={'body':_0x5427fc['body'],'channel':_0x8cd3('0x24')};var _0x101c9f=[];var _0x463ef1=[];var _0x528009={};return db[_0x8cd3('0x25')][_0x8cd3('0x26')]()[_0x8cd3('0x10')](function(_0x8f3ba2){if(!_0x8f3ba2){throw new db[(_0x8cd3('0x27'))]['ValidationError'](_0x8cd3('0x28'));}_0x101c9f=_['difference'](_['keys'](_0x8f3ba2),[_0x8cd3('0x29'),_0x8cd3('0x2a')]);_0x463ef1=_[_0x8cd3('0x2b')](_['keys'](_0x8f3ba2),[_0x8cd3('0x29'),_0x8cd3('0x2a'),_0x8cd3('0x2c'),_0x8cd3('0x2d')]);if(_0x5427fc[_0x8cd3('0x2e')]['id']){delete _0x5427fc[_0x8cd3('0x2e')]['id'];}if(_['isNil'](_0x5427fc[_0x8cd3('0x2e')][_0x8cd3('0x2f')])){throw new db[(_0x8cd3('0x27'))][(_0x8cd3('0x30'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5427fc['body']['body'])||_0x5427fc[_0x8cd3('0x2e')]['body']===''){throw new db[(_0x8cd3('0x27'))]['ValidationError'](_0x8cd3('0x31'));}if(_[_0x8cd3('0x32')](_0x5427fc[_0x8cd3('0x2e')][_0x8cd3('0x33')])){throw new db[(_0x8cd3('0x27'))][(_0x8cd3('0x30'))](_0x8cd3('0x34')+_0x463ef1);}if(!_[_0x8cd3('0x35')](_0x463ef1,_0x5427fc[_0x8cd3('0x2e')][_0x8cd3('0x33')])){throw new db[(_0x8cd3('0x27'))][(_0x8cd3('0x30'))](_0x8cd3('0x36')+_0x463ef1);}_0x528009[_0x5427fc[_0x8cd3('0x2e')]['mapKey']]=_0x5427fc[_0x8cd3('0x2e')][_0x8cd3('0x2f')];})['then'](function(){return db['FaxAccount'][_0x8cd3('0x37')]({'where':{'id':_0x5427fc[_0x8cd3('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8cd3('0x25')],'as':_0x8cd3('0x39'),'where':_0x528009,'limit':0x1,'order':[[_0x8cd3('0x2a'),_0x8cd3('0x3a')]]}]},{'model':db[_0x8cd3('0x3b')],'as':_0x8cd3('0x3c')}]});})[_0x8cd3('0x10')](function(_0x1afe76){if(_0x1afe76&&_0x1afe76['List']){var _0x14be38=_0x1afe76['get']({'plain':!![]});_0x3208e3[_0x8cd3('0x38')]=_0x14be38;_0x3208e3[_0x8cd3('0x3d')]=_0x14be38[_0x8cd3('0x3c')];_0x3208e3[_0x8cd3('0x3e')]=_0x14be38[_0x8cd3('0x3f')];_0x3208e3['applications']=_[_0x8cd3('0x40')](_0x3208e3['applications'],[_0x8cd3('0x41')],[_0x8cd3('0x42')]);if(_0x3208e3['account'][_0x8cd3('0x3c')]){delete _0x3208e3['account']['Applications'];}if(_0x3208e3[_0x8cd3('0x38')][_0x8cd3('0x3f')]&&_0x3208e3[_0x8cd3('0x38')]['List']['Contacts'][_0x8cd3('0x43')]){return _0x3208e3[_0x8cd3('0x38')][_0x8cd3('0x3f')][_0x8cd3('0x39')][0x0];}var _0x357e72=_[_0x8cd3('0xb')](_0x5427fc[_0x8cd3('0x2e')],{'firstName':_0x5427fc['body'][_0x8cd3('0x2f')],'ListId':_0x14be38['ListId']});_0x357e72[_0x5427fc[_0x8cd3('0x2e')][_0x8cd3('0x33')]]=_0x5427fc[_0x8cd3('0x2e')][_0x8cd3('0x2f')];return db[_0x8cd3('0x25')][_0x8cd3('0x44')](_0x357e72,{'fields':_0x101c9f,'raw':!![]});}})[_0x8cd3('0x10')](function(_0x386e18){_0x3208e3['contact']=_0x386e18;if(_0x386e18){var _0x14ad24={'ContactId':_0x386e18['id'],'FaxAccountId':_0x5427fc[_0x8cd3('0x38')]['id'],'fax':_0x386e18[_0x8cd3('0x24')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x386e18['id'],'closed':![],'FaxAccountId':_0x5427fc[_0x8cd3('0x38')]['id']}})[_0x8cd3('0x10')](function(_0xa7262){if(_0xa7262){return[_0xa7262,![]];}return db[_0x8cd3('0x45')][_0x8cd3('0x44')](_0x14ad24)[_0x8cd3('0x10')](function(_0x500032){return[_0x500032,!![]];});});}else{throw new Error(_0x8cd3('0x46'));}})[_0x8cd3('0x47')](function(_0x27da74,_0x35d45c){var _0x2bf178=_0x27da74[_0x8cd3('0x48')]({'plain':!![]});if(_0x35d45c){if(_0x3208e3[_0x8cd3('0x38')][_0x8cd3('0x49')]){_0x3208e3[_0x8cd3('0x3d')][_0x8cd3('0x4a')]({'id':0x0,'priority':_0x3208e3[_0x8cd3('0x3d')]['length']+0x1,'app':_0x8cd3('0x4b'),'appdata':_0x8cd3('0x4c'),'interval':'*,*,*,*'});}_0x2bf178[_0x8cd3('0x4d')]=!![];}else{_0x2bf178[_0x8cd3('0x4d')]=![];}_0x3208e3['interaction']=_0x2bf178;return db[_0x8cd3('0x4e')][_0x8cd3('0x44')]({'body':_0x5427fc[_0x8cd3('0x2e')][_0x8cd3('0x2e')],'FaxAccountId':_0x5427fc[_0x8cd3('0x38')]['id'],'FaxInteractionId':_0x27da74['id'],'direction':'in','ContactId':_0x27da74[_0x8cd3('0x4f')],'AttachmentId':_0x5427fc[_0x8cd3('0x2e')][_0x8cd3('0x50')]});})[_0x8cd3('0x10')](function(_0x4d92ed){_0x3208e3[_0x8cd3('0x16')]=_0x4d92ed;if(_0x3208e3[_0x8cd3('0x51')][_0x8cd3('0x52')]){return db[_0x8cd3('0x53')][_0x8cd3('0x37')]({'attributes':['id',_0x8cd3('0x54')],'where':{'id':_0x3208e3[_0x8cd3('0x51')][_0x8cd3('0x52')]}})[_0x8cd3('0x10')](function(_0x196e00){if(_0x196e00){_0x3208e3[_0x8cd3('0x3d')][_0x8cd3('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x196e00[_0x8cd3('0x54')]+','+(_0x3208e3[_0x8cd3('0x38')][_0x8cd3('0x56')]||0xa),'interval':_0x8cd3('0x57')});}return respondWithRpcPromise(_0x8cd3('0x58'),'startRouting',_0x3208e3);});}return respondWithRpcPromise(_0x8cd3('0x58'),_0x8cd3('0x59'),_0x3208e3);})['then'](function(_0x5ad471){_0x546498(_0x5ad471);})['catch'](function(_0x2e8ae4){_0x2d795e(_0x32d8bf[_0x8cd3('0x15')](0x1f4,_0x2e8ae4[_0x8cd3('0x16')]));});});}; \ No newline at end of file +var _0x2ad3=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','limit','include','map','model','attributes','NotifyFaxAccount','body','fax','CmContact','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','priority','asc','length','create','contact','find','FaxInteraction','spread','get','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','Start','startRouting','lodash','util'];(function(_0x4ec520,_0x15fee2){var _0xed49d7=function(_0x3031f2){while(--_0x3031f2){_0x4ec520['push'](_0x4ec520['shift']());}};_0xed49d7(++_0x15fee2);}(_0x2ad3,0x1bb));var _0x32ad=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x2ad3[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x32ad('0x0'));var util=require(_0x32ad('0x1'));var moment=require(_0x32ad('0x2'));var BPromise=require(_0x32ad('0x3'));var rs=require(_0x32ad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32ad('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x32ad('0x6'))(_0x32ad('0x7'));var config=require(_0x32ad('0x8'));var jayson=require(_0x32ad('0x9'));var client=jayson['client'][_0x32ad('0xa')]({'port':0x232c});config[_0x32ad('0xb')]=_[_0x32ad('0xc')](config[_0x32ad('0xb')],{'host':_0x32ad('0xd'),'port':0x18eb});var socket=require(_0x32ad('0xe'))(new Redis(config[_0x32ad('0xb')]));require(_0x32ad('0xf'))[_0x32ad('0x10')](socket);function respondWithRpcPromise(_0x505901,_0x566f60,_0x28423d){return new BPromise(function(_0x5a8e49,_0x28df3c){return client['request'](_0x505901,_0x28423d)[_0x32ad('0x11')](function(_0x40d464){logger[_0x32ad('0x12')]('FaxAccount,\x20%s,\x20%s',_0x566f60,'request\x20sent');logger[_0x32ad('0x13')](_0x32ad('0x14'),_0x566f60,_0x32ad('0x15'),JSON[_0x32ad('0x16')](_0x40d464));if(_0x40d464[_0x32ad('0x17')]){if(_0x40d464[_0x32ad('0x17')]['code']===0x1f4){logger[_0x32ad('0x17')](_0x32ad('0x18'),_0x566f60,_0x40d464['error'][_0x32ad('0x19')]);return _0x28df3c(_0x40d464[_0x32ad('0x17')][_0x32ad('0x19')]);}logger[_0x32ad('0x17')](_0x32ad('0x18'),_0x566f60,_0x40d464[_0x32ad('0x17')]['message']);return _0x5a8e49(_0x40d464[_0x32ad('0x17')][_0x32ad('0x19')]);}else{logger[_0x32ad('0x12')](_0x32ad('0x18'),_0x566f60,_0x32ad('0x15'));_0x5a8e49(_0x40d464[_0x32ad('0x1a')]['message']);}})[_0x32ad('0x1b')](function(_0x307559){logger['error']('FaxAccount,\x20%s,\x20%s',_0x566f60,_0x307559);_0x28df3c(_0x307559);});});}exports[_0x32ad('0x1c')]=function(_0x2035b1){var _0x23d4e1=this;return new Promise(function(_0x25e87c,_0x5a3439){return db[_0x32ad('0x1d')][_0x32ad('0x1e')]({'raw':_0x2035b1['options']?_0x2035b1['options']['raw']===undefined?!![]:![]:!![],'where':_0x2035b1[_0x32ad('0x1f')]?_0x2035b1[_0x32ad('0x1f')][_0x32ad('0x20')]||null:null,'attributes':_0x2035b1[_0x32ad('0x1f')]?_0x2035b1[_0x32ad('0x1f')]['attributes']||null:null,'limit':_0x2035b1['options']?_0x2035b1[_0x32ad('0x1f')][_0x32ad('0x21')]||null:null,'include':_0x2035b1['options']?_0x2035b1[_0x32ad('0x1f')][_0x32ad('0x22')]?_[_0x32ad('0x23')](_0x2035b1[_0x32ad('0x1f')][_0x32ad('0x22')],function(_0x1d78b7){return{'model':db[_0x1d78b7[_0x32ad('0x24')]],'as':_0x1d78b7['as'],'attributes':_0x1d78b7[_0x32ad('0x25')],'include':_0x1d78b7[_0x32ad('0x22')]?_[_0x32ad('0x23')](_0x1d78b7[_0x32ad('0x22')],function(_0x23b22b){return{'model':db[_0x23b22b[_0x32ad('0x24')]],'as':_0x23b22b['as'],'attributes':_0x23b22b['attributes'],'include':_0x23b22b[_0x32ad('0x22')]?_['map'](_0x23b22b[_0x32ad('0x22')],function(_0x521b19){return{'model':db[_0x521b19[_0x32ad('0x24')]],'as':_0x521b19['as'],'attributes':_0x521b19[_0x32ad('0x25')]};}):[]};}):[]};}):[]:[]})[_0x32ad('0x11')](function(_0xbd487){logger['info'](_0x32ad('0x1c'),_0x2035b1);logger[_0x32ad('0x13')](_0x32ad('0x1c'),_0x2035b1,JSON['stringify'](_0xbd487));_0x25e87c(_0xbd487);})['catch'](function(_0x13ab91){logger[_0x32ad('0x17')]('GetFaxAccount',_0x13ab91[_0x32ad('0x19')],_0x2035b1);_0x5a3439(_0x23d4e1['error'](0x1f4,_0x13ab91[_0x32ad('0x19')]));});});};exports[_0x32ad('0x26')]=function(_0x314c69,_0x7f9bb5,_0x43b9d5){var _0x3e88e2=this;return new Promise(function(_0x16f58b,_0x579aa4){var _0x26eddf={'body':_0x314c69[_0x32ad('0x27')],'channel':_0x32ad('0x28')};var _0x8e030b=[];var _0x49521b=[];var _0x4b6f70={};return db[_0x32ad('0x29')]['describe']()[_0x32ad('0x11')](function(_0x4bc291){if(!_0x4bc291){throw new db['Sequelize'][(_0x32ad('0x2a'))]('no\x20available\x20attributes');}_0x8e030b=_[_0x32ad('0x2b')](_[_0x32ad('0x2c')](_0x4bc291),[_0x32ad('0x2d'),_0x32ad('0x2e')]);_0x49521b=_[_0x32ad('0x2b')](_[_0x32ad('0x2c')](_0x4bc291),[_0x32ad('0x2d'),_0x32ad('0x2e'),_0x32ad('0x2f'),_0x32ad('0x30')]);if(_0x314c69[_0x32ad('0x27')]['id']){delete _0x314c69[_0x32ad('0x27')]['id'];}if(_[_0x32ad('0x31')](_0x314c69[_0x32ad('0x27')][_0x32ad('0x32')])){throw new db[(_0x32ad('0x33'))][(_0x32ad('0x2a'))]('from\x20is\x20mandatory');}if(_[_0x32ad('0x31')](_0x314c69[_0x32ad('0x27')][_0x32ad('0x27')])||_0x314c69[_0x32ad('0x27')][_0x32ad('0x27')]===''){throw new db[(_0x32ad('0x33'))][(_0x32ad('0x2a'))](_0x32ad('0x34'));}if(_[_0x32ad('0x31')](_0x314c69[_0x32ad('0x27')][_0x32ad('0x35')])){throw new db['Sequelize'][(_0x32ad('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49521b);}if(!_[_0x32ad('0x36')](_0x49521b,_0x314c69[_0x32ad('0x27')][_0x32ad('0x35')])){throw new db[(_0x32ad('0x33'))][(_0x32ad('0x2a'))](_0x32ad('0x37')+_0x49521b);}_0x4b6f70[_0x314c69[_0x32ad('0x27')]['mapKey']]=_0x314c69['body'][_0x32ad('0x32')];})[_0x32ad('0x11')](function(){return db[_0x32ad('0x1d')]['find']({'where':{'id':_0x314c69[_0x32ad('0x38')]['id']},'include':[{'model':db[_0x32ad('0x39')],'as':_0x32ad('0x3a'),'include':[{'model':db[_0x32ad('0x29')],'as':_0x32ad('0x3b'),'where':_0x4b6f70,'limit':0x1,'order':[[_0x32ad('0x2e'),_0x32ad('0x3c')]]}]},{'model':db[_0x32ad('0x3d')],'as':_0x32ad('0x3e')}]});})['then'](function(_0xe1c4bf){if(_0xe1c4bf&&_0xe1c4bf['List']){var _0x44e27a=_0xe1c4bf['get']({'plain':!![]});_0x26eddf[_0x32ad('0x38')]=_0x44e27a;_0x26eddf[_0x32ad('0x3f')]=_0x44e27a[_0x32ad('0x3e')];_0x26eddf['list']=_0x44e27a[_0x32ad('0x3a')];_0x26eddf['applications']=_['orderBy'](_0x26eddf[_0x32ad('0x3f')],[_0x32ad('0x40')],[_0x32ad('0x41')]);if(_0x26eddf[_0x32ad('0x38')][_0x32ad('0x3e')]){delete _0x26eddf[_0x32ad('0x38')][_0x32ad('0x3e')];}if(_0x26eddf[_0x32ad('0x38')][_0x32ad('0x3a')]&&_0x26eddf[_0x32ad('0x38')][_0x32ad('0x3a')][_0x32ad('0x3b')][_0x32ad('0x42')]){return _0x26eddf['account'][_0x32ad('0x3a')][_0x32ad('0x3b')][0x0];}var _0x347a6a=_['defaults'](_0x314c69[_0x32ad('0x27')],{'firstName':_0x314c69['body'][_0x32ad('0x32')],'ListId':_0x44e27a[_0x32ad('0x30')]});_0x347a6a[_0x314c69[_0x32ad('0x27')][_0x32ad('0x35')]]=_0x314c69['body'][_0x32ad('0x32')];return db[_0x32ad('0x29')][_0x32ad('0x43')](_0x347a6a,{'fields':_0x8e030b,'raw':!![]});}})[_0x32ad('0x11')](function(_0x13b096){_0x26eddf[_0x32ad('0x44')]=_0x13b096;if(_0x13b096){var _0x40123e={'ContactId':_0x13b096['id'],'FaxAccountId':_0x314c69['account']['id'],'fax':_0x13b096['fax']};return db['FaxInteraction'][_0x32ad('0x45')]({'where':{'ContactId':_0x13b096['id'],'closed':![],'FaxAccountId':_0x314c69[_0x32ad('0x38')]['id']}})[_0x32ad('0x11')](function(_0x1574c9){if(_0x1574c9){return[_0x1574c9,![]];}return db[_0x32ad('0x46')][_0x32ad('0x43')](_0x40123e)[_0x32ad('0x11')](function(_0xd79d57){return[_0xd79d57,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x32ad('0x47')](function(_0x34bb27,_0x232645){var _0x41033c=_0x34bb27[_0x32ad('0x48')]({'plain':!![]});if(_0x232645){if(_0x26eddf[_0x32ad('0x38')][_0x32ad('0x49')]){_0x26eddf['applications'][_0x32ad('0x4a')]({'id':0x0,'priority':_0x26eddf[_0x32ad('0x3f')][_0x32ad('0x42')]+0x1,'app':'close','appdata':_0x32ad('0x4b'),'interval':_0x32ad('0x4c')});}_0x41033c[_0x32ad('0x4d')]=!![];}else{_0x41033c[_0x32ad('0x4d')]=![];}_0x26eddf[_0x32ad('0x4e')]=_0x41033c;return db[_0x32ad('0x4f')][_0x32ad('0x43')]({'body':_0x314c69['body'][_0x32ad('0x27')],'FaxAccountId':_0x314c69[_0x32ad('0x38')]['id'],'FaxInteractionId':_0x34bb27['id'],'direction':'in','ContactId':_0x34bb27[_0x32ad('0x50')],'AttachmentId':_0x314c69[_0x32ad('0x27')][_0x32ad('0x51')]});})[_0x32ad('0x11')](function(_0x19119c){_0x26eddf[_0x32ad('0x19')]=_0x19119c;if(_0x26eddf[_0x32ad('0x4e')][_0x32ad('0x52')]){return db[_0x32ad('0x53')][_0x32ad('0x45')]({'attributes':['id',_0x32ad('0x54')],'where':{'id':_0x26eddf[_0x32ad('0x4e')][_0x32ad('0x52')]}})['then'](function(_0x5bd436){if(_0x5bd436){_0x26eddf[_0x32ad('0x3f')][_0x32ad('0x55')]({'id':0x0,'priority':0x0,'app':_0x32ad('0x56'),'appdata':_0x5bd436[_0x32ad('0x54')]+','+(_0x26eddf[_0x32ad('0x38')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ad('0x57'),'startRouting',_0x26eddf);});}return respondWithRpcPromise(_0x32ad('0x57'),_0x32ad('0x58'),_0x26eddf);})[_0x32ad('0x11')](function(_0x1fcd13){_0x16f58b(_0x1fcd13);})[_0x32ad('0x1b')](function(_0x448f2b){_0x579aa4(_0x3e88e2[_0x32ad('0x17')](0x1f4,_0x448f2b[_0x32ad('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 7da2e48..d3cb7c0 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 _0xe792=['removeListener','register','./faxAccount.events','save','remove','update','emit'];(function(_0x3e1936,_0xbfa630){var _0x171f4a=function(_0x26665f){while(--_0x26665f){_0x3e1936['push'](_0x3e1936['shift']());}};_0x171f4a(++_0xbfa630);}(_0xe792,0x1bb));var _0x2e79=function(_0x630c80,_0x303623){_0x630c80=_0x630c80-0x0;var _0x31b2e1=_0xe792[_0x630c80];return _0x31b2e1;};'use strict';var FaxAccountEvents=require(_0x2e79('0x0'));var events=[_0x2e79('0x1'),_0x2e79('0x2'),_0x2e79('0x3')];function createListener(_0x3cba97,_0x2bdacd){return function(_0x5837a2){_0x2bdacd[_0x2e79('0x4')](_0x3cba97,_0x5837a2);};}function removeListener(_0x2ed25d,_0x63b49a){return function(){FaxAccountEvents[_0x2e79('0x5')](_0x2ed25d,_0x63b49a);};}exports[_0x2e79('0x6')]=function(_0x57dde1){for(var _0x34f985=0x0,_0x349711=events['length'];_0x34f985<_0x349711;_0x34f985++){var _0x52266d=events[_0x34f985];var _0x4776c5=createListener('faxAccount:'+_0x52266d,_0x57dde1);FaxAccountEvents['on'](_0x52266d,_0x4776c5);}}; \ No newline at end of file +var _0x52d5=['emit','register','./faxAccount.events','save','update'];(function(_0x277cdb,_0x20161e){var _0x5d7639=function(_0x2b5ef2){while(--_0x2b5ef2){_0x277cdb['push'](_0x277cdb['shift']());}};_0x5d7639(++_0x20161e);}(_0x52d5,0x93));var _0x552d=function(_0x1278ea,_0x304fc2){_0x1278ea=_0x1278ea-0x0;var _0x54ff7e=_0x52d5[_0x1278ea];return _0x54ff7e;};'use strict';var FaxAccountEvents=require(_0x552d('0x0'));var events=[_0x552d('0x1'),'remove',_0x552d('0x2')];function createListener(_0x1fa5f4,_0x22144a){return function(_0x1e6ab2){_0x22144a[_0x552d('0x3')](_0x1fa5f4,_0x1e6ab2);};}function removeListener(_0x399390,_0x19767c){return function(){FaxAccountEvents['removeListener'](_0x399390,_0x19767c);};}exports[_0x552d('0x4')]=function(_0x367308){for(var _0x431529=0x0,_0x42ab26=events['length'];_0x431529<_0x42ab26;_0x431529++){var _0x5665a5=events[_0x431529];var _0x5b8975=createListener('faxAccount:'+_0x5665a5,_0x367308);FaxAccountEvents['on'](_0x5665a5,_0x5b8975);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7be6bd9..98df19c 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(_0x129422,_0x4af03c){var _0x3f7f3a=function(_0x1b1fcd){while(--_0x1b1fcd){_0x129422['push'](_0x129422['shift']());}};_0x3f7f3a(++_0x4af03c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/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(_0x2716b1,_0x5064d6){var _0x3625e8=function(_0x21e5fb){while(--_0x21e5fb){_0x2716b1['push'](_0x2716b1['shift']());}};_0x3625e8(++_0x5064d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 a9c9f1b..14f843b 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 _0x1ba6=['sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x1e7158,_0xd669b2){var _0x2f7967=function(_0x3d25ae){while(--_0x3d25ae){_0x1e7158['push'](_0x1e7158['shift']());}};_0x2f7967(++_0xd669b2);}(_0x1ba6,0x186));var _0x61ba=function(_0x1e3e7b,_0x52d0ff){_0x1e3e7b=_0x1e3e7b-0x0;var _0x1b7734=_0x1ba6[_0x1e3e7b];return _0x1b7734;};'use strict';var Sequelize=require(_0x61ba('0x0'));module[_0x61ba('0x1')]={'priority':{'type':Sequelize[_0x61ba('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x61ba('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x61ba('0x4')]()},'description':{'type':Sequelize[_0x61ba('0x3')]},'interval':{'type':Sequelize[_0x61ba('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfffa=['TEXT','STRING','INTEGER','noop'];(function(_0x396d0d,_0x1ed99c){var _0x28afe1=function(_0xcb935e){while(--_0xcb935e){_0x396d0d['push'](_0x396d0d['shift']());}};_0x28afe1(++_0x1ed99c);}(_0xfffa,0x15e));var _0xafff=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xfffa[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xafff('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xafff('0x1')},'appdata':{'type':Sequelize[_0xafff('0x2')]()},'description':{'type':Sequelize[_0xafff('0x3')]},'interval':{'type':Sequelize[_0xafff('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c41f700..9100073 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 _0x8f7e=['fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','keys','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','FaxApplication'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x8f7e,0x1d2));var _0xe8f7=function(_0x10a280,_0x16b373){_0x10a280=_0x10a280-0x0;var _0x195a69=_0x8f7e[_0x10a280];return _0x195a69;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe8f7('0x0'));var jsonpatch=require(_0xe8f7('0x1'));var rp=require(_0xe8f7('0x2'));var moment=require(_0xe8f7('0x3'));var BPromise=require(_0xe8f7('0x4'));var Mustache=require(_0xe8f7('0x5'));var util=require('util');var path=require(_0xe8f7('0x6'));var sox=require('sox');var csv=require(_0xe8f7('0x7'));var ejs=require(_0xe8f7('0x8'));var fs=require('fs');var fs_extra=require(_0xe8f7('0x9'));var _=require(_0xe8f7('0xa'));var squel=require(_0xe8f7('0xb'));var crypto=require('crypto');var jsforce=require(_0xe8f7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe8f7('0xd'));var Papa=require(_0xe8f7('0xe'));var Redis=require(_0xe8f7('0xf'));var authService=require(_0xe8f7('0x10'));var qs=require(_0xe8f7('0x11'));var as=require(_0xe8f7('0x12'));var hardwareService=require(_0xe8f7('0x13'));var logger=require(_0xe8f7('0x14'))('api');var utils=require(_0xe8f7('0x15'));var config=require(_0xe8f7('0x16'));var licenseUtil=require(_0xe8f7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d87a1,_0x4e7f92){_0x4e7f92=_0x4e7f92||0xcc;return function(_0x1983be){if(_0x1983be){return _0x3d87a1[_0xe8f7('0x18')](_0x4e7f92);}return _0x3d87a1[_0xe8f7('0x19')](_0x4e7f92)[_0xe8f7('0x1a')]();};}function respondWithResult(_0x3caaa5,_0x2acf5e){_0x2acf5e=_0x2acf5e||0xc8;return function(_0x129388){if(_0x129388){return _0x3caaa5[_0xe8f7('0x19')](_0x2acf5e)[_0xe8f7('0x1b')](_0x129388);}};}function respondWithFilteredResult(_0x11690d,_0x4e39d2){return function(_0x25375d){if(_0x25375d){var _0x52f051=typeof _0x4e39d2[_0xe8f7('0x1c')]===_0xe8f7('0x1d')&&typeof _0x4e39d2[_0xe8f7('0x1e')]==='undefined';var _0x11336d=_0x25375d[_0xe8f7('0x1f')];var _0x2aa42e=_0x52f051?0x0:_0x4e39d2[_0xe8f7('0x1c')];var _0x459827=_0x52f051?_0x25375d[_0xe8f7('0x1f')]:_0x4e39d2[_0xe8f7('0x1c')]+_0x4e39d2['limit'];var _0x43111f;if(_0x459827>=_0x11336d){_0x459827=_0x11336d;_0x43111f=0xc8;}else{_0x43111f=0xce;}_0x11690d[_0xe8f7('0x19')](_0x43111f);return _0x11690d[_0xe8f7('0x20')]('Content-Range',_0x2aa42e+'-'+_0x459827+'/'+_0x11336d)[_0xe8f7('0x1b')](_0x25375d);}return null;};}function patchUpdates(_0xe403ac){return function(_0xdc85b9){try{jsonpatch[_0xe8f7('0x21')](_0xdc85b9,_0xe403ac,!![]);}catch(_0x824935){return BPromise[_0xe8f7('0x22')](_0x824935);}return _0xdc85b9[_0xe8f7('0x23')]();};}function saveUpdates(_0x3a815d,_0x116ba5){return function(_0xc97171){if(_0xc97171){return _0xc97171[_0xe8f7('0x24')](_0x3a815d)[_0xe8f7('0x25')](function(_0xfe86ca){return _0xfe86ca;});}return null;};}function removeEntity(_0x6bc319,_0x37cb1f){return function(_0xc30307){if(_0xc30307){return _0xc30307[_0xe8f7('0x26')]()[_0xe8f7('0x25')](function(){_0x6bc319[_0xe8f7('0x19')](0xcc)[_0xe8f7('0x1a')]();});}};}function handleEntityNotFound(_0x43a9da,_0x45eefa){return function(_0xa22c2c){if(!_0xa22c2c){_0x43a9da[_0xe8f7('0x18')](0x194);}return _0xa22c2c;};}function handleError(_0xe3b12e,_0x1a92f8){_0x1a92f8=_0x1a92f8||0x1f4;return function(_0xde2ad4){logger[_0xe8f7('0x27')](_0xde2ad4[_0xe8f7('0x28')]);if(_0xde2ad4[_0xe8f7('0x29')]){delete _0xde2ad4[_0xe8f7('0x29')];}_0xe3b12e[_0xe8f7('0x19')](_0x1a92f8)['send'](_0xde2ad4);};}exports[_0xe8f7('0x2a')]=function(_0x2e58d9,_0x29b272){var _0xdef6d4={},_0x1aec06={},_0x1b2963={'count':0x0,'rows':[]};var _0x3c35b2=_[_0xe8f7('0x2b')](db[_0xe8f7('0x2c')]['rawAttributes'],function(_0x2ddcc8){return{'name':_0x2ddcc8[_0xe8f7('0x2d')],'type':_0x2ddcc8[_0xe8f7('0x2e')]['key']};});_0x1aec06['model']=_[_0xe8f7('0x2b')](_0x3c35b2,_0xe8f7('0x29'));_0x1aec06[_0xe8f7('0x2f')]=_['keys'](_0x2e58d9[_0xe8f7('0x2f')]);_0x1aec06['filters']=_[_0xe8f7('0x30')](_0x1aec06[_0xe8f7('0x31')],_0x1aec06[_0xe8f7('0x2f')]);_0xdef6d4[_0xe8f7('0x32')]=_[_0xe8f7('0x30')](_0x1aec06[_0xe8f7('0x31')],qs[_0xe8f7('0x33')](_0x2e58d9[_0xe8f7('0x2f')][_0xe8f7('0x33')]));_0xdef6d4[_0xe8f7('0x32')]=_0xdef6d4['attributes'][_0xe8f7('0x34')]?_0xdef6d4[_0xe8f7('0x32')]:_0x1aec06['model'];if(!_0x2e58d9[_0xe8f7('0x2f')][_0xe8f7('0x35')]('nolimit')){_0xdef6d4['limit']=qs[_0xe8f7('0x1e')](_0x2e58d9[_0xe8f7('0x2f')][_0xe8f7('0x1e')]);_0xdef6d4[_0xe8f7('0x1c')]=qs[_0xe8f7('0x1c')](_0x2e58d9[_0xe8f7('0x2f')][_0xe8f7('0x1c')]);}_0xdef6d4['order']=qs[_0xe8f7('0x36')](_0x2e58d9[_0xe8f7('0x2f')][_0xe8f7('0x36')]);_0xdef6d4[_0xe8f7('0x37')]=qs[_0xe8f7('0x38')](_[_0xe8f7('0x39')](_0x2e58d9[_0xe8f7('0x2f')],_0x1aec06[_0xe8f7('0x38')]),_0x3c35b2);if(_0x2e58d9[_0xe8f7('0x2f')][_0xe8f7('0x3a')]){_0xdef6d4[_0xe8f7('0x37')]=_[_0xe8f7('0x3b')](_0xdef6d4[_0xe8f7('0x37')],{'$or':_['map'](_0x3c35b2,function(_0x4c4519){if(_0x4c4519[_0xe8f7('0x2e')]!==_0xe8f7('0x3c')){var _0x1228a8={};_0x1228a8[_0x4c4519[_0xe8f7('0x29')]]={'$like':'%'+_0x2e58d9[_0xe8f7('0x2f')][_0xe8f7('0x3a')]+'%'};return _0x1228a8;}})});}_0xdef6d4=_[_0xe8f7('0x3b')]({},_0xdef6d4,_0x2e58d9[_0xe8f7('0x3d')]);var _0x39e843={'where':_0xdef6d4['where']};return db[_0xe8f7('0x2c')]['count'](_0x39e843)['then'](function(_0x3dc6a4){_0x1b2963[_0xe8f7('0x1f')]=_0x3dc6a4;if(_0x2e58d9[_0xe8f7('0x2f')][_0xe8f7('0x3e')]){_0xdef6d4[_0xe8f7('0x3f')]=[{'all':!![]}];}return db[_0xe8f7('0x2c')][_0xe8f7('0x40')](_0xdef6d4);})[_0xe8f7('0x25')](function(_0x3ba6d6){_0x1b2963['rows']=_0x3ba6d6;return _0x1b2963;})[_0xe8f7('0x25')](respondWithFilteredResult(_0x29b272,_0xdef6d4))[_0xe8f7('0x41')](handleError(_0x29b272,null));};exports[_0xe8f7('0x42')]=function(_0x3b91d5,_0x4441a6){var _0x470a54={'raw':!![],'where':{'id':_0x3b91d5['params']['id']}},_0x56f086={};_0x56f086[_0xe8f7('0x31')]=_['keys'](db['FaxApplication'][_0xe8f7('0x43')]);_0x56f086[_0xe8f7('0x2f')]=_[_0xe8f7('0x44')](_0x3b91d5[_0xe8f7('0x2f')]);_0x56f086[_0xe8f7('0x38')]=_[_0xe8f7('0x30')](_0x56f086['model'],_0x56f086['query']);_0x470a54['attributes']=_[_0xe8f7('0x30')](_0x56f086[_0xe8f7('0x31')],qs[_0xe8f7('0x33')](_0x3b91d5[_0xe8f7('0x2f')][_0xe8f7('0x33')]));_0x470a54[_0xe8f7('0x32')]=_0x470a54[_0xe8f7('0x32')][_0xe8f7('0x34')]?_0x470a54[_0xe8f7('0x32')]:_0x56f086[_0xe8f7('0x31')];if(_0x3b91d5[_0xe8f7('0x2f')][_0xe8f7('0x3e')]){_0x470a54[_0xe8f7('0x3f')]=[{'all':!![]}];}_0x470a54=_[_0xe8f7('0x3b')]({},_0x470a54,_0x3b91d5[_0xe8f7('0x3d')]);return db[_0xe8f7('0x2c')][_0xe8f7('0x45')](_0x470a54)['then'](handleEntityNotFound(_0x4441a6,null))['then'](respondWithResult(_0x4441a6,null))['catch'](handleError(_0x4441a6,null));};exports[_0xe8f7('0x46')]=function(_0x597441,_0x3410ea){return db[_0xe8f7('0x2c')]['create'](_0x597441[_0xe8f7('0x47')],{})[_0xe8f7('0x25')](respondWithResult(_0x3410ea,0xc9))['catch'](handleError(_0x3410ea,null));};exports['update']=function(_0x5577b7,_0x2996bc){if(_0x5577b7['body']['id']){delete _0x5577b7[_0xe8f7('0x47')]['id'];}return db[_0xe8f7('0x2c')]['find']({'where':{'id':_0x5577b7[_0xe8f7('0x48')]['id']}})[_0xe8f7('0x25')](handleEntityNotFound(_0x2996bc,null))[_0xe8f7('0x25')](saveUpdates(_0x5577b7[_0xe8f7('0x47')],null))[_0xe8f7('0x25')](respondWithResult(_0x2996bc,null))[_0xe8f7('0x41')](handleError(_0x2996bc,null));};exports[_0xe8f7('0x26')]=function(_0x212382,_0x3f9425){return db['FaxApplication'][_0xe8f7('0x45')]({'where':{'id':_0x212382['params']['id']}})['then'](handleEntityNotFound(_0x3f9425,null))['then'](removeEntity(_0x3f9425,null))[_0xe8f7('0x41')](handleError(_0x3f9425,null));}; \ No newline at end of file +var _0xed23=['path','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x4af3eb,_0x48cca9){var _0x96ebba=function(_0x23e683){while(--_0x23e683){_0x4af3eb['push'](_0x4af3eb['shift']());}};_0x96ebba(++_0x48cca9);}(_0xed23,0x88));var _0x3ed2=function(_0x21876c,_0xcd8d7b){_0x21876c=_0x21876c-0x0;var _0x5d1d5f=_0xed23[_0x21876c];return _0x5d1d5f;};'use strict';var emlformat=require(_0x3ed2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ed2('0x1'));var jsonpatch=require(_0x3ed2('0x2'));var rp=require('request-promise');var moment=require(_0x3ed2('0x3'));var BPromise=require(_0x3ed2('0x4'));var Mustache=require('mustache');var util=require(_0x3ed2('0x5'));var path=require(_0x3ed2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ed2('0x7'));var fs=require('fs');var fs_extra=require(_0x3ed2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3ed2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3ed2('0xa'));var toCsv=require(_0x3ed2('0xb'));var querystring=require(_0x3ed2('0xc'));var Papa=require(_0x3ed2('0xd'));var Redis=require(_0x3ed2('0xe'));var authService=require(_0x3ed2('0xf'));var qs=require(_0x3ed2('0x10'));var as=require(_0x3ed2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3ed2('0x12'));var utils=require(_0x3ed2('0x13'));var config=require(_0x3ed2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ed2('0x15'))['db'];function respondWithStatusCode(_0x36913f,_0x302837){_0x302837=_0x302837||0xcc;return function(_0x5f4b0f){if(_0x5f4b0f){return _0x36913f['sendStatus'](_0x302837);}return _0x36913f['status'](_0x302837)['end']();};}function respondWithResult(_0x55fe86,_0x1c8ca5){_0x1c8ca5=_0x1c8ca5||0xc8;return function(_0x511e32){if(_0x511e32){return _0x55fe86[_0x3ed2('0x16')](_0x1c8ca5)[_0x3ed2('0x17')](_0x511e32);}};}function respondWithFilteredResult(_0x9ddf99,_0x251d5d){return function(_0x4d7707){if(_0x4d7707){var _0xcb57b3=typeof _0x251d5d[_0x3ed2('0x18')]==='undefined'&&typeof _0x251d5d[_0x3ed2('0x19')]===_0x3ed2('0x1a');var _0xb453a1=_0x4d7707[_0x3ed2('0x1b')];var _0x19d4c7=_0xcb57b3?0x0:_0x251d5d[_0x3ed2('0x18')];var _0x277044=_0xcb57b3?_0x4d7707[_0x3ed2('0x1b')]:_0x251d5d[_0x3ed2('0x18')]+_0x251d5d[_0x3ed2('0x19')];var _0x4ba22d;if(_0x277044>=_0xb453a1){_0x277044=_0xb453a1;_0x4ba22d=0xc8;}else{_0x4ba22d=0xce;}_0x9ddf99[_0x3ed2('0x16')](_0x4ba22d);return _0x9ddf99[_0x3ed2('0x1c')](_0x3ed2('0x1d'),_0x19d4c7+'-'+_0x277044+'/'+_0xb453a1)['json'](_0x4d7707);}return null;};}function patchUpdates(_0x53629b){return function(_0x37c1b5){try{jsonpatch['apply'](_0x37c1b5,_0x53629b,!![]);}catch(_0x1b0a42){return BPromise[_0x3ed2('0x1e')](_0x1b0a42);}return _0x37c1b5['save']();};}function saveUpdates(_0x56151d,_0x1ac7ed){return function(_0x1a2565){if(_0x1a2565){return _0x1a2565[_0x3ed2('0x1f')](_0x56151d)[_0x3ed2('0x20')](function(_0x333b14){return _0x333b14;});}return null;};}function removeEntity(_0x49832c,_0x493f9e){return function(_0x2e299f){if(_0x2e299f){return _0x2e299f[_0x3ed2('0x21')]()[_0x3ed2('0x20')](function(){_0x49832c['status'](0xcc)[_0x3ed2('0x22')]();});}};}function handleEntityNotFound(_0x5299ef,_0x32fc4f){return function(_0x1b3e0a){if(!_0x1b3e0a){_0x5299ef[_0x3ed2('0x23')](0x194);}return _0x1b3e0a;};}function handleError(_0x6657bd,_0x5a8b4d){_0x5a8b4d=_0x5a8b4d||0x1f4;return function(_0x57b6d0){logger[_0x3ed2('0x24')](_0x57b6d0[_0x3ed2('0x25')]);if(_0x57b6d0[_0x3ed2('0x26')]){delete _0x57b6d0[_0x3ed2('0x26')];}_0x6657bd[_0x3ed2('0x16')](_0x5a8b4d)[_0x3ed2('0x27')](_0x57b6d0);};}exports[_0x3ed2('0x28')]=function(_0x582f64,_0xc044e8){var _0xf737dc={},_0x1b5374={},_0x514943={'count':0x0,'rows':[]};var _0x40dbf6=_[_0x3ed2('0x29')](db[_0x3ed2('0x2a')][_0x3ed2('0x2b')],function(_0x108c6c){return{'name':_0x108c6c[_0x3ed2('0x2c')],'type':_0x108c6c['type'][_0x3ed2('0x2d')]};});_0x1b5374[_0x3ed2('0x2e')]=_[_0x3ed2('0x29')](_0x40dbf6,_0x3ed2('0x26'));_0x1b5374['query']=_[_0x3ed2('0x2f')](_0x582f64[_0x3ed2('0x30')]);_0x1b5374[_0x3ed2('0x31')]=_[_0x3ed2('0x32')](_0x1b5374['model'],_0x1b5374[_0x3ed2('0x30')]);_0xf737dc['attributes']=_[_0x3ed2('0x32')](_0x1b5374['model'],qs[_0x3ed2('0x33')](_0x582f64[_0x3ed2('0x30')][_0x3ed2('0x33')]));_0xf737dc[_0x3ed2('0x34')]=_0xf737dc[_0x3ed2('0x34')][_0x3ed2('0x35')]?_0xf737dc['attributes']:_0x1b5374[_0x3ed2('0x2e')];if(!_0x582f64[_0x3ed2('0x30')][_0x3ed2('0x36')]('nolimit')){_0xf737dc[_0x3ed2('0x19')]=qs[_0x3ed2('0x19')](_0x582f64['query'][_0x3ed2('0x19')]);_0xf737dc[_0x3ed2('0x18')]=qs[_0x3ed2('0x18')](_0x582f64[_0x3ed2('0x30')][_0x3ed2('0x18')]);}_0xf737dc['order']=qs[_0x3ed2('0x37')](_0x582f64[_0x3ed2('0x30')][_0x3ed2('0x37')]);_0xf737dc[_0x3ed2('0x38')]=qs[_0x3ed2('0x31')](_[_0x3ed2('0x39')](_0x582f64[_0x3ed2('0x30')],_0x1b5374[_0x3ed2('0x31')]),_0x40dbf6);if(_0x582f64[_0x3ed2('0x30')][_0x3ed2('0x3a')]){_0xf737dc[_0x3ed2('0x38')]=_[_0x3ed2('0x3b')](_0xf737dc[_0x3ed2('0x38')],{'$or':_[_0x3ed2('0x29')](_0x40dbf6,function(_0x496876){if(_0x496876[_0x3ed2('0x3c')]!==_0x3ed2('0x3d')){var _0x11cc47={};_0x11cc47[_0x496876[_0x3ed2('0x26')]]={'$like':'%'+_0x582f64[_0x3ed2('0x30')][_0x3ed2('0x3a')]+'%'};return _0x11cc47;}})});}_0xf737dc=_['merge']({},_0xf737dc,_0x582f64[_0x3ed2('0x3e')]);var _0x287333={'where':_0xf737dc[_0x3ed2('0x38')]};return db[_0x3ed2('0x2a')][_0x3ed2('0x1b')](_0x287333)['then'](function(_0x316a8b){_0x514943[_0x3ed2('0x1b')]=_0x316a8b;if(_0x582f64[_0x3ed2('0x30')][_0x3ed2('0x3f')]){_0xf737dc['include']=[{'all':!![]}];}return db[_0x3ed2('0x2a')][_0x3ed2('0x40')](_0xf737dc);})[_0x3ed2('0x20')](function(_0x530840){_0x514943['rows']=_0x530840;return _0x514943;})['then'](respondWithFilteredResult(_0xc044e8,_0xf737dc))[_0x3ed2('0x41')](handleError(_0xc044e8,null));};exports[_0x3ed2('0x42')]=function(_0x25b84c,_0x39690e){var _0xeca62d={'raw':!![],'where':{'id':_0x25b84c[_0x3ed2('0x43')]['id']}},_0x569ca8={};_0x569ca8['model']=_[_0x3ed2('0x2f')](db[_0x3ed2('0x2a')][_0x3ed2('0x2b')]);_0x569ca8[_0x3ed2('0x30')]=_[_0x3ed2('0x2f')](_0x25b84c[_0x3ed2('0x30')]);_0x569ca8[_0x3ed2('0x31')]=_['intersection'](_0x569ca8['model'],_0x569ca8[_0x3ed2('0x30')]);_0xeca62d['attributes']=_[_0x3ed2('0x32')](_0x569ca8[_0x3ed2('0x2e')],qs[_0x3ed2('0x33')](_0x25b84c[_0x3ed2('0x30')][_0x3ed2('0x33')]));_0xeca62d[_0x3ed2('0x34')]=_0xeca62d[_0x3ed2('0x34')][_0x3ed2('0x35')]?_0xeca62d[_0x3ed2('0x34')]:_0x569ca8[_0x3ed2('0x2e')];if(_0x25b84c[_0x3ed2('0x30')][_0x3ed2('0x3f')]){_0xeca62d['include']=[{'all':!![]}];}_0xeca62d=_[_0x3ed2('0x3b')]({},_0xeca62d,_0x25b84c['options']);return db['FaxApplication'][_0x3ed2('0x44')](_0xeca62d)['then'](handleEntityNotFound(_0x39690e,null))[_0x3ed2('0x20')](respondWithResult(_0x39690e,null))['catch'](handleError(_0x39690e,null));};exports['create']=function(_0x1101b3,_0x45529d){return db['FaxApplication'][_0x3ed2('0x45')](_0x1101b3[_0x3ed2('0x46')],{})[_0x3ed2('0x20')](respondWithResult(_0x45529d,0xc9))['catch'](handleError(_0x45529d,null));};exports[_0x3ed2('0x1f')]=function(_0x68ff7d,_0xa41d48){if(_0x68ff7d['body']['id']){delete _0x68ff7d[_0x3ed2('0x46')]['id'];}return db[_0x3ed2('0x2a')][_0x3ed2('0x44')]({'where':{'id':_0x68ff7d[_0x3ed2('0x43')]['id']}})[_0x3ed2('0x20')](handleEntityNotFound(_0xa41d48,null))[_0x3ed2('0x20')](saveUpdates(_0x68ff7d[_0x3ed2('0x46')],null))[_0x3ed2('0x20')](respondWithResult(_0xa41d48,null))[_0x3ed2('0x41')](handleError(_0xa41d48,null));};exports[_0x3ed2('0x21')]=function(_0x3bceed,_0x1b0254){return db[_0x3ed2('0x2a')]['find']({'where':{'id':_0x3bceed['params']['id']}})['then'](handleEntityNotFound(_0x1b0254,null))['then'](removeEntity(_0x1b0254,null))[_0x3ed2('0x41')](handleError(_0x1b0254,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 58cdbdb..21fdfab 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 _0x64b2=['util','../../config/logger','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1c1798,_0x24812b){var _0x4f235e=function(_0x30028e){while(--_0x30028e){_0x1c1798['push'](_0x1c1798['shift']());}};_0x4f235e(++_0x24812b);}(_0x64b2,0x175));var _0x264b=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x64b2[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0x264b('0x0'));var util=require(_0x264b('0x1'));var logger=require(_0x264b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x264b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x264b('0x4'));var config=require(_0x264b('0x5'));var attributes=require(_0x264b('0x6'));module[_0x264b('0x7')]=function(_0x4fda0d,_0x559de1){return _0x4fda0d[_0x264b('0x8')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x264b('0x9'),'collate':_0x264b('0xa')});}; \ No newline at end of file +var _0xdfcc=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash'];(function(_0x4accd3,_0x59c83e){var _0x29e032=function(_0x45e61f){while(--_0x45e61f){_0x4accd3['push'](_0x4accd3['shift']());}};_0x29e032(++_0x59c83e);}(_0xdfcc,0xfe));var _0xcdfc=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0xdfcc[_0x2af160];return _0x439d67;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var logger=require(_0xcdfc('0x2'))(_0xcdfc('0x3'));var moment=require(_0xcdfc('0x4'));var BPromise=require(_0xcdfc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdfc('0x6'));var rimraf=require(_0xcdfc('0x7'));var config=require(_0xcdfc('0x8'));var attributes=require(_0xcdfc('0x9'));module[_0xcdfc('0xa')]=function(_0x113f32,_0x4ec872){return _0x113f32[_0xcdfc('0xb')](_0xcdfc('0xc'),attributes,{'tableName':_0xcdfc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcdfc('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 7b859ab..47e2984 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 _0xa509=['jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxApplication','body','options','raw','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5afcb0,_0x2f05c5){var _0x54987e=function(_0x1068d4){while(--_0x1068d4){_0x5afcb0['push'](_0x5afcb0['shift']());}};_0x54987e(++_0x2f05c5);}(_0xa509,0x1ce));var _0x9a50=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa509[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9a50('0x0'));var util=require('util');var moment=require(_0x9a50('0x1'));var BPromise=require(_0x9a50('0x2'));var rs=require(_0x9a50('0x3'));var fs=require('fs');var Redis=require(_0x9a50('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a50('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9a50('0x6'));var client=jayson['client'][_0x9a50('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x594936,_0x127ea0,_0x5ef5ee){return new BPromise(function(_0x14ac7b,_0x2b37df){return client[_0x9a50('0x8')](_0x594936,_0x5ef5ee)[_0x9a50('0x9')](function(_0x1c1cd4){logger[_0x9a50('0xa')](_0x9a50('0xb'),_0x127ea0,_0x9a50('0xc'));logger[_0x9a50('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x127ea0,_0x9a50('0xc'),JSON[_0x9a50('0xe')](_0x1c1cd4));if(_0x1c1cd4['error']){if(_0x1c1cd4[_0x9a50('0xf')][_0x9a50('0x10')]===0x1f4){logger[_0x9a50('0xf')](_0x9a50('0xb'),_0x127ea0,_0x1c1cd4[_0x9a50('0xf')][_0x9a50('0x11')]);return _0x2b37df(_0x1c1cd4[_0x9a50('0xf')][_0x9a50('0x11')]);}logger[_0x9a50('0xf')](_0x9a50('0xb'),_0x127ea0,_0x1c1cd4['error'][_0x9a50('0x11')]);return _0x14ac7b(_0x1c1cd4[_0x9a50('0xf')][_0x9a50('0x11')]);}else{logger[_0x9a50('0xa')](_0x9a50('0xb'),_0x127ea0,'request\x20sent');_0x14ac7b(_0x1c1cd4[_0x9a50('0x12')]['message']);}})[_0x9a50('0x13')](function(_0xbe53a5){logger[_0x9a50('0xf')]('FaxApplication,\x20%s,\x20%s',_0x127ea0,_0xbe53a5);_0x2b37df(_0xbe53a5);});});}exports[_0x9a50('0x14')]=function(_0x3d9234){var _0xf5a3ac=this;return new Promise(function(_0xeb3f19,_0x4d514d){return db['FaxApplication']['update'](_0x3d9234[_0x9a50('0x15')],{'raw':_0x3d9234['options']?_0x3d9234[_0x9a50('0x16')][_0x9a50('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d9234[_0x9a50('0x16')]?_0x3d9234[_0x9a50('0x16')]['where']||null:null,'attributes':_0x3d9234[_0x9a50('0x16')]?_0x3d9234[_0x9a50('0x16')][_0x9a50('0x18')]||null:null,'limit':_0x3d9234['options']?_0x3d9234[_0x9a50('0x16')][_0x9a50('0x19')]||null:null})['then'](function(_0x130e5d){logger[_0x9a50('0xa')]('UpdateFaxApplication',_0x3d9234);logger[_0x9a50('0xd')](_0x9a50('0x14'),_0x3d9234,JSON['stringify'](_0x130e5d));_0xeb3f19(_0x130e5d);})['catch'](function(_0x5dfde0){logger[_0x9a50('0xf')](_0x9a50('0x14'),_0x5dfde0[_0x9a50('0x11')],_0x3d9234);_0x4d514d(_0xf5a3ac[_0x9a50('0xf')](0x1f4,_0x5dfde0[_0x9a50('0x11')]));});});}; \ No newline at end of file +var _0xe54d=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','then','lodash','util'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe54d,0xbe));var _0xde54=function(_0x33de54,_0x5434b9){_0x33de54=_0x33de54-0x0;var _0x18fe1f=_0xe54d[_0x33de54];return _0x18fe1f;};'use strict';var _=require(_0xde54('0x0'));var util=require(_0xde54('0x1'));var moment=require('moment');var BPromise=require(_0xde54('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde54('0x3'));var db=require(_0xde54('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xde54('0x5'))(_0xde54('0x6'));var config=require(_0xde54('0x7'));var jayson=require(_0xde54('0x8'));var client=jayson[_0xde54('0x9')][_0xde54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e37f8,_0x1c3e07,_0x353c26){return new BPromise(function(_0x2c0414,_0x21bb11){return client[_0xde54('0xb')](_0x2e37f8,_0x353c26)['then'](function(_0x8e2891){logger[_0xde54('0xc')](_0xde54('0xd'),_0x1c3e07,_0xde54('0xe'));logger[_0xde54('0xf')](_0xde54('0x10'),_0x1c3e07,'request\x20sent',JSON[_0xde54('0x11')](_0x8e2891));if(_0x8e2891[_0xde54('0x12')]){if(_0x8e2891[_0xde54('0x12')][_0xde54('0x13')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x1c3e07,_0x8e2891[_0xde54('0x12')][_0xde54('0x14')]);return _0x21bb11(_0x8e2891[_0xde54('0x12')][_0xde54('0x14')]);}logger['error'](_0xde54('0xd'),_0x1c3e07,_0x8e2891[_0xde54('0x12')]['message']);return _0x2c0414(_0x8e2891[_0xde54('0x12')]['message']);}else{logger['info'](_0xde54('0xd'),_0x1c3e07,_0xde54('0xe'));_0x2c0414(_0x8e2891[_0xde54('0x15')][_0xde54('0x14')]);}})[_0xde54('0x16')](function(_0x13b48b){logger['error'](_0xde54('0xd'),_0x1c3e07,_0x13b48b);_0x21bb11(_0x13b48b);});});}exports[_0xde54('0x17')]=function(_0x38c68f){var _0x885f79=this;return new Promise(function(_0x42ab22,_0x4b90c5){return db[_0xde54('0x18')][_0xde54('0x19')](_0x38c68f[_0xde54('0x1a')],{'raw':_0x38c68f[_0xde54('0x1b')]?_0x38c68f[_0xde54('0x1b')][_0xde54('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38c68f['options']?_0x38c68f['options'][_0xde54('0x1d')]||null:null,'attributes':_0x38c68f['options']?_0x38c68f[_0xde54('0x1b')][_0xde54('0x1e')]||null:null,'limit':_0x38c68f[_0xde54('0x1b')]?_0x38c68f[_0xde54('0x1b')]['limit']||null:null})[_0xde54('0x1f')](function(_0x36f594){logger[_0xde54('0xc')](_0xde54('0x17'),_0x38c68f);logger['debug'](_0xde54('0x17'),_0x38c68f,JSON[_0xde54('0x11')](_0x36f594));_0x42ab22(_0x36f594);})[_0xde54('0x16')](function(_0x2fe191){logger[_0xde54('0x12')](_0xde54('0x17'),_0x2fe191[_0xde54('0x14')],_0x38c68f);_0x4b90c5(_0x885f79[_0xde54('0x12')](0x1f4,_0x2fe191[_0xde54('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 32b5d56..9014f49 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 _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x599347,_0x4b8f3b){var _0x2315bb=function(_0x1d670a){while(--_0x1d670a){_0x599347['push'](_0x599347['shift']());}};_0x2315bb(++_0x4b8f3b);}(_0x9354,0x96));var _0x4935=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0x9354[_0xa8b370];return _0x643e37;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file +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(_0x18881e,_0x499cfe){var _0xb36b55=function(_0x23661e){while(--_0x23661e){_0x18881e['push'](_0x18881e['shift']());}};_0xb36b55(++_0x499cfe);}(_0xe511,0x16f));var _0x1e51=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0xe511[_0x54381d];return _0x5308a7;};'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 11e8eac..ddb3188 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 _0x7284=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x238170,_0x4bbc8d){var _0x5a8bc6=function(_0xac0202){while(--_0xac0202){_0x238170['push'](_0x238170['shift']());}};_0x5a8bc6(++_0x4bbc8d);}(_0x7284,0x13e));var _0x4728=function(_0x1dfe57,_0x483ac0){_0x1dfe57=_0x1dfe57-0x0;var _0x31bb57=_0x7284[_0x1dfe57];return _0x31bb57;};'use strict';var Sequelize=require(_0x4728('0x0'));module[_0x4728('0x1')]={'closed':{'type':Sequelize[_0x4728('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4728('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4728('0x4')]},'note':{'type':Sequelize[_0x4728('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x4728('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x4728('0x5')]('in',_0x4728('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4728('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4728('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0710=['exports','BOOLEAN','DATE','STRING','out','ENUM'];(function(_0x393f62,_0x4dfe05){var _0xdd72e0=function(_0x4d4922){while(--_0x4d4922){_0x393f62['push'](_0x393f62['shift']());}};_0xdd72e0(++_0x4dfe05);}(_0x0710,0x90));var _0x0071=function(_0x5cb158,_0x45557e){_0x5cb158=_0x5cb158-0x0;var _0x4032a0=_0x0710[_0x5cb158];return _0x4032a0;};'use strict';var Sequelize=require('sequelize');module[_0x0071('0x0')]={'closed':{'type':Sequelize[_0x0071('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0071('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0071('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0071('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0071('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x0071('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0071('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x0071('0x5')]('in',_0x0071('0x4')),'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 d97f970..33dc344 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 _0x7d8a=['rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','ids','omit','findOne','hasOwnProperty','nolimit','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','rows','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','resolve','log','err','unlinkSync','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','index','map','FaxInteraction'];(function(_0x2cd1fb,_0x291f55){var _0x48fd2b=function(_0x18e23e){while(--_0x18e23e){_0x2cd1fb['push'](_0x2cd1fb['shift']());}};_0x48fd2b(++_0x291f55);}(_0x7d8a,0x118));var _0xa7d8=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x7d8a[_0x5f09c5];return _0x426ad9;};'use strict';var rimraf=require(_0xa7d8('0x0'));var zipdir=require('zip-dir');var moment=require(_0xa7d8('0x1'));var BPromise=require(_0xa7d8('0x2'));var util=require(_0xa7d8('0x3'));var path=require(_0xa7d8('0x4'));var fs=require('fs');var _=require(_0xa7d8('0x5'));var Redis=require(_0xa7d8('0x6'));var interaction=require(_0xa7d8('0x7'));var qs=require(_0xa7d8('0x8'));var logger=require('../../config/logger')(_0xa7d8('0x9'));var config=require(_0xa7d8('0xa'));var db=require(_0xa7d8('0xb'))['db'];config[_0xa7d8('0xc')]=_[_0xa7d8('0xd')](config['redis'],{'host':_0xa7d8('0xe'),'port':0x18eb});var socket=require(_0xa7d8('0xf'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xa7d8('0x10')](socket);function respondWithStatusCode(_0x317e40,_0x41eba8){_0x41eba8=_0x41eba8||0xcc;return function(_0xb05049){if(_0xb05049){return _0x317e40[_0xa7d8('0x11')](_0x41eba8);}return _0x317e40[_0xa7d8('0x12')](_0x41eba8)[_0xa7d8('0x13')]();};}function respondWithResult(_0x4b698b,_0x1229db){_0x1229db=_0x1229db||0xc8;return function(_0x42231b){if(_0x42231b){return _0x4b698b[_0xa7d8('0x12')](_0x1229db)[_0xa7d8('0x14')](_0x42231b);}};}function respondWithFilteredResult(_0x6293fa,_0x25f607){return function(_0x3bbed3){if(_0x3bbed3){var _0x39aff3=typeof _0x25f607[_0xa7d8('0x15')]===_0xa7d8('0x16')&&typeof _0x25f607[_0xa7d8('0x17')]===_0xa7d8('0x16');var _0x2fcd04=_0x3bbed3[_0xa7d8('0x18')];var _0x13a2b9=_0x39aff3?0x0:_0x25f607[_0xa7d8('0x15')];var _0x4d2ef2=_0x39aff3?_0x3bbed3[_0xa7d8('0x18')]:_0x25f607[_0xa7d8('0x15')]+_0x25f607[_0xa7d8('0x17')];var _0x4c5d82;if(_0x4d2ef2>=_0x2fcd04){_0x4d2ef2=_0x2fcd04;_0x4c5d82=0xc8;}else{_0x4c5d82=0xce;}_0x6293fa[_0xa7d8('0x12')](_0x4c5d82);return _0x6293fa[_0xa7d8('0x19')](_0xa7d8('0x1a'),_0x13a2b9+'-'+_0x4d2ef2+'/'+_0x2fcd04)['json'](_0x3bbed3);}return null;};}function saveUpdates(_0x4580fb){return function(_0x49e7d2){if(_0x49e7d2){return _0x49e7d2[_0xa7d8('0x1b')](_0x4580fb)[_0xa7d8('0x1c')](function(_0x519179){return _0x519179;});}return null;};}function removeEntity(_0x50e28f){return function(_0x16345d){if(_0x16345d){return _0x16345d[_0xa7d8('0x1d')]()[_0xa7d8('0x1c')](function(){_0x50e28f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x510710){return function(_0x2a5d82){if(!_0x2a5d82){_0x510710['sendStatus'](0x194);}return _0x2a5d82;};}function handleError(_0x8163c3,_0x5c9ea2){_0x5c9ea2=_0x5c9ea2||0x1f4;return function(_0x5d1226){logger['error'](_0x5d1226[_0xa7d8('0x1e')]);if(_0x5d1226[_0xa7d8('0x1f')]){delete _0x5d1226[_0xa7d8('0x1f')];}_0x8163c3['status'](_0x5c9ea2)['send'](_0x5d1226);};}exports[_0xa7d8('0x20')]=function(_0x889035,_0x596e84){var _0x3d2031={};var _0x3b5c80=_[_0xa7d8('0x21')](db[_0xa7d8('0x22')][_0xa7d8('0x23')],function(_0x1d27d4){return{'name':_0x1d27d4[_0xa7d8('0x24')],'type':_0x1d27d4[_0xa7d8('0x25')][_0xa7d8('0x26')]};});_0x3d2031=qs[_0xa7d8('0x27')](_0x3b5c80,_0x889035);return interaction[_0xa7d8('0x28')](_0xa7d8('0x29'),_0x889035[_0xa7d8('0x2a')],_0x889035[_0xa7d8('0x2b')],_0x3d2031,_0x3b5c80)[_0xa7d8('0x1c')](respondWithFilteredResult(_0x596e84,_0x3d2031))['catch'](handleError(_0x596e84,null));};exports[_0xa7d8('0x2c')]=function(_0x17c431,_0xd730d5){var _0x2386c8={'raw':![],'where':{'id':_0x17c431[_0xa7d8('0x2d')]['id']}},_0x42926f={};_0x42926f[_0xa7d8('0x2e')]=_[_0xa7d8('0x2f')](db[_0xa7d8('0x22')][_0xa7d8('0x23')]);_0x42926f['query']=_[_0xa7d8('0x2f')](_0x17c431[_0xa7d8('0x2a')]);_0x42926f[_0xa7d8('0x30')]=_[_0xa7d8('0x31')](_0x42926f[_0xa7d8('0x2e')],_0x42926f['query']);_0x2386c8[_0xa7d8('0x32')]=_['intersection'](_0x42926f[_0xa7d8('0x2e')],qs[_0xa7d8('0x33')](_0x17c431['query'][_0xa7d8('0x33')]));_0x2386c8[_0xa7d8('0x32')]=_0x2386c8[_0xa7d8('0x32')][_0xa7d8('0x34')]?_0x2386c8['attributes']:_0x42926f['model'];if(_0x17c431['query'][_0xa7d8('0x35')]){_0x2386c8[_0xa7d8('0x36')]=[{'all':!![]}];}_0x2386c8=_[_0xa7d8('0x37')]({},_0x2386c8,_0x17c431[_0xa7d8('0x38')]);return db['FaxInteraction'][_0xa7d8('0x39')](_0x2386c8)[_0xa7d8('0x1c')](handleEntityNotFound(_0xd730d5,null))[_0xa7d8('0x1c')](respondWithResult(_0xd730d5,null))[_0xa7d8('0x3a')](handleError(_0xd730d5,null));};exports[_0xa7d8('0x3b')]=function(_0x467b84,_0x5c7544){return db[_0xa7d8('0x22')][_0xa7d8('0x3b')](_0x467b84[_0xa7d8('0x3c')],{})['then'](respondWithResult(_0x5c7544,0xc9))[_0xa7d8('0x3a')](handleError(_0x5c7544,null));};exports[_0xa7d8('0x1b')]=function(_0x4b9b8c,_0x572884){if(_0x4b9b8c[_0xa7d8('0x3c')]['id']){delete _0x4b9b8c[_0xa7d8('0x3c')]['id'];}return db[_0xa7d8('0x22')][_0xa7d8('0x39')]({'where':{'id':_0x4b9b8c[_0xa7d8('0x2d')]['id']}})[_0xa7d8('0x1c')](handleEntityNotFound(_0x572884,null))[_0xa7d8('0x1c')](saveUpdates(_0x4b9b8c[_0xa7d8('0x3c')],null))[_0xa7d8('0x1c')](respondWithResult(_0x572884,null))[_0xa7d8('0x3a')](handleError(_0x572884,null));};exports[_0xa7d8('0x1d')]=function(_0x27b2a9,_0x3d5056){return db[_0xa7d8('0x22')][_0xa7d8('0x39')]({'where':{'id':_0x27b2a9[_0xa7d8('0x2d')]['id']}})[_0xa7d8('0x1c')](handleEntityNotFound(_0x3d5056,null))['then'](removeEntity(_0x3d5056,null))['catch'](handleError(_0x3d5056,null));};exports['describe']=function(_0x1f9b01,_0x4ffaf9){return db[_0xa7d8('0x22')][_0xa7d8('0x3d')]()[_0xa7d8('0x1c')](respondWithResult(_0x4ffaf9,null))[_0xa7d8('0x3a')](handleError(_0x4ffaf9,null));};exports[_0xa7d8('0x3e')]=function(_0x4a8943,_0x21bc56){return db['FaxMessage'][_0xa7d8('0x39')]({'where':{'id':_0x4a8943[_0xa7d8('0x2d')]['id']}})[_0xa7d8('0x1c')](handleEntityNotFound(_0x21bc56,null))[_0xa7d8('0x1c')](function(_0xf9e0ae){if(_0xf9e0ae){return _0xf9e0ae[_0xa7d8('0x3e')](_0x4a8943[_0xa7d8('0x3c')][_0xa7d8('0x3f')],_[_0xa7d8('0x40')](_0x4a8943[_0xa7d8('0x3c')],[_0xa7d8('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x21bc56,null))[_0xa7d8('0x3a')](handleError(_0x21bc56,null));};exports['getMessages']=function(_0x5cbe07,_0x1456fd){var _0x4fad63={'raw':![],'where':{}};var _0x499805={};var _0x4babb2={'count':0x0,'rows':[]};return db[_0xa7d8('0x22')][_0xa7d8('0x41')]({'where':{'id':_0x5cbe07[_0xa7d8('0x2d')]['id']}})[_0xa7d8('0x1c')](handleEntityNotFound(_0x1456fd,null))[_0xa7d8('0x1c')](function(_0xeec39){if(_0xeec39){_0x499805[_0xa7d8('0x2e')]=_[_0xa7d8('0x2f')](db['FaxMessage'][_0xa7d8('0x23')]);_0x499805[_0xa7d8('0x2a')]=_[_0xa7d8('0x2f')](_0x5cbe07[_0xa7d8('0x2a')]);_0x499805[_0xa7d8('0x30')]=_['intersection'](_0x499805[_0xa7d8('0x2e')],_0x499805[_0xa7d8('0x2a')]);_0x4fad63[_0xa7d8('0x32')]=_[_0xa7d8('0x31')](_0x499805['model'],qs[_0xa7d8('0x33')](_0x5cbe07['query']['fields']));_0x4fad63[_0xa7d8('0x32')]=_0x4fad63[_0xa7d8('0x32')][_0xa7d8('0x34')]?_0x4fad63['attributes']:_0x499805[_0xa7d8('0x2e')];if(!_0x5cbe07[_0xa7d8('0x2a')][_0xa7d8('0x42')](_0xa7d8('0x43'))){_0x4fad63[_0xa7d8('0x17')]=qs[_0xa7d8('0x17')](_0x5cbe07[_0xa7d8('0x2a')][_0xa7d8('0x17')]);_0x4fad63[_0xa7d8('0x15')]=qs[_0xa7d8('0x15')](_0x5cbe07[_0xa7d8('0x2a')][_0xa7d8('0x15')]);}_0x4fad63['order']=qs['sort'](_0x5cbe07['query'][_0xa7d8('0x44')]);_0x4fad63[_0xa7d8('0x45')]=qs[_0xa7d8('0x30')](_[_0xa7d8('0x46')](_0x5cbe07[_0xa7d8('0x2a')],_0x499805[_0xa7d8('0x30')]));_0x4fad63[_0xa7d8('0x45')][_0xa7d8('0x47')]=_0xeec39['id'];if(_0x5cbe07['query'][_0xa7d8('0x48')]){_0x4fad63['where']=_[_0xa7d8('0x37')](_0x4fad63[_0xa7d8('0x45')],{'$or':_[_0xa7d8('0x21')](_0x4fad63[_0xa7d8('0x32')],function(_0x206620){var _0x1d8ea5={};_0x1d8ea5[_0x206620]={'$like':'%'+_0x5cbe07['query'][_0xa7d8('0x48')]+'%'};return _0x1d8ea5;})});}if(_0x5cbe07['query'][_0xa7d8('0x49')]){var _0x3b9e5b=_0x5cbe07[_0xa7d8('0x2a')][_0xa7d8('0x49')][_0xa7d8('0x4a')](',');var _0x7cb4c0={};_0x7cb4c0[_0x3b9e5b[0x0]]={'$gte':moment(_0x3b9e5b[0x1])[_0xa7d8('0x4b')](_0xa7d8('0x4c'))};_0x4fad63[_0xa7d8('0x45')]=_['merge'](_0x4fad63[_0xa7d8('0x45')],_0x7cb4c0);}_0x4fad63=_['merge']({},_0x4fad63,_0x5cbe07['options']);return db['FaxMessage'][_0xa7d8('0x18')]({'where':_0x4fad63[_0xa7d8('0x45')]})[_0xa7d8('0x1c')](function(_0x5d5905){_0x4babb2[_0xa7d8('0x18')]=_0x5d5905;if(_0x5cbe07[_0xa7d8('0x2a')][_0xa7d8('0x35')]){_0x4fad63[_0xa7d8('0x36')]=[{'all':!![]}];}return db[_0xa7d8('0x4d')]['findAll'](_0x4fad63);})[_0xa7d8('0x1c')](function(_0x4e9c8e){_0x4babb2[_0xa7d8('0x4e')]=_0x4e9c8e;return _0x4babb2;});}})[_0xa7d8('0x1c')](respondWithFilteredResult(_0x1456fd,_0x4fad63))[_0xa7d8('0x3a')](handleError(_0x1456fd,null));};exports[_0xa7d8('0x4f')]=function(_0x4b19df,_0x426df7){return db[_0xa7d8('0x22')][_0xa7d8('0x39')]({'where':{'id':_0x4b19df[_0xa7d8('0x2d')]['id']}})[_0xa7d8('0x1c')](handleEntityNotFound(_0x426df7,null))[_0xa7d8('0x1c')](function(_0x26afc9){if(_0x26afc9){return _0x26afc9[_0xa7d8('0x50')](_0x4b19df['body'][_0xa7d8('0x3f')],_[_0xa7d8('0x40')](_0x4b19df[_0xa7d8('0x3c')],[_0xa7d8('0x3f'),'id'])||{})[_0xa7d8('0x51')](function(){return db['Tag'][_0xa7d8('0x28')]({'attributes':['id',_0xa7d8('0x1f'),_0xa7d8('0x52')],'where':{'id':_0x4b19df[_0xa7d8('0x3c')][_0xa7d8('0x3f')]}});})[_0xa7d8('0x1c')](function(_0x3bae94){socket[_0xa7d8('0x53')](_0xa7d8('0x54'),{'id':Number(_0x4b19df[_0xa7d8('0x2d')]['id']),'tags':_0x3bae94||[]});return{'id':Number(_0x4b19df[_0xa7d8('0x2d')]['id']),'tags':_0x3bae94||[]};});}})[_0xa7d8('0x1c')](respondWithResult(_0x426df7,null))[_0xa7d8('0x3a')](handleError(_0x426df7,null));};exports[_0xa7d8('0x55')]=function(_0x484f67,_0x360e1f){return db['FaxInteraction'][_0xa7d8('0x39')]({'where':{'id':_0x484f67[_0xa7d8('0x2d')]['id']}})['then'](handleEntityNotFound(_0x360e1f,null))[_0xa7d8('0x1c')](function(_0x256e10){if(_0x256e10){return _0x256e10[_0xa7d8('0x55')](_0x484f67[_0xa7d8('0x2a')][_0xa7d8('0x3f')]);}})[_0xa7d8('0x1c')](respondWithStatusCode(_0x360e1f,null))[_0xa7d8('0x3a')](handleError(_0x360e1f,null));};exports[_0xa7d8('0x56')]=function(_0xbf0eb6,_0x57bb46){var _0x3ba621=moment()[_0xa7d8('0x57')]()['toString']();var _0x17a813=path[_0xa7d8('0x58')](config[_0xa7d8('0x59')],'server',_0xa7d8('0x5a'),'tmp');var _0x4d3226=path[_0xa7d8('0x58')](config['root'],'server',_0xa7d8('0x5a'),_0xa7d8('0x5b'));var _0x61ccbc=path['join'](_0x17a813,_0x3ba621);var _0x5334ef=util['format'](_0xa7d8('0x5c'),_0xbf0eb6[_0xa7d8('0x2d')]['id'],_0x3ba621);var _0x449070=path['join'](_0x17a813,_0x5334ef);var _0x1d418e=[];_0x1d418e['push']({'model':db[_0xa7d8('0x5d')],'as':_0xa7d8('0x5d'),'raw':!![]});var _0x234acf=[{'model':db[_0xa7d8('0x4d')],'as':_0xa7d8('0x5e'),'attributes':['id',_0xa7d8('0x3c'),'createdAt'],'include':_0x1d418e}];return db[_0xa7d8('0x22')][_0xa7d8('0x39')]({'where':{'id':_0xbf0eb6[_0xa7d8('0x2d')]['id']},'include':_0x234acf})[_0xa7d8('0x1c')](handleEntityNotFound(_0x57bb46,null))[_0xa7d8('0x1c')](function(_0x10c86c){if(_0x10c86c&&_0x10c86c[_0xa7d8('0x5e')]){var _0x35cf8d=_0x10c86c[_0xa7d8('0x5f')]({'plain':!![]});fs[_0xa7d8('0x60')](_0x61ccbc);for(var _0x265161=0x0;_0x265161<_0x35cf8d[_0xa7d8('0x5e')]['length'];_0x265161++){var _0xf8d387=_0x35cf8d['Messages'][_0x265161]['Attachment'];if(_0xf8d387){var _0x580d23=path['join'](_0x4d3226,_0xf8d387[_0xa7d8('0x61')]);if(fs[_0xa7d8('0x62')](_0x580d23)){fs[_0xa7d8('0x63')](_0x580d23)[_0xa7d8('0x64')](fs['createWriteStream'](path[_0xa7d8('0x58')](_0x61ccbc,_0xf8d387[_0xa7d8('0x61')])));}}}return BPromise[_0xa7d8('0x65')]()['then'](function(){return new BPromise(function(_0x38c70d,_0x4cd180){zipdir(_0x61ccbc,{'saveTo':_0x449070},function(_0x15bff3,_0x539b05){if(_0x15bff3)return _0x4cd180(_0x15bff3);return _0x38c70d(_0x539b05);});})['then'](function(){return new BPromise(function(_0xa3511,_0x1f3780){rimraf(_0x61ccbc,function(_0x4d6cce){if(_0x4d6cce)_0x1f3780(_0x4d6cce);return _0xa3511();});});})[_0xa7d8('0x1c')](function(){return _0x57bb46[_0xa7d8('0x56')](_0x449070,_0x5334ef,function(_0x23f968){if(_0x23f968){console[_0xa7d8('0x66')](_0xa7d8('0x67'),_0x23f968);}else{fs[_0xa7d8('0x68')](_0x449070);}});});});}else{return _0x57bb46[_0xa7d8('0x11')](0xc8);}})[_0xa7d8('0x3a')](handleError(_0x57bb46,null));}; \ No newline at end of file +var _0x219c=['bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','FaxInteraction','rawAttributes','fieldName','type','getOptions','findAll','fax','user','params','keys','query','filters','intersection','model','attributes','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','fields','hasOwnProperty','nolimit','sort','where','filter','map','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','color','emit','faxInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','push','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','zip-dir','moment'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x219c,0x1ed));var _0xc219=function(_0xe33e3f,_0xce7d6f){_0xe33e3f=_0xe33e3f-0x0;var _0x3f556d=_0x219c[_0xe33e3f];return _0x3f556d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc219('0x0'));var moment=require(_0xc219('0x1'));var BPromise=require(_0xc219('0x2'));var util=require('util');var path=require(_0xc219('0x3'));var fs=require('fs');var _=require(_0xc219('0x4'));var Redis=require(_0xc219('0x5'));var interaction=require(_0xc219('0x6'));var qs=require(_0xc219('0x7'));var logger=require(_0xc219('0x8'))(_0xc219('0x9'));var config=require('../../config/environment');var db=require(_0xc219('0xa'))['db'];config[_0xc219('0xb')]=_['defaults'](config[_0xc219('0xb')],{'host':_0xc219('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc219('0xd'))[_0xc219('0xe')](socket);function respondWithStatusCode(_0x12ef43,_0x5a7225){_0x5a7225=_0x5a7225||0xcc;return function(_0x10b57d){if(_0x10b57d){return _0x12ef43[_0xc219('0xf')](_0x5a7225);}return _0x12ef43[_0xc219('0x10')](_0x5a7225)[_0xc219('0x11')]();};}function respondWithResult(_0x17ed65,_0x98c014){_0x98c014=_0x98c014||0xc8;return function(_0x3b8ba3){if(_0x3b8ba3){return _0x17ed65['status'](_0x98c014)[_0xc219('0x12')](_0x3b8ba3);}};}function respondWithFilteredResult(_0x19c7b9,_0x2fd322){return function(_0x1bd8d7){if(_0x1bd8d7){var _0x5254dd=typeof _0x2fd322[_0xc219('0x13')]===_0xc219('0x14')&&typeof _0x2fd322[_0xc219('0x15')]===_0xc219('0x14');var _0x4e4a94=_0x1bd8d7[_0xc219('0x16')];var _0x395a01=_0x5254dd?0x0:_0x2fd322[_0xc219('0x13')];var _0x237a61=_0x5254dd?_0x1bd8d7[_0xc219('0x16')]:_0x2fd322[_0xc219('0x13')]+_0x2fd322[_0xc219('0x15')];var _0x123e11;if(_0x237a61>=_0x4e4a94){_0x237a61=_0x4e4a94;_0x123e11=0xc8;}else{_0x123e11=0xce;}_0x19c7b9[_0xc219('0x10')](_0x123e11);return _0x19c7b9['set'](_0xc219('0x17'),_0x395a01+'-'+_0x237a61+'/'+_0x4e4a94)['json'](_0x1bd8d7);}return null;};}function saveUpdates(_0x3ebc1f){return function(_0x14b11c){if(_0x14b11c){return _0x14b11c[_0xc219('0x18')](_0x3ebc1f)[_0xc219('0x19')](function(_0x12e813){return _0x12e813;});}return null;};}function removeEntity(_0xd069d7){return function(_0x1f0c6a){if(_0x1f0c6a){return _0x1f0c6a[_0xc219('0x1a')]()['then'](function(){_0xd069d7[_0xc219('0x10')](0xcc)[_0xc219('0x11')]();});}};}function handleEntityNotFound(_0x3f1b5b){return function(_0x52f7f6){if(!_0x52f7f6){_0x3f1b5b[_0xc219('0xf')](0x194);}return _0x52f7f6;};}function handleError(_0x2b8089,_0x52f0d4){_0x52f0d4=_0x52f0d4||0x1f4;return function(_0x25e901){logger[_0xc219('0x1b')](_0x25e901[_0xc219('0x1c')]);if(_0x25e901[_0xc219('0x1d')]){delete _0x25e901[_0xc219('0x1d')];}_0x2b8089[_0xc219('0x10')](_0x52f0d4)[_0xc219('0x1e')](_0x25e901);};}exports[_0xc219('0x1f')]=function(_0x83da85,_0x4ab2af){var _0x2e9d34={};var _0x27bf04=_['map'](db[_0xc219('0x20')][_0xc219('0x21')],function(_0x3829f9){return{'name':_0x3829f9[_0xc219('0x22')],'type':_0x3829f9[_0xc219('0x23')]['key']};});_0x2e9d34=qs[_0xc219('0x24')](_0x27bf04,_0x83da85);return interaction[_0xc219('0x25')](_0xc219('0x26'),_0x83da85['query'],_0x83da85[_0xc219('0x27')],_0x2e9d34,_0x27bf04)[_0xc219('0x19')](respondWithFilteredResult(_0x4ab2af,_0x2e9d34))['catch'](handleError(_0x4ab2af,null));};exports['show']=function(_0x1efa85,_0x4d9205){var _0x273af5={'raw':![],'where':{'id':_0x1efa85[_0xc219('0x28')]['id']}},_0x58cf0d={};_0x58cf0d['model']=_[_0xc219('0x29')](db[_0xc219('0x20')][_0xc219('0x21')]);_0x58cf0d[_0xc219('0x2a')]=_[_0xc219('0x29')](_0x1efa85[_0xc219('0x2a')]);_0x58cf0d[_0xc219('0x2b')]=_[_0xc219('0x2c')](_0x58cf0d[_0xc219('0x2d')],_0x58cf0d[_0xc219('0x2a')]);_0x273af5[_0xc219('0x2e')]=_[_0xc219('0x2c')](_0x58cf0d[_0xc219('0x2d')],qs['fields'](_0x1efa85['query']['fields']));_0x273af5[_0xc219('0x2e')]=_0x273af5[_0xc219('0x2e')][_0xc219('0x2f')]?_0x273af5['attributes']:_0x58cf0d['model'];if(_0x1efa85[_0xc219('0x2a')][_0xc219('0x30')]){_0x273af5[_0xc219('0x31')]=[{'all':!![]}];}_0x273af5=_[_0xc219('0x32')]({},_0x273af5,_0x1efa85[_0xc219('0x33')]);return db[_0xc219('0x20')][_0xc219('0x34')](_0x273af5)[_0xc219('0x19')](handleEntityNotFound(_0x4d9205,null))['then'](respondWithResult(_0x4d9205,null))[_0xc219('0x35')](handleError(_0x4d9205,null));};exports['create']=function(_0x6f8176,_0x3b9e2d){return db[_0xc219('0x20')][_0xc219('0x36')](_0x6f8176[_0xc219('0x37')],{})[_0xc219('0x19')](respondWithResult(_0x3b9e2d,0xc9))[_0xc219('0x35')](handleError(_0x3b9e2d,null));};exports['update']=function(_0xa287b8,_0x3d12d3){if(_0xa287b8[_0xc219('0x37')]['id']){delete _0xa287b8[_0xc219('0x37')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0xa287b8[_0xc219('0x28')]['id']}})[_0xc219('0x19')](handleEntityNotFound(_0x3d12d3,null))['then'](saveUpdates(_0xa287b8[_0xc219('0x37')],null))['then'](respondWithResult(_0x3d12d3,null))[_0xc219('0x35')](handleError(_0x3d12d3,null));};exports[_0xc219('0x1a')]=function(_0x84064,_0x51642f){return db[_0xc219('0x20')][_0xc219('0x34')]({'where':{'id':_0x84064[_0xc219('0x28')]['id']}})['then'](handleEntityNotFound(_0x51642f,null))[_0xc219('0x19')](removeEntity(_0x51642f,null))[_0xc219('0x35')](handleError(_0x51642f,null));};exports[_0xc219('0x38')]=function(_0x4f84ce,_0x1aa6a0){return db[_0xc219('0x20')][_0xc219('0x38')]()[_0xc219('0x19')](respondWithResult(_0x1aa6a0,null))[_0xc219('0x35')](handleError(_0x1aa6a0,null));};exports[_0xc219('0x39')]=function(_0x37142f,_0x550061){return db['FaxMessage']['find']({'where':{'id':_0x37142f[_0xc219('0x28')]['id']}})[_0xc219('0x19')](handleEntityNotFound(_0x550061,null))['then'](function(_0xd10c52){if(_0xd10c52){return _0xd10c52['addMessage'](_0x37142f[_0xc219('0x37')][_0xc219('0x3a')],_[_0xc219('0x3b')](_0x37142f[_0xc219('0x37')],[_0xc219('0x3a'),'id'])||{});}})[_0xc219('0x19')](respondWithResult(_0x550061,null))['catch'](handleError(_0x550061,null));};exports[_0xc219('0x3c')]=function(_0x3a5925,_0x5b886b){var _0x1c3c4f={'raw':![],'where':{}};var _0x16e9e5={};var _0x28b80f={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xc219('0x3d')]({'where':{'id':_0x3a5925['params']['id']}})[_0xc219('0x19')](handleEntityNotFound(_0x5b886b,null))['then'](function(_0x56113e){if(_0x56113e){_0x16e9e5[_0xc219('0x2d')]=_[_0xc219('0x29')](db[_0xc219('0x3e')][_0xc219('0x21')]);_0x16e9e5['query']=_['keys'](_0x3a5925[_0xc219('0x2a')]);_0x16e9e5[_0xc219('0x2b')]=_[_0xc219('0x2c')](_0x16e9e5[_0xc219('0x2d')],_0x16e9e5[_0xc219('0x2a')]);_0x1c3c4f[_0xc219('0x2e')]=_[_0xc219('0x2c')](_0x16e9e5[_0xc219('0x2d')],qs[_0xc219('0x3f')](_0x3a5925[_0xc219('0x2a')][_0xc219('0x3f')]));_0x1c3c4f['attributes']=_0x1c3c4f['attributes'][_0xc219('0x2f')]?_0x1c3c4f[_0xc219('0x2e')]:_0x16e9e5[_0xc219('0x2d')];if(!_0x3a5925[_0xc219('0x2a')][_0xc219('0x40')](_0xc219('0x41'))){_0x1c3c4f['limit']=qs['limit'](_0x3a5925[_0xc219('0x2a')][_0xc219('0x15')]);_0x1c3c4f['offset']=qs[_0xc219('0x13')](_0x3a5925[_0xc219('0x2a')][_0xc219('0x13')]);}_0x1c3c4f['order']=qs['sort'](_0x3a5925[_0xc219('0x2a')][_0xc219('0x42')]);_0x1c3c4f[_0xc219('0x43')]=qs[_0xc219('0x2b')](_['pick'](_0x3a5925['query'],_0x16e9e5[_0xc219('0x2b')]));_0x1c3c4f['where']['FaxInteractionId']=_0x56113e['id'];if(_0x3a5925[_0xc219('0x2a')][_0xc219('0x44')]){_0x1c3c4f[_0xc219('0x43')]=_['merge'](_0x1c3c4f[_0xc219('0x43')],{'$or':_[_0xc219('0x45')](_0x1c3c4f[_0xc219('0x2e')],function(_0x4d8b5b){var _0x4f2f2b={};_0x4f2f2b[_0x4d8b5b]={'$like':'%'+_0x3a5925['query'][_0xc219('0x44')]+'%'};return _0x4f2f2b;})});}if(_0x3a5925[_0xc219('0x2a')]['$gte']){var _0x360d15=_0x3a5925[_0xc219('0x2a')]['$gte'][_0xc219('0x46')](',');var _0x305c47={};_0x305c47[_0x360d15[0x0]]={'$gte':moment(_0x360d15[0x1])[_0xc219('0x47')](_0xc219('0x48'))};_0x1c3c4f[_0xc219('0x43')]=_[_0xc219('0x32')](_0x1c3c4f[_0xc219('0x43')],_0x305c47);}_0x1c3c4f=_['merge']({},_0x1c3c4f,_0x3a5925['options']);return db[_0xc219('0x3e')]['count']({'where':_0x1c3c4f['where']})[_0xc219('0x19')](function(_0x56f970){_0x28b80f['count']=_0x56f970;if(_0x3a5925[_0xc219('0x2a')]['includeAll']){_0x1c3c4f['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1c3c4f);})[_0xc219('0x19')](function(_0x493a0b){_0x28b80f[_0xc219('0x49')]=_0x493a0b;return _0x28b80f;});}})[_0xc219('0x19')](respondWithFilteredResult(_0x5b886b,_0x1c3c4f))[_0xc219('0x35')](handleError(_0x5b886b,null));};exports['addTags']=function(_0x5db205,_0x361d9d){return db['FaxInteraction']['find']({'where':{'id':_0x5db205[_0xc219('0x28')]['id']}})[_0xc219('0x19')](handleEntityNotFound(_0x361d9d,null))[_0xc219('0x19')](function(_0x463438){if(_0x463438){return _0x463438[_0xc219('0x4a')](_0x5db205[_0xc219('0x37')][_0xc219('0x3a')],_[_0xc219('0x3b')](_0x5db205[_0xc219('0x37')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xc219('0x25')]({'attributes':['id','name',_0xc219('0x4b')],'where':{'id':_0x5db205[_0xc219('0x37')][_0xc219('0x3a')]}});})[_0xc219('0x19')](function(_0x522998){socket[_0xc219('0x4c')](_0xc219('0x4d'),{'id':Number(_0x5db205[_0xc219('0x28')]['id']),'tags':_0x522998||[]});return{'id':Number(_0x5db205[_0xc219('0x28')]['id']),'tags':_0x522998||[]};});}})[_0xc219('0x19')](respondWithResult(_0x361d9d,null))['catch'](handleError(_0x361d9d,null));};exports['removeTags']=function(_0x50a970,_0xd4e816){return db['FaxInteraction'][_0xc219('0x34')]({'where':{'id':_0x50a970['params']['id']}})['then'](handleEntityNotFound(_0xd4e816,null))['then'](function(_0x9c69f5){if(_0x9c69f5){return _0x9c69f5[_0xc219('0x4e')](_0x50a970[_0xc219('0x2a')][_0xc219('0x3a')]);}})['then'](respondWithStatusCode(_0xd4e816,null))[_0xc219('0x35')](handleError(_0xd4e816,null));};exports['download']=function(_0xa034fe,_0x4b2024){var _0x21a21c=moment()[_0xc219('0x4f')]()[_0xc219('0x50')]();var _0x4532e4=path[_0xc219('0x51')](config[_0xc219('0x52')],_0xc219('0x53'),_0xc219('0x54'),_0xc219('0x55'));var _0xebd726=path['join'](config[_0xc219('0x52')],_0xc219('0x53'),_0xc219('0x54'),'attachments');var _0x421463=path['join'](_0x4532e4,_0x21a21c);var _0x3cc306=util['format']('transcript-%d-%s.zip',_0xa034fe['params']['id'],_0x21a21c);var _0x142967=path['join'](_0x4532e4,_0x3cc306);var _0x216e99=[];_0x216e99[_0xc219('0x56')]({'model':db[_0xc219('0x57')],'as':_0xc219('0x57'),'raw':!![]});var _0x3d0ffc=[{'model':db[_0xc219('0x3e')],'as':'Messages','attributes':['id',_0xc219('0x37'),'createdAt'],'include':_0x216e99}];return db[_0xc219('0x20')]['find']({'where':{'id':_0xa034fe[_0xc219('0x28')]['id']},'include':_0x3d0ffc})[_0xc219('0x19')](handleEntityNotFound(_0x4b2024,null))[_0xc219('0x19')](function(_0x492714){if(_0x492714&&_0x492714[_0xc219('0x58')]){var _0xb0ee56=_0x492714[_0xc219('0x59')]({'plain':!![]});fs['mkdirSync'](_0x421463);for(var _0xc4394c=0x0;_0xc4394c<_0xb0ee56[_0xc219('0x58')][_0xc219('0x2f')];_0xc4394c++){var _0x5ac1c2=_0xb0ee56['Messages'][_0xc4394c][_0xc219('0x57')];if(_0x5ac1c2){var _0x3640f4=path['join'](_0xebd726,_0x5ac1c2[_0xc219('0x5a')]);if(fs[_0xc219('0x5b')](_0x3640f4)){fs[_0xc219('0x5c')](_0x3640f4)[_0xc219('0x5d')](fs[_0xc219('0x5e')](path[_0xc219('0x51')](_0x421463,_0x5ac1c2[_0xc219('0x5a')])));}}}return BPromise[_0xc219('0x5f')]()[_0xc219('0x19')](function(){return new BPromise(function(_0x30dc13,_0x4eddd8){zipdir(_0x421463,{'saveTo':_0x142967},function(_0x3e0d2c,_0x196314){if(_0x3e0d2c)return _0x4eddd8(_0x3e0d2c);return _0x30dc13(_0x196314);});})[_0xc219('0x19')](function(){return new BPromise(function(_0x36c1e9,_0x48038b){rimraf(_0x421463,function(_0x460d40){if(_0x460d40)_0x48038b(_0x460d40);return _0x36c1e9();});});})[_0xc219('0x19')](function(){return _0x4b2024['download'](_0x142967,_0x3cc306,function(_0x8acdf){if(_0x8acdf){console[_0xc219('0x60')](_0xc219('0x61'),_0x8acdf);}else{fs[_0xc219('0x62')](_0x142967);}});});});}else{return _0x4b2024[_0xc219('0xf')](0xc8);}})[_0xc219('0x35')](handleError(_0x4b2024,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index fc9ef3e..6cd1471 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 _0xd9f2=['update','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','events','FaxInteraction','../../mysqldb','save'];(function(_0x136e0a,_0x528b6e){var _0x53e571=function(_0x4a0048){while(--_0x4a0048){_0x136e0a['push'](_0x136e0a['shift']());}};_0x53e571(++_0x528b6e);}(_0xd9f2,0x1be));var _0x2d9f=function(_0xf59d63,_0x4b2f73){_0xf59d63=_0xf59d63-0x0;var _0x56e7d9=_0xd9f2[_0xf59d63];return _0x56e7d9;};'use strict';var EventEmitter=require(_0x2d9f('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x2d9f('0x1')];var FaxMessage=require(_0x2d9f('0x2'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2d9f('0x3'),'afterUpdate':_0x2d9f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1cd659){return function(_0x14afd2,_0x4a148f,_0xf9fdf3){_0x14afd2['getUsers']({'attributes':['id'],'raw':!![]})[_0x2d9f('0x5')](function(_0x107fd7){_0x14afd2[_0x2d9f('0x6')](_0x2d9f('0x7'),_0x107fd7[_0x2d9f('0x8')](function(_0x120b34){return{'id':_0x120b34['id']};}));return FaxMessage[_0x2d9f('0x9')]({'where':{'FaxInteractionId':_0x14afd2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2d9f('0x5')](function(_0x3bfd17){_0x14afd2['setDataValue'](_0x2d9f('0xa'),_0x3bfd17[_0x2d9f('0xb')]);FaxInteractionEvents[_0x2d9f('0xc')](_0x1cd659+':'+_0x14afd2['id'],_0x14afd2);FaxInteractionEvents[_0x2d9f('0xc')](_0x1cd659,_0x14afd2);_0xf9fdf3(null);})[_0x2d9f('0xd')](_0xf9fdf3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x2d9f('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x3436=['events','../../mysqldb','FaxMessage','setMaxListeners','update','remove','getUsers','Users','map','then','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports'];(function(_0x25102c,_0x18aa78){var _0x3563af=function(_0x2c5cad){while(--_0x2c5cad){_0x25102c['push'](_0x25102c['shift']());}};_0x3563af(++_0x18aa78);}(_0x3436,0x99));var _0x6343=function(_0x4705b0,_0x47d2c7){_0x4705b0=_0x4705b0-0x0;var _0x2076ce=_0x3436[_0x4705b0];return _0x2076ce;};'use strict';var EventEmitter=require(_0x6343('0x0'));var FaxInteraction=require(_0x6343('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0x6343('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6343('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6343('0x4'),'afterDestroy':_0x6343('0x5')};function emitEvent(_0x26a8e4){return function(_0x1abdd3,_0x205b03,_0x12648c){_0x1abdd3[_0x6343('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58127c){_0x1abdd3['setDataValue'](_0x6343('0x7'),_0x58127c[_0x6343('0x8')](function(_0x174d59){return{'id':_0x174d59['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1abdd3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6343('0x9')](function(_0x5e6b5a){_0x1abdd3[_0x6343('0xa')](_0x6343('0xb'),_0x5e6b5a['length']);FaxInteractionEvents[_0x6343('0xc')](_0x26a8e4+':'+_0x1abdd3['id'],_0x1abdd3);FaxInteractionEvents[_0x6343('0xc')](_0x26a8e4,_0x1abdd3);_0x12648c(null);})[_0x6343('0xd')](_0x12648c(null));};}for(var e in events){if(events[_0x6343('0xe')](e)){var event=events[e];FaxInteraction[_0x6343('0xf')](e,emitEvent(event));}}module[_0x6343('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 76d8182..b119d16 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 _0x5079=['path','rimraf','../../config/environment','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x365b1a,_0x269baa){var _0x1ef8ea=function(_0x439e03){while(--_0x439e03){_0x365b1a['push'](_0x365b1a['shift']());}};_0x1ef8ea(++_0x269baa);}(_0x5079,0x13c));var _0x9507=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x5079[_0x3227c1];return _0x31fd48;};'use strict';var _=require(_0x9507('0x0'));var util=require(_0x9507('0x1'));var logger=require(_0x9507('0x2'))(_0x9507('0x3'));var moment=require(_0x9507('0x4'));var BPromise=require(_0x9507('0x5'));var rp=require(_0x9507('0x6'));var fs=require('fs');var path=require(_0x9507('0x7'));var rimraf=require(_0x9507('0x8'));var config=require(_0x9507('0x9'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x29e17a,_0x5c74ea){return _0x29e17a[_0x9507('0xa')](_0x9507('0xb'),attributes,{'tableName':_0x9507('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5282fd,_0x3e4110,_0x937133){if(_0x5282fd[_0x9507('0xd')](_0x9507('0xe'))){_0x5282fd[_0x9507('0xf')]=moment()['format'](_0x9507('0x10'));}_0x937133(null,_0x5282fd);}}});}; \ No newline at end of file +var _0xdbeb=['request-promise','rimraf','define','FaxInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf7ff4,_0x543a19){var _0x554e6a=function(_0x4b8192){while(--_0x4b8192){_0xf7ff4['push'](_0xf7ff4['shift']());}};_0x554e6a(++_0x543a19);}(_0xdbeb,0x174));var _0xbdbe=function(_0x453a4e,_0x264785){_0x453a4e=_0x453a4e-0x0;var _0x57dd75=_0xdbeb[_0x453a4e];return _0x57dd75;};'use strict';var _=require(_0xbdbe('0x0'));var util=require(_0xbdbe('0x1'));var logger=require(_0xbdbe('0x2'))(_0xbdbe('0x3'));var moment=require(_0xbdbe('0x4'));var BPromise=require(_0xbdbe('0x5'));var rp=require(_0xbdbe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdbe('0x7'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module['exports']=function(_0xd07f84,_0x6f9316){return _0xd07f84[_0xbdbe('0x8')](_0xbdbe('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32d49a,_0x3b10aa,_0x24ad50){if(_0x32d49a[_0xbdbe('0xa')](_0xbdbe('0xb'))){_0x32d49a[_0xbdbe('0xc')]=moment()['format'](_0xbdbe('0xd'));}_0x24ad50(null,_0x32d49a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a42f51b..3b758f8 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 _0x1615=['catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','find','addTags','ids','omit','AddTags','util','moment','randomstring','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x4e9f29,_0x1bbcbf){var _0x8e1ab3=function(_0x4a4e6b){while(--_0x4a4e6b){_0x4e9f29['push'](_0x4e9f29['shift']());}};_0x8e1ab3(++_0x1bbcbf);}(_0x1615,0x194));var _0x5161=function(_0x170d24,_0xafcd1d){_0x170d24=_0x170d24-0x0;var _0x3c46b1=_0x1615[_0x170d24];return _0x3c46b1;};'use strict';var _=require('lodash');var util=require(_0x5161('0x0'));var moment=require(_0x5161('0x1'));var BPromise=require('bluebird');var rs=require(_0x5161('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5161('0x3'));var config=require(_0x5161('0x4'));var jayson=require(_0x5161('0x5'));var client=jayson[_0x5161('0x6')][_0x5161('0x7')]({'port':0x232a});config[_0x5161('0x8')]=_['defaults'](config[_0x5161('0x8')],{'host':_0x5161('0x9'),'port':0x18eb});var socket=require(_0x5161('0xa'))(new Redis(config['redis']));require(_0x5161('0xb'))[_0x5161('0xc')](socket);function respondWithRpcPromise(_0xbd6167,_0x40a0d7,_0x2b50d7){return new BPromise(function(_0x9e23f9,_0x2402a6){return client[_0x5161('0xd')](_0xbd6167,_0x2b50d7)[_0x5161('0xe')](function(_0x4e1897){logger[_0x5161('0xf')](_0x5161('0x10'),_0x40a0d7,_0x5161('0x11'));logger[_0x5161('0x12')](_0x5161('0x13'),_0x40a0d7,_0x5161('0x11'),JSON[_0x5161('0x14')](_0x4e1897));if(_0x4e1897['error']){if(_0x4e1897['error'][_0x5161('0x15')]===0x1f4){logger[_0x5161('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x40a0d7,_0x4e1897[_0x5161('0x16')][_0x5161('0x17')]);return _0x2402a6(_0x4e1897['error'][_0x5161('0x17')]);}logger['error'](_0x5161('0x10'),_0x40a0d7,_0x4e1897[_0x5161('0x16')][_0x5161('0x17')]);return _0x9e23f9(_0x4e1897['error'][_0x5161('0x17')]);}else{logger['info'](_0x5161('0x10'),_0x40a0d7,_0x5161('0x11'));_0x9e23f9(_0x4e1897[_0x5161('0x18')][_0x5161('0x17')]);}})[_0x5161('0x19')](function(_0xd1169e){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x40a0d7,_0xd1169e);_0x2402a6(_0xd1169e);});});}exports[_0x5161('0x1a')]=function(_0x51c04b){var _0x407595=this;return new Promise(function(_0x3dd853,_0x34cb7e){return db[_0x5161('0x1b')][_0x5161('0x1c')](_0x51c04b[_0x5161('0x1d')],{'raw':_0x51c04b[_0x5161('0x1e')]?_0x51c04b[_0x5161('0x1e')][_0x5161('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51c04b[_0x5161('0x1e')]?_0x51c04b[_0x5161('0x1e')][_0x5161('0x20')]||null:null,'attributes':_0x51c04b[_0x5161('0x1e')]?_0x51c04b[_0x5161('0x1e')][_0x5161('0x21')]||null:null,'limit':_0x51c04b[_0x5161('0x1e')]?_0x51c04b[_0x5161('0x1e')]['limit']||null:null})[_0x5161('0xe')](function(_0x33715a){logger['info']('UpdateFaxInteraction',_0x51c04b);logger[_0x5161('0x12')](_0x5161('0x1a'),_0x51c04b,JSON['stringify'](_0x33715a));_0x3dd853(_0x33715a);})[_0x5161('0x19')](function(_0x25e7ee){logger[_0x5161('0x16')](_0x5161('0x1a'),_0x25e7ee[_0x5161('0x17')],_0x51c04b);_0x34cb7e(_0x407595['error'](0x1f4,_0x25e7ee['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x1a6ec6){return new Promise(function(_0x352f46,_0x48493e){return db[_0x5161('0x1b')][_0x5161('0x22')]({'where':_0x1a6ec6[_0x5161('0x1e')]?_0x1a6ec6[_0x5161('0x1e')][_0x5161('0x20')]||null:null})['then'](function(_0x3bb172){if(_0x3bb172){return _0x3bb172[_0x5161('0x23')](_0x1a6ec6['body'][_0x5161('0x24')],_[_0x5161('0x25')](_0x1a6ec6['body'],['ids','id'])||{});}})['spread'](function(_0x232573){logger[_0x5161('0xf')](_0x5161('0x26'),_0x1a6ec6);logger[_0x5161('0x12')](_0x5161('0x26'),_0x1a6ec6,JSON[_0x5161('0x14')](_0x232573));_0x352f46(_0x232573);})[_0x5161('0x19')](function(_0x31f06a){logger[_0x5161('0x16')]('AddTags',_0x31f06a[_0x5161('0x17')],_0x1a6ec6);_0x48493e(_this[_0x5161('0x16')](0x1f4,_0x31f06a[_0x5161('0x17')]));});});}; \ No newline at end of file +var _0x9ae1=['UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToFaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x580428,_0x40b471){var _0x45f738=function(_0x36ec63){while(--_0x36ec63){_0x580428['push'](_0x580428['shift']());}};_0x45f738(++_0x40b471);}(_0x9ae1,0x8d));var _0x19ae=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x9ae1[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x19ae('0x0'));var util=require(_0x19ae('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x19ae('0x2'));var fs=require('fs');var Redis=require(_0x19ae('0x3'));var db=require(_0x19ae('0x4'))['db'];var utils=require(_0x19ae('0x5'));var logger=require(_0x19ae('0x6'))(_0x19ae('0x7'));var config=require(_0x19ae('0x8'));var jayson=require(_0x19ae('0x9'));var client=jayson[_0x19ae('0xa')][_0x19ae('0xb')]({'port':0x232a});config[_0x19ae('0xc')]=_['defaults'](config[_0x19ae('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x19ae('0xd'))(new Redis(config[_0x19ae('0xc')]));require(_0x19ae('0xe'))[_0x19ae('0xf')](socket);function respondWithRpcPromise(_0x58b427,_0x59cdab,_0x182397){return new BPromise(function(_0x8bd443,_0x320836){return client[_0x19ae('0x10')](_0x58b427,_0x182397)[_0x19ae('0x11')](function(_0x50173b){logger[_0x19ae('0x12')](_0x19ae('0x13'),_0x59cdab,_0x19ae('0x14'));logger[_0x19ae('0x15')](_0x19ae('0x16'),_0x59cdab,_0x19ae('0x14'),JSON['stringify'](_0x50173b));if(_0x50173b[_0x19ae('0x17')]){if(_0x50173b['error'][_0x19ae('0x18')]===0x1f4){logger[_0x19ae('0x17')](_0x19ae('0x13'),_0x59cdab,_0x50173b[_0x19ae('0x17')][_0x19ae('0x19')]);return _0x320836(_0x50173b[_0x19ae('0x17')]['message']);}logger[_0x19ae('0x17')](_0x19ae('0x13'),_0x59cdab,_0x50173b['error']['message']);return _0x8bd443(_0x50173b[_0x19ae('0x17')][_0x19ae('0x19')]);}else{logger[_0x19ae('0x12')](_0x19ae('0x13'),_0x59cdab,_0x19ae('0x14'));_0x8bd443(_0x50173b[_0x19ae('0x1a')][_0x19ae('0x19')]);}})['catch'](function(_0x44f42a){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x59cdab,_0x44f42a);_0x320836(_0x44f42a);});});}exports[_0x19ae('0x1b')]=function(_0x3b4dc7){var _0x3d949d=this;return new Promise(function(_0x4eac4b,_0x37af33){return db[_0x19ae('0x1c')]['update'](_0x3b4dc7[_0x19ae('0x1d')],{'raw':_0x3b4dc7[_0x19ae('0x1e')]?_0x3b4dc7[_0x19ae('0x1e')][_0x19ae('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b4dc7['options']?_0x3b4dc7[_0x19ae('0x1e')][_0x19ae('0x20')]||null:null,'attributes':_0x3b4dc7[_0x19ae('0x1e')]?_0x3b4dc7[_0x19ae('0x1e')][_0x19ae('0x21')]||null:null,'limit':_0x3b4dc7[_0x19ae('0x1e')]?_0x3b4dc7[_0x19ae('0x1e')][_0x19ae('0x22')]||null:null})['then'](function(_0xe167c){logger['info']('UpdateFaxInteraction',_0x3b4dc7);logger[_0x19ae('0x15')](_0x19ae('0x1b'),_0x3b4dc7,JSON[_0x19ae('0x23')](_0xe167c));_0x4eac4b(_0xe167c);})['catch'](function(_0x5dd1fa){logger[_0x19ae('0x17')]('UpdateFaxInteraction',_0x5dd1fa[_0x19ae('0x19')],_0x3b4dc7);_0x37af33(_0x3d949d[_0x19ae('0x17')](0x1f4,_0x5dd1fa[_0x19ae('0x19')]));});});};exports[_0x19ae('0x24')]=function(_0x25d610){return new Promise(function(_0x2c5340,_0x315880){return db['FaxInteraction']['find']({'where':_0x25d610[_0x19ae('0x1e')]?_0x25d610['options'][_0x19ae('0x20')]||null:null})[_0x19ae('0x11')](function(_0x3b26ff){if(_0x3b26ff){return _0x3b26ff[_0x19ae('0x25')](_0x25d610[_0x19ae('0x1d')][_0x19ae('0x26')],_[_0x19ae('0x27')](_0x25d610[_0x19ae('0x1d')],[_0x19ae('0x26'),'id'])||{});}})[_0x19ae('0x28')](function(_0x58e3f9){logger[_0x19ae('0x12')](_0x19ae('0x29'),_0x25d610);logger[_0x19ae('0x15')](_0x19ae('0x29'),_0x25d610,JSON['stringify'](_0x58e3f9));_0x2c5340(_0x58e3f9);})['catch'](function(_0x9687d){logger[_0x19ae('0x17')]('AddTags',_0x9687d[_0x19ae('0x19')],_0x25d610);_0x315880(_this[_0x19ae('0x17')](0x1f4,_0x9687d[_0x19ae('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index bd7cb55..2ff037d 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 _0x2253=['save','remove','removeListener','register','faxInteraction:','./faxInteraction.events'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x2253,0x1b5));var _0x3225=function(_0x1231d3,_0x392a1a){_0x1231d3=_0x1231d3-0x0;var _0x452b64=_0x2253[_0x1231d3];return _0x452b64;};'use strict';var FaxInteractionEvents=require(_0x3225('0x0'));var events=[_0x3225('0x1'),_0x3225('0x2'),'update'];function createListener(_0x35cc23,_0x22096a){return function(_0x2110ca){_0x22096a['emit'](_0x35cc23,_0x2110ca);};}function removeListener(_0x506e16,_0xf816f5){return function(){FaxInteractionEvents[_0x3225('0x3')](_0x506e16,_0xf816f5);};}exports[_0x3225('0x4')]=function(_0x3f434b){for(var _0x33ec32=0x0,_0x51b52c=events['length'];_0x33ec32<_0x51b52c;_0x33ec32++){var _0x5d8236=events[_0x33ec32];var _0x38c6bd=createListener(_0x3225('0x5')+_0x5d8236,_0x3f434b);FaxInteractionEvents['on'](_0x5d8236,_0x38c6bd);}}; \ No newline at end of file +var _0x8bb5=['emit','removeListener','register','./faxInteraction.events','remove','update'];(function(_0xda501a,_0x159d6a){var _0x44be3a=function(_0x5c1c5f){while(--_0x5c1c5f){_0xda501a['push'](_0xda501a['shift']());}};_0x44be3a(++_0x159d6a);}(_0x8bb5,0x8d));var _0x58bb=function(_0x4584ef,_0x3c640a){_0x4584ef=_0x4584ef-0x0;var _0x258dbb=_0x8bb5[_0x4584ef];return _0x258dbb;};'use strict';var FaxInteractionEvents=require(_0x58bb('0x0'));var events=['save',_0x58bb('0x1'),_0x58bb('0x2')];function createListener(_0x50c9c3,_0x3b8716){return function(_0x38f312){_0x3b8716[_0x58bb('0x3')](_0x50c9c3,_0x38f312);};}function removeListener(_0x235b40,_0x1c7a58){return function(){FaxInteractionEvents[_0x58bb('0x4')](_0x235b40,_0x1c7a58);};}exports[_0x58bb('0x5')]=function(_0x376ed2){for(var _0x47fc34=0x0,_0x48b573=events['length'];_0x47fc34<_0x48b573;_0x47fc34++){var _0x1bdfa6=events[_0x47fc34];var _0x4a45b9=createListener('faxInteraction:'+_0x1bdfa6,_0x376ed2);FaxInteractionEvents['on'](_0x1bdfa6,_0x4a45b9);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 0ce20ae..60f11ad 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 _0xaa36=['post','addMessage','faxinteraction:addtags','addTags','tracked','fax','faxinteraction:update','update','delete','/:id','destroy','removeTags','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','./faxInteraction.controller','get','index','/describe','isAuthenticated','/:id/messages','getMessages','/:id/download','download','create'];(function(_0x21fc94,_0x35633d){var _0x1bb3f1=function(_0x1b06ba){while(--_0x1b06ba){_0x21fc94['push'](_0x21fc94['shift']());}};_0x1bb3f1(++_0x35633d);}(_0xaa36,0x125));var _0x6aa3=function(_0x428751,_0x1eb9c3){_0x428751=_0x428751-0x0;var _0x147aff=_0xaa36[_0x428751];return _0x147aff;};'use strict';var multer=require(_0x6aa3('0x0'));var util=require(_0x6aa3('0x1'));var path=require('path');var timeout=require(_0x6aa3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aa3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6aa3('0x4'));var config=require('../../config/environment');var controller=require(_0x6aa3('0x5'));router[_0x6aa3('0x6')]('/',auth['isAuthenticated'](),controller[_0x6aa3('0x7')]);router['get'](_0x6aa3('0x8'),auth[_0x6aa3('0x9')](),controller['describe']);router[_0x6aa3('0x6')]('/:id',auth[_0x6aa3('0x9')](),controller['show']);router[_0x6aa3('0x6')](_0x6aa3('0xa'),auth[_0x6aa3('0x9')](),controller[_0x6aa3('0xb')]);router[_0x6aa3('0x6')](_0x6aa3('0xc'),auth[_0x6aa3('0x9')](),controller[_0x6aa3('0xd')]);router['post']('/',auth[_0x6aa3('0x9')](),controller[_0x6aa3('0xe')]);router[_0x6aa3('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6aa3('0x10')]);router[_0x6aa3('0xf')]('/:id/tags',auth[_0x6aa3('0x9')](),interaction['tracked']('fax',_0x6aa3('0x11')),controller[_0x6aa3('0x12')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x6aa3('0x13')](_0x6aa3('0x14'),_0x6aa3('0x15')),controller[_0x6aa3('0x16')]);router[_0x6aa3('0x17')](_0x6aa3('0x18'),auth[_0x6aa3('0x9')](),interaction[_0x6aa3('0x13')](_0x6aa3('0x14'),'faxinteraction:destroy'),controller[_0x6aa3('0x19')]);router[_0x6aa3('0x17')]('/:id/tags',auth['isAuthenticated'](),controller[_0x6aa3('0x1a')]);module[_0x6aa3('0x1b')]=router; \ No newline at end of file +var _0xd2fc=['./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','destroy','delete','/:id/tags','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2f2d73,_0x455dcd){var _0x401786=function(_0xf14260){while(--_0xf14260){_0x2f2d73['push'](_0x2f2d73['shift']());}};_0x401786(++_0x455dcd);}(_0xd2fc,0xda));var _0xcd2f=function(_0x172134,_0x5e90e1){_0x172134=_0x172134-0x0;var _0x4e68cb=_0xd2fc[_0x172134];return _0x4e68cb;};'use strict';var multer=require('multer');var util=require(_0xcd2f('0x0'));var path=require('path');var timeout=require(_0xcd2f('0x1'));var express=require('express');var router=express[_0xcd2f('0x2')]();var fs_extra=require(_0xcd2f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcd2f('0x4'));var config=require(_0xcd2f('0x5'));var controller=require(_0xcd2f('0x6'));router[_0xcd2f('0x7')]('/',auth[_0xcd2f('0x8')](),controller[_0xcd2f('0x9')]);router[_0xcd2f('0x7')](_0xcd2f('0xa'),auth[_0xcd2f('0x8')](),controller[_0xcd2f('0xb')]);router[_0xcd2f('0x7')](_0xcd2f('0xc'),auth[_0xcd2f('0x8')](),controller[_0xcd2f('0xd')]);router[_0xcd2f('0x7')](_0xcd2f('0xe'),auth[_0xcd2f('0x8')](),controller[_0xcd2f('0xf')]);router[_0xcd2f('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xcd2f('0x10')]);router[_0xcd2f('0x11')]('/',auth[_0xcd2f('0x8')](),controller['create']);router[_0xcd2f('0x11')](_0xcd2f('0xe'),auth[_0xcd2f('0x8')](),controller['addMessage']);router[_0xcd2f('0x11')]('/:id/tags',auth[_0xcd2f('0x8')](),interaction[_0xcd2f('0x12')](_0xcd2f('0x13'),_0xcd2f('0x14')),controller[_0xcd2f('0x15')]);router[_0xcd2f('0x16')](_0xcd2f('0xc'),auth[_0xcd2f('0x8')](),interaction[_0xcd2f('0x12')](_0xcd2f('0x13'),_0xcd2f('0x17')),controller[_0xcd2f('0x18')]);router['delete'](_0xcd2f('0xc'),auth['isAuthenticated'](),interaction[_0xcd2f('0x12')](_0xcd2f('0x13'),'faxinteraction:destroy'),controller[_0xcd2f('0x19')]);router[_0xcd2f('0x1a')](_0xcd2f('0x1b'),auth[_0xcd2f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index de9edc8..d53ed0a 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 _0xd51f=['sequelize','exports','medium','BOOLEAN','out','DATE'];(function(_0x98b847,_0x418696){var _0x4e110f=function(_0x32e4bb){while(--_0x32e4bb){_0x98b847['push'](_0x98b847['shift']());}};_0x4e110f(++_0x418696);}(_0xd51f,0xf0));var _0xfd51=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd51f[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xfd51('0x0'));module[_0xfd51('0x1')]={'body':{'type':Sequelize['TEXT'](_0xfd51('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfd51('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfd51('0x4')),'defaultValue':_0xfd51('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xfd51('0x5')]}}; \ No newline at end of file +var _0xcea2=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x1f27bc,_0x3f7e77){var _0x48494f=function(_0x13d41b){while(--_0x13d41b){_0x1f27bc['push'](_0x1f27bc['shift']());}};_0x48494f(++_0x3f7e77);}(_0xcea2,0x15a));var _0x2cea=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xcea2[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require(_0x2cea('0x0'));module['exports']={'body':{'type':Sequelize[_0x2cea('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2cea('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2cea('0x3')]('in',_0x2cea('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x2cea('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2cea('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index aa410c4..626e6da 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 _0xda8b=['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','defaults','localhost','redis','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','update','then','name','send','index','map','FaxMessage','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','merge','find','body','params','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','SIP/%s','reject','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel'];(function(_0x1f22e0,_0x32e6a1){var _0x31d7ee=function(_0x2c4bb0){while(--_0x2c4bb0){_0x1f22e0['push'](_0x1f22e0['shift']());}};_0x31d7ee(++_0x32e6a1);}(_0xda8b,0x10e));var _0xbda8=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xda8b[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0xbda8('0x0'));var rimraf=require(_0xbda8('0x1'));var zipdir=require(_0xbda8('0x2'));var jsonpatch=require(_0xbda8('0x3'));var rp=require(_0xbda8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbda8('0x5'));var util=require('util');var path=require(_0xbda8('0x6'));var sox=require(_0xbda8('0x7'));var csv=require(_0xbda8('0x8'));var ejs=require(_0xbda8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbda8('0xa'));var squel=require(_0xbda8('0xb'));var crypto=require(_0xbda8('0xc'));var jsforce=require(_0xbda8('0xd'));var deskjs=require(_0xbda8('0xe'));var toCsv=require(_0xbda8('0x8'));var querystring=require(_0xbda8('0xf'));var Papa=require(_0xbda8('0x10'));var Redis=require(_0xbda8('0x11'));var authService=require(_0xbda8('0x12'));var qs=require(_0xbda8('0x13'));var as=require(_0xbda8('0x14'));var hardwareService=require(_0xbda8('0x15'));var logger=require(_0xbda8('0x16'))(_0xbda8('0x17'));var utils=require(_0xbda8('0x18'));var config=require(_0xbda8('0x19'));var licenseUtil=require(_0xbda8('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xbda8('0x1b')](config['redis'],{'host':_0xbda8('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbda8('0x1d')]));require('./faxMessage.socket')[_0xbda8('0x1e')](socket);var jayson=require(_0xbda8('0x1f'));var client=jayson[_0xbda8('0x20')][_0xbda8('0x21')]({'port':0x232c});var client9002=jayson[_0xbda8('0x20')][_0xbda8('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x562dc3,_0x15c277,_0x297eb2,_0x4aeed7){return new BPromise(function(_0x1c6456,_0x47c4db){var _0x4357a7=_0x4aeed7||client;return _0x4357a7[_0xbda8('0x22')](_0x562dc3,_0x297eb2)['then'](function(_0x97eb90){logger[_0xbda8('0x23')](_0xbda8('0x24'),_0x15c277,_0xbda8('0x25'));logger['debug'](_0xbda8('0x26'),_0x15c277,_0xbda8('0x25'),JSON[_0xbda8('0x27')](_0x97eb90));if(_0x97eb90['error']){if(_0x97eb90[_0xbda8('0x28')][_0xbda8('0x29')]===0x1f4){logger[_0xbda8('0x28')](_0xbda8('0x24'),_0x15c277,_0x97eb90['error'][_0xbda8('0x2a')]);return _0x47c4db(_0x97eb90['error']['message']);}logger[_0xbda8('0x28')](_0xbda8('0x24'),_0x15c277,_0x97eb90[_0xbda8('0x28')][_0xbda8('0x2a')]);return _0x1c6456(_0x97eb90[_0xbda8('0x28')][_0xbda8('0x2a')]);}else{logger['info'](_0xbda8('0x24'),_0x15c277,_0xbda8('0x25'));_0x1c6456(_0x97eb90['result']['message']);}})[_0xbda8('0x2b')](function(_0x1551c5){logger[_0xbda8('0x28')]('FaxMessage,\x20%s,\x20%s',_0x15c277,_0x1551c5);_0x47c4db(_0x1551c5);});});}function respondWithStatusCode(_0x3c670c,_0x389f6b){_0x389f6b=_0x389f6b||0xcc;return function(_0x59e84a){if(_0x59e84a){return _0x3c670c[_0xbda8('0x2c')](_0x389f6b);}return _0x3c670c[_0xbda8('0x2d')](_0x389f6b)[_0xbda8('0x2e')]();};}function respondWithResult(_0x27dcdf,_0x4cb2cf){_0x4cb2cf=_0x4cb2cf||0xc8;return function(_0x10e641){if(_0x10e641){return _0x27dcdf['status'](_0x4cb2cf)['json'](_0x10e641);}};}function respondWithFilteredResult(_0x526b6d,_0x5ad6bf){return function(_0xcb8e01){if(_0xcb8e01){var _0x429fac=typeof _0x5ad6bf['offset']===_0xbda8('0x2f')&&typeof _0x5ad6bf[_0xbda8('0x30')]===_0xbda8('0x2f');var _0x4a34f2=_0xcb8e01[_0xbda8('0x31')];var _0x323c94=_0x429fac?0x0:_0x5ad6bf[_0xbda8('0x32')];var _0x145537=_0x429fac?_0xcb8e01[_0xbda8('0x31')]:_0x5ad6bf['offset']+_0x5ad6bf[_0xbda8('0x30')];var _0xd48828;if(_0x145537>=_0x4a34f2){_0x145537=_0x4a34f2;_0xd48828=0xc8;}else{_0xd48828=0xce;}_0x526b6d[_0xbda8('0x2d')](_0xd48828);return _0x526b6d[_0xbda8('0x33')]('Content-Range',_0x323c94+'-'+_0x145537+'/'+_0x4a34f2)[_0xbda8('0x34')](_0xcb8e01);}return null;};}function patchUpdates(_0x50c710){return function(_0x2c51e1){try{jsonpatch[_0xbda8('0x35')](_0x2c51e1,_0x50c710,!![]);}catch(_0x478c78){return BPromise['reject'](_0x478c78);}return _0x2c51e1['save']();};}function saveUpdates(_0x29633d,_0x349ad0){return function(_0x53c29b){if(_0x53c29b){return _0x53c29b[_0xbda8('0x36')](_0x29633d)[_0xbda8('0x37')](function(_0x44e5cb){return _0x44e5cb;});}return null;};}function removeEntity(_0x51466b,_0x4a2db1){return function(_0x2576ed){if(_0x2576ed){return _0x2576ed['destroy']()[_0xbda8('0x37')](function(){_0x51466b['status'](0xcc)[_0xbda8('0x2e')]();});}};}function handleEntityNotFound(_0x268592,_0x2d3d83){return function(_0x4f0171){if(!_0x4f0171){_0x268592['sendStatus'](0x194);}return _0x4f0171;};}function handleError(_0x172fb3,_0x22b356){_0x22b356=_0x22b356||0x1f4;return function(_0x5ac0d0){logger['error'](_0x5ac0d0['stack']);if(_0x5ac0d0['name']){delete _0x5ac0d0[_0xbda8('0x38')];}_0x172fb3[_0xbda8('0x2d')](_0x22b356)[_0xbda8('0x39')](_0x5ac0d0);};}exports[_0xbda8('0x3a')]=function(_0x53f59d,_0x440e39){var _0x11892c={},_0x5ab67a={},_0x49ec3e={'count':0x0,'rows':[]};var _0x4da7a6=_[_0xbda8('0x3b')](db[_0xbda8('0x3c')]['rawAttributes'],function(_0x11b89c){return{'name':_0x11b89c[_0xbda8('0x3d')],'type':_0x11b89c[_0xbda8('0x3e')][_0xbda8('0x3f')]};});_0x5ab67a['model']=_[_0xbda8('0x3b')](_0x4da7a6,'name');_0x5ab67a[_0xbda8('0x40')]=_[_0xbda8('0x41')](_0x53f59d['query']);_0x5ab67a[_0xbda8('0x42')]=_[_0xbda8('0x43')](_0x5ab67a['model'],_0x5ab67a[_0xbda8('0x40')]);_0x11892c[_0xbda8('0x44')]=_[_0xbda8('0x43')](_0x5ab67a[_0xbda8('0x45')],qs[_0xbda8('0x46')](_0x53f59d['query'][_0xbda8('0x46')]));_0x11892c[_0xbda8('0x44')]=_0x11892c['attributes'][_0xbda8('0x47')]?_0x11892c['attributes']:_0x5ab67a['model'];if(!_0x53f59d[_0xbda8('0x40')][_0xbda8('0x48')]('nolimit')){_0x11892c[_0xbda8('0x30')]=qs['limit'](_0x53f59d['query'][_0xbda8('0x30')]);_0x11892c[_0xbda8('0x32')]=qs[_0xbda8('0x32')](_0x53f59d[_0xbda8('0x40')][_0xbda8('0x32')]);}_0x11892c['order']=qs[_0xbda8('0x49')](_0x53f59d['query'][_0xbda8('0x49')]);_0x11892c[_0xbda8('0x4a')]=qs['filters'](_[_0xbda8('0x4b')](_0x53f59d['query'],_0x5ab67a[_0xbda8('0x42')]),_0x4da7a6);if(_0x53f59d[_0xbda8('0x40')][_0xbda8('0x4c')]){_0x11892c[_0xbda8('0x4a')]=_['merge'](_0x11892c[_0xbda8('0x4a')],{'$or':_[_0xbda8('0x3b')](_0x4da7a6,function(_0x3f76ef){if(_0x3f76ef['type']!==_0xbda8('0x4d')){var _0x31d762={};_0x31d762[_0x3f76ef['name']]={'$like':'%'+_0x53f59d['query'][_0xbda8('0x4c')]+'%'};return _0x31d762;}})});}_0x11892c=_['merge']({},_0x11892c,_0x53f59d[_0xbda8('0x4e')]);var _0xb1ed70={'where':_0x11892c[_0xbda8('0x4a')]};return db[_0xbda8('0x3c')][_0xbda8('0x31')](_0xb1ed70)['then'](function(_0x4db4f0){_0x49ec3e[_0xbda8('0x31')]=_0x4db4f0;if(_0x53f59d['query'][_0xbda8('0x4f')]){_0x11892c[_0xbda8('0x50')]=[{'all':!![]}];}return db[_0xbda8('0x3c')][_0xbda8('0x51')](_0x11892c);})[_0xbda8('0x37')](function(_0x285a8d){_0x49ec3e['rows']=_0x285a8d;return _0x49ec3e;})['then'](respondWithFilteredResult(_0x440e39,_0x11892c))[_0xbda8('0x2b')](handleError(_0x440e39,null));};exports['show']=function(_0x3247b2,_0x3fb8ce){var _0x8b2b6a={'raw':!![],'where':{'id':_0x3247b2['params']['id']}},_0x5c7f12={};_0x5c7f12[_0xbda8('0x45')]=_[_0xbda8('0x41')](db[_0xbda8('0x3c')]['rawAttributes']);_0x5c7f12[_0xbda8('0x40')]=_[_0xbda8('0x41')](_0x3247b2['query']);_0x5c7f12[_0xbda8('0x42')]=_[_0xbda8('0x43')](_0x5c7f12[_0xbda8('0x45')],_0x5c7f12[_0xbda8('0x40')]);_0x8b2b6a[_0xbda8('0x44')]=_['intersection'](_0x5c7f12[_0xbda8('0x45')],qs[_0xbda8('0x46')](_0x3247b2[_0xbda8('0x40')][_0xbda8('0x46')]));_0x8b2b6a['attributes']=_0x8b2b6a[_0xbda8('0x44')][_0xbda8('0x47')]?_0x8b2b6a[_0xbda8('0x44')]:_0x5c7f12[_0xbda8('0x45')];if(_0x3247b2[_0xbda8('0x40')][_0xbda8('0x4f')]){_0x8b2b6a[_0xbda8('0x50')]=[{'all':!![]}];}_0x8b2b6a=_[_0xbda8('0x52')]({},_0x8b2b6a,_0x3247b2[_0xbda8('0x4e')]);return db[_0xbda8('0x3c')][_0xbda8('0x53')](_0x8b2b6a)['then'](handleEntityNotFound(_0x3fb8ce,null))[_0xbda8('0x37')](respondWithResult(_0x3fb8ce,null))[_0xbda8('0x2b')](handleError(_0x3fb8ce,null));};exports[_0xbda8('0x36')]=function(_0x221c1d,_0x46a706){if(_0x221c1d[_0xbda8('0x54')]['id']){delete _0x221c1d[_0xbda8('0x54')]['id'];}return db[_0xbda8('0x3c')][_0xbda8('0x53')]({'where':{'id':_0x221c1d['params']['id']}})['then'](handleEntityNotFound(_0x46a706,null))[_0xbda8('0x37')](saveUpdates(_0x221c1d['body'],null))[_0xbda8('0x37')](respondWithResult(_0x46a706,null))[_0xbda8('0x2b')](handleError(_0x46a706,null));};exports['destroy']=function(_0x1a4a5f,_0x16fac8){return db[_0xbda8('0x3c')][_0xbda8('0x53')]({'where':{'id':_0x1a4a5f[_0xbda8('0x55')]['id']}})[_0xbda8('0x37')](handleEntityNotFound(_0x16fac8,null))['then'](removeEntity(_0x16fac8,null))[_0xbda8('0x2b')](handleError(_0x16fac8,null));};exports[_0xbda8('0x56')]=function(_0x148ec8,_0x32dc0d){return db[_0xbda8('0x3c')][_0xbda8('0x56')]()['then'](respondWithResult(_0x32dc0d,null))['catch'](handleError(_0x32dc0d,null));};var interaction_log=require(_0xbda8('0x16'))('fax-interactions');exports[_0xbda8('0x57')]=function(_0x4a9c4a,_0x3e7b05,_0x1d3d7f){var _0x15e300={'agent':{},'channel':_0xbda8('0x58')};if(_0x4a9c4a[_0xbda8('0x54')]['id']){delete _0x4a9c4a['body']['id'];}_0x4a9c4a[_0xbda8('0x54')][_0xbda8('0x59')]=!![];_0x4a9c4a[_0xbda8('0x54')][_0xbda8('0x5a')]=moment()[_0xbda8('0x5b')](_0xbda8('0x5c'));_0x4a9c4a[_0xbda8('0x54')][_0xbda8('0x5d')]=_0x4a9c4a[_0xbda8('0x54')][_0xbda8('0x5d')]||_0x4a9c4a[_0xbda8('0x5e')]['id'];_0x15e300[_0xbda8('0x5f')]['id']=_0x4a9c4a[_0xbda8('0x54')][_0xbda8('0x5d')];return db[_0xbda8('0x3c')]['find']({'where':{'id':_0x4a9c4a[_0xbda8('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e7b05,null))[_0xbda8('0x37')](saveUpdates(_0x4a9c4a[_0xbda8('0x54')],null))[_0xbda8('0x37')](function(_0x36f27f){if(_0x36f27f){_0x15e300['message']=_0x36f27f[_0xbda8('0x60')]({'plain':!![]});return db['FaxInteraction'][_0xbda8('0x53')]({'where':{'id':_0x36f27f['FaxInteractionId']}});}return null;})[_0xbda8('0x37')](handleEntityNotFound(_0x3e7b05,null))[_0xbda8('0x37')](function(_0x3b765b){if(_0x3b765b){return _0x3b765b['update']({'UserId':_0x4a9c4a[_0xbda8('0x54')]['UserId'],'read1stAt':_[_0xbda8('0x61')](_0x3b765b[_0xbda8('0x62')])?moment()[_0xbda8('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbda8('0x37')](function(_0x5c99a7){if(_0x5c99a7){_0x15e300[_0xbda8('0x63')]=_0x5c99a7['get']({'plain':!![]});interaction_log[_0xbda8('0x23')](_0xbda8('0x64'),_0x4a9c4a['user']['id'],_0x4a9c4a['user'][_0xbda8('0x38')],_0x4a9c4a[_0xbda8('0x5e')][_0xbda8('0x65')],_0x15e300['interaction']['id'],_0x4a9c4a['body']?JSON['stringify'](_0x4a9c4a[_0xbda8('0x54')]):_0xbda8('0x66'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x15e300);}return null;})[_0xbda8('0x37')](function(_0x22055c){var _0x2e7021=_0xbda8('0x67')+_0x22055c['message'][_0xbda8('0x68')];return db[_0xbda8('0x69')][_0xbda8('0x40')](_0x2e7021,{'type':db[_0xbda8('0x6a')][_0xbda8('0x6b')][_0xbda8('0x6c')],'raw':!![]})['then'](function(_0x216c3d){return _0x216c3d;});})[_0xbda8('0x37')](function(_0xf6ec72){if(_0xf6ec72){_0x15e300[_0xbda8('0x2a')][_0xbda8('0x6d')]=_0xf6ec72[0x0];if(!_0x4a9c4a[_0xbda8('0x54')][_0xbda8('0x5d')])return;return db[_0xbda8('0x6e')][_0xbda8('0x53')]({'where':{'id':_0x4a9c4a[_0xbda8('0x54')][_0xbda8('0x5d')],'role':'agent'},'attributes':['id',_0xbda8('0x38'),_0xbda8('0x6f'),'email',_0xbda8('0x70')],'raw':!![]});}return null;})[_0xbda8('0x37')](function(_0x5f4a2a){if(!_0x5f4a2a)return null;_0x15e300[_0xbda8('0x2a')][_0xbda8('0x5f')]=_0x5f4a2a;return _0x15e300;})[_0xbda8('0x37')](function(_0x2fd44e){if(_0x2fd44e){if(_0x4a9c4a[_0xbda8('0x54')]['manual']){_0x15e300[_0xbda8('0x2a')]['interface']=util['format']('SIP/%s',_0x4a9c4a[_0xbda8('0x5e')][_0xbda8('0x38')]);_0x15e300['message']['channel']=_0x15e300[_0xbda8('0x71')];_0x15e300[_0xbda8('0x2a')][_0xbda8('0x72')]=_0x15e300['channel'];_0x15e300[_0xbda8('0x2a')][_0xbda8('0x73')]=_0xbda8('0x57');return respondWithRpcPromise(_0xbda8('0x74'),'EventManager',{'event':_0xbda8('0x75'),'message':_0x15e300['message']},client9002)[_0xbda8('0x37')](function(){return _0x15e300;});}return _0x15e300;}return null;})['then'](respondWithResult(_0x3e7b05,null))['catch'](handleError(_0x3e7b05,null));};var interaction_log=require(_0xbda8('0x16'))(_0xbda8('0x76'));exports['reject']=function(_0x2216d3,_0x1d7a1c,_0x167bdc){var _0x3d433c={'agent':{},'channel':_0xbda8('0x58')};if(_0x2216d3['body']['id']){delete _0x2216d3['body']['id'];}_0x2216d3[_0xbda8('0x54')][_0xbda8('0x5d')]=_0x2216d3[_0xbda8('0x54')]['UserId']||_0x2216d3[_0xbda8('0x5e')]['id'];_0x3d433c[_0xbda8('0x5f')]['id']=_0x2216d3['body'][_0xbda8('0x5d')];return db[_0xbda8('0x3c')][_0xbda8('0x53')]({'where':{'id':_0x2216d3[_0xbda8('0x55')]['id'],'UserId':null}})[_0xbda8('0x37')](handleEntityNotFound(_0x1d7a1c,null))[_0xbda8('0x37')](function(_0x254903){if(_0x254903){_0x3d433c[_0xbda8('0x2a')]=_0x254903[_0xbda8('0x60')]({'plain':!![]});return db[_0xbda8('0x77')][_0xbda8('0x53')]({'where':{'id':_0x254903[_0xbda8('0x78')]}});}return null;})[_0xbda8('0x37')](handleEntityNotFound(_0x1d7a1c,null))[_0xbda8('0x37')](function(_0x4fe77f){if(_0x4fe77f){_0x3d433c['interaction']=_0x4fe77f[_0xbda8('0x60')]({'plain':!![]});interaction_log[_0xbda8('0x23')](_0xbda8('0x79'),_0x2216d3[_0xbda8('0x5e')]['id'],_0x2216d3[_0xbda8('0x5e')][_0xbda8('0x38')],_0x2216d3['user'][_0xbda8('0x65')],_0x3d433c[_0xbda8('0x63')]['id'],_0x2216d3[_0xbda8('0x54')]?JSON[_0xbda8('0x27')](_0x2216d3[_0xbda8('0x54')]):_0xbda8('0x66'));return respondWithRpcPromise('RejectMessage',_0xbda8('0x7a'),_0x3d433c);}return null;})[_0xbda8('0x37')](function(_0x18e88a){var _0x4653b2=_0xbda8('0x67')+_0x18e88a['message'][_0xbda8('0x68')];return db['sequelize'][_0xbda8('0x40')](_0x4653b2,{'type':db[_0xbda8('0x6a')][_0xbda8('0x6b')]['SELECT'],'raw':!![]})[_0xbda8('0x37')](function(_0x282280){return _0x282280;});})[_0xbda8('0x37')](function(_0x5b1b2b){if(_0x5b1b2b){_0x3d433c[_0xbda8('0x2a')][_0xbda8('0x6d')]=_0x5b1b2b[0x0];if(!_0x2216d3[_0xbda8('0x54')][_0xbda8('0x5d')])return;return db[_0xbda8('0x6e')]['find']({'where':{'id':_0x2216d3[_0xbda8('0x54')][_0xbda8('0x5d')],'role':'agent'},'attributes':['id',_0xbda8('0x38'),_0xbda8('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0xbda8('0x37')](function(_0x46a130){if(!_0x46a130)return null;_0x3d433c['message'][_0xbda8('0x5f')]=_0x46a130;return _0x3d433c;})[_0xbda8('0x37')](function(_0x28851d){if(_0x28851d){_0x28851d[_0xbda8('0x2a')][_0xbda8('0x7b')]=util[_0xbda8('0x5b')](_0xbda8('0x7c'),_0x2216d3[_0xbda8('0x5e')][_0xbda8('0x38')]);_0x28851d[_0xbda8('0x2a')][_0xbda8('0x71')]=_0x3d433c[_0xbda8('0x71')];_0x28851d[_0xbda8('0x2a')][_0xbda8('0x72')]=_0x3d433c[_0xbda8('0x71')];_0x28851d['message']['event']=_0xbda8('0x7d');respondWithRpcPromise(_0xbda8('0x74'),_0xbda8('0x74'),{'event':_0xbda8('0x7e'),'message':_0x28851d[_0xbda8('0x2a')]},client9002);return _0x3d433c;}return null;})[_0xbda8('0x37')](respondWithResult(_0x1d7a1c,null))['catch'](handleError(_0x1d7a1c,null));};exports[_0xbda8('0x7f')]=function(_0x23ba26,_0x519300){var _0xd2c1fe;return db['FaxMessage'][_0xbda8('0x7f')](_0x23ba26[_0xbda8('0x54')],{})[_0xbda8('0x37')](function(_0x32bd68){_0xd2c1fe=_0x32bd68;return db[_0xbda8('0x80')][_0xbda8('0x81')]({'where':{'id':_0xd2c1fe[_0xbda8('0x68')]}});})['then'](function(_0x8781c7){if(_[_0xbda8('0x61')](_0x8781c7)){return;}else{_0xd2c1fe[_0xbda8('0x58')]=_0x8781c7['fax'];return db['Attachment'][_0xbda8('0x81')]({'where':{'id':_0xd2c1fe[_0xbda8('0x82')]}});}})[_0xbda8('0x37')](function(_0x54d7e5){return respondWithRpcPromise(_0xbda8('0x83'),_0xbda8('0x83'),{'FaxAccountId':_[_0xbda8('0x61')](_0x23ba26[_0xbda8('0x54')])?undefined:_0x23ba26[_0xbda8('0x54')][_0xbda8('0x84')],'path':_['isNil'](_0x54d7e5)?undefined:util[_0xbda8('0x5b')]('/var/opt/motion2/server/files/attachments/%s',_0x54d7e5[_0xbda8('0x85')]),'fax':_[_0xbda8('0x61')](_0xd2c1fe[_0xbda8('0x58')])?undefined:_0xd2c1fe[_0xbda8('0x58')],'AttachmentId':_0xd2c1fe['AttachmentId']},client9002);})[_0xbda8('0x37')](respondWithResult(_0x519300,0xc9))[_0xbda8('0x2b')](handleError(_0x519300,null));};exports[_0xbda8('0x86')]=function(_0x3e15c4,_0x2621db){var _0x3f513a=path[_0xbda8('0x87')](config[_0xbda8('0x88')],_0xbda8('0x89'),_0xbda8('0x8a'),_0xbda8('0x8b'));return db[_0xbda8('0x3c')][_0xbda8('0x53')]({'where':{'id':_0x3e15c4['params']['id']},'include':[{'model':db['Attachment'],'as':_0xbda8('0x8c')}]})[_0xbda8('0x37')](handleEntityNotFound(_0x2621db,null))[_0xbda8('0x37')](function(_0x51bad6){if(_0x51bad6){return _0x2621db[_0xbda8('0x86')](path['join'](_0x3f513a,_0x51bad6[_0xbda8('0x8c')]['basename']));}})[_0xbda8('0x2b')](handleError(_0x2621db,null));}; \ No newline at end of file +var _0x2298=['options','count','include','findAll','rows','show','params','includeAll','find','body','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','interface','rejectmessage','create','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','end','sendStatus','stack','name','send','map','FaxMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge'];(function(_0x415cf4,_0x1c5b67){var _0x11b6f2=function(_0x4400da){while(--_0x4400da){_0x415cf4['push'](_0x415cf4['shift']());}};_0x11b6f2(++_0x1c5b67);}(_0x2298,0x162));var _0x8229=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2298[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x8229('0x0'));var rimraf=require(_0x8229('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8229('0x2'));var moment=require(_0x8229('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8229('0x4'));var util=require(_0x8229('0x5'));var path=require(_0x8229('0x6'));var sox=require(_0x8229('0x7'));var csv=require(_0x8229('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8229('0x9'));var squel=require(_0x8229('0xa'));var crypto=require('crypto');var jsforce=require(_0x8229('0xb'));var deskjs=require(_0x8229('0xc'));var toCsv=require(_0x8229('0x8'));var querystring=require(_0x8229('0xd'));var Papa=require('papaparse');var Redis=require(_0x8229('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8229('0xf'));var as=require(_0x8229('0x10'));var hardwareService=require(_0x8229('0x11'));var logger=require(_0x8229('0x12'))(_0x8229('0x13'));var utils=require(_0x8229('0x14'));var config=require(_0x8229('0x15'));var licenseUtil=require(_0x8229('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8229('0x17')](config['redis'],{'host':_0x8229('0x18'),'port':0x18eb});var socket=require(_0x8229('0x19'))(new Redis(config['redis']));require(_0x8229('0x1a'))['register'](socket);var jayson=require(_0x8229('0x1b'));var client=jayson[_0x8229('0x1c')][_0x8229('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x8229('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x920683,_0x4c091a,_0x442c9c,_0x19c2ba){return new BPromise(function(_0x59f1b3,_0x4cf268){var _0x2ebeba=_0x19c2ba||client;return _0x2ebeba[_0x8229('0x1e')](_0x920683,_0x442c9c)[_0x8229('0x1f')](function(_0x2d823a){logger[_0x8229('0x20')]('FaxMessage,\x20%s,\x20%s',_0x4c091a,'request\x20sent');logger['debug'](_0x8229('0x21'),_0x4c091a,_0x8229('0x22'),JSON[_0x8229('0x23')](_0x2d823a));if(_0x2d823a[_0x8229('0x24')]){if(_0x2d823a[_0x8229('0x24')][_0x8229('0x25')]===0x1f4){logger[_0x8229('0x24')](_0x8229('0x26'),_0x4c091a,_0x2d823a['error'][_0x8229('0x27')]);return _0x4cf268(_0x2d823a[_0x8229('0x24')][_0x8229('0x27')]);}logger['error'](_0x8229('0x26'),_0x4c091a,_0x2d823a[_0x8229('0x24')][_0x8229('0x27')]);return _0x59f1b3(_0x2d823a[_0x8229('0x24')]['message']);}else{logger[_0x8229('0x20')]('FaxMessage,\x20%s,\x20%s',_0x4c091a,'request\x20sent');_0x59f1b3(_0x2d823a[_0x8229('0x28')][_0x8229('0x27')]);}})[_0x8229('0x29')](function(_0x4c46e2){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4c091a,_0x4c46e2);_0x4cf268(_0x4c46e2);});});}function respondWithStatusCode(_0x444411,_0x4a004a){_0x4a004a=_0x4a004a||0xcc;return function(_0x16213b){if(_0x16213b){return _0x444411['sendStatus'](_0x4a004a);}return _0x444411[_0x8229('0x2a')](_0x4a004a)['end']();};}function respondWithResult(_0x3471fc,_0x1e0003){_0x1e0003=_0x1e0003||0xc8;return function(_0x3e0f99){if(_0x3e0f99){return _0x3471fc[_0x8229('0x2a')](_0x1e0003)[_0x8229('0x2b')](_0x3e0f99);}};}function respondWithFilteredResult(_0x273cbd,_0x530b8e){return function(_0x379efb){if(_0x379efb){var _0x136f0c=typeof _0x530b8e[_0x8229('0x2c')]==='undefined'&&typeof _0x530b8e[_0x8229('0x2d')]==='undefined';var _0x40ae88=_0x379efb['count'];var _0x170540=_0x136f0c?0x0:_0x530b8e[_0x8229('0x2c')];var _0x4fac90=_0x136f0c?_0x379efb['count']:_0x530b8e[_0x8229('0x2c')]+_0x530b8e['limit'];var _0x2f8bdb;if(_0x4fac90>=_0x40ae88){_0x4fac90=_0x40ae88;_0x2f8bdb=0xc8;}else{_0x2f8bdb=0xce;}_0x273cbd['status'](_0x2f8bdb);return _0x273cbd[_0x8229('0x2e')](_0x8229('0x2f'),_0x170540+'-'+_0x4fac90+'/'+_0x40ae88)[_0x8229('0x2b')](_0x379efb);}return null;};}function patchUpdates(_0x425dc1){return function(_0x2e434e){try{jsonpatch[_0x8229('0x30')](_0x2e434e,_0x425dc1,!![]);}catch(_0x1e4583){return BPromise[_0x8229('0x31')](_0x1e4583);}return _0x2e434e['save']();};}function saveUpdates(_0x3cbcce,_0xacff09){return function(_0xa2e15f){if(_0xa2e15f){return _0xa2e15f[_0x8229('0x32')](_0x3cbcce)['then'](function(_0x514a67){return _0x514a67;});}return null;};}function removeEntity(_0x190cd7,_0x259b05){return function(_0x27ea5f){if(_0x27ea5f){return _0x27ea5f[_0x8229('0x33')]()[_0x8229('0x1f')](function(){_0x190cd7[_0x8229('0x2a')](0xcc)[_0x8229('0x34')]();});}};}function handleEntityNotFound(_0x12224e,_0x38c523){return function(_0x14aca8){if(!_0x14aca8){_0x12224e[_0x8229('0x35')](0x194);}return _0x14aca8;};}function handleError(_0x246cf3,_0xea2a19){_0xea2a19=_0xea2a19||0x1f4;return function(_0x126eff){logger[_0x8229('0x24')](_0x126eff[_0x8229('0x36')]);if(_0x126eff['name']){delete _0x126eff[_0x8229('0x37')];}_0x246cf3[_0x8229('0x2a')](_0xea2a19)[_0x8229('0x38')](_0x126eff);};}exports['index']=function(_0x429210,_0x51d45c){var _0x3bc789={},_0x4a4791={},_0x28924d={'count':0x0,'rows':[]};var _0x487245=_[_0x8229('0x39')](db[_0x8229('0x3a')][_0x8229('0x3b')],function(_0x119eeb){return{'name':_0x119eeb[_0x8229('0x3c')],'type':_0x119eeb[_0x8229('0x3d')][_0x8229('0x3e')]};});_0x4a4791['model']=_['map'](_0x487245,_0x8229('0x37'));_0x4a4791[_0x8229('0x3f')]=_[_0x8229('0x40')](_0x429210[_0x8229('0x3f')]);_0x4a4791[_0x8229('0x41')]=_[_0x8229('0x42')](_0x4a4791[_0x8229('0x43')],_0x4a4791['query']);_0x3bc789[_0x8229('0x44')]=_[_0x8229('0x42')](_0x4a4791[_0x8229('0x43')],qs[_0x8229('0x45')](_0x429210['query'][_0x8229('0x45')]));_0x3bc789[_0x8229('0x44')]=_0x3bc789[_0x8229('0x44')][_0x8229('0x46')]?_0x3bc789[_0x8229('0x44')]:_0x4a4791[_0x8229('0x43')];if(!_0x429210[_0x8229('0x3f')][_0x8229('0x47')](_0x8229('0x48'))){_0x3bc789[_0x8229('0x2d')]=qs['limit'](_0x429210[_0x8229('0x3f')][_0x8229('0x2d')]);_0x3bc789[_0x8229('0x2c')]=qs[_0x8229('0x2c')](_0x429210[_0x8229('0x3f')]['offset']);}_0x3bc789[_0x8229('0x49')]=qs[_0x8229('0x4a')](_0x429210['query']['sort']);_0x3bc789['where']=qs[_0x8229('0x41')](_['pick'](_0x429210[_0x8229('0x3f')],_0x4a4791[_0x8229('0x41')]),_0x487245);if(_0x429210[_0x8229('0x3f')][_0x8229('0x4b')]){_0x3bc789[_0x8229('0x4c')]=_[_0x8229('0x4d')](_0x3bc789[_0x8229('0x4c')],{'$or':_[_0x8229('0x39')](_0x487245,function(_0x55bc5d){if(_0x55bc5d[_0x8229('0x3d')]!=='VIRTUAL'){var _0x7b0722={};_0x7b0722[_0x55bc5d[_0x8229('0x37')]]={'$like':'%'+_0x429210['query'][_0x8229('0x4b')]+'%'};return _0x7b0722;}})});}_0x3bc789=_[_0x8229('0x4d')]({},_0x3bc789,_0x429210[_0x8229('0x4e')]);var _0x5af956={'where':_0x3bc789[_0x8229('0x4c')]};return db['FaxMessage']['count'](_0x5af956)[_0x8229('0x1f')](function(_0x3d251d){_0x28924d[_0x8229('0x4f')]=_0x3d251d;if(_0x429210[_0x8229('0x3f')]['includeAll']){_0x3bc789[_0x8229('0x50')]=[{'all':!![]}];}return db['FaxMessage'][_0x8229('0x51')](_0x3bc789);})[_0x8229('0x1f')](function(_0x4901ec){_0x28924d[_0x8229('0x52')]=_0x4901ec;return _0x28924d;})[_0x8229('0x1f')](respondWithFilteredResult(_0x51d45c,_0x3bc789))[_0x8229('0x29')](handleError(_0x51d45c,null));};exports[_0x8229('0x53')]=function(_0x45fc26,_0x47024e){var _0x5ea06a={'raw':!![],'where':{'id':_0x45fc26[_0x8229('0x54')]['id']}},_0x1f9735={};_0x1f9735[_0x8229('0x43')]=_['keys'](db[_0x8229('0x3a')][_0x8229('0x3b')]);_0x1f9735[_0x8229('0x3f')]=_[_0x8229('0x40')](_0x45fc26['query']);_0x1f9735[_0x8229('0x41')]=_[_0x8229('0x42')](_0x1f9735[_0x8229('0x43')],_0x1f9735[_0x8229('0x3f')]);_0x5ea06a[_0x8229('0x44')]=_[_0x8229('0x42')](_0x1f9735['model'],qs[_0x8229('0x45')](_0x45fc26[_0x8229('0x3f')]['fields']));_0x5ea06a[_0x8229('0x44')]=_0x5ea06a[_0x8229('0x44')][_0x8229('0x46')]?_0x5ea06a[_0x8229('0x44')]:_0x1f9735[_0x8229('0x43')];if(_0x45fc26[_0x8229('0x3f')][_0x8229('0x55')]){_0x5ea06a[_0x8229('0x50')]=[{'all':!![]}];}_0x5ea06a=_[_0x8229('0x4d')]({},_0x5ea06a,_0x45fc26['options']);return db[_0x8229('0x3a')][_0x8229('0x56')](_0x5ea06a)[_0x8229('0x1f')](handleEntityNotFound(_0x47024e,null))['then'](respondWithResult(_0x47024e,null))[_0x8229('0x29')](handleError(_0x47024e,null));};exports[_0x8229('0x32')]=function(_0x5209ca,_0x10e3ec){if(_0x5209ca[_0x8229('0x57')]['id']){delete _0x5209ca[_0x8229('0x57')]['id'];}return db[_0x8229('0x3a')]['find']({'where':{'id':_0x5209ca['params']['id']}})[_0x8229('0x1f')](handleEntityNotFound(_0x10e3ec,null))[_0x8229('0x1f')](saveUpdates(_0x5209ca[_0x8229('0x57')],null))[_0x8229('0x1f')](respondWithResult(_0x10e3ec,null))[_0x8229('0x29')](handleError(_0x10e3ec,null));};exports['destroy']=function(_0x8e8f12,_0x290d5f){return db['FaxMessage']['find']({'where':{'id':_0x8e8f12[_0x8229('0x54')]['id']}})[_0x8229('0x1f')](handleEntityNotFound(_0x290d5f,null))['then'](removeEntity(_0x290d5f,null))[_0x8229('0x29')](handleError(_0x290d5f,null));};exports[_0x8229('0x58')]=function(_0x2029c9,_0x233987){return db['FaxMessage'][_0x8229('0x58')]()[_0x8229('0x1f')](respondWithResult(_0x233987,null))[_0x8229('0x29')](handleError(_0x233987,null));};var interaction_log=require(_0x8229('0x12'))(_0x8229('0x59'));exports[_0x8229('0x5a')]=function(_0x934204,_0x3bf2b6,_0x324585){var _0x46d6f7={'agent':{},'channel':_0x8229('0x5b')};if(_0x934204['body']['id']){delete _0x934204[_0x8229('0x57')]['id'];}_0x934204[_0x8229('0x57')][_0x8229('0x5c')]=!![];_0x934204[_0x8229('0x57')]['readAt']=moment()[_0x8229('0x5d')](_0x8229('0x5e'));_0x934204[_0x8229('0x57')][_0x8229('0x5f')]=_0x934204[_0x8229('0x57')][_0x8229('0x5f')]||_0x934204[_0x8229('0x60')]['id'];_0x46d6f7[_0x8229('0x61')]['id']=_0x934204['body'][_0x8229('0x5f')];return db[_0x8229('0x3a')][_0x8229('0x56')]({'where':{'id':_0x934204[_0x8229('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3bf2b6,null))['then'](saveUpdates(_0x934204[_0x8229('0x57')],null))[_0x8229('0x1f')](function(_0x2e4825){if(_0x2e4825){_0x46d6f7[_0x8229('0x27')]=_0x2e4825[_0x8229('0x62')]({'plain':!![]});return db[_0x8229('0x63')][_0x8229('0x56')]({'where':{'id':_0x2e4825[_0x8229('0x64')]}});}return null;})[_0x8229('0x1f')](handleEntityNotFound(_0x3bf2b6,null))[_0x8229('0x1f')](function(_0x347a5a){if(_0x347a5a){return _0x347a5a[_0x8229('0x32')]({'UserId':_0x934204['body'][_0x8229('0x5f')],'read1stAt':_[_0x8229('0x65')](_0x347a5a[_0x8229('0x66')])?moment()[_0x8229('0x5d')](_0x8229('0x5e')):undefined});}return null;})[_0x8229('0x1f')](function(_0x13517a){if(_0x13517a){_0x46d6f7[_0x8229('0x67')]=_0x13517a[_0x8229('0x62')]({'plain':!![]});interaction_log[_0x8229('0x20')](_0x8229('0x68'),_0x934204[_0x8229('0x60')]['id'],_0x934204[_0x8229('0x60')][_0x8229('0x37')],_0x934204[_0x8229('0x60')][_0x8229('0x69')],_0x46d6f7[_0x8229('0x67')]['id'],_0x934204['body']?JSON[_0x8229('0x23')](_0x934204['body']):_0x8229('0x6a'));return respondWithRpcPromise(_0x8229('0x6b'),_0x8229('0x6c'),_0x46d6f7);}return null;})[_0x8229('0x1f')](function(_0x2ddda6){var _0x450d3c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2ddda6[_0x8229('0x27')][_0x8229('0x6d')];return db[_0x8229('0x6e')][_0x8229('0x3f')](_0x450d3c,{'type':db['Sequelize'][_0x8229('0x6f')][_0x8229('0x70')],'raw':!![]})[_0x8229('0x1f')](function(_0x4bf432){return _0x4bf432;});})[_0x8229('0x1f')](function(_0x2194bb){if(_0x2194bb){_0x46d6f7['message'][_0x8229('0x71')]=_0x2194bb[0x0];if(!_0x934204[_0x8229('0x57')][_0x8229('0x5f')])return;return db[_0x8229('0x72')][_0x8229('0x56')]({'where':{'id':_0x934204['body'][_0x8229('0x5f')],'role':_0x8229('0x61')},'attributes':['id',_0x8229('0x37'),_0x8229('0x73'),'email',_0x8229('0x74')],'raw':!![]});}return null;})[_0x8229('0x1f')](function(_0x3bd41c){if(!_0x3bd41c)return null;_0x46d6f7['message'][_0x8229('0x61')]=_0x3bd41c;return _0x46d6f7;})[_0x8229('0x1f')](function(_0x221a70){if(_0x221a70){if(_0x934204['body'][_0x8229('0x75')]){_0x46d6f7[_0x8229('0x27')]['interface']=util[_0x8229('0x5d')](_0x8229('0x76'),_0x934204['user']['name']);_0x46d6f7[_0x8229('0x27')][_0x8229('0x77')]=_0x46d6f7[_0x8229('0x77')];_0x46d6f7[_0x8229('0x27')][_0x8229('0x78')]=_0x46d6f7[_0x8229('0x77')];_0x46d6f7['message'][_0x8229('0x79')]='accept';return respondWithRpcPromise(_0x8229('0x7a'),'EventManager',{'event':_0x8229('0x7b'),'message':_0x46d6f7[_0x8229('0x27')]},client9002)['then'](function(){return _0x46d6f7;});}return _0x46d6f7;}return null;})[_0x8229('0x1f')](respondWithResult(_0x3bf2b6,null))[_0x8229('0x29')](handleError(_0x3bf2b6,null));};var interaction_log=require(_0x8229('0x12'))(_0x8229('0x59'));exports[_0x8229('0x31')]=function(_0x32bc89,_0x4c222d,_0x43231a){var _0x2677fc={'agent':{},'channel':_0x8229('0x5b')};if(_0x32bc89[_0x8229('0x57')]['id']){delete _0x32bc89[_0x8229('0x57')]['id'];}_0x32bc89[_0x8229('0x57')][_0x8229('0x5f')]=_0x32bc89[_0x8229('0x57')][_0x8229('0x5f')]||_0x32bc89[_0x8229('0x60')]['id'];_0x2677fc['agent']['id']=_0x32bc89['body'][_0x8229('0x5f')];return db['FaxMessage']['find']({'where':{'id':_0x32bc89[_0x8229('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4c222d,null))[_0x8229('0x1f')](function(_0x568c51){if(_0x568c51){_0x2677fc[_0x8229('0x27')]=_0x568c51[_0x8229('0x62')]({'plain':!![]});return db[_0x8229('0x63')][_0x8229('0x56')]({'where':{'id':_0x568c51['FaxInteractionId']}});}return null;})[_0x8229('0x1f')](handleEntityNotFound(_0x4c222d,null))[_0x8229('0x1f')](function(_0x2cf70a){if(_0x2cf70a){_0x2677fc[_0x8229('0x67')]=_0x2cf70a[_0x8229('0x62')]({'plain':!![]});interaction_log[_0x8229('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x32bc89[_0x8229('0x60')]['id'],_0x32bc89[_0x8229('0x60')]['name'],_0x32bc89[_0x8229('0x60')][_0x8229('0x69')],_0x2677fc[_0x8229('0x67')]['id'],_0x32bc89[_0x8229('0x57')]?JSON['stringify'](_0x32bc89[_0x8229('0x57')]):_0x8229('0x6a'));return respondWithRpcPromise(_0x8229('0x7c'),_0x8229('0x7d'),_0x2677fc);}return null;})['then'](function(_0x2fb516){var _0xbcfc09=_0x8229('0x7e')+_0x2fb516[_0x8229('0x27')][_0x8229('0x6d')];return db[_0x8229('0x6e')][_0x8229('0x3f')](_0xbcfc09,{'type':db['Sequelize']['QueryTypes'][_0x8229('0x70')],'raw':!![]})[_0x8229('0x1f')](function(_0x446e16){return _0x446e16;});})[_0x8229('0x1f')](function(_0x32b6f3){if(_0x32b6f3){_0x2677fc[_0x8229('0x27')][_0x8229('0x71')]=_0x32b6f3[0x0];if(!_0x32bc89['body'][_0x8229('0x5f')])return;return db['User'][_0x8229('0x56')]({'where':{'id':_0x32bc89[_0x8229('0x57')]['UserId'],'role':'agent'},'attributes':['id',_0x8229('0x37'),_0x8229('0x73'),_0x8229('0x7f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x9758b3){if(!_0x9758b3)return null;_0x2677fc[_0x8229('0x27')][_0x8229('0x61')]=_0x9758b3;return _0x2677fc;})['then'](function(_0x1c382d){if(_0x1c382d){_0x1c382d['message'][_0x8229('0x80')]=util[_0x8229('0x5d')]('SIP/%s',_0x32bc89['user'][_0x8229('0x37')]);_0x1c382d[_0x8229('0x27')]['channel']=_0x2677fc[_0x8229('0x77')];_0x1c382d[_0x8229('0x27')]['motionChannel']=_0x2677fc[_0x8229('0x77')];_0x1c382d[_0x8229('0x27')]['event']='reject';respondWithRpcPromise(_0x8229('0x7a'),_0x8229('0x7a'),{'event':_0x8229('0x81'),'message':_0x1c382d[_0x8229('0x27')]},client9002);return _0x2677fc;}return null;})['then'](respondWithResult(_0x4c222d,null))[_0x8229('0x29')](handleError(_0x4c222d,null));};exports[_0x8229('0x82')]=function(_0x5522ec,_0x26eacb){var _0x589c3b;return db['FaxMessage'][_0x8229('0x82')](_0x5522ec['body'],{})['then'](function(_0xb38820){_0x589c3b=_0xb38820;return db['CmContact'][_0x8229('0x83')]({'where':{'id':_0x589c3b[_0x8229('0x6d')]}});})[_0x8229('0x1f')](function(_0x2a22a4){if(_[_0x8229('0x65')](_0x2a22a4)){return;}else{_0x589c3b['fax']=_0x2a22a4[_0x8229('0x5b')];return db[_0x8229('0x84')][_0x8229('0x83')]({'where':{'id':_0x589c3b['AttachmentId']}});}})[_0x8229('0x1f')](function(_0x5d99e5){return respondWithRpcPromise('SendFax',_0x8229('0x85'),{'FaxAccountId':_[_0x8229('0x65')](_0x5522ec[_0x8229('0x57')])?undefined:_0x5522ec[_0x8229('0x57')][_0x8229('0x86')],'path':_[_0x8229('0x65')](_0x5d99e5)?undefined:util['format'](_0x8229('0x87'),_0x5d99e5[_0x8229('0x88')]),'fax':_['isNil'](_0x589c3b[_0x8229('0x5b')])?undefined:_0x589c3b[_0x8229('0x5b')],'AttachmentId':_0x589c3b[_0x8229('0x89')]},client9002);})['then'](respondWithResult(_0x26eacb,0xc9))[_0x8229('0x29')](handleError(_0x26eacb,null));};exports[_0x8229('0x8a')]=function(_0x5e8233,_0x493fc5){var _0x5ccd28=path[_0x8229('0x8b')](config[_0x8229('0x8c')],_0x8229('0x8d'),_0x8229('0x8e'),_0x8229('0x8f'));return db[_0x8229('0x3a')][_0x8229('0x56')]({'where':{'id':_0x5e8233[_0x8229('0x54')]['id']},'include':[{'model':db[_0x8229('0x84')],'as':_0x8229('0x84')}]})[_0x8229('0x1f')](handleEntityNotFound(_0x493fc5,null))[_0x8229('0x1f')](function(_0x2ecfcb){if(_0x2ecfcb){return _0x493fc5[_0x8229('0x8a')](path[_0x8229('0x8b')](_0x5ccd28,_0x2ecfcb[_0x8229('0x84')][_0x8229('0x88')]));}})[_0x8229('0x29')](handleError(_0x493fc5,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c0d00bf..774909a 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 _0x84c6=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','FaxMessage'];(function(_0x2fb4ee,_0x4db18a){var _0xeb370f=function(_0x5dace1){while(--_0x5dace1){_0x2fb4ee['push'](_0x2fb4ee['shift']());}};_0xeb370f(++_0x4db18a);}(_0x84c6,0xe7));var _0x684c=function(_0x236ccb,_0x105349){_0x236ccb=_0x236ccb-0x0;var _0x4d8b67=_0x84c6[_0x236ccb];return _0x4d8b67;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x684c('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x684c('0x1')](0x0);var events={'afterCreate':_0x684c('0x2'),'afterUpdate':'update','afterDestroy':_0x684c('0x3')};function emitEvent(_0x4e2f8c){return function(_0x3930c5,_0x40cc4c,_0x3baab2){FaxMessageEvents[_0x684c('0x4')](_0x4e2f8c+':'+_0x3930c5['id'],_0x3930c5);FaxMessageEvents[_0x684c('0x4')](_0x4e2f8c,_0x3930c5);_0x3baab2(null);};}for(var e in events){if(events[_0x684c('0x5')](e)){var event=events[e];FaxMessage[_0x684c('0x6')](e,emitEvent(event));}}module[_0x684c('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x8f6b=['save','update','emit','hook','events','../../mysqldb','FaxMessage'];(function(_0x769407,_0x56665d){var _0x1a19c9=function(_0x27c8fc){while(--_0x27c8fc){_0x769407['push'](_0x769407['shift']());}};_0x1a19c9(++_0x56665d);}(_0x8f6b,0x146));var _0xb8f6=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x8f6b[_0x40bffc];return _0x3007e9;};'use strict';var EventEmitter=require(_0xb8f6('0x0'));var FaxMessage=require(_0xb8f6('0x1'))['db'][_0xb8f6('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8f6('0x3'),'afterUpdate':_0xb8f6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36b78d){return function(_0x456df3,_0x49693f,_0x333054){FaxMessageEvents['emit'](_0x36b78d+':'+_0x456df3['id'],_0x456df3);FaxMessageEvents[_0xb8f6('0x5')](_0x36b78d,_0x456df3);_0x333054(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xb8f6('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 44f2203..f29496f 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 _0xa91c=['update','createdAt','utf8mb4','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','findOne','FaxInteractionId','then'];(function(_0x1558ee,_0x40ed70){var _0x252dba=function(_0x2dbde5){while(--_0x2dbde5){_0x1558ee['push'](_0x1558ee['shift']());}};_0x252dba(++_0x40ed70);}(_0xa91c,0x9f));var _0xca91=function(_0x336486,_0x1573ee){_0x336486=_0x336486-0x0;var _0x7c8132=_0xa91c[_0x336486];return _0x7c8132;};'use strict';var _=require(_0xca91('0x0'));var util=require(_0xca91('0x1'));var logger=require(_0xca91('0x2'))('api');var moment=require(_0xca91('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xca91('0x4'));var rimraf=require(_0xca91('0x5'));var config=require(_0xca91('0x6'));var attributes=require(_0xca91('0x7'));module['exports']=function(_0x549a6d,_0xe56b21){return _0x549a6d[_0xca91('0x8')](_0xca91('0x9'),attributes,{'tableName':_0xca91('0xa'),'paranoid':![],'indexes':[{'name':_0xca91('0xb'),'fields':[_0xca91('0xc')],'type':_0xca91('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32fc03,_0x2b75e1,_0xe10c44){var _0x2091e0=_0x549a6d[_0xca91('0xe')];var _0x1069bc=_0x32fc03[_0xca91('0xf')]({'plain':!![]});if(_0x1069bc[_0xca91('0x10')][_0xca91('0x11')]()==='in'||_0x1069bc[_0xca91('0x10')][_0xca91('0x11')]()==='out'&&!_0x1069bc[_0xca91('0x12')]&&!_['isNil'](_0x1069bc[_0xca91('0x13')])){_0x2091e0['FaxInteraction'][_0xca91('0x14')]({'where':{'id':_0x1069bc[_0xca91('0x15')]}})[_0xca91('0x16')](function(_0x37abd8){if(_0x37abd8){_0x37abd8[_0xca91('0x17')]({'lastMsgAt':_0x1069bc[_0xca91('0x18')],'lastMsgDirection':_0x1069bc[_0xca91('0x10')][_0xca91('0x11')]()});}})['catch'](function(_0xeb4a72){console['error'](_0xeb4a72);});}_0xe10c44();}},'charset':_0xca91('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa258=['secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','FaxMessage','fti_fax_messages','models','toLowerCase','direction'];(function(_0x51af00,_0x293964){var _0x25bad7=function(_0x8b078b){while(--_0x8b078b){_0x51af00['push'](_0x51af00['shift']());}};_0x25bad7(++_0x293964);}(_0xa258,0x88));var _0x8a25=function(_0x924aed,_0x3bca33){_0x924aed=_0x924aed-0x0;var _0x4f644e=_0xa258[_0x924aed];return _0x4f644e;};'use strict';var _=require('lodash');var util=require(_0x8a25('0x0'));var logger=require(_0x8a25('0x1'))(_0x8a25('0x2'));var moment=require(_0x8a25('0x3'));var BPromise=require('bluebird');var rp=require(_0x8a25('0x4'));var fs=require('fs');var path=require(_0x8a25('0x5'));var rimraf=require(_0x8a25('0x6'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x8a25('0x7')]=function(_0x3faf12,_0x30bf24){return _0x3faf12[_0x8a25('0x8')](_0x8a25('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x8a25('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x168596,_0x9d8c8a,_0x350c1d){var _0x24182c=_0x3faf12[_0x8a25('0xb')];var _0x24959c=_0x168596['get']({'plain':!![]});if(_0x24959c['direction'][_0x8a25('0xc')]()==='in'||_0x24959c[_0x8a25('0xd')][_0x8a25('0xc')]()==='out'&&!_0x24959c[_0x8a25('0xe')]&&!_['isNil'](_0x24959c[_0x8a25('0xf')])){_0x24182c[_0x8a25('0x10')][_0x8a25('0x11')]({'where':{'id':_0x24959c[_0x8a25('0x12')]}})[_0x8a25('0x13')](function(_0x1f47b5){if(_0x1f47b5){_0x1f47b5[_0x8a25('0x14')]({'lastMsgAt':_0x24959c[_0x8a25('0x15')],'lastMsgDirection':_0x24959c[_0x8a25('0xd')]['toLowerCase']()});}})[_0x8a25('0x16')](function(_0x5c4bd2){console[_0x8a25('0x17')](_0x5c4bd2);});}_0x350c1d();}},'charset':_0x8a25('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 968a199..600fddb 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 _0xbd50=['request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','options','raw','then','UpdateFaxMessage','FaxMessage','update','body','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','./faxMessage.socket','register'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xbd50,0x196));var _0x0bd5=function(_0x14eb03,_0x8d5034){_0x14eb03=_0x14eb03-0x0;var _0x21ce5d=_0xbd50[_0x14eb03];return _0x21ce5d;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});config[_0x0bd5('0xa')]=_[_0x0bd5('0xb')](config[_0x0bd5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bd5('0xa')]));require(_0x0bd5('0xc'))[_0x0bd5('0xd')](socket);function respondWithRpcPromise(_0x5f5a0c,_0xa98f54,_0x2fa7d1){return new BPromise(function(_0x519bc6,_0x210f45){return client[_0x0bd5('0xe')](_0x5f5a0c,_0x2fa7d1)['then'](function(_0x1ce7dd){logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,'request\x20sent');logger[_0x0bd5('0x11')](_0x0bd5('0x12'),_0xa98f54,_0x0bd5('0x13'),JSON[_0x0bd5('0x14')](_0x1ce7dd));if(_0x1ce7dd[_0x0bd5('0x15')]){if(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x16')]===0x1f4){logger[_0x0bd5('0x15')]('FaxMessage,\x20%s,\x20%s',_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);return _0x210f45(_0x1ce7dd['error'][_0x0bd5('0x17')]);}logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')]['message']);return _0x519bc6(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);}else{logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,_0x0bd5('0x13'));_0x519bc6(_0x1ce7dd[_0x0bd5('0x18')][_0x0bd5('0x17')]);}})[_0x0bd5('0x19')](function(_0x29fa4c){logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x29fa4c);_0x210f45(_0x29fa4c);});});}exports[_0x0bd5('0x1a')]=function(_0x4008bd){var _0x2dc1e5=this;return new Promise(function(_0x527c37,_0x5ba943){return db['FaxMessage']['create'](_0x4008bd['body'],{'raw':_0x4008bd[_0x0bd5('0x1b')]?_0x4008bd[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![]})[_0x0bd5('0x1d')](function(_0x6ee1a8){logger['info'](_0x0bd5('0x1a'),_0x4008bd);logger[_0x0bd5('0x11')](_0x0bd5('0x1a'),_0x4008bd,JSON['stringify'](_0x6ee1a8));_0x527c37(_0x6ee1a8);})[_0x0bd5('0x19')](function(_0x4a8787){logger['error'](_0x0bd5('0x1a'),_0x4a8787[_0x0bd5('0x17')],_0x4008bd);_0x5ba943(_0x2dc1e5[_0x0bd5('0x15')](0x1f4,_0x4a8787['message']));});});};exports[_0x0bd5('0x1e')]=function(_0x5eab3e){var _0x456e87=this;return new Promise(function(_0x3ffb08,_0x18cec3){return db[_0x0bd5('0x1f')][_0x0bd5('0x20')](_0x5eab3e[_0x0bd5('0x21')],{'raw':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x22')]||null:null,'attributes':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['attributes']||null:null,'limit':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['limit']||null:null})[_0x0bd5('0x1d')](function(_0x8eccc9){logger['info'](_0x0bd5('0x1e'),_0x5eab3e);logger[_0x0bd5('0x11')](_0x0bd5('0x1e'),_0x5eab3e,JSON[_0x0bd5('0x14')](_0x8eccc9));_0x3ffb08(_0x8eccc9);})['catch'](function(_0x440e69){logger[_0x0bd5('0x15')](_0x0bd5('0x1e'),_0x440e69[_0x0bd5('0x17')],_0x5eab3e);_0x18cec3(_0x456e87[_0x0bd5('0x15')](0x1f4,_0x440e69[_0x0bd5('0x17')]));});});}; \ No newline at end of file +var _0x6aa7=['redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','create','options','raw','catch','update','body','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x3fac57,_0x40eebc){var _0x24c236=function(_0x2ea083){while(--_0x2ea083){_0x3fac57['push'](_0x3fac57['shift']());}};_0x24c236(++_0x40eebc);}(_0x6aa7,0x178));var _0x76aa=function(_0x4e1363,_0x222e58){_0x4e1363=_0x4e1363-0x0;var _0x5290f5=_0x6aa7[_0x4e1363];return _0x5290f5;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});config[_0x76aa('0x9')]=_[_0x76aa('0xa')](config[_0x76aa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x76aa('0xb'))(new Redis(config[_0x76aa('0x9')]));require(_0x76aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xcd99aa,_0x25856d,_0x41643a){return new BPromise(function(_0x16cb50,_0x37f1ab){return client[_0x76aa('0xd')](_0xcd99aa,_0x41643a)[_0x76aa('0xe')](function(_0x8dc35c){logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,'request\x20sent');logger[_0x76aa('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x25856d,_0x76aa('0x12'),JSON[_0x76aa('0x13')](_0x8dc35c));if(_0x8dc35c[_0x76aa('0x14')]){if(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x25856d,_0x8dc35c[_0x76aa('0x14')]['message']);return _0x37f1ab(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x16')]);}logger['error'](_0x76aa('0x10'),_0x25856d,_0x8dc35c['error'][_0x76aa('0x16')]);return _0x16cb50(_0x8dc35c['error'][_0x76aa('0x16')]);}else{logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,_0x76aa('0x12'));_0x16cb50(_0x8dc35c[_0x76aa('0x17')][_0x76aa('0x16')]);}})['catch'](function(_0x5d6202){logger[_0x76aa('0x14')](_0x76aa('0x10'),_0x25856d,_0x5d6202);_0x37f1ab(_0x5d6202);});});}exports[_0x76aa('0x18')]=function(_0x15b931){var _0x15109b=this;return new Promise(function(_0x191560,_0x19af92){return db[_0x76aa('0x19')][_0x76aa('0x1a')](_0x15b931['body'],{'raw':_0x15b931[_0x76aa('0x1b')]?_0x15b931[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x41463a){logger[_0x76aa('0xf')](_0x76aa('0x18'),_0x15b931);logger[_0x76aa('0x11')](_0x76aa('0x18'),_0x15b931,JSON[_0x76aa('0x13')](_0x41463a));_0x191560(_0x41463a);})[_0x76aa('0x1d')](function(_0x3363b3){logger[_0x76aa('0x14')](_0x76aa('0x18'),_0x3363b3[_0x76aa('0x16')],_0x15b931);_0x19af92(_0x15109b[_0x76aa('0x14')](0x1f4,_0x3363b3[_0x76aa('0x16')]));});});};exports['UpdateFaxMessage']=function(_0xb5e8a9){var _0x1d6d15=this;return new Promise(function(_0x25c614,_0x2e7ab4){return db[_0x76aa('0x19')][_0x76aa('0x1e')](_0xb5e8a9[_0x76aa('0x1f')],{'raw':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5e8a9['options']?_0xb5e8a9[_0x76aa('0x1b')]['where']||null:null,'attributes':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x20')]||null:null,'limit':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x21')]||null:null})[_0x76aa('0xe')](function(_0x3827ec){logger[_0x76aa('0xf')](_0x76aa('0x22'),_0xb5e8a9);logger['debug'](_0x76aa('0x22'),_0xb5e8a9,JSON[_0x76aa('0x13')](_0x3827ec));_0x25c614(_0x3827ec);})[_0x76aa('0x1d')](function(_0x928ccf){logger[_0x76aa('0x14')](_0x76aa('0x22'),_0x928ccf[_0x76aa('0x16')],_0xb5e8a9);_0x2e7ab4(_0x1d6d15['error'](0x1f4,_0x928ccf[_0x76aa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index f195ffd..8ddc755 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 _0xa42b=['./faxMessage.events','save','remove','update','emit','removeListener','faxMessage:'];(function(_0x509965,_0x289866){var _0x27ff13=function(_0x1d3c18){while(--_0x1d3c18){_0x509965['push'](_0x509965['shift']());}};_0x27ff13(++_0x289866);}(_0xa42b,0xbd));var _0xba42=function(_0x1d83b7,_0x5a1236){_0x1d83b7=_0x1d83b7-0x0;var _0x26533b=_0xa42b[_0x1d83b7];return _0x26533b;};'use strict';var FaxMessageEvents=require(_0xba42('0x0'));var events=[_0xba42('0x1'),_0xba42('0x2'),_0xba42('0x3')];function createListener(_0x2db826,_0x4b32fc){return function(_0x22e3b9){_0x4b32fc[_0xba42('0x4')](_0x2db826,_0x22e3b9);};}function removeListener(_0x31f709,_0x1a8a46){return function(){FaxMessageEvents[_0xba42('0x5')](_0x31f709,_0x1a8a46);};}exports['register']=function(_0x15bc0e){for(var _0x135be8=0x0,_0x45171f=events['length'];_0x135be8<_0x45171f;_0x135be8++){var _0x45d0ca=events[_0x135be8];var _0x4411d5=createListener(_0xba42('0x6')+_0x45d0ca,_0x15bc0e);FaxMessageEvents['on'](_0x45d0ca,_0x4411d5);}}; \ No newline at end of file +var _0x912e=['./faxMessage.events','save','remove','update','emit','register','faxMessage:'];(function(_0x49ddfa,_0x2c2461){var _0x26be0b=function(_0x5459a4){while(--_0x5459a4){_0x49ddfa['push'](_0x49ddfa['shift']());}};_0x26be0b(++_0x2c2461);}(_0x912e,0xf5));var _0xe912=function(_0x1e7d80,_0x400a77){_0x1e7d80=_0x1e7d80-0x0;var _0x104384=_0x912e[_0x1e7d80];return _0x104384;};'use strict';var FaxMessageEvents=require(_0xe912('0x0'));var events=[_0xe912('0x1'),_0xe912('0x2'),_0xe912('0x3')];function createListener(_0x2af542,_0x4e9d29){return function(_0x1ff319){_0x4e9d29[_0xe912('0x4')](_0x2af542,_0x1ff319);};}function removeListener(_0x28f5db,_0x48d181){return function(){FaxMessageEvents['removeListener'](_0x28f5db,_0x48d181);};}exports[_0xe912('0x5')]=function(_0x1bbb2b){for(var _0x15df3c=0x0,_0x408d4c=events['length'];_0x15df3c<_0x408d4c;_0x15df3c++){var _0x1b1631=events[_0x15df3c];var _0x220a0a=createListener(_0xe912('0x6')+_0x1b1631,_0x1bbb2b);FaxMessageEvents['on'](_0x1b1631,_0x220a0a);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3969120..85a7bab 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','./faxMessage.controller','isAuthenticated','describe','get','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','update','reject','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x13cfcc,_0x33ac5b){var _0x217917=function(_0x1fe24a){while(--_0x1fe24a){_0x13cfcc['push'](_0x13cfcc['shift']());}};_0x217917(++_0x33ac5b);}(_0x70e0,0x17b));var _0x070e=function(_0x4888b2,_0x451cb3){_0x4888b2=_0x4888b2-0x0;var _0x4609c8=_0x70e0[_0x4888b2];return _0x4609c8;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x070e('0xd')]);router[_0x070e('0xe')]('/',auth[_0x070e('0x8')](),interaction[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11')),controller[_0x070e('0x12')]);router[_0x070e('0x13')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/accept',auth[_0x070e('0x8')](),controller['accept']);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x16')]);module[_0x070e('0x17')]=router; \ No newline at end of file +var _0xcea2=['create','put','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked'];(function(_0x4371a8,_0x3ac39){var _0x110901=function(_0x1b9497){while(--_0x1b9497){_0x4371a8['push'](_0x4371a8['shift']());}};_0x110901(++_0x3ac39);}(_0xcea2,0x15a));var _0x2cea=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xcea2[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0xd')]);router[_0x2cea('0x9')](_0x2cea('0xe'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xf')]);router[_0x2cea('0x10')]('/',auth[_0x2cea('0x8')](),interaction[_0x2cea('0x11')]('fax','faxmessage:create'),controller[_0x2cea('0x12')]);router[_0x2cea('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2cea('0x14')]);router['put'](_0x2cea('0x15'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x2cea('0x17')]);router['delete'](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x18')]);module[_0x2cea('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a6da162..63d3082 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 _0x1e82=['exports','STRING','name','INTEGER','rrmemory','beepall','sequelize'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x1e82,0x8b));var _0x21e8=function(_0x25722d,_0x2390c8){_0x25722d=_0x25722d-0x0;var _0x4c2bde=_0x1e82[_0x25722d];return _0x4c2bde;};'use strict';var Sequelize=require(_0x21e8('0x0'));module[_0x21e8('0x1')]={'name':{'type':Sequelize[_0x21e8('0x2')],'unique':_0x21e8('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x21e8('0x2')]},'timeout':{'type':Sequelize[_0x21e8('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x21e8('0x5'),_0x21e8('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x21e8('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b3b=['STRING','ENUM','rrmemory','beepall','roundrobin','name'];(function(_0x1d0847,_0x151b3e){var _0x444f72=function(_0xe3406c){while(--_0xe3406c){_0x1d0847['push'](_0x1d0847['shift']());}};_0x444f72(++_0x151b3e);}(_0x2b3b,0x83));var _0xb2b3=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x2b3b[_0x397cfb];return _0x15fed9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb2b3('0x0'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb2b3('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb2b3('0x2')](_0xb2b3('0x3'),_0xb2b3('0x4'),_0xb2b3('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 5a32bf7..3092d9a 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 _0x615e=['join','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','every','TeamId','includes','all','compact','removeTeams','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','then','get','FaxQueues','UserProfileResource','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','FaxQueue','includeAll','include','findAll','rows','catch','keys','find','create','role','UserProfileSection','userProfileId','autoAssociation','update','body','params','describe','UserFaxQueue','hasOwnProperty','FaxQueueId','filter','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','User','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','ids','select','field','tq.TeamId','from','team_has_fax_queues'];(function(_0x25971c,_0x5ebc17){var _0x3dcbca=function(_0x5ef50f){while(--_0x5ef50f){_0x25971c['push'](_0x25971c['shift']());}};_0x3dcbca(++_0x5ebc17);}(_0x615e,0x128));var _0xe615=function(_0x4df169,_0x28c6d4){_0x4df169=_0x4df169-0x0;var _0x5b8b20=_0x615e[_0x4df169];return _0x5b8b20;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe615('0x0'));var zipdir=require(_0xe615('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe615('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe615('0x3'));var util=require(_0xe615('0x4'));var path=require(_0xe615('0x5'));var sox=require(_0xe615('0x6'));var csv=require(_0xe615('0x7'));var ejs=require(_0xe615('0x8'));var fs=require('fs');var fs_extra=require(_0xe615('0x9'));var _=require(_0xe615('0xa'));var squel=require(_0xe615('0xb'));var crypto=require(_0xe615('0xc'));var jsforce=require(_0xe615('0xd'));var deskjs=require(_0xe615('0xe'));var toCsv=require(_0xe615('0x7'));var querystring=require(_0xe615('0xf'));var Papa=require('papaparse');var Redis=require(_0xe615('0x10'));var authService=require(_0xe615('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe615('0x12'));var hardwareService=require(_0xe615('0x13'));var logger=require(_0xe615('0x14'))(_0xe615('0x15'));var utils=require(_0xe615('0x16'));var config=require(_0xe615('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe615('0x18'))['db'];config[_0xe615('0x19')]=_['defaults'](config[_0xe615('0x19')],{'host':_0xe615('0x1a'),'port':0x18eb});var socket=require(_0xe615('0x1b'))(new Redis(config[_0xe615('0x19')]));require(_0xe615('0x1c'))[_0xe615('0x1d')](socket);function respondWithStatusCode(_0x1380c7,_0x41b0bd){_0x41b0bd=_0x41b0bd||0xcc;return function(_0x3c18d1){if(_0x3c18d1){return _0x1380c7[_0xe615('0x1e')](_0x41b0bd);}return _0x1380c7[_0xe615('0x1f')](_0x41b0bd)['end']();};}function respondWithResult(_0x2db49c,_0x5b18a7){_0x5b18a7=_0x5b18a7||0xc8;return function(_0x40b769){if(_0x40b769){return _0x2db49c[_0xe615('0x1f')](_0x5b18a7)['json'](_0x40b769);}};}function respondWithFilteredResult(_0x104532,_0x2585d0){return function(_0x364c2d){if(_0x364c2d){var _0x46d01b=typeof _0x2585d0[_0xe615('0x20')]===_0xe615('0x21')&&typeof _0x2585d0['limit']===_0xe615('0x21');var _0x163839=_0x364c2d['count'];var _0x2c8fbf=_0x46d01b?0x0:_0x2585d0[_0xe615('0x20')];var _0x5e3fad=_0x46d01b?_0x364c2d[_0xe615('0x22')]:_0x2585d0[_0xe615('0x20')]+_0x2585d0[_0xe615('0x23')];var _0x3ba8f4;if(_0x5e3fad>=_0x163839){_0x5e3fad=_0x163839;_0x3ba8f4=0xc8;}else{_0x3ba8f4=0xce;}_0x104532[_0xe615('0x1f')](_0x3ba8f4);return _0x104532[_0xe615('0x24')]('Content-Range',_0x2c8fbf+'-'+_0x5e3fad+'/'+_0x163839)[_0xe615('0x25')](_0x364c2d);}return null;};}function patchUpdates(_0x37bba0){return function(_0xaab2a2){try{jsonpatch[_0xe615('0x26')](_0xaab2a2,_0x37bba0,!![]);}catch(_0x5ec3de){return BPromise[_0xe615('0x27')](_0x5ec3de);}return _0xaab2a2[_0xe615('0x28')]();};}function saveUpdates(_0x4b3ead,_0x410c1c){return function(_0x1b490b){if(_0x1b490b){return _0x1b490b['update'](_0x4b3ead)['then'](function(_0x10e5d8){return _0x10e5d8;});}return null;};}function removeEntity(_0x107323,_0x1c6413){return function(_0x16b395){if(_0x16b395){return _0x16b395['destroy']()[_0xe615('0x29')](function(){var _0x1286e2=_0x16b395[_0xe615('0x2a')]({'plain':!![]});var _0x3310bb=_0xe615('0x2b');return db[_0xe615('0x2c')][_0xe615('0x2d')]({'where':{'type':_0x3310bb,'resourceId':_0x1286e2['id']}})[_0xe615('0x29')](function(){return _0x16b395;});})[_0xe615('0x29')](function(){_0x107323[_0xe615('0x1f')](0xcc)[_0xe615('0x2e')]();});}};}function handleEntityNotFound(_0x267072,_0x532eec){return function(_0x3f099e){if(!_0x3f099e){_0x267072[_0xe615('0x1e')](0x194);}return _0x3f099e;};}function handleError(_0x35d003,_0x39f7db){_0x39f7db=_0x39f7db||0x1f4;return function(_0x521b96){logger[_0xe615('0x2f')](_0x521b96[_0xe615('0x30')]);if(_0x521b96[_0xe615('0x31')]){delete _0x521b96[_0xe615('0x31')];}_0x35d003[_0xe615('0x1f')](_0x39f7db)[_0xe615('0x32')](_0x521b96);};}exports['index']=function(_0x38fabb,_0xf732a2){var _0x490d71={},_0x47e7d5={},_0x5239d7={'count':0x0,'rows':[]};var _0x48bb4f=_[_0xe615('0x33')](db['FaxQueue'][_0xe615('0x34')],function(_0x1a064d){return{'name':_0x1a064d[_0xe615('0x35')],'type':_0x1a064d[_0xe615('0x36')][_0xe615('0x37')]};});_0x47e7d5[_0xe615('0x38')]=_[_0xe615('0x33')](_0x48bb4f,_0xe615('0x31'));_0x47e7d5[_0xe615('0x39')]=_['keys'](_0x38fabb[_0xe615('0x39')]);_0x47e7d5['filters']=_[_0xe615('0x3a')](_0x47e7d5[_0xe615('0x38')],_0x47e7d5[_0xe615('0x39')]);_0x490d71['attributes']=_['intersection'](_0x47e7d5[_0xe615('0x38')],qs['fields'](_0x38fabb['query'][_0xe615('0x3b')]));_0x490d71[_0xe615('0x3c')]=_0x490d71['attributes'][_0xe615('0x3d')]?_0x490d71[_0xe615('0x3c')]:_0x47e7d5[_0xe615('0x38')];if(!_0x38fabb['query']['hasOwnProperty'](_0xe615('0x3e'))){_0x490d71[_0xe615('0x23')]=qs['limit'](_0x38fabb[_0xe615('0x39')][_0xe615('0x23')]);_0x490d71['offset']=qs['offset'](_0x38fabb[_0xe615('0x39')]['offset']);}_0x490d71[_0xe615('0x3f')]=qs[_0xe615('0x40')](_0x38fabb[_0xe615('0x39')][_0xe615('0x40')]);_0x490d71[_0xe615('0x41')]=qs[_0xe615('0x42')](_[_0xe615('0x43')](_0x38fabb['query'],_0x47e7d5[_0xe615('0x42')]),_0x48bb4f);if(_0x38fabb['query']['filter']){_0x490d71[_0xe615('0x41')]=_[_0xe615('0x44')](_0x490d71[_0xe615('0x41')],{'$or':_[_0xe615('0x33')](_0x48bb4f,function(_0x2961e0){if(_0x2961e0[_0xe615('0x36')]!==_0xe615('0x45')){var _0x4426c1={};_0x4426c1[_0x2961e0[_0xe615('0x31')]]={'$like':'%'+_0x38fabb[_0xe615('0x39')]['filter']+'%'};return _0x4426c1;}})});}_0x490d71=_[_0xe615('0x44')]({},_0x490d71,_0x38fabb[_0xe615('0x46')]);var _0x2f0dfa={'where':_0x490d71['where']};return db[_0xe615('0x47')]['count'](_0x2f0dfa)['then'](function(_0x847c5e){_0x5239d7[_0xe615('0x22')]=_0x847c5e;if(_0x38fabb[_0xe615('0x39')][_0xe615('0x48')]){_0x490d71[_0xe615('0x49')]=[{'all':!![]}];}return db[_0xe615('0x47')][_0xe615('0x4a')](_0x490d71);})[_0xe615('0x29')](function(_0x35c368){_0x5239d7[_0xe615('0x4b')]=_0x35c368;return _0x5239d7;})['then'](respondWithFilteredResult(_0xf732a2,_0x490d71))[_0xe615('0x4c')](handleError(_0xf732a2,null));};exports['show']=function(_0x3aae89,_0x1e9ae0){var _0x5632a6={'raw':!![],'where':{'id':_0x3aae89['params']['id']}},_0x1ae6ff={};_0x1ae6ff[_0xe615('0x38')]=_[_0xe615('0x4d')](db['FaxQueue'][_0xe615('0x34')]);_0x1ae6ff[_0xe615('0x39')]=_[_0xe615('0x4d')](_0x3aae89[_0xe615('0x39')]);_0x1ae6ff[_0xe615('0x42')]=_[_0xe615('0x3a')](_0x1ae6ff[_0xe615('0x38')],_0x1ae6ff['query']);_0x5632a6['attributes']=_[_0xe615('0x3a')](_0x1ae6ff['model'],qs[_0xe615('0x3b')](_0x3aae89['query'][_0xe615('0x3b')]));_0x5632a6[_0xe615('0x3c')]=_0x5632a6[_0xe615('0x3c')][_0xe615('0x3d')]?_0x5632a6['attributes']:_0x1ae6ff['model'];if(_0x3aae89['query'][_0xe615('0x48')]){_0x5632a6[_0xe615('0x49')]=[{'all':!![]}];}_0x5632a6=_[_0xe615('0x44')]({},_0x5632a6,_0x3aae89[_0xe615('0x46')]);return db['FaxQueue'][_0xe615('0x4e')](_0x5632a6)[_0xe615('0x29')](handleEntityNotFound(_0x1e9ae0,null))[_0xe615('0x29')](respondWithResult(_0x1e9ae0,null))[_0xe615('0x4c')](handleError(_0x1e9ae0,null));};exports[_0xe615('0x4f')]=function(_0x2af4f0,_0x26ae33){return db[_0xe615('0x47')][_0xe615('0x4f')](_0x2af4f0['body'],{})[_0xe615('0x29')](function(_0x1bea62){var _0x33a85e=_0x2af4f0['user'][_0xe615('0x2a')]({'plain':!![]});if(!_0x33a85e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33a85e[_0xe615('0x50')]==='user'){var _0x32c27d=_0x1bea62[_0xe615('0x2a')]({'plain':!![]});var _0x1462cc=_0xe615('0x2b');return db[_0xe615('0x51')][_0xe615('0x4e')]({'where':{'name':_0x1462cc,'userProfileId':_0x33a85e[_0xe615('0x52')]},'raw':!![]})[_0xe615('0x29')](function(_0x14c9da){if(_0x14c9da&&_0x14c9da[_0xe615('0x53')]===0x0){return db[_0xe615('0x2c')]['create']({'name':_0x32c27d['name'],'resourceId':_0x32c27d['id'],'type':_0x14c9da[_0xe615('0x31')],'sectionId':_0x14c9da['id']},{})[_0xe615('0x29')](function(){return _0x1bea62;});}else{return _0x1bea62;}})[_0xe615('0x4c')](function(_0x31bb31){logger[_0xe615('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31bb31);throw _0x31bb31;});}return _0x1bea62;})[_0xe615('0x29')](respondWithResult(_0x26ae33,0xc9))['catch'](handleError(_0x26ae33,null));};exports[_0xe615('0x54')]=function(_0x5e541c,_0x53357b){if(_0x5e541c[_0xe615('0x55')]['id']){delete _0x5e541c[_0xe615('0x55')]['id'];}return db[_0xe615('0x47')]['find']({'where':{'id':_0x5e541c[_0xe615('0x56')]['id']}})[_0xe615('0x29')](handleEntityNotFound(_0x53357b,null))[_0xe615('0x29')](saveUpdates(_0x5e541c[_0xe615('0x55')],null))[_0xe615('0x29')](respondWithResult(_0x53357b,null))[_0xe615('0x4c')](handleError(_0x53357b,null));};exports[_0xe615('0x2d')]=function(_0x2c6ef5,_0x3e9848){return db[_0xe615('0x47')][_0xe615('0x4e')]({'where':{'id':_0x2c6ef5[_0xe615('0x56')]['id']}})[_0xe615('0x29')](handleEntityNotFound(_0x3e9848,null))['then'](removeEntity(_0x3e9848,null))[_0xe615('0x4c')](handleError(_0x3e9848,null));};exports[_0xe615('0x57')]=function(_0x269043,_0x3c2ea9){return db[_0xe615('0x47')][_0xe615('0x57')]()[_0xe615('0x29')](respondWithResult(_0x3c2ea9,null))[_0xe615('0x4c')](handleError(_0x3c2ea9,null));};exports['getMembers']=function(_0x4b90a6,_0x567c25,_0x1c2bb4){var _0x51a371={'raw':!![],'where':{}},_0x1590fa={},_0x931c7b;return db[_0xe615('0x47')]['findOne']({'where':{'id':_0x4b90a6[_0xe615('0x56')]['id']}})[_0xe615('0x29')](handleEntityNotFound(_0x567c25,null))[_0xe615('0x29')](function(_0x48d6eb){if(_0x48d6eb){_0x931c7b=_0x48d6eb[_0xe615('0x2a')]({'plain':!![]});_0x1590fa[_0xe615('0x38')]=_[_0xe615('0x4d')](db[_0xe615('0x58')]['rawAttributes']);_0x1590fa[_0xe615('0x39')]=_[_0xe615('0x4d')](_0x4b90a6[_0xe615('0x39')]);_0x1590fa['filters']=_[_0xe615('0x3a')](_0x1590fa[_0xe615('0x38')],_0x1590fa['query']);_0x51a371['attributes']=_[_0xe615('0x3a')](_0x1590fa[_0xe615('0x38')],qs[_0xe615('0x3b')](_0x4b90a6[_0xe615('0x39')]['fields']));_0x51a371[_0xe615('0x3c')]=_0x51a371[_0xe615('0x3c')][_0xe615('0x3d')]?_0x51a371[_0xe615('0x3c')]:_0x1590fa[_0xe615('0x38')];if(!_0x4b90a6['query'][_0xe615('0x59')](_0xe615('0x3e'))){_0x51a371[_0xe615('0x23')]=qs[_0xe615('0x23')](_0x4b90a6['query'][_0xe615('0x23')]);_0x51a371['offset']=qs[_0xe615('0x20')](_0x4b90a6[_0xe615('0x39')]['offset']);}_0x51a371[_0xe615('0x3f')]=qs[_0xe615('0x40')](_0x4b90a6[_0xe615('0x39')][_0xe615('0x40')]);_0x51a371[_0xe615('0x41')]=qs[_0xe615('0x42')](_['pick'](_0x4b90a6['query'],_0x1590fa[_0xe615('0x42')]));_0x51a371['where'][_0xe615('0x5a')]=_0x48d6eb['id'];if(_0x4b90a6[_0xe615('0x39')][_0xe615('0x5b')]){_0x51a371[_0xe615('0x41')]=_['merge'](_0x51a371['where'],{'$or':_[_0xe615('0x33')](_0x51a371['attributes'],function(_0x18abbc){var _0x4e4de5={};_0x4e4de5[_0x18abbc]={'$like':'%'+_0x4b90a6[_0xe615('0x39')][_0xe615('0x5b')]+'%'};return _0x4e4de5;})});}_0x51a371=_[_0xe615('0x44')]({},_0x51a371,_0x4b90a6[_0xe615('0x46')]);return db[_0xe615('0x58')][_0xe615('0x4a')](_0x51a371);}})['then'](function(_0x8e67ef){if(_0x8e67ef){return db['User'][_0xe615('0x5c')]({'where':{'id':_[_0xe615('0x33')](_0x8e67ef,_0xe615('0x5d')),'role':_0xe615('0x5e')},'attributes':['id',_0xe615('0x31'),_0xe615('0x5f'),_0xe615('0x60'),'createdAt']});}})[_0xe615('0x29')](function(_0x5b6937){if(_0x5b6937){return{'count':_0x5b6937[_0xe615('0x22')],'rows':_[_0xe615('0x33')](_0x5b6937[_0xe615('0x4b')],function(_0x8a5f57){return{'membername':_0x8a5f57[_0xe615('0x31')],'UserId':_0x8a5f57['id'],'queue_name':_0x931c7b[_0xe615('0x31')],'FaxQueueId':_0x931c7b['id'],'interface':util[_0xe615('0x61')](_0xe615('0x62'),_0xe615('0x63'),_0x8a5f57['name']),'penalty':0x0,'paused':_0x8a5f57['faxPause'],'createdAt':_0x8a5f57[_0xe615('0x64')],'updatedAt':_0x8a5f57[_0xe615('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe615('0x29')](respondWithFilteredResult(_0x567c25,_0x51a371))[_0xe615('0x4c')](handleError(_0x567c25,null));};exports[_0xe615('0x65')]=function(_0x577a6f,_0x5528ad,_0x1bc6a9){var _0x44fbd8={};var _0x223a1b={};var _0x1f1797;var _0x3642f4;return db[_0xe615('0x47')]['findOne']({'where':{'id':_0x577a6f[_0xe615('0x56')]['id']}})['then'](handleEntityNotFound(_0x5528ad,null))[_0xe615('0x29')](function(_0xb8fbb6){if(_0xb8fbb6){_0x1f1797=_0xb8fbb6;_0x223a1b[_0xe615('0x38')]=_['keys'](db[_0xe615('0x66')][_0xe615('0x34')]);_0x223a1b[_0xe615('0x39')]=_[_0xe615('0x4d')](_0x577a6f[_0xe615('0x39')]);_0x223a1b[_0xe615('0x42')]=_[_0xe615('0x3a')](_0x223a1b[_0xe615('0x38')],_0x223a1b[_0xe615('0x39')]);_0x44fbd8[_0xe615('0x3c')]=_['intersection'](_0x223a1b[_0xe615('0x38')],qs[_0xe615('0x3b')](_0x577a6f[_0xe615('0x39')][_0xe615('0x3b')]));_0x44fbd8[_0xe615('0x3c')]=_0x44fbd8[_0xe615('0x3c')][_0xe615('0x3d')]?_0x44fbd8[_0xe615('0x3c')]:_0x223a1b[_0xe615('0x38')];_0x44fbd8[_0xe615('0x3f')]=qs['sort'](_0x577a6f[_0xe615('0x39')][_0xe615('0x40')]);_0x44fbd8[_0xe615('0x41')]=qs[_0xe615('0x42')](_[_0xe615('0x43')](_0x577a6f[_0xe615('0x39')],_0x223a1b[_0xe615('0x42')]));if(_0x577a6f[_0xe615('0x39')][_0xe615('0x5b')]){_0x44fbd8[_0xe615('0x41')]=_[_0xe615('0x44')](_0x44fbd8[_0xe615('0x41')],{'$or':_['map'](_0x44fbd8[_0xe615('0x3c')],function(_0x505fbb){var _0x9ec41f={};_0x9ec41f[_0x505fbb]={'$like':'%'+_0x577a6f['query'][_0xe615('0x5b')]+'%'};return _0x9ec41f;})});}_0x44fbd8=_['merge']({},_0x44fbd8,_0x577a6f[_0xe615('0x46')]);return _0x1f1797[_0xe615('0x65')](_0x44fbd8);}})[_0xe615('0x29')](function(_0xd6e30e){if(_0xd6e30e){_0x3642f4=_0xd6e30e[_0xe615('0x3d')];if(!_0x577a6f[_0xe615('0x39')][_0xe615('0x59')]('nolimit')){_0x44fbd8[_0xe615('0x23')]=qs[_0xe615('0x23')](_0x577a6f[_0xe615('0x39')]['limit']);_0x44fbd8[_0xe615('0x20')]=qs[_0xe615('0x20')](_0x577a6f['query']['offset']);}return _0x1f1797[_0xe615('0x65')](_0x44fbd8);}})[_0xe615('0x29')](function(_0x44f246){if(_0x44f246){return _0x44f246?{'count':_0x3642f4,'rows':_0x44f246}:null;}})['then'](respondWithResult(_0x5528ad,null))[_0xe615('0x4c')](handleError(_0x5528ad,null));};exports[_0xe615('0x67')]=function(_0x589eb2,_0x3d9f63,_0x2eb4fe){var _0x2c6d1c=_0x589eb2[_0xe615('0x55')]['ids'];return db['Team'][_0xe615('0x4a')]({'where':{'id':_0x2c6d1c},'attributes':['id'],'include':[{'model':db[_0xe615('0x68')],'as':_0xe615('0x69'),'attributes':['id',_0xe615('0x31'),_0xe615('0x6a'),'voicePause',_0xe615('0x6b')],'raw':!![]}]})[_0xe615('0x29')](function(_0x1825f2){if(_0x1825f2){var _0x60dc9e=_[_0xe615('0x6c')](_0x1825f2,function(_0x5caf8a){var _0x2dbb81=_0x5caf8a[_0xe615('0x2a')]({'plain':!![]});return _0x2dbb81['Agents'];});return db[_0xe615('0x47')]['find']({'where':{'id':_0x589eb2[_0xe615('0x56')]['id']}})[_0xe615('0x29')](function(_0x2f941b){return db[_0xe615('0x6d')][_0xe615('0x6e')](function(_0x36aefc){return _0x2f941b[_0xe615('0x67')](_0x2c6d1c,{'transaction':_0x36aefc})[_0xe615('0x29')](function(){return BPromise['each'](_0x60dc9e,function(_0xf85cc2){return db[_0xe615('0x58')][_0xe615('0x6f')]({'where':{'UserId':_0xf85cc2['id'],'FaxQueueId':_0x589eb2[_0xe615('0x56')]['id']},'transaction':_0x36aefc});});})['then'](function(){_0x60dc9e[_0xe615('0x70')](function(_0xbd1403){socket[_0xe615('0x71')](_0xe615('0x72'),{'UserId':_0xbd1403['id'],'FaxQueueId':_0x2f941b['id']});});});});});}})['then'](respondWithStatusCode(_0x3d9f63,null))[_0xe615('0x4c')](handleError(_0x3d9f63,null));};exports['removeTeams']=function(_0x1ccf9e,_0x47d6b6,_0x3ec2e6){return db[_0xe615('0x66')][_0xe615('0x4a')]({'where':{'id':_0x1ccf9e['query'][_0xe615('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe615('0x69'),'attributes':['id'],'raw':!![]}]})[_0xe615('0x29')](handleEntityNotFound(_0x47d6b6,null))[_0xe615('0x29')](function(_0x38069e){var _0xd4891b=_[_0xe615('0x33')](_0x38069e,'id');var _0x33d52c=[];var _0x18b659=[];var _0x4cd32a=squel[_0xe615('0x74')]();_0x4cd32a[_0xe615('0x75')](_0xe615('0x76'))[_0xe615('0x77')](_0xe615('0x78'),'tq')[_0xe615('0x79')]('user_has_teams','ut',_0xe615('0x7a'))[_0xe615('0x41')]('FaxQueueId\x20=\x20?',_0x1ccf9e[_0xe615('0x56')]['id']);for(var _0x43aa65=0x0;_0x43aa65<_0x38069e['length'];_0x43aa65+=0x1){let _0x251806=_0x38069e[_0x43aa65];for(var _0x1f7c35=0x0;_0x1f7c35<_0x251806['Agents'][_0xe615('0x3d')];_0x1f7c35+=0x1){let _0x2822da=_0x251806[_0xe615('0x69')][_0x1f7c35];var _0x1f6b4b=_0x4cd32a[_0xe615('0x7b')]();_0x1f6b4b[_0xe615('0x41')]('ut.UserId\x20=\x20?',_0x2822da['id']);_0x18b659['push'](db['sequelize'][_0xe615('0x39')](_0x1f6b4b['toString'](),{'type':db['sequelize'][_0xe615('0x7c')][_0xe615('0x7d')]})['then'](function(_0x4f64a8){if(_0x4f64a8[_0xe615('0x3d')]===0x1){return _0x2822da['id'];}else{var _0x525470=_[_0xe615('0x7e')](_[_0xe615('0x33')](_0x4f64a8,_0xe615('0x7f')),function(_0x3988c2){return _[_0xe615('0x80')](_0xd4891b,_0x3988c2);});if(_0x525470){return _0x2822da['id'];}}}));}}return BPromise[_0xe615('0x81')](_0x18b659)[_0xe615('0x29')](function(_0xc31dc3){_0x33d52c=_(_0x33d52c)['union'](_0xc31dc3)[_0xe615('0x82')]()['value']();return db[_0xe615('0x47')][_0xe615('0x4e')]({'where':{'id':_0x1ccf9e[_0xe615('0x56')]['id']}})[_0xe615('0x29')](function(_0x4e4831){return db['sequelize'][_0xe615('0x6e')](function(_0x45c8f0){return _0x4e4831[_0xe615('0x83')](_0x1ccf9e[_0xe615('0x39')]['ids'],{'transaction':_0x45c8f0})[_0xe615('0x29')](function(){if(!_['isEmpty'](_0x33d52c)){return _0x4e4831[_0xe615('0x84')](_0x33d52c,{'transaction':_0x45c8f0});}})[_0xe615('0x29')](function(){_0x33d52c[_0xe615('0x70')](function(_0xa36036){socket[_0xe615('0x71')](_0xe615('0x85'),{'UserId':_0xa36036,'FaxQueueId':_0x4e4831['id']});});});});});});})[_0xe615('0x29')](respondWithStatusCode(_0x47d6b6,null))['catch'](handleError(_0x47d6b6,null));};exports[_0xe615('0x86')]=function(_0x37473d,_0x519cd3,_0x42adfd){return db[_0xe615('0x47')]['find']({'where':{'id':_0x37473d[_0xe615('0x56')]['id']}})[_0xe615('0x29')](handleEntityNotFound(_0x519cd3,null))[_0xe615('0x29')](function(_0x4fb344){if(_0x4fb344){return _0x4fb344[_0xe615('0x86')](_0x37473d[_0xe615('0x55')]['ids'],_[_0xe615('0x87')](_0x37473d[_0xe615('0x55')],[_0xe615('0x73'),'id'])||{})[_0xe615('0x88')](function(_0x2dc262){for(var _0x45078b=0x0;_0x45078b<_0x37473d[_0xe615('0x55')][_0xe615('0x73')][_0xe615('0x3d')];_0x45078b+=0x1){socket[_0xe615('0x71')]('userFaxQueue:save',{'UserId':Number(_0x37473d[_0xe615('0x55')][_0xe615('0x73')][_0x45078b]),'FaxQueueId':Number(_0x37473d['params']['id'])});}return _0x2dc262;});}})[_0xe615('0x29')](respondWithResult(_0x519cd3,null))[_0xe615('0x4c')](handleError(_0x519cd3,null));};exports['removeAgents']=function(_0x49bd0d,_0x18704e,_0xf22231){return db['FaxQueue']['find']({'where':{'id':_0x49bd0d[_0xe615('0x56')]['id']}})[_0xe615('0x29')](handleEntityNotFound(_0x18704e,null))[_0xe615('0x29')](function(_0x212506){if(_0x212506){return _0x212506[_0xe615('0x84')](_0x49bd0d['query'][_0xe615('0x73')])[_0xe615('0x29')](function(){if(_[_0xe615('0x89')](_0x49bd0d['query'][_0xe615('0x73')])){for(var _0x161a78=0x0;_0x161a78<_0x49bd0d[_0xe615('0x39')]['ids'][_0xe615('0x3d')];_0x161a78+=0x1){socket[_0xe615('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x49bd0d[_0xe615('0x39')][_0xe615('0x73')][_0x161a78]),'FaxQueueId':Number(_0x49bd0d[_0xe615('0x56')]['id'])});}}else{socket[_0xe615('0x71')](_0xe615('0x85'),{'UserId':Number(_0x49bd0d[_0xe615('0x39')][_0xe615('0x73')]),'FaxQueueId':Number(_0x49bd0d[_0xe615('0x56')]['id'])});}});}})[_0xe615('0x29')](respondWithStatusCode(_0x18704e,null))[_0xe615('0x4c')](handleError(_0x18704e,null));};exports['getAgents']=function(_0x518f3c,_0x34f0c4,_0x5da338){var _0x9f217a={};var _0x519959={};var _0x13e884;var _0xf18edf;return db[_0xe615('0x47')]['findOne']({'where':{'id':_0x518f3c[_0xe615('0x56')]['id']}})[_0xe615('0x29')](handleEntityNotFound(_0x34f0c4,null))[_0xe615('0x29')](function(_0x3fe9a5){if(_0x3fe9a5){_0x13e884=_0x3fe9a5;_0x519959['model']=_[_0xe615('0x4d')](db[_0xe615('0x68')][_0xe615('0x34')]);_0x519959[_0xe615('0x39')]=_[_0xe615('0x4d')](_0x518f3c[_0xe615('0x39')]);_0x519959[_0xe615('0x42')]=_[_0xe615('0x3a')](_0x519959[_0xe615('0x38')],_0x519959[_0xe615('0x39')]);_0x9f217a['attributes']=_[_0xe615('0x3a')](_0x519959['model'],qs[_0xe615('0x3b')](_0x518f3c[_0xe615('0x39')][_0xe615('0x3b')]));_0x9f217a[_0xe615('0x3c')]=_0x9f217a['attributes'][_0xe615('0x3d')]?_0x9f217a[_0xe615('0x3c')]:_0x519959[_0xe615('0x38')];_0x9f217a[_0xe615('0x3f')]=qs[_0xe615('0x40')](_0x518f3c[_0xe615('0x39')]['sort']);_0x9f217a[_0xe615('0x41')]=qs[_0xe615('0x42')](_['pick'](_0x518f3c['query'],_0x519959['filters']));if(_0x518f3c[_0xe615('0x39')][_0xe615('0x5b')]){_0x9f217a['where']=_[_0xe615('0x44')](_0x9f217a[_0xe615('0x41')],{'$or':_[_0xe615('0x33')](_0x9f217a['attributes'],function(_0x3b8aef){var _0x5bf37b={};_0x5bf37b[_0x3b8aef]={'$like':'%'+_0x518f3c[_0xe615('0x39')]['filter']+'%'};return _0x5bf37b;})});}_0x9f217a=_[_0xe615('0x44')]({},_0x9f217a,_0x518f3c[_0xe615('0x46')]);return _0x13e884[_0xe615('0x8a')](_0x9f217a);}})[_0xe615('0x29')](function(_0x52370a){if(_0x52370a){_0xf18edf=_0x52370a['length'];if(!_0x518f3c[_0xe615('0x39')][_0xe615('0x59')](_0xe615('0x3e'))){_0x9f217a[_0xe615('0x23')]=qs[_0xe615('0x23')](_0x518f3c[_0xe615('0x39')][_0xe615('0x23')]);_0x9f217a[_0xe615('0x20')]=qs[_0xe615('0x20')](_0x518f3c[_0xe615('0x39')][_0xe615('0x20')]);}return _0x13e884[_0xe615('0x8a')](_0x9f217a);}})[_0xe615('0x29')](function(_0x33c29f){if(_0x33c29f){return _0x33c29f?{'count':_0xf18edf,'rows':_0x33c29f}:null;}})[_0xe615('0x29')](respondWithResult(_0x34f0c4,null))[_0xe615('0x4c')](handleError(_0x34f0c4,null));}; \ No newline at end of file +var _0x2789=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','get','FaxQueues','UserProfileResource','end','error','stack','name','send','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','FaxQueue','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','rawAttributes','pick','FaxQueueId','UserFaxQueue','findAndCountAll','faxPause','updatedAt','createdAt','SIP','getTeams','findOne','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','from','join','user_has_teams','FaxQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','removeTeams','isEmpty','userFaxQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce'];(function(_0x5b26be,_0x24893b){var _0x4c02c9=function(_0x17dac2){while(--_0x17dac2){_0x5b26be['push'](_0x5b26be['shift']());}};_0x4c02c9(++_0x24893b);}(_0x2789,0x107));var _0x9278=function(_0x252819,_0x451cfb){_0x252819=_0x252819-0x0;var _0x439cd0=_0x2789[_0x252819];return _0x439cd0;};'use strict';var emlformat=require(_0x9278('0x0'));var rimraf=require(_0x9278('0x1'));var zipdir=require(_0x9278('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9278('0x3'));var moment=require(_0x9278('0x4'));var BPromise=require(_0x9278('0x5'));var Mustache=require(_0x9278('0x6'));var util=require('util');var path=require(_0x9278('0x7'));var sox=require(_0x9278('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9278('0x9'));var _=require('lodash');var squel=require(_0x9278('0xa'));var crypto=require(_0x9278('0xb'));var jsforce=require(_0x9278('0xc'));var deskjs=require(_0x9278('0xd'));var toCsv=require(_0x9278('0xe'));var querystring=require(_0x9278('0xf'));var Papa=require(_0x9278('0x10'));var Redis=require(_0x9278('0x11'));var authService=require(_0x9278('0x12'));var qs=require(_0x9278('0x13'));var as=require(_0x9278('0x14'));var hardwareService=require(_0x9278('0x15'));var logger=require('../../config/logger')(_0x9278('0x16'));var utils=require('../../config/utils');var config=require(_0x9278('0x17'));var licenseUtil=require(_0x9278('0x18'));var db=require(_0x9278('0x19'))['db'];config['redis']=_[_0x9278('0x1a')](config[_0x9278('0x1b')],{'host':_0x9278('0x1c'),'port':0x18eb});var socket=require(_0x9278('0x1d'))(new Redis(config[_0x9278('0x1b')]));require(_0x9278('0x1e'))[_0x9278('0x1f')](socket);function respondWithStatusCode(_0x26a4f4,_0x270c7a){_0x270c7a=_0x270c7a||0xcc;return function(_0x522358){if(_0x522358){return _0x26a4f4[_0x9278('0x20')](_0x270c7a);}return _0x26a4f4[_0x9278('0x21')](_0x270c7a)['end']();};}function respondWithResult(_0xf81b7c,_0x3af74f){_0x3af74f=_0x3af74f||0xc8;return function(_0x5925ca){if(_0x5925ca){return _0xf81b7c[_0x9278('0x21')](_0x3af74f)[_0x9278('0x22')](_0x5925ca);}};}function respondWithFilteredResult(_0x28e194,_0x1b30ec){return function(_0x1e47ae){if(_0x1e47ae){var _0x1f49c2=typeof _0x1b30ec['offset']==='undefined'&&typeof _0x1b30ec['limit']==='undefined';var _0x58e49f=_0x1e47ae[_0x9278('0x23')];var _0x30a2ce=_0x1f49c2?0x0:_0x1b30ec[_0x9278('0x24')];var _0x132f51=_0x1f49c2?_0x1e47ae[_0x9278('0x23')]:_0x1b30ec['offset']+_0x1b30ec[_0x9278('0x25')];var _0x1c44d9;if(_0x132f51>=_0x58e49f){_0x132f51=_0x58e49f;_0x1c44d9=0xc8;}else{_0x1c44d9=0xce;}_0x28e194[_0x9278('0x21')](_0x1c44d9);return _0x28e194[_0x9278('0x26')]('Content-Range',_0x30a2ce+'-'+_0x132f51+'/'+_0x58e49f)['json'](_0x1e47ae);}return null;};}function patchUpdates(_0x4001d4){return function(_0x4dccea){try{jsonpatch[_0x9278('0x27')](_0x4dccea,_0x4001d4,!![]);}catch(_0x29a610){return BPromise[_0x9278('0x28')](_0x29a610);}return _0x4dccea[_0x9278('0x29')]();};}function saveUpdates(_0x5337a1,_0x2a5bab){return function(_0x3c6fbf){if(_0x3c6fbf){return _0x3c6fbf[_0x9278('0x2a')](_0x5337a1)['then'](function(_0x3376c3){return _0x3376c3;});}return null;};}function removeEntity(_0x51d9b1,_0x22a015){return function(_0x48cfb2){if(_0x48cfb2){return _0x48cfb2[_0x9278('0x2b')]()[_0x9278('0x2c')](function(){var _0xff93e9=_0x48cfb2[_0x9278('0x2d')]({'plain':!![]});var _0x15d71b=_0x9278('0x2e');return db[_0x9278('0x2f')][_0x9278('0x2b')]({'where':{'type':_0x15d71b,'resourceId':_0xff93e9['id']}})[_0x9278('0x2c')](function(){return _0x48cfb2;});})['then'](function(){_0x51d9b1[_0x9278('0x21')](0xcc)[_0x9278('0x30')]();});}};}function handleEntityNotFound(_0x4ef90f,_0x141449){return function(_0x4b6e5e){if(!_0x4b6e5e){_0x4ef90f[_0x9278('0x20')](0x194);}return _0x4b6e5e;};}function handleError(_0x2a888e,_0x326142){_0x326142=_0x326142||0x1f4;return function(_0x3e723e){logger[_0x9278('0x31')](_0x3e723e[_0x9278('0x32')]);if(_0x3e723e[_0x9278('0x33')]){delete _0x3e723e[_0x9278('0x33')];}_0x2a888e[_0x9278('0x21')](_0x326142)[_0x9278('0x34')](_0x3e723e);};}exports['index']=function(_0x6bdf09,_0x3b58f9){var _0xafca70={},_0x1471a1={},_0x155ef7={'count':0x0,'rows':[]};var _0x2f335a=_[_0x9278('0x35')](db['FaxQueue']['rawAttributes'],function(_0x498ef6){return{'name':_0x498ef6['fieldName'],'type':_0x498ef6[_0x9278('0x36')][_0x9278('0x37')]};});_0x1471a1[_0x9278('0x38')]=_[_0x9278('0x35')](_0x2f335a,'name');_0x1471a1[_0x9278('0x39')]=_[_0x9278('0x3a')](_0x6bdf09[_0x9278('0x39')]);_0x1471a1[_0x9278('0x3b')]=_[_0x9278('0x3c')](_0x1471a1[_0x9278('0x38')],_0x1471a1[_0x9278('0x39')]);_0xafca70['attributes']=_[_0x9278('0x3c')](_0x1471a1[_0x9278('0x38')],qs[_0x9278('0x3d')](_0x6bdf09[_0x9278('0x39')][_0x9278('0x3d')]));_0xafca70[_0x9278('0x3e')]=_0xafca70[_0x9278('0x3e')][_0x9278('0x3f')]?_0xafca70['attributes']:_0x1471a1['model'];if(!_0x6bdf09[_0x9278('0x39')][_0x9278('0x40')](_0x9278('0x41'))){_0xafca70[_0x9278('0x25')]=qs[_0x9278('0x25')](_0x6bdf09[_0x9278('0x39')][_0x9278('0x25')]);_0xafca70[_0x9278('0x24')]=qs[_0x9278('0x24')](_0x6bdf09[_0x9278('0x39')][_0x9278('0x24')]);}_0xafca70[_0x9278('0x42')]=qs[_0x9278('0x43')](_0x6bdf09[_0x9278('0x39')][_0x9278('0x43')]);_0xafca70[_0x9278('0x44')]=qs[_0x9278('0x3b')](_['pick'](_0x6bdf09[_0x9278('0x39')],_0x1471a1[_0x9278('0x3b')]),_0x2f335a);if(_0x6bdf09[_0x9278('0x39')][_0x9278('0x45')]){_0xafca70[_0x9278('0x44')]=_[_0x9278('0x46')](_0xafca70[_0x9278('0x44')],{'$or':_['map'](_0x2f335a,function(_0x320e0f){if(_0x320e0f['type']!=='VIRTUAL'){var _0x4551fe={};_0x4551fe[_0x320e0f[_0x9278('0x33')]]={'$like':'%'+_0x6bdf09[_0x9278('0x39')][_0x9278('0x45')]+'%'};return _0x4551fe;}})});}_0xafca70=_[_0x9278('0x46')]({},_0xafca70,_0x6bdf09[_0x9278('0x47')]);var _0x1cd053={'where':_0xafca70['where']};return db[_0x9278('0x48')][_0x9278('0x23')](_0x1cd053)[_0x9278('0x2c')](function(_0x522c56){_0x155ef7['count']=_0x522c56;if(_0x6bdf09[_0x9278('0x39')][_0x9278('0x49')]){_0xafca70[_0x9278('0x4a')]=[{'all':!![]}];}return db[_0x9278('0x48')][_0x9278('0x4b')](_0xafca70);})[_0x9278('0x2c')](function(_0x56f9cf){_0x155ef7[_0x9278('0x4c')]=_0x56f9cf;return _0x155ef7;})[_0x9278('0x2c')](respondWithFilteredResult(_0x3b58f9,_0xafca70))['catch'](handleError(_0x3b58f9,null));};exports[_0x9278('0x4d')]=function(_0x3de83f,_0x26c2b1){var _0x3bc98a={'raw':!![],'where':{'id':_0x3de83f[_0x9278('0x4e')]['id']}},_0x3d8e82={};_0x3d8e82[_0x9278('0x38')]=_[_0x9278('0x3a')](db[_0x9278('0x48')]['rawAttributes']);_0x3d8e82[_0x9278('0x39')]=_[_0x9278('0x3a')](_0x3de83f[_0x9278('0x39')]);_0x3d8e82[_0x9278('0x3b')]=_[_0x9278('0x3c')](_0x3d8e82['model'],_0x3d8e82[_0x9278('0x39')]);_0x3bc98a[_0x9278('0x3e')]=_[_0x9278('0x3c')](_0x3d8e82['model'],qs['fields'](_0x3de83f['query'][_0x9278('0x3d')]));_0x3bc98a[_0x9278('0x3e')]=_0x3bc98a[_0x9278('0x3e')][_0x9278('0x3f')]?_0x3bc98a[_0x9278('0x3e')]:_0x3d8e82['model'];if(_0x3de83f['query'][_0x9278('0x49')]){_0x3bc98a['include']=[{'all':!![]}];}_0x3bc98a=_['merge']({},_0x3bc98a,_0x3de83f[_0x9278('0x47')]);return db[_0x9278('0x48')][_0x9278('0x4f')](_0x3bc98a)[_0x9278('0x2c')](handleEntityNotFound(_0x26c2b1,null))[_0x9278('0x2c')](respondWithResult(_0x26c2b1,null))[_0x9278('0x50')](handleError(_0x26c2b1,null));};exports[_0x9278('0x51')]=function(_0x3d0dcc,_0x43b40b){return db[_0x9278('0x48')]['create'](_0x3d0dcc[_0x9278('0x52')],{})[_0x9278('0x2c')](function(_0x2bf25d){var _0x4c9eeb=_0x3d0dcc[_0x9278('0x53')][_0x9278('0x2d')]({'plain':!![]});if(!_0x4c9eeb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c9eeb[_0x9278('0x54')]===_0x9278('0x53')){var _0x57c41c=_0x2bf25d[_0x9278('0x2d')]({'plain':!![]});var _0x477ee5=_0x9278('0x2e');return db['UserProfileSection'][_0x9278('0x4f')]({'where':{'name':_0x477ee5,'userProfileId':_0x4c9eeb[_0x9278('0x55')]},'raw':!![]})[_0x9278('0x2c')](function(_0x47c607){if(_0x47c607&&_0x47c607[_0x9278('0x56')]===0x0){return db['UserProfileResource'][_0x9278('0x51')]({'name':_0x57c41c['name'],'resourceId':_0x57c41c['id'],'type':_0x47c607['name'],'sectionId':_0x47c607['id']},{})[_0x9278('0x2c')](function(){return _0x2bf25d;});}else{return _0x2bf25d;}})[_0x9278('0x50')](function(_0x44ea91){logger[_0x9278('0x31')](_0x9278('0x57'),_0x44ea91);throw _0x44ea91;});}return _0x2bf25d;})[_0x9278('0x2c')](respondWithResult(_0x43b40b,0xc9))[_0x9278('0x50')](handleError(_0x43b40b,null));};exports[_0x9278('0x2a')]=function(_0x15992,_0x137225){if(_0x15992['body']['id']){delete _0x15992[_0x9278('0x52')]['id'];}return db[_0x9278('0x48')][_0x9278('0x4f')]({'where':{'id':_0x15992[_0x9278('0x4e')]['id']}})[_0x9278('0x2c')](handleEntityNotFound(_0x137225,null))['then'](saveUpdates(_0x15992[_0x9278('0x52')],null))['then'](respondWithResult(_0x137225,null))[_0x9278('0x50')](handleError(_0x137225,null));};exports[_0x9278('0x2b')]=function(_0x2de9b0,_0x472296){return db[_0x9278('0x48')][_0x9278('0x4f')]({'where':{'id':_0x2de9b0[_0x9278('0x4e')]['id']}})[_0x9278('0x2c')](handleEntityNotFound(_0x472296,null))[_0x9278('0x2c')](removeEntity(_0x472296,null))['catch'](handleError(_0x472296,null));};exports[_0x9278('0x58')]=function(_0x13f4b4,_0x2d6502){return db[_0x9278('0x48')][_0x9278('0x58')]()['then'](respondWithResult(_0x2d6502,null))[_0x9278('0x50')](handleError(_0x2d6502,null));};exports[_0x9278('0x59')]=function(_0x2cc671,_0x4863b8,_0x73db09){var _0x139756={'raw':!![],'where':{}},_0x2800cb={},_0xd0c8cd;return db['FaxQueue']['findOne']({'where':{'id':_0x2cc671['params']['id']}})[_0x9278('0x2c')](handleEntityNotFound(_0x4863b8,null))[_0x9278('0x2c')](function(_0xfa87e3){if(_0xfa87e3){_0xd0c8cd=_0xfa87e3[_0x9278('0x2d')]({'plain':!![]});_0x2800cb['model']=_['keys'](db['UserFaxQueue'][_0x9278('0x5a')]);_0x2800cb[_0x9278('0x39')]=_[_0x9278('0x3a')](_0x2cc671[_0x9278('0x39')]);_0x2800cb[_0x9278('0x3b')]=_['intersection'](_0x2800cb[_0x9278('0x38')],_0x2800cb[_0x9278('0x39')]);_0x139756['attributes']=_[_0x9278('0x3c')](_0x2800cb[_0x9278('0x38')],qs[_0x9278('0x3d')](_0x2cc671[_0x9278('0x39')]['fields']));_0x139756[_0x9278('0x3e')]=_0x139756[_0x9278('0x3e')][_0x9278('0x3f')]?_0x139756[_0x9278('0x3e')]:_0x2800cb['model'];if(!_0x2cc671[_0x9278('0x39')]['hasOwnProperty']('nolimit')){_0x139756[_0x9278('0x25')]=qs['limit'](_0x2cc671['query']['limit']);_0x139756['offset']=qs[_0x9278('0x24')](_0x2cc671[_0x9278('0x39')][_0x9278('0x24')]);}_0x139756[_0x9278('0x42')]=qs[_0x9278('0x43')](_0x2cc671[_0x9278('0x39')][_0x9278('0x43')]);_0x139756[_0x9278('0x44')]=qs[_0x9278('0x3b')](_[_0x9278('0x5b')](_0x2cc671[_0x9278('0x39')],_0x2800cb[_0x9278('0x3b')]));_0x139756[_0x9278('0x44')][_0x9278('0x5c')]=_0xfa87e3['id'];if(_0x2cc671['query']['filter']){_0x139756[_0x9278('0x44')]=_[_0x9278('0x46')](_0x139756[_0x9278('0x44')],{'$or':_[_0x9278('0x35')](_0x139756[_0x9278('0x3e')],function(_0x1aec55){var _0x49ef7a={};_0x49ef7a[_0x1aec55]={'$like':'%'+_0x2cc671['query'][_0x9278('0x45')]+'%'};return _0x49ef7a;})});}_0x139756=_[_0x9278('0x46')]({},_0x139756,_0x2cc671['options']);return db[_0x9278('0x5d')][_0x9278('0x4b')](_0x139756);}})['then'](function(_0x59b1c6){if(_0x59b1c6){return db['User'][_0x9278('0x5e')]({'where':{'id':_[_0x9278('0x35')](_0x59b1c6,'UserId'),'role':'agent'},'attributes':['id',_0x9278('0x33'),_0x9278('0x5f'),_0x9278('0x60'),_0x9278('0x61')]});}})['then'](function(_0xe8d82c){if(_0xe8d82c){return{'count':_0xe8d82c[_0x9278('0x23')],'rows':_[_0x9278('0x35')](_0xe8d82c['rows'],function(_0x3563ca){return{'membername':_0x3563ca[_0x9278('0x33')],'UserId':_0x3563ca['id'],'queue_name':_0xd0c8cd[_0x9278('0x33')],'FaxQueueId':_0xd0c8cd['id'],'interface':util['format']('%s/%s',_0x9278('0x62'),_0x3563ca['name']),'penalty':0x0,'paused':_0x3563ca[_0x9278('0x5f')],'createdAt':_0x3563ca['createdAt'],'updatedAt':_0x3563ca[_0x9278('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4863b8,_0x139756))[_0x9278('0x50')](handleError(_0x4863b8,null));};exports[_0x9278('0x63')]=function(_0x2c33a1,_0x5ccea7,_0x4a6eaf){var _0x54514b={};var _0x2fc662={};var _0xd2c700;var _0x420073;return db[_0x9278('0x48')][_0x9278('0x64')]({'where':{'id':_0x2c33a1[_0x9278('0x4e')]['id']}})[_0x9278('0x2c')](handleEntityNotFound(_0x5ccea7,null))[_0x9278('0x2c')](function(_0x1e9dc3){if(_0x1e9dc3){_0xd2c700=_0x1e9dc3;_0x2fc662[_0x9278('0x38')]=_[_0x9278('0x3a')](db[_0x9278('0x65')][_0x9278('0x5a')]);_0x2fc662[_0x9278('0x39')]=_['keys'](_0x2c33a1[_0x9278('0x39')]);_0x2fc662[_0x9278('0x3b')]=_[_0x9278('0x3c')](_0x2fc662[_0x9278('0x38')],_0x2fc662[_0x9278('0x39')]);_0x54514b[_0x9278('0x3e')]=_['intersection'](_0x2fc662[_0x9278('0x38')],qs[_0x9278('0x3d')](_0x2c33a1[_0x9278('0x39')]['fields']));_0x54514b[_0x9278('0x3e')]=_0x54514b[_0x9278('0x3e')][_0x9278('0x3f')]?_0x54514b['attributes']:_0x2fc662[_0x9278('0x38')];_0x54514b[_0x9278('0x42')]=qs[_0x9278('0x43')](_0x2c33a1[_0x9278('0x39')][_0x9278('0x43')]);_0x54514b[_0x9278('0x44')]=qs[_0x9278('0x3b')](_[_0x9278('0x5b')](_0x2c33a1[_0x9278('0x39')],_0x2fc662[_0x9278('0x3b')]));if(_0x2c33a1[_0x9278('0x39')]['filter']){_0x54514b[_0x9278('0x44')]=_['merge'](_0x54514b[_0x9278('0x44')],{'$or':_[_0x9278('0x35')](_0x54514b[_0x9278('0x3e')],function(_0x3bc1ff){var _0x29e30d={};_0x29e30d[_0x3bc1ff]={'$like':'%'+_0x2c33a1['query'][_0x9278('0x45')]+'%'};return _0x29e30d;})});}_0x54514b=_[_0x9278('0x46')]({},_0x54514b,_0x2c33a1[_0x9278('0x47')]);return _0xd2c700[_0x9278('0x63')](_0x54514b);}})['then'](function(_0x20e5ba){if(_0x20e5ba){_0x420073=_0x20e5ba['length'];if(!_0x2c33a1['query'][_0x9278('0x40')](_0x9278('0x41'))){_0x54514b[_0x9278('0x25')]=qs[_0x9278('0x25')](_0x2c33a1[_0x9278('0x39')][_0x9278('0x25')]);_0x54514b[_0x9278('0x24')]=qs[_0x9278('0x24')](_0x2c33a1[_0x9278('0x39')][_0x9278('0x24')]);}return _0xd2c700[_0x9278('0x63')](_0x54514b);}})[_0x9278('0x2c')](function(_0x4a3473){if(_0x4a3473){return _0x4a3473?{'count':_0x420073,'rows':_0x4a3473}:null;}})['then'](respondWithResult(_0x5ccea7,null))[_0x9278('0x50')](handleError(_0x5ccea7,null));};exports[_0x9278('0x66')]=function(_0x5a8a9a,_0x1483f8,_0x7a22c8){var _0xc0eeb=_0x5a8a9a[_0x9278('0x52')][_0x9278('0x67')];return db[_0x9278('0x65')][_0x9278('0x4b')]({'where':{'id':_0xc0eeb},'attributes':['id'],'include':[{'model':db[_0x9278('0x68')],'as':_0x9278('0x69'),'attributes':['id',_0x9278('0x33'),_0x9278('0x6a'),_0x9278('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x20071e){if(_0x20071e){var _0x4a223d=_[_0x9278('0x6c')](_0x20071e,function(_0x536379){var _0x2502ce=_0x536379[_0x9278('0x2d')]({'plain':!![]});return _0x2502ce[_0x9278('0x69')];});return db[_0x9278('0x48')][_0x9278('0x4f')]({'where':{'id':_0x5a8a9a[_0x9278('0x4e')]['id']}})[_0x9278('0x2c')](function(_0x32635f){return db[_0x9278('0x6d')][_0x9278('0x6e')](function(_0x5e434c){return _0x32635f[_0x9278('0x66')](_0xc0eeb,{'transaction':_0x5e434c})[_0x9278('0x2c')](function(){return BPromise['each'](_0x4a223d,function(_0x1b3f65){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x1b3f65['id'],'FaxQueueId':_0x5a8a9a['params']['id']},'transaction':_0x5e434c});});})['then'](function(){_0x4a223d[_0x9278('0x6f')](function(_0x40ad90){socket[_0x9278('0x70')](_0x9278('0x71'),{'UserId':_0x40ad90['id'],'FaxQueueId':_0x32635f['id']});});});});});}})[_0x9278('0x2c')](respondWithStatusCode(_0x1483f8,null))[_0x9278('0x50')](handleError(_0x1483f8,null));};exports['removeTeams']=function(_0x432e5c,_0x28bbdb,_0x520392){return db[_0x9278('0x65')]['findAll']({'where':{'id':_0x432e5c[_0x9278('0x39')][_0x9278('0x67')]},'attributes':['id'],'include':[{'model':db[_0x9278('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9278('0x2c')](handleEntityNotFound(_0x28bbdb,null))['then'](function(_0x40920c){var _0x5bb647=_[_0x9278('0x35')](_0x40920c,'id');var _0xf89e10=[];var _0x201cdd=[];var _0x582787=squel[_0x9278('0x72')]();_0x582787[_0x9278('0x73')](_0x9278('0x74'))[_0x9278('0x75')]('team_has_fax_queues','tq')[_0x9278('0x76')](_0x9278('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x9278('0x78'),_0x432e5c['params']['id']);for(var _0x453597=0x0;_0x453597<_0x40920c[_0x9278('0x3f')];_0x453597+=0x1){let _0x4eb5e4=_0x40920c[_0x453597];for(var _0x29b090=0x0;_0x29b090<_0x4eb5e4[_0x9278('0x69')][_0x9278('0x3f')];_0x29b090+=0x1){let _0x918570=_0x4eb5e4[_0x9278('0x69')][_0x29b090];var _0x4865e2=_0x582787['clone']();_0x4865e2['where']('ut.UserId\x20=\x20?',_0x918570['id']);_0x201cdd[_0x9278('0x79')](db[_0x9278('0x6d')][_0x9278('0x39')](_0x4865e2[_0x9278('0x7a')](),{'type':db[_0x9278('0x6d')][_0x9278('0x7b')][_0x9278('0x7c')]})[_0x9278('0x2c')](function(_0x3e3f5f){if(_0x3e3f5f['length']===0x1){return _0x918570['id'];}else{var _0xb13180=_[_0x9278('0x7d')](_['map'](_0x3e3f5f,_0x9278('0x7e')),function(_0x325d19){return _[_0x9278('0x7f')](_0x5bb647,_0x325d19);});if(_0xb13180){return _0x918570['id'];}}}));}}return BPromise['all'](_0x201cdd)[_0x9278('0x2c')](function(_0x3753d8){_0xf89e10=_(_0xf89e10)[_0x9278('0x80')](_0x3753d8)['compact']()[_0x9278('0x81')]();return db[_0x9278('0x48')][_0x9278('0x4f')]({'where':{'id':_0x432e5c[_0x9278('0x4e')]['id']}})['then'](function(_0x178e66){return db[_0x9278('0x6d')][_0x9278('0x6e')](function(_0x3ecbd2){return _0x178e66[_0x9278('0x82')](_0x432e5c[_0x9278('0x39')][_0x9278('0x67')],{'transaction':_0x3ecbd2})['then'](function(){if(!_[_0x9278('0x83')](_0xf89e10)){return _0x178e66['removeAgents'](_0xf89e10,{'transaction':_0x3ecbd2});}})[_0x9278('0x2c')](function(){_0xf89e10[_0x9278('0x6f')](function(_0x56b041){socket[_0x9278('0x70')](_0x9278('0x84'),{'UserId':_0x56b041,'FaxQueueId':_0x178e66['id']});});});});});});})['then'](respondWithStatusCode(_0x28bbdb,null))[_0x9278('0x50')](handleError(_0x28bbdb,null));};exports[_0x9278('0x85')]=function(_0x5be0bd,_0x4c66f0,_0x1e8a95){return db[_0x9278('0x48')]['find']({'where':{'id':_0x5be0bd[_0x9278('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4c66f0,null))[_0x9278('0x2c')](function(_0x3a39a8){if(_0x3a39a8){return _0x3a39a8[_0x9278('0x85')](_0x5be0bd[_0x9278('0x52')][_0x9278('0x67')],_['omit'](_0x5be0bd[_0x9278('0x52')],[_0x9278('0x67'),'id'])||{})[_0x9278('0x86')](function(_0x5c02f3){for(var _0xd68b05=0x0;_0xd68b05<_0x5be0bd[_0x9278('0x52')][_0x9278('0x67')][_0x9278('0x3f')];_0xd68b05+=0x1){socket[_0x9278('0x70')]('userFaxQueue:save',{'UserId':Number(_0x5be0bd[_0x9278('0x52')][_0x9278('0x67')][_0xd68b05]),'FaxQueueId':Number(_0x5be0bd[_0x9278('0x4e')]['id'])});}return _0x5c02f3;});}})['then'](respondWithResult(_0x4c66f0,null))[_0x9278('0x50')](handleError(_0x4c66f0,null));};exports[_0x9278('0x87')]=function(_0x399a8e,_0x5e9219,_0x11aa93){return db[_0x9278('0x48')][_0x9278('0x4f')]({'where':{'id':_0x399a8e[_0x9278('0x4e')]['id']}})[_0x9278('0x2c')](handleEntityNotFound(_0x5e9219,null))[_0x9278('0x2c')](function(_0x3d11d0){if(_0x3d11d0){return _0x3d11d0[_0x9278('0x87')](_0x399a8e[_0x9278('0x39')][_0x9278('0x67')])[_0x9278('0x2c')](function(){if(_[_0x9278('0x88')](_0x399a8e[_0x9278('0x39')][_0x9278('0x67')])){for(var _0x3df4bf=0x0;_0x3df4bf<_0x399a8e[_0x9278('0x39')]['ids'][_0x9278('0x3f')];_0x3df4bf+=0x1){socket[_0x9278('0x70')](_0x9278('0x84'),{'UserId':Number(_0x399a8e['query'][_0x9278('0x67')][_0x3df4bf]),'FaxQueueId':Number(_0x399a8e[_0x9278('0x4e')]['id'])});}}else{socket['emit'](_0x9278('0x84'),{'UserId':Number(_0x399a8e['query'][_0x9278('0x67')]),'FaxQueueId':Number(_0x399a8e[_0x9278('0x4e')]['id'])});}});}})[_0x9278('0x2c')](respondWithStatusCode(_0x5e9219,null))[_0x9278('0x50')](handleError(_0x5e9219,null));};exports['getAgents']=function(_0x2e073c,_0x238275,_0xa09204){var _0x207685={};var _0x10069b={};var _0x5e7315;var _0x200a23;return db['FaxQueue'][_0x9278('0x64')]({'where':{'id':_0x2e073c[_0x9278('0x4e')]['id']}})['then'](handleEntityNotFound(_0x238275,null))[_0x9278('0x2c')](function(_0x1e0293){if(_0x1e0293){_0x5e7315=_0x1e0293;_0x10069b[_0x9278('0x38')]=_[_0x9278('0x3a')](db[_0x9278('0x68')][_0x9278('0x5a')]);_0x10069b[_0x9278('0x39')]=_[_0x9278('0x3a')](_0x2e073c[_0x9278('0x39')]);_0x10069b[_0x9278('0x3b')]=_['intersection'](_0x10069b[_0x9278('0x38')],_0x10069b[_0x9278('0x39')]);_0x207685[_0x9278('0x3e')]=_[_0x9278('0x3c')](_0x10069b[_0x9278('0x38')],qs[_0x9278('0x3d')](_0x2e073c[_0x9278('0x39')][_0x9278('0x3d')]));_0x207685[_0x9278('0x3e')]=_0x207685[_0x9278('0x3e')][_0x9278('0x3f')]?_0x207685[_0x9278('0x3e')]:_0x10069b[_0x9278('0x38')];_0x207685['order']=qs[_0x9278('0x43')](_0x2e073c[_0x9278('0x39')][_0x9278('0x43')]);_0x207685[_0x9278('0x44')]=qs[_0x9278('0x3b')](_['pick'](_0x2e073c['query'],_0x10069b[_0x9278('0x3b')]));if(_0x2e073c[_0x9278('0x39')][_0x9278('0x45')]){_0x207685[_0x9278('0x44')]=_[_0x9278('0x46')](_0x207685['where'],{'$or':_['map'](_0x207685['attributes'],function(_0x487317){var _0x576e24={};_0x576e24[_0x487317]={'$like':'%'+_0x2e073c['query'][_0x9278('0x45')]+'%'};return _0x576e24;})});}_0x207685=_['merge']({},_0x207685,_0x2e073c[_0x9278('0x47')]);return _0x5e7315['getAgents'](_0x207685);}})[_0x9278('0x2c')](function(_0xdf2060){if(_0xdf2060){_0x200a23=_0xdf2060[_0x9278('0x3f')];if(!_0x2e073c[_0x9278('0x39')][_0x9278('0x40')](_0x9278('0x41'))){_0x207685[_0x9278('0x25')]=qs[_0x9278('0x25')](_0x2e073c['query'][_0x9278('0x25')]);_0x207685[_0x9278('0x24')]=qs[_0x9278('0x24')](_0x2e073c[_0x9278('0x39')]['offset']);}return _0x5e7315[_0x9278('0x89')](_0x207685);}})['then'](function(_0x5a2354){if(_0x5a2354){return _0x5a2354?{'count':_0x200a23,'rows':_0x5a2354}:null;}})[_0x9278('0x2c')](respondWithResult(_0x238275,null))[_0x9278('0x50')](handleError(_0x238275,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 71adf2a..f6cc3e5 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 _0xd053=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0xd053,0xe3));var _0x3d05=function(_0x324f55,_0x2e6ca4){_0x324f55=_0x324f55-0x0;var _0x284952=_0xd053[_0x324f55];return _0x284952;};'use strict';var EventEmitter=require(_0x3d05('0x0'));var FaxQueue=require(_0x3d05('0x1'))['db'][_0x3d05('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3d05('0x3')](0x0);var events={'afterCreate':_0x3d05('0x4'),'afterUpdate':'update','afterDestroy':_0x3d05('0x5')};function emitEvent(_0x451568){return function(_0x49c0a7,_0x28d9a1,_0x376d7b){FaxQueueEvents[_0x3d05('0x6')](_0x451568+':'+_0x49c0a7['id'],_0x49c0a7);FaxQueueEvents[_0x3d05('0x6')](_0x451568,_0x49c0a7);_0x376d7b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x3d05('0x7')](e,emitEvent(event));}}module[_0x3d05('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xd464=['hasOwnProperty','hook','events','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x4deca4,_0x18dab3){var _0x427c34=function(_0x1e11a4){while(--_0x1e11a4){_0x4deca4['push'](_0x4deca4['shift']());}};_0x427c34(++_0x18dab3);}(_0xd464,0x182));var _0x4d46=function(_0x6f8bbb,_0x410f59){_0x6f8bbb=_0x6f8bbb-0x0;var _0x4a2bb9=_0xd464[_0x6f8bbb];return _0x4a2bb9;};'use strict';var EventEmitter=require(_0x4d46('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x4d46('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4d46('0x2')](0x0);var events={'afterCreate':_0x4d46('0x3'),'afterUpdate':'update','afterDestroy':_0x4d46('0x4')};function emitEvent(_0x35facc){return function(_0x4b85a1,_0x312131,_0x1ee554){FaxQueueEvents[_0x4d46('0x5')](_0x35facc+':'+_0x4b85a1['id'],_0x4b85a1);FaxQueueEvents[_0x4d46('0x5')](_0x35facc,_0x4b85a1);_0x1ee554(null);};}for(var e in events){if(events[_0x4d46('0x6')](e)){var event=events[e];FaxQueue[_0x4d46('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index d51f75d..aa81e81 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 _0x13af=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash'];(function(_0x130049,_0x420398){var _0x35adeb=function(_0x42c42d){while(--_0x42c42d){_0x130049['push'](_0x130049['shift']());}};_0x35adeb(++_0x420398);}(_0x13af,0x83));var _0xf13a=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x13af[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0xf13a('0x0'));var util=require(_0xf13a('0x1'));var logger=require(_0xf13a('0x2'))('api');var moment=require(_0xf13a('0x3'));var BPromise=require(_0xf13a('0x4'));var rp=require(_0xf13a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf13a('0x6'));var config=require(_0xf13a('0x7'));var attributes=require(_0xf13a('0x8'));module[_0xf13a('0x9')]=function(_0x244afa,_0x133b43){return _0x244afa['define'](_0xf13a('0xa'),attributes,{'tableName':_0xf13a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x679f=['fax_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxQueue'];(function(_0x1c00d7,_0x54c5e6){var _0x5a2418=function(_0x31338c){while(--_0x31338c){_0x1c00d7['push'](_0x1c00d7['shift']());}};_0x5a2418(++_0x54c5e6);}(_0x679f,0x169));var _0xf679=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x679f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf679('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf679('0x1'));var moment=require(_0xf679('0x2'));var BPromise=require(_0xf679('0x3'));var rp=require(_0xf679('0x4'));var fs=require('fs');var path=require(_0xf679('0x5'));var rimraf=require(_0xf679('0x6'));var config=require(_0xf679('0x7'));var attributes=require('./faxQueue.attributes');module[_0xf679('0x8')]=function(_0x42e44f,_0x5582d5){return _0x42e44f[_0xf679('0x9')](_0xf679('0xa'),attributes,{'tableName':_0xf679('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 cd9c08a..72edc0e 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 _0x9951=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxQueue.socket','register','then','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','map','include','model','attributes','info','find','ShowFaxQueue','lodash'];(function(_0x141e7d,_0x1fe76d){var _0x5158cd=function(_0x29a2fc){while(--_0x29a2fc){_0x141e7d['push'](_0x141e7d['shift']());}};_0x5158cd(++_0x1fe76d);}(_0x9951,0x170));var _0x1995=function(_0x7a69a6,_0x3e6ffa){_0x7a69a6=_0x7a69a6-0x0;var _0x40651b=_0x9951[_0x7a69a6];return _0x40651b;};'use strict';var _=require(_0x1995('0x0'));var util=require(_0x1995('0x1'));var moment=require(_0x1995('0x2'));var BPromise=require(_0x1995('0x3'));var rs=require(_0x1995('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1995('0x5'))['db'];var utils=require(_0x1995('0x6'));var logger=require(_0x1995('0x7'))(_0x1995('0x8'));var config=require(_0x1995('0x9'));var jayson=require(_0x1995('0xa'));var client=jayson[_0x1995('0xb')][_0x1995('0xc')]({'port':0x232a});config[_0x1995('0xd')]=_['defaults'](config[_0x1995('0xd')],{'host':_0x1995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1995('0xd')]));require(_0x1995('0xf'))[_0x1995('0x10')](socket);function respondWithRpcPromise(_0x345ef0,_0x295e2e,_0x175773){return new BPromise(function(_0x2e76f4,_0x3175ad){return client['request'](_0x345ef0,_0x175773)[_0x1995('0x11')](function(_0x5d8964){logger['info']('FaxQueue,\x20%s,\x20%s',_0x295e2e,_0x1995('0x12'));logger[_0x1995('0x13')](_0x1995('0x14'),_0x295e2e,_0x1995('0x12'),JSON[_0x1995('0x15')](_0x5d8964));if(_0x5d8964['error']){if(_0x5d8964[_0x1995('0x16')]['code']===0x1f4){logger[_0x1995('0x16')](_0x1995('0x17'),_0x295e2e,_0x5d8964[_0x1995('0x16')][_0x1995('0x18')]);return _0x3175ad(_0x5d8964[_0x1995('0x16')][_0x1995('0x18')]);}logger['error'](_0x1995('0x17'),_0x295e2e,_0x5d8964[_0x1995('0x16')]['message']);return _0x2e76f4(_0x5d8964[_0x1995('0x16')]['message']);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x295e2e,_0x1995('0x12'));_0x2e76f4(_0x5d8964[_0x1995('0x19')][_0x1995('0x18')]);}})[_0x1995('0x1a')](function(_0x4fe9c9){logger[_0x1995('0x16')](_0x1995('0x17'),_0x295e2e,_0x4fe9c9);_0x3175ad(_0x4fe9c9);});});}exports[_0x1995('0x1b')]=function(_0x3034ff){var _0x2ace50=this;return new Promise(function(_0x58c034,_0x3c879d){return db[_0x1995('0x1c')][_0x1995('0x1d')]({'raw':_0x3034ff['options']?_0x3034ff[_0x1995('0x1e')][_0x1995('0x1f')]===undefined?!![]:![]:!![],'where':_0x3034ff[_0x1995('0x1e')]?_0x3034ff[_0x1995('0x1e')][_0x1995('0x20')]||null:null,'attributes':_0x3034ff[_0x1995('0x1e')]?_0x3034ff[_0x1995('0x1e')]['attributes']||null:null,'limit':_0x3034ff[_0x1995('0x1e')]?_0x3034ff[_0x1995('0x1e')][_0x1995('0x21')]||null:null,'include':_0x3034ff[_0x1995('0x1e')]?_0x3034ff[_0x1995('0x1e')]['include']?_[_0x1995('0x22')](_0x3034ff[_0x1995('0x1e')][_0x1995('0x23')],function(_0x13d9a2){return{'model':db[_0x13d9a2[_0x1995('0x24')]],'as':_0x13d9a2['as'],'attributes':_0x13d9a2[_0x1995('0x25')],'include':_0x13d9a2[_0x1995('0x23')]?_[_0x1995('0x22')](_0x13d9a2[_0x1995('0x23')],function(_0x1a83d1){return{'model':db[_0x1a83d1['model']],'as':_0x1a83d1['as'],'attributes':_0x1a83d1[_0x1995('0x25')],'include':_0x1a83d1[_0x1995('0x23')]?_[_0x1995('0x22')](_0x1a83d1[_0x1995('0x23')],function(_0x23f76d){return{'model':db[_0x23f76d[_0x1995('0x24')]],'as':_0x23f76d['as'],'attributes':_0x23f76d[_0x1995('0x25')]};}):[]};}):[]};}):[]:[]})[_0x1995('0x11')](function(_0x5252c6){logger[_0x1995('0x26')](_0x1995('0x1b'),_0x3034ff);logger[_0x1995('0x13')](_0x1995('0x1b'),_0x3034ff,JSON['stringify'](_0x5252c6));_0x58c034(_0x5252c6);})['catch'](function(_0x23c45f){logger[_0x1995('0x16')]('GetFaxQueue',_0x23c45f[_0x1995('0x18')],_0x3034ff);_0x3c879d(_0x2ace50[_0x1995('0x16')](0x1f4,_0x23c45f[_0x1995('0x18')]));});});};exports['ShowFaxQueue']=function(_0x30d079){var _0xe76f0b=this;return new Promise(function(_0x1aa1a1,_0x4bd5f6){return db[_0x1995('0x1c')][_0x1995('0x27')]({'raw':_0x30d079[_0x1995('0x1e')]?_0x30d079['options']['raw']===undefined?!![]:![]:!![],'where':_0x30d079['options']?_0x30d079['options'][_0x1995('0x20')]||null:null,'attributes':_0x30d079[_0x1995('0x1e')]?_0x30d079[_0x1995('0x1e')]['attributes']||null:null,'include':_0x30d079['options']?_0x30d079['options']['include']?_[_0x1995('0x22')](_0x30d079[_0x1995('0x1e')]['include'],function(_0x464c2a){return{'model':db[_0x464c2a[_0x1995('0x24')]],'as':_0x464c2a['as'],'attributes':_0x464c2a[_0x1995('0x25')],'include':_0x464c2a[_0x1995('0x23')]?_[_0x1995('0x22')](_0x464c2a[_0x1995('0x23')],function(_0x117d5b){return{'model':db[_0x117d5b[_0x1995('0x24')]],'as':_0x117d5b['as'],'attributes':_0x117d5b[_0x1995('0x25')],'include':_0x117d5b[_0x1995('0x23')]?_['map'](_0x117d5b[_0x1995('0x23')],function(_0x1a57c5){return{'model':db[_0x1a57c5[_0x1995('0x24')]],'as':_0x1a57c5['as'],'attributes':_0x1a57c5[_0x1995('0x25')]};}):[]};}):[]};}):[]:[]})[_0x1995('0x11')](function(_0x38927e){logger[_0x1995('0x26')]('ShowFaxQueue',_0x30d079);logger[_0x1995('0x13')](_0x1995('0x28'),_0x30d079,JSON[_0x1995('0x15')](_0x38927e));_0x1aa1a1(_0x38927e);})[_0x1995('0x1a')](function(_0x12ce18){logger[_0x1995('0x16')](_0x1995('0x28'),_0x12ce18[_0x1995('0x18')],_0x30d079);_0x4bd5f6(_0xe76f0b[_0x1995('0x16')](0x1f4,_0x12ce18['message']));});});}; \ No newline at end of file +var _0xaf1c=['catch','GetFaxQueue','FaxQueue','options','where','attributes','limit','map','model','include','then','ShowFaxQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5938a3,_0x20150c){var _0x51b960=function(_0x48fc28){while(--_0x48fc28){_0x5938a3['push'](_0x5938a3['shift']());}};_0x51b960(++_0x20150c);}(_0xaf1c,0x10a));var _0xcaf1=function(_0x560a04,_0x9a73e0){_0x560a04=_0x560a04-0x0;var _0x2a266d=_0xaf1c[_0x560a04];return _0x2a266d;};'use strict';var _=require(_0xcaf1('0x0'));var util=require(_0xcaf1('0x1'));var moment=require(_0xcaf1('0x2'));var BPromise=require('bluebird');var rs=require(_0xcaf1('0x3'));var fs=require('fs');var Redis=require(_0xcaf1('0x4'));var db=require(_0xcaf1('0x5'))['db'];var utils=require(_0xcaf1('0x6'));var logger=require(_0xcaf1('0x7'))('rpc');var config=require(_0xcaf1('0x8'));var jayson=require(_0xcaf1('0x9'));var client=jayson[_0xcaf1('0xa')][_0xcaf1('0xb')]({'port':0x232a});config[_0xcaf1('0xc')]=_[_0xcaf1('0xd')](config[_0xcaf1('0xc')],{'host':_0xcaf1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcaf1('0xc')]));require(_0xcaf1('0xf'))[_0xcaf1('0x10')](socket);function respondWithRpcPromise(_0xfc2726,_0x2fc85e,_0x1ec74e){return new BPromise(function(_0x489146,_0xfad8ff){return client[_0xcaf1('0x11')](_0xfc2726,_0x1ec74e)['then'](function(_0x4d07c6){logger[_0xcaf1('0x12')](_0xcaf1('0x13'),_0x2fc85e,_0xcaf1('0x14'));logger[_0xcaf1('0x15')](_0xcaf1('0x16'),_0x2fc85e,'request\x20sent',JSON[_0xcaf1('0x17')](_0x4d07c6));if(_0x4d07c6['error']){if(_0x4d07c6[_0xcaf1('0x18')][_0xcaf1('0x19')]===0x1f4){logger[_0xcaf1('0x18')](_0xcaf1('0x13'),_0x2fc85e,_0x4d07c6['error'][_0xcaf1('0x1a')]);return _0xfad8ff(_0x4d07c6[_0xcaf1('0x18')][_0xcaf1('0x1a')]);}logger[_0xcaf1('0x18')]('FaxQueue,\x20%s,\x20%s',_0x2fc85e,_0x4d07c6[_0xcaf1('0x18')][_0xcaf1('0x1a')]);return _0x489146(_0x4d07c6['error'][_0xcaf1('0x1a')]);}else{logger[_0xcaf1('0x12')]('FaxQueue,\x20%s,\x20%s',_0x2fc85e,_0xcaf1('0x14'));_0x489146(_0x4d07c6[_0xcaf1('0x1b')][_0xcaf1('0x1a')]);}})[_0xcaf1('0x1c')](function(_0x41e23d){logger[_0xcaf1('0x18')](_0xcaf1('0x13'),_0x2fc85e,_0x41e23d);_0xfad8ff(_0x41e23d);});});}exports[_0xcaf1('0x1d')]=function(_0x4b58ce){var _0x42e45a=this;return new Promise(function(_0x5072ba,_0x4ac892){return db[_0xcaf1('0x1e')]['findAll']({'raw':_0x4b58ce[_0xcaf1('0x1f')]?_0x4b58ce[_0xcaf1('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4b58ce[_0xcaf1('0x1f')]?_0x4b58ce[_0xcaf1('0x1f')][_0xcaf1('0x20')]||null:null,'attributes':_0x4b58ce[_0xcaf1('0x1f')]?_0x4b58ce[_0xcaf1('0x1f')][_0xcaf1('0x21')]||null:null,'limit':_0x4b58ce[_0xcaf1('0x1f')]?_0x4b58ce[_0xcaf1('0x1f')][_0xcaf1('0x22')]||null:null,'include':_0x4b58ce['options']?_0x4b58ce[_0xcaf1('0x1f')]['include']?_[_0xcaf1('0x23')](_0x4b58ce[_0xcaf1('0x1f')]['include'],function(_0x2e6d76){return{'model':db[_0x2e6d76[_0xcaf1('0x24')]],'as':_0x2e6d76['as'],'attributes':_0x2e6d76[_0xcaf1('0x21')],'include':_0x2e6d76[_0xcaf1('0x25')]?_[_0xcaf1('0x23')](_0x2e6d76['include'],function(_0x44de7e){return{'model':db[_0x44de7e[_0xcaf1('0x24')]],'as':_0x44de7e['as'],'attributes':_0x44de7e['attributes'],'include':_0x44de7e[_0xcaf1('0x25')]?_[_0xcaf1('0x23')](_0x44de7e[_0xcaf1('0x25')],function(_0x227232){return{'model':db[_0x227232[_0xcaf1('0x24')]],'as':_0x227232['as'],'attributes':_0x227232[_0xcaf1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcaf1('0x26')](function(_0xa7ac04){logger[_0xcaf1('0x12')](_0xcaf1('0x1d'),_0x4b58ce);logger[_0xcaf1('0x15')]('GetFaxQueue',_0x4b58ce,JSON[_0xcaf1('0x17')](_0xa7ac04));_0x5072ba(_0xa7ac04);})[_0xcaf1('0x1c')](function(_0x428d53){logger[_0xcaf1('0x18')](_0xcaf1('0x1d'),_0x428d53['message'],_0x4b58ce);_0x4ac892(_0x42e45a[_0xcaf1('0x18')](0x1f4,_0x428d53[_0xcaf1('0x1a')]));});});};exports[_0xcaf1('0x27')]=function(_0x5b562e){var _0xfd8fd5=this;return new Promise(function(_0x1d89b,_0x3098da){return db['FaxQueue'][_0xcaf1('0x28')]({'raw':_0x5b562e[_0xcaf1('0x1f')]?_0x5b562e[_0xcaf1('0x1f')][_0xcaf1('0x29')]===undefined?!![]:![]:!![],'where':_0x5b562e[_0xcaf1('0x1f')]?_0x5b562e[_0xcaf1('0x1f')][_0xcaf1('0x20')]||null:null,'attributes':_0x5b562e[_0xcaf1('0x1f')]?_0x5b562e[_0xcaf1('0x1f')][_0xcaf1('0x21')]||null:null,'include':_0x5b562e[_0xcaf1('0x1f')]?_0x5b562e[_0xcaf1('0x1f')][_0xcaf1('0x25')]?_['map'](_0x5b562e[_0xcaf1('0x1f')]['include'],function(_0x1436f9){return{'model':db[_0x1436f9[_0xcaf1('0x24')]],'as':_0x1436f9['as'],'attributes':_0x1436f9[_0xcaf1('0x21')],'include':_0x1436f9[_0xcaf1('0x25')]?_[_0xcaf1('0x23')](_0x1436f9[_0xcaf1('0x25')],function(_0x589e4d){return{'model':db[_0x589e4d[_0xcaf1('0x24')]],'as':_0x589e4d['as'],'attributes':_0x589e4d[_0xcaf1('0x21')],'include':_0x589e4d['include']?_[_0xcaf1('0x23')](_0x589e4d[_0xcaf1('0x25')],function(_0x31e536){return{'model':db[_0x31e536[_0xcaf1('0x24')]],'as':_0x31e536['as'],'attributes':_0x31e536[_0xcaf1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcaf1('0x26')](function(_0x3caac4){logger['info'](_0xcaf1('0x27'),_0x5b562e);logger['debug'](_0xcaf1('0x27'),_0x5b562e,JSON[_0xcaf1('0x17')](_0x3caac4));_0x1d89b(_0x3caac4);})[_0xcaf1('0x1c')](function(_0x5d19c4){logger[_0xcaf1('0x18')](_0xcaf1('0x27'),_0x5d19c4[_0xcaf1('0x1a')],_0x5b562e);_0x3098da(_0xfd8fd5[_0xcaf1('0x18')](0x1f4,_0x5d19c4[_0xcaf1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 2e35289..05892b6 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 _0x40c2=['./faxQueue.events','save','update','removeListener','register'];(function(_0x12865f,_0x26e1da){var _0x14bdc9=function(_0x9b1ced){while(--_0x9b1ced){_0x12865f['push'](_0x12865f['shift']());}};_0x14bdc9(++_0x26e1da);}(_0x40c2,0x1b8));var _0x240c=function(_0x9fae93,_0x1a1156){_0x9fae93=_0x9fae93-0x0;var _0xed1c35=_0x40c2[_0x9fae93];return _0xed1c35;};'use strict';var FaxQueueEvents=require(_0x240c('0x0'));var events=[_0x240c('0x1'),'remove',_0x240c('0x2')];function createListener(_0x3b5e77,_0x4e3eb9){return function(_0x287696){_0x4e3eb9['emit'](_0x3b5e77,_0x287696);};}function removeListener(_0x58bff9,_0x42ae01){return function(){FaxQueueEvents[_0x240c('0x3')](_0x58bff9,_0x42ae01);};}exports[_0x240c('0x4')]=function(_0x1b1990){for(var _0x2d3030=0x0,_0x51432e=events['length'];_0x2d3030<_0x51432e;_0x2d3030++){var _0x3292c4=events[_0x2d3030];var _0x1d0b92=createListener('faxQueue:'+_0x3292c4,_0x1b1990);FaxQueueEvents['on'](_0x3292c4,_0x1d0b92);}}; \ No newline at end of file +var _0x7d7f=['update','removeListener','length','./faxQueue.events','save'];(function(_0x49d2df,_0x1f7534){var _0x47abfe=function(_0x16b607){while(--_0x16b607){_0x49d2df['push'](_0x49d2df['shift']());}};_0x47abfe(++_0x1f7534);}(_0x7d7f,0xa3));var _0xf7d7=function(_0x721436,_0x21de0b){_0x721436=_0x721436-0x0;var _0x45af45=_0x7d7f[_0x721436];return _0x45af45;};'use strict';var FaxQueueEvents=require(_0xf7d7('0x0'));var events=[_0xf7d7('0x1'),'remove',_0xf7d7('0x2')];function createListener(_0x3e4586,_0x92f19f){return function(_0x5cd0e0){_0x92f19f['emit'](_0x3e4586,_0x5cd0e0);};}function removeListener(_0x51d7e1,_0x53ce89){return function(){FaxQueueEvents[_0xf7d7('0x3')](_0x51d7e1,_0x53ce89);};}exports['register']=function(_0x59a417){for(var _0xb93425=0x0,_0xa46787=events[_0xf7d7('0x4')];_0xb93425<_0xa46787;_0xb93425++){var _0x1a1d70=events[_0xb93425];var _0x25989c=createListener('faxQueue:'+_0x1a1d70,_0x59a417);FaxQueueEvents['on'](_0x1a1d70,_0x25989c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index fd92a77..e38a87b 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 _0xc359=['isAuthenticated','describe','/:id','show','/:id/members','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0xef66ed,_0x1a5239){var _0xa14f66=function(_0x458541){while(--_0x458541){_0xef66ed['push'](_0xef66ed['shift']());}};_0xa14f66(++_0x1a5239);}(_0xc359,0x1d9));var _0x9c35=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0xc359[_0x315b61];return _0x3521e8;};'use strict';var multer=require('multer');var util=require(_0x9c35('0x0'));var path=require('path');var timeout=require(_0x9c35('0x1'));var express=require(_0x9c35('0x2'));var router=express[_0x9c35('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9c35('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9c35('0x5'));var controller=require('./faxQueue.controller');router[_0x9c35('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x9c35('0x7')](),controller[_0x9c35('0x8')]);router[_0x9c35('0x6')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),controller[_0x9c35('0xa')]);router['get'](_0x9c35('0xb'),auth[_0x9c35('0x7')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x9c35('0x7')](),controller['getTeams']);router[_0x9c35('0x6')](_0x9c35('0xc'),auth[_0x9c35('0x7')](),controller['getAgents']);router[_0x9c35('0xd')]('/',auth[_0x9c35('0x7')](),controller[_0x9c35('0xe')]);router[_0x9c35('0xd')](_0x9c35('0xf'),auth['isAuthenticated'](),controller[_0x9c35('0x10')]);router[_0x9c35('0xd')](_0x9c35('0xc'),auth[_0x9c35('0x7')](),controller[_0x9c35('0x11')]);router[_0x9c35('0x12')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),controller[_0x9c35('0x13')]);router[_0x9c35('0x14')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),controller[_0x9c35('0x15')]);router[_0x9c35('0x14')](_0x9c35('0xf'),auth['isAuthenticated'](),controller[_0x9c35('0x16')]);router[_0x9c35('0x14')](_0x9c35('0xc'),auth[_0x9c35('0x7')](),controller['removeAgents']);module[_0x9c35('0x17')]=router; \ No newline at end of file +var _0xf562=['destroy','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','getMembers','/:id/teams','post','create','addTeams','addAgents','put','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf562,0x100));var _0x2f56=function(_0x3caa82,_0x2eec8f){_0x3caa82=_0x3caa82-0x0;var _0x257182=_0xf562[_0x3caa82];return _0x257182;};'use strict';var multer=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var path=require(_0x2f56('0x2'));var timeout=require(_0x2f56('0x3'));var express=require(_0x2f56('0x4'));var router=express[_0x2f56('0x5')]();var fs_extra=require(_0x2f56('0x6'));var auth=require(_0x2f56('0x7'));var interaction=require(_0x2f56('0x8'));var config=require('../../config/environment');var controller=require(_0x2f56('0x9'));router['get']('/',auth[_0x2f56('0xa')](),controller['index']);router[_0x2f56('0xb')](_0x2f56('0xc'),auth[_0x2f56('0xa')](),controller[_0x2f56('0xd')]);router[_0x2f56('0xb')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller[_0x2f56('0xf')]);router[_0x2f56('0xb')]('/:id/members',auth[_0x2f56('0xa')](),controller[_0x2f56('0x10')]);router['get'](_0x2f56('0x11'),auth[_0x2f56('0xa')](),controller['getTeams']);router[_0x2f56('0xb')]('/:id/users',auth[_0x2f56('0xa')](),controller['getAgents']);router[_0x2f56('0x12')]('/',auth[_0x2f56('0xa')](),controller[_0x2f56('0x13')]);router[_0x2f56('0x12')](_0x2f56('0x11'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x14')]);router[_0x2f56('0x12')]('/:id/users',auth[_0x2f56('0xa')](),controller[_0x2f56('0x15')]);router[_0x2f56('0x16')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller['update']);router[_0x2f56('0x17')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x18')]);router[_0x2f56('0x17')]('/:id/teams',auth[_0x2f56('0xa')](),controller[_0x2f56('0x19')]);router[_0x2f56('0x17')](_0x2f56('0x1a'),auth[_0x2f56('0xa')](),controller['removeAgents']);module[_0x2f56('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index fa79ab2..b6c3ef4 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 _0x6f94=['STRING','DATE','moment','sequelize','exports'];(function(_0x7b192f,_0x406561){var _0x129cda=function(_0x3b0bc5){while(--_0x3b0bc5){_0x7b192f['push'](_0x7b192f['shift']());}};_0x129cda(++_0x406561);}(_0x6f94,0x1ba));var _0x46f9=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x6f94[_0x42bdad];return _0x122626;};'use strict';var moment=require(_0x46f9('0x0'));var Sequelize=require(_0x46f9('0x1'));module[_0x46f9('0x2')]={'uniqueid':{'type':Sequelize[_0x46f9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x46f9('0x3')]},'joinAt':{'type':Sequelize[_0x46f9('0x4')]},'leaveAt':{'type':Sequelize[_0x46f9('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x46f9('0x4')]},'reason':{'type':Sequelize[_0x46f9('0x3')]}}; \ No newline at end of file +var _0x273a=['STRING','DATE','exports'];(function(_0x498ed1,_0x20e53b){var _0x48f88d=function(_0x3b66f0){while(--_0x3b66f0){_0x498ed1['push'](_0x498ed1['shift']());}};_0x48f88d(++_0x20e53b);}(_0x273a,0xb6));var _0xa273=function(_0x4cfb90,_0x9135ca){_0x4cfb90=_0x4cfb90-0x0;var _0x4f37c9=_0x273a[_0x4cfb90];return _0x4f37c9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xa273('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa273('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa273('0x2')]},'acceptAt':{'type':Sequelize[_0xa273('0x2')]},'exitAt':{'type':Sequelize[_0xa273('0x2')]},'reason':{'type':Sequelize[_0xa273('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index fbd23b7..ef369cb 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 _0x3c81=['apply','reject','save','update','then','destroy','end','error','name','send','map','FaxQueueReport','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x37896b,_0xf55488){var _0x55cf1a=function(_0x4fbbf1){while(--_0x4fbbf1){_0x37896b['push'](_0x37896b['shift']());}};_0x55cf1a(++_0xf55488);}(_0x3c81,0x102));var _0x13c8=function(_0x3b11c6,_0x1f9408){_0x3b11c6=_0x3b11c6-0x0;var _0x116592=_0x3c81[_0x3b11c6];return _0x116592;};'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(){_0xcf41d2['status'](0xcc)[_0x13c8('0x28')]();});}};}function handleEntityNotFound(_0x4aff35,_0x47e8ae){return function(_0x5ad0dc){if(!_0x5ad0dc){_0x4aff35[_0x13c8('0x19')](0x194);}return _0x5ad0dc;};}function handleError(_0xc7f1b6,_0x53ada9){_0x53ada9=_0x53ada9||0x1f4;return function(_0x4df077){logger[_0x13c8('0x29')](_0x4df077['stack']);if(_0x4df077['name']){delete _0x4df077[_0x13c8('0x2a')];}_0xc7f1b6[_0x13c8('0x1a')](_0x53ada9)[_0x13c8('0x2b')](_0x4df077);};}exports['index']=function(_0x5ef2f7,_0x277a89){var _0x1071a0={},_0x399840={},_0x441182={'count':0x0,'rows':[]};var _0x138017=_[_0x13c8('0x2c')](db[_0x13c8('0x2d')]['rawAttributes'],function(_0x109cb8){return{'name':_0x109cb8[_0x13c8('0x2e')],'type':_0x109cb8['type']['key']};});_0x399840[_0x13c8('0x2f')]=_[_0x13c8('0x2c')](_0x138017,'name');_0x399840[_0x13c8('0x30')]=_[_0x13c8('0x31')](_0x5ef2f7['query']);_0x399840[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],_0x399840[_0x13c8('0x30')]);_0x1071a0[_0x13c8('0x34')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x5ef2f7['query']['fields']));_0x1071a0[_0x13c8('0x34')]=_0x1071a0[_0x13c8('0x34')]['length']?_0x1071a0[_0x13c8('0x34')]:_0x399840['model'];if(!_0x5ef2f7[_0x13c8('0x30')]['hasOwnProperty'](_0x13c8('0x36'))){_0x1071a0[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x1d')]);_0x1071a0[_0x13c8('0x1c')]=qs[_0x13c8('0x1c')](_0x5ef2f7['query'][_0x13c8('0x1c')]);}_0x1071a0[_0x13c8('0x37')]=qs['sort'](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x38')]);_0x1071a0[_0x13c8('0x39')]=qs['filters'](_['pick'](_0x5ef2f7['query'],_0x399840[_0x13c8('0x32')]),_0x138017);if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]){_0x1071a0[_0x13c8('0x39')]=_[_0x13c8('0x3b')](_0x1071a0[_0x13c8('0x39')],{'$or':_[_0x13c8('0x2c')](_0x138017,function(_0xe19858){if(_0xe19858[_0x13c8('0x3c')]!=='VIRTUAL'){var _0x5b2a28={};_0x5b2a28[_0xe19858[_0x13c8('0x2a')]]={'$like':'%'+_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]+'%'};return _0x5b2a28;}})});}_0x1071a0=_[_0x13c8('0x3b')]({},_0x1071a0,_0x5ef2f7['options']);var _0x35e1e7={'where':_0x1071a0['where']};return db[_0x13c8('0x2d')][_0x13c8('0x1f')](_0x35e1e7)[_0x13c8('0x26')](function(_0x1cd02c){_0x441182[_0x13c8('0x1f')]=_0x1cd02c;if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3d')]){_0x1071a0[_0x13c8('0x3e')]=[{'all':!![]}];}return db[_0x13c8('0x2d')][_0x13c8('0x3f')](_0x1071a0);})[_0x13c8('0x26')](function(_0x416169){_0x441182[_0x13c8('0x40')]=_0x416169;return _0x441182;})[_0x13c8('0x26')](respondWithFilteredResult(_0x277a89,_0x1071a0))[_0x13c8('0x41')](handleError(_0x277a89,null));};exports[_0x13c8('0x42')]=function(_0x1b2ada,_0x1505fb){var _0xc5eb86={'raw':!![],'where':{'id':_0x1b2ada[_0x13c8('0x43')]['id']}},_0x1cff99={};_0x1cff99[_0x13c8('0x2f')]=_[_0x13c8('0x31')](db[_0x13c8('0x2d')][_0x13c8('0x44')]);_0x1cff99['query']=_[_0x13c8('0x31')](_0x1b2ada[_0x13c8('0x30')]);_0x1cff99[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],_0x1cff99['query']);_0xc5eb86['attributes']=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x1b2ada['query']['fields']));_0xc5eb86['attributes']=_0xc5eb86[_0x13c8('0x34')]['length']?_0xc5eb86[_0x13c8('0x34')]:_0x1cff99['model'];if(_0x1b2ada[_0x13c8('0x30')][_0x13c8('0x3d')]){_0xc5eb86[_0x13c8('0x3e')]=[{'all':!![]}];}_0xc5eb86=_[_0x13c8('0x3b')]({},_0xc5eb86,_0x1b2ada[_0x13c8('0x45')]);return db[_0x13c8('0x2d')]['find'](_0xc5eb86)[_0x13c8('0x26')](handleEntityNotFound(_0x1505fb,null))[_0x13c8('0x26')](respondWithResult(_0x1505fb,null))['catch'](handleError(_0x1505fb,null));};exports[_0x13c8('0x46')]=function(_0x26155d,_0x2e925f){return db[_0x13c8('0x2d')][_0x13c8('0x46')](_0x26155d['body'],{})[_0x13c8('0x26')](respondWithResult(_0x2e925f,0xc9))[_0x13c8('0x41')](handleError(_0x2e925f,null));};exports[_0x13c8('0x25')]=function(_0x38418b,_0x185d18){if(_0x38418b['body']['id']){delete _0x38418b[_0x13c8('0x47')]['id'];}return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x38418b[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x185d18,null))[_0x13c8('0x26')](saveUpdates(_0x38418b[_0x13c8('0x47')],null))[_0x13c8('0x26')](respondWithResult(_0x185d18,null))[_0x13c8('0x41')](handleError(_0x185d18,null));};exports[_0x13c8('0x27')]=function(_0x266f4e,_0x5e1fe5){return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x266f4e[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x5e1fe5,null))[_0x13c8('0x26')](removeEntity(_0x5e1fe5,null))[_0x13c8('0x41')](handleError(_0x5e1fe5,null));};exports['describe']=function(_0x341fd3,_0x416e4f){return db[_0x13c8('0x2d')]['describe']()['then'](respondWithResult(_0x416e4f,null))[_0x13c8('0x41')](handleError(_0x416e4f,null));}; \ No newline at end of file +var _0xd136=['body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','index','map','FaxQueueReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create'];(function(_0x14a32b,_0x356d43){var _0x2b89a9=function(_0x13bc04){while(--_0x13bc04){_0x14a32b['push'](_0x14a32b['shift']());}};_0x2b89a9(++_0x356d43);}(_0xd136,0x94));var _0x6d13=function(_0x2f3c0e,_0x1b844a){_0x2f3c0e=_0x2f3c0e-0x0;var _0x46b864=_0xd136[_0x2f3c0e];return _0x46b864;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d13('0x0'));var zipdir=require(_0x6d13('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d13('0x2'));var moment=require(_0x6d13('0x3'));var BPromise=require(_0x6d13('0x4'));var Mustache=require(_0x6d13('0x5'));var util=require(_0x6d13('0x6'));var path=require(_0x6d13('0x7'));var sox=require(_0x6d13('0x8'));var csv=require(_0x6d13('0x9'));var ejs=require(_0x6d13('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d13('0xb'));var squel=require(_0x6d13('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d13('0xd'));var toCsv=require(_0x6d13('0x9'));var querystring=require(_0x6d13('0xe'));var Papa=require(_0x6d13('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d13('0x10'));var as=require(_0x6d13('0x11'));var hardwareService=require(_0x6d13('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6d13('0x13'));var config=require(_0x6d13('0x14'));var licenseUtil=require(_0x6d13('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b4cc3,_0x5ef7e6){_0x5ef7e6=_0x5ef7e6||0xcc;return function(_0x37d3c1){if(_0x37d3c1){return _0x1b4cc3[_0x6d13('0x16')](_0x5ef7e6);}return _0x1b4cc3['status'](_0x5ef7e6)['end']();};}function respondWithResult(_0x4ca95d,_0x37efd8){_0x37efd8=_0x37efd8||0xc8;return function(_0x10709d){if(_0x10709d){return _0x4ca95d[_0x6d13('0x17')](_0x37efd8)[_0x6d13('0x18')](_0x10709d);}};}function respondWithFilteredResult(_0x2f4c2b,_0x4f1bdf){return function(_0xf27049){if(_0xf27049){var _0x405368=typeof _0x4f1bdf[_0x6d13('0x19')]===_0x6d13('0x1a')&&typeof _0x4f1bdf[_0x6d13('0x1b')]===_0x6d13('0x1a');var _0xb17857=_0xf27049[_0x6d13('0x1c')];var _0xc6c2b=_0x405368?0x0:_0x4f1bdf['offset'];var _0x276fdd=_0x405368?_0xf27049[_0x6d13('0x1c')]:_0x4f1bdf[_0x6d13('0x19')]+_0x4f1bdf[_0x6d13('0x1b')];var _0x1f3603;if(_0x276fdd>=_0xb17857){_0x276fdd=_0xb17857;_0x1f3603=0xc8;}else{_0x1f3603=0xce;}_0x2f4c2b[_0x6d13('0x17')](_0x1f3603);return _0x2f4c2b[_0x6d13('0x1d')](_0x6d13('0x1e'),_0xc6c2b+'-'+_0x276fdd+'/'+_0xb17857)[_0x6d13('0x18')](_0xf27049);}return null;};}function patchUpdates(_0x427bb8){return function(_0x40f629){try{jsonpatch[_0x6d13('0x1f')](_0x40f629,_0x427bb8,!![]);}catch(_0x18889d){return BPromise[_0x6d13('0x20')](_0x18889d);}return _0x40f629[_0x6d13('0x21')]();};}function saveUpdates(_0x208876,_0x5619fc){return function(_0x387de2){if(_0x387de2){return _0x387de2['update'](_0x208876)[_0x6d13('0x22')](function(_0x204438){return _0x204438;});}return null;};}function removeEntity(_0x151aa4,_0x5bbc9d){return function(_0x1b0f94){if(_0x1b0f94){return _0x1b0f94[_0x6d13('0x23')]()[_0x6d13('0x22')](function(){_0x151aa4[_0x6d13('0x17')](0xcc)[_0x6d13('0x24')]();});}};}function handleEntityNotFound(_0x361432,_0x66e464){return function(_0x821eea){if(!_0x821eea){_0x361432['sendStatus'](0x194);}return _0x821eea;};}function handleError(_0xacf472,_0x4f70e2){_0x4f70e2=_0x4f70e2||0x1f4;return function(_0x4c8526){logger[_0x6d13('0x25')](_0x4c8526['stack']);if(_0x4c8526[_0x6d13('0x26')]){delete _0x4c8526[_0x6d13('0x26')];}_0xacf472[_0x6d13('0x17')](_0x4f70e2)['send'](_0x4c8526);};}exports[_0x6d13('0x27')]=function(_0xd469b6,_0x573080){var _0x2fcdfd={},_0x1eda96={},_0xb82395={'count':0x0,'rows':[]};var _0x438e93=_[_0x6d13('0x28')](db[_0x6d13('0x29')][_0x6d13('0x2a')],function(_0x34abc4){return{'name':_0x34abc4['fieldName'],'type':_0x34abc4[_0x6d13('0x2b')][_0x6d13('0x2c')]};});_0x1eda96['model']=_[_0x6d13('0x28')](_0x438e93,_0x6d13('0x26'));_0x1eda96[_0x6d13('0x2d')]=_['keys'](_0xd469b6[_0x6d13('0x2d')]);_0x1eda96[_0x6d13('0x2e')]=_[_0x6d13('0x2f')](_0x1eda96[_0x6d13('0x30')],_0x1eda96[_0x6d13('0x2d')]);_0x2fcdfd[_0x6d13('0x31')]=_[_0x6d13('0x2f')](_0x1eda96['model'],qs[_0x6d13('0x32')](_0xd469b6['query'][_0x6d13('0x32')]));_0x2fcdfd[_0x6d13('0x31')]=_0x2fcdfd[_0x6d13('0x31')][_0x6d13('0x33')]?_0x2fcdfd[_0x6d13('0x31')]:_0x1eda96[_0x6d13('0x30')];if(!_0xd469b6['query']['hasOwnProperty'](_0x6d13('0x34'))){_0x2fcdfd[_0x6d13('0x1b')]=qs[_0x6d13('0x1b')](_0xd469b6[_0x6d13('0x2d')][_0x6d13('0x1b')]);_0x2fcdfd[_0x6d13('0x19')]=qs['offset'](_0xd469b6[_0x6d13('0x2d')][_0x6d13('0x19')]);}_0x2fcdfd[_0x6d13('0x35')]=qs[_0x6d13('0x36')](_0xd469b6[_0x6d13('0x2d')][_0x6d13('0x36')]);_0x2fcdfd[_0x6d13('0x37')]=qs[_0x6d13('0x2e')](_[_0x6d13('0x38')](_0xd469b6[_0x6d13('0x2d')],_0x1eda96['filters']),_0x438e93);if(_0xd469b6['query'][_0x6d13('0x39')]){_0x2fcdfd['where']=_['merge'](_0x2fcdfd[_0x6d13('0x37')],{'$or':_[_0x6d13('0x28')](_0x438e93,function(_0xba5453){if(_0xba5453['type']!==_0x6d13('0x3a')){var _0x3c5b61={};_0x3c5b61[_0xba5453[_0x6d13('0x26')]]={'$like':'%'+_0xd469b6['query'][_0x6d13('0x39')]+'%'};return _0x3c5b61;}})});}_0x2fcdfd=_['merge']({},_0x2fcdfd,_0xd469b6[_0x6d13('0x3b')]);var _0x4d2bdd={'where':_0x2fcdfd['where']};return db[_0x6d13('0x29')][_0x6d13('0x1c')](_0x4d2bdd)['then'](function(_0x4c31fe){_0xb82395[_0x6d13('0x1c')]=_0x4c31fe;if(_0xd469b6[_0x6d13('0x2d')][_0x6d13('0x3c')]){_0x2fcdfd[_0x6d13('0x3d')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x6d13('0x3e')](_0x2fcdfd);})[_0x6d13('0x22')](function(_0x4b4cc5){_0xb82395[_0x6d13('0x3f')]=_0x4b4cc5;return _0xb82395;})[_0x6d13('0x22')](respondWithFilteredResult(_0x573080,_0x2fcdfd))[_0x6d13('0x40')](handleError(_0x573080,null));};exports[_0x6d13('0x41')]=function(_0x19456c,_0x112bfd){var _0x289170={'raw':!![],'where':{'id':_0x19456c[_0x6d13('0x42')]['id']}},_0x5f1238={};_0x5f1238[_0x6d13('0x30')]=_[_0x6d13('0x43')](db[_0x6d13('0x29')][_0x6d13('0x2a')]);_0x5f1238[_0x6d13('0x2d')]=_[_0x6d13('0x43')](_0x19456c['query']);_0x5f1238[_0x6d13('0x2e')]=_['intersection'](_0x5f1238[_0x6d13('0x30')],_0x5f1238[_0x6d13('0x2d')]);_0x289170[_0x6d13('0x31')]=_[_0x6d13('0x2f')](_0x5f1238[_0x6d13('0x30')],qs[_0x6d13('0x32')](_0x19456c[_0x6d13('0x2d')][_0x6d13('0x32')]));_0x289170['attributes']=_0x289170[_0x6d13('0x31')]['length']?_0x289170[_0x6d13('0x31')]:_0x5f1238[_0x6d13('0x30')];if(_0x19456c[_0x6d13('0x2d')][_0x6d13('0x3c')]){_0x289170[_0x6d13('0x3d')]=[{'all':!![]}];}_0x289170=_[_0x6d13('0x44')]({},_0x289170,_0x19456c[_0x6d13('0x3b')]);return db[_0x6d13('0x29')][_0x6d13('0x45')](_0x289170)[_0x6d13('0x22')](handleEntityNotFound(_0x112bfd,null))[_0x6d13('0x22')](respondWithResult(_0x112bfd,null))['catch'](handleError(_0x112bfd,null));};exports[_0x6d13('0x46')]=function(_0x3f6821,_0x3ae25c){return db['FaxQueueReport']['create'](_0x3f6821[_0x6d13('0x47')],{})[_0x6d13('0x22')](respondWithResult(_0x3ae25c,0xc9))[_0x6d13('0x40')](handleError(_0x3ae25c,null));};exports['update']=function(_0x3ac978,_0x31872b){if(_0x3ac978[_0x6d13('0x47')]['id']){delete _0x3ac978['body']['id'];}return db[_0x6d13('0x29')][_0x6d13('0x45')]({'where':{'id':_0x3ac978['params']['id']}})['then'](handleEntityNotFound(_0x31872b,null))[_0x6d13('0x22')](saveUpdates(_0x3ac978[_0x6d13('0x47')],null))[_0x6d13('0x22')](respondWithResult(_0x31872b,null))[_0x6d13('0x40')](handleError(_0x31872b,null));};exports[_0x6d13('0x23')]=function(_0x3d3244,_0x5037a3){return db['FaxQueueReport'][_0x6d13('0x45')]({'where':{'id':_0x3d3244[_0x6d13('0x42')]['id']}})[_0x6d13('0x22')](handleEntityNotFound(_0x5037a3,null))[_0x6d13('0x22')](removeEntity(_0x5037a3,null))[_0x6d13('0x40')](handleError(_0x5037a3,null));};exports['describe']=function(_0x1bb289,_0x48ea56){return db[_0x6d13('0x29')][_0x6d13('0x48')]()[_0x6d13('0x22')](respondWithResult(_0x48ea56,null))['catch'](handleError(_0x48ea56,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1763796..4c29fdd 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x32800b,_0x52db61){var _0x2394af=function(_0x380165){while(--_0x380165){_0x32800b['push'](_0x32800b['shift']());}};_0x2394af(++_0x52db61);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x5fc3[_0x4b6778];return _0x22dbb9;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x814b,0x1a2));var _0xb814=function(_0x4e0eb6,_0x240784){_0x4e0eb6=_0x4e0eb6-0x0;var _0x46e432=_0x814b[_0x4e0eb6];return _0x46e432;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index bdef474..b06561b 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 _0xa393=['rpc','../../config/environment','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateFaxQueueReport','create','options','raw','stringify','UpdateFaxQueueReport','FaxQueueReport','update','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x320b7b,_0x1e2ea0){var _0x2ff108=function(_0x2fb1f7){while(--_0x2fb1f7){_0x320b7b['push'](_0x320b7b['shift']());}};_0x2ff108(++_0x1e2ea0);}(_0xa393,0xed));var _0x3a39=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa393[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3a39('0x0'));var util=require(_0x3a39('0x1'));var moment=require(_0x3a39('0x2'));var BPromise=require(_0x3a39('0x3'));var rs=require(_0x3a39('0x4'));var fs=require('fs');var Redis=require(_0x3a39('0x5'));var db=require(_0x3a39('0x6'))['db'];var utils=require(_0x3a39('0x7'));var logger=require('../../config/logger')(_0x3a39('0x8'));var config=require(_0x3a39('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3a39('0xa')][_0x3a39('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29d1fb,_0xc1830e,_0x4bb0f9){return new BPromise(function(_0x1caf0b,_0x12be3a){return client[_0x3a39('0xc')](_0x29d1fb,_0x4bb0f9)[_0x3a39('0xd')](function(_0x117ce3){logger['info'](_0x3a39('0xe'),_0xc1830e,_0x3a39('0xf'));logger[_0x3a39('0x10')](_0x3a39('0x11'),_0xc1830e,_0x3a39('0xf'),JSON['stringify'](_0x117ce3));if(_0x117ce3[_0x3a39('0x12')]){if(_0x117ce3[_0x3a39('0x12')][_0x3a39('0x13')]===0x1f4){logger[_0x3a39('0x12')](_0x3a39('0xe'),_0xc1830e,_0x117ce3[_0x3a39('0x12')]['message']);return _0x12be3a(_0x117ce3[_0x3a39('0x12')][_0x3a39('0x14')]);}logger[_0x3a39('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0xc1830e,_0x117ce3[_0x3a39('0x12')][_0x3a39('0x14')]);return _0x1caf0b(_0x117ce3[_0x3a39('0x12')]['message']);}else{logger[_0x3a39('0x15')](_0x3a39('0xe'),_0xc1830e,_0x3a39('0xf'));_0x1caf0b(_0x117ce3[_0x3a39('0x16')][_0x3a39('0x14')]);}})[_0x3a39('0x17')](function(_0x5139f6){logger[_0x3a39('0x12')](_0x3a39('0xe'),_0xc1830e,_0x5139f6);_0x12be3a(_0x5139f6);});});}exports[_0x3a39('0x18')]=function(_0x18375f){var _0x290918=this;return new Promise(function(_0x1d0e5c,_0x591187){return db['FaxQueueReport'][_0x3a39('0x19')](_0x18375f['body'],{'raw':_0x18375f[_0x3a39('0x1a')]?_0x18375f[_0x3a39('0x1a')][_0x3a39('0x1b')]===undefined?!![]:![]:!![]})[_0x3a39('0xd')](function(_0x1d50ff){logger[_0x3a39('0x15')]('CreateFaxQueueReport',_0x18375f);logger[_0x3a39('0x10')]('CreateFaxQueueReport',_0x18375f,JSON[_0x3a39('0x1c')](_0x1d50ff));_0x1d0e5c(_0x1d50ff);})[_0x3a39('0x17')](function(_0x1c18ea){logger[_0x3a39('0x12')]('CreateFaxQueueReport',_0x1c18ea['message'],_0x18375f);_0x591187(_0x290918[_0x3a39('0x12')](0x1f4,_0x1c18ea['message']));});});};exports[_0x3a39('0x1d')]=function(_0x5c1622){var _0x5a3578=this;return new Promise(function(_0x5829b1,_0x240fb7){return db[_0x3a39('0x1e')][_0x3a39('0x1f')](_0x5c1622[_0x3a39('0x20')],{'raw':_0x5c1622['options']?_0x5c1622[_0x3a39('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c1622[_0x3a39('0x1a')]?_0x5c1622['options'][_0x3a39('0x21')]||null:null,'attributes':_0x5c1622[_0x3a39('0x1a')]?_0x5c1622[_0x3a39('0x1a')][_0x3a39('0x22')]||null:null,'limit':_0x5c1622[_0x3a39('0x1a')]?_0x5c1622['options']['limit']||null:null})[_0x3a39('0xd')](function(_0x544a21){logger[_0x3a39('0x15')](_0x3a39('0x1d'),_0x5c1622);logger['debug']('UpdateFaxQueueReport',_0x5c1622,JSON[_0x3a39('0x1c')](_0x544a21));_0x5829b1(_0x544a21);})[_0x3a39('0x17')](function(_0x5dc3e3){logger[_0x3a39('0x12')](_0x3a39('0x1d'),_0x5dc3e3[_0x3a39('0x14')],_0x5c1622);_0x240fb7(_0x5a3578[_0x3a39('0x12')](0x1f4,_0x5dc3e3['message']));});});}; \ No newline at end of file +var _0x658f=['stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','UpdateFaxQueueReport','body','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x3cde56,_0x27ff34){var _0x1688d3=function(_0x6c6c81){while(--_0x6c6c81){_0x3cde56['push'](_0x3cde56['shift']());}};_0x1688d3(++_0x27ff34);}(_0x658f,0x112));var _0xf658=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x658f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf658('0x0'));var util=require(_0xf658('0x1'));var moment=require('moment');var BPromise=require(_0xf658('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf658('0x3'));var db=require(_0xf658('0x4'))['db'];var utils=require(_0xf658('0x5'));var logger=require(_0xf658('0x6'))('rpc');var config=require(_0xf658('0x7'));var jayson=require(_0xf658('0x8'));var client=jayson['client'][_0xf658('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17823b,_0x5141e9,_0x346790){return new BPromise(function(_0x1b0e02,_0x5c2ce4){return client['request'](_0x17823b,_0x346790)[_0xf658('0xa')](function(_0x337dd1){logger[_0xf658('0xb')](_0xf658('0xc'),_0x5141e9,_0xf658('0xd'));logger[_0xf658('0xe')](_0xf658('0xf'),_0x5141e9,_0xf658('0xd'),JSON[_0xf658('0x10')](_0x337dd1));if(_0x337dd1[_0xf658('0x11')]){if(_0x337dd1[_0xf658('0x11')]['code']===0x1f4){logger[_0xf658('0x11')](_0xf658('0xc'),_0x5141e9,_0x337dd1[_0xf658('0x11')][_0xf658('0x12')]);return _0x5c2ce4(_0x337dd1[_0xf658('0x11')][_0xf658('0x12')]);}logger[_0xf658('0x11')](_0xf658('0xc'),_0x5141e9,_0x337dd1[_0xf658('0x11')][_0xf658('0x12')]);return _0x1b0e02(_0x337dd1[_0xf658('0x11')]['message']);}else{logger[_0xf658('0xb')](_0xf658('0xc'),_0x5141e9,'request\x20sent');_0x1b0e02(_0x337dd1[_0xf658('0x13')]['message']);}})[_0xf658('0x14')](function(_0x170c67){logger[_0xf658('0x11')](_0xf658('0xc'),_0x5141e9,_0x170c67);_0x5c2ce4(_0x170c67);});});}exports[_0xf658('0x15')]=function(_0xa02387){var _0x445029=this;return new Promise(function(_0x3d6375,_0x2cd1c9){return db[_0xf658('0x16')]['create'](_0xa02387['body'],{'raw':_0xa02387[_0xf658('0x17')]?_0xa02387[_0xf658('0x17')][_0xf658('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x44c13b){logger[_0xf658('0xb')](_0xf658('0x15'),_0xa02387);logger[_0xf658('0xe')](_0xf658('0x15'),_0xa02387,JSON[_0xf658('0x10')](_0x44c13b));_0x3d6375(_0x44c13b);})[_0xf658('0x14')](function(_0x5733f4){logger['error'](_0xf658('0x15'),_0x5733f4[_0xf658('0x12')],_0xa02387);_0x2cd1c9(_0x445029['error'](0x1f4,_0x5733f4[_0xf658('0x12')]));});});};exports[_0xf658('0x19')]=function(_0x35f830){var _0x54aa7a=this;return new Promise(function(_0x5e4f91,_0x2e55a7){return db[_0xf658('0x16')]['update'](_0x35f830[_0xf658('0x1a')],{'raw':_0x35f830[_0xf658('0x17')]?_0x35f830[_0xf658('0x17')][_0xf658('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35f830[_0xf658('0x17')]?_0x35f830['options']['where']||null:null,'attributes':_0x35f830[_0xf658('0x17')]?_0x35f830[_0xf658('0x17')][_0xf658('0x1b')]||null:null,'limit':_0x35f830['options']?_0x35f830['options'][_0xf658('0x1c')]||null:null})[_0xf658('0xa')](function(_0x4447ba){logger[_0xf658('0xb')](_0xf658('0x19'),_0x35f830);logger[_0xf658('0xe')](_0xf658('0x19'),_0x35f830,JSON[_0xf658('0x10')](_0x4447ba));_0x5e4f91(_0x4447ba);})[_0xf658('0x14')](function(_0x3e0a8a){logger[_0xf658('0x11')](_0xf658('0x19'),_0x3e0a8a['message'],_0x35f830);_0x2e55a7(_0x54aa7a[_0xf658('0x11')](0x1f4,_0x3e0a8a[_0xf658('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8df3465..a2f5b24 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 _0x1ffe=['/describe','/:id','show','post','put','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x1ffe,0x1ed));var _0xe1ff=function(_0x139f4f,_0x208d00){_0x139f4f=_0x139f4f-0x0;var _0x5f080e=_0x1ffe[_0x139f4f];return _0x5f080e;};'use strict';var multer=require(_0xe1ff('0x0'));var util=require('util');var path=require(_0xe1ff('0x1'));var timeout=require(_0xe1ff('0x2'));var express=require(_0xe1ff('0x3'));var router=express[_0xe1ff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe1ff('0x5'));var interaction=require(_0xe1ff('0x6'));var config=require(_0xe1ff('0x7'));var controller=require(_0xe1ff('0x8'));router['get']('/',auth[_0xe1ff('0x9')](),controller[_0xe1ff('0xa')]);router['get'](_0xe1ff('0xb'),auth[_0xe1ff('0x9')](),controller['describe']);router['get'](_0xe1ff('0xc'),auth['isAuthenticated'](),controller[_0xe1ff('0xd')]);router[_0xe1ff('0xe')]('/',auth[_0xe1ff('0x9')](),controller['create']);router[_0xe1ff('0xf')](_0xe1ff('0xc'),auth[_0xe1ff('0x9')](),controller[_0xe1ff('0x10')]);router['delete'](_0xe1ff('0xc'),auth[_0xe1ff('0x9')](),controller[_0xe1ff('0x11')]);module['exports']=router; \ No newline at end of file +var _0x574a=['fs-extra','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1af19d,_0x33d24a){var _0x5c0d1d=function(_0x261ff2){while(--_0x261ff2){_0x1af19d['push'](_0x1af19d['shift']());}};_0x5c0d1d(++_0x33d24a);}(_0x574a,0x118));var _0xa574=function(_0x50c50b,_0x3a6fb3){_0x50c50b=_0x50c50b-0x0;var _0x423c29=_0x574a[_0x50c50b];return _0x423c29;};'use strict';var multer=require(_0xa574('0x0'));var util=require(_0xa574('0x1'));var path=require(_0xa574('0x2'));var timeout=require(_0xa574('0x3'));var express=require(_0xa574('0x4'));var router=express[_0xa574('0x5')]();var fs_extra=require(_0xa574('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa574('0x7'));router[_0xa574('0x8')]('/',auth[_0xa574('0x9')](),controller[_0xa574('0xa')]);router[_0xa574('0x8')](_0xa574('0xb'),auth[_0xa574('0x9')](),controller[_0xa574('0xc')]);router[_0xa574('0x8')](_0xa574('0xd'),auth['isAuthenticated'](),controller[_0xa574('0xe')]);router[_0xa574('0xf')]('/',auth[_0xa574('0x9')](),controller[_0xa574('0x10')]);router[_0xa574('0x11')](_0xa574('0xd'),auth[_0xa574('0x9')](),controller[_0xa574('0x12')]);router[_0xa574('0x13')]('/:id',auth[_0xa574('0x9')](),controller[_0xa574('0x14')]);module[_0xa574('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 05052a0..fe7e919 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x42f3e4,_0x2646fd){var _0x1d7aa6=function(_0x4a721d){while(--_0x4a721d){_0x42f3e4['push'](_0x42f3e4['shift']());}};_0x1d7aa6(++_0x2646fd);}(_0x34e8,0x12c));var _0x834e=function(_0x18e3ff,_0x75f0f7){_0x18e3ff=_0x18e3ff-0x0;var _0x10d522=_0x34e8[_0x18e3ff];return _0x10d522;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1677e9,_0x26d0ac){_0x1677e9=_0x1677e9-0x0;var _0x4bdac8=_0x9bde[_0x1677e9];return _0x4bdac8;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index df90791..25475d9 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 _0xdb49=['moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','update','destroy','then','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch'];(function(_0xcc18a5,_0x4dbb0a){var _0x314c9b=function(_0x4b9582){while(--_0x4b9582){_0xcc18a5['push'](_0xcc18a5['shift']());}};_0x314c9b(++_0x4dbb0a);}(_0xdb49,0x85));var _0x9db4=function(_0x114d9c,_0x32794b){_0x114d9c=_0x114d9c-0x0;var _0x4ffa3b=_0xdb49[_0x114d9c];return _0x4ffa3b;};'use strict';var emlformat=require(_0x9db4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9db4('0x1'));var jsonpatch=require(_0x9db4('0x2'));var rp=require('request-promise');var moment=require(_0x9db4('0x3'));var BPromise=require(_0x9db4('0x4'));var Mustache=require('mustache');var util=require(_0x9db4('0x5'));var path=require('path');var sox=require(_0x9db4('0x6'));var csv=require(_0x9db4('0x7'));var ejs=require(_0x9db4('0x8'));var fs=require('fs');var fs_extra=require(_0x9db4('0x9'));var _=require('lodash');var squel=require(_0x9db4('0xa'));var crypto=require(_0x9db4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9db4('0xc'));var toCsv=require(_0x9db4('0x7'));var querystring=require(_0x9db4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9db4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9db4('0xf'));var hardwareService=require(_0x9db4('0x10'));var logger=require('../../config/logger')(_0x9db4('0x11'));var utils=require(_0x9db4('0x12'));var config=require(_0x9db4('0x13'));var licenseUtil=require(_0x9db4('0x14'));var db=require(_0x9db4('0x15'))['db'];function respondWithStatusCode(_0x455848,_0x5c00cf){_0x5c00cf=_0x5c00cf||0xcc;return function(_0x57e8ab){if(_0x57e8ab){return _0x455848[_0x9db4('0x16')](_0x5c00cf);}return _0x455848[_0x9db4('0x17')](_0x5c00cf)[_0x9db4('0x18')]();};}function respondWithResult(_0x23a4b8,_0x35e97c){_0x35e97c=_0x35e97c||0xc8;return function(_0x365b48){if(_0x365b48){return _0x23a4b8[_0x9db4('0x17')](_0x35e97c)[_0x9db4('0x19')](_0x365b48);}};}function respondWithFilteredResult(_0x107615,_0x32906f){return function(_0x51868b){if(_0x51868b){var _0x377b64=typeof _0x32906f[_0x9db4('0x1a')]===_0x9db4('0x1b')&&typeof _0x32906f[_0x9db4('0x1c')]===_0x9db4('0x1b');var _0x1f5a6c=_0x51868b[_0x9db4('0x1d')];var _0x3ea961=_0x377b64?0x0:_0x32906f[_0x9db4('0x1a')];var _0x5412f2=_0x377b64?_0x51868b[_0x9db4('0x1d')]:_0x32906f[_0x9db4('0x1a')]+_0x32906f['limit'];var _0x41e0db;if(_0x5412f2>=_0x1f5a6c){_0x5412f2=_0x1f5a6c;_0x41e0db=0xc8;}else{_0x41e0db=0xce;}_0x107615[_0x9db4('0x17')](_0x41e0db);return _0x107615['set']('Content-Range',_0x3ea961+'-'+_0x5412f2+'/'+_0x1f5a6c)['json'](_0x51868b);}return null;};}function patchUpdates(_0x31d9e2){return function(_0x125c1a){try{jsonpatch[_0x9db4('0x1e')](_0x125c1a,_0x31d9e2,!![]);}catch(_0x388cad){return BPromise['reject'](_0x388cad);}return _0x125c1a['save']();};}function saveUpdates(_0x530837,_0x3568cd){return function(_0x5db045){if(_0x5db045){return _0x5db045[_0x9db4('0x1f')](_0x530837)['then'](function(_0x5f163d){return _0x5f163d;});}return null;};}function removeEntity(_0x34e1cb,_0xdef10e){return function(_0x3113a7){if(_0x3113a7){return _0x3113a7[_0x9db4('0x20')]()[_0x9db4('0x21')](function(){_0x34e1cb['status'](0xcc)[_0x9db4('0x18')]();});}};}function handleEntityNotFound(_0x211e27,_0x426bf9){return function(_0x3f572c){if(!_0x3f572c){_0x211e27[_0x9db4('0x16')](0x194);}return _0x3f572c;};}function handleError(_0x5dba41,_0x30154f){_0x30154f=_0x30154f||0x1f4;return function(_0x161766){logger['error'](_0x161766['stack']);if(_0x161766[_0x9db4('0x22')]){delete _0x161766[_0x9db4('0x22')];}_0x5dba41[_0x9db4('0x17')](_0x30154f)[_0x9db4('0x23')](_0x161766);};}exports[_0x9db4('0x24')]=function(_0x3549af,_0x207e07){var _0x43ee34={},_0x567f0e={},_0x51f64d={'count':0x0,'rows':[]};var _0x23fe98=_[_0x9db4('0x25')](db[_0x9db4('0x26')][_0x9db4('0x27')],function(_0x40b152){return{'name':_0x40b152[_0x9db4('0x28')],'type':_0x40b152[_0x9db4('0x29')]['key']};});_0x567f0e[_0x9db4('0x2a')]=_[_0x9db4('0x25')](_0x23fe98,_0x9db4('0x22'));_0x567f0e['query']=_[_0x9db4('0x2b')](_0x3549af[_0x9db4('0x2c')]);_0x567f0e[_0x9db4('0x2d')]=_[_0x9db4('0x2e')](_0x567f0e[_0x9db4('0x2a')],_0x567f0e[_0x9db4('0x2c')]);_0x43ee34[_0x9db4('0x2f')]=_['intersection'](_0x567f0e[_0x9db4('0x2a')],qs[_0x9db4('0x30')](_0x3549af[_0x9db4('0x2c')][_0x9db4('0x30')]));_0x43ee34[_0x9db4('0x2f')]=_0x43ee34[_0x9db4('0x2f')][_0x9db4('0x31')]?_0x43ee34[_0x9db4('0x2f')]:_0x567f0e['model'];if(!_0x3549af['query'][_0x9db4('0x32')]('nolimit')){_0x43ee34[_0x9db4('0x1c')]=qs['limit'](_0x3549af['query']['limit']);_0x43ee34[_0x9db4('0x1a')]=qs['offset'](_0x3549af[_0x9db4('0x2c')][_0x9db4('0x1a')]);}_0x43ee34['order']=qs[_0x9db4('0x33')](_0x3549af[_0x9db4('0x2c')]['sort']);_0x43ee34[_0x9db4('0x34')]=qs['filters'](_[_0x9db4('0x35')](_0x3549af[_0x9db4('0x2c')],_0x567f0e[_0x9db4('0x2d')]),_0x23fe98);if(_0x3549af[_0x9db4('0x2c')][_0x9db4('0x36')]){_0x43ee34[_0x9db4('0x34')]=_[_0x9db4('0x37')](_0x43ee34['where'],{'$or':_['map'](_0x23fe98,function(_0x33b8c5){if(_0x33b8c5[_0x9db4('0x29')]!==_0x9db4('0x38')){var _0x5df4d1={};_0x5df4d1[_0x33b8c5['name']]={'$like':'%'+_0x3549af[_0x9db4('0x2c')][_0x9db4('0x36')]+'%'};return _0x5df4d1;}})});}_0x43ee34=_['merge']({},_0x43ee34,_0x3549af[_0x9db4('0x39')]);var _0x292b50={'where':_0x43ee34[_0x9db4('0x34')]};return db['FaxTransferReport'][_0x9db4('0x1d')](_0x292b50)[_0x9db4('0x21')](function(_0x1a53d1){_0x51f64d['count']=_0x1a53d1;if(_0x3549af[_0x9db4('0x2c')][_0x9db4('0x3a')]){_0x43ee34[_0x9db4('0x3b')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x9db4('0x3c')](_0x43ee34);})[_0x9db4('0x21')](function(_0x3e3158){_0x51f64d['rows']=_0x3e3158;return _0x51f64d;})[_0x9db4('0x21')](respondWithFilteredResult(_0x207e07,_0x43ee34))[_0x9db4('0x3d')](handleError(_0x207e07,null));};exports[_0x9db4('0x3e')]=function(_0x4d0432,_0x2ab434){var _0x564a90={'raw':!![],'where':{'id':_0x4d0432[_0x9db4('0x3f')]['id']}},_0x277c89={};_0x277c89['model']=_[_0x9db4('0x2b')](db[_0x9db4('0x26')][_0x9db4('0x27')]);_0x277c89[_0x9db4('0x2c')]=_[_0x9db4('0x2b')](_0x4d0432[_0x9db4('0x2c')]);_0x277c89[_0x9db4('0x2d')]=_['intersection'](_0x277c89[_0x9db4('0x2a')],_0x277c89[_0x9db4('0x2c')]);_0x564a90[_0x9db4('0x2f')]=_['intersection'](_0x277c89[_0x9db4('0x2a')],qs['fields'](_0x4d0432[_0x9db4('0x2c')]['fields']));_0x564a90['attributes']=_0x564a90[_0x9db4('0x2f')][_0x9db4('0x31')]?_0x564a90[_0x9db4('0x2f')]:_0x277c89['model'];if(_0x4d0432[_0x9db4('0x2c')]['includeAll']){_0x564a90[_0x9db4('0x3b')]=[{'all':!![]}];}_0x564a90=_[_0x9db4('0x37')]({},_0x564a90,_0x4d0432['options']);return db[_0x9db4('0x26')][_0x9db4('0x40')](_0x564a90)[_0x9db4('0x21')](handleEntityNotFound(_0x2ab434,null))[_0x9db4('0x21')](respondWithResult(_0x2ab434,null))[_0x9db4('0x3d')](handleError(_0x2ab434,null));};exports[_0x9db4('0x41')]=function(_0x890052,_0x1d033a){return db[_0x9db4('0x26')]['create'](_0x890052[_0x9db4('0x42')],{})[_0x9db4('0x21')](respondWithResult(_0x1d033a,0xc9))['catch'](handleError(_0x1d033a,null));};exports[_0x9db4('0x1f')]=function(_0x2b9a1e,_0x3ca59a){if(_0x2b9a1e[_0x9db4('0x42')]['id']){delete _0x2b9a1e[_0x9db4('0x42')]['id'];}return db[_0x9db4('0x26')][_0x9db4('0x40')]({'where':{'id':_0x2b9a1e[_0x9db4('0x3f')]['id']}})[_0x9db4('0x21')](handleEntityNotFound(_0x3ca59a,null))[_0x9db4('0x21')](saveUpdates(_0x2b9a1e[_0x9db4('0x42')],null))['then'](respondWithResult(_0x3ca59a,null))[_0x9db4('0x3d')](handleError(_0x3ca59a,null));};exports[_0x9db4('0x20')]=function(_0x5936bb,_0x23debe){return db[_0x9db4('0x26')][_0x9db4('0x40')]({'where':{'id':_0x5936bb[_0x9db4('0x3f')]['id']}})[_0x9db4('0x21')](handleEntityNotFound(_0x23debe,null))[_0x9db4('0x21')](removeEntity(_0x23debe,null))[_0x9db4('0x3d')](handleError(_0x23debe,null));};exports['describe']=function(_0x1c83e9,_0x305b14){return db[_0x9db4('0x26')][_0x9db4('0x43')]()[_0x9db4('0x21')](respondWithResult(_0x305b14,null))[_0x9db4('0x3d')](handleError(_0x305b14,null));}; \ No newline at end of file +var _0x236a=['show','params','find','create','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch'];(function(_0x4fb625,_0x2676f9){var _0x4fbf74=function(_0x79c300){while(--_0x79c300){_0x4fb625['push'](_0x4fb625['shift']());}};_0x4fbf74(++_0x2676f9);}(_0x236a,0x96));var _0xa236=function(_0x3bb8c3,_0x5153b7){_0x3bb8c3=_0x3bb8c3-0x0;var _0x4e0ba7=_0x236a[_0x3bb8c3];return _0x4e0ba7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa236('0x0'));var rp=require(_0xa236('0x1'));var moment=require(_0xa236('0x2'));var BPromise=require(_0xa236('0x3'));var Mustache=require(_0xa236('0x4'));var util=require(_0xa236('0x5'));var path=require(_0xa236('0x6'));var sox=require('sox');var csv=require(_0xa236('0x7'));var ejs=require(_0xa236('0x8'));var fs=require('fs');var fs_extra=require(_0xa236('0x9'));var _=require(_0xa236('0xa'));var squel=require(_0xa236('0xb'));var crypto=require('crypto');var jsforce=require(_0xa236('0xc'));var deskjs=require(_0xa236('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa236('0xe'));var Papa=require(_0xa236('0xf'));var Redis=require(_0xa236('0x10'));var authService=require(_0xa236('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa236('0x12'));var hardwareService=require(_0xa236('0x13'));var logger=require(_0xa236('0x14'))(_0xa236('0x15'));var utils=require('../../config/utils');var config=require(_0xa236('0x16'));var licenseUtil=require(_0xa236('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59f68f,_0x27b11e){_0x27b11e=_0x27b11e||0xcc;return function(_0x13acec){if(_0x13acec){return _0x59f68f[_0xa236('0x18')](_0x27b11e);}return _0x59f68f[_0xa236('0x19')](_0x27b11e)[_0xa236('0x1a')]();};}function respondWithResult(_0x1623f8,_0x7dd780){_0x7dd780=_0x7dd780||0xc8;return function(_0x3d38dc){if(_0x3d38dc){return _0x1623f8[_0xa236('0x19')](_0x7dd780)[_0xa236('0x1b')](_0x3d38dc);}};}function respondWithFilteredResult(_0x5cfe6f,_0x1e5370){return function(_0x1d5fbb){if(_0x1d5fbb){var _0x23c673=typeof _0x1e5370[_0xa236('0x1c')]===_0xa236('0x1d')&&typeof _0x1e5370[_0xa236('0x1e')]==='undefined';var _0x16d432=_0x1d5fbb['count'];var _0x307259=_0x23c673?0x0:_0x1e5370[_0xa236('0x1c')];var _0x54f694=_0x23c673?_0x1d5fbb[_0xa236('0x1f')]:_0x1e5370[_0xa236('0x1c')]+_0x1e5370['limit'];var _0x38fb77;if(_0x54f694>=_0x16d432){_0x54f694=_0x16d432;_0x38fb77=0xc8;}else{_0x38fb77=0xce;}_0x5cfe6f[_0xa236('0x19')](_0x38fb77);return _0x5cfe6f[_0xa236('0x20')]('Content-Range',_0x307259+'-'+_0x54f694+'/'+_0x16d432)[_0xa236('0x1b')](_0x1d5fbb);}return null;};}function patchUpdates(_0x54715b){return function(_0x413598){try{jsonpatch['apply'](_0x413598,_0x54715b,!![]);}catch(_0x12d3e3){return BPromise[_0xa236('0x21')](_0x12d3e3);}return _0x413598['save']();};}function saveUpdates(_0x33ebd0,_0x119051){return function(_0x50677c){if(_0x50677c){return _0x50677c[_0xa236('0x22')](_0x33ebd0)[_0xa236('0x23')](function(_0x40e790){return _0x40e790;});}return null;};}function removeEntity(_0xed3599,_0x1ea0b9){return function(_0x4c5460){if(_0x4c5460){return _0x4c5460[_0xa236('0x24')]()[_0xa236('0x23')](function(){_0xed3599[_0xa236('0x19')](0xcc)[_0xa236('0x1a')]();});}};}function handleEntityNotFound(_0x1b2285,_0x9c0d59){return function(_0x537b58){if(!_0x537b58){_0x1b2285['sendStatus'](0x194);}return _0x537b58;};}function handleError(_0x576485,_0x51f2f2){_0x51f2f2=_0x51f2f2||0x1f4;return function(_0x198f3b){logger[_0xa236('0x25')](_0x198f3b[_0xa236('0x26')]);if(_0x198f3b[_0xa236('0x27')]){delete _0x198f3b[_0xa236('0x27')];}_0x576485['status'](_0x51f2f2)[_0xa236('0x28')](_0x198f3b);};}exports[_0xa236('0x29')]=function(_0x1bf05f,_0x355de6){var _0x454639={},_0x501f95={},_0x44ff07={'count':0x0,'rows':[]};var _0x4eac4d=_[_0xa236('0x2a')](db[_0xa236('0x2b')]['rawAttributes'],function(_0x48393e){return{'name':_0x48393e[_0xa236('0x2c')],'type':_0x48393e[_0xa236('0x2d')][_0xa236('0x2e')]};});_0x501f95[_0xa236('0x2f')]=_['map'](_0x4eac4d,_0xa236('0x27'));_0x501f95[_0xa236('0x30')]=_['keys'](_0x1bf05f[_0xa236('0x30')]);_0x501f95[_0xa236('0x31')]=_[_0xa236('0x32')](_0x501f95[_0xa236('0x2f')],_0x501f95[_0xa236('0x30')]);_0x454639[_0xa236('0x33')]=_['intersection'](_0x501f95[_0xa236('0x2f')],qs[_0xa236('0x34')](_0x1bf05f[_0xa236('0x30')][_0xa236('0x34')]));_0x454639[_0xa236('0x33')]=_0x454639[_0xa236('0x33')][_0xa236('0x35')]?_0x454639['attributes']:_0x501f95[_0xa236('0x2f')];if(!_0x1bf05f['query'][_0xa236('0x36')](_0xa236('0x37'))){_0x454639[_0xa236('0x1e')]=qs[_0xa236('0x1e')](_0x1bf05f[_0xa236('0x30')]['limit']);_0x454639[_0xa236('0x1c')]=qs[_0xa236('0x1c')](_0x1bf05f[_0xa236('0x30')][_0xa236('0x1c')]);}_0x454639[_0xa236('0x38')]=qs[_0xa236('0x39')](_0x1bf05f[_0xa236('0x30')]['sort']);_0x454639[_0xa236('0x3a')]=qs[_0xa236('0x31')](_['pick'](_0x1bf05f[_0xa236('0x30')],_0x501f95['filters']),_0x4eac4d);if(_0x1bf05f['query'][_0xa236('0x3b')]){_0x454639[_0xa236('0x3a')]=_[_0xa236('0x3c')](_0x454639[_0xa236('0x3a')],{'$or':_[_0xa236('0x2a')](_0x4eac4d,function(_0x28f015){if(_0x28f015['type']!==_0xa236('0x3d')){var _0x144f1f={};_0x144f1f[_0x28f015[_0xa236('0x27')]]={'$like':'%'+_0x1bf05f[_0xa236('0x30')][_0xa236('0x3b')]+'%'};return _0x144f1f;}})});}_0x454639=_[_0xa236('0x3c')]({},_0x454639,_0x1bf05f[_0xa236('0x3e')]);var _0x5e4770={'where':_0x454639[_0xa236('0x3a')]};return db[_0xa236('0x2b')][_0xa236('0x1f')](_0x5e4770)[_0xa236('0x23')](function(_0x5941d3){_0x44ff07['count']=_0x5941d3;if(_0x1bf05f[_0xa236('0x30')]['includeAll']){_0x454639[_0xa236('0x3f')]=[{'all':!![]}];}return db[_0xa236('0x2b')]['findAll'](_0x454639);})[_0xa236('0x23')](function(_0xb2dc5b){_0x44ff07[_0xa236('0x40')]=_0xb2dc5b;return _0x44ff07;})[_0xa236('0x23')](respondWithFilteredResult(_0x355de6,_0x454639))[_0xa236('0x41')](handleError(_0x355de6,null));};exports[_0xa236('0x42')]=function(_0x1b49cb,_0x1b0eaf){var _0x4e4f4f={'raw':!![],'where':{'id':_0x1b49cb[_0xa236('0x43')]['id']}},_0x4a851c={};_0x4a851c[_0xa236('0x2f')]=_['keys'](db[_0xa236('0x2b')]['rawAttributes']);_0x4a851c[_0xa236('0x30')]=_['keys'](_0x1b49cb[_0xa236('0x30')]);_0x4a851c[_0xa236('0x31')]=_[_0xa236('0x32')](_0x4a851c['model'],_0x4a851c[_0xa236('0x30')]);_0x4e4f4f['attributes']=_['intersection'](_0x4a851c[_0xa236('0x2f')],qs['fields'](_0x1b49cb[_0xa236('0x30')][_0xa236('0x34')]));_0x4e4f4f[_0xa236('0x33')]=_0x4e4f4f[_0xa236('0x33')][_0xa236('0x35')]?_0x4e4f4f[_0xa236('0x33')]:_0x4a851c['model'];if(_0x1b49cb[_0xa236('0x30')]['includeAll']){_0x4e4f4f[_0xa236('0x3f')]=[{'all':!![]}];}_0x4e4f4f=_['merge']({},_0x4e4f4f,_0x1b49cb['options']);return db[_0xa236('0x2b')][_0xa236('0x44')](_0x4e4f4f)[_0xa236('0x23')](handleEntityNotFound(_0x1b0eaf,null))['then'](respondWithResult(_0x1b0eaf,null))[_0xa236('0x41')](handleError(_0x1b0eaf,null));};exports[_0xa236('0x45')]=function(_0x4a2161,_0x1b5da5){return db[_0xa236('0x2b')][_0xa236('0x45')](_0x4a2161['body'],{})[_0xa236('0x23')](respondWithResult(_0x1b5da5,0xc9))[_0xa236('0x41')](handleError(_0x1b5da5,null));};exports[_0xa236('0x22')]=function(_0x3cee8b,_0x11adcb){if(_0x3cee8b[_0xa236('0x46')]['id']){delete _0x3cee8b[_0xa236('0x46')]['id'];}return db[_0xa236('0x2b')][_0xa236('0x44')]({'where':{'id':_0x3cee8b[_0xa236('0x43')]['id']}})[_0xa236('0x23')](handleEntityNotFound(_0x11adcb,null))['then'](saveUpdates(_0x3cee8b[_0xa236('0x46')],null))[_0xa236('0x23')](respondWithResult(_0x11adcb,null))['catch'](handleError(_0x11adcb,null));};exports[_0xa236('0x24')]=function(_0x21026a,_0x202963){return db[_0xa236('0x2b')][_0xa236('0x44')]({'where':{'id':_0x21026a[_0xa236('0x43')]['id']}})[_0xa236('0x23')](handleEntityNotFound(_0x202963,null))[_0xa236('0x23')](removeEntity(_0x202963,null))[_0xa236('0x41')](handleError(_0x202963,null));};exports[_0xa236('0x47')]=function(_0x358724,_0x1533b5){return db[_0xa236('0x2b')][_0xa236('0x47')]()['then'](respondWithResult(_0x1533b5,null))['catch'](handleError(_0x1533b5,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 13397c2..5f153a8 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 _0xcf37=['./faxTransferReport.attributes','exports','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf37,0xdc));var _0x7cf3=function(_0x563806,_0x50508c){_0x563806=_0x563806-0x0;var _0x3e7666=_0xcf37[_0x563806];return _0x3e7666;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var logger=require(_0x7cf3('0x1'))(_0x7cf3('0x2'));var moment=require(_0x7cf3('0x3'));var BPromise=require(_0x7cf3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cf3('0x5'));var rimraf=require(_0x7cf3('0x6'));var config=require(_0x7cf3('0x7'));var attributes=require(_0x7cf3('0x8'));module[_0x7cf3('0x9')]=function(_0x48c7cf,_0x488938){return _0x48c7cf['define']('FaxTransferReport',attributes,{'tableName':_0x7cf3('0xa'),'paranoid':![],'indexes':[{'name':_0x7cf3('0xb'),'fields':[_0x7cf3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b35=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x5acb6d,_0x5b40d7){var _0x14c5a6=function(_0x1df497){while(--_0x1df497){_0x5acb6d['push'](_0x5acb6d['shift']());}};_0x14c5a6(++_0x5b40d7);}(_0x6b35,0x6e));var _0x56b3=function(_0x5ef114,_0x2346f5){_0x5ef114=_0x5ef114-0x0;var _0x3f29a0=_0x6b35[_0x5ef114];return _0x3f29a0;};'use strict';var _=require('lodash');var util=require(_0x56b3('0x0'));var logger=require(_0x56b3('0x1'))(_0x56b3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x56b3('0x3'));var fs=require('fs');var path=require(_0x56b3('0x4'));var rimraf=require(_0x56b3('0x5'));var config=require(_0x56b3('0x6'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x49c8ca,_0x5dc45b){return _0x49c8ca[_0x56b3('0x7')](_0x56b3('0x8'),attributes,{'tableName':_0x56b3('0x9'),'paranoid':![],'indexes':[{'name':_0x56b3('0xa'),'fields':[_0x56b3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5f1ae84..c073d02 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 _0xf417=['info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4fc8f1,_0x20799d){var _0x445f16=function(_0x59b869){while(--_0x59b869){_0x4fc8f1['push'](_0x4fc8f1['shift']());}};_0x445f16(++_0x20799d);}(_0xf417,0xba));var _0x7f41=function(_0x32f235,_0x4a7643){_0x32f235=_0x32f235-0x0;var _0x31ca4f=_0xf417[_0x32f235];return _0x31ca4f;};'use strict';var _=require(_0x7f41('0x0'));var util=require(_0x7f41('0x1'));var moment=require('moment');var BPromise=require(_0x7f41('0x2'));var rs=require(_0x7f41('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f41('0x4'))['db'];var utils=require(_0x7f41('0x5'));var logger=require('../../config/logger')(_0x7f41('0x6'));var config=require(_0x7f41('0x7'));var jayson=require(_0x7f41('0x8'));var client=jayson[_0x7f41('0x9')][_0x7f41('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34fc27,_0x34680e,_0x321213){return new BPromise(function(_0x26afe0,_0x117e85){return client[_0x7f41('0xb')](_0x34fc27,_0x321213)['then'](function(_0xf57ef3){logger[_0x7f41('0xc')](_0x7f41('0xd'),_0x34680e,'request\x20sent');logger[_0x7f41('0xe')](_0x7f41('0xf'),_0x34680e,'request\x20sent',JSON[_0x7f41('0x10')](_0xf57ef3));if(_0xf57ef3[_0x7f41('0x11')]){if(_0xf57ef3[_0x7f41('0x11')][_0x7f41('0x12')]===0x1f4){logger[_0x7f41('0x11')](_0x7f41('0xd'),_0x34680e,_0xf57ef3['error'][_0x7f41('0x13')]);return _0x117e85(_0xf57ef3[_0x7f41('0x11')][_0x7f41('0x13')]);}logger['error'](_0x7f41('0xd'),_0x34680e,_0xf57ef3[_0x7f41('0x11')][_0x7f41('0x13')]);return _0x26afe0(_0xf57ef3[_0x7f41('0x11')][_0x7f41('0x13')]);}else{logger['info'](_0x7f41('0xd'),_0x34680e,'request\x20sent');_0x26afe0(_0xf57ef3[_0x7f41('0x14')]['message']);}})[_0x7f41('0x15')](function(_0x3f9524){logger[_0x7f41('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x34680e,_0x3f9524);_0x117e85(_0x3f9524);});});} \ No newline at end of file +var _0x424b=['jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x424b,0x1f1));var _0xb424=function(_0x3f6fe6,_0x52243c){_0x3f6fe6=_0x3f6fe6-0x0;var _0xebbe7f=_0x424b[_0x3f6fe6];return _0xebbe7f;};'use strict';var _=require(_0xb424('0x0'));var util=require(_0xb424('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb424('0x2'));var fs=require('fs');var Redis=require(_0xb424('0x3'));var db=require(_0xb424('0x4'))['db'];var utils=require(_0xb424('0x5'));var logger=require(_0xb424('0x6'))(_0xb424('0x7'));var config=require(_0xb424('0x8'));var jayson=require(_0xb424('0x9'));var client=jayson['client'][_0xb424('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bd398,_0xaabd01,_0x32607c){return new BPromise(function(_0x9cd273,_0x35112f){return client[_0xb424('0xb')](_0x3bd398,_0x32607c)[_0xb424('0xc')](function(_0x4923fb){logger[_0xb424('0xd')](_0xb424('0xe'),_0xaabd01,_0xb424('0xf'));logger[_0xb424('0x10')](_0xb424('0x11'),_0xaabd01,_0xb424('0xf'),JSON[_0xb424('0x12')](_0x4923fb));if(_0x4923fb[_0xb424('0x13')]){if(_0x4923fb['error'][_0xb424('0x14')]===0x1f4){logger[_0xb424('0x13')](_0xb424('0xe'),_0xaabd01,_0x4923fb[_0xb424('0x13')]['message']);return _0x35112f(_0x4923fb[_0xb424('0x13')]['message']);}logger[_0xb424('0x13')](_0xb424('0xe'),_0xaabd01,_0x4923fb['error'][_0xb424('0x15')]);return _0x9cd273(_0x4923fb[_0xb424('0x13')][_0xb424('0x15')]);}else{logger[_0xb424('0xd')](_0xb424('0xe'),_0xaabd01,_0xb424('0xf'));_0x9cd273(_0x4923fb['result'][_0xb424('0x15')]);}})[_0xb424('0x16')](function(_0x3073e6){logger[_0xb424('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0xaabd01,_0x3073e6);_0x35112f(_0x3073e6);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a1a9b28..2ea8b5e 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 _0x51c1=['create','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x51c1,0x79));var _0x151c=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x51c1[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x151c('0x0'));var util=require('util');var path=require(_0x151c('0x1'));var timeout=require(_0x151c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x151c('0x3'));var auth=require(_0x151c('0x4'));var interaction=require(_0x151c('0x5'));var config=require(_0x151c('0x6'));var controller=require(_0x151c('0x7'));router[_0x151c('0x8')]('/',auth[_0x151c('0x9')](),controller[_0x151c('0xa')]);router[_0x151c('0x8')](_0x151c('0xb'),auth[_0x151c('0x9')](),controller['describe']);router[_0x151c('0x8')](_0x151c('0xc'),auth[_0x151c('0x9')](),controller['show']);router[_0x151c('0xd')]('/',auth[_0x151c('0x9')](),controller[_0x151c('0xe')]);router['put'](_0x151c('0xc'),auth[_0x151c('0x9')](),controller['update']);router['delete'](_0x151c('0xc'),auth[_0x151c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb649=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x33f1f1,_0x3f2a10){var _0x3052d4=function(_0x2d62ad){while(--_0x2d62ad){_0x33f1f1['push'](_0x33f1f1['shift']());}};_0x3052d4(++_0x3f2a10);}(_0xb649,0x17f));var _0x9b64=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0xb649[_0x4b12ae];return _0x16957b;};'use strict';var multer=require(_0x9b64('0x0'));var util=require(_0x9b64('0x1'));var path=require(_0x9b64('0x2'));var timeout=require(_0x9b64('0x3'));var express=require(_0x9b64('0x4'));var router=express[_0x9b64('0x5')]();var fs_extra=require(_0x9b64('0x6'));var auth=require(_0x9b64('0x7'));var interaction=require(_0x9b64('0x8'));var config=require(_0x9b64('0x9'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x9b64('0xa')](),controller[_0x9b64('0xb')]);router[_0x9b64('0xc')](_0x9b64('0xd'),auth[_0x9b64('0xa')](),controller[_0x9b64('0xe')]);router[_0x9b64('0xc')](_0x9b64('0xf'),auth[_0x9b64('0xa')](),controller[_0x9b64('0x10')]);router[_0x9b64('0x11')]('/',auth[_0x9b64('0xa')](),controller[_0x9b64('0x12')]);router[_0x9b64('0x13')]('/:id',auth[_0x9b64('0xa')](),controller[_0x9b64('0x14')]);router[_0x9b64('0x15')](_0x9b64('0xf'),auth[_0x9b64('0xa')](),controller['destroy']);module[_0x9b64('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3d7611b..bc1b04d 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 _0x899e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','put','update','delete','destroy','exports','util','path','express'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x899e,0xe4));var _0xe899=function(_0x582c7,_0x53fcc7){_0x582c7=_0x582c7-0x0;var _0xc22542=_0x899e[_0x582c7];return _0xc22542;};'use strict';var multer=require('multer');var util=require(_0xe899('0x0'));var path=require(_0xe899('0x1'));var timeout=require('connect-timeout');var express=require(_0xe899('0x2'));var router=express[_0xe899('0x3')]();var fs_extra=require(_0xe899('0x4'));var auth=require(_0xe899('0x5'));var interaction=require(_0xe899('0x6'));var config=require('../../config/environment');var controller=require(_0xe899('0x7'));router[_0xe899('0x8')]('/',auth['isAuthenticated'](),controller[_0xe899('0x9')]);router[_0xe899('0x8')](_0xe899('0xa'),auth[_0xe899('0xb')](),controller['show']);router['get'](_0xe899('0xc'),auth['isAuthenticated'](),controller[_0xe899('0xd')]);router['get'](_0xe899('0xe'),auth[_0xe899('0xb')](),controller['getFields']);router[_0xe899('0xf')]('/',auth[_0xe899('0xb')](),controller['create']);router[_0xe899('0xf')](_0xe899('0xc'),auth[_0xe899('0xb')](),controller['addConfiguration']);router[_0xe899('0x10')]('/:id',auth[_0xe899('0xb')](),controller[_0xe899('0x11')]);router[_0xe899('0x12')](_0xe899('0xa'),auth[_0xe899('0xb')](),controller[_0xe899('0x13')]);module[_0xe899('0x14')]=router; \ No newline at end of file +var _0x92cc=['addConfiguration','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','getFields','post'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x92cc,0x17f));var _0xc92c=function(_0x452a3e,_0x1d6cc4){_0x452a3e=_0x452a3e-0x0;var _0x5bce1b=_0x92cc[_0x452a3e];return _0x5bce1b;};'use strict';var multer=require(_0xc92c('0x0'));var util=require(_0xc92c('0x1'));var path=require(_0xc92c('0x2'));var timeout=require(_0xc92c('0x3'));var express=require(_0xc92c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc92c('0x5'));var interaction=require(_0xc92c('0x6'));var config=require(_0xc92c('0x7'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0xc92c('0x8')](),controller[_0xc92c('0x9')]);router[_0xc92c('0xa')](_0xc92c('0xb'),auth[_0xc92c('0x8')](),controller['show']);router[_0xc92c('0xa')](_0xc92c('0xc'),auth[_0xc92c('0x8')](),controller[_0xc92c('0xd')]);router[_0xc92c('0xa')]('/:id/fields',auth[_0xc92c('0x8')](),controller[_0xc92c('0xe')]);router[_0xc92c('0xf')]('/',auth[_0xc92c('0x8')](),controller['create']);router[_0xc92c('0xf')](_0xc92c('0xc'),auth[_0xc92c('0x8')](),controller[_0xc92c('0x10')]);router['put'](_0xc92c('0xb'),auth[_0xc92c('0x8')](),controller[_0xc92c('0x11')]);router[_0xc92c('0x12')]('/:id',auth[_0xc92c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 5884c33..a97290a 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 _0x6303=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x45b1c9,_0x13af38){var _0x5635b5=function(_0x512998){while(--_0x512998){_0x45b1c9['push'](_0x45b1c9['shift']());}};_0x5635b5(++_0x13af38);}(_0x6303,0x1c8));var _0x3630=function(_0x16b8dc,_0x129a38){_0x16b8dc=_0x16b8dc-0x0;var _0x345a46=_0x6303[_0x16b8dc];return _0x345a46;};'use strict';var Sequelize=require('sequelize');module[_0x3630('0x0')]={'name':{'type':Sequelize[_0x3630('0x1')]},'description':{'type':Sequelize[_0x3630('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x3630('0x2')](_0x3630('0x3')),'defaultValue':_0x3630('0x3')},'password':{'type':Sequelize[_0x3630('0x1')]},'consumerKey':{'type':Sequelize[_0x3630('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x3630('0x1')]},'serverUrl':{'type':Sequelize[_0x3630('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3630('0x2')](_0x3630('0x4'),_0x3630('0x5')),'defaultValue':_0x3630('0x4')}}; \ No newline at end of file +var _0x7c0f=['newTab','sequelize','STRING','basic','ENUM','integrationTab'];(function(_0x5d6bae,_0x1624a6){var _0x11eddf=function(_0x148eb9){while(--_0x148eb9){_0x5d6bae['push'](_0x5d6bae['shift']());}};_0x11eddf(++_0x1624a6);}(_0x7c0f,0x67));var _0xf7c0=function(_0x1f5916,_0x142d3c){_0x1f5916=_0x1f5916-0x0;var _0x4a3799=_0x7c0f[_0x1f5916];return _0x4a3799;};'use strict';var Sequelize=require(_0xf7c0('0x0'));module['exports']={'name':{'type':Sequelize[_0xf7c0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf7c0('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0xf7c0('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xf7c0('0x1')]},'consumerSecret':{'type':Sequelize[_0xf7c0('0x1')]},'token':{'type':Sequelize[_0xf7c0('0x1')]},'tokenSecret':{'type':Sequelize[_0xf7c0('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf7c0('0x3')](_0xf7c0('0x4'),_0xf7c0('0x5')),'defaultValue':_0xf7c0('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b1f6610..70e90bf 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 _0x0a32=['lastIndexOf','GET','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','format','%s:%s','password','toString','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','DeskAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','rows','show','rawAttributes','include','find','catch','create','body','params','getConfigurations','findOne','DeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','substring'];(function(_0x2c9ff6,_0x24ce62){var _0x79dad4=function(_0xe619a6){while(--_0xe619a6){_0x2c9ff6['push'](_0x2c9ff6['shift']());}};_0x79dad4(++_0x24ce62);}(_0x0a32,0x109));var _0x20a3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0a32[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x20a3('0x0'));var rimraf=require(_0x20a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20a3('0x2'));var rp=require(_0x20a3('0x3'));var moment=require('moment');var BPromise=require(_0x20a3('0x4'));var Mustache=require(_0x20a3('0x5'));var util=require('util');var path=require(_0x20a3('0x6'));var sox=require(_0x20a3('0x7'));var csv=require('to-csv');var ejs=require(_0x20a3('0x8'));var fs=require('fs');var fs_extra=require(_0x20a3('0x9'));var _=require(_0x20a3('0xa'));var squel=require(_0x20a3('0xb'));var crypto=require(_0x20a3('0xc'));var jsforce=require(_0x20a3('0xd'));var deskjs=require(_0x20a3('0xe'));var toCsv=require(_0x20a3('0xf'));var querystring=require(_0x20a3('0x10'));var Papa=require(_0x20a3('0x11'));var Redis=require(_0x20a3('0x12'));var authService=require(_0x20a3('0x13'));var qs=require(_0x20a3('0x14'));var as=require(_0x20a3('0x15'));var hardwareService=require(_0x20a3('0x16'));var logger=require(_0x20a3('0x17'))(_0x20a3('0x18'));var utils=require(_0x20a3('0x19'));var config=require(_0x20a3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x20a3('0x1b'));function respondWithStatusCode(_0x116d20,_0x3e842b){_0x3e842b=_0x3e842b||0xcc;return function(_0x4d4829){if(_0x4d4829){return _0x116d20[_0x20a3('0x1c')](_0x3e842b);}return _0x116d20['status'](_0x3e842b)[_0x20a3('0x1d')]();};}function respondWithResult(_0x3fda3d,_0x6b828b){_0x6b828b=_0x6b828b||0xc8;return function(_0x51906e){if(_0x51906e){return _0x3fda3d[_0x20a3('0x1e')](_0x6b828b)[_0x20a3('0x1f')](_0x51906e);}};}function respondWithFilteredResult(_0x363896,_0x165f99){return function(_0x54a212){if(_0x54a212){var _0x45260b=typeof _0x165f99[_0x20a3('0x20')]===_0x20a3('0x21')&&typeof _0x165f99[_0x20a3('0x22')]===_0x20a3('0x21');var _0x5de9d7=_0x54a212['count'];var _0x4e3229=_0x45260b?0x0:_0x165f99[_0x20a3('0x20')];var _0x516a8f=_0x45260b?_0x54a212[_0x20a3('0x23')]:_0x165f99[_0x20a3('0x20')]+_0x165f99['limit'];var _0x45a5e2;if(_0x516a8f>=_0x5de9d7){_0x516a8f=_0x5de9d7;_0x45a5e2=0xc8;}else{_0x45a5e2=0xce;}_0x363896[_0x20a3('0x1e')](_0x45a5e2);return _0x363896[_0x20a3('0x24')](_0x20a3('0x25'),_0x4e3229+'-'+_0x516a8f+'/'+_0x5de9d7)[_0x20a3('0x1f')](_0x54a212);}return null;};}function patchUpdates(_0xcb7071){return function(_0x1f03e3){try{jsonpatch['apply'](_0x1f03e3,_0xcb7071,!![]);}catch(_0x473961){return BPromise[_0x20a3('0x26')](_0x473961);}return _0x1f03e3[_0x20a3('0x27')]();};}function saveUpdates(_0x2d6e15,_0x3abc9d){return function(_0x26df57){if(_0x26df57){return _0x26df57[_0x20a3('0x28')](_0x2d6e15)[_0x20a3('0x29')](function(_0xab1cd7){return _0xab1cd7;});}return null;};}function removeEntity(_0x125170,_0x35246d){return function(_0x32f3c8){if(_0x32f3c8){return _0x32f3c8[_0x20a3('0x2a')]()[_0x20a3('0x29')](function(){_0x125170['status'](0xcc)[_0x20a3('0x1d')]();});}};}function handleEntityNotFound(_0x3e8078,_0x173a63){return function(_0x5b72e9){if(!_0x5b72e9){_0x3e8078[_0x20a3('0x1c')](0x194);}return _0x5b72e9;};}function handleError(_0x22c802,_0xaa255d){_0xaa255d=_0xaa255d||0x1f4;return function(_0x52b049){logger['error'](_0x52b049[_0x20a3('0x2b')]);if(_0x52b049[_0x20a3('0x2c')]){delete _0x52b049[_0x20a3('0x2c')];}_0x22c802['status'](_0xaa255d)[_0x20a3('0x2d')](_0x52b049);};}exports[_0x20a3('0x2e')]=function(_0x8f5e0e,_0xc53316){var _0x1cfa70={},_0x1deb5d={},_0x2de83f={'count':0x0,'rows':[]};var _0x100907=_[_0x20a3('0x2f')](db[_0x20a3('0x30')]['rawAttributes'],function(_0x13bd6f){return{'name':_0x13bd6f[_0x20a3('0x31')],'type':_0x13bd6f[_0x20a3('0x32')][_0x20a3('0x33')]};});_0x1deb5d['model']=_['map'](_0x100907,_0x20a3('0x2c'));_0x1deb5d[_0x20a3('0x34')]=_[_0x20a3('0x35')](_0x8f5e0e[_0x20a3('0x34')]);_0x1deb5d[_0x20a3('0x36')]=_[_0x20a3('0x37')](_0x1deb5d[_0x20a3('0x38')],_0x1deb5d[_0x20a3('0x34')]);_0x1cfa70[_0x20a3('0x39')]=_[_0x20a3('0x37')](_0x1deb5d[_0x20a3('0x38')],qs[_0x20a3('0x3a')](_0x8f5e0e['query']['fields']));_0x1cfa70[_0x20a3('0x39')]=_0x1cfa70[_0x20a3('0x39')][_0x20a3('0x3b')]?_0x1cfa70['attributes']:_0x1deb5d['model'];if(!_0x8f5e0e['query'][_0x20a3('0x3c')](_0x20a3('0x3d'))){_0x1cfa70['limit']=qs[_0x20a3('0x22')](_0x8f5e0e['query'][_0x20a3('0x22')]);_0x1cfa70[_0x20a3('0x20')]=qs[_0x20a3('0x20')](_0x8f5e0e[_0x20a3('0x34')]['offset']);}_0x1cfa70[_0x20a3('0x3e')]=qs[_0x20a3('0x3f')](_0x8f5e0e['query'][_0x20a3('0x3f')]);_0x1cfa70[_0x20a3('0x40')]=qs['filters'](_['pick'](_0x8f5e0e[_0x20a3('0x34')],_0x1deb5d['filters']),_0x100907);if(_0x8f5e0e[_0x20a3('0x34')]['filter']){_0x1cfa70[_0x20a3('0x40')]=_[_0x20a3('0x41')](_0x1cfa70[_0x20a3('0x40')],{'$or':_[_0x20a3('0x2f')](_0x100907,function(_0x3b9d95){if(_0x3b9d95['type']!=='VIRTUAL'){var _0x46ee53={};_0x46ee53[_0x3b9d95[_0x20a3('0x2c')]]={'$like':'%'+_0x8f5e0e[_0x20a3('0x34')][_0x20a3('0x42')]+'%'};return _0x46ee53;}})});}_0x1cfa70=_[_0x20a3('0x41')]({},_0x1cfa70,_0x8f5e0e[_0x20a3('0x43')]);var _0x52009e={'where':_0x1cfa70[_0x20a3('0x40')]};return db[_0x20a3('0x30')]['count'](_0x52009e)[_0x20a3('0x29')](function(_0x3dca03){_0x2de83f[_0x20a3('0x23')]=_0x3dca03;if(_0x8f5e0e[_0x20a3('0x34')][_0x20a3('0x44')]){_0x1cfa70['include']=[{'all':!![]}];}return db[_0x20a3('0x30')]['findAll'](_0x1cfa70);})[_0x20a3('0x29')](function(_0x1265ec){_0x2de83f[_0x20a3('0x45')]=_0x1265ec;return _0x2de83f;})[_0x20a3('0x29')](respondWithFilteredResult(_0xc53316,_0x1cfa70))['catch'](handleError(_0xc53316,null));};exports[_0x20a3('0x46')]=function(_0x542420,_0xa20bbd){var _0x1fe8f1={'raw':![],'where':{'id':_0x542420['params']['id']}},_0x424c83={};_0x424c83[_0x20a3('0x38')]=_[_0x20a3('0x35')](db[_0x20a3('0x30')][_0x20a3('0x47')]);_0x424c83[_0x20a3('0x34')]=_['keys'](_0x542420[_0x20a3('0x34')]);_0x424c83[_0x20a3('0x36')]=_[_0x20a3('0x37')](_0x424c83['model'],_0x424c83[_0x20a3('0x34')]);_0x1fe8f1[_0x20a3('0x39')]=_[_0x20a3('0x37')](_0x424c83[_0x20a3('0x38')],qs['fields'](_0x542420['query'][_0x20a3('0x3a')]));_0x1fe8f1[_0x20a3('0x39')]=_0x1fe8f1[_0x20a3('0x39')]['length']?_0x1fe8f1[_0x20a3('0x39')]:_0x424c83['model'];if(_0x542420[_0x20a3('0x34')][_0x20a3('0x44')]){_0x1fe8f1[_0x20a3('0x48')]=[{'all':!![]}];}_0x1fe8f1=_['merge']({},_0x1fe8f1,_0x542420[_0x20a3('0x43')]);return db[_0x20a3('0x30')][_0x20a3('0x49')](_0x1fe8f1)[_0x20a3('0x29')](handleEntityNotFound(_0xa20bbd,null))[_0x20a3('0x29')](respondWithResult(_0xa20bbd,null))[_0x20a3('0x4a')](handleError(_0xa20bbd,null));};exports[_0x20a3('0x4b')]=function(_0x3dcd50,_0x1c94b8){return db['DeskAccount'][_0x20a3('0x4b')](_0x3dcd50[_0x20a3('0x4c')],{})[_0x20a3('0x29')](respondWithResult(_0x1c94b8,0xc9))[_0x20a3('0x4a')](handleError(_0x1c94b8,null));};exports['update']=function(_0x13e1fb,_0x495084){if(_0x13e1fb[_0x20a3('0x4c')]['id']){delete _0x13e1fb[_0x20a3('0x4c')]['id'];}return db[_0x20a3('0x30')][_0x20a3('0x49')]({'where':{'id':_0x13e1fb[_0x20a3('0x4d')]['id']}})[_0x20a3('0x29')](handleEntityNotFound(_0x495084,null))[_0x20a3('0x29')](saveUpdates(_0x13e1fb[_0x20a3('0x4c')],null))['then'](respondWithResult(_0x495084,null))['catch'](handleError(_0x495084,null));};exports[_0x20a3('0x2a')]=function(_0x4714e0,_0x2c2d02){return db[_0x20a3('0x30')][_0x20a3('0x49')]({'where':{'id':_0x4714e0['params']['id']}})[_0x20a3('0x29')](handleEntityNotFound(_0x2c2d02,null))[_0x20a3('0x29')](removeEntity(_0x2c2d02,null))['catch'](handleError(_0x2c2d02,null));};exports[_0x20a3('0x4e')]=function(_0x14157c,_0x44b8c6,_0x189618){var _0x5e75fb={};var _0x62c6dc={};var _0x11d2c9;var _0x3b6713;return db[_0x20a3('0x30')][_0x20a3('0x4f')]({'where':{'id':_0x14157c[_0x20a3('0x4d')]['id']}})[_0x20a3('0x29')](handleEntityNotFound(_0x44b8c6,null))[_0x20a3('0x29')](function(_0x4c5cbb){if(_0x4c5cbb){_0x11d2c9=_0x4c5cbb;_0x62c6dc[_0x20a3('0x38')]=_[_0x20a3('0x35')](db[_0x20a3('0x50')]['rawAttributes']);_0x62c6dc['query']=_['keys'](_0x14157c[_0x20a3('0x34')]);_0x62c6dc[_0x20a3('0x36')]=_[_0x20a3('0x37')](_0x62c6dc['model'],_0x62c6dc['query']);_0x5e75fb[_0x20a3('0x39')]=_[_0x20a3('0x37')](_0x62c6dc[_0x20a3('0x38')],qs[_0x20a3('0x3a')](_0x14157c[_0x20a3('0x34')][_0x20a3('0x3a')]));_0x5e75fb[_0x20a3('0x39')]=_0x5e75fb['attributes'][_0x20a3('0x3b')]?_0x5e75fb[_0x20a3('0x39')]:_0x62c6dc[_0x20a3('0x38')];_0x5e75fb[_0x20a3('0x3e')]=qs[_0x20a3('0x3f')](_0x14157c[_0x20a3('0x34')][_0x20a3('0x3f')]);_0x5e75fb[_0x20a3('0x40')]=qs[_0x20a3('0x36')](_[_0x20a3('0x51')](_0x14157c[_0x20a3('0x34')],_0x62c6dc['filters']));if(_0x14157c[_0x20a3('0x34')][_0x20a3('0x42')]){_0x5e75fb[_0x20a3('0x40')]=_[_0x20a3('0x41')](_0x5e75fb[_0x20a3('0x40')],{'$or':_[_0x20a3('0x2f')](_0x5e75fb[_0x20a3('0x39')],function(_0x4bba9f){var _0x577e88={};_0x577e88[_0x4bba9f]={'$like':'%'+_0x14157c[_0x20a3('0x34')]['filter']+'%'};return _0x577e88;})});}_0x5e75fb=_[_0x20a3('0x41')]({},_0x5e75fb,_0x14157c['options']);return _0x11d2c9[_0x20a3('0x4e')](_0x5e75fb);}})[_0x20a3('0x29')](function(_0x36db8d){if(_0x36db8d){_0x3b6713=_0x36db8d[_0x20a3('0x3b')];if(!_0x14157c[_0x20a3('0x34')][_0x20a3('0x3c')](_0x20a3('0x3d'))){_0x5e75fb[_0x20a3('0x22')]=qs[_0x20a3('0x22')](_0x14157c[_0x20a3('0x34')][_0x20a3('0x22')]);_0x5e75fb[_0x20a3('0x20')]=qs['offset'](_0x14157c[_0x20a3('0x34')][_0x20a3('0x20')]);}return _0x11d2c9['getConfigurations'](_0x5e75fb);}})[_0x20a3('0x29')](function(_0x45b425){if(_0x45b425){return _0x45b425?{'count':_0x3b6713,'rows':_0x45b425}:null;}})[_0x20a3('0x29')](respondWithResult(_0x44b8c6,null))[_0x20a3('0x4a')](handleError(_0x44b8c6,null));};exports[_0x20a3('0x52')]=function(_0x1144ef,_0x1d5aab,_0x46f0d6){if(_0x1144ef[_0x20a3('0x4c')]['id']){delete _0x1144ef[_0x20a3('0x4c')]['id'];}return db[_0x20a3('0x30')][_0x20a3('0x4f')]({'where':{'id':_0x1144ef[_0x20a3('0x4d')]['id']}})[_0x20a3('0x29')](handleEntityNotFound(_0x1d5aab,null))[_0x20a3('0x29')](function(_0x1c8358){if(_0x1c8358){_0x1144ef[_0x20a3('0x4c')][_0x20a3('0x53')]=_0x1c8358['id'];_0x1144ef[_0x20a3('0x4c')][_0x20a3('0x54')]=integrations[_0x20a3('0x55')](_0x1144ef[_0x20a3('0x4c')][_0x20a3('0x56')],_0x1144ef[_0x20a3('0x4c')]['type']);_0x1144ef[_0x20a3('0x4c')][_0x20a3('0x57')]=integrations[_0x20a3('0x58')](_0x1144ef[_0x20a3('0x4c')][_0x20a3('0x56')],_0x1144ef[_0x20a3('0x4c')][_0x20a3('0x32')]);return db['DeskConfiguration'][_0x20a3('0x4b')](_0x1144ef[_0x20a3('0x4c')],{'include':[{'model':db[_0x20a3('0x59')],'as':'Subjects'},{'model':db[_0x20a3('0x59')],'as':_0x20a3('0x57')}]});}return null;})[_0x20a3('0x29')](respondWithResult(_0x1d5aab,null))['catch'](handleError(_0x1d5aab,null));};exports[_0x20a3('0x5a')]=function(_0x3abf43,_0x286edd,_0x58a063){var _0x40ba46=[{'name':'priority','label':_0x20a3('0x5b'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xe57d5c='';return db[_0x20a3('0x30')][_0x20a3('0x4f')]({'where':{'id':_0x3abf43[_0x20a3('0x4d')]['id']},'attributes':['id',_0x20a3('0x5c'),_0x20a3('0x5d'),_0x20a3('0x5e'),'password',_0x20a3('0x5f'),_0x20a3('0x60'),_0x20a3('0x61'),_0x20a3('0x62')]})[_0x20a3('0x29')](handleEntityNotFound(_0x286edd,null))['then'](function(_0x25b764){if(_0x25b764){_0xe57d5c=_0x25b764[_0x20a3('0x5c')];var _0x3bfab6=_0xe57d5c[_0x20a3('0x63')](-0x1);if(_0x3bfab6==='/'){_0xe57d5c=_0xe57d5c[_0x20a3('0x64')](0x0,_0xe57d5c[_0x20a3('0x65')](_0x3bfab6));}var _0x281ef9={'method':_0x20a3('0x66'),'uri':util['format'](_0x20a3('0x67'),_0xe57d5c),'headers':{'Content-Type':_0x20a3('0x68'),'Accept':_0x20a3('0x68')},'json':!![]};if(_0x25b764['authType']==='basic'){_0x281ef9[_0x20a3('0x69')][_0x20a3('0x6a')]=util['format'](_0x20a3('0x6b'),new Buffer(util[_0x20a3('0x6c')](_0x20a3('0x6d'),_0x25b764[_0x20a3('0x5e')],_0x25b764[_0x20a3('0x6e')]))[_0x20a3('0x6f')](_0x20a3('0x70')));}return rp(_0x281ef9)[_0x20a3('0x29')](function(_0x27118b){return _0x40ba46[_0x20a3('0x71')](_[_0x20a3('0x2f')](_0x27118b[_0x20a3('0x72')]['entries'],function(_0x4cc21e){return{'id':_0x4cc21e[_0x20a3('0x2c')],'name':_0x4cc21e['name'],'type':_0x4cc21e[_0x20a3('0x32')],'active':_0x4cc21e[_0x20a3('0x73')],'label':_0x4cc21e[_0x20a3('0x74')],'custom':!![]};}));});}})[_0x20a3('0x29')](function(_0x6c81cd){return{'count':_0x6c81cd[_0x20a3('0x3b')],'rows':_0x6c81cd};})[_0x20a3('0x29')](respondWithResult(_0x286edd,null))['catch'](function(_0x54e59c){var _0x492b4d=_0x3abf43[_0x20a3('0x34')][_0x20a3('0x75')]?0x1f4:_0x54e59c[_0x20a3('0x76')]||0x1f4;logger['error'](_0x20a3('0x77'),_0x20a3('0x5a'),_0x492b4d,JSON[_0x20a3('0x78')](_0x54e59c));delete _0x54e59c['name'];if(_0x492b4d===0x191){_0x492b4d=0x190;}_0x286edd[_0x20a3('0x1e')](_0x492b4d)['send'](_0x3abf43['query'][_0x20a3('0x75')]?{'message':_0x20a3('0x79'),'statusCode':_0x54e59c[_0x20a3('0x76')]}:_0x54e59c);});}; \ No newline at end of file +var _0xdb11=['name','index','map','fieldName','key','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','merge','type','options','DeskAccount','include','findAll','rows','show','params','intersection','includeAll','find','catch','create','update','body','getConfigurations','DeskConfiguration','rawAttributes','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','DeskField','Descriptions','priority','remoteUri','authType','username','consumerKey','consumerSecret','substring','%s/custom_fields','application/json','basic','Authorization','format','Basic\x20%s','%s:%s','password','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error'];(function(_0x45ce1a,_0x4f8ea5){var _0x4926d8=function(_0x4b29d8){while(--_0x4b29d8){_0x45ce1a['push'](_0x45ce1a['shift']());}};_0x4926d8(++_0x4f8ea5);}(_0xdb11,0xb0));var _0x1db1=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xdb11[_0xe66cf2];return _0x2d84e7;};'use strict';var emlformat=require(_0x1db1('0x0'));var rimraf=require(_0x1db1('0x1'));var zipdir=require(_0x1db1('0x2'));var jsonpatch=require(_0x1db1('0x3'));var rp=require(_0x1db1('0x4'));var moment=require('moment');var BPromise=require(_0x1db1('0x5'));var Mustache=require('mustache');var util=require(_0x1db1('0x6'));var path=require(_0x1db1('0x7'));var sox=require(_0x1db1('0x8'));var csv=require(_0x1db1('0x9'));var ejs=require(_0x1db1('0xa'));var fs=require('fs');var fs_extra=require(_0x1db1('0xb'));var _=require(_0x1db1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1db1('0xd'));var deskjs=require(_0x1db1('0xe'));var toCsv=require(_0x1db1('0x9'));var querystring=require('querystring');var Papa=require(_0x1db1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1db1('0x10'));var hardwareService=require(_0x1db1('0x11'));var logger=require('../../config/logger')(_0x1db1('0x12'));var utils=require(_0x1db1('0x13'));var config=require(_0x1db1('0x14'));var licenseUtil=require(_0x1db1('0x15'));var db=require(_0x1db1('0x16'))['db'];var integrations=require(_0x1db1('0x17'));function respondWithStatusCode(_0x32d725,_0x994b45){_0x994b45=_0x994b45||0xcc;return function(_0x1769b6){if(_0x1769b6){return _0x32d725[_0x1db1('0x18')](_0x994b45);}return _0x32d725[_0x1db1('0x19')](_0x994b45)[_0x1db1('0x1a')]();};}function respondWithResult(_0x285187,_0x19fcd6){_0x19fcd6=_0x19fcd6||0xc8;return function(_0x270996){if(_0x270996){return _0x285187[_0x1db1('0x19')](_0x19fcd6)[_0x1db1('0x1b')](_0x270996);}};}function respondWithFilteredResult(_0x128725,_0x543a18){return function(_0x464c4b){if(_0x464c4b){var _0x151891=typeof _0x543a18[_0x1db1('0x1c')]===_0x1db1('0x1d')&&typeof _0x543a18[_0x1db1('0x1e')]==='undefined';var _0x4f572d=_0x464c4b['count'];var _0x595bd4=_0x151891?0x0:_0x543a18[_0x1db1('0x1c')];var _0xb4c1f3=_0x151891?_0x464c4b[_0x1db1('0x1f')]:_0x543a18[_0x1db1('0x1c')]+_0x543a18[_0x1db1('0x1e')];var _0x4958bf;if(_0xb4c1f3>=_0x4f572d){_0xb4c1f3=_0x4f572d;_0x4958bf=0xc8;}else{_0x4958bf=0xce;}_0x128725['status'](_0x4958bf);return _0x128725[_0x1db1('0x20')](_0x1db1('0x21'),_0x595bd4+'-'+_0xb4c1f3+'/'+_0x4f572d)['json'](_0x464c4b);}return null;};}function patchUpdates(_0xa6724c){return function(_0x2d125f){try{jsonpatch[_0x1db1('0x22')](_0x2d125f,_0xa6724c,!![]);}catch(_0x51b326){return BPromise['reject'](_0x51b326);}return _0x2d125f['save']();};}function saveUpdates(_0x2dfa4e,_0x1c885f){return function(_0x4edfb1){if(_0x4edfb1){return _0x4edfb1['update'](_0x2dfa4e)[_0x1db1('0x23')](function(_0x283de2){return _0x283de2;});}return null;};}function removeEntity(_0x55c97e,_0x2ff139){return function(_0xdad3d6){if(_0xdad3d6){return _0xdad3d6[_0x1db1('0x24')]()[_0x1db1('0x23')](function(){_0x55c97e[_0x1db1('0x19')](0xcc)[_0x1db1('0x1a')]();});}};}function handleEntityNotFound(_0x52dc78,_0xd24da8){return function(_0xd7fe5c){if(!_0xd7fe5c){_0x52dc78[_0x1db1('0x18')](0x194);}return _0xd7fe5c;};}function handleError(_0x3e3c59,_0x9254c3){_0x9254c3=_0x9254c3||0x1f4;return function(_0x8ed2ec){logger[_0x1db1('0x25')](_0x8ed2ec['stack']);if(_0x8ed2ec['name']){delete _0x8ed2ec[_0x1db1('0x26')];}_0x3e3c59[_0x1db1('0x19')](_0x9254c3)['send'](_0x8ed2ec);};}exports[_0x1db1('0x27')]=function(_0x2f12cc,_0x13f2ce){var _0x436f77={},_0x3409b6={},_0x592d58={'count':0x0,'rows':[]};var _0x53bd1a=_[_0x1db1('0x28')](db['DeskAccount']['rawAttributes'],function(_0x35b5c0){return{'name':_0x35b5c0[_0x1db1('0x29')],'type':_0x35b5c0['type'][_0x1db1('0x2a')]};});_0x3409b6['model']=_[_0x1db1('0x28')](_0x53bd1a,_0x1db1('0x26'));_0x3409b6[_0x1db1('0x2b')]=_[_0x1db1('0x2c')](_0x2f12cc[_0x1db1('0x2b')]);_0x3409b6[_0x1db1('0x2d')]=_['intersection'](_0x3409b6[_0x1db1('0x2e')],_0x3409b6['query']);_0x436f77[_0x1db1('0x2f')]=_['intersection'](_0x3409b6[_0x1db1('0x2e')],qs[_0x1db1('0x30')](_0x2f12cc[_0x1db1('0x2b')]['fields']));_0x436f77[_0x1db1('0x2f')]=_0x436f77[_0x1db1('0x2f')][_0x1db1('0x31')]?_0x436f77[_0x1db1('0x2f')]:_0x3409b6['model'];if(!_0x2f12cc['query']['hasOwnProperty'](_0x1db1('0x32'))){_0x436f77[_0x1db1('0x1e')]=qs[_0x1db1('0x1e')](_0x2f12cc[_0x1db1('0x2b')][_0x1db1('0x1e')]);_0x436f77[_0x1db1('0x1c')]=qs['offset'](_0x2f12cc[_0x1db1('0x2b')][_0x1db1('0x1c')]);}_0x436f77[_0x1db1('0x33')]=qs[_0x1db1('0x34')](_0x2f12cc[_0x1db1('0x2b')][_0x1db1('0x34')]);_0x436f77[_0x1db1('0x35')]=qs[_0x1db1('0x2d')](_['pick'](_0x2f12cc['query'],_0x3409b6['filters']),_0x53bd1a);if(_0x2f12cc[_0x1db1('0x2b')]['filter']){_0x436f77[_0x1db1('0x35')]=_[_0x1db1('0x36')](_0x436f77[_0x1db1('0x35')],{'$or':_['map'](_0x53bd1a,function(_0x5b0bab){if(_0x5b0bab[_0x1db1('0x37')]!=='VIRTUAL'){var _0x4eff45={};_0x4eff45[_0x5b0bab[_0x1db1('0x26')]]={'$like':'%'+_0x2f12cc['query']['filter']+'%'};return _0x4eff45;}})});}_0x436f77=_[_0x1db1('0x36')]({},_0x436f77,_0x2f12cc[_0x1db1('0x38')]);var _0x4a1507={'where':_0x436f77[_0x1db1('0x35')]};return db[_0x1db1('0x39')]['count'](_0x4a1507)[_0x1db1('0x23')](function(_0x1f94f3){_0x592d58[_0x1db1('0x1f')]=_0x1f94f3;if(_0x2f12cc[_0x1db1('0x2b')]['includeAll']){_0x436f77[_0x1db1('0x3a')]=[{'all':!![]}];}return db[_0x1db1('0x39')][_0x1db1('0x3b')](_0x436f77);})[_0x1db1('0x23')](function(_0x48d30c){_0x592d58[_0x1db1('0x3c')]=_0x48d30c;return _0x592d58;})[_0x1db1('0x23')](respondWithFilteredResult(_0x13f2ce,_0x436f77))['catch'](handleError(_0x13f2ce,null));};exports[_0x1db1('0x3d')]=function(_0x44b5ea,_0x45f515){var _0x4f184f={'raw':![],'where':{'id':_0x44b5ea[_0x1db1('0x3e')]['id']}},_0x5d8faa={};_0x5d8faa[_0x1db1('0x2e')]=_[_0x1db1('0x2c')](db[_0x1db1('0x39')]['rawAttributes']);_0x5d8faa[_0x1db1('0x2b')]=_[_0x1db1('0x2c')](_0x44b5ea[_0x1db1('0x2b')]);_0x5d8faa['filters']=_['intersection'](_0x5d8faa['model'],_0x5d8faa[_0x1db1('0x2b')]);_0x4f184f[_0x1db1('0x2f')]=_[_0x1db1('0x3f')](_0x5d8faa[_0x1db1('0x2e')],qs[_0x1db1('0x30')](_0x44b5ea[_0x1db1('0x2b')]['fields']));_0x4f184f['attributes']=_0x4f184f[_0x1db1('0x2f')][_0x1db1('0x31')]?_0x4f184f[_0x1db1('0x2f')]:_0x5d8faa[_0x1db1('0x2e')];if(_0x44b5ea[_0x1db1('0x2b')][_0x1db1('0x40')]){_0x4f184f[_0x1db1('0x3a')]=[{'all':!![]}];}_0x4f184f=_[_0x1db1('0x36')]({},_0x4f184f,_0x44b5ea[_0x1db1('0x38')]);return db['DeskAccount'][_0x1db1('0x41')](_0x4f184f)[_0x1db1('0x23')](handleEntityNotFound(_0x45f515,null))[_0x1db1('0x23')](respondWithResult(_0x45f515,null))[_0x1db1('0x42')](handleError(_0x45f515,null));};exports[_0x1db1('0x43')]=function(_0x1ef676,_0x39c2cb){return db[_0x1db1('0x39')][_0x1db1('0x43')](_0x1ef676['body'],{})[_0x1db1('0x23')](respondWithResult(_0x39c2cb,0xc9))[_0x1db1('0x42')](handleError(_0x39c2cb,null));};exports[_0x1db1('0x44')]=function(_0x4050b8,_0x996713){if(_0x4050b8[_0x1db1('0x45')]['id']){delete _0x4050b8[_0x1db1('0x45')]['id'];}return db[_0x1db1('0x39')][_0x1db1('0x41')]({'where':{'id':_0x4050b8[_0x1db1('0x3e')]['id']}})[_0x1db1('0x23')](handleEntityNotFound(_0x996713,null))[_0x1db1('0x23')](saveUpdates(_0x4050b8[_0x1db1('0x45')],null))[_0x1db1('0x23')](respondWithResult(_0x996713,null))[_0x1db1('0x42')](handleError(_0x996713,null));};exports[_0x1db1('0x24')]=function(_0x2f55bc,_0x1c7da7){return db['DeskAccount'][_0x1db1('0x41')]({'where':{'id':_0x2f55bc[_0x1db1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1c7da7,null))[_0x1db1('0x23')](removeEntity(_0x1c7da7,null))[_0x1db1('0x42')](handleError(_0x1c7da7,null));};exports[_0x1db1('0x46')]=function(_0x5d904a,_0x18950e,_0xba7362){var _0x2aff8f={};var _0x26db84={};var _0x4f7a82;var _0x9139b;return db[_0x1db1('0x39')]['findOne']({'where':{'id':_0x5d904a['params']['id']}})[_0x1db1('0x23')](handleEntityNotFound(_0x18950e,null))[_0x1db1('0x23')](function(_0x79eb6a){if(_0x79eb6a){_0x4f7a82=_0x79eb6a;_0x26db84[_0x1db1('0x2e')]=_['keys'](db[_0x1db1('0x47')][_0x1db1('0x48')]);_0x26db84[_0x1db1('0x2b')]=_[_0x1db1('0x2c')](_0x5d904a['query']);_0x26db84['filters']=_[_0x1db1('0x3f')](_0x26db84[_0x1db1('0x2e')],_0x26db84[_0x1db1('0x2b')]);_0x2aff8f[_0x1db1('0x2f')]=_[_0x1db1('0x3f')](_0x26db84['model'],qs[_0x1db1('0x30')](_0x5d904a[_0x1db1('0x2b')][_0x1db1('0x30')]));_0x2aff8f['attributes']=_0x2aff8f[_0x1db1('0x2f')][_0x1db1('0x31')]?_0x2aff8f[_0x1db1('0x2f')]:_0x26db84[_0x1db1('0x2e')];_0x2aff8f[_0x1db1('0x33')]=qs[_0x1db1('0x34')](_0x5d904a[_0x1db1('0x2b')][_0x1db1('0x34')]);_0x2aff8f[_0x1db1('0x35')]=qs[_0x1db1('0x2d')](_[_0x1db1('0x49')](_0x5d904a[_0x1db1('0x2b')],_0x26db84['filters']));if(_0x5d904a[_0x1db1('0x2b')]['filter']){_0x2aff8f[_0x1db1('0x35')]=_[_0x1db1('0x36')](_0x2aff8f[_0x1db1('0x35')],{'$or':_[_0x1db1('0x28')](_0x2aff8f['attributes'],function(_0xad6714){var _0x4d5e5a={};_0x4d5e5a[_0xad6714]={'$like':'%'+_0x5d904a['query']['filter']+'%'};return _0x4d5e5a;})});}_0x2aff8f=_[_0x1db1('0x36')]({},_0x2aff8f,_0x5d904a[_0x1db1('0x38')]);return _0x4f7a82[_0x1db1('0x46')](_0x2aff8f);}})[_0x1db1('0x23')](function(_0x5f2888){if(_0x5f2888){_0x9139b=_0x5f2888['length'];if(!_0x5d904a[_0x1db1('0x2b')]['hasOwnProperty']('nolimit')){_0x2aff8f['limit']=qs[_0x1db1('0x1e')](_0x5d904a[_0x1db1('0x2b')]['limit']);_0x2aff8f[_0x1db1('0x1c')]=qs[_0x1db1('0x1c')](_0x5d904a[_0x1db1('0x2b')]['offset']);}return _0x4f7a82['getConfigurations'](_0x2aff8f);}})[_0x1db1('0x23')](function(_0x287d5a){if(_0x287d5a){return _0x287d5a?{'count':_0x9139b,'rows':_0x287d5a}:null;}})[_0x1db1('0x23')](respondWithResult(_0x18950e,null))[_0x1db1('0x42')](handleError(_0x18950e,null));};exports[_0x1db1('0x4a')]=function(_0xa49cb5,_0x180f5f,_0x32e889){if(_0xa49cb5[_0x1db1('0x45')]['id']){delete _0xa49cb5[_0x1db1('0x45')]['id'];}return db[_0x1db1('0x39')][_0x1db1('0x4b')]({'where':{'id':_0xa49cb5[_0x1db1('0x3e')]['id']}})[_0x1db1('0x23')](handleEntityNotFound(_0x180f5f,null))[_0x1db1('0x23')](function(_0x4f9977){if(_0x4f9977){_0xa49cb5[_0x1db1('0x45')][_0x1db1('0x4c')]=_0x4f9977['id'];_0xa49cb5['body'][_0x1db1('0x4d')]=integrations[_0x1db1('0x4e')](_0xa49cb5['body'][_0x1db1('0x4f')],_0xa49cb5[_0x1db1('0x45')][_0x1db1('0x37')]);_0xa49cb5[_0x1db1('0x45')]['Descriptions']=integrations['getDescriptions'](_0xa49cb5[_0x1db1('0x45')][_0x1db1('0x4f')],_0xa49cb5[_0x1db1('0x45')][_0x1db1('0x37')]);return db[_0x1db1('0x47')][_0x1db1('0x43')](_0xa49cb5[_0x1db1('0x45')],{'include':[{'model':db[_0x1db1('0x50')],'as':_0x1db1('0x4d')},{'model':db[_0x1db1('0x50')],'as':_0x1db1('0x51')}]});}return null;})[_0x1db1('0x23')](respondWithResult(_0x180f5f,null))[_0x1db1('0x42')](handleError(_0x180f5f,null));};exports['getFields']=function(_0xdf7805,_0x311758,_0x1a63aa){var _0xe59f13=[{'name':_0x1db1('0x52'),'label':_0x1db1('0x52'),'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 _0x58fa17='';return db[_0x1db1('0x39')][_0x1db1('0x4b')]({'where':{'id':_0xdf7805[_0x1db1('0x3e')]['id']},'attributes':['id',_0x1db1('0x53'),_0x1db1('0x54'),_0x1db1('0x55'),'password',_0x1db1('0x56'),_0x1db1('0x57'),'token','tokenSecret']})[_0x1db1('0x23')](handleEntityNotFound(_0x311758,null))[_0x1db1('0x23')](function(_0x6460ea){if(_0x6460ea){_0x58fa17=_0x6460ea[_0x1db1('0x53')];var _0x12eebe=_0x58fa17['slice'](-0x1);if(_0x12eebe==='/'){_0x58fa17=_0x58fa17[_0x1db1('0x58')](0x0,_0x58fa17['lastIndexOf'](_0x12eebe));}var _0x204036={'method':'GET','uri':util['format'](_0x1db1('0x59'),_0x58fa17),'headers':{'Content-Type':'application/json','Accept':_0x1db1('0x5a')},'json':!![]};if(_0x6460ea[_0x1db1('0x54')]===_0x1db1('0x5b')){_0x204036['headers'][_0x1db1('0x5c')]=util[_0x1db1('0x5d')](_0x1db1('0x5e'),new Buffer(util[_0x1db1('0x5d')](_0x1db1('0x5f'),_0x6460ea[_0x1db1('0x55')],_0x6460ea[_0x1db1('0x60')]))['toString'](_0x1db1('0x61')));}return rp(_0x204036)[_0x1db1('0x23')](function(_0x3b2c3b){return _0xe59f13[_0x1db1('0x62')](_['map'](_0x3b2c3b[_0x1db1('0x63')][_0x1db1('0x64')],function(_0x514479){return{'id':_0x514479[_0x1db1('0x26')],'name':_0x514479[_0x1db1('0x26')],'type':_0x514479['type'],'active':_0x514479[_0x1db1('0x65')],'label':_0x514479[_0x1db1('0x66')],'custom':!![]};}));});}})[_0x1db1('0x23')](function(_0x594ae7){return{'count':_0x594ae7[_0x1db1('0x31')],'rows':_0x594ae7};})['then'](respondWithResult(_0x311758,null))['catch'](function(_0x54a9bf){var _0x2beed3=_0xdf7805['query'][_0x1db1('0x67')]?0x1f4:_0x54a9bf[_0x1db1('0x68')]||0x1f4;logger[_0x1db1('0x25')](_0x1db1('0x69'),'getFields',_0x2beed3,JSON['stringify'](_0x54a9bf));delete _0x54a9bf[_0x1db1('0x26')];if(_0x2beed3===0x191){_0x2beed3=0x190;}_0x311758['status'](_0x2beed3)[_0x1db1('0x6a')](_0xdf7805[_0x1db1('0x2b')][_0x1db1('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x54a9bf[_0x1db1('0x68')]}:_0x54a9bf);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index b15072a..ffeb99d 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 _0xe613=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x37cad7,_0x20acee){var _0x5a77da=function(_0x58855f){while(--_0x58855f){_0x37cad7['push'](_0x37cad7['shift']());}};_0x5a77da(++_0x20acee);}(_0xe613,0x1da));var _0x3e61=function(_0x5ace7d,_0x173877){_0x5ace7d=_0x5ace7d-0x0;var _0x2ececb=_0xe613[_0x5ace7d];return _0x2ececb;};'use strict';var _=require('lodash');var util=require(_0x3e61('0x0'));var logger=require(_0x3e61('0x1'))(_0x3e61('0x2'));var moment=require(_0x3e61('0x3'));var BPromise=require(_0x3e61('0x4'));var rp=require(_0x3e61('0x5'));var fs=require('fs');var path=require(_0x3e61('0x6'));var rimraf=require(_0x3e61('0x7'));var config=require(_0x3e61('0x8'));var attributes=require(_0x3e61('0x9'));var integrations=require(_0x3e61('0xa'));module[_0x3e61('0xb')]=function(_0x12efaf,_0x42fe89){return _0x12efaf[_0x3e61('0xc')](_0x3e61('0xd'),attributes,{'tableName':_0x3e61('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63b1=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','util','bluebird','request-promise','path','rimraf'];(function(_0x7918a1,_0xcdad9){var _0x436a7a=function(_0x21444f){while(--_0x21444f){_0x7918a1['push'](_0x7918a1['shift']());}};_0x436a7a(++_0xcdad9);}(_0x63b1,0x1d1));var _0x163b=function(_0x10fadc,_0x5871f2){_0x10fadc=_0x10fadc-0x0;var _0x1e0afa=_0x63b1[_0x10fadc];return _0x1e0afa;};'use strict';var _=require('lodash');var util=require(_0x163b('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x163b('0x1'));var rp=require(_0x163b('0x2'));var fs=require('fs');var path=require(_0x163b('0x3'));var rimraf=require(_0x163b('0x4'));var config=require(_0x163b('0x5'));var attributes=require(_0x163b('0x6'));var integrations=require(_0x163b('0x7'));module['exports']=function(_0x416f12,_0x5b9482){return _0x416f12[_0x163b('0x8')]('DeskAccount',attributes,{'tableName':_0x163b('0x9'),'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 3235d5b..99a9fee 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 _0x12e4=['../../config/environment','jayson/promise','client','request','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetDeskAccount','DeskAccount','options','where','attributes','limit','include','map','model','then','catch','ShowDeskAccount','find','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x41156e,_0x4388a7){var _0x3b4258=function(_0x2d001d){while(--_0x2d001d){_0x41156e['push'](_0x41156e['shift']());}};_0x3b4258(++_0x4388a7);}(_0x12e4,0xab));var _0x412e=function(_0x33449c,_0x13e8c1){_0x33449c=_0x33449c-0x0;var _0x2293e5=_0x12e4[_0x33449c];return _0x2293e5;};'use strict';var _=require(_0x412e('0x0'));var util=require(_0x412e('0x1'));var moment=require(_0x412e('0x2'));var BPromise=require(_0x412e('0x3'));var rs=require(_0x412e('0x4'));var fs=require('fs');var Redis=require(_0x412e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x412e('0x6'));var logger=require(_0x412e('0x7'))(_0x412e('0x8'));var config=require(_0x412e('0x9'));var jayson=require(_0x412e('0xa'));var client=jayson[_0x412e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52e681,_0x5f436a,_0x34b9bd){return new BPromise(function(_0x544054,_0x528f26){return client[_0x412e('0xc')](_0x52e681,_0x34b9bd)['then'](function(_0x44f617){logger['info'](_0x412e('0xd'),_0x5f436a,'request\x20sent');logger[_0x412e('0xe')](_0x412e('0xf'),_0x5f436a,'request\x20sent',JSON['stringify'](_0x44f617));if(_0x44f617[_0x412e('0x10')]){if(_0x44f617[_0x412e('0x10')][_0x412e('0x11')]===0x1f4){logger['error'](_0x412e('0xd'),_0x5f436a,_0x44f617[_0x412e('0x10')][_0x412e('0x12')]);return _0x528f26(_0x44f617[_0x412e('0x10')][_0x412e('0x12')]);}logger[_0x412e('0x10')](_0x412e('0xd'),_0x5f436a,_0x44f617[_0x412e('0x10')][_0x412e('0x12')]);return _0x544054(_0x44f617[_0x412e('0x10')][_0x412e('0x12')]);}else{logger[_0x412e('0x13')](_0x412e('0xd'),_0x5f436a,'request\x20sent');_0x544054(_0x44f617[_0x412e('0x14')]['message']);}})['catch'](function(_0x316a07){logger[_0x412e('0x10')]('DeskAccount,\x20%s,\x20%s',_0x5f436a,_0x316a07);_0x528f26(_0x316a07);});});}exports[_0x412e('0x15')]=function(_0x26d8fd){var _0xf0769e=this;return new Promise(function(_0xf7c42b,_0x5ee77b){return db[_0x412e('0x16')]['findAll']({'raw':_0x26d8fd[_0x412e('0x17')]?_0x26d8fd[_0x412e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x26d8fd[_0x412e('0x17')]?_0x26d8fd[_0x412e('0x17')][_0x412e('0x18')]||null:null,'attributes':_0x26d8fd[_0x412e('0x17')]?_0x26d8fd[_0x412e('0x17')][_0x412e('0x19')]||null:null,'limit':_0x26d8fd['options']?_0x26d8fd[_0x412e('0x17')][_0x412e('0x1a')]||null:null,'include':_0x26d8fd['options']?_0x26d8fd[_0x412e('0x17')][_0x412e('0x1b')]?_[_0x412e('0x1c')](_0x26d8fd[_0x412e('0x17')][_0x412e('0x1b')],function(_0x3acd6c){return{'model':db[_0x3acd6c[_0x412e('0x1d')]],'as':_0x3acd6c['as'],'attributes':_0x3acd6c[_0x412e('0x19')],'include':_0x3acd6c[_0x412e('0x1b')]?_[_0x412e('0x1c')](_0x3acd6c[_0x412e('0x1b')],function(_0x4d3ece){return{'model':db[_0x4d3ece['model']],'as':_0x4d3ece['as'],'attributes':_0x4d3ece[_0x412e('0x19')],'include':_0x4d3ece[_0x412e('0x1b')]?_[_0x412e('0x1c')](_0x4d3ece[_0x412e('0x1b')],function(_0x412194){return{'model':db[_0x412194[_0x412e('0x1d')]],'as':_0x412194['as'],'attributes':_0x412194[_0x412e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x412e('0x1e')](function(_0x7722e0){logger['info'](_0x412e('0x15'),_0x26d8fd);logger[_0x412e('0xe')]('GetDeskAccount',_0x26d8fd,JSON['stringify'](_0x7722e0));_0xf7c42b(_0x7722e0);})[_0x412e('0x1f')](function(_0x4ef348){logger['error'](_0x412e('0x15'),_0x4ef348[_0x412e('0x12')],_0x26d8fd);_0x5ee77b(_0xf0769e[_0x412e('0x10')](0x1f4,_0x4ef348[_0x412e('0x12')]));});});};exports[_0x412e('0x20')]=function(_0x599e6f){var _0x2facd2=this;return new Promise(function(_0x15f408,_0x109c45){return db['DeskAccount'][_0x412e('0x21')]({'raw':_0x599e6f[_0x412e('0x17')]?_0x599e6f[_0x412e('0x17')][_0x412e('0x22')]===undefined?!![]:![]:!![],'where':_0x599e6f[_0x412e('0x17')]?_0x599e6f[_0x412e('0x17')][_0x412e('0x18')]||null:null,'attributes':_0x599e6f[_0x412e('0x17')]?_0x599e6f['options']['attributes']||null:null,'include':_0x599e6f['options']?_0x599e6f['options'][_0x412e('0x1b')]?_[_0x412e('0x1c')](_0x599e6f[_0x412e('0x17')][_0x412e('0x1b')],function(_0x3587be){return{'model':db[_0x3587be[_0x412e('0x1d')]],'as':_0x3587be['as'],'attributes':_0x3587be[_0x412e('0x19')],'include':_0x3587be[_0x412e('0x1b')]?_['map'](_0x3587be['include'],function(_0x3a04fc){return{'model':db[_0x3a04fc['model']],'as':_0x3a04fc['as'],'attributes':_0x3a04fc[_0x412e('0x19')],'include':_0x3a04fc[_0x412e('0x1b')]?_['map'](_0x3a04fc[_0x412e('0x1b')],function(_0x357019){return{'model':db[_0x357019[_0x412e('0x1d')]],'as':_0x357019['as'],'attributes':_0x357019['attributes']};}):[]};}):[]};}):[]:[]})[_0x412e('0x1e')](function(_0x58d449){logger[_0x412e('0x13')](_0x412e('0x20'),_0x599e6f);logger[_0x412e('0xe')]('ShowDeskAccount',_0x599e6f,JSON[_0x412e('0x23')](_0x58d449));_0x15f408(_0x58d449);})[_0x412e('0x1f')](function(_0x5ca200){logger[_0x412e('0x10')](_0x412e('0x20'),_0x5ca200[_0x412e('0x12')],_0x599e6f);_0x109c45(_0x2facd2[_0x412e('0x10')](0x1f4,_0x5ca200[_0x412e('0x12')]));});});}; \ No newline at end of file +var _0x5d07=['map','ShowDeskAccount','find','then','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','model'];(function(_0x567d04,_0x3d13a1){var _0x58ee79=function(_0x4c5548){while(--_0x4c5548){_0x567d04['push'](_0x567d04['shift']());}};_0x58ee79(++_0x3d13a1);}(_0x5d07,0xf9));var _0x75d0=function(_0x556f70,_0x540d53){_0x556f70=_0x556f70-0x0;var _0x38dc3f=_0x5d07[_0x556f70];return _0x38dc3f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d0('0x0'));var fs=require('fs');var Redis=require(_0x75d0('0x1'));var db=require(_0x75d0('0x2'))['db'];var utils=require(_0x75d0('0x3'));var logger=require(_0x75d0('0x4'))(_0x75d0('0x5'));var config=require(_0x75d0('0x6'));var jayson=require(_0x75d0('0x7'));var client=jayson['client'][_0x75d0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5936aa,_0x3883e0,_0x4c6480){return new BPromise(function(_0x451642,_0x55419d){return client[_0x75d0('0x9')](_0x5936aa,_0x4c6480)['then'](function(_0x24092a){logger['info'](_0x75d0('0xa'),_0x3883e0,_0x75d0('0xb'));logger[_0x75d0('0xc')](_0x75d0('0xd'),_0x3883e0,_0x75d0('0xb'),JSON[_0x75d0('0xe')](_0x24092a));if(_0x24092a[_0x75d0('0xf')]){if(_0x24092a[_0x75d0('0xf')][_0x75d0('0x10')]===0x1f4){logger['error'](_0x75d0('0xa'),_0x3883e0,_0x24092a[_0x75d0('0xf')]['message']);return _0x55419d(_0x24092a[_0x75d0('0xf')]['message']);}logger[_0x75d0('0xf')](_0x75d0('0xa'),_0x3883e0,_0x24092a[_0x75d0('0xf')][_0x75d0('0x11')]);return _0x451642(_0x24092a['error'][_0x75d0('0x11')]);}else{logger[_0x75d0('0x12')](_0x75d0('0xa'),_0x3883e0,_0x75d0('0xb'));_0x451642(_0x24092a[_0x75d0('0x13')][_0x75d0('0x11')]);}})[_0x75d0('0x14')](function(_0x120efa){logger[_0x75d0('0xf')](_0x75d0('0xa'),_0x3883e0,_0x120efa);_0x55419d(_0x120efa);});});}exports[_0x75d0('0x15')]=function(_0x1e75fb){var _0x201e0f=this;return new Promise(function(_0x3021d9,_0x524054){return db[_0x75d0('0x16')][_0x75d0('0x17')]({'raw':_0x1e75fb[_0x75d0('0x18')]?_0x1e75fb[_0x75d0('0x18')][_0x75d0('0x19')]===undefined?!![]:![]:!![],'where':_0x1e75fb[_0x75d0('0x18')]?_0x1e75fb[_0x75d0('0x18')][_0x75d0('0x1a')]||null:null,'attributes':_0x1e75fb[_0x75d0('0x18')]?_0x1e75fb[_0x75d0('0x18')][_0x75d0('0x1b')]||null:null,'limit':_0x1e75fb[_0x75d0('0x18')]?_0x1e75fb[_0x75d0('0x18')][_0x75d0('0x1c')]||null:null,'include':_0x1e75fb[_0x75d0('0x18')]?_0x1e75fb[_0x75d0('0x18')][_0x75d0('0x1d')]?_['map'](_0x1e75fb['options']['include'],function(_0x62c877){return{'model':db[_0x62c877[_0x75d0('0x1e')]],'as':_0x62c877['as'],'attributes':_0x62c877['attributes'],'include':_0x62c877['include']?_[_0x75d0('0x1f')](_0x62c877[_0x75d0('0x1d')],function(_0x447a11){return{'model':db[_0x447a11['model']],'as':_0x447a11['as'],'attributes':_0x447a11['attributes'],'include':_0x447a11[_0x75d0('0x1d')]?_[_0x75d0('0x1f')](_0x447a11[_0x75d0('0x1d')],function(_0x3eb5c8){return{'model':db[_0x3eb5c8[_0x75d0('0x1e')]],'as':_0x3eb5c8['as'],'attributes':_0x3eb5c8[_0x75d0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43bef2){logger[_0x75d0('0x12')](_0x75d0('0x15'),_0x1e75fb);logger[_0x75d0('0xc')]('GetDeskAccount',_0x1e75fb,JSON[_0x75d0('0xe')](_0x43bef2));_0x3021d9(_0x43bef2);})[_0x75d0('0x14')](function(_0x55fc53){logger['error'](_0x75d0('0x15'),_0x55fc53[_0x75d0('0x11')],_0x1e75fb);_0x524054(_0x201e0f[_0x75d0('0xf')](0x1f4,_0x55fc53[_0x75d0('0x11')]));});});};exports[_0x75d0('0x20')]=function(_0x506119){var _0x5f2936=this;return new Promise(function(_0x515e2e,_0x317946){return db[_0x75d0('0x16')][_0x75d0('0x21')]({'raw':_0x506119[_0x75d0('0x18')]?_0x506119[_0x75d0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x506119[_0x75d0('0x18')]?_0x506119[_0x75d0('0x18')][_0x75d0('0x1a')]||null:null,'attributes':_0x506119[_0x75d0('0x18')]?_0x506119['options']['attributes']||null:null,'include':_0x506119[_0x75d0('0x18')]?_0x506119[_0x75d0('0x18')]['include']?_[_0x75d0('0x1f')](_0x506119[_0x75d0('0x18')][_0x75d0('0x1d')],function(_0x31ab92){return{'model':db[_0x31ab92['model']],'as':_0x31ab92['as'],'attributes':_0x31ab92[_0x75d0('0x1b')],'include':_0x31ab92[_0x75d0('0x1d')]?_[_0x75d0('0x1f')](_0x31ab92[_0x75d0('0x1d')],function(_0xca5bf5){return{'model':db[_0xca5bf5[_0x75d0('0x1e')]],'as':_0xca5bf5['as'],'attributes':_0xca5bf5[_0x75d0('0x1b')],'include':_0xca5bf5['include']?_[_0x75d0('0x1f')](_0xca5bf5[_0x75d0('0x1d')],function(_0x439df2){return{'model':db[_0x439df2[_0x75d0('0x1e')]],'as':_0x439df2['as'],'attributes':_0x439df2['attributes']};}):[]};}):[]};}):[]:[]})[_0x75d0('0x22')](function(_0x3d00d8){logger['info'](_0x75d0('0x20'),_0x506119);logger[_0x75d0('0xc')](_0x75d0('0x20'),_0x506119,JSON[_0x75d0('0xe')](_0x3d00d8));_0x515e2e(_0x3d00d8);})['catch'](function(_0x55412c){logger['error'](_0x75d0('0x20'),_0x55412c[_0x75d0('0x11')],_0x506119);_0x317946(_0x5f2936[_0x75d0('0xf')](0x1f4,_0x55412c[_0x75d0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a029ba6..faab8fe 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0xc37798,_0x57a52f){var _0x2de1e7=function(_0x36d2e8){while(--_0x36d2e8){_0xc37798['push'](_0xc37798['shift']());}};_0x2de1e7(++_0x57a52f);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',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/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x49dc06,_0x13c5e3){var _0x364efa=function(_0x4537bb){while(--_0x4537bb){_0x49dc06['push'](_0x49dc06['shift']());}};_0x364efa(++_0x13c5e3);}(_0xedd9,0xfc));var _0x9edd=function(_0x25c161,_0x4f6bd7){_0x25c161=_0x25c161-0x0;var _0x3df80b=_0xedd9[_0x25c161];return _0x3df80b;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 850d218..1db59d7 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 _0x4d23=['sequelize','STRING'];(function(_0x29fe82,_0x4c34f1){var _0x47e77d=function(_0xcc9443){while(--_0xcc9443){_0x29fe82['push'](_0x29fe82['shift']());}};_0x47e77d(++_0x4c34f1);}(_0x4d23,0x116));var _0x34d2=function(_0x48e87f,_0x4beb81){_0x48e87f=_0x48e87f-0x0;var _0x406f04=_0x4d23[_0x48e87f];return _0x406f04;};'use strict';var Sequelize=require(_0x34d2('0x0'));module['exports']={'name':{'type':Sequelize[_0x34d2('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x164e=['exports','STRING','sequelize'];(function(_0x113c46,_0x3c67ea){var _0xe71fd3=function(_0x4510fb){while(--_0x4510fb){_0x113c46['push'](_0x113c46['shift']());}};_0xe71fd3(++_0x3c67ea);}(_0x164e,0x182));var _0xe164=function(_0xdd1da3,_0x245e9d){_0xdd1da3=_0xdd1da3-0x0;var _0x18ae17=_0x164e[_0xdd1da3];return _0x18ae17;};'use strict';var Sequelize=require(_0xe164('0x0'));module[_0xe164('0x1')]={'name':{'type':Sequelize[_0xe164('0x2')]},'description':{'type':Sequelize[_0xe164('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 83efbc2..58b1b14 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 _0x4d81=['Tag','setTags','ids','eml-format','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','params','fields','length','include','options','find','create','body','findOne','DeskField','order','getFields','getSubjects','sort','getDescriptions','getTags'];(function(_0x1af965,_0x47583c){var _0x2789d5=function(_0x46a436){while(--_0x46a436){_0x1af965['push'](_0x1af965['shift']());}};_0x2789d5(++_0x47583c);}(_0x4d81,0x1e3));var _0x14d8=function(_0x4434d7,_0x20ac5a){_0x4434d7=_0x4434d7-0x0;var _0x3bd620=_0x4d81[_0x4434d7];return _0x3bd620;};'use strict';var emlformat=require(_0x14d8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x14d8('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x14d8('0x2'));var util=require(_0x14d8('0x3'));var path=require(_0x14d8('0x4'));var sox=require(_0x14d8('0x5'));var csv=require(_0x14d8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14d8('0x7'));var _=require(_0x14d8('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x14d8('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x14d8('0x6'));var querystring=require(_0x14d8('0xa'));var Papa=require('papaparse');var Redis=require(_0x14d8('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14d8('0xc'));var hardwareService=require(_0x14d8('0xd'));var logger=require('../../config/logger')(_0x14d8('0xe'));var utils=require(_0x14d8('0xf'));var config=require(_0x14d8('0x10'));var licenseUtil=require(_0x14d8('0x11'));var db=require(_0x14d8('0x12'))['db'];function respondWithStatusCode(_0xf529ae,_0x3e12c6){_0x3e12c6=_0x3e12c6||0xcc;return function(_0x20a16f){if(_0x20a16f){return _0xf529ae[_0x14d8('0x13')](_0x3e12c6);}return _0xf529ae[_0x14d8('0x14')](_0x3e12c6)[_0x14d8('0x15')]();};}function respondWithResult(_0x10157d,_0x453af9){_0x453af9=_0x453af9||0xc8;return function(_0x2112b2){if(_0x2112b2){return _0x10157d[_0x14d8('0x14')](_0x453af9)[_0x14d8('0x16')](_0x2112b2);}};}function respondWithFilteredResult(_0x5efe25,_0x3f94da){return function(_0x56f196){if(_0x56f196){var _0x1f51c6=typeof _0x3f94da[_0x14d8('0x17')]===_0x14d8('0x18')&&typeof _0x3f94da['limit']===_0x14d8('0x18');var _0xaf72e1=_0x56f196[_0x14d8('0x19')];var _0x33772c=_0x1f51c6?0x0:_0x3f94da[_0x14d8('0x17')];var _0x401548=_0x1f51c6?_0x56f196[_0x14d8('0x19')]:_0x3f94da[_0x14d8('0x17')]+_0x3f94da[_0x14d8('0x1a')];var _0x174318;if(_0x401548>=_0xaf72e1){_0x401548=_0xaf72e1;_0x174318=0xc8;}else{_0x174318=0xce;}_0x5efe25[_0x14d8('0x14')](_0x174318);return _0x5efe25[_0x14d8('0x1b')](_0x14d8('0x1c'),_0x33772c+'-'+_0x401548+'/'+_0xaf72e1)['json'](_0x56f196);}return null;};}function patchUpdates(_0x32a6d3){return function(_0x55f9e5){try{jsonpatch[_0x14d8('0x1d')](_0x55f9e5,_0x32a6d3,!![]);}catch(_0x1b2990){return BPromise[_0x14d8('0x1e')](_0x1b2990);}return _0x55f9e5[_0x14d8('0x1f')]();};}function saveUpdates(_0x20846b,_0x57660a){return function(_0x19cd2c){if(_0x19cd2c){return _0x19cd2c[_0x14d8('0x20')](_0x20846b)[_0x14d8('0x21')](function(_0x165d62){return _0x165d62;});}return null;};}function removeEntity(_0x36eb4d,_0x54ecbe){return function(_0x1facc4){if(_0x1facc4){return _0x1facc4[_0x14d8('0x22')]()['then'](function(){_0x36eb4d[_0x14d8('0x14')](0xcc)[_0x14d8('0x15')]();});}};}function handleEntityNotFound(_0x2b8294,_0xc61a50){return function(_0x11acd7){if(!_0x11acd7){_0x2b8294['sendStatus'](0x194);}return _0x11acd7;};}function handleError(_0x442bbe,_0x3bc71d){_0x3bc71d=_0x3bc71d||0x1f4;return function(_0x4e28e4){logger[_0x14d8('0x23')](_0x4e28e4[_0x14d8('0x24')]);if(_0x4e28e4['name']){delete _0x4e28e4[_0x14d8('0x25')];}_0x442bbe['status'](_0x3bc71d)[_0x14d8('0x26')](_0x4e28e4);};}exports[_0x14d8('0x27')]=function(_0x2f76c7,_0x4d6571){var _0x2c9588={},_0x346207={},_0x54a5e5={'count':0x0,'rows':[]};var _0x340198=_[_0x14d8('0x28')](db[_0x14d8('0x29')][_0x14d8('0x2a')],function(_0x348a3b){return{'name':_0x348a3b['fieldName'],'type':_0x348a3b[_0x14d8('0x2b')][_0x14d8('0x2c')]};});_0x346207[_0x14d8('0x2d')]=_['map'](_0x340198,_0x14d8('0x25'));_0x346207[_0x14d8('0x2e')]=_[_0x14d8('0x2f')](_0x2f76c7[_0x14d8('0x2e')]);_0x346207[_0x14d8('0x30')]=_[_0x14d8('0x31')](_0x346207[_0x14d8('0x2d')],_0x346207['query']);_0x2c9588[_0x14d8('0x32')]=_[_0x14d8('0x31')](_0x346207[_0x14d8('0x2d')],qs['fields'](_0x2f76c7[_0x14d8('0x2e')]['fields']));_0x2c9588[_0x14d8('0x32')]=_0x2c9588[_0x14d8('0x32')]['length']?_0x2c9588[_0x14d8('0x32')]:_0x346207['model'];if(!_0x2f76c7[_0x14d8('0x2e')][_0x14d8('0x33')](_0x14d8('0x34'))){_0x2c9588[_0x14d8('0x1a')]=qs[_0x14d8('0x1a')](_0x2f76c7['query'][_0x14d8('0x1a')]);_0x2c9588[_0x14d8('0x17')]=qs[_0x14d8('0x17')](_0x2f76c7[_0x14d8('0x2e')][_0x14d8('0x17')]);}_0x2c9588['order']=qs['sort'](_0x2f76c7[_0x14d8('0x2e')]['sort']);_0x2c9588[_0x14d8('0x35')]=qs[_0x14d8('0x30')](_[_0x14d8('0x36')](_0x2f76c7['query'],_0x346207['filters']),_0x340198);if(_0x2f76c7[_0x14d8('0x2e')][_0x14d8('0x37')]){_0x2c9588[_0x14d8('0x35')]=_[_0x14d8('0x38')](_0x2c9588[_0x14d8('0x35')],{'$or':_[_0x14d8('0x28')](_0x340198,function(_0x577b0c){if(_0x577b0c[_0x14d8('0x2b')]!==_0x14d8('0x39')){var _0x10fdc3={};_0x10fdc3[_0x577b0c[_0x14d8('0x25')]]={'$like':'%'+_0x2f76c7[_0x14d8('0x2e')]['filter']+'%'};return _0x10fdc3;}})});}_0x2c9588=_[_0x14d8('0x38')]({},_0x2c9588,_0x2f76c7['options']);var _0xd332d2={'where':_0x2c9588[_0x14d8('0x35')]};return db[_0x14d8('0x29')]['count'](_0xd332d2)[_0x14d8('0x21')](function(_0x1a209e){_0x54a5e5[_0x14d8('0x19')]=_0x1a209e;if(_0x2f76c7[_0x14d8('0x2e')][_0x14d8('0x3a')]){_0x2c9588['include']=[{'all':!![]}];}return db[_0x14d8('0x29')][_0x14d8('0x3b')](_0x2c9588);})[_0x14d8('0x21')](function(_0x332b02){_0x54a5e5['rows']=_0x332b02;return _0x54a5e5;})[_0x14d8('0x21')](respondWithFilteredResult(_0x4d6571,_0x2c9588))[_0x14d8('0x3c')](handleError(_0x4d6571,null));};exports['show']=function(_0xd8df79,_0x3c8aaa){var _0x2715ad={'raw':![],'where':{'id':_0xd8df79[_0x14d8('0x3d')]['id']}},_0x17415c={};_0x17415c[_0x14d8('0x2d')]=_['keys'](db[_0x14d8('0x29')][_0x14d8('0x2a')]);_0x17415c[_0x14d8('0x2e')]=_[_0x14d8('0x2f')](_0xd8df79[_0x14d8('0x2e')]);_0x17415c[_0x14d8('0x30')]=_[_0x14d8('0x31')](_0x17415c['model'],_0x17415c[_0x14d8('0x2e')]);_0x2715ad[_0x14d8('0x32')]=_['intersection'](_0x17415c[_0x14d8('0x2d')],qs[_0x14d8('0x3e')](_0xd8df79['query'][_0x14d8('0x3e')]));_0x2715ad[_0x14d8('0x32')]=_0x2715ad[_0x14d8('0x32')][_0x14d8('0x3f')]?_0x2715ad[_0x14d8('0x32')]:_0x17415c['model'];if(_0xd8df79[_0x14d8('0x2e')][_0x14d8('0x3a')]){_0x2715ad[_0x14d8('0x40')]=[{'all':!![]}];}_0x2715ad=_['merge']({},_0x2715ad,_0xd8df79[_0x14d8('0x41')]);return db[_0x14d8('0x29')][_0x14d8('0x42')](_0x2715ad)['then'](handleEntityNotFound(_0x3c8aaa,null))[_0x14d8('0x21')](respondWithResult(_0x3c8aaa,null))[_0x14d8('0x3c')](handleError(_0x3c8aaa,null));};exports[_0x14d8('0x43')]=function(_0xbbeaa4,_0x526240){return db['DeskConfiguration']['create'](_0xbbeaa4[_0x14d8('0x44')],{})[_0x14d8('0x21')](respondWithResult(_0x526240,0xc9))[_0x14d8('0x3c')](handleError(_0x526240,null));};exports['update']=function(_0xd8c6d6,_0xbb4620){if(_0xd8c6d6['body']['id']){delete _0xd8c6d6['body']['id'];}return db[_0x14d8('0x29')][_0x14d8('0x42')]({'where':{'id':_0xd8c6d6[_0x14d8('0x3d')]['id']}})[_0x14d8('0x21')](handleEntityNotFound(_0xbb4620,null))['then'](saveUpdates(_0xd8c6d6[_0x14d8('0x44')],null))[_0x14d8('0x21')](respondWithResult(_0xbb4620,null))[_0x14d8('0x3c')](handleError(_0xbb4620,null));};exports[_0x14d8('0x22')]=function(_0x124066,_0xdea442){return db[_0x14d8('0x29')][_0x14d8('0x42')]({'where':{'id':_0x124066[_0x14d8('0x3d')]['id']}})[_0x14d8('0x21')](handleEntityNotFound(_0xdea442,null))[_0x14d8('0x21')](removeEntity(_0xdea442,null))[_0x14d8('0x3c')](handleError(_0xdea442,null));};exports['getFields']=function(_0x3d322c,_0x3c5d61,_0x151147){var _0x60a4ff={};var _0x51a9e7={};var _0x413842;var _0x257757;return db[_0x14d8('0x29')][_0x14d8('0x45')]({'where':{'id':_0x3d322c[_0x14d8('0x3d')]['id']}})[_0x14d8('0x21')](handleEntityNotFound(_0x3c5d61,null))[_0x14d8('0x21')](function(_0x2aba13){if(_0x2aba13){_0x413842=_0x2aba13;_0x51a9e7['model']=_[_0x14d8('0x2f')](db[_0x14d8('0x46')][_0x14d8('0x2a')]);_0x51a9e7[_0x14d8('0x2e')]=_[_0x14d8('0x2f')](_0x3d322c[_0x14d8('0x2e')]);_0x51a9e7[_0x14d8('0x30')]=_[_0x14d8('0x31')](_0x51a9e7['model'],_0x51a9e7[_0x14d8('0x2e')]);_0x60a4ff[_0x14d8('0x32')]=_[_0x14d8('0x31')](_0x51a9e7[_0x14d8('0x2d')],qs[_0x14d8('0x3e')](_0x3d322c[_0x14d8('0x2e')][_0x14d8('0x3e')]));_0x60a4ff[_0x14d8('0x32')]=_0x60a4ff['attributes'][_0x14d8('0x3f')]?_0x60a4ff[_0x14d8('0x32')]:_0x51a9e7[_0x14d8('0x2d')];_0x60a4ff[_0x14d8('0x47')]=qs['sort'](_0x3d322c[_0x14d8('0x2e')]['sort']);_0x60a4ff[_0x14d8('0x35')]=qs['filters'](_[_0x14d8('0x36')](_0x3d322c[_0x14d8('0x2e')],_0x51a9e7['filters']));if(_0x3d322c[_0x14d8('0x2e')][_0x14d8('0x37')]){_0x60a4ff[_0x14d8('0x35')]=_['merge'](_0x60a4ff[_0x14d8('0x35')],{'$or':_[_0x14d8('0x28')](_0x60a4ff[_0x14d8('0x32')],function(_0x1a2797){var _0x148489={};_0x148489[_0x1a2797]={'$like':'%'+_0x3d322c[_0x14d8('0x2e')][_0x14d8('0x37')]+'%'};return _0x148489;})});}_0x60a4ff=_[_0x14d8('0x38')]({},_0x60a4ff,_0x3d322c['options']);return _0x413842['getFields'](_0x60a4ff);}})[_0x14d8('0x21')](function(_0x230c7a){if(_0x230c7a){_0x257757=_0x230c7a[_0x14d8('0x3f')];if(!_0x3d322c[_0x14d8('0x2e')][_0x14d8('0x33')]('nolimit')){_0x60a4ff[_0x14d8('0x1a')]=qs[_0x14d8('0x1a')](_0x3d322c['query'][_0x14d8('0x1a')]);_0x60a4ff[_0x14d8('0x17')]=qs[_0x14d8('0x17')](_0x3d322c[_0x14d8('0x2e')]['offset']);}return _0x413842[_0x14d8('0x48')](_0x60a4ff);}})[_0x14d8('0x21')](function(_0x34f72a){if(_0x34f72a){return _0x34f72a?{'count':_0x257757,'rows':_0x34f72a}:null;}})['then'](respondWithResult(_0x3c5d61,null))[_0x14d8('0x3c')](handleError(_0x3c5d61,null));};exports[_0x14d8('0x49')]=function(_0x328561,_0x4dd03e,_0x1c50c9){var _0x4c6b6b={};var _0x54985a={};var _0x35cc4a;var _0x1b7ae3;return db[_0x14d8('0x29')]['findOne']({'where':{'id':_0x328561[_0x14d8('0x3d')]['id']}})[_0x14d8('0x21')](handleEntityNotFound(_0x4dd03e,null))[_0x14d8('0x21')](function(_0x1d325c){if(_0x1d325c){_0x35cc4a=_0x1d325c;_0x54985a[_0x14d8('0x2d')]=_[_0x14d8('0x2f')](db[_0x14d8('0x46')]['rawAttributes']);_0x54985a['query']=_[_0x14d8('0x2f')](_0x328561[_0x14d8('0x2e')]);_0x54985a[_0x14d8('0x30')]=_[_0x14d8('0x31')](_0x54985a[_0x14d8('0x2d')],_0x54985a[_0x14d8('0x2e')]);_0x4c6b6b[_0x14d8('0x32')]=_[_0x14d8('0x31')](_0x54985a[_0x14d8('0x2d')],qs['fields'](_0x328561[_0x14d8('0x2e')][_0x14d8('0x3e')]));_0x4c6b6b[_0x14d8('0x32')]=_0x4c6b6b[_0x14d8('0x32')][_0x14d8('0x3f')]?_0x4c6b6b[_0x14d8('0x32')]:_0x54985a['model'];_0x4c6b6b[_0x14d8('0x47')]=qs[_0x14d8('0x4a')](_0x328561[_0x14d8('0x2e')]['sort']);_0x4c6b6b['where']=qs['filters'](_['pick'](_0x328561[_0x14d8('0x2e')],_0x54985a['filters']));if(_0x328561['query']['filter']){_0x4c6b6b[_0x14d8('0x35')]=_[_0x14d8('0x38')](_0x4c6b6b[_0x14d8('0x35')],{'$or':_[_0x14d8('0x28')](_0x4c6b6b[_0x14d8('0x32')],function(_0xdca086){var _0x2c910a={};_0x2c910a[_0xdca086]={'$like':'%'+_0x328561[_0x14d8('0x2e')][_0x14d8('0x37')]+'%'};return _0x2c910a;})});}_0x4c6b6b=_[_0x14d8('0x38')]({},_0x4c6b6b,_0x328561['options']);return _0x35cc4a['getSubjects'](_0x4c6b6b);}})['then'](function(_0x505da9){if(_0x505da9){_0x1b7ae3=_0x505da9[_0x14d8('0x3f')];if(!_0x328561[_0x14d8('0x2e')]['hasOwnProperty'](_0x14d8('0x34'))){_0x4c6b6b[_0x14d8('0x1a')]=qs[_0x14d8('0x1a')](_0x328561[_0x14d8('0x2e')][_0x14d8('0x1a')]);_0x4c6b6b[_0x14d8('0x17')]=qs['offset'](_0x328561[_0x14d8('0x2e')][_0x14d8('0x17')]);}return _0x35cc4a[_0x14d8('0x49')](_0x4c6b6b);}})[_0x14d8('0x21')](function(_0x53701b){if(_0x53701b){return _0x53701b?{'count':_0x1b7ae3,'rows':_0x53701b}:null;}})[_0x14d8('0x21')](respondWithResult(_0x4dd03e,null))[_0x14d8('0x3c')](handleError(_0x4dd03e,null));};exports[_0x14d8('0x4b')]=function(_0x2c709c,_0x43fc79,_0x3f92e6){var _0x5c1033={};var _0x1ef4fb={};var _0x1eb70f;var _0x448cbe;return db[_0x14d8('0x29')][_0x14d8('0x45')]({'where':{'id':_0x2c709c[_0x14d8('0x3d')]['id']}})['then'](handleEntityNotFound(_0x43fc79,null))[_0x14d8('0x21')](function(_0x303b77){if(_0x303b77){_0x1eb70f=_0x303b77;_0x1ef4fb['model']=_[_0x14d8('0x2f')](db[_0x14d8('0x46')]['rawAttributes']);_0x1ef4fb[_0x14d8('0x2e')]=_['keys'](_0x2c709c[_0x14d8('0x2e')]);_0x1ef4fb[_0x14d8('0x30')]=_[_0x14d8('0x31')](_0x1ef4fb[_0x14d8('0x2d')],_0x1ef4fb[_0x14d8('0x2e')]);_0x5c1033['attributes']=_['intersection'](_0x1ef4fb[_0x14d8('0x2d')],qs[_0x14d8('0x3e')](_0x2c709c[_0x14d8('0x2e')][_0x14d8('0x3e')]));_0x5c1033[_0x14d8('0x32')]=_0x5c1033[_0x14d8('0x32')][_0x14d8('0x3f')]?_0x5c1033[_0x14d8('0x32')]:_0x1ef4fb[_0x14d8('0x2d')];_0x5c1033[_0x14d8('0x47')]=qs[_0x14d8('0x4a')](_0x2c709c[_0x14d8('0x2e')][_0x14d8('0x4a')]);_0x5c1033[_0x14d8('0x35')]=qs['filters'](_[_0x14d8('0x36')](_0x2c709c[_0x14d8('0x2e')],_0x1ef4fb['filters']));if(_0x2c709c['query'][_0x14d8('0x37')]){_0x5c1033['where']=_[_0x14d8('0x38')](_0x5c1033[_0x14d8('0x35')],{'$or':_['map'](_0x5c1033['attributes'],function(_0xd3a477){var _0x1a0de0={};_0x1a0de0[_0xd3a477]={'$like':'%'+_0x2c709c[_0x14d8('0x2e')][_0x14d8('0x37')]+'%'};return _0x1a0de0;})});}_0x5c1033=_['merge']({},_0x5c1033,_0x2c709c[_0x14d8('0x41')]);return _0x1eb70f[_0x14d8('0x4b')](_0x5c1033);}})['then'](function(_0x2667b5){if(_0x2667b5){_0x448cbe=_0x2667b5['length'];if(!_0x2c709c[_0x14d8('0x2e')][_0x14d8('0x33')]('nolimit')){_0x5c1033[_0x14d8('0x1a')]=qs[_0x14d8('0x1a')](_0x2c709c[_0x14d8('0x2e')][_0x14d8('0x1a')]);_0x5c1033[_0x14d8('0x17')]=qs['offset'](_0x2c709c[_0x14d8('0x2e')][_0x14d8('0x17')]);}return _0x1eb70f[_0x14d8('0x4b')](_0x5c1033);}})['then'](function(_0x218d86){if(_0x218d86){return _0x218d86?{'count':_0x448cbe,'rows':_0x218d86}:null;}})['then'](respondWithResult(_0x43fc79,null))[_0x14d8('0x3c')](handleError(_0x43fc79,null));};exports[_0x14d8('0x4c')]=function(_0x5aa54f,_0x2099ad,_0x4092e6){var _0x64661c={};var _0x56a185={};var _0x4d95a5;var _0x583419;return db[_0x14d8('0x29')][_0x14d8('0x45')]({'where':{'id':_0x5aa54f['params']['id']}})[_0x14d8('0x21')](handleEntityNotFound(_0x2099ad,null))[_0x14d8('0x21')](function(_0x3ef765){if(_0x3ef765){_0x4d95a5=_0x3ef765;_0x56a185['model']=_[_0x14d8('0x2f')](db[_0x14d8('0x4d')][_0x14d8('0x2a')]);_0x56a185[_0x14d8('0x2e')]=_['keys'](_0x5aa54f[_0x14d8('0x2e')]);_0x56a185['filters']=_[_0x14d8('0x31')](_0x56a185['model'],_0x56a185['query']);_0x64661c[_0x14d8('0x32')]=_[_0x14d8('0x31')](_0x56a185[_0x14d8('0x2d')],qs[_0x14d8('0x3e')](_0x5aa54f[_0x14d8('0x2e')]['fields']));_0x64661c[_0x14d8('0x32')]=_0x64661c[_0x14d8('0x32')][_0x14d8('0x3f')]?_0x64661c[_0x14d8('0x32')]:_0x56a185['model'];_0x64661c[_0x14d8('0x47')]=qs['sort'](_0x5aa54f[_0x14d8('0x2e')]['sort']);_0x64661c[_0x14d8('0x35')]=qs['filters'](_['pick'](_0x5aa54f[_0x14d8('0x2e')],_0x56a185['filters']));if(_0x5aa54f[_0x14d8('0x2e')][_0x14d8('0x37')]){_0x64661c[_0x14d8('0x35')]=_[_0x14d8('0x38')](_0x64661c[_0x14d8('0x35')],{'$or':_['map'](_0x64661c[_0x14d8('0x32')],function(_0x40c658){var _0xdaf9bd={};_0xdaf9bd[_0x40c658]={'$like':'%'+_0x5aa54f['query'][_0x14d8('0x37')]+'%'};return _0xdaf9bd;})});}_0x64661c=_[_0x14d8('0x38')]({},_0x64661c,_0x5aa54f['options']);return _0x4d95a5[_0x14d8('0x4c')](_0x64661c);}})[_0x14d8('0x21')](function(_0x9f92d7){if(_0x9f92d7){_0x583419=_0x9f92d7[_0x14d8('0x3f')];if(!_0x5aa54f[_0x14d8('0x2e')][_0x14d8('0x33')](_0x14d8('0x34'))){_0x64661c[_0x14d8('0x1a')]=qs[_0x14d8('0x1a')](_0x5aa54f[_0x14d8('0x2e')][_0x14d8('0x1a')]);_0x64661c[_0x14d8('0x17')]=qs[_0x14d8('0x17')](_0x5aa54f[_0x14d8('0x2e')][_0x14d8('0x17')]);}return _0x4d95a5[_0x14d8('0x4c')](_0x64661c);}})[_0x14d8('0x21')](function(_0x256eb8){if(_0x256eb8){return _0x256eb8?{'count':_0x583419,'rows':_0x256eb8}:null;}})[_0x14d8('0x21')](respondWithResult(_0x2099ad,null))[_0x14d8('0x3c')](handleError(_0x2099ad,null));};exports['setTags']=function(_0x1edf19,_0x2f25b9,_0x2141e1){if(_0x1edf19[_0x14d8('0x44')]['id']){delete _0x1edf19[_0x14d8('0x44')]['id'];}return db[_0x14d8('0x29')]['findOne']({'where':{'id':_0x1edf19['params']['id']}})[_0x14d8('0x21')](handleEntityNotFound(_0x2f25b9,null))['then'](function(_0x137ba3){if(_0x137ba3){return _0x137ba3[_0x14d8('0x4e')](_0x1edf19['body'][_0x14d8('0x4f')]||[]);}return null;})[_0x14d8('0x21')](respondWithResult(_0x2f25b9,null))[_0x14d8('0x3c')](handleError(_0x2f25b9,null));}; \ No newline at end of file +var _0xd0e7=['Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','error','name','send','index','map','DeskConfiguration','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','getFields','findOne','pick','getSubjects','rawAttributes','hasOwnProperty','getDescriptions','DeskField','getTags'];(function(_0x3ca6c1,_0x1c9e15){var _0xc43f29=function(_0x68e585){while(--_0x68e585){_0x3ca6c1['push'](_0x3ca6c1['shift']());}};_0xc43f29(++_0x1c9e15);}(_0xd0e7,0x1bb));var _0x7d0e=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xd0e7[_0x59d0cc];return _0x2ae79f;};'use strict';var emlformat=require(_0x7d0e('0x0'));var rimraf=require(_0x7d0e('0x1'));var zipdir=require(_0x7d0e('0x2'));var jsonpatch=require(_0x7d0e('0x3'));var rp=require(_0x7d0e('0x4'));var moment=require(_0x7d0e('0x5'));var BPromise=require(_0x7d0e('0x6'));var Mustache=require(_0x7d0e('0x7'));var util=require(_0x7d0e('0x8'));var path=require(_0x7d0e('0x9'));var sox=require(_0x7d0e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d0e('0xb'));var _=require(_0x7d0e('0xc'));var squel=require('squel');var crypto=require(_0x7d0e('0xd'));var jsforce=require(_0x7d0e('0xe'));var deskjs=require(_0x7d0e('0xf'));var toCsv=require(_0x7d0e('0x10'));var querystring=require(_0x7d0e('0x11'));var Papa=require(_0x7d0e('0x12'));var Redis=require('ioredis');var authService=require(_0x7d0e('0x13'));var qs=require(_0x7d0e('0x14'));var as=require(_0x7d0e('0x15'));var hardwareService=require(_0x7d0e('0x16'));var logger=require(_0x7d0e('0x17'))('api');var utils=require(_0x7d0e('0x18'));var config=require(_0x7d0e('0x19'));var licenseUtil=require(_0x7d0e('0x1a'));var db=require(_0x7d0e('0x1b'))['db'];function respondWithStatusCode(_0x34d8a8,_0x5c360d){_0x5c360d=_0x5c360d||0xcc;return function(_0x282643){if(_0x282643){return _0x34d8a8[_0x7d0e('0x1c')](_0x5c360d);}return _0x34d8a8[_0x7d0e('0x1d')](_0x5c360d)[_0x7d0e('0x1e')]();};}function respondWithResult(_0x63d331,_0x453a4d){_0x453a4d=_0x453a4d||0xc8;return function(_0x16cbbb){if(_0x16cbbb){return _0x63d331[_0x7d0e('0x1d')](_0x453a4d)[_0x7d0e('0x1f')](_0x16cbbb);}};}function respondWithFilteredResult(_0xda189,_0x59da82){return function(_0x16554b){if(_0x16554b){var _0x307a0d=typeof _0x59da82[_0x7d0e('0x20')]===_0x7d0e('0x21')&&typeof _0x59da82['limit']===_0x7d0e('0x21');var _0x428179=_0x16554b[_0x7d0e('0x22')];var _0x2177b2=_0x307a0d?0x0:_0x59da82[_0x7d0e('0x20')];var _0xee4f00=_0x307a0d?_0x16554b[_0x7d0e('0x22')]:_0x59da82['offset']+_0x59da82[_0x7d0e('0x23')];var _0x1b6ad8;if(_0xee4f00>=_0x428179){_0xee4f00=_0x428179;_0x1b6ad8=0xc8;}else{_0x1b6ad8=0xce;}_0xda189['status'](_0x1b6ad8);return _0xda189[_0x7d0e('0x24')]('Content-Range',_0x2177b2+'-'+_0xee4f00+'/'+_0x428179)['json'](_0x16554b);}return null;};}function patchUpdates(_0x32c274){return function(_0x4bcbd8){try{jsonpatch[_0x7d0e('0x25')](_0x4bcbd8,_0x32c274,!![]);}catch(_0x5abf38){return BPromise[_0x7d0e('0x26')](_0x5abf38);}return _0x4bcbd8[_0x7d0e('0x27')]();};}function saveUpdates(_0x40f553,_0xeaa5ce){return function(_0x34e6b5){if(_0x34e6b5){return _0x34e6b5['update'](_0x40f553)['then'](function(_0x1a61b5){return _0x1a61b5;});}return null;};}function removeEntity(_0x2f857b,_0x374079){return function(_0x48be45){if(_0x48be45){return _0x48be45[_0x7d0e('0x28')]()[_0x7d0e('0x29')](function(){_0x2f857b[_0x7d0e('0x1d')](0xcc)[_0x7d0e('0x1e')]();});}};}function handleEntityNotFound(_0x44522e,_0x56fac8){return function(_0x5d486a){if(!_0x5d486a){_0x44522e['sendStatus'](0x194);}return _0x5d486a;};}function handleError(_0x8deb1d,_0x333495){_0x333495=_0x333495||0x1f4;return function(_0x34cc9f){logger[_0x7d0e('0x2a')](_0x34cc9f['stack']);if(_0x34cc9f[_0x7d0e('0x2b')]){delete _0x34cc9f['name'];}_0x8deb1d['status'](_0x333495)[_0x7d0e('0x2c')](_0x34cc9f);};}exports[_0x7d0e('0x2d')]=function(_0x445aac,_0x613bbd){var _0x25767d={},_0x105b07={},_0x12d7c6={'count':0x0,'rows':[]};var _0x261774=_[_0x7d0e('0x2e')](db[_0x7d0e('0x2f')]['rawAttributes'],function(_0x9a944){return{'name':_0x9a944[_0x7d0e('0x30')],'type':_0x9a944[_0x7d0e('0x31')][_0x7d0e('0x32')]};});_0x105b07[_0x7d0e('0x33')]=_[_0x7d0e('0x2e')](_0x261774,_0x7d0e('0x2b'));_0x105b07['query']=_[_0x7d0e('0x34')](_0x445aac['query']);_0x105b07[_0x7d0e('0x35')]=_[_0x7d0e('0x36')](_0x105b07[_0x7d0e('0x33')],_0x105b07[_0x7d0e('0x37')]);_0x25767d[_0x7d0e('0x38')]=_[_0x7d0e('0x36')](_0x105b07[_0x7d0e('0x33')],qs['fields'](_0x445aac['query'][_0x7d0e('0x39')]));_0x25767d[_0x7d0e('0x38')]=_0x25767d[_0x7d0e('0x38')][_0x7d0e('0x3a')]?_0x25767d[_0x7d0e('0x38')]:_0x105b07[_0x7d0e('0x33')];if(!_0x445aac[_0x7d0e('0x37')]['hasOwnProperty'](_0x7d0e('0x3b'))){_0x25767d[_0x7d0e('0x23')]=qs[_0x7d0e('0x23')](_0x445aac[_0x7d0e('0x37')][_0x7d0e('0x23')]);_0x25767d[_0x7d0e('0x20')]=qs[_0x7d0e('0x20')](_0x445aac[_0x7d0e('0x37')][_0x7d0e('0x20')]);}_0x25767d[_0x7d0e('0x3c')]=qs[_0x7d0e('0x3d')](_0x445aac[_0x7d0e('0x37')][_0x7d0e('0x3d')]);_0x25767d[_0x7d0e('0x3e')]=qs['filters'](_['pick'](_0x445aac['query'],_0x105b07[_0x7d0e('0x35')]),_0x261774);if(_0x445aac[_0x7d0e('0x37')][_0x7d0e('0x3f')]){_0x25767d['where']=_[_0x7d0e('0x40')](_0x25767d['where'],{'$or':_['map'](_0x261774,function(_0x25ff1e){if(_0x25ff1e[_0x7d0e('0x31')]!==_0x7d0e('0x41')){var _0x62f74a={};_0x62f74a[_0x25ff1e[_0x7d0e('0x2b')]]={'$like':'%'+_0x445aac[_0x7d0e('0x37')][_0x7d0e('0x3f')]+'%'};return _0x62f74a;}})});}_0x25767d=_['merge']({},_0x25767d,_0x445aac[_0x7d0e('0x42')]);var _0xa9b928={'where':_0x25767d[_0x7d0e('0x3e')]};return db[_0x7d0e('0x2f')][_0x7d0e('0x22')](_0xa9b928)[_0x7d0e('0x29')](function(_0x2ab7c9){_0x12d7c6['count']=_0x2ab7c9;if(_0x445aac[_0x7d0e('0x37')][_0x7d0e('0x43')]){_0x25767d[_0x7d0e('0x44')]=[{'all':!![]}];}return db[_0x7d0e('0x2f')][_0x7d0e('0x45')](_0x25767d);})[_0x7d0e('0x29')](function(_0x3de610){_0x12d7c6[_0x7d0e('0x46')]=_0x3de610;return _0x12d7c6;})[_0x7d0e('0x29')](respondWithFilteredResult(_0x613bbd,_0x25767d))[_0x7d0e('0x47')](handleError(_0x613bbd,null));};exports['show']=function(_0x42017b,_0x43ec7e){var _0x3b7d50={'raw':![],'where':{'id':_0x42017b[_0x7d0e('0x48')]['id']}},_0x3d5934={};_0x3d5934[_0x7d0e('0x33')]=_['keys'](db[_0x7d0e('0x2f')]['rawAttributes']);_0x3d5934['query']=_[_0x7d0e('0x34')](_0x42017b['query']);_0x3d5934[_0x7d0e('0x35')]=_[_0x7d0e('0x36')](_0x3d5934[_0x7d0e('0x33')],_0x3d5934[_0x7d0e('0x37')]);_0x3b7d50[_0x7d0e('0x38')]=_[_0x7d0e('0x36')](_0x3d5934[_0x7d0e('0x33')],qs['fields'](_0x42017b[_0x7d0e('0x37')][_0x7d0e('0x39')]));_0x3b7d50['attributes']=_0x3b7d50[_0x7d0e('0x38')][_0x7d0e('0x3a')]?_0x3b7d50['attributes']:_0x3d5934['model'];if(_0x42017b[_0x7d0e('0x37')][_0x7d0e('0x43')]){_0x3b7d50['include']=[{'all':!![]}];}_0x3b7d50=_['merge']({},_0x3b7d50,_0x42017b[_0x7d0e('0x42')]);return db[_0x7d0e('0x2f')]['find'](_0x3b7d50)['then'](handleEntityNotFound(_0x43ec7e,null))[_0x7d0e('0x29')](respondWithResult(_0x43ec7e,null))['catch'](handleError(_0x43ec7e,null));};exports[_0x7d0e('0x49')]=function(_0x867834,_0x410169){return db[_0x7d0e('0x2f')][_0x7d0e('0x49')](_0x867834[_0x7d0e('0x4a')],{})['then'](respondWithResult(_0x410169,0xc9))[_0x7d0e('0x47')](handleError(_0x410169,null));};exports['update']=function(_0x53e9b4,_0x5d172b){if(_0x53e9b4['body']['id']){delete _0x53e9b4[_0x7d0e('0x4a')]['id'];}return db[_0x7d0e('0x2f')][_0x7d0e('0x4b')]({'where':{'id':_0x53e9b4[_0x7d0e('0x48')]['id']}})[_0x7d0e('0x29')](handleEntityNotFound(_0x5d172b,null))['then'](saveUpdates(_0x53e9b4['body'],null))[_0x7d0e('0x29')](respondWithResult(_0x5d172b,null))[_0x7d0e('0x47')](handleError(_0x5d172b,null));};exports[_0x7d0e('0x28')]=function(_0x33a765,_0x4afd23){return db[_0x7d0e('0x2f')][_0x7d0e('0x4b')]({'where':{'id':_0x33a765[_0x7d0e('0x48')]['id']}})['then'](handleEntityNotFound(_0x4afd23,null))[_0x7d0e('0x29')](removeEntity(_0x4afd23,null))[_0x7d0e('0x47')](handleError(_0x4afd23,null));};exports[_0x7d0e('0x4c')]=function(_0x57e917,_0x57df30,_0x4a6328){var _0x11782d={};var _0x27a609={};var _0x127b36;var _0x26a4b0;return db[_0x7d0e('0x2f')][_0x7d0e('0x4d')]({'where':{'id':_0x57e917[_0x7d0e('0x48')]['id']}})[_0x7d0e('0x29')](handleEntityNotFound(_0x57df30,null))['then'](function(_0x401d56){if(_0x401d56){_0x127b36=_0x401d56;_0x27a609[_0x7d0e('0x33')]=_[_0x7d0e('0x34')](db['DeskField']['rawAttributes']);_0x27a609[_0x7d0e('0x37')]=_['keys'](_0x57e917[_0x7d0e('0x37')]);_0x27a609['filters']=_[_0x7d0e('0x36')](_0x27a609[_0x7d0e('0x33')],_0x27a609[_0x7d0e('0x37')]);_0x11782d[_0x7d0e('0x38')]=_[_0x7d0e('0x36')](_0x27a609[_0x7d0e('0x33')],qs[_0x7d0e('0x39')](_0x57e917[_0x7d0e('0x37')]['fields']));_0x11782d['attributes']=_0x11782d['attributes'][_0x7d0e('0x3a')]?_0x11782d['attributes']:_0x27a609[_0x7d0e('0x33')];_0x11782d[_0x7d0e('0x3c')]=qs[_0x7d0e('0x3d')](_0x57e917[_0x7d0e('0x37')]['sort']);_0x11782d['where']=qs[_0x7d0e('0x35')](_[_0x7d0e('0x4e')](_0x57e917[_0x7d0e('0x37')],_0x27a609['filters']));if(_0x57e917[_0x7d0e('0x37')]['filter']){_0x11782d[_0x7d0e('0x3e')]=_[_0x7d0e('0x40')](_0x11782d['where'],{'$or':_[_0x7d0e('0x2e')](_0x11782d['attributes'],function(_0x2c6f77){var _0x4151e4={};_0x4151e4[_0x2c6f77]={'$like':'%'+_0x57e917['query'][_0x7d0e('0x3f')]+'%'};return _0x4151e4;})});}_0x11782d=_['merge']({},_0x11782d,_0x57e917['options']);return _0x127b36[_0x7d0e('0x4c')](_0x11782d);}})['then'](function(_0x19c488){if(_0x19c488){_0x26a4b0=_0x19c488['length'];if(!_0x57e917[_0x7d0e('0x37')]['hasOwnProperty']('nolimit')){_0x11782d[_0x7d0e('0x23')]=qs[_0x7d0e('0x23')](_0x57e917[_0x7d0e('0x37')][_0x7d0e('0x23')]);_0x11782d[_0x7d0e('0x20')]=qs[_0x7d0e('0x20')](_0x57e917[_0x7d0e('0x37')][_0x7d0e('0x20')]);}return _0x127b36[_0x7d0e('0x4c')](_0x11782d);}})[_0x7d0e('0x29')](function(_0xe3c9fd){if(_0xe3c9fd){return _0xe3c9fd?{'count':_0x26a4b0,'rows':_0xe3c9fd}:null;}})['then'](respondWithResult(_0x57df30,null))[_0x7d0e('0x47')](handleError(_0x57df30,null));};exports[_0x7d0e('0x4f')]=function(_0x5c5874,_0x3a8b0c,_0x16ae82){var _0x314971={};var _0x18b36f={};var _0x17617d;var _0x4f2cf9;return db[_0x7d0e('0x2f')][_0x7d0e('0x4d')]({'where':{'id':_0x5c5874['params']['id']}})[_0x7d0e('0x29')](handleEntityNotFound(_0x3a8b0c,null))[_0x7d0e('0x29')](function(_0xc51d19){if(_0xc51d19){_0x17617d=_0xc51d19;_0x18b36f[_0x7d0e('0x33')]=_['keys'](db['DeskField'][_0x7d0e('0x50')]);_0x18b36f[_0x7d0e('0x37')]=_[_0x7d0e('0x34')](_0x5c5874[_0x7d0e('0x37')]);_0x18b36f['filters']=_[_0x7d0e('0x36')](_0x18b36f['model'],_0x18b36f[_0x7d0e('0x37')]);_0x314971[_0x7d0e('0x38')]=_[_0x7d0e('0x36')](_0x18b36f[_0x7d0e('0x33')],qs[_0x7d0e('0x39')](_0x5c5874[_0x7d0e('0x37')][_0x7d0e('0x39')]));_0x314971[_0x7d0e('0x38')]=_0x314971[_0x7d0e('0x38')][_0x7d0e('0x3a')]?_0x314971[_0x7d0e('0x38')]:_0x18b36f[_0x7d0e('0x33')];_0x314971[_0x7d0e('0x3c')]=qs[_0x7d0e('0x3d')](_0x5c5874[_0x7d0e('0x37')]['sort']);_0x314971[_0x7d0e('0x3e')]=qs[_0x7d0e('0x35')](_[_0x7d0e('0x4e')](_0x5c5874['query'],_0x18b36f[_0x7d0e('0x35')]));if(_0x5c5874[_0x7d0e('0x37')][_0x7d0e('0x3f')]){_0x314971['where']=_['merge'](_0x314971['where'],{'$or':_[_0x7d0e('0x2e')](_0x314971[_0x7d0e('0x38')],function(_0x2ebe0d){var _0x212203={};_0x212203[_0x2ebe0d]={'$like':'%'+_0x5c5874[_0x7d0e('0x37')]['filter']+'%'};return _0x212203;})});}_0x314971=_['merge']({},_0x314971,_0x5c5874['options']);return _0x17617d[_0x7d0e('0x4f')](_0x314971);}})[_0x7d0e('0x29')](function(_0x26788c){if(_0x26788c){_0x4f2cf9=_0x26788c[_0x7d0e('0x3a')];if(!_0x5c5874[_0x7d0e('0x37')][_0x7d0e('0x51')](_0x7d0e('0x3b'))){_0x314971['limit']=qs['limit'](_0x5c5874[_0x7d0e('0x37')][_0x7d0e('0x23')]);_0x314971[_0x7d0e('0x20')]=qs[_0x7d0e('0x20')](_0x5c5874[_0x7d0e('0x37')][_0x7d0e('0x20')]);}return _0x17617d['getSubjects'](_0x314971);}})[_0x7d0e('0x29')](function(_0x577583){if(_0x577583){return _0x577583?{'count':_0x4f2cf9,'rows':_0x577583}:null;}})['then'](respondWithResult(_0x3a8b0c,null))['catch'](handleError(_0x3a8b0c,null));};exports[_0x7d0e('0x52')]=function(_0xcece11,_0x126b67,_0x2e180e){var _0x181613={};var _0x450f06={};var _0x28751c;var _0x26c258;return db[_0x7d0e('0x2f')][_0x7d0e('0x4d')]({'where':{'id':_0xcece11['params']['id']}})['then'](handleEntityNotFound(_0x126b67,null))[_0x7d0e('0x29')](function(_0x19b2d6){if(_0x19b2d6){_0x28751c=_0x19b2d6;_0x450f06[_0x7d0e('0x33')]=_['keys'](db[_0x7d0e('0x53')]['rawAttributes']);_0x450f06[_0x7d0e('0x37')]=_['keys'](_0xcece11['query']);_0x450f06['filters']=_[_0x7d0e('0x36')](_0x450f06[_0x7d0e('0x33')],_0x450f06[_0x7d0e('0x37')]);_0x181613[_0x7d0e('0x38')]=_[_0x7d0e('0x36')](_0x450f06[_0x7d0e('0x33')],qs[_0x7d0e('0x39')](_0xcece11[_0x7d0e('0x37')][_0x7d0e('0x39')]));_0x181613[_0x7d0e('0x38')]=_0x181613[_0x7d0e('0x38')][_0x7d0e('0x3a')]?_0x181613[_0x7d0e('0x38')]:_0x450f06[_0x7d0e('0x33')];_0x181613[_0x7d0e('0x3c')]=qs['sort'](_0xcece11[_0x7d0e('0x37')][_0x7d0e('0x3d')]);_0x181613[_0x7d0e('0x3e')]=qs['filters'](_['pick'](_0xcece11[_0x7d0e('0x37')],_0x450f06[_0x7d0e('0x35')]));if(_0xcece11[_0x7d0e('0x37')][_0x7d0e('0x3f')]){_0x181613['where']=_['merge'](_0x181613['where'],{'$or':_[_0x7d0e('0x2e')](_0x181613[_0x7d0e('0x38')],function(_0x5b3b26){var _0x15493e={};_0x15493e[_0x5b3b26]={'$like':'%'+_0xcece11[_0x7d0e('0x37')][_0x7d0e('0x3f')]+'%'};return _0x15493e;})});}_0x181613=_[_0x7d0e('0x40')]({},_0x181613,_0xcece11[_0x7d0e('0x42')]);return _0x28751c[_0x7d0e('0x52')](_0x181613);}})[_0x7d0e('0x29')](function(_0x5ec085){if(_0x5ec085){_0x26c258=_0x5ec085[_0x7d0e('0x3a')];if(!_0xcece11[_0x7d0e('0x37')][_0x7d0e('0x51')]('nolimit')){_0x181613[_0x7d0e('0x23')]=qs[_0x7d0e('0x23')](_0xcece11[_0x7d0e('0x37')][_0x7d0e('0x23')]);_0x181613[_0x7d0e('0x20')]=qs[_0x7d0e('0x20')](_0xcece11[_0x7d0e('0x37')][_0x7d0e('0x20')]);}return _0x28751c[_0x7d0e('0x52')](_0x181613);}})[_0x7d0e('0x29')](function(_0x37fd8d){if(_0x37fd8d){return _0x37fd8d?{'count':_0x26c258,'rows':_0x37fd8d}:null;}})[_0x7d0e('0x29')](respondWithResult(_0x126b67,null))[_0x7d0e('0x47')](handleError(_0x126b67,null));};exports[_0x7d0e('0x54')]=function(_0x17a3fe,_0x4335a1,_0x32b89a){var _0x334944={};var _0x2429df={};var _0x20cff3;var _0x4caef7;return db[_0x7d0e('0x2f')][_0x7d0e('0x4d')]({'where':{'id':_0x17a3fe[_0x7d0e('0x48')]['id']}})[_0x7d0e('0x29')](handleEntityNotFound(_0x4335a1,null))[_0x7d0e('0x29')](function(_0x58c638){if(_0x58c638){_0x20cff3=_0x58c638;_0x2429df[_0x7d0e('0x33')]=_[_0x7d0e('0x34')](db[_0x7d0e('0x55')]['rawAttributes']);_0x2429df['query']=_[_0x7d0e('0x34')](_0x17a3fe[_0x7d0e('0x37')]);_0x2429df['filters']=_[_0x7d0e('0x36')](_0x2429df[_0x7d0e('0x33')],_0x2429df[_0x7d0e('0x37')]);_0x334944[_0x7d0e('0x38')]=_[_0x7d0e('0x36')](_0x2429df['model'],qs[_0x7d0e('0x39')](_0x17a3fe['query'][_0x7d0e('0x39')]));_0x334944[_0x7d0e('0x38')]=_0x334944[_0x7d0e('0x38')][_0x7d0e('0x3a')]?_0x334944['attributes']:_0x2429df[_0x7d0e('0x33')];_0x334944[_0x7d0e('0x3c')]=qs[_0x7d0e('0x3d')](_0x17a3fe[_0x7d0e('0x37')]['sort']);_0x334944[_0x7d0e('0x3e')]=qs[_0x7d0e('0x35')](_[_0x7d0e('0x4e')](_0x17a3fe[_0x7d0e('0x37')],_0x2429df[_0x7d0e('0x35')]));if(_0x17a3fe[_0x7d0e('0x37')][_0x7d0e('0x3f')]){_0x334944[_0x7d0e('0x3e')]=_[_0x7d0e('0x40')](_0x334944[_0x7d0e('0x3e')],{'$or':_[_0x7d0e('0x2e')](_0x334944[_0x7d0e('0x38')],function(_0x2fd8ca){var _0x5486a1={};_0x5486a1[_0x2fd8ca]={'$like':'%'+_0x17a3fe['query']['filter']+'%'};return _0x5486a1;})});}_0x334944=_[_0x7d0e('0x40')]({},_0x334944,_0x17a3fe[_0x7d0e('0x42')]);return _0x20cff3[_0x7d0e('0x54')](_0x334944);}})[_0x7d0e('0x29')](function(_0x18ed1b){if(_0x18ed1b){_0x4caef7=_0x18ed1b[_0x7d0e('0x3a')];if(!_0x17a3fe[_0x7d0e('0x37')][_0x7d0e('0x51')](_0x7d0e('0x3b'))){_0x334944[_0x7d0e('0x23')]=qs['limit'](_0x17a3fe[_0x7d0e('0x37')][_0x7d0e('0x23')]);_0x334944[_0x7d0e('0x20')]=qs[_0x7d0e('0x20')](_0x17a3fe[_0x7d0e('0x37')][_0x7d0e('0x20')]);}return _0x20cff3[_0x7d0e('0x54')](_0x334944);}})[_0x7d0e('0x29')](function(_0x287940){if(_0x287940){return _0x287940?{'count':_0x4caef7,'rows':_0x287940}:null;}})[_0x7d0e('0x29')](respondWithResult(_0x4335a1,null))[_0x7d0e('0x47')](handleError(_0x4335a1,null));};exports['setTags']=function(_0x33780c,_0x2d17a3,_0x42a9c2){if(_0x33780c[_0x7d0e('0x4a')]['id']){delete _0x33780c[_0x7d0e('0x4a')]['id'];}return db['DeskConfiguration'][_0x7d0e('0x4d')]({'where':{'id':_0x33780c[_0x7d0e('0x48')]['id']}})[_0x7d0e('0x29')](handleEntityNotFound(_0x2d17a3,null))[_0x7d0e('0x29')](function(_0x28b97e){if(_0x28b97e){return _0x28b97e[_0x7d0e('0x56')](_0x33780c[_0x7d0e('0x4a')][_0x7d0e('0x57')]||[]);}return null;})[_0x7d0e('0x29')](respondWithResult(_0x2d17a3,null))[_0x7d0e('0x47')](handleError(_0x2d17a3,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index a39cef7..f331144 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 _0x6d4a=['rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d4a,0x117));var _0xa6d4=function(_0x10bc0a,_0x53582e){_0x10bc0a=_0x10bc0a-0x0;var _0x3286f0=_0x6d4a[_0x10bc0a];return _0x3286f0;};'use strict';var _=require(_0xa6d4('0x0'));var util=require('util');var logger=require(_0xa6d4('0x1'))(_0xa6d4('0x2'));var moment=require(_0xa6d4('0x3'));var BPromise=require(_0xa6d4('0x4'));var rp=require(_0xa6d4('0x5'));var fs=require('fs');var path=require(_0xa6d4('0x6'));var rimraf=require(_0xa6d4('0x7'));var config=require(_0xa6d4('0x8'));var attributes=require(_0xa6d4('0x9'));module[_0xa6d4('0xa')]=function(_0x25a720,_0xe6dda6){return _0x25a720[_0xa6d4('0xb')](_0xa6d4('0xc'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06d3=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','api','moment','request-promise'];(function(_0x33bd25,_0x26a42c){var _0x5e8c9c=function(_0x791964){while(--_0x791964){_0x33bd25['push'](_0x33bd25['shift']());}};_0x5e8c9c(++_0x26a42c);}(_0x06d3,0xcd));var _0x306d=function(_0x507ab1,_0x9d31eb){_0x507ab1=_0x507ab1-0x0;var _0x3cd4b6=_0x06d3[_0x507ab1];return _0x3cd4b6;};'use strict';var _=require(_0x306d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x306d('0x1'));var moment=require(_0x306d('0x2'));var BPromise=require('bluebird');var rp=require(_0x306d('0x3'));var fs=require('fs');var path=require(_0x306d('0x4'));var rimraf=require(_0x306d('0x5'));var config=require(_0x306d('0x6'));var attributes=require(_0x306d('0x7'));module[_0x306d('0x8')]=function(_0x238cee,_0x251aed){return _0x238cee['define'](_0x306d('0x9'),attributes,{'tableName':_0x306d('0xa'),'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 91f342f..39c7f9f 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 _0x9e6d=['error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1c5417,_0x21b96c){var _0x5b2ec0=function(_0x17bdf2){while(--_0x17bdf2){_0x1c5417['push'](_0x1c5417['shift']());}};_0x5b2ec0(++_0x21b96c);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x9d485,_0x21d5fb){_0x9d485=_0x9d485-0x0;var _0x530758=_0x9e6d[_0x9d485];return _0x530758;};'use strict';var _=require(_0xd9e6('0x0'));var util=require('util');var moment=require(_0xd9e6('0x1'));var BPromise=require(_0xd9e6('0x2'));var rs=require(_0xd9e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9e6('0x4'))['db'];var utils=require(_0xd9e6('0x5'));var logger=require(_0xd9e6('0x6'))(_0xd9e6('0x7'));var config=require('../../config/environment');var jayson=require(_0xd9e6('0x8'));var client=jayson[_0xd9e6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57a688,_0x1cb696,_0x44ac22){return new BPromise(function(_0x1103ba,_0x5b296b){return client[_0xd9e6('0xa')](_0x57a688,_0x44ac22)[_0xd9e6('0xb')](function(_0x596895){logger[_0xd9e6('0xc')](_0xd9e6('0xd'),_0x1cb696,'request\x20sent');logger['debug'](_0xd9e6('0xe'),_0x1cb696,_0xd9e6('0xf'),JSON[_0xd9e6('0x10')](_0x596895));if(_0x596895[_0xd9e6('0x11')]){if(_0x596895[_0xd9e6('0x11')][_0xd9e6('0x12')]===0x1f4){logger[_0xd9e6('0x11')](_0xd9e6('0xd'),_0x1cb696,_0x596895[_0xd9e6('0x11')]['message']);return _0x5b296b(_0x596895[_0xd9e6('0x11')][_0xd9e6('0x13')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x1cb696,_0x596895[_0xd9e6('0x11')]['message']);return _0x1103ba(_0x596895[_0xd9e6('0x11')][_0xd9e6('0x13')]);}else{logger[_0xd9e6('0xc')](_0xd9e6('0xd'),_0x1cb696,_0xd9e6('0xf'));_0x1103ba(_0x596895['result']['message']);}})[_0xd9e6('0x14')](function(_0x5dfc4b){logger[_0xd9e6('0x11')](_0xd9e6('0xd'),_0x1cb696,_0x5dfc4b);_0x5b296b(_0x5dfc4b);});});} \ No newline at end of file +var _0x0447=['request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','DeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x273408,_0x417fdd){var _0x413f82=function(_0x4ede40){while(--_0x4ede40){_0x273408['push'](_0x273408['shift']());}};_0x413f82(++_0x417fdd);}(_0x0447,0x8b));var _0x7044=function(_0x4e0159,_0x528421){_0x4e0159=_0x4e0159-0x0;var _0x2e0d6d=_0x0447[_0x4e0159];return _0x2e0d6d;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var moment=require(_0x7044('0x2'));var BPromise=require(_0x7044('0x3'));var rs=require(_0x7044('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7044('0x5'))['db'];var utils=require(_0x7044('0x6'));var logger=require(_0x7044('0x7'))(_0x7044('0x8'));var config=require(_0x7044('0x9'));var jayson=require(_0x7044('0xa'));var client=jayson[_0x7044('0xb')][_0x7044('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x66b8cb,_0x51de50,_0x72d341){return new BPromise(function(_0x42d53b,_0x2a2b36){return client[_0x7044('0xd')](_0x66b8cb,_0x72d341)['then'](function(_0x41616d){logger[_0x7044('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x51de50,_0x7044('0xf'));logger[_0x7044('0x10')](_0x7044('0x11'),_0x51de50,_0x7044('0xf'),JSON['stringify'](_0x41616d));if(_0x41616d[_0x7044('0x12')]){if(_0x41616d['error']['code']===0x1f4){logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')][_0x7044('0x14')]);return _0x2a2b36(_0x41616d[_0x7044('0x12')]['message']);}logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')]['message']);return _0x42d53b(_0x41616d['error'][_0x7044('0x14')]);}else{logger[_0x7044('0xe')](_0x7044('0x13'),_0x51de50,_0x7044('0xf'));_0x42d53b(_0x41616d[_0x7044('0x15')][_0x7044('0x14')]);}})['catch'](function(_0xdae8a){logger[_0x7044('0x12')](_0x7044('0x13'),_0x51de50,_0xdae8a);_0x2a2b36(_0xdae8a);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 2a9eabb..33cb15e 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 _0xf161=['index','get','/:id','show','post','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated'];(function(_0x4c7858,_0x617df4){var _0x393be7=function(_0x4dad42){while(--_0x4dad42){_0x4c7858['push'](_0x4c7858['shift']());}};_0x393be7(++_0x617df4);}(_0xf161,0x1d1));var _0x1f16=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xf161[_0x4ed4d2];return _0x15ae2e;};'use strict';var multer=require(_0x1f16('0x0'));var util=require(_0x1f16('0x1'));var path=require(_0x1f16('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f16('0x3'));var router=express[_0x1f16('0x4')]();var fs_extra=require(_0x1f16('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f16('0x6'));var config=require(_0x1f16('0x7'));var controller=require(_0x1f16('0x8'));router['get']('/',auth[_0x1f16('0x9')](),controller[_0x1f16('0xa')]);router[_0x1f16('0xb')](_0x1f16('0xc'),auth[_0x1f16('0x9')](),controller[_0x1f16('0xd')]);router[_0x1f16('0xe')]('/',auth[_0x1f16('0x9')](),controller['create']);router[_0x1f16('0xf')](_0x1f16('0xc'),auth[_0x1f16('0x9')](),controller['update']);router[_0x1f16('0x10')](_0x1f16('0xc'),auth[_0x1f16('0x9')](),controller[_0x1f16('0x11')]);module[_0x1f16('0x12')]=router; \ No newline at end of file +var _0xe676=['isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get'];(function(_0x3ed727,_0xfbaa56){var _0x56e015=function(_0x234677){while(--_0x234677){_0x3ed727['push'](_0x3ed727['shift']());}};_0x56e015(++_0xfbaa56);}(_0xe676,0x1d5));var _0x6e67=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0xe676[_0x30182f];return _0x5207db;};'use strict';var multer=require(_0x6e67('0x0'));var util=require(_0x6e67('0x1'));var path=require(_0x6e67('0x2'));var timeout=require(_0x6e67('0x3'));var express=require(_0x6e67('0x4'));var router=express[_0x6e67('0x5')]();var fs_extra=require(_0x6e67('0x6'));var auth=require(_0x6e67('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6e67('0x8'));var controller=require(_0x6e67('0x9'));router[_0x6e67('0xa')]('/',auth[_0x6e67('0xb')](),controller['index']);router[_0x6e67('0xa')](_0x6e67('0xc'),auth['isAuthenticated'](),controller[_0x6e67('0xd')]);router[_0x6e67('0xe')]('/',auth[_0x6e67('0xb')](),controller[_0x6e67('0xf')]);router[_0x6e67('0x10')](_0x6e67('0xc'),auth[_0x6e67('0xb')](),controller['update']);router[_0x6e67('0x11')](_0x6e67('0xc'),auth['isAuthenticated'](),controller[_0x6e67('0x12')]);module[_0x6e67('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 4662cd7..8e42bd9 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 _0x95c5=['ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable','keyValue','STRING'];(function(_0x1618ae,_0xef8deb){var _0x21a437=function(_0x16f757){while(--_0x16f757){_0x1618ae['push'](_0x1618ae['shift']());}};_0x21a437(++_0xef8deb);}(_0x95c5,0x1c5));var _0x595c=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x95c5[_0x3ee1fe];return _0x1ae57a;};'use strict';var Sequelize=require(_0x595c('0x0'));module[_0x595c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x595c('0x2'),_0x595c('0x3'),'customVariable',_0x595c('0x4'),'picklist'),'defaultValue':_0x595c('0x2')},'content':{'type':Sequelize[_0x595c('0x5')]},'key':{'type':Sequelize[_0x595c('0x5')]},'keyType':{'type':Sequelize[_0x595c('0x6')](_0x595c('0x2'),'variable',_0x595c('0x7'))},'keyContent':{'type':Sequelize[_0x595c('0x5')]},'idField':{'type':Sequelize[_0x595c('0x5')]},'nameField':{'type':Sequelize[_0x595c('0x5')]},'customField':{'type':Sequelize[_0x595c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2ec9=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist','string'];(function(_0x6eee62,_0x25680a){var _0x4d5417=function(_0x6b969a){while(--_0x6b969a){_0x6eee62['push'](_0x6eee62['shift']());}};_0x4d5417(++_0x25680a);}(_0x2ec9,0x1bb));var _0x92ec=function(_0x3a177b,_0x10d9fe){_0x3a177b=_0x3a177b-0x0;var _0x205959=_0x2ec9[_0x3a177b];return _0x205959;};'use strict';var Sequelize=require(_0x92ec('0x0'));module[_0x92ec('0x1')]={'type':{'type':Sequelize[_0x92ec('0x2')]('string',_0x92ec('0x3'),_0x92ec('0x4'),'keyValue',_0x92ec('0x5')),'defaultValue':_0x92ec('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x92ec('0x7')]},'keyType':{'type':Sequelize[_0x92ec('0x2')](_0x92ec('0x6'),'variable',_0x92ec('0x4'))},'keyContent':{'type':Sequelize[_0x92ec('0x7')]},'idField':{'type':Sequelize[_0x92ec('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x92ec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x92ec('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1f03014..6c81652 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 _0xe714=['fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskField','include','findAll','catch','show','params','includeAll','find','create','body','eml-format','zip-dir'];(function(_0x34e08e,_0xb303ee){var _0x398387=function(_0x270ec6){while(--_0x270ec6){_0x34e08e['push'](_0x34e08e['shift']());}};_0x398387(++_0xb303ee);}(_0xe714,0xe2));var _0x4e71=function(_0x546d73,_0x134baf){_0x546d73=_0x546d73-0x0;var _0x538fd7=_0xe714[_0x546d73];return _0x538fd7;};'use strict';var emlformat=require(_0x4e71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e71('0x1'));var jsonpatch=require(_0x4e71('0x2'));var rp=require(_0x4e71('0x3'));var moment=require(_0x4e71('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4e71('0x5'));var util=require('util');var path=require(_0x4e71('0x6'));var sox=require(_0x4e71('0x7'));var csv=require(_0x4e71('0x8'));var ejs=require(_0x4e71('0x9'));var fs=require('fs');var fs_extra=require(_0x4e71('0xa'));var _=require(_0x4e71('0xb'));var squel=require('squel');var crypto=require(_0x4e71('0xc'));var jsforce=require(_0x4e71('0xd'));var deskjs=require(_0x4e71('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4e71('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e71('0x10'));var authService=require(_0x4e71('0x11'));var qs=require(_0x4e71('0x12'));var as=require(_0x4e71('0x13'));var hardwareService=require(_0x4e71('0x14'));var logger=require(_0x4e71('0x15'))(_0x4e71('0x16'));var utils=require(_0x4e71('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4e71('0x18'));var db=require(_0x4e71('0x19'))['db'];function respondWithStatusCode(_0x585acd,_0x3bd53c){_0x3bd53c=_0x3bd53c||0xcc;return function(_0x311b12){if(_0x311b12){return _0x585acd['sendStatus'](_0x3bd53c);}return _0x585acd[_0x4e71('0x1a')](_0x3bd53c)[_0x4e71('0x1b')]();};}function respondWithResult(_0x5a3d88,_0x5ad00a){_0x5ad00a=_0x5ad00a||0xc8;return function(_0x25c229){if(_0x25c229){return _0x5a3d88['status'](_0x5ad00a)['json'](_0x25c229);}};}function respondWithFilteredResult(_0x5afe50,_0x244272){return function(_0x4617d2){if(_0x4617d2){var _0x52ef52=typeof _0x244272['offset']===_0x4e71('0x1c')&&typeof _0x244272[_0x4e71('0x1d')]===_0x4e71('0x1c');var _0xef8e0d=_0x4617d2[_0x4e71('0x1e')];var _0x281a2b=_0x52ef52?0x0:_0x244272['offset'];var _0x18b745=_0x52ef52?_0x4617d2[_0x4e71('0x1e')]:_0x244272['offset']+_0x244272[_0x4e71('0x1d')];var _0x20b3ef;if(_0x18b745>=_0xef8e0d){_0x18b745=_0xef8e0d;_0x20b3ef=0xc8;}else{_0x20b3ef=0xce;}_0x5afe50['status'](_0x20b3ef);return _0x5afe50['set']('Content-Range',_0x281a2b+'-'+_0x18b745+'/'+_0xef8e0d)[_0x4e71('0x1f')](_0x4617d2);}return null;};}function patchUpdates(_0x1708fe){return function(_0x476b59){try{jsonpatch[_0x4e71('0x20')](_0x476b59,_0x1708fe,!![]);}catch(_0x44a6e5){return BPromise[_0x4e71('0x21')](_0x44a6e5);}return _0x476b59[_0x4e71('0x22')]();};}function saveUpdates(_0x2c22f0,_0x3bd6fc){return function(_0x335956){if(_0x335956){return _0x335956[_0x4e71('0x23')](_0x2c22f0)[_0x4e71('0x24')](function(_0x5e90f0){return _0x5e90f0;});}return null;};}function removeEntity(_0x5aa6b8,_0x56dd25){return function(_0x5b6584){if(_0x5b6584){return _0x5b6584[_0x4e71('0x25')]()[_0x4e71('0x24')](function(){_0x5aa6b8[_0x4e71('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35f181,_0x237057){return function(_0x564afb){if(!_0x564afb){_0x35f181[_0x4e71('0x26')](0x194);}return _0x564afb;};}function handleError(_0x40bb91,_0x2c9abf){_0x2c9abf=_0x2c9abf||0x1f4;return function(_0x53b08a){logger['error'](_0x53b08a[_0x4e71('0x27')]);if(_0x53b08a[_0x4e71('0x28')]){delete _0x53b08a[_0x4e71('0x28')];}_0x40bb91[_0x4e71('0x1a')](_0x2c9abf)[_0x4e71('0x29')](_0x53b08a);};}exports[_0x4e71('0x2a')]=function(_0x507639,_0x5ac921){var _0x51e9ea={},_0x2a7ce3={},_0xe33409={'count':0x0,'rows':[]};var _0x5a58b0=_[_0x4e71('0x2b')](db['DeskField'][_0x4e71('0x2c')],function(_0x4326cd){return{'name':_0x4326cd[_0x4e71('0x2d')],'type':_0x4326cd[_0x4e71('0x2e')][_0x4e71('0x2f')]};});_0x2a7ce3['model']=_[_0x4e71('0x2b')](_0x5a58b0,'name');_0x2a7ce3[_0x4e71('0x30')]=_[_0x4e71('0x31')](_0x507639[_0x4e71('0x30')]);_0x2a7ce3[_0x4e71('0x32')]=_[_0x4e71('0x33')](_0x2a7ce3['model'],_0x2a7ce3['query']);_0x51e9ea['attributes']=_[_0x4e71('0x33')](_0x2a7ce3[_0x4e71('0x34')],qs['fields'](_0x507639[_0x4e71('0x30')][_0x4e71('0x35')]));_0x51e9ea['attributes']=_0x51e9ea['attributes'][_0x4e71('0x36')]?_0x51e9ea[_0x4e71('0x37')]:_0x2a7ce3['model'];if(!_0x507639[_0x4e71('0x30')][_0x4e71('0x38')]('nolimit')){_0x51e9ea[_0x4e71('0x1d')]=qs[_0x4e71('0x1d')](_0x507639[_0x4e71('0x30')]['limit']);_0x51e9ea[_0x4e71('0x39')]=qs[_0x4e71('0x39')](_0x507639[_0x4e71('0x30')][_0x4e71('0x39')]);}_0x51e9ea[_0x4e71('0x3a')]=qs['sort'](_0x507639[_0x4e71('0x30')][_0x4e71('0x3b')]);_0x51e9ea[_0x4e71('0x3c')]=qs[_0x4e71('0x32')](_[_0x4e71('0x3d')](_0x507639['query'],_0x2a7ce3['filters']),_0x5a58b0);if(_0x507639[_0x4e71('0x30')][_0x4e71('0x3e')]){_0x51e9ea[_0x4e71('0x3c')]=_[_0x4e71('0x3f')](_0x51e9ea[_0x4e71('0x3c')],{'$or':_['map'](_0x5a58b0,function(_0x16dba2){if(_0x16dba2['type']!==_0x4e71('0x40')){var _0x4edcf0={};_0x4edcf0[_0x16dba2[_0x4e71('0x28')]]={'$like':'%'+_0x507639[_0x4e71('0x30')]['filter']+'%'};return _0x4edcf0;}})});}_0x51e9ea=_[_0x4e71('0x3f')]({},_0x51e9ea,_0x507639[_0x4e71('0x41')]);var _0x66a95c={'where':_0x51e9ea[_0x4e71('0x3c')]};return db[_0x4e71('0x42')][_0x4e71('0x1e')](_0x66a95c)[_0x4e71('0x24')](function(_0x2bae8a){_0xe33409[_0x4e71('0x1e')]=_0x2bae8a;if(_0x507639['query']['includeAll']){_0x51e9ea[_0x4e71('0x43')]=[{'all':!![]}];}return db[_0x4e71('0x42')][_0x4e71('0x44')](_0x51e9ea);})[_0x4e71('0x24')](function(_0x4fac41){_0xe33409['rows']=_0x4fac41;return _0xe33409;})[_0x4e71('0x24')](respondWithFilteredResult(_0x5ac921,_0x51e9ea))[_0x4e71('0x45')](handleError(_0x5ac921,null));};exports[_0x4e71('0x46')]=function(_0x5c64e2,_0x46963b){var _0x117877={'raw':!![],'where':{'id':_0x5c64e2[_0x4e71('0x47')]['id']}},_0x42df32={};_0x42df32[_0x4e71('0x34')]=_[_0x4e71('0x31')](db[_0x4e71('0x42')][_0x4e71('0x2c')]);_0x42df32['query']=_[_0x4e71('0x31')](_0x5c64e2[_0x4e71('0x30')]);_0x42df32[_0x4e71('0x32')]=_['intersection'](_0x42df32['model'],_0x42df32['query']);_0x117877['attributes']=_[_0x4e71('0x33')](_0x42df32[_0x4e71('0x34')],qs['fields'](_0x5c64e2['query']['fields']));_0x117877[_0x4e71('0x37')]=_0x117877[_0x4e71('0x37')][_0x4e71('0x36')]?_0x117877[_0x4e71('0x37')]:_0x42df32[_0x4e71('0x34')];if(_0x5c64e2[_0x4e71('0x30')][_0x4e71('0x48')]){_0x117877[_0x4e71('0x43')]=[{'all':!![]}];}_0x117877=_[_0x4e71('0x3f')]({},_0x117877,_0x5c64e2[_0x4e71('0x41')]);return db['DeskField'][_0x4e71('0x49')](_0x117877)[_0x4e71('0x24')](handleEntityNotFound(_0x46963b,null))['then'](respondWithResult(_0x46963b,null))[_0x4e71('0x45')](handleError(_0x46963b,null));};exports[_0x4e71('0x4a')]=function(_0x5a7a22,_0x1f16f5){return db[_0x4e71('0x42')][_0x4e71('0x4a')](_0x5a7a22[_0x4e71('0x4b')],{})['then'](respondWithResult(_0x1f16f5,0xc9))[_0x4e71('0x45')](handleError(_0x1f16f5,null));};exports['update']=function(_0x597f67,_0x2af74c){if(_0x597f67[_0x4e71('0x4b')]['id']){delete _0x597f67[_0x4e71('0x4b')]['id'];}return db[_0x4e71('0x42')][_0x4e71('0x49')]({'where':{'id':_0x597f67[_0x4e71('0x47')]['id']}})['then'](handleEntityNotFound(_0x2af74c,null))[_0x4e71('0x24')](saveUpdates(_0x597f67[_0x4e71('0x4b')],null))[_0x4e71('0x24')](respondWithResult(_0x2af74c,null))[_0x4e71('0x45')](handleError(_0x2af74c,null));};exports[_0x4e71('0x25')]=function(_0x52f274,_0x55432e){return db[_0x4e71('0x42')][_0x4e71('0x49')]({'where':{'id':_0x52f274[_0x4e71('0x47')]['id']}})[_0x4e71('0x24')](handleEntityNotFound(_0x55432e,null))[_0x4e71('0x24')](removeEntity(_0x55432e,null))[_0x4e71('0x45')](handleError(_0x55432e,null));}; \ No newline at end of file +var _0x5379=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','DeskField','fieldName','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x4ec7f2,_0x3d92d2){var _0x118004=function(_0x1ac4fb){while(--_0x1ac4fb){_0x4ec7f2['push'](_0x4ec7f2['shift']());}};_0x118004(++_0x3d92d2);}(_0x5379,0x1a2));var _0x9537=function(_0x3971bc,_0x31f003){_0x3971bc=_0x3971bc-0x0;var _0x2da5f5=_0x5379[_0x3971bc];return _0x2da5f5;};'use strict';var emlformat=require(_0x9537('0x0'));var rimraf=require(_0x9537('0x1'));var zipdir=require(_0x9537('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9537('0x3'));var moment=require('moment');var BPromise=require(_0x9537('0x4'));var Mustache=require(_0x9537('0x5'));var util=require(_0x9537('0x6'));var path=require(_0x9537('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9537('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9537('0x9'));var squel=require(_0x9537('0xa'));var crypto=require(_0x9537('0xb'));var jsforce=require(_0x9537('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9537('0xd'));var querystring=require(_0x9537('0xe'));var Papa=require(_0x9537('0xf'));var Redis=require(_0x9537('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9537('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9537('0x12'))(_0x9537('0x13'));var utils=require(_0x9537('0x14'));var config=require(_0x9537('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45337f,_0x2a29a6){_0x2a29a6=_0x2a29a6||0xcc;return function(_0x1afbf8){if(_0x1afbf8){return _0x45337f['sendStatus'](_0x2a29a6);}return _0x45337f[_0x9537('0x16')](_0x2a29a6)[_0x9537('0x17')]();};}function respondWithResult(_0x152d1a,_0x507e5c){_0x507e5c=_0x507e5c||0xc8;return function(_0x2e0660){if(_0x2e0660){return _0x152d1a[_0x9537('0x16')](_0x507e5c)[_0x9537('0x18')](_0x2e0660);}};}function respondWithFilteredResult(_0x55abad,_0x1a4327){return function(_0x4dcaca){if(_0x4dcaca){var _0x5e87a6=typeof _0x1a4327[_0x9537('0x19')]===_0x9537('0x1a')&&typeof _0x1a4327[_0x9537('0x1b')]===_0x9537('0x1a');var _0x34be49=_0x4dcaca[_0x9537('0x1c')];var _0x5b6d04=_0x5e87a6?0x0:_0x1a4327[_0x9537('0x19')];var _0xc2a33f=_0x5e87a6?_0x4dcaca[_0x9537('0x1c')]:_0x1a4327['offset']+_0x1a4327[_0x9537('0x1b')];var _0x108cc4;if(_0xc2a33f>=_0x34be49){_0xc2a33f=_0x34be49;_0x108cc4=0xc8;}else{_0x108cc4=0xce;}_0x55abad['status'](_0x108cc4);return _0x55abad[_0x9537('0x1d')](_0x9537('0x1e'),_0x5b6d04+'-'+_0xc2a33f+'/'+_0x34be49)['json'](_0x4dcaca);}return null;};}function patchUpdates(_0x4d0f0f){return function(_0x5bd365){try{jsonpatch[_0x9537('0x1f')](_0x5bd365,_0x4d0f0f,!![]);}catch(_0x32d54e){return BPromise[_0x9537('0x20')](_0x32d54e);}return _0x5bd365[_0x9537('0x21')]();};}function saveUpdates(_0x132ad5,_0x22e86a){return function(_0x53ea20){if(_0x53ea20){return _0x53ea20[_0x9537('0x22')](_0x132ad5)[_0x9537('0x23')](function(_0x1f3f87){return _0x1f3f87;});}return null;};}function removeEntity(_0x4f9706,_0x481aa5){return function(_0xaa3222){if(_0xaa3222){return _0xaa3222[_0x9537('0x24')]()[_0x9537('0x23')](function(){_0x4f9706[_0x9537('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c4df8,_0xf16084){return function(_0xf1f702){if(!_0xf1f702){_0x1c4df8[_0x9537('0x25')](0x194);}return _0xf1f702;};}function handleError(_0x4aae2b,_0x204c8d){_0x204c8d=_0x204c8d||0x1f4;return function(_0x2ef7b9){logger[_0x9537('0x26')](_0x2ef7b9[_0x9537('0x27')]);if(_0x2ef7b9['name']){delete _0x2ef7b9[_0x9537('0x28')];}_0x4aae2b[_0x9537('0x16')](_0x204c8d)[_0x9537('0x29')](_0x2ef7b9);};}exports[_0x9537('0x2a')]=function(_0xfc643e,_0x4f774f){var _0x482df0={},_0x1e8207={},_0x185033={'count':0x0,'rows':[]};var _0x2b6ec1=_['map'](db[_0x9537('0x2b')]['rawAttributes'],function(_0x499c03){return{'name':_0x499c03[_0x9537('0x2c')],'type':_0x499c03['type']['key']};});_0x1e8207['model']=_[_0x9537('0x2d')](_0x2b6ec1,_0x9537('0x28'));_0x1e8207[_0x9537('0x2e')]=_[_0x9537('0x2f')](_0xfc643e[_0x9537('0x2e')]);_0x1e8207[_0x9537('0x30')]=_[_0x9537('0x31')](_0x1e8207['model'],_0x1e8207[_0x9537('0x2e')]);_0x482df0[_0x9537('0x32')]=_[_0x9537('0x31')](_0x1e8207[_0x9537('0x33')],qs['fields'](_0xfc643e[_0x9537('0x2e')][_0x9537('0x34')]));_0x482df0[_0x9537('0x32')]=_0x482df0[_0x9537('0x32')][_0x9537('0x35')]?_0x482df0[_0x9537('0x32')]:_0x1e8207[_0x9537('0x33')];if(!_0xfc643e['query'][_0x9537('0x36')](_0x9537('0x37'))){_0x482df0[_0x9537('0x1b')]=qs[_0x9537('0x1b')](_0xfc643e[_0x9537('0x2e')][_0x9537('0x1b')]);_0x482df0[_0x9537('0x19')]=qs[_0x9537('0x19')](_0xfc643e[_0x9537('0x2e')][_0x9537('0x19')]);}_0x482df0[_0x9537('0x38')]=qs[_0x9537('0x39')](_0xfc643e['query']['sort']);_0x482df0[_0x9537('0x3a')]=qs['filters'](_[_0x9537('0x3b')](_0xfc643e[_0x9537('0x2e')],_0x1e8207[_0x9537('0x30')]),_0x2b6ec1);if(_0xfc643e[_0x9537('0x2e')][_0x9537('0x3c')]){_0x482df0[_0x9537('0x3a')]=_[_0x9537('0x3d')](_0x482df0[_0x9537('0x3a')],{'$or':_['map'](_0x2b6ec1,function(_0x22e175){if(_0x22e175[_0x9537('0x3e')]!==_0x9537('0x3f')){var _0x2ac030={};_0x2ac030[_0x22e175[_0x9537('0x28')]]={'$like':'%'+_0xfc643e[_0x9537('0x2e')]['filter']+'%'};return _0x2ac030;}})});}_0x482df0=_['merge']({},_0x482df0,_0xfc643e[_0x9537('0x40')]);var _0x2d84ea={'where':_0x482df0[_0x9537('0x3a')]};return db[_0x9537('0x2b')]['count'](_0x2d84ea)['then'](function(_0x1c4878){_0x185033[_0x9537('0x1c')]=_0x1c4878;if(_0xfc643e[_0x9537('0x2e')][_0x9537('0x41')]){_0x482df0['include']=[{'all':!![]}];}return db[_0x9537('0x2b')]['findAll'](_0x482df0);})[_0x9537('0x23')](function(_0x5e21db){_0x185033[_0x9537('0x42')]=_0x5e21db;return _0x185033;})[_0x9537('0x23')](respondWithFilteredResult(_0x4f774f,_0x482df0))[_0x9537('0x43')](handleError(_0x4f774f,null));};exports[_0x9537('0x44')]=function(_0x142a4a,_0x4b04be){var _0x1ac923={'raw':!![],'where':{'id':_0x142a4a[_0x9537('0x45')]['id']}},_0x3fef71={};_0x3fef71['model']=_['keys'](db[_0x9537('0x2b')][_0x9537('0x46')]);_0x3fef71[_0x9537('0x2e')]=_[_0x9537('0x2f')](_0x142a4a[_0x9537('0x2e')]);_0x3fef71['filters']=_[_0x9537('0x31')](_0x3fef71['model'],_0x3fef71[_0x9537('0x2e')]);_0x1ac923['attributes']=_['intersection'](_0x3fef71[_0x9537('0x33')],qs[_0x9537('0x34')](_0x142a4a[_0x9537('0x2e')][_0x9537('0x34')]));_0x1ac923[_0x9537('0x32')]=_0x1ac923['attributes']['length']?_0x1ac923[_0x9537('0x32')]:_0x3fef71['model'];if(_0x142a4a[_0x9537('0x2e')][_0x9537('0x41')]){_0x1ac923[_0x9537('0x47')]=[{'all':!![]}];}_0x1ac923=_[_0x9537('0x3d')]({},_0x1ac923,_0x142a4a[_0x9537('0x40')]);return db[_0x9537('0x2b')]['find'](_0x1ac923)['then'](handleEntityNotFound(_0x4b04be,null))['then'](respondWithResult(_0x4b04be,null))[_0x9537('0x43')](handleError(_0x4b04be,null));};exports[_0x9537('0x48')]=function(_0x561745,_0x234a5e){return db[_0x9537('0x2b')][_0x9537('0x48')](_0x561745[_0x9537('0x49')],{})[_0x9537('0x23')](respondWithResult(_0x234a5e,0xc9))[_0x9537('0x43')](handleError(_0x234a5e,null));};exports[_0x9537('0x22')]=function(_0x1081cb,_0x4fb9bc){if(_0x1081cb[_0x9537('0x49')]['id']){delete _0x1081cb['body']['id'];}return db[_0x9537('0x2b')][_0x9537('0x4a')]({'where':{'id':_0x1081cb[_0x9537('0x45')]['id']}})[_0x9537('0x23')](handleEntityNotFound(_0x4fb9bc,null))[_0x9537('0x23')](saveUpdates(_0x1081cb['body'],null))['then'](respondWithResult(_0x4fb9bc,null))[_0x9537('0x43')](handleError(_0x4fb9bc,null));};exports['destroy']=function(_0x1b9d71,_0x2a37f8){return db['DeskField'][_0x9537('0x4a')]({'where':{'id':_0x1b9d71[_0x9537('0x45')]['id']}})[_0x9537('0x23')](handleEntityNotFound(_0x2a37f8,null))['then'](removeEntity(_0x2a37f8,null))[_0x9537('0x43')](handleError(_0x2a37f8,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index fce8c9d..67a17fd 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 _0x0f5b=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util'];(function(_0x3bd2fc,_0x1c93db){var _0x48372f=function(_0x5c4e8e){while(--_0x5c4e8e){_0x3bd2fc['push'](_0x3bd2fc['shift']());}};_0x48372f(++_0x1c93db);}(_0x0f5b,0x67));var _0xb0f5=function(_0x38e271,_0x124323){_0x38e271=_0x38e271-0x0;var _0x24e0e1=_0x0f5b[_0x38e271];return _0x24e0e1;};'use strict';var _=require(_0xb0f5('0x0'));var util=require(_0xb0f5('0x1'));var logger=require(_0xb0f5('0x2'))(_0xb0f5('0x3'));var moment=require('moment');var BPromise=require(_0xb0f5('0x4'));var rp=require(_0xb0f5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0f5('0x6'));var config=require(_0xb0f5('0x7'));var attributes=require(_0xb0f5('0x8'));module[_0xb0f5('0x9')]=function(_0x1c1d13,_0x213a97){return _0x1c1d13[_0xb0f5('0xa')](_0xb0f5('0xb'),attributes,{'tableName':_0xb0f5('0xc'),'paranoid':![],'indexes':[{'name':_0xb0f5('0xd'),'fields':['idField',_0xb0f5('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d8d=['DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x27e83f,_0x43cc6b){var _0x146933=function(_0x435d24){while(--_0x435d24){_0x27e83f['push'](_0x27e83f['shift']());}};_0x146933(++_0x43cc6b);}(_0x4d8d,0x1f2));var _0xd4d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4d8d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd4d8('0x0'));var util=require(_0xd4d8('0x1'));var logger=require(_0xd4d8('0x2'))(_0xd4d8('0x3'));var moment=require(_0xd4d8('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4d8('0x5'));var fs=require('fs');var path=require(_0xd4d8('0x6'));var rimraf=require(_0xd4d8('0x7'));var config=require(_0xd4d8('0x8'));var attributes=require(_0xd4d8('0x9'));module[_0xd4d8('0xa')]=function(_0x216b4b,_0x3b23bb){return _0x216b4b[_0xd4d8('0xb')](_0xd4d8('0xc'),attributes,{'tableName':_0xd4d8('0xd'),'paranoid':![],'indexes':[{'name':_0xd4d8('0xe'),'fields':[_0xd4d8('0xf'),_0xd4d8('0x10')],'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 98b0d16..17759a6 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 _0xfa96=['../../config/environment','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x236ce3,_0x2d67b1){var _0x3b425d=function(_0xf84f04){while(--_0xf84f04){_0x236ce3['push'](_0x236ce3['shift']());}};_0x3b425d(++_0x2d67b1);}(_0xfa96,0x77));var _0x6fa9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfa96[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6fa9('0x0'));var util=require(_0x6fa9('0x1'));var moment=require(_0x6fa9('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fa9('0x3'));var fs=require('fs');var Redis=require(_0x6fa9('0x4'));var db=require(_0x6fa9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fa9('0x6'))('rpc');var config=require(_0x6fa9('0x7'));var jayson=require(_0x6fa9('0x8'));var client=jayson[_0x6fa9('0x9')][_0x6fa9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444f9d,_0x58ed63,_0xe68e9c){return new BPromise(function(_0x1316f2,_0x49b82a){return client['request'](_0x444f9d,_0xe68e9c)['then'](function(_0x514715){logger[_0x6fa9('0xb')](_0x6fa9('0xc'),_0x58ed63,_0x6fa9('0xd'));logger[_0x6fa9('0xe')](_0x6fa9('0xf'),_0x58ed63,_0x6fa9('0xd'),JSON[_0x6fa9('0x10')](_0x514715));if(_0x514715[_0x6fa9('0x11')]){if(_0x514715['error'][_0x6fa9('0x12')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x58ed63,_0x514715[_0x6fa9('0x11')]['message']);return _0x49b82a(_0x514715[_0x6fa9('0x11')][_0x6fa9('0x13')]);}logger[_0x6fa9('0x11')](_0x6fa9('0xc'),_0x58ed63,_0x514715['error'][_0x6fa9('0x13')]);return _0x1316f2(_0x514715[_0x6fa9('0x11')][_0x6fa9('0x13')]);}else{logger[_0x6fa9('0xb')]('DeskField,\x20%s,\x20%s',_0x58ed63,'request\x20sent');_0x1316f2(_0x514715['result'][_0x6fa9('0x13')]);}})[_0x6fa9('0x14')](function(_0x3d30ae){logger['error'](_0x6fa9('0xc'),_0x58ed63,_0x3d30ae);_0x49b82a(_0x3d30ae);});});} \ No newline at end of file +var _0xe9fe=['message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x101d2a,_0x2e4274){var _0xa2297e=function(_0x30ffa6){while(--_0x30ffa6){_0x101d2a['push'](_0x101d2a['shift']());}};_0xa2297e(++_0x2e4274);}(_0xe9fe,0x72));var _0xee9f=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0xe9fe[_0x1283d4];return _0x433643;};'use strict';var _=require(_0xee9f('0x0'));var util=require(_0xee9f('0x1'));var moment=require('moment');var BPromise=require(_0xee9f('0x2'));var rs=require(_0xee9f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee9f('0x4'))['db'];var utils=require(_0xee9f('0x5'));var logger=require(_0xee9f('0x6'))(_0xee9f('0x7'));var config=require(_0xee9f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xee9f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a2be7,_0x8eaa60,_0x2b4f12){return new BPromise(function(_0x4635f5,_0x3615e1){return client[_0xee9f('0xa')](_0x1a2be7,_0x2b4f12)[_0xee9f('0xb')](function(_0x2986d4){logger['info'](_0xee9f('0xc'),_0x8eaa60,_0xee9f('0xd'));logger['debug'](_0xee9f('0xe'),_0x8eaa60,'request\x20sent',JSON[_0xee9f('0xf')](_0x2986d4));if(_0x2986d4[_0xee9f('0x10')]){if(_0x2986d4[_0xee9f('0x10')][_0xee9f('0x11')]===0x1f4){logger[_0xee9f('0x10')](_0xee9f('0xc'),_0x8eaa60,_0x2986d4[_0xee9f('0x10')][_0xee9f('0x12')]);return _0x3615e1(_0x2986d4[_0xee9f('0x10')]['message']);}logger[_0xee9f('0x10')](_0xee9f('0xc'),_0x8eaa60,_0x2986d4[_0xee9f('0x10')][_0xee9f('0x12')]);return _0x4635f5(_0x2986d4[_0xee9f('0x10')][_0xee9f('0x12')]);}else{logger[_0xee9f('0x13')](_0xee9f('0xc'),_0x8eaa60,'request\x20sent');_0x4635f5(_0x2986d4[_0xee9f('0x14')][_0xee9f('0x12')]);}})[_0xee9f('0x15')](function(_0x4b6942){logger[_0xee9f('0x10')](_0xee9f('0xc'),_0x8eaa60,_0x4b6942);_0x3615e1(_0x4b6942);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b274da4..b772ad6 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 _0xaf88=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x50c186,_0xf7791){var _0x1da419=function(_0x17b339){while(--_0x17b339){_0x50c186['push'](_0x50c186['shift']());}};_0x1da419(++_0xf7791);}(_0xaf88,0x107));var _0x8af8=function(_0x1463be,_0x3a24b9){_0x1463be=_0x1463be-0x0;var _0x1d160a=_0xaf88[_0x1463be];return _0x1d160a;};'use strict';var multer=require(_0x8af8('0x0'));var util=require(_0x8af8('0x1'));var path=require(_0x8af8('0x2'));var timeout=require(_0x8af8('0x3'));var express=require(_0x8af8('0x4'));var router=express[_0x8af8('0x5')]();var fs_extra=require(_0x8af8('0x6'));var auth=require(_0x8af8('0x7'));var interaction=require(_0x8af8('0x8'));var config=require(_0x8af8('0x9'));var controller=require(_0x8af8('0xa'));router[_0x8af8('0xb')]('/',auth[_0x8af8('0xc')](),controller[_0x8af8('0xd')]);router[_0x8af8('0xb')](_0x8af8('0xe'),auth[_0x8af8('0xc')](),controller['show']);router[_0x8af8('0xb')](_0x8af8('0xf'),auth['isAuthenticated'](),controller[_0x8af8('0x10')]);router[_0x8af8('0xb')](_0x8af8('0x11'),auth['isAuthenticated'](),controller[_0x8af8('0x12')]);router[_0x8af8('0x13')]('/',auth['isAuthenticated'](),controller[_0x8af8('0x14')]);router[_0x8af8('0x13')](_0x8af8('0xf'),auth[_0x8af8('0xc')](),controller[_0x8af8('0x15')]);router[_0x8af8('0x16')](_0x8af8('0xe'),auth[_0x8af8('0xc')](),controller[_0x8af8('0x17')]);router['delete'](_0x8af8('0xe'),auth[_0x8af8('0xc')](),controller[_0x8af8('0x18')]);module['exports']=router; \ No newline at end of file +var _0x2d48=['./intDynamics365Account.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd01c0f,_0x338f4f){var _0x498e77=function(_0x400323){while(--_0x400323){_0xd01c0f['push'](_0xd01c0f['shift']());}};_0x498e77(++_0x338f4f);}(_0x2d48,0xcb));var _0x82d4=function(_0x4d2583,_0x52bd89){_0x4d2583=_0x4d2583-0x0;var _0x57fa3a=_0x2d48[_0x4d2583];return _0x57fa3a;};'use strict';var multer=require('multer');var util=require(_0x82d4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x82d4('0x1'));var router=express['Router']();var fs_extra=require(_0x82d4('0x2'));var auth=require(_0x82d4('0x3'));var interaction=require(_0x82d4('0x4'));var config=require(_0x82d4('0x5'));var controller=require(_0x82d4('0x6'));router['get']('/',auth[_0x82d4('0x7')](),controller['index']);router[_0x82d4('0x8')](_0x82d4('0x9'),auth[_0x82d4('0x7')](),controller['show']);router[_0x82d4('0x8')](_0x82d4('0xa'),auth[_0x82d4('0x7')](),controller[_0x82d4('0xb')]);router[_0x82d4('0x8')]('/:id/fields',auth[_0x82d4('0x7')](),controller[_0x82d4('0xc')]);router[_0x82d4('0xd')]('/',auth[_0x82d4('0x7')](),controller[_0x82d4('0xe')]);router[_0x82d4('0xd')](_0x82d4('0xa'),auth['isAuthenticated'](),controller[_0x82d4('0xf')]);router['put'](_0x82d4('0x9'),auth[_0x82d4('0x7')](),controller[_0x82d4('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x82d4('0x11')]);module[_0x82d4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 487917d..16e2371 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 _0xe181=['sequelize','STRING'];(function(_0x24ffbc,_0x3a834f){var _0x196753=function(_0x2e83d6){while(--_0x2e83d6){_0x24ffbc['push'](_0x24ffbc['shift']());}};_0x196753(++_0x3a834f);}(_0xe181,0x68));var _0x1e18=function(_0x1eff83,_0x598a1c){_0x1eff83=_0x1eff83-0x0;var _0x20f2fa=_0xe181[_0x1eff83];return _0x20f2fa;};'use strict';var Sequelize=require(_0x1e18('0x0'));module['exports']={'name':{'type':Sequelize[_0x1e18('0x1')]},'username':{'type':Sequelize[_0x1e18('0x1')]},'password':{'type':Sequelize[_0x1e18('0x1')]},'remoteUri':{'type':Sequelize[_0x1e18('0x1')]},'tenantId':{'type':Sequelize[_0x1e18('0x1')]},'clientId':{'type':Sequelize[_0x1e18('0x1')]},'clientSecret':{'type':Sequelize[_0x1e18('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1e18('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x4ce6=['sequelize','STRING'];(function(_0x11343c,_0x12857d){var _0x5603b2=function(_0x3e06bd){while(--_0x3e06bd){_0x11343c['push'](_0x11343c['shift']());}};_0x5603b2(++_0x12857d);}(_0x4ce6,0x108));var _0x64ce=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x4ce6[_0x455c6c];return _0x488242;};'use strict';var Sequelize=require(_0x64ce('0x0'));module['exports']={'name':{'type':Sequelize[_0x64ce('0x1')]},'username':{'type':Sequelize[_0x64ce('0x1')]},'password':{'type':Sequelize[_0x64ce('0x1')]},'remoteUri':{'type':Sequelize[_0x64ce('0x1')]},'tenantId':{'type':Sequelize[_0x64ce('0x1')]},'clientId':{'type':Sequelize[_0x64ce('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x64ce('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 752ca12..a0798da 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 _0x8a2a=['filter','merge','VIRTUAL','options','include','catch','show','params','keys','length','find','create','getConfigurations','Dynamics365Configuration','order','addConfiguration','body','findOne','AccountId','Subjects','channel','Descriptions','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedon','modifiedonbehalfbyyominame','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','access_token','remoteUri','https://login.microsoftonline.com/','tenantId','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','UserLocalizedLabel','Value','DisplayName','Label',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','false','?$select=DisplayName,LogicalName','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x3c6894,_0x813a7f){var _0x4c8ec1=function(_0x967ee6){while(--_0x967ee6){_0x3c6894['push'](_0x3c6894['shift']());}};_0x4c8ec1(++_0x813a7f);}(_0x8a2a,0x8d));var _0xa8a2=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0x8a2a[_0x22ffbf];return _0x360c17;};'use strict';var rp=require('request-promise');var util=require(_0xa8a2('0x0'));var _=require('lodash');var qs=require(_0xa8a2('0x1'));var logger=require(_0xa8a2('0x2'))(_0xa8a2('0x3'));var db=require(_0xa8a2('0x4'))['db'];var integrations=require(_0xa8a2('0x5'));function respondWithResult(_0xc62edd,_0x4e0c4a){_0x4e0c4a=_0x4e0c4a||0xc8;return function(_0x2ddde7){if(_0x2ddde7){return _0xc62edd[_0xa8a2('0x6')](_0x4e0c4a)[_0xa8a2('0x7')](_0x2ddde7);}};}function respondWithFilteredResult(_0x313bb0,_0x5dcd18){return function(_0x10ef08){if(_0x10ef08){var _0x1230d9=typeof _0x5dcd18[_0xa8a2('0x8')]==='undefined'&&typeof _0x5dcd18['limit']===_0xa8a2('0x9');var _0x27f31f=_0x10ef08[_0xa8a2('0xa')];var _0x4984ec=_0x1230d9?0x0:_0x5dcd18[_0xa8a2('0x8')];var _0x37fd88=_0x1230d9?_0x10ef08[_0xa8a2('0xa')]:_0x5dcd18[_0xa8a2('0x8')]+_0x5dcd18[_0xa8a2('0xb')];var _0x1f3004;if(_0x37fd88>=_0x27f31f){_0x37fd88=_0x27f31f;_0x1f3004=0xc8;}else{_0x1f3004=0xce;}_0x313bb0[_0xa8a2('0x6')](_0x1f3004);return _0x313bb0[_0xa8a2('0xc')](_0xa8a2('0xd'),_0x4984ec+'-'+_0x37fd88+'/'+_0x27f31f)['json'](_0x10ef08);}return null;};}function saveUpdates(_0x477ca5){return function(_0x29990f){if(_0x29990f){return _0x29990f[_0xa8a2('0xe')](_0x477ca5)[_0xa8a2('0xf')](function(_0x4bbb7d){return _0x4bbb7d;});}return null;};}function removeEntity(_0x5e0609){return function(_0x454193){if(_0x454193){return _0x454193[_0xa8a2('0x10')]()[_0xa8a2('0xf')](function(){_0x5e0609[_0xa8a2('0x6')](0xcc)[_0xa8a2('0x11')]();});}};}function handleEntityNotFound(_0x1eb72d){return function(_0x514d8a){if(!_0x514d8a){_0x1eb72d[_0xa8a2('0x12')](0x194);}return _0x514d8a;};}function handleError(_0x5bf9f3,_0x3b92ed){_0x3b92ed=_0x3b92ed||0x1f4;return function(_0x3e56e3){logger[_0xa8a2('0x13')](_0x3e56e3['stack']);if(_0x3e56e3['name']){delete _0x3e56e3['name'];}_0x5bf9f3[_0xa8a2('0x6')](_0x3b92ed)[_0xa8a2('0x14')](_0x3e56e3);};}exports[_0xa8a2('0x15')]=function(_0x4df78f,_0x723a88){var _0x571e48={},_0x5a1122={},_0x755291={'count':0x0,'rows':[]};var _0xbffa67=_[_0xa8a2('0x16')](db[_0xa8a2('0x17')][_0xa8a2('0x18')],function(_0x417d43){return{'name':_0x417d43[_0xa8a2('0x19')],'type':_0x417d43[_0xa8a2('0x1a')]['key']};});_0x5a1122[_0xa8a2('0x1b')]=_[_0xa8a2('0x16')](_0xbffa67,_0xa8a2('0x1c'));_0x5a1122[_0xa8a2('0x1d')]=_['keys'](_0x4df78f[_0xa8a2('0x1d')]);_0x5a1122[_0xa8a2('0x1e')]=_[_0xa8a2('0x1f')](_0x5a1122[_0xa8a2('0x1b')],_0x5a1122[_0xa8a2('0x1d')]);_0x571e48[_0xa8a2('0x20')]=_[_0xa8a2('0x1f')](_0x5a1122[_0xa8a2('0x1b')],qs[_0xa8a2('0x21')](_0x4df78f['query']['fields']));_0x571e48[_0xa8a2('0x20')]=_0x571e48['attributes']['length']?_0x571e48[_0xa8a2('0x20')]:_0x5a1122[_0xa8a2('0x1b')];if(!_0x4df78f['query'][_0xa8a2('0x22')](_0xa8a2('0x23'))){_0x571e48[_0xa8a2('0xb')]=qs[_0xa8a2('0xb')](_0x4df78f[_0xa8a2('0x1d')][_0xa8a2('0xb')]);_0x571e48[_0xa8a2('0x8')]=qs[_0xa8a2('0x8')](_0x4df78f[_0xa8a2('0x1d')][_0xa8a2('0x8')]);}_0x571e48['order']=qs[_0xa8a2('0x24')](_0x4df78f[_0xa8a2('0x1d')][_0xa8a2('0x24')]);_0x571e48[_0xa8a2('0x25')]=qs[_0xa8a2('0x1e')](_[_0xa8a2('0x26')](_0x4df78f[_0xa8a2('0x1d')],_0x5a1122[_0xa8a2('0x1e')]),_0xbffa67);if(_0x4df78f[_0xa8a2('0x1d')][_0xa8a2('0x27')]){_0x571e48[_0xa8a2('0x25')]=_[_0xa8a2('0x28')](_0x571e48[_0xa8a2('0x25')],{'$or':_[_0xa8a2('0x16')](_0xbffa67,function(_0x15443c){if(_0x15443c[_0xa8a2('0x1a')]!==_0xa8a2('0x29')){var _0x57a0f5={};_0x57a0f5[_0x15443c[_0xa8a2('0x1c')]]={'$like':'%'+_0x4df78f['query'][_0xa8a2('0x27')]+'%'};return _0x57a0f5;}})});}_0x571e48=_[_0xa8a2('0x28')]({},_0x571e48,_0x4df78f[_0xa8a2('0x2a')]);var _0x1c25fc={'where':_0x571e48[_0xa8a2('0x25')]};return db['Dynamics365Account']['count'](_0x1c25fc)['then'](function(_0x417113){_0x755291['count']=_0x417113;if(_0x4df78f['query']['includeAll']){_0x571e48[_0xa8a2('0x2b')]=[{'all':!![]}];}return db[_0xa8a2('0x17')]['findAll'](_0x571e48);})[_0xa8a2('0xf')](function(_0x558715){_0x755291['rows']=_0x558715;return _0x755291;})['then'](respondWithFilteredResult(_0x723a88,_0x571e48))[_0xa8a2('0x2c')](handleError(_0x723a88,null));};exports[_0xa8a2('0x2d')]=function(_0x17e4b2,_0x279049){var _0x5cdb61={'raw':![],'where':{'id':_0x17e4b2[_0xa8a2('0x2e')]['id']}},_0x42003f={};_0x42003f[_0xa8a2('0x1b')]=_[_0xa8a2('0x2f')](db[_0xa8a2('0x17')][_0xa8a2('0x18')]);_0x42003f['query']=_[_0xa8a2('0x2f')](_0x17e4b2[_0xa8a2('0x1d')]);_0x42003f[_0xa8a2('0x1e')]=_['intersection'](_0x42003f['model'],_0x42003f[_0xa8a2('0x1d')]);_0x5cdb61['attributes']=_[_0xa8a2('0x1f')](_0x42003f['model'],qs['fields'](_0x17e4b2['query'][_0xa8a2('0x21')]));_0x5cdb61[_0xa8a2('0x20')]=_0x5cdb61[_0xa8a2('0x20')][_0xa8a2('0x30')]?_0x5cdb61['attributes']:_0x42003f[_0xa8a2('0x1b')];if(_0x17e4b2[_0xa8a2('0x1d')]['includeAll']){_0x5cdb61[_0xa8a2('0x2b')]=[{'all':!![]}];}_0x5cdb61=_[_0xa8a2('0x28')]({},_0x5cdb61,_0x17e4b2[_0xa8a2('0x2a')]);return db['Dynamics365Account'][_0xa8a2('0x31')](_0x5cdb61)[_0xa8a2('0xf')](handleEntityNotFound(_0x279049,null))[_0xa8a2('0xf')](respondWithResult(_0x279049,null))[_0xa8a2('0x2c')](handleError(_0x279049,null));};exports[_0xa8a2('0x32')]=function(_0x3483c2,_0x567490){return db[_0xa8a2('0x17')][_0xa8a2('0x32')](_0x3483c2['body'],{})[_0xa8a2('0xf')](respondWithResult(_0x567490,0xc9))[_0xa8a2('0x2c')](handleError(_0x567490,null));};exports[_0xa8a2('0xe')]=function(_0x5bc29d,_0x4068a8){if(_0x5bc29d['body']['id']){delete _0x5bc29d['body']['id'];}return db[_0xa8a2('0x17')]['find']({'where':{'id':_0x5bc29d['params']['id']}})[_0xa8a2('0xf')](handleEntityNotFound(_0x4068a8,null))[_0xa8a2('0xf')](saveUpdates(_0x5bc29d['body'],null))[_0xa8a2('0xf')](respondWithResult(_0x4068a8,null))['catch'](handleError(_0x4068a8,null));};exports[_0xa8a2('0x10')]=function(_0x2c78e2,_0x22e229){return db['Dynamics365Account']['find']({'where':{'id':_0x2c78e2[_0xa8a2('0x2e')]['id']}})[_0xa8a2('0xf')](handleEntityNotFound(_0x22e229,null))[_0xa8a2('0xf')](removeEntity(_0x22e229,null))[_0xa8a2('0x2c')](handleError(_0x22e229,null));};exports[_0xa8a2('0x33')]=function(_0x554cd8,_0x5a3212){var _0x5c25f3={};var _0x32d896={};var _0x424071;var _0x2f2b36;return db[_0xa8a2('0x17')]['findOne']({'where':{'id':_0x554cd8['params']['id']}})[_0xa8a2('0xf')](handleEntityNotFound(_0x5a3212,null))[_0xa8a2('0xf')](function(_0x4d0519){if(_0x4d0519){_0x424071=_0x4d0519;_0x32d896[_0xa8a2('0x1b')]=_['keys'](db[_0xa8a2('0x34')][_0xa8a2('0x18')]);_0x32d896[_0xa8a2('0x1d')]=_[_0xa8a2('0x2f')](_0x554cd8['query']);_0x32d896[_0xa8a2('0x1e')]=_[_0xa8a2('0x1f')](_0x32d896['model'],_0x32d896[_0xa8a2('0x1d')]);_0x5c25f3[_0xa8a2('0x20')]=_['intersection'](_0x32d896[_0xa8a2('0x1b')],qs[_0xa8a2('0x21')](_0x554cd8[_0xa8a2('0x1d')][_0xa8a2('0x21')]));_0x5c25f3[_0xa8a2('0x20')]=_0x5c25f3[_0xa8a2('0x20')]['length']?_0x5c25f3[_0xa8a2('0x20')]:_0x32d896[_0xa8a2('0x1b')];_0x5c25f3[_0xa8a2('0x35')]=qs[_0xa8a2('0x24')](_0x554cd8[_0xa8a2('0x1d')]['sort']);_0x5c25f3[_0xa8a2('0x25')]=qs[_0xa8a2('0x1e')](_[_0xa8a2('0x26')](_0x554cd8[_0xa8a2('0x1d')],_0x32d896[_0xa8a2('0x1e')]));if(_0x554cd8[_0xa8a2('0x1d')][_0xa8a2('0x27')]){_0x5c25f3[_0xa8a2('0x25')]=_[_0xa8a2('0x28')](_0x5c25f3['where'],{'$or':_['map'](_0x5c25f3['attributes'],function(_0xbb5583){var _0x351916={};_0x351916[_0xbb5583]={'$like':'%'+_0x554cd8[_0xa8a2('0x1d')][_0xa8a2('0x27')]+'%'};return _0x351916;})});}_0x5c25f3=_[_0xa8a2('0x28')]({},_0x5c25f3,_0x554cd8[_0xa8a2('0x2a')]);return _0x424071[_0xa8a2('0x33')](_0x5c25f3);}})[_0xa8a2('0xf')](function(_0x36bef4){if(_0x36bef4){_0x2f2b36=_0x36bef4[_0xa8a2('0x30')];if(!_0x554cd8['query'][_0xa8a2('0x22')](_0xa8a2('0x23'))){_0x5c25f3[_0xa8a2('0xb')]=qs[_0xa8a2('0xb')](_0x554cd8[_0xa8a2('0x1d')][_0xa8a2('0xb')]);_0x5c25f3[_0xa8a2('0x8')]=qs[_0xa8a2('0x8')](_0x554cd8[_0xa8a2('0x1d')][_0xa8a2('0x8')]);}return _0x424071[_0xa8a2('0x33')](_0x5c25f3);}})[_0xa8a2('0xf')](function(_0x3fc5bd){if(_0x3fc5bd){return _0x3fc5bd?{'count':_0x2f2b36,'rows':_0x3fc5bd}:null;}})['then'](respondWithResult(_0x5a3212,null))[_0xa8a2('0x2c')](handleError(_0x5a3212,null));};exports[_0xa8a2('0x36')]=function(_0x3cd16c,_0x12d905){if(_0x3cd16c['body']['id']){delete _0x3cd16c[_0xa8a2('0x37')]['id'];}return db['Dynamics365Account'][_0xa8a2('0x38')]({'where':{'id':_0x3cd16c[_0xa8a2('0x2e')]['id']}})[_0xa8a2('0xf')](handleEntityNotFound(_0x12d905,null))[_0xa8a2('0xf')](function(_0x28d043){if(_0x28d043){_0x3cd16c[_0xa8a2('0x37')][_0xa8a2('0x39')]=_0x28d043['id'];_0x3cd16c[_0xa8a2('0x37')][_0xa8a2('0x3a')]=integrations['getSubjects'](_0x3cd16c[_0xa8a2('0x37')][_0xa8a2('0x3b')],_0x3cd16c[_0xa8a2('0x37')]['type']);_0x3cd16c['body'][_0xa8a2('0x3c')]=integrations['getDescriptions'](_0x3cd16c[_0xa8a2('0x37')]['channel'],_0x3cd16c[_0xa8a2('0x37')][_0xa8a2('0x1a')]);return db[_0xa8a2('0x34')]['create'](_0x3cd16c[_0xa8a2('0x37')],{'include':[{'model':db[_0xa8a2('0x3d')],'as':_0xa8a2('0x3a')},{'model':db[_0xa8a2('0x3d')],'as':_0xa8a2('0x3c')}]});}return null;})['then'](respondWithResult(_0x12d905,null))[_0xa8a2('0x2c')](handleError(_0x12d905,null));};function sanitizeRemoteUri(_0x3d080b){var _0xf2284f=_0x3d080b['slice'](-0x1);if(_0xf2284f==='/')return _0x3d080b[_0xa8a2('0x3e')](0x0,_0x3d080b[_0xa8a2('0x3f')](_0xf2284f));return _0x3d080b;}function getWebApiUrl(_0x2b0b0c){return util[_0xa8a2('0x40')](_0xa8a2('0x41'),_0x2b0b0c);}exports[_0xa8a2('0x42')]=function(_0x4afa0a,_0xb3633){var _0x1b1829=_0x4afa0a[_0xa8a2('0x1d')]['ticketType'];var _0xd7b15=_0x1b1829===_0xa8a2('0x43')?_0xa8a2('0x44'):_0xa8a2('0x45');var _0x3ced6f='';var _0xcb4f1b='';var _0x366f2d='';var _0x1aa96c='';var _0x211edf='';var _0x39f3e1='';var _0x3bd68a='';var _0x571041='';var _0x1d3604=[_0xa8a2('0x46'),_0xa8a2('0x47'),_0xa8a2('0x48'),_0xa8a2('0x49'),_0xa8a2('0x4a'),_0xa8a2('0x4b'),'phonenumber',_0xa8a2('0x4c'),'directioncode',_0xa8a2('0x4d')];var _0x90cf50=[_0xa8a2('0x4e'),'accountidyominame',_0xa8a2('0x4f'),'billedserviceunits',_0xa8a2('0x50'),_0xa8a2('0x51'),_0xa8a2('0x52'),_0xa8a2('0x53'),_0xa8a2('0x54'),_0xa8a2('0x55'),_0xa8a2('0x56'),_0xa8a2('0x57'),_0xa8a2('0x58'),_0xa8a2('0x59'),_0xa8a2('0x5a'),_0xa8a2('0x5b'),_0xa8a2('0x5c'),_0xa8a2('0x5d'),_0xa8a2('0x5e'),'entitlementidname',_0xa8a2('0x5f'),_0xa8a2('0x60'),_0xa8a2('0x61'),_0xa8a2('0x62'),'firstresponsebykpiidname',_0xa8a2('0x63'),_0xa8a2('0x64'),_0xa8a2('0x65'),_0xa8a2('0x66'),_0xa8a2('0x67'),'masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame',_0xa8a2('0x68'),'modifiedonbehalfbyname',_0xa8a2('0x69'),'msdyn_incidenttypename','msdyn_iotalertname',_0xa8a2('0x6a'),_0xa8a2('0x6b'),_0xa8a2('0x6c'),_0xa8a2('0x6d'),'owneridtype','owneridyominame',_0xa8a2('0x6e'),_0xa8a2('0x6f'),_0xa8a2('0x70'),_0xa8a2('0x71'),'productidname','productserialnumber','resolveby',_0xa8a2('0x72'),_0xa8a2('0x73'),_0xa8a2('0x74'),_0xa8a2('0x75'),_0xa8a2('0x76'),_0xa8a2('0x77'),'slaname',_0xa8a2('0x78'),_0xa8a2('0x79'),'statuscode',_0xa8a2('0x7a'),'ticketnumber',_0xa8a2('0x7b'),'transactioncurrencyidname',_0xa8a2('0x7c'),_0xa8a2('0x7d'),_0xa8a2('0x7e')];var _0x4f8777=_0x1d3604[_0xa8a2('0x7f')](_0x90cf50);return db[_0xa8a2('0x17')][_0xa8a2('0x38')]({'where':{'id':_0x4afa0a[_0xa8a2('0x2e')]['id']},'attributes':['id',_0xa8a2('0x80'),_0xa8a2('0x81'),'remoteUri','tenantId',_0xa8a2('0x82'),_0xa8a2('0x83'),'modernAuthentication'],'include':[{'model':db[_0xa8a2('0x84')],'as':'CloudProvider','attributes':['id',_0xa8a2('0x85'),_0xa8a2('0x86')]}]})['then'](handleEntityNotFound(_0xb3633,null))[_0xa8a2('0xf')](function(_0x1cd711){if(_0x1cd711){if(_0x1cd711[_0xa8a2('0x87')]){_0x1cd711[_0xa8a2('0x88')]=_0x1cd711[_0xa8a2('0x84')]['data5'];_0x571041=sanitizeRemoteUri(_0x1cd711[_0xa8a2('0x84')][_0xa8a2('0x86')]);_0x3bd68a=getWebApiUrl(_0x571041);return _0x1cd711;}_0x571041=sanitizeRemoteUri(_0x1cd711[_0xa8a2('0x89')]);_0x3bd68a=getWebApiUrl(_0x571041);var _0x28376f={'method':'POST','uri':_0xa8a2('0x8a')+_0x1cd711[_0xa8a2('0x8b')]+_0xa8a2('0x8c'),'form':{'client_id':_0x1cd711[_0xa8a2('0x82')],'resource':_0x571041,'username':_0x1cd711[_0xa8a2('0x80')],'password':_0x1cd711['password'],'grant_type':_0xa8a2('0x81'),'client_secret':_0x1cd711['clientSecret']},'json':!![]};return rp(_0x28376f);}})[_0xa8a2('0xf')](function(_0x2aec94){_0x39f3e1=_0x2aec94[_0xa8a2('0x88')];var _0x506acb={'method':'GET','uri':encodeURI(_0x3bd68a+_0xa8a2('0x8d')+_0xd7b15+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x39f3e1,'If-None-Match':null,'OData-Version':_0xa8a2('0x8e')},'json':!![]};return rp(_0x506acb);})[_0xa8a2('0xf')](function(_0xc3703f){var _0x4e7798=_0xc3703f['value'][0x0];var _0x1c70e8=_0x4e7798[_0xa8a2('0x8f')];var _0x402aee={'method':_0xa8a2('0x90'),'uri':_0x3bd68a+'EntityDefinitions('+_0x1c70e8+_0xa8a2('0x91'),'headers':{'Authorization':'Bearer\x20'+_0x39f3e1,'If-None-Match':null,'OData-Version':_0xa8a2('0x8e')},'json':!![]};return rp(_0x402aee);})['then'](function(_0x744d5e){_0x3ced6f=_0x744d5e;_0xcb4f1b=_0x3ced6f[_0xa8a2('0x92')];_0xcb4f1b=_[_0xa8a2('0x93')](_0xcb4f1b,function(_0x3c2fe9){return!_0x4f8777['includes'](_0x3c2fe9[_0xa8a2('0x94')]);});var _0x4c226f=[];var _0x3bb005=[];_0xcb4f1b[_0xa8a2('0x95')](function(_0x114a52){if(_0x114a52[_0xa8a2('0x96')]){var _0x3598c2=_0x114a52[_0xa8a2('0x96')][_0xa8a2('0x3e')](_0x114a52[_0xa8a2('0x96')]['lastIndexOf']('.')+0x1);if(_0x3598c2==='PicklistAttributeMetadata'){_0x4c226f[_0xa8a2('0x97')](getSelectList(_0x3bd68a,_0x1b1829,_0x3bb005,_0x3ced6f['MetadataId'],_0x114a52[_0xa8a2('0x8f')],_0x39f3e1));}}});return Promise[_0xa8a2('0x98')](_0x4c226f);})['then'](function(_0x1877e5){_0x366f2d=_0x1877e5[0x0];var _0x19ad5a=[];var _0x59e4cd=[];_0xcb4f1b[_0xa8a2('0x95')](function(_0xe85531){if(!_[_0xa8a2('0x99')](_0xe85531['@odata.type'])){var _0x2f19a1=_0xe85531[_0xa8a2('0x96')][_0xa8a2('0x3e')](_0xe85531[_0xa8a2('0x96')][_0xa8a2('0x3f')]('.')+0x1);if(_0x2f19a1===_0xa8a2('0x9a')){_0x19ad5a[_0xa8a2('0x97')](getBooleanList(_0x3bd68a,_0x1b1829,_0x59e4cd,_0x3ced6f[_0xa8a2('0x8f')],_0xe85531['MetadataId'],_0x39f3e1));}}});return Promise[_0xa8a2('0x98')](_0x19ad5a);})[_0xa8a2('0xf')](function(_0x33627e){_0x1aa96c=_0x33627e[0x0];var _0x391fe7=[];var _0x4416bb=[];_0xcb4f1b[_0xa8a2('0x95')](function(_0x314a98){if(_0x314a98[_0xa8a2('0x96')]){var _0x57ee32=_0x314a98['@odata.type'][_0xa8a2('0x3e')](_0x314a98[_0xa8a2('0x96')][_0xa8a2('0x3f')]('.')+0x1);if(_0x57ee32===_0xa8a2('0x9b')||_0x57ee32==='DoubleAttributeMetadata'||_0x57ee32===_0xa8a2('0x9c')||_0x57ee32===_0xa8a2('0x9d')||_0x57ee32===_0xa8a2('0x9e')||_0x57ee32===_0xa8a2('0x9f')||_0x57ee32===_0xa8a2('0xa0')||_0x57ee32===_0xa8a2('0xa1')||_0x57ee32===_0xa8a2('0xa2')||_0x57ee32===_0xa8a2('0xa3')){_0x391fe7[_0xa8a2('0x97')](getInputList(_0x3bd68a,_0x1b1829,_0x57ee32,_0x4416bb,_0x3ced6f['MetadataId'],_0x314a98[_0xa8a2('0x8f')],_0x39f3e1));}}});return Promise[_0xa8a2('0x98')](_0x391fe7);})[_0xa8a2('0xf')](function(_0x52fb24){_0x211edf=_0x52fb24[0x0];var _0x20016f=_0x366f2d['concat'](_0x1aa96c)[_0xa8a2('0x7f')](_0x211edf);var _0x2ac632={'count':_0x20016f[_0xa8a2('0x30')],'rows':_0x20016f};return _0x2ac632;})[_0xa8a2('0xf')](respondWithResult(_0xb3633,null))[_0xa8a2('0x2c')](function(_0x575211){var _0x2831dc=_0x4afa0a[_0xa8a2('0x1d')][_0xa8a2('0xa4')]?0x1f4:_0x575211[_0xa8a2('0xa5')]||0x1f4;logger[_0xa8a2('0x13')](_0x575211[_0xa8a2('0xa6')]);delete _0x575211[_0xa8a2('0x1c')];if(_0x2831dc===0x191){_0x2831dc=0x190;}_0xb3633[_0xa8a2('0x6')](_0x2831dc)['send'](_0x4afa0a[_0xa8a2('0x1d')][_0xa8a2('0xa4')]?{'message':_0xa8a2('0xa7'),'statusCode':_0x575211[_0xa8a2('0xa5')]}:_0x575211);});};function getSelectList(_0x59a165,_0x43c1e,_0x1bcaa1,_0x43423e,_0x2b9bf4,_0x57fc9e){var _0x571a8b={'method':_0xa8a2('0x90'),'uri':_0x59a165+_0xa8a2('0xa8')+_0x43423e+')/Attributes('+_0x2b9bf4+_0xa8a2('0xa9')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x57fc9e,'If-None-Match':null,'OData-Version':_0xa8a2('0x8e')},'json':!![]};return rp(_0x571a8b)[_0xa8a2('0xf')](function(_0x1623c1){var _0x19909=[];var _0x2df28a=_0x1623c1['OptionSet'][_0xa8a2('0xaa')];_0x2df28a[_0xa8a2('0x95')](function(_0x4741d0){_0x19909[_0xa8a2('0x97')]({'name':_0x4741d0['Label'][_0xa8a2('0xab')]['Label'],'value':String(_0x4741d0[_0xa8a2('0xac')])});});var _0xd42696={'id':_0x43c1e+'_'+_0x1623c1[_0xa8a2('0x94')],'name':_0x1623c1[_0xa8a2('0xad')][_0xa8a2('0xab')][_0xa8a2('0xae')],'custom':![],'options':_0x19909};_0x1bcaa1['push'](_0xd42696);return _0x1bcaa1;});}function getBooleanList(_0x4dfc1a,_0x2b1415,_0x457e86,_0x3ba0c7,_0x5f07ae,_0x52b5e3){var _0x95a354={'method':_0xa8a2('0x90'),'uri':_0x4dfc1a+_0xa8a2('0xa8')+_0x3ba0c7+_0xa8a2('0xaf')+_0x5f07ae+_0xa8a2('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x52b5e3,'If-None-Match':null,'OData-Version':_0xa8a2('0x8e')},'json':!![]};return rp(_0x95a354)['then'](function(_0x33229e){var _0x5c1073=[];_0x5c1073[_0xa8a2('0x97')]({'name':_0x33229e['OptionSet']['TrueOption'][_0xa8a2('0xae')]['UserLocalizedLabel'][_0xa8a2('0xae')],'value':'true'},{'name':_0x33229e['OptionSet'][_0xa8a2('0xb1')]['Label']['UserLocalizedLabel'][_0xa8a2('0xae')],'value':_0xa8a2('0xb2')});var _0x2441c8={'id':_0x2b1415+'_'+_0x33229e['LogicalName'],'name':_0x33229e['DisplayName'][_0xa8a2('0xab')][_0xa8a2('0xae')],'custom':![],'options':_0x5c1073};_0x457e86[_0xa8a2('0x97')](_0x2441c8);return _0x457e86;});}function getInputList(_0x324a1e,_0x312220,_0x5a3389,_0x1f0a4,_0x1dd68b,_0x2c9247,_0x513967){var _0x37ced3={'method':_0xa8a2('0x90'),'uri':_0x324a1e+_0xa8a2('0xa8')+_0x1dd68b+_0xa8a2('0xaf')+_0x2c9247+')/Microsoft.Dynamics.CRM.'+_0x5a3389+_0xa8a2('0xb3'),'headers':{'Authorization':'Bearer\x20'+_0x513967,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x37ced3)[_0xa8a2('0xf')](function(_0x397764){var _0x220c54={'id':_0x312220+'_'+_0x397764[_0xa8a2('0x94')],'name':_0x397764[_0xa8a2('0xad')][_0xa8a2('0xab')]?_0x397764[_0xa8a2('0xad')][_0xa8a2('0xab')][_0xa8a2('0xae')]:_0x397764[_0xa8a2('0x94')],'custom':![],'options':[]};_0x1f0a4[_0xa8a2('0x97')](_0x220c54);return _0x1f0a4;});} \ No newline at end of file +var _0x641a=['data7','access_token','https://login.microsoftonline.com/','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','statusCode','stack','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','Options','Label','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','false',')/Microsoft.Dynamics.CRM.','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','undefined','limit','offset','count','set','update','then','destroy','end','sendStatus','error','name','send','index','map','Dynamics365Account','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','options','includeAll','include','rows','catch','merge','body','find','params','findOne','keys','filter','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','create','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','incident','Incident','PhoneCall','title','description','caseorigincode','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5'];(function(_0x4324e3,_0x17d826){var _0x114577=function(_0x65c5bb){while(--_0x65c5bb){_0x4324e3['push'](_0x4324e3['shift']());}};_0x114577(++_0x17d826);}(_0x641a,0xde));var _0xa641=function(_0x2d2201,_0x3cfe3d){_0x2d2201=_0x2d2201-0x0;var _0x12e6cd=_0x641a[_0x2d2201];return _0x12e6cd;};'use strict';var rp=require(_0xa641('0x0'));var util=require(_0xa641('0x1'));var _=require('lodash');var qs=require(_0xa641('0x2'));var logger=require(_0xa641('0x3'))(_0xa641('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa641('0x5'));function respondWithResult(_0x2ae71e,_0x5d98d2){_0x5d98d2=_0x5d98d2||0xc8;return function(_0x23e198){if(_0x23e198){return _0x2ae71e[_0xa641('0x6')](_0x5d98d2)[_0xa641('0x7')](_0x23e198);}};}function respondWithFilteredResult(_0x5f28d0,_0x4355a7){return function(_0x4e1912){if(_0x4e1912){var _0x2dd25a=typeof _0x4355a7['offset']===_0xa641('0x8')&&typeof _0x4355a7[_0xa641('0x9')]==='undefined';var _0x3dc63b=_0x4e1912['count'];var _0x1d0974=_0x2dd25a?0x0:_0x4355a7[_0xa641('0xa')];var _0x38c727=_0x2dd25a?_0x4e1912[_0xa641('0xb')]:_0x4355a7[_0xa641('0xa')]+_0x4355a7[_0xa641('0x9')];var _0x18b507;if(_0x38c727>=_0x3dc63b){_0x38c727=_0x3dc63b;_0x18b507=0xc8;}else{_0x18b507=0xce;}_0x5f28d0[_0xa641('0x6')](_0x18b507);return _0x5f28d0[_0xa641('0xc')]('Content-Range',_0x1d0974+'-'+_0x38c727+'/'+_0x3dc63b)['json'](_0x4e1912);}return null;};}function saveUpdates(_0x2dbf79){return function(_0x382e8b){if(_0x382e8b){return _0x382e8b[_0xa641('0xd')](_0x2dbf79)[_0xa641('0xe')](function(_0x418e74){return _0x418e74;});}return null;};}function removeEntity(_0x13f948){return function(_0x29f55a){if(_0x29f55a){return _0x29f55a[_0xa641('0xf')]()['then'](function(){_0x13f948['status'](0xcc)[_0xa641('0x10')]();});}};}function handleEntityNotFound(_0x5b29d9){return function(_0x472ff5){if(!_0x472ff5){_0x5b29d9[_0xa641('0x11')](0x194);}return _0x472ff5;};}function handleError(_0xee74cd,_0x52be5d){_0x52be5d=_0x52be5d||0x1f4;return function(_0xa343eb){logger[_0xa641('0x12')](_0xa343eb['stack']);if(_0xa343eb[_0xa641('0x13')]){delete _0xa343eb['name'];}_0xee74cd[_0xa641('0x6')](_0x52be5d)[_0xa641('0x14')](_0xa343eb);};}exports[_0xa641('0x15')]=function(_0x43bf3a,_0x1254c7){var _0x2d7172={},_0x2ebbfd={},_0x26babf={'count':0x0,'rows':[]};var _0x24d846=_[_0xa641('0x16')](db[_0xa641('0x17')][_0xa641('0x18')],function(_0xc14786){return{'name':_0xc14786['fieldName'],'type':_0xc14786['type'][_0xa641('0x19')]};});_0x2ebbfd[_0xa641('0x1a')]=_['map'](_0x24d846,'name');_0x2ebbfd[_0xa641('0x1b')]=_['keys'](_0x43bf3a[_0xa641('0x1b')]);_0x2ebbfd[_0xa641('0x1c')]=_[_0xa641('0x1d')](_0x2ebbfd[_0xa641('0x1a')],_0x2ebbfd[_0xa641('0x1b')]);_0x2d7172[_0xa641('0x1e')]=_[_0xa641('0x1d')](_0x2ebbfd[_0xa641('0x1a')],qs[_0xa641('0x1f')](_0x43bf3a['query'][_0xa641('0x1f')]));_0x2d7172[_0xa641('0x1e')]=_0x2d7172[_0xa641('0x1e')][_0xa641('0x20')]?_0x2d7172[_0xa641('0x1e')]:_0x2ebbfd[_0xa641('0x1a')];if(!_0x43bf3a[_0xa641('0x1b')][_0xa641('0x21')](_0xa641('0x22'))){_0x2d7172[_0xa641('0x9')]=qs['limit'](_0x43bf3a[_0xa641('0x1b')][_0xa641('0x9')]);_0x2d7172[_0xa641('0xa')]=qs[_0xa641('0xa')](_0x43bf3a[_0xa641('0x1b')]['offset']);}_0x2d7172[_0xa641('0x23')]=qs[_0xa641('0x24')](_0x43bf3a[_0xa641('0x1b')][_0xa641('0x24')]);_0x2d7172[_0xa641('0x25')]=qs[_0xa641('0x1c')](_[_0xa641('0x26')](_0x43bf3a[_0xa641('0x1b')],_0x2ebbfd[_0xa641('0x1c')]),_0x24d846);if(_0x43bf3a[_0xa641('0x1b')]['filter']){_0x2d7172['where']=_['merge'](_0x2d7172['where'],{'$or':_[_0xa641('0x16')](_0x24d846,function(_0x5d1194){if(_0x5d1194[_0xa641('0x27')]!==_0xa641('0x28')){var _0x6ef65c={};_0x6ef65c[_0x5d1194['name']]={'$like':'%'+_0x43bf3a['query']['filter']+'%'};return _0x6ef65c;}})});}_0x2d7172=_['merge']({},_0x2d7172,_0x43bf3a[_0xa641('0x29')]);var _0x481f7f={'where':_0x2d7172[_0xa641('0x25')]};return db[_0xa641('0x17')][_0xa641('0xb')](_0x481f7f)[_0xa641('0xe')](function(_0x4973a5){_0x26babf['count']=_0x4973a5;if(_0x43bf3a[_0xa641('0x1b')][_0xa641('0x2a')]){_0x2d7172[_0xa641('0x2b')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x2d7172);})[_0xa641('0xe')](function(_0xc8c85){_0x26babf[_0xa641('0x2c')]=_0xc8c85;return _0x26babf;})['then'](respondWithFilteredResult(_0x1254c7,_0x2d7172))[_0xa641('0x2d')](handleError(_0x1254c7,null));};exports['show']=function(_0xb3652d,_0x17a5b3){var _0x1a5ce2={'raw':![],'where':{'id':_0xb3652d['params']['id']}},_0x57d128={};_0x57d128['model']=_['keys'](db[_0xa641('0x17')]['rawAttributes']);_0x57d128['query']=_['keys'](_0xb3652d[_0xa641('0x1b')]);_0x57d128[_0xa641('0x1c')]=_['intersection'](_0x57d128[_0xa641('0x1a')],_0x57d128['query']);_0x1a5ce2['attributes']=_[_0xa641('0x1d')](_0x57d128[_0xa641('0x1a')],qs['fields'](_0xb3652d[_0xa641('0x1b')][_0xa641('0x1f')]));_0x1a5ce2['attributes']=_0x1a5ce2[_0xa641('0x1e')][_0xa641('0x20')]?_0x1a5ce2[_0xa641('0x1e')]:_0x57d128['model'];if(_0xb3652d[_0xa641('0x1b')][_0xa641('0x2a')]){_0x1a5ce2['include']=[{'all':!![]}];}_0x1a5ce2=_[_0xa641('0x2e')]({},_0x1a5ce2,_0xb3652d[_0xa641('0x29')]);return db[_0xa641('0x17')]['find'](_0x1a5ce2)[_0xa641('0xe')](handleEntityNotFound(_0x17a5b3,null))['then'](respondWithResult(_0x17a5b3,null))[_0xa641('0x2d')](handleError(_0x17a5b3,null));};exports['create']=function(_0x325b5d,_0x115035){return db['Dynamics365Account']['create'](_0x325b5d[_0xa641('0x2f')],{})[_0xa641('0xe')](respondWithResult(_0x115035,0xc9))['catch'](handleError(_0x115035,null));};exports[_0xa641('0xd')]=function(_0xbb057e,_0x3abc21){if(_0xbb057e[_0xa641('0x2f')]['id']){delete _0xbb057e[_0xa641('0x2f')]['id'];}return db['Dynamics365Account'][_0xa641('0x30')]({'where':{'id':_0xbb057e[_0xa641('0x31')]['id']}})[_0xa641('0xe')](handleEntityNotFound(_0x3abc21,null))[_0xa641('0xe')](saveUpdates(_0xbb057e['body'],null))[_0xa641('0xe')](respondWithResult(_0x3abc21,null))[_0xa641('0x2d')](handleError(_0x3abc21,null));};exports[_0xa641('0xf')]=function(_0x3e69f9,_0x1efd11){return db[_0xa641('0x17')][_0xa641('0x30')]({'where':{'id':_0x3e69f9[_0xa641('0x31')]['id']}})[_0xa641('0xe')](handleEntityNotFound(_0x1efd11,null))['then'](removeEntity(_0x1efd11,null))['catch'](handleError(_0x1efd11,null));};exports['getConfigurations']=function(_0x44b07d,_0x47288d){var _0x41bdc3={};var _0x48155d={};var _0x47337b;var _0x4567f5;return db[_0xa641('0x17')][_0xa641('0x32')]({'where':{'id':_0x44b07d[_0xa641('0x31')]['id']}})[_0xa641('0xe')](handleEntityNotFound(_0x47288d,null))['then'](function(_0x5c71ee){if(_0x5c71ee){_0x47337b=_0x5c71ee;_0x48155d['model']=_[_0xa641('0x33')](db['Dynamics365Configuration'][_0xa641('0x18')]);_0x48155d[_0xa641('0x1b')]=_[_0xa641('0x33')](_0x44b07d[_0xa641('0x1b')]);_0x48155d['filters']=_[_0xa641('0x1d')](_0x48155d['model'],_0x48155d[_0xa641('0x1b')]);_0x41bdc3[_0xa641('0x1e')]=_['intersection'](_0x48155d['model'],qs[_0xa641('0x1f')](_0x44b07d[_0xa641('0x1b')]['fields']));_0x41bdc3[_0xa641('0x1e')]=_0x41bdc3[_0xa641('0x1e')][_0xa641('0x20')]?_0x41bdc3[_0xa641('0x1e')]:_0x48155d[_0xa641('0x1a')];_0x41bdc3['order']=qs[_0xa641('0x24')](_0x44b07d[_0xa641('0x1b')][_0xa641('0x24')]);_0x41bdc3[_0xa641('0x25')]=qs['filters'](_[_0xa641('0x26')](_0x44b07d['query'],_0x48155d[_0xa641('0x1c')]));if(_0x44b07d[_0xa641('0x1b')]['filter']){_0x41bdc3[_0xa641('0x25')]=_[_0xa641('0x2e')](_0x41bdc3['where'],{'$or':_[_0xa641('0x16')](_0x41bdc3['attributes'],function(_0x100d61){var _0x94dffe={};_0x94dffe[_0x100d61]={'$like':'%'+_0x44b07d['query'][_0xa641('0x34')]+'%'};return _0x94dffe;})});}_0x41bdc3=_[_0xa641('0x2e')]({},_0x41bdc3,_0x44b07d['options']);return _0x47337b[_0xa641('0x35')](_0x41bdc3);}})[_0xa641('0xe')](function(_0x4a55b3){if(_0x4a55b3){_0x4567f5=_0x4a55b3[_0xa641('0x20')];if(!_0x44b07d[_0xa641('0x1b')][_0xa641('0x21')](_0xa641('0x22'))){_0x41bdc3['limit']=qs['limit'](_0x44b07d[_0xa641('0x1b')][_0xa641('0x9')]);_0x41bdc3[_0xa641('0xa')]=qs['offset'](_0x44b07d['query']['offset']);}return _0x47337b[_0xa641('0x35')](_0x41bdc3);}})[_0xa641('0xe')](function(_0x32825f){if(_0x32825f){return _0x32825f?{'count':_0x4567f5,'rows':_0x32825f}:null;}})['then'](respondWithResult(_0x47288d,null))[_0xa641('0x2d')](handleError(_0x47288d,null));};exports[_0xa641('0x36')]=function(_0x5773e6,_0x2434e3){if(_0x5773e6[_0xa641('0x2f')]['id']){delete _0x5773e6['body']['id'];}return db[_0xa641('0x17')][_0xa641('0x32')]({'where':{'id':_0x5773e6['params']['id']}})['then'](handleEntityNotFound(_0x2434e3,null))[_0xa641('0xe')](function(_0xa031cd){if(_0xa031cd){_0x5773e6['body'][_0xa641('0x37')]=_0xa031cd['id'];_0x5773e6['body'][_0xa641('0x38')]=integrations['getSubjects'](_0x5773e6['body'][_0xa641('0x39')],_0x5773e6[_0xa641('0x2f')][_0xa641('0x27')]);_0x5773e6[_0xa641('0x2f')][_0xa641('0x3a')]=integrations[_0xa641('0x3b')](_0x5773e6[_0xa641('0x2f')][_0xa641('0x39')],_0x5773e6['body'][_0xa641('0x27')]);return db[_0xa641('0x3c')][_0xa641('0x3d')](_0x5773e6[_0xa641('0x2f')],{'include':[{'model':db[_0xa641('0x3e')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0xa641('0x3a')}]});}return null;})[_0xa641('0xe')](respondWithResult(_0x2434e3,null))[_0xa641('0x2d')](handleError(_0x2434e3,null));};function sanitizeRemoteUri(_0x53b4b9){var _0x44e065=_0x53b4b9[_0xa641('0x3f')](-0x1);if(_0x44e065==='/')return _0x53b4b9[_0xa641('0x40')](0x0,_0x53b4b9[_0xa641('0x41')](_0x44e065));return _0x53b4b9;}function getWebApiUrl(_0x4c0e96){return util[_0xa641('0x42')](_0xa641('0x43'),_0x4c0e96);}exports['getFields']=function(_0x3763dd,_0x2d7962){var _0x150f47=_0x3763dd[_0xa641('0x1b')]['ticketType'];var _0x2545dc=_0x150f47===_0xa641('0x44')?_0xa641('0x45'):_0xa641('0x46');var _0x388b67='';var _0x239023='';var _0x1697b7='';var _0x46e0df='';var _0x169e83='';var _0x4fb2e5='';var _0x545b70='';var _0x15f506='';var _0x225d4a=[_0xa641('0x47'),_0xa641('0x48'),'customerid','ownerid',_0xa641('0x49'),'subject',_0xa641('0x4a'),'regardingobjectid',_0xa641('0x4b'),'phonecall_activity_parties'];var _0x6f6a7f=[_0xa641('0x4c'),_0xa641('0x4d'),_0xa641('0x4e'),'billedserviceunits',_0xa641('0x4f'),_0xa641('0x50'),'contractdetailidname',_0xa641('0x51'),_0xa641('0x52'),_0xa641('0x53'),_0xa641('0x54'),_0xa641('0x55'),_0xa641('0x56'),_0xa641('0x57'),_0xa641('0x58'),'customeridname','customeridtype',_0xa641('0x59'),'emailaddress','entitlementidname',_0xa641('0x5a'),_0xa641('0x5b'),_0xa641('0x5c'),_0xa641('0x5d'),_0xa641('0x5e'),_0xa641('0x5f'),'importsequencenumber','influencescore',_0xa641('0x60'),_0xa641('0x61'),_0xa641('0x62'),'modifiedbyexternalpartyname',_0xa641('0x63'),_0xa641('0x64'),_0xa641('0x65'),'modifiedon',_0xa641('0x66'),_0xa641('0x67'),_0xa641('0x68'),'msdyn_iotalertname',_0xa641('0x69'),_0xa641('0x6a'),_0xa641('0x6b'),'owneridname','owneridtype',_0xa641('0x6c'),'parentcaseidname',_0xa641('0x6d'),_0xa641('0x6e'),_0xa641('0x6f'),_0xa641('0x70'),'productserialnumber',_0xa641('0x71'),_0xa641('0x72'),_0xa641('0x73'),_0xa641('0x74'),_0xa641('0x75'),_0xa641('0x76'),_0xa641('0x77'),'slaname','socialprofileidname',_0xa641('0x78'),_0xa641('0x79'),_0xa641('0x7a'),_0xa641('0x7b'),_0xa641('0x7c'),_0xa641('0x7d'),_0xa641('0x7e'),_0xa641('0x7f'),_0xa641('0x80')];var _0x4f0cdd=_0x225d4a[_0xa641('0x81')](_0x6f6a7f);return db[_0xa641('0x17')][_0xa641('0x32')]({'where':{'id':_0x3763dd['params']['id']},'attributes':['id',_0xa641('0x82'),'password',_0xa641('0x83'),_0xa641('0x84'),_0xa641('0x85'),_0xa641('0x86'),_0xa641('0x87')],'include':[{'model':db[_0xa641('0x88')],'as':_0xa641('0x88'),'attributes':['id',_0xa641('0x89'),_0xa641('0x8a')]}]})[_0xa641('0xe')](handleEntityNotFound(_0x2d7962,null))[_0xa641('0xe')](function(_0x5bc204){if(_0x5bc204){if(_0x5bc204[_0xa641('0x87')]){_0x5bc204[_0xa641('0x8b')]=_0x5bc204[_0xa641('0x88')][_0xa641('0x89')];_0x15f506=sanitizeRemoteUri(_0x5bc204['CloudProvider'][_0xa641('0x8a')]);_0x545b70=getWebApiUrl(_0x15f506);return _0x5bc204;}_0x15f506=sanitizeRemoteUri(_0x5bc204['remoteUri']);_0x545b70=getWebApiUrl(_0x15f506);var _0x50b5e2={'method':'POST','uri':_0xa641('0x8c')+_0x5bc204[_0xa641('0x84')]+_0xa641('0x8d'),'form':{'client_id':_0x5bc204['clientId'],'resource':_0x15f506,'username':_0x5bc204[_0xa641('0x82')],'password':_0x5bc204[_0xa641('0x8e')],'grant_type':'password','client_secret':_0x5bc204[_0xa641('0x86')]},'json':!![]};return rp(_0x50b5e2);}})[_0xa641('0xe')](function(_0x232e71){_0x4fb2e5=_0x232e71[_0xa641('0x8b')];var _0x2d05f5={'method':_0xa641('0x8f'),'uri':encodeURI(_0x545b70+_0xa641('0x90')+_0x2545dc+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4fb2e5,'If-None-Match':null,'OData-Version':_0xa641('0x91')},'json':!![]};return rp(_0x2d05f5);})[_0xa641('0xe')](function(_0x4feec2){var _0x49c272=_0x4feec2[_0xa641('0x92')][0x0];var _0x3743ec=_0x49c272[_0xa641('0x93')];var _0x3d558c={'method':_0xa641('0x8f'),'uri':_0x545b70+_0xa641('0x94')+_0x3743ec+_0xa641('0x95'),'headers':{'Authorization':'Bearer\x20'+_0x4fb2e5,'If-None-Match':null,'OData-Version':_0xa641('0x91')},'json':!![]};return rp(_0x3d558c);})[_0xa641('0xe')](function(_0x5c8b9e){_0x388b67=_0x5c8b9e;_0x239023=_0x388b67[_0xa641('0x96')];_0x239023=_[_0xa641('0x97')](_0x239023,function(_0x909a4c){return!_0x4f0cdd[_0xa641('0x98')](_0x909a4c[_0xa641('0x99')]);});var _0x1240d6=[];var _0x36a918=[];_0x239023['forEach'](function(_0x3e07e9){if(_0x3e07e9[_0xa641('0x9a')]){var _0x4431d5=_0x3e07e9[_0xa641('0x9a')][_0xa641('0x40')](_0x3e07e9['@odata.type'][_0xa641('0x41')]('.')+0x1);if(_0x4431d5===_0xa641('0x9b')){_0x1240d6[_0xa641('0x9c')](getSelectList(_0x545b70,_0x150f47,_0x36a918,_0x388b67[_0xa641('0x93')],_0x3e07e9[_0xa641('0x93')],_0x4fb2e5));}}});return Promise[_0xa641('0x9d')](_0x1240d6);})['then'](function(_0x8fdec3){_0x1697b7=_0x8fdec3[0x0];var _0x96a964=[];var _0x220f74=[];_0x239023[_0xa641('0x9e')](function(_0x1bb1e1){if(!_['isNil'](_0x1bb1e1[_0xa641('0x9a')])){var _0x80a665=_0x1bb1e1[_0xa641('0x9a')]['substring'](_0x1bb1e1[_0xa641('0x9a')]['lastIndexOf']('.')+0x1);if(_0x80a665===_0xa641('0x9f')){_0x96a964['push'](getBooleanList(_0x545b70,_0x150f47,_0x220f74,_0x388b67['MetadataId'],_0x1bb1e1['MetadataId'],_0x4fb2e5));}}});return Promise[_0xa641('0x9d')](_0x96a964);})[_0xa641('0xe')](function(_0x5ea587){_0x46e0df=_0x5ea587[0x0];var _0x404a4a=[];var _0x779fb5=[];_0x239023[_0xa641('0x9e')](function(_0x4dc7c9){if(_0x4dc7c9[_0xa641('0x9a')]){var _0x543009=_0x4dc7c9[_0xa641('0x9a')][_0xa641('0x40')](_0x4dc7c9[_0xa641('0x9a')][_0xa641('0x41')]('.')+0x1);if(_0x543009==='StringAttributeMetadata'||_0x543009==='DoubleAttributeMetadata'||_0x543009===_0xa641('0xa0')||_0x543009===_0xa641('0xa1')||_0x543009==='MemoAttributeMetadata'||_0x543009===_0xa641('0xa2')||_0x543009==='StatusAttributeMetadata'||_0x543009==='EntityNameAttributeMetadata'||_0x543009==='StateAttributeMetadata'||_0x543009==='DecimalAttributeMetadata'){_0x404a4a[_0xa641('0x9c')](getInputList(_0x545b70,_0x150f47,_0x543009,_0x779fb5,_0x388b67[_0xa641('0x93')],_0x4dc7c9[_0xa641('0x93')],_0x4fb2e5));}}});return Promise[_0xa641('0x9d')](_0x404a4a);})[_0xa641('0xe')](function(_0x10e814){_0x169e83=_0x10e814[0x0];var _0x3263ea=_0x1697b7[_0xa641('0x81')](_0x46e0df)[_0xa641('0x81')](_0x169e83);var _0x28ffad={'count':_0x3263ea[_0xa641('0x20')],'rows':_0x3263ea};return _0x28ffad;})[_0xa641('0xe')](respondWithResult(_0x2d7962,null))[_0xa641('0x2d')](function(_0x495a77){var _0x1420e7=_0x3763dd[_0xa641('0x1b')]['test']?0x1f4:_0x495a77[_0xa641('0xa3')]||0x1f4;logger[_0xa641('0x12')](_0x495a77[_0xa641('0xa4')]);delete _0x495a77['name'];if(_0x1420e7===0x191){_0x1420e7=0x190;}_0x2d7962['status'](_0x1420e7)[_0xa641('0x14')](_0x3763dd[_0xa641('0x1b')][_0xa641('0xa5')]?{'message':_0xa641('0xa6'),'statusCode':_0x495a77['statusCode']}:_0x495a77);});};function getSelectList(_0x1d2c3b,_0x18fcf5,_0x6aa2d1,_0x18308c,_0x34fa26,_0x39ff79){var _0xe72d08={'method':'GET','uri':_0x1d2c3b+_0xa641('0x94')+_0x18308c+_0xa641('0xa7')+_0x34fa26+_0xa641('0xa8')+_0xa641('0xa9'),'headers':{'Authorization':_0xa641('0xaa')+_0x39ff79,'If-None-Match':null,'OData-Version':_0xa641('0x91')},'json':!![]};return rp(_0xe72d08)['then'](function(_0x28ae96){var _0x465cbb=[];var _0x23fd57=_0x28ae96['OptionSet'][_0xa641('0xab')];_0x23fd57[_0xa641('0x9e')](function(_0xab00f9){_0x465cbb['push']({'name':_0xab00f9[_0xa641('0xac')]['UserLocalizedLabel']['Label'],'value':String(_0xab00f9['Value'])});});var _0x486e68={'id':_0x18fcf5+'_'+_0x28ae96[_0xa641('0x99')],'name':_0x28ae96[_0xa641('0xad')][_0xa641('0xae')][_0xa641('0xac')],'custom':![],'options':_0x465cbb};_0x6aa2d1[_0xa641('0x9c')](_0x486e68);return _0x6aa2d1;});}function getBooleanList(_0x133e51,_0x2b4bf8,_0x2696aa,_0x1607b1,_0x582f1b,_0x473454){var _0x212548={'method':_0xa641('0x8f'),'uri':_0x133e51+_0xa641('0x94')+_0x1607b1+_0xa641('0xa7')+_0x582f1b+_0xa641('0xaf'),'headers':{'Authorization':_0xa641('0xaa')+_0x473454,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x212548)[_0xa641('0xe')](function(_0x4b1077){var _0x37a8a1=[];_0x37a8a1[_0xa641('0x9c')]({'name':_0x4b1077[_0xa641('0xb0')][_0xa641('0xb1')]['Label'][_0xa641('0xae')][_0xa641('0xac')],'value':'true'},{'name':_0x4b1077[_0xa641('0xb0')]['FalseOption']['Label']['UserLocalizedLabel']['Label'],'value':_0xa641('0xb2')});var _0x3ebcc0={'id':_0x2b4bf8+'_'+_0x4b1077[_0xa641('0x99')],'name':_0x4b1077[_0xa641('0xad')][_0xa641('0xae')][_0xa641('0xac')],'custom':![],'options':_0x37a8a1};_0x2696aa['push'](_0x3ebcc0);return _0x2696aa;});}function getInputList(_0x1d68d4,_0x56fd05,_0x4610cb,_0x4ca409,_0x217ca8,_0x5d19f1,_0x4d1feb){var _0x33110f={'method':_0xa641('0x8f'),'uri':_0x1d68d4+'EntityDefinitions('+_0x217ca8+_0xa641('0xa7')+_0x5d19f1+_0xa641('0xb3')+_0x4610cb+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xa641('0xaa')+_0x4d1feb,'If-None-Match':null,'OData-Version':_0xa641('0x91')},'json':!![]};return rp(_0x33110f)[_0xa641('0xe')](function(_0x2f4281){var _0x180e2e={'id':_0x56fd05+'_'+_0x2f4281[_0xa641('0x99')],'name':_0x2f4281[_0xa641('0xad')]['UserLocalizedLabel']?_0x2f4281[_0xa641('0xad')][_0xa641('0xae')]['Label']:_0x2f4281['LogicalName'],'custom':![],'options':[]};_0x4ca409[_0xa641('0x9c')](_0x180e2e);return _0x4ca409;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a5a1369..c683b3d 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0xff6063,_0x4d4f9){var _0x1a2466=function(_0x143bdd){while(--_0x143bdd){_0xff6063['push'](_0xff6063['shift']());}};_0x1a2466(++_0x4d4f9);}(_0xe706,0xa3));var _0x6e70=function(_0x3dff0d,_0x4d59ff){_0x3dff0d=_0x3dff0d-0x0;var _0x352383=_0xe706[_0x3dff0d];return _0x352383;};'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'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x4fd9ca,_0x12887f){var _0x208f49=function(_0x32b40c){while(--_0x32b40c){_0x4fd9ca['push'](_0x4fd9ca['shift']());}};_0x208f49(++_0x12887f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 8cc2bda..f709615 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 _0x3430=['request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetDynamics365Account','findAll','options','raw','attributes','include','map','model','where','ShowDynamics365Account','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s'];(function(_0x30b784,_0x116fa9){var _0xe18661=function(_0x49b87e){while(--_0x49b87e){_0x30b784['push'](_0x30b784['shift']());}};_0xe18661(++_0x116fa9);}(_0x3430,0x6b));var _0x0343=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x3430[_0x56ba92];return _0x8fe94d;};'use strict';var _=require(_0x0343('0x0'));var util=require(_0x0343('0x1'));var moment=require(_0x0343('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0343('0x3'));var db=require(_0x0343('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0343('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0343('0x6'));var client=jayson[_0x0343('0x7')][_0x0343('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a7533,_0x39e4ce,_0x5a48f2){return new BPromise(function(_0x28d48a,_0x5bde19){return client[_0x0343('0x9')](_0x3a7533,_0x5a48f2)[_0x0343('0xa')](function(_0x3cffb3){logger[_0x0343('0xb')](_0x0343('0xc'),_0x39e4ce,_0x0343('0xd'));logger[_0x0343('0xe')](_0x0343('0xf'),_0x39e4ce,_0x0343('0xd'),JSON[_0x0343('0x10')](_0x3cffb3));if(_0x3cffb3['error']){if(_0x3cffb3[_0x0343('0x11')][_0x0343('0x12')]===0x1f4){logger['error'](_0x0343('0xc'),_0x39e4ce,_0x3cffb3[_0x0343('0x11')]['message']);return _0x5bde19(_0x3cffb3[_0x0343('0x11')]['message']);}logger['error'](_0x0343('0xc'),_0x39e4ce,_0x3cffb3[_0x0343('0x11')][_0x0343('0x13')]);return _0x28d48a(_0x3cffb3[_0x0343('0x11')][_0x0343('0x13')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x39e4ce,_0x0343('0xd'));_0x28d48a(_0x3cffb3['result']['message']);}})['catch'](function(_0x59d75c){logger['error'](_0x0343('0xc'),_0x39e4ce,_0x59d75c);_0x5bde19(_0x59d75c);});});}exports[_0x0343('0x14')]=function(_0x35a84b){var _0x46c2a5=this;return new Promise(function(_0x446ab3,_0x392960){return db['Dynamics365Account'][_0x0343('0x15')]({'raw':_0x35a84b['options']?_0x35a84b[_0x0343('0x16')][_0x0343('0x17')]===undefined?!![]:![]:!![],'where':_0x35a84b['options']?_0x35a84b[_0x0343('0x16')]['where']||null:null,'attributes':_0x35a84b[_0x0343('0x16')]?_0x35a84b[_0x0343('0x16')][_0x0343('0x18')]||null:null,'limit':_0x35a84b[_0x0343('0x16')]?_0x35a84b['options']['limit']||null:null,'include':_0x35a84b['options']?_0x35a84b['options'][_0x0343('0x19')]?_[_0x0343('0x1a')](_0x35a84b[_0x0343('0x16')][_0x0343('0x19')],function(_0x3a6539){return{'model':db[_0x3a6539[_0x0343('0x1b')]],'as':_0x3a6539['as'],'attributes':_0x3a6539[_0x0343('0x18')],'include':_0x3a6539[_0x0343('0x19')]?_['map'](_0x3a6539[_0x0343('0x19')],function(_0x33d2c6){return{'model':db[_0x33d2c6[_0x0343('0x1b')]],'as':_0x33d2c6['as'],'attributes':_0x33d2c6[_0x0343('0x18')],'include':_0x33d2c6[_0x0343('0x19')]?_[_0x0343('0x1a')](_0x33d2c6[_0x0343('0x19')],function(_0x52a238){return{'model':db[_0x52a238[_0x0343('0x1b')]],'as':_0x52a238['as'],'attributes':_0x52a238[_0x0343('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0343('0xa')](function(_0x2297c1){logger[_0x0343('0xb')](_0x0343('0x14'),_0x35a84b);logger[_0x0343('0xe')](_0x0343('0x14'),_0x35a84b,JSON[_0x0343('0x10')](_0x2297c1));_0x446ab3(_0x2297c1);})['catch'](function(_0x586d3a){logger['error'](_0x0343('0x14'),_0x586d3a[_0x0343('0x13')],_0x35a84b);_0x392960(_0x46c2a5[_0x0343('0x11')](0x1f4,_0x586d3a[_0x0343('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x18bde1){var _0x173d10=this;return new Promise(function(_0x148449,_0x420370){return db['Dynamics365Account']['find']({'raw':_0x18bde1['options']?_0x18bde1[_0x0343('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x18bde1[_0x0343('0x16')]?_0x18bde1['options'][_0x0343('0x1c')]||null:null,'attributes':_0x18bde1[_0x0343('0x16')]?_0x18bde1['options'][_0x0343('0x18')]||null:null,'include':_0x18bde1['options']?_0x18bde1[_0x0343('0x16')]['include']?_[_0x0343('0x1a')](_0x18bde1[_0x0343('0x16')][_0x0343('0x19')],function(_0x315c7d){return{'model':db[_0x315c7d[_0x0343('0x1b')]],'as':_0x315c7d['as'],'attributes':_0x315c7d[_0x0343('0x18')],'include':_0x315c7d[_0x0343('0x19')]?_[_0x0343('0x1a')](_0x315c7d[_0x0343('0x19')],function(_0x489411){return{'model':db[_0x489411[_0x0343('0x1b')]],'as':_0x489411['as'],'attributes':_0x489411[_0x0343('0x18')],'include':_0x489411[_0x0343('0x19')]?_[_0x0343('0x1a')](_0x489411[_0x0343('0x19')],function(_0x10aa13){return{'model':db[_0x10aa13[_0x0343('0x1b')]],'as':_0x10aa13['as'],'attributes':_0x10aa13[_0x0343('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0343('0xa')](function(_0x4c2a33){logger[_0x0343('0xb')](_0x0343('0x1d'),_0x18bde1);logger[_0x0343('0xe')](_0x0343('0x1d'),_0x18bde1,JSON[_0x0343('0x10')](_0x4c2a33));_0x148449(_0x4c2a33);})['catch'](function(_0x398abb){logger[_0x0343('0x11')](_0x0343('0x1d'),_0x398abb[_0x0343('0x13')],_0x18bde1);_0x420370(_0x173d10[_0x0343('0x11')](0x1f4,_0x398abb[_0x0343('0x13')]));});});}; \ No newline at end of file +var _0xa5d6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','options','where','attributes','limit','include','map','model','debug','catch','ShowDynamics365Account','find','raw','lodash','util','bluebird','randomstring'];(function(_0x5c97e5,_0x8c41dc){var _0x189b0a=function(_0x22b32f){while(--_0x22b32f){_0x5c97e5['push'](_0x5c97e5['shift']());}};_0x189b0a(++_0x8c41dc);}(_0xa5d6,0xb5));var _0x6a5d=function(_0xb25c7e,_0x5c8388){_0xb25c7e=_0xb25c7e-0x0;var _0x10d5d0=_0xa5d6[_0xb25c7e];return _0x10d5d0;};'use strict';var _=require(_0x6a5d('0x0'));var util=require(_0x6a5d('0x1'));var moment=require('moment');var BPromise=require(_0x6a5d('0x2'));var rs=require(_0x6a5d('0x3'));var fs=require('fs');var Redis=require(_0x6a5d('0x4'));var db=require(_0x6a5d('0x5'))['db'];var utils=require(_0x6a5d('0x6'));var logger=require(_0x6a5d('0x7'))(_0x6a5d('0x8'));var config=require(_0x6a5d('0x9'));var jayson=require(_0x6a5d('0xa'));var client=jayson[_0x6a5d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1aeaed,_0x19c7f1,_0x437689){return new BPromise(function(_0x54b84b,_0x49eb75){return client[_0x6a5d('0xc')](_0x1aeaed,_0x437689)[_0x6a5d('0xd')](function(_0x164e4c){logger[_0x6a5d('0xe')](_0x6a5d('0xf'),_0x19c7f1,_0x6a5d('0x10'));logger['debug'](_0x6a5d('0x11'),_0x19c7f1,'request\x20sent',JSON[_0x6a5d('0x12')](_0x164e4c));if(_0x164e4c[_0x6a5d('0x13')]){if(_0x164e4c[_0x6a5d('0x13')][_0x6a5d('0x14')]===0x1f4){logger[_0x6a5d('0x13')](_0x6a5d('0xf'),_0x19c7f1,_0x164e4c[_0x6a5d('0x13')][_0x6a5d('0x15')]);return _0x49eb75(_0x164e4c[_0x6a5d('0x13')][_0x6a5d('0x15')]);}logger[_0x6a5d('0x13')](_0x6a5d('0xf'),_0x19c7f1,_0x164e4c[_0x6a5d('0x13')][_0x6a5d('0x15')]);return _0x54b84b(_0x164e4c[_0x6a5d('0x13')]['message']);}else{logger['info'](_0x6a5d('0xf'),_0x19c7f1,'request\x20sent');_0x54b84b(_0x164e4c[_0x6a5d('0x16')][_0x6a5d('0x15')]);}})['catch'](function(_0x57150f){logger[_0x6a5d('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x19c7f1,_0x57150f);_0x49eb75(_0x57150f);});});}exports[_0x6a5d('0x17')]=function(_0x308698){var _0x2ad6f9=this;return new Promise(function(_0xcfc8fa,_0x368e22){return db[_0x6a5d('0x18')]['findAll']({'raw':_0x308698[_0x6a5d('0x19')]?_0x308698[_0x6a5d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x308698[_0x6a5d('0x19')]?_0x308698['options'][_0x6a5d('0x1a')]||null:null,'attributes':_0x308698[_0x6a5d('0x19')]?_0x308698['options'][_0x6a5d('0x1b')]||null:null,'limit':_0x308698[_0x6a5d('0x19')]?_0x308698['options'][_0x6a5d('0x1c')]||null:null,'include':_0x308698['options']?_0x308698['options'][_0x6a5d('0x1d')]?_[_0x6a5d('0x1e')](_0x308698[_0x6a5d('0x19')][_0x6a5d('0x1d')],function(_0x3a4b9b){return{'model':db[_0x3a4b9b[_0x6a5d('0x1f')]],'as':_0x3a4b9b['as'],'attributes':_0x3a4b9b[_0x6a5d('0x1b')],'include':_0x3a4b9b[_0x6a5d('0x1d')]?_['map'](_0x3a4b9b['include'],function(_0x158f4f){return{'model':db[_0x158f4f[_0x6a5d('0x1f')]],'as':_0x158f4f['as'],'attributes':_0x158f4f['attributes'],'include':_0x158f4f[_0x6a5d('0x1d')]?_[_0x6a5d('0x1e')](_0x158f4f[_0x6a5d('0x1d')],function(_0x205b8e){return{'model':db[_0x205b8e[_0x6a5d('0x1f')]],'as':_0x205b8e['as'],'attributes':_0x205b8e[_0x6a5d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4982f1){logger[_0x6a5d('0xe')]('GetDynamics365Account',_0x308698);logger[_0x6a5d('0x20')](_0x6a5d('0x17'),_0x308698,JSON[_0x6a5d('0x12')](_0x4982f1));_0xcfc8fa(_0x4982f1);})[_0x6a5d('0x21')](function(_0x52712b){logger['error'](_0x6a5d('0x17'),_0x52712b[_0x6a5d('0x15')],_0x308698);_0x368e22(_0x2ad6f9[_0x6a5d('0x13')](0x1f4,_0x52712b[_0x6a5d('0x15')]));});});};exports[_0x6a5d('0x22')]=function(_0x4e5eb5){var _0x32ab69=this;return new Promise(function(_0x4efa87,_0x5a109c){return db[_0x6a5d('0x18')][_0x6a5d('0x23')]({'raw':_0x4e5eb5[_0x6a5d('0x19')]?_0x4e5eb5[_0x6a5d('0x19')][_0x6a5d('0x24')]===undefined?!![]:![]:!![],'where':_0x4e5eb5[_0x6a5d('0x19')]?_0x4e5eb5[_0x6a5d('0x19')][_0x6a5d('0x1a')]||null:null,'attributes':_0x4e5eb5[_0x6a5d('0x19')]?_0x4e5eb5['options'][_0x6a5d('0x1b')]||null:null,'include':_0x4e5eb5[_0x6a5d('0x19')]?_0x4e5eb5[_0x6a5d('0x19')]['include']?_[_0x6a5d('0x1e')](_0x4e5eb5['options'][_0x6a5d('0x1d')],function(_0x3be8b3){return{'model':db[_0x3be8b3['model']],'as':_0x3be8b3['as'],'attributes':_0x3be8b3[_0x6a5d('0x1b')],'include':_0x3be8b3['include']?_[_0x6a5d('0x1e')](_0x3be8b3[_0x6a5d('0x1d')],function(_0x5a011b){return{'model':db[_0x5a011b[_0x6a5d('0x1f')]],'as':_0x5a011b['as'],'attributes':_0x5a011b[_0x6a5d('0x1b')],'include':_0x5a011b[_0x6a5d('0x1d')]?_[_0x6a5d('0x1e')](_0x5a011b['include'],function(_0x5f0471){return{'model':db[_0x5f0471['model']],'as':_0x5f0471['as'],'attributes':_0x5f0471[_0x6a5d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6a5d('0xd')](function(_0x2e8ad9){logger[_0x6a5d('0xe')](_0x6a5d('0x22'),_0x4e5eb5);logger[_0x6a5d('0x20')](_0x6a5d('0x22'),_0x4e5eb5,JSON['stringify'](_0x2e8ad9));_0x4efa87(_0x2e8ad9);})[_0x6a5d('0x21')](function(_0x19f5ef){logger[_0x6a5d('0x13')](_0x6a5d('0x22'),_0x19f5ef['message'],_0x4e5eb5);_0x5a109c(_0x32ab69[_0x6a5d('0x13')](0x1f4,_0x19f5ef[_0x6a5d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 94168ea..db677e3 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 _0x4273=['getDescriptions','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4273,0xc5));var _0x3427=function(_0x49f94d,_0x3cb2f9){_0x49f94d=_0x49f94d-0x0;var _0xf6da6=_0x4273[_0x49f94d];return _0xf6da6;};'use strict';var multer=require(_0x3427('0x0'));var util=require(_0x3427('0x1'));var path=require(_0x3427('0x2'));var timeout=require('connect-timeout');var express=require(_0x3427('0x3'));var router=express[_0x3427('0x4')]();var fs_extra=require(_0x3427('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x3427('0x6')]('/',auth[_0x3427('0x7')](),controller['index']);router[_0x3427('0x6')]('/:id',auth[_0x3427('0x7')](),controller[_0x3427('0x8')]);router['get'](_0x3427('0x9'),auth['isAuthenticated'](),controller['getFields']);router[_0x3427('0x6')](_0x3427('0xa'),auth[_0x3427('0x7')](),controller[_0x3427('0xb')]);router[_0x3427('0x6')](_0x3427('0xc'),auth[_0x3427('0x7')](),controller[_0x3427('0xd')]);router[_0x3427('0xe')]('/',auth[_0x3427('0x7')](),controller[_0x3427('0xf')]);router[_0x3427('0x10')](_0x3427('0x11'),auth[_0x3427('0x7')](),controller['update']);router[_0x3427('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3427('0x13')]);module[_0x3427('0x14')]=router; \ No newline at end of file +var _0xcd78=['connect-timeout','express','Router','fs-extra','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id/fields','/:id/subjects','getSubjects','post','create','put','/:id','update','exports','multer','util'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0xcd78,0xa9));var _0x8cd7=function(_0x15b97a,_0x405cd8){_0x15b97a=_0x15b97a-0x0;var _0x729867=_0xcd78[_0x15b97a];return _0x729867;};'use strict';var multer=require(_0x8cd7('0x0'));var util=require(_0x8cd7('0x1'));var path=require('path');var timeout=require(_0x8cd7('0x2'));var express=require(_0x8cd7('0x3'));var router=express[_0x8cd7('0x4')]();var fs_extra=require(_0x8cd7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8cd7('0x6'));router['get']('/',auth[_0x8cd7('0x7')](),controller[_0x8cd7('0x8')]);router[_0x8cd7('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8cd7('0x9')](_0x8cd7('0xa'),auth[_0x8cd7('0x7')](),controller['getFields']);router['get'](_0x8cd7('0xb'),auth[_0x8cd7('0x7')](),controller[_0x8cd7('0xc')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x8cd7('0xd')]('/',auth[_0x8cd7('0x7')](),controller[_0x8cd7('0xe')]);router[_0x8cd7('0xf')](_0x8cd7('0x10'),auth[_0x8cd7('0x7')](),controller[_0x8cd7('0x11')]);router['delete'](_0x8cd7('0x10'),auth[_0x8cd7('0x7')](),controller['destroy']);module[_0x8cd7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 678f480..22ff495 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 _0xf5b7=['ENUM','phonecall','incident','contact','nothing','BOOLEAN','exports','STRING'];(function(_0x20b25b,_0x2b271f){var _0x59a495=function(_0x45dcbe){while(--_0x45dcbe){_0x20b25b['push'](_0x20b25b['shift']());}};_0x59a495(++_0x2b271f);}(_0xf5b7,0xce));var _0x7f5b=function(_0x5551ef,_0x1bce6f){_0x5551ef=_0x5551ef-0x0;var _0x2f84ef=_0xf5b7[_0x5551ef];return _0x2f84ef;};'use strict';var Sequelize=require('sequelize');module[_0x7f5b('0x0')]={'name':{'type':Sequelize[_0x7f5b('0x1')]},'description':{'type':Sequelize[_0x7f5b('0x1')]},'ticketType':{'type':Sequelize[_0x7f5b('0x2')]('incident',_0x7f5b('0x3')),'defaultValue':_0x7f5b('0x4')},'moduleCreate':{'type':Sequelize[_0x7f5b('0x2')](_0x7f5b('0x5'),_0x7f5b('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7f5b('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc942=['contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x56de7c,_0xb03126){var _0x42dcf7=function(_0x5cbba5){while(--_0x5cbba5){_0x56de7c['push'](_0x56de7c['shift']());}};_0x42dcf7(++_0xb03126);}(_0xc942,0x111));var _0x2c94=function(_0x4a5fa6,_0x235c89){_0x4a5fa6=_0x4a5fa6-0x0;var _0x5d3eb3=_0xc942[_0x4a5fa6];return _0x5d3eb3;};'use strict';var Sequelize=require(_0x2c94('0x0'));module[_0x2c94('0x1')]={'name':{'type':Sequelize[_0x2c94('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x2c94('0x3')](_0x2c94('0x4'),_0x2c94('0x5')),'defaultValue':_0x2c94('0x4')},'moduleCreate':{'type':Sequelize[_0x2c94('0x3')](_0x2c94('0x6'),_0x2c94('0x7')),'defaultValue':_0x2c94('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x2c94('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x2c94('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 070eb89..9e128bc 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 _0x45ce=['jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','reject','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','getFields','findOne','Dynamics365Field','rawAttributes','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x144bed,_0x115974){var _0x4f3d52=function(_0x12dd2d){while(--_0x12dd2d){_0x144bed['push'](_0x144bed['shift']());}};_0x4f3d52(++_0x115974);}(_0x45ce,0xd8));var _0xe45c=function(_0x3a3dc2,_0x239f03){_0x3a3dc2=_0x3a3dc2-0x0;var _0x411c98=_0x45ce[_0x3a3dc2];return _0x411c98;};'use strict';var emlformat=require(_0xe45c('0x0'));var rimraf=require(_0xe45c('0x1'));var zipdir=require(_0xe45c('0x2'));var jsonpatch=require(_0xe45c('0x3'));var rp=require(_0xe45c('0x4'));var moment=require(_0xe45c('0x5'));var BPromise=require(_0xe45c('0x6'));var Mustache=require(_0xe45c('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe45c('0x8'));var csv=require(_0xe45c('0x9'));var ejs=require(_0xe45c('0xa'));var fs=require('fs');var fs_extra=require(_0xe45c('0xb'));var _=require(_0xe45c('0xc'));var squel=require(_0xe45c('0xd'));var crypto=require(_0xe45c('0xe'));var jsforce=require(_0xe45c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe45c('0x9'));var querystring=require(_0xe45c('0x10'));var Papa=require(_0xe45c('0x11'));var Redis=require(_0xe45c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe45c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe45c('0x14'))(_0xe45c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe45c('0x16'))['db'];function respondWithStatusCode(_0x5bc473,_0x27cc41){_0x27cc41=_0x27cc41||0xcc;return function(_0xc8dd64){if(_0xc8dd64){return _0x5bc473[_0xe45c('0x17')](_0x27cc41);}return _0x5bc473[_0xe45c('0x18')](_0x27cc41)['end']();};}function respondWithResult(_0x279002,_0xfc6be7){_0xfc6be7=_0xfc6be7||0xc8;return function(_0x50c742){if(_0x50c742){return _0x279002[_0xe45c('0x18')](_0xfc6be7)[_0xe45c('0x19')](_0x50c742);}};}function respondWithFilteredResult(_0xe21a9d,_0x545ac9){return function(_0x50be9d){if(_0x50be9d){var _0x2f9c25=typeof _0x545ac9['offset']==='undefined'&&typeof _0x545ac9[_0xe45c('0x1a')]===_0xe45c('0x1b');var _0x5f2b8c=_0x50be9d['count'];var _0x18c7d9=_0x2f9c25?0x0:_0x545ac9[_0xe45c('0x1c')];var _0x50ca57=_0x2f9c25?_0x50be9d[_0xe45c('0x1d')]:_0x545ac9['offset']+_0x545ac9[_0xe45c('0x1a')];var _0x4d0014;if(_0x50ca57>=_0x5f2b8c){_0x50ca57=_0x5f2b8c;_0x4d0014=0xc8;}else{_0x4d0014=0xce;}_0xe21a9d[_0xe45c('0x18')](_0x4d0014);return _0xe21a9d['set']('Content-Range',_0x18c7d9+'-'+_0x50ca57+'/'+_0x5f2b8c)['json'](_0x50be9d);}return null;};}function patchUpdates(_0x3bf501){return function(_0x39ae5f){try{jsonpatch['apply'](_0x39ae5f,_0x3bf501,!![]);}catch(_0x33c804){return BPromise[_0xe45c('0x1e')](_0x33c804);}return _0x39ae5f['save']();};}function saveUpdates(_0x3972dd,_0x20dc23){return function(_0x5f1c25){if(_0x5f1c25){return _0x5f1c25[_0xe45c('0x1f')](_0x3972dd)[_0xe45c('0x20')](function(_0x4853d8){return _0x4853d8;});}return null;};}function removeEntity(_0x33fea8,_0x16538e){return function(_0xde99fa){if(_0xde99fa){return _0xde99fa[_0xe45c('0x21')]()[_0xe45c('0x20')](function(){_0x33fea8[_0xe45c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fcf02,_0x167bfe){return function(_0x529110){if(!_0x529110){_0x4fcf02[_0xe45c('0x17')](0x194);}return _0x529110;};}function handleError(_0xd3895a,_0x494e6b){_0x494e6b=_0x494e6b||0x1f4;return function(_0x46e2e0){logger[_0xe45c('0x22')](_0x46e2e0[_0xe45c('0x23')]);if(_0x46e2e0[_0xe45c('0x24')]){delete _0x46e2e0[_0xe45c('0x24')];}_0xd3895a[_0xe45c('0x18')](_0x494e6b)[_0xe45c('0x25')](_0x46e2e0);};}exports[_0xe45c('0x26')]=function(_0x308b24,_0x3c27a4){var _0x2733df={},_0x5316c2={},_0x387fc2={'count':0x0,'rows':[]};var _0x3defc8=_[_0xe45c('0x27')](db[_0xe45c('0x28')]['rawAttributes'],function(_0x15e60e){return{'name':_0x15e60e[_0xe45c('0x29')],'type':_0x15e60e[_0xe45c('0x2a')][_0xe45c('0x2b')]};});_0x5316c2[_0xe45c('0x2c')]=_[_0xe45c('0x27')](_0x3defc8,'name');_0x5316c2[_0xe45c('0x2d')]=_[_0xe45c('0x2e')](_0x308b24['query']);_0x5316c2[_0xe45c('0x2f')]=_[_0xe45c('0x30')](_0x5316c2['model'],_0x5316c2['query']);_0x2733df[_0xe45c('0x31')]=_[_0xe45c('0x30')](_0x5316c2[_0xe45c('0x2c')],qs['fields'](_0x308b24[_0xe45c('0x2d')][_0xe45c('0x32')]));_0x2733df[_0xe45c('0x31')]=_0x2733df['attributes'][_0xe45c('0x33')]?_0x2733df[_0xe45c('0x31')]:_0x5316c2['model'];if(!_0x308b24['query'][_0xe45c('0x34')](_0xe45c('0x35'))){_0x2733df[_0xe45c('0x1a')]=qs['limit'](_0x308b24[_0xe45c('0x2d')][_0xe45c('0x1a')]);_0x2733df[_0xe45c('0x1c')]=qs[_0xe45c('0x1c')](_0x308b24[_0xe45c('0x2d')][_0xe45c('0x1c')]);}_0x2733df[_0xe45c('0x36')]=qs['sort'](_0x308b24[_0xe45c('0x2d')][_0xe45c('0x37')]);_0x2733df[_0xe45c('0x38')]=qs['filters'](_[_0xe45c('0x39')](_0x308b24['query'],_0x5316c2['filters']),_0x3defc8);if(_0x308b24['query'][_0xe45c('0x3a')]){_0x2733df[_0xe45c('0x38')]=_[_0xe45c('0x3b')](_0x2733df[_0xe45c('0x38')],{'$or':_['map'](_0x3defc8,function(_0x2018a8){if(_0x2018a8[_0xe45c('0x2a')]!=='VIRTUAL'){var _0x1fd91c={};_0x1fd91c[_0x2018a8[_0xe45c('0x24')]]={'$like':'%'+_0x308b24[_0xe45c('0x2d')][_0xe45c('0x3a')]+'%'};return _0x1fd91c;}})});}_0x2733df=_['merge']({},_0x2733df,_0x308b24[_0xe45c('0x3c')]);var _0x35353d={'where':_0x2733df[_0xe45c('0x38')]};return db[_0xe45c('0x28')][_0xe45c('0x1d')](_0x35353d)['then'](function(_0x4a5e70){_0x387fc2['count']=_0x4a5e70;if(_0x308b24[_0xe45c('0x2d')][_0xe45c('0x3d')]){_0x2733df[_0xe45c('0x3e')]=[{'all':!![]}];}return db[_0xe45c('0x28')][_0xe45c('0x3f')](_0x2733df);})['then'](function(_0x49c9cb){_0x387fc2[_0xe45c('0x40')]=_0x49c9cb;return _0x387fc2;})[_0xe45c('0x20')](respondWithFilteredResult(_0x3c27a4,_0x2733df))['catch'](handleError(_0x3c27a4,null));};exports[_0xe45c('0x41')]=function(_0x2fcb4d,_0x357397){var _0x261a58={'raw':![],'where':{'id':_0x2fcb4d['params']['id']}},_0x220f00={};_0x220f00[_0xe45c('0x2c')]=_['keys'](db[_0xe45c('0x28')]['rawAttributes']);_0x220f00[_0xe45c('0x2d')]=_[_0xe45c('0x2e')](_0x2fcb4d[_0xe45c('0x2d')]);_0x220f00[_0xe45c('0x2f')]=_[_0xe45c('0x30')](_0x220f00[_0xe45c('0x2c')],_0x220f00[_0xe45c('0x2d')]);_0x261a58[_0xe45c('0x31')]=_['intersection'](_0x220f00[_0xe45c('0x2c')],qs['fields'](_0x2fcb4d['query'][_0xe45c('0x32')]));_0x261a58['attributes']=_0x261a58[_0xe45c('0x31')][_0xe45c('0x33')]?_0x261a58[_0xe45c('0x31')]:_0x220f00['model'];if(_0x2fcb4d[_0xe45c('0x2d')]['includeAll']){_0x261a58[_0xe45c('0x3e')]=[{'all':!![]}];}_0x261a58=_['merge']({},_0x261a58,_0x2fcb4d[_0xe45c('0x3c')]);return db['Dynamics365Configuration'][_0xe45c('0x42')](_0x261a58)['then'](handleEntityNotFound(_0x357397,null))[_0xe45c('0x20')](respondWithResult(_0x357397,null))[_0xe45c('0x43')](handleError(_0x357397,null));};exports[_0xe45c('0x44')]=function(_0x3f0a96,_0x1ab60e){return db[_0xe45c('0x28')][_0xe45c('0x44')](_0x3f0a96[_0xe45c('0x45')],{})[_0xe45c('0x20')](respondWithResult(_0x1ab60e,0xc9))[_0xe45c('0x43')](handleError(_0x1ab60e,null));};exports[_0xe45c('0x1f')]=function(_0x353d0d,_0x25bfbd){if(_0x353d0d[_0xe45c('0x45')]['id']){delete _0x353d0d['body']['id'];}return db['Dynamics365Configuration'][_0xe45c('0x42')]({'where':{'id':_0x353d0d['params']['id']}})[_0xe45c('0x20')](handleEntityNotFound(_0x25bfbd,null))['then'](saveUpdates(_0x353d0d[_0xe45c('0x45')],null))[_0xe45c('0x20')](respondWithResult(_0x25bfbd,null))[_0xe45c('0x43')](handleError(_0x25bfbd,null));};exports[_0xe45c('0x21')]=function(_0x35bf06,_0x55a9ce){return db['Dynamics365Configuration'][_0xe45c('0x42')]({'where':{'id':_0x35bf06[_0xe45c('0x46')]['id']}})['then'](handleEntityNotFound(_0x55a9ce,null))[_0xe45c('0x20')](removeEntity(_0x55a9ce,null))[_0xe45c('0x43')](handleError(_0x55a9ce,null));};exports[_0xe45c('0x47')]=function(_0x250be9,_0x2732ac,_0x3a685d){var _0x76feb9={};var _0x203dbd={};var _0x20af36;var _0x4b90cd;return db['Dynamics365Configuration'][_0xe45c('0x48')]({'where':{'id':_0x250be9['params']['id']}})[_0xe45c('0x20')](handleEntityNotFound(_0x2732ac,null))[_0xe45c('0x20')](function(_0x5988c6){if(_0x5988c6){_0x20af36=_0x5988c6;_0x203dbd[_0xe45c('0x2c')]=_[_0xe45c('0x2e')](db[_0xe45c('0x49')][_0xe45c('0x4a')]);_0x203dbd['query']=_['keys'](_0x250be9['query']);_0x203dbd[_0xe45c('0x2f')]=_['intersection'](_0x203dbd[_0xe45c('0x2c')],_0x203dbd[_0xe45c('0x2d')]);_0x76feb9[_0xe45c('0x31')]=_[_0xe45c('0x30')](_0x203dbd[_0xe45c('0x2c')],qs[_0xe45c('0x32')](_0x250be9[_0xe45c('0x2d')][_0xe45c('0x32')]));_0x76feb9[_0xe45c('0x31')]=_0x76feb9[_0xe45c('0x31')][_0xe45c('0x33')]?_0x76feb9[_0xe45c('0x31')]:_0x203dbd[_0xe45c('0x2c')];_0x76feb9['order']=qs[_0xe45c('0x37')](_0x250be9[_0xe45c('0x2d')][_0xe45c('0x37')]);_0x76feb9[_0xe45c('0x38')]=qs['filters'](_[_0xe45c('0x39')](_0x250be9[_0xe45c('0x2d')],_0x203dbd[_0xe45c('0x2f')]));if(_0x250be9[_0xe45c('0x2d')][_0xe45c('0x3a')]){_0x76feb9[_0xe45c('0x38')]=_['merge'](_0x76feb9['where'],{'$or':_[_0xe45c('0x27')](_0x76feb9['attributes'],function(_0x416c2c){var _0x2acc54={};_0x2acc54[_0x416c2c]={'$like':'%'+_0x250be9[_0xe45c('0x2d')]['filter']+'%'};return _0x2acc54;})});}_0x76feb9=_[_0xe45c('0x3b')]({},_0x76feb9,_0x250be9['options']);return _0x20af36[_0xe45c('0x47')](_0x76feb9);}})[_0xe45c('0x20')](function(_0x78451e){if(_0x78451e){_0x4b90cd=_0x78451e[_0xe45c('0x33')];if(!_0x250be9[_0xe45c('0x2d')][_0xe45c('0x34')]('nolimit')){_0x76feb9[_0xe45c('0x1a')]=qs[_0xe45c('0x1a')](_0x250be9[_0xe45c('0x2d')]['limit']);_0x76feb9[_0xe45c('0x1c')]=qs['offset'](_0x250be9[_0xe45c('0x2d')][_0xe45c('0x1c')]);}return _0x20af36['getFields'](_0x76feb9);}})[_0xe45c('0x20')](function(_0x1936c8){if(_0x1936c8){return _0x1936c8?{'count':_0x4b90cd,'rows':_0x1936c8}:null;}})[_0xe45c('0x20')](respondWithResult(_0x2732ac,null))[_0xe45c('0x43')](handleError(_0x2732ac,null));};exports['getSubjects']=function(_0xf1b89c,_0x39bdda,_0x387aca){var _0xc8eaf0={};var _0x240da9={};var _0x5ab487;var _0x12b4eb;return db[_0xe45c('0x28')][_0xe45c('0x48')]({'where':{'id':_0xf1b89c[_0xe45c('0x46')]['id']}})[_0xe45c('0x20')](handleEntityNotFound(_0x39bdda,null))['then'](function(_0x2ab9d5){if(_0x2ab9d5){_0x5ab487=_0x2ab9d5;_0x240da9[_0xe45c('0x2c')]=_[_0xe45c('0x2e')](db[_0xe45c('0x49')]['rawAttributes']);_0x240da9[_0xe45c('0x2d')]=_['keys'](_0xf1b89c['query']);_0x240da9[_0xe45c('0x2f')]=_[_0xe45c('0x30')](_0x240da9[_0xe45c('0x2c')],_0x240da9[_0xe45c('0x2d')]);_0xc8eaf0[_0xe45c('0x31')]=_[_0xe45c('0x30')](_0x240da9[_0xe45c('0x2c')],qs[_0xe45c('0x32')](_0xf1b89c[_0xe45c('0x2d')][_0xe45c('0x32')]));_0xc8eaf0['attributes']=_0xc8eaf0[_0xe45c('0x31')][_0xe45c('0x33')]?_0xc8eaf0[_0xe45c('0x31')]:_0x240da9[_0xe45c('0x2c')];_0xc8eaf0[_0xe45c('0x36')]=qs[_0xe45c('0x37')](_0xf1b89c[_0xe45c('0x2d')][_0xe45c('0x37')]);_0xc8eaf0[_0xe45c('0x38')]=qs[_0xe45c('0x2f')](_[_0xe45c('0x39')](_0xf1b89c['query'],_0x240da9[_0xe45c('0x2f')]));if(_0xf1b89c[_0xe45c('0x2d')]['filter']){_0xc8eaf0['where']=_[_0xe45c('0x3b')](_0xc8eaf0[_0xe45c('0x38')],{'$or':_[_0xe45c('0x27')](_0xc8eaf0[_0xe45c('0x31')],function(_0x55bb7b){var _0x37f425={};_0x37f425[_0x55bb7b]={'$like':'%'+_0xf1b89c[_0xe45c('0x2d')][_0xe45c('0x3a')]+'%'};return _0x37f425;})});}_0xc8eaf0=_['merge']({},_0xc8eaf0,_0xf1b89c[_0xe45c('0x3c')]);return _0x5ab487['getSubjects'](_0xc8eaf0);}})[_0xe45c('0x20')](function(_0x3dcb40){if(_0x3dcb40){_0x12b4eb=_0x3dcb40['length'];if(!_0xf1b89c[_0xe45c('0x2d')][_0xe45c('0x34')](_0xe45c('0x35'))){_0xc8eaf0[_0xe45c('0x1a')]=qs[_0xe45c('0x1a')](_0xf1b89c['query']['limit']);_0xc8eaf0['offset']=qs[_0xe45c('0x1c')](_0xf1b89c[_0xe45c('0x2d')][_0xe45c('0x1c')]);}return _0x5ab487[_0xe45c('0x4b')](_0xc8eaf0);}})[_0xe45c('0x20')](function(_0xc99a98){if(_0xc99a98){return _0xc99a98?{'count':_0x12b4eb,'rows':_0xc99a98}:null;}})[_0xe45c('0x20')](respondWithResult(_0x39bdda,null))[_0xe45c('0x43')](handleError(_0x39bdda,null));};exports[_0xe45c('0x4c')]=function(_0x4dd805,_0x4e5060,_0x5cb258){var _0x4144b5={};var _0x1fa82c={};var _0x2fd208;var _0x1a6ba7;return db[_0xe45c('0x28')][_0xe45c('0x48')]({'where':{'id':_0x4dd805['params']['id']}})[_0xe45c('0x20')](handleEntityNotFound(_0x4e5060,null))['then'](function(_0x566c0f){if(_0x566c0f){_0x2fd208=_0x566c0f;_0x1fa82c[_0xe45c('0x2c')]=_[_0xe45c('0x2e')](db[_0xe45c('0x49')][_0xe45c('0x4a')]);_0x1fa82c['query']=_[_0xe45c('0x2e')](_0x4dd805['query']);_0x1fa82c[_0xe45c('0x2f')]=_[_0xe45c('0x30')](_0x1fa82c[_0xe45c('0x2c')],_0x1fa82c[_0xe45c('0x2d')]);_0x4144b5['attributes']=_['intersection'](_0x1fa82c[_0xe45c('0x2c')],qs[_0xe45c('0x32')](_0x4dd805['query'][_0xe45c('0x32')]));_0x4144b5[_0xe45c('0x31')]=_0x4144b5[_0xe45c('0x31')]['length']?_0x4144b5['attributes']:_0x1fa82c[_0xe45c('0x2c')];_0x4144b5[_0xe45c('0x36')]=qs['sort'](_0x4dd805[_0xe45c('0x2d')][_0xe45c('0x37')]);_0x4144b5[_0xe45c('0x38')]=qs[_0xe45c('0x2f')](_['pick'](_0x4dd805[_0xe45c('0x2d')],_0x1fa82c[_0xe45c('0x2f')]));if(_0x4dd805[_0xe45c('0x2d')][_0xe45c('0x3a')]){_0x4144b5[_0xe45c('0x38')]=_['merge'](_0x4144b5[_0xe45c('0x38')],{'$or':_[_0xe45c('0x27')](_0x4144b5[_0xe45c('0x31')],function(_0x57ea88){var _0x45dca4={};_0x45dca4[_0x57ea88]={'$like':'%'+_0x4dd805[_0xe45c('0x2d')][_0xe45c('0x3a')]+'%'};return _0x45dca4;})});}_0x4144b5=_['merge']({},_0x4144b5,_0x4dd805['options']);return _0x2fd208[_0xe45c('0x4c')](_0x4144b5);}})[_0xe45c('0x20')](function(_0x1bfe77){if(_0x1bfe77){_0x1a6ba7=_0x1bfe77[_0xe45c('0x33')];if(!_0x4dd805['query'][_0xe45c('0x34')](_0xe45c('0x35'))){_0x4144b5[_0xe45c('0x1a')]=qs[_0xe45c('0x1a')](_0x4dd805[_0xe45c('0x2d')][_0xe45c('0x1a')]);_0x4144b5[_0xe45c('0x1c')]=qs[_0xe45c('0x1c')](_0x4dd805[_0xe45c('0x2d')][_0xe45c('0x1c')]);}return _0x2fd208[_0xe45c('0x4c')](_0x4144b5);}})[_0xe45c('0x20')](function(_0x1ecf07){if(_0x1ecf07){return _0x1ecf07?{'count':_0x1a6ba7,'rows':_0x1ecf07}:null;}})[_0xe45c('0x20')](respondWithResult(_0x4e5060,null))[_0xe45c('0x43')](handleError(_0x4e5060,null));}; \ No newline at end of file +var _0x3387=['includeAll','findAll','catch','show','params','options','find','create','body','destroy','getFields','findOne','Dynamics365Field','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','end','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','Dynamics365Configuration'];(function(_0x5e6c4d,_0x53b8a6){var _0x23855c=function(_0x3e2ce2){while(--_0x3e2ce2){_0x5e6c4d['push'](_0x5e6c4d['shift']());}};_0x23855c(++_0x53b8a6);}(_0x3387,0xf5));var _0x7338=function(_0x2d32ae,_0x77b33c){_0x2d32ae=_0x2d32ae-0x0;var _0x2520f1=_0x3387[_0x2d32ae];return _0x2520f1;};'use strict';var emlformat=require(_0x7338('0x0'));var rimraf=require(_0x7338('0x1'));var zipdir=require(_0x7338('0x2'));var jsonpatch=require(_0x7338('0x3'));var rp=require(_0x7338('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7338('0x5'));var path=require('path');var sox=require(_0x7338('0x6'));var csv=require('to-csv');var ejs=require(_0x7338('0x7'));var fs=require('fs');var fs_extra=require(_0x7338('0x8'));var _=require(_0x7338('0x9'));var squel=require(_0x7338('0xa'));var crypto=require(_0x7338('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7338('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7338('0xd'));var Papa=require('papaparse');var Redis=require(_0x7338('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7338('0xf'));var as=require(_0x7338('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7338('0x11'))(_0x7338('0x12'));var utils=require(_0x7338('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7338('0x14'));var db=require(_0x7338('0x15'))['db'];function respondWithStatusCode(_0x5ed849,_0xf3b86d){_0xf3b86d=_0xf3b86d||0xcc;return function(_0xf114fe){if(_0xf114fe){return _0x5ed849[_0x7338('0x16')](_0xf3b86d);}return _0x5ed849[_0x7338('0x17')](_0xf3b86d)['end']();};}function respondWithResult(_0x2e3a58,_0x2aca15){_0x2aca15=_0x2aca15||0xc8;return function(_0x4bfeff){if(_0x4bfeff){return _0x2e3a58[_0x7338('0x17')](_0x2aca15)[_0x7338('0x18')](_0x4bfeff);}};}function respondWithFilteredResult(_0x36f58b,_0x4c0cfd){return function(_0x1c9e94){if(_0x1c9e94){var _0x540f73=typeof _0x4c0cfd[_0x7338('0x19')]===_0x7338('0x1a')&&typeof _0x4c0cfd['limit']===_0x7338('0x1a');var _0x47f7e5=_0x1c9e94[_0x7338('0x1b')];var _0x4c7b9a=_0x540f73?0x0:_0x4c0cfd[_0x7338('0x19')];var _0x16ed73=_0x540f73?_0x1c9e94[_0x7338('0x1b')]:_0x4c0cfd[_0x7338('0x19')]+_0x4c0cfd[_0x7338('0x1c')];var _0x5f42d3;if(_0x16ed73>=_0x47f7e5){_0x16ed73=_0x47f7e5;_0x5f42d3=0xc8;}else{_0x5f42d3=0xce;}_0x36f58b[_0x7338('0x17')](_0x5f42d3);return _0x36f58b[_0x7338('0x1d')](_0x7338('0x1e'),_0x4c7b9a+'-'+_0x16ed73+'/'+_0x47f7e5)[_0x7338('0x18')](_0x1c9e94);}return null;};}function patchUpdates(_0x2f49c5){return function(_0x187e49){try{jsonpatch['apply'](_0x187e49,_0x2f49c5,!![]);}catch(_0x439472){return BPromise['reject'](_0x439472);}return _0x187e49[_0x7338('0x1f')]();};}function saveUpdates(_0x30c647,_0x48fc36){return function(_0x7af13b){if(_0x7af13b){return _0x7af13b[_0x7338('0x20')](_0x30c647)[_0x7338('0x21')](function(_0x4ee9e0){return _0x4ee9e0;});}return null;};}function removeEntity(_0x24e145,_0x20e013){return function(_0x2e0da4){if(_0x2e0da4){return _0x2e0da4['destroy']()[_0x7338('0x21')](function(){_0x24e145['status'](0xcc)[_0x7338('0x22')]();});}};}function handleEntityNotFound(_0x24e4f0,_0x5c230d){return function(_0x1b4168){if(!_0x1b4168){_0x24e4f0[_0x7338('0x16')](0x194);}return _0x1b4168;};}function handleError(_0x1cf9c1,_0x5075a6){_0x5075a6=_0x5075a6||0x1f4;return function(_0x4f8e8c){logger[_0x7338('0x23')](_0x4f8e8c[_0x7338('0x24')]);if(_0x4f8e8c[_0x7338('0x25')]){delete _0x4f8e8c[_0x7338('0x25')];}_0x1cf9c1[_0x7338('0x17')](_0x5075a6)[_0x7338('0x26')](_0x4f8e8c);};}exports['index']=function(_0x2e9597,_0x54cba3){var _0xb73f80={},_0x26bb89={},_0x3d7a67={'count':0x0,'rows':[]};var _0x59fe72=_['map'](db['Dynamics365Configuration'][_0x7338('0x27')],function(_0x5625fa){return{'name':_0x5625fa[_0x7338('0x28')],'type':_0x5625fa[_0x7338('0x29')]['key']};});_0x26bb89[_0x7338('0x2a')]=_[_0x7338('0x2b')](_0x59fe72,'name');_0x26bb89[_0x7338('0x2c')]=_[_0x7338('0x2d')](_0x2e9597[_0x7338('0x2c')]);_0x26bb89[_0x7338('0x2e')]=_[_0x7338('0x2f')](_0x26bb89[_0x7338('0x2a')],_0x26bb89[_0x7338('0x2c')]);_0xb73f80['attributes']=_[_0x7338('0x2f')](_0x26bb89['model'],qs[_0x7338('0x30')](_0x2e9597[_0x7338('0x2c')][_0x7338('0x30')]));_0xb73f80[_0x7338('0x31')]=_0xb73f80[_0x7338('0x31')][_0x7338('0x32')]?_0xb73f80['attributes']:_0x26bb89[_0x7338('0x2a')];if(!_0x2e9597[_0x7338('0x2c')]['hasOwnProperty'](_0x7338('0x33'))){_0xb73f80[_0x7338('0x1c')]=qs['limit'](_0x2e9597[_0x7338('0x2c')][_0x7338('0x1c')]);_0xb73f80[_0x7338('0x19')]=qs[_0x7338('0x19')](_0x2e9597[_0x7338('0x2c')][_0x7338('0x19')]);}_0xb73f80[_0x7338('0x34')]=qs[_0x7338('0x35')](_0x2e9597[_0x7338('0x2c')]['sort']);_0xb73f80[_0x7338('0x36')]=qs['filters'](_['pick'](_0x2e9597[_0x7338('0x2c')],_0x26bb89[_0x7338('0x2e')]),_0x59fe72);if(_0x2e9597[_0x7338('0x2c')]['filter']){_0xb73f80[_0x7338('0x36')]=_[_0x7338('0x37')](_0xb73f80[_0x7338('0x36')],{'$or':_['map'](_0x59fe72,function(_0x191492){if(_0x191492['type']!==_0x7338('0x38')){var _0x23700c={};_0x23700c[_0x191492[_0x7338('0x25')]]={'$like':'%'+_0x2e9597[_0x7338('0x2c')][_0x7338('0x39')]+'%'};return _0x23700c;}})});}_0xb73f80=_[_0x7338('0x37')]({},_0xb73f80,_0x2e9597['options']);var _0x325649={'where':_0xb73f80[_0x7338('0x36')]};return db[_0x7338('0x3a')]['count'](_0x325649)[_0x7338('0x21')](function(_0x155aa3){_0x3d7a67[_0x7338('0x1b')]=_0x155aa3;if(_0x2e9597[_0x7338('0x2c')][_0x7338('0x3b')]){_0xb73f80['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x7338('0x3c')](_0xb73f80);})[_0x7338('0x21')](function(_0x2ce2d5){_0x3d7a67['rows']=_0x2ce2d5;return _0x3d7a67;})[_0x7338('0x21')](respondWithFilteredResult(_0x54cba3,_0xb73f80))[_0x7338('0x3d')](handleError(_0x54cba3,null));};exports[_0x7338('0x3e')]=function(_0x1e5c85,_0x23a504){var _0x14e7cf={'raw':![],'where':{'id':_0x1e5c85[_0x7338('0x3f')]['id']}},_0x995e70={};_0x995e70['model']=_['keys'](db[_0x7338('0x3a')][_0x7338('0x27')]);_0x995e70['query']=_[_0x7338('0x2d')](_0x1e5c85[_0x7338('0x2c')]);_0x995e70[_0x7338('0x2e')]=_['intersection'](_0x995e70[_0x7338('0x2a')],_0x995e70['query']);_0x14e7cf[_0x7338('0x31')]=_[_0x7338('0x2f')](_0x995e70[_0x7338('0x2a')],qs['fields'](_0x1e5c85[_0x7338('0x2c')][_0x7338('0x30')]));_0x14e7cf[_0x7338('0x31')]=_0x14e7cf[_0x7338('0x31')][_0x7338('0x32')]?_0x14e7cf['attributes']:_0x995e70[_0x7338('0x2a')];if(_0x1e5c85[_0x7338('0x2c')][_0x7338('0x3b')]){_0x14e7cf['include']=[{'all':!![]}];}_0x14e7cf=_[_0x7338('0x37')]({},_0x14e7cf,_0x1e5c85[_0x7338('0x40')]);return db['Dynamics365Configuration'][_0x7338('0x41')](_0x14e7cf)[_0x7338('0x21')](handleEntityNotFound(_0x23a504,null))[_0x7338('0x21')](respondWithResult(_0x23a504,null))[_0x7338('0x3d')](handleError(_0x23a504,null));};exports[_0x7338('0x42')]=function(_0x4c6f16,_0x29eceb){return db[_0x7338('0x3a')]['create'](_0x4c6f16[_0x7338('0x43')],{})[_0x7338('0x21')](respondWithResult(_0x29eceb,0xc9))[_0x7338('0x3d')](handleError(_0x29eceb,null));};exports['update']=function(_0x569e77,_0x4bee15){if(_0x569e77[_0x7338('0x43')]['id']){delete _0x569e77['body']['id'];}return db[_0x7338('0x3a')][_0x7338('0x41')]({'where':{'id':_0x569e77[_0x7338('0x3f')]['id']}})[_0x7338('0x21')](handleEntityNotFound(_0x4bee15,null))[_0x7338('0x21')](saveUpdates(_0x569e77['body'],null))[_0x7338('0x21')](respondWithResult(_0x4bee15,null))['catch'](handleError(_0x4bee15,null));};exports[_0x7338('0x44')]=function(_0x483905,_0x4c412d){return db[_0x7338('0x3a')][_0x7338('0x41')]({'where':{'id':_0x483905[_0x7338('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4c412d,null))[_0x7338('0x21')](removeEntity(_0x4c412d,null))[_0x7338('0x3d')](handleError(_0x4c412d,null));};exports[_0x7338('0x45')]=function(_0x55f644,_0xb5ff87,_0x708001){var _0x219f90={};var _0x40d8b5={};var _0x239491;var _0x3bbf44;return db[_0x7338('0x3a')][_0x7338('0x46')]({'where':{'id':_0x55f644[_0x7338('0x3f')]['id']}})[_0x7338('0x21')](handleEntityNotFound(_0xb5ff87,null))[_0x7338('0x21')](function(_0x44496f){if(_0x44496f){_0x239491=_0x44496f;_0x40d8b5[_0x7338('0x2a')]=_[_0x7338('0x2d')](db[_0x7338('0x47')]['rawAttributes']);_0x40d8b5[_0x7338('0x2c')]=_[_0x7338('0x2d')](_0x55f644[_0x7338('0x2c')]);_0x40d8b5[_0x7338('0x2e')]=_['intersection'](_0x40d8b5[_0x7338('0x2a')],_0x40d8b5[_0x7338('0x2c')]);_0x219f90['attributes']=_[_0x7338('0x2f')](_0x40d8b5[_0x7338('0x2a')],qs[_0x7338('0x30')](_0x55f644[_0x7338('0x2c')]['fields']));_0x219f90['attributes']=_0x219f90[_0x7338('0x31')]['length']?_0x219f90['attributes']:_0x40d8b5[_0x7338('0x2a')];_0x219f90[_0x7338('0x34')]=qs['sort'](_0x55f644['query'][_0x7338('0x35')]);_0x219f90[_0x7338('0x36')]=qs[_0x7338('0x2e')](_[_0x7338('0x48')](_0x55f644[_0x7338('0x2c')],_0x40d8b5[_0x7338('0x2e')]));if(_0x55f644[_0x7338('0x2c')][_0x7338('0x39')]){_0x219f90['where']=_['merge'](_0x219f90[_0x7338('0x36')],{'$or':_[_0x7338('0x2b')](_0x219f90[_0x7338('0x31')],function(_0x3cc3ac){var _0x2bc9b6={};_0x2bc9b6[_0x3cc3ac]={'$like':'%'+_0x55f644[_0x7338('0x2c')][_0x7338('0x39')]+'%'};return _0x2bc9b6;})});}_0x219f90=_[_0x7338('0x37')]({},_0x219f90,_0x55f644['options']);return _0x239491[_0x7338('0x45')](_0x219f90);}})[_0x7338('0x21')](function(_0x19d81d){if(_0x19d81d){_0x3bbf44=_0x19d81d[_0x7338('0x32')];if(!_0x55f644[_0x7338('0x2c')][_0x7338('0x49')](_0x7338('0x33'))){_0x219f90[_0x7338('0x1c')]=qs[_0x7338('0x1c')](_0x55f644[_0x7338('0x2c')]['limit']);_0x219f90['offset']=qs['offset'](_0x55f644[_0x7338('0x2c')][_0x7338('0x19')]);}return _0x239491[_0x7338('0x45')](_0x219f90);}})[_0x7338('0x21')](function(_0x280bfd){if(_0x280bfd){return _0x280bfd?{'count':_0x3bbf44,'rows':_0x280bfd}:null;}})['then'](respondWithResult(_0xb5ff87,null))[_0x7338('0x3d')](handleError(_0xb5ff87,null));};exports[_0x7338('0x4a')]=function(_0x1bbd36,_0x1af6f3,_0xbfcc76){var _0x3e3bfd={};var _0x41eb35={};var _0x542ce8;var _0x37ead3;return db[_0x7338('0x3a')]['findOne']({'where':{'id':_0x1bbd36[_0x7338('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1af6f3,null))[_0x7338('0x21')](function(_0x5f47af){if(_0x5f47af){_0x542ce8=_0x5f47af;_0x41eb35[_0x7338('0x2a')]=_['keys'](db[_0x7338('0x47')][_0x7338('0x27')]);_0x41eb35[_0x7338('0x2c')]=_['keys'](_0x1bbd36['query']);_0x41eb35[_0x7338('0x2e')]=_[_0x7338('0x2f')](_0x41eb35['model'],_0x41eb35[_0x7338('0x2c')]);_0x3e3bfd[_0x7338('0x31')]=_[_0x7338('0x2f')](_0x41eb35['model'],qs['fields'](_0x1bbd36['query'][_0x7338('0x30')]));_0x3e3bfd['attributes']=_0x3e3bfd[_0x7338('0x31')][_0x7338('0x32')]?_0x3e3bfd['attributes']:_0x41eb35['model'];_0x3e3bfd[_0x7338('0x34')]=qs[_0x7338('0x35')](_0x1bbd36[_0x7338('0x2c')][_0x7338('0x35')]);_0x3e3bfd[_0x7338('0x36')]=qs[_0x7338('0x2e')](_[_0x7338('0x48')](_0x1bbd36[_0x7338('0x2c')],_0x41eb35['filters']));if(_0x1bbd36[_0x7338('0x2c')][_0x7338('0x39')]){_0x3e3bfd[_0x7338('0x36')]=_[_0x7338('0x37')](_0x3e3bfd[_0x7338('0x36')],{'$or':_[_0x7338('0x2b')](_0x3e3bfd[_0x7338('0x31')],function(_0x224493){var _0x2a1666={};_0x2a1666[_0x224493]={'$like':'%'+_0x1bbd36['query'][_0x7338('0x39')]+'%'};return _0x2a1666;})});}_0x3e3bfd=_['merge']({},_0x3e3bfd,_0x1bbd36[_0x7338('0x40')]);return _0x542ce8[_0x7338('0x4a')](_0x3e3bfd);}})[_0x7338('0x21')](function(_0x409cd2){if(_0x409cd2){_0x37ead3=_0x409cd2[_0x7338('0x32')];if(!_0x1bbd36[_0x7338('0x2c')][_0x7338('0x49')](_0x7338('0x33'))){_0x3e3bfd[_0x7338('0x1c')]=qs[_0x7338('0x1c')](_0x1bbd36[_0x7338('0x2c')][_0x7338('0x1c')]);_0x3e3bfd[_0x7338('0x19')]=qs[_0x7338('0x19')](_0x1bbd36[_0x7338('0x2c')][_0x7338('0x19')]);}return _0x542ce8['getSubjects'](_0x3e3bfd);}})[_0x7338('0x21')](function(_0x2ce4cb){if(_0x2ce4cb){return _0x2ce4cb?{'count':_0x37ead3,'rows':_0x2ce4cb}:null;}})[_0x7338('0x21')](respondWithResult(_0x1af6f3,null))[_0x7338('0x3d')](handleError(_0x1af6f3,null));};exports[_0x7338('0x4b')]=function(_0xe0d567,_0x2f8ccf,_0x1d75b6){var _0x11673b={};var _0x46813c={};var _0x20a21c;var _0x2452a4;return db[_0x7338('0x3a')][_0x7338('0x46')]({'where':{'id':_0xe0d567[_0x7338('0x3f')]['id']}})[_0x7338('0x21')](handleEntityNotFound(_0x2f8ccf,null))['then'](function(_0x42b7cd){if(_0x42b7cd){_0x20a21c=_0x42b7cd;_0x46813c[_0x7338('0x2a')]=_['keys'](db[_0x7338('0x47')][_0x7338('0x27')]);_0x46813c[_0x7338('0x2c')]=_['keys'](_0xe0d567[_0x7338('0x2c')]);_0x46813c['filters']=_[_0x7338('0x2f')](_0x46813c[_0x7338('0x2a')],_0x46813c[_0x7338('0x2c')]);_0x11673b['attributes']=_['intersection'](_0x46813c[_0x7338('0x2a')],qs['fields'](_0xe0d567[_0x7338('0x2c')][_0x7338('0x30')]));_0x11673b[_0x7338('0x31')]=_0x11673b[_0x7338('0x31')][_0x7338('0x32')]?_0x11673b[_0x7338('0x31')]:_0x46813c['model'];_0x11673b[_0x7338('0x34')]=qs[_0x7338('0x35')](_0xe0d567[_0x7338('0x2c')][_0x7338('0x35')]);_0x11673b[_0x7338('0x36')]=qs[_0x7338('0x2e')](_['pick'](_0xe0d567[_0x7338('0x2c')],_0x46813c[_0x7338('0x2e')]));if(_0xe0d567[_0x7338('0x2c')][_0x7338('0x39')]){_0x11673b[_0x7338('0x36')]=_[_0x7338('0x37')](_0x11673b[_0x7338('0x36')],{'$or':_['map'](_0x11673b[_0x7338('0x31')],function(_0x5dbddb){var _0x19a2ca={};_0x19a2ca[_0x5dbddb]={'$like':'%'+_0xe0d567[_0x7338('0x2c')]['filter']+'%'};return _0x19a2ca;})});}_0x11673b=_[_0x7338('0x37')]({},_0x11673b,_0xe0d567[_0x7338('0x40')]);return _0x20a21c[_0x7338('0x4b')](_0x11673b);}})['then'](function(_0x564473){if(_0x564473){_0x2452a4=_0x564473[_0x7338('0x32')];if(!_0xe0d567['query'][_0x7338('0x49')](_0x7338('0x33'))){_0x11673b['limit']=qs[_0x7338('0x1c')](_0xe0d567[_0x7338('0x2c')]['limit']);_0x11673b[_0x7338('0x19')]=qs['offset'](_0xe0d567[_0x7338('0x2c')]['offset']);}return _0x20a21c['getDescriptions'](_0x11673b);}})[_0x7338('0x21')](function(_0x3e231b){if(_0x3e231b){return _0x3e231b?{'count':_0x2452a4,'rows':_0x3e231b}:null;}})['then'](respondWithResult(_0x2f8ccf,null))[_0x7338('0x3d')](handleError(_0x2f8ccf,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 8467c16..68f816b 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 _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x16cd0f,_0x1c7184){var _0x595bac=function(_0x2ce8b4){while(--_0x2ce8b4){_0x16cd0f['push'](_0x16cd0f['shift']());}};_0x595bac(++_0x1c7184);}(_0x70e0,0x17b));var _0x070e=function(_0x3cb9b1,_0x465b79){_0x3cb9b1=_0x3cb9b1-0x0;var _0x3235b8=_0x70e0[_0x3cb9b1];return _0x3235b8;};'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']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x4aba20,_0x3ebc8a){var _0xb6da33=function(_0x5e94f0){while(--_0x5e94f0){_0x4aba20['push'](_0x4aba20['shift']());}};_0xb6da33(++_0x3ebc8a);}(_0x34e8,0x12c));var _0x834e=function(_0x39d06b,_0x5983b1){_0x39d06b=_0x39d06b-0x0;var _0x55140d=_0x34e8[_0x39d06b];return _0x55140d;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index d93ed18..6e70137 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 _0xa601=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0xa601,0x1f3));var _0x1a60=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xa601[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x1a60('0x0'));var util=require('util');var moment=require(_0x1a60('0x1'));var BPromise=require(_0x1a60('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a60('0x3'));var db=require(_0x1a60('0x4'))['db'];var utils=require(_0x1a60('0x5'));var logger=require('../../config/logger')(_0x1a60('0x6'));var config=require(_0x1a60('0x7'));var jayson=require(_0x1a60('0x8'));var client=jayson[_0x1a60('0x9')][_0x1a60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29df54,_0x4c47fb,_0x39098c){return new BPromise(function(_0x580449,_0x4da645){return client[_0x1a60('0xb')](_0x29df54,_0x39098c)['then'](function(_0x3573d0){logger[_0x1a60('0xc')](_0x1a60('0xd'),_0x4c47fb,_0x1a60('0xe'));logger[_0x1a60('0xf')](_0x1a60('0x10'),_0x4c47fb,'request\x20sent',JSON['stringify'](_0x3573d0));if(_0x3573d0[_0x1a60('0x11')]){if(_0x3573d0[_0x1a60('0x11')]['code']===0x1f4){logger[_0x1a60('0x11')](_0x1a60('0xd'),_0x4c47fb,_0x3573d0[_0x1a60('0x11')]['message']);return _0x4da645(_0x3573d0[_0x1a60('0x11')]['message']);}logger['error'](_0x1a60('0xd'),_0x4c47fb,_0x3573d0[_0x1a60('0x11')][_0x1a60('0x12')]);return _0x580449(_0x3573d0[_0x1a60('0x11')][_0x1a60('0x12')]);}else{logger['info'](_0x1a60('0xd'),_0x4c47fb,_0x1a60('0xe'));_0x580449(_0x3573d0[_0x1a60('0x13')]['message']);}})['catch'](function(_0x218e3c){logger[_0x1a60('0x11')](_0x1a60('0xd'),_0x4c47fb,_0x218e3c);_0x4da645(_0x218e3c);});});} \ No newline at end of file +var _0x23be=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x23be,0xd6));var _0xe23b=function(_0x1f8e0c,_0x4579b8){_0x1f8e0c=_0x1f8e0c-0x0;var _0x5e3d67=_0x23be[_0x1f8e0c];return _0x5e3d67;};'use strict';var _=require(_0xe23b('0x0'));var util=require(_0xe23b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe23b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe23b('0x3'))['db'];var utils=require(_0xe23b('0x4'));var logger=require('../../config/logger')(_0xe23b('0x5'));var config=require(_0xe23b('0x6'));var jayson=require(_0xe23b('0x7'));var client=jayson[_0xe23b('0x8')][_0xe23b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x509ec2,_0x2dbb8a,_0x5d1f63){return new BPromise(function(_0xa72556,_0x32dc0e){return client[_0xe23b('0xa')](_0x509ec2,_0x5d1f63)[_0xe23b('0xb')](function(_0x2a9fde){logger[_0xe23b('0xc')](_0xe23b('0xd'),_0x2dbb8a,_0xe23b('0xe'));logger[_0xe23b('0xf')](_0xe23b('0x10'),_0x2dbb8a,_0xe23b('0xe'),JSON[_0xe23b('0x11')](_0x2a9fde));if(_0x2a9fde[_0xe23b('0x12')]){if(_0x2a9fde[_0xe23b('0x12')][_0xe23b('0x13')]===0x1f4){logger[_0xe23b('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2dbb8a,_0x2a9fde[_0xe23b('0x12')][_0xe23b('0x14')]);return _0x32dc0e(_0x2a9fde[_0xe23b('0x12')][_0xe23b('0x14')]);}logger[_0xe23b('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2dbb8a,_0x2a9fde[_0xe23b('0x12')][_0xe23b('0x14')]);return _0xa72556(_0x2a9fde[_0xe23b('0x12')][_0xe23b('0x14')]);}else{logger[_0xe23b('0xc')](_0xe23b('0xd'),_0x2dbb8a,_0xe23b('0xe'));_0xa72556(_0x2a9fde[_0xe23b('0x15')][_0xe23b('0x14')]);}})[_0xe23b('0x16')](function(_0x40ec5c){logger['error'](_0xe23b('0xd'),_0x2dbb8a,_0x40ec5c);_0x32dc0e(_0x40ec5c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index acfe827..77f62dd 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 _0xf856=['put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1360df,_0x14bfef){var _0x399a66=function(_0x6b0416){while(--_0x6b0416){_0x1360df['push'](_0x1360df['shift']());}};_0x399a66(++_0x14bfef);}(_0xf856,0x101));var _0x6f85=function(_0x455461,_0x5f3af0){_0x455461=_0x455461-0x0;var _0x3babe4=_0xf856[_0x455461];return _0x3babe4;};'use strict';var multer=require('multer');var util=require(_0x6f85('0x0'));var path=require(_0x6f85('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f85('0x2'));var router=express['Router']();var fs_extra=require(_0x6f85('0x3'));var auth=require(_0x6f85('0x4'));var interaction=require(_0x6f85('0x5'));var config=require('../../config/environment');var controller=require(_0x6f85('0x6'));router[_0x6f85('0x7')]('/',auth[_0x6f85('0x8')](),controller[_0x6f85('0x9')]);router[_0x6f85('0x7')](_0x6f85('0xa'),auth['isAuthenticated'](),controller[_0x6f85('0xb')]);router[_0x6f85('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6f85('0xd')](_0x6f85('0xa'),auth['isAuthenticated'](),controller[_0x6f85('0xe')]);router[_0x6f85('0xf')]('/:id',auth[_0x6f85('0x8')](),controller[_0x6f85('0x10')]);module[_0x6f85('0x11')]=router; \ No newline at end of file +var _0x2961=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports'];(function(_0x16bf39,_0x563569){var _0x350181=function(_0x37b9e9){while(--_0x37b9e9){_0x16bf39['push'](_0x16bf39['shift']());}};_0x350181(++_0x563569);}(_0x2961,0x156));var _0x1296=function(_0x5d0108,_0x44adee){_0x5d0108=_0x5d0108-0x0;var _0x53e2e8=_0x2961[_0x5d0108];return _0x53e2e8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1296('0x0'));var timeout=require(_0x1296('0x1'));var express=require(_0x1296('0x2'));var router=express['Router']();var fs_extra=require(_0x1296('0x3'));var auth=require(_0x1296('0x4'));var interaction=require(_0x1296('0x5'));var config=require('../../config/environment');var controller=require(_0x1296('0x6'));router[_0x1296('0x7')]('/',auth[_0x1296('0x8')](),controller[_0x1296('0x9')]);router[_0x1296('0x7')](_0x1296('0xa'),auth[_0x1296('0x8')](),controller[_0x1296('0xb')]);router[_0x1296('0xc')]('/',auth[_0x1296('0x8')](),controller[_0x1296('0xd')]);router[_0x1296('0xe')](_0x1296('0xa'),auth[_0x1296('0x8')](),controller[_0x1296('0xf')]);router[_0x1296('0x10')](_0x1296('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1296('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 7b05b6f..737a06e 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 _0x83f6=['variable','keyValue','picklist','ENUM','customVariable','STRING','BOOLEAN','sequelize','exports','string'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x83f6,0x133));var _0x683f=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0x83f6[_0x5e6bec];return _0x5dc5cf;};'use strict';var Sequelize=require(_0x683f('0x0'));module[_0x683f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x683f('0x2'),_0x683f('0x3'),'customVariable',_0x683f('0x4'),_0x683f('0x5')),'defaultValue':_0x683f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x683f('0x6')]('string',_0x683f('0x3'),_0x683f('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x683f('0x8')]},'nameField':{'type':Sequelize[_0x683f('0x8')]},'customField':{'type':Sequelize[_0x683f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x71fd=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x143edc,_0x24df40){var _0x4ab31d=function(_0x1b8df1){while(--_0x1b8df1){_0x143edc['push'](_0x143edc['shift']());}};_0x4ab31d(++_0x24df40);}(_0x71fd,0x1a6));var _0xd71f=function(_0x3fb63b,_0x376d67){_0x3fb63b=_0x3fb63b-0x0;var _0x22c858=_0x71fd[_0x3fb63b];return _0x22c858;};'use strict';var Sequelize=require(_0xd71f('0x0'));module[_0xd71f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd71f('0x2'),_0xd71f('0x3'),_0xd71f('0x4'),_0xd71f('0x5'),_0xd71f('0x6')),'defaultValue':_0xd71f('0x2')},'content':{'type':Sequelize[_0xd71f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xd71f('0x2'),_0xd71f('0x3'),_0xd71f('0x4'))},'keyContent':{'type':Sequelize[_0xd71f('0x7')]},'idField':{'type':Sequelize[_0xd71f('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'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 0a15315..c907ebb 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 _0xcc23=['limit','set','Content-Range','save','update','then','end','error','stack','name','send','index','Dynamics365Field','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','rawAttributes','length','include','options','create','body','find','destroy','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset'];(function(_0x9ee6af,_0x1c07a4){var _0x36d072=function(_0x497ce9){while(--_0x497ce9){_0x9ee6af['push'](_0x9ee6af['shift']());}};_0x36d072(++_0x1c07a4);}(_0xcc23,0x1a0));var _0x3cc2=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xcc23[_0x96f74c];return _0x379222;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3cc2('0x0'));var zipdir=require(_0x3cc2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3cc2('0x2'));var BPromise=require(_0x3cc2('0x3'));var Mustache=require(_0x3cc2('0x4'));var util=require(_0x3cc2('0x5'));var path=require(_0x3cc2('0x6'));var sox=require('sox');var csv=require(_0x3cc2('0x7'));var ejs=require(_0x3cc2('0x8'));var fs=require('fs');var fs_extra=require(_0x3cc2('0x9'));var _=require('lodash');var squel=require(_0x3cc2('0xa'));var crypto=require('crypto');var jsforce=require(_0x3cc2('0xb'));var deskjs=require(_0x3cc2('0xc'));var toCsv=require(_0x3cc2('0x7'));var querystring=require('querystring');var Papa=require(_0x3cc2('0xd'));var Redis=require(_0x3cc2('0xe'));var authService=require(_0x3cc2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3cc2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cc2('0x11'))(_0x3cc2('0x12'));var utils=require(_0x3cc2('0x13'));var config=require(_0x3cc2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3cc2('0x15'))['db'];function respondWithStatusCode(_0x2fe61c,_0x441a45){_0x441a45=_0x441a45||0xcc;return function(_0x42f448){if(_0x42f448){return _0x2fe61c[_0x3cc2('0x16')](_0x441a45);}return _0x2fe61c[_0x3cc2('0x17')](_0x441a45)['end']();};}function respondWithResult(_0x32edc1,_0x4fe18c){_0x4fe18c=_0x4fe18c||0xc8;return function(_0x601d5a){if(_0x601d5a){return _0x32edc1[_0x3cc2('0x17')](_0x4fe18c)[_0x3cc2('0x18')](_0x601d5a);}};}function respondWithFilteredResult(_0x381a18,_0x15d7fd){return function(_0x141194){if(_0x141194){var _0x201cba=typeof _0x15d7fd['offset']===_0x3cc2('0x19')&&typeof _0x15d7fd['limit']==='undefined';var _0x390d39=_0x141194[_0x3cc2('0x1a')];var _0x4bb55a=_0x201cba?0x0:_0x15d7fd[_0x3cc2('0x1b')];var _0x41de82=_0x201cba?_0x141194[_0x3cc2('0x1a')]:_0x15d7fd[_0x3cc2('0x1b')]+_0x15d7fd[_0x3cc2('0x1c')];var _0x481845;if(_0x41de82>=_0x390d39){_0x41de82=_0x390d39;_0x481845=0xc8;}else{_0x481845=0xce;}_0x381a18[_0x3cc2('0x17')](_0x481845);return _0x381a18[_0x3cc2('0x1d')](_0x3cc2('0x1e'),_0x4bb55a+'-'+_0x41de82+'/'+_0x390d39)[_0x3cc2('0x18')](_0x141194);}return null;};}function patchUpdates(_0x25f422){return function(_0x35fe6a){try{jsonpatch['apply'](_0x35fe6a,_0x25f422,!![]);}catch(_0x44327c){return BPromise['reject'](_0x44327c);}return _0x35fe6a[_0x3cc2('0x1f')]();};}function saveUpdates(_0xdfc702,_0x2bdc51){return function(_0x3d1dba){if(_0x3d1dba){return _0x3d1dba[_0x3cc2('0x20')](_0xdfc702)[_0x3cc2('0x21')](function(_0x588494){return _0x588494;});}return null;};}function removeEntity(_0x26c052,_0x375ba5){return function(_0x3268a3){if(_0x3268a3){return _0x3268a3['destroy']()['then'](function(){_0x26c052['status'](0xcc)[_0x3cc2('0x22')]();});}};}function handleEntityNotFound(_0x49e952,_0x2f49f3){return function(_0x2cc6fb){if(!_0x2cc6fb){_0x49e952[_0x3cc2('0x16')](0x194);}return _0x2cc6fb;};}function handleError(_0x14de1a,_0x53ee10){_0x53ee10=_0x53ee10||0x1f4;return function(_0x5a6fb9){logger[_0x3cc2('0x23')](_0x5a6fb9[_0x3cc2('0x24')]);if(_0x5a6fb9['name']){delete _0x5a6fb9[_0x3cc2('0x25')];}_0x14de1a[_0x3cc2('0x17')](_0x53ee10)[_0x3cc2('0x26')](_0x5a6fb9);};}exports[_0x3cc2('0x27')]=function(_0x2002e6,_0x5f37e0){var _0xa7e7c3={},_0x99e9fc={},_0x1f7736={'count':0x0,'rows':[]};var _0x4e8f2e=_['map'](db[_0x3cc2('0x28')]['rawAttributes'],function(_0xc372b9){return{'name':_0xc372b9[_0x3cc2('0x29')],'type':_0xc372b9[_0x3cc2('0x2a')][_0x3cc2('0x2b')]};});_0x99e9fc['model']=_[_0x3cc2('0x2c')](_0x4e8f2e,_0x3cc2('0x25'));_0x99e9fc[_0x3cc2('0x2d')]=_[_0x3cc2('0x2e')](_0x2002e6[_0x3cc2('0x2d')]);_0x99e9fc[_0x3cc2('0x2f')]=_[_0x3cc2('0x30')](_0x99e9fc['model'],_0x99e9fc['query']);_0xa7e7c3[_0x3cc2('0x31')]=_[_0x3cc2('0x30')](_0x99e9fc[_0x3cc2('0x32')],qs[_0x3cc2('0x33')](_0x2002e6['query'][_0x3cc2('0x33')]));_0xa7e7c3[_0x3cc2('0x31')]=_0xa7e7c3['attributes']['length']?_0xa7e7c3[_0x3cc2('0x31')]:_0x99e9fc[_0x3cc2('0x32')];if(!_0x2002e6[_0x3cc2('0x2d')][_0x3cc2('0x34')](_0x3cc2('0x35'))){_0xa7e7c3[_0x3cc2('0x1c')]=qs[_0x3cc2('0x1c')](_0x2002e6[_0x3cc2('0x2d')]['limit']);_0xa7e7c3[_0x3cc2('0x1b')]=qs[_0x3cc2('0x1b')](_0x2002e6[_0x3cc2('0x2d')]['offset']);}_0xa7e7c3[_0x3cc2('0x36')]=qs[_0x3cc2('0x37')](_0x2002e6[_0x3cc2('0x2d')][_0x3cc2('0x37')]);_0xa7e7c3['where']=qs[_0x3cc2('0x2f')](_[_0x3cc2('0x38')](_0x2002e6[_0x3cc2('0x2d')],_0x99e9fc[_0x3cc2('0x2f')]),_0x4e8f2e);if(_0x2002e6['query'][_0x3cc2('0x39')]){_0xa7e7c3[_0x3cc2('0x3a')]=_[_0x3cc2('0x3b')](_0xa7e7c3[_0x3cc2('0x3a')],{'$or':_['map'](_0x4e8f2e,function(_0x4ac132){if(_0x4ac132[_0x3cc2('0x2a')]!==_0x3cc2('0x3c')){var _0x300233={};_0x300233[_0x4ac132[_0x3cc2('0x25')]]={'$like':'%'+_0x2002e6[_0x3cc2('0x2d')][_0x3cc2('0x39')]+'%'};return _0x300233;}})});}_0xa7e7c3=_[_0x3cc2('0x3b')]({},_0xa7e7c3,_0x2002e6['options']);var _0x591055={'where':_0xa7e7c3[_0x3cc2('0x3a')]};return db[_0x3cc2('0x28')][_0x3cc2('0x1a')](_0x591055)[_0x3cc2('0x21')](function(_0x14936e){_0x1f7736['count']=_0x14936e;if(_0x2002e6['query'][_0x3cc2('0x3d')]){_0xa7e7c3['include']=[{'all':!![]}];}return db[_0x3cc2('0x28')]['findAll'](_0xa7e7c3);})[_0x3cc2('0x21')](function(_0x34e997){_0x1f7736[_0x3cc2('0x3e')]=_0x34e997;return _0x1f7736;})[_0x3cc2('0x21')](respondWithFilteredResult(_0x5f37e0,_0xa7e7c3))[_0x3cc2('0x3f')](handleError(_0x5f37e0,null));};exports[_0x3cc2('0x40')]=function(_0xe24792,_0x3d2e03){var _0x52370a={'raw':!![],'where':{'id':_0xe24792[_0x3cc2('0x41')]['id']}},_0x3a3785={};_0x3a3785[_0x3cc2('0x32')]=_[_0x3cc2('0x2e')](db[_0x3cc2('0x28')][_0x3cc2('0x42')]);_0x3a3785[_0x3cc2('0x2d')]=_[_0x3cc2('0x2e')](_0xe24792[_0x3cc2('0x2d')]);_0x3a3785[_0x3cc2('0x2f')]=_[_0x3cc2('0x30')](_0x3a3785['model'],_0x3a3785[_0x3cc2('0x2d')]);_0x52370a['attributes']=_[_0x3cc2('0x30')](_0x3a3785[_0x3cc2('0x32')],qs['fields'](_0xe24792['query'][_0x3cc2('0x33')]));_0x52370a[_0x3cc2('0x31')]=_0x52370a[_0x3cc2('0x31')][_0x3cc2('0x43')]?_0x52370a[_0x3cc2('0x31')]:_0x3a3785['model'];if(_0xe24792[_0x3cc2('0x2d')][_0x3cc2('0x3d')]){_0x52370a[_0x3cc2('0x44')]=[{'all':!![]}];}_0x52370a=_[_0x3cc2('0x3b')]({},_0x52370a,_0xe24792[_0x3cc2('0x45')]);return db[_0x3cc2('0x28')]['find'](_0x52370a)[_0x3cc2('0x21')](handleEntityNotFound(_0x3d2e03,null))[_0x3cc2('0x21')](respondWithResult(_0x3d2e03,null))[_0x3cc2('0x3f')](handleError(_0x3d2e03,null));};exports[_0x3cc2('0x46')]=function(_0x1d10a6,_0x4d85e1){return db[_0x3cc2('0x28')]['create'](_0x1d10a6[_0x3cc2('0x47')],{})['then'](respondWithResult(_0x4d85e1,0xc9))[_0x3cc2('0x3f')](handleError(_0x4d85e1,null));};exports[_0x3cc2('0x20')]=function(_0x32d3db,_0x20422b){if(_0x32d3db['body']['id']){delete _0x32d3db['body']['id'];}return db[_0x3cc2('0x28')][_0x3cc2('0x48')]({'where':{'id':_0x32d3db[_0x3cc2('0x41')]['id']}})[_0x3cc2('0x21')](handleEntityNotFound(_0x20422b,null))[_0x3cc2('0x21')](saveUpdates(_0x32d3db[_0x3cc2('0x47')],null))['then'](respondWithResult(_0x20422b,null))['catch'](handleError(_0x20422b,null));};exports[_0x3cc2('0x49')]=function(_0x469fed,_0x1a2eaa){return db[_0x3cc2('0x28')][_0x3cc2('0x48')]({'where':{'id':_0x469fed[_0x3cc2('0x41')]['id']}})[_0x3cc2('0x21')](handleEntityNotFound(_0x1a2eaa,null))[_0x3cc2('0x21')](removeEntity(_0x1a2eaa,null))[_0x3cc2('0x3f')](handleError(_0x1a2eaa,null));}; \ No newline at end of file +var _0xf6ad=['show','rawAttributes','options','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','Dynamics365Field','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch'];(function(_0x597eb5,_0x4cb6f4){var _0x1305ab=function(_0x24c0cb){while(--_0x24c0cb){_0x597eb5['push'](_0x597eb5['shift']());}};_0x1305ab(++_0x4cb6f4);}(_0xf6ad,0xde));var _0xdf6a=function(_0x3f6f75,_0x26d69e){_0x3f6f75=_0x3f6f75-0x0;var _0x49931f=_0xf6ad[_0x3f6f75];return _0x49931f;};'use strict';var emlformat=require(_0xdf6a('0x0'));var rimraf=require(_0xdf6a('0x1'));var zipdir=require(_0xdf6a('0x2'));var jsonpatch=require(_0xdf6a('0x3'));var rp=require(_0xdf6a('0x4'));var moment=require('moment');var BPromise=require(_0xdf6a('0x5'));var Mustache=require(_0xdf6a('0x6'));var util=require(_0xdf6a('0x7'));var path=require(_0xdf6a('0x8'));var sox=require(_0xdf6a('0x9'));var csv=require(_0xdf6a('0xa'));var ejs=require(_0xdf6a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf6a('0xc'));var squel=require(_0xdf6a('0xd'));var crypto=require('crypto');var jsforce=require(_0xdf6a('0xe'));var deskjs=require(_0xdf6a('0xf'));var toCsv=require(_0xdf6a('0xa'));var querystring=require(_0xdf6a('0x10'));var Papa=require(_0xdf6a('0x11'));var Redis=require(_0xdf6a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf6a('0x13'));var hardwareService=require(_0xdf6a('0x14'));var logger=require('../../config/logger')(_0xdf6a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdf6a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x121150,_0x19d394){_0x19d394=_0x19d394||0xcc;return function(_0x5444d5){if(_0x5444d5){return _0x121150[_0xdf6a('0x17')](_0x19d394);}return _0x121150[_0xdf6a('0x18')](_0x19d394)[_0xdf6a('0x19')]();};}function respondWithResult(_0x3fce3d,_0x1345c3){_0x1345c3=_0x1345c3||0xc8;return function(_0x55a936){if(_0x55a936){return _0x3fce3d[_0xdf6a('0x18')](_0x1345c3)[_0xdf6a('0x1a')](_0x55a936);}};}function respondWithFilteredResult(_0x376da4,_0x19572a){return function(_0x36c0b7){if(_0x36c0b7){var _0x4901a1=typeof _0x19572a[_0xdf6a('0x1b')]==='undefined'&&typeof _0x19572a['limit']===_0xdf6a('0x1c');var _0x51ad34=_0x36c0b7[_0xdf6a('0x1d')];var _0x203bc8=_0x4901a1?0x0:_0x19572a['offset'];var _0x1bebcb=_0x4901a1?_0x36c0b7[_0xdf6a('0x1d')]:_0x19572a[_0xdf6a('0x1b')]+_0x19572a[_0xdf6a('0x1e')];var _0x26d6cc;if(_0x1bebcb>=_0x51ad34){_0x1bebcb=_0x51ad34;_0x26d6cc=0xc8;}else{_0x26d6cc=0xce;}_0x376da4[_0xdf6a('0x18')](_0x26d6cc);return _0x376da4[_0xdf6a('0x1f')](_0xdf6a('0x20'),_0x203bc8+'-'+_0x1bebcb+'/'+_0x51ad34)[_0xdf6a('0x1a')](_0x36c0b7);}return null;};}function patchUpdates(_0x3f0b57){return function(_0x122860){try{jsonpatch[_0xdf6a('0x21')](_0x122860,_0x3f0b57,!![]);}catch(_0xde159a){return BPromise['reject'](_0xde159a);}return _0x122860[_0xdf6a('0x22')]();};}function saveUpdates(_0xa78c13,_0x113193){return function(_0x33631e){if(_0x33631e){return _0x33631e[_0xdf6a('0x23')](_0xa78c13)[_0xdf6a('0x24')](function(_0xcf349c){return _0xcf349c;});}return null;};}function removeEntity(_0x406508,_0x35fed7){return function(_0x3951d8){if(_0x3951d8){return _0x3951d8[_0xdf6a('0x25')]()[_0xdf6a('0x24')](function(){_0x406508[_0xdf6a('0x18')](0xcc)[_0xdf6a('0x19')]();});}};}function handleEntityNotFound(_0x5bb4db,_0x2bc40d){return function(_0x489957){if(!_0x489957){_0x5bb4db['sendStatus'](0x194);}return _0x489957;};}function handleError(_0x53a3c2,_0x515a96){_0x515a96=_0x515a96||0x1f4;return function(_0x1a5021){logger[_0xdf6a('0x26')](_0x1a5021['stack']);if(_0x1a5021[_0xdf6a('0x27')]){delete _0x1a5021[_0xdf6a('0x27')];}_0x53a3c2[_0xdf6a('0x18')](_0x515a96)[_0xdf6a('0x28')](_0x1a5021);};}exports[_0xdf6a('0x29')]=function(_0x32cdcb,_0x2dc80c){var _0x317f90={},_0x458793={},_0x1aedf8={'count':0x0,'rows':[]};var _0x4bfc22=_[_0xdf6a('0x2a')](db[_0xdf6a('0x2b')]['rawAttributes'],function(_0x145f9b){return{'name':_0x145f9b[_0xdf6a('0x2c')],'type':_0x145f9b[_0xdf6a('0x2d')]['key']};});_0x458793[_0xdf6a('0x2e')]=_[_0xdf6a('0x2a')](_0x4bfc22,_0xdf6a('0x27'));_0x458793[_0xdf6a('0x2f')]=_[_0xdf6a('0x30')](_0x32cdcb[_0xdf6a('0x2f')]);_0x458793[_0xdf6a('0x31')]=_[_0xdf6a('0x32')](_0x458793[_0xdf6a('0x2e')],_0x458793[_0xdf6a('0x2f')]);_0x317f90['attributes']=_[_0xdf6a('0x32')](_0x458793['model'],qs[_0xdf6a('0x33')](_0x32cdcb[_0xdf6a('0x2f')]['fields']));_0x317f90['attributes']=_0x317f90[_0xdf6a('0x34')][_0xdf6a('0x35')]?_0x317f90[_0xdf6a('0x34')]:_0x458793['model'];if(!_0x32cdcb['query']['hasOwnProperty'](_0xdf6a('0x36'))){_0x317f90[_0xdf6a('0x1e')]=qs['limit'](_0x32cdcb[_0xdf6a('0x2f')][_0xdf6a('0x1e')]);_0x317f90['offset']=qs['offset'](_0x32cdcb[_0xdf6a('0x2f')][_0xdf6a('0x1b')]);}_0x317f90[_0xdf6a('0x37')]=qs[_0xdf6a('0x38')](_0x32cdcb['query']['sort']);_0x317f90[_0xdf6a('0x39')]=qs[_0xdf6a('0x31')](_[_0xdf6a('0x3a')](_0x32cdcb[_0xdf6a('0x2f')],_0x458793[_0xdf6a('0x31')]),_0x4bfc22);if(_0x32cdcb[_0xdf6a('0x2f')][_0xdf6a('0x3b')]){_0x317f90['where']=_[_0xdf6a('0x3c')](_0x317f90['where'],{'$or':_[_0xdf6a('0x2a')](_0x4bfc22,function(_0x791f9e){if(_0x791f9e[_0xdf6a('0x2d')]!==_0xdf6a('0x3d')){var _0x101ff0={};_0x101ff0[_0x791f9e[_0xdf6a('0x27')]]={'$like':'%'+_0x32cdcb[_0xdf6a('0x2f')]['filter']+'%'};return _0x101ff0;}})});}_0x317f90=_[_0xdf6a('0x3c')]({},_0x317f90,_0x32cdcb['options']);var _0xc050ff={'where':_0x317f90['where']};return db[_0xdf6a('0x2b')][_0xdf6a('0x1d')](_0xc050ff)['then'](function(_0x17d6ba){_0x1aedf8[_0xdf6a('0x1d')]=_0x17d6ba;if(_0x32cdcb[_0xdf6a('0x2f')][_0xdf6a('0x3e')]){_0x317f90[_0xdf6a('0x3f')]=[{'all':!![]}];}return db[_0xdf6a('0x2b')]['findAll'](_0x317f90);})[_0xdf6a('0x24')](function(_0x52a173){_0x1aedf8[_0xdf6a('0x40')]=_0x52a173;return _0x1aedf8;})[_0xdf6a('0x24')](respondWithFilteredResult(_0x2dc80c,_0x317f90))[_0xdf6a('0x41')](handleError(_0x2dc80c,null));};exports[_0xdf6a('0x42')]=function(_0x33b5bc,_0x1e802e){var _0x23d378={'raw':!![],'where':{'id':_0x33b5bc['params']['id']}},_0x48964e={};_0x48964e[_0xdf6a('0x2e')]=_[_0xdf6a('0x30')](db['Dynamics365Field'][_0xdf6a('0x43')]);_0x48964e[_0xdf6a('0x2f')]=_[_0xdf6a('0x30')](_0x33b5bc[_0xdf6a('0x2f')]);_0x48964e['filters']=_[_0xdf6a('0x32')](_0x48964e[_0xdf6a('0x2e')],_0x48964e[_0xdf6a('0x2f')]);_0x23d378[_0xdf6a('0x34')]=_[_0xdf6a('0x32')](_0x48964e[_0xdf6a('0x2e')],qs[_0xdf6a('0x33')](_0x33b5bc[_0xdf6a('0x2f')][_0xdf6a('0x33')]));_0x23d378['attributes']=_0x23d378[_0xdf6a('0x34')][_0xdf6a('0x35')]?_0x23d378[_0xdf6a('0x34')]:_0x48964e[_0xdf6a('0x2e')];if(_0x33b5bc[_0xdf6a('0x2f')][_0xdf6a('0x3e')]){_0x23d378[_0xdf6a('0x3f')]=[{'all':!![]}];}_0x23d378=_[_0xdf6a('0x3c')]({},_0x23d378,_0x33b5bc[_0xdf6a('0x44')]);return db[_0xdf6a('0x2b')][_0xdf6a('0x45')](_0x23d378)[_0xdf6a('0x24')](handleEntityNotFound(_0x1e802e,null))[_0xdf6a('0x24')](respondWithResult(_0x1e802e,null))[_0xdf6a('0x41')](handleError(_0x1e802e,null));};exports['create']=function(_0x436d67,_0x3237d4){return db[_0xdf6a('0x2b')]['create'](_0x436d67[_0xdf6a('0x46')],{})[_0xdf6a('0x24')](respondWithResult(_0x3237d4,0xc9))[_0xdf6a('0x41')](handleError(_0x3237d4,null));};exports[_0xdf6a('0x23')]=function(_0x1578db,_0x564355){if(_0x1578db['body']['id']){delete _0x1578db[_0xdf6a('0x46')]['id'];}return db[_0xdf6a('0x2b')][_0xdf6a('0x45')]({'where':{'id':_0x1578db[_0xdf6a('0x47')]['id']}})[_0xdf6a('0x24')](handleEntityNotFound(_0x564355,null))[_0xdf6a('0x24')](saveUpdates(_0x1578db['body'],null))['then'](respondWithResult(_0x564355,null))[_0xdf6a('0x41')](handleError(_0x564355,null));};exports[_0xdf6a('0x25')]=function(_0x2db759,_0x4d63d3){return db[_0xdf6a('0x2b')][_0xdf6a('0x45')]({'where':{'id':_0x2db759[_0xdf6a('0x47')]['id']}})[_0xdf6a('0x24')](handleEntityNotFound(_0x4d63d3,null))['then'](removeEntity(_0x4d63d3,null))[_0xdf6a('0x41')](handleError(_0x4d63d3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 353d46b..afe2b84 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 _0x98d1=['../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x98d1,0x190));var _0x198d=function(_0xdfbb37,_0xd2490d){_0xdfbb37=_0xdfbb37-0x0;var _0x1d44b8=_0x98d1[_0xdfbb37];return _0x1d44b8;};'use strict';var _=require(_0x198d('0x0'));var util=require(_0x198d('0x1'));var logger=require(_0x198d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x198d('0x3'));var rp=require(_0x198d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x198d('0x5'));var config=require(_0x198d('0x6'));var attributes=require(_0x198d('0x7'));module[_0x198d('0x8')]=function(_0x1cfead,_0x16834c){return _0x1cfead[_0x198d('0x9')]('Dynamics365Field',attributes,{'tableName':_0x198d('0xa'),'paranoid':![],'indexes':[{'name':_0x198d('0xb'),'fields':[_0x198d('0xc'),_0x198d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf588=['util','../../config/logger','moment','request-promise','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','idField','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf588,0x1cd));var _0x8f58=function(_0x5d6b17,_0xead78a){_0x5d6b17=_0x5d6b17-0x0;var _0x27f93f=_0xf588[_0x5d6b17];return _0x27f93f;};'use strict';var _=require(_0x8f58('0x0'));var util=require(_0x8f58('0x1'));var logger=require(_0x8f58('0x2'))('api');var moment=require(_0x8f58('0x3'));var BPromise=require('bluebird');var rp=require(_0x8f58('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f58('0x5'));var config=require('../../config/environment');var attributes=require(_0x8f58('0x6'));module[_0x8f58('0x7')]=function(_0x372b89,_0x158f6){return _0x372b89['define'](_0x8f58('0x8'),attributes,{'tableName':_0x8f58('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x8f58('0xa'),'FieldId'],'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 f3314bc..aac804f 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 _0x2aec=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','code','Dynamics365Field,\x20%s,\x20%s','message','catch','util','moment','bluebird'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0x2aec,0x141));var _0xc2ae=function(_0x23f785,_0xb2072){_0x23f785=_0x23f785-0x0;var _0x4fa572=_0x2aec[_0x23f785];return _0x4fa572;};'use strict';var _=require('lodash');var util=require(_0xc2ae('0x0'));var moment=require(_0xc2ae('0x1'));var BPromise=require(_0xc2ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2ae('0x4'));var logger=require('../../config/logger')(_0xc2ae('0x5'));var config=require(_0xc2ae('0x6'));var jayson=require(_0xc2ae('0x7'));var client=jayson[_0xc2ae('0x8')][_0xc2ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1630d5,_0xce7c66,_0x3fa9be){return new BPromise(function(_0x109c51,_0x32c1dd){return client['request'](_0x1630d5,_0x3fa9be)[_0xc2ae('0xa')](function(_0x2a4a33){logger[_0xc2ae('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0xce7c66,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xce7c66,_0xc2ae('0xc'),JSON['stringify'](_0x2a4a33));if(_0x2a4a33[_0xc2ae('0xd')]){if(_0x2a4a33[_0xc2ae('0xd')][_0xc2ae('0xe')]===0x1f4){logger[_0xc2ae('0xd')](_0xc2ae('0xf'),_0xce7c66,_0x2a4a33[_0xc2ae('0xd')][_0xc2ae('0x10')]);return _0x32c1dd(_0x2a4a33['error'][_0xc2ae('0x10')]);}logger[_0xc2ae('0xd')](_0xc2ae('0xf'),_0xce7c66,_0x2a4a33[_0xc2ae('0xd')]['message']);return _0x109c51(_0x2a4a33[_0xc2ae('0xd')]['message']);}else{logger['info'](_0xc2ae('0xf'),_0xce7c66,_0xc2ae('0xc'));_0x109c51(_0x2a4a33['result'][_0xc2ae('0x10')]);}})[_0xc2ae('0x11')](function(_0x53855){logger['error'](_0xc2ae('0xf'),_0xce7c66,_0x53855);_0x32c1dd(_0x53855);});});} \ No newline at end of file +var _0xe2a0=['request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x41e96,_0x4c9b00){var _0x2f16cf=function(_0x3c6cb4){while(--_0x3c6cb4){_0x41e96['push'](_0x41e96['shift']());}};_0x2f16cf(++_0x4c9b00);}(_0xe2a0,0x1d3));var _0x0e2a=function(_0x435344,_0x33239b){_0x435344=_0x435344-0x0;var _0xf0fa25=_0xe2a0[_0x435344];return _0xf0fa25;};'use strict';var _=require(_0x0e2a('0x0'));var util=require(_0x0e2a('0x1'));var moment=require('moment');var BPromise=require(_0x0e2a('0x2'));var rs=require(_0x0e2a('0x3'));var fs=require('fs');var Redis=require(_0x0e2a('0x4'));var db=require(_0x0e2a('0x5'))['db'];var utils=require(_0x0e2a('0x6'));var logger=require(_0x0e2a('0x7'))('rpc');var config=require(_0x0e2a('0x8'));var jayson=require(_0x0e2a('0x9'));var client=jayson[_0x0e2a('0xa')][_0x0e2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcf535e,_0x1330b7,_0x587fdf){return new BPromise(function(_0x351022,_0x1c2d90){return client[_0x0e2a('0xc')](_0xcf535e,_0x587fdf)[_0x0e2a('0xd')](function(_0xc4f95f){logger[_0x0e2a('0xe')](_0x0e2a('0xf'),_0x1330b7,_0x0e2a('0x10'));logger['debug'](_0x0e2a('0x11'),_0x1330b7,_0x0e2a('0x10'),JSON[_0x0e2a('0x12')](_0xc4f95f));if(_0xc4f95f[_0x0e2a('0x13')]){if(_0xc4f95f[_0x0e2a('0x13')][_0x0e2a('0x14')]===0x1f4){logger[_0x0e2a('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x1330b7,_0xc4f95f[_0x0e2a('0x13')]['message']);return _0x1c2d90(_0xc4f95f[_0x0e2a('0x13')]['message']);}logger[_0x0e2a('0x13')](_0x0e2a('0xf'),_0x1330b7,_0xc4f95f[_0x0e2a('0x13')][_0x0e2a('0x15')]);return _0x351022(_0xc4f95f[_0x0e2a('0x13')][_0x0e2a('0x15')]);}else{logger['info'](_0x0e2a('0xf'),_0x1330b7,_0x0e2a('0x10'));_0x351022(_0xc4f95f[_0x0e2a('0x16')][_0x0e2a('0x15')]);}})['catch'](function(_0x20b48c){logger[_0x0e2a('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x1330b7,_0x20b48c);_0x1c2d90(_0x20b48c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 1e4fc95..4e4ef20 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 _0x6d5f=['fs-extra','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3c9bdf,_0x3b30cd){var _0x5664a6=function(_0x4ea55c){while(--_0x4ea55c){_0x3c9bdf['push'](_0x3c9bdf['shift']());}};_0x5664a6(++_0x3b30cd);}(_0x6d5f,0x18a));var _0xf6d5=function(_0x7de442,_0x182d78){_0x7de442=_0x7de442-0x0;var _0x51072f=_0x6d5f[_0x7de442];return _0x51072f;};'use strict';var multer=require(_0xf6d5('0x0'));var util=require(_0xf6d5('0x1'));var path=require(_0xf6d5('0x2'));var timeout=require(_0xf6d5('0x3'));var express=require(_0xf6d5('0x4'));var router=express[_0xf6d5('0x5')]();var fs_extra=require(_0xf6d5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf6d5('0x7'));var config=require(_0xf6d5('0x8'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf6d5('0x9')]);router[_0xf6d5('0xa')]('/:id',auth[_0xf6d5('0xb')](),controller[_0xf6d5('0xc')]);router[_0xf6d5('0xa')](_0xf6d5('0xd'),auth[_0xf6d5('0xb')](),controller[_0xf6d5('0xe')]);router[_0xf6d5('0xa')](_0xf6d5('0xf'),auth[_0xf6d5('0xb')](),controller[_0xf6d5('0x10')]);router[_0xf6d5('0x11')]('/',auth[_0xf6d5('0xb')](),controller[_0xf6d5('0x12')]);router['post'](_0xf6d5('0xd'),auth[_0xf6d5('0xb')](),controller[_0xf6d5('0x13')]);router[_0xf6d5('0x14')](_0xf6d5('0x15'),auth[_0xf6d5('0xb')](),controller[_0xf6d5('0x16')]);router[_0xf6d5('0x17')](_0xf6d5('0x15'),auth[_0xf6d5('0xb')](),controller['destroy']);module[_0xf6d5('0x18')]=router; \ No newline at end of file +var _0xc827=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x290d3f,_0x4ebeb7){var _0x7f91e6=function(_0x152461){while(--_0x152461){_0x290d3f['push'](_0x290d3f['shift']());}};_0x7f91e6(++_0x4ebeb7);}(_0xc827,0x1d6));var _0x7c82=function(_0x575358,_0x2bc7c2){_0x575358=_0x575358-0x0;var _0x2e36a6=_0xc827[_0x575358];return _0x2e36a6;};'use strict';var multer=require(_0x7c82('0x0'));var util=require(_0x7c82('0x1'));var path=require(_0x7c82('0x2'));var timeout=require(_0x7c82('0x3'));var express=require('express');var router=express[_0x7c82('0x4')]();var fs_extra=require(_0x7c82('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c82('0x6'));var config=require(_0x7c82('0x7'));var controller=require(_0x7c82('0x8'));router[_0x7c82('0x9')]('/',auth[_0x7c82('0xa')](),controller[_0x7c82('0xb')]);router[_0x7c82('0x9')](_0x7c82('0xc'),auth[_0x7c82('0xa')](),controller[_0x7c82('0xd')]);router[_0x7c82('0x9')](_0x7c82('0xe'),auth['isAuthenticated'](),controller[_0x7c82('0xf')]);router[_0x7c82('0x9')](_0x7c82('0x10'),auth[_0x7c82('0xa')](),controller[_0x7c82('0x11')]);router[_0x7c82('0x12')]('/',auth[_0x7c82('0xa')](),controller['create']);router['post'](_0x7c82('0xe'),auth[_0x7c82('0xa')](),controller['addConfiguration']);router[_0x7c82('0x13')](_0x7c82('0xc'),auth[_0x7c82('0xa')](),controller['update']);router['delete'](_0x7c82('0xc'),auth[_0x7c82('0xa')](),controller[_0x7c82('0x14')]);module[_0x7c82('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 4efc7ca..ba1f5cc 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 _0xa456=['STRING','username','sequelize','exports'];(function(_0x1b3df1,_0xd27d37){var _0x4c9bc5=function(_0x3c94ea){while(--_0x3c94ea){_0x1b3df1['push'](_0x1b3df1['shift']());}};_0x4c9bc5(++_0xd27d37);}(_0xa456,0x142));var _0x6a45=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xa456[_0x42bc91];return _0x3f5507;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'name':{'type':Sequelize[_0x6a45('0x2')]},'description':{'type':Sequelize[_0x6a45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6a45('0x3')},'apiKey':{'type':Sequelize[_0x6a45('0x2')]},'remoteUri':{'type':Sequelize[_0x6a45('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6a45('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0xadb5,0xad));var _0x5adb=function(_0x297350,_0x2f4dcf){_0x297350=_0x297350-0x0;var _0x95fe72=_0xadb5[_0x297350];return _0x95fe72;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 00b8871..db67455 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 _0x9e5e=['Basic\x20%s','%s:X','apiKey','toString','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','include','rows','catch','show','params','attributes','includeAll','find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x9e5e[_0x725b8e];return _0x43ac45;};'use strict';var emlformat=require(_0xe9e5('0x0'));var rimraf=require(_0xe9e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9e5('0x2'));var rp=require(_0xe9e5('0x3'));var moment=require(_0xe9e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9e5('0x5'));var util=require('util');var path=require(_0xe9e5('0x6'));var sox=require(_0xe9e5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9e5('0x8'));var _=require(_0xe9e5('0x9'));var squel=require('squel');var crypto=require(_0xe9e5('0xa'));var jsforce=require(_0xe9e5('0xb'));var deskjs=require(_0xe9e5('0xc'));var toCsv=require(_0xe9e5('0xd'));var querystring=require(_0xe9e5('0xe'));var Papa=require(_0xe9e5('0xf'));var Redis=require(_0xe9e5('0x10'));var authService=require(_0xe9e5('0x11'));var qs=require(_0xe9e5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9e5('0x13'));var logger=require(_0xe9e5('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe9e5('0x15'))['db'];var integrations=require(_0xe9e5('0x16'));function respondWithStatusCode(_0x42dcba,_0x272b49){_0x272b49=_0x272b49||0xcc;return function(_0x269ac4){if(_0x269ac4){return _0x42dcba[_0xe9e5('0x17')](_0x272b49);}return _0x42dcba[_0xe9e5('0x18')](_0x272b49)[_0xe9e5('0x19')]();};}function respondWithResult(_0x3097da,_0xfe19e8){_0xfe19e8=_0xfe19e8||0xc8;return function(_0x5c901a){if(_0x5c901a){return _0x3097da[_0xe9e5('0x18')](_0xfe19e8)[_0xe9e5('0x1a')](_0x5c901a);}};}function respondWithFilteredResult(_0x35c830,_0x3f0990){return function(_0x17990d){if(_0x17990d){var _0x695c52=typeof _0x3f0990[_0xe9e5('0x1b')]===_0xe9e5('0x1c')&&typeof _0x3f0990[_0xe9e5('0x1d')]===_0xe9e5('0x1c');var _0x4d779e=_0x17990d[_0xe9e5('0x1e')];var _0x30550=_0x695c52?0x0:_0x3f0990[_0xe9e5('0x1b')];var _0x3ad9f9=_0x695c52?_0x17990d[_0xe9e5('0x1e')]:_0x3f0990[_0xe9e5('0x1b')]+_0x3f0990[_0xe9e5('0x1d')];var _0x44e60d;if(_0x3ad9f9>=_0x4d779e){_0x3ad9f9=_0x4d779e;_0x44e60d=0xc8;}else{_0x44e60d=0xce;}_0x35c830[_0xe9e5('0x18')](_0x44e60d);return _0x35c830[_0xe9e5('0x1f')]('Content-Range',_0x30550+'-'+_0x3ad9f9+'/'+_0x4d779e)['json'](_0x17990d);}return null;};}function patchUpdates(_0x559d10){return function(_0x106b21){try{jsonpatch[_0xe9e5('0x20')](_0x106b21,_0x559d10,!![]);}catch(_0x2935a4){return BPromise[_0xe9e5('0x21')](_0x2935a4);}return _0x106b21[_0xe9e5('0x22')]();};}function saveUpdates(_0xb2a983,_0x22d394){return function(_0x15db4b){if(_0x15db4b){return _0x15db4b[_0xe9e5('0x23')](_0xb2a983)[_0xe9e5('0x24')](function(_0x1b9d2f){return _0x1b9d2f;});}return null;};}function removeEntity(_0x4c0fb9,_0x252fdc){return function(_0x579d9a){if(_0x579d9a){return _0x579d9a[_0xe9e5('0x25')]()['then'](function(){_0x4c0fb9[_0xe9e5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac8fc,_0x5e84dc){return function(_0xf88884){if(!_0xf88884){_0x5ac8fc[_0xe9e5('0x17')](0x194);}return _0xf88884;};}function handleError(_0x338076,_0x327cb2){_0x327cb2=_0x327cb2||0x1f4;return function(_0x3fcab2){logger[_0xe9e5('0x26')](_0x3fcab2[_0xe9e5('0x27')]);if(_0x3fcab2[_0xe9e5('0x28')]){delete _0x3fcab2[_0xe9e5('0x28')];}_0x338076[_0xe9e5('0x18')](_0x327cb2)['send'](_0x3fcab2);};}exports[_0xe9e5('0x29')]=function(_0x56f728,_0xe7d11e){var _0x18969d={},_0x554bcb={},_0x4161e9={'count':0x0,'rows':[]};var _0x881d0d=_[_0xe9e5('0x2a')](db['FreshdeskAccount'][_0xe9e5('0x2b')],function(_0x5d0593){return{'name':_0x5d0593[_0xe9e5('0x2c')],'type':_0x5d0593[_0xe9e5('0x2d')]['key']};});_0x554bcb[_0xe9e5('0x2e')]=_[_0xe9e5('0x2a')](_0x881d0d,'name');_0x554bcb[_0xe9e5('0x2f')]=_[_0xe9e5('0x30')](_0x56f728[_0xe9e5('0x2f')]);_0x554bcb[_0xe9e5('0x31')]=_[_0xe9e5('0x32')](_0x554bcb[_0xe9e5('0x2e')],_0x554bcb['query']);_0x18969d['attributes']=_[_0xe9e5('0x32')](_0x554bcb[_0xe9e5('0x2e')],qs['fields'](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x33')]));_0x18969d['attributes']=_0x18969d['attributes'][_0xe9e5('0x34')]?_0x18969d['attributes']:_0x554bcb['model'];if(!_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x35')](_0xe9e5('0x36'))){_0x18969d[_0xe9e5('0x1d')]=qs[_0xe9e5('0x1d')](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x1d')]);_0x18969d[_0xe9e5('0x1b')]=qs[_0xe9e5('0x1b')](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x1b')]);}_0x18969d[_0xe9e5('0x37')]=qs[_0xe9e5('0x38')](_0x56f728['query'][_0xe9e5('0x38')]);_0x18969d[_0xe9e5('0x39')]=qs[_0xe9e5('0x31')](_[_0xe9e5('0x3a')](_0x56f728[_0xe9e5('0x2f')],_0x554bcb[_0xe9e5('0x31')]),_0x881d0d);if(_0x56f728['query'][_0xe9e5('0x3b')]){_0x18969d[_0xe9e5('0x39')]=_[_0xe9e5('0x3c')](_0x18969d['where'],{'$or':_[_0xe9e5('0x2a')](_0x881d0d,function(_0x352903){if(_0x352903[_0xe9e5('0x2d')]!==_0xe9e5('0x3d')){var _0x3353d6={};_0x3353d6[_0x352903[_0xe9e5('0x28')]]={'$like':'%'+_0x56f728[_0xe9e5('0x2f')]['filter']+'%'};return _0x3353d6;}})});}_0x18969d=_['merge']({},_0x18969d,_0x56f728[_0xe9e5('0x3e')]);var _0x304571={'where':_0x18969d[_0xe9e5('0x39')]};return db[_0xe9e5('0x3f')][_0xe9e5('0x1e')](_0x304571)['then'](function(_0x2c44eb){_0x4161e9['count']=_0x2c44eb;if(_0x56f728[_0xe9e5('0x2f')]['includeAll']){_0x18969d[_0xe9e5('0x40')]=[{'all':!![]}];}return db[_0xe9e5('0x3f')]['findAll'](_0x18969d);})[_0xe9e5('0x24')](function(_0x47c5ea){_0x4161e9[_0xe9e5('0x41')]=_0x47c5ea;return _0x4161e9;})[_0xe9e5('0x24')](respondWithFilteredResult(_0xe7d11e,_0x18969d))[_0xe9e5('0x42')](handleError(_0xe7d11e,null));};exports[_0xe9e5('0x43')]=function(_0x10572d,_0x2bc934){var _0x1601fd={'raw':![],'where':{'id':_0x10572d[_0xe9e5('0x44')]['id']}},_0x147741={};_0x147741[_0xe9e5('0x2e')]=_[_0xe9e5('0x30')](db['FreshdeskAccount'][_0xe9e5('0x2b')]);_0x147741[_0xe9e5('0x2f')]=_[_0xe9e5('0x30')](_0x10572d[_0xe9e5('0x2f')]);_0x147741['filters']=_['intersection'](_0x147741[_0xe9e5('0x2e')],_0x147741['query']);_0x1601fd[_0xe9e5('0x45')]=_[_0xe9e5('0x32')](_0x147741[_0xe9e5('0x2e')],qs[_0xe9e5('0x33')](_0x10572d[_0xe9e5('0x2f')]['fields']));_0x1601fd[_0xe9e5('0x45')]=_0x1601fd['attributes']['length']?_0x1601fd['attributes']:_0x147741[_0xe9e5('0x2e')];if(_0x10572d[_0xe9e5('0x2f')][_0xe9e5('0x46')]){_0x1601fd[_0xe9e5('0x40')]=[{'all':!![]}];}_0x1601fd=_[_0xe9e5('0x3c')]({},_0x1601fd,_0x10572d[_0xe9e5('0x3e')]);return db[_0xe9e5('0x3f')][_0xe9e5('0x47')](_0x1601fd)['then'](handleEntityNotFound(_0x2bc934,null))[_0xe9e5('0x24')](respondWithResult(_0x2bc934,null))[_0xe9e5('0x42')](handleError(_0x2bc934,null));};exports[_0xe9e5('0x48')]=function(_0x441839,_0x2b785e){return db[_0xe9e5('0x3f')][_0xe9e5('0x48')](_0x441839['body'],{})['then'](respondWithResult(_0x2b785e,0xc9))[_0xe9e5('0x42')](handleError(_0x2b785e,null));};exports['update']=function(_0x1dc5cf,_0x20be8f){if(_0x1dc5cf[_0xe9e5('0x49')]['id']){delete _0x1dc5cf['body']['id'];}return db[_0xe9e5('0x3f')][_0xe9e5('0x47')]({'where':{'id':_0x1dc5cf[_0xe9e5('0x44')]['id']}})[_0xe9e5('0x24')](handleEntityNotFound(_0x20be8f,null))['then'](saveUpdates(_0x1dc5cf[_0xe9e5('0x49')],null))[_0xe9e5('0x24')](respondWithResult(_0x20be8f,null))[_0xe9e5('0x42')](handleError(_0x20be8f,null));};exports[_0xe9e5('0x25')]=function(_0x3f532d,_0x23cee5){return db[_0xe9e5('0x3f')][_0xe9e5('0x47')]({'where':{'id':_0x3f532d[_0xe9e5('0x44')]['id']}})['then'](handleEntityNotFound(_0x23cee5,null))['then'](removeEntity(_0x23cee5,null))[_0xe9e5('0x42')](handleError(_0x23cee5,null));};exports[_0xe9e5('0x4a')]=function(_0x275022,_0x3b673d,_0x219f73){var _0x19ad88={};var _0x42ce27={};var _0x28439f;var _0x47d74b;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x275022[_0xe9e5('0x44')]['id']}})[_0xe9e5('0x24')](handleEntityNotFound(_0x3b673d,null))[_0xe9e5('0x24')](function(_0x198ce0){if(_0x198ce0){_0x28439f=_0x198ce0;_0x42ce27[_0xe9e5('0x2e')]=_[_0xe9e5('0x30')](db[_0xe9e5('0x4b')]['rawAttributes']);_0x42ce27[_0xe9e5('0x2f')]=_['keys'](_0x275022[_0xe9e5('0x2f')]);_0x42ce27[_0xe9e5('0x31')]=_[_0xe9e5('0x32')](_0x42ce27['model'],_0x42ce27[_0xe9e5('0x2f')]);_0x19ad88[_0xe9e5('0x45')]=_['intersection'](_0x42ce27['model'],qs[_0xe9e5('0x33')](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x33')]));_0x19ad88[_0xe9e5('0x45')]=_0x19ad88[_0xe9e5('0x45')][_0xe9e5('0x34')]?_0x19ad88[_0xe9e5('0x45')]:_0x42ce27['model'];_0x19ad88[_0xe9e5('0x37')]=qs[_0xe9e5('0x38')](_0x275022[_0xe9e5('0x2f')]['sort']);_0x19ad88[_0xe9e5('0x39')]=qs[_0xe9e5('0x31')](_['pick'](_0x275022[_0xe9e5('0x2f')],_0x42ce27[_0xe9e5('0x31')]));if(_0x275022[_0xe9e5('0x2f')]['filter']){_0x19ad88[_0xe9e5('0x39')]=_[_0xe9e5('0x3c')](_0x19ad88[_0xe9e5('0x39')],{'$or':_[_0xe9e5('0x2a')](_0x19ad88[_0xe9e5('0x45')],function(_0x33ea59){var _0x10b48b={};_0x10b48b[_0x33ea59]={'$like':'%'+_0x275022[_0xe9e5('0x2f')]['filter']+'%'};return _0x10b48b;})});}_0x19ad88=_['merge']({},_0x19ad88,_0x275022[_0xe9e5('0x3e')]);return _0x28439f[_0xe9e5('0x4a')](_0x19ad88);}})[_0xe9e5('0x24')](function(_0x24e116){if(_0x24e116){_0x47d74b=_0x24e116[_0xe9e5('0x34')];if(!_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x35')]('nolimit')){_0x19ad88[_0xe9e5('0x1d')]=qs[_0xe9e5('0x1d')](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x1d')]);_0x19ad88['offset']=qs['offset'](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x1b')]);}return _0x28439f[_0xe9e5('0x4a')](_0x19ad88);}})['then'](function(_0x49d6bb){if(_0x49d6bb){return _0x49d6bb?{'count':_0x47d74b,'rows':_0x49d6bb}:null;}})['then'](respondWithResult(_0x3b673d,null))[_0xe9e5('0x42')](handleError(_0x3b673d,null));};exports[_0xe9e5('0x4c')]=function(_0x335685,_0x19bcd6,_0x2da8ad){if(_0x335685[_0xe9e5('0x49')]['id']){delete _0x335685[_0xe9e5('0x49')]['id'];}return db['FreshdeskAccount'][_0xe9e5('0x4d')]({'where':{'id':_0x335685['params']['id']}})['then'](handleEntityNotFound(_0x19bcd6,null))[_0xe9e5('0x24')](function(_0x1e3373){if(_0x1e3373){_0x335685[_0xe9e5('0x49')][_0xe9e5('0x4e')]=_0x1e3373['id'];_0x335685[_0xe9e5('0x49')][_0xe9e5('0x4f')]=integrations[_0xe9e5('0x50')](_0x335685[_0xe9e5('0x49')][_0xe9e5('0x51')],_0x335685['body'][_0xe9e5('0x2d')]);_0x335685[_0xe9e5('0x49')]['Descriptions']=integrations['getDescriptions'](_0x335685[_0xe9e5('0x49')][_0xe9e5('0x51')],_0x335685[_0xe9e5('0x49')][_0xe9e5('0x2d')]);return db[_0xe9e5('0x4b')][_0xe9e5('0x48')](_0x335685[_0xe9e5('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0xe9e5('0x4f')},{'model':db[_0xe9e5('0x52')],'as':_0xe9e5('0x53')}]});}return null;})[_0xe9e5('0x24')](respondWithResult(_0x19bcd6,null))[_0xe9e5('0x42')](handleError(_0x19bcd6,null));};exports[_0xe9e5('0x54')]=function(_0x15d799,_0x17dcb9,_0x3f655c){var _0x54ba7e='';return db[_0xe9e5('0x3f')]['findOne']({'where':{'id':_0x15d799['params']['id']},'attributes':['id',_0xe9e5('0x55'),'apiKey']})[_0xe9e5('0x24')](handleEntityNotFound(_0x17dcb9,null))[_0xe9e5('0x24')](function(_0x4aa632){if(_0x4aa632){_0x54ba7e=_0x4aa632[_0xe9e5('0x55')];var _0x50ee97=_0x54ba7e[_0xe9e5('0x56')](-0x1);if(_0x50ee97==='/'){_0x54ba7e=_0x54ba7e[_0xe9e5('0x57')](0x0,_0x54ba7e[_0xe9e5('0x58')](_0x50ee97));}return rp({'method':_0xe9e5('0x59'),'uri':util['format'](_0xe9e5('0x5a'),_0x54ba7e,_0xe9e5('0x5b')),'headers':{'Authorization':util[_0xe9e5('0x5c')](_0xe9e5('0x5d'),new Buffer(util['format'](_0xe9e5('0x5e'),_0x4aa632[_0xe9e5('0x5f')]))[_0xe9e5('0x60')]('base64'))},'json':!![]});}})[_0xe9e5('0x24')](function(_0x3b89b2){if(_0x3b89b2){var _0x59c87e=['requester','subject',_0xe9e5('0x61'),_0xe9e5('0x62'),'status',_0xe9e5('0x63'),_0xe9e5('0x64'),_0xe9e5('0x65'),_0xe9e5('0x66'),_0xe9e5('0x64'),'company'];_[_0xe9e5('0x67')](_0x3b89b2,function(_0x500f14){return _0x59c87e[_0xe9e5('0x68')](_0x500f14[_0xe9e5('0x28')])||!_0x500f14[_0xe9e5('0x69')]&&_0x500f14[_0xe9e5('0x2d')]!=='custom_text'&&_0x500f14[_0xe9e5('0x2d')]!==_0xe9e5('0x6a');});return{'count':_0x3b89b2['length'],'rows':_['map'](_0x3b89b2,function(_0x272f6d){return{'id':_0x272f6d[_0xe9e5('0x28')],'name':_0x272f6d[_0xe9e5('0x6b')],'custom':!_0x272f6d[_0xe9e5('0x69')],'options':_0x272f6d['choices']?_[_0xe9e5('0x2a')](_0x272f6d[_0xe9e5('0x6c')],function(_0x2e8bdf){return{'name':_[_0xe9e5('0x6d')](_0x2e8bdf),'value':_0x2e8bdf};}):[]};})};}})[_0xe9e5('0x24')](respondWithResult(_0x17dcb9,null))[_0xe9e5('0x42')](function(_0x26b885){var _0x58302a=_0x15d799[_0xe9e5('0x2f')]['test']?0x1f4:_0x26b885[_0xe9e5('0x6e')]||0x1f4;logger['error'](_0xe9e5('0x6f'),_0xe9e5('0x54'),_0x58302a,JSON['stringify'](_0x26b885));delete _0x26b885[_0xe9e5('0x28')];if(_0x58302a===0x191){_0x58302a=0x190;}_0x17dcb9[_0xe9e5('0x18')](_0x58302a)[_0xe9e5('0x70')](_0x15d799['query'][_0xe9e5('0x71')]?{'message':_0xe9e5('0x72'),'statusCode':_0x26b885[_0xe9e5('0x6e')]}:_0x26b885);});}; \ No newline at end of file +var _0x938c=['query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','filter','merge','include','findAll','rows','catch','params','includeAll','options','body','find','getConfigurations','FreshdeskConfiguration','sort','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','description','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','keys'];(function(_0x3b0ab9,_0x4185f1){var _0x226c29=function(_0x236629){while(--_0x236629){_0x3b0ab9['push'](_0x3b0ab9['shift']());}};_0x226c29(++_0x4185f1);}(_0x938c,0x11f));var _0xc938=function(_0x348062,_0x45684b){_0x348062=_0x348062-0x0;var _0x2cf0fd=_0x938c[_0x348062];return _0x2cf0fd;};'use strict';var emlformat=require(_0xc938('0x0'));var rimraf=require(_0xc938('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc938('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc938('0x3'));var Mustache=require('mustache');var util=require(_0xc938('0x4'));var path=require(_0xc938('0x5'));var sox=require(_0xc938('0x6'));var csv=require(_0xc938('0x7'));var ejs=require(_0xc938('0x8'));var fs=require('fs');var fs_extra=require(_0xc938('0x9'));var _=require('lodash');var squel=require(_0xc938('0xa'));var crypto=require(_0xc938('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc938('0xc'));var toCsv=require(_0xc938('0x7'));var querystring=require('querystring');var Papa=require(_0xc938('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc938('0xe'));var as=require(_0xc938('0xf'));var hardwareService=require(_0xc938('0x10'));var logger=require('../../config/logger')(_0xc938('0x11'));var utils=require(_0xc938('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc938('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc938('0x14'));function respondWithStatusCode(_0x134bef,_0x3ec5e5){_0x3ec5e5=_0x3ec5e5||0xcc;return function(_0x5f4eca){if(_0x5f4eca){return _0x134bef[_0xc938('0x15')](_0x3ec5e5);}return _0x134bef[_0xc938('0x16')](_0x3ec5e5)[_0xc938('0x17')]();};}function respondWithResult(_0x4d9dab,_0x4bc776){_0x4bc776=_0x4bc776||0xc8;return function(_0x4fd0bf){if(_0x4fd0bf){return _0x4d9dab[_0xc938('0x16')](_0x4bc776)[_0xc938('0x18')](_0x4fd0bf);}};}function respondWithFilteredResult(_0x34e3a7,_0x52a56b){return function(_0x143c42){if(_0x143c42){var _0x4df453=typeof _0x52a56b[_0xc938('0x19')]===_0xc938('0x1a')&&typeof _0x52a56b['limit']===_0xc938('0x1a');var _0x2c1690=_0x143c42['count'];var _0x67e1d8=_0x4df453?0x0:_0x52a56b['offset'];var _0xe23b6b=_0x4df453?_0x143c42[_0xc938('0x1b')]:_0x52a56b[_0xc938('0x19')]+_0x52a56b['limit'];var _0x1d4e2e;if(_0xe23b6b>=_0x2c1690){_0xe23b6b=_0x2c1690;_0x1d4e2e=0xc8;}else{_0x1d4e2e=0xce;}_0x34e3a7[_0xc938('0x16')](_0x1d4e2e);return _0x34e3a7[_0xc938('0x1c')](_0xc938('0x1d'),_0x67e1d8+'-'+_0xe23b6b+'/'+_0x2c1690)[_0xc938('0x18')](_0x143c42);}return null;};}function patchUpdates(_0x474d1b){return function(_0x2dab15){try{jsonpatch[_0xc938('0x1e')](_0x2dab15,_0x474d1b,!![]);}catch(_0x58deae){return BPromise[_0xc938('0x1f')](_0x58deae);}return _0x2dab15[_0xc938('0x20')]();};}function saveUpdates(_0x5858b7,_0xa43304){return function(_0x47e2fe){if(_0x47e2fe){return _0x47e2fe[_0xc938('0x21')](_0x5858b7)['then'](function(_0x196481){return _0x196481;});}return null;};}function removeEntity(_0x388391,_0x20734d){return function(_0x5cd674){if(_0x5cd674){return _0x5cd674[_0xc938('0x22')]()[_0xc938('0x23')](function(){_0x388391['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x219ec4,_0x136f6f){return function(_0x2de7af){if(!_0x2de7af){_0x219ec4[_0xc938('0x15')](0x194);}return _0x2de7af;};}function handleError(_0x21194d,_0x3bcf2b){_0x3bcf2b=_0x3bcf2b||0x1f4;return function(_0xb4364c){logger[_0xc938('0x24')](_0xb4364c[_0xc938('0x25')]);if(_0xb4364c[_0xc938('0x26')]){delete _0xb4364c[_0xc938('0x26')];}_0x21194d[_0xc938('0x16')](_0x3bcf2b)[_0xc938('0x27')](_0xb4364c);};}exports[_0xc938('0x28')]=function(_0x2c8a49,_0x4c5278){var _0xf19e7b={},_0x3765a6={},_0x26ff50={'count':0x0,'rows':[]};var _0x349bb4=_['map'](db[_0xc938('0x29')][_0xc938('0x2a')],function(_0x1bc0a8){return{'name':_0x1bc0a8[_0xc938('0x2b')],'type':_0x1bc0a8[_0xc938('0x2c')][_0xc938('0x2d')]};});_0x3765a6[_0xc938('0x2e')]=_[_0xc938('0x2f')](_0x349bb4,_0xc938('0x26'));_0x3765a6['query']=_[_0xc938('0x30')](_0x2c8a49[_0xc938('0x31')]);_0x3765a6[_0xc938('0x32')]=_[_0xc938('0x33')](_0x3765a6[_0xc938('0x2e')],_0x3765a6[_0xc938('0x31')]);_0xf19e7b[_0xc938('0x34')]=_[_0xc938('0x33')](_0x3765a6[_0xc938('0x2e')],qs[_0xc938('0x35')](_0x2c8a49[_0xc938('0x31')][_0xc938('0x35')]));_0xf19e7b['attributes']=_0xf19e7b[_0xc938('0x34')][_0xc938('0x36')]?_0xf19e7b[_0xc938('0x34')]:_0x3765a6['model'];if(!_0x2c8a49[_0xc938('0x31')][_0xc938('0x37')]('nolimit')){_0xf19e7b[_0xc938('0x38')]=qs['limit'](_0x2c8a49['query'][_0xc938('0x38')]);_0xf19e7b[_0xc938('0x19')]=qs['offset'](_0x2c8a49[_0xc938('0x31')][_0xc938('0x19')]);}_0xf19e7b[_0xc938('0x39')]=qs['sort'](_0x2c8a49[_0xc938('0x31')]['sort']);_0xf19e7b[_0xc938('0x3a')]=qs[_0xc938('0x32')](_['pick'](_0x2c8a49['query'],_0x3765a6['filters']),_0x349bb4);if(_0x2c8a49[_0xc938('0x31')][_0xc938('0x3b')]){_0xf19e7b[_0xc938('0x3a')]=_[_0xc938('0x3c')](_0xf19e7b[_0xc938('0x3a')],{'$or':_[_0xc938('0x2f')](_0x349bb4,function(_0x3a4bd3){if(_0x3a4bd3[_0xc938('0x2c')]!=='VIRTUAL'){var _0x12aa77={};_0x12aa77[_0x3a4bd3[_0xc938('0x26')]]={'$like':'%'+_0x2c8a49[_0xc938('0x31')][_0xc938('0x3b')]+'%'};return _0x12aa77;}})});}_0xf19e7b=_['merge']({},_0xf19e7b,_0x2c8a49['options']);var _0x5683ff={'where':_0xf19e7b[_0xc938('0x3a')]};return db[_0xc938('0x29')][_0xc938('0x1b')](_0x5683ff)[_0xc938('0x23')](function(_0x3d943e){_0x26ff50[_0xc938('0x1b')]=_0x3d943e;if(_0x2c8a49[_0xc938('0x31')]['includeAll']){_0xf19e7b[_0xc938('0x3d')]=[{'all':!![]}];}return db[_0xc938('0x29')][_0xc938('0x3e')](_0xf19e7b);})[_0xc938('0x23')](function(_0x52b214){_0x26ff50[_0xc938('0x3f')]=_0x52b214;return _0x26ff50;})['then'](respondWithFilteredResult(_0x4c5278,_0xf19e7b))[_0xc938('0x40')](handleError(_0x4c5278,null));};exports['show']=function(_0x2a6a62,_0x303360){var _0x3c4667={'raw':![],'where':{'id':_0x2a6a62[_0xc938('0x41')]['id']}},_0x17897e={};_0x17897e[_0xc938('0x2e')]=_[_0xc938('0x30')](db['FreshdeskAccount'][_0xc938('0x2a')]);_0x17897e[_0xc938('0x31')]=_[_0xc938('0x30')](_0x2a6a62[_0xc938('0x31')]);_0x17897e[_0xc938('0x32')]=_[_0xc938('0x33')](_0x17897e[_0xc938('0x2e')],_0x17897e[_0xc938('0x31')]);_0x3c4667[_0xc938('0x34')]=_[_0xc938('0x33')](_0x17897e[_0xc938('0x2e')],qs[_0xc938('0x35')](_0x2a6a62[_0xc938('0x31')]['fields']));_0x3c4667['attributes']=_0x3c4667['attributes']['length']?_0x3c4667[_0xc938('0x34')]:_0x17897e[_0xc938('0x2e')];if(_0x2a6a62[_0xc938('0x31')][_0xc938('0x42')]){_0x3c4667[_0xc938('0x3d')]=[{'all':!![]}];}_0x3c4667=_[_0xc938('0x3c')]({},_0x3c4667,_0x2a6a62[_0xc938('0x43')]);return db[_0xc938('0x29')]['find'](_0x3c4667)['then'](handleEntityNotFound(_0x303360,null))[_0xc938('0x23')](respondWithResult(_0x303360,null))[_0xc938('0x40')](handleError(_0x303360,null));};exports['create']=function(_0x419d6d,_0x2dba29){return db[_0xc938('0x29')]['create'](_0x419d6d[_0xc938('0x44')],{})[_0xc938('0x23')](respondWithResult(_0x2dba29,0xc9))[_0xc938('0x40')](handleError(_0x2dba29,null));};exports[_0xc938('0x21')]=function(_0x390b40,_0x4eb82f){if(_0x390b40['body']['id']){delete _0x390b40[_0xc938('0x44')]['id'];}return db['FreshdeskAccount'][_0xc938('0x45')]({'where':{'id':_0x390b40[_0xc938('0x41')]['id']}})['then'](handleEntityNotFound(_0x4eb82f,null))[_0xc938('0x23')](saveUpdates(_0x390b40[_0xc938('0x44')],null))['then'](respondWithResult(_0x4eb82f,null))[_0xc938('0x40')](handleError(_0x4eb82f,null));};exports[_0xc938('0x22')]=function(_0x4926ba,_0x2fe7fc){return db['FreshdeskAccount'][_0xc938('0x45')]({'where':{'id':_0x4926ba[_0xc938('0x41')]['id']}})['then'](handleEntityNotFound(_0x2fe7fc,null))[_0xc938('0x23')](removeEntity(_0x2fe7fc,null))[_0xc938('0x40')](handleError(_0x2fe7fc,null));};exports[_0xc938('0x46')]=function(_0x17c9e5,_0x1f2223,_0x19419d){var _0x5e5f96={};var _0xcd3111={};var _0xd34391;var _0x28bbfd;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x17c9e5['params']['id']}})[_0xc938('0x23')](handleEntityNotFound(_0x1f2223,null))[_0xc938('0x23')](function(_0x43af75){if(_0x43af75){_0xd34391=_0x43af75;_0xcd3111[_0xc938('0x2e')]=_[_0xc938('0x30')](db[_0xc938('0x47')][_0xc938('0x2a')]);_0xcd3111['query']=_['keys'](_0x17c9e5[_0xc938('0x31')]);_0xcd3111[_0xc938('0x32')]=_[_0xc938('0x33')](_0xcd3111[_0xc938('0x2e')],_0xcd3111[_0xc938('0x31')]);_0x5e5f96[_0xc938('0x34')]=_['intersection'](_0xcd3111['model'],qs[_0xc938('0x35')](_0x17c9e5[_0xc938('0x31')][_0xc938('0x35')]));_0x5e5f96[_0xc938('0x34')]=_0x5e5f96[_0xc938('0x34')][_0xc938('0x36')]?_0x5e5f96[_0xc938('0x34')]:_0xcd3111['model'];_0x5e5f96[_0xc938('0x39')]=qs[_0xc938('0x48')](_0x17c9e5['query'][_0xc938('0x48')]);_0x5e5f96[_0xc938('0x3a')]=qs[_0xc938('0x32')](_[_0xc938('0x49')](_0x17c9e5[_0xc938('0x31')],_0xcd3111['filters']));if(_0x17c9e5[_0xc938('0x31')]['filter']){_0x5e5f96[_0xc938('0x3a')]=_[_0xc938('0x3c')](_0x5e5f96[_0xc938('0x3a')],{'$or':_[_0xc938('0x2f')](_0x5e5f96[_0xc938('0x34')],function(_0x16aaad){var _0xae391c={};_0xae391c[_0x16aaad]={'$like':'%'+_0x17c9e5[_0xc938('0x31')]['filter']+'%'};return _0xae391c;})});}_0x5e5f96=_[_0xc938('0x3c')]({},_0x5e5f96,_0x17c9e5[_0xc938('0x43')]);return _0xd34391[_0xc938('0x46')](_0x5e5f96);}})[_0xc938('0x23')](function(_0x416837){if(_0x416837){_0x28bbfd=_0x416837[_0xc938('0x36')];if(!_0x17c9e5[_0xc938('0x31')][_0xc938('0x37')]('nolimit')){_0x5e5f96[_0xc938('0x38')]=qs[_0xc938('0x38')](_0x17c9e5[_0xc938('0x31')]['limit']);_0x5e5f96[_0xc938('0x19')]=qs[_0xc938('0x19')](_0x17c9e5[_0xc938('0x31')][_0xc938('0x19')]);}return _0xd34391[_0xc938('0x46')](_0x5e5f96);}})[_0xc938('0x23')](function(_0x397a1e){if(_0x397a1e){return _0x397a1e?{'count':_0x28bbfd,'rows':_0x397a1e}:null;}})[_0xc938('0x23')](respondWithResult(_0x1f2223,null))[_0xc938('0x40')](handleError(_0x1f2223,null));};exports[_0xc938('0x4a')]=function(_0x5b37e0,_0x44e70e,_0x565e79){if(_0x5b37e0[_0xc938('0x44')]['id']){delete _0x5b37e0['body']['id'];}return db[_0xc938('0x29')][_0xc938('0x4b')]({'where':{'id':_0x5b37e0['params']['id']}})[_0xc938('0x23')](handleEntityNotFound(_0x44e70e,null))[_0xc938('0x23')](function(_0x15250f){if(_0x15250f){_0x5b37e0[_0xc938('0x44')][_0xc938('0x4c')]=_0x15250f['id'];_0x5b37e0['body'][_0xc938('0x4d')]=integrations[_0xc938('0x4e')](_0x5b37e0[_0xc938('0x44')][_0xc938('0x4f')],_0x5b37e0[_0xc938('0x44')][_0xc938('0x2c')]);_0x5b37e0[_0xc938('0x44')][_0xc938('0x50')]=integrations[_0xc938('0x51')](_0x5b37e0[_0xc938('0x44')][_0xc938('0x4f')],_0x5b37e0[_0xc938('0x44')][_0xc938('0x2c')]);return db[_0xc938('0x47')][_0xc938('0x52')](_0x5b37e0[_0xc938('0x44')],{'include':[{'model':db[_0xc938('0x53')],'as':_0xc938('0x4d')},{'model':db[_0xc938('0x53')],'as':_0xc938('0x50')}]});}return null;})['then'](respondWithResult(_0x44e70e,null))[_0xc938('0x40')](handleError(_0x44e70e,null));};exports[_0xc938('0x54')]=function(_0x59687c,_0x2cee40,_0x4dbc47){var _0x3263b3='';return db['FreshdeskAccount'][_0xc938('0x4b')]({'where':{'id':_0x59687c['params']['id']},'attributes':['id',_0xc938('0x55'),_0xc938('0x56')]})[_0xc938('0x23')](handleEntityNotFound(_0x2cee40,null))[_0xc938('0x23')](function(_0x1bf986){if(_0x1bf986){_0x3263b3=_0x1bf986[_0xc938('0x55')];var _0x339464=_0x3263b3[_0xc938('0x57')](-0x1);if(_0x339464==='/'){_0x3263b3=_0x3263b3[_0xc938('0x58')](0x0,_0x3263b3[_0xc938('0x59')](_0x339464));}return rp({'method':'GET','uri':util[_0xc938('0x5a')]('%s/%s',_0x3263b3,_0xc938('0x5b')),'headers':{'Authorization':util[_0xc938('0x5a')](_0xc938('0x5c'),new Buffer(util[_0xc938('0x5a')](_0xc938('0x5d'),_0x1bf986['apiKey']))[_0xc938('0x5e')]('base64'))},'json':!![]});}})[_0xc938('0x23')](function(_0xdd54dd){if(_0xdd54dd){var _0x6367bc=[_0xc938('0x5f'),'subject','agent',_0xc938('0x60'),_0xc938('0x16'),'priority',_0xc938('0x61'),'source','ticket_type','group',_0xc938('0x62')];_[_0xc938('0x63')](_0xdd54dd,function(_0xba845c){return _0x6367bc[_0xc938('0x64')](_0xba845c['name'])||!_0xba845c[_0xc938('0x65')]&&_0xba845c[_0xc938('0x2c')]!==_0xc938('0x66')&&_0xba845c['type']!==_0xc938('0x67');});return{'count':_0xdd54dd[_0xc938('0x36')],'rows':_[_0xc938('0x2f')](_0xdd54dd,function(_0x122b4d){return{'id':_0x122b4d[_0xc938('0x26')],'name':_0x122b4d[_0xc938('0x68')],'custom':!_0x122b4d['default'],'options':_0x122b4d[_0xc938('0x69')]?_[_0xc938('0x2f')](_0x122b4d['choices'],function(_0x46f35c){return{'name':_[_0xc938('0x6a')](_0x46f35c),'value':_0x46f35c};}):[]};})};}})[_0xc938('0x23')](respondWithResult(_0x2cee40,null))[_0xc938('0x40')](function(_0xbbce34){var _0x541705=_0x59687c['query'][_0xc938('0x6b')]?0x1f4:_0xbbce34['statusCode']||0x1f4;logger[_0xc938('0x24')](_0xc938('0x6c'),_0xc938('0x54'),_0x541705,JSON[_0xc938('0x6d')](_0xbbce34));delete _0xbbce34[_0xc938('0x26')];if(_0x541705===0x191){_0x541705=0x190;}_0x2cee40[_0xc938('0x16')](_0x541705)[_0xc938('0x27')](_0x59687c['query']['test']?{'message':_0xc938('0x6e'),'statusCode':_0xbbce34[_0xc938('0x6f')]}:_0xbbce34);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 86351b9..7bf7b49 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 _0xdddd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x3029ba,_0x5d7fa8){var _0x3c8b50=function(_0x5e8a77){while(--_0x5e8a77){_0x3029ba['push'](_0x3029ba['shift']());}};_0x3c8b50(++_0x5d7fa8);}(_0xdddd,0x177));var _0xdddd=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0xdddd[_0x439d59];return _0x3670c7;};'use strict';var _=require(_0xdddd('0x0'));var util=require(_0xdddd('0x1'));var logger=require(_0xdddd('0x2'))('api');var moment=require(_0xdddd('0x3'));var BPromise=require(_0xdddd('0x4'));var rp=require(_0xdddd('0x5'));var fs=require('fs');var path=require(_0xdddd('0x6'));var rimraf=require(_0xdddd('0x7'));var config=require(_0xdddd('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xdddd('0x9'));module[_0xdddd('0xa')]=function(_0xf465ed,_0x3d8483){return _0xf465ed[_0xdddd('0xb')](_0xdddd('0xc'),attributes,{'tableName':_0xdddd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c4c=['path','./intFreshdeskAccount.attributes','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x42a842,_0x1eb672){var _0x1676bb=function(_0xf75015){while(--_0xf75015){_0x42a842['push'](_0x42a842['shift']());}};_0x1676bb(++_0x1eb672);}(_0x4c4c,0x108));var _0xc4c4=function(_0x3e7092,_0x141979){_0x3e7092=_0x3e7092-0x0;var _0x27d67e=_0x4c4c[_0x3e7092];return _0x27d67e;};'use strict';var _=require(_0xc4c4('0x0'));var util=require(_0xc4c4('0x1'));var logger=require(_0xc4c4('0x2'))(_0xc4c4('0x3'));var moment=require(_0xc4c4('0x4'));var BPromise=require(_0xc4c4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4c4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc4c4('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x24ef8f,_0x3a5771){return _0x24ef8f['define'](_0xc4c4('0x8'),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 c7e535f..35a1a6d 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 _0x585e=['request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','raw','lodash','util','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x54c4cd,_0x450327){var _0x2ce949=function(_0x4bd2db){while(--_0x4bd2db){_0x54c4cd['push'](_0x54c4cd['shift']());}};_0x2ce949(++_0x450327);}(_0x585e,0x151));var _0xe585=function(_0x484b19,_0x303d12){_0x484b19=_0x484b19-0x0;var _0x4a473c=_0x585e[_0x484b19];return _0x4a473c;};'use strict';var _=require(_0xe585('0x0'));var util=require(_0xe585('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe585('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe585('0x3'));var logger=require(_0xe585('0x4'))('rpc');var config=require(_0xe585('0x5'));var jayson=require(_0xe585('0x6'));var client=jayson[_0xe585('0x7')][_0xe585('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x369e18,_0x31bab7,_0x2f5553){return new BPromise(function(_0x13b44f,_0x269b6c){return client[_0xe585('0x9')](_0x369e18,_0x2f5553)[_0xe585('0xa')](function(_0x4f59a7){logger[_0xe585('0xb')](_0xe585('0xc'),_0x31bab7,_0xe585('0xd'));logger[_0xe585('0xe')](_0xe585('0xf'),_0x31bab7,'request\x20sent',JSON[_0xe585('0x10')](_0x4f59a7));if(_0x4f59a7['error']){if(_0x4f59a7[_0xe585('0x11')][_0xe585('0x12')]===0x1f4){logger[_0xe585('0x11')](_0xe585('0xc'),_0x31bab7,_0x4f59a7[_0xe585('0x11')][_0xe585('0x13')]);return _0x269b6c(_0x4f59a7[_0xe585('0x11')][_0xe585('0x13')]);}logger[_0xe585('0x11')](_0xe585('0xc'),_0x31bab7,_0x4f59a7[_0xe585('0x11')][_0xe585('0x13')]);return _0x13b44f(_0x4f59a7[_0xe585('0x11')]['message']);}else{logger[_0xe585('0xb')](_0xe585('0xc'),_0x31bab7,_0xe585('0xd'));_0x13b44f(_0x4f59a7[_0xe585('0x14')][_0xe585('0x13')]);}})[_0xe585('0x15')](function(_0x2cee65){logger[_0xe585('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x31bab7,_0x2cee65);_0x269b6c(_0x2cee65);});});}exports[_0xe585('0x16')]=function(_0xbf1eb1){var _0xe39477=this;return new Promise(function(_0x210272,_0x204f7b){return db[_0xe585('0x17')][_0xe585('0x18')]({'raw':_0xbf1eb1['options']?_0xbf1eb1[_0xe585('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xbf1eb1[_0xe585('0x19')]?_0xbf1eb1[_0xe585('0x19')][_0xe585('0x1a')]||null:null,'attributes':_0xbf1eb1[_0xe585('0x19')]?_0xbf1eb1['options'][_0xe585('0x1b')]||null:null,'limit':_0xbf1eb1[_0xe585('0x19')]?_0xbf1eb1[_0xe585('0x19')][_0xe585('0x1c')]||null:null,'include':_0xbf1eb1[_0xe585('0x19')]?_0xbf1eb1[_0xe585('0x19')][_0xe585('0x1d')]?_[_0xe585('0x1e')](_0xbf1eb1['options'][_0xe585('0x1d')],function(_0x5332ac){return{'model':db[_0x5332ac[_0xe585('0x1f')]],'as':_0x5332ac['as'],'attributes':_0x5332ac['attributes'],'include':_0x5332ac['include']?_[_0xe585('0x1e')](_0x5332ac[_0xe585('0x1d')],function(_0x560bab){return{'model':db[_0x560bab[_0xe585('0x1f')]],'as':_0x560bab['as'],'attributes':_0x560bab[_0xe585('0x1b')],'include':_0x560bab['include']?_[_0xe585('0x1e')](_0x560bab[_0xe585('0x1d')],function(_0x45e766){return{'model':db[_0x45e766[_0xe585('0x1f')]],'as':_0x45e766['as'],'attributes':_0x45e766[_0xe585('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe585('0xa')](function(_0x1e796a){logger[_0xe585('0xb')](_0xe585('0x16'),_0xbf1eb1);logger['debug'](_0xe585('0x16'),_0xbf1eb1,JSON['stringify'](_0x1e796a));_0x210272(_0x1e796a);})['catch'](function(_0x256afa){logger[_0xe585('0x11')]('GetFreshdeskAccount',_0x256afa[_0xe585('0x13')],_0xbf1eb1);_0x204f7b(_0xe39477[_0xe585('0x11')](0x1f4,_0x256afa['message']));});});};exports[_0xe585('0x20')]=function(_0xe755e0){var _0x10fbf9=this;return new Promise(function(_0x30d0a5,_0x3ea6e4){return db['FreshdeskAccount'][_0xe585('0x21')]({'raw':_0xe755e0[_0xe585('0x19')]?_0xe755e0[_0xe585('0x19')][_0xe585('0x22')]===undefined?!![]:![]:!![],'where':_0xe755e0['options']?_0xe755e0['options'][_0xe585('0x1a')]||null:null,'attributes':_0xe755e0['options']?_0xe755e0['options'][_0xe585('0x1b')]||null:null,'include':_0xe755e0[_0xe585('0x19')]?_0xe755e0[_0xe585('0x19')][_0xe585('0x1d')]?_[_0xe585('0x1e')](_0xe755e0[_0xe585('0x19')]['include'],function(_0x943944){return{'model':db[_0x943944['model']],'as':_0x943944['as'],'attributes':_0x943944[_0xe585('0x1b')],'include':_0x943944['include']?_[_0xe585('0x1e')](_0x943944['include'],function(_0x33c6bd){return{'model':db[_0x33c6bd[_0xe585('0x1f')]],'as':_0x33c6bd['as'],'attributes':_0x33c6bd['attributes'],'include':_0x33c6bd[_0xe585('0x1d')]?_['map'](_0x33c6bd['include'],function(_0x31687c){return{'model':db[_0x31687c[_0xe585('0x1f')]],'as':_0x31687c['as'],'attributes':_0x31687c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe585('0xa')](function(_0x1a18e6){logger[_0xe585('0xb')](_0xe585('0x20'),_0xe755e0);logger[_0xe585('0xe')]('ShowFreshdeskAccount',_0xe755e0,JSON['stringify'](_0x1a18e6));_0x30d0a5(_0x1a18e6);})['catch'](function(_0x530660){logger[_0xe585('0x11')]('ShowFreshdeskAccount',_0x530660[_0xe585('0x13')],_0xe755e0);_0x3ea6e4(_0x10fbf9[_0xe585('0x11')](0x1f4,_0x530660[_0xe585('0x13')]));});});}; \ No newline at end of file +var _0xd77a=['info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','FreshdeskAccount','options','where','attributes','limit','include','map','model','GetFreshdeskAccount','catch','ShowFreshdeskAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then'];(function(_0x14ee69,_0x436a8a){var _0x4d5664=function(_0x3e69bc){while(--_0x3e69bc){_0x14ee69['push'](_0x14ee69['shift']());}};_0x4d5664(++_0x436a8a);}(_0xd77a,0x104));var _0xad77=function(_0x488066,_0x518094){_0x488066=_0x488066-0x0;var _0x4ba9a6=_0xd77a[_0x488066];return _0x4ba9a6;};'use strict';var _=require(_0xad77('0x0'));var util=require(_0xad77('0x1'));var moment=require(_0xad77('0x2'));var BPromise=require(_0xad77('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad77('0x4'));var db=require(_0xad77('0x5'))['db'];var utils=require(_0xad77('0x6'));var logger=require(_0xad77('0x7'))('rpc');var config=require(_0xad77('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xad77('0x9')][_0xad77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56ac6a,_0x59ef41,_0x26afe8){return new BPromise(function(_0x31b622,_0x596b8c){return client['request'](_0x56ac6a,_0x26afe8)[_0xad77('0xb')](function(_0x4d2825){logger[_0xad77('0xc')](_0xad77('0xd'),_0x59ef41,_0xad77('0xe'));logger[_0xad77('0xf')](_0xad77('0x10'),_0x59ef41,_0xad77('0xe'),JSON[_0xad77('0x11')](_0x4d2825));if(_0x4d2825['error']){if(_0x4d2825['error']['code']===0x1f4){logger[_0xad77('0x12')](_0xad77('0xd'),_0x59ef41,_0x4d2825[_0xad77('0x12')][_0xad77('0x13')]);return _0x596b8c(_0x4d2825[_0xad77('0x12')][_0xad77('0x13')]);}logger[_0xad77('0x12')](_0xad77('0xd'),_0x59ef41,_0x4d2825[_0xad77('0x12')][_0xad77('0x13')]);return _0x31b622(_0x4d2825['error'][_0xad77('0x13')]);}else{logger[_0xad77('0xc')](_0xad77('0xd'),_0x59ef41,_0xad77('0xe'));_0x31b622(_0x4d2825[_0xad77('0x14')][_0xad77('0x13')]);}})['catch'](function(_0x3c9f44){logger[_0xad77('0x12')](_0xad77('0xd'),_0x59ef41,_0x3c9f44);_0x596b8c(_0x3c9f44);});});}exports['GetFreshdeskAccount']=function(_0x237eef){var _0x12983e=this;return new Promise(function(_0x2c5550,_0x2e762d){return db[_0xad77('0x15')]['findAll']({'raw':_0x237eef['options']?_0x237eef[_0xad77('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x237eef[_0xad77('0x16')]?_0x237eef[_0xad77('0x16')][_0xad77('0x17')]||null:null,'attributes':_0x237eef['options']?_0x237eef[_0xad77('0x16')][_0xad77('0x18')]||null:null,'limit':_0x237eef[_0xad77('0x16')]?_0x237eef[_0xad77('0x16')][_0xad77('0x19')]||null:null,'include':_0x237eef['options']?_0x237eef[_0xad77('0x16')][_0xad77('0x1a')]?_[_0xad77('0x1b')](_0x237eef[_0xad77('0x16')][_0xad77('0x1a')],function(_0x335f53){return{'model':db[_0x335f53['model']],'as':_0x335f53['as'],'attributes':_0x335f53[_0xad77('0x18')],'include':_0x335f53[_0xad77('0x1a')]?_['map'](_0x335f53[_0xad77('0x1a')],function(_0x52a38e){return{'model':db[_0x52a38e[_0xad77('0x1c')]],'as':_0x52a38e['as'],'attributes':_0x52a38e[_0xad77('0x18')],'include':_0x52a38e[_0xad77('0x1a')]?_[_0xad77('0x1b')](_0x52a38e[_0xad77('0x1a')],function(_0x2a2cb2){return{'model':db[_0x2a2cb2['model']],'as':_0x2a2cb2['as'],'attributes':_0x2a2cb2[_0xad77('0x18')]};}):[]};}):[]};}):[]:[]})[_0xad77('0xb')](function(_0x7e670d){logger[_0xad77('0xc')](_0xad77('0x1d'),_0x237eef);logger['debug'](_0xad77('0x1d'),_0x237eef,JSON[_0xad77('0x11')](_0x7e670d));_0x2c5550(_0x7e670d);})[_0xad77('0x1e')](function(_0x951de2){logger[_0xad77('0x12')]('GetFreshdeskAccount',_0x951de2['message'],_0x237eef);_0x2e762d(_0x12983e['error'](0x1f4,_0x951de2[_0xad77('0x13')]));});});};exports[_0xad77('0x1f')]=function(_0x42629b){var _0x498f7f=this;return new Promise(function(_0x2b78e3,_0x2426f7){return db['FreshdeskAccount'][_0xad77('0x20')]({'raw':_0x42629b[_0xad77('0x16')]?_0x42629b['options'][_0xad77('0x21')]===undefined?!![]:![]:!![],'where':_0x42629b[_0xad77('0x16')]?_0x42629b['options'][_0xad77('0x17')]||null:null,'attributes':_0x42629b[_0xad77('0x16')]?_0x42629b[_0xad77('0x16')][_0xad77('0x18')]||null:null,'include':_0x42629b[_0xad77('0x16')]?_0x42629b['options'][_0xad77('0x1a')]?_[_0xad77('0x1b')](_0x42629b[_0xad77('0x16')][_0xad77('0x1a')],function(_0x36faff){return{'model':db[_0x36faff[_0xad77('0x1c')]],'as':_0x36faff['as'],'attributes':_0x36faff[_0xad77('0x18')],'include':_0x36faff[_0xad77('0x1a')]?_['map'](_0x36faff[_0xad77('0x1a')],function(_0x25d227){return{'model':db[_0x25d227['model']],'as':_0x25d227['as'],'attributes':_0x25d227[_0xad77('0x18')],'include':_0x25d227[_0xad77('0x1a')]?_[_0xad77('0x1b')](_0x25d227[_0xad77('0x1a')],function(_0x30b867){return{'model':db[_0x30b867['model']],'as':_0x30b867['as'],'attributes':_0x30b867[_0xad77('0x18')]};}):[]};}):[]};}):[]:[]})[_0xad77('0xb')](function(_0x466cae){logger[_0xad77('0xc')](_0xad77('0x1f'),_0x42629b);logger[_0xad77('0xf')](_0xad77('0x1f'),_0x42629b,JSON[_0xad77('0x11')](_0x466cae));_0x2b78e3(_0x466cae);})['catch'](function(_0x1f60b4){logger[_0xad77('0x12')](_0xad77('0x1f'),_0x1f60b4[_0xad77('0x13')],_0x42629b);_0x2426f7(_0x498f7f[_0xad77('0x12')](0x1f4,_0x1f60b4[_0xad77('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 94b40b6..d6a975b 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 _0xb17f=['../../config/environment','get','isAuthenticated','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb17f,0x169));var _0xfb17=function(_0x374bc9,_0x4111df){_0x374bc9=_0x374bc9-0x0;var _0x18d5d6=_0xb17f[_0x374bc9];return _0x18d5d6;};'use strict';var multer=require(_0xfb17('0x0'));var util=require(_0xfb17('0x1'));var path=require(_0xfb17('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb17('0x3'));var router=express['Router']();var fs_extra=require(_0xfb17('0x4'));var auth=require(_0xfb17('0x5'));var interaction=require(_0xfb17('0x6'));var config=require(_0xfb17('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xfb17('0x8')]('/',auth[_0xfb17('0x9')](),controller['index']);router[_0xfb17('0x8')](_0xfb17('0xa'),auth[_0xfb17('0x9')](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xfb17('0xb')]);router[_0xfb17('0x8')](_0xfb17('0xc'),auth['isAuthenticated'](),controller[_0xfb17('0xd')]);router[_0xfb17('0x8')](_0xfb17('0xe'),auth[_0xfb17('0x9')](),controller['getDescriptions']);router['get'](_0xfb17('0xf'),auth[_0xfb17('0x9')](),controller[_0xfb17('0x10')]);router[_0xfb17('0x11')]('/',auth[_0xfb17('0x9')](),controller[_0xfb17('0x12')]);router[_0xfb17('0x11')](_0xfb17('0xf'),auth[_0xfb17('0x9')](),controller[_0xfb17('0x13')]);router[_0xfb17('0x14')](_0xfb17('0xa'),auth[_0xfb17('0x9')](),controller[_0xfb17('0x15')]);router['delete'](_0xfb17('0xa'),auth[_0xfb17('0x9')](),controller[_0xfb17('0x16')]);module['exports']=router; \ No newline at end of file +var _0x26d9=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','delete','destroy','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26d9,0x176));var _0x926d=function(_0x4322d3,_0x1d1966){_0x4322d3=_0x4322d3-0x0;var _0x48b097=_0x26d9[_0x4322d3];return _0x48b097;};'use strict';var multer=require(_0x926d('0x0'));var util=require('util');var path=require(_0x926d('0x1'));var timeout=require('connect-timeout');var express=require(_0x926d('0x2'));var router=express['Router']();var fs_extra=require(_0x926d('0x3'));var auth=require(_0x926d('0x4'));var interaction=require(_0x926d('0x5'));var config=require(_0x926d('0x6'));var controller=require(_0x926d('0x7'));router['get']('/',auth[_0x926d('0x8')](),controller[_0x926d('0x9')]);router[_0x926d('0xa')]('/:id',auth[_0x926d('0x8')](),controller[_0x926d('0xb')]);router['get'](_0x926d('0xc'),auth[_0x926d('0x8')](),controller[_0x926d('0xd')]);router[_0x926d('0xa')](_0x926d('0xe'),auth['isAuthenticated'](),controller[_0x926d('0xf')]);router[_0x926d('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x926d('0x10')]);router[_0x926d('0xa')](_0x926d('0x11'),auth[_0x926d('0x8')](),controller[_0x926d('0x12')]);router[_0x926d('0x13')]('/',auth[_0x926d('0x8')](),controller['create']);router[_0x926d('0x13')](_0x926d('0x11'),auth[_0x926d('0x8')](),controller[_0x926d('0x14')]);router[_0x926d('0x15')](_0x926d('0x16'),auth[_0x926d('0x8')](),controller['update']);router[_0x926d('0x17')](_0x926d('0x16'),auth[_0x926d('0x8')](),controller[_0x926d('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 86dff03..50115da 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 _0xf399=['sequelize','exports','STRING'];(function(_0x2ce4ce,_0x105f8b){var _0x1222ae=function(_0xf4766a){while(--_0xf4766a){_0x2ce4ce['push'](_0x2ce4ce['shift']());}};_0x1222ae(++_0x105f8b);}(_0xf399,0x114));var _0x9f39=function(_0xcff927,_0x1c6126){_0xcff927=_0xcff927-0x0;var _0x2cfe9d=_0xf399[_0xcff927];return _0x2cfe9d;};'use strict';var Sequelize=require(_0x9f39('0x0'));module[_0x9f39('0x1')]={'name':{'type':Sequelize[_0x9f39('0x2')]},'description':{'type':Sequelize[_0x9f39('0x2')]}}; \ No newline at end of file +var _0xea2a=['exports','STRING','sequelize'];(function(_0x55e4f8,_0x292de5){var _0x1f2a5d=function(_0x23b029){while(--_0x23b029){_0x55e4f8['push'](_0x55e4f8['shift']());}};_0x1f2a5d(++_0x292de5);}(_0xea2a,0x1ca));var _0xaea2=function(_0x66a60e,_0x34b813){_0x66a60e=_0x66a60e-0x0;var _0x54f2d8=_0xea2a[_0x66a60e];return _0x54f2d8;};'use strict';var Sequelize=require(_0xaea2('0x0'));module[_0xaea2('0x1')]={'name':{'type':Sequelize[_0xaea2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a02950b..2d2510b 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 _0xff97=['crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','catch','length','includeAll','include','find','create','body','params','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash'];(function(_0xe16547,_0x3a3b5f){var _0x5a56d4=function(_0x1e4669){while(--_0x1e4669){_0xe16547['push'](_0xe16547['shift']());}};_0x5a56d4(++_0x3a3b5f);}(_0xff97,0x1d5));var _0x7ff9=function(_0x595c09,_0x2ddd12){_0x595c09=_0x595c09-0x0;var _0x9c4d65=_0xff97[_0x595c09];return _0x9c4d65;};'use strict';var emlformat=require(_0x7ff9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7ff9('0x1'));var rp=require(_0x7ff9('0x2'));var moment=require(_0x7ff9('0x3'));var BPromise=require(_0x7ff9('0x4'));var Mustache=require(_0x7ff9('0x5'));var util=require(_0x7ff9('0x6'));var path=require('path');var sox=require(_0x7ff9('0x7'));var csv=require('to-csv');var ejs=require(_0x7ff9('0x8'));var fs=require('fs');var fs_extra=require(_0x7ff9('0x9'));var _=require(_0x7ff9('0xa'));var squel=require('squel');var crypto=require(_0x7ff9('0xb'));var jsforce=require(_0x7ff9('0xc'));var deskjs=require(_0x7ff9('0xd'));var toCsv=require(_0x7ff9('0xe'));var querystring=require('querystring');var Papa=require(_0x7ff9('0xf'));var Redis=require('ioredis');var authService=require(_0x7ff9('0x10'));var qs=require(_0x7ff9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ff9('0x12'));var logger=require(_0x7ff9('0x13'))(_0x7ff9('0x14'));var utils=require('../../config/utils');var config=require(_0x7ff9('0x15'));var licenseUtil=require(_0x7ff9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fd133,_0x28eb60){_0x28eb60=_0x28eb60||0xcc;return function(_0x3602be){if(_0x3602be){return _0x1fd133[_0x7ff9('0x17')](_0x28eb60);}return _0x1fd133[_0x7ff9('0x18')](_0x28eb60)[_0x7ff9('0x19')]();};}function respondWithResult(_0x198f0f,_0x443778){_0x443778=_0x443778||0xc8;return function(_0x38601d){if(_0x38601d){return _0x198f0f[_0x7ff9('0x18')](_0x443778)[_0x7ff9('0x1a')](_0x38601d);}};}function respondWithFilteredResult(_0x380b1a,_0x344617){return function(_0x583ad8){if(_0x583ad8){var _0x5d37a1=typeof _0x344617[_0x7ff9('0x1b')]===_0x7ff9('0x1c')&&typeof _0x344617[_0x7ff9('0x1d')]==='undefined';var _0x235d5a=_0x583ad8[_0x7ff9('0x1e')];var _0x1bd2f4=_0x5d37a1?0x0:_0x344617[_0x7ff9('0x1b')];var _0x590a06=_0x5d37a1?_0x583ad8[_0x7ff9('0x1e')]:_0x344617['offset']+_0x344617[_0x7ff9('0x1d')];var _0x1d47b2;if(_0x590a06>=_0x235d5a){_0x590a06=_0x235d5a;_0x1d47b2=0xc8;}else{_0x1d47b2=0xce;}_0x380b1a[_0x7ff9('0x18')](_0x1d47b2);return _0x380b1a[_0x7ff9('0x1f')](_0x7ff9('0x20'),_0x1bd2f4+'-'+_0x590a06+'/'+_0x235d5a)[_0x7ff9('0x1a')](_0x583ad8);}return null;};}function patchUpdates(_0x4f50d3){return function(_0x49a236){try{jsonpatch['apply'](_0x49a236,_0x4f50d3,!![]);}catch(_0x3d3f7e){return BPromise['reject'](_0x3d3f7e);}return _0x49a236[_0x7ff9('0x21')]();};}function saveUpdates(_0x54dcc8,_0xcaa15d){return function(_0x1895c7){if(_0x1895c7){return _0x1895c7['update'](_0x54dcc8)[_0x7ff9('0x22')](function(_0x4a4193){return _0x4a4193;});}return null;};}function removeEntity(_0x3a3649,_0x4ed5e6){return function(_0x20026b){if(_0x20026b){return _0x20026b[_0x7ff9('0x23')]()[_0x7ff9('0x22')](function(){_0x3a3649[_0x7ff9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f4192,_0x5431fc){return function(_0x2725de){if(!_0x2725de){_0x3f4192['sendStatus'](0x194);}return _0x2725de;};}function handleError(_0x2bc895,_0x3ba300){_0x3ba300=_0x3ba300||0x1f4;return function(_0x4b0d8f){logger[_0x7ff9('0x24')](_0x4b0d8f[_0x7ff9('0x25')]);if(_0x4b0d8f[_0x7ff9('0x26')]){delete _0x4b0d8f['name'];}_0x2bc895['status'](_0x3ba300)[_0x7ff9('0x27')](_0x4b0d8f);};}exports['index']=function(_0x210c01,_0x20ea39){var _0x46781a={},_0x1263d4={},_0x7daa7={'count':0x0,'rows':[]};var _0x314423=_[_0x7ff9('0x28')](db[_0x7ff9('0x29')][_0x7ff9('0x2a')],function(_0x2ca7a4){return{'name':_0x2ca7a4[_0x7ff9('0x2b')],'type':_0x2ca7a4[_0x7ff9('0x2c')][_0x7ff9('0x2d')]};});_0x1263d4['model']=_[_0x7ff9('0x28')](_0x314423,_0x7ff9('0x26'));_0x1263d4['query']=_[_0x7ff9('0x2e')](_0x210c01[_0x7ff9('0x2f')]);_0x1263d4[_0x7ff9('0x30')]=_[_0x7ff9('0x31')](_0x1263d4[_0x7ff9('0x32')],_0x1263d4[_0x7ff9('0x2f')]);_0x46781a[_0x7ff9('0x33')]=_['intersection'](_0x1263d4[_0x7ff9('0x32')],qs['fields'](_0x210c01[_0x7ff9('0x2f')][_0x7ff9('0x34')]));_0x46781a[_0x7ff9('0x33')]=_0x46781a[_0x7ff9('0x33')]['length']?_0x46781a[_0x7ff9('0x33')]:_0x1263d4[_0x7ff9('0x32')];if(!_0x210c01[_0x7ff9('0x2f')][_0x7ff9('0x35')](_0x7ff9('0x36'))){_0x46781a[_0x7ff9('0x1d')]=qs['limit'](_0x210c01[_0x7ff9('0x2f')]['limit']);_0x46781a[_0x7ff9('0x1b')]=qs[_0x7ff9('0x1b')](_0x210c01[_0x7ff9('0x2f')][_0x7ff9('0x1b')]);}_0x46781a[_0x7ff9('0x37')]=qs[_0x7ff9('0x38')](_0x210c01[_0x7ff9('0x2f')][_0x7ff9('0x38')]);_0x46781a['where']=qs['filters'](_[_0x7ff9('0x39')](_0x210c01[_0x7ff9('0x2f')],_0x1263d4[_0x7ff9('0x30')]),_0x314423);if(_0x210c01['query'][_0x7ff9('0x3a')]){_0x46781a[_0x7ff9('0x3b')]=_['merge'](_0x46781a[_0x7ff9('0x3b')],{'$or':_[_0x7ff9('0x28')](_0x314423,function(_0x2e49ae){if(_0x2e49ae[_0x7ff9('0x2c')]!==_0x7ff9('0x3c')){var _0x38cf06={};_0x38cf06[_0x2e49ae[_0x7ff9('0x26')]]={'$like':'%'+_0x210c01[_0x7ff9('0x2f')]['filter']+'%'};return _0x38cf06;}})});}_0x46781a=_[_0x7ff9('0x3d')]({},_0x46781a,_0x210c01[_0x7ff9('0x3e')]);var _0x3a9988={'where':_0x46781a[_0x7ff9('0x3b')]};return db[_0x7ff9('0x29')][_0x7ff9('0x1e')](_0x3a9988)[_0x7ff9('0x22')](function(_0x4ea2a5){_0x7daa7[_0x7ff9('0x1e')]=_0x4ea2a5;if(_0x210c01[_0x7ff9('0x2f')]['includeAll']){_0x46781a['include']=[{'all':!![]}];}return db[_0x7ff9('0x29')]['findAll'](_0x46781a);})[_0x7ff9('0x22')](function(_0x462f16){_0x7daa7['rows']=_0x462f16;return _0x7daa7;})[_0x7ff9('0x22')](respondWithFilteredResult(_0x20ea39,_0x46781a))[_0x7ff9('0x3f')](handleError(_0x20ea39,null));};exports['show']=function(_0x3bb3da,_0x1c6796){var _0x12682d={'raw':![],'where':{'id':_0x3bb3da['params']['id']}},_0x22638a={};_0x22638a['model']=_[_0x7ff9('0x2e')](db[_0x7ff9('0x29')][_0x7ff9('0x2a')]);_0x22638a[_0x7ff9('0x2f')]=_[_0x7ff9('0x2e')](_0x3bb3da[_0x7ff9('0x2f')]);_0x22638a[_0x7ff9('0x30')]=_[_0x7ff9('0x31')](_0x22638a[_0x7ff9('0x32')],_0x22638a[_0x7ff9('0x2f')]);_0x12682d[_0x7ff9('0x33')]=_[_0x7ff9('0x31')](_0x22638a[_0x7ff9('0x32')],qs[_0x7ff9('0x34')](_0x3bb3da['query'][_0x7ff9('0x34')]));_0x12682d[_0x7ff9('0x33')]=_0x12682d['attributes'][_0x7ff9('0x40')]?_0x12682d['attributes']:_0x22638a[_0x7ff9('0x32')];if(_0x3bb3da[_0x7ff9('0x2f')][_0x7ff9('0x41')]){_0x12682d[_0x7ff9('0x42')]=[{'all':!![]}];}_0x12682d=_['merge']({},_0x12682d,_0x3bb3da[_0x7ff9('0x3e')]);return db['FreshdeskConfiguration'][_0x7ff9('0x43')](_0x12682d)[_0x7ff9('0x22')](handleEntityNotFound(_0x1c6796,null))[_0x7ff9('0x22')](respondWithResult(_0x1c6796,null))[_0x7ff9('0x3f')](handleError(_0x1c6796,null));};exports[_0x7ff9('0x44')]=function(_0x391553,_0x5d53cd){return db['FreshdeskConfiguration'][_0x7ff9('0x44')](_0x391553[_0x7ff9('0x45')],{})[_0x7ff9('0x22')](respondWithResult(_0x5d53cd,0xc9))[_0x7ff9('0x3f')](handleError(_0x5d53cd,null));};exports['update']=function(_0x4d0653,_0x1ccdbb){if(_0x4d0653[_0x7ff9('0x45')]['id']){delete _0x4d0653[_0x7ff9('0x45')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x4d0653[_0x7ff9('0x46')]['id']}})[_0x7ff9('0x22')](handleEntityNotFound(_0x1ccdbb,null))[_0x7ff9('0x22')](saveUpdates(_0x4d0653[_0x7ff9('0x45')],null))[_0x7ff9('0x22')](respondWithResult(_0x1ccdbb,null))[_0x7ff9('0x3f')](handleError(_0x1ccdbb,null));};exports['destroy']=function(_0x354cb9,_0x4c0191){return db[_0x7ff9('0x29')][_0x7ff9('0x43')]({'where':{'id':_0x354cb9['params']['id']}})[_0x7ff9('0x22')](handleEntityNotFound(_0x4c0191,null))[_0x7ff9('0x22')](removeEntity(_0x4c0191,null))[_0x7ff9('0x3f')](handleError(_0x4c0191,null));};exports['getFields']=function(_0x3fa56e,_0x328c86,_0x5cedd8){var _0xaba2ca={};var _0x5dad13={};var _0x13b9ee;var _0x518417;return db[_0x7ff9('0x29')][_0x7ff9('0x47')]({'where':{'id':_0x3fa56e[_0x7ff9('0x46')]['id']}})[_0x7ff9('0x22')](handleEntityNotFound(_0x328c86,null))['then'](function(_0x3dcaac){if(_0x3dcaac){_0x13b9ee=_0x3dcaac;_0x5dad13[_0x7ff9('0x32')]=_[_0x7ff9('0x2e')](db[_0x7ff9('0x48')][_0x7ff9('0x2a')]);_0x5dad13[_0x7ff9('0x2f')]=_['keys'](_0x3fa56e[_0x7ff9('0x2f')]);_0x5dad13[_0x7ff9('0x30')]=_[_0x7ff9('0x31')](_0x5dad13[_0x7ff9('0x32')],_0x5dad13[_0x7ff9('0x2f')]);_0xaba2ca[_0x7ff9('0x33')]=_['intersection'](_0x5dad13[_0x7ff9('0x32')],qs[_0x7ff9('0x34')](_0x3fa56e[_0x7ff9('0x2f')][_0x7ff9('0x34')]));_0xaba2ca[_0x7ff9('0x33')]=_0xaba2ca[_0x7ff9('0x33')][_0x7ff9('0x40')]?_0xaba2ca[_0x7ff9('0x33')]:_0x5dad13[_0x7ff9('0x32')];_0xaba2ca[_0x7ff9('0x37')]=qs['sort'](_0x3fa56e[_0x7ff9('0x2f')]['sort']);_0xaba2ca['where']=qs[_0x7ff9('0x30')](_[_0x7ff9('0x39')](_0x3fa56e[_0x7ff9('0x2f')],_0x5dad13[_0x7ff9('0x30')]));if(_0x3fa56e['query'][_0x7ff9('0x3a')]){_0xaba2ca[_0x7ff9('0x3b')]=_[_0x7ff9('0x3d')](_0xaba2ca['where'],{'$or':_[_0x7ff9('0x28')](_0xaba2ca['attributes'],function(_0x187a59){var _0x527785={};_0x527785[_0x187a59]={'$like':'%'+_0x3fa56e[_0x7ff9('0x2f')][_0x7ff9('0x3a')]+'%'};return _0x527785;})});}_0xaba2ca=_[_0x7ff9('0x3d')]({},_0xaba2ca,_0x3fa56e[_0x7ff9('0x3e')]);return _0x13b9ee['getFields'](_0xaba2ca);}})[_0x7ff9('0x22')](function(_0x47f2af){if(_0x47f2af){_0x518417=_0x47f2af[_0x7ff9('0x40')];if(!_0x3fa56e[_0x7ff9('0x2f')]['hasOwnProperty'](_0x7ff9('0x36'))){_0xaba2ca[_0x7ff9('0x1d')]=qs['limit'](_0x3fa56e[_0x7ff9('0x2f')][_0x7ff9('0x1d')]);_0xaba2ca[_0x7ff9('0x1b')]=qs[_0x7ff9('0x1b')](_0x3fa56e[_0x7ff9('0x2f')][_0x7ff9('0x1b')]);}return _0x13b9ee[_0x7ff9('0x49')](_0xaba2ca);}})[_0x7ff9('0x22')](function(_0x9ec9fd){if(_0x9ec9fd){return _0x9ec9fd?{'count':_0x518417,'rows':_0x9ec9fd}:null;}})['then'](respondWithResult(_0x328c86,null))[_0x7ff9('0x3f')](handleError(_0x328c86,null));};exports[_0x7ff9('0x4a')]=function(_0x5b76de,_0x3e6e91,_0x6f571f){var _0x559036={};var _0x42d806={};var _0x278602;var _0x4c0998;return db[_0x7ff9('0x29')][_0x7ff9('0x47')]({'where':{'id':_0x5b76de[_0x7ff9('0x46')]['id']}})[_0x7ff9('0x22')](handleEntityNotFound(_0x3e6e91,null))[_0x7ff9('0x22')](function(_0xe97022){if(_0xe97022){_0x278602=_0xe97022;_0x42d806['model']=_[_0x7ff9('0x2e')](db[_0x7ff9('0x48')]['rawAttributes']);_0x42d806[_0x7ff9('0x2f')]=_[_0x7ff9('0x2e')](_0x5b76de[_0x7ff9('0x2f')]);_0x42d806[_0x7ff9('0x30')]=_[_0x7ff9('0x31')](_0x42d806['model'],_0x42d806[_0x7ff9('0x2f')]);_0x559036[_0x7ff9('0x33')]=_[_0x7ff9('0x31')](_0x42d806[_0x7ff9('0x32')],qs['fields'](_0x5b76de[_0x7ff9('0x2f')]['fields']));_0x559036['attributes']=_0x559036['attributes'][_0x7ff9('0x40')]?_0x559036[_0x7ff9('0x33')]:_0x42d806[_0x7ff9('0x32')];_0x559036[_0x7ff9('0x37')]=qs[_0x7ff9('0x38')](_0x5b76de['query'][_0x7ff9('0x38')]);_0x559036[_0x7ff9('0x3b')]=qs[_0x7ff9('0x30')](_[_0x7ff9('0x39')](_0x5b76de[_0x7ff9('0x2f')],_0x42d806['filters']));if(_0x5b76de['query'][_0x7ff9('0x3a')]){_0x559036['where']=_[_0x7ff9('0x3d')](_0x559036[_0x7ff9('0x3b')],{'$or':_[_0x7ff9('0x28')](_0x559036[_0x7ff9('0x33')],function(_0x7ed052){var _0x8306a0={};_0x8306a0[_0x7ed052]={'$like':'%'+_0x5b76de[_0x7ff9('0x2f')][_0x7ff9('0x3a')]+'%'};return _0x8306a0;})});}_0x559036=_[_0x7ff9('0x3d')]({},_0x559036,_0x5b76de[_0x7ff9('0x3e')]);return _0x278602[_0x7ff9('0x4a')](_0x559036);}})[_0x7ff9('0x22')](function(_0xbb11e1){if(_0xbb11e1){_0x4c0998=_0xbb11e1[_0x7ff9('0x40')];if(!_0x5b76de[_0x7ff9('0x2f')][_0x7ff9('0x35')](_0x7ff9('0x36'))){_0x559036[_0x7ff9('0x1d')]=qs['limit'](_0x5b76de['query'][_0x7ff9('0x1d')]);_0x559036[_0x7ff9('0x1b')]=qs[_0x7ff9('0x1b')](_0x5b76de[_0x7ff9('0x2f')][_0x7ff9('0x1b')]);}return _0x278602[_0x7ff9('0x4a')](_0x559036);}})[_0x7ff9('0x22')](function(_0x3806ef){if(_0x3806ef){return _0x3806ef?{'count':_0x4c0998,'rows':_0x3806ef}:null;}})[_0x7ff9('0x22')](respondWithResult(_0x3e6e91,null))[_0x7ff9('0x3f')](handleError(_0x3e6e91,null));};exports['getDescriptions']=function(_0x582492,_0x2b51d,_0x3232e2){var _0x22fa17={};var _0x5ba38a={};var _0x2319db;var _0x5552a4;return db['FreshdeskConfiguration'][_0x7ff9('0x47')]({'where':{'id':_0x582492[_0x7ff9('0x46')]['id']}})[_0x7ff9('0x22')](handleEntityNotFound(_0x2b51d,null))[_0x7ff9('0x22')](function(_0x3fb950){if(_0x3fb950){_0x2319db=_0x3fb950;_0x5ba38a[_0x7ff9('0x32')]=_[_0x7ff9('0x2e')](db['FreshdeskField'][_0x7ff9('0x2a')]);_0x5ba38a[_0x7ff9('0x2f')]=_[_0x7ff9('0x2e')](_0x582492[_0x7ff9('0x2f')]);_0x5ba38a[_0x7ff9('0x30')]=_[_0x7ff9('0x31')](_0x5ba38a[_0x7ff9('0x32')],_0x5ba38a[_0x7ff9('0x2f')]);_0x22fa17[_0x7ff9('0x33')]=_[_0x7ff9('0x31')](_0x5ba38a[_0x7ff9('0x32')],qs[_0x7ff9('0x34')](_0x582492['query']['fields']));_0x22fa17['attributes']=_0x22fa17[_0x7ff9('0x33')][_0x7ff9('0x40')]?_0x22fa17['attributes']:_0x5ba38a[_0x7ff9('0x32')];_0x22fa17[_0x7ff9('0x37')]=qs[_0x7ff9('0x38')](_0x582492['query']['sort']);_0x22fa17['where']=qs['filters'](_[_0x7ff9('0x39')](_0x582492[_0x7ff9('0x2f')],_0x5ba38a['filters']));if(_0x582492[_0x7ff9('0x2f')]['filter']){_0x22fa17[_0x7ff9('0x3b')]=_['merge'](_0x22fa17[_0x7ff9('0x3b')],{'$or':_[_0x7ff9('0x28')](_0x22fa17['attributes'],function(_0x1b0a00){var _0x48d02f={};_0x48d02f[_0x1b0a00]={'$like':'%'+_0x582492[_0x7ff9('0x2f')][_0x7ff9('0x3a')]+'%'};return _0x48d02f;})});}_0x22fa17=_['merge']({},_0x22fa17,_0x582492[_0x7ff9('0x3e')]);return _0x2319db[_0x7ff9('0x4b')](_0x22fa17);}})['then'](function(_0x1b14cd){if(_0x1b14cd){_0x5552a4=_0x1b14cd[_0x7ff9('0x40')];if(!_0x582492['query'][_0x7ff9('0x35')](_0x7ff9('0x36'))){_0x22fa17[_0x7ff9('0x1d')]=qs[_0x7ff9('0x1d')](_0x582492[_0x7ff9('0x2f')]['limit']);_0x22fa17['offset']=qs[_0x7ff9('0x1b')](_0x582492[_0x7ff9('0x2f')]['offset']);}return _0x2319db[_0x7ff9('0x4b')](_0x22fa17);}})[_0x7ff9('0x22')](function(_0x3cebaa){if(_0x3cebaa){return _0x3cebaa?{'count':_0x5552a4,'rows':_0x3cebaa}:null;}})[_0x7ff9('0x22')](respondWithResult(_0x2b51d,null))[_0x7ff9('0x3f')](handleError(_0x2b51d,null));};exports[_0x7ff9('0x4c')]=function(_0x42e41d,_0x1d1fb2,_0x53da03){var _0x5dc7e7={};var _0x1a5cfb={};var _0x19ee2b;var _0x533f3a;return db[_0x7ff9('0x29')][_0x7ff9('0x47')]({'where':{'id':_0x42e41d[_0x7ff9('0x46')]['id']}})[_0x7ff9('0x22')](handleEntityNotFound(_0x1d1fb2,null))[_0x7ff9('0x22')](function(_0x15bb8a){if(_0x15bb8a){_0x19ee2b=_0x15bb8a;_0x1a5cfb[_0x7ff9('0x32')]=_['keys'](db[_0x7ff9('0x4d')][_0x7ff9('0x2a')]);_0x1a5cfb['query']=_[_0x7ff9('0x2e')](_0x42e41d[_0x7ff9('0x2f')]);_0x1a5cfb['filters']=_[_0x7ff9('0x31')](_0x1a5cfb[_0x7ff9('0x32')],_0x1a5cfb[_0x7ff9('0x2f')]);_0x5dc7e7[_0x7ff9('0x33')]=_[_0x7ff9('0x31')](_0x1a5cfb[_0x7ff9('0x32')],qs[_0x7ff9('0x34')](_0x42e41d[_0x7ff9('0x2f')][_0x7ff9('0x34')]));_0x5dc7e7[_0x7ff9('0x33')]=_0x5dc7e7[_0x7ff9('0x33')][_0x7ff9('0x40')]?_0x5dc7e7[_0x7ff9('0x33')]:_0x1a5cfb[_0x7ff9('0x32')];_0x5dc7e7[_0x7ff9('0x37')]=qs[_0x7ff9('0x38')](_0x42e41d[_0x7ff9('0x2f')][_0x7ff9('0x38')]);_0x5dc7e7[_0x7ff9('0x3b')]=qs['filters'](_['pick'](_0x42e41d[_0x7ff9('0x2f')],_0x1a5cfb[_0x7ff9('0x30')]));if(_0x42e41d[_0x7ff9('0x2f')][_0x7ff9('0x3a')]){_0x5dc7e7[_0x7ff9('0x3b')]=_['merge'](_0x5dc7e7['where'],{'$or':_['map'](_0x5dc7e7[_0x7ff9('0x33')],function(_0x11b1d6){var _0x8215bb={};_0x8215bb[_0x11b1d6]={'$like':'%'+_0x42e41d['query'][_0x7ff9('0x3a')]+'%'};return _0x8215bb;})});}_0x5dc7e7=_['merge']({},_0x5dc7e7,_0x42e41d['options']);return _0x19ee2b['getTags'](_0x5dc7e7);}})['then'](function(_0x4597ab){if(_0x4597ab){_0x533f3a=_0x4597ab[_0x7ff9('0x40')];if(!_0x42e41d['query'][_0x7ff9('0x35')](_0x7ff9('0x36'))){_0x5dc7e7[_0x7ff9('0x1d')]=qs[_0x7ff9('0x1d')](_0x42e41d['query']['limit']);_0x5dc7e7[_0x7ff9('0x1b')]=qs[_0x7ff9('0x1b')](_0x42e41d[_0x7ff9('0x2f')][_0x7ff9('0x1b')]);}return _0x19ee2b[_0x7ff9('0x4c')](_0x5dc7e7);}})['then'](function(_0x27cf7d){if(_0x27cf7d){return _0x27cf7d?{'count':_0x533f3a,'rows':_0x27cf7d}:null;}})[_0x7ff9('0x22')](respondWithResult(_0x1d1fb2,null))[_0x7ff9('0x3f')](handleError(_0x1d1fb2,null));};exports[_0x7ff9('0x4e')]=function(_0xbb2b9a,_0x1ef077,_0xe56115){if(_0xbb2b9a['body']['id']){delete _0xbb2b9a[_0x7ff9('0x45')]['id'];}return db[_0x7ff9('0x29')][_0x7ff9('0x47')]({'where':{'id':_0xbb2b9a[_0x7ff9('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ef077,null))['then'](function(_0x59a912){if(_0x59a912){return _0x59a912[_0x7ff9('0x4e')](_0xbb2b9a[_0x7ff9('0x45')][_0x7ff9('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x1ef077,null))['catch'](handleError(_0x1ef077,null));}; \ No newline at end of file +var _0x05c6=['status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','error','stack','send','map','FreshdeskConfiguration','rawAttributes','key','model','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','name','filter','then','include','findAll','rows','catch','show','params','length','find','create','body','keys','FreshdeskField','getFields','getSubjects','findOne','options','nolimit','getDescriptions','getTags','setTags','ids','rimraf','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x94372b,_0x186f99){var _0x4e4ea2=function(_0x50efb0){while(--_0x50efb0){_0x94372b['push'](_0x94372b['shift']());}};_0x4e4ea2(++_0x186f99);}(_0x05c6,0x123));var _0x605c=function(_0x149112,_0x55945f){_0x149112=_0x149112-0x0;var _0x3221a6=_0x05c6[_0x149112];return _0x3221a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x605c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x605c('0x1'));var moment=require('moment');var BPromise=require(_0x605c('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x605c('0x3'));var sox=require(_0x605c('0x4'));var csv=require(_0x605c('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x605c('0x6'));var _=require(_0x605c('0x7'));var squel=require('squel');var crypto=require(_0x605c('0x8'));var jsforce=require(_0x605c('0x9'));var deskjs=require(_0x605c('0xa'));var toCsv=require(_0x605c('0x5'));var querystring=require(_0x605c('0xb'));var Papa=require(_0x605c('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x605c('0xd'));var as=require(_0x605c('0xe'));var hardwareService=require(_0x605c('0xf'));var logger=require(_0x605c('0x10'))(_0x605c('0x11'));var utils=require(_0x605c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x605c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a93bd,_0x2a22b9){_0x2a22b9=_0x2a22b9||0xcc;return function(_0xa8fada){if(_0xa8fada){return _0x1a93bd[_0x605c('0x14')](_0x2a22b9);}return _0x1a93bd[_0x605c('0x15')](_0x2a22b9)[_0x605c('0x16')]();};}function respondWithResult(_0x15a3e1,_0x49a1d9){_0x49a1d9=_0x49a1d9||0xc8;return function(_0x56d8d6){if(_0x56d8d6){return _0x15a3e1[_0x605c('0x15')](_0x49a1d9)[_0x605c('0x17')](_0x56d8d6);}};}function respondWithFilteredResult(_0x457d19,_0x3c67f9){return function(_0x160547){if(_0x160547){var _0x413e8d=typeof _0x3c67f9[_0x605c('0x18')]==='undefined'&&typeof _0x3c67f9[_0x605c('0x19')]==='undefined';var _0x58d716=_0x160547[_0x605c('0x1a')];var _0x4cba6d=_0x413e8d?0x0:_0x3c67f9['offset'];var _0x2bb32b=_0x413e8d?_0x160547[_0x605c('0x1a')]:_0x3c67f9[_0x605c('0x18')]+_0x3c67f9[_0x605c('0x19')];var _0x5eccb8;if(_0x2bb32b>=_0x58d716){_0x2bb32b=_0x58d716;_0x5eccb8=0xc8;}else{_0x5eccb8=0xce;}_0x457d19[_0x605c('0x15')](_0x5eccb8);return _0x457d19['set'](_0x605c('0x1b'),_0x4cba6d+'-'+_0x2bb32b+'/'+_0x58d716)[_0x605c('0x17')](_0x160547);}return null;};}function patchUpdates(_0x48d69c){return function(_0xc2302a){try{jsonpatch[_0x605c('0x1c')](_0xc2302a,_0x48d69c,!![]);}catch(_0x406b70){return BPromise[_0x605c('0x1d')](_0x406b70);}return _0xc2302a[_0x605c('0x1e')]();};}function saveUpdates(_0x90adce,_0x5b0852){return function(_0x17811d){if(_0x17811d){return _0x17811d[_0x605c('0x1f')](_0x90adce)['then'](function(_0x3d08fd){return _0x3d08fd;});}return null;};}function removeEntity(_0x1124bd,_0x34ef31){return function(_0xd1adbc){if(_0xd1adbc){return _0xd1adbc[_0x605c('0x20')]()['then'](function(){_0x1124bd[_0x605c('0x15')](0xcc)[_0x605c('0x16')]();});}};}function handleEntityNotFound(_0x2ff44a,_0x2381df){return function(_0x41fcb3){if(!_0x41fcb3){_0x2ff44a[_0x605c('0x14')](0x194);}return _0x41fcb3;};}function handleError(_0x2f2895,_0xb67717){_0xb67717=_0xb67717||0x1f4;return function(_0xdcfdf9){logger[_0x605c('0x21')](_0xdcfdf9[_0x605c('0x22')]);if(_0xdcfdf9['name']){delete _0xdcfdf9['name'];}_0x2f2895[_0x605c('0x15')](_0xb67717)[_0x605c('0x23')](_0xdcfdf9);};}exports['index']=function(_0x88948a,_0x20b7a0){var _0x133cb1={},_0xfe9423={},_0x16f5f5={'count':0x0,'rows':[]};var _0x502fa1=_[_0x605c('0x24')](db[_0x605c('0x25')][_0x605c('0x26')],function(_0x39bc6d){return{'name':_0x39bc6d['fieldName'],'type':_0x39bc6d['type'][_0x605c('0x27')]};});_0xfe9423[_0x605c('0x28')]=_['map'](_0x502fa1,'name');_0xfe9423['query']=_['keys'](_0x88948a[_0x605c('0x29')]);_0xfe9423['filters']=_['intersection'](_0xfe9423[_0x605c('0x28')],_0xfe9423[_0x605c('0x29')]);_0x133cb1[_0x605c('0x2a')]=_[_0x605c('0x2b')](_0xfe9423[_0x605c('0x28')],qs[_0x605c('0x2c')](_0x88948a[_0x605c('0x29')][_0x605c('0x2c')]));_0x133cb1[_0x605c('0x2a')]=_0x133cb1[_0x605c('0x2a')]['length']?_0x133cb1[_0x605c('0x2a')]:_0xfe9423[_0x605c('0x28')];if(!_0x88948a[_0x605c('0x29')][_0x605c('0x2d')]('nolimit')){_0x133cb1['limit']=qs[_0x605c('0x19')](_0x88948a['query'][_0x605c('0x19')]);_0x133cb1[_0x605c('0x18')]=qs[_0x605c('0x18')](_0x88948a[_0x605c('0x29')][_0x605c('0x18')]);}_0x133cb1[_0x605c('0x2e')]=qs[_0x605c('0x2f')](_0x88948a[_0x605c('0x29')][_0x605c('0x2f')]);_0x133cb1[_0x605c('0x30')]=qs[_0x605c('0x31')](_[_0x605c('0x32')](_0x88948a[_0x605c('0x29')],_0xfe9423[_0x605c('0x31')]),_0x502fa1);if(_0x88948a[_0x605c('0x29')]['filter']){_0x133cb1['where']=_[_0x605c('0x33')](_0x133cb1[_0x605c('0x30')],{'$or':_[_0x605c('0x24')](_0x502fa1,function(_0x4bb55e){if(_0x4bb55e[_0x605c('0x34')]!==_0x605c('0x35')){var _0x3d6afe={};_0x3d6afe[_0x4bb55e[_0x605c('0x36')]]={'$like':'%'+_0x88948a[_0x605c('0x29')][_0x605c('0x37')]+'%'};return _0x3d6afe;}})});}_0x133cb1=_['merge']({},_0x133cb1,_0x88948a['options']);var _0x27ffa4={'where':_0x133cb1[_0x605c('0x30')]};return db[_0x605c('0x25')][_0x605c('0x1a')](_0x27ffa4)[_0x605c('0x38')](function(_0x38bd51){_0x16f5f5['count']=_0x38bd51;if(_0x88948a[_0x605c('0x29')]['includeAll']){_0x133cb1[_0x605c('0x39')]=[{'all':!![]}];}return db[_0x605c('0x25')][_0x605c('0x3a')](_0x133cb1);})[_0x605c('0x38')](function(_0x3c1f62){_0x16f5f5[_0x605c('0x3b')]=_0x3c1f62;return _0x16f5f5;})[_0x605c('0x38')](respondWithFilteredResult(_0x20b7a0,_0x133cb1))[_0x605c('0x3c')](handleError(_0x20b7a0,null));};exports[_0x605c('0x3d')]=function(_0x103467,_0xc45be1){var _0x33e55a={'raw':![],'where':{'id':_0x103467[_0x605c('0x3e')]['id']}},_0x4d2e4f={};_0x4d2e4f[_0x605c('0x28')]=_['keys'](db[_0x605c('0x25')]['rawAttributes']);_0x4d2e4f[_0x605c('0x29')]=_['keys'](_0x103467[_0x605c('0x29')]);_0x4d2e4f[_0x605c('0x31')]=_[_0x605c('0x2b')](_0x4d2e4f['model'],_0x4d2e4f[_0x605c('0x29')]);_0x33e55a[_0x605c('0x2a')]=_[_0x605c('0x2b')](_0x4d2e4f[_0x605c('0x28')],qs[_0x605c('0x2c')](_0x103467[_0x605c('0x29')][_0x605c('0x2c')]));_0x33e55a[_0x605c('0x2a')]=_0x33e55a['attributes'][_0x605c('0x3f')]?_0x33e55a[_0x605c('0x2a')]:_0x4d2e4f[_0x605c('0x28')];if(_0x103467[_0x605c('0x29')]['includeAll']){_0x33e55a[_0x605c('0x39')]=[{'all':!![]}];}_0x33e55a=_[_0x605c('0x33')]({},_0x33e55a,_0x103467['options']);return db[_0x605c('0x25')][_0x605c('0x40')](_0x33e55a)[_0x605c('0x38')](handleEntityNotFound(_0xc45be1,null))[_0x605c('0x38')](respondWithResult(_0xc45be1,null))['catch'](handleError(_0xc45be1,null));};exports['create']=function(_0x31c98b,_0x167d2c){return db['FreshdeskConfiguration'][_0x605c('0x41')](_0x31c98b['body'],{})['then'](respondWithResult(_0x167d2c,0xc9))[_0x605c('0x3c')](handleError(_0x167d2c,null));};exports['update']=function(_0x296f2e,_0x3b439d){if(_0x296f2e['body']['id']){delete _0x296f2e['body']['id'];}return db[_0x605c('0x25')][_0x605c('0x40')]({'where':{'id':_0x296f2e[_0x605c('0x3e')]['id']}})[_0x605c('0x38')](handleEntityNotFound(_0x3b439d,null))[_0x605c('0x38')](saveUpdates(_0x296f2e[_0x605c('0x42')],null))[_0x605c('0x38')](respondWithResult(_0x3b439d,null))[_0x605c('0x3c')](handleError(_0x3b439d,null));};exports[_0x605c('0x20')]=function(_0x3156cd,_0x1c345e){return db['FreshdeskConfiguration'][_0x605c('0x40')]({'where':{'id':_0x3156cd[_0x605c('0x3e')]['id']}})[_0x605c('0x38')](handleEntityNotFound(_0x1c345e,null))[_0x605c('0x38')](removeEntity(_0x1c345e,null))[_0x605c('0x3c')](handleError(_0x1c345e,null));};exports['getFields']=function(_0x3cf707,_0x16db68,_0x5848d3){var _0x4049f9={};var _0x4433b0={};var _0x31fb77;var _0x459484;return db[_0x605c('0x25')]['findOne']({'where':{'id':_0x3cf707[_0x605c('0x3e')]['id']}})[_0x605c('0x38')](handleEntityNotFound(_0x16db68,null))[_0x605c('0x38')](function(_0x32fae5){if(_0x32fae5){_0x31fb77=_0x32fae5;_0x4433b0[_0x605c('0x28')]=_[_0x605c('0x43')](db[_0x605c('0x44')][_0x605c('0x26')]);_0x4433b0[_0x605c('0x29')]=_['keys'](_0x3cf707[_0x605c('0x29')]);_0x4433b0[_0x605c('0x31')]=_[_0x605c('0x2b')](_0x4433b0[_0x605c('0x28')],_0x4433b0[_0x605c('0x29')]);_0x4049f9['attributes']=_['intersection'](_0x4433b0[_0x605c('0x28')],qs[_0x605c('0x2c')](_0x3cf707[_0x605c('0x29')]['fields']));_0x4049f9[_0x605c('0x2a')]=_0x4049f9[_0x605c('0x2a')][_0x605c('0x3f')]?_0x4049f9['attributes']:_0x4433b0['model'];_0x4049f9[_0x605c('0x2e')]=qs[_0x605c('0x2f')](_0x3cf707[_0x605c('0x29')]['sort']);_0x4049f9[_0x605c('0x30')]=qs['filters'](_[_0x605c('0x32')](_0x3cf707[_0x605c('0x29')],_0x4433b0[_0x605c('0x31')]));if(_0x3cf707[_0x605c('0x29')]['filter']){_0x4049f9['where']=_[_0x605c('0x33')](_0x4049f9[_0x605c('0x30')],{'$or':_[_0x605c('0x24')](_0x4049f9[_0x605c('0x2a')],function(_0x3c9cdb){var _0x2c4718={};_0x2c4718[_0x3c9cdb]={'$like':'%'+_0x3cf707[_0x605c('0x29')][_0x605c('0x37')]+'%'};return _0x2c4718;})});}_0x4049f9=_[_0x605c('0x33')]({},_0x4049f9,_0x3cf707['options']);return _0x31fb77[_0x605c('0x45')](_0x4049f9);}})['then'](function(_0x124a1d){if(_0x124a1d){_0x459484=_0x124a1d[_0x605c('0x3f')];if(!_0x3cf707[_0x605c('0x29')]['hasOwnProperty']('nolimit')){_0x4049f9['limit']=qs[_0x605c('0x19')](_0x3cf707['query'][_0x605c('0x19')]);_0x4049f9[_0x605c('0x18')]=qs[_0x605c('0x18')](_0x3cf707[_0x605c('0x29')][_0x605c('0x18')]);}return _0x31fb77[_0x605c('0x45')](_0x4049f9);}})[_0x605c('0x38')](function(_0x137791){if(_0x137791){return _0x137791?{'count':_0x459484,'rows':_0x137791}:null;}})['then'](respondWithResult(_0x16db68,null))[_0x605c('0x3c')](handleError(_0x16db68,null));};exports[_0x605c('0x46')]=function(_0x19421f,_0x264e79,_0x2d9963){var _0x458ecb={};var _0x2f2c65={};var _0xcb8a35;var _0x138cb6;return db[_0x605c('0x25')][_0x605c('0x47')]({'where':{'id':_0x19421f[_0x605c('0x3e')]['id']}})[_0x605c('0x38')](handleEntityNotFound(_0x264e79,null))[_0x605c('0x38')](function(_0x181488){if(_0x181488){_0xcb8a35=_0x181488;_0x2f2c65[_0x605c('0x28')]=_['keys'](db['FreshdeskField'][_0x605c('0x26')]);_0x2f2c65[_0x605c('0x29')]=_[_0x605c('0x43')](_0x19421f[_0x605c('0x29')]);_0x2f2c65[_0x605c('0x31')]=_[_0x605c('0x2b')](_0x2f2c65[_0x605c('0x28')],_0x2f2c65['query']);_0x458ecb[_0x605c('0x2a')]=_[_0x605c('0x2b')](_0x2f2c65[_0x605c('0x28')],qs[_0x605c('0x2c')](_0x19421f[_0x605c('0x29')][_0x605c('0x2c')]));_0x458ecb[_0x605c('0x2a')]=_0x458ecb[_0x605c('0x2a')][_0x605c('0x3f')]?_0x458ecb[_0x605c('0x2a')]:_0x2f2c65['model'];_0x458ecb[_0x605c('0x2e')]=qs[_0x605c('0x2f')](_0x19421f[_0x605c('0x29')]['sort']);_0x458ecb[_0x605c('0x30')]=qs['filters'](_[_0x605c('0x32')](_0x19421f[_0x605c('0x29')],_0x2f2c65['filters']));if(_0x19421f[_0x605c('0x29')][_0x605c('0x37')]){_0x458ecb[_0x605c('0x30')]=_['merge'](_0x458ecb[_0x605c('0x30')],{'$or':_[_0x605c('0x24')](_0x458ecb['attributes'],function(_0x35b0d0){var _0x5eb3e6={};_0x5eb3e6[_0x35b0d0]={'$like':'%'+_0x19421f[_0x605c('0x29')][_0x605c('0x37')]+'%'};return _0x5eb3e6;})});}_0x458ecb=_['merge']({},_0x458ecb,_0x19421f[_0x605c('0x48')]);return _0xcb8a35[_0x605c('0x46')](_0x458ecb);}})[_0x605c('0x38')](function(_0x4d868e){if(_0x4d868e){_0x138cb6=_0x4d868e[_0x605c('0x3f')];if(!_0x19421f[_0x605c('0x29')][_0x605c('0x2d')](_0x605c('0x49'))){_0x458ecb[_0x605c('0x19')]=qs[_0x605c('0x19')](_0x19421f['query'][_0x605c('0x19')]);_0x458ecb[_0x605c('0x18')]=qs[_0x605c('0x18')](_0x19421f['query'][_0x605c('0x18')]);}return _0xcb8a35['getSubjects'](_0x458ecb);}})[_0x605c('0x38')](function(_0x32a9e4){if(_0x32a9e4){return _0x32a9e4?{'count':_0x138cb6,'rows':_0x32a9e4}:null;}})[_0x605c('0x38')](respondWithResult(_0x264e79,null))[_0x605c('0x3c')](handleError(_0x264e79,null));};exports[_0x605c('0x4a')]=function(_0x442ec3,_0x57e99a,_0x503c64){var _0x51f048={};var _0x238b8d={};var _0x102b58;var _0x40568c;return db['FreshdeskConfiguration'][_0x605c('0x47')]({'where':{'id':_0x442ec3[_0x605c('0x3e')]['id']}})[_0x605c('0x38')](handleEntityNotFound(_0x57e99a,null))[_0x605c('0x38')](function(_0x46893b){if(_0x46893b){_0x102b58=_0x46893b;_0x238b8d[_0x605c('0x28')]=_['keys'](db[_0x605c('0x44')]['rawAttributes']);_0x238b8d[_0x605c('0x29')]=_[_0x605c('0x43')](_0x442ec3[_0x605c('0x29')]);_0x238b8d['filters']=_['intersection'](_0x238b8d[_0x605c('0x28')],_0x238b8d[_0x605c('0x29')]);_0x51f048[_0x605c('0x2a')]=_[_0x605c('0x2b')](_0x238b8d[_0x605c('0x28')],qs[_0x605c('0x2c')](_0x442ec3[_0x605c('0x29')]['fields']));_0x51f048[_0x605c('0x2a')]=_0x51f048[_0x605c('0x2a')]['length']?_0x51f048[_0x605c('0x2a')]:_0x238b8d[_0x605c('0x28')];_0x51f048[_0x605c('0x2e')]=qs[_0x605c('0x2f')](_0x442ec3[_0x605c('0x29')][_0x605c('0x2f')]);_0x51f048[_0x605c('0x30')]=qs['filters'](_[_0x605c('0x32')](_0x442ec3[_0x605c('0x29')],_0x238b8d[_0x605c('0x31')]));if(_0x442ec3['query']['filter']){_0x51f048[_0x605c('0x30')]=_[_0x605c('0x33')](_0x51f048[_0x605c('0x30')],{'$or':_[_0x605c('0x24')](_0x51f048[_0x605c('0x2a')],function(_0x483c92){var _0x2f2ba={};_0x2f2ba[_0x483c92]={'$like':'%'+_0x442ec3[_0x605c('0x29')][_0x605c('0x37')]+'%'};return _0x2f2ba;})});}_0x51f048=_['merge']({},_0x51f048,_0x442ec3[_0x605c('0x48')]);return _0x102b58['getDescriptions'](_0x51f048);}})[_0x605c('0x38')](function(_0x256f51){if(_0x256f51){_0x40568c=_0x256f51['length'];if(!_0x442ec3['query']['hasOwnProperty'](_0x605c('0x49'))){_0x51f048[_0x605c('0x19')]=qs[_0x605c('0x19')](_0x442ec3[_0x605c('0x29')][_0x605c('0x19')]);_0x51f048['offset']=qs[_0x605c('0x18')](_0x442ec3[_0x605c('0x29')][_0x605c('0x18')]);}return _0x102b58[_0x605c('0x4a')](_0x51f048);}})[_0x605c('0x38')](function(_0x35714e){if(_0x35714e){return _0x35714e?{'count':_0x40568c,'rows':_0x35714e}:null;}})[_0x605c('0x38')](respondWithResult(_0x57e99a,null))[_0x605c('0x3c')](handleError(_0x57e99a,null));};exports['getTags']=function(_0x226ec3,_0x37832b,_0x1212c7){var _0x5839ee={};var _0x2da450={};var _0x564d10;var _0x1c54e5;return db[_0x605c('0x25')][_0x605c('0x47')]({'where':{'id':_0x226ec3[_0x605c('0x3e')]['id']}})[_0x605c('0x38')](handleEntityNotFound(_0x37832b,null))[_0x605c('0x38')](function(_0x386cad){if(_0x386cad){_0x564d10=_0x386cad;_0x2da450[_0x605c('0x28')]=_[_0x605c('0x43')](db['Tag'][_0x605c('0x26')]);_0x2da450[_0x605c('0x29')]=_['keys'](_0x226ec3[_0x605c('0x29')]);_0x2da450[_0x605c('0x31')]=_[_0x605c('0x2b')](_0x2da450['model'],_0x2da450['query']);_0x5839ee[_0x605c('0x2a')]=_['intersection'](_0x2da450[_0x605c('0x28')],qs[_0x605c('0x2c')](_0x226ec3[_0x605c('0x29')][_0x605c('0x2c')]));_0x5839ee[_0x605c('0x2a')]=_0x5839ee[_0x605c('0x2a')]['length']?_0x5839ee[_0x605c('0x2a')]:_0x2da450[_0x605c('0x28')];_0x5839ee[_0x605c('0x2e')]=qs[_0x605c('0x2f')](_0x226ec3[_0x605c('0x29')][_0x605c('0x2f')]);_0x5839ee[_0x605c('0x30')]=qs['filters'](_['pick'](_0x226ec3[_0x605c('0x29')],_0x2da450['filters']));if(_0x226ec3[_0x605c('0x29')]['filter']){_0x5839ee[_0x605c('0x30')]=_[_0x605c('0x33')](_0x5839ee[_0x605c('0x30')],{'$or':_['map'](_0x5839ee[_0x605c('0x2a')],function(_0x1098e4){var _0x598fb3={};_0x598fb3[_0x1098e4]={'$like':'%'+_0x226ec3[_0x605c('0x29')]['filter']+'%'};return _0x598fb3;})});}_0x5839ee=_[_0x605c('0x33')]({},_0x5839ee,_0x226ec3[_0x605c('0x48')]);return _0x564d10[_0x605c('0x4b')](_0x5839ee);}})[_0x605c('0x38')](function(_0x4216bf){if(_0x4216bf){_0x1c54e5=_0x4216bf[_0x605c('0x3f')];if(!_0x226ec3[_0x605c('0x29')][_0x605c('0x2d')](_0x605c('0x49'))){_0x5839ee[_0x605c('0x19')]=qs[_0x605c('0x19')](_0x226ec3['query'][_0x605c('0x19')]);_0x5839ee[_0x605c('0x18')]=qs[_0x605c('0x18')](_0x226ec3[_0x605c('0x29')][_0x605c('0x18')]);}return _0x564d10['getTags'](_0x5839ee);}})[_0x605c('0x38')](function(_0x1936d7){if(_0x1936d7){return _0x1936d7?{'count':_0x1c54e5,'rows':_0x1936d7}:null;}})[_0x605c('0x38')](respondWithResult(_0x37832b,null))['catch'](handleError(_0x37832b,null));};exports[_0x605c('0x4c')]=function(_0x277b77,_0x671a69,_0x17b93d){if(_0x277b77[_0x605c('0x42')]['id']){delete _0x277b77['body']['id'];}return db[_0x605c('0x25')][_0x605c('0x47')]({'where':{'id':_0x277b77[_0x605c('0x3e')]['id']}})[_0x605c('0x38')](handleEntityNotFound(_0x671a69,null))['then'](function(_0x2a6933){if(_0x2a6933){return _0x2a6933[_0x605c('0x4c')](_0x277b77['body'][_0x605c('0x4d')]||[]);}return null;})['then'](respondWithResult(_0x671a69,null))['catch'](handleError(_0x671a69,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 86ec6e0..e0b5952 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 _0x0337=['exports','define','FreshdeskConfiguration','util','moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0337,0x8f));var _0x7033=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0x0337[_0x19a49f];return _0x5351ae;};'use strict';var _=require('lodash');var util=require(_0x7033('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7033('0x1'));var BPromise=require(_0x7033('0x2'));var rp=require(_0x7033('0x3'));var fs=require('fs');var path=require(_0x7033('0x4'));var rimraf=require(_0x7033('0x5'));var config=require('../../config/environment');var attributes=require(_0x7033('0x6'));module[_0x7033('0x7')]=function(_0x3ac619,_0x1d80b6){return _0x3ac619[_0x7033('0x8')](_0x7033('0x9'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec02=['FreshdeskConfiguration','../../config/logger','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x42c6b8,_0x192769){var _0x3f4df1=function(_0x52bf77){while(--_0x52bf77){_0x42c6b8['push'](_0x42c6b8['shift']());}};_0x3f4df1(++_0x192769);}(_0xec02,0x158));var _0x2ec0=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xec02[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2ec0('0x0'))('api');var moment=require('moment');var BPromise=require(_0x2ec0('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ec0('0x2'));var rimraf=require('rimraf');var config=require(_0x2ec0('0x3'));var attributes=require(_0x2ec0('0x4'));module[_0x2ec0('0x5')]=function(_0x1c7ed4,_0xf85dca){return _0x1c7ed4['define'](_0x2ec0('0x6'),attributes,{'tableName':'int_freshdesk_configurations','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 d36985b..82a1072 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 _0x98d6=['../../config/environment','http','request','then','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x31f53b,_0x21c467){var _0x4d7b20=function(_0x5170c4){while(--_0x5170c4){_0x31f53b['push'](_0x31f53b['shift']());}};_0x4d7b20(++_0x21c467);}(_0x98d6,0x14d));var _0x698d=function(_0x549e9f,_0x3f1816){_0x549e9f=_0x549e9f-0x0;var _0x683aaf=_0x98d6[_0x549e9f];return _0x683aaf;};'use strict';var _=require('lodash');var util=require(_0x698d('0x0'));var moment=require(_0x698d('0x1'));var BPromise=require(_0x698d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x698d('0x3'));var db=require(_0x698d('0x4'))['db'];var utils=require(_0x698d('0x5'));var logger=require('../../config/logger')(_0x698d('0x6'));var config=require(_0x698d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x698d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf15bac,_0xb8e0a9,_0x5c7db6){return new BPromise(function(_0x32610c,_0x90fec9){return client[_0x698d('0x9')](_0xf15bac,_0x5c7db6)[_0x698d('0xa')](function(_0x45371c){logger[_0x698d('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xb8e0a9,'request\x20sent');logger[_0x698d('0xc')](_0x698d('0xd'),_0xb8e0a9,_0x698d('0xe'),JSON[_0x698d('0xf')](_0x45371c));if(_0x45371c[_0x698d('0x10')]){if(_0x45371c['error'][_0x698d('0x11')]===0x1f4){logger['error'](_0x698d('0x12'),_0xb8e0a9,_0x45371c[_0x698d('0x10')][_0x698d('0x13')]);return _0x90fec9(_0x45371c['error'][_0x698d('0x13')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0xb8e0a9,_0x45371c[_0x698d('0x10')][_0x698d('0x13')]);return _0x32610c(_0x45371c[_0x698d('0x10')][_0x698d('0x13')]);}else{logger[_0x698d('0xb')](_0x698d('0x12'),_0xb8e0a9,_0x698d('0xe'));_0x32610c(_0x45371c['result']['message']);}})['catch'](function(_0x5d6484){logger[_0x698d('0x10')](_0x698d('0x12'),_0xb8e0a9,_0x5d6484);_0x90fec9(_0x5d6484);});});} \ No newline at end of file +var _0x1856=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1856,0x1b5));var _0x6185=function(_0xe64c1,_0x107b70){_0xe64c1=_0xe64c1-0x0;var _0x2732d9=_0x1856[_0xe64c1];return _0x2732d9;};'use strict';var _=require(_0x6185('0x0'));var util=require(_0x6185('0x1'));var moment=require('moment');var BPromise=require(_0x6185('0x2'));var rs=require(_0x6185('0x3'));var fs=require('fs');var Redis=require(_0x6185('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6185('0x5'));var logger=require(_0x6185('0x6'))(_0x6185('0x7'));var config=require(_0x6185('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6185('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44e480,_0x1aa8ff,_0x5c9d7c){return new BPromise(function(_0x4b033c,_0x545f39){return client[_0x6185('0xa')](_0x44e480,_0x5c9d7c)['then'](function(_0x415da4){logger[_0x6185('0xb')](_0x6185('0xc'),_0x1aa8ff,_0x6185('0xd'));logger[_0x6185('0xe')](_0x6185('0xf'),_0x1aa8ff,_0x6185('0xd'),JSON[_0x6185('0x10')](_0x415da4));if(_0x415da4[_0x6185('0x11')]){if(_0x415da4[_0x6185('0x11')]['code']===0x1f4){logger[_0x6185('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1aa8ff,_0x415da4[_0x6185('0x11')][_0x6185('0x12')]);return _0x545f39(_0x415da4[_0x6185('0x11')][_0x6185('0x12')]);}logger[_0x6185('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1aa8ff,_0x415da4[_0x6185('0x11')][_0x6185('0x12')]);return _0x4b033c(_0x415da4[_0x6185('0x11')]['message']);}else{logger[_0x6185('0xb')](_0x6185('0xc'),_0x1aa8ff,'request\x20sent');_0x4b033c(_0x415da4['result']['message']);}})[_0x6185('0x13')](function(_0x186f0a){logger[_0x6185('0x11')](_0x6185('0xc'),_0x1aa8ff,_0x186f0a);_0x545f39(_0x186f0a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ba918dc..6d8c627 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 _0x265a=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x265a,0x1a8));var _0xa265=function(_0x5484dc,_0x57933d){_0x5484dc=_0x5484dc-0x0;var _0x23da66=_0x265a[_0x5484dc];return _0x23da66;};'use strict';var multer=require(_0xa265('0x0'));var util=require(_0xa265('0x1'));var path=require(_0xa265('0x2'));var timeout=require('connect-timeout');var express=require(_0xa265('0x3'));var router=express[_0xa265('0x4')]();var fs_extra=require(_0xa265('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa265('0x6'));var config=require(_0xa265('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xa265('0x8')]('/',auth[_0xa265('0x9')](),controller[_0xa265('0xa')]);router[_0xa265('0x8')](_0xa265('0xb'),auth[_0xa265('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa265('0xc')]);router[_0xa265('0xd')](_0xa265('0xb'),auth[_0xa265('0x9')](),controller[_0xa265('0xe')]);router[_0xa265('0xf')](_0xa265('0xb'),auth[_0xa265('0x9')](),controller[_0xa265('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6a8c=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','update','exports','multer'];(function(_0x19e53d,_0x753a2f){var _0x593edf=function(_0x4b53b7){while(--_0x4b53b7){_0x19e53d['push'](_0x19e53d['shift']());}};_0x593edf(++_0x753a2f);}(_0x6a8c,0xef));var _0xc6a8=function(_0x16fe4c,_0x2421e8){_0x16fe4c=_0x16fe4c-0x0;var _0x9999d=_0x6a8c[_0x16fe4c];return _0x9999d;};'use strict';var multer=require(_0xc6a8('0x0'));var util=require(_0xc6a8('0x1'));var path=require(_0xc6a8('0x2'));var timeout=require(_0xc6a8('0x3'));var express=require(_0xc6a8('0x4'));var router=express[_0xc6a8('0x5')]();var fs_extra=require(_0xc6a8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc6a8('0x7'));var config=require(_0xc6a8('0x8'));var controller=require(_0xc6a8('0x9'));router[_0xc6a8('0xa')]('/',auth[_0xc6a8('0xb')](),controller[_0xc6a8('0xc')]);router[_0xc6a8('0xa')]('/:id',auth[_0xc6a8('0xb')](),controller['show']);router['post']('/',auth[_0xc6a8('0xb')](),controller['create']);router['put'](_0xc6a8('0xd'),auth[_0xc6a8('0xb')](),controller[_0xc6a8('0xe')]);router['delete'](_0xc6a8('0xd'),auth[_0xc6a8('0xb')](),controller['destroy']);module[_0xc6a8('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index f94af08..dec2e2c 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 _0xe13d=['ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x4c0d42,_0x56994c){var _0x760519=function(_0x38e43e){while(--_0x38e43e){_0x4c0d42['push'](_0x4c0d42['shift']());}};_0x760519(++_0x56994c);}(_0xe13d,0x6a));var _0xde13=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xe13d[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xde13('0x0'));module[_0xde13('0x1')]={'type':{'type':Sequelize[_0xde13('0x2')]('string',_0xde13('0x3'),_0xde13('0x4'),'keyValue',_0xde13('0x5')),'defaultValue':_0xde13('0x6')},'content':{'type':Sequelize[_0xde13('0x7')]},'key':{'type':Sequelize[_0xde13('0x7')]},'keyType':{'type':Sequelize[_0xde13('0x2')](_0xde13('0x6'),_0xde13('0x3'),_0xde13('0x4'))},'keyContent':{'type':Sequelize[_0xde13('0x7')]},'idField':{'type':Sequelize[_0xde13('0x7')]},'nameField':{'type':Sequelize[_0xde13('0x7')]},'customField':{'type':Sequelize[_0xde13('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde13('0x7')]}}; \ No newline at end of file +var _0xe7bc=['ENUM','sequelize','exports','string','customVariable','picklist','STRING'];(function(_0x2de0bb,_0x5defee){var _0x276417=function(_0x1cbf8a){while(--_0x1cbf8a){_0x2de0bb['push'](_0x2de0bb['shift']());}};_0x276417(++_0x5defee);}(_0xe7bc,0x78));var _0xce7b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe7bc[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xce7b('0x0'));module[_0xce7b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xce7b('0x2'),'variable',_0xce7b('0x3'),'keyValue',_0xce7b('0x4')),'defaultValue':_0xce7b('0x2')},'content':{'type':Sequelize[_0xce7b('0x5')]},'key':{'type':Sequelize[_0xce7b('0x5')]},'keyType':{'type':Sequelize[_0xce7b('0x6')](_0xce7b('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xce7b('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xce7b('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index b7e8668..5cb3382 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 _0xbee3=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','FreshdeskField','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','body','find','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash'];(function(_0x1d6265,_0x5dbaae){var _0x3bed33=function(_0x1b06b6){while(--_0x1b06b6){_0x1d6265['push'](_0x1d6265['shift']());}};_0x3bed33(++_0x5dbaae);}(_0xbee3,0xd5));var _0x3bee=function(_0x588a23,_0x416b18){_0x588a23=_0x588a23-0x0;var _0x2efaae=_0xbee3[_0x588a23];return _0x2efaae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];function respondWithStatusCode(_0x407526,_0x6950d0){_0x6950d0=_0x6950d0||0xcc;return function(_0x410124){if(_0x410124){return _0x407526[_0x3bee('0x17')](_0x6950d0);}return _0x407526[_0x3bee('0x18')](_0x6950d0)['end']();};}function respondWithResult(_0xad01f9,_0x33504d){_0x33504d=_0x33504d||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0xad01f9[_0x3bee('0x18')](_0x33504d)[_0x3bee('0x19')](_0x31ac52);}};}function respondWithFilteredResult(_0x5b9473,_0x558436){return function(_0x346767){if(_0x346767){var _0x515397=typeof _0x558436[_0x3bee('0x1a')]===_0x3bee('0x1b')&&typeof _0x558436['limit']==='undefined';var _0x1582a4=_0x346767[_0x3bee('0x1c')];var _0xfdba3b=_0x515397?0x0:_0x558436[_0x3bee('0x1a')];var _0x49095a=_0x515397?_0x346767[_0x3bee('0x1c')]:_0x558436[_0x3bee('0x1a')]+_0x558436[_0x3bee('0x1d')];var _0x49b32d;if(_0x49095a>=_0x1582a4){_0x49095a=_0x1582a4;_0x49b32d=0xc8;}else{_0x49b32d=0xce;}_0x5b9473[_0x3bee('0x18')](_0x49b32d);return _0x5b9473[_0x3bee('0x1e')](_0x3bee('0x1f'),_0xfdba3b+'-'+_0x49095a+'/'+_0x1582a4)['json'](_0x346767);}return null;};}function patchUpdates(_0x4f36af){return function(_0x1afd0f){try{jsonpatch[_0x3bee('0x20')](_0x1afd0f,_0x4f36af,!![]);}catch(_0x57aba4){return BPromise[_0x3bee('0x21')](_0x57aba4);}return _0x1afd0f[_0x3bee('0x22')]();};}function saveUpdates(_0x2eea75,_0x179e62){return function(_0x28c248){if(_0x28c248){return _0x28c248[_0x3bee('0x23')](_0x2eea75)[_0x3bee('0x24')](function(_0x582fa9){return _0x582fa9;});}return null;};}function removeEntity(_0x8ae4ca,_0x1ed0c1){return function(_0x1fed5a){if(_0x1fed5a){return _0x1fed5a[_0x3bee('0x25')]()['then'](function(){_0x8ae4ca[_0x3bee('0x18')](0xcc)[_0x3bee('0x26')]();});}};}function handleEntityNotFound(_0x1e0111,_0x4b4cd4){return function(_0x5ed022){if(!_0x5ed022){_0x1e0111[_0x3bee('0x17')](0x194);}return _0x5ed022;};}function handleError(_0x479f45,_0x5341e2){_0x5341e2=_0x5341e2||0x1f4;return function(_0x2c0e50){logger[_0x3bee('0x27')](_0x2c0e50[_0x3bee('0x28')]);if(_0x2c0e50['name']){delete _0x2c0e50[_0x3bee('0x29')];}_0x479f45[_0x3bee('0x18')](_0x5341e2)[_0x3bee('0x2a')](_0x2c0e50);};}exports['index']=function(_0x239fa4,_0xf08fb3){var _0x3a3d92={},_0x496abd={},_0x1115ed={'count':0x0,'rows':[]};var _0x24d523=_[_0x3bee('0x2b')](db[_0x3bee('0x2c')][_0x3bee('0x2d')],function(_0x559c2b){return{'name':_0x559c2b['fieldName'],'type':_0x559c2b[_0x3bee('0x2e')][_0x3bee('0x2f')]};});_0x496abd[_0x3bee('0x30')]=_[_0x3bee('0x2b')](_0x24d523,'name');_0x496abd['query']=_[_0x3bee('0x31')](_0x239fa4[_0x3bee('0x32')]);_0x496abd['filters']=_['intersection'](_0x496abd[_0x3bee('0x30')],_0x496abd[_0x3bee('0x32')]);_0x3a3d92[_0x3bee('0x33')]=_[_0x3bee('0x34')](_0x496abd[_0x3bee('0x30')],qs[_0x3bee('0x35')](_0x239fa4[_0x3bee('0x32')][_0x3bee('0x35')]));_0x3a3d92[_0x3bee('0x33')]=_0x3a3d92[_0x3bee('0x33')]['length']?_0x3a3d92['attributes']:_0x496abd[_0x3bee('0x30')];if(!_0x239fa4['query']['hasOwnProperty'](_0x3bee('0x36'))){_0x3a3d92[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x239fa4[_0x3bee('0x32')][_0x3bee('0x1d')]);_0x3a3d92[_0x3bee('0x1a')]=qs[_0x3bee('0x1a')](_0x239fa4[_0x3bee('0x32')]['offset']);}_0x3a3d92[_0x3bee('0x37')]=qs[_0x3bee('0x38')](_0x239fa4['query'][_0x3bee('0x38')]);_0x3a3d92[_0x3bee('0x39')]=qs[_0x3bee('0x3a')](_[_0x3bee('0x3b')](_0x239fa4[_0x3bee('0x32')],_0x496abd['filters']),_0x24d523);if(_0x239fa4['query'][_0x3bee('0x3c')]){_0x3a3d92[_0x3bee('0x39')]=_[_0x3bee('0x3d')](_0x3a3d92[_0x3bee('0x39')],{'$or':_[_0x3bee('0x2b')](_0x24d523,function(_0x3d9656){if(_0x3d9656[_0x3bee('0x2e')]!==_0x3bee('0x3e')){var _0x2fb349={};_0x2fb349[_0x3d9656[_0x3bee('0x29')]]={'$like':'%'+_0x239fa4[_0x3bee('0x32')][_0x3bee('0x3c')]+'%'};return _0x2fb349;}})});}_0x3a3d92=_['merge']({},_0x3a3d92,_0x239fa4[_0x3bee('0x3f')]);var _0x1b5eca={'where':_0x3a3d92[_0x3bee('0x39')]};return db[_0x3bee('0x2c')][_0x3bee('0x1c')](_0x1b5eca)[_0x3bee('0x24')](function(_0x1622b9){_0x1115ed[_0x3bee('0x1c')]=_0x1622b9;if(_0x239fa4[_0x3bee('0x32')][_0x3bee('0x40')]){_0x3a3d92[_0x3bee('0x41')]=[{'all':!![]}];}return db[_0x3bee('0x2c')][_0x3bee('0x42')](_0x3a3d92);})['then'](function(_0x2b773d){_0x1115ed[_0x3bee('0x43')]=_0x2b773d;return _0x1115ed;})[_0x3bee('0x24')](respondWithFilteredResult(_0xf08fb3,_0x3a3d92))[_0x3bee('0x44')](handleError(_0xf08fb3,null));};exports[_0x3bee('0x45')]=function(_0x44489f,_0x13dd72){var _0xd1140d={'raw':!![],'where':{'id':_0x44489f[_0x3bee('0x46')]['id']}},_0x5d9e1b={};_0x5d9e1b[_0x3bee('0x30')]=_[_0x3bee('0x31')](db['FreshdeskField'][_0x3bee('0x2d')]);_0x5d9e1b['query']=_[_0x3bee('0x31')](_0x44489f['query']);_0x5d9e1b['filters']=_[_0x3bee('0x34')](_0x5d9e1b[_0x3bee('0x30')],_0x5d9e1b[_0x3bee('0x32')]);_0xd1140d[_0x3bee('0x33')]=_[_0x3bee('0x34')](_0x5d9e1b['model'],qs['fields'](_0x44489f[_0x3bee('0x32')]['fields']));_0xd1140d[_0x3bee('0x33')]=_0xd1140d['attributes'][_0x3bee('0x47')]?_0xd1140d['attributes']:_0x5d9e1b[_0x3bee('0x30')];if(_0x44489f[_0x3bee('0x32')][_0x3bee('0x40')]){_0xd1140d[_0x3bee('0x41')]=[{'all':!![]}];}_0xd1140d=_['merge']({},_0xd1140d,_0x44489f['options']);return db[_0x3bee('0x2c')]['find'](_0xd1140d)['then'](handleEntityNotFound(_0x13dd72,null))['then'](respondWithResult(_0x13dd72,null))[_0x3bee('0x44')](handleError(_0x13dd72,null));};exports['create']=function(_0x125fa5,_0x33d615){return db[_0x3bee('0x2c')]['create'](_0x125fa5[_0x3bee('0x48')],{})['then'](respondWithResult(_0x33d615,0xc9))[_0x3bee('0x44')](handleError(_0x33d615,null));};exports['update']=function(_0x26ccd7,_0x16b096){if(_0x26ccd7[_0x3bee('0x48')]['id']){delete _0x26ccd7['body']['id'];}return db[_0x3bee('0x2c')][_0x3bee('0x49')]({'where':{'id':_0x26ccd7[_0x3bee('0x46')]['id']}})['then'](handleEntityNotFound(_0x16b096,null))['then'](saveUpdates(_0x26ccd7[_0x3bee('0x48')],null))[_0x3bee('0x24')](respondWithResult(_0x16b096,null))[_0x3bee('0x44')](handleError(_0x16b096,null));};exports[_0x3bee('0x25')]=function(_0x3b5d7a,_0x21ab40){return db[_0x3bee('0x2c')]['find']({'where':{'id':_0x3b5d7a[_0x3bee('0x46')]['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x21ab40,null))['then'](removeEntity(_0x21ab40,null))['catch'](handleError(_0x21ab40,null));}; \ No newline at end of file +var _0xb469=['undefined','count','limit','set','Content-Range','apply','update','then','error','stack','name','index','map','FreshdeskField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','params','includeAll','options','find','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0xb469,0x13b));var _0x9b46=function(_0x1dabcf,_0x19161a){_0x1dabcf=_0x1dabcf-0x0;var _0x2c98a7=_0xb469[_0x1dabcf];return _0x2c98a7;};'use strict';var emlformat=require(_0x9b46('0x0'));var rimraf=require(_0x9b46('0x1'));var zipdir=require(_0x9b46('0x2'));var jsonpatch=require(_0x9b46('0x3'));var rp=require(_0x9b46('0x4'));var moment=require(_0x9b46('0x5'));var BPromise=require(_0x9b46('0x6'));var Mustache=require('mustache');var util=require(_0x9b46('0x7'));var path=require(_0x9b46('0x8'));var sox=require('sox');var csv=require(_0x9b46('0x9'));var ejs=require(_0x9b46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b46('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b46('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9b46('0x9'));var querystring=require(_0x9b46('0xd'));var Papa=require(_0x9b46('0xe'));var Redis=require('ioredis');var authService=require(_0x9b46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9b46('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b46('0x11'))('api');var utils=require(_0x9b46('0x12'));var config=require(_0x9b46('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b46('0x14'))['db'];function respondWithStatusCode(_0x417df5,_0x5b65c2){_0x5b65c2=_0x5b65c2||0xcc;return function(_0x14362a){if(_0x14362a){return _0x417df5[_0x9b46('0x15')](_0x5b65c2);}return _0x417df5[_0x9b46('0x16')](_0x5b65c2)[_0x9b46('0x17')]();};}function respondWithResult(_0xa8f4ac,_0x35c5c1){_0x35c5c1=_0x35c5c1||0xc8;return function(_0x2136bc){if(_0x2136bc){return _0xa8f4ac[_0x9b46('0x16')](_0x35c5c1)[_0x9b46('0x18')](_0x2136bc);}};}function respondWithFilteredResult(_0x178293,_0xbc1ba6){return function(_0x135cc2){if(_0x135cc2){var _0x1e6911=typeof _0xbc1ba6['offset']==='undefined'&&typeof _0xbc1ba6['limit']===_0x9b46('0x19');var _0x5a380c=_0x135cc2[_0x9b46('0x1a')];var _0x5c5cc9=_0x1e6911?0x0:_0xbc1ba6['offset'];var _0x3d9efa=_0x1e6911?_0x135cc2['count']:_0xbc1ba6['offset']+_0xbc1ba6[_0x9b46('0x1b')];var _0x3a15cc;if(_0x3d9efa>=_0x5a380c){_0x3d9efa=_0x5a380c;_0x3a15cc=0xc8;}else{_0x3a15cc=0xce;}_0x178293['status'](_0x3a15cc);return _0x178293[_0x9b46('0x1c')](_0x9b46('0x1d'),_0x5c5cc9+'-'+_0x3d9efa+'/'+_0x5a380c)['json'](_0x135cc2);}return null;};}function patchUpdates(_0x55aece){return function(_0xbec2ea){try{jsonpatch[_0x9b46('0x1e')](_0xbec2ea,_0x55aece,!![]);}catch(_0x204098){return BPromise['reject'](_0x204098);}return _0xbec2ea['save']();};}function saveUpdates(_0x2b3440,_0x51d2ca){return function(_0x21dacb){if(_0x21dacb){return _0x21dacb[_0x9b46('0x1f')](_0x2b3440)['then'](function(_0xadff19){return _0xadff19;});}return null;};}function removeEntity(_0x5182b1,_0x141cb6){return function(_0x2b6f72){if(_0x2b6f72){return _0x2b6f72['destroy']()[_0x9b46('0x20')](function(){_0x5182b1[_0x9b46('0x16')](0xcc)[_0x9b46('0x17')]();});}};}function handleEntityNotFound(_0x319930,_0x33ea06){return function(_0x3e4899){if(!_0x3e4899){_0x319930[_0x9b46('0x15')](0x194);}return _0x3e4899;};}function handleError(_0x5dc377,_0xdd756c){_0xdd756c=_0xdd756c||0x1f4;return function(_0x3ac37e){logger[_0x9b46('0x21')](_0x3ac37e[_0x9b46('0x22')]);if(_0x3ac37e[_0x9b46('0x23')]){delete _0x3ac37e[_0x9b46('0x23')];}_0x5dc377[_0x9b46('0x16')](_0xdd756c)['send'](_0x3ac37e);};}exports[_0x9b46('0x24')]=function(_0xee519e,_0x3630bf){var _0x376ccc={},_0x28b289={},_0x869993={'count':0x0,'rows':[]};var _0xc062ec=_[_0x9b46('0x25')](db[_0x9b46('0x26')][_0x9b46('0x27')],function(_0x2e1c51){return{'name':_0x2e1c51['fieldName'],'type':_0x2e1c51[_0x9b46('0x28')][_0x9b46('0x29')]};});_0x28b289[_0x9b46('0x2a')]=_[_0x9b46('0x25')](_0xc062ec,_0x9b46('0x23'));_0x28b289[_0x9b46('0x2b')]=_[_0x9b46('0x2c')](_0xee519e[_0x9b46('0x2b')]);_0x28b289[_0x9b46('0x2d')]=_[_0x9b46('0x2e')](_0x28b289[_0x9b46('0x2a')],_0x28b289['query']);_0x376ccc[_0x9b46('0x2f')]=_['intersection'](_0x28b289[_0x9b46('0x2a')],qs[_0x9b46('0x30')](_0xee519e[_0x9b46('0x2b')]['fields']));_0x376ccc[_0x9b46('0x2f')]=_0x376ccc[_0x9b46('0x2f')][_0x9b46('0x31')]?_0x376ccc[_0x9b46('0x2f')]:_0x28b289[_0x9b46('0x2a')];if(!_0xee519e['query']['hasOwnProperty'](_0x9b46('0x32'))){_0x376ccc[_0x9b46('0x1b')]=qs[_0x9b46('0x1b')](_0xee519e[_0x9b46('0x2b')]['limit']);_0x376ccc[_0x9b46('0x33')]=qs['offset'](_0xee519e[_0x9b46('0x2b')][_0x9b46('0x33')]);}_0x376ccc[_0x9b46('0x34')]=qs[_0x9b46('0x35')](_0xee519e['query'][_0x9b46('0x35')]);_0x376ccc['where']=qs[_0x9b46('0x2d')](_[_0x9b46('0x36')](_0xee519e[_0x9b46('0x2b')],_0x28b289[_0x9b46('0x2d')]),_0xc062ec);if(_0xee519e[_0x9b46('0x2b')][_0x9b46('0x37')]){_0x376ccc[_0x9b46('0x38')]=_[_0x9b46('0x39')](_0x376ccc[_0x9b46('0x38')],{'$or':_[_0x9b46('0x25')](_0xc062ec,function(_0x1c4147){if(_0x1c4147['type']!==_0x9b46('0x3a')){var _0x5aac02={};_0x5aac02[_0x1c4147[_0x9b46('0x23')]]={'$like':'%'+_0xee519e[_0x9b46('0x2b')]['filter']+'%'};return _0x5aac02;}})});}_0x376ccc=_[_0x9b46('0x39')]({},_0x376ccc,_0xee519e['options']);var _0x416538={'where':_0x376ccc['where']};return db[_0x9b46('0x26')][_0x9b46('0x1a')](_0x416538)[_0x9b46('0x20')](function(_0x22ab5d){_0x869993[_0x9b46('0x1a')]=_0x22ab5d;if(_0xee519e['query']['includeAll']){_0x376ccc[_0x9b46('0x3b')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x376ccc);})['then'](function(_0x4e1911){_0x869993[_0x9b46('0x3c')]=_0x4e1911;return _0x869993;})['then'](respondWithFilteredResult(_0x3630bf,_0x376ccc))[_0x9b46('0x3d')](handleError(_0x3630bf,null));};exports['show']=function(_0x3fa46c,_0xe807bf){var _0x2e92aa={'raw':!![],'where':{'id':_0x3fa46c[_0x9b46('0x3e')]['id']}},_0xa14b={};_0xa14b[_0x9b46('0x2a')]=_[_0x9b46('0x2c')](db[_0x9b46('0x26')][_0x9b46('0x27')]);_0xa14b['query']=_[_0x9b46('0x2c')](_0x3fa46c[_0x9b46('0x2b')]);_0xa14b[_0x9b46('0x2d')]=_[_0x9b46('0x2e')](_0xa14b[_0x9b46('0x2a')],_0xa14b[_0x9b46('0x2b')]);_0x2e92aa[_0x9b46('0x2f')]=_[_0x9b46('0x2e')](_0xa14b[_0x9b46('0x2a')],qs[_0x9b46('0x30')](_0x3fa46c[_0x9b46('0x2b')][_0x9b46('0x30')]));_0x2e92aa[_0x9b46('0x2f')]=_0x2e92aa[_0x9b46('0x2f')]['length']?_0x2e92aa['attributes']:_0xa14b[_0x9b46('0x2a')];if(_0x3fa46c[_0x9b46('0x2b')][_0x9b46('0x3f')]){_0x2e92aa['include']=[{'all':!![]}];}_0x2e92aa=_['merge']({},_0x2e92aa,_0x3fa46c[_0x9b46('0x40')]);return db[_0x9b46('0x26')][_0x9b46('0x41')](_0x2e92aa)[_0x9b46('0x20')](handleEntityNotFound(_0xe807bf,null))[_0x9b46('0x20')](respondWithResult(_0xe807bf,null))[_0x9b46('0x3d')](handleError(_0xe807bf,null));};exports['create']=function(_0x6d1e73,_0x32e34d){return db[_0x9b46('0x26')]['create'](_0x6d1e73[_0x9b46('0x42')],{})['then'](respondWithResult(_0x32e34d,0xc9))[_0x9b46('0x3d')](handleError(_0x32e34d,null));};exports[_0x9b46('0x1f')]=function(_0x16e6d8,_0x566bad){if(_0x16e6d8[_0x9b46('0x42')]['id']){delete _0x16e6d8[_0x9b46('0x42')]['id'];}return db[_0x9b46('0x26')][_0x9b46('0x41')]({'where':{'id':_0x16e6d8[_0x9b46('0x3e')]['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x566bad,null))['then'](saveUpdates(_0x16e6d8[_0x9b46('0x42')],null))[_0x9b46('0x20')](respondWithResult(_0x566bad,null))[_0x9b46('0x3d')](handleError(_0x566bad,null));};exports[_0x9b46('0x43')]=function(_0x362311,_0x36a492){return db['FreshdeskField'][_0x9b46('0x41')]({'where':{'id':_0x362311['params']['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x36a492,null))[_0x9b46('0x20')](removeEntity(_0x36a492,null))[_0x9b46('0x3d')](handleError(_0x36a492,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 59e11b2..b63df1f 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 _0x9251=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','idField','FieldId','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9251,0x1e6));var _0x1925=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0x9251[_0x4ed32d];return _0xf624df;};'use strict';var _=require('lodash');var util=require(_0x1925('0x0'));var logger=require(_0x1925('0x1'))(_0x1925('0x2'));var moment=require(_0x1925('0x3'));var BPromise=require(_0x1925('0x4'));var rp=require(_0x1925('0x5'));var fs=require('fs');var path=require(_0x1925('0x6'));var rimraf=require(_0x1925('0x7'));var config=require(_0x1925('0x8'));var attributes=require(_0x1925('0x9'));module['exports']=function(_0x24af68,_0xe3c3a5){return _0x24af68[_0x1925('0xa')](_0x1925('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x1925('0xc'),_0x1925('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc8c=['rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','moment','request-promise'];(function(_0x1bddad,_0x376905){var _0x58d346=function(_0x1ea804){while(--_0x1ea804){_0x1bddad['push'](_0x1bddad['shift']());}};_0x58d346(++_0x376905);}(_0xdc8c,0xd9));var _0xcdc8=function(_0x458bd0,_0x5f54ad){_0x458bd0=_0x458bd0-0x0;var _0x1f5916=_0xdc8c[_0x458bd0];return _0x1f5916;};'use strict';var _=require(_0xcdc8('0x0'));var util=require(_0xcdc8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcdc8('0x2'));var BPromise=require('bluebird');var rp=require(_0xcdc8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdc8('0x4'));var config=require(_0xcdc8('0x5'));var attributes=require(_0xcdc8('0x6'));module['exports']=function(_0x2808b1,_0x36e0db){return _0x2808b1[_0xcdc8('0x7')](_0xcdc8('0x8'),attributes,{'tableName':_0xcdc8('0x9'),'paranoid':![],'indexes':[{'name':_0xcdc8('0xa'),'fields':[_0xcdc8('0xb'),_0xcdc8('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 514114a..14dfa8f 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 _0xb29b=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0xb29b,0x1ac));var _0xbb29=function(_0xbcf59f,_0x5acaa3){_0xbcf59f=_0xbcf59f-0x0;var _0x163df1=_0xb29b[_0xbcf59f];return _0x163df1;};'use strict';var _=require(_0xbb29('0x0'));var util=require('util');var moment=require(_0xbb29('0x1'));var BPromise=require(_0xbb29('0x2'));var rs=require(_0xbb29('0x3'));var fs=require('fs');var Redis=require(_0xbb29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb29('0x5'));var logger=require('../../config/logger')(_0xbb29('0x6'));var config=require(_0xbb29('0x7'));var jayson=require(_0xbb29('0x8'));var client=jayson[_0xbb29('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc00ad1,_0x4c12c8,_0xf9d743){return new BPromise(function(_0x815285,_0x54398a){return client[_0xbb29('0xa')](_0xc00ad1,_0xf9d743)[_0xbb29('0xb')](function(_0x37b3a1){logger[_0xbb29('0xc')](_0xbb29('0xd'),_0x4c12c8,_0xbb29('0xe'));logger[_0xbb29('0xf')](_0xbb29('0x10'),_0x4c12c8,_0xbb29('0xe'),JSON[_0xbb29('0x11')](_0x37b3a1));if(_0x37b3a1[_0xbb29('0x12')]){if(_0x37b3a1['error']['code']===0x1f4){logger['error'](_0xbb29('0xd'),_0x4c12c8,_0x37b3a1[_0xbb29('0x12')][_0xbb29('0x13')]);return _0x54398a(_0x37b3a1[_0xbb29('0x12')]['message']);}logger['error'](_0xbb29('0xd'),_0x4c12c8,_0x37b3a1['error'][_0xbb29('0x13')]);return _0x815285(_0x37b3a1[_0xbb29('0x12')][_0xbb29('0x13')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x4c12c8,_0xbb29('0xe'));_0x815285(_0x37b3a1['result'][_0xbb29('0x13')]);}})[_0xbb29('0x14')](function(_0x15396a){logger[_0xbb29('0x12')](_0xbb29('0xd'),_0x4c12c8,_0x15396a);_0x54398a(_0x15396a);});});} \ No newline at end of file +var _0x2bd6=['result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2bd6,0x17c));var _0x62bd=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x2bd6[_0x2f3794];return _0x1c9fbe;};'use strict';var _=require(_0x62bd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x62bd('0x1'));var rs=require(_0x62bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62bd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x62bd('0x4'))(_0x62bd('0x5'));var config=require(_0x62bd('0x6'));var jayson=require(_0x62bd('0x7'));var client=jayson[_0x62bd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dc29f,_0x5e963e,_0x543200){return new BPromise(function(_0x50c606,_0x1ab523){return client[_0x62bd('0x9')](_0x2dc29f,_0x543200)[_0x62bd('0xa')](function(_0x2627c1){logger[_0x62bd('0xb')](_0x62bd('0xc'),_0x5e963e,_0x62bd('0xd'));logger[_0x62bd('0xe')](_0x62bd('0xf'),_0x5e963e,_0x62bd('0xd'),JSON[_0x62bd('0x10')](_0x2627c1));if(_0x2627c1[_0x62bd('0x11')]){if(_0x2627c1[_0x62bd('0x11')]['code']===0x1f4){logger['error'](_0x62bd('0xc'),_0x5e963e,_0x2627c1['error'][_0x62bd('0x12')]);return _0x1ab523(_0x2627c1[_0x62bd('0x11')][_0x62bd('0x12')]);}logger[_0x62bd('0x11')](_0x62bd('0xc'),_0x5e963e,_0x2627c1[_0x62bd('0x11')][_0x62bd('0x12')]);return _0x50c606(_0x2627c1[_0x62bd('0x11')]['message']);}else{logger[_0x62bd('0xb')](_0x62bd('0xc'),_0x5e963e,_0x62bd('0xd'));_0x50c606(_0x2627c1[_0x62bd('0x13')][_0x62bd('0x12')]);}})[_0x62bd('0x14')](function(_0x128aa6){logger['error'](_0x62bd('0xc'),_0x5e963e,_0x128aa6);_0x1ab523(_0x128aa6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 2eb3363..e7282fb 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 _0x373d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','update','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x373d,0x1e2));var _0xd373=function(_0x8905ed,_0x130f11){_0x8905ed=_0x8905ed-0x0;var _0x1d86cd=_0x373d[_0x8905ed];return _0x1d86cd;};'use strict';var multer=require(_0xd373('0x0'));var util=require('util');var path=require(_0xd373('0x1'));var timeout=require(_0xd373('0x2'));var express=require(_0xd373('0x3'));var router=express[_0xd373('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd373('0x5'));var interaction=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0xd373('0x8')](),controller[_0xd373('0x9')]);router[_0xd373('0xa')](_0xd373('0xb'),auth['isAuthenticated'](),controller[_0xd373('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xd373('0xd')]);router[_0xd373('0xa')]('/:id/fields',auth[_0xd373('0x8')](),controller[_0xd373('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd373('0xf')]);router[_0xd373('0x10')](_0xd373('0x11'),auth[_0xd373('0x8')](),controller['addConfiguration']);router['put']('/:id',auth[_0xd373('0x8')](),controller[_0xd373('0x12')]);router['delete'](_0xd373('0xb'),auth[_0xd373('0x8')](),controller[_0xd373('0x13')]);module[_0xd373('0x14')]=router; \ No newline at end of file +var _0x39cb=['put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','post','create','addConfiguration'];(function(_0x4e29e5,_0x5ce388){var _0x312749=function(_0x5cce82){while(--_0x5cce82){_0x4e29e5['push'](_0x4e29e5['shift']());}};_0x312749(++_0x5ce388);}(_0x39cb,0x1bd));var _0xb39c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39cb[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb39c('0x4'));var interaction=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var controller=require(_0xb39c('0x7'));router[_0xb39c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb39c('0x9')]);router[_0xb39c('0x8')](_0xb39c('0xa'),auth[_0xb39c('0xb')](),controller['show']);router['get'](_0xb39c('0xc'),auth[_0xb39c('0xb')](),controller[_0xb39c('0xd')]);router[_0xb39c('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xb39c('0xe')]('/',auth[_0xb39c('0xb')](),controller[_0xb39c('0xf')]);router[_0xb39c('0xe')](_0xb39c('0xc'),auth[_0xb39c('0xb')](),controller[_0xb39c('0x10')]);router[_0xb39c('0x11')]('/:id',auth[_0xb39c('0xb')](),controller[_0xb39c('0x12')]);router[_0xb39c('0x13')]('/:id',auth[_0xb39c('0xb')](),controller[_0xb39c('0x14')]);module[_0xb39c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ebdf536..c2affd0 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 _0x77d4=['exports','STRING','username'];(function(_0x566c40,_0x3c2178){var _0x5152ec=function(_0x3e2112){while(--_0x3e2112){_0x566c40['push'](_0x566c40['shift']());}};_0x5152ec(++_0x3c2178);}(_0x77d4,0x108));var _0x477d=function(_0x12dc05,_0x55988f){_0x12dc05=_0x12dc05-0x0;var _0x4489cc=_0x77d4[_0x12dc05];return _0x4489cc;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x477d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x477d('0x2')},'apiKey':{'type':Sequelize[_0x477d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x477d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x7b84,0x17c));var _0x47b8=function(_0x14653b,_0x4cdecc){_0x14653b=_0x14653b-0x0;var _0x25967b=_0x7b84[_0x14653b];return _0x25967b;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index ed16a61..a6ec3a3 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 _0x11f0=['name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','FreshsalesConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','zip-dir','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x11f0,0x1ce));var _0x011f=function(_0x4015cd,_0x5aec08){_0x4015cd=_0x4015cd-0x0;var _0xc157e8=_0x11f0[_0x4015cd];return _0xc157e8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x011f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x011f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x011f('0x2'));var util=require('util');var path=require(_0x011f('0x3'));var sox=require(_0x011f('0x4'));var csv=require(_0x011f('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x011f('0x6'));var squel=require(_0x011f('0x7'));var crypto=require(_0x011f('0x8'));var jsforce=require(_0x011f('0x9'));var deskjs=require(_0x011f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x011f('0xb'));var Papa=require(_0x011f('0xc'));var Redis=require('ioredis');var authService=require(_0x011f('0xd'));var qs=require(_0x011f('0xe'));var as=require(_0x011f('0xf'));var hardwareService=require(_0x011f('0x10'));var logger=require(_0x011f('0x11'))('api');var utils=require(_0x011f('0x12'));var config=require(_0x011f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x011f('0x14'))['db'];var integrations=require(_0x011f('0x15'));function respondWithStatusCode(_0x16b060,_0x171422){_0x171422=_0x171422||0xcc;return function(_0x574bcb){if(_0x574bcb){return _0x16b060['sendStatus'](_0x171422);}return _0x16b060[_0x011f('0x16')](_0x171422)['end']();};}function respondWithResult(_0x5c7a77,_0x35f249){_0x35f249=_0x35f249||0xc8;return function(_0x6000b4){if(_0x6000b4){return _0x5c7a77['status'](_0x35f249)[_0x011f('0x17')](_0x6000b4);}};}function respondWithFilteredResult(_0x132df4,_0x3e0b10){return function(_0x3e545e){if(_0x3e545e){var _0x30dbb3=typeof _0x3e0b10['offset']===_0x011f('0x18')&&typeof _0x3e0b10[_0x011f('0x19')]===_0x011f('0x18');var _0x3d8d27=_0x3e545e[_0x011f('0x1a')];var _0x50c98e=_0x30dbb3?0x0:_0x3e0b10[_0x011f('0x1b')];var _0x7f9760=_0x30dbb3?_0x3e545e[_0x011f('0x1a')]:_0x3e0b10[_0x011f('0x1b')]+_0x3e0b10[_0x011f('0x19')];var _0x222884;if(_0x7f9760>=_0x3d8d27){_0x7f9760=_0x3d8d27;_0x222884=0xc8;}else{_0x222884=0xce;}_0x132df4[_0x011f('0x16')](_0x222884);return _0x132df4[_0x011f('0x1c')]('Content-Range',_0x50c98e+'-'+_0x7f9760+'/'+_0x3d8d27)[_0x011f('0x17')](_0x3e545e);}return null;};}function patchUpdates(_0x5da00b){return function(_0x28f8a8){try{jsonpatch[_0x011f('0x1d')](_0x28f8a8,_0x5da00b,!![]);}catch(_0x3dbdf9){return BPromise[_0x011f('0x1e')](_0x3dbdf9);}return _0x28f8a8[_0x011f('0x1f')]();};}function saveUpdates(_0x1c5a59,_0x23ff76){return function(_0x54c36f){if(_0x54c36f){return _0x54c36f[_0x011f('0x20')](_0x1c5a59)[_0x011f('0x21')](function(_0x601296){return _0x601296;});}return null;};}function removeEntity(_0xcd9096,_0x42a645){return function(_0x57887d){if(_0x57887d){return _0x57887d[_0x011f('0x22')]()[_0x011f('0x21')](function(){_0xcd9096[_0x011f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6d4d62,_0x302fd4){return function(_0x50a56c){if(!_0x50a56c){_0x6d4d62[_0x011f('0x23')](0x194);}return _0x50a56c;};}function handleError(_0xe32e0c,_0x330a7a){_0x330a7a=_0x330a7a||0x1f4;return function(_0xa7ec92){logger[_0x011f('0x24')](_0xa7ec92[_0x011f('0x25')]);if(_0xa7ec92['name']){delete _0xa7ec92[_0x011f('0x26')];}_0xe32e0c[_0x011f('0x16')](_0x330a7a)['send'](_0xa7ec92);};}exports[_0x011f('0x27')]=function(_0x5534d8,_0x3d8f97){var _0x255887={},_0x1b1d6f={},_0xd091db={'count':0x0,'rows':[]};var _0xf9b236=_[_0x011f('0x28')](db[_0x011f('0x29')][_0x011f('0x2a')],function(_0x59b0d5){return{'name':_0x59b0d5[_0x011f('0x2b')],'type':_0x59b0d5[_0x011f('0x2c')][_0x011f('0x2d')]};});_0x1b1d6f[_0x011f('0x2e')]=_[_0x011f('0x28')](_0xf9b236,_0x011f('0x26'));_0x1b1d6f[_0x011f('0x2f')]=_[_0x011f('0x30')](_0x5534d8['query']);_0x1b1d6f[_0x011f('0x31')]=_[_0x011f('0x32')](_0x1b1d6f[_0x011f('0x2e')],_0x1b1d6f[_0x011f('0x2f')]);_0x255887[_0x011f('0x33')]=_[_0x011f('0x32')](_0x1b1d6f[_0x011f('0x2e')],qs['fields'](_0x5534d8[_0x011f('0x2f')][_0x011f('0x34')]));_0x255887[_0x011f('0x33')]=_0x255887[_0x011f('0x33')][_0x011f('0x35')]?_0x255887['attributes']:_0x1b1d6f[_0x011f('0x2e')];if(!_0x5534d8['query'][_0x011f('0x36')](_0x011f('0x37'))){_0x255887[_0x011f('0x19')]=qs[_0x011f('0x19')](_0x5534d8[_0x011f('0x2f')][_0x011f('0x19')]);_0x255887[_0x011f('0x1b')]=qs[_0x011f('0x1b')](_0x5534d8[_0x011f('0x2f')][_0x011f('0x1b')]);}_0x255887['order']=qs[_0x011f('0x38')](_0x5534d8['query'][_0x011f('0x38')]);_0x255887[_0x011f('0x39')]=qs[_0x011f('0x31')](_[_0x011f('0x3a')](_0x5534d8['query'],_0x1b1d6f[_0x011f('0x31')]),_0xf9b236);if(_0x5534d8['query'][_0x011f('0x3b')]){_0x255887['where']=_[_0x011f('0x3c')](_0x255887['where'],{'$or':_[_0x011f('0x28')](_0xf9b236,function(_0x6a7b92){if(_0x6a7b92[_0x011f('0x2c')]!=='VIRTUAL'){var _0x1ec7d6={};_0x1ec7d6[_0x6a7b92['name']]={'$like':'%'+_0x5534d8['query']['filter']+'%'};return _0x1ec7d6;}})});}_0x255887=_[_0x011f('0x3c')]({},_0x255887,_0x5534d8[_0x011f('0x3d')]);var _0x78f0fc={'where':_0x255887[_0x011f('0x39')]};return db[_0x011f('0x29')][_0x011f('0x1a')](_0x78f0fc)[_0x011f('0x21')](function(_0x3d2524){_0xd091db[_0x011f('0x1a')]=_0x3d2524;if(_0x5534d8[_0x011f('0x2f')][_0x011f('0x3e')]){_0x255887[_0x011f('0x3f')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x011f('0x40')](_0x255887);})[_0x011f('0x21')](function(_0x3642e3){_0xd091db[_0x011f('0x41')]=_0x3642e3;return _0xd091db;})[_0x011f('0x21')](respondWithFilteredResult(_0x3d8f97,_0x255887))['catch'](handleError(_0x3d8f97,null));};exports[_0x011f('0x42')]=function(_0x413229,_0x51346f){var _0x3fa06f={'raw':![],'where':{'id':_0x413229[_0x011f('0x43')]['id']}},_0x24f539={};_0x24f539['model']=_[_0x011f('0x30')](db[_0x011f('0x29')][_0x011f('0x2a')]);_0x24f539[_0x011f('0x2f')]=_[_0x011f('0x30')](_0x413229[_0x011f('0x2f')]);_0x24f539[_0x011f('0x31')]=_['intersection'](_0x24f539[_0x011f('0x2e')],_0x24f539[_0x011f('0x2f')]);_0x3fa06f[_0x011f('0x33')]=_['intersection'](_0x24f539[_0x011f('0x2e')],qs[_0x011f('0x34')](_0x413229[_0x011f('0x2f')][_0x011f('0x34')]));_0x3fa06f[_0x011f('0x33')]=_0x3fa06f[_0x011f('0x33')][_0x011f('0x35')]?_0x3fa06f[_0x011f('0x33')]:_0x24f539['model'];if(_0x413229['query']['includeAll']){_0x3fa06f[_0x011f('0x3f')]=[{'all':!![]}];}_0x3fa06f=_[_0x011f('0x3c')]({},_0x3fa06f,_0x413229[_0x011f('0x3d')]);return db[_0x011f('0x29')][_0x011f('0x44')](_0x3fa06f)[_0x011f('0x21')](handleEntityNotFound(_0x51346f,null))[_0x011f('0x21')](respondWithResult(_0x51346f,null))[_0x011f('0x45')](handleError(_0x51346f,null));};exports['create']=function(_0x4469f1,_0x10b330){return db[_0x011f('0x29')][_0x011f('0x46')](_0x4469f1[_0x011f('0x47')],{})[_0x011f('0x21')](respondWithResult(_0x10b330,0xc9))[_0x011f('0x45')](handleError(_0x10b330,null));};exports['update']=function(_0x1946a3,_0x454638){if(_0x1946a3[_0x011f('0x47')]['id']){delete _0x1946a3['body']['id'];}return db[_0x011f('0x29')][_0x011f('0x44')]({'where':{'id':_0x1946a3[_0x011f('0x43')]['id']}})[_0x011f('0x21')](handleEntityNotFound(_0x454638,null))[_0x011f('0x21')](saveUpdates(_0x1946a3[_0x011f('0x47')],null))['then'](respondWithResult(_0x454638,null))[_0x011f('0x45')](handleError(_0x454638,null));};exports[_0x011f('0x22')]=function(_0x25c346,_0x2a192c){return db[_0x011f('0x29')][_0x011f('0x44')]({'where':{'id':_0x25c346[_0x011f('0x43')]['id']}})[_0x011f('0x21')](handleEntityNotFound(_0x2a192c,null))['then'](removeEntity(_0x2a192c,null))[_0x011f('0x45')](handleError(_0x2a192c,null));};exports[_0x011f('0x48')]=function(_0x3a06d7,_0x56e670,_0x6bd344){var _0x1b0318={};var _0x563171={};var _0x1e37cb;var _0x1162e2;return db['FreshsalesAccount'][_0x011f('0x49')]({'where':{'id':_0x3a06d7[_0x011f('0x43')]['id']}})[_0x011f('0x21')](handleEntityNotFound(_0x56e670,null))['then'](function(_0x44c0a0){if(_0x44c0a0){_0x1e37cb=_0x44c0a0;_0x563171['model']=_[_0x011f('0x30')](db[_0x011f('0x4a')][_0x011f('0x2a')]);_0x563171[_0x011f('0x2f')]=_['keys'](_0x3a06d7['query']);_0x563171[_0x011f('0x31')]=_[_0x011f('0x32')](_0x563171[_0x011f('0x2e')],_0x563171[_0x011f('0x2f')]);_0x1b0318[_0x011f('0x33')]=_['intersection'](_0x563171[_0x011f('0x2e')],qs[_0x011f('0x34')](_0x3a06d7[_0x011f('0x2f')][_0x011f('0x34')]));_0x1b0318[_0x011f('0x33')]=_0x1b0318[_0x011f('0x33')][_0x011f('0x35')]?_0x1b0318[_0x011f('0x33')]:_0x563171['model'];_0x1b0318[_0x011f('0x4b')]=qs['sort'](_0x3a06d7['query'][_0x011f('0x38')]);_0x1b0318[_0x011f('0x39')]=qs[_0x011f('0x31')](_[_0x011f('0x3a')](_0x3a06d7[_0x011f('0x2f')],_0x563171[_0x011f('0x31')]));if(_0x3a06d7['query'][_0x011f('0x3b')]){_0x1b0318[_0x011f('0x39')]=_[_0x011f('0x3c')](_0x1b0318[_0x011f('0x39')],{'$or':_[_0x011f('0x28')](_0x1b0318[_0x011f('0x33')],function(_0x375aa4){var _0x500209={};_0x500209[_0x375aa4]={'$like':'%'+_0x3a06d7[_0x011f('0x2f')]['filter']+'%'};return _0x500209;})});}_0x1b0318=_[_0x011f('0x3c')]({},_0x1b0318,_0x3a06d7[_0x011f('0x3d')]);return _0x1e37cb[_0x011f('0x48')](_0x1b0318);}})[_0x011f('0x21')](function(_0x1358c4){if(_0x1358c4){_0x1162e2=_0x1358c4[_0x011f('0x35')];if(!_0x3a06d7[_0x011f('0x2f')][_0x011f('0x36')](_0x011f('0x37'))){_0x1b0318[_0x011f('0x19')]=qs[_0x011f('0x19')](_0x3a06d7['query'][_0x011f('0x19')]);_0x1b0318['offset']=qs[_0x011f('0x1b')](_0x3a06d7[_0x011f('0x2f')]['offset']);}return _0x1e37cb['getConfigurations'](_0x1b0318);}})[_0x011f('0x21')](function(_0x68c7e4){if(_0x68c7e4){return _0x68c7e4?{'count':_0x1162e2,'rows':_0x68c7e4}:null;}})[_0x011f('0x21')](respondWithResult(_0x56e670,null))[_0x011f('0x45')](handleError(_0x56e670,null));};exports[_0x011f('0x4c')]=function(_0xffc6c1,_0x4f6c63,_0x73ee1d){if(_0xffc6c1[_0x011f('0x47')]['id']){delete _0xffc6c1['body']['id'];}return db[_0x011f('0x29')]['findOne']({'where':{'id':_0xffc6c1[_0x011f('0x43')]['id']}})[_0x011f('0x21')](handleEntityNotFound(_0x4f6c63,null))['then'](function(_0x17b33c){if(_0x17b33c){_0xffc6c1[_0x011f('0x47')][_0x011f('0x4d')]=_0x17b33c['id'];_0xffc6c1[_0x011f('0x47')][_0x011f('0x4e')]=integrations[_0x011f('0x4f')](_0xffc6c1[_0x011f('0x47')]['channel'],_0xffc6c1[_0x011f('0x47')][_0x011f('0x2c')]);_0xffc6c1[_0x011f('0x47')][_0x011f('0x50')]=integrations[_0x011f('0x51')](_0xffc6c1[_0x011f('0x47')]['channel'],_0xffc6c1[_0x011f('0x47')][_0x011f('0x2c')]);return db['FreshsalesConfiguration'][_0x011f('0x46')](_0xffc6c1['body'],{'include':[{'model':db[_0x011f('0x52')],'as':_0x011f('0x4e')},{'model':db[_0x011f('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4f6c63,null))[_0x011f('0x45')](handleError(_0x4f6c63,null));};exports[_0x011f('0x53')]=function(_0x39a5cd,_0x3a8f6e,_0x3caf7d){var _0xd1ab5e='';var _0xac2d4d='';return db[_0x011f('0x29')][_0x011f('0x49')]({'where':{'id':_0x39a5cd[_0x011f('0x43')]['id']},'attributes':['id',_0x011f('0x54'),_0x011f('0x55'),_0x011f('0x56')]})[_0x011f('0x21')](handleEntityNotFound(_0x3a8f6e,null))[_0x011f('0x21')](function(_0x91f62c){if(_0x91f62c){_0xac2d4d=_0x91f62c[_0x011f('0x54')];_0xd1ab5e=_0x91f62c[_0x011f('0x55')];var _0x5f0e6d=_0x91f62c[_0x011f('0x55')][_0x011f('0x57')](-0x1);if(_0x5f0e6d==='/'){_0xd1ab5e=_0xd1ab5e[_0x011f('0x58')](0x0,_0xd1ab5e[_0x011f('0x59')](_0x5f0e6d));}return rp({'method':_0x011f('0x5a'),'uri':util[_0x011f('0x5b')](_0x011f('0x5c'),_0xd1ab5e,_0x011f('0x5d')),'headers':{'Authorization':'Token\x20token='+_0x91f62c[_0x011f('0x56')]},'json':!![]});}})['then'](function(_0x5ec44d){if(_0x5ec44d){var _0x5c5f6d=_0x5ec44d[_0x011f('0x5e')];var _0xfb16f=![];var _0x535e26=null;for(_0x535e26=0x0;_0x535e26<_0x5c5f6d[_0x011f('0x35')];_0x535e26++){if(_0x5c5f6d[_0x535e26]['email']===_0xac2d4d){_0xfb16f=!![];}}if(_0xfb16f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x011f('0x21')](respondWithResult(_0x3a8f6e,null))[_0x011f('0x45')](function(_0x397cb4){var _0x1f19ca=_0x39a5cd[_0x011f('0x2f')][_0x011f('0x5f')]?0x1f4:_0x397cb4[_0x011f('0x60')]||0x1f4;logger[_0x011f('0x24')](_0x011f('0x61'),'getFields',_0x1f19ca,JSON[_0x011f('0x62')](_0x397cb4));delete _0x397cb4[_0x011f('0x26')];if(_0x1f19ca===0x191){_0x1f19ca=0x190;}_0x3a8f6e['status'](_0x1f19ca)[_0x011f('0x63')](_0x39a5cd[_0x011f('0x2f')][_0x011f('0x5f')]?{'message':'Wrong\x20credentials','statusCode':_0x397cb4[_0x011f('0x60')]}:_0x397cb4);});}; \ No newline at end of file +var _0xa778=['username','remoteUri','apiKey','slice','substring','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','FreshsalesAccount','includeAll','rows','catch','show','fields','include','options','find','create','body','params','getConfigurations','FreshsalesConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','FreshsalesField'];(function(_0x46d7b2,_0x547b66){var _0x5a6376=function(_0x20ce4d){while(--_0x20ce4d){_0x46d7b2['push'](_0x46d7b2['shift']());}};_0x5a6376(++_0x547b66);}(_0xa778,0x14d));var _0x8a77=function(_0x44a783,_0x11b91d){_0x44a783=_0x44a783-0x0;var _0x24b728=_0xa778[_0x44a783];return _0x24b728;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a77('0x0'));var zipdir=require(_0x8a77('0x1'));var jsonpatch=require(_0x8a77('0x2'));var rp=require('request-promise');var moment=require(_0x8a77('0x3'));var BPromise=require(_0x8a77('0x4'));var Mustache=require(_0x8a77('0x5'));var util=require(_0x8a77('0x6'));var path=require(_0x8a77('0x7'));var sox=require(_0x8a77('0x8'));var csv=require(_0x8a77('0x9'));var ejs=require(_0x8a77('0xa'));var fs=require('fs');var fs_extra=require(_0x8a77('0xb'));var _=require(_0x8a77('0xc'));var squel=require(_0x8a77('0xd'));var crypto=require(_0x8a77('0xe'));var jsforce=require(_0x8a77('0xf'));var deskjs=require(_0x8a77('0x10'));var toCsv=require(_0x8a77('0x9'));var querystring=require(_0x8a77('0x11'));var Papa=require(_0x8a77('0x12'));var Redis=require(_0x8a77('0x13'));var authService=require(_0x8a77('0x14'));var qs=require(_0x8a77('0x15'));var as=require(_0x8a77('0x16'));var hardwareService=require(_0x8a77('0x17'));var logger=require(_0x8a77('0x18'))(_0x8a77('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8a77('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8a77('0x1b'));function respondWithStatusCode(_0x169541,_0x3329c3){_0x3329c3=_0x3329c3||0xcc;return function(_0x31743d){if(_0x31743d){return _0x169541['sendStatus'](_0x3329c3);}return _0x169541[_0x8a77('0x1c')](_0x3329c3)[_0x8a77('0x1d')]();};}function respondWithResult(_0x468ee7,_0x59a334){_0x59a334=_0x59a334||0xc8;return function(_0x43fc21){if(_0x43fc21){return _0x468ee7[_0x8a77('0x1c')](_0x59a334)['json'](_0x43fc21);}};}function respondWithFilteredResult(_0x508866,_0x3a1396){return function(_0x38e150){if(_0x38e150){var _0x515770=typeof _0x3a1396[_0x8a77('0x1e')]===_0x8a77('0x1f')&&typeof _0x3a1396[_0x8a77('0x20')]===_0x8a77('0x1f');var _0x372b30=_0x38e150[_0x8a77('0x21')];var _0x30b2d1=_0x515770?0x0:_0x3a1396[_0x8a77('0x1e')];var _0x3ef19b=_0x515770?_0x38e150[_0x8a77('0x21')]:_0x3a1396[_0x8a77('0x1e')]+_0x3a1396[_0x8a77('0x20')];var _0x1c500e;if(_0x3ef19b>=_0x372b30){_0x3ef19b=_0x372b30;_0x1c500e=0xc8;}else{_0x1c500e=0xce;}_0x508866[_0x8a77('0x1c')](_0x1c500e);return _0x508866[_0x8a77('0x22')]('Content-Range',_0x30b2d1+'-'+_0x3ef19b+'/'+_0x372b30)['json'](_0x38e150);}return null;};}function patchUpdates(_0x3f2d07){return function(_0x344700){try{jsonpatch[_0x8a77('0x23')](_0x344700,_0x3f2d07,!![]);}catch(_0x525242){return BPromise[_0x8a77('0x24')](_0x525242);}return _0x344700[_0x8a77('0x25')]();};}function saveUpdates(_0x497131,_0x46f549){return function(_0x11013d){if(_0x11013d){return _0x11013d[_0x8a77('0x26')](_0x497131)['then'](function(_0x4e2ea4){return _0x4e2ea4;});}return null;};}function removeEntity(_0x6908a1,_0x2d8f8f){return function(_0x159982){if(_0x159982){return _0x159982[_0x8a77('0x27')]()[_0x8a77('0x28')](function(){_0x6908a1['status'](0xcc)[_0x8a77('0x1d')]();});}};}function handleEntityNotFound(_0x34aae1,_0x3aeeee){return function(_0x3d44c5){if(!_0x3d44c5){_0x34aae1[_0x8a77('0x29')](0x194);}return _0x3d44c5;};}function handleError(_0x1f9316,_0x295d8f){_0x295d8f=_0x295d8f||0x1f4;return function(_0x142747){logger['error'](_0x142747[_0x8a77('0x2a')]);if(_0x142747[_0x8a77('0x2b')]){delete _0x142747['name'];}_0x1f9316[_0x8a77('0x1c')](_0x295d8f)['send'](_0x142747);};}exports[_0x8a77('0x2c')]=function(_0x264e8b,_0x4f1936){var _0x545032={},_0x1752c6={},_0x35d1aa={'count':0x0,'rows':[]};var _0x24fd7d=_[_0x8a77('0x2d')](db['FreshsalesAccount'][_0x8a77('0x2e')],function(_0x134231){return{'name':_0x134231[_0x8a77('0x2f')],'type':_0x134231[_0x8a77('0x30')][_0x8a77('0x31')]};});_0x1752c6[_0x8a77('0x32')]=_[_0x8a77('0x2d')](_0x24fd7d,'name');_0x1752c6['query']=_[_0x8a77('0x33')](_0x264e8b[_0x8a77('0x34')]);_0x1752c6[_0x8a77('0x35')]=_[_0x8a77('0x36')](_0x1752c6[_0x8a77('0x32')],_0x1752c6[_0x8a77('0x34')]);_0x545032[_0x8a77('0x37')]=_[_0x8a77('0x36')](_0x1752c6[_0x8a77('0x32')],qs['fields'](_0x264e8b['query']['fields']));_0x545032[_0x8a77('0x37')]=_0x545032['attributes'][_0x8a77('0x38')]?_0x545032['attributes']:_0x1752c6['model'];if(!_0x264e8b[_0x8a77('0x34')]['hasOwnProperty'](_0x8a77('0x39'))){_0x545032[_0x8a77('0x20')]=qs['limit'](_0x264e8b[_0x8a77('0x34')][_0x8a77('0x20')]);_0x545032['offset']=qs['offset'](_0x264e8b[_0x8a77('0x34')]['offset']);}_0x545032[_0x8a77('0x3a')]=qs[_0x8a77('0x3b')](_0x264e8b[_0x8a77('0x34')][_0x8a77('0x3b')]);_0x545032['where']=qs[_0x8a77('0x35')](_[_0x8a77('0x3c')](_0x264e8b[_0x8a77('0x34')],_0x1752c6['filters']),_0x24fd7d);if(_0x264e8b[_0x8a77('0x34')][_0x8a77('0x3d')]){_0x545032[_0x8a77('0x3e')]=_[_0x8a77('0x3f')](_0x545032[_0x8a77('0x3e')],{'$or':_[_0x8a77('0x2d')](_0x24fd7d,function(_0x2abcb9){if(_0x2abcb9[_0x8a77('0x30')]!==_0x8a77('0x40')){var _0xa76a0e={};_0xa76a0e[_0x2abcb9[_0x8a77('0x2b')]]={'$like':'%'+_0x264e8b[_0x8a77('0x34')]['filter']+'%'};return _0xa76a0e;}})});}_0x545032=_[_0x8a77('0x3f')]({},_0x545032,_0x264e8b['options']);var _0x4d2139={'where':_0x545032['where']};return db[_0x8a77('0x41')][_0x8a77('0x21')](_0x4d2139)['then'](function(_0x1220d6){_0x35d1aa[_0x8a77('0x21')]=_0x1220d6;if(_0x264e8b[_0x8a77('0x34')][_0x8a77('0x42')]){_0x545032['include']=[{'all':!![]}];}return db[_0x8a77('0x41')]['findAll'](_0x545032);})[_0x8a77('0x28')](function(_0x533adf){_0x35d1aa[_0x8a77('0x43')]=_0x533adf;return _0x35d1aa;})[_0x8a77('0x28')](respondWithFilteredResult(_0x4f1936,_0x545032))[_0x8a77('0x44')](handleError(_0x4f1936,null));};exports[_0x8a77('0x45')]=function(_0x36079e,_0x386e13){var _0x19cf21={'raw':![],'where':{'id':_0x36079e['params']['id']}},_0x1ae3cd={};_0x1ae3cd[_0x8a77('0x32')]=_['keys'](db[_0x8a77('0x41')][_0x8a77('0x2e')]);_0x1ae3cd['query']=_[_0x8a77('0x33')](_0x36079e[_0x8a77('0x34')]);_0x1ae3cd[_0x8a77('0x35')]=_[_0x8a77('0x36')](_0x1ae3cd[_0x8a77('0x32')],_0x1ae3cd[_0x8a77('0x34')]);_0x19cf21[_0x8a77('0x37')]=_[_0x8a77('0x36')](_0x1ae3cd[_0x8a77('0x32')],qs[_0x8a77('0x46')](_0x36079e[_0x8a77('0x34')][_0x8a77('0x46')]));_0x19cf21[_0x8a77('0x37')]=_0x19cf21[_0x8a77('0x37')]['length']?_0x19cf21[_0x8a77('0x37')]:_0x1ae3cd[_0x8a77('0x32')];if(_0x36079e[_0x8a77('0x34')][_0x8a77('0x42')]){_0x19cf21[_0x8a77('0x47')]=[{'all':!![]}];}_0x19cf21=_['merge']({},_0x19cf21,_0x36079e[_0x8a77('0x48')]);return db['FreshsalesAccount'][_0x8a77('0x49')](_0x19cf21)[_0x8a77('0x28')](handleEntityNotFound(_0x386e13,null))[_0x8a77('0x28')](respondWithResult(_0x386e13,null))['catch'](handleError(_0x386e13,null));};exports[_0x8a77('0x4a')]=function(_0x5e3182,_0x348e8c){return db['FreshsalesAccount'][_0x8a77('0x4a')](_0x5e3182['body'],{})[_0x8a77('0x28')](respondWithResult(_0x348e8c,0xc9))['catch'](handleError(_0x348e8c,null));};exports[_0x8a77('0x26')]=function(_0x53e0e3,_0x24e3bc){if(_0x53e0e3[_0x8a77('0x4b')]['id']){delete _0x53e0e3[_0x8a77('0x4b')]['id'];}return db[_0x8a77('0x41')]['find']({'where':{'id':_0x53e0e3[_0x8a77('0x4c')]['id']}})[_0x8a77('0x28')](handleEntityNotFound(_0x24e3bc,null))[_0x8a77('0x28')](saveUpdates(_0x53e0e3[_0x8a77('0x4b')],null))['then'](respondWithResult(_0x24e3bc,null))[_0x8a77('0x44')](handleError(_0x24e3bc,null));};exports[_0x8a77('0x27')]=function(_0x5264d,_0x16a6ce){return db[_0x8a77('0x41')]['find']({'where':{'id':_0x5264d[_0x8a77('0x4c')]['id']}})[_0x8a77('0x28')](handleEntityNotFound(_0x16a6ce,null))[_0x8a77('0x28')](removeEntity(_0x16a6ce,null))['catch'](handleError(_0x16a6ce,null));};exports[_0x8a77('0x4d')]=function(_0x1d195f,_0x11c2db,_0x3a1322){var _0x14bd4d={};var _0x4c0aed={};var _0xc96ff7;var _0x2b0f6c;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x1d195f[_0x8a77('0x4c')]['id']}})[_0x8a77('0x28')](handleEntityNotFound(_0x11c2db,null))[_0x8a77('0x28')](function(_0x4d4f70){if(_0x4d4f70){_0xc96ff7=_0x4d4f70;_0x4c0aed[_0x8a77('0x32')]=_[_0x8a77('0x33')](db[_0x8a77('0x4e')][_0x8a77('0x2e')]);_0x4c0aed[_0x8a77('0x34')]=_[_0x8a77('0x33')](_0x1d195f[_0x8a77('0x34')]);_0x4c0aed[_0x8a77('0x35')]=_[_0x8a77('0x36')](_0x4c0aed[_0x8a77('0x32')],_0x4c0aed[_0x8a77('0x34')]);_0x14bd4d['attributes']=_[_0x8a77('0x36')](_0x4c0aed['model'],qs['fields'](_0x1d195f['query'][_0x8a77('0x46')]));_0x14bd4d[_0x8a77('0x37')]=_0x14bd4d[_0x8a77('0x37')][_0x8a77('0x38')]?_0x14bd4d[_0x8a77('0x37')]:_0x4c0aed['model'];_0x14bd4d[_0x8a77('0x3a')]=qs[_0x8a77('0x3b')](_0x1d195f['query'][_0x8a77('0x3b')]);_0x14bd4d['where']=qs['filters'](_[_0x8a77('0x3c')](_0x1d195f['query'],_0x4c0aed[_0x8a77('0x35')]));if(_0x1d195f[_0x8a77('0x34')][_0x8a77('0x3d')]){_0x14bd4d[_0x8a77('0x3e')]=_[_0x8a77('0x3f')](_0x14bd4d[_0x8a77('0x3e')],{'$or':_[_0x8a77('0x2d')](_0x14bd4d[_0x8a77('0x37')],function(_0x3f04e9){var _0x569a66={};_0x569a66[_0x3f04e9]={'$like':'%'+_0x1d195f[_0x8a77('0x34')][_0x8a77('0x3d')]+'%'};return _0x569a66;})});}_0x14bd4d=_['merge']({},_0x14bd4d,_0x1d195f[_0x8a77('0x48')]);return _0xc96ff7['getConfigurations'](_0x14bd4d);}})[_0x8a77('0x28')](function(_0x487bbd){if(_0x487bbd){_0x2b0f6c=_0x487bbd['length'];if(!_0x1d195f[_0x8a77('0x34')]['hasOwnProperty'](_0x8a77('0x39'))){_0x14bd4d[_0x8a77('0x20')]=qs[_0x8a77('0x20')](_0x1d195f['query'][_0x8a77('0x20')]);_0x14bd4d[_0x8a77('0x1e')]=qs[_0x8a77('0x1e')](_0x1d195f[_0x8a77('0x34')][_0x8a77('0x1e')]);}return _0xc96ff7[_0x8a77('0x4d')](_0x14bd4d);}})[_0x8a77('0x28')](function(_0x25cf10){if(_0x25cf10){return _0x25cf10?{'count':_0x2b0f6c,'rows':_0x25cf10}:null;}})['then'](respondWithResult(_0x11c2db,null))[_0x8a77('0x44')](handleError(_0x11c2db,null));};exports['addConfiguration']=function(_0xbe397d,_0x21e02e,_0xe6940){if(_0xbe397d[_0x8a77('0x4b')]['id']){delete _0xbe397d[_0x8a77('0x4b')]['id'];}return db[_0x8a77('0x41')][_0x8a77('0x4f')]({'where':{'id':_0xbe397d[_0x8a77('0x4c')]['id']}})[_0x8a77('0x28')](handleEntityNotFound(_0x21e02e,null))[_0x8a77('0x28')](function(_0x1ea88b){if(_0x1ea88b){_0xbe397d[_0x8a77('0x4b')][_0x8a77('0x50')]=_0x1ea88b['id'];_0xbe397d[_0x8a77('0x4b')]['Subjects']=integrations[_0x8a77('0x51')](_0xbe397d['body'][_0x8a77('0x52')],_0xbe397d[_0x8a77('0x4b')][_0x8a77('0x30')]);_0xbe397d[_0x8a77('0x4b')][_0x8a77('0x53')]=integrations[_0x8a77('0x54')](_0xbe397d['body']['channel'],_0xbe397d['body'][_0x8a77('0x30')]);return db['FreshsalesConfiguration'][_0x8a77('0x4a')](_0xbe397d[_0x8a77('0x4b')],{'include':[{'model':db['FreshsalesField'],'as':_0x8a77('0x55')},{'model':db[_0x8a77('0x56')],'as':_0x8a77('0x53')}]});}return null;})['then'](respondWithResult(_0x21e02e,null))[_0x8a77('0x44')](handleError(_0x21e02e,null));};exports['getFields']=function(_0x593413,_0x265c98,_0x6a23e8){var _0x1e35b9='';var _0x4dfa8d='';return db['FreshsalesAccount'][_0x8a77('0x4f')]({'where':{'id':_0x593413[_0x8a77('0x4c')]['id']},'attributes':['id',_0x8a77('0x57'),_0x8a77('0x58'),_0x8a77('0x59')]})['then'](handleEntityNotFound(_0x265c98,null))[_0x8a77('0x28')](function(_0x1c6e5d){if(_0x1c6e5d){_0x4dfa8d=_0x1c6e5d[_0x8a77('0x57')];_0x1e35b9=_0x1c6e5d[_0x8a77('0x58')];var _0x43c05a=_0x1c6e5d[_0x8a77('0x58')][_0x8a77('0x5a')](-0x1);if(_0x43c05a==='/'){_0x1e35b9=_0x1e35b9[_0x8a77('0x5b')](0x0,_0x1e35b9['lastIndexOf'](_0x43c05a));}return rp({'method':_0x8a77('0x5c'),'uri':util[_0x8a77('0x5d')]('%s%s',_0x1e35b9,_0x8a77('0x5e')),'headers':{'Authorization':_0x8a77('0x5f')+_0x1c6e5d[_0x8a77('0x59')]},'json':!![]});}})['then'](function(_0x40de19){if(_0x40de19){var _0x57996b=_0x40de19[_0x8a77('0x60')];var _0x441747=![];var _0x25157b=null;for(_0x25157b=0x0;_0x25157b<_0x57996b[_0x8a77('0x38')];_0x25157b++){if(_0x57996b[_0x25157b][_0x8a77('0x61')]===_0x4dfa8d){_0x441747=!![];}}if(_0x441747){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8a77('0x62')});}}})[_0x8a77('0x28')](respondWithResult(_0x265c98,null))[_0x8a77('0x44')](function(_0x4a645c){var _0x1379c3=_0x593413[_0x8a77('0x34')][_0x8a77('0x63')]?0x1f4:_0x4a645c[_0x8a77('0x64')]||0x1f4;logger[_0x8a77('0x65')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1379c3,JSON[_0x8a77('0x66')](_0x4a645c));delete _0x4a645c[_0x8a77('0x2b')];if(_0x1379c3===0x191){_0x1379c3=0x190;}_0x265c98[_0x8a77('0x1c')](_0x1379c3)[_0x8a77('0x67')](_0x593413['query'][_0x8a77('0x63')]?{'message':_0x8a77('0x68'),'statusCode':_0x4a645c[_0x8a77('0x64')]}:_0x4a645c);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index a3ec0cd..f249419 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 _0xba34=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x57e679,_0x4d20ca){var _0x269d9e=function(_0x1b4619){while(--_0x1b4619){_0x57e679['push'](_0x57e679['shift']());}};_0x269d9e(++_0x4d20ca);}(_0xba34,0x119));var _0x4ba3=function(_0x39171e,_0x59dea7){_0x39171e=_0x39171e-0x0;var _0xf1c822=_0xba34[_0x39171e];return _0xf1c822;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xadb5,0xad));var _0x5adb=function(_0x321bcf,_0xbf87a9){_0x321bcf=_0x321bcf-0x0;var _0x5356ed=_0xadb5[_0x321bcf];return _0x5356ed;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x5adb('0x7'));module[_0x5adb('0x8')]=function(_0x3e2555,_0x3213e8){return _0x3e2555[_0x5adb('0x9')](_0x5adb('0xa'),attributes,{'tableName':_0x5adb('0xb'),'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 02f2804..c77e8bf 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 _0x6455=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','raw','options','attributes','limit','include','map','model','GetFreshsalesAccount','debug','catch','FreshsalesAccount','find','where','ShowFreshsalesAccount','lodash'];(function(_0x575ba6,_0xe81c6){var _0x13c152=function(_0x2ebe96){while(--_0x2ebe96){_0x575ba6['push'](_0x575ba6['shift']());}};_0x13c152(++_0xe81c6);}(_0x6455,0x97));var _0x5645=function(_0x51e37a,_0x2aa92b){_0x51e37a=_0x51e37a-0x0;var _0x5d522f=_0x6455[_0x51e37a];return _0x5d522f;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d672,_0xa14a06,_0x278d86){return new BPromise(function(_0x518a28,_0x5f4037){return client[_0x5645('0xc')](_0x37d672,_0x278d86)[_0x5645('0xd')](function(_0x38c07a){logger[_0x5645('0xe')](_0x5645('0xf'),_0xa14a06,_0x5645('0x10'));logger['debug'](_0x5645('0x11'),_0xa14a06,_0x5645('0x10'),JSON[_0x5645('0x12')](_0x38c07a));if(_0x38c07a[_0x5645('0x13')]){if(_0x38c07a['error'][_0x5645('0x14')]===0x1f4){logger['error'](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);return _0x5f4037(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')]['message']);return _0x518a28(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}else{logger[_0x5645('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0xa14a06,'request\x20sent');_0x518a28(_0x38c07a[_0x5645('0x16')][_0x5645('0x15')]);}})['catch'](function(_0x35e0c7){logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x35e0c7);_0x5f4037(_0x35e0c7);});});}exports['GetFreshsalesAccount']=function(_0x35bc6f){var _0x1d519d=this;return new Promise(function(_0x22a6cf,_0x102c19){return db['FreshsalesAccount'][_0x5645('0x17')]({'raw':_0x35bc6f['options']?_0x35bc6f['options'][_0x5645('0x18')]===undefined?!![]:![]:!![],'where':_0x35bc6f[_0x5645('0x19')]?_0x35bc6f[_0x5645('0x19')]['where']||null:null,'attributes':_0x35bc6f[_0x5645('0x19')]?_0x35bc6f['options'][_0x5645('0x1a')]||null:null,'limit':_0x35bc6f['options']?_0x35bc6f['options'][_0x5645('0x1b')]||null:null,'include':_0x35bc6f['options']?_0x35bc6f[_0x5645('0x19')][_0x5645('0x1c')]?_['map'](_0x35bc6f[_0x5645('0x19')][_0x5645('0x1c')],function(_0xe83ed7){return{'model':db[_0xe83ed7['model']],'as':_0xe83ed7['as'],'attributes':_0xe83ed7[_0x5645('0x1a')],'include':_0xe83ed7[_0x5645('0x1c')]?_[_0x5645('0x1d')](_0xe83ed7[_0x5645('0x1c')],function(_0x568fd6){return{'model':db[_0x568fd6['model']],'as':_0x568fd6['as'],'attributes':_0x568fd6['attributes'],'include':_0x568fd6['include']?_[_0x5645('0x1d')](_0x568fd6['include'],function(_0x47d097){return{'model':db[_0x47d097[_0x5645('0x1e')]],'as':_0x47d097['as'],'attributes':_0x47d097[_0x5645('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5645('0xd')](function(_0x308991){logger[_0x5645('0xe')](_0x5645('0x1f'),_0x35bc6f);logger[_0x5645('0x20')](_0x5645('0x1f'),_0x35bc6f,JSON[_0x5645('0x12')](_0x308991));_0x22a6cf(_0x308991);})[_0x5645('0x21')](function(_0x1c0aa2){logger[_0x5645('0x13')](_0x5645('0x1f'),_0x1c0aa2[_0x5645('0x15')],_0x35bc6f);_0x102c19(_0x1d519d['error'](0x1f4,_0x1c0aa2[_0x5645('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x12aea2){var _0x31c31b=this;return new Promise(function(_0x40f716,_0x43d514){return db[_0x5645('0x22')][_0x5645('0x23')]({'raw':_0x12aea2['options']?_0x12aea2['options'][_0x5645('0x18')]===undefined?!![]:![]:!![],'where':_0x12aea2[_0x5645('0x19')]?_0x12aea2[_0x5645('0x19')][_0x5645('0x24')]||null:null,'attributes':_0x12aea2[_0x5645('0x19')]?_0x12aea2[_0x5645('0x19')][_0x5645('0x1a')]||null:null,'include':_0x12aea2[_0x5645('0x19')]?_0x12aea2[_0x5645('0x19')][_0x5645('0x1c')]?_[_0x5645('0x1d')](_0x12aea2['options']['include'],function(_0xe01db0){return{'model':db[_0xe01db0['model']],'as':_0xe01db0['as'],'attributes':_0xe01db0[_0x5645('0x1a')],'include':_0xe01db0['include']?_[_0x5645('0x1d')](_0xe01db0['include'],function(_0x2e3dfb){return{'model':db[_0x2e3dfb[_0x5645('0x1e')]],'as':_0x2e3dfb['as'],'attributes':_0x2e3dfb[_0x5645('0x1a')],'include':_0x2e3dfb[_0x5645('0x1c')]?_[_0x5645('0x1d')](_0x2e3dfb[_0x5645('0x1c')],function(_0x57fe61){return{'model':db[_0x57fe61[_0x5645('0x1e')]],'as':_0x57fe61['as'],'attributes':_0x57fe61[_0x5645('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5645('0xd')](function(_0x1f6c2f){logger[_0x5645('0xe')](_0x5645('0x25'),_0x12aea2);logger[_0x5645('0x20')](_0x5645('0x25'),_0x12aea2,JSON['stringify'](_0x1f6c2f));_0x40f716(_0x1f6c2f);})[_0x5645('0x21')](function(_0x48844f){logger[_0x5645('0x13')](_0x5645('0x25'),_0x48844f[_0x5645('0x15')],_0x12aea2);_0x43d514(_0x31c31b[_0x5645('0x13')](0x1f4,_0x48844f[_0x5645('0x15')]));});});}; \ No newline at end of file +var _0x4745=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','attributes','limit','include','map','model','then','raw','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0x4745,0x1e7));var _0x5474=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x4745[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var BPromise=require(_0x5474('0x3'));var rs=require(_0x5474('0x4'));var fs=require('fs');var Redis=require(_0x5474('0x5'));var db=require(_0x5474('0x6'))['db'];var utils=require(_0x5474('0x7'));var logger=require(_0x5474('0x8'))(_0x5474('0x9'));var config=require(_0x5474('0xa'));var jayson=require(_0x5474('0xb'));var client=jayson['client'][_0x5474('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x431f81,_0x57add7,_0x13929f){return new BPromise(function(_0x5d778b,_0x902ba8){return client[_0x5474('0xd')](_0x431f81,_0x13929f)['then'](function(_0xf876f8){logger[_0x5474('0xe')](_0x5474('0xf'),_0x57add7,_0x5474('0x10'));logger[_0x5474('0x11')](_0x5474('0x12'),_0x57add7,_0x5474('0x10'),JSON[_0x5474('0x13')](_0xf876f8));if(_0xf876f8['error']){if(_0xf876f8[_0x5474('0x14')][_0x5474('0x15')]===0x1f4){logger[_0x5474('0x14')](_0x5474('0xf'),_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x902ba8(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}logger[_0x5474('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x5d778b(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x57add7,'request\x20sent');_0x5d778b(_0xf876f8['result'][_0x5474('0x16')]);}})[_0x5474('0x17')](function(_0x2da774){logger['error'](_0x5474('0xf'),_0x57add7,_0x2da774);_0x902ba8(_0x2da774);});});}exports[_0x5474('0x18')]=function(_0x56dbfa){var _0x22b37d=this;return new Promise(function(_0x198fc8,_0x18b0fe){return db[_0x5474('0x19')][_0x5474('0x1a')]({'raw':_0x56dbfa['options']?_0x56dbfa[_0x5474('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')]['where']||null:null,'attributes':_0x56dbfa['options']?_0x56dbfa['options'][_0x5474('0x1c')]||null:null,'limit':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1d')]||null:null,'include':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1e')],function(_0x542d1f){return{'model':db[_0x542d1f['model']],'as':_0x542d1f['as'],'attributes':_0x542d1f[_0x5474('0x1c')],'include':_0x542d1f[_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x542d1f['include'],function(_0x24997a){return{'model':db[_0x24997a['model']],'as':_0x24997a['as'],'attributes':_0x24997a[_0x5474('0x1c')],'include':_0x24997a[_0x5474('0x1e')]?_['map'](_0x24997a[_0x5474('0x1e')],function(_0x5d4cd7){return{'model':db[_0x5d4cd7[_0x5474('0x20')]],'as':_0x5d4cd7['as'],'attributes':_0x5d4cd7['attributes']};}):[]};}):[]};}):[]:[]})[_0x5474('0x21')](function(_0x1384e4){logger[_0x5474('0xe')]('GetFreshsalesAccount',_0x56dbfa);logger[_0x5474('0x11')](_0x5474('0x18'),_0x56dbfa,JSON['stringify'](_0x1384e4));_0x198fc8(_0x1384e4);})['catch'](function(_0x5d2381){logger['error'](_0x5474('0x18'),_0x5d2381[_0x5474('0x16')],_0x56dbfa);_0x18b0fe(_0x22b37d['error'](0x1f4,_0x5d2381[_0x5474('0x16')]));});});};exports['ShowFreshsalesAccount']=function(_0xc1e0ce){var _0x58f27a=this;return new Promise(function(_0x70774f,_0x530cdb){return db[_0x5474('0x19')]['find']({'raw':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce[_0x5474('0x1b')][_0x5474('0x22')]===undefined?!![]:![]:!![],'where':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce['options']['where']||null:null,'attributes':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce[_0x5474('0x1b')][_0x5474('0x1c')]||null:null,'include':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce['options']['include']?_[_0x5474('0x1f')](_0xc1e0ce[_0x5474('0x1b')]['include'],function(_0x3ce359){return{'model':db[_0x3ce359[_0x5474('0x20')]],'as':_0x3ce359['as'],'attributes':_0x3ce359[_0x5474('0x1c')],'include':_0x3ce359[_0x5474('0x1e')]?_['map'](_0x3ce359[_0x5474('0x1e')],function(_0x409111){return{'model':db[_0x409111[_0x5474('0x20')]],'as':_0x409111['as'],'attributes':_0x409111['attributes'],'include':_0x409111[_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x409111[_0x5474('0x1e')],function(_0x2f4589){return{'model':db[_0x2f4589['model']],'as':_0x2f4589['as'],'attributes':_0x2f4589['attributes']};}):[]};}):[]};}):[]:[]})[_0x5474('0x21')](function(_0x3eccef){logger[_0x5474('0xe')](_0x5474('0x23'),_0xc1e0ce);logger['debug'](_0x5474('0x23'),_0xc1e0ce,JSON[_0x5474('0x13')](_0x3eccef));_0x70774f(_0x3eccef);})[_0x5474('0x17')](function(_0x22009e){logger['error']('ShowFreshsalesAccount',_0x22009e['message'],_0xc1e0ce);_0x530cdb(_0x58f27a[_0x5474('0x14')](0x1f4,_0x22009e['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index b19eb24..be0b5f5 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 _0xd21a=['/:id/fields','getFields','post','create','update','delete','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x2210bc,_0x2f7478){var _0x1bb00d=function(_0x17d38f){while(--_0x17d38f){_0x2210bc['push'](_0x2210bc['shift']());}};_0x1bb00d(++_0x2f7478);}(_0xd21a,0x17f));var _0xad21=function(_0x1481d0,_0x2dcebe){_0x1481d0=_0x1481d0-0x0;var _0x1af8ff=_0xd21a[_0x1481d0];return _0x1af8ff;};'use strict';var multer=require(_0xad21('0x0'));var util=require('util');var path=require(_0xad21('0x1'));var timeout=require(_0xad21('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xad21('0x3'));var auth=require(_0xad21('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xad21('0x5'));var controller=require(_0xad21('0x6'));router[_0xad21('0x7')]('/',auth[_0xad21('0x8')](),controller['index']);router[_0xad21('0x7')]('/:id',auth[_0xad21('0x8')](),controller[_0xad21('0x9')]);router[_0xad21('0x7')]('/:id/subjects',auth[_0xad21('0x8')](),controller[_0xad21('0xa')]);router[_0xad21('0x7')](_0xad21('0xb'),auth['isAuthenticated'](),controller[_0xad21('0xc')]);router['get'](_0xad21('0xd'),auth[_0xad21('0x8')](),controller[_0xad21('0xe')]);router[_0xad21('0xf')]('/',auth['isAuthenticated'](),controller[_0xad21('0x10')]);router['put']('/:id',auth[_0xad21('0x8')](),controller[_0xad21('0x11')]);router[_0xad21('0x12')](_0xad21('0x13'),auth[_0xad21('0x8')](),controller[_0xad21('0x14')]);module[_0xad21('0x15')]=router; \ No newline at end of file +var _0x4829=['isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/fields','getFields','create','update','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x4829,0xa3));var _0x9482=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x4829[_0x556bb1];return _0x45455f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9482('0x0'));var express=require('express');var router=express[_0x9482('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x9482('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x9482('0x3'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x9482('0x4')]('/',auth[_0x9482('0x5')](),controller['index']);router[_0x9482('0x4')](_0x9482('0x6'),auth[_0x9482('0x5')](),controller[_0x9482('0x7')]);router['get'](_0x9482('0x8'),auth[_0x9482('0x5')](),controller[_0x9482('0x9')]);router[_0x9482('0x4')]('/:id/descriptions',auth[_0x9482('0x5')](),controller['getDescriptions']);router[_0x9482('0x4')](_0x9482('0xa'),auth[_0x9482('0x5')](),controller[_0x9482('0xb')]);router['post']('/',auth[_0x9482('0x5')](),controller[_0x9482('0xc')]);router['put'](_0x9482('0x6'),auth[_0x9482('0x5')](),controller[_0x9482('0xd')]);router['delete'](_0x9482('0x6'),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 b723406..af0006d 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 _0x141d=['sequelize','exports','STRING'];(function(_0x476137,_0x1ccb32){var _0x5acaf8=function(_0x32ff8d){while(--_0x32ff8d){_0x476137['push'](_0x476137['shift']());}};_0x5acaf8(++_0x1ccb32);}(_0x141d,0x1a1));var _0xd141=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x141d[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0xd141('0x0'));module[_0xd141('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd141('0x2')]}}; \ No newline at end of file +var _0x9367=['sequelize','exports','STRING'];(function(_0x170f4c,_0x4a4c80){var _0x52eedd=function(_0x473905){while(--_0x473905){_0x170f4c['push'](_0x170f4c['shift']());}};_0x52eedd(++_0x4a4c80);}(_0x9367,0x150));var _0x7936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9367[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7936('0x0'));module[_0x7936('0x1')]={'name':{'type':Sequelize[_0x7936('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 8f25509..5a42907 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 _0x84a7=['body','getSubjects','findOne','FreshsalesField','nolimit','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','limit','undefined','count','status','set','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','FreshsalesConfiguration','catch','show','params','keys','include','find','create'];(function(_0x3d8e26,_0x457f1){var _0x2cfcc6=function(_0x4cddad){while(--_0x4cddad){_0x3d8e26['push'](_0x3d8e26['shift']());}};_0x2cfcc6(++_0x457f1);}(_0x84a7,0xa1));var _0x784a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x84a7[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x784a('0x0'));var rimraf=require(_0x784a('0x1'));var zipdir=require(_0x784a('0x2'));var jsonpatch=require(_0x784a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x784a('0x4'));var util=require(_0x784a('0x5'));var path=require('path');var sox=require(_0x784a('0x6'));var csv=require(_0x784a('0x7'));var ejs=require(_0x784a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x784a('0x9'));var squel=require(_0x784a('0xa'));var crypto=require('crypto');var jsforce=require(_0x784a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x784a('0x7'));var querystring=require('querystring');var Papa=require(_0x784a('0xc'));var Redis=require(_0x784a('0xd'));var authService=require(_0x784a('0xe'));var qs=require(_0x784a('0xf'));var as=require(_0x784a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x784a('0x11'))(_0x784a('0x12'));var utils=require(_0x784a('0x13'));var config=require(_0x784a('0x14'));var licenseUtil=require(_0x784a('0x15'));var db=require(_0x784a('0x16'))['db'];function respondWithStatusCode(_0x680627,_0x5d2199){_0x5d2199=_0x5d2199||0xcc;return function(_0x5bbe09){if(_0x5bbe09){return _0x680627['sendStatus'](_0x5d2199);}return _0x680627['status'](_0x5d2199)[_0x784a('0x17')]();};}function respondWithResult(_0x4e9b72,_0x11dfc4){_0x11dfc4=_0x11dfc4||0xc8;return function(_0x33ab12){if(_0x33ab12){return _0x4e9b72['status'](_0x11dfc4)['json'](_0x33ab12);}};}function respondWithFilteredResult(_0x3c9d53,_0x26735f){return function(_0x5990fb){if(_0x5990fb){var _0x5e25ee=typeof _0x26735f[_0x784a('0x18')]==='undefined'&&typeof _0x26735f[_0x784a('0x19')]===_0x784a('0x1a');var _0x27894a=_0x5990fb[_0x784a('0x1b')];var _0x2f8efd=_0x5e25ee?0x0:_0x26735f['offset'];var _0x421a4b=_0x5e25ee?_0x5990fb['count']:_0x26735f[_0x784a('0x18')]+_0x26735f[_0x784a('0x19')];var _0x1874e7;if(_0x421a4b>=_0x27894a){_0x421a4b=_0x27894a;_0x1874e7=0xc8;}else{_0x1874e7=0xce;}_0x3c9d53[_0x784a('0x1c')](_0x1874e7);return _0x3c9d53[_0x784a('0x1d')]('Content-Range',_0x2f8efd+'-'+_0x421a4b+'/'+_0x27894a)[_0x784a('0x1e')](_0x5990fb);}return null;};}function patchUpdates(_0x1de9ac){return function(_0x207526){try{jsonpatch[_0x784a('0x1f')](_0x207526,_0x1de9ac,!![]);}catch(_0x453c73){return BPromise[_0x784a('0x20')](_0x453c73);}return _0x207526[_0x784a('0x21')]();};}function saveUpdates(_0x3e7206,_0x2b03d9){return function(_0x209897){if(_0x209897){return _0x209897[_0x784a('0x22')](_0x3e7206)[_0x784a('0x23')](function(_0x214553){return _0x214553;});}return null;};}function removeEntity(_0x477f60,_0x2195f7){return function(_0x555469){if(_0x555469){return _0x555469[_0x784a('0x24')]()[_0x784a('0x23')](function(){_0x477f60[_0x784a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2875a3,_0x1990ac){return function(_0x534a2c){if(!_0x534a2c){_0x2875a3[_0x784a('0x25')](0x194);}return _0x534a2c;};}function handleError(_0xca2cc1,_0x1348c3){_0x1348c3=_0x1348c3||0x1f4;return function(_0x5275e9){logger['error'](_0x5275e9[_0x784a('0x26')]);if(_0x5275e9[_0x784a('0x27')]){delete _0x5275e9[_0x784a('0x27')];}_0xca2cc1['status'](_0x1348c3)[_0x784a('0x28')](_0x5275e9);};}exports[_0x784a('0x29')]=function(_0x2be5bf,_0x3db8ac){var _0x4dc664={},_0x2bfd5e={},_0x3aa132={'count':0x0,'rows':[]};var _0x293d3e=_['map'](db['FreshsalesConfiguration'][_0x784a('0x2a')],function(_0x5143d8){return{'name':_0x5143d8[_0x784a('0x2b')],'type':_0x5143d8['type'][_0x784a('0x2c')]};});_0x2bfd5e[_0x784a('0x2d')]=_[_0x784a('0x2e')](_0x293d3e,'name');_0x2bfd5e[_0x784a('0x2f')]=_['keys'](_0x2be5bf[_0x784a('0x2f')]);_0x2bfd5e[_0x784a('0x30')]=_[_0x784a('0x31')](_0x2bfd5e[_0x784a('0x2d')],_0x2bfd5e[_0x784a('0x2f')]);_0x4dc664['attributes']=_[_0x784a('0x31')](_0x2bfd5e[_0x784a('0x2d')],qs[_0x784a('0x32')](_0x2be5bf[_0x784a('0x2f')][_0x784a('0x32')]));_0x4dc664[_0x784a('0x33')]=_0x4dc664[_0x784a('0x33')][_0x784a('0x34')]?_0x4dc664[_0x784a('0x33')]:_0x2bfd5e[_0x784a('0x2d')];if(!_0x2be5bf[_0x784a('0x2f')][_0x784a('0x35')]('nolimit')){_0x4dc664[_0x784a('0x19')]=qs[_0x784a('0x19')](_0x2be5bf[_0x784a('0x2f')][_0x784a('0x19')]);_0x4dc664[_0x784a('0x18')]=qs[_0x784a('0x18')](_0x2be5bf[_0x784a('0x2f')]['offset']);}_0x4dc664[_0x784a('0x36')]=qs[_0x784a('0x37')](_0x2be5bf[_0x784a('0x2f')][_0x784a('0x37')]);_0x4dc664[_0x784a('0x38')]=qs['filters'](_[_0x784a('0x39')](_0x2be5bf[_0x784a('0x2f')],_0x2bfd5e[_0x784a('0x30')]),_0x293d3e);if(_0x2be5bf[_0x784a('0x2f')]['filter']){_0x4dc664[_0x784a('0x38')]=_[_0x784a('0x3a')](_0x4dc664[_0x784a('0x38')],{'$or':_[_0x784a('0x2e')](_0x293d3e,function(_0x240368){if(_0x240368['type']!=='VIRTUAL'){var _0x5e85ef={};_0x5e85ef[_0x240368['name']]={'$like':'%'+_0x2be5bf[_0x784a('0x2f')][_0x784a('0x3b')]+'%'};return _0x5e85ef;}})});}_0x4dc664=_[_0x784a('0x3a')]({},_0x4dc664,_0x2be5bf[_0x784a('0x3c')]);var _0x951f00={'where':_0x4dc664[_0x784a('0x38')]};return db['FreshsalesConfiguration'][_0x784a('0x1b')](_0x951f00)[_0x784a('0x23')](function(_0x1db214){_0x3aa132[_0x784a('0x1b')]=_0x1db214;if(_0x2be5bf['query'][_0x784a('0x3d')]){_0x4dc664['include']=[{'all':!![]}];}return db[_0x784a('0x3e')]['findAll'](_0x4dc664);})[_0x784a('0x23')](function(_0x39a42c){_0x3aa132['rows']=_0x39a42c;return _0x3aa132;})[_0x784a('0x23')](respondWithFilteredResult(_0x3db8ac,_0x4dc664))[_0x784a('0x3f')](handleError(_0x3db8ac,null));};exports[_0x784a('0x40')]=function(_0x4b9854,_0x28934f){var _0x2c2baf={'raw':![],'where':{'id':_0x4b9854[_0x784a('0x41')]['id']}},_0x1a1ad2={};_0x1a1ad2[_0x784a('0x2d')]=_[_0x784a('0x42')](db[_0x784a('0x3e')][_0x784a('0x2a')]);_0x1a1ad2[_0x784a('0x2f')]=_['keys'](_0x4b9854[_0x784a('0x2f')]);_0x1a1ad2[_0x784a('0x30')]=_[_0x784a('0x31')](_0x1a1ad2[_0x784a('0x2d')],_0x1a1ad2[_0x784a('0x2f')]);_0x2c2baf[_0x784a('0x33')]=_['intersection'](_0x1a1ad2[_0x784a('0x2d')],qs[_0x784a('0x32')](_0x4b9854[_0x784a('0x2f')][_0x784a('0x32')]));_0x2c2baf[_0x784a('0x33')]=_0x2c2baf['attributes']['length']?_0x2c2baf['attributes']:_0x1a1ad2[_0x784a('0x2d')];if(_0x4b9854[_0x784a('0x2f')][_0x784a('0x3d')]){_0x2c2baf[_0x784a('0x43')]=[{'all':!![]}];}_0x2c2baf=_[_0x784a('0x3a')]({},_0x2c2baf,_0x4b9854['options']);return db['FreshsalesConfiguration'][_0x784a('0x44')](_0x2c2baf)[_0x784a('0x23')](handleEntityNotFound(_0x28934f,null))[_0x784a('0x23')](respondWithResult(_0x28934f,null))[_0x784a('0x3f')](handleError(_0x28934f,null));};exports[_0x784a('0x45')]=function(_0x11501c,_0x1523a1){return db[_0x784a('0x3e')][_0x784a('0x45')](_0x11501c[_0x784a('0x46')],{})[_0x784a('0x23')](respondWithResult(_0x1523a1,0xc9))[_0x784a('0x3f')](handleError(_0x1523a1,null));};exports[_0x784a('0x22')]=function(_0x496066,_0x139bd1){if(_0x496066['body']['id']){delete _0x496066[_0x784a('0x46')]['id'];}return db[_0x784a('0x3e')][_0x784a('0x44')]({'where':{'id':_0x496066[_0x784a('0x41')]['id']}})[_0x784a('0x23')](handleEntityNotFound(_0x139bd1,null))[_0x784a('0x23')](saveUpdates(_0x496066[_0x784a('0x46')],null))['then'](respondWithResult(_0x139bd1,null))[_0x784a('0x3f')](handleError(_0x139bd1,null));};exports[_0x784a('0x24')]=function(_0x4a0e53,_0x1571a1){return db[_0x784a('0x3e')][_0x784a('0x44')]({'where':{'id':_0x4a0e53['params']['id']}})[_0x784a('0x23')](handleEntityNotFound(_0x1571a1,null))[_0x784a('0x23')](removeEntity(_0x1571a1,null))[_0x784a('0x3f')](handleError(_0x1571a1,null));};exports[_0x784a('0x47')]=function(_0x43ef04,_0x4366bf,_0x473cd0){var _0x9312d1={};var _0x30b5fc={};var _0x18d8e7;var _0x1c096a;return db[_0x784a('0x3e')][_0x784a('0x48')]({'where':{'id':_0x43ef04[_0x784a('0x41')]['id']}})[_0x784a('0x23')](handleEntityNotFound(_0x4366bf,null))['then'](function(_0x48f7fb){if(_0x48f7fb){_0x18d8e7=_0x48f7fb;_0x30b5fc[_0x784a('0x2d')]=_[_0x784a('0x42')](db[_0x784a('0x49')][_0x784a('0x2a')]);_0x30b5fc[_0x784a('0x2f')]=_[_0x784a('0x42')](_0x43ef04['query']);_0x30b5fc[_0x784a('0x30')]=_[_0x784a('0x31')](_0x30b5fc['model'],_0x30b5fc['query']);_0x9312d1[_0x784a('0x33')]=_['intersection'](_0x30b5fc[_0x784a('0x2d')],qs[_0x784a('0x32')](_0x43ef04[_0x784a('0x2f')][_0x784a('0x32')]));_0x9312d1['attributes']=_0x9312d1[_0x784a('0x33')][_0x784a('0x34')]?_0x9312d1[_0x784a('0x33')]:_0x30b5fc[_0x784a('0x2d')];_0x9312d1[_0x784a('0x36')]=qs['sort'](_0x43ef04['query']['sort']);_0x9312d1['where']=qs[_0x784a('0x30')](_[_0x784a('0x39')](_0x43ef04[_0x784a('0x2f')],_0x30b5fc[_0x784a('0x30')]));if(_0x43ef04['query'][_0x784a('0x3b')]){_0x9312d1[_0x784a('0x38')]=_[_0x784a('0x3a')](_0x9312d1[_0x784a('0x38')],{'$or':_[_0x784a('0x2e')](_0x9312d1[_0x784a('0x33')],function(_0x1f5b7a){var _0x453386={};_0x453386[_0x1f5b7a]={'$like':'%'+_0x43ef04[_0x784a('0x2f')][_0x784a('0x3b')]+'%'};return _0x453386;})});}_0x9312d1=_[_0x784a('0x3a')]({},_0x9312d1,_0x43ef04[_0x784a('0x3c')]);return _0x18d8e7['getSubjects'](_0x9312d1);}})['then'](function(_0x3babbd){if(_0x3babbd){_0x1c096a=_0x3babbd[_0x784a('0x34')];if(!_0x43ef04['query'][_0x784a('0x35')](_0x784a('0x4a'))){_0x9312d1[_0x784a('0x19')]=qs[_0x784a('0x19')](_0x43ef04[_0x784a('0x2f')]['limit']);_0x9312d1[_0x784a('0x18')]=qs[_0x784a('0x18')](_0x43ef04[_0x784a('0x2f')][_0x784a('0x18')]);}return _0x18d8e7[_0x784a('0x47')](_0x9312d1);}})[_0x784a('0x23')](function(_0xe3ae29){if(_0xe3ae29){return _0xe3ae29?{'count':_0x1c096a,'rows':_0xe3ae29}:null;}})['then'](respondWithResult(_0x4366bf,null))[_0x784a('0x3f')](handleError(_0x4366bf,null));};exports[_0x784a('0x4b')]=function(_0x170474,_0x5f15d9,_0x58fcb2){var _0x3c5f63={};var _0x3a0a3b={};var _0x11264f;var _0xf39944;return db[_0x784a('0x3e')][_0x784a('0x48')]({'where':{'id':_0x170474[_0x784a('0x41')]['id']}})[_0x784a('0x23')](handleEntityNotFound(_0x5f15d9,null))[_0x784a('0x23')](function(_0x5a217c){if(_0x5a217c){_0x11264f=_0x5a217c;_0x3a0a3b[_0x784a('0x2d')]=_[_0x784a('0x42')](db['FreshsalesField'][_0x784a('0x2a')]);_0x3a0a3b[_0x784a('0x2f')]=_['keys'](_0x170474[_0x784a('0x2f')]);_0x3a0a3b[_0x784a('0x30')]=_[_0x784a('0x31')](_0x3a0a3b[_0x784a('0x2d')],_0x3a0a3b[_0x784a('0x2f')]);_0x3c5f63[_0x784a('0x33')]=_[_0x784a('0x31')](_0x3a0a3b[_0x784a('0x2d')],qs[_0x784a('0x32')](_0x170474[_0x784a('0x2f')]['fields']));_0x3c5f63[_0x784a('0x33')]=_0x3c5f63[_0x784a('0x33')]['length']?_0x3c5f63[_0x784a('0x33')]:_0x3a0a3b[_0x784a('0x2d')];_0x3c5f63[_0x784a('0x36')]=qs['sort'](_0x170474[_0x784a('0x2f')][_0x784a('0x37')]);_0x3c5f63['where']=qs[_0x784a('0x30')](_[_0x784a('0x39')](_0x170474[_0x784a('0x2f')],_0x3a0a3b[_0x784a('0x30')]));if(_0x170474['query'][_0x784a('0x3b')]){_0x3c5f63[_0x784a('0x38')]=_[_0x784a('0x3a')](_0x3c5f63['where'],{'$or':_[_0x784a('0x2e')](_0x3c5f63[_0x784a('0x33')],function(_0x6be370){var _0x485763={};_0x485763[_0x6be370]={'$like':'%'+_0x170474[_0x784a('0x2f')][_0x784a('0x3b')]+'%'};return _0x485763;})});}_0x3c5f63=_['merge']({},_0x3c5f63,_0x170474[_0x784a('0x3c')]);return _0x11264f['getDescriptions'](_0x3c5f63);}})[_0x784a('0x23')](function(_0x1575d3){if(_0x1575d3){_0xf39944=_0x1575d3['length'];if(!_0x170474[_0x784a('0x2f')][_0x784a('0x35')](_0x784a('0x4a'))){_0x3c5f63[_0x784a('0x19')]=qs[_0x784a('0x19')](_0x170474[_0x784a('0x2f')]['limit']);_0x3c5f63[_0x784a('0x18')]=qs[_0x784a('0x18')](_0x170474['query'][_0x784a('0x18')]);}return _0x11264f[_0x784a('0x4b')](_0x3c5f63);}})[_0x784a('0x23')](function(_0x4a57ea){if(_0x4a57ea){return _0x4a57ea?{'count':_0xf39944,'rows':_0x4a57ea}:null;}})[_0x784a('0x23')](respondWithResult(_0x5f15d9,null))[_0x784a('0x3f')](handleError(_0x5f15d9,null));};exports[_0x784a('0x4c')]=function(_0x5961f3,_0x2e562b,_0xdcfe76){var _0x47d623={};var _0x1c6a99={};var _0x156d72;var _0x48dd8b;return db[_0x784a('0x3e')][_0x784a('0x48')]({'where':{'id':_0x5961f3[_0x784a('0x41')]['id']}})[_0x784a('0x23')](handleEntityNotFound(_0x2e562b,null))['then'](function(_0x18ab3c){if(_0x18ab3c){_0x156d72=_0x18ab3c;_0x1c6a99[_0x784a('0x2d')]=_[_0x784a('0x42')](db[_0x784a('0x49')][_0x784a('0x2a')]);_0x1c6a99['query']=_[_0x784a('0x42')](_0x5961f3[_0x784a('0x2f')]);_0x1c6a99[_0x784a('0x30')]=_[_0x784a('0x31')](_0x1c6a99[_0x784a('0x2d')],_0x1c6a99[_0x784a('0x2f')]);_0x47d623[_0x784a('0x33')]=_[_0x784a('0x31')](_0x1c6a99[_0x784a('0x2d')],qs['fields'](_0x5961f3['query'][_0x784a('0x32')]));_0x47d623[_0x784a('0x33')]=_0x47d623[_0x784a('0x33')][_0x784a('0x34')]?_0x47d623[_0x784a('0x33')]:_0x1c6a99[_0x784a('0x2d')];_0x47d623[_0x784a('0x36')]=qs[_0x784a('0x37')](_0x5961f3['query']['sort']);_0x47d623['where']=qs[_0x784a('0x30')](_[_0x784a('0x39')](_0x5961f3['query'],_0x1c6a99[_0x784a('0x30')]));if(_0x5961f3[_0x784a('0x2f')]['filter']){_0x47d623[_0x784a('0x38')]=_[_0x784a('0x3a')](_0x47d623[_0x784a('0x38')],{'$or':_[_0x784a('0x2e')](_0x47d623['attributes'],function(_0x45e0b4){var _0x1c4e19={};_0x1c4e19[_0x45e0b4]={'$like':'%'+_0x5961f3[_0x784a('0x2f')][_0x784a('0x3b')]+'%'};return _0x1c4e19;})});}_0x47d623=_['merge']({},_0x47d623,_0x5961f3[_0x784a('0x3c')]);return _0x156d72[_0x784a('0x4c')](_0x47d623);}})['then'](function(_0x1bb472){if(_0x1bb472){_0x48dd8b=_0x1bb472['length'];if(!_0x5961f3['query']['hasOwnProperty']('nolimit')){_0x47d623[_0x784a('0x19')]=qs[_0x784a('0x19')](_0x5961f3[_0x784a('0x2f')][_0x784a('0x19')]);_0x47d623[_0x784a('0x18')]=qs[_0x784a('0x18')](_0x5961f3['query'][_0x784a('0x18')]);}return _0x156d72[_0x784a('0x4c')](_0x47d623);}})[_0x784a('0x23')](function(_0x1e6156){if(_0x1e6156){return _0x1e6156?{'count':_0x48dd8b,'rows':_0x1e6156}:null;}})[_0x784a('0x23')](respondWithResult(_0x2e562b,null))[_0x784a('0x3f')](handleError(_0x2e562b,null));}; \ No newline at end of file +var _0x662a=['options','create','body','find','destroy','getSubjects','findOne','FreshsalesField','pick','filter','nolimit','getDescriptions','hasOwnProperty','getFields','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','end','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','order','sort','where','filters','merge','then','includeAll','include','findAll','rows','catch','show','params'];(function(_0x3d822c,_0x4fec1d){var _0x564515=function(_0x14ae8a){while(--_0x14ae8a){_0x3d822c['push'](_0x3d822c['shift']());}};_0x564515(++_0x4fec1d);}(_0x662a,0xae));var _0xa662=function(_0x45980f,_0x4324a0){_0x45980f=_0x45980f-0x0;var _0x5c8029=_0x662a[_0x45980f];return _0x5c8029;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa662('0x0'));var zipdir=require(_0xa662('0x1'));var jsonpatch=require(_0xa662('0x2'));var rp=require(_0xa662('0x3'));var moment=require('moment');var BPromise=require(_0xa662('0x4'));var Mustache=require(_0xa662('0x5'));var util=require(_0xa662('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa662('0x7'));var ejs=require(_0xa662('0x8'));var fs=require('fs');var fs_extra=require(_0xa662('0x9'));var _=require(_0xa662('0xa'));var squel=require(_0xa662('0xb'));var crypto=require(_0xa662('0xc'));var jsforce=require(_0xa662('0xd'));var deskjs=require(_0xa662('0xe'));var toCsv=require(_0xa662('0x7'));var querystring=require('querystring');var Papa=require(_0xa662('0xf'));var Redis=require('ioredis');var authService=require(_0xa662('0x10'));var qs=require(_0xa662('0x11'));var as=require(_0xa662('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa662('0x13'))(_0xa662('0x14'));var utils=require('../../config/utils');var config=require(_0xa662('0x15'));var licenseUtil=require(_0xa662('0x16'));var db=require(_0xa662('0x17'))['db'];function respondWithStatusCode(_0x177549,_0x3a57e7){_0x3a57e7=_0x3a57e7||0xcc;return function(_0xece161){if(_0xece161){return _0x177549[_0xa662('0x18')](_0x3a57e7);}return _0x177549[_0xa662('0x19')](_0x3a57e7)['end']();};}function respondWithResult(_0x27b19b,_0x44e17e){_0x44e17e=_0x44e17e||0xc8;return function(_0x4ea91b){if(_0x4ea91b){return _0x27b19b[_0xa662('0x19')](_0x44e17e)[_0xa662('0x1a')](_0x4ea91b);}};}function respondWithFilteredResult(_0x4f09ab,_0x31ee39){return function(_0x22516f){if(_0x22516f){var _0x1cd9cd=typeof _0x31ee39[_0xa662('0x1b')]===_0xa662('0x1c')&&typeof _0x31ee39[_0xa662('0x1d')]==='undefined';var _0x121f86=_0x22516f[_0xa662('0x1e')];var _0x4e049c=_0x1cd9cd?0x0:_0x31ee39[_0xa662('0x1b')];var _0x29d945=_0x1cd9cd?_0x22516f[_0xa662('0x1e')]:_0x31ee39[_0xa662('0x1b')]+_0x31ee39['limit'];var _0x169edd;if(_0x29d945>=_0x121f86){_0x29d945=_0x121f86;_0x169edd=0xc8;}else{_0x169edd=0xce;}_0x4f09ab[_0xa662('0x19')](_0x169edd);return _0x4f09ab[_0xa662('0x1f')](_0xa662('0x20'),_0x4e049c+'-'+_0x29d945+'/'+_0x121f86)[_0xa662('0x1a')](_0x22516f);}return null;};}function patchUpdates(_0x10b214){return function(_0x14249d){try{jsonpatch['apply'](_0x14249d,_0x10b214,!![]);}catch(_0x56f901){return BPromise[_0xa662('0x21')](_0x56f901);}return _0x14249d['save']();};}function saveUpdates(_0x2fbcee,_0x5a4999){return function(_0x166495){if(_0x166495){return _0x166495['update'](_0x2fbcee)['then'](function(_0x90fdb0){return _0x90fdb0;});}return null;};}function removeEntity(_0x47c251,_0x18f215){return function(_0x12a5ae){if(_0x12a5ae){return _0x12a5ae['destroy']()['then'](function(){_0x47c251[_0xa662('0x19')](0xcc)[_0xa662('0x22')]();});}};}function handleEntityNotFound(_0x406699,_0x1e905b){return function(_0x268ff2){if(!_0x268ff2){_0x406699['sendStatus'](0x194);}return _0x268ff2;};}function handleError(_0x4da8ea,_0x37369d){_0x37369d=_0x37369d||0x1f4;return function(_0x572927){logger[_0xa662('0x23')](_0x572927[_0xa662('0x24')]);if(_0x572927[_0xa662('0x25')]){delete _0x572927['name'];}_0x4da8ea[_0xa662('0x19')](_0x37369d)[_0xa662('0x26')](_0x572927);};}exports[_0xa662('0x27')]=function(_0x4c45cc,_0x4299fd){var _0x10a0e6={},_0x1dc05b={},_0x12b359={'count':0x0,'rows':[]};var _0x1ff272=_[_0xa662('0x28')](db[_0xa662('0x29')][_0xa662('0x2a')],function(_0x2ad84e){return{'name':_0x2ad84e[_0xa662('0x2b')],'type':_0x2ad84e[_0xa662('0x2c')][_0xa662('0x2d')]};});_0x1dc05b[_0xa662('0x2e')]=_[_0xa662('0x28')](_0x1ff272,_0xa662('0x25'));_0x1dc05b['query']=_[_0xa662('0x2f')](_0x4c45cc['query']);_0x1dc05b['filters']=_['intersection'](_0x1dc05b[_0xa662('0x2e')],_0x1dc05b[_0xa662('0x30')]);_0x10a0e6['attributes']=_[_0xa662('0x31')](_0x1dc05b[_0xa662('0x2e')],qs[_0xa662('0x32')](_0x4c45cc['query']['fields']));_0x10a0e6[_0xa662('0x33')]=_0x10a0e6[_0xa662('0x33')][_0xa662('0x34')]?_0x10a0e6[_0xa662('0x33')]:_0x1dc05b['model'];if(!_0x4c45cc[_0xa662('0x30')]['hasOwnProperty']('nolimit')){_0x10a0e6['limit']=qs[_0xa662('0x1d')](_0x4c45cc[_0xa662('0x30')]['limit']);_0x10a0e6[_0xa662('0x1b')]=qs[_0xa662('0x1b')](_0x4c45cc['query'][_0xa662('0x1b')]);}_0x10a0e6[_0xa662('0x35')]=qs[_0xa662('0x36')](_0x4c45cc[_0xa662('0x30')]['sort']);_0x10a0e6[_0xa662('0x37')]=qs[_0xa662('0x38')](_['pick'](_0x4c45cc['query'],_0x1dc05b[_0xa662('0x38')]),_0x1ff272);if(_0x4c45cc[_0xa662('0x30')]['filter']){_0x10a0e6['where']=_[_0xa662('0x39')](_0x10a0e6[_0xa662('0x37')],{'$or':_[_0xa662('0x28')](_0x1ff272,function(_0x6309f7){if(_0x6309f7[_0xa662('0x2c')]!=='VIRTUAL'){var _0x5c640e={};_0x5c640e[_0x6309f7['name']]={'$like':'%'+_0x4c45cc[_0xa662('0x30')]['filter']+'%'};return _0x5c640e;}})});}_0x10a0e6=_[_0xa662('0x39')]({},_0x10a0e6,_0x4c45cc['options']);var _0x6fbf1={'where':_0x10a0e6['where']};return db['FreshsalesConfiguration'][_0xa662('0x1e')](_0x6fbf1)[_0xa662('0x3a')](function(_0x70a999){_0x12b359[_0xa662('0x1e')]=_0x70a999;if(_0x4c45cc[_0xa662('0x30')][_0xa662('0x3b')]){_0x10a0e6[_0xa662('0x3c')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xa662('0x3d')](_0x10a0e6);})[_0xa662('0x3a')](function(_0x492acd){_0x12b359[_0xa662('0x3e')]=_0x492acd;return _0x12b359;})[_0xa662('0x3a')](respondWithFilteredResult(_0x4299fd,_0x10a0e6))[_0xa662('0x3f')](handleError(_0x4299fd,null));};exports[_0xa662('0x40')]=function(_0x4860c7,_0x27a96c){var _0x436a99={'raw':![],'where':{'id':_0x4860c7[_0xa662('0x41')]['id']}},_0x373923={};_0x373923[_0xa662('0x2e')]=_[_0xa662('0x2f')](db[_0xa662('0x29')][_0xa662('0x2a')]);_0x373923[_0xa662('0x30')]=_[_0xa662('0x2f')](_0x4860c7['query']);_0x373923[_0xa662('0x38')]=_[_0xa662('0x31')](_0x373923['model'],_0x373923[_0xa662('0x30')]);_0x436a99[_0xa662('0x33')]=_[_0xa662('0x31')](_0x373923[_0xa662('0x2e')],qs[_0xa662('0x32')](_0x4860c7[_0xa662('0x30')]['fields']));_0x436a99['attributes']=_0x436a99[_0xa662('0x33')]['length']?_0x436a99[_0xa662('0x33')]:_0x373923[_0xa662('0x2e')];if(_0x4860c7['query'][_0xa662('0x3b')]){_0x436a99['include']=[{'all':!![]}];}_0x436a99=_[_0xa662('0x39')]({},_0x436a99,_0x4860c7[_0xa662('0x42')]);return db[_0xa662('0x29')]['find'](_0x436a99)['then'](handleEntityNotFound(_0x27a96c,null))[_0xa662('0x3a')](respondWithResult(_0x27a96c,null))[_0xa662('0x3f')](handleError(_0x27a96c,null));};exports[_0xa662('0x43')]=function(_0x4ce640,_0x4ab44e){return db[_0xa662('0x29')][_0xa662('0x43')](_0x4ce640[_0xa662('0x44')],{})['then'](respondWithResult(_0x4ab44e,0xc9))[_0xa662('0x3f')](handleError(_0x4ab44e,null));};exports['update']=function(_0x1d7d35,_0x33ac26){if(_0x1d7d35[_0xa662('0x44')]['id']){delete _0x1d7d35['body']['id'];}return db[_0xa662('0x29')][_0xa662('0x45')]({'where':{'id':_0x1d7d35[_0xa662('0x41')]['id']}})[_0xa662('0x3a')](handleEntityNotFound(_0x33ac26,null))[_0xa662('0x3a')](saveUpdates(_0x1d7d35[_0xa662('0x44')],null))[_0xa662('0x3a')](respondWithResult(_0x33ac26,null))[_0xa662('0x3f')](handleError(_0x33ac26,null));};exports[_0xa662('0x46')]=function(_0x2af025,_0x2d5898){return db[_0xa662('0x29')]['find']({'where':{'id':_0x2af025['params']['id']}})[_0xa662('0x3a')](handleEntityNotFound(_0x2d5898,null))[_0xa662('0x3a')](removeEntity(_0x2d5898,null))[_0xa662('0x3f')](handleError(_0x2d5898,null));};exports[_0xa662('0x47')]=function(_0x136aa0,_0x3bb877,_0x3e5aa5){var _0x49a9f0={};var _0x204798={};var _0x5223d6;var _0x35c227;return db[_0xa662('0x29')][_0xa662('0x48')]({'where':{'id':_0x136aa0[_0xa662('0x41')]['id']}})[_0xa662('0x3a')](handleEntityNotFound(_0x3bb877,null))[_0xa662('0x3a')](function(_0x3899e6){if(_0x3899e6){_0x5223d6=_0x3899e6;_0x204798[_0xa662('0x2e')]=_[_0xa662('0x2f')](db[_0xa662('0x49')][_0xa662('0x2a')]);_0x204798[_0xa662('0x30')]=_[_0xa662('0x2f')](_0x136aa0[_0xa662('0x30')]);_0x204798[_0xa662('0x38')]=_[_0xa662('0x31')](_0x204798[_0xa662('0x2e')],_0x204798['query']);_0x49a9f0[_0xa662('0x33')]=_[_0xa662('0x31')](_0x204798['model'],qs['fields'](_0x136aa0[_0xa662('0x30')][_0xa662('0x32')]));_0x49a9f0[_0xa662('0x33')]=_0x49a9f0[_0xa662('0x33')][_0xa662('0x34')]?_0x49a9f0[_0xa662('0x33')]:_0x204798[_0xa662('0x2e')];_0x49a9f0[_0xa662('0x35')]=qs[_0xa662('0x36')](_0x136aa0[_0xa662('0x30')][_0xa662('0x36')]);_0x49a9f0[_0xa662('0x37')]=qs[_0xa662('0x38')](_[_0xa662('0x4a')](_0x136aa0['query'],_0x204798[_0xa662('0x38')]));if(_0x136aa0[_0xa662('0x30')][_0xa662('0x4b')]){_0x49a9f0[_0xa662('0x37')]=_[_0xa662('0x39')](_0x49a9f0[_0xa662('0x37')],{'$or':_[_0xa662('0x28')](_0x49a9f0[_0xa662('0x33')],function(_0x3dfe96){var _0xf55380={};_0xf55380[_0x3dfe96]={'$like':'%'+_0x136aa0['query']['filter']+'%'};return _0xf55380;})});}_0x49a9f0=_['merge']({},_0x49a9f0,_0x136aa0[_0xa662('0x42')]);return _0x5223d6['getSubjects'](_0x49a9f0);}})[_0xa662('0x3a')](function(_0x1baba9){if(_0x1baba9){_0x35c227=_0x1baba9[_0xa662('0x34')];if(!_0x136aa0['query']['hasOwnProperty'](_0xa662('0x4c'))){_0x49a9f0['limit']=qs[_0xa662('0x1d')](_0x136aa0['query']['limit']);_0x49a9f0[_0xa662('0x1b')]=qs['offset'](_0x136aa0[_0xa662('0x30')][_0xa662('0x1b')]);}return _0x5223d6['getSubjects'](_0x49a9f0);}})['then'](function(_0x114a7f){if(_0x114a7f){return _0x114a7f?{'count':_0x35c227,'rows':_0x114a7f}:null;}})[_0xa662('0x3a')](respondWithResult(_0x3bb877,null))[_0xa662('0x3f')](handleError(_0x3bb877,null));};exports[_0xa662('0x4d')]=function(_0xb5ac8b,_0x40806a,_0x418a79){var _0x1fe5e0={};var _0xabb838={};var _0x9d6cee;var _0x468004;return db[_0xa662('0x29')][_0xa662('0x48')]({'where':{'id':_0xb5ac8b['params']['id']}})[_0xa662('0x3a')](handleEntityNotFound(_0x40806a,null))[_0xa662('0x3a')](function(_0xd0dacc){if(_0xd0dacc){_0x9d6cee=_0xd0dacc;_0xabb838[_0xa662('0x2e')]=_[_0xa662('0x2f')](db[_0xa662('0x49')][_0xa662('0x2a')]);_0xabb838[_0xa662('0x30')]=_[_0xa662('0x2f')](_0xb5ac8b['query']);_0xabb838[_0xa662('0x38')]=_[_0xa662('0x31')](_0xabb838['model'],_0xabb838[_0xa662('0x30')]);_0x1fe5e0[_0xa662('0x33')]=_[_0xa662('0x31')](_0xabb838[_0xa662('0x2e')],qs[_0xa662('0x32')](_0xb5ac8b[_0xa662('0x30')][_0xa662('0x32')]));_0x1fe5e0[_0xa662('0x33')]=_0x1fe5e0[_0xa662('0x33')][_0xa662('0x34')]?_0x1fe5e0[_0xa662('0x33')]:_0xabb838[_0xa662('0x2e')];_0x1fe5e0[_0xa662('0x35')]=qs[_0xa662('0x36')](_0xb5ac8b[_0xa662('0x30')]['sort']);_0x1fe5e0[_0xa662('0x37')]=qs[_0xa662('0x38')](_[_0xa662('0x4a')](_0xb5ac8b[_0xa662('0x30')],_0xabb838[_0xa662('0x38')]));if(_0xb5ac8b[_0xa662('0x30')]['filter']){_0x1fe5e0[_0xa662('0x37')]=_['merge'](_0x1fe5e0[_0xa662('0x37')],{'$or':_['map'](_0x1fe5e0['attributes'],function(_0x50b995){var _0x12e7b0={};_0x12e7b0[_0x50b995]={'$like':'%'+_0xb5ac8b[_0xa662('0x30')]['filter']+'%'};return _0x12e7b0;})});}_0x1fe5e0=_[_0xa662('0x39')]({},_0x1fe5e0,_0xb5ac8b[_0xa662('0x42')]);return _0x9d6cee[_0xa662('0x4d')](_0x1fe5e0);}})[_0xa662('0x3a')](function(_0x1b0778){if(_0x1b0778){_0x468004=_0x1b0778[_0xa662('0x34')];if(!_0xb5ac8b[_0xa662('0x30')][_0xa662('0x4e')](_0xa662('0x4c'))){_0x1fe5e0[_0xa662('0x1d')]=qs[_0xa662('0x1d')](_0xb5ac8b[_0xa662('0x30')][_0xa662('0x1d')]);_0x1fe5e0[_0xa662('0x1b')]=qs[_0xa662('0x1b')](_0xb5ac8b[_0xa662('0x30')]['offset']);}return _0x9d6cee[_0xa662('0x4d')](_0x1fe5e0);}})[_0xa662('0x3a')](function(_0x3671c2){if(_0x3671c2){return _0x3671c2?{'count':_0x468004,'rows':_0x3671c2}:null;}})[_0xa662('0x3a')](respondWithResult(_0x40806a,null))[_0xa662('0x3f')](handleError(_0x40806a,null));};exports['getFields']=function(_0x2c415d,_0x9a71bc,_0xc25de5){var _0x3501f9={};var _0x6a0443={};var _0x5dcfb9;var _0x3c3f4c;return db[_0xa662('0x29')]['findOne']({'where':{'id':_0x2c415d[_0xa662('0x41')]['id']}})[_0xa662('0x3a')](handleEntityNotFound(_0x9a71bc,null))[_0xa662('0x3a')](function(_0x3636e6){if(_0x3636e6){_0x5dcfb9=_0x3636e6;_0x6a0443['model']=_[_0xa662('0x2f')](db[_0xa662('0x49')][_0xa662('0x2a')]);_0x6a0443[_0xa662('0x30')]=_[_0xa662('0x2f')](_0x2c415d[_0xa662('0x30')]);_0x6a0443[_0xa662('0x38')]=_[_0xa662('0x31')](_0x6a0443[_0xa662('0x2e')],_0x6a0443[_0xa662('0x30')]);_0x3501f9[_0xa662('0x33')]=_[_0xa662('0x31')](_0x6a0443['model'],qs['fields'](_0x2c415d[_0xa662('0x30')][_0xa662('0x32')]));_0x3501f9[_0xa662('0x33')]=_0x3501f9['attributes']['length']?_0x3501f9[_0xa662('0x33')]:_0x6a0443['model'];_0x3501f9['order']=qs[_0xa662('0x36')](_0x2c415d[_0xa662('0x30')][_0xa662('0x36')]);_0x3501f9[_0xa662('0x37')]=qs[_0xa662('0x38')](_[_0xa662('0x4a')](_0x2c415d['query'],_0x6a0443[_0xa662('0x38')]));if(_0x2c415d['query'][_0xa662('0x4b')]){_0x3501f9['where']=_['merge'](_0x3501f9[_0xa662('0x37')],{'$or':_[_0xa662('0x28')](_0x3501f9[_0xa662('0x33')],function(_0x12828c){var _0x2fc9ef={};_0x2fc9ef[_0x12828c]={'$like':'%'+_0x2c415d[_0xa662('0x30')]['filter']+'%'};return _0x2fc9ef;})});}_0x3501f9=_['merge']({},_0x3501f9,_0x2c415d[_0xa662('0x42')]);return _0x5dcfb9[_0xa662('0x4f')](_0x3501f9);}})[_0xa662('0x3a')](function(_0xb04a1b){if(_0xb04a1b){_0x3c3f4c=_0xb04a1b[_0xa662('0x34')];if(!_0x2c415d[_0xa662('0x30')][_0xa662('0x4e')](_0xa662('0x4c'))){_0x3501f9['limit']=qs['limit'](_0x2c415d['query'][_0xa662('0x1d')]);_0x3501f9[_0xa662('0x1b')]=qs[_0xa662('0x1b')](_0x2c415d[_0xa662('0x30')][_0xa662('0x1b')]);}return _0x5dcfb9['getFields'](_0x3501f9);}})['then'](function(_0x391b14){if(_0x391b14){return _0x391b14?{'count':_0x3c3f4c,'rows':_0x391b14}:null;}})[_0xa662('0x3a')](respondWithResult(_0x9a71bc,null))[_0xa662('0x3f')](handleError(_0x9a71bc,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9102a49..be58261 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 _0x0b3d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x0b3d,0x1af));var _0xd0b3=function(_0x2866c7,_0x197fdd){_0x2866c7=_0x2866c7-0x0;var _0x3c5db2=_0x0b3d[_0x2866c7];return _0x3c5db2;};'use strict';var _=require(_0xd0b3('0x0'));var util=require(_0xd0b3('0x1'));var logger=require(_0xd0b3('0x2'))(_0xd0b3('0x3'));var moment=require(_0xd0b3('0x4'));var BPromise=require(_0xd0b3('0x5'));var rp=require(_0xd0b3('0x6'));var fs=require('fs');var path=require(_0xd0b3('0x7'));var rimraf=require(_0xd0b3('0x8'));var config=require(_0xd0b3('0x9'));var attributes=require(_0xd0b3('0xa'));module[_0xd0b3('0xb')]=function(_0x33072a,_0x487e47){return _0x33072a[_0xd0b3('0xc')](_0xd0b3('0xd'),attributes,{'tableName':_0xd0b3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3593=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api'];(function(_0x399e3b,_0x5dd3d2){var _0x28c6a4=function(_0x7d77c1){while(--_0x7d77c1){_0x399e3b['push'](_0x399e3b['shift']());}};_0x28c6a4(++_0x5dd3d2);}(_0x3593,0x8c));var _0x3359=function(_0x585f6c,_0x537b7a){_0x585f6c=_0x585f6c-0x0;var _0x598331=_0x3593[_0x585f6c];return _0x598331;};'use strict';var _=require(_0x3359('0x0'));var util=require(_0x3359('0x1'));var logger=require(_0x3359('0x2'))(_0x3359('0x3'));var moment=require('moment');var BPromise=require(_0x3359('0x4'));var rp=require(_0x3359('0x5'));var fs=require('fs');var path=require(_0x3359('0x6'));var rimraf=require(_0x3359('0x7'));var config=require(_0x3359('0x8'));var attributes=require(_0x3359('0x9'));module['exports']=function(_0x286c04,_0x39c4ec){return _0x286c04['define'](_0x3359('0xa'),attributes,{'tableName':_0x3359('0xb'),'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 dd8eeb3..d67760a 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 _0x3d6a=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x311416,_0x4a48c8){var _0x31211d=function(_0x5e97ab){while(--_0x5e97ab){_0x311416['push'](_0x311416['shift']());}};_0x31211d(++_0x4a48c8);}(_0x3d6a,0xc3));var _0xa3d6=function(_0x51766a,_0x26d7a8){_0x51766a=_0x51766a-0x0;var _0x22089b=_0x3d6a[_0x51766a];return _0x22089b;};'use strict';var _=require(_0xa3d6('0x0'));var util=require(_0xa3d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa3d6('0x2'));var fs=require('fs');var Redis=require(_0xa3d6('0x3'));var db=require(_0xa3d6('0x4'))['db'];var utils=require(_0xa3d6('0x5'));var logger=require(_0xa3d6('0x6'))(_0xa3d6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3d6('0x8')][_0xa3d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44eb8b,_0x295818,_0x420bf0){return new BPromise(function(_0x37e8e1,_0x3f0bb7){return client[_0xa3d6('0xa')](_0x44eb8b,_0x420bf0)[_0xa3d6('0xb')](function(_0x1acf56){logger[_0xa3d6('0xc')](_0xa3d6('0xd'),_0x295818,_0xa3d6('0xe'));logger['debug'](_0xa3d6('0xf'),_0x295818,_0xa3d6('0xe'),JSON[_0xa3d6('0x10')](_0x1acf56));if(_0x1acf56[_0xa3d6('0x11')]){if(_0x1acf56[_0xa3d6('0x11')][_0xa3d6('0x12')]===0x1f4){logger[_0xa3d6('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x295818,_0x1acf56['error'][_0xa3d6('0x13')]);return _0x3f0bb7(_0x1acf56[_0xa3d6('0x11')]['message']);}logger['error'](_0xa3d6('0xd'),_0x295818,_0x1acf56[_0xa3d6('0x11')]['message']);return _0x37e8e1(_0x1acf56['error'][_0xa3d6('0x13')]);}else{logger[_0xa3d6('0xc')](_0xa3d6('0xd'),_0x295818,_0xa3d6('0xe'));_0x37e8e1(_0x1acf56['result']['message']);}})['catch'](function(_0x4b1520){logger[_0xa3d6('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x295818,_0x4b1520);_0x3f0bb7(_0x4b1520);});});} \ No newline at end of file +var _0x91a6=['code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0xa4c22b,_0xcc6a14){var _0x3adac5=function(_0x1a57e5){while(--_0x1a57e5){_0xa4c22b['push'](_0xa4c22b['shift']());}};_0x3adac5(++_0xcc6a14);}(_0x91a6,0x67));var _0x691a=function(_0x4d4345,_0x32a68a){_0x4d4345=_0x4d4345-0x0;var _0x23d12e=_0x91a6[_0x4d4345];return _0x23d12e;};'use strict';var _=require(_0x691a('0x0'));var util=require(_0x691a('0x1'));var moment=require(_0x691a('0x2'));var BPromise=require(_0x691a('0x3'));var rs=require(_0x691a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x691a('0x5'))['db'];var utils=require(_0x691a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x691a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x691a('0x8')][_0x691a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1be3c7,_0x499408,_0xc098eb){return new BPromise(function(_0x580e52,_0x3f839f){return client[_0x691a('0xa')](_0x1be3c7,_0xc098eb)[_0x691a('0xb')](function(_0x4c6b7f){logger[_0x691a('0xc')](_0x691a('0xd'),_0x499408,_0x691a('0xe'));logger['debug'](_0x691a('0xf'),_0x499408,'request\x20sent',JSON['stringify'](_0x4c6b7f));if(_0x4c6b7f[_0x691a('0x10')]){if(_0x4c6b7f[_0x691a('0x10')][_0x691a('0x11')]===0x1f4){logger[_0x691a('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x499408,_0x4c6b7f[_0x691a('0x10')][_0x691a('0x12')]);return _0x3f839f(_0x4c6b7f[_0x691a('0x10')]['message']);}logger[_0x691a('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x499408,_0x4c6b7f[_0x691a('0x10')]['message']);return _0x580e52(_0x4c6b7f['error'][_0x691a('0x12')]);}else{logger[_0x691a('0xc')](_0x691a('0xd'),_0x499408,_0x691a('0xe'));_0x580e52(_0x4c6b7f['result'][_0x691a('0x12')]);}})[_0x691a('0x13')](function(_0x4f56ba){logger[_0x691a('0x10')](_0x691a('0xd'),_0x499408,_0x4f56ba);_0x3f839f(_0x4f56ba);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 329407f..52302af 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 _0x5ff3=['fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','post','create','/:id','update','delete','destroy','util','connect-timeout','Router'];(function(_0x3c3eb7,_0x55343d){var _0x108733=function(_0x5bd6f6){while(--_0x5bd6f6){_0x3c3eb7['push'](_0x3c3eb7['shift']());}};_0x108733(++_0x55343d);}(_0x5ff3,0x17d));var _0x35ff=function(_0x37c21a,_0xbfeeb7){_0x37c21a=_0x37c21a-0x0;var _0x4869ee=_0x5ff3[_0x37c21a];return _0x4869ee;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var fs_extra=require(_0x35ff('0x3'));var auth=require(_0x35ff('0x4'));var interaction=require(_0x35ff('0x5'));var config=require('../../config/environment');var controller=require(_0x35ff('0x6'));router[_0x35ff('0x7')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0x9')]);router[_0x35ff('0x7')]('/:id',auth[_0x35ff('0x8')](),controller['show']);router[_0x35ff('0xa')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0xb')]);router['put'](_0x35ff('0xc'),auth['isAuthenticated'](),controller[_0x35ff('0xd')]);router[_0x35ff('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3164=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x339765,_0x111d76){var _0x5e6ba8=function(_0xc6e8a){while(--_0xc6e8a){_0x339765['push'](_0x339765['shift']());}};_0x5e6ba8(++_0x111d76);}(_0x3164,0x182));var _0x4316=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x3164[_0x5dfc2a];return _0x3f1a71;};'use strict';var multer=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var path=require(_0x4316('0x2'));var timeout=require(_0x4316('0x3'));var express=require(_0x4316('0x4'));var router=express['Router']();var fs_extra=require(_0x4316('0x5'));var auth=require(_0x4316('0x6'));var interaction=require(_0x4316('0x7'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x4316('0x8')]('/',auth[_0x4316('0x9')](),controller[_0x4316('0xa')]);router[_0x4316('0x8')](_0x4316('0xb'),auth[_0x4316('0x9')](),controller[_0x4316('0xc')]);router[_0x4316('0xd')]('/',auth[_0x4316('0x9')](),controller[_0x4316('0xe')]);router[_0x4316('0xf')](_0x4316('0xb'),auth[_0x4316('0x9')](),controller[_0x4316('0x10')]);router['delete'](_0x4316('0xb'),auth[_0x4316('0x9')](),controller[_0x4316('0x11')]);module[_0x4316('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 869f636..fc46e5f 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 _0xbfd6=['picklist','STRING','BOOLEAN','exports','ENUM','string','customVariable'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xbfd6,0x122));var _0x6bfd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbfd6[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x6bfd('0x0')]={'type':{'type':Sequelize[_0x6bfd('0x1')](_0x6bfd('0x2'),'variable',_0x6bfd('0x3'),'keyValue',_0x6bfd('0x4')),'defaultValue':_0x6bfd('0x2')},'content':{'type':Sequelize[_0x6bfd('0x5')]},'key':{'type':Sequelize[_0x6bfd('0x5')]},'keyType':{'type':Sequelize[_0x6bfd('0x1')](_0x6bfd('0x2'),'variable',_0x6bfd('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6bfd('0x5')]},'nameField':{'type':Sequelize[_0x6bfd('0x5')]},'customField':{'type':Sequelize[_0x6bfd('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6bfd('0x5')]}}; \ No newline at end of file +var _0xb82b=['exports','string','variable','picklist','STRING','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb82b,0x1ce));var _0xbb82=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb82b[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0xbb82('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbb82('0x1'),_0xbb82('0x2'),'customVariable','keyValue',_0xbb82('0x3')),'defaultValue':_0xbb82('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xbb82('0x4')]},'keyType':{'type':Sequelize[_0xbb82('0x5')](_0xbb82('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xbb82('0x4')]},'idField':{'type':Sequelize[_0xbb82('0x4')]},'nameField':{'type':Sequelize[_0xbb82('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb82('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 8a4b366..8f23bda 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 _0x4d27=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','include','findAll','rows','show','params','rawAttributes','includeAll','catch'];(function(_0x3211e4,_0x4eeecb){var _0x4f0edc=function(_0x4dcca9){while(--_0x4dcca9){_0x3211e4['push'](_0x3211e4['shift']());}};_0x4f0edc(++_0x4eeecb);}(_0x4d27,0x126));var _0x74d2=function(_0x3025b1,_0x26ace5){_0x3025b1=_0x3025b1-0x0;var _0x1840ef=_0x4d27[_0x3025b1];return _0x1840ef;};'use strict';var emlformat=require(_0x74d2('0x0'));var rimraf=require(_0x74d2('0x1'));var zipdir=require(_0x74d2('0x2'));var jsonpatch=require(_0x74d2('0x3'));var rp=require(_0x74d2('0x4'));var moment=require(_0x74d2('0x5'));var BPromise=require(_0x74d2('0x6'));var Mustache=require(_0x74d2('0x7'));var util=require(_0x74d2('0x8'));var path=require(_0x74d2('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74d2('0xa'));var squel=require(_0x74d2('0xb'));var crypto=require(_0x74d2('0xc'));var jsforce=require(_0x74d2('0xd'));var deskjs=require(_0x74d2('0xe'));var toCsv=require(_0x74d2('0xf'));var querystring=require('querystring');var Papa=require(_0x74d2('0x10'));var Redis=require(_0x74d2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x74d2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x74d2('0x13'))(_0x74d2('0x14'));var utils=require(_0x74d2('0x15'));var config=require(_0x74d2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x74d2('0x17'))['db'];function respondWithStatusCode(_0x1cebc6,_0x17b06f){_0x17b06f=_0x17b06f||0xcc;return function(_0x1c5bba){if(_0x1c5bba){return _0x1cebc6[_0x74d2('0x18')](_0x17b06f);}return _0x1cebc6[_0x74d2('0x19')](_0x17b06f)[_0x74d2('0x1a')]();};}function respondWithResult(_0x197332,_0x12ffd4){_0x12ffd4=_0x12ffd4||0xc8;return function(_0x4bf0d2){if(_0x4bf0d2){return _0x197332[_0x74d2('0x19')](_0x12ffd4)[_0x74d2('0x1b')](_0x4bf0d2);}};}function respondWithFilteredResult(_0x35c3a2,_0xa71ff9){return function(_0x488e86){if(_0x488e86){var _0x4039b7=typeof _0xa71ff9[_0x74d2('0x1c')]===_0x74d2('0x1d')&&typeof _0xa71ff9[_0x74d2('0x1e')]==='undefined';var _0x13de9f=_0x488e86['count'];var _0x211378=_0x4039b7?0x0:_0xa71ff9[_0x74d2('0x1c')];var _0x423d43=_0x4039b7?_0x488e86[_0x74d2('0x1f')]:_0xa71ff9['offset']+_0xa71ff9[_0x74d2('0x1e')];var _0x2dbac5;if(_0x423d43>=_0x13de9f){_0x423d43=_0x13de9f;_0x2dbac5=0xc8;}else{_0x2dbac5=0xce;}_0x35c3a2[_0x74d2('0x19')](_0x2dbac5);return _0x35c3a2[_0x74d2('0x20')](_0x74d2('0x21'),_0x211378+'-'+_0x423d43+'/'+_0x13de9f)[_0x74d2('0x1b')](_0x488e86);}return null;};}function patchUpdates(_0x4e6f72){return function(_0x54fd03){try{jsonpatch[_0x74d2('0x22')](_0x54fd03,_0x4e6f72,!![]);}catch(_0x373f2a){return BPromise['reject'](_0x373f2a);}return _0x54fd03[_0x74d2('0x23')]();};}function saveUpdates(_0x83a809,_0x13ae8d){return function(_0x7562b8){if(_0x7562b8){return _0x7562b8[_0x74d2('0x24')](_0x83a809)[_0x74d2('0x25')](function(_0x260af6){return _0x260af6;});}return null;};}function removeEntity(_0x383185,_0x11a9eb){return function(_0x37a1fb){if(_0x37a1fb){return _0x37a1fb[_0x74d2('0x26')]()[_0x74d2('0x25')](function(){_0x383185[_0x74d2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41e1cf,_0x5c1356){return function(_0x4b9226){if(!_0x4b9226){_0x41e1cf['sendStatus'](0x194);}return _0x4b9226;};}function handleError(_0x1f3b70,_0x3374a7){_0x3374a7=_0x3374a7||0x1f4;return function(_0x759d8c){logger[_0x74d2('0x27')](_0x759d8c['stack']);if(_0x759d8c[_0x74d2('0x28')]){delete _0x759d8c['name'];}_0x1f3b70[_0x74d2('0x19')](_0x3374a7)[_0x74d2('0x29')](_0x759d8c);};}exports[_0x74d2('0x2a')]=function(_0x13da4a,_0x2afa34){var _0x4d507d={},_0x466f8c={},_0x146311={'count':0x0,'rows':[]};var _0x35d0c5=_[_0x74d2('0x2b')](db['FreshsalesField']['rawAttributes'],function(_0x33ed70){return{'name':_0x33ed70['fieldName'],'type':_0x33ed70[_0x74d2('0x2c')][_0x74d2('0x2d')]};});_0x466f8c['model']=_[_0x74d2('0x2b')](_0x35d0c5,'name');_0x466f8c[_0x74d2('0x2e')]=_[_0x74d2('0x2f')](_0x13da4a[_0x74d2('0x2e')]);_0x466f8c[_0x74d2('0x30')]=_[_0x74d2('0x31')](_0x466f8c['model'],_0x466f8c[_0x74d2('0x2e')]);_0x4d507d[_0x74d2('0x32')]=_[_0x74d2('0x31')](_0x466f8c[_0x74d2('0x33')],qs['fields'](_0x13da4a['query'][_0x74d2('0x34')]));_0x4d507d[_0x74d2('0x32')]=_0x4d507d[_0x74d2('0x32')][_0x74d2('0x35')]?_0x4d507d[_0x74d2('0x32')]:_0x466f8c[_0x74d2('0x33')];if(!_0x13da4a['query']['hasOwnProperty']('nolimit')){_0x4d507d[_0x74d2('0x1e')]=qs[_0x74d2('0x1e')](_0x13da4a['query'][_0x74d2('0x1e')]);_0x4d507d[_0x74d2('0x1c')]=qs[_0x74d2('0x1c')](_0x13da4a[_0x74d2('0x2e')][_0x74d2('0x1c')]);}_0x4d507d[_0x74d2('0x36')]=qs[_0x74d2('0x37')](_0x13da4a[_0x74d2('0x2e')]['sort']);_0x4d507d[_0x74d2('0x38')]=qs[_0x74d2('0x30')](_[_0x74d2('0x39')](_0x13da4a[_0x74d2('0x2e')],_0x466f8c[_0x74d2('0x30')]),_0x35d0c5);if(_0x13da4a['query'][_0x74d2('0x3a')]){_0x4d507d[_0x74d2('0x38')]=_[_0x74d2('0x3b')](_0x4d507d[_0x74d2('0x38')],{'$or':_['map'](_0x35d0c5,function(_0x69a500){if(_0x69a500[_0x74d2('0x2c')]!==_0x74d2('0x3c')){var _0x490961={};_0x490961[_0x69a500['name']]={'$like':'%'+_0x13da4a[_0x74d2('0x2e')][_0x74d2('0x3a')]+'%'};return _0x490961;}})});}_0x4d507d=_[_0x74d2('0x3b')]({},_0x4d507d,_0x13da4a[_0x74d2('0x3d')]);var _0x45afac={'where':_0x4d507d['where']};return db[_0x74d2('0x3e')][_0x74d2('0x1f')](_0x45afac)[_0x74d2('0x25')](function(_0x59b29b){_0x146311['count']=_0x59b29b;if(_0x13da4a[_0x74d2('0x2e')]['includeAll']){_0x4d507d[_0x74d2('0x3f')]=[{'all':!![]}];}return db[_0x74d2('0x3e')][_0x74d2('0x40')](_0x4d507d);})[_0x74d2('0x25')](function(_0x4498b9){_0x146311[_0x74d2('0x41')]=_0x4498b9;return _0x146311;})[_0x74d2('0x25')](respondWithFilteredResult(_0x2afa34,_0x4d507d))['catch'](handleError(_0x2afa34,null));};exports[_0x74d2('0x42')]=function(_0x547cff,_0x4c2f0f){var _0x37d5fa={'raw':!![],'where':{'id':_0x547cff[_0x74d2('0x43')]['id']}},_0x22ef71={};_0x22ef71['model']=_[_0x74d2('0x2f')](db[_0x74d2('0x3e')][_0x74d2('0x44')]);_0x22ef71[_0x74d2('0x2e')]=_[_0x74d2('0x2f')](_0x547cff[_0x74d2('0x2e')]);_0x22ef71[_0x74d2('0x30')]=_[_0x74d2('0x31')](_0x22ef71[_0x74d2('0x33')],_0x22ef71[_0x74d2('0x2e')]);_0x37d5fa[_0x74d2('0x32')]=_[_0x74d2('0x31')](_0x22ef71[_0x74d2('0x33')],qs[_0x74d2('0x34')](_0x547cff[_0x74d2('0x2e')][_0x74d2('0x34')]));_0x37d5fa['attributes']=_0x37d5fa[_0x74d2('0x32')][_0x74d2('0x35')]?_0x37d5fa['attributes']:_0x22ef71[_0x74d2('0x33')];if(_0x547cff[_0x74d2('0x2e')][_0x74d2('0x45')]){_0x37d5fa['include']=[{'all':!![]}];}_0x37d5fa=_[_0x74d2('0x3b')]({},_0x37d5fa,_0x547cff[_0x74d2('0x3d')]);return db[_0x74d2('0x3e')]['find'](_0x37d5fa)[_0x74d2('0x25')](handleEntityNotFound(_0x4c2f0f,null))[_0x74d2('0x25')](respondWithResult(_0x4c2f0f,null))[_0x74d2('0x46')](handleError(_0x4c2f0f,null));};exports[_0x74d2('0x47')]=function(_0x5df5ce,_0x3b4658){return db[_0x74d2('0x3e')][_0x74d2('0x47')](_0x5df5ce[_0x74d2('0x48')],{})['then'](respondWithResult(_0x3b4658,0xc9))[_0x74d2('0x46')](handleError(_0x3b4658,null));};exports['update']=function(_0x51746c,_0x2ba503){if(_0x51746c['body']['id']){delete _0x51746c[_0x74d2('0x48')]['id'];}return db[_0x74d2('0x3e')]['find']({'where':{'id':_0x51746c[_0x74d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ba503,null))[_0x74d2('0x25')](saveUpdates(_0x51746c[_0x74d2('0x48')],null))[_0x74d2('0x25')](respondWithResult(_0x2ba503,null))[_0x74d2('0x46')](handleError(_0x2ba503,null));};exports[_0x74d2('0x26')]=function(_0x197262,_0x2fbea5){return db[_0x74d2('0x3e')]['find']({'where':{'id':_0x197262[_0x74d2('0x43')]['id']}})[_0x74d2('0x25')](handleEntityNotFound(_0x2fbea5,null))[_0x74d2('0x25')](removeEntity(_0x2fbea5,null))[_0x74d2('0x46')](handleError(_0x2fbea5,null));}; \ No newline at end of file +var _0xceff=['lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../mysqldb','status','end','json','offset','undefined','limit','count','set','update','then','destroy','sendStatus','error','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','mustache','path','sox','to-csv'];(function(_0x4b55a9,_0x321895){var _0x9791cd=function(_0x57a008){while(--_0x57a008){_0x4b55a9['push'](_0x4b55a9['shift']());}};_0x9791cd(++_0x321895);}(_0xceff,0xb0));var _0xfcef=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xceff[_0x1b2ff7];return _0x31656a;};'use strict';var emlformat=require(_0xfcef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcef('0x1'));var jsonpatch=require(_0xfcef('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfcef('0x3'));var util=require('util');var path=require(_0xfcef('0x4'));var sox=require(_0xfcef('0x5'));var csv=require(_0xfcef('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcef('0x7'));var squel=require('squel');var crypto=require(_0xfcef('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfcef('0x6'));var querystring=require('querystring');var Papa=require(_0xfcef('0x9'));var Redis=require(_0xfcef('0xa'));var authService=require(_0xfcef('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xfcef('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfcef('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcef('0xe'))['db'];function respondWithStatusCode(_0xed71ab,_0x186582){_0x186582=_0x186582||0xcc;return function(_0x69f04e){if(_0x69f04e){return _0xed71ab['sendStatus'](_0x186582);}return _0xed71ab[_0xfcef('0xf')](_0x186582)[_0xfcef('0x10')]();};}function respondWithResult(_0x29f284,_0xf59f8f){_0xf59f8f=_0xf59f8f||0xc8;return function(_0x55c3c1){if(_0x55c3c1){return _0x29f284[_0xfcef('0xf')](_0xf59f8f)[_0xfcef('0x11')](_0x55c3c1);}};}function respondWithFilteredResult(_0x271ed1,_0x293ec2){return function(_0x4130ba){if(_0x4130ba){var _0x21e583=typeof _0x293ec2[_0xfcef('0x12')]===_0xfcef('0x13')&&typeof _0x293ec2[_0xfcef('0x14')]===_0xfcef('0x13');var _0x58f0cc=_0x4130ba[_0xfcef('0x15')];var _0x3f328c=_0x21e583?0x0:_0x293ec2['offset'];var _0x1dc1f4=_0x21e583?_0x4130ba[_0xfcef('0x15')]:_0x293ec2[_0xfcef('0x12')]+_0x293ec2[_0xfcef('0x14')];var _0x574ea7;if(_0x1dc1f4>=_0x58f0cc){_0x1dc1f4=_0x58f0cc;_0x574ea7=0xc8;}else{_0x574ea7=0xce;}_0x271ed1[_0xfcef('0xf')](_0x574ea7);return _0x271ed1[_0xfcef('0x16')]('Content-Range',_0x3f328c+'-'+_0x1dc1f4+'/'+_0x58f0cc)['json'](_0x4130ba);}return null;};}function patchUpdates(_0x5d6cfe){return function(_0x373a41){try{jsonpatch['apply'](_0x373a41,_0x5d6cfe,!![]);}catch(_0x4e59c5){return BPromise['reject'](_0x4e59c5);}return _0x373a41['save']();};}function saveUpdates(_0x119537,_0x36ae6b){return function(_0x1ddc20){if(_0x1ddc20){return _0x1ddc20[_0xfcef('0x17')](_0x119537)[_0xfcef('0x18')](function(_0x5770a2){return _0x5770a2;});}return null;};}function removeEntity(_0x2157fd,_0x31a545){return function(_0x3c6546){if(_0x3c6546){return _0x3c6546[_0xfcef('0x19')]()[_0xfcef('0x18')](function(){_0x2157fd[_0xfcef('0xf')](0xcc)[_0xfcef('0x10')]();});}};}function handleEntityNotFound(_0x368f74,_0xf3fa5d){return function(_0x48e26c){if(!_0x48e26c){_0x368f74[_0xfcef('0x1a')](0x194);}return _0x48e26c;};}function handleError(_0x33882b,_0xecc03a){_0xecc03a=_0xecc03a||0x1f4;return function(_0x5c9f0){logger[_0xfcef('0x1b')](_0x5c9f0[_0xfcef('0x1c')]);if(_0x5c9f0[_0xfcef('0x1d')]){delete _0x5c9f0['name'];}_0x33882b[_0xfcef('0xf')](_0xecc03a)[_0xfcef('0x1e')](_0x5c9f0);};}exports[_0xfcef('0x1f')]=function(_0x4cab,_0x53157a){var _0x53b7a9={},_0x1b453d={},_0x1d0840={'count':0x0,'rows':[]};var _0x154e07=_['map'](db[_0xfcef('0x20')][_0xfcef('0x21')],function(_0x8f65b2){return{'name':_0x8f65b2[_0xfcef('0x22')],'type':_0x8f65b2[_0xfcef('0x23')][_0xfcef('0x24')]};});_0x1b453d[_0xfcef('0x25')]=_[_0xfcef('0x26')](_0x154e07,'name');_0x1b453d[_0xfcef('0x27')]=_[_0xfcef('0x28')](_0x4cab[_0xfcef('0x27')]);_0x1b453d[_0xfcef('0x29')]=_[_0xfcef('0x2a')](_0x1b453d['model'],_0x1b453d['query']);_0x53b7a9[_0xfcef('0x2b')]=_[_0xfcef('0x2a')](_0x1b453d[_0xfcef('0x25')],qs['fields'](_0x4cab[_0xfcef('0x27')][_0xfcef('0x2c')]));_0x53b7a9['attributes']=_0x53b7a9[_0xfcef('0x2b')][_0xfcef('0x2d')]?_0x53b7a9[_0xfcef('0x2b')]:_0x1b453d[_0xfcef('0x25')];if(!_0x4cab['query']['hasOwnProperty'](_0xfcef('0x2e'))){_0x53b7a9[_0xfcef('0x14')]=qs[_0xfcef('0x14')](_0x4cab[_0xfcef('0x27')][_0xfcef('0x14')]);_0x53b7a9[_0xfcef('0x12')]=qs['offset'](_0x4cab['query']['offset']);}_0x53b7a9['order']=qs[_0xfcef('0x2f')](_0x4cab[_0xfcef('0x27')][_0xfcef('0x2f')]);_0x53b7a9['where']=qs['filters'](_['pick'](_0x4cab[_0xfcef('0x27')],_0x1b453d[_0xfcef('0x29')]),_0x154e07);if(_0x4cab[_0xfcef('0x27')][_0xfcef('0x30')]){_0x53b7a9['where']=_[_0xfcef('0x31')](_0x53b7a9[_0xfcef('0x32')],{'$or':_['map'](_0x154e07,function(_0x25be72){if(_0x25be72[_0xfcef('0x23')]!==_0xfcef('0x33')){var _0x4b5423={};_0x4b5423[_0x25be72[_0xfcef('0x1d')]]={'$like':'%'+_0x4cab[_0xfcef('0x27')][_0xfcef('0x30')]+'%'};return _0x4b5423;}})});}_0x53b7a9=_[_0xfcef('0x31')]({},_0x53b7a9,_0x4cab[_0xfcef('0x34')]);var _0x19dfa4={'where':_0x53b7a9[_0xfcef('0x32')]};return db[_0xfcef('0x20')][_0xfcef('0x15')](_0x19dfa4)[_0xfcef('0x18')](function(_0x58bb41){_0x1d0840[_0xfcef('0x15')]=_0x58bb41;if(_0x4cab['query'][_0xfcef('0x35')]){_0x53b7a9['include']=[{'all':!![]}];}return db[_0xfcef('0x20')]['findAll'](_0x53b7a9);})[_0xfcef('0x18')](function(_0x14d4c9){_0x1d0840[_0xfcef('0x36')]=_0x14d4c9;return _0x1d0840;})['then'](respondWithFilteredResult(_0x53157a,_0x53b7a9))[_0xfcef('0x37')](handleError(_0x53157a,null));};exports[_0xfcef('0x38')]=function(_0x161591,_0x3f4f0b){var _0x53e249={'raw':!![],'where':{'id':_0x161591[_0xfcef('0x39')]['id']}},_0x2afad9={};_0x2afad9['model']=_[_0xfcef('0x28')](db['FreshsalesField'][_0xfcef('0x21')]);_0x2afad9[_0xfcef('0x27')]=_[_0xfcef('0x28')](_0x161591[_0xfcef('0x27')]);_0x2afad9['filters']=_[_0xfcef('0x2a')](_0x2afad9[_0xfcef('0x25')],_0x2afad9[_0xfcef('0x27')]);_0x53e249[_0xfcef('0x2b')]=_[_0xfcef('0x2a')](_0x2afad9[_0xfcef('0x25')],qs[_0xfcef('0x2c')](_0x161591[_0xfcef('0x27')][_0xfcef('0x2c')]));_0x53e249[_0xfcef('0x2b')]=_0x53e249[_0xfcef('0x2b')]['length']?_0x53e249['attributes']:_0x2afad9[_0xfcef('0x25')];if(_0x161591[_0xfcef('0x27')]['includeAll']){_0x53e249['include']=[{'all':!![]}];}_0x53e249=_[_0xfcef('0x31')]({},_0x53e249,_0x161591[_0xfcef('0x34')]);return db[_0xfcef('0x20')][_0xfcef('0x3a')](_0x53e249)['then'](handleEntityNotFound(_0x3f4f0b,null))[_0xfcef('0x18')](respondWithResult(_0x3f4f0b,null))['catch'](handleError(_0x3f4f0b,null));};exports[_0xfcef('0x3b')]=function(_0x24ff80,_0x46e9ce){return db['FreshsalesField'][_0xfcef('0x3b')](_0x24ff80[_0xfcef('0x3c')],{})[_0xfcef('0x18')](respondWithResult(_0x46e9ce,0xc9))['catch'](handleError(_0x46e9ce,null));};exports[_0xfcef('0x17')]=function(_0x55394f,_0x38422f){if(_0x55394f[_0xfcef('0x3c')]['id']){delete _0x55394f['body']['id'];}return db[_0xfcef('0x20')]['find']({'where':{'id':_0x55394f[_0xfcef('0x39')]['id']}})[_0xfcef('0x18')](handleEntityNotFound(_0x38422f,null))['then'](saveUpdates(_0x55394f[_0xfcef('0x3c')],null))[_0xfcef('0x18')](respondWithResult(_0x38422f,null))['catch'](handleError(_0x38422f,null));};exports[_0xfcef('0x19')]=function(_0x97b84d,_0x20701c){return db['FreshsalesField'][_0xfcef('0x3a')]({'where':{'id':_0x97b84d['params']['id']}})['then'](handleEntityNotFound(_0x20701c,null))[_0xfcef('0x18')](removeEntity(_0x20701c,null))[_0xfcef('0x37')](handleError(_0x20701c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 4e98b45..8cd958a 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 _0x5942=['define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x5ad0c6,_0x56ee17){var _0x167958=function(_0x32dd81){while(--_0x32dd81){_0x5ad0c6['push'](_0x5ad0c6['shift']());}};_0x167958(++_0x56ee17);}(_0x5942,0x16a));var _0x2594=function(_0xa7cd19,_0x2ec1a4){_0xa7cd19=_0xa7cd19-0x0;var _0x329877=_0x5942[_0xa7cd19];return _0x329877;};'use strict';var _=require(_0x2594('0x0'));var util=require(_0x2594('0x1'));var logger=require(_0x2594('0x2'))(_0x2594('0x3'));var moment=require(_0x2594('0x4'));var BPromise=require(_0x2594('0x5'));var rp=require(_0x2594('0x6'));var fs=require('fs');var path=require(_0x2594('0x7'));var rimraf=require(_0x2594('0x8'));var config=require(_0x2594('0x9'));var attributes=require(_0x2594('0xa'));module[_0x2594('0xb')]=function(_0x495540,_0x59f01a){return _0x495540[_0x2594('0xc')](_0x2594('0xd'),attributes,{'tableName':_0x2594('0xe'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x2594('0xf'),_0x2594('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x93e9=['request-promise','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x46a742,_0x3d237e){var _0x4436e7=function(_0x2a12e6){while(--_0x2a12e6){_0x46a742['push'](_0x46a742['shift']());}};_0x4436e7(++_0x3d237e);}(_0x93e9,0xcc));var _0x993e=function(_0x3c5482,_0x8f4ac1){_0x3c5482=_0x3c5482-0x0;var _0x465531=_0x93e9[_0x3c5482];return _0x465531;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x993e('0xd'),_0x993e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 366e45d..85055cf 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 _0xb4c7=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x268fb7,_0x174041){var _0x5006b3=function(_0x2d83f3){while(--_0x2d83f3){_0x268fb7['push'](_0x268fb7['shift']());}};_0x5006b3(++_0x174041);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x288cbd,_0x4f7b5e){_0x288cbd=_0x288cbd-0x0;var _0x237da4=_0xb4c7[_0x288cbd];return _0x237da4;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file +var _0x7096=['code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x7096,0x10c));var _0x6709=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7096[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index d4d053a..50168a4 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5b1be6,_0x3b609b){var _0x361caf=function(_0xc18faf){while(--_0xc18faf){_0x5b1be6['push'](_0x5b1be6['shift']());}};_0x361caf(++_0x3b609b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x98ec80,_0x937897){var _0x1cbb96=function(_0x3b628b){while(--_0x3b628b){_0x98ec80['push'](_0x98ec80['shift']());}};_0x1cbb96(++_0x937897);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 70e8f40..1992cd8 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 _0x2015=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x5c4d18,_0x4358d6){var _0x43959d=function(_0x329bcc){while(--_0x329bcc){_0x5c4d18['push'](_0x5c4d18['shift']());}};_0x43959d(++_0x4358d6);}(_0x2015,0x193));var _0x5201=function(_0x1dc59d,_0x479e93){_0x1dc59d=_0x1dc59d-0x0;var _0x2b1d44=_0x2015[_0x1dc59d];return _0x2b1d44;};'use strict';var Sequelize=require(_0x5201('0x0'));module[_0x5201('0x1')]={'name':{'type':Sequelize[_0x5201('0x2')]},'description':{'type':Sequelize[_0x5201('0x2')]},'username':{'type':Sequelize[_0x5201('0x2')],'unique':_0x5201('0x3')},'remoteUri':{'type':Sequelize[_0x5201('0x2')]},'password':{'type':Sequelize[_0x5201('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x5201('0x2')]},'securityToken':{'type':Sequelize[_0x5201('0x2')]},'serverUrl':{'type':Sequelize[_0x5201('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5201('0x4')](_0x5201('0x5'),_0x5201('0x6')),'defaultValue':_0x5201('0x5')}}; \ No newline at end of file +var _0xbc36=['integrationTab','sequelize','STRING','username','ENUM'];(function(_0x5bb271,_0x35153d){var _0x5a6b7f=function(_0x23f88a){while(--_0x23f88a){_0x5bb271['push'](_0x5bb271['shift']());}};_0x5a6b7f(++_0x35153d);}(_0xbc36,0x169));var _0x6bc3=function(_0x486195,_0x457be4){_0x486195=_0x486195-0x0;var _0x2115e6=_0xbc36[_0x486195];return _0x2115e6;};'use strict';var Sequelize=require(_0x6bc3('0x0'));module['exports']={'name':{'type':Sequelize[_0x6bc3('0x1')]},'description':{'type':Sequelize[_0x6bc3('0x1')]},'username':{'type':Sequelize[_0x6bc3('0x1')],'unique':_0x6bc3('0x2')},'remoteUri':{'type':Sequelize[_0x6bc3('0x1')]},'password':{'type':Sequelize[_0x6bc3('0x1')]},'clientId':{'type':Sequelize[_0x6bc3('0x1')]},'clientSecret':{'type':Sequelize[_0x6bc3('0x1')]},'securityToken':{'type':Sequelize[_0x6bc3('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6bc3('0x3')](_0x6bc3('0x4'),'newTab'),'defaultValue':_0x6bc3('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 2085a95..85114ef 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 _0x65c8=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','SalesforceConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','findOne','clientId','clientSecret','username','securityToken','remoteUri','Connection','login','password','isNil','sobject','describe','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','phone','remove','includes','custom','picklistValues','label','value','True','true','False','statusCode','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1fe5f5,_0x171ac6){var _0x4b6d9d=function(_0x247f88){while(--_0x247f88){_0x1fe5f5['push'](_0x1fe5f5['shift']());}};_0x4b6d9d(++_0x171ac6);}(_0x65c8,0xe6));var _0x865c=function(_0x44c9bb,_0x470c5c){_0x44c9bb=_0x44c9bb-0x0;var _0x4ed2d2=_0x65c8[_0x44c9bb];return _0x4ed2d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x865c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x865c('0x1'));var rp=require(_0x865c('0x2'));var moment=require('moment');var BPromise=require(_0x865c('0x3'));var Mustache=require('mustache');var util=require(_0x865c('0x4'));var path=require(_0x865c('0x5'));var sox=require(_0x865c('0x6'));var csv=require(_0x865c('0x7'));var ejs=require(_0x865c('0x8'));var fs=require('fs');var fs_extra=require(_0x865c('0x9'));var _=require(_0x865c('0xa'));var squel=require(_0x865c('0xb'));var crypto=require(_0x865c('0xc'));var jsforce=require(_0x865c('0xd'));var deskjs=require(_0x865c('0xe'));var toCsv=require(_0x865c('0x7'));var querystring=require(_0x865c('0xf'));var Papa=require(_0x865c('0x10'));var Redis=require(_0x865c('0x11'));var authService=require(_0x865c('0x12'));var qs=require(_0x865c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x865c('0x14'));var logger=require(_0x865c('0x15'))(_0x865c('0x16'));var utils=require('../../config/utils');var config=require(_0x865c('0x17'));var licenseUtil=require(_0x865c('0x18'));var db=require(_0x865c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x190412,_0x41dc00){_0x41dc00=_0x41dc00||0xcc;return function(_0x4e7bd6){if(_0x4e7bd6){return _0x190412['sendStatus'](_0x41dc00);}return _0x190412[_0x865c('0x1a')](_0x41dc00)[_0x865c('0x1b')]();};}function respondWithResult(_0x20d24d,_0x55855a){_0x55855a=_0x55855a||0xc8;return function(_0x31cd28){if(_0x31cd28){return _0x20d24d[_0x865c('0x1a')](_0x55855a)[_0x865c('0x1c')](_0x31cd28);}};}function respondWithFilteredResult(_0x27c313,_0x33db4c){return function(_0x251a43){if(_0x251a43){var _0x3918b4=typeof _0x33db4c[_0x865c('0x1d')]===_0x865c('0x1e')&&typeof _0x33db4c[_0x865c('0x1f')]===_0x865c('0x1e');var _0x11c290=_0x251a43[_0x865c('0x20')];var _0x27767d=_0x3918b4?0x0:_0x33db4c[_0x865c('0x1d')];var _0x130e0f=_0x3918b4?_0x251a43[_0x865c('0x20')]:_0x33db4c['offset']+_0x33db4c[_0x865c('0x1f')];var _0x423d16;if(_0x130e0f>=_0x11c290){_0x130e0f=_0x11c290;_0x423d16=0xc8;}else{_0x423d16=0xce;}_0x27c313[_0x865c('0x1a')](_0x423d16);return _0x27c313[_0x865c('0x21')](_0x865c('0x22'),_0x27767d+'-'+_0x130e0f+'/'+_0x11c290)[_0x865c('0x1c')](_0x251a43);}return null;};}function patchUpdates(_0xf3ae82){return function(_0x9ac7bc){try{jsonpatch[_0x865c('0x23')](_0x9ac7bc,_0xf3ae82,!![]);}catch(_0x773cc){return BPromise[_0x865c('0x24')](_0x773cc);}return _0x9ac7bc[_0x865c('0x25')]();};}function saveUpdates(_0x5f18f6,_0x485199){return function(_0x23e9cd){if(_0x23e9cd){return _0x23e9cd['update'](_0x5f18f6)[_0x865c('0x26')](function(_0xaf856b){return _0xaf856b;});}return null;};}function removeEntity(_0x53e226,_0x432865){return function(_0x575e15){if(_0x575e15){return _0x575e15[_0x865c('0x27')]()[_0x865c('0x26')](function(){_0x53e226[_0x865c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df4e8,_0x82665c){return function(_0x32eb96){if(!_0x32eb96){_0x1df4e8['sendStatus'](0x194);}return _0x32eb96;};}function handleError(_0x4f138e,_0x1c59fd){_0x1c59fd=_0x1c59fd||0x1f4;return function(_0x2775c3){logger[_0x865c('0x28')](_0x2775c3[_0x865c('0x29')]);if(_0x2775c3[_0x865c('0x2a')]){delete _0x2775c3[_0x865c('0x2a')];}_0x4f138e[_0x865c('0x1a')](_0x1c59fd)[_0x865c('0x2b')](_0x2775c3);};}exports[_0x865c('0x2c')]=function(_0x39f473,_0xaa6f1d){var _0x4bdb4f={},_0x1a37c2={},_0x3ebf42={'count':0x0,'rows':[]};var _0x25a85a=_[_0x865c('0x2d')](db[_0x865c('0x2e')][_0x865c('0x2f')],function(_0xf8f992){return{'name':_0xf8f992[_0x865c('0x30')],'type':_0xf8f992[_0x865c('0x31')][_0x865c('0x32')]};});_0x1a37c2[_0x865c('0x33')]=_[_0x865c('0x2d')](_0x25a85a,_0x865c('0x2a'));_0x1a37c2[_0x865c('0x34')]=_[_0x865c('0x35')](_0x39f473['query']);_0x1a37c2[_0x865c('0x36')]=_[_0x865c('0x37')](_0x1a37c2[_0x865c('0x33')],_0x1a37c2[_0x865c('0x34')]);_0x4bdb4f[_0x865c('0x38')]=_[_0x865c('0x37')](_0x1a37c2[_0x865c('0x33')],qs[_0x865c('0x39')](_0x39f473['query'][_0x865c('0x39')]));_0x4bdb4f[_0x865c('0x38')]=_0x4bdb4f['attributes'][_0x865c('0x3a')]?_0x4bdb4f[_0x865c('0x38')]:_0x1a37c2['model'];if(!_0x39f473['query']['hasOwnProperty'](_0x865c('0x3b'))){_0x4bdb4f[_0x865c('0x1f')]=qs[_0x865c('0x1f')](_0x39f473['query'][_0x865c('0x1f')]);_0x4bdb4f[_0x865c('0x1d')]=qs['offset'](_0x39f473[_0x865c('0x34')][_0x865c('0x1d')]);}_0x4bdb4f[_0x865c('0x3c')]=qs['sort'](_0x39f473[_0x865c('0x34')][_0x865c('0x3d')]);_0x4bdb4f[_0x865c('0x3e')]=qs[_0x865c('0x36')](_['pick'](_0x39f473['query'],_0x1a37c2[_0x865c('0x36')]),_0x25a85a);if(_0x39f473['query'][_0x865c('0x3f')]){_0x4bdb4f[_0x865c('0x3e')]=_[_0x865c('0x40')](_0x4bdb4f[_0x865c('0x3e')],{'$or':_[_0x865c('0x2d')](_0x25a85a,function(_0x319ac5){if(_0x319ac5[_0x865c('0x31')]!==_0x865c('0x41')){var _0x3f560d={};_0x3f560d[_0x319ac5['name']]={'$like':'%'+_0x39f473['query']['filter']+'%'};return _0x3f560d;}})});}_0x4bdb4f=_[_0x865c('0x40')]({},_0x4bdb4f,_0x39f473[_0x865c('0x42')]);var _0x1dc649={'where':_0x4bdb4f[_0x865c('0x3e')]};return db['SalesforceAccount'][_0x865c('0x20')](_0x1dc649)[_0x865c('0x26')](function(_0x52d7bc){_0x3ebf42[_0x865c('0x20')]=_0x52d7bc;if(_0x39f473['query'][_0x865c('0x43')]){_0x4bdb4f[_0x865c('0x44')]=[{'all':!![]}];}return db[_0x865c('0x2e')][_0x865c('0x45')](_0x4bdb4f);})[_0x865c('0x26')](function(_0x15a782){_0x3ebf42[_0x865c('0x46')]=_0x15a782;return _0x3ebf42;})[_0x865c('0x26')](respondWithFilteredResult(_0xaa6f1d,_0x4bdb4f))[_0x865c('0x47')](handleError(_0xaa6f1d,null));};exports[_0x865c('0x48')]=function(_0x31423f,_0x2a8544){var _0x1bebd5={'raw':![],'where':{'id':_0x31423f[_0x865c('0x49')]['id']}},_0x72098d={};_0x72098d[_0x865c('0x33')]=_[_0x865c('0x35')](db[_0x865c('0x2e')][_0x865c('0x2f')]);_0x72098d[_0x865c('0x34')]=_[_0x865c('0x35')](_0x31423f[_0x865c('0x34')]);_0x72098d[_0x865c('0x36')]=_[_0x865c('0x37')](_0x72098d[_0x865c('0x33')],_0x72098d[_0x865c('0x34')]);_0x1bebd5[_0x865c('0x38')]=_[_0x865c('0x37')](_0x72098d[_0x865c('0x33')],qs['fields'](_0x31423f[_0x865c('0x34')]['fields']));_0x1bebd5[_0x865c('0x38')]=_0x1bebd5[_0x865c('0x38')]['length']?_0x1bebd5[_0x865c('0x38')]:_0x72098d[_0x865c('0x33')];if(_0x31423f[_0x865c('0x34')][_0x865c('0x43')]){_0x1bebd5['include']=[{'all':!![]}];}_0x1bebd5=_[_0x865c('0x40')]({},_0x1bebd5,_0x31423f[_0x865c('0x42')]);return db[_0x865c('0x2e')][_0x865c('0x4a')](_0x1bebd5)[_0x865c('0x26')](handleEntityNotFound(_0x2a8544,null))[_0x865c('0x26')](respondWithResult(_0x2a8544,null))[_0x865c('0x47')](handleError(_0x2a8544,null));};exports['create']=function(_0x3224b5,_0x46c2e8){return db[_0x865c('0x2e')][_0x865c('0x4b')](_0x3224b5[_0x865c('0x4c')],{})[_0x865c('0x26')](respondWithResult(_0x46c2e8,0xc9))['catch'](handleError(_0x46c2e8,null));};exports['update']=function(_0x1d6527,_0x34e955){if(_0x1d6527['body']['id']){delete _0x1d6527[_0x865c('0x4c')]['id'];}return db[_0x865c('0x2e')][_0x865c('0x4a')]({'where':{'id':_0x1d6527[_0x865c('0x49')]['id']}})[_0x865c('0x26')](handleEntityNotFound(_0x34e955,null))['then'](saveUpdates(_0x1d6527[_0x865c('0x4c')],null))[_0x865c('0x26')](respondWithResult(_0x34e955,null))[_0x865c('0x47')](handleError(_0x34e955,null));};exports[_0x865c('0x27')]=function(_0x1bc61e,_0x155027){return db[_0x865c('0x2e')][_0x865c('0x4a')]({'where':{'id':_0x1bc61e['params']['id']}})[_0x865c('0x26')](handleEntityNotFound(_0x155027,null))[_0x865c('0x26')](removeEntity(_0x155027,null))[_0x865c('0x47')](handleError(_0x155027,null));};exports[_0x865c('0x4d')]=function(_0x32db75,_0x3d51ad,_0x3dba70){var _0x55fad0={};var _0x7b845c={};var _0x568900;var _0x22930b;return db['SalesforceAccount']['findOne']({'where':{'id':_0x32db75[_0x865c('0x49')]['id']}})[_0x865c('0x26')](handleEntityNotFound(_0x3d51ad,null))[_0x865c('0x26')](function(_0x381891){if(_0x381891){_0x568900=_0x381891;_0x7b845c['model']=_[_0x865c('0x35')](db[_0x865c('0x4e')][_0x865c('0x2f')]);_0x7b845c[_0x865c('0x34')]=_[_0x865c('0x35')](_0x32db75[_0x865c('0x34')]);_0x7b845c[_0x865c('0x36')]=_['intersection'](_0x7b845c[_0x865c('0x33')],_0x7b845c['query']);_0x55fad0['attributes']=_[_0x865c('0x37')](_0x7b845c[_0x865c('0x33')],qs[_0x865c('0x39')](_0x32db75['query'][_0x865c('0x39')]));_0x55fad0[_0x865c('0x38')]=_0x55fad0[_0x865c('0x38')][_0x865c('0x3a')]?_0x55fad0[_0x865c('0x38')]:_0x7b845c['model'];_0x55fad0[_0x865c('0x3c')]=qs[_0x865c('0x3d')](_0x32db75[_0x865c('0x34')][_0x865c('0x3d')]);_0x55fad0['where']=qs[_0x865c('0x36')](_[_0x865c('0x4f')](_0x32db75[_0x865c('0x34')],_0x7b845c[_0x865c('0x36')]));if(_0x32db75[_0x865c('0x34')]['filter']){_0x55fad0['where']=_['merge'](_0x55fad0[_0x865c('0x3e')],{'$or':_[_0x865c('0x2d')](_0x55fad0[_0x865c('0x38')],function(_0x4726c6){var _0x21ec0a={};_0x21ec0a[_0x4726c6]={'$like':'%'+_0x32db75[_0x865c('0x34')][_0x865c('0x3f')]+'%'};return _0x21ec0a;})});}_0x55fad0=_[_0x865c('0x40')]({},_0x55fad0,_0x32db75['options']);return _0x568900[_0x865c('0x4d')](_0x55fad0);}})[_0x865c('0x26')](function(_0x308b01){if(_0x308b01){_0x22930b=_0x308b01[_0x865c('0x3a')];if(!_0x32db75[_0x865c('0x34')][_0x865c('0x50')](_0x865c('0x3b'))){_0x55fad0[_0x865c('0x1f')]=qs[_0x865c('0x1f')](_0x32db75['query']['limit']);_0x55fad0[_0x865c('0x1d')]=qs[_0x865c('0x1d')](_0x32db75[_0x865c('0x34')][_0x865c('0x1d')]);}return _0x568900['getConfigurations'](_0x55fad0);}})['then'](function(_0x34bc93){if(_0x34bc93){return _0x34bc93?{'count':_0x22930b,'rows':_0x34bc93}:null;}})[_0x865c('0x26')](respondWithResult(_0x3d51ad,null))[_0x865c('0x47')](handleError(_0x3d51ad,null));};exports[_0x865c('0x51')]=function(_0x410058,_0x629ac8,_0x3dab7a){if(_0x410058[_0x865c('0x4c')]['id']){delete _0x410058[_0x865c('0x4c')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x410058[_0x865c('0x49')]['id']}})[_0x865c('0x26')](handleEntityNotFound(_0x629ac8,null))[_0x865c('0x26')](function(_0xd82800){if(_0xd82800){_0x410058[_0x865c('0x4c')][_0x865c('0x52')]=_0xd82800['id'];_0x410058[_0x865c('0x4c')][_0x865c('0x53')]=integrations[_0x865c('0x54')](_0x410058['body'][_0x865c('0x55')],_0x410058[_0x865c('0x4c')]['type']);_0x410058['body']['Descriptions']=integrations[_0x865c('0x56')](_0x410058['body'][_0x865c('0x55')],_0x410058[_0x865c('0x4c')][_0x865c('0x31')]);return db['SalesforceConfiguration'][_0x865c('0x4b')](_0x410058['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x865c('0x57')],'as':_0x865c('0x58')}]});}return null;})[_0x865c('0x26')](respondWithResult(_0x629ac8,null))[_0x865c('0x47')](handleError(_0x629ac8,null));};exports[_0x865c('0x59')]=function(_0x21a69e,_0xc100c7,_0x1ed56b){var _0x5174fa;var _0x1f863e='';var _0x36e78f='Task';return db['SalesforceAccount'][_0x865c('0x5a')]({'where':{'id':_0x21a69e[_0x865c('0x49')]['id']},'attributes':['id','remoteUri',_0x865c('0x5b'),_0x865c('0x5c'),_0x865c('0x5d'),'password',_0x865c('0x5e')]})[_0x865c('0x26')](handleEntityNotFound(_0xc100c7,null))[_0x865c('0x26')](function(_0x29c25d){if(_0x29c25d){_0x1f863e=_0x29c25d[_0x865c('0x5f')];var _0x5ec15a=_0x1f863e['slice'](-0x1);if(_0x5ec15a==='/'){_0x1f863e=_0x1f863e['substring'](0x0,_0x1f863e['lastIndexOf'](_0x5ec15a));}_0x5174fa=new jsforce[(_0x865c('0x60'))]({'oauth2':{'loginUrl':_0x1f863e,'clientId':_0x29c25d[_0x865c('0x5b')],'clientSecret':_0x29c25d[_0x865c('0x5c')]}});return _0x5174fa[_0x865c('0x61')](_0x29c25d[_0x865c('0x5d')],_0x29c25d[_0x865c('0x62')]['concat'](_0x29c25d[_0x865c('0x5e')]));}})[_0x865c('0x26')](function(_0x428bce){if(_0x428bce){if(!_[_0x865c('0x63')](_0x21a69e['query']['ticketType'])){_0x36e78f=_0x21a69e[_0x865c('0x34')]['ticketType'];}return _0x5174fa[_0x865c('0x64')](_0x36e78f)[_0x865c('0x65')]();}})['then'](function(_0x32ecc1){var _0x345667=['OwnerId','ActivityDate',_0x865c('0x66'),_0x865c('0x67'),_0x865c('0x68'),_0x865c('0x69')];var _0x397688=['string',_0x865c('0x6a'),_0x865c('0x6b'),_0x865c('0x6c'),_0x865c('0x6d'),'textarea',_0x865c('0x6e')];if(_0x32ecc1){_[_0x865c('0x6f')](_0x32ecc1[_0x865c('0x39')],function(_0x1b5edc){return _0x345667[_0x865c('0x70')](_0x1b5edc[_0x865c('0x2a')])||!_0x397688[_0x865c('0x70')](_0x1b5edc[_0x865c('0x31')]);});return{'count':_0x32ecc1[_0x865c('0x39')][_0x865c('0x3a')],'rows':_[_0x865c('0x2d')](_0x32ecc1[_0x865c('0x39')],function(_0x5650b5){return{'id':_0x5650b5[_0x865c('0x2a')],'name':_0x5650b5['label'],'custom':_0x5650b5[_0x865c('0x71')],'options':_0x5650b5[_0x865c('0x72')][_0x865c('0x3a')]>0x0?_[_0x865c('0x2d')](_0x5650b5[_0x865c('0x72')],function(_0x3c24ac){return{'name':_0x3c24ac[_0x865c('0x73')],'value':_0x3c24ac[_0x865c('0x74')]};}):_0x5650b5['type']=='boolean'?[{'name':_0x865c('0x75'),'value':_0x865c('0x76')},{'name':_0x865c('0x77'),'value':'false'}]:[]};})};}})[_0x865c('0x26')](respondWithResult(_0xc100c7,null))[_0x865c('0x47')](function(_0x4ce8c6){var _0x487eba=_0x21a69e[_0x865c('0x34')]['test']?0x1f4:_0x4ce8c6[_0x865c('0x78')]||0x1f4;logger[_0x865c('0x28')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x487eba,JSON['stringify'](_0x4ce8c6));delete _0x4ce8c6[_0x865c('0x2a')];if(_0x487eba===0x191){_0x487eba=0x190;}_0xc100c7['status'](_0x487eba)['send'](_0x21a69e[_0x865c('0x34')][_0x865c('0x79')]?{'message':_0x865c('0x7a'),'statusCode':_0x4ce8c6[_0x865c('0x78')]}:_0x4ce8c6);});}; \ No newline at end of file +var _0x9d1b=['findOne','SalesforceConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','channel','Subjects','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','email','textarea','phone','remove','includes','label','custom','picklistValues','value','boolean','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d1b,0xb2));var _0xb9d1=function(_0x279e6f,_0x566574){_0x279e6f=_0x279e6f-0x0;var _0x489a5f=_0x9d1b[_0x279e6f];return _0x489a5f;};'use strict';var emlformat=require(_0xb9d1('0x0'));var rimraf=require(_0xb9d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9d1('0x2'));var rp=require('request-promise');var moment=require(_0xb9d1('0x3'));var BPromise=require(_0xb9d1('0x4'));var Mustache=require('mustache');var util=require(_0xb9d1('0x5'));var path=require(_0xb9d1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9d1('0x7'));var _=require(_0xb9d1('0x8'));var squel=require(_0xb9d1('0x9'));var crypto=require(_0xb9d1('0xa'));var jsforce=require(_0xb9d1('0xb'));var deskjs=require(_0xb9d1('0xc'));var toCsv=require(_0xb9d1('0xd'));var querystring=require(_0xb9d1('0xe'));var Papa=require('papaparse');var Redis=require(_0xb9d1('0xf'));var authService=require(_0xb9d1('0x10'));var qs=require(_0xb9d1('0x11'));var as=require(_0xb9d1('0x12'));var hardwareService=require(_0xb9d1('0x13'));var logger=require(_0xb9d1('0x14'))('api');var utils=require(_0xb9d1('0x15'));var config=require(_0xb9d1('0x16'));var licenseUtil=require(_0xb9d1('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb9d1('0x18'));function respondWithStatusCode(_0x28ee89,_0x4f5b33){_0x4f5b33=_0x4f5b33||0xcc;return function(_0x2f14b0){if(_0x2f14b0){return _0x28ee89['sendStatus'](_0x4f5b33);}return _0x28ee89['status'](_0x4f5b33)[_0xb9d1('0x19')]();};}function respondWithResult(_0x1b7cc1,_0x298d77){_0x298d77=_0x298d77||0xc8;return function(_0x392a1f){if(_0x392a1f){return _0x1b7cc1['status'](_0x298d77)[_0xb9d1('0x1a')](_0x392a1f);}};}function respondWithFilteredResult(_0x24bff0,_0x522f20){return function(_0x103db5){if(_0x103db5){var _0xd202a5=typeof _0x522f20[_0xb9d1('0x1b')]===_0xb9d1('0x1c')&&typeof _0x522f20[_0xb9d1('0x1d')]==='undefined';var _0xedd6b4=_0x103db5[_0xb9d1('0x1e')];var _0x1b33d9=_0xd202a5?0x0:_0x522f20[_0xb9d1('0x1b')];var _0x141d02=_0xd202a5?_0x103db5['count']:_0x522f20['offset']+_0x522f20[_0xb9d1('0x1d')];var _0x4b9d7d;if(_0x141d02>=_0xedd6b4){_0x141d02=_0xedd6b4;_0x4b9d7d=0xc8;}else{_0x4b9d7d=0xce;}_0x24bff0[_0xb9d1('0x1f')](_0x4b9d7d);return _0x24bff0[_0xb9d1('0x20')](_0xb9d1('0x21'),_0x1b33d9+'-'+_0x141d02+'/'+_0xedd6b4)[_0xb9d1('0x1a')](_0x103db5);}return null;};}function patchUpdates(_0x43fc7d){return function(_0x462019){try{jsonpatch[_0xb9d1('0x22')](_0x462019,_0x43fc7d,!![]);}catch(_0x421b3b){return BPromise[_0xb9d1('0x23')](_0x421b3b);}return _0x462019[_0xb9d1('0x24')]();};}function saveUpdates(_0x3cd601,_0x25d9b7){return function(_0x3661ec){if(_0x3661ec){return _0x3661ec[_0xb9d1('0x25')](_0x3cd601)[_0xb9d1('0x26')](function(_0x41f091){return _0x41f091;});}return null;};}function removeEntity(_0x3ac1c9,_0x5f3c6c){return function(_0x108fd9){if(_0x108fd9){return _0x108fd9[_0xb9d1('0x27')]()[_0xb9d1('0x26')](function(){_0x3ac1c9[_0xb9d1('0x1f')](0xcc)[_0xb9d1('0x19')]();});}};}function handleEntityNotFound(_0x2ebbf0,_0x500d50){return function(_0xb665f9){if(!_0xb665f9){_0x2ebbf0[_0xb9d1('0x28')](0x194);}return _0xb665f9;};}function handleError(_0x370d73,_0x1a824c){_0x1a824c=_0x1a824c||0x1f4;return function(_0x52fdd7){logger[_0xb9d1('0x29')](_0x52fdd7[_0xb9d1('0x2a')]);if(_0x52fdd7[_0xb9d1('0x2b')]){delete _0x52fdd7[_0xb9d1('0x2b')];}_0x370d73[_0xb9d1('0x1f')](_0x1a824c)[_0xb9d1('0x2c')](_0x52fdd7);};}exports[_0xb9d1('0x2d')]=function(_0x39e7de,_0x17e082){var _0x3cd0f6={},_0x1ac415={},_0x13068b={'count':0x0,'rows':[]};var _0x40203f=_[_0xb9d1('0x2e')](db[_0xb9d1('0x2f')]['rawAttributes'],function(_0x35e0a0){return{'name':_0x35e0a0[_0xb9d1('0x30')],'type':_0x35e0a0[_0xb9d1('0x31')][_0xb9d1('0x32')]};});_0x1ac415['model']=_['map'](_0x40203f,_0xb9d1('0x2b'));_0x1ac415[_0xb9d1('0x33')]=_[_0xb9d1('0x34')](_0x39e7de[_0xb9d1('0x33')]);_0x1ac415[_0xb9d1('0x35')]=_[_0xb9d1('0x36')](_0x1ac415[_0xb9d1('0x37')],_0x1ac415['query']);_0x3cd0f6[_0xb9d1('0x38')]=_[_0xb9d1('0x36')](_0x1ac415['model'],qs['fields'](_0x39e7de[_0xb9d1('0x33')][_0xb9d1('0x39')]));_0x3cd0f6[_0xb9d1('0x38')]=_0x3cd0f6[_0xb9d1('0x38')][_0xb9d1('0x3a')]?_0x3cd0f6[_0xb9d1('0x38')]:_0x1ac415['model'];if(!_0x39e7de[_0xb9d1('0x33')][_0xb9d1('0x3b')](_0xb9d1('0x3c'))){_0x3cd0f6[_0xb9d1('0x1d')]=qs[_0xb9d1('0x1d')](_0x39e7de[_0xb9d1('0x33')][_0xb9d1('0x1d')]);_0x3cd0f6[_0xb9d1('0x1b')]=qs[_0xb9d1('0x1b')](_0x39e7de['query']['offset']);}_0x3cd0f6[_0xb9d1('0x3d')]=qs[_0xb9d1('0x3e')](_0x39e7de[_0xb9d1('0x33')][_0xb9d1('0x3e')]);_0x3cd0f6[_0xb9d1('0x3f')]=qs['filters'](_[_0xb9d1('0x40')](_0x39e7de[_0xb9d1('0x33')],_0x1ac415['filters']),_0x40203f);if(_0x39e7de[_0xb9d1('0x33')][_0xb9d1('0x41')]){_0x3cd0f6[_0xb9d1('0x3f')]=_[_0xb9d1('0x42')](_0x3cd0f6[_0xb9d1('0x3f')],{'$or':_[_0xb9d1('0x2e')](_0x40203f,function(_0x36a179){if(_0x36a179['type']!==_0xb9d1('0x43')){var _0x1a42c1={};_0x1a42c1[_0x36a179[_0xb9d1('0x2b')]]={'$like':'%'+_0x39e7de['query'][_0xb9d1('0x41')]+'%'};return _0x1a42c1;}})});}_0x3cd0f6=_['merge']({},_0x3cd0f6,_0x39e7de[_0xb9d1('0x44')]);var _0xdfc265={'where':_0x3cd0f6[_0xb9d1('0x3f')]};return db[_0xb9d1('0x2f')][_0xb9d1('0x1e')](_0xdfc265)['then'](function(_0x2d8482){_0x13068b[_0xb9d1('0x1e')]=_0x2d8482;if(_0x39e7de[_0xb9d1('0x33')][_0xb9d1('0x45')]){_0x3cd0f6[_0xb9d1('0x46')]=[{'all':!![]}];}return db[_0xb9d1('0x2f')]['findAll'](_0x3cd0f6);})[_0xb9d1('0x26')](function(_0x3761f2){_0x13068b[_0xb9d1('0x47')]=_0x3761f2;return _0x13068b;})['then'](respondWithFilteredResult(_0x17e082,_0x3cd0f6))[_0xb9d1('0x48')](handleError(_0x17e082,null));};exports[_0xb9d1('0x49')]=function(_0x4d39e7,_0x2bddb9){var _0x4c2a43={'raw':![],'where':{'id':_0x4d39e7[_0xb9d1('0x4a')]['id']}},_0x473ad5={};_0x473ad5[_0xb9d1('0x37')]=_[_0xb9d1('0x34')](db['SalesforceAccount'][_0xb9d1('0x4b')]);_0x473ad5[_0xb9d1('0x33')]=_[_0xb9d1('0x34')](_0x4d39e7[_0xb9d1('0x33')]);_0x473ad5[_0xb9d1('0x35')]=_['intersection'](_0x473ad5[_0xb9d1('0x37')],_0x473ad5[_0xb9d1('0x33')]);_0x4c2a43[_0xb9d1('0x38')]=_[_0xb9d1('0x36')](_0x473ad5[_0xb9d1('0x37')],qs[_0xb9d1('0x39')](_0x4d39e7[_0xb9d1('0x33')]['fields']));_0x4c2a43['attributes']=_0x4c2a43[_0xb9d1('0x38')][_0xb9d1('0x3a')]?_0x4c2a43[_0xb9d1('0x38')]:_0x473ad5[_0xb9d1('0x37')];if(_0x4d39e7['query']['includeAll']){_0x4c2a43[_0xb9d1('0x46')]=[{'all':!![]}];}_0x4c2a43=_[_0xb9d1('0x42')]({},_0x4c2a43,_0x4d39e7[_0xb9d1('0x44')]);return db['SalesforceAccount'][_0xb9d1('0x4c')](_0x4c2a43)[_0xb9d1('0x26')](handleEntityNotFound(_0x2bddb9,null))[_0xb9d1('0x26')](respondWithResult(_0x2bddb9,null))['catch'](handleError(_0x2bddb9,null));};exports[_0xb9d1('0x4d')]=function(_0x45ae38,_0xba96a6){return db['SalesforceAccount'][_0xb9d1('0x4d')](_0x45ae38['body'],{})[_0xb9d1('0x26')](respondWithResult(_0xba96a6,0xc9))[_0xb9d1('0x48')](handleError(_0xba96a6,null));};exports[_0xb9d1('0x25')]=function(_0x179c40,_0x4bd4b2){if(_0x179c40[_0xb9d1('0x4e')]['id']){delete _0x179c40[_0xb9d1('0x4e')]['id'];}return db[_0xb9d1('0x2f')][_0xb9d1('0x4c')]({'where':{'id':_0x179c40['params']['id']}})[_0xb9d1('0x26')](handleEntityNotFound(_0x4bd4b2,null))[_0xb9d1('0x26')](saveUpdates(_0x179c40[_0xb9d1('0x4e')],null))[_0xb9d1('0x26')](respondWithResult(_0x4bd4b2,null))[_0xb9d1('0x48')](handleError(_0x4bd4b2,null));};exports[_0xb9d1('0x27')]=function(_0x5f3eea,_0x16864a){return db[_0xb9d1('0x2f')][_0xb9d1('0x4c')]({'where':{'id':_0x5f3eea[_0xb9d1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x16864a,null))[_0xb9d1('0x26')](removeEntity(_0x16864a,null))[_0xb9d1('0x48')](handleError(_0x16864a,null));};exports[_0xb9d1('0x4f')]=function(_0x5a9851,_0x35d3e6,_0x5d156a){var _0x45c556={};var _0x1ddbfc={};var _0xe5008f;var _0xa5a576;return db[_0xb9d1('0x2f')][_0xb9d1('0x50')]({'where':{'id':_0x5a9851[_0xb9d1('0x4a')]['id']}})[_0xb9d1('0x26')](handleEntityNotFound(_0x35d3e6,null))[_0xb9d1('0x26')](function(_0x2b708b){if(_0x2b708b){_0xe5008f=_0x2b708b;_0x1ddbfc['model']=_['keys'](db[_0xb9d1('0x51')][_0xb9d1('0x4b')]);_0x1ddbfc['query']=_[_0xb9d1('0x34')](_0x5a9851[_0xb9d1('0x33')]);_0x1ddbfc['filters']=_[_0xb9d1('0x36')](_0x1ddbfc[_0xb9d1('0x37')],_0x1ddbfc[_0xb9d1('0x33')]);_0x45c556[_0xb9d1('0x38')]=_['intersection'](_0x1ddbfc[_0xb9d1('0x37')],qs['fields'](_0x5a9851['query'][_0xb9d1('0x39')]));_0x45c556['attributes']=_0x45c556[_0xb9d1('0x38')][_0xb9d1('0x3a')]?_0x45c556[_0xb9d1('0x38')]:_0x1ddbfc[_0xb9d1('0x37')];_0x45c556[_0xb9d1('0x3d')]=qs[_0xb9d1('0x3e')](_0x5a9851[_0xb9d1('0x33')][_0xb9d1('0x3e')]);_0x45c556['where']=qs[_0xb9d1('0x35')](_[_0xb9d1('0x40')](_0x5a9851[_0xb9d1('0x33')],_0x1ddbfc[_0xb9d1('0x35')]));if(_0x5a9851[_0xb9d1('0x33')]['filter']){_0x45c556[_0xb9d1('0x3f')]=_[_0xb9d1('0x42')](_0x45c556[_0xb9d1('0x3f')],{'$or':_['map'](_0x45c556[_0xb9d1('0x38')],function(_0x38633e){var _0x579d25={};_0x579d25[_0x38633e]={'$like':'%'+_0x5a9851[_0xb9d1('0x33')]['filter']+'%'};return _0x579d25;})});}_0x45c556=_[_0xb9d1('0x42')]({},_0x45c556,_0x5a9851['options']);return _0xe5008f['getConfigurations'](_0x45c556);}})[_0xb9d1('0x26')](function(_0x26b277){if(_0x26b277){_0xa5a576=_0x26b277[_0xb9d1('0x3a')];if(!_0x5a9851[_0xb9d1('0x33')]['hasOwnProperty']('nolimit')){_0x45c556[_0xb9d1('0x1d')]=qs['limit'](_0x5a9851[_0xb9d1('0x33')][_0xb9d1('0x1d')]);_0x45c556[_0xb9d1('0x1b')]=qs['offset'](_0x5a9851[_0xb9d1('0x33')]['offset']);}return _0xe5008f[_0xb9d1('0x4f')](_0x45c556);}})[_0xb9d1('0x26')](function(_0x3a0b99){if(_0x3a0b99){return _0x3a0b99?{'count':_0xa5a576,'rows':_0x3a0b99}:null;}})[_0xb9d1('0x26')](respondWithResult(_0x35d3e6,null))['catch'](handleError(_0x35d3e6,null));};exports[_0xb9d1('0x52')]=function(_0x5a5b26,_0x32aa21,_0x3132a3){if(_0x5a5b26[_0xb9d1('0x4e')]['id']){delete _0x5a5b26[_0xb9d1('0x4e')]['id'];}return db[_0xb9d1('0x2f')][_0xb9d1('0x50')]({'where':{'id':_0x5a5b26[_0xb9d1('0x4a')]['id']}})[_0xb9d1('0x26')](handleEntityNotFound(_0x32aa21,null))[_0xb9d1('0x26')](function(_0x350a55){if(_0x350a55){_0x5a5b26['body'][_0xb9d1('0x53')]=_0x350a55['id'];_0x5a5b26[_0xb9d1('0x4e')]['Subjects']=integrations[_0xb9d1('0x54')](_0x5a5b26[_0xb9d1('0x4e')]['channel'],_0x5a5b26[_0xb9d1('0x4e')][_0xb9d1('0x31')]);_0x5a5b26[_0xb9d1('0x4e')][_0xb9d1('0x55')]=integrations['getDescriptions'](_0x5a5b26[_0xb9d1('0x4e')][_0xb9d1('0x56')],_0x5a5b26[_0xb9d1('0x4e')][_0xb9d1('0x31')]);return db[_0xb9d1('0x51')][_0xb9d1('0x4d')](_0x5a5b26[_0xb9d1('0x4e')],{'include':[{'model':db['SalesforceField'],'as':_0xb9d1('0x57')},{'model':db[_0xb9d1('0x58')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x32aa21,null))[_0xb9d1('0x48')](handleError(_0x32aa21,null));};exports[_0xb9d1('0x59')]=function(_0xed89b2,_0x2f233c,_0x4f9919){var _0x4e4a28;var _0x531f81='';var _0x32369e='Task';return db[_0xb9d1('0x2f')][_0xb9d1('0x50')]({'where':{'id':_0xed89b2[_0xb9d1('0x4a')]['id']},'attributes':['id',_0xb9d1('0x5a'),_0xb9d1('0x5b'),_0xb9d1('0x5c'),_0xb9d1('0x5d'),_0xb9d1('0x5e'),_0xb9d1('0x5f')]})[_0xb9d1('0x26')](handleEntityNotFound(_0x2f233c,null))['then'](function(_0x5e4be5){if(_0x5e4be5){_0x531f81=_0x5e4be5[_0xb9d1('0x5a')];var _0x1b5a96=_0x531f81[_0xb9d1('0x60')](-0x1);if(_0x1b5a96==='/'){_0x531f81=_0x531f81[_0xb9d1('0x61')](0x0,_0x531f81[_0xb9d1('0x62')](_0x1b5a96));}_0x4e4a28=new jsforce[(_0xb9d1('0x63'))]({'oauth2':{'loginUrl':_0x531f81,'clientId':_0x5e4be5['clientId'],'clientSecret':_0x5e4be5[_0xb9d1('0x5c')]}});return _0x4e4a28['login'](_0x5e4be5[_0xb9d1('0x5d')],_0x5e4be5[_0xb9d1('0x5e')]['concat'](_0x5e4be5[_0xb9d1('0x5f')]));}})[_0xb9d1('0x26')](function(_0x40a7d3){if(_0x40a7d3){if(!_[_0xb9d1('0x64')](_0xed89b2[_0xb9d1('0x33')][_0xb9d1('0x65')])){_0x32369e=_0xed89b2['query'][_0xb9d1('0x65')];}return _0x4e4a28[_0xb9d1('0x66')](_0x32369e)[_0xb9d1('0x67')]();}})['then'](function(_0x911446){var _0x33fc5b=[_0xb9d1('0x68'),_0xb9d1('0x69'),_0xb9d1('0x6a'),'IsRecurrence',_0xb9d1('0x6b'),_0xb9d1('0x6c')];var _0x5c6c40=[_0xb9d1('0x6d'),_0xb9d1('0x6e'),'picklist','boolean',_0xb9d1('0x6f'),_0xb9d1('0x70'),_0xb9d1('0x71')];if(_0x911446){_[_0xb9d1('0x72')](_0x911446[_0xb9d1('0x39')],function(_0x1ee363){return _0x33fc5b[_0xb9d1('0x73')](_0x1ee363[_0xb9d1('0x2b')])||!_0x5c6c40['includes'](_0x1ee363['type']);});return{'count':_0x911446[_0xb9d1('0x39')][_0xb9d1('0x3a')],'rows':_['map'](_0x911446[_0xb9d1('0x39')],function(_0x1d1ecb){return{'id':_0x1d1ecb[_0xb9d1('0x2b')],'name':_0x1d1ecb[_0xb9d1('0x74')],'custom':_0x1d1ecb[_0xb9d1('0x75')],'options':_0x1d1ecb['picklistValues'][_0xb9d1('0x3a')]>0x0?_[_0xb9d1('0x2e')](_0x1d1ecb[_0xb9d1('0x76')],function(_0x249b9f){return{'name':_0x249b9f[_0xb9d1('0x74')],'value':_0x249b9f[_0xb9d1('0x77')]};}):_0x1d1ecb[_0xb9d1('0x31')]==_0xb9d1('0x78')?[{'name':_0xb9d1('0x79'),'value':_0xb9d1('0x7a')},{'name':'False','value':_0xb9d1('0x7b')}]:[]};})};}})[_0xb9d1('0x26')](respondWithResult(_0x2f233c,null))[_0xb9d1('0x48')](function(_0x3fede2){var _0x4b60b8=_0xed89b2[_0xb9d1('0x33')][_0xb9d1('0x7c')]?0x1f4:_0x3fede2[_0xb9d1('0x7d')]||0x1f4;logger[_0xb9d1('0x29')](_0xb9d1('0x7e'),_0xb9d1('0x59'),_0x4b60b8,JSON[_0xb9d1('0x7f')](_0x3fede2));delete _0x3fede2[_0xb9d1('0x2b')];if(_0x4b60b8===0x191){_0x4b60b8=0x190;}_0x2f233c[_0xb9d1('0x1f')](_0x4b60b8)['send'](_0xed89b2['query'][_0xb9d1('0x7c')]?{'message':_0xb9d1('0x80'),'statusCode':_0x3fede2[_0xb9d1('0x7d')]}:_0x3fede2);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index fffb294..15a19ee 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 _0xf492=['api','request-promise','path','rimraf','../../config/environment','define','SalesforceAccount','lodash','../../config/logger'];(function(_0x37f6d6,_0x1af0f6){var _0x4ad08c=function(_0x53634d){while(--_0x53634d){_0x37f6d6['push'](_0x37f6d6['shift']());}};_0x4ad08c(++_0x1af0f6);}(_0xf492,0xb2));var _0x2f49=function(_0x12381f,_0x4aae58){_0x12381f=_0x12381f-0x0;var _0x10960d=_0xf492[_0x12381f];return _0x10960d;};'use strict';var _=require(_0x2f49('0x0'));var util=require('util');var logger=require(_0x2f49('0x1'))(_0x2f49('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f49('0x3'));var fs=require('fs');var path=require(_0x2f49('0x4'));var rimraf=require(_0x2f49('0x5'));var config=require(_0x2f49('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xf74eda,_0x47dc4c){return _0xf74eda[_0x2f49('0x7')](_0x2f49('0x8'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2746=['exports','define','SalesforceAccount','int_salesforce_accounts','../../config/logger','api','moment','bluebird','request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x2d0f29,_0x9c8f1b){var _0x30d0df=function(_0x48d52e){while(--_0x48d52e){_0x2d0f29['push'](_0x2d0f29['shift']());}};_0x30d0df(++_0x9c8f1b);}(_0x2746,0x19c));var _0x6274=function(_0x354136,_0xf63e85){_0x354136=_0x354136-0x0;var _0x3ce09b=_0x2746[_0x354136];return _0x3ce09b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6274('0x0'))(_0x6274('0x1'));var moment=require(_0x6274('0x2'));var BPromise=require(_0x6274('0x3'));var rp=require(_0x6274('0x4'));var fs=require('fs');var path=require(_0x6274('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6274('0x6'));var integrations=require(_0x6274('0x7'));module[_0x6274('0x8')]=function(_0x534aee,_0x1d22fb){return _0x534aee[_0x6274('0x9')](_0x6274('0xa'),attributes,{'tableName':_0x6274('0xb'),'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 59f4403..e98eb21 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 _0xc163=['http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','SalesforceAccount','options','raw','where','limit','map','include','attributes','model','catch','ShowSalesforceAccount','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3a9ce3,_0x3e783d){var _0x477f5a=function(_0x24133e){while(--_0x24133e){_0x3a9ce3['push'](_0x3a9ce3['shift']());}};_0x477f5a(++_0x3e783d);}(_0xc163,0xa1));var _0x3c16=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc163[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3c16('0x0'));var util=require(_0x3c16('0x1'));var moment=require(_0x3c16('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c16('0x3'))['db'];var utils=require(_0x3c16('0x4'));var logger=require('../../config/logger')(_0x3c16('0x5'));var config=require(_0x3c16('0x6'));var jayson=require(_0x3c16('0x7'));var client=jayson[_0x3c16('0x8')][_0x3c16('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33a18e,_0x3d8511,_0x405339){return new BPromise(function(_0x300350,_0x3b4cf8){return client[_0x3c16('0xa')](_0x33a18e,_0x405339)[_0x3c16('0xb')](function(_0x5ea503){logger[_0x3c16('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x3d8511,_0x3c16('0xd'));logger[_0x3c16('0xe')](_0x3c16('0xf'),_0x3d8511,'request\x20sent',JSON[_0x3c16('0x10')](_0x5ea503));if(_0x5ea503['error']){if(_0x5ea503[_0x3c16('0x11')][_0x3c16('0x12')]===0x1f4){logger[_0x3c16('0x11')](_0x3c16('0x13'),_0x3d8511,_0x5ea503['error'][_0x3c16('0x14')]);return _0x3b4cf8(_0x5ea503['error'][_0x3c16('0x14')]);}logger[_0x3c16('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x3d8511,_0x5ea503['error'][_0x3c16('0x14')]);return _0x300350(_0x5ea503[_0x3c16('0x11')][_0x3c16('0x14')]);}else{logger[_0x3c16('0xc')](_0x3c16('0x13'),_0x3d8511,_0x3c16('0xd'));_0x300350(_0x5ea503[_0x3c16('0x15')][_0x3c16('0x14')]);}})['catch'](function(_0x420c42){logger[_0x3c16('0x11')](_0x3c16('0x13'),_0x3d8511,_0x420c42);_0x3b4cf8(_0x420c42);});});}exports[_0x3c16('0x16')]=function(_0x5f4af0){var _0x1f3c95=this;return new Promise(function(_0x336d65,_0x606f4d){return db[_0x3c16('0x17')]['findAll']({'raw':_0x5f4af0[_0x3c16('0x18')]?_0x5f4af0[_0x3c16('0x18')][_0x3c16('0x19')]===undefined?!![]:![]:!![],'where':_0x5f4af0[_0x3c16('0x18')]?_0x5f4af0[_0x3c16('0x18')][_0x3c16('0x1a')]||null:null,'attributes':_0x5f4af0['options']?_0x5f4af0[_0x3c16('0x18')]['attributes']||null:null,'limit':_0x5f4af0[_0x3c16('0x18')]?_0x5f4af0['options'][_0x3c16('0x1b')]||null:null,'include':_0x5f4af0['options']?_0x5f4af0[_0x3c16('0x18')]['include']?_[_0x3c16('0x1c')](_0x5f4af0['options'][_0x3c16('0x1d')],function(_0x5cb01a){return{'model':db[_0x5cb01a['model']],'as':_0x5cb01a['as'],'attributes':_0x5cb01a[_0x3c16('0x1e')],'include':_0x5cb01a[_0x3c16('0x1d')]?_['map'](_0x5cb01a[_0x3c16('0x1d')],function(_0x3edd48){return{'model':db[_0x3edd48[_0x3c16('0x1f')]],'as':_0x3edd48['as'],'attributes':_0x3edd48[_0x3c16('0x1e')],'include':_0x3edd48[_0x3c16('0x1d')]?_[_0x3c16('0x1c')](_0x3edd48[_0x3c16('0x1d')],function(_0x4bd6ce){return{'model':db[_0x4bd6ce[_0x3c16('0x1f')]],'as':_0x4bd6ce['as'],'attributes':_0x4bd6ce[_0x3c16('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3c16('0xb')](function(_0x395d5f){logger[_0x3c16('0xc')](_0x3c16('0x16'),_0x5f4af0);logger[_0x3c16('0xe')](_0x3c16('0x16'),_0x5f4af0,JSON[_0x3c16('0x10')](_0x395d5f));_0x336d65(_0x395d5f);})[_0x3c16('0x20')](function(_0xe4b62a){logger[_0x3c16('0x11')](_0x3c16('0x16'),_0xe4b62a[_0x3c16('0x14')],_0x5f4af0);_0x606f4d(_0x1f3c95[_0x3c16('0x11')](0x1f4,_0xe4b62a[_0x3c16('0x14')]));});});};exports[_0x3c16('0x21')]=function(_0x5bcef0){var _0x422140=this;return new Promise(function(_0x39e49a,_0x4e48b4){return db[_0x3c16('0x17')]['find']({'raw':_0x5bcef0[_0x3c16('0x18')]?_0x5bcef0['options'][_0x3c16('0x19')]===undefined?!![]:![]:!![],'where':_0x5bcef0[_0x3c16('0x18')]?_0x5bcef0['options'][_0x3c16('0x1a')]||null:null,'attributes':_0x5bcef0[_0x3c16('0x18')]?_0x5bcef0['options'][_0x3c16('0x1e')]||null:null,'include':_0x5bcef0[_0x3c16('0x18')]?_0x5bcef0[_0x3c16('0x18')][_0x3c16('0x1d')]?_[_0x3c16('0x1c')](_0x5bcef0['options'][_0x3c16('0x1d')],function(_0x5b4131){return{'model':db[_0x5b4131['model']],'as':_0x5b4131['as'],'attributes':_0x5b4131[_0x3c16('0x1e')],'include':_0x5b4131[_0x3c16('0x1d')]?_['map'](_0x5b4131['include'],function(_0x3ce599){return{'model':db[_0x3ce599[_0x3c16('0x1f')]],'as':_0x3ce599['as'],'attributes':_0x3ce599[_0x3c16('0x1e')],'include':_0x3ce599['include']?_[_0x3c16('0x1c')](_0x3ce599[_0x3c16('0x1d')],function(_0x440050){return{'model':db[_0x440050[_0x3c16('0x1f')]],'as':_0x440050['as'],'attributes':_0x440050[_0x3c16('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3c16('0xb')](function(_0x2f049f){logger[_0x3c16('0xc')]('ShowSalesforceAccount',_0x5bcef0);logger[_0x3c16('0xe')](_0x3c16('0x21'),_0x5bcef0,JSON[_0x3c16('0x10')](_0x2f049f));_0x39e49a(_0x2f049f);})[_0x3c16('0x20')](function(_0x3dbdac){logger[_0x3c16('0x11')](_0x3c16('0x21'),_0x3dbdac[_0x3c16('0x14')],_0x5bcef0);_0x4e48b4(_0x422140['error'](0x1f4,_0x3dbdac[_0x3c16('0x14')]));});});}; \ No newline at end of file +var _0xf952=['raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount','SalesforceAccount','options'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0xf952,0x173));var _0x2f95=function(_0x5affdd,_0x4187a0){_0x5affdd=_0x5affdd-0x0;var _0x394ad2=_0xf952[_0x5affdd];return _0x394ad2;};'use strict';var _=require('lodash');var util=require(_0x2f95('0x0'));var moment=require('moment');var BPromise=require(_0x2f95('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f95('0x2'));var db=require(_0x2f95('0x3'))['db'];var utils=require(_0x2f95('0x4'));var logger=require(_0x2f95('0x5'))(_0x2f95('0x6'));var config=require(_0x2f95('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2f95('0x8')][_0x2f95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f8e68,_0x33762d,_0x5bbd9c){return new BPromise(function(_0x233ae1,_0x3eaf08){return client[_0x2f95('0xa')](_0x3f8e68,_0x5bbd9c)[_0x2f95('0xb')](function(_0x1183ad){logger[_0x2f95('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x33762d,_0x2f95('0xd'));logger[_0x2f95('0xe')](_0x2f95('0xf'),_0x33762d,_0x2f95('0xd'),JSON[_0x2f95('0x10')](_0x1183ad));if(_0x1183ad[_0x2f95('0x11')]){if(_0x1183ad['error'][_0x2f95('0x12')]===0x1f4){logger[_0x2f95('0x11')](_0x2f95('0x13'),_0x33762d,_0x1183ad['error']['message']);return _0x3eaf08(_0x1183ad['error'][_0x2f95('0x14')]);}logger[_0x2f95('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x33762d,_0x1183ad[_0x2f95('0x11')][_0x2f95('0x14')]);return _0x233ae1(_0x1183ad['error'][_0x2f95('0x14')]);}else{logger[_0x2f95('0xc')](_0x2f95('0x13'),_0x33762d,_0x2f95('0xd'));_0x233ae1(_0x1183ad['result']['message']);}})[_0x2f95('0x15')](function(_0x2466cb){logger[_0x2f95('0x11')](_0x2f95('0x13'),_0x33762d,_0x2466cb);_0x3eaf08(_0x2466cb);});});}exports[_0x2f95('0x16')]=function(_0xdf77ae){var _0x1af5e8=this;return new Promise(function(_0x2439fe,_0x451286){return db[_0x2f95('0x17')]['findAll']({'raw':_0xdf77ae[_0x2f95('0x18')]?_0xdf77ae[_0x2f95('0x18')][_0x2f95('0x19')]===undefined?!![]:![]:!![],'where':_0xdf77ae[_0x2f95('0x18')]?_0xdf77ae['options'][_0x2f95('0x1a')]||null:null,'attributes':_0xdf77ae[_0x2f95('0x18')]?_0xdf77ae[_0x2f95('0x18')][_0x2f95('0x1b')]||null:null,'limit':_0xdf77ae['options']?_0xdf77ae[_0x2f95('0x18')][_0x2f95('0x1c')]||null:null,'include':_0xdf77ae[_0x2f95('0x18')]?_0xdf77ae[_0x2f95('0x18')][_0x2f95('0x1d')]?_[_0x2f95('0x1e')](_0xdf77ae[_0x2f95('0x18')][_0x2f95('0x1d')],function(_0x3ce790){return{'model':db[_0x3ce790[_0x2f95('0x1f')]],'as':_0x3ce790['as'],'attributes':_0x3ce790['attributes'],'include':_0x3ce790['include']?_['map'](_0x3ce790['include'],function(_0x613593){return{'model':db[_0x613593['model']],'as':_0x613593['as'],'attributes':_0x613593[_0x2f95('0x1b')],'include':_0x613593[_0x2f95('0x1d')]?_[_0x2f95('0x1e')](_0x613593['include'],function(_0x39150f){return{'model':db[_0x39150f[_0x2f95('0x1f')]],'as':_0x39150f['as'],'attributes':_0x39150f[_0x2f95('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1378ad){logger['info']('GetSalesforceAccount',_0xdf77ae);logger[_0x2f95('0xe')](_0x2f95('0x16'),_0xdf77ae,JSON[_0x2f95('0x10')](_0x1378ad));_0x2439fe(_0x1378ad);})[_0x2f95('0x15')](function(_0x5954a5){logger[_0x2f95('0x11')](_0x2f95('0x16'),_0x5954a5['message'],_0xdf77ae);_0x451286(_0x1af5e8[_0x2f95('0x11')](0x1f4,_0x5954a5[_0x2f95('0x14')]));});});};exports[_0x2f95('0x20')]=function(_0x274ae5){var _0x3660b4=this;return new Promise(function(_0x3d0118,_0x29cccd){return db[_0x2f95('0x17')]['find']({'raw':_0x274ae5[_0x2f95('0x18')]?_0x274ae5[_0x2f95('0x18')][_0x2f95('0x19')]===undefined?!![]:![]:!![],'where':_0x274ae5['options']?_0x274ae5[_0x2f95('0x18')][_0x2f95('0x1a')]||null:null,'attributes':_0x274ae5[_0x2f95('0x18')]?_0x274ae5[_0x2f95('0x18')][_0x2f95('0x1b')]||null:null,'include':_0x274ae5[_0x2f95('0x18')]?_0x274ae5[_0x2f95('0x18')][_0x2f95('0x1d')]?_[_0x2f95('0x1e')](_0x274ae5['options'][_0x2f95('0x1d')],function(_0x32e414){return{'model':db[_0x32e414['model']],'as':_0x32e414['as'],'attributes':_0x32e414[_0x2f95('0x1b')],'include':_0x32e414[_0x2f95('0x1d')]?_[_0x2f95('0x1e')](_0x32e414[_0x2f95('0x1d')],function(_0x53c3ec){return{'model':db[_0x53c3ec[_0x2f95('0x1f')]],'as':_0x53c3ec['as'],'attributes':_0x53c3ec['attributes'],'include':_0x53c3ec[_0x2f95('0x1d')]?_[_0x2f95('0x1e')](_0x53c3ec[_0x2f95('0x1d')],function(_0x24b83b){return{'model':db[_0x24b83b[_0x2f95('0x1f')]],'as':_0x24b83b['as'],'attributes':_0x24b83b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f95('0xb')](function(_0x2d7c6e){logger[_0x2f95('0xc')](_0x2f95('0x20'),_0x274ae5);logger[_0x2f95('0xe')](_0x2f95('0x20'),_0x274ae5,JSON['stringify'](_0x2d7c6e));_0x3d0118(_0x2d7c6e);})[_0x2f95('0x15')](function(_0x5305d0){logger[_0x2f95('0x11')](_0x2f95('0x20'),_0x5305d0[_0x2f95('0x14')],_0x274ae5);_0x29cccd(_0x3660b4[_0x2f95('0x11')](0x1f4,_0x5305d0[_0x2f95('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f62536f..0552552 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x57d5da,_0x233bf1){var _0x49aaf2=function(_0x27c210){while(--_0x27c210){_0x57d5da['push'](_0x57d5da['shift']());}};_0x49aaf2(++_0x233bf1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x58f0d5,_0x46959e){_0x58f0d5=_0x58f0d5-0x0;var _0x1fc46d=_0x5f2f[_0x58f0d5];return _0x1fc46d;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xdb28,0x106));var _0x8db2=function(_0x41e19b,_0x171f8c){_0x41e19b=_0x41e19b-0x0;var _0x468b47=_0xdb28[_0x41e19b];return _0x468b47;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index cf8fd74..4548037 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 _0x64a2=['account','sequelize','exports','STRING','ENUM','Task','contact','lead','nothing'];(function(_0x5b3ef7,_0x415965){var _0xbc0495=function(_0x4d9f6a){while(--_0x4d9f6a){_0x5b3ef7['push'](_0x5b3ef7['shift']());}};_0xbc0495(++_0x415965);}(_0x64a2,0x160));var _0x264a=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x64a2[_0x56916d];return _0x2b7f1f;};'use strict';var Sequelize=require(_0x264a('0x0'));module[_0x264a('0x1')]={'name':{'type':Sequelize[_0x264a('0x2')]},'description':{'type':Sequelize[_0x264a('0x2')]},'ticketType':{'type':Sequelize[_0x264a('0x3')](_0x264a('0x4'),'Case'),'defaultValue':_0x264a('0x4')},'moduleSearch':{'type':Sequelize[_0x264a('0x3')]('contact_lead',_0x264a('0x5'),_0x264a('0x6'),'account_contact_lead','account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x264a('0x3')](_0x264a('0x7'),_0x264a('0x5'),_0x264a('0x6'),_0x264a('0x8')),'defaultValue':_0x264a('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x264a('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x264a('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x264a('0x2')]}}; \ No newline at end of file +var _0x55c7=['ENUM','Task','Case','contact','account_contact_lead','account','contact_lead','nothing','lead','exports','STRING'];(function(_0x5a10d5,_0x10a3a5){var _0x12ec3b=function(_0x393907){while(--_0x393907){_0x5a10d5['push'](_0x5a10d5['shift']());}};_0x12ec3b(++_0x10a3a5);}(_0x55c7,0x127));var _0x755c=function(_0xf6fc68,_0x359662){_0xf6fc68=_0xf6fc68-0x0;var _0x59fb82=_0x55c7[_0xf6fc68];return _0x59fb82;};'use strict';var Sequelize=require('sequelize');module[_0x755c('0x0')]={'name':{'type':Sequelize[_0x755c('0x1')]},'description':{'type':Sequelize[_0x755c('0x1')]},'ticketType':{'type':Sequelize[_0x755c('0x2')](_0x755c('0x3'),_0x755c('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x755c('0x2')]('contact_lead',_0x755c('0x5'),'lead',_0x755c('0x6'),_0x755c('0x7')),'defaultValue':_0x755c('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0x755c('0x9'),_0x755c('0x5'),'lead','account'),'defaultValue':_0x755c('0xa')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x755c('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x755c('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 84efbe9..c87ca6f 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 _0x269f=['getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','map','SalesforceConfiguration','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','length','options','find','create','body','params','getFields','SalesforceField','order','hasOwnProperty','findOne','getSubjects'];(function(_0x47a6f7,_0x1c1c9e){var _0x575ac0=function(_0x241a47){while(--_0x241a47){_0x47a6f7['push'](_0x47a6f7['shift']());}};_0x575ac0(++_0x1c1c9e);}(_0x269f,0xee));var _0xf269=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x269f[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0xf269('0x0'));var rimraf=require(_0xf269('0x1'));var zipdir=require(_0xf269('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf269('0x3'));var moment=require('moment');var BPromise=require(_0xf269('0x4'));var Mustache=require(_0xf269('0x5'));var util=require(_0xf269('0x6'));var path=require(_0xf269('0x7'));var sox=require(_0xf269('0x8'));var csv=require('to-csv');var ejs=require(_0xf269('0x9'));var fs=require('fs');var fs_extra=require(_0xf269('0xa'));var _=require(_0xf269('0xb'));var squel=require(_0xf269('0xc'));var crypto=require(_0xf269('0xd'));var jsforce=require(_0xf269('0xe'));var deskjs=require(_0xf269('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf269('0x10'));var Papa=require(_0xf269('0x11'));var Redis=require(_0xf269('0x12'));var authService=require(_0xf269('0x13'));var qs=require(_0xf269('0x14'));var as=require(_0xf269('0x15'));var hardwareService=require(_0xf269('0x16'));var logger=require(_0xf269('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x194d06,_0x36504a){_0x36504a=_0x36504a||0xcc;return function(_0x396a75){if(_0x396a75){return _0x194d06[_0xf269('0x18')](_0x36504a);}return _0x194d06[_0xf269('0x19')](_0x36504a)[_0xf269('0x1a')]();};}function respondWithResult(_0x2cf3f2,_0x34912d){_0x34912d=_0x34912d||0xc8;return function(_0x3e6198){if(_0x3e6198){return _0x2cf3f2[_0xf269('0x19')](_0x34912d)[_0xf269('0x1b')](_0x3e6198);}};}function respondWithFilteredResult(_0x2bdeb9,_0xfc8d78){return function(_0x2a240a){if(_0x2a240a){var _0x31201c=typeof _0xfc8d78[_0xf269('0x1c')]===_0xf269('0x1d')&&typeof _0xfc8d78[_0xf269('0x1e')]===_0xf269('0x1d');var _0x2910d0=_0x2a240a[_0xf269('0x1f')];var _0x1333ce=_0x31201c?0x0:_0xfc8d78['offset'];var _0x60f3b0=_0x31201c?_0x2a240a[_0xf269('0x1f')]:_0xfc8d78['offset']+_0xfc8d78['limit'];var _0x3a7f06;if(_0x60f3b0>=_0x2910d0){_0x60f3b0=_0x2910d0;_0x3a7f06=0xc8;}else{_0x3a7f06=0xce;}_0x2bdeb9['status'](_0x3a7f06);return _0x2bdeb9[_0xf269('0x20')]('Content-Range',_0x1333ce+'-'+_0x60f3b0+'/'+_0x2910d0)['json'](_0x2a240a);}return null;};}function patchUpdates(_0x4924d4){return function(_0x1d1847){try{jsonpatch[_0xf269('0x21')](_0x1d1847,_0x4924d4,!![]);}catch(_0x4cedf4){return BPromise[_0xf269('0x22')](_0x4cedf4);}return _0x1d1847[_0xf269('0x23')]();};}function saveUpdates(_0x5795cc,_0x9c9c7a){return function(_0x328973){if(_0x328973){return _0x328973[_0xf269('0x24')](_0x5795cc)[_0xf269('0x25')](function(_0x18f0db){return _0x18f0db;});}return null;};}function removeEntity(_0x30d9b0,_0x4d9776){return function(_0x9148c5){if(_0x9148c5){return _0x9148c5[_0xf269('0x26')]()['then'](function(){_0x30d9b0[_0xf269('0x19')](0xcc)[_0xf269('0x1a')]();});}};}function handleEntityNotFound(_0x100ce8,_0x3ac6fc){return function(_0x21e13f){if(!_0x21e13f){_0x100ce8['sendStatus'](0x194);}return _0x21e13f;};}function handleError(_0x523477,_0x9f558d){_0x9f558d=_0x9f558d||0x1f4;return function(_0x4087ef){logger[_0xf269('0x27')](_0x4087ef[_0xf269('0x28')]);if(_0x4087ef[_0xf269('0x29')]){delete _0x4087ef[_0xf269('0x29')];}_0x523477[_0xf269('0x19')](_0x9f558d)['send'](_0x4087ef);};}exports['index']=function(_0xeac015,_0x3e9ab9){var _0x261ccf={},_0x43d6b8={},_0x2ad8c3={'count':0x0,'rows':[]};var _0x3441df=_[_0xf269('0x2a')](db[_0xf269('0x2b')][_0xf269('0x2c')],function(_0x35c03f){return{'name':_0x35c03f[_0xf269('0x2d')],'type':_0x35c03f[_0xf269('0x2e')]['key']};});_0x43d6b8['model']=_[_0xf269('0x2a')](_0x3441df,'name');_0x43d6b8[_0xf269('0x2f')]=_[_0xf269('0x30')](_0xeac015[_0xf269('0x2f')]);_0x43d6b8[_0xf269('0x31')]=_['intersection'](_0x43d6b8[_0xf269('0x32')],_0x43d6b8[_0xf269('0x2f')]);_0x261ccf[_0xf269('0x33')]=_[_0xf269('0x34')](_0x43d6b8[_0xf269('0x32')],qs[_0xf269('0x35')](_0xeac015[_0xf269('0x2f')][_0xf269('0x35')]));_0x261ccf[_0xf269('0x33')]=_0x261ccf[_0xf269('0x33')]['length']?_0x261ccf[_0xf269('0x33')]:_0x43d6b8[_0xf269('0x32')];if(!_0xeac015['query']['hasOwnProperty'](_0xf269('0x36'))){_0x261ccf[_0xf269('0x1e')]=qs['limit'](_0xeac015[_0xf269('0x2f')][_0xf269('0x1e')]);_0x261ccf['offset']=qs[_0xf269('0x1c')](_0xeac015[_0xf269('0x2f')][_0xf269('0x1c')]);}_0x261ccf['order']=qs[_0xf269('0x37')](_0xeac015[_0xf269('0x2f')][_0xf269('0x37')]);_0x261ccf[_0xf269('0x38')]=qs[_0xf269('0x31')](_[_0xf269('0x39')](_0xeac015['query'],_0x43d6b8[_0xf269('0x31')]),_0x3441df);if(_0xeac015[_0xf269('0x2f')][_0xf269('0x3a')]){_0x261ccf[_0xf269('0x38')]=_[_0xf269('0x3b')](_0x261ccf['where'],{'$or':_[_0xf269('0x2a')](_0x3441df,function(_0x22d0f2){if(_0x22d0f2[_0xf269('0x2e')]!==_0xf269('0x3c')){var _0xcae240={};_0xcae240[_0x22d0f2[_0xf269('0x29')]]={'$like':'%'+_0xeac015['query'][_0xf269('0x3a')]+'%'};return _0xcae240;}})});}_0x261ccf=_[_0xf269('0x3b')]({},_0x261ccf,_0xeac015['options']);var _0x185a1f={'where':_0x261ccf[_0xf269('0x38')]};return db['SalesforceConfiguration'][_0xf269('0x1f')](_0x185a1f)[_0xf269('0x25')](function(_0x323f23){_0x2ad8c3[_0xf269('0x1f')]=_0x323f23;if(_0xeac015[_0xf269('0x2f')][_0xf269('0x3d')]){_0x261ccf[_0xf269('0x3e')]=[{'all':!![]}];}return db[_0xf269('0x2b')]['findAll'](_0x261ccf);})[_0xf269('0x25')](function(_0x2a1540){_0x2ad8c3[_0xf269('0x3f')]=_0x2a1540;return _0x2ad8c3;})[_0xf269('0x25')](respondWithFilteredResult(_0x3e9ab9,_0x261ccf))[_0xf269('0x40')](handleError(_0x3e9ab9,null));};exports[_0xf269('0x41')]=function(_0x217f46,_0x4b9d3d){var _0x3610e2={'raw':![],'where':{'id':_0x217f46['params']['id']}},_0x34dd14={};_0x34dd14[_0xf269('0x32')]=_[_0xf269('0x30')](db[_0xf269('0x2b')]['rawAttributes']);_0x34dd14[_0xf269('0x2f')]=_[_0xf269('0x30')](_0x217f46[_0xf269('0x2f')]);_0x34dd14[_0xf269('0x31')]=_[_0xf269('0x34')](_0x34dd14[_0xf269('0x32')],_0x34dd14[_0xf269('0x2f')]);_0x3610e2[_0xf269('0x33')]=_[_0xf269('0x34')](_0x34dd14[_0xf269('0x32')],qs[_0xf269('0x35')](_0x217f46['query']['fields']));_0x3610e2[_0xf269('0x33')]=_0x3610e2[_0xf269('0x33')][_0xf269('0x42')]?_0x3610e2['attributes']:_0x34dd14[_0xf269('0x32')];if(_0x217f46[_0xf269('0x2f')][_0xf269('0x3d')]){_0x3610e2[_0xf269('0x3e')]=[{'all':!![]}];}_0x3610e2=_[_0xf269('0x3b')]({},_0x3610e2,_0x217f46[_0xf269('0x43')]);return db[_0xf269('0x2b')][_0xf269('0x44')](_0x3610e2)[_0xf269('0x25')](handleEntityNotFound(_0x4b9d3d,null))[_0xf269('0x25')](respondWithResult(_0x4b9d3d,null))[_0xf269('0x40')](handleError(_0x4b9d3d,null));};exports[_0xf269('0x45')]=function(_0x4f6c98,_0x5a4a59){return db[_0xf269('0x2b')][_0xf269('0x45')](_0x4f6c98[_0xf269('0x46')],{})[_0xf269('0x25')](respondWithResult(_0x5a4a59,0xc9))['catch'](handleError(_0x5a4a59,null));};exports['update']=function(_0x51aa47,_0x1f1a65){if(_0x51aa47['body']['id']){delete _0x51aa47[_0xf269('0x46')]['id'];}return db[_0xf269('0x2b')][_0xf269('0x44')]({'where':{'id':_0x51aa47[_0xf269('0x47')]['id']}})[_0xf269('0x25')](handleEntityNotFound(_0x1f1a65,null))[_0xf269('0x25')](saveUpdates(_0x51aa47[_0xf269('0x46')],null))['then'](respondWithResult(_0x1f1a65,null))[_0xf269('0x40')](handleError(_0x1f1a65,null));};exports[_0xf269('0x26')]=function(_0xf28d34,_0x9bb640){return db[_0xf269('0x2b')][_0xf269('0x44')]({'where':{'id':_0xf28d34[_0xf269('0x47')]['id']}})[_0xf269('0x25')](handleEntityNotFound(_0x9bb640,null))[_0xf269('0x25')](removeEntity(_0x9bb640,null))[_0xf269('0x40')](handleError(_0x9bb640,null));};exports[_0xf269('0x48')]=function(_0x288d32,_0x4abc3a,_0x39cb9c){var _0x3391a1={};var _0x57cd77={};var _0x2f9ea3;var _0x2f499b;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x288d32[_0xf269('0x47')]['id']}})['then'](handleEntityNotFound(_0x4abc3a,null))[_0xf269('0x25')](function(_0x4c7433){if(_0x4c7433){_0x2f9ea3=_0x4c7433;_0x57cd77[_0xf269('0x32')]=_['keys'](db[_0xf269('0x49')][_0xf269('0x2c')]);_0x57cd77[_0xf269('0x2f')]=_[_0xf269('0x30')](_0x288d32[_0xf269('0x2f')]);_0x57cd77[_0xf269('0x31')]=_[_0xf269('0x34')](_0x57cd77[_0xf269('0x32')],_0x57cd77[_0xf269('0x2f')]);_0x3391a1[_0xf269('0x33')]=_[_0xf269('0x34')](_0x57cd77[_0xf269('0x32')],qs[_0xf269('0x35')](_0x288d32[_0xf269('0x2f')][_0xf269('0x35')]));_0x3391a1[_0xf269('0x33')]=_0x3391a1[_0xf269('0x33')]['length']?_0x3391a1['attributes']:_0x57cd77[_0xf269('0x32')];_0x3391a1[_0xf269('0x4a')]=qs[_0xf269('0x37')](_0x288d32[_0xf269('0x2f')][_0xf269('0x37')]);_0x3391a1[_0xf269('0x38')]=qs['filters'](_['pick'](_0x288d32[_0xf269('0x2f')],_0x57cd77[_0xf269('0x31')]));if(_0x288d32[_0xf269('0x2f')][_0xf269('0x3a')]){_0x3391a1['where']=_[_0xf269('0x3b')](_0x3391a1[_0xf269('0x38')],{'$or':_['map'](_0x3391a1[_0xf269('0x33')],function(_0x195b87){var _0x2ede9e={};_0x2ede9e[_0x195b87]={'$like':'%'+_0x288d32['query'][_0xf269('0x3a')]+'%'};return _0x2ede9e;})});}_0x3391a1=_[_0xf269('0x3b')]({},_0x3391a1,_0x288d32['options']);return _0x2f9ea3[_0xf269('0x48')](_0x3391a1);}})[_0xf269('0x25')](function(_0x22ce0e){if(_0x22ce0e){_0x2f499b=_0x22ce0e['length'];if(!_0x288d32[_0xf269('0x2f')][_0xf269('0x4b')](_0xf269('0x36'))){_0x3391a1['limit']=qs[_0xf269('0x1e')](_0x288d32[_0xf269('0x2f')][_0xf269('0x1e')]);_0x3391a1['offset']=qs[_0xf269('0x1c')](_0x288d32[_0xf269('0x2f')][_0xf269('0x1c')]);}return _0x2f9ea3['getFields'](_0x3391a1);}})[_0xf269('0x25')](function(_0x457017){if(_0x457017){return _0x457017?{'count':_0x2f499b,'rows':_0x457017}:null;}})[_0xf269('0x25')](respondWithResult(_0x4abc3a,null))[_0xf269('0x40')](handleError(_0x4abc3a,null));};exports['getSubjects']=function(_0x52b5bc,_0x3ce151,_0x4f8f59){var _0x285257={};var _0x28f43c={};var _0x21c68e;var _0x58e36c;return db['SalesforceConfiguration'][_0xf269('0x4c')]({'where':{'id':_0x52b5bc[_0xf269('0x47')]['id']}})[_0xf269('0x25')](handleEntityNotFound(_0x3ce151,null))[_0xf269('0x25')](function(_0x379e6e){if(_0x379e6e){_0x21c68e=_0x379e6e;_0x28f43c[_0xf269('0x32')]=_[_0xf269('0x30')](db['SalesforceField'][_0xf269('0x2c')]);_0x28f43c[_0xf269('0x2f')]=_[_0xf269('0x30')](_0x52b5bc[_0xf269('0x2f')]);_0x28f43c[_0xf269('0x31')]=_[_0xf269('0x34')](_0x28f43c['model'],_0x28f43c['query']);_0x285257[_0xf269('0x33')]=_[_0xf269('0x34')](_0x28f43c[_0xf269('0x32')],qs['fields'](_0x52b5bc[_0xf269('0x2f')][_0xf269('0x35')]));_0x285257[_0xf269('0x33')]=_0x285257['attributes']['length']?_0x285257[_0xf269('0x33')]:_0x28f43c[_0xf269('0x32')];_0x285257['order']=qs[_0xf269('0x37')](_0x52b5bc[_0xf269('0x2f')][_0xf269('0x37')]);_0x285257[_0xf269('0x38')]=qs['filters'](_['pick'](_0x52b5bc[_0xf269('0x2f')],_0x28f43c[_0xf269('0x31')]));if(_0x52b5bc[_0xf269('0x2f')]['filter']){_0x285257['where']=_[_0xf269('0x3b')](_0x285257[_0xf269('0x38')],{'$or':_[_0xf269('0x2a')](_0x285257[_0xf269('0x33')],function(_0x275f42){var _0x171b6f={};_0x171b6f[_0x275f42]={'$like':'%'+_0x52b5bc['query'][_0xf269('0x3a')]+'%'};return _0x171b6f;})});}_0x285257=_[_0xf269('0x3b')]({},_0x285257,_0x52b5bc[_0xf269('0x43')]);return _0x21c68e[_0xf269('0x4d')](_0x285257);}})[_0xf269('0x25')](function(_0x463654){if(_0x463654){_0x58e36c=_0x463654[_0xf269('0x42')];if(!_0x52b5bc[_0xf269('0x2f')][_0xf269('0x4b')](_0xf269('0x36'))){_0x285257['limit']=qs[_0xf269('0x1e')](_0x52b5bc[_0xf269('0x2f')]['limit']);_0x285257[_0xf269('0x1c')]=qs[_0xf269('0x1c')](_0x52b5bc['query']['offset']);}return _0x21c68e[_0xf269('0x4d')](_0x285257);}})[_0xf269('0x25')](function(_0x442746){if(_0x442746){return _0x442746?{'count':_0x58e36c,'rows':_0x442746}:null;}})[_0xf269('0x25')](respondWithResult(_0x3ce151,null))[_0xf269('0x40')](handleError(_0x3ce151,null));};exports['getDescriptions']=function(_0x12153,_0x300633,_0x10a31a){var _0x5707e6={};var _0x407feb={};var _0x3f5082;var _0x4c7f06;return db[_0xf269('0x2b')]['findOne']({'where':{'id':_0x12153[_0xf269('0x47')]['id']}})[_0xf269('0x25')](handleEntityNotFound(_0x300633,null))['then'](function(_0x2de74a){if(_0x2de74a){_0x3f5082=_0x2de74a;_0x407feb[_0xf269('0x32')]=_[_0xf269('0x30')](db[_0xf269('0x49')][_0xf269('0x2c')]);_0x407feb[_0xf269('0x2f')]=_[_0xf269('0x30')](_0x12153[_0xf269('0x2f')]);_0x407feb['filters']=_[_0xf269('0x34')](_0x407feb[_0xf269('0x32')],_0x407feb['query']);_0x5707e6[_0xf269('0x33')]=_[_0xf269('0x34')](_0x407feb[_0xf269('0x32')],qs['fields'](_0x12153[_0xf269('0x2f')][_0xf269('0x35')]));_0x5707e6[_0xf269('0x33')]=_0x5707e6[_0xf269('0x33')]['length']?_0x5707e6[_0xf269('0x33')]:_0x407feb[_0xf269('0x32')];_0x5707e6[_0xf269('0x4a')]=qs[_0xf269('0x37')](_0x12153[_0xf269('0x2f')][_0xf269('0x37')]);_0x5707e6[_0xf269('0x38')]=qs[_0xf269('0x31')](_[_0xf269('0x39')](_0x12153[_0xf269('0x2f')],_0x407feb[_0xf269('0x31')]));if(_0x12153['query'][_0xf269('0x3a')]){_0x5707e6[_0xf269('0x38')]=_[_0xf269('0x3b')](_0x5707e6[_0xf269('0x38')],{'$or':_[_0xf269('0x2a')](_0x5707e6[_0xf269('0x33')],function(_0x3b3b03){var _0x33ce69={};_0x33ce69[_0x3b3b03]={'$like':'%'+_0x12153['query'][_0xf269('0x3a')]+'%'};return _0x33ce69;})});}_0x5707e6=_[_0xf269('0x3b')]({},_0x5707e6,_0x12153['options']);return _0x3f5082[_0xf269('0x4e')](_0x5707e6);}})[_0xf269('0x25')](function(_0x359f51){if(_0x359f51){_0x4c7f06=_0x359f51[_0xf269('0x42')];if(!_0x12153['query'][_0xf269('0x4b')](_0xf269('0x36'))){_0x5707e6[_0xf269('0x1e')]=qs['limit'](_0x12153[_0xf269('0x2f')][_0xf269('0x1e')]);_0x5707e6[_0xf269('0x1c')]=qs['offset'](_0x12153[_0xf269('0x2f')][_0xf269('0x1c')]);}return _0x3f5082[_0xf269('0x4e')](_0x5707e6);}})[_0xf269('0x25')](function(_0x80c741){if(_0x80c741){return _0x80c741?{'count':_0x4c7f06,'rows':_0x80c741}:null;}})[_0xf269('0x25')](respondWithResult(_0x300633,null))[_0xf269('0x40')](handleError(_0x300633,null));}; \ No newline at end of file +var _0xc813=['body','getFields','findOne','intersection','getSubjects','SalesforceField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','fields','find','create'];(function(_0x1e3195,_0x2d8492){var _0x1b75d0=function(_0x52d368){while(--_0x52d368){_0x1e3195['push'](_0x1e3195['shift']());}};_0x1b75d0(++_0x2d8492);}(_0xc813,0x1db));var _0x3c81=function(_0x51b10b,_0x311567){_0x51b10b=_0x51b10b-0x0;var _0x45b2cf=_0xc813[_0x51b10b];return _0x45b2cf;};'use strict';var emlformat=require(_0x3c81('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c81('0x1'));var jsonpatch=require(_0x3c81('0x2'));var rp=require(_0x3c81('0x3'));var moment=require(_0x3c81('0x4'));var BPromise=require(_0x3c81('0x5'));var Mustache=require(_0x3c81('0x6'));var util=require(_0x3c81('0x7'));var path=require(_0x3c81('0x8'));var sox=require(_0x3c81('0x9'));var csv=require(_0x3c81('0xa'));var ejs=require(_0x3c81('0xb'));var fs=require('fs');var fs_extra=require(_0x3c81('0xc'));var _=require('lodash');var squel=require(_0x3c81('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c81('0xe'));var deskjs=require(_0x3c81('0xf'));var toCsv=require(_0x3c81('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c81('0x10'));var authService=require(_0x3c81('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3c81('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c81('0x13'))(_0x3c81('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3c81('0x15'));var db=require(_0x3c81('0x16'))['db'];function respondWithStatusCode(_0x39613e,_0x2c61ae){_0x2c61ae=_0x2c61ae||0xcc;return function(_0x51887a){if(_0x51887a){return _0x39613e[_0x3c81('0x17')](_0x2c61ae);}return _0x39613e[_0x3c81('0x18')](_0x2c61ae)[_0x3c81('0x19')]();};}function respondWithResult(_0x53aaec,_0x2e8993){_0x2e8993=_0x2e8993||0xc8;return function(_0x1113a8){if(_0x1113a8){return _0x53aaec[_0x3c81('0x18')](_0x2e8993)[_0x3c81('0x1a')](_0x1113a8);}};}function respondWithFilteredResult(_0x2af43f,_0xd045ab){return function(_0x4d3d04){if(_0x4d3d04){var _0x2cbbb2=typeof _0xd045ab[_0x3c81('0x1b')]===_0x3c81('0x1c')&&typeof _0xd045ab[_0x3c81('0x1d')]===_0x3c81('0x1c');var _0x143ed0=_0x4d3d04[_0x3c81('0x1e')];var _0x355805=_0x2cbbb2?0x0:_0xd045ab[_0x3c81('0x1b')];var _0x18fa6c=_0x2cbbb2?_0x4d3d04['count']:_0xd045ab[_0x3c81('0x1b')]+_0xd045ab['limit'];var _0xa0c16b;if(_0x18fa6c>=_0x143ed0){_0x18fa6c=_0x143ed0;_0xa0c16b=0xc8;}else{_0xa0c16b=0xce;}_0x2af43f[_0x3c81('0x18')](_0xa0c16b);return _0x2af43f[_0x3c81('0x1f')](_0x3c81('0x20'),_0x355805+'-'+_0x18fa6c+'/'+_0x143ed0)[_0x3c81('0x1a')](_0x4d3d04);}return null;};}function patchUpdates(_0x33c450){return function(_0x4f2c67){try{jsonpatch[_0x3c81('0x21')](_0x4f2c67,_0x33c450,!![]);}catch(_0x1cb471){return BPromise[_0x3c81('0x22')](_0x1cb471);}return _0x4f2c67[_0x3c81('0x23')]();};}function saveUpdates(_0x3f1e87,_0x1f5933){return function(_0x47fbff){if(_0x47fbff){return _0x47fbff[_0x3c81('0x24')](_0x3f1e87)[_0x3c81('0x25')](function(_0x3c3987){return _0x3c3987;});}return null;};}function removeEntity(_0x1ea3ef,_0x53ce15){return function(_0x52d7e3){if(_0x52d7e3){return _0x52d7e3[_0x3c81('0x26')]()[_0x3c81('0x25')](function(){_0x1ea3ef[_0x3c81('0x18')](0xcc)[_0x3c81('0x19')]();});}};}function handleEntityNotFound(_0x5d2773,_0xff1a39){return function(_0x22d7ed){if(!_0x22d7ed){_0x5d2773['sendStatus'](0x194);}return _0x22d7ed;};}function handleError(_0x43642e,_0x3375e7){_0x3375e7=_0x3375e7||0x1f4;return function(_0x1a4dd9){logger[_0x3c81('0x27')](_0x1a4dd9['stack']);if(_0x1a4dd9[_0x3c81('0x28')]){delete _0x1a4dd9[_0x3c81('0x28')];}_0x43642e[_0x3c81('0x18')](_0x3375e7)['send'](_0x1a4dd9);};}exports[_0x3c81('0x29')]=function(_0x553054,_0xaba94d){var _0x37da24={},_0x3bc617={},_0x4745a4={'count':0x0,'rows':[]};var _0x404757=_[_0x3c81('0x2a')](db[_0x3c81('0x2b')][_0x3c81('0x2c')],function(_0x532b4a){return{'name':_0x532b4a[_0x3c81('0x2d')],'type':_0x532b4a[_0x3c81('0x2e')][_0x3c81('0x2f')]};});_0x3bc617[_0x3c81('0x30')]=_['map'](_0x404757,_0x3c81('0x28'));_0x3bc617['query']=_[_0x3c81('0x31')](_0x553054['query']);_0x3bc617[_0x3c81('0x32')]=_['intersection'](_0x3bc617[_0x3c81('0x30')],_0x3bc617['query']);_0x37da24['attributes']=_['intersection'](_0x3bc617[_0x3c81('0x30')],qs['fields'](_0x553054[_0x3c81('0x33')]['fields']));_0x37da24[_0x3c81('0x34')]=_0x37da24[_0x3c81('0x34')][_0x3c81('0x35')]?_0x37da24['attributes']:_0x3bc617[_0x3c81('0x30')];if(!_0x553054[_0x3c81('0x33')][_0x3c81('0x36')](_0x3c81('0x37'))){_0x37da24['limit']=qs[_0x3c81('0x1d')](_0x553054[_0x3c81('0x33')][_0x3c81('0x1d')]);_0x37da24[_0x3c81('0x1b')]=qs[_0x3c81('0x1b')](_0x553054['query'][_0x3c81('0x1b')]);}_0x37da24[_0x3c81('0x38')]=qs[_0x3c81('0x39')](_0x553054[_0x3c81('0x33')][_0x3c81('0x39')]);_0x37da24[_0x3c81('0x3a')]=qs[_0x3c81('0x32')](_[_0x3c81('0x3b')](_0x553054[_0x3c81('0x33')],_0x3bc617[_0x3c81('0x32')]),_0x404757);if(_0x553054['query'][_0x3c81('0x3c')]){_0x37da24[_0x3c81('0x3a')]=_[_0x3c81('0x3d')](_0x37da24[_0x3c81('0x3a')],{'$or':_['map'](_0x404757,function(_0x37a487){if(_0x37a487[_0x3c81('0x2e')]!==_0x3c81('0x3e')){var _0x11eec9={};_0x11eec9[_0x37a487[_0x3c81('0x28')]]={'$like':'%'+_0x553054[_0x3c81('0x33')][_0x3c81('0x3c')]+'%'};return _0x11eec9;}})});}_0x37da24=_['merge']({},_0x37da24,_0x553054[_0x3c81('0x3f')]);var _0x1e5ae1={'where':_0x37da24[_0x3c81('0x3a')]};return db[_0x3c81('0x2b')]['count'](_0x1e5ae1)[_0x3c81('0x25')](function(_0x159e5d){_0x4745a4['count']=_0x159e5d;if(_0x553054[_0x3c81('0x33')][_0x3c81('0x40')]){_0x37da24['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x3c81('0x41')](_0x37da24);})[_0x3c81('0x25')](function(_0x5465ff){_0x4745a4['rows']=_0x5465ff;return _0x4745a4;})[_0x3c81('0x25')](respondWithFilteredResult(_0xaba94d,_0x37da24))[_0x3c81('0x42')](handleError(_0xaba94d,null));};exports['show']=function(_0x5440ed,_0x57a3c6){var _0x2fa355={'raw':![],'where':{'id':_0x5440ed[_0x3c81('0x43')]['id']}},_0x570fba={};_0x570fba[_0x3c81('0x30')]=_[_0x3c81('0x31')](db['SalesforceConfiguration']['rawAttributes']);_0x570fba['query']=_['keys'](_0x5440ed[_0x3c81('0x33')]);_0x570fba[_0x3c81('0x32')]=_['intersection'](_0x570fba[_0x3c81('0x30')],_0x570fba[_0x3c81('0x33')]);_0x2fa355[_0x3c81('0x34')]=_['intersection'](_0x570fba[_0x3c81('0x30')],qs[_0x3c81('0x44')](_0x5440ed[_0x3c81('0x33')]['fields']));_0x2fa355[_0x3c81('0x34')]=_0x2fa355[_0x3c81('0x34')][_0x3c81('0x35')]?_0x2fa355['attributes']:_0x570fba[_0x3c81('0x30')];if(_0x5440ed[_0x3c81('0x33')][_0x3c81('0x40')]){_0x2fa355['include']=[{'all':!![]}];}_0x2fa355=_[_0x3c81('0x3d')]({},_0x2fa355,_0x5440ed[_0x3c81('0x3f')]);return db[_0x3c81('0x2b')][_0x3c81('0x45')](_0x2fa355)[_0x3c81('0x25')](handleEntityNotFound(_0x57a3c6,null))[_0x3c81('0x25')](respondWithResult(_0x57a3c6,null))[_0x3c81('0x42')](handleError(_0x57a3c6,null));};exports[_0x3c81('0x46')]=function(_0x4543d5,_0x434661){return db[_0x3c81('0x2b')][_0x3c81('0x46')](_0x4543d5[_0x3c81('0x47')],{})[_0x3c81('0x25')](respondWithResult(_0x434661,0xc9))[_0x3c81('0x42')](handleError(_0x434661,null));};exports[_0x3c81('0x24')]=function(_0x130289,_0x235568){if(_0x130289[_0x3c81('0x47')]['id']){delete _0x130289['body']['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x130289[_0x3c81('0x43')]['id']}})[_0x3c81('0x25')](handleEntityNotFound(_0x235568,null))[_0x3c81('0x25')](saveUpdates(_0x130289['body'],null))['then'](respondWithResult(_0x235568,null))[_0x3c81('0x42')](handleError(_0x235568,null));};exports[_0x3c81('0x26')]=function(_0x5877d6,_0x40c572){return db['SalesforceConfiguration'][_0x3c81('0x45')]({'where':{'id':_0x5877d6[_0x3c81('0x43')]['id']}})[_0x3c81('0x25')](handleEntityNotFound(_0x40c572,null))[_0x3c81('0x25')](removeEntity(_0x40c572,null))[_0x3c81('0x42')](handleError(_0x40c572,null));};exports[_0x3c81('0x48')]=function(_0x21edbe,_0x52d2fb,_0x139dc2){var _0x271c01={};var _0x45f0ee={};var _0x1860d7;var _0xd08d7a;return db[_0x3c81('0x2b')][_0x3c81('0x49')]({'where':{'id':_0x21edbe[_0x3c81('0x43')]['id']}})['then'](handleEntityNotFound(_0x52d2fb,null))[_0x3c81('0x25')](function(_0xf90888){if(_0xf90888){_0x1860d7=_0xf90888;_0x45f0ee['model']=_[_0x3c81('0x31')](db['SalesforceField'][_0x3c81('0x2c')]);_0x45f0ee[_0x3c81('0x33')]=_[_0x3c81('0x31')](_0x21edbe[_0x3c81('0x33')]);_0x45f0ee[_0x3c81('0x32')]=_[_0x3c81('0x4a')](_0x45f0ee[_0x3c81('0x30')],_0x45f0ee['query']);_0x271c01[_0x3c81('0x34')]=_['intersection'](_0x45f0ee['model'],qs[_0x3c81('0x44')](_0x21edbe[_0x3c81('0x33')][_0x3c81('0x44')]));_0x271c01['attributes']=_0x271c01['attributes'][_0x3c81('0x35')]?_0x271c01[_0x3c81('0x34')]:_0x45f0ee[_0x3c81('0x30')];_0x271c01['order']=qs['sort'](_0x21edbe['query']['sort']);_0x271c01['where']=qs[_0x3c81('0x32')](_[_0x3c81('0x3b')](_0x21edbe[_0x3c81('0x33')],_0x45f0ee['filters']));if(_0x21edbe[_0x3c81('0x33')][_0x3c81('0x3c')]){_0x271c01['where']=_[_0x3c81('0x3d')](_0x271c01[_0x3c81('0x3a')],{'$or':_[_0x3c81('0x2a')](_0x271c01[_0x3c81('0x34')],function(_0x6bb6b2){var _0x191590={};_0x191590[_0x6bb6b2]={'$like':'%'+_0x21edbe[_0x3c81('0x33')][_0x3c81('0x3c')]+'%'};return _0x191590;})});}_0x271c01=_[_0x3c81('0x3d')]({},_0x271c01,_0x21edbe[_0x3c81('0x3f')]);return _0x1860d7[_0x3c81('0x48')](_0x271c01);}})[_0x3c81('0x25')](function(_0x2d57ba){if(_0x2d57ba){_0xd08d7a=_0x2d57ba[_0x3c81('0x35')];if(!_0x21edbe[_0x3c81('0x33')][_0x3c81('0x36')](_0x3c81('0x37'))){_0x271c01['limit']=qs['limit'](_0x21edbe[_0x3c81('0x33')][_0x3c81('0x1d')]);_0x271c01[_0x3c81('0x1b')]=qs[_0x3c81('0x1b')](_0x21edbe[_0x3c81('0x33')][_0x3c81('0x1b')]);}return _0x1860d7[_0x3c81('0x48')](_0x271c01);}})[_0x3c81('0x25')](function(_0x16dcfd){if(_0x16dcfd){return _0x16dcfd?{'count':_0xd08d7a,'rows':_0x16dcfd}:null;}})[_0x3c81('0x25')](respondWithResult(_0x52d2fb,null))[_0x3c81('0x42')](handleError(_0x52d2fb,null));};exports[_0x3c81('0x4b')]=function(_0x36f88d,_0x23f84f,_0x12effc){var _0x2b52d7={};var _0x3c7304={};var _0x47ad80;var _0x53ef7e;return db[_0x3c81('0x2b')]['findOne']({'where':{'id':_0x36f88d[_0x3c81('0x43')]['id']}})['then'](handleEntityNotFound(_0x23f84f,null))[_0x3c81('0x25')](function(_0x29009c){if(_0x29009c){_0x47ad80=_0x29009c;_0x3c7304[_0x3c81('0x30')]=_[_0x3c81('0x31')](db['SalesforceField']['rawAttributes']);_0x3c7304[_0x3c81('0x33')]=_[_0x3c81('0x31')](_0x36f88d[_0x3c81('0x33')]);_0x3c7304['filters']=_[_0x3c81('0x4a')](_0x3c7304[_0x3c81('0x30')],_0x3c7304['query']);_0x2b52d7[_0x3c81('0x34')]=_['intersection'](_0x3c7304[_0x3c81('0x30')],qs[_0x3c81('0x44')](_0x36f88d[_0x3c81('0x33')][_0x3c81('0x44')]));_0x2b52d7[_0x3c81('0x34')]=_0x2b52d7[_0x3c81('0x34')][_0x3c81('0x35')]?_0x2b52d7[_0x3c81('0x34')]:_0x3c7304['model'];_0x2b52d7[_0x3c81('0x38')]=qs[_0x3c81('0x39')](_0x36f88d[_0x3c81('0x33')][_0x3c81('0x39')]);_0x2b52d7[_0x3c81('0x3a')]=qs[_0x3c81('0x32')](_[_0x3c81('0x3b')](_0x36f88d['query'],_0x3c7304[_0x3c81('0x32')]));if(_0x36f88d[_0x3c81('0x33')][_0x3c81('0x3c')]){_0x2b52d7[_0x3c81('0x3a')]=_[_0x3c81('0x3d')](_0x2b52d7[_0x3c81('0x3a')],{'$or':_[_0x3c81('0x2a')](_0x2b52d7[_0x3c81('0x34')],function(_0x535a28){var _0x38901c={};_0x38901c[_0x535a28]={'$like':'%'+_0x36f88d[_0x3c81('0x33')][_0x3c81('0x3c')]+'%'};return _0x38901c;})});}_0x2b52d7=_[_0x3c81('0x3d')]({},_0x2b52d7,_0x36f88d[_0x3c81('0x3f')]);return _0x47ad80[_0x3c81('0x4b')](_0x2b52d7);}})[_0x3c81('0x25')](function(_0x2da0cd){if(_0x2da0cd){_0x53ef7e=_0x2da0cd[_0x3c81('0x35')];if(!_0x36f88d[_0x3c81('0x33')][_0x3c81('0x36')](_0x3c81('0x37'))){_0x2b52d7['limit']=qs['limit'](_0x36f88d[_0x3c81('0x33')]['limit']);_0x2b52d7['offset']=qs[_0x3c81('0x1b')](_0x36f88d[_0x3c81('0x33')][_0x3c81('0x1b')]);}return _0x47ad80[_0x3c81('0x4b')](_0x2b52d7);}})[_0x3c81('0x25')](function(_0x1947ed){if(_0x1947ed){return _0x1947ed?{'count':_0x53ef7e,'rows':_0x1947ed}:null;}})[_0x3c81('0x25')](respondWithResult(_0x23f84f,null))[_0x3c81('0x42')](handleError(_0x23f84f,null));};exports['getDescriptions']=function(_0x19afcb,_0x4f4263,_0x58233b){var _0x53aed4={};var _0x23b425={};var _0x3e02bf;var _0x26a3c8;return db[_0x3c81('0x2b')][_0x3c81('0x49')]({'where':{'id':_0x19afcb[_0x3c81('0x43')]['id']}})[_0x3c81('0x25')](handleEntityNotFound(_0x4f4263,null))[_0x3c81('0x25')](function(_0x12f570){if(_0x12f570){_0x3e02bf=_0x12f570;_0x23b425[_0x3c81('0x30')]=_['keys'](db[_0x3c81('0x4c')][_0x3c81('0x2c')]);_0x23b425['query']=_[_0x3c81('0x31')](_0x19afcb[_0x3c81('0x33')]);_0x23b425['filters']=_[_0x3c81('0x4a')](_0x23b425[_0x3c81('0x30')],_0x23b425['query']);_0x53aed4[_0x3c81('0x34')]=_[_0x3c81('0x4a')](_0x23b425[_0x3c81('0x30')],qs[_0x3c81('0x44')](_0x19afcb[_0x3c81('0x33')]['fields']));_0x53aed4[_0x3c81('0x34')]=_0x53aed4[_0x3c81('0x34')][_0x3c81('0x35')]?_0x53aed4['attributes']:_0x23b425[_0x3c81('0x30')];_0x53aed4[_0x3c81('0x38')]=qs[_0x3c81('0x39')](_0x19afcb[_0x3c81('0x33')]['sort']);_0x53aed4['where']=qs['filters'](_[_0x3c81('0x3b')](_0x19afcb['query'],_0x23b425[_0x3c81('0x32')]));if(_0x19afcb[_0x3c81('0x33')]['filter']){_0x53aed4[_0x3c81('0x3a')]=_[_0x3c81('0x3d')](_0x53aed4[_0x3c81('0x3a')],{'$or':_[_0x3c81('0x2a')](_0x53aed4[_0x3c81('0x34')],function(_0x44085d){var _0x4b766d={};_0x4b766d[_0x44085d]={'$like':'%'+_0x19afcb[_0x3c81('0x33')][_0x3c81('0x3c')]+'%'};return _0x4b766d;})});}_0x53aed4=_[_0x3c81('0x3d')]({},_0x53aed4,_0x19afcb['options']);return _0x3e02bf[_0x3c81('0x4d')](_0x53aed4);}})[_0x3c81('0x25')](function(_0x45b90a){if(_0x45b90a){_0x26a3c8=_0x45b90a['length'];if(!_0x19afcb[_0x3c81('0x33')]['hasOwnProperty']('nolimit')){_0x53aed4['limit']=qs[_0x3c81('0x1d')](_0x19afcb[_0x3c81('0x33')]['limit']);_0x53aed4['offset']=qs[_0x3c81('0x1b')](_0x19afcb['query'][_0x3c81('0x1b')]);}return _0x3e02bf[_0x3c81('0x4d')](_0x53aed4);}})[_0x3c81('0x25')](function(_0x10d617){if(_0x10d617){return _0x10d617?{'count':_0x26a3c8,'rows':_0x10d617}:null;}})[_0x3c81('0x25')](respondWithResult(_0x4f4263,null))['catch'](handleError(_0x4f4263,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e871af1..1b7c9dd 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 _0x3f70=['moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger'];(function(_0x47d981,_0x4e08b0){var _0x24cd9d=function(_0x45f688){while(--_0x45f688){_0x47d981['push'](_0x47d981['shift']());}};_0x24cd9d(++_0x4e08b0);}(_0x3f70,0xfa));var _0x03f7=function(_0x3ebc28,_0x28dd6d){_0x3ebc28=_0x3ebc28-0x0;var _0xeb3b02=_0x3f70[_0x3ebc28];return _0xeb3b02;};'use strict';var _=require(_0x03f7('0x0'));var util=require('util');var logger=require(_0x03f7('0x1'))('api');var moment=require(_0x03f7('0x2'));var BPromise=require(_0x03f7('0x3'));var rp=require(_0x03f7('0x4'));var fs=require('fs');var path=require(_0x03f7('0x5'));var rimraf=require(_0x03f7('0x6'));var config=require('../../config/environment');var attributes=require(_0x03f7('0x7'));module[_0x03f7('0x8')]=function(_0x594e19,_0x16ad61){return _0x594e19[_0x03f7('0x9')](_0x03f7('0xa'),attributes,{'tableName':_0x03f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeac=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0x4d9255,_0x374413){var _0x19442c=function(_0x10ed9b){while(--_0x10ed9b){_0x4d9255['push'](_0x4d9255['shift']());}};_0x19442c(++_0x374413);}(_0xbeac,0x191));var _0xcbea=function(_0x281b52,_0x17d7b7){_0x281b52=_0x281b52-0x0;var _0x14981c=_0xbeac[_0x281b52];return _0x14981c;};'use strict';var _=require(_0xcbea('0x0'));var util=require(_0xcbea('0x1'));var logger=require(_0xcbea('0x2'))('api');var moment=require(_0xcbea('0x3'));var BPromise=require(_0xcbea('0x4'));var rp=require(_0xcbea('0x5'));var fs=require('fs');var path=require(_0xcbea('0x6'));var rimraf=require('rimraf');var config=require(_0xcbea('0x7'));var attributes=require(_0xcbea('0x8'));module[_0xcbea('0x9')]=function(_0x2c2b2b,_0x2a0d38){return _0x2c2b2b[_0xcbea('0xa')](_0xcbea('0xb'),attributes,{'tableName':_0xcbea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 9927dc9..06a5a2d 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 _0x3f83=['client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2c7123,_0x33d3a6){var _0x18979a=function(_0xff4b9c){while(--_0xff4b9c){_0x2c7123['push'](_0x2c7123['shift']());}};_0x18979a(++_0x33d3a6);}(_0x3f83,0x1a6));var _0x33f8=function(_0x17ffd0,_0x1ea12e){_0x17ffd0=_0x17ffd0-0x0;var _0x104d90=_0x3f83[_0x17ffd0];return _0x104d90;};'use strict';var _=require(_0x33f8('0x0'));var util=require(_0x33f8('0x1'));var moment=require(_0x33f8('0x2'));var BPromise=require(_0x33f8('0x3'));var rs=require(_0x33f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x33f8('0x5'));var logger=require(_0x33f8('0x6'))(_0x33f8('0x7'));var config=require(_0x33f8('0x8'));var jayson=require(_0x33f8('0x9'));var client=jayson[_0x33f8('0xa')][_0x33f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3701a3,_0xd0f5d8,_0x26401b){return new BPromise(function(_0x468305,_0x452c76){return client['request'](_0x3701a3,_0x26401b)[_0x33f8('0xc')](function(_0x18d35d){logger[_0x33f8('0xd')](_0x33f8('0xe'),_0xd0f5d8,_0x33f8('0xf'));logger[_0x33f8('0x10')](_0x33f8('0x11'),_0xd0f5d8,_0x33f8('0xf'),JSON[_0x33f8('0x12')](_0x18d35d));if(_0x18d35d[_0x33f8('0x13')]){if(_0x18d35d[_0x33f8('0x13')][_0x33f8('0x14')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0xd0f5d8,_0x18d35d['error'][_0x33f8('0x15')]);return _0x452c76(_0x18d35d['error'][_0x33f8('0x15')]);}logger[_0x33f8('0x13')](_0x33f8('0xe'),_0xd0f5d8,_0x18d35d[_0x33f8('0x13')][_0x33f8('0x15')]);return _0x468305(_0x18d35d[_0x33f8('0x13')]['message']);}else{logger[_0x33f8('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0xd0f5d8,_0x33f8('0xf'));_0x468305(_0x18d35d[_0x33f8('0x16')][_0x33f8('0x15')]);}})[_0x33f8('0x17')](function(_0x331669){logger[_0x33f8('0x13')](_0x33f8('0xe'),_0xd0f5d8,_0x331669);_0x452c76(_0x331669);});});} \ No newline at end of file +var _0xcc87=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4c3817,_0x5be1bb){var _0x3a2936=function(_0x5ca525){while(--_0x5ca525){_0x4c3817['push'](_0x4c3817['shift']());}};_0x3a2936(++_0x5be1bb);}(_0xcc87,0x14d));var _0x7cc8=function(_0x1fbffe,_0x1e2725){_0x1fbffe=_0x1fbffe-0x0;var _0xa058cf=_0xcc87[_0x1fbffe];return _0xa058cf;};'use strict';var _=require(_0x7cc8('0x0'));var util=require(_0x7cc8('0x1'));var moment=require('moment');var BPromise=require(_0x7cc8('0x2'));var rs=require(_0x7cc8('0x3'));var fs=require('fs');var Redis=require(_0x7cc8('0x4'));var db=require(_0x7cc8('0x5'))['db'];var utils=require(_0x7cc8('0x6'));var logger=require(_0x7cc8('0x7'))(_0x7cc8('0x8'));var config=require(_0x7cc8('0x9'));var jayson=require(_0x7cc8('0xa'));var client=jayson[_0x7cc8('0xb')][_0x7cc8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b94ed,_0x2e7355,_0x1fff56){return new BPromise(function(_0x424302,_0x3dfb1c){return client[_0x7cc8('0xd')](_0x4b94ed,_0x1fff56)[_0x7cc8('0xe')](function(_0x36e05d){logger[_0x7cc8('0xf')](_0x7cc8('0x10'),_0x2e7355,_0x7cc8('0x11'));logger[_0x7cc8('0x12')](_0x7cc8('0x13'),_0x2e7355,'request\x20sent',JSON[_0x7cc8('0x14')](_0x36e05d));if(_0x36e05d[_0x7cc8('0x15')]){if(_0x36e05d[_0x7cc8('0x15')][_0x7cc8('0x16')]===0x1f4){logger[_0x7cc8('0x15')](_0x7cc8('0x10'),_0x2e7355,_0x36e05d[_0x7cc8('0x15')][_0x7cc8('0x17')]);return _0x3dfb1c(_0x36e05d[_0x7cc8('0x15')][_0x7cc8('0x17')]);}logger[_0x7cc8('0x15')](_0x7cc8('0x10'),_0x2e7355,_0x36e05d[_0x7cc8('0x15')][_0x7cc8('0x17')]);return _0x424302(_0x36e05d[_0x7cc8('0x15')]['message']);}else{logger[_0x7cc8('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2e7355,_0x7cc8('0x11'));_0x424302(_0x36e05d[_0x7cc8('0x18')][_0x7cc8('0x17')]);}})[_0x7cc8('0x19')](function(_0x198e55){logger[_0x7cc8('0x15')](_0x7cc8('0x10'),_0x2e7355,_0x198e55);_0x3dfb1c(_0x198e55);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0381656..df3a237 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 _0xc0c6=['fs-extra','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','put','update','multer','util','path','connect-timeout','Router'];(function(_0x36c7de,_0x366b47){var _0x16de7a=function(_0x491654){while(--_0x491654){_0x36c7de['push'](_0x36c7de['shift']());}};_0x16de7a(++_0x366b47);}(_0xc0c6,0x14b));var _0x6c0c=function(_0x510639,_0xa5572){_0x510639=_0x510639-0x0;var _0x4cd834=_0xc0c6[_0x510639];return _0x4cd834;};'use strict';var multer=require(_0x6c0c('0x0'));var util=require(_0x6c0c('0x1'));var path=require(_0x6c0c('0x2'));var timeout=require(_0x6c0c('0x3'));var express=require('express');var router=express[_0x6c0c('0x4')]();var fs_extra=require(_0x6c0c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6c0c('0x6'));var config=require('../../config/environment');var controller=require(_0x6c0c('0x7'));router[_0x6c0c('0x8')]('/',auth[_0x6c0c('0x9')](),controller[_0x6c0c('0xa')]);router[_0x6c0c('0x8')](_0x6c0c('0xb'),auth[_0x6c0c('0x9')](),controller[_0x6c0c('0xc')]);router['post']('/',auth[_0x6c0c('0x9')](),controller[_0x6c0c('0xd')]);router[_0x6c0c('0xe')]('/:id',auth[_0x6c0c('0x9')](),controller[_0x6c0c('0xf')]);router['delete'](_0x6c0c('0xb'),auth[_0x6c0c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5458=['index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x1d9088,_0x1cc0bd){var _0x4ee896=function(_0x438cf9){while(--_0x438cf9){_0x1d9088['push'](_0x1d9088['shift']());}};_0x4ee896(++_0x1cc0bd);}(_0x5458,0x14e));var _0x8545=function(_0x405531,_0x1c6e9b){_0x405531=_0x405531-0x0;var _0x2784f6=_0x5458[_0x405531];return _0x2784f6;};'use strict';var multer=require('multer');var util=require(_0x8545('0x0'));var path=require(_0x8545('0x1'));var timeout=require('connect-timeout');var express=require(_0x8545('0x2'));var router=express[_0x8545('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8545('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8545('0x5'));var controller=require(_0x8545('0x6'));router[_0x8545('0x7')]('/',auth['isAuthenticated'](),controller[_0x8545('0x8')]);router[_0x8545('0x7')](_0x8545('0x9'),auth[_0x8545('0xa')](),controller[_0x8545('0xb')]);router[_0x8545('0xc')]('/',auth[_0x8545('0xa')](),controller['create']);router[_0x8545('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8545('0xe')]);router[_0x8545('0xf')](_0x8545('0x9'),auth[_0x8545('0xa')](),controller[_0x8545('0x10')]);module[_0x8545('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 80de0e8..59b3946 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 _0xd5e5=['variable','customVariable','keyValue','picklist','STRING','ENUM','string','sequelize','exports'];(function(_0x248b8d,_0x2caf42){var _0x25f65f=function(_0x59bbc1){while(--_0x59bbc1){_0x248b8d['push'](_0x248b8d['shift']());}};_0x25f65f(++_0x2caf42);}(_0xd5e5,0x193));var _0x5d5e=function(_0x4d55ed,_0x18ebc8){_0x4d55ed=_0x4d55ed-0x0;var _0x2cb865=_0xd5e5[_0x4d55ed];return _0x2cb865;};'use strict';var Sequelize=require(_0x5d5e('0x0'));module[_0x5d5e('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x5d5e('0x2'),_0x5d5e('0x3'),_0x5d5e('0x4'),_0x5d5e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5d5e('0x6')]},'key':{'type':Sequelize[_0x5d5e('0x6')]},'keyType':{'type':Sequelize[_0x5d5e('0x7')](_0x5d5e('0x8'),'variable',_0x5d5e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5d5e('0x6')]},'variableName':{'type':Sequelize[_0x5d5e('0x6')]}}; \ No newline at end of file +var _0xe5de=['STRING','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0xef440e,_0xed0726){var _0x186b1f=function(_0x241847){while(--_0x241847){_0xef440e['push'](_0xef440e['shift']());}};_0x186b1f(++_0xed0726);}(_0xe5de,0x94));var _0xee5d=function(_0x275795,_0x11bb93){_0x275795=_0x275795-0x0;var _0x4e7cee=_0xe5de[_0x275795];return _0x4e7cee;};'use strict';var Sequelize=require('sequelize');module[_0xee5d('0x0')]={'type':{'type':Sequelize[_0xee5d('0x1')](_0xee5d('0x2'),_0xee5d('0x3'),_0xee5d('0x4'),_0xee5d('0x5'),'picklist'),'defaultValue':_0xee5d('0x2')},'content':{'type':Sequelize[_0xee5d('0x6')]},'key':{'type':Sequelize[_0xee5d('0x6')]},'keyType':{'type':Sequelize[_0xee5d('0x1')]('string',_0xee5d('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xee5d('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 27259a1..72d7351 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 _0x6c60=['apply','reject','save','update','then','destroy','error','stack','send','index','map','SalesforceField','type','key','model','name','query','keys','filters','attributes','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','findAll','catch','show','rawAttributes','intersection','fields','length','includeAll','include','find','create','body','params','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x243a39,_0x4c9b51){var _0x5620a2=function(_0x16a997){while(--_0x16a997){_0x243a39['push'](_0x243a39['shift']());}};_0x5620a2(++_0x4c9b51);}(_0x6c60,0x10b));var _0x06c6=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x6c60[_0x397cfb];return _0x15fed9;};'use strict';var emlformat=require(_0x06c6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x06c6('0x1'));var moment=require(_0x06c6('0x2'));var BPromise=require(_0x06c6('0x3'));var Mustache=require(_0x06c6('0x4'));var util=require(_0x06c6('0x5'));var path=require(_0x06c6('0x6'));var sox=require(_0x06c6('0x7'));var csv=require(_0x06c6('0x8'));var ejs=require(_0x06c6('0x9'));var fs=require('fs');var fs_extra=require(_0x06c6('0xa'));var _=require('lodash');var squel=require(_0x06c6('0xb'));var crypto=require(_0x06c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x06c6('0xd'));var toCsv=require(_0x06c6('0x8'));var querystring=require('querystring');var Papa=require(_0x06c6('0xe'));var Redis=require(_0x06c6('0xf'));var authService=require(_0x06c6('0x10'));var qs=require(_0x06c6('0x11'));var as=require(_0x06c6('0x12'));var hardwareService=require(_0x06c6('0x13'));var logger=require(_0x06c6('0x14'))('api');var utils=require(_0x06c6('0x15'));var config=require(_0x06c6('0x16'));var licenseUtil=require(_0x06c6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527f1b,_0x4fbfcd){_0x4fbfcd=_0x4fbfcd||0xcc;return function(_0x2dbaa9){if(_0x2dbaa9){return _0x527f1b[_0x06c6('0x18')](_0x4fbfcd);}return _0x527f1b[_0x06c6('0x19')](_0x4fbfcd)[_0x06c6('0x1a')]();};}function respondWithResult(_0x33f342,_0x4ba1fc){_0x4ba1fc=_0x4ba1fc||0xc8;return function(_0x5bbc26){if(_0x5bbc26){return _0x33f342[_0x06c6('0x19')](_0x4ba1fc)[_0x06c6('0x1b')](_0x5bbc26);}};}function respondWithFilteredResult(_0xe6b4da,_0x3eea80){return function(_0x5f36af){if(_0x5f36af){var _0x755ea4=typeof _0x3eea80[_0x06c6('0x1c')]===_0x06c6('0x1d')&&typeof _0x3eea80[_0x06c6('0x1e')]===_0x06c6('0x1d');var _0x56c4f8=_0x5f36af['count'];var _0x307954=_0x755ea4?0x0:_0x3eea80['offset'];var _0x5c8618=_0x755ea4?_0x5f36af[_0x06c6('0x1f')]:_0x3eea80['offset']+_0x3eea80[_0x06c6('0x1e')];var _0x4b0f4d;if(_0x5c8618>=_0x56c4f8){_0x5c8618=_0x56c4f8;_0x4b0f4d=0xc8;}else{_0x4b0f4d=0xce;}_0xe6b4da['status'](_0x4b0f4d);return _0xe6b4da['set'](_0x06c6('0x20'),_0x307954+'-'+_0x5c8618+'/'+_0x56c4f8)[_0x06c6('0x1b')](_0x5f36af);}return null;};}function patchUpdates(_0x200da8){return function(_0x3b4cd8){try{jsonpatch[_0x06c6('0x21')](_0x3b4cd8,_0x200da8,!![]);}catch(_0x4a1b6a){return BPromise[_0x06c6('0x22')](_0x4a1b6a);}return _0x3b4cd8[_0x06c6('0x23')]();};}function saveUpdates(_0x151b91,_0x58fe0e){return function(_0x2884b6){if(_0x2884b6){return _0x2884b6[_0x06c6('0x24')](_0x151b91)[_0x06c6('0x25')](function(_0x3f4425){return _0x3f4425;});}return null;};}function removeEntity(_0x4c418a,_0x16faec){return function(_0x2031e5){if(_0x2031e5){return _0x2031e5[_0x06c6('0x26')]()[_0x06c6('0x25')](function(){_0x4c418a[_0x06c6('0x19')](0xcc)[_0x06c6('0x1a')]();});}};}function handleEntityNotFound(_0x434150,_0x1eec48){return function(_0x54a314){if(!_0x54a314){_0x434150[_0x06c6('0x18')](0x194);}return _0x54a314;};}function handleError(_0x3c465b,_0x3976d3){_0x3976d3=_0x3976d3||0x1f4;return function(_0x31cb22){logger[_0x06c6('0x27')](_0x31cb22[_0x06c6('0x28')]);if(_0x31cb22['name']){delete _0x31cb22['name'];}_0x3c465b[_0x06c6('0x19')](_0x3976d3)[_0x06c6('0x29')](_0x31cb22);};}exports[_0x06c6('0x2a')]=function(_0x12cdd8,_0x276347){var _0x50231f={},_0x1b50be={},_0x282fbe={'count':0x0,'rows':[]};var _0x394b89=_[_0x06c6('0x2b')](db[_0x06c6('0x2c')]['rawAttributes'],function(_0x273a7a){return{'name':_0x273a7a['fieldName'],'type':_0x273a7a[_0x06c6('0x2d')][_0x06c6('0x2e')]};});_0x1b50be[_0x06c6('0x2f')]=_[_0x06c6('0x2b')](_0x394b89,_0x06c6('0x30'));_0x1b50be[_0x06c6('0x31')]=_[_0x06c6('0x32')](_0x12cdd8['query']);_0x1b50be[_0x06c6('0x33')]=_['intersection'](_0x1b50be['model'],_0x1b50be[_0x06c6('0x31')]);_0x50231f[_0x06c6('0x34')]=_['intersection'](_0x1b50be['model'],qs['fields'](_0x12cdd8[_0x06c6('0x31')]['fields']));_0x50231f[_0x06c6('0x34')]=_0x50231f['attributes']['length']?_0x50231f['attributes']:_0x1b50be[_0x06c6('0x2f')];if(!_0x12cdd8[_0x06c6('0x31')][_0x06c6('0x35')](_0x06c6('0x36'))){_0x50231f[_0x06c6('0x1e')]=qs['limit'](_0x12cdd8['query'][_0x06c6('0x1e')]);_0x50231f[_0x06c6('0x1c')]=qs['offset'](_0x12cdd8['query'][_0x06c6('0x1c')]);}_0x50231f['order']=qs[_0x06c6('0x37')](_0x12cdd8['query'][_0x06c6('0x37')]);_0x50231f['where']=qs[_0x06c6('0x33')](_[_0x06c6('0x38')](_0x12cdd8[_0x06c6('0x31')],_0x1b50be[_0x06c6('0x33')]),_0x394b89);if(_0x12cdd8[_0x06c6('0x31')][_0x06c6('0x39')]){_0x50231f['where']=_[_0x06c6('0x3a')](_0x50231f[_0x06c6('0x3b')],{'$or':_[_0x06c6('0x2b')](_0x394b89,function(_0x5acd2f){if(_0x5acd2f[_0x06c6('0x2d')]!==_0x06c6('0x3c')){var _0x32b8e5={};_0x32b8e5[_0x5acd2f['name']]={'$like':'%'+_0x12cdd8[_0x06c6('0x31')][_0x06c6('0x39')]+'%'};return _0x32b8e5;}})});}_0x50231f=_[_0x06c6('0x3a')]({},_0x50231f,_0x12cdd8[_0x06c6('0x3d')]);var _0x1be196={'where':_0x50231f[_0x06c6('0x3b')]};return db[_0x06c6('0x2c')]['count'](_0x1be196)['then'](function(_0x1f6f13){_0x282fbe['count']=_0x1f6f13;if(_0x12cdd8[_0x06c6('0x31')]['includeAll']){_0x50231f['include']=[{'all':!![]}];}return db[_0x06c6('0x2c')][_0x06c6('0x3e')](_0x50231f);})[_0x06c6('0x25')](function(_0x66402f){_0x282fbe['rows']=_0x66402f;return _0x282fbe;})['then'](respondWithFilteredResult(_0x276347,_0x50231f))[_0x06c6('0x3f')](handleError(_0x276347,null));};exports[_0x06c6('0x40')]=function(_0x3dfadd,_0x269e9){var _0x2797ae={'raw':!![],'where':{'id':_0x3dfadd['params']['id']}},_0x148d42={};_0x148d42['model']=_[_0x06c6('0x32')](db[_0x06c6('0x2c')][_0x06c6('0x41')]);_0x148d42['query']=_[_0x06c6('0x32')](_0x3dfadd[_0x06c6('0x31')]);_0x148d42[_0x06c6('0x33')]=_[_0x06c6('0x42')](_0x148d42[_0x06c6('0x2f')],_0x148d42[_0x06c6('0x31')]);_0x2797ae[_0x06c6('0x34')]=_['intersection'](_0x148d42[_0x06c6('0x2f')],qs[_0x06c6('0x43')](_0x3dfadd[_0x06c6('0x31')][_0x06c6('0x43')]));_0x2797ae[_0x06c6('0x34')]=_0x2797ae['attributes'][_0x06c6('0x44')]?_0x2797ae[_0x06c6('0x34')]:_0x148d42[_0x06c6('0x2f')];if(_0x3dfadd[_0x06c6('0x31')][_0x06c6('0x45')]){_0x2797ae[_0x06c6('0x46')]=[{'all':!![]}];}_0x2797ae=_[_0x06c6('0x3a')]({},_0x2797ae,_0x3dfadd['options']);return db['SalesforceField'][_0x06c6('0x47')](_0x2797ae)[_0x06c6('0x25')](handleEntityNotFound(_0x269e9,null))['then'](respondWithResult(_0x269e9,null))[_0x06c6('0x3f')](handleError(_0x269e9,null));};exports['create']=function(_0x42d15d,_0x38e5d5){return db[_0x06c6('0x2c')][_0x06c6('0x48')](_0x42d15d[_0x06c6('0x49')],{})[_0x06c6('0x25')](respondWithResult(_0x38e5d5,0xc9))['catch'](handleError(_0x38e5d5,null));};exports[_0x06c6('0x24')]=function(_0x5cdf07,_0x2cc212){if(_0x5cdf07[_0x06c6('0x49')]['id']){delete _0x5cdf07[_0x06c6('0x49')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x5cdf07['params']['id']}})[_0x06c6('0x25')](handleEntityNotFound(_0x2cc212,null))[_0x06c6('0x25')](saveUpdates(_0x5cdf07['body'],null))[_0x06c6('0x25')](respondWithResult(_0x2cc212,null))[_0x06c6('0x3f')](handleError(_0x2cc212,null));};exports[_0x06c6('0x26')]=function(_0xec8bf2,_0x33d471){return db[_0x06c6('0x2c')][_0x06c6('0x47')]({'where':{'id':_0xec8bf2[_0x06c6('0x4a')]['id']}})[_0x06c6('0x25')](handleEntityNotFound(_0x33d471,null))['then'](removeEntity(_0x33d471,null))[_0x06c6('0x3f')](handleError(_0x33d471,null));}; \ No newline at end of file +var _0xc154=['find','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','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','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','error','send','index','map','fieldName','type','name','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','SalesforceField','then','includeAll','rows','catch','show','length','include','options','create','body','params'];(function(_0x3135f7,_0x13571d){var _0x22294a=function(_0x338155){while(--_0x338155){_0x3135f7['push'](_0x3135f7['shift']());}};_0x22294a(++_0x13571d);}(_0xc154,0x1cf));var _0x4c15=function(_0x2bda85,_0x5466b1){_0x2bda85=_0x2bda85-0x0;var _0xbff55f=_0xc154[_0x2bda85];return _0xbff55f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c15('0x0'));var zipdir=require(_0x4c15('0x1'));var jsonpatch=require(_0x4c15('0x2'));var rp=require(_0x4c15('0x3'));var moment=require(_0x4c15('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4c15('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4c15('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c15('0x7'));var _=require(_0x4c15('0x8'));var squel=require(_0x4c15('0x9'));var crypto=require(_0x4c15('0xa'));var jsforce=require(_0x4c15('0xb'));var deskjs=require(_0x4c15('0xc'));var toCsv=require(_0x4c15('0xd'));var querystring=require(_0x4c15('0xe'));var Papa=require(_0x4c15('0xf'));var Redis=require(_0x4c15('0x10'));var authService=require(_0x4c15('0x11'));var qs=require(_0x4c15('0x12'));var as=require(_0x4c15('0x13'));var hardwareService=require(_0x4c15('0x14'));var logger=require(_0x4c15('0x15'))(_0x4c15('0x16'));var utils=require(_0x4c15('0x17'));var config=require(_0x4c15('0x18'));var licenseUtil=require(_0x4c15('0x19'));var db=require(_0x4c15('0x1a'))['db'];function respondWithStatusCode(_0x713855,_0xdc15dc){_0xdc15dc=_0xdc15dc||0xcc;return function(_0x1b8568){if(_0x1b8568){return _0x713855[_0x4c15('0x1b')](_0xdc15dc);}return _0x713855[_0x4c15('0x1c')](_0xdc15dc)[_0x4c15('0x1d')]();};}function respondWithResult(_0x5cd5f8,_0x23acb6){_0x23acb6=_0x23acb6||0xc8;return function(_0x2a0419){if(_0x2a0419){return _0x5cd5f8[_0x4c15('0x1c')](_0x23acb6)['json'](_0x2a0419);}};}function respondWithFilteredResult(_0x5ad2f4,_0x366705){return function(_0xcdacdd){if(_0xcdacdd){var _0x536041=typeof _0x366705[_0x4c15('0x1e')]===_0x4c15('0x1f')&&typeof _0x366705['limit']===_0x4c15('0x1f');var _0x3d49b8=_0xcdacdd[_0x4c15('0x20')];var _0x59b3e6=_0x536041?0x0:_0x366705[_0x4c15('0x1e')];var _0x2880d0=_0x536041?_0xcdacdd[_0x4c15('0x20')]:_0x366705['offset']+_0x366705[_0x4c15('0x21')];var _0x519f49;if(_0x2880d0>=_0x3d49b8){_0x2880d0=_0x3d49b8;_0x519f49=0xc8;}else{_0x519f49=0xce;}_0x5ad2f4[_0x4c15('0x1c')](_0x519f49);return _0x5ad2f4[_0x4c15('0x22')](_0x4c15('0x23'),_0x59b3e6+'-'+_0x2880d0+'/'+_0x3d49b8)[_0x4c15('0x24')](_0xcdacdd);}return null;};}function patchUpdates(_0x801196){return function(_0x5d2a4c){try{jsonpatch[_0x4c15('0x25')](_0x5d2a4c,_0x801196,!![]);}catch(_0x1864ec){return BPromise['reject'](_0x1864ec);}return _0x5d2a4c[_0x4c15('0x26')]();};}function saveUpdates(_0x1daa64,_0x381895){return function(_0x5679ca){if(_0x5679ca){return _0x5679ca[_0x4c15('0x27')](_0x1daa64)['then'](function(_0x357211){return _0x357211;});}return null;};}function removeEntity(_0x4a6d93,_0x4c4ae8){return function(_0x187419){if(_0x187419){return _0x187419[_0x4c15('0x28')]()['then'](function(){_0x4a6d93[_0x4c15('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x184365,_0x9b2757){return function(_0x4a081c){if(!_0x4a081c){_0x184365['sendStatus'](0x194);}return _0x4a081c;};}function handleError(_0x22206f,_0x2901b1){_0x2901b1=_0x2901b1||0x1f4;return function(_0x369ef1){logger[_0x4c15('0x29')](_0x369ef1['stack']);if(_0x369ef1['name']){delete _0x369ef1['name'];}_0x22206f[_0x4c15('0x1c')](_0x2901b1)[_0x4c15('0x2a')](_0x369ef1);};}exports[_0x4c15('0x2b')]=function(_0x2b9b08,_0x33ddad){var _0x32c8e4={},_0x3029b2={},_0x2b3bb6={'count':0x0,'rows':[]};var _0x2e56fa=_[_0x4c15('0x2c')](db['SalesforceField']['rawAttributes'],function(_0x73fe3b){return{'name':_0x73fe3b[_0x4c15('0x2d')],'type':_0x73fe3b[_0x4c15('0x2e')]['key']};});_0x3029b2['model']=_[_0x4c15('0x2c')](_0x2e56fa,_0x4c15('0x2f'));_0x3029b2['query']=_[_0x4c15('0x30')](_0x2b9b08[_0x4c15('0x31')]);_0x3029b2['filters']=_[_0x4c15('0x32')](_0x3029b2[_0x4c15('0x33')],_0x3029b2[_0x4c15('0x31')]);_0x32c8e4[_0x4c15('0x34')]=_['intersection'](_0x3029b2[_0x4c15('0x33')],qs[_0x4c15('0x35')](_0x2b9b08['query']['fields']));_0x32c8e4[_0x4c15('0x34')]=_0x32c8e4['attributes']['length']?_0x32c8e4[_0x4c15('0x34')]:_0x3029b2[_0x4c15('0x33')];if(!_0x2b9b08[_0x4c15('0x31')][_0x4c15('0x36')](_0x4c15('0x37'))){_0x32c8e4[_0x4c15('0x21')]=qs[_0x4c15('0x21')](_0x2b9b08[_0x4c15('0x31')][_0x4c15('0x21')]);_0x32c8e4[_0x4c15('0x1e')]=qs[_0x4c15('0x1e')](_0x2b9b08[_0x4c15('0x31')][_0x4c15('0x1e')]);}_0x32c8e4[_0x4c15('0x38')]=qs['sort'](_0x2b9b08[_0x4c15('0x31')][_0x4c15('0x39')]);_0x32c8e4[_0x4c15('0x3a')]=qs[_0x4c15('0x3b')](_[_0x4c15('0x3c')](_0x2b9b08['query'],_0x3029b2[_0x4c15('0x3b')]),_0x2e56fa);if(_0x2b9b08[_0x4c15('0x31')]['filter']){_0x32c8e4['where']=_[_0x4c15('0x3d')](_0x32c8e4[_0x4c15('0x3a')],{'$or':_[_0x4c15('0x2c')](_0x2e56fa,function(_0x30f553){if(_0x30f553[_0x4c15('0x2e')]!==_0x4c15('0x3e')){var _0x504afe={};_0x504afe[_0x30f553[_0x4c15('0x2f')]]={'$like':'%'+_0x2b9b08[_0x4c15('0x31')][_0x4c15('0x3f')]+'%'};return _0x504afe;}})});}_0x32c8e4=_[_0x4c15('0x3d')]({},_0x32c8e4,_0x2b9b08['options']);var _0x21ab1f={'where':_0x32c8e4['where']};return db[_0x4c15('0x40')][_0x4c15('0x20')](_0x21ab1f)[_0x4c15('0x41')](function(_0x224f50){_0x2b3bb6['count']=_0x224f50;if(_0x2b9b08[_0x4c15('0x31')][_0x4c15('0x42')]){_0x32c8e4['include']=[{'all':!![]}];}return db[_0x4c15('0x40')]['findAll'](_0x32c8e4);})[_0x4c15('0x41')](function(_0x60edc4){_0x2b3bb6[_0x4c15('0x43')]=_0x60edc4;return _0x2b3bb6;})[_0x4c15('0x41')](respondWithFilteredResult(_0x33ddad,_0x32c8e4))[_0x4c15('0x44')](handleError(_0x33ddad,null));};exports[_0x4c15('0x45')]=function(_0x26e471,_0x3990fa){var _0xc77a58={'raw':!![],'where':{'id':_0x26e471['params']['id']}},_0x11e8c2={};_0x11e8c2[_0x4c15('0x33')]=_[_0x4c15('0x30')](db[_0x4c15('0x40')]['rawAttributes']);_0x11e8c2[_0x4c15('0x31')]=_[_0x4c15('0x30')](_0x26e471['query']);_0x11e8c2[_0x4c15('0x3b')]=_['intersection'](_0x11e8c2['model'],_0x11e8c2['query']);_0xc77a58['attributes']=_[_0x4c15('0x32')](_0x11e8c2['model'],qs[_0x4c15('0x35')](_0x26e471[_0x4c15('0x31')][_0x4c15('0x35')]));_0xc77a58[_0x4c15('0x34')]=_0xc77a58[_0x4c15('0x34')][_0x4c15('0x46')]?_0xc77a58[_0x4c15('0x34')]:_0x11e8c2[_0x4c15('0x33')];if(_0x26e471[_0x4c15('0x31')][_0x4c15('0x42')]){_0xc77a58[_0x4c15('0x47')]=[{'all':!![]}];}_0xc77a58=_[_0x4c15('0x3d')]({},_0xc77a58,_0x26e471[_0x4c15('0x48')]);return db[_0x4c15('0x40')]['find'](_0xc77a58)['then'](handleEntityNotFound(_0x3990fa,null))['then'](respondWithResult(_0x3990fa,null))[_0x4c15('0x44')](handleError(_0x3990fa,null));};exports[_0x4c15('0x49')]=function(_0x5cf422,_0x74eb4c){return db[_0x4c15('0x40')][_0x4c15('0x49')](_0x5cf422[_0x4c15('0x4a')],{})[_0x4c15('0x41')](respondWithResult(_0x74eb4c,0xc9))[_0x4c15('0x44')](handleError(_0x74eb4c,null));};exports[_0x4c15('0x27')]=function(_0xe41e9d,_0x34dae1){if(_0xe41e9d[_0x4c15('0x4a')]['id']){delete _0xe41e9d['body']['id'];}return db[_0x4c15('0x40')]['find']({'where':{'id':_0xe41e9d[_0x4c15('0x4b')]['id']}})[_0x4c15('0x41')](handleEntityNotFound(_0x34dae1,null))[_0x4c15('0x41')](saveUpdates(_0xe41e9d[_0x4c15('0x4a')],null))[_0x4c15('0x41')](respondWithResult(_0x34dae1,null))['catch'](handleError(_0x34dae1,null));};exports[_0x4c15('0x28')]=function(_0x25fb48,_0x2b6caa){return db[_0x4c15('0x40')][_0x4c15('0x4c')]({'where':{'id':_0x25fb48[_0x4c15('0x4b')]['id']}})[_0x4c15('0x41')](handleEntityNotFound(_0x2b6caa,null))[_0x4c15('0x41')](removeEntity(_0x2b6caa,null))[_0x4c15('0x44')](handleError(_0x2b6caa,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 80971a4..fe72ac2 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 _0x2e98=['../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0x2e98,0x88));var _0x82e9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2e98[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x82e9('0x0'));var util=require(_0x82e9('0x1'));var logger=require(_0x82e9('0x2'))('api');var moment=require(_0x82e9('0x3'));var BPromise=require(_0x82e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82e9('0x5'));var rimraf=require(_0x82e9('0x6'));var config=require(_0x82e9('0x7'));var attributes=require(_0x82e9('0x8'));module['exports']=function(_0x9fcd17,_0x4632d5){return _0x9fcd17[_0x82e9('0x9')](_0x82e9('0xa'),attributes,{'tableName':_0x82e9('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x82e9('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7781=['request-promise','path','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7781,0x19f));var _0x1778=function(_0x5168ad,_0x278244){_0x5168ad=_0x5168ad-0x0;var _0x4b4b9f=_0x7781[_0x5168ad];return _0x4b4b9f;};'use strict';var _=require(_0x1778('0x0'));var util=require(_0x1778('0x1'));var logger=require(_0x1778('0x2'))(_0x1778('0x3'));var moment=require('moment');var BPromise=require(_0x1778('0x4'));var rp=require(_0x1778('0x5'));var fs=require('fs');var path=require(_0x1778('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1778('0x7'));module[_0x1778('0x8')]=function(_0x4b3aad,_0x506ddc){return _0x4b3aad[_0x1778('0x9')](_0x1778('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x1778('0xb'),'fields':[_0x1778('0xc'),_0x1778('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 a63c9a2..1311bc7 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 _0x4bb5=['jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x454643,_0x1c8611){var _0x4fa630=function(_0x338e04){while(--_0x338e04){_0x454643['push'](_0x454643['shift']());}};_0x4fa630(++_0x1c8611);}(_0x4bb5,0x114));var _0x54bb=function(_0x3a1af1,_0x13205c){_0x3a1af1=_0x3a1af1-0x0;var _0x5782c0=_0x4bb5[_0x3a1af1];return _0x5782c0;};'use strict';var _=require(_0x54bb('0x0'));var util=require('util');var moment=require(_0x54bb('0x1'));var BPromise=require(_0x54bb('0x2'));var rs=require(_0x54bb('0x3'));var fs=require('fs');var Redis=require(_0x54bb('0x4'));var db=require(_0x54bb('0x5'))['db'];var utils=require(_0x54bb('0x6'));var logger=require(_0x54bb('0x7'))(_0x54bb('0x8'));var config=require(_0x54bb('0x9'));var jayson=require(_0x54bb('0xa'));var client=jayson[_0x54bb('0xb')][_0x54bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2817cd,_0x3a99f0,_0x1aa15e){return new BPromise(function(_0x2e612b,_0x254521){return client[_0x54bb('0xd')](_0x2817cd,_0x1aa15e)['then'](function(_0x380e34){logger[_0x54bb('0xe')](_0x54bb('0xf'),_0x3a99f0,_0x54bb('0x10'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x3a99f0,_0x54bb('0x10'),JSON[_0x54bb('0x11')](_0x380e34));if(_0x380e34['error']){if(_0x380e34[_0x54bb('0x12')]['code']===0x1f4){logger['error'](_0x54bb('0xf'),_0x3a99f0,_0x380e34[_0x54bb('0x12')][_0x54bb('0x13')]);return _0x254521(_0x380e34[_0x54bb('0x12')][_0x54bb('0x13')]);}logger[_0x54bb('0x12')]('SalesforceField,\x20%s,\x20%s',_0x3a99f0,_0x380e34['error']['message']);return _0x2e612b(_0x380e34[_0x54bb('0x12')][_0x54bb('0x13')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x3a99f0,_0x54bb('0x10'));_0x2e612b(_0x380e34[_0x54bb('0x14')][_0x54bb('0x13')]);}})[_0x54bb('0x15')](function(_0x1279ed){logger['error']('SalesforceField,\x20%s,\x20%s',_0x3a99f0,_0x1279ed);_0x254521(_0x1279ed);});});} \ No newline at end of file +var _0x143a=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x143a,0x170));var _0xa143=function(_0x31b132,_0x431a5f){_0x31b132=_0x31b132-0x0;var _0x1b172e=_0x143a[_0x31b132];return _0x1b172e;};'use strict';var _=require('lodash');var util=require(_0xa143('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa143('0x1'));var fs=require('fs');var Redis=require(_0xa143('0x2'));var db=require(_0xa143('0x3'))['db'];var utils=require(_0xa143('0x4'));var logger=require(_0xa143('0x5'))(_0xa143('0x6'));var config=require(_0xa143('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa143('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x240588,_0x506fa0,_0x1dd89c){return new BPromise(function(_0x2749b5,_0x4f4c4d){return client['request'](_0x240588,_0x1dd89c)[_0xa143('0x9')](function(_0x46e2cc){logger[_0xa143('0xa')](_0xa143('0xb'),_0x506fa0,'request\x20sent');logger['debug'](_0xa143('0xc'),_0x506fa0,_0xa143('0xd'),JSON[_0xa143('0xe')](_0x46e2cc));if(_0x46e2cc['error']){if(_0x46e2cc[_0xa143('0xf')]['code']===0x1f4){logger[_0xa143('0xf')](_0xa143('0xb'),_0x506fa0,_0x46e2cc[_0xa143('0xf')][_0xa143('0x10')]);return _0x4f4c4d(_0x46e2cc[_0xa143('0xf')][_0xa143('0x10')]);}logger[_0xa143('0xf')]('SalesforceField,\x20%s,\x20%s',_0x506fa0,_0x46e2cc[_0xa143('0xf')][_0xa143('0x10')]);return _0x2749b5(_0x46e2cc[_0xa143('0xf')][_0xa143('0x10')]);}else{logger[_0xa143('0xa')](_0xa143('0xb'),_0x506fa0,_0xa143('0xd'));_0x2749b5(_0x46e2cc[_0xa143('0x11')][_0xa143('0x10')]);}})[_0xa143('0x12')](function(_0x1dc299){logger[_0xa143('0xf')](_0xa143('0xb'),_0x506fa0,_0x1dc299);_0x4f4c4d(_0x1dc299);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 5e63bcd..77051e9 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 _0xf12f=['create','addConfiguration','update','delete','util','path','connect-timeout','fs-extra','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x5c403,_0x1fbbf9){var _0x57696a=function(_0x242b77){while(--_0x242b77){_0x5c403['push'](_0x5c403['shift']());}};_0x57696a(++_0x1fbbf9);}(_0xf12f,0x9c));var _0xff12=function(_0x12786e,_0x121447){_0x12786e=_0x12786e-0x0;var _0xb65e70=_0xf12f[_0x12786e];return _0xb65e70;};'use strict';var multer=require('multer');var util=require(_0xff12('0x0'));var path=require(_0xff12('0x1'));var timeout=require(_0xff12('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xff12('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xff12('0x4'));var controller=require(_0xff12('0x5'));router[_0xff12('0x6')]('/',auth[_0xff12('0x7')](),controller[_0xff12('0x8')]);router[_0xff12('0x6')](_0xff12('0x9'),auth[_0xff12('0x7')](),controller['show']);router['get'](_0xff12('0xa'),auth['isAuthenticated'](),controller[_0xff12('0xb')]);router[_0xff12('0x6')](_0xff12('0xc'),auth['isAuthenticated'](),controller[_0xff12('0xd')]);router[_0xff12('0xe')]('/',auth[_0xff12('0x7')](),controller[_0xff12('0xf')]);router['post'](_0xff12('0xa'),auth[_0xff12('0x7')](),controller[_0xff12('0x10')]);router['put'](_0xff12('0x9'),auth['isAuthenticated'](),controller[_0xff12('0x11')]);router[_0xff12('0x12')](_0xff12('0x9'),auth[_0xff12('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdddf=['show','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x5a24e7,_0x155edc){var _0x3c177c=function(_0x1e1281){while(--_0x1e1281){_0x5a24e7['push'](_0x5a24e7['shift']());}};_0x3c177c(++_0x155edc);}(_0xdddf,0x17a));var _0xfddd=function(_0x42b594,_0x517a49){_0x42b594=_0x42b594-0x0;var _0xb611b8=_0xdddf[_0x42b594];return _0xb611b8;};'use strict';var multer=require(_0xfddd('0x0'));var util=require(_0xfddd('0x1'));var path=require(_0xfddd('0x2'));var timeout=require(_0xfddd('0x3'));var express=require(_0xfddd('0x4'));var router=express[_0xfddd('0x5')]();var fs_extra=require(_0xfddd('0x6'));var auth=require(_0xfddd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xfddd('0x8'));var controller=require('./intServicenowAccount.controller');router[_0xfddd('0x9')]('/',auth[_0xfddd('0xa')](),controller[_0xfddd('0xb')]);router[_0xfddd('0x9')](_0xfddd('0xc'),auth['isAuthenticated'](),controller[_0xfddd('0xd')]);router[_0xfddd('0x9')](_0xfddd('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xfddd('0xf'),auth[_0xfddd('0xa')](),controller['getFields']);router[_0xfddd('0x10')]('/',auth[_0xfddd('0xa')](),controller['create']);router['post'](_0xfddd('0xe'),auth[_0xfddd('0xa')](),controller[_0xfddd('0x11')]);router[_0xfddd('0x12')](_0xfddd('0xc'),auth['isAuthenticated'](),controller[_0xfddd('0x13')]);router[_0xfddd('0x14')](_0xfddd('0xc'),auth['isAuthenticated'](),controller[_0xfddd('0x15')]);module[_0xfddd('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b458131..7a9f0e3 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 _0x0fcc=['exports','STRING','remoteUri','sequelize'];(function(_0x3fe2fb,_0x4637cb){var _0x2a3fc9=function(_0x5019fe){while(--_0x5019fe){_0x3fe2fb['push'](_0x3fe2fb['shift']());}};_0x2a3fc9(++_0x4637cb);}(_0x0fcc,0x13f));var _0xc0fc=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x0fcc[_0x1afabf];return _0x497ff1;};'use strict';var Sequelize=require(_0xc0fc('0x0'));module[_0xc0fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc0fc('0x2')]},'username':{'type':Sequelize[_0xc0fc('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc0fc('0x2')]},'remoteUri':{'type':Sequelize[_0xc0fc('0x2')],'unique':_0xc0fc('0x3')},'serverUrl':{'type':Sequelize[_0xc0fc('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbd79=['exports','STRING','username'];(function(_0x19db25,_0x4244be){var _0x5ec07c=function(_0x3330b2){while(--_0x3330b2){_0x19db25['push'](_0x19db25['shift']());}};_0x5ec07c(++_0x4244be);}(_0xbd79,0xab));var _0x9bd7=function(_0x42835a,_0x5259a7){_0x42835a=_0x42835a-0x0;var _0xa4f23b=_0xbd79[_0x42835a];return _0xa4f23b;};'use strict';var Sequelize=require('sequelize');module[_0x9bd7('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9bd7('0x1')]},'username':{'type':Sequelize[_0x9bd7('0x1')],'unique':_0x9bd7('0x2')},'password':{'type':Sequelize[_0x9bd7('0x1')]},'email':{'type':Sequelize[_0x9bd7('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index fd4f4a2..dd24cb9 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 _0x20ab=['rows','show','params','keys','includeAll','options','find','create','body','catch','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','knowledge','subcategory','notify','incident_state','category','parent','caused_by','sys_updated_on','child_incidents','hold_reason','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','business_service','priority','rfc','expected_start','opened_at','business_duration','group_list','resolved_at','caller_id','approval_set','work_notes','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','severity','approval','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','boolean','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','end','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll'];(function(_0x58feb2,_0xcb86a6){var _0x2f5919=function(_0xd743fc){while(--_0xd743fc){_0x58feb2['push'](_0x58feb2['shift']());}};_0x2f5919(++_0xcb86a6);}(_0x20ab,0x1dc));var _0xb20a=function(_0x2c50a6,_0x2a9854){_0x2c50a6=_0x2c50a6-0x0;var _0x3e6556=_0x20ab[_0x2c50a6];return _0x3e6556;};'use strict';var emlformat=require(_0xb20a('0x0'));var rimraf=require(_0xb20a('0x1'));var zipdir=require(_0xb20a('0x2'));var jsonpatch=require(_0xb20a('0x3'));var rp=require(_0xb20a('0x4'));var moment=require(_0xb20a('0x5'));var BPromise=require(_0xb20a('0x6'));var Mustache=require(_0xb20a('0x7'));var util=require(_0xb20a('0x8'));var path=require(_0xb20a('0x9'));var sox=require('sox');var csv=require(_0xb20a('0xa'));var ejs=require(_0xb20a('0xb'));var fs=require('fs');var fs_extra=require(_0xb20a('0xc'));var _=require(_0xb20a('0xd'));var squel=require(_0xb20a('0xe'));var crypto=require(_0xb20a('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb20a('0xa'));var querystring=require(_0xb20a('0x10'));var Papa=require(_0xb20a('0x11'));var Redis=require(_0xb20a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb20a('0x13'));var as=require(_0xb20a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb20a('0x15'))(_0xb20a('0x16'));var utils=require(_0xb20a('0x17'));var config=require(_0xb20a('0x18'));var licenseUtil=require(_0xb20a('0x19'));var db=require(_0xb20a('0x1a'))['db'];var integrations=require(_0xb20a('0x1b'));function respondWithStatusCode(_0x24cb61,_0x5d7f07){_0x5d7f07=_0x5d7f07||0xcc;return function(_0x501b83){if(_0x501b83){return _0x24cb61[_0xb20a('0x1c')](_0x5d7f07);}return _0x24cb61[_0xb20a('0x1d')](_0x5d7f07)['end']();};}function respondWithResult(_0x44a478,_0x4ff07c){_0x4ff07c=_0x4ff07c||0xc8;return function(_0x2c301d){if(_0x2c301d){return _0x44a478[_0xb20a('0x1d')](_0x4ff07c)[_0xb20a('0x1e')](_0x2c301d);}};}function respondWithFilteredResult(_0x10ad8f,_0x393f4b){return function(_0x30c91c){if(_0x30c91c){var _0x2ea554=typeof _0x393f4b['offset']===_0xb20a('0x1f')&&typeof _0x393f4b[_0xb20a('0x20')]===_0xb20a('0x1f');var _0x3d1364=_0x30c91c[_0xb20a('0x21')];var _0x23d8be=_0x2ea554?0x0:_0x393f4b[_0xb20a('0x22')];var _0x3e9202=_0x2ea554?_0x30c91c[_0xb20a('0x21')]:_0x393f4b[_0xb20a('0x22')]+_0x393f4b['limit'];var _0x425322;if(_0x3e9202>=_0x3d1364){_0x3e9202=_0x3d1364;_0x425322=0xc8;}else{_0x425322=0xce;}_0x10ad8f[_0xb20a('0x1d')](_0x425322);return _0x10ad8f[_0xb20a('0x23')](_0xb20a('0x24'),_0x23d8be+'-'+_0x3e9202+'/'+_0x3d1364)['json'](_0x30c91c);}return null;};}function patchUpdates(_0x15e1d6){return function(_0x2bb81d){try{jsonpatch['apply'](_0x2bb81d,_0x15e1d6,!![]);}catch(_0x428fa9){return BPromise['reject'](_0x428fa9);}return _0x2bb81d[_0xb20a('0x25')]();};}function saveUpdates(_0x21f78c,_0x4a18c2){return function(_0x245728){if(_0x245728){return _0x245728[_0xb20a('0x26')](_0x21f78c)['then'](function(_0x440561){return _0x440561;});}return null;};}function removeEntity(_0x36941c,_0x51063a){return function(_0x418883){if(_0x418883){return _0x418883[_0xb20a('0x27')]()[_0xb20a('0x28')](function(){_0x36941c[_0xb20a('0x1d')](0xcc)[_0xb20a('0x29')]();});}};}function handleEntityNotFound(_0x480ac8,_0x31c20a){return function(_0x1d7e7e){if(!_0x1d7e7e){_0x480ac8[_0xb20a('0x1c')](0x194);}return _0x1d7e7e;};}function handleError(_0x565dce,_0x45ca19){_0x45ca19=_0x45ca19||0x1f4;return function(_0x4f7268){logger[_0xb20a('0x2a')](_0x4f7268[_0xb20a('0x2b')]);if(_0x4f7268[_0xb20a('0x2c')]){delete _0x4f7268[_0xb20a('0x2c')];}_0x565dce[_0xb20a('0x1d')](_0x45ca19)[_0xb20a('0x2d')](_0x4f7268);};}exports[_0xb20a('0x2e')]=function(_0x4cc987,_0x23963f){var _0xd3ebbe={},_0x5d2154={},_0x1da46d={'count':0x0,'rows':[]};var _0x16ecd3=_[_0xb20a('0x2f')](db[_0xb20a('0x30')][_0xb20a('0x31')],function(_0x27a979){return{'name':_0x27a979[_0xb20a('0x32')],'type':_0x27a979[_0xb20a('0x33')]['key']};});_0x5d2154[_0xb20a('0x34')]=_[_0xb20a('0x2f')](_0x16ecd3,'name');_0x5d2154['query']=_['keys'](_0x4cc987[_0xb20a('0x35')]);_0x5d2154['filters']=_[_0xb20a('0x36')](_0x5d2154[_0xb20a('0x34')],_0x5d2154[_0xb20a('0x35')]);_0xd3ebbe[_0xb20a('0x37')]=_['intersection'](_0x5d2154['model'],qs[_0xb20a('0x38')](_0x4cc987[_0xb20a('0x35')][_0xb20a('0x38')]));_0xd3ebbe[_0xb20a('0x37')]=_0xd3ebbe[_0xb20a('0x37')][_0xb20a('0x39')]?_0xd3ebbe['attributes']:_0x5d2154[_0xb20a('0x34')];if(!_0x4cc987[_0xb20a('0x35')]['hasOwnProperty']('nolimit')){_0xd3ebbe[_0xb20a('0x20')]=qs['limit'](_0x4cc987[_0xb20a('0x35')][_0xb20a('0x20')]);_0xd3ebbe[_0xb20a('0x22')]=qs[_0xb20a('0x22')](_0x4cc987['query']['offset']);}_0xd3ebbe[_0xb20a('0x3a')]=qs[_0xb20a('0x3b')](_0x4cc987[_0xb20a('0x35')][_0xb20a('0x3b')]);_0xd3ebbe[_0xb20a('0x3c')]=qs[_0xb20a('0x3d')](_['pick'](_0x4cc987[_0xb20a('0x35')],_0x5d2154[_0xb20a('0x3d')]),_0x16ecd3);if(_0x4cc987[_0xb20a('0x35')][_0xb20a('0x3e')]){_0xd3ebbe[_0xb20a('0x3c')]=_[_0xb20a('0x3f')](_0xd3ebbe[_0xb20a('0x3c')],{'$or':_[_0xb20a('0x2f')](_0x16ecd3,function(_0x1e1b85){if(_0x1e1b85[_0xb20a('0x33')]!==_0xb20a('0x40')){var _0x559e35={};_0x559e35[_0x1e1b85[_0xb20a('0x2c')]]={'$like':'%'+_0x4cc987[_0xb20a('0x35')]['filter']+'%'};return _0x559e35;}})});}_0xd3ebbe=_[_0xb20a('0x3f')]({},_0xd3ebbe,_0x4cc987['options']);var _0x5756a3={'where':_0xd3ebbe[_0xb20a('0x3c')]};return db[_0xb20a('0x30')][_0xb20a('0x21')](_0x5756a3)[_0xb20a('0x28')](function(_0x386ee1){_0x1da46d[_0xb20a('0x21')]=_0x386ee1;if(_0x4cc987[_0xb20a('0x35')]['includeAll']){_0xd3ebbe[_0xb20a('0x41')]=[{'all':!![]}];}return db[_0xb20a('0x30')][_0xb20a('0x42')](_0xd3ebbe);})[_0xb20a('0x28')](function(_0x263a06){_0x1da46d[_0xb20a('0x43')]=_0x263a06;return _0x1da46d;})['then'](respondWithFilteredResult(_0x23963f,_0xd3ebbe))['catch'](handleError(_0x23963f,null));};exports[_0xb20a('0x44')]=function(_0x4b76cb,_0x535f31){var _0x1c3acc={'raw':![],'where':{'id':_0x4b76cb[_0xb20a('0x45')]['id']}},_0x44ad4c={};_0x44ad4c[_0xb20a('0x34')]=_['keys'](db['ServicenowAccount'][_0xb20a('0x31')]);_0x44ad4c['query']=_[_0xb20a('0x46')](_0x4b76cb[_0xb20a('0x35')]);_0x44ad4c[_0xb20a('0x3d')]=_[_0xb20a('0x36')](_0x44ad4c['model'],_0x44ad4c[_0xb20a('0x35')]);_0x1c3acc[_0xb20a('0x37')]=_[_0xb20a('0x36')](_0x44ad4c[_0xb20a('0x34')],qs[_0xb20a('0x38')](_0x4b76cb[_0xb20a('0x35')][_0xb20a('0x38')]));_0x1c3acc[_0xb20a('0x37')]=_0x1c3acc['attributes'][_0xb20a('0x39')]?_0x1c3acc[_0xb20a('0x37')]:_0x44ad4c[_0xb20a('0x34')];if(_0x4b76cb[_0xb20a('0x35')][_0xb20a('0x47')]){_0x1c3acc['include']=[{'all':!![]}];}_0x1c3acc=_['merge']({},_0x1c3acc,_0x4b76cb[_0xb20a('0x48')]);return db[_0xb20a('0x30')][_0xb20a('0x49')](_0x1c3acc)[_0xb20a('0x28')](handleEntityNotFound(_0x535f31,null))[_0xb20a('0x28')](respondWithResult(_0x535f31,null))['catch'](handleError(_0x535f31,null));};exports[_0xb20a('0x4a')]=function(_0x1e2f80,_0x457f4d){return db[_0xb20a('0x30')][_0xb20a('0x4a')](_0x1e2f80[_0xb20a('0x4b')],{})[_0xb20a('0x28')](respondWithResult(_0x457f4d,0xc9))[_0xb20a('0x4c')](handleError(_0x457f4d,null));};exports[_0xb20a('0x26')]=function(_0x30ea2d,_0x1870c5){if(_0x30ea2d['body']['id']){delete _0x30ea2d['body']['id'];}return db[_0xb20a('0x30')][_0xb20a('0x49')]({'where':{'id':_0x30ea2d[_0xb20a('0x45')]['id']}})['then'](handleEntityNotFound(_0x1870c5,null))[_0xb20a('0x28')](saveUpdates(_0x30ea2d[_0xb20a('0x4b')],null))[_0xb20a('0x28')](respondWithResult(_0x1870c5,null))[_0xb20a('0x4c')](handleError(_0x1870c5,null));};exports[_0xb20a('0x27')]=function(_0x3da92f,_0xc47c7c){return db[_0xb20a('0x30')][_0xb20a('0x49')]({'where':{'id':_0x3da92f['params']['id']}})['then'](handleEntityNotFound(_0xc47c7c,null))[_0xb20a('0x28')](removeEntity(_0xc47c7c,null))[_0xb20a('0x4c')](handleError(_0xc47c7c,null));};exports[_0xb20a('0x4d')]=function(_0x3b5ea4,_0x5dedb6,_0x340f0e){var _0x200f65={};var _0x14b4bc={};var _0x58330f;var _0x24a3fe;return db[_0xb20a('0x30')][_0xb20a('0x4e')]({'where':{'id':_0x3b5ea4[_0xb20a('0x45')]['id']}})[_0xb20a('0x28')](handleEntityNotFound(_0x5dedb6,null))[_0xb20a('0x28')](function(_0x331d8a){if(_0x331d8a){_0x58330f=_0x331d8a;_0x14b4bc[_0xb20a('0x34')]=_[_0xb20a('0x46')](db[_0xb20a('0x4f')][_0xb20a('0x31')]);_0x14b4bc[_0xb20a('0x35')]=_['keys'](_0x3b5ea4[_0xb20a('0x35')]);_0x14b4bc[_0xb20a('0x3d')]=_[_0xb20a('0x36')](_0x14b4bc[_0xb20a('0x34')],_0x14b4bc[_0xb20a('0x35')]);_0x200f65['attributes']=_[_0xb20a('0x36')](_0x14b4bc[_0xb20a('0x34')],qs[_0xb20a('0x38')](_0x3b5ea4[_0xb20a('0x35')][_0xb20a('0x38')]));_0x200f65['attributes']=_0x200f65[_0xb20a('0x37')][_0xb20a('0x39')]?_0x200f65['attributes']:_0x14b4bc[_0xb20a('0x34')];_0x200f65['order']=qs[_0xb20a('0x3b')](_0x3b5ea4[_0xb20a('0x35')][_0xb20a('0x3b')]);_0x200f65[_0xb20a('0x3c')]=qs[_0xb20a('0x3d')](_[_0xb20a('0x50')](_0x3b5ea4['query'],_0x14b4bc[_0xb20a('0x3d')]));if(_0x3b5ea4[_0xb20a('0x35')][_0xb20a('0x3e')]){_0x200f65['where']=_['merge'](_0x200f65[_0xb20a('0x3c')],{'$or':_['map'](_0x200f65[_0xb20a('0x37')],function(_0x1e6d8b){var _0x2f904c={};_0x2f904c[_0x1e6d8b]={'$like':'%'+_0x3b5ea4['query'][_0xb20a('0x3e')]+'%'};return _0x2f904c;})});}_0x200f65=_[_0xb20a('0x3f')]({},_0x200f65,_0x3b5ea4[_0xb20a('0x48')]);return _0x58330f['getConfigurations'](_0x200f65);}})[_0xb20a('0x28')](function(_0x45002e){if(_0x45002e){_0x24a3fe=_0x45002e[_0xb20a('0x39')];if(!_0x3b5ea4[_0xb20a('0x35')][_0xb20a('0x51')](_0xb20a('0x52'))){_0x200f65[_0xb20a('0x20')]=qs[_0xb20a('0x20')](_0x3b5ea4['query'][_0xb20a('0x20')]);_0x200f65[_0xb20a('0x22')]=qs[_0xb20a('0x22')](_0x3b5ea4[_0xb20a('0x35')]['offset']);}return _0x58330f[_0xb20a('0x4d')](_0x200f65);}})[_0xb20a('0x28')](function(_0x1d32ef){if(_0x1d32ef){return _0x1d32ef?{'count':_0x24a3fe,'rows':_0x1d32ef}:null;}})['then'](respondWithResult(_0x5dedb6,null))['catch'](handleError(_0x5dedb6,null));};exports[_0xb20a('0x53')]=function(_0xdf7ff9,_0x320ca7,_0x38054a){if(_0xdf7ff9[_0xb20a('0x4b')]['id']){delete _0xdf7ff9[_0xb20a('0x4b')]['id'];}return db[_0xb20a('0x30')]['findOne']({'where':{'id':_0xdf7ff9[_0xb20a('0x45')]['id']}})[_0xb20a('0x28')](handleEntityNotFound(_0x320ca7,null))['then'](function(_0x4530bb){if(_0x4530bb){_0xdf7ff9[_0xb20a('0x4b')][_0xb20a('0x54')]=_0x4530bb['id'];_0xdf7ff9[_0xb20a('0x4b')]['Subjects']=integrations['getSubjects'](_0xdf7ff9[_0xb20a('0x4b')][_0xb20a('0x55')],_0xdf7ff9['body']['type']);_0xdf7ff9['body'][_0xb20a('0x56')]=integrations[_0xb20a('0x57')](_0xdf7ff9[_0xb20a('0x4b')][_0xb20a('0x55')],_0xdf7ff9[_0xb20a('0x4b')][_0xb20a('0x33')]);return db[_0xb20a('0x4f')][_0xb20a('0x4a')](_0xdf7ff9[_0xb20a('0x4b')],{'include':[{'model':db[_0xb20a('0x58')],'as':_0xb20a('0x59')},{'model':db[_0xb20a('0x58')],'as':'Descriptions'}]});}return null;})[_0xb20a('0x28')](respondWithResult(_0x320ca7,null))['catch'](handleError(_0x320ca7,null));};exports[_0xb20a('0x5a')]=function(_0x2051bb,_0x5b1be5,_0x4867b4){var _0x58162f=[_0xb20a('0x5b'),'hold_reason',_0xb20a('0x5c'),_0xb20a('0x5d'),'close_code',_0xb20a('0x5e'),_0xb20a('0x5f'),'severity',_0xb20a('0x60')];var _0x462302=[_0xb20a('0x61'),'made_sla',_0xb20a('0x62'),'watch_list','upon_reject',_0xb20a('0x63'),_0xb20a('0x64'),_0xb20a('0x65'),'approval_history',_0xb20a('0x66'),_0xb20a('0x67'),_0xb20a('0x68'),_0xb20a('0x69'),_0xb20a('0x6a'),'sys_created_on',_0xb20a('0x6b'),'state',_0xb20a('0x6c'),'knowledge',_0xb20a('0x3a'),_0xb20a('0x6d'),'closed_at',_0xb20a('0x6e'),_0xb20a('0x6f'),_0xb20a('0x70'),'active','work_notes_list',_0xb20a('0x71'),_0xb20a('0x72'),'sys_domain_path',_0xb20a('0x73'),'time_worked',_0xb20a('0x74'),_0xb20a('0x75'),_0xb20a('0x76'),_0xb20a('0x77'),'work_end','reopened_time',_0xb20a('0x78'),_0xb20a('0x79'),_0xb20a('0x7a'),'subcategory',_0xb20a('0x7b'),'short_description',_0xb20a('0x7c'),_0xb20a('0x7d'),_0xb20a('0x7e'),_0xb20a('0x7f'),_0xb20a('0x80'),_0xb20a('0x81'),_0xb20a('0x82'),_0xb20a('0x83'),_0xb20a('0x84'),'notify',_0xb20a('0x85'),_0xb20a('0x86'),_0xb20a('0x87'),'follow_up',_0xb20a('0x88'),'sys_id',_0xb20a('0x89'),_0xb20a('0x8a'),_0xb20a('0x5f'),_0xb20a('0x8b'),'problem_id',_0xb20a('0x8c'),_0xb20a('0x8d'),_0xb20a('0x8e'),'assigned_to',_0xb20a('0x8f'),'comments','sla_due',_0xb20a('0x90'),'comments_and_work_notes','due_date',_0xb20a('0x91'),_0xb20a('0x92'),_0xb20a('0x93'),'escalation',_0xb20a('0x94'),_0xb20a('0x95'),'location',_0xb20a('0x60')];var _0x100ebc='';var _0x1fa74d='';var _0x218cee=[];var _0xaa8859='';var _0x18de48='';var _0xf03502=[];var _0x20c7d5='';var _0x36ca23='';var _0x5740be={};var _0x53fced='';return db[_0xb20a('0x30')]['findOne']({'where':{'id':_0x2051bb['params']['id']},'attributes':['id',_0xb20a('0x96'),_0xb20a('0x97'),'email',_0xb20a('0x98'),_0xb20a('0x99')]})[_0xb20a('0x28')](handleEntityNotFound(_0x5b1be5,null))[_0xb20a('0x28')](function(_0x4764e9){if(_0x4764e9){_0x53fced=_0x4764e9[_0xb20a('0x98')];var _0x1a3834=_0x53fced[_0xb20a('0x9a')](-0x1);if(_0x1a3834==='/'){_0x53fced=_0x53fced[_0xb20a('0x9b')](0x0,_0x53fced[_0xb20a('0x9c')](_0x1a3834));}_0x36ca23=util['format'](_0xb20a('0x9d'),_0x53fced);_0x20c7d5=util[_0xb20a('0x9e')]('%s/api/now/table/',_0x53fced);_0x5740be={'user':_0x4764e9[_0xb20a('0x96')],'pass':_0x4764e9[_0xb20a('0x97')]};var _0x9d38ea={'method':_0xb20a('0x9f'),'uri':_0x36ca23+_0xb20a('0xa0'),'auth':_0x5740be,'json':!![]};return rp(_0x9d38ea);}})[_0xb20a('0x28')](function(_0x4f0f3a){if(_0x4f0f3a[_0xb20a('0xa1')][_0xb20a('0x39')]>0x0){_0x100ebc=_0x4f0f3a[_0xb20a('0xa1')];}console[_0xb20a('0xa2')](_0xb20a('0xa3'),_0x100ebc);_0xf03502=[];_0x1fa74d=Object[_0xb20a('0xa4')]([],_0x100ebc);_[_0xb20a('0xa5')](_0x1fa74d,function(_0x158887){return!_0x58162f[_0xb20a('0xa6')](_0x158887[_0xb20a('0x2c')]);});_0x1fa74d[_0xb20a('0xa7')](function(_0x5681cb){var _0x4752ee=createFieldObject(_0x20c7d5,_0x5740be,_0x5681cb[_0xb20a('0xa8')],_0x5681cb[_0xb20a('0x2c')],_0x5681cb[_0xb20a('0xa9')],![]);_0xf03502[_0xb20a('0xaa')](_0x4752ee);});return Promise[_0xb20a('0xab')](_0xf03502);})[_0xb20a('0x28')](function(_0x23f411){_0x218cee=_0x23f411;_0xaa8859=Object['assign']([],_0x100ebc);console[_0xb20a('0xa2')](_0xb20a('0xac'),_0x100ebc);_[_0xb20a('0xa5')](_0xaa8859,function(_0x1c0b65){return _0x462302[_0xb20a('0xa6')](_0x1c0b65[_0xb20a('0x2c')]);});console[_0xb20a('0xa2')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0xaa8859);_0xf03502=[];_0xaa8859[_0xb20a('0xa7')](function(_0x16e2dc){var _0x4ddcbe=createFieldObject(_0x20c7d5,_0x5740be,_0x16e2dc['internalType'],_0x16e2dc[_0xb20a('0x2c')],_0x16e2dc[_0xb20a('0xa9')],!![]);_0xf03502[_0xb20a('0xaa')](_0x4ddcbe);});return Promise['all'](_0xf03502);})['then'](function(_0x5b9902){_0x18de48=_0x5b9902;var _0x487a43=_0x218cee[_0xb20a('0xad')](_0x18de48);return{'count':_0x487a43[_0xb20a('0x39')],'rows':_0x487a43};})[_0xb20a('0x28')](respondWithResult(_0x5b1be5,null))[_0xb20a('0x4c')](function(_0x1c9a64){console[_0xb20a('0xa2')](_0xb20a('0xae')+_0x1c9a64);var _0x36d9ab=_0x2051bb[_0xb20a('0x35')][_0xb20a('0xaf')]?0x1f4:_0x1c9a64['statusCode']||0x1f4;logger[_0xb20a('0x2a')](_0x1c9a64[_0xb20a('0x2b')]);delete _0x1c9a64[_0xb20a('0x2c')];if(_0x36d9ab===0x191){_0x36d9ab=0x190;}_0x5b1be5['status'](_0x36d9ab)[_0xb20a('0x2d')](_0x2051bb[_0xb20a('0x35')][_0xb20a('0xaf')]?{'message':'Wrong\x20credentials','statusCode':_0x1c9a64['statusCode']}:_0x1c9a64);});};function createFieldObject(_0x267542,_0x14f47f,_0x9ffe82,_0x35da77,_0x391d4d,_0x23ac67){return new Promise(function(_0x4e2b06,_0x2a7720){var _0x15d86f={'id':_0x35da77,'name':_0x391d4d,'custom':_0x23ac67};if(_0x9ffe82===_0xb20a('0xb0')){_0x15d86f['options']=[{'name':'True','value':_0xb20a('0xb1')},{'name':'False','value':_0xb20a('0xb2')}];_0x4e2b06(_0x15d86f);}else{var _0x4d9d55={'method':'GET','uri':_0x267542+_0xb20a('0xb3')+_0x35da77,'auth':_0x14f47f,'json':!![]};return rp(_0x4d9d55)[_0xb20a('0x28')](function(_0x29f0f7){var _0x1f6b99=[];if(_0x29f0f7[_0xb20a('0xa1')][_0xb20a('0x39')]>0x0){_0x29f0f7[_0xb20a('0xa1')]['forEach'](function(_0x45e933){if(_0x45e933[_0xb20a('0xb4')]===_0xb20a('0xb2')){var _0x1c18b5={'name':_0x45e933[_0xb20a('0xa9')],'value':_0x45e933['value']};_0x1f6b99[_0xb20a('0xaa')](_0x1c18b5);}});}_0x15d86f['options']=_0x1f6b99;if(_0x15d86f[_0xb20a('0x48')][_0xb20a('0x39')]>0x0){_0x4e2b06(_0x15d86f);}else{if(_0x23ac67==![]){_0x4e2b06();}else{_0x4e2b06(_0x15d86f);}}});}});} \ No newline at end of file +var _0x2980=['sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','severity','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','remoteUri','serverUrl','lastIndexOf','format','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','statusCode','error','boolean','True','False','inactive','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','ServicenowAccount','fieldName','type','model','query','keys','intersection','attributes','fields','length','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','findOne','order','pick','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowConfiguration','create','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','category','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_domain','state','sys_created_by','calendar_stc','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','rfc','time_worked','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','close_notes','closed_by','follow_up','parent_incident'];(function(_0x106b21,_0x22cefc){var _0x5b079f=function(_0x5b99aa){while(--_0x5b99aa){_0x106b21['push'](_0x106b21['shift']());}};_0x5b079f(++_0x22cefc);}(_0x2980,0x19a));var _0x0298=function(_0x4b3303,_0x9107f3){_0x4b3303=_0x4b3303-0x0;var _0x535f64=_0x2980[_0x4b3303];return _0x535f64;};'use strict';var emlformat=require(_0x0298('0x0'));var rimraf=require(_0x0298('0x1'));var zipdir=require(_0x0298('0x2'));var jsonpatch=require(_0x0298('0x3'));var rp=require(_0x0298('0x4'));var moment=require(_0x0298('0x5'));var BPromise=require(_0x0298('0x6'));var Mustache=require(_0x0298('0x7'));var util=require(_0x0298('0x8'));var path=require(_0x0298('0x9'));var sox=require(_0x0298('0xa'));var csv=require(_0x0298('0xb'));var ejs=require(_0x0298('0xc'));var fs=require('fs');var fs_extra=require(_0x0298('0xd'));var _=require('lodash');var squel=require(_0x0298('0xe'));var crypto=require(_0x0298('0xf'));var jsforce=require(_0x0298('0x10'));var deskjs=require(_0x0298('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0298('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0298('0x13'));var as=require(_0x0298('0x14'));var hardwareService=require(_0x0298('0x15'));var logger=require(_0x0298('0x16'))(_0x0298('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0298('0x18'));var db=require(_0x0298('0x19'))['db'];var integrations=require(_0x0298('0x1a'));function respondWithStatusCode(_0x5f0f0a,_0x4498b1){_0x4498b1=_0x4498b1||0xcc;return function(_0x2ab8ca){if(_0x2ab8ca){return _0x5f0f0a['sendStatus'](_0x4498b1);}return _0x5f0f0a['status'](_0x4498b1)['end']();};}function respondWithResult(_0x494e88,_0x501f2c){_0x501f2c=_0x501f2c||0xc8;return function(_0x1b5ac2){if(_0x1b5ac2){return _0x494e88[_0x0298('0x1b')](_0x501f2c)[_0x0298('0x1c')](_0x1b5ac2);}};}function respondWithFilteredResult(_0x4b7646,_0x478ed4){return function(_0x52bb97){if(_0x52bb97){var _0x5c1db7=typeof _0x478ed4[_0x0298('0x1d')]===_0x0298('0x1e')&&typeof _0x478ed4[_0x0298('0x1f')]===_0x0298('0x1e');var _0xa8bf00=_0x52bb97[_0x0298('0x20')];var _0x55c089=_0x5c1db7?0x0:_0x478ed4[_0x0298('0x1d')];var _0x2d0183=_0x5c1db7?_0x52bb97[_0x0298('0x20')]:_0x478ed4[_0x0298('0x1d')]+_0x478ed4['limit'];var _0x4cb518;if(_0x2d0183>=_0xa8bf00){_0x2d0183=_0xa8bf00;_0x4cb518=0xc8;}else{_0x4cb518=0xce;}_0x4b7646[_0x0298('0x1b')](_0x4cb518);return _0x4b7646[_0x0298('0x21')](_0x0298('0x22'),_0x55c089+'-'+_0x2d0183+'/'+_0xa8bf00)[_0x0298('0x1c')](_0x52bb97);}return null;};}function patchUpdates(_0x167098){return function(_0x5ecad6){try{jsonpatch[_0x0298('0x23')](_0x5ecad6,_0x167098,!![]);}catch(_0x56b79d){return BPromise[_0x0298('0x24')](_0x56b79d);}return _0x5ecad6[_0x0298('0x25')]();};}function saveUpdates(_0x53adcf,_0x2456a6){return function(_0x1b20ab){if(_0x1b20ab){return _0x1b20ab[_0x0298('0x26')](_0x53adcf)[_0x0298('0x27')](function(_0x41ce7d){return _0x41ce7d;});}return null;};}function removeEntity(_0x139448,_0x19df15){return function(_0x4f3413){if(_0x4f3413){return _0x4f3413[_0x0298('0x28')]()[_0x0298('0x27')](function(){_0x139448[_0x0298('0x1b')](0xcc)[_0x0298('0x29')]();});}};}function handleEntityNotFound(_0x167fc5,_0x42349e){return function(_0x3acee5){if(!_0x3acee5){_0x167fc5[_0x0298('0x2a')](0x194);}return _0x3acee5;};}function handleError(_0x37ef26,_0x1b476d){_0x1b476d=_0x1b476d||0x1f4;return function(_0x128ce0){logger['error'](_0x128ce0[_0x0298('0x2b')]);if(_0x128ce0[_0x0298('0x2c')]){delete _0x128ce0[_0x0298('0x2c')];}_0x37ef26['status'](_0x1b476d)[_0x0298('0x2d')](_0x128ce0);};}exports[_0x0298('0x2e')]=function(_0x178a3d,_0x5d64a8){var _0x226878={},_0xf8df55={},_0x36f3d2={'count':0x0,'rows':[]};var _0x4cd0f1=_[_0x0298('0x2f')](db[_0x0298('0x30')]['rawAttributes'],function(_0x1b9e1b){return{'name':_0x1b9e1b[_0x0298('0x31')],'type':_0x1b9e1b[_0x0298('0x32')]['key']};});_0xf8df55[_0x0298('0x33')]=_['map'](_0x4cd0f1,_0x0298('0x2c'));_0xf8df55[_0x0298('0x34')]=_[_0x0298('0x35')](_0x178a3d[_0x0298('0x34')]);_0xf8df55['filters']=_[_0x0298('0x36')](_0xf8df55[_0x0298('0x33')],_0xf8df55[_0x0298('0x34')]);_0x226878[_0x0298('0x37')]=_[_0x0298('0x36')](_0xf8df55[_0x0298('0x33')],qs[_0x0298('0x38')](_0x178a3d[_0x0298('0x34')][_0x0298('0x38')]));_0x226878[_0x0298('0x37')]=_0x226878['attributes'][_0x0298('0x39')]?_0x226878['attributes']:_0xf8df55[_0x0298('0x33')];if(!_0x178a3d['query']['hasOwnProperty']('nolimit')){_0x226878[_0x0298('0x1f')]=qs[_0x0298('0x1f')](_0x178a3d[_0x0298('0x34')]['limit']);_0x226878['offset']=qs[_0x0298('0x1d')](_0x178a3d[_0x0298('0x34')]['offset']);}_0x226878['order']=qs['sort'](_0x178a3d[_0x0298('0x34')][_0x0298('0x3a')]);_0x226878[_0x0298('0x3b')]=qs[_0x0298('0x3c')](_['pick'](_0x178a3d['query'],_0xf8df55['filters']),_0x4cd0f1);if(_0x178a3d['query'][_0x0298('0x3d')]){_0x226878['where']=_[_0x0298('0x3e')](_0x226878[_0x0298('0x3b')],{'$or':_[_0x0298('0x2f')](_0x4cd0f1,function(_0x5b6ca7){if(_0x5b6ca7[_0x0298('0x32')]!==_0x0298('0x3f')){var _0x3daffa={};_0x3daffa[_0x5b6ca7[_0x0298('0x2c')]]={'$like':'%'+_0x178a3d[_0x0298('0x34')][_0x0298('0x3d')]+'%'};return _0x3daffa;}})});}_0x226878=_[_0x0298('0x3e')]({},_0x226878,_0x178a3d[_0x0298('0x40')]);var _0xdb46f4={'where':_0x226878[_0x0298('0x3b')]};return db[_0x0298('0x30')][_0x0298('0x20')](_0xdb46f4)[_0x0298('0x27')](function(_0x561e9d){_0x36f3d2[_0x0298('0x20')]=_0x561e9d;if(_0x178a3d[_0x0298('0x34')][_0x0298('0x41')]){_0x226878[_0x0298('0x42')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x0298('0x43')](_0x226878);})[_0x0298('0x27')](function(_0x349301){_0x36f3d2[_0x0298('0x44')]=_0x349301;return _0x36f3d2;})[_0x0298('0x27')](respondWithFilteredResult(_0x5d64a8,_0x226878))[_0x0298('0x45')](handleError(_0x5d64a8,null));};exports[_0x0298('0x46')]=function(_0x53e296,_0x2ab413){var _0x191485={'raw':![],'where':{'id':_0x53e296[_0x0298('0x47')]['id']}},_0x1c405f={};_0x1c405f['model']=_[_0x0298('0x35')](db['ServicenowAccount'][_0x0298('0x48')]);_0x1c405f[_0x0298('0x34')]=_[_0x0298('0x35')](_0x53e296[_0x0298('0x34')]);_0x1c405f[_0x0298('0x3c')]=_[_0x0298('0x36')](_0x1c405f[_0x0298('0x33')],_0x1c405f[_0x0298('0x34')]);_0x191485[_0x0298('0x37')]=_[_0x0298('0x36')](_0x1c405f[_0x0298('0x33')],qs[_0x0298('0x38')](_0x53e296[_0x0298('0x34')][_0x0298('0x38')]));_0x191485[_0x0298('0x37')]=_0x191485['attributes'][_0x0298('0x39')]?_0x191485[_0x0298('0x37')]:_0x1c405f[_0x0298('0x33')];if(_0x53e296[_0x0298('0x34')][_0x0298('0x41')]){_0x191485[_0x0298('0x42')]=[{'all':!![]}];}_0x191485=_[_0x0298('0x3e')]({},_0x191485,_0x53e296[_0x0298('0x40')]);return db['ServicenowAccount'][_0x0298('0x49')](_0x191485)[_0x0298('0x27')](handleEntityNotFound(_0x2ab413,null))[_0x0298('0x27')](respondWithResult(_0x2ab413,null))['catch'](handleError(_0x2ab413,null));};exports['create']=function(_0x2a8e41,_0xde5ee9){return db[_0x0298('0x30')]['create'](_0x2a8e41[_0x0298('0x4a')],{})[_0x0298('0x27')](respondWithResult(_0xde5ee9,0xc9))[_0x0298('0x45')](handleError(_0xde5ee9,null));};exports[_0x0298('0x26')]=function(_0x20d470,_0x1fef9e){if(_0x20d470[_0x0298('0x4a')]['id']){delete _0x20d470['body']['id'];}return db[_0x0298('0x30')]['find']({'where':{'id':_0x20d470['params']['id']}})['then'](handleEntityNotFound(_0x1fef9e,null))[_0x0298('0x27')](saveUpdates(_0x20d470[_0x0298('0x4a')],null))['then'](respondWithResult(_0x1fef9e,null))[_0x0298('0x45')](handleError(_0x1fef9e,null));};exports[_0x0298('0x28')]=function(_0x5e70d8,_0x8e5c29){return db['ServicenowAccount'][_0x0298('0x49')]({'where':{'id':_0x5e70d8[_0x0298('0x47')]['id']}})[_0x0298('0x27')](handleEntityNotFound(_0x8e5c29,null))[_0x0298('0x27')](removeEntity(_0x8e5c29,null))[_0x0298('0x45')](handleError(_0x8e5c29,null));};exports['getConfigurations']=function(_0x4799bd,_0x5ad754,_0x1324f3){var _0x3bfd8f={};var _0x15c562={};var _0x3afb6d;var _0x2bd06;return db[_0x0298('0x30')][_0x0298('0x4b')]({'where':{'id':_0x4799bd[_0x0298('0x47')]['id']}})[_0x0298('0x27')](handleEntityNotFound(_0x5ad754,null))['then'](function(_0x498b42){if(_0x498b42){_0x3afb6d=_0x498b42;_0x15c562['model']=_[_0x0298('0x35')](db['ServicenowConfiguration'][_0x0298('0x48')]);_0x15c562['query']=_[_0x0298('0x35')](_0x4799bd['query']);_0x15c562[_0x0298('0x3c')]=_[_0x0298('0x36')](_0x15c562[_0x0298('0x33')],_0x15c562[_0x0298('0x34')]);_0x3bfd8f[_0x0298('0x37')]=_[_0x0298('0x36')](_0x15c562[_0x0298('0x33')],qs[_0x0298('0x38')](_0x4799bd[_0x0298('0x34')][_0x0298('0x38')]));_0x3bfd8f[_0x0298('0x37')]=_0x3bfd8f[_0x0298('0x37')][_0x0298('0x39')]?_0x3bfd8f[_0x0298('0x37')]:_0x15c562['model'];_0x3bfd8f[_0x0298('0x4c')]=qs[_0x0298('0x3a')](_0x4799bd[_0x0298('0x34')]['sort']);_0x3bfd8f[_0x0298('0x3b')]=qs[_0x0298('0x3c')](_[_0x0298('0x4d')](_0x4799bd[_0x0298('0x34')],_0x15c562[_0x0298('0x3c')]));if(_0x4799bd[_0x0298('0x34')]['filter']){_0x3bfd8f[_0x0298('0x3b')]=_[_0x0298('0x3e')](_0x3bfd8f['where'],{'$or':_[_0x0298('0x2f')](_0x3bfd8f[_0x0298('0x37')],function(_0x25156a){var _0x24fa03={};_0x24fa03[_0x25156a]={'$like':'%'+_0x4799bd[_0x0298('0x34')][_0x0298('0x3d')]+'%'};return _0x24fa03;})});}_0x3bfd8f=_[_0x0298('0x3e')]({},_0x3bfd8f,_0x4799bd[_0x0298('0x40')]);return _0x3afb6d[_0x0298('0x4e')](_0x3bfd8f);}})[_0x0298('0x27')](function(_0x433c9e){if(_0x433c9e){_0x2bd06=_0x433c9e['length'];if(!_0x4799bd[_0x0298('0x34')]['hasOwnProperty'](_0x0298('0x4f'))){_0x3bfd8f[_0x0298('0x1f')]=qs[_0x0298('0x1f')](_0x4799bd[_0x0298('0x34')]['limit']);_0x3bfd8f['offset']=qs['offset'](_0x4799bd[_0x0298('0x34')]['offset']);}return _0x3afb6d['getConfigurations'](_0x3bfd8f);}})['then'](function(_0x425296){if(_0x425296){return _0x425296?{'count':_0x2bd06,'rows':_0x425296}:null;}})[_0x0298('0x27')](respondWithResult(_0x5ad754,null))['catch'](handleError(_0x5ad754,null));};exports[_0x0298('0x50')]=function(_0x1fc4fd,_0x4e0ca2,_0x195a37){if(_0x1fc4fd[_0x0298('0x4a')]['id']){delete _0x1fc4fd[_0x0298('0x4a')]['id'];}return db['ServicenowAccount'][_0x0298('0x4b')]({'where':{'id':_0x1fc4fd[_0x0298('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e0ca2,null))['then'](function(_0x9cdcdf){if(_0x9cdcdf){_0x1fc4fd[_0x0298('0x4a')][_0x0298('0x51')]=_0x9cdcdf['id'];_0x1fc4fd['body'][_0x0298('0x52')]=integrations[_0x0298('0x53')](_0x1fc4fd[_0x0298('0x4a')]['channel'],_0x1fc4fd[_0x0298('0x4a')]['type']);_0x1fc4fd['body'][_0x0298('0x54')]=integrations[_0x0298('0x55')](_0x1fc4fd[_0x0298('0x4a')][_0x0298('0x56')],_0x1fc4fd[_0x0298('0x4a')][_0x0298('0x32')]);return db[_0x0298('0x57')][_0x0298('0x58')](_0x1fc4fd[_0x0298('0x4a')],{'include':[{'model':db[_0x0298('0x59')],'as':_0x0298('0x52')},{'model':db[_0x0298('0x59')],'as':_0x0298('0x54')}]});}return null;})[_0x0298('0x27')](respondWithResult(_0x4e0ca2,null))['catch'](handleError(_0x4e0ca2,null));};exports[_0x0298('0x5a')]=function(_0x47ade7,_0x1386e4,_0x37b128){var _0x440a92=['made_sla',_0x0298('0x5b'),_0x0298('0x5c'),_0x0298('0x5d'),_0x0298('0x5e'),_0x0298('0x5f'),'incident_state','severity',_0x0298('0x60')];var _0x1495b6=['parent',_0x0298('0x61'),_0x0298('0x62'),_0x0298('0x63'),_0x0298('0x64'),_0x0298('0x65'),_0x0298('0x66'),_0x0298('0x5b'),'approval_history',_0x0298('0x67'),_0x0298('0x68'),_0x0298('0x69'),'opened_by',_0x0298('0x6a'),'sys_created_on',_0x0298('0x6b'),_0x0298('0x6c'),_0x0298('0x6d'),_0x0298('0x5c'),'order',_0x0298('0x6e'),'closed_at','cmdb_ci',_0x0298('0x6f'),_0x0298('0x70'),'active',_0x0298('0x71'),_0x0298('0x72'),'priority',_0x0298('0x73'),_0x0298('0x74'),_0x0298('0x75'),'expected_start','opened_at',_0x0298('0x76'),'group_list',_0x0298('0x77'),_0x0298('0x78'),_0x0298('0x79'),_0x0298('0x7a'),_0x0298('0x7b'),_0x0298('0x5d'),_0x0298('0x7c'),_0x0298('0x7d'),_0x0298('0x5e'),_0x0298('0x7e'),'delivery_task',_0x0298('0x7f'),_0x0298('0x80'),_0x0298('0x81'),_0x0298('0x82'),'description',_0x0298('0x83'),_0x0298('0x5f'),'sys_class_name',_0x0298('0x84'),_0x0298('0x85'),_0x0298('0x86'),_0x0298('0x87'),_0x0298('0x88'),_0x0298('0x89'),'reopened_by','incident_state',_0x0298('0x8a'),_0x0298('0x8b'),_0x0298('0x8c'),_0x0298('0x8d'),_0x0298('0x8e'),'assigned_to',_0x0298('0x8f'),'comments',_0x0298('0x90'),_0x0298('0x91'),_0x0298('0x92'),'due_date',_0x0298('0x93'),_0x0298('0x94'),_0x0298('0x95'),_0x0298('0x96'),_0x0298('0x97'),_0x0298('0x98'),'location','category'];var _0x437161='';var _0x3222ae='';var _0x56d87d=[];var _0x119c4b='';var _0x16c9ee='';var _0x3865cc=[];var _0x1f7211='';var _0x19bb29='';var _0x81092f={};var _0x26beee='';return db[_0x0298('0x30')][_0x0298('0x4b')]({'where':{'id':_0x47ade7['params']['id']},'attributes':['id',_0x0298('0x99'),'password','email',_0x0298('0x9a'),_0x0298('0x9b')]})['then'](handleEntityNotFound(_0x1386e4,null))[_0x0298('0x27')](function(_0x4889e7){if(_0x4889e7){_0x26beee=_0x4889e7[_0x0298('0x9a')];var _0x233385=_0x26beee['slice'](-0x1);if(_0x233385==='/'){_0x26beee=_0x26beee['substring'](0x0,_0x26beee[_0x0298('0x9c')](_0x233385));}_0x19bb29=util[_0x0298('0x9d')]('%s/api/now/doc/table/schema/',_0x26beee);_0x1f7211=util[_0x0298('0x9d')]('%s/api/now/table/',_0x26beee);_0x81092f={'user':_0x4889e7[_0x0298('0x99')],'pass':_0x4889e7[_0x0298('0x9e')]};var _0x5ea1c6={'method':_0x0298('0x9f'),'uri':_0x19bb29+_0x0298('0xa0'),'auth':_0x81092f,'json':!![]};return rp(_0x5ea1c6);}})[_0x0298('0x27')](function(_0x52f08c){if(_0x52f08c[_0x0298('0xa1')]['length']>0x0){_0x437161=_0x52f08c[_0x0298('0xa1')];}console[_0x0298('0xa2')](_0x0298('0xa3'),_0x437161);_0x3865cc=[];_0x3222ae=Object['assign']([],_0x437161);_[_0x0298('0xa4')](_0x3222ae,function(_0x3bb699){return!_0x440a92[_0x0298('0xa5')](_0x3bb699[_0x0298('0x2c')]);});_0x3222ae[_0x0298('0xa6')](function(_0x2b4b24){var _0x122f41=createFieldObject(_0x1f7211,_0x81092f,_0x2b4b24[_0x0298('0xa7')],_0x2b4b24['name'],_0x2b4b24[_0x0298('0xa8')],![]);_0x3865cc[_0x0298('0xa9')](_0x122f41);});return Promise['all'](_0x3865cc);})['then'](function(_0x478669){_0x56d87d=_0x478669;_0x119c4b=Object[_0x0298('0xaa')]([],_0x437161);console[_0x0298('0xa2')](_0x0298('0xab'),_0x437161);_[_0x0298('0xa4')](_0x119c4b,function(_0x3c1fe7){return _0x1495b6[_0x0298('0xa5')](_0x3c1fe7[_0x0298('0x2c')]);});console[_0x0298('0xa2')](_0x0298('0xac'),_0x119c4b);_0x3865cc=[];_0x119c4b[_0x0298('0xa6')](function(_0x1e468d){var _0x5847cf=createFieldObject(_0x1f7211,_0x81092f,_0x1e468d[_0x0298('0xa7')],_0x1e468d[_0x0298('0x2c')],_0x1e468d[_0x0298('0xa8')],!![]);_0x3865cc[_0x0298('0xa9')](_0x5847cf);});return Promise['all'](_0x3865cc);})[_0x0298('0x27')](function(_0xf5133e){_0x16c9ee=_0xf5133e;var _0x5f0259=_0x56d87d[_0x0298('0xad')](_0x16c9ee);return{'count':_0x5f0259[_0x0298('0x39')],'rows':_0x5f0259};})[_0x0298('0x27')](respondWithResult(_0x1386e4,null))[_0x0298('0x45')](function(_0x55de93){console[_0x0298('0xa2')]('ServiceNow\x20error:\x20'+_0x55de93);var _0x50f892=_0x47ade7[_0x0298('0x34')]['test']?0x1f4:_0x55de93[_0x0298('0xae')]||0x1f4;logger[_0x0298('0xaf')](_0x55de93['stack']);delete _0x55de93[_0x0298('0x2c')];if(_0x50f892===0x191){_0x50f892=0x190;}_0x1386e4[_0x0298('0x1b')](_0x50f892)['send'](_0x47ade7[_0x0298('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x55de93[_0x0298('0xae')]}:_0x55de93);});};function createFieldObject(_0x457e31,_0x2ad44d,_0x5c7042,_0x3804ef,_0x178a1a,_0x1d046e){return new Promise(function(_0x406ad9,_0x54265e){var _0x1561f4={'id':_0x3804ef,'name':_0x178a1a,'custom':_0x1d046e};if(_0x5c7042===_0x0298('0xb0')){_0x1561f4[_0x0298('0x40')]=[{'name':_0x0298('0xb1'),'value':'true'},{'name':_0x0298('0xb2'),'value':'false'}];_0x406ad9(_0x1561f4);}else{var _0x401c23={'method':_0x0298('0x9f'),'uri':_0x457e31+'sys_choice?sysparm_query=name=incident^element='+_0x3804ef,'auth':_0x2ad44d,'json':!![]};return rp(_0x401c23)[_0x0298('0x27')](function(_0x40497a){var _0x31163f=[];if(_0x40497a[_0x0298('0xa1')][_0x0298('0x39')]>0x0){_0x40497a[_0x0298('0xa1')][_0x0298('0xa6')](function(_0x38e219){if(_0x38e219[_0x0298('0xb3')]===_0x0298('0xb4')){var _0x1154cd={'name':_0x38e219[_0x0298('0xa8')],'value':_0x38e219[_0x0298('0xb5')]};_0x31163f[_0x0298('0xa9')](_0x1154cd);}});}_0x1561f4[_0x0298('0x40')]=_0x31163f;if(_0x1561f4[_0x0298('0x40')]['length']>0x0){_0x406ad9(_0x1561f4);}else{if(_0x1d046e==![]){_0x406ad9();}else{_0x406ad9(_0x1561f4);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index faa7d4b..7cd6645 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 _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x5cfd77,_0x589515){_0x5cfd77=_0x5cfd77-0x0;var _0xd55e59=_0x3f8a[_0x5cfd77];return _0xd55e59;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d17=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x45eaed,_0x21e3c9){var _0x5b24f6=function(_0x4a7704){while(--_0x4a7704){_0x45eaed['push'](_0x45eaed['shift']());}};_0x5b24f6(++_0x21e3c9);}(_0x5d17,0x114));var _0x75d1=function(_0x5745d2,_0x536b58){_0x5745d2=_0x5745d2-0x0;var _0xd6df54=_0x5d17[_0x5745d2];return _0xd6df54;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));var integrations=require(_0x75d1('0x8'));module['exports']=function(_0x458681,_0x116a51){return _0x458681[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 5cfa6de..1053465 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 _0x6f47=['result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowServicenowAccount','find','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x11ba32,_0x5a7ba6){var _0x296558=function(_0x53d575){while(--_0x53d575){_0x11ba32['push'](_0x11ba32['shift']());}};_0x296558(++_0x5a7ba6);}(_0x6f47,0x196));var _0x76f4=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x6f47[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x76f4('0x0'));var util=require(_0x76f4('0x1'));var moment=require(_0x76f4('0x2'));var BPromise=require(_0x76f4('0x3'));var rs=require(_0x76f4('0x4'));var fs=require('fs');var Redis=require(_0x76f4('0x5'));var db=require(_0x76f4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x7'))(_0x76f4('0x8'));var config=require(_0x76f4('0x9'));var jayson=require(_0x76f4('0xa'));var client=jayson[_0x76f4('0xb')][_0x76f4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbe56a2,_0x45a9bf,_0x58475a){return new BPromise(function(_0x342092,_0x1231d1){return client[_0x76f4('0xd')](_0xbe56a2,_0x58475a)[_0x76f4('0xe')](function(_0x461a9d){logger['info'](_0x76f4('0xf'),_0x45a9bf,_0x76f4('0x10'));logger[_0x76f4('0x11')](_0x76f4('0x12'),_0x45a9bf,_0x76f4('0x10'),JSON[_0x76f4('0x13')](_0x461a9d));if(_0x461a9d[_0x76f4('0x14')]){if(_0x461a9d['error'][_0x76f4('0x15')]===0x1f4){logger[_0x76f4('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x45a9bf,_0x461a9d[_0x76f4('0x14')][_0x76f4('0x16')]);return _0x1231d1(_0x461a9d[_0x76f4('0x14')][_0x76f4('0x16')]);}logger[_0x76f4('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x45a9bf,_0x461a9d[_0x76f4('0x14')][_0x76f4('0x16')]);return _0x342092(_0x461a9d[_0x76f4('0x14')]['message']);}else{logger['info'](_0x76f4('0xf'),_0x45a9bf,_0x76f4('0x10'));_0x342092(_0x461a9d[_0x76f4('0x17')][_0x76f4('0x16')]);}})['catch'](function(_0x21e85b){logger[_0x76f4('0x14')](_0x76f4('0xf'),_0x45a9bf,_0x21e85b);_0x1231d1(_0x21e85b);});});}exports[_0x76f4('0x18')]=function(_0x4b192a){var _0x39c03=this;return new Promise(function(_0x433fc4,_0xee2490){return db[_0x76f4('0x19')][_0x76f4('0x1a')]({'raw':_0x4b192a['options']?_0x4b192a[_0x76f4('0x1b')][_0x76f4('0x1c')]===undefined?!![]:![]:!![],'where':_0x4b192a[_0x76f4('0x1b')]?_0x4b192a['options'][_0x76f4('0x1d')]||null:null,'attributes':_0x4b192a['options']?_0x4b192a[_0x76f4('0x1b')][_0x76f4('0x1e')]||null:null,'limit':_0x4b192a[_0x76f4('0x1b')]?_0x4b192a[_0x76f4('0x1b')][_0x76f4('0x1f')]||null:null,'include':_0x4b192a[_0x76f4('0x1b')]?_0x4b192a[_0x76f4('0x1b')]['include']?_[_0x76f4('0x20')](_0x4b192a[_0x76f4('0x1b')][_0x76f4('0x21')],function(_0x46f98f){return{'model':db[_0x46f98f['model']],'as':_0x46f98f['as'],'attributes':_0x46f98f['attributes'],'include':_0x46f98f[_0x76f4('0x21')]?_[_0x76f4('0x20')](_0x46f98f[_0x76f4('0x21')],function(_0x158107){return{'model':db[_0x158107[_0x76f4('0x22')]],'as':_0x158107['as'],'attributes':_0x158107[_0x76f4('0x1e')],'include':_0x158107[_0x76f4('0x21')]?_['map'](_0x158107[_0x76f4('0x21')],function(_0x4879bb){return{'model':db[_0x4879bb[_0x76f4('0x22')]],'as':_0x4879bb['as'],'attributes':_0x4879bb[_0x76f4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x76f4('0xe')](function(_0x41c3d4){logger['info'](_0x76f4('0x18'),_0x4b192a);logger['debug']('GetServicenowAccount',_0x4b192a,JSON[_0x76f4('0x13')](_0x41c3d4));_0x433fc4(_0x41c3d4);})['catch'](function(_0x265d0d){logger[_0x76f4('0x14')]('GetServicenowAccount',_0x265d0d[_0x76f4('0x16')],_0x4b192a);_0xee2490(_0x39c03['error'](0x1f4,_0x265d0d[_0x76f4('0x16')]));});});};exports[_0x76f4('0x23')]=function(_0x1f2f6e){var _0x572ec9=this;return new Promise(function(_0x1310ee,_0x1f36b8){return db[_0x76f4('0x19')][_0x76f4('0x24')]({'raw':_0x1f2f6e[_0x76f4('0x1b')]?_0x1f2f6e[_0x76f4('0x1b')][_0x76f4('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f2f6e[_0x76f4('0x1b')]?_0x1f2f6e['options']['where']||null:null,'attributes':_0x1f2f6e['options']?_0x1f2f6e['options'][_0x76f4('0x1e')]||null:null,'include':_0x1f2f6e['options']?_0x1f2f6e['options'][_0x76f4('0x21')]?_[_0x76f4('0x20')](_0x1f2f6e[_0x76f4('0x1b')][_0x76f4('0x21')],function(_0x4bf13b){return{'model':db[_0x4bf13b[_0x76f4('0x22')]],'as':_0x4bf13b['as'],'attributes':_0x4bf13b['attributes'],'include':_0x4bf13b['include']?_[_0x76f4('0x20')](_0x4bf13b['include'],function(_0x1d49b7){return{'model':db[_0x1d49b7[_0x76f4('0x22')]],'as':_0x1d49b7['as'],'attributes':_0x1d49b7[_0x76f4('0x1e')],'include':_0x1d49b7[_0x76f4('0x21')]?_[_0x76f4('0x20')](_0x1d49b7[_0x76f4('0x21')],function(_0x273496){return{'model':db[_0x273496[_0x76f4('0x22')]],'as':_0x273496['as'],'attributes':_0x273496['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x571adf){logger[_0x76f4('0x25')](_0x76f4('0x23'),_0x1f2f6e);logger[_0x76f4('0x11')](_0x76f4('0x23'),_0x1f2f6e,JSON[_0x76f4('0x13')](_0x571adf));_0x1310ee(_0x571adf);})[_0x76f4('0x26')](function(_0x5824bb){logger[_0x76f4('0x14')](_0x76f4('0x23'),_0x5824bb[_0x76f4('0x16')],_0x1f2f6e);_0x1f36b8(_0x572ec9[_0x76f4('0x14')](0x1f4,_0x5824bb[_0x76f4('0x16')]));});});}; \ No newline at end of file +var _0xcd46=['../../config/environment','jayson/promise','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','findAll','options','attributes','limit','include','model','map','GetServicenowAccount','ShowServicenowAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4a53e7,_0x5bc92c){var _0x3aaed5=function(_0x2683a2){while(--_0x2683a2){_0x4a53e7['push'](_0x4a53e7['shift']());}};_0x3aaed5(++_0x5bc92c);}(_0xcd46,0x65));var _0x6cd4=function(_0x118323,_0x3969d6){_0x118323=_0x118323-0x0;var _0x13ba4f=_0xcd46[_0x118323];return _0x13ba4f;};'use strict';var _=require(_0x6cd4('0x0'));var util=require(_0x6cd4('0x1'));var moment=require(_0x6cd4('0x2'));var BPromise=require(_0x6cd4('0x3'));var rs=require(_0x6cd4('0x4'));var fs=require('fs');var Redis=require(_0x6cd4('0x5'));var db=require(_0x6cd4('0x6'))['db'];var utils=require(_0x6cd4('0x7'));var logger=require(_0x6cd4('0x8'))(_0x6cd4('0x9'));var config=require(_0x6cd4('0xa'));var jayson=require(_0x6cd4('0xb'));var client=jayson[_0x6cd4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4deb94,_0x1f60b8,_0x970ee2){return new BPromise(function(_0x491935,_0x11a1ed){return client[_0x6cd4('0xd')](_0x4deb94,_0x970ee2)[_0x6cd4('0xe')](function(_0x318a31){logger['info'](_0x6cd4('0xf'),_0x1f60b8,_0x6cd4('0x10'));logger['debug'](_0x6cd4('0x11'),_0x1f60b8,_0x6cd4('0x10'),JSON[_0x6cd4('0x12')](_0x318a31));if(_0x318a31['error']){if(_0x318a31['error'][_0x6cd4('0x13')]===0x1f4){logger[_0x6cd4('0x14')](_0x6cd4('0xf'),_0x1f60b8,_0x318a31[_0x6cd4('0x14')]['message']);return _0x11a1ed(_0x318a31['error'][_0x6cd4('0x15')]);}logger[_0x6cd4('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x1f60b8,_0x318a31[_0x6cd4('0x14')]['message']);return _0x491935(_0x318a31[_0x6cd4('0x14')]['message']);}else{logger[_0x6cd4('0x16')](_0x6cd4('0xf'),_0x1f60b8,_0x6cd4('0x10'));_0x491935(_0x318a31[_0x6cd4('0x17')][_0x6cd4('0x15')]);}})[_0x6cd4('0x18')](function(_0x272952){logger[_0x6cd4('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x1f60b8,_0x272952);_0x11a1ed(_0x272952);});});}exports['GetServicenowAccount']=function(_0x1c6285){var _0x255845=this;return new Promise(function(_0x1fbc41,_0x578524){return db['ServicenowAccount'][_0x6cd4('0x19')]({'raw':_0x1c6285['options']?_0x1c6285[_0x6cd4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1c6285[_0x6cd4('0x1a')]?_0x1c6285['options']['where']||null:null,'attributes':_0x1c6285[_0x6cd4('0x1a')]?_0x1c6285['options'][_0x6cd4('0x1b')]||null:null,'limit':_0x1c6285[_0x6cd4('0x1a')]?_0x1c6285[_0x6cd4('0x1a')][_0x6cd4('0x1c')]||null:null,'include':_0x1c6285[_0x6cd4('0x1a')]?_0x1c6285[_0x6cd4('0x1a')]['include']?_['map'](_0x1c6285['options'][_0x6cd4('0x1d')],function(_0xbb9c47){return{'model':db[_0xbb9c47[_0x6cd4('0x1e')]],'as':_0xbb9c47['as'],'attributes':_0xbb9c47['attributes'],'include':_0xbb9c47[_0x6cd4('0x1d')]?_[_0x6cd4('0x1f')](_0xbb9c47[_0x6cd4('0x1d')],function(_0x544949){return{'model':db[_0x544949[_0x6cd4('0x1e')]],'as':_0x544949['as'],'attributes':_0x544949[_0x6cd4('0x1b')],'include':_0x544949[_0x6cd4('0x1d')]?_[_0x6cd4('0x1f')](_0x544949[_0x6cd4('0x1d')],function(_0x406c8f){return{'model':db[_0x406c8f['model']],'as':_0x406c8f['as'],'attributes':_0x406c8f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x91706){logger[_0x6cd4('0x16')](_0x6cd4('0x20'),_0x1c6285);logger['debug'](_0x6cd4('0x20'),_0x1c6285,JSON['stringify'](_0x91706));_0x1fbc41(_0x91706);})[_0x6cd4('0x18')](function(_0x5d7e1f){logger[_0x6cd4('0x14')](_0x6cd4('0x20'),_0x5d7e1f[_0x6cd4('0x15')],_0x1c6285);_0x578524(_0x255845[_0x6cd4('0x14')](0x1f4,_0x5d7e1f[_0x6cd4('0x15')]));});});};exports[_0x6cd4('0x21')]=function(_0x1c2e05){var _0x3a2a77=this;return new Promise(function(_0x461e18,_0x575c50){return db['ServicenowAccount'][_0x6cd4('0x22')]({'raw':_0x1c2e05[_0x6cd4('0x1a')]?_0x1c2e05['options'][_0x6cd4('0x23')]===undefined?!![]:![]:!![],'where':_0x1c2e05['options']?_0x1c2e05[_0x6cd4('0x1a')][_0x6cd4('0x24')]||null:null,'attributes':_0x1c2e05[_0x6cd4('0x1a')]?_0x1c2e05[_0x6cd4('0x1a')][_0x6cd4('0x1b')]||null:null,'include':_0x1c2e05['options']?_0x1c2e05['options'][_0x6cd4('0x1d')]?_['map'](_0x1c2e05['options'][_0x6cd4('0x1d')],function(_0x2f4163){return{'model':db[_0x2f4163[_0x6cd4('0x1e')]],'as':_0x2f4163['as'],'attributes':_0x2f4163[_0x6cd4('0x1b')],'include':_0x2f4163[_0x6cd4('0x1d')]?_[_0x6cd4('0x1f')](_0x2f4163[_0x6cd4('0x1d')],function(_0x222b65){return{'model':db[_0x222b65[_0x6cd4('0x1e')]],'as':_0x222b65['as'],'attributes':_0x222b65['attributes'],'include':_0x222b65[_0x6cd4('0x1d')]?_[_0x6cd4('0x1f')](_0x222b65[_0x6cd4('0x1d')],function(_0x1c64ca){return{'model':db[_0x1c64ca[_0x6cd4('0x1e')]],'as':_0x1c64ca['as'],'attributes':_0x1c64ca['attributes']};}):[]};}):[]};}):[]:[]})[_0x6cd4('0xe')](function(_0x471175){logger[_0x6cd4('0x16')]('ShowServicenowAccount',_0x1c2e05);logger['debug'](_0x6cd4('0x21'),_0x1c2e05,JSON[_0x6cd4('0x12')](_0x471175));_0x461e18(_0x471175);})[_0x6cd4('0x18')](function(_0x3680b7){logger[_0x6cd4('0x14')](_0x6cd4('0x21'),_0x3680b7[_0x6cd4('0x15')],_0x1c2e05);_0x575c50(_0x3a2a77[_0x6cd4('0x14')](0x1f4,_0x3680b7[_0x6cd4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 20b150b..a0d0ecc 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 _0xff06=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports'];(function(_0x5a4e75,_0x12f202){var _0x5bee2f=function(_0x3aa291){while(--_0x3aa291){_0x5a4e75['push'](_0x5a4e75['shift']());}};_0x5bee2f(++_0x12f202);}(_0xff06,0x1e6));var _0x6ff0=function(_0x2e7c96,_0x27804d){_0x2e7c96=_0x2e7c96-0x0;var _0x36008e=_0xff06[_0x2e7c96];return _0x36008e;};'use strict';var multer=require(_0x6ff0('0x0'));var util=require(_0x6ff0('0x1'));var path=require(_0x6ff0('0x2'));var timeout=require(_0x6ff0('0x3'));var express=require(_0x6ff0('0x4'));var router=express[_0x6ff0('0x5')]();var fs_extra=require(_0x6ff0('0x6'));var auth=require(_0x6ff0('0x7'));var interaction=require(_0x6ff0('0x8'));var config=require(_0x6ff0('0x9'));var controller=require(_0x6ff0('0xa'));router[_0x6ff0('0xb')]('/',auth[_0x6ff0('0xc')](),controller[_0x6ff0('0xd')]);router['get'](_0x6ff0('0xe'),auth[_0x6ff0('0xc')](),controller[_0x6ff0('0xf')]);router['get'](_0x6ff0('0x10'),auth[_0x6ff0('0xc')](),controller['getFields']);router[_0x6ff0('0xb')](_0x6ff0('0x11'),auth[_0x6ff0('0xc')](),controller[_0x6ff0('0x12')]);router[_0x6ff0('0xb')](_0x6ff0('0x13'),auth[_0x6ff0('0xc')](),controller[_0x6ff0('0x14')]);router[_0x6ff0('0x15')]('/',auth[_0x6ff0('0xc')](),controller[_0x6ff0('0x16')]);router['put'](_0x6ff0('0xe'),auth['isAuthenticated'](),controller[_0x6ff0('0x17')]);router[_0x6ff0('0x18')](_0x6ff0('0xe'),auth[_0x6ff0('0xc')](),controller[_0x6ff0('0x19')]);module[_0x6ff0('0x1a')]=router; \ No newline at end of file +var _0xb5a8=['../../components/auth/service','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5a8,0x12f));var _0x8b5a=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xb5a8[_0x18a79d];return _0x4f8848;};'use strict';var multer=require('multer');var util=require(_0x8b5a('0x0'));var path=require(_0x8b5a('0x1'));var timeout=require(_0x8b5a('0x2'));var express=require('express');var router=express[_0x8b5a('0x3')]();var fs_extra=require(_0x8b5a('0x4'));var auth=require(_0x8b5a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8b5a('0x6')]);router[_0x8b5a('0x7')](_0x8b5a('0x8'),auth[_0x8b5a('0x9')](),controller[_0x8b5a('0xa')]);router[_0x8b5a('0x7')](_0x8b5a('0xb'),auth[_0x8b5a('0x9')](),controller[_0x8b5a('0xc')]);router[_0x8b5a('0x7')](_0x8b5a('0xd'),auth[_0x8b5a('0x9')](),controller[_0x8b5a('0xe')]);router[_0x8b5a('0x7')](_0x8b5a('0xf'),auth['isAuthenticated'](),controller[_0x8b5a('0x10')]);router[_0x8b5a('0x11')]('/',auth[_0x8b5a('0x9')](),controller[_0x8b5a('0x12')]);router[_0x8b5a('0x13')](_0x8b5a('0x8'),auth[_0x8b5a('0x9')](),controller[_0x8b5a('0x14')]);router['delete']('/:id',auth[_0x8b5a('0x9')](),controller['destroy']);module[_0x8b5a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 4f47e62..ce29f0a 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 _0xdbfd=['sequelize','exports','STRING'];(function(_0x53da9e,_0x5e8aca){var _0x2c3e26=function(_0xae1a1b){while(--_0xae1a1b){_0x53da9e['push'](_0x53da9e['shift']());}};_0x2c3e26(++_0x5e8aca);}(_0xdbfd,0xab));var _0xddbf=function(_0x3e8f4d,_0x334360){_0x3e8f4d=_0x3e8f4d-0x0;var _0x1eb198=_0xdbfd[_0x3e8f4d];return _0x1eb198;};'use strict';var Sequelize=require(_0xddbf('0x0'));module[_0xddbf('0x1')]={'name':{'type':Sequelize[_0xddbf('0x2')]},'description':{'type':Sequelize[_0xddbf('0x2')]}}; \ No newline at end of file +var _0x791a=['exports','STRING'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x791a,0x1d6));var _0xa791=function(_0x5a5a0f,_0x3d1fc8){_0x5a5a0f=_0x5a5a0f-0x0;var _0x3efabd=_0x791a[_0x5a5a0f];return _0x3efabd;};'use strict';var Sequelize=require('sequelize');module[_0xa791('0x0')]={'name':{'type':Sequelize[_0xa791('0x1')]},'description':{'type':Sequelize[_0xa791('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 1640ee0..4575bf5 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 _0x7153=['name','send','index','map','ServicenowConfiguration','fieldName','type','key','model','query','keys','intersection','fields','attributes','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','rawAttributes','length','include','find','create','update','body','params','getFields','findOne','ServicenowField','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','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','limit','count','set','apply','reject','then','sendStatus','error'];(function(_0x1cf544,_0x1e27b0){var _0xd9a935=function(_0x394d08){while(--_0x394d08){_0x1cf544['push'](_0x1cf544['shift']());}};_0xd9a935(++_0x1e27b0);}(_0x7153,0x78));var _0x3715=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x7153[_0x1030ce];return _0x3367fd;};'use strict';var emlformat=require(_0x3715('0x0'));var rimraf=require(_0x3715('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3715('0x2'));var rp=require(_0x3715('0x3'));var moment=require('moment');var BPromise=require(_0x3715('0x4'));var Mustache=require(_0x3715('0x5'));var util=require(_0x3715('0x6'));var path=require(_0x3715('0x7'));var sox=require(_0x3715('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3715('0x9'));var squel=require(_0x3715('0xa'));var crypto=require('crypto');var jsforce=require(_0x3715('0xb'));var deskjs=require(_0x3715('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3715('0xd'));var Papa=require(_0x3715('0xe'));var Redis=require('ioredis');var authService=require(_0x3715('0xf'));var qs=require(_0x3715('0x10'));var as=require(_0x3715('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3715('0x12'))(_0x3715('0x13'));var utils=require('../../config/utils');var config=require(_0x3715('0x14'));var licenseUtil=require(_0x3715('0x15'));var db=require(_0x3715('0x16'))['db'];function respondWithStatusCode(_0x48ce52,_0x1fdf4f){_0x1fdf4f=_0x1fdf4f||0xcc;return function(_0x2239c4){if(_0x2239c4){return _0x48ce52['sendStatus'](_0x1fdf4f);}return _0x48ce52[_0x3715('0x17')](_0x1fdf4f)[_0x3715('0x18')]();};}function respondWithResult(_0x93a3d,_0x5535e7){_0x5535e7=_0x5535e7||0xc8;return function(_0x1efdd4){if(_0x1efdd4){return _0x93a3d[_0x3715('0x17')](_0x5535e7)[_0x3715('0x19')](_0x1efdd4);}};}function respondWithFilteredResult(_0x3adca2,_0x23151b){return function(_0x185f0b){if(_0x185f0b){var _0x57965c=typeof _0x23151b[_0x3715('0x1a')]===_0x3715('0x1b')&&typeof _0x23151b[_0x3715('0x1c')]==='undefined';var _0x3347b4=_0x185f0b[_0x3715('0x1d')];var _0x89b7a9=_0x57965c?0x0:_0x23151b[_0x3715('0x1a')];var _0x5d6f73=_0x57965c?_0x185f0b['count']:_0x23151b[_0x3715('0x1a')]+_0x23151b[_0x3715('0x1c')];var _0x3f5b82;if(_0x5d6f73>=_0x3347b4){_0x5d6f73=_0x3347b4;_0x3f5b82=0xc8;}else{_0x3f5b82=0xce;}_0x3adca2[_0x3715('0x17')](_0x3f5b82);return _0x3adca2[_0x3715('0x1e')]('Content-Range',_0x89b7a9+'-'+_0x5d6f73+'/'+_0x3347b4)[_0x3715('0x19')](_0x185f0b);}return null;};}function patchUpdates(_0x339610){return function(_0x5dafc6){try{jsonpatch[_0x3715('0x1f')](_0x5dafc6,_0x339610,!![]);}catch(_0x55ea83){return BPromise[_0x3715('0x20')](_0x55ea83);}return _0x5dafc6['save']();};}function saveUpdates(_0x438af2,_0x5b4850){return function(_0x4579c2){if(_0x4579c2){return _0x4579c2['update'](_0x438af2)[_0x3715('0x21')](function(_0x35629f){return _0x35629f;});}return null;};}function removeEntity(_0x1b0fb7,_0x5b9f63){return function(_0x49476c){if(_0x49476c){return _0x49476c['destroy']()[_0x3715('0x21')](function(){_0x1b0fb7[_0x3715('0x17')](0xcc)[_0x3715('0x18')]();});}};}function handleEntityNotFound(_0x10c499,_0x2ec92a){return function(_0x1fc825){if(!_0x1fc825){_0x10c499[_0x3715('0x22')](0x194);}return _0x1fc825;};}function handleError(_0x10300e,_0x2aa300){_0x2aa300=_0x2aa300||0x1f4;return function(_0x3d8297){logger[_0x3715('0x23')](_0x3d8297['stack']);if(_0x3d8297['name']){delete _0x3d8297[_0x3715('0x24')];}_0x10300e['status'](_0x2aa300)[_0x3715('0x25')](_0x3d8297);};}exports[_0x3715('0x26')]=function(_0x2b401e,_0x27a4dc){var _0x455f32={},_0x5a857c={},_0x35466a={'count':0x0,'rows':[]};var _0x3a76d3=_[_0x3715('0x27')](db[_0x3715('0x28')]['rawAttributes'],function(_0x23f103){return{'name':_0x23f103[_0x3715('0x29')],'type':_0x23f103[_0x3715('0x2a')][_0x3715('0x2b')]};});_0x5a857c[_0x3715('0x2c')]=_[_0x3715('0x27')](_0x3a76d3,_0x3715('0x24'));_0x5a857c[_0x3715('0x2d')]=_[_0x3715('0x2e')](_0x2b401e[_0x3715('0x2d')]);_0x5a857c['filters']=_[_0x3715('0x2f')](_0x5a857c['model'],_0x5a857c['query']);_0x455f32['attributes']=_[_0x3715('0x2f')](_0x5a857c['model'],qs['fields'](_0x2b401e[_0x3715('0x2d')][_0x3715('0x30')]));_0x455f32['attributes']=_0x455f32['attributes']['length']?_0x455f32[_0x3715('0x31')]:_0x5a857c[_0x3715('0x2c')];if(!_0x2b401e[_0x3715('0x2d')]['hasOwnProperty']('nolimit')){_0x455f32[_0x3715('0x1c')]=qs['limit'](_0x2b401e[_0x3715('0x2d')][_0x3715('0x1c')]);_0x455f32[_0x3715('0x1a')]=qs['offset'](_0x2b401e[_0x3715('0x2d')][_0x3715('0x1a')]);}_0x455f32[_0x3715('0x32')]=qs[_0x3715('0x33')](_0x2b401e['query'][_0x3715('0x33')]);_0x455f32[_0x3715('0x34')]=qs[_0x3715('0x35')](_[_0x3715('0x36')](_0x2b401e[_0x3715('0x2d')],_0x5a857c[_0x3715('0x35')]),_0x3a76d3);if(_0x2b401e[_0x3715('0x2d')]['filter']){_0x455f32['where']=_[_0x3715('0x37')](_0x455f32[_0x3715('0x34')],{'$or':_[_0x3715('0x27')](_0x3a76d3,function(_0x3c908b){if(_0x3c908b[_0x3715('0x2a')]!==_0x3715('0x38')){var _0xef1b52={};_0xef1b52[_0x3c908b[_0x3715('0x24')]]={'$like':'%'+_0x2b401e[_0x3715('0x2d')][_0x3715('0x39')]+'%'};return _0xef1b52;}})});}_0x455f32=_['merge']({},_0x455f32,_0x2b401e[_0x3715('0x3a')]);var _0x451b53={'where':_0x455f32[_0x3715('0x34')]};return db['ServicenowConfiguration'][_0x3715('0x1d')](_0x451b53)['then'](function(_0x5b1914){_0x35466a[_0x3715('0x1d')]=_0x5b1914;if(_0x2b401e['query'][_0x3715('0x3b')]){_0x455f32['include']=[{'all':!![]}];}return db[_0x3715('0x28')]['findAll'](_0x455f32);})['then'](function(_0xf7a59c){_0x35466a[_0x3715('0x3c')]=_0xf7a59c;return _0x35466a;})['then'](respondWithFilteredResult(_0x27a4dc,_0x455f32))[_0x3715('0x3d')](handleError(_0x27a4dc,null));};exports[_0x3715('0x3e')]=function(_0xc9c01f,_0x595f17){var _0x515454={'raw':![],'where':{'id':_0xc9c01f['params']['id']}},_0x1e4524={};_0x1e4524['model']=_[_0x3715('0x2e')](db[_0x3715('0x28')][_0x3715('0x3f')]);_0x1e4524[_0x3715('0x2d')]=_[_0x3715('0x2e')](_0xc9c01f[_0x3715('0x2d')]);_0x1e4524[_0x3715('0x35')]=_[_0x3715('0x2f')](_0x1e4524[_0x3715('0x2c')],_0x1e4524[_0x3715('0x2d')]);_0x515454[_0x3715('0x31')]=_[_0x3715('0x2f')](_0x1e4524[_0x3715('0x2c')],qs['fields'](_0xc9c01f['query'][_0x3715('0x30')]));_0x515454['attributes']=_0x515454[_0x3715('0x31')][_0x3715('0x40')]?_0x515454[_0x3715('0x31')]:_0x1e4524['model'];if(_0xc9c01f[_0x3715('0x2d')][_0x3715('0x3b')]){_0x515454[_0x3715('0x41')]=[{'all':!![]}];}_0x515454=_[_0x3715('0x37')]({},_0x515454,_0xc9c01f[_0x3715('0x3a')]);return db[_0x3715('0x28')][_0x3715('0x42')](_0x515454)['then'](handleEntityNotFound(_0x595f17,null))[_0x3715('0x21')](respondWithResult(_0x595f17,null))[_0x3715('0x3d')](handleError(_0x595f17,null));};exports['create']=function(_0x224d3a,_0xa89a22){return db[_0x3715('0x28')][_0x3715('0x43')](_0x224d3a['body'],{})[_0x3715('0x21')](respondWithResult(_0xa89a22,0xc9))[_0x3715('0x3d')](handleError(_0xa89a22,null));};exports[_0x3715('0x44')]=function(_0x120123,_0x338d5f){if(_0x120123[_0x3715('0x45')]['id']){delete _0x120123[_0x3715('0x45')]['id'];}return db[_0x3715('0x28')][_0x3715('0x42')]({'where':{'id':_0x120123[_0x3715('0x46')]['id']}})['then'](handleEntityNotFound(_0x338d5f,null))[_0x3715('0x21')](saveUpdates(_0x120123[_0x3715('0x45')],null))[_0x3715('0x21')](respondWithResult(_0x338d5f,null))[_0x3715('0x3d')](handleError(_0x338d5f,null));};exports['destroy']=function(_0x3015d9,_0x3a9231){return db[_0x3715('0x28')][_0x3715('0x42')]({'where':{'id':_0x3015d9[_0x3715('0x46')]['id']}})[_0x3715('0x21')](handleEntityNotFound(_0x3a9231,null))[_0x3715('0x21')](removeEntity(_0x3a9231,null))[_0x3715('0x3d')](handleError(_0x3a9231,null));};exports[_0x3715('0x47')]=function(_0x37803a,_0x25b7a0,_0x5c8e92){var _0x1656c9={};var _0x43e531={};var _0x32af02;var _0x319b9f;return db[_0x3715('0x28')][_0x3715('0x48')]({'where':{'id':_0x37803a[_0x3715('0x46')]['id']}})[_0x3715('0x21')](handleEntityNotFound(_0x25b7a0,null))[_0x3715('0x21')](function(_0x256827){if(_0x256827){_0x32af02=_0x256827;_0x43e531['model']=_['keys'](db[_0x3715('0x49')]['rawAttributes']);_0x43e531['query']=_['keys'](_0x37803a[_0x3715('0x2d')]);_0x43e531[_0x3715('0x35')]=_['intersection'](_0x43e531['model'],_0x43e531[_0x3715('0x2d')]);_0x1656c9[_0x3715('0x31')]=_[_0x3715('0x2f')](_0x43e531['model'],qs['fields'](_0x37803a[_0x3715('0x2d')]['fields']));_0x1656c9[_0x3715('0x31')]=_0x1656c9[_0x3715('0x31')][_0x3715('0x40')]?_0x1656c9[_0x3715('0x31')]:_0x43e531[_0x3715('0x2c')];_0x1656c9[_0x3715('0x32')]=qs[_0x3715('0x33')](_0x37803a['query'][_0x3715('0x33')]);_0x1656c9['where']=qs[_0x3715('0x35')](_['pick'](_0x37803a[_0x3715('0x2d')],_0x43e531['filters']));if(_0x37803a['query'][_0x3715('0x39')]){_0x1656c9['where']=_[_0x3715('0x37')](_0x1656c9[_0x3715('0x34')],{'$or':_[_0x3715('0x27')](_0x1656c9['attributes'],function(_0x3ad4c8){var _0x17bdcb={};_0x17bdcb[_0x3ad4c8]={'$like':'%'+_0x37803a[_0x3715('0x2d')][_0x3715('0x39')]+'%'};return _0x17bdcb;})});}_0x1656c9=_['merge']({},_0x1656c9,_0x37803a[_0x3715('0x3a')]);return _0x32af02['getFields'](_0x1656c9);}})['then'](function(_0x329a66){if(_0x329a66){_0x319b9f=_0x329a66[_0x3715('0x40')];if(!_0x37803a[_0x3715('0x2d')]['hasOwnProperty'](_0x3715('0x4a'))){_0x1656c9['limit']=qs[_0x3715('0x1c')](_0x37803a[_0x3715('0x2d')][_0x3715('0x1c')]);_0x1656c9[_0x3715('0x1a')]=qs[_0x3715('0x1a')](_0x37803a[_0x3715('0x2d')]['offset']);}return _0x32af02[_0x3715('0x47')](_0x1656c9);}})['then'](function(_0x4a9147){if(_0x4a9147){return _0x4a9147?{'count':_0x319b9f,'rows':_0x4a9147}:null;}})[_0x3715('0x21')](respondWithResult(_0x25b7a0,null))[_0x3715('0x3d')](handleError(_0x25b7a0,null));};exports[_0x3715('0x4b')]=function(_0x58398d,_0x36c527,_0x3f1f5c){var _0xb8f550={};var _0xbded69={};var _0x38093d;var _0x3d1741;return db[_0x3715('0x28')][_0x3715('0x48')]({'where':{'id':_0x58398d[_0x3715('0x46')]['id']}})[_0x3715('0x21')](handleEntityNotFound(_0x36c527,null))[_0x3715('0x21')](function(_0x1268d2){if(_0x1268d2){_0x38093d=_0x1268d2;_0xbded69['model']=_[_0x3715('0x2e')](db[_0x3715('0x49')][_0x3715('0x3f')]);_0xbded69[_0x3715('0x2d')]=_['keys'](_0x58398d[_0x3715('0x2d')]);_0xbded69[_0x3715('0x35')]=_['intersection'](_0xbded69[_0x3715('0x2c')],_0xbded69[_0x3715('0x2d')]);_0xb8f550[_0x3715('0x31')]=_[_0x3715('0x2f')](_0xbded69['model'],qs[_0x3715('0x30')](_0x58398d['query'][_0x3715('0x30')]));_0xb8f550[_0x3715('0x31')]=_0xb8f550['attributes'][_0x3715('0x40')]?_0xb8f550[_0x3715('0x31')]:_0xbded69['model'];_0xb8f550[_0x3715('0x32')]=qs['sort'](_0x58398d[_0x3715('0x2d')][_0x3715('0x33')]);_0xb8f550[_0x3715('0x34')]=qs['filters'](_['pick'](_0x58398d[_0x3715('0x2d')],_0xbded69[_0x3715('0x35')]));if(_0x58398d[_0x3715('0x2d')][_0x3715('0x39')]){_0xb8f550['where']=_['merge'](_0xb8f550[_0x3715('0x34')],{'$or':_[_0x3715('0x27')](_0xb8f550['attributes'],function(_0x57d9cd){var _0x551534={};_0x551534[_0x57d9cd]={'$like':'%'+_0x58398d['query'][_0x3715('0x39')]+'%'};return _0x551534;})});}_0xb8f550=_[_0x3715('0x37')]({},_0xb8f550,_0x58398d[_0x3715('0x3a')]);return _0x38093d[_0x3715('0x4b')](_0xb8f550);}})[_0x3715('0x21')](function(_0x2c682e){if(_0x2c682e){_0x3d1741=_0x2c682e[_0x3715('0x40')];if(!_0x58398d[_0x3715('0x2d')][_0x3715('0x4c')](_0x3715('0x4a'))){_0xb8f550[_0x3715('0x1c')]=qs['limit'](_0x58398d[_0x3715('0x2d')][_0x3715('0x1c')]);_0xb8f550[_0x3715('0x1a')]=qs[_0x3715('0x1a')](_0x58398d[_0x3715('0x2d')][_0x3715('0x1a')]);}return _0x38093d[_0x3715('0x4b')](_0xb8f550);}})['then'](function(_0x239047){if(_0x239047){return _0x239047?{'count':_0x3d1741,'rows':_0x239047}:null;}})[_0x3715('0x21')](respondWithResult(_0x36c527,null))[_0x3715('0x3d')](handleError(_0x36c527,null));};exports[_0x3715('0x4d')]=function(_0x4c81f4,_0x1599d0,_0x48c5e5){var _0x4ed4ad={};var _0x669645={};var _0x550c06;var _0x19f9bc;return db[_0x3715('0x28')]['findOne']({'where':{'id':_0x4c81f4[_0x3715('0x46')]['id']}})[_0x3715('0x21')](handleEntityNotFound(_0x1599d0,null))[_0x3715('0x21')](function(_0x4fc322){if(_0x4fc322){_0x550c06=_0x4fc322;_0x669645[_0x3715('0x2c')]=_[_0x3715('0x2e')](db[_0x3715('0x49')][_0x3715('0x3f')]);_0x669645['query']=_['keys'](_0x4c81f4['query']);_0x669645[_0x3715('0x35')]=_[_0x3715('0x2f')](_0x669645[_0x3715('0x2c')],_0x669645[_0x3715('0x2d')]);_0x4ed4ad[_0x3715('0x31')]=_['intersection'](_0x669645['model'],qs[_0x3715('0x30')](_0x4c81f4[_0x3715('0x2d')][_0x3715('0x30')]));_0x4ed4ad[_0x3715('0x31')]=_0x4ed4ad[_0x3715('0x31')]['length']?_0x4ed4ad[_0x3715('0x31')]:_0x669645[_0x3715('0x2c')];_0x4ed4ad[_0x3715('0x32')]=qs[_0x3715('0x33')](_0x4c81f4[_0x3715('0x2d')]['sort']);_0x4ed4ad['where']=qs[_0x3715('0x35')](_[_0x3715('0x36')](_0x4c81f4['query'],_0x669645['filters']));if(_0x4c81f4[_0x3715('0x2d')]['filter']){_0x4ed4ad['where']=_['merge'](_0x4ed4ad[_0x3715('0x34')],{'$or':_[_0x3715('0x27')](_0x4ed4ad[_0x3715('0x31')],function(_0xfec0b3){var _0x5370a9={};_0x5370a9[_0xfec0b3]={'$like':'%'+_0x4c81f4[_0x3715('0x2d')][_0x3715('0x39')]+'%'};return _0x5370a9;})});}_0x4ed4ad=_['merge']({},_0x4ed4ad,_0x4c81f4[_0x3715('0x3a')]);return _0x550c06[_0x3715('0x4d')](_0x4ed4ad);}})['then'](function(_0x34834){if(_0x34834){_0x19f9bc=_0x34834[_0x3715('0x40')];if(!_0x4c81f4[_0x3715('0x2d')][_0x3715('0x4c')]('nolimit')){_0x4ed4ad[_0x3715('0x1c')]=qs['limit'](_0x4c81f4[_0x3715('0x2d')][_0x3715('0x1c')]);_0x4ed4ad[_0x3715('0x1a')]=qs[_0x3715('0x1a')](_0x4c81f4[_0x3715('0x2d')][_0x3715('0x1a')]);}return _0x550c06[_0x3715('0x4d')](_0x4ed4ad);}})[_0x3715('0x21')](function(_0x34c93b){if(_0x34c93b){return _0x34c93b?{'count':_0x19f9bc,'rows':_0x34c93b}:null;}})[_0x3715('0x21')](respondWithResult(_0x1599d0,null))['catch'](handleError(_0x1599d0,null));}; \ No newline at end of file +var _0x2dce=['limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','ServicenowConfiguration','type','key','map','query','filters','model','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','getFields','findOne','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x545390,_0x5a8b85){var _0x4eca8a=function(_0x1ad17b){while(--_0x1ad17b){_0x545390['push'](_0x545390['shift']());}};_0x4eca8a(++_0x5a8b85);}(_0x2dce,0x1cb));var _0xe2dc=function(_0x13c59f,_0x3752ba){_0x13c59f=_0x13c59f-0x0;var _0x3c582b=_0x2dce[_0x13c59f];return _0x3c582b;};'use strict';var emlformat=require(_0xe2dc('0x0'));var rimraf=require(_0xe2dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe2dc('0x2'));var rp=require(_0xe2dc('0x3'));var moment=require(_0xe2dc('0x4'));var BPromise=require(_0xe2dc('0x5'));var Mustache=require(_0xe2dc('0x6'));var util=require(_0xe2dc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe2dc('0x8'));var ejs=require(_0xe2dc('0x9'));var fs=require('fs');var fs_extra=require(_0xe2dc('0xa'));var _=require(_0xe2dc('0xb'));var squel=require(_0xe2dc('0xc'));var crypto=require(_0xe2dc('0xd'));var jsforce=require(_0xe2dc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe2dc('0x8'));var querystring=require(_0xe2dc('0xf'));var Papa=require(_0xe2dc('0x10'));var Redis=require(_0xe2dc('0x11'));var authService=require(_0xe2dc('0x12'));var qs=require(_0xe2dc('0x13'));var as=require(_0xe2dc('0x14'));var hardwareService=require(_0xe2dc('0x15'));var logger=require(_0xe2dc('0x16'))('api');var utils=require(_0xe2dc('0x17'));var config=require(_0xe2dc('0x18'));var licenseUtil=require(_0xe2dc('0x19'));var db=require(_0xe2dc('0x1a'))['db'];function respondWithStatusCode(_0x5c2032,_0x1d2cf5){_0x1d2cf5=_0x1d2cf5||0xcc;return function(_0x55a1d8){if(_0x55a1d8){return _0x5c2032[_0xe2dc('0x1b')](_0x1d2cf5);}return _0x5c2032[_0xe2dc('0x1c')](_0x1d2cf5)[_0xe2dc('0x1d')]();};}function respondWithResult(_0x57faa4,_0x52c144){_0x52c144=_0x52c144||0xc8;return function(_0x3b3830){if(_0x3b3830){return _0x57faa4[_0xe2dc('0x1c')](_0x52c144)[_0xe2dc('0x1e')](_0x3b3830);}};}function respondWithFilteredResult(_0x472571,_0x2ace65){return function(_0xa5d6b5){if(_0xa5d6b5){var _0x3cafd3=typeof _0x2ace65[_0xe2dc('0x1f')]===_0xe2dc('0x20')&&typeof _0x2ace65[_0xe2dc('0x21')]===_0xe2dc('0x20');var _0x3d4b88=_0xa5d6b5[_0xe2dc('0x22')];var _0x255ffc=_0x3cafd3?0x0:_0x2ace65[_0xe2dc('0x1f')];var _0x543999=_0x3cafd3?_0xa5d6b5['count']:_0x2ace65[_0xe2dc('0x1f')]+_0x2ace65[_0xe2dc('0x21')];var _0x27366;if(_0x543999>=_0x3d4b88){_0x543999=_0x3d4b88;_0x27366=0xc8;}else{_0x27366=0xce;}_0x472571[_0xe2dc('0x1c')](_0x27366);return _0x472571[_0xe2dc('0x23')](_0xe2dc('0x24'),_0x255ffc+'-'+_0x543999+'/'+_0x3d4b88)['json'](_0xa5d6b5);}return null;};}function patchUpdates(_0xbf326d){return function(_0x41e425){try{jsonpatch[_0xe2dc('0x25')](_0x41e425,_0xbf326d,!![]);}catch(_0x56d2ff){return BPromise['reject'](_0x56d2ff);}return _0x41e425['save']();};}function saveUpdates(_0x3c8583,_0x208103){return function(_0x2253c6){if(_0x2253c6){return _0x2253c6[_0xe2dc('0x26')](_0x3c8583)[_0xe2dc('0x27')](function(_0x5bb044){return _0x5bb044;});}return null;};}function removeEntity(_0x4f1d69,_0x58e6e9){return function(_0x24ae8d){if(_0x24ae8d){return _0x24ae8d[_0xe2dc('0x28')]()[_0xe2dc('0x27')](function(){_0x4f1d69[_0xe2dc('0x1c')](0xcc)[_0xe2dc('0x1d')]();});}};}function handleEntityNotFound(_0x4f4f81,_0x4cdd5b){return function(_0x647675){if(!_0x647675){_0x4f4f81[_0xe2dc('0x1b')](0x194);}return _0x647675;};}function handleError(_0x4b289a,_0x41084d){_0x41084d=_0x41084d||0x1f4;return function(_0x311b2a){logger[_0xe2dc('0x29')](_0x311b2a[_0xe2dc('0x2a')]);if(_0x311b2a[_0xe2dc('0x2b')]){delete _0x311b2a['name'];}_0x4b289a[_0xe2dc('0x1c')](_0x41084d)[_0xe2dc('0x2c')](_0x311b2a);};}exports[_0xe2dc('0x2d')]=function(_0x491b41,_0xca1761){var _0x18ac7b={},_0x93846c={},_0x28270f={'count':0x0,'rows':[]};var _0x4be309=_['map'](db[_0xe2dc('0x2e')]['rawAttributes'],function(_0x59a8c5){return{'name':_0x59a8c5['fieldName'],'type':_0x59a8c5[_0xe2dc('0x2f')][_0xe2dc('0x30')]};});_0x93846c['model']=_[_0xe2dc('0x31')](_0x4be309,_0xe2dc('0x2b'));_0x93846c[_0xe2dc('0x32')]=_['keys'](_0x491b41[_0xe2dc('0x32')]);_0x93846c[_0xe2dc('0x33')]=_['intersection'](_0x93846c[_0xe2dc('0x34')],_0x93846c[_0xe2dc('0x32')]);_0x18ac7b[_0xe2dc('0x35')]=_[_0xe2dc('0x36')](_0x93846c[_0xe2dc('0x34')],qs['fields'](_0x491b41[_0xe2dc('0x32')][_0xe2dc('0x37')]));_0x18ac7b[_0xe2dc('0x35')]=_0x18ac7b['attributes'][_0xe2dc('0x38')]?_0x18ac7b[_0xe2dc('0x35')]:_0x93846c[_0xe2dc('0x34')];if(!_0x491b41[_0xe2dc('0x32')]['hasOwnProperty']('nolimit')){_0x18ac7b[_0xe2dc('0x21')]=qs[_0xe2dc('0x21')](_0x491b41['query'][_0xe2dc('0x21')]);_0x18ac7b[_0xe2dc('0x1f')]=qs['offset'](_0x491b41['query'][_0xe2dc('0x1f')]);}_0x18ac7b[_0xe2dc('0x39')]=qs['sort'](_0x491b41[_0xe2dc('0x32')][_0xe2dc('0x3a')]);_0x18ac7b[_0xe2dc('0x3b')]=qs[_0xe2dc('0x33')](_[_0xe2dc('0x3c')](_0x491b41[_0xe2dc('0x32')],_0x93846c['filters']),_0x4be309);if(_0x491b41[_0xe2dc('0x32')][_0xe2dc('0x3d')]){_0x18ac7b[_0xe2dc('0x3b')]=_['merge'](_0x18ac7b[_0xe2dc('0x3b')],{'$or':_[_0xe2dc('0x31')](_0x4be309,function(_0xcc139a){if(_0xcc139a[_0xe2dc('0x2f')]!==_0xe2dc('0x3e')){var _0x4a6da1={};_0x4a6da1[_0xcc139a['name']]={'$like':'%'+_0x491b41[_0xe2dc('0x32')][_0xe2dc('0x3d')]+'%'};return _0x4a6da1;}})});}_0x18ac7b=_[_0xe2dc('0x3f')]({},_0x18ac7b,_0x491b41[_0xe2dc('0x40')]);var _0x44c1ce={'where':_0x18ac7b[_0xe2dc('0x3b')]};return db['ServicenowConfiguration'][_0xe2dc('0x22')](_0x44c1ce)['then'](function(_0x3ab4ca){_0x28270f[_0xe2dc('0x22')]=_0x3ab4ca;if(_0x491b41[_0xe2dc('0x32')]['includeAll']){_0x18ac7b[_0xe2dc('0x41')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x18ac7b);})[_0xe2dc('0x27')](function(_0x527a14){_0x28270f[_0xe2dc('0x42')]=_0x527a14;return _0x28270f;})[_0xe2dc('0x27')](respondWithFilteredResult(_0xca1761,_0x18ac7b))['catch'](handleError(_0xca1761,null));};exports[_0xe2dc('0x43')]=function(_0x242ec0,_0x213c2e){var _0x5bd2a9={'raw':![],'where':{'id':_0x242ec0[_0xe2dc('0x44')]['id']}},_0x10ce47={};_0x10ce47[_0xe2dc('0x34')]=_[_0xe2dc('0x45')](db[_0xe2dc('0x2e')][_0xe2dc('0x46')]);_0x10ce47[_0xe2dc('0x32')]=_[_0xe2dc('0x45')](_0x242ec0[_0xe2dc('0x32')]);_0x10ce47[_0xe2dc('0x33')]=_[_0xe2dc('0x36')](_0x10ce47['model'],_0x10ce47[_0xe2dc('0x32')]);_0x5bd2a9[_0xe2dc('0x35')]=_['intersection'](_0x10ce47[_0xe2dc('0x34')],qs[_0xe2dc('0x37')](_0x242ec0['query'][_0xe2dc('0x37')]));_0x5bd2a9[_0xe2dc('0x35')]=_0x5bd2a9['attributes'][_0xe2dc('0x38')]?_0x5bd2a9[_0xe2dc('0x35')]:_0x10ce47['model'];if(_0x242ec0[_0xe2dc('0x32')][_0xe2dc('0x47')]){_0x5bd2a9[_0xe2dc('0x41')]=[{'all':!![]}];}_0x5bd2a9=_['merge']({},_0x5bd2a9,_0x242ec0[_0xe2dc('0x40')]);return db['ServicenowConfiguration'][_0xe2dc('0x48')](_0x5bd2a9)[_0xe2dc('0x27')](handleEntityNotFound(_0x213c2e,null))[_0xe2dc('0x27')](respondWithResult(_0x213c2e,null))[_0xe2dc('0x49')](handleError(_0x213c2e,null));};exports[_0xe2dc('0x4a')]=function(_0x42741b,_0x3c2c99){return db['ServicenowConfiguration'][_0xe2dc('0x4a')](_0x42741b['body'],{})[_0xe2dc('0x27')](respondWithResult(_0x3c2c99,0xc9))[_0xe2dc('0x49')](handleError(_0x3c2c99,null));};exports[_0xe2dc('0x26')]=function(_0x28313b,_0xa12445){if(_0x28313b[_0xe2dc('0x4b')]['id']){delete _0x28313b[_0xe2dc('0x4b')]['id'];}return db[_0xe2dc('0x2e')]['find']({'where':{'id':_0x28313b[_0xe2dc('0x44')]['id']}})['then'](handleEntityNotFound(_0xa12445,null))[_0xe2dc('0x27')](saveUpdates(_0x28313b[_0xe2dc('0x4b')],null))[_0xe2dc('0x27')](respondWithResult(_0xa12445,null))['catch'](handleError(_0xa12445,null));};exports[_0xe2dc('0x28')]=function(_0x529d42,_0x5ce110){return db[_0xe2dc('0x2e')][_0xe2dc('0x48')]({'where':{'id':_0x529d42[_0xe2dc('0x44')]['id']}})[_0xe2dc('0x27')](handleEntityNotFound(_0x5ce110,null))[_0xe2dc('0x27')](removeEntity(_0x5ce110,null))[_0xe2dc('0x49')](handleError(_0x5ce110,null));};exports[_0xe2dc('0x4c')]=function(_0x5dde0d,_0x334cb9,_0xaf101a){var _0x31366d={};var _0x2c9c74={};var _0x51026b;var _0x246a0a;return db[_0xe2dc('0x2e')][_0xe2dc('0x4d')]({'where':{'id':_0x5dde0d['params']['id']}})[_0xe2dc('0x27')](handleEntityNotFound(_0x334cb9,null))[_0xe2dc('0x27')](function(_0x29d1a5){if(_0x29d1a5){_0x51026b=_0x29d1a5;_0x2c9c74[_0xe2dc('0x34')]=_[_0xe2dc('0x45')](db['ServicenowField'][_0xe2dc('0x46')]);_0x2c9c74[_0xe2dc('0x32')]=_[_0xe2dc('0x45')](_0x5dde0d['query']);_0x2c9c74['filters']=_[_0xe2dc('0x36')](_0x2c9c74[_0xe2dc('0x34')],_0x2c9c74['query']);_0x31366d[_0xe2dc('0x35')]=_[_0xe2dc('0x36')](_0x2c9c74['model'],qs[_0xe2dc('0x37')](_0x5dde0d[_0xe2dc('0x32')]['fields']));_0x31366d[_0xe2dc('0x35')]=_0x31366d[_0xe2dc('0x35')][_0xe2dc('0x38')]?_0x31366d[_0xe2dc('0x35')]:_0x2c9c74[_0xe2dc('0x34')];_0x31366d[_0xe2dc('0x39')]=qs['sort'](_0x5dde0d[_0xe2dc('0x32')][_0xe2dc('0x3a')]);_0x31366d[_0xe2dc('0x3b')]=qs[_0xe2dc('0x33')](_['pick'](_0x5dde0d[_0xe2dc('0x32')],_0x2c9c74[_0xe2dc('0x33')]));if(_0x5dde0d['query'][_0xe2dc('0x3d')]){_0x31366d[_0xe2dc('0x3b')]=_['merge'](_0x31366d['where'],{'$or':_[_0xe2dc('0x31')](_0x31366d[_0xe2dc('0x35')],function(_0x35fa7e){var _0x4e4b71={};_0x4e4b71[_0x35fa7e]={'$like':'%'+_0x5dde0d['query'][_0xe2dc('0x3d')]+'%'};return _0x4e4b71;})});}_0x31366d=_['merge']({},_0x31366d,_0x5dde0d[_0xe2dc('0x40')]);return _0x51026b[_0xe2dc('0x4c')](_0x31366d);}})[_0xe2dc('0x27')](function(_0x5e1d8f){if(_0x5e1d8f){_0x246a0a=_0x5e1d8f[_0xe2dc('0x38')];if(!_0x5dde0d[_0xe2dc('0x32')]['hasOwnProperty'](_0xe2dc('0x4e'))){_0x31366d['limit']=qs[_0xe2dc('0x21')](_0x5dde0d['query']['limit']);_0x31366d[_0xe2dc('0x1f')]=qs[_0xe2dc('0x1f')](_0x5dde0d[_0xe2dc('0x32')]['offset']);}return _0x51026b[_0xe2dc('0x4c')](_0x31366d);}})[_0xe2dc('0x27')](function(_0x1139e6){if(_0x1139e6){return _0x1139e6?{'count':_0x246a0a,'rows':_0x1139e6}:null;}})[_0xe2dc('0x27')](respondWithResult(_0x334cb9,null))['catch'](handleError(_0x334cb9,null));};exports[_0xe2dc('0x4f')]=function(_0x7c950e,_0x3edbb3,_0x225281){var _0x393dc2={};var _0x2aa131={};var _0x3d4163;var _0x4c434d;return db[_0xe2dc('0x2e')]['findOne']({'where':{'id':_0x7c950e['params']['id']}})[_0xe2dc('0x27')](handleEntityNotFound(_0x3edbb3,null))[_0xe2dc('0x27')](function(_0x2e91b4){if(_0x2e91b4){_0x3d4163=_0x2e91b4;_0x2aa131['model']=_['keys'](db['ServicenowField'][_0xe2dc('0x46')]);_0x2aa131[_0xe2dc('0x32')]=_[_0xe2dc('0x45')](_0x7c950e[_0xe2dc('0x32')]);_0x2aa131[_0xe2dc('0x33')]=_['intersection'](_0x2aa131[_0xe2dc('0x34')],_0x2aa131[_0xe2dc('0x32')]);_0x393dc2[_0xe2dc('0x35')]=_[_0xe2dc('0x36')](_0x2aa131[_0xe2dc('0x34')],qs['fields'](_0x7c950e[_0xe2dc('0x32')][_0xe2dc('0x37')]));_0x393dc2[_0xe2dc('0x35')]=_0x393dc2[_0xe2dc('0x35')][_0xe2dc('0x38')]?_0x393dc2[_0xe2dc('0x35')]:_0x2aa131[_0xe2dc('0x34')];_0x393dc2['order']=qs[_0xe2dc('0x3a')](_0x7c950e[_0xe2dc('0x32')][_0xe2dc('0x3a')]);_0x393dc2[_0xe2dc('0x3b')]=qs[_0xe2dc('0x33')](_[_0xe2dc('0x3c')](_0x7c950e[_0xe2dc('0x32')],_0x2aa131['filters']));if(_0x7c950e[_0xe2dc('0x32')][_0xe2dc('0x3d')]){_0x393dc2[_0xe2dc('0x3b')]=_[_0xe2dc('0x3f')](_0x393dc2['where'],{'$or':_[_0xe2dc('0x31')](_0x393dc2['attributes'],function(_0x5f2448){var _0x4d64fd={};_0x4d64fd[_0x5f2448]={'$like':'%'+_0x7c950e[_0xe2dc('0x32')][_0xe2dc('0x3d')]+'%'};return _0x4d64fd;})});}_0x393dc2=_['merge']({},_0x393dc2,_0x7c950e['options']);return _0x3d4163[_0xe2dc('0x4f')](_0x393dc2);}})[_0xe2dc('0x27')](function(_0x415b8e){if(_0x415b8e){_0x4c434d=_0x415b8e[_0xe2dc('0x38')];if(!_0x7c950e[_0xe2dc('0x32')][_0xe2dc('0x50')]('nolimit')){_0x393dc2[_0xe2dc('0x21')]=qs[_0xe2dc('0x21')](_0x7c950e[_0xe2dc('0x32')][_0xe2dc('0x21')]);_0x393dc2[_0xe2dc('0x1f')]=qs[_0xe2dc('0x1f')](_0x7c950e[_0xe2dc('0x32')][_0xe2dc('0x1f')]);}return _0x3d4163[_0xe2dc('0x4f')](_0x393dc2);}})[_0xe2dc('0x27')](function(_0x378f3f){if(_0x378f3f){return _0x378f3f?{'count':_0x4c434d,'rows':_0x378f3f}:null;}})['then'](respondWithResult(_0x3edbb3,null))[_0xe2dc('0x49')](handleError(_0x3edbb3,null));};exports['getDescriptions']=function(_0x5b6762,_0x37a937,_0x5ae9b2){var _0x28484c={};var _0x3f7a2e={};var _0x50cfdd;var _0x40a833;return db[_0xe2dc('0x2e')]['findOne']({'where':{'id':_0x5b6762[_0xe2dc('0x44')]['id']}})[_0xe2dc('0x27')](handleEntityNotFound(_0x37a937,null))['then'](function(_0x91b17b){if(_0x91b17b){_0x50cfdd=_0x91b17b;_0x3f7a2e[_0xe2dc('0x34')]=_['keys'](db['ServicenowField'][_0xe2dc('0x46')]);_0x3f7a2e[_0xe2dc('0x32')]=_['keys'](_0x5b6762[_0xe2dc('0x32')]);_0x3f7a2e[_0xe2dc('0x33')]=_[_0xe2dc('0x36')](_0x3f7a2e[_0xe2dc('0x34')],_0x3f7a2e[_0xe2dc('0x32')]);_0x28484c[_0xe2dc('0x35')]=_[_0xe2dc('0x36')](_0x3f7a2e[_0xe2dc('0x34')],qs['fields'](_0x5b6762[_0xe2dc('0x32')]['fields']));_0x28484c['attributes']=_0x28484c[_0xe2dc('0x35')][_0xe2dc('0x38')]?_0x28484c[_0xe2dc('0x35')]:_0x3f7a2e[_0xe2dc('0x34')];_0x28484c[_0xe2dc('0x39')]=qs[_0xe2dc('0x3a')](_0x5b6762[_0xe2dc('0x32')][_0xe2dc('0x3a')]);_0x28484c[_0xe2dc('0x3b')]=qs['filters'](_['pick'](_0x5b6762[_0xe2dc('0x32')],_0x3f7a2e['filters']));if(_0x5b6762[_0xe2dc('0x32')][_0xe2dc('0x3d')]){_0x28484c['where']=_[_0xe2dc('0x3f')](_0x28484c[_0xe2dc('0x3b')],{'$or':_[_0xe2dc('0x31')](_0x28484c[_0xe2dc('0x35')],function(_0x2ac002){var _0x4563c9={};_0x4563c9[_0x2ac002]={'$like':'%'+_0x5b6762[_0xe2dc('0x32')][_0xe2dc('0x3d')]+'%'};return _0x4563c9;})});}_0x28484c=_[_0xe2dc('0x3f')]({},_0x28484c,_0x5b6762[_0xe2dc('0x40')]);return _0x50cfdd[_0xe2dc('0x51')](_0x28484c);}})['then'](function(_0x550d5c){if(_0x550d5c){_0x40a833=_0x550d5c[_0xe2dc('0x38')];if(!_0x5b6762[_0xe2dc('0x32')][_0xe2dc('0x50')](_0xe2dc('0x4e'))){_0x28484c['limit']=qs['limit'](_0x5b6762[_0xe2dc('0x32')][_0xe2dc('0x21')]);_0x28484c[_0xe2dc('0x1f')]=qs['offset'](_0x5b6762[_0xe2dc('0x32')][_0xe2dc('0x1f')]);}return _0x50cfdd[_0xe2dc('0x51')](_0x28484c);}})[_0xe2dc('0x27')](function(_0x367350){if(_0x367350){return _0x367350?{'count':_0x40a833,'rows':_0x367350}:null;}})['then'](respondWithResult(_0x37a937,null))['catch'](handleError(_0x37a937,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 69be146..f9eb4c9 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 _0x7d25=['api','moment','bluebird','request-promise','path','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger'];(function(_0x32cce8,_0x18762f){var _0x4a732b=function(_0x5a3a21){while(--_0x5a3a21){_0x32cce8['push'](_0x32cce8['shift']());}};_0x4a732b(++_0x18762f);}(_0x7d25,0x8a));var _0x57d2=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x7d25[_0x580647];return _0x5f0792;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fea=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7fea,0x149));var _0xa7fe=function(_0x54b171,_0x1a9b61){_0x54b171=_0x54b171-0x0;var _0x3326d3=_0x7fea[_0x54b171];return _0x3326d3;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa7fe('0x1'));var BPromise=require(_0xa7fe('0x2'));var rp=require(_0xa7fe('0x3'));var fs=require('fs');var path=require(_0xa7fe('0x4'));var rimraf=require(_0xa7fe('0x5'));var config=require(_0xa7fe('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xa7fe('0x7')]=function(_0x2bcfad,_0x1fbc99){return _0x2bcfad[_0xa7fe('0x8')](_0xa7fe('0x9'),attributes,{'tableName':_0xa7fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 32c5463..cbaa13f 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 _0x4071=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x4071,0x1e6));var _0x1407=function(_0x509faf,_0x574c85){_0x509faf=_0x509faf-0x0;var _0x322034=_0x4071[_0x509faf];return _0x322034;};'use strict';var _=require(_0x1407('0x0'));var util=require(_0x1407('0x1'));var moment=require(_0x1407('0x2'));var BPromise=require(_0x1407('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1407('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1407('0x5'));var logger=require(_0x1407('0x6'))(_0x1407('0x7'));var config=require('../../config/environment');var jayson=require(_0x1407('0x8'));var client=jayson[_0x1407('0x9')][_0x1407('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x560e24,_0x366dee,_0xc875da){return new BPromise(function(_0x354550,_0xb886d0){return client['request'](_0x560e24,_0xc875da)[_0x1407('0xb')](function(_0x3cbe6a){logger[_0x1407('0xc')](_0x1407('0xd'),_0x366dee,_0x1407('0xe'));logger[_0x1407('0xf')](_0x1407('0x10'),_0x366dee,_0x1407('0xe'),JSON[_0x1407('0x11')](_0x3cbe6a));if(_0x3cbe6a['error']){if(_0x3cbe6a[_0x1407('0x12')][_0x1407('0x13')]===0x1f4){logger[_0x1407('0x12')](_0x1407('0xd'),_0x366dee,_0x3cbe6a[_0x1407('0x12')]['message']);return _0xb886d0(_0x3cbe6a[_0x1407('0x12')][_0x1407('0x14')]);}logger['error'](_0x1407('0xd'),_0x366dee,_0x3cbe6a[_0x1407('0x12')][_0x1407('0x14')]);return _0x354550(_0x3cbe6a['error'][_0x1407('0x14')]);}else{logger['info'](_0x1407('0xd'),_0x366dee,_0x1407('0xe'));_0x354550(_0x3cbe6a[_0x1407('0x15')][_0x1407('0x14')]);}})[_0x1407('0x16')](function(_0x149e7c){logger[_0x1407('0x12')](_0x1407('0xd'),_0x366dee,_0x149e7c);_0xb886d0(_0x149e7c);});});} \ No newline at end of file +var _0x8481=['request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x75cfd6,_0x44b213){var _0x4692e6=function(_0xf9f5ea){while(--_0xf9f5ea){_0x75cfd6['push'](_0x75cfd6['shift']());}};_0x4692e6(++_0x44b213);}(_0x8481,0xb0));var _0x1848=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x8481[_0x43d16c];return _0x208cce;};'use strict';var _=require('lodash');var util=require(_0x1848('0x0'));var moment=require(_0x1848('0x1'));var BPromise=require(_0x1848('0x2'));var rs=require(_0x1848('0x3'));var fs=require('fs');var Redis=require(_0x1848('0x4'));var db=require(_0x1848('0x5'))['db'];var utils=require(_0x1848('0x6'));var logger=require(_0x1848('0x7'))(_0x1848('0x8'));var config=require(_0x1848('0x9'));var jayson=require(_0x1848('0xa'));var client=jayson[_0x1848('0xb')][_0x1848('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56325a,_0x4947f9,_0x38b895){return new BPromise(function(_0x10cf04,_0x56809f){return client[_0x1848('0xd')](_0x56325a,_0x38b895)[_0x1848('0xe')](function(_0x400a5b){logger['info'](_0x1848('0xf'),_0x4947f9,_0x1848('0x10'));logger[_0x1848('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4947f9,_0x1848('0x10'),JSON['stringify'](_0x400a5b));if(_0x400a5b[_0x1848('0x12')]){if(_0x400a5b[_0x1848('0x12')][_0x1848('0x13')]===0x1f4){logger[_0x1848('0x12')](_0x1848('0xf'),_0x4947f9,_0x400a5b['error']['message']);return _0x56809f(_0x400a5b[_0x1848('0x12')][_0x1848('0x14')]);}logger['error'](_0x1848('0xf'),_0x4947f9,_0x400a5b[_0x1848('0x12')]['message']);return _0x10cf04(_0x400a5b[_0x1848('0x12')][_0x1848('0x14')]);}else{logger[_0x1848('0x15')](_0x1848('0xf'),_0x4947f9,'request\x20sent');_0x10cf04(_0x400a5b[_0x1848('0x16')][_0x1848('0x14')]);}})[_0x1848('0x17')](function(_0x4a7424){logger[_0x1848('0x12')](_0x1848('0xf'),_0x4947f9,_0x4a7424);_0x56809f(_0x4a7424);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 12a4cb6..d5618dd 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 _0x3b5f=['update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','put'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x3b5f,0xb3));var _0xf3b5=function(_0x6fc018,_0x4b794){_0x6fc018=_0x6fc018-0x0;var _0x5402b5=_0x3b5f[_0x6fc018];return _0x5402b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf3b5('0x0'));var timeout=require(_0xf3b5('0x1'));var express=require(_0xf3b5('0x2'));var router=express[_0xf3b5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf3b5('0x4'));var interaction=require(_0xf3b5('0x5'));var config=require('../../config/environment');var controller=require(_0xf3b5('0x6'));router[_0xf3b5('0x7')]('/',auth[_0xf3b5('0x8')](),controller['index']);router['get'](_0xf3b5('0x9'),auth[_0xf3b5('0x8')](),controller[_0xf3b5('0xa')]);router[_0xf3b5('0xb')]('/',auth[_0xf3b5('0x8')](),controller['create']);router[_0xf3b5('0xc')](_0xf3b5('0x9'),auth[_0xf3b5('0x8')](),controller[_0xf3b5('0xd')]);router['delete'](_0xf3b5('0x9'),auth[_0xf3b5('0x8')](),controller[_0xf3b5('0xe')]);module[_0xf3b5('0xf')]=router; \ No newline at end of file +var _0x3724=['isAuthenticated','show','post','create','put','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id'];(function(_0x2adefb,_0x21670d){var _0xa413c8=function(_0x17c1f6){while(--_0x17c1f6){_0x2adefb['push'](_0x2adefb['shift']());}};_0xa413c8(++_0x21670d);}(_0x3724,0x84));var _0x4372=function(_0x4474c2,_0x59cf02){_0x4474c2=_0x4474c2-0x0;var _0x435fbb=_0x3724[_0x4474c2];return _0x435fbb;};'use strict';var multer=require(_0x4372('0x0'));var util=require(_0x4372('0x1'));var path=require(_0x4372('0x2'));var timeout=require(_0x4372('0x3'));var express=require('express');var router=express[_0x4372('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4372('0x5'));var interaction=require(_0x4372('0x6'));var config=require(_0x4372('0x7'));var controller=require(_0x4372('0x8'));router[_0x4372('0x9')]('/',auth['isAuthenticated'](),controller[_0x4372('0xa')]);router[_0x4372('0x9')](_0x4372('0xb'),auth[_0x4372('0xc')](),controller[_0x4372('0xd')]);router[_0x4372('0xe')]('/',auth[_0x4372('0xc')](),controller[_0x4372('0xf')]);router[_0x4372('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4372('0x11')]('/:id',auth[_0x4372('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b7dd752..06f289b 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 _0xfbcc=['keyValue','picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x3c09b9,_0x467b3c){var _0x4d2673=function(_0x57dccc){while(--_0x57dccc){_0x3c09b9['push'](_0x3c09b9['shift']());}};_0x4d2673(++_0x467b3c);}(_0xfbcc,0x153));var _0xcfbc=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0xfbcc[_0x2dc96f];return _0xd012da;};'use strict';var Sequelize=require(_0xcfbc('0x0'));module['exports']={'type':{'type':Sequelize[_0xcfbc('0x1')](_0xcfbc('0x2'),_0xcfbc('0x3'),_0xcfbc('0x4'),_0xcfbc('0x5'),_0xcfbc('0x6')),'defaultValue':_0xcfbc('0x2')},'content':{'type':Sequelize[_0xcfbc('0x7')]},'key':{'type':Sequelize[_0xcfbc('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xcfbc('0x2'),_0xcfbc('0x3'),_0xcfbc('0x4'))},'keyContent':{'type':Sequelize[_0xcfbc('0x7')]},'idField':{'type':Sequelize[_0xcfbc('0x7')]},'nameField':{'type':Sequelize[_0xcfbc('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcfbc('0x7')]}}; \ No newline at end of file +var _0x6a6f=['string','picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x404276,_0x194e57){var _0x4a7e75=function(_0x268fc4){while(--_0x268fc4){_0x404276['push'](_0x404276['shift']());}};_0x4a7e75(++_0x194e57);}(_0x6a6f,0x69));var _0xf6a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a6f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf6a6('0x0'));module[_0xf6a6('0x1')]={'type':{'type':Sequelize[_0xf6a6('0x2')](_0xf6a6('0x3'),'variable','customVariable','keyValue',_0xf6a6('0x4')),'defaultValue':_0xf6a6('0x3')},'content':{'type':Sequelize[_0xf6a6('0x5')]},'key':{'type':Sequelize[_0xf6a6('0x5')]},'keyType':{'type':Sequelize[_0xf6a6('0x2')](_0xf6a6('0x3'),_0xf6a6('0x6'),_0xf6a6('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf6a6('0x5')]},'nameField':{'type':Sequelize[_0xf6a6('0x5')]},'customField':{'type':Sequelize[_0xf6a6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 6837707..4a1203c 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 _0x2057=['fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','ServicenowField','include','findAll','rows','catch','find','create','body','params','rimraf'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x2057,0x162));var _0x7205=function(_0x184bb5,_0x2580e8){_0x184bb5=_0x184bb5-0x0;var _0x4c15d8=_0x2057[_0x184bb5];return _0x4c15d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7205('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7205('0x1'));var rp=require('request-promise');var moment=require(_0x7205('0x2'));var BPromise=require(_0x7205('0x3'));var Mustache=require(_0x7205('0x4'));var util=require('util');var path=require(_0x7205('0x5'));var sox=require('sox');var csv=require(_0x7205('0x6'));var ejs=require(_0x7205('0x7'));var fs=require('fs');var fs_extra=require(_0x7205('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7205('0x9'));var jsforce=require(_0x7205('0xa'));var deskjs=require(_0x7205('0xb'));var toCsv=require(_0x7205('0x6'));var querystring=require('querystring');var Papa=require(_0x7205('0xc'));var Redis=require(_0x7205('0xd'));var authService=require(_0x7205('0xe'));var qs=require(_0x7205('0xf'));var as=require(_0x7205('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7205('0x11'))(_0x7205('0x12'));var utils=require(_0x7205('0x13'));var config=require(_0x7205('0x14'));var licenseUtil=require(_0x7205('0x15'));var db=require(_0x7205('0x16'))['db'];function respondWithStatusCode(_0x562566,_0x5e24a3){_0x5e24a3=_0x5e24a3||0xcc;return function(_0x4c832e){if(_0x4c832e){return _0x562566[_0x7205('0x17')](_0x5e24a3);}return _0x562566[_0x7205('0x18')](_0x5e24a3)[_0x7205('0x19')]();};}function respondWithResult(_0x16eb4a,_0x4515d2){_0x4515d2=_0x4515d2||0xc8;return function(_0x42b7ae){if(_0x42b7ae){return _0x16eb4a[_0x7205('0x18')](_0x4515d2)[_0x7205('0x1a')](_0x42b7ae);}};}function respondWithFilteredResult(_0x5a49d2,_0x1a40f3){return function(_0x29442a){if(_0x29442a){var _0x147ee1=typeof _0x1a40f3[_0x7205('0x1b')]===_0x7205('0x1c')&&typeof _0x1a40f3[_0x7205('0x1d')]===_0x7205('0x1c');var _0x2a6776=_0x29442a[_0x7205('0x1e')];var _0xdd3fb=_0x147ee1?0x0:_0x1a40f3[_0x7205('0x1b')];var _0x42b7be=_0x147ee1?_0x29442a[_0x7205('0x1e')]:_0x1a40f3[_0x7205('0x1b')]+_0x1a40f3[_0x7205('0x1d')];var _0x366878;if(_0x42b7be>=_0x2a6776){_0x42b7be=_0x2a6776;_0x366878=0xc8;}else{_0x366878=0xce;}_0x5a49d2[_0x7205('0x18')](_0x366878);return _0x5a49d2['set'](_0x7205('0x1f'),_0xdd3fb+'-'+_0x42b7be+'/'+_0x2a6776)[_0x7205('0x1a')](_0x29442a);}return null;};}function patchUpdates(_0x1bf44f){return function(_0xf65c86){try{jsonpatch['apply'](_0xf65c86,_0x1bf44f,!![]);}catch(_0x338445){return BPromise[_0x7205('0x20')](_0x338445);}return _0xf65c86[_0x7205('0x21')]();};}function saveUpdates(_0x1403ad,_0x1bce8b){return function(_0x2a0b66){if(_0x2a0b66){return _0x2a0b66['update'](_0x1403ad)['then'](function(_0x5b21fd){return _0x5b21fd;});}return null;};}function removeEntity(_0x61b367,_0x209576){return function(_0x382d65){if(_0x382d65){return _0x382d65[_0x7205('0x22')]()[_0x7205('0x23')](function(){_0x61b367[_0x7205('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a16b,_0x1be1ce){return function(_0x202db0){if(!_0x202db0){_0x51a16b['sendStatus'](0x194);}return _0x202db0;};}function handleError(_0x1c8c7d,_0x318448){_0x318448=_0x318448||0x1f4;return function(_0x241c2b){logger[_0x7205('0x24')](_0x241c2b[_0x7205('0x25')]);if(_0x241c2b[_0x7205('0x26')]){delete _0x241c2b[_0x7205('0x26')];}_0x1c8c7d[_0x7205('0x18')](_0x318448)[_0x7205('0x27')](_0x241c2b);};}exports[_0x7205('0x28')]=function(_0x59e6ae,_0x29cfc2){var _0x2d5c81={},_0x3ab7e5={},_0x745d10={'count':0x0,'rows':[]};var _0x53790d=_[_0x7205('0x29')](db['ServicenowField'][_0x7205('0x2a')],function(_0x56dfd4){return{'name':_0x56dfd4['fieldName'],'type':_0x56dfd4[_0x7205('0x2b')][_0x7205('0x2c')]};});_0x3ab7e5['model']=_[_0x7205('0x29')](_0x53790d,_0x7205('0x26'));_0x3ab7e5['query']=_[_0x7205('0x2d')](_0x59e6ae[_0x7205('0x2e')]);_0x3ab7e5[_0x7205('0x2f')]=_[_0x7205('0x30')](_0x3ab7e5[_0x7205('0x31')],_0x3ab7e5[_0x7205('0x2e')]);_0x2d5c81[_0x7205('0x32')]=_[_0x7205('0x30')](_0x3ab7e5[_0x7205('0x31')],qs[_0x7205('0x33')](_0x59e6ae[_0x7205('0x2e')][_0x7205('0x33')]));_0x2d5c81[_0x7205('0x32')]=_0x2d5c81[_0x7205('0x32')][_0x7205('0x34')]?_0x2d5c81[_0x7205('0x32')]:_0x3ab7e5[_0x7205('0x31')];if(!_0x59e6ae[_0x7205('0x2e')][_0x7205('0x35')](_0x7205('0x36'))){_0x2d5c81[_0x7205('0x1d')]=qs[_0x7205('0x1d')](_0x59e6ae[_0x7205('0x2e')][_0x7205('0x1d')]);_0x2d5c81[_0x7205('0x1b')]=qs[_0x7205('0x1b')](_0x59e6ae[_0x7205('0x2e')][_0x7205('0x1b')]);}_0x2d5c81[_0x7205('0x37')]=qs['sort'](_0x59e6ae['query']['sort']);_0x2d5c81['where']=qs['filters'](_[_0x7205('0x38')](_0x59e6ae[_0x7205('0x2e')],_0x3ab7e5[_0x7205('0x2f')]),_0x53790d);if(_0x59e6ae['query'][_0x7205('0x39')]){_0x2d5c81['where']=_['merge'](_0x2d5c81[_0x7205('0x3a')],{'$or':_[_0x7205('0x29')](_0x53790d,function(_0x43be66){if(_0x43be66[_0x7205('0x2b')]!==_0x7205('0x3b')){var _0x513cdd={};_0x513cdd[_0x43be66['name']]={'$like':'%'+_0x59e6ae[_0x7205('0x2e')][_0x7205('0x39')]+'%'};return _0x513cdd;}})});}_0x2d5c81=_[_0x7205('0x3c')]({},_0x2d5c81,_0x59e6ae[_0x7205('0x3d')]);var _0x2dd824={'where':_0x2d5c81[_0x7205('0x3a')]};return db[_0x7205('0x3e')]['count'](_0x2dd824)[_0x7205('0x23')](function(_0x233e5b){_0x745d10[_0x7205('0x1e')]=_0x233e5b;if(_0x59e6ae['query']['includeAll']){_0x2d5c81[_0x7205('0x3f')]=[{'all':!![]}];}return db[_0x7205('0x3e')][_0x7205('0x40')](_0x2d5c81);})[_0x7205('0x23')](function(_0x27a52a){_0x745d10[_0x7205('0x41')]=_0x27a52a;return _0x745d10;})[_0x7205('0x23')](respondWithFilteredResult(_0x29cfc2,_0x2d5c81))[_0x7205('0x42')](handleError(_0x29cfc2,null));};exports['show']=function(_0x34236a,_0x39ad3d){var _0x227250={'raw':!![],'where':{'id':_0x34236a['params']['id']}},_0x26dc1e={};_0x26dc1e[_0x7205('0x31')]=_[_0x7205('0x2d')](db[_0x7205('0x3e')][_0x7205('0x2a')]);_0x26dc1e[_0x7205('0x2e')]=_[_0x7205('0x2d')](_0x34236a[_0x7205('0x2e')]);_0x26dc1e[_0x7205('0x2f')]=_[_0x7205('0x30')](_0x26dc1e[_0x7205('0x31')],_0x26dc1e[_0x7205('0x2e')]);_0x227250[_0x7205('0x32')]=_[_0x7205('0x30')](_0x26dc1e['model'],qs[_0x7205('0x33')](_0x34236a[_0x7205('0x2e')]['fields']));_0x227250[_0x7205('0x32')]=_0x227250['attributes']['length']?_0x227250[_0x7205('0x32')]:_0x26dc1e[_0x7205('0x31')];if(_0x34236a[_0x7205('0x2e')]['includeAll']){_0x227250[_0x7205('0x3f')]=[{'all':!![]}];}_0x227250=_['merge']({},_0x227250,_0x34236a[_0x7205('0x3d')]);return db[_0x7205('0x3e')][_0x7205('0x43')](_0x227250)[_0x7205('0x23')](handleEntityNotFound(_0x39ad3d,null))[_0x7205('0x23')](respondWithResult(_0x39ad3d,null))[_0x7205('0x42')](handleError(_0x39ad3d,null));};exports[_0x7205('0x44')]=function(_0x5a1d75,_0xc88799){return db[_0x7205('0x3e')][_0x7205('0x44')](_0x5a1d75[_0x7205('0x45')],{})[_0x7205('0x23')](respondWithResult(_0xc88799,0xc9))[_0x7205('0x42')](handleError(_0xc88799,null));};exports['update']=function(_0x4f4757,_0x5ee901){if(_0x4f4757[_0x7205('0x45')]['id']){delete _0x4f4757[_0x7205('0x45')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x4f4757[_0x7205('0x46')]['id']}})[_0x7205('0x23')](handleEntityNotFound(_0x5ee901,null))[_0x7205('0x23')](saveUpdates(_0x4f4757['body'],null))['then'](respondWithResult(_0x5ee901,null))['catch'](handleError(_0x5ee901,null));};exports['destroy']=function(_0x3b550a,_0x1cc260){return db[_0x7205('0x3e')][_0x7205('0x43')]({'where':{'id':_0x3b550a[_0x7205('0x46')]['id']}})[_0x7205('0x23')](handleEntityNotFound(_0x1cc260,null))[_0x7205('0x23')](removeEntity(_0x1cc260,null))[_0x7205('0x42')](handleError(_0x1cc260,null));}; \ No newline at end of file +var _0xff99=['stack','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','ServicenowField','findAll','rows','show','params','length','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','../../config/utils','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus'];(function(_0x50a4c2,_0x19837c){var _0x3e1839=function(_0x801725){while(--_0x801725){_0x50a4c2['push'](_0x50a4c2['shift']());}};_0x3e1839(++_0x19837c);}(_0xff99,0xb4));var _0x9ff9=function(_0x481837,_0x10e935){_0x481837=_0x481837-0x0;var _0x54c12c=_0xff99[_0x481837];return _0x54c12c;};'use strict';var emlformat=require(_0x9ff9('0x0'));var rimraf=require(_0x9ff9('0x1'));var zipdir=require(_0x9ff9('0x2'));var jsonpatch=require(_0x9ff9('0x3'));var rp=require('request-promise');var moment=require(_0x9ff9('0x4'));var BPromise=require(_0x9ff9('0x5'));var Mustache=require(_0x9ff9('0x6'));var util=require(_0x9ff9('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9ff9('0x8'));var ejs=require(_0x9ff9('0x9'));var fs=require('fs');var fs_extra=require(_0x9ff9('0xa'));var _=require(_0x9ff9('0xb'));var squel=require(_0x9ff9('0xc'));var crypto=require(_0x9ff9('0xd'));var jsforce=require(_0x9ff9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ff9('0xf'));var Papa=require(_0x9ff9('0x10'));var Redis=require(_0x9ff9('0x11'));var authService=require(_0x9ff9('0x12'));var qs=require(_0x9ff9('0x13'));var as=require(_0x9ff9('0x14'));var hardwareService=require(_0x9ff9('0x15'));var logger=require(_0x9ff9('0x16'))('api');var utils=require(_0x9ff9('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9ff9('0x18'))['db'];function respondWithStatusCode(_0x137894,_0x50b598){_0x50b598=_0x50b598||0xcc;return function(_0x54ba83){if(_0x54ba83){return _0x137894['sendStatus'](_0x50b598);}return _0x137894[_0x9ff9('0x19')](_0x50b598)['end']();};}function respondWithResult(_0x3191c8,_0x3717bb){_0x3717bb=_0x3717bb||0xc8;return function(_0x54425b){if(_0x54425b){return _0x3191c8['status'](_0x3717bb)['json'](_0x54425b);}};}function respondWithFilteredResult(_0x723573,_0x47f03a){return function(_0x18b2ac){if(_0x18b2ac){var _0xedac0a=typeof _0x47f03a[_0x9ff9('0x1a')]==='undefined'&&typeof _0x47f03a[_0x9ff9('0x1b')]===_0x9ff9('0x1c');var _0x4066b9=_0x18b2ac['count'];var _0x36ab0a=_0xedac0a?0x0:_0x47f03a[_0x9ff9('0x1a')];var _0x1e187a=_0xedac0a?_0x18b2ac[_0x9ff9('0x1d')]:_0x47f03a[_0x9ff9('0x1a')]+_0x47f03a[_0x9ff9('0x1b')];var _0x409eea;if(_0x1e187a>=_0x4066b9){_0x1e187a=_0x4066b9;_0x409eea=0xc8;}else{_0x409eea=0xce;}_0x723573[_0x9ff9('0x19')](_0x409eea);return _0x723573[_0x9ff9('0x1e')](_0x9ff9('0x1f'),_0x36ab0a+'-'+_0x1e187a+'/'+_0x4066b9)['json'](_0x18b2ac);}return null;};}function patchUpdates(_0x28ced4){return function(_0x1b3c29){try{jsonpatch[_0x9ff9('0x20')](_0x1b3c29,_0x28ced4,!![]);}catch(_0x10ec15){return BPromise[_0x9ff9('0x21')](_0x10ec15);}return _0x1b3c29['save']();};}function saveUpdates(_0x91b01d,_0x4b971d){return function(_0x35a034){if(_0x35a034){return _0x35a034[_0x9ff9('0x22')](_0x91b01d)[_0x9ff9('0x23')](function(_0x38c205){return _0x38c205;});}return null;};}function removeEntity(_0x3ab76c,_0x31b329){return function(_0x42ab6d){if(_0x42ab6d){return _0x42ab6d[_0x9ff9('0x24')]()['then'](function(){_0x3ab76c[_0x9ff9('0x19')](0xcc)[_0x9ff9('0x25')]();});}};}function handleEntityNotFound(_0x398370,_0x71d2c3){return function(_0x15a035){if(!_0x15a035){_0x398370[_0x9ff9('0x26')](0x194);}return _0x15a035;};}function handleError(_0x515598,_0x3ef52c){_0x3ef52c=_0x3ef52c||0x1f4;return function(_0x41fcfa){logger['error'](_0x41fcfa[_0x9ff9('0x27')]);if(_0x41fcfa['name']){delete _0x41fcfa[_0x9ff9('0x28')];}_0x515598[_0x9ff9('0x19')](_0x3ef52c)['send'](_0x41fcfa);};}exports[_0x9ff9('0x29')]=function(_0x5d0240,_0x1ded2b){var _0x5c426c={},_0x47b297={},_0xe53cfa={'count':0x0,'rows':[]};var _0x3ff90f=_[_0x9ff9('0x2a')](db['ServicenowField'][_0x9ff9('0x2b')],function(_0x375c4c){return{'name':_0x375c4c['fieldName'],'type':_0x375c4c[_0x9ff9('0x2c')][_0x9ff9('0x2d')]};});_0x47b297['model']=_[_0x9ff9('0x2a')](_0x3ff90f,_0x9ff9('0x28'));_0x47b297[_0x9ff9('0x2e')]=_[_0x9ff9('0x2f')](_0x5d0240[_0x9ff9('0x2e')]);_0x47b297[_0x9ff9('0x30')]=_[_0x9ff9('0x31')](_0x47b297[_0x9ff9('0x32')],_0x47b297[_0x9ff9('0x2e')]);_0x5c426c[_0x9ff9('0x33')]=_['intersection'](_0x47b297[_0x9ff9('0x32')],qs['fields'](_0x5d0240[_0x9ff9('0x2e')][_0x9ff9('0x34')]));_0x5c426c['attributes']=_0x5c426c['attributes']['length']?_0x5c426c[_0x9ff9('0x33')]:_0x47b297[_0x9ff9('0x32')];if(!_0x5d0240[_0x9ff9('0x2e')][_0x9ff9('0x35')]('nolimit')){_0x5c426c[_0x9ff9('0x1b')]=qs[_0x9ff9('0x1b')](_0x5d0240[_0x9ff9('0x2e')][_0x9ff9('0x1b')]);_0x5c426c[_0x9ff9('0x1a')]=qs[_0x9ff9('0x1a')](_0x5d0240[_0x9ff9('0x2e')]['offset']);}_0x5c426c[_0x9ff9('0x36')]=qs[_0x9ff9('0x37')](_0x5d0240['query'][_0x9ff9('0x37')]);_0x5c426c[_0x9ff9('0x38')]=qs[_0x9ff9('0x30')](_['pick'](_0x5d0240[_0x9ff9('0x2e')],_0x47b297[_0x9ff9('0x30')]),_0x3ff90f);if(_0x5d0240[_0x9ff9('0x2e')]['filter']){_0x5c426c['where']=_[_0x9ff9('0x39')](_0x5c426c[_0x9ff9('0x38')],{'$or':_[_0x9ff9('0x2a')](_0x3ff90f,function(_0xe0c00){if(_0xe0c00[_0x9ff9('0x2c')]!==_0x9ff9('0x3a')){var _0x50c9b1={};_0x50c9b1[_0xe0c00[_0x9ff9('0x28')]]={'$like':'%'+_0x5d0240[_0x9ff9('0x2e')][_0x9ff9('0x3b')]+'%'};return _0x50c9b1;}})});}_0x5c426c=_[_0x9ff9('0x39')]({},_0x5c426c,_0x5d0240[_0x9ff9('0x3c')]);var _0x528150={'where':_0x5c426c[_0x9ff9('0x38')]};return db['ServicenowField'][_0x9ff9('0x1d')](_0x528150)['then'](function(_0x33ee88){_0xe53cfa[_0x9ff9('0x1d')]=_0x33ee88;if(_0x5d0240[_0x9ff9('0x2e')]['includeAll']){_0x5c426c[_0x9ff9('0x3d')]=[{'all':!![]}];}return db[_0x9ff9('0x3e')][_0x9ff9('0x3f')](_0x5c426c);})['then'](function(_0xd0c7f3){_0xe53cfa[_0x9ff9('0x40')]=_0xd0c7f3;return _0xe53cfa;})[_0x9ff9('0x23')](respondWithFilteredResult(_0x1ded2b,_0x5c426c))['catch'](handleError(_0x1ded2b,null));};exports[_0x9ff9('0x41')]=function(_0x3451ee,_0x223a93){var _0x19481b={'raw':!![],'where':{'id':_0x3451ee[_0x9ff9('0x42')]['id']}},_0x43af51={};_0x43af51[_0x9ff9('0x32')]=_[_0x9ff9('0x2f')](db[_0x9ff9('0x3e')]['rawAttributes']);_0x43af51['query']=_['keys'](_0x3451ee[_0x9ff9('0x2e')]);_0x43af51[_0x9ff9('0x30')]=_[_0x9ff9('0x31')](_0x43af51[_0x9ff9('0x32')],_0x43af51[_0x9ff9('0x2e')]);_0x19481b[_0x9ff9('0x33')]=_[_0x9ff9('0x31')](_0x43af51[_0x9ff9('0x32')],qs[_0x9ff9('0x34')](_0x3451ee[_0x9ff9('0x2e')][_0x9ff9('0x34')]));_0x19481b['attributes']=_0x19481b[_0x9ff9('0x33')][_0x9ff9('0x43')]?_0x19481b[_0x9ff9('0x33')]:_0x43af51[_0x9ff9('0x32')];if(_0x3451ee['query'][_0x9ff9('0x44')]){_0x19481b[_0x9ff9('0x3d')]=[{'all':!![]}];}_0x19481b=_[_0x9ff9('0x39')]({},_0x19481b,_0x3451ee[_0x9ff9('0x3c')]);return db['ServicenowField'][_0x9ff9('0x45')](_0x19481b)[_0x9ff9('0x23')](handleEntityNotFound(_0x223a93,null))[_0x9ff9('0x23')](respondWithResult(_0x223a93,null))[_0x9ff9('0x46')](handleError(_0x223a93,null));};exports[_0x9ff9('0x47')]=function(_0x2f5ffe,_0x4ece61){return db[_0x9ff9('0x3e')][_0x9ff9('0x47')](_0x2f5ffe['body'],{})['then'](respondWithResult(_0x4ece61,0xc9))['catch'](handleError(_0x4ece61,null));};exports[_0x9ff9('0x22')]=function(_0x6446f4,_0x171a00){if(_0x6446f4['body']['id']){delete _0x6446f4[_0x9ff9('0x48')]['id'];}return db[_0x9ff9('0x3e')][_0x9ff9('0x45')]({'where':{'id':_0x6446f4['params']['id']}})[_0x9ff9('0x23')](handleEntityNotFound(_0x171a00,null))[_0x9ff9('0x23')](saveUpdates(_0x6446f4[_0x9ff9('0x48')],null))[_0x9ff9('0x23')](respondWithResult(_0x171a00,null))[_0x9ff9('0x46')](handleError(_0x171a00,null));};exports['destroy']=function(_0x2fdc2c,_0x39df18){return db[_0x9ff9('0x3e')][_0x9ff9('0x45')]({'where':{'id':_0x2fdc2c[_0x9ff9('0x42')]['id']}})[_0x9ff9('0x23')](handleEntityNotFound(_0x39df18,null))['then'](removeEntity(_0x39df18,null))[_0x9ff9('0x46')](handleError(_0x39df18,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 971c683..afa97a8 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 _0x7350=['bluebird','path','rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7350,0x6c));var _0x0735=function(_0x30a573,_0x560975){_0x30a573=_0x30a573-0x0;var _0x2094cf=_0x7350[_0x30a573];return _0x2094cf;};'use strict';var _=require(_0x0735('0x0'));var util=require(_0x0735('0x1'));var logger=require(_0x0735('0x2'))(_0x0735('0x3'));var moment=require('moment');var BPromise=require(_0x0735('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0735('0x5'));var rimraf=require(_0x0735('0x6'));var config=require(_0x0735('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x0735('0x8')]=function(_0x3255db,_0xb94f81){return _0x3255db[_0x0735('0x9')](_0x0735('0xa'),attributes,{'tableName':_0x0735('0xb'),'paranoid':![],'indexes':[{'name':_0x0735('0xc'),'fields':['idField',_0x0735('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39ad=['api','moment','bluebird','path','rimraf','../../config/environment','exports','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x39ad,0xcf));var _0xd39a=function(_0x18afd7,_0x2bb7c3){_0x18afd7=_0x18afd7-0x0;var _0x4d212a=_0x39ad[_0x18afd7];return _0x4d212a;};'use strict';var _=require(_0xd39a('0x0'));var util=require(_0xd39a('0x1'));var logger=require(_0xd39a('0x2'))(_0xd39a('0x3'));var moment=require(_0xd39a('0x4'));var BPromise=require(_0xd39a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd39a('0x6'));var rimraf=require(_0xd39a('0x7'));var config=require(_0xd39a('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xd39a('0x9')]=function(_0xb6f2,_0x1579b8){return _0xb6f2['define'](_0xd39a('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xd39a('0xb'),'fields':[_0xd39a('0xc'),_0xd39a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 9e66d95..eb34e8b 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2d049e,_0x4af4b8){var _0x366747=function(_0x3af23c){while(--_0x3af23c){_0x2d049e['push'](_0x2d049e['shift']());}};_0x366747(++_0x4af4b8);}(_0xe706,0xa3));var _0x6e70=function(_0x3ee8b1,_0x375088){_0x3ee8b1=_0x3ee8b1-0x0;var _0x53aa77=_0xe706[_0x3ee8b1];return _0x53aa77;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1f7f08,_0x408158){var _0x4701ca=function(_0x505d9c){while(--_0x505d9c){_0x1f7f08['push'](_0x1f7f08['shift']());}};_0x4701ca(++_0x408158);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7587439..1c27b86 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(_0x2adfbc,_0x26c06c){var _0x30400c=function(_0x781695){while(--_0x781695){_0x2adfbc['push'](_0x2adfbc['shift']());}};_0x30400c(++_0x26c06c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x53d11d,_0x4a704e){var _0x3231ab=function(_0x4e2511){while(--_0x4e2511){_0x53d11d['push'](_0x53d11d['shift']());}};_0x3231ab(++_0x4a704e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 3b74071..866b949 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(_0x32060c,_0x47f13d){var _0x1fc312=function(_0x3a46a1){while(--_0x3a46a1){_0x32060c['push'](_0x32060c['shift']());}};_0x1fc312(++_0x47f13d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x20d0d5,_0x234e4d){var _0xd88495=function(_0x2c955e){while(--_0x2c955e){_0x20d0d5['push'](_0x20d0d5['shift']());}};_0xd88495(++_0x234e4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 43a914c..a787370 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 _0x4361=['rawAttributes','create','body','find','getConfigurations','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','username','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','get_module_fields','module_fields','remove','includes','label','endsWith','value','test','statusCode','error','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params'];(function(_0x190f80,_0x2b7584){var _0x8aa4e0=function(_0x205a1d){while(--_0x205a1d){_0x190f80['push'](_0x190f80['shift']());}};_0x8aa4e0(++_0x2b7584);}(_0x4361,0xa8));var _0x1436=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x4361[_0x49ca18];return _0x145d54;};'use strict';var emlformat=require(_0x1436('0x0'));var rimraf=require(_0x1436('0x1'));var zipdir=require(_0x1436('0x2'));var jsonpatch=require(_0x1436('0x3'));var rp=require(_0x1436('0x4'));var moment=require(_0x1436('0x5'));var BPromise=require(_0x1436('0x6'));var Mustache=require(_0x1436('0x7'));var util=require(_0x1436('0x8'));var path=require('path');var sox=require(_0x1436('0x9'));var csv=require(_0x1436('0xa'));var ejs=require(_0x1436('0xb'));var fs=require('fs');var fs_extra=require(_0x1436('0xc'));var _=require(_0x1436('0xd'));var squel=require(_0x1436('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1436('0xf'));var toCsv=require(_0x1436('0xa'));var querystring=require('querystring');var Papa=require(_0x1436('0x10'));var Redis=require(_0x1436('0x11'));var authService=require(_0x1436('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1436('0x13'));var logger=require(_0x1436('0x14'))(_0x1436('0x15'));var utils=require(_0x1436('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1436('0x17'));var db=require(_0x1436('0x18'))['db'];var integrations=require(_0x1436('0x19'));function respondWithStatusCode(_0x29f3cf,_0x5e5cc1){_0x5e5cc1=_0x5e5cc1||0xcc;return function(_0x2818ed){if(_0x2818ed){return _0x29f3cf[_0x1436('0x1a')](_0x5e5cc1);}return _0x29f3cf['status'](_0x5e5cc1)['end']();};}function respondWithResult(_0x2b9bd7,_0x309aa7){_0x309aa7=_0x309aa7||0xc8;return function(_0x54b4db){if(_0x54b4db){return _0x2b9bd7[_0x1436('0x1b')](_0x309aa7)[_0x1436('0x1c')](_0x54b4db);}};}function respondWithFilteredResult(_0x227bfd,_0xd3aded){return function(_0x367cbd){if(_0x367cbd){var _0x48b7dd=typeof _0xd3aded[_0x1436('0x1d')]===_0x1436('0x1e')&&typeof _0xd3aded['limit']===_0x1436('0x1e');var _0x12bd6c=_0x367cbd['count'];var _0x24f667=_0x48b7dd?0x0:_0xd3aded[_0x1436('0x1d')];var _0x40748e=_0x48b7dd?_0x367cbd[_0x1436('0x1f')]:_0xd3aded['offset']+_0xd3aded[_0x1436('0x20')];var _0x3d344d;if(_0x40748e>=_0x12bd6c){_0x40748e=_0x12bd6c;_0x3d344d=0xc8;}else{_0x3d344d=0xce;}_0x227bfd[_0x1436('0x1b')](_0x3d344d);return _0x227bfd[_0x1436('0x21')](_0x1436('0x22'),_0x24f667+'-'+_0x40748e+'/'+_0x12bd6c)[_0x1436('0x1c')](_0x367cbd);}return null;};}function patchUpdates(_0x475dce){return function(_0x7e8f9){try{jsonpatch[_0x1436('0x23')](_0x7e8f9,_0x475dce,!![]);}catch(_0x3c98cc){return BPromise[_0x1436('0x24')](_0x3c98cc);}return _0x7e8f9[_0x1436('0x25')]();};}function saveUpdates(_0x38791a,_0x485b62){return function(_0x19f1bd){if(_0x19f1bd){return _0x19f1bd[_0x1436('0x26')](_0x38791a)['then'](function(_0x20e176){return _0x20e176;});}return null;};}function removeEntity(_0x53cb8b,_0x5368ae){return function(_0x42a596){if(_0x42a596){return _0x42a596[_0x1436('0x27')]()[_0x1436('0x28')](function(){_0x53cb8b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35da6e,_0x3ad2c8){return function(_0x1f7e07){if(!_0x1f7e07){_0x35da6e[_0x1436('0x1a')](0x194);}return _0x1f7e07;};}function handleError(_0x13c538,_0x44cc67){_0x44cc67=_0x44cc67||0x1f4;return function(_0x236622){logger['error'](_0x236622[_0x1436('0x29')]);if(_0x236622[_0x1436('0x2a')]){delete _0x236622['name'];}_0x13c538[_0x1436('0x1b')](_0x44cc67)[_0x1436('0x2b')](_0x236622);};}exports[_0x1436('0x2c')]=function(_0x206ba8,_0x4627cc){var _0x20afe9={},_0x48ab09={},_0x268013={'count':0x0,'rows':[]};var _0x2477f3=_[_0x1436('0x2d')](db['SugarcrmAccount']['rawAttributes'],function(_0x39d478){return{'name':_0x39d478[_0x1436('0x2e')],'type':_0x39d478[_0x1436('0x2f')][_0x1436('0x30')]};});_0x48ab09[_0x1436('0x31')]=_[_0x1436('0x2d')](_0x2477f3,_0x1436('0x2a'));_0x48ab09[_0x1436('0x32')]=_[_0x1436('0x33')](_0x206ba8[_0x1436('0x32')]);_0x48ab09[_0x1436('0x34')]=_[_0x1436('0x35')](_0x48ab09['model'],_0x48ab09[_0x1436('0x32')]);_0x20afe9['attributes']=_[_0x1436('0x35')](_0x48ab09[_0x1436('0x31')],qs['fields'](_0x206ba8[_0x1436('0x32')][_0x1436('0x36')]));_0x20afe9[_0x1436('0x37')]=_0x20afe9['attributes'][_0x1436('0x38')]?_0x20afe9['attributes']:_0x48ab09['model'];if(!_0x206ba8[_0x1436('0x32')]['hasOwnProperty'](_0x1436('0x39'))){_0x20afe9['limit']=qs['limit'](_0x206ba8[_0x1436('0x32')][_0x1436('0x20')]);_0x20afe9[_0x1436('0x1d')]=qs[_0x1436('0x1d')](_0x206ba8['query'][_0x1436('0x1d')]);}_0x20afe9[_0x1436('0x3a')]=qs[_0x1436('0x3b')](_0x206ba8[_0x1436('0x32')][_0x1436('0x3b')]);_0x20afe9[_0x1436('0x3c')]=qs[_0x1436('0x34')](_[_0x1436('0x3d')](_0x206ba8[_0x1436('0x32')],_0x48ab09[_0x1436('0x34')]),_0x2477f3);if(_0x206ba8[_0x1436('0x32')][_0x1436('0x3e')]){_0x20afe9[_0x1436('0x3c')]=_[_0x1436('0x3f')](_0x20afe9[_0x1436('0x3c')],{'$or':_[_0x1436('0x2d')](_0x2477f3,function(_0x16ced8){if(_0x16ced8['type']!==_0x1436('0x40')){var _0x2bd3f3={};_0x2bd3f3[_0x16ced8[_0x1436('0x2a')]]={'$like':'%'+_0x206ba8[_0x1436('0x32')][_0x1436('0x3e')]+'%'};return _0x2bd3f3;}})});}_0x20afe9=_['merge']({},_0x20afe9,_0x206ba8[_0x1436('0x41')]);var _0x16d838={'where':_0x20afe9[_0x1436('0x3c')]};return db[_0x1436('0x42')][_0x1436('0x1f')](_0x16d838)[_0x1436('0x28')](function(_0x40c4e1){_0x268013[_0x1436('0x1f')]=_0x40c4e1;if(_0x206ba8[_0x1436('0x32')][_0x1436('0x43')]){_0x20afe9[_0x1436('0x44')]=[{'all':!![]}];}return db[_0x1436('0x42')][_0x1436('0x45')](_0x20afe9);})[_0x1436('0x28')](function(_0x24a130){_0x268013[_0x1436('0x46')]=_0x24a130;return _0x268013;})['then'](respondWithFilteredResult(_0x4627cc,_0x20afe9))[_0x1436('0x47')](handleError(_0x4627cc,null));};exports[_0x1436('0x48')]=function(_0x492e05,_0x5d88ab){var _0x26764f={'raw':![],'where':{'id':_0x492e05[_0x1436('0x49')]['id']}},_0x32b9a1={};_0x32b9a1[_0x1436('0x31')]=_[_0x1436('0x33')](db['SugarcrmAccount'][_0x1436('0x4a')]);_0x32b9a1[_0x1436('0x32')]=_[_0x1436('0x33')](_0x492e05[_0x1436('0x32')]);_0x32b9a1['filters']=_[_0x1436('0x35')](_0x32b9a1[_0x1436('0x31')],_0x32b9a1['query']);_0x26764f['attributes']=_[_0x1436('0x35')](_0x32b9a1['model'],qs[_0x1436('0x36')](_0x492e05[_0x1436('0x32')]['fields']));_0x26764f[_0x1436('0x37')]=_0x26764f[_0x1436('0x37')][_0x1436('0x38')]?_0x26764f[_0x1436('0x37')]:_0x32b9a1['model'];if(_0x492e05[_0x1436('0x32')]['includeAll']){_0x26764f['include']=[{'all':!![]}];}_0x26764f=_[_0x1436('0x3f')]({},_0x26764f,_0x492e05[_0x1436('0x41')]);return db[_0x1436('0x42')]['find'](_0x26764f)['then'](handleEntityNotFound(_0x5d88ab,null))[_0x1436('0x28')](respondWithResult(_0x5d88ab,null))[_0x1436('0x47')](handleError(_0x5d88ab,null));};exports[_0x1436('0x4b')]=function(_0x42430a,_0x52f2c7){return db[_0x1436('0x42')]['create'](_0x42430a[_0x1436('0x4c')],{})['then'](respondWithResult(_0x52f2c7,0xc9))[_0x1436('0x47')](handleError(_0x52f2c7,null));};exports[_0x1436('0x26')]=function(_0x1061bf,_0x1ba80a){if(_0x1061bf['body']['id']){delete _0x1061bf[_0x1436('0x4c')]['id'];}return db['SugarcrmAccount'][_0x1436('0x4d')]({'where':{'id':_0x1061bf['params']['id']}})[_0x1436('0x28')](handleEntityNotFound(_0x1ba80a,null))[_0x1436('0x28')](saveUpdates(_0x1061bf['body'],null))[_0x1436('0x28')](respondWithResult(_0x1ba80a,null))[_0x1436('0x47')](handleError(_0x1ba80a,null));};exports[_0x1436('0x27')]=function(_0x31c6a4,_0x2001f2){return db[_0x1436('0x42')][_0x1436('0x4d')]({'where':{'id':_0x31c6a4['params']['id']}})[_0x1436('0x28')](handleEntityNotFound(_0x2001f2,null))['then'](removeEntity(_0x2001f2,null))[_0x1436('0x47')](handleError(_0x2001f2,null));};exports[_0x1436('0x4e')]=function(_0x77d4c4,_0x2bf53e,_0x5f2006){var _0x145d0e={};var _0x3d69e3={};var _0x4d3487;var _0x45c6d0;return db[_0x1436('0x42')]['findOne']({'where':{'id':_0x77d4c4[_0x1436('0x49')]['id']}})[_0x1436('0x28')](handleEntityNotFound(_0x2bf53e,null))['then'](function(_0x4735df){if(_0x4735df){_0x4d3487=_0x4735df;_0x3d69e3[_0x1436('0x31')]=_[_0x1436('0x33')](db['SugarcrmConfiguration']['rawAttributes']);_0x3d69e3[_0x1436('0x32')]=_[_0x1436('0x33')](_0x77d4c4[_0x1436('0x32')]);_0x3d69e3[_0x1436('0x34')]=_[_0x1436('0x35')](_0x3d69e3['model'],_0x3d69e3[_0x1436('0x32')]);_0x145d0e['attributes']=_[_0x1436('0x35')](_0x3d69e3[_0x1436('0x31')],qs[_0x1436('0x36')](_0x77d4c4[_0x1436('0x32')]['fields']));_0x145d0e[_0x1436('0x37')]=_0x145d0e[_0x1436('0x37')][_0x1436('0x38')]?_0x145d0e[_0x1436('0x37')]:_0x3d69e3['model'];_0x145d0e[_0x1436('0x3a')]=qs[_0x1436('0x3b')](_0x77d4c4[_0x1436('0x32')]['sort']);_0x145d0e[_0x1436('0x3c')]=qs['filters'](_[_0x1436('0x3d')](_0x77d4c4[_0x1436('0x32')],_0x3d69e3[_0x1436('0x34')]));if(_0x77d4c4['query'][_0x1436('0x3e')]){_0x145d0e['where']=_['merge'](_0x145d0e[_0x1436('0x3c')],{'$or':_[_0x1436('0x2d')](_0x145d0e[_0x1436('0x37')],function(_0xc4989c){var _0x1b6ce7={};_0x1b6ce7[_0xc4989c]={'$like':'%'+_0x77d4c4['query'][_0x1436('0x3e')]+'%'};return _0x1b6ce7;})});}_0x145d0e=_[_0x1436('0x3f')]({},_0x145d0e,_0x77d4c4[_0x1436('0x41')]);return _0x4d3487[_0x1436('0x4e')](_0x145d0e);}})['then'](function(_0x1d1f85){if(_0x1d1f85){_0x45c6d0=_0x1d1f85[_0x1436('0x38')];if(!_0x77d4c4[_0x1436('0x32')][_0x1436('0x4f')](_0x1436('0x39'))){_0x145d0e[_0x1436('0x20')]=qs['limit'](_0x77d4c4[_0x1436('0x32')][_0x1436('0x20')]);_0x145d0e[_0x1436('0x1d')]=qs['offset'](_0x77d4c4[_0x1436('0x32')][_0x1436('0x1d')]);}return _0x4d3487[_0x1436('0x4e')](_0x145d0e);}})['then'](function(_0x22c9a5){if(_0x22c9a5){return _0x22c9a5?{'count':_0x45c6d0,'rows':_0x22c9a5}:null;}})[_0x1436('0x28')](respondWithResult(_0x2bf53e,null))[_0x1436('0x47')](handleError(_0x2bf53e,null));};exports['addConfiguration']=function(_0x139677,_0x40bdca,_0x9c9923){if(_0x139677['body']['id']){delete _0x139677[_0x1436('0x4c')]['id'];}return db[_0x1436('0x42')][_0x1436('0x50')]({'where':{'id':_0x139677[_0x1436('0x49')]['id']}})['then'](handleEntityNotFound(_0x40bdca,null))[_0x1436('0x28')](function(_0x21f4fb){if(_0x21f4fb){_0x139677[_0x1436('0x4c')][_0x1436('0x51')]=_0x21f4fb['id'];_0x139677[_0x1436('0x4c')][_0x1436('0x52')]=integrations[_0x1436('0x53')](_0x139677[_0x1436('0x4c')][_0x1436('0x54')],_0x139677[_0x1436('0x4c')][_0x1436('0x2f')]);_0x139677[_0x1436('0x4c')]['Descriptions']=integrations[_0x1436('0x55')](_0x139677[_0x1436('0x4c')][_0x1436('0x54')],_0x139677[_0x1436('0x4c')][_0x1436('0x2f')]);return db['SugarcrmConfiguration'][_0x1436('0x4b')](_0x139677['body'],{'include':[{'model':db[_0x1436('0x56')],'as':_0x1436('0x52')},{'model':db[_0x1436('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x40bdca,null))[_0x1436('0x47')](handleError(_0x40bdca,null));};exports[_0x1436('0x57')]=function(_0x2ba915,_0x2ecea7,_0x5f0642){var _0xa47a3c='';var _0x296c87=['id',_0x1436('0x2a'),_0x1436('0x58'),_0x1436('0x59'),_0x1436('0x5a'),_0x1436('0x5b'),_0x1436('0x5c'),_0x1436('0x5d'),_0x1436('0x5e'),_0x1436('0x5f'),'parent_name','direction'];return db[_0x1436('0x42')][_0x1436('0x50')]({'where':{'id':_0x2ba915[_0x1436('0x49')]['id']},'attributes':['id',_0x1436('0x60'),_0x1436('0x61'),_0x1436('0x62')]})[_0x1436('0x28')](handleEntityNotFound(_0x2ecea7,null))[_0x1436('0x28')](function(_0x4e1837){if(_0x4e1837){_0xa47a3c=_0x4e1837[_0x1436('0x62')];var _0x368e02=_0xa47a3c['slice'](-0x1);if(_0x368e02==='/'){_0xa47a3c=_0xa47a3c[_0x1436('0x63')](0x0,_0xa47a3c[_0x1436('0x64')](_0x368e02));}return rp({'method':_0x1436('0x65'),'uri':util[_0x1436('0x66')](_0x1436('0x67'),_0xa47a3c,_0x1436('0x68')),'json':!![],'form':{'method':_0x1436('0x69'),'input_type':_0x1436('0x6a'),'response_type':_0x1436('0x6a'),'rest_data':JSON[_0x1436('0x6b')]({'user_auth':{'user_name':_0x4e1837[_0x1436('0x60')],'password':_0x4e1837[_0x1436('0x61')],'encryption':_0x1436('0x6c')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x1436('0x28')](function(_0x25fcc0){if(_0x25fcc0&&_0x25fcc0[_0x1436('0x2a')]!==_0x1436('0x6d')&&_0x25fcc0[_0x1436('0x2a')]!=='Password\x20Expired'){return rp({'method':_0x1436('0x65'),'uri':util['format'](_0x1436('0x67'),_0xa47a3c,_0x1436('0x68')),'json':!![],'form':{'method':_0x1436('0x6e'),'input_type':_0x1436('0x6a'),'response_type':_0x1436('0x6a'),'rest_data':JSON[_0x1436('0x6b')]({'session':_0x25fcc0['id'],'module_name':'Calls'})}})[_0x1436('0x28')](function(_0x5ae9dd){if(_0x5ae9dd){var _0x26d469=_['values'](_0x5ae9dd[_0x1436('0x6f')]);_[_0x1436('0x70')](_0x26d469,function(_0x1adf3b){return _0x296c87[_0x1436('0x71')](_0x1adf3b[_0x1436('0x2a')]);});return{'count':_0x26d469['length'],'rows':_[_0x1436('0x2d')](_0x26d469,function(_0x5edae5){return{'id':_0x5edae5[_0x1436('0x2a')],'name':_0x5edae5[_0x1436('0x72')],'custom':_[_0x1436('0x73')](_0x5edae5[_0x1436('0x2a')],'_c')?!![]:![],'options':_0x5edae5[_0x1436('0x41')]?_[_0x1436('0x2d')](_['values'](_0x5edae5[_0x1436('0x41')]),function(_0x4bd606){return{'name':_0x4bd606[_0x1436('0x74')],'value':_0x4bd606[_0x1436('0x2a')]};}):[]};})};}})['then'](respondWithResult(_0x2ecea7,null))[_0x1436('0x47')](function(_0x49b1b6){var _0x3bbe65=_0x2ba915[_0x1436('0x32')][_0x1436('0x75')]?0x1f4:_0x49b1b6[_0x1436('0x76')]||0x1f4;logger[_0x1436('0x77')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3bbe65,JSON[_0x1436('0x6b')](_0x49b1b6));delete _0x49b1b6[_0x1436('0x2a')];if(_0x3bbe65===0x191){_0x3bbe65=0x190;}_0x2ecea7['status'](_0x3bbe65)['send'](_0x2ba915[_0x1436('0x32')][_0x1436('0x75')]?{'message':_0x1436('0x78'),'statusCode':_0x49b1b6[_0x1436('0x76')]}:_0x49b1b6);});}else{var _0x27b5be=0x1f4;_0x2ecea7[_0x1436('0x1b')](_0x27b5be)[_0x1436('0x2b')]({'message':_0x1436('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x3aae=['duration_minutes','parent_type','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','JSON','stringify','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','endsWith','value','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','description','date_start'];(function(_0x50ed47,_0x28cc70){var _0x2260c1=function(_0x3cc8d6){while(--_0x3cc8d6){_0x50ed47['push'](_0x50ed47['shift']());}};_0x2260c1(++_0x28cc70);}(_0x3aae,0x167));var _0xe3aa=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3aae[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xe3aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3aa('0x1'));var jsonpatch=require(_0xe3aa('0x2'));var rp=require(_0xe3aa('0x3'));var moment=require('moment');var BPromise=require(_0xe3aa('0x4'));var Mustache=require(_0xe3aa('0x5'));var util=require('util');var path=require(_0xe3aa('0x6'));var sox=require(_0xe3aa('0x7'));var csv=require(_0xe3aa('0x8'));var ejs=require(_0xe3aa('0x9'));var fs=require('fs');var fs_extra=require(_0xe3aa('0xa'));var _=require(_0xe3aa('0xb'));var squel=require(_0xe3aa('0xc'));var crypto=require(_0xe3aa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe3aa('0xe'));var toCsv=require(_0xe3aa('0x8'));var querystring=require(_0xe3aa('0xf'));var Papa=require('papaparse');var Redis=require(_0xe3aa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe3aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3aa('0x12'));var logger=require(_0xe3aa('0x13'))('api');var utils=require(_0xe3aa('0x14'));var config=require(_0xe3aa('0x15'));var licenseUtil=require(_0xe3aa('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1279f0,_0xfd8dac){_0xfd8dac=_0xfd8dac||0xcc;return function(_0x349baf){if(_0x349baf){return _0x1279f0[_0xe3aa('0x17')](_0xfd8dac);}return _0x1279f0[_0xe3aa('0x18')](_0xfd8dac)[_0xe3aa('0x19')]();};}function respondWithResult(_0x45e273,_0x5bc0c0){_0x5bc0c0=_0x5bc0c0||0xc8;return function(_0x26df54){if(_0x26df54){return _0x45e273[_0xe3aa('0x18')](_0x5bc0c0)[_0xe3aa('0x1a')](_0x26df54);}};}function respondWithFilteredResult(_0x3e0530,_0x109696){return function(_0x29d22f){if(_0x29d22f){var _0x4d8059=typeof _0x109696[_0xe3aa('0x1b')]===_0xe3aa('0x1c')&&typeof _0x109696[_0xe3aa('0x1d')]===_0xe3aa('0x1c');var _0x4a6b41=_0x29d22f[_0xe3aa('0x1e')];var _0x285af2=_0x4d8059?0x0:_0x109696[_0xe3aa('0x1b')];var _0x3d3122=_0x4d8059?_0x29d22f[_0xe3aa('0x1e')]:_0x109696[_0xe3aa('0x1b')]+_0x109696[_0xe3aa('0x1d')];var _0x235918;if(_0x3d3122>=_0x4a6b41){_0x3d3122=_0x4a6b41;_0x235918=0xc8;}else{_0x235918=0xce;}_0x3e0530[_0xe3aa('0x18')](_0x235918);return _0x3e0530[_0xe3aa('0x1f')]('Content-Range',_0x285af2+'-'+_0x3d3122+'/'+_0x4a6b41)[_0xe3aa('0x1a')](_0x29d22f);}return null;};}function patchUpdates(_0x546e00){return function(_0x12841c){try{jsonpatch[_0xe3aa('0x20')](_0x12841c,_0x546e00,!![]);}catch(_0x43120f){return BPromise[_0xe3aa('0x21')](_0x43120f);}return _0x12841c[_0xe3aa('0x22')]();};}function saveUpdates(_0x31709e,_0x395c37){return function(_0x236707){if(_0x236707){return _0x236707[_0xe3aa('0x23')](_0x31709e)[_0xe3aa('0x24')](function(_0x3c9259){return _0x3c9259;});}return null;};}function removeEntity(_0x50e337,_0x279f70){return function(_0x3b9aba){if(_0x3b9aba){return _0x3b9aba[_0xe3aa('0x25')]()[_0xe3aa('0x24')](function(){_0x50e337[_0xe3aa('0x18')](0xcc)[_0xe3aa('0x19')]();});}};}function handleEntityNotFound(_0xe9ebeb,_0x3a6919){return function(_0x28ca59){if(!_0x28ca59){_0xe9ebeb[_0xe3aa('0x17')](0x194);}return _0x28ca59;};}function handleError(_0x380a44,_0x127117){_0x127117=_0x127117||0x1f4;return function(_0x4b5171){logger['error'](_0x4b5171[_0xe3aa('0x26')]);if(_0x4b5171[_0xe3aa('0x27')]){delete _0x4b5171[_0xe3aa('0x27')];}_0x380a44['status'](_0x127117)['send'](_0x4b5171);};}exports[_0xe3aa('0x28')]=function(_0x165d41,_0x3675a0){var _0x4cdbea={},_0x3ec8b6={},_0x2e9625={'count':0x0,'rows':[]};var _0x4f3e17=_[_0xe3aa('0x29')](db[_0xe3aa('0x2a')][_0xe3aa('0x2b')],function(_0x478378){return{'name':_0x478378[_0xe3aa('0x2c')],'type':_0x478378[_0xe3aa('0x2d')][_0xe3aa('0x2e')]};});_0x3ec8b6[_0xe3aa('0x2f')]=_[_0xe3aa('0x29')](_0x4f3e17,'name');_0x3ec8b6[_0xe3aa('0x30')]=_[_0xe3aa('0x31')](_0x165d41['query']);_0x3ec8b6['filters']=_[_0xe3aa('0x32')](_0x3ec8b6['model'],_0x3ec8b6[_0xe3aa('0x30')]);_0x4cdbea[_0xe3aa('0x33')]=_['intersection'](_0x3ec8b6[_0xe3aa('0x2f')],qs['fields'](_0x165d41[_0xe3aa('0x30')][_0xe3aa('0x34')]));_0x4cdbea[_0xe3aa('0x33')]=_0x4cdbea[_0xe3aa('0x33')][_0xe3aa('0x35')]?_0x4cdbea[_0xe3aa('0x33')]:_0x3ec8b6[_0xe3aa('0x2f')];if(!_0x165d41[_0xe3aa('0x30')][_0xe3aa('0x36')](_0xe3aa('0x37'))){_0x4cdbea[_0xe3aa('0x1d')]=qs[_0xe3aa('0x1d')](_0x165d41[_0xe3aa('0x30')]['limit']);_0x4cdbea[_0xe3aa('0x1b')]=qs['offset'](_0x165d41[_0xe3aa('0x30')][_0xe3aa('0x1b')]);}_0x4cdbea['order']=qs[_0xe3aa('0x38')](_0x165d41[_0xe3aa('0x30')][_0xe3aa('0x38')]);_0x4cdbea[_0xe3aa('0x39')]=qs[_0xe3aa('0x3a')](_[_0xe3aa('0x3b')](_0x165d41['query'],_0x3ec8b6[_0xe3aa('0x3a')]),_0x4f3e17);if(_0x165d41[_0xe3aa('0x30')][_0xe3aa('0x3c')]){_0x4cdbea[_0xe3aa('0x39')]=_['merge'](_0x4cdbea[_0xe3aa('0x39')],{'$or':_[_0xe3aa('0x29')](_0x4f3e17,function(_0x3fa00f){if(_0x3fa00f['type']!==_0xe3aa('0x3d')){var _0x2f0a2b={};_0x2f0a2b[_0x3fa00f[_0xe3aa('0x27')]]={'$like':'%'+_0x165d41[_0xe3aa('0x30')][_0xe3aa('0x3c')]+'%'};return _0x2f0a2b;}})});}_0x4cdbea=_[_0xe3aa('0x3e')]({},_0x4cdbea,_0x165d41[_0xe3aa('0x3f')]);var _0x15dab7={'where':_0x4cdbea[_0xe3aa('0x39')]};return db[_0xe3aa('0x2a')]['count'](_0x15dab7)[_0xe3aa('0x24')](function(_0x41e202){_0x2e9625[_0xe3aa('0x1e')]=_0x41e202;if(_0x165d41[_0xe3aa('0x30')][_0xe3aa('0x40')]){_0x4cdbea[_0xe3aa('0x41')]=[{'all':!![]}];}return db[_0xe3aa('0x2a')]['findAll'](_0x4cdbea);})[_0xe3aa('0x24')](function(_0x21520e){_0x2e9625[_0xe3aa('0x42')]=_0x21520e;return _0x2e9625;})[_0xe3aa('0x24')](respondWithFilteredResult(_0x3675a0,_0x4cdbea))[_0xe3aa('0x43')](handleError(_0x3675a0,null));};exports['show']=function(_0x1163b8,_0x22c287){var _0x929939={'raw':![],'where':{'id':_0x1163b8[_0xe3aa('0x44')]['id']}},_0x18e333={};_0x18e333[_0xe3aa('0x2f')]=_[_0xe3aa('0x31')](db['SugarcrmAccount'][_0xe3aa('0x2b')]);_0x18e333[_0xe3aa('0x30')]=_[_0xe3aa('0x31')](_0x1163b8[_0xe3aa('0x30')]);_0x18e333[_0xe3aa('0x3a')]=_[_0xe3aa('0x32')](_0x18e333[_0xe3aa('0x2f')],_0x18e333[_0xe3aa('0x30')]);_0x929939[_0xe3aa('0x33')]=_[_0xe3aa('0x32')](_0x18e333[_0xe3aa('0x2f')],qs[_0xe3aa('0x34')](_0x1163b8['query']['fields']));_0x929939[_0xe3aa('0x33')]=_0x929939['attributes'][_0xe3aa('0x35')]?_0x929939[_0xe3aa('0x33')]:_0x18e333[_0xe3aa('0x2f')];if(_0x1163b8[_0xe3aa('0x30')]['includeAll']){_0x929939[_0xe3aa('0x41')]=[{'all':!![]}];}_0x929939=_[_0xe3aa('0x3e')]({},_0x929939,_0x1163b8[_0xe3aa('0x3f')]);return db[_0xe3aa('0x2a')][_0xe3aa('0x45')](_0x929939)['then'](handleEntityNotFound(_0x22c287,null))[_0xe3aa('0x24')](respondWithResult(_0x22c287,null))[_0xe3aa('0x43')](handleError(_0x22c287,null));};exports[_0xe3aa('0x46')]=function(_0x2dca83,_0x4b15bc){return db[_0xe3aa('0x2a')]['create'](_0x2dca83['body'],{})['then'](respondWithResult(_0x4b15bc,0xc9))[_0xe3aa('0x43')](handleError(_0x4b15bc,null));};exports[_0xe3aa('0x23')]=function(_0x1217a7,_0x151758){if(_0x1217a7[_0xe3aa('0x47')]['id']){delete _0x1217a7[_0xe3aa('0x47')]['id'];}return db[_0xe3aa('0x2a')][_0xe3aa('0x45')]({'where':{'id':_0x1217a7[_0xe3aa('0x44')]['id']}})['then'](handleEntityNotFound(_0x151758,null))[_0xe3aa('0x24')](saveUpdates(_0x1217a7[_0xe3aa('0x47')],null))[_0xe3aa('0x24')](respondWithResult(_0x151758,null))[_0xe3aa('0x43')](handleError(_0x151758,null));};exports[_0xe3aa('0x25')]=function(_0x1110e1,_0x2b56eb){return db[_0xe3aa('0x2a')][_0xe3aa('0x45')]({'where':{'id':_0x1110e1[_0xe3aa('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b56eb,null))[_0xe3aa('0x24')](removeEntity(_0x2b56eb,null))[_0xe3aa('0x43')](handleError(_0x2b56eb,null));};exports[_0xe3aa('0x48')]=function(_0x57d049,_0xfb6629,_0x196749){var _0x18a375={};var _0x4954f8={};var _0x2a1752;var _0x1101c9;return db[_0xe3aa('0x2a')][_0xe3aa('0x49')]({'where':{'id':_0x57d049[_0xe3aa('0x44')]['id']}})['then'](handleEntityNotFound(_0xfb6629,null))[_0xe3aa('0x24')](function(_0x560c64){if(_0x560c64){_0x2a1752=_0x560c64;_0x4954f8[_0xe3aa('0x2f')]=_['keys'](db[_0xe3aa('0x4a')]['rawAttributes']);_0x4954f8[_0xe3aa('0x30')]=_[_0xe3aa('0x31')](_0x57d049[_0xe3aa('0x30')]);_0x4954f8['filters']=_['intersection'](_0x4954f8['model'],_0x4954f8[_0xe3aa('0x30')]);_0x18a375['attributes']=_[_0xe3aa('0x32')](_0x4954f8[_0xe3aa('0x2f')],qs[_0xe3aa('0x34')](_0x57d049[_0xe3aa('0x30')][_0xe3aa('0x34')]));_0x18a375[_0xe3aa('0x33')]=_0x18a375[_0xe3aa('0x33')]['length']?_0x18a375[_0xe3aa('0x33')]:_0x4954f8[_0xe3aa('0x2f')];_0x18a375['order']=qs[_0xe3aa('0x38')](_0x57d049[_0xe3aa('0x30')][_0xe3aa('0x38')]);_0x18a375[_0xe3aa('0x39')]=qs[_0xe3aa('0x3a')](_[_0xe3aa('0x3b')](_0x57d049[_0xe3aa('0x30')],_0x4954f8[_0xe3aa('0x3a')]));if(_0x57d049[_0xe3aa('0x30')][_0xe3aa('0x3c')]){_0x18a375[_0xe3aa('0x39')]=_['merge'](_0x18a375[_0xe3aa('0x39')],{'$or':_[_0xe3aa('0x29')](_0x18a375['attributes'],function(_0x2aecc9){var _0x135e7a={};_0x135e7a[_0x2aecc9]={'$like':'%'+_0x57d049[_0xe3aa('0x30')]['filter']+'%'};return _0x135e7a;})});}_0x18a375=_[_0xe3aa('0x3e')]({},_0x18a375,_0x57d049['options']);return _0x2a1752['getConfigurations'](_0x18a375);}})['then'](function(_0xfb58a5){if(_0xfb58a5){_0x1101c9=_0xfb58a5[_0xe3aa('0x35')];if(!_0x57d049[_0xe3aa('0x30')]['hasOwnProperty']('nolimit')){_0x18a375['limit']=qs[_0xe3aa('0x1d')](_0x57d049[_0xe3aa('0x30')][_0xe3aa('0x1d')]);_0x18a375[_0xe3aa('0x1b')]=qs[_0xe3aa('0x1b')](_0x57d049[_0xe3aa('0x30')][_0xe3aa('0x1b')]);}return _0x2a1752['getConfigurations'](_0x18a375);}})[_0xe3aa('0x24')](function(_0x4efd9f){if(_0x4efd9f){return _0x4efd9f?{'count':_0x1101c9,'rows':_0x4efd9f}:null;}})[_0xe3aa('0x24')](respondWithResult(_0xfb6629,null))['catch'](handleError(_0xfb6629,null));};exports['addConfiguration']=function(_0x2456b1,_0x44486d,_0x58bf49){if(_0x2456b1[_0xe3aa('0x47')]['id']){delete _0x2456b1[_0xe3aa('0x47')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x2456b1[_0xe3aa('0x44')]['id']}})[_0xe3aa('0x24')](handleEntityNotFound(_0x44486d,null))['then'](function(_0x25e34d){if(_0x25e34d){_0x2456b1[_0xe3aa('0x47')][_0xe3aa('0x4b')]=_0x25e34d['id'];_0x2456b1[_0xe3aa('0x47')][_0xe3aa('0x4c')]=integrations[_0xe3aa('0x4d')](_0x2456b1['body'][_0xe3aa('0x4e')],_0x2456b1[_0xe3aa('0x47')]['type']);_0x2456b1[_0xe3aa('0x47')][_0xe3aa('0x4f')]=integrations['getDescriptions'](_0x2456b1[_0xe3aa('0x47')][_0xe3aa('0x4e')],_0x2456b1['body'][_0xe3aa('0x2d')]);return db[_0xe3aa('0x4a')][_0xe3aa('0x46')](_0x2456b1[_0xe3aa('0x47')],{'include':[{'model':db[_0xe3aa('0x50')],'as':_0xe3aa('0x4c')},{'model':db[_0xe3aa('0x50')],'as':_0xe3aa('0x4f')}]});}return null;})[_0xe3aa('0x24')](respondWithResult(_0x44486d,null))[_0xe3aa('0x43')](handleError(_0x44486d,null));};exports[_0xe3aa('0x51')]=function(_0x2a0e2f,_0xa6c740,_0x30df6f){var _0xf7d042='';var _0x346b72=['id','name',_0xe3aa('0x52'),'created_by',_0xe3aa('0x53'),_0xe3aa('0x54'),'duration_hours',_0xe3aa('0x55'),'parent_id',_0xe3aa('0x56'),'parent_name','direction'];return db[_0xe3aa('0x2a')][_0xe3aa('0x49')]({'where':{'id':_0x2a0e2f[_0xe3aa('0x44')]['id']},'attributes':['id',_0xe3aa('0x57'),_0xe3aa('0x58'),_0xe3aa('0x59')]})[_0xe3aa('0x24')](handleEntityNotFound(_0xa6c740,null))['then'](function(_0x49a88c){if(_0x49a88c){_0xf7d042=_0x49a88c[_0xe3aa('0x59')];var _0x109fe5=_0xf7d042[_0xe3aa('0x5a')](-0x1);if(_0x109fe5==='/'){_0xf7d042=_0xf7d042[_0xe3aa('0x5b')](0x0,_0xf7d042[_0xe3aa('0x5c')](_0x109fe5));}return rp({'method':_0xe3aa('0x5d'),'uri':util[_0xe3aa('0x5e')]('%s%s',_0xf7d042,_0xe3aa('0x5f')),'json':!![],'form':{'method':'login','input_type':_0xe3aa('0x60'),'response_type':'JSON','rest_data':JSON[_0xe3aa('0x61')]({'user_auth':{'user_name':_0x49a88c[_0xe3aa('0x57')],'password':_0x49a88c[_0xe3aa('0x58')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xe3aa('0x24')](function(_0x4b33ae){if(_0x4b33ae&&_0x4b33ae[_0xe3aa('0x27')]!==_0xe3aa('0x62')&&_0x4b33ae[_0xe3aa('0x27')]!==_0xe3aa('0x63')){return rp({'method':_0xe3aa('0x5d'),'uri':util[_0xe3aa('0x5e')]('%s%s',_0xf7d042,_0xe3aa('0x5f')),'json':!![],'form':{'method':_0xe3aa('0x64'),'input_type':_0xe3aa('0x60'),'response_type':_0xe3aa('0x60'),'rest_data':JSON[_0xe3aa('0x61')]({'session':_0x4b33ae['id'],'module_name':_0xe3aa('0x65')})}})['then'](function(_0x5de588){if(_0x5de588){var _0x211d6a=_[_0xe3aa('0x66')](_0x5de588['module_fields']);_['remove'](_0x211d6a,function(_0x5771a1){return _0x346b72['includes'](_0x5771a1['name']);});return{'count':_0x211d6a[_0xe3aa('0x35')],'rows':_['map'](_0x211d6a,function(_0x38c7ab){return{'id':_0x38c7ab['name'],'name':_0x38c7ab['label'],'custom':_[_0xe3aa('0x67')](_0x38c7ab[_0xe3aa('0x27')],'_c')?!![]:![],'options':_0x38c7ab['options']?_['map'](_[_0xe3aa('0x66')](_0x38c7ab[_0xe3aa('0x3f')]),function(_0x3dcd13){return{'name':_0x3dcd13[_0xe3aa('0x68')],'value':_0x3dcd13[_0xe3aa('0x27')]};}):[]};})};}})[_0xe3aa('0x24')](respondWithResult(_0xa6c740,null))[_0xe3aa('0x43')](function(_0x43169c){var _0x5e4039=_0x2a0e2f['query']['test']?0x1f4:_0x43169c[_0xe3aa('0x69')]||0x1f4;logger[_0xe3aa('0x6a')](_0xe3aa('0x6b'),'getFields',_0x5e4039,JSON[_0xe3aa('0x61')](_0x43169c));delete _0x43169c[_0xe3aa('0x27')];if(_0x5e4039===0x191){_0x5e4039=0x190;}_0xa6c740[_0xe3aa('0x18')](_0x5e4039)[_0xe3aa('0x6c')](_0x2a0e2f[_0xe3aa('0x30')][_0xe3aa('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x43169c[_0xe3aa('0x69')]}:_0x43169c);});}else{var _0x4a2105=0x1f4;_0xa6c740[_0xe3aa('0x18')](_0x4a2105)['send']({'message':_0xe3aa('0x6e'),'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 9b49e1b..653d30d 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 _0xbd22=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xbd22,0xf7));var _0x2bd2=function(_0x30b5a2,_0x245604){_0x30b5a2=_0x30b5a2-0x0;var _0x182fc0=_0xbd22[_0x30b5a2];return _0x182fc0;};'use strict';var _=require(_0x2bd2('0x0'));var util=require(_0x2bd2('0x1'));var logger=require(_0x2bd2('0x2'))(_0x2bd2('0x3'));var moment=require(_0x2bd2('0x4'));var BPromise=require(_0x2bd2('0x5'));var rp=require(_0x2bd2('0x6'));var fs=require('fs');var path=require(_0x2bd2('0x7'));var rimraf=require(_0x2bd2('0x8'));var config=require(_0x2bd2('0x9'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x2bd2('0xa'));module[_0x2bd2('0xb')]=function(_0x2f3872,_0x4bff6d){return _0x2f3872[_0x2bd2('0xc')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c45=['../../config/logger','api','moment','bluebird','request-promise','path','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x307a7d,_0x43d87b){var _0x5894a4=function(_0x46526c){while(--_0x46526c){_0x307a7d['push'](_0x307a7d['shift']());}};_0x5894a4(++_0x43d87b);}(_0x1c45,0x1b0));var _0x51c4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1c45[_0x432682];return _0x463d05;};'use strict';var _=require(_0x51c4('0x0'));var util=require(_0x51c4('0x1'));var logger=require(_0x51c4('0x2'))(_0x51c4('0x3'));var moment=require(_0x51c4('0x4'));var BPromise=require(_0x51c4('0x5'));var rp=require(_0x51c4('0x6'));var fs=require('fs');var path=require(_0x51c4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x51c4('0x8'));var integrations=require(_0x51c4('0x9'));module[_0x51c4('0xa')]=function(_0x609bef,_0x1f22a2){return _0x609bef[_0x51c4('0xb')](_0x51c4('0xc'),attributes,{'tableName':_0x51c4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index a8dd3a8..e5407ac 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 _0x16e1=['model','debug','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x1b3463,_0x43e1f5){var _0x29d544=function(_0x73f158){while(--_0x73f158){_0x1b3463['push'](_0x1b3463['shift']());}};_0x29d544(++_0x43e1f5);}(_0x16e1,0x16d));var _0x116e=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x16e1[_0x503950];return _0x1657a9;};'use strict';var _=require(_0x116e('0x0'));var util=require(_0x116e('0x1'));var moment=require('moment');var BPromise=require(_0x116e('0x2'));var rs=require(_0x116e('0x3'));var fs=require('fs');var Redis=require(_0x116e('0x4'));var db=require(_0x116e('0x5'))['db'];var utils=require(_0x116e('0x6'));var logger=require(_0x116e('0x7'))(_0x116e('0x8'));var config=require('../../config/environment');var jayson=require(_0x116e('0x9'));var client=jayson[_0x116e('0xa')][_0x116e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x339f85,_0xce5ed7,_0x50d0fa){return new BPromise(function(_0x3dcab4,_0x4fe5da){return client['request'](_0x339f85,_0x50d0fa)[_0x116e('0xc')](function(_0x595ea1){logger[_0x116e('0xd')](_0x116e('0xe'),_0xce5ed7,_0x116e('0xf'));logger['debug'](_0x116e('0x10'),_0xce5ed7,_0x116e('0xf'),JSON[_0x116e('0x11')](_0x595ea1));if(_0x595ea1[_0x116e('0x12')]){if(_0x595ea1[_0x116e('0x12')]['code']===0x1f4){logger[_0x116e('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0xce5ed7,_0x595ea1[_0x116e('0x12')]['message']);return _0x4fe5da(_0x595ea1['error'][_0x116e('0x13')]);}logger[_0x116e('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0xce5ed7,_0x595ea1[_0x116e('0x12')]['message']);return _0x3dcab4(_0x595ea1[_0x116e('0x12')][_0x116e('0x13')]);}else{logger[_0x116e('0xd')](_0x116e('0xe'),_0xce5ed7,_0x116e('0xf'));_0x3dcab4(_0x595ea1[_0x116e('0x14')][_0x116e('0x13')]);}})[_0x116e('0x15')](function(_0x1b75a1){logger[_0x116e('0x12')](_0x116e('0xe'),_0xce5ed7,_0x1b75a1);_0x4fe5da(_0x1b75a1);});});}exports[_0x116e('0x16')]=function(_0x44a7e6){var _0x3a6697=this;return new Promise(function(_0x5d805c,_0x2de10c){return db['SugarcrmAccount'][_0x116e('0x17')]({'raw':_0x44a7e6[_0x116e('0x18')]?_0x44a7e6[_0x116e('0x18')][_0x116e('0x19')]===undefined?!![]:![]:!![],'where':_0x44a7e6[_0x116e('0x18')]?_0x44a7e6[_0x116e('0x18')][_0x116e('0x1a')]||null:null,'attributes':_0x44a7e6['options']?_0x44a7e6[_0x116e('0x18')][_0x116e('0x1b')]||null:null,'limit':_0x44a7e6[_0x116e('0x18')]?_0x44a7e6['options'][_0x116e('0x1c')]||null:null,'include':_0x44a7e6[_0x116e('0x18')]?_0x44a7e6['options'][_0x116e('0x1d')]?_[_0x116e('0x1e')](_0x44a7e6[_0x116e('0x18')][_0x116e('0x1d')],function(_0x25d256){return{'model':db[_0x25d256[_0x116e('0x1f')]],'as':_0x25d256['as'],'attributes':_0x25d256['attributes'],'include':_0x25d256[_0x116e('0x1d')]?_[_0x116e('0x1e')](_0x25d256[_0x116e('0x1d')],function(_0x33b0cb){return{'model':db[_0x33b0cb['model']],'as':_0x33b0cb['as'],'attributes':_0x33b0cb['attributes'],'include':_0x33b0cb['include']?_['map'](_0x33b0cb[_0x116e('0x1d')],function(_0x3a1887){return{'model':db[_0x3a1887[_0x116e('0x1f')]],'as':_0x3a1887['as'],'attributes':_0x3a1887['attributes']};}):[]};}):[]};}):[]:[]})[_0x116e('0xc')](function(_0x596832){logger[_0x116e('0xd')](_0x116e('0x16'),_0x44a7e6);logger[_0x116e('0x20')](_0x116e('0x16'),_0x44a7e6,JSON[_0x116e('0x11')](_0x596832));_0x5d805c(_0x596832);})['catch'](function(_0x584fc9){logger[_0x116e('0x12')](_0x116e('0x16'),_0x584fc9[_0x116e('0x13')],_0x44a7e6);_0x2de10c(_0x3a6697[_0x116e('0x12')](0x1f4,_0x584fc9[_0x116e('0x13')]));});});};exports[_0x116e('0x21')]=function(_0x454029){var _0x47a1dc=this;return new Promise(function(_0x3b5001,_0x4a4257){return db[_0x116e('0x22')][_0x116e('0x23')]({'raw':_0x454029[_0x116e('0x18')]?_0x454029[_0x116e('0x18')][_0x116e('0x19')]===undefined?!![]:![]:!![],'where':_0x454029[_0x116e('0x18')]?_0x454029['options'][_0x116e('0x1a')]||null:null,'attributes':_0x454029['options']?_0x454029[_0x116e('0x18')][_0x116e('0x1b')]||null:null,'include':_0x454029['options']?_0x454029[_0x116e('0x18')][_0x116e('0x1d')]?_[_0x116e('0x1e')](_0x454029[_0x116e('0x18')][_0x116e('0x1d')],function(_0x3b09e6){return{'model':db[_0x3b09e6[_0x116e('0x1f')]],'as':_0x3b09e6['as'],'attributes':_0x3b09e6[_0x116e('0x1b')],'include':_0x3b09e6[_0x116e('0x1d')]?_[_0x116e('0x1e')](_0x3b09e6[_0x116e('0x1d')],function(_0x5ced9a){return{'model':db[_0x5ced9a[_0x116e('0x1f')]],'as':_0x5ced9a['as'],'attributes':_0x5ced9a[_0x116e('0x1b')],'include':_0x5ced9a[_0x116e('0x1d')]?_['map'](_0x5ced9a[_0x116e('0x1d')],function(_0x49a985){return{'model':db[_0x49a985[_0x116e('0x1f')]],'as':_0x49a985['as'],'attributes':_0x49a985[_0x116e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45cbaa){logger[_0x116e('0xd')](_0x116e('0x21'),_0x454029);logger[_0x116e('0x20')](_0x116e('0x21'),_0x454029,JSON[_0x116e('0x11')](_0x45cbaa));_0x3b5001(_0x45cbaa);})[_0x116e('0x15')](function(_0x207b68){logger[_0x116e('0x12')]('ShowSugarcrmAccount',_0x207b68[_0x116e('0x13')],_0x454029);_0x4a4257(_0x47a1dc[_0x116e('0x12')](0x1f4,_0x207b68[_0x116e('0x13')]));});});}; \ No newline at end of file +var _0x4e89=['stringify','error','message','info','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','include','map','model','ShowSugarcrmAccount','find','raw','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0x4e89,0xf1));var _0x94e8=function(_0x304971,_0x345c46){_0x304971=_0x304971-0x0;var _0x2eb301=_0x4e89[_0x304971];return _0x2eb301;};'use strict';var _=require(_0x94e8('0x0'));var util=require(_0x94e8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x94e8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94e8('0x3'))['db'];var utils=require(_0x94e8('0x4'));var logger=require(_0x94e8('0x5'))(_0x94e8('0x6'));var config=require(_0x94e8('0x7'));var jayson=require(_0x94e8('0x8'));var client=jayson['client'][_0x94e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3392cb,_0x3f551c,_0x27d011){return new BPromise(function(_0x5bacf7,_0x188f5c){return client['request'](_0x3392cb,_0x27d011)[_0x94e8('0xa')](function(_0x1b0f65){logger['info'](_0x94e8('0xb'),_0x3f551c,_0x94e8('0xc'));logger[_0x94e8('0xd')](_0x94e8('0xe'),_0x3f551c,_0x94e8('0xc'),JSON[_0x94e8('0xf')](_0x1b0f65));if(_0x1b0f65['error']){if(_0x1b0f65['error']['code']===0x1f4){logger[_0x94e8('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x3f551c,_0x1b0f65['error'][_0x94e8('0x11')]);return _0x188f5c(_0x1b0f65[_0x94e8('0x10')][_0x94e8('0x11')]);}logger[_0x94e8('0x10')](_0x94e8('0xb'),_0x3f551c,_0x1b0f65[_0x94e8('0x10')]['message']);return _0x5bacf7(_0x1b0f65[_0x94e8('0x10')][_0x94e8('0x11')]);}else{logger[_0x94e8('0x12')](_0x94e8('0xb'),_0x3f551c,'request\x20sent');_0x5bacf7(_0x1b0f65['result'][_0x94e8('0x11')]);}})[_0x94e8('0x13')](function(_0x23cb83){logger[_0x94e8('0x10')](_0x94e8('0xb'),_0x3f551c,_0x23cb83);_0x188f5c(_0x23cb83);});});}exports[_0x94e8('0x14')]=function(_0x3d4610){var _0x5a2220=this;return new Promise(function(_0x34b3c8,_0x21bc19){return db[_0x94e8('0x15')][_0x94e8('0x16')]({'raw':_0x3d4610['options']?_0x3d4610['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d4610['options']?_0x3d4610[_0x94e8('0x17')][_0x94e8('0x18')]||null:null,'attributes':_0x3d4610['options']?_0x3d4610[_0x94e8('0x17')][_0x94e8('0x19')]||null:null,'limit':_0x3d4610[_0x94e8('0x17')]?_0x3d4610[_0x94e8('0x17')]['limit']||null:null,'include':_0x3d4610[_0x94e8('0x17')]?_0x3d4610[_0x94e8('0x17')][_0x94e8('0x1a')]?_[_0x94e8('0x1b')](_0x3d4610[_0x94e8('0x17')]['include'],function(_0x3266fa){return{'model':db[_0x3266fa['model']],'as':_0x3266fa['as'],'attributes':_0x3266fa['attributes'],'include':_0x3266fa[_0x94e8('0x1a')]?_[_0x94e8('0x1b')](_0x3266fa[_0x94e8('0x1a')],function(_0x5b19c4){return{'model':db[_0x5b19c4[_0x94e8('0x1c')]],'as':_0x5b19c4['as'],'attributes':_0x5b19c4[_0x94e8('0x19')],'include':_0x5b19c4[_0x94e8('0x1a')]?_['map'](_0x5b19c4[_0x94e8('0x1a')],function(_0x4fa4e9){return{'model':db[_0x4fa4e9[_0x94e8('0x1c')]],'as':_0x4fa4e9['as'],'attributes':_0x4fa4e9[_0x94e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x94e8('0xa')](function(_0x4baed0){logger['info'](_0x94e8('0x14'),_0x3d4610);logger[_0x94e8('0xd')](_0x94e8('0x14'),_0x3d4610,JSON[_0x94e8('0xf')](_0x4baed0));_0x34b3c8(_0x4baed0);})[_0x94e8('0x13')](function(_0x2a5b75){logger['error'](_0x94e8('0x14'),_0x2a5b75[_0x94e8('0x11')],_0x3d4610);_0x21bc19(_0x5a2220[_0x94e8('0x10')](0x1f4,_0x2a5b75['message']));});});};exports[_0x94e8('0x1d')]=function(_0x125144){var _0x592cce=this;return new Promise(function(_0x4df829,_0x4b9d02){return db[_0x94e8('0x15')][_0x94e8('0x1e')]({'raw':_0x125144[_0x94e8('0x17')]?_0x125144['options'][_0x94e8('0x1f')]===undefined?!![]:![]:!![],'where':_0x125144[_0x94e8('0x17')]?_0x125144[_0x94e8('0x17')][_0x94e8('0x18')]||null:null,'attributes':_0x125144[_0x94e8('0x17')]?_0x125144['options'][_0x94e8('0x19')]||null:null,'include':_0x125144[_0x94e8('0x17')]?_0x125144[_0x94e8('0x17')][_0x94e8('0x1a')]?_['map'](_0x125144[_0x94e8('0x17')][_0x94e8('0x1a')],function(_0x5f19d9){return{'model':db[_0x5f19d9[_0x94e8('0x1c')]],'as':_0x5f19d9['as'],'attributes':_0x5f19d9['attributes'],'include':_0x5f19d9['include']?_[_0x94e8('0x1b')](_0x5f19d9[_0x94e8('0x1a')],function(_0x18a985){return{'model':db[_0x18a985[_0x94e8('0x1c')]],'as':_0x18a985['as'],'attributes':_0x18a985[_0x94e8('0x19')],'include':_0x18a985['include']?_['map'](_0x18a985[_0x94e8('0x1a')],function(_0x4e4519){return{'model':db[_0x4e4519[_0x94e8('0x1c')]],'as':_0x4e4519['as'],'attributes':_0x4e4519[_0x94e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x94e8('0xa')](function(_0x4b59fd){logger[_0x94e8('0x12')](_0x94e8('0x1d'),_0x125144);logger[_0x94e8('0xd')]('ShowSugarcrmAccount',_0x125144,JSON[_0x94e8('0xf')](_0x4b59fd));_0x4df829(_0x4b59fd);})[_0x94e8('0x13')](function(_0x411658){logger[_0x94e8('0x10')](_0x94e8('0x1d'),_0x411658[_0x94e8('0x11')],_0x125144);_0x4b9d02(_0x592cce[_0x94e8('0x10')](0x1f4,_0x411658[_0x94e8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 73d0616..88d799e 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 _0xdd0f=['put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','isAuthenticated','get','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xdd0f,0x180));var _0xfdd0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd0f[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xfdd0('0x0'));var util=require(_0xfdd0('0x1'));var path=require(_0xfdd0('0x2'));var timeout=require(_0xfdd0('0x3'));var express=require(_0xfdd0('0x4'));var router=express['Router']();var fs_extra=require(_0xfdd0('0x5'));var auth=require(_0xfdd0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xfdd0('0x7')](),controller['index']);router[_0xfdd0('0x8')](_0xfdd0('0x9'),auth[_0xfdd0('0x7')](),controller[_0xfdd0('0xa')]);router[_0xfdd0('0x8')]('/:id/fields',auth[_0xfdd0('0x7')](),controller[_0xfdd0('0xb')]);router[_0xfdd0('0x8')](_0xfdd0('0xc'),auth[_0xfdd0('0x7')](),controller[_0xfdd0('0xd')]);router[_0xfdd0('0x8')]('/:id/descriptions',auth[_0xfdd0('0x7')](),controller[_0xfdd0('0xe')]);router[_0xfdd0('0xf')]('/',auth[_0xfdd0('0x7')](),controller['create']);router[_0xfdd0('0x10')](_0xfdd0('0x9'),auth[_0xfdd0('0x7')](),controller[_0xfdd0('0x11')]);router['delete']('/:id',auth[_0xfdd0('0x7')](),controller[_0xfdd0('0x12')]);module[_0xfdd0('0x13')]=router; \ No newline at end of file +var _0xf0a2=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post'];(function(_0x9c692,_0x4671ce){var _0x3160b5=function(_0x3eacf2){while(--_0x3eacf2){_0x9c692['push'](_0x9c692['shift']());}};_0x3160b5(++_0x4671ce);}(_0xf0a2,0xf6));var _0x2f0a=function(_0x112168,_0x5bbd60){_0x112168=_0x112168-0x0;var _0x529296=_0xf0a2[_0x112168];return _0x529296;};'use strict';var multer=require(_0x2f0a('0x0'));var util=require(_0x2f0a('0x1'));var path=require(_0x2f0a('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f0a('0x3'));var router=express[_0x2f0a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2f0a('0x5'));var interaction=require(_0x2f0a('0x6'));var config=require(_0x2f0a('0x7'));var controller=require(_0x2f0a('0x8'));router[_0x2f0a('0x9')]('/',auth[_0x2f0a('0xa')](),controller['index']);router[_0x2f0a('0x9')](_0x2f0a('0xb'),auth[_0x2f0a('0xa')](),controller[_0x2f0a('0xc')]);router[_0x2f0a('0x9')](_0x2f0a('0xd'),auth[_0x2f0a('0xa')](),controller[_0x2f0a('0xe')]);router[_0x2f0a('0x9')]('/:id/subjects',auth[_0x2f0a('0xa')](),controller['getSubjects']);router[_0x2f0a('0x9')](_0x2f0a('0xf'),auth[_0x2f0a('0xa')](),controller[_0x2f0a('0x10')]);router[_0x2f0a('0x11')]('/',auth['isAuthenticated'](),controller[_0x2f0a('0x12')]);router[_0x2f0a('0x13')](_0x2f0a('0xb'),auth[_0x2f0a('0xa')](),controller[_0x2f0a('0x14')]);router[_0x2f0a('0x15')](_0x2f0a('0xb'),auth[_0x2f0a('0xa')](),controller[_0x2f0a('0x16')]);module[_0x2f0a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index bc0d943..b0e0fa3 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 _0x30a7=['STRING','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x30a7,0x1dd));var _0x730a=function(_0xa51d2b,_0x105fe1){_0xa51d2b=_0xa51d2b-0x0;var _0x3fe6a6=_0x30a7[_0xa51d2b];return _0x3fe6a6;};'use strict';var Sequelize=require(_0x730a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x730a('0x1')]}}; \ No newline at end of file +var _0x8655=['STRING','exports'];(function(_0x1dc8ce,_0x46f0a2){var _0xc1fadd=function(_0x5acf3f){while(--_0x5acf3f){_0x1dc8ce['push'](_0x1dc8ce['shift']());}};_0xc1fadd(++_0x46f0a2);}(_0x8655,0x16f));var _0x5865=function(_0x6b8fcc,_0x36f061){_0x6b8fcc=_0x6b8fcc-0x0;var _0x1c46aa=_0x8655[_0x6b8fcc];return _0x1c46aa;};'use strict';var Sequelize=require('sequelize');module[_0x5865('0x0')]={'name':{'type':Sequelize[_0x5865('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6de8520..da2ee75 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 _0x5513=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','save','then','destroy','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','map','nolimit','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','squel','crypto'];(function(_0x49995f,_0x2a4bb9){var _0x311bf0=function(_0x54ad16){while(--_0x54ad16){_0x49995f['push'](_0x49995f['shift']());}};_0x311bf0(++_0x2a4bb9);}(_0x5513,0x125));var _0x3551=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5513[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x3551('0x0'));var rimraf=require(_0x3551('0x1'));var zipdir=require(_0x3551('0x2'));var jsonpatch=require(_0x3551('0x3'));var rp=require(_0x3551('0x4'));var moment=require(_0x3551('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3551('0x6'));var util=require('util');var path=require(_0x3551('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3551('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3551('0x9'));var crypto=require(_0x3551('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3551('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3551('0xc'));var Papa=require(_0x3551('0xd'));var Redis=require('ioredis');var authService=require(_0x3551('0xe'));var qs=require(_0x3551('0xf'));var as=require(_0x3551('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3551('0x11'))('api');var utils=require(_0x3551('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3551('0x13'));var db=require(_0x3551('0x14'))['db'];function respondWithStatusCode(_0x5448ef,_0x2d8040){_0x2d8040=_0x2d8040||0xcc;return function(_0x5e505b){if(_0x5e505b){return _0x5448ef[_0x3551('0x15')](_0x2d8040);}return _0x5448ef['status'](_0x2d8040)['end']();};}function respondWithResult(_0x105baa,_0x3660c){_0x3660c=_0x3660c||0xc8;return function(_0x38e428){if(_0x38e428){return _0x105baa['status'](_0x3660c)[_0x3551('0x16')](_0x38e428);}};}function respondWithFilteredResult(_0x213eac,_0x3e5316){return function(_0x303187){if(_0x303187){var _0x2b0c9f=typeof _0x3e5316[_0x3551('0x17')]===_0x3551('0x18')&&typeof _0x3e5316[_0x3551('0x19')]===_0x3551('0x18');var _0x1ec93b=_0x303187[_0x3551('0x1a')];var _0x1784d5=_0x2b0c9f?0x0:_0x3e5316[_0x3551('0x17')];var _0x336373=_0x2b0c9f?_0x303187[_0x3551('0x1a')]:_0x3e5316[_0x3551('0x17')]+_0x3e5316['limit'];var _0xf2afe1;if(_0x336373>=_0x1ec93b){_0x336373=_0x1ec93b;_0xf2afe1=0xc8;}else{_0xf2afe1=0xce;}_0x213eac[_0x3551('0x1b')](_0xf2afe1);return _0x213eac['set'](_0x3551('0x1c'),_0x1784d5+'-'+_0x336373+'/'+_0x1ec93b)['json'](_0x303187);}return null;};}function patchUpdates(_0x2531e2){return function(_0xa925b6){try{jsonpatch['apply'](_0xa925b6,_0x2531e2,!![]);}catch(_0x36c616){return BPromise[_0x3551('0x1d')](_0x36c616);}return _0xa925b6[_0x3551('0x1e')]();};}function saveUpdates(_0x45c9e7,_0x4e731c){return function(_0x573e4a){if(_0x573e4a){return _0x573e4a['update'](_0x45c9e7)[_0x3551('0x1f')](function(_0x460eb5){return _0x460eb5;});}return null;};}function removeEntity(_0x316818,_0x273ee8){return function(_0x1d976b){if(_0x1d976b){return _0x1d976b[_0x3551('0x20')]()['then'](function(){_0x316818['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x372086,_0x4dcec1){return function(_0x216ed6){if(!_0x216ed6){_0x372086[_0x3551('0x15')](0x194);}return _0x216ed6;};}function handleError(_0x4cdef8,_0x5be5de){_0x5be5de=_0x5be5de||0x1f4;return function(_0x1f6313){logger[_0x3551('0x21')](_0x1f6313[_0x3551('0x22')]);if(_0x1f6313[_0x3551('0x23')]){delete _0x1f6313[_0x3551('0x23')];}_0x4cdef8['status'](_0x5be5de)[_0x3551('0x24')](_0x1f6313);};}exports[_0x3551('0x25')]=function(_0x2afcaf,_0x499a38){var _0x414972={},_0xa88c0e={},_0x453156={'count':0x0,'rows':[]};var _0x4f4bef=_['map'](db[_0x3551('0x26')][_0x3551('0x27')],function(_0x1f7010){return{'name':_0x1f7010[_0x3551('0x28')],'type':_0x1f7010[_0x3551('0x29')][_0x3551('0x2a')]};});_0xa88c0e[_0x3551('0x2b')]=_['map'](_0x4f4bef,'name');_0xa88c0e[_0x3551('0x2c')]=_[_0x3551('0x2d')](_0x2afcaf['query']);_0xa88c0e[_0x3551('0x2e')]=_[_0x3551('0x2f')](_0xa88c0e[_0x3551('0x2b')],_0xa88c0e['query']);_0x414972[_0x3551('0x30')]=_[_0x3551('0x2f')](_0xa88c0e[_0x3551('0x2b')],qs['fields'](_0x2afcaf[_0x3551('0x2c')][_0x3551('0x31')]));_0x414972[_0x3551('0x30')]=_0x414972['attributes'][_0x3551('0x32')]?_0x414972[_0x3551('0x30')]:_0xa88c0e['model'];if(!_0x2afcaf[_0x3551('0x2c')][_0x3551('0x33')]('nolimit')){_0x414972['limit']=qs[_0x3551('0x19')](_0x2afcaf[_0x3551('0x2c')][_0x3551('0x19')]);_0x414972['offset']=qs['offset'](_0x2afcaf[_0x3551('0x2c')][_0x3551('0x17')]);}_0x414972[_0x3551('0x34')]=qs[_0x3551('0x35')](_0x2afcaf[_0x3551('0x2c')][_0x3551('0x35')]);_0x414972['where']=qs[_0x3551('0x2e')](_[_0x3551('0x36')](_0x2afcaf[_0x3551('0x2c')],_0xa88c0e[_0x3551('0x2e')]),_0x4f4bef);if(_0x2afcaf[_0x3551('0x2c')][_0x3551('0x37')]){_0x414972[_0x3551('0x38')]=_[_0x3551('0x39')](_0x414972[_0x3551('0x38')],{'$or':_['map'](_0x4f4bef,function(_0x2e0fd4){if(_0x2e0fd4['type']!=='VIRTUAL'){var _0x2c808f={};_0x2c808f[_0x2e0fd4[_0x3551('0x23')]]={'$like':'%'+_0x2afcaf[_0x3551('0x2c')][_0x3551('0x37')]+'%'};return _0x2c808f;}})});}_0x414972=_[_0x3551('0x39')]({},_0x414972,_0x2afcaf[_0x3551('0x3a')]);var _0x19ba29={'where':_0x414972['where']};return db['SugarcrmConfiguration'][_0x3551('0x1a')](_0x19ba29)['then'](function(_0x1870e6){_0x453156['count']=_0x1870e6;if(_0x2afcaf[_0x3551('0x2c')][_0x3551('0x3b')]){_0x414972[_0x3551('0x3c')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x3551('0x3d')](_0x414972);})['then'](function(_0x18fb49){_0x453156[_0x3551('0x3e')]=_0x18fb49;return _0x453156;})[_0x3551('0x1f')](respondWithFilteredResult(_0x499a38,_0x414972))[_0x3551('0x3f')](handleError(_0x499a38,null));};exports[_0x3551('0x40')]=function(_0x1484bc,_0x3d08b3){var _0x6622f3={'raw':![],'where':{'id':_0x1484bc[_0x3551('0x41')]['id']}},_0x291f40={};_0x291f40[_0x3551('0x2b')]=_[_0x3551('0x2d')](db[_0x3551('0x26')]['rawAttributes']);_0x291f40[_0x3551('0x2c')]=_[_0x3551('0x2d')](_0x1484bc[_0x3551('0x2c')]);_0x291f40[_0x3551('0x2e')]=_[_0x3551('0x2f')](_0x291f40[_0x3551('0x2b')],_0x291f40[_0x3551('0x2c')]);_0x6622f3[_0x3551('0x30')]=_[_0x3551('0x2f')](_0x291f40[_0x3551('0x2b')],qs[_0x3551('0x31')](_0x1484bc[_0x3551('0x2c')][_0x3551('0x31')]));_0x6622f3[_0x3551('0x30')]=_0x6622f3[_0x3551('0x30')][_0x3551('0x32')]?_0x6622f3[_0x3551('0x30')]:_0x291f40[_0x3551('0x2b')];if(_0x1484bc[_0x3551('0x2c')][_0x3551('0x3b')]){_0x6622f3[_0x3551('0x3c')]=[{'all':!![]}];}_0x6622f3=_['merge']({},_0x6622f3,_0x1484bc[_0x3551('0x3a')]);return db[_0x3551('0x26')][_0x3551('0x42')](_0x6622f3)['then'](handleEntityNotFound(_0x3d08b3,null))[_0x3551('0x1f')](respondWithResult(_0x3d08b3,null))[_0x3551('0x3f')](handleError(_0x3d08b3,null));};exports['create']=function(_0x342749,_0x35e9e6){return db[_0x3551('0x26')][_0x3551('0x43')](_0x342749['body'],{})['then'](respondWithResult(_0x35e9e6,0xc9))[_0x3551('0x3f')](handleError(_0x35e9e6,null));};exports['update']=function(_0x30e360,_0x3ab774){if(_0x30e360[_0x3551('0x44')]['id']){delete _0x30e360[_0x3551('0x44')]['id'];}return db[_0x3551('0x26')]['find']({'where':{'id':_0x30e360[_0x3551('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ab774,null))['then'](saveUpdates(_0x30e360[_0x3551('0x44')],null))['then'](respondWithResult(_0x3ab774,null))[_0x3551('0x3f')](handleError(_0x3ab774,null));};exports[_0x3551('0x20')]=function(_0x438ce2,_0x5cb212){return db[_0x3551('0x26')][_0x3551('0x42')]({'where':{'id':_0x438ce2[_0x3551('0x41')]['id']}})[_0x3551('0x1f')](handleEntityNotFound(_0x5cb212,null))[_0x3551('0x1f')](removeEntity(_0x5cb212,null))[_0x3551('0x3f')](handleError(_0x5cb212,null));};exports[_0x3551('0x45')]=function(_0x25e342,_0x3e37c4,_0x1a48e6){var _0x143350={};var _0x1d0a89={};var _0x1cd961;var _0x1eaa85;return db[_0x3551('0x26')][_0x3551('0x46')]({'where':{'id':_0x25e342[_0x3551('0x41')]['id']}})[_0x3551('0x1f')](handleEntityNotFound(_0x3e37c4,null))[_0x3551('0x1f')](function(_0x35def3){if(_0x35def3){_0x1cd961=_0x35def3;_0x1d0a89['model']=_[_0x3551('0x2d')](db['SugarcrmField'][_0x3551('0x27')]);_0x1d0a89['query']=_['keys'](_0x25e342[_0x3551('0x2c')]);_0x1d0a89[_0x3551('0x2e')]=_['intersection'](_0x1d0a89[_0x3551('0x2b')],_0x1d0a89[_0x3551('0x2c')]);_0x143350[_0x3551('0x30')]=_[_0x3551('0x2f')](_0x1d0a89[_0x3551('0x2b')],qs[_0x3551('0x31')](_0x25e342[_0x3551('0x2c')][_0x3551('0x31')]));_0x143350['attributes']=_0x143350[_0x3551('0x30')][_0x3551('0x32')]?_0x143350[_0x3551('0x30')]:_0x1d0a89[_0x3551('0x2b')];_0x143350[_0x3551('0x34')]=qs[_0x3551('0x35')](_0x25e342['query'][_0x3551('0x35')]);_0x143350[_0x3551('0x38')]=qs[_0x3551('0x2e')](_['pick'](_0x25e342[_0x3551('0x2c')],_0x1d0a89['filters']));if(_0x25e342['query'][_0x3551('0x37')]){_0x143350[_0x3551('0x38')]=_[_0x3551('0x39')](_0x143350['where'],{'$or':_[_0x3551('0x47')](_0x143350[_0x3551('0x30')],function(_0x3ec64e){var _0x4a226b={};_0x4a226b[_0x3ec64e]={'$like':'%'+_0x25e342[_0x3551('0x2c')][_0x3551('0x37')]+'%'};return _0x4a226b;})});}_0x143350=_[_0x3551('0x39')]({},_0x143350,_0x25e342[_0x3551('0x3a')]);return _0x1cd961[_0x3551('0x45')](_0x143350);}})[_0x3551('0x1f')](function(_0x4c6a0c){if(_0x4c6a0c){_0x1eaa85=_0x4c6a0c['length'];if(!_0x25e342[_0x3551('0x2c')][_0x3551('0x33')](_0x3551('0x48'))){_0x143350[_0x3551('0x19')]=qs[_0x3551('0x19')](_0x25e342[_0x3551('0x2c')][_0x3551('0x19')]);_0x143350[_0x3551('0x17')]=qs[_0x3551('0x17')](_0x25e342['query'][_0x3551('0x17')]);}return _0x1cd961[_0x3551('0x45')](_0x143350);}})[_0x3551('0x1f')](function(_0x2e2d64){if(_0x2e2d64){return _0x2e2d64?{'count':_0x1eaa85,'rows':_0x2e2d64}:null;}})['then'](respondWithResult(_0x3e37c4,null))['catch'](handleError(_0x3e37c4,null));};exports['getSubjects']=function(_0x258171,_0x44738a,_0x44f52f){var _0x11a867={};var _0x3ac098={};var _0x23c30a;var _0x373668;return db[_0x3551('0x26')][_0x3551('0x46')]({'where':{'id':_0x258171['params']['id']}})[_0x3551('0x1f')](handleEntityNotFound(_0x44738a,null))['then'](function(_0x7998b3){if(_0x7998b3){_0x23c30a=_0x7998b3;_0x3ac098['model']=_[_0x3551('0x2d')](db[_0x3551('0x49')][_0x3551('0x27')]);_0x3ac098[_0x3551('0x2c')]=_[_0x3551('0x2d')](_0x258171[_0x3551('0x2c')]);_0x3ac098[_0x3551('0x2e')]=_['intersection'](_0x3ac098[_0x3551('0x2b')],_0x3ac098[_0x3551('0x2c')]);_0x11a867[_0x3551('0x30')]=_[_0x3551('0x2f')](_0x3ac098[_0x3551('0x2b')],qs[_0x3551('0x31')](_0x258171[_0x3551('0x2c')][_0x3551('0x31')]));_0x11a867['attributes']=_0x11a867['attributes'][_0x3551('0x32')]?_0x11a867[_0x3551('0x30')]:_0x3ac098[_0x3551('0x2b')];_0x11a867[_0x3551('0x34')]=qs[_0x3551('0x35')](_0x258171[_0x3551('0x2c')][_0x3551('0x35')]);_0x11a867[_0x3551('0x38')]=qs[_0x3551('0x2e')](_[_0x3551('0x36')](_0x258171[_0x3551('0x2c')],_0x3ac098['filters']));if(_0x258171[_0x3551('0x2c')]['filter']){_0x11a867[_0x3551('0x38')]=_['merge'](_0x11a867[_0x3551('0x38')],{'$or':_[_0x3551('0x47')](_0x11a867[_0x3551('0x30')],function(_0x1982ec){var _0x226261={};_0x226261[_0x1982ec]={'$like':'%'+_0x258171[_0x3551('0x2c')][_0x3551('0x37')]+'%'};return _0x226261;})});}_0x11a867=_[_0x3551('0x39')]({},_0x11a867,_0x258171[_0x3551('0x3a')]);return _0x23c30a[_0x3551('0x4a')](_0x11a867);}})[_0x3551('0x1f')](function(_0x32ced4){if(_0x32ced4){_0x373668=_0x32ced4[_0x3551('0x32')];if(!_0x258171[_0x3551('0x2c')][_0x3551('0x33')](_0x3551('0x48'))){_0x11a867['limit']=qs[_0x3551('0x19')](_0x258171[_0x3551('0x2c')]['limit']);_0x11a867[_0x3551('0x17')]=qs[_0x3551('0x17')](_0x258171[_0x3551('0x2c')][_0x3551('0x17')]);}return _0x23c30a['getSubjects'](_0x11a867);}})['then'](function(_0x43b036){if(_0x43b036){return _0x43b036?{'count':_0x373668,'rows':_0x43b036}:null;}})[_0x3551('0x1f')](respondWithResult(_0x44738a,null))['catch'](handleError(_0x44738a,null));};exports[_0x3551('0x4b')]=function(_0x52e741,_0x5aa115,_0x284e64){var _0x3509ee={};var _0x5cf4fe={};var _0x3fe346;var _0x57b20e;return db[_0x3551('0x26')]['findOne']({'where':{'id':_0x52e741[_0x3551('0x41')]['id']}})[_0x3551('0x1f')](handleEntityNotFound(_0x5aa115,null))[_0x3551('0x1f')](function(_0x2423ca){if(_0x2423ca){_0x3fe346=_0x2423ca;_0x5cf4fe[_0x3551('0x2b')]=_['keys'](db[_0x3551('0x49')][_0x3551('0x27')]);_0x5cf4fe[_0x3551('0x2c')]=_['keys'](_0x52e741[_0x3551('0x2c')]);_0x5cf4fe[_0x3551('0x2e')]=_['intersection'](_0x5cf4fe['model'],_0x5cf4fe[_0x3551('0x2c')]);_0x3509ee[_0x3551('0x30')]=_[_0x3551('0x2f')](_0x5cf4fe[_0x3551('0x2b')],qs['fields'](_0x52e741[_0x3551('0x2c')][_0x3551('0x31')]));_0x3509ee['attributes']=_0x3509ee[_0x3551('0x30')][_0x3551('0x32')]?_0x3509ee['attributes']:_0x5cf4fe['model'];_0x3509ee[_0x3551('0x34')]=qs[_0x3551('0x35')](_0x52e741[_0x3551('0x2c')][_0x3551('0x35')]);_0x3509ee[_0x3551('0x38')]=qs[_0x3551('0x2e')](_[_0x3551('0x36')](_0x52e741[_0x3551('0x2c')],_0x5cf4fe[_0x3551('0x2e')]));if(_0x52e741[_0x3551('0x2c')]['filter']){_0x3509ee[_0x3551('0x38')]=_['merge'](_0x3509ee[_0x3551('0x38')],{'$or':_[_0x3551('0x47')](_0x3509ee[_0x3551('0x30')],function(_0x2183a5){var _0x394f7a={};_0x394f7a[_0x2183a5]={'$like':'%'+_0x52e741[_0x3551('0x2c')]['filter']+'%'};return _0x394f7a;})});}_0x3509ee=_['merge']({},_0x3509ee,_0x52e741[_0x3551('0x3a')]);return _0x3fe346[_0x3551('0x4b')](_0x3509ee);}})['then'](function(_0x10b473){if(_0x10b473){_0x57b20e=_0x10b473['length'];if(!_0x52e741['query'][_0x3551('0x33')](_0x3551('0x48'))){_0x3509ee[_0x3551('0x19')]=qs[_0x3551('0x19')](_0x52e741[_0x3551('0x2c')][_0x3551('0x19')]);_0x3509ee[_0x3551('0x17')]=qs[_0x3551('0x17')](_0x52e741['query'][_0x3551('0x17')]);}return _0x3fe346[_0x3551('0x4b')](_0x3509ee);}})['then'](function(_0x32f411){if(_0x32f411){return _0x32f411?{'count':_0x57b20e,'rows':_0x32f411}:null;}})['then'](respondWithResult(_0x5aa115,null))[_0x3551('0x3f')](handleError(_0x5aa115,null));}; \ No newline at end of file +var _0xe0db=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','SugarcrmField','filter','merge','hasOwnProperty','getSubjects','findOne','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0xe0db,0xe1));var _0xbe0d=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xe0db[_0x58dc25];return _0x21b0a7;};'use strict';var emlformat=require(_0xbe0d('0x0'));var rimraf=require(_0xbe0d('0x1'));var zipdir=require(_0xbe0d('0x2'));var jsonpatch=require(_0xbe0d('0x3'));var rp=require('request-promise');var moment=require(_0xbe0d('0x4'));var BPromise=require(_0xbe0d('0x5'));var Mustache=require(_0xbe0d('0x6'));var util=require('util');var path=require(_0xbe0d('0x7'));var sox=require(_0xbe0d('0x8'));var csv=require(_0xbe0d('0x9'));var ejs=require(_0xbe0d('0xa'));var fs=require('fs');var fs_extra=require(_0xbe0d('0xb'));var _=require(_0xbe0d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbe0d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbe0d('0x9'));var querystring=require(_0xbe0d('0xe'));var Papa=require(_0xbe0d('0xf'));var Redis=require(_0xbe0d('0x10'));var authService=require(_0xbe0d('0x11'));var qs=require(_0xbe0d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe0d('0x13'));var logger=require('../../config/logger')(_0xbe0d('0x14'));var utils=require(_0xbe0d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbe0d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bdfa,_0x1344ff){_0x1344ff=_0x1344ff||0xcc;return function(_0x4556c0){if(_0x4556c0){return _0x3bdfa[_0xbe0d('0x17')](_0x1344ff);}return _0x3bdfa[_0xbe0d('0x18')](_0x1344ff)[_0xbe0d('0x19')]();};}function respondWithResult(_0x2d8c41,_0x43e823){_0x43e823=_0x43e823||0xc8;return function(_0x5786ba){if(_0x5786ba){return _0x2d8c41[_0xbe0d('0x18')](_0x43e823)[_0xbe0d('0x1a')](_0x5786ba);}};}function respondWithFilteredResult(_0x2849ed,_0x7a0aca){return function(_0x18becc){if(_0x18becc){var _0x3cd50b=typeof _0x7a0aca[_0xbe0d('0x1b')]===_0xbe0d('0x1c')&&typeof _0x7a0aca[_0xbe0d('0x1d')]===_0xbe0d('0x1c');var _0x3eaa1e=_0x18becc[_0xbe0d('0x1e')];var _0x4cdc30=_0x3cd50b?0x0:_0x7a0aca[_0xbe0d('0x1b')];var _0xe195da=_0x3cd50b?_0x18becc[_0xbe0d('0x1e')]:_0x7a0aca[_0xbe0d('0x1b')]+_0x7a0aca[_0xbe0d('0x1d')];var _0x320650;if(_0xe195da>=_0x3eaa1e){_0xe195da=_0x3eaa1e;_0x320650=0xc8;}else{_0x320650=0xce;}_0x2849ed['status'](_0x320650);return _0x2849ed[_0xbe0d('0x1f')](_0xbe0d('0x20'),_0x4cdc30+'-'+_0xe195da+'/'+_0x3eaa1e)[_0xbe0d('0x1a')](_0x18becc);}return null;};}function patchUpdates(_0x172c55){return function(_0x290689){try{jsonpatch[_0xbe0d('0x21')](_0x290689,_0x172c55,!![]);}catch(_0x217367){return BPromise[_0xbe0d('0x22')](_0x217367);}return _0x290689['save']();};}function saveUpdates(_0x379617,_0x5a78e1){return function(_0x416208){if(_0x416208){return _0x416208[_0xbe0d('0x23')](_0x379617)[_0xbe0d('0x24')](function(_0x6f51c4){return _0x6f51c4;});}return null;};}function removeEntity(_0x440402,_0x3a2e21){return function(_0x4f1f0b){if(_0x4f1f0b){return _0x4f1f0b[_0xbe0d('0x25')]()[_0xbe0d('0x24')](function(){_0x440402['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3928ae,_0x4b0da1){return function(_0x540d85){if(!_0x540d85){_0x3928ae['sendStatus'](0x194);}return _0x540d85;};}function handleError(_0x15868d,_0x3af25f){_0x3af25f=_0x3af25f||0x1f4;return function(_0x1d24bf){logger[_0xbe0d('0x26')](_0x1d24bf[_0xbe0d('0x27')]);if(_0x1d24bf[_0xbe0d('0x28')]){delete _0x1d24bf[_0xbe0d('0x28')];}_0x15868d[_0xbe0d('0x18')](_0x3af25f)[_0xbe0d('0x29')](_0x1d24bf);};}exports[_0xbe0d('0x2a')]=function(_0x1d62ba,_0xb739ba){var _0x4889c4={},_0x1c33d2={},_0x57ccd8={'count':0x0,'rows':[]};var _0x27dce1=_[_0xbe0d('0x2b')](db['SugarcrmConfiguration'][_0xbe0d('0x2c')],function(_0xbdc0dc){return{'name':_0xbdc0dc['fieldName'],'type':_0xbdc0dc[_0xbe0d('0x2d')][_0xbe0d('0x2e')]};});_0x1c33d2['model']=_[_0xbe0d('0x2b')](_0x27dce1,'name');_0x1c33d2[_0xbe0d('0x2f')]=_[_0xbe0d('0x30')](_0x1d62ba['query']);_0x1c33d2[_0xbe0d('0x31')]=_[_0xbe0d('0x32')](_0x1c33d2[_0xbe0d('0x33')],_0x1c33d2[_0xbe0d('0x2f')]);_0x4889c4['attributes']=_[_0xbe0d('0x32')](_0x1c33d2['model'],qs[_0xbe0d('0x34')](_0x1d62ba[_0xbe0d('0x2f')][_0xbe0d('0x34')]));_0x4889c4[_0xbe0d('0x35')]=_0x4889c4['attributes'][_0xbe0d('0x36')]?_0x4889c4[_0xbe0d('0x35')]:_0x1c33d2[_0xbe0d('0x33')];if(!_0x1d62ba[_0xbe0d('0x2f')]['hasOwnProperty']('nolimit')){_0x4889c4[_0xbe0d('0x1d')]=qs['limit'](_0x1d62ba[_0xbe0d('0x2f')]['limit']);_0x4889c4[_0xbe0d('0x1b')]=qs['offset'](_0x1d62ba[_0xbe0d('0x2f')]['offset']);}_0x4889c4[_0xbe0d('0x37')]=qs[_0xbe0d('0x38')](_0x1d62ba[_0xbe0d('0x2f')]['sort']);_0x4889c4[_0xbe0d('0x39')]=qs[_0xbe0d('0x31')](_[_0xbe0d('0x3a')](_0x1d62ba['query'],_0x1c33d2['filters']),_0x27dce1);if(_0x1d62ba['query']['filter']){_0x4889c4[_0xbe0d('0x39')]=_['merge'](_0x4889c4[_0xbe0d('0x39')],{'$or':_['map'](_0x27dce1,function(_0x16498d){if(_0x16498d[_0xbe0d('0x2d')]!==_0xbe0d('0x3b')){var _0x54f96d={};_0x54f96d[_0x16498d[_0xbe0d('0x28')]]={'$like':'%'+_0x1d62ba['query']['filter']+'%'};return _0x54f96d;}})});}_0x4889c4=_['merge']({},_0x4889c4,_0x1d62ba[_0xbe0d('0x3c')]);var _0x1de34f={'where':_0x4889c4[_0xbe0d('0x39')]};return db[_0xbe0d('0x3d')][_0xbe0d('0x1e')](_0x1de34f)[_0xbe0d('0x24')](function(_0x20cc70){_0x57ccd8[_0xbe0d('0x1e')]=_0x20cc70;if(_0x1d62ba[_0xbe0d('0x2f')][_0xbe0d('0x3e')]){_0x4889c4[_0xbe0d('0x3f')]=[{'all':!![]}];}return db[_0xbe0d('0x3d')][_0xbe0d('0x40')](_0x4889c4);})['then'](function(_0x533f03){_0x57ccd8[_0xbe0d('0x41')]=_0x533f03;return _0x57ccd8;})[_0xbe0d('0x24')](respondWithFilteredResult(_0xb739ba,_0x4889c4))[_0xbe0d('0x42')](handleError(_0xb739ba,null));};exports[_0xbe0d('0x43')]=function(_0x6f173d,_0x11f044){var _0x4c9da0={'raw':![],'where':{'id':_0x6f173d[_0xbe0d('0x44')]['id']}},_0x2074e4={};_0x2074e4['model']=_[_0xbe0d('0x30')](db['SugarcrmConfiguration'][_0xbe0d('0x2c')]);_0x2074e4[_0xbe0d('0x2f')]=_[_0xbe0d('0x30')](_0x6f173d[_0xbe0d('0x2f')]);_0x2074e4['filters']=_[_0xbe0d('0x32')](_0x2074e4['model'],_0x2074e4['query']);_0x4c9da0[_0xbe0d('0x35')]=_[_0xbe0d('0x32')](_0x2074e4['model'],qs[_0xbe0d('0x34')](_0x6f173d[_0xbe0d('0x2f')]['fields']));_0x4c9da0[_0xbe0d('0x35')]=_0x4c9da0[_0xbe0d('0x35')]['length']?_0x4c9da0[_0xbe0d('0x35')]:_0x2074e4['model'];if(_0x6f173d[_0xbe0d('0x2f')][_0xbe0d('0x3e')]){_0x4c9da0['include']=[{'all':!![]}];}_0x4c9da0=_['merge']({},_0x4c9da0,_0x6f173d[_0xbe0d('0x3c')]);return db[_0xbe0d('0x3d')][_0xbe0d('0x45')](_0x4c9da0)[_0xbe0d('0x24')](handleEntityNotFound(_0x11f044,null))[_0xbe0d('0x24')](respondWithResult(_0x11f044,null))[_0xbe0d('0x42')](handleError(_0x11f044,null));};exports[_0xbe0d('0x46')]=function(_0x25ab24,_0x146620){return db[_0xbe0d('0x3d')][_0xbe0d('0x46')](_0x25ab24[_0xbe0d('0x47')],{})[_0xbe0d('0x24')](respondWithResult(_0x146620,0xc9))['catch'](handleError(_0x146620,null));};exports['update']=function(_0x544bf9,_0x4986d0){if(_0x544bf9[_0xbe0d('0x47')]['id']){delete _0x544bf9[_0xbe0d('0x47')]['id'];}return db[_0xbe0d('0x3d')]['find']({'where':{'id':_0x544bf9['params']['id']}})[_0xbe0d('0x24')](handleEntityNotFound(_0x4986d0,null))['then'](saveUpdates(_0x544bf9[_0xbe0d('0x47')],null))['then'](respondWithResult(_0x4986d0,null))[_0xbe0d('0x42')](handleError(_0x4986d0,null));};exports['destroy']=function(_0x172c7b,_0x55d25e){return db[_0xbe0d('0x3d')][_0xbe0d('0x45')]({'where':{'id':_0x172c7b['params']['id']}})['then'](handleEntityNotFound(_0x55d25e,null))[_0xbe0d('0x24')](removeEntity(_0x55d25e,null))[_0xbe0d('0x42')](handleError(_0x55d25e,null));};exports[_0xbe0d('0x48')]=function(_0x244b86,_0x2073d4,_0x45cdea){var _0x22d372={};var _0x24c354={};var _0x35141f;var _0x567026;return db[_0xbe0d('0x3d')]['findOne']({'where':{'id':_0x244b86[_0xbe0d('0x44')]['id']}})[_0xbe0d('0x24')](handleEntityNotFound(_0x2073d4,null))[_0xbe0d('0x24')](function(_0x5e01ae){if(_0x5e01ae){_0x35141f=_0x5e01ae;_0x24c354[_0xbe0d('0x33')]=_[_0xbe0d('0x30')](db[_0xbe0d('0x49')][_0xbe0d('0x2c')]);_0x24c354[_0xbe0d('0x2f')]=_[_0xbe0d('0x30')](_0x244b86['query']);_0x24c354[_0xbe0d('0x31')]=_[_0xbe0d('0x32')](_0x24c354[_0xbe0d('0x33')],_0x24c354['query']);_0x22d372['attributes']=_[_0xbe0d('0x32')](_0x24c354['model'],qs[_0xbe0d('0x34')](_0x244b86[_0xbe0d('0x2f')][_0xbe0d('0x34')]));_0x22d372[_0xbe0d('0x35')]=_0x22d372[_0xbe0d('0x35')][_0xbe0d('0x36')]?_0x22d372[_0xbe0d('0x35')]:_0x24c354['model'];_0x22d372[_0xbe0d('0x37')]=qs[_0xbe0d('0x38')](_0x244b86['query'][_0xbe0d('0x38')]);_0x22d372[_0xbe0d('0x39')]=qs[_0xbe0d('0x31')](_[_0xbe0d('0x3a')](_0x244b86[_0xbe0d('0x2f')],_0x24c354[_0xbe0d('0x31')]));if(_0x244b86[_0xbe0d('0x2f')][_0xbe0d('0x4a')]){_0x22d372[_0xbe0d('0x39')]=_[_0xbe0d('0x4b')](_0x22d372[_0xbe0d('0x39')],{'$or':_[_0xbe0d('0x2b')](_0x22d372[_0xbe0d('0x35')],function(_0x7d03d5){var _0x2d8ddc={};_0x2d8ddc[_0x7d03d5]={'$like':'%'+_0x244b86[_0xbe0d('0x2f')][_0xbe0d('0x4a')]+'%'};return _0x2d8ddc;})});}_0x22d372=_[_0xbe0d('0x4b')]({},_0x22d372,_0x244b86[_0xbe0d('0x3c')]);return _0x35141f['getFields'](_0x22d372);}})[_0xbe0d('0x24')](function(_0xcf6f99){if(_0xcf6f99){_0x567026=_0xcf6f99['length'];if(!_0x244b86['query'][_0xbe0d('0x4c')]('nolimit')){_0x22d372['limit']=qs['limit'](_0x244b86[_0xbe0d('0x2f')][_0xbe0d('0x1d')]);_0x22d372[_0xbe0d('0x1b')]=qs['offset'](_0x244b86[_0xbe0d('0x2f')][_0xbe0d('0x1b')]);}return _0x35141f[_0xbe0d('0x48')](_0x22d372);}})['then'](function(_0x2d5c66){if(_0x2d5c66){return _0x2d5c66?{'count':_0x567026,'rows':_0x2d5c66}:null;}})['then'](respondWithResult(_0x2073d4,null))[_0xbe0d('0x42')](handleError(_0x2073d4,null));};exports[_0xbe0d('0x4d')]=function(_0x4c5a60,_0x237c8e,_0x5ba372){var _0x2482af={};var _0x3fba18={};var _0x5de554;var _0x1e3799;return db[_0xbe0d('0x3d')][_0xbe0d('0x4e')]({'where':{'id':_0x4c5a60[_0xbe0d('0x44')]['id']}})[_0xbe0d('0x24')](handleEntityNotFound(_0x237c8e,null))['then'](function(_0x12f1af){if(_0x12f1af){_0x5de554=_0x12f1af;_0x3fba18[_0xbe0d('0x33')]=_[_0xbe0d('0x30')](db[_0xbe0d('0x49')][_0xbe0d('0x2c')]);_0x3fba18[_0xbe0d('0x2f')]=_['keys'](_0x4c5a60[_0xbe0d('0x2f')]);_0x3fba18['filters']=_[_0xbe0d('0x32')](_0x3fba18['model'],_0x3fba18['query']);_0x2482af[_0xbe0d('0x35')]=_[_0xbe0d('0x32')](_0x3fba18['model'],qs[_0xbe0d('0x34')](_0x4c5a60['query'][_0xbe0d('0x34')]));_0x2482af[_0xbe0d('0x35')]=_0x2482af[_0xbe0d('0x35')][_0xbe0d('0x36')]?_0x2482af[_0xbe0d('0x35')]:_0x3fba18[_0xbe0d('0x33')];_0x2482af[_0xbe0d('0x37')]=qs[_0xbe0d('0x38')](_0x4c5a60['query'][_0xbe0d('0x38')]);_0x2482af[_0xbe0d('0x39')]=qs[_0xbe0d('0x31')](_['pick'](_0x4c5a60[_0xbe0d('0x2f')],_0x3fba18['filters']));if(_0x4c5a60['query']['filter']){_0x2482af[_0xbe0d('0x39')]=_[_0xbe0d('0x4b')](_0x2482af[_0xbe0d('0x39')],{'$or':_['map'](_0x2482af[_0xbe0d('0x35')],function(_0x4035db){var _0x48ed48={};_0x48ed48[_0x4035db]={'$like':'%'+_0x4c5a60[_0xbe0d('0x2f')][_0xbe0d('0x4a')]+'%'};return _0x48ed48;})});}_0x2482af=_[_0xbe0d('0x4b')]({},_0x2482af,_0x4c5a60['options']);return _0x5de554[_0xbe0d('0x4d')](_0x2482af);}})[_0xbe0d('0x24')](function(_0x2f0cf1){if(_0x2f0cf1){_0x1e3799=_0x2f0cf1[_0xbe0d('0x36')];if(!_0x4c5a60['query'][_0xbe0d('0x4c')](_0xbe0d('0x4f'))){_0x2482af[_0xbe0d('0x1d')]=qs[_0xbe0d('0x1d')](_0x4c5a60['query'][_0xbe0d('0x1d')]);_0x2482af['offset']=qs[_0xbe0d('0x1b')](_0x4c5a60[_0xbe0d('0x2f')]['offset']);}return _0x5de554[_0xbe0d('0x4d')](_0x2482af);}})['then'](function(_0x3c35ee){if(_0x3c35ee){return _0x3c35ee?{'count':_0x1e3799,'rows':_0x3c35ee}:null;}})[_0xbe0d('0x24')](respondWithResult(_0x237c8e,null))['catch'](handleError(_0x237c8e,null));};exports['getDescriptions']=function(_0x4821fd,_0x26964c,_0x2602bc){var _0x5af110={};var _0x5e49d7={};var _0x3f86e1;var _0x565595;return db[_0xbe0d('0x3d')][_0xbe0d('0x4e')]({'where':{'id':_0x4821fd[_0xbe0d('0x44')]['id']}})[_0xbe0d('0x24')](handleEntityNotFound(_0x26964c,null))[_0xbe0d('0x24')](function(_0x172ef8){if(_0x172ef8){_0x3f86e1=_0x172ef8;_0x5e49d7['model']=_[_0xbe0d('0x30')](db[_0xbe0d('0x49')][_0xbe0d('0x2c')]);_0x5e49d7[_0xbe0d('0x2f')]=_[_0xbe0d('0x30')](_0x4821fd[_0xbe0d('0x2f')]);_0x5e49d7[_0xbe0d('0x31')]=_[_0xbe0d('0x32')](_0x5e49d7[_0xbe0d('0x33')],_0x5e49d7[_0xbe0d('0x2f')]);_0x5af110['attributes']=_[_0xbe0d('0x32')](_0x5e49d7[_0xbe0d('0x33')],qs[_0xbe0d('0x34')](_0x4821fd['query'][_0xbe0d('0x34')]));_0x5af110[_0xbe0d('0x35')]=_0x5af110['attributes']['length']?_0x5af110['attributes']:_0x5e49d7[_0xbe0d('0x33')];_0x5af110[_0xbe0d('0x37')]=qs[_0xbe0d('0x38')](_0x4821fd[_0xbe0d('0x2f')][_0xbe0d('0x38')]);_0x5af110[_0xbe0d('0x39')]=qs[_0xbe0d('0x31')](_[_0xbe0d('0x3a')](_0x4821fd[_0xbe0d('0x2f')],_0x5e49d7['filters']));if(_0x4821fd[_0xbe0d('0x2f')][_0xbe0d('0x4a')]){_0x5af110['where']=_['merge'](_0x5af110[_0xbe0d('0x39')],{'$or':_[_0xbe0d('0x2b')](_0x5af110[_0xbe0d('0x35')],function(_0x4c2cfb){var _0x52fa90={};_0x52fa90[_0x4c2cfb]={'$like':'%'+_0x4821fd[_0xbe0d('0x2f')][_0xbe0d('0x4a')]+'%'};return _0x52fa90;})});}_0x5af110=_[_0xbe0d('0x4b')]({},_0x5af110,_0x4821fd[_0xbe0d('0x3c')]);return _0x3f86e1[_0xbe0d('0x50')](_0x5af110);}})[_0xbe0d('0x24')](function(_0x358970){if(_0x358970){_0x565595=_0x358970['length'];if(!_0x4821fd['query'][_0xbe0d('0x4c')](_0xbe0d('0x4f'))){_0x5af110[_0xbe0d('0x1d')]=qs[_0xbe0d('0x1d')](_0x4821fd['query'][_0xbe0d('0x1d')]);_0x5af110[_0xbe0d('0x1b')]=qs[_0xbe0d('0x1b')](_0x4821fd[_0xbe0d('0x2f')][_0xbe0d('0x1b')]);}return _0x3f86e1[_0xbe0d('0x50')](_0x5af110);}})['then'](function(_0x5812e9){if(_0x5812e9){return _0x5812e9?{'count':_0x565595,'rows':_0x5812e9}:null;}})['then'](respondWithResult(_0x26964c,null))[_0xbe0d('0x42')](handleError(_0x26964c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 263c584..97eefd4 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 _0xe269=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','bluebird','request-promise','path'];(function(_0x3c583a,_0x367327){var _0x18f417=function(_0x5cb40f){while(--_0x5cb40f){_0x3c583a['push'](_0x3c583a['shift']());}};_0x18f417(++_0x367327);}(_0xe269,0x10f));var _0x9e26=function(_0x2d7b79,_0x348b76){_0x2d7b79=_0x2d7b79-0x0;var _0x5f2003=_0xe269[_0x2d7b79];return _0x5f2003;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9e26('0x0'))('api');var moment=require('moment');var BPromise=require(_0x9e26('0x1'));var rp=require(_0x9e26('0x2'));var fs=require('fs');var path=require(_0x9e26('0x3'));var rimraf=require(_0x9e26('0x4'));var config=require(_0x9e26('0x5'));var attributes=require(_0x9e26('0x6'));module[_0x9e26('0x7')]=function(_0x4fca90,_0x4fb342){return _0x4fca90[_0x9e26('0x8')](_0x9e26('0x9'),attributes,{'tableName':_0x9e26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a92=['bluebird','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','moment'];(function(_0x1ee003,_0x3de654){var _0x12f06a=function(_0xaa0bed){while(--_0xaa0bed){_0x1ee003['push'](_0x1ee003['shift']());}};_0x12f06a(++_0x3de654);}(_0x7a92,0x13e));var _0x27a9=function(_0x43e6b7,_0x1ae994){_0x43e6b7=_0x43e6b7-0x0;var _0x444a8e=_0x7a92[_0x43e6b7];return _0x444a8e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x27a9('0x0'))('api');var moment=require(_0x27a9('0x1'));var BPromise=require(_0x27a9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27a9('0x3'));var rimraf=require(_0x27a9('0x4'));var config=require(_0x27a9('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x27a9('0x6')]=function(_0x181163,_0x539968){return _0x181163[_0x27a9('0x7')](_0x27a9('0x8'),attributes,{'tableName':_0x27a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index dedb2d1..0799d9c 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 _0xeacd=['error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x199dcc,_0x13e81e){var _0x20f808=function(_0x4bfc7c){while(--_0x4bfc7c){_0x199dcc['push'](_0x199dcc['shift']());}};_0x20f808(++_0x13e81e);}(_0xeacd,0x10c));var _0xdeac=function(_0x4a8540,_0x5050f9){_0x4a8540=_0x4a8540-0x0;var _0x38ffe4=_0xeacd[_0x4a8540];return _0x38ffe4;};'use strict';var _=require(_0xdeac('0x0'));var util=require(_0xdeac('0x1'));var moment=require(_0xdeac('0x2'));var BPromise=require('bluebird');var rs=require(_0xdeac('0x3'));var fs=require('fs');var Redis=require(_0xdeac('0x4'));var db=require(_0xdeac('0x5'))['db'];var utils=require(_0xdeac('0x6'));var logger=require(_0xdeac('0x7'))(_0xdeac('0x8'));var config=require(_0xdeac('0x9'));var jayson=require(_0xdeac('0xa'));var client=jayson[_0xdeac('0xb')][_0xdeac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4379dd,_0x38b052,_0x363a24){return new BPromise(function(_0x3d7f0d,_0x1a7b6f){return client[_0xdeac('0xd')](_0x4379dd,_0x363a24)[_0xdeac('0xe')](function(_0x4b0101){logger[_0xdeac('0xf')](_0xdeac('0x10'),_0x38b052,'request\x20sent');logger['debug'](_0xdeac('0x11'),_0x38b052,_0xdeac('0x12'),JSON[_0xdeac('0x13')](_0x4b0101));if(_0x4b0101['error']){if(_0x4b0101['error']['code']===0x1f4){logger['error'](_0xdeac('0x10'),_0x38b052,_0x4b0101[_0xdeac('0x14')]['message']);return _0x1a7b6f(_0x4b0101[_0xdeac('0x14')][_0xdeac('0x15')]);}logger['error'](_0xdeac('0x10'),_0x38b052,_0x4b0101[_0xdeac('0x14')][_0xdeac('0x15')]);return _0x3d7f0d(_0x4b0101['error'][_0xdeac('0x15')]);}else{logger[_0xdeac('0xf')](_0xdeac('0x10'),_0x38b052,_0xdeac('0x12'));_0x3d7f0d(_0x4b0101[_0xdeac('0x16')][_0xdeac('0x15')]);}})[_0xdeac('0x17')](function(_0x4d01f8){logger[_0xdeac('0x14')](_0xdeac('0x10'),_0x38b052,_0x4d01f8);_0x1a7b6f(_0x4d01f8);});});} \ No newline at end of file +var _0xb93e=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb93e,0xb1));var _0xeb93=function(_0x2bc3ed,_0x477713){_0x2bc3ed=_0x2bc3ed-0x0;var _0xebbe09=_0xb93e[_0x2bc3ed];return _0xebbe09;};'use strict';var _=require(_0xeb93('0x0'));var util=require(_0xeb93('0x1'));var moment=require(_0xeb93('0x2'));var BPromise=require(_0xeb93('0x3'));var rs=require(_0xeb93('0x4'));var fs=require('fs');var Redis=require(_0xeb93('0x5'));var db=require(_0xeb93('0x6'))['db'];var utils=require(_0xeb93('0x7'));var logger=require(_0xeb93('0x8'))('rpc');var config=require(_0xeb93('0x9'));var jayson=require(_0xeb93('0xa'));var client=jayson[_0xeb93('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb951,_0x2ede62,_0x3d60fd){return new BPromise(function(_0x9d052,_0x16c2b0){return client[_0xeb93('0xc')](_0x2cb951,_0x3d60fd)[_0xeb93('0xd')](function(_0x4b04ff){logger[_0xeb93('0xe')](_0xeb93('0xf'),_0x2ede62,_0xeb93('0x10'));logger[_0xeb93('0x11')](_0xeb93('0x12'),_0x2ede62,_0xeb93('0x10'),JSON[_0xeb93('0x13')](_0x4b04ff));if(_0x4b04ff[_0xeb93('0x14')]){if(_0x4b04ff[_0xeb93('0x14')]['code']===0x1f4){logger[_0xeb93('0x14')](_0xeb93('0xf'),_0x2ede62,_0x4b04ff[_0xeb93('0x14')][_0xeb93('0x15')]);return _0x16c2b0(_0x4b04ff[_0xeb93('0x14')][_0xeb93('0x15')]);}logger['error'](_0xeb93('0xf'),_0x2ede62,_0x4b04ff['error'][_0xeb93('0x15')]);return _0x9d052(_0x4b04ff['error'][_0xeb93('0x15')]);}else{logger[_0xeb93('0xe')](_0xeb93('0xf'),_0x2ede62,_0xeb93('0x10'));_0x9d052(_0x4b04ff[_0xeb93('0x16')][_0xeb93('0x15')]);}})['catch'](function(_0x3edb8c){logger[_0xeb93('0x14')](_0xeb93('0xf'),_0x2ede62,_0x3edb8c);_0x16c2b0(_0x3edb8c);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 71b24af..b910928 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 _0x1f02=['delete','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','/:id','update'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1f02,0x15c));var _0x21f0=function(_0x44356b,_0x434d06){_0x44356b=_0x44356b-0x0;var _0x47c4ec=_0x1f02[_0x44356b];return _0x47c4ec;};'use strict';var multer=require(_0x21f0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21f0('0x1')]();var fs_extra=require(_0x21f0('0x2'));var auth=require(_0x21f0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x21f0('0x4'));var controller=require('./intSugarcrmField.controller');router[_0x21f0('0x5')]('/',auth[_0x21f0('0x6')](),controller[_0x21f0('0x7')]);router[_0x21f0('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x21f0('0x8')]);router[_0x21f0('0x9')]('/',auth[_0x21f0('0x6')](),controller['create']);router['put'](_0x21f0('0xa'),auth[_0x21f0('0x6')](),controller[_0x21f0('0xb')]);router[_0x21f0('0xc')](_0x21f0('0xa'),auth['isAuthenticated'](),controller[_0x21f0('0xd')]);module[_0x21f0('0xe')]=router; \ No newline at end of file +var _0x73c7=['/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get'];(function(_0x56c956,_0x4a8cb8){var _0x1725e6=function(_0x3cdcaf){while(--_0x3cdcaf){_0x56c956['push'](_0x56c956['shift']());}};_0x1725e6(++_0x4a8cb8);}(_0x73c7,0x78));var _0x773c=function(_0x311f97,_0x355744){_0x311f97=_0x311f97-0x0;var _0x3d113b=_0x73c7[_0x311f97];return _0x3d113b;};'use strict';var multer=require(_0x773c('0x0'));var util=require(_0x773c('0x1'));var path=require(_0x773c('0x2'));var timeout=require(_0x773c('0x3'));var express=require(_0x773c('0x4'));var router=express[_0x773c('0x5')]();var fs_extra=require(_0x773c('0x6'));var auth=require(_0x773c('0x7'));var interaction=require(_0x773c('0x8'));var config=require('../../config/environment');var controller=require(_0x773c('0x9'));router['get']('/',auth[_0x773c('0xa')](),controller[_0x773c('0xb')]);router[_0x773c('0xc')](_0x773c('0xd'),auth[_0x773c('0xa')](),controller[_0x773c('0xe')]);router[_0x773c('0xf')]('/',auth[_0x773c('0xa')](),controller[_0x773c('0x10')]);router['put'](_0x773c('0xd'),auth[_0x773c('0xa')](),controller['update']);router[_0x773c('0x11')](_0x773c('0xd'),auth[_0x773c('0xa')](),controller[_0x773c('0x12')]);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 5446640..8bb7733 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 _0x649d=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0xe6023b,_0x254bc0){var _0x2a9830=function(_0x197daf){while(--_0x197daf){_0xe6023b['push'](_0xe6023b['shift']());}};_0x2a9830(++_0x254bc0);}(_0x649d,0x1d5));var _0xd649=function(_0x3d6414,_0x17c326){_0x3d6414=_0x3d6414-0x0;var _0x404db3=_0x649d[_0x3d6414];return _0x404db3;};'use strict';var Sequelize=require(_0xd649('0x0'));module[_0xd649('0x1')]={'type':{'type':Sequelize[_0xd649('0x2')](_0xd649('0x3'),_0xd649('0x4'),_0xd649('0x5'),_0xd649('0x6'),_0xd649('0x7')),'defaultValue':_0xd649('0x3')},'content':{'type':Sequelize[_0xd649('0x8')]},'key':{'type':Sequelize[_0xd649('0x8')]},'keyType':{'type':Sequelize[_0xd649('0x2')](_0xd649('0x3'),'variable',_0xd649('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd649('0x8')]},'customField':{'type':Sequelize[_0xd649('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd649('0x8')]}}; \ No newline at end of file +var _0x5455=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x1fd2e8,_0x49432f){var _0x32524e=function(_0x15a743){while(--_0x15a743){_0x1fd2e8['push'](_0x1fd2e8['shift']());}};_0x32524e(++_0x49432f);}(_0x5455,0x74));var _0x5545=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5455[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x5545('0x0'));module['exports']={'type':{'type':Sequelize[_0x5545('0x1')](_0x5545('0x2'),_0x5545('0x3'),_0x5545('0x4'),_0x5545('0x5'),_0x5545('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5545('0x7')]},'key':{'type':Sequelize[_0x5545('0x7')]},'keyType':{'type':Sequelize[_0x5545('0x1')](_0x5545('0x2'),_0x5545('0x3'),_0x5545('0x4'))},'keyContent':{'type':Sequelize[_0x5545('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5545('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index b8df004..26ea203 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 _0x96dd=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','map','SugarcrmField','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96dd,0x1b1));var _0xd96d=function(_0x291b3a,_0x3dca62){_0x291b3a=_0x291b3a-0x0;var _0x529d19=_0x96dd[_0x291b3a];return _0x529d19;};'use strict';var emlformat=require(_0xd96d('0x0'));var rimraf=require(_0xd96d('0x1'));var zipdir=require(_0xd96d('0x2'));var jsonpatch=require(_0xd96d('0x3'));var rp=require(_0xd96d('0x4'));var moment=require(_0xd96d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd96d('0x6'));var util=require(_0xd96d('0x7'));var path=require(_0xd96d('0x8'));var sox=require(_0xd96d('0x9'));var csv=require(_0xd96d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd96d('0xb'));var _=require(_0xd96d('0xc'));var squel=require(_0xd96d('0xd'));var crypto=require(_0xd96d('0xe'));var jsforce=require(_0xd96d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd96d('0x10'));var Papa=require(_0xd96d('0x11'));var Redis=require(_0xd96d('0x12'));var authService=require(_0xd96d('0x13'));var qs=require(_0xd96d('0x14'));var as=require(_0xd96d('0x15'));var hardwareService=require(_0xd96d('0x16'));var logger=require('../../config/logger')(_0xd96d('0x17'));var utils=require(_0xd96d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd96d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ae0f0,_0x4f0998){_0x4f0998=_0x4f0998||0xcc;return function(_0x8dd2a5){if(_0x8dd2a5){return _0x4ae0f0[_0xd96d('0x1a')](_0x4f0998);}return _0x4ae0f0[_0xd96d('0x1b')](_0x4f0998)[_0xd96d('0x1c')]();};}function respondWithResult(_0x2f18d8,_0x5247d6){_0x5247d6=_0x5247d6||0xc8;return function(_0x260f0d){if(_0x260f0d){return _0x2f18d8[_0xd96d('0x1b')](_0x5247d6)[_0xd96d('0x1d')](_0x260f0d);}};}function respondWithFilteredResult(_0x4ecc4d,_0xf4b0b0){return function(_0x4c5c3c){if(_0x4c5c3c){var _0x4a09b5=typeof _0xf4b0b0['offset']==='undefined'&&typeof _0xf4b0b0[_0xd96d('0x1e')]===_0xd96d('0x1f');var _0x417b02=_0x4c5c3c['count'];var _0x3c1801=_0x4a09b5?0x0:_0xf4b0b0[_0xd96d('0x20')];var _0x2d2fbd=_0x4a09b5?_0x4c5c3c[_0xd96d('0x21')]:_0xf4b0b0['offset']+_0xf4b0b0['limit'];var _0x228151;if(_0x2d2fbd>=_0x417b02){_0x2d2fbd=_0x417b02;_0x228151=0xc8;}else{_0x228151=0xce;}_0x4ecc4d['status'](_0x228151);return _0x4ecc4d[_0xd96d('0x22')](_0xd96d('0x23'),_0x3c1801+'-'+_0x2d2fbd+'/'+_0x417b02)[_0xd96d('0x1d')](_0x4c5c3c);}return null;};}function patchUpdates(_0x5327b4){return function(_0x4e48fa){try{jsonpatch['apply'](_0x4e48fa,_0x5327b4,!![]);}catch(_0x1eac39){return BPromise[_0xd96d('0x24')](_0x1eac39);}return _0x4e48fa[_0xd96d('0x25')]();};}function saveUpdates(_0x4b239e,_0x24cadc){return function(_0x3d612c){if(_0x3d612c){return _0x3d612c[_0xd96d('0x26')](_0x4b239e)[_0xd96d('0x27')](function(_0x56be03){return _0x56be03;});}return null;};}function removeEntity(_0x1f8eeb,_0x381f3c){return function(_0x1894bc){if(_0x1894bc){return _0x1894bc[_0xd96d('0x28')]()[_0xd96d('0x27')](function(){_0x1f8eeb[_0xd96d('0x1b')](0xcc)[_0xd96d('0x1c')]();});}};}function handleEntityNotFound(_0x332126,_0x17ecb3){return function(_0x7c2928){if(!_0x7c2928){_0x332126[_0xd96d('0x1a')](0x194);}return _0x7c2928;};}function handleError(_0xbce6e4,_0xc6219){_0xc6219=_0xc6219||0x1f4;return function(_0x1a59a3){logger[_0xd96d('0x29')](_0x1a59a3[_0xd96d('0x2a')]);if(_0x1a59a3[_0xd96d('0x2b')]){delete _0x1a59a3[_0xd96d('0x2b')];}_0xbce6e4[_0xd96d('0x1b')](_0xc6219)['send'](_0x1a59a3);};}exports['index']=function(_0x328673,_0x36c23f){var _0x30078b={},_0x2d8b5f={},_0xd0aa06={'count':0x0,'rows':[]};var _0x1fe204=_[_0xd96d('0x2c')](db[_0xd96d('0x2d')][_0xd96d('0x2e')],function(_0x3105a9){return{'name':_0x3105a9['fieldName'],'type':_0x3105a9[_0xd96d('0x2f')][_0xd96d('0x30')]};});_0x2d8b5f[_0xd96d('0x31')]=_[_0xd96d('0x2c')](_0x1fe204,_0xd96d('0x2b'));_0x2d8b5f[_0xd96d('0x32')]=_[_0xd96d('0x33')](_0x328673[_0xd96d('0x32')]);_0x2d8b5f['filters']=_[_0xd96d('0x34')](_0x2d8b5f[_0xd96d('0x31')],_0x2d8b5f[_0xd96d('0x32')]);_0x30078b[_0xd96d('0x35')]=_[_0xd96d('0x34')](_0x2d8b5f['model'],qs['fields'](_0x328673[_0xd96d('0x32')][_0xd96d('0x36')]));_0x30078b['attributes']=_0x30078b[_0xd96d('0x35')][_0xd96d('0x37')]?_0x30078b[_0xd96d('0x35')]:_0x2d8b5f['model'];if(!_0x328673[_0xd96d('0x32')]['hasOwnProperty'](_0xd96d('0x38'))){_0x30078b[_0xd96d('0x1e')]=qs[_0xd96d('0x1e')](_0x328673[_0xd96d('0x32')][_0xd96d('0x1e')]);_0x30078b[_0xd96d('0x20')]=qs[_0xd96d('0x20')](_0x328673['query']['offset']);}_0x30078b[_0xd96d('0x39')]=qs[_0xd96d('0x3a')](_0x328673['query'][_0xd96d('0x3a')]);_0x30078b[_0xd96d('0x3b')]=qs[_0xd96d('0x3c')](_[_0xd96d('0x3d')](_0x328673[_0xd96d('0x32')],_0x2d8b5f['filters']),_0x1fe204);if(_0x328673[_0xd96d('0x32')][_0xd96d('0x3e')]){_0x30078b[_0xd96d('0x3b')]=_[_0xd96d('0x3f')](_0x30078b[_0xd96d('0x3b')],{'$or':_[_0xd96d('0x2c')](_0x1fe204,function(_0x2cec94){if(_0x2cec94[_0xd96d('0x2f')]!=='VIRTUAL'){var _0x3023f6={};_0x3023f6[_0x2cec94[_0xd96d('0x2b')]]={'$like':'%'+_0x328673['query'][_0xd96d('0x3e')]+'%'};return _0x3023f6;}})});}_0x30078b=_[_0xd96d('0x3f')]({},_0x30078b,_0x328673[_0xd96d('0x40')]);var _0x5d826d={'where':_0x30078b[_0xd96d('0x3b')]};return db[_0xd96d('0x2d')][_0xd96d('0x21')](_0x5d826d)[_0xd96d('0x27')](function(_0x446d96){_0xd0aa06[_0xd96d('0x21')]=_0x446d96;if(_0x328673[_0xd96d('0x32')][_0xd96d('0x41')]){_0x30078b[_0xd96d('0x42')]=[{'all':!![]}];}return db[_0xd96d('0x2d')]['findAll'](_0x30078b);})[_0xd96d('0x27')](function(_0x59f74e){_0xd0aa06[_0xd96d('0x43')]=_0x59f74e;return _0xd0aa06;})['then'](respondWithFilteredResult(_0x36c23f,_0x30078b))[_0xd96d('0x44')](handleError(_0x36c23f,null));};exports[_0xd96d('0x45')]=function(_0xc5353c,_0x17244b){var _0x9c252b={'raw':!![],'where':{'id':_0xc5353c['params']['id']}},_0x5ca5d5={};_0x5ca5d5['model']=_['keys'](db['SugarcrmField']['rawAttributes']);_0x5ca5d5[_0xd96d('0x32')]=_[_0xd96d('0x33')](_0xc5353c[_0xd96d('0x32')]);_0x5ca5d5[_0xd96d('0x3c')]=_[_0xd96d('0x34')](_0x5ca5d5[_0xd96d('0x31')],_0x5ca5d5[_0xd96d('0x32')]);_0x9c252b[_0xd96d('0x35')]=_[_0xd96d('0x34')](_0x5ca5d5[_0xd96d('0x31')],qs[_0xd96d('0x36')](_0xc5353c['query'][_0xd96d('0x36')]));_0x9c252b['attributes']=_0x9c252b[_0xd96d('0x35')][_0xd96d('0x37')]?_0x9c252b[_0xd96d('0x35')]:_0x5ca5d5[_0xd96d('0x31')];if(_0xc5353c['query'][_0xd96d('0x41')]){_0x9c252b[_0xd96d('0x42')]=[{'all':!![]}];}_0x9c252b=_[_0xd96d('0x3f')]({},_0x9c252b,_0xc5353c['options']);return db[_0xd96d('0x2d')][_0xd96d('0x46')](_0x9c252b)[_0xd96d('0x27')](handleEntityNotFound(_0x17244b,null))[_0xd96d('0x27')](respondWithResult(_0x17244b,null))['catch'](handleError(_0x17244b,null));};exports[_0xd96d('0x47')]=function(_0x2259ef,_0x52de1a){return db[_0xd96d('0x2d')][_0xd96d('0x47')](_0x2259ef['body'],{})[_0xd96d('0x27')](respondWithResult(_0x52de1a,0xc9))[_0xd96d('0x44')](handleError(_0x52de1a,null));};exports[_0xd96d('0x26')]=function(_0x2418ef,_0x212fe4){if(_0x2418ef[_0xd96d('0x48')]['id']){delete _0x2418ef[_0xd96d('0x48')]['id'];}return db[_0xd96d('0x2d')][_0xd96d('0x46')]({'where':{'id':_0x2418ef[_0xd96d('0x49')]['id']}})[_0xd96d('0x27')](handleEntityNotFound(_0x212fe4,null))[_0xd96d('0x27')](saveUpdates(_0x2418ef['body'],null))[_0xd96d('0x27')](respondWithResult(_0x212fe4,null))[_0xd96d('0x44')](handleError(_0x212fe4,null));};exports[_0xd96d('0x28')]=function(_0x5831ba,_0x578bb1){return db['SugarcrmField'][_0xd96d('0x46')]({'where':{'id':_0x5831ba[_0xd96d('0x49')]['id']}})[_0xd96d('0x27')](handleEntityNotFound(_0x578bb1,null))[_0xd96d('0x27')](removeEntity(_0x578bb1,null))['catch'](handleError(_0x578bb1,null));}; \ No newline at end of file +var _0x56a2=['hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','findAll','rows','catch','show','params','keys','intersection','include','merge','find','create','body','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length'];(function(_0x2ebc04,_0x412f52){var _0x442259=function(_0xefee19){while(--_0xefee19){_0x2ebc04['push'](_0x2ebc04['shift']());}};_0x442259(++_0x412f52);}(_0x56a2,0xaa));var _0x256a=function(_0x3a94e1,_0x22e4fd){_0x3a94e1=_0x3a94e1-0x0;var _0x6a09d5=_0x56a2[_0x3a94e1];return _0x6a09d5;};'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(_0x256a('0x0'));var moment=require(_0x256a('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x256a('0x2'));var csv=require(_0x256a('0x3'));var ejs=require(_0x256a('0x4'));var fs=require('fs');var fs_extra=require(_0x256a('0x5'));var _=require(_0x256a('0x6'));var squel=require(_0x256a('0x7'));var crypto=require(_0x256a('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x256a('0x9'));var toCsv=require(_0x256a('0x3'));var querystring=require(_0x256a('0xa'));var Papa=require(_0x256a('0xb'));var Redis=require(_0x256a('0xc'));var authService=require(_0x256a('0xd'));var qs=require(_0x256a('0xe'));var as=require(_0x256a('0xf'));var hardwareService=require(_0x256a('0x10'));var logger=require(_0x256a('0x11'))(_0x256a('0x12'));var utils=require(_0x256a('0x13'));var config=require(_0x256a('0x14'));var licenseUtil=require(_0x256a('0x15'));var db=require(_0x256a('0x16'))['db'];function respondWithStatusCode(_0x424b14,_0x163f28){_0x163f28=_0x163f28||0xcc;return function(_0x55e056){if(_0x55e056){return _0x424b14[_0x256a('0x17')](_0x163f28);}return _0x424b14[_0x256a('0x18')](_0x163f28)['end']();};}function respondWithResult(_0x4646c6,_0x5155ec){_0x5155ec=_0x5155ec||0xc8;return function(_0x138d78){if(_0x138d78){return _0x4646c6['status'](_0x5155ec)[_0x256a('0x19')](_0x138d78);}};}function respondWithFilteredResult(_0x14dc4b,_0x4811b5){return function(_0x55cde1){if(_0x55cde1){var _0x383fbc=typeof _0x4811b5[_0x256a('0x1a')]===_0x256a('0x1b')&&typeof _0x4811b5[_0x256a('0x1c')]===_0x256a('0x1b');var _0x2b3257=_0x55cde1[_0x256a('0x1d')];var _0x39ef54=_0x383fbc?0x0:_0x4811b5[_0x256a('0x1a')];var _0x137636=_0x383fbc?_0x55cde1[_0x256a('0x1d')]:_0x4811b5[_0x256a('0x1a')]+_0x4811b5['limit'];var _0xd9b08;if(_0x137636>=_0x2b3257){_0x137636=_0x2b3257;_0xd9b08=0xc8;}else{_0xd9b08=0xce;}_0x14dc4b[_0x256a('0x18')](_0xd9b08);return _0x14dc4b[_0x256a('0x1e')](_0x256a('0x1f'),_0x39ef54+'-'+_0x137636+'/'+_0x2b3257)[_0x256a('0x19')](_0x55cde1);}return null;};}function patchUpdates(_0x9b87e9){return function(_0x20bcf6){try{jsonpatch[_0x256a('0x20')](_0x20bcf6,_0x9b87e9,!![]);}catch(_0x10a600){return BPromise[_0x256a('0x21')](_0x10a600);}return _0x20bcf6[_0x256a('0x22')]();};}function saveUpdates(_0x5da3a4,_0x53207e){return function(_0x10aaed){if(_0x10aaed){return _0x10aaed[_0x256a('0x23')](_0x5da3a4)[_0x256a('0x24')](function(_0x4fb10b){return _0x4fb10b;});}return null;};}function removeEntity(_0x27236d,_0x194e8e){return function(_0x46d3bb){if(_0x46d3bb){return _0x46d3bb[_0x256a('0x25')]()['then'](function(){_0x27236d[_0x256a('0x18')](0xcc)[_0x256a('0x26')]();});}};}function handleEntityNotFound(_0x55fbc2,_0x2a66c9){return function(_0x11026a){if(!_0x11026a){_0x55fbc2[_0x256a('0x17')](0x194);}return _0x11026a;};}function handleError(_0x779e58,_0x1006d1){_0x1006d1=_0x1006d1||0x1f4;return function(_0x576618){logger['error'](_0x576618[_0x256a('0x27')]);if(_0x576618[_0x256a('0x28')]){delete _0x576618[_0x256a('0x28')];}_0x779e58[_0x256a('0x18')](_0x1006d1)[_0x256a('0x29')](_0x576618);};}exports[_0x256a('0x2a')]=function(_0x10da30,_0x1b1f13){var _0x36f4c8={},_0x3a9249={},_0x3fa9d2={'count':0x0,'rows':[]};var _0x8108a7=_[_0x256a('0x2b')](db[_0x256a('0x2c')][_0x256a('0x2d')],function(_0xa45640){return{'name':_0xa45640[_0x256a('0x2e')],'type':_0xa45640[_0x256a('0x2f')][_0x256a('0x30')]};});_0x3a9249[_0x256a('0x31')]=_[_0x256a('0x2b')](_0x8108a7,_0x256a('0x28'));_0x3a9249[_0x256a('0x32')]=_['keys'](_0x10da30[_0x256a('0x32')]);_0x3a9249[_0x256a('0x33')]=_['intersection'](_0x3a9249[_0x256a('0x31')],_0x3a9249[_0x256a('0x32')]);_0x36f4c8['attributes']=_['intersection'](_0x3a9249[_0x256a('0x31')],qs[_0x256a('0x34')](_0x10da30['query'][_0x256a('0x34')]));_0x36f4c8[_0x256a('0x35')]=_0x36f4c8[_0x256a('0x35')][_0x256a('0x36')]?_0x36f4c8[_0x256a('0x35')]:_0x3a9249[_0x256a('0x31')];if(!_0x10da30[_0x256a('0x32')][_0x256a('0x37')](_0x256a('0x38'))){_0x36f4c8['limit']=qs[_0x256a('0x1c')](_0x10da30[_0x256a('0x32')][_0x256a('0x1c')]);_0x36f4c8[_0x256a('0x1a')]=qs[_0x256a('0x1a')](_0x10da30[_0x256a('0x32')][_0x256a('0x1a')]);}_0x36f4c8[_0x256a('0x39')]=qs[_0x256a('0x3a')](_0x10da30[_0x256a('0x32')][_0x256a('0x3a')]);_0x36f4c8[_0x256a('0x3b')]=qs[_0x256a('0x33')](_['pick'](_0x10da30[_0x256a('0x32')],_0x3a9249[_0x256a('0x33')]),_0x8108a7);if(_0x10da30['query']['filter']){_0x36f4c8[_0x256a('0x3b')]=_['merge'](_0x36f4c8[_0x256a('0x3b')],{'$or':_[_0x256a('0x2b')](_0x8108a7,function(_0x5a6001){if(_0x5a6001[_0x256a('0x2f')]!=='VIRTUAL'){var _0x4242fa={};_0x4242fa[_0x5a6001[_0x256a('0x28')]]={'$like':'%'+_0x10da30[_0x256a('0x32')][_0x256a('0x3c')]+'%'};return _0x4242fa;}})});}_0x36f4c8=_['merge']({},_0x36f4c8,_0x10da30[_0x256a('0x3d')]);var _0x40990c={'where':_0x36f4c8[_0x256a('0x3b')]};return db[_0x256a('0x2c')]['count'](_0x40990c)[_0x256a('0x24')](function(_0x3c6cbe){_0x3fa9d2[_0x256a('0x1d')]=_0x3c6cbe;if(_0x10da30[_0x256a('0x32')][_0x256a('0x3e')]){_0x36f4c8['include']=[{'all':!![]}];}return db[_0x256a('0x2c')][_0x256a('0x3f')](_0x36f4c8);})[_0x256a('0x24')](function(_0x34fcec){_0x3fa9d2[_0x256a('0x40')]=_0x34fcec;return _0x3fa9d2;})[_0x256a('0x24')](respondWithFilteredResult(_0x1b1f13,_0x36f4c8))[_0x256a('0x41')](handleError(_0x1b1f13,null));};exports[_0x256a('0x42')]=function(_0xba150a,_0x243686){var _0xdb98ea={'raw':!![],'where':{'id':_0xba150a[_0x256a('0x43')]['id']}},_0x4f6eb2={};_0x4f6eb2['model']=_[_0x256a('0x44')](db[_0x256a('0x2c')][_0x256a('0x2d')]);_0x4f6eb2['query']=_['keys'](_0xba150a[_0x256a('0x32')]);_0x4f6eb2[_0x256a('0x33')]=_['intersection'](_0x4f6eb2[_0x256a('0x31')],_0x4f6eb2[_0x256a('0x32')]);_0xdb98ea[_0x256a('0x35')]=_[_0x256a('0x45')](_0x4f6eb2[_0x256a('0x31')],qs['fields'](_0xba150a['query'][_0x256a('0x34')]));_0xdb98ea[_0x256a('0x35')]=_0xdb98ea[_0x256a('0x35')][_0x256a('0x36')]?_0xdb98ea[_0x256a('0x35')]:_0x4f6eb2[_0x256a('0x31')];if(_0xba150a[_0x256a('0x32')][_0x256a('0x3e')]){_0xdb98ea[_0x256a('0x46')]=[{'all':!![]}];}_0xdb98ea=_[_0x256a('0x47')]({},_0xdb98ea,_0xba150a[_0x256a('0x3d')]);return db['SugarcrmField'][_0x256a('0x48')](_0xdb98ea)[_0x256a('0x24')](handleEntityNotFound(_0x243686,null))[_0x256a('0x24')](respondWithResult(_0x243686,null))[_0x256a('0x41')](handleError(_0x243686,null));};exports[_0x256a('0x49')]=function(_0x1488ea,_0x38320e){return db['SugarcrmField']['create'](_0x1488ea[_0x256a('0x4a')],{})[_0x256a('0x24')](respondWithResult(_0x38320e,0xc9))[_0x256a('0x41')](handleError(_0x38320e,null));};exports[_0x256a('0x23')]=function(_0xf48754,_0x51601b){if(_0xf48754[_0x256a('0x4a')]['id']){delete _0xf48754[_0x256a('0x4a')]['id'];}return db[_0x256a('0x2c')][_0x256a('0x48')]({'where':{'id':_0xf48754[_0x256a('0x43')]['id']}})[_0x256a('0x24')](handleEntityNotFound(_0x51601b,null))[_0x256a('0x24')](saveUpdates(_0xf48754[_0x256a('0x4a')],null))[_0x256a('0x24')](respondWithResult(_0x51601b,null))[_0x256a('0x41')](handleError(_0x51601b,null));};exports[_0x256a('0x25')]=function(_0x33ac09,_0x14047b){return db[_0x256a('0x2c')][_0x256a('0x48')]({'where':{'id':_0x33ac09['params']['id']}})[_0x256a('0x24')](handleEntityNotFound(_0x14047b,null))[_0x256a('0x24')](removeEntity(_0x14047b,null))[_0x256a('0x41')](handleError(_0x14047b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e9d66eb..1546dd7 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 _0xb554=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util'];(function(_0x334619,_0x4d049e){var _0x174dea=function(_0x574705){while(--_0x574705){_0x334619['push'](_0x334619['shift']());}};_0x174dea(++_0x4d049e);}(_0xb554,0xfd));var _0x4b55=function(_0x20f26e,_0x5e99c2){_0x20f26e=_0x20f26e-0x0;var _0x7ac649=_0xb554[_0x20f26e];return _0x7ac649;};'use strict';var _=require(_0x4b55('0x0'));var util=require(_0x4b55('0x1'));var logger=require(_0x4b55('0x2'))(_0x4b55('0x3'));var moment=require(_0x4b55('0x4'));var BPromise=require(_0x4b55('0x5'));var rp=require(_0x4b55('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b55('0x7'));var config=require('../../config/environment');var attributes=require(_0x4b55('0x8'));module[_0x4b55('0x9')]=function(_0x1aef59,_0x2eec5c){return _0x1aef59[_0x4b55('0xa')](_0x4b55('0xb'),attributes,{'tableName':_0x4b55('0xc'),'paranoid':![],'indexes':[{'name':_0x4b55('0xd'),'fields':['idField',_0x4b55('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb050=['./intSugarcrmField.attributes','exports','define','SugarcrmField','FieldId','lodash','util','api','request-promise','rimraf','../../config/environment'];(function(_0x92075a,_0xd78175){var _0x456c44=function(_0x1d1cec){while(--_0x1d1cec){_0x92075a['push'](_0x92075a['shift']());}};_0x456c44(++_0xd78175);}(_0xb050,0x102));var _0x0b05=function(_0x117885,_0x30988f){_0x117885=_0x117885-0x0;var _0x595006=_0xb050[_0x117885];return _0x595006;};'use strict';var _=require(_0x0b05('0x0'));var util=require(_0x0b05('0x1'));var logger=require('../../config/logger')(_0x0b05('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b05('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b05('0x4'));var config=require(_0x0b05('0x5'));var attributes=require(_0x0b05('0x6'));module[_0x0b05('0x7')]=function(_0x36c1f5,_0x260d91){return _0x36c1f5[_0x0b05('0x8')](_0x0b05('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x0b05('0xa')],'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 8ecfe6d..fc55bb2 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 _0xaaf5=['bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','request','then','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment'];(function(_0x225b4b,_0x55a260){var _0xaec8c3=function(_0x23be29){while(--_0x23be29){_0x225b4b['push'](_0x225b4b['shift']());}};_0xaec8c3(++_0x55a260);}(_0xaaf5,0x1d1));var _0x5aaf=function(_0x2d822b,_0x2ce322){_0x2d822b=_0x2d822b-0x0;var _0x36ac27=_0xaaf5[_0x2d822b];return _0x36ac27;};'use strict';var _=require(_0x5aaf('0x0'));var util=require(_0x5aaf('0x1'));var moment=require(_0x5aaf('0x2'));var BPromise=require(_0x5aaf('0x3'));var rs=require(_0x5aaf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5aaf('0x5'))(_0x5aaf('0x6'));var config=require(_0x5aaf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5aaf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x86b47,_0x135c2a,_0x53483f){return new BPromise(function(_0x50c844,_0x29a3c3){return client[_0x5aaf('0x9')](_0x86b47,_0x53483f)[_0x5aaf('0xa')](function(_0x14a6ff){logger['info'](_0x5aaf('0xb'),_0x135c2a,'request\x20sent');logger['debug'](_0x5aaf('0xc'),_0x135c2a,_0x5aaf('0xd'),JSON[_0x5aaf('0xe')](_0x14a6ff));if(_0x14a6ff[_0x5aaf('0xf')]){if(_0x14a6ff[_0x5aaf('0xf')]['code']===0x1f4){logger[_0x5aaf('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x135c2a,_0x14a6ff[_0x5aaf('0xf')][_0x5aaf('0x10')]);return _0x29a3c3(_0x14a6ff['error'][_0x5aaf('0x10')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x135c2a,_0x14a6ff[_0x5aaf('0xf')][_0x5aaf('0x10')]);return _0x50c844(_0x14a6ff[_0x5aaf('0xf')][_0x5aaf('0x10')]);}else{logger['info'](_0x5aaf('0xb'),_0x135c2a,_0x5aaf('0xd'));_0x50c844(_0x14a6ff['result'][_0x5aaf('0x10')]);}})[_0x5aaf('0x11')](function(_0xaad3a1){logger[_0x5aaf('0xf')](_0x5aaf('0xb'),_0x135c2a,_0xaad3a1);_0x29a3c3(_0xaad3a1);});});} \ No newline at end of file +var _0xd5ca=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x58ca9f,_0x1aba52){var _0x5d7da7=function(_0x192461){while(--_0x192461){_0x58ca9f['push'](_0x58ca9f['shift']());}};_0x5d7da7(++_0x1aba52);}(_0xd5ca,0x170));var _0xad5c=function(_0x5884e9,_0x4d03e2){_0x5884e9=_0x5884e9-0x0;var _0x2274b0=_0xd5ca[_0x5884e9];return _0x2274b0;};'use strict';var _=require(_0xad5c('0x0'));var util=require(_0xad5c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xad5c('0x2'));var fs=require('fs');var Redis=require(_0xad5c('0x3'));var db=require(_0xad5c('0x4'))['db'];var utils=require(_0xad5c('0x5'));var logger=require(_0xad5c('0x6'))(_0xad5c('0x7'));var config=require(_0xad5c('0x8'));var jayson=require(_0xad5c('0x9'));var client=jayson['client'][_0xad5c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b84f9,_0x342b14,_0x3a4769){return new BPromise(function(_0x164cdd,_0x392b0e){return client[_0xad5c('0xb')](_0x4b84f9,_0x3a4769)[_0xad5c('0xc')](function(_0xcf506f){logger[_0xad5c('0xd')](_0xad5c('0xe'),_0x342b14,_0xad5c('0xf'));logger[_0xad5c('0x10')](_0xad5c('0x11'),_0x342b14,_0xad5c('0xf'),JSON[_0xad5c('0x12')](_0xcf506f));if(_0xcf506f['error']){if(_0xcf506f[_0xad5c('0x13')][_0xad5c('0x14')]===0x1f4){logger['error'](_0xad5c('0xe'),_0x342b14,_0xcf506f[_0xad5c('0x13')][_0xad5c('0x15')]);return _0x392b0e(_0xcf506f[_0xad5c('0x13')][_0xad5c('0x15')]);}logger[_0xad5c('0x13')](_0xad5c('0xe'),_0x342b14,_0xcf506f[_0xad5c('0x13')]['message']);return _0x164cdd(_0xcf506f[_0xad5c('0x13')]['message']);}else{logger[_0xad5c('0xd')](_0xad5c('0xe'),_0x342b14,'request\x20sent');_0x164cdd(_0xcf506f[_0xad5c('0x16')]['message']);}})[_0xad5c('0x17')](function(_0x355309){logger[_0xad5c('0x13')](_0xad5c('0xe'),_0x342b14,_0x355309);_0x392b0e(_0x355309);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index a901287..9e13160 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 _0x0ec2=['create','addConfiguration','put','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post'];(function(_0x437713,_0x2c63b7){var _0x3aeaa2=function(_0x309663){while(--_0x309663){_0x437713['push'](_0x437713['shift']());}};_0x3aeaa2(++_0x2c63b7);}(_0x0ec2,0x72));var _0x20ec=function(_0x2b2c53,_0x4bcf9b){_0x2b2c53=_0x2b2c53-0x0;var _0x311ec2=_0x0ec2[_0x2b2c53];return _0x311ec2;};'use strict';var multer=require(_0x20ec('0x0'));var util=require('util');var path=require(_0x20ec('0x1'));var timeout=require(_0x20ec('0x2'));var express=require(_0x20ec('0x3'));var router=express[_0x20ec('0x4')]();var fs_extra=require(_0x20ec('0x5'));var auth=require(_0x20ec('0x6'));var interaction=require(_0x20ec('0x7'));var config=require(_0x20ec('0x8'));var controller=require(_0x20ec('0x9'));router[_0x20ec('0xa')]('/',auth[_0x20ec('0xb')](),controller[_0x20ec('0xc')]);router[_0x20ec('0xa')](_0x20ec('0xd'),auth[_0x20ec('0xb')](),controller['show']);router[_0x20ec('0xa')]('/:id/configurations',auth[_0x20ec('0xb')](),controller[_0x20ec('0xe')]);router[_0x20ec('0xa')](_0x20ec('0xf'),auth[_0x20ec('0xb')](),controller[_0x20ec('0x10')]);router[_0x20ec('0x11')]('/',auth[_0x20ec('0xb')](),controller[_0x20ec('0x12')]);router[_0x20ec('0x11')]('/:id/configurations',auth[_0x20ec('0xb')](),controller[_0x20ec('0x13')]);router[_0x20ec('0x14')](_0x20ec('0xd'),auth[_0x20ec('0xb')](),controller['update']);router['delete'](_0x20ec('0xd'),auth[_0x20ec('0xb')](),controller['destroy']);module[_0x20ec('0x15')]=router; \ No newline at end of file +var _0xe920=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','post','addConfiguration','delete','destroy'];(function(_0x2c021b,_0x521d59){var _0x27ac93=function(_0x583cbe){while(--_0x583cbe){_0x2c021b['push'](_0x2c021b['shift']());}};_0x27ac93(++_0x521d59);}(_0xe920,0xbe));var _0x0e92=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0xe920[_0x3bab09];return _0x164376;};'use strict';var multer=require(_0x0e92('0x0'));var util=require(_0x0e92('0x1'));var path=require(_0x0e92('0x2'));var timeout=require(_0x0e92('0x3'));var express=require(_0x0e92('0x4'));var router=express[_0x0e92('0x5')]();var fs_extra=require(_0x0e92('0x6'));var auth=require(_0x0e92('0x7'));var interaction=require(_0x0e92('0x8'));var config=require(_0x0e92('0x9'));var controller=require('./intVtigerAccount.controller');router[_0x0e92('0xa')]('/',auth['isAuthenticated'](),controller[_0x0e92('0xb')]);router[_0x0e92('0xa')](_0x0e92('0xc'),auth[_0x0e92('0xd')](),controller['show']);router[_0x0e92('0xa')](_0x0e92('0xe'),auth[_0x0e92('0xd')](),controller[_0x0e92('0xf')]);router[_0x0e92('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x0e92('0x10')]('/',auth[_0x0e92('0xd')](),controller['create']);router['post']('/:id/configurations',auth[_0x0e92('0xd')](),controller[_0x0e92('0x11')]);router['put'](_0x0e92('0xc'),auth[_0x0e92('0xd')](),controller['update']);router[_0x0e92('0x12')](_0x0e92('0xc'),auth[_0x0e92('0xd')](),controller[_0x0e92('0x13')]);module[_0x0e92('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 62187b7..82fdc25 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 _0x6684=['exports','STRING','HelpDesk'];(function(_0x49189f,_0x1a5de2){var _0x3a9cf1=function(_0x365b6a){while(--_0x365b6a){_0x49189f['push'](_0x49189f['shift']());}};_0x3a9cf1(++_0x1a5de2);}(_0x6684,0xed));var _0x4668=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x6684[_0x51bda1];return _0x1ce08c;};'use strict';var Sequelize=require('sequelize');module[_0x4668('0x0')]={'name':{'type':Sequelize[_0x4668('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4668('0x1')],'allowNull':![],'defaultValue':_0x4668('0x2')},'remoteUri':{'type':Sequelize[_0x4668('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4668('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x83ba=['HelpDesk','sequelize','exports','STRING'];(function(_0x142b0b,_0x50b597){var _0x4b7181=function(_0x1001e5){while(--_0x1001e5){_0x142b0b['push'](_0x142b0b['shift']());}};_0x4b7181(++_0x50b597);}(_0x83ba,0xf1));var _0xa83b=function(_0x568df7,_0x27c02f){_0x568df7=_0x568df7-0x0;var _0x16cc04=_0x83ba[_0x568df7];return _0x16cc04;};'use strict';var Sequelize=require(_0xa83b('0x0'));module[_0xa83b('0x1')]={'name':{'type':Sequelize[_0xa83b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa83b('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa83b('0x2')],'allowNull':![],'defaultValue':_0xa83b('0x3')},'remoteUri':{'type':Sequelize[_0xa83b('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa83b('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa83b('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 23eefd5..0dc0e5c 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 _0xbc63=['send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../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','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','VtigerAccount','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','keys','options','find','create','body','params','findOne','VtigerConfiguration','getConfigurations','Subjects','channel','Descriptions','getDescriptions','VtigerField','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','result','token','autogenerated','reference','owner','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x32aa9e,_0x21dd46){var _0x403275=function(_0x36a9e6){while(--_0x36a9e6){_0x32aa9e['push'](_0x32aa9e['shift']());}};_0x403275(++_0x21dd46);}(_0xbc63,0x7c));var _0x3bc6=function(_0x94cc07,_0x110609){_0x94cc07=_0x94cc07-0x0;var _0x56c7ac=_0xbc63[_0x94cc07];return _0x56c7ac;};'use strict';var emlformat=require(_0x3bc6('0x0'));var rimraf=require(_0x3bc6('0x1'));var zipdir=require(_0x3bc6('0x2'));var jsonpatch=require(_0x3bc6('0x3'));var rp=require(_0x3bc6('0x4'));var moment=require(_0x3bc6('0x5'));var BPromise=require(_0x3bc6('0x6'));var Mustache=require(_0x3bc6('0x7'));var util=require(_0x3bc6('0x8'));var path=require(_0x3bc6('0x9'));var sox=require(_0x3bc6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bc6('0xb'));var _=require('lodash');var squel=require(_0x3bc6('0xc'));var crypto=require(_0x3bc6('0xd'));var jsforce=require(_0x3bc6('0xe'));var deskjs=require(_0x3bc6('0xf'));var toCsv=require(_0x3bc6('0x10'));var querystring=require('querystring');var Papa=require(_0x3bc6('0x11'));var Redis=require(_0x3bc6('0x12'));var authService=require(_0x3bc6('0x13'));var qs=require(_0x3bc6('0x14'));var as=require(_0x3bc6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bc6('0x16'))(_0x3bc6('0x17'));var utils=require(_0x3bc6('0x18'));var config=require(_0x3bc6('0x19'));var licenseUtil=require(_0x3bc6('0x1a'));var db=require(_0x3bc6('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x54f7fd,_0x19a246){_0x19a246=_0x19a246||0xcc;return function(_0x50a985){if(_0x50a985){return _0x54f7fd['sendStatus'](_0x19a246);}return _0x54f7fd[_0x3bc6('0x1c')](_0x19a246)[_0x3bc6('0x1d')]();};}function respondWithResult(_0x3dc4e1,_0x504c8e){_0x504c8e=_0x504c8e||0xc8;return function(_0x5572f5){if(_0x5572f5){return _0x3dc4e1[_0x3bc6('0x1c')](_0x504c8e)[_0x3bc6('0x1e')](_0x5572f5);}};}function respondWithFilteredResult(_0x4369b0,_0x15a44e){return function(_0x2b8d42){if(_0x2b8d42){var _0x5d9d21=typeof _0x15a44e[_0x3bc6('0x1f')]===_0x3bc6('0x20')&&typeof _0x15a44e['limit']==='undefined';var _0x183fac=_0x2b8d42[_0x3bc6('0x21')];var _0x4e30fd=_0x5d9d21?0x0:_0x15a44e[_0x3bc6('0x1f')];var _0x125fe1=_0x5d9d21?_0x2b8d42[_0x3bc6('0x21')]:_0x15a44e[_0x3bc6('0x1f')]+_0x15a44e['limit'];var _0x3b966b;if(_0x125fe1>=_0x183fac){_0x125fe1=_0x183fac;_0x3b966b=0xc8;}else{_0x3b966b=0xce;}_0x4369b0[_0x3bc6('0x1c')](_0x3b966b);return _0x4369b0[_0x3bc6('0x22')](_0x3bc6('0x23'),_0x4e30fd+'-'+_0x125fe1+'/'+_0x183fac)[_0x3bc6('0x1e')](_0x2b8d42);}return null;};}function patchUpdates(_0x2ef6c1){return function(_0x37fd01){try{jsonpatch['apply'](_0x37fd01,_0x2ef6c1,!![]);}catch(_0x303e91){return BPromise[_0x3bc6('0x24')](_0x303e91);}return _0x37fd01[_0x3bc6('0x25')]();};}function saveUpdates(_0x4ad6d2,_0x465340){return function(_0x4f281d){if(_0x4f281d){return _0x4f281d[_0x3bc6('0x26')](_0x4ad6d2)[_0x3bc6('0x27')](function(_0x44009e){return _0x44009e;});}return null;};}function removeEntity(_0x166089,_0x9d3c64){return function(_0x5eaa24){if(_0x5eaa24){return _0x5eaa24[_0x3bc6('0x28')]()[_0x3bc6('0x27')](function(){_0x166089[_0x3bc6('0x1c')](0xcc)[_0x3bc6('0x1d')]();});}};}function handleEntityNotFound(_0x1f5fd0,_0x3a61d6){return function(_0x37b254){if(!_0x37b254){_0x1f5fd0[_0x3bc6('0x29')](0x194);}return _0x37b254;};}function handleError(_0x4b1061,_0x28df0a){_0x28df0a=_0x28df0a||0x1f4;return function(_0x245177){logger[_0x3bc6('0x2a')](_0x245177[_0x3bc6('0x2b')]);if(_0x245177[_0x3bc6('0x2c')]){delete _0x245177[_0x3bc6('0x2c')];}_0x4b1061[_0x3bc6('0x1c')](_0x28df0a)['send'](_0x245177);};}exports['index']=function(_0x5b9b40,_0x27876a){var _0x1760c6={},_0x55080b={},_0x382a56={'count':0x0,'rows':[]};var _0x4d08ea=_['map'](db[_0x3bc6('0x2d')][_0x3bc6('0x2e')],function(_0x1583a3){return{'name':_0x1583a3[_0x3bc6('0x2f')],'type':_0x1583a3[_0x3bc6('0x30')][_0x3bc6('0x31')]};});_0x55080b[_0x3bc6('0x32')]=_[_0x3bc6('0x33')](_0x4d08ea,'name');_0x55080b['query']=_['keys'](_0x5b9b40['query']);_0x55080b[_0x3bc6('0x34')]=_[_0x3bc6('0x35')](_0x55080b['model'],_0x55080b[_0x3bc6('0x36')]);_0x1760c6[_0x3bc6('0x37')]=_[_0x3bc6('0x35')](_0x55080b[_0x3bc6('0x32')],qs[_0x3bc6('0x38')](_0x5b9b40[_0x3bc6('0x36')]['fields']));_0x1760c6['attributes']=_0x1760c6[_0x3bc6('0x37')][_0x3bc6('0x39')]?_0x1760c6['attributes']:_0x55080b[_0x3bc6('0x32')];if(!_0x5b9b40[_0x3bc6('0x36')][_0x3bc6('0x3a')](_0x3bc6('0x3b'))){_0x1760c6[_0x3bc6('0x3c')]=qs[_0x3bc6('0x3c')](_0x5b9b40['query'][_0x3bc6('0x3c')]);_0x1760c6[_0x3bc6('0x1f')]=qs['offset'](_0x5b9b40[_0x3bc6('0x36')][_0x3bc6('0x1f')]);}_0x1760c6[_0x3bc6('0x3d')]=qs['sort'](_0x5b9b40['query'][_0x3bc6('0x3e')]);_0x1760c6['where']=qs[_0x3bc6('0x34')](_[_0x3bc6('0x3f')](_0x5b9b40['query'],_0x55080b['filters']),_0x4d08ea);if(_0x5b9b40[_0x3bc6('0x36')][_0x3bc6('0x40')]){_0x1760c6[_0x3bc6('0x41')]=_[_0x3bc6('0x42')](_0x1760c6[_0x3bc6('0x41')],{'$or':_[_0x3bc6('0x33')](_0x4d08ea,function(_0x159b2b){if(_0x159b2b[_0x3bc6('0x30')]!=='VIRTUAL'){var _0x37ae63={};_0x37ae63[_0x159b2b[_0x3bc6('0x2c')]]={'$like':'%'+_0x5b9b40[_0x3bc6('0x36')][_0x3bc6('0x40')]+'%'};return _0x37ae63;}})});}_0x1760c6=_[_0x3bc6('0x42')]({},_0x1760c6,_0x5b9b40['options']);var _0x5c8162={'where':_0x1760c6[_0x3bc6('0x41')]};return db[_0x3bc6('0x2d')]['count'](_0x5c8162)['then'](function(_0x1bb94b){_0x382a56[_0x3bc6('0x21')]=_0x1bb94b;if(_0x5b9b40[_0x3bc6('0x36')][_0x3bc6('0x43')]){_0x1760c6[_0x3bc6('0x44')]=[{'all':!![]}];}return db['VtigerAccount'][_0x3bc6('0x45')](_0x1760c6);})[_0x3bc6('0x27')](function(_0x1b0c31){_0x382a56[_0x3bc6('0x46')]=_0x1b0c31;return _0x382a56;})[_0x3bc6('0x27')](respondWithFilteredResult(_0x27876a,_0x1760c6))[_0x3bc6('0x47')](handleError(_0x27876a,null));};exports['show']=function(_0x4698ec,_0x185fb4){var _0xefd04a={'raw':![],'where':{'id':_0x4698ec['params']['id']}},_0xb39cc0={};_0xb39cc0['model']=_[_0x3bc6('0x48')](db[_0x3bc6('0x2d')]['rawAttributes']);_0xb39cc0['query']=_['keys'](_0x4698ec[_0x3bc6('0x36')]);_0xb39cc0[_0x3bc6('0x34')]=_[_0x3bc6('0x35')](_0xb39cc0[_0x3bc6('0x32')],_0xb39cc0[_0x3bc6('0x36')]);_0xefd04a[_0x3bc6('0x37')]=_['intersection'](_0xb39cc0[_0x3bc6('0x32')],qs[_0x3bc6('0x38')](_0x4698ec[_0x3bc6('0x36')][_0x3bc6('0x38')]));_0xefd04a[_0x3bc6('0x37')]=_0xefd04a[_0x3bc6('0x37')][_0x3bc6('0x39')]?_0xefd04a[_0x3bc6('0x37')]:_0xb39cc0[_0x3bc6('0x32')];if(_0x4698ec[_0x3bc6('0x36')][_0x3bc6('0x43')]){_0xefd04a[_0x3bc6('0x44')]=[{'all':!![]}];}_0xefd04a=_[_0x3bc6('0x42')]({},_0xefd04a,_0x4698ec[_0x3bc6('0x49')]);return db['VtigerAccount'][_0x3bc6('0x4a')](_0xefd04a)['then'](handleEntityNotFound(_0x185fb4,null))['then'](respondWithResult(_0x185fb4,null))[_0x3bc6('0x47')](handleError(_0x185fb4,null));};exports[_0x3bc6('0x4b')]=function(_0x323656,_0x18728a){return db[_0x3bc6('0x2d')][_0x3bc6('0x4b')](_0x323656[_0x3bc6('0x4c')],{})[_0x3bc6('0x27')](respondWithResult(_0x18728a,0xc9))[_0x3bc6('0x47')](handleError(_0x18728a,null));};exports[_0x3bc6('0x26')]=function(_0x5e7019,_0x1a0659){if(_0x5e7019['body']['id']){delete _0x5e7019['body']['id'];}return db[_0x3bc6('0x2d')]['find']({'where':{'id':_0x5e7019[_0x3bc6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1a0659,null))['then'](saveUpdates(_0x5e7019[_0x3bc6('0x4c')],null))[_0x3bc6('0x27')](respondWithResult(_0x1a0659,null))[_0x3bc6('0x47')](handleError(_0x1a0659,null));};exports['destroy']=function(_0x32099a,_0x496b2b){return db[_0x3bc6('0x2d')][_0x3bc6('0x4a')]({'where':{'id':_0x32099a['params']['id']}})['then'](handleEntityNotFound(_0x496b2b,null))[_0x3bc6('0x27')](removeEntity(_0x496b2b,null))[_0x3bc6('0x47')](handleError(_0x496b2b,null));};exports['getConfigurations']=function(_0x943a08,_0x32e766,_0x1d3d6b){var _0x482579={};var _0x386e7b={};var _0x2d0f8f;var _0x274a40;return db[_0x3bc6('0x2d')][_0x3bc6('0x4e')]({'where':{'id':_0x943a08['params']['id']}})[_0x3bc6('0x27')](handleEntityNotFound(_0x32e766,null))[_0x3bc6('0x27')](function(_0x263c7b){if(_0x263c7b){_0x2d0f8f=_0x263c7b;_0x386e7b['model']=_['keys'](db[_0x3bc6('0x4f')][_0x3bc6('0x2e')]);_0x386e7b[_0x3bc6('0x36')]=_[_0x3bc6('0x48')](_0x943a08[_0x3bc6('0x36')]);_0x386e7b[_0x3bc6('0x34')]=_[_0x3bc6('0x35')](_0x386e7b[_0x3bc6('0x32')],_0x386e7b[_0x3bc6('0x36')]);_0x482579[_0x3bc6('0x37')]=_[_0x3bc6('0x35')](_0x386e7b[_0x3bc6('0x32')],qs[_0x3bc6('0x38')](_0x943a08[_0x3bc6('0x36')][_0x3bc6('0x38')]));_0x482579[_0x3bc6('0x37')]=_0x482579[_0x3bc6('0x37')][_0x3bc6('0x39')]?_0x482579[_0x3bc6('0x37')]:_0x386e7b[_0x3bc6('0x32')];_0x482579[_0x3bc6('0x3d')]=qs[_0x3bc6('0x3e')](_0x943a08[_0x3bc6('0x36')][_0x3bc6('0x3e')]);_0x482579[_0x3bc6('0x41')]=qs[_0x3bc6('0x34')](_[_0x3bc6('0x3f')](_0x943a08[_0x3bc6('0x36')],_0x386e7b[_0x3bc6('0x34')]));if(_0x943a08[_0x3bc6('0x36')]['filter']){_0x482579['where']=_[_0x3bc6('0x42')](_0x482579[_0x3bc6('0x41')],{'$or':_[_0x3bc6('0x33')](_0x482579[_0x3bc6('0x37')],function(_0x10a164){var _0xb593d={};_0xb593d[_0x10a164]={'$like':'%'+_0x943a08[_0x3bc6('0x36')][_0x3bc6('0x40')]+'%'};return _0xb593d;})});}_0x482579=_[_0x3bc6('0x42')]({},_0x482579,_0x943a08[_0x3bc6('0x49')]);return _0x2d0f8f['getConfigurations'](_0x482579);}})[_0x3bc6('0x27')](function(_0x31832f){if(_0x31832f){_0x274a40=_0x31832f['length'];if(!_0x943a08[_0x3bc6('0x36')][_0x3bc6('0x3a')](_0x3bc6('0x3b'))){_0x482579['limit']=qs[_0x3bc6('0x3c')](_0x943a08[_0x3bc6('0x36')][_0x3bc6('0x3c')]);_0x482579[_0x3bc6('0x1f')]=qs[_0x3bc6('0x1f')](_0x943a08['query'][_0x3bc6('0x1f')]);}return _0x2d0f8f[_0x3bc6('0x50')](_0x482579);}})[_0x3bc6('0x27')](function(_0x3f66a3){if(_0x3f66a3){return _0x3f66a3?{'count':_0x274a40,'rows':_0x3f66a3}:null;}})[_0x3bc6('0x27')](respondWithResult(_0x32e766,null))[_0x3bc6('0x47')](handleError(_0x32e766,null));};exports['addConfiguration']=function(_0xf1b5f2,_0x2271ac,_0x30b7ef){if(_0xf1b5f2[_0x3bc6('0x4c')]['id']){delete _0xf1b5f2[_0x3bc6('0x4c')]['id'];}return db[_0x3bc6('0x2d')][_0x3bc6('0x4e')]({'where':{'id':_0xf1b5f2['params']['id']}})[_0x3bc6('0x27')](handleEntityNotFound(_0x2271ac,null))[_0x3bc6('0x27')](function(_0x45fb3b){if(_0x45fb3b){_0xf1b5f2['body']['AccountId']=_0x45fb3b['id'];_0xf1b5f2[_0x3bc6('0x4c')][_0x3bc6('0x51')]=integrations['getSubjects'](_0xf1b5f2['body'][_0x3bc6('0x52')],_0xf1b5f2[_0x3bc6('0x4c')]['type']);_0xf1b5f2['body'][_0x3bc6('0x53')]=integrations[_0x3bc6('0x54')](_0xf1b5f2[_0x3bc6('0x4c')][_0x3bc6('0x52')],_0xf1b5f2['body'][_0x3bc6('0x30')]);return db[_0x3bc6('0x4f')][_0x3bc6('0x4b')](_0xf1b5f2[_0x3bc6('0x4c')],{'include':[{'model':db[_0x3bc6('0x55')],'as':'Subjects'},{'model':db[_0x3bc6('0x55')],'as':_0x3bc6('0x53')}]});}return null;})['then'](respondWithResult(_0x2271ac,null))[_0x3bc6('0x47')](handleError(_0x2271ac,null));};var md5=require('md5');exports[_0x3bc6('0x56')]=function(_0x33b7fa,_0x2c7b5b,_0x4fa89c){var _0x4b4a17=null;var _0x5b6d73=null;var _0x2d8421=null;var _0x218a5b=null;var _0x293c5c='';return db[_0x3bc6('0x2d')][_0x3bc6('0x4e')]({'where':{'id':_0x33b7fa[_0x3bc6('0x4d')]['id']},'attributes':['id',_0x3bc6('0x2c'),'username',_0x3bc6('0x57'),_0x3bc6('0x58'),_0x3bc6('0x59'),_0x3bc6('0x5a'),_0x3bc6('0x5b')]})['then'](handleEntityNotFound(_0x2c7b5b,null))[_0x3bc6('0x27')](function(_0x484e62){if(_0x484e62){_0x4b4a17=_0x484e62[_0x3bc6('0x5c')];_0x5b6d73=_0x484e62[_0x3bc6('0x5b')];_0x2d8421=_0x484e62[_0x3bc6('0x58')];_0x293c5c=_0x484e62[_0x3bc6('0x59')];var _0x1a197b=_0x293c5c['slice'](-0x1);if(_0x1a197b==='/'){_0x293c5c=_0x293c5c[_0x3bc6('0x5d')](0x0,_0x293c5c[_0x3bc6('0x5e')](_0x1a197b));}_0x218a5b=util[_0x3bc6('0x5f')](_0x3bc6('0x60'),_0x293c5c);var _0x47eb4e={'method':_0x3bc6('0x61'),'uri':_0x218a5b,'qs':{'operation':_0x3bc6('0x62'),'username':_0x484e62[_0x3bc6('0x5c')]},'json':!![]};return rp(_0x47eb4e);}})[_0x3bc6('0x27')](function(_0x4f73ab){if(_0x4f73ab[_0x3bc6('0x63')]){var _0x3a8348={'method':'POST','uri':_0x218a5b,'form':{'operation':'login','username':_0x4b4a17,'accessKey':md5(_0x4f73ab[_0x3bc6('0x64')][_0x3bc6('0x65')]+_0x5b6d73)},'json':!![]};return rp(_0x3a8348);}})[_0x3bc6('0x27')](function(_0xe51c9f){if(_0xe51c9f['success']){var _0x7abd9e={'method':'GET','uri':_0x218a5b,'qs':{'operation':'describe','username':_0x4b4a17,'sessionName':_0xe51c9f['result']['sessionName'],'elementType':_0x2d8421},'json':!![]};return rp(_0x7abd9e);}})[_0x3bc6('0x27')](function(_0x122906){if(_0x122906[_0x3bc6('0x63')]){var _0x31e6dd=[_0x3bc6('0x66'),_0x3bc6('0x67'),_0x3bc6('0x68')];_['remove'](_0x122906['result'][_0x3bc6('0x38')],function(_0x14e13c){return _0x31e6dd['includes'](_0x14e13c[_0x3bc6('0x30')][_0x3bc6('0x2c')]);});_['remove'](_0x122906[_0x3bc6('0x64')][_0x3bc6('0x38')],function(_0x92e2a){return _0x92e2a[_0x3bc6('0x69')]===_0x3bc6('0x6a');});return{'count':_0x122906[_0x3bc6('0x64')]['fields'][_0x3bc6('0x39')],'rows':_[_0x3bc6('0x33')](_0x122906[_0x3bc6('0x64')][_0x3bc6('0x38')],function(_0x31ad93){return{'id':_0x31ad93[_0x3bc6('0x2c')],'name':_0x31ad93[_0x3bc6('0x6b')],'custom':_[_0x3bc6('0x6c')](_0x31ad93['name'],_0x3bc6('0x6d'))?!![]:![],'options':_0x31ad93[_0x3bc6('0x30')][_0x3bc6('0x2c')]===_0x3bc6('0x6e')&&_0x31ad93[_0x3bc6('0x30')][_0x3bc6('0x6f')][_0x3bc6('0x39')]>0x0?_[_0x3bc6('0x33')](_0x31ad93[_0x3bc6('0x30')][_0x3bc6('0x6f')],function(_0x16b244){return{'name':_0x16b244[_0x3bc6('0x6b')],'value':_0x16b244[_0x3bc6('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x2c7b5b,null))[_0x3bc6('0x47')](function(_0x40a90d){console[_0x3bc6('0x71')](_0x3bc6('0x72')+_0x40a90d);var _0x553547=_0x33b7fa[_0x3bc6('0x36')]['test']?0x1f4:_0x40a90d[_0x3bc6('0x73')]||0x1f4;logger[_0x3bc6('0x2a')](_0x3bc6('0x74'),'getFields',_0x553547,JSON[_0x3bc6('0x75')](_0x40a90d));delete _0x40a90d['name'];if(_0x553547===0x191){_0x553547=0x190;}_0x2c7b5b[_0x3bc6('0x1c')](_0x553547)[_0x3bc6('0x76')](_0x33b7fa[_0x3bc6('0x36')][_0x3bc6('0x77')]?{'message':_0x3bc6('0x78'),'statusCode':_0x40a90d['statusCode']}:_0x40a90d);});}; \ No newline at end of file +var _0x836f=['findAll','rows','catch','show','params','options','find','create','body','update','getConfigurations','VtigerConfiguration','map','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','substring','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','result','autogenerated','reference','owner','remove','includes','editable','false','cf_','picklistValues','label','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll'];(function(_0x2b47a0,_0x21c4aa){var _0x54e5f5=function(_0x4fc1f9){while(--_0x4fc1f9){_0x2b47a0['push'](_0x2b47a0['shift']());}};_0x54e5f5(++_0x21c4aa);}(_0x836f,0x12f));var _0xf836=function(_0x37f9c5,_0x277779){_0x37f9c5=_0x37f9c5-0x0;var _0x3e423b=_0x836f[_0x37f9c5];return _0x3e423b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf836('0x0'));var zipdir=require(_0xf836('0x1'));var jsonpatch=require(_0xf836('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf836('0x3'));var Mustache=require(_0xf836('0x4'));var util=require('util');var path=require(_0xf836('0x5'));var sox=require(_0xf836('0x6'));var csv=require(_0xf836('0x7'));var ejs=require(_0xf836('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf836('0x9'));var squel=require(_0xf836('0xa'));var crypto=require('crypto');var jsforce=require(_0xf836('0xb'));var deskjs=require(_0xf836('0xc'));var toCsv=require(_0xf836('0x7'));var querystring=require('querystring');var Papa=require(_0xf836('0xd'));var Redis=require(_0xf836('0xe'));var authService=require(_0xf836('0xf'));var qs=require(_0xf836('0x10'));var as=require(_0xf836('0x11'));var hardwareService=require(_0xf836('0x12'));var logger=require(_0xf836('0x13'))('api');var utils=require(_0xf836('0x14'));var config=require(_0xf836('0x15'));var licenseUtil=require(_0xf836('0x16'));var db=require(_0xf836('0x17'))['db'];var integrations=require(_0xf836('0x18'));function respondWithStatusCode(_0x498737,_0x1b7301){_0x1b7301=_0x1b7301||0xcc;return function(_0x1a7a5f){if(_0x1a7a5f){return _0x498737[_0xf836('0x19')](_0x1b7301);}return _0x498737[_0xf836('0x1a')](_0x1b7301)[_0xf836('0x1b')]();};}function respondWithResult(_0xe5ecce,_0x5c0b01){_0x5c0b01=_0x5c0b01||0xc8;return function(_0x5623df){if(_0x5623df){return _0xe5ecce[_0xf836('0x1a')](_0x5c0b01)[_0xf836('0x1c')](_0x5623df);}};}function respondWithFilteredResult(_0x17981a,_0x17db4a){return function(_0x1ad14d){if(_0x1ad14d){var _0x36164c=typeof _0x17db4a[_0xf836('0x1d')]===_0xf836('0x1e')&&typeof _0x17db4a[_0xf836('0x1f')]===_0xf836('0x1e');var _0x556760=_0x1ad14d[_0xf836('0x20')];var _0x21454f=_0x36164c?0x0:_0x17db4a['offset'];var _0x19446c=_0x36164c?_0x1ad14d[_0xf836('0x20')]:_0x17db4a[_0xf836('0x1d')]+_0x17db4a['limit'];var _0x1c11d8;if(_0x19446c>=_0x556760){_0x19446c=_0x556760;_0x1c11d8=0xc8;}else{_0x1c11d8=0xce;}_0x17981a[_0xf836('0x1a')](_0x1c11d8);return _0x17981a['set'](_0xf836('0x21'),_0x21454f+'-'+_0x19446c+'/'+_0x556760)[_0xf836('0x1c')](_0x1ad14d);}return null;};}function patchUpdates(_0x2cbe67){return function(_0x1ae75b){try{jsonpatch[_0xf836('0x22')](_0x1ae75b,_0x2cbe67,!![]);}catch(_0x1b0772){return BPromise[_0xf836('0x23')](_0x1b0772);}return _0x1ae75b[_0xf836('0x24')]();};}function saveUpdates(_0x280584,_0x2907e0){return function(_0x25fd9c){if(_0x25fd9c){return _0x25fd9c['update'](_0x280584)[_0xf836('0x25')](function(_0x4f73d8){return _0x4f73d8;});}return null;};}function removeEntity(_0x2d9137,_0x5a361f){return function(_0x2ba695){if(_0x2ba695){return _0x2ba695[_0xf836('0x26')]()[_0xf836('0x25')](function(){_0x2d9137[_0xf836('0x1a')](0xcc)[_0xf836('0x1b')]();});}};}function handleEntityNotFound(_0x5445a5,_0x568f27){return function(_0x191056){if(!_0x191056){_0x5445a5[_0xf836('0x19')](0x194);}return _0x191056;};}function handleError(_0x372286,_0x57ba4d){_0x57ba4d=_0x57ba4d||0x1f4;return function(_0x5290fe){logger[_0xf836('0x27')](_0x5290fe[_0xf836('0x28')]);if(_0x5290fe[_0xf836('0x29')]){delete _0x5290fe[_0xf836('0x29')];}_0x372286[_0xf836('0x1a')](_0x57ba4d)[_0xf836('0x2a')](_0x5290fe);};}exports[_0xf836('0x2b')]=function(_0x458cd5,_0x3744ea){var _0x3a6627={},_0x213619={},_0xcdde3d={'count':0x0,'rows':[]};var _0x10c32f=_['map'](db[_0xf836('0x2c')][_0xf836('0x2d')],function(_0x5aa451){return{'name':_0x5aa451[_0xf836('0x2e')],'type':_0x5aa451[_0xf836('0x2f')][_0xf836('0x30')]};});_0x213619['model']=_['map'](_0x10c32f,_0xf836('0x29'));_0x213619[_0xf836('0x31')]=_[_0xf836('0x32')](_0x458cd5[_0xf836('0x31')]);_0x213619[_0xf836('0x33')]=_[_0xf836('0x34')](_0x213619[_0xf836('0x35')],_0x213619['query']);_0x3a6627[_0xf836('0x36')]=_['intersection'](_0x213619[_0xf836('0x35')],qs[_0xf836('0x37')](_0x458cd5[_0xf836('0x31')][_0xf836('0x37')]));_0x3a6627['attributes']=_0x3a6627['attributes'][_0xf836('0x38')]?_0x3a6627['attributes']:_0x213619[_0xf836('0x35')];if(!_0x458cd5[_0xf836('0x31')][_0xf836('0x39')](_0xf836('0x3a'))){_0x3a6627[_0xf836('0x1f')]=qs[_0xf836('0x1f')](_0x458cd5[_0xf836('0x31')][_0xf836('0x1f')]);_0x3a6627[_0xf836('0x1d')]=qs[_0xf836('0x1d')](_0x458cd5[_0xf836('0x31')][_0xf836('0x1d')]);}_0x3a6627[_0xf836('0x3b')]=qs[_0xf836('0x3c')](_0x458cd5[_0xf836('0x31')][_0xf836('0x3c')]);_0x3a6627['where']=qs[_0xf836('0x33')](_[_0xf836('0x3d')](_0x458cd5[_0xf836('0x31')],_0x213619['filters']),_0x10c32f);if(_0x458cd5[_0xf836('0x31')][_0xf836('0x3e')]){_0x3a6627[_0xf836('0x3f')]=_[_0xf836('0x40')](_0x3a6627['where'],{'$or':_['map'](_0x10c32f,function(_0x3cd5a3){if(_0x3cd5a3[_0xf836('0x2f')]!=='VIRTUAL'){var _0x132fdc={};_0x132fdc[_0x3cd5a3[_0xf836('0x29')]]={'$like':'%'+_0x458cd5['query'][_0xf836('0x3e')]+'%'};return _0x132fdc;}})});}_0x3a6627=_[_0xf836('0x40')]({},_0x3a6627,_0x458cd5['options']);var _0x519ba9={'where':_0x3a6627[_0xf836('0x3f')]};return db[_0xf836('0x2c')][_0xf836('0x20')](_0x519ba9)[_0xf836('0x25')](function(_0x32b31f){_0xcdde3d['count']=_0x32b31f;if(_0x458cd5[_0xf836('0x31')][_0xf836('0x41')]){_0x3a6627['include']=[{'all':!![]}];}return db[_0xf836('0x2c')][_0xf836('0x42')](_0x3a6627);})[_0xf836('0x25')](function(_0x587a30){_0xcdde3d[_0xf836('0x43')]=_0x587a30;return _0xcdde3d;})[_0xf836('0x25')](respondWithFilteredResult(_0x3744ea,_0x3a6627))[_0xf836('0x44')](handleError(_0x3744ea,null));};exports[_0xf836('0x45')]=function(_0x1476c1,_0x1ce159){var _0xc03a61={'raw':![],'where':{'id':_0x1476c1[_0xf836('0x46')]['id']}},_0x2c27a6={};_0x2c27a6['model']=_[_0xf836('0x32')](db[_0xf836('0x2c')][_0xf836('0x2d')]);_0x2c27a6[_0xf836('0x31')]=_[_0xf836('0x32')](_0x1476c1[_0xf836('0x31')]);_0x2c27a6[_0xf836('0x33')]=_[_0xf836('0x34')](_0x2c27a6[_0xf836('0x35')],_0x2c27a6[_0xf836('0x31')]);_0xc03a61['attributes']=_['intersection'](_0x2c27a6[_0xf836('0x35')],qs['fields'](_0x1476c1['query'][_0xf836('0x37')]));_0xc03a61[_0xf836('0x36')]=_0xc03a61[_0xf836('0x36')][_0xf836('0x38')]?_0xc03a61[_0xf836('0x36')]:_0x2c27a6[_0xf836('0x35')];if(_0x1476c1[_0xf836('0x31')][_0xf836('0x41')]){_0xc03a61['include']=[{'all':!![]}];}_0xc03a61=_[_0xf836('0x40')]({},_0xc03a61,_0x1476c1[_0xf836('0x47')]);return db[_0xf836('0x2c')][_0xf836('0x48')](_0xc03a61)[_0xf836('0x25')](handleEntityNotFound(_0x1ce159,null))[_0xf836('0x25')](respondWithResult(_0x1ce159,null))['catch'](handleError(_0x1ce159,null));};exports[_0xf836('0x49')]=function(_0x366ef3,_0x107520){return db['VtigerAccount']['create'](_0x366ef3[_0xf836('0x4a')],{})[_0xf836('0x25')](respondWithResult(_0x107520,0xc9))[_0xf836('0x44')](handleError(_0x107520,null));};exports[_0xf836('0x4b')]=function(_0x274fc1,_0x29bb61){if(_0x274fc1[_0xf836('0x4a')]['id']){delete _0x274fc1[_0xf836('0x4a')]['id'];}return db['VtigerAccount'][_0xf836('0x48')]({'where':{'id':_0x274fc1[_0xf836('0x46')]['id']}})['then'](handleEntityNotFound(_0x29bb61,null))[_0xf836('0x25')](saveUpdates(_0x274fc1[_0xf836('0x4a')],null))[_0xf836('0x25')](respondWithResult(_0x29bb61,null))[_0xf836('0x44')](handleError(_0x29bb61,null));};exports[_0xf836('0x26')]=function(_0x4c1235,_0x3ca7dc){return db[_0xf836('0x2c')]['find']({'where':{'id':_0x4c1235[_0xf836('0x46')]['id']}})[_0xf836('0x25')](handleEntityNotFound(_0x3ca7dc,null))[_0xf836('0x25')](removeEntity(_0x3ca7dc,null))[_0xf836('0x44')](handleError(_0x3ca7dc,null));};exports[_0xf836('0x4c')]=function(_0x5d557d,_0x17a68b,_0x5a32a0){var _0x5c9a47={};var _0x2159e9={};var _0x4d5add;var _0x3ad78e;return db['VtigerAccount']['findOne']({'where':{'id':_0x5d557d[_0xf836('0x46')]['id']}})[_0xf836('0x25')](handleEntityNotFound(_0x17a68b,null))[_0xf836('0x25')](function(_0x5459e6){if(_0x5459e6){_0x4d5add=_0x5459e6;_0x2159e9[_0xf836('0x35')]=_[_0xf836('0x32')](db[_0xf836('0x4d')][_0xf836('0x2d')]);_0x2159e9['query']=_[_0xf836('0x32')](_0x5d557d['query']);_0x2159e9[_0xf836('0x33')]=_[_0xf836('0x34')](_0x2159e9['model'],_0x2159e9['query']);_0x5c9a47[_0xf836('0x36')]=_[_0xf836('0x34')](_0x2159e9['model'],qs[_0xf836('0x37')](_0x5d557d[_0xf836('0x31')][_0xf836('0x37')]));_0x5c9a47[_0xf836('0x36')]=_0x5c9a47[_0xf836('0x36')][_0xf836('0x38')]?_0x5c9a47[_0xf836('0x36')]:_0x2159e9[_0xf836('0x35')];_0x5c9a47['order']=qs[_0xf836('0x3c')](_0x5d557d[_0xf836('0x31')]['sort']);_0x5c9a47['where']=qs['filters'](_['pick'](_0x5d557d[_0xf836('0x31')],_0x2159e9['filters']));if(_0x5d557d['query']['filter']){_0x5c9a47[_0xf836('0x3f')]=_[_0xf836('0x40')](_0x5c9a47[_0xf836('0x3f')],{'$or':_[_0xf836('0x4e')](_0x5c9a47['attributes'],function(_0x3a0e8a){var _0x171e39={};_0x171e39[_0x3a0e8a]={'$like':'%'+_0x5d557d[_0xf836('0x31')]['filter']+'%'};return _0x171e39;})});}_0x5c9a47=_[_0xf836('0x40')]({},_0x5c9a47,_0x5d557d[_0xf836('0x47')]);return _0x4d5add['getConfigurations'](_0x5c9a47);}})['then'](function(_0x48df96){if(_0x48df96){_0x3ad78e=_0x48df96[_0xf836('0x38')];if(!_0x5d557d[_0xf836('0x31')][_0xf836('0x39')]('nolimit')){_0x5c9a47[_0xf836('0x1f')]=qs[_0xf836('0x1f')](_0x5d557d[_0xf836('0x31')][_0xf836('0x1f')]);_0x5c9a47[_0xf836('0x1d')]=qs[_0xf836('0x1d')](_0x5d557d[_0xf836('0x31')]['offset']);}return _0x4d5add[_0xf836('0x4c')](_0x5c9a47);}})['then'](function(_0x44c496){if(_0x44c496){return _0x44c496?{'count':_0x3ad78e,'rows':_0x44c496}:null;}})[_0xf836('0x25')](respondWithResult(_0x17a68b,null))[_0xf836('0x44')](handleError(_0x17a68b,null));};exports[_0xf836('0x4f')]=function(_0x2b71b0,_0x10c9fd,_0x5ab0cf){if(_0x2b71b0['body']['id']){delete _0x2b71b0['body']['id'];}return db['VtigerAccount'][_0xf836('0x50')]({'where':{'id':_0x2b71b0[_0xf836('0x46')]['id']}})[_0xf836('0x25')](handleEntityNotFound(_0x10c9fd,null))[_0xf836('0x25')](function(_0x45df80){if(_0x45df80){_0x2b71b0[_0xf836('0x4a')][_0xf836('0x51')]=_0x45df80['id'];_0x2b71b0[_0xf836('0x4a')][_0xf836('0x52')]=integrations[_0xf836('0x53')](_0x2b71b0[_0xf836('0x4a')][_0xf836('0x54')],_0x2b71b0[_0xf836('0x4a')][_0xf836('0x2f')]);_0x2b71b0['body'][_0xf836('0x55')]=integrations[_0xf836('0x56')](_0x2b71b0[_0xf836('0x4a')][_0xf836('0x54')],_0x2b71b0[_0xf836('0x4a')][_0xf836('0x2f')]);return db['VtigerConfiguration'][_0xf836('0x49')](_0x2b71b0[_0xf836('0x4a')],{'include':[{'model':db[_0xf836('0x57')],'as':_0xf836('0x52')},{'model':db[_0xf836('0x57')],'as':_0xf836('0x55')}]});}return null;})[_0xf836('0x25')](respondWithResult(_0x10c9fd,null))[_0xf836('0x44')](handleError(_0x10c9fd,null));};var md5=require(_0xf836('0x58'));exports[_0xf836('0x59')]=function(_0xe5e52d,_0x476151,_0x4b0741){var _0x3a1d69=null;var _0x2374d3=null;var _0x20af84=null;var _0x367930=null;var _0x4017d4='';return db['VtigerAccount'][_0xf836('0x50')]({'where':{'id':_0xe5e52d[_0xf836('0x46')]['id']},'attributes':['id',_0xf836('0x29'),_0xf836('0x5a'),'description',_0xf836('0x5b'),_0xf836('0x5c'),_0xf836('0x5d'),_0xf836('0x5e')]})[_0xf836('0x25')](handleEntityNotFound(_0x476151,null))[_0xf836('0x25')](function(_0x46bb2e){if(_0x46bb2e){_0x3a1d69=_0x46bb2e[_0xf836('0x5a')];_0x2374d3=_0x46bb2e['accessKey'];_0x20af84=_0x46bb2e[_0xf836('0x5b')];_0x4017d4=_0x46bb2e['remoteUri'];var _0x488e9f=_0x4017d4['slice'](-0x1);if(_0x488e9f==='/'){_0x4017d4=_0x4017d4[_0xf836('0x5f')](0x0,_0x4017d4['lastIndexOf'](_0x488e9f));}_0x367930=util[_0xf836('0x60')](_0xf836('0x61'),_0x4017d4);var _0x1f83f9={'method':_0xf836('0x62'),'uri':_0x367930,'qs':{'operation':_0xf836('0x63'),'username':_0x46bb2e[_0xf836('0x5a')]},'json':!![]};return rp(_0x1f83f9);}})[_0xf836('0x25')](function(_0x4708f5){if(_0x4708f5[_0xf836('0x64')]){var _0x532a4d={'method':_0xf836('0x65'),'uri':_0x367930,'form':{'operation':_0xf836('0x66'),'username':_0x3a1d69,'accessKey':md5(_0x4708f5['result'][_0xf836('0x67')]+_0x2374d3)},'json':!![]};return rp(_0x532a4d);}})[_0xf836('0x25')](function(_0x2c963a){if(_0x2c963a[_0xf836('0x64')]){var _0x299773={'method':'GET','uri':_0x367930,'qs':{'operation':_0xf836('0x68'),'username':_0x3a1d69,'sessionName':_0x2c963a[_0xf836('0x69')]['sessionName'],'elementType':_0x20af84},'json':!![]};return rp(_0x299773);}})[_0xf836('0x25')](function(_0x243e0d){if(_0x243e0d[_0xf836('0x64')]){var _0x4f861a=[_0xf836('0x6a'),_0xf836('0x6b'),_0xf836('0x6c')];_[_0xf836('0x6d')](_0x243e0d[_0xf836('0x69')][_0xf836('0x37')],function(_0x348e21){return _0x4f861a[_0xf836('0x6e')](_0x348e21[_0xf836('0x2f')][_0xf836('0x29')]);});_[_0xf836('0x6d')](_0x243e0d[_0xf836('0x69')]['fields'],function(_0x2b559c){return _0x2b559c[_0xf836('0x6f')]===_0xf836('0x70');});return{'count':_0x243e0d[_0xf836('0x69')][_0xf836('0x37')][_0xf836('0x38')],'rows':_['map'](_0x243e0d['result'][_0xf836('0x37')],function(_0x4a4753){return{'id':_0x4a4753[_0xf836('0x29')],'name':_0x4a4753['label'],'custom':_['startsWith'](_0x4a4753[_0xf836('0x29')],_0xf836('0x71'))?!![]:![],'options':_0x4a4753[_0xf836('0x2f')]['name']==='picklist'&&_0x4a4753[_0xf836('0x2f')][_0xf836('0x72')][_0xf836('0x38')]>0x0?_[_0xf836('0x4e')](_0x4a4753['type']['picklistValues'],function(_0x1f4f9c){return{'name':_0x1f4f9c[_0xf836('0x73')],'value':_0x1f4f9c[_0xf836('0x74')]};}):[]};})};}})[_0xf836('0x25')](respondWithResult(_0x476151,null))[_0xf836('0x44')](function(_0x64f55){console[_0xf836('0x75')]('vTiger\x20error:\x20'+_0x64f55);var _0x2f12ce=_0xe5e52d['query'][_0xf836('0x76')]?0x1f4:_0x64f55[_0xf836('0x77')]||0x1f4;logger[_0xf836('0x27')](_0xf836('0x78'),'getFields',_0x2f12ce,JSON[_0xf836('0x79')](_0x64f55));delete _0x64f55['name'];if(_0x2f12ce===0x191){_0x2f12ce=0x190;}_0x476151[_0xf836('0x1a')](_0x2f12ce)[_0xf836('0x2a')](_0xe5e52d[_0xf836('0x31')][_0xf836('0x76')]?{'message':_0xf836('0x7a'),'statusCode':_0x64f55[_0xf836('0x77')]}:_0x64f55);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f22ecaf..1095c57 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 _0x8d7f=['api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x3e2b81,_0x4d764b){var _0x44c9fb=function(_0x74745a){while(--_0x74745a){_0x3e2b81['push'](_0x3e2b81['shift']());}};_0x44c9fb(++_0x4d764b);}(_0x8d7f,0x1cb));var _0xf8d7=function(_0x4874a4,_0x6ef115){_0x4874a4=_0x4874a4-0x0;var _0x839e4f=_0x8d7f[_0x4874a4];return _0x839e4f;};'use strict';var _=require(_0xf8d7('0x0'));var util=require(_0xf8d7('0x1'));var logger=require(_0xf8d7('0x2'))(_0xf8d7('0x3'));var moment=require('moment');var BPromise=require(_0xf8d7('0x4'));var rp=require(_0xf8d7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8d7('0x6'));var config=require(_0xf8d7('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xf8d7('0x8'));module['exports']=function(_0x3c33dc,_0x445317){return _0x3c33dc[_0xf8d7('0x9')]('VtigerAccount',attributes,{'tableName':_0xf8d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf76a=['VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x2536ea,_0x4aa898){var _0x6248be=function(_0x3f4a1c){while(--_0x3f4a1c){_0x2536ea['push'](_0x2536ea['shift']());}};_0x6248be(++_0x4aa898);}(_0xf76a,0xd4));var _0xaf76=function(_0x228b77,_0x47215f){_0x228b77=_0x228b77-0x0;var _0x527bbd=_0xf76a[_0x228b77];return _0x527bbd;};'use strict';var _=require(_0xaf76('0x0'));var util=require(_0xaf76('0x1'));var logger=require(_0xaf76('0x2'))(_0xaf76('0x3'));var moment=require(_0xaf76('0x4'));var BPromise=require(_0xaf76('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf76('0x6'));var rimraf=require(_0xaf76('0x7'));var config=require(_0xaf76('0x8'));var attributes=require(_0xaf76('0x9'));var integrations=require(_0xaf76('0xa'));module[_0xaf76('0xb')]=function(_0x3ad8bc,_0x50d8a6){return _0x3ad8bc[_0xaf76('0xc')](_0xaf76('0xd'),attributes,{'tableName':_0xaf76('0xe'),'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 0ee0e71..8e45062 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 _0xb10b=['../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowVtigerAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4da2da,_0x390f9a){var _0x57b72a=function(_0x168083){while(--_0x168083){_0x4da2da['push'](_0x4da2da['shift']());}};_0x57b72a(++_0x390f9a);}(_0xb10b,0x12a));var _0xbb10=function(_0x20e375,_0xdc0dde){_0x20e375=_0x20e375-0x0;var _0x55ac5d=_0xb10b[_0x20e375];return _0x55ac5d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetVtigerAccount',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowVtigerAccount']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowVtigerAccount',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x6e6c=['where','limit','include','map','attributes','model','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VtigerAccount','findAll','options','raw'];(function(_0x74071,_0x3c574a){var _0x29a146=function(_0x4b70a0){while(--_0x4b70a0){_0x74071['push'](_0x74071['shift']());}};_0x29a146(++_0x3c574a);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var rs=require(_0xc6e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6e6('0x4'));var logger=require('../../config/logger')(_0xc6e6('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6e6('0x6'));var client=jayson[_0xc6e6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301f55,_0x30a10b,_0x4da7bd){return new BPromise(function(_0x324706,_0x15d268){return client['request'](_0x301f55,_0x4da7bd)[_0xc6e6('0x8')](function(_0x481799){logger[_0xc6e6('0x9')](_0xc6e6('0xa'),_0x30a10b,_0xc6e6('0xb'));logger[_0xc6e6('0xc')](_0xc6e6('0xd'),_0x30a10b,_0xc6e6('0xb'),JSON[_0xc6e6('0xe')](_0x481799));if(_0x481799[_0xc6e6('0xf')]){if(_0x481799[_0xc6e6('0xf')]['code']===0x1f4){logger[_0xc6e6('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x30a10b,_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);return _0x15d268(_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);}logger['error'](_0xc6e6('0xa'),_0x30a10b,_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);return _0x324706(_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);}else{logger['info'](_0xc6e6('0xa'),_0x30a10b,_0xc6e6('0xb'));_0x324706(_0x481799['result'][_0xc6e6('0x10')]);}})[_0xc6e6('0x11')](function(_0xedf127){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x30a10b,_0xedf127);_0x15d268(_0xedf127);});});}exports['GetVtigerAccount']=function(_0x3a1ccc){var _0x554262=this;return new Promise(function(_0x46e58f,_0x2069e4){return db[_0xc6e6('0x12')][_0xc6e6('0x13')]({'raw':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x15')]===undefined?!![]:![]:!![],'where':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x16')]||null:null,'attributes':_0x3a1ccc['options']?_0x3a1ccc[_0xc6e6('0x14')]['attributes']||null:null,'limit':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x17')]||null:null,'include':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc['options'][_0xc6e6('0x18')]?_[_0xc6e6('0x19')](_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x18')],function(_0x107561){return{'model':db[_0x107561['model']],'as':_0x107561['as'],'attributes':_0x107561[_0xc6e6('0x1a')],'include':_0x107561['include']?_[_0xc6e6('0x19')](_0x107561[_0xc6e6('0x18')],function(_0x2e5e0e){return{'model':db[_0x2e5e0e[_0xc6e6('0x1b')]],'as':_0x2e5e0e['as'],'attributes':_0x2e5e0e['attributes'],'include':_0x2e5e0e[_0xc6e6('0x18')]?_['map'](_0x2e5e0e[_0xc6e6('0x18')],function(_0x534745){return{'model':db[_0x534745[_0xc6e6('0x1b')]],'as':_0x534745['as'],'attributes':_0x534745[_0xc6e6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc6e6('0x8')](function(_0x41e7c2){logger[_0xc6e6('0x9')]('GetVtigerAccount',_0x3a1ccc);logger[_0xc6e6('0xc')](_0xc6e6('0x1c'),_0x3a1ccc,JSON[_0xc6e6('0xe')](_0x41e7c2));_0x46e58f(_0x41e7c2);})[_0xc6e6('0x11')](function(_0x4d1284){logger[_0xc6e6('0xf')]('GetVtigerAccount',_0x4d1284[_0xc6e6('0x10')],_0x3a1ccc);_0x2069e4(_0x554262[_0xc6e6('0xf')](0x1f4,_0x4d1284[_0xc6e6('0x10')]));});});};exports[_0xc6e6('0x1d')]=function(_0xd3b63){var _0x402598=this;return new Promise(function(_0x43ff9c,_0x337442){return db[_0xc6e6('0x12')][_0xc6e6('0x1e')]({'raw':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63[_0xc6e6('0x14')][_0xc6e6('0x15')]===undefined?!![]:![]:!![],'where':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63[_0xc6e6('0x14')][_0xc6e6('0x16')]||null:null,'attributes':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63['options'][_0xc6e6('0x1a')]||null:null,'include':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63['options']['include']?_[_0xc6e6('0x19')](_0xd3b63[_0xc6e6('0x14')][_0xc6e6('0x18')],function(_0x152e45){return{'model':db[_0x152e45[_0xc6e6('0x1b')]],'as':_0x152e45['as'],'attributes':_0x152e45[_0xc6e6('0x1a')],'include':_0x152e45['include']?_[_0xc6e6('0x19')](_0x152e45[_0xc6e6('0x18')],function(_0x1fff39){return{'model':db[_0x1fff39['model']],'as':_0x1fff39['as'],'attributes':_0x1fff39['attributes'],'include':_0x1fff39[_0xc6e6('0x18')]?_[_0xc6e6('0x19')](_0x1fff39[_0xc6e6('0x18')],function(_0x2db0a2){return{'model':db[_0x2db0a2['model']],'as':_0x2db0a2['as'],'attributes':_0x2db0a2['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6e6('0x8')](function(_0x4e94ea){logger[_0xc6e6('0x9')]('ShowVtigerAccount',_0xd3b63);logger[_0xc6e6('0xc')](_0xc6e6('0x1d'),_0xd3b63,JSON[_0xc6e6('0xe')](_0x4e94ea));_0x43ff9c(_0x4e94ea);})[_0xc6e6('0x11')](function(_0x58b972){logger['error'](_0xc6e6('0x1d'),_0x58b972[_0xc6e6('0x10')],_0xd3b63);_0x337442(_0x402598[_0xc6e6('0xf')](0x1f4,_0x58b972[_0xc6e6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c8bd77e..42f7d10 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 _0x2f7a=['../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2509be,_0x5c9173){var _0x2f2f00=function(_0x12b660){while(--_0x12b660){_0x2509be['push'](_0x2509be['shift']());}};_0x2f2f00(++_0x5c9173);}(_0x2f7a,0x1c3));var _0xa2f7=function(_0x55f77d,_0x42167b){_0x55f77d=_0x55f77d-0x0;var _0x369456=_0x2f7a[_0x55f77d];return _0x369456;};'use strict';var multer=require(_0xa2f7('0x0'));var util=require(_0xa2f7('0x1'));var path=require(_0xa2f7('0x2'));var timeout=require(_0xa2f7('0x3'));var express=require(_0xa2f7('0x4'));var router=express[_0xa2f7('0x5')]();var fs_extra=require(_0xa2f7('0x6'));var auth=require(_0xa2f7('0x7'));var interaction=require(_0xa2f7('0x8'));var config=require(_0xa2f7('0x9'));var controller=require(_0xa2f7('0xa'));router[_0xa2f7('0xb')]('/',auth['isAuthenticated'](),controller[_0xa2f7('0xc')]);router[_0xa2f7('0xb')](_0xa2f7('0xd'),auth[_0xa2f7('0xe')](),controller[_0xa2f7('0xf')]);router[_0xa2f7('0xb')](_0xa2f7('0x10'),auth['isAuthenticated'](),controller[_0xa2f7('0x11')]);router[_0xa2f7('0xb')](_0xa2f7('0x12'),auth[_0xa2f7('0xe')](),controller[_0xa2f7('0x13')]);router['get'](_0xa2f7('0x14'),auth[_0xa2f7('0xe')](),controller[_0xa2f7('0x15')]);router[_0xa2f7('0x16')]('/',auth[_0xa2f7('0xe')](),controller[_0xa2f7('0x17')]);router['put'](_0xa2f7('0xd'),auth[_0xa2f7('0xe')](),controller[_0xa2f7('0x18')]);router[_0xa2f7('0x19')](_0xa2f7('0xd'),auth[_0xa2f7('0xe')](),controller[_0xa2f7('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x87cc=['../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xca1643,_0x3eaf18){var _0x5dec49=function(_0x5e0bd9){while(--_0x5e0bd9){_0xca1643['push'](_0xca1643['shift']());}};_0x5dec49(++_0x3eaf18);}(_0x87cc,0xec));var _0xc87c=function(_0x4158c8,_0xa26189){_0x4158c8=_0x4158c8-0x0;var _0x20a22c=_0x87cc[_0x4158c8];return _0x20a22c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc87c('0x0'));var timeout=require(_0xc87c('0x1'));var express=require('express');var router=express[_0xc87c('0x2')]();var fs_extra=require(_0xc87c('0x3'));var auth=require(_0xc87c('0x4'));var interaction=require(_0xc87c('0x5'));var config=require(_0xc87c('0x6'));var controller=require(_0xc87c('0x7'));router[_0xc87c('0x8')]('/',auth[_0xc87c('0x9')](),controller['index']);router[_0xc87c('0x8')]('/:id',auth[_0xc87c('0x9')](),controller[_0xc87c('0xa')]);router['get'](_0xc87c('0xb'),auth[_0xc87c('0x9')](),controller[_0xc87c('0xc')]);router[_0xc87c('0x8')](_0xc87c('0xd'),auth['isAuthenticated'](),controller[_0xc87c('0xe')]);router[_0xc87c('0x8')](_0xc87c('0xf'),auth[_0xc87c('0x9')](),controller[_0xc87c('0x10')]);router[_0xc87c('0x11')]('/',auth[_0xc87c('0x9')](),controller[_0xc87c('0x12')]);router[_0xc87c('0x13')]('/:id',auth[_0xc87c('0x9')](),controller['update']);router[_0xc87c('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc87c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 6d10241..bc1beef 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 _0xc260=['STRING','exports'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0xc260,0x109));var _0x0c26=function(_0x562823,_0x3731e3){_0x562823=_0x562823-0x0;var _0x417734=_0xc260[_0x562823];return _0x417734;};'use strict';var Sequelize=require('sequelize');module[_0x0c26('0x0')]={'name':{'type':Sequelize[_0x0c26('0x1')]},'description':{'type':Sequelize[_0x0c26('0x1')]}}; \ No newline at end of file +var _0x047c=['sequelize','exports','STRING'];(function(_0x369268,_0x401490){var _0x346f5a=function(_0x2ea126){while(--_0x2ea126){_0x369268['push'](_0x369268['shift']());}};_0x346f5a(++_0x401490);}(_0x047c,0xd5));var _0xc047=function(_0x1a03e1,_0x3f5037){_0x1a03e1=_0x1a03e1-0x0;var _0x528919=_0x047c[_0x1a03e1];return _0x528919;};'use strict';var Sequelize=require(_0xc047('0x0'));module[_0xc047('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc047('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c562307..e36eeb9 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 _0xd1a6=['send','index','VtigerConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','destroy','findOne','VtigerField','getFields','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','end','name'];(function(_0x13d782,_0x64900d){var _0x17dc15=function(_0x296842){while(--_0x296842){_0x13d782['push'](_0x13d782['shift']());}};_0x17dc15(++_0x64900d);}(_0xd1a6,0x176));var _0x6d1a=function(_0x17f339,_0x1c4422){_0x17f339=_0x17f339-0x0;var _0x529dc2=_0xd1a6[_0x17f339];return _0x529dc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d1a('0x0'));var zipdir=require(_0x6d1a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d1a('0x2'));var moment=require(_0x6d1a('0x3'));var BPromise=require(_0x6d1a('0x4'));var Mustache=require(_0x6d1a('0x5'));var util=require(_0x6d1a('0x6'));var path=require(_0x6d1a('0x7'));var sox=require(_0x6d1a('0x8'));var csv=require(_0x6d1a('0x9'));var ejs=require(_0x6d1a('0xa'));var fs=require('fs');var fs_extra=require(_0x6d1a('0xb'));var _=require(_0x6d1a('0xc'));var squel=require(_0x6d1a('0xd'));var crypto=require(_0x6d1a('0xe'));var jsforce=require(_0x6d1a('0xf'));var deskjs=require(_0x6d1a('0x10'));var toCsv=require(_0x6d1a('0x9'));var querystring=require(_0x6d1a('0x11'));var Papa=require(_0x6d1a('0x12'));var Redis=require('ioredis');var authService=require(_0x6d1a('0x13'));var qs=require(_0x6d1a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d1a('0x15'));var logger=require(_0x6d1a('0x16'))('api');var utils=require(_0x6d1a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6d1a('0x18'));var db=require(_0x6d1a('0x19'))['db'];function respondWithStatusCode(_0x1023b0,_0x508507){_0x508507=_0x508507||0xcc;return function(_0x2c1868){if(_0x2c1868){return _0x1023b0[_0x6d1a('0x1a')](_0x508507);}return _0x1023b0[_0x6d1a('0x1b')](_0x508507)['end']();};}function respondWithResult(_0x17a2da,_0x45cfd3){_0x45cfd3=_0x45cfd3||0xc8;return function(_0x5e801c){if(_0x5e801c){return _0x17a2da['status'](_0x45cfd3)['json'](_0x5e801c);}};}function respondWithFilteredResult(_0x12e050,_0x193309){return function(_0x2e911a){if(_0x2e911a){var _0x5af663=typeof _0x193309[_0x6d1a('0x1c')]===_0x6d1a('0x1d')&&typeof _0x193309[_0x6d1a('0x1e')]==='undefined';var _0x143e5e=_0x2e911a[_0x6d1a('0x1f')];var _0x2c9b58=_0x5af663?0x0:_0x193309[_0x6d1a('0x1c')];var _0x3c30b2=_0x5af663?_0x2e911a[_0x6d1a('0x1f')]:_0x193309[_0x6d1a('0x1c')]+_0x193309[_0x6d1a('0x1e')];var _0x2d1fd5;if(_0x3c30b2>=_0x143e5e){_0x3c30b2=_0x143e5e;_0x2d1fd5=0xc8;}else{_0x2d1fd5=0xce;}_0x12e050[_0x6d1a('0x1b')](_0x2d1fd5);return _0x12e050[_0x6d1a('0x20')](_0x6d1a('0x21'),_0x2c9b58+'-'+_0x3c30b2+'/'+_0x143e5e)[_0x6d1a('0x22')](_0x2e911a);}return null;};}function patchUpdates(_0x5bd762){return function(_0x47da15){try{jsonpatch[_0x6d1a('0x23')](_0x47da15,_0x5bd762,!![]);}catch(_0x4c0703){return BPromise[_0x6d1a('0x24')](_0x4c0703);}return _0x47da15[_0x6d1a('0x25')]();};}function saveUpdates(_0x3d23be,_0x5024a3){return function(_0x2ce4b9){if(_0x2ce4b9){return _0x2ce4b9['update'](_0x3d23be)[_0x6d1a('0x26')](function(_0x573c4d){return _0x573c4d;});}return null;};}function removeEntity(_0x10a894,_0x1c4f23){return function(_0x5166f4){if(_0x5166f4){return _0x5166f4['destroy']()[_0x6d1a('0x26')](function(){_0x10a894['status'](0xcc)[_0x6d1a('0x27')]();});}};}function handleEntityNotFound(_0x28d6c9,_0x15c967){return function(_0x1e286f){if(!_0x1e286f){_0x28d6c9[_0x6d1a('0x1a')](0x194);}return _0x1e286f;};}function handleError(_0x3c486d,_0x5aabab){_0x5aabab=_0x5aabab||0x1f4;return function(_0x42d91d){logger['error'](_0x42d91d['stack']);if(_0x42d91d[_0x6d1a('0x28')]){delete _0x42d91d[_0x6d1a('0x28')];}_0x3c486d['status'](_0x5aabab)[_0x6d1a('0x29')](_0x42d91d);};}exports[_0x6d1a('0x2a')]=function(_0x654783,_0xe0f8d6){var _0x41c7d9={},_0x424f74={},_0x3a038f={'count':0x0,'rows':[]};var _0x3ea0a8=_['map'](db[_0x6d1a('0x2b')][_0x6d1a('0x2c')],function(_0x2f4709){return{'name':_0x2f4709[_0x6d1a('0x2d')],'type':_0x2f4709['type'][_0x6d1a('0x2e')]};});_0x424f74[_0x6d1a('0x2f')]=_[_0x6d1a('0x30')](_0x3ea0a8,'name');_0x424f74[_0x6d1a('0x31')]=_[_0x6d1a('0x32')](_0x654783[_0x6d1a('0x31')]);_0x424f74[_0x6d1a('0x33')]=_[_0x6d1a('0x34')](_0x424f74[_0x6d1a('0x2f')],_0x424f74[_0x6d1a('0x31')]);_0x41c7d9[_0x6d1a('0x35')]=_['intersection'](_0x424f74[_0x6d1a('0x2f')],qs[_0x6d1a('0x36')](_0x654783[_0x6d1a('0x31')][_0x6d1a('0x36')]));_0x41c7d9[_0x6d1a('0x35')]=_0x41c7d9[_0x6d1a('0x35')]['length']?_0x41c7d9['attributes']:_0x424f74[_0x6d1a('0x2f')];if(!_0x654783[_0x6d1a('0x31')][_0x6d1a('0x37')](_0x6d1a('0x38'))){_0x41c7d9[_0x6d1a('0x1e')]=qs[_0x6d1a('0x1e')](_0x654783[_0x6d1a('0x31')][_0x6d1a('0x1e')]);_0x41c7d9[_0x6d1a('0x1c')]=qs[_0x6d1a('0x1c')](_0x654783[_0x6d1a('0x31')]['offset']);}_0x41c7d9[_0x6d1a('0x39')]=qs[_0x6d1a('0x3a')](_0x654783[_0x6d1a('0x31')][_0x6d1a('0x3a')]);_0x41c7d9[_0x6d1a('0x3b')]=qs[_0x6d1a('0x33')](_[_0x6d1a('0x3c')](_0x654783[_0x6d1a('0x31')],_0x424f74[_0x6d1a('0x33')]),_0x3ea0a8);if(_0x654783['query']['filter']){_0x41c7d9['where']=_[_0x6d1a('0x3d')](_0x41c7d9[_0x6d1a('0x3b')],{'$or':_[_0x6d1a('0x30')](_0x3ea0a8,function(_0x32a318){if(_0x32a318[_0x6d1a('0x3e')]!==_0x6d1a('0x3f')){var _0x3283e2={};_0x3283e2[_0x32a318[_0x6d1a('0x28')]]={'$like':'%'+_0x654783[_0x6d1a('0x31')][_0x6d1a('0x40')]+'%'};return _0x3283e2;}})});}_0x41c7d9=_[_0x6d1a('0x3d')]({},_0x41c7d9,_0x654783[_0x6d1a('0x41')]);var _0x41023b={'where':_0x41c7d9[_0x6d1a('0x3b')]};return db[_0x6d1a('0x2b')][_0x6d1a('0x1f')](_0x41023b)['then'](function(_0x562b45){_0x3a038f[_0x6d1a('0x1f')]=_0x562b45;if(_0x654783[_0x6d1a('0x31')]['includeAll']){_0x41c7d9[_0x6d1a('0x42')]=[{'all':!![]}];}return db[_0x6d1a('0x2b')][_0x6d1a('0x43')](_0x41c7d9);})[_0x6d1a('0x26')](function(_0x521494){_0x3a038f[_0x6d1a('0x44')]=_0x521494;return _0x3a038f;})['then'](respondWithFilteredResult(_0xe0f8d6,_0x41c7d9))[_0x6d1a('0x45')](handleError(_0xe0f8d6,null));};exports[_0x6d1a('0x46')]=function(_0xcbc020,_0x30d017){var _0x45d0cc={'raw':![],'where':{'id':_0xcbc020[_0x6d1a('0x47')]['id']}},_0x3a9773={};_0x3a9773['model']=_['keys'](db[_0x6d1a('0x2b')]['rawAttributes']);_0x3a9773['query']=_[_0x6d1a('0x32')](_0xcbc020[_0x6d1a('0x31')]);_0x3a9773[_0x6d1a('0x33')]=_[_0x6d1a('0x34')](_0x3a9773[_0x6d1a('0x2f')],_0x3a9773[_0x6d1a('0x31')]);_0x45d0cc['attributes']=_[_0x6d1a('0x34')](_0x3a9773[_0x6d1a('0x2f')],qs[_0x6d1a('0x36')](_0xcbc020[_0x6d1a('0x31')][_0x6d1a('0x36')]));_0x45d0cc[_0x6d1a('0x35')]=_0x45d0cc[_0x6d1a('0x35')][_0x6d1a('0x48')]?_0x45d0cc[_0x6d1a('0x35')]:_0x3a9773[_0x6d1a('0x2f')];if(_0xcbc020[_0x6d1a('0x31')][_0x6d1a('0x49')]){_0x45d0cc[_0x6d1a('0x42')]=[{'all':!![]}];}_0x45d0cc=_['merge']({},_0x45d0cc,_0xcbc020[_0x6d1a('0x41')]);return db[_0x6d1a('0x2b')][_0x6d1a('0x4a')](_0x45d0cc)[_0x6d1a('0x26')](handleEntityNotFound(_0x30d017,null))['then'](respondWithResult(_0x30d017,null))['catch'](handleError(_0x30d017,null));};exports['create']=function(_0xa08020,_0x2b5f0a){return db[_0x6d1a('0x2b')][_0x6d1a('0x4b')](_0xa08020[_0x6d1a('0x4c')],{})[_0x6d1a('0x26')](respondWithResult(_0x2b5f0a,0xc9))[_0x6d1a('0x45')](handleError(_0x2b5f0a,null));};exports['update']=function(_0x5f23d9,_0x5c6f06){if(_0x5f23d9['body']['id']){delete _0x5f23d9[_0x6d1a('0x4c')]['id'];}return db[_0x6d1a('0x2b')]['find']({'where':{'id':_0x5f23d9[_0x6d1a('0x47')]['id']}})[_0x6d1a('0x26')](handleEntityNotFound(_0x5c6f06,null))['then'](saveUpdates(_0x5f23d9[_0x6d1a('0x4c')],null))['then'](respondWithResult(_0x5c6f06,null))['catch'](handleError(_0x5c6f06,null));};exports[_0x6d1a('0x4d')]=function(_0x231c4c,_0x4225d6){return db[_0x6d1a('0x2b')][_0x6d1a('0x4a')]({'where':{'id':_0x231c4c['params']['id']}})[_0x6d1a('0x26')](handleEntityNotFound(_0x4225d6,null))[_0x6d1a('0x26')](removeEntity(_0x4225d6,null))[_0x6d1a('0x45')](handleError(_0x4225d6,null));};exports['getFields']=function(_0x23ffd7,_0x535c33,_0x5afc54){var _0x396f5d={};var _0x4dc260={};var _0x305d09;var _0x5f219f;return db[_0x6d1a('0x2b')][_0x6d1a('0x4e')]({'where':{'id':_0x23ffd7[_0x6d1a('0x47')]['id']}})[_0x6d1a('0x26')](handleEntityNotFound(_0x535c33,null))[_0x6d1a('0x26')](function(_0x15d84c){if(_0x15d84c){_0x305d09=_0x15d84c;_0x4dc260[_0x6d1a('0x2f')]=_['keys'](db[_0x6d1a('0x4f')][_0x6d1a('0x2c')]);_0x4dc260[_0x6d1a('0x31')]=_[_0x6d1a('0x32')](_0x23ffd7[_0x6d1a('0x31')]);_0x4dc260[_0x6d1a('0x33')]=_[_0x6d1a('0x34')](_0x4dc260[_0x6d1a('0x2f')],_0x4dc260[_0x6d1a('0x31')]);_0x396f5d[_0x6d1a('0x35')]=_[_0x6d1a('0x34')](_0x4dc260['model'],qs[_0x6d1a('0x36')](_0x23ffd7[_0x6d1a('0x31')][_0x6d1a('0x36')]));_0x396f5d[_0x6d1a('0x35')]=_0x396f5d[_0x6d1a('0x35')][_0x6d1a('0x48')]?_0x396f5d[_0x6d1a('0x35')]:_0x4dc260[_0x6d1a('0x2f')];_0x396f5d[_0x6d1a('0x39')]=qs[_0x6d1a('0x3a')](_0x23ffd7[_0x6d1a('0x31')][_0x6d1a('0x3a')]);_0x396f5d[_0x6d1a('0x3b')]=qs[_0x6d1a('0x33')](_['pick'](_0x23ffd7['query'],_0x4dc260['filters']));if(_0x23ffd7[_0x6d1a('0x31')]['filter']){_0x396f5d['where']=_[_0x6d1a('0x3d')](_0x396f5d[_0x6d1a('0x3b')],{'$or':_[_0x6d1a('0x30')](_0x396f5d[_0x6d1a('0x35')],function(_0x4f6d1c){var _0x537912={};_0x537912[_0x4f6d1c]={'$like':'%'+_0x23ffd7[_0x6d1a('0x31')][_0x6d1a('0x40')]+'%'};return _0x537912;})});}_0x396f5d=_[_0x6d1a('0x3d')]({},_0x396f5d,_0x23ffd7[_0x6d1a('0x41')]);return _0x305d09[_0x6d1a('0x50')](_0x396f5d);}})[_0x6d1a('0x26')](function(_0x4506ef){if(_0x4506ef){_0x5f219f=_0x4506ef[_0x6d1a('0x48')];if(!_0x23ffd7[_0x6d1a('0x31')]['hasOwnProperty'](_0x6d1a('0x38'))){_0x396f5d[_0x6d1a('0x1e')]=qs[_0x6d1a('0x1e')](_0x23ffd7[_0x6d1a('0x31')]['limit']);_0x396f5d[_0x6d1a('0x1c')]=qs[_0x6d1a('0x1c')](_0x23ffd7[_0x6d1a('0x31')][_0x6d1a('0x1c')]);}return _0x305d09[_0x6d1a('0x50')](_0x396f5d);}})['then'](function(_0x2d74d7){if(_0x2d74d7){return _0x2d74d7?{'count':_0x5f219f,'rows':_0x2d74d7}:null;}})['then'](respondWithResult(_0x535c33,null))['catch'](handleError(_0x535c33,null));};exports['getSubjects']=function(_0x247587,_0x4b7976,_0x225405){var _0x229ecc={};var _0xff6568={};var _0x1f044;var _0x984c34;return db[_0x6d1a('0x2b')][_0x6d1a('0x4e')]({'where':{'id':_0x247587['params']['id']}})[_0x6d1a('0x26')](handleEntityNotFound(_0x4b7976,null))[_0x6d1a('0x26')](function(_0x4f8bf8){if(_0x4f8bf8){_0x1f044=_0x4f8bf8;_0xff6568[_0x6d1a('0x2f')]=_[_0x6d1a('0x32')](db[_0x6d1a('0x4f')][_0x6d1a('0x2c')]);_0xff6568[_0x6d1a('0x31')]=_['keys'](_0x247587['query']);_0xff6568[_0x6d1a('0x33')]=_[_0x6d1a('0x34')](_0xff6568[_0x6d1a('0x2f')],_0xff6568[_0x6d1a('0x31')]);_0x229ecc['attributes']=_[_0x6d1a('0x34')](_0xff6568[_0x6d1a('0x2f')],qs[_0x6d1a('0x36')](_0x247587[_0x6d1a('0x31')]['fields']));_0x229ecc['attributes']=_0x229ecc[_0x6d1a('0x35')]['length']?_0x229ecc['attributes']:_0xff6568[_0x6d1a('0x2f')];_0x229ecc[_0x6d1a('0x39')]=qs[_0x6d1a('0x3a')](_0x247587['query'][_0x6d1a('0x3a')]);_0x229ecc[_0x6d1a('0x3b')]=qs['filters'](_[_0x6d1a('0x3c')](_0x247587[_0x6d1a('0x31')],_0xff6568[_0x6d1a('0x33')]));if(_0x247587[_0x6d1a('0x31')][_0x6d1a('0x40')]){_0x229ecc[_0x6d1a('0x3b')]=_[_0x6d1a('0x3d')](_0x229ecc[_0x6d1a('0x3b')],{'$or':_[_0x6d1a('0x30')](_0x229ecc[_0x6d1a('0x35')],function(_0x10f9ad){var _0x9818ca={};_0x9818ca[_0x10f9ad]={'$like':'%'+_0x247587[_0x6d1a('0x31')][_0x6d1a('0x40')]+'%'};return _0x9818ca;})});}_0x229ecc=_[_0x6d1a('0x3d')]({},_0x229ecc,_0x247587[_0x6d1a('0x41')]);return _0x1f044[_0x6d1a('0x51')](_0x229ecc);}})[_0x6d1a('0x26')](function(_0x512ce7){if(_0x512ce7){_0x984c34=_0x512ce7[_0x6d1a('0x48')];if(!_0x247587[_0x6d1a('0x31')][_0x6d1a('0x37')](_0x6d1a('0x38'))){_0x229ecc['limit']=qs[_0x6d1a('0x1e')](_0x247587[_0x6d1a('0x31')]['limit']);_0x229ecc[_0x6d1a('0x1c')]=qs[_0x6d1a('0x1c')](_0x247587[_0x6d1a('0x31')]['offset']);}return _0x1f044[_0x6d1a('0x51')](_0x229ecc);}})[_0x6d1a('0x26')](function(_0x387562){if(_0x387562){return _0x387562?{'count':_0x984c34,'rows':_0x387562}:null;}})[_0x6d1a('0x26')](respondWithResult(_0x4b7976,null))[_0x6d1a('0x45')](handleError(_0x4b7976,null));};exports[_0x6d1a('0x52')]=function(_0x11e92b,_0x5403c2,_0x2e42bb){var _0xbf9f68={};var _0x497918={};var _0x361aef;var _0x2709cc;return db[_0x6d1a('0x2b')][_0x6d1a('0x4e')]({'where':{'id':_0x11e92b[_0x6d1a('0x47')]['id']}})[_0x6d1a('0x26')](handleEntityNotFound(_0x5403c2,null))['then'](function(_0x585810){if(_0x585810){_0x361aef=_0x585810;_0x497918['model']=_[_0x6d1a('0x32')](db['VtigerField'][_0x6d1a('0x2c')]);_0x497918[_0x6d1a('0x31')]=_[_0x6d1a('0x32')](_0x11e92b['query']);_0x497918[_0x6d1a('0x33')]=_['intersection'](_0x497918[_0x6d1a('0x2f')],_0x497918[_0x6d1a('0x31')]);_0xbf9f68[_0x6d1a('0x35')]=_['intersection'](_0x497918[_0x6d1a('0x2f')],qs[_0x6d1a('0x36')](_0x11e92b[_0x6d1a('0x31')][_0x6d1a('0x36')]));_0xbf9f68['attributes']=_0xbf9f68[_0x6d1a('0x35')]['length']?_0xbf9f68[_0x6d1a('0x35')]:_0x497918['model'];_0xbf9f68['order']=qs[_0x6d1a('0x3a')](_0x11e92b['query']['sort']);_0xbf9f68[_0x6d1a('0x3b')]=qs[_0x6d1a('0x33')](_[_0x6d1a('0x3c')](_0x11e92b[_0x6d1a('0x31')],_0x497918['filters']));if(_0x11e92b[_0x6d1a('0x31')][_0x6d1a('0x40')]){_0xbf9f68[_0x6d1a('0x3b')]=_[_0x6d1a('0x3d')](_0xbf9f68['where'],{'$or':_[_0x6d1a('0x30')](_0xbf9f68[_0x6d1a('0x35')],function(_0x2089d4){var _0x129903={};_0x129903[_0x2089d4]={'$like':'%'+_0x11e92b[_0x6d1a('0x31')][_0x6d1a('0x40')]+'%'};return _0x129903;})});}_0xbf9f68=_[_0x6d1a('0x3d')]({},_0xbf9f68,_0x11e92b[_0x6d1a('0x41')]);return _0x361aef['getDescriptions'](_0xbf9f68);}})[_0x6d1a('0x26')](function(_0x44a835){if(_0x44a835){_0x2709cc=_0x44a835[_0x6d1a('0x48')];if(!_0x11e92b['query'][_0x6d1a('0x37')]('nolimit')){_0xbf9f68[_0x6d1a('0x1e')]=qs[_0x6d1a('0x1e')](_0x11e92b['query'][_0x6d1a('0x1e')]);_0xbf9f68[_0x6d1a('0x1c')]=qs[_0x6d1a('0x1c')](_0x11e92b['query']['offset']);}return _0x361aef['getDescriptions'](_0xbf9f68);}})[_0x6d1a('0x26')](function(_0x403fc7){if(_0x403fc7){return _0x403fc7?{'count':_0x2709cc,'rows':_0x403fc7}:null;}})[_0x6d1a('0x26')](respondWithResult(_0x5403c2,null))['catch'](handleError(_0x5403c2,null));}; \ No newline at end of file +var _0xad53=['VtigerField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','name','send','map','VtigerConfiguration','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','destroy','getFields','findOne'];(function(_0x3bdd40,_0x414ee6){var _0x216370=function(_0x3e6252){while(--_0x3e6252){_0x3bdd40['push'](_0x3bdd40['shift']());}};_0x216370(++_0x414ee6);}(_0xad53,0x1ea));var _0x3ad5=function(_0x470faa,_0x369fdb){_0x470faa=_0x470faa-0x0;var _0x188e51=_0xad53[_0x470faa];return _0x188e51;};'use strict';var emlformat=require(_0x3ad5('0x0'));var rimraf=require(_0x3ad5('0x1'));var zipdir=require(_0x3ad5('0x2'));var jsonpatch=require(_0x3ad5('0x3'));var rp=require(_0x3ad5('0x4'));var moment=require(_0x3ad5('0x5'));var BPromise=require(_0x3ad5('0x6'));var Mustache=require(_0x3ad5('0x7'));var util=require('util');var path=require(_0x3ad5('0x8'));var sox=require(_0x3ad5('0x9'));var csv=require(_0x3ad5('0xa'));var ejs=require(_0x3ad5('0xb'));var fs=require('fs');var fs_extra=require(_0x3ad5('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ad5('0xd'));var deskjs=require(_0x3ad5('0xe'));var toCsv=require(_0x3ad5('0xa'));var querystring=require(_0x3ad5('0xf'));var Papa=require(_0x3ad5('0x10'));var Redis=require(_0x3ad5('0x11'));var authService=require(_0x3ad5('0x12'));var qs=require(_0x3ad5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ad5('0x14'));var logger=require(_0x3ad5('0x15'))(_0x3ad5('0x16'));var utils=require(_0x3ad5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3ad5('0x18'));var db=require(_0x3ad5('0x19'))['db'];function respondWithStatusCode(_0x1dc68b,_0x542e82){_0x542e82=_0x542e82||0xcc;return function(_0x1bd82f){if(_0x1bd82f){return _0x1dc68b[_0x3ad5('0x1a')](_0x542e82);}return _0x1dc68b[_0x3ad5('0x1b')](_0x542e82)[_0x3ad5('0x1c')]();};}function respondWithResult(_0x2cfe73,_0x28d6ad){_0x28d6ad=_0x28d6ad||0xc8;return function(_0x50758e){if(_0x50758e){return _0x2cfe73['status'](_0x28d6ad)[_0x3ad5('0x1d')](_0x50758e);}};}function respondWithFilteredResult(_0x278364,_0xabcbc0){return function(_0x70aec9){if(_0x70aec9){var _0x1d5868=typeof _0xabcbc0[_0x3ad5('0x1e')]==='undefined'&&typeof _0xabcbc0['limit']===_0x3ad5('0x1f');var _0x421d09=_0x70aec9['count'];var _0x5d557e=_0x1d5868?0x0:_0xabcbc0[_0x3ad5('0x1e')];var _0xd8775=_0x1d5868?_0x70aec9[_0x3ad5('0x20')]:_0xabcbc0[_0x3ad5('0x1e')]+_0xabcbc0['limit'];var _0xb97fb9;if(_0xd8775>=_0x421d09){_0xd8775=_0x421d09;_0xb97fb9=0xc8;}else{_0xb97fb9=0xce;}_0x278364[_0x3ad5('0x1b')](_0xb97fb9);return _0x278364[_0x3ad5('0x21')](_0x3ad5('0x22'),_0x5d557e+'-'+_0xd8775+'/'+_0x421d09)[_0x3ad5('0x1d')](_0x70aec9);}return null;};}function patchUpdates(_0x1c37c7){return function(_0x3aaef8){try{jsonpatch[_0x3ad5('0x23')](_0x3aaef8,_0x1c37c7,!![]);}catch(_0x177760){return BPromise['reject'](_0x177760);}return _0x3aaef8[_0x3ad5('0x24')]();};}function saveUpdates(_0x4d00e2,_0x936a29){return function(_0x58a06f){if(_0x58a06f){return _0x58a06f[_0x3ad5('0x25')](_0x4d00e2)[_0x3ad5('0x26')](function(_0x1dcde4){return _0x1dcde4;});}return null;};}function removeEntity(_0xeaf8f7,_0x24d2ee){return function(_0x26b402){if(_0x26b402){return _0x26b402['destroy']()[_0x3ad5('0x26')](function(){_0xeaf8f7[_0x3ad5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa80a,_0x24f7e1){return function(_0x42c242){if(!_0x42c242){_0xaa80a['sendStatus'](0x194);}return _0x42c242;};}function handleError(_0x8ef5c,_0x429ea6){_0x429ea6=_0x429ea6||0x1f4;return function(_0x40da5d){logger['error'](_0x40da5d['stack']);if(_0x40da5d['name']){delete _0x40da5d[_0x3ad5('0x27')];}_0x8ef5c[_0x3ad5('0x1b')](_0x429ea6)[_0x3ad5('0x28')](_0x40da5d);};}exports['index']=function(_0x1aa234,_0x1724fc){var _0x489de6={},_0x4c66f7={},_0x2a402c={'count':0x0,'rows':[]};var _0x5c2d1e=_[_0x3ad5('0x29')](db[_0x3ad5('0x2a')][_0x3ad5('0x2b')],function(_0x389abd){return{'name':_0x389abd[_0x3ad5('0x2c')],'type':_0x389abd['type']['key']};});_0x4c66f7[_0x3ad5('0x2d')]=_[_0x3ad5('0x29')](_0x5c2d1e,_0x3ad5('0x27'));_0x4c66f7[_0x3ad5('0x2e')]=_['keys'](_0x1aa234[_0x3ad5('0x2e')]);_0x4c66f7[_0x3ad5('0x2f')]=_[_0x3ad5('0x30')](_0x4c66f7[_0x3ad5('0x2d')],_0x4c66f7[_0x3ad5('0x2e')]);_0x489de6[_0x3ad5('0x31')]=_[_0x3ad5('0x30')](_0x4c66f7[_0x3ad5('0x2d')],qs[_0x3ad5('0x32')](_0x1aa234[_0x3ad5('0x2e')]['fields']));_0x489de6[_0x3ad5('0x31')]=_0x489de6[_0x3ad5('0x31')][_0x3ad5('0x33')]?_0x489de6[_0x3ad5('0x31')]:_0x4c66f7[_0x3ad5('0x2d')];if(!_0x1aa234[_0x3ad5('0x2e')][_0x3ad5('0x34')]('nolimit')){_0x489de6['limit']=qs[_0x3ad5('0x35')](_0x1aa234[_0x3ad5('0x2e')]['limit']);_0x489de6[_0x3ad5('0x1e')]=qs[_0x3ad5('0x1e')](_0x1aa234[_0x3ad5('0x2e')][_0x3ad5('0x1e')]);}_0x489de6[_0x3ad5('0x36')]=qs[_0x3ad5('0x37')](_0x1aa234[_0x3ad5('0x2e')][_0x3ad5('0x37')]);_0x489de6[_0x3ad5('0x38')]=qs[_0x3ad5('0x2f')](_[_0x3ad5('0x39')](_0x1aa234[_0x3ad5('0x2e')],_0x4c66f7[_0x3ad5('0x2f')]),_0x5c2d1e);if(_0x1aa234['query'][_0x3ad5('0x3a')]){_0x489de6['where']=_[_0x3ad5('0x3b')](_0x489de6[_0x3ad5('0x38')],{'$or':_[_0x3ad5('0x29')](_0x5c2d1e,function(_0x31cc70){if(_0x31cc70[_0x3ad5('0x3c')]!==_0x3ad5('0x3d')){var _0x183dcb={};_0x183dcb[_0x31cc70['name']]={'$like':'%'+_0x1aa234['query'][_0x3ad5('0x3a')]+'%'};return _0x183dcb;}})});}_0x489de6=_[_0x3ad5('0x3b')]({},_0x489de6,_0x1aa234[_0x3ad5('0x3e')]);var _0x1a9b61={'where':_0x489de6[_0x3ad5('0x38')]};return db[_0x3ad5('0x2a')][_0x3ad5('0x20')](_0x1a9b61)[_0x3ad5('0x26')](function(_0x462e00){_0x2a402c[_0x3ad5('0x20')]=_0x462e00;if(_0x1aa234[_0x3ad5('0x2e')][_0x3ad5('0x3f')]){_0x489de6[_0x3ad5('0x40')]=[{'all':!![]}];}return db[_0x3ad5('0x2a')][_0x3ad5('0x41')](_0x489de6);})[_0x3ad5('0x26')](function(_0x26ae59){_0x2a402c[_0x3ad5('0x42')]=_0x26ae59;return _0x2a402c;})['then'](respondWithFilteredResult(_0x1724fc,_0x489de6))['catch'](handleError(_0x1724fc,null));};exports[_0x3ad5('0x43')]=function(_0x6d237e,_0x550c1c){var _0x6a73f3={'raw':![],'where':{'id':_0x6d237e['params']['id']}},_0x47f797={};_0x47f797[_0x3ad5('0x2d')]=_[_0x3ad5('0x44')](db[_0x3ad5('0x2a')][_0x3ad5('0x2b')]);_0x47f797[_0x3ad5('0x2e')]=_[_0x3ad5('0x44')](_0x6d237e[_0x3ad5('0x2e')]);_0x47f797['filters']=_[_0x3ad5('0x30')](_0x47f797[_0x3ad5('0x2d')],_0x47f797[_0x3ad5('0x2e')]);_0x6a73f3[_0x3ad5('0x31')]=_[_0x3ad5('0x30')](_0x47f797['model'],qs[_0x3ad5('0x32')](_0x6d237e[_0x3ad5('0x2e')][_0x3ad5('0x32')]));_0x6a73f3[_0x3ad5('0x31')]=_0x6a73f3['attributes']['length']?_0x6a73f3['attributes']:_0x47f797[_0x3ad5('0x2d')];if(_0x6d237e[_0x3ad5('0x2e')][_0x3ad5('0x3f')]){_0x6a73f3[_0x3ad5('0x40')]=[{'all':!![]}];}_0x6a73f3=_['merge']({},_0x6a73f3,_0x6d237e['options']);return db[_0x3ad5('0x2a')][_0x3ad5('0x45')](_0x6a73f3)[_0x3ad5('0x26')](handleEntityNotFound(_0x550c1c,null))['then'](respondWithResult(_0x550c1c,null))[_0x3ad5('0x46')](handleError(_0x550c1c,null));};exports[_0x3ad5('0x47')]=function(_0x597c62,_0x26acf4){return db[_0x3ad5('0x2a')][_0x3ad5('0x47')](_0x597c62['body'],{})['then'](respondWithResult(_0x26acf4,0xc9))[_0x3ad5('0x46')](handleError(_0x26acf4,null));};exports['update']=function(_0x256c1d,_0x5351d9){if(_0x256c1d[_0x3ad5('0x48')]['id']){delete _0x256c1d[_0x3ad5('0x48')]['id'];}return db['VtigerConfiguration'][_0x3ad5('0x45')]({'where':{'id':_0x256c1d[_0x3ad5('0x49')]['id']}})[_0x3ad5('0x26')](handleEntityNotFound(_0x5351d9,null))['then'](saveUpdates(_0x256c1d['body'],null))[_0x3ad5('0x26')](respondWithResult(_0x5351d9,null))[_0x3ad5('0x46')](handleError(_0x5351d9,null));};exports[_0x3ad5('0x4a')]=function(_0x3cd138,_0x1b423c){return db['VtigerConfiguration'][_0x3ad5('0x45')]({'where':{'id':_0x3cd138[_0x3ad5('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b423c,null))[_0x3ad5('0x26')](removeEntity(_0x1b423c,null))['catch'](handleError(_0x1b423c,null));};exports[_0x3ad5('0x4b')]=function(_0x101f05,_0x28ca27,_0x13f65b){var _0x38634a={};var _0x204bae={};var _0x386f76;var _0x3b4609;return db[_0x3ad5('0x2a')][_0x3ad5('0x4c')]({'where':{'id':_0x101f05['params']['id']}})[_0x3ad5('0x26')](handleEntityNotFound(_0x28ca27,null))[_0x3ad5('0x26')](function(_0x57177c){if(_0x57177c){_0x386f76=_0x57177c;_0x204bae[_0x3ad5('0x2d')]=_['keys'](db[_0x3ad5('0x4d')]['rawAttributes']);_0x204bae[_0x3ad5('0x2e')]=_[_0x3ad5('0x44')](_0x101f05['query']);_0x204bae[_0x3ad5('0x2f')]=_['intersection'](_0x204bae[_0x3ad5('0x2d')],_0x204bae[_0x3ad5('0x2e')]);_0x38634a[_0x3ad5('0x31')]=_['intersection'](_0x204bae[_0x3ad5('0x2d')],qs['fields'](_0x101f05[_0x3ad5('0x2e')]['fields']));_0x38634a[_0x3ad5('0x31')]=_0x38634a[_0x3ad5('0x31')][_0x3ad5('0x33')]?_0x38634a[_0x3ad5('0x31')]:_0x204bae['model'];_0x38634a['order']=qs[_0x3ad5('0x37')](_0x101f05[_0x3ad5('0x2e')][_0x3ad5('0x37')]);_0x38634a['where']=qs['filters'](_[_0x3ad5('0x39')](_0x101f05[_0x3ad5('0x2e')],_0x204bae[_0x3ad5('0x2f')]));if(_0x101f05[_0x3ad5('0x2e')]['filter']){_0x38634a[_0x3ad5('0x38')]=_[_0x3ad5('0x3b')](_0x38634a[_0x3ad5('0x38')],{'$or':_[_0x3ad5('0x29')](_0x38634a[_0x3ad5('0x31')],function(_0x141b4f){var _0x5b5845={};_0x5b5845[_0x141b4f]={'$like':'%'+_0x101f05['query'][_0x3ad5('0x3a')]+'%'};return _0x5b5845;})});}_0x38634a=_[_0x3ad5('0x3b')]({},_0x38634a,_0x101f05[_0x3ad5('0x3e')]);return _0x386f76['getFields'](_0x38634a);}})['then'](function(_0x5cc254){if(_0x5cc254){_0x3b4609=_0x5cc254['length'];if(!_0x101f05['query']['hasOwnProperty'](_0x3ad5('0x4e'))){_0x38634a['limit']=qs[_0x3ad5('0x35')](_0x101f05['query'][_0x3ad5('0x35')]);_0x38634a[_0x3ad5('0x1e')]=qs[_0x3ad5('0x1e')](_0x101f05[_0x3ad5('0x2e')][_0x3ad5('0x1e')]);}return _0x386f76[_0x3ad5('0x4b')](_0x38634a);}})['then'](function(_0x42ea5c){if(_0x42ea5c){return _0x42ea5c?{'count':_0x3b4609,'rows':_0x42ea5c}:null;}})['then'](respondWithResult(_0x28ca27,null))['catch'](handleError(_0x28ca27,null));};exports['getSubjects']=function(_0xde030c,_0x3121d1,_0x24f4fa){var _0x15bf13={};var _0x18424f={};var _0x259ada;var _0x57ba6a;return db[_0x3ad5('0x2a')][_0x3ad5('0x4c')]({'where':{'id':_0xde030c[_0x3ad5('0x49')]['id']}})[_0x3ad5('0x26')](handleEntityNotFound(_0x3121d1,null))[_0x3ad5('0x26')](function(_0x367e3c){if(_0x367e3c){_0x259ada=_0x367e3c;_0x18424f[_0x3ad5('0x2d')]=_[_0x3ad5('0x44')](db['VtigerField'][_0x3ad5('0x2b')]);_0x18424f['query']=_[_0x3ad5('0x44')](_0xde030c[_0x3ad5('0x2e')]);_0x18424f[_0x3ad5('0x2f')]=_[_0x3ad5('0x30')](_0x18424f[_0x3ad5('0x2d')],_0x18424f[_0x3ad5('0x2e')]);_0x15bf13[_0x3ad5('0x31')]=_[_0x3ad5('0x30')](_0x18424f['model'],qs['fields'](_0xde030c[_0x3ad5('0x2e')][_0x3ad5('0x32')]));_0x15bf13['attributes']=_0x15bf13['attributes'][_0x3ad5('0x33')]?_0x15bf13[_0x3ad5('0x31')]:_0x18424f[_0x3ad5('0x2d')];_0x15bf13['order']=qs[_0x3ad5('0x37')](_0xde030c[_0x3ad5('0x2e')][_0x3ad5('0x37')]);_0x15bf13['where']=qs['filters'](_[_0x3ad5('0x39')](_0xde030c[_0x3ad5('0x2e')],_0x18424f[_0x3ad5('0x2f')]));if(_0xde030c[_0x3ad5('0x2e')][_0x3ad5('0x3a')]){_0x15bf13[_0x3ad5('0x38')]=_[_0x3ad5('0x3b')](_0x15bf13[_0x3ad5('0x38')],{'$or':_[_0x3ad5('0x29')](_0x15bf13[_0x3ad5('0x31')],function(_0x220335){var _0x6dd459={};_0x6dd459[_0x220335]={'$like':'%'+_0xde030c[_0x3ad5('0x2e')][_0x3ad5('0x3a')]+'%'};return _0x6dd459;})});}_0x15bf13=_[_0x3ad5('0x3b')]({},_0x15bf13,_0xde030c[_0x3ad5('0x3e')]);return _0x259ada['getSubjects'](_0x15bf13);}})[_0x3ad5('0x26')](function(_0x2b427){if(_0x2b427){_0x57ba6a=_0x2b427['length'];if(!_0xde030c[_0x3ad5('0x2e')][_0x3ad5('0x34')](_0x3ad5('0x4e'))){_0x15bf13[_0x3ad5('0x35')]=qs[_0x3ad5('0x35')](_0xde030c['query'][_0x3ad5('0x35')]);_0x15bf13['offset']=qs['offset'](_0xde030c[_0x3ad5('0x2e')]['offset']);}return _0x259ada[_0x3ad5('0x4f')](_0x15bf13);}})['then'](function(_0x4fb098){if(_0x4fb098){return _0x4fb098?{'count':_0x57ba6a,'rows':_0x4fb098}:null;}})[_0x3ad5('0x26')](respondWithResult(_0x3121d1,null))[_0x3ad5('0x46')](handleError(_0x3121d1,null));};exports[_0x3ad5('0x50')]=function(_0x19f5af,_0x48a3eb,_0x5cc738){var _0x4603b8={};var _0x2ef921={};var _0x246abe;var _0x2722a9;return db['VtigerConfiguration'][_0x3ad5('0x4c')]({'where':{'id':_0x19f5af[_0x3ad5('0x49')]['id']}})[_0x3ad5('0x26')](handleEntityNotFound(_0x48a3eb,null))[_0x3ad5('0x26')](function(_0x158d8d){if(_0x158d8d){_0x246abe=_0x158d8d;_0x2ef921[_0x3ad5('0x2d')]=_[_0x3ad5('0x44')](db['VtigerField']['rawAttributes']);_0x2ef921[_0x3ad5('0x2e')]=_['keys'](_0x19f5af['query']);_0x2ef921['filters']=_['intersection'](_0x2ef921[_0x3ad5('0x2d')],_0x2ef921[_0x3ad5('0x2e')]);_0x4603b8[_0x3ad5('0x31')]=_[_0x3ad5('0x30')](_0x2ef921[_0x3ad5('0x2d')],qs[_0x3ad5('0x32')](_0x19f5af[_0x3ad5('0x2e')][_0x3ad5('0x32')]));_0x4603b8[_0x3ad5('0x31')]=_0x4603b8['attributes'][_0x3ad5('0x33')]?_0x4603b8[_0x3ad5('0x31')]:_0x2ef921[_0x3ad5('0x2d')];_0x4603b8[_0x3ad5('0x36')]=qs[_0x3ad5('0x37')](_0x19f5af[_0x3ad5('0x2e')][_0x3ad5('0x37')]);_0x4603b8[_0x3ad5('0x38')]=qs[_0x3ad5('0x2f')](_['pick'](_0x19f5af[_0x3ad5('0x2e')],_0x2ef921['filters']));if(_0x19f5af[_0x3ad5('0x2e')][_0x3ad5('0x3a')]){_0x4603b8[_0x3ad5('0x38')]=_[_0x3ad5('0x3b')](_0x4603b8[_0x3ad5('0x38')],{'$or':_['map'](_0x4603b8['attributes'],function(_0x37f98c){var _0x2c4d30={};_0x2c4d30[_0x37f98c]={'$like':'%'+_0x19f5af[_0x3ad5('0x2e')][_0x3ad5('0x3a')]+'%'};return _0x2c4d30;})});}_0x4603b8=_['merge']({},_0x4603b8,_0x19f5af[_0x3ad5('0x3e')]);return _0x246abe[_0x3ad5('0x50')](_0x4603b8);}})['then'](function(_0x1811ee){if(_0x1811ee){_0x2722a9=_0x1811ee[_0x3ad5('0x33')];if(!_0x19f5af[_0x3ad5('0x2e')]['hasOwnProperty'](_0x3ad5('0x4e'))){_0x4603b8['limit']=qs[_0x3ad5('0x35')](_0x19f5af[_0x3ad5('0x2e')][_0x3ad5('0x35')]);_0x4603b8['offset']=qs['offset'](_0x19f5af[_0x3ad5('0x2e')][_0x3ad5('0x1e')]);}return _0x246abe['getDescriptions'](_0x4603b8);}})['then'](function(_0x3a70c9){if(_0x3a70c9){return _0x3a70c9?{'count':_0x2722a9,'rows':_0x3a70c9}:null;}})[_0x3ad5('0x26')](respondWithResult(_0x48a3eb,null))[_0x3ad5('0x46')](handleError(_0x48a3eb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 721178d..35b5960 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 _0x810c=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x810c,0x116));var _0xc810=function(_0x5bffd7,_0x1ac4f4){_0x5bffd7=_0x5bffd7-0x0;var _0x48e5dd=_0x810c[_0x5bffd7];return _0x48e5dd;};'use strict';var _=require(_0xc810('0x0'));var util=require(_0xc810('0x1'));var logger=require(_0xc810('0x2'))(_0xc810('0x3'));var moment=require(_0xc810('0x4'));var BPromise=require('bluebird');var rp=require(_0xc810('0x5'));var fs=require('fs');var path=require(_0xc810('0x6'));var rimraf=require(_0xc810('0x7'));var config=require(_0xc810('0x8'));var attributes=require(_0xc810('0x9'));module[_0xc810('0xa')]=function(_0x5ae50f,_0x61b8d1){return _0x5ae50f[_0xc810('0xb')](_0xc810('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc440=['define','int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x2b7c61,_0x5d8d5b){var _0x127d9d=function(_0xcefacb){while(--_0xcefacb){_0x2b7c61['push'](_0x2b7c61['shift']());}};_0x127d9d(++_0x5d8d5b);}(_0xc440,0x9e));var _0x0c44=function(_0x23d77a,_0x5c651b){_0x23d77a=_0x23d77a-0x0;var _0xffcbc5=_0xc440[_0x23d77a];return _0xffcbc5;};'use strict';var _=require(_0x0c44('0x0'));var util=require('util');var logger=require(_0x0c44('0x1'))(_0x0c44('0x2'));var moment=require(_0x0c44('0x3'));var BPromise=require(_0x0c44('0x4'));var rp=require(_0x0c44('0x5'));var fs=require('fs');var path=require(_0x0c44('0x6'));var rimraf=require(_0x0c44('0x7'));var config=require(_0x0c44('0x8'));var attributes=require(_0x0c44('0x9'));module[_0x0c44('0xa')]=function(_0x29041d,_0x1a0c81){return _0x29041d[_0x0c44('0xb')]('VtigerConfiguration',attributes,{'tableName':_0x0c44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 3741f44..0675417 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 _0x9670=['then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9670,0x1e7));var _0x0967=function(_0x4fce2c,_0x56f9e2){_0x4fce2c=_0x4fce2c-0x0;var _0x3ebea7=_0x9670[_0x4fce2c];return _0x3ebea7;};'use strict';var _=require(_0x0967('0x0'));var util=require(_0x0967('0x1'));var moment=require(_0x0967('0x2'));var BPromise=require(_0x0967('0x3'));var rs=require(_0x0967('0x4'));var fs=require('fs');var Redis=require(_0x0967('0x5'));var db=require(_0x0967('0x6'))['db'];var utils=require(_0x0967('0x7'));var logger=require(_0x0967('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0967('0x9'));var client=jayson[_0x0967('0xa')][_0x0967('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15a2d5,_0x627ddd,_0x12572e){return new BPromise(function(_0x4e77a1,_0x1cb6c8){return client[_0x0967('0xc')](_0x15a2d5,_0x12572e)[_0x0967('0xd')](function(_0x5592b6){logger[_0x0967('0xe')](_0x0967('0xf'),_0x627ddd,_0x0967('0x10'));logger[_0x0967('0x11')](_0x0967('0x12'),_0x627ddd,_0x0967('0x10'),JSON[_0x0967('0x13')](_0x5592b6));if(_0x5592b6['error']){if(_0x5592b6['error'][_0x0967('0x14')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x627ddd,_0x5592b6[_0x0967('0x15')][_0x0967('0x16')]);return _0x1cb6c8(_0x5592b6[_0x0967('0x15')][_0x0967('0x16')]);}logger[_0x0967('0x15')]('VtigerConfiguration,\x20%s,\x20%s',_0x627ddd,_0x5592b6['error'][_0x0967('0x16')]);return _0x4e77a1(_0x5592b6[_0x0967('0x15')][_0x0967('0x16')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x627ddd,_0x0967('0x10'));_0x4e77a1(_0x5592b6[_0x0967('0x17')]['message']);}})[_0x0967('0x18')](function(_0x1c9112){logger['error'](_0x0967('0xf'),_0x627ddd,_0x1c9112);_0x1cb6c8(_0x1c9112);});});} \ No newline at end of file +var _0x47b2=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x47b2,0x111));var _0x247b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x247b('0x0'));var util=require(_0x247b('0x1'));var moment=require(_0x247b('0x2'));var BPromise=require(_0x247b('0x3'));var rs=require(_0x247b('0x4'));var fs=require('fs');var Redis=require(_0x247b('0x5'));var db=require(_0x247b('0x6'))['db'];var utils=require(_0x247b('0x7'));var logger=require(_0x247b('0x8'))(_0x247b('0x9'));var config=require(_0x247b('0xa'));var jayson=require(_0x247b('0xb'));var client=jayson[_0x247b('0xc')][_0x247b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4d6145,_0x15bdf3,_0x283f88){return new BPromise(function(_0x1cb04f,_0x3577d4){return client[_0x247b('0xe')](_0x4d6145,_0x283f88)['then'](function(_0x4bf273){logger[_0x247b('0xf')](_0x247b('0x10'),_0x15bdf3,_0x247b('0x11'));logger[_0x247b('0x12')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x15bdf3,_0x247b('0x11'),JSON['stringify'](_0x4bf273));if(_0x4bf273[_0x247b('0x13')]){if(_0x4bf273['error'][_0x247b('0x14')]===0x1f4){logger[_0x247b('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x15bdf3,_0x4bf273[_0x247b('0x13')][_0x247b('0x15')]);return _0x3577d4(_0x4bf273[_0x247b('0x13')][_0x247b('0x15')]);}logger[_0x247b('0x13')](_0x247b('0x10'),_0x15bdf3,_0x4bf273[_0x247b('0x13')]['message']);return _0x1cb04f(_0x4bf273[_0x247b('0x13')][_0x247b('0x15')]);}else{logger[_0x247b('0xf')](_0x247b('0x10'),_0x15bdf3,_0x247b('0x11'));_0x1cb04f(_0x4bf273[_0x247b('0x16')][_0x247b('0x15')]);}})[_0x247b('0x17')](function(_0x118df6){logger[_0x247b('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x15bdf3,_0x118df6);_0x3577d4(_0x118df6);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5097f5a..d72fd5c 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 _0xc579=['multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xc579,0xf7));var _0x9c57=function(_0xd26501,_0x22c758){_0xd26501=_0xd26501-0x0;var _0x5e8a92=_0xc579[_0xd26501];return _0x5e8a92;};'use strict';var multer=require(_0x9c57('0x0'));var util=require(_0x9c57('0x1'));var path=require(_0x9c57('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9c57('0x3'));var auth=require(_0x9c57('0x4'));var interaction=require(_0x9c57('0x5'));var config=require(_0x9c57('0x6'));var controller=require(_0x9c57('0x7'));router[_0x9c57('0x8')]('/',auth[_0x9c57('0x9')](),controller['index']);router[_0x9c57('0x8')](_0x9c57('0xa'),auth[_0x9c57('0x9')](),controller[_0x9c57('0xb')]);router[_0x9c57('0xc')]('/',auth['isAuthenticated'](),controller[_0x9c57('0xd')]);router[_0x9c57('0xe')](_0x9c57('0xa'),auth[_0x9c57('0x9')](),controller[_0x9c57('0xf')]);router[_0x9c57('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9c57('0x11')]);module[_0x9c57('0x12')]=router; \ No newline at end of file +var _0x9dd0=['get','index','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','./intVtigerField.controller'];(function(_0xebd1b6,_0xddbad6){var _0x126016=function(_0x4b7e34){while(--_0x4b7e34){_0xebd1b6['push'](_0xebd1b6['shift']());}};_0x126016(++_0xddbad6);}(_0x9dd0,0x6a));var _0x09dd=function(_0x479c7f,_0x420811){_0x479c7f=_0x479c7f-0x0;var _0xcf7508=_0x9dd0[_0x479c7f];return _0xcf7508;};'use strict';var multer=require(_0x09dd('0x0'));var util=require(_0x09dd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09dd('0x2'));var router=express[_0x09dd('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x09dd('0x4'));var config=require('../../config/environment');var controller=require(_0x09dd('0x5'));router[_0x09dd('0x6')]('/',auth['isAuthenticated'](),controller[_0x09dd('0x7')]);router[_0x09dd('0x6')](_0x09dd('0x8'),auth[_0x09dd('0x9')](),controller[_0x09dd('0xa')]);router[_0x09dd('0xb')]('/',auth[_0x09dd('0x9')](),controller[_0x09dd('0xc')]);router['put'](_0x09dd('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x09dd('0xd')](_0x09dd('0x8'),auth[_0x09dd('0x9')](),controller[_0x09dd('0xe')]);module[_0x09dd('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3d6f97b..1d1b194 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 _0x3228=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x2e0cfa,_0x552437){var _0x1df60b=function(_0x4e7bf2){while(--_0x4e7bf2){_0x2e0cfa['push'](_0x2e0cfa['shift']());}};_0x1df60b(++_0x552437);}(_0x3228,0x12e));var _0x8322=function(_0x2f9924,_0x1ac81e){_0x2f9924=_0x2f9924-0x0;var _0x454a40=_0x3228[_0x2f9924];return _0x454a40;};'use strict';var Sequelize=require(_0x8322('0x0'));module[_0x8322('0x1')]={'type':{'type':Sequelize[_0x8322('0x2')](_0x8322('0x3'),_0x8322('0x4'),_0x8322('0x5'),_0x8322('0x6'),_0x8322('0x7')),'defaultValue':_0x8322('0x3')},'content':{'type':Sequelize[_0x8322('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8322('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x8322('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8322('0x8')]},'customField':{'type':Sequelize[_0x8322('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8322('0x8')]}}; \ No newline at end of file +var _0x3095=['keyValue','picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x396836,_0x396ec1){var _0x8c5477=function(_0x1e38f1){while(--_0x1e38f1){_0x396836['push'](_0x396836['shift']());}};_0x8c5477(++_0x396ec1);}(_0x3095,0x153));var _0x5309=function(_0x1024ca,_0x2562fe){_0x1024ca=_0x1024ca-0x0;var _0x390f5c=_0x3095[_0x1024ca];return _0x390f5c;};'use strict';var Sequelize=require(_0x5309('0x0'));module['exports']={'type':{'type':Sequelize[_0x5309('0x1')](_0x5309('0x2'),_0x5309('0x3'),_0x5309('0x4'),_0x5309('0x5'),_0x5309('0x6')),'defaultValue':_0x5309('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x5309('0x2'),'variable',_0x5309('0x4'))},'keyContent':{'type':Sequelize[_0x5309('0x7')]},'idField':{'type':Sequelize[_0x5309('0x7')]},'nameField':{'type':Sequelize[_0x5309('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5309('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index c64745d..a1b4779 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 _0x0e88=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','params','options','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x949ea5,_0x47be0d){var _0xc8993e=function(_0xdb1384){while(--_0xdb1384){_0x949ea5['push'](_0x949ea5['shift']());}};_0xc8993e(++_0x47be0d);}(_0x0e88,0x151));var _0x80e8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0e88[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x80e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x80e8('0x1'));var jsonpatch=require(_0x80e8('0x2'));var rp=require(_0x80e8('0x3'));var moment=require('moment');var BPromise=require(_0x80e8('0x4'));var Mustache=require(_0x80e8('0x5'));var util=require(_0x80e8('0x6'));var path=require(_0x80e8('0x7'));var sox=require(_0x80e8('0x8'));var csv=require('to-csv');var ejs=require(_0x80e8('0x9'));var fs=require('fs');var fs_extra=require(_0x80e8('0xa'));var _=require('lodash');var squel=require(_0x80e8('0xb'));var crypto=require(_0x80e8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x80e8('0xd'));var toCsv=require(_0x80e8('0xe'));var querystring=require('querystring');var Papa=require(_0x80e8('0xf'));var Redis=require(_0x80e8('0x10'));var authService=require(_0x80e8('0x11'));var qs=require(_0x80e8('0x12'));var as=require(_0x80e8('0x13'));var hardwareService=require(_0x80e8('0x14'));var logger=require(_0x80e8('0x15'))(_0x80e8('0x16'));var utils=require(_0x80e8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x80e8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x336b5e,_0x1ce147){_0x1ce147=_0x1ce147||0xcc;return function(_0x4d760b){if(_0x4d760b){return _0x336b5e[_0x80e8('0x19')](_0x1ce147);}return _0x336b5e[_0x80e8('0x1a')](_0x1ce147)[_0x80e8('0x1b')]();};}function respondWithResult(_0x1930f2,_0x34ac31){_0x34ac31=_0x34ac31||0xc8;return function(_0x3652f9){if(_0x3652f9){return _0x1930f2[_0x80e8('0x1a')](_0x34ac31)[_0x80e8('0x1c')](_0x3652f9);}};}function respondWithFilteredResult(_0x281f67,_0xa72a37){return function(_0x131fa0){if(_0x131fa0){var _0x385710=typeof _0xa72a37[_0x80e8('0x1d')]==='undefined'&&typeof _0xa72a37[_0x80e8('0x1e')]===_0x80e8('0x1f');var _0x5cd034=_0x131fa0[_0x80e8('0x20')];var _0x2f1dfb=_0x385710?0x0:_0xa72a37[_0x80e8('0x1d')];var _0x53e9c4=_0x385710?_0x131fa0['count']:_0xa72a37[_0x80e8('0x1d')]+_0xa72a37['limit'];var _0x591843;if(_0x53e9c4>=_0x5cd034){_0x53e9c4=_0x5cd034;_0x591843=0xc8;}else{_0x591843=0xce;}_0x281f67[_0x80e8('0x1a')](_0x591843);return _0x281f67[_0x80e8('0x21')](_0x80e8('0x22'),_0x2f1dfb+'-'+_0x53e9c4+'/'+_0x5cd034)[_0x80e8('0x1c')](_0x131fa0);}return null;};}function patchUpdates(_0xbfc005){return function(_0x54c771){try{jsonpatch[_0x80e8('0x23')](_0x54c771,_0xbfc005,!![]);}catch(_0x1bf3e8){return BPromise['reject'](_0x1bf3e8);}return _0x54c771['save']();};}function saveUpdates(_0x171ae7,_0x3a44b5){return function(_0x39166b){if(_0x39166b){return _0x39166b[_0x80e8('0x24')](_0x171ae7)[_0x80e8('0x25')](function(_0x456d26){return _0x456d26;});}return null;};}function removeEntity(_0x2cbd5e,_0x5bea60){return function(_0x4c3847){if(_0x4c3847){return _0x4c3847['destroy']()[_0x80e8('0x25')](function(){_0x2cbd5e['status'](0xcc)[_0x80e8('0x1b')]();});}};}function handleEntityNotFound(_0x20bfa3,_0x121e37){return function(_0x5a77e0){if(!_0x5a77e0){_0x20bfa3[_0x80e8('0x19')](0x194);}return _0x5a77e0;};}function handleError(_0x1a446d,_0x1a2110){_0x1a2110=_0x1a2110||0x1f4;return function(_0x3d9978){logger['error'](_0x3d9978[_0x80e8('0x26')]);if(_0x3d9978[_0x80e8('0x27')]){delete _0x3d9978[_0x80e8('0x27')];}_0x1a446d[_0x80e8('0x1a')](_0x1a2110)[_0x80e8('0x28')](_0x3d9978);};}exports[_0x80e8('0x29')]=function(_0x4cf673,_0x1e7ef0){var _0x3baf6c={},_0x4bdaac={},_0x4fff9b={'count':0x0,'rows':[]};var _0x2a7c76=_[_0x80e8('0x2a')](db[_0x80e8('0x2b')][_0x80e8('0x2c')],function(_0x1ddd7c){return{'name':_0x1ddd7c['fieldName'],'type':_0x1ddd7c[_0x80e8('0x2d')][_0x80e8('0x2e')]};});_0x4bdaac[_0x80e8('0x2f')]=_[_0x80e8('0x2a')](_0x2a7c76,_0x80e8('0x27'));_0x4bdaac['query']=_[_0x80e8('0x30')](_0x4cf673['query']);_0x4bdaac[_0x80e8('0x31')]=_[_0x80e8('0x32')](_0x4bdaac[_0x80e8('0x2f')],_0x4bdaac['query']);_0x3baf6c[_0x80e8('0x33')]=_[_0x80e8('0x32')](_0x4bdaac[_0x80e8('0x2f')],qs[_0x80e8('0x34')](_0x4cf673[_0x80e8('0x35')]['fields']));_0x3baf6c[_0x80e8('0x33')]=_0x3baf6c[_0x80e8('0x33')]['length']?_0x3baf6c[_0x80e8('0x33')]:_0x4bdaac[_0x80e8('0x2f')];if(!_0x4cf673[_0x80e8('0x35')][_0x80e8('0x36')](_0x80e8('0x37'))){_0x3baf6c[_0x80e8('0x1e')]=qs['limit'](_0x4cf673[_0x80e8('0x35')][_0x80e8('0x1e')]);_0x3baf6c['offset']=qs[_0x80e8('0x1d')](_0x4cf673[_0x80e8('0x35')][_0x80e8('0x1d')]);}_0x3baf6c[_0x80e8('0x38')]=qs[_0x80e8('0x39')](_0x4cf673['query'][_0x80e8('0x39')]);_0x3baf6c[_0x80e8('0x3a')]=qs[_0x80e8('0x31')](_[_0x80e8('0x3b')](_0x4cf673[_0x80e8('0x35')],_0x4bdaac[_0x80e8('0x31')]),_0x2a7c76);if(_0x4cf673[_0x80e8('0x35')]['filter']){_0x3baf6c[_0x80e8('0x3a')]=_[_0x80e8('0x3c')](_0x3baf6c['where'],{'$or':_[_0x80e8('0x2a')](_0x2a7c76,function(_0x2dcf5a){if(_0x2dcf5a[_0x80e8('0x2d')]!=='VIRTUAL'){var _0x1ddf33={};_0x1ddf33[_0x2dcf5a[_0x80e8('0x27')]]={'$like':'%'+_0x4cf673['query'][_0x80e8('0x3d')]+'%'};return _0x1ddf33;}})});}_0x3baf6c=_[_0x80e8('0x3c')]({},_0x3baf6c,_0x4cf673['options']);var _0x2fddb5={'where':_0x3baf6c[_0x80e8('0x3a')]};return db[_0x80e8('0x2b')][_0x80e8('0x20')](_0x2fddb5)['then'](function(_0x30c2d9){_0x4fff9b[_0x80e8('0x20')]=_0x30c2d9;if(_0x4cf673[_0x80e8('0x35')][_0x80e8('0x3e')]){_0x3baf6c[_0x80e8('0x3f')]=[{'all':!![]}];}return db[_0x80e8('0x2b')][_0x80e8('0x40')](_0x3baf6c);})[_0x80e8('0x25')](function(_0x28decf){_0x4fff9b[_0x80e8('0x41')]=_0x28decf;return _0x4fff9b;})[_0x80e8('0x25')](respondWithFilteredResult(_0x1e7ef0,_0x3baf6c))[_0x80e8('0x42')](handleError(_0x1e7ef0,null));};exports['show']=function(_0x1522ca,_0xe9ca3e){var _0x3c0bb6={'raw':!![],'where':{'id':_0x1522ca[_0x80e8('0x43')]['id']}},_0x284513={};_0x284513[_0x80e8('0x2f')]=_[_0x80e8('0x30')](db[_0x80e8('0x2b')]['rawAttributes']);_0x284513[_0x80e8('0x35')]=_[_0x80e8('0x30')](_0x1522ca[_0x80e8('0x35')]);_0x284513['filters']=_[_0x80e8('0x32')](_0x284513[_0x80e8('0x2f')],_0x284513[_0x80e8('0x35')]);_0x3c0bb6[_0x80e8('0x33')]=_[_0x80e8('0x32')](_0x284513[_0x80e8('0x2f')],qs['fields'](_0x1522ca['query'][_0x80e8('0x34')]));_0x3c0bb6['attributes']=_0x3c0bb6[_0x80e8('0x33')]['length']?_0x3c0bb6['attributes']:_0x284513[_0x80e8('0x2f')];if(_0x1522ca[_0x80e8('0x35')][_0x80e8('0x3e')]){_0x3c0bb6[_0x80e8('0x3f')]=[{'all':!![]}];}_0x3c0bb6=_[_0x80e8('0x3c')]({},_0x3c0bb6,_0x1522ca[_0x80e8('0x44')]);return db[_0x80e8('0x2b')]['find'](_0x3c0bb6)[_0x80e8('0x25')](handleEntityNotFound(_0xe9ca3e,null))['then'](respondWithResult(_0xe9ca3e,null))[_0x80e8('0x42')](handleError(_0xe9ca3e,null));};exports[_0x80e8('0x45')]=function(_0x4c32b3,_0x415c77){return db['VtigerField']['create'](_0x4c32b3[_0x80e8('0x46')],{})[_0x80e8('0x25')](respondWithResult(_0x415c77,0xc9))['catch'](handleError(_0x415c77,null));};exports[_0x80e8('0x24')]=function(_0x25ee23,_0x3c7876){if(_0x25ee23['body']['id']){delete _0x25ee23[_0x80e8('0x46')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x25ee23[_0x80e8('0x43')]['id']}})[_0x80e8('0x25')](handleEntityNotFound(_0x3c7876,null))[_0x80e8('0x25')](saveUpdates(_0x25ee23[_0x80e8('0x46')],null))['then'](respondWithResult(_0x3c7876,null))[_0x80e8('0x42')](handleError(_0x3c7876,null));};exports[_0x80e8('0x47')]=function(_0xe74b36,_0x4f5e9c){return db[_0x80e8('0x2b')]['find']({'where':{'id':_0xe74b36['params']['id']}})[_0x80e8('0x25')](handleEntityNotFound(_0x4f5e9c,null))['then'](removeEntity(_0x4f5e9c,null))[_0x80e8('0x42')](handleError(_0x4f5e9c,null));}; \ No newline at end of file +var _0xfd45=['crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','json','apply','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','VIRTUAL','options','VtigerField','includeAll','findAll','rows','catch','params','keys','length','merge','create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0xc0374e,_0x2de1fc){var _0x3cabe1=function(_0x2cfcae){while(--_0x2cfcae){_0xc0374e['push'](_0xc0374e['shift']());}};_0x3cabe1(++_0x2de1fc);}(_0xfd45,0x156));var _0x5fd4=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xfd45[_0x1da04e];return _0xdd8c41;};'use strict';var emlformat=require(_0x5fd4('0x0'));var rimraf=require(_0x5fd4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fd4('0x2'));var rp=require(_0x5fd4('0x3'));var moment=require(_0x5fd4('0x4'));var BPromise=require(_0x5fd4('0x5'));var Mustache=require(_0x5fd4('0x6'));var util=require(_0x5fd4('0x7'));var path=require(_0x5fd4('0x8'));var sox=require(_0x5fd4('0x9'));var csv=require(_0x5fd4('0xa'));var ejs=require(_0x5fd4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fd4('0xc'));var squel=require('squel');var crypto=require(_0x5fd4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5fd4('0xe'));var toCsv=require(_0x5fd4('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5fd4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5fd4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fd4('0x11'));var logger=require('../../config/logger')(_0x5fd4('0x12'));var utils=require(_0x5fd4('0x13'));var config=require(_0x5fd4('0x14'));var licenseUtil=require(_0x5fd4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2739a6,_0x52fa31){_0x52fa31=_0x52fa31||0xcc;return function(_0x54ebaf){if(_0x54ebaf){return _0x2739a6[_0x5fd4('0x16')](_0x52fa31);}return _0x2739a6[_0x5fd4('0x17')](_0x52fa31)[_0x5fd4('0x18')]();};}function respondWithResult(_0x2f8488,_0x588b77){_0x588b77=_0x588b77||0xc8;return function(_0x230e5e){if(_0x230e5e){return _0x2f8488['status'](_0x588b77)['json'](_0x230e5e);}};}function respondWithFilteredResult(_0x1a4269,_0x1b6470){return function(_0xd93780){if(_0xd93780){var _0x500110=typeof _0x1b6470[_0x5fd4('0x19')]===_0x5fd4('0x1a')&&typeof _0x1b6470['limit']===_0x5fd4('0x1a');var _0x37362e=_0xd93780[_0x5fd4('0x1b')];var _0x4f1e72=_0x500110?0x0:_0x1b6470[_0x5fd4('0x19')];var _0x4b3eca=_0x500110?_0xd93780['count']:_0x1b6470[_0x5fd4('0x19')]+_0x1b6470['limit'];var _0x31b1c8;if(_0x4b3eca>=_0x37362e){_0x4b3eca=_0x37362e;_0x31b1c8=0xc8;}else{_0x31b1c8=0xce;}_0x1a4269['status'](_0x31b1c8);return _0x1a4269[_0x5fd4('0x1c')]('Content-Range',_0x4f1e72+'-'+_0x4b3eca+'/'+_0x37362e)[_0x5fd4('0x1d')](_0xd93780);}return null;};}function patchUpdates(_0x44c597){return function(_0x29c9ae){try{jsonpatch[_0x5fd4('0x1e')](_0x29c9ae,_0x44c597,!![]);}catch(_0x3e7fd2){return BPromise['reject'](_0x3e7fd2);}return _0x29c9ae[_0x5fd4('0x1f')]();};}function saveUpdates(_0x4c6e1f,_0x149eab){return function(_0x40ce24){if(_0x40ce24){return _0x40ce24[_0x5fd4('0x20')](_0x4c6e1f)[_0x5fd4('0x21')](function(_0x2e71ad){return _0x2e71ad;});}return null;};}function removeEntity(_0x48e017,_0x473d07){return function(_0x48a75b){if(_0x48a75b){return _0x48a75b['destroy']()['then'](function(){_0x48e017[_0x5fd4('0x17')](0xcc)[_0x5fd4('0x18')]();});}};}function handleEntityNotFound(_0xde6714,_0x1e1af5){return function(_0x48a387){if(!_0x48a387){_0xde6714[_0x5fd4('0x16')](0x194);}return _0x48a387;};}function handleError(_0x526df0,_0x5cab07){_0x5cab07=_0x5cab07||0x1f4;return function(_0xeae3d9){logger[_0x5fd4('0x22')](_0xeae3d9[_0x5fd4('0x23')]);if(_0xeae3d9[_0x5fd4('0x24')]){delete _0xeae3d9[_0x5fd4('0x24')];}_0x526df0[_0x5fd4('0x17')](_0x5cab07)['send'](_0xeae3d9);};}exports[_0x5fd4('0x25')]=function(_0x1049b8,_0x5c961f){var _0x35ace0={},_0x138a97={},_0x4fdd3e={'count':0x0,'rows':[]};var _0x3d7699=_[_0x5fd4('0x26')](db['VtigerField'][_0x5fd4('0x27')],function(_0x50215c){return{'name':_0x50215c[_0x5fd4('0x28')],'type':_0x50215c[_0x5fd4('0x29')]['key']};});_0x138a97[_0x5fd4('0x2a')]=_[_0x5fd4('0x26')](_0x3d7699,_0x5fd4('0x24'));_0x138a97['query']=_['keys'](_0x1049b8[_0x5fd4('0x2b')]);_0x138a97['filters']=_['intersection'](_0x138a97[_0x5fd4('0x2a')],_0x138a97[_0x5fd4('0x2b')]);_0x35ace0[_0x5fd4('0x2c')]=_[_0x5fd4('0x2d')](_0x138a97['model'],qs['fields'](_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x2e')]));_0x35ace0['attributes']=_0x35ace0[_0x5fd4('0x2c')]['length']?_0x35ace0[_0x5fd4('0x2c')]:_0x138a97[_0x5fd4('0x2a')];if(!_0x1049b8['query'][_0x5fd4('0x2f')](_0x5fd4('0x30'))){_0x35ace0[_0x5fd4('0x31')]=qs[_0x5fd4('0x31')](_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x31')]);_0x35ace0['offset']=qs[_0x5fd4('0x19')](_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x19')]);}_0x35ace0[_0x5fd4('0x32')]=qs[_0x5fd4('0x33')](_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x33')]);_0x35ace0['where']=qs[_0x5fd4('0x34')](_[_0x5fd4('0x35')](_0x1049b8[_0x5fd4('0x2b')],_0x138a97[_0x5fd4('0x34')]),_0x3d7699);if(_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x36')]){_0x35ace0[_0x5fd4('0x37')]=_['merge'](_0x35ace0[_0x5fd4('0x37')],{'$or':_[_0x5fd4('0x26')](_0x3d7699,function(_0x2cf57f){if(_0x2cf57f['type']!==_0x5fd4('0x38')){var _0x3a8042={};_0x3a8042[_0x2cf57f[_0x5fd4('0x24')]]={'$like':'%'+_0x1049b8[_0x5fd4('0x2b')]['filter']+'%'};return _0x3a8042;}})});}_0x35ace0=_['merge']({},_0x35ace0,_0x1049b8[_0x5fd4('0x39')]);var _0x414176={'where':_0x35ace0['where']};return db[_0x5fd4('0x3a')][_0x5fd4('0x1b')](_0x414176)[_0x5fd4('0x21')](function(_0x5ac00a){_0x4fdd3e['count']=_0x5ac00a;if(_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x3b')]){_0x35ace0['include']=[{'all':!![]}];}return db['VtigerField'][_0x5fd4('0x3c')](_0x35ace0);})[_0x5fd4('0x21')](function(_0x1992d9){_0x4fdd3e[_0x5fd4('0x3d')]=_0x1992d9;return _0x4fdd3e;})[_0x5fd4('0x21')](respondWithFilteredResult(_0x5c961f,_0x35ace0))[_0x5fd4('0x3e')](handleError(_0x5c961f,null));};exports['show']=function(_0x32276d,_0x50a1f2){var _0x53ec27={'raw':!![],'where':{'id':_0x32276d[_0x5fd4('0x3f')]['id']}},_0x4b6c13={};_0x4b6c13[_0x5fd4('0x2a')]=_[_0x5fd4('0x40')](db[_0x5fd4('0x3a')][_0x5fd4('0x27')]);_0x4b6c13['query']=_['keys'](_0x32276d[_0x5fd4('0x2b')]);_0x4b6c13['filters']=_[_0x5fd4('0x2d')](_0x4b6c13['model'],_0x4b6c13['query']);_0x53ec27[_0x5fd4('0x2c')]=_[_0x5fd4('0x2d')](_0x4b6c13['model'],qs[_0x5fd4('0x2e')](_0x32276d[_0x5fd4('0x2b')][_0x5fd4('0x2e')]));_0x53ec27[_0x5fd4('0x2c')]=_0x53ec27[_0x5fd4('0x2c')][_0x5fd4('0x41')]?_0x53ec27[_0x5fd4('0x2c')]:_0x4b6c13[_0x5fd4('0x2a')];if(_0x32276d[_0x5fd4('0x2b')][_0x5fd4('0x3b')]){_0x53ec27['include']=[{'all':!![]}];}_0x53ec27=_[_0x5fd4('0x42')]({},_0x53ec27,_0x32276d['options']);return db['VtigerField']['find'](_0x53ec27)[_0x5fd4('0x21')](handleEntityNotFound(_0x50a1f2,null))[_0x5fd4('0x21')](respondWithResult(_0x50a1f2,null))[_0x5fd4('0x3e')](handleError(_0x50a1f2,null));};exports[_0x5fd4('0x43')]=function(_0x2dbb29,_0x39aeb5){return db[_0x5fd4('0x3a')]['create'](_0x2dbb29[_0x5fd4('0x44')],{})[_0x5fd4('0x21')](respondWithResult(_0x39aeb5,0xc9))[_0x5fd4('0x3e')](handleError(_0x39aeb5,null));};exports['update']=function(_0x57b243,_0x445e7a){if(_0x57b243[_0x5fd4('0x44')]['id']){delete _0x57b243[_0x5fd4('0x44')]['id'];}return db['VtigerField'][_0x5fd4('0x45')]({'where':{'id':_0x57b243[_0x5fd4('0x3f')]['id']}})[_0x5fd4('0x21')](handleEntityNotFound(_0x445e7a,null))['then'](saveUpdates(_0x57b243['body'],null))[_0x5fd4('0x21')](respondWithResult(_0x445e7a,null))['catch'](handleError(_0x445e7a,null));};exports[_0x5fd4('0x46')]=function(_0x2dd149,_0x4937a){return db['VtigerField'][_0x5fd4('0x45')]({'where':{'id':_0x2dd149[_0x5fd4('0x3f')]['id']}})[_0x5fd4('0x21')](handleEntityNotFound(_0x4937a,null))['then'](removeEntity(_0x4937a,null))['catch'](handleError(_0x4937a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index bd39ff5..717914a 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 _0xd0c9=['bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','vtiger_unique_index','idField','util','../../config/logger','api'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xd0c9,0x14d));var _0x9d0c=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xd0c9[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require('lodash');var util=require(_0x9d0c('0x0'));var logger=require(_0x9d0c('0x1'))(_0x9d0c('0x2'));var moment=require('moment');var BPromise=require(_0x9d0c('0x3'));var rp=require(_0x9d0c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d0c('0x5'));var config=require(_0x9d0c('0x6'));var attributes=require(_0x9d0c('0x7'));module['exports']=function(_0x1cd4f7,_0x46cd30){return _0x1cd4f7[_0x9d0c('0x8')](_0x9d0c('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x9d0c('0xa'),'fields':[_0x9d0c('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79d9=['define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','./intVtigerField.attributes'];(function(_0x5f0ec9,_0xa394f0){var _0x4909b6=function(_0x3f8354){while(--_0x3f8354){_0x5f0ec9['push'](_0x5f0ec9['shift']());}};_0x4909b6(++_0xa394f0);}(_0x79d9,0xaa));var _0x979d=function(_0x4f5b13,_0x4a33bd){_0x4f5b13=_0x4f5b13-0x0;var _0x556ef7=_0x79d9[_0x4f5b13];return _0x556ef7;};'use strict';var _=require(_0x979d('0x0'));var util=require('util');var logger=require(_0x979d('0x1'))(_0x979d('0x2'));var moment=require('moment');var BPromise=require(_0x979d('0x3'));var rp=require(_0x979d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x979d('0x5'));module['exports']=function(_0x1d3ae5,_0x5cb024){return _0x1d3ae5[_0x979d('0x6')](_0x979d('0x7'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x979d('0x8'),'fields':[_0x979d('0x9'),_0x979d('0xa')],'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 4c981a9..116e627 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 _0x29ad=['rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerField,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5ed7c5,_0x466b60){var _0x220229=function(_0x976729){while(--_0x976729){_0x5ed7c5['push'](_0x5ed7c5['shift']());}};_0x220229(++_0x466b60);}(_0x29ad,0x1bf));var _0xd29a=function(_0x14cefa,_0x509c9b){_0x14cefa=_0x14cefa-0x0;var _0x2ddf18=_0x29ad[_0x14cefa];return _0x2ddf18;};'use strict';var _=require(_0xd29a('0x0'));var util=require(_0xd29a('0x1'));var moment=require(_0xd29a('0x2'));var BPromise=require(_0xd29a('0x3'));var rs=require(_0xd29a('0x4'));var fs=require('fs');var Redis=require(_0xd29a('0x5'));var db=require(_0xd29a('0x6'))['db'];var utils=require(_0xd29a('0x7'));var logger=require(_0xd29a('0x8'))(_0xd29a('0x9'));var config=require(_0xd29a('0xa'));var jayson=require(_0xd29a('0xb'));var client=jayson[_0xd29a('0xc')][_0xd29a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x35cb4b,_0x31abf4,_0x425acf){return new BPromise(function(_0x5a83a7,_0xfc8a9b){return client['request'](_0x35cb4b,_0x425acf)[_0xd29a('0xe')](function(_0x26341b){logger[_0xd29a('0xf')]('VtigerField,\x20%s,\x20%s',_0x31abf4,'request\x20sent');logger[_0xd29a('0x10')](_0xd29a('0x11'),_0x31abf4,'request\x20sent',JSON[_0xd29a('0x12')](_0x26341b));if(_0x26341b[_0xd29a('0x13')]){if(_0x26341b[_0xd29a('0x13')][_0xd29a('0x14')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x31abf4,_0x26341b[_0xd29a('0x13')]['message']);return _0xfc8a9b(_0x26341b['error'][_0xd29a('0x15')]);}logger['error'](_0xd29a('0x16'),_0x31abf4,_0x26341b[_0xd29a('0x13')][_0xd29a('0x15')]);return _0x5a83a7(_0x26341b['error'][_0xd29a('0x15')]);}else{logger[_0xd29a('0xf')]('VtigerField,\x20%s,\x20%s',_0x31abf4,'request\x20sent');_0x5a83a7(_0x26341b[_0xd29a('0x17')][_0xd29a('0x15')]);}})['catch'](function(_0x2a685a){logger[_0xd29a('0x13')](_0xd29a('0x16'),_0x31abf4,_0x2a685a);_0xfc8a9b(_0x2a685a);});});} \ No newline at end of file +var _0x0165=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0165,0xde));var _0x5016=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0165[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x5016('0x0'));var util=require(_0x5016('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5016('0x2'));var fs=require('fs');var Redis=require(_0x5016('0x3'));var db=require(_0x5016('0x4'))['db'];var utils=require(_0x5016('0x5'));var logger=require('../../config/logger')(_0x5016('0x6'));var config=require(_0x5016('0x7'));var jayson=require(_0x5016('0x8'));var client=jayson[_0x5016('0x9')][_0x5016('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33a8bb,_0x3076e6,_0x6ed40){return new BPromise(function(_0x27e6c7,_0x42bc41){return client[_0x5016('0xb')](_0x33a8bb,_0x6ed40)[_0x5016('0xc')](function(_0x3b02f8){logger['info'](_0x5016('0xd'),_0x3076e6,_0x5016('0xe'));logger[_0x5016('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3076e6,'request\x20sent',JSON[_0x5016('0x10')](_0x3b02f8));if(_0x3b02f8[_0x5016('0x11')]){if(_0x3b02f8[_0x5016('0x11')][_0x5016('0x12')]===0x1f4){logger['error'](_0x5016('0xd'),_0x3076e6,_0x3b02f8[_0x5016('0x11')][_0x5016('0x13')]);return _0x42bc41(_0x3b02f8[_0x5016('0x11')][_0x5016('0x13')]);}logger['error'](_0x5016('0xd'),_0x3076e6,_0x3b02f8[_0x5016('0x11')]['message']);return _0x27e6c7(_0x3b02f8[_0x5016('0x11')][_0x5016('0x13')]);}else{logger['info'](_0x5016('0xd'),_0x3076e6,_0x5016('0xe'));_0x27e6c7(_0x3b02f8[_0x5016('0x14')][_0x5016('0x13')]);}})[_0x5016('0x15')](function(_0x446202){logger[_0x5016('0x11')](_0x5016('0xd'),_0x3076e6,_0x446202);_0x42bc41(_0x446202);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index d71020c..5323565 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 _0x4e7b=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','update','destroy','exports','multer'];(function(_0x35c38d,_0x245e04){var _0x197c45=function(_0x539cec){while(--_0x539cec){_0x35c38d['push'](_0x35c38d['shift']());}};_0x197c45(++_0x245e04);}(_0x4e7b,0x83));var _0xb4e7=function(_0x290be4,_0x2df3bd){_0x290be4=_0x290be4-0x0;var _0x2cbe14=_0x4e7b[_0x290be4];return _0x2cbe14;};'use strict';var multer=require(_0xb4e7('0x0'));var util=require(_0xb4e7('0x1'));var path=require('path');var timeout=require(_0xb4e7('0x2'));var express=require(_0xb4e7('0x3'));var router=express[_0xb4e7('0x4')]();var fs_extra=require(_0xb4e7('0x5'));var auth=require(_0xb4e7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb4e7('0x7'));var controller=require(_0xb4e7('0x8'));router[_0xb4e7('0x9')]('/',auth[_0xb4e7('0xa')](),controller['index']);router[_0xb4e7('0x9')](_0xb4e7('0xb'),auth[_0xb4e7('0xa')](),controller[_0xb4e7('0xc')]);router['get']('/:id/configurations',auth[_0xb4e7('0xa')](),controller[_0xb4e7('0xd')]);router[_0xb4e7('0x9')](_0xb4e7('0xe'),auth['isAuthenticated'](),controller[_0xb4e7('0xf')]);router[_0xb4e7('0x10')]('/',auth[_0xb4e7('0xa')](),controller[_0xb4e7('0x11')]);router['post'](_0xb4e7('0x12'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xb4e7('0xb'),auth[_0xb4e7('0xa')](),controller[_0xb4e7('0x13')]);router['delete'](_0xb4e7('0xb'),auth[_0xb4e7('0xa')](),controller[_0xb4e7('0x14')]);module[_0xb4e7('0x15')]=router; \ No newline at end of file +var _0x56d8=['../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','post','create','addConfiguration','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1e71b8,_0x2ba29c){var _0x32f86e=function(_0x112457){while(--_0x112457){_0x1e71b8['push'](_0x1e71b8['shift']());}};_0x32f86e(++_0x2ba29c);}(_0x56d8,0x11f));var _0x856d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x56d8[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0x856d('0x0'));var util=require('util');var path=require(_0x856d('0x1'));var timeout=require(_0x856d('0x2'));var express=require(_0x856d('0x3'));var router=express[_0x856d('0x4')]();var fs_extra=require(_0x856d('0x5'));var auth=require(_0x856d('0x6'));var interaction=require(_0x856d('0x7'));var config=require('../../config/environment');var controller=require(_0x856d('0x8'));router[_0x856d('0x9')]('/',auth[_0x856d('0xa')](),controller[_0x856d('0xb')]);router[_0x856d('0x9')](_0x856d('0xc'),auth[_0x856d('0xa')](),controller['show']);router[_0x856d('0x9')]('/:id/configurations',auth[_0x856d('0xa')](),controller[_0x856d('0xd')]);router['get'](_0x856d('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x856d('0xf')]('/',auth[_0x856d('0xa')](),controller[_0x856d('0x10')]);router[_0x856d('0xf')]('/:id/configurations',auth[_0x856d('0xa')](),controller[_0x856d('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x856d('0x12')]('/:id',auth[_0x856d('0xa')](),controller[_0x856d('0x13')]);module[_0x856d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5cb0c78..9faa1dc 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 _0x677a=['username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','STRING'];(function(_0x2fb5ea,_0x58897d){var _0x223fa5=function(_0x33f33e){while(--_0x33f33e){_0x2fb5ea['push'](_0x2fb5ea['shift']());}};_0x223fa5(++_0x58897d);}(_0x677a,0xd6));var _0xa677=function(_0x54cf50,_0xe0b43b){_0x54cf50=_0x54cf50-0x0;var _0x3e7bd3=_0x677a[_0x54cf50];return _0x3e7bd3;};'use strict';var Sequelize=require(_0xa677('0x0'));module['exports']={'name':{'type':Sequelize[_0xa677('0x1')]},'description':{'type':Sequelize[_0xa677('0x1')]},'username':{'type':Sequelize[_0xa677('0x1')],'unique':_0xa677('0x2')},'password':{'type':Sequelize[_0xa677('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa677('0x1')],'unique':_0xa677('0x3')},'authType':{'type':Sequelize[_0xa677('0x4')](_0xa677('0x5'),_0xa677('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xa677('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa677('0x4')](_0xa677('0x7'),_0xa677('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xfb67=['remoteUri','ENUM','password','token','integrationTab','sequelize','exports','STRING','username'];(function(_0x5e7af9,_0x30ced1){var _0x374f0b=function(_0x25afda){while(--_0x25afda){_0x5e7af9['push'](_0x5e7af9['shift']());}};_0x374f0b(++_0x30ced1);}(_0xfb67,0xdd));var _0x7fb6=function(_0x34844b,_0x4fe97e){_0x34844b=_0x34844b-0x0;var _0x1a1a2b=_0xfb67[_0x34844b];return _0x1a1a2b;};'use strict';var Sequelize=require(_0x7fb6('0x0'));module[_0x7fb6('0x1')]={'name':{'type':Sequelize[_0x7fb6('0x2')]},'description':{'type':Sequelize[_0x7fb6('0x2')]},'username':{'type':Sequelize[_0x7fb6('0x2')],'unique':_0x7fb6('0x3')},'password':{'type':Sequelize[_0x7fb6('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7fb6('0x2')],'unique':_0x7fb6('0x4')},'authType':{'type':Sequelize[_0x7fb6('0x5')](_0x7fb6('0x6'),_0x7fb6('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x7fb6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7fb6('0x5')](_0x7fb6('0x8'),'newTab'),'defaultValue':_0x7fb6('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d9df0e3..7888a43 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 _0xea28=['stack','name','index','map','ZendeskAccount','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','length','find','catch','create','body','getConfigurations','ZendeskConfiguration','order','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','username','password','remoteUri','slice','lastIndexOf','GET','format','ticket_fields','authType','%s:%s','token','Basic\x20%s','%s/token:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','error'];(function(_0x2b8edd,_0x11d4dc){var _0x32ce62=function(_0x39fe5b){while(--_0x39fe5b){_0x2b8edd['push'](_0x2b8edd['shift']());}};_0x32ce62(++_0x11d4dc);}(_0xea28,0x13a));var _0x8ea2=function(_0x466cbc,_0x52f8e5){_0x466cbc=_0x466cbc-0x0;var _0x4a608c=_0xea28[_0x466cbc];return _0x4a608c;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];var integrations=require(_0x8ea2('0x1b'));function respondWithStatusCode(_0x10aead,_0xe47c0e){_0xe47c0e=_0xe47c0e||0xcc;return function(_0x5e662e){if(_0x5e662e){return _0x10aead[_0x8ea2('0x1c')](_0xe47c0e);}return _0x10aead['status'](_0xe47c0e)['end']();};}function respondWithResult(_0x772bad,_0x4726a7){_0x4726a7=_0x4726a7||0xc8;return function(_0x416bae){if(_0x416bae){return _0x772bad[_0x8ea2('0x1d')](_0x4726a7)[_0x8ea2('0x1e')](_0x416bae);}};}function respondWithFilteredResult(_0xbb9bd1,_0x3cff96){return function(_0x11f5e8){if(_0x11f5e8){var _0x474873=typeof _0x3cff96[_0x8ea2('0x1f')]===_0x8ea2('0x20')&&typeof _0x3cff96[_0x8ea2('0x21')]===_0x8ea2('0x20');var _0xaa8abf=_0x11f5e8[_0x8ea2('0x22')];var _0x174ef2=_0x474873?0x0:_0x3cff96[_0x8ea2('0x1f')];var _0x2a0329=_0x474873?_0x11f5e8[_0x8ea2('0x22')]:_0x3cff96[_0x8ea2('0x1f')]+_0x3cff96[_0x8ea2('0x21')];var _0x287597;if(_0x2a0329>=_0xaa8abf){_0x2a0329=_0xaa8abf;_0x287597=0xc8;}else{_0x287597=0xce;}_0xbb9bd1['status'](_0x287597);return _0xbb9bd1['set'](_0x8ea2('0x23'),_0x174ef2+'-'+_0x2a0329+'/'+_0xaa8abf)[_0x8ea2('0x1e')](_0x11f5e8);}return null;};}function patchUpdates(_0x29151a){return function(_0x5ebc04){try{jsonpatch[_0x8ea2('0x24')](_0x5ebc04,_0x29151a,!![]);}catch(_0x218bd0){return BPromise['reject'](_0x218bd0);}return _0x5ebc04[_0x8ea2('0x25')]();};}function saveUpdates(_0x283f00,_0x37229a){return function(_0x9f9548){if(_0x9f9548){return _0x9f9548[_0x8ea2('0x26')](_0x283f00)[_0x8ea2('0x27')](function(_0x199417){return _0x199417;});}return null;};}function removeEntity(_0x1e4cc9,_0x18ec34){return function(_0x4d5030){if(_0x4d5030){return _0x4d5030[_0x8ea2('0x28')]()['then'](function(){_0x1e4cc9[_0x8ea2('0x1d')](0xcc)[_0x8ea2('0x29')]();});}};}function handleEntityNotFound(_0x29b38f,_0x4e2106){return function(_0x53ed43){if(!_0x53ed43){_0x29b38f[_0x8ea2('0x1c')](0x194);}return _0x53ed43;};}function handleError(_0x4dc7bf,_0x200a49){_0x200a49=_0x200a49||0x1f4;return function(_0x4e786d){logger[_0x8ea2('0x2a')](_0x4e786d[_0x8ea2('0x2b')]);if(_0x4e786d[_0x8ea2('0x2c')]){delete _0x4e786d[_0x8ea2('0x2c')];}_0x4dc7bf['status'](_0x200a49)['send'](_0x4e786d);};}exports[_0x8ea2('0x2d')]=function(_0x4da5b3,_0x4a9875){var _0x287078={},_0x24f187={},_0x41f482={'count':0x0,'rows':[]};var _0x307c74=_[_0x8ea2('0x2e')](db[_0x8ea2('0x2f')][_0x8ea2('0x30')],function(_0x19e868){return{'name':_0x19e868[_0x8ea2('0x31')],'type':_0x19e868['type']['key']};});_0x24f187[_0x8ea2('0x32')]=_[_0x8ea2('0x2e')](_0x307c74,'name');_0x24f187['query']=_[_0x8ea2('0x33')](_0x4da5b3['query']);_0x24f187[_0x8ea2('0x34')]=_[_0x8ea2('0x35')](_0x24f187['model'],_0x24f187[_0x8ea2('0x36')]);_0x287078[_0x8ea2('0x37')]=_[_0x8ea2('0x35')](_0x24f187['model'],qs['fields'](_0x4da5b3['query'][_0x8ea2('0x38')]));_0x287078[_0x8ea2('0x37')]=_0x287078[_0x8ea2('0x37')]['length']?_0x287078[_0x8ea2('0x37')]:_0x24f187[_0x8ea2('0x32')];if(!_0x4da5b3[_0x8ea2('0x36')][_0x8ea2('0x39')](_0x8ea2('0x3a'))){_0x287078[_0x8ea2('0x21')]=qs[_0x8ea2('0x21')](_0x4da5b3[_0x8ea2('0x36')]['limit']);_0x287078[_0x8ea2('0x1f')]=qs[_0x8ea2('0x1f')](_0x4da5b3[_0x8ea2('0x36')][_0x8ea2('0x1f')]);}_0x287078['order']=qs[_0x8ea2('0x3b')](_0x4da5b3['query'][_0x8ea2('0x3b')]);_0x287078[_0x8ea2('0x3c')]=qs[_0x8ea2('0x34')](_[_0x8ea2('0x3d')](_0x4da5b3['query'],_0x24f187[_0x8ea2('0x34')]),_0x307c74);if(_0x4da5b3['query']['filter']){_0x287078[_0x8ea2('0x3c')]=_['merge'](_0x287078[_0x8ea2('0x3c')],{'$or':_[_0x8ea2('0x2e')](_0x307c74,function(_0x1c229d){if(_0x1c229d[_0x8ea2('0x3e')]!==_0x8ea2('0x3f')){var _0x4ae536={};_0x4ae536[_0x1c229d[_0x8ea2('0x2c')]]={'$like':'%'+_0x4da5b3['query'][_0x8ea2('0x40')]+'%'};return _0x4ae536;}})});}_0x287078=_[_0x8ea2('0x41')]({},_0x287078,_0x4da5b3[_0x8ea2('0x42')]);var _0x3995ff={'where':_0x287078['where']};return db[_0x8ea2('0x2f')]['count'](_0x3995ff)[_0x8ea2('0x27')](function(_0x5ba351){_0x41f482[_0x8ea2('0x22')]=_0x5ba351;if(_0x4da5b3[_0x8ea2('0x36')][_0x8ea2('0x43')]){_0x287078[_0x8ea2('0x44')]=[{'all':!![]}];}return db[_0x8ea2('0x2f')][_0x8ea2('0x45')](_0x287078);})[_0x8ea2('0x27')](function(_0x478d5c){_0x41f482['rows']=_0x478d5c;return _0x41f482;})[_0x8ea2('0x27')](respondWithFilteredResult(_0x4a9875,_0x287078))['catch'](handleError(_0x4a9875,null));};exports['show']=function(_0x59e2fa,_0x3cbc09){var _0x5d9ba0={'raw':![],'where':{'id':_0x59e2fa[_0x8ea2('0x46')]['id']}},_0x40a532={};_0x40a532[_0x8ea2('0x32')]=_[_0x8ea2('0x33')](db[_0x8ea2('0x2f')][_0x8ea2('0x30')]);_0x40a532[_0x8ea2('0x36')]=_[_0x8ea2('0x33')](_0x59e2fa['query']);_0x40a532[_0x8ea2('0x34')]=_[_0x8ea2('0x35')](_0x40a532[_0x8ea2('0x32')],_0x40a532['query']);_0x5d9ba0[_0x8ea2('0x37')]=_[_0x8ea2('0x35')](_0x40a532[_0x8ea2('0x32')],qs[_0x8ea2('0x38')](_0x59e2fa[_0x8ea2('0x36')]['fields']));_0x5d9ba0[_0x8ea2('0x37')]=_0x5d9ba0[_0x8ea2('0x37')][_0x8ea2('0x47')]?_0x5d9ba0['attributes']:_0x40a532[_0x8ea2('0x32')];if(_0x59e2fa[_0x8ea2('0x36')][_0x8ea2('0x43')]){_0x5d9ba0[_0x8ea2('0x44')]=[{'all':!![]}];}_0x5d9ba0=_[_0x8ea2('0x41')]({},_0x5d9ba0,_0x59e2fa[_0x8ea2('0x42')]);return db[_0x8ea2('0x2f')][_0x8ea2('0x48')](_0x5d9ba0)[_0x8ea2('0x27')](handleEntityNotFound(_0x3cbc09,null))[_0x8ea2('0x27')](respondWithResult(_0x3cbc09,null))[_0x8ea2('0x49')](handleError(_0x3cbc09,null));};exports[_0x8ea2('0x4a')]=function(_0x220970,_0x12e81f){return db['ZendeskAccount'][_0x8ea2('0x4a')](_0x220970[_0x8ea2('0x4b')],{})[_0x8ea2('0x27')](respondWithResult(_0x12e81f,0xc9))[_0x8ea2('0x49')](handleError(_0x12e81f,null));};exports[_0x8ea2('0x26')]=function(_0x1daa25,_0x11b3ef){if(_0x1daa25[_0x8ea2('0x4b')]['id']){delete _0x1daa25['body']['id'];}return db[_0x8ea2('0x2f')][_0x8ea2('0x48')]({'where':{'id':_0x1daa25[_0x8ea2('0x46')]['id']}})['then'](handleEntityNotFound(_0x11b3ef,null))['then'](saveUpdates(_0x1daa25[_0x8ea2('0x4b')],null))[_0x8ea2('0x27')](respondWithResult(_0x11b3ef,null))[_0x8ea2('0x49')](handleError(_0x11b3ef,null));};exports['destroy']=function(_0x3d86f3,_0x315b5d){return db[_0x8ea2('0x2f')][_0x8ea2('0x48')]({'where':{'id':_0x3d86f3[_0x8ea2('0x46')]['id']}})['then'](handleEntityNotFound(_0x315b5d,null))['then'](removeEntity(_0x315b5d,null))[_0x8ea2('0x49')](handleError(_0x315b5d,null));};exports[_0x8ea2('0x4c')]=function(_0x1b8c4b,_0x5e4268,_0x18cbe9){var _0x100e29={};var _0x442dce={};var _0x54c9d7;var _0x5c6524;return db['ZendeskAccount']['findOne']({'where':{'id':_0x1b8c4b['params']['id']}})[_0x8ea2('0x27')](handleEntityNotFound(_0x5e4268,null))[_0x8ea2('0x27')](function(_0x5f56f8){if(_0x5f56f8){_0x54c9d7=_0x5f56f8;_0x442dce['model']=_[_0x8ea2('0x33')](db[_0x8ea2('0x4d')][_0x8ea2('0x30')]);_0x442dce['query']=_[_0x8ea2('0x33')](_0x1b8c4b[_0x8ea2('0x36')]);_0x442dce['filters']=_[_0x8ea2('0x35')](_0x442dce[_0x8ea2('0x32')],_0x442dce[_0x8ea2('0x36')]);_0x100e29[_0x8ea2('0x37')]=_[_0x8ea2('0x35')](_0x442dce['model'],qs['fields'](_0x1b8c4b['query'][_0x8ea2('0x38')]));_0x100e29[_0x8ea2('0x37')]=_0x100e29[_0x8ea2('0x37')][_0x8ea2('0x47')]?_0x100e29[_0x8ea2('0x37')]:_0x442dce[_0x8ea2('0x32')];_0x100e29[_0x8ea2('0x4e')]=qs['sort'](_0x1b8c4b['query']['sort']);_0x100e29[_0x8ea2('0x3c')]=qs[_0x8ea2('0x34')](_[_0x8ea2('0x3d')](_0x1b8c4b[_0x8ea2('0x36')],_0x442dce['filters']));if(_0x1b8c4b[_0x8ea2('0x36')][_0x8ea2('0x40')]){_0x100e29['where']=_[_0x8ea2('0x41')](_0x100e29[_0x8ea2('0x3c')],{'$or':_[_0x8ea2('0x2e')](_0x100e29[_0x8ea2('0x37')],function(_0x3de1a2){var _0x48c1de={};_0x48c1de[_0x3de1a2]={'$like':'%'+_0x1b8c4b['query']['filter']+'%'};return _0x48c1de;})});}_0x100e29=_[_0x8ea2('0x41')]({},_0x100e29,_0x1b8c4b[_0x8ea2('0x42')]);return _0x54c9d7[_0x8ea2('0x4c')](_0x100e29);}})[_0x8ea2('0x27')](function(_0x3c44ef){if(_0x3c44ef){_0x5c6524=_0x3c44ef['length'];if(!_0x1b8c4b[_0x8ea2('0x36')][_0x8ea2('0x39')](_0x8ea2('0x3a'))){_0x100e29[_0x8ea2('0x21')]=qs['limit'](_0x1b8c4b[_0x8ea2('0x36')]['limit']);_0x100e29[_0x8ea2('0x1f')]=qs['offset'](_0x1b8c4b[_0x8ea2('0x36')][_0x8ea2('0x1f')]);}return _0x54c9d7['getConfigurations'](_0x100e29);}})['then'](function(_0x1d0326){if(_0x1d0326){return _0x1d0326?{'count':_0x5c6524,'rows':_0x1d0326}:null;}})['then'](respondWithResult(_0x5e4268,null))[_0x8ea2('0x49')](handleError(_0x5e4268,null));};exports[_0x8ea2('0x4f')]=function(_0x1c5489,_0x23185e,_0x4dab8f){if(_0x1c5489[_0x8ea2('0x4b')]['id']){delete _0x1c5489[_0x8ea2('0x4b')]['id'];}return db[_0x8ea2('0x2f')][_0x8ea2('0x50')]({'where':{'id':_0x1c5489[_0x8ea2('0x46')]['id']}})[_0x8ea2('0x27')](handleEntityNotFound(_0x23185e,null))[_0x8ea2('0x27')](function(_0x3a78c9){if(_0x3a78c9){_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x51')]=_0x3a78c9['id'];_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x52')]=integrations['getSubjects'](_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x53')],_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x3e')]);_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x54')]=integrations[_0x8ea2('0x55')](_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x53')],_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x3e')]);return db[_0x8ea2('0x4d')]['create'](_0x1c5489[_0x8ea2('0x4b')],{'include':[{'model':db[_0x8ea2('0x56')],'as':_0x8ea2('0x52')},{'model':db[_0x8ea2('0x56')],'as':_0x8ea2('0x54')}]});}return null;})['then'](respondWithResult(_0x23185e,null))['catch'](handleError(_0x23185e,null));};exports['getFields']=function(_0x17f2f2,_0xe8b3ed,_0x380066){var _0x31bda0='';return db[_0x8ea2('0x2f')][_0x8ea2('0x50')]({'where':{'id':_0x17f2f2['params']['id']},'attributes':['id',_0x8ea2('0x57'),_0x8ea2('0x58'),'token','authType',_0x8ea2('0x59')]})[_0x8ea2('0x27')](handleEntityNotFound(_0xe8b3ed,null))[_0x8ea2('0x27')](function(_0x289e74){if(_0x289e74){_0x31bda0=_0x289e74[_0x8ea2('0x59')];var _0x32a8f2=_0x31bda0[_0x8ea2('0x5a')](-0x1);if(_0x32a8f2==='/'){_0x31bda0=_0x31bda0['substring'](0x0,_0x31bda0[_0x8ea2('0x5b')](_0x32a8f2));}var _0x3fa2c8={'method':_0x8ea2('0x5c'),'uri':util[_0x8ea2('0x5d')]('%s/%s',_0x31bda0,_0x8ea2('0x5e')),'json':!![]};switch(_0x289e74[_0x8ea2('0x5f')]){case _0x8ea2('0x58'):_0x3fa2c8['headers']={'Authorization':util[_0x8ea2('0x5d')]('Basic\x20%s',new Buffer(util['format'](_0x8ea2('0x60'),_0x289e74[_0x8ea2('0x57')],_0x289e74['password']))['toString']('base64'))};break;case _0x8ea2('0x61'):_0x3fa2c8['headers']={'Authorization':util['format'](_0x8ea2('0x62'),new Buffer(util[_0x8ea2('0x5d')](_0x8ea2('0x63'),_0x289e74[_0x8ea2('0x57')],_0x289e74[_0x8ea2('0x61')]))[_0x8ea2('0x64')](_0x8ea2('0x65')))};break;default:throw new db[(_0x8ea2('0x66'))][(_0x8ea2('0x67'))](_0x8ea2('0x68'));}return rp(_0x3fa2c8);}})[_0x8ea2('0x27')](function(_0x15eab7){if(_0x15eab7){var _0x1961a9=[_0x8ea2('0x69'),'description',_0x8ea2('0x6a'),_0x8ea2('0x6b')];_[_0x8ea2('0x6c')](_0x15eab7['ticket_fields'],function(_0x1807bb){return _0x1961a9['includes'](_0x1807bb[_0x8ea2('0x3e')]);});return{'count':_0x15eab7['ticket_fields'][_0x8ea2('0x47')],'rows':_['map'](_0x15eab7[_0x8ea2('0x5e')],function(_0x165052){return{'id':_0x165052['id'],'name':_0x165052['position']>0x7?_0x165052[_0x8ea2('0x6d')]:_0x165052['type'],'custom':_0x165052[_0x8ea2('0x6e')]>0x7?!![]:![],'options':_0x165052[_0x8ea2('0x6f')]?_0x165052[_0x8ea2('0x6f')]:_0x165052[_0x8ea2('0x70')]?_0x165052[_0x8ea2('0x70')]:[]};})};}})['then'](respondWithResult(_0xe8b3ed,null))['catch'](function(_0x39d0d7){var _0x4b7e5e=_0x17f2f2[_0x8ea2('0x36')][_0x8ea2('0x71')]?0x1f4:_0x39d0d7[_0x8ea2('0x72')]||0x1f4;logger[_0x8ea2('0x2a')](_0x8ea2('0x73'),_0x8ea2('0x74'),_0x4b7e5e,JSON['stringify'](_0x39d0d7));delete _0x39d0d7['name'];if(_0x4b7e5e===0x191){_0x4b7e5e=0x190;}_0xe8b3ed['status'](_0x4b7e5e)[_0x8ea2('0x75')](_0x17f2f2['query'][_0x8ea2('0x71')]?{'message':_0x8ea2('0x76'),'statusCode':_0x39d0d7[_0x8ea2('0x72')]}:_0x39d0d7);});}; \ No newline at end of file +var _0x5eb8=['sort','where','filter','merge','type','options','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','title','position','system_field_options','custom_field_options','send','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','map','ZendeskAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4756a1,_0x3f8d1){_0x4756a1=_0x4756a1-0x0;var _0x177c4f=_0x5eb8[_0x4756a1];return _0x177c4f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];var integrations=require(_0x85eb('0x19'));function respondWithStatusCode(_0x2f42ba,_0x259f72){_0x259f72=_0x259f72||0xcc;return function(_0x4db167){if(_0x4db167){return _0x2f42ba['sendStatus'](_0x259f72);}return _0x2f42ba[_0x85eb('0x1a')](_0x259f72)['end']();};}function respondWithResult(_0x18ca53,_0x23a82a){_0x23a82a=_0x23a82a||0xc8;return function(_0x600a7f){if(_0x600a7f){return _0x18ca53[_0x85eb('0x1a')](_0x23a82a)[_0x85eb('0x1b')](_0x600a7f);}};}function respondWithFilteredResult(_0x49efdf,_0x2e5c0a){return function(_0x59237b){if(_0x59237b){var _0x17140b=typeof _0x2e5c0a[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x2e5c0a[_0x85eb('0x1e')]==='undefined';var _0x5c5cbb=_0x59237b['count'];var _0xe198ca=_0x17140b?0x0:_0x2e5c0a[_0x85eb('0x1c')];var _0x10cf2f=_0x17140b?_0x59237b[_0x85eb('0x1f')]:_0x2e5c0a[_0x85eb('0x1c')]+_0x2e5c0a[_0x85eb('0x1e')];var _0x5acd3d;if(_0x10cf2f>=_0x5c5cbb){_0x10cf2f=_0x5c5cbb;_0x5acd3d=0xc8;}else{_0x5acd3d=0xce;}_0x49efdf[_0x85eb('0x1a')](_0x5acd3d);return _0x49efdf[_0x85eb('0x20')](_0x85eb('0x21'),_0xe198ca+'-'+_0x10cf2f+'/'+_0x5c5cbb)['json'](_0x59237b);}return null;};}function patchUpdates(_0x4b4b38){return function(_0x48bd86){try{jsonpatch['apply'](_0x48bd86,_0x4b4b38,!![]);}catch(_0x244667){return BPromise[_0x85eb('0x22')](_0x244667);}return _0x48bd86[_0x85eb('0x23')]();};}function saveUpdates(_0x255ca7,_0x465c74){return function(_0x3fc6da){if(_0x3fc6da){return _0x3fc6da['update'](_0x255ca7)['then'](function(_0x5b48d9){return _0x5b48d9;});}return null;};}function removeEntity(_0x298e84,_0x1426c8){return function(_0x3f7a4d){if(_0x3f7a4d){return _0x3f7a4d[_0x85eb('0x24')]()[_0x85eb('0x25')](function(){_0x298e84[_0x85eb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39d3fe,_0x3453cd){return function(_0x4709ad){if(!_0x4709ad){_0x39d3fe[_0x85eb('0x26')](0x194);}return _0x4709ad;};}function handleError(_0x3e2326,_0x57a03c){_0x57a03c=_0x57a03c||0x1f4;return function(_0x2e5aa3){logger[_0x85eb('0x27')](_0x2e5aa3[_0x85eb('0x28')]);if(_0x2e5aa3[_0x85eb('0x29')]){delete _0x2e5aa3[_0x85eb('0x29')];}_0x3e2326[_0x85eb('0x1a')](_0x57a03c)['send'](_0x2e5aa3);};}exports['index']=function(_0x37515c,_0x585f2a){var _0xa9b14f={},_0x5255eb={},_0x4229e9={'count':0x0,'rows':[]};var _0x3570f7=_[_0x85eb('0x2a')](db[_0x85eb('0x2b')][_0x85eb('0x2c')],function(_0xf4ac13){return{'name':_0xf4ac13[_0x85eb('0x2d')],'type':_0xf4ac13['type'][_0x85eb('0x2e')]};});_0x5255eb[_0x85eb('0x2f')]=_['map'](_0x3570f7,_0x85eb('0x29'));_0x5255eb['query']=_['keys'](_0x37515c[_0x85eb('0x30')]);_0x5255eb[_0x85eb('0x31')]=_[_0x85eb('0x32')](_0x5255eb[_0x85eb('0x2f')],_0x5255eb[_0x85eb('0x30')]);_0xa9b14f[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x5255eb[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x37515c[_0x85eb('0x30')]['fields']));_0xa9b14f[_0x85eb('0x33')]=_0xa9b14f[_0x85eb('0x33')]['length']?_0xa9b14f['attributes']:_0x5255eb[_0x85eb('0x2f')];if(!_0x37515c[_0x85eb('0x30')][_0x85eb('0x35')](_0x85eb('0x36'))){_0xa9b14f[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x37515c[_0x85eb('0x30')][_0x85eb('0x1e')]);_0xa9b14f[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x37515c[_0x85eb('0x30')][_0x85eb('0x1c')]);}_0xa9b14f[_0x85eb('0x37')]=qs[_0x85eb('0x38')](_0x37515c['query'][_0x85eb('0x38')]);_0xa9b14f[_0x85eb('0x39')]=qs['filters'](_['pick'](_0x37515c[_0x85eb('0x30')],_0x5255eb[_0x85eb('0x31')]),_0x3570f7);if(_0x37515c['query'][_0x85eb('0x3a')]){_0xa9b14f['where']=_[_0x85eb('0x3b')](_0xa9b14f['where'],{'$or':_[_0x85eb('0x2a')](_0x3570f7,function(_0x5ce7e4){if(_0x5ce7e4[_0x85eb('0x3c')]!=='VIRTUAL'){var _0x38ab0f={};_0x38ab0f[_0x5ce7e4[_0x85eb('0x29')]]={'$like':'%'+_0x37515c['query'][_0x85eb('0x3a')]+'%'};return _0x38ab0f;}})});}_0xa9b14f=_['merge']({},_0xa9b14f,_0x37515c[_0x85eb('0x3d')]);var _0x331260={'where':_0xa9b14f['where']};return db[_0x85eb('0x2b')]['count'](_0x331260)['then'](function(_0x1b8a71){_0x4229e9['count']=_0x1b8a71;if(_0x37515c[_0x85eb('0x30')][_0x85eb('0x3e')]){_0xa9b14f['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x85eb('0x3f')](_0xa9b14f);})[_0x85eb('0x25')](function(_0x48160e){_0x4229e9['rows']=_0x48160e;return _0x4229e9;})[_0x85eb('0x25')](respondWithFilteredResult(_0x585f2a,_0xa9b14f))[_0x85eb('0x40')](handleError(_0x585f2a,null));};exports[_0x85eb('0x41')]=function(_0x202681,_0x3be961){var _0x5b7411={'raw':![],'where':{'id':_0x202681[_0x85eb('0x42')]['id']}},_0x5ccf8a={};_0x5ccf8a[_0x85eb('0x2f')]=_[_0x85eb('0x43')](db[_0x85eb('0x2b')][_0x85eb('0x2c')]);_0x5ccf8a[_0x85eb('0x30')]=_[_0x85eb('0x43')](_0x202681[_0x85eb('0x30')]);_0x5ccf8a['filters']=_[_0x85eb('0x32')](_0x5ccf8a[_0x85eb('0x2f')],_0x5ccf8a['query']);_0x5b7411[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x5ccf8a[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x202681[_0x85eb('0x30')][_0x85eb('0x34')]));_0x5b7411['attributes']=_0x5b7411[_0x85eb('0x33')][_0x85eb('0x44')]?_0x5b7411[_0x85eb('0x33')]:_0x5ccf8a[_0x85eb('0x2f')];if(_0x202681[_0x85eb('0x30')][_0x85eb('0x3e')]){_0x5b7411[_0x85eb('0x45')]=[{'all':!![]}];}_0x5b7411=_[_0x85eb('0x3b')]({},_0x5b7411,_0x202681['options']);return db[_0x85eb('0x2b')][_0x85eb('0x46')](_0x5b7411)[_0x85eb('0x25')](handleEntityNotFound(_0x3be961,null))[_0x85eb('0x25')](respondWithResult(_0x3be961,null))[_0x85eb('0x40')](handleError(_0x3be961,null));};exports[_0x85eb('0x47')]=function(_0x3c387a,_0x77fdc4){return db[_0x85eb('0x2b')][_0x85eb('0x47')](_0x3c387a[_0x85eb('0x48')],{})[_0x85eb('0x25')](respondWithResult(_0x77fdc4,0xc9))['catch'](handleError(_0x77fdc4,null));};exports[_0x85eb('0x49')]=function(_0x2c951b,_0x22d9d6){if(_0x2c951b['body']['id']){delete _0x2c951b[_0x85eb('0x48')]['id'];}return db[_0x85eb('0x2b')][_0x85eb('0x46')]({'where':{'id':_0x2c951b[_0x85eb('0x42')]['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x22d9d6,null))['then'](saveUpdates(_0x2c951b[_0x85eb('0x48')],null))[_0x85eb('0x25')](respondWithResult(_0x22d9d6,null))[_0x85eb('0x40')](handleError(_0x22d9d6,null));};exports['destroy']=function(_0xc5cb43,_0x4550fd){return db[_0x85eb('0x2b')]['find']({'where':{'id':_0xc5cb43['params']['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x4550fd,null))['then'](removeEntity(_0x4550fd,null))['catch'](handleError(_0x4550fd,null));};exports[_0x85eb('0x4a')]=function(_0x593723,_0x39316d,_0xfb0ac){var _0x4e3d96={};var _0x4abe5e={};var _0x27ce2a;var _0x249511;return db[_0x85eb('0x2b')][_0x85eb('0x4b')]({'where':{'id':_0x593723[_0x85eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x39316d,null))[_0x85eb('0x25')](function(_0x30062e){if(_0x30062e){_0x27ce2a=_0x30062e;_0x4abe5e[_0x85eb('0x2f')]=_[_0x85eb('0x43')](db[_0x85eb('0x4c')]['rawAttributes']);_0x4abe5e[_0x85eb('0x30')]=_['keys'](_0x593723[_0x85eb('0x30')]);_0x4abe5e[_0x85eb('0x31')]=_['intersection'](_0x4abe5e[_0x85eb('0x2f')],_0x4abe5e[_0x85eb('0x30')]);_0x4e3d96[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x4abe5e[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x593723['query'][_0x85eb('0x34')]));_0x4e3d96['attributes']=_0x4e3d96[_0x85eb('0x33')][_0x85eb('0x44')]?_0x4e3d96['attributes']:_0x4abe5e[_0x85eb('0x2f')];_0x4e3d96[_0x85eb('0x37')]=qs['sort'](_0x593723[_0x85eb('0x30')]['sort']);_0x4e3d96[_0x85eb('0x39')]=qs[_0x85eb('0x31')](_[_0x85eb('0x4d')](_0x593723[_0x85eb('0x30')],_0x4abe5e[_0x85eb('0x31')]));if(_0x593723[_0x85eb('0x30')]['filter']){_0x4e3d96[_0x85eb('0x39')]=_[_0x85eb('0x3b')](_0x4e3d96[_0x85eb('0x39')],{'$or':_[_0x85eb('0x2a')](_0x4e3d96[_0x85eb('0x33')],function(_0x1529dd){var _0x2024df={};_0x2024df[_0x1529dd]={'$like':'%'+_0x593723[_0x85eb('0x30')][_0x85eb('0x3a')]+'%'};return _0x2024df;})});}_0x4e3d96=_[_0x85eb('0x3b')]({},_0x4e3d96,_0x593723[_0x85eb('0x3d')]);return _0x27ce2a['getConfigurations'](_0x4e3d96);}})[_0x85eb('0x25')](function(_0x21b873){if(_0x21b873){_0x249511=_0x21b873[_0x85eb('0x44')];if(!_0x593723[_0x85eb('0x30')][_0x85eb('0x35')](_0x85eb('0x36'))){_0x4e3d96['limit']=qs[_0x85eb('0x1e')](_0x593723['query'][_0x85eb('0x1e')]);_0x4e3d96[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x593723[_0x85eb('0x30')][_0x85eb('0x1c')]);}return _0x27ce2a['getConfigurations'](_0x4e3d96);}})[_0x85eb('0x25')](function(_0x143d65){if(_0x143d65){return _0x143d65?{'count':_0x249511,'rows':_0x143d65}:null;}})[_0x85eb('0x25')](respondWithResult(_0x39316d,null))[_0x85eb('0x40')](handleError(_0x39316d,null));};exports[_0x85eb('0x4e')]=function(_0x14cab8,_0x23fcf9,_0x5de716){if(_0x14cab8['body']['id']){delete _0x14cab8[_0x85eb('0x48')]['id'];}return db['ZendeskAccount'][_0x85eb('0x4b')]({'where':{'id':_0x14cab8[_0x85eb('0x42')]['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x23fcf9,null))[_0x85eb('0x25')](function(_0x259ee3){if(_0x259ee3){_0x14cab8['body'][_0x85eb('0x4f')]=_0x259ee3['id'];_0x14cab8[_0x85eb('0x48')][_0x85eb('0x50')]=integrations[_0x85eb('0x51')](_0x14cab8[_0x85eb('0x48')][_0x85eb('0x52')],_0x14cab8['body']['type']);_0x14cab8[_0x85eb('0x48')]['Descriptions']=integrations[_0x85eb('0x53')](_0x14cab8[_0x85eb('0x48')][_0x85eb('0x52')],_0x14cab8[_0x85eb('0x48')][_0x85eb('0x3c')]);return db[_0x85eb('0x4c')]['create'](_0x14cab8[_0x85eb('0x48')],{'include':[{'model':db[_0x85eb('0x54')],'as':_0x85eb('0x50')},{'model':db[_0x85eb('0x54')],'as':'Descriptions'}]});}return null;})[_0x85eb('0x25')](respondWithResult(_0x23fcf9,null))[_0x85eb('0x40')](handleError(_0x23fcf9,null));};exports[_0x85eb('0x55')]=function(_0x14bf0e,_0x5037c7,_0x459317){var _0x2e6734='';return db[_0x85eb('0x2b')][_0x85eb('0x4b')]({'where':{'id':_0x14bf0e[_0x85eb('0x42')]['id']},'attributes':['id',_0x85eb('0x56'),_0x85eb('0x57'),_0x85eb('0x58'),_0x85eb('0x59'),_0x85eb('0x5a')]})[_0x85eb('0x25')](handleEntityNotFound(_0x5037c7,null))[_0x85eb('0x25')](function(_0x1d9d3a){if(_0x1d9d3a){_0x2e6734=_0x1d9d3a[_0x85eb('0x5a')];var _0x2f2464=_0x2e6734[_0x85eb('0x5b')](-0x1);if(_0x2f2464==='/'){_0x2e6734=_0x2e6734[_0x85eb('0x5c')](0x0,_0x2e6734[_0x85eb('0x5d')](_0x2f2464));}var _0x106caa={'method':'GET','uri':util[_0x85eb('0x5e')]('%s/%s',_0x2e6734,_0x85eb('0x5f')),'json':!![]};switch(_0x1d9d3a[_0x85eb('0x59')]){case _0x85eb('0x57'):_0x106caa[_0x85eb('0x60')]={'Authorization':util[_0x85eb('0x5e')](_0x85eb('0x61'),new Buffer(util[_0x85eb('0x5e')](_0x85eb('0x62'),_0x1d9d3a[_0x85eb('0x56')],_0x1d9d3a['password']))[_0x85eb('0x63')](_0x85eb('0x64')))};break;case _0x85eb('0x58'):_0x106caa[_0x85eb('0x60')]={'Authorization':util[_0x85eb('0x5e')]('Basic\x20%s',new Buffer(util[_0x85eb('0x5e')]('%s/token:%s',_0x1d9d3a[_0x85eb('0x56')],_0x1d9d3a[_0x85eb('0x58')]))[_0x85eb('0x63')]('base64'))};break;default:throw new db[(_0x85eb('0x65'))][(_0x85eb('0x66'))](_0x85eb('0x67'));}return rp(_0x106caa);}})['then'](function(_0x588c72){if(_0x588c72){var _0x45a1ef=[_0x85eb('0x68'),_0x85eb('0x69'),_0x85eb('0x6a'),'assignee'];_[_0x85eb('0x6b')](_0x588c72['ticket_fields'],function(_0x11a3bd){return _0x45a1ef[_0x85eb('0x6c')](_0x11a3bd[_0x85eb('0x3c')]);});return{'count':_0x588c72[_0x85eb('0x5f')][_0x85eb('0x44')],'rows':_[_0x85eb('0x2a')](_0x588c72['ticket_fields'],function(_0x9a80a1){return{'id':_0x9a80a1['id'],'name':_0x9a80a1['position']>0x7?_0x9a80a1[_0x85eb('0x6d')]:_0x9a80a1[_0x85eb('0x3c')],'custom':_0x9a80a1[_0x85eb('0x6e')]>0x7?!![]:![],'options':_0x9a80a1[_0x85eb('0x6f')]?_0x9a80a1[_0x85eb('0x6f')]:_0x9a80a1[_0x85eb('0x70')]?_0x9a80a1[_0x85eb('0x70')]:[]};})};}})[_0x85eb('0x25')](respondWithResult(_0x5037c7,null))[_0x85eb('0x40')](function(_0x543146){var _0x3358c8=_0x14bf0e[_0x85eb('0x30')]['test']?0x1f4:_0x543146['statusCode']||0x1f4;logger[_0x85eb('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x85eb('0x55'),_0x3358c8,JSON['stringify'](_0x543146));delete _0x543146[_0x85eb('0x29')];if(_0x3358c8===0x191){_0x3358c8=0x190;}_0x5037c7['status'](_0x3358c8)[_0x85eb('0x71')](_0x14bf0e[_0x85eb('0x30')]['test']?{'message':_0x85eb('0x72'),'statusCode':_0x543146[_0x85eb('0x73')]}:_0x543146);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 3e9ddd7..a00f942 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 _0xc7f7=['ZendeskAccount','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x2582af,_0x3409f7){var _0x38c9c6=function(_0x2695e4){while(--_0x2695e4){_0x2582af['push'](_0x2582af['shift']());}};_0x38c9c6(++_0x3409f7);}(_0xc7f7,0x1c4));var _0x7c7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7f7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7c7f('0x0'))(_0x7c7f('0x1'));var moment=require(_0x7c7f('0x2'));var BPromise=require(_0x7c7f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c7f('0x4'));var rimraf=require('rimraf');var config=require(_0x7c7f('0x5'));var attributes=require(_0x7c7f('0x6'));var integrations=require(_0x7c7f('0x7'));module[_0x7c7f('0x8')]=function(_0x40e1da,_0x282663){return _0x40e1da[_0x7c7f('0x9')](_0x7c7f('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8386=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x469fe3,_0x2d209e){var _0x47a1d3=function(_0x309bdf){while(--_0x309bdf){_0x469fe3['push'](_0x469fe3['shift']());}};_0x47a1d3(++_0x2d209e);}(_0x8386,0x85));var _0x6838=function(_0x31c0ef,_0x3913e4){_0x31c0ef=_0x31c0ef-0x0;var _0x5f1aca=_0x8386[_0x31c0ef];return _0x5f1aca;};'use strict';var _=require(_0x6838('0x0'));var util=require(_0x6838('0x1'));var logger=require(_0x6838('0x2'))(_0x6838('0x3'));var moment=require(_0x6838('0x4'));var BPromise=require('bluebird');var rp=require(_0x6838('0x5'));var fs=require('fs');var path=require(_0x6838('0x6'));var rimraf=require('rimraf');var config=require(_0x6838('0x7'));var attributes=require(_0x6838('0x8'));var integrations=require(_0x6838('0x9'));module[_0x6838('0xa')]=function(_0x41e5dd,_0x5242db){return _0x41e5dd[_0x6838('0xb')](_0x6838('0xc'),attributes,{'tableName':_0x6838('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index dec5124..6fb9d14 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 _0x5a93=['limit','include','model','stringify','ShowZendeskAccount','find','raw','map','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x5a93,0xf6));var _0x35a9=function(_0x357b0d,_0x10aeaa){_0x357b0d=_0x357b0d-0x0;var _0x3c48e9=_0x5a93[_0x357b0d];return _0x3c48e9;};'use strict';var _=require('lodash');var util=require(_0x35a9('0x0'));var moment=require('moment');var BPromise=require(_0x35a9('0x1'));var rs=require(_0x35a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35a9('0x3'));var logger=require(_0x35a9('0x4'))(_0x35a9('0x5'));var config=require('../../config/environment');var jayson=require(_0x35a9('0x6'));var client=jayson[_0x35a9('0x7')][_0x35a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x354490,_0x271228,_0x45e6f7){return new BPromise(function(_0x71d143,_0x22d770){return client[_0x35a9('0x9')](_0x354490,_0x45e6f7)[_0x35a9('0xa')](function(_0x5b4f25){logger[_0x35a9('0xb')](_0x35a9('0xc'),_0x271228,_0x35a9('0xd'));logger[_0x35a9('0xe')](_0x35a9('0xf'),_0x271228,_0x35a9('0xd'),JSON['stringify'](_0x5b4f25));if(_0x5b4f25[_0x35a9('0x10')]){if(_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x11')]===0x1f4){logger[_0x35a9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x271228,_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x12')]);return _0x22d770(_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x12')]);}logger['error'](_0x35a9('0xc'),_0x271228,_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x12')]);return _0x71d143(_0x5b4f25[_0x35a9('0x10')]['message']);}else{logger[_0x35a9('0xb')](_0x35a9('0xc'),_0x271228,_0x35a9('0xd'));_0x71d143(_0x5b4f25['result'][_0x35a9('0x12')]);}})[_0x35a9('0x13')](function(_0x14eeb5){logger[_0x35a9('0x10')](_0x35a9('0xc'),_0x271228,_0x14eeb5);_0x22d770(_0x14eeb5);});});}exports[_0x35a9('0x14')]=function(_0x56f31f){var _0x152086=this;return new Promise(function(_0x4490d5,_0x36f0fe){return db[_0x35a9('0x15')][_0x35a9('0x16')]({'raw':_0x56f31f['options']?_0x56f31f[_0x35a9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x56f31f[_0x35a9('0x17')]?_0x56f31f[_0x35a9('0x17')][_0x35a9('0x18')]||null:null,'attributes':_0x56f31f[_0x35a9('0x17')]?_0x56f31f[_0x35a9('0x17')][_0x35a9('0x19')]||null:null,'limit':_0x56f31f[_0x35a9('0x17')]?_0x56f31f[_0x35a9('0x17')][_0x35a9('0x1a')]||null:null,'include':_0x56f31f['options']?_0x56f31f[_0x35a9('0x17')][_0x35a9('0x1b')]?_['map'](_0x56f31f['options'][_0x35a9('0x1b')],function(_0x1dd1ab){return{'model':db[_0x1dd1ab[_0x35a9('0x1c')]],'as':_0x1dd1ab['as'],'attributes':_0x1dd1ab[_0x35a9('0x19')],'include':_0x1dd1ab[_0x35a9('0x1b')]?_['map'](_0x1dd1ab[_0x35a9('0x1b')],function(_0xc31cd1){return{'model':db[_0xc31cd1[_0x35a9('0x1c')]],'as':_0xc31cd1['as'],'attributes':_0xc31cd1[_0x35a9('0x19')],'include':_0xc31cd1[_0x35a9('0x1b')]?_['map'](_0xc31cd1['include'],function(_0x5dfc9f){return{'model':db[_0x5dfc9f[_0x35a9('0x1c')]],'as':_0x5dfc9f['as'],'attributes':_0x5dfc9f['attributes']};}):[]};}):[]};}):[]:[]})[_0x35a9('0xa')](function(_0x15eada){logger['info'](_0x35a9('0x14'),_0x56f31f);logger['debug'](_0x35a9('0x14'),_0x56f31f,JSON[_0x35a9('0x1d')](_0x15eada));_0x4490d5(_0x15eada);})['catch'](function(_0x534455){logger[_0x35a9('0x10')](_0x35a9('0x14'),_0x534455[_0x35a9('0x12')],_0x56f31f);_0x36f0fe(_0x152086[_0x35a9('0x10')](0x1f4,_0x534455[_0x35a9('0x12')]));});});};exports[_0x35a9('0x1e')]=function(_0x145cc6){var _0x246316=this;return new Promise(function(_0x52c9c9,_0x39fa5a){return db[_0x35a9('0x15')][_0x35a9('0x1f')]({'raw':_0x145cc6[_0x35a9('0x17')]?_0x145cc6[_0x35a9('0x17')][_0x35a9('0x20')]===undefined?!![]:![]:!![],'where':_0x145cc6['options']?_0x145cc6[_0x35a9('0x17')][_0x35a9('0x18')]||null:null,'attributes':_0x145cc6[_0x35a9('0x17')]?_0x145cc6['options'][_0x35a9('0x19')]||null:null,'include':_0x145cc6['options']?_0x145cc6[_0x35a9('0x17')][_0x35a9('0x1b')]?_[_0x35a9('0x21')](_0x145cc6[_0x35a9('0x17')][_0x35a9('0x1b')],function(_0x28e8c8){return{'model':db[_0x28e8c8['model']],'as':_0x28e8c8['as'],'attributes':_0x28e8c8['attributes'],'include':_0x28e8c8[_0x35a9('0x1b')]?_[_0x35a9('0x21')](_0x28e8c8['include'],function(_0x5771ed){return{'model':db[_0x5771ed[_0x35a9('0x1c')]],'as':_0x5771ed['as'],'attributes':_0x5771ed['attributes'],'include':_0x5771ed['include']?_['map'](_0x5771ed[_0x35a9('0x1b')],function(_0x37f2fb){return{'model':db[_0x37f2fb['model']],'as':_0x37f2fb['as'],'attributes':_0x37f2fb[_0x35a9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x35a9('0xa')](function(_0x3695f1){logger[_0x35a9('0xb')]('ShowZendeskAccount',_0x145cc6);logger[_0x35a9('0xe')](_0x35a9('0x1e'),_0x145cc6,JSON[_0x35a9('0x1d')](_0x3695f1));_0x52c9c9(_0x3695f1);})[_0x35a9('0x13')](function(_0x4710ac){logger['error']('ShowZendeskAccount',_0x4710ac[_0x35a9('0x12')],_0x145cc6);_0x39fa5a(_0x246316['error'](0x1f4,_0x4710ac[_0x35a9('0x12')]));});});}; \ No newline at end of file +var _0x5a5d=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','map','include','model','attributes','then','stringify','find','ShowZendeskAccount','lodash'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5a5d,0x131));var _0xd5a5=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5a5d[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xd5a5('0x0'));var util=require(_0xd5a5('0x1'));var moment=require(_0xd5a5('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd5a5('0x4'));var logger=require(_0xd5a5('0x5'))(_0xd5a5('0x6'));var config=require('../../config/environment');var jayson=require(_0xd5a5('0x7'));var client=jayson[_0xd5a5('0x8')][_0xd5a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ec2fd,_0x294f59,_0x23ddba){return new BPromise(function(_0x40d77a,_0x358ec4){return client['request'](_0x2ec2fd,_0x23ddba)['then'](function(_0x37ff5d){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x294f59,_0xd5a5('0xa'));logger[_0xd5a5('0xb')](_0xd5a5('0xc'),_0x294f59,_0xd5a5('0xa'),JSON['stringify'](_0x37ff5d));if(_0x37ff5d[_0xd5a5('0xd')]){if(_0x37ff5d['error'][_0xd5a5('0xe')]===0x1f4){logger[_0xd5a5('0xd')](_0xd5a5('0xf'),_0x294f59,_0x37ff5d[_0xd5a5('0xd')][_0xd5a5('0x10')]);return _0x358ec4(_0x37ff5d[_0xd5a5('0xd')][_0xd5a5('0x10')]);}logger['error'](_0xd5a5('0xf'),_0x294f59,_0x37ff5d['error'][_0xd5a5('0x10')]);return _0x40d77a(_0x37ff5d[_0xd5a5('0xd')]['message']);}else{logger[_0xd5a5('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x294f59,_0xd5a5('0xa'));_0x40d77a(_0x37ff5d[_0xd5a5('0x12')][_0xd5a5('0x10')]);}})[_0xd5a5('0x13')](function(_0x7d0315){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x294f59,_0x7d0315);_0x358ec4(_0x7d0315);});});}exports[_0xd5a5('0x14')]=function(_0x75601){var _0x36c327=this;return new Promise(function(_0x2c40ce,_0x45677f){return db[_0xd5a5('0x15')][_0xd5a5('0x16')]({'raw':_0x75601[_0xd5a5('0x17')]?_0x75601[_0xd5a5('0x17')][_0xd5a5('0x18')]===undefined?!![]:![]:!![],'where':_0x75601[_0xd5a5('0x17')]?_0x75601[_0xd5a5('0x17')][_0xd5a5('0x19')]||null:null,'attributes':_0x75601[_0xd5a5('0x17')]?_0x75601[_0xd5a5('0x17')]['attributes']||null:null,'limit':_0x75601['options']?_0x75601[_0xd5a5('0x17')]['limit']||null:null,'include':_0x75601[_0xd5a5('0x17')]?_0x75601[_0xd5a5('0x17')]['include']?_[_0xd5a5('0x1a')](_0x75601[_0xd5a5('0x17')][_0xd5a5('0x1b')],function(_0x2e939b){return{'model':db[_0x2e939b[_0xd5a5('0x1c')]],'as':_0x2e939b['as'],'attributes':_0x2e939b[_0xd5a5('0x1d')],'include':_0x2e939b['include']?_[_0xd5a5('0x1a')](_0x2e939b['include'],function(_0xb3415e){return{'model':db[_0xb3415e[_0xd5a5('0x1c')]],'as':_0xb3415e['as'],'attributes':_0xb3415e[_0xd5a5('0x1d')],'include':_0xb3415e[_0xd5a5('0x1b')]?_['map'](_0xb3415e[_0xd5a5('0x1b')],function(_0x30d339){return{'model':db[_0x30d339[_0xd5a5('0x1c')]],'as':_0x30d339['as'],'attributes':_0x30d339[_0xd5a5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd5a5('0x1e')](function(_0x274871){logger[_0xd5a5('0x11')](_0xd5a5('0x14'),_0x75601);logger[_0xd5a5('0xb')]('GetZendeskAccount',_0x75601,JSON[_0xd5a5('0x1f')](_0x274871));_0x2c40ce(_0x274871);})[_0xd5a5('0x13')](function(_0x239ee7){logger[_0xd5a5('0xd')]('GetZendeskAccount',_0x239ee7[_0xd5a5('0x10')],_0x75601);_0x45677f(_0x36c327[_0xd5a5('0xd')](0x1f4,_0x239ee7[_0xd5a5('0x10')]));});});};exports['ShowZendeskAccount']=function(_0x375941){var _0x1f89ef=this;return new Promise(function(_0x40afa5,_0x16594a){return db['ZendeskAccount'][_0xd5a5('0x20')]({'raw':_0x375941[_0xd5a5('0x17')]?_0x375941[_0xd5a5('0x17')][_0xd5a5('0x18')]===undefined?!![]:![]:!![],'where':_0x375941[_0xd5a5('0x17')]?_0x375941[_0xd5a5('0x17')][_0xd5a5('0x19')]||null:null,'attributes':_0x375941[_0xd5a5('0x17')]?_0x375941[_0xd5a5('0x17')][_0xd5a5('0x1d')]||null:null,'include':_0x375941[_0xd5a5('0x17')]?_0x375941['options'][_0xd5a5('0x1b')]?_['map'](_0x375941[_0xd5a5('0x17')]['include'],function(_0x30fd78){return{'model':db[_0x30fd78[_0xd5a5('0x1c')]],'as':_0x30fd78['as'],'attributes':_0x30fd78[_0xd5a5('0x1d')],'include':_0x30fd78[_0xd5a5('0x1b')]?_[_0xd5a5('0x1a')](_0x30fd78['include'],function(_0x17c7cb){return{'model':db[_0x17c7cb[_0xd5a5('0x1c')]],'as':_0x17c7cb['as'],'attributes':_0x17c7cb[_0xd5a5('0x1d')],'include':_0x17c7cb[_0xd5a5('0x1b')]?_['map'](_0x17c7cb[_0xd5a5('0x1b')],function(_0x2099f1){return{'model':db[_0x2099f1[_0xd5a5('0x1c')]],'as':_0x2099f1['as'],'attributes':_0x2099f1['attributes']};}):[]};}):[]};}):[]:[]})[_0xd5a5('0x1e')](function(_0x1a996d){logger['info'](_0xd5a5('0x21'),_0x375941);logger[_0xd5a5('0xb')]('ShowZendeskAccount',_0x375941,JSON[_0xd5a5('0x1f')](_0x1a996d));_0x40afa5(_0x1a996d);})[_0xd5a5('0x13')](function(_0x1a4d7c){logger[_0xd5a5('0xd')](_0xd5a5('0x21'),_0x1a4d7c[_0xd5a5('0x10')],_0x375941);_0x16594a(_0x1f89ef[_0xd5a5('0xd')](0x1f4,_0x1a4d7c[_0xd5a5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index c97095e..479be63 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 _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(_0x1cd705,_0x1710ba){var _0x18410c=function(_0x2716cc){while(--_0x2716cc){_0x1cd705['push'](_0x1cd705['shift']());}};_0x18410c(++_0x1710ba);}(_0x5c00,0x17e));var _0x05c0=function(_0x3dacc3,_0x3a475f){_0x3dacc3=_0x3dacc3-0x0;var _0x3ed9a5=_0x5c00[_0x3dacc3];return _0x3ed9a5;};'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 +var _0xcb91=['get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','create','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller'];(function(_0x51e897,_0x3d9a7e){var _0x54a1b8=function(_0x32089d){while(--_0x32089d){_0x51e897['push'](_0x51e897['shift']());}};_0x54a1b8(++_0x3d9a7e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0xcb91[_0x259d17];return _0x407535;};'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['getFields']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0x7')]('/:id/descriptions',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0x7')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x1cb9('0x10')]);router[_0x1cb9('0x11')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['setTags']);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);router[_0x1cb9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x16')]);module[_0x1cb9('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 6f924d5..6985404 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 _0xb180=['exports','STRING','sequelize'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0xb180,0x95));var _0x0b18=function(_0x12fabc,_0x3bc89d){_0x12fabc=_0x12fabc-0x0;var _0x4c07fb=_0xb180[_0x12fabc];return _0x4c07fb;};'use strict';var Sequelize=require(_0x0b18('0x0'));module[_0x0b18('0x1')]={'name':{'type':Sequelize[_0x0b18('0x2')]},'description':{'type':Sequelize[_0x0b18('0x2')]}}; \ No newline at end of file +var _0x2b83=['sequelize','exports','STRING'];(function(_0x211664,_0x1282c7){var _0x53ff61=function(_0x387f7a){while(--_0x387f7a){_0x211664['push'](_0x211664['shift']());}};_0x53ff61(++_0x1282c7);}(_0x2b83,0x14a));var _0x32b8=function(_0x5c0f18,_0x5f0394){_0x5c0f18=_0x5c0f18-0x0;var _0x4dad1a=_0x2b83[_0x5c0f18];return _0x4dad1a;};'use strict';var Sequelize=require(_0x32b8('0x0'));module[_0x32b8('0x1')]={'name':{'type':Sequelize[_0x32b8('0x2')]},'description':{'type':Sequelize[_0x32b8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index c4f319a..4ffacad 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 _0xccde=['util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','ZendeskConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','merge','find','create','body','findOne','ZendeskField','hasOwnProperty','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x568850,_0x419e01){var _0x107524=function(_0x47127a){while(--_0x47127a){_0x568850['push'](_0x568850['shift']());}};_0x107524(++_0x419e01);}(_0xccde,0x14a));var _0xeccd=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0xccde[_0x581960];return _0x4ee892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeccd('0x0'));var zipdir=require(_0xeccd('0x1'));var jsonpatch=require(_0xeccd('0x2'));var rp=require('request-promise');var moment=require(_0xeccd('0x3'));var BPromise=require(_0xeccd('0x4'));var Mustache=require(_0xeccd('0x5'));var util=require(_0xeccd('0x6'));var path=require(_0xeccd('0x7'));var sox=require(_0xeccd('0x8'));var csv=require('to-csv');var ejs=require(_0xeccd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeccd('0xa'));var squel=require(_0xeccd('0xb'));var crypto=require(_0xeccd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeccd('0xd'));var querystring=require(_0xeccd('0xe'));var Papa=require(_0xeccd('0xf'));var Redis=require(_0xeccd('0x10'));var authService=require(_0xeccd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeccd('0x12'));var hardwareService=require(_0xeccd('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xeccd('0x14'));var licenseUtil=require(_0xeccd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38d693,_0x55d7ad){_0x55d7ad=_0x55d7ad||0xcc;return function(_0x1a5d4e){if(_0x1a5d4e){return _0x38d693[_0xeccd('0x16')](_0x55d7ad);}return _0x38d693['status'](_0x55d7ad)[_0xeccd('0x17')]();};}function respondWithResult(_0x48cae1,_0x2630f9){_0x2630f9=_0x2630f9||0xc8;return function(_0x24ab3a){if(_0x24ab3a){return _0x48cae1[_0xeccd('0x18')](_0x2630f9)[_0xeccd('0x19')](_0x24ab3a);}};}function respondWithFilteredResult(_0x3402ef,_0x450a4e){return function(_0x53d484){if(_0x53d484){var _0x2e5537=typeof _0x450a4e[_0xeccd('0x1a')]===_0xeccd('0x1b')&&typeof _0x450a4e['limit']==='undefined';var _0x592560=_0x53d484[_0xeccd('0x1c')];var _0x2986d9=_0x2e5537?0x0:_0x450a4e[_0xeccd('0x1a')];var _0x251515=_0x2e5537?_0x53d484[_0xeccd('0x1c')]:_0x450a4e['offset']+_0x450a4e['limit'];var _0x5b2fa1;if(_0x251515>=_0x592560){_0x251515=_0x592560;_0x5b2fa1=0xc8;}else{_0x5b2fa1=0xce;}_0x3402ef[_0xeccd('0x18')](_0x5b2fa1);return _0x3402ef[_0xeccd('0x1d')](_0xeccd('0x1e'),_0x2986d9+'-'+_0x251515+'/'+_0x592560)[_0xeccd('0x19')](_0x53d484);}return null;};}function patchUpdates(_0x759435){return function(_0x7b4e79){try{jsonpatch['apply'](_0x7b4e79,_0x759435,!![]);}catch(_0x36743e){return BPromise[_0xeccd('0x1f')](_0x36743e);}return _0x7b4e79[_0xeccd('0x20')]();};}function saveUpdates(_0x5cb3cb,_0x541044){return function(_0xe35047){if(_0xe35047){return _0xe35047[_0xeccd('0x21')](_0x5cb3cb)['then'](function(_0x18b76c){return _0x18b76c;});}return null;};}function removeEntity(_0x4ea3d8,_0x2c5f9b){return function(_0x34d6ac){if(_0x34d6ac){return _0x34d6ac[_0xeccd('0x22')]()[_0xeccd('0x23')](function(){_0x4ea3d8[_0xeccd('0x18')](0xcc)[_0xeccd('0x17')]();});}};}function handleEntityNotFound(_0x50d178,_0x5af5a8){return function(_0x21f91e){if(!_0x21f91e){_0x50d178[_0xeccd('0x16')](0x194);}return _0x21f91e;};}function handleError(_0x4c071c,_0x3c7719){_0x3c7719=_0x3c7719||0x1f4;return function(_0x389382){logger[_0xeccd('0x24')](_0x389382[_0xeccd('0x25')]);if(_0x389382['name']){delete _0x389382[_0xeccd('0x26')];}_0x4c071c[_0xeccd('0x18')](_0x3c7719)[_0xeccd('0x27')](_0x389382);};}exports[_0xeccd('0x28')]=function(_0x162113,_0x2b0882){var _0xe17db4={},_0xaf0679={},_0x589fd8={'count':0x0,'rows':[]};var _0x4a2bb3=_[_0xeccd('0x29')](db[_0xeccd('0x2a')]['rawAttributes'],function(_0x9dbb0d){return{'name':_0x9dbb0d[_0xeccd('0x2b')],'type':_0x9dbb0d[_0xeccd('0x2c')][_0xeccd('0x2d')]};});_0xaf0679[_0xeccd('0x2e')]=_[_0xeccd('0x29')](_0x4a2bb3,_0xeccd('0x26'));_0xaf0679['query']=_[_0xeccd('0x2f')](_0x162113[_0xeccd('0x30')]);_0xaf0679[_0xeccd('0x31')]=_[_0xeccd('0x32')](_0xaf0679[_0xeccd('0x2e')],_0xaf0679['query']);_0xe17db4[_0xeccd('0x33')]=_[_0xeccd('0x32')](_0xaf0679[_0xeccd('0x2e')],qs[_0xeccd('0x34')](_0x162113['query']['fields']));_0xe17db4[_0xeccd('0x33')]=_0xe17db4[_0xeccd('0x33')][_0xeccd('0x35')]?_0xe17db4['attributes']:_0xaf0679[_0xeccd('0x2e')];if(!_0x162113['query']['hasOwnProperty'](_0xeccd('0x36'))){_0xe17db4[_0xeccd('0x37')]=qs[_0xeccd('0x37')](_0x162113['query']['limit']);_0xe17db4[_0xeccd('0x1a')]=qs[_0xeccd('0x1a')](_0x162113[_0xeccd('0x30')][_0xeccd('0x1a')]);}_0xe17db4[_0xeccd('0x38')]=qs[_0xeccd('0x39')](_0x162113[_0xeccd('0x30')][_0xeccd('0x39')]);_0xe17db4[_0xeccd('0x3a')]=qs[_0xeccd('0x31')](_[_0xeccd('0x3b')](_0x162113[_0xeccd('0x30')],_0xaf0679[_0xeccd('0x31')]),_0x4a2bb3);if(_0x162113[_0xeccd('0x30')][_0xeccd('0x3c')]){_0xe17db4[_0xeccd('0x3a')]=_['merge'](_0xe17db4[_0xeccd('0x3a')],{'$or':_[_0xeccd('0x29')](_0x4a2bb3,function(_0x70bba8){if(_0x70bba8[_0xeccd('0x2c')]!==_0xeccd('0x3d')){var _0x3126db={};_0x3126db[_0x70bba8[_0xeccd('0x26')]]={'$like':'%'+_0x162113['query'][_0xeccd('0x3c')]+'%'};return _0x3126db;}})});}_0xe17db4=_['merge']({},_0xe17db4,_0x162113[_0xeccd('0x3e')]);var _0x7af05a={'where':_0xe17db4[_0xeccd('0x3a')]};return db[_0xeccd('0x2a')][_0xeccd('0x1c')](_0x7af05a)['then'](function(_0x414670){_0x589fd8['count']=_0x414670;if(_0x162113[_0xeccd('0x30')][_0xeccd('0x3f')]){_0xe17db4[_0xeccd('0x40')]=[{'all':!![]}];}return db[_0xeccd('0x2a')][_0xeccd('0x41')](_0xe17db4);})['then'](function(_0x46cf52){_0x589fd8['rows']=_0x46cf52;return _0x589fd8;})['then'](respondWithFilteredResult(_0x2b0882,_0xe17db4))[_0xeccd('0x42')](handleError(_0x2b0882,null));};exports[_0xeccd('0x43')]=function(_0x419c93,_0x49e97f){var _0x970a5d={'raw':![],'where':{'id':_0x419c93[_0xeccd('0x44')]['id']}},_0x4f9f87={};_0x4f9f87['model']=_[_0xeccd('0x2f')](db['ZendeskConfiguration'][_0xeccd('0x45')]);_0x4f9f87[_0xeccd('0x30')]=_['keys'](_0x419c93[_0xeccd('0x30')]);_0x4f9f87[_0xeccd('0x31')]=_[_0xeccd('0x32')](_0x4f9f87[_0xeccd('0x2e')],_0x4f9f87['query']);_0x970a5d['attributes']=_['intersection'](_0x4f9f87[_0xeccd('0x2e')],qs['fields'](_0x419c93['query'][_0xeccd('0x34')]));_0x970a5d['attributes']=_0x970a5d[_0xeccd('0x33')][_0xeccd('0x35')]?_0x970a5d['attributes']:_0x4f9f87[_0xeccd('0x2e')];if(_0x419c93[_0xeccd('0x30')][_0xeccd('0x3f')]){_0x970a5d[_0xeccd('0x40')]=[{'all':!![]}];}_0x970a5d=_[_0xeccd('0x46')]({},_0x970a5d,_0x419c93['options']);return db[_0xeccd('0x2a')][_0xeccd('0x47')](_0x970a5d)[_0xeccd('0x23')](handleEntityNotFound(_0x49e97f,null))['then'](respondWithResult(_0x49e97f,null))[_0xeccd('0x42')](handleError(_0x49e97f,null));};exports['create']=function(_0xf5229f,_0xa3a45d){return db[_0xeccd('0x2a')][_0xeccd('0x48')](_0xf5229f['body'],{})[_0xeccd('0x23')](respondWithResult(_0xa3a45d,0xc9))[_0xeccd('0x42')](handleError(_0xa3a45d,null));};exports[_0xeccd('0x21')]=function(_0x5392a1,_0x21d072){if(_0x5392a1[_0xeccd('0x49')]['id']){delete _0x5392a1[_0xeccd('0x49')]['id'];}return db['ZendeskConfiguration'][_0xeccd('0x47')]({'where':{'id':_0x5392a1[_0xeccd('0x44')]['id']}})['then'](handleEntityNotFound(_0x21d072,null))['then'](saveUpdates(_0x5392a1['body'],null))[_0xeccd('0x23')](respondWithResult(_0x21d072,null))[_0xeccd('0x42')](handleError(_0x21d072,null));};exports['destroy']=function(_0x1f2fac,_0x8829b3){return db['ZendeskConfiguration'][_0xeccd('0x47')]({'where':{'id':_0x1f2fac[_0xeccd('0x44')]['id']}})[_0xeccd('0x23')](handleEntityNotFound(_0x8829b3,null))[_0xeccd('0x23')](removeEntity(_0x8829b3,null))[_0xeccd('0x42')](handleError(_0x8829b3,null));};exports['getFields']=function(_0x398efe,_0x31d0c1,_0x214915){var _0xb07b75={};var _0x3e8345={};var _0x591a4e;var _0x594a61;return db[_0xeccd('0x2a')][_0xeccd('0x4a')]({'where':{'id':_0x398efe[_0xeccd('0x44')]['id']}})[_0xeccd('0x23')](handleEntityNotFound(_0x31d0c1,null))[_0xeccd('0x23')](function(_0x2241fd){if(_0x2241fd){_0x591a4e=_0x2241fd;_0x3e8345[_0xeccd('0x2e')]=_['keys'](db[_0xeccd('0x4b')][_0xeccd('0x45')]);_0x3e8345[_0xeccd('0x30')]=_[_0xeccd('0x2f')](_0x398efe['query']);_0x3e8345[_0xeccd('0x31')]=_[_0xeccd('0x32')](_0x3e8345['model'],_0x3e8345[_0xeccd('0x30')]);_0xb07b75['attributes']=_[_0xeccd('0x32')](_0x3e8345[_0xeccd('0x2e')],qs[_0xeccd('0x34')](_0x398efe[_0xeccd('0x30')][_0xeccd('0x34')]));_0xb07b75[_0xeccd('0x33')]=_0xb07b75[_0xeccd('0x33')][_0xeccd('0x35')]?_0xb07b75[_0xeccd('0x33')]:_0x3e8345[_0xeccd('0x2e')];_0xb07b75[_0xeccd('0x38')]=qs[_0xeccd('0x39')](_0x398efe[_0xeccd('0x30')][_0xeccd('0x39')]);_0xb07b75[_0xeccd('0x3a')]=qs[_0xeccd('0x31')](_['pick'](_0x398efe[_0xeccd('0x30')],_0x3e8345[_0xeccd('0x31')]));if(_0x398efe['query']['filter']){_0xb07b75['where']=_[_0xeccd('0x46')](_0xb07b75[_0xeccd('0x3a')],{'$or':_[_0xeccd('0x29')](_0xb07b75[_0xeccd('0x33')],function(_0x55a6e8){var _0x264d03={};_0x264d03[_0x55a6e8]={'$like':'%'+_0x398efe[_0xeccd('0x30')][_0xeccd('0x3c')]+'%'};return _0x264d03;})});}_0xb07b75=_[_0xeccd('0x46')]({},_0xb07b75,_0x398efe['options']);return _0x591a4e['getFields'](_0xb07b75);}})['then'](function(_0x3d28ba){if(_0x3d28ba){_0x594a61=_0x3d28ba[_0xeccd('0x35')];if(!_0x398efe['query'][_0xeccd('0x4c')]('nolimit')){_0xb07b75[_0xeccd('0x37')]=qs[_0xeccd('0x37')](_0x398efe[_0xeccd('0x30')][_0xeccd('0x37')]);_0xb07b75['offset']=qs[_0xeccd('0x1a')](_0x398efe[_0xeccd('0x30')][_0xeccd('0x1a')]);}return _0x591a4e[_0xeccd('0x4d')](_0xb07b75);}})[_0xeccd('0x23')](function(_0x32f8df){if(_0x32f8df){return _0x32f8df?{'count':_0x594a61,'rows':_0x32f8df}:null;}})[_0xeccd('0x23')](respondWithResult(_0x31d0c1,null))['catch'](handleError(_0x31d0c1,null));};exports[_0xeccd('0x4e')]=function(_0x2e29f8,_0x57616f,_0xde00db){var _0x78262c={};var _0x4cfac9={};var _0x2be9cc;var _0x22067c;return db[_0xeccd('0x2a')][_0xeccd('0x4a')]({'where':{'id':_0x2e29f8[_0xeccd('0x44')]['id']}})[_0xeccd('0x23')](handleEntityNotFound(_0x57616f,null))[_0xeccd('0x23')](function(_0x5dd87f){if(_0x5dd87f){_0x2be9cc=_0x5dd87f;_0x4cfac9[_0xeccd('0x2e')]=_[_0xeccd('0x2f')](db[_0xeccd('0x4b')][_0xeccd('0x45')]);_0x4cfac9[_0xeccd('0x30')]=_['keys'](_0x2e29f8[_0xeccd('0x30')]);_0x4cfac9[_0xeccd('0x31')]=_[_0xeccd('0x32')](_0x4cfac9[_0xeccd('0x2e')],_0x4cfac9[_0xeccd('0x30')]);_0x78262c[_0xeccd('0x33')]=_[_0xeccd('0x32')](_0x4cfac9[_0xeccd('0x2e')],qs[_0xeccd('0x34')](_0x2e29f8[_0xeccd('0x30')][_0xeccd('0x34')]));_0x78262c['attributes']=_0x78262c[_0xeccd('0x33')]['length']?_0x78262c['attributes']:_0x4cfac9['model'];_0x78262c[_0xeccd('0x38')]=qs['sort'](_0x2e29f8['query'][_0xeccd('0x39')]);_0x78262c[_0xeccd('0x3a')]=qs[_0xeccd('0x31')](_['pick'](_0x2e29f8['query'],_0x4cfac9[_0xeccd('0x31')]));if(_0x2e29f8['query'][_0xeccd('0x3c')]){_0x78262c[_0xeccd('0x3a')]=_['merge'](_0x78262c['where'],{'$or':_[_0xeccd('0x29')](_0x78262c[_0xeccd('0x33')],function(_0x4d65db){var _0x1f9834={};_0x1f9834[_0x4d65db]={'$like':'%'+_0x2e29f8[_0xeccd('0x30')][_0xeccd('0x3c')]+'%'};return _0x1f9834;})});}_0x78262c=_[_0xeccd('0x46')]({},_0x78262c,_0x2e29f8['options']);return _0x2be9cc[_0xeccd('0x4e')](_0x78262c);}})[_0xeccd('0x23')](function(_0x337314){if(_0x337314){_0x22067c=_0x337314[_0xeccd('0x35')];if(!_0x2e29f8[_0xeccd('0x30')][_0xeccd('0x4c')](_0xeccd('0x36'))){_0x78262c[_0xeccd('0x37')]=qs[_0xeccd('0x37')](_0x2e29f8['query'][_0xeccd('0x37')]);_0x78262c[_0xeccd('0x1a')]=qs['offset'](_0x2e29f8[_0xeccd('0x30')][_0xeccd('0x1a')]);}return _0x2be9cc[_0xeccd('0x4e')](_0x78262c);}})[_0xeccd('0x23')](function(_0x3c9f33){if(_0x3c9f33){return _0x3c9f33?{'count':_0x22067c,'rows':_0x3c9f33}:null;}})[_0xeccd('0x23')](respondWithResult(_0x57616f,null))[_0xeccd('0x42')](handleError(_0x57616f,null));};exports[_0xeccd('0x4f')]=function(_0x1b4338,_0x94a144,_0x2893c9){var _0x4623e3={};var _0x2a03f8={};var _0xa427ba;var _0x5aed2e;return db['ZendeskConfiguration'][_0xeccd('0x4a')]({'where':{'id':_0x1b4338['params']['id']}})[_0xeccd('0x23')](handleEntityNotFound(_0x94a144,null))[_0xeccd('0x23')](function(_0x5eec66){if(_0x5eec66){_0xa427ba=_0x5eec66;_0x2a03f8[_0xeccd('0x2e')]=_[_0xeccd('0x2f')](db[_0xeccd('0x4b')][_0xeccd('0x45')]);_0x2a03f8[_0xeccd('0x30')]=_[_0xeccd('0x2f')](_0x1b4338[_0xeccd('0x30')]);_0x2a03f8[_0xeccd('0x31')]=_['intersection'](_0x2a03f8[_0xeccd('0x2e')],_0x2a03f8['query']);_0x4623e3[_0xeccd('0x33')]=_[_0xeccd('0x32')](_0x2a03f8[_0xeccd('0x2e')],qs[_0xeccd('0x34')](_0x1b4338['query'][_0xeccd('0x34')]));_0x4623e3[_0xeccd('0x33')]=_0x4623e3[_0xeccd('0x33')]['length']?_0x4623e3['attributes']:_0x2a03f8[_0xeccd('0x2e')];_0x4623e3[_0xeccd('0x38')]=qs[_0xeccd('0x39')](_0x1b4338[_0xeccd('0x30')][_0xeccd('0x39')]);_0x4623e3['where']=qs[_0xeccd('0x31')](_[_0xeccd('0x3b')](_0x1b4338['query'],_0x2a03f8['filters']));if(_0x1b4338['query'][_0xeccd('0x3c')]){_0x4623e3[_0xeccd('0x3a')]=_[_0xeccd('0x46')](_0x4623e3[_0xeccd('0x3a')],{'$or':_[_0xeccd('0x29')](_0x4623e3[_0xeccd('0x33')],function(_0x211ebd){var _0x3c8079={};_0x3c8079[_0x211ebd]={'$like':'%'+_0x1b4338[_0xeccd('0x30')]['filter']+'%'};return _0x3c8079;})});}_0x4623e3=_[_0xeccd('0x46')]({},_0x4623e3,_0x1b4338[_0xeccd('0x3e')]);return _0xa427ba[_0xeccd('0x4f')](_0x4623e3);}})[_0xeccd('0x23')](function(_0x5e7cc5){if(_0x5e7cc5){_0x5aed2e=_0x5e7cc5[_0xeccd('0x35')];if(!_0x1b4338[_0xeccd('0x30')]['hasOwnProperty'](_0xeccd('0x36'))){_0x4623e3['limit']=qs[_0xeccd('0x37')](_0x1b4338[_0xeccd('0x30')][_0xeccd('0x37')]);_0x4623e3[_0xeccd('0x1a')]=qs[_0xeccd('0x1a')](_0x1b4338[_0xeccd('0x30')][_0xeccd('0x1a')]);}return _0xa427ba[_0xeccd('0x4f')](_0x4623e3);}})[_0xeccd('0x23')](function(_0x19d54c){if(_0x19d54c){return _0x19d54c?{'count':_0x5aed2e,'rows':_0x19d54c}:null;}})[_0xeccd('0x23')](respondWithResult(_0x94a144,null))['catch'](handleError(_0x94a144,null));};exports['getTags']=function(_0x135aa5,_0x1edf8d,_0x44c7a8){var _0x228430={};var _0x376f32={};var _0x59f35e;var _0x1c9da3;return db['ZendeskConfiguration'][_0xeccd('0x4a')]({'where':{'id':_0x135aa5['params']['id']}})[_0xeccd('0x23')](handleEntityNotFound(_0x1edf8d,null))[_0xeccd('0x23')](function(_0x316997){if(_0x316997){_0x59f35e=_0x316997;_0x376f32['model']=_[_0xeccd('0x2f')](db[_0xeccd('0x50')][_0xeccd('0x45')]);_0x376f32[_0xeccd('0x30')]=_['keys'](_0x135aa5[_0xeccd('0x30')]);_0x376f32['filters']=_[_0xeccd('0x32')](_0x376f32['model'],_0x376f32[_0xeccd('0x30')]);_0x228430[_0xeccd('0x33')]=_[_0xeccd('0x32')](_0x376f32[_0xeccd('0x2e')],qs[_0xeccd('0x34')](_0x135aa5[_0xeccd('0x30')][_0xeccd('0x34')]));_0x228430[_0xeccd('0x33')]=_0x228430[_0xeccd('0x33')][_0xeccd('0x35')]?_0x228430[_0xeccd('0x33')]:_0x376f32[_0xeccd('0x2e')];_0x228430[_0xeccd('0x38')]=qs[_0xeccd('0x39')](_0x135aa5[_0xeccd('0x30')][_0xeccd('0x39')]);_0x228430['where']=qs['filters'](_[_0xeccd('0x3b')](_0x135aa5[_0xeccd('0x30')],_0x376f32['filters']));if(_0x135aa5[_0xeccd('0x30')][_0xeccd('0x3c')]){_0x228430[_0xeccd('0x3a')]=_[_0xeccd('0x46')](_0x228430[_0xeccd('0x3a')],{'$or':_[_0xeccd('0x29')](_0x228430['attributes'],function(_0x7847ec){var _0x58be51={};_0x58be51[_0x7847ec]={'$like':'%'+_0x135aa5[_0xeccd('0x30')][_0xeccd('0x3c')]+'%'};return _0x58be51;})});}_0x228430=_[_0xeccd('0x46')]({},_0x228430,_0x135aa5['options']);return _0x59f35e[_0xeccd('0x51')](_0x228430);}})[_0xeccd('0x23')](function(_0x3b93f7){if(_0x3b93f7){_0x1c9da3=_0x3b93f7[_0xeccd('0x35')];if(!_0x135aa5[_0xeccd('0x30')][_0xeccd('0x4c')](_0xeccd('0x36'))){_0x228430[_0xeccd('0x37')]=qs[_0xeccd('0x37')](_0x135aa5['query'][_0xeccd('0x37')]);_0x228430[_0xeccd('0x1a')]=qs[_0xeccd('0x1a')](_0x135aa5[_0xeccd('0x30')][_0xeccd('0x1a')]);}return _0x59f35e[_0xeccd('0x51')](_0x228430);}})['then'](function(_0xc4b6a5){if(_0xc4b6a5){return _0xc4b6a5?{'count':_0x1c9da3,'rows':_0xc4b6a5}:null;}})['then'](respondWithResult(_0x1edf8d,null))[_0xeccd('0x42')](handleError(_0x1edf8d,null));};exports[_0xeccd('0x52')]=function(_0x18e1e9,_0x2a2c8b,_0x20cf97){if(_0x18e1e9[_0xeccd('0x49')]['id']){delete _0x18e1e9[_0xeccd('0x49')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x18e1e9['params']['id']}})['then'](handleEntityNotFound(_0x2a2c8b,null))[_0xeccd('0x23')](function(_0x506282){if(_0x506282){return _0x506282[_0xeccd('0x52')](_0x18e1e9['body'][_0xeccd('0x53')]||[]);}return null;})[_0xeccd('0x23')](respondWithResult(_0x2a2c8b,null))[_0xeccd('0x42')](handleError(_0x2a2c8b,null));}; \ No newline at end of file +var _0xf5e3=['catch','show','find','create','body','params','getFields','ZendeskField','hasOwnProperty','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','type','filter','options','then','includeAll','include','findAll','rows'];(function(_0x181398,_0x281eae){var _0x135f1d=function(_0x1f976e){while(--_0x1f976e){_0x181398['push'](_0x181398['shift']());}};_0x135f1d(++_0x281eae);}(_0xf5e3,0x1af));var _0x3f5e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf5e3[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x3f5e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f5e('0x1'));var jsonpatch=require(_0x3f5e('0x2'));var rp=require(_0x3f5e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3f5e('0x4'));var util=require(_0x3f5e('0x5'));var path=require('path');var sox=require(_0x3f5e('0x6'));var csv=require('to-csv');var ejs=require(_0x3f5e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3f5e('0x8'));var jsforce=require(_0x3f5e('0x9'));var deskjs=require(_0x3f5e('0xa'));var toCsv=require(_0x3f5e('0xb'));var querystring=require(_0x3f5e('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f5e('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f5e('0xe'));var logger=require(_0x3f5e('0xf'))('api');var utils=require(_0x3f5e('0x10'));var config=require(_0x3f5e('0x11'));var licenseUtil=require(_0x3f5e('0x12'));var db=require(_0x3f5e('0x13'))['db'];function respondWithStatusCode(_0x210bb5,_0x2bf439){_0x2bf439=_0x2bf439||0xcc;return function(_0x28d8ae){if(_0x28d8ae){return _0x210bb5[_0x3f5e('0x14')](_0x2bf439);}return _0x210bb5[_0x3f5e('0x15')](_0x2bf439)[_0x3f5e('0x16')]();};}function respondWithResult(_0x3384dc,_0x15d3a6){_0x15d3a6=_0x15d3a6||0xc8;return function(_0x183a26){if(_0x183a26){return _0x3384dc[_0x3f5e('0x15')](_0x15d3a6)['json'](_0x183a26);}};}function respondWithFilteredResult(_0x36a7ae,_0x396447){return function(_0x5631e8){if(_0x5631e8){var _0x49b451=typeof _0x396447[_0x3f5e('0x17')]==='undefined'&&typeof _0x396447[_0x3f5e('0x18')]===_0x3f5e('0x19');var _0x2c2da1=_0x5631e8['count'];var _0x437895=_0x49b451?0x0:_0x396447[_0x3f5e('0x17')];var _0x39e8eb=_0x49b451?_0x5631e8[_0x3f5e('0x1a')]:_0x396447[_0x3f5e('0x17')]+_0x396447['limit'];var _0x3a33f5;if(_0x39e8eb>=_0x2c2da1){_0x39e8eb=_0x2c2da1;_0x3a33f5=0xc8;}else{_0x3a33f5=0xce;}_0x36a7ae['status'](_0x3a33f5);return _0x36a7ae[_0x3f5e('0x1b')](_0x3f5e('0x1c'),_0x437895+'-'+_0x39e8eb+'/'+_0x2c2da1)[_0x3f5e('0x1d')](_0x5631e8);}return null;};}function patchUpdates(_0x50bfbb){return function(_0x2d81ca){try{jsonpatch[_0x3f5e('0x1e')](_0x2d81ca,_0x50bfbb,!![]);}catch(_0x1b171d){return BPromise[_0x3f5e('0x1f')](_0x1b171d);}return _0x2d81ca[_0x3f5e('0x20')]();};}function saveUpdates(_0x5043b2,_0x4c9097){return function(_0x156c01){if(_0x156c01){return _0x156c01[_0x3f5e('0x21')](_0x5043b2)['then'](function(_0x3cfe84){return _0x3cfe84;});}return null;};}function removeEntity(_0x50f6b1,_0x1df7cb){return function(_0x3d479c){if(_0x3d479c){return _0x3d479c[_0x3f5e('0x22')]()['then'](function(){_0x50f6b1[_0x3f5e('0x15')](0xcc)[_0x3f5e('0x16')]();});}};}function handleEntityNotFound(_0x2c1192,_0x5641e8){return function(_0x21fc55){if(!_0x21fc55){_0x2c1192[_0x3f5e('0x14')](0x194);}return _0x21fc55;};}function handleError(_0x5d4d36,_0x10f617){_0x10f617=_0x10f617||0x1f4;return function(_0xb8e39){logger[_0x3f5e('0x23')](_0xb8e39[_0x3f5e('0x24')]);if(_0xb8e39[_0x3f5e('0x25')]){delete _0xb8e39[_0x3f5e('0x25')];}_0x5d4d36['status'](_0x10f617)[_0x3f5e('0x26')](_0xb8e39);};}exports[_0x3f5e('0x27')]=function(_0x2c3008,_0x548e76){var _0x2fe68b={},_0x409873={},_0x456e49={'count':0x0,'rows':[]};var _0x69a9b0=_[_0x3f5e('0x28')](db[_0x3f5e('0x29')][_0x3f5e('0x2a')],function(_0x574a2c){return{'name':_0x574a2c[_0x3f5e('0x2b')],'type':_0x574a2c['type'][_0x3f5e('0x2c')]};});_0x409873[_0x3f5e('0x2d')]=_[_0x3f5e('0x28')](_0x69a9b0,'name');_0x409873[_0x3f5e('0x2e')]=_[_0x3f5e('0x2f')](_0x2c3008[_0x3f5e('0x2e')]);_0x409873['filters']=_[_0x3f5e('0x30')](_0x409873[_0x3f5e('0x2d')],_0x409873[_0x3f5e('0x2e')]);_0x2fe68b[_0x3f5e('0x31')]=_[_0x3f5e('0x30')](_0x409873['model'],qs['fields'](_0x2c3008['query'][_0x3f5e('0x32')]));_0x2fe68b[_0x3f5e('0x31')]=_0x2fe68b['attributes'][_0x3f5e('0x33')]?_0x2fe68b[_0x3f5e('0x31')]:_0x409873[_0x3f5e('0x2d')];if(!_0x2c3008[_0x3f5e('0x2e')]['hasOwnProperty'](_0x3f5e('0x34'))){_0x2fe68b['limit']=qs[_0x3f5e('0x18')](_0x2c3008[_0x3f5e('0x2e')]['limit']);_0x2fe68b['offset']=qs[_0x3f5e('0x17')](_0x2c3008[_0x3f5e('0x2e')]['offset']);}_0x2fe68b[_0x3f5e('0x35')]=qs['sort'](_0x2c3008[_0x3f5e('0x2e')][_0x3f5e('0x36')]);_0x2fe68b[_0x3f5e('0x37')]=qs[_0x3f5e('0x38')](_[_0x3f5e('0x39')](_0x2c3008[_0x3f5e('0x2e')],_0x409873[_0x3f5e('0x38')]),_0x69a9b0);if(_0x2c3008[_0x3f5e('0x2e')]['filter']){_0x2fe68b[_0x3f5e('0x37')]=_[_0x3f5e('0x3a')](_0x2fe68b['where'],{'$or':_[_0x3f5e('0x28')](_0x69a9b0,function(_0x7bdc8a){if(_0x7bdc8a[_0x3f5e('0x3b')]!=='VIRTUAL'){var _0x1d61a9={};_0x1d61a9[_0x7bdc8a[_0x3f5e('0x25')]]={'$like':'%'+_0x2c3008['query'][_0x3f5e('0x3c')]+'%'};return _0x1d61a9;}})});}_0x2fe68b=_[_0x3f5e('0x3a')]({},_0x2fe68b,_0x2c3008[_0x3f5e('0x3d')]);var _0x5c49ca={'where':_0x2fe68b[_0x3f5e('0x37')]};return db[_0x3f5e('0x29')][_0x3f5e('0x1a')](_0x5c49ca)[_0x3f5e('0x3e')](function(_0x30a3ed){_0x456e49[_0x3f5e('0x1a')]=_0x30a3ed;if(_0x2c3008[_0x3f5e('0x2e')][_0x3f5e('0x3f')]){_0x2fe68b[_0x3f5e('0x40')]=[{'all':!![]}];}return db[_0x3f5e('0x29')][_0x3f5e('0x41')](_0x2fe68b);})[_0x3f5e('0x3e')](function(_0xfd8b83){_0x456e49[_0x3f5e('0x42')]=_0xfd8b83;return _0x456e49;})[_0x3f5e('0x3e')](respondWithFilteredResult(_0x548e76,_0x2fe68b))[_0x3f5e('0x43')](handleError(_0x548e76,null));};exports[_0x3f5e('0x44')]=function(_0x4c954a,_0x59c75f){var _0x1e40a4={'raw':![],'where':{'id':_0x4c954a['params']['id']}},_0x31cd83={};_0x31cd83[_0x3f5e('0x2d')]=_[_0x3f5e('0x2f')](db['ZendeskConfiguration'][_0x3f5e('0x2a')]);_0x31cd83[_0x3f5e('0x2e')]=_[_0x3f5e('0x2f')](_0x4c954a[_0x3f5e('0x2e')]);_0x31cd83['filters']=_[_0x3f5e('0x30')](_0x31cd83['model'],_0x31cd83['query']);_0x1e40a4['attributes']=_[_0x3f5e('0x30')](_0x31cd83['model'],qs[_0x3f5e('0x32')](_0x4c954a[_0x3f5e('0x2e')][_0x3f5e('0x32')]));_0x1e40a4[_0x3f5e('0x31')]=_0x1e40a4[_0x3f5e('0x31')][_0x3f5e('0x33')]?_0x1e40a4[_0x3f5e('0x31')]:_0x31cd83['model'];if(_0x4c954a['query']['includeAll']){_0x1e40a4[_0x3f5e('0x40')]=[{'all':!![]}];}_0x1e40a4=_['merge']({},_0x1e40a4,_0x4c954a[_0x3f5e('0x3d')]);return db['ZendeskConfiguration'][_0x3f5e('0x45')](_0x1e40a4)[_0x3f5e('0x3e')](handleEntityNotFound(_0x59c75f,null))[_0x3f5e('0x3e')](respondWithResult(_0x59c75f,null))[_0x3f5e('0x43')](handleError(_0x59c75f,null));};exports[_0x3f5e('0x46')]=function(_0x484cf3,_0x287548){return db['ZendeskConfiguration'][_0x3f5e('0x46')](_0x484cf3[_0x3f5e('0x47')],{})[_0x3f5e('0x3e')](respondWithResult(_0x287548,0xc9))[_0x3f5e('0x43')](handleError(_0x287548,null));};exports[_0x3f5e('0x21')]=function(_0x5fd4b,_0x4dbcb5){if(_0x5fd4b['body']['id']){delete _0x5fd4b[_0x3f5e('0x47')]['id'];}return db['ZendeskConfiguration'][_0x3f5e('0x45')]({'where':{'id':_0x5fd4b['params']['id']}})[_0x3f5e('0x3e')](handleEntityNotFound(_0x4dbcb5,null))['then'](saveUpdates(_0x5fd4b[_0x3f5e('0x47')],null))[_0x3f5e('0x3e')](respondWithResult(_0x4dbcb5,null))[_0x3f5e('0x43')](handleError(_0x4dbcb5,null));};exports[_0x3f5e('0x22')]=function(_0x33987f,_0x192f40){return db[_0x3f5e('0x29')][_0x3f5e('0x45')]({'where':{'id':_0x33987f[_0x3f5e('0x48')]['id']}})['then'](handleEntityNotFound(_0x192f40,null))[_0x3f5e('0x3e')](removeEntity(_0x192f40,null))[_0x3f5e('0x43')](handleError(_0x192f40,null));};exports[_0x3f5e('0x49')]=function(_0x3b6485,_0x2d1616,_0x375352){var _0x50a446={};var _0x52bba8={};var _0xe3195a;var _0x5eaba9;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3b6485['params']['id']}})[_0x3f5e('0x3e')](handleEntityNotFound(_0x2d1616,null))['then'](function(_0x1b2b01){if(_0x1b2b01){_0xe3195a=_0x1b2b01;_0x52bba8[_0x3f5e('0x2d')]=_[_0x3f5e('0x2f')](db[_0x3f5e('0x4a')][_0x3f5e('0x2a')]);_0x52bba8[_0x3f5e('0x2e')]=_[_0x3f5e('0x2f')](_0x3b6485['query']);_0x52bba8[_0x3f5e('0x38')]=_[_0x3f5e('0x30')](_0x52bba8[_0x3f5e('0x2d')],_0x52bba8[_0x3f5e('0x2e')]);_0x50a446[_0x3f5e('0x31')]=_[_0x3f5e('0x30')](_0x52bba8[_0x3f5e('0x2d')],qs['fields'](_0x3b6485['query']['fields']));_0x50a446[_0x3f5e('0x31')]=_0x50a446['attributes'][_0x3f5e('0x33')]?_0x50a446['attributes']:_0x52bba8[_0x3f5e('0x2d')];_0x50a446['order']=qs[_0x3f5e('0x36')](_0x3b6485[_0x3f5e('0x2e')]['sort']);_0x50a446[_0x3f5e('0x37')]=qs[_0x3f5e('0x38')](_['pick'](_0x3b6485['query'],_0x52bba8[_0x3f5e('0x38')]));if(_0x3b6485['query']['filter']){_0x50a446[_0x3f5e('0x37')]=_[_0x3f5e('0x3a')](_0x50a446['where'],{'$or':_[_0x3f5e('0x28')](_0x50a446[_0x3f5e('0x31')],function(_0x53168f){var _0x13f4a5={};_0x13f4a5[_0x53168f]={'$like':'%'+_0x3b6485[_0x3f5e('0x2e')][_0x3f5e('0x3c')]+'%'};return _0x13f4a5;})});}_0x50a446=_[_0x3f5e('0x3a')]({},_0x50a446,_0x3b6485[_0x3f5e('0x3d')]);return _0xe3195a[_0x3f5e('0x49')](_0x50a446);}})[_0x3f5e('0x3e')](function(_0x3df67a){if(_0x3df67a){_0x5eaba9=_0x3df67a[_0x3f5e('0x33')];if(!_0x3b6485[_0x3f5e('0x2e')][_0x3f5e('0x4b')](_0x3f5e('0x34'))){_0x50a446['limit']=qs[_0x3f5e('0x18')](_0x3b6485[_0x3f5e('0x2e')][_0x3f5e('0x18')]);_0x50a446[_0x3f5e('0x17')]=qs[_0x3f5e('0x17')](_0x3b6485['query'][_0x3f5e('0x17')]);}return _0xe3195a[_0x3f5e('0x49')](_0x50a446);}})[_0x3f5e('0x3e')](function(_0x385d67){if(_0x385d67){return _0x385d67?{'count':_0x5eaba9,'rows':_0x385d67}:null;}})[_0x3f5e('0x3e')](respondWithResult(_0x2d1616,null))[_0x3f5e('0x43')](handleError(_0x2d1616,null));};exports['getSubjects']=function(_0x88d0e0,_0x364aef,_0x4b519f){var _0x34d8c8={};var _0x59f064={};var _0x648db4;var _0x5f0705;return db[_0x3f5e('0x29')][_0x3f5e('0x4c')]({'where':{'id':_0x88d0e0['params']['id']}})[_0x3f5e('0x3e')](handleEntityNotFound(_0x364aef,null))[_0x3f5e('0x3e')](function(_0x387a5b){if(_0x387a5b){_0x648db4=_0x387a5b;_0x59f064['model']=_[_0x3f5e('0x2f')](db[_0x3f5e('0x4a')][_0x3f5e('0x2a')]);_0x59f064[_0x3f5e('0x2e')]=_[_0x3f5e('0x2f')](_0x88d0e0[_0x3f5e('0x2e')]);_0x59f064[_0x3f5e('0x38')]=_[_0x3f5e('0x30')](_0x59f064[_0x3f5e('0x2d')],_0x59f064[_0x3f5e('0x2e')]);_0x34d8c8[_0x3f5e('0x31')]=_[_0x3f5e('0x30')](_0x59f064[_0x3f5e('0x2d')],qs[_0x3f5e('0x32')](_0x88d0e0[_0x3f5e('0x2e')][_0x3f5e('0x32')]));_0x34d8c8[_0x3f5e('0x31')]=_0x34d8c8[_0x3f5e('0x31')][_0x3f5e('0x33')]?_0x34d8c8[_0x3f5e('0x31')]:_0x59f064['model'];_0x34d8c8[_0x3f5e('0x35')]=qs[_0x3f5e('0x36')](_0x88d0e0[_0x3f5e('0x2e')]['sort']);_0x34d8c8[_0x3f5e('0x37')]=qs[_0x3f5e('0x38')](_[_0x3f5e('0x39')](_0x88d0e0['query'],_0x59f064[_0x3f5e('0x38')]));if(_0x88d0e0['query'][_0x3f5e('0x3c')]){_0x34d8c8[_0x3f5e('0x37')]=_[_0x3f5e('0x3a')](_0x34d8c8['where'],{'$or':_['map'](_0x34d8c8[_0x3f5e('0x31')],function(_0x10aa09){var _0x1876b2={};_0x1876b2[_0x10aa09]={'$like':'%'+_0x88d0e0[_0x3f5e('0x2e')][_0x3f5e('0x3c')]+'%'};return _0x1876b2;})});}_0x34d8c8=_[_0x3f5e('0x3a')]({},_0x34d8c8,_0x88d0e0[_0x3f5e('0x3d')]);return _0x648db4[_0x3f5e('0x4d')](_0x34d8c8);}})['then'](function(_0x42b3e8){if(_0x42b3e8){_0x5f0705=_0x42b3e8[_0x3f5e('0x33')];if(!_0x88d0e0['query'][_0x3f5e('0x4b')](_0x3f5e('0x34'))){_0x34d8c8[_0x3f5e('0x18')]=qs[_0x3f5e('0x18')](_0x88d0e0[_0x3f5e('0x2e')][_0x3f5e('0x18')]);_0x34d8c8[_0x3f5e('0x17')]=qs[_0x3f5e('0x17')](_0x88d0e0[_0x3f5e('0x2e')][_0x3f5e('0x17')]);}return _0x648db4[_0x3f5e('0x4d')](_0x34d8c8);}})[_0x3f5e('0x3e')](function(_0x2dc1d1){if(_0x2dc1d1){return _0x2dc1d1?{'count':_0x5f0705,'rows':_0x2dc1d1}:null;}})['then'](respondWithResult(_0x364aef,null))[_0x3f5e('0x43')](handleError(_0x364aef,null));};exports[_0x3f5e('0x4e')]=function(_0x46ae23,_0x59aa3c,_0x1809b2){var _0x411c66={};var _0x3642cd={};var _0x16739b;var _0x1fcb39;return db[_0x3f5e('0x29')][_0x3f5e('0x4c')]({'where':{'id':_0x46ae23['params']['id']}})['then'](handleEntityNotFound(_0x59aa3c,null))['then'](function(_0x573399){if(_0x573399){_0x16739b=_0x573399;_0x3642cd[_0x3f5e('0x2d')]=_[_0x3f5e('0x2f')](db[_0x3f5e('0x4a')][_0x3f5e('0x2a')]);_0x3642cd[_0x3f5e('0x2e')]=_['keys'](_0x46ae23[_0x3f5e('0x2e')]);_0x3642cd[_0x3f5e('0x38')]=_[_0x3f5e('0x30')](_0x3642cd[_0x3f5e('0x2d')],_0x3642cd[_0x3f5e('0x2e')]);_0x411c66[_0x3f5e('0x31')]=_['intersection'](_0x3642cd['model'],qs[_0x3f5e('0x32')](_0x46ae23[_0x3f5e('0x2e')][_0x3f5e('0x32')]));_0x411c66[_0x3f5e('0x31')]=_0x411c66['attributes'][_0x3f5e('0x33')]?_0x411c66[_0x3f5e('0x31')]:_0x3642cd[_0x3f5e('0x2d')];_0x411c66[_0x3f5e('0x35')]=qs['sort'](_0x46ae23[_0x3f5e('0x2e')][_0x3f5e('0x36')]);_0x411c66[_0x3f5e('0x37')]=qs[_0x3f5e('0x38')](_['pick'](_0x46ae23[_0x3f5e('0x2e')],_0x3642cd[_0x3f5e('0x38')]));if(_0x46ae23[_0x3f5e('0x2e')][_0x3f5e('0x3c')]){_0x411c66[_0x3f5e('0x37')]=_[_0x3f5e('0x3a')](_0x411c66[_0x3f5e('0x37')],{'$or':_[_0x3f5e('0x28')](_0x411c66[_0x3f5e('0x31')],function(_0x26411c){var _0x5993d1={};_0x5993d1[_0x26411c]={'$like':'%'+_0x46ae23[_0x3f5e('0x2e')]['filter']+'%'};return _0x5993d1;})});}_0x411c66=_[_0x3f5e('0x3a')]({},_0x411c66,_0x46ae23['options']);return _0x16739b[_0x3f5e('0x4e')](_0x411c66);}})[_0x3f5e('0x3e')](function(_0x1d6912){if(_0x1d6912){_0x1fcb39=_0x1d6912[_0x3f5e('0x33')];if(!_0x46ae23['query'][_0x3f5e('0x4b')](_0x3f5e('0x34'))){_0x411c66[_0x3f5e('0x18')]=qs[_0x3f5e('0x18')](_0x46ae23['query'][_0x3f5e('0x18')]);_0x411c66['offset']=qs[_0x3f5e('0x17')](_0x46ae23[_0x3f5e('0x2e')][_0x3f5e('0x17')]);}return _0x16739b[_0x3f5e('0x4e')](_0x411c66);}})[_0x3f5e('0x3e')](function(_0x4ef1f7){if(_0x4ef1f7){return _0x4ef1f7?{'count':_0x1fcb39,'rows':_0x4ef1f7}:null;}})[_0x3f5e('0x3e')](respondWithResult(_0x59aa3c,null))['catch'](handleError(_0x59aa3c,null));};exports[_0x3f5e('0x4f')]=function(_0x46e3ed,_0x592229,_0x538198){var _0x55a32d={};var _0x57508d={};var _0x4f8805;var _0x3c4f83;return db[_0x3f5e('0x29')][_0x3f5e('0x4c')]({'where':{'id':_0x46e3ed[_0x3f5e('0x48')]['id']}})[_0x3f5e('0x3e')](handleEntityNotFound(_0x592229,null))[_0x3f5e('0x3e')](function(_0x1c9647){if(_0x1c9647){_0x4f8805=_0x1c9647;_0x57508d[_0x3f5e('0x2d')]=_[_0x3f5e('0x2f')](db[_0x3f5e('0x50')][_0x3f5e('0x2a')]);_0x57508d[_0x3f5e('0x2e')]=_['keys'](_0x46e3ed[_0x3f5e('0x2e')]);_0x57508d[_0x3f5e('0x38')]=_[_0x3f5e('0x30')](_0x57508d[_0x3f5e('0x2d')],_0x57508d[_0x3f5e('0x2e')]);_0x55a32d[_0x3f5e('0x31')]=_[_0x3f5e('0x30')](_0x57508d[_0x3f5e('0x2d')],qs[_0x3f5e('0x32')](_0x46e3ed[_0x3f5e('0x2e')][_0x3f5e('0x32')]));_0x55a32d[_0x3f5e('0x31')]=_0x55a32d[_0x3f5e('0x31')]['length']?_0x55a32d[_0x3f5e('0x31')]:_0x57508d['model'];_0x55a32d['order']=qs[_0x3f5e('0x36')](_0x46e3ed[_0x3f5e('0x2e')][_0x3f5e('0x36')]);_0x55a32d[_0x3f5e('0x37')]=qs[_0x3f5e('0x38')](_['pick'](_0x46e3ed['query'],_0x57508d[_0x3f5e('0x38')]));if(_0x46e3ed[_0x3f5e('0x2e')]['filter']){_0x55a32d[_0x3f5e('0x37')]=_[_0x3f5e('0x3a')](_0x55a32d['where'],{'$or':_[_0x3f5e('0x28')](_0x55a32d[_0x3f5e('0x31')],function(_0x5ccfc8){var _0x2aba73={};_0x2aba73[_0x5ccfc8]={'$like':'%'+_0x46e3ed[_0x3f5e('0x2e')]['filter']+'%'};return _0x2aba73;})});}_0x55a32d=_['merge']({},_0x55a32d,_0x46e3ed['options']);return _0x4f8805[_0x3f5e('0x4f')](_0x55a32d);}})['then'](function(_0x56e223){if(_0x56e223){_0x3c4f83=_0x56e223['length'];if(!_0x46e3ed[_0x3f5e('0x2e')][_0x3f5e('0x4b')]('nolimit')){_0x55a32d[_0x3f5e('0x18')]=qs[_0x3f5e('0x18')](_0x46e3ed[_0x3f5e('0x2e')][_0x3f5e('0x18')]);_0x55a32d[_0x3f5e('0x17')]=qs[_0x3f5e('0x17')](_0x46e3ed[_0x3f5e('0x2e')][_0x3f5e('0x17')]);}return _0x4f8805['getTags'](_0x55a32d);}})[_0x3f5e('0x3e')](function(_0x41573d){if(_0x41573d){return _0x41573d?{'count':_0x3c4f83,'rows':_0x41573d}:null;}})[_0x3f5e('0x3e')](respondWithResult(_0x592229,null))['catch'](handleError(_0x592229,null));};exports[_0x3f5e('0x51')]=function(_0x384673,_0x66d003,_0x4fb326){if(_0x384673[_0x3f5e('0x47')]['id']){delete _0x384673[_0x3f5e('0x47')]['id'];}return db[_0x3f5e('0x29')][_0x3f5e('0x4c')]({'where':{'id':_0x384673[_0x3f5e('0x48')]['id']}})['then'](handleEntityNotFound(_0x66d003,null))[_0x3f5e('0x3e')](function(_0x24f52f){if(_0x24f52f){return _0x24f52f[_0x3f5e('0x51')](_0x384673[_0x3f5e('0x47')][_0x3f5e('0x52')]||[]);}return null;})[_0x3f5e('0x3e')](respondWithResult(_0x66d003,null))[_0x3f5e('0x43')](handleError(_0x66d003,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index cf91476..8c02e16 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 _0x8952=['exports','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4aa473,_0xc3315b){var _0x4a898b=function(_0xf8b02c){while(--_0xf8b02c){_0x4aa473['push'](_0x4aa473['shift']());}};_0x4a898b(++_0xc3315b);}(_0x8952,0x17e));var _0x2895=function(_0x40401a,_0x5a3f02){_0x40401a=_0x40401a-0x0;var _0x2e93b8=_0x8952[_0x40401a];return _0x2e93b8;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var logger=require(_0x2895('0x1'))(_0x2895('0x2'));var moment=require(_0x2895('0x3'));var BPromise=require(_0x2895('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2895('0x5'));var rimraf=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x2895('0x8')]=function(_0x73c245,_0x37305b){return _0x73c245['define']('ZendeskConfiguration',attributes,{'tableName':_0x2895('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','ZendeskConfiguration','lodash','util','api','moment'];(function(_0x1bc059,_0x5c56ae){var _0x5488ce=function(_0x4d62ef){while(--_0x4d62ef){_0x1bc059['push'](_0x1bc059['shift']());}};_0x5488ce(++_0x5c56ae);}(_0x5423,0xe3));var _0x3542=function(_0x2a8ba5,_0x1f7e3c){_0x2a8ba5=_0x2a8ba5-0x0;var _0x467d44=_0x5423[_0x2a8ba5];return _0x467d44;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'int_zendesk_configurations','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 d6f169f..25675e6 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 _0x1cdf=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2375a1,_0x20b04b){var _0x2f5659=function(_0x459d2a){while(--_0x459d2a){_0x2375a1['push'](_0x2375a1['shift']());}};_0x2f5659(++_0x20b04b);}(_0x1cdf,0x161));var _0xf1cd=function(_0x378fc7,_0x5181a3){_0x378fc7=_0x378fc7-0x0;var _0x44dfec=_0x1cdf[_0x378fc7];return _0x44dfec;};'use strict';var _=require('lodash');var util=require(_0xf1cd('0x0'));var moment=require('moment');var BPromise=require(_0xf1cd('0x1'));var rs=require(_0xf1cd('0x2'));var fs=require('fs');var Redis=require(_0xf1cd('0x3'));var db=require(_0xf1cd('0x4'))['db'];var utils=require(_0xf1cd('0x5'));var logger=require('../../config/logger')(_0xf1cd('0x6'));var config=require(_0xf1cd('0x7'));var jayson=require(_0xf1cd('0x8'));var client=jayson[_0xf1cd('0x9')][_0xf1cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x64dacd,_0x7a12b3,_0x56ffc5){return new BPromise(function(_0x552628,_0x33e99e){return client[_0xf1cd('0xb')](_0x64dacd,_0x56ffc5)[_0xf1cd('0xc')](function(_0x2f199e){logger[_0xf1cd('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7a12b3,_0xf1cd('0xe'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x7a12b3,'request\x20sent',JSON[_0xf1cd('0xf')](_0x2f199e));if(_0x2f199e[_0xf1cd('0x10')]){if(_0x2f199e['error']['code']===0x1f4){logger[_0xf1cd('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7a12b3,_0x2f199e[_0xf1cd('0x10')]['message']);return _0x33e99e(_0x2f199e[_0xf1cd('0x10')][_0xf1cd('0x11')]);}logger[_0xf1cd('0x10')](_0xf1cd('0x12'),_0x7a12b3,_0x2f199e['error'][_0xf1cd('0x11')]);return _0x552628(_0x2f199e[_0xf1cd('0x10')][_0xf1cd('0x11')]);}else{logger[_0xf1cd('0xd')](_0xf1cd('0x12'),_0x7a12b3,'request\x20sent');_0x552628(_0x2f199e[_0xf1cd('0x13')]['message']);}})['catch'](function(_0x481257){logger[_0xf1cd('0x10')](_0xf1cd('0x12'),_0x7a12b3,_0x481257);_0x33e99e(_0x481257);});});} \ No newline at end of file +var _0x016b=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util'];(function(_0x231ede,_0x4856bb){var _0x3fdd8a=function(_0x4e622c){while(--_0x4e622c){_0x231ede['push'](_0x231ede['shift']());}};_0x3fdd8a(++_0x4856bb);}(_0x016b,0x1e1));var _0xb016=function(_0x10ca20,_0x38a470){_0x10ca20=_0x10ca20-0x0;var _0x1b2447=_0x016b[_0x10ca20];return _0x1b2447;};'use strict';var _=require(_0xb016('0x0'));var util=require(_0xb016('0x1'));var moment=require(_0xb016('0x2'));var BPromise=require('bluebird');var rs=require(_0xb016('0x3'));var fs=require('fs');var Redis=require(_0xb016('0x4'));var db=require(_0xb016('0x5'))['db'];var utils=require(_0xb016('0x6'));var logger=require(_0xb016('0x7'))(_0xb016('0x8'));var config=require(_0xb016('0x9'));var jayson=require(_0xb016('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c70fa,_0x47c2c7,_0x4ea948){return new BPromise(function(_0x89794a,_0xb9f1bc){return client[_0xb016('0xb')](_0x1c70fa,_0x4ea948)['then'](function(_0xda0473){logger[_0xb016('0xc')](_0xb016('0xd'),_0x47c2c7,_0xb016('0xe'));logger[_0xb016('0xf')](_0xb016('0x10'),_0x47c2c7,_0xb016('0xe'),JSON['stringify'](_0xda0473));if(_0xda0473[_0xb016('0x11')]){if(_0xda0473[_0xb016('0x11')][_0xb016('0x12')]===0x1f4){logger[_0xb016('0x11')](_0xb016('0xd'),_0x47c2c7,_0xda0473[_0xb016('0x11')]['message']);return _0xb9f1bc(_0xda0473[_0xb016('0x11')][_0xb016('0x13')]);}logger[_0xb016('0x11')](_0xb016('0xd'),_0x47c2c7,_0xda0473[_0xb016('0x11')][_0xb016('0x13')]);return _0x89794a(_0xda0473[_0xb016('0x11')][_0xb016('0x13')]);}else{logger[_0xb016('0xc')](_0xb016('0xd'),_0x47c2c7,'request\x20sent');_0x89794a(_0xda0473[_0xb016('0x14')]['message']);}})['catch'](function(_0x58a613){logger[_0xb016('0x11')](_0xb016('0xd'),_0x47c2c7,_0x58a613);_0xb9f1bc(_0x58a613);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 343d3f7..dff3872 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 _0x4094=['Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','update','delete','multer','path','express'];(function(_0x11c60a,_0x294908){var _0x5a4d14=function(_0x2e6061){while(--_0x2e6061){_0x11c60a['push'](_0x11c60a['shift']());}};_0x5a4d14(++_0x294908);}(_0x4094,0x66));var _0x4409=function(_0x1a035b,_0x29c1ec){_0x1a035b=_0x1a035b-0x0;var _0x7e7167=_0x4094[_0x1a035b];return _0x7e7167;};'use strict';var multer=require(_0x4409('0x0'));var util=require('util');var path=require(_0x4409('0x1'));var timeout=require('connect-timeout');var express=require(_0x4409('0x2'));var router=express[_0x4409('0x3')]();var fs_extra=require(_0x4409('0x4'));var auth=require(_0x4409('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x4409('0x6')]('/',auth[_0x4409('0x7')](),controller[_0x4409('0x8')]);router['get'](_0x4409('0x9'),auth[_0x4409('0x7')](),controller[_0x4409('0xa')]);router[_0x4409('0xb')]('/',auth['isAuthenticated'](),controller[_0x4409('0xc')]);router['put'](_0x4409('0x9'),auth[_0x4409('0x7')](),controller[_0x4409('0xd')]);router[_0x4409('0xe')](_0x4409('0x9'),auth[_0x4409('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3c5b=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','/:id','show','post','create','update','delete','destroy','util','path'];(function(_0x544b1f,_0x456faf){var _0x1367ac=function(_0x47ff30){while(--_0x47ff30){_0x544b1f['push'](_0x544b1f['shift']());}};_0x1367ac(++_0x456faf);}(_0x3c5b,0x15e));var _0xb3c5=function(_0x34c8c6,_0x390bb5){_0x34c8c6=_0x34c8c6-0x0;var _0x40b304=_0x3c5b[_0x34c8c6];return _0x40b304;};'use strict';var multer=require('multer');var util=require(_0xb3c5('0x0'));var path=require(_0xb3c5('0x1'));var timeout=require(_0xb3c5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb3c5('0x3'));var auth=require(_0xb3c5('0x4'));var interaction=require(_0xb3c5('0x5'));var config=require(_0xb3c5('0x6'));var controller=require(_0xb3c5('0x7'));router['get']('/',auth[_0xb3c5('0x8')](),controller['index']);router['get'](_0xb3c5('0x9'),auth['isAuthenticated'](),controller[_0xb3c5('0xa')]);router[_0xb3c5('0xb')]('/',auth[_0xb3c5('0x8')](),controller[_0xb3c5('0xc')]);router['put'](_0xb3c5('0x9'),auth['isAuthenticated'](),controller[_0xb3c5('0xd')]);router[_0xb3c5('0xe')](_0xb3c5('0x9'),auth[_0xb3c5('0x8')](),controller[_0xb3c5('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 61e8f10..bfa2715 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 _0xb2e8=['exports','string','variable','customVariable','keyValue','ENUM','STRING'];(function(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0xb2e8,0x15e));var _0x8b2e=function(_0x21eb93,_0x541100){_0x21eb93=_0x21eb93-0x0;var _0xdd15bd=_0xb2e8[_0x21eb93];return _0xdd15bd;};'use strict';var Sequelize=require('sequelize');module[_0x8b2e('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8b2e('0x1'),_0x8b2e('0x2'),_0x8b2e('0x3'),_0x8b2e('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8b2e('0x5')](_0x8b2e('0x1'),_0x8b2e('0x2'),_0x8b2e('0x3'))},'keyContent':{'type':Sequelize[_0x8b2e('0x6')]},'idField':{'type':Sequelize[_0x8b2e('0x6')]},'nameField':{'type':Sequelize[_0x8b2e('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b2e('0x6')]}}; \ No newline at end of file +var _0xff00=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x137ba5,_0x206556){var _0x4a84d1=function(_0x5a3fb1){while(--_0x5a3fb1){_0x137ba5['push'](_0x137ba5['shift']());}};_0x4a84d1(++_0x206556);}(_0xff00,0x15a));var _0x0ff0=function(_0x5a4ab3,_0xb441b){_0x5a4ab3=_0x5a4ab3-0x0;var _0x34b201=_0xff00[_0x5a4ab3];return _0x34b201;};'use strict';var Sequelize=require(_0x0ff0('0x0'));module[_0x0ff0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0ff0('0x2'),_0x0ff0('0x3'),_0x0ff0('0x4'),_0x0ff0('0x5'),_0x0ff0('0x6')),'defaultValue':_0x0ff0('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0ff0('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x0ff0('0x2'),_0x0ff0('0x3'),_0x0ff0('0x4'))},'keyContent':{'type':Sequelize[_0x0ff0('0x7')]},'idField':{'type':Sequelize[_0x0ff0('0x7')]},'nameField':{'type':Sequelize[_0x0ff0('0x7')]},'customField':{'type':Sequelize[_0x0ff0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a6913b1..998b1f5 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 _0x9904=['util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','update','destroy','error','name','ZendeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','then','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x22f75e,_0x4a9e06){var _0x1f6ab3=function(_0x1479d4){while(--_0x1479d4){_0x22f75e['push'](_0x22f75e['shift']());}};_0x1f6ab3(++_0x4a9e06);}(_0x9904,0xf5));var _0x4990=function(_0x151e4f,_0x45b100){_0x151e4f=_0x151e4f-0x0;var _0x3a7128=_0x9904[_0x151e4f];return _0x3a7128;};'use strict';var emlformat=require(_0x4990('0x0'));var rimraf=require(_0x4990('0x1'));var zipdir=require(_0x4990('0x2'));var jsonpatch=require(_0x4990('0x3'));var rp=require('request-promise');var moment=require(_0x4990('0x4'));var BPromise=require(_0x4990('0x5'));var Mustache=require(_0x4990('0x6'));var util=require(_0x4990('0x7'));var path=require(_0x4990('0x8'));var sox=require('sox');var csv=require(_0x4990('0x9'));var ejs=require(_0x4990('0xa'));var fs=require('fs');var fs_extra=require(_0x4990('0xb'));var _=require('lodash');var squel=require(_0x4990('0xc'));var crypto=require(_0x4990('0xd'));var jsforce=require(_0x4990('0xe'));var deskjs=require(_0x4990('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4990('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4990('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4990('0x12'));var logger=require(_0x4990('0x13'))('api');var utils=require(_0x4990('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18ee83,_0x4d9ba1){_0x4d9ba1=_0x4d9ba1||0xcc;return function(_0x59206b){if(_0x59206b){return _0x18ee83[_0x4990('0x15')](_0x4d9ba1);}return _0x18ee83[_0x4990('0x16')](_0x4d9ba1)['end']();};}function respondWithResult(_0x5600e8,_0x1a51ab){_0x1a51ab=_0x1a51ab||0xc8;return function(_0x3fcd05){if(_0x3fcd05){return _0x5600e8[_0x4990('0x16')](_0x1a51ab)['json'](_0x3fcd05);}};}function respondWithFilteredResult(_0x325411,_0x586745){return function(_0x56c1e9){if(_0x56c1e9){var _0x11c611=typeof _0x586745[_0x4990('0x17')]===_0x4990('0x18')&&typeof _0x586745[_0x4990('0x19')]===_0x4990('0x18');var _0x1b36f7=_0x56c1e9['count'];var _0x271e8c=_0x11c611?0x0:_0x586745[_0x4990('0x17')];var _0xb0ef4a=_0x11c611?_0x56c1e9[_0x4990('0x1a')]:_0x586745['offset']+_0x586745[_0x4990('0x19')];var _0x2e7b5d;if(_0xb0ef4a>=_0x1b36f7){_0xb0ef4a=_0x1b36f7;_0x2e7b5d=0xc8;}else{_0x2e7b5d=0xce;}_0x325411[_0x4990('0x16')](_0x2e7b5d);return _0x325411['set'](_0x4990('0x1b'),_0x271e8c+'-'+_0xb0ef4a+'/'+_0x1b36f7)[_0x4990('0x1c')](_0x56c1e9);}return null;};}function patchUpdates(_0x124270){return function(_0x20f75e){try{jsonpatch['apply'](_0x20f75e,_0x124270,!![]);}catch(_0x2a738f){return BPromise[_0x4990('0x1d')](_0x2a738f);}return _0x20f75e['save']();};}function saveUpdates(_0x148829,_0x40fe0f){return function(_0x4bc0c8){if(_0x4bc0c8){return _0x4bc0c8[_0x4990('0x1e')](_0x148829)['then'](function(_0x5ebcba){return _0x5ebcba;});}return null;};}function removeEntity(_0x44796e,_0x15f603){return function(_0x3800c7){if(_0x3800c7){return _0x3800c7[_0x4990('0x1f')]()['then'](function(){_0x44796e[_0x4990('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff4d0,_0x252ed4){return function(_0x481e69){if(!_0x481e69){_0x2ff4d0[_0x4990('0x15')](0x194);}return _0x481e69;};}function handleError(_0x119fbe,_0x522bec){_0x522bec=_0x522bec||0x1f4;return function(_0x56bda1){logger[_0x4990('0x20')](_0x56bda1['stack']);if(_0x56bda1[_0x4990('0x21')]){delete _0x56bda1[_0x4990('0x21')];}_0x119fbe[_0x4990('0x16')](_0x522bec)['send'](_0x56bda1);};}exports['index']=function(_0x1d5d5c,_0x1e63d4){var _0x116a77={},_0x3569bf={},_0x111fdf={'count':0x0,'rows':[]};var _0x35b5b1=_['map'](db[_0x4990('0x22')][_0x4990('0x23')],function(_0x974e70){return{'name':_0x974e70[_0x4990('0x24')],'type':_0x974e70[_0x4990('0x25')][_0x4990('0x26')]};});_0x3569bf[_0x4990('0x27')]=_[_0x4990('0x28')](_0x35b5b1,_0x4990('0x21'));_0x3569bf[_0x4990('0x29')]=_[_0x4990('0x2a')](_0x1d5d5c[_0x4990('0x29')]);_0x3569bf[_0x4990('0x2b')]=_[_0x4990('0x2c')](_0x3569bf[_0x4990('0x27')],_0x3569bf[_0x4990('0x29')]);_0x116a77[_0x4990('0x2d')]=_[_0x4990('0x2c')](_0x3569bf[_0x4990('0x27')],qs[_0x4990('0x2e')](_0x1d5d5c[_0x4990('0x29')]['fields']));_0x116a77[_0x4990('0x2d')]=_0x116a77[_0x4990('0x2d')][_0x4990('0x2f')]?_0x116a77[_0x4990('0x2d')]:_0x3569bf['model'];if(!_0x1d5d5c[_0x4990('0x29')]['hasOwnProperty']('nolimit')){_0x116a77[_0x4990('0x19')]=qs['limit'](_0x1d5d5c[_0x4990('0x29')]['limit']);_0x116a77[_0x4990('0x17')]=qs[_0x4990('0x17')](_0x1d5d5c['query'][_0x4990('0x17')]);}_0x116a77[_0x4990('0x30')]=qs[_0x4990('0x31')](_0x1d5d5c[_0x4990('0x29')][_0x4990('0x31')]);_0x116a77[_0x4990('0x32')]=qs[_0x4990('0x2b')](_[_0x4990('0x33')](_0x1d5d5c['query'],_0x3569bf[_0x4990('0x2b')]),_0x35b5b1);if(_0x1d5d5c['query']['filter']){_0x116a77[_0x4990('0x32')]=_[_0x4990('0x34')](_0x116a77['where'],{'$or':_['map'](_0x35b5b1,function(_0x21ce72){if(_0x21ce72[_0x4990('0x25')]!==_0x4990('0x35')){var _0x5032a6={};_0x5032a6[_0x21ce72['name']]={'$like':'%'+_0x1d5d5c[_0x4990('0x29')][_0x4990('0x36')]+'%'};return _0x5032a6;}})});}_0x116a77=_[_0x4990('0x34')]({},_0x116a77,_0x1d5d5c['options']);var _0x1246e0={'where':_0x116a77[_0x4990('0x32')]};return db[_0x4990('0x22')]['count'](_0x1246e0)['then'](function(_0x283a4b){_0x111fdf[_0x4990('0x1a')]=_0x283a4b;if(_0x1d5d5c[_0x4990('0x29')][_0x4990('0x37')]){_0x116a77[_0x4990('0x38')]=[{'all':!![]}];}return db[_0x4990('0x22')]['findAll'](_0x116a77);})[_0x4990('0x39')](function(_0x22c39d){_0x111fdf['rows']=_0x22c39d;return _0x111fdf;})[_0x4990('0x39')](respondWithFilteredResult(_0x1e63d4,_0x116a77))['catch'](handleError(_0x1e63d4,null));};exports['show']=function(_0x3dfdff,_0x334610){var _0x1c723b={'raw':!![],'where':{'id':_0x3dfdff['params']['id']}},_0x298aae={};_0x298aae[_0x4990('0x27')]=_['keys'](db[_0x4990('0x22')][_0x4990('0x23')]);_0x298aae[_0x4990('0x29')]=_[_0x4990('0x2a')](_0x3dfdff[_0x4990('0x29')]);_0x298aae[_0x4990('0x2b')]=_[_0x4990('0x2c')](_0x298aae[_0x4990('0x27')],_0x298aae[_0x4990('0x29')]);_0x1c723b[_0x4990('0x2d')]=_[_0x4990('0x2c')](_0x298aae[_0x4990('0x27')],qs['fields'](_0x3dfdff[_0x4990('0x29')][_0x4990('0x2e')]));_0x1c723b[_0x4990('0x2d')]=_0x1c723b['attributes'][_0x4990('0x2f')]?_0x1c723b[_0x4990('0x2d')]:_0x298aae[_0x4990('0x27')];if(_0x3dfdff[_0x4990('0x29')][_0x4990('0x37')]){_0x1c723b[_0x4990('0x38')]=[{'all':!![]}];}_0x1c723b=_[_0x4990('0x34')]({},_0x1c723b,_0x3dfdff['options']);return db[_0x4990('0x22')][_0x4990('0x3a')](_0x1c723b)[_0x4990('0x39')](handleEntityNotFound(_0x334610,null))[_0x4990('0x39')](respondWithResult(_0x334610,null))[_0x4990('0x3b')](handleError(_0x334610,null));};exports[_0x4990('0x3c')]=function(_0x141001,_0x54cea2){return db[_0x4990('0x22')][_0x4990('0x3c')](_0x141001[_0x4990('0x3d')],{})[_0x4990('0x39')](respondWithResult(_0x54cea2,0xc9))[_0x4990('0x3b')](handleError(_0x54cea2,null));};exports['update']=function(_0x16d00f,_0x1d074e){if(_0x16d00f[_0x4990('0x3d')]['id']){delete _0x16d00f[_0x4990('0x3d')]['id'];}return db[_0x4990('0x22')][_0x4990('0x3a')]({'where':{'id':_0x16d00f['params']['id']}})['then'](handleEntityNotFound(_0x1d074e,null))['then'](saveUpdates(_0x16d00f[_0x4990('0x3d')],null))[_0x4990('0x39')](respondWithResult(_0x1d074e,null))[_0x4990('0x3b')](handleError(_0x1d074e,null));};exports[_0x4990('0x1f')]=function(_0x1807e4,_0x21f2a2){return db[_0x4990('0x22')][_0x4990('0x3a')]({'where':{'id':_0x1807e4[_0x4990('0x3e')]['id']}})['then'](handleEntityNotFound(_0x21f2a2,null))['then'](removeEntity(_0x21f2a2,null))[_0x4990('0x3b')](handleError(_0x21f2a2,null));}; \ No newline at end of file +var _0x3095=['key','model','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskField','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','intersection','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','index','map','type'];(function(_0x11de67,_0x40da2d){var _0x1854cf=function(_0x26b2b4){while(--_0x26b2b4){_0x11de67['push'](_0x11de67['shift']());}};_0x1854cf(++_0x40da2d);}(_0x3095,0x158));var _0x5309=function(_0x47078c,_0x2dd424){_0x47078c=_0x47078c-0x0;var _0x2a7dd2=_0x3095[_0x47078c];return _0x2a7dd2;};'use strict';var emlformat=require(_0x5309('0x0'));var rimraf=require(_0x5309('0x1'));var zipdir=require(_0x5309('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5309('0x3'));var BPromise=require(_0x5309('0x4'));var Mustache=require(_0x5309('0x5'));var util=require(_0x5309('0x6'));var path=require(_0x5309('0x7'));var sox=require(_0x5309('0x8'));var csv=require(_0x5309('0x9'));var ejs=require(_0x5309('0xa'));var fs=require('fs');var fs_extra=require(_0x5309('0xb'));var _=require(_0x5309('0xc'));var squel=require(_0x5309('0xd'));var crypto=require(_0x5309('0xe'));var jsforce=require(_0x5309('0xf'));var deskjs=require(_0x5309('0x10'));var toCsv=require(_0x5309('0x9'));var querystring=require(_0x5309('0x11'));var Papa=require(_0x5309('0x12'));var Redis=require('ioredis');var authService=require(_0x5309('0x13'));var qs=require(_0x5309('0x14'));var as=require(_0x5309('0x15'));var hardwareService=require(_0x5309('0x16'));var logger=require(_0x5309('0x17'))(_0x5309('0x18'));var utils=require(_0x5309('0x19'));var config=require(_0x5309('0x1a'));var licenseUtil=require(_0x5309('0x1b'));var db=require(_0x5309('0x1c'))['db'];function respondWithStatusCode(_0x3404e2,_0x4f4e82){_0x4f4e82=_0x4f4e82||0xcc;return function(_0x5e949d){if(_0x5e949d){return _0x3404e2[_0x5309('0x1d')](_0x4f4e82);}return _0x3404e2['status'](_0x4f4e82)['end']();};}function respondWithResult(_0x3bc3d8,_0x3dda22){_0x3dda22=_0x3dda22||0xc8;return function(_0x1b6410){if(_0x1b6410){return _0x3bc3d8[_0x5309('0x1e')](_0x3dda22)[_0x5309('0x1f')](_0x1b6410);}};}function respondWithFilteredResult(_0x591c28,_0x55ceea){return function(_0xde3215){if(_0xde3215){var _0x786c45=typeof _0x55ceea[_0x5309('0x20')]===_0x5309('0x21')&&typeof _0x55ceea[_0x5309('0x22')]==='undefined';var _0x5d8ee0=_0xde3215[_0x5309('0x23')];var _0x3980ee=_0x786c45?0x0:_0x55ceea['offset'];var _0x319a0b=_0x786c45?_0xde3215[_0x5309('0x23')]:_0x55ceea['offset']+_0x55ceea[_0x5309('0x22')];var _0x55f9ff;if(_0x319a0b>=_0x5d8ee0){_0x319a0b=_0x5d8ee0;_0x55f9ff=0xc8;}else{_0x55f9ff=0xce;}_0x591c28[_0x5309('0x1e')](_0x55f9ff);return _0x591c28[_0x5309('0x24')](_0x5309('0x25'),_0x3980ee+'-'+_0x319a0b+'/'+_0x5d8ee0)[_0x5309('0x1f')](_0xde3215);}return null;};}function patchUpdates(_0x3c745e){return function(_0x551a1c){try{jsonpatch[_0x5309('0x26')](_0x551a1c,_0x3c745e,!![]);}catch(_0x3e0d3b){return BPromise[_0x5309('0x27')](_0x3e0d3b);}return _0x551a1c[_0x5309('0x28')]();};}function saveUpdates(_0x327e7e,_0xdf261d){return function(_0x2a096d){if(_0x2a096d){return _0x2a096d[_0x5309('0x29')](_0x327e7e)['then'](function(_0x18daaa){return _0x18daaa;});}return null;};}function removeEntity(_0x51dd4d,_0x35f2ca){return function(_0x2c4adf){if(_0x2c4adf){return _0x2c4adf[_0x5309('0x2a')]()[_0x5309('0x2b')](function(){_0x51dd4d[_0x5309('0x1e')](0xcc)[_0x5309('0x2c')]();});}};}function handleEntityNotFound(_0x3793e0,_0x271633){return function(_0x35afe1){if(!_0x35afe1){_0x3793e0[_0x5309('0x1d')](0x194);}return _0x35afe1;};}function handleError(_0x1c2e95,_0x1d640a){_0x1d640a=_0x1d640a||0x1f4;return function(_0x474a75){logger[_0x5309('0x2d')](_0x474a75['stack']);if(_0x474a75[_0x5309('0x2e')]){delete _0x474a75[_0x5309('0x2e')];}_0x1c2e95[_0x5309('0x1e')](_0x1d640a)[_0x5309('0x2f')](_0x474a75);};}exports[_0x5309('0x30')]=function(_0x465135,_0x4ce08e){var _0x32af40={},_0x1acca7={},_0x420b7e={'count':0x0,'rows':[]};var _0x21b7da=_[_0x5309('0x31')](db['ZendeskField']['rawAttributes'],function(_0x369917){return{'name':_0x369917['fieldName'],'type':_0x369917[_0x5309('0x32')][_0x5309('0x33')]};});_0x1acca7[_0x5309('0x34')]=_[_0x5309('0x31')](_0x21b7da,'name');_0x1acca7[_0x5309('0x35')]=_['keys'](_0x465135['query']);_0x1acca7['filters']=_['intersection'](_0x1acca7[_0x5309('0x34')],_0x1acca7[_0x5309('0x35')]);_0x32af40[_0x5309('0x36')]=_['intersection'](_0x1acca7['model'],qs['fields'](_0x465135[_0x5309('0x35')][_0x5309('0x37')]));_0x32af40[_0x5309('0x36')]=_0x32af40[_0x5309('0x36')][_0x5309('0x38')]?_0x32af40[_0x5309('0x36')]:_0x1acca7['model'];if(!_0x465135[_0x5309('0x35')]['hasOwnProperty'](_0x5309('0x39'))){_0x32af40[_0x5309('0x22')]=qs['limit'](_0x465135[_0x5309('0x35')][_0x5309('0x22')]);_0x32af40[_0x5309('0x20')]=qs[_0x5309('0x20')](_0x465135[_0x5309('0x35')][_0x5309('0x20')]);}_0x32af40[_0x5309('0x3a')]=qs[_0x5309('0x3b')](_0x465135['query'][_0x5309('0x3b')]);_0x32af40[_0x5309('0x3c')]=qs['filters'](_[_0x5309('0x3d')](_0x465135[_0x5309('0x35')],_0x1acca7['filters']),_0x21b7da);if(_0x465135['query'][_0x5309('0x3e')]){_0x32af40[_0x5309('0x3c')]=_[_0x5309('0x3f')](_0x32af40['where'],{'$or':_['map'](_0x21b7da,function(_0x1fd921){if(_0x1fd921['type']!==_0x5309('0x40')){var _0x221cf9={};_0x221cf9[_0x1fd921[_0x5309('0x2e')]]={'$like':'%'+_0x465135[_0x5309('0x35')]['filter']+'%'};return _0x221cf9;}})});}_0x32af40=_['merge']({},_0x32af40,_0x465135[_0x5309('0x41')]);var _0x35bca8={'where':_0x32af40[_0x5309('0x3c')]};return db[_0x5309('0x42')]['count'](_0x35bca8)[_0x5309('0x2b')](function(_0x5840c0){_0x420b7e['count']=_0x5840c0;if(_0x465135[_0x5309('0x35')][_0x5309('0x43')]){_0x32af40[_0x5309('0x44')]=[{'all':!![]}];}return db[_0x5309('0x42')][_0x5309('0x45')](_0x32af40);})[_0x5309('0x2b')](function(_0x2a92e3){_0x420b7e[_0x5309('0x46')]=_0x2a92e3;return _0x420b7e;})[_0x5309('0x2b')](respondWithFilteredResult(_0x4ce08e,_0x32af40))[_0x5309('0x47')](handleError(_0x4ce08e,null));};exports['show']=function(_0x890fdb,_0x27fc33){var _0x3af032={'raw':!![],'where':{'id':_0x890fdb[_0x5309('0x48')]['id']}},_0x5e91af={};_0x5e91af[_0x5309('0x34')]=_[_0x5309('0x49')](db['ZendeskField'][_0x5309('0x4a')]);_0x5e91af['query']=_[_0x5309('0x49')](_0x890fdb[_0x5309('0x35')]);_0x5e91af['filters']=_['intersection'](_0x5e91af[_0x5309('0x34')],_0x5e91af[_0x5309('0x35')]);_0x3af032[_0x5309('0x36')]=_[_0x5309('0x4b')](_0x5e91af[_0x5309('0x34')],qs[_0x5309('0x37')](_0x890fdb[_0x5309('0x35')]['fields']));_0x3af032['attributes']=_0x3af032[_0x5309('0x36')][_0x5309('0x38')]?_0x3af032[_0x5309('0x36')]:_0x5e91af[_0x5309('0x34')];if(_0x890fdb[_0x5309('0x35')][_0x5309('0x43')]){_0x3af032[_0x5309('0x44')]=[{'all':!![]}];}_0x3af032=_[_0x5309('0x3f')]({},_0x3af032,_0x890fdb['options']);return db['ZendeskField'][_0x5309('0x4c')](_0x3af032)[_0x5309('0x2b')](handleEntityNotFound(_0x27fc33,null))[_0x5309('0x2b')](respondWithResult(_0x27fc33,null))[_0x5309('0x47')](handleError(_0x27fc33,null));};exports[_0x5309('0x4d')]=function(_0x14e951,_0x5ced9d){return db[_0x5309('0x42')]['create'](_0x14e951[_0x5309('0x4e')],{})[_0x5309('0x2b')](respondWithResult(_0x5ced9d,0xc9))[_0x5309('0x47')](handleError(_0x5ced9d,null));};exports['update']=function(_0x4c6fdb,_0x4f845b){if(_0x4c6fdb[_0x5309('0x4e')]['id']){delete _0x4c6fdb[_0x5309('0x4e')]['id'];}return db['ZendeskField'][_0x5309('0x4c')]({'where':{'id':_0x4c6fdb['params']['id']}})[_0x5309('0x2b')](handleEntityNotFound(_0x4f845b,null))[_0x5309('0x2b')](saveUpdates(_0x4c6fdb[_0x5309('0x4e')],null))[_0x5309('0x2b')](respondWithResult(_0x4f845b,null))[_0x5309('0x47')](handleError(_0x4f845b,null));};exports[_0x5309('0x2a')]=function(_0x51c32d,_0x568243){return db[_0x5309('0x42')]['find']({'where':{'id':_0x51c32d[_0x5309('0x48')]['id']}})[_0x5309('0x2b')](handleEntityNotFound(_0x568243,null))[_0x5309('0x2b')](removeEntity(_0x568243,null))['catch'](handleError(_0x568243,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 6fafc8c..46a58ac 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 _0x4506=['exports','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x3d6e60,_0x582bb3){var _0xf00ca4=function(_0xfec387){while(--_0xfec387){_0x3d6e60['push'](_0x3d6e60['shift']());}};_0xf00ca4(++_0x582bb3);}(_0x4506,0x140));var _0x6450=function(_0x4a7d1f,_0x1a5b88){_0x4a7d1f=_0x4a7d1f-0x0;var _0x2a5938=_0x4506[_0x4a7d1f];return _0x2a5938;};'use strict';var _=require(_0x6450('0x0'));var util=require(_0x6450('0x1'));var logger=require(_0x6450('0x2'))('api');var moment=require(_0x6450('0x3'));var BPromise=require(_0x6450('0x4'));var rp=require(_0x6450('0x5'));var fs=require('fs');var path=require(_0x6450('0x6'));var rimraf=require(_0x6450('0x7'));var config=require(_0x6450('0x8'));var attributes=require(_0x6450('0x9'));module[_0x6450('0xa')]=function(_0x327037,_0x3ebf91){return _0x327037['define'](_0x6450('0xb'),attributes,{'tableName':_0x6450('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x6450('0xd'),_0x6450('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57ea=['util','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId'];(function(_0x2d3975,_0x2a6856){var _0x3e86e8=function(_0x956e0e){while(--_0x956e0e){_0x2d3975['push'](_0x2d3975['shift']());}};_0x3e86e8(++_0x2a6856);}(_0x57ea,0x181));var _0xa57e=function(_0x1a6bc2,_0x126f66){_0x1a6bc2=_0x1a6bc2-0x0;var _0x147952=_0x57ea[_0x1a6bc2];return _0x147952;};'use strict';var _=require('lodash');var util=require(_0xa57e('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa57e('0x1'));var fs=require('fs');var path=require(_0xa57e('0x2'));var rimraf=require(_0xa57e('0x3'));var config=require(_0xa57e('0x4'));var attributes=require('./intZendeskField.attributes');module[_0xa57e('0x5')]=function(_0x5c9995,_0x5bb3f8){return _0x5c9995[_0xa57e('0x6')](_0xa57e('0x7'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xa57e('0x8'),'fields':[_0xa57e('0x9'),_0xa57e('0xa')],'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 7fd8a40..d76de39 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 _0xb9ea=['../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xb9ea,0x175));var _0xab9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9ea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab9e('0x0'));var util=require(_0xab9e('0x1'));var moment=require(_0xab9e('0x2'));var BPromise=require(_0xab9e('0x3'));var rs=require(_0xab9e('0x4'));var fs=require('fs');var Redis=require(_0xab9e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xab9e('0x6'))('rpc');var config=require(_0xab9e('0x7'));var jayson=require(_0xab9e('0x8'));var client=jayson[_0xab9e('0x9')][_0xab9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11fba3,_0x15110c,_0x53930d){return new BPromise(function(_0x348b3a,_0x45f8c4){return client['request'](_0x11fba3,_0x53930d)[_0xab9e('0xb')](function(_0x42400d){logger[_0xab9e('0xc')](_0xab9e('0xd'),_0x15110c,'request\x20sent');logger['debug'](_0xab9e('0xe'),_0x15110c,'request\x20sent',JSON[_0xab9e('0xf')](_0x42400d));if(_0x42400d[_0xab9e('0x10')]){if(_0x42400d[_0xab9e('0x10')][_0xab9e('0x11')]===0x1f4){logger[_0xab9e('0x10')](_0xab9e('0xd'),_0x15110c,_0x42400d['error'][_0xab9e('0x12')]);return _0x45f8c4(_0x42400d[_0xab9e('0x10')][_0xab9e('0x12')]);}logger[_0xab9e('0x10')]('ZendeskField,\x20%s,\x20%s',_0x15110c,_0x42400d['error'][_0xab9e('0x12')]);return _0x348b3a(_0x42400d[_0xab9e('0x10')][_0xab9e('0x12')]);}else{logger[_0xab9e('0xc')](_0xab9e('0xd'),_0x15110c,'request\x20sent');_0x348b3a(_0x42400d['result'][_0xab9e('0x12')]);}})[_0xab9e('0x13')](function(_0xb2a485){logger['error'](_0xab9e('0xd'),_0x15110c,_0xb2a485);_0x45f8c4(_0xb2a485);});});} \ No newline at end of file +var _0x44fa=['http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x36c6f8,_0x17cb72){var _0x240ff0=function(_0x3a369d){while(--_0x3a369d){_0x36c6f8['push'](_0x36c6f8['shift']());}};_0x240ff0(++_0x17cb72);}(_0x44fa,0x1b7));var _0xa44f=function(_0x1205b1,_0x2a7010){_0x1205b1=_0x1205b1-0x0;var _0x2d3bad=_0x44fa[_0x1205b1];return _0x2d3bad;};'use strict';var _=require(_0xa44f('0x0'));var util=require(_0xa44f('0x1'));var moment=require(_0xa44f('0x2'));var BPromise=require(_0xa44f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa44f('0x4'));var db=require(_0xa44f('0x5'))['db'];var utils=require(_0xa44f('0x6'));var logger=require(_0xa44f('0x7'))('rpc');var config=require(_0xa44f('0x8'));var jayson=require(_0xa44f('0x9'));var client=jayson[_0xa44f('0xa')][_0xa44f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb79317,_0x99f50d,_0x2a8ac9){return new BPromise(function(_0x4c2747,_0x44eda5){return client[_0xa44f('0xc')](_0xb79317,_0x2a8ac9)[_0xa44f('0xd')](function(_0x58382d){logger[_0xa44f('0xe')](_0xa44f('0xf'),_0x99f50d,_0xa44f('0x10'));logger[_0xa44f('0x11')](_0xa44f('0x12'),_0x99f50d,_0xa44f('0x10'),JSON[_0xa44f('0x13')](_0x58382d));if(_0x58382d['error']){if(_0x58382d[_0xa44f('0x14')][_0xa44f('0x15')]===0x1f4){logger['error'](_0xa44f('0xf'),_0x99f50d,_0x58382d[_0xa44f('0x14')][_0xa44f('0x16')]);return _0x44eda5(_0x58382d[_0xa44f('0x14')][_0xa44f('0x16')]);}logger['error'](_0xa44f('0xf'),_0x99f50d,_0x58382d['error'][_0xa44f('0x16')]);return _0x4c2747(_0x58382d[_0xa44f('0x14')][_0xa44f('0x16')]);}else{logger[_0xa44f('0xe')]('ZendeskField,\x20%s,\x20%s',_0x99f50d,'request\x20sent');_0x4c2747(_0x58382d[_0xa44f('0x17')][_0xa44f('0x16')]);}})[_0xa44f('0x18')](function(_0x4f0e34){logger[_0xa44f('0x14')](_0xa44f('0xf'),_0x99f50d,_0x4f0e34);_0x44eda5(_0x4f0e34);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9dbe431..affaa88 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 _0x8a6c=['post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x442692,_0x1b84ff){var _0x35646c=function(_0x466bfc){while(--_0x466bfc){_0x442692['push'](_0x442692['shift']());}};_0x35646c(++_0x1b84ff);}(_0x8a6c,0x7f));var _0xc8a6=function(_0x3fc54b,_0x128245){_0x3fc54b=_0x3fc54b-0x0;var _0x2c350b=_0x8a6c[_0x3fc54b];return _0x2c350b;};'use strict';var multer=require(_0xc8a6('0x0'));var util=require(_0xc8a6('0x1'));var path=require(_0xc8a6('0x2'));var timeout=require(_0xc8a6('0x3'));var express=require(_0xc8a6('0x4'));var router=express[_0xc8a6('0x5')]();var fs_extra=require(_0xc8a6('0x6'));var auth=require(_0xc8a6('0x7'));var interaction=require(_0xc8a6('0x8'));var config=require('../../config/environment');var controller=require(_0xc8a6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc8a6('0xa')]);router[_0xc8a6('0xb')](_0xc8a6('0xc'),auth[_0xc8a6('0xd')](),controller['show']);router[_0xc8a6('0xb')](_0xc8a6('0xe'),auth[_0xc8a6('0xd')](),controller[_0xc8a6('0xf')]);router[_0xc8a6('0xb')](_0xc8a6('0x10'),auth[_0xc8a6('0xd')](),controller['getFields']);router[_0xc8a6('0x11')]('/',auth[_0xc8a6('0xd')](),controller['create']);router[_0xc8a6('0x11')](_0xc8a6('0xe'),auth[_0xc8a6('0xd')](),controller[_0xc8a6('0x12')]);router[_0xc8a6('0x13')](_0xc8a6('0xc'),auth[_0xc8a6('0xd')](),controller[_0xc8a6('0x14')]);router[_0xc8a6('0x15')](_0xc8a6('0xc'),auth[_0xc8a6('0xd')](),controller[_0xc8a6('0x16')]);module[_0xc8a6('0x17')]=router; \ No newline at end of file +var _0xfafb=['post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x4931d3,_0x1f94f0){var _0x4a4816=function(_0x3bd6e3){while(--_0x3bd6e3){_0x4931d3['push'](_0x4931d3['shift']());}};_0x4a4816(++_0x1f94f0);}(_0xfafb,0xf2));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbfaf('0x0'));var util=require('util');var path=require(_0xbfaf('0x1'));var timeout=require(_0xbfaf('0x2'));var express=require(_0xbfaf('0x3'));var router=express[_0xbfaf('0x4')]();var fs_extra=require(_0xbfaf('0x5'));var auth=require(_0xbfaf('0x6'));var interaction=require(_0xbfaf('0x7'));var config=require(_0xbfaf('0x8'));var controller=require(_0xbfaf('0x9'));router[_0xbfaf('0xa')]('/',auth[_0xbfaf('0xb')](),controller['index']);router[_0xbfaf('0xa')]('/:id',auth[_0xbfaf('0xb')](),controller[_0xbfaf('0xc')]);router[_0xbfaf('0xa')](_0xbfaf('0xd'),auth[_0xbfaf('0xb')](),controller[_0xbfaf('0xe')]);router['get'](_0xbfaf('0xf'),auth['isAuthenticated'](),controller[_0xbfaf('0x10')]);router['post']('/',auth[_0xbfaf('0xb')](),controller[_0xbfaf('0x11')]);router[_0xbfaf('0x12')](_0xbfaf('0xd'),auth[_0xbfaf('0xb')](),controller[_0xbfaf('0x13')]);router[_0xbfaf('0x14')](_0xbfaf('0x15'),auth['isAuthenticated'](),controller[_0xbfaf('0x16')]);router[_0xbfaf('0x17')](_0xbfaf('0x15'),auth[_0xbfaf('0xb')](),controller[_0xbfaf('0x18')]);module[_0xbfaf('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a969064..d19f1dc 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['exports','STRING'];(function(_0x591ad2,_0xbfe834){var _0x161ff8=function(_0x2f0269){while(--_0x2f0269){_0x591ad2['push'](_0x591ad2['shift']());}};_0x161ff8(++_0xbfe834);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4a7b39,_0x3f3733){_0x4a7b39=_0x4a7b39-0x0;var _0x9c2c93=_0x6f0d[_0x4a7b39];return _0x9c2c93;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'name':{'type':Sequelize[_0xd6f0('0x1')]},'description':{'type':Sequelize[_0xd6f0('0x1')]},'host':{'type':Sequelize[_0xd6f0('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd6f0('0x1')]},'clientSecret':{'type':Sequelize[_0xd6f0('0x1')]},'serverUrl':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xd6f0('0x1')]},'refreshToken':{'type':Sequelize[_0xd6f0('0x1')]}}; \ No newline at end of file +var _0xd0bb=['exports','STRING','sequelize'];(function(_0x4bc0f7,_0x329c69){var _0x1fa851=function(_0x53173d){while(--_0x53173d){_0x4bc0f7['push'](_0x4bc0f7['shift']());}};_0x1fa851(++_0x329c69);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xb1ee0e,_0x2126df){_0xb1ee0e=_0xb1ee0e-0x0;var _0x376116=_0xd0bb[_0xb1ee0e];return _0x376116;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'name':{'type':Sequelize[_0xbd0b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd0b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbd0b('0x2')]},'clientSecret':{'type':Sequelize[_0xbd0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xbd0b('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index daf86bb..419549b 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 _0x1c83=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','set','reject','save','update','destroy','then','name','send','ZohoAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','keys','merge','options','find','create','body','params','ZohoConfiguration','getConfigurations','hasOwnProperty','addConfiguration','findOne','Subjects','Descriptions','channel','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','refreshToken','zoho.eu','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','error','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','system_mandatory','push','data_type','pick_list_values','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x4b7391,_0x586f07){var _0x581212=function(_0x4e92c0){while(--_0x4e92c0){_0x4b7391['push'](_0x4b7391['shift']());}};_0x581212(++_0x586f07);}(_0x1c83,0x16d));var _0x31c8=function(_0x41674d,_0xbc687a){_0x41674d=_0x41674d-0x0;var _0x57ff86=_0x1c83[_0x41674d];return _0x57ff86;};'use strict';var emlformat=require(_0x31c8('0x0'));var rimraf=require(_0x31c8('0x1'));var zipdir=require(_0x31c8('0x2'));var jsonpatch=require(_0x31c8('0x3'));var rp=require('request-promise');var moment=require(_0x31c8('0x4'));var BPromise=require(_0x31c8('0x5'));var Mustache=require('mustache');var util=require(_0x31c8('0x6'));var path=require(_0x31c8('0x7'));var sox=require(_0x31c8('0x8'));var csv=require(_0x31c8('0x9'));var ejs=require(_0x31c8('0xa'));var fs=require('fs');var fs_extra=require(_0x31c8('0xb'));var _=require(_0x31c8('0xc'));var squel=require('squel');var crypto=require(_0x31c8('0xd'));var jsforce=require(_0x31c8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x31c8('0x9'));var querystring=require('querystring');var Papa=require(_0x31c8('0xf'));var Redis=require(_0x31c8('0x10'));var authService=require(_0x31c8('0x11'));var qs=require(_0x31c8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x31c8('0x13'))(_0x31c8('0x14'));var utils=require(_0x31c8('0x15'));var config=require(_0x31c8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x31c8('0x17'))['db'];var integrations=require(_0x31c8('0x18'));function respondWithStatusCode(_0x1359e5,_0x3bae18){_0x3bae18=_0x3bae18||0xcc;return function(_0x132868){if(_0x132868){return _0x1359e5[_0x31c8('0x19')](_0x3bae18);}return _0x1359e5[_0x31c8('0x1a')](_0x3bae18)[_0x31c8('0x1b')]();};}function respondWithResult(_0x245428,_0x39914b){_0x39914b=_0x39914b||0xc8;return function(_0x52817b){if(_0x52817b){return _0x245428[_0x31c8('0x1a')](_0x39914b)[_0x31c8('0x1c')](_0x52817b);}};}function respondWithFilteredResult(_0x2ba5d8,_0x264137){return function(_0x1d7405){if(_0x1d7405){var _0x1dbc46=typeof _0x264137[_0x31c8('0x1d')]==='undefined'&&typeof _0x264137[_0x31c8('0x1e')]===_0x31c8('0x1f');var _0x4ed086=_0x1d7405['count'];var _0x1c74b0=_0x1dbc46?0x0:_0x264137[_0x31c8('0x1d')];var _0x50c9ee=_0x1dbc46?_0x1d7405['count']:_0x264137[_0x31c8('0x1d')]+_0x264137['limit'];var _0x46e3b8;if(_0x50c9ee>=_0x4ed086){_0x50c9ee=_0x4ed086;_0x46e3b8=0xc8;}else{_0x46e3b8=0xce;}_0x2ba5d8[_0x31c8('0x1a')](_0x46e3b8);return _0x2ba5d8[_0x31c8('0x20')]('Content-Range',_0x1c74b0+'-'+_0x50c9ee+'/'+_0x4ed086)[_0x31c8('0x1c')](_0x1d7405);}return null;};}function patchUpdates(_0x3c42dc){return function(_0x5bc895){try{jsonpatch['apply'](_0x5bc895,_0x3c42dc,!![]);}catch(_0xc0bb3a){return BPromise[_0x31c8('0x21')](_0xc0bb3a);}return _0x5bc895[_0x31c8('0x22')]();};}function saveUpdates(_0x833fe6,_0x1c3701){return function(_0x4ee954){if(_0x4ee954){return _0x4ee954[_0x31c8('0x23')](_0x833fe6)['then'](function(_0x233fd5){return _0x233fd5;});}return null;};}function removeEntity(_0x34597e,_0x28e3af){return function(_0x11af07){if(_0x11af07){return _0x11af07[_0x31c8('0x24')]()[_0x31c8('0x25')](function(){_0x34597e[_0x31c8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c7ff0,_0x3f2bf){return function(_0x595453){if(!_0x595453){_0x4c7ff0[_0x31c8('0x19')](0x194);}return _0x595453;};}function handleError(_0x1fb6f3,_0x364215){_0x364215=_0x364215||0x1f4;return function(_0x37c3ff){logger['error'](_0x37c3ff['stack']);if(_0x37c3ff[_0x31c8('0x26')]){delete _0x37c3ff[_0x31c8('0x26')];}_0x1fb6f3[_0x31c8('0x1a')](_0x364215)[_0x31c8('0x27')](_0x37c3ff);};}exports['index']=function(_0x6fc3bb,_0xbeeb30){var _0x3f901f={},_0x2fc54d={},_0x39c18d={'count':0x0,'rows':[]};var _0x5f4dad=_['map'](db[_0x31c8('0x28')][_0x31c8('0x29')],function(_0x2f59e0){return{'name':_0x2f59e0[_0x31c8('0x2a')],'type':_0x2f59e0['type'][_0x31c8('0x2b')]};});_0x2fc54d['model']=_['map'](_0x5f4dad,'name');_0x2fc54d[_0x31c8('0x2c')]=_['keys'](_0x6fc3bb[_0x31c8('0x2c')]);_0x2fc54d[_0x31c8('0x2d')]=_[_0x31c8('0x2e')](_0x2fc54d[_0x31c8('0x2f')],_0x2fc54d[_0x31c8('0x2c')]);_0x3f901f[_0x31c8('0x30')]=_['intersection'](_0x2fc54d['model'],qs[_0x31c8('0x31')](_0x6fc3bb['query'][_0x31c8('0x31')]));_0x3f901f['attributes']=_0x3f901f['attributes'][_0x31c8('0x32')]?_0x3f901f[_0x31c8('0x30')]:_0x2fc54d['model'];if(!_0x6fc3bb[_0x31c8('0x2c')]['hasOwnProperty'](_0x31c8('0x33'))){_0x3f901f[_0x31c8('0x1e')]=qs[_0x31c8('0x1e')](_0x6fc3bb[_0x31c8('0x2c')][_0x31c8('0x1e')]);_0x3f901f[_0x31c8('0x1d')]=qs['offset'](_0x6fc3bb[_0x31c8('0x2c')]['offset']);}_0x3f901f[_0x31c8('0x34')]=qs[_0x31c8('0x35')](_0x6fc3bb[_0x31c8('0x2c')][_0x31c8('0x35')]);_0x3f901f['where']=qs[_0x31c8('0x2d')](_[_0x31c8('0x36')](_0x6fc3bb[_0x31c8('0x2c')],_0x2fc54d['filters']),_0x5f4dad);if(_0x6fc3bb['query'][_0x31c8('0x37')]){_0x3f901f[_0x31c8('0x38')]=_['merge'](_0x3f901f[_0x31c8('0x38')],{'$or':_[_0x31c8('0x39')](_0x5f4dad,function(_0x2b210c){if(_0x2b210c[_0x31c8('0x3a')]!==_0x31c8('0x3b')){var _0x23ad70={};_0x23ad70[_0x2b210c['name']]={'$like':'%'+_0x6fc3bb[_0x31c8('0x2c')][_0x31c8('0x37')]+'%'};return _0x23ad70;}})});}_0x3f901f=_['merge']({},_0x3f901f,_0x6fc3bb['options']);var _0x31e83c={'where':_0x3f901f['where']};return db[_0x31c8('0x28')][_0x31c8('0x3c')](_0x31e83c)[_0x31c8('0x25')](function(_0x1776ef){_0x39c18d[_0x31c8('0x3c')]=_0x1776ef;if(_0x6fc3bb[_0x31c8('0x2c')][_0x31c8('0x3d')]){_0x3f901f[_0x31c8('0x3e')]=[{'all':!![]}];}return db[_0x31c8('0x28')][_0x31c8('0x3f')](_0x3f901f);})[_0x31c8('0x25')](function(_0x4c006f){_0x39c18d[_0x31c8('0x40')]=_0x4c006f;return _0x39c18d;})[_0x31c8('0x25')](respondWithFilteredResult(_0xbeeb30,_0x3f901f))[_0x31c8('0x41')](handleError(_0xbeeb30,null));};exports[_0x31c8('0x42')]=function(_0x5e8ce8,_0x137ea9){var _0x292a6c={'raw':![],'where':{'id':_0x5e8ce8['params']['id']}},_0x398c5e={};_0x398c5e['model']=_[_0x31c8('0x43')](db[_0x31c8('0x28')]['rawAttributes']);_0x398c5e['query']=_[_0x31c8('0x43')](_0x5e8ce8[_0x31c8('0x2c')]);_0x398c5e[_0x31c8('0x2d')]=_[_0x31c8('0x2e')](_0x398c5e[_0x31c8('0x2f')],_0x398c5e[_0x31c8('0x2c')]);_0x292a6c[_0x31c8('0x30')]=_[_0x31c8('0x2e')](_0x398c5e[_0x31c8('0x2f')],qs[_0x31c8('0x31')](_0x5e8ce8[_0x31c8('0x2c')]['fields']));_0x292a6c['attributes']=_0x292a6c[_0x31c8('0x30')][_0x31c8('0x32')]?_0x292a6c[_0x31c8('0x30')]:_0x398c5e['model'];if(_0x5e8ce8[_0x31c8('0x2c')][_0x31c8('0x3d')]){_0x292a6c[_0x31c8('0x3e')]=[{'all':!![]}];}_0x292a6c=_[_0x31c8('0x44')]({},_0x292a6c,_0x5e8ce8[_0x31c8('0x45')]);return db[_0x31c8('0x28')][_0x31c8('0x46')](_0x292a6c)[_0x31c8('0x25')](handleEntityNotFound(_0x137ea9,null))['then'](respondWithResult(_0x137ea9,null))['catch'](handleError(_0x137ea9,null));};exports[_0x31c8('0x47')]=function(_0xf9d066,_0x482a2e){return db[_0x31c8('0x28')]['create'](_0xf9d066[_0x31c8('0x48')],{})[_0x31c8('0x25')](respondWithResult(_0x482a2e,0xc9))[_0x31c8('0x41')](handleError(_0x482a2e,null));};exports[_0x31c8('0x23')]=function(_0x344951,_0x18ddf9){if(_0x344951[_0x31c8('0x48')]['id']){delete _0x344951[_0x31c8('0x48')]['id'];}return db[_0x31c8('0x28')][_0x31c8('0x46')]({'where':{'id':_0x344951[_0x31c8('0x49')]['id']}})[_0x31c8('0x25')](handleEntityNotFound(_0x18ddf9,null))['then'](saveUpdates(_0x344951[_0x31c8('0x48')],null))[_0x31c8('0x25')](respondWithResult(_0x18ddf9,null))['catch'](handleError(_0x18ddf9,null));};exports[_0x31c8('0x24')]=function(_0x4d343b,_0x1cbd95){return db['ZohoAccount'][_0x31c8('0x46')]({'where':{'id':_0x4d343b[_0x31c8('0x49')]['id']}})[_0x31c8('0x25')](handleEntityNotFound(_0x1cbd95,null))[_0x31c8('0x25')](removeEntity(_0x1cbd95,null))[_0x31c8('0x41')](handleError(_0x1cbd95,null));};exports['getConfigurations']=function(_0x3a4d6d,_0x3fd8ad,_0x5a175e){var _0x51f5af={};var _0x567c9a={};var _0x558a13;var _0x2ea8c9;return db[_0x31c8('0x28')]['findOne']({'where':{'id':_0x3a4d6d[_0x31c8('0x49')]['id']}})[_0x31c8('0x25')](handleEntityNotFound(_0x3fd8ad,null))[_0x31c8('0x25')](function(_0x327b1f){if(_0x327b1f){_0x558a13=_0x327b1f;_0x567c9a[_0x31c8('0x2f')]=_[_0x31c8('0x43')](db[_0x31c8('0x4a')][_0x31c8('0x29')]);_0x567c9a[_0x31c8('0x2c')]=_[_0x31c8('0x43')](_0x3a4d6d['query']);_0x567c9a[_0x31c8('0x2d')]=_['intersection'](_0x567c9a[_0x31c8('0x2f')],_0x567c9a['query']);_0x51f5af[_0x31c8('0x30')]=_[_0x31c8('0x2e')](_0x567c9a[_0x31c8('0x2f')],qs[_0x31c8('0x31')](_0x3a4d6d[_0x31c8('0x2c')][_0x31c8('0x31')]));_0x51f5af[_0x31c8('0x30')]=_0x51f5af[_0x31c8('0x30')]['length']?_0x51f5af[_0x31c8('0x30')]:_0x567c9a[_0x31c8('0x2f')];_0x51f5af[_0x31c8('0x34')]=qs['sort'](_0x3a4d6d[_0x31c8('0x2c')]['sort']);_0x51f5af[_0x31c8('0x38')]=qs[_0x31c8('0x2d')](_['pick'](_0x3a4d6d[_0x31c8('0x2c')],_0x567c9a[_0x31c8('0x2d')]));if(_0x3a4d6d[_0x31c8('0x2c')]['filter']){_0x51f5af['where']=_[_0x31c8('0x44')](_0x51f5af['where'],{'$or':_[_0x31c8('0x39')](_0x51f5af[_0x31c8('0x30')],function(_0x4cb104){var _0x202d19={};_0x202d19[_0x4cb104]={'$like':'%'+_0x3a4d6d['query'][_0x31c8('0x37')]+'%'};return _0x202d19;})});}_0x51f5af=_[_0x31c8('0x44')]({},_0x51f5af,_0x3a4d6d[_0x31c8('0x45')]);return _0x558a13[_0x31c8('0x4b')](_0x51f5af);}})['then'](function(_0x3d8759){if(_0x3d8759){_0x2ea8c9=_0x3d8759[_0x31c8('0x32')];if(!_0x3a4d6d[_0x31c8('0x2c')][_0x31c8('0x4c')](_0x31c8('0x33'))){_0x51f5af[_0x31c8('0x1e')]=qs[_0x31c8('0x1e')](_0x3a4d6d[_0x31c8('0x2c')][_0x31c8('0x1e')]);_0x51f5af['offset']=qs[_0x31c8('0x1d')](_0x3a4d6d['query'][_0x31c8('0x1d')]);}return _0x558a13['getConfigurations'](_0x51f5af);}})[_0x31c8('0x25')](function(_0x40f40f){if(_0x40f40f){return _0x40f40f?{'count':_0x2ea8c9,'rows':_0x40f40f}:null;}})['then'](respondWithResult(_0x3fd8ad,null))['catch'](handleError(_0x3fd8ad,null));};exports[_0x31c8('0x4d')]=function(_0x245689,_0x19078f,_0x432bc2){if(_0x245689[_0x31c8('0x48')]['id']){delete _0x245689[_0x31c8('0x48')]['id'];}return db[_0x31c8('0x28')][_0x31c8('0x4e')]({'where':{'id':_0x245689[_0x31c8('0x49')]['id']}})['then'](handleEntityNotFound(_0x19078f,null))[_0x31c8('0x25')](function(_0xc64dc4){if(_0xc64dc4){_0x245689[_0x31c8('0x48')]['AccountId']=_0xc64dc4['id'];_0x245689[_0x31c8('0x48')][_0x31c8('0x4f')]=integrations['getSubjects'](_0x245689['body']['channel'],_0x245689['body']['type']);_0x245689[_0x31c8('0x48')][_0x31c8('0x50')]=integrations['getDescriptions'](_0x245689[_0x31c8('0x48')][_0x31c8('0x51')],_0x245689['body'][_0x31c8('0x3a')]);return db['ZohoConfiguration'][_0x31c8('0x47')](_0x245689['body'],{'include':[{'model':db[_0x31c8('0x52')],'as':'Subjects'},{'model':db[_0x31c8('0x52')],'as':_0x31c8('0x50')}]});}return null;})[_0x31c8('0x25')](respondWithResult(_0x19078f,null))[_0x31c8('0x41')](handleError(_0x19078f,null));};function getAccessToken(_0x4b1daf){return new Promise(function(_0x36c89c,_0x40f063){var _0x25f47f;switch(_0x4b1daf['zone']){case'US':_0x25f47f=_0x31c8('0x53');break;case'AU':_0x25f47f=_0x31c8('0x54');break;case'EU':_0x25f47f=_0x31c8('0x55');break;case'IN':_0x25f47f='https://accounts.zoho.in';break;case'CN':_0x25f47f=_0x31c8('0x56');break;default:_0x25f47f=_0x31c8('0x55');break;}var _0x348ccb={'method':_0x31c8('0x57'),'uri':_0x25f47f+'/oauth/v2/token','qs':{'refresh_token':_0x4b1daf['refreshToken'],'client_id':_0x4b1daf[_0x31c8('0x58')],'client_secret':_0x4b1daf['clientSecret'],'grant_type':_0x31c8('0x59')},'json':!![]};return rp(_0x348ccb)[_0x31c8('0x25')](function(_0x2a3253){if(_0x2a3253[_0x31c8('0x5a')]){_0x36c89c(_0x2a3253['access_token']);}else{_0x40f063(_0x31c8('0x5b'));}})['catch'](function(_0x209638){_0x40f063(_0x209638);});});}exports[_0x31c8('0x5c')]=function(_0x216a53,_0x413ea9,_0x4f94a0){var _0xbc9a7,_0x19cb2a,_0x339089,_0x2ad72f,_0xbfa43d;return db[_0x31c8('0x28')][_0x31c8('0x4e')]({'where':{'id':_0x216a53[_0x31c8('0x49')]['id']},'attributes':['id',_0x31c8('0x5d'),'zone','clientId',_0x31c8('0x5e'),_0x31c8('0x5f'),_0x31c8('0x60'),_0x31c8('0x61')]})[_0x31c8('0x25')](handleEntityNotFound(_0x413ea9,null))[_0x31c8('0x25')](function(_0x4b4940){_0xbfa43d=_0x4b4940;_0xbc9a7=_0xbfa43d['host'];_0x19cb2a=_0xbc9a7===_0x31c8('0x62')?'eu':_0x31c8('0x63');_0x339089=_0xbfa43d[_0x31c8('0x5f')];var _0x52ebe4=_0x339089[_0x31c8('0x64')](-0x1);if(_0x52ebe4==='/'||_0x52ebe4==='\x5c'||_0x52ebe4===':'){_0x339089=_0x339089['substring'](0x0,_0x339089['lastIndexOf'](_0x52ebe4));}if(!_0xbfa43d[_0x31c8('0x61')]){throw new Error(_0x31c8('0x65'));}return getAccessToken(_0xbfa43d);})['then'](function(_0x41c57a){if(_0x41c57a){return rp({'method':_0x31c8('0x66'),'uri':util[_0x31c8('0x67')](_0x31c8('0x68'),_0x19cb2a),'qs':{'module':_0x31c8('0x69')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x41c57a},'json':!![]});}})['then'](function(_0x224e1c){if(_0x224e1c){if(_0x224e1c[_0x31c8('0x6a')]&&_0x224e1c[_0x31c8('0x6a')][_0x31c8('0x6b')]){throw new Error(_0x224e1c[_0x31c8('0x6a')][_0x31c8('0x6b')][_0x31c8('0x6c')]);}var _0x4b9726=[];var _0x3106aa=[];var _0x477303=['Owner',_0x31c8('0x6d'),_0x31c8('0x6e'),_0x31c8('0x6f'),_0x31c8('0x70'),_0x31c8('0x71'),_0x31c8('0x72'),'Call_Type'];_0x3106aa=_[_0x31c8('0x73')](_0x224e1c[_0x31c8('0x31')],function(_0x534aef){return _0x477303[_0x31c8('0x74')](_0x534aef['api_name']);});for(var _0x242078=0x0;_0x242078<_0x3106aa[_0x31c8('0x32')];_0x242078++){if(_0x3106aa[_0x242078][_0x31c8('0x75')]===![]){_0x4b9726[_0x31c8('0x76')]({'id':_0x3106aa[_0x242078]['id'],'name':_0x3106aa[_0x242078]['display_label'],'custom':_0x3106aa[_0x242078]['custom_field'],'options':_0x3106aa[_0x242078][_0x31c8('0x77')]==='picklist'&&_0x3106aa[_0x242078][_0x31c8('0x78')]['length']>-0x1?_['map'](_0x3106aa[_0x242078]['pick_list_values'],function(_0x5c8583){return{'name':_0x5c8583,'value':_0x5c8583};}):[]});}}return{'count':_0x4b9726['length'],'rows':_0x4b9726};}else{return{'count':0x0,'rows':[]};}})[_0x31c8('0x25')](respondWithResult(_0x413ea9,null))[_0x31c8('0x41')](function(_0x519219){var _0x470c1c=_0x216a53[_0x31c8('0x2c')][_0x31c8('0x79')]?0x1f4:_0x519219['statusCode']||0x1f4;logger[_0x31c8('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0x31c8('0x5c'),_0x470c1c,JSON['stringify'](_0x519219));delete _0x519219[_0x31c8('0x26')];if(_0x470c1c===0x191){_0x470c1c=0x190;}_0x413ea9['status'](_0x470c1c)[_0x31c8('0x27')](_0x216a53['query'][_0x31c8('0x79')]?{'message':_0x31c8('0x7a'),'statusCode':_0x519219[_0x31c8('0x7b')]}:_0x519219);});}; \ No newline at end of file +var _0x2f9a=['then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','getFields','host','com','substring','lastIndexOf','GET','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update'];(function(_0x163000,_0x1c14e5){var _0x3b3fdd=function(_0x1a4427){while(--_0x1a4427){_0x163000['push'](_0x163000['shift']());}};_0x3b3fdd(++_0x1c14e5);}(_0x2f9a,0xd0));var _0xa2f9=function(_0x2f479d,_0x1d6836){_0x2f479d=_0x2f479d-0x0;var _0x300d48=_0x2f9a[_0x2f479d];return _0x300d48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2f9('0x0'));var zipdir=require(_0xa2f9('0x1'));var jsonpatch=require(_0xa2f9('0x2'));var rp=require('request-promise');var moment=require(_0xa2f9('0x3'));var BPromise=require(_0xa2f9('0x4'));var Mustache=require(_0xa2f9('0x5'));var util=require(_0xa2f9('0x6'));var path=require(_0xa2f9('0x7'));var sox=require('sox');var csv=require(_0xa2f9('0x8'));var ejs=require(_0xa2f9('0x9'));var fs=require('fs');var fs_extra=require(_0xa2f9('0xa'));var _=require(_0xa2f9('0xb'));var squel=require(_0xa2f9('0xc'));var crypto=require(_0xa2f9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa2f9('0xe'));var Papa=require(_0xa2f9('0xf'));var Redis=require(_0xa2f9('0x10'));var authService=require(_0xa2f9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa2f9('0x12'));var hardwareService=require(_0xa2f9('0x13'));var logger=require(_0xa2f9('0x14'))('api');var utils=require(_0xa2f9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa2f9('0x16'));var db=require(_0xa2f9('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4d54f9,_0x39a790){_0x39a790=_0x39a790||0xcc;return function(_0x4ecb0d){if(_0x4ecb0d){return _0x4d54f9['sendStatus'](_0x39a790);}return _0x4d54f9[_0xa2f9('0x18')](_0x39a790)[_0xa2f9('0x19')]();};}function respondWithResult(_0x4afd45,_0x19e91b){_0x19e91b=_0x19e91b||0xc8;return function(_0x3e6762){if(_0x3e6762){return _0x4afd45[_0xa2f9('0x18')](_0x19e91b)[_0xa2f9('0x1a')](_0x3e6762);}};}function respondWithFilteredResult(_0x357e7a,_0x19abe6){return function(_0x56dda9){if(_0x56dda9){var _0x58bc54=typeof _0x19abe6['offset']==='undefined'&&typeof _0x19abe6[_0xa2f9('0x1b')]===_0xa2f9('0x1c');var _0x5a96df=_0x56dda9[_0xa2f9('0x1d')];var _0x490c8e=_0x58bc54?0x0:_0x19abe6[_0xa2f9('0x1e')];var _0x4bbfc8=_0x58bc54?_0x56dda9['count']:_0x19abe6[_0xa2f9('0x1e')]+_0x19abe6[_0xa2f9('0x1b')];var _0x3e41ac;if(_0x4bbfc8>=_0x5a96df){_0x4bbfc8=_0x5a96df;_0x3e41ac=0xc8;}else{_0x3e41ac=0xce;}_0x357e7a[_0xa2f9('0x18')](_0x3e41ac);return _0x357e7a['set'](_0xa2f9('0x1f'),_0x490c8e+'-'+_0x4bbfc8+'/'+_0x5a96df)[_0xa2f9('0x1a')](_0x56dda9);}return null;};}function patchUpdates(_0x2e9334){return function(_0x2551a3){try{jsonpatch[_0xa2f9('0x20')](_0x2551a3,_0x2e9334,!![]);}catch(_0x527bdf){return BPromise[_0xa2f9('0x21')](_0x527bdf);}return _0x2551a3[_0xa2f9('0x22')]();};}function saveUpdates(_0x94c570,_0x28f544){return function(_0x81e816){if(_0x81e816){return _0x81e816[_0xa2f9('0x23')](_0x94c570)[_0xa2f9('0x24')](function(_0x37477a){return _0x37477a;});}return null;};}function removeEntity(_0x4f7411,_0x394902){return function(_0x37d1d2){if(_0x37d1d2){return _0x37d1d2[_0xa2f9('0x25')]()[_0xa2f9('0x24')](function(){_0x4f7411[_0xa2f9('0x18')](0xcc)[_0xa2f9('0x19')]();});}};}function handleEntityNotFound(_0x4a8fc4,_0x5d6604){return function(_0x178269){if(!_0x178269){_0x4a8fc4[_0xa2f9('0x26')](0x194);}return _0x178269;};}function handleError(_0x14fa5a,_0x5f4f73){_0x5f4f73=_0x5f4f73||0x1f4;return function(_0x57df84){logger[_0xa2f9('0x27')](_0x57df84[_0xa2f9('0x28')]);if(_0x57df84[_0xa2f9('0x29')]){delete _0x57df84[_0xa2f9('0x29')];}_0x14fa5a[_0xa2f9('0x18')](_0x5f4f73)[_0xa2f9('0x2a')](_0x57df84);};}exports[_0xa2f9('0x2b')]=function(_0x40456d,_0x5853f1){var _0x2b63d1={},_0x3d43e6={},_0x165fde={'count':0x0,'rows':[]};var _0x329d56=_[_0xa2f9('0x2c')](db[_0xa2f9('0x2d')][_0xa2f9('0x2e')],function(_0x14ee78){return{'name':_0x14ee78[_0xa2f9('0x2f')],'type':_0x14ee78[_0xa2f9('0x30')]['key']};});_0x3d43e6[_0xa2f9('0x31')]=_[_0xa2f9('0x2c')](_0x329d56,_0xa2f9('0x29'));_0x3d43e6[_0xa2f9('0x32')]=_[_0xa2f9('0x33')](_0x40456d[_0xa2f9('0x32')]);_0x3d43e6[_0xa2f9('0x34')]=_[_0xa2f9('0x35')](_0x3d43e6[_0xa2f9('0x31')],_0x3d43e6[_0xa2f9('0x32')]);_0x2b63d1[_0xa2f9('0x36')]=_[_0xa2f9('0x35')](_0x3d43e6[_0xa2f9('0x31')],qs[_0xa2f9('0x37')](_0x40456d['query'][_0xa2f9('0x37')]));_0x2b63d1[_0xa2f9('0x36')]=_0x2b63d1[_0xa2f9('0x36')][_0xa2f9('0x38')]?_0x2b63d1[_0xa2f9('0x36')]:_0x3d43e6[_0xa2f9('0x31')];if(!_0x40456d[_0xa2f9('0x32')]['hasOwnProperty'](_0xa2f9('0x39'))){_0x2b63d1[_0xa2f9('0x1b')]=qs['limit'](_0x40456d['query'][_0xa2f9('0x1b')]);_0x2b63d1['offset']=qs['offset'](_0x40456d['query']['offset']);}_0x2b63d1['order']=qs['sort'](_0x40456d[_0xa2f9('0x32')][_0xa2f9('0x3a')]);_0x2b63d1[_0xa2f9('0x3b')]=qs[_0xa2f9('0x34')](_[_0xa2f9('0x3c')](_0x40456d[_0xa2f9('0x32')],_0x3d43e6[_0xa2f9('0x34')]),_0x329d56);if(_0x40456d['query'][_0xa2f9('0x3d')]){_0x2b63d1['where']=_[_0xa2f9('0x3e')](_0x2b63d1[_0xa2f9('0x3b')],{'$or':_[_0xa2f9('0x2c')](_0x329d56,function(_0x565890){if(_0x565890[_0xa2f9('0x30')]!=='VIRTUAL'){var _0x1565f1={};_0x1565f1[_0x565890[_0xa2f9('0x29')]]={'$like':'%'+_0x40456d[_0xa2f9('0x32')][_0xa2f9('0x3d')]+'%'};return _0x1565f1;}})});}_0x2b63d1=_[_0xa2f9('0x3e')]({},_0x2b63d1,_0x40456d[_0xa2f9('0x3f')]);var _0x428956={'where':_0x2b63d1['where']};return db['ZohoAccount']['count'](_0x428956)[_0xa2f9('0x24')](function(_0x221921){_0x165fde['count']=_0x221921;if(_0x40456d[_0xa2f9('0x32')][_0xa2f9('0x40')]){_0x2b63d1['include']=[{'all':!![]}];}return db[_0xa2f9('0x2d')][_0xa2f9('0x41')](_0x2b63d1);})['then'](function(_0x1309d0){_0x165fde[_0xa2f9('0x42')]=_0x1309d0;return _0x165fde;})[_0xa2f9('0x24')](respondWithFilteredResult(_0x5853f1,_0x2b63d1))[_0xa2f9('0x43')](handleError(_0x5853f1,null));};exports[_0xa2f9('0x44')]=function(_0xf304fc,_0x1136a2){var _0x50e679={'raw':![],'where':{'id':_0xf304fc['params']['id']}},_0x3b7149={};_0x3b7149[_0xa2f9('0x31')]=_[_0xa2f9('0x33')](db[_0xa2f9('0x2d')][_0xa2f9('0x2e')]);_0x3b7149['query']=_[_0xa2f9('0x33')](_0xf304fc[_0xa2f9('0x32')]);_0x3b7149[_0xa2f9('0x34')]=_[_0xa2f9('0x35')](_0x3b7149[_0xa2f9('0x31')],_0x3b7149['query']);_0x50e679[_0xa2f9('0x36')]=_[_0xa2f9('0x35')](_0x3b7149[_0xa2f9('0x31')],qs[_0xa2f9('0x37')](_0xf304fc['query'][_0xa2f9('0x37')]));_0x50e679[_0xa2f9('0x36')]=_0x50e679[_0xa2f9('0x36')][_0xa2f9('0x38')]?_0x50e679[_0xa2f9('0x36')]:_0x3b7149[_0xa2f9('0x31')];if(_0xf304fc[_0xa2f9('0x32')][_0xa2f9('0x40')]){_0x50e679[_0xa2f9('0x45')]=[{'all':!![]}];}_0x50e679=_[_0xa2f9('0x3e')]({},_0x50e679,_0xf304fc['options']);return db[_0xa2f9('0x2d')][_0xa2f9('0x46')](_0x50e679)[_0xa2f9('0x24')](handleEntityNotFound(_0x1136a2,null))['then'](respondWithResult(_0x1136a2,null))[_0xa2f9('0x43')](handleError(_0x1136a2,null));};exports[_0xa2f9('0x47')]=function(_0x5766c4,_0x52f347){return db[_0xa2f9('0x2d')][_0xa2f9('0x47')](_0x5766c4['body'],{})[_0xa2f9('0x24')](respondWithResult(_0x52f347,0xc9))[_0xa2f9('0x43')](handleError(_0x52f347,null));};exports['update']=function(_0x57c22f,_0x15af94){if(_0x57c22f[_0xa2f9('0x48')]['id']){delete _0x57c22f[_0xa2f9('0x48')]['id'];}return db[_0xa2f9('0x2d')][_0xa2f9('0x46')]({'where':{'id':_0x57c22f[_0xa2f9('0x49')]['id']}})['then'](handleEntityNotFound(_0x15af94,null))[_0xa2f9('0x24')](saveUpdates(_0x57c22f[_0xa2f9('0x48')],null))[_0xa2f9('0x24')](respondWithResult(_0x15af94,null))[_0xa2f9('0x43')](handleError(_0x15af94,null));};exports[_0xa2f9('0x25')]=function(_0x436702,_0x5aff04){return db['ZohoAccount'][_0xa2f9('0x46')]({'where':{'id':_0x436702[_0xa2f9('0x49')]['id']}})[_0xa2f9('0x24')](handleEntityNotFound(_0x5aff04,null))[_0xa2f9('0x24')](removeEntity(_0x5aff04,null))[_0xa2f9('0x43')](handleError(_0x5aff04,null));};exports[_0xa2f9('0x4a')]=function(_0xbf9a35,_0x3d6bb8,_0xcd0013){var _0x416e36={};var _0x2b4732={};var _0x500eba;var _0x4bbd2d;return db[_0xa2f9('0x2d')][_0xa2f9('0x4b')]({'where':{'id':_0xbf9a35[_0xa2f9('0x49')]['id']}})[_0xa2f9('0x24')](handleEntityNotFound(_0x3d6bb8,null))['then'](function(_0x2c7155){if(_0x2c7155){_0x500eba=_0x2c7155;_0x2b4732['model']=_[_0xa2f9('0x33')](db[_0xa2f9('0x4c')][_0xa2f9('0x2e')]);_0x2b4732[_0xa2f9('0x32')]=_[_0xa2f9('0x33')](_0xbf9a35[_0xa2f9('0x32')]);_0x2b4732[_0xa2f9('0x34')]=_[_0xa2f9('0x35')](_0x2b4732[_0xa2f9('0x31')],_0x2b4732[_0xa2f9('0x32')]);_0x416e36[_0xa2f9('0x36')]=_[_0xa2f9('0x35')](_0x2b4732[_0xa2f9('0x31')],qs['fields'](_0xbf9a35[_0xa2f9('0x32')][_0xa2f9('0x37')]));_0x416e36['attributes']=_0x416e36['attributes']['length']?_0x416e36[_0xa2f9('0x36')]:_0x2b4732['model'];_0x416e36['order']=qs[_0xa2f9('0x3a')](_0xbf9a35['query'][_0xa2f9('0x3a')]);_0x416e36['where']=qs[_0xa2f9('0x34')](_[_0xa2f9('0x3c')](_0xbf9a35['query'],_0x2b4732['filters']));if(_0xbf9a35[_0xa2f9('0x32')][_0xa2f9('0x3d')]){_0x416e36[_0xa2f9('0x3b')]=_[_0xa2f9('0x3e')](_0x416e36[_0xa2f9('0x3b')],{'$or':_[_0xa2f9('0x2c')](_0x416e36['attributes'],function(_0x390a8d){var _0x3da6bd={};_0x3da6bd[_0x390a8d]={'$like':'%'+_0xbf9a35[_0xa2f9('0x32')]['filter']+'%'};return _0x3da6bd;})});}_0x416e36=_['merge']({},_0x416e36,_0xbf9a35[_0xa2f9('0x3f')]);return _0x500eba[_0xa2f9('0x4a')](_0x416e36);}})[_0xa2f9('0x24')](function(_0x251cdb){if(_0x251cdb){_0x4bbd2d=_0x251cdb[_0xa2f9('0x38')];if(!_0xbf9a35[_0xa2f9('0x32')]['hasOwnProperty']('nolimit')){_0x416e36[_0xa2f9('0x1b')]=qs[_0xa2f9('0x1b')](_0xbf9a35['query'][_0xa2f9('0x1b')]);_0x416e36['offset']=qs[_0xa2f9('0x1e')](_0xbf9a35[_0xa2f9('0x32')][_0xa2f9('0x1e')]);}return _0x500eba[_0xa2f9('0x4a')](_0x416e36);}})[_0xa2f9('0x24')](function(_0x2ddc5f){if(_0x2ddc5f){return _0x2ddc5f?{'count':_0x4bbd2d,'rows':_0x2ddc5f}:null;}})[_0xa2f9('0x24')](respondWithResult(_0x3d6bb8,null))[_0xa2f9('0x43')](handleError(_0x3d6bb8,null));};exports[_0xa2f9('0x4d')]=function(_0x2a4d1d,_0x1c0d7d,_0x7f0d1c){if(_0x2a4d1d[_0xa2f9('0x48')]['id']){delete _0x2a4d1d[_0xa2f9('0x48')]['id'];}return db[_0xa2f9('0x2d')][_0xa2f9('0x4b')]({'where':{'id':_0x2a4d1d[_0xa2f9('0x49')]['id']}})[_0xa2f9('0x24')](handleEntityNotFound(_0x1c0d7d,null))[_0xa2f9('0x24')](function(_0x5aa648){if(_0x5aa648){_0x2a4d1d['body'][_0xa2f9('0x4e')]=_0x5aa648['id'];_0x2a4d1d[_0xa2f9('0x48')][_0xa2f9('0x4f')]=integrations[_0xa2f9('0x50')](_0x2a4d1d[_0xa2f9('0x48')]['channel'],_0x2a4d1d[_0xa2f9('0x48')][_0xa2f9('0x30')]);_0x2a4d1d['body'][_0xa2f9('0x51')]=integrations[_0xa2f9('0x52')](_0x2a4d1d[_0xa2f9('0x48')][_0xa2f9('0x53')],_0x2a4d1d[_0xa2f9('0x48')][_0xa2f9('0x30')]);return db['ZohoConfiguration']['create'](_0x2a4d1d[_0xa2f9('0x48')],{'include':[{'model':db[_0xa2f9('0x54')],'as':_0xa2f9('0x4f')},{'model':db[_0xa2f9('0x54')],'as':'Descriptions'}]});}return null;})[_0xa2f9('0x24')](respondWithResult(_0x1c0d7d,null))[_0xa2f9('0x43')](handleError(_0x1c0d7d,null));};function getAccessToken(_0x4edadb){return new Promise(function(_0x116d1a,_0x5fcbf8){var _0x401976;switch(_0x4edadb[_0xa2f9('0x55')]){case'US':_0x401976=_0xa2f9('0x56');break;case'AU':_0x401976='https://accounts.zoho.com.au';break;case'EU':_0x401976=_0xa2f9('0x57');break;case'IN':_0x401976=_0xa2f9('0x58');break;case'CN':_0x401976=_0xa2f9('0x59');break;default:_0x401976=_0xa2f9('0x57');break;}var _0x47991d={'method':_0xa2f9('0x5a'),'uri':_0x401976+_0xa2f9('0x5b'),'qs':{'refresh_token':_0x4edadb[_0xa2f9('0x5c')],'client_id':_0x4edadb['clientId'],'client_secret':_0x4edadb[_0xa2f9('0x5d')],'grant_type':_0xa2f9('0x5e')},'json':!![]};return rp(_0x47991d)['then'](function(_0x18b084){if(_0x18b084['access_token']){_0x116d1a(_0x18b084[_0xa2f9('0x5f')]);}else{_0x5fcbf8('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xa2f9('0x43')](function(_0x3019aa){_0x5fcbf8(_0x3019aa);});});}exports[_0xa2f9('0x60')]=function(_0x41f546,_0x4c9d1a,_0x2047ce){var _0x15fcf8,_0xf4b3cf,_0x3630d0,_0x3a6881,_0x2525c9;return db[_0xa2f9('0x2d')][_0xa2f9('0x4b')]({'where':{'id':_0x41f546['params']['id']},'attributes':['id',_0xa2f9('0x61'),_0xa2f9('0x55'),'clientId',_0xa2f9('0x5d'),'serverUrl','code',_0xa2f9('0x5c')]})[_0xa2f9('0x24')](handleEntityNotFound(_0x4c9d1a,null))[_0xa2f9('0x24')](function(_0x4de74b){_0x2525c9=_0x4de74b;_0x15fcf8=_0x2525c9[_0xa2f9('0x61')];_0xf4b3cf=_0x15fcf8==='zoho.eu'?'eu':_0xa2f9('0x62');_0x3630d0=_0x2525c9['serverUrl'];var _0x471f1a=_0x3630d0['slice'](-0x1);if(_0x471f1a==='/'||_0x471f1a==='\x5c'||_0x471f1a===':'){_0x3630d0=_0x3630d0[_0xa2f9('0x63')](0x0,_0x3630d0[_0xa2f9('0x64')](_0x471f1a));}if(!_0x2525c9[_0xa2f9('0x5c')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2525c9);})[_0xa2f9('0x24')](function(_0x5e2149){if(_0x5e2149){return rp({'method':_0xa2f9('0x65'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0xf4b3cf),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5e2149},'json':!![]});}})['then'](function(_0x407a18){if(_0x407a18){if(_0x407a18[_0xa2f9('0x66')]&&_0x407a18[_0xa2f9('0x66')][_0xa2f9('0x27')]){throw new Error(_0x407a18[_0xa2f9('0x66')][_0xa2f9('0x27')][_0xa2f9('0x67')]);}var _0x429756=[];var _0x134714=[];var _0x52ba53=[_0xa2f9('0x68'),_0xa2f9('0x69'),_0xa2f9('0x6a'),_0xa2f9('0x6b'),_0xa2f9('0x6c'),_0xa2f9('0x6d'),_0xa2f9('0x6e'),_0xa2f9('0x6f')];_0x134714=_[_0xa2f9('0x70')](_0x407a18[_0xa2f9('0x37')],function(_0x6a6397){return _0x52ba53['includes'](_0x6a6397['api_name']);});for(var _0x415b57=0x0;_0x415b57<_0x134714['length'];_0x415b57++){if(_0x134714[_0x415b57][_0xa2f9('0x71')]===![]){_0x429756['push']({'id':_0x134714[_0x415b57]['id'],'name':_0x134714[_0x415b57][_0xa2f9('0x72')],'custom':_0x134714[_0x415b57][_0xa2f9('0x73')],'options':_0x134714[_0x415b57][_0xa2f9('0x74')]===_0xa2f9('0x75')&&_0x134714[_0x415b57][_0xa2f9('0x76')][_0xa2f9('0x38')]>-0x1?_[_0xa2f9('0x2c')](_0x134714[_0x415b57][_0xa2f9('0x76')],function(_0x1d77b8){return{'name':_0x1d77b8,'value':_0x1d77b8};}):[]});}}return{'count':_0x429756[_0xa2f9('0x38')],'rows':_0x429756};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4c9d1a,null))[_0xa2f9('0x43')](function(_0x58086b){var _0x6f082=_0x41f546[_0xa2f9('0x32')][_0xa2f9('0x77')]?0x1f4:_0x58086b[_0xa2f9('0x78')]||0x1f4;logger[_0xa2f9('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xa2f9('0x60'),_0x6f082,JSON['stringify'](_0x58086b));delete _0x58086b['name'];if(_0x6f082===0x191){_0x6f082=0x190;}_0x4c9d1a[_0xa2f9('0x18')](_0x6f082)[_0xa2f9('0x2a')](_0x41f546['query']['test']?{'message':_0xa2f9('0x79'),'statusCode':_0x58086b['statusCode']}:_0x58086b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 13e0ec0..e95855a 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 _0xc79d=['refreshToken','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientSecret','code','application/x-www-form-urlencoded','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','format','inspect','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','slice','lastIndexOf','authorization_code','parse'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xc79d,0x1af));var _0xdc79=function(_0x29f3b0,_0xa83012){_0x29f3b0=_0x29f3b0-0x0;var _0x379f39=_0xc79d[_0x29f3b0];return _0x379f39;};'use strict';var _=require(_0xdc79('0x0'));var util=require(_0xdc79('0x1'));var logger=require(_0xdc79('0x2'))(_0xdc79('0x3'));var moment=require(_0xdc79('0x4'));var BPromise=require(_0xdc79('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc79('0x6'));var rimraf=require(_0xdc79('0x7'));var config=require(_0xdc79('0x8'));var attributes=require(_0xdc79('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4670ef,_0x51b700){return _0x4670ef[_0xdc79('0xa')](_0xdc79('0xb'),attributes,{'tableName':_0xdc79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e0df1,_0x33ccf7,_0x3f5a65){if(_0x1e0df1[_0xdc79('0xd')](_0xdc79('0xe'))||_0x1e0df1['changed'](_0xdc79('0xf'))||_0x1e0df1[_0xdc79('0xd')](_0xdc79('0x10'))||_0x1e0df1[_0xdc79('0xd')]('clientSecret')||_0x1e0df1[_0xdc79('0xd')]('code')||_0x1e0df1['changed']('host')){var _0x55717e,_0x56c6c7;_0x55717e=_0x1e0df1[_0xdc79('0xf')];var _0x1a0bc2=_0x55717e['slice'](-0x1);if(_0x1a0bc2==='/'||_0x1a0bc2==='\x5c'||_0x1a0bc2===':'){_0x55717e=_0x55717e[_0xdc79('0x11')](0x0,_0x55717e['lastIndexOf'](_0x1a0bc2));}switch(_0x1e0df1[_0xdc79('0xe')]){case'US':_0x56c6c7=_0xdc79('0x12');break;case'AU':_0x56c6c7=_0xdc79('0x13');break;case'IN':_0x56c6c7=_0xdc79('0x14');break;case'CN':_0x56c6c7=_0xdc79('0x15');break;default:_0x56c6c7=_0xdc79('0x16');break;}var _0x1d2745={'method':_0xdc79('0x17'),'uri':_0x56c6c7+_0xdc79('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x1e0df1[_0xdc79('0x10')],'client_secret':_0x1e0df1[_0xdc79('0x19')],'redirect_uri':_0x1e0df1['serverUrl'],'code':_0x1e0df1[_0xdc79('0x1a')]},'headers':{'Content-Type':_0xdc79('0x1b')}};return rp(_0x1d2745)['then'](function(_0x3fab89){var _0x5d7b2d=JSON['parse'](_0x3fab89);if(_0x5d7b2d[_0xdc79('0x1c')]){_0x1e0df1['refreshToken']=_0x5d7b2d[_0xdc79('0x1c')];logger[_0xdc79('0x1d')](util['format'](_0xdc79('0x1e'),_0x1e0df1[_0xdc79('0x1f')],_0x1e0df1['id']));}else{logger['error'](util[_0xdc79('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1e0df1['name'],_0x1e0df1['id']),util[_0xdc79('0x21')](_0x5d7b2d,{'showHidden':![],'depth':null}));}return _0x3f5a65(null,_0x33ccf7);})[_0xdc79('0x22')](function(_0x3334e1){logger[_0xdc79('0x23')](util[_0xdc79('0x20')](_0xdc79('0x24'),_0x1e0df1['name'],_0x1e0df1['id']),util[_0xdc79('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x3f5a65(_0x3334e1);});}else{return _0x3f5a65(null,_0x33ccf7);}},'beforeUpdate':function(_0x498e56,_0x2d04ee,_0x2df702){if(_0x498e56[_0xdc79('0xd')]('zone')||_0x498e56['changed'](_0xdc79('0xf'))||_0x498e56[_0xdc79('0xd')]('clientId')||_0x498e56[_0xdc79('0xd')](_0xdc79('0x19'))||_0x498e56['changed'](_0xdc79('0x1a'))||_0x498e56[_0xdc79('0xd')](_0xdc79('0x25'))){var _0x1bd9f4,_0x85e335;_0x1bd9f4=_0x498e56[_0xdc79('0xf')];var _0x24cc2d=_0x1bd9f4[_0xdc79('0x26')](-0x1);if(_0x24cc2d==='/'||_0x24cc2d==='\x5c'||_0x24cc2d===':'){_0x1bd9f4=_0x1bd9f4[_0xdc79('0x11')](0x0,_0x1bd9f4[_0xdc79('0x27')](_0x24cc2d));}switch(_0x498e56['zone']){case'US':_0x85e335='https://accounts.zoho.com';break;case'AU':_0x85e335=_0xdc79('0x13');break;case'IN':_0x85e335=_0xdc79('0x14');break;case'CN':_0x85e335=_0xdc79('0x15');break;default:_0x85e335='https://accounts.zoho.eu';break;}var _0xea2ea1={'method':_0xdc79('0x17'),'uri':_0x85e335+_0xdc79('0x18'),'form':{'grant_type':_0xdc79('0x28'),'client_id':_0x498e56['clientId'],'client_secret':_0x498e56['clientSecret'],'redirect_uri':_0x498e56[_0xdc79('0xf')],'code':_0x498e56[_0xdc79('0x1a')]},'headers':{'Content-Type':_0xdc79('0x1b')}};return rp(_0xea2ea1)['then'](function(_0x379495){var _0xde7d59=JSON[_0xdc79('0x29')](_0x379495);if(_0xde7d59[_0xdc79('0x1c')]){_0x498e56[_0xdc79('0x2a')]=_0xde7d59[_0xdc79('0x1c')];logger[_0xdc79('0x1d')](util[_0xdc79('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x498e56[_0xdc79('0x1f')],_0x498e56['id']));}else{logger[_0xdc79('0x23')](util['format'](_0xdc79('0x24'),_0x498e56[_0xdc79('0x1f')],_0x498e56['id']),util['inspect'](_0xde7d59,{'showHidden':![],'depth':null}));}return _0x2df702(null,_0x2d04ee);})[_0xdc79('0x22')](function(_0x41fa24){logger[_0xdc79('0x23')](util['format'](_0xdc79('0x24'),_0x498e56[_0xdc79('0x1f')],_0x498e56['id']),util[_0xdc79('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x2df702(_0x41fa24);});}else{return _0x2df702(null,_0x2d04ee);}}}});}; \ No newline at end of file +var _0x8b97=['parse','refresh_token','format','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','lastIndexOf','https://accounts.zoho.com.cn','authorization_code','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','zone','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST'];(function(_0x50cd9b,_0xa3b69d){var _0xb000b9=function(_0x348102){while(--_0x348102){_0x50cd9b['push'](_0x50cd9b['shift']());}};_0xb000b9(++_0xa3b69d);}(_0x8b97,0x12d));var _0x78b9=function(_0xa4e9d,_0x5436d){_0xa4e9d=_0xa4e9d-0x0;var _0x4c577e=_0x8b97[_0xa4e9d];return _0x4c577e;};'use strict';var _=require(_0x78b9('0x0'));var util=require(_0x78b9('0x1'));var logger=require(_0x78b9('0x2'))(_0x78b9('0x3'));var moment=require(_0x78b9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78b9('0x5'));var rimraf=require(_0x78b9('0x6'));var config=require(_0x78b9('0x7'));var attributes=require(_0x78b9('0x8'));var integrations=require(_0x78b9('0x9'));module[_0x78b9('0xa')]=function(_0x17630c,_0x274d82){return _0x17630c[_0x78b9('0xb')](_0x78b9('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1f0ecd,_0x2f7486,_0x38b8fc){if(_0x1f0ecd['changed'](_0x78b9('0xd'))||_0x1f0ecd[_0x78b9('0xe')](_0x78b9('0xf'))||_0x1f0ecd['changed'](_0x78b9('0x10'))||_0x1f0ecd['changed'](_0x78b9('0x11'))||_0x1f0ecd[_0x78b9('0xe')](_0x78b9('0x12'))||_0x1f0ecd[_0x78b9('0xe')](_0x78b9('0x13'))){var _0x3d2ef3,_0x1cd974;_0x3d2ef3=_0x1f0ecd[_0x78b9('0xf')];var _0x1dbdf6=_0x3d2ef3[_0x78b9('0x14')](-0x1);if(_0x1dbdf6==='/'||_0x1dbdf6==='\x5c'||_0x1dbdf6===':'){_0x3d2ef3=_0x3d2ef3[_0x78b9('0x15')](0x0,_0x3d2ef3['lastIndexOf'](_0x1dbdf6));}switch(_0x1f0ecd[_0x78b9('0xd')]){case'US':_0x1cd974=_0x78b9('0x16');break;case'AU':_0x1cd974=_0x78b9('0x17');break;case'IN':_0x1cd974=_0x78b9('0x18');break;case'CN':_0x1cd974='https://accounts.zoho.com.cn';break;default:_0x1cd974=_0x78b9('0x19');break;}var _0x19aa12={'method':_0x78b9('0x1a'),'uri':_0x1cd974+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x1f0ecd[_0x78b9('0x10')],'client_secret':_0x1f0ecd['clientSecret'],'redirect_uri':_0x1f0ecd[_0x78b9('0xf')],'code':_0x1f0ecd[_0x78b9('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x19aa12)['then'](function(_0x4e44f4){var _0x27bd3f=JSON[_0x78b9('0x1b')](_0x4e44f4);if(_0x27bd3f[_0x78b9('0x1c')]){_0x1f0ecd['refreshToken']=_0x27bd3f[_0x78b9('0x1c')];logger['info'](util[_0x78b9('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1f0ecd[_0x78b9('0x1e')],_0x1f0ecd['id']));}else{logger['error'](util[_0x78b9('0x1d')](_0x78b9('0x1f'),_0x1f0ecd['name'],_0x1f0ecd['id']),util[_0x78b9('0x20')](_0x27bd3f,{'showHidden':![],'depth':null}));}return _0x38b8fc(null,_0x2f7486);})[_0x78b9('0x21')](function(_0x473449){logger[_0x78b9('0x22')](util[_0x78b9('0x1d')](_0x78b9('0x1f'),_0x1f0ecd['name'],_0x1f0ecd['id']),util[_0x78b9('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x38b8fc(_0x473449);});}else{return _0x38b8fc(null,_0x2f7486);}},'beforeUpdate':function(_0x1d2e44,_0x50ce13,_0x4bf331){if(_0x1d2e44[_0x78b9('0xe')](_0x78b9('0xd'))||_0x1d2e44[_0x78b9('0xe')](_0x78b9('0xf'))||_0x1d2e44[_0x78b9('0xe')](_0x78b9('0x10'))||_0x1d2e44[_0x78b9('0xe')](_0x78b9('0x11'))||_0x1d2e44['changed']('code')||_0x1d2e44[_0x78b9('0xe')](_0x78b9('0x13'))){var _0x3d3973,_0x34576e;_0x3d3973=_0x1d2e44[_0x78b9('0xf')];var _0x456e48=_0x3d3973['slice'](-0x1);if(_0x456e48==='/'||_0x456e48==='\x5c'||_0x456e48===':'){_0x3d3973=_0x3d3973[_0x78b9('0x15')](0x0,_0x3d3973[_0x78b9('0x23')](_0x456e48));}switch(_0x1d2e44[_0x78b9('0xd')]){case'US':_0x34576e='https://accounts.zoho.com';break;case'AU':_0x34576e=_0x78b9('0x17');break;case'IN':_0x34576e=_0x78b9('0x18');break;case'CN':_0x34576e=_0x78b9('0x24');break;default:_0x34576e=_0x78b9('0x19');break;}var _0x2f429a={'method':_0x78b9('0x1a'),'uri':_0x34576e+'/oauth/v2/token','form':{'grant_type':_0x78b9('0x25'),'client_id':_0x1d2e44[_0x78b9('0x10')],'client_secret':_0x1d2e44[_0x78b9('0x11')],'redirect_uri':_0x1d2e44['serverUrl'],'code':_0x1d2e44[_0x78b9('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2f429a)['then'](function(_0xf2c7c5){var _0x3bc1ce=JSON[_0x78b9('0x1b')](_0xf2c7c5);if(_0x3bc1ce[_0x78b9('0x1c')]){_0x1d2e44[_0x78b9('0x26')]=_0x3bc1ce[_0x78b9('0x1c')];logger[_0x78b9('0x27')](util[_0x78b9('0x1d')](_0x78b9('0x28'),_0x1d2e44[_0x78b9('0x1e')],_0x1d2e44['id']));}else{logger[_0x78b9('0x22')](util['format'](_0x78b9('0x1f'),_0x1d2e44[_0x78b9('0x1e')],_0x1d2e44['id']),util['inspect'](_0x3bc1ce,{'showHidden':![],'depth':null}));}return _0x4bf331(null,_0x50ce13);})[_0x78b9('0x21')](function(_0x45a968){logger[_0x78b9('0x22')](util[_0x78b9('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1d2e44['name'],_0x1d2e44['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4bf331(_0x45a968);});}else{return _0x4bf331(null,_0x50ce13);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 26a8e7d..fb855f4 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 _0xc1d3=['ShowZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ZohoAccount','findAll','options','where','limit','include','map','model','attributes','GetZohoAccount'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xc1d3,0x147));var _0x3c1d=function(_0xbed52b,_0x36d658){_0xbed52b=_0xbed52b-0x0;var _0x391159=_0xc1d3[_0xbed52b];return _0x391159;};'use strict';var _=require(_0x3c1d('0x0'));var util=require(_0x3c1d('0x1'));var moment=require(_0x3c1d('0x2'));var BPromise=require(_0x3c1d('0x3'));var rs=require(_0x3c1d('0x4'));var fs=require('fs');var Redis=require(_0x3c1d('0x5'));var db=require(_0x3c1d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c1d('0x7'));var config=require(_0x3c1d('0x8'));var jayson=require(_0x3c1d('0x9'));var client=jayson['client'][_0x3c1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36863b,_0x3bef1a,_0x28793c){return new BPromise(function(_0x1796a0,_0x58e08c){return client[_0x3c1d('0xb')](_0x36863b,_0x28793c)[_0x3c1d('0xc')](function(_0x33cb1b){logger[_0x3c1d('0xd')](_0x3c1d('0xe'),_0x3bef1a,_0x3c1d('0xf'));logger[_0x3c1d('0x10')](_0x3c1d('0x11'),_0x3bef1a,'request\x20sent',JSON[_0x3c1d('0x12')](_0x33cb1b));if(_0x33cb1b[_0x3c1d('0x13')]){if(_0x33cb1b[_0x3c1d('0x13')][_0x3c1d('0x14')]===0x1f4){logger[_0x3c1d('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x3bef1a,_0x33cb1b[_0x3c1d('0x13')][_0x3c1d('0x15')]);return _0x58e08c(_0x33cb1b['error'][_0x3c1d('0x15')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3bef1a,_0x33cb1b['error'][_0x3c1d('0x15')]);return _0x1796a0(_0x33cb1b[_0x3c1d('0x13')][_0x3c1d('0x15')]);}else{logger[_0x3c1d('0xd')](_0x3c1d('0xe'),_0x3bef1a,_0x3c1d('0xf'));_0x1796a0(_0x33cb1b['result']['message']);}})[_0x3c1d('0x16')](function(_0x5ab3b0){logger[_0x3c1d('0x13')](_0x3c1d('0xe'),_0x3bef1a,_0x5ab3b0);_0x58e08c(_0x5ab3b0);});});}exports['GetZohoAccount']=function(_0x4a7e42){var _0x49a81d=this;return new Promise(function(_0x33637d,_0x4620fb){return db[_0x3c1d('0x17')][_0x3c1d('0x18')]({'raw':_0x4a7e42[_0x3c1d('0x19')]?_0x4a7e42['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a7e42[_0x3c1d('0x19')]?_0x4a7e42[_0x3c1d('0x19')][_0x3c1d('0x1a')]||null:null,'attributes':_0x4a7e42[_0x3c1d('0x19')]?_0x4a7e42[_0x3c1d('0x19')]['attributes']||null:null,'limit':_0x4a7e42[_0x3c1d('0x19')]?_0x4a7e42[_0x3c1d('0x19')][_0x3c1d('0x1b')]||null:null,'include':_0x4a7e42['options']?_0x4a7e42[_0x3c1d('0x19')][_0x3c1d('0x1c')]?_[_0x3c1d('0x1d')](_0x4a7e42[_0x3c1d('0x19')][_0x3c1d('0x1c')],function(_0x1a853d){return{'model':db[_0x1a853d[_0x3c1d('0x1e')]],'as':_0x1a853d['as'],'attributes':_0x1a853d[_0x3c1d('0x1f')],'include':_0x1a853d[_0x3c1d('0x1c')]?_['map'](_0x1a853d[_0x3c1d('0x1c')],function(_0x2a8854){return{'model':db[_0x2a8854[_0x3c1d('0x1e')]],'as':_0x2a8854['as'],'attributes':_0x2a8854['attributes'],'include':_0x2a8854[_0x3c1d('0x1c')]?_[_0x3c1d('0x1d')](_0x2a8854['include'],function(_0x392bb1){return{'model':db[_0x392bb1[_0x3c1d('0x1e')]],'as':_0x392bb1['as'],'attributes':_0x392bb1[_0x3c1d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23e5a0){logger['info'](_0x3c1d('0x20'),_0x4a7e42);logger[_0x3c1d('0x10')]('GetZohoAccount',_0x4a7e42,JSON['stringify'](_0x23e5a0));_0x33637d(_0x23e5a0);})[_0x3c1d('0x16')](function(_0x2f7af9){logger[_0x3c1d('0x13')]('GetZohoAccount',_0x2f7af9[_0x3c1d('0x15')],_0x4a7e42);_0x4620fb(_0x49a81d['error'](0x1f4,_0x2f7af9[_0x3c1d('0x15')]));});});};exports[_0x3c1d('0x21')]=function(_0x1296ed){var _0x4f0d9e=this;return new Promise(function(_0x147523,_0x3fa262){return db[_0x3c1d('0x17')][_0x3c1d('0x22')]({'raw':_0x1296ed[_0x3c1d('0x19')]?_0x1296ed[_0x3c1d('0x19')][_0x3c1d('0x23')]===undefined?!![]:![]:!![],'where':_0x1296ed[_0x3c1d('0x19')]?_0x1296ed[_0x3c1d('0x19')]['where']||null:null,'attributes':_0x1296ed['options']?_0x1296ed[_0x3c1d('0x19')]['attributes']||null:null,'include':_0x1296ed[_0x3c1d('0x19')]?_0x1296ed[_0x3c1d('0x19')][_0x3c1d('0x1c')]?_[_0x3c1d('0x1d')](_0x1296ed[_0x3c1d('0x19')]['include'],function(_0x1bc180){return{'model':db[_0x1bc180[_0x3c1d('0x1e')]],'as':_0x1bc180['as'],'attributes':_0x1bc180['attributes'],'include':_0x1bc180['include']?_[_0x3c1d('0x1d')](_0x1bc180[_0x3c1d('0x1c')],function(_0x38673f){return{'model':db[_0x38673f[_0x3c1d('0x1e')]],'as':_0x38673f['as'],'attributes':_0x38673f[_0x3c1d('0x1f')],'include':_0x38673f['include']?_[_0x3c1d('0x1d')](_0x38673f[_0x3c1d('0x1c')],function(_0x4bda17){return{'model':db[_0x4bda17['model']],'as':_0x4bda17['as'],'attributes':_0x4bda17['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c1d('0xc')](function(_0xe04d95){logger[_0x3c1d('0xd')](_0x3c1d('0x21'),_0x1296ed);logger['debug'](_0x3c1d('0x21'),_0x1296ed,JSON['stringify'](_0xe04d95));_0x147523(_0xe04d95);})[_0x3c1d('0x16')](function(_0x3c9d5d){logger[_0x3c1d('0x13')](_0x3c1d('0x21'),_0x3c9d5d[_0x3c1d('0x15')],_0x1296ed);_0x3fa262(_0x4f0d9e['error'](0x1f4,_0x3c9d5d[_0x3c1d('0x15')]));});});}; \ No newline at end of file +var _0x01d9=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZohoAccount','find','where','stringify','lodash','util','moment'];(function(_0xfcdd74,_0x3c721f){var _0x4af489=function(_0x2612bb){while(--_0x2612bb){_0xfcdd74['push'](_0xfcdd74['shift']());}};_0x4af489(++_0x3c721f);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});}exports[_0x901d('0x17')]=function(_0x285353){var _0x403db9=this;return new Promise(function(_0x38f42b,_0x414171){return db[_0x901d('0x18')][_0x901d('0x19')]({'raw':_0x285353['options']?_0x285353[_0x901d('0x1a')][_0x901d('0x1b')]===undefined?!![]:![]:!![],'where':_0x285353['options']?_0x285353['options']['where']||null:null,'attributes':_0x285353['options']?_0x285353[_0x901d('0x1a')][_0x901d('0x1c')]||null:null,'limit':_0x285353['options']?_0x285353[_0x901d('0x1a')][_0x901d('0x1d')]||null:null,'include':_0x285353['options']?_0x285353[_0x901d('0x1a')][_0x901d('0x1e')]?_[_0x901d('0x1f')](_0x285353[_0x901d('0x1a')][_0x901d('0x1e')],function(_0x1818d3){return{'model':db[_0x1818d3[_0x901d('0x20')]],'as':_0x1818d3['as'],'attributes':_0x1818d3[_0x901d('0x1c')],'include':_0x1818d3['include']?_[_0x901d('0x1f')](_0x1818d3[_0x901d('0x1e')],function(_0xbc89a5){return{'model':db[_0xbc89a5[_0x901d('0x20')]],'as':_0xbc89a5['as'],'attributes':_0xbc89a5['attributes'],'include':_0xbc89a5[_0x901d('0x1e')]?_[_0x901d('0x1f')](_0xbc89a5[_0x901d('0x1e')],function(_0x3cbe43){return{'model':db[_0x3cbe43[_0x901d('0x20')]],'as':_0x3cbe43['as'],'attributes':_0x3cbe43['attributes']};}):[]};}):[]};}):[]:[]})[_0x901d('0xd')](function(_0xc52d0f){logger[_0x901d('0xe')](_0x901d('0x17'),_0x285353);logger[_0x901d('0x11')](_0x901d('0x17'),_0x285353,JSON['stringify'](_0xc52d0f));_0x38f42b(_0xc52d0f);})[_0x901d('0x16')](function(_0x533038){logger[_0x901d('0x12')](_0x901d('0x17'),_0x533038[_0x901d('0x14')],_0x285353);_0x414171(_0x403db9[_0x901d('0x12')](0x1f4,_0x533038[_0x901d('0x14')]));});});};exports[_0x901d('0x21')]=function(_0x4137b7){var _0x115676=this;return new Promise(function(_0x530c4b,_0x336f28){return db[_0x901d('0x18')][_0x901d('0x22')]({'raw':_0x4137b7[_0x901d('0x1a')]?_0x4137b7[_0x901d('0x1a')][_0x901d('0x1b')]===undefined?!![]:![]:!![],'where':_0x4137b7['options']?_0x4137b7[_0x901d('0x1a')][_0x901d('0x23')]||null:null,'attributes':_0x4137b7[_0x901d('0x1a')]?_0x4137b7['options'][_0x901d('0x1c')]||null:null,'include':_0x4137b7[_0x901d('0x1a')]?_0x4137b7[_0x901d('0x1a')][_0x901d('0x1e')]?_[_0x901d('0x1f')](_0x4137b7[_0x901d('0x1a')][_0x901d('0x1e')],function(_0x1b8d3){return{'model':db[_0x1b8d3[_0x901d('0x20')]],'as':_0x1b8d3['as'],'attributes':_0x1b8d3[_0x901d('0x1c')],'include':_0x1b8d3['include']?_['map'](_0x1b8d3[_0x901d('0x1e')],function(_0x4e66b4){return{'model':db[_0x4e66b4[_0x901d('0x20')]],'as':_0x4e66b4['as'],'attributes':_0x4e66b4[_0x901d('0x1c')],'include':_0x4e66b4['include']?_[_0x901d('0x1f')](_0x4e66b4[_0x901d('0x1e')],function(_0x2f5e22){return{'model':db[_0x2f5e22['model']],'as':_0x2f5e22['as'],'attributes':_0x2f5e22[_0x901d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x901d('0xd')](function(_0x1a1f9c){logger[_0x901d('0xe')](_0x901d('0x21'),_0x4137b7);logger[_0x901d('0x11')](_0x901d('0x21'),_0x4137b7,JSON[_0x901d('0x24')](_0x1a1f9c));_0x530c4b(_0x1a1f9c);})[_0x901d('0x16')](function(_0x384d82){logger[_0x901d('0x12')](_0x901d('0x21'),_0x384d82[_0x901d('0x14')],_0x4137b7);_0x336f28(_0x115676[_0x901d('0x12')](0x1f4,_0x384d82[_0x901d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9d68502..3bb639c 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 _0xb88e=['/:id/descriptions','getDescriptions','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb88e,0x79));var _0xeb88=function(_0x56cc40,_0x19bcd){_0x56cc40=_0x56cc40-0x0;var _0x1899b6=_0xb88e[_0x56cc40];return _0x1899b6;};'use strict';var multer=require(_0xeb88('0x0'));var util=require(_0xeb88('0x1'));var path=require(_0xeb88('0x2'));var timeout=require(_0xeb88('0x3'));var express=require(_0xeb88('0x4'));var router=express[_0xeb88('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeb88('0x6'));var interaction=require(_0xeb88('0x7'));var config=require('../../config/environment');var controller=require(_0xeb88('0x8'));router[_0xeb88('0x9')]('/',auth[_0xeb88('0xa')](),controller[_0xeb88('0xb')]);router['get'](_0xeb88('0xc'),auth['isAuthenticated'](),controller[_0xeb88('0xd')]);router['get'](_0xeb88('0xe'),auth[_0xeb88('0xa')](),controller['getFields']);router[_0xeb88('0x9')](_0xeb88('0xf'),auth[_0xeb88('0xa')](),controller[_0xeb88('0x10')]);router[_0xeb88('0x9')](_0xeb88('0x11'),auth['isAuthenticated'](),controller[_0xeb88('0x12')]);router['post']('/',auth[_0xeb88('0xa')](),controller[_0xeb88('0x13')]);router['put'](_0xeb88('0xc'),auth[_0xeb88('0xa')](),controller[_0xeb88('0x14')]);router['delete']('/:id',auth[_0xeb88('0xa')](),controller[_0xeb88('0x15')]);module[_0xeb88('0x16')]=router; \ No newline at end of file +var _0x1f3f=['put','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','index','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create'];(function(_0x5bf593,_0x4b8f39){var _0x4bef25=function(_0x95769){while(--_0x95769){_0x5bf593['push'](_0x5bf593['shift']());}};_0x4bef25(++_0x4b8f39);}(_0x1f3f,0x145));var _0xf1f3=function(_0x5a6e32,_0x573b46){_0x5a6e32=_0x5a6e32-0x0;var _0x168e07=_0x1f3f[_0x5a6e32];return _0x168e07;};'use strict';var multer=require(_0xf1f3('0x0'));var util=require(_0xf1f3('0x1'));var path=require(_0xf1f3('0x2'));var timeout=require(_0xf1f3('0x3'));var express=require('express');var router=express[_0xf1f3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf1f3('0x5'));var interaction=require(_0xf1f3('0x6'));var config=require(_0xf1f3('0x7'));var controller=require(_0xf1f3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf1f3('0x9')]);router[_0xf1f3('0xa')](_0xf1f3('0xb'),auth[_0xf1f3('0xc')](),controller['show']);router[_0xf1f3('0xa')](_0xf1f3('0xd'),auth['isAuthenticated'](),controller[_0xf1f3('0xe')]);router[_0xf1f3('0xa')](_0xf1f3('0xf'),auth[_0xf1f3('0xc')](),controller[_0xf1f3('0x10')]);router[_0xf1f3('0xa')](_0xf1f3('0x11'),auth['isAuthenticated'](),controller[_0xf1f3('0x12')]);router['post']('/',auth[_0xf1f3('0xc')](),controller[_0xf1f3('0x13')]);router[_0xf1f3('0x14')](_0xf1f3('0xb'),auth[_0xf1f3('0xc')](),controller[_0xf1f3('0x15')]);router[_0xf1f3('0x16')]('/:id',auth[_0xf1f3('0xc')](),controller['destroy']);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 5aee497..19b2908 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 _0x9917=['STRING','ENUM','lead','contact','contact_lead','sequelize'];(function(_0x16bc92,_0x1b0935){var _0x27a2d2=function(_0x334beb){while(--_0x334beb){_0x16bc92['push'](_0x16bc92['shift']());}};_0x27a2d2(++_0x1b0935);}(_0x9917,0x8f));var _0x7991=function(_0x5a4714,_0x3512d8){_0x5a4714=_0x5a4714-0x0;var _0x2671b9=_0x9917[_0x5a4714];return _0x2671b9;};'use strict';var Sequelize=require(_0x7991('0x0'));module['exports']={'name':{'type':Sequelize[_0x7991('0x1')]},'moduleCreate':{'type':Sequelize[_0x7991('0x2')](_0x7991('0x3'),_0x7991('0x4'),'nothing'),'defaultValue':_0x7991('0x3')},'moduleSearch':{'type':Sequelize[_0x7991('0x2')](_0x7991('0x5'),_0x7991('0x4'),_0x7991('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8347=['contact_lead','sequelize','exports','ENUM','lead','contact'];(function(_0x9e069c,_0x43f38c){var _0x448ce7=function(_0x258a6a){while(--_0x258a6a){_0x9e069c['push'](_0x9e069c['shift']());}};_0x448ce7(++_0x43f38c);}(_0x8347,0xa9));var _0x7834=function(_0x138aa9,_0x44d435){_0x138aa9=_0x138aa9-0x0;var _0x3c50dd=_0x8347[_0x138aa9];return _0x3c50dd;};'use strict';var Sequelize=require(_0x7834('0x0'));module[_0x7834('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x7834('0x2')](_0x7834('0x3'),_0x7834('0x4'),'nothing'),'defaultValue':_0x7834('0x3')},'moduleSearch':{'type':Sequelize[_0x7834('0x2')](_0x7834('0x5'),_0x7834('0x4'),_0x7834('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 1b46f5d..23b1cdf 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 _0xd700=['offset','undefined','limit','count','set','Content-Range','apply','save','then','stack','name','send','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','catch','create','body','update','destroy','find','getFields','findOne','ZohoField','pick','nolimit','getSubjects','order','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x64390a,_0x1ce939){var _0x2225b8=function(_0xdd5eb3){while(--_0xdd5eb3){_0x64390a['push'](_0x64390a['shift']());}};_0x2225b8(++_0x1ce939);}(_0xd700,0x163));var _0x0d70=function(_0x119ec0,_0x206327){_0x119ec0=_0x119ec0-0x0;var _0x56f82b=_0xd700[_0x119ec0];return _0x56f82b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d70('0x0'));var zipdir=require(_0x0d70('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d70('0x2'));var moment=require(_0x0d70('0x3'));var BPromise=require(_0x0d70('0x4'));var Mustache=require(_0x0d70('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0d70('0x6'));var csv=require(_0x0d70('0x7'));var ejs=require(_0x0d70('0x8'));var fs=require('fs');var fs_extra=require(_0x0d70('0x9'));var _=require(_0x0d70('0xa'));var squel=require(_0x0d70('0xb'));var crypto=require('crypto');var jsforce=require(_0x0d70('0xc'));var deskjs=require(_0x0d70('0xd'));var toCsv=require(_0x0d70('0x7'));var querystring=require(_0x0d70('0xe'));var Papa=require('papaparse');var Redis=require(_0x0d70('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d70('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x0d70('0x11'));var config=require(_0x0d70('0x12'));var licenseUtil=require(_0x0d70('0x13'));var db=require(_0x0d70('0x14'))['db'];function respondWithStatusCode(_0x36dc82,_0x4b78ab){_0x4b78ab=_0x4b78ab||0xcc;return function(_0x3625fc){if(_0x3625fc){return _0x36dc82[_0x0d70('0x15')](_0x4b78ab);}return _0x36dc82[_0x0d70('0x16')](_0x4b78ab)[_0x0d70('0x17')]();};}function respondWithResult(_0x21f973,_0x459b91){_0x459b91=_0x459b91||0xc8;return function(_0x4e0a18){if(_0x4e0a18){return _0x21f973['status'](_0x459b91)[_0x0d70('0x18')](_0x4e0a18);}};}function respondWithFilteredResult(_0x1e2cb9,_0x5bec35){return function(_0xa6c495){if(_0xa6c495){var _0x9d977e=typeof _0x5bec35[_0x0d70('0x19')]===_0x0d70('0x1a')&&typeof _0x5bec35[_0x0d70('0x1b')]===_0x0d70('0x1a');var _0x4c0d86=_0xa6c495[_0x0d70('0x1c')];var _0x487cfa=_0x9d977e?0x0:_0x5bec35[_0x0d70('0x19')];var _0x1d17b2=_0x9d977e?_0xa6c495['count']:_0x5bec35[_0x0d70('0x19')]+_0x5bec35[_0x0d70('0x1b')];var _0x37f7c7;if(_0x1d17b2>=_0x4c0d86){_0x1d17b2=_0x4c0d86;_0x37f7c7=0xc8;}else{_0x37f7c7=0xce;}_0x1e2cb9['status'](_0x37f7c7);return _0x1e2cb9[_0x0d70('0x1d')](_0x0d70('0x1e'),_0x487cfa+'-'+_0x1d17b2+'/'+_0x4c0d86)[_0x0d70('0x18')](_0xa6c495);}return null;};}function patchUpdates(_0x1643fc){return function(_0x563942){try{jsonpatch[_0x0d70('0x1f')](_0x563942,_0x1643fc,!![]);}catch(_0x4cee2c){return BPromise['reject'](_0x4cee2c);}return _0x563942[_0x0d70('0x20')]();};}function saveUpdates(_0x155d82,_0x4bde7d){return function(_0x2eae55){if(_0x2eae55){return _0x2eae55['update'](_0x155d82)[_0x0d70('0x21')](function(_0x94427d){return _0x94427d;});}return null;};}function removeEntity(_0x322a54,_0x340cda){return function(_0x485121){if(_0x485121){return _0x485121['destroy']()[_0x0d70('0x21')](function(){_0x322a54[_0x0d70('0x16')](0xcc)[_0x0d70('0x17')]();});}};}function handleEntityNotFound(_0x30318b,_0x4b3f8f){return function(_0x41fc4b){if(!_0x41fc4b){_0x30318b[_0x0d70('0x15')](0x194);}return _0x41fc4b;};}function handleError(_0x5d9f18,_0x5cec03){_0x5cec03=_0x5cec03||0x1f4;return function(_0x1e014d){logger['error'](_0x1e014d[_0x0d70('0x22')]);if(_0x1e014d['name']){delete _0x1e014d[_0x0d70('0x23')];}_0x5d9f18[_0x0d70('0x16')](_0x5cec03)[_0x0d70('0x24')](_0x1e014d);};}exports['index']=function(_0x27f56a,_0x4d1eb0){var _0x248e32={},_0xbb98d7={},_0x44382f={'count':0x0,'rows':[]};var _0x21b7b7=_['map'](db[_0x0d70('0x25')][_0x0d70('0x26')],function(_0x26eb27){return{'name':_0x26eb27[_0x0d70('0x27')],'type':_0x26eb27[_0x0d70('0x28')][_0x0d70('0x29')]};});_0xbb98d7[_0x0d70('0x2a')]=_[_0x0d70('0x2b')](_0x21b7b7,_0x0d70('0x23'));_0xbb98d7['query']=_[_0x0d70('0x2c')](_0x27f56a[_0x0d70('0x2d')]);_0xbb98d7[_0x0d70('0x2e')]=_[_0x0d70('0x2f')](_0xbb98d7[_0x0d70('0x2a')],_0xbb98d7[_0x0d70('0x2d')]);_0x248e32[_0x0d70('0x30')]=_[_0x0d70('0x2f')](_0xbb98d7[_0x0d70('0x2a')],qs[_0x0d70('0x31')](_0x27f56a['query'][_0x0d70('0x31')]));_0x248e32[_0x0d70('0x30')]=_0x248e32[_0x0d70('0x30')][_0x0d70('0x32')]?_0x248e32[_0x0d70('0x30')]:_0xbb98d7[_0x0d70('0x2a')];if(!_0x27f56a['query'][_0x0d70('0x33')]('nolimit')){_0x248e32[_0x0d70('0x1b')]=qs['limit'](_0x27f56a[_0x0d70('0x2d')][_0x0d70('0x1b')]);_0x248e32[_0x0d70('0x19')]=qs[_0x0d70('0x19')](_0x27f56a[_0x0d70('0x2d')][_0x0d70('0x19')]);}_0x248e32['order']=qs[_0x0d70('0x34')](_0x27f56a[_0x0d70('0x2d')][_0x0d70('0x34')]);_0x248e32[_0x0d70('0x35')]=qs[_0x0d70('0x2e')](_['pick'](_0x27f56a[_0x0d70('0x2d')],_0xbb98d7[_0x0d70('0x2e')]),_0x21b7b7);if(_0x27f56a[_0x0d70('0x2d')][_0x0d70('0x36')]){_0x248e32[_0x0d70('0x35')]=_[_0x0d70('0x37')](_0x248e32['where'],{'$or':_[_0x0d70('0x2b')](_0x21b7b7,function(_0x2a2817){if(_0x2a2817[_0x0d70('0x28')]!==_0x0d70('0x38')){var _0x109a57={};_0x109a57[_0x2a2817['name']]={'$like':'%'+_0x27f56a['query']['filter']+'%'};return _0x109a57;}})});}_0x248e32=_[_0x0d70('0x37')]({},_0x248e32,_0x27f56a[_0x0d70('0x39')]);var _0x54eb02={'where':_0x248e32['where']};return db[_0x0d70('0x25')]['count'](_0x54eb02)[_0x0d70('0x21')](function(_0x144be0){_0x44382f[_0x0d70('0x1c')]=_0x144be0;if(_0x27f56a[_0x0d70('0x2d')][_0x0d70('0x3a')]){_0x248e32['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x0d70('0x3b')](_0x248e32);})[_0x0d70('0x21')](function(_0x5c6301){_0x44382f['rows']=_0x5c6301;return _0x44382f;})[_0x0d70('0x21')](respondWithFilteredResult(_0x4d1eb0,_0x248e32))['catch'](handleError(_0x4d1eb0,null));};exports[_0x0d70('0x3c')]=function(_0xcc426b,_0x3f4114){var _0x29acd5={'raw':![],'where':{'id':_0xcc426b[_0x0d70('0x3d')]['id']}},_0x1a9189={};_0x1a9189[_0x0d70('0x2a')]=_[_0x0d70('0x2c')](db[_0x0d70('0x25')][_0x0d70('0x26')]);_0x1a9189['query']=_['keys'](_0xcc426b[_0x0d70('0x2d')]);_0x1a9189[_0x0d70('0x2e')]=_['intersection'](_0x1a9189[_0x0d70('0x2a')],_0x1a9189['query']);_0x29acd5[_0x0d70('0x30')]=_[_0x0d70('0x2f')](_0x1a9189[_0x0d70('0x2a')],qs[_0x0d70('0x31')](_0xcc426b[_0x0d70('0x2d')]['fields']));_0x29acd5[_0x0d70('0x30')]=_0x29acd5[_0x0d70('0x30')][_0x0d70('0x32')]?_0x29acd5[_0x0d70('0x30')]:_0x1a9189[_0x0d70('0x2a')];if(_0xcc426b[_0x0d70('0x2d')][_0x0d70('0x3a')]){_0x29acd5['include']=[{'all':!![]}];}_0x29acd5=_[_0x0d70('0x37')]({},_0x29acd5,_0xcc426b[_0x0d70('0x39')]);return db[_0x0d70('0x25')]['find'](_0x29acd5)[_0x0d70('0x21')](handleEntityNotFound(_0x3f4114,null))['then'](respondWithResult(_0x3f4114,null))[_0x0d70('0x3e')](handleError(_0x3f4114,null));};exports[_0x0d70('0x3f')]=function(_0x206e24,_0x3c1b12){return db['ZohoConfiguration'][_0x0d70('0x3f')](_0x206e24[_0x0d70('0x40')],{})[_0x0d70('0x21')](respondWithResult(_0x3c1b12,0xc9))['catch'](handleError(_0x3c1b12,null));};exports[_0x0d70('0x41')]=function(_0x10ec66,_0x2578aa){if(_0x10ec66[_0x0d70('0x40')]['id']){delete _0x10ec66[_0x0d70('0x40')]['id'];}return db[_0x0d70('0x25')]['find']({'where':{'id':_0x10ec66[_0x0d70('0x3d')]['id']}})[_0x0d70('0x21')](handleEntityNotFound(_0x2578aa,null))[_0x0d70('0x21')](saveUpdates(_0x10ec66[_0x0d70('0x40')],null))[_0x0d70('0x21')](respondWithResult(_0x2578aa,null))[_0x0d70('0x3e')](handleError(_0x2578aa,null));};exports[_0x0d70('0x42')]=function(_0x48665a,_0x4df08b){return db['ZohoConfiguration'][_0x0d70('0x43')]({'where':{'id':_0x48665a[_0x0d70('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4df08b,null))[_0x0d70('0x21')](removeEntity(_0x4df08b,null))[_0x0d70('0x3e')](handleError(_0x4df08b,null));};exports[_0x0d70('0x44')]=function(_0x5f36b9,_0x3b7e27,_0x983280){var _0x20dd0d={};var _0x3b13a1={};var _0x3b62e9;var _0x362ac0;return db['ZohoConfiguration'][_0x0d70('0x45')]({'where':{'id':_0x5f36b9[_0x0d70('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3b7e27,null))[_0x0d70('0x21')](function(_0x5be321){if(_0x5be321){_0x3b62e9=_0x5be321;_0x3b13a1['model']=_[_0x0d70('0x2c')](db[_0x0d70('0x46')][_0x0d70('0x26')]);_0x3b13a1[_0x0d70('0x2d')]=_['keys'](_0x5f36b9[_0x0d70('0x2d')]);_0x3b13a1[_0x0d70('0x2e')]=_[_0x0d70('0x2f')](_0x3b13a1[_0x0d70('0x2a')],_0x3b13a1[_0x0d70('0x2d')]);_0x20dd0d[_0x0d70('0x30')]=_[_0x0d70('0x2f')](_0x3b13a1['model'],qs[_0x0d70('0x31')](_0x5f36b9[_0x0d70('0x2d')][_0x0d70('0x31')]));_0x20dd0d[_0x0d70('0x30')]=_0x20dd0d[_0x0d70('0x30')][_0x0d70('0x32')]?_0x20dd0d['attributes']:_0x3b13a1[_0x0d70('0x2a')];_0x20dd0d['order']=qs[_0x0d70('0x34')](_0x5f36b9[_0x0d70('0x2d')][_0x0d70('0x34')]);_0x20dd0d[_0x0d70('0x35')]=qs['filters'](_[_0x0d70('0x47')](_0x5f36b9[_0x0d70('0x2d')],_0x3b13a1['filters']));if(_0x5f36b9['query']['filter']){_0x20dd0d[_0x0d70('0x35')]=_[_0x0d70('0x37')](_0x20dd0d[_0x0d70('0x35')],{'$or':_[_0x0d70('0x2b')](_0x20dd0d[_0x0d70('0x30')],function(_0x5eb7a2){var _0x1658f9={};_0x1658f9[_0x5eb7a2]={'$like':'%'+_0x5f36b9[_0x0d70('0x2d')][_0x0d70('0x36')]+'%'};return _0x1658f9;})});}_0x20dd0d=_['merge']({},_0x20dd0d,_0x5f36b9[_0x0d70('0x39')]);return _0x3b62e9[_0x0d70('0x44')](_0x20dd0d);}})[_0x0d70('0x21')](function(_0x5a2f08){if(_0x5a2f08){_0x362ac0=_0x5a2f08[_0x0d70('0x32')];if(!_0x5f36b9[_0x0d70('0x2d')][_0x0d70('0x33')](_0x0d70('0x48'))){_0x20dd0d['limit']=qs['limit'](_0x5f36b9['query'][_0x0d70('0x1b')]);_0x20dd0d['offset']=qs['offset'](_0x5f36b9['query'][_0x0d70('0x19')]);}return _0x3b62e9['getFields'](_0x20dd0d);}})[_0x0d70('0x21')](function(_0x3080e5){if(_0x3080e5){return _0x3080e5?{'count':_0x362ac0,'rows':_0x3080e5}:null;}})[_0x0d70('0x21')](respondWithResult(_0x3b7e27,null))['catch'](handleError(_0x3b7e27,null));};exports[_0x0d70('0x49')]=function(_0x56027c,_0x2c75d,_0x383873){var _0x168658={};var _0x355fc5={};var _0x4339e6;var _0x36c097;return db[_0x0d70('0x25')][_0x0d70('0x45')]({'where':{'id':_0x56027c[_0x0d70('0x3d')]['id']}})[_0x0d70('0x21')](handleEntityNotFound(_0x2c75d,null))['then'](function(_0x501135){if(_0x501135){_0x4339e6=_0x501135;_0x355fc5[_0x0d70('0x2a')]=_[_0x0d70('0x2c')](db[_0x0d70('0x46')]['rawAttributes']);_0x355fc5[_0x0d70('0x2d')]=_[_0x0d70('0x2c')](_0x56027c[_0x0d70('0x2d')]);_0x355fc5[_0x0d70('0x2e')]=_[_0x0d70('0x2f')](_0x355fc5['model'],_0x355fc5[_0x0d70('0x2d')]);_0x168658['attributes']=_[_0x0d70('0x2f')](_0x355fc5[_0x0d70('0x2a')],qs[_0x0d70('0x31')](_0x56027c[_0x0d70('0x2d')][_0x0d70('0x31')]));_0x168658[_0x0d70('0x30')]=_0x168658[_0x0d70('0x30')][_0x0d70('0x32')]?_0x168658['attributes']:_0x355fc5['model'];_0x168658[_0x0d70('0x4a')]=qs[_0x0d70('0x34')](_0x56027c[_0x0d70('0x2d')][_0x0d70('0x34')]);_0x168658[_0x0d70('0x35')]=qs['filters'](_['pick'](_0x56027c['query'],_0x355fc5[_0x0d70('0x2e')]));if(_0x56027c[_0x0d70('0x2d')][_0x0d70('0x36')]){_0x168658[_0x0d70('0x35')]=_['merge'](_0x168658[_0x0d70('0x35')],{'$or':_[_0x0d70('0x2b')](_0x168658['attributes'],function(_0x7d8aeb){var _0x2290a1={};_0x2290a1[_0x7d8aeb]={'$like':'%'+_0x56027c[_0x0d70('0x2d')][_0x0d70('0x36')]+'%'};return _0x2290a1;})});}_0x168658=_[_0x0d70('0x37')]({},_0x168658,_0x56027c[_0x0d70('0x39')]);return _0x4339e6[_0x0d70('0x49')](_0x168658);}})['then'](function(_0x5ed51c){if(_0x5ed51c){_0x36c097=_0x5ed51c[_0x0d70('0x32')];if(!_0x56027c[_0x0d70('0x2d')]['hasOwnProperty'](_0x0d70('0x48'))){_0x168658['limit']=qs['limit'](_0x56027c['query'][_0x0d70('0x1b')]);_0x168658['offset']=qs[_0x0d70('0x19')](_0x56027c['query'][_0x0d70('0x19')]);}return _0x4339e6[_0x0d70('0x49')](_0x168658);}})[_0x0d70('0x21')](function(_0x44de3e){if(_0x44de3e){return _0x44de3e?{'count':_0x36c097,'rows':_0x44de3e}:null;}})[_0x0d70('0x21')](respondWithResult(_0x2c75d,null))['catch'](handleError(_0x2c75d,null));};exports['getDescriptions']=function(_0x5bd0c8,_0x729537,_0x3b05b8){var _0x387d18={};var _0x4bbde0={};var _0x5257c6;var _0x4b1899;return db[_0x0d70('0x25')][_0x0d70('0x45')]({'where':{'id':_0x5bd0c8[_0x0d70('0x3d')]['id']}})[_0x0d70('0x21')](handleEntityNotFound(_0x729537,null))['then'](function(_0x1e90a9){if(_0x1e90a9){_0x5257c6=_0x1e90a9;_0x4bbde0[_0x0d70('0x2a')]=_[_0x0d70('0x2c')](db[_0x0d70('0x46')][_0x0d70('0x26')]);_0x4bbde0[_0x0d70('0x2d')]=_['keys'](_0x5bd0c8[_0x0d70('0x2d')]);_0x4bbde0[_0x0d70('0x2e')]=_[_0x0d70('0x2f')](_0x4bbde0[_0x0d70('0x2a')],_0x4bbde0[_0x0d70('0x2d')]);_0x387d18['attributes']=_[_0x0d70('0x2f')](_0x4bbde0[_0x0d70('0x2a')],qs[_0x0d70('0x31')](_0x5bd0c8[_0x0d70('0x2d')][_0x0d70('0x31')]));_0x387d18[_0x0d70('0x30')]=_0x387d18[_0x0d70('0x30')][_0x0d70('0x32')]?_0x387d18[_0x0d70('0x30')]:_0x4bbde0[_0x0d70('0x2a')];_0x387d18[_0x0d70('0x4a')]=qs[_0x0d70('0x34')](_0x5bd0c8[_0x0d70('0x2d')]['sort']);_0x387d18[_0x0d70('0x35')]=qs[_0x0d70('0x2e')](_[_0x0d70('0x47')](_0x5bd0c8[_0x0d70('0x2d')],_0x4bbde0[_0x0d70('0x2e')]));if(_0x5bd0c8[_0x0d70('0x2d')][_0x0d70('0x36')]){_0x387d18[_0x0d70('0x35')]=_[_0x0d70('0x37')](_0x387d18[_0x0d70('0x35')],{'$or':_[_0x0d70('0x2b')](_0x387d18[_0x0d70('0x30')],function(_0x218bb3){var _0x4f7165={};_0x4f7165[_0x218bb3]={'$like':'%'+_0x5bd0c8[_0x0d70('0x2d')][_0x0d70('0x36')]+'%'};return _0x4f7165;})});}_0x387d18=_[_0x0d70('0x37')]({},_0x387d18,_0x5bd0c8['options']);return _0x5257c6[_0x0d70('0x4b')](_0x387d18);}})['then'](function(_0x7648d5){if(_0x7648d5){_0x4b1899=_0x7648d5[_0x0d70('0x32')];if(!_0x5bd0c8['query'][_0x0d70('0x33')]('nolimit')){_0x387d18[_0x0d70('0x1b')]=qs[_0x0d70('0x1b')](_0x5bd0c8['query'][_0x0d70('0x1b')]);_0x387d18[_0x0d70('0x19')]=qs[_0x0d70('0x19')](_0x5bd0c8[_0x0d70('0x2d')][_0x0d70('0x19')]);}return _0x5257c6[_0x0d70('0x4b')](_0x387d18);}})['then'](function(_0x6696a0){if(_0x6696a0){return _0x6696a0?{'count':_0x4b1899,'rows':_0x6696a0}:null;}})[_0x0d70('0x21')](respondWithResult(_0x729537,null))[_0x0d70('0x3e')](handleError(_0x729537,null));}; \ No newline at end of file +var _0x343a=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ZohoConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','getFields','findOne','nolimit','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x447550,_0x477c3b){var _0x50ce12=function(_0x1941da){while(--_0x1941da){_0x447550['push'](_0x447550['shift']());}};_0x50ce12(++_0x477c3b);}(_0x343a,0x87));var _0xa343=function(_0x2585ef,_0x3b2545){_0x2585ef=_0x2585ef-0x0;var _0x5db7e4=_0x343a[_0x2585ef];return _0x5db7e4;};'use strict';var emlformat=require(_0xa343('0x0'));var rimraf=require(_0xa343('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa343('0x2'));var rp=require('request-promise');var moment=require(_0xa343('0x3'));var BPromise=require(_0xa343('0x4'));var Mustache=require(_0xa343('0x5'));var util=require(_0xa343('0x6'));var path=require(_0xa343('0x7'));var sox=require(_0xa343('0x8'));var csv=require(_0xa343('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa343('0xa'));var crypto=require(_0xa343('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa343('0xc'));var toCsv=require(_0xa343('0x9'));var querystring=require(_0xa343('0xd'));var Papa=require(_0xa343('0xe'));var Redis=require(_0xa343('0xf'));var authService=require(_0xa343('0x10'));var qs=require(_0xa343('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa343('0x12'));var logger=require('../../config/logger')(_0xa343('0x13'));var utils=require(_0xa343('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa343('0x15'));var db=require(_0xa343('0x16'))['db'];function respondWithStatusCode(_0x200855,_0x1779fb){_0x1779fb=_0x1779fb||0xcc;return function(_0x323422){if(_0x323422){return _0x200855[_0xa343('0x17')](_0x1779fb);}return _0x200855[_0xa343('0x18')](_0x1779fb)[_0xa343('0x19')]();};}function respondWithResult(_0x229666,_0x320573){_0x320573=_0x320573||0xc8;return function(_0x2e1d0b){if(_0x2e1d0b){return _0x229666['status'](_0x320573)['json'](_0x2e1d0b);}};}function respondWithFilteredResult(_0x5f5b47,_0x2d1239){return function(_0x30c6c0){if(_0x30c6c0){var _0x413141=typeof _0x2d1239[_0xa343('0x1a')]===_0xa343('0x1b')&&typeof _0x2d1239[_0xa343('0x1c')]===_0xa343('0x1b');var _0x376541=_0x30c6c0[_0xa343('0x1d')];var _0x5ca186=_0x413141?0x0:_0x2d1239[_0xa343('0x1a')];var _0x47c86e=_0x413141?_0x30c6c0[_0xa343('0x1d')]:_0x2d1239[_0xa343('0x1a')]+_0x2d1239[_0xa343('0x1c')];var _0x2585c6;if(_0x47c86e>=_0x376541){_0x47c86e=_0x376541;_0x2585c6=0xc8;}else{_0x2585c6=0xce;}_0x5f5b47[_0xa343('0x18')](_0x2585c6);return _0x5f5b47[_0xa343('0x1e')](_0xa343('0x1f'),_0x5ca186+'-'+_0x47c86e+'/'+_0x376541)['json'](_0x30c6c0);}return null;};}function patchUpdates(_0x4fa306){return function(_0x2a5d6a){try{jsonpatch[_0xa343('0x20')](_0x2a5d6a,_0x4fa306,!![]);}catch(_0xd9a27){return BPromise['reject'](_0xd9a27);}return _0x2a5d6a[_0xa343('0x21')]();};}function saveUpdates(_0x5ec1da,_0x526fb3){return function(_0x39763d){if(_0x39763d){return _0x39763d[_0xa343('0x22')](_0x5ec1da)[_0xa343('0x23')](function(_0x44a509){return _0x44a509;});}return null;};}function removeEntity(_0x126855,_0x1fe076){return function(_0x12916c){if(_0x12916c){return _0x12916c['destroy']()[_0xa343('0x23')](function(){_0x126855['status'](0xcc)[_0xa343('0x19')]();});}};}function handleEntityNotFound(_0x1f66d9,_0x38dfb1){return function(_0x102455){if(!_0x102455){_0x1f66d9[_0xa343('0x17')](0x194);}return _0x102455;};}function handleError(_0x959d88,_0x4bca90){_0x4bca90=_0x4bca90||0x1f4;return function(_0x161363){logger[_0xa343('0x24')](_0x161363[_0xa343('0x25')]);if(_0x161363['name']){delete _0x161363[_0xa343('0x26')];}_0x959d88[_0xa343('0x18')](_0x4bca90)['send'](_0x161363);};}exports[_0xa343('0x27')]=function(_0x5d8d25,_0x5d35b8){var _0x365e7e={},_0x1d7a60={},_0x440edb={'count':0x0,'rows':[]};var _0xcfd981=_[_0xa343('0x28')](db[_0xa343('0x29')][_0xa343('0x2a')],function(_0x558bbe){return{'name':_0x558bbe['fieldName'],'type':_0x558bbe[_0xa343('0x2b')][_0xa343('0x2c')]};});_0x1d7a60['model']=_[_0xa343('0x28')](_0xcfd981,_0xa343('0x26'));_0x1d7a60[_0xa343('0x2d')]=_[_0xa343('0x2e')](_0x5d8d25[_0xa343('0x2d')]);_0x1d7a60[_0xa343('0x2f')]=_[_0xa343('0x30')](_0x1d7a60[_0xa343('0x31')],_0x1d7a60['query']);_0x365e7e[_0xa343('0x32')]=_[_0xa343('0x30')](_0x1d7a60['model'],qs['fields'](_0x5d8d25[_0xa343('0x2d')]['fields']));_0x365e7e['attributes']=_0x365e7e[_0xa343('0x32')][_0xa343('0x33')]?_0x365e7e[_0xa343('0x32')]:_0x1d7a60[_0xa343('0x31')];if(!_0x5d8d25[_0xa343('0x2d')][_0xa343('0x34')]('nolimit')){_0x365e7e[_0xa343('0x1c')]=qs[_0xa343('0x1c')](_0x5d8d25[_0xa343('0x2d')][_0xa343('0x1c')]);_0x365e7e['offset']=qs[_0xa343('0x1a')](_0x5d8d25[_0xa343('0x2d')]['offset']);}_0x365e7e[_0xa343('0x35')]=qs[_0xa343('0x36')](_0x5d8d25[_0xa343('0x2d')][_0xa343('0x36')]);_0x365e7e[_0xa343('0x37')]=qs[_0xa343('0x2f')](_[_0xa343('0x38')](_0x5d8d25['query'],_0x1d7a60[_0xa343('0x2f')]),_0xcfd981);if(_0x5d8d25[_0xa343('0x2d')][_0xa343('0x39')]){_0x365e7e[_0xa343('0x37')]=_[_0xa343('0x3a')](_0x365e7e[_0xa343('0x37')],{'$or':_[_0xa343('0x28')](_0xcfd981,function(_0x469a90){if(_0x469a90[_0xa343('0x2b')]!==_0xa343('0x3b')){var _0x550ca8={};_0x550ca8[_0x469a90[_0xa343('0x26')]]={'$like':'%'+_0x5d8d25['query'][_0xa343('0x39')]+'%'};return _0x550ca8;}})});}_0x365e7e=_['merge']({},_0x365e7e,_0x5d8d25[_0xa343('0x3c')]);var _0x21a67d={'where':_0x365e7e[_0xa343('0x37')]};return db[_0xa343('0x29')][_0xa343('0x1d')](_0x21a67d)[_0xa343('0x23')](function(_0xee6a1d){_0x440edb['count']=_0xee6a1d;if(_0x5d8d25[_0xa343('0x2d')][_0xa343('0x3d')]){_0x365e7e[_0xa343('0x3e')]=[{'all':!![]}];}return db[_0xa343('0x29')][_0xa343('0x3f')](_0x365e7e);})[_0xa343('0x23')](function(_0x411956){_0x440edb[_0xa343('0x40')]=_0x411956;return _0x440edb;})['then'](respondWithFilteredResult(_0x5d35b8,_0x365e7e))[_0xa343('0x41')](handleError(_0x5d35b8,null));};exports[_0xa343('0x42')]=function(_0x31774d,_0x217dbd){var _0x2d2ea8={'raw':![],'where':{'id':_0x31774d[_0xa343('0x43')]['id']}},_0x4be925={};_0x4be925[_0xa343('0x31')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x4be925['query']=_[_0xa343('0x2e')](_0x31774d[_0xa343('0x2d')]);_0x4be925[_0xa343('0x2f')]=_[_0xa343('0x30')](_0x4be925[_0xa343('0x31')],_0x4be925[_0xa343('0x2d')]);_0x2d2ea8[_0xa343('0x32')]=_[_0xa343('0x30')](_0x4be925[_0xa343('0x31')],qs[_0xa343('0x44')](_0x31774d[_0xa343('0x2d')][_0xa343('0x44')]));_0x2d2ea8[_0xa343('0x32')]=_0x2d2ea8['attributes']['length']?_0x2d2ea8[_0xa343('0x32')]:_0x4be925['model'];if(_0x31774d[_0xa343('0x2d')][_0xa343('0x3d')]){_0x2d2ea8[_0xa343('0x3e')]=[{'all':!![]}];}_0x2d2ea8=_[_0xa343('0x3a')]({},_0x2d2ea8,_0x31774d[_0xa343('0x3c')]);return db[_0xa343('0x29')][_0xa343('0x45')](_0x2d2ea8)[_0xa343('0x23')](handleEntityNotFound(_0x217dbd,null))[_0xa343('0x23')](respondWithResult(_0x217dbd,null))[_0xa343('0x41')](handleError(_0x217dbd,null));};exports[_0xa343('0x46')]=function(_0x1f8ba1,_0x5be8f5){return db[_0xa343('0x29')][_0xa343('0x46')](_0x1f8ba1['body'],{})[_0xa343('0x23')](respondWithResult(_0x5be8f5,0xc9))[_0xa343('0x41')](handleError(_0x5be8f5,null));};exports[_0xa343('0x22')]=function(_0xcd64ed,_0x29f7ac){if(_0xcd64ed[_0xa343('0x47')]['id']){delete _0xcd64ed['body']['id'];}return db[_0xa343('0x29')]['find']({'where':{'id':_0xcd64ed[_0xa343('0x43')]['id']}})[_0xa343('0x23')](handleEntityNotFound(_0x29f7ac,null))[_0xa343('0x23')](saveUpdates(_0xcd64ed[_0xa343('0x47')],null))[_0xa343('0x23')](respondWithResult(_0x29f7ac,null))[_0xa343('0x41')](handleError(_0x29f7ac,null));};exports['destroy']=function(_0x547116,_0x29cbfc){return db['ZohoConfiguration'][_0xa343('0x45')]({'where':{'id':_0x547116[_0xa343('0x43')]['id']}})['then'](handleEntityNotFound(_0x29cbfc,null))[_0xa343('0x23')](removeEntity(_0x29cbfc,null))[_0xa343('0x41')](handleError(_0x29cbfc,null));};exports[_0xa343('0x48')]=function(_0x52c474,_0x3ccc36,_0x800bf7){var _0x23244c={};var _0x564e2b={};var _0x4b4601;var _0x3691ec;return db[_0xa343('0x29')][_0xa343('0x49')]({'where':{'id':_0x52c474[_0xa343('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ccc36,null))['then'](function(_0x50df8f){if(_0x50df8f){_0x4b4601=_0x50df8f;_0x564e2b['model']=_[_0xa343('0x2e')](db['ZohoField'][_0xa343('0x2a')]);_0x564e2b[_0xa343('0x2d')]=_[_0xa343('0x2e')](_0x52c474['query']);_0x564e2b[_0xa343('0x2f')]=_[_0xa343('0x30')](_0x564e2b[_0xa343('0x31')],_0x564e2b['query']);_0x23244c[_0xa343('0x32')]=_[_0xa343('0x30')](_0x564e2b[_0xa343('0x31')],qs[_0xa343('0x44')](_0x52c474[_0xa343('0x2d')]['fields']));_0x23244c[_0xa343('0x32')]=_0x23244c[_0xa343('0x32')][_0xa343('0x33')]?_0x23244c['attributes']:_0x564e2b[_0xa343('0x31')];_0x23244c[_0xa343('0x35')]=qs[_0xa343('0x36')](_0x52c474['query']['sort']);_0x23244c[_0xa343('0x37')]=qs['filters'](_[_0xa343('0x38')](_0x52c474[_0xa343('0x2d')],_0x564e2b[_0xa343('0x2f')]));if(_0x52c474[_0xa343('0x2d')][_0xa343('0x39')]){_0x23244c[_0xa343('0x37')]=_['merge'](_0x23244c[_0xa343('0x37')],{'$or':_['map'](_0x23244c[_0xa343('0x32')],function(_0x2df441){var _0x1e395d={};_0x1e395d[_0x2df441]={'$like':'%'+_0x52c474[_0xa343('0x2d')][_0xa343('0x39')]+'%'};return _0x1e395d;})});}_0x23244c=_[_0xa343('0x3a')]({},_0x23244c,_0x52c474[_0xa343('0x3c')]);return _0x4b4601[_0xa343('0x48')](_0x23244c);}})[_0xa343('0x23')](function(_0x342a44){if(_0x342a44){_0x3691ec=_0x342a44[_0xa343('0x33')];if(!_0x52c474['query']['hasOwnProperty'](_0xa343('0x4a'))){_0x23244c[_0xa343('0x1c')]=qs[_0xa343('0x1c')](_0x52c474['query'][_0xa343('0x1c')]);_0x23244c[_0xa343('0x1a')]=qs[_0xa343('0x1a')](_0x52c474[_0xa343('0x2d')][_0xa343('0x1a')]);}return _0x4b4601[_0xa343('0x48')](_0x23244c);}})['then'](function(_0x12ed42){if(_0x12ed42){return _0x12ed42?{'count':_0x3691ec,'rows':_0x12ed42}:null;}})[_0xa343('0x23')](respondWithResult(_0x3ccc36,null))['catch'](handleError(_0x3ccc36,null));};exports[_0xa343('0x4b')]=function(_0xe5a99f,_0x21c68d,_0x2776a6){var _0x3222f2={};var _0x2cb399={};var _0x2b8f01;var _0x592e19;return db[_0xa343('0x29')]['findOne']({'where':{'id':_0xe5a99f[_0xa343('0x43')]['id']}})[_0xa343('0x23')](handleEntityNotFound(_0x21c68d,null))[_0xa343('0x23')](function(_0x1d3ce2){if(_0x1d3ce2){_0x2b8f01=_0x1d3ce2;_0x2cb399[_0xa343('0x31')]=_[_0xa343('0x2e')](db[_0xa343('0x4c')]['rawAttributes']);_0x2cb399[_0xa343('0x2d')]=_[_0xa343('0x2e')](_0xe5a99f[_0xa343('0x2d')]);_0x2cb399['filters']=_[_0xa343('0x30')](_0x2cb399[_0xa343('0x31')],_0x2cb399[_0xa343('0x2d')]);_0x3222f2[_0xa343('0x32')]=_[_0xa343('0x30')](_0x2cb399['model'],qs[_0xa343('0x44')](_0xe5a99f[_0xa343('0x2d')][_0xa343('0x44')]));_0x3222f2[_0xa343('0x32')]=_0x3222f2[_0xa343('0x32')][_0xa343('0x33')]?_0x3222f2[_0xa343('0x32')]:_0x2cb399[_0xa343('0x31')];_0x3222f2['order']=qs[_0xa343('0x36')](_0xe5a99f[_0xa343('0x2d')][_0xa343('0x36')]);_0x3222f2[_0xa343('0x37')]=qs['filters'](_[_0xa343('0x38')](_0xe5a99f[_0xa343('0x2d')],_0x2cb399['filters']));if(_0xe5a99f[_0xa343('0x2d')]['filter']){_0x3222f2[_0xa343('0x37')]=_['merge'](_0x3222f2['where'],{'$or':_[_0xa343('0x28')](_0x3222f2[_0xa343('0x32')],function(_0xa20e80){var _0x568c5e={};_0x568c5e[_0xa20e80]={'$like':'%'+_0xe5a99f[_0xa343('0x2d')]['filter']+'%'};return _0x568c5e;})});}_0x3222f2=_[_0xa343('0x3a')]({},_0x3222f2,_0xe5a99f['options']);return _0x2b8f01[_0xa343('0x4b')](_0x3222f2);}})[_0xa343('0x23')](function(_0x466c8a){if(_0x466c8a){_0x592e19=_0x466c8a[_0xa343('0x33')];if(!_0xe5a99f[_0xa343('0x2d')][_0xa343('0x34')]('nolimit')){_0x3222f2[_0xa343('0x1c')]=qs[_0xa343('0x1c')](_0xe5a99f['query'][_0xa343('0x1c')]);_0x3222f2[_0xa343('0x1a')]=qs[_0xa343('0x1a')](_0xe5a99f[_0xa343('0x2d')][_0xa343('0x1a')]);}return _0x2b8f01[_0xa343('0x4b')](_0x3222f2);}})['then'](function(_0x162f9d){if(_0x162f9d){return _0x162f9d?{'count':_0x592e19,'rows':_0x162f9d}:null;}})['then'](respondWithResult(_0x21c68d,null))[_0xa343('0x41')](handleError(_0x21c68d,null));};exports[_0xa343('0x4d')]=function(_0x391a06,_0x5d117d,_0x27ece7){var _0x4d2b4b={};var _0x53d17a={};var _0x5972b9;var _0x221ab8;return db[_0xa343('0x29')][_0xa343('0x49')]({'where':{'id':_0x391a06['params']['id']}})[_0xa343('0x23')](handleEntityNotFound(_0x5d117d,null))['then'](function(_0x5b9e11){if(_0x5b9e11){_0x5972b9=_0x5b9e11;_0x53d17a[_0xa343('0x31')]=_['keys'](db['ZohoField'][_0xa343('0x2a')]);_0x53d17a[_0xa343('0x2d')]=_['keys'](_0x391a06[_0xa343('0x2d')]);_0x53d17a['filters']=_['intersection'](_0x53d17a['model'],_0x53d17a[_0xa343('0x2d')]);_0x4d2b4b[_0xa343('0x32')]=_[_0xa343('0x30')](_0x53d17a[_0xa343('0x31')],qs['fields'](_0x391a06[_0xa343('0x2d')][_0xa343('0x44')]));_0x4d2b4b[_0xa343('0x32')]=_0x4d2b4b[_0xa343('0x32')][_0xa343('0x33')]?_0x4d2b4b[_0xa343('0x32')]:_0x53d17a[_0xa343('0x31')];_0x4d2b4b[_0xa343('0x35')]=qs[_0xa343('0x36')](_0x391a06[_0xa343('0x2d')][_0xa343('0x36')]);_0x4d2b4b[_0xa343('0x37')]=qs[_0xa343('0x2f')](_[_0xa343('0x38')](_0x391a06['query'],_0x53d17a['filters']));if(_0x391a06[_0xa343('0x2d')][_0xa343('0x39')]){_0x4d2b4b['where']=_[_0xa343('0x3a')](_0x4d2b4b[_0xa343('0x37')],{'$or':_[_0xa343('0x28')](_0x4d2b4b['attributes'],function(_0x5b0377){var _0x39ed30={};_0x39ed30[_0x5b0377]={'$like':'%'+_0x391a06[_0xa343('0x2d')]['filter']+'%'};return _0x39ed30;})});}_0x4d2b4b=_['merge']({},_0x4d2b4b,_0x391a06[_0xa343('0x3c')]);return _0x5972b9[_0xa343('0x4d')](_0x4d2b4b);}})[_0xa343('0x23')](function(_0x44ebb7){if(_0x44ebb7){_0x221ab8=_0x44ebb7[_0xa343('0x33')];if(!_0x391a06[_0xa343('0x2d')][_0xa343('0x34')](_0xa343('0x4a'))){_0x4d2b4b[_0xa343('0x1c')]=qs['limit'](_0x391a06[_0xa343('0x2d')][_0xa343('0x1c')]);_0x4d2b4b[_0xa343('0x1a')]=qs['offset'](_0x391a06[_0xa343('0x2d')][_0xa343('0x1a')]);}return _0x5972b9['getDescriptions'](_0x4d2b4b);}})[_0xa343('0x23')](function(_0x3497f8){if(_0x3497f8){return _0x3497f8?{'count':_0x221ab8,'rows':_0x3497f8}:null;}})[_0xa343('0x23')](respondWithResult(_0x5d117d,null))[_0xa343('0x41')](handleError(_0x5d117d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c857144..c9eae33 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 _0x6248=['ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x555168,_0x1025a8){var _0x23d7cc=function(_0x49e309){while(--_0x49e309){_0x555168['push'](_0x555168['shift']());}};_0x23d7cc(++_0x1025a8);}(_0x6248,0x1bc));var _0x8624=function(_0x3fe41e,_0x29bbb8){_0x3fe41e=_0x3fe41e-0x0;var _0x31e4b6=_0x6248[_0x3fe41e];return _0x31e4b6;};'use strict';var _=require(_0x8624('0x0'));var util=require(_0x8624('0x1'));var logger=require('../../config/logger')(_0x8624('0x2'));var moment=require(_0x8624('0x3'));var BPromise=require(_0x8624('0x4'));var rp=require(_0x8624('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8624('0x6'));var config=require(_0x8624('0x7'));var attributes=require(_0x8624('0x8'));module[_0x8624('0x9')]=function(_0xde17ea,_0x5436a6){return _0xde17ea[_0x8624('0xa')](_0x8624('0xb'),attributes,{'tableName':_0x8624('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dd6=['../../config/environment','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x19a631,_0x4861c8){var _0x443a16=function(_0x585ff6){while(--_0x585ff6){_0x19a631['push'](_0x19a631['shift']());}};_0x443a16(++_0x4861c8);}(_0x6dd6,0x13c));var _0x66dd=function(_0x188bfe,_0x2517cc){_0x188bfe=_0x188bfe-0x0;var _0x1a9efa=_0x6dd6[_0x188bfe];return _0x1a9efa;};'use strict';var _=require(_0x66dd('0x0'));var util=require(_0x66dd('0x1'));var logger=require(_0x66dd('0x2'))(_0x66dd('0x3'));var moment=require(_0x66dd('0x4'));var BPromise=require('bluebird');var rp=require(_0x66dd('0x5'));var fs=require('fs');var path=require(_0x66dd('0x6'));var rimraf=require(_0x66dd('0x7'));var config=require(_0x66dd('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x66dd('0x9')]=function(_0x4673c9,_0x5c6578){return _0x4673c9['define'](_0x66dd('0xa'),attributes,{'tableName':_0x66dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index c258e26..e89ed4f 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 _0xac4c=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4d53a5,_0x3da5df){var _0xb85e6e=function(_0x3a726e){while(--_0x3a726e){_0x4d53a5['push'](_0x4d53a5['shift']());}};_0xb85e6e(++_0x3da5df);}(_0xac4c,0x70));var _0xcac4=function(_0x2cacbd,_0x43e28f){_0x2cacbd=_0x2cacbd-0x0;var _0x5f410e=_0xac4c[_0x2cacbd];return _0x5f410e;};'use strict';var _=require(_0xcac4('0x0'));var util=require(_0xcac4('0x1'));var moment=require('moment');var BPromise=require(_0xcac4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcac4('0x3'));var db=require(_0xcac4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcac4('0x5'));var config=require(_0xcac4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcac4('0x7')][_0xcac4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfc83a6,_0x409d67,_0x4f5f1c){return new BPromise(function(_0x49d2b8,_0x546588){return client[_0xcac4('0x9')](_0xfc83a6,_0x4f5f1c)[_0xcac4('0xa')](function(_0x4bdee5){logger[_0xcac4('0xb')](_0xcac4('0xc'),_0x409d67,_0xcac4('0xd'));logger[_0xcac4('0xe')](_0xcac4('0xf'),_0x409d67,_0xcac4('0xd'),JSON['stringify'](_0x4bdee5));if(_0x4bdee5[_0xcac4('0x10')]){if(_0x4bdee5['error'][_0xcac4('0x11')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x409d67,_0x4bdee5[_0xcac4('0x10')]['message']);return _0x546588(_0x4bdee5[_0xcac4('0x10')][_0xcac4('0x12')]);}logger[_0xcac4('0x10')](_0xcac4('0xc'),_0x409d67,_0x4bdee5[_0xcac4('0x10')][_0xcac4('0x12')]);return _0x49d2b8(_0x4bdee5[_0xcac4('0x10')]['message']);}else{logger[_0xcac4('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x409d67,_0xcac4('0xd'));_0x49d2b8(_0x4bdee5[_0xcac4('0x13')][_0xcac4('0x12')]);}})[_0xcac4('0x14')](function(_0x57ba25){logger['error'](_0xcac4('0xc'),_0x409d67,_0x57ba25);_0x546588(_0x57ba25);});});} \ No newline at end of file +var _0xa50a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','result','util','moment','bluebird','ioredis'];(function(_0x3810fb,_0x109b23){var _0x458d27=function(_0x109e56){while(--_0x109e56){_0x3810fb['push'](_0x3810fb['shift']());}};_0x458d27(++_0x109b23);}(_0xa50a,0xd8));var _0xaa50=function(_0x546af3,_0x904a3f){_0x546af3=_0x546af3-0x0;var _0x1c156a=_0xa50a[_0x546af3];return _0x1c156a;};'use strict';var _=require('lodash');var util=require(_0xaa50('0x0'));var moment=require(_0xaa50('0x1'));var BPromise=require(_0xaa50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa50('0x3'));var db=require(_0xaa50('0x4'))['db'];var utils=require(_0xaa50('0x5'));var logger=require(_0xaa50('0x6'))(_0xaa50('0x7'));var config=require(_0xaa50('0x8'));var jayson=require(_0xaa50('0x9'));var client=jayson['client'][_0xaa50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xda6ac1,_0x15152e,_0x3640ad){return new BPromise(function(_0x5ac8af,_0x5c5399){return client[_0xaa50('0xb')](_0xda6ac1,_0x3640ad)[_0xaa50('0xc')](function(_0x408a20){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x15152e,_0xaa50('0xd'));logger[_0xaa50('0xe')](_0xaa50('0xf'),_0x15152e,_0xaa50('0xd'),JSON['stringify'](_0x408a20));if(_0x408a20['error']){if(_0x408a20[_0xaa50('0x10')][_0xaa50('0x11')]===0x1f4){logger[_0xaa50('0x10')](_0xaa50('0x12'),_0x15152e,_0x408a20[_0xaa50('0x10')][_0xaa50('0x13')]);return _0x5c5399(_0x408a20[_0xaa50('0x10')][_0xaa50('0x13')]);}logger['error'](_0xaa50('0x12'),_0x15152e,_0x408a20[_0xaa50('0x10')][_0xaa50('0x13')]);return _0x5ac8af(_0x408a20[_0xaa50('0x10')][_0xaa50('0x13')]);}else{logger[_0xaa50('0x14')](_0xaa50('0x12'),_0x15152e,'request\x20sent');_0x5ac8af(_0x408a20[_0xaa50('0x15')][_0xaa50('0x13')]);}})['catch'](function(_0x19968e){logger[_0xaa50('0x10')](_0xaa50('0x12'),_0x15152e,_0x19968e);_0x5c5399(_0x19968e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 6241f2a..26a1e9e 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 _0xb9f8=['post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0xb9f8,0x15b));var _0x8b9f=function(_0xcbe321,_0x43fd9d){_0xcbe321=_0xcbe321-0x0;var _0x43b66c=_0xb9f8[_0xcbe321];return _0x43b66c;};'use strict';var multer=require(_0x8b9f('0x0'));var util=require(_0x8b9f('0x1'));var path=require(_0x8b9f('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b9f('0x3'));var router=express[_0x8b9f('0x4')]();var fs_extra=require(_0x8b9f('0x5'));var auth=require(_0x8b9f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b9f('0x7'));var controller=require(_0x8b9f('0x8'));router[_0x8b9f('0x9')]('/',auth[_0x8b9f('0xa')](),controller['index']);router[_0x8b9f('0x9')](_0x8b9f('0xb'),auth['isAuthenticated'](),controller[_0x8b9f('0xc')]);router[_0x8b9f('0xd')]('/',auth[_0x8b9f('0xa')](),controller[_0x8b9f('0xe')]);router[_0x8b9f('0xf')](_0x8b9f('0xb'),auth[_0x8b9f('0xa')](),controller[_0x8b9f('0x10')]);router[_0x8b9f('0x11')](_0x8b9f('0xb'),auth['isAuthenticated'](),controller[_0x8b9f('0x12')]);module[_0x8b9f('0x13')]=router; \ No newline at end of file +var _0x72db=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0x58ee32,_0x2450cc){var _0x22a1d9=function(_0x253807){while(--_0x253807){_0x58ee32['push'](_0x58ee32['shift']());}};_0x22a1d9(++_0x2450cc);}(_0x72db,0xa8));var _0xb72d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x72db[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb72d('0x0'));var util=require(_0xb72d('0x1'));var path=require(_0xb72d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb72d('0x3'));var router=express[_0xb72d('0x4')]();var fs_extra=require(_0xb72d('0x5'));var auth=require(_0xb72d('0x6'));var interaction=require(_0xb72d('0x7'));var config=require(_0xb72d('0x8'));var controller=require(_0xb72d('0x9'));router[_0xb72d('0xa')]('/',auth['isAuthenticated'](),controller[_0xb72d('0xb')]);router[_0xb72d('0xa')](_0xb72d('0xc'),auth[_0xb72d('0xd')](),controller['show']);router[_0xb72d('0xe')]('/',auth[_0xb72d('0xd')](),controller[_0xb72d('0xf')]);router[_0xb72d('0x10')](_0xb72d('0xc'),auth['isAuthenticated'](),controller[_0xb72d('0x11')]);router[_0xb72d('0x12')](_0xb72d('0xc'),auth[_0xb72d('0xd')](),controller[_0xb72d('0x13')]);module[_0xb72d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c30feb6..1c95589 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 _0x530f=['picklist','string','STRING','BOOLEAN','exports','ENUM','variable','keyValue'];(function(_0x14f980,_0x2f6495){var _0x1163b7=function(_0xacb364){while(--_0xacb364){_0x14f980['push'](_0x14f980['shift']());}};_0x1163b7(++_0x2f6495);}(_0x530f,0xa4));var _0xf530=function(_0x1522db,_0x7efece){_0x1522db=_0x1522db-0x0;var _0x165585=_0x530f[_0x1522db];return _0x165585;};'use strict';var Sequelize=require('sequelize');module[_0xf530('0x0')]={'type':{'type':Sequelize[_0xf530('0x1')]('string',_0xf530('0x2'),'customVariable',_0xf530('0x3'),_0xf530('0x4')),'defaultValue':_0xf530('0x5')},'content':{'type':Sequelize[_0xf530('0x6')]},'key':{'type':Sequelize[_0xf530('0x6')]},'keyType':{'type':Sequelize[_0xf530('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf530('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf530('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf530('0x6')]}}; \ No newline at end of file +var _0xbfbe=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x5136f6,_0x2c5ede){var _0x20a13a=function(_0x2acc5c){while(--_0x2acc5c){_0x5136f6['push'](_0x5136f6['shift']());}};_0x20a13a(++_0x2c5ede);}(_0xbfbe,0x148));var _0xebfb=function(_0xbcd604,_0x5c6862){_0xbcd604=_0xbcd604-0x0;var _0x16a71e=_0xbfbe[_0xbcd604];return _0x16a71e;};'use strict';var Sequelize=require(_0xebfb('0x0'));module[_0xebfb('0x1')]={'type':{'type':Sequelize[_0xebfb('0x2')](_0xebfb('0x3'),'variable',_0xebfb('0x4'),_0xebfb('0x5'),_0xebfb('0x6')),'defaultValue':_0xebfb('0x3')},'content':{'type':Sequelize[_0xebfb('0x7')]},'key':{'type':Sequelize[_0xebfb('0x7')]},'keyType':{'type':Sequelize[_0xebfb('0x2')](_0xebfb('0x3'),_0xebfb('0x8'),_0xebfb('0x4'))},'keyContent':{'type':Sequelize[_0xebfb('0x7')]},'idField':{'type':Sequelize[_0xebfb('0x7')]},'nameField':{'type':Sequelize[_0xebfb('0x7')]},'customField':{'type':Sequelize[_0xebfb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xebfb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index fd474eb..5932e40 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 _0xf8fb=['rows','catch','show','find','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','offset','sort','where','pick','filter','merge','options','includeAll','include','findAll'];(function(_0x285c6c,_0xdfbed9){var _0x5a195c=function(_0x51f414){while(--_0x51f414){_0x285c6c['push'](_0x285c6c['shift']());}};_0x5a195c(++_0xdfbed9);}(_0xf8fb,0x184));var _0xbf8f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf8fb[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0xbf8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf8f('0x1'));var jsonpatch=require(_0xbf8f('0x2'));var rp=require(_0xbf8f('0x3'));var moment=require(_0xbf8f('0x4'));var BPromise=require(_0xbf8f('0x5'));var Mustache=require('mustache');var util=require(_0xbf8f('0x6'));var path=require(_0xbf8f('0x7'));var sox=require(_0xbf8f('0x8'));var csv=require(_0xbf8f('0x9'));var ejs=require(_0xbf8f('0xa'));var fs=require('fs');var fs_extra=require(_0xbf8f('0xb'));var _=require(_0xbf8f('0xc'));var squel=require('squel');var crypto=require(_0xbf8f('0xd'));var jsforce=require(_0xbf8f('0xe'));var deskjs=require(_0xbf8f('0xf'));var toCsv=require(_0xbf8f('0x9'));var querystring=require(_0xbf8f('0x10'));var Papa=require(_0xbf8f('0x11'));var Redis=require(_0xbf8f('0x12'));var authService=require(_0xbf8f('0x13'));var qs=require(_0xbf8f('0x14'));var as=require(_0xbf8f('0x15'));var hardwareService=require(_0xbf8f('0x16'));var logger=require(_0xbf8f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xbf8f('0x18'));var licenseUtil=require(_0xbf8f('0x19'));var db=require(_0xbf8f('0x1a'))['db'];function respondWithStatusCode(_0x23d11,_0x26a100){_0x26a100=_0x26a100||0xcc;return function(_0x5dfa29){if(_0x5dfa29){return _0x23d11[_0xbf8f('0x1b')](_0x26a100);}return _0x23d11['status'](_0x26a100)[_0xbf8f('0x1c')]();};}function respondWithResult(_0x108fb7,_0x3b242c){_0x3b242c=_0x3b242c||0xc8;return function(_0x7ec369){if(_0x7ec369){return _0x108fb7[_0xbf8f('0x1d')](_0x3b242c)[_0xbf8f('0x1e')](_0x7ec369);}};}function respondWithFilteredResult(_0x212ee1,_0x18e9ef){return function(_0x3c36e1){if(_0x3c36e1){var _0x27d2fd=typeof _0x18e9ef['offset']===_0xbf8f('0x1f')&&typeof _0x18e9ef[_0xbf8f('0x20')]===_0xbf8f('0x1f');var _0x46f5ac=_0x3c36e1['count'];var _0x1fbe1e=_0x27d2fd?0x0:_0x18e9ef['offset'];var _0x3a2111=_0x27d2fd?_0x3c36e1[_0xbf8f('0x21')]:_0x18e9ef['offset']+_0x18e9ef[_0xbf8f('0x20')];var _0xa91e60;if(_0x3a2111>=_0x46f5ac){_0x3a2111=_0x46f5ac;_0xa91e60=0xc8;}else{_0xa91e60=0xce;}_0x212ee1[_0xbf8f('0x1d')](_0xa91e60);return _0x212ee1[_0xbf8f('0x22')]('Content-Range',_0x1fbe1e+'-'+_0x3a2111+'/'+_0x46f5ac)[_0xbf8f('0x1e')](_0x3c36e1);}return null;};}function patchUpdates(_0x1e89a8){return function(_0x2615d6){try{jsonpatch[_0xbf8f('0x23')](_0x2615d6,_0x1e89a8,!![]);}catch(_0x12ad97){return BPromise[_0xbf8f('0x24')](_0x12ad97);}return _0x2615d6['save']();};}function saveUpdates(_0x3fdc0a,_0x3135f4){return function(_0x8f79c0){if(_0x8f79c0){return _0x8f79c0[_0xbf8f('0x25')](_0x3fdc0a)[_0xbf8f('0x26')](function(_0x4ddbdd){return _0x4ddbdd;});}return null;};}function removeEntity(_0x3cfb0c,_0x432cee){return function(_0x3b1f35){if(_0x3b1f35){return _0x3b1f35['destroy']()[_0xbf8f('0x26')](function(){_0x3cfb0c['status'](0xcc)[_0xbf8f('0x1c')]();});}};}function handleEntityNotFound(_0x1f676f,_0x487ee8){return function(_0x35ce5d){if(!_0x35ce5d){_0x1f676f[_0xbf8f('0x1b')](0x194);}return _0x35ce5d;};}function handleError(_0x135f91,_0x448eb1){_0x448eb1=_0x448eb1||0x1f4;return function(_0x430847){logger[_0xbf8f('0x27')](_0x430847[_0xbf8f('0x28')]);if(_0x430847['name']){delete _0x430847[_0xbf8f('0x29')];}_0x135f91[_0xbf8f('0x1d')](_0x448eb1)[_0xbf8f('0x2a')](_0x430847);};}exports[_0xbf8f('0x2b')]=function(_0x5654b4,_0x29871c){var _0x464e6a={},_0x28202c={},_0x1b692c={'count':0x0,'rows':[]};var _0xb2a1b7=_[_0xbf8f('0x2c')](db[_0xbf8f('0x2d')][_0xbf8f('0x2e')],function(_0x35b299){return{'name':_0x35b299[_0xbf8f('0x2f')],'type':_0x35b299[_0xbf8f('0x30')][_0xbf8f('0x31')]};});_0x28202c[_0xbf8f('0x32')]=_['map'](_0xb2a1b7,_0xbf8f('0x29'));_0x28202c[_0xbf8f('0x33')]=_[_0xbf8f('0x34')](_0x5654b4[_0xbf8f('0x33')]);_0x28202c[_0xbf8f('0x35')]=_[_0xbf8f('0x36')](_0x28202c[_0xbf8f('0x32')],_0x28202c[_0xbf8f('0x33')]);_0x464e6a[_0xbf8f('0x37')]=_[_0xbf8f('0x36')](_0x28202c[_0xbf8f('0x32')],qs[_0xbf8f('0x38')](_0x5654b4[_0xbf8f('0x33')][_0xbf8f('0x38')]));_0x464e6a['attributes']=_0x464e6a[_0xbf8f('0x37')][_0xbf8f('0x39')]?_0x464e6a[_0xbf8f('0x37')]:_0x28202c[_0xbf8f('0x32')];if(!_0x5654b4[_0xbf8f('0x33')]['hasOwnProperty']('nolimit')){_0x464e6a[_0xbf8f('0x20')]=qs[_0xbf8f('0x20')](_0x5654b4['query'][_0xbf8f('0x20')]);_0x464e6a[_0xbf8f('0x3a')]=qs[_0xbf8f('0x3a')](_0x5654b4[_0xbf8f('0x33')]['offset']);}_0x464e6a['order']=qs['sort'](_0x5654b4['query'][_0xbf8f('0x3b')]);_0x464e6a[_0xbf8f('0x3c')]=qs[_0xbf8f('0x35')](_[_0xbf8f('0x3d')](_0x5654b4[_0xbf8f('0x33')],_0x28202c[_0xbf8f('0x35')]),_0xb2a1b7);if(_0x5654b4[_0xbf8f('0x33')][_0xbf8f('0x3e')]){_0x464e6a[_0xbf8f('0x3c')]=_['merge'](_0x464e6a[_0xbf8f('0x3c')],{'$or':_[_0xbf8f('0x2c')](_0xb2a1b7,function(_0x1390d2){if(_0x1390d2[_0xbf8f('0x30')]!=='VIRTUAL'){var _0x545fcb={};_0x545fcb[_0x1390d2[_0xbf8f('0x29')]]={'$like':'%'+_0x5654b4[_0xbf8f('0x33')][_0xbf8f('0x3e')]+'%'};return _0x545fcb;}})});}_0x464e6a=_[_0xbf8f('0x3f')]({},_0x464e6a,_0x5654b4[_0xbf8f('0x40')]);var _0x4806d5={'where':_0x464e6a['where']};return db['ZohoField']['count'](_0x4806d5)['then'](function(_0x10a753){_0x1b692c[_0xbf8f('0x21')]=_0x10a753;if(_0x5654b4[_0xbf8f('0x33')][_0xbf8f('0x41')]){_0x464e6a[_0xbf8f('0x42')]=[{'all':!![]}];}return db[_0xbf8f('0x2d')][_0xbf8f('0x43')](_0x464e6a);})[_0xbf8f('0x26')](function(_0x52a240){_0x1b692c[_0xbf8f('0x44')]=_0x52a240;return _0x1b692c;})[_0xbf8f('0x26')](respondWithFilteredResult(_0x29871c,_0x464e6a))[_0xbf8f('0x45')](handleError(_0x29871c,null));};exports[_0xbf8f('0x46')]=function(_0x5d6a99,_0x351616){var _0x259ce9={'raw':!![],'where':{'id':_0x5d6a99['params']['id']}},_0x3e112b={};_0x3e112b[_0xbf8f('0x32')]=_['keys'](db['ZohoField'][_0xbf8f('0x2e')]);_0x3e112b[_0xbf8f('0x33')]=_[_0xbf8f('0x34')](_0x5d6a99[_0xbf8f('0x33')]);_0x3e112b[_0xbf8f('0x35')]=_[_0xbf8f('0x36')](_0x3e112b[_0xbf8f('0x32')],_0x3e112b['query']);_0x259ce9[_0xbf8f('0x37')]=_[_0xbf8f('0x36')](_0x3e112b[_0xbf8f('0x32')],qs['fields'](_0x5d6a99[_0xbf8f('0x33')]['fields']));_0x259ce9['attributes']=_0x259ce9[_0xbf8f('0x37')][_0xbf8f('0x39')]?_0x259ce9['attributes']:_0x3e112b['model'];if(_0x5d6a99['query'][_0xbf8f('0x41')]){_0x259ce9[_0xbf8f('0x42')]=[{'all':!![]}];}_0x259ce9=_[_0xbf8f('0x3f')]({},_0x259ce9,_0x5d6a99['options']);return db[_0xbf8f('0x2d')][_0xbf8f('0x47')](_0x259ce9)['then'](handleEntityNotFound(_0x351616,null))['then'](respondWithResult(_0x351616,null))['catch'](handleError(_0x351616,null));};exports[_0xbf8f('0x48')]=function(_0x2ddf81,_0x205f9e){return db['ZohoField'][_0xbf8f('0x48')](_0x2ddf81[_0xbf8f('0x49')],{})[_0xbf8f('0x26')](respondWithResult(_0x205f9e,0xc9))[_0xbf8f('0x45')](handleError(_0x205f9e,null));};exports['update']=function(_0x13904c,_0x24ddee){if(_0x13904c[_0xbf8f('0x49')]['id']){delete _0x13904c['body']['id'];}return db[_0xbf8f('0x2d')][_0xbf8f('0x47')]({'where':{'id':_0x13904c[_0xbf8f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24ddee,null))[_0xbf8f('0x26')](saveUpdates(_0x13904c[_0xbf8f('0x49')],null))[_0xbf8f('0x26')](respondWithResult(_0x24ddee,null))[_0xbf8f('0x45')](handleError(_0x24ddee,null));};exports[_0xbf8f('0x4b')]=function(_0x42936e,_0x1c9f78){return db[_0xbf8f('0x2d')][_0xbf8f('0x47')]({'where':{'id':_0x42936e[_0xbf8f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1c9f78,null))[_0xbf8f('0x26')](removeEntity(_0x1c9f78,null))['catch'](handleError(_0x1c9f78,null));}; \ No newline at end of file +var _0x0c71=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','ZohoField','body','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','send','index','map','rawAttributes','type','key','model','name','query','keys'];(function(_0x58153d,_0x3a4932){var _0x2ff1b1=function(_0xc4d0ce){while(--_0xc4d0ce){_0x58153d['push'](_0x58153d['shift']());}};_0x2ff1b1(++_0x3a4932);}(_0x0c71,0xfb));var _0x10c7=function(_0x40dfca,_0x563819){_0x40dfca=_0x40dfca-0x0;var _0x28e6e6=_0x0c71[_0x40dfca];return _0x28e6e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x10c7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10c7('0x1'));var rp=require(_0x10c7('0x2'));var moment=require(_0x10c7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x10c7('0x4'));var path=require('path');var sox=require(_0x10c7('0x5'));var csv=require(_0x10c7('0x6'));var ejs=require(_0x10c7('0x7'));var fs=require('fs');var fs_extra=require(_0x10c7('0x8'));var _=require(_0x10c7('0x9'));var squel=require(_0x10c7('0xa'));var crypto=require('crypto');var jsforce=require(_0x10c7('0xb'));var deskjs=require(_0x10c7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x10c7('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x10c7('0xe'));var qs=require(_0x10c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10c7('0x10'));var logger=require(_0x10c7('0x11'))(_0x10c7('0x12'));var utils=require(_0x10c7('0x13'));var config=require(_0x10c7('0x14'));var licenseUtil=require(_0x10c7('0x15'));var db=require(_0x10c7('0x16'))['db'];function respondWithStatusCode(_0x2fcb9f,_0x3e0507){_0x3e0507=_0x3e0507||0xcc;return function(_0x15f838){if(_0x15f838){return _0x2fcb9f['sendStatus'](_0x3e0507);}return _0x2fcb9f[_0x10c7('0x17')](_0x3e0507)[_0x10c7('0x18')]();};}function respondWithResult(_0x3fbf7a,_0x253c65){_0x253c65=_0x253c65||0xc8;return function(_0x45568c){if(_0x45568c){return _0x3fbf7a[_0x10c7('0x17')](_0x253c65)[_0x10c7('0x19')](_0x45568c);}};}function respondWithFilteredResult(_0x4ea8b3,_0x28ed15){return function(_0xe44546){if(_0xe44546){var _0x53aaae=typeof _0x28ed15[_0x10c7('0x1a')]===_0x10c7('0x1b')&&typeof _0x28ed15[_0x10c7('0x1c')]===_0x10c7('0x1b');var _0x2f4966=_0xe44546[_0x10c7('0x1d')];var _0x3168e1=_0x53aaae?0x0:_0x28ed15[_0x10c7('0x1a')];var _0x2ecb76=_0x53aaae?_0xe44546['count']:_0x28ed15['offset']+_0x28ed15[_0x10c7('0x1c')];var _0x28c0bd;if(_0x2ecb76>=_0x2f4966){_0x2ecb76=_0x2f4966;_0x28c0bd=0xc8;}else{_0x28c0bd=0xce;}_0x4ea8b3['status'](_0x28c0bd);return _0x4ea8b3[_0x10c7('0x1e')](_0x10c7('0x1f'),_0x3168e1+'-'+_0x2ecb76+'/'+_0x2f4966)[_0x10c7('0x19')](_0xe44546);}return null;};}function patchUpdates(_0x5373cf){return function(_0x41a5ba){try{jsonpatch['apply'](_0x41a5ba,_0x5373cf,!![]);}catch(_0x3bc5e0){return BPromise[_0x10c7('0x20')](_0x3bc5e0);}return _0x41a5ba[_0x10c7('0x21')]();};}function saveUpdates(_0x5a2b7f,_0x29a2e5){return function(_0xc4dc9e){if(_0xc4dc9e){return _0xc4dc9e[_0x10c7('0x22')](_0x5a2b7f)[_0x10c7('0x23')](function(_0x1450f3){return _0x1450f3;});}return null;};}function removeEntity(_0xcafdc1,_0x9c658f){return function(_0x308e3a){if(_0x308e3a){return _0x308e3a[_0x10c7('0x24')]()[_0x10c7('0x23')](function(){_0xcafdc1[_0x10c7('0x17')](0xcc)[_0x10c7('0x18')]();});}};}function handleEntityNotFound(_0x3bc016,_0xe53724){return function(_0x3c40c3){if(!_0x3c40c3){_0x3bc016[_0x10c7('0x25')](0x194);}return _0x3c40c3;};}function handleError(_0xec403,_0x2cc3d0){_0x2cc3d0=_0x2cc3d0||0x1f4;return function(_0x33093e){logger[_0x10c7('0x26')](_0x33093e['stack']);if(_0x33093e['name']){delete _0x33093e['name'];}_0xec403[_0x10c7('0x17')](_0x2cc3d0)[_0x10c7('0x27')](_0x33093e);};}exports[_0x10c7('0x28')]=function(_0x206e1d,_0x27ac7e){var _0x3284c4={},_0x4844cc={},_0x4630c8={'count':0x0,'rows':[]};var _0x5cf4dd=_[_0x10c7('0x29')](db['ZohoField'][_0x10c7('0x2a')],function(_0x14efa1){return{'name':_0x14efa1['fieldName'],'type':_0x14efa1[_0x10c7('0x2b')][_0x10c7('0x2c')]};});_0x4844cc[_0x10c7('0x2d')]=_['map'](_0x5cf4dd,_0x10c7('0x2e'));_0x4844cc[_0x10c7('0x2f')]=_[_0x10c7('0x30')](_0x206e1d[_0x10c7('0x2f')]);_0x4844cc[_0x10c7('0x31')]=_[_0x10c7('0x32')](_0x4844cc[_0x10c7('0x2d')],_0x4844cc['query']);_0x3284c4['attributes']=_[_0x10c7('0x32')](_0x4844cc[_0x10c7('0x2d')],qs[_0x10c7('0x33')](_0x206e1d[_0x10c7('0x2f')][_0x10c7('0x33')]));_0x3284c4[_0x10c7('0x34')]=_0x3284c4[_0x10c7('0x34')][_0x10c7('0x35')]?_0x3284c4[_0x10c7('0x34')]:_0x4844cc[_0x10c7('0x2d')];if(!_0x206e1d[_0x10c7('0x2f')][_0x10c7('0x36')](_0x10c7('0x37'))){_0x3284c4[_0x10c7('0x1c')]=qs['limit'](_0x206e1d[_0x10c7('0x2f')][_0x10c7('0x1c')]);_0x3284c4[_0x10c7('0x1a')]=qs[_0x10c7('0x1a')](_0x206e1d['query'][_0x10c7('0x1a')]);}_0x3284c4[_0x10c7('0x38')]=qs[_0x10c7('0x39')](_0x206e1d[_0x10c7('0x2f')][_0x10c7('0x39')]);_0x3284c4[_0x10c7('0x3a')]=qs[_0x10c7('0x31')](_[_0x10c7('0x3b')](_0x206e1d[_0x10c7('0x2f')],_0x4844cc[_0x10c7('0x31')]),_0x5cf4dd);if(_0x206e1d['query'][_0x10c7('0x3c')]){_0x3284c4[_0x10c7('0x3a')]=_['merge'](_0x3284c4[_0x10c7('0x3a')],{'$or':_['map'](_0x5cf4dd,function(_0x41e06b){if(_0x41e06b[_0x10c7('0x2b')]!==_0x10c7('0x3d')){var _0x148afa={};_0x148afa[_0x41e06b[_0x10c7('0x2e')]]={'$like':'%'+_0x206e1d[_0x10c7('0x2f')][_0x10c7('0x3c')]+'%'};return _0x148afa;}})});}_0x3284c4=_[_0x10c7('0x3e')]({},_0x3284c4,_0x206e1d[_0x10c7('0x3f')]);var _0x181515={'where':_0x3284c4[_0x10c7('0x3a')]};return db['ZohoField'][_0x10c7('0x1d')](_0x181515)[_0x10c7('0x23')](function(_0x444475){_0x4630c8[_0x10c7('0x1d')]=_0x444475;if(_0x206e1d['query'][_0x10c7('0x40')]){_0x3284c4['include']=[{'all':!![]}];}return db['ZohoField'][_0x10c7('0x41')](_0x3284c4);})['then'](function(_0xe022ce){_0x4630c8[_0x10c7('0x42')]=_0xe022ce;return _0x4630c8;})[_0x10c7('0x23')](respondWithFilteredResult(_0x27ac7e,_0x3284c4))[_0x10c7('0x43')](handleError(_0x27ac7e,null));};exports[_0x10c7('0x44')]=function(_0x1b0175,_0xa79ce3){var _0x2712d4={'raw':!![],'where':{'id':_0x1b0175[_0x10c7('0x45')]['id']}},_0x5b73d2={};_0x5b73d2[_0x10c7('0x2d')]=_[_0x10c7('0x30')](db['ZohoField'][_0x10c7('0x2a')]);_0x5b73d2[_0x10c7('0x2f')]=_['keys'](_0x1b0175[_0x10c7('0x2f')]);_0x5b73d2[_0x10c7('0x31')]=_[_0x10c7('0x32')](_0x5b73d2[_0x10c7('0x2d')],_0x5b73d2[_0x10c7('0x2f')]);_0x2712d4[_0x10c7('0x34')]=_['intersection'](_0x5b73d2[_0x10c7('0x2d')],qs['fields'](_0x1b0175['query']['fields']));_0x2712d4[_0x10c7('0x34')]=_0x2712d4['attributes']['length']?_0x2712d4['attributes']:_0x5b73d2[_0x10c7('0x2d')];if(_0x1b0175[_0x10c7('0x2f')][_0x10c7('0x40')]){_0x2712d4[_0x10c7('0x46')]=[{'all':!![]}];}_0x2712d4=_[_0x10c7('0x3e')]({},_0x2712d4,_0x1b0175[_0x10c7('0x3f')]);return db['ZohoField'][_0x10c7('0x47')](_0x2712d4)[_0x10c7('0x23')](handleEntityNotFound(_0xa79ce3,null))['then'](respondWithResult(_0xa79ce3,null))[_0x10c7('0x43')](handleError(_0xa79ce3,null));};exports[_0x10c7('0x48')]=function(_0x1d9331,_0x5039bb){return db[_0x10c7('0x49')][_0x10c7('0x48')](_0x1d9331[_0x10c7('0x4a')],{})[_0x10c7('0x23')](respondWithResult(_0x5039bb,0xc9))[_0x10c7('0x43')](handleError(_0x5039bb,null));};exports[_0x10c7('0x22')]=function(_0x2c204f,_0xeb2c86){if(_0x2c204f[_0x10c7('0x4a')]['id']){delete _0x2c204f[_0x10c7('0x4a')]['id'];}return db[_0x10c7('0x49')]['find']({'where':{'id':_0x2c204f[_0x10c7('0x45')]['id']}})[_0x10c7('0x23')](handleEntityNotFound(_0xeb2c86,null))['then'](saveUpdates(_0x2c204f[_0x10c7('0x4a')],null))[_0x10c7('0x23')](respondWithResult(_0xeb2c86,null))[_0x10c7('0x43')](handleError(_0xeb2c86,null));};exports[_0x10c7('0x24')]=function(_0x57a4fe,_0x1621f3){return db[_0x10c7('0x49')][_0x10c7('0x47')]({'where':{'id':_0x57a4fe[_0x10c7('0x45')]['id']}})[_0x10c7('0x23')](handleEntityNotFound(_0x1621f3,null))['then'](removeEntity(_0x1621f3,null))['catch'](handleError(_0x1621f3,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0c090ef..0188247 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 _0x1623=['zoho_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','path','./intZohoField.attributes','ZohoField','int_zoho_fields'];(function(_0x575b6f,_0x5a1f37){var _0x1dc254=function(_0x58d1ab){while(--_0x58d1ab){_0x575b6f['push'](_0x575b6f['shift']());}};_0x1dc254(++_0x5a1f37);}(_0x1623,0xab));var _0x3162=function(_0x47e401,_0x2b64a9){_0x47e401=_0x47e401-0x0;var _0x232d0e=_0x1623[_0x47e401];return _0x232d0e;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[{'name':_0x3162('0x9'),'fields':[_0x3162('0xa'),_0x3162('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['bluebird','request-promise','path','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x29bb73,_0x2afece){var _0xc2f389=function(_0x2c7b70){while(--_0x2c7b70){_0x29bb73['push'](_0x29bb73['shift']());}};_0xc2f389(++_0x2afece);}(_0xafc4,0x69));var _0x4afc=function(_0x57ba1b,_0x374ef2){_0x57ba1b=_0x57ba1b-0x0;var _0x29a979=_0xafc4[_0x57ba1b];return _0x29a979;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x4afc('0xa'),_0x4afc('0xb')],'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 f892aed..65b0128 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 _0xae27=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x179c89,_0x3a69b2){var _0x4b87e5=function(_0xbdf6f2){while(--_0xbdf6f2){_0x179c89['push'](_0x179c89['shift']());}};_0x4b87e5(++_0x3a69b2);}(_0xae27,0xa5));var _0x7ae2=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0xae27[_0x4d79bc];return _0x4b4760;};'use strict';var _=require(_0x7ae2('0x0'));var util=require('util');var moment=require(_0x7ae2('0x1'));var BPromise=require(_0x7ae2('0x2'));var rs=require(_0x7ae2('0x3'));var fs=require('fs');var Redis=require(_0x7ae2('0x4'));var db=require(_0x7ae2('0x5'))['db'];var utils=require(_0x7ae2('0x6'));var logger=require(_0x7ae2('0x7'))(_0x7ae2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ae2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9f16c9,_0x5ededd,_0x5ca0f6){return new BPromise(function(_0x43c2ed,_0x5706fb){return client[_0x7ae2('0xa')](_0x9f16c9,_0x5ca0f6)[_0x7ae2('0xb')](function(_0x371b5d){logger[_0x7ae2('0xc')](_0x7ae2('0xd'),_0x5ededd,_0x7ae2('0xe'));logger[_0x7ae2('0xf')](_0x7ae2('0x10'),_0x5ededd,_0x7ae2('0xe'),JSON[_0x7ae2('0x11')](_0x371b5d));if(_0x371b5d[_0x7ae2('0x12')]){if(_0x371b5d[_0x7ae2('0x12')][_0x7ae2('0x13')]===0x1f4){logger[_0x7ae2('0x12')](_0x7ae2('0xd'),_0x5ededd,_0x371b5d[_0x7ae2('0x12')][_0x7ae2('0x14')]);return _0x5706fb(_0x371b5d[_0x7ae2('0x12')][_0x7ae2('0x14')]);}logger['error'](_0x7ae2('0xd'),_0x5ededd,_0x371b5d['error'][_0x7ae2('0x14')]);return _0x43c2ed(_0x371b5d[_0x7ae2('0x12')]['message']);}else{logger[_0x7ae2('0xc')](_0x7ae2('0xd'),_0x5ededd,_0x7ae2('0xe'));_0x43c2ed(_0x371b5d[_0x7ae2('0x15')][_0x7ae2('0x14')]);}})[_0x7ae2('0x16')](function(_0x31be43){logger['error'](_0x7ae2('0xd'),_0x5ededd,_0x31be43);_0x5706fb(_0x31be43);});});} \ No newline at end of file +var _0x1025=['request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x1025,0x1ef));var _0x5102=function(_0xa277de,_0x2ad712){_0xa277de=_0xa277de-0x0;var _0x27c2da=_0x1025[_0xa277de];return _0x27c2da;};'use strict';var _=require(_0x5102('0x0'));var util=require('util');var moment=require(_0x5102('0x1'));var BPromise=require(_0x5102('0x2'));var rs=require(_0x5102('0x3'));var fs=require('fs');var Redis=require(_0x5102('0x4'));var db=require(_0x5102('0x5'))['db'];var utils=require(_0x5102('0x6'));var logger=require('../../config/logger')(_0x5102('0x7'));var config=require(_0x5102('0x8'));var jayson=require(_0x5102('0x9'));var client=jayson['client'][_0x5102('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x390e04,_0x21fb22,_0x30aa25){return new BPromise(function(_0x45fe1f,_0x3024ee){return client[_0x5102('0xb')](_0x390e04,_0x30aa25)[_0x5102('0xc')](function(_0x4c5fa6){logger[_0x5102('0xd')](_0x5102('0xe'),_0x21fb22,'request\x20sent');logger[_0x5102('0xf')](_0x5102('0x10'),_0x21fb22,'request\x20sent',JSON['stringify'](_0x4c5fa6));if(_0x4c5fa6[_0x5102('0x11')]){if(_0x4c5fa6['error'][_0x5102('0x12')]===0x1f4){logger[_0x5102('0x11')](_0x5102('0xe'),_0x21fb22,_0x4c5fa6[_0x5102('0x11')][_0x5102('0x13')]);return _0x3024ee(_0x4c5fa6[_0x5102('0x11')][_0x5102('0x13')]);}logger['error'](_0x5102('0xe'),_0x21fb22,_0x4c5fa6[_0x5102('0x11')][_0x5102('0x13')]);return _0x45fe1f(_0x4c5fa6[_0x5102('0x11')][_0x5102('0x13')]);}else{logger['info'](_0x5102('0xe'),_0x21fb22,_0x5102('0x14'));_0x45fe1f(_0x4c5fa6[_0x5102('0x15')][_0x5102('0x13')]);}})[_0x5102('0x16')](function(_0xab239d){logger[_0x5102('0x11')](_0x5102('0xe'),_0x21fb22,_0xab239d);_0x3024ee(_0xab239d);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index cc8fda6..aa62567 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x59c1bd,_0x1247de){var _0x3246dc=function(_0x335757){while(--_0x335757){_0x59c1bd['push'](_0x59c1bd['shift']());}};_0x3246dc(++_0x1247de);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xcb91[_0xa148b7];return _0x51efd3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x37ffbd,_0x236a17){var _0x5104d0=function(_0xf957f7){while(--_0xf957f7){_0x37ffbd['push'](_0x37ffbd['shift']());}};_0x5104d0(++_0x236a17);}(_0xe706,0xa3));var _0x6e70=function(_0xa5c63f,_0x2aaaa8){_0xa5c63f=_0xa5c63f-0x0;var _0xf352b1=_0xe706[_0xa5c63f];return _0xf352b1;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 2b2df4a..216a60d 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 _0x5981=['exports','STRING','unique_name_and_version','app.js','INTEGER','state','sequelize'];(function(_0x423929,_0x1846be){var _0x466ba8=function(_0x5588d4){while(--_0x5588d4){_0x423929['push'](_0x423929['shift']());}};_0x466ba8(++_0x1846be);}(_0x5981,0xa7));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1598('0x0'));module[_0x1598('0x1')]={'name':{'type':Sequelize[_0x1598('0x2')],'allowNull':![],'unique':_0x1598('0x3')},'version':{'type':Sequelize[_0x1598('0x2')],'allowNull':![],'unique':_0x1598('0x3')},'main':{'type':Sequelize[_0x1598('0x2')],'defaultValue':_0x1598('0x4')},'filename':{'type':Sequelize[_0x1598('0x2')]},'path':{'type':Sequelize[_0x1598('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x1598('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x1598('0x2')]},'logo':{'type':Sequelize[_0x1598('0x2')]},'state':{'type':Sequelize[_0x1598('0x2')],'unique':_0x1598('0x6')},'description':{'type':Sequelize[_0x1598('0x2')]},'title':{'type':Sequelize[_0x1598('0x2')]},'remoteUri':{'type':Sequelize[_0x1598('0x2')]},'link':{'type':Sequelize[_0x1598('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x1b81=['app.js','INTEGER','exports','STRING','unique_name_and_version'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0x1b81,0x124));var _0x11b8=function(_0x1fb0a,_0x58b76b){_0x1fb0a=_0x1fb0a-0x0;var _0xf302d1=_0x1b81[_0x1fb0a];return _0xf302d1;};'use strict';var Sequelize=require('sequelize');module[_0x11b8('0x0')]={'name':{'type':Sequelize[_0x11b8('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x11b8('0x1')],'allowNull':![],'unique':_0x11b8('0x2')},'main':{'type':Sequelize[_0x11b8('0x1')],'defaultValue':_0x11b8('0x3')},'filename':{'type':Sequelize[_0x11b8('0x1')]},'path':{'type':Sequelize[_0x11b8('0x1')]},'type':{'type':Sequelize[_0x11b8('0x1')]},'size':{'type':Sequelize[_0x11b8('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x11b8('0x1')]},'logo':{'type':Sequelize[_0x11b8('0x1')]},'state':{'type':Sequelize[_0x11b8('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x11b8('0x1')]},'title':{'type':Sequelize[_0x11b8('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x11b8('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 2c9abfc..424cb3d 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 _0xc2c7=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2c7,0x134));var _0x7c2c=function(_0x163230,_0x5d1994){_0x163230=_0x163230-0x0;var _0x49089e=_0xc2c7[_0x163230];return _0x49089e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['Integration'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['Integration'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));}; \ No newline at end of file +var _0x4c60=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','Integration','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x4c60,0xc1));var _0x04c6=function(_0x2c2bd8,_0x5586bc){_0x2c2bd8=_0x2c2bd8-0x0;var _0x74d971=_0x4c60[_0x2c2bd8];return _0x74d971;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['Integration'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['Integration'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['Integration'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['Integration'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['Integration'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0fc7cf5..032f65d 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 _0x0633=['define','Integration','lodash','api','moment','request-promise','path','rimraf','./integration.attributes','exports'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x0633,0xd4));var _0x3063=function(_0x5030e9,_0x5d70b2){_0x5030e9=_0x5030e9-0x0;var _0x446e4a=_0x0633[_0x5030e9];return _0x446e4a;};'use strict';var _=require(_0x3063('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3063('0x1'));var moment=require(_0x3063('0x2'));var BPromise=require('bluebird');var rp=require(_0x3063('0x3'));var fs=require('fs');var path=require(_0x3063('0x4'));var rimraf=require(_0x3063('0x5'));var config=require('../../config/environment');var attributes=require(_0x3063('0x6'));module[_0x3063('0x7')]=function(_0x5b18fa,_0x1fac87){return _0x5b18fa[_0x3063('0x8')](_0x3063('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27e8=['Integration','integrations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0x27e8,0xd2));var _0x827e=function(_0x29d49e,_0x1430c7){_0x29d49e=_0x29d49e-0x0;var _0x528bff=_0x27e8[_0x29d49e];return _0x528bff;};'use strict';var _=require(_0x827e('0x0'));var util=require('util');var logger=require(_0x827e('0x1'))(_0x827e('0x2'));var moment=require(_0x827e('0x3'));var BPromise=require(_0x827e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x827e('0x5'));var rimraf=require(_0x827e('0x6'));var config=require(_0x827e('0x7'));var attributes=require(_0x827e('0x8'));module[_0x827e('0x9')]=function(_0x3463a4,_0x3af024){return _0x3463a4[_0x827e('0xa')](_0x827e('0xb'),attributes,{'tableName':_0x827e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index a87866e..e3af6b8 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 _0x955f=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x375ab5,_0x5332be){var _0x270ab6=function(_0x13e76b){while(--_0x13e76b){_0x375ab5['push'](_0x375ab5['shift']());}};_0x270ab6(++_0x5332be);}(_0x955f,0x1eb));var _0xf955=function(_0x2b8417,_0x1ce4b8){_0x2b8417=_0x2b8417-0x0;var _0x2cec5c=_0x955f[_0x2b8417];return _0x2cec5c;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('Integration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file +var _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x19562d,_0x2a77ab){var _0x396e97=function(_0x1734fe){while(--_0x1734fe){_0x19562d['push'](_0x19562d['shift']());}};_0x396e97(++_0x2a77ab);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4320c3,_0x5f0185){_0x4320c3=_0x4320c3-0x0;var _0x2433c7=_0x9f0e[_0x4320c3];return _0x2433c7;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 446b8c7..d5157ce 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 _0x896e=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x896e,0x1e9));var _0xe896=function(_0x288662,_0x1ff124){_0x288662=_0x288662-0x0;var _0x24c01e=_0x896e[_0x288662];return _0x24c01e;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['post']('/',auth[_0xe896('0xe')](),controller['create']);router[_0xe896('0x12')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x13')]);router[_0xe896('0x14')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);module[_0xe896('0x16')]=router; \ No newline at end of file +var _0x66fa=['index','get','/describe','post','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x39f794,_0x212dc5){var _0x180134=function(_0x1b6401){while(--_0x1b6401){_0x39f794['push'](_0x39f794['shift']());}};_0x180134(++_0x212dc5);}(_0x66fa,0x117));var _0xa66f=function(_0xd2ed63,_0x432465){_0xd2ed63=_0xd2ed63-0x0;var _0x36e128=_0x66fa[_0xd2ed63];return _0x36e128;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xe'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xf')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0x10')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index ed184bf..e6529da 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 _0x0c9f=['INTEGER','BOOLEAN','DATE','TEXT','ENUM','SENT','FAILED','sequelize','exports','STRING'];(function(_0x92354d,_0xcbd1ac){var _0x57f449=function(_0x19658f){while(--_0x19658f){_0x92354d['push'](_0x92354d['shift']());}};_0x57f449(++_0xcbd1ac);}(_0x0c9f,0x183));var _0xf0c9=function(_0x508532,_0x39546c){_0x508532=_0x508532-0x0;var _0x280fc7=_0x0c9f[_0x508532];return _0x280fc7;};'use strict';var Sequelize=require(_0xf0c9('0x0'));module[_0xf0c9('0x1')]={'integration':{'type':Sequelize[_0xf0c9('0x2')]},'eventChannel':{'type':Sequelize[_0xf0c9('0x2')]},'exitStatus':{'type':Sequelize[_0xf0c9('0x2')]},'ticketId':{'type':Sequelize[_0xf0c9('0x2')]},'integrationId':{'type':Sequelize[_0xf0c9('0x3')]},'contacts':{'type':Sequelize[_0xf0c9('0x2')]},'uniqueid':{'type':Sequelize[_0xf0c9('0x2')]},'calleridnum':{'type':Sequelize[_0xf0c9('0x2')]},'calleridname':{'type':Sequelize[_0xf0c9('0x2')]},'queue':{'type':Sequelize[_0xf0c9('0x2')]},'interface':{'type':Sequelize[_0xf0c9('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf0c9('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf0c9('0x5')]},'talktime':{'type':Sequelize[_0xf0c9('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xf0c9('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf0c9('0x5')]},'agentdump':{'type':Sequelize[_0xf0c9('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf0c9('0x5')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf0c9('0x2')]},'channelstate':{'type':Sequelize[_0xf0c9('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf0c9('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf0c9('0x2')]},'connectedlinename':{'type':Sequelize[_0xf0c9('0x2')]},'language':{'type':Sequelize[_0xf0c9('0x2')]},'accountcode':{'type':Sequelize[_0xf0c9('0x2')]},'context':{'type':Sequelize[_0xf0c9('0x2')]},'exten':{'type':Sequelize[_0xf0c9('0x2')]},'priority':{'type':Sequelize[_0xf0c9('0x2')]},'destchannel':{'type':Sequelize[_0xf0c9('0x2')]},'destchannelstate':{'type':Sequelize[_0xf0c9('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf0c9('0x2')]},'destcalleridname':{'type':Sequelize[_0xf0c9('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xf0c9('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xf0c9('0x2')]},'destcontext':{'type':Sequelize[_0xf0c9('0x2')]},'destexten':{'type':Sequelize[_0xf0c9('0x2')]},'destpriority':{'type':Sequelize[_0xf0c9('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xf0c9('0x2')]},'inReplyTo':{'type':Sequelize[_0xf0c9('0x2')]},'subject':{'type':Sequelize[_0xf0c9('0x2')]},'from':{'type':Sequelize[_0xf0c9('0x2')]},'to':{'type':Sequelize[_0xf0c9('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xf0c9('0x6')]},'html':{'type':Sequelize[_0xf0c9('0x6')]},'text':{'type':Sequelize[_0xf0c9('0x6')]},'status':{'type':Sequelize[_0xf0c9('0x7')](_0xf0c9('0x8'),'SENDING','RECEIVED',_0xf0c9('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xf0c9('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xf0c9('0x3')]}}; \ No newline at end of file +var _0xd995=['TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x535c96,_0x39e449){var _0x568db0=function(_0x19a517){while(--_0x19a517){_0x535c96['push'](_0x535c96['shift']());}};_0x568db0(++_0x39e449);}(_0xd995,0x18b));var _0x5d99=function(_0x5d69d2,_0x155523){_0x5d69d2=_0x5d69d2-0x0;var _0x351133=_0xd995[_0x5d69d2];return _0x351133;};'use strict';var Sequelize=require(_0x5d99('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x5d99('0x1')]},'exitStatus':{'type':Sequelize[_0x5d99('0x1')]},'ticketId':{'type':Sequelize[_0x5d99('0x1')]},'integrationId':{'type':Sequelize[_0x5d99('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5d99('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5d99('0x1')]},'queue':{'type':Sequelize[_0x5d99('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5d99('0x1')]},'agentcalledAt':{'type':Sequelize[_0x5d99('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5d99('0x3')]},'holdtime':{'type':Sequelize[_0x5d99('0x2')]},'agentcomplete':{'type':Sequelize[_0x5d99('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x5d99('0x2')]},'agentacw':{'type':Sequelize[_0x5d99('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5d99('0x2')]},'reason':{'type':Sequelize[_0x5d99('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x5d99('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5d99('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5d99('0x3')]},'lastevent':{'type':Sequelize[_0x5d99('0x1')]},'channel':{'type':Sequelize[_0x5d99('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5d99('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5d99('0x1')]},'connectedlinename':{'type':Sequelize[_0x5d99('0x1')]},'language':{'type':Sequelize[_0x5d99('0x1')]},'accountcode':{'type':Sequelize[_0x5d99('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5d99('0x1')]},'priority':{'type':Sequelize[_0x5d99('0x1')]},'destchannel':{'type':Sequelize[_0x5d99('0x1')]},'destchannelstate':{'type':Sequelize[_0x5d99('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x5d99('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x5d99('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x5d99('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x5d99('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5d99('0x1')]},'destpriority':{'type':Sequelize[_0x5d99('0x1')]},'destuniqueid':{'type':Sequelize[_0x5d99('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x5d99('0x1')]},'subject':{'type':Sequelize[_0x5d99('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x5d99('0x1')]},'cc':{'type':Sequelize[_0x5d99('0x1')]},'attachment':{'type':Sequelize[_0x5d99('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x5d99('0x5')]},'status':{'type':Sequelize[_0x5d99('0x6')](_0x5d99('0x7'),'SENDING',_0x5d99('0x8'),_0x5d99('0x9'))},'url':{'type':Sequelize[_0x5d99('0x1')]},'app':{'type':Sequelize[_0x5d99('0x1')]},'appdata':{'type':Sequelize[_0x5d99('0x1')]},'projectId':{'type':Sequelize[_0x5d99('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 01d4eb7..3ee1d0f 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 _0xe72e=['util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','IntegrationReport','rawAttributes','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x42146d,_0x5daba1){var _0x354548=function(_0x4cc1bb){while(--_0x4cc1bb){_0x42146d['push'](_0x42146d['shift']());}};_0x354548(++_0x5daba1);}(_0xe72e,0x16f));var _0xee72=function(_0x47678c,_0x4a41b7){_0x47678c=_0x47678c-0x0;var _0x24603c=_0xe72e[_0x47678c];return _0x24603c;};'use strict';var emlformat=require(_0xee72('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee72('0x1'));var jsonpatch=require(_0xee72('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee72('0x3'));var path=require(_0xee72('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xee72('0x5'));var fs=require('fs');var fs_extra=require(_0xee72('0x6'));var _=require(_0xee72('0x7'));var squel=require(_0xee72('0x8'));var crypto=require(_0xee72('0x9'));var jsforce=require(_0xee72('0xa'));var deskjs=require(_0xee72('0xb'));var toCsv=require('to-csv');var querystring=require(_0xee72('0xc'));var Papa=require(_0xee72('0xd'));var Redis=require(_0xee72('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xee72('0xf'));var as=require(_0xee72('0x10'));var hardwareService=require(_0xee72('0x11'));var logger=require(_0xee72('0x12'))('api');var utils=require(_0xee72('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xee72('0x14'));var db=require(_0xee72('0x15'))['db'];function respondWithStatusCode(_0x1babb6,_0x5bde5b){_0x5bde5b=_0x5bde5b||0xcc;return function(_0x4ae661){if(_0x4ae661){return _0x1babb6['sendStatus'](_0x5bde5b);}return _0x1babb6[_0xee72('0x16')](_0x5bde5b)[_0xee72('0x17')]();};}function respondWithResult(_0x2a74d2,_0x16e3a3){_0x16e3a3=_0x16e3a3||0xc8;return function(_0x39508a){if(_0x39508a){return _0x2a74d2['status'](_0x16e3a3)['json'](_0x39508a);}};}function respondWithFilteredResult(_0x2b4cfb,_0x291eeb){return function(_0x490088){if(_0x490088){var _0x1c0edb=typeof _0x291eeb[_0xee72('0x18')]===_0xee72('0x19')&&typeof _0x291eeb[_0xee72('0x1a')]==='undefined';var _0x4ba896=_0x490088['count'];var _0x738235=_0x1c0edb?0x0:_0x291eeb[_0xee72('0x18')];var _0x2c3a61=_0x1c0edb?_0x490088[_0xee72('0x1b')]:_0x291eeb[_0xee72('0x18')]+_0x291eeb[_0xee72('0x1a')];var _0x58abd3;if(_0x2c3a61>=_0x4ba896){_0x2c3a61=_0x4ba896;_0x58abd3=0xc8;}else{_0x58abd3=0xce;}_0x2b4cfb['status'](_0x58abd3);return _0x2b4cfb['set'](_0xee72('0x1c'),_0x738235+'-'+_0x2c3a61+'/'+_0x4ba896)['json'](_0x490088);}return null;};}function patchUpdates(_0x557f06){return function(_0xe35621){try{jsonpatch[_0xee72('0x1d')](_0xe35621,_0x557f06,!![]);}catch(_0x1715a1){return BPromise[_0xee72('0x1e')](_0x1715a1);}return _0xe35621[_0xee72('0x1f')]();};}function saveUpdates(_0x455d6b,_0x519316){return function(_0x2b13e6){if(_0x2b13e6){return _0x2b13e6[_0xee72('0x20')](_0x455d6b)['then'](function(_0x292b3c){return _0x292b3c;});}return null;};}function removeEntity(_0x16471a,_0x158322){return function(_0x45797c){if(_0x45797c){return _0x45797c[_0xee72('0x21')]()[_0xee72('0x22')](function(){_0x16471a['status'](0xcc)[_0xee72('0x17')]();});}};}function handleEntityNotFound(_0x320f1d,_0xa0db10){return function(_0x2d7004){if(!_0x2d7004){_0x320f1d[_0xee72('0x23')](0x194);}return _0x2d7004;};}function handleError(_0x162f77,_0x347b86){_0x347b86=_0x347b86||0x1f4;return function(_0x4e0a94){logger[_0xee72('0x24')](_0x4e0a94[_0xee72('0x25')]);if(_0x4e0a94[_0xee72('0x26')]){delete _0x4e0a94[_0xee72('0x26')];}_0x162f77[_0xee72('0x16')](_0x347b86)[_0xee72('0x27')](_0x4e0a94);};}exports[_0xee72('0x28')]=function(_0x15f895,_0x38b68a){var _0x403b61={},_0x1e9bb3={},_0x25b803={'count':0x0,'rows':[]};var _0x126cd9=_[_0xee72('0x29')](db[_0xee72('0x2a')][_0xee72('0x2b')],function(_0xbeb7ba){return{'name':_0xbeb7ba['fieldName'],'type':_0xbeb7ba['type'][_0xee72('0x2c')]};});_0x1e9bb3[_0xee72('0x2d')]=_[_0xee72('0x29')](_0x126cd9,'name');_0x1e9bb3['query']=_[_0xee72('0x2e')](_0x15f895[_0xee72('0x2f')]);_0x1e9bb3['filters']=_[_0xee72('0x30')](_0x1e9bb3[_0xee72('0x2d')],_0x1e9bb3[_0xee72('0x2f')]);_0x403b61[_0xee72('0x31')]=_['intersection'](_0x1e9bb3[_0xee72('0x2d')],qs[_0xee72('0x32')](_0x15f895['query'][_0xee72('0x32')]));_0x403b61[_0xee72('0x31')]=_0x403b61['attributes']['length']?_0x403b61[_0xee72('0x31')]:_0x1e9bb3[_0xee72('0x2d')];if(!_0x15f895[_0xee72('0x2f')][_0xee72('0x33')](_0xee72('0x34'))){_0x403b61[_0xee72('0x1a')]=qs[_0xee72('0x1a')](_0x15f895[_0xee72('0x2f')][_0xee72('0x1a')]);_0x403b61[_0xee72('0x18')]=qs['offset'](_0x15f895['query'][_0xee72('0x18')]);}_0x403b61['order']=qs[_0xee72('0x35')](_0x15f895[_0xee72('0x2f')][_0xee72('0x35')]);_0x403b61[_0xee72('0x36')]=qs[_0xee72('0x37')](_[_0xee72('0x38')](_0x15f895[_0xee72('0x2f')],_0x1e9bb3['filters']),_0x126cd9);if(_0x15f895[_0xee72('0x2f')][_0xee72('0x39')]){_0x403b61[_0xee72('0x36')]=_['merge'](_0x403b61[_0xee72('0x36')],{'$or':_['map'](_0x126cd9,function(_0x1efc73){if(_0x1efc73[_0xee72('0x3a')]!==_0xee72('0x3b')){var _0x5107e7={};_0x5107e7[_0x1efc73[_0xee72('0x26')]]={'$like':'%'+_0x15f895[_0xee72('0x2f')]['filter']+'%'};return _0x5107e7;}})});}_0x403b61=_[_0xee72('0x3c')]({},_0x403b61,_0x15f895[_0xee72('0x3d')]);var _0x5a3234={'where':_0x403b61[_0xee72('0x36')]};return db[_0xee72('0x2a')][_0xee72('0x1b')](_0x5a3234)[_0xee72('0x22')](function(_0x43f56a){_0x25b803['count']=_0x43f56a;if(_0x15f895[_0xee72('0x2f')]['includeAll']){_0x403b61[_0xee72('0x3e')]=[{'all':!![]}];}return db[_0xee72('0x2a')][_0xee72('0x3f')](_0x403b61);})[_0xee72('0x22')](function(_0x59bd4b){_0x25b803[_0xee72('0x40')]=_0x59bd4b;return _0x25b803;})['then'](respondWithFilteredResult(_0x38b68a,_0x403b61))[_0xee72('0x41')](handleError(_0x38b68a,null));};exports[_0xee72('0x42')]=function(_0x381b59,_0x1f00ed){var _0x43df3a={'raw':![],'where':{'id':_0x381b59[_0xee72('0x43')]['id']}},_0x56d28d={};_0x56d28d['model']=_[_0xee72('0x2e')](db[_0xee72('0x2a')][_0xee72('0x2b')]);_0x56d28d['query']=_[_0xee72('0x2e')](_0x381b59[_0xee72('0x2f')]);_0x56d28d[_0xee72('0x37')]=_['intersection'](_0x56d28d[_0xee72('0x2d')],_0x56d28d[_0xee72('0x2f')]);_0x43df3a['attributes']=_[_0xee72('0x30')](_0x56d28d[_0xee72('0x2d')],qs[_0xee72('0x32')](_0x381b59[_0xee72('0x2f')]['fields']));_0x43df3a['attributes']=_0x43df3a['attributes'][_0xee72('0x44')]?_0x43df3a[_0xee72('0x31')]:_0x56d28d['model'];if(_0x381b59[_0xee72('0x2f')][_0xee72('0x45')]){_0x43df3a[_0xee72('0x3e')]=[{'all':!![]}];}_0x43df3a=_[_0xee72('0x3c')]({},_0x43df3a,_0x381b59[_0xee72('0x3d')]);return db['IntegrationReport']['find'](_0x43df3a)['then'](handleEntityNotFound(_0x1f00ed,null))[_0xee72('0x22')](respondWithResult(_0x1f00ed,null))['catch'](handleError(_0x1f00ed,null));};exports['create']=function(_0x595b30,_0x49fdcd){return db[_0xee72('0x2a')][_0xee72('0x46')](_0x595b30[_0xee72('0x47')],{})[_0xee72('0x22')](respondWithResult(_0x49fdcd,0xc9))['catch'](handleError(_0x49fdcd,null));};exports[_0xee72('0x20')]=function(_0x55eb89,_0xdf5c82){if(_0x55eb89[_0xee72('0x47')]['id']){delete _0x55eb89[_0xee72('0x47')]['id'];}return db['IntegrationReport'][_0xee72('0x48')]({'where':{'id':_0x55eb89['params']['id']}})['then'](handleEntityNotFound(_0xdf5c82,null))['then'](saveUpdates(_0x55eb89[_0xee72('0x47')],null))['then'](respondWithResult(_0xdf5c82,null))[_0xee72('0x41')](handleError(_0xdf5c82,null));};exports[_0xee72('0x21')]=function(_0x28ac30,_0x38f8e7){return db[_0xee72('0x2a')][_0xee72('0x48')]({'where':{'id':_0x28ac30[_0xee72('0x43')]['id']}})[_0xee72('0x22')](handleEntityNotFound(_0x38f8e7,null))[_0xee72('0x22')](removeEntity(_0x38f8e7,null))['catch'](handleError(_0x38f8e7,null));};exports[_0xee72('0x49')]=function(_0x5d25b1,_0x38c319){return db[_0xee72('0x2a')][_0xee72('0x49')]()[_0xee72('0x22')](respondWithResult(_0x38c319,null))[_0xee72('0x41')](handleError(_0x38c319,null));}; \ No newline at end of file +var _0x7137=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','error','stack','name','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','IntegrationReport','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x49eed1,_0x334fa0){var _0x51eda0=function(_0x3611a4){while(--_0x3611a4){_0x49eed1['push'](_0x49eed1['shift']());}};_0x51eda0(++_0x334fa0);}(_0x7137,0xc4));var _0x7713=function(_0x11d3bc,_0x46a8b2){_0x11d3bc=_0x11d3bc-0x0;var _0x114a67=_0x7137[_0x11d3bc];return _0x114a67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7713('0x0'));var zipdir=require(_0x7713('0x1'));var jsonpatch=require(_0x7713('0x2'));var rp=require(_0x7713('0x3'));var moment=require(_0x7713('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7713('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7713('0x6'));var ejs=require(_0x7713('0x7'));var fs=require('fs');var fs_extra=require(_0x7713('0x8'));var _=require(_0x7713('0x9'));var squel=require(_0x7713('0xa'));var crypto=require(_0x7713('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7713('0xc'));var toCsv=require(_0x7713('0x6'));var querystring=require(_0x7713('0xd'));var Papa=require('papaparse');var Redis=require(_0x7713('0xe'));var authService=require(_0x7713('0xf'));var qs=require(_0x7713('0x10'));var as=require(_0x7713('0x11'));var hardwareService=require(_0x7713('0x12'));var logger=require(_0x7713('0x13'))('api');var utils=require(_0x7713('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7713('0x15'));var db=require(_0x7713('0x16'))['db'];function respondWithStatusCode(_0x30112c,_0x5ad748){_0x5ad748=_0x5ad748||0xcc;return function(_0x4ff6a7){if(_0x4ff6a7){return _0x30112c[_0x7713('0x17')](_0x5ad748);}return _0x30112c['status'](_0x5ad748)[_0x7713('0x18')]();};}function respondWithResult(_0xbfa2f9,_0x45073d){_0x45073d=_0x45073d||0xc8;return function(_0x4cb0ee){if(_0x4cb0ee){return _0xbfa2f9[_0x7713('0x19')](_0x45073d)[_0x7713('0x1a')](_0x4cb0ee);}};}function respondWithFilteredResult(_0x5b632f,_0x55358d){return function(_0xddc3c2){if(_0xddc3c2){var _0x5d6b3d=typeof _0x55358d[_0x7713('0x1b')]===_0x7713('0x1c')&&typeof _0x55358d['limit']==='undefined';var _0x593733=_0xddc3c2['count'];var _0x272fd8=_0x5d6b3d?0x0:_0x55358d[_0x7713('0x1b')];var _0x312877=_0x5d6b3d?_0xddc3c2[_0x7713('0x1d')]:_0x55358d[_0x7713('0x1b')]+_0x55358d[_0x7713('0x1e')];var _0x3f264b;if(_0x312877>=_0x593733){_0x312877=_0x593733;_0x3f264b=0xc8;}else{_0x3f264b=0xce;}_0x5b632f[_0x7713('0x19')](_0x3f264b);return _0x5b632f['set'](_0x7713('0x1f'),_0x272fd8+'-'+_0x312877+'/'+_0x593733)[_0x7713('0x1a')](_0xddc3c2);}return null;};}function patchUpdates(_0x401c74){return function(_0x3f9c7c){try{jsonpatch[_0x7713('0x20')](_0x3f9c7c,_0x401c74,!![]);}catch(_0x546051){return BPromise[_0x7713('0x21')](_0x546051);}return _0x3f9c7c['save']();};}function saveUpdates(_0x247312,_0xfad84){return function(_0x27a7e3){if(_0x27a7e3){return _0x27a7e3[_0x7713('0x22')](_0x247312)[_0x7713('0x23')](function(_0xbf94eb){return _0xbf94eb;});}return null;};}function removeEntity(_0x1d639d,_0x2c3915){return function(_0x3889d2){if(_0x3889d2){return _0x3889d2['destroy']()[_0x7713('0x23')](function(){_0x1d639d[_0x7713('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x357500,_0x21960c){return function(_0x400247){if(!_0x400247){_0x357500[_0x7713('0x17')](0x194);}return _0x400247;};}function handleError(_0x377b56,_0x4dbd38){_0x4dbd38=_0x4dbd38||0x1f4;return function(_0x5c5f81){logger[_0x7713('0x24')](_0x5c5f81[_0x7713('0x25')]);if(_0x5c5f81[_0x7713('0x26')]){delete _0x5c5f81['name'];}_0x377b56[_0x7713('0x19')](_0x4dbd38)['send'](_0x5c5f81);};}exports['index']=function(_0xcbc0c3,_0x512940){var _0x3638c9={},_0x2da272={},_0x46109d={'count':0x0,'rows':[]};var _0x5307c7=_[_0x7713('0x27')](db['IntegrationReport'][_0x7713('0x28')],function(_0xd0bf00){return{'name':_0xd0bf00[_0x7713('0x29')],'type':_0xd0bf00[_0x7713('0x2a')]['key']};});_0x2da272[_0x7713('0x2b')]=_[_0x7713('0x27')](_0x5307c7,_0x7713('0x26'));_0x2da272['query']=_[_0x7713('0x2c')](_0xcbc0c3[_0x7713('0x2d')]);_0x2da272['filters']=_[_0x7713('0x2e')](_0x2da272[_0x7713('0x2b')],_0x2da272[_0x7713('0x2d')]);_0x3638c9[_0x7713('0x2f')]=_['intersection'](_0x2da272[_0x7713('0x2b')],qs[_0x7713('0x30')](_0xcbc0c3[_0x7713('0x2d')][_0x7713('0x30')]));_0x3638c9[_0x7713('0x2f')]=_0x3638c9[_0x7713('0x2f')][_0x7713('0x31')]?_0x3638c9[_0x7713('0x2f')]:_0x2da272['model'];if(!_0xcbc0c3['query'][_0x7713('0x32')](_0x7713('0x33'))){_0x3638c9[_0x7713('0x1e')]=qs[_0x7713('0x1e')](_0xcbc0c3[_0x7713('0x2d')][_0x7713('0x1e')]);_0x3638c9['offset']=qs[_0x7713('0x1b')](_0xcbc0c3['query'][_0x7713('0x1b')]);}_0x3638c9['order']=qs['sort'](_0xcbc0c3[_0x7713('0x2d')][_0x7713('0x34')]);_0x3638c9['where']=qs[_0x7713('0x35')](_[_0x7713('0x36')](_0xcbc0c3['query'],_0x2da272[_0x7713('0x35')]),_0x5307c7);if(_0xcbc0c3[_0x7713('0x2d')][_0x7713('0x37')]){_0x3638c9[_0x7713('0x38')]=_[_0x7713('0x39')](_0x3638c9[_0x7713('0x38')],{'$or':_[_0x7713('0x27')](_0x5307c7,function(_0x5c4797){if(_0x5c4797[_0x7713('0x2a')]!==_0x7713('0x3a')){var _0x1a22b4={};_0x1a22b4[_0x5c4797[_0x7713('0x26')]]={'$like':'%'+_0xcbc0c3[_0x7713('0x2d')][_0x7713('0x37')]+'%'};return _0x1a22b4;}})});}_0x3638c9=_[_0x7713('0x39')]({},_0x3638c9,_0xcbc0c3['options']);var _0x35bb1a={'where':_0x3638c9[_0x7713('0x38')]};return db['IntegrationReport'][_0x7713('0x1d')](_0x35bb1a)[_0x7713('0x23')](function(_0x1d4614){_0x46109d['count']=_0x1d4614;if(_0xcbc0c3[_0x7713('0x2d')]['includeAll']){_0x3638c9['include']=[{'all':!![]}];}return db[_0x7713('0x3b')][_0x7713('0x3c')](_0x3638c9);})[_0x7713('0x23')](function(_0x309569){_0x46109d[_0x7713('0x3d')]=_0x309569;return _0x46109d;})[_0x7713('0x23')](respondWithFilteredResult(_0x512940,_0x3638c9))[_0x7713('0x3e')](handleError(_0x512940,null));};exports[_0x7713('0x3f')]=function(_0x3ff478,_0xd415d3){var _0x19e6ce={'raw':![],'where':{'id':_0x3ff478[_0x7713('0x40')]['id']}},_0x2f3a4c={};_0x2f3a4c['model']=_['keys'](db[_0x7713('0x3b')][_0x7713('0x28')]);_0x2f3a4c['query']=_['keys'](_0x3ff478[_0x7713('0x2d')]);_0x2f3a4c[_0x7713('0x35')]=_[_0x7713('0x2e')](_0x2f3a4c[_0x7713('0x2b')],_0x2f3a4c[_0x7713('0x2d')]);_0x19e6ce[_0x7713('0x2f')]=_[_0x7713('0x2e')](_0x2f3a4c[_0x7713('0x2b')],qs[_0x7713('0x30')](_0x3ff478[_0x7713('0x2d')]['fields']));_0x19e6ce[_0x7713('0x2f')]=_0x19e6ce['attributes'][_0x7713('0x31')]?_0x19e6ce[_0x7713('0x2f')]:_0x2f3a4c[_0x7713('0x2b')];if(_0x3ff478[_0x7713('0x2d')]['includeAll']){_0x19e6ce[_0x7713('0x41')]=[{'all':!![]}];}_0x19e6ce=_[_0x7713('0x39')]({},_0x19e6ce,_0x3ff478['options']);return db[_0x7713('0x3b')][_0x7713('0x42')](_0x19e6ce)[_0x7713('0x23')](handleEntityNotFound(_0xd415d3,null))[_0x7713('0x23')](respondWithResult(_0xd415d3,null))['catch'](handleError(_0xd415d3,null));};exports[_0x7713('0x43')]=function(_0x7bf9da,_0x38dab0){return db[_0x7713('0x3b')]['create'](_0x7bf9da[_0x7713('0x44')],{})[_0x7713('0x23')](respondWithResult(_0x38dab0,0xc9))[_0x7713('0x3e')](handleError(_0x38dab0,null));};exports['update']=function(_0x3d4253,_0x2af062){if(_0x3d4253[_0x7713('0x44')]['id']){delete _0x3d4253['body']['id'];}return db['IntegrationReport'][_0x7713('0x42')]({'where':{'id':_0x3d4253[_0x7713('0x40')]['id']}})['then'](handleEntityNotFound(_0x2af062,null))[_0x7713('0x23')](saveUpdates(_0x3d4253[_0x7713('0x44')],null))[_0x7713('0x23')](respondWithResult(_0x2af062,null))[_0x7713('0x3e')](handleError(_0x2af062,null));};exports[_0x7713('0x45')]=function(_0x3489cf,_0x5497e9){return db[_0x7713('0x3b')][_0x7713('0x42')]({'where':{'id':_0x3489cf[_0x7713('0x40')]['id']}})[_0x7713('0x23')](handleEntityNotFound(_0x5497e9,null))[_0x7713('0x23')](removeEntity(_0x5497e9,null))['catch'](handleError(_0x5497e9,null));};exports[_0x7713('0x46')]=function(_0x15c160,_0x427c11){return db['IntegrationReport'][_0x7713('0x46')]()[_0x7713('0x23')](respondWithResult(_0x427c11,null))[_0x7713('0x3e')](handleError(_0x427c11,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c9fab8c..d81fba4 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 _0x31c0=['util','../../config/logger','api','moment','request-promise','path','rimraf','./integrationReport.attributes','exports','IntegrationReport','lodash'];(function(_0x253b37,_0xdb7ae0){var _0x24b147=function(_0x38c58d){while(--_0x38c58d){_0x253b37['push'](_0x253b37['shift']());}};_0x24b147(++_0xdb7ae0);}(_0x31c0,0xa4));var _0x031c=function(_0x3ae192,_0x4f5f22){_0x3ae192=_0x3ae192-0x0;var _0x2cc787=_0x31c0[_0x3ae192];return _0x2cc787;};'use strict';var _=require(_0x031c('0x0'));var util=require(_0x031c('0x1'));var logger=require(_0x031c('0x2'))(_0x031c('0x3'));var moment=require(_0x031c('0x4'));var BPromise=require('bluebird');var rp=require(_0x031c('0x5'));var fs=require('fs');var path=require(_0x031c('0x6'));var rimraf=require(_0x031c('0x7'));var config=require('../../config/environment');var attributes=require(_0x031c('0x8'));module[_0x031c('0x9')]=function(_0x184a8a,_0x3dae36){return _0x184a8a['define'](_0x031c('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf0e=['request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','api','moment'];(function(_0x1da558,_0x14c9d8){var _0x5b7c3e=function(_0x1bb0fa){while(--_0x1bb0fa){_0x1da558['push'](_0x1da558['shift']());}};_0x5b7c3e(++_0x14c9d8);}(_0xbf0e,0xa5));var _0xebf0=function(_0x14d7d9,_0x440f9b){_0x14d7d9=_0x14d7d9-0x0;var _0x4f0c52=_0xbf0e[_0x14d7d9];return _0x4f0c52;};'use strict';var _=require(_0xebf0('0x0'));var util=require(_0xebf0('0x1'));var logger=require('../../config/logger')(_0xebf0('0x2'));var moment=require(_0xebf0('0x3'));var BPromise=require('bluebird');var rp=require(_0xebf0('0x4'));var fs=require('fs');var path=require(_0xebf0('0x5'));var rimraf=require(_0xebf0('0x6'));var config=require(_0xebf0('0x7'));var attributes=require(_0xebf0('0x8'));module[_0xebf0('0x9')]=function(_0x39185e,_0x38c02f){return _0x39185e[_0xebf0('0xa')](_0xebf0('0xb'),attributes,{'tableName':_0xebf0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 547b2ce..549acb2 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1ff6aa,_0x58798b){var _0xd41db7=function(_0x52d617){while(--_0x52d617){_0x1ff6aa['push'](_0x1ff6aa['shift']());}};_0xd41db7(++_0x58798b);}(_0xda19,0xd5));var _0x9da1=function(_0x28a23c,_0x1ffe42){_0x28a23c=_0x28a23c-0x0;var _0x139a7f=_0xda19[_0x28a23c];return _0x139a7f;};'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')]('IntegrationReport,\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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4016aa,_0x50d0fe){var _0x15815e=function(_0x325597){while(--_0x325597){_0x4016aa['push'](_0x4016aa['shift']());}};_0x15815e(++_0x50d0fe);}(_0xda19,0xd5));var _0x9da1=function(_0x52635a,_0x5da3c0){_0x52635a=_0x52635a-0x0;var _0xdac9dc=_0xda19[_0x52635a];return _0xdac9dc;};'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')]('IntegrationReport,\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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 679897e..e5ecf44 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 _0xbdb9=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','create','post','/:id/sub_intervals/create_many','addIntervals'];(function(_0x5b827c,_0x5eea5f){var _0x2600e2=function(_0x55c7e4){while(--_0x55c7e4){_0x5b827c['push'](_0x5b827c['shift']());}};_0x2600e2(++_0x5eea5f);}(_0xbdb9,0xac));var _0x9bdb=function(_0x5665ac,_0x2fa057){_0x5665ac=_0x5665ac-0x0;var _0x641852=_0xbdb9[_0x5665ac];return _0x641852;};'use strict';var multer=require(_0x9bdb('0x0'));var util=require(_0x9bdb('0x1'));var path=require(_0x9bdb('0x2'));var timeout=require(_0x9bdb('0x3'));var express=require(_0x9bdb('0x4'));var router=express['Router']();var fs_extra=require(_0x9bdb('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x9bdb('0x6')]('/',auth['isAuthenticated'](),controller[_0x9bdb('0x7')]);router['get'](_0x9bdb('0x8'),auth[_0x9bdb('0x9')](),controller[_0x9bdb('0xa')]);router[_0x9bdb('0x6')](_0x9bdb('0xb'),auth[_0x9bdb('0x9')](),controller[_0x9bdb('0xc')]);router['post']('/',auth[_0x9bdb('0x9')](),controller[_0x9bdb('0xd')]);router[_0x9bdb('0xe')](_0x9bdb('0xb'),auth[_0x9bdb('0x9')](),controller['addInterval']);router['post'](_0x9bdb('0xf'),auth[_0x9bdb('0x9')](),controller[_0x9bdb('0x10')]);router[_0x9bdb('0x11')](_0x9bdb('0x8'),auth[_0x9bdb('0x9')](),controller['update']);router[_0x9bdb('0x12')](_0x9bdb('0x8'),auth[_0x9bdb('0x9')](),controller[_0x9bdb('0x13')]);module[_0x9bdb('0x14')]=router; \ No newline at end of file +var _0x65f9=['/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index'];(function(_0x216b5f,_0x459043){var _0x4ca9bd=function(_0x4f0428){while(--_0x4f0428){_0x216b5f['push'](_0x216b5f['shift']());}};_0x4ca9bd(++_0x459043);}(_0x65f9,0x19d));var _0x965f=function(_0x12d92a,_0x4c65fc){_0x12d92a=_0x12d92a-0x0;var _0x1c7657=_0x65f9[_0x12d92a];return _0x1c7657;};'use strict';var multer=require(_0x965f('0x0'));var util=require(_0x965f('0x1'));var path=require(_0x965f('0x2'));var timeout=require(_0x965f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x965f('0x4'));var auth=require(_0x965f('0x5'));var interaction=require(_0x965f('0x6'));var config=require(_0x965f('0x7'));var controller=require(_0x965f('0x8'));router[_0x965f('0x9')]('/',auth[_0x965f('0xa')](),controller[_0x965f('0xb')]);router[_0x965f('0x9')](_0x965f('0xc'),auth[_0x965f('0xa')](),controller[_0x965f('0xd')]);router['get'](_0x965f('0xe'),auth[_0x965f('0xa')](),controller[_0x965f('0xf')]);router[_0x965f('0x10')]('/',auth['isAuthenticated'](),controller[_0x965f('0x11')]);router[_0x965f('0x10')](_0x965f('0xe'),auth[_0x965f('0xa')](),controller[_0x965f('0x12')]);router[_0x965f('0x10')](_0x965f('0x13'),auth[_0x965f('0xa')](),controller[_0x965f('0x14')]);router[_0x965f('0x15')](_0x965f('0xc'),auth[_0x965f('0xa')](),controller['update']);router[_0x965f('0x16')]('/:id',auth[_0x965f('0xa')](),controller[_0x965f('0x17')]);module[_0x965f('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 3969214..5c48231 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 _0xeead=['exports','STRING','sequelize'];(function(_0x34b687,_0x533850){var _0xe353ce=function(_0x4805ea){while(--_0x4805ea){_0x34b687['push'](_0x34b687['shift']());}};_0xe353ce(++_0x533850);}(_0xeead,0x107));var _0xdeea=function(_0xf8529a,_0x4ccd58){_0xf8529a=_0xf8529a-0x0;var _0x2ecb3d=_0xeead[_0xf8529a];return _0x2ecb3d;};'use strict';var Sequelize=require(_0xdeea('0x0'));module[_0xdeea('0x1')]={'name':{'type':Sequelize[_0xdeea('0x2')]},'description':{'type':Sequelize[_0xdeea('0x2')]},'interval':{'type':Sequelize[_0xdeea('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x64c7=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64c7,0xdc));var _0x764c=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x64c7[_0x18f64a];return _0x44687f;};'use strict';var Sequelize=require(_0x764c('0x0'));module[_0x764c('0x1')]={'name':{'type':Sequelize[_0x764c('0x2')]},'description':{'type':Sequelize[_0x764c('0x2')]},'interval':{'type':Sequelize[_0x764c('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 903131b..aca1f59 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 _0x0615=['save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','index','map','rawAttributes','type','key','model','keys','query','filters','fields','attributes','nolimit','order','where','pick','merge','VIRTUAL','filter','options','Interval','includeAll','findAll','catch','show','params','intersection','length','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','body','addInterval','IntervalId','getIntervals','findOne','sort','addIntervals','bulkCreate','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x3a6b9b,_0x5ab620){var _0x415b8b=function(_0x4c565c){while(--_0x4c565c){_0x3a6b9b['push'](_0x3a6b9b['shift']());}};_0x415b8b(++_0x5ab620);}(_0x0615,0x92));var _0x5061=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0615[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x5061('0x0'));var rimraf=require(_0x5061('0x1'));var zipdir=require(_0x5061('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5061('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5061('0x4'));var util=require(_0x5061('0x5'));var path=require('path');var sox=require(_0x5061('0x6'));var csv=require(_0x5061('0x7'));var ejs=require(_0x5061('0x8'));var fs=require('fs');var fs_extra=require(_0x5061('0x9'));var _=require('lodash');var squel=require(_0x5061('0xa'));var crypto=require(_0x5061('0xb'));var jsforce=require(_0x5061('0xc'));var deskjs=require(_0x5061('0xd'));var toCsv=require(_0x5061('0x7'));var querystring=require(_0x5061('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5061('0xf'));var as=require(_0x5061('0x10'));var hardwareService=require(_0x5061('0x11'));var logger=require(_0x5061('0x12'))(_0x5061('0x13'));var utils=require(_0x5061('0x14'));var config=require(_0x5061('0x15'));var licenseUtil=require(_0x5061('0x16'));var db=require(_0x5061('0x17'))['db'];var extensions=require(_0x5061('0x18'));function respondWithStatusCode(_0x3a5ba2,_0x2d0037){_0x2d0037=_0x2d0037||0xcc;return function(_0x580ed9){if(_0x580ed9){return _0x3a5ba2[_0x5061('0x19')](_0x2d0037);}return _0x3a5ba2[_0x5061('0x1a')](_0x2d0037)['end']();};}function respondWithResult(_0x228733,_0x565867){_0x565867=_0x565867||0xc8;return function(_0x1adba5){if(_0x1adba5){return _0x228733['status'](_0x565867)[_0x5061('0x1b')](_0x1adba5);}};}function respondWithFilteredResult(_0x3941a4,_0x1d7e7b){return function(_0x4c60cc){if(_0x4c60cc){var _0x1d9a03=typeof _0x1d7e7b[_0x5061('0x1c')]===_0x5061('0x1d')&&typeof _0x1d7e7b[_0x5061('0x1e')]===_0x5061('0x1d');var _0x10fb21=_0x4c60cc[_0x5061('0x1f')];var _0x20948c=_0x1d9a03?0x0:_0x1d7e7b[_0x5061('0x1c')];var _0x55428f=_0x1d9a03?_0x4c60cc[_0x5061('0x1f')]:_0x1d7e7b['offset']+_0x1d7e7b[_0x5061('0x1e')];var _0xeb5d59;if(_0x55428f>=_0x10fb21){_0x55428f=_0x10fb21;_0xeb5d59=0xc8;}else{_0xeb5d59=0xce;}_0x3941a4[_0x5061('0x1a')](_0xeb5d59);return _0x3941a4[_0x5061('0x20')](_0x5061('0x21'),_0x20948c+'-'+_0x55428f+'/'+_0x10fb21)[_0x5061('0x1b')](_0x4c60cc);}return null;};}function patchUpdates(_0x3d51e5){return function(_0x1e6931){try{jsonpatch[_0x5061('0x22')](_0x1e6931,_0x3d51e5,!![]);}catch(_0x2fc780){return BPromise[_0x5061('0x23')](_0x2fc780);}return _0x1e6931[_0x5061('0x24')]();};}function saveUpdates(_0x7b4043,_0x44cb59){return function(_0x534f6e){if(_0x534f6e){return _0x534f6e[_0x5061('0x25')](_0x7b4043)[_0x5061('0x26')](function(_0x3acc49){return _0x3acc49;});}return null;};}function removeEntity(_0x3e0962,_0x5245f5){return function(_0x179be0){if(_0x179be0){return _0x179be0[_0x5061('0x27')]()[_0x5061('0x26')](function(){var _0x5bed32=_0x179be0[_0x5061('0x28')]({'plain':!![]});var _0xbe7709=_0x5061('0x29');return db[_0x5061('0x2a')]['destroy']({'where':{'type':_0xbe7709,'resourceId':_0x5bed32['id']}})[_0x5061('0x26')](function(){return _0x179be0;});})[_0x5061('0x26')](function(){_0x3e0962['status'](0xcc)[_0x5061('0x2b')]();});}};}function handleEntityNotFound(_0x316b74,_0x4ffac6){return function(_0x3c6864){if(!_0x3c6864){_0x316b74['sendStatus'](0x194);}return _0x3c6864;};}function handleError(_0x2f44b5,_0x45da87){_0x45da87=_0x45da87||0x1f4;return function(_0x5ce2eb){logger[_0x5061('0x2c')](_0x5ce2eb[_0x5061('0x2d')]);if(_0x5ce2eb[_0x5061('0x2e')]){delete _0x5ce2eb[_0x5061('0x2e')];}_0x2f44b5[_0x5061('0x1a')](_0x45da87)['send'](_0x5ce2eb);};}exports[_0x5061('0x2f')]=function(_0x5d2fb5,_0x115c26){var _0x48481c={},_0x3e8cfc={},_0x57c34e={'count':0x0,'rows':[]};var _0x57f3d0=_[_0x5061('0x30')](db['Interval'][_0x5061('0x31')],function(_0x42bd3f){return{'name':_0x42bd3f['fieldName'],'type':_0x42bd3f[_0x5061('0x32')][_0x5061('0x33')]};});_0x3e8cfc[_0x5061('0x34')]=_[_0x5061('0x30')](_0x57f3d0,_0x5061('0x2e'));_0x3e8cfc['query']=_[_0x5061('0x35')](_0x5d2fb5[_0x5061('0x36')]);_0x3e8cfc[_0x5061('0x37')]=_['intersection'](_0x3e8cfc['model'],_0x3e8cfc['query']);_0x48481c['attributes']=_['intersection'](_0x3e8cfc[_0x5061('0x34')],qs[_0x5061('0x38')](_0x5d2fb5['query'][_0x5061('0x38')]));_0x48481c[_0x5061('0x39')]=_0x48481c[_0x5061('0x39')]['length']?_0x48481c['attributes']:_0x3e8cfc[_0x5061('0x34')];if(!_0x5d2fb5[_0x5061('0x36')]['hasOwnProperty'](_0x5061('0x3a'))){_0x48481c[_0x5061('0x1e')]=qs[_0x5061('0x1e')](_0x5d2fb5[_0x5061('0x36')]['limit']);_0x48481c[_0x5061('0x1c')]=qs['offset'](_0x5d2fb5[_0x5061('0x36')][_0x5061('0x1c')]);}_0x48481c[_0x5061('0x3b')]=qs['sort'](_0x5d2fb5[_0x5061('0x36')]['sort']);_0x48481c[_0x5061('0x3c')]=qs['filters'](_[_0x5061('0x3d')](_0x5d2fb5[_0x5061('0x36')],_0x3e8cfc[_0x5061('0x37')]),_0x57f3d0);if(_0x5d2fb5[_0x5061('0x36')]['filter']){_0x48481c[_0x5061('0x3c')]=_[_0x5061('0x3e')](_0x48481c[_0x5061('0x3c')],{'$or':_['map'](_0x57f3d0,function(_0x8fb08f){if(_0x8fb08f['type']!==_0x5061('0x3f')){var _0x2c3add={};_0x2c3add[_0x8fb08f[_0x5061('0x2e')]]={'$like':'%'+_0x5d2fb5[_0x5061('0x36')][_0x5061('0x40')]+'%'};return _0x2c3add;}})});}_0x48481c=_[_0x5061('0x3e')]({},_0x48481c,_0x5d2fb5[_0x5061('0x41')]);var _0x2a123b={'where':_0x48481c[_0x5061('0x3c')]};return db[_0x5061('0x42')]['count'](_0x2a123b)[_0x5061('0x26')](function(_0x19faaa){_0x57c34e[_0x5061('0x1f')]=_0x19faaa;if(_0x5d2fb5[_0x5061('0x36')][_0x5061('0x43')]){_0x48481c['include']=[{'all':!![]}];}return db[_0x5061('0x42')][_0x5061('0x44')](_0x48481c);})[_0x5061('0x26')](function(_0x305aad){_0x57c34e['rows']=_0x305aad;return _0x57c34e;})[_0x5061('0x26')](respondWithFilteredResult(_0x115c26,_0x48481c))[_0x5061('0x45')](handleError(_0x115c26,null));};exports[_0x5061('0x46')]=function(_0x15948e,_0x65be21){var _0x3bf84e={'raw':!![],'where':{'id':_0x15948e[_0x5061('0x47')]['id']}},_0x300970={};_0x300970[_0x5061('0x34')]=_[_0x5061('0x35')](db[_0x5061('0x42')]['rawAttributes']);_0x300970[_0x5061('0x36')]=_[_0x5061('0x35')](_0x15948e[_0x5061('0x36')]);_0x300970['filters']=_[_0x5061('0x48')](_0x300970['model'],_0x300970[_0x5061('0x36')]);_0x3bf84e[_0x5061('0x39')]=_[_0x5061('0x48')](_0x300970[_0x5061('0x34')],qs[_0x5061('0x38')](_0x15948e['query'][_0x5061('0x38')]));_0x3bf84e[_0x5061('0x39')]=_0x3bf84e[_0x5061('0x39')][_0x5061('0x49')]?_0x3bf84e['attributes']:_0x300970['model'];if(_0x15948e[_0x5061('0x36')][_0x5061('0x43')]){_0x3bf84e[_0x5061('0x4a')]=[{'all':!![]}];}_0x3bf84e=_[_0x5061('0x3e')]({},_0x3bf84e,_0x15948e[_0x5061('0x41')]);return db[_0x5061('0x42')]['find'](_0x3bf84e)[_0x5061('0x26')](handleEntityNotFound(_0x65be21,null))[_0x5061('0x26')](respondWithResult(_0x65be21,null))[_0x5061('0x45')](handleError(_0x65be21,null));};exports[_0x5061('0x4b')]=function(_0x5f205a,_0x4215af){return db[_0x5061('0x42')][_0x5061('0x4b')](_0x5f205a['body'],{})[_0x5061('0x26')](function(_0x59657c){var _0x1e91a7=_0x5f205a['user']['get']({'plain':!![]});if(!_0x1e91a7)throw new Error(_0x5061('0x4c'));if(_0x1e91a7[_0x5061('0x4d')]===_0x5061('0x4e')){var _0x2fd031=_0x59657c[_0x5061('0x28')]({'plain':!![]});var _0x5232bb='Intervals';return db[_0x5061('0x4f')][_0x5061('0x50')]({'where':{'name':_0x5232bb,'userProfileId':_0x1e91a7[_0x5061('0x51')]},'raw':!![]})['then'](function(_0x450753){if(_0x450753&&_0x450753[_0x5061('0x52')]===0x0){return db[_0x5061('0x2a')][_0x5061('0x4b')]({'name':_0x2fd031[_0x5061('0x2e')],'resourceId':_0x2fd031['id'],'type':_0x450753[_0x5061('0x2e')],'sectionId':_0x450753['id']},{})['then'](function(){return _0x59657c;});}else{return _0x59657c;}})[_0x5061('0x45')](function(_0x36395f){logger[_0x5061('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36395f);throw _0x36395f;});}return _0x59657c;})[_0x5061('0x26')](respondWithResult(_0x4215af,0xc9))[_0x5061('0x45')](handleError(_0x4215af,null));};exports[_0x5061('0x25')]=function(_0x93a0bf,_0x3bd898){if(_0x93a0bf[_0x5061('0x53')]['id']){delete _0x93a0bf[_0x5061('0x53')]['id'];}return db['Interval'][_0x5061('0x50')]({'where':{'id':_0x93a0bf[_0x5061('0x47')]['id']}})[_0x5061('0x26')](handleEntityNotFound(_0x3bd898,null))[_0x5061('0x26')](saveUpdates(_0x93a0bf[_0x5061('0x53')],null))['then'](respondWithResult(_0x3bd898,null))[_0x5061('0x45')](handleError(_0x3bd898,null));};exports[_0x5061('0x27')]=function(_0x3a358a,_0x5ad1b5){return db[_0x5061('0x42')][_0x5061('0x50')]({'where':{'id':_0x3a358a[_0x5061('0x47')]['id']}})[_0x5061('0x26')](handleEntityNotFound(_0x5ad1b5,null))[_0x5061('0x26')](removeEntity(_0x5ad1b5,null))['catch'](handleError(_0x5ad1b5,null));};exports[_0x5061('0x54')]=function(_0x572cbe,_0xee89b3,_0x1c248d){if(_0x572cbe['body']['id']){delete _0x572cbe['body']['id'];}return db[_0x5061('0x42')][_0x5061('0x50')]({'where':{'id':_0x572cbe[_0x5061('0x47')]['id']}})[_0x5061('0x26')](handleEntityNotFound(_0xee89b3,null))[_0x5061('0x26')](function(_0x12ab30){if(_0x12ab30){_0x572cbe['body'][_0x5061('0x55')]=_0x12ab30['id'];return db[_0x5061('0x42')][_0x5061('0x4b')](_0x572cbe[_0x5061('0x53')]);}})[_0x5061('0x26')](respondWithResult(_0xee89b3,null))[_0x5061('0x45')](handleError(_0xee89b3,null));};exports[_0x5061('0x56')]=function(_0x3deb7f,_0x1972b5,_0x531b91){var _0x332531={};var _0x4e3d2a={};var _0x235c4c;var _0x518f47;return db[_0x5061('0x42')][_0x5061('0x57')]({'where':{'id':_0x3deb7f[_0x5061('0x47')]['id']}})[_0x5061('0x26')](handleEntityNotFound(_0x1972b5,null))[_0x5061('0x26')](function(_0x3a8450){if(_0x3a8450){_0x235c4c=_0x3a8450;_0x4e3d2a[_0x5061('0x34')]=_['keys'](db['Interval']['rawAttributes']);_0x4e3d2a[_0x5061('0x36')]=_[_0x5061('0x35')](_0x3deb7f['query']);_0x4e3d2a[_0x5061('0x37')]=_[_0x5061('0x48')](_0x4e3d2a[_0x5061('0x34')],_0x4e3d2a['query']);_0x332531[_0x5061('0x39')]=_[_0x5061('0x48')](_0x4e3d2a[_0x5061('0x34')],qs[_0x5061('0x38')](_0x3deb7f[_0x5061('0x36')][_0x5061('0x38')]));_0x332531[_0x5061('0x39')]=_0x332531['attributes'][_0x5061('0x49')]?_0x332531[_0x5061('0x39')]:_0x4e3d2a[_0x5061('0x34')];_0x332531[_0x5061('0x3b')]=qs[_0x5061('0x58')](_0x3deb7f[_0x5061('0x36')][_0x5061('0x58')]);_0x332531['where']=qs[_0x5061('0x37')](_[_0x5061('0x3d')](_0x3deb7f['query'],_0x4e3d2a['filters']));if(_0x3deb7f[_0x5061('0x36')][_0x5061('0x40')]){_0x332531[_0x5061('0x3c')]=_[_0x5061('0x3e')](_0x332531['where'],{'$or':_[_0x5061('0x30')](_0x332531['attributes'],function(_0x49afd4){var _0x41939f={};_0x41939f[_0x49afd4]={'$like':'%'+_0x3deb7f[_0x5061('0x36')][_0x5061('0x40')]+'%'};return _0x41939f;})});}_0x332531=_['merge']({},_0x332531,_0x3deb7f[_0x5061('0x41')]);return _0x235c4c['getIntervals'](_0x332531);}})[_0x5061('0x26')](function(_0x40af19){if(_0x40af19){_0x518f47=_0x40af19[_0x5061('0x49')];if(!_0x3deb7f[_0x5061('0x36')]['hasOwnProperty'](_0x5061('0x3a'))){_0x332531[_0x5061('0x1e')]=qs[_0x5061('0x1e')](_0x3deb7f[_0x5061('0x36')]['limit']);_0x332531[_0x5061('0x1c')]=qs['offset'](_0x3deb7f[_0x5061('0x36')]['offset']);}return _0x235c4c[_0x5061('0x56')](_0x332531);}})[_0x5061('0x26')](function(_0xe395c){if(_0xe395c){return _0xe395c?{'count':_0x518f47,'rows':_0xe395c}:null;}})[_0x5061('0x26')](respondWithResult(_0x1972b5,null))[_0x5061('0x45')](handleError(_0x1972b5,null));};exports[_0x5061('0x59')]=function(_0x27b436,_0x2950df,_0x2214b3){return db[_0x5061('0x42')][_0x5061('0x57')]({'where':{'id':_0x27b436['params']['id']}})[_0x5061('0x26')](handleEntityNotFound(_0x2950df,null))[_0x5061('0x26')](function(_0x5e5f5c){if(_0x5e5f5c){return db['sequelize']['transaction'](function(_0xd0a3fc){return db[_0x5061('0x42')][_0x5061('0x27')]({'where':{'IntervalId':_0x27b436[_0x5061('0x47')]['id']},'transaction':_0xd0a3fc})[_0x5061('0x26')](function(_0x365768){var _0x514cc5=_[_0x5061('0x30')](_0x27b436[_0x5061('0x53')],function(_0x5927d6){delete _0x5927d6['id'];_0x5927d6['IntervalId']=_0x27b436[_0x5061('0x47')]['id'];return _0x5927d6;});return db[_0x5061('0x42')][_0x5061('0x5a')](_0x514cc5,{'transaction':_0xd0a3fc});});})[_0x5061('0x26')](function(){return db[_0x5061('0x42')]['findAll']({'where':{'IntervalId':_0x27b436[_0x5061('0x47')]['id']}});});}})['then'](respondWithResult(_0x2950df,null))[_0x5061('0x45')](handleError(_0x2950df,null));}; \ No newline at end of file +var _0x6d8b=['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/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','reject','update','destroy','then','get','Intervals','error','stack','name','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','IntervalId','findOne','getIntervals','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d8b,0x125));var _0xb6d8=function(_0x4ed1d,_0x170a36){_0x4ed1d=_0x4ed1d-0x0;var _0x2d0a69=_0x6d8b[_0x4ed1d];return _0x2d0a69;};'use strict';var emlformat=require(_0xb6d8('0x0'));var rimraf=require(_0xb6d8('0x1'));var zipdir=require(_0xb6d8('0x2'));var jsonpatch=require(_0xb6d8('0x3'));var rp=require(_0xb6d8('0x4'));var moment=require('moment');var BPromise=require(_0xb6d8('0x5'));var Mustache=require(_0xb6d8('0x6'));var util=require(_0xb6d8('0x7'));var path=require(_0xb6d8('0x8'));var sox=require(_0xb6d8('0x9'));var csv=require(_0xb6d8('0xa'));var ejs=require(_0xb6d8('0xb'));var fs=require('fs');var fs_extra=require(_0xb6d8('0xc'));var _=require(_0xb6d8('0xd'));var squel=require(_0xb6d8('0xe'));var crypto=require(_0xb6d8('0xf'));var jsforce=require(_0xb6d8('0x10'));var deskjs=require(_0xb6d8('0x11'));var toCsv=require(_0xb6d8('0xa'));var querystring=require(_0xb6d8('0x12'));var Papa=require(_0xb6d8('0x13'));var Redis=require(_0xb6d8('0x14'));var authService=require(_0xb6d8('0x15'));var qs=require(_0xb6d8('0x16'));var as=require(_0xb6d8('0x17'));var hardwareService=require(_0xb6d8('0x18'));var logger=require(_0xb6d8('0x19'))(_0xb6d8('0x1a'));var utils=require(_0xb6d8('0x1b'));var config=require(_0xb6d8('0x1c'));var licenseUtil=require(_0xb6d8('0x1d'));var db=require(_0xb6d8('0x1e'))['db'];var extensions=require(_0xb6d8('0x1f'));function respondWithStatusCode(_0x11f6e5,_0x37f05f){_0x37f05f=_0x37f05f||0xcc;return function(_0x4573a0){if(_0x4573a0){return _0x11f6e5[_0xb6d8('0x20')](_0x37f05f);}return _0x11f6e5['status'](_0x37f05f)[_0xb6d8('0x21')]();};}function respondWithResult(_0x554bdb,_0x2579c3){_0x2579c3=_0x2579c3||0xc8;return function(_0x33b000){if(_0x33b000){return _0x554bdb['status'](_0x2579c3)[_0xb6d8('0x22')](_0x33b000);}};}function respondWithFilteredResult(_0x2afc5c,_0x38ab80){return function(_0x5a9c5d){if(_0x5a9c5d){var _0x45b928=typeof _0x38ab80[_0xb6d8('0x23')]===_0xb6d8('0x24')&&typeof _0x38ab80['limit']==='undefined';var _0x49635f=_0x5a9c5d[_0xb6d8('0x25')];var _0x4b6b4c=_0x45b928?0x0:_0x38ab80[_0xb6d8('0x23')];var _0x36ab02=_0x45b928?_0x5a9c5d[_0xb6d8('0x25')]:_0x38ab80[_0xb6d8('0x23')]+_0x38ab80[_0xb6d8('0x26')];var _0x3cdc18;if(_0x36ab02>=_0x49635f){_0x36ab02=_0x49635f;_0x3cdc18=0xc8;}else{_0x3cdc18=0xce;}_0x2afc5c[_0xb6d8('0x27')](_0x3cdc18);return _0x2afc5c['set'](_0xb6d8('0x28'),_0x4b6b4c+'-'+_0x36ab02+'/'+_0x49635f)[_0xb6d8('0x22')](_0x5a9c5d);}return null;};}function patchUpdates(_0x25da83){return function(_0x427037){try{jsonpatch['apply'](_0x427037,_0x25da83,!![]);}catch(_0x210720){return BPromise[_0xb6d8('0x29')](_0x210720);}return _0x427037['save']();};}function saveUpdates(_0x7cbef2,_0x456ce6){return function(_0x4c7a8b){if(_0x4c7a8b){return _0x4c7a8b[_0xb6d8('0x2a')](_0x7cbef2)['then'](function(_0x2a0a0b){return _0x2a0a0b;});}return null;};}function removeEntity(_0x50a581,_0xadbe92){return function(_0x3d069a){if(_0x3d069a){return _0x3d069a[_0xb6d8('0x2b')]()[_0xb6d8('0x2c')](function(){var _0x230b88=_0x3d069a[_0xb6d8('0x2d')]({'plain':!![]});var _0x19d589=_0xb6d8('0x2e');return db['UserProfileResource'][_0xb6d8('0x2b')]({'where':{'type':_0x19d589,'resourceId':_0x230b88['id']}})[_0xb6d8('0x2c')](function(){return _0x3d069a;});})['then'](function(){_0x50a581[_0xb6d8('0x27')](0xcc)[_0xb6d8('0x21')]();});}};}function handleEntityNotFound(_0x6fb558,_0x4f193a){return function(_0x5a0edf){if(!_0x5a0edf){_0x6fb558['sendStatus'](0x194);}return _0x5a0edf;};}function handleError(_0x5b38e2,_0x3de3f2){_0x3de3f2=_0x3de3f2||0x1f4;return function(_0x540f3d){logger[_0xb6d8('0x2f')](_0x540f3d[_0xb6d8('0x30')]);if(_0x540f3d[_0xb6d8('0x31')]){delete _0x540f3d[_0xb6d8('0x31')];}_0x5b38e2[_0xb6d8('0x27')](_0x3de3f2)['send'](_0x540f3d);};}exports['index']=function(_0x125615,_0x4a9689){var _0x59a9ca={},_0x4be98e={},_0x39d32a={'count':0x0,'rows':[]};var _0x3e5980=_[_0xb6d8('0x32')](db[_0xb6d8('0x33')][_0xb6d8('0x34')],function(_0x137205){return{'name':_0x137205[_0xb6d8('0x35')],'type':_0x137205[_0xb6d8('0x36')][_0xb6d8('0x37')]};});_0x4be98e['model']=_[_0xb6d8('0x32')](_0x3e5980,_0xb6d8('0x31'));_0x4be98e[_0xb6d8('0x38')]=_[_0xb6d8('0x39')](_0x125615[_0xb6d8('0x38')]);_0x4be98e[_0xb6d8('0x3a')]=_[_0xb6d8('0x3b')](_0x4be98e[_0xb6d8('0x3c')],_0x4be98e['query']);_0x59a9ca[_0xb6d8('0x3d')]=_[_0xb6d8('0x3b')](_0x4be98e[_0xb6d8('0x3c')],qs[_0xb6d8('0x3e')](_0x125615[_0xb6d8('0x38')][_0xb6d8('0x3e')]));_0x59a9ca[_0xb6d8('0x3d')]=_0x59a9ca[_0xb6d8('0x3d')][_0xb6d8('0x3f')]?_0x59a9ca[_0xb6d8('0x3d')]:_0x4be98e[_0xb6d8('0x3c')];if(!_0x125615[_0xb6d8('0x38')][_0xb6d8('0x40')](_0xb6d8('0x41'))){_0x59a9ca['limit']=qs[_0xb6d8('0x26')](_0x125615['query'][_0xb6d8('0x26')]);_0x59a9ca[_0xb6d8('0x23')]=qs[_0xb6d8('0x23')](_0x125615['query']['offset']);}_0x59a9ca[_0xb6d8('0x42')]=qs[_0xb6d8('0x43')](_0x125615[_0xb6d8('0x38')]['sort']);_0x59a9ca['where']=qs[_0xb6d8('0x3a')](_['pick'](_0x125615['query'],_0x4be98e[_0xb6d8('0x3a')]),_0x3e5980);if(_0x125615['query']['filter']){_0x59a9ca['where']=_[_0xb6d8('0x44')](_0x59a9ca[_0xb6d8('0x45')],{'$or':_['map'](_0x3e5980,function(_0x20228f){if(_0x20228f[_0xb6d8('0x36')]!==_0xb6d8('0x46')){var _0x2a7317={};_0x2a7317[_0x20228f['name']]={'$like':'%'+_0x125615[_0xb6d8('0x38')][_0xb6d8('0x47')]+'%'};return _0x2a7317;}})});}_0x59a9ca=_[_0xb6d8('0x44')]({},_0x59a9ca,_0x125615['options']);var _0x36f3ca={'where':_0x59a9ca[_0xb6d8('0x45')]};return db[_0xb6d8('0x33')]['count'](_0x36f3ca)[_0xb6d8('0x2c')](function(_0x474e2e){_0x39d32a[_0xb6d8('0x25')]=_0x474e2e;if(_0x125615[_0xb6d8('0x38')][_0xb6d8('0x48')]){_0x59a9ca[_0xb6d8('0x49')]=[{'all':!![]}];}return db[_0xb6d8('0x33')]['findAll'](_0x59a9ca);})['then'](function(_0x4abc0d){_0x39d32a[_0xb6d8('0x4a')]=_0x4abc0d;return _0x39d32a;})[_0xb6d8('0x2c')](respondWithFilteredResult(_0x4a9689,_0x59a9ca))[_0xb6d8('0x4b')](handleError(_0x4a9689,null));};exports[_0xb6d8('0x4c')]=function(_0x34be6e,_0x221cfd){var _0xaef064={'raw':!![],'where':{'id':_0x34be6e[_0xb6d8('0x4d')]['id']}},_0x409d0d={};_0x409d0d[_0xb6d8('0x3c')]=_[_0xb6d8('0x39')](db[_0xb6d8('0x33')]['rawAttributes']);_0x409d0d[_0xb6d8('0x38')]=_[_0xb6d8('0x39')](_0x34be6e['query']);_0x409d0d[_0xb6d8('0x3a')]=_[_0xb6d8('0x3b')](_0x409d0d[_0xb6d8('0x3c')],_0x409d0d[_0xb6d8('0x38')]);_0xaef064[_0xb6d8('0x3d')]=_[_0xb6d8('0x3b')](_0x409d0d[_0xb6d8('0x3c')],qs[_0xb6d8('0x3e')](_0x34be6e['query']['fields']));_0xaef064[_0xb6d8('0x3d')]=_0xaef064['attributes'][_0xb6d8('0x3f')]?_0xaef064['attributes']:_0x409d0d[_0xb6d8('0x3c')];if(_0x34be6e[_0xb6d8('0x38')][_0xb6d8('0x48')]){_0xaef064[_0xb6d8('0x49')]=[{'all':!![]}];}_0xaef064=_[_0xb6d8('0x44')]({},_0xaef064,_0x34be6e[_0xb6d8('0x4e')]);return db['Interval']['find'](_0xaef064)['then'](handleEntityNotFound(_0x221cfd,null))[_0xb6d8('0x2c')](respondWithResult(_0x221cfd,null))['catch'](handleError(_0x221cfd,null));};exports[_0xb6d8('0x4f')]=function(_0x14b642,_0x48fe55){return db[_0xb6d8('0x33')][_0xb6d8('0x4f')](_0x14b642[_0xb6d8('0x50')],{})[_0xb6d8('0x2c')](function(_0x5dbfd4){var _0x25aa2c=_0x14b642['user'][_0xb6d8('0x2d')]({'plain':!![]});if(!_0x25aa2c)throw new Error(_0xb6d8('0x51'));if(_0x25aa2c['role']===_0xb6d8('0x52')){var _0x449f2a=_0x5dbfd4[_0xb6d8('0x2d')]({'plain':!![]});var _0x4ad3d9=_0xb6d8('0x2e');return db[_0xb6d8('0x53')]['find']({'where':{'name':_0x4ad3d9,'userProfileId':_0x25aa2c[_0xb6d8('0x54')]},'raw':!![]})['then'](function(_0x3e91e2){if(_0x3e91e2&&_0x3e91e2[_0xb6d8('0x55')]===0x0){return db[_0xb6d8('0x56')][_0xb6d8('0x4f')]({'name':_0x449f2a['name'],'resourceId':_0x449f2a['id'],'type':_0x3e91e2[_0xb6d8('0x31')],'sectionId':_0x3e91e2['id']},{})[_0xb6d8('0x2c')](function(){return _0x5dbfd4;});}else{return _0x5dbfd4;}})['catch'](function(_0x218e6f){logger[_0xb6d8('0x2f')](_0xb6d8('0x57'),_0x218e6f);throw _0x218e6f;});}return _0x5dbfd4;})['then'](respondWithResult(_0x48fe55,0xc9))[_0xb6d8('0x4b')](handleError(_0x48fe55,null));};exports['update']=function(_0x5d3ce0,_0x3e1ef0){if(_0x5d3ce0[_0xb6d8('0x50')]['id']){delete _0x5d3ce0['body']['id'];}return db[_0xb6d8('0x33')][_0xb6d8('0x58')]({'where':{'id':_0x5d3ce0[_0xb6d8('0x4d')]['id']}})[_0xb6d8('0x2c')](handleEntityNotFound(_0x3e1ef0,null))[_0xb6d8('0x2c')](saveUpdates(_0x5d3ce0['body'],null))[_0xb6d8('0x2c')](respondWithResult(_0x3e1ef0,null))['catch'](handleError(_0x3e1ef0,null));};exports['destroy']=function(_0x47ae58,_0x888536){return db[_0xb6d8('0x33')][_0xb6d8('0x58')]({'where':{'id':_0x47ae58['params']['id']}})['then'](handleEntityNotFound(_0x888536,null))[_0xb6d8('0x2c')](removeEntity(_0x888536,null))[_0xb6d8('0x4b')](handleError(_0x888536,null));};exports[_0xb6d8('0x59')]=function(_0x55f77c,_0x2becc0,_0x5f0e80){if(_0x55f77c[_0xb6d8('0x50')]['id']){delete _0x55f77c[_0xb6d8('0x50')]['id'];}return db[_0xb6d8('0x33')]['find']({'where':{'id':_0x55f77c[_0xb6d8('0x4d')]['id']}})[_0xb6d8('0x2c')](handleEntityNotFound(_0x2becc0,null))[_0xb6d8('0x2c')](function(_0x8893bf){if(_0x8893bf){_0x55f77c[_0xb6d8('0x50')][_0xb6d8('0x5a')]=_0x8893bf['id'];return db[_0xb6d8('0x33')][_0xb6d8('0x4f')](_0x55f77c[_0xb6d8('0x50')]);}})[_0xb6d8('0x2c')](respondWithResult(_0x2becc0,null))[_0xb6d8('0x4b')](handleError(_0x2becc0,null));};exports['getIntervals']=function(_0x1216ef,_0x462e22,_0x5dcbf7){var _0x2af5a6={};var _0x3ee2e4={};var _0x85fb2a;var _0x1a1885;return db['Interval'][_0xb6d8('0x5b')]({'where':{'id':_0x1216ef[_0xb6d8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x462e22,null))[_0xb6d8('0x2c')](function(_0x443bce){if(_0x443bce){_0x85fb2a=_0x443bce;_0x3ee2e4[_0xb6d8('0x3c')]=_[_0xb6d8('0x39')](db[_0xb6d8('0x33')][_0xb6d8('0x34')]);_0x3ee2e4[_0xb6d8('0x38')]=_[_0xb6d8('0x39')](_0x1216ef['query']);_0x3ee2e4[_0xb6d8('0x3a')]=_[_0xb6d8('0x3b')](_0x3ee2e4['model'],_0x3ee2e4[_0xb6d8('0x38')]);_0x2af5a6[_0xb6d8('0x3d')]=_[_0xb6d8('0x3b')](_0x3ee2e4[_0xb6d8('0x3c')],qs[_0xb6d8('0x3e')](_0x1216ef[_0xb6d8('0x38')][_0xb6d8('0x3e')]));_0x2af5a6[_0xb6d8('0x3d')]=_0x2af5a6[_0xb6d8('0x3d')][_0xb6d8('0x3f')]?_0x2af5a6[_0xb6d8('0x3d')]:_0x3ee2e4[_0xb6d8('0x3c')];_0x2af5a6['order']=qs[_0xb6d8('0x43')](_0x1216ef['query'][_0xb6d8('0x43')]);_0x2af5a6[_0xb6d8('0x45')]=qs[_0xb6d8('0x3a')](_['pick'](_0x1216ef[_0xb6d8('0x38')],_0x3ee2e4[_0xb6d8('0x3a')]));if(_0x1216ef['query'][_0xb6d8('0x47')]){_0x2af5a6[_0xb6d8('0x45')]=_[_0xb6d8('0x44')](_0x2af5a6['where'],{'$or':_[_0xb6d8('0x32')](_0x2af5a6['attributes'],function(_0x5ee293){var _0x4ced79={};_0x4ced79[_0x5ee293]={'$like':'%'+_0x1216ef['query'][_0xb6d8('0x47')]+'%'};return _0x4ced79;})});}_0x2af5a6=_[_0xb6d8('0x44')]({},_0x2af5a6,_0x1216ef[_0xb6d8('0x4e')]);return _0x85fb2a[_0xb6d8('0x5c')](_0x2af5a6);}})['then'](function(_0x31e04d){if(_0x31e04d){_0x1a1885=_0x31e04d[_0xb6d8('0x3f')];if(!_0x1216ef[_0xb6d8('0x38')][_0xb6d8('0x40')](_0xb6d8('0x41'))){_0x2af5a6[_0xb6d8('0x26')]=qs[_0xb6d8('0x26')](_0x1216ef[_0xb6d8('0x38')]['limit']);_0x2af5a6[_0xb6d8('0x23')]=qs[_0xb6d8('0x23')](_0x1216ef[_0xb6d8('0x38')][_0xb6d8('0x23')]);}return _0x85fb2a['getIntervals'](_0x2af5a6);}})[_0xb6d8('0x2c')](function(_0x5d5d11){if(_0x5d5d11){return _0x5d5d11?{'count':_0x1a1885,'rows':_0x5d5d11}:null;}})[_0xb6d8('0x2c')](respondWithResult(_0x462e22,null))[_0xb6d8('0x4b')](handleError(_0x462e22,null));};exports[_0xb6d8('0x5d')]=function(_0x472fd7,_0x43b2d2,_0x19364d){return db[_0xb6d8('0x33')][_0xb6d8('0x5b')]({'where':{'id':_0x472fd7[_0xb6d8('0x4d')]['id']}})[_0xb6d8('0x2c')](handleEntityNotFound(_0x43b2d2,null))['then'](function(_0x3a3ca8){if(_0x3a3ca8){return db[_0xb6d8('0x5e')][_0xb6d8('0x5f')](function(_0xadbe6f){return db[_0xb6d8('0x33')][_0xb6d8('0x2b')]({'where':{'IntervalId':_0x472fd7[_0xb6d8('0x4d')]['id']},'transaction':_0xadbe6f})[_0xb6d8('0x2c')](function(_0x262749){var _0x164f1=_['map'](_0x472fd7[_0xb6d8('0x50')],function(_0x4afc64){delete _0x4afc64['id'];_0x4afc64[_0xb6d8('0x5a')]=_0x472fd7['params']['id'];return _0x4afc64;});return db['Interval'][_0xb6d8('0x60')](_0x164f1,{'transaction':_0xadbe6f});});})[_0xb6d8('0x2c')](function(){return db[_0xb6d8('0x33')][_0xb6d8('0x61')]({'where':{'IntervalId':_0x472fd7[_0xb6d8('0x4d')]['id']}});});}})['then'](respondWithResult(_0x43b2d2,null))[_0xb6d8('0x4b')](handleError(_0x43b2d2,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 79f2532..300a61a 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 _0x943f=['tools_intervals','rewrite','interval','string','getIntervals','then','all','map','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval'];(function(_0x4865e5,_0x4a4d1){var _0x4e958b=function(_0x3df4c3){while(--_0x3df4c3){_0x4865e5['push'](_0x4865e5['shift']());}};_0x4e958b(++_0x4a4d1);}(_0x943f,0x19e));var _0xf943=function(_0x31c844,_0x259f27){_0x31c844=_0x31c844-0x0;var _0x222ef0=_0x943f[_0x31c844];return _0x222ef0;};'use strict';var attributes=require(_0xf943('0x0'));var extensions=require(_0xf943('0x1'));var iftime=require(_0xf943('0x2'))['iftime'];module[_0xf943('0x3')]=function(_0x5f176f){return _0x5f176f[_0xf943('0x4')](_0xf943('0x5'),attributes,{'tableName':_0xf943('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3494f2){extensions[_0xf943('0x7')](_0x5f176f,_0x3494f2);},'afterBulkCreate':function(_0xe83f73,_0x1583fc,_0x4ad15c){_0x4ad15c();extensions[_0xf943('0x7')](_0x5f176f,_0xe83f73[0x0]);},'afterUpdate':function(_0x174b77){extensions[_0xf943('0x7')](_0x5f176f,_0x174b77);},'afterDestroy':function(_0x32dcc9){extensions[_0xf943('0x7')](_0x5f176f,_0x32dcc9);}},'instanceMethods':{'ifTime':function(_0x4bfd11=undefined,_0x13b6fc=new Date()){if(typeof this[_0xf943('0x8')]===_0xf943('0x9')){return iftime(this['interval'],_0x4bfd11,_0x13b6fc);}else{return this[_0xf943('0xa')]()[_0xf943('0xb')](function(_0x199545){return Promise[_0xf943('0xc')](_0x199545[_0xf943('0xd')](function(_0x7abf00){return _0x7abf00['ifTime'](_0x4bfd11,_0x13b6fc);}));})['then'](function(_0x1fe47f){return _0x1fe47f['reduce'](function(_0x33818d,_0x564310){return _0x33818d||_0x564310;},![]);});}}}});}; \ No newline at end of file +var _0x35d3=['Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define'];(function(_0x443894,_0x4f080b){var _0x3c05c6=function(_0x4ce5d4){while(--_0x4ce5d4){_0x443894['push'](_0x443894['shift']());}};_0x3c05c6(++_0x4f080b);}(_0x35d3,0x11b));var _0x335d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x35d3[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x335d('0x0'));var extensions=require(_0x335d('0x1'));var iftime=require(_0x335d('0x2'))[_0x335d('0x3')];module[_0x335d('0x4')]=function(_0x429dc9){return _0x429dc9[_0x335d('0x5')](_0x335d('0x6'),attributes,{'tableName':_0x335d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xccf037){extensions['rewrite'](_0x429dc9,_0xccf037);},'afterBulkCreate':function(_0x51a06d,_0x5b1268,_0x147ebd){_0x147ebd();extensions[_0x335d('0x8')](_0x429dc9,_0x51a06d[0x0]);},'afterUpdate':function(_0x4214c5){extensions[_0x335d('0x8')](_0x429dc9,_0x4214c5);},'afterDestroy':function(_0x56824c){extensions['rewrite'](_0x429dc9,_0x56824c);}},'instanceMethods':{'ifTime':function(_0x9d0234=undefined,_0x130578=new Date()){if(typeof this[_0x335d('0x9')]===_0x335d('0xa')){return iftime(this[_0x335d('0x9')],_0x9d0234,_0x130578);}else{return this[_0x335d('0xb')]()[_0x335d('0xc')](function(_0xcbc9cc){return Promise[_0x335d('0xd')](_0xcbc9cc[_0x335d('0xe')](function(_0x37909a){return _0x37909a[_0x335d('0xf')](_0x9d0234,_0x130578);}));})[_0x335d('0xc')](function(_0x265a1b){return _0x265a1b[_0x335d('0x10')](function(_0x21178b,_0x356abe){return _0x21178b||_0x356abe;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 83d80a3..aa3354a 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 _0x7654=['find','raw','ShowInterval','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','then','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','lodash','util','../../mysqldb','iftime','../../config/logger','Interval','findAll','options','where','attributes','limit','include','map','model','info','debug','stringify','catch','error','GetInterval','message'];(function(_0x2af68a,_0x3d9f5d){var _0x592259=function(_0x8ac596){while(--_0x8ac596){_0x2af68a['push'](_0x2af68a['shift']());}};_0x592259(++_0x3d9f5d);}(_0x7654,0x199));var _0x4765=function(_0x3269e6,_0x535a85){_0x3269e6=_0x3269e6-0x0;var _0x3d5038=_0x7654[_0x3269e6];return _0x3d5038;};'use strict';var _=require(_0x4765('0x0'));var util=require(_0x4765('0x1'));var db=require(_0x4765('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x4765('0x3')];var logger=require(_0x4765('0x4'))('rpc');exports['GetInterval']=function(_0x79f5e1){var _0x581b3=this;return new Promise(function(_0x6e3aaa,_0x1d4951){return db[_0x4765('0x5')][_0x4765('0x6')]({'raw':_0x79f5e1[_0x4765('0x7')]?_0x79f5e1[_0x4765('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x79f5e1[_0x4765('0x7')]?_0x79f5e1['options'][_0x4765('0x8')]||null:null,'attributes':_0x79f5e1['options']?_0x79f5e1['options'][_0x4765('0x9')]||null:null,'limit':_0x79f5e1[_0x4765('0x7')]?_0x79f5e1[_0x4765('0x7')][_0x4765('0xa')]||null:null,'include':_0x79f5e1['options']?_0x79f5e1[_0x4765('0x7')][_0x4765('0xb')]?_[_0x4765('0xc')](_0x79f5e1[_0x4765('0x7')][_0x4765('0xb')],function(_0x5dbd20){return{'model':db[_0x5dbd20['model']],'as':_0x5dbd20['as'],'attributes':_0x5dbd20['attributes'],'include':_0x5dbd20[_0x4765('0xb')]?_[_0x4765('0xc')](_0x5dbd20['include'],function(_0x2e9ba1){return{'model':db[_0x2e9ba1[_0x4765('0xd')]],'as':_0x2e9ba1['as'],'attributes':_0x2e9ba1[_0x4765('0x9')],'include':_0x2e9ba1[_0x4765('0xb')]?_[_0x4765('0xc')](_0x2e9ba1[_0x4765('0xb')],function(_0x194ddb){return{'model':db[_0x194ddb['model']],'as':_0x194ddb['as'],'attributes':_0x194ddb[_0x4765('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31d363){logger[_0x4765('0xe')]('GetInterval',_0x79f5e1);logger[_0x4765('0xf')]('GetInterval',_0x79f5e1,JSON[_0x4765('0x10')](_0x31d363));_0x6e3aaa(_0x31d363);})[_0x4765('0x11')](function(_0x5259ca){logger[_0x4765('0x12')](_0x4765('0x13'),_0x5259ca['message'],_0x79f5e1);_0x1d4951(_0x581b3[_0x4765('0x12')](0x1f4,_0x5259ca[_0x4765('0x14')]));});});};exports['ShowInterval']=function(_0x14f310){var _0x5eaf83=this;return new Promise(function(_0x4c7a52,_0x3bf359){return db[_0x4765('0x5')][_0x4765('0x15')]({'raw':_0x14f310[_0x4765('0x7')]?_0x14f310['options'][_0x4765('0x16')]===undefined?!![]:![]:!![],'where':_0x14f310[_0x4765('0x7')]?_0x14f310[_0x4765('0x7')][_0x4765('0x8')]||null:null,'attributes':_0x14f310[_0x4765('0x7')]?_0x14f310[_0x4765('0x7')][_0x4765('0x9')]||null:null,'include':_0x14f310[_0x4765('0x7')]?_0x14f310['options']['include']?_[_0x4765('0xc')](_0x14f310[_0x4765('0x7')][_0x4765('0xb')],function(_0x1ffd89){return{'model':db[_0x1ffd89[_0x4765('0xd')]],'as':_0x1ffd89['as'],'attributes':_0x1ffd89[_0x4765('0x9')],'include':_0x1ffd89[_0x4765('0xb')]?_[_0x4765('0xc')](_0x1ffd89[_0x4765('0xb')],function(_0x469087){return{'model':db[_0x469087['model']],'as':_0x469087['as'],'attributes':_0x469087[_0x4765('0x9')],'include':_0x469087[_0x4765('0xb')]?_[_0x4765('0xc')](_0x469087[_0x4765('0xb')],function(_0x117ba6){return{'model':db[_0x117ba6[_0x4765('0xd')]],'as':_0x117ba6['as'],'attributes':_0x117ba6[_0x4765('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bd307){logger[_0x4765('0xe')](_0x4765('0x17'),_0x14f310);logger['debug'](_0x4765('0x17'),_0x14f310,JSON[_0x4765('0x10')](_0x1bd307));_0x4c7a52(_0x1bd307);})[_0x4765('0x11')](function(_0x379fb7){logger['error'](_0x4765('0x17'),_0x379fb7['message'],_0x14f310);_0x3bf359(_0x5eaf83[_0x4765('0x12')](0x1f4,_0x379fb7['message']));});});};function checkArrayOfIntervals(_0x365166,_0x3b0017){var _0x481708=[];return db['Interval'][_0x4765('0x6')]({'where':{'id':_0x365166}})['then'](function(_0x239365){_0x481708=_0x239365;return Promise['all'](_0x481708[_0x4765('0xc')](function(_0x304d9a){return _0x304d9a[_0x4765('0x18')](_0x3b0017);}));})['then'](function(_0x4d21dd){var _0x3f781c=_0x4d21dd[_0x4765('0x19')](function(_0x391a72,_0x696b11){return _0x391a72||_0x696b11;},![]);logger[_0x4765('0xe')](util['format'](_0x4765('0x1a'),_0x481708[_0x4765('0xc')](function(_0x4941a0){return _0x4941a0[_0x4765('0x1b')];})[_0x4765('0x1c')](',\x20'),_0x481708[_0x4765('0xc')](function(_0x3b520c){return _0x3b520c['id'];})['join'](',\x20')));return _0x3f781c;});}function checkSingleInterval(_0x18c3eb,_0xcb97ca){return db[_0x4765('0x5')][_0x4765('0x1d')](_0x18c3eb)[_0x4765('0x1e')](function(_0x9e13d6){if(_0x9e13d6){logger[_0x4765('0xe')](util[_0x4765('0x1f')](_0x4765('0x20'),_0x9e13d6[_0x4765('0x1b')],_0x9e13d6['id']));return _0x9e13d6[_0x4765('0x18')](_0xcb97ca);}});}exports[_0x4765('0x21')]=function(_0x1f73cf){var _0x504d3e=_0x1f73cf[_0x4765('0x22')];var _0x1abf48=Array[_0x4765('0x23')](_0x1f73cf[_0x4765('0x24')])?_0x1f73cf[_0x4765('0x24')]:typeof _0x1f73cf[_0x4765('0x24')]===_0x4765('0x25')?[_0x1f73cf[_0x4765('0x24')]]:[];var _0xc6b4c=_0x1f73cf[_0x4765('0x26')]||undefined;var _0x1a6737=![];if(_0x1abf48[_0x4765('0x27')]){logger[_0x4765('0xe')](util[_0x4765('0x1f')](_0x4765('0x28'),_0x1abf48[_0x4765('0x1c')](';\x20')));}if(_0xc6b4c){logger[_0x4765('0xe')](util[_0x4765('0x1f')](_0x4765('0x29'),_0xc6b4c));}logger['debug'](_0x4765('0x2a'),_0x1a6737);logger['silly']('IntervalIftime',_0x1f73cf);return Promise['resolve']()[_0x4765('0x1e')](function(){if(Array['isArray'](_0x504d3e)){return checkArrayOfIntervals(_0x504d3e,_0xc6b4c);}else if(_0x504d3e){return checkSingleInterval(_0x504d3e,_0xc6b4c);}})[_0x4765('0x1e')](function(_0xea67a8){var _0x9bdb3a=_0x1abf48[_0x4765('0x19')](function(_0x383c8b,_0x444e72){return _0x383c8b||iftime(_0x444e72,_0xc6b4c);},![]);_0x1a6737=_0xea67a8||_0x9bdb3a;return _0x1a6737;})[_0x4765('0x11')](function(_0x583768){logger[_0x4765('0x12')](_0x4765('0x21'),_0x1f73cf,_0x583768);throw this[_0x4765('0x12')](0x1f4,_0x583768[_0x4765('0x14')]);});}; \ No newline at end of file +var _0x1ce1=['limit','include','model','attributes','map','then','info','debug','catch','error','message','ShowInterval','stringify','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','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','isArray','lodash','util','../../mysqldb','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where'];(function(_0x1f4c09,_0x75df9d){var _0x564684=function(_0x30bb1f){while(--_0x30bb1f){_0x1f4c09['push'](_0x1f4c09['shift']());}};_0x564684(++_0x75df9d);}(_0x1ce1,0x1ed));var _0x11ce=function(_0x5ecdb0,_0x507e96){_0x5ecdb0=_0x5ecdb0-0x0;var _0x2a1652=_0x1ce1[_0x5ecdb0];return _0x2a1652;};'use strict';var _=require(_0x11ce('0x0'));var util=require(_0x11ce('0x1'));var db=require(_0x11ce('0x2'))['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0x11ce('0x3'))(_0x11ce('0x4'));exports[_0x11ce('0x5')]=function(_0x5e17e9){var _0x4aa679=this;return new Promise(function(_0x2d059b,_0x3402ad){return db[_0x11ce('0x6')][_0x11ce('0x7')]({'raw':_0x5e17e9[_0x11ce('0x8')]?_0x5e17e9[_0x11ce('0x8')][_0x11ce('0x9')]===undefined?!![]:![]:!![],'where':_0x5e17e9[_0x11ce('0x8')]?_0x5e17e9['options'][_0x11ce('0xa')]||null:null,'attributes':_0x5e17e9[_0x11ce('0x8')]?_0x5e17e9[_0x11ce('0x8')]['attributes']||null:null,'limit':_0x5e17e9[_0x11ce('0x8')]?_0x5e17e9[_0x11ce('0x8')][_0x11ce('0xb')]||null:null,'include':_0x5e17e9['options']?_0x5e17e9[_0x11ce('0x8')][_0x11ce('0xc')]?_['map'](_0x5e17e9[_0x11ce('0x8')][_0x11ce('0xc')],function(_0x3701e5){return{'model':db[_0x3701e5[_0x11ce('0xd')]],'as':_0x3701e5['as'],'attributes':_0x3701e5[_0x11ce('0xe')],'include':_0x3701e5[_0x11ce('0xc')]?_[_0x11ce('0xf')](_0x3701e5[_0x11ce('0xc')],function(_0x5619c8){return{'model':db[_0x5619c8[_0x11ce('0xd')]],'as':_0x5619c8['as'],'attributes':_0x5619c8['attributes'],'include':_0x5619c8[_0x11ce('0xc')]?_[_0x11ce('0xf')](_0x5619c8[_0x11ce('0xc')],function(_0x40a8c7){return{'model':db[_0x40a8c7[_0x11ce('0xd')]],'as':_0x40a8c7['as'],'attributes':_0x40a8c7[_0x11ce('0xe')]};}):[]};}):[]};}):[]:[]})[_0x11ce('0x10')](function(_0x10b946){logger[_0x11ce('0x11')](_0x11ce('0x5'),_0x5e17e9);logger[_0x11ce('0x12')](_0x11ce('0x5'),_0x5e17e9,JSON['stringify'](_0x10b946));_0x2d059b(_0x10b946);})[_0x11ce('0x13')](function(_0x394f68){logger[_0x11ce('0x14')](_0x11ce('0x5'),_0x394f68['message'],_0x5e17e9);_0x3402ad(_0x4aa679[_0x11ce('0x14')](0x1f4,_0x394f68[_0x11ce('0x15')]));});});};exports[_0x11ce('0x16')]=function(_0x3668a7){var _0x1213f0=this;return new Promise(function(_0x13777f,_0x5a4a03){return db[_0x11ce('0x6')]['find']({'raw':_0x3668a7[_0x11ce('0x8')]?_0x3668a7[_0x11ce('0x8')][_0x11ce('0x9')]===undefined?!![]:![]:!![],'where':_0x3668a7['options']?_0x3668a7[_0x11ce('0x8')][_0x11ce('0xa')]||null:null,'attributes':_0x3668a7[_0x11ce('0x8')]?_0x3668a7[_0x11ce('0x8')][_0x11ce('0xe')]||null:null,'include':_0x3668a7[_0x11ce('0x8')]?_0x3668a7[_0x11ce('0x8')][_0x11ce('0xc')]?_['map'](_0x3668a7[_0x11ce('0x8')][_0x11ce('0xc')],function(_0x4f030e){return{'model':db[_0x4f030e['model']],'as':_0x4f030e['as'],'attributes':_0x4f030e[_0x11ce('0xe')],'include':_0x4f030e[_0x11ce('0xc')]?_[_0x11ce('0xf')](_0x4f030e[_0x11ce('0xc')],function(_0x2c1c16){return{'model':db[_0x2c1c16['model']],'as':_0x2c1c16['as'],'attributes':_0x2c1c16['attributes'],'include':_0x2c1c16[_0x11ce('0xc')]?_[_0x11ce('0xf')](_0x2c1c16[_0x11ce('0xc')],function(_0x4adaf6){return{'model':db[_0x4adaf6[_0x11ce('0xd')]],'as':_0x4adaf6['as'],'attributes':_0x4adaf6[_0x11ce('0xe')]};}):[]};}):[]};}):[]:[]})[_0x11ce('0x10')](function(_0x30370b){logger[_0x11ce('0x11')](_0x11ce('0x16'),_0x3668a7);logger[_0x11ce('0x12')](_0x11ce('0x16'),_0x3668a7,JSON[_0x11ce('0x17')](_0x30370b));_0x13777f(_0x30370b);})[_0x11ce('0x13')](function(_0x434b5d){logger[_0x11ce('0x14')](_0x11ce('0x16'),_0x434b5d['message'],_0x3668a7);_0x5a4a03(_0x1213f0[_0x11ce('0x14')](0x1f4,_0x434b5d[_0x11ce('0x15')]));});});};function checkArrayOfIntervals(_0x3fce8a,_0xc64b2d){var _0x389d0d=[];return db['Interval'][_0x11ce('0x7')]({'where':{'id':_0x3fce8a}})[_0x11ce('0x10')](function(_0x441778){_0x389d0d=_0x441778;return Promise[_0x11ce('0x18')](_0x389d0d['map'](function(_0x24b201){return _0x24b201[_0x11ce('0x19')](_0xc64b2d);}));})['then'](function(_0x56320e){var _0x1715ba=_0x56320e[_0x11ce('0x1a')](function(_0x35b47f,_0x4fbcf0){return _0x35b47f||_0x4fbcf0;},![]);logger[_0x11ce('0x11')](util[_0x11ce('0x1b')](_0x11ce('0x1c'),_0x389d0d[_0x11ce('0xf')](function(_0x47fade){return _0x47fade[_0x11ce('0x1d')];})['join'](',\x20'),_0x389d0d[_0x11ce('0xf')](function(_0x5485d5){return _0x5485d5['id'];})[_0x11ce('0x1e')](',\x20')));return _0x1715ba;});}function checkSingleInterval(_0x1d346a,_0x482c70){return db[_0x11ce('0x6')][_0x11ce('0x1f')](_0x1d346a)[_0x11ce('0x10')](function(_0x1b1698){if(_0x1b1698){logger[_0x11ce('0x11')](util[_0x11ce('0x1b')](_0x11ce('0x20'),_0x1b1698[_0x11ce('0x1d')],_0x1b1698['id']));return _0x1b1698[_0x11ce('0x19')](_0x482c70);}});}exports[_0x11ce('0x21')]=function(_0x119c82){var _0x4fa05b=_0x119c82[_0x11ce('0x22')];var _0x23a143=Array['isArray'](_0x119c82['intervals'])?_0x119c82[_0x11ce('0x23')]:typeof _0x119c82['intervals']===_0x11ce('0x24')?[_0x119c82[_0x11ce('0x23')]]:[];var _0x314724=_0x119c82['timezone']||undefined;var _0x271406=![];if(_0x23a143[_0x11ce('0x25')]){logger[_0x11ce('0x11')](util[_0x11ce('0x1b')](_0x11ce('0x26'),_0x23a143[_0x11ce('0x1e')](';\x20')));}if(_0x314724){logger[_0x11ce('0x11')](util[_0x11ce('0x1b')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x314724));}logger[_0x11ce('0x12')](_0x11ce('0x27'),_0x271406);logger[_0x11ce('0x28')](_0x11ce('0x21'),_0x119c82);return Promise['resolve']()['then'](function(){if(Array[_0x11ce('0x29')](_0x4fa05b)){return checkArrayOfIntervals(_0x4fa05b,_0x314724);}else if(_0x4fa05b){return checkSingleInterval(_0x4fa05b,_0x314724);}})[_0x11ce('0x10')](function(_0x582c3b){var _0x360379=_0x23a143[_0x11ce('0x1a')](function(_0x1325ed,_0x399ecb){return _0x1325ed||iftime(_0x399ecb,_0x314724);},![]);_0x271406=_0x582c3b||_0x360379;return _0x271406;})['catch'](function(_0x51cdb4){logger[_0x11ce('0x14')](_0x11ce('0x21'),_0x119c82,_0x51cdb4);throw this['error'](0x1f4,_0x51cdb4[_0x11ce('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 96608af..35ad3a1 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x0b0e,0x187));var _0xe0b0=function(_0x463697,_0xccfdc4){_0x463697=_0x463697-0x0;var _0x33cfe1=_0x0b0e[_0x463697];return _0x33cfe1;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x3e23dd,_0x2bdb68){var _0x5de564=function(_0x7d27fc){while(--_0x7d27fc){_0x3e23dd['push'](_0x3e23dd['shift']());}};_0x5de564(++_0x2bdb68);}(_0x2032,0xd9));var _0x2203=function(_0x43f709,_0x3aa3ed){_0x43f709=_0x43f709-0x0;var _0x361443=_0x2032[_0x43f709];return _0x361443;};'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 57cce78..2fd9d63 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 _0xabe9=['json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','../../config/logger','api','support','3eAmWpBVP0','summary','Report','\x20from\x20','description','stringify','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','setEncoding','end','status','statusCode','parse','error'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0xabe9,0x9c));var _0x9abe=function(_0x402438,_0x2e0303){_0x402438=_0x402438-0x0;var _0x39c138=_0xabe9[_0x402438];return _0x39c138;};'use strict';var BPromise=require(_0x9abe('0x0'));var https=require('https');var logger=require(_0x9abe('0x1'))(_0x9abe('0x2'));var USERNAME=_0x9abe('0x3');var PASSWORD=_0x9abe('0x4');function openIssue(_0x241d2b,_0x1a81a5){var _0x116909={'fields':{'project':{'key':_0x241d2b['key']||'MOTGUI'},'summary':(_0x241d2b[_0x9abe('0x5')]||_0x9abe('0x6'))+_0x9abe('0x7')+_0x241d2b['ip'],'description':_0x241d2b[_0x9abe('0x8')]||JSON[_0x9abe('0x9')](_0x241d2b),'issuetype':{'name':_0x241d2b['issuetype']||'Bug'}}};_0x116909[_0x9abe('0xa')][_0x9abe('0xb')]=_0x241d2b['email'];_0x116909[_0x9abe('0xa')]['customfield_11501']=_0x241d2b[_0x9abe('0xc')];_0x116909[_0x9abe('0xa')][_0x9abe('0xd')]=_0x241d2b[_0x9abe('0xe')];_0x116909[_0x9abe('0xa')][_0x9abe('0xf')]=_0x241d2b[_0x9abe('0x10')];_0x116909[_0x9abe('0xa')]['customfield_11504']=_0x241d2b['reason'];_0x116909[_0x9abe('0xa')][_0x9abe('0x11')]=_0x241d2b['ip'];var _0x49d9d5={'host':_0x9abe('0x12'),'port':0x1bb,'path':_0x9abe('0x13'),'method':_0x9abe('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x9abe('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x9abe('0x16')]('base64')}};var _0x7795fd=JSON['stringify'](_0x116909);var _0x2ce1d2=https['request'](_0x49d9d5,function(_0xa39e8b){_0xa39e8b[_0x9abe('0x17')]('utf8');var _0x528524='';_0xa39e8b['on']('data',function(_0x3d3c05){_0x528524+=_0x3d3c05;});_0xa39e8b['on'](_0x9abe('0x18'),function(){if(_0x1a81a5){return _0x1a81a5[_0x9abe('0x19')](_0xa39e8b[_0x9abe('0x1a')])['json'](JSON[_0x9abe('0x1b')](_0x528524));}});});_0x2ce1d2['on'](_0x9abe('0x1c'),function(_0x3a1fd9){if(_0x1a81a5){return _0x1a81a5[_0x9abe('0x19')](0x1f4)[_0x9abe('0x1d')]({'errors':[{'message':_0x9abe('0x1e'),'type':'api.jira'}]});}});_0x2ce1d2['write'](_0x7795fd);_0x2ce1d2['end']();}exports['openIssue']=openIssue;exports['send']=function(_0x1c3f32,_0x2cbf12){_0x1c3f32[_0x9abe('0x1f')]['ip']=_0x1c3f32[_0x9abe('0x20')][_0x9abe('0x21')]||_0x1c3f32['connection'][_0x9abe('0x22')]||_0x1c3f32[_0x9abe('0x23')]['remoteAddress']||_0x1c3f32[_0x9abe('0x24')]['socket'][_0x9abe('0x22')];return openIssue(_0x1c3f32[_0x9abe('0x1f')],_0x2cbf12);}; \ No newline at end of file +var _0xc7a7=['MOTGUI','summary','Report','\x20from\x20','description','Bug','fields','customfield_11500','email','oldToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','stringify','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key'];(function(_0x2e00f7,_0x4d54c6){var _0x25e0aa=function(_0x245fae){while(--_0x245fae){_0x2e00f7['push'](_0x2e00f7['shift']());}};_0x25e0aa(++_0x4d54c6);}(_0xc7a7,0x135));var _0x7c7a=function(_0x5368cb,_0x26ed7b){_0x5368cb=_0x5368cb-0x0;var _0x3989f9=_0xc7a7[_0x5368cb];return _0x3989f9;};'use strict';var BPromise=require(_0x7c7a('0x0'));var https=require(_0x7c7a('0x1'));var logger=require('../../config/logger')(_0x7c7a('0x2'));var USERNAME=_0x7c7a('0x3');var PASSWORD=_0x7c7a('0x4');function openIssue(_0x1b98aa,_0x2eb04b){var _0x5f1f0e={'fields':{'project':{'key':_0x1b98aa[_0x7c7a('0x5')]||_0x7c7a('0x6')},'summary':(_0x1b98aa[_0x7c7a('0x7')]||_0x7c7a('0x8'))+_0x7c7a('0x9')+_0x1b98aa['ip'],'description':_0x1b98aa[_0x7c7a('0xa')]||JSON['stringify'](_0x1b98aa),'issuetype':{'name':_0x1b98aa['issuetype']||_0x7c7a('0xb')}}};_0x5f1f0e[_0x7c7a('0xc')][_0x7c7a('0xd')]=_0x1b98aa[_0x7c7a('0xe')];_0x5f1f0e[_0x7c7a('0xc')]['customfield_11501']=_0x1b98aa[_0x7c7a('0xf')];_0x5f1f0e['fields']['customfield_11502']=_0x1b98aa['newToken'];_0x5f1f0e[_0x7c7a('0xc')]['customfield_11503']=_0x1b98aa[_0x7c7a('0x10')];_0x5f1f0e[_0x7c7a('0xc')][_0x7c7a('0x11')]=_0x1b98aa[_0x7c7a('0x12')];_0x5f1f0e[_0x7c7a('0xc')][_0x7c7a('0x13')]=_0x1b98aa['ip'];var _0x592ebb={'host':_0x7c7a('0x14'),'port':0x1bb,'path':_0x7c7a('0x15'),'method':_0x7c7a('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x7c7a('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x7c7a('0x18')](_0x7c7a('0x19'))}};var _0x3dec81=JSON[_0x7c7a('0x1a')](_0x5f1f0e);var _0x5c22c8=https['request'](_0x592ebb,function(_0xda56a6){_0xda56a6['setEncoding'](_0x7c7a('0x1b'));var _0x44fcbc='';_0xda56a6['on'](_0x7c7a('0x1c'),function(_0x4e7447){_0x44fcbc+=_0x4e7447;});_0xda56a6['on'](_0x7c7a('0x1d'),function(){if(_0x2eb04b){return _0x2eb04b[_0x7c7a('0x1e')](_0xda56a6[_0x7c7a('0x1f')])[_0x7c7a('0x20')](JSON[_0x7c7a('0x21')](_0x44fcbc));}});});_0x5c22c8['on'](_0x7c7a('0x22'),function(_0xeadbf6){if(_0x2eb04b){return _0x2eb04b['status'](0x1f4)[_0x7c7a('0x20')]({'errors':[{'message':_0x7c7a('0x23'),'type':'api.jira'}]});}});_0x5c22c8[_0x7c7a('0x24')](_0x3dec81);_0x5c22c8[_0x7c7a('0x1d')]();}exports[_0x7c7a('0x25')]=openIssue;exports[_0x7c7a('0x26')]=function(_0x2dded7,_0x304799){_0x2dded7[_0x7c7a('0x27')]['ip']=_0x2dded7[_0x7c7a('0x28')][_0x7c7a('0x29')]||_0x2dded7[_0x7c7a('0x2a')][_0x7c7a('0x2b')]||_0x2dded7['socket'][_0x7c7a('0x2b')]||_0x2dded7[_0x7c7a('0x2a')][_0x7c7a('0x2c')]['remoteAddress'];return openIssue(_0x2dded7[_0x7c7a('0x27')],_0x304799);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index c7c4810..8e9f809 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 _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x1e4794,_0x10e273){var _0x396565=function(_0x28dcba){while(--_0x28dcba){_0x1e4794['push'](_0x1e4794['shift']());}};_0x396565(++_0x10e273);}(_0x4522,0x1a0));var _0x2452=function(_0x1d9016,_0x84886){_0x1d9016=_0x1d9016-0x0;var _0x3ceec4=_0x4522[_0x1d9016];return _0x3ceec4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2452('0xf')]);router['put']('/:id',auth[_0x2452('0x9')](),controller[_0x2452('0x10')]);router[_0x2452('0x11')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x12')]);module[_0x2452('0x13')]=router; \ No newline at end of file +var _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x2d452b,_0x4a837a){var _0x2034b2=function(_0x4c9e02){while(--_0x4c9e02){_0x2d452b['push'](_0x2d452b['shift']());}};_0x2034b2(++_0x4a837a);}(_0x99e9,0xb4));var _0x999e=function(_0x8bf471,_0x2e9da0){_0x8bf471=_0x8bf471-0x0;var _0x3d93d7=_0x99e9[_0x8bf471];return _0x3d93d7;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index e4dfe42..ba6ce16 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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x7a54,0x106));var _0x47a5=function(_0x35fc92,_0x97efe7){_0x35fc92=_0x35fc92-0x0;var _0x3980d7=_0x7a54[_0x35fc92];return _0x3980d7;};'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(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7a54,0x106));var _0x47a5=function(_0x1b59e4,_0x36edbb){_0x1b59e4=_0x1b59e4-0x0;var _0x48ceb9=_0x7a54[_0x1b59e4];return _0x48ceb9;};'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 f4b5cc0..871ccc4 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 _0x1b20=['fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','params','includeAll','merge','find','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','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/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','JscriptyAnswerReport','rawAttributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1b20,0x66));var _0x01b2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1b20[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01b2('0x0'));var zipdir=require(_0x01b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x01b2('0x2'));var BPromise=require(_0x01b2('0x3'));var Mustache=require(_0x01b2('0x4'));var util=require(_0x01b2('0x5'));var path=require(_0x01b2('0x6'));var sox=require(_0x01b2('0x7'));var csv=require(_0x01b2('0x8'));var ejs=require(_0x01b2('0x9'));var fs=require('fs');var fs_extra=require(_0x01b2('0xa'));var _=require(_0x01b2('0xb'));var squel=require(_0x01b2('0xc'));var crypto=require(_0x01b2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x01b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x01b2('0xf'));var Papa=require(_0x01b2('0x10'));var Redis=require(_0x01b2('0x11'));var authService=require(_0x01b2('0x12'));var qs=require(_0x01b2('0x13'));var as=require(_0x01b2('0x14'));var hardwareService=require(_0x01b2('0x15'));var logger=require(_0x01b2('0x16'))('api');var utils=require(_0x01b2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x01b2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41a618,_0x8ac569){_0x8ac569=_0x8ac569||0xcc;return function(_0x2c6d4d){if(_0x2c6d4d){return _0x41a618[_0x01b2('0x19')](_0x8ac569);}return _0x41a618['status'](_0x8ac569)[_0x01b2('0x1a')]();};}function respondWithResult(_0x2e7b31,_0x4f1c15){_0x4f1c15=_0x4f1c15||0xc8;return function(_0x1626ba){if(_0x1626ba){return _0x2e7b31[_0x01b2('0x1b')](_0x4f1c15)['json'](_0x1626ba);}};}function respondWithFilteredResult(_0x299d0c,_0x3d5833){return function(_0x1a9734){if(_0x1a9734){var _0x3f68a8=typeof _0x3d5833['offset']==='undefined'&&typeof _0x3d5833[_0x01b2('0x1c')]===_0x01b2('0x1d');var _0x588dbe=_0x1a9734[_0x01b2('0x1e')];var _0x444236=_0x3f68a8?0x0:_0x3d5833[_0x01b2('0x1f')];var _0x5986f5=_0x3f68a8?_0x1a9734[_0x01b2('0x1e')]:_0x3d5833[_0x01b2('0x1f')]+_0x3d5833[_0x01b2('0x1c')];var _0xd2acbb;if(_0x5986f5>=_0x588dbe){_0x5986f5=_0x588dbe;_0xd2acbb=0xc8;}else{_0xd2acbb=0xce;}_0x299d0c[_0x01b2('0x1b')](_0xd2acbb);return _0x299d0c['set'](_0x01b2('0x20'),_0x444236+'-'+_0x5986f5+'/'+_0x588dbe)['json'](_0x1a9734);}return null;};}function patchUpdates(_0x7464e5){return function(_0x4c0008){try{jsonpatch[_0x01b2('0x21')](_0x4c0008,_0x7464e5,!![]);}catch(_0x266264){return BPromise[_0x01b2('0x22')](_0x266264);}return _0x4c0008['save']();};}function saveUpdates(_0x269b54,_0x2f01b0){return function(_0xc3027){if(_0xc3027){return _0xc3027[_0x01b2('0x23')](_0x269b54)[_0x01b2('0x24')](function(_0x479e94){return _0x479e94;});}return null;};}function removeEntity(_0x1874b9,_0x539db1){return function(_0x54e866){if(_0x54e866){return _0x54e866[_0x01b2('0x25')]()[_0x01b2('0x24')](function(){_0x1874b9[_0x01b2('0x1b')](0xcc)[_0x01b2('0x1a')]();});}};}function handleEntityNotFound(_0x2e32c1,_0x307229){return function(_0x4920f7){if(!_0x4920f7){_0x2e32c1[_0x01b2('0x19')](0x194);}return _0x4920f7;};}function handleError(_0x239543,_0x424cfd){_0x424cfd=_0x424cfd||0x1f4;return function(_0x17274f){logger['error'](_0x17274f[_0x01b2('0x26')]);if(_0x17274f['name']){delete _0x17274f[_0x01b2('0x27')];}_0x239543[_0x01b2('0x1b')](_0x424cfd)['send'](_0x17274f);};}exports[_0x01b2('0x28')]=function(_0x5efdda,_0x487c49){var _0x291d56={},_0x4363ec={},_0x5befbf={'count':0x0,'rows':[]};var _0x24ed7d=_[_0x01b2('0x29')](db[_0x01b2('0x2a')][_0x01b2('0x2b')],function(_0x3009a6){return{'name':_0x3009a6[_0x01b2('0x2c')],'type':_0x3009a6[_0x01b2('0x2d')][_0x01b2('0x2e')]};});_0x4363ec[_0x01b2('0x2f')]=_[_0x01b2('0x29')](_0x24ed7d,_0x01b2('0x27'));_0x4363ec['query']=_[_0x01b2('0x30')](_0x5efdda[_0x01b2('0x31')]);_0x4363ec[_0x01b2('0x32')]=_[_0x01b2('0x33')](_0x4363ec[_0x01b2('0x2f')],_0x4363ec[_0x01b2('0x31')]);_0x291d56['attributes']=_['intersection'](_0x4363ec[_0x01b2('0x2f')],qs['fields'](_0x5efdda['query'][_0x01b2('0x34')]));_0x291d56[_0x01b2('0x35')]=_0x291d56[_0x01b2('0x35')][_0x01b2('0x36')]?_0x291d56['attributes']:_0x4363ec[_0x01b2('0x2f')];if(!_0x5efdda['query'][_0x01b2('0x37')]('nolimit')){_0x291d56['limit']=qs['limit'](_0x5efdda[_0x01b2('0x31')][_0x01b2('0x1c')]);_0x291d56[_0x01b2('0x1f')]=qs[_0x01b2('0x1f')](_0x5efdda['query'][_0x01b2('0x1f')]);}_0x291d56[_0x01b2('0x38')]=qs['sort'](_0x5efdda[_0x01b2('0x31')][_0x01b2('0x39')]);_0x291d56[_0x01b2('0x3a')]=qs[_0x01b2('0x32')](_[_0x01b2('0x3b')](_0x5efdda[_0x01b2('0x31')],_0x4363ec['filters']),_0x24ed7d);if(_0x5efdda[_0x01b2('0x31')][_0x01b2('0x3c')]){_0x291d56['where']=_['merge'](_0x291d56[_0x01b2('0x3a')],{'$or':_[_0x01b2('0x29')](_0x24ed7d,function(_0x4555c8){if(_0x4555c8[_0x01b2('0x2d')]!==_0x01b2('0x3d')){var _0x3b0cc7={};_0x3b0cc7[_0x4555c8['name']]={'$like':'%'+_0x5efdda['query'][_0x01b2('0x3c')]+'%'};return _0x3b0cc7;}})});}_0x291d56=_['merge']({},_0x291d56,_0x5efdda[_0x01b2('0x3e')]);var _0x31878={'where':_0x291d56[_0x01b2('0x3a')]};return db[_0x01b2('0x2a')][_0x01b2('0x1e')](_0x31878)['then'](function(_0x279ce0){_0x5befbf[_0x01b2('0x1e')]=_0x279ce0;if(_0x5efdda[_0x01b2('0x31')]['includeAll']){_0x291d56[_0x01b2('0x3f')]=[{'all':!![]}];}return db[_0x01b2('0x2a')][_0x01b2('0x40')](_0x291d56);})['then'](function(_0x34f646){_0x5befbf['rows']=_0x34f646;return _0x5befbf;})[_0x01b2('0x24')](respondWithFilteredResult(_0x487c49,_0x291d56))[_0x01b2('0x41')](handleError(_0x487c49,null));};exports['show']=function(_0x2b5214,_0x3a36fc){var _0x4da4aa={'raw':!![],'where':{'id':_0x2b5214[_0x01b2('0x42')]['id']}},_0x2df2b6={};_0x2df2b6[_0x01b2('0x2f')]=_[_0x01b2('0x30')](db[_0x01b2('0x2a')]['rawAttributes']);_0x2df2b6[_0x01b2('0x31')]=_[_0x01b2('0x30')](_0x2b5214[_0x01b2('0x31')]);_0x2df2b6['filters']=_[_0x01b2('0x33')](_0x2df2b6[_0x01b2('0x2f')],_0x2df2b6[_0x01b2('0x31')]);_0x4da4aa[_0x01b2('0x35')]=_[_0x01b2('0x33')](_0x2df2b6[_0x01b2('0x2f')],qs[_0x01b2('0x34')](_0x2b5214[_0x01b2('0x31')]['fields']));_0x4da4aa[_0x01b2('0x35')]=_0x4da4aa[_0x01b2('0x35')][_0x01b2('0x36')]?_0x4da4aa[_0x01b2('0x35')]:_0x2df2b6[_0x01b2('0x2f')];if(_0x2b5214[_0x01b2('0x31')][_0x01b2('0x43')]){_0x4da4aa['include']=[{'all':!![]}];}_0x4da4aa=_[_0x01b2('0x44')]({},_0x4da4aa,_0x2b5214[_0x01b2('0x3e')]);return db[_0x01b2('0x2a')][_0x01b2('0x45')](_0x4da4aa)['then'](handleEntityNotFound(_0x3a36fc,null))['then'](respondWithResult(_0x3a36fc,null))[_0x01b2('0x41')](handleError(_0x3a36fc,null));};exports[_0x01b2('0x46')]=function(_0x404a65,_0x49370d){return db[_0x01b2('0x2a')][_0x01b2('0x46')](_0x404a65[_0x01b2('0x47')],{})[_0x01b2('0x24')](respondWithResult(_0x49370d,0xc9))[_0x01b2('0x41')](handleError(_0x49370d,null));};exports[_0x01b2('0x23')]=function(_0x5b54c5,_0x2a8b8d){if(_0x5b54c5['body']['id']){delete _0x5b54c5[_0x01b2('0x47')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x5b54c5[_0x01b2('0x42')]['id']}})[_0x01b2('0x24')](handleEntityNotFound(_0x2a8b8d,null))[_0x01b2('0x24')](saveUpdates(_0x5b54c5[_0x01b2('0x47')],null))[_0x01b2('0x24')](respondWithResult(_0x2a8b8d,null))['catch'](handleError(_0x2a8b8d,null));};exports['destroy']=function(_0x387954,_0x115557){return db[_0x01b2('0x2a')][_0x01b2('0x45')]({'where':{'id':_0x387954[_0x01b2('0x42')]['id']}})[_0x01b2('0x24')](handleEntityNotFound(_0x115557,null))['then'](removeEntity(_0x115557,null))[_0x01b2('0x41')](handleError(_0x115557,null));};exports[_0x01b2('0x48')]=function(_0x12ec87,_0x2b5bb5){return db[_0x01b2('0x2a')][_0x01b2('0x48')]()[_0x01b2('0x24')](respondWithResult(_0x2b5bb5,null))['catch'](handleError(_0x2b5bb5,null));}; \ No newline at end of file +var _0x6075=['end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','JscriptyAnswerReport','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x3921a2,_0x5e9bab){var _0x4687e9=function(_0x32f991){while(--_0x32f991){_0x3921a2['push'](_0x3921a2['shift']());}};_0x4687e9(++_0x5e9bab);}(_0x6075,0x191));var _0x5607=function(_0x31c78d,_0x594960){_0x31c78d=_0x31c78d-0x0;var _0x4fc2cb=_0x6075[_0x31c78d];return _0x4fc2cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5607('0x0'));var zipdir=require(_0x5607('0x1'));var jsonpatch=require(_0x5607('0x2'));var rp=require(_0x5607('0x3'));var moment=require(_0x5607('0x4'));var BPromise=require(_0x5607('0x5'));var Mustache=require(_0x5607('0x6'));var util=require(_0x5607('0x7'));var path=require(_0x5607('0x8'));var sox=require('sox');var csv=require(_0x5607('0x9'));var ejs=require(_0x5607('0xa'));var fs=require('fs');var fs_extra=require(_0x5607('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5607('0xc'));var jsforce=require(_0x5607('0xd'));var deskjs=require(_0x5607('0xe'));var toCsv=require(_0x5607('0x9'));var querystring=require(_0x5607('0xf'));var Papa=require('papaparse');var Redis=require(_0x5607('0x10'));var authService=require(_0x5607('0x11'));var qs=require(_0x5607('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5607('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5607('0x14'));var config=require(_0x5607('0x15'));var licenseUtil=require(_0x5607('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c8013,_0x42a405){_0x42a405=_0x42a405||0xcc;return function(_0xc534bd){if(_0xc534bd){return _0x2c8013[_0x5607('0x17')](_0x42a405);}return _0x2c8013[_0x5607('0x18')](_0x42a405)[_0x5607('0x19')]();};}function respondWithResult(_0x138d74,_0x1c8cbc){_0x1c8cbc=_0x1c8cbc||0xc8;return function(_0x2daf4c){if(_0x2daf4c){return _0x138d74['status'](_0x1c8cbc)[_0x5607('0x1a')](_0x2daf4c);}};}function respondWithFilteredResult(_0x275c5d,_0xe3e004){return function(_0x505b12){if(_0x505b12){var _0x556397=typeof _0xe3e004[_0x5607('0x1b')]==='undefined'&&typeof _0xe3e004[_0x5607('0x1c')]===_0x5607('0x1d');var _0x1fa238=_0x505b12[_0x5607('0x1e')];var _0x3eaaa0=_0x556397?0x0:_0xe3e004[_0x5607('0x1b')];var _0x55689e=_0x556397?_0x505b12[_0x5607('0x1e')]:_0xe3e004['offset']+_0xe3e004[_0x5607('0x1c')];var _0x3e071b;if(_0x55689e>=_0x1fa238){_0x55689e=_0x1fa238;_0x3e071b=0xc8;}else{_0x3e071b=0xce;}_0x275c5d[_0x5607('0x18')](_0x3e071b);return _0x275c5d['set'](_0x5607('0x1f'),_0x3eaaa0+'-'+_0x55689e+'/'+_0x1fa238)[_0x5607('0x1a')](_0x505b12);}return null;};}function patchUpdates(_0x303089){return function(_0x4e66f0){try{jsonpatch[_0x5607('0x20')](_0x4e66f0,_0x303089,!![]);}catch(_0x2fdc13){return BPromise[_0x5607('0x21')](_0x2fdc13);}return _0x4e66f0['save']();};}function saveUpdates(_0x44f7a2,_0x4feb1c){return function(_0x49f918){if(_0x49f918){return _0x49f918[_0x5607('0x22')](_0x44f7a2)[_0x5607('0x23')](function(_0x32d30a){return _0x32d30a;});}return null;};}function removeEntity(_0x2d983f,_0x351c32){return function(_0x34df69){if(_0x34df69){return _0x34df69[_0x5607('0x24')]()[_0x5607('0x23')](function(){_0x2d983f[_0x5607('0x18')](0xcc)[_0x5607('0x19')]();});}};}function handleEntityNotFound(_0x593df7,_0x20ae60){return function(_0x27e144){if(!_0x27e144){_0x593df7['sendStatus'](0x194);}return _0x27e144;};}function handleError(_0xa83081,_0x14dd08){_0x14dd08=_0x14dd08||0x1f4;return function(_0xdb07c8){logger[_0x5607('0x25')](_0xdb07c8[_0x5607('0x26')]);if(_0xdb07c8[_0x5607('0x27')]){delete _0xdb07c8[_0x5607('0x27')];}_0xa83081[_0x5607('0x18')](_0x14dd08)['send'](_0xdb07c8);};}exports[_0x5607('0x28')]=function(_0x309ede,_0x51b7d5){var _0x5932ae={},_0x12f58f={},_0x40f20e={'count':0x0,'rows':[]};var _0xe8788=_[_0x5607('0x29')](db[_0x5607('0x2a')]['rawAttributes'],function(_0x2575c3){return{'name':_0x2575c3['fieldName'],'type':_0x2575c3[_0x5607('0x2b')][_0x5607('0x2c')]};});_0x12f58f[_0x5607('0x2d')]=_['map'](_0xe8788,_0x5607('0x27'));_0x12f58f['query']=_[_0x5607('0x2e')](_0x309ede[_0x5607('0x2f')]);_0x12f58f[_0x5607('0x30')]=_[_0x5607('0x31')](_0x12f58f[_0x5607('0x2d')],_0x12f58f['query']);_0x5932ae[_0x5607('0x32')]=_['intersection'](_0x12f58f[_0x5607('0x2d')],qs[_0x5607('0x33')](_0x309ede['query'][_0x5607('0x33')]));_0x5932ae[_0x5607('0x32')]=_0x5932ae[_0x5607('0x32')]['length']?_0x5932ae[_0x5607('0x32')]:_0x12f58f[_0x5607('0x2d')];if(!_0x309ede[_0x5607('0x2f')][_0x5607('0x34')]('nolimit')){_0x5932ae[_0x5607('0x1c')]=qs[_0x5607('0x1c')](_0x309ede['query'][_0x5607('0x1c')]);_0x5932ae[_0x5607('0x1b')]=qs[_0x5607('0x1b')](_0x309ede['query'][_0x5607('0x1b')]);}_0x5932ae['order']=qs[_0x5607('0x35')](_0x309ede[_0x5607('0x2f')][_0x5607('0x35')]);_0x5932ae['where']=qs['filters'](_['pick'](_0x309ede[_0x5607('0x2f')],_0x12f58f[_0x5607('0x30')]),_0xe8788);if(_0x309ede[_0x5607('0x2f')][_0x5607('0x36')]){_0x5932ae[_0x5607('0x37')]=_[_0x5607('0x38')](_0x5932ae[_0x5607('0x37')],{'$or':_[_0x5607('0x29')](_0xe8788,function(_0x54cc53){if(_0x54cc53[_0x5607('0x2b')]!==_0x5607('0x39')){var _0x1671f0={};_0x1671f0[_0x54cc53[_0x5607('0x27')]]={'$like':'%'+_0x309ede['query'][_0x5607('0x36')]+'%'};return _0x1671f0;}})});}_0x5932ae=_[_0x5607('0x38')]({},_0x5932ae,_0x309ede['options']);var _0x4a5cef={'where':_0x5932ae[_0x5607('0x37')]};return db[_0x5607('0x2a')][_0x5607('0x1e')](_0x4a5cef)['then'](function(_0x562fa6){_0x40f20e['count']=_0x562fa6;if(_0x309ede[_0x5607('0x2f')][_0x5607('0x3a')]){_0x5932ae[_0x5607('0x3b')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x5607('0x3c')](_0x5932ae);})[_0x5607('0x23')](function(_0x458e15){_0x40f20e[_0x5607('0x3d')]=_0x458e15;return _0x40f20e;})[_0x5607('0x23')](respondWithFilteredResult(_0x51b7d5,_0x5932ae))[_0x5607('0x3e')](handleError(_0x51b7d5,null));};exports[_0x5607('0x3f')]=function(_0x5058b5,_0x57be05){var _0x2b34b4={'raw':!![],'where':{'id':_0x5058b5[_0x5607('0x40')]['id']}},_0x3b8397={};_0x3b8397['model']=_[_0x5607('0x2e')](db[_0x5607('0x2a')]['rawAttributes']);_0x3b8397[_0x5607('0x2f')]=_[_0x5607('0x2e')](_0x5058b5['query']);_0x3b8397['filters']=_[_0x5607('0x31')](_0x3b8397[_0x5607('0x2d')],_0x3b8397[_0x5607('0x2f')]);_0x2b34b4['attributes']=_[_0x5607('0x31')](_0x3b8397[_0x5607('0x2d')],qs['fields'](_0x5058b5[_0x5607('0x2f')][_0x5607('0x33')]));_0x2b34b4['attributes']=_0x2b34b4[_0x5607('0x32')][_0x5607('0x41')]?_0x2b34b4[_0x5607('0x32')]:_0x3b8397['model'];if(_0x5058b5[_0x5607('0x2f')][_0x5607('0x3a')]){_0x2b34b4[_0x5607('0x3b')]=[{'all':!![]}];}_0x2b34b4=_[_0x5607('0x38')]({},_0x2b34b4,_0x5058b5[_0x5607('0x42')]);return db['JscriptyAnswerReport'][_0x5607('0x43')](_0x2b34b4)[_0x5607('0x23')](handleEntityNotFound(_0x57be05,null))[_0x5607('0x23')](respondWithResult(_0x57be05,null))[_0x5607('0x3e')](handleError(_0x57be05,null));};exports[_0x5607('0x44')]=function(_0x51c1fc,_0x1a5483){return db['JscriptyAnswerReport'][_0x5607('0x44')](_0x51c1fc[_0x5607('0x45')],{})[_0x5607('0x23')](respondWithResult(_0x1a5483,0xc9))[_0x5607('0x3e')](handleError(_0x1a5483,null));};exports[_0x5607('0x22')]=function(_0x416060,_0x4a904b){if(_0x416060['body']['id']){delete _0x416060['body']['id'];}return db[_0x5607('0x2a')][_0x5607('0x43')]({'where':{'id':_0x416060['params']['id']}})[_0x5607('0x23')](handleEntityNotFound(_0x4a904b,null))[_0x5607('0x23')](saveUpdates(_0x416060[_0x5607('0x45')],null))[_0x5607('0x23')](respondWithResult(_0x4a904b,null))[_0x5607('0x3e')](handleError(_0x4a904b,null));};exports[_0x5607('0x24')]=function(_0xccd4f5,_0xf554a0){return db[_0x5607('0x2a')][_0x5607('0x43')]({'where':{'id':_0xccd4f5[_0x5607('0x40')]['id']}})[_0x5607('0x23')](handleEntityNotFound(_0xf554a0,null))[_0x5607('0x23')](removeEntity(_0xf554a0,null))[_0x5607('0x3e')](handleError(_0xf554a0,null));};exports[_0x5607('0x46')]=function(_0x3edc1d,_0x2955e8){return db['JscriptyAnswerReport'][_0x5607('0x46')]()['then'](respondWithResult(_0x2955e8,null))[_0x5607('0x3e')](handleError(_0x2955e8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e8fbd4a..ed0389a 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 _0x89bd=['exports','report_jscripty_answers','../../config/logger','api','moment','path','rimraf','./jscriptyAnswerReport.attributes'];(function(_0x2731df,_0x190651){var _0x222023=function(_0x4c2483){while(--_0x4c2483){_0x2731df['push'](_0x2731df['shift']());}};_0x222023(++_0x190651);}(_0x89bd,0x92));var _0xd89b=function(_0x44d603,_0x5f1356){_0x44d603=_0x44d603-0x0;var _0x382a7e=_0x89bd[_0x44d603];return _0x382a7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd89b('0x0'))(_0xd89b('0x1'));var moment=require(_0xd89b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd89b('0x3'));var rimraf=require(_0xd89b('0x4'));var config=require('../../config/environment');var attributes=require(_0xd89b('0x5'));module[_0xd89b('0x6')]=function(_0x381107,_0x534249){return _0x381107['define']('JscriptyAnswerReport',attributes,{'tableName':_0xd89b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfb8=['request-promise','path','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment'];(function(_0x5d4eec,_0x2126e6){var _0x208d98=function(_0x56a0cb){while(--_0x56a0cb){_0x5d4eec['push'](_0x5d4eec['shift']());}};_0x208d98(++_0x2126e6);}(_0xbfb8,0xf9));var _0x8bfb=function(_0x27b2ac,_0x4abdb6){_0x27b2ac=_0x27b2ac-0x0;var _0x3697a9=_0xbfb8[_0x27b2ac];return _0x3697a9;};'use strict';var _=require(_0x8bfb('0x0'));var util=require(_0x8bfb('0x1'));var logger=require('../../config/logger')(_0x8bfb('0x2'));var moment=require(_0x8bfb('0x3'));var BPromise=require('bluebird');var rp=require(_0x8bfb('0x4'));var fs=require('fs');var path=require(_0x8bfb('0x5'));var rimraf=require('rimraf');var config=require(_0x8bfb('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x8bfb('0x7')]=function(_0x5db7f4,_0x413c3c){return _0x5db7f4[_0x8bfb('0x8')](_0x8bfb('0x9'),attributes,{'tableName':_0x8bfb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 937b8ce..555b7f5 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 _0xc7d7=['code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xc7d7,0x139));var _0x7c7d=function(_0x84ed0d,_0x351465){_0x84ed0d=_0x84ed0d-0x0;var _0x169118=_0xc7d7[_0x84ed0d];return _0x169118;};'use strict';var _=require('lodash');var util=require(_0x7c7d('0x0'));var moment=require(_0x7c7d('0x1'));var BPromise=require(_0x7c7d('0x2'));var rs=require(_0x7c7d('0x3'));var fs=require('fs');var Redis=require(_0x7c7d('0x4'));var db=require(_0x7c7d('0x5'))['db'];var utils=require(_0x7c7d('0x6'));var logger=require(_0x7c7d('0x7'))(_0x7c7d('0x8'));var config=require(_0x7c7d('0x9'));var jayson=require(_0x7c7d('0xa'));var client=jayson['client'][_0x7c7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x367e1f,_0x2e280d,_0x5858cb){return new BPromise(function(_0x1f6b6f,_0x1f429b){return client['request'](_0x367e1f,_0x5858cb)['then'](function(_0x4e3b94){logger[_0x7c7d('0xc')](_0x7c7d('0xd'),_0x2e280d,_0x7c7d('0xe'));logger['debug'](_0x7c7d('0xf'),_0x2e280d,_0x7c7d('0xe'),JSON[_0x7c7d('0x10')](_0x4e3b94));if(_0x4e3b94['error']){if(_0x4e3b94['error'][_0x7c7d('0x11')]===0x1f4){logger[_0x7c7d('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2e280d,_0x4e3b94[_0x7c7d('0x12')][_0x7c7d('0x13')]);return _0x1f429b(_0x4e3b94['error'][_0x7c7d('0x13')]);}logger[_0x7c7d('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2e280d,_0x4e3b94[_0x7c7d('0x12')][_0x7c7d('0x13')]);return _0x1f6b6f(_0x4e3b94[_0x7c7d('0x12')][_0x7c7d('0x13')]);}else{logger[_0x7c7d('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2e280d,_0x7c7d('0xe'));_0x1f6b6f(_0x4e3b94[_0x7c7d('0x14')][_0x7c7d('0x13')]);}})[_0x7c7d('0x15')](function(_0x19519f){logger[_0x7c7d('0x12')](_0x7c7d('0xd'),_0x2e280d,_0x19519f);_0x1f429b(_0x19519f);});});} \ No newline at end of file +var _0xea08=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0xea08,0x1b6));var _0x8ea0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xea08[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8ea0('0x0'));var util=require('util');var moment=require(_0x8ea0('0x1'));var BPromise=require(_0x8ea0('0x2'));var rs=require(_0x8ea0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ea0('0x4'))['db'];var utils=require(_0x8ea0('0x5'));var logger=require(_0x8ea0('0x6'))('rpc');var config=require(_0x8ea0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8ea0('0x8')][_0x8ea0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x129514,_0xa365c5,_0x444a06){return new BPromise(function(_0x305305,_0x4e06c6){return client[_0x8ea0('0xa')](_0x129514,_0x444a06)[_0x8ea0('0xb')](function(_0x5f0403){logger[_0x8ea0('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xa365c5,_0x8ea0('0xd'));logger[_0x8ea0('0xe')](_0x8ea0('0xf'),_0xa365c5,_0x8ea0('0xd'),JSON[_0x8ea0('0x10')](_0x5f0403));if(_0x5f0403['error']){if(_0x5f0403[_0x8ea0('0x11')][_0x8ea0('0x12')]===0x1f4){logger[_0x8ea0('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xa365c5,_0x5f0403['error'][_0x8ea0('0x13')]);return _0x4e06c6(_0x5f0403[_0x8ea0('0x11')][_0x8ea0('0x13')]);}logger['error'](_0x8ea0('0x14'),_0xa365c5,_0x5f0403['error'][_0x8ea0('0x13')]);return _0x305305(_0x5f0403['error'][_0x8ea0('0x13')]);}else{logger['info'](_0x8ea0('0x14'),_0xa365c5,_0x8ea0('0xd'));_0x305305(_0x5f0403[_0x8ea0('0x15')]['message']);}})[_0x8ea0('0x16')](function(_0x400ba4){logger[_0x8ea0('0x11')](_0x8ea0('0x14'),_0xa365c5,_0x400ba4);_0x4e06c6(_0x400ba4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 2c47803..1970b7f 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 _0x483e=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','30s','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','util'];(function(_0x185774,_0x25f793){var _0x566d24=function(_0x3e5584){while(--_0x3e5584){_0x185774['push'](_0x185774['shift']());}};_0x566d24(++_0x25f793);}(_0x483e,0x1f2));var _0xe483=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0x483e[_0x3e21f4];return _0x40fc49;};'use strict';var multer=require(_0xe483('0x0'));var util=require(_0xe483('0x1'));var path=require(_0xe483('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe483('0x3'));var auth=require(_0xe483('0x4'));var interaction=require(_0xe483('0x5'));var config=require(_0xe483('0x6'));var controller=require(_0xe483('0x7'));router[_0xe483('0x8')]('/',auth[_0xe483('0x9')](),controller['index']);router['get'](_0xe483('0xa'),auth[_0xe483('0x9')](),controller[_0xe483('0xb')]);router[_0xe483('0x8')](_0xe483('0xc'),auth['isAuthenticated'](),controller[_0xe483('0xd')]);router['get'](_0xe483('0xe'),auth[_0xe483('0x9')](),controller['getAnswers']);router['get']('/:id/summary',auth[_0xe483('0x9')](),timeout(_0xe483('0xf')),controller['getSummary']);router[_0xe483('0x10')]('/',auth[_0xe483('0x9')](),controller[_0xe483('0x11')]);router[_0xe483('0x10')](_0xe483('0x12'),auth[_0xe483('0x9')](),controller[_0xe483('0x13')]);router[_0xe483('0x14')](_0xe483('0xa'),auth['isAuthenticated'](),controller[_0xe483('0x15')]);router[_0xe483('0x16')](_0xe483('0xa'),auth[_0xe483('0x9')](),controller[_0xe483('0x17')]);module[_0xe483('0x18')]=router; \ No newline at end of file +var _0x9f27=['post','create','put','/:id','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s'];(function(_0x567488,_0x14a925){var _0x3e9524=function(_0x42ee51){while(--_0x42ee51){_0x567488['push'](_0x567488['shift']());}};_0x3e9524(++_0x14a925);}(_0x9f27,0xe3));var _0x79f2=function(_0x45da96,_0x7b8876){_0x45da96=_0x45da96-0x0;var _0x192a94=_0x9f27[_0x45da96];return _0x192a94;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79f2('0x0'));var timeout=require(_0x79f2('0x1'));var express=require(_0x79f2('0x2'));var router=express[_0x79f2('0x3')]();var fs_extra=require(_0x79f2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x79f2('0x5'));var config=require(_0x79f2('0x6'));var controller=require('./jscriptyProject.controller');router[_0x79f2('0x7')]('/',auth[_0x79f2('0x8')](),controller[_0x79f2('0x9')]);router[_0x79f2('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x79f2('0x7')](_0x79f2('0xa'),auth[_0x79f2('0x8')](),controller[_0x79f2('0xb')]);router[_0x79f2('0x7')](_0x79f2('0xc'),auth[_0x79f2('0x8')](),controller['getAnswers']);router[_0x79f2('0x7')](_0x79f2('0xd'),auth[_0x79f2('0x8')](),timeout(_0x79f2('0xe')),controller['getSummary']);router[_0x79f2('0xf')]('/',auth[_0x79f2('0x8')](),controller[_0x79f2('0x10')]);router[_0x79f2('0xf')]('/:id/clone',auth[_0x79f2('0x8')](),controller['clone']);router[_0x79f2('0x11')](_0x79f2('0x12'),auth['isAuthenticated'](),controller[_0x79f2('0x13')]);router[_0x79f2('0x14')](_0x79f2('0x12'),auth[_0x79f2('0x8')](),controller[_0x79f2('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 3c37753..e6d1ee5 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 _0x1d64=['util','exports','STRING','name','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','format','getDataValue','BOOLEAN'];(function(_0x54a783,_0xa4585b){var _0x190c10=function(_0x3a6731){while(--_0x3a6731){_0x54a783['push'](_0x54a783['shift']());}};_0x190c10(++_0xa4585b);}(_0x1d64,0x126));var _0x41d6=function(_0x334f9a,_0x542f01){_0x334f9a=_0x334f9a-0x0;var _0x2b219d=_0x1d64[_0x334f9a];return _0x2b219d;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x41d6('0x0'));module[_0x41d6('0x1')]={'name':{'type':Sequelize[_0x41d6('0x2')],'unique':_0x41d6('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x41d6('0x4')](_0x41d6('0x5')),'set':function(_0x19bc9e){if(_[_0x41d6('0x6')](_0x19bc9e)){this['setDataValue'](_0x41d6('0x7'),JSON[_0x41d6('0x8')](_0x19bc9e));}else if(_[_0x41d6('0x9')](_0x19bc9e)){this[_0x41d6('0xa')](_0x41d6('0x7'),_0x19bc9e);}else{this[_0x41d6('0xa')](_0x41d6('0x7'),util[_0x41d6('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x41d6('0xc')]('name')||'',this[_0x41d6('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x41d6('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1f6f=['STRING','name','TEXT','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x308a1d,_0x3d379d){var _0x5eb875=function(_0x464dbe){while(--_0x464dbe){_0x308a1d['push'](_0x308a1d['shift']());}};_0x5eb875(++_0x3d379d);}(_0x1f6f,0xbf));var _0xf1f6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1f6f[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xf1f6('0x0'));var _=require('lodash');var util=require('util');module['exports']={'name':{'type':Sequelize[_0xf1f6('0x1')],'unique':_0xf1f6('0x2')},'description':{'type':Sequelize[_0xf1f6('0x1')]},'formData':{'type':Sequelize[_0xf1f6('0x3')]('long'),'set':function(_0x454df7){if(_['isObjectLike'](_0x454df7)){this['setDataValue']('formData',JSON[_0xf1f6('0x4')](_0x454df7));}else if(_[_0xf1f6('0x5')](_0x454df7)){this['setDataValue']('formData',_0x454df7);}else{this[_0xf1f6('0x6')]('formData',util[_0xf1f6('0x7')](_0xf1f6('0x8'),this[_0xf1f6('0x9')](_0xf1f6('0x2'))||'',this[_0xf1f6('0x9')](_0xf1f6('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf1f6('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d1047db..f2b9fad 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 _0x7fea=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Projects','UserProfileResource','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','JscriptyProject','findAll','rows','catch','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','omit','updatedAt','destroy','getSessions','findOne','JscriptySessionReport','pick','ProjectId','filter','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','startTime','starttime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','rimraf','request-promise','moment','bluebird','mustache','util','path','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/utils'];(function(_0x5cf5be,_0x31a10c){var _0x41c969=function(_0x1ee830){while(--_0x1ee830){_0x5cf5be['push'](_0x5cf5be['shift']());}};_0x41c969(++_0x31a10c);}(_0x7fea,0x149));var _0xa7fe=function(_0x245a00,_0xb4c70b){_0x245a00=_0x245a00-0x0;var _0x26617f=_0x7fea[_0x245a00];return _0x26617f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7fe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa7fe('0x1'));var moment=require(_0xa7fe('0x2'));var BPromise=require(_0xa7fe('0x3'));var Mustache=require(_0xa7fe('0x4'));var util=require(_0xa7fe('0x5'));var path=require(_0xa7fe('0x6'));var sox=require('sox');var csv=require(_0xa7fe('0x7'));var ejs=require(_0xa7fe('0x8'));var fs=require('fs');var fs_extra=require(_0xa7fe('0x9'));var _=require(_0xa7fe('0xa'));var squel=require(_0xa7fe('0xb'));var crypto=require(_0xa7fe('0xc'));var jsforce=require(_0xa7fe('0xd'));var deskjs=require(_0xa7fe('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa7fe('0xf'));var Redis=require(_0xa7fe('0x10'));var authService=require(_0xa7fe('0x11'));var qs=require(_0xa7fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7fe('0x13'));var logger=require(_0xa7fe('0x14'))('api');var utils=require(_0xa7fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa7fe('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50a806,_0x3005d3){_0x3005d3=_0x3005d3||0xcc;return function(_0x26dde5){if(_0x26dde5){return _0x50a806[_0xa7fe('0x17')](_0x3005d3);}return _0x50a806[_0xa7fe('0x18')](_0x3005d3)[_0xa7fe('0x19')]();};}function respondWithResult(_0x5a4975,_0x49e7cb){_0x49e7cb=_0x49e7cb||0xc8;return function(_0x215d4c){if(_0x215d4c){return _0x5a4975[_0xa7fe('0x18')](_0x49e7cb)[_0xa7fe('0x1a')](_0x215d4c);}};}function respondWithFilteredResult(_0x43ae73,_0x34490e){return function(_0x5df0e3){if(_0x5df0e3){var _0x137dc9=typeof _0x34490e[_0xa7fe('0x1b')]===_0xa7fe('0x1c')&&typeof _0x34490e[_0xa7fe('0x1d')]===_0xa7fe('0x1c');var _0x4ac6eb=_0x5df0e3[_0xa7fe('0x1e')];var _0x1e4966=_0x137dc9?0x0:_0x34490e[_0xa7fe('0x1b')];var _0x2ef53c=_0x137dc9?_0x5df0e3[_0xa7fe('0x1e')]:_0x34490e[_0xa7fe('0x1b')]+_0x34490e[_0xa7fe('0x1d')];var _0x5e769d;if(_0x2ef53c>=_0x4ac6eb){_0x2ef53c=_0x4ac6eb;_0x5e769d=0xc8;}else{_0x5e769d=0xce;}_0x43ae73['status'](_0x5e769d);return _0x43ae73[_0xa7fe('0x1f')](_0xa7fe('0x20'),_0x1e4966+'-'+_0x2ef53c+'/'+_0x4ac6eb)[_0xa7fe('0x1a')](_0x5df0e3);}return null;};}function patchUpdates(_0x529990){return function(_0x1d33d2){try{jsonpatch[_0xa7fe('0x21')](_0x1d33d2,_0x529990,!![]);}catch(_0x189ada){return BPromise['reject'](_0x189ada);}return _0x1d33d2[_0xa7fe('0x22')]();};}function saveUpdates(_0x19b408,_0x1619c1){return function(_0x13e31e){if(_0x13e31e){return _0x13e31e[_0xa7fe('0x23')](_0x19b408)[_0xa7fe('0x24')](function(_0x2bc7fd){return _0x2bc7fd;});}return null;};}function removeEntity(_0x1043bf,_0x4ac7e0){return function(_0x3415b8){if(_0x3415b8){return _0x3415b8['destroy']()['then'](function(){var _0x37c8fa=_0x3415b8[_0xa7fe('0x25')]({'plain':!![]});var _0x24ec1b=_0xa7fe('0x26');return db[_0xa7fe('0x27')]['destroy']({'where':{'type':_0x24ec1b,'resourceId':_0x37c8fa['id']}})[_0xa7fe('0x24')](function(){return _0x3415b8;});})[_0xa7fe('0x24')](function(){_0x1043bf[_0xa7fe('0x18')](0xcc)[_0xa7fe('0x19')]();});}};}function handleEntityNotFound(_0x26e5a4,_0x146a74){return function(_0x11aff3){if(!_0x11aff3){_0x26e5a4[_0xa7fe('0x17')](0x194);}return _0x11aff3;};}function handleError(_0x9d5272,_0x3c3f91){_0x3c3f91=_0x3c3f91||0x1f4;return function(_0x44ba8a){logger[_0xa7fe('0x28')](_0x44ba8a[_0xa7fe('0x29')]);if(_0x44ba8a[_0xa7fe('0x2a')]){delete _0x44ba8a[_0xa7fe('0x2a')];}_0x9d5272[_0xa7fe('0x18')](_0x3c3f91)[_0xa7fe('0x2b')](_0x44ba8a);};}exports[_0xa7fe('0x2c')]=function(_0x1c9e5a,_0x429df4){var _0x5bd01d={},_0x3f900a={},_0x3198f9={'count':0x0,'rows':[]};var _0x5bde8b=_['map'](db['JscriptyProject'][_0xa7fe('0x2d')],function(_0x293405){return{'name':_0x293405['fieldName'],'type':_0x293405[_0xa7fe('0x2e')][_0xa7fe('0x2f')]};});_0x3f900a[_0xa7fe('0x30')]=_[_0xa7fe('0x31')](_0x5bde8b,_0xa7fe('0x2a'));_0x3f900a[_0xa7fe('0x32')]=_[_0xa7fe('0x33')](_0x1c9e5a[_0xa7fe('0x32')]);_0x3f900a[_0xa7fe('0x34')]=_['intersection'](_0x3f900a[_0xa7fe('0x30')],_0x3f900a['query']);_0x5bd01d[_0xa7fe('0x35')]=_[_0xa7fe('0x36')](_0x3f900a[_0xa7fe('0x30')],qs['fields'](_0x1c9e5a[_0xa7fe('0x32')][_0xa7fe('0x37')]));_0x5bd01d[_0xa7fe('0x35')]=_0x5bd01d[_0xa7fe('0x35')]['length']?_0x5bd01d[_0xa7fe('0x35')]:_0x3f900a[_0xa7fe('0x30')];if(!_0x1c9e5a['query'][_0xa7fe('0x38')](_0xa7fe('0x39'))){_0x5bd01d[_0xa7fe('0x1d')]=qs[_0xa7fe('0x1d')](_0x1c9e5a[_0xa7fe('0x32')][_0xa7fe('0x1d')]);_0x5bd01d[_0xa7fe('0x1b')]=qs[_0xa7fe('0x1b')](_0x1c9e5a[_0xa7fe('0x32')][_0xa7fe('0x1b')]);}_0x5bd01d[_0xa7fe('0x3a')]=qs[_0xa7fe('0x3b')](_0x1c9e5a[_0xa7fe('0x32')][_0xa7fe('0x3b')]);_0x5bd01d[_0xa7fe('0x3c')]=qs[_0xa7fe('0x34')](_['pick'](_0x1c9e5a['query'],_0x3f900a[_0xa7fe('0x34')]),_0x5bde8b);if(_0x1c9e5a[_0xa7fe('0x32')]['filter']){_0x5bd01d[_0xa7fe('0x3c')]=_[_0xa7fe('0x3d')](_0x5bd01d['where'],{'$or':_[_0xa7fe('0x31')](_0x5bde8b,function(_0x228590){if(_0x228590[_0xa7fe('0x2e')]!==_0xa7fe('0x3e')){var _0x463947={};_0x463947[_0x228590[_0xa7fe('0x2a')]]={'$like':'%'+_0x1c9e5a[_0xa7fe('0x32')]['filter']+'%'};return _0x463947;}})});}_0x5bd01d=_[_0xa7fe('0x3d')]({},_0x5bd01d,_0x1c9e5a[_0xa7fe('0x3f')]);var _0x2c6197={'where':_0x5bd01d[_0xa7fe('0x3c')]};return db['JscriptyProject'][_0xa7fe('0x1e')](_0x2c6197)[_0xa7fe('0x24')](function(_0x66671){_0x3198f9[_0xa7fe('0x1e')]=_0x66671;if(_0x1c9e5a[_0xa7fe('0x32')][_0xa7fe('0x40')]){_0x5bd01d[_0xa7fe('0x41')]=[{'all':!![]}];}return db[_0xa7fe('0x42')][_0xa7fe('0x43')](_0x5bd01d);})[_0xa7fe('0x24')](function(_0x241b13){_0x3198f9[_0xa7fe('0x44')]=_0x241b13;return _0x3198f9;})[_0xa7fe('0x24')](respondWithFilteredResult(_0x429df4,_0x5bd01d))[_0xa7fe('0x45')](handleError(_0x429df4,null));};exports['show']=function(_0x5c3a64,_0x5ab950){var _0x48d6f6={'raw':![],'where':{'id':_0x5c3a64[_0xa7fe('0x46')]['id']}},_0x24d943={};_0x24d943[_0xa7fe('0x30')]=_[_0xa7fe('0x33')](db[_0xa7fe('0x42')][_0xa7fe('0x2d')]);_0x24d943[_0xa7fe('0x32')]=_[_0xa7fe('0x33')](_0x5c3a64['query']);_0x24d943[_0xa7fe('0x34')]=_[_0xa7fe('0x36')](_0x24d943[_0xa7fe('0x30')],_0x24d943['query']);_0x48d6f6[_0xa7fe('0x35')]=_[_0xa7fe('0x36')](_0x24d943['model'],qs[_0xa7fe('0x37')](_0x5c3a64[_0xa7fe('0x32')][_0xa7fe('0x37')]));_0x48d6f6[_0xa7fe('0x35')]=_0x48d6f6['attributes'][_0xa7fe('0x47')]?_0x48d6f6[_0xa7fe('0x35')]:_0x24d943['model'];if(_0x5c3a64[_0xa7fe('0x32')]['includeAll']){_0x48d6f6[_0xa7fe('0x41')]=[{'all':!![]}];}_0x48d6f6=_[_0xa7fe('0x3d')]({},_0x48d6f6,_0x5c3a64[_0xa7fe('0x3f')]);return db['JscriptyProject'][_0xa7fe('0x48')](_0x48d6f6)[_0xa7fe('0x24')](handleEntityNotFound(_0x5ab950,null))['then'](respondWithResult(_0x5ab950,null))[_0xa7fe('0x45')](handleError(_0x5ab950,null));};exports['create']=function(_0x1d9ad4,_0x58cbec){return db[_0xa7fe('0x42')][_0xa7fe('0x49')](_0x1d9ad4[_0xa7fe('0x4a')],{})[_0xa7fe('0x24')](function(_0x41124a){var _0x5ecc9a=_0x1d9ad4['user'][_0xa7fe('0x25')]({'plain':!![]});if(!_0x5ecc9a)throw new Error(_0xa7fe('0x4b'));if(_0x5ecc9a[_0xa7fe('0x4c')]===_0xa7fe('0x4d')){var _0xf316c8=_0x41124a['get']({'plain':!![]});var _0x4e2918=_0xa7fe('0x26');return db[_0xa7fe('0x4e')]['find']({'where':{'name':_0x4e2918,'userProfileId':_0x5ecc9a[_0xa7fe('0x4f')]},'raw':!![]})['then'](function(_0x37d9c3){if(_0x37d9c3&&_0x37d9c3[_0xa7fe('0x50')]===0x0){return db[_0xa7fe('0x27')]['create']({'name':_0xf316c8['name'],'resourceId':_0xf316c8['id'],'type':_0x37d9c3[_0xa7fe('0x2a')],'sectionId':_0x37d9c3['id']},{})['then'](function(){return _0x41124a;});}else{return _0x41124a;}})['catch'](function(_0x1ebeb5){logger[_0xa7fe('0x28')](_0xa7fe('0x51'),_0x1ebeb5);throw _0x1ebeb5;});}return _0x41124a;})[_0xa7fe('0x24')](respondWithResult(_0x58cbec,0xc9))[_0xa7fe('0x45')](handleError(_0x58cbec,null));};exports['clone']=function(_0x241090,_0xae7bea){var _0x418e7f={'where':{'id':_0x241090['params']['id']}},_0x10a287={};_0x10a287['model']=_['keys'](db[_0xa7fe('0x42')]['rawAttributes']);_0x418e7f[_0xa7fe('0x35')]=_[_0xa7fe('0x36')](_0x10a287[_0xa7fe('0x30')],qs[_0xa7fe('0x37')](_0x241090[_0xa7fe('0x32')][_0xa7fe('0x37')]));_0x418e7f['attributes']=_0x418e7f['attributes'][_0xa7fe('0x47')]?_0x418e7f[_0xa7fe('0x35')]:_0x10a287[_0xa7fe('0x30')];if(_0x241090['query'][_0xa7fe('0x40')]){_0x418e7f[_0xa7fe('0x41')]=[{'all':!![]}];}_0x418e7f=_[_0xa7fe('0x3d')]({},_0x418e7f,_0x241090['options']);return db[_0xa7fe('0x42')][_0xa7fe('0x48')](_0x418e7f)[_0xa7fe('0x24')](handleEntityNotFound(_0xae7bea,null))[_0xa7fe('0x24')](function(_0x40f888){if(_0x40f888){var _0x3ed6e9=_0x40f888[_0xa7fe('0x25')]({'plain':!![]});_0x3ed6e9=qs['omit'](_0x3ed6e9,['id',_0xa7fe('0x52'),'updatedAt']);_0x241090[_0xa7fe('0x4a')]=_[_0xa7fe('0x53')](_0x241090[_0xa7fe('0x4a')],['id',_0xa7fe('0x52'),_0xa7fe('0x54')]);return db[_0xa7fe('0x42')][_0xa7fe('0x49')](_[_0xa7fe('0x3d')](_0x3ed6e9,_0x241090[_0xa7fe('0x4a')]),{'include':_0x241090[_0xa7fe('0x32')][_0xa7fe('0x40')]?[{'all':!![]}]:undefined})[_0xa7fe('0x24')](function(_0x410674){var _0x5262de=_0x241090[_0xa7fe('0x4d')][_0xa7fe('0x25')]({'plain':!![]});if(!_0x5262de)throw new Error(_0xa7fe('0x4b'));if(_0x5262de[_0xa7fe('0x4c')]===_0xa7fe('0x4d')){var _0x39a947=_0x410674[_0xa7fe('0x25')]({'plain':!![]});var _0x4d624c=_0xa7fe('0x26');return db['UserProfileSection'][_0xa7fe('0x48')]({'where':{'name':_0x4d624c,'userProfileId':_0x5262de[_0xa7fe('0x4f')]},'raw':!![]})[_0xa7fe('0x24')](function(_0x1d7eca){if(_0x1d7eca&&_0x1d7eca[_0xa7fe('0x50')]===0x0){return db['UserProfileResource'][_0xa7fe('0x49')]({'name':_0x39a947[_0xa7fe('0x2a')],'resourceId':_0x39a947['id'],'type':_0x1d7eca['name'],'sectionId':_0x1d7eca['id']},{})[_0xa7fe('0x24')](function(){return _0x410674;});}else{return _0x410674;}})[_0xa7fe('0x45')](function(_0x4a88d2){logger[_0xa7fe('0x28')](_0xa7fe('0x51'),_0x4a88d2);throw _0x4a88d2;});}return _0x410674;});}})[_0xa7fe('0x24')](respondWithResult(_0xae7bea,0xc9))[_0xa7fe('0x45')](handleError(_0xae7bea,null));};exports[_0xa7fe('0x23')]=function(_0x5050b2,_0x2c5241){if(_0x5050b2[_0xa7fe('0x4a')]['id']){delete _0x5050b2[_0xa7fe('0x4a')]['id'];}return db[_0xa7fe('0x42')][_0xa7fe('0x48')]({'where':{'id':_0x5050b2[_0xa7fe('0x46')]['id']}})[_0xa7fe('0x24')](handleEntityNotFound(_0x2c5241,null))[_0xa7fe('0x24')](saveUpdates(_0x5050b2[_0xa7fe('0x4a')],null))['then'](respondWithResult(_0x2c5241,null))[_0xa7fe('0x45')](handleError(_0x2c5241,null));};exports[_0xa7fe('0x55')]=function(_0x5356d8,_0x2ae0fa){return db['JscriptyProject'][_0xa7fe('0x48')]({'where':{'id':_0x5356d8[_0xa7fe('0x46')]['id']}})[_0xa7fe('0x24')](handleEntityNotFound(_0x2ae0fa,null))[_0xa7fe('0x24')](removeEntity(_0x2ae0fa,null))['catch'](handleError(_0x2ae0fa,null));};exports[_0xa7fe('0x56')]=function(_0x1d6398,_0x237d8c,_0x1d4e4a){var _0x4b767a={'raw':!![],'where':{}};var _0x8e04bf={};var _0x175489={'count':0x0,'rows':[]};return db[_0xa7fe('0x42')][_0xa7fe('0x57')]({'where':{'id':_0x1d6398[_0xa7fe('0x46')]['id']}})[_0xa7fe('0x24')](handleEntityNotFound(_0x237d8c,null))[_0xa7fe('0x24')](function(_0x2c15fc){if(_0x2c15fc){_0x8e04bf[_0xa7fe('0x30')]=_[_0xa7fe('0x33')](db[_0xa7fe('0x58')][_0xa7fe('0x2d')]);_0x8e04bf[_0xa7fe('0x32')]=_[_0xa7fe('0x33')](_0x1d6398['query']);_0x8e04bf[_0xa7fe('0x34')]=_[_0xa7fe('0x36')](_0x8e04bf[_0xa7fe('0x30')],_0x8e04bf['query']);_0x4b767a[_0xa7fe('0x35')]=_['intersection'](_0x8e04bf[_0xa7fe('0x30')],qs['fields'](_0x1d6398[_0xa7fe('0x32')]['fields']));_0x4b767a['attributes']=_0x4b767a[_0xa7fe('0x35')][_0xa7fe('0x47')]?_0x4b767a['attributes']:_0x8e04bf[_0xa7fe('0x30')];if(!_0x1d6398['query']['hasOwnProperty']('nolimit')){_0x4b767a[_0xa7fe('0x1d')]=qs['limit'](_0x1d6398[_0xa7fe('0x32')][_0xa7fe('0x1d')]);_0x4b767a[_0xa7fe('0x1b')]=qs[_0xa7fe('0x1b')](_0x1d6398['query'][_0xa7fe('0x1b')]);}_0x4b767a[_0xa7fe('0x3a')]=qs['sort'](_0x1d6398[_0xa7fe('0x32')][_0xa7fe('0x3b')]);_0x4b767a['where']=qs[_0xa7fe('0x34')](_[_0xa7fe('0x59')](_0x1d6398['query'],_0x8e04bf[_0xa7fe('0x34')]));_0x4b767a[_0xa7fe('0x3c')][_0xa7fe('0x5a')]=_0x2c15fc['id'];if(_0x1d6398[_0xa7fe('0x32')][_0xa7fe('0x5b')]){_0x4b767a[_0xa7fe('0x3c')]=_[_0xa7fe('0x3d')](_0x4b767a['where'],{'$or':_['map'](_0x4b767a[_0xa7fe('0x35')],function(_0x3f8b5a){var _0x484114={};_0x484114[_0x3f8b5a]={'$like':'%'+_0x1d6398[_0xa7fe('0x32')][_0xa7fe('0x5b')]+'%'};return _0x484114;})});}_0x4b767a=_[_0xa7fe('0x3d')]({},_0x4b767a,_0x1d6398[_0xa7fe('0x3f')]);return db['JscriptySessionReport'][_0xa7fe('0x1e')]({'where':_0x4b767a[_0xa7fe('0x3c')]})['then'](function(_0x63d1cf){_0x175489[_0xa7fe('0x1e')]=_0x63d1cf;if(_0x1d6398[_0xa7fe('0x32')][_0xa7fe('0x40')]){_0x4b767a[_0xa7fe('0x41')]=[{'all':!![]}];}return db[_0xa7fe('0x58')][_0xa7fe('0x43')](_0x4b767a);})['then'](function(_0x408768){_0x175489[_0xa7fe('0x44')]=_0x408768;return _0x175489;});}})[_0xa7fe('0x24')](respondWithFilteredResult(_0x237d8c,_0x4b767a))[_0xa7fe('0x45')](handleError(_0x237d8c,null));};exports['getAnswers']=function(_0x21b9f7,_0x367f55,_0x1f48df){var _0x14916b={'raw':!![],'where':{}};var _0x295e0a={};var _0x427cfb={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x21b9f7[_0xa7fe('0x46')]['id']}})[_0xa7fe('0x24')](handleEntityNotFound(_0x367f55,null))[_0xa7fe('0x24')](function(_0x81c253){if(_0x81c253){_0x295e0a[_0xa7fe('0x30')]=_[_0xa7fe('0x33')](db[_0xa7fe('0x5c')][_0xa7fe('0x2d')]);_0x295e0a[_0xa7fe('0x32')]=_['keys'](_0x21b9f7[_0xa7fe('0x32')]);_0x295e0a['filters']=_[_0xa7fe('0x36')](_0x295e0a[_0xa7fe('0x30')],_0x295e0a[_0xa7fe('0x32')]);_0x14916b[_0xa7fe('0x35')]=_[_0xa7fe('0x36')](_0x295e0a[_0xa7fe('0x30')],qs['fields'](_0x21b9f7[_0xa7fe('0x32')]['fields']));_0x14916b[_0xa7fe('0x35')]=_0x14916b['attributes']['length']?_0x14916b[_0xa7fe('0x35')]:_0x295e0a[_0xa7fe('0x30')];if(!_0x21b9f7['query'][_0xa7fe('0x38')](_0xa7fe('0x39'))){_0x14916b['limit']=qs[_0xa7fe('0x1d')](_0x21b9f7[_0xa7fe('0x32')][_0xa7fe('0x1d')]);_0x14916b[_0xa7fe('0x1b')]=qs['offset'](_0x21b9f7['query'][_0xa7fe('0x1b')]);}_0x14916b['order']=qs[_0xa7fe('0x3b')](_0x21b9f7[_0xa7fe('0x32')][_0xa7fe('0x3b')]);_0x14916b[_0xa7fe('0x3c')]=qs[_0xa7fe('0x34')](_[_0xa7fe('0x59')](_0x21b9f7[_0xa7fe('0x32')],_0x295e0a[_0xa7fe('0x34')]));_0x14916b[_0xa7fe('0x3c')][_0xa7fe('0x5a')]=_0x81c253['id'];if(_0x21b9f7[_0xa7fe('0x32')][_0xa7fe('0x5b')]){_0x14916b[_0xa7fe('0x3c')]=_[_0xa7fe('0x3d')](_0x14916b[_0xa7fe('0x3c')],{'$or':_[_0xa7fe('0x31')](_0x14916b[_0xa7fe('0x35')],function(_0x1027e5){var _0x90f882={};_0x90f882[_0x1027e5]={'$like':'%'+_0x21b9f7[_0xa7fe('0x32')][_0xa7fe('0x5b')]+'%'};return _0x90f882;})});}_0x14916b=_[_0xa7fe('0x3d')]({},_0x14916b,_0x21b9f7[_0xa7fe('0x3f')]);return db[_0xa7fe('0x5c')]['count']({'where':_0x14916b[_0xa7fe('0x3c')]})[_0xa7fe('0x24')](function(_0x27beb1){_0x427cfb[_0xa7fe('0x1e')]=_0x27beb1;if(_0x21b9f7[_0xa7fe('0x32')][_0xa7fe('0x40')]){_0x14916b[_0xa7fe('0x41')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa7fe('0x43')](_0x14916b);})[_0xa7fe('0x24')](function(_0x51b335){_0x427cfb['rows']=_0x51b335;return _0x427cfb;});}})['then'](respondWithFilteredResult(_0x367f55,_0x14916b))['catch'](handleError(_0x367f55,null));};function char(_0x4ad192){return _0xa7fe('0x5d')===typeof _0x4ad192?String[_0xa7fe('0x5e')]['apply'](null,arguments):_0x4ad192;}function needsEncapsulation(_0x2e909a){return!!_0x2e909a&&(_0x2e909a['toString']()[_0xa7fe('0x5f')](char(0xd))>=0x0||_0x2e909a['toString']()[_0xa7fe('0x5f')](char(0xa))>=0x0||_0x2e909a[_0xa7fe('0x60')]()[_0xa7fe('0x5f')](char(0x2c))>=0x0||_0x2e909a['toString']()[_0xa7fe('0x5f')](char(0x22))>=0x0);}function encapsulate(_0xf4eb62){var _0x5d6cf3=char(0x22),_0x121dbf='\x5c'+char(0x22),_0x4e7eb1=_0xf4eb62['toString']()[_0xa7fe('0x61')](new RegExp(_0x5d6cf3,'g'),_0x121dbf);return _0x5d6cf3+_0x4e7eb1+_0x5d6cf3;}exports['getSummary']=function(_0x2dc904,_0x209918,_0x58736e){var _0x9053e4,_0x5a96fc;var _0x4f1ccc={'where':{'ProjectId':_0x2dc904['params']['id']}};if(_0x2dc904[_0xa7fe('0x32')][_0xa7fe('0x62')]){_0x4f1ccc[_0xa7fe('0x3c')][_0xa7fe('0x63')]=JSON[_0xa7fe('0x64')](_0x2dc904[_0xa7fe('0x32')][_0xa7fe('0x62')]);}return db[_0xa7fe('0x58')][_0xa7fe('0x43')](_0x4f1ccc)[_0xa7fe('0x24')](handleEntityNotFound(_0x209918,null))[_0xa7fe('0x24')](function(_0x11b76a){if(_0x11b76a){_0x9053e4=_0x11b76a;return db['JscriptyQuestionReport'][_0xa7fe('0x43')]({'where':{'SessionId':{'$in':_[_0xa7fe('0x31')](_0x9053e4,'id')},'ProjectId':_0x2dc904[_0xa7fe('0x46')]['id']},'order':'-createdAt'});}})[_0xa7fe('0x24')](handleEntityNotFound(_0x209918,null))[_0xa7fe('0x24')](function(_0x3697cd){if(_0x3697cd){_0x5a96fc=_0x3697cd;var _0x39061c={};for(var _0x2ba52d=0x0,_0x7624e2=_0x5a96fc['length'];_0x2ba52d<_0x7624e2;_0x2ba52d++){if(!_0x39061c['hasOwnProperty'](_0x5a96fc[_0x2ba52d][_0xa7fe('0x65')])){_0x39061c[_0x5a96fc[_0x2ba52d]['questionId']]=needsEncapsulation(_0x5a96fc[_0x2ba52d]['question'])?encapsulate(_0x5a96fc[_0x2ba52d][_0xa7fe('0x66')]):_0x5a96fc[_0x2ba52d]['question'];}}var _0x3c77ec=[],_0x5f26e8={};for(var _0x20d61f=0x0,_0x69934e=_0x9053e4[_0xa7fe('0x47')];_0x20d61f<_0x69934e;_0x20d61f++){_0x5f26e8={'ProjectId':_0x2dc904[_0xa7fe('0x46')]['id'],'SessionId':_0x9053e4[_0x20d61f]['id'],'StartTime':moment(_0x9053e4[_0x20d61f][_0xa7fe('0x63')])[_0xa7fe('0x67')](_0xa7fe('0x68'))};for(var _0x47601b=0x0,_0x1cfd13=_0x5a96fc[_0xa7fe('0x47')];_0x47601b<_0x1cfd13;_0x47601b++){if(_0x5a96fc[_0x47601b][_0xa7fe('0x69')]==_0x9053e4[_0x20d61f]['id']&&_0x39061c['hasOwnProperty'](_0x5a96fc[_0x47601b][_0xa7fe('0x65')])){_0x5f26e8[_0x39061c[_0x5a96fc[_0x47601b]['questionId']]]=_0x5a96fc[_0x47601b][_0xa7fe('0x6a')];}}for(var _0x522f8d in _0x39061c){if(!_0x5f26e8[_0xa7fe('0x38')](_0x39061c[_0x522f8d])){_0x5f26e8[_0x39061c[_0x522f8d]]=null;}}_0x3c77ec[_0xa7fe('0x6b')](_0x5f26e8);}return _0x3c77ec;}})['then'](function(_0x45d3db){if(!_[_0xa7fe('0x6c')](_0x45d3db)){var _0x3bda80=toCsv(_0x45d3db);var _0x211462=Date[_0xa7fe('0x6d')]();fs[_0xa7fe('0x6e')](util[_0xa7fe('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2dc904[_0xa7fe('0x46')]['id'],_0x211462),_0x3bda80);_0x209918['setHeader']('Content-disposition',_0xa7fe('0x6f')+util[_0xa7fe('0x67')](_0xa7fe('0x70'),_0x2dc904[_0xa7fe('0x46')]['id'],_0x211462));_0x209918[_0xa7fe('0x71')](_0xa7fe('0x72'),_0xa7fe('0x73'));return _0x209918[_0xa7fe('0x74')](util[_0xa7fe('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2dc904[_0xa7fe('0x46')]['id'],_0x211462));}else{return _0x209918[_0xa7fe('0x17')](0xcc);}})[_0xa7fe('0x45')](handleError(_0x209918,null));}; \ No newline at end of file +var _0x1dcc=['request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','get','Projects','error','stack','index','map','JscriptyProject','fieldName','key','name','query','intersection','model','fields','length','attributes','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','getSessions','findOne','keys','JscriptySessionReport','nolimit','ProjectId','getAnswers','JscriptyAnswerReport','hasOwnProperty','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','fast-json-patch'];(function(_0x44d15b,_0xf4adaa){var _0x5d9e81=function(_0x211f00){while(--_0x211f00){_0x44d15b['push'](_0x44d15b['shift']());}};_0x5d9e81(++_0xf4adaa);}(_0x1dcc,0x77));var _0xc1dc=function(_0xc5e82e,_0x12aaf1){_0xc5e82e=_0xc5e82e-0x0;var _0x1bbdb9=_0x1dcc[_0xc5e82e];return _0x1bbdb9;};'use strict';var emlformat=require(_0xc1dc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc1dc('0x1'));var rp=require(_0xc1dc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc1dc('0x3'));var util=require(_0xc1dc('0x4'));var path=require(_0xc1dc('0x5'));var sox=require(_0xc1dc('0x6'));var csv=require(_0xc1dc('0x7'));var ejs=require(_0xc1dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc1dc('0x9'));var _=require('lodash');var squel=require(_0xc1dc('0xa'));var crypto=require(_0xc1dc('0xb'));var jsforce=require(_0xc1dc('0xc'));var deskjs=require(_0xc1dc('0xd'));var toCsv=require(_0xc1dc('0x7'));var querystring=require(_0xc1dc('0xe'));var Papa=require(_0xc1dc('0xf'));var Redis=require(_0xc1dc('0x10'));var authService=require(_0xc1dc('0x11'));var qs=require(_0xc1dc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1dc('0x13'));var logger=require(_0xc1dc('0x14'))('api');var utils=require(_0xc1dc('0x15'));var config=require(_0xc1dc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1dc('0x17'))['db'];function respondWithStatusCode(_0x2545e8,_0x31cd63){_0x31cd63=_0x31cd63||0xcc;return function(_0x2d407c){if(_0x2d407c){return _0x2545e8[_0xc1dc('0x18')](_0x31cd63);}return _0x2545e8[_0xc1dc('0x19')](_0x31cd63)[_0xc1dc('0x1a')]();};}function respondWithResult(_0x4d9d5e,_0x48abc3){_0x48abc3=_0x48abc3||0xc8;return function(_0x140b0b){if(_0x140b0b){return _0x4d9d5e[_0xc1dc('0x19')](_0x48abc3)[_0xc1dc('0x1b')](_0x140b0b);}};}function respondWithFilteredResult(_0xdfbe60,_0x31191a){return function(_0x209355){if(_0x209355){var _0x1edb66=typeof _0x31191a['offset']==='undefined'&&typeof _0x31191a['limit']==='undefined';var _0x2e2d8e=_0x209355[_0xc1dc('0x1c')];var _0x12510a=_0x1edb66?0x0:_0x31191a[_0xc1dc('0x1d')];var _0x6d7e23=_0x1edb66?_0x209355[_0xc1dc('0x1c')]:_0x31191a['offset']+_0x31191a[_0xc1dc('0x1e')];var _0xcac31f;if(_0x6d7e23>=_0x2e2d8e){_0x6d7e23=_0x2e2d8e;_0xcac31f=0xc8;}else{_0xcac31f=0xce;}_0xdfbe60[_0xc1dc('0x19')](_0xcac31f);return _0xdfbe60['set'](_0xc1dc('0x1f'),_0x12510a+'-'+_0x6d7e23+'/'+_0x2e2d8e)['json'](_0x209355);}return null;};}function patchUpdates(_0xabf65a){return function(_0x214ce3){try{jsonpatch[_0xc1dc('0x20')](_0x214ce3,_0xabf65a,!![]);}catch(_0x3939af){return BPromise[_0xc1dc('0x21')](_0x3939af);}return _0x214ce3['save']();};}function saveUpdates(_0x3d7a8f,_0x1a92f6){return function(_0x3ce279){if(_0x3ce279){return _0x3ce279[_0xc1dc('0x22')](_0x3d7a8f)['then'](function(_0x31f5eb){return _0x31f5eb;});}return null;};}function removeEntity(_0x2c5e5a,_0x57582b){return function(_0x71bf72){if(_0x71bf72){return _0x71bf72[_0xc1dc('0x23')]()[_0xc1dc('0x24')](function(){var _0x21a887=_0x71bf72[_0xc1dc('0x25')]({'plain':!![]});var _0x454ed2=_0xc1dc('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x454ed2,'resourceId':_0x21a887['id']}})[_0xc1dc('0x24')](function(){return _0x71bf72;});})['then'](function(){_0x2c5e5a[_0xc1dc('0x19')](0xcc)[_0xc1dc('0x1a')]();});}};}function handleEntityNotFound(_0x413bc7,_0x4dc1ae){return function(_0x580ffc){if(!_0x580ffc){_0x413bc7[_0xc1dc('0x18')](0x194);}return _0x580ffc;};}function handleError(_0x418072,_0x3a8b7f){_0x3a8b7f=_0x3a8b7f||0x1f4;return function(_0x1dc7bc){logger[_0xc1dc('0x27')](_0x1dc7bc[_0xc1dc('0x28')]);if(_0x1dc7bc['name']){delete _0x1dc7bc['name'];}_0x418072[_0xc1dc('0x19')](_0x3a8b7f)['send'](_0x1dc7bc);};}exports[_0xc1dc('0x29')]=function(_0x577fe5,_0x51f940){var _0x10e03f={},_0xc1e849={},_0xfeab2a={'count':0x0,'rows':[]};var _0x2aface=_[_0xc1dc('0x2a')](db[_0xc1dc('0x2b')]['rawAttributes'],function(_0x453412){return{'name':_0x453412[_0xc1dc('0x2c')],'type':_0x453412['type'][_0xc1dc('0x2d')]};});_0xc1e849['model']=_[_0xc1dc('0x2a')](_0x2aface,_0xc1dc('0x2e'));_0xc1e849[_0xc1dc('0x2f')]=_['keys'](_0x577fe5[_0xc1dc('0x2f')]);_0xc1e849['filters']=_[_0xc1dc('0x30')](_0xc1e849[_0xc1dc('0x31')],_0xc1e849[_0xc1dc('0x2f')]);_0x10e03f['attributes']=_[_0xc1dc('0x30')](_0xc1e849[_0xc1dc('0x31')],qs[_0xc1dc('0x32')](_0x577fe5[_0xc1dc('0x2f')]['fields']));_0x10e03f['attributes']=_0x10e03f['attributes'][_0xc1dc('0x33')]?_0x10e03f[_0xc1dc('0x34')]:_0xc1e849[_0xc1dc('0x31')];if(!_0x577fe5[_0xc1dc('0x2f')]['hasOwnProperty']('nolimit')){_0x10e03f['limit']=qs[_0xc1dc('0x1e')](_0x577fe5[_0xc1dc('0x2f')][_0xc1dc('0x1e')]);_0x10e03f['offset']=qs[_0xc1dc('0x1d')](_0x577fe5[_0xc1dc('0x2f')][_0xc1dc('0x1d')]);}_0x10e03f[_0xc1dc('0x35')]=qs['sort'](_0x577fe5['query'][_0xc1dc('0x36')]);_0x10e03f['where']=qs[_0xc1dc('0x37')](_[_0xc1dc('0x38')](_0x577fe5[_0xc1dc('0x2f')],_0xc1e849[_0xc1dc('0x37')]),_0x2aface);if(_0x577fe5[_0xc1dc('0x2f')][_0xc1dc('0x39')]){_0x10e03f[_0xc1dc('0x3a')]=_[_0xc1dc('0x3b')](_0x10e03f[_0xc1dc('0x3a')],{'$or':_[_0xc1dc('0x2a')](_0x2aface,function(_0x422f37){if(_0x422f37[_0xc1dc('0x3c')]!==_0xc1dc('0x3d')){var _0x248311={};_0x248311[_0x422f37['name']]={'$like':'%'+_0x577fe5[_0xc1dc('0x2f')][_0xc1dc('0x39')]+'%'};return _0x248311;}})});}_0x10e03f=_[_0xc1dc('0x3b')]({},_0x10e03f,_0x577fe5[_0xc1dc('0x3e')]);var _0x141f2e={'where':_0x10e03f['where']};return db[_0xc1dc('0x2b')][_0xc1dc('0x1c')](_0x141f2e)[_0xc1dc('0x24')](function(_0x322368){_0xfeab2a[_0xc1dc('0x1c')]=_0x322368;if(_0x577fe5[_0xc1dc('0x2f')][_0xc1dc('0x3f')]){_0x10e03f[_0xc1dc('0x40')]=[{'all':!![]}];}return db[_0xc1dc('0x2b')][_0xc1dc('0x41')](_0x10e03f);})['then'](function(_0x24d976){_0xfeab2a[_0xc1dc('0x42')]=_0x24d976;return _0xfeab2a;})['then'](respondWithFilteredResult(_0x51f940,_0x10e03f))[_0xc1dc('0x43')](handleError(_0x51f940,null));};exports['show']=function(_0x376fe2,_0x457d3a){var _0x7e535={'raw':![],'where':{'id':_0x376fe2[_0xc1dc('0x44')]['id']}},_0x1193b4={};_0x1193b4[_0xc1dc('0x31')]=_['keys'](db[_0xc1dc('0x2b')][_0xc1dc('0x45')]);_0x1193b4[_0xc1dc('0x2f')]=_['keys'](_0x376fe2[_0xc1dc('0x2f')]);_0x1193b4[_0xc1dc('0x37')]=_['intersection'](_0x1193b4['model'],_0x1193b4['query']);_0x7e535[_0xc1dc('0x34')]=_[_0xc1dc('0x30')](_0x1193b4[_0xc1dc('0x31')],qs[_0xc1dc('0x32')](_0x376fe2['query'][_0xc1dc('0x32')]));_0x7e535[_0xc1dc('0x34')]=_0x7e535['attributes'][_0xc1dc('0x33')]?_0x7e535[_0xc1dc('0x34')]:_0x1193b4[_0xc1dc('0x31')];if(_0x376fe2['query']['includeAll']){_0x7e535[_0xc1dc('0x40')]=[{'all':!![]}];}_0x7e535=_[_0xc1dc('0x3b')]({},_0x7e535,_0x376fe2[_0xc1dc('0x3e')]);return db[_0xc1dc('0x2b')][_0xc1dc('0x46')](_0x7e535)[_0xc1dc('0x24')](handleEntityNotFound(_0x457d3a,null))[_0xc1dc('0x24')](respondWithResult(_0x457d3a,null))[_0xc1dc('0x43')](handleError(_0x457d3a,null));};exports[_0xc1dc('0x47')]=function(_0x51b970,_0x74756){return db['JscriptyProject'][_0xc1dc('0x47')](_0x51b970[_0xc1dc('0x48')],{})[_0xc1dc('0x24')](function(_0x46f7c4){var _0x8e6a96=_0x51b970[_0xc1dc('0x49')][_0xc1dc('0x25')]({'plain':!![]});if(!_0x8e6a96)throw new Error(_0xc1dc('0x4a'));if(_0x8e6a96[_0xc1dc('0x4b')]===_0xc1dc('0x49')){var _0xcc3f55=_0x46f7c4[_0xc1dc('0x25')]({'plain':!![]});var _0x203b8e=_0xc1dc('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x203b8e,'userProfileId':_0x8e6a96[_0xc1dc('0x4c')]},'raw':!![]})[_0xc1dc('0x24')](function(_0x4de388){if(_0x4de388&&_0x4de388[_0xc1dc('0x4d')]===0x0){return db[_0xc1dc('0x4e')]['create']({'name':_0xcc3f55[_0xc1dc('0x2e')],'resourceId':_0xcc3f55['id'],'type':_0x4de388['name'],'sectionId':_0x4de388['id']},{})[_0xc1dc('0x24')](function(){return _0x46f7c4;});}else{return _0x46f7c4;}})[_0xc1dc('0x43')](function(_0x3c6b1d){logger[_0xc1dc('0x27')](_0xc1dc('0x4f'),_0x3c6b1d);throw _0x3c6b1d;});}return _0x46f7c4;})[_0xc1dc('0x24')](respondWithResult(_0x74756,0xc9))[_0xc1dc('0x43')](handleError(_0x74756,null));};exports[_0xc1dc('0x50')]=function(_0x22c10e,_0x42be97){var _0x50ae51={'where':{'id':_0x22c10e[_0xc1dc('0x44')]['id']}},_0x4f97c0={};_0x4f97c0[_0xc1dc('0x31')]=_['keys'](db['JscriptyProject'][_0xc1dc('0x45')]);_0x50ae51[_0xc1dc('0x34')]=_[_0xc1dc('0x30')](_0x4f97c0[_0xc1dc('0x31')],qs[_0xc1dc('0x32')](_0x22c10e[_0xc1dc('0x2f')][_0xc1dc('0x32')]));_0x50ae51[_0xc1dc('0x34')]=_0x50ae51[_0xc1dc('0x34')]['length']?_0x50ae51[_0xc1dc('0x34')]:_0x4f97c0['model'];if(_0x22c10e[_0xc1dc('0x2f')][_0xc1dc('0x3f')]){_0x50ae51[_0xc1dc('0x40')]=[{'all':!![]}];}_0x50ae51=_[_0xc1dc('0x3b')]({},_0x50ae51,_0x22c10e[_0xc1dc('0x3e')]);return db['JscriptyProject'][_0xc1dc('0x46')](_0x50ae51)[_0xc1dc('0x24')](handleEntityNotFound(_0x42be97,null))[_0xc1dc('0x24')](function(_0x5b1fd6){if(_0x5b1fd6){var _0x3b5b1d=_0x5b1fd6[_0xc1dc('0x25')]({'plain':!![]});_0x3b5b1d=qs[_0xc1dc('0x51')](_0x3b5b1d,['id',_0xc1dc('0x52'),_0xc1dc('0x53')]);_0x22c10e[_0xc1dc('0x48')]=_[_0xc1dc('0x51')](_0x22c10e['body'],['id','createdAt','updatedAt']);return db[_0xc1dc('0x2b')][_0xc1dc('0x47')](_[_0xc1dc('0x3b')](_0x3b5b1d,_0x22c10e['body']),{'include':_0x22c10e[_0xc1dc('0x2f')][_0xc1dc('0x3f')]?[{'all':!![]}]:undefined})[_0xc1dc('0x24')](function(_0x41091d){var _0x17d5e7=_0x22c10e['user']['get']({'plain':!![]});if(!_0x17d5e7)throw new Error(_0xc1dc('0x4a'));if(_0x17d5e7['role']===_0xc1dc('0x49')){var _0x382ba1=_0x41091d['get']({'plain':!![]});var _0x4d26a8=_0xc1dc('0x26');return db[_0xc1dc('0x54')]['find']({'where':{'name':_0x4d26a8,'userProfileId':_0x17d5e7[_0xc1dc('0x4c')]},'raw':!![]})[_0xc1dc('0x24')](function(_0x19ea11){if(_0x19ea11&&_0x19ea11[_0xc1dc('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x382ba1['name'],'resourceId':_0x382ba1['id'],'type':_0x19ea11['name'],'sectionId':_0x19ea11['id']},{})['then'](function(){return _0x41091d;});}else{return _0x41091d;}})['catch'](function(_0x3055f8){logger['error'](_0xc1dc('0x4f'),_0x3055f8);throw _0x3055f8;});}return _0x41091d;});}})['then'](respondWithResult(_0x42be97,0xc9))[_0xc1dc('0x43')](handleError(_0x42be97,null));};exports['update']=function(_0x157d03,_0x37e90f){if(_0x157d03[_0xc1dc('0x48')]['id']){delete _0x157d03[_0xc1dc('0x48')]['id'];}return db[_0xc1dc('0x2b')][_0xc1dc('0x46')]({'where':{'id':_0x157d03[_0xc1dc('0x44')]['id']}})[_0xc1dc('0x24')](handleEntityNotFound(_0x37e90f,null))[_0xc1dc('0x24')](saveUpdates(_0x157d03['body'],null))['then'](respondWithResult(_0x37e90f,null))[_0xc1dc('0x43')](handleError(_0x37e90f,null));};exports[_0xc1dc('0x23')]=function(_0x444095,_0x382990){return db[_0xc1dc('0x2b')][_0xc1dc('0x46')]({'where':{'id':_0x444095['params']['id']}})[_0xc1dc('0x24')](handleEntityNotFound(_0x382990,null))[_0xc1dc('0x24')](removeEntity(_0x382990,null))[_0xc1dc('0x43')](handleError(_0x382990,null));};exports[_0xc1dc('0x55')]=function(_0x588be8,_0xe3cce7,_0x78bf5f){var _0x2df251={'raw':!![],'where':{}};var _0x48768a={};var _0x4599f6={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc1dc('0x56')]({'where':{'id':_0x588be8[_0xc1dc('0x44')]['id']}})[_0xc1dc('0x24')](handleEntityNotFound(_0xe3cce7,null))[_0xc1dc('0x24')](function(_0x36e903){if(_0x36e903){_0x48768a['model']=_[_0xc1dc('0x57')](db[_0xc1dc('0x58')][_0xc1dc('0x45')]);_0x48768a['query']=_['keys'](_0x588be8['query']);_0x48768a[_0xc1dc('0x37')]=_['intersection'](_0x48768a[_0xc1dc('0x31')],_0x48768a['query']);_0x2df251[_0xc1dc('0x34')]=_[_0xc1dc('0x30')](_0x48768a['model'],qs[_0xc1dc('0x32')](_0x588be8[_0xc1dc('0x2f')][_0xc1dc('0x32')]));_0x2df251[_0xc1dc('0x34')]=_0x2df251[_0xc1dc('0x34')]['length']?_0x2df251[_0xc1dc('0x34')]:_0x48768a[_0xc1dc('0x31')];if(!_0x588be8['query']['hasOwnProperty'](_0xc1dc('0x59'))){_0x2df251[_0xc1dc('0x1e')]=qs['limit'](_0x588be8[_0xc1dc('0x2f')][_0xc1dc('0x1e')]);_0x2df251['offset']=qs[_0xc1dc('0x1d')](_0x588be8['query']['offset']);}_0x2df251[_0xc1dc('0x35')]=qs[_0xc1dc('0x36')](_0x588be8['query'][_0xc1dc('0x36')]);_0x2df251[_0xc1dc('0x3a')]=qs['filters'](_['pick'](_0x588be8[_0xc1dc('0x2f')],_0x48768a[_0xc1dc('0x37')]));_0x2df251[_0xc1dc('0x3a')][_0xc1dc('0x5a')]=_0x36e903['id'];if(_0x588be8[_0xc1dc('0x2f')][_0xc1dc('0x39')]){_0x2df251['where']=_[_0xc1dc('0x3b')](_0x2df251[_0xc1dc('0x3a')],{'$or':_['map'](_0x2df251[_0xc1dc('0x34')],function(_0x1cfb1c){var _0x1fabb1={};_0x1fabb1[_0x1cfb1c]={'$like':'%'+_0x588be8[_0xc1dc('0x2f')][_0xc1dc('0x39')]+'%'};return _0x1fabb1;})});}_0x2df251=_[_0xc1dc('0x3b')]({},_0x2df251,_0x588be8['options']);return db[_0xc1dc('0x58')][_0xc1dc('0x1c')]({'where':_0x2df251[_0xc1dc('0x3a')]})['then'](function(_0x2cc1e2){_0x4599f6[_0xc1dc('0x1c')]=_0x2cc1e2;if(_0x588be8[_0xc1dc('0x2f')][_0xc1dc('0x3f')]){_0x2df251[_0xc1dc('0x40')]=[{'all':!![]}];}return db[_0xc1dc('0x58')][_0xc1dc('0x41')](_0x2df251);})[_0xc1dc('0x24')](function(_0x2c6c1d){_0x4599f6[_0xc1dc('0x42')]=_0x2c6c1d;return _0x4599f6;});}})['then'](respondWithFilteredResult(_0xe3cce7,_0x2df251))['catch'](handleError(_0xe3cce7,null));};exports[_0xc1dc('0x5b')]=function(_0x5f10e8,_0x116e90,_0x327993){var _0x27529f={'raw':!![],'where':{}};var _0x6dbca3={};var _0x2d60ac={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc1dc('0x56')]({'where':{'id':_0x5f10e8[_0xc1dc('0x44')]['id']}})[_0xc1dc('0x24')](handleEntityNotFound(_0x116e90,null))['then'](function(_0xc4c708){if(_0xc4c708){_0x6dbca3[_0xc1dc('0x31')]=_[_0xc1dc('0x57')](db[_0xc1dc('0x5c')][_0xc1dc('0x45')]);_0x6dbca3[_0xc1dc('0x2f')]=_[_0xc1dc('0x57')](_0x5f10e8[_0xc1dc('0x2f')]);_0x6dbca3[_0xc1dc('0x37')]=_[_0xc1dc('0x30')](_0x6dbca3[_0xc1dc('0x31')],_0x6dbca3['query']);_0x27529f['attributes']=_[_0xc1dc('0x30')](_0x6dbca3['model'],qs[_0xc1dc('0x32')](_0x5f10e8['query'][_0xc1dc('0x32')]));_0x27529f['attributes']=_0x27529f[_0xc1dc('0x34')][_0xc1dc('0x33')]?_0x27529f[_0xc1dc('0x34')]:_0x6dbca3['model'];if(!_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x5d')]('nolimit')){_0x27529f['limit']=qs[_0xc1dc('0x1e')](_0x5f10e8['query'][_0xc1dc('0x1e')]);_0x27529f['offset']=qs[_0xc1dc('0x1d')](_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x1d')]);}_0x27529f[_0xc1dc('0x35')]=qs['sort'](_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x36')]);_0x27529f[_0xc1dc('0x3a')]=qs[_0xc1dc('0x37')](_[_0xc1dc('0x38')](_0x5f10e8[_0xc1dc('0x2f')],_0x6dbca3['filters']));_0x27529f['where'][_0xc1dc('0x5a')]=_0xc4c708['id'];if(_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x39')]){_0x27529f[_0xc1dc('0x3a')]=_[_0xc1dc('0x3b')](_0x27529f[_0xc1dc('0x3a')],{'$or':_['map'](_0x27529f['attributes'],function(_0x22c2de){var _0x3231c1={};_0x3231c1[_0x22c2de]={'$like':'%'+_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x39')]+'%'};return _0x3231c1;})});}_0x27529f=_['merge']({},_0x27529f,_0x5f10e8[_0xc1dc('0x3e')]);return db[_0xc1dc('0x5c')][_0xc1dc('0x1c')]({'where':_0x27529f[_0xc1dc('0x3a')]})[_0xc1dc('0x24')](function(_0x457643){_0x2d60ac[_0xc1dc('0x1c')]=_0x457643;if(_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x3f')]){_0x27529f[_0xc1dc('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc1dc('0x41')](_0x27529f);})[_0xc1dc('0x24')](function(_0x2a762a){_0x2d60ac['rows']=_0x2a762a;return _0x2d60ac;});}})[_0xc1dc('0x24')](respondWithFilteredResult(_0x116e90,_0x27529f))[_0xc1dc('0x43')](handleError(_0x116e90,null));};function char(_0x36b712){return'number'===typeof _0x36b712?String[_0xc1dc('0x5e')][_0xc1dc('0x20')](null,arguments):_0x36b712;}function needsEncapsulation(_0x1918b4){return!!_0x1918b4&&(_0x1918b4[_0xc1dc('0x5f')]()[_0xc1dc('0x60')](char(0xd))>=0x0||_0x1918b4[_0xc1dc('0x5f')]()[_0xc1dc('0x60')](char(0xa))>=0x0||_0x1918b4[_0xc1dc('0x5f')]()[_0xc1dc('0x60')](char(0x2c))>=0x0||_0x1918b4[_0xc1dc('0x5f')]()[_0xc1dc('0x60')](char(0x22))>=0x0);}function encapsulate(_0x721f51){var _0x1a6bca=char(0x22),_0x41d99c='\x5c'+char(0x22),_0x175706=_0x721f51[_0xc1dc('0x5f')]()[_0xc1dc('0x61')](new RegExp(_0x1a6bca,'g'),_0x41d99c);return _0x1a6bca+_0x175706+_0x1a6bca;}exports[_0xc1dc('0x62')]=function(_0xa8a711,_0x1a8ebf,_0x621756){var _0x58e6f1,_0x45e11b;var _0x15ab26={'where':{'ProjectId':_0xa8a711[_0xc1dc('0x44')]['id']}};if(_0xa8a711['query'][_0xc1dc('0x63')]){_0x15ab26[_0xc1dc('0x3a')]['starttime']=JSON[_0xc1dc('0x64')](_0xa8a711[_0xc1dc('0x2f')][_0xc1dc('0x63')]);}return db[_0xc1dc('0x58')][_0xc1dc('0x41')](_0x15ab26)[_0xc1dc('0x24')](handleEntityNotFound(_0x1a8ebf,null))[_0xc1dc('0x24')](function(_0x3f1358){if(_0x3f1358){_0x58e6f1=_0x3f1358;return db[_0xc1dc('0x65')][_0xc1dc('0x41')]({'where':{'SessionId':{'$in':_[_0xc1dc('0x2a')](_0x58e6f1,'id')},'ProjectId':_0xa8a711[_0xc1dc('0x44')]['id']},'order':_0xc1dc('0x66')});}})['then'](handleEntityNotFound(_0x1a8ebf,null))[_0xc1dc('0x24')](function(_0x4a8ca1){if(_0x4a8ca1){_0x45e11b=_0x4a8ca1;var _0x509873={};for(var _0x5bd3ea=0x0,_0x7bb24e=_0x45e11b[_0xc1dc('0x33')];_0x5bd3ea<_0x7bb24e;_0x5bd3ea++){if(!_0x509873[_0xc1dc('0x5d')](_0x45e11b[_0x5bd3ea][_0xc1dc('0x67')])){_0x509873[_0x45e11b[_0x5bd3ea]['questionId']]=needsEncapsulation(_0x45e11b[_0x5bd3ea][_0xc1dc('0x68')])?encapsulate(_0x45e11b[_0x5bd3ea][_0xc1dc('0x68')]):_0x45e11b[_0x5bd3ea]['question'];}}var _0x3cb914=[],_0x4c4db2={};for(var _0x1a704f=0x0,_0x28e6bf=_0x58e6f1['length'];_0x1a704f<_0x28e6bf;_0x1a704f++){_0x4c4db2={'ProjectId':_0xa8a711[_0xc1dc('0x44')]['id'],'SessionId':_0x58e6f1[_0x1a704f]['id'],'StartTime':moment(_0x58e6f1[_0x1a704f][_0xc1dc('0x69')])[_0xc1dc('0x6a')](_0xc1dc('0x6b'))};for(var _0x485b53=0x0,_0x4c860e=_0x45e11b[_0xc1dc('0x33')];_0x485b53<_0x4c860e;_0x485b53++){if(_0x45e11b[_0x485b53][_0xc1dc('0x6c')]==_0x58e6f1[_0x1a704f]['id']&&_0x509873[_0xc1dc('0x5d')](_0x45e11b[_0x485b53][_0xc1dc('0x67')])){_0x4c4db2[_0x509873[_0x45e11b[_0x485b53][_0xc1dc('0x67')]]]=_0x45e11b[_0x485b53][_0xc1dc('0x6d')];}}for(var _0x4d1c45 in _0x509873){if(!_0x4c4db2[_0xc1dc('0x5d')](_0x509873[_0x4d1c45])){_0x4c4db2[_0x509873[_0x4d1c45]]=null;}}_0x3cb914[_0xc1dc('0x6e')](_0x4c4db2);}return _0x3cb914;}})[_0xc1dc('0x24')](function(_0x3a9170){if(!_[_0xc1dc('0x6f')](_0x3a9170)){var _0xcd2261=toCsv(_0x3a9170);var _0x700725=Date[_0xc1dc('0x70')]();fs[_0xc1dc('0x71')](util[_0xc1dc('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xa8a711['params']['id'],_0x700725),_0xcd2261);_0x1a8ebf[_0xc1dc('0x72')]('Content-disposition',_0xc1dc('0x73')+util[_0xc1dc('0x6a')](_0xc1dc('0x74'),_0xa8a711['params']['id'],_0x700725));_0x1a8ebf[_0xc1dc('0x72')](_0xc1dc('0x75'),_0xc1dc('0x76'));return _0x1a8ebf[_0xc1dc('0x77')](util[_0xc1dc('0x6a')](_0xc1dc('0x78'),_0xa8a711['params']['id'],_0x700725));}else{return _0x1a8ebf[_0xc1dc('0x18')](0xcc);}})['catch'](handleError(_0x1a8ebf,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ea972d2..bb3a9d2 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 _0x4a80=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','../../config/logger'];(function(_0x253935,_0x43d337){var _0x4680b6=function(_0x43e53b){while(--_0x43e53b){_0x253935['push'](_0x253935['shift']());}};_0x4680b6(++_0x43d337);}(_0x4a80,0xbe));var _0x04a8=function(_0x10d671,_0x5d7431){_0x10d671=_0x10d671-0x0;var _0x2f17a1=_0x4a80[_0x10d671];return _0x2f17a1;};'use strict';var _=require(_0x04a8('0x0'));var util=require('util');var logger=require(_0x04a8('0x1'))(_0x04a8('0x2'));var moment=require('moment');var BPromise=require(_0x04a8('0x3'));var rp=require(_0x04a8('0x4'));var fs=require('fs');var path=require(_0x04a8('0x5'));var rimraf=require(_0x04a8('0x6'));var config=require(_0x04a8('0x7'));var attributes=require(_0x04a8('0x8'));module[_0x04a8('0x9')]=function(_0x353b43,_0x709eea){return _0x353b43[_0x04a8('0xa')]('JscriptyProject',attributes,{'tableName':_0x04a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x093a=['JscriptyProject','jscripty_projects','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x093a,0x16a));var _0xa093=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0x093a[_0x356127];return _0x5d4c75;};'use strict';var _=require('lodash');var util=require(_0xa093('0x0'));var logger=require(_0xa093('0x1'))(_0xa093('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa093('0x3'));var fs=require('fs');var path=require(_0xa093('0x4'));var rimraf=require(_0xa093('0x5'));var config=require(_0xa093('0x6'));var attributes=require(_0xa093('0x7'));module[_0xa093('0x8')]=function(_0x2346f1,_0x145f58){return _0x2346f1[_0xa093('0x9')](_0xa093('0xa'),attributes,{'tableName':_0xa093('0xb'),'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 f840375..1c75f94 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x3d3ca9,_0x305b47){var _0x3c6373=function(_0x28cbe7){while(--_0x28cbe7){_0x3d3ca9['push'](_0x3d3ca9['shift']());}};_0x3c6373(++_0x305b47);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0xcb91[_0x358806];return _0x19fdcb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac4a,0x13f));var _0xaac4=function(_0x2d5d3c,_0x4e0363){_0x2d5d3c=_0x2d5d3c-0x0;var _0x32725b=_0xac4a[_0x2d5d3c];return _0x32725b;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 39de5b7..03c6e6a 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 _0xe71f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x226dc7,_0x4ffe7f){var _0x427660=function(_0x1542cb){while(--_0x1542cb){_0x226dc7['push'](_0x226dc7['shift']());}};_0x427660(++_0x4ffe7f);}(_0xe71f,0x1ca));var _0xfe71=function(_0x51a55e,_0x5a3f5e){_0x51a55e=_0x51a55e-0x0;var _0x37b10b=_0xe71f[_0x51a55e];return _0x37b10b;};'use strict';var multer=require('multer');var util=require(_0xfe71('0x0'));var path=require(_0xfe71('0x1'));var timeout=require(_0xfe71('0x2'));var express=require(_0xfe71('0x3'));var router=express[_0xfe71('0x4')]();var fs_extra=require(_0xfe71('0x5'));var auth=require(_0xfe71('0x6'));var interaction=require(_0xfe71('0x7'));var config=require(_0xfe71('0x8'));var controller=require(_0xfe71('0x9'));router[_0xfe71('0xa')]('/',auth['isAuthenticated'](),controller[_0xfe71('0xb')]);router[_0xfe71('0xa')]('/describe',auth[_0xfe71('0xc')](),controller[_0xfe71('0xd')]);router[_0xfe71('0xa')](_0xfe71('0xe'),auth[_0xfe71('0xc')](),controller[_0xfe71('0xf')]);router['post']('/',auth[_0xfe71('0xc')](),controller['create']);router[_0xfe71('0x10')](_0xfe71('0xe'),auth[_0xfe71('0xc')](),controller[_0xfe71('0x11')]);router[_0xfe71('0x12')]('/:id',auth[_0xfe71('0xc')](),controller[_0xfe71('0x13')]);module[_0xfe71('0x14')]=router; \ No newline at end of file +var _0xa6e2=['index','describe','show','post','put','/:id','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa6e2,0x1cb));var _0x2a6e=function(_0xd8d798,_0x247af1){_0xd8d798=_0xd8d798-0x0;var _0x28aa53=_0xa6e2[_0xd8d798];return _0x28aa53;};'use strict';var multer=require(_0x2a6e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2a6e('0x1'));var express=require(_0x2a6e('0x2'));var router=express[_0x2a6e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2a6e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2a6e('0x5'));var controller=require(_0x2a6e('0x6'));router[_0x2a6e('0x7')]('/',auth[_0x2a6e('0x8')](),controller[_0x2a6e('0x9')]);router['get']('/describe',auth[_0x2a6e('0x8')](),controller[_0x2a6e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2a6e('0xb')]);router[_0x2a6e('0xc')]('/',auth[_0x2a6e('0x8')](),controller['create']);router[_0x2a6e('0xd')](_0x2a6e('0xe'),auth[_0x2a6e('0x8')](),controller[_0x2a6e('0xf')]);router['delete'](_0x2a6e('0xe'),auth[_0x2a6e('0x8')](),controller[_0x2a6e('0x10')]);module[_0x2a6e('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 8d9c018..1122ef5 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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x422ebf,_0x474e63){_0x422ebf=_0x422ebf-0x0;var _0x3ce81c=_0x7a54[_0x422ebf];return _0x3ce81c;};'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(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x3bef81,_0x31193d){_0x3bef81=_0x3bef81-0x0;var _0x41404b=_0x7a54[_0x3bef81];return _0x41404b;};'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 9372006..4e2ce5a 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 _0xbb3a=['fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x4fd75d,_0x167b74){var _0x575327=function(_0x13417b){while(--_0x13417b){_0x4fd75d['push'](_0x4fd75d['shift']());}};_0x575327(++_0x167b74);}(_0xbb3a,0x143));var _0xabb3=function(_0x34ac15,_0x173e93){_0x34ac15=_0x34ac15-0x0;var _0x272ccc=_0xbb3a[_0x34ac15];return _0x272ccc;};'use strict';var emlformat=require(_0xabb3('0x0'));var rimraf=require(_0xabb3('0x1'));var zipdir=require(_0xabb3('0x2'));var jsonpatch=require(_0xabb3('0x3'));var rp=require(_0xabb3('0x4'));var moment=require(_0xabb3('0x5'));var BPromise=require(_0xabb3('0x6'));var Mustache=require(_0xabb3('0x7'));var util=require(_0xabb3('0x8'));var path=require('path');var sox=require(_0xabb3('0x9'));var csv=require(_0xabb3('0xa'));var ejs=require(_0xabb3('0xb'));var fs=require('fs');var fs_extra=require(_0xabb3('0xc'));var _=require('lodash');var squel=require(_0xabb3('0xd'));var crypto=require(_0xabb3('0xe'));var jsforce=require(_0xabb3('0xf'));var deskjs=require(_0xabb3('0x10'));var toCsv=require(_0xabb3('0xa'));var querystring=require('querystring');var Papa=require(_0xabb3('0x11'));var Redis=require(_0xabb3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xabb3('0x13'));var as=require(_0xabb3('0x14'));var hardwareService=require(_0xabb3('0x15'));var logger=require(_0xabb3('0x16'))(_0xabb3('0x17'));var utils=require(_0xabb3('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xabb3('0x19'))['db'];function respondWithStatusCode(_0x15cb1b,_0x2da2ee){_0x2da2ee=_0x2da2ee||0xcc;return function(_0x1bf684){if(_0x1bf684){return _0x15cb1b['sendStatus'](_0x2da2ee);}return _0x15cb1b['status'](_0x2da2ee)[_0xabb3('0x1a')]();};}function respondWithResult(_0x4af4db,_0xfb9dcb){_0xfb9dcb=_0xfb9dcb||0xc8;return function(_0x3c3c7b){if(_0x3c3c7b){return _0x4af4db[_0xabb3('0x1b')](_0xfb9dcb)[_0xabb3('0x1c')](_0x3c3c7b);}};}function respondWithFilteredResult(_0x534c25,_0x148c32){return function(_0x596d50){if(_0x596d50){var _0x29e125=typeof _0x148c32['offset']===_0xabb3('0x1d')&&typeof _0x148c32[_0xabb3('0x1e')]===_0xabb3('0x1d');var _0x4e0fc9=_0x596d50[_0xabb3('0x1f')];var _0x590e0c=_0x29e125?0x0:_0x148c32[_0xabb3('0x20')];var _0x25bdc1=_0x29e125?_0x596d50['count']:_0x148c32[_0xabb3('0x20')]+_0x148c32[_0xabb3('0x1e')];var _0x2e21f5;if(_0x25bdc1>=_0x4e0fc9){_0x25bdc1=_0x4e0fc9;_0x2e21f5=0xc8;}else{_0x2e21f5=0xce;}_0x534c25[_0xabb3('0x1b')](_0x2e21f5);return _0x534c25[_0xabb3('0x21')](_0xabb3('0x22'),_0x590e0c+'-'+_0x25bdc1+'/'+_0x4e0fc9)[_0xabb3('0x1c')](_0x596d50);}return null;};}function patchUpdates(_0x265718){return function(_0x46018d){try{jsonpatch['apply'](_0x46018d,_0x265718,!![]);}catch(_0x52762f){return BPromise[_0xabb3('0x23')](_0x52762f);}return _0x46018d[_0xabb3('0x24')]();};}function saveUpdates(_0x3a791e,_0x417214){return function(_0x1e4660){if(_0x1e4660){return _0x1e4660[_0xabb3('0x25')](_0x3a791e)['then'](function(_0x33cc71){return _0x33cc71;});}return null;};}function removeEntity(_0x5f296a,_0x29f6a4){return function(_0x43f9d9){if(_0x43f9d9){return _0x43f9d9[_0xabb3('0x26')]()[_0xabb3('0x27')](function(){_0x5f296a[_0xabb3('0x1b')](0xcc)[_0xabb3('0x1a')]();});}};}function handleEntityNotFound(_0x49c353,_0x17f404){return function(_0x40ff66){if(!_0x40ff66){_0x49c353[_0xabb3('0x28')](0x194);}return _0x40ff66;};}function handleError(_0x414918,_0x41d32f){_0x41d32f=_0x41d32f||0x1f4;return function(_0x442aac){logger[_0xabb3('0x29')](_0x442aac[_0xabb3('0x2a')]);if(_0x442aac[_0xabb3('0x2b')]){delete _0x442aac['name'];}_0x414918[_0xabb3('0x1b')](_0x41d32f)['send'](_0x442aac);};}exports[_0xabb3('0x2c')]=function(_0x253ec8,_0x1beaa1){var _0x383e46={},_0x2baad4={},_0x383e26={'count':0x0,'rows':[]};var _0x54b473=_[_0xabb3('0x2d')](db[_0xabb3('0x2e')][_0xabb3('0x2f')],function(_0x43cfbf){return{'name':_0x43cfbf[_0xabb3('0x30')],'type':_0x43cfbf[_0xabb3('0x31')][_0xabb3('0x32')]};});_0x2baad4[_0xabb3('0x33')]=_[_0xabb3('0x2d')](_0x54b473,_0xabb3('0x2b'));_0x2baad4['query']=_[_0xabb3('0x34')](_0x253ec8[_0xabb3('0x35')]);_0x2baad4[_0xabb3('0x36')]=_[_0xabb3('0x37')](_0x2baad4[_0xabb3('0x33')],_0x2baad4[_0xabb3('0x35')]);_0x383e46[_0xabb3('0x38')]=_['intersection'](_0x2baad4[_0xabb3('0x33')],qs['fields'](_0x253ec8[_0xabb3('0x35')][_0xabb3('0x39')]));_0x383e46['attributes']=_0x383e46[_0xabb3('0x38')]['length']?_0x383e46[_0xabb3('0x38')]:_0x2baad4[_0xabb3('0x33')];if(!_0x253ec8['query']['hasOwnProperty']('nolimit')){_0x383e46[_0xabb3('0x1e')]=qs[_0xabb3('0x1e')](_0x253ec8[_0xabb3('0x35')][_0xabb3('0x1e')]);_0x383e46[_0xabb3('0x20')]=qs[_0xabb3('0x20')](_0x253ec8['query'][_0xabb3('0x20')]);}_0x383e46[_0xabb3('0x3a')]=qs['sort'](_0x253ec8[_0xabb3('0x35')][_0xabb3('0x3b')]);_0x383e46[_0xabb3('0x3c')]=qs[_0xabb3('0x36')](_[_0xabb3('0x3d')](_0x253ec8[_0xabb3('0x35')],_0x2baad4['filters']),_0x54b473);if(_0x253ec8['query'][_0xabb3('0x3e')]){_0x383e46[_0xabb3('0x3c')]=_['merge'](_0x383e46['where'],{'$or':_[_0xabb3('0x2d')](_0x54b473,function(_0x59a30c){if(_0x59a30c[_0xabb3('0x31')]!=='VIRTUAL'){var _0x1443b2={};_0x1443b2[_0x59a30c[_0xabb3('0x2b')]]={'$like':'%'+_0x253ec8[_0xabb3('0x35')][_0xabb3('0x3e')]+'%'};return _0x1443b2;}})});}_0x383e46=_[_0xabb3('0x3f')]({},_0x383e46,_0x253ec8[_0xabb3('0x40')]);var _0x296045={'where':_0x383e46['where']};return db[_0xabb3('0x2e')]['count'](_0x296045)[_0xabb3('0x27')](function(_0x469940){_0x383e26['count']=_0x469940;if(_0x253ec8[_0xabb3('0x35')][_0xabb3('0x41')]){_0x383e46[_0xabb3('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xabb3('0x43')](_0x383e46);})[_0xabb3('0x27')](function(_0x27c4a1){_0x383e26[_0xabb3('0x44')]=_0x27c4a1;return _0x383e26;})['then'](respondWithFilteredResult(_0x1beaa1,_0x383e46))[_0xabb3('0x45')](handleError(_0x1beaa1,null));};exports[_0xabb3('0x46')]=function(_0xd45659,_0x3957bc){var _0x42a00d={'raw':!![],'where':{'id':_0xd45659[_0xabb3('0x47')]['id']}},_0x25f53b={};_0x25f53b[_0xabb3('0x33')]=_[_0xabb3('0x34')](db['JscriptyQuestionReport']['rawAttributes']);_0x25f53b[_0xabb3('0x35')]=_[_0xabb3('0x34')](_0xd45659['query']);_0x25f53b[_0xabb3('0x36')]=_[_0xabb3('0x37')](_0x25f53b['model'],_0x25f53b['query']);_0x42a00d[_0xabb3('0x38')]=_[_0xabb3('0x37')](_0x25f53b[_0xabb3('0x33')],qs[_0xabb3('0x39')](_0xd45659[_0xabb3('0x35')][_0xabb3('0x39')]));_0x42a00d[_0xabb3('0x38')]=_0x42a00d[_0xabb3('0x38')]['length']?_0x42a00d[_0xabb3('0x38')]:_0x25f53b[_0xabb3('0x33')];if(_0xd45659['query']['includeAll']){_0x42a00d[_0xabb3('0x42')]=[{'all':!![]}];}_0x42a00d=_['merge']({},_0x42a00d,_0xd45659[_0xabb3('0x40')]);return db[_0xabb3('0x2e')]['find'](_0x42a00d)[_0xabb3('0x27')](handleEntityNotFound(_0x3957bc,null))[_0xabb3('0x27')](respondWithResult(_0x3957bc,null))['catch'](handleError(_0x3957bc,null));};exports[_0xabb3('0x48')]=function(_0x35dded,_0x1b931c){return db[_0xabb3('0x2e')][_0xabb3('0x48')](_0x35dded[_0xabb3('0x49')],{})[_0xabb3('0x27')](respondWithResult(_0x1b931c,0xc9))['catch'](handleError(_0x1b931c,null));};exports[_0xabb3('0x25')]=function(_0x1c4a99,_0x2ef086){if(_0x1c4a99[_0xabb3('0x49')]['id']){delete _0x1c4a99[_0xabb3('0x49')]['id'];}return db[_0xabb3('0x2e')][_0xabb3('0x4a')]({'where':{'id':_0x1c4a99[_0xabb3('0x47')]['id']}})[_0xabb3('0x27')](handleEntityNotFound(_0x2ef086,null))[_0xabb3('0x27')](saveUpdates(_0x1c4a99['body'],null))['then'](respondWithResult(_0x2ef086,null))[_0xabb3('0x45')](handleError(_0x2ef086,null));};exports['destroy']=function(_0x54311e,_0x28bdc1){return db['JscriptyQuestionReport'][_0xabb3('0x4a')]({'where':{'id':_0x54311e['params']['id']}})['then'](handleEntityNotFound(_0x28bdc1,null))[_0xabb3('0x27')](removeEntity(_0x28bdc1,null))[_0xabb3('0x45')](handleError(_0x28bdc1,null));};exports[_0xabb3('0x4b')]=function(_0x2740e0,_0x4d6b6a){return db[_0xabb3('0x2e')][_0xabb3('0x4b')]()[_0xabb3('0x27')](respondWithResult(_0x4d6b6a,null))[_0xabb3('0x45')](handleError(_0x4d6b6a,null));}; \ No newline at end of file +var _0xb06b=['describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','destroy','then','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','find','create','body'];(function(_0x23f438,_0x1b2a91){var _0x10611c=function(_0x5cfa6c){while(--_0x5cfa6c){_0x23f438['push'](_0x23f438['shift']());}};_0x10611c(++_0x1b2a91);}(_0xb06b,0xdf));var _0xbb06=function(_0x37dbc2,_0xb46c96){_0x37dbc2=_0x37dbc2-0x0;var _0x20df72=_0xb06b[_0x37dbc2];return _0x20df72;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb06('0x0'));var zipdir=require(_0xbb06('0x1'));var jsonpatch=require(_0xbb06('0x2'));var rp=require(_0xbb06('0x3'));var moment=require('moment');var BPromise=require(_0xbb06('0x4'));var Mustache=require(_0xbb06('0x5'));var util=require('util');var path=require(_0xbb06('0x6'));var sox=require(_0xbb06('0x7'));var csv=require(_0xbb06('0x8'));var ejs=require(_0xbb06('0x9'));var fs=require('fs');var fs_extra=require(_0xbb06('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbb06('0xb'));var jsforce=require(_0xbb06('0xc'));var deskjs=require(_0xbb06('0xd'));var toCsv=require(_0xbb06('0x8'));var querystring=require(_0xbb06('0xe'));var Papa=require(_0xbb06('0xf'));var Redis=require(_0xbb06('0x10'));var authService=require(_0xbb06('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbb06('0x12'));var hardwareService=require(_0xbb06('0x13'));var logger=require(_0xbb06('0x14'))(_0xbb06('0x15'));var utils=require(_0xbb06('0x16'));var config=require(_0xbb06('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb06('0x18'))['db'];function respondWithStatusCode(_0x266429,_0x4bdad8){_0x4bdad8=_0x4bdad8||0xcc;return function(_0x2d07dc){if(_0x2d07dc){return _0x266429[_0xbb06('0x19')](_0x4bdad8);}return _0x266429[_0xbb06('0x1a')](_0x4bdad8)[_0xbb06('0x1b')]();};}function respondWithResult(_0x3637dc,_0x544212){_0x544212=_0x544212||0xc8;return function(_0x5c4549){if(_0x5c4549){return _0x3637dc[_0xbb06('0x1a')](_0x544212)[_0xbb06('0x1c')](_0x5c4549);}};}function respondWithFilteredResult(_0x10cf5f,_0x290c01){return function(_0x2b8ba4){if(_0x2b8ba4){var _0x3ed383=typeof _0x290c01['offset']===_0xbb06('0x1d')&&typeof _0x290c01[_0xbb06('0x1e')]===_0xbb06('0x1d');var _0x4e7f20=_0x2b8ba4[_0xbb06('0x1f')];var _0x154f04=_0x3ed383?0x0:_0x290c01[_0xbb06('0x20')];var _0x57af99=_0x3ed383?_0x2b8ba4[_0xbb06('0x1f')]:_0x290c01[_0xbb06('0x20')]+_0x290c01['limit'];var _0x89d494;if(_0x57af99>=_0x4e7f20){_0x57af99=_0x4e7f20;_0x89d494=0xc8;}else{_0x89d494=0xce;}_0x10cf5f['status'](_0x89d494);return _0x10cf5f['set'](_0xbb06('0x21'),_0x154f04+'-'+_0x57af99+'/'+_0x4e7f20)[_0xbb06('0x1c')](_0x2b8ba4);}return null;};}function patchUpdates(_0x252355){return function(_0x3c4886){try{jsonpatch['apply'](_0x3c4886,_0x252355,!![]);}catch(_0xeb8bcf){return BPromise[_0xbb06('0x22')](_0xeb8bcf);}return _0x3c4886['save']();};}function saveUpdates(_0x11f55a,_0x2f4970){return function(_0x2bc230){if(_0x2bc230){return _0x2bc230[_0xbb06('0x23')](_0x11f55a)['then'](function(_0x52b134){return _0x52b134;});}return null;};}function removeEntity(_0x4f5044,_0x565a15){return function(_0x518dc2){if(_0x518dc2){return _0x518dc2[_0xbb06('0x24')]()[_0xbb06('0x25')](function(){_0x4f5044[_0xbb06('0x1a')](0xcc)[_0xbb06('0x1b')]();});}};}function handleEntityNotFound(_0xc5eba,_0x4c7268){return function(_0x46f463){if(!_0x46f463){_0xc5eba[_0xbb06('0x19')](0x194);}return _0x46f463;};}function handleError(_0x3c81fb,_0x1cb995){_0x1cb995=_0x1cb995||0x1f4;return function(_0x398e54){logger[_0xbb06('0x26')](_0x398e54[_0xbb06('0x27')]);if(_0x398e54[_0xbb06('0x28')]){delete _0x398e54[_0xbb06('0x28')];}_0x3c81fb[_0xbb06('0x1a')](_0x1cb995)[_0xbb06('0x29')](_0x398e54);};}exports[_0xbb06('0x2a')]=function(_0x13137f,_0x187110){var _0xdad5f7={},_0x5ac8ac={},_0x426011={'count':0x0,'rows':[]};var _0x3023df=_['map'](db[_0xbb06('0x2b')][_0xbb06('0x2c')],function(_0x1390d8){return{'name':_0x1390d8[_0xbb06('0x2d')],'type':_0x1390d8['type'][_0xbb06('0x2e')]};});_0x5ac8ac[_0xbb06('0x2f')]=_[_0xbb06('0x30')](_0x3023df,_0xbb06('0x28'));_0x5ac8ac[_0xbb06('0x31')]=_[_0xbb06('0x32')](_0x13137f[_0xbb06('0x31')]);_0x5ac8ac['filters']=_[_0xbb06('0x33')](_0x5ac8ac['model'],_0x5ac8ac[_0xbb06('0x31')]);_0xdad5f7[_0xbb06('0x34')]=_[_0xbb06('0x33')](_0x5ac8ac[_0xbb06('0x2f')],qs[_0xbb06('0x35')](_0x13137f['query'][_0xbb06('0x35')]));_0xdad5f7['attributes']=_0xdad5f7['attributes'][_0xbb06('0x36')]?_0xdad5f7[_0xbb06('0x34')]:_0x5ac8ac[_0xbb06('0x2f')];if(!_0x13137f[_0xbb06('0x31')][_0xbb06('0x37')]('nolimit')){_0xdad5f7[_0xbb06('0x1e')]=qs[_0xbb06('0x1e')](_0x13137f[_0xbb06('0x31')]['limit']);_0xdad5f7[_0xbb06('0x20')]=qs[_0xbb06('0x20')](_0x13137f['query'][_0xbb06('0x20')]);}_0xdad5f7['order']=qs['sort'](_0x13137f[_0xbb06('0x31')][_0xbb06('0x38')]);_0xdad5f7[_0xbb06('0x39')]=qs[_0xbb06('0x3a')](_[_0xbb06('0x3b')](_0x13137f[_0xbb06('0x31')],_0x5ac8ac[_0xbb06('0x3a')]),_0x3023df);if(_0x13137f[_0xbb06('0x31')][_0xbb06('0x3c')]){_0xdad5f7[_0xbb06('0x39')]=_[_0xbb06('0x3d')](_0xdad5f7[_0xbb06('0x39')],{'$or':_[_0xbb06('0x30')](_0x3023df,function(_0x3e058d){if(_0x3e058d[_0xbb06('0x3e')]!=='VIRTUAL'){var _0x108b80={};_0x108b80[_0x3e058d[_0xbb06('0x28')]]={'$like':'%'+_0x13137f[_0xbb06('0x31')][_0xbb06('0x3c')]+'%'};return _0x108b80;}})});}_0xdad5f7=_['merge']({},_0xdad5f7,_0x13137f[_0xbb06('0x3f')]);var _0x98ab5f={'where':_0xdad5f7[_0xbb06('0x39')]};return db[_0xbb06('0x2b')][_0xbb06('0x1f')](_0x98ab5f)['then'](function(_0x5b785f){_0x426011[_0xbb06('0x1f')]=_0x5b785f;if(_0x13137f[_0xbb06('0x31')][_0xbb06('0x40')]){_0xdad5f7[_0xbb06('0x41')]=[{'all':!![]}];}return db[_0xbb06('0x2b')][_0xbb06('0x42')](_0xdad5f7);})['then'](function(_0x1dde5d){_0x426011[_0xbb06('0x43')]=_0x1dde5d;return _0x426011;})['then'](respondWithFilteredResult(_0x187110,_0xdad5f7))[_0xbb06('0x44')](handleError(_0x187110,null));};exports['show']=function(_0x3e7802,_0xbc2323){var _0x3d0108={'raw':!![],'where':{'id':_0x3e7802[_0xbb06('0x45')]['id']}},_0x49eeb1={};_0x49eeb1[_0xbb06('0x2f')]=_['keys'](db[_0xbb06('0x2b')][_0xbb06('0x2c')]);_0x49eeb1[_0xbb06('0x31')]=_[_0xbb06('0x32')](_0x3e7802[_0xbb06('0x31')]);_0x49eeb1[_0xbb06('0x3a')]=_['intersection'](_0x49eeb1[_0xbb06('0x2f')],_0x49eeb1[_0xbb06('0x31')]);_0x3d0108['attributes']=_[_0xbb06('0x33')](_0x49eeb1[_0xbb06('0x2f')],qs[_0xbb06('0x35')](_0x3e7802[_0xbb06('0x31')][_0xbb06('0x35')]));_0x3d0108[_0xbb06('0x34')]=_0x3d0108[_0xbb06('0x34')]['length']?_0x3d0108[_0xbb06('0x34')]:_0x49eeb1[_0xbb06('0x2f')];if(_0x3e7802[_0xbb06('0x31')][_0xbb06('0x40')]){_0x3d0108[_0xbb06('0x41')]=[{'all':!![]}];}_0x3d0108=_['merge']({},_0x3d0108,_0x3e7802['options']);return db[_0xbb06('0x2b')][_0xbb06('0x46')](_0x3d0108)[_0xbb06('0x25')](handleEntityNotFound(_0xbc2323,null))[_0xbb06('0x25')](respondWithResult(_0xbc2323,null))['catch'](handleError(_0xbc2323,null));};exports[_0xbb06('0x47')]=function(_0x31878e,_0x101971){return db[_0xbb06('0x2b')]['create'](_0x31878e[_0xbb06('0x48')],{})[_0xbb06('0x25')](respondWithResult(_0x101971,0xc9))[_0xbb06('0x44')](handleError(_0x101971,null));};exports[_0xbb06('0x23')]=function(_0xc8f984,_0x525508){if(_0xc8f984[_0xbb06('0x48')]['id']){delete _0xc8f984[_0xbb06('0x48')]['id'];}return db[_0xbb06('0x2b')]['find']({'where':{'id':_0xc8f984[_0xbb06('0x45')]['id']}})[_0xbb06('0x25')](handleEntityNotFound(_0x525508,null))[_0xbb06('0x25')](saveUpdates(_0xc8f984[_0xbb06('0x48')],null))['then'](respondWithResult(_0x525508,null))[_0xbb06('0x44')](handleError(_0x525508,null));};exports['destroy']=function(_0x540834,_0x165ff2){return db[_0xbb06('0x2b')][_0xbb06('0x46')]({'where':{'id':_0x540834['params']['id']}})[_0xbb06('0x25')](handleEntityNotFound(_0x165ff2,null))[_0xbb06('0x25')](removeEntity(_0x165ff2,null))['catch'](handleError(_0x165ff2,null));};exports[_0xbb06('0x49')]=function(_0x4383ca,_0x263b84){return db[_0xbb06('0x2b')][_0xbb06('0x49')]()['then'](respondWithResult(_0x263b84,null))[_0xbb06('0x44')](handleError(_0x263b84,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 3420d35..1ffdac9 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 _0x600c=['exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','moment','bluebird','path','rimraf','./jscriptyQuestionReport.attributes'];(function(_0x316cf6,_0x1ddc5b){var _0x2968f2=function(_0x52492a){while(--_0x52492a){_0x316cf6['push'](_0x316cf6['shift']());}};_0x2968f2(++_0x1ddc5b);}(_0x600c,0x7c));var _0xc600=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x600c[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xc600('0x0'));var util=require(_0xc600('0x1'));var logger=require('../../config/logger')(_0xc600('0x2'));var moment=require(_0xc600('0x3'));var BPromise=require(_0xc600('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc600('0x5'));var rimraf=require(_0xc600('0x6'));var config=require('../../config/environment');var attributes=require(_0xc600('0x7'));module[_0xc600('0x8')]=function(_0x735ccd,_0x4625f7){return _0x735ccd['define'](_0xc600('0x9'),attributes,{'tableName':_0xc600('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x552f=['exports','report_jscripty_questions','util','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x552f,0x1ba));var _0xf552=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0x552f[_0x5c6022];return _0x4ab5af;};'use strict';var _=require('lodash');var util=require(_0xf552('0x0'));var logger=require('../../config/logger')(_0xf552('0x1'));var moment=require(_0xf552('0x2'));var BPromise=require(_0xf552('0x3'));var rp=require(_0xf552('0x4'));var fs=require('fs');var path=require(_0xf552('0x5'));var rimraf=require('rimraf');var config=require(_0xf552('0x6'));var attributes=require(_0xf552('0x7'));module[_0xf552('0x8')]=function(_0x1a3d3e,_0x1c2f5b){return _0x1a3d3e['define']('JscriptyQuestionReport',attributes,{'tableName':_0xf552('0x9'),'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 c362a18..aee3dc2 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 _0x7842=['randomstring','../../mysqldb','../../config/environment','jayson/promise','http','then','info','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x35c33d,_0x46defa){var _0x5139b3=function(_0x427391){while(--_0x427391){_0x35c33d['push'](_0x35c33d['shift']());}};_0x5139b3(++_0x46defa);}(_0x7842,0x1d1));var _0x2784=function(_0x2423d7,_0xe6ec57){_0x2423d7=_0x2423d7-0x0;var _0x151d17=_0x7842[_0x2423d7];return _0x151d17;};'use strict';var _=require(_0x2784('0x0'));var util=require('util');var moment=require(_0x2784('0x1'));var BPromise=require(_0x2784('0x2'));var rs=require(_0x2784('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2784('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2784('0x5'));var jayson=require(_0x2784('0x6'));var client=jayson['client'][_0x2784('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ffa7e,_0x42cdd7,_0x2d2d03){return new BPromise(function(_0x3cd41f,_0x302097){return client['request'](_0x1ffa7e,_0x2d2d03)[_0x2784('0x8')](function(_0x477b16){logger[_0x2784('0x9')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x42cdd7,_0x2784('0xa'));logger['debug'](_0x2784('0xb'),_0x42cdd7,_0x2784('0xa'),JSON[_0x2784('0xc')](_0x477b16));if(_0x477b16[_0x2784('0xd')]){if(_0x477b16[_0x2784('0xd')]['code']===0x1f4){logger[_0x2784('0xd')](_0x2784('0xe'),_0x42cdd7,_0x477b16[_0x2784('0xd')]['message']);return _0x302097(_0x477b16[_0x2784('0xd')]['message']);}logger[_0x2784('0xd')](_0x2784('0xe'),_0x42cdd7,_0x477b16['error'][_0x2784('0xf')]);return _0x3cd41f(_0x477b16[_0x2784('0xd')][_0x2784('0xf')]);}else{logger[_0x2784('0x9')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x42cdd7,_0x2784('0xa'));_0x3cd41f(_0x477b16[_0x2784('0x10')][_0x2784('0xf')]);}})[_0x2784('0x11')](function(_0x25f65d){logger[_0x2784('0xd')](_0x2784('0xe'),_0x42cdd7,_0x25f65d);_0x302097(_0x25f65d);});});} \ No newline at end of file +var _0x0e5b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x30b5d2,_0x45cd68){var _0x101855=function(_0x386276){while(--_0x386276){_0x30b5d2['push'](_0x30b5d2['shift']());}};_0x101855(++_0x45cd68);}(_0x0e5b,0x1e3));var _0xb0e5=function(_0x76e11b,_0x4e5bea){_0x76e11b=_0x76e11b-0x0;var _0x506127=_0x0e5b[_0x76e11b];return _0x506127;};'use strict';var _=require(_0xb0e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb0e5('0x1'));var rs=require(_0xb0e5('0x2'));var fs=require('fs');var Redis=require(_0xb0e5('0x3'));var db=require(_0xb0e5('0x4'))['db'];var utils=require(_0xb0e5('0x5'));var logger=require(_0xb0e5('0x6'))(_0xb0e5('0x7'));var config=require(_0xb0e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb0e5('0x9')][_0xb0e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ece34,_0x33025d,_0x31a341){return new BPromise(function(_0x406768,_0x492044){return client['request'](_0x1ece34,_0x31a341)[_0xb0e5('0xb')](function(_0x40a750){logger['info'](_0xb0e5('0xc'),_0x33025d,_0xb0e5('0xd'));logger[_0xb0e5('0xe')](_0xb0e5('0xf'),_0x33025d,_0xb0e5('0xd'),JSON['stringify'](_0x40a750));if(_0x40a750['error']){if(_0x40a750[_0xb0e5('0x10')][_0xb0e5('0x11')]===0x1f4){logger[_0xb0e5('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x33025d,_0x40a750[_0xb0e5('0x10')]['message']);return _0x492044(_0x40a750[_0xb0e5('0x10')][_0xb0e5('0x12')]);}logger[_0xb0e5('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x33025d,_0x40a750[_0xb0e5('0x10')][_0xb0e5('0x12')]);return _0x406768(_0x40a750[_0xb0e5('0x10')][_0xb0e5('0x12')]);}else{logger[_0xb0e5('0x13')](_0xb0e5('0xc'),_0x33025d,_0xb0e5('0xd'));_0x406768(_0x40a750[_0xb0e5('0x14')]['message']);}})[_0xb0e5('0x15')](function(_0x48ae23){logger[_0xb0e5('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x33025d,_0x48ae23);_0x492044(_0x48ae23);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ce963a1..5864955 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 _0xc0aa=['/:id','show','/:id/questions','getQuestions','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe'];(function(_0x507ab1,_0x395133){var _0x5c63bc=function(_0x185a73){while(--_0x185a73){_0x507ab1['push'](_0x507ab1['shift']());}};_0x5c63bc(++_0x395133);}(_0xc0aa,0x13d));var _0xac0a=function(_0x36be76,_0x379431){_0x36be76=_0x36be76-0x0;var _0x42d4b4=_0xc0aa[_0x36be76];return _0x42d4b4;};'use strict';var multer=require(_0xac0a('0x0'));var util=require(_0xac0a('0x1'));var path=require('path');var timeout=require(_0xac0a('0x2'));var express=require(_0xac0a('0x3'));var router=express[_0xac0a('0x4')]();var fs_extra=require(_0xac0a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xac0a('0x6'));var config=require(_0xac0a('0x7'));var controller=require(_0xac0a('0x8'));router[_0xac0a('0x9')]('/',auth[_0xac0a('0xa')](),controller[_0xac0a('0xb')]);router[_0xac0a('0x9')](_0xac0a('0xc'),auth[_0xac0a('0xa')](),controller['describe']);router[_0xac0a('0x9')](_0xac0a('0xd'),auth['isAuthenticated'](),controller[_0xac0a('0xe')]);router['get'](_0xac0a('0xf'),auth['isAuthenticated'](),controller[_0xac0a('0x10')]);router[_0xac0a('0x11')]('/',auth[_0xac0a('0xa')](),controller['create']);router[_0xac0a('0x12')](_0xac0a('0xd'),auth['isAuthenticated'](),controller[_0xac0a('0x13')]);router[_0xac0a('0x14')](_0xac0a('0xd'),auth[_0xac0a('0xa')](),controller[_0xac0a('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbdb5=['put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/questions','post','create'];(function(_0x6ff0d6,_0x5baf89){var _0x82d6ac=function(_0x55ac24){while(--_0x55ac24){_0x6ff0d6['push'](_0x6ff0d6['shift']());}};_0x82d6ac(++_0x5baf89);}(_0xbdb5,0x1a8));var _0x5bdb=function(_0x276260,_0x5ef6af){_0x276260=_0x276260-0x0;var _0x5e1f2b=_0xbdb5[_0x276260];return _0x5e1f2b;};'use strict';var multer=require('multer');var util=require(_0x5bdb('0x0'));var path=require('path');var timeout=require(_0x5bdb('0x1'));var express=require(_0x5bdb('0x2'));var router=express[_0x5bdb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5bdb('0x4'));var interaction=require(_0x5bdb('0x5'));var config=require(_0x5bdb('0x6'));var controller=require(_0x5bdb('0x7'));router[_0x5bdb('0x8')]('/',auth['isAuthenticated'](),controller[_0x5bdb('0x9')]);router[_0x5bdb('0x8')](_0x5bdb('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x5bdb('0x8')](_0x5bdb('0xb'),auth[_0x5bdb('0xc')](),controller[_0x5bdb('0xd')]);router['get'](_0x5bdb('0xe'),auth['isAuthenticated'](),controller['getQuestions']);router[_0x5bdb('0xf')]('/',auth[_0x5bdb('0xc')](),controller[_0x5bdb('0x10')]);router[_0x5bdb('0x11')](_0x5bdb('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5bdb('0x12')](_0x5bdb('0xb'),auth[_0x5bdb('0xc')](),controller[_0x5bdb('0x13')]);module[_0x5bdb('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 2583ebf..15cf5a3 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 _0xe2df=['setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','DATE'];(function(_0x3e727c,_0x7cb5d2){var _0x3be9c6=function(_0xb495f0){while(--_0xb495f0){_0x3e727c['push'](_0x3e727c['shift']());}};_0x3be9c6(++_0x7cb5d2);}(_0xe2df,0xec));var _0xfe2d=function(_0x3dece5,_0x21e6aa){_0x3dece5=_0x3dece5-0x0;var _0x42e1c7=_0xe2df[_0x3dece5];return _0x42e1c7;};'use strict';var moment=require(_0xfe2d('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0xfe2d('0x1')],'set':function(_0x4c904b){this[_0xfe2d('0x2')]('starttime',_0x4c904b);this[_0xfe2d('0x2')](_0xfe2d('0x3'),moment()['format'](_0xfe2d('0x4')));}},'endtime':{'type':Sequelize[_0xfe2d('0x1')]},'membername':{'type':Sequelize[_0xfe2d('0x5')]},'projectname':{'type':Sequelize[_0xfe2d('0x5')]},'queue':{'type':Sequelize[_0xfe2d('0x5')]},'uniqueid':{'type':Sequelize[_0xfe2d('0x5')]},'calleridname':{'type':Sequelize[_0xfe2d('0x5')]},'calleridnum':{'type':Sequelize[_0xfe2d('0x5')]},'completed':{'type':Sequelize[_0xfe2d('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x8dec=['STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x8dec,0x1e2));var _0xc8de=function(_0x5a7676,_0x1dd3b9){_0x5a7676=_0x5a7676-0x0;var _0x140d86=_0x8dec[_0x5a7676];return _0x140d86;};'use strict';var moment=require(_0xc8de('0x0'));var Sequelize=require(_0xc8de('0x1'));module[_0xc8de('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x72f622){this[_0xc8de('0x3')](_0xc8de('0x4'),_0x72f622);this['setDataValue'](_0xc8de('0x5'),moment()['format'](_0xc8de('0x6')));}},'endtime':{'type':Sequelize[_0xc8de('0x7')]},'membername':{'type':Sequelize[_0xc8de('0x8')]},'projectname':{'type':Sequelize[_0xc8de('0x8')]},'queue':{'type':Sequelize[_0xc8de('0x8')]},'uniqueid':{'type':Sequelize[_0xc8de('0x8')]},'calleridname':{'type':Sequelize[_0xc8de('0x8')]},'calleridnum':{'type':Sequelize[_0xc8de('0x8')]},'completed':{'type':Sequelize[_0xc8de('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7218ae2..bd4c380 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 _0x529a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','end','error','stack','name','index','map','JscriptySessionReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','create','body','destroy','describe','getQuestions','findOne','params','SessionId','JscriptyQuestionReport','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x431d2b,_0x7a3416){var _0x7e3d8e=function(_0x3e969b){while(--_0x3e969b){_0x431d2b['push'](_0x431d2b['shift']());}};_0x7e3d8e(++_0x7a3416);}(_0x529a,0x18c));var _0xa529=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x529a[_0x56740a];return _0x257144;};'use strict';var emlformat=require(_0xa529('0x0'));var rimraf=require(_0xa529('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa529('0x2'));var rp=require('request-promise');var moment=require(_0xa529('0x3'));var BPromise=require(_0xa529('0x4'));var Mustache=require(_0xa529('0x5'));var util=require(_0xa529('0x6'));var path=require(_0xa529('0x7'));var sox=require(_0xa529('0x8'));var csv=require('to-csv');var ejs=require(_0xa529('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa529('0xa'));var squel=require(_0xa529('0xb'));var crypto=require(_0xa529('0xc'));var jsforce=require(_0xa529('0xd'));var deskjs=require(_0xa529('0xe'));var toCsv=require(_0xa529('0xf'));var querystring=require('querystring');var Papa=require(_0xa529('0x10'));var Redis=require(_0xa529('0x11'));var authService=require(_0xa529('0x12'));var qs=require(_0xa529('0x13'));var as=require(_0xa529('0x14'));var hardwareService=require(_0xa529('0x15'));var logger=require(_0xa529('0x16'))(_0xa529('0x17'));var utils=require(_0xa529('0x18'));var config=require(_0xa529('0x19'));var licenseUtil=require(_0xa529('0x1a'));var db=require(_0xa529('0x1b'))['db'];function respondWithStatusCode(_0x53d918,_0x2cbc5a){_0x2cbc5a=_0x2cbc5a||0xcc;return function(_0x27081c){if(_0x27081c){return _0x53d918[_0xa529('0x1c')](_0x2cbc5a);}return _0x53d918[_0xa529('0x1d')](_0x2cbc5a)['end']();};}function respondWithResult(_0x25e217,_0x2e3514){_0x2e3514=_0x2e3514||0xc8;return function(_0x22a108){if(_0x22a108){return _0x25e217[_0xa529('0x1d')](_0x2e3514)[_0xa529('0x1e')](_0x22a108);}};}function respondWithFilteredResult(_0x5e8b19,_0x1a9e81){return function(_0x5e1289){if(_0x5e1289){var _0x8dc0b4=typeof _0x1a9e81['offset']===_0xa529('0x1f')&&typeof _0x1a9e81[_0xa529('0x20')]===_0xa529('0x1f');var _0xfe0707=_0x5e1289['count'];var _0xf97b0f=_0x8dc0b4?0x0:_0x1a9e81['offset'];var _0x3a7670=_0x8dc0b4?_0x5e1289[_0xa529('0x21')]:_0x1a9e81[_0xa529('0x22')]+_0x1a9e81['limit'];var _0xf2639e;if(_0x3a7670>=_0xfe0707){_0x3a7670=_0xfe0707;_0xf2639e=0xc8;}else{_0xf2639e=0xce;}_0x5e8b19[_0xa529('0x1d')](_0xf2639e);return _0x5e8b19[_0xa529('0x23')](_0xa529('0x24'),_0xf97b0f+'-'+_0x3a7670+'/'+_0xfe0707)['json'](_0x5e1289);}return null;};}function patchUpdates(_0x439eec){return function(_0x39834e){try{jsonpatch[_0xa529('0x25')](_0x39834e,_0x439eec,!![]);}catch(_0x2a5358){return BPromise[_0xa529('0x26')](_0x2a5358);}return _0x39834e['save']();};}function saveUpdates(_0x3c2d99,_0x2b1acb){return function(_0x1ff3ae){if(_0x1ff3ae){return _0x1ff3ae[_0xa529('0x27')](_0x3c2d99)['then'](function(_0x3fc02a){return _0x3fc02a;});}return null;};}function removeEntity(_0x4637ed,_0x12b65b){return function(_0x2bbdf9){if(_0x2bbdf9){return _0x2bbdf9['destroy']()[_0xa529('0x28')](function(){_0x4637ed[_0xa529('0x1d')](0xcc)[_0xa529('0x29')]();});}};}function handleEntityNotFound(_0x29ee78,_0x5586ba){return function(_0x50b829){if(!_0x50b829){_0x29ee78['sendStatus'](0x194);}return _0x50b829;};}function handleError(_0x59a5f0,_0x33cd01){_0x33cd01=_0x33cd01||0x1f4;return function(_0x43422f){logger[_0xa529('0x2a')](_0x43422f[_0xa529('0x2b')]);if(_0x43422f['name']){delete _0x43422f[_0xa529('0x2c')];}_0x59a5f0['status'](_0x33cd01)['send'](_0x43422f);};}exports[_0xa529('0x2d')]=function(_0xd0e857,_0x47f0f1){var _0x534ff1={},_0x1d5e44={},_0x29b407={'count':0x0,'rows':[]};var _0x216686=_[_0xa529('0x2e')](db[_0xa529('0x2f')][_0xa529('0x30')],function(_0x1abb64){return{'name':_0x1abb64['fieldName'],'type':_0x1abb64['type']['key']};});_0x1d5e44[_0xa529('0x31')]=_['map'](_0x216686,'name');_0x1d5e44[_0xa529('0x32')]=_[_0xa529('0x33')](_0xd0e857[_0xa529('0x32')]);_0x1d5e44[_0xa529('0x34')]=_[_0xa529('0x35')](_0x1d5e44[_0xa529('0x31')],_0x1d5e44[_0xa529('0x32')]);_0x534ff1[_0xa529('0x36')]=_[_0xa529('0x35')](_0x1d5e44[_0xa529('0x31')],qs[_0xa529('0x37')](_0xd0e857[_0xa529('0x32')][_0xa529('0x37')]));_0x534ff1['attributes']=_0x534ff1[_0xa529('0x36')][_0xa529('0x38')]?_0x534ff1[_0xa529('0x36')]:_0x1d5e44[_0xa529('0x31')];if(!_0xd0e857[_0xa529('0x32')][_0xa529('0x39')](_0xa529('0x3a'))){_0x534ff1[_0xa529('0x20')]=qs[_0xa529('0x20')](_0xd0e857['query'][_0xa529('0x20')]);_0x534ff1[_0xa529('0x22')]=qs[_0xa529('0x22')](_0xd0e857[_0xa529('0x32')]['offset']);}_0x534ff1[_0xa529('0x3b')]=qs[_0xa529('0x3c')](_0xd0e857[_0xa529('0x32')][_0xa529('0x3c')]);_0x534ff1[_0xa529('0x3d')]=qs[_0xa529('0x34')](_[_0xa529('0x3e')](_0xd0e857['query'],_0x1d5e44['filters']),_0x216686);if(_0xd0e857['query'][_0xa529('0x3f')]){_0x534ff1[_0xa529('0x3d')]=_[_0xa529('0x40')](_0x534ff1[_0xa529('0x3d')],{'$or':_['map'](_0x216686,function(_0x557395){if(_0x557395[_0xa529('0x41')]!=='VIRTUAL'){var _0x27e8e5={};_0x27e8e5[_0x557395[_0xa529('0x2c')]]={'$like':'%'+_0xd0e857['query']['filter']+'%'};return _0x27e8e5;}})});}_0x534ff1=_['merge']({},_0x534ff1,_0xd0e857[_0xa529('0x42')]);var _0x480e6a={'where':_0x534ff1['where']};return db['JscriptySessionReport'][_0xa529('0x21')](_0x480e6a)[_0xa529('0x28')](function(_0x2bea44){_0x29b407['count']=_0x2bea44;if(_0xd0e857[_0xa529('0x32')][_0xa529('0x43')]){_0x534ff1[_0xa529('0x44')]=[{'all':!![]}];}return db[_0xa529('0x2f')][_0xa529('0x45')](_0x534ff1);})[_0xa529('0x28')](function(_0x296c8c){_0x29b407[_0xa529('0x46')]=_0x296c8c;return _0x29b407;})[_0xa529('0x28')](respondWithFilteredResult(_0x47f0f1,_0x534ff1))[_0xa529('0x47')](handleError(_0x47f0f1,null));};exports[_0xa529('0x48')]=function(_0xb9c02c,_0x507f15){var _0x105053={'raw':!![],'where':{'id':_0xb9c02c['params']['id']}},_0x336d1f={};_0x336d1f[_0xa529('0x31')]=_[_0xa529('0x33')](db[_0xa529('0x2f')][_0xa529('0x30')]);_0x336d1f[_0xa529('0x32')]=_[_0xa529('0x33')](_0xb9c02c['query']);_0x336d1f[_0xa529('0x34')]=_[_0xa529('0x35')](_0x336d1f[_0xa529('0x31')],_0x336d1f[_0xa529('0x32')]);_0x105053[_0xa529('0x36')]=_[_0xa529('0x35')](_0x336d1f['model'],qs[_0xa529('0x37')](_0xb9c02c[_0xa529('0x32')][_0xa529('0x37')]));_0x105053[_0xa529('0x36')]=_0x105053[_0xa529('0x36')][_0xa529('0x38')]?_0x105053[_0xa529('0x36')]:_0x336d1f[_0xa529('0x31')];if(_0xb9c02c[_0xa529('0x32')][_0xa529('0x43')]){_0x105053[_0xa529('0x44')]=[{'all':!![]}];}_0x105053=_[_0xa529('0x40')]({},_0x105053,_0xb9c02c[_0xa529('0x42')]);return db[_0xa529('0x2f')][_0xa529('0x49')](_0x105053)[_0xa529('0x28')](handleEntityNotFound(_0x507f15,null))[_0xa529('0x28')](respondWithResult(_0x507f15,null))[_0xa529('0x47')](handleError(_0x507f15,null));};exports[_0xa529('0x4a')]=function(_0x5cb907,_0x3073ac){return db[_0xa529('0x2f')][_0xa529('0x4a')](_0x5cb907[_0xa529('0x4b')],{})[_0xa529('0x28')](respondWithResult(_0x3073ac,0xc9))[_0xa529('0x47')](handleError(_0x3073ac,null));};exports[_0xa529('0x27')]=function(_0x19f471,_0x1e21c3){if(_0x19f471[_0xa529('0x4b')]['id']){delete _0x19f471[_0xa529('0x4b')]['id'];}return db[_0xa529('0x2f')][_0xa529('0x49')]({'where':{'id':_0x19f471['params']['id']}})['then'](handleEntityNotFound(_0x1e21c3,null))[_0xa529('0x28')](saveUpdates(_0x19f471[_0xa529('0x4b')],null))[_0xa529('0x28')](respondWithResult(_0x1e21c3,null))[_0xa529('0x47')](handleError(_0x1e21c3,null));};exports[_0xa529('0x4c')]=function(_0x558c38,_0xf1e993){return db[_0xa529('0x2f')]['find']({'where':{'id':_0x558c38['params']['id']}})[_0xa529('0x28')](handleEntityNotFound(_0xf1e993,null))[_0xa529('0x28')](removeEntity(_0xf1e993,null))['catch'](handleError(_0xf1e993,null));};exports[_0xa529('0x4d')]=function(_0xdcc58f,_0x5c028b){return db[_0xa529('0x2f')][_0xa529('0x4d')]()[_0xa529('0x28')](respondWithResult(_0x5c028b,null))['catch'](handleError(_0x5c028b,null));};exports[_0xa529('0x4e')]=function(_0x38165b,_0x1453b0,_0x358f3c){var _0x334783={'raw':!![],'where':{}};var _0x56634d={};var _0xf021be={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xa529('0x4f')]({'where':{'id':_0x38165b[_0xa529('0x50')]['id']}})[_0xa529('0x28')](handleEntityNotFound(_0x1453b0,null))[_0xa529('0x28')](function(_0x25e8d7){if(_0x25e8d7){_0x56634d[_0xa529('0x31')]=_[_0xa529('0x33')](db['JscriptyQuestionReport'][_0xa529('0x30')]);_0x56634d[_0xa529('0x32')]=_[_0xa529('0x33')](_0x38165b[_0xa529('0x32')]);_0x56634d[_0xa529('0x34')]=_[_0xa529('0x35')](_0x56634d[_0xa529('0x31')],_0x56634d['query']);_0x334783[_0xa529('0x36')]=_[_0xa529('0x35')](_0x56634d[_0xa529('0x31')],qs[_0xa529('0x37')](_0x38165b[_0xa529('0x32')][_0xa529('0x37')]));_0x334783[_0xa529('0x36')]=_0x334783['attributes'][_0xa529('0x38')]?_0x334783[_0xa529('0x36')]:_0x56634d['model'];if(!_0x38165b[_0xa529('0x32')]['hasOwnProperty']('nolimit')){_0x334783[_0xa529('0x20')]=qs[_0xa529('0x20')](_0x38165b['query'][_0xa529('0x20')]);_0x334783[_0xa529('0x22')]=qs[_0xa529('0x22')](_0x38165b[_0xa529('0x32')][_0xa529('0x22')]);}_0x334783['order']=qs['sort'](_0x38165b['query'][_0xa529('0x3c')]);_0x334783['where']=qs[_0xa529('0x34')](_[_0xa529('0x3e')](_0x38165b['query'],_0x56634d[_0xa529('0x34')]));_0x334783[_0xa529('0x3d')][_0xa529('0x51')]=_0x25e8d7['id'];if(_0x38165b[_0xa529('0x32')][_0xa529('0x3f')]){_0x334783['where']=_[_0xa529('0x40')](_0x334783[_0xa529('0x3d')],{'$or':_[_0xa529('0x2e')](_0x334783[_0xa529('0x36')],function(_0x36c680){var _0x2cb836={};_0x2cb836[_0x36c680]={'$like':'%'+_0x38165b[_0xa529('0x32')][_0xa529('0x3f')]+'%'};return _0x2cb836;})});}_0x334783=_[_0xa529('0x40')]({},_0x334783,_0x38165b[_0xa529('0x42')]);return db[_0xa529('0x52')][_0xa529('0x21')]({'where':_0x334783[_0xa529('0x3d')]})[_0xa529('0x28')](function(_0x2b687b){_0xf021be['count']=_0x2b687b;if(_0x38165b[_0xa529('0x32')]['includeAll']){_0x334783['include']=[{'all':!![]}];}return db[_0xa529('0x52')][_0xa529('0x45')](_0x334783);})[_0xa529('0x28')](function(_0x5c4722){_0xf021be[_0xa529('0x46')]=_0x5c4722;return _0xf021be;});}})['then'](respondWithFilteredResult(_0x1453b0,_0x334783))[_0xa529('0x47')](handleError(_0x1453b0,null));}; \ No newline at end of file +var _0x689d=['end','offset','count','limit','Content-Range','reject','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','order','sort','filters','pick','VIRTUAL','filter','merge','options','where','JscriptySessionReport','include','findAll','rows','show','params','includeAll','find','create','body','catch','update','destroy','describe','findOne','hasOwnProperty','nolimit','SessionId','JscriptyQuestionReport','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x4caaaa,_0x43123f){var _0x356d35=function(_0xa1bc59){while(--_0xa1bc59){_0x4caaaa['push'](_0x4caaaa['shift']());}};_0x356d35(++_0x43123f);}(_0x689d,0x19f));var _0xd689=function(_0x22e133,_0x527287){_0x22e133=_0x22e133-0x0;var _0x3455ca=_0x689d[_0x22e133];return _0x3455ca;};'use strict';var emlformat=require(_0xd689('0x0'));var rimraf=require(_0xd689('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd689('0x2'));var rp=require(_0xd689('0x3'));var moment=require('moment');var BPromise=require(_0xd689('0x4'));var Mustache=require('mustache');var util=require(_0xd689('0x5'));var path=require(_0xd689('0x6'));var sox=require(_0xd689('0x7'));var csv=require(_0xd689('0x8'));var ejs=require(_0xd689('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd689('0xa'));var crypto=require('crypto');var jsforce=require(_0xd689('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd689('0x8'));var querystring=require(_0xd689('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd689('0xd'));var qs=require(_0xd689('0xe'));var as=require(_0xd689('0xf'));var hardwareService=require(_0xd689('0x10'));var logger=require(_0xd689('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd689('0x12'));var licenseUtil=require(_0xd689('0x13'));var db=require(_0xd689('0x14'))['db'];function respondWithStatusCode(_0x2ac7e9,_0x4444e6){_0x4444e6=_0x4444e6||0xcc;return function(_0x1addfb){if(_0x1addfb){return _0x2ac7e9[_0xd689('0x15')](_0x4444e6);}return _0x2ac7e9[_0xd689('0x16')](_0x4444e6)[_0xd689('0x17')]();};}function respondWithResult(_0x28f28c,_0x535865){_0x535865=_0x535865||0xc8;return function(_0x42a42e){if(_0x42a42e){return _0x28f28c[_0xd689('0x16')](_0x535865)['json'](_0x42a42e);}};}function respondWithFilteredResult(_0x44a1a2,_0x1c74c7){return function(_0x3fafd1){if(_0x3fafd1){var _0x402765=typeof _0x1c74c7[_0xd689('0x18')]==='undefined'&&typeof _0x1c74c7['limit']==='undefined';var _0x14c335=_0x3fafd1[_0xd689('0x19')];var _0x32003f=_0x402765?0x0:_0x1c74c7[_0xd689('0x18')];var _0x3346fe=_0x402765?_0x3fafd1[_0xd689('0x19')]:_0x1c74c7[_0xd689('0x18')]+_0x1c74c7[_0xd689('0x1a')];var _0xced3a7;if(_0x3346fe>=_0x14c335){_0x3346fe=_0x14c335;_0xced3a7=0xc8;}else{_0xced3a7=0xce;}_0x44a1a2[_0xd689('0x16')](_0xced3a7);return _0x44a1a2['set'](_0xd689('0x1b'),_0x32003f+'-'+_0x3346fe+'/'+_0x14c335)['json'](_0x3fafd1);}return null;};}function patchUpdates(_0x15ebbc){return function(_0x4b4597){try{jsonpatch['apply'](_0x4b4597,_0x15ebbc,!![]);}catch(_0x39cc77){return BPromise[_0xd689('0x1c')](_0x39cc77);}return _0x4b4597['save']();};}function saveUpdates(_0x117a85,_0x3c06a9){return function(_0x31763e){if(_0x31763e){return _0x31763e['update'](_0x117a85)[_0xd689('0x1d')](function(_0x242eb0){return _0x242eb0;});}return null;};}function removeEntity(_0x283fb1,_0x10ec49){return function(_0x2c1e62){if(_0x2c1e62){return _0x2c1e62['destroy']()[_0xd689('0x1d')](function(){_0x283fb1[_0xd689('0x16')](0xcc)[_0xd689('0x17')]();});}};}function handleEntityNotFound(_0x1a50a7,_0x3fd325){return function(_0x166259){if(!_0x166259){_0x1a50a7[_0xd689('0x15')](0x194);}return _0x166259;};}function handleError(_0x747af7,_0x2039b8){_0x2039b8=_0x2039b8||0x1f4;return function(_0x23d038){logger[_0xd689('0x1e')](_0x23d038['stack']);if(_0x23d038[_0xd689('0x1f')]){delete _0x23d038['name'];}_0x747af7['status'](_0x2039b8)[_0xd689('0x20')](_0x23d038);};}exports[_0xd689('0x21')]=function(_0x52d1d2,_0x529138){var _0x8f6a1={},_0x2b32fc={},_0x4eef4f={'count':0x0,'rows':[]};var _0x17faca=_[_0xd689('0x22')](db['JscriptySessionReport'][_0xd689('0x23')],function(_0x2b91a2){return{'name':_0x2b91a2[_0xd689('0x24')],'type':_0x2b91a2[_0xd689('0x25')][_0xd689('0x26')]};});_0x2b32fc[_0xd689('0x27')]=_[_0xd689('0x22')](_0x17faca,_0xd689('0x1f'));_0x2b32fc['query']=_[_0xd689('0x28')](_0x52d1d2['query']);_0x2b32fc['filters']=_['intersection'](_0x2b32fc[_0xd689('0x27')],_0x2b32fc[_0xd689('0x29')]);_0x8f6a1[_0xd689('0x2a')]=_[_0xd689('0x2b')](_0x2b32fc['model'],qs[_0xd689('0x2c')](_0x52d1d2[_0xd689('0x29')][_0xd689('0x2c')]));_0x8f6a1[_0xd689('0x2a')]=_0x8f6a1[_0xd689('0x2a')]['length']?_0x8f6a1[_0xd689('0x2a')]:_0x2b32fc['model'];if(!_0x52d1d2[_0xd689('0x29')]['hasOwnProperty']('nolimit')){_0x8f6a1[_0xd689('0x1a')]=qs[_0xd689('0x1a')](_0x52d1d2[_0xd689('0x29')]['limit']);_0x8f6a1[_0xd689('0x18')]=qs[_0xd689('0x18')](_0x52d1d2[_0xd689('0x29')]['offset']);}_0x8f6a1[_0xd689('0x2d')]=qs['sort'](_0x52d1d2['query'][_0xd689('0x2e')]);_0x8f6a1['where']=qs[_0xd689('0x2f')](_[_0xd689('0x30')](_0x52d1d2[_0xd689('0x29')],_0x2b32fc[_0xd689('0x2f')]),_0x17faca);if(_0x52d1d2[_0xd689('0x29')]['filter']){_0x8f6a1['where']=_['merge'](_0x8f6a1['where'],{'$or':_['map'](_0x17faca,function(_0x1952ae){if(_0x1952ae['type']!==_0xd689('0x31')){var _0x3f8e2d={};_0x3f8e2d[_0x1952ae['name']]={'$like':'%'+_0x52d1d2[_0xd689('0x29')][_0xd689('0x32')]+'%'};return _0x3f8e2d;}})});}_0x8f6a1=_[_0xd689('0x33')]({},_0x8f6a1,_0x52d1d2[_0xd689('0x34')]);var _0xa04af4={'where':_0x8f6a1[_0xd689('0x35')]};return db[_0xd689('0x36')]['count'](_0xa04af4)[_0xd689('0x1d')](function(_0x31b959){_0x4eef4f[_0xd689('0x19')]=_0x31b959;if(_0x52d1d2[_0xd689('0x29')]['includeAll']){_0x8f6a1[_0xd689('0x37')]=[{'all':!![]}];}return db[_0xd689('0x36')][_0xd689('0x38')](_0x8f6a1);})[_0xd689('0x1d')](function(_0xe914b2){_0x4eef4f[_0xd689('0x39')]=_0xe914b2;return _0x4eef4f;})[_0xd689('0x1d')](respondWithFilteredResult(_0x529138,_0x8f6a1))['catch'](handleError(_0x529138,null));};exports[_0xd689('0x3a')]=function(_0x10174f,_0x57e78c){var _0xa14dbd={'raw':!![],'where':{'id':_0x10174f[_0xd689('0x3b')]['id']}},_0x2074ac={};_0x2074ac['model']=_[_0xd689('0x28')](db[_0xd689('0x36')][_0xd689('0x23')]);_0x2074ac['query']=_['keys'](_0x10174f['query']);_0x2074ac['filters']=_[_0xd689('0x2b')](_0x2074ac['model'],_0x2074ac['query']);_0xa14dbd[_0xd689('0x2a')]=_[_0xd689('0x2b')](_0x2074ac['model'],qs[_0xd689('0x2c')](_0x10174f[_0xd689('0x29')][_0xd689('0x2c')]));_0xa14dbd[_0xd689('0x2a')]=_0xa14dbd[_0xd689('0x2a')]['length']?_0xa14dbd[_0xd689('0x2a')]:_0x2074ac[_0xd689('0x27')];if(_0x10174f['query'][_0xd689('0x3c')]){_0xa14dbd[_0xd689('0x37')]=[{'all':!![]}];}_0xa14dbd=_['merge']({},_0xa14dbd,_0x10174f['options']);return db['JscriptySessionReport'][_0xd689('0x3d')](_0xa14dbd)[_0xd689('0x1d')](handleEntityNotFound(_0x57e78c,null))['then'](respondWithResult(_0x57e78c,null))['catch'](handleError(_0x57e78c,null));};exports[_0xd689('0x3e')]=function(_0x42943d,_0x103825){return db[_0xd689('0x36')][_0xd689('0x3e')](_0x42943d[_0xd689('0x3f')],{})[_0xd689('0x1d')](respondWithResult(_0x103825,0xc9))[_0xd689('0x40')](handleError(_0x103825,null));};exports[_0xd689('0x41')]=function(_0x30017b,_0x1f380b){if(_0x30017b['body']['id']){delete _0x30017b[_0xd689('0x3f')]['id'];}return db[_0xd689('0x36')][_0xd689('0x3d')]({'where':{'id':_0x30017b[_0xd689('0x3b')]['id']}})[_0xd689('0x1d')](handleEntityNotFound(_0x1f380b,null))[_0xd689('0x1d')](saveUpdates(_0x30017b[_0xd689('0x3f')],null))[_0xd689('0x1d')](respondWithResult(_0x1f380b,null))[_0xd689('0x40')](handleError(_0x1f380b,null));};exports[_0xd689('0x42')]=function(_0x218853,_0x1bfc3a){return db[_0xd689('0x36')][_0xd689('0x3d')]({'where':{'id':_0x218853[_0xd689('0x3b')]['id']}})[_0xd689('0x1d')](handleEntityNotFound(_0x1bfc3a,null))[_0xd689('0x1d')](removeEntity(_0x1bfc3a,null))[_0xd689('0x40')](handleError(_0x1bfc3a,null));};exports[_0xd689('0x43')]=function(_0x9f576e,_0xf6edb1){return db[_0xd689('0x36')][_0xd689('0x43')]()[_0xd689('0x1d')](respondWithResult(_0xf6edb1,null))['catch'](handleError(_0xf6edb1,null));};exports['getQuestions']=function(_0x241aaa,_0x48b5ea,_0x220cc2){var _0x284538={'raw':!![],'where':{}};var _0x3002bd={};var _0x9ac5a3={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xd689('0x44')]({'where':{'id':_0x241aaa[_0xd689('0x3b')]['id']}})[_0xd689('0x1d')](handleEntityNotFound(_0x48b5ea,null))['then'](function(_0x59e5c6){if(_0x59e5c6){_0x3002bd['model']=_[_0xd689('0x28')](db['JscriptyQuestionReport'][_0xd689('0x23')]);_0x3002bd[_0xd689('0x29')]=_[_0xd689('0x28')](_0x241aaa[_0xd689('0x29')]);_0x3002bd[_0xd689('0x2f')]=_[_0xd689('0x2b')](_0x3002bd['model'],_0x3002bd['query']);_0x284538['attributes']=_[_0xd689('0x2b')](_0x3002bd[_0xd689('0x27')],qs[_0xd689('0x2c')](_0x241aaa['query'][_0xd689('0x2c')]));_0x284538[_0xd689('0x2a')]=_0x284538[_0xd689('0x2a')]['length']?_0x284538['attributes']:_0x3002bd[_0xd689('0x27')];if(!_0x241aaa['query'][_0xd689('0x45')](_0xd689('0x46'))){_0x284538[_0xd689('0x1a')]=qs[_0xd689('0x1a')](_0x241aaa['query'][_0xd689('0x1a')]);_0x284538[_0xd689('0x18')]=qs[_0xd689('0x18')](_0x241aaa[_0xd689('0x29')]['offset']);}_0x284538[_0xd689('0x2d')]=qs['sort'](_0x241aaa[_0xd689('0x29')]['sort']);_0x284538[_0xd689('0x35')]=qs[_0xd689('0x2f')](_[_0xd689('0x30')](_0x241aaa[_0xd689('0x29')],_0x3002bd[_0xd689('0x2f')]));_0x284538[_0xd689('0x35')][_0xd689('0x47')]=_0x59e5c6['id'];if(_0x241aaa[_0xd689('0x29')][_0xd689('0x32')]){_0x284538[_0xd689('0x35')]=_['merge'](_0x284538[_0xd689('0x35')],{'$or':_['map'](_0x284538['attributes'],function(_0x4bf226){var _0x4268ae={};_0x4268ae[_0x4bf226]={'$like':'%'+_0x241aaa[_0xd689('0x29')][_0xd689('0x32')]+'%'};return _0x4268ae;})});}_0x284538=_[_0xd689('0x33')]({},_0x284538,_0x241aaa['options']);return db[_0xd689('0x48')]['count']({'where':_0x284538[_0xd689('0x35')]})[_0xd689('0x1d')](function(_0x572af7){_0x9ac5a3[_0xd689('0x19')]=_0x572af7;if(_0x241aaa['query']['includeAll']){_0x284538[_0xd689('0x37')]=[{'all':!![]}];}return db[_0xd689('0x48')][_0xd689('0x38')](_0x284538);})[_0xd689('0x1d')](function(_0x2a47a5){_0x9ac5a3[_0xd689('0x39')]=_0x2a47a5;return _0x9ac5a3;});}})[_0xd689('0x1d')](respondWithFilteredResult(_0x48b5ea,_0x284538))[_0xd689('0x40')](handleError(_0x48b5ea,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index e5f24a0..81b5fc0 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 _0x7217=['../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0x7217,0x19e));var _0x7721=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7217[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','lodash','util','api','moment','bluebird','path'];(function(_0xa0e3e3,_0x1ebf50){var _0x517992=function(_0x57adf9){while(--_0x57adf9){_0xa0e3e3['push'](_0xa0e3e3['shift']());}};_0x517992(++_0x1ebf50);}(_0xeff8,0x186));var _0x8eff=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xeff8[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 996d673..56eaafc 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 _0x5464=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x17c372,_0x3dd069){var _0x4fcc89=function(_0x385da9){while(--_0x385da9){_0x17c372['push'](_0x17c372['shift']());}};_0x4fcc89(++_0x3dd069);}(_0x5464,0x15d));var _0x4546=function(_0x50d41d,_0x11cb39){_0x50d41d=_0x50d41d-0x0;var _0x412afa=_0x5464[_0x50d41d];return _0x412afa;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});} \ No newline at end of file +var _0xc1c6=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x3fa6bd,_0x54de34){var _0x1bd448=function(_0x3df4f9){while(--_0x3df4f9){_0x3fa6bd['push'](_0x3fa6bd['shift']());}};_0x1bd448(++_0x54de34);}(_0xc1c6,0xf7));var _0x6c1c=function(_0xed8a98,_0xe1231c){_0xed8a98=_0xed8a98-0x0;var _0x2eafe1=_0xc1c6[_0xed8a98];return _0x2eafe1;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index fe71b66..7ae9ce1 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 _0x9407=['downloadLogFile','exports','multer','util','express','fs-extra','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update','/download_log_file'];(function(_0x93d258,_0x3b96fa){var _0x32c4ad=function(_0xaefc78){while(--_0xaefc78){_0x93d258['push'](_0x93d258['shift']());}};_0x32c4ad(++_0x3b96fa);}(_0x9407,0x1ec));var _0x7940=function(_0x321322,_0x3a3e46){_0x321322=_0x321322-0x0;var _0x3fb77f=_0x9407[_0x321322];return _0x3fb77f;};'use strict';var multer=require(_0x7940('0x0'));var util=require(_0x7940('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7940('0x2'));var router=express['Router']();var fs_extra=require(_0x7940('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7940('0x4'));var controller=require(_0x7940('0x5'));router[_0x7940('0x6')]('/',controller[_0x7940('0x7')]);router['put'](_0x7940('0x8'),auth[_0x7940('0x9')](),controller[_0x7940('0xa')]);router['get'](_0x7940('0xb'),auth[_0x7940('0x9')](),controller[_0x7940('0xc')]);module[_0x7940('0xd')]=router; \ No newline at end of file +var _0x5e30=['../../config/environment','get','index','put','isAuthenticated','update','/download_log_file','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5e30,0x1ca));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x05e3('0x0'));var util=require(_0x05e3('0x1'));var path=require(_0x05e3('0x2'));var timeout=require(_0x05e3('0x3'));var express=require(_0x05e3('0x4'));var router=express['Router']();var fs_extra=require(_0x05e3('0x5'));var auth=require(_0x05e3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x05e3('0x7'));var controller=require('./license.controller');router[_0x05e3('0x8')]('/',controller[_0x05e3('0x9')]);router[_0x05e3('0xa')]('/:id',auth[_0x05e3('0xb')](),controller[_0x05e3('0xc')]);router['get'](_0x05e3('0xd'),auth[_0x05e3('0xb')](),controller['downloadLogFile']);module[_0x05e3('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index ddbdeee..b13d459 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 _0x1573=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x1573,0x17a));var _0x3157=function(_0x21ae22,_0x54911f){_0x21ae22=_0x21ae22-0x0;var _0x1e610a=_0x1573[_0x21ae22];return _0x1e610a;};'use strict';var Sequelize=require(_0x3157('0x0'));module[_0x3157('0x1')]={'license':{'type':Sequelize[_0x3157('0x2')]},'data1':{'type':Sequelize[_0x3157('0x3')]},'data2':{'type':Sequelize[_0x3157('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x3157('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9748=['STRING','sequelize','exports','TEXT'];(function(_0x31587e,_0x1eec2b){var _0x5b64f9=function(_0x5d514c){while(--_0x5d514c){_0x31587e['push'](_0x31587e['shift']());}};_0x5b64f9(++_0x1eec2b);}(_0x9748,0x1e9));var _0x8974=function(_0xa29d93,_0xfdb711){_0xa29d93=_0xa29d93-0x0;var _0x379ec3=_0x9748[_0xa29d93];return _0x379ec3;};'use strict';var Sequelize=require(_0x8974('0x0'));module[_0x8974('0x1')]={'license':{'type':Sequelize[_0x8974('0x2')]},'data1':{'type':Sequelize[_0x8974('0x3')]},'data2':{'type':Sequelize[_0x8974('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index a7d095e..14472cc 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 _0x67e5=['../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','model','query','keys','filters','intersection','attributes','fields','length','options','getLicense','body','License','find','params','get','checkLicense','key','demo','catch','downloadLogFile','license-info.log','/var','log','xcally','setHeader','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3c858f,_0x235201){var _0x198090=function(_0xc4c406){while(--_0xc4c406){_0x3c858f['push'](_0x3c858f['shift']());}};_0x198090(++_0x235201);}(_0x67e5,0x106));var _0x567e=function(_0x2886fe,_0x4c53b3){_0x2886fe=_0x2886fe-0x0;var _0x59a248=_0x67e5[_0x2886fe];return _0x59a248;};'use strict';var emlformat=require(_0x567e('0x0'));var rimraf=require(_0x567e('0x1'));var zipdir=require(_0x567e('0x2'));var jsonpatch=require(_0x567e('0x3'));var rp=require('request-promise');var moment=require(_0x567e('0x4'));var BPromise=require(_0x567e('0x5'));var Mustache=require(_0x567e('0x6'));var util=require(_0x567e('0x7'));var path=require(_0x567e('0x8'));var sox=require('sox');var csv=require(_0x567e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x567e('0xa'));var jsforce=require(_0x567e('0xb'));var deskjs=require(_0x567e('0xc'));var toCsv=require(_0x567e('0x9'));var querystring=require(_0x567e('0xd'));var Papa=require('papaparse');var Redis=require(_0x567e('0xe'));var authService=require(_0x567e('0xf'));var qs=require(_0x567e('0x10'));var as=require(_0x567e('0x11'));var hardwareService=require(_0x567e('0x12'));var logger=require(_0x567e('0x13'))(_0x567e('0x14'));var utils=require(_0x567e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x567e('0x16'));var db=require(_0x567e('0x17'))['db'];function respondWithStatusCode(_0x4fd6f5,_0x587145){_0x587145=_0x587145||0xcc;return function(_0x5bbf71){if(_0x5bbf71){return _0x4fd6f5['sendStatus'](_0x587145);}return _0x4fd6f5['status'](_0x587145)[_0x567e('0x18')]();};}function respondWithResult(_0x19cbec,_0x5d59dc){_0x5d59dc=_0x5d59dc||0xc8;return function(_0x32e684){if(_0x32e684){return _0x19cbec[_0x567e('0x19')](_0x5d59dc)[_0x567e('0x1a')](_0x32e684);}};}function respondWithFilteredResult(_0x436d39,_0x3a0b2e){return function(_0x155dd2){if(_0x155dd2){var _0x131f7e=typeof _0x3a0b2e[_0x567e('0x1b')]===_0x567e('0x1c')&&typeof _0x3a0b2e[_0x567e('0x1d')]===_0x567e('0x1c');var _0x1467a9=_0x155dd2[_0x567e('0x1e')];var _0x35b76b=_0x131f7e?0x0:_0x3a0b2e['offset'];var _0x5e3419=_0x131f7e?_0x155dd2[_0x567e('0x1e')]:_0x3a0b2e['offset']+_0x3a0b2e[_0x567e('0x1d')];var _0x5ada6b;if(_0x5e3419>=_0x1467a9){_0x5e3419=_0x1467a9;_0x5ada6b=0xc8;}else{_0x5ada6b=0xce;}_0x436d39[_0x567e('0x19')](_0x5ada6b);return _0x436d39[_0x567e('0x1f')](_0x567e('0x20'),_0x35b76b+'-'+_0x5e3419+'/'+_0x1467a9)[_0x567e('0x1a')](_0x155dd2);}return null;};}function patchUpdates(_0x31ceaf){return function(_0x4a3b0b){try{jsonpatch[_0x567e('0x21')](_0x4a3b0b,_0x31ceaf,!![]);}catch(_0x419bbf){return BPromise[_0x567e('0x22')](_0x419bbf);}return _0x4a3b0b[_0x567e('0x23')]();};}function saveUpdates(_0x3219b5,_0x4fa030){return function(_0x2f2c93){if(_0x2f2c93){return _0x2f2c93[_0x567e('0x24')](_0x3219b5)[_0x567e('0x25')](function(_0x6a7c01){return _0x6a7c01;});}return null;};}function removeEntity(_0x2a4015,_0x12e032){return function(_0x18f775){if(_0x18f775){return _0x18f775[_0x567e('0x26')]()[_0x567e('0x25')](function(){_0x2a4015[_0x567e('0x19')](0xcc)[_0x567e('0x18')]();});}};}function handleEntityNotFound(_0x1a66de,_0x1b9cd2){return function(_0x5240f0){if(!_0x5240f0){_0x1a66de[_0x567e('0x27')](0x194);}return _0x5240f0;};}function handleError(_0x4e8404,_0x2d4e36){_0x2d4e36=_0x2d4e36||0x1f4;return function(_0x45d659){logger[_0x567e('0x28')](_0x45d659[_0x567e('0x29')]);if(_0x45d659[_0x567e('0x2a')]){delete _0x45d659[_0x567e('0x2a')];}_0x4e8404['status'](_0x2d4e36)[_0x567e('0x2b')](_0x45d659);};}var utilLicense=require(_0x567e('0x16'));exports[_0x567e('0x2c')]=function(_0x28bd3a,_0x5312b9){var _0x51b79c={'raw':!![],'where':{'id':0x1}},_0x391245={};_0x391245[_0x567e('0x2d')]=_['keys'](db['License']['rawAttributes']);_0x391245[_0x567e('0x2e')]=_[_0x567e('0x2f')](_0x28bd3a[_0x567e('0x2e')]);_0x391245[_0x567e('0x30')]=_[_0x567e('0x31')](_0x391245[_0x567e('0x2d')],_0x391245[_0x567e('0x2e')]);_0x51b79c[_0x567e('0x32')]=_['intersection'](_0x391245['model'],qs[_0x567e('0x33')](_0x28bd3a[_0x567e('0x2e')][_0x567e('0x33')]));_0x51b79c[_0x567e('0x32')]=_0x51b79c[_0x567e('0x32')][_0x567e('0x34')]?_0x51b79c['attributes']:_0x391245['model'];_0x51b79c=_['merge']({},_0x51b79c,_0x28bd3a[_0x567e('0x35')]);return utilLicense[_0x567e('0x36')](_0x51b79c)[_0x567e('0x25')](respondWithResult(_0x5312b9,null))['catch'](handleError(_0x5312b9,null));};exports[_0x567e('0x24')]=function(_0x1c2b19,_0x32db21){if(_0x1c2b19[_0x567e('0x37')]['id']){delete _0x1c2b19[_0x567e('0x37')]['id'];}return db[_0x567e('0x38')][_0x567e('0x39')]({'where':{'id':_0x1c2b19[_0x567e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x32db21,null))['then'](function(_0x389433){var _0x3ed06c=_0x389433[_0x567e('0x3b')]({'plain':!![]});return utilLicense[_0x567e('0x3c')](_0x3ed06c,_0x1c2b19[_0x567e('0x37')][_0x567e('0x3d')]);})[_0x567e('0x25')](function(_0x36d060){if(!_0x36d060[_0x567e('0x3e')]){return saveUpdates(_0x1c2b19[_0x567e('0x37')],null);}return _0x36d060;})[_0x567e('0x25')](respondWithResult(_0x32db21,null))[_0x567e('0x3f')](handleError(_0x32db21,null));};exports[_0x567e('0x40')]=function(_0x48accb,_0x4daad3){var _0x2e1c9b=_0x567e('0x41');var _0x33f797=path['join'](_0x567e('0x42'),_0x567e('0x43'),_0x567e('0x44'),_0x2e1c9b);_0x4daad3[_0x567e('0x45')]('Content-disposition','attachment;\x20filename='+_0x2e1c9b);_0x4daad3[_0x567e('0x1f')]('Content-Type',_0x567e('0x46'));_0x4daad3['download'](_0x33f797);}; \ No newline at end of file +var _0xd160=['setHeader','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','set','json','apply','reject','then','sendStatus','error','stack','name','send','../../config/license/util','index','model','rawAttributes','query','keys','intersection','attributes','fields','length','options','getLicense','update','body','find','params','key','demo','catch','join','/var','xcally'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd160,0xc8));var _0x0d16=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xd160[_0x23b655];return _0x364b32;};'use strict';var emlformat=require(_0x0d16('0x0'));var rimraf=require(_0x0d16('0x1'));var zipdir=require(_0x0d16('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d16('0x3'));var moment=require('moment');var BPromise=require(_0x0d16('0x4'));var Mustache=require(_0x0d16('0x5'));var util=require(_0x0d16('0x6'));var path=require('path');var sox=require(_0x0d16('0x7'));var csv=require(_0x0d16('0x8'));var ejs=require(_0x0d16('0x9'));var fs=require('fs');var fs_extra=require(_0x0d16('0xa'));var _=require(_0x0d16('0xb'));var squel=require(_0x0d16('0xc'));var crypto=require(_0x0d16('0xd'));var jsforce=require(_0x0d16('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0d16('0x8'));var querystring=require(_0x0d16('0xf'));var Papa=require(_0x0d16('0x10'));var Redis=require('ioredis');var authService=require(_0x0d16('0x11'));var qs=require(_0x0d16('0x12'));var as=require(_0x0d16('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0d16('0x14'));var utils=require('../../config/utils');var config=require(_0x0d16('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d16('0x16'))['db'];function respondWithStatusCode(_0x1f1273,_0x14b3f9){_0x14b3f9=_0x14b3f9||0xcc;return function(_0x3a1eef){if(_0x3a1eef){return _0x1f1273['sendStatus'](_0x14b3f9);}return _0x1f1273[_0x0d16('0x17')](_0x14b3f9)[_0x0d16('0x18')]();};}function respondWithResult(_0x556a0f,_0xf5d51a){_0xf5d51a=_0xf5d51a||0xc8;return function(_0x29317f){if(_0x29317f){return _0x556a0f['status'](_0xf5d51a)['json'](_0x29317f);}};}function respondWithFilteredResult(_0x507c12,_0x1908d9){return function(_0x4bebcd){if(_0x4bebcd){var _0x63d98d=typeof _0x1908d9[_0x0d16('0x19')]===_0x0d16('0x1a')&&typeof _0x1908d9[_0x0d16('0x1b')]===_0x0d16('0x1a');var _0x56abe9=_0x4bebcd['count'];var _0x33ab05=_0x63d98d?0x0:_0x1908d9[_0x0d16('0x19')];var _0x48dd8b=_0x63d98d?_0x4bebcd['count']:_0x1908d9[_0x0d16('0x19')]+_0x1908d9[_0x0d16('0x1b')];var _0x3b7b10;if(_0x48dd8b>=_0x56abe9){_0x48dd8b=_0x56abe9;_0x3b7b10=0xc8;}else{_0x3b7b10=0xce;}_0x507c12[_0x0d16('0x17')](_0x3b7b10);return _0x507c12[_0x0d16('0x1c')]('Content-Range',_0x33ab05+'-'+_0x48dd8b+'/'+_0x56abe9)[_0x0d16('0x1d')](_0x4bebcd);}return null;};}function patchUpdates(_0x145d9d){return function(_0x1bcce0){try{jsonpatch[_0x0d16('0x1e')](_0x1bcce0,_0x145d9d,!![]);}catch(_0x517a1a){return BPromise[_0x0d16('0x1f')](_0x517a1a);}return _0x1bcce0['save']();};}function saveUpdates(_0x586585,_0x5a7088){return function(_0x115d63){if(_0x115d63){return _0x115d63['update'](_0x586585)[_0x0d16('0x20')](function(_0x5e1710){return _0x5e1710;});}return null;};}function removeEntity(_0x241e75,_0x266092){return function(_0x4da20f){if(_0x4da20f){return _0x4da20f['destroy']()[_0x0d16('0x20')](function(){_0x241e75['status'](0xcc)[_0x0d16('0x18')]();});}};}function handleEntityNotFound(_0x1651a4,_0xc1bc49){return function(_0x189bd1){if(!_0x189bd1){_0x1651a4[_0x0d16('0x21')](0x194);}return _0x189bd1;};}function handleError(_0x1ced90,_0x3ce194){_0x3ce194=_0x3ce194||0x1f4;return function(_0x140f53){logger[_0x0d16('0x22')](_0x140f53[_0x0d16('0x23')]);if(_0x140f53['name']){delete _0x140f53[_0x0d16('0x24')];}_0x1ced90[_0x0d16('0x17')](_0x3ce194)[_0x0d16('0x25')](_0x140f53);};}var utilLicense=require(_0x0d16('0x26'));exports[_0x0d16('0x27')]=function(_0x2657b8,_0x52ecaa){var _0x48fdd4={'raw':!![],'where':{'id':0x1}},_0x592a8b={};_0x592a8b[_0x0d16('0x28')]=_['keys'](db['License'][_0x0d16('0x29')]);_0x592a8b[_0x0d16('0x2a')]=_[_0x0d16('0x2b')](_0x2657b8['query']);_0x592a8b['filters']=_[_0x0d16('0x2c')](_0x592a8b[_0x0d16('0x28')],_0x592a8b['query']);_0x48fdd4[_0x0d16('0x2d')]=_['intersection'](_0x592a8b['model'],qs[_0x0d16('0x2e')](_0x2657b8[_0x0d16('0x2a')][_0x0d16('0x2e')]));_0x48fdd4[_0x0d16('0x2d')]=_0x48fdd4[_0x0d16('0x2d')][_0x0d16('0x2f')]?_0x48fdd4[_0x0d16('0x2d')]:_0x592a8b[_0x0d16('0x28')];_0x48fdd4=_['merge']({},_0x48fdd4,_0x2657b8[_0x0d16('0x30')]);return utilLicense[_0x0d16('0x31')](_0x48fdd4)[_0x0d16('0x20')](respondWithResult(_0x52ecaa,null))['catch'](handleError(_0x52ecaa,null));};exports[_0x0d16('0x32')]=function(_0x5e64c5,_0x34531d){if(_0x5e64c5[_0x0d16('0x33')]['id']){delete _0x5e64c5[_0x0d16('0x33')]['id'];}return db['License'][_0x0d16('0x34')]({'where':{'id':_0x5e64c5[_0x0d16('0x35')]['id']}})[_0x0d16('0x20')](handleEntityNotFound(_0x34531d,null))[_0x0d16('0x20')](function(_0x4ce47a){var _0x61ee31=_0x4ce47a['get']({'plain':!![]});return utilLicense['checkLicense'](_0x61ee31,_0x5e64c5[_0x0d16('0x33')][_0x0d16('0x36')]);})[_0x0d16('0x20')](function(_0x30c0a1){if(!_0x30c0a1[_0x0d16('0x37')]){return saveUpdates(_0x5e64c5[_0x0d16('0x33')],null);}return _0x30c0a1;})['then'](respondWithResult(_0x34531d,null))[_0x0d16('0x38')](handleError(_0x34531d,null));};exports['downloadLogFile']=function(_0x292e19,_0x2497e1){var _0x366071='license-info.log';var _0x37c06c=path[_0x0d16('0x39')](_0x0d16('0x3a'),'log',_0x0d16('0x3b'),_0x366071);_0x2497e1[_0x0d16('0x3c')]('Content-disposition',_0x0d16('0x3d')+_0x366071);_0x2497e1['set'](_0x0d16('0x3e'),_0x0d16('0x3f'));_0x2497e1[_0x0d16('0x40')](_0x37c06c);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 6f09966..ac03fad 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 _0x4b9a=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x4b9a,0x7a));var _0xa4b9=function(_0x2dff03,_0x270d01){_0x2dff03=_0x2dff03-0x0;var _0x23602a=_0x4b9a[_0x2dff03];return _0x23602a;};'use strict';var _=require(_0xa4b9('0x0'));var util=require(_0xa4b9('0x1'));var logger=require(_0xa4b9('0x2'))(_0xa4b9('0x3'));var moment=require(_0xa4b9('0x4'));var BPromise=require(_0xa4b9('0x5'));var rp=require(_0xa4b9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4b9('0x7'));var config=require(_0xa4b9('0x8'));var attributes=require(_0xa4b9('0x9'));module[_0xa4b9('0xa')]=function(_0x488b5f,_0x33894d){return _0x488b5f[_0xa4b9('0xb')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe96=['define','License','license','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x35cfcd,_0x388f3e){var _0x47819a=function(_0x31ef78){while(--_0x31ef78){_0x35cfcd['push'](_0x35cfcd['shift']());}};_0x47819a(++_0x388f3e);}(_0xfe96,0x107));var _0x6fe9=function(_0x9fb3d9,_0x19a3be){_0x9fb3d9=_0x9fb3d9-0x0;var _0xcd3a61=_0xfe96[_0x9fb3d9];return _0xcd3a61;};'use strict';var _=require(_0x6fe9('0x0'));var util=require(_0x6fe9('0x1'));var logger=require(_0x6fe9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6fe9('0x3'));var rp=require(_0x6fe9('0x4'));var fs=require('fs');var path=require(_0x6fe9('0x5'));var rimraf=require(_0x6fe9('0x6'));var config=require(_0x6fe9('0x7'));var attributes=require(_0x6fe9('0x8'));module[_0x6fe9('0x9')]=function(_0x2a64ba,_0x41aed3){return _0x2a64ba[_0x6fe9('0xa')](_0x6fe9('0xb'),attributes,{'tableName':_0x6fe9('0xc'),'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 5c2fb13..a65e9d5 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 _0x9d25=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','License,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x49988b,_0x4e3fd6){var _0x5737a7=function(_0xf99be7){while(--_0xf99be7){_0x49988b['push'](_0x49988b['shift']());}};_0x5737a7(++_0x4e3fd6);}(_0x9d25,0x14a));var _0x59d2=function(_0x225dea,_0x54f491){_0x225dea=_0x225dea-0x0;var _0x5b19f1=_0x9d25[_0x225dea];return _0x5b19f1;};'use strict';var _=require(_0x59d2('0x0'));var util=require(_0x59d2('0x1'));var moment=require(_0x59d2('0x2'));var BPromise=require(_0x59d2('0x3'));var rs=require(_0x59d2('0x4'));var fs=require('fs');var Redis=require(_0x59d2('0x5'));var db=require(_0x59d2('0x6'))['db'];var utils=require(_0x59d2('0x7'));var logger=require(_0x59d2('0x8'))(_0x59d2('0x9'));var config=require(_0x59d2('0xa'));var jayson=require(_0x59d2('0xb'));var client=jayson[_0x59d2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x67db26,_0x5ac650,_0x3136e2){return new BPromise(function(_0x581c71,_0x19f9ea){return client['request'](_0x67db26,_0x3136e2)[_0x59d2('0xd')](function(_0xd7bc71){logger[_0x59d2('0xe')](_0x59d2('0xf'),_0x5ac650,_0x59d2('0x10'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x5ac650,_0x59d2('0x10'),JSON[_0x59d2('0x11')](_0xd7bc71));if(_0xd7bc71['error']){if(_0xd7bc71[_0x59d2('0x12')][_0x59d2('0x13')]===0x1f4){logger[_0x59d2('0x12')](_0x59d2('0xf'),_0x5ac650,_0xd7bc71[_0x59d2('0x12')][_0x59d2('0x14')]);return _0x19f9ea(_0xd7bc71[_0x59d2('0x12')][_0x59d2('0x14')]);}logger[_0x59d2('0x12')](_0x59d2('0xf'),_0x5ac650,_0xd7bc71['error'][_0x59d2('0x14')]);return _0x581c71(_0xd7bc71[_0x59d2('0x12')]['message']);}else{logger[_0x59d2('0xe')](_0x59d2('0xf'),_0x5ac650,_0x59d2('0x10'));_0x581c71(_0xd7bc71['result'][_0x59d2('0x14')]);}})[_0x59d2('0x15')](function(_0x385167){logger['error'](_0x59d2('0xf'),_0x5ac650,_0x385167);_0x19f9ea(_0x385167);});});} \ No newline at end of file +var _0x9cd5=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x19a4ed,_0x476e25){var _0x4f8121=function(_0x29276c){while(--_0x29276c){_0x19a4ed['push'](_0x19a4ed['shift']());}};_0x4f8121(++_0x476e25);}(_0x9cd5,0x1f2));var _0x59cd=function(_0x30fa93,_0x3ba6a4){_0x30fa93=_0x30fa93-0x0;var _0x53d09f=_0x9cd5[_0x30fa93];return _0x53d09f;};'use strict';var _=require(_0x59cd('0x0'));var util=require(_0x59cd('0x1'));var moment=require(_0x59cd('0x2'));var BPromise=require(_0x59cd('0x3'));var rs=require(_0x59cd('0x4'));var fs=require('fs');var Redis=require(_0x59cd('0x5'));var db=require(_0x59cd('0x6'))['db'];var utils=require(_0x59cd('0x7'));var logger=require(_0x59cd('0x8'))(_0x59cd('0x9'));var config=require(_0x59cd('0xa'));var jayson=require(_0x59cd('0xb'));var client=jayson[_0x59cd('0xc')][_0x59cd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xeca5ed,_0x30a30a,_0x27a5ef){return new BPromise(function(_0x47c86f,_0x29d8fd){return client[_0x59cd('0xe')](_0xeca5ed,_0x27a5ef)[_0x59cd('0xf')](function(_0x2ff482){logger[_0x59cd('0x10')](_0x59cd('0x11'),_0x30a30a,_0x59cd('0x12'));logger['debug'](_0x59cd('0x13'),_0x30a30a,_0x59cd('0x12'),JSON[_0x59cd('0x14')](_0x2ff482));if(_0x2ff482[_0x59cd('0x15')]){if(_0x2ff482[_0x59cd('0x15')][_0x59cd('0x16')]===0x1f4){logger[_0x59cd('0x15')](_0x59cd('0x11'),_0x30a30a,_0x2ff482[_0x59cd('0x15')][_0x59cd('0x17')]);return _0x29d8fd(_0x2ff482[_0x59cd('0x15')]['message']);}logger[_0x59cd('0x15')]('License,\x20%s,\x20%s',_0x30a30a,_0x2ff482[_0x59cd('0x15')][_0x59cd('0x17')]);return _0x47c86f(_0x2ff482[_0x59cd('0x15')][_0x59cd('0x17')]);}else{logger['info'](_0x59cd('0x11'),_0x30a30a,_0x59cd('0x12'));_0x47c86f(_0x2ff482[_0x59cd('0x18')][_0x59cd('0x17')]);}})[_0x59cd('0x19')](function(_0x2261b7){logger[_0x59cd('0x15')]('License,\x20%s,\x20%s',_0x30a30a,_0x2261b7);_0x29d8fd(_0x2261b7);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 33ed57b..35750e3 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 _0x0ea2=['../../components/interaction/service','get','index','describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addImap','addSmtp','addApplications','/:id/send','send','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0xb24d15,_0x19cbba){var _0xd5c904=function(_0x4c0a63){while(--_0x4c0a63){_0xb24d15['push'](_0xb24d15['shift']());}};_0xd5c904(++_0x19cbba);}(_0x0ea2,0x8e));var _0x20ea=function(_0x15e43b,_0x2a3132){_0x15e43b=_0x15e43b-0x0;var _0x537fcf=_0x0ea2[_0x15e43b];return _0x537fcf;};'use strict';var multer=require(_0x20ea('0x0'));var util=require('util');var path=require(_0x20ea('0x1'));var timeout=require('connect-timeout');var express=require(_0x20ea('0x2'));var router=express[_0x20ea('0x3')]();var fs_extra=require(_0x20ea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x20ea('0x5'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x20ea('0x6')]('/',auth['isAuthenticated'](),controller[_0x20ea('0x7')]);router[_0x20ea('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x20ea('0x8')]);router[_0x20ea('0x6')]('/:id',auth[_0x20ea('0x9')](),controller[_0x20ea('0xa')]);router[_0x20ea('0x6')](_0x20ea('0xb'),auth[_0x20ea('0x9')](),controller[_0x20ea('0xc')]);router[_0x20ea('0x6')](_0x20ea('0xd'),auth['isAuthenticated'](),controller[_0x20ea('0xe')]);router[_0x20ea('0x6')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x20ea('0xf')]);router[_0x20ea('0x6')](_0x20ea('0x10'),auth[_0x20ea('0x9')](),controller[_0x20ea('0x11')]);router['get'](_0x20ea('0x12'),auth[_0x20ea('0x9')](),controller[_0x20ea('0x13')]);router[_0x20ea('0x6')](_0x20ea('0x14'),auth[_0x20ea('0x9')](),controller[_0x20ea('0x15')]);router[_0x20ea('0x6')](_0x20ea('0x16'),auth['isAuthenticated'](),controller[_0x20ea('0x17')]);router['get'](_0x20ea('0x18'),auth['isAuthenticated'](),controller[_0x20ea('0x19')]);router[_0x20ea('0x6')](_0x20ea('0x1a'),auth[_0x20ea('0x9')](),controller[_0x20ea('0x1b')]);router[_0x20ea('0x1c')](_0x20ea('0xb'),auth[_0x20ea('0x9')](),controller[_0x20ea('0x1d')]);router[_0x20ea('0x1c')]('/:id/canned_answers',auth[_0x20ea('0x9')](),controller[_0x20ea('0x1e')]);router[_0x20ea('0x1c')]('/',auth[_0x20ea('0x9')](),controller[_0x20ea('0x1f')]);router[_0x20ea('0x1c')](_0x20ea('0x20'),auth['isAuthenticated'](),controller[_0x20ea('0x21')]);router['post'](_0x20ea('0x10'),auth[_0x20ea('0x9')](),controller[_0x20ea('0x22')]);router[_0x20ea('0x1c')](_0x20ea('0x12'),auth[_0x20ea('0x9')](),controller['addInteraction']);router[_0x20ea('0x1c')](_0x20ea('0x14'),auth[_0x20ea('0x9')](),controller[_0x20ea('0x23')]);router[_0x20ea('0x1c')](_0x20ea('0x24'),auth[_0x20ea('0x9')](),controller[_0x20ea('0x25')]);router[_0x20ea('0x1c')](_0x20ea('0x1a'),auth[_0x20ea('0x9')](),controller[_0x20ea('0x26')]);router[_0x20ea('0x27')](_0x20ea('0x28'),auth[_0x20ea('0x9')](),controller[_0x20ea('0x29')]);router[_0x20ea('0x2a')]('/:id/dispositions',auth[_0x20ea('0x9')](),controller[_0x20ea('0x2b')]);router[_0x20ea('0x2a')](_0x20ea('0xd'),auth['isAuthenticated'](),controller[_0x20ea('0x2c')]);router['delete'](_0x20ea('0x20'),auth['isAuthenticated'](),controller[_0x20ea('0x2d')]);router[_0x20ea('0x2a')](_0x20ea('0x10'),auth['isAuthenticated'](),controller[_0x20ea('0x2e')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x20ea('0x2f')]);router[_0x20ea('0x2a')](_0x20ea('0x1a'),auth[_0x20ea('0x9')](),controller['removeAgents']);module[_0x20ea('0x30')]=router; \ No newline at end of file +var _0xbe4b=['/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','create','addImap','/:id/out_servers','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','removeAgents','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index'];(function(_0x191230,_0xa67052){var _0x2046ec=function(_0x58ad0a){while(--_0x58ad0a){_0x191230['push'](_0x191230['shift']());}};_0x2046ec(++_0xa67052);}(_0xbe4b,0x15e));var _0xbbe4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xbe4b[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0xbbe4('0x0'));var util=require(_0xbbe4('0x1'));var path=require('path');var timeout=require(_0xbbe4('0x2'));var express=require(_0xbbe4('0x3'));var router=express['Router']();var fs_extra=require(_0xbbe4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbbe4('0x5'));var config=require(_0xbbe4('0x6'));var controller=require(_0xbbe4('0x7'));router[_0xbbe4('0x8')]('/',auth['isAuthenticated'](),controller[_0xbbe4('0x9')]);router[_0xbbe4('0x8')](_0xbbe4('0xa'),auth[_0xbbe4('0xb')](),controller['describe']);router['get'](_0xbbe4('0xc'),auth[_0xbbe4('0xb')](),controller[_0xbbe4('0xd')]);router[_0xbbe4('0x8')](_0xbbe4('0xe'),auth[_0xbbe4('0xb')](),controller[_0xbbe4('0xf')]);router['get'](_0xbbe4('0x10'),auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x11')]);router[_0xbbe4('0x8')](_0xbbe4('0x12'),auth['isAuthenticated'](),controller['getImap']);router['get']('/:id/out_servers',auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x13')]);router['get'](_0xbbe4('0x14'),auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x15')]);router[_0xbbe4('0x8')](_0xbbe4('0x16'),auth[_0xbbe4('0xb')](),controller['getApplications']);router[_0xbbe4('0x8')]('/:id/messages',auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x17')]);router[_0xbbe4('0x8')](_0xbbe4('0x18'),auth['isAuthenticated'](),controller[_0xbbe4('0x19')]);router[_0xbbe4('0x8')](_0xbbe4('0x1a'),auth['isAuthenticated'](),controller[_0xbbe4('0x1b')]);router[_0xbbe4('0x1c')](_0xbbe4('0xe'),auth['isAuthenticated'](),controller[_0xbbe4('0x1d')]);router[_0xbbe4('0x1c')](_0xbbe4('0x10'),auth[_0xbbe4('0xb')](),controller['addAnswer']);router[_0xbbe4('0x1c')]('/',auth['isAuthenticated'](),controller[_0xbbe4('0x1e')]);router[_0xbbe4('0x1c')]('/:id/in_servers',auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x1f')]);router[_0xbbe4('0x1c')](_0xbbe4('0x20'),auth[_0xbbe4('0xb')](),controller['addSmtp']);router[_0xbbe4('0x1c')](_0xbbe4('0x14'),auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x21')]);router['post']('/:id/applications',auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x22')]);router[_0xbbe4('0x1c')](_0xbbe4('0x23'),auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x24')]);router[_0xbbe4('0x1c')](_0xbbe4('0x1a'),auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x25')]);router[_0xbbe4('0x26')](_0xbbe4('0xc'),auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x27')]);router[_0xbbe4('0x28')]('/:id/dispositions',auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x29')]);router[_0xbbe4('0x28')]('/:id/canned_answers',auth[_0xbbe4('0xb')](),controller['removeAnswers']);router[_0xbbe4('0x28')]('/:id/in_servers',auth[_0xbbe4('0xb')](),controller[_0xbbe4('0x2a')]);router[_0xbbe4('0x28')](_0xbbe4('0x20'),auth['isAuthenticated'](),controller[_0xbbe4('0x2b')]);router['delete'](_0xbbe4('0xc'),auth[_0xbbe4('0xb')](),controller['destroy']);router['delete'](_0xbbe4('0x1a'),auth['isAuthenticated'](),controller[_0xbbe4('0x2c')]);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 ad658f7..ac682f2 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 _0xbd76=['STRING','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0xbd76,0x1a4));var _0x6bd7=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xbd76[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6bd7('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x6bd7('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x6bd7('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6bd7('0x1')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6bd7('0x2')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x6bd7('0x3')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6bd7('0x4')],'defaultValue':function(){return _0x6bd7('0x5');}},'notificationSound':{'type':Sequelize[_0x6bd7('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6bd7('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6bd7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6bd7('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6bd7('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x6bd7('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x6bd7('0x1')],'defaultValue':![],'comment':_0x6bd7('0x8'),'set':function(_0x3603d0){if(!_0x3603d0)this[_0x6bd7('0x9')](_0x6bd7('0xa'),null);this[_0x6bd7('0x9')](_0x6bd7('0xb'),_0x3603d0);}},'provider':{'type':Sequelize[_0x6bd7('0xc')](_0x6bd7('0xd'),_0x6bd7('0xe'),_0x6bd7('0xf'),_0x6bd7('0x10')),'defaultValue':null,'get':function(){if(!this[_0x6bd7('0x11')](_0x6bd7('0x12')))return'custom';return this[_0x6bd7('0x11')](_0x6bd7('0x12'));},'set':function(_0x544f66){if(_0x544f66===_0x6bd7('0x13'))_0x544f66=null;return this[_0x6bd7('0x9')](_0x6bd7('0x12'),_0x544f66);}}}; \ No newline at end of file +var _0x2805=['outlook365','custom','getDataValue','provider','sequelize','exports','BOOLEAN','TEXT','STRING','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'];(function(_0xf66b2f,_0x2a116a){var _0x352545=function(_0x394b05){while(--_0x394b05){_0xf66b2f['push'](_0xf66b2f['shift']());}};_0x352545(++_0x2a116a);}(_0x2805,0x16c));var _0x5280=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x2805[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require(_0x5280('0x0'));module[_0x5280('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5280('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x5280('0x3')]},'markAsUnread':{'type':Sequelize[_0x5280('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5280('0x4')],'allowNull':![],'defaultValue':_0x5280('0x5')},'fontSize':{'type':Sequelize[_0x5280('0x6')](0x2)[_0x5280('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5280('0x8');}},'notificationSound':{'type':Sequelize[_0x5280('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5280('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5280('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5280('0x6')],'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[_0x5280('0x2')],'defaultValue':![],'comment':_0x5280('0x9'),'set':function(_0x3a86c9){if(!_0x3a86c9)this[_0x5280('0xa')](_0x5280('0xb'),null);this[_0x5280('0xa')](_0x5280('0xc'),_0x3a86c9);}},'provider':{'type':Sequelize[_0x5280('0xd')](_0x5280('0xe'),_0x5280('0xf'),'yahoo',_0x5280('0x10')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return _0x5280('0x11');return this[_0x5280('0x12')](_0x5280('0x13'));},'set':function(_0x5692d5){if(_0x5692d5===_0x5280('0x11'))_0x5692d5=null;return this['setDataValue'](_0x5280('0x13'),_0x5692d5);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 011ce42..54c9cb6 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 _0x3e9d=['Messages','verifySmtp','Sequelize','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','lodash','juice','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','json','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','secure','service','authentication','host','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','MailAccount','rawAttributes','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','include','rows','show','params','mandatoryDispositionPause','body','provider','custom','find','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create','getDispositions','findOne','length','removeDispositions','ids','CannedAnswer','getAnswers','findAll','removeAnswers','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','internal','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3e9d,0xc3));var _0xd3e9=function(_0x313165,_0x4d841a){_0x313165=_0x313165-0x0;var _0x4cda43=_0x3e9d[_0x313165];return _0x4cda43;};'use strict';var moment=require(_0xd3e9('0x0'));var BPromise=require(_0xd3e9('0x1'));var util=require('util');var path=require('path');var _=require(_0xd3e9('0x2'));var juice=require(_0xd3e9('0x3'));var Redis=require(_0xd3e9('0x4'));var qs=require(_0xd3e9('0x5'));var logger=require('../../config/logger')('api');var config=require(_0xd3e9('0x6'));var db=require(_0xd3e9('0x7'))['db'];config[_0xd3e9('0x8')]=_[_0xd3e9('0x9')](config[_0xd3e9('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd3e9('0xa'))(new Redis(config[_0xd3e9('0x8')]));require('./mailAccount.socket')[_0xd3e9('0xb')](socket);var jayson=require(_0xd3e9('0xc'));var client=jayson[_0xd3e9('0xd')][_0xd3e9('0xe')]({'port':0x232b});function respondWithRpcPromise(_0xfe1c0f,_0x477127,_0x592fff,_0x4f0c18){return new BPromise(function(_0x5a6e26,_0x12efe4){var _0x177224=_0x4f0c18||client;return _0x177224['request'](_0xfe1c0f,_0x592fff)[_0xd3e9('0xf')](function(_0x222dce){logger[_0xd3e9('0x10')](_0xd3e9('0x11'),_0x477127,_0xd3e9('0x12'));logger[_0xd3e9('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x477127,_0xd3e9('0x12'),JSON[_0xd3e9('0x14')](_0x222dce));if(_0x222dce[_0xd3e9('0x15')]){if(_0x222dce['error'][_0xd3e9('0x16')]===0x1f4){logger[_0xd3e9('0x15')](_0xd3e9('0x11'),_0x477127,_0x222dce[_0xd3e9('0x15')][_0xd3e9('0x17')]);return _0x12efe4(_0x222dce[_0xd3e9('0x15')][_0xd3e9('0x17')]);}logger[_0xd3e9('0x15')](_0xd3e9('0x11'),_0x477127,_0x222dce[_0xd3e9('0x15')]['message']);return _0x5a6e26(_0x222dce['error'][_0xd3e9('0x17')]);}else{logger[_0xd3e9('0x10')](_0xd3e9('0x11'),_0x477127,_0xd3e9('0x12'));_0x5a6e26(_0x222dce[_0xd3e9('0x18')][_0xd3e9('0x17')]);}})[_0xd3e9('0x19')](function(_0x3afc8a){logger[_0xd3e9('0x15')]('MailAccount,\x20%s,\x20%s',_0x477127,_0x3afc8a);_0x12efe4(_0x3afc8a);});});}function respondWithStatusCode(_0x2d4385,_0x2b8be3){_0x2b8be3=_0x2b8be3||0xcc;return function(_0x51da31){if(_0x51da31){return _0x2d4385[_0xd3e9('0x1a')](_0x2b8be3);}return _0x2d4385[_0xd3e9('0x1b')](_0x2b8be3)[_0xd3e9('0x1c')]();};}function respondWithResult(_0x2bdc2d,_0x405356){_0x405356=_0x405356||0xc8;return function(_0x557ab9){if(_0x557ab9){return _0x2bdc2d[_0xd3e9('0x1b')](_0x405356)['json'](_0x557ab9);}};}function respondWithFilteredResult(_0x3d649c,_0x29354e){return function(_0x24d104){if(_0x24d104){var _0x322467=typeof _0x29354e['offset']===_0xd3e9('0x1d')&&typeof _0x29354e[_0xd3e9('0x1e')]==='undefined';var _0x2b8527=_0x24d104[_0xd3e9('0x1f')];var _0x5acca5=_0x322467?0x0:_0x29354e[_0xd3e9('0x20')];var _0x39f887=_0x322467?_0x24d104['count']:_0x29354e[_0xd3e9('0x20')]+_0x29354e[_0xd3e9('0x1e')];var _0x361b2b;if(_0x39f887>=_0x2b8527){_0x39f887=_0x2b8527;_0x361b2b=0xc8;}else{_0x361b2b=0xce;}_0x3d649c['status'](_0x361b2b);return _0x3d649c['set']('Content-Range',_0x5acca5+'-'+_0x39f887+'/'+_0x2b8527)[_0xd3e9('0x21')](_0x24d104);}return null;};}function saveUpdates(_0x525750){return function(_0x3850bc){if(_0x3850bc){return _0x3850bc[_0xd3e9('0x22')](_0x525750)[_0xd3e9('0xf')](function(_0x47fbd7){return _0x47fbd7;});}return null;};}function removeEntity(_0x5344b6){return function(_0xcc17ee){if(_0xcc17ee){return _0xcc17ee[_0xd3e9('0x23')]()['then'](function(){var _0x5847a9=_0xcc17ee[_0xd3e9('0x24')]({'plain':!![]});var _0x1c27be=_0xd3e9('0x25');return db[_0xd3e9('0x26')]['destroy']({'where':{'type':_0x1c27be,'resourceId':_0x5847a9['id']}})[_0xd3e9('0xf')](function(){return _0xcc17ee;});})[_0xd3e9('0xf')](function(){_0x5344b6[_0xd3e9('0x1b')](0xcc)[_0xd3e9('0x1c')]();});}};}function handleEntityNotFound(_0x5288a1){return function(_0x1b29a3){if(!_0x1b29a3){_0x5288a1[_0xd3e9('0x1a')](0x194);}return _0x1b29a3;};}function handleError(_0x833e5c,_0x366988){_0x366988=_0x366988||0x1f4;return function(_0x19dd18){logger[_0xd3e9('0x15')](_0x19dd18[_0xd3e9('0x27')]);if(_0x19dd18[_0xd3e9('0x28')]){delete _0x19dd18[_0xd3e9('0x28')];}_0x833e5c['status'](_0x366988)[_0xd3e9('0x29')](_0x19dd18);};}function getImapHost(_0x5a29db){switch(_0x5a29db){case _0xd3e9('0x2a'):return _0xd3e9('0x2b');case _0xd3e9('0x2c'):return _0xd3e9('0x2d');case _0xd3e9('0x2e'):return _0xd3e9('0x2f');case _0xd3e9('0x30'):return _0xd3e9('0x31');}throw new Error(_0xd3e9('0x32'),_0x5a29db);}function getSmtpHost(_0x406ce3){switch(_0x406ce3){case _0xd3e9('0x2a'):return _0xd3e9('0x33');case _0xd3e9('0x2c'):return'smtp.mail.yahoo.com';case'hotmail':return _0xd3e9('0x34');case _0xd3e9('0x30'):return _0xd3e9('0x35');}throw new Error('Unknown\x20email\x20service\x20provider',_0x406ce3);}function getAuthenticationOptions(_0x266cd2,_0x46915f){var _0x92b39c={};var _0x142bde={};if(_0x266cd2){_0x92b39c[_0xd3e9('0x36')]=_0x142bde['user']=_0x46915f[_0xd3e9('0x37')];_0x92b39c[_0xd3e9('0x38')]=_0x142bde[_0xd3e9('0x39')]=_0x46915f[_0xd3e9('0x38')];if(_0x46915f[_0xd3e9('0x3a')]){_0x92b39c['modernAuthentication']=_0x142bde[_0xd3e9('0x3a')]=!![];_0x92b39c[_0xd3e9('0x3b')]=_0x142bde[_0xd3e9('0x3b')]=_0x46915f[_0xd3e9('0x3b')];_0x92b39c[_0xd3e9('0x38')]=_0x142bde[_0xd3e9('0x39')]=null;}else{_0x92b39c['CloudProviderId']=_0x142bde[_0xd3e9('0x3b')]=null;}_0x92b39c['host']=getImapHost(_0x266cd2);_0x92b39c[_0xd3e9('0x3c')]=0x3e1;_0x142bde['host']=getSmtpHost(_0x266cd2);_0x142bde['port']=0x24b;_0x142bde[_0xd3e9('0x3d')]=![];_0x92b39c['service']=_0x142bde[_0xd3e9('0x3e')]=null;}else{if(_0x46915f[_0xd3e9('0x3f')]){_0x92b39c['user']=_0x142bde['user']=_0x46915f[_0xd3e9('0x37')];_0x92b39c[_0xd3e9('0x38')]=_0x142bde['pass']=_0x46915f[_0xd3e9('0x38')];}else{_0x92b39c[_0xd3e9('0x3f')]=_0x142bde[_0xd3e9('0x3f')]=![];_0x92b39c['user']=_0x142bde[_0xd3e9('0x36')]=null;_0x92b39c[_0xd3e9('0x38')]=_0x142bde['pass']=null;}_0x92b39c['host']=_0x46915f['Imap'][_0xd3e9('0x40')];_0x92b39c[_0xd3e9('0x3c')]=_0x46915f[_0xd3e9('0x41')][_0xd3e9('0x3c')];_0x142bde[_0xd3e9('0x40')]=_0x46915f[_0xd3e9('0x42')][_0xd3e9('0x40')];_0x142bde[_0xd3e9('0x3c')]=_0x46915f[_0xd3e9('0x42')][_0xd3e9('0x3c')];}return{'Imap':_0x92b39c,'Smtp':_0x142bde};}exports[_0xd3e9('0x43')]=function(_0x4af96f,_0x2eb2ef){var _0x2bc8a9={'include':[{'model':db[_0xd3e9('0x44')],'as':_0xd3e9('0x41')},{'model':db[_0xd3e9('0x45')],'as':'Smtp'},{'model':db[_0xd3e9('0x46')],'as':'mandatoryDispositionPause'}]},_0x2de12d={},_0xaadf97={'count':0x0,'rows':[]};var _0x53711a=_['map'](db[_0xd3e9('0x47')][_0xd3e9('0x48')],function(_0x3e25ef){return{'name':_0x3e25ef['fieldName'],'type':_0x3e25ef['type'][_0xd3e9('0x49')]};});_0x2de12d[_0xd3e9('0x4a')]=_[_0xd3e9('0x4b')](_0x53711a,_0xd3e9('0x28'));_0x2de12d['query']=_[_0xd3e9('0x4c')](_0x4af96f['query']);_0x2de12d[_0xd3e9('0x4d')]=_[_0xd3e9('0x4e')](_0x2de12d[_0xd3e9('0x4a')],_0x2de12d[_0xd3e9('0x4f')]);_0x2bc8a9[_0xd3e9('0x50')]=_['intersection'](_0x2de12d[_0xd3e9('0x4a')],qs['fields'](_0x4af96f[_0xd3e9('0x4f')][_0xd3e9('0x51')]));_0x2bc8a9[_0xd3e9('0x50')]=_0x2bc8a9[_0xd3e9('0x50')]['length']?_0x2bc8a9[_0xd3e9('0x50')]:_0x2de12d[_0xd3e9('0x4a')];if(!_0x4af96f[_0xd3e9('0x4f')][_0xd3e9('0x52')](_0xd3e9('0x53'))){_0x2bc8a9[_0xd3e9('0x1e')]=qs['limit'](_0x4af96f[_0xd3e9('0x4f')][_0xd3e9('0x1e')]);_0x2bc8a9[_0xd3e9('0x20')]=qs['offset'](_0x4af96f[_0xd3e9('0x4f')][_0xd3e9('0x20')]);}_0x2bc8a9[_0xd3e9('0x54')]=qs[_0xd3e9('0x55')](_0x4af96f[_0xd3e9('0x4f')]['sort']);_0x2bc8a9['where']=qs[_0xd3e9('0x4d')](_[_0xd3e9('0x56')](_0x4af96f[_0xd3e9('0x4f')],_0x2de12d['filters']),_0x53711a);if(_0x4af96f['query']['filter']){_0x2bc8a9[_0xd3e9('0x57')]=_[_0xd3e9('0x58')](_0x2bc8a9[_0xd3e9('0x57')],{'$or':_[_0xd3e9('0x4b')](_0x53711a,function(_0x4f3bbc){if(_0x4f3bbc[_0xd3e9('0x59')]!=='VIRTUAL'){var _0x48c16e={};_0x48c16e[_0x4f3bbc[_0xd3e9('0x28')]]={'$like':'%'+_0x4af96f[_0xd3e9('0x4f')][_0xd3e9('0x5a')]+'%'};return _0x48c16e;}})});}_0x2bc8a9=_[_0xd3e9('0x58')]({},_0x2bc8a9,_0x4af96f[_0xd3e9('0x5b')]);var _0x4ef325={'where':_0x2bc8a9[_0xd3e9('0x57')]};return db[_0xd3e9('0x47')][_0xd3e9('0x1f')](_0x4ef325)[_0xd3e9('0xf')](function(_0x1173c3){_0xaadf97[_0xd3e9('0x1f')]=_0x1173c3;if(_0x4af96f[_0xd3e9('0x4f')][_0xd3e9('0x5c')]){_0x2bc8a9[_0xd3e9('0x5d')]=[{'all':!![]}];}return db[_0xd3e9('0x47')]['findAll'](_0x2bc8a9);})[_0xd3e9('0xf')](function(_0x23e879){_0xaadf97[_0xd3e9('0x5e')]=_0x23e879;return _0xaadf97;})[_0xd3e9('0xf')](respondWithFilteredResult(_0x2eb2ef,_0x2bc8a9))[_0xd3e9('0x19')](handleError(_0x2eb2ef,null));};exports[_0xd3e9('0x5f')]=function(_0x7f17d0,_0x16d21){var _0x3731ef={'raw':![],'where':{'id':_0x7f17d0[_0xd3e9('0x60')]['id']},'include':[{'model':db[_0xd3e9('0x44')],'as':_0xd3e9('0x41')},{'model':db[_0xd3e9('0x45')],'as':_0xd3e9('0x42')},{'model':db['Pause'],'as':_0xd3e9('0x61')}]},_0x28ef57={};_0x28ef57[_0xd3e9('0x4a')]=_[_0xd3e9('0x4c')](db[_0xd3e9('0x47')]['rawAttributes']);_0x28ef57['query']=_['keys'](_0x7f17d0['query']);_0x28ef57[_0xd3e9('0x4d')]=_[_0xd3e9('0x4e')](_0x28ef57['model'],_0x28ef57['query']);_0x3731ef[_0xd3e9('0x50')]=_[_0xd3e9('0x4e')](_0x28ef57[_0xd3e9('0x4a')],qs[_0xd3e9('0x51')](_0x7f17d0[_0xd3e9('0x4f')][_0xd3e9('0x51')]));_0x3731ef[_0xd3e9('0x50')]=_0x3731ef[_0xd3e9('0x50')]['length']?_0x3731ef[_0xd3e9('0x50')]:_0x28ef57[_0xd3e9('0x4a')];if(_0x7f17d0[_0xd3e9('0x4f')][_0xd3e9('0x5c')]){_0x3731ef[_0xd3e9('0x5d')]=[{'all':!![]}];}_0x3731ef=_['merge']({},_0x3731ef,_0x7f17d0[_0xd3e9('0x5b')]);return db['MailAccount']['find'](_0x3731ef)['then'](handleEntityNotFound(_0x16d21,null))[_0xd3e9('0xf')](respondWithResult(_0x16d21,null))[_0xd3e9('0x19')](handleError(_0x16d21,null));};exports[_0xd3e9('0x22')]=function(_0x152b14,_0x1330b0){if(_0x152b14['body']['id']){delete _0x152b14[_0xd3e9('0x62')]['id'];}var _0x255764=_0x152b14[_0xd3e9('0x62')][_0xd3e9('0x63')]===_0xd3e9('0x64')?null:_0x152b14[_0xd3e9('0x62')][_0xd3e9('0x63')];var _0x5555df=_0x152b14[_0xd3e9('0x62')]['Imap']||{};var _0x34357=_0x152b14[_0xd3e9('0x62')][_0xd3e9('0x42')]||{};if(_0x255764){_0x5555df[_0xd3e9('0x40')]=getImapHost(_0x255764);_0x5555df[_0xd3e9('0x3c')]=0x3e1;_0x34357[_0xd3e9('0x40')]=getSmtpHost(_0x255764);_0x34357[_0xd3e9('0x3c')]=0x24b;_0x34357[_0xd3e9('0x3d')]=![];}if(_0x34357[_0xd3e9('0x3a')]){_0x34357[_0xd3e9('0x3d')]=![];}else{_0x34357[_0xd3e9('0x3b')]=null;}if(!_0x5555df[_0xd3e9('0x3a')])_0x5555df['CloudProviderId']=null;_0x152b14[_0xd3e9('0x62')]['Imap']=_0x5555df;_0x152b14[_0xd3e9('0x62')][_0xd3e9('0x42')]=_0x34357;return db['MailAccount'][_0xd3e9('0x65')]({'where':{'id':_0x152b14[_0xd3e9('0x60')]['id']},'include':[{'model':db[_0xd3e9('0x44')],'as':'Imap'},{'model':db[_0xd3e9('0x45')],'as':_0xd3e9('0x42')},{'model':db['Pause'],'as':_0xd3e9('0x61')}]})[_0xd3e9('0xf')](handleEntityNotFound(_0x1330b0,null))[_0xd3e9('0xf')](function(_0x1f16e1){if(!_0x1f16e1)throw new Error(_0xd3e9('0x66'));if(_0x1f16e1[_0xd3e9('0x3e')])delete _0x152b14[_0xd3e9('0x62')][_0xd3e9('0x41')];return _0x1f16e1;})[_0xd3e9('0xf')](saveUpdates(_0x152b14[_0xd3e9('0x62')],null))['then'](function(_0x360016){if(!_0x152b14[_0xd3e9('0x62')][_0xd3e9('0x41')])return _0x360016;return db[_0xd3e9('0x44')][_0xd3e9('0x22')](_0x152b14[_0xd3e9('0x62')]['Imap'],{'where':{'MailAccountId':_0x360016['id']}})[_0xd3e9('0xf')](function(){return _0x360016;});})[_0xd3e9('0xf')](function(_0x1ad5c7){if(!_0x152b14[_0xd3e9('0x62')]['Smtp'])return _0x1ad5c7;return db[_0xd3e9('0x45')][_0xd3e9('0x22')](_0x152b14['body'][_0xd3e9('0x42')],{'where':{'MailAccountId':_0x1ad5c7['id']}})['then'](function(){return _0x1ad5c7;});})['then'](respondWithResult(_0x1330b0,null))[_0xd3e9('0x19')](handleError(_0x1330b0,null));};exports[_0xd3e9('0x67')]=function(_0x4a14f3,_0x112f94){return db[_0xd3e9('0x47')][_0xd3e9('0x67')]()[_0xd3e9('0xf')](respondWithResult(_0x112f94,null))[_0xd3e9('0x19')](handleError(_0x112f94,null));};exports['addDisposition']=function(_0x401dd8,_0x18ba65){if(_0x401dd8[_0xd3e9('0x62')]['id']){delete _0x401dd8[_0xd3e9('0x62')]['id'];}return db[_0xd3e9('0x47')][_0xd3e9('0x65')]({'where':{'id':_0x401dd8[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x18ba65,null))[_0xd3e9('0xf')](function(_0x2e72fb){if(_0x2e72fb){_0x401dd8['body'][_0xd3e9('0x68')]=_0x2e72fb['id'];return db[_0xd3e9('0x69')][_0xd3e9('0x6a')](_0x401dd8['body']);}})[_0xd3e9('0xf')](respondWithResult(_0x18ba65,null))['catch'](handleError(_0x18ba65,null));};exports[_0xd3e9('0x6b')]=function(_0x3e6643,_0x1a43cf){var _0x2de54c={'raw':![],'where':{}};var _0xba73a0={};var _0x9c7f56={'count':0x0,'rows':[]};return db[_0xd3e9('0x47')][_0xd3e9('0x6c')]({'where':{'id':_0x3e6643[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x1a43cf,null))[_0xd3e9('0xf')](function(_0x2cb551){if(_0x2cb551){_0xba73a0[_0xd3e9('0x4a')]=_['keys'](db[_0xd3e9('0x69')][_0xd3e9('0x48')]);_0xba73a0[_0xd3e9('0x4f')]=_[_0xd3e9('0x4c')](_0x3e6643[_0xd3e9('0x4f')]);_0xba73a0[_0xd3e9('0x4d')]=_[_0xd3e9('0x4e')](_0xba73a0['model'],_0xba73a0[_0xd3e9('0x4f')]);_0x2de54c[_0xd3e9('0x50')]=_[_0xd3e9('0x4e')](_0xba73a0[_0xd3e9('0x4a')],qs[_0xd3e9('0x51')](_0x3e6643[_0xd3e9('0x4f')][_0xd3e9('0x51')]));_0x2de54c['attributes']=_0x2de54c[_0xd3e9('0x50')][_0xd3e9('0x6d')]?_0x2de54c['attributes']:_0xba73a0[_0xd3e9('0x4a')];if(!_0x3e6643[_0xd3e9('0x4f')][_0xd3e9('0x52')](_0xd3e9('0x53'))){_0x2de54c[_0xd3e9('0x1e')]=qs[_0xd3e9('0x1e')](_0x3e6643[_0xd3e9('0x4f')][_0xd3e9('0x1e')]);_0x2de54c[_0xd3e9('0x20')]=qs[_0xd3e9('0x20')](_0x3e6643['query'][_0xd3e9('0x20')]);}_0x2de54c[_0xd3e9('0x54')]=qs[_0xd3e9('0x55')](_0x3e6643[_0xd3e9('0x4f')]['sort']);_0x2de54c['where']=qs['filters'](_['pick'](_0x3e6643[_0xd3e9('0x4f')],_0xba73a0[_0xd3e9('0x4d')]));_0x2de54c[_0xd3e9('0x57')]['MailAccountId']=_0x2cb551['id'];if(_0x3e6643['query'][_0xd3e9('0x5a')]){_0x2de54c['where']=_[_0xd3e9('0x58')](_0x2de54c[_0xd3e9('0x57')],{'$or':_['map'](_0x2de54c[_0xd3e9('0x50')],function(_0x4b5307){var _0x258eb1={};_0x258eb1[_0x4b5307]={'$like':'%'+_0x3e6643[_0xd3e9('0x4f')][_0xd3e9('0x5a')]+'%'};return _0x258eb1;})});}_0x2de54c=_[_0xd3e9('0x58')]({},_0x2de54c,_0x3e6643[_0xd3e9('0x5b')]);return db[_0xd3e9('0x69')][_0xd3e9('0x1f')]({'where':_0x2de54c[_0xd3e9('0x57')]})['then'](function(_0x291d08){_0x9c7f56['count']=_0x291d08;if(_0x3e6643[_0xd3e9('0x4f')][_0xd3e9('0x5c')]){_0x2de54c[_0xd3e9('0x5d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2de54c);})[_0xd3e9('0xf')](function(_0x2714f3){_0x9c7f56[_0xd3e9('0x5e')]=_0x2714f3;return _0x9c7f56;});}})['then'](respondWithFilteredResult(_0x1a43cf,_0x2de54c))['catch'](handleError(_0x1a43cf,null));};exports[_0xd3e9('0x6e')]=function(_0x587235,_0x3638d9){return db[_0xd3e9('0x47')][_0xd3e9('0x65')]({'where':{'id':_0x587235[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x3638d9,null))[_0xd3e9('0xf')](function(_0x234e83){if(_0x234e83){return _0x234e83[_0xd3e9('0x6e')](_0x587235['query'][_0xd3e9('0x6f')]);}})[_0xd3e9('0xf')](respondWithStatusCode(_0x3638d9,null))['catch'](handleError(_0x3638d9,null));};exports['addAnswer']=function(_0xbdba63,_0x2b8718){if(_0xbdba63['body']['id']){delete _0xbdba63['body']['id'];}return db[_0xd3e9('0x47')][_0xd3e9('0x65')]({'where':{'id':_0xbdba63['params']['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x2b8718,null))[_0xd3e9('0xf')](function(_0x221490){if(_0x221490){_0xbdba63[_0xd3e9('0x62')][_0xd3e9('0x68')]=_0x221490['id'];return db[_0xd3e9('0x70')]['create'](_0xbdba63[_0xd3e9('0x62')]);}})[_0xd3e9('0xf')](respondWithResult(_0x2b8718,null))[_0xd3e9('0x19')](handleError(_0x2b8718,null));};exports[_0xd3e9('0x71')]=function(_0x2fc0c2,_0x5d5638){var _0x3d1d92={'raw':![],'where':{}};var _0x3baa9e={};var _0x340270={'count':0x0,'rows':[]};return db[_0xd3e9('0x47')]['findOne']({'where':{'id':_0x2fc0c2[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x5d5638,null))[_0xd3e9('0xf')](function(_0x337229){if(_0x337229){_0x3baa9e[_0xd3e9('0x4a')]=_[_0xd3e9('0x4c')](db['CannedAnswer'][_0xd3e9('0x48')]);_0x3baa9e[_0xd3e9('0x4f')]=_['keys'](_0x2fc0c2[_0xd3e9('0x4f')]);_0x3baa9e['filters']=_[_0xd3e9('0x4e')](_0x3baa9e['model'],_0x3baa9e[_0xd3e9('0x4f')]);_0x3d1d92[_0xd3e9('0x50')]=_[_0xd3e9('0x4e')](_0x3baa9e['model'],qs[_0xd3e9('0x51')](_0x2fc0c2[_0xd3e9('0x4f')][_0xd3e9('0x51')]));_0x3d1d92[_0xd3e9('0x50')]=_0x3d1d92[_0xd3e9('0x50')]['length']?_0x3d1d92[_0xd3e9('0x50')]:_0x3baa9e['model'];if(!_0x2fc0c2[_0xd3e9('0x4f')][_0xd3e9('0x52')](_0xd3e9('0x53'))){_0x3d1d92[_0xd3e9('0x1e')]=qs[_0xd3e9('0x1e')](_0x2fc0c2[_0xd3e9('0x4f')]['limit']);_0x3d1d92[_0xd3e9('0x20')]=qs['offset'](_0x2fc0c2[_0xd3e9('0x4f')][_0xd3e9('0x20')]);}_0x3d1d92[_0xd3e9('0x54')]=qs[_0xd3e9('0x55')](_0x2fc0c2[_0xd3e9('0x4f')][_0xd3e9('0x55')]);_0x3d1d92['where']=qs[_0xd3e9('0x4d')](_[_0xd3e9('0x56')](_0x2fc0c2[_0xd3e9('0x4f')],_0x3baa9e[_0xd3e9('0x4d')]));_0x3d1d92['where']['MailAccountId']=_0x337229['id'];if(_0x2fc0c2[_0xd3e9('0x4f')][_0xd3e9('0x5a')]){_0x3d1d92[_0xd3e9('0x57')]=_[_0xd3e9('0x58')](_0x3d1d92[_0xd3e9('0x57')],{'$or':_[_0xd3e9('0x4b')](_0x3d1d92[_0xd3e9('0x50')],function(_0x138bd3){var _0x17fed7={};_0x17fed7[_0x138bd3]={'$like':'%'+_0x2fc0c2[_0xd3e9('0x4f')][_0xd3e9('0x5a')]+'%'};return _0x17fed7;})});}_0x3d1d92=_['merge']({},_0x3d1d92,_0x2fc0c2[_0xd3e9('0x5b')]);return db['CannedAnswer'][_0xd3e9('0x1f')]({'where':_0x3d1d92[_0xd3e9('0x57')]})[_0xd3e9('0xf')](function(_0x3ce5c2){_0x340270['count']=_0x3ce5c2;if(_0x2fc0c2['query'][_0xd3e9('0x5c')]){_0x3d1d92[_0xd3e9('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd3e9('0x72')](_0x3d1d92);})[_0xd3e9('0xf')](function(_0x44e135){_0x340270[_0xd3e9('0x5e')]=_0x44e135;return _0x340270;});}})['then'](respondWithFilteredResult(_0x5d5638,_0x3d1d92))[_0xd3e9('0x19')](handleError(_0x5d5638,null));};exports[_0xd3e9('0x73')]=function(_0x2eeeac,_0x2d4d46){return db[_0xd3e9('0x47')][_0xd3e9('0x65')]({'where':{'id':_0x2eeeac[_0xd3e9('0x60')]['id']}})['then'](handleEntityNotFound(_0x2d4d46,null))[_0xd3e9('0xf')](function(_0x3bd2cb){if(_0x3bd2cb){return _0x3bd2cb[_0xd3e9('0x73')](_0x2eeeac[_0xd3e9('0x4f')][_0xd3e9('0x6f')]);}})[_0xd3e9('0xf')](respondWithStatusCode(_0x2d4d46,null))[_0xd3e9('0x19')](handleError(_0x2d4d46,null));};exports[_0xd3e9('0x6a')]=function(_0x3b85dd,_0x3c50f4){var _0x36b954={'name':_0x3b85dd[_0xd3e9('0x62')][_0xd3e9('0x28')],'key':_0x3b85dd[_0xd3e9('0x62')]['key'],'provider':_0x3b85dd[_0xd3e9('0x62')][_0xd3e9('0x63')]===_0xd3e9('0x64')?null:_0x3b85dd['body']['provider'],'email':_0x3b85dd[_0xd3e9('0x62')]['email'],'ListId':_0x3b85dd[_0xd3e9('0x62')][_0xd3e9('0x74')],'active':!_[_0xd3e9('0x75')](_0x3b85dd['body'][_0xd3e9('0x76')])?_0x3b85dd[_0xd3e9('0x62')][_0xd3e9('0x76')]:!![],'description':_0x3b85dd['body'][_0xd3e9('0x77')]||null};var _0x3e7f76=getAuthenticationOptions(_0x36b954[_0xd3e9('0x63')],_0x3b85dd[_0xd3e9('0x62')]);_0x36b954['Imap']=_0x3e7f76[_0xd3e9('0x41')];_0x36b954['Smtp']=_0x3e7f76[_0xd3e9('0x42')];return db[_0xd3e9('0x47')][_0xd3e9('0x6a')](_0x36b954,{'include':[{'model':db[_0xd3e9('0x45')],'as':_0xd3e9('0x42')},{'model':db['MailServerIn'],'as':_0xd3e9('0x41')}]})[_0xd3e9('0xf')](function(_0xccc3a5){var _0x54169a=_0x3b85dd[_0xd3e9('0x36')][_0xd3e9('0x24')]({'plain':!![]});if(!_0x54169a)throw new Error(_0xd3e9('0x78'));if(_0x54169a['role']===_0xd3e9('0x36')){var _0x2704e7=_0xccc3a5[_0xd3e9('0x24')]({'plain':!![]});return db[_0xd3e9('0x79')][_0xd3e9('0x65')]({'where':{'name':_0xd3e9('0x25'),'userProfileId':_0x54169a[_0xd3e9('0x7a')]},'raw':!![]})[_0xd3e9('0xf')](function(_0xa58106){if(_0xa58106&&_0xa58106['autoAssociation']===0x0){return db[_0xd3e9('0x26')][_0xd3e9('0x6a')]({'name':_0x2704e7[_0xd3e9('0x28')],'resourceId':_0x2704e7['id'],'type':_0xa58106[_0xd3e9('0x28')],'sectionId':_0xa58106['id']},{})['then'](function(){return _0xccc3a5;});}else{return _0xccc3a5;}})[_0xd3e9('0x19')](function(_0x1d92f4){logger[_0xd3e9('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d92f4);throw _0x1d92f4;});}return _0xccc3a5;})[_0xd3e9('0xf')](respondWithResult(_0x3c50f4,0xc9))[_0xd3e9('0x19')](handleError(_0x3c50f4,null));};exports[_0xd3e9('0x7b')]=function(_0x70715b,_0x39e56e){return db[_0xd3e9('0x47')][_0xd3e9('0x6c')]({'where':{'id':_0x70715b[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x39e56e,null))[_0xd3e9('0xf')](function(_0x58a9c9){if(_0x58a9c9){return _0x58a9c9[_0xd3e9('0x7b')]();}return null;})[_0xd3e9('0xf')](respondWithResult(_0x39e56e,null))[_0xd3e9('0x19')](handleError(_0x39e56e,null));};exports['addImap']=function(_0x1b6dbf,_0x531f63){if(_0x1b6dbf[_0xd3e9('0x62')]['id']){delete _0x1b6dbf[_0xd3e9('0x62')]['id'];}return db[_0xd3e9('0x47')]['find']({'where':{'id':_0x1b6dbf['params']['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x531f63,null))[_0xd3e9('0xf')](function(_0x2cfb2a){if(_0x2cfb2a){_0x1b6dbf[_0xd3e9('0x62')][_0xd3e9('0x68')]=_0x2cfb2a['id'];return db[_0xd3e9('0x44')]['create'](_0x1b6dbf[_0xd3e9('0x62')]);}})[_0xd3e9('0xf')](respondWithResult(_0x531f63,null))[_0xd3e9('0x19')](handleError(_0x531f63,null));};exports[_0xd3e9('0x7c')]=function(_0x4242d4,_0x17d4e3){return db[_0xd3e9('0x47')][_0xd3e9('0x6c')]({'where':{'id':_0x4242d4['params']['id']}})['then'](handleEntityNotFound(_0x17d4e3,null))[_0xd3e9('0xf')](function(_0xbdb332){if(_0xbdb332){return _0xbdb332[_0xd3e9('0x7d')](null);}return null;})[_0xd3e9('0xf')](respondWithStatusCode(_0x17d4e3,null))[_0xd3e9('0x19')](handleError(_0x17d4e3,null));};exports['getSmtp']=function(_0x4027aa,_0x15f276){return db[_0xd3e9('0x47')][_0xd3e9('0x6c')]({'where':{'id':_0x4027aa[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x15f276,null))[_0xd3e9('0xf')](function(_0x5c2cf9){if(_0x5c2cf9){return _0x5c2cf9[_0xd3e9('0x7e')]();}return null;})[_0xd3e9('0xf')](respondWithResult(_0x15f276,null))[_0xd3e9('0x19')](handleError(_0x15f276,null));};exports[_0xd3e9('0x7f')]=function(_0x286145,_0x3780b6){if(_0x286145[_0xd3e9('0x62')]['id']){delete _0x286145[_0xd3e9('0x62')]['id'];}return db[_0xd3e9('0x47')][_0xd3e9('0x65')]({'where':{'id':_0x286145['params']['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x3780b6,null))['then'](function(_0x438e1e){if(_0x438e1e){_0x286145['body']['MailAccountId']=_0x438e1e['id'];return db[_0xd3e9('0x45')][_0xd3e9('0x6a')](_0x286145[_0xd3e9('0x62')]);}})['then'](respondWithResult(_0x3780b6,null))[_0xd3e9('0x19')](handleError(_0x3780b6,null));};exports[_0xd3e9('0x80')]=function(_0x45b582,_0x348e11){return db['MailAccount'][_0xd3e9('0x6c')]({'where':{'id':_0x45b582[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x348e11,null))[_0xd3e9('0xf')](function(_0x28a58e){if(_0x28a58e){return _0x28a58e[_0xd3e9('0x81')](null);}return null;})[_0xd3e9('0xf')](respondWithStatusCode(_0x348e11,null))[_0xd3e9('0x19')](handleError(_0x348e11,null));};exports[_0xd3e9('0x82')]=function(_0x127d9c,_0x722e93){return db[_0xd3e9('0x83')]['find']({'where':{'id':_0x127d9c[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x722e93,null))[_0xd3e9('0xf')](function(_0x59c332){if(_0x59c332){return _0x59c332[_0xd3e9('0x82')](_0x127d9c[_0xd3e9('0x62')]['ids'],_['omit'](_0x127d9c['body'],['ids','id'])||{});}})[_0xd3e9('0xf')](respondWithResult(_0x722e93,null))[_0xd3e9('0x19')](handleError(_0x722e93,null));};exports[_0xd3e9('0x84')]=function(_0x1cd62a,_0x209347){var _0x4f9298={'raw':![],'where':{}};var _0x1f1b8e={};var _0x39be07={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1cd62a[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x209347,null))[_0xd3e9('0xf')](function(_0x7ee366){if(_0x7ee366){_0x1f1b8e[_0xd3e9('0x4a')]=_[_0xd3e9('0x4c')](db['MailInteraction'][_0xd3e9('0x48')]);_0x1f1b8e[_0xd3e9('0x4f')]=_[_0xd3e9('0x4c')](_0x1cd62a[_0xd3e9('0x4f')]);_0x1f1b8e[_0xd3e9('0x4d')]=_[_0xd3e9('0x4e')](_0x1f1b8e[_0xd3e9('0x4a')],_0x1f1b8e[_0xd3e9('0x4f')]);_0x4f9298[_0xd3e9('0x50')]=_[_0xd3e9('0x4e')](_0x1f1b8e['model'],qs['fields'](_0x1cd62a[_0xd3e9('0x4f')][_0xd3e9('0x51')]));_0x4f9298[_0xd3e9('0x50')]=_0x4f9298[_0xd3e9('0x50')][_0xd3e9('0x6d')]?_0x4f9298[_0xd3e9('0x50')]:_0x1f1b8e[_0xd3e9('0x4a')];if(!_0x1cd62a['query'][_0xd3e9('0x52')](_0xd3e9('0x53'))){_0x4f9298[_0xd3e9('0x1e')]=qs[_0xd3e9('0x1e')](_0x1cd62a[_0xd3e9('0x4f')][_0xd3e9('0x1e')]);_0x4f9298[_0xd3e9('0x20')]=qs[_0xd3e9('0x20')](_0x1cd62a[_0xd3e9('0x4f')][_0xd3e9('0x20')]);}_0x4f9298[_0xd3e9('0x54')]=qs[_0xd3e9('0x55')](_0x1cd62a[_0xd3e9('0x4f')][_0xd3e9('0x55')]);_0x4f9298[_0xd3e9('0x57')]=qs[_0xd3e9('0x4d')](_[_0xd3e9('0x56')](_0x1cd62a['query'],_0x1f1b8e[_0xd3e9('0x4d')]));_0x4f9298[_0xd3e9('0x57')][_0xd3e9('0x68')]=_0x7ee366['id'];if(_0x1cd62a[_0xd3e9('0x4f')]['filter']){_0x4f9298[_0xd3e9('0x57')]=_[_0xd3e9('0x58')](_0x4f9298['where'],{'$or':_[_0xd3e9('0x4b')](_0x4f9298[_0xd3e9('0x50')],function(_0x164451){var _0x4b3d0e={};_0x4b3d0e[_0x164451]={'$like':'%'+_0x1cd62a['query'][_0xd3e9('0x5a')]+'%'};return _0x4b3d0e;})});}_0x4f9298=_[_0xd3e9('0x58')]({},_0x4f9298,_0x1cd62a[_0xd3e9('0x5b')]);return db[_0xd3e9('0x83')][_0xd3e9('0x1f')]({'where':_0x4f9298['where']})[_0xd3e9('0xf')](function(_0x3a115a){_0x39be07[_0xd3e9('0x1f')]=_0x3a115a;if(_0x1cd62a[_0xd3e9('0x4f')]['includeAll']){_0x4f9298[_0xd3e9('0x5d')]=[{'model':db[_0xd3e9('0x85')],'as':_0xd3e9('0x86'),'required':![]},{'model':db[_0xd3e9('0x87')],'as':_0xd3e9('0x88'),'attributes':[_0xd3e9('0x28'),'fullname',_0xd3e9('0x89')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd3e9('0x28'),_0xd3e9('0x8a')],'where':_0x1cd62a[_0xd3e9('0x4f')]['tag']?{'id':_0x1cd62a['query']['tag']}:undefined,'required':_0x1cd62a['query'][_0xd3e9('0x8b')]?!![]:![]}];}return db[_0xd3e9('0x83')][_0xd3e9('0x72')](_0x4f9298);})[_0xd3e9('0xf')](function(_0x14d3f6){_0x39be07[_0xd3e9('0x5e')]=_0x14d3f6;return _0x39be07;});}})[_0xd3e9('0xf')](respondWithFilteredResult(_0x209347,_0x4f9298))[_0xd3e9('0x19')](handleError(_0x209347,null));};exports[_0xd3e9('0x8c')]=function addApplications(_0x4083a6,_0x26520b){var _0x8c6dd5=_0x4083a6['params']['id'];var _0x4905d4=_0x4083a6['body'];var _0x2c4f7d=0xc8;var _0x33219e=null;return db[_0xd3e9('0x8d')][_0xd3e9('0x8e')]({'isolationLevel':db['sequelize'][_0xd3e9('0x8f')][_0xd3e9('0x90')]['READ_COMMITTED']},function(_0x3abdd8){return db['MailAccount'][_0xd3e9('0x6c')]({'where':{'id':_0x8c6dd5},'transaction':_0x3abdd8})['then'](function(_0x13dbb4){if(_0x13dbb4){return db[_0xd3e9('0x91')][_0xd3e9('0x23')]({'where':{'MailAccountId':_0x8c6dd5},'transaction':_0x3abdd8})['then'](function(){var _0x5a6c78=_[_0xd3e9('0x4b')](_0x4905d4,function(_0x5c06b5){_0x5c06b5[_0xd3e9('0x68')]=_0x8c6dd5;return _0x5c06b5;});return db[_0xd3e9('0x91')][_0xd3e9('0x92')](_0x5a6c78,{'transaction':_0x3abdd8});});}else{_0x2c4f7d=0x194;_0x33219e=[];}});})[_0xd3e9('0xf')](function(){if(_0x2c4f7d!==0x194){return db[_0xd3e9('0x91')]['findAndCountAll']({'where':{'MailAccountId':_0x8c6dd5},'order':'priority'})[_0xd3e9('0xf')](function(_0x1200f8){_0x33219e=_0x1200f8;});}})[_0xd3e9('0x19')](function(_0x3ab43d){_0x2c4f7d=0x1f4;logger[_0xd3e9('0x15')](_0x3ab43d[_0xd3e9('0x27')]);if(_0x3ab43d[_0xd3e9('0x28')]){delete _0x3ab43d[_0xd3e9('0x28')];}_0x33219e=_0x3ab43d;})['finally'](function(){if(_0x33219e===null){_0x26520b['sendStatus'](_0x2c4f7d);}else{if(_0x2c4f7d===0x1f4){_0x26520b['status'](_0x2c4f7d)[_0xd3e9('0x29')](_0x33219e);}else{_0x26520b['status'](_0x2c4f7d)['json'](_0x33219e);}}});};exports['getApplications']=function(_0x40e90d,_0xeb8af3){var _0x5d745d={};var _0x2dd70e={};var _0x572cda;var _0x566216;return db['MailAccount'][_0xd3e9('0x6c')]({'where':{'id':_0x40e90d[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0xeb8af3,null))[_0xd3e9('0xf')](function(_0x5c6aec){if(_0x5c6aec){_0x572cda=_0x5c6aec;_0x2dd70e[_0xd3e9('0x4a')]=_['keys'](db['MailApplication'][_0xd3e9('0x48')]);_0x2dd70e['query']=_[_0xd3e9('0x4c')](_0x40e90d[_0xd3e9('0x4f')]);_0x2dd70e[_0xd3e9('0x4d')]=_[_0xd3e9('0x4e')](_0x2dd70e[_0xd3e9('0x4a')],_0x2dd70e[_0xd3e9('0x4f')]);_0x5d745d['attributes']=_[_0xd3e9('0x4e')](_0x2dd70e[_0xd3e9('0x4a')],qs[_0xd3e9('0x51')](_0x40e90d[_0xd3e9('0x4f')][_0xd3e9('0x51')]));_0x5d745d[_0xd3e9('0x50')]=_0x5d745d['attributes'][_0xd3e9('0x6d')]?_0x5d745d[_0xd3e9('0x50')]:_0x2dd70e['model'];_0x5d745d[_0xd3e9('0x54')]=qs[_0xd3e9('0x55')](_0x40e90d['query'][_0xd3e9('0x55')]);_0x5d745d[_0xd3e9('0x57')]=qs[_0xd3e9('0x4d')](_[_0xd3e9('0x56')](_0x40e90d[_0xd3e9('0x4f')],_0x2dd70e[_0xd3e9('0x4d')]));if(_0x40e90d[_0xd3e9('0x4f')][_0xd3e9('0x5a')]){_0x5d745d[_0xd3e9('0x57')]=_[_0xd3e9('0x58')](_0x5d745d[_0xd3e9('0x57')],{'$or':_[_0xd3e9('0x4b')](_0x5d745d[_0xd3e9('0x50')],function(_0x391cf3){var _0x96c6dd={};_0x96c6dd[_0x391cf3]={'$like':'%'+_0x40e90d[_0xd3e9('0x4f')][_0xd3e9('0x5a')]+'%'};return _0x96c6dd;})});}_0x5d745d=_[_0xd3e9('0x58')]({},_0x5d745d,_0x40e90d[_0xd3e9('0x5b')]);return _0x572cda[_0xd3e9('0x93')](_0x5d745d);}})['then'](function(_0x4fa19c){if(_0x4fa19c){_0x566216=_0x4fa19c[_0xd3e9('0x6d')];if(!_0x40e90d['query'][_0xd3e9('0x52')](_0xd3e9('0x53'))){_0x5d745d[_0xd3e9('0x1e')]=qs[_0xd3e9('0x1e')](_0x40e90d[_0xd3e9('0x4f')]['limit']);_0x5d745d[_0xd3e9('0x20')]=qs[_0xd3e9('0x20')](_0x40e90d[_0xd3e9('0x4f')]['offset']);}return _0x572cda[_0xd3e9('0x93')](_0x5d745d);}})[_0xd3e9('0xf')](function(_0x491373){if(_0x491373){return _0x491373?{'count':_0x566216,'rows':_0x491373}:null;}})[_0xd3e9('0xf')](respondWithResult(_0xeb8af3,null))[_0xd3e9('0x19')](handleError(_0xeb8af3,null));};exports['getMessages']=function(_0x118227,_0x314378){var _0x3e763d={'raw':!![],'where':{}};var _0xb0d343={};var _0x4fd315={'count':0x0,'rows':[]};return db[_0xd3e9('0x47')][_0xd3e9('0x6c')]({'where':{'id':_0x118227[_0xd3e9('0x60')]['id']}})['then'](handleEntityNotFound(_0x314378,null))['then'](function(_0xf73d89){if(_0xf73d89){_0xb0d343[_0xd3e9('0x4a')]=_['keys'](db[_0xd3e9('0x94')][_0xd3e9('0x48')]);_0xb0d343[_0xd3e9('0x4f')]=_[_0xd3e9('0x4c')](_0x118227[_0xd3e9('0x4f')]);_0xb0d343['filters']=_[_0xd3e9('0x4e')](_0xb0d343[_0xd3e9('0x4a')],_0xb0d343['query']);_0x3e763d[_0xd3e9('0x50')]=_[_0xd3e9('0x4e')](_0xb0d343['model'],qs[_0xd3e9('0x51')](_0x118227[_0xd3e9('0x4f')]['fields']));_0x3e763d[_0xd3e9('0x50')]=_0x3e763d['attributes'][_0xd3e9('0x6d')]?_0x3e763d[_0xd3e9('0x50')]:_0xb0d343['model'];if(!_0x118227[_0xd3e9('0x4f')][_0xd3e9('0x52')]('nolimit')){_0x3e763d['limit']=qs[_0xd3e9('0x1e')](_0x118227['query'][_0xd3e9('0x1e')]);_0x3e763d[_0xd3e9('0x20')]=qs[_0xd3e9('0x20')](_0x118227[_0xd3e9('0x4f')][_0xd3e9('0x20')]);}_0x3e763d[_0xd3e9('0x54')]=qs[_0xd3e9('0x55')](_0x118227[_0xd3e9('0x4f')][_0xd3e9('0x55')]);_0x3e763d['where']=qs[_0xd3e9('0x4d')](_['pick'](_0x118227['query'],_0xb0d343[_0xd3e9('0x4d')]));_0x3e763d[_0xd3e9('0x57')][_0xd3e9('0x68')]=_0xf73d89['id'];if(_0x118227[_0xd3e9('0x4f')][_0xd3e9('0x5a')]){_0x3e763d[_0xd3e9('0x57')]=_[_0xd3e9('0x58')](_0x3e763d[_0xd3e9('0x57')],{'$or':_[_0xd3e9('0x4b')](_0x3e763d[_0xd3e9('0x50')],function(_0x48d097){var _0x45f7e5={};_0x45f7e5[_0x48d097]={'$like':'%'+_0x118227[_0xd3e9('0x4f')][_0xd3e9('0x5a')]+'%'};return _0x45f7e5;})});}if(_0x118227[_0xd3e9('0x4f')][_0xd3e9('0x95')]){var _0x4e8754=_0x118227[_0xd3e9('0x4f')][_0xd3e9('0x95')][_0xd3e9('0x96')](',');var _0x3fbd0f={};_0x3fbd0f[_0x4e8754[0x0]]={'$gte':moment(_0x4e8754[0x1])[_0xd3e9('0x97')](_0xd3e9('0x98'))};_0x3e763d[_0xd3e9('0x57')]=_[_0xd3e9('0x58')](_0x3e763d[_0xd3e9('0x57')],_0x3fbd0f);}_0x3e763d=_[_0xd3e9('0x58')]({},_0x3e763d,_0x118227[_0xd3e9('0x5b')]);return db[_0xd3e9('0x94')][_0xd3e9('0x1f')]({'where':_0x3e763d[_0xd3e9('0x57')]})[_0xd3e9('0xf')](function(_0x5d4266){_0x4fd315['count']=_0x5d4266;if(_0x118227['query']['includeAll']){_0x3e763d[_0xd3e9('0x5d')]=[{'all':!![]}];}return db[_0xd3e9('0x94')][_0xd3e9('0x72')](_0x3e763d);})[_0xd3e9('0xf')](function(_0x41a11b){if(_0x118227['query'][_0xd3e9('0x99')]===_0xd3e9('0x9a')){for(var _0x24b471=0x0;_0x24b471<_0x41a11b['length'];_0x24b471++){_0x41a11b[_0x24b471][_0xd3e9('0x62')]=juice(_0x41a11b[_0x24b471][_0xd3e9('0x62')]);}}_0x4fd315[_0xd3e9('0x5e')]=_0x41a11b;return _0x4fd315;});}})[_0xd3e9('0xf')](respondWithFilteredResult(_0x314378,_0x3e763d))[_0xd3e9('0x19')](handleError(_0x314378,null));};exports['send']=function(_0x5e30b0,_0x588651){var _0x324b46,_0x29e013={},_0x566340;if(_0x5e30b0[_0xd3e9('0x62')]['to']){_0x566340=_0x5e30b0[_0xd3e9('0x62')]['to']['split'](',')[0x0];}return db[_0xd3e9('0x47')][_0xd3e9('0x65')]({'where':{'id':_0x5e30b0[_0xd3e9('0x60')]['id']},'include':[{'model':db[_0xd3e9('0x9b')],'as':_0xd3e9('0x9c'),'include':[{'model':db['CmContact'],'as':_0xd3e9('0x9d'),'where':{'email':_0x566340},'limit':0x1,'order':[[_0xd3e9('0x9e'),_0xd3e9('0x9f')]]}]},{'model':db[_0xd3e9('0x45')],'as':_0xd3e9('0x42'),'raw':!![],'include':[{'model':db[_0xd3e9('0xa0')],'as':_0xd3e9('0xa0'),'raw':!![]}]}]})[_0xd3e9('0xf')](handleEntityNotFound(_0x588651,null))[_0xd3e9('0xf')](function(_0x40d8c8){if(!_0x40d8c8)return;_0x324b46=_0x40d8c8;if(!_0x40d8c8['Smtp'])throw new Error(_0xd3e9('0xa1'));if(_['isNil'](_0x5e30b0[_0xd3e9('0x62')][_0xd3e9('0xa2')])){_0x5e30b0[_0xd3e9('0x62')][_0xd3e9('0xa2')]=util[_0xd3e9('0x97')](_0xd3e9('0xa3'),_0x40d8c8[_0xd3e9('0x28')],_0x40d8c8[_0xd3e9('0xa4')]||_0x40d8c8[_0xd3e9('0x42')][_0xd3e9('0x36')]);}if(_0x5e30b0['body'][_0xd3e9('0xa5')]&&_0x5e30b0[_0xd3e9('0x62')][_0xd3e9('0xa5')]['length']){for(var _0xf1990a=0x0;_0xf1990a<_0x5e30b0[_0xd3e9('0x62')]['attachments'][_0xd3e9('0x6d')];_0xf1990a+=0x1){_0x5e30b0[_0xd3e9('0x62')]['attachments'][_0xf1990a]={'filename':_0x5e30b0[_0xd3e9('0x62')][_0xd3e9('0xa5')][_0xf1990a][_0xd3e9('0x28')],'path':path['join'](config['root'],'server/files/attachments',_0x5e30b0[_0xd3e9('0x62')]['attachments'][_0xf1990a][_0xd3e9('0xa6')])};}}var _0x5663e9=_0x40d8c8[_0xd3e9('0xa7')]();return respondWithRpcPromise('SendMail',_0xd3e9('0xa8'),{'account':_0x5663e9,'message':_0x5e30b0['body']});})[_0xd3e9('0xf')](function(_0x4a55f6){if(!_0x4a55f6)return;_0x29e013=_0x4a55f6;if(!_0x324b46[_0xd3e9('0x9c')])throw new Error(_0xd3e9('0xa9'));if(_0x324b46['List'][_0xd3e9('0x9d')][_0xd3e9('0x6d')])return _0x324b46[_0xd3e9('0x9c')]['Contacts'][0x0];return db['CmContact'][_0xd3e9('0x6a')](_['defaults'](_0x5e30b0[_0xd3e9('0x62')],{'firstName':_0x5e30b0['body']['to'],'email':_0x5e30b0[_0xd3e9('0x62')]['to'],'phone':_0x5e30b0[_0xd3e9('0x62')]['to'],'ListId':_0x324b46[_0xd3e9('0x74')]}));})['then'](function(_0x5dd5a8){if(!_0x5dd5a8)return;var _0x35df4a={'UserId':_0x5e30b0[_0xd3e9('0x36')]['id'],'ContactId':_0x5dd5a8['id'],'MailAccountId':_0x324b46['id'],'inReplyTo':_0x29e013[_0xd3e9('0xaa')],'to':_0x5e30b0['body'][_0xd3e9('0xa2')],'cc':_0x5e30b0[_0xd3e9('0x62')]['cc'],'subject':_0x5e30b0[_0xd3e9('0x62')][_0xd3e9('0xab')],'attach':_0x5e30b0[_0xd3e9('0x62')][_0xd3e9('0xac')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xd3e9('0x98')),'lastMsgDirection':_0xd3e9('0xad'),'Messages':[_[_0xd3e9('0x58')](_0x5e30b0['body'],{'messageId':_0x29e013['messageId'],'sentAt':moment()[_0xd3e9('0x97')](_0xd3e9('0x98')),'read':!![],'MailAccountId':_0x324b46['id'],'UserId':_0x5e30b0[_0xd3e9('0x36')]['id'],'ContactId':_0x5dd5a8['id']})]};if(_0x5e30b0[_0xd3e9('0x62')][_0xd3e9('0xae')]){_0x35df4a=_[_0xd3e9('0x58')](_0x35df4a,_0x5e30b0[_0xd3e9('0x62')][_0xd3e9('0xae')]);}return db[_0xd3e9('0x83')][_0xd3e9('0x6a')](_0x35df4a,{'include':[{'model':db[_0xd3e9('0x94')],'as':_0xd3e9('0xaf')}]});})[_0xd3e9('0xf')](respondWithResult(_0x588651,null))['catch'](handleError(_0x588651,null));};exports['verifySmtp']=function(_0x37832d,_0x146ebc){return db['MailAccount'][_0xd3e9('0x65')]({'where':{'id':_0x37832d['params']['id']},'include':[{'model':db[_0xd3e9('0x45')],'as':_0xd3e9('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd3e9('0xa0'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x146ebc,null))['then'](function(_0xd59d0){if(!_0xd59d0[_0xd3e9('0x42')])return;var _0x476327=_0xd59d0[_0xd3e9('0xa7')]();return respondWithRpcPromise('VerifySmtp',_0xd3e9('0xb0'),{'account':_0x476327});})[_0xd3e9('0xf')](respondWithResult(_0x146ebc,null))['catch'](handleError(_0x146ebc,null));};exports[_0xd3e9('0x23')]=function(_0x27f26d,_0x2992b6){return db['MailAccount'][_0xd3e9('0x65')]({'where':{'id':_0x27f26d[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x2992b6,null))['then'](function(_0x453eab){if(_0x453eab&&_0x453eab[_0xd3e9('0x3e')]){throw new db[(_0xd3e9('0xb1'))][(_0xd3e9('0xb2'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x453eab;})['then'](removeEntity(_0x2992b6,null))[_0xd3e9('0x19')](handleError(_0x2992b6,null));};exports[_0xd3e9('0xb3')]=function(_0x57a39c,_0x468e90){return db[_0xd3e9('0x47')]['find']({'where':{'id':_0x57a39c[_0xd3e9('0x60')]['id']}})['then'](handleEntityNotFound(_0x468e90,null))[_0xd3e9('0xf')](function(_0x5a614f){if(_0x5a614f){return _0x5a614f['addAgents'](_0x57a39c[_0xd3e9('0x62')]['ids'],_['omit'](_0x57a39c[_0xd3e9('0x62')],[_0xd3e9('0x6f'),'id'])||{})['spread'](function(_0x6f68fa){for(var _0x51d4d0=0x0;_0x51d4d0<_0x57a39c[_0xd3e9('0x62')][_0xd3e9('0x6f')]['length'];_0x51d4d0+=0x1){socket[_0xd3e9('0xb4')](_0xd3e9('0xb5'),{'UserId':Number(_0x57a39c[_0xd3e9('0x62')]['ids'][_0x51d4d0]),'MailAccountId':Number(_0x57a39c[_0xd3e9('0x60')]['id'])});}return _0x6f68fa;});}})[_0xd3e9('0xf')](respondWithResult(_0x468e90,null))['catch'](handleError(_0x468e90,null));};exports['removeAgents']=function(_0x139681,_0x17cf09){return db[_0xd3e9('0x47')][_0xd3e9('0x65')]({'where':{'id':_0x139681['params']['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x17cf09,null))[_0xd3e9('0xf')](function(_0x4ac84e){if(_0x4ac84e){return _0x4ac84e[_0xd3e9('0xb6')](_0x139681[_0xd3e9('0x4f')][_0xd3e9('0x6f')])[_0xd3e9('0xf')](function(){if(_['isArray'](_0x139681['query'][_0xd3e9('0x6f')])){for(var _0x362261=0x0;_0x362261<_0x139681[_0xd3e9('0x4f')][_0xd3e9('0x6f')][_0xd3e9('0x6d')];_0x362261+=0x1){socket['emit'](_0xd3e9('0xb7'),{'UserId':Number(_0x139681[_0xd3e9('0x4f')][_0xd3e9('0x6f')][_0x362261]),'MailAccountId':Number(_0x139681['params']['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x139681[_0xd3e9('0x4f')][_0xd3e9('0x6f')]),'MailAccountId':Number(_0x139681[_0xd3e9('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x17cf09,null))['catch'](handleError(_0x17cf09,null));};exports[_0xd3e9('0xb8')]=function(_0x4f490b,_0x2805aa){var _0x3b1029={};var _0x4cecdc={};var _0x23af78;var _0x581974;return db[_0xd3e9('0x47')]['findOne']({'where':{'id':_0x4f490b[_0xd3e9('0x60')]['id']}})[_0xd3e9('0xf')](handleEntityNotFound(_0x2805aa,null))[_0xd3e9('0xf')](function(_0x21197c){if(_0x21197c){_0x23af78=_0x21197c;_0x4cecdc[_0xd3e9('0x4a')]=_[_0xd3e9('0x4c')](db[_0xd3e9('0x87')][_0xd3e9('0x48')]);_0x4cecdc[_0xd3e9('0x4f')]=_[_0xd3e9('0x4c')](_0x4f490b['query']);_0x4cecdc[_0xd3e9('0x4d')]=_['intersection'](_0x4cecdc[_0xd3e9('0x4a')],_0x4cecdc[_0xd3e9('0x4f')]);_0x3b1029[_0xd3e9('0x50')]=_['intersection'](_0x4cecdc[_0xd3e9('0x4a')],qs['fields'](_0x4f490b[_0xd3e9('0x4f')][_0xd3e9('0x51')]));_0x3b1029['attributes']=_0x3b1029[_0xd3e9('0x50')][_0xd3e9('0x6d')]?_0x3b1029['attributes']:_0x4cecdc[_0xd3e9('0x4a')];_0x3b1029[_0xd3e9('0x54')]=qs['sort'](_0x4f490b[_0xd3e9('0x4f')][_0xd3e9('0x55')]);_0x3b1029[_0xd3e9('0x57')]=qs[_0xd3e9('0x4d')](_[_0xd3e9('0x56')](_0x4f490b[_0xd3e9('0x4f')],_0x4cecdc[_0xd3e9('0x4d')]));if(_0x4f490b[_0xd3e9('0x4f')][_0xd3e9('0x5a')]){_0x3b1029[_0xd3e9('0x57')]=_['merge'](_0x3b1029[_0xd3e9('0x57')],{'$or':_['map'](_0x3b1029[_0xd3e9('0x50')],function(_0x4b92e7){var _0x3552a6={};_0x3552a6[_0x4b92e7]={'$like':'%'+_0x4f490b[_0xd3e9('0x4f')][_0xd3e9('0x5a')]+'%'};return _0x3552a6;})});}_0x3b1029=_['merge']({},_0x3b1029,_0x4f490b[_0xd3e9('0x5b')]);return _0x23af78[_0xd3e9('0xb8')](_0x3b1029);}})[_0xd3e9('0xf')](function(_0x1b38ca){if(_0x1b38ca){_0x581974=_0x1b38ca[_0xd3e9('0x6d')];if(!_0x4f490b[_0xd3e9('0x4f')][_0xd3e9('0x52')](_0xd3e9('0x53'))){_0x3b1029[_0xd3e9('0x1e')]=qs[_0xd3e9('0x1e')](_0x4f490b['query'][_0xd3e9('0x1e')]);_0x3b1029[_0xd3e9('0x20')]=qs[_0xd3e9('0x20')](_0x4f490b[_0xd3e9('0x4f')][_0xd3e9('0x20')]);}return _0x23af78[_0xd3e9('0xb8')](_0x3b1029);}})['then'](function(_0x5bf9b1){if(_0x5bf9b1){return _0x5bf9b1?{'count':_0x581974,'rows':_0x5bf9b1}:null;}})[_0xd3e9('0xf')](respondWithResult(_0x2805aa,null))['catch'](handleError(_0x2805aa,null));}; \ No newline at end of file +var _0x85e1=['sendStatus','status','json','undefined','limit','count','set','Content-Range','destroy','get','UserProfileResource','end','stack','name','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','mandatoryDispositionPause','find','update','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','addSmtp','removeSmtp','MailInteraction','addInteraction','omit','getInteractions','User','Owner','fullname','Tags','color','tag','findAll','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','server/files/attachments','getSmtpOptions','SendMail','sendMail','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','userMailAccount:remove','moment','bluebird','util','path','lodash','juice','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','jayson/promise','http','request','then','info','debug','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x85e1,0xa5));var _0x185e=function(_0x537d4e,_0x2bfd04){_0x537d4e=_0x537d4e-0x0;var _0x4a3c54=_0x85e1[_0x537d4e];return _0x4a3c54;};'use strict';var moment=require(_0x185e('0x0'));var BPromise=require(_0x185e('0x1'));var util=require(_0x185e('0x2'));var path=require(_0x185e('0x3'));var _=require(_0x185e('0x4'));var juice=require(_0x185e('0x5'));var Redis=require(_0x185e('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x185e('0x7'))(_0x185e('0x8'));var config=require('../../config/environment');var db=require(_0x185e('0x9'))['db'];config[_0x185e('0xa')]=_[_0x185e('0xb')](config[_0x185e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x185e('0xc'))(new Redis(config['redis']));require(_0x185e('0xd'))['register'](socket);var jayson=require(_0x185e('0xe'));var client=jayson['client'][_0x185e('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x17e43d,_0x3db368,_0x589df5,_0x4cde77){return new BPromise(function(_0x38490e,_0x2d8ce3){var _0x6720fb=_0x4cde77||client;return _0x6720fb[_0x185e('0x10')](_0x17e43d,_0x589df5)[_0x185e('0x11')](function(_0x29906d){logger[_0x185e('0x12')]('MailAccount,\x20%s,\x20%s',_0x3db368,'request\x20sent');logger[_0x185e('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3db368,_0x185e('0x14'),JSON[_0x185e('0x15')](_0x29906d));if(_0x29906d[_0x185e('0x16')]){if(_0x29906d[_0x185e('0x16')]['code']===0x1f4){logger[_0x185e('0x16')](_0x185e('0x17'),_0x3db368,_0x29906d[_0x185e('0x16')][_0x185e('0x18')]);return _0x2d8ce3(_0x29906d[_0x185e('0x16')][_0x185e('0x18')]);}logger['error'](_0x185e('0x17'),_0x3db368,_0x29906d[_0x185e('0x16')][_0x185e('0x18')]);return _0x38490e(_0x29906d[_0x185e('0x16')][_0x185e('0x18')]);}else{logger[_0x185e('0x12')](_0x185e('0x17'),_0x3db368,_0x185e('0x14'));_0x38490e(_0x29906d[_0x185e('0x19')][_0x185e('0x18')]);}})['catch'](function(_0xbd23ab){logger[_0x185e('0x16')](_0x185e('0x17'),_0x3db368,_0xbd23ab);_0x2d8ce3(_0xbd23ab);});});}function respondWithStatusCode(_0x3deaf9,_0x2f27de){_0x2f27de=_0x2f27de||0xcc;return function(_0x6a3160){if(_0x6a3160){return _0x3deaf9[_0x185e('0x1a')](_0x2f27de);}return _0x3deaf9['status'](_0x2f27de)['end']();};}function respondWithResult(_0x3abd46,_0x12bbf9){_0x12bbf9=_0x12bbf9||0xc8;return function(_0x231f1f){if(_0x231f1f){return _0x3abd46[_0x185e('0x1b')](_0x12bbf9)[_0x185e('0x1c')](_0x231f1f);}};}function respondWithFilteredResult(_0x5589b9,_0x367d19){return function(_0x5d51ba){if(_0x5d51ba){var _0x7109a5=typeof _0x367d19['offset']===_0x185e('0x1d')&&typeof _0x367d19[_0x185e('0x1e')]==='undefined';var _0x4122c3=_0x5d51ba[_0x185e('0x1f')];var _0x490c9c=_0x7109a5?0x0:_0x367d19['offset'];var _0x28eaaa=_0x7109a5?_0x5d51ba['count']:_0x367d19['offset']+_0x367d19[_0x185e('0x1e')];var _0x50dc75;if(_0x28eaaa>=_0x4122c3){_0x28eaaa=_0x4122c3;_0x50dc75=0xc8;}else{_0x50dc75=0xce;}_0x5589b9[_0x185e('0x1b')](_0x50dc75);return _0x5589b9[_0x185e('0x20')](_0x185e('0x21'),_0x490c9c+'-'+_0x28eaaa+'/'+_0x4122c3)[_0x185e('0x1c')](_0x5d51ba);}return null;};}function saveUpdates(_0x52d493){return function(_0x5b32ba){if(_0x5b32ba){return _0x5b32ba['update'](_0x52d493)['then'](function(_0x465938){return _0x465938;});}return null;};}function removeEntity(_0x35fba8){return function(_0x49a951){if(_0x49a951){return _0x49a951[_0x185e('0x22')]()['then'](function(){var _0x266cb0=_0x49a951[_0x185e('0x23')]({'plain':!![]});var _0x4dbeed='MailAccounts';return db[_0x185e('0x24')]['destroy']({'where':{'type':_0x4dbeed,'resourceId':_0x266cb0['id']}})[_0x185e('0x11')](function(){return _0x49a951;});})[_0x185e('0x11')](function(){_0x35fba8[_0x185e('0x1b')](0xcc)[_0x185e('0x25')]();});}};}function handleEntityNotFound(_0x3f06ca){return function(_0x430c13){if(!_0x430c13){_0x3f06ca[_0x185e('0x1a')](0x194);}return _0x430c13;};}function handleError(_0xbdd842,_0x1cdaad){_0x1cdaad=_0x1cdaad||0x1f4;return function(_0x44c660){logger[_0x185e('0x16')](_0x44c660[_0x185e('0x26')]);if(_0x44c660[_0x185e('0x27')]){delete _0x44c660['name'];}_0xbdd842[_0x185e('0x1b')](_0x1cdaad)['send'](_0x44c660);};}function getImapHost(_0x5915b8){switch(_0x5915b8){case _0x185e('0x28'):return _0x185e('0x29');case'yahoo':return _0x185e('0x2a');case _0x185e('0x2b'):return _0x185e('0x2c');case'outlook365':return'outlook.office365.com';}throw new Error(_0x185e('0x2d'),_0x5915b8);}function getSmtpHost(_0x14dcba){switch(_0x14dcba){case _0x185e('0x28'):return _0x185e('0x2e');case _0x185e('0x2f'):return _0x185e('0x30');case _0x185e('0x2b'):return'smtp-mail.outlook.com';case'outlook365':return _0x185e('0x31');}throw new Error(_0x185e('0x2d'),_0x14dcba);}function getAuthenticationOptions(_0x49ffc6,_0x1056c8){var _0x5632cb={};var _0x2cfcc8={};if(_0x49ffc6){_0x5632cb[_0x185e('0x32')]=_0x2cfcc8['user']=_0x1056c8[_0x185e('0x33')];_0x5632cb[_0x185e('0x34')]=_0x2cfcc8[_0x185e('0x35')]=_0x1056c8[_0x185e('0x34')];if(_0x1056c8[_0x185e('0x36')]){_0x5632cb[_0x185e('0x36')]=_0x2cfcc8['modernAuthentication']=!![];_0x5632cb[_0x185e('0x37')]=_0x2cfcc8[_0x185e('0x37')]=_0x1056c8[_0x185e('0x37')];_0x5632cb[_0x185e('0x34')]=_0x2cfcc8['pass']=null;}else{_0x5632cb[_0x185e('0x37')]=_0x2cfcc8[_0x185e('0x37')]=null;}_0x5632cb[_0x185e('0x38')]=getImapHost(_0x49ffc6);_0x5632cb[_0x185e('0x39')]=0x3e1;_0x2cfcc8['host']=getSmtpHost(_0x49ffc6);_0x2cfcc8[_0x185e('0x39')]=0x24b;_0x2cfcc8[_0x185e('0x3a')]=![];_0x5632cb[_0x185e('0x3b')]=_0x2cfcc8[_0x185e('0x3b')]=null;}else{if(_0x1056c8[_0x185e('0x3c')]){_0x5632cb[_0x185e('0x32')]=_0x2cfcc8['user']=_0x1056c8['username'];_0x5632cb[_0x185e('0x34')]=_0x2cfcc8[_0x185e('0x35')]=_0x1056c8['password'];}else{_0x5632cb[_0x185e('0x3c')]=_0x2cfcc8[_0x185e('0x3c')]=![];_0x5632cb[_0x185e('0x32')]=_0x2cfcc8[_0x185e('0x32')]=null;_0x5632cb[_0x185e('0x34')]=_0x2cfcc8[_0x185e('0x35')]=null;}_0x5632cb[_0x185e('0x38')]=_0x1056c8[_0x185e('0x3d')][_0x185e('0x38')];_0x5632cb[_0x185e('0x39')]=_0x1056c8['Imap'][_0x185e('0x39')];_0x2cfcc8[_0x185e('0x38')]=_0x1056c8[_0x185e('0x3e')]['host'];_0x2cfcc8[_0x185e('0x39')]=_0x1056c8[_0x185e('0x3e')][_0x185e('0x39')];}return{'Imap':_0x5632cb,'Smtp':_0x2cfcc8};}exports[_0x185e('0x3f')]=function(_0x74daa4,_0x534311){var _0x489b25={'include':[{'model':db[_0x185e('0x40')],'as':_0x185e('0x3d')},{'model':db[_0x185e('0x41')],'as':_0x185e('0x3e')},{'model':db[_0x185e('0x42')],'as':'mandatoryDispositionPause'}]},_0x27227b={},_0x9df834={'count':0x0,'rows':[]};var _0x164c9f=_[_0x185e('0x43')](db[_0x185e('0x44')][_0x185e('0x45')],function(_0x5c5487){return{'name':_0x5c5487[_0x185e('0x46')],'type':_0x5c5487[_0x185e('0x47')][_0x185e('0x48')]};});_0x27227b['model']=_[_0x185e('0x43')](_0x164c9f,_0x185e('0x27'));_0x27227b[_0x185e('0x49')]=_[_0x185e('0x4a')](_0x74daa4[_0x185e('0x49')]);_0x27227b[_0x185e('0x4b')]=_[_0x185e('0x4c')](_0x27227b[_0x185e('0x4d')],_0x27227b[_0x185e('0x49')]);_0x489b25[_0x185e('0x4e')]=_['intersection'](_0x27227b[_0x185e('0x4d')],qs[_0x185e('0x4f')](_0x74daa4[_0x185e('0x49')][_0x185e('0x4f')]));_0x489b25[_0x185e('0x4e')]=_0x489b25['attributes'][_0x185e('0x50')]?_0x489b25['attributes']:_0x27227b[_0x185e('0x4d')];if(!_0x74daa4[_0x185e('0x49')][_0x185e('0x51')](_0x185e('0x52'))){_0x489b25[_0x185e('0x1e')]=qs[_0x185e('0x1e')](_0x74daa4[_0x185e('0x49')][_0x185e('0x1e')]);_0x489b25[_0x185e('0x53')]=qs[_0x185e('0x53')](_0x74daa4[_0x185e('0x49')][_0x185e('0x53')]);}_0x489b25[_0x185e('0x54')]=qs[_0x185e('0x55')](_0x74daa4[_0x185e('0x49')][_0x185e('0x55')]);_0x489b25[_0x185e('0x56')]=qs['filters'](_[_0x185e('0x57')](_0x74daa4[_0x185e('0x49')],_0x27227b['filters']),_0x164c9f);if(_0x74daa4[_0x185e('0x49')][_0x185e('0x58')]){_0x489b25['where']=_[_0x185e('0x59')](_0x489b25[_0x185e('0x56')],{'$or':_[_0x185e('0x43')](_0x164c9f,function(_0x3fca43){if(_0x3fca43[_0x185e('0x47')]!==_0x185e('0x5a')){var _0x384c10={};_0x384c10[_0x3fca43['name']]={'$like':'%'+_0x74daa4[_0x185e('0x49')][_0x185e('0x58')]+'%'};return _0x384c10;}})});}_0x489b25=_[_0x185e('0x59')]({},_0x489b25,_0x74daa4[_0x185e('0x5b')]);var _0x55747={'where':_0x489b25[_0x185e('0x56')]};return db[_0x185e('0x44')][_0x185e('0x1f')](_0x55747)['then'](function(_0x592125){_0x9df834[_0x185e('0x1f')]=_0x592125;if(_0x74daa4[_0x185e('0x49')][_0x185e('0x5c')]){_0x489b25[_0x185e('0x5d')]=[{'all':!![]}];}return db[_0x185e('0x44')]['findAll'](_0x489b25);})[_0x185e('0x11')](function(_0x3958df){_0x9df834[_0x185e('0x5e')]=_0x3958df;return _0x9df834;})[_0x185e('0x11')](respondWithFilteredResult(_0x534311,_0x489b25))[_0x185e('0x5f')](handleError(_0x534311,null));};exports[_0x185e('0x60')]=function(_0xd5e859,_0x73181f){var _0x2344ed={'raw':![],'where':{'id':_0xd5e859[_0x185e('0x61')]['id']},'include':[{'model':db[_0x185e('0x40')],'as':'Imap'},{'model':db[_0x185e('0x41')],'as':_0x185e('0x3e')},{'model':db[_0x185e('0x42')],'as':_0x185e('0x62')}]},_0x27f18e={};_0x27f18e['model']=_[_0x185e('0x4a')](db[_0x185e('0x44')][_0x185e('0x45')]);_0x27f18e[_0x185e('0x49')]=_[_0x185e('0x4a')](_0xd5e859[_0x185e('0x49')]);_0x27f18e[_0x185e('0x4b')]=_['intersection'](_0x27f18e[_0x185e('0x4d')],_0x27f18e['query']);_0x2344ed[_0x185e('0x4e')]=_[_0x185e('0x4c')](_0x27f18e[_0x185e('0x4d')],qs[_0x185e('0x4f')](_0xd5e859[_0x185e('0x49')][_0x185e('0x4f')]));_0x2344ed[_0x185e('0x4e')]=_0x2344ed[_0x185e('0x4e')][_0x185e('0x50')]?_0x2344ed[_0x185e('0x4e')]:_0x27f18e[_0x185e('0x4d')];if(_0xd5e859[_0x185e('0x49')][_0x185e('0x5c')]){_0x2344ed[_0x185e('0x5d')]=[{'all':!![]}];}_0x2344ed=_['merge']({},_0x2344ed,_0xd5e859['options']);return db['MailAccount'][_0x185e('0x63')](_0x2344ed)[_0x185e('0x11')](handleEntityNotFound(_0x73181f,null))[_0x185e('0x11')](respondWithResult(_0x73181f,null))['catch'](handleError(_0x73181f,null));};exports[_0x185e('0x64')]=function(_0xf94e57,_0x274e48){if(_0xf94e57[_0x185e('0x65')]['id']){delete _0xf94e57['body']['id'];}var _0x4b56c4=_0xf94e57[_0x185e('0x65')][_0x185e('0x66')]===_0x185e('0x67')?null:_0xf94e57[_0x185e('0x65')][_0x185e('0x66')];var _0x4cc046=_0xf94e57[_0x185e('0x65')][_0x185e('0x3d')]||{};var _0x5b21ce=_0xf94e57[_0x185e('0x65')]['Smtp']||{};if(_0x4b56c4){_0x4cc046[_0x185e('0x38')]=getImapHost(_0x4b56c4);_0x4cc046[_0x185e('0x39')]=0x3e1;_0x5b21ce[_0x185e('0x38')]=getSmtpHost(_0x4b56c4);_0x5b21ce[_0x185e('0x39')]=0x24b;_0x5b21ce['secure']=![];}if(_0x5b21ce[_0x185e('0x36')]){_0x5b21ce[_0x185e('0x3a')]=![];}else{_0x5b21ce[_0x185e('0x37')]=null;}if(!_0x4cc046[_0x185e('0x36')])_0x4cc046['CloudProviderId']=null;_0xf94e57[_0x185e('0x65')][_0x185e('0x3d')]=_0x4cc046;_0xf94e57[_0x185e('0x65')]['Smtp']=_0x5b21ce;return db[_0x185e('0x44')][_0x185e('0x63')]({'where':{'id':_0xf94e57['params']['id']},'include':[{'model':db[_0x185e('0x40')],'as':_0x185e('0x3d')},{'model':db[_0x185e('0x41')],'as':_0x185e('0x3e')},{'model':db[_0x185e('0x42')],'as':_0x185e('0x62')}]})[_0x185e('0x11')](handleEntityNotFound(_0x274e48,null))[_0x185e('0x11')](function(_0x3e8497){if(!_0x3e8497)throw new Error(_0x185e('0x68'));if(_0x3e8497[_0x185e('0x3b')])delete _0xf94e57[_0x185e('0x65')]['Imap'];return _0x3e8497;})['then'](saveUpdates(_0xf94e57[_0x185e('0x65')],null))[_0x185e('0x11')](function(_0x3afdf8){if(!_0xf94e57[_0x185e('0x65')]['Imap'])return _0x3afdf8;return db['MailServerIn'][_0x185e('0x64')](_0xf94e57['body']['Imap'],{'where':{'MailAccountId':_0x3afdf8['id']}})[_0x185e('0x11')](function(){return _0x3afdf8;});})[_0x185e('0x11')](function(_0x2d70ee){if(!_0xf94e57['body'][_0x185e('0x3e')])return _0x2d70ee;return db['MailServerOut'][_0x185e('0x64')](_0xf94e57[_0x185e('0x65')][_0x185e('0x3e')],{'where':{'MailAccountId':_0x2d70ee['id']}})[_0x185e('0x11')](function(){return _0x2d70ee;});})[_0x185e('0x11')](respondWithResult(_0x274e48,null))[_0x185e('0x5f')](handleError(_0x274e48,null));};exports[_0x185e('0x69')]=function(_0x4ff1f3,_0xfe907b){return db['MailAccount'][_0x185e('0x69')]()['then'](respondWithResult(_0xfe907b,null))['catch'](handleError(_0xfe907b,null));};exports[_0x185e('0x6a')]=function(_0x14321d,_0x5f49bb){if(_0x14321d['body']['id']){delete _0x14321d['body']['id'];}return db[_0x185e('0x44')][_0x185e('0x63')]({'where':{'id':_0x14321d[_0x185e('0x61')]['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x5f49bb,null))[_0x185e('0x11')](function(_0x1ad134){if(_0x1ad134){_0x14321d[_0x185e('0x65')][_0x185e('0x6b')]=_0x1ad134['id'];return db[_0x185e('0x6c')][_0x185e('0x6d')](_0x14321d[_0x185e('0x65')]);}})['then'](respondWithResult(_0x5f49bb,null))['catch'](handleError(_0x5f49bb,null));};exports[_0x185e('0x6e')]=function(_0x12a0e2,_0x5dab4){var _0x2bd35c={'raw':![],'where':{}};var _0x25cf44={};var _0x3f5be1={'count':0x0,'rows':[]};return db['MailAccount'][_0x185e('0x6f')]({'where':{'id':_0x12a0e2[_0x185e('0x61')]['id']}})['then'](handleEntityNotFound(_0x5dab4,null))['then'](function(_0x58e9b2){if(_0x58e9b2){_0x25cf44['model']=_['keys'](db[_0x185e('0x6c')][_0x185e('0x45')]);_0x25cf44[_0x185e('0x49')]=_[_0x185e('0x4a')](_0x12a0e2['query']);_0x25cf44['filters']=_['intersection'](_0x25cf44[_0x185e('0x4d')],_0x25cf44[_0x185e('0x49')]);_0x2bd35c['attributes']=_['intersection'](_0x25cf44[_0x185e('0x4d')],qs[_0x185e('0x4f')](_0x12a0e2[_0x185e('0x49')]['fields']));_0x2bd35c[_0x185e('0x4e')]=_0x2bd35c[_0x185e('0x4e')][_0x185e('0x50')]?_0x2bd35c['attributes']:_0x25cf44[_0x185e('0x4d')];if(!_0x12a0e2['query'][_0x185e('0x51')](_0x185e('0x52'))){_0x2bd35c['limit']=qs[_0x185e('0x1e')](_0x12a0e2[_0x185e('0x49')][_0x185e('0x1e')]);_0x2bd35c['offset']=qs[_0x185e('0x53')](_0x12a0e2[_0x185e('0x49')][_0x185e('0x53')]);}_0x2bd35c[_0x185e('0x54')]=qs[_0x185e('0x55')](_0x12a0e2[_0x185e('0x49')][_0x185e('0x55')]);_0x2bd35c[_0x185e('0x56')]=qs[_0x185e('0x4b')](_[_0x185e('0x57')](_0x12a0e2['query'],_0x25cf44['filters']));_0x2bd35c[_0x185e('0x56')][_0x185e('0x6b')]=_0x58e9b2['id'];if(_0x12a0e2[_0x185e('0x49')][_0x185e('0x58')]){_0x2bd35c[_0x185e('0x56')]=_[_0x185e('0x59')](_0x2bd35c[_0x185e('0x56')],{'$or':_[_0x185e('0x43')](_0x2bd35c[_0x185e('0x4e')],function(_0x1e78b7){var _0x4a73f8={};_0x4a73f8[_0x1e78b7]={'$like':'%'+_0x12a0e2[_0x185e('0x49')][_0x185e('0x58')]+'%'};return _0x4a73f8;})});}_0x2bd35c=_['merge']({},_0x2bd35c,_0x12a0e2['options']);return db[_0x185e('0x6c')][_0x185e('0x1f')]({'where':_0x2bd35c['where']})[_0x185e('0x11')](function(_0x5cd230){_0x3f5be1[_0x185e('0x1f')]=_0x5cd230;if(_0x12a0e2[_0x185e('0x49')][_0x185e('0x5c')]){_0x2bd35c['include']=[{'all':!![]}];}return db[_0x185e('0x6c')]['findAll'](_0x2bd35c);})[_0x185e('0x11')](function(_0x4e1c21){_0x3f5be1[_0x185e('0x5e')]=_0x4e1c21;return _0x3f5be1;});}})[_0x185e('0x11')](respondWithFilteredResult(_0x5dab4,_0x2bd35c))['catch'](handleError(_0x5dab4,null));};exports[_0x185e('0x70')]=function(_0x4ff275,_0x531a96){return db[_0x185e('0x44')][_0x185e('0x63')]({'where':{'id':_0x4ff275[_0x185e('0x61')]['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x531a96,null))[_0x185e('0x11')](function(_0x227c6c){if(_0x227c6c){return _0x227c6c[_0x185e('0x70')](_0x4ff275[_0x185e('0x49')][_0x185e('0x71')]);}})[_0x185e('0x11')](respondWithStatusCode(_0x531a96,null))['catch'](handleError(_0x531a96,null));};exports[_0x185e('0x72')]=function(_0x375d72,_0x1640d3){if(_0x375d72[_0x185e('0x65')]['id']){delete _0x375d72['body']['id'];}return db[_0x185e('0x44')][_0x185e('0x63')]({'where':{'id':_0x375d72[_0x185e('0x61')]['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x1640d3,null))[_0x185e('0x11')](function(_0x2583b6){if(_0x2583b6){_0x375d72[_0x185e('0x65')]['MailAccountId']=_0x2583b6['id'];return db[_0x185e('0x73')][_0x185e('0x6d')](_0x375d72[_0x185e('0x65')]);}})[_0x185e('0x11')](respondWithResult(_0x1640d3,null))[_0x185e('0x5f')](handleError(_0x1640d3,null));};exports['getAnswers']=function(_0x12aa99,_0x223b5d){var _0x56405f={'raw':![],'where':{}};var _0x21f6ed={};var _0x2bff15={'count':0x0,'rows':[]};return db[_0x185e('0x44')]['findOne']({'where':{'id':_0x12aa99[_0x185e('0x61')]['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x223b5d,null))[_0x185e('0x11')](function(_0x579d1e){if(_0x579d1e){_0x21f6ed[_0x185e('0x4d')]=_[_0x185e('0x4a')](db[_0x185e('0x73')]['rawAttributes']);_0x21f6ed['query']=_[_0x185e('0x4a')](_0x12aa99[_0x185e('0x49')]);_0x21f6ed['filters']=_[_0x185e('0x4c')](_0x21f6ed[_0x185e('0x4d')],_0x21f6ed[_0x185e('0x49')]);_0x56405f[_0x185e('0x4e')]=_[_0x185e('0x4c')](_0x21f6ed['model'],qs[_0x185e('0x4f')](_0x12aa99['query'][_0x185e('0x4f')]));_0x56405f[_0x185e('0x4e')]=_0x56405f[_0x185e('0x4e')][_0x185e('0x50')]?_0x56405f[_0x185e('0x4e')]:_0x21f6ed['model'];if(!_0x12aa99['query'][_0x185e('0x51')](_0x185e('0x52'))){_0x56405f[_0x185e('0x1e')]=qs[_0x185e('0x1e')](_0x12aa99[_0x185e('0x49')][_0x185e('0x1e')]);_0x56405f[_0x185e('0x53')]=qs['offset'](_0x12aa99[_0x185e('0x49')][_0x185e('0x53')]);}_0x56405f[_0x185e('0x54')]=qs[_0x185e('0x55')](_0x12aa99['query']['sort']);_0x56405f[_0x185e('0x56')]=qs['filters'](_[_0x185e('0x57')](_0x12aa99[_0x185e('0x49')],_0x21f6ed[_0x185e('0x4b')]));_0x56405f[_0x185e('0x56')][_0x185e('0x6b')]=_0x579d1e['id'];if(_0x12aa99['query'][_0x185e('0x58')]){_0x56405f[_0x185e('0x56')]=_[_0x185e('0x59')](_0x56405f['where'],{'$or':_[_0x185e('0x43')](_0x56405f[_0x185e('0x4e')],function(_0x1daffa){var _0x48ee69={};_0x48ee69[_0x1daffa]={'$like':'%'+_0x12aa99['query']['filter']+'%'};return _0x48ee69;})});}_0x56405f=_[_0x185e('0x59')]({},_0x56405f,_0x12aa99[_0x185e('0x5b')]);return db[_0x185e('0x73')][_0x185e('0x1f')]({'where':_0x56405f[_0x185e('0x56')]})[_0x185e('0x11')](function(_0x3c9a1d){_0x2bff15[_0x185e('0x1f')]=_0x3c9a1d;if(_0x12aa99['query']['includeAll']){_0x56405f[_0x185e('0x5d')]=[{'all':!![]}];}return db[_0x185e('0x73')]['findAll'](_0x56405f);})[_0x185e('0x11')](function(_0x3b56d2){_0x2bff15[_0x185e('0x5e')]=_0x3b56d2;return _0x2bff15;});}})[_0x185e('0x11')](respondWithFilteredResult(_0x223b5d,_0x56405f))[_0x185e('0x5f')](handleError(_0x223b5d,null));};exports[_0x185e('0x74')]=function(_0x1172b1,_0x3cdace){return db[_0x185e('0x44')][_0x185e('0x63')]({'where':{'id':_0x1172b1[_0x185e('0x61')]['id']}})['then'](handleEntityNotFound(_0x3cdace,null))[_0x185e('0x11')](function(_0x5160a7){if(_0x5160a7){return _0x5160a7['removeAnswers'](_0x1172b1[_0x185e('0x49')][_0x185e('0x71')]);}})[_0x185e('0x11')](respondWithStatusCode(_0x3cdace,null))['catch'](handleError(_0x3cdace,null));};exports[_0x185e('0x6d')]=function(_0x2ce86d,_0x2f74b9){var _0x22d7b2={'name':_0x2ce86d[_0x185e('0x65')][_0x185e('0x27')],'key':_0x2ce86d['body'][_0x185e('0x48')],'provider':_0x2ce86d['body'][_0x185e('0x66')]===_0x185e('0x67')?null:_0x2ce86d[_0x185e('0x65')][_0x185e('0x66')],'email':_0x2ce86d[_0x185e('0x65')][_0x185e('0x75')],'ListId':_0x2ce86d['body'][_0x185e('0x76')],'active':!_[_0x185e('0x77')](_0x2ce86d[_0x185e('0x65')][_0x185e('0x78')])?_0x2ce86d[_0x185e('0x65')]['active']:!![],'description':_0x2ce86d[_0x185e('0x65')]['description']||null};var _0xb9deb0=getAuthenticationOptions(_0x22d7b2[_0x185e('0x66')],_0x2ce86d['body']);_0x22d7b2['Imap']=_0xb9deb0[_0x185e('0x3d')];_0x22d7b2[_0x185e('0x3e')]=_0xb9deb0[_0x185e('0x3e')];return db['MailAccount'][_0x185e('0x6d')](_0x22d7b2,{'include':[{'model':db['MailServerOut'],'as':_0x185e('0x3e')},{'model':db[_0x185e('0x40')],'as':_0x185e('0x3d')}]})[_0x185e('0x11')](function(_0x2522dc){var _0xb84357=_0x2ce86d[_0x185e('0x32')][_0x185e('0x23')]({'plain':!![]});if(!_0xb84357)throw new Error(_0x185e('0x79'));if(_0xb84357['role']==='user'){var _0x510c0d=_0x2522dc['get']({'plain':!![]});return db[_0x185e('0x7a')][_0x185e('0x63')]({'where':{'name':_0x185e('0x7b'),'userProfileId':_0xb84357[_0x185e('0x7c')]},'raw':!![]})[_0x185e('0x11')](function(_0x1c5499){if(_0x1c5499&&_0x1c5499['autoAssociation']===0x0){return db['UserProfileResource'][_0x185e('0x6d')]({'name':_0x510c0d['name'],'resourceId':_0x510c0d['id'],'type':_0x1c5499[_0x185e('0x27')],'sectionId':_0x1c5499['id']},{})['then'](function(){return _0x2522dc;});}else{return _0x2522dc;}})['catch'](function(_0x4eaa7d){logger[_0x185e('0x16')](_0x185e('0x7d'),_0x4eaa7d);throw _0x4eaa7d;});}return _0x2522dc;})[_0x185e('0x11')](respondWithResult(_0x2f74b9,0xc9))['catch'](handleError(_0x2f74b9,null));};exports[_0x185e('0x7e')]=function(_0x39e3b9,_0x19cfea){return db[_0x185e('0x44')][_0x185e('0x6f')]({'where':{'id':_0x39e3b9['params']['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x19cfea,null))[_0x185e('0x11')](function(_0x5dcc28){if(_0x5dcc28){return _0x5dcc28[_0x185e('0x7e')]();}return null;})['then'](respondWithResult(_0x19cfea,null))[_0x185e('0x5f')](handleError(_0x19cfea,null));};exports['addImap']=function(_0x294e74,_0x1cc52){if(_0x294e74[_0x185e('0x65')]['id']){delete _0x294e74['body']['id'];}return db[_0x185e('0x44')][_0x185e('0x63')]({'where':{'id':_0x294e74[_0x185e('0x61')]['id']}})['then'](handleEntityNotFound(_0x1cc52,null))['then'](function(_0xfb1db){if(_0xfb1db){_0x294e74[_0x185e('0x65')][_0x185e('0x6b')]=_0xfb1db['id'];return db[_0x185e('0x40')][_0x185e('0x6d')](_0x294e74['body']);}})[_0x185e('0x11')](respondWithResult(_0x1cc52,null))['catch'](handleError(_0x1cc52,null));};exports[_0x185e('0x7f')]=function(_0x53d21b,_0x544a20){return db[_0x185e('0x44')][_0x185e('0x6f')]({'where':{'id':_0x53d21b[_0x185e('0x61')]['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x544a20,null))[_0x185e('0x11')](function(_0x3a3f91){if(_0x3a3f91){return _0x3a3f91[_0x185e('0x80')](null);}return null;})[_0x185e('0x11')](respondWithStatusCode(_0x544a20,null))[_0x185e('0x5f')](handleError(_0x544a20,null));};exports['getSmtp']=function(_0xf60987,_0x577040){return db[_0x185e('0x44')][_0x185e('0x6f')]({'where':{'id':_0xf60987[_0x185e('0x61')]['id']}})['then'](handleEntityNotFound(_0x577040,null))['then'](function(_0x12f5fb){if(_0x12f5fb){return _0x12f5fb['getSmtp']();}return null;})[_0x185e('0x11')](respondWithResult(_0x577040,null))['catch'](handleError(_0x577040,null));};exports[_0x185e('0x81')]=function(_0x5a8c1e,_0x538150){if(_0x5a8c1e[_0x185e('0x65')]['id']){delete _0x5a8c1e['body']['id'];}return db[_0x185e('0x44')][_0x185e('0x63')]({'where':{'id':_0x5a8c1e['params']['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x538150,null))[_0x185e('0x11')](function(_0x16ebb9){if(_0x16ebb9){_0x5a8c1e[_0x185e('0x65')]['MailAccountId']=_0x16ebb9['id'];return db[_0x185e('0x41')][_0x185e('0x6d')](_0x5a8c1e[_0x185e('0x65')]);}})[_0x185e('0x11')](respondWithResult(_0x538150,null))[_0x185e('0x5f')](handleError(_0x538150,null));};exports[_0x185e('0x82')]=function(_0x55cfcc,_0x4a59ca){return db[_0x185e('0x44')][_0x185e('0x6f')]({'where':{'id':_0x55cfcc[_0x185e('0x61')]['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x4a59ca,null))[_0x185e('0x11')](function(_0x1bd0eb){if(_0x1bd0eb){return _0x1bd0eb['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x4a59ca,null))['catch'](handleError(_0x4a59ca,null));};exports['addInteraction']=function(_0x212174,_0x2d6135){return db[_0x185e('0x83')]['find']({'where':{'id':_0x212174[_0x185e('0x61')]['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x2d6135,null))['then'](function(_0x12db9d){if(_0x12db9d){return _0x12db9d[_0x185e('0x84')](_0x212174[_0x185e('0x65')]['ids'],_[_0x185e('0x85')](_0x212174['body'],[_0x185e('0x71'),'id'])||{});}})['then'](respondWithResult(_0x2d6135,null))[_0x185e('0x5f')](handleError(_0x2d6135,null));};exports[_0x185e('0x86')]=function(_0x359f42,_0x107971){var _0x14cb71={'raw':![],'where':{}};var _0x550d3f={};var _0x57022e={'count':0x0,'rows':[]};return db[_0x185e('0x44')][_0x185e('0x6f')]({'where':{'id':_0x359f42[_0x185e('0x61')]['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x107971,null))['then'](function(_0x22d5b6){if(_0x22d5b6){_0x550d3f['model']=_['keys'](db['MailInteraction']['rawAttributes']);_0x550d3f[_0x185e('0x49')]=_[_0x185e('0x4a')](_0x359f42[_0x185e('0x49')]);_0x550d3f['filters']=_[_0x185e('0x4c')](_0x550d3f[_0x185e('0x4d')],_0x550d3f[_0x185e('0x49')]);_0x14cb71[_0x185e('0x4e')]=_['intersection'](_0x550d3f[_0x185e('0x4d')],qs['fields'](_0x359f42[_0x185e('0x49')][_0x185e('0x4f')]));_0x14cb71['attributes']=_0x14cb71[_0x185e('0x4e')]['length']?_0x14cb71[_0x185e('0x4e')]:_0x550d3f['model'];if(!_0x359f42[_0x185e('0x49')]['hasOwnProperty'](_0x185e('0x52'))){_0x14cb71['limit']=qs[_0x185e('0x1e')](_0x359f42['query'][_0x185e('0x1e')]);_0x14cb71['offset']=qs['offset'](_0x359f42['query'][_0x185e('0x53')]);}_0x14cb71[_0x185e('0x54')]=qs[_0x185e('0x55')](_0x359f42[_0x185e('0x49')][_0x185e('0x55')]);_0x14cb71[_0x185e('0x56')]=qs[_0x185e('0x4b')](_[_0x185e('0x57')](_0x359f42[_0x185e('0x49')],_0x550d3f[_0x185e('0x4b')]));_0x14cb71[_0x185e('0x56')][_0x185e('0x6b')]=_0x22d5b6['id'];if(_0x359f42[_0x185e('0x49')][_0x185e('0x58')]){_0x14cb71[_0x185e('0x56')]=_['merge'](_0x14cb71['where'],{'$or':_[_0x185e('0x43')](_0x14cb71['attributes'],function(_0xb1dc3e){var _0x5bb252={};_0x5bb252[_0xb1dc3e]={'$like':'%'+_0x359f42[_0x185e('0x49')][_0x185e('0x58')]+'%'};return _0x5bb252;})});}_0x14cb71=_[_0x185e('0x59')]({},_0x14cb71,_0x359f42[_0x185e('0x5b')]);return db[_0x185e('0x83')]['count']({'where':_0x14cb71[_0x185e('0x56')]})[_0x185e('0x11')](function(_0x41c8df){_0x57022e[_0x185e('0x1f')]=_0x41c8df;if(_0x359f42[_0x185e('0x49')]['includeAll']){_0x14cb71[_0x185e('0x5d')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x185e('0x87')],'as':_0x185e('0x88'),'attributes':[_0x185e('0x27'),_0x185e('0x89'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x185e('0x8a'),'attributes':['id',_0x185e('0x27'),_0x185e('0x8b')],'where':_0x359f42[_0x185e('0x49')][_0x185e('0x8c')]?{'id':_0x359f42['query'][_0x185e('0x8c')]}:undefined,'required':_0x359f42['query'][_0x185e('0x8c')]?!![]:![]}];}return db[_0x185e('0x83')][_0x185e('0x8d')](_0x14cb71);})[_0x185e('0x11')](function(_0x31be71){_0x57022e['rows']=_0x31be71;return _0x57022e;});}})[_0x185e('0x11')](respondWithFilteredResult(_0x107971,_0x14cb71))[_0x185e('0x5f')](handleError(_0x107971,null));};exports[_0x185e('0x8e')]=function addApplications(_0x49788e,_0x198507){var _0x462c81=_0x49788e['params']['id'];var _0xe9e09d=_0x49788e[_0x185e('0x65')];var _0x6ef12e=0xc8;var _0x202813=null;return db[_0x185e('0x8f')][_0x185e('0x90')]({'isolationLevel':db[_0x185e('0x8f')]['Transaction'][_0x185e('0x91')][_0x185e('0x92')]},function(_0x1ac310){return db['MailAccount'][_0x185e('0x6f')]({'where':{'id':_0x462c81},'transaction':_0x1ac310})[_0x185e('0x11')](function(_0x29a9f0){if(_0x29a9f0){return db['MailApplication'][_0x185e('0x22')]({'where':{'MailAccountId':_0x462c81},'transaction':_0x1ac310})[_0x185e('0x11')](function(){var _0xd20726=_[_0x185e('0x43')](_0xe9e09d,function(_0x13b06d){_0x13b06d['MailAccountId']=_0x462c81;return _0x13b06d;});return db[_0x185e('0x93')][_0x185e('0x94')](_0xd20726,{'transaction':_0x1ac310});});}else{_0x6ef12e=0x194;_0x202813=[];}});})[_0x185e('0x11')](function(){if(_0x6ef12e!==0x194){return db['MailApplication'][_0x185e('0x95')]({'where':{'MailAccountId':_0x462c81},'order':'priority'})[_0x185e('0x11')](function(_0x31a285){_0x202813=_0x31a285;});}})['catch'](function(_0xd210e0){_0x6ef12e=0x1f4;logger[_0x185e('0x16')](_0xd210e0['stack']);if(_0xd210e0['name']){delete _0xd210e0[_0x185e('0x27')];}_0x202813=_0xd210e0;})[_0x185e('0x96')](function(){if(_0x202813===null){_0x198507[_0x185e('0x1a')](_0x6ef12e);}else{if(_0x6ef12e===0x1f4){_0x198507[_0x185e('0x1b')](_0x6ef12e)[_0x185e('0x97')](_0x202813);}else{_0x198507[_0x185e('0x1b')](_0x6ef12e)[_0x185e('0x1c')](_0x202813);}}});};exports[_0x185e('0x98')]=function(_0x234eed,_0x3977ad){var _0x591ba1={};var _0x186945={};var _0x78880e;var _0x3bf1da;return db[_0x185e('0x44')][_0x185e('0x6f')]({'where':{'id':_0x234eed[_0x185e('0x61')]['id']}})['then'](handleEntityNotFound(_0x3977ad,null))[_0x185e('0x11')](function(_0x5ad0fa){if(_0x5ad0fa){_0x78880e=_0x5ad0fa;_0x186945[_0x185e('0x4d')]=_[_0x185e('0x4a')](db['MailApplication'][_0x185e('0x45')]);_0x186945[_0x185e('0x49')]=_[_0x185e('0x4a')](_0x234eed[_0x185e('0x49')]);_0x186945[_0x185e('0x4b')]=_[_0x185e('0x4c')](_0x186945[_0x185e('0x4d')],_0x186945[_0x185e('0x49')]);_0x591ba1[_0x185e('0x4e')]=_[_0x185e('0x4c')](_0x186945[_0x185e('0x4d')],qs[_0x185e('0x4f')](_0x234eed['query'][_0x185e('0x4f')]));_0x591ba1[_0x185e('0x4e')]=_0x591ba1[_0x185e('0x4e')][_0x185e('0x50')]?_0x591ba1[_0x185e('0x4e')]:_0x186945[_0x185e('0x4d')];_0x591ba1['order']=qs[_0x185e('0x55')](_0x234eed[_0x185e('0x49')][_0x185e('0x55')]);_0x591ba1[_0x185e('0x56')]=qs[_0x185e('0x4b')](_[_0x185e('0x57')](_0x234eed[_0x185e('0x49')],_0x186945[_0x185e('0x4b')]));if(_0x234eed[_0x185e('0x49')][_0x185e('0x58')]){_0x591ba1[_0x185e('0x56')]=_[_0x185e('0x59')](_0x591ba1[_0x185e('0x56')],{'$or':_[_0x185e('0x43')](_0x591ba1[_0x185e('0x4e')],function(_0xfc558b){var _0x45a026={};_0x45a026[_0xfc558b]={'$like':'%'+_0x234eed['query'][_0x185e('0x58')]+'%'};return _0x45a026;})});}_0x591ba1=_['merge']({},_0x591ba1,_0x234eed[_0x185e('0x5b')]);return _0x78880e[_0x185e('0x98')](_0x591ba1);}})[_0x185e('0x11')](function(_0x117d03){if(_0x117d03){_0x3bf1da=_0x117d03['length'];if(!_0x234eed[_0x185e('0x49')][_0x185e('0x51')](_0x185e('0x52'))){_0x591ba1['limit']=qs[_0x185e('0x1e')](_0x234eed[_0x185e('0x49')][_0x185e('0x1e')]);_0x591ba1[_0x185e('0x53')]=qs[_0x185e('0x53')](_0x234eed[_0x185e('0x49')][_0x185e('0x53')]);}return _0x78880e['getApplications'](_0x591ba1);}})[_0x185e('0x11')](function(_0x2be3a9){if(_0x2be3a9){return _0x2be3a9?{'count':_0x3bf1da,'rows':_0x2be3a9}:null;}})[_0x185e('0x11')](respondWithResult(_0x3977ad,null))[_0x185e('0x5f')](handleError(_0x3977ad,null));};exports[_0x185e('0x99')]=function(_0x3077ca,_0x156f48){var _0x12b428={'raw':!![],'where':{}};var _0x1528f4={};var _0x3d44bf={'count':0x0,'rows':[]};return db['MailAccount'][_0x185e('0x6f')]({'where':{'id':_0x3077ca[_0x185e('0x61')]['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x156f48,null))['then'](function(_0x33c021){if(_0x33c021){_0x1528f4[_0x185e('0x4d')]=_['keys'](db[_0x185e('0x9a')][_0x185e('0x45')]);_0x1528f4[_0x185e('0x49')]=_[_0x185e('0x4a')](_0x3077ca[_0x185e('0x49')]);_0x1528f4[_0x185e('0x4b')]=_[_0x185e('0x4c')](_0x1528f4['model'],_0x1528f4['query']);_0x12b428['attributes']=_['intersection'](_0x1528f4['model'],qs[_0x185e('0x4f')](_0x3077ca[_0x185e('0x49')][_0x185e('0x4f')]));_0x12b428['attributes']=_0x12b428[_0x185e('0x4e')]['length']?_0x12b428[_0x185e('0x4e')]:_0x1528f4['model'];if(!_0x3077ca[_0x185e('0x49')][_0x185e('0x51')](_0x185e('0x52'))){_0x12b428[_0x185e('0x1e')]=qs[_0x185e('0x1e')](_0x3077ca[_0x185e('0x49')]['limit']);_0x12b428[_0x185e('0x53')]=qs[_0x185e('0x53')](_0x3077ca[_0x185e('0x49')]['offset']);}_0x12b428['order']=qs[_0x185e('0x55')](_0x3077ca[_0x185e('0x49')]['sort']);_0x12b428[_0x185e('0x56')]=qs[_0x185e('0x4b')](_[_0x185e('0x57')](_0x3077ca[_0x185e('0x49')],_0x1528f4[_0x185e('0x4b')]));_0x12b428[_0x185e('0x56')][_0x185e('0x6b')]=_0x33c021['id'];if(_0x3077ca[_0x185e('0x49')][_0x185e('0x58')]){_0x12b428['where']=_[_0x185e('0x59')](_0x12b428[_0x185e('0x56')],{'$or':_[_0x185e('0x43')](_0x12b428[_0x185e('0x4e')],function(_0x1599c1){var _0x377bbc={};_0x377bbc[_0x1599c1]={'$like':'%'+_0x3077ca['query'][_0x185e('0x58')]+'%'};return _0x377bbc;})});}if(_0x3077ca[_0x185e('0x49')][_0x185e('0x9b')]){var _0x5b61b2=_0x3077ca[_0x185e('0x49')][_0x185e('0x9b')][_0x185e('0x9c')](',');var _0x311d08={};_0x311d08[_0x5b61b2[0x0]]={'$gte':moment(_0x5b61b2[0x1])[_0x185e('0x9d')](_0x185e('0x9e'))};_0x12b428[_0x185e('0x56')]=_['merge'](_0x12b428[_0x185e('0x56')],_0x311d08);}_0x12b428=_[_0x185e('0x59')]({},_0x12b428,_0x3077ca[_0x185e('0x5b')]);return db[_0x185e('0x9a')][_0x185e('0x1f')]({'where':_0x12b428[_0x185e('0x56')]})[_0x185e('0x11')](function(_0x230f3e){_0x3d44bf[_0x185e('0x1f')]=_0x230f3e;if(_0x3077ca[_0x185e('0x49')]['includeAll']){_0x12b428[_0x185e('0x5d')]=[{'all':!![]}];}return db['MailMessage'][_0x185e('0x8d')](_0x12b428);})['then'](function(_0x11c9e2){if(_0x3077ca[_0x185e('0x49')][_0x185e('0x9f')]===_0x185e('0xa0')){for(var _0x382e9d=0x0;_0x382e9d<_0x11c9e2[_0x185e('0x50')];_0x382e9d++){_0x11c9e2[_0x382e9d][_0x185e('0x65')]=juice(_0x11c9e2[_0x382e9d][_0x185e('0x65')]);}}_0x3d44bf[_0x185e('0x5e')]=_0x11c9e2;return _0x3d44bf;});}})['then'](respondWithFilteredResult(_0x156f48,_0x12b428))[_0x185e('0x5f')](handleError(_0x156f48,null));};exports['send']=function(_0x5852e3,_0x19eb7b){var _0x54f38a,_0x4f5907={},_0x1e87f3;if(_0x5852e3[_0x185e('0x65')]['to']){_0x1e87f3=_0x5852e3[_0x185e('0x65')]['to'][_0x185e('0x9c')](',')[0x0];}return db[_0x185e('0x44')][_0x185e('0x63')]({'where':{'id':_0x5852e3['params']['id']},'include':[{'model':db[_0x185e('0xa1')],'as':_0x185e('0xa2'),'include':[{'model':db[_0x185e('0xa3')],'as':_0x185e('0xa4'),'where':{'email':_0x1e87f3},'limit':0x1,'order':[[_0x185e('0xa5'),_0x185e('0xa6')]]}]},{'model':db[_0x185e('0x41')],'as':_0x185e('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x185e('0xa7'),'raw':!![]}]}]})[_0x185e('0x11')](handleEntityNotFound(_0x19eb7b,null))[_0x185e('0x11')](function(_0x567e48){if(!_0x567e48)return;_0x54f38a=_0x567e48;if(!_0x567e48[_0x185e('0x3e')])throw new Error(_0x185e('0xa8'));if(_[_0x185e('0x77')](_0x5852e3['body'][_0x185e('0xa9')])){_0x5852e3[_0x185e('0x65')][_0x185e('0xa9')]=util[_0x185e('0x9d')](_0x185e('0xaa'),_0x567e48['name'],_0x567e48['email']||_0x567e48[_0x185e('0x3e')]['user']);}if(_0x5852e3[_0x185e('0x65')][_0x185e('0xab')]&&_0x5852e3[_0x185e('0x65')][_0x185e('0xab')][_0x185e('0x50')]){for(var _0x54a754=0x0;_0x54a754<_0x5852e3[_0x185e('0x65')]['attachments']['length'];_0x54a754+=0x1){_0x5852e3[_0x185e('0x65')][_0x185e('0xab')][_0x54a754]={'filename':_0x5852e3[_0x185e('0x65')]['attachments'][_0x54a754][_0x185e('0x27')],'path':path['join'](config['root'],_0x185e('0xac'),_0x5852e3[_0x185e('0x65')][_0x185e('0xab')][_0x54a754]['basename'])};}}var _0x4e16d6=_0x567e48[_0x185e('0xad')]();return respondWithRpcPromise(_0x185e('0xae'),_0x185e('0xaf'),{'account':_0x4e16d6,'message':_0x5852e3[_0x185e('0x65')]});})['then'](function(_0x1c1a98){if(!_0x1c1a98)return;_0x4f5907=_0x1c1a98;if(!_0x54f38a[_0x185e('0xa2')])throw new Error('List\x20not\x20found');if(_0x54f38a[_0x185e('0xa2')][_0x185e('0xa4')][_0x185e('0x50')])return _0x54f38a[_0x185e('0xa2')][_0x185e('0xa4')][0x0];return db[_0x185e('0xa3')][_0x185e('0x6d')](_[_0x185e('0xb')](_0x5852e3[_0x185e('0x65')],{'firstName':_0x5852e3[_0x185e('0x65')]['to'],'email':_0x5852e3[_0x185e('0x65')]['to'],'phone':_0x5852e3['body']['to'],'ListId':_0x54f38a[_0x185e('0x76')]}));})[_0x185e('0x11')](function(_0x5d2abd){if(!_0x5d2abd)return;var _0x26ea30={'UserId':_0x5852e3[_0x185e('0x32')]['id'],'ContactId':_0x5d2abd['id'],'MailAccountId':_0x54f38a['id'],'inReplyTo':_0x4f5907[_0x185e('0xb0')],'to':_0x5852e3[_0x185e('0x65')][_0x185e('0xa9')],'cc':_0x5852e3[_0x185e('0x65')]['cc'],'subject':_0x5852e3[_0x185e('0x65')][_0x185e('0xb1')],'attach':_0x5852e3[_0x185e('0x65')][_0x185e('0xb2')],'firstMsgDirection':_0x185e('0xb3'),'lastMsgAt':moment()[_0x185e('0x9d')](_0x185e('0x9e')),'lastMsgDirection':_0x185e('0xb3'),'Messages':[_[_0x185e('0x59')](_0x5852e3['body'],{'messageId':_0x4f5907[_0x185e('0xb0')],'sentAt':moment()[_0x185e('0x9d')](_0x185e('0x9e')),'read':!![],'MailAccountId':_0x54f38a['id'],'UserId':_0x5852e3[_0x185e('0x32')]['id'],'ContactId':_0x5d2abd['id']})]};if(_0x5852e3[_0x185e('0x65')][_0x185e('0xb4')]){_0x26ea30=_[_0x185e('0x59')](_0x26ea30,_0x5852e3['body'][_0x185e('0xb4')]);}return db[_0x185e('0x83')][_0x185e('0x6d')](_0x26ea30,{'include':[{'model':db['MailMessage'],'as':_0x185e('0xb5')}]});})[_0x185e('0x11')](respondWithResult(_0x19eb7b,null))[_0x185e('0x5f')](handleError(_0x19eb7b,null));};exports[_0x185e('0xb6')]=function(_0x31c17e,_0x5211b0){return db[_0x185e('0x44')][_0x185e('0x63')]({'where':{'id':_0x31c17e[_0x185e('0x61')]['id']},'include':[{'model':db[_0x185e('0x41')],'as':_0x185e('0x3e'),'raw':!![],'include':[{'model':db[_0x185e('0xa7')],'as':_0x185e('0xa7'),'raw':!![]}]}]})[_0x185e('0x11')](handleEntityNotFound(_0x5211b0,null))[_0x185e('0x11')](function(_0x401a93){if(!_0x401a93[_0x185e('0x3e')])return;var _0x119a79=_0x401a93['getSmtpOptions']();return respondWithRpcPromise(_0x185e('0xb7'),_0x185e('0xb6'),{'account':_0x119a79});})['then'](respondWithResult(_0x5211b0,null))[_0x185e('0x5f')](handleError(_0x5211b0,null));};exports[_0x185e('0x22')]=function(_0x192ebc,_0x2efe58){return db['MailAccount'][_0x185e('0x63')]({'where':{'id':_0x192ebc['params']['id']}})['then'](handleEntityNotFound(_0x2efe58,null))['then'](function(_0x58cd6f){if(_0x58cd6f&&_0x58cd6f[_0x185e('0x3b')]){throw new db[(_0x185e('0xb8'))]['ValidationError'](_0x185e('0xb9'));}return _0x58cd6f;})[_0x185e('0x11')](removeEntity(_0x2efe58,null))[_0x185e('0x5f')](handleError(_0x2efe58,null));};exports[_0x185e('0xba')]=function(_0x545d62,_0x4757c1){return db[_0x185e('0x44')][_0x185e('0x63')]({'where':{'id':_0x545d62['params']['id']}})['then'](handleEntityNotFound(_0x4757c1,null))[_0x185e('0x11')](function(_0xe75d71){if(_0xe75d71){return _0xe75d71[_0x185e('0xba')](_0x545d62['body'][_0x185e('0x71')],_[_0x185e('0x85')](_0x545d62[_0x185e('0x65')],['ids','id'])||{})['spread'](function(_0x26adeb){for(var _0xe99bce=0x0;_0xe99bce<_0x545d62['body']['ids'][_0x185e('0x50')];_0xe99bce+=0x1){socket[_0x185e('0xbb')](_0x185e('0xbc'),{'UserId':Number(_0x545d62[_0x185e('0x65')][_0x185e('0x71')][_0xe99bce]),'MailAccountId':Number(_0x545d62[_0x185e('0x61')]['id'])});}return _0x26adeb;});}})['then'](respondWithResult(_0x4757c1,null))[_0x185e('0x5f')](handleError(_0x4757c1,null));};exports[_0x185e('0xbd')]=function(_0x55aa03,_0x56b2f6){return db['MailAccount'][_0x185e('0x63')]({'where':{'id':_0x55aa03[_0x185e('0x61')]['id']}})[_0x185e('0x11')](handleEntityNotFound(_0x56b2f6,null))[_0x185e('0x11')](function(_0x183ac9){if(_0x183ac9){return _0x183ac9[_0x185e('0xbd')](_0x55aa03[_0x185e('0x49')][_0x185e('0x71')])[_0x185e('0x11')](function(){if(_['isArray'](_0x55aa03['query'][_0x185e('0x71')])){for(var _0x5ea9da=0x0;_0x5ea9da<_0x55aa03[_0x185e('0x49')][_0x185e('0x71')][_0x185e('0x50')];_0x5ea9da+=0x1){socket['emit'](_0x185e('0xbe'),{'UserId':Number(_0x55aa03['query'][_0x185e('0x71')][_0x5ea9da]),'MailAccountId':Number(_0x55aa03[_0x185e('0x61')]['id'])});}}else{socket[_0x185e('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x55aa03['query']['ids']),'MailAccountId':Number(_0x55aa03['params']['id'])});}});}})[_0x185e('0x11')](respondWithStatusCode(_0x56b2f6,null))[_0x185e('0x5f')](handleError(_0x56b2f6,null));};exports['getAgents']=function(_0x5c2ccc,_0x2b1acc){var _0x4ce91a={};var _0x137458={};var _0x4cb4f1;var _0x32590f;return db[_0x185e('0x44')]['findOne']({'where':{'id':_0x5c2ccc[_0x185e('0x61')]['id']}})['then'](handleEntityNotFound(_0x2b1acc,null))[_0x185e('0x11')](function(_0xfcfd78){if(_0xfcfd78){_0x4cb4f1=_0xfcfd78;_0x137458[_0x185e('0x4d')]=_['keys'](db['User']['rawAttributes']);_0x137458[_0x185e('0x49')]=_[_0x185e('0x4a')](_0x5c2ccc['query']);_0x137458[_0x185e('0x4b')]=_[_0x185e('0x4c')](_0x137458[_0x185e('0x4d')],_0x137458['query']);_0x4ce91a[_0x185e('0x4e')]=_[_0x185e('0x4c')](_0x137458[_0x185e('0x4d')],qs[_0x185e('0x4f')](_0x5c2ccc[_0x185e('0x49')]['fields']));_0x4ce91a[_0x185e('0x4e')]=_0x4ce91a[_0x185e('0x4e')][_0x185e('0x50')]?_0x4ce91a[_0x185e('0x4e')]:_0x137458['model'];_0x4ce91a[_0x185e('0x54')]=qs['sort'](_0x5c2ccc[_0x185e('0x49')]['sort']);_0x4ce91a['where']=qs[_0x185e('0x4b')](_[_0x185e('0x57')](_0x5c2ccc[_0x185e('0x49')],_0x137458[_0x185e('0x4b')]));if(_0x5c2ccc[_0x185e('0x49')][_0x185e('0x58')]){_0x4ce91a[_0x185e('0x56')]=_[_0x185e('0x59')](_0x4ce91a[_0x185e('0x56')],{'$or':_['map'](_0x4ce91a[_0x185e('0x4e')],function(_0x15ccb4){var _0x5305ed={};_0x5305ed[_0x15ccb4]={'$like':'%'+_0x5c2ccc['query']['filter']+'%'};return _0x5305ed;})});}_0x4ce91a=_['merge']({},_0x4ce91a,_0x5c2ccc[_0x185e('0x5b')]);return _0x4cb4f1['getAgents'](_0x4ce91a);}})[_0x185e('0x11')](function(_0x1e4968){if(_0x1e4968){_0x32590f=_0x1e4968[_0x185e('0x50')];if(!_0x5c2ccc[_0x185e('0x49')][_0x185e('0x51')](_0x185e('0x52'))){_0x4ce91a[_0x185e('0x1e')]=qs[_0x185e('0x1e')](_0x5c2ccc['query']['limit']);_0x4ce91a[_0x185e('0x53')]=qs[_0x185e('0x53')](_0x5c2ccc['query']['offset']);}return _0x4cb4f1['getAgents'](_0x4ce91a);}})[_0x185e('0x11')](function(_0x4afadb){if(_0x4afadb){return _0x4afadb?{'count':_0x32590f,'rows':_0x4afadb}:null;}})[_0x185e('0x11')](respondWithResult(_0x2b1acc,null))[_0x185e('0x5f')](handleError(_0x2b1acc,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 1d3692c..ba8ea22 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 _0xfaf2=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','remove','hook'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0xfaf2,0x169));var _0x2faf=function(_0x25a88d,_0x3e0341){_0x25a88d=_0x25a88d-0x0;var _0x18a7c5=_0xfaf2[_0x25a88d];return _0x18a7c5;};'use strict';var EventEmitter=require(_0x2faf('0x0'));var MailAccount=require(_0x2faf('0x1'))['db'][_0x2faf('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2faf('0x3')](0x0);var events={'afterCreate':_0x2faf('0x4'),'afterUpdate':'update','afterDestroy':_0x2faf('0x5')};function emitEvent(_0xadff87){return function(_0x1be5d0,_0x4164cc,_0x1b9f32){MailAccountEvents['emit'](_0xadff87+':'+_0x1be5d0['id'],_0x1be5d0);MailAccountEvents['emit'](_0xadff87,_0x1be5d0);_0x1b9f32(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x2faf('0x6')](e,emitEvent(event));}}module[_0x2faf('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x8c8b=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5e2262,_0x3c0687){var _0x50c4c7=function(_0x57a3ed){while(--_0x57a3ed){_0x5e2262['push'](_0x5e2262['shift']());}};_0x50c4c7(++_0x3c0687);}(_0x8c8b,0x106));var _0xb8c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c8b[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xb8c8('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb8c8('0x1')](0x0);var events={'afterCreate':_0xb8c8('0x2'),'afterUpdate':_0xb8c8('0x3'),'afterDestroy':_0xb8c8('0x4')};function emitEvent(_0x4c0ddd){return function(_0x4c1ecc,_0x40094e,_0x1bc15d){MailAccountEvents[_0xb8c8('0x5')](_0x4c0ddd+':'+_0x4c1ecc['id'],_0x4c1ecc);MailAccountEvents[_0xb8c8('0x5')](_0x4c0ddd,_0x4c1ecc);_0x1bc15d(null);};}for(var e in events){if(events[_0xb8c8('0x6')](e)){var event=events[e];MailAccount[_0xb8c8('0x7')](e,emitEvent(event));}}module[_0xb8c8('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 28f19e4..14916ff 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 _0x782f=['user','data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount','provider','custom','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2'];(function(_0x447385,_0x4da907){var _0x3688ea=function(_0x594e0f){while(--_0x594e0f){_0x447385['push'](_0x447385['shift']());}};_0x3688ea(++_0x4da907);}(_0x782f,0x180));var _0xf782=function(_0x26d781,_0x455578){_0x26d781=_0x26d781-0x0;var _0x5a0166=_0x782f[_0x26d781];return _0x5a0166;};'use strict';var attributes=require(_0xf782('0x0'));module[_0xf782('0x1')]=function(_0x4a2422){return _0x4a2422[_0xf782('0x2')](_0xf782('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xeb8785=this;var _0x402e04={'id':_0xeb8785['id'],'tls':{'rejectUnauthorized':![]}};if(_0xeb8785[_0xf782('0x4')]!==_0xf782('0x5')){_0x402e04['service']=_0xeb8785[_0xf782('0x4')];}else{_0x402e04[_0xf782('0x6')]=_0xeb8785[_0xf782('0x7')][_0xf782('0x6')];_0x402e04[_0xf782('0x8')]=_0xeb8785[_0xf782('0x7')][_0xf782('0x8')];_0x402e04[_0xf782('0x9')]=_0xeb8785[_0xf782('0x7')][_0xf782('0x9')];}if(_0xeb8785['Smtp'][_0xf782('0xa')]){if(_0xeb8785[_0xf782('0x7')][_0xf782('0xb')]){if(!_0xeb8785[_0xf782('0x7')][_0xf782('0xc')])throw new Error(_0xf782('0xd'));_0x402e04['auth']={'type':_0xf782('0xe'),'user':_0xeb8785[_0xf782('0x7')][_0xf782('0xf')],'accessToken':_0xeb8785[_0xf782('0x7')]['CloudProvider'][_0xf782('0x10')]};}else{_0x402e04[_0xf782('0x11')]={'user':_0xeb8785[_0xf782('0x7')][_0xf782('0xf')],'pass':_0xeb8785[_0xf782('0x7')][_0xf782('0x12')]};}}return _0x402e04;}}});}; \ No newline at end of file +var _0x7d44=['auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service','provider','host','port','Smtp','secure','authentication','CloudProvider'];(function(_0x7401aa,_0x4fc7e9){var _0x1f75e7=function(_0x3016ca){while(--_0x3016ca){_0x7401aa['push'](_0x7401aa['shift']());}};_0x1f75e7(++_0x4fc7e9);}(_0x7d44,0x64));var _0x47d4=function(_0x4d9ec6,_0xa6774c){_0x4d9ec6=_0x4d9ec6-0x0;var _0x190e69=_0x7d44[_0x4d9ec6];return _0x190e69;};'use strict';var attributes=require(_0x47d4('0x0'));module[_0x47d4('0x1')]=function(_0x1c900f){return _0x1c900f[_0x47d4('0x2')](_0x47d4('0x3'),attributes,{'tableName':_0x47d4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4479f5=this;var _0x181da4={'id':_0x4479f5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4479f5['provider']!==_0x47d4('0x5')){_0x181da4[_0x47d4('0x6')]=_0x4479f5[_0x47d4('0x7')];}else{_0x181da4[_0x47d4('0x8')]=_0x4479f5['Smtp'][_0x47d4('0x8')];_0x181da4[_0x47d4('0x9')]=_0x4479f5[_0x47d4('0xa')]['port'];_0x181da4[_0x47d4('0xb')]=_0x4479f5['Smtp'][_0x47d4('0xb')];}if(_0x4479f5['Smtp'][_0x47d4('0xc')]){if(_0x4479f5[_0x47d4('0xa')]['modernAuthentication']){if(!_0x4479f5[_0x47d4('0xa')][_0x47d4('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x181da4[_0x47d4('0xe')]={'type':_0x47d4('0xf'),'user':_0x4479f5['Smtp'][_0x47d4('0x10')],'accessToken':_0x4479f5[_0x47d4('0xa')][_0x47d4('0xd')][_0x47d4('0x11')]};}else{_0x181da4[_0x47d4('0xe')]={'user':_0x4479f5['Smtp'][_0x47d4('0x10')],'pass':_0x4479f5[_0x47d4('0xa')][_0x47d4('0x12')]};}}return _0x181da4;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index ea03ba2..c32e12e 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 _0x5fab=['DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','getSmtpOptions','applications','orderBy','priority','push','length','close','autoclose','*,*,*,*','defaults','ListId','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','spread','interaction','get','created','create','attachments','originTo','originCc','bcc','originChannel','Email','Attachment','Attachments','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','attributes','limit','include','model','map','ShowMailAccount','find','where','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','List','Contacts','updatedAt'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x5fab,0x177));var _0xb5fa=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0x5fab[_0xc14df7];return _0x34a445;};'use strict';var _=require(_0xb5fa('0x0'));var moment=require(_0xb5fa('0x1'));var BPromise=require('bluebird');var rs=require(_0xb5fa('0x2'));var Redis=require(_0xb5fa('0x3'));var db=require(_0xb5fa('0x4'))['db'];var logger=require(_0xb5fa('0x5'))(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var jayson=require(_0xb5fa('0x8'));var client=jayson[_0xb5fa('0x9')][_0xb5fa('0xa')]({'port':0x232c});config[_0xb5fa('0xb')]=_['defaults'](config['redis'],{'host':_0xb5fa('0xc'),'port':0x18eb});var socket=require(_0xb5fa('0xd'))(new Redis(config[_0xb5fa('0xb')]));require('./mailAccount.socket')[_0xb5fa('0xe')](socket);function respondWithRpcPromise(_0x38d9a3,_0x2cf4a5,_0x54c7eb){return new BPromise(function(_0x5b5ea8,_0x3a8e1b){return client[_0xb5fa('0xf')](_0x38d9a3,_0x54c7eb)[_0xb5fa('0x10')](function(_0x44e6c8){logger[_0xb5fa('0x11')](_0xb5fa('0x12'),_0x2cf4a5,_0xb5fa('0x13'));logger[_0xb5fa('0x14')](_0xb5fa('0x15'),_0x2cf4a5,'request\x20sent',JSON[_0xb5fa('0x16')](_0x44e6c8));if(_0x44e6c8[_0xb5fa('0x17')]){if(_0x44e6c8['error'][_0xb5fa('0x18')]===0x1f4){logger['error'](_0xb5fa('0x12'),_0x2cf4a5,_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x3a8e1b(_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x2cf4a5,_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x5b5ea8(_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x2cf4a5,_0xb5fa('0x13'));_0x5b5ea8(_0x44e6c8[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x324ba5){logger[_0xb5fa('0x17')](_0xb5fa('0x12'),_0x2cf4a5,_0x324ba5);_0x3a8e1b(_0x324ba5);});});}exports[_0xb5fa('0x1c')]=function(_0xc14dc4){var _0x368cb1=this;return new Promise(function(_0x3c8d53,_0x1f5064){return db['MailAccount'][_0xb5fa('0x1d')]({'raw':_0xc14dc4['options']?_0xc14dc4[_0xb5fa('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4[_0xb5fa('0x1e')]['where']||null:null,'attributes':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x1f')]||null:null,'limit':_0xc14dc4['options']?_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x20')]||null:null,'include':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4['options'][_0xb5fa('0x21')]?_['map'](_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x21')],function(_0x11053a){return{'model':db[_0x11053a[_0xb5fa('0x22')]],'as':_0x11053a['as'],'attributes':_0x11053a[_0xb5fa('0x1f')],'include':_0x11053a[_0xb5fa('0x21')]?_[_0xb5fa('0x23')](_0x11053a[_0xb5fa('0x21')],function(_0x568870){return{'model':db[_0x568870['model']],'as':_0x568870['as'],'attributes':_0x568870['attributes'],'include':_0x568870['include']?_[_0xb5fa('0x23')](_0x568870[_0xb5fa('0x21')],function(_0x12c0d4){return{'model':db[_0x12c0d4[_0xb5fa('0x22')]],'as':_0x12c0d4['as'],'attributes':_0x12c0d4[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0x10')](function(_0x358549){logger[_0xb5fa('0x11')](_0xb5fa('0x1c'),_0xc14dc4);logger[_0xb5fa('0x14')](_0xb5fa('0x1c'),_0xc14dc4,JSON[_0xb5fa('0x16')](_0x358549));_0x3c8d53(_0x358549);})[_0xb5fa('0x1b')](function(_0x1f4380){logger[_0xb5fa('0x17')](_0xb5fa('0x1c'),_0x1f4380[_0xb5fa('0x19')],_0xc14dc4);_0x1f5064(_0x368cb1[_0xb5fa('0x17')](0x1f4,_0x1f4380[_0xb5fa('0x19')]));});});};exports[_0xb5fa('0x24')]=function(_0x291938){var _0x370d95=this;return new Promise(function(_0x10fb43,_0x25fc7c){return db['MailAccount'][_0xb5fa('0x25')]({'raw':_0x291938['options']?_0x291938['options']['raw']===undefined?!![]:![]:!![],'where':_0x291938[_0xb5fa('0x1e')]?_0x291938['options'][_0xb5fa('0x26')]||null:null,'attributes':_0x291938['options']?_0x291938['options'][_0xb5fa('0x1f')]||null:null,'include':_0x291938[_0xb5fa('0x1e')]?_0x291938['options']['include']?_[_0xb5fa('0x23')](_0x291938[_0xb5fa('0x1e')][_0xb5fa('0x21')],function(_0x560b53){return{'model':db[_0x560b53[_0xb5fa('0x22')]],'as':_0x560b53['as'],'attributes':_0x560b53[_0xb5fa('0x1f')],'include':_0x560b53['include']?_[_0xb5fa('0x23')](_0x560b53[_0xb5fa('0x21')],function(_0x204d6b){return{'model':db[_0x204d6b['model']],'as':_0x204d6b['as'],'attributes':_0x204d6b[_0xb5fa('0x1f')],'include':_0x204d6b[_0xb5fa('0x21')]?_[_0xb5fa('0x23')](_0x204d6b['include'],function(_0x117694){return{'model':db[_0x117694[_0xb5fa('0x22')]],'as':_0x117694['as'],'attributes':_0x117694[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0x10')](function(_0x5e7770){if(_0x291938['options']['smtp']===!![])_0x5e7770['setDataValue']('smtpOptions',_0x5e7770['getSmtpOptions']());logger[_0xb5fa('0x11')]('ShowMailAccount',_0x291938);logger[_0xb5fa('0x14')](_0xb5fa('0x24'),_0x291938,JSON[_0xb5fa('0x16')](_0x5e7770));_0x10fb43(_0x5e7770);})[_0xb5fa('0x1b')](function(_0x40c1c0){logger[_0xb5fa('0x17')]('ShowMailAccount',_0x40c1c0['message'],_0x291938);_0x25fc7c(_0x370d95['error'](0x1f4,_0x40c1c0[_0xb5fa('0x19')]));});});};exports['NotifyMailAccount']=function(_0x73d425){var _0x5addd5=this;return new Promise(function(_0x58aa97,_0x3cdf63){var _0x42d331={'body':_0x73d425[_0xb5fa('0x27')],'channel':_0xb5fa('0x28')};var _0x5bc93f=_[_0xb5fa('0x29')](_[_0xb5fa('0x2a')](db[_0xb5fa('0x2b')][_0xb5fa('0x2c')]),[_0xb5fa('0x2d'),'updatedAt',_0xb5fa('0x2e'),'ListId']);var _0x233f90=![];if(_0x73d425[_0xb5fa('0x27')]['id']){delete _0x73d425[_0xb5fa('0x27')]['id'];}if(_[_0xb5fa('0x2f')](_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x31')));}if(_['isNil'](_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x27')])||_0x73d425['body'][_0xb5fa('0x27')]===''){return _0x3cdf63(_0x5addd5['error'](0x1f4,_0xb5fa('0x32')));}if(_[_0xb5fa('0x2f')](_0x73d425['body']['mapKey'])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x33')+_0x5bc93f));}if(!_[_0xb5fa('0x34')](_0x5bc93f,_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x35')])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x36')+_0x5bc93f));}var _0x125a5c={};_0x125a5c[_0x73d425['body'][_0xb5fa('0x35')]]=_0x73d425[_0xb5fa('0x27')]['from'];return db[_0xb5fa('0x37')][_0xb5fa('0x25')]({'where':{'id':_0x73d425[_0xb5fa('0x38')]['id']},'include':[{'model':db[_0xb5fa('0x39')],'as':_0xb5fa('0x3a'),'include':[{'model':db[_0xb5fa('0x2b')],'as':_0xb5fa('0x3b'),'where':_0x125a5c,'limit':0x1,'order':[[_0xb5fa('0x3c'),_0xb5fa('0x3d')]]}]},{'model':db[_0xb5fa('0x3e')],'as':_0xb5fa('0x3f')},{'model':db[_0xb5fa('0x40')],'as':_0xb5fa('0x41'),'include':[{'model':db[_0xb5fa('0x42')],'as':_0xb5fa('0x42')}]}]})[_0xb5fa('0x10')](function(_0x52f5d8){if(_0x52f5d8&&_0x52f5d8['List']){var _0x46194d=_0x52f5d8['get']({'plain':!![]});_0x42d331[_0xb5fa('0x38')]=_[_0xb5fa('0x43')](_0x46194d,['Applications',_0xb5fa('0x3a')]);_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x44')]=_0x52f5d8[_0xb5fa('0x45')]();_0x42d331[_0xb5fa('0x46')]=_0x46194d[_0xb5fa('0x3f')];_0x42d331['list']=_0x46194d[_0xb5fa('0x3a')];_0x42d331['applications']=_[_0xb5fa('0x47')](_0x42d331[_0xb5fa('0x46')],[_0xb5fa('0x48')],['asc']);if(_0x42d331[_0xb5fa('0x38')]&&_0x42d331[_0xb5fa('0x38')]['autoclose']){_0x42d331['applications'][_0xb5fa('0x49')]({'id':0x0,'priority':_0x42d331[_0xb5fa('0x46')][_0xb5fa('0x4a')]+0x1,'app':_0xb5fa('0x4b'),'appdata':_0xb5fa('0x4c'),'interval':_0xb5fa('0x4d')});}if(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3f')]){delete _0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3f')];}if(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3a')]){delete _0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3a')];}if(_0x46194d[_0xb5fa('0x3a')][_0xb5fa('0x3b')][_0xb5fa('0x4a')]){return _0x46194d[_0xb5fa('0x3a')]['Contacts'][0x0];}var _0x1900a5=_[_0xb5fa('0x4e')](_0x73d425[_0xb5fa('0x27')],{'firstName':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')],'ListId':_0x46194d[_0xb5fa('0x4f')]});_0x1900a5[_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x35')]]=_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')];return db['CmContact']['create'](_0x1900a5);}else{throw new Error(_0xb5fa('0x50'));}})[_0xb5fa('0x10')](function(_0x1e78cb){_0x42d331['contact']=_0x1e78cb;if(_0x1e78cb){if(!_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x51')]){_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x51')]=rs[_0xb5fa('0x52')]()+'\x20'+_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x30')];}var _0x4afc02={'ContactId':_0x1e78cb['id'],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id'],'inReplyTo':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x51')],'to':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x30')],'cc':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['cc'],'subject':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x53')],'attach':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x54')],'lastMsgAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgDirection':'in'};return db[_0xb5fa('0x57')][_0xb5fa('0x25')]({'where':{'closed':![],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id']},'include':[{'model':db[_0xb5fa('0x58')],'as':_0xb5fa('0x59'),'attributes':[_0xb5fa('0x51')],'where':{'messageId':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['inReplyTo']}}]})[_0xb5fa('0x10')](function(_0x34ebd0){if(_0x34ebd0){return[_0x34ebd0,![]];}return db[_0xb5fa('0x57')]['create'](_0x4afc02)[_0xb5fa('0x10')](function(_0x2d786e){return[_0x2d786e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb5fa('0x5a')](function(_0xb535c3,_0x5c25f6){if(_0xb535c3){_0x233f90=_0x5c25f6;if(!_0x5c25f6){return _0xb535c3['update']({'inReplyTo':_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x51')],'to':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x30')],'cc':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['cc'],'subject':_0x73d425[_0xb5fa('0x27')]['message']['subject'],'attach':_0xb535c3['attach']?_0xb535c3[_0xb5fa('0x54')]:_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['attach'],'substatus':null,'substatusAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgDirection':'in'});}else{return _0xb535c3;}}})[_0xb5fa('0x10')](function(_0x36b709){_0x42d331[_0xb5fa('0x5b')]=_0x36b709[_0xb5fa('0x5c')]({'plain':!![]});_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x5d')]=_0x233f90;return db[_0xb5fa('0x58')][_0xb5fa('0x5e')]({'body':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x27')],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id'],'MailInteractionId':_0x36b709['id'],'direction':'in','ContactId':_0x42d331['contact']['id'],'messageId':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x51')],'from':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x30')],'to':_0x73d425[_0xb5fa('0x27')]['message']['to'],'cc':_0x73d425[_0xb5fa('0x27')]['message']['cc'],'subject':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x53')],'attach':_0x73d425[_0xb5fa('0x27')]['message']['attach'],'Attachments':_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x5f')],'originTo':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x60')],'originCc':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x61')],'bcc':_0x73d425['body']['message'][_0xb5fa('0x62')],'ChatWebsiteId':_0x73d425['body']['message']['ChatWebsiteId']||null,'originChannel':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x63')]||_0xb5fa('0x64'),'ChatOfflineMessageId':_0x73d425[_0xb5fa('0x27')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xb5fa('0x65')],'as':_0xb5fa('0x66')}]});})['then'](function(_0x2d0c95){_0x42d331[_0xb5fa('0x19')]=_0x2d0c95;if(_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x67')]){return db['User'][_0xb5fa('0x25')]({'attributes':['id',_0xb5fa('0x68')],'where':{'id':_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x67')]}})[_0xb5fa('0x10')](function(_0x3348f7){if(_0x3348f7){_0x42d331[_0xb5fa('0x46')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb5fa('0x69'),'appdata':_0x3348f7['name']+','+(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x6a')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb5fa('0x6b'),_0xb5fa('0x6c'),_0x42d331);});}return respondWithRpcPromise(_0xb5fa('0x6b'),_0xb5fa('0x6c'),_0x42d331);})[_0xb5fa('0x10')](function(_0x8ce5b8){_0x58aa97(_0x8ce5b8);})[_0xb5fa('0x1b')](function(_0x1bac54){_0x3cdf63(_0x5addd5['error'](0x1f4,_0x1bac54[_0xb5fa('0x19')]));});});}; \ No newline at end of file +var _0x1a85=['getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','body','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','applications','orderBy','asc','autoclose','push','length','close','*,*,*,*','Contacts','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','Contact\x20not\x20found','update','attach','interaction','get','created','attachments','originCc','bcc','ChatWebsiteId','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','startRouting','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailAccount','findAll','options','where','attributes','map','include','model','GetMailAccount','ShowMailAccount','find','raw'];(function(_0x8a73e0,_0x2740b4){var _0x1021c8=function(_0xf70d0b){while(--_0xf70d0b){_0x8a73e0['push'](_0x8a73e0['shift']());}};_0x1021c8(++_0x2740b4);}(_0x1a85,0x178));var _0x51a8=function(_0x22071a,_0x4bcf62){_0x22071a=_0x22071a-0x0;var _0x5c6c85=_0x1a85[_0x22071a];return _0x5c6c85;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x51a8('0x0'));var rs=require(_0x51a8('0x1'));var Redis=require(_0x51a8('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x51a8('0x3'));var config=require(_0x51a8('0x4'));var jayson=require(_0x51a8('0x5'));var client=jayson['client'][_0x51a8('0x6')]({'port':0x232c});config['redis']=_[_0x51a8('0x7')](config['redis'],{'host':_0x51a8('0x8'),'port':0x18eb});var socket=require(_0x51a8('0x9'))(new Redis(config['redis']));require(_0x51a8('0xa'))['register'](socket);function respondWithRpcPromise(_0x56e1b4,_0x39e06a,_0x2f276b){return new BPromise(function(_0x1a476d,_0x45a3f4){return client[_0x51a8('0xb')](_0x56e1b4,_0x2f276b)[_0x51a8('0xc')](function(_0x3f93c7){logger[_0x51a8('0xd')](_0x51a8('0xe'),_0x39e06a,_0x51a8('0xf'));logger[_0x51a8('0x10')](_0x51a8('0x11'),_0x39e06a,_0x51a8('0xf'),JSON[_0x51a8('0x12')](_0x3f93c7));if(_0x3f93c7[_0x51a8('0x13')]){if(_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x14')]===0x1f4){logger['error'](_0x51a8('0xe'),_0x39e06a,_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x15')]);return _0x45a3f4(_0x3f93c7['error'][_0x51a8('0x15')]);}logger['error'](_0x51a8('0xe'),_0x39e06a,_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x15')]);return _0x1a476d(_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x15')]);}else{logger[_0x51a8('0xd')](_0x51a8('0xe'),_0x39e06a,'request\x20sent');_0x1a476d(_0x3f93c7[_0x51a8('0x16')][_0x51a8('0x15')]);}})[_0x51a8('0x17')](function(_0x23539e){logger[_0x51a8('0x13')](_0x51a8('0xe'),_0x39e06a,_0x23539e);_0x45a3f4(_0x23539e);});});}exports['GetMailAccount']=function(_0x1df8c2){var _0x3b7e7e=this;return new Promise(function(_0x2217ce,_0x2f2681){return db[_0x51a8('0x18')][_0x51a8('0x19')]({'raw':_0x1df8c2[_0x51a8('0x1a')]?_0x1df8c2[_0x51a8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1df8c2[_0x51a8('0x1a')]?_0x1df8c2['options'][_0x51a8('0x1b')]||null:null,'attributes':_0x1df8c2[_0x51a8('0x1a')]?_0x1df8c2[_0x51a8('0x1a')][_0x51a8('0x1c')]||null:null,'limit':_0x1df8c2['options']?_0x1df8c2[_0x51a8('0x1a')]['limit']||null:null,'include':_0x1df8c2['options']?_0x1df8c2[_0x51a8('0x1a')]['include']?_[_0x51a8('0x1d')](_0x1df8c2[_0x51a8('0x1a')][_0x51a8('0x1e')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1f')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1f')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')],'include':_0x273ce2[_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x273ce2[_0x51a8('0x1e')],function(_0x1a886f){return{'model':db[_0x1a886f[_0x51a8('0x1f')]],'as':_0x1a886f['as'],'attributes':_0x1a886f[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0xc')](function(_0x20c6b5){logger[_0x51a8('0xd')]('GetMailAccount',_0x1df8c2);logger[_0x51a8('0x10')]('GetMailAccount',_0x1df8c2,JSON[_0x51a8('0x12')](_0x20c6b5));_0x2217ce(_0x20c6b5);})[_0x51a8('0x17')](function(_0x143f46){logger[_0x51a8('0x13')](_0x51a8('0x20'),_0x143f46['message'],_0x1df8c2);_0x2f2681(_0x3b7e7e[_0x51a8('0x13')](0x1f4,_0x143f46['message']));});});};exports[_0x51a8('0x21')]=function(_0x24b39a){var _0x253a59=this;return new Promise(function(_0x4b19c8,_0x2080a1){return db['MailAccount'][_0x51a8('0x22')]({'raw':_0x24b39a[_0x51a8('0x1a')]?_0x24b39a[_0x51a8('0x1a')][_0x51a8('0x23')]===undefined?!![]:![]:!![],'where':_0x24b39a[_0x51a8('0x1a')]?_0x24b39a['options'][_0x51a8('0x1b')]||null:null,'attributes':_0x24b39a['options']?_0x24b39a[_0x51a8('0x1a')][_0x51a8('0x1c')]||null:null,'include':_0x24b39a[_0x51a8('0x1a')]?_0x24b39a['options'][_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x24b39a[_0x51a8('0x1a')][_0x51a8('0x1e')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1d')](_0x41c020[_0x51a8('0x1e')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1f')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes'],'include':_0x4ec1db[_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x4ec1db[_0x51a8('0x1e')],function(_0x1eef9d){return{'model':db[_0x1eef9d[_0x51a8('0x1f')]],'as':_0x1eef9d['as'],'attributes':_0x1eef9d[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e5566){if(_0x24b39a[_0x51a8('0x1a')]['smtp']===!![])_0x4e5566['setDataValue']('smtpOptions',_0x4e5566[_0x51a8('0x24')]());logger[_0x51a8('0xd')](_0x51a8('0x21'),_0x24b39a);logger['debug'](_0x51a8('0x21'),_0x24b39a,JSON[_0x51a8('0x12')](_0x4e5566));_0x4b19c8(_0x4e5566);})[_0x51a8('0x17')](function(_0x310ad2){logger['error'](_0x51a8('0x21'),_0x310ad2[_0x51a8('0x15')],_0x24b39a);_0x2080a1(_0x253a59[_0x51a8('0x13')](0x1f4,_0x310ad2['message']));});});};exports[_0x51a8('0x25')]=function(_0x51d7bd){var _0x2032c0=this;return new Promise(function(_0x1e637a,_0x2a98bd){var _0x37d50b={'body':_0x51d7bd['body'],'channel':_0x51a8('0x26')};var _0x3da2cf=_[_0x51a8('0x27')](_[_0x51a8('0x28')](db[_0x51a8('0x29')][_0x51a8('0x2a')]),[_0x51a8('0x2b'),_0x51a8('0x2c'),_0x51a8('0x2d'),'ListId']);var _0x22e6e6=![];if(_0x51d7bd[_0x51a8('0x2e')]['id']){delete _0x51d7bd['body']['id'];}if(_['isNil'](_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2f')])){return _0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,_0x51a8('0x30')));}if(_[_0x51a8('0x31')](_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2e')])||_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2e')]===''){return _0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x51a8('0x31')](_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x32')])){return _0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,_0x51a8('0x33')+_0x3da2cf));}if(!_[_0x51a8('0x34')](_0x3da2cf,_0x51d7bd['body'][_0x51a8('0x32')])){return _0x2a98bd(_0x2032c0['error'](0x1f4,_0x51a8('0x35')+_0x3da2cf));}var _0x3a33f3={};_0x3a33f3[_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x32')]]=_0x51d7bd[_0x51a8('0x2e')]['from'];return db['MailAccount'][_0x51a8('0x22')]({'where':{'id':_0x51d7bd[_0x51a8('0x36')]['id']},'include':[{'model':db[_0x51a8('0x37')],'as':_0x51a8('0x38'),'include':[{'model':db[_0x51a8('0x29')],'as':'Contacts','where':_0x3a33f3,'limit':0x1,'order':[['updatedAt',_0x51a8('0x39')]]}]},{'model':db[_0x51a8('0x3a')],'as':_0x51a8('0x3b')},{'model':db[_0x51a8('0x3c')],'as':_0x51a8('0x3d'),'include':[{'model':db[_0x51a8('0x3e')],'as':_0x51a8('0x3e')}]}]})[_0x51a8('0xc')](function(_0x301578){if(_0x301578&&_0x301578['List']){var _0x5cb2cf=_0x301578['get']({'plain':!![]});_0x37d50b[_0x51a8('0x36')]=_[_0x51a8('0x3f')](_0x5cb2cf,[_0x51a8('0x3b'),'List']);_0x37d50b[_0x51a8('0x36')][_0x51a8('0x40')]=_0x301578['getSmtpOptions']();_0x37d50b[_0x51a8('0x41')]=_0x5cb2cf['Applications'];_0x37d50b['list']=_0x5cb2cf[_0x51a8('0x38')];_0x37d50b[_0x51a8('0x41')]=_[_0x51a8('0x42')](_0x37d50b['applications'],['priority'],[_0x51a8('0x43')]);if(_0x37d50b['account']&&_0x37d50b[_0x51a8('0x36')][_0x51a8('0x44')]){_0x37d50b[_0x51a8('0x41')][_0x51a8('0x45')]({'id':0x0,'priority':_0x37d50b[_0x51a8('0x41')][_0x51a8('0x46')]+0x1,'app':_0x51a8('0x47'),'appdata':_0x51a8('0x44'),'interval':_0x51a8('0x48')});}if(_0x37d50b['account'][_0x51a8('0x3b')]){delete _0x37d50b[_0x51a8('0x36')][_0x51a8('0x3b')];}if(_0x37d50b[_0x51a8('0x36')]['List']){delete _0x37d50b[_0x51a8('0x36')]['List'];}if(_0x5cb2cf[_0x51a8('0x38')][_0x51a8('0x49')]['length']){return _0x5cb2cf['List'][_0x51a8('0x49')][0x0];}var _0x16f124=_[_0x51a8('0x7')](_0x51d7bd[_0x51a8('0x2e')],{'firstName':_0x51d7bd[_0x51a8('0x2e')]['from'],'ListId':_0x5cb2cf[_0x51a8('0x4a')]});_0x16f124[_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x32')]]=_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2f')];return db['CmContact'][_0x51a8('0x4b')](_0x16f124);}else{throw new Error(_0x51a8('0x4c'));}})[_0x51a8('0xc')](function(_0x3e43cc){_0x37d50b[_0x51a8('0x4d')]=_0x3e43cc;if(_0x3e43cc){if(!_0x51d7bd[_0x51a8('0x2e')]['message']['messageId']){_0x51d7bd['body']['message'][_0x51a8('0x4e')]=rs[_0x51a8('0x4f')]()+'\x20'+_0x51d7bd['body'][_0x51a8('0x15')]['from'];}var _0x41cc00={'ContactId':_0x3e43cc['id'],'MailAccountId':_0x51d7bd['account']['id'],'inReplyTo':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['messageId'],'to':_0x51d7bd['body']['message'][_0x51a8('0x2f')],'cc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['cc'],'subject':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x50')],'attach':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['attach'],'lastMsgAt':moment()[_0x51a8('0x51')](_0x51a8('0x52')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x51a8('0x22')]({'where':{'closed':![],'MailAccountId':_0x51d7bd[_0x51a8('0x36')]['id']},'include':[{'model':db[_0x51a8('0x53')],'as':_0x51a8('0x54'),'attributes':[_0x51a8('0x4e')],'where':{'messageId':_0x51d7bd[_0x51a8('0x2e')]['message']['inReplyTo']}}]})[_0x51a8('0xc')](function(_0x53f25e){if(_0x53f25e){return[_0x53f25e,![]];}return db['MailInteraction']['create'](_0x41cc00)['then'](function(_0x483a5a){return[_0x483a5a,!![]];});});}else{throw new Error(_0x51a8('0x55'));}})['spread'](function(_0x1477af,_0x4772cd){if(_0x1477af){_0x22e6e6=_0x4772cd;if(!_0x4772cd){return _0x1477af[_0x51a8('0x56')]({'inReplyTo':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x4e')],'to':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x2f')],'cc':_0x51d7bd[_0x51a8('0x2e')]['message']['cc'],'subject':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x50')],'attach':_0x1477af['attach']?_0x1477af['attach']:_0x51d7bd['body'][_0x51a8('0x15')][_0x51a8('0x57')],'substatus':null,'substatusAt':moment()[_0x51a8('0x51')](_0x51a8('0x52')),'lastMsgAt':moment()[_0x51a8('0x51')](_0x51a8('0x52')),'lastMsgDirection':'in'});}else{return _0x1477af;}}})[_0x51a8('0xc')](function(_0x418445){_0x37d50b[_0x51a8('0x58')]=_0x418445[_0x51a8('0x59')]({'plain':!![]});_0x37d50b[_0x51a8('0x58')][_0x51a8('0x5a')]=_0x22e6e6;return db[_0x51a8('0x53')]['create']({'body':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2e')],'MailAccountId':_0x51d7bd['account']['id'],'MailInteractionId':_0x418445['id'],'direction':'in','ContactId':_0x37d50b[_0x51a8('0x4d')]['id'],'messageId':_0x51d7bd['body']['message']['messageId'],'from':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x2f')],'to':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['to'],'cc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['cc'],'subject':_0x51d7bd['body']['message']['subject'],'attach':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x57')],'Attachments':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5b')],'originTo':_0x51d7bd['body'][_0x51a8('0x15')]['originTo'],'originCc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5c')],'bcc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5d')],'ChatWebsiteId':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5e')]||null,'originChannel':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['originChannel']||'Email','ChatOfflineMessageId':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5f')]||null},{'include':[{'model':db[_0x51a8('0x60')],'as':'Attachments'}]});})[_0x51a8('0xc')](function(_0x4d418a){_0x37d50b[_0x51a8('0x15')]=_0x4d418a;if(_0x37d50b[_0x51a8('0x58')][_0x51a8('0x61')]){return db[_0x51a8('0x62')][_0x51a8('0x22')]({'attributes':['id',_0x51a8('0x63')],'where':{'id':_0x37d50b[_0x51a8('0x58')][_0x51a8('0x61')]}})[_0x51a8('0xc')](function(_0x53fc80){if(_0x53fc80){_0x37d50b[_0x51a8('0x41')][_0x51a8('0x64')]({'id':0x0,'priority':0x0,'app':_0x51a8('0x65'),'appdata':_0x53fc80[_0x51a8('0x63')]+','+(_0x37d50b['account']['waitForTheAssignedAgent']||0xa),'interval':_0x51a8('0x48')});}return respondWithRpcPromise('Start','startRouting',_0x37d50b);});}return respondWithRpcPromise('Start',_0x51a8('0x66'),_0x37d50b);})['then'](function(_0x5c7aca){_0x1e637a(_0x5c7aca);})[_0x51a8('0x17')](function(_0x23f82a){_0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,_0x23f82a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1db8b25..c166b32 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 _0x9091=['emit','length','mailAccount:','./mailAccount.events','remove'];(function(_0x5c5361,_0x145cc8){var _0x22ca36=function(_0x2f02fd){while(--_0x2f02fd){_0x5c5361['push'](_0x5c5361['shift']());}};_0x22ca36(++_0x145cc8);}(_0x9091,0x1ed));var _0x1909=function(_0x4f7b8f,_0x86c890){_0x4f7b8f=_0x4f7b8f-0x0;var _0xa126fd=_0x9091[_0x4f7b8f];return _0xa126fd;};'use strict';var MailAccountEvents=require(_0x1909('0x0'));var events=['save',_0x1909('0x1'),'update'];function createListener(_0xc9d95e,_0x530368){return function(_0xcf58d6){_0x530368[_0x1909('0x2')](_0xc9d95e,_0xcf58d6);};}function removeListener(_0x44f6f9,_0x522e9a){return function(){MailAccountEvents['removeListener'](_0x44f6f9,_0x522e9a);};}exports['register']=function(_0x15ae85){for(var _0x53bf6b=0x0,_0x3dd05e=events[_0x1909('0x3')];_0x53bf6b<_0x3dd05e;_0x53bf6b++){var _0x20a7fc=events[_0x53bf6b];var _0x3e25fd=createListener(_0x1909('0x4')+_0x20a7fc,_0x15ae85);MailAccountEvents['on'](_0x20a7fc,_0x3e25fd);}}; \ No newline at end of file +var _0x8ce2=['removeListener','register','mailAccount:','./mailAccount.events','save','update','emit'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0x8ce2,0x18b));var _0x28ce=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8ce2[_0x2b10c6];return _0x3789d2;};'use strict';var MailAccountEvents=require(_0x28ce('0x0'));var events=[_0x28ce('0x1'),'remove',_0x28ce('0x2')];function createListener(_0x347a43,_0x2dee6f){return function(_0x3392fd){_0x2dee6f[_0x28ce('0x3')](_0x347a43,_0x3392fd);};}function removeListener(_0xdca3cb,_0x5dd67d){return function(){MailAccountEvents[_0x28ce('0x4')](_0xdca3cb,_0x5dd67d);};}exports[_0x28ce('0x5')]=function(_0x24278a){for(var _0x1a8370=0x0,_0x1c6b69=events['length'];_0x1a8370<_0x1c6b69;_0x1a8370++){var _0x5a9c46=events[_0x1a8370];var _0x292b5b=createListener(_0x28ce('0x6')+_0x5a9c46,_0x24278a);MailAccountEvents['on'](_0x5a9c46,_0x292b5b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 6734dd7..f11de87 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 _0x1697=['put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show'];(function(_0x38b114,_0x22cc0b){var _0x17d966=function(_0x32baca){while(--_0x32baca){_0x38b114['push'](_0x38b114['shift']());}};_0x17d966(++_0x22cc0b);}(_0x1697,0x134));var _0x7169=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0x1697[_0x2dbce7];return _0x3a3ed0;};'use strict';var multer=require(_0x7169('0x0'));var util=require('util');var path=require(_0x7169('0x1'));var timeout=require(_0x7169('0x2'));var express=require(_0x7169('0x3'));var router=express[_0x7169('0x4')]();var fs_extra=require(_0x7169('0x5'));var auth=require(_0x7169('0x6'));var interaction=require(_0x7169('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x7169('0x8')](_0x7169('0x9'),auth[_0x7169('0xa')](),controller[_0x7169('0xb')]);router[_0x7169('0xc')]('/:id',auth[_0x7169('0xa')](),controller[_0x7169('0xd')]);router[_0x7169('0xe')]('/:id',auth[_0x7169('0xa')](),controller['destroy']);module[_0x7169('0xf')]=router; \ No newline at end of file +var _0xca10=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated','update','destroy','exports','util','path'];(function(_0x4cd204,_0x22955f){var _0x2e0dbf=function(_0x3b95e5){while(--_0x3b95e5){_0x4cd204['push'](_0x4cd204['shift']());}};_0x2e0dbf(++_0x22955f);}(_0xca10,0x102));var _0x0ca1=function(_0x248171,_0x57a024){_0x248171=_0x248171-0x0;var _0x4f3b09=_0xca10[_0x248171];return _0x4f3b09;};'use strict';var multer=require('multer');var util=require(_0x0ca1('0x0'));var path=require(_0x0ca1('0x1'));var timeout=require(_0x0ca1('0x2'));var express=require('express');var router=express[_0x0ca1('0x3')]();var fs_extra=require(_0x0ca1('0x4'));var auth=require(_0x0ca1('0x5'));var interaction=require(_0x0ca1('0x6'));var config=require('../../config/environment');var controller=require(_0x0ca1('0x7'));router['get'](_0x0ca1('0x8'),auth[_0x0ca1('0x9')](),controller['show']);router['put']('/:id',auth[_0x0ca1('0x9')](),controller[_0x0ca1('0xa')]);router['delete']('/:id',auth[_0x0ca1('0x9')](),controller[_0x0ca1('0xb')]);module[_0x0ca1('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 7c720b2..7699ac1 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 _0xf859=['sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x450fb4,_0x43f94d){var _0x5bb6cc=function(_0x188c6f){while(--_0x188c6f){_0x450fb4['push'](_0x450fb4['shift']());}};_0x5bb6cc(++_0x43f94d);}(_0xf859,0x159));var _0x9f85=function(_0x24001c,_0x1dc7c3){_0x24001c=_0x24001c-0x0;var _0x1e2871=_0xf859[_0x24001c];return _0x1e2871;};'use strict';var Sequelize=require(_0x9f85('0x0'));module[_0x9f85('0x1')]={'priority':{'type':Sequelize[_0x9f85('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9f85('0x3')]()},'description':{'type':Sequelize[_0x9f85('0x4')]},'interval':{'type':Sequelize[_0x9f85('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa114=['exports','INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x584d37,_0x13fb20){var _0x1a1dbf=function(_0x23cd11){while(--_0x23cd11){_0x584d37['push'](_0x584d37['shift']());}};_0x1a1dbf(++_0x13fb20);}(_0xa114,0xb3));var _0x4a11=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xa114[_0x5a9c0c];return _0x53c77d;};'use strict';var Sequelize=require(_0x4a11('0x0'));module[_0x4a11('0x1')]={'priority':{'type':Sequelize[_0x4a11('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4a11('0x3')},'appdata':{'type':Sequelize[_0x4a11('0x4')]()},'description':{'type':Sequelize[_0x4a11('0x5')]},'interval':{'type':Sequelize[_0x4a11('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 676a967..5d22c4e 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0xf5f512,_0x131ec0){var _0x1940c9=function(_0x3e6795){while(--_0x3e6795){_0xf5f512['push'](_0xf5f512['shift']());}};_0x1940c9(++_0x131ec0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4b0ebc,_0x195784){_0x4b0ebc=_0x4b0ebc-0x0;var _0x27235d=_0x9bde[_0x4b0ebc];return _0x27235d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x51aebd,_0x5b25b9){var _0x5a9706=function(_0x422a49){while(--_0x422a49){_0x51aebd['push'](_0x51aebd['shift']());}};_0x5a9706(++_0x5b25b9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3c2290,_0x69f385){_0x3c2290=_0x3c2290-0x0;var _0x4ee2ad=_0xf4eb[_0x3c2290];return _0x4ee2ad;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7d5ca80..4237c53 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 _0x5a6d=['../../config/logger','moment','request-promise','rimraf','./mailApplication.attributes','define','utf8mb4','lodash','util'];(function(_0x2ccab9,_0x42969d){var _0x20e296=function(_0x58ef89){while(--_0x58ef89){_0x2ccab9['push'](_0x2ccab9['shift']());}};_0x20e296(++_0x42969d);}(_0x5a6d,0x181));var _0xd5a6=function(_0x5e5ed2,_0x41a1ec){_0x5e5ed2=_0x5e5ed2-0x0;var _0x2fdd99=_0x5a6d[_0x5e5ed2];return _0x2fdd99;};'use strict';var _=require(_0xd5a6('0x0'));var util=require(_0xd5a6('0x1'));var logger=require(_0xd5a6('0x2'))('api');var moment=require(_0xd5a6('0x3'));var BPromise=require('bluebird');var rp=require(_0xd5a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5a6('0x5'));var config=require('../../config/environment');var attributes=require(_0xd5a6('0x6'));module['exports']=function(_0x2e23f1,_0x537f15){return _0x2e23f1[_0xd5a6('0x7')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd5a6('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdbac=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','mail_applications','utf8mb4'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdbac,0xfc));var _0xcdba=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xdbac[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xcdba('0x0'));var util=require(_0xcdba('0x1'));var logger=require(_0xcdba('0x2'))('api');var moment=require(_0xcdba('0x3'));var BPromise=require(_0xcdba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdba('0x5'));var rimraf=require(_0xcdba('0x6'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x3ca0b3,_0x2cbbff){return _0x3ca0b3['define']('MailApplication',attributes,{'tableName':_0xcdba('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcdba('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 905ec6d..11a30c2 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 _0x5f11=['MailApplication','update','options','raw','where','attributes','limit','then','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','UpdateMailApplication'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0x5f11,0x1da));var _0x15f1=function(_0xd500d2,_0x52e41f){_0xd500d2=_0xd500d2-0x0;var _0x2af4d7=_0x5f11[_0xd500d2];return _0x2af4d7;};'use strict';var _=require(_0x15f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x15f1('0x1'));var rs=require(_0x15f1('0x2'));var fs=require('fs');var Redis=require(_0x15f1('0x3'));var db=require(_0x15f1('0x4'))['db'];var utils=require(_0x15f1('0x5'));var logger=require('../../config/logger')(_0x15f1('0x6'));var config=require(_0x15f1('0x7'));var jayson=require(_0x15f1('0x8'));var client=jayson[_0x15f1('0x9')][_0x15f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3557f5,_0x249bd1,_0x1f0902){return new BPromise(function(_0x4d0df8,_0x1acf39){return client[_0x15f1('0xb')](_0x3557f5,_0x1f0902)['then'](function(_0x511206){logger['info'](_0x15f1('0xc'),_0x249bd1,_0x15f1('0xd'));logger[_0x15f1('0xe')](_0x15f1('0xf'),_0x249bd1,_0x15f1('0xd'),JSON[_0x15f1('0x10')](_0x511206));if(_0x511206[_0x15f1('0x11')]){if(_0x511206[_0x15f1('0x11')]['code']===0x1f4){logger[_0x15f1('0x11')](_0x15f1('0xc'),_0x249bd1,_0x511206['error'][_0x15f1('0x12')]);return _0x1acf39(_0x511206[_0x15f1('0x11')][_0x15f1('0x12')]);}logger[_0x15f1('0x11')](_0x15f1('0xc'),_0x249bd1,_0x511206['error'][_0x15f1('0x12')]);return _0x4d0df8(_0x511206[_0x15f1('0x11')][_0x15f1('0x12')]);}else{logger[_0x15f1('0x13')](_0x15f1('0xc'),_0x249bd1,'request\x20sent');_0x4d0df8(_0x511206[_0x15f1('0x14')]['message']);}})['catch'](function(_0x35a842){logger[_0x15f1('0x11')](_0x15f1('0xc'),_0x249bd1,_0x35a842);_0x1acf39(_0x35a842);});});}exports[_0x15f1('0x15')]=function(_0x2b80bd){var _0x57315a=this;return new Promise(function(_0x5c5d79,_0x2d03ba){return db[_0x15f1('0x16')][_0x15f1('0x17')](_0x2b80bd['body'],{'raw':_0x2b80bd[_0x15f1('0x18')]?_0x2b80bd[_0x15f1('0x18')][_0x15f1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b80bd[_0x15f1('0x18')]?_0x2b80bd[_0x15f1('0x18')][_0x15f1('0x1a')]||null:null,'attributes':_0x2b80bd[_0x15f1('0x18')]?_0x2b80bd[_0x15f1('0x18')][_0x15f1('0x1b')]||null:null,'limit':_0x2b80bd['options']?_0x2b80bd[_0x15f1('0x18')][_0x15f1('0x1c')]||null:null})[_0x15f1('0x1d')](function(_0x1c9f1e){logger[_0x15f1('0x13')](_0x15f1('0x15'),_0x2b80bd);logger['debug'](_0x15f1('0x15'),_0x2b80bd,JSON[_0x15f1('0x10')](_0x1c9f1e));_0x5c5d79(_0x1c9f1e);})[_0x15f1('0x1e')](function(_0x2c0e52){logger[_0x15f1('0x11')](_0x15f1('0x15'),_0x2c0e52[_0x15f1('0x12')],_0x2b80bd);_0x2d03ba(_0x57315a[_0x15f1('0x11')](0x1f4,_0x2c0e52[_0x15f1('0x12')]));});});}; \ No newline at end of file +var _0x480b=['request\x20sent','debug','stringify','error','message','info','result','catch','UpdateMailApplication','MailApplication','body','raw','options','where','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','MailApplication,\x20%s,\x20%s'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x480b,0x16e));var _0xb480=function(_0x2ca6cf,_0x4cdbc9){_0x2ca6cf=_0x2ca6cf-0x0;var _0x1f1ba3=_0x480b[_0x2ca6cf];return _0x1f1ba3;};'use strict';var _=require('lodash');var util=require(_0xb480('0x0'));var moment=require(_0xb480('0x1'));var BPromise=require('bluebird');var rs=require(_0xb480('0x2'));var fs=require('fs');var Redis=require(_0xb480('0x3'));var db=require(_0xb480('0x4'))['db'];var utils=require(_0xb480('0x5'));var logger=require(_0xb480('0x6'))('rpc');var config=require(_0xb480('0x7'));var jayson=require(_0xb480('0x8'));var client=jayson['client'][_0xb480('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x78246f,_0xdc85c2,_0x43de80){return new BPromise(function(_0x2e6e3b,_0x1ff6d2){return client['request'](_0x78246f,_0x43de80)[_0xb480('0xa')](function(_0x256ef){logger['info'](_0xb480('0xb'),_0xdc85c2,_0xb480('0xc'));logger[_0xb480('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0xdc85c2,_0xb480('0xc'),JSON[_0xb480('0xe')](_0x256ef));if(_0x256ef[_0xb480('0xf')]){if(_0x256ef['error']['code']===0x1f4){logger['error'](_0xb480('0xb'),_0xdc85c2,_0x256ef[_0xb480('0xf')]['message']);return _0x1ff6d2(_0x256ef['error'][_0xb480('0x10')]);}logger[_0xb480('0xf')](_0xb480('0xb'),_0xdc85c2,_0x256ef[_0xb480('0xf')][_0xb480('0x10')]);return _0x2e6e3b(_0x256ef['error'][_0xb480('0x10')]);}else{logger[_0xb480('0x11')](_0xb480('0xb'),_0xdc85c2,_0xb480('0xc'));_0x2e6e3b(_0x256ef[_0xb480('0x12')][_0xb480('0x10')]);}})[_0xb480('0x13')](function(_0x592ea8){logger[_0xb480('0xf')](_0xb480('0xb'),_0xdc85c2,_0x592ea8);_0x1ff6d2(_0x592ea8);});});}exports[_0xb480('0x14')]=function(_0x410c56){var _0x27d0ca=this;return new Promise(function(_0x5cc250,_0x19e96b){return db[_0xb480('0x15')]['update'](_0x410c56[_0xb480('0x16')],{'raw':_0x410c56['options']?_0x410c56['options'][_0xb480('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x410c56[_0xb480('0x18')]?_0x410c56[_0xb480('0x18')][_0xb480('0x19')]||null:null,'attributes':_0x410c56[_0xb480('0x18')]?_0x410c56[_0xb480('0x18')]['attributes']||null:null,'limit':_0x410c56['options']?_0x410c56[_0xb480('0x18')][_0xb480('0x1a')]||null:null})['then'](function(_0xbf776e){logger[_0xb480('0x11')](_0xb480('0x14'),_0x410c56);logger[_0xb480('0xd')]('UpdateMailApplication',_0x410c56,JSON[_0xb480('0xe')](_0xbf776e));_0x5cc250(_0xbf776e);})[_0xb480('0x13')](function(_0x4332d4){logger['error'](_0xb480('0x14'),_0x4332d4['message'],_0x410c56);_0x19e96b(_0x27d0ca['error'](0x1f4,_0x4332d4[_0xb480('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 7d53eee..6c1f291 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 _0xfe94=['update','delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','addMessage','post','/:id/tags','mail','mailinteraction:addtags','put','/:id','tracked','mailinteraction:update'];(function(_0x5c7c77,_0x2f2936){var _0x2288be=function(_0x2ad53b){while(--_0x2ad53b){_0x5c7c77['push'](_0x5c7c77['shift']());}};_0x2288be(++_0x2f2936);}(_0xfe94,0xed));var _0x4fe9=function(_0x2c4de5,_0x16a160){_0x2c4de5=_0x2c4de5-0x0;var _0x24de48=_0xfe94[_0x2c4de5];return _0x24de48;};'use strict';var express=require(_0x4fe9('0x0'));var router=express[_0x4fe9('0x1')]();var auth=require(_0x4fe9('0x2'));var interaction=require(_0x4fe9('0x3'));var controller=require(_0x4fe9('0x4'));router['get']('/',auth[_0x4fe9('0x5')](),controller[_0x4fe9('0x6')]);router[_0x4fe9('0x7')](_0x4fe9('0x8'),auth[_0x4fe9('0x5')](),controller[_0x4fe9('0x9')]);router[_0x4fe9('0x7')]('/:id',auth[_0x4fe9('0x5')](),controller[_0x4fe9('0xa')]);router[_0x4fe9('0x7')](_0x4fe9('0xb'),auth[_0x4fe9('0x5')](),controller[_0x4fe9('0xc')]);router[_0x4fe9('0x7')](_0x4fe9('0xd'),auth[_0x4fe9('0x5')](),controller[_0x4fe9('0xe')]);router['post']('/',auth[_0x4fe9('0x5')](),controller['create']);router['post'](_0x4fe9('0xb'),auth[_0x4fe9('0x5')](),controller[_0x4fe9('0xf')]);router[_0x4fe9('0x10')](_0x4fe9('0x11'),auth[_0x4fe9('0x5')](),interaction['tracked'](_0x4fe9('0x12'),_0x4fe9('0x13')),controller['addTags']);router[_0x4fe9('0x14')](_0x4fe9('0x15'),auth[_0x4fe9('0x5')](),interaction[_0x4fe9('0x16')](_0x4fe9('0x12'),_0x4fe9('0x17')),controller[_0x4fe9('0x18')]);router[_0x4fe9('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x4fe9('0x16')](_0x4fe9('0x12'),_0x4fe9('0x1a')),controller['destroy']);router[_0x4fe9('0x19')](_0x4fe9('0x11'),auth['isAuthenticated'](),controller[_0x4fe9('0x1b')]);module[_0x4fe9('0x1c')]=router; \ No newline at end of file +var _0x9743=['destroy','removeTags','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','delete','mailinteraction:destroy'];(function(_0x320240,_0x581d18){var _0x289c17=function(_0x13bd33){while(--_0x13bd33){_0x320240['push'](_0x320240['shift']());}};_0x289c17(++_0x581d18);}(_0x9743,0x1b2));var _0x3974=function(_0x8c777a,_0x2609cd){_0x8c777a=_0x8c777a-0x0;var _0x268475=_0x9743[_0x8c777a];return _0x268475;};'use strict';var express=require(_0x3974('0x0'));var router=express['Router']();var auth=require(_0x3974('0x1'));var interaction=require(_0x3974('0x2'));var controller=require(_0x3974('0x3'));router[_0x3974('0x4')]('/',auth[_0x3974('0x5')](),controller[_0x3974('0x6')]);router[_0x3974('0x4')](_0x3974('0x7'),auth[_0x3974('0x5')](),controller[_0x3974('0x8')]);router['get'](_0x3974('0x9'),auth[_0x3974('0x5')](),controller[_0x3974('0xa')]);router['get'](_0x3974('0xb'),auth[_0x3974('0x5')](),controller[_0x3974('0xc')]);router['get'](_0x3974('0xd'),auth[_0x3974('0x5')](),controller[_0x3974('0xe')]);router[_0x3974('0xf')]('/',auth[_0x3974('0x5')](),controller[_0x3974('0x10')]);router['post']('/:id/messages',auth[_0x3974('0x5')](),controller['addMessage']);router[_0x3974('0xf')](_0x3974('0x11'),auth[_0x3974('0x5')](),interaction[_0x3974('0x12')](_0x3974('0x13'),_0x3974('0x14')),controller[_0x3974('0x15')]);router['put'](_0x3974('0x9'),auth[_0x3974('0x5')](),interaction[_0x3974('0x12')]('mail',_0x3974('0x16')),controller['update']);router[_0x3974('0x17')](_0x3974('0x9'),auth[_0x3974('0x5')](),interaction[_0x3974('0x12')](_0x3974('0x13'),_0x3974('0x18')),controller[_0x3974('0x19')]);router[_0x3974('0x17')](_0x3974('0x11'),auth[_0x3974('0x5')](),controller[_0x3974('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index b06080b..76d7e70 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 _0x0b7b=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','out','ENUM'];(function(_0x97ec0e,_0x10eb67){var _0x1fd9dd=function(_0x187652){while(--_0x187652){_0x97ec0e['push'](_0x97ec0e['shift']());}};_0x1fd9dd(++_0x10eb67);}(_0x0b7b,0x13b));var _0xb0b7=function(_0x239f30,_0x4dbad1){_0x239f30=_0x239f30-0x0;var _0x575926=_0x0b7b[_0x239f30];return _0x575926;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xb0b7('0x0'));module[_0xb0b7('0x1')]={'closed':{'type':Sequelize[_0xb0b7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb0b7('0x3')]},'disposition':{'type':Sequelize[_0xb0b7('0x4')]},'secondDisposition':{'type':Sequelize[_0xb0b7('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb0b7('0x4')]},'note':{'type':Sequelize[_0xb0b7('0x4')]},'inReplyTo':{'type':Sequelize[_0xb0b7('0x4')](0x1fe)},'to':{'type':Sequelize[_0xb0b7('0x4')]},'cc':{'type':Sequelize[_0xb0b7('0x5')](_0xb0b7('0x6'))},'subject':{'type':Sequelize[_0xb0b7('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb0b7('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xb0b7('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb0b7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb0b7('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb0b7('0x8')]('in',_0xb0b7('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb0b7('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x70d9=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out','sequelize'];(function(_0x521dfb,_0x159743){var _0x1bda2e=function(_0x195246){while(--_0x195246){_0x521dfb['push'](_0x521dfb['shift']());}};_0x1bda2e(++_0x159743);}(_0x70d9,0xb3));var _0x970d=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x70d9[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x970d('0x0'));var iconv=require(_0x970d('0x1'));module[_0x970d('0x2')]={'closed':{'type':Sequelize[_0x970d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x970d('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x970d('0x5')]},'thirdDisposition':{'type':Sequelize[_0x970d('0x5')]},'note':{'type':Sequelize[_0x970d('0x5')]},'inReplyTo':{'type':Sequelize[_0x970d('0x5')](0x1fe)},'to':{'type':Sequelize[_0x970d('0x5')]},'cc':{'type':Sequelize[_0x970d('0x6')]('long')},'subject':{'type':Sequelize[_0x970d('0x6')]()},'attach':{'type':Sequelize[_0x970d('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x970d('0x4')]},'substatus':{'type':Sequelize[_0x970d('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x970d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x970d('0x7')]('in',_0x970d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x970d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x970d('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 0e32e45..a7577f6 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 _0x3f05=['mailInteractionTags:save','removeTags','download','toString','files','tmp','join','root','server','attachments','transcript-%d-%s.zip','push','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','decode','headers','Bcc','basename','readFileSync','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','sendStatus','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','error','name','index','fieldName','type','mail','user','catch','show','model','MailInteraction','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','params','describe','MailMessage','addMessage','ids','omit','getMessages','findOne','keys','nolimit','sort','where','pick','MailInteractionId','filter','map','$gte','split','format','findAll','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit'];(function(_0x213f91,_0x8f3782){var _0x5cf677=function(_0x469754){while(--_0x469754){_0x213f91['push'](_0x213f91['shift']());}};_0x5cf677(++_0x8f3782);}(_0x3f05,0xfa));var _0x53f0=function(_0x325155,_0x5d4450){_0x325155=_0x325155-0x0;var _0x284d00=_0x3f05[_0x325155];return _0x284d00;};'use strict';var emlformat=require(_0x53f0('0x0'));var rimraf=require(_0x53f0('0x1'));var zipdir=require(_0x53f0('0x2'));var moment=require(_0x53f0('0x3'));var BPromise=require(_0x53f0('0x4'));var util=require('util');var path=require(_0x53f0('0x5'));var fs=require('fs');var _=require(_0x53f0('0x6'));var juice=require(_0x53f0('0x7'));var Redis=require(_0x53f0('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x53f0('0x9'));var logger=require('../../config/logger')(_0x53f0('0xa'));var config=require(_0x53f0('0xb'));var db=require(_0x53f0('0xc'))['db'];var htmlEntities=require(_0x53f0('0xd'));config[_0x53f0('0xe')]=_[_0x53f0('0xf')](config[_0x53f0('0xe')],{'host':_0x53f0('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x53f0('0x11'))['register'](socket);function respondWithStatusCode(_0x513570,_0x5b873e){_0x5b873e=_0x5b873e||0xcc;return function(_0x5b0ec7){if(_0x5b0ec7){return _0x513570[_0x53f0('0x12')](_0x5b873e);}return _0x513570[_0x53f0('0x13')](_0x5b873e)['end']();};}function respondWithResult(_0x3b5e39,_0x1762b7){_0x1762b7=_0x1762b7||0xc8;return function(_0x35da4a){if(_0x35da4a){return _0x3b5e39[_0x53f0('0x13')](_0x1762b7)[_0x53f0('0x14')](_0x35da4a);}};}function respondWithFilteredResult(_0x281b01,_0x4df3ab){return function(_0x332de6){if(_0x332de6){var _0x1305e7=typeof _0x4df3ab[_0x53f0('0x15')]==='undefined'&&typeof _0x4df3ab[_0x53f0('0x16')]===_0x53f0('0x17');var _0x41a678=_0x332de6[_0x53f0('0x18')];var _0xc1c15d=_0x1305e7?0x0:_0x4df3ab[_0x53f0('0x15')];var _0x5ec66c=_0x1305e7?_0x332de6[_0x53f0('0x18')]:_0x4df3ab[_0x53f0('0x15')]+_0x4df3ab['limit'];var _0x4a40ab;if(_0x5ec66c>=_0x41a678){_0x5ec66c=_0x41a678;_0x4a40ab=0xc8;}else{_0x4a40ab=0xce;}_0x281b01['status'](_0x4a40ab);return _0x281b01['set'](_0x53f0('0x19'),_0xc1c15d+'-'+_0x5ec66c+'/'+_0x41a678)[_0x53f0('0x14')](_0x332de6);}return null;};}function saveUpdates(_0x1315f0){return function(_0x15aac5){if(_0x15aac5){return _0x15aac5[_0x53f0('0x1a')](_0x1315f0)[_0x53f0('0x1b')](function(_0x2fdf53){return _0x2fdf53;});}return null;};}function removeEntity(_0x332acf){return function(_0x5418ab){if(_0x5418ab){return _0x5418ab[_0x53f0('0x1c')]()[_0x53f0('0x1b')](function(){_0x332acf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28988d){return function(_0x4f0ac4){if(!_0x4f0ac4){_0x28988d['sendStatus'](0x194);}return _0x4f0ac4;};}function handleError(_0xcc8398,_0x36e377){_0x36e377=_0x36e377||0x1f4;return function(_0x15a629){logger[_0x53f0('0x1d')](_0x15a629['stack']);if(_0x15a629[_0x53f0('0x1e')]){delete _0x15a629[_0x53f0('0x1e')];}_0xcc8398[_0x53f0('0x13')](_0x36e377)['send'](_0x15a629);};}exports[_0x53f0('0x1f')]=function(_0x3a9ebf,_0x433c1a){var _0x2630a2={};var _0x21276e=_['map'](db['MailInteraction']['rawAttributes'],function(_0x20a907){return{'name':_0x20a907[_0x53f0('0x20')],'type':_0x20a907[_0x53f0('0x21')]['key']};});_0x2630a2=qs['getOptions'](_0x21276e,_0x3a9ebf);return interaction['findAll'](_0x53f0('0x22'),_0x3a9ebf['query'],_0x3a9ebf[_0x53f0('0x23')],_0x2630a2,_0x21276e)[_0x53f0('0x1b')](respondWithFilteredResult(_0x433c1a,_0x2630a2))[_0x53f0('0x24')](handleError(_0x433c1a,null));};exports[_0x53f0('0x25')]=function(_0x343b95,_0x2a51e8){var _0x1c1e10={'raw':![],'where':{'id':_0x343b95['params']['id']}},_0x126738={};_0x126738[_0x53f0('0x26')]=_['keys'](db[_0x53f0('0x27')][_0x53f0('0x28')]);_0x126738[_0x53f0('0x29')]=_['keys'](_0x343b95[_0x53f0('0x29')]);_0x126738[_0x53f0('0x2a')]=_['intersection'](_0x126738[_0x53f0('0x26')],_0x126738[_0x53f0('0x29')]);_0x1c1e10[_0x53f0('0x2b')]=_[_0x53f0('0x2c')](_0x126738['model'],qs[_0x53f0('0x2d')](_0x343b95[_0x53f0('0x29')][_0x53f0('0x2d')]));_0x1c1e10[_0x53f0('0x2b')]=_0x1c1e10['attributes'][_0x53f0('0x2e')]?_0x1c1e10[_0x53f0('0x2b')]:_0x126738[_0x53f0('0x26')];if(_0x343b95['query'][_0x53f0('0x2f')]){_0x1c1e10[_0x53f0('0x30')]=[{'all':!![]}];}_0x1c1e10=_[_0x53f0('0x31')]({},_0x1c1e10,_0x343b95[_0x53f0('0x32')]);return db[_0x53f0('0x27')][_0x53f0('0x33')](_0x1c1e10)['then'](handleEntityNotFound(_0x2a51e8,null))['then'](respondWithResult(_0x2a51e8,null))[_0x53f0('0x24')](handleError(_0x2a51e8,null));};exports[_0x53f0('0x34')]=function(_0x4050d1,_0x5d89fa){return db[_0x53f0('0x27')][_0x53f0('0x34')](_0x4050d1[_0x53f0('0x35')],{})[_0x53f0('0x1b')](respondWithResult(_0x5d89fa,0xc9))['catch'](handleError(_0x5d89fa,null));};exports[_0x53f0('0x1a')]=function(_0x3d0cae,_0x225bf1){if(_0x3d0cae['body']['id']){delete _0x3d0cae[_0x53f0('0x35')]['id'];}return db['MailInteraction'][_0x53f0('0x33')]({'where':{'id':_0x3d0cae[_0x53f0('0x36')]['id']}})['then'](handleEntityNotFound(_0x225bf1,null))[_0x53f0('0x1b')](saveUpdates(_0x3d0cae[_0x53f0('0x35')],null))[_0x53f0('0x1b')](respondWithResult(_0x225bf1,null))[_0x53f0('0x24')](handleError(_0x225bf1,null));};exports['destroy']=function(_0x3c702e,_0x41d5cb){return db[_0x53f0('0x27')][_0x53f0('0x33')]({'where':{'id':_0x3c702e[_0x53f0('0x36')]['id']}})[_0x53f0('0x1b')](handleEntityNotFound(_0x41d5cb,null))[_0x53f0('0x1b')](removeEntity(_0x41d5cb,null))['catch'](handleError(_0x41d5cb,null));};exports[_0x53f0('0x37')]=function(_0x6fbd94,_0x469282){return db[_0x53f0('0x27')][_0x53f0('0x37')]()[_0x53f0('0x1b')](respondWithResult(_0x469282,null))['catch'](handleError(_0x469282,null));};exports['addMessage']=function(_0xbaa73e,_0x46916a){return db[_0x53f0('0x38')][_0x53f0('0x33')]({'where':{'id':_0xbaa73e[_0x53f0('0x36')]['id']}})[_0x53f0('0x1b')](handleEntityNotFound(_0x46916a,null))[_0x53f0('0x1b')](function(_0x25825b){if(_0x25825b){return _0x25825b[_0x53f0('0x39')](_0xbaa73e['body'][_0x53f0('0x3a')],_[_0x53f0('0x3b')](_0xbaa73e[_0x53f0('0x35')],[_0x53f0('0x3a'),'id'])||{});}})[_0x53f0('0x1b')](respondWithResult(_0x46916a,null))['catch'](handleError(_0x46916a,null));};exports[_0x53f0('0x3c')]=function(_0x3d2d69,_0x469331){var _0x5a16a3={'raw':![],'where':{}};var _0x42017d={};var _0x1d6a95={'count':0x0,'rows':[]};return db[_0x53f0('0x27')][_0x53f0('0x3d')]({'where':{'id':_0x3d2d69['params']['id']}})[_0x53f0('0x1b')](handleEntityNotFound(_0x469331,null))[_0x53f0('0x1b')](function(_0xa125f7){if(_0xa125f7){_0x42017d[_0x53f0('0x26')]=_[_0x53f0('0x3e')](db[_0x53f0('0x38')]['rawAttributes']);_0x42017d[_0x53f0('0x29')]=_['keys'](_0x3d2d69[_0x53f0('0x29')]);_0x42017d['filters']=_[_0x53f0('0x2c')](_0x42017d[_0x53f0('0x26')],_0x42017d[_0x53f0('0x29')]);_0x5a16a3[_0x53f0('0x2b')]=_[_0x53f0('0x2c')](_0x42017d['model'],qs[_0x53f0('0x2d')](_0x3d2d69['query'][_0x53f0('0x2d')]));_0x5a16a3[_0x53f0('0x2b')]=_0x5a16a3[_0x53f0('0x2b')]['length']?_0x5a16a3[_0x53f0('0x2b')]:_0x42017d[_0x53f0('0x26')];if(!_0x3d2d69['query']['hasOwnProperty'](_0x53f0('0x3f'))){_0x5a16a3['limit']=qs[_0x53f0('0x16')](_0x3d2d69[_0x53f0('0x29')][_0x53f0('0x16')]);_0x5a16a3[_0x53f0('0x15')]=qs[_0x53f0('0x15')](_0x3d2d69['query'][_0x53f0('0x15')]);}_0x5a16a3['order']=qs['sort'](_0x3d2d69[_0x53f0('0x29')][_0x53f0('0x40')]);_0x5a16a3[_0x53f0('0x41')]=qs['filters'](_[_0x53f0('0x42')](_0x3d2d69['query'],_0x42017d[_0x53f0('0x2a')]));_0x5a16a3[_0x53f0('0x41')][_0x53f0('0x43')]=_0xa125f7['id'];if(_0x3d2d69[_0x53f0('0x29')][_0x53f0('0x44')]){_0x5a16a3[_0x53f0('0x41')]=_['merge'](_0x5a16a3[_0x53f0('0x41')],{'$or':_[_0x53f0('0x45')](_0x5a16a3[_0x53f0('0x2b')],function(_0x5355ae){var _0x44fead={};_0x44fead[_0x5355ae]={'$like':'%'+_0x3d2d69[_0x53f0('0x29')]['filter']+'%'};return _0x44fead;})});}if(_0x3d2d69[_0x53f0('0x29')]['$gte']){var _0x3cccf6=_0x3d2d69['query'][_0x53f0('0x46')][_0x53f0('0x47')](',');var _0x3606de={};_0x3606de[_0x3cccf6[0x0]]={'$gte':moment(_0x3cccf6[0x1])[_0x53f0('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5a16a3[_0x53f0('0x41')]=_[_0x53f0('0x31')](_0x5a16a3[_0x53f0('0x41')],_0x3606de);}_0x5a16a3=_[_0x53f0('0x31')]({},_0x5a16a3,_0x3d2d69[_0x53f0('0x32')]);return db[_0x53f0('0x38')]['count']({'where':_0x5a16a3[_0x53f0('0x41')]})[_0x53f0('0x1b')](function(_0x18d80a){_0x1d6a95['count']=_0x18d80a;if(_0x3d2d69[_0x53f0('0x29')][_0x53f0('0x2f')]){_0x5a16a3[_0x53f0('0x30')]=[{'all':!![]}];}return db['MailMessage'][_0x53f0('0x49')](_0x5a16a3);})[_0x53f0('0x1b')](function(_0x3d090d){if(_0x3d2d69[_0x53f0('0x29')][_0x53f0('0x4a')]===_0x53f0('0x4b')){for(var _0x1351f4=0x0;_0x1351f4<_0x3d090d[_0x53f0('0x2e')];_0x1351f4++){_0x3d090d[_0x1351f4][_0x53f0('0x35')]=juice(_0x3d090d[_0x1351f4][_0x53f0('0x35')]);}}_0x1d6a95[_0x53f0('0x4c')]=_0x3d090d;return _0x1d6a95;});}})[_0x53f0('0x1b')](respondWithFilteredResult(_0x469331,_0x5a16a3))[_0x53f0('0x24')](handleError(_0x469331,null));};exports[_0x53f0('0x4d')]=function(_0x37e7b8,_0x3b2587){return db[_0x53f0('0x27')][_0x53f0('0x33')]({'where':{'id':_0x37e7b8[_0x53f0('0x36')]['id']}})[_0x53f0('0x1b')](handleEntityNotFound(_0x3b2587,null))[_0x53f0('0x1b')](function(_0x53cbdd){if(_0x53cbdd){return _0x53cbdd[_0x53f0('0x4e')](_0x37e7b8[_0x53f0('0x35')][_0x53f0('0x3a')],_['omit'](_0x37e7b8['body'],[_0x53f0('0x3a'),'id'])||{})[_0x53f0('0x4f')](function(){return db[_0x53f0('0x50')][_0x53f0('0x49')]({'attributes':['id',_0x53f0('0x1e'),_0x53f0('0x51')],'where':{'id':_0x37e7b8[_0x53f0('0x35')]['ids']}});})[_0x53f0('0x1b')](function(_0x2dd510){socket[_0x53f0('0x52')](_0x53f0('0x53'),{'id':Number(_0x37e7b8[_0x53f0('0x36')]['id']),'tags':_0x2dd510||[]});return{'id':Number(_0x37e7b8[_0x53f0('0x36')]['id']),'tags':_0x2dd510||[]};});}})['then'](respondWithResult(_0x3b2587,null))[_0x53f0('0x24')](handleError(_0x3b2587,null));};exports[_0x53f0('0x54')]=function(_0xcab300,_0x54a764){return db[_0x53f0('0x27')][_0x53f0('0x33')]({'where':{'id':_0xcab300['params']['id']}})[_0x53f0('0x1b')](handleEntityNotFound(_0x54a764,null))[_0x53f0('0x1b')](function(_0x6fa5b9){if(_0x6fa5b9){return _0x6fa5b9[_0x53f0('0x54')](_0xcab300[_0x53f0('0x29')][_0x53f0('0x3a')]);}})['then'](respondWithStatusCode(_0x54a764,null))[_0x53f0('0x24')](handleError(_0x54a764,null));};exports[_0x53f0('0x55')]=function(_0x25707c,_0x35d311){var _0x396355=moment()['unix']()[_0x53f0('0x56')]();var _0x30653e=path['join'](config['root'],'server',_0x53f0('0x57'),_0x53f0('0x58'));var _0x5e0501=path[_0x53f0('0x59')](config[_0x53f0('0x5a')],_0x53f0('0x5b'),_0x53f0('0x57'),_0x53f0('0x5c'));var _0x3c983c=path[_0x53f0('0x59')](_0x30653e,_0x396355);var _0x2adb3d=util[_0x53f0('0x48')](_0x53f0('0x5d'),_0x25707c[_0x53f0('0x36')]['id'],_0x396355);var _0x190e54=path[_0x53f0('0x59')](_0x30653e,_0x2adb3d);var _0x4c2c62=[];if(_0x25707c[_0x53f0('0x29')]['attachments']){_0x4c2c62[_0x53f0('0x5e')]({'model':db['Attachment'],'as':_0x53f0('0x5f'),'raw':!![]});}var _0x53aedf=[{'model':db[_0x53f0('0x38')],'as':_0x53f0('0x60'),'attributes':['id',_0x53f0('0x35'),'from','to','cc',_0x53f0('0x61'),_0x53f0('0x62'),_0x53f0('0x63')],'where':{'secret':![]},'order':qs[_0x53f0('0x40')]('id'),'include':_0x4c2c62}];return db[_0x53f0('0x27')][_0x53f0('0x33')]({'where':{'id':_0x25707c['params']['id']},'include':_0x53aedf})['then'](handleEntityNotFound(_0x35d311,null))[_0x53f0('0x1b')](function(_0x3d853f){if(_0x3d853f&&_0x3d853f['Messages']){var _0xd027d3=_0x3d853f[_0x53f0('0x64')]({'plain':!![]});fs[_0x53f0('0x65')](_0x3c983c);return BPromise[_0x53f0('0x66')](_0xd027d3[_0x53f0('0x60')],function(_0x67251e,_0x7984f0){var _0x1dd617={'from':_0x67251e[_0x53f0('0x67')],'to':_0x67251e['to']||'missing.recipient@your.company.com','subject':_0x67251e[_0x53f0('0x62')],'html':htmlEntities[_0x53f0('0x68')](_0x67251e[_0x53f0('0x35')]),'headers':{'Date':moment(_0x67251e[_0x53f0('0x63')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x67251e['cc']){_0x1dd617[_0x53f0('0x69')]['Cc']=_0x67251e['cc'];}if(_0x67251e[_0x53f0('0x61')]){_0x1dd617[_0x53f0('0x69')][_0x53f0('0x6a')]=_0x67251e[_0x53f0('0x61')];}return new BPromise(function(_0x30a0bf,_0x3c7446){if(_0x67251e[_0x53f0('0x5f')]){for(var _0x1ecf6e=0x0;_0x1ecf6e<_0x67251e[_0x53f0('0x5f')][_0x53f0('0x2e')];_0x1ecf6e++){var _0x4e60ca=_0x67251e[_0x53f0('0x5f')][_0x1ecf6e];var _0x3661f3=path['join'](_0x5e0501,_0x4e60ca[_0x53f0('0x6b')]);if(fs['existsSync'](_0x3661f3)){_0x1dd617[_0x53f0('0x5c')][_0x53f0('0x5e')]({'name':_0x4e60ca[_0x53f0('0x1e')],'contentType':_0x4e60ca[_0x53f0('0x21')],'data':fs[_0x53f0('0x6c')](_0x3661f3)});}}}emlformat['build'](_0x1dd617,function(_0x10c58f,_0xff1d3){if(_0x10c58f)return _0x3c7446(_0x10c58f);fs[_0x53f0('0x6d')](path[_0x53f0('0x59')](_0x3c983c,util[_0x53f0('0x48')](_0x53f0('0x6e'),_0x7984f0)),_0xff1d3);return _0x30a0bf(_0xff1d3);});});})[_0x53f0('0x1b')](function(){return new BPromise(function(_0x1f7751,_0xa4faeb){zipdir(_0x3c983c,{'saveTo':_0x190e54},function(_0x3aad08,_0x1a6f5a){if(_0x3aad08)return _0xa4faeb(_0x3aad08);return _0x1f7751(_0x1a6f5a);});})[_0x53f0('0x1b')](function(){return new BPromise(function(_0x4d7781,_0x5cfe09){rimraf(_0x3c983c,function(_0x15d281){if(_0x15d281)_0x5cfe09(_0x15d281);return _0x4d7781();});});})['then'](function(){return _0x35d311['download'](_0x190e54,_0x2adb3d,function(_0x5ef59c){if(!_0x5ef59c)fs['unlinkSync'](_0x190e54);});});});}else{return _0x35d311[_0x53f0('0x12')](0xc8);}})[_0x53f0('0x24')](handleError(_0x35d311,null));}; \ No newline at end of file +var _0x91dc=['addMessage','MailMessage','ids','getMessages','findOne','filters','nolimit','order','where','MailInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','inlineCss','true','rows','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','from','bcc','subject','createdAt','Messages','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','download','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','stack','name','send','index','MailInteraction','fieldName','type','key','getOptions','mail','user','then','catch','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','find','create','body','describe'];(function(_0x308f43,_0x525cfe){var _0x53f0cc=function(_0x1a768e){while(--_0x1a768e){_0x308f43['push'](_0x308f43['shift']());}};_0x53f0cc(++_0x525cfe);}(_0x91dc,0xad));var _0xc91d=function(_0x2528f4,_0x9ccff9){_0x2528f4=_0x2528f4-0x0;var _0x120ea3=_0x91dc[_0x2528f4];return _0x120ea3;};'use strict';var emlformat=require(_0xc91d('0x0'));var rimraf=require(_0xc91d('0x1'));var zipdir=require(_0xc91d('0x2'));var moment=require('moment');var BPromise=require(_0xc91d('0x3'));var util=require(_0xc91d('0x4'));var path=require(_0xc91d('0x5'));var fs=require('fs');var _=require(_0xc91d('0x6'));var juice=require(_0xc91d('0x7'));var Redis=require(_0xc91d('0x8'));var interaction=require(_0xc91d('0x9'));var qs=require(_0xc91d('0xa'));var logger=require(_0xc91d('0xb'))('api');var config=require(_0xc91d('0xc'));var db=require(_0xc91d('0xd'))['db'];var htmlEntities=require(_0xc91d('0xe'));config[_0xc91d('0xf')]=_['defaults'](config['redis'],{'host':_0xc91d('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc91d('0xf')]));require(_0xc91d('0x11'))[_0xc91d('0x12')](socket);function respondWithStatusCode(_0x2f1310,_0x1f7c8b){_0x1f7c8b=_0x1f7c8b||0xcc;return function(_0x59e21e){if(_0x59e21e){return _0x2f1310[_0xc91d('0x13')](_0x1f7c8b);}return _0x2f1310[_0xc91d('0x14')](_0x1f7c8b)[_0xc91d('0x15')]();};}function respondWithResult(_0x58396c,_0x16432c){_0x16432c=_0x16432c||0xc8;return function(_0x38cb59){if(_0x38cb59){return _0x58396c[_0xc91d('0x14')](_0x16432c)[_0xc91d('0x16')](_0x38cb59);}};}function respondWithFilteredResult(_0x5501f2,_0x533365){return function(_0x262df9){if(_0x262df9){var _0x4b5d24=typeof _0x533365[_0xc91d('0x17')]===_0xc91d('0x18')&&typeof _0x533365['limit']==='undefined';var _0x5c4092=_0x262df9[_0xc91d('0x19')];var _0x401253=_0x4b5d24?0x0:_0x533365[_0xc91d('0x17')];var _0x1e083c=_0x4b5d24?_0x262df9[_0xc91d('0x19')]:_0x533365['offset']+_0x533365[_0xc91d('0x1a')];var _0x28944f;if(_0x1e083c>=_0x5c4092){_0x1e083c=_0x5c4092;_0x28944f=0xc8;}else{_0x28944f=0xce;}_0x5501f2[_0xc91d('0x14')](_0x28944f);return _0x5501f2[_0xc91d('0x1b')](_0xc91d('0x1c'),_0x401253+'-'+_0x1e083c+'/'+_0x5c4092)[_0xc91d('0x16')](_0x262df9);}return null;};}function saveUpdates(_0x4ccddb){return function(_0x41212c){if(_0x41212c){return _0x41212c[_0xc91d('0x1d')](_0x4ccddb)['then'](function(_0x1a919e){return _0x1a919e;});}return null;};}function removeEntity(_0x341230){return function(_0x216d22){if(_0x216d22){return _0x216d22[_0xc91d('0x1e')]()['then'](function(){_0x341230['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xac685f){return function(_0x309680){if(!_0x309680){_0xac685f[_0xc91d('0x13')](0x194);}return _0x309680;};}function handleError(_0xefb353,_0x282ee5){_0x282ee5=_0x282ee5||0x1f4;return function(_0x1c8980){logger['error'](_0x1c8980[_0xc91d('0x1f')]);if(_0x1c8980[_0xc91d('0x20')]){delete _0x1c8980['name'];}_0xefb353[_0xc91d('0x14')](_0x282ee5)[_0xc91d('0x21')](_0x1c8980);};}exports[_0xc91d('0x22')]=function(_0x16b44b,_0x1da967){var _0x51dc21={};var _0x4d57a1=_['map'](db[_0xc91d('0x23')]['rawAttributes'],function(_0x1e6e09){return{'name':_0x1e6e09[_0xc91d('0x24')],'type':_0x1e6e09[_0xc91d('0x25')][_0xc91d('0x26')]};});_0x51dc21=qs[_0xc91d('0x27')](_0x4d57a1,_0x16b44b);return interaction['findAll'](_0xc91d('0x28'),_0x16b44b['query'],_0x16b44b[_0xc91d('0x29')],_0x51dc21,_0x4d57a1)[_0xc91d('0x2a')](respondWithFilteredResult(_0x1da967,_0x51dc21))[_0xc91d('0x2b')](handleError(_0x1da967,null));};exports['show']=function(_0x47d950,_0x2e0fd2){var _0xbbbdc={'raw':![],'where':{'id':_0x47d950[_0xc91d('0x2c')]['id']}},_0x20f565={};_0x20f565[_0xc91d('0x2d')]=_[_0xc91d('0x2e')](db[_0xc91d('0x23')][_0xc91d('0x2f')]);_0x20f565[_0xc91d('0x30')]=_[_0xc91d('0x2e')](_0x47d950[_0xc91d('0x30')]);_0x20f565['filters']=_[_0xc91d('0x31')](_0x20f565[_0xc91d('0x2d')],_0x20f565[_0xc91d('0x30')]);_0xbbbdc[_0xc91d('0x32')]=_['intersection'](_0x20f565['model'],qs[_0xc91d('0x33')](_0x47d950[_0xc91d('0x30')][_0xc91d('0x33')]));_0xbbbdc[_0xc91d('0x32')]=_0xbbbdc[_0xc91d('0x32')][_0xc91d('0x34')]?_0xbbbdc[_0xc91d('0x32')]:_0x20f565[_0xc91d('0x2d')];if(_0x47d950[_0xc91d('0x30')][_0xc91d('0x35')]){_0xbbbdc[_0xc91d('0x36')]=[{'all':!![]}];}_0xbbbdc=_['merge']({},_0xbbbdc,_0x47d950['options']);return db['MailInteraction'][_0xc91d('0x37')](_0xbbbdc)['then'](handleEntityNotFound(_0x2e0fd2,null))[_0xc91d('0x2a')](respondWithResult(_0x2e0fd2,null))[_0xc91d('0x2b')](handleError(_0x2e0fd2,null));};exports[_0xc91d('0x38')]=function(_0x5c7d07,_0x317ff8){return db['MailInteraction'][_0xc91d('0x38')](_0x5c7d07[_0xc91d('0x39')],{})['then'](respondWithResult(_0x317ff8,0xc9))[_0xc91d('0x2b')](handleError(_0x317ff8,null));};exports[_0xc91d('0x1d')]=function(_0x5d3f85,_0x1d983d){if(_0x5d3f85['body']['id']){delete _0x5d3f85['body']['id'];}return db['MailInteraction'][_0xc91d('0x37')]({'where':{'id':_0x5d3f85['params']['id']}})['then'](handleEntityNotFound(_0x1d983d,null))[_0xc91d('0x2a')](saveUpdates(_0x5d3f85[_0xc91d('0x39')],null))['then'](respondWithResult(_0x1d983d,null))['catch'](handleError(_0x1d983d,null));};exports[_0xc91d('0x1e')]=function(_0x4b0130,_0x523781){return db[_0xc91d('0x23')]['find']({'where':{'id':_0x4b0130[_0xc91d('0x2c')]['id']}})[_0xc91d('0x2a')](handleEntityNotFound(_0x523781,null))[_0xc91d('0x2a')](removeEntity(_0x523781,null))[_0xc91d('0x2b')](handleError(_0x523781,null));};exports[_0xc91d('0x3a')]=function(_0x34a340,_0x148f01){return db['MailInteraction'][_0xc91d('0x3a')]()[_0xc91d('0x2a')](respondWithResult(_0x148f01,null))[_0xc91d('0x2b')](handleError(_0x148f01,null));};exports[_0xc91d('0x3b')]=function(_0x135412,_0x192f14){return db[_0xc91d('0x3c')][_0xc91d('0x37')]({'where':{'id':_0x135412[_0xc91d('0x2c')]['id']}})[_0xc91d('0x2a')](handleEntityNotFound(_0x192f14,null))[_0xc91d('0x2a')](function(_0x4204d9){if(_0x4204d9){return _0x4204d9[_0xc91d('0x3b')](_0x135412[_0xc91d('0x39')]['ids'],_['omit'](_0x135412['body'],[_0xc91d('0x3d'),'id'])||{});}})[_0xc91d('0x2a')](respondWithResult(_0x192f14,null))[_0xc91d('0x2b')](handleError(_0x192f14,null));};exports[_0xc91d('0x3e')]=function(_0x348446,_0x5616c4){var _0x3923ff={'raw':![],'where':{}};var _0x49057d={};var _0x27646d={'count':0x0,'rows':[]};return db[_0xc91d('0x23')][_0xc91d('0x3f')]({'where':{'id':_0x348446[_0xc91d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5616c4,null))['then'](function(_0x28efbd){if(_0x28efbd){_0x49057d[_0xc91d('0x2d')]=_[_0xc91d('0x2e')](db['MailMessage'][_0xc91d('0x2f')]);_0x49057d['query']=_[_0xc91d('0x2e')](_0x348446[_0xc91d('0x30')]);_0x49057d[_0xc91d('0x40')]=_[_0xc91d('0x31')](_0x49057d['model'],_0x49057d[_0xc91d('0x30')]);_0x3923ff[_0xc91d('0x32')]=_[_0xc91d('0x31')](_0x49057d[_0xc91d('0x2d')],qs[_0xc91d('0x33')](_0x348446[_0xc91d('0x30')][_0xc91d('0x33')]));_0x3923ff[_0xc91d('0x32')]=_0x3923ff['attributes'][_0xc91d('0x34')]?_0x3923ff[_0xc91d('0x32')]:_0x49057d[_0xc91d('0x2d')];if(!_0x348446['query']['hasOwnProperty'](_0xc91d('0x41'))){_0x3923ff['limit']=qs[_0xc91d('0x1a')](_0x348446['query']['limit']);_0x3923ff['offset']=qs[_0xc91d('0x17')](_0x348446[_0xc91d('0x30')]['offset']);}_0x3923ff[_0xc91d('0x42')]=qs['sort'](_0x348446[_0xc91d('0x30')]['sort']);_0x3923ff['where']=qs['filters'](_['pick'](_0x348446[_0xc91d('0x30')],_0x49057d[_0xc91d('0x40')]));_0x3923ff[_0xc91d('0x43')][_0xc91d('0x44')]=_0x28efbd['id'];if(_0x348446['query'][_0xc91d('0x45')]){_0x3923ff[_0xc91d('0x43')]=_[_0xc91d('0x46')](_0x3923ff[_0xc91d('0x43')],{'$or':_['map'](_0x3923ff[_0xc91d('0x32')],function(_0x4dca6a){var _0x32574c={};_0x32574c[_0x4dca6a]={'$like':'%'+_0x348446[_0xc91d('0x30')][_0xc91d('0x45')]+'%'};return _0x32574c;})});}if(_0x348446[_0xc91d('0x30')][_0xc91d('0x47')]){var _0x2de3c5=_0x348446[_0xc91d('0x30')]['$gte'][_0xc91d('0x48')](',');var _0x2e8434={};_0x2e8434[_0x2de3c5[0x0]]={'$gte':moment(_0x2de3c5[0x1])[_0xc91d('0x49')](_0xc91d('0x4a'))};_0x3923ff[_0xc91d('0x43')]=_[_0xc91d('0x46')](_0x3923ff[_0xc91d('0x43')],_0x2e8434);}_0x3923ff=_[_0xc91d('0x46')]({},_0x3923ff,_0x348446[_0xc91d('0x4b')]);return db['MailMessage'][_0xc91d('0x19')]({'where':_0x3923ff[_0xc91d('0x43')]})[_0xc91d('0x2a')](function(_0x38b5c2){_0x27646d[_0xc91d('0x19')]=_0x38b5c2;if(_0x348446[_0xc91d('0x30')]['includeAll']){_0x3923ff[_0xc91d('0x36')]=[{'all':!![]}];}return db[_0xc91d('0x3c')][_0xc91d('0x4c')](_0x3923ff);})[_0xc91d('0x2a')](function(_0xe245b6){if(_0x348446[_0xc91d('0x30')][_0xc91d('0x4d')]===_0xc91d('0x4e')){for(var _0x401b77=0x0;_0x401b77<_0xe245b6[_0xc91d('0x34')];_0x401b77++){_0xe245b6[_0x401b77][_0xc91d('0x39')]=juice(_0xe245b6[_0x401b77]['body']);}}_0x27646d[_0xc91d('0x4f')]=_0xe245b6;return _0x27646d;});}})['then'](respondWithFilteredResult(_0x5616c4,_0x3923ff))['catch'](handleError(_0x5616c4,null));};exports[_0xc91d('0x50')]=function(_0x58f665,_0x1b520a){return db['MailInteraction'][_0xc91d('0x37')]({'where':{'id':_0x58f665[_0xc91d('0x2c')]['id']}})[_0xc91d('0x2a')](handleEntityNotFound(_0x1b520a,null))[_0xc91d('0x2a')](function(_0x14870f){if(_0x14870f){return _0x14870f[_0xc91d('0x51')](_0x58f665[_0xc91d('0x39')][_0xc91d('0x3d')],_['omit'](_0x58f665[_0xc91d('0x39')],['ids','id'])||{})['spread'](function(){return db[_0xc91d('0x52')]['findAll']({'attributes':['id',_0xc91d('0x20'),_0xc91d('0x53')],'where':{'id':_0x58f665[_0xc91d('0x39')][_0xc91d('0x3d')]}});})['then'](function(_0x18074f){socket[_0xc91d('0x54')](_0xc91d('0x55'),{'id':Number(_0x58f665[_0xc91d('0x2c')]['id']),'tags':_0x18074f||[]});return{'id':Number(_0x58f665[_0xc91d('0x2c')]['id']),'tags':_0x18074f||[]};});}})[_0xc91d('0x2a')](respondWithResult(_0x1b520a,null))[_0xc91d('0x2b')](handleError(_0x1b520a,null));};exports[_0xc91d('0x56')]=function(_0x4b1609,_0x588127){return db[_0xc91d('0x23')][_0xc91d('0x37')]({'where':{'id':_0x4b1609['params']['id']}})[_0xc91d('0x2a')](handleEntityNotFound(_0x588127,null))[_0xc91d('0x2a')](function(_0x24f7f1){if(_0x24f7f1){return _0x24f7f1[_0xc91d('0x56')](_0x4b1609[_0xc91d('0x30')][_0xc91d('0x3d')]);}})[_0xc91d('0x2a')](respondWithStatusCode(_0x588127,null))[_0xc91d('0x2b')](handleError(_0x588127,null));};exports['download']=function(_0x39345a,_0x44ddbf){var _0xb40ae0=moment()[_0xc91d('0x57')]()[_0xc91d('0x58')]();var _0x5f5ce4=path[_0xc91d('0x59')](config['root'],'server',_0xc91d('0x5a'),_0xc91d('0x5b'));var _0x2feac9=path[_0xc91d('0x59')](config[_0xc91d('0x5c')],_0xc91d('0x5d'),_0xc91d('0x5a'),_0xc91d('0x5e'));var _0x579c5d=path['join'](_0x5f5ce4,_0xb40ae0);var _0x2fee04=util[_0xc91d('0x49')](_0xc91d('0x5f'),_0x39345a['params']['id'],_0xb40ae0);var _0x2cbd94=path[_0xc91d('0x59')](_0x5f5ce4,_0x2fee04);var _0xd9c6ca=[];if(_0x39345a[_0xc91d('0x30')][_0xc91d('0x5e')]){_0xd9c6ca[_0xc91d('0x60')]({'model':db[_0xc91d('0x61')],'as':_0xc91d('0x62'),'raw':!![]});}var _0x507f72=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0xc91d('0x39'),_0xc91d('0x63'),'to','cc',_0xc91d('0x64'),_0xc91d('0x65'),_0xc91d('0x66')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0xd9c6ca}];return db['MailInteraction'][_0xc91d('0x37')]({'where':{'id':_0x39345a['params']['id']},'include':_0x507f72})[_0xc91d('0x2a')](handleEntityNotFound(_0x44ddbf,null))[_0xc91d('0x2a')](function(_0xfc331d){if(_0xfc331d&&_0xfc331d[_0xc91d('0x67')]){var _0x6abe95=_0xfc331d[_0xc91d('0x68')]({'plain':!![]});fs['mkdirSync'](_0x579c5d);return BPromise[_0xc91d('0x69')](_0x6abe95['Messages'],function(_0x4baa18,_0x59527c){var _0x483478={'from':_0x4baa18[_0xc91d('0x63')],'to':_0x4baa18['to']||'missing.recipient@your.company.com','subject':_0x4baa18[_0xc91d('0x65')],'html':htmlEntities[_0xc91d('0x6a')](_0x4baa18[_0xc91d('0x39')]),'headers':{'Date':moment(_0x4baa18['createdAt'])[_0xc91d('0x49')](_0xc91d('0x6b'))},'attachments':[]};if(_0x4baa18['cc']){_0x483478[_0xc91d('0x6c')]['Cc']=_0x4baa18['cc'];}if(_0x4baa18[_0xc91d('0x64')]){_0x483478[_0xc91d('0x6c')][_0xc91d('0x6d')]=_0x4baa18[_0xc91d('0x64')];}return new BPromise(function(_0x315a45,_0x286f8c){if(_0x4baa18[_0xc91d('0x62')]){for(var _0x9a99a3=0x0;_0x9a99a3<_0x4baa18['Attachments']['length'];_0x9a99a3++){var _0x4bc1fb=_0x4baa18[_0xc91d('0x62')][_0x9a99a3];var _0x1eb17f=path['join'](_0x2feac9,_0x4bc1fb[_0xc91d('0x6e')]);if(fs[_0xc91d('0x6f')](_0x1eb17f)){_0x483478[_0xc91d('0x5e')][_0xc91d('0x60')]({'name':_0x4bc1fb[_0xc91d('0x20')],'contentType':_0x4bc1fb[_0xc91d('0x25')],'data':fs[_0xc91d('0x70')](_0x1eb17f)});}}}emlformat[_0xc91d('0x71')](_0x483478,function(_0x577f72,_0x44e1ad){if(_0x577f72)return _0x286f8c(_0x577f72);fs['writeFileSync'](path[_0xc91d('0x59')](_0x579c5d,util[_0xc91d('0x49')]('message%d.eml',_0x59527c)),_0x44e1ad);return _0x315a45(_0x44e1ad);});});})[_0xc91d('0x2a')](function(){return new BPromise(function(_0x38546c,_0xdf1731){zipdir(_0x579c5d,{'saveTo':_0x2cbd94},function(_0x1ec87b,_0x53f9bf){if(_0x1ec87b)return _0xdf1731(_0x1ec87b);return _0x38546c(_0x53f9bf);});})[_0xc91d('0x2a')](function(){return new BPromise(function(_0xec18a3,_0x5116fe){rimraf(_0x579c5d,function(_0x4244a6){if(_0x4244a6)_0x5116fe(_0x4244a6);return _0xec18a3();});});})[_0xc91d('0x2a')](function(){return _0x44ddbf[_0xc91d('0x72')](_0x2cbd94,_0x2fee04,function(_0x4e1f03){if(!_0x4e1f03)fs[_0xc91d('0x73')](_0x2cbd94);});});});}else{return _0x44ddbf['sendStatus'](0xc8);}})[_0xc91d('0x2b')](handleError(_0x44ddbf,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c5145ff..b2f14dd 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 _0xdd86=['findAll','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x2fe110,_0x42f8d8){var _0x3cbe27=function(_0x3140d8){while(--_0x3140d8){_0x2fe110['push'](_0x2fe110['shift']());}};_0x3cbe27(++_0x42f8d8);}(_0xdd86,0x15d));var _0x6dd8=function(_0x238343,_0x3ba55c){_0x238343=_0x238343-0x0;var _0x38bb9a=_0xdd86[_0x238343];return _0x38bb9a;};'use strict';var EventEmitter=require(_0x6dd8('0x0'));var MailInteraction=require(_0x6dd8('0x1'))['db'][_0x6dd8('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x6dd8('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6dd8('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6dd8('0x5'),'afterDestroy':_0x6dd8('0x6')};function emitEvent(_0x3d3462){return function(_0x1f30a9,_0x16b920,_0x52a55d){_0x1f30a9[_0x6dd8('0x7')]({'attributes':['id'],'raw':!![]})[_0x6dd8('0x8')](function(_0x153d35){_0x1f30a9[_0x6dd8('0x9')](_0x6dd8('0xa'),_0x153d35[_0x6dd8('0xb')](function(_0xbe08f8){return{'id':_0xbe08f8['id']};}));return MailMessage[_0x6dd8('0xc')]({'where':{'MailInteractionId':_0x1f30a9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4bca22){_0x1f30a9[_0x6dd8('0x9')](_0x6dd8('0xd'),_0x4bca22[_0x6dd8('0xe')]);MailInteractionEvents['emit'](_0x3d3462+':'+_0x1f30a9['id'],_0x1f30a9);MailInteractionEvents['emit'](_0x3d3462,_0x1f30a9);_0x52a55d(null);})[_0x6dd8('0xf')](_0x52a55d(null));};}for(var e in events){if(events[_0x6dd8('0x10')](e)){var event=events[e];MailInteraction[_0x6dd8('0x11')](e,emitEvent(event));}}module[_0x6dd8('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x16a6=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update'];(function(_0x4710a5,_0x59128d){var _0x3a0d10=function(_0x73ee2a){while(--_0x73ee2a){_0x4710a5['push'](_0x4710a5['shift']());}};_0x3a0d10(++_0x59128d);}(_0x16a6,0x14e));var _0x616a=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x16a6[_0x5db99b];return _0x4b2d0e;};'use strict';var EventEmitter=require(_0x616a('0x0'));var MailInteraction=require(_0x616a('0x1'))['db'][_0x616a('0x2')];var MailMessage=require(_0x616a('0x1'))['db'][_0x616a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x616a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x616a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2dffbd){return function(_0x51ffc2,_0x51b601,_0x40c9c0){_0x51ffc2['getUsers']({'attributes':['id'],'raw':!![]})[_0x616a('0x6')](function(_0x23da72){_0x51ffc2[_0x616a('0x7')](_0x616a('0x8'),_0x23da72[_0x616a('0x9')](function(_0x1a84df){return{'id':_0x1a84df['id']};}));return MailMessage[_0x616a('0xa')]({'where':{'MailInteractionId':_0x51ffc2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2d0de4){_0x51ffc2[_0x616a('0x7')](_0x616a('0xb'),_0x2d0de4[_0x616a('0xc')]);MailInteractionEvents[_0x616a('0xd')](_0x2dffbd+':'+_0x51ffc2['id'],_0x51ffc2);MailInteractionEvents[_0x616a('0xd')](_0x2dffbd,_0x51ffc2);_0x40c9c0(null);})['catch'](_0x40c9c0(null));};}for(var e in events){if(events[_0x616a('0xe')](e)){var event=events[e];MailInteraction[_0x616a('0xf')](e,emitEvent(event));}}module[_0x616a('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d1ea862..3697a4d 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 _0xdc6c=['closedAt','changed','substatus','get','utf8mb4','lodash','util','moment','bluebird','path','../../config/environment','exports','define','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0x8d585c,_0x1c32b3){var _0x192077=function(_0x2ac0c6){while(--_0x2ac0c6){_0x8d585c['push'](_0x8d585c['shift']());}};_0x192077(++_0x1c32b3);}(_0xdc6c,0x69));var _0xcdc6=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xdc6c[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0xcdc6('0x0'));var util=require(_0xcdc6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcdc6('0x2'));var BPromise=require(_0xcdc6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdc6('0x4'));var rimraf=require('rimraf');var config=require(_0xcdc6('0x5'));var attributes=require('./mailInteraction.attributes');module[_0xcdc6('0x6')]=function(_0x3a9f95,_0x8047da){return _0x3a9f95[_0xcdc6('0x7')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xcdc6('0x8'),'fields':[_0xcdc6('0x9'),'to'],'type':_0xcdc6('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59e119,_0x11faa8,_0x191099){if(_0x59e119['substatus']){_0x59e119[_0xcdc6('0xb')]=moment()[_0xcdc6('0xc')](_0xcdc6('0xd'));}if(_0x59e119[_0xcdc6('0xe')]){_0x59e119[_0xcdc6('0xf')]=moment()[_0xcdc6('0xc')](_0xcdc6('0xd'));}_0x191099(null,_0x11faa8);},'beforeUpdate':function(_0x2bbc23,_0x1e6670,_0x32962f){if(_0x2bbc23[_0xcdc6('0x10')](_0xcdc6('0x11'))){_0x2bbc23['substatusAt']=_0x2bbc23[_0xcdc6('0x11')]?moment()[_0xcdc6('0xc')](_0xcdc6('0xd')):null;}if(_0x2bbc23[_0xcdc6('0x10')](_0xcdc6('0xe'))){_0x2bbc23[_0xcdc6('0xf')]=moment()[_0xcdc6('0xc')](_0xcdc6('0xd'));_0x2bbc23[_0xcdc6('0x11')]=null;_0x2bbc23[_0xcdc6('0xb')]=null;}_0x32962f(null,_0x2bbc23);},'afterUpdate':function(_0x1f92ad,_0x1e414a,_0x18293d){var _0x1a71e0=_0x3a9f95['models'];var _0x4fe128=_0x1f92ad[_0xcdc6('0x12')]({'plain':!![]});if(_0x4fe128[_0xcdc6('0xe')]){return _0x1a71e0['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x4fe128['id']}})['then'](function(){_0x18293d();})['catch'](function(_0xad0410){_0x18293d(_0xad0410);});}else{_0x18293d();}}},'charset':_0xcdc6('0x13'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4b71=['models','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','util','bluebird','request-promise','path','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed'];(function(_0x44dbd2,_0x5ab76b){var _0x17f240=function(_0x128ec3){while(--_0x128ec3){_0x44dbd2['push'](_0x44dbd2['shift']());}};_0x17f240(++_0x5ab76b);}(_0x4b71,0x90));var _0x14b7=function(_0x466755,_0xf412e1){_0x466755=_0x466755-0x0;var _0x3d111a=_0x4b71[_0x466755];return _0x3d111a;};'use strict';var _=require('lodash');var util=require(_0x14b7('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x14b7('0x1'));var rp=require(_0x14b7('0x2'));var fs=require('fs');var path=require(_0x14b7('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x14b7('0x4')]=function(_0x475e85,_0x49f6f){return _0x475e85[_0x14b7('0x5')](_0x14b7('0x6'),attributes,{'tableName':_0x14b7('0x7'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x14b7('0x8'),'to'],'type':_0x14b7('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2617b7,_0x1b3e8c,_0x7591fa){if(_0x2617b7[_0x14b7('0xa')]){_0x2617b7[_0x14b7('0xb')]=moment()[_0x14b7('0xc')](_0x14b7('0xd'));}if(_0x2617b7['closed']){_0x2617b7[_0x14b7('0xe')]=moment()[_0x14b7('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x7591fa(null,_0x1b3e8c);},'beforeUpdate':function(_0x2ea998,_0x52b074,_0x9c4fee){if(_0x2ea998[_0x14b7('0xf')](_0x14b7('0xa'))){_0x2ea998['substatusAt']=_0x2ea998[_0x14b7('0xa')]?moment()[_0x14b7('0xc')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2ea998[_0x14b7('0xf')](_0x14b7('0x10'))){_0x2ea998[_0x14b7('0xe')]=moment()[_0x14b7('0xc')](_0x14b7('0xd'));_0x2ea998['substatus']=null;_0x2ea998['substatusAt']=null;}_0x9c4fee(null,_0x2ea998);},'afterUpdate':function(_0x4b738b,_0x17fb1e,_0x152021){var _0x8a5ed6=_0x475e85[_0x14b7('0x11')];var _0x4ed0f9=_0x4b738b['get']({'plain':!![]});if(_0x4ed0f9[_0x14b7('0x10')]){return _0x8a5ed6[_0x14b7('0x12')][_0x14b7('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x4ed0f9['id']}})['then'](function(){_0x152021();})[_0x14b7('0x14')](function(_0x546ada){_0x152021(_0x546ada);});}else{_0x152021();}}},'charset':_0x14b7('0x15'),'collate':_0x14b7('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 9ab7414..ec28632 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 _0x39b5=['spread','AddTags','moment','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','addTags','omit','ids'];(function(_0x21a6f0,_0x34f377){var _0x394ada=function(_0x523061){while(--_0x523061){_0x21a6f0['push'](_0x21a6f0['shift']());}};_0x394ada(++_0x34f377);}(_0x39b5,0x1ba));var _0x539b=function(_0x3398a6,_0x4cacfc){_0x3398a6=_0x3398a6-0x0;var _0x4e2459=_0x39b5[_0x3398a6];return _0x4e2459;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x539b('0x0'));var BPromise=require('bluebird');var rs=require(_0x539b('0x1'));var fs=require('fs');var Redis=require(_0x539b('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x539b('0x3'))('rpc');var config=require(_0x539b('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x539b('0x5')][_0x539b('0x6')]({'port':0x232a});config[_0x539b('0x7')]=_[_0x539b('0x8')](config[_0x539b('0x7')],{'host':_0x539b('0x9'),'port':0x18eb});var socket=require(_0x539b('0xa'))(new Redis(config['redis']));require(_0x539b('0xb'))[_0x539b('0xc')](socket);function respondWithRpcPromise(_0x1c531d,_0x372ac1,_0x37cb22){return new BPromise(function(_0x1c2427,_0x129ca5){return client[_0x539b('0xd')](_0x1c531d,_0x37cb22)[_0x539b('0xe')](function(_0x120a8e){logger[_0x539b('0xf')](_0x539b('0x10'),_0x372ac1,_0x539b('0x11'));logger[_0x539b('0x12')](_0x539b('0x13'),_0x372ac1,_0x539b('0x11'),JSON[_0x539b('0x14')](_0x120a8e));if(_0x120a8e[_0x539b('0x15')]){if(_0x120a8e[_0x539b('0x15')][_0x539b('0x16')]===0x1f4){logger[_0x539b('0x15')]('MailInteraction,\x20%s,\x20%s',_0x372ac1,_0x120a8e[_0x539b('0x15')][_0x539b('0x17')]);return _0x129ca5(_0x120a8e[_0x539b('0x15')][_0x539b('0x17')]);}logger[_0x539b('0x15')](_0x539b('0x10'),_0x372ac1,_0x120a8e['error'][_0x539b('0x17')]);return _0x1c2427(_0x120a8e[_0x539b('0x15')][_0x539b('0x17')]);}else{logger['info'](_0x539b('0x10'),_0x372ac1,_0x539b('0x11'));_0x1c2427(_0x120a8e['result'][_0x539b('0x17')]);}})[_0x539b('0x18')](function(_0x489cd3){logger[_0x539b('0x15')](_0x539b('0x10'),_0x372ac1,_0x489cd3);_0x129ca5(_0x489cd3);});});}exports[_0x539b('0x19')]=function(_0x324c6d){var _0x8e5675=this;return new Promise(function(_0x48da41,_0x1d5402){return db[_0x539b('0x1a')][_0x539b('0x1b')](_0x324c6d[_0x539b('0x1c')],{'raw':_0x324c6d[_0x539b('0x1d')]?_0x324c6d[_0x539b('0x1d')][_0x539b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x324c6d[_0x539b('0x1d')]?_0x324c6d[_0x539b('0x1d')][_0x539b('0x1f')]||null:null,'attributes':_0x324c6d[_0x539b('0x1d')]?_0x324c6d[_0x539b('0x1d')][_0x539b('0x20')]||null:null,'limit':_0x324c6d[_0x539b('0x1d')]?_0x324c6d[_0x539b('0x1d')][_0x539b('0x21')]||null:null})[_0x539b('0xe')](function(_0x44554c){logger['info'](_0x539b('0x19'),_0x324c6d);logger[_0x539b('0x12')](_0x539b('0x19'),_0x324c6d,JSON[_0x539b('0x14')](_0x44554c));_0x48da41(_0x44554c);})[_0x539b('0x18')](function(_0x639be2){logger[_0x539b('0x15')](_0x539b('0x19'),_0x639be2[_0x539b('0x17')],_0x324c6d);_0x1d5402(_0x8e5675[_0x539b('0x15')](0x1f4,_0x639be2[_0x539b('0x17')]));});});};exports[_0x539b('0x22')]=function(_0x30a517){return new Promise(function(_0x56e7d8,_0x182c9b){return db[_0x539b('0x1a')]['find']({'where':_0x30a517[_0x539b('0x1d')]?_0x30a517['options']['where']||null:null})[_0x539b('0xe')](function(_0x622375){if(_0x622375){return _0x622375[_0x539b('0x23')](_0x30a517['body']['ids'],_[_0x539b('0x24')](_0x30a517['body'],[_0x539b('0x25'),'id'])||{});}})[_0x539b('0x26')](function(_0x335c80){logger[_0x539b('0xf')](_0x539b('0x27'),_0x30a517);logger[_0x539b('0x12')]('AddTags',_0x30a517,JSON[_0x539b('0x14')](_0x335c80));_0x56e7d8(_0x335c80);})[_0x539b('0x18')](function(_0x5c290b){logger[_0x539b('0x15')](_0x539b('0x27'),_0x5c290b['message'],_0x30a517);_0x182c9b(_this[_0x539b('0x15')](0x1f4,_0x5c290b[_0x539b('0x17')]));});});}; \ No newline at end of file +var _0x36b6=['socket.io-emitter','./mailInteraction.socket','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateMailInteraction','body','options','raw','attributes','limit','MailInteraction','find','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x10bbb8,_0x19e2eb){var _0x2026a0=function(_0x36420e){while(--_0x36420e){_0x10bbb8['push'](_0x10bbb8['shift']());}};_0x2026a0(++_0x19e2eb);}(_0x36b6,0x13a));var _0x636b=function(_0x43bee1,_0x10ad81){_0x43bee1=_0x43bee1-0x0;var _0x2fedfd=_0x36b6[_0x43bee1];return _0x2fedfd;};'use strict';var _=require(_0x636b('0x0'));var util=require(_0x636b('0x1'));var moment=require(_0x636b('0x2'));var BPromise=require(_0x636b('0x3'));var rs=require(_0x636b('0x4'));var fs=require('fs');var Redis=require(_0x636b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x636b('0x6'));var logger=require(_0x636b('0x7'))('rpc');var config=require(_0x636b('0x8'));var jayson=require(_0x636b('0x9'));var client=jayson[_0x636b('0xa')][_0x636b('0xb')]({'port':0x232a});config[_0x636b('0xc')]=_[_0x636b('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x636b('0xe'))(new Redis(config['redis']));require(_0x636b('0xf'))[_0x636b('0x10')](socket);function respondWithRpcPromise(_0x194d35,_0x17f029,_0x335202){return new BPromise(function(_0x1a9458,_0x9b7d57){return client['request'](_0x194d35,_0x335202)[_0x636b('0x11')](function(_0x44b913){logger['info'](_0x636b('0x12'),_0x17f029,_0x636b('0x13'));logger[_0x636b('0x14')](_0x636b('0x15'),_0x17f029,_0x636b('0x13'),JSON[_0x636b('0x16')](_0x44b913));if(_0x44b913['error']){if(_0x44b913[_0x636b('0x17')]['code']===0x1f4){logger[_0x636b('0x17')]('MailInteraction,\x20%s,\x20%s',_0x17f029,_0x44b913[_0x636b('0x17')][_0x636b('0x18')]);return _0x9b7d57(_0x44b913['error'][_0x636b('0x18')]);}logger[_0x636b('0x17')](_0x636b('0x12'),_0x17f029,_0x44b913[_0x636b('0x17')][_0x636b('0x18')]);return _0x1a9458(_0x44b913[_0x636b('0x17')][_0x636b('0x18')]);}else{logger[_0x636b('0x19')](_0x636b('0x12'),_0x17f029,'request\x20sent');_0x1a9458(_0x44b913[_0x636b('0x1a')][_0x636b('0x18')]);}})[_0x636b('0x1b')](function(_0x39ad09){logger[_0x636b('0x17')]('MailInteraction,\x20%s,\x20%s',_0x17f029,_0x39ad09);_0x9b7d57(_0x39ad09);});});}exports[_0x636b('0x1c')]=function(_0x13bdfe){var _0x32edd7=this;return new Promise(function(_0x3cdfa9,_0x1d3b59){return db['MailInteraction']['update'](_0x13bdfe[_0x636b('0x1d')],{'raw':_0x13bdfe[_0x636b('0x1e')]?_0x13bdfe['options'][_0x636b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13bdfe[_0x636b('0x1e')]?_0x13bdfe['options']['where']||null:null,'attributes':_0x13bdfe[_0x636b('0x1e')]?_0x13bdfe[_0x636b('0x1e')][_0x636b('0x20')]||null:null,'limit':_0x13bdfe[_0x636b('0x1e')]?_0x13bdfe[_0x636b('0x1e')][_0x636b('0x21')]||null:null})['then'](function(_0xca2ad9){logger[_0x636b('0x19')](_0x636b('0x1c'),_0x13bdfe);logger[_0x636b('0x14')](_0x636b('0x1c'),_0x13bdfe,JSON[_0x636b('0x16')](_0xca2ad9));_0x3cdfa9(_0xca2ad9);})['catch'](function(_0xb2a375){logger[_0x636b('0x17')](_0x636b('0x1c'),_0xb2a375['message'],_0x13bdfe);_0x1d3b59(_0x32edd7[_0x636b('0x17')](0x1f4,_0xb2a375[_0x636b('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x26e659){return new Promise(function(_0x1f6224,_0x10da22){return db[_0x636b('0x22')][_0x636b('0x23')]({'where':_0x26e659[_0x636b('0x1e')]?_0x26e659[_0x636b('0x1e')][_0x636b('0x24')]||null:null})[_0x636b('0x11')](function(_0x5a00d6){if(_0x5a00d6){return _0x5a00d6[_0x636b('0x25')](_0x26e659[_0x636b('0x1d')][_0x636b('0x26')],_[_0x636b('0x27')](_0x26e659[_0x636b('0x1d')],[_0x636b('0x26'),'id'])||{});}})['spread'](function(_0x14480c){logger[_0x636b('0x19')](_0x636b('0x28'),_0x26e659);logger[_0x636b('0x14')](_0x636b('0x28'),_0x26e659,JSON[_0x636b('0x16')](_0x14480c));_0x1f6224(_0x14480c);})[_0x636b('0x1b')](function(_0xfb3200){logger[_0x636b('0x17')](_0x636b('0x28'),_0xfb3200[_0x636b('0x18')],_0x26e659);_0x10da22(_this[_0x636b('0x17')](0x1f4,_0xfb3200[_0x636b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 47d4493..92e7b89 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 _0x24c0=['removeListener','register','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24c0,0xeb));var _0x024c=function(_0x257d80,_0x5559f2){_0x257d80=_0x257d80-0x0;var _0x1b28d9=_0x24c0[_0x257d80];return _0x1b28d9;};'use strict';var MailInteractionEvents=require(_0x024c('0x0'));var events=[_0x024c('0x1'),_0x024c('0x2'),_0x024c('0x3')];function createListener(_0x8fba5e,_0x164d30){return function(_0x410a0e){_0x164d30[_0x024c('0x4')](_0x8fba5e,_0x410a0e);};}function removeListener(_0x3714f7,_0x33c0b3){return function(){MailInteractionEvents[_0x024c('0x5')](_0x3714f7,_0x33c0b3);};}exports[_0x024c('0x6')]=function(_0x43869d){for(var _0x992077=0x0,_0x454f66=events['length'];_0x992077<_0x454f66;_0x992077++){var _0x52c1e9=events[_0x992077];var _0x5e05e3=createListener(_0x024c('0x7')+_0x52c1e9,_0x43869d);MailInteractionEvents['on'](_0x52c1e9,_0x5e05e3);}}; \ No newline at end of file +var _0xcc7a=['update','emit','register','length','mailInteraction:','save'];(function(_0x29675f,_0x1854a3){var _0x276a54=function(_0x356e0f){while(--_0x356e0f){_0x29675f['push'](_0x29675f['shift']());}};_0x276a54(++_0x1854a3);}(_0xcc7a,0x101));var _0xacc7=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0xcc7a[_0x34b1b8];return _0x542dd8;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xacc7('0x0'),'remove',_0xacc7('0x1')];function createListener(_0x43dbec,_0x37dff){return function(_0x311c5b){_0x37dff[_0xacc7('0x2')](_0x43dbec,_0x311c5b);};}function removeListener(_0x32585c,_0x4af14c){return function(){MailInteractionEvents['removeListener'](_0x32585c,_0x4af14c);};}exports[_0xacc7('0x3')]=function(_0x415ec0){for(var _0x1efa0c=0x0,_0x349758=events[_0xacc7('0x4')];_0x1efa0c<_0x349758;_0x1efa0c++){var _0x281694=events[_0x1efa0c];var _0x3f9ecc=createListener(_0xacc7('0x5')+_0x281694,_0x415ec0);MailInteractionEvents['on'](_0x281694,_0x3f9ecc);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index b430e84..5245444 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 _0xf12a=['show','post','tracked','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x104a5e,_0x4e20ae){var _0x2830f4=function(_0x1a810e){while(--_0x1a810e){_0x104a5e['push'](_0x104a5e['shift']());}};_0x2830f4(++_0x4e20ae);}(_0xf12a,0x8e));var _0xaf12=function(_0x5497d3,_0x193adf){_0x5497d3=_0x5497d3-0x0;var _0x42f1ef=_0xf12a[_0x5497d3];return _0x42f1ef;};'use strict';var multer=require(_0xaf12('0x0'));var util=require(_0xaf12('0x1'));var path=require(_0xaf12('0x2'));var timeout=require(_0xaf12('0x3'));var express=require(_0xaf12('0x4'));var router=express[_0xaf12('0x5')]();var fs_extra=require(_0xaf12('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf12('0x7'));var controller=require('./mailMessage.controller');router[_0xaf12('0x8')]('/',auth['isAuthenticated'](),controller[_0xaf12('0x9')]);router['get'](_0xaf12('0xa'),auth[_0xaf12('0xb')](),controller[_0xaf12('0xc')]);router[_0xaf12('0x8')](_0xaf12('0xd'),auth[_0xaf12('0xb')](),controller[_0xaf12('0xe')]);router[_0xaf12('0x8')]('/:id/download',auth[_0xaf12('0xb')](),controller['download']);router[_0xaf12('0xf')]('/',auth['isAuthenticated'](),interaction[_0xaf12('0x10')]('mail','mailmessage:create'),controller[_0xaf12('0x11')]);router[_0xaf12('0x12')](_0xaf12('0xd'),auth[_0xaf12('0xb')](),controller[_0xaf12('0x13')]);router[_0xaf12('0x12')](_0xaf12('0x14'),auth[_0xaf12('0xb')](),controller[_0xaf12('0x15')]);router[_0xaf12('0x12')](_0xaf12('0x16'),auth[_0xaf12('0xb')](),controller[_0xaf12('0x17')]);router[_0xaf12('0x18')](_0xaf12('0xd'),auth[_0xaf12('0xb')](),controller[_0xaf12('0x19')]);module['exports']=router; \ No newline at end of file +var _0x570f=['index','/describe','describe','/:id','show','/:id/download','isAuthenticated','download','tracked','mail','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x570f,0x152));var _0xf570=function(_0x5053ff,_0x3fb835){_0x5053ff=_0x5053ff-0x0;var _0x2d4f6c=_0x570f[_0x5053ff];return _0x2d4f6c;};'use strict';var multer=require(_0xf570('0x0'));var util=require(_0xf570('0x1'));var path=require(_0xf570('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf570('0x3')]();var fs_extra=require(_0xf570('0x4'));var auth=require(_0xf570('0x5'));var interaction=require(_0xf570('0x6'));var config=require(_0xf570('0x7'));var controller=require(_0xf570('0x8'));router[_0xf570('0x9')]('/',auth['isAuthenticated'](),controller[_0xf570('0xa')]);router['get'](_0xf570('0xb'),auth['isAuthenticated'](),controller[_0xf570('0xc')]);router['get'](_0xf570('0xd'),auth['isAuthenticated'](),controller[_0xf570('0xe')]);router[_0xf570('0x9')](_0xf570('0xf'),auth[_0xf570('0x10')](),controller[_0xf570('0x11')]);router['post']('/',auth[_0xf570('0x10')](),interaction[_0xf570('0x12')](_0xf570('0x13'),'mailmessage:create'),controller[_0xf570('0x14')]);router[_0xf570('0x15')](_0xf570('0xd'),auth['isAuthenticated'](),controller[_0xf570('0x16')]);router[_0xf570('0x15')](_0xf570('0x17'),auth[_0xf570('0x10')](),controller['accept']);router[_0xf570('0x15')](_0xf570('0x18'),auth[_0xf570('0x10')](),controller[_0xf570('0x19')]);router[_0xf570('0x1a')](_0xf570('0xd'),auth[_0xf570('0x10')](),controller[_0xf570('0x1b')]);module[_0xf570('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index f58e41f..9ef6ba9 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 _0xe5e4=['BOOLEAN','ENUM','out','DATE','INTEGER','Email','Chat','sequelize','exports','TEXT','long'];(function(_0x338c81,_0x566dff){var _0x4b1fa0=function(_0x2254e5){while(--_0x2254e5){_0x338c81['push'](_0x338c81['shift']());}};_0x4b1fa0(++_0x566dff);}(_0xe5e4,0xac));var _0x4e5e=function(_0x162b28,_0x7d1512){_0x162b28=_0x162b28-0x0;var _0x1bfc21=_0xe5e4[_0x162b28];return _0x1bfc21;};'use strict';var Sequelize=require(_0x4e5e('0x0'));var _=require('lodash');module[_0x4e5e('0x1')]={'body':{'type':Sequelize[_0x4e5e('0x2')](_0x4e5e('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x4e5e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4e5e('0x5')]('in',_0x4e5e('0x6')),'defaultValue':_0x4e5e('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x4e5e('0x2')](_0x4e5e('0x3'))},'cc':{'type':Sequelize[_0x4e5e('0x2')](_0x4e5e('0x3'))},'bcc':{'type':Sequelize[_0x4e5e('0x2')](_0x4e5e('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x4e5e('0x7')]},'attach':{'type':Sequelize[_0x4e5e('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4e5e('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4e5e('0x7')]},'originTo':{'type':Sequelize[_0x4e5e('0x2')]('long')},'originCc':{'type':Sequelize[_0x4e5e('0x2')](_0x4e5e('0x3'))},'originChannel':{'type':Sequelize[_0x4e5e('0x5')](_0x4e5e('0x9'),_0x4e5e('0xa')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xe7bf=['DATE','Email','Chat','sequelize','lodash','exports','long','TEXT','medium','ENUM','out','STRING','INTEGER','BOOLEAN'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xe7bf,0x16f));var _0xfe7b=function(_0x484503,_0x217fb4){_0x484503=_0x484503-0x0;var _0x3338d7=_0xe7bf[_0x484503];return _0x3338d7;};'use strict';var Sequelize=require(_0xfe7b('0x0'));var _=require(_0xfe7b('0x1'));module[_0xfe7b('0x2')]={'body':{'type':Sequelize['TEXT'](_0xfe7b('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfe7b('0x4')](_0xfe7b('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfe7b('0x6')]('in',_0xfe7b('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xfe7b('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xfe7b('0x4')](_0xfe7b('0x3'))},'cc':{'type':Sequelize['TEXT'](_0xfe7b('0x3'))},'bcc':{'type':Sequelize[_0xfe7b('0x4')](_0xfe7b('0x3'))},'subject':{'type':Sequelize[_0xfe7b('0x4')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xfe7b('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xfe7b('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xfe7b('0xb')]},'originTo':{'type':Sequelize[_0xfe7b('0x4')]('long')},'originCc':{'type':Sequelize[_0xfe7b('0x4')](_0xfe7b('0x3'))},'originChannel':{'type':Sequelize[_0xfe7b('0x6')](_0xfe7b('0xc'),_0xfe7b('0xd')),'defaultValue':_0xfe7b('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 772b948..4b6ccf5 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 _0x1705=['destroy','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','fields','find','update','body','describe','create','out','secret','MailAccount','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','format','stringify','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','MailInteractionId','isNil','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','contact','SIP/%s','fromString','rejectmessage','unix','join','server','tmp','files','message-%s.eml','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','writeFileSync','download','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','redis','defaults','html-entities','client','http','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','result','status','json','offset','limit','undefined','count','set'];(function(_0x1f80f7,_0x47da0b){var _0x481cf9=function(_0x2e18e0){while(--_0x2e18e0){_0x1f80f7['push'](_0x1f80f7['shift']());}};_0x481cf9(++_0x47da0b);}(_0x1705,0x19d));var _0x5170=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x1705[_0x2a1b33];return _0x4c50e7;};'use strict';var emlformat=require('eml-format');var moment=require(_0x5170('0x0'));var BPromise=require(_0x5170('0x1'));var util=require(_0x5170('0x2'));var path=require(_0x5170('0x3'));var fs=require('fs');var _=require(_0x5170('0x4'));var Redis=require(_0x5170('0x5'));var htmlToText=require(_0x5170('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x5170('0x7'))(_0x5170('0x8'));var interaction_log=require(_0x5170('0x7'))(_0x5170('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x5170('0xa')]=_[_0x5170('0xb')](config[_0x5170('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5170('0xa')]));var htmlEntities=require(_0x5170('0xc'));require('./mailMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5170('0xd')][_0x5170('0xe')]({'port':0x232c});var client9003=jayson[_0x5170('0xd')][_0x5170('0xe')]({'port':0x232b});var client9002=jayson[_0x5170('0xd')][_0x5170('0xe')]({'port':0x232a});function respondWithRpcPromise(_0x3a7747,_0xf483cf,_0x2496e5,_0x5e3eed){return new BPromise(function(_0x2f5abe,_0x584686){var _0x13a42a=_0x5e3eed||client;return _0x13a42a['request'](_0x3a7747,_0x2496e5)[_0x5170('0xf')](function(_0x4a3721){logger[_0x5170('0x10')]('MailMessage,\x20%s,\x20%s',_0xf483cf,_0x5170('0x11'));logger['debug'](_0x5170('0x12'),_0xf483cf,_0x5170('0x11'),JSON['stringify'](_0x4a3721));if(_0x4a3721['error']){if(_0x4a3721[_0x5170('0x13')][_0x5170('0x14')]===0x1f4){logger['error'](_0x5170('0x15'),_0xf483cf,_0x4a3721['error'][_0x5170('0x16')]);return _0x584686(_0x4a3721[_0x5170('0x13')][_0x5170('0x16')]);}logger[_0x5170('0x13')]('MailMessage,\x20%s,\x20%s',_0xf483cf,_0x4a3721['error'][_0x5170('0x16')]);return _0x2f5abe(_0x4a3721[_0x5170('0x13')][_0x5170('0x16')]);}else{logger[_0x5170('0x10')]('MailMessage,\x20%s,\x20%s',_0xf483cf,_0x5170('0x11'));_0x2f5abe(_0x4a3721[_0x5170('0x17')][_0x5170('0x16')]);}})['catch'](function(_0x11b1d2){logger[_0x5170('0x13')](_0x5170('0x15'),_0xf483cf,_0x11b1d2);_0x584686(_0x11b1d2);});});}function respondWithResult(_0x26a232,_0x2d6b64){_0x2d6b64=_0x2d6b64||0xc8;return function(_0x463a86){if(_0x463a86){return _0x26a232[_0x5170('0x18')](_0x2d6b64)[_0x5170('0x19')](_0x463a86);}};}function respondWithFilteredResult(_0x4b1105,_0xa88532){return function(_0x140225){if(_0x140225){var _0x2f9e56=typeof _0xa88532[_0x5170('0x1a')]==='undefined'&&typeof _0xa88532[_0x5170('0x1b')]===_0x5170('0x1c');var _0x32928d=_0x140225['count'];var _0xbf1c9=_0x2f9e56?0x0:_0xa88532['offset'];var _0x4aa98b=_0x2f9e56?_0x140225[_0x5170('0x1d')]:_0xa88532['offset']+_0xa88532[_0x5170('0x1b')];var _0x2ce3e1;if(_0x4aa98b>=_0x32928d){_0x4aa98b=_0x32928d;_0x2ce3e1=0xc8;}else{_0x2ce3e1=0xce;}_0x4b1105[_0x5170('0x18')](_0x2ce3e1);return _0x4b1105[_0x5170('0x1e')]('Content-Range',_0xbf1c9+'-'+_0x4aa98b+'/'+_0x32928d)[_0x5170('0x19')](_0x140225);}return null;};}function saveUpdates(_0x442827){return function(_0x18f13c){if(_0x18f13c){return _0x18f13c['update'](_0x442827)[_0x5170('0xf')](function(_0xe181a2){return _0xe181a2;});}return null;};}function removeEntity(_0x3ba74e){return function(_0x2a4a96){if(_0x2a4a96){return _0x2a4a96[_0x5170('0x1f')]()[_0x5170('0xf')](function(){_0x3ba74e[_0x5170('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc337){return function(_0x3a18c2){if(!_0x3a18c2){_0x2fc337[_0x5170('0x20')](0x194);}return _0x3a18c2;};}function handleError(_0x481004,_0x4fc7af){_0x4fc7af=_0x4fc7af||0x1f4;return function(_0x1cd4b1){logger['error'](_0x1cd4b1[_0x5170('0x21')]);if(_0x1cd4b1[_0x5170('0x22')]){delete _0x1cd4b1[_0x5170('0x22')];}_0x481004[_0x5170('0x18')](_0x4fc7af)[_0x5170('0x23')](_0x1cd4b1);};}exports[_0x5170('0x24')]=function(_0x44bf1d,_0x2b660e){var _0x260abf={},_0x345178={},_0x5bf67e={'count':0x0,'rows':[]};var _0x5a52e1=_[_0x5170('0x25')](db[_0x5170('0x26')][_0x5170('0x27')],function(_0x2a37fb){return{'name':_0x2a37fb['fieldName'],'type':_0x2a37fb[_0x5170('0x28')][_0x5170('0x29')]};});_0x345178['model']=_['map'](_0x5a52e1,_0x5170('0x22'));_0x345178[_0x5170('0x2a')]=_[_0x5170('0x2b')](_0x44bf1d[_0x5170('0x2a')]);_0x345178[_0x5170('0x2c')]=_[_0x5170('0x2d')](_0x345178[_0x5170('0x2e')],_0x345178['query']);_0x260abf[_0x5170('0x2f')]=_[_0x5170('0x2d')](_0x345178['model'],qs['fields'](_0x44bf1d[_0x5170('0x2a')]['fields']));_0x260abf[_0x5170('0x2f')]=_0x260abf['attributes'][_0x5170('0x30')]?_0x260abf[_0x5170('0x2f')]:_0x345178[_0x5170('0x2e')];if(!_0x44bf1d['query']['hasOwnProperty']('nolimit')){_0x260abf[_0x5170('0x1b')]=qs['limit'](_0x44bf1d[_0x5170('0x2a')]['limit']);_0x260abf[_0x5170('0x1a')]=qs[_0x5170('0x1a')](_0x44bf1d[_0x5170('0x2a')]['offset']);}_0x260abf['order']=qs['sort'](_0x44bf1d['query'][_0x5170('0x31')]);_0x260abf['where']=qs[_0x5170('0x2c')](_[_0x5170('0x32')](_0x44bf1d[_0x5170('0x2a')],_0x345178[_0x5170('0x2c')]),_0x5a52e1);if(_0x44bf1d[_0x5170('0x2a')]['filter']){_0x260abf[_0x5170('0x33')]=_[_0x5170('0x34')](_0x260abf['where'],{'$or':_[_0x5170('0x25')](_0x5a52e1,function(_0x59bb16){if(_0x59bb16['type']!==_0x5170('0x35')){var _0x22c047={};_0x22c047[_0x59bb16[_0x5170('0x22')]]={'$like':'%'+_0x44bf1d['query'][_0x5170('0x36')]+'%'};return _0x22c047;}})});}_0x260abf=_['merge']({},_0x260abf,_0x44bf1d['options']);var _0x3f55ba={'where':_0x260abf[_0x5170('0x33')]};return db[_0x5170('0x26')]['count'](_0x3f55ba)[_0x5170('0xf')](function(_0x5e0706){_0x5bf67e[_0x5170('0x1d')]=_0x5e0706;if(_0x44bf1d[_0x5170('0x2a')][_0x5170('0x37')]){_0x260abf[_0x5170('0x38')]=[{'all':!![]}];}return db['MailMessage'][_0x5170('0x39')](_0x260abf);})['then'](function(_0x2592c9){_0x5bf67e[_0x5170('0x3a')]=_0x2592c9;return _0x5bf67e;})['then'](respondWithFilteredResult(_0x2b660e,_0x260abf))[_0x5170('0x3b')](handleError(_0x2b660e,null));};exports[_0x5170('0x3c')]=function(_0x472363,_0xf9e4fc){var _0x2b9580={'raw':!![],'where':{'id':_0x472363[_0x5170('0x3d')]['id']}},_0x27e080={};_0x27e080[_0x5170('0x2e')]=_[_0x5170('0x2b')](db[_0x5170('0x26')][_0x5170('0x27')]);_0x27e080['query']=_[_0x5170('0x2b')](_0x472363[_0x5170('0x2a')]);_0x27e080[_0x5170('0x2c')]=_[_0x5170('0x2d')](_0x27e080[_0x5170('0x2e')],_0x27e080[_0x5170('0x2a')]);_0x2b9580[_0x5170('0x2f')]=_[_0x5170('0x2d')](_0x27e080[_0x5170('0x2e')],qs[_0x5170('0x3e')](_0x472363[_0x5170('0x2a')][_0x5170('0x3e')]));_0x2b9580[_0x5170('0x2f')]=_0x2b9580[_0x5170('0x2f')][_0x5170('0x30')]?_0x2b9580['attributes']:_0x27e080[_0x5170('0x2e')];if(_0x472363[_0x5170('0x2a')][_0x5170('0x37')]){_0x2b9580['include']=[{'all':!![]}];}_0x2b9580=_['merge']({},_0x2b9580,_0x472363['options']);return db[_0x5170('0x26')][_0x5170('0x3f')](_0x2b9580)[_0x5170('0xf')](handleEntityNotFound(_0xf9e4fc,null))[_0x5170('0xf')](respondWithResult(_0xf9e4fc,null))[_0x5170('0x3b')](handleError(_0xf9e4fc,null));};exports[_0x5170('0x40')]=function(_0x31b4a8,_0x22309d){if(_0x31b4a8[_0x5170('0x41')]['id']){delete _0x31b4a8[_0x5170('0x41')]['id'];}return db[_0x5170('0x26')][_0x5170('0x3f')]({'where':{'id':_0x31b4a8[_0x5170('0x3d')]['id']}})[_0x5170('0xf')](handleEntityNotFound(_0x22309d,null))['then'](saveUpdates(_0x31b4a8[_0x5170('0x41')],null))[_0x5170('0xf')](respondWithResult(_0x22309d,null))['catch'](handleError(_0x22309d,null));};exports[_0x5170('0x1f')]=function(_0x303daa,_0x21573d){return db['MailMessage'][_0x5170('0x3f')]({'where':{'id':_0x303daa[_0x5170('0x3d')]['id']}})[_0x5170('0xf')](handleEntityNotFound(_0x21573d,null))[_0x5170('0xf')](removeEntity(_0x21573d,null))[_0x5170('0x3b')](handleError(_0x21573d,null));};exports['describe']=function(_0x45731a,_0x304dce){return db[_0x5170('0x26')][_0x5170('0x42')]()[_0x5170('0xf')](respondWithResult(_0x304dce,null))[_0x5170('0x3b')](handleError(_0x304dce,null));};exports[_0x5170('0x43')]=function(_0x34d363,_0x3ef8fd){return db[_0x5170('0x26')][_0x5170('0x43')](_0x34d363[_0x5170('0x41')])[_0x5170('0xf')](function(_0x19d4d0){if(_0x19d4d0){if(_0x19d4d0['direction']===_0x5170('0x44')&&!_0x19d4d0[_0x5170('0x45')]){var _0x388b9f,_0x3d31ee,_0x16b840;if(_0x34d363[_0x5170('0x41')]['to']){_0x3d31ee=_0x34d363[_0x5170('0x41')]['to']['split'](',')[0x0];}return db[_0x5170('0x46')]['findOne']({'where':{'id':_0x19d4d0['MailAccountId']},'include':[{'model':db[_0x5170('0x47')],'as':_0x5170('0x48'),'include':[{'model':db[_0x5170('0x49')],'as':_0x5170('0x4a'),'where':{'email':_0x3d31ee},'limit':0x1,'order':[[_0x5170('0x4b'),_0x5170('0x4c')]]}]},{'model':db[_0x5170('0x4d')],'as':_0x5170('0x4e'),'raw':!![],'include':[{'model':db[_0x5170('0x4f')],'as':'CloudProvider','raw':!![]}]}]})[_0x5170('0xf')](function(_0x5634b5){_0x388b9f=_0x5634b5;if(!_0x388b9f||!_0x388b9f[_0x5170('0x4e')])return;var _0x309961=_0x388b9f[_0x5170('0x50')]();if(_0x34d363['body'][_0x5170('0x51')]&&_0x34d363['body'][_0x5170('0x51')][_0x5170('0x30')]){for(var _0x51c3a3=0x0;_0x51c3a3<_0x34d363[_0x5170('0x41')]['attachments']['length'];_0x51c3a3+=0x1){_0x34d363['body']['attachments'][_0x51c3a3]={'filename':_0x34d363[_0x5170('0x41')][_0x5170('0x51')][_0x51c3a3][_0x5170('0x22')],'path':path['join'](config[_0x5170('0x52')],_0x5170('0x53'),_0x34d363[_0x5170('0x41')][_0x5170('0x51')][_0x51c3a3][_0x5170('0x54')])};}}_0x16b840={'account':_0x309961,'message':_0x34d363[_0x5170('0x41')]};return;})['then'](function(){if(_0x388b9f[_0x5170('0x48')]){if(_0x388b9f[_0x5170('0x48')][_0x5170('0x4a')][_0x5170('0x30')]){return _0x388b9f[_0x5170('0x48')][_0x5170('0x4a')][0x0];}else{return db[_0x5170('0x49')]['create'](_[_0x5170('0xb')](_0x34d363[_0x5170('0x41')],{'firstName':_0x34d363[_0x5170('0x41')]['to'],'email':_0x34d363['body']['to'],'phone':_0x34d363[_0x5170('0x41')]['to'],'ListId':_0x388b9f['ListId']}));}}else{throw new Error(_0x5170('0x55'));}})[_0x5170('0xf')](function(){if(_0x16b840){return respondWithRpcPromise(_0x5170('0x56'),_0x5170('0x57'),_0x16b840,client9003)['then'](function(_0x438e25){return _0x19d4d0[_0x5170('0x40')]({'read':!![],'messageId':_0x438e25['messageId'],'sentAt':moment()[_0x5170('0x58')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x5170('0x3b')](function(_0x254fc3){logger[_0x5170('0x13')]('%s',JSON[_0x5170('0x59')](_0x254fc3));return _0x19d4d0;});}return _0x19d4d0;});}return _0x19d4d0;}})[_0x5170('0xf')](respondWithResult(_0x3ef8fd,0xc9))[_0x5170('0x3b')](handleError(_0x3ef8fd,null));};exports[_0x5170('0x5a')]=function(_0x2bf714,_0x4fbf4a){var _0x83b293={'agent':{},'channel':'mail'};if(_0x2bf714['body']['id']){delete _0x2bf714[_0x5170('0x41')]['id'];}_0x2bf714[_0x5170('0x41')][_0x5170('0x5b')]=!![];_0x2bf714[_0x5170('0x41')][_0x5170('0x5c')]=moment()['format'](_0x5170('0x5d'));_0x2bf714[_0x5170('0x41')]['UserId']=_0x2bf714[_0x5170('0x41')][_0x5170('0x5e')]||_0x2bf714[_0x5170('0x5f')]['id'];_0x83b293['agent']['id']=_0x2bf714[_0x5170('0x41')][_0x5170('0x5e')];return db[_0x5170('0x26')][_0x5170('0x3f')]({'where':{'id':_0x2bf714['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4fbf4a,null))[_0x5170('0xf')](saveUpdates(_0x2bf714[_0x5170('0x41')],null))[_0x5170('0xf')](function(_0xd2b8cc){if(_0xd2b8cc){_0x83b293[_0x5170('0x16')]=_0xd2b8cc['get']({'plain':!![]});return db['MailInteraction'][_0x5170('0x3f')]({'where':{'id':_0xd2b8cc[_0x5170('0x60')]}});}return null;})[_0x5170('0xf')](handleEntityNotFound(_0x4fbf4a,null))['then'](function(_0x3c539f){if(_0x3c539f){return _0x3c539f['update']({'UserId':_0x2bf714[_0x5170('0x41')][_0x5170('0x5e')],'read1stAt':_[_0x5170('0x61')](_0x3c539f['read1stAt'])?moment()[_0x5170('0x58')](_0x5170('0x5d')):undefined});}return null;})[_0x5170('0xf')](function(_0x3df92d){if(_0x3df92d){_0x83b293['interaction']=_0x3df92d[_0x5170('0x62')]({'plain':!![]});interaction_log[_0x5170('0x10')](_0x5170('0x63'),_0x2bf714['user']['id'],_0x2bf714[_0x5170('0x5f')]['name'],_0x2bf714['user']['role'],_0x83b293[_0x5170('0x64')]['id'],_0x2bf714['body']?JSON['stringify'](_0x2bf714[_0x5170('0x41')]):_0x5170('0x65'));return respondWithRpcPromise(_0x5170('0x66'),_0x5170('0x67'),_0x83b293);}return null;})[_0x5170('0xf')](function(_0x898c23){var _0x3f1c1d=_0x5170('0x68')+_0x898c23[_0x5170('0x16')][_0x5170('0x69')];return db['sequelize'][_0x5170('0x2a')](_0x3f1c1d,{'type':db[_0x5170('0x6a')][_0x5170('0x6b')][_0x5170('0x6c')],'raw':!![]})[_0x5170('0xf')](function(_0x5c836c){return _0x5c836c;});})[_0x5170('0xf')](function(_0x5583be){if(_0x5583be){_0x83b293[_0x5170('0x16')]['contact']=_0x5583be[0x0];if(!_0x2bf714[_0x5170('0x41')][_0x5170('0x5e')])return;return db[_0x5170('0x6d')]['find']({'where':{'id':_0x2bf714[_0x5170('0x41')][_0x5170('0x5e')],'role':_0x5170('0x6e')},'attributes':['id',_0x5170('0x22'),_0x5170('0x6f'),_0x5170('0x70'),_0x5170('0x71')],'raw':!![]});}return null;})['then'](function(_0xdf021c){if(!_0xdf021c)return null;_0x83b293[_0x5170('0x16')]['agent']=_0xdf021c;return _0x83b293;})[_0x5170('0xf')](function(_0x2cf3f1){if(_0x2cf3f1){if(_0x2bf714[_0x5170('0x41')][_0x5170('0x72')]){_0x83b293['message'][_0x5170('0x73')]=util['format']('SIP/%s',_0x2bf714[_0x5170('0x5f')][_0x5170('0x22')]);_0x83b293[_0x5170('0x16')][_0x5170('0x74')]=_0x83b293[_0x5170('0x74')];_0x83b293[_0x5170('0x16')][_0x5170('0x75')]=_0x83b293['channel'];_0x83b293[_0x5170('0x16')][_0x5170('0x76')]=_0x5170('0x5a');_0x83b293[_0x5170('0x16')][_0x5170('0x41')]=htmlToText['fromString'](_0x83b293[_0x5170('0x16')]['body']);return respondWithRpcPromise(_0x5170('0x77'),_0x5170('0x77'),{'event':'acceptmessage','message':_0x83b293[_0x5170('0x16')]},client9002)[_0x5170('0xf')](function(){return _0x83b293;});}return _0x83b293;}return null;})[_0x5170('0xf')](respondWithResult(_0x4fbf4a,null))[_0x5170('0x3b')](handleError(_0x4fbf4a,null));};exports[_0x5170('0x78')]=function(_0x512278,_0xbfceb3){var _0xab4abe={'agent':{},'channel':'mail'};if(_0x512278[_0x5170('0x41')]['id']){delete _0x512278[_0x5170('0x41')]['id'];}_0x512278['body'][_0x5170('0x5e')]=_0x512278[_0x5170('0x41')][_0x5170('0x5e')]||_0x512278[_0x5170('0x5f')]['id'];_0xab4abe[_0x5170('0x6e')]['id']=_0x512278[_0x5170('0x41')][_0x5170('0x5e')];return db[_0x5170('0x26')][_0x5170('0x3f')]({'where':{'id':_0x512278[_0x5170('0x3d')]['id'],'UserId':null}})[_0x5170('0xf')](handleEntityNotFound(_0xbfceb3,null))[_0x5170('0xf')](function(_0x2e9b5f){if(_0x2e9b5f){_0xab4abe[_0x5170('0x16')]=_0x2e9b5f[_0x5170('0x62')]({'plain':!![]});return db[_0x5170('0x79')]['find']({'where':{'id':_0x2e9b5f['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xbfceb3,null))['then'](function(_0x3a9f39){if(_0x3a9f39){_0xab4abe[_0x5170('0x64')]=_0x3a9f39[_0x5170('0x62')]({'plain':!![]});interaction_log[_0x5170('0x10')](_0x5170('0x7a'),_0x512278[_0x5170('0x5f')]['id'],_0x512278[_0x5170('0x5f')][_0x5170('0x22')],_0x512278[_0x5170('0x5f')][_0x5170('0x7b')],_0xab4abe['interaction']['id'],_0x512278[_0x5170('0x41')]?JSON[_0x5170('0x59')](_0x512278[_0x5170('0x41')]):'null');return respondWithRpcPromise(_0x5170('0x7c'),_0x5170('0x7d'),_0xab4abe);}return null;})[_0x5170('0xf')](function(_0x4b7d12){var _0x319bb5=_0x5170('0x68')+_0x4b7d12[_0x5170('0x16')][_0x5170('0x69')];return db['sequelize']['query'](_0x319bb5,{'type':db['Sequelize'][_0x5170('0x6b')][_0x5170('0x6c')],'raw':!![]})[_0x5170('0xf')](function(_0x536d81){return _0x536d81;});})[_0x5170('0xf')](function(_0x3993d9){if(_0x3993d9){_0xab4abe[_0x5170('0x16')][_0x5170('0x7e')]=_0x3993d9[0x0];if(!_0x512278[_0x5170('0x41')][_0x5170('0x5e')])return;return db[_0x5170('0x6d')]['find']({'where':{'id':_0x512278['body'][_0x5170('0x5e')],'role':_0x5170('0x6e')},'attributes':['id',_0x5170('0x22'),'fullname',_0x5170('0x70'),_0x5170('0x71')],'raw':!![]});}return null;})[_0x5170('0xf')](function(_0x1823ee){if(!_0x1823ee)return null;_0xab4abe[_0x5170('0x16')][_0x5170('0x6e')]=_0x1823ee;return _0xab4abe;})['then'](function(_0x418156){if(_0x418156){_0x418156[_0x5170('0x16')]['interface']=util[_0x5170('0x58')](_0x5170('0x7f'),_0x512278[_0x5170('0x5f')][_0x5170('0x22')]);_0x418156[_0x5170('0x16')]['channel']=_0xab4abe['channel'];_0x418156[_0x5170('0x16')][_0x5170('0x75')]=_0xab4abe[_0x5170('0x74')];_0x418156[_0x5170('0x16')][_0x5170('0x76')]=_0x5170('0x78');_0x418156[_0x5170('0x16')][_0x5170('0x41')]=htmlToText[_0x5170('0x80')](_0xab4abe[_0x5170('0x16')][_0x5170('0x41')]);respondWithRpcPromise(_0x5170('0x77'),'EventManager',{'event':_0x5170('0x81'),'message':_0x418156[_0x5170('0x16')]},client9002);return _0xab4abe;}return null;})['then'](respondWithResult(_0xbfceb3,null))[_0x5170('0x3b')](handleError(_0xbfceb3,null));};exports['download']=function(_0x3ece65,_0x461fdb){var _0x3ace3e=moment()[_0x5170('0x82')]()['toString']();var _0x40d796=path[_0x5170('0x83')](config[_0x5170('0x52')],_0x5170('0x84'),'files',_0x5170('0x85'));var _0xd699d8=path['join'](config[_0x5170('0x52')],'server',_0x5170('0x86'),_0x5170('0x51'));var _0x161185=util[_0x5170('0x58')](_0x5170('0x87'),_0x3ace3e);return db[_0x5170('0x26')][_0x5170('0x3f')]({'where':{'id':_0x3ece65[_0x5170('0x3d')]['id']},'attributes':['id',_0x5170('0x41'),'from','to','cc','bcc',_0x5170('0x88'),_0x5170('0x89')],'include':_0x3ece65[_0x5170('0x2a')][_0x5170('0x51')]?[{'model':db[_0x5170('0x8a')],'as':_0x5170('0x8b')}]:undefined})[_0x5170('0xf')](handleEntityNotFound(_0x461fdb,null))[_0x5170('0xf')](function(_0x2dc03e){if(_0x2dc03e){var _0x36fdb1=_0x2dc03e;var _0x195f22={'from':_0x36fdb1['from'],'to':_0x36fdb1['to'],'subject':_0x36fdb1[_0x5170('0x88')],'html':htmlEntities['decode'](_0x36fdb1[_0x5170('0x41')]),'headers':{'Date':moment(_0x36fdb1[_0x5170('0x89')])[_0x5170('0x58')](_0x5170('0x8c'))},'attachments':[]};if(_0x2dc03e['cc']){_0x195f22['headers']['Cc']=_0x2dc03e['cc'];}if(_0x2dc03e['bcc']){_0x195f22['headers'][_0x5170('0x8d')]=_0x2dc03e['bcc'];}return new BPromise(function(_0x23e7ba,_0x51642d){if(_0x2dc03e['Attachments']){for(var _0x2e03f2=0x0;_0x2e03f2<_0x2dc03e[_0x5170('0x8b')][_0x5170('0x30')];_0x2e03f2++){var _0x3e0995=_0x2dc03e['Attachments'][_0x2e03f2];var _0x15d1c8=path['join'](_0xd699d8,_0x3e0995[_0x5170('0x54')]);if(fs[_0x5170('0x8e')](_0x15d1c8)){_0x195f22[_0x5170('0x51')][_0x5170('0x8f')]({'name':_0x3e0995[_0x5170('0x22')],'contentType':_0x3e0995['type'],'data':fs[_0x5170('0x90')](_0x15d1c8)});}}}emlformat['build'](_0x195f22,function(_0xa84862,_0x2b5632){if(_0xa84862)return _0x51642d(_0xa84862);fs[_0x5170('0x91')](path[_0x5170('0x83')](_0x40d796,_0x161185),_0x2b5632);return _0x23e7ba(_0x2b5632);});});}})[_0x5170('0xf')](function(_0x318586){if(_0x318586){return _0x461fdb[_0x5170('0x92')](path[_0x5170('0x83')](_0x40d796,_0x161185),_0x161185,function(_0x58c959){if(!_0x58c959)fs[_0x5170('0x93')](path[_0x5170('0x83')](_0x40d796,_0x161185));});}})[_0x5170('0x3b')](handleError(_0x461fdb,null));}; \ No newline at end of file +var _0xb42f=['[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','Sequelize','event','download','unix','toString','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','stack','name','send','map','MailMessage','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','body','params','find','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','length','join','root','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','readAt','UserId','user','get','MailInteraction','MailInteractionId','isNil','read1stAt','format','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','acceptMessage','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','accept','fromString','EventManager','acceptmessage','reject'];(function(_0x406c07,_0x188e1b){var _0x38722c=function(_0x2ab052){while(--_0x2ab052){_0x406c07['push'](_0x406c07['shift']());}};_0x38722c(++_0x188e1b);}(_0xb42f,0x16c));var _0xfb42=function(_0x3416c3,_0x36c13a){_0x3416c3=_0x3416c3-0x0;var _0x52000e=_0xb42f[_0x3416c3];return _0x52000e;};'use strict';var emlformat=require(_0xfb42('0x0'));var moment=require('moment');var BPromise=require(_0xfb42('0x1'));var util=require(_0xfb42('0x2'));var path=require(_0xfb42('0x3'));var fs=require('fs');var _=require(_0xfb42('0x4'));var Redis=require(_0xfb42('0x5'));var htmlToText=require(_0xfb42('0x6'));var qs=require(_0xfb42('0x7'));var logger=require('../../config/logger')(_0xfb42('0x8'));var interaction_log=require(_0xfb42('0x9'))(_0xfb42('0xa'));var config=require(_0xfb42('0xb'));var db=require(_0xfb42('0xc'))['db'];config['redis']=_[_0xfb42('0xd')](config[_0xfb42('0xe')],{'host':_0xfb42('0xf'),'port':0x18eb});var socket=require(_0xfb42('0x10'))(new Redis(config['redis']));var htmlEntities=require(_0xfb42('0x11'));require(_0xfb42('0x12'))[_0xfb42('0x13')](socket);var jayson=require(_0xfb42('0x14'));var client=jayson[_0xfb42('0x15')][_0xfb42('0x16')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0xfb42('0x15')][_0xfb42('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2748b3,_0x50ea00,_0x1bd94c,_0x17fb8d){return new BPromise(function(_0x4d01a9,_0x8e1f64){var _0x39a12f=_0x17fb8d||client;return _0x39a12f[_0xfb42('0x17')](_0x2748b3,_0x1bd94c)[_0xfb42('0x18')](function(_0x2ce4eb){logger[_0xfb42('0x19')]('MailMessage,\x20%s,\x20%s',_0x50ea00,_0xfb42('0x1a'));logger[_0xfb42('0x1b')](_0xfb42('0x1c'),_0x50ea00,_0xfb42('0x1a'),JSON[_0xfb42('0x1d')](_0x2ce4eb));if(_0x2ce4eb[_0xfb42('0x1e')]){if(_0x2ce4eb[_0xfb42('0x1e')][_0xfb42('0x1f')]===0x1f4){logger['error'](_0xfb42('0x20'),_0x50ea00,_0x2ce4eb[_0xfb42('0x1e')]['message']);return _0x8e1f64(_0x2ce4eb[_0xfb42('0x1e')][_0xfb42('0x21')]);}logger['error'](_0xfb42('0x20'),_0x50ea00,_0x2ce4eb['error'][_0xfb42('0x21')]);return _0x4d01a9(_0x2ce4eb['error'][_0xfb42('0x21')]);}else{logger[_0xfb42('0x19')]('MailMessage,\x20%s,\x20%s',_0x50ea00,_0xfb42('0x1a'));_0x4d01a9(_0x2ce4eb[_0xfb42('0x22')][_0xfb42('0x21')]);}})[_0xfb42('0x23')](function(_0x3c636d){logger['error']('MailMessage,\x20%s,\x20%s',_0x50ea00,_0x3c636d);_0x8e1f64(_0x3c636d);});});}function respondWithResult(_0x3f56a5,_0x555d5c){_0x555d5c=_0x555d5c||0xc8;return function(_0x5daed5){if(_0x5daed5){return _0x3f56a5[_0xfb42('0x24')](_0x555d5c)[_0xfb42('0x25')](_0x5daed5);}};}function respondWithFilteredResult(_0x58f700,_0xd48879){return function(_0x18a4a1){if(_0x18a4a1){var _0x24bb85=typeof _0xd48879[_0xfb42('0x26')]===_0xfb42('0x27')&&typeof _0xd48879[_0xfb42('0x28')]===_0xfb42('0x27');var _0x238b05=_0x18a4a1['count'];var _0x1b3cf8=_0x24bb85?0x0:_0xd48879[_0xfb42('0x26')];var _0x1cfdf8=_0x24bb85?_0x18a4a1[_0xfb42('0x29')]:_0xd48879['offset']+_0xd48879[_0xfb42('0x28')];var _0x31f12b;if(_0x1cfdf8>=_0x238b05){_0x1cfdf8=_0x238b05;_0x31f12b=0xc8;}else{_0x31f12b=0xce;}_0x58f700[_0xfb42('0x24')](_0x31f12b);return _0x58f700[_0xfb42('0x2a')](_0xfb42('0x2b'),_0x1b3cf8+'-'+_0x1cfdf8+'/'+_0x238b05)[_0xfb42('0x25')](_0x18a4a1);}return null;};}function saveUpdates(_0x5b6b65){return function(_0x4388d0){if(_0x4388d0){return _0x4388d0[_0xfb42('0x2c')](_0x5b6b65)[_0xfb42('0x18')](function(_0x51034b){return _0x51034b;});}return null;};}function removeEntity(_0x28d212){return function(_0x547fe8){if(_0x547fe8){return _0x547fe8[_0xfb42('0x2d')]()[_0xfb42('0x18')](function(){_0x28d212[_0xfb42('0x24')](0xcc)[_0xfb42('0x2e')]();});}};}function handleEntityNotFound(_0x5cd074){return function(_0x2705e1){if(!_0x2705e1){_0x5cd074['sendStatus'](0x194);}return _0x2705e1;};}function handleError(_0x49b67f,_0x1858c8){_0x1858c8=_0x1858c8||0x1f4;return function(_0x5c1a17){logger['error'](_0x5c1a17[_0xfb42('0x2f')]);if(_0x5c1a17['name']){delete _0x5c1a17[_0xfb42('0x30')];}_0x49b67f[_0xfb42('0x24')](_0x1858c8)[_0xfb42('0x31')](_0x5c1a17);};}exports['index']=function(_0x42c68c,_0x2d2a87){var _0x22e792={},_0xb2b9f={},_0x2a257c={'count':0x0,'rows':[]};var _0x2b667f=_[_0xfb42('0x32')](db[_0xfb42('0x33')][_0xfb42('0x34')],function(_0x1c0e45){return{'name':_0x1c0e45[_0xfb42('0x35')],'type':_0x1c0e45[_0xfb42('0x36')][_0xfb42('0x37')]};});_0xb2b9f[_0xfb42('0x38')]=_['map'](_0x2b667f,_0xfb42('0x30'));_0xb2b9f[_0xfb42('0x39')]=_['keys'](_0x42c68c[_0xfb42('0x39')]);_0xb2b9f['filters']=_['intersection'](_0xb2b9f[_0xfb42('0x38')],_0xb2b9f[_0xfb42('0x39')]);_0x22e792[_0xfb42('0x3a')]=_[_0xfb42('0x3b')](_0xb2b9f[_0xfb42('0x38')],qs[_0xfb42('0x3c')](_0x42c68c[_0xfb42('0x39')][_0xfb42('0x3c')]));_0x22e792[_0xfb42('0x3a')]=_0x22e792['attributes']['length']?_0x22e792[_0xfb42('0x3a')]:_0xb2b9f[_0xfb42('0x38')];if(!_0x42c68c[_0xfb42('0x39')][_0xfb42('0x3d')](_0xfb42('0x3e'))){_0x22e792[_0xfb42('0x28')]=qs[_0xfb42('0x28')](_0x42c68c[_0xfb42('0x39')][_0xfb42('0x28')]);_0x22e792[_0xfb42('0x26')]=qs['offset'](_0x42c68c[_0xfb42('0x39')]['offset']);}_0x22e792[_0xfb42('0x3f')]=qs[_0xfb42('0x40')](_0x42c68c[_0xfb42('0x39')][_0xfb42('0x40')]);_0x22e792[_0xfb42('0x41')]=qs[_0xfb42('0x42')](_['pick'](_0x42c68c[_0xfb42('0x39')],_0xb2b9f[_0xfb42('0x42')]),_0x2b667f);if(_0x42c68c[_0xfb42('0x39')][_0xfb42('0x43')]){_0x22e792[_0xfb42('0x41')]=_[_0xfb42('0x44')](_0x22e792[_0xfb42('0x41')],{'$or':_['map'](_0x2b667f,function(_0x2c632a){if(_0x2c632a[_0xfb42('0x36')]!==_0xfb42('0x45')){var _0x14612a={};_0x14612a[_0x2c632a[_0xfb42('0x30')]]={'$like':'%'+_0x42c68c[_0xfb42('0x39')][_0xfb42('0x43')]+'%'};return _0x14612a;}})});}_0x22e792=_[_0xfb42('0x44')]({},_0x22e792,_0x42c68c[_0xfb42('0x46')]);var _0x32f6f6={'where':_0x22e792[_0xfb42('0x41')]};return db[_0xfb42('0x33')][_0xfb42('0x29')](_0x32f6f6)[_0xfb42('0x18')](function(_0x23d361){_0x2a257c['count']=_0x23d361;if(_0x42c68c[_0xfb42('0x39')][_0xfb42('0x47')]){_0x22e792[_0xfb42('0x48')]=[{'all':!![]}];}return db[_0xfb42('0x33')][_0xfb42('0x49')](_0x22e792);})[_0xfb42('0x18')](function(_0x58e717){_0x2a257c['rows']=_0x58e717;return _0x2a257c;})[_0xfb42('0x18')](respondWithFilteredResult(_0x2d2a87,_0x22e792))[_0xfb42('0x23')](handleError(_0x2d2a87,null));};exports[_0xfb42('0x4a')]=function(_0x2b093e,_0xef6eb1){var _0x3f8e08={'raw':!![],'where':{'id':_0x2b093e['params']['id']}},_0x4ea8d6={};_0x4ea8d6[_0xfb42('0x38')]=_['keys'](db['MailMessage']['rawAttributes']);_0x4ea8d6['query']=_['keys'](_0x2b093e[_0xfb42('0x39')]);_0x4ea8d6[_0xfb42('0x42')]=_[_0xfb42('0x3b')](_0x4ea8d6['model'],_0x4ea8d6[_0xfb42('0x39')]);_0x3f8e08[_0xfb42('0x3a')]=_[_0xfb42('0x3b')](_0x4ea8d6[_0xfb42('0x38')],qs[_0xfb42('0x3c')](_0x2b093e['query'][_0xfb42('0x3c')]));_0x3f8e08[_0xfb42('0x3a')]=_0x3f8e08[_0xfb42('0x3a')]['length']?_0x3f8e08[_0xfb42('0x3a')]:_0x4ea8d6[_0xfb42('0x38')];if(_0x2b093e[_0xfb42('0x39')]['includeAll']){_0x3f8e08[_0xfb42('0x48')]=[{'all':!![]}];}_0x3f8e08=_[_0xfb42('0x44')]({},_0x3f8e08,_0x2b093e[_0xfb42('0x46')]);return db[_0xfb42('0x33')]['find'](_0x3f8e08)[_0xfb42('0x18')](handleEntityNotFound(_0xef6eb1,null))['then'](respondWithResult(_0xef6eb1,null))[_0xfb42('0x23')](handleError(_0xef6eb1,null));};exports[_0xfb42('0x2c')]=function(_0x4361c4,_0x1ed341){if(_0x4361c4[_0xfb42('0x4b')]['id']){delete _0x4361c4[_0xfb42('0x4b')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x4361c4[_0xfb42('0x4c')]['id']}})[_0xfb42('0x18')](handleEntityNotFound(_0x1ed341,null))['then'](saveUpdates(_0x4361c4['body'],null))[_0xfb42('0x18')](respondWithResult(_0x1ed341,null))[_0xfb42('0x23')](handleError(_0x1ed341,null));};exports['destroy']=function(_0x4df4a3,_0x51647b){return db['MailMessage'][_0xfb42('0x4d')]({'where':{'id':_0x4df4a3['params']['id']}})[_0xfb42('0x18')](handleEntityNotFound(_0x51647b,null))[_0xfb42('0x18')](removeEntity(_0x51647b,null))['catch'](handleError(_0x51647b,null));};exports[_0xfb42('0x4e')]=function(_0x50b9b7,_0x18feea){return db[_0xfb42('0x33')][_0xfb42('0x4e')]()['then'](respondWithResult(_0x18feea,null))[_0xfb42('0x23')](handleError(_0x18feea,null));};exports[_0xfb42('0x4f')]=function(_0x1a8968,_0x462e75){return db[_0xfb42('0x33')]['create'](_0x1a8968[_0xfb42('0x4b')])['then'](function(_0x28e658){if(_0x28e658){if(_0x28e658[_0xfb42('0x50')]===_0xfb42('0x51')&&!_0x28e658[_0xfb42('0x52')]){var _0x274eba,_0x579b8a,_0x41bb75;if(_0x1a8968[_0xfb42('0x4b')]['to']){_0x579b8a=_0x1a8968['body']['to'][_0xfb42('0x53')](',')[0x0];}return db[_0xfb42('0x54')][_0xfb42('0x55')]({'where':{'id':_0x28e658[_0xfb42('0x56')]},'include':[{'model':db[_0xfb42('0x57')],'as':_0xfb42('0x58'),'include':[{'model':db[_0xfb42('0x59')],'as':_0xfb42('0x5a'),'where':{'email':_0x579b8a},'limit':0x1,'order':[[_0xfb42('0x5b'),_0xfb42('0x5c')]]}]},{'model':db['MailServerOut'],'as':_0xfb42('0x5d'),'raw':!![],'include':[{'model':db[_0xfb42('0x5e')],'as':_0xfb42('0x5e'),'raw':!![]}]}]})[_0xfb42('0x18')](function(_0x16d436){_0x274eba=_0x16d436;if(!_0x274eba||!_0x274eba[_0xfb42('0x5d')])return;var _0x587ebd=_0x274eba[_0xfb42('0x5f')]();if(_0x1a8968[_0xfb42('0x4b')]['attachments']&&_0x1a8968[_0xfb42('0x4b')][_0xfb42('0x60')][_0xfb42('0x61')]){for(var _0x4aed82=0x0;_0x4aed82<_0x1a8968[_0xfb42('0x4b')][_0xfb42('0x60')][_0xfb42('0x61')];_0x4aed82+=0x1){_0x1a8968[_0xfb42('0x4b')][_0xfb42('0x60')][_0x4aed82]={'filename':_0x1a8968[_0xfb42('0x4b')]['attachments'][_0x4aed82]['name'],'path':path[_0xfb42('0x62')](config[_0xfb42('0x63')],'server/files/attachments',_0x1a8968[_0xfb42('0x4b')][_0xfb42('0x60')][_0x4aed82][_0xfb42('0x64')])};}}_0x41bb75={'account':_0x587ebd,'message':_0x1a8968[_0xfb42('0x4b')]};return;})['then'](function(){if(_0x274eba[_0xfb42('0x58')]){if(_0x274eba['List'][_0xfb42('0x5a')][_0xfb42('0x61')]){return _0x274eba['List'][_0xfb42('0x5a')][0x0];}else{return db[_0xfb42('0x59')]['create'](_['defaults'](_0x1a8968['body'],{'firstName':_0x1a8968['body']['to'],'email':_0x1a8968['body']['to'],'phone':_0x1a8968[_0xfb42('0x4b')]['to'],'ListId':_0x274eba[_0xfb42('0x65')]}));}}else{throw new Error(_0xfb42('0x66'));}})[_0xfb42('0x18')](function(){if(_0x41bb75){return respondWithRpcPromise(_0xfb42('0x67'),_0xfb42('0x68'),_0x41bb75,client9003)['then'](function(_0x171d02){return _0x28e658[_0xfb42('0x2c')]({'read':!![],'messageId':_0x171d02[_0xfb42('0x69')],'sentAt':moment()['format'](_0xfb42('0x6a'))});})[_0xfb42('0x23')](function(_0x55e398){logger['error']('%s',JSON[_0xfb42('0x1d')](_0x55e398));return _0x28e658;});}return _0x28e658;});}return _0x28e658;}})[_0xfb42('0x18')](respondWithResult(_0x462e75,0xc9))[_0xfb42('0x23')](handleError(_0x462e75,null));};exports['accept']=function(_0x2da62a,_0x3a0a59){var _0x476c37={'agent':{},'channel':'mail'};if(_0x2da62a[_0xfb42('0x4b')]['id']){delete _0x2da62a[_0xfb42('0x4b')]['id'];}_0x2da62a['body']['read']=!![];_0x2da62a[_0xfb42('0x4b')][_0xfb42('0x6b')]=moment()['format'](_0xfb42('0x6a'));_0x2da62a[_0xfb42('0x4b')][_0xfb42('0x6c')]=_0x2da62a[_0xfb42('0x4b')][_0xfb42('0x6c')]||_0x2da62a[_0xfb42('0x6d')]['id'];_0x476c37['agent']['id']=_0x2da62a[_0xfb42('0x4b')][_0xfb42('0x6c')];return db[_0xfb42('0x33')]['find']({'where':{'id':_0x2da62a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3a0a59,null))[_0xfb42('0x18')](saveUpdates(_0x2da62a[_0xfb42('0x4b')],null))['then'](function(_0x119df9){if(_0x119df9){_0x476c37[_0xfb42('0x21')]=_0x119df9[_0xfb42('0x6e')]({'plain':!![]});return db[_0xfb42('0x6f')][_0xfb42('0x4d')]({'where':{'id':_0x119df9[_0xfb42('0x70')]}});}return null;})[_0xfb42('0x18')](handleEntityNotFound(_0x3a0a59,null))[_0xfb42('0x18')](function(_0x35594b){if(_0x35594b){return _0x35594b[_0xfb42('0x2c')]({'UserId':_0x2da62a[_0xfb42('0x4b')][_0xfb42('0x6c')],'read1stAt':_[_0xfb42('0x71')](_0x35594b[_0xfb42('0x72')])?moment()[_0xfb42('0x73')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0xdb1956){if(_0xdb1956){_0x476c37['interaction']=_0xdb1956[_0xfb42('0x6e')]({'plain':!![]});interaction_log[_0xfb42('0x19')](_0xfb42('0x74'),_0x2da62a[_0xfb42('0x6d')]['id'],_0x2da62a[_0xfb42('0x6d')][_0xfb42('0x30')],_0x2da62a['user']['role'],_0x476c37[_0xfb42('0x75')]['id'],_0x2da62a[_0xfb42('0x4b')]?JSON[_0xfb42('0x1d')](_0x2da62a[_0xfb42('0x4b')]):'null');return respondWithRpcPromise('AcceptMessage',_0xfb42('0x76'),_0x476c37);}return null;})[_0xfb42('0x18')](function(_0x91ed02){var _0x1beb99=_0xfb42('0x77')+_0x91ed02[_0xfb42('0x21')][_0xfb42('0x78')];return db[_0xfb42('0x79')][_0xfb42('0x39')](_0x1beb99,{'type':db['Sequelize'][_0xfb42('0x7a')][_0xfb42('0x7b')],'raw':!![]})[_0xfb42('0x18')](function(_0x5eef01){return _0x5eef01;});})[_0xfb42('0x18')](function(_0x2d2664){if(_0x2d2664){_0x476c37[_0xfb42('0x21')][_0xfb42('0x7c')]=_0x2d2664[0x0];if(!_0x2da62a[_0xfb42('0x4b')][_0xfb42('0x6c')])return;return db[_0xfb42('0x7d')]['find']({'where':{'id':_0x2da62a[_0xfb42('0x4b')]['UserId'],'role':'agent'},'attributes':['id',_0xfb42('0x30'),_0xfb42('0x7e'),_0xfb42('0x7f'),_0xfb42('0x80')],'raw':!![]});}return null;})['then'](function(_0x134906){if(!_0x134906)return null;_0x476c37['message'][_0xfb42('0x81')]=_0x134906;return _0x476c37;})[_0xfb42('0x18')](function(_0x232559){if(_0x232559){if(_0x2da62a[_0xfb42('0x4b')][_0xfb42('0x82')]){_0x476c37[_0xfb42('0x21')][_0xfb42('0x83')]=util[_0xfb42('0x73')](_0xfb42('0x84'),_0x2da62a[_0xfb42('0x6d')][_0xfb42('0x30')]);_0x476c37[_0xfb42('0x21')][_0xfb42('0x85')]=_0x476c37[_0xfb42('0x85')];_0x476c37[_0xfb42('0x21')][_0xfb42('0x86')]=_0x476c37['channel'];_0x476c37[_0xfb42('0x21')]['event']=_0xfb42('0x87');_0x476c37[_0xfb42('0x21')][_0xfb42('0x4b')]=htmlToText[_0xfb42('0x88')](_0x476c37[_0xfb42('0x21')][_0xfb42('0x4b')]);return respondWithRpcPromise(_0xfb42('0x89'),_0xfb42('0x89'),{'event':_0xfb42('0x8a'),'message':_0x476c37[_0xfb42('0x21')]},client9002)[_0xfb42('0x18')](function(){return _0x476c37;});}return _0x476c37;}return null;})[_0xfb42('0x18')](respondWithResult(_0x3a0a59,null))[_0xfb42('0x23')](handleError(_0x3a0a59,null));};exports[_0xfb42('0x8b')]=function(_0x4d8f7f,_0x424cc0){var _0x1150da={'agent':{},'channel':'mail'};if(_0x4d8f7f['body']['id']){delete _0x4d8f7f[_0xfb42('0x4b')]['id'];}_0x4d8f7f['body']['UserId']=_0x4d8f7f[_0xfb42('0x4b')][_0xfb42('0x6c')]||_0x4d8f7f[_0xfb42('0x6d')]['id'];_0x1150da[_0xfb42('0x81')]['id']=_0x4d8f7f[_0xfb42('0x4b')]['UserId'];return db[_0xfb42('0x33')][_0xfb42('0x4d')]({'where':{'id':_0x4d8f7f[_0xfb42('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x424cc0,null))[_0xfb42('0x18')](function(_0x31be92){if(_0x31be92){_0x1150da[_0xfb42('0x21')]=_0x31be92[_0xfb42('0x6e')]({'plain':!![]});return db[_0xfb42('0x6f')][_0xfb42('0x4d')]({'where':{'id':_0x31be92[_0xfb42('0x70')]}});}return null;})[_0xfb42('0x18')](handleEntityNotFound(_0x424cc0,null))[_0xfb42('0x18')](function(_0x51a034){if(_0x51a034){_0x1150da[_0xfb42('0x75')]=_0x51a034['get']({'plain':!![]});interaction_log['info'](_0xfb42('0x8c'),_0x4d8f7f['user']['id'],_0x4d8f7f[_0xfb42('0x6d')][_0xfb42('0x30')],_0x4d8f7f[_0xfb42('0x6d')][_0xfb42('0x8d')],_0x1150da[_0xfb42('0x75')]['id'],_0x4d8f7f['body']?JSON['stringify'](_0x4d8f7f[_0xfb42('0x4b')]):_0xfb42('0x8e'));return respondWithRpcPromise(_0xfb42('0x8f'),_0xfb42('0x90'),_0x1150da);}return null;})[_0xfb42('0x18')](function(_0x560901){var _0x1cbc40=_0xfb42('0x77')+_0x560901[_0xfb42('0x21')][_0xfb42('0x78')];return db[_0xfb42('0x79')][_0xfb42('0x39')](_0x1cbc40,{'type':db[_0xfb42('0x91')]['QueryTypes'][_0xfb42('0x7b')],'raw':!![]})[_0xfb42('0x18')](function(_0x1746ce){return _0x1746ce;});})['then'](function(_0x4d49fa){if(_0x4d49fa){_0x1150da['message'][_0xfb42('0x7c')]=_0x4d49fa[0x0];if(!_0x4d8f7f[_0xfb42('0x4b')][_0xfb42('0x6c')])return;return db['User']['find']({'where':{'id':_0x4d8f7f[_0xfb42('0x4b')][_0xfb42('0x6c')],'role':'agent'},'attributes':['id',_0xfb42('0x30'),_0xfb42('0x7e'),_0xfb42('0x7f'),_0xfb42('0x80')],'raw':!![]});}return null;})[_0xfb42('0x18')](function(_0x121b03){if(!_0x121b03)return null;_0x1150da[_0xfb42('0x21')]['agent']=_0x121b03;return _0x1150da;})[_0xfb42('0x18')](function(_0xe4763){if(_0xe4763){_0xe4763['message'][_0xfb42('0x83')]=util[_0xfb42('0x73')](_0xfb42('0x84'),_0x4d8f7f[_0xfb42('0x6d')][_0xfb42('0x30')]);_0xe4763[_0xfb42('0x21')][_0xfb42('0x85')]=_0x1150da['channel'];_0xe4763[_0xfb42('0x21')]['motionChannel']=_0x1150da[_0xfb42('0x85')];_0xe4763[_0xfb42('0x21')][_0xfb42('0x92')]='reject';_0xe4763[_0xfb42('0x21')][_0xfb42('0x4b')]=htmlToText[_0xfb42('0x88')](_0x1150da[_0xfb42('0x21')][_0xfb42('0x4b')]);respondWithRpcPromise(_0xfb42('0x89'),'EventManager',{'event':'rejectmessage','message':_0xe4763[_0xfb42('0x21')]},client9002);return _0x1150da;}return null;})[_0xfb42('0x18')](respondWithResult(_0x424cc0,null))[_0xfb42('0x23')](handleError(_0x424cc0,null));};exports[_0xfb42('0x93')]=function(_0x350c13,_0x2d010b){var _0x4c0cb7=moment()[_0xfb42('0x94')]()[_0xfb42('0x95')]();var _0x5753d1=path[_0xfb42('0x62')](config[_0xfb42('0x63')],_0xfb42('0x96'),_0xfb42('0x97'),_0xfb42('0x98'));var _0x350887=path['join'](config[_0xfb42('0x63')],'server',_0xfb42('0x97'),_0xfb42('0x60'));var _0x5c0d2a=util[_0xfb42('0x73')](_0xfb42('0x99'),_0x4c0cb7);return db[_0xfb42('0x33')]['find']({'where':{'id':_0x350c13[_0xfb42('0x4c')]['id']},'attributes':['id',_0xfb42('0x4b'),_0xfb42('0x9a'),'to','cc','bcc',_0xfb42('0x9b'),_0xfb42('0x9c')],'include':_0x350c13[_0xfb42('0x39')][_0xfb42('0x60')]?[{'model':db['Attachment'],'as':_0xfb42('0x9d')}]:undefined})[_0xfb42('0x18')](handleEntityNotFound(_0x2d010b,null))[_0xfb42('0x18')](function(_0x57f9f3){if(_0x57f9f3){var _0x33ce61=_0x57f9f3;var _0x1cb0f2={'from':_0x33ce61[_0xfb42('0x9a')],'to':_0x33ce61['to'],'subject':_0x33ce61[_0xfb42('0x9b')],'html':htmlEntities[_0xfb42('0x9e')](_0x33ce61[_0xfb42('0x4b')]),'headers':{'Date':moment(_0x33ce61['createdAt'])[_0xfb42('0x73')](_0xfb42('0x9f'))},'attachments':[]};if(_0x57f9f3['cc']){_0x1cb0f2['headers']['Cc']=_0x57f9f3['cc'];}if(_0x57f9f3[_0xfb42('0xa0')]){_0x1cb0f2[_0xfb42('0xa1')]['Bcc']=_0x57f9f3[_0xfb42('0xa0')];}return new BPromise(function(_0x666226,_0x4b0ebb){if(_0x57f9f3[_0xfb42('0x9d')]){for(var _0xb75f70=0x0;_0xb75f70<_0x57f9f3[_0xfb42('0x9d')][_0xfb42('0x61')];_0xb75f70++){var _0x366ddb=_0x57f9f3[_0xfb42('0x9d')][_0xb75f70];var _0x49e40a=path[_0xfb42('0x62')](_0x350887,_0x366ddb[_0xfb42('0x64')]);if(fs[_0xfb42('0xa2')](_0x49e40a)){_0x1cb0f2[_0xfb42('0x60')][_0xfb42('0xa3')]({'name':_0x366ddb[_0xfb42('0x30')],'contentType':_0x366ddb[_0xfb42('0x36')],'data':fs[_0xfb42('0xa4')](_0x49e40a)});}}}emlformat[_0xfb42('0xa5')](_0x1cb0f2,function(_0x2ed65a,_0x3003b5){if(_0x2ed65a)return _0x4b0ebb(_0x2ed65a);fs[_0xfb42('0xa6')](path[_0xfb42('0x62')](_0x5753d1,_0x5c0d2a),_0x3003b5);return _0x666226(_0x3003b5);});});}})[_0xfb42('0x18')](function(_0x3e0198){if(_0x3e0198){return _0x2d010b[_0xfb42('0x93')](path[_0xfb42('0x62')](_0x5753d1,_0x5c0d2a),_0x5c0d2a,function(_0x1dfb4e){if(!_0x1dfb4e)fs[_0xfb42('0xa7')](path[_0xfb42('0x62')](_0x5753d1,_0x5c0d2a));});}})['catch'](handleError(_0x2d010b,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index ebb6edf..919aeb2 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 _0xcd39=['remove','emit','hasOwnProperty','events','../../mysqldb','MailMessage','save','update'];(function(_0x5dc1cf,_0x578d55){var _0x42219c=function(_0x1ee889){while(--_0x1ee889){_0x5dc1cf['push'](_0x5dc1cf['shift']());}};_0x42219c(++_0x578d55);}(_0xcd39,0x6b));var _0x9cd3=function(_0x53d0f2,_0x461fff){_0x53d0f2=_0x53d0f2-0x0;var _0x4039fe=_0xcd39[_0x53d0f2];return _0x4039fe;};'use strict';var EventEmitter=require(_0x9cd3('0x0'));var MailMessage=require(_0x9cd3('0x1'))['db'][_0x9cd3('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9cd3('0x3'),'afterUpdate':_0x9cd3('0x4'),'afterDestroy':_0x9cd3('0x5')};function emitEvent(_0x1f2a86){return function(_0x15c06e,_0x3124b0,_0x20b032){MailMessageEvents['emit'](_0x1f2a86+':'+_0x15c06e['id'],_0x15c06e);MailMessageEvents[_0x9cd3('0x6')](_0x1f2a86,_0x15c06e);_0x20b032(null);};}for(var e in events){if(events[_0x9cd3('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xb4ee=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb4ee,0x189));var _0xeb4e=function(_0x1c2d01,_0x55590b){_0x1c2d01=_0x1c2d01-0x0;var _0x2fe07e=_0xb4ee[_0x1c2d01];return _0x2fe07e;};'use strict';var EventEmitter=require(_0xeb4e('0x0'));var MailMessage=require(_0xeb4e('0x1'))['db'][_0xeb4e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xeb4e('0x3')](0x0);var events={'afterCreate':_0xeb4e('0x4'),'afterUpdate':_0xeb4e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x185952){return function(_0x1fe67a,_0x3fa375,_0xa6ee44){MailMessageEvents['emit'](_0x185952+':'+_0x1fe67a['id'],_0x1fe67a);MailMessageEvents[_0xeb4e('0x6')](_0x185952,_0x1fe67a);_0xa6ee44(null);};}for(var e in events){if(events[_0xeb4e('0x7')](e)){var event=events[e];MailMessage[_0xeb4e('0x8')](e,emitEvent(event));}}module[_0xeb4e('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 248de22..741cc45 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 _0x85cc=['rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','subject','FULLTEXT','plainBody','fromString','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path'];(function(_0x14be19,_0x3067bb){var _0x240fb4=function(_0x58a3b9){while(--_0x58a3b9){_0x14be19['push'](_0x14be19['shift']());}};_0x240fb4(++_0x3067bb);}(_0x85cc,0x1cb));var _0xc85c=function(_0x46ba57,_0x4788c2){_0x46ba57=_0x46ba57-0x0;var _0x350bb9=_0x85cc[_0x46ba57];return _0x350bb9;};'use strict';var _=require(_0xc85c('0x0'));var util=require(_0xc85c('0x1'));var logger=require(_0xc85c('0x2'))(_0xc85c('0x3'));var moment=require(_0xc85c('0x4'));var BPromise=require(_0xc85c('0x5'));var rp=require(_0xc85c('0x6'));var htmlToText=require(_0xc85c('0x7'));var fs=require('fs');var path=require(_0xc85c('0x8'));var rimraf=require(_0xc85c('0x9'));var config=require(_0xc85c('0xa'));var attributes=require(_0xc85c('0xb'));module[_0xc85c('0xc')]=function(_0x2d3047,_0x49bea0){return _0x2d3047[_0xc85c('0xd')](_0xc85c('0xe'),attributes,{'tableName':_0xc85c('0xf'),'paranoid':![],'indexes':[{'name':_0xc85c('0x10'),'fields':['messageId']},{'name':'fti_mail_messages','fields':['plainBody',_0xc85c('0x11')],'type':_0xc85c('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d40cc,_0x2b187f,_0x469c39){if(_0x4d40cc['body']){_0x4d40cc[_0xc85c('0x13')]=htmlToText[_0xc85c('0x14')](_0x4d40cc[_0xc85c('0x15')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x469c39(null,_0x2b187f);},'afterCreate':function(_0x232c96,_0x58845b,_0x3f7827){var _0x55b974=_0x2d3047[_0xc85c('0x16')];var _0x2afc37=_0x232c96[_0xc85c('0x17')]({'plain':!![]});if(_0x2afc37[_0xc85c('0x18')][_0xc85c('0x19')]()==='in'||_0x2afc37[_0xc85c('0x18')][_0xc85c('0x19')]()===_0xc85c('0x1a')&&!_0x2afc37[_0xc85c('0x1b')]&&!_[_0xc85c('0x1c')](_0x2afc37[_0xc85c('0x1d')])){_0x55b974[_0xc85c('0x1e')][_0xc85c('0x1f')]({'where':{'id':_0x2afc37[_0xc85c('0x20')]}})[_0xc85c('0x21')](function(_0x144180){if(_0x144180){_0x144180[_0xc85c('0x22')]({'lastMsgAt':_0x2afc37[_0xc85c('0x23')],'lastMsgDirection':_0x2afc37[_0xc85c('0x18')][_0xc85c('0x19')]()});}})[_0xc85c('0x24')](function(_0x52f0ff){console[_0xc85c('0x25')](_0x52f0ff);});}_0x3f7827();}},'charset':'utf8mb4','collate':_0xc85c('0x26')});}; \ No newline at end of file +var _0xf6a9=['catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf6a9,0x158));var _0x9f6a=function(_0x2ae8bb,_0x422843){_0x2ae8bb=_0x2ae8bb-0x0;var _0x3a38a3=_0xf6a9[_0x2ae8bb];return _0x3a38a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9f6a('0x0'))(_0x9f6a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f6a('0x2'));var htmlToText=require(_0x9f6a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f6a('0x4'));var config=require(_0x9f6a('0x5'));var attributes=require(_0x9f6a('0x6'));module[_0x9f6a('0x7')]=function(_0x365ebe,_0x39f8d5){return _0x365ebe[_0x9f6a('0x8')]('MailMessage',attributes,{'tableName':_0x9f6a('0x9'),'paranoid':![],'indexes':[{'name':_0x9f6a('0xa'),'fields':[_0x9f6a('0xa')]},{'name':_0x9f6a('0xb'),'fields':[_0x9f6a('0xc'),_0x9f6a('0xd')],'type':_0x9f6a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x40c088,_0x371c0b,_0x48dad1){if(_0x40c088[_0x9f6a('0xf')]){_0x40c088[_0x9f6a('0xc')]=htmlToText[_0x9f6a('0x10')](_0x40c088[_0x9f6a('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x48dad1(null,_0x371c0b);},'afterCreate':function(_0xf21867,_0x5b24bf,_0x5873c1){var _0x3a6795=_0x365ebe[_0x9f6a('0x11')];var _0x5b2e39=_0xf21867[_0x9f6a('0x12')]({'plain':!![]});if(_0x5b2e39[_0x9f6a('0x13')][_0x9f6a('0x14')]()==='in'||_0x5b2e39[_0x9f6a('0x13')]['toLowerCase']()==='out'&&!_0x5b2e39[_0x9f6a('0x15')]&&!_[_0x9f6a('0x16')](_0x5b2e39[_0x9f6a('0x17')])){_0x3a6795[_0x9f6a('0x18')][_0x9f6a('0x19')]({'where':{'id':_0x5b2e39[_0x9f6a('0x1a')]}})[_0x9f6a('0x1b')](function(_0x2b58f1){if(_0x2b58f1){_0x2b58f1[_0x9f6a('0x1c')]({'lastMsgAt':_0x5b2e39[_0x9f6a('0x1d')],'lastMsgDirection':_0x5b2e39[_0x9f6a('0x13')][_0x9f6a('0x14')]()});}})[_0x9f6a('0x1e')](function(_0x347225){console[_0x9f6a('0x1f')](_0x347225);});}_0x5873c1();}},'charset':_0x9f6a('0x20'),'collate':_0x9f6a('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d3df1c4..7a6b204 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 _0x93e9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','debug'];(function(_0x53ed44,_0x485721){var _0x2df77c=function(_0x13a970){while(--_0x13a970){_0x53ed44['push'](_0x53ed44['shift']());}};_0x2df77c(++_0x485721);}(_0x93e9,0xcc));var _0x993e=function(_0x440a9b,_0x19435a){_0x440a9b=_0x440a9b-0x0;var _0x4fe804=_0x93e9[_0x440a9b];return _0x4fe804;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});config[_0x993e('0xc')]=_[_0x993e('0xd')](config[_0x993e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x993e('0xe'))(new Redis(config[_0x993e('0xc')]));require(_0x993e('0xf'))[_0x993e('0x10')](socket);function respondWithRpcPromise(_0x2cd389,_0x27a28f,_0x1c2324){return new BPromise(function(_0x48291a,_0x196f6d){return client[_0x993e('0x11')](_0x2cd389,_0x1c2324)['then'](function(_0x5ebc8c){logger[_0x993e('0x12')]('MailMessage,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'),JSON[_0x993e('0x14')](_0x5ebc8c));if(_0x5ebc8c[_0x993e('0x15')]){if(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x16')]===0x1f4){logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x196f6d(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x48291a(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}else{logger['info'](_0x993e('0x17'),_0x27a28f,_0x993e('0x13'));_0x48291a(_0x5ebc8c[_0x993e('0x19')][_0x993e('0x18')]);}})[_0x993e('0x1a')](function(_0x3eda77){logger['error'](_0x993e('0x17'),_0x27a28f,_0x3eda77);_0x196f6d(_0x3eda77);});});}exports[_0x993e('0x1b')]=function(_0x1eaf57){var _0x22390e=this;return new Promise(function(_0x130a8a,_0x425ab4){return db[_0x993e('0x1c')][_0x993e('0x1d')](_0x1eaf57['body'],{'raw':_0x1eaf57[_0x993e('0x1e')]?_0x1eaf57['options'][_0x993e('0x1f')]===undefined?!![]:![]:!![]})[_0x993e('0x20')](function(_0x32b09e){logger['info'](_0x993e('0x1b'),_0x1eaf57);logger[_0x993e('0x21')](_0x993e('0x1b'),_0x1eaf57,JSON[_0x993e('0x14')](_0x32b09e));_0x130a8a(_0x32b09e);})[_0x993e('0x1a')](function(_0x328d22){logger[_0x993e('0x15')](_0x993e('0x1b'),_0x328d22[_0x993e('0x18')],_0x1eaf57);_0x425ab4(_0x22390e[_0x993e('0x15')](0x1f4,_0x328d22[_0x993e('0x18')]));});});}; \ 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(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'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 3ecbda0..12e3ce8 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 _0xb7a0=['removeListener','register','length','./mailMessage.events','save','remove','update','emit'];(function(_0x35d8d0,_0x56179c){var _0x1e845b=function(_0x2e249b){while(--_0x2e249b){_0x35d8d0['push'](_0x35d8d0['shift']());}};_0x1e845b(++_0x56179c);}(_0xb7a0,0x13b));var _0x0b7a=function(_0x15ae4f,_0x38a7c9){_0x15ae4f=_0x15ae4f-0x0;var _0x3f1349=_0xb7a0[_0x15ae4f];return _0x3f1349;};'use strict';var MailMessageEvents=require(_0x0b7a('0x0'));var events=[_0x0b7a('0x1'),_0x0b7a('0x2'),_0x0b7a('0x3')];function createListener(_0x5f120d,_0x29868b){return function(_0x550a48){_0x29868b[_0x0b7a('0x4')](_0x5f120d,_0x550a48);};}function removeListener(_0x4f1b69,_0x3ed511){return function(){MailMessageEvents[_0x0b7a('0x5')](_0x4f1b69,_0x3ed511);};}exports[_0x0b7a('0x6')]=function(_0x12d600){for(var _0x650c7a=0x0,_0x6f7861=events[_0x0b7a('0x7')];_0x650c7a<_0x6f7861;_0x650c7a++){var _0xd6477c=events[_0x650c7a];var _0x5099f1=createListener('mailMessage:'+_0xd6477c,_0x12d600);MailMessageEvents['on'](_0xd6477c,_0x5099f1);}}; \ No newline at end of file +var _0xccea=['register','mailMessage:','./mailMessage.events','remove','update','emit','removeListener'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xccea,0x198));var _0xacce=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xccea[_0x4b2863];return _0x567d67;};'use strict';var MailMessageEvents=require(_0xacce('0x0'));var events=['save',_0xacce('0x1'),_0xacce('0x2')];function createListener(_0x3d0b8e,_0x2819f1){return function(_0xc17a17){_0x2819f1[_0xacce('0x3')](_0x3d0b8e,_0xc17a17);};}function removeListener(_0x31172d,_0x15f11b){return function(){MailMessageEvents[_0xacce('0x4')](_0x31172d,_0x15f11b);};}exports[_0xacce('0x5')]=function(_0x3c5dd6){for(var _0x283add=0x0,_0x3cc305=events['length'];_0x283add<_0x3cc305;_0x283add++){var _0x2c426a=events[_0x283add];var _0x201f59=createListener(_0xacce('0x6')+_0x2c426a,_0x3c5dd6);MailMessageEvents['on'](_0x2c426a,_0x201f59);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 11d5e79..7b77b0f 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 _0x39d9=['express','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x39d9,0x1cc));var _0x939d=function(_0x2e29d9,_0x37e372){_0x2e29d9=_0x2e29d9-0x0;var _0x29cd7a=_0x39d9[_0x2e29d9];return _0x29cd7a;};'use strict';var multer=require(_0x939d('0x0'));var util=require(_0x939d('0x1'));var path=require(_0x939d('0x2'));var timeout=require(_0x939d('0x3'));var express=require(_0x939d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x939d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x939d('0x6'));router[_0x939d('0x7')]('/',auth[_0x939d('0x8')](),controller[_0x939d('0x9')]);router[_0x939d('0x7')](_0x939d('0xa'),auth[_0x939d('0x8')](),controller[_0x939d('0xb')]);router[_0x939d('0x7')](_0x939d('0xc'),auth[_0x939d('0x8')](),controller[_0x939d('0xd')]);router[_0x939d('0x7')]('/:id/members',auth[_0x939d('0x8')](),controller[_0x939d('0xe')]);router[_0x939d('0x7')](_0x939d('0xf'),auth[_0x939d('0x8')](),controller[_0x939d('0x10')]);router[_0x939d('0x7')](_0x939d('0x11'),auth[_0x939d('0x8')](),controller['getAgents']);router[_0x939d('0x12')]('/',auth[_0x939d('0x8')](),controller[_0x939d('0x13')]);router['post'](_0x939d('0xf'),auth[_0x939d('0x8')](),controller[_0x939d('0x14')]);router[_0x939d('0x12')](_0x939d('0x11'),auth[_0x939d('0x8')](),controller[_0x939d('0x15')]);router[_0x939d('0x16')](_0x939d('0xc'),auth[_0x939d('0x8')](),controller[_0x939d('0x17')]);router[_0x939d('0x18')](_0x939d('0xc'),auth['isAuthenticated'](),controller[_0x939d('0x19')]);router[_0x939d('0x18')](_0x939d('0xf'),auth[_0x939d('0x8')](),controller[_0x939d('0x1a')]);router[_0x939d('0x18')](_0x939d('0x11'),auth[_0x939d('0x8')](),controller[_0x939d('0x1b')]);module[_0x939d('0x1c')]=router; \ No newline at end of file +var _0x8bf4=['/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x8bf4,0xc1));var _0x48bf=function(_0x30e804,_0x8d453b){_0x30e804=_0x30e804-0x0;var _0x529374=_0x8bf4[_0x30e804];return _0x529374;};'use strict';var multer=require(_0x48bf('0x0'));var util=require('util');var path=require(_0x48bf('0x1'));var timeout=require(_0x48bf('0x2'));var express=require(_0x48bf('0x3'));var router=express[_0x48bf('0x4')]();var fs_extra=require(_0x48bf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x48bf('0x6'));var config=require(_0x48bf('0x7'));var controller=require(_0x48bf('0x8'));router[_0x48bf('0x9')]('/',auth[_0x48bf('0xa')](),controller[_0x48bf('0xb')]);router['get'](_0x48bf('0xc'),auth[_0x48bf('0xa')](),controller[_0x48bf('0xd')]);router[_0x48bf('0x9')]('/:id',auth[_0x48bf('0xa')](),controller['show']);router[_0x48bf('0x9')](_0x48bf('0xe'),auth[_0x48bf('0xa')](),controller[_0x48bf('0xf')]);router['get'](_0x48bf('0x10'),auth['isAuthenticated'](),controller[_0x48bf('0x11')]);router[_0x48bf('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x48bf('0x12')]('/',auth[_0x48bf('0xa')](),controller[_0x48bf('0x13')]);router[_0x48bf('0x12')](_0x48bf('0x10'),auth[_0x48bf('0xa')](),controller[_0x48bf('0x14')]);router[_0x48bf('0x12')](_0x48bf('0x15'),auth[_0x48bf('0xa')](),controller[_0x48bf('0x16')]);router[_0x48bf('0x17')](_0x48bf('0x18'),auth[_0x48bf('0xa')](),controller[_0x48bf('0x19')]);router[_0x48bf('0x1a')]('/:id',auth[_0x48bf('0xa')](),controller[_0x48bf('0x1b')]);router[_0x48bf('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0x48bf('0x1c')]);router[_0x48bf('0x1a')](_0x48bf('0x15'),auth[_0x48bf('0xa')](),controller[_0x48bf('0x1d')]);module[_0x48bf('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 894445c..d0efd0e 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 _0xb007=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x95f48,_0x2020be){var _0x4b011d=function(_0x32ed5a){while(--_0x32ed5a){_0x95f48['push'](_0x95f48['shift']());}};_0x4b011d(++_0x2020be);}(_0xb007,0x7a));var _0x7b00=function(_0x5e930c,_0x531c7b){_0x5e930c=_0x5e930c-0x0;var _0x506605=_0xb007[_0x5e930c];return _0x506605;};'use strict';var Sequelize=require(_0x7b00('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b00('0x1')],'unique':_0x7b00('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7b00('0x1')]},'timeout':{'type':Sequelize[_0x7b00('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b00('0x4')](_0x7b00('0x5'),_0x7b00('0x6'),_0x7b00('0x7'))}}; \ No newline at end of file +var _0xb58a=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x1faf28,_0x1a5b11){var _0x2b1fa8=function(_0x2ed943){while(--_0x2ed943){_0x1faf28['push'](_0x1faf28['shift']());}};_0x2b1fa8(++_0x1a5b11);}(_0xb58a,0x108));var _0xab58=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0xb58a[_0x11a962];return _0x55d423;};'use strict';var Sequelize=require(_0xab58('0x0'));module[_0xab58('0x1')]={'name':{'type':Sequelize[_0xab58('0x2')],'unique':_0xab58('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab58('0x2')]},'timeout':{'type':Sequelize[_0xab58('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xab58('0x5')](_0xab58('0x6'),'beepall',_0xab58('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index b359f2d..0bba1da 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 _0xf60a=['name','send','index','map','MailQueue','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','role','user','UserProfileSection','error','params','describe','pick','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','Team','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','userMailQueue:save','removeTeams','select','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','save','update','then','destroy','get','MailQueues','UserProfileResource','stack'];(function(_0x27cddc,_0x57780a){var _0x2aa574=function(_0x42cd6a){while(--_0x42cd6a){_0x27cddc['push'](_0x27cddc['shift']());}};_0x2aa574(++_0x57780a);}(_0xf60a,0x166));var _0xaf60=function(_0x26d1f4,_0x2142b7){_0x26d1f4=_0x26d1f4-0x0;var _0x4bc350=_0xf60a[_0x26d1f4];return _0x4bc350;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf60('0x0'));var zipdir=require(_0xaf60('0x1'));var jsonpatch=require(_0xaf60('0x2'));var rp=require(_0xaf60('0x3'));var moment=require('moment');var BPromise=require(_0xaf60('0x4'));var Mustache=require('mustache');var util=require(_0xaf60('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xaf60('0x6'));var ejs=require(_0xaf60('0x7'));var fs=require('fs');var fs_extra=require(_0xaf60('0x8'));var _=require(_0xaf60('0x9'));var squel=require(_0xaf60('0xa'));var crypto=require(_0xaf60('0xb'));var jsforce=require(_0xaf60('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaf60('0x6'));var querystring=require('querystring');var Papa=require(_0xaf60('0xd'));var Redis=require(_0xaf60('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaf60('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaf60('0x10'));var utils=require(_0xaf60('0x11'));var config=require(_0xaf60('0x12'));var licenseUtil=require(_0xaf60('0x13'));var db=require(_0xaf60('0x14'))['db'];config[_0xaf60('0x15')]=_[_0xaf60('0x16')](config[_0xaf60('0x15')],{'host':_0xaf60('0x17'),'port':0x18eb});var socket=require(_0xaf60('0x18'))(new Redis(config['redis']));require(_0xaf60('0x19'))[_0xaf60('0x1a')](socket);function respondWithStatusCode(_0x969b08,_0x5505e2){_0x5505e2=_0x5505e2||0xcc;return function(_0x5821f1){if(_0x5821f1){return _0x969b08[_0xaf60('0x1b')](_0x5505e2);}return _0x969b08[_0xaf60('0x1c')](_0x5505e2)[_0xaf60('0x1d')]();};}function respondWithResult(_0x38b582,_0x11de60){_0x11de60=_0x11de60||0xc8;return function(_0x26ea22){if(_0x26ea22){return _0x38b582[_0xaf60('0x1c')](_0x11de60)[_0xaf60('0x1e')](_0x26ea22);}};}function respondWithFilteredResult(_0x168be0,_0x28aff9){return function(_0x31a34f){if(_0x31a34f){var _0x55fe26=typeof _0x28aff9[_0xaf60('0x1f')]===_0xaf60('0x20')&&typeof _0x28aff9['limit']===_0xaf60('0x20');var _0x2d555b=_0x31a34f[_0xaf60('0x21')];var _0x25d8c4=_0x55fe26?0x0:_0x28aff9[_0xaf60('0x1f')];var _0x50f660=_0x55fe26?_0x31a34f[_0xaf60('0x21')]:_0x28aff9[_0xaf60('0x1f')]+_0x28aff9[_0xaf60('0x22')];var _0x536236;if(_0x50f660>=_0x2d555b){_0x50f660=_0x2d555b;_0x536236=0xc8;}else{_0x536236=0xce;}_0x168be0[_0xaf60('0x1c')](_0x536236);return _0x168be0[_0xaf60('0x23')]('Content-Range',_0x25d8c4+'-'+_0x50f660+'/'+_0x2d555b)['json'](_0x31a34f);}return null;};}function patchUpdates(_0x49ab65){return function(_0x5acf11){try{jsonpatch['apply'](_0x5acf11,_0x49ab65,!![]);}catch(_0x44b1f6){return BPromise['reject'](_0x44b1f6);}return _0x5acf11[_0xaf60('0x24')]();};}function saveUpdates(_0x598878,_0x215abe){return function(_0x2b048e){if(_0x2b048e){return _0x2b048e[_0xaf60('0x25')](_0x598878)[_0xaf60('0x26')](function(_0x168990){return _0x168990;});}return null;};}function removeEntity(_0x5797e0,_0x292469){return function(_0x39968a){if(_0x39968a){return _0x39968a[_0xaf60('0x27')]()['then'](function(){var _0x2cbdbd=_0x39968a[_0xaf60('0x28')]({'plain':!![]});var _0x2975a0=_0xaf60('0x29');return db[_0xaf60('0x2a')][_0xaf60('0x27')]({'where':{'type':_0x2975a0,'resourceId':_0x2cbdbd['id']}})[_0xaf60('0x26')](function(){return _0x39968a;});})[_0xaf60('0x26')](function(){_0x5797e0[_0xaf60('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59960a,_0x345e96){return function(_0x5a8db0){if(!_0x5a8db0){_0x59960a[_0xaf60('0x1b')](0x194);}return _0x5a8db0;};}function handleError(_0x57b5d6,_0x1a4698){_0x1a4698=_0x1a4698||0x1f4;return function(_0x2a404a){logger['error'](_0x2a404a[_0xaf60('0x2b')]);if(_0x2a404a[_0xaf60('0x2c')]){delete _0x2a404a[_0xaf60('0x2c')];}_0x57b5d6[_0xaf60('0x1c')](_0x1a4698)[_0xaf60('0x2d')](_0x2a404a);};}exports[_0xaf60('0x2e')]=function(_0x415476,_0x3e418c){var _0x4d91a1={},_0x4aba0d={},_0x4dea58={'count':0x0,'rows':[]};var _0x464b6f=_[_0xaf60('0x2f')](db[_0xaf60('0x30')]['rawAttributes'],function(_0x37603f){return{'name':_0x37603f['fieldName'],'type':_0x37603f[_0xaf60('0x31')]['key']};});_0x4aba0d[_0xaf60('0x32')]=_[_0xaf60('0x2f')](_0x464b6f,_0xaf60('0x2c'));_0x4aba0d[_0xaf60('0x33')]=_[_0xaf60('0x34')](_0x415476[_0xaf60('0x33')]);_0x4aba0d['filters']=_[_0xaf60('0x35')](_0x4aba0d[_0xaf60('0x32')],_0x4aba0d[_0xaf60('0x33')]);_0x4d91a1[_0xaf60('0x36')]=_[_0xaf60('0x35')](_0x4aba0d[_0xaf60('0x32')],qs[_0xaf60('0x37')](_0x415476[_0xaf60('0x33')][_0xaf60('0x37')]));_0x4d91a1[_0xaf60('0x36')]=_0x4d91a1[_0xaf60('0x36')][_0xaf60('0x38')]?_0x4d91a1[_0xaf60('0x36')]:_0x4aba0d[_0xaf60('0x32')];if(!_0x415476[_0xaf60('0x33')][_0xaf60('0x39')]('nolimit')){_0x4d91a1['limit']=qs[_0xaf60('0x22')](_0x415476[_0xaf60('0x33')]['limit']);_0x4d91a1[_0xaf60('0x1f')]=qs[_0xaf60('0x1f')](_0x415476[_0xaf60('0x33')][_0xaf60('0x1f')]);}_0x4d91a1[_0xaf60('0x3a')]=qs[_0xaf60('0x3b')](_0x415476[_0xaf60('0x33')][_0xaf60('0x3b')]);_0x4d91a1[_0xaf60('0x3c')]=qs[_0xaf60('0x3d')](_['pick'](_0x415476[_0xaf60('0x33')],_0x4aba0d[_0xaf60('0x3d')]),_0x464b6f);if(_0x415476[_0xaf60('0x33')][_0xaf60('0x3e')]){_0x4d91a1[_0xaf60('0x3c')]=_[_0xaf60('0x3f')](_0x4d91a1[_0xaf60('0x3c')],{'$or':_[_0xaf60('0x2f')](_0x464b6f,function(_0xe4eb46){if(_0xe4eb46[_0xaf60('0x31')]!==_0xaf60('0x40')){var _0x258ad9={};_0x258ad9[_0xe4eb46[_0xaf60('0x2c')]]={'$like':'%'+_0x415476['query'][_0xaf60('0x3e')]+'%'};return _0x258ad9;}})});}_0x4d91a1=_[_0xaf60('0x3f')]({},_0x4d91a1,_0x415476['options']);var _0x5ebb6d={'where':_0x4d91a1['where']};return db[_0xaf60('0x30')]['count'](_0x5ebb6d)[_0xaf60('0x26')](function(_0x22d34a){_0x4dea58['count']=_0x22d34a;if(_0x415476['query'][_0xaf60('0x41')]){_0x4d91a1[_0xaf60('0x42')]=[{'all':!![]}];}return db[_0xaf60('0x30')][_0xaf60('0x43')](_0x4d91a1);})[_0xaf60('0x26')](function(_0x488c32){_0x4dea58['rows']=_0x488c32;return _0x4dea58;})[_0xaf60('0x26')](respondWithFilteredResult(_0x3e418c,_0x4d91a1))[_0xaf60('0x44')](handleError(_0x3e418c,null));};exports[_0xaf60('0x45')]=function(_0x1bdf2b,_0xfbfeb){var _0x4fa6b2={'raw':!![],'where':{'id':_0x1bdf2b['params']['id']}},_0x2db568={};_0x2db568['model']=_[_0xaf60('0x34')](db[_0xaf60('0x30')][_0xaf60('0x46')]);_0x2db568[_0xaf60('0x33')]=_['keys'](_0x1bdf2b[_0xaf60('0x33')]);_0x2db568[_0xaf60('0x3d')]=_[_0xaf60('0x35')](_0x2db568[_0xaf60('0x32')],_0x2db568[_0xaf60('0x33')]);_0x4fa6b2[_0xaf60('0x36')]=_[_0xaf60('0x35')](_0x2db568[_0xaf60('0x32')],qs[_0xaf60('0x37')](_0x1bdf2b[_0xaf60('0x33')][_0xaf60('0x37')]));_0x4fa6b2[_0xaf60('0x36')]=_0x4fa6b2[_0xaf60('0x36')][_0xaf60('0x38')]?_0x4fa6b2[_0xaf60('0x36')]:_0x2db568[_0xaf60('0x32')];if(_0x1bdf2b[_0xaf60('0x33')]['includeAll']){_0x4fa6b2['include']=[{'all':!![]}];}_0x4fa6b2=_[_0xaf60('0x3f')]({},_0x4fa6b2,_0x1bdf2b[_0xaf60('0x47')]);return db[_0xaf60('0x30')][_0xaf60('0x48')](_0x4fa6b2)['then'](handleEntityNotFound(_0xfbfeb,null))['then'](respondWithResult(_0xfbfeb,null))[_0xaf60('0x44')](handleError(_0xfbfeb,null));};exports[_0xaf60('0x49')]=function(_0xea3ec0,_0x160c41){return db[_0xaf60('0x30')][_0xaf60('0x49')](_0xea3ec0[_0xaf60('0x4a')],{})[_0xaf60('0x26')](function(_0x538603){var _0x2b09ba=_0xea3ec0['user'][_0xaf60('0x28')]({'plain':!![]});if(!_0x2b09ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b09ba[_0xaf60('0x4b')]===_0xaf60('0x4c')){var _0x54c534=_0x538603['get']({'plain':!![]});var _0x26507e=_0xaf60('0x29');return db[_0xaf60('0x4d')]['find']({'where':{'name':_0x26507e,'userProfileId':_0x2b09ba['userProfileId']},'raw':!![]})['then'](function(_0x701bfe){if(_0x701bfe&&_0x701bfe['autoAssociation']===0x0){return db['UserProfileResource'][_0xaf60('0x49')]({'name':_0x54c534[_0xaf60('0x2c')],'resourceId':_0x54c534['id'],'type':_0x701bfe['name'],'sectionId':_0x701bfe['id']},{})['then'](function(){return _0x538603;});}else{return _0x538603;}})['catch'](function(_0x5be6fc){logger[_0xaf60('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5be6fc);throw _0x5be6fc;});}return _0x538603;})['then'](respondWithResult(_0x160c41,0xc9))['catch'](handleError(_0x160c41,null));};exports[_0xaf60('0x25')]=function(_0x95380d,_0x311f49){if(_0x95380d[_0xaf60('0x4a')]['id']){delete _0x95380d['body']['id'];}return db['MailQueue'][_0xaf60('0x48')]({'where':{'id':_0x95380d[_0xaf60('0x4f')]['id']}})[_0xaf60('0x26')](handleEntityNotFound(_0x311f49,null))[_0xaf60('0x26')](saveUpdates(_0x95380d[_0xaf60('0x4a')],null))[_0xaf60('0x26')](respondWithResult(_0x311f49,null))[_0xaf60('0x44')](handleError(_0x311f49,null));};exports[_0xaf60('0x27')]=function(_0x591202,_0x138e38){return db[_0xaf60('0x30')][_0xaf60('0x48')]({'where':{'id':_0x591202[_0xaf60('0x4f')]['id']}})['then'](handleEntityNotFound(_0x138e38,null))[_0xaf60('0x26')](removeEntity(_0x138e38,null))[_0xaf60('0x44')](handleError(_0x138e38,null));};exports['describe']=function(_0x1defa1,_0x5b3808){return db[_0xaf60('0x30')][_0xaf60('0x50')]()['then'](respondWithResult(_0x5b3808,null))[_0xaf60('0x44')](handleError(_0x5b3808,null));};exports['getMembers']=function(_0x1c3df3,_0x551a8f,_0x557de0){var _0x347de1={'raw':!![],'where':{}},_0x4071de={},_0x2557e4;return db['MailQueue']['findOne']({'where':{'id':_0x1c3df3[_0xaf60('0x4f')]['id']}})['then'](handleEntityNotFound(_0x551a8f,null))[_0xaf60('0x26')](function(_0x2896c4){if(_0x2896c4){_0x2557e4=_0x2896c4[_0xaf60('0x28')]({'plain':!![]});_0x4071de[_0xaf60('0x32')]=_[_0xaf60('0x34')](db['UserMailQueue'][_0xaf60('0x46')]);_0x4071de[_0xaf60('0x33')]=_[_0xaf60('0x34')](_0x1c3df3[_0xaf60('0x33')]);_0x4071de[_0xaf60('0x3d')]=_[_0xaf60('0x35')](_0x4071de[_0xaf60('0x32')],_0x4071de[_0xaf60('0x33')]);_0x347de1[_0xaf60('0x36')]=_[_0xaf60('0x35')](_0x4071de['model'],qs[_0xaf60('0x37')](_0x1c3df3['query']['fields']));_0x347de1[_0xaf60('0x36')]=_0x347de1[_0xaf60('0x36')]['length']?_0x347de1[_0xaf60('0x36')]:_0x4071de[_0xaf60('0x32')];if(!_0x1c3df3[_0xaf60('0x33')]['hasOwnProperty']('nolimit')){_0x347de1[_0xaf60('0x22')]=qs['limit'](_0x1c3df3[_0xaf60('0x33')][_0xaf60('0x22')]);_0x347de1[_0xaf60('0x1f')]=qs[_0xaf60('0x1f')](_0x1c3df3['query']['offset']);}_0x347de1[_0xaf60('0x3a')]=qs[_0xaf60('0x3b')](_0x1c3df3['query'][_0xaf60('0x3b')]);_0x347de1[_0xaf60('0x3c')]=qs[_0xaf60('0x3d')](_[_0xaf60('0x51')](_0x1c3df3[_0xaf60('0x33')],_0x4071de[_0xaf60('0x3d')]));_0x347de1['where'][_0xaf60('0x52')]=_0x2896c4['id'];if(_0x1c3df3[_0xaf60('0x33')][_0xaf60('0x3e')]){_0x347de1['where']=_[_0xaf60('0x3f')](_0x347de1[_0xaf60('0x3c')],{'$or':_[_0xaf60('0x2f')](_0x347de1[_0xaf60('0x36')],function(_0x42a427){var _0x24637e={};_0x24637e[_0x42a427]={'$like':'%'+_0x1c3df3[_0xaf60('0x33')][_0xaf60('0x3e')]+'%'};return _0x24637e;})});}_0x347de1=_[_0xaf60('0x3f')]({},_0x347de1,_0x1c3df3[_0xaf60('0x47')]);return db[_0xaf60('0x53')][_0xaf60('0x43')](_0x347de1);}})[_0xaf60('0x26')](function(_0x2100b0){if(_0x2100b0){return db[_0xaf60('0x54')][_0xaf60('0x55')]({'where':{'id':_[_0xaf60('0x2f')](_0x2100b0,_0xaf60('0x56')),'role':_0xaf60('0x57')},'attributes':['id',_0xaf60('0x2c'),_0xaf60('0x58'),_0xaf60('0x59'),_0xaf60('0x5a')]});}})[_0xaf60('0x26')](function(_0x760be1){if(_0x760be1){return{'count':_0x760be1['count'],'rows':_[_0xaf60('0x2f')](_0x760be1[_0xaf60('0x5b')],function(_0x58bb0d){return{'membername':_0x58bb0d[_0xaf60('0x2c')],'UserId':_0x58bb0d['id'],'queue_name':_0x2557e4[_0xaf60('0x2c')],'MailQueueId':_0x2557e4['id'],'interface':util['format'](_0xaf60('0x5c'),_0xaf60('0x5d'),_0x58bb0d[_0xaf60('0x2c')]),'penalty':0x0,'paused':_0x58bb0d[_0xaf60('0x58')],'createdAt':_0x58bb0d[_0xaf60('0x5a')],'updatedAt':_0x58bb0d[_0xaf60('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaf60('0x26')](respondWithFilteredResult(_0x551a8f,_0x347de1))['catch'](handleError(_0x551a8f,null));};exports[_0xaf60('0x5e')]=function(_0x8ec3bf,_0x16d89a,_0xf00280){var _0x27244c={};var _0x58f9f9={};var _0x291228;var _0x401a84;return db[_0xaf60('0x30')]['findOne']({'where':{'id':_0x8ec3bf['params']['id']}})[_0xaf60('0x26')](handleEntityNotFound(_0x16d89a,null))['then'](function(_0x4d5bc1){if(_0x4d5bc1){_0x291228=_0x4d5bc1;_0x58f9f9[_0xaf60('0x32')]=_[_0xaf60('0x34')](db[_0xaf60('0x5f')][_0xaf60('0x46')]);_0x58f9f9[_0xaf60('0x33')]=_['keys'](_0x8ec3bf[_0xaf60('0x33')]);_0x58f9f9[_0xaf60('0x3d')]=_[_0xaf60('0x35')](_0x58f9f9[_0xaf60('0x32')],_0x58f9f9[_0xaf60('0x33')]);_0x27244c[_0xaf60('0x36')]=_['intersection'](_0x58f9f9[_0xaf60('0x32')],qs[_0xaf60('0x37')](_0x8ec3bf[_0xaf60('0x33')]['fields']));_0x27244c[_0xaf60('0x36')]=_0x27244c['attributes']['length']?_0x27244c['attributes']:_0x58f9f9[_0xaf60('0x32')];_0x27244c[_0xaf60('0x3a')]=qs[_0xaf60('0x3b')](_0x8ec3bf[_0xaf60('0x33')][_0xaf60('0x3b')]);_0x27244c[_0xaf60('0x3c')]=qs['filters'](_[_0xaf60('0x51')](_0x8ec3bf[_0xaf60('0x33')],_0x58f9f9['filters']));if(_0x8ec3bf['query'][_0xaf60('0x3e')]){_0x27244c[_0xaf60('0x3c')]=_[_0xaf60('0x3f')](_0x27244c['where'],{'$or':_[_0xaf60('0x2f')](_0x27244c[_0xaf60('0x36')],function(_0x415d72){var _0x252294={};_0x252294[_0x415d72]={'$like':'%'+_0x8ec3bf[_0xaf60('0x33')][_0xaf60('0x3e')]+'%'};return _0x252294;})});}_0x27244c=_[_0xaf60('0x3f')]({},_0x27244c,_0x8ec3bf[_0xaf60('0x47')]);return _0x291228[_0xaf60('0x5e')](_0x27244c);}})[_0xaf60('0x26')](function(_0xb23d24){if(_0xb23d24){_0x401a84=_0xb23d24['length'];if(!_0x8ec3bf[_0xaf60('0x33')][_0xaf60('0x39')]('nolimit')){_0x27244c[_0xaf60('0x22')]=qs[_0xaf60('0x22')](_0x8ec3bf[_0xaf60('0x33')][_0xaf60('0x22')]);_0x27244c['offset']=qs['offset'](_0x8ec3bf[_0xaf60('0x33')][_0xaf60('0x1f')]);}return _0x291228[_0xaf60('0x5e')](_0x27244c);}})[_0xaf60('0x26')](function(_0x53e9fe){if(_0x53e9fe){return _0x53e9fe?{'count':_0x401a84,'rows':_0x53e9fe}:null;}})['then'](respondWithResult(_0x16d89a,null))[_0xaf60('0x44')](handleError(_0x16d89a,null));};exports['addTeams']=function(_0x502fcd,_0x1e205f,_0x3f53f9){var _0x367c86=_0x502fcd[_0xaf60('0x4a')][_0xaf60('0x60')];return db[_0xaf60('0x5f')][_0xaf60('0x43')]({'where':{'id':_0x367c86},'attributes':['id'],'include':[{'model':db[_0xaf60('0x54')],'as':_0xaf60('0x61'),'attributes':['id',_0xaf60('0x2c'),_0xaf60('0x62'),'voicePause',_0xaf60('0x63')],'raw':!![]}]})['then'](function(_0x394306){if(_0x394306){var _0x36efbd=_[_0xaf60('0x64')](_0x394306,function(_0x5791a4){var _0x454ec6=_0x5791a4['get']({'plain':!![]});return _0x454ec6['Agents'];});return db['MailQueue']['find']({'where':{'id':_0x502fcd[_0xaf60('0x4f')]['id']}})[_0xaf60('0x26')](function(_0x153bd0){return db[_0xaf60('0x65')][_0xaf60('0x66')](function(_0x987282){return _0x153bd0[_0xaf60('0x67')](_0x367c86,{'transaction':_0x987282})[_0xaf60('0x26')](function(){return BPromise['each'](_0x36efbd,function(_0xa0b787){return db[_0xaf60('0x53')][_0xaf60('0x68')]({'where':{'UserId':_0xa0b787['id'],'MailQueueId':_0x502fcd[_0xaf60('0x4f')]['id']},'transaction':_0x987282});});})[_0xaf60('0x26')](function(){_0x36efbd[_0xaf60('0x69')](function(_0x2dba65){socket['emit'](_0xaf60('0x6a'),{'UserId':_0x2dba65['id'],'MailQueueId':_0x153bd0['id']});});});});});}})['then'](respondWithStatusCode(_0x1e205f,null))[_0xaf60('0x44')](handleError(_0x1e205f,null));};exports[_0xaf60('0x6b')]=function(_0x24deab,_0x4f7ce3,_0x1887b6){return db[_0xaf60('0x5f')][_0xaf60('0x43')]({'where':{'id':_0x24deab[_0xaf60('0x33')][_0xaf60('0x60')]},'attributes':['id'],'include':[{'model':db[_0xaf60('0x54')],'as':_0xaf60('0x61'),'attributes':['id'],'raw':!![]}]})[_0xaf60('0x26')](handleEntityNotFound(_0x4f7ce3,null))[_0xaf60('0x26')](function(_0x55b170){var _0x45817d=_['map'](_0x55b170,'id');var _0x1c7206=[];var _0x39b2ec=[];var _0x560daa=squel[_0xaf60('0x6c')]();_0x560daa['field'](_0xaf60('0x6d'))['from'](_0xaf60('0x6e'),'tq')[_0xaf60('0x6f')](_0xaf60('0x70'),'ut',_0xaf60('0x71'))[_0xaf60('0x3c')]('MailQueueId\x20=\x20?',_0x24deab[_0xaf60('0x4f')]['id']);for(var _0x466cde=0x0;_0x466cde<_0x55b170['length'];_0x466cde+=0x1){let _0x2364db=_0x55b170[_0x466cde];for(var _0x2156be=0x0;_0x2156be<_0x2364db[_0xaf60('0x61')][_0xaf60('0x38')];_0x2156be+=0x1){let _0xa9a617=_0x2364db[_0xaf60('0x61')][_0x2156be];var _0x5c7b4f=_0x560daa[_0xaf60('0x72')]();_0x5c7b4f[_0xaf60('0x3c')]('ut.UserId\x20=\x20?',_0xa9a617['id']);_0x39b2ec[_0xaf60('0x73')](db[_0xaf60('0x65')][_0xaf60('0x33')](_0x5c7b4f[_0xaf60('0x74')](),{'type':db[_0xaf60('0x65')][_0xaf60('0x75')]['SELECT']})['then'](function(_0x3892d6){if(_0x3892d6[_0xaf60('0x38')]===0x1){return _0xa9a617['id'];}else{var _0x3eb345=_[_0xaf60('0x76')](_['map'](_0x3892d6,_0xaf60('0x77')),function(_0x11dc65){return _[_0xaf60('0x78')](_0x45817d,_0x11dc65);});if(_0x3eb345){return _0xa9a617['id'];}}}));}}return BPromise['all'](_0x39b2ec)[_0xaf60('0x26')](function(_0x5e1fc0){_0x1c7206=_(_0x1c7206)[_0xaf60('0x79')](_0x5e1fc0)[_0xaf60('0x7a')]()[_0xaf60('0x7b')]();return db['MailQueue']['find']({'where':{'id':_0x24deab['params']['id']}})[_0xaf60('0x26')](function(_0x358a19){return db[_0xaf60('0x65')][_0xaf60('0x66')](function(_0x396825){return _0x358a19[_0xaf60('0x6b')](_0x24deab['query']['ids'],{'transaction':_0x396825})[_0xaf60('0x26')](function(){if(!_[_0xaf60('0x7c')](_0x1c7206)){return _0x358a19[_0xaf60('0x7d')](_0x1c7206,{'transaction':_0x396825});}})[_0xaf60('0x26')](function(){_0x1c7206[_0xaf60('0x69')](function(_0x15dba3){socket[_0xaf60('0x7e')](_0xaf60('0x7f'),{'UserId':_0x15dba3,'MailQueueId':_0x358a19['id']});});});});});});})[_0xaf60('0x26')](respondWithStatusCode(_0x4f7ce3,null))['catch'](handleError(_0x4f7ce3,null));};exports[_0xaf60('0x80')]=function(_0x7da04d,_0x151dd0,_0x52ff63){return db[_0xaf60('0x30')]['find']({'where':{'id':_0x7da04d[_0xaf60('0x4f')]['id']}})[_0xaf60('0x26')](handleEntityNotFound(_0x151dd0,null))[_0xaf60('0x26')](function(_0x492403){if(_0x492403){return _0x492403[_0xaf60('0x80')](_0x7da04d['body']['ids'],_[_0xaf60('0x81')](_0x7da04d[_0xaf60('0x4a')],[_0xaf60('0x60'),'id'])||{})[_0xaf60('0x82')](function(_0x39ed38){for(var _0x13b43c=0x0;_0x13b43c<_0x7da04d[_0xaf60('0x4a')][_0xaf60('0x60')][_0xaf60('0x38')];_0x13b43c+=0x1){socket[_0xaf60('0x7e')](_0xaf60('0x6a'),{'UserId':Number(_0x7da04d[_0xaf60('0x4a')][_0xaf60('0x60')][_0x13b43c]),'MailQueueId':Number(_0x7da04d['params']['id'])});}return _0x39ed38;});}})['then'](respondWithResult(_0x151dd0,null))['catch'](handleError(_0x151dd0,null));};exports['removeAgents']=function(_0x4f3915,_0x5431ad,_0x2102c7){return db[_0xaf60('0x30')]['find']({'where':{'id':_0x4f3915[_0xaf60('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5431ad,null))[_0xaf60('0x26')](function(_0x43bdf0){if(_0x43bdf0){return _0x43bdf0[_0xaf60('0x7d')](_0x4f3915[_0xaf60('0x33')][_0xaf60('0x60')])[_0xaf60('0x26')](function(){if(_[_0xaf60('0x83')](_0x4f3915['query'][_0xaf60('0x60')])){for(var _0x50ce11=0x0;_0x50ce11<_0x4f3915[_0xaf60('0x33')][_0xaf60('0x60')][_0xaf60('0x38')];_0x50ce11+=0x1){socket[_0xaf60('0x7e')](_0xaf60('0x7f'),{'UserId':Number(_0x4f3915[_0xaf60('0x33')][_0xaf60('0x60')][_0x50ce11]),'MailQueueId':Number(_0x4f3915[_0xaf60('0x4f')]['id'])});}}else{socket[_0xaf60('0x7e')]('userMailQueue:remove',{'UserId':Number(_0x4f3915[_0xaf60('0x33')][_0xaf60('0x60')]),'MailQueueId':Number(_0x4f3915[_0xaf60('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x5431ad,null))[_0xaf60('0x44')](handleError(_0x5431ad,null));};exports['getAgents']=function(_0x5aefe3,_0x50c100,_0xf49c95){var _0x2d271b={};var _0xcd85cd={};var _0x485780;var _0x292426;return db['MailQueue']['findOne']({'where':{'id':_0x5aefe3[_0xaf60('0x4f')]['id']}})[_0xaf60('0x26')](handleEntityNotFound(_0x50c100,null))[_0xaf60('0x26')](function(_0x54e39b){if(_0x54e39b){_0x485780=_0x54e39b;_0xcd85cd[_0xaf60('0x32')]=_['keys'](db[_0xaf60('0x54')][_0xaf60('0x46')]);_0xcd85cd[_0xaf60('0x33')]=_[_0xaf60('0x34')](_0x5aefe3[_0xaf60('0x33')]);_0xcd85cd[_0xaf60('0x3d')]=_[_0xaf60('0x35')](_0xcd85cd[_0xaf60('0x32')],_0xcd85cd['query']);_0x2d271b[_0xaf60('0x36')]=_[_0xaf60('0x35')](_0xcd85cd[_0xaf60('0x32')],qs[_0xaf60('0x37')](_0x5aefe3[_0xaf60('0x33')][_0xaf60('0x37')]));_0x2d271b[_0xaf60('0x36')]=_0x2d271b[_0xaf60('0x36')]['length']?_0x2d271b[_0xaf60('0x36')]:_0xcd85cd[_0xaf60('0x32')];_0x2d271b[_0xaf60('0x3a')]=qs[_0xaf60('0x3b')](_0x5aefe3[_0xaf60('0x33')][_0xaf60('0x3b')]);_0x2d271b[_0xaf60('0x3c')]=qs[_0xaf60('0x3d')](_['pick'](_0x5aefe3[_0xaf60('0x33')],_0xcd85cd[_0xaf60('0x3d')]));if(_0x5aefe3[_0xaf60('0x33')][_0xaf60('0x3e')]){_0x2d271b[_0xaf60('0x3c')]=_[_0xaf60('0x3f')](_0x2d271b[_0xaf60('0x3c')],{'$or':_[_0xaf60('0x2f')](_0x2d271b[_0xaf60('0x36')],function(_0x511b9f){var _0xca76ba={};_0xca76ba[_0x511b9f]={'$like':'%'+_0x5aefe3['query'][_0xaf60('0x3e')]+'%'};return _0xca76ba;})});}_0x2d271b=_[_0xaf60('0x3f')]({},_0x2d271b,_0x5aefe3[_0xaf60('0x47')]);return _0x485780[_0xaf60('0x84')](_0x2d271b);}})[_0xaf60('0x26')](function(_0x5c5a1e){if(_0x5c5a1e){_0x292426=_0x5c5a1e[_0xaf60('0x38')];if(!_0x5aefe3[_0xaf60('0x33')]['hasOwnProperty'](_0xaf60('0x85'))){_0x2d271b[_0xaf60('0x22')]=qs[_0xaf60('0x22')](_0x5aefe3[_0xaf60('0x33')][_0xaf60('0x22')]);_0x2d271b['offset']=qs[_0xaf60('0x1f')](_0x5aefe3['query'][_0xaf60('0x1f')]);}return _0x485780[_0xaf60('0x84')](_0x2d271b);}})[_0xaf60('0x26')](function(_0x53378c){if(_0x53378c){return _0x53378c?{'count':_0x292426,'rows':_0x53378c}:null;}})[_0xaf60('0x26')](respondWithResult(_0x50c100,null))['catch'](handleError(_0x50c100,null));}; \ No newline at end of file +var _0xd86a=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','destroy','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','MailQueueId','User','agent','mailPause','createdAt','%s/%s','updatedAt','getTeams','Team','order','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','nolimit','sort','where','filters','pick','filter','merge'];(function(_0x3ae9d6,_0x293b86){var _0x3e16da=function(_0x1888a4){while(--_0x1888a4){_0x3ae9d6['push'](_0x3ae9d6['shift']());}};_0x3e16da(++_0x293b86);}(_0xd86a,0xd1));var _0xad86=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0xd86a[_0x212bf5];return _0xfcad21;};'use strict';var emlformat=require(_0xad86('0x0'));var rimraf=require(_0xad86('0x1'));var zipdir=require(_0xad86('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad86('0x3'));var moment=require(_0xad86('0x4'));var BPromise=require(_0xad86('0x5'));var Mustache=require(_0xad86('0x6'));var util=require(_0xad86('0x7'));var path=require('path');var sox=require(_0xad86('0x8'));var csv=require(_0xad86('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad86('0xa'));var _=require(_0xad86('0xb'));var squel=require(_0xad86('0xc'));var crypto=require(_0xad86('0xd'));var jsforce=require(_0xad86('0xe'));var deskjs=require(_0xad86('0xf'));var toCsv=require(_0xad86('0x9'));var querystring=require(_0xad86('0x10'));var Papa=require(_0xad86('0x11'));var Redis=require(_0xad86('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xad86('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad86('0x14'))(_0xad86('0x15'));var utils=require(_0xad86('0x16'));var config=require(_0xad86('0x17'));var licenseUtil=require(_0xad86('0x18'));var db=require(_0xad86('0x19'))['db'];config[_0xad86('0x1a')]=_[_0xad86('0x1b')](config[_0xad86('0x1a')],{'host':_0xad86('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xad86('0x1a')]));require(_0xad86('0x1d'))['register'](socket);function respondWithStatusCode(_0x3b0c1b,_0x290639){_0x290639=_0x290639||0xcc;return function(_0x3501eb){if(_0x3501eb){return _0x3b0c1b[_0xad86('0x1e')](_0x290639);}return _0x3b0c1b[_0xad86('0x1f')](_0x290639)['end']();};}function respondWithResult(_0xde2d8d,_0x2d3ab8){_0x2d3ab8=_0x2d3ab8||0xc8;return function(_0x3d88d6){if(_0x3d88d6){return _0xde2d8d[_0xad86('0x1f')](_0x2d3ab8)[_0xad86('0x20')](_0x3d88d6);}};}function respondWithFilteredResult(_0x1cfb36,_0x2eb962){return function(_0x2e0d8a){if(_0x2e0d8a){var _0x3893cb=typeof _0x2eb962[_0xad86('0x21')]===_0xad86('0x22')&&typeof _0x2eb962['limit']===_0xad86('0x22');var _0x48a0d3=_0x2e0d8a[_0xad86('0x23')];var _0x1efac0=_0x3893cb?0x0:_0x2eb962[_0xad86('0x21')];var _0x4a834c=_0x3893cb?_0x2e0d8a[_0xad86('0x23')]:_0x2eb962['offset']+_0x2eb962[_0xad86('0x24')];var _0x4a0b31;if(_0x4a834c>=_0x48a0d3){_0x4a834c=_0x48a0d3;_0x4a0b31=0xc8;}else{_0x4a0b31=0xce;}_0x1cfb36[_0xad86('0x1f')](_0x4a0b31);return _0x1cfb36[_0xad86('0x25')](_0xad86('0x26'),_0x1efac0+'-'+_0x4a834c+'/'+_0x48a0d3)[_0xad86('0x20')](_0x2e0d8a);}return null;};}function patchUpdates(_0x253de5){return function(_0x231baf){try{jsonpatch['apply'](_0x231baf,_0x253de5,!![]);}catch(_0x272f8d){return BPromise[_0xad86('0x27')](_0x272f8d);}return _0x231baf['save']();};}function saveUpdates(_0x25880c,_0x4c036d){return function(_0x5441ab){if(_0x5441ab){return _0x5441ab[_0xad86('0x28')](_0x25880c)[_0xad86('0x29')](function(_0x2a707e){return _0x2a707e;});}return null;};}function removeEntity(_0x412618,_0x515ec2){return function(_0x24fc99){if(_0x24fc99){return _0x24fc99['destroy']()[_0xad86('0x29')](function(){var _0x508017=_0x24fc99[_0xad86('0x2a')]({'plain':!![]});var _0x1f0790=_0xad86('0x2b');return db[_0xad86('0x2c')]['destroy']({'where':{'type':_0x1f0790,'resourceId':_0x508017['id']}})[_0xad86('0x29')](function(){return _0x24fc99;});})['then'](function(){_0x412618['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c552,_0xa9a234){return function(_0x3dd773){if(!_0x3dd773){_0x36c552[_0xad86('0x1e')](0x194);}return _0x3dd773;};}function handleError(_0x224ec1,_0x5db3b2){_0x5db3b2=_0x5db3b2||0x1f4;return function(_0x4ed0d3){logger[_0xad86('0x2d')](_0x4ed0d3[_0xad86('0x2e')]);if(_0x4ed0d3['name']){delete _0x4ed0d3[_0xad86('0x2f')];}_0x224ec1[_0xad86('0x1f')](_0x5db3b2)[_0xad86('0x30')](_0x4ed0d3);};}exports[_0xad86('0x31')]=function(_0x5d5546,_0xd09395){var _0x3d24d8={},_0x59c94a={},_0x18348a={'count':0x0,'rows':[]};var _0x14993=_[_0xad86('0x32')](db[_0xad86('0x33')][_0xad86('0x34')],function(_0x59a275){return{'name':_0x59a275[_0xad86('0x35')],'type':_0x59a275[_0xad86('0x36')][_0xad86('0x37')]};});_0x59c94a[_0xad86('0x38')]=_['map'](_0x14993,_0xad86('0x2f'));_0x59c94a['query']=_[_0xad86('0x39')](_0x5d5546[_0xad86('0x3a')]);_0x59c94a['filters']=_['intersection'](_0x59c94a[_0xad86('0x38')],_0x59c94a['query']);_0x3d24d8['attributes']=_[_0xad86('0x3b')](_0x59c94a[_0xad86('0x38')],qs[_0xad86('0x3c')](_0x5d5546['query'][_0xad86('0x3c')]));_0x3d24d8[_0xad86('0x3d')]=_0x3d24d8[_0xad86('0x3d')]['length']?_0x3d24d8[_0xad86('0x3d')]:_0x59c94a['model'];if(!_0x5d5546[_0xad86('0x3a')]['hasOwnProperty'](_0xad86('0x3e'))){_0x3d24d8[_0xad86('0x24')]=qs[_0xad86('0x24')](_0x5d5546[_0xad86('0x3a')][_0xad86('0x24')]);_0x3d24d8['offset']=qs['offset'](_0x5d5546[_0xad86('0x3a')][_0xad86('0x21')]);}_0x3d24d8['order']=qs[_0xad86('0x3f')](_0x5d5546['query'][_0xad86('0x3f')]);_0x3d24d8[_0xad86('0x40')]=qs[_0xad86('0x41')](_[_0xad86('0x42')](_0x5d5546[_0xad86('0x3a')],_0x59c94a[_0xad86('0x41')]),_0x14993);if(_0x5d5546[_0xad86('0x3a')][_0xad86('0x43')]){_0x3d24d8[_0xad86('0x40')]=_[_0xad86('0x44')](_0x3d24d8['where'],{'$or':_[_0xad86('0x32')](_0x14993,function(_0x1205cd){if(_0x1205cd[_0xad86('0x36')]!==_0xad86('0x45')){var _0x2049a3={};_0x2049a3[_0x1205cd[_0xad86('0x2f')]]={'$like':'%'+_0x5d5546[_0xad86('0x3a')][_0xad86('0x43')]+'%'};return _0x2049a3;}})});}_0x3d24d8=_[_0xad86('0x44')]({},_0x3d24d8,_0x5d5546[_0xad86('0x46')]);var _0x43c1b3={'where':_0x3d24d8['where']};return db[_0xad86('0x33')]['count'](_0x43c1b3)['then'](function(_0x3c56c9){_0x18348a['count']=_0x3c56c9;if(_0x5d5546[_0xad86('0x3a')][_0xad86('0x47')]){_0x3d24d8[_0xad86('0x48')]=[{'all':!![]}];}return db[_0xad86('0x33')][_0xad86('0x49')](_0x3d24d8);})[_0xad86('0x29')](function(_0x240ccb){_0x18348a[_0xad86('0x4a')]=_0x240ccb;return _0x18348a;})[_0xad86('0x29')](respondWithFilteredResult(_0xd09395,_0x3d24d8))['catch'](handleError(_0xd09395,null));};exports[_0xad86('0x4b')]=function(_0x2f2814,_0x2e227b){var _0x1f1675={'raw':!![],'where':{'id':_0x2f2814[_0xad86('0x4c')]['id']}},_0x34b9df={};_0x34b9df[_0xad86('0x38')]=_[_0xad86('0x39')](db[_0xad86('0x33')][_0xad86('0x34')]);_0x34b9df[_0xad86('0x3a')]=_[_0xad86('0x39')](_0x2f2814[_0xad86('0x3a')]);_0x34b9df['filters']=_['intersection'](_0x34b9df[_0xad86('0x38')],_0x34b9df['query']);_0x1f1675[_0xad86('0x3d')]=_[_0xad86('0x3b')](_0x34b9df[_0xad86('0x38')],qs['fields'](_0x2f2814['query'][_0xad86('0x3c')]));_0x1f1675['attributes']=_0x1f1675[_0xad86('0x3d')][_0xad86('0x4d')]?_0x1f1675['attributes']:_0x34b9df[_0xad86('0x38')];if(_0x2f2814[_0xad86('0x3a')][_0xad86('0x47')]){_0x1f1675[_0xad86('0x48')]=[{'all':!![]}];}_0x1f1675=_['merge']({},_0x1f1675,_0x2f2814[_0xad86('0x46')]);return db[_0xad86('0x33')][_0xad86('0x4e')](_0x1f1675)[_0xad86('0x29')](handleEntityNotFound(_0x2e227b,null))['then'](respondWithResult(_0x2e227b,null))[_0xad86('0x4f')](handleError(_0x2e227b,null));};exports[_0xad86('0x50')]=function(_0x2ce237,_0x189072){return db[_0xad86('0x33')]['create'](_0x2ce237[_0xad86('0x51')],{})[_0xad86('0x29')](function(_0x556a98){var _0x6543e9=_0x2ce237[_0xad86('0x52')][_0xad86('0x2a')]({'plain':!![]});if(!_0x6543e9)throw new Error(_0xad86('0x53'));if(_0x6543e9[_0xad86('0x54')]===_0xad86('0x52')){var _0x4255f8=_0x556a98['get']({'plain':!![]});var _0x291e34=_0xad86('0x2b');return db['UserProfileSection'][_0xad86('0x4e')]({'where':{'name':_0x291e34,'userProfileId':_0x6543e9[_0xad86('0x55')]},'raw':!![]})['then'](function(_0x55d23a){if(_0x55d23a&&_0x55d23a[_0xad86('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x4255f8['name'],'resourceId':_0x4255f8['id'],'type':_0x55d23a[_0xad86('0x2f')],'sectionId':_0x55d23a['id']},{})['then'](function(){return _0x556a98;});}else{return _0x556a98;}})[_0xad86('0x4f')](function(_0x491b28){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x491b28);throw _0x491b28;});}return _0x556a98;})[_0xad86('0x29')](respondWithResult(_0x189072,0xc9))[_0xad86('0x4f')](handleError(_0x189072,null));};exports[_0xad86('0x28')]=function(_0x567c92,_0x27bc47){if(_0x567c92[_0xad86('0x51')]['id']){delete _0x567c92[_0xad86('0x51')]['id'];}return db[_0xad86('0x33')][_0xad86('0x4e')]({'where':{'id':_0x567c92['params']['id']}})['then'](handleEntityNotFound(_0x27bc47,null))[_0xad86('0x29')](saveUpdates(_0x567c92[_0xad86('0x51')],null))[_0xad86('0x29')](respondWithResult(_0x27bc47,null))[_0xad86('0x4f')](handleError(_0x27bc47,null));};exports[_0xad86('0x57')]=function(_0x1d9094,_0x2ff78b){return db[_0xad86('0x33')][_0xad86('0x4e')]({'where':{'id':_0x1d9094[_0xad86('0x4c')]['id']}})[_0xad86('0x29')](handleEntityNotFound(_0x2ff78b,null))[_0xad86('0x29')](removeEntity(_0x2ff78b,null))[_0xad86('0x4f')](handleError(_0x2ff78b,null));};exports[_0xad86('0x58')]=function(_0x353caf,_0x595930){return db[_0xad86('0x33')]['describe']()[_0xad86('0x29')](respondWithResult(_0x595930,null))[_0xad86('0x4f')](handleError(_0x595930,null));};exports[_0xad86('0x59')]=function(_0x4d9082,_0x5b4d94,_0x4c132c){var _0x226a35={'raw':!![],'where':{}},_0x2d8b00={},_0x3fe73c;return db['MailQueue'][_0xad86('0x5a')]({'where':{'id':_0x4d9082[_0xad86('0x4c')]['id']}})[_0xad86('0x29')](handleEntityNotFound(_0x5b4d94,null))[_0xad86('0x29')](function(_0x2f2b73){if(_0x2f2b73){_0x3fe73c=_0x2f2b73['get']({'plain':!![]});_0x2d8b00[_0xad86('0x38')]=_[_0xad86('0x39')](db[_0xad86('0x5b')][_0xad86('0x34')]);_0x2d8b00['query']=_[_0xad86('0x39')](_0x4d9082[_0xad86('0x3a')]);_0x2d8b00[_0xad86('0x41')]=_[_0xad86('0x3b')](_0x2d8b00[_0xad86('0x38')],_0x2d8b00['query']);_0x226a35['attributes']=_[_0xad86('0x3b')](_0x2d8b00[_0xad86('0x38')],qs['fields'](_0x4d9082[_0xad86('0x3a')]['fields']));_0x226a35[_0xad86('0x3d')]=_0x226a35[_0xad86('0x3d')]['length']?_0x226a35[_0xad86('0x3d')]:_0x2d8b00[_0xad86('0x38')];if(!_0x4d9082[_0xad86('0x3a')][_0xad86('0x5c')]('nolimit')){_0x226a35[_0xad86('0x24')]=qs['limit'](_0x4d9082[_0xad86('0x3a')][_0xad86('0x24')]);_0x226a35[_0xad86('0x21')]=qs['offset'](_0x4d9082[_0xad86('0x3a')][_0xad86('0x21')]);}_0x226a35['order']=qs[_0xad86('0x3f')](_0x4d9082['query'][_0xad86('0x3f')]);_0x226a35[_0xad86('0x40')]=qs[_0xad86('0x41')](_[_0xad86('0x42')](_0x4d9082[_0xad86('0x3a')],_0x2d8b00['filters']));_0x226a35[_0xad86('0x40')][_0xad86('0x5d')]=_0x2f2b73['id'];if(_0x4d9082['query']['filter']){_0x226a35[_0xad86('0x40')]=_[_0xad86('0x44')](_0x226a35[_0xad86('0x40')],{'$or':_[_0xad86('0x32')](_0x226a35[_0xad86('0x3d')],function(_0x52b743){var _0x28044f={};_0x28044f[_0x52b743]={'$like':'%'+_0x4d9082['query'][_0xad86('0x43')]+'%'};return _0x28044f;})});}_0x226a35=_[_0xad86('0x44')]({},_0x226a35,_0x4d9082[_0xad86('0x46')]);return db[_0xad86('0x5b')]['findAll'](_0x226a35);}})['then'](function(_0xb3df32){if(_0xb3df32){return db[_0xad86('0x5e')]['findAndCountAll']({'where':{'id':_[_0xad86('0x32')](_0xb3df32,'UserId'),'role':_0xad86('0x5f')},'attributes':['id',_0xad86('0x2f'),_0xad86('0x60'),'updatedAt',_0xad86('0x61')]});}})[_0xad86('0x29')](function(_0x5ef34f){if(_0x5ef34f){return{'count':_0x5ef34f[_0xad86('0x23')],'rows':_[_0xad86('0x32')](_0x5ef34f[_0xad86('0x4a')],function(_0x114eb1){return{'membername':_0x114eb1['name'],'UserId':_0x114eb1['id'],'queue_name':_0x3fe73c[_0xad86('0x2f')],'MailQueueId':_0x3fe73c['id'],'interface':util['format'](_0xad86('0x62'),'SIP',_0x114eb1[_0xad86('0x2f')]),'penalty':0x0,'paused':_0x114eb1[_0xad86('0x60')],'createdAt':_0x114eb1[_0xad86('0x61')],'updatedAt':_0x114eb1[_0xad86('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5b4d94,_0x226a35))[_0xad86('0x4f')](handleError(_0x5b4d94,null));};exports[_0xad86('0x64')]=function(_0x32ba46,_0x2d4a33,_0x4fd7bc){var _0x195a3e={};var _0x247825={};var _0x425984;var _0xeaa387;return db['MailQueue'][_0xad86('0x5a')]({'where':{'id':_0x32ba46[_0xad86('0x4c')]['id']}})[_0xad86('0x29')](handleEntityNotFound(_0x2d4a33,null))[_0xad86('0x29')](function(_0x247a4d){if(_0x247a4d){_0x425984=_0x247a4d;_0x247825['model']=_['keys'](db[_0xad86('0x65')][_0xad86('0x34')]);_0x247825[_0xad86('0x3a')]=_[_0xad86('0x39')](_0x32ba46[_0xad86('0x3a')]);_0x247825['filters']=_['intersection'](_0x247825['model'],_0x247825['query']);_0x195a3e['attributes']=_[_0xad86('0x3b')](_0x247825[_0xad86('0x38')],qs['fields'](_0x32ba46[_0xad86('0x3a')][_0xad86('0x3c')]));_0x195a3e[_0xad86('0x3d')]=_0x195a3e[_0xad86('0x3d')][_0xad86('0x4d')]?_0x195a3e['attributes']:_0x247825[_0xad86('0x38')];_0x195a3e[_0xad86('0x66')]=qs[_0xad86('0x3f')](_0x32ba46['query'][_0xad86('0x3f')]);_0x195a3e[_0xad86('0x40')]=qs[_0xad86('0x41')](_[_0xad86('0x42')](_0x32ba46[_0xad86('0x3a')],_0x247825[_0xad86('0x41')]));if(_0x32ba46[_0xad86('0x3a')][_0xad86('0x43')]){_0x195a3e['where']=_['merge'](_0x195a3e[_0xad86('0x40')],{'$or':_[_0xad86('0x32')](_0x195a3e[_0xad86('0x3d')],function(_0x3ffc72){var _0x26d7eb={};_0x26d7eb[_0x3ffc72]={'$like':'%'+_0x32ba46[_0xad86('0x3a')]['filter']+'%'};return _0x26d7eb;})});}_0x195a3e=_['merge']({},_0x195a3e,_0x32ba46[_0xad86('0x46')]);return _0x425984[_0xad86('0x64')](_0x195a3e);}})[_0xad86('0x29')](function(_0x3a4116){if(_0x3a4116){_0xeaa387=_0x3a4116['length'];if(!_0x32ba46[_0xad86('0x3a')][_0xad86('0x5c')](_0xad86('0x3e'))){_0x195a3e[_0xad86('0x24')]=qs['limit'](_0x32ba46[_0xad86('0x3a')]['limit']);_0x195a3e[_0xad86('0x21')]=qs['offset'](_0x32ba46[_0xad86('0x3a')][_0xad86('0x21')]);}return _0x425984[_0xad86('0x64')](_0x195a3e);}})[_0xad86('0x29')](function(_0x12b49a){if(_0x12b49a){return _0x12b49a?{'count':_0xeaa387,'rows':_0x12b49a}:null;}})[_0xad86('0x29')](respondWithResult(_0x2d4a33,null))[_0xad86('0x4f')](handleError(_0x2d4a33,null));};exports[_0xad86('0x67')]=function(_0x99881a,_0x2384df,_0x46abd3){var _0x29a49c=_0x99881a['body'][_0xad86('0x68')];return db['Team'][_0xad86('0x49')]({'where':{'id':_0x29a49c},'attributes':['id'],'include':[{'model':db[_0xad86('0x5e')],'as':_0xad86('0x69'),'attributes':['id',_0xad86('0x2f'),_0xad86('0x6a'),_0xad86('0x6b'),_0xad86('0x6c')],'raw':!![]}]})[_0xad86('0x29')](function(_0x4fa9b9){if(_0x4fa9b9){var _0x543eaf=_['flatMap'](_0x4fa9b9,function(_0x59764d){var _0xf78109=_0x59764d[_0xad86('0x2a')]({'plain':!![]});return _0xf78109['Agents'];});return db['MailQueue'][_0xad86('0x4e')]({'where':{'id':_0x99881a[_0xad86('0x4c')]['id']}})[_0xad86('0x29')](function(_0xfa513f){return db[_0xad86('0x6d')][_0xad86('0x6e')](function(_0x14845f){return _0xfa513f[_0xad86('0x67')](_0x29a49c,{'transaction':_0x14845f})[_0xad86('0x29')](function(){return BPromise['each'](_0x543eaf,function(_0x403820){return db['UserMailQueue'][_0xad86('0x6f')]({'where':{'UserId':_0x403820['id'],'MailQueueId':_0x99881a[_0xad86('0x4c')]['id']},'transaction':_0x14845f});});})[_0xad86('0x29')](function(){_0x543eaf[_0xad86('0x70')](function(_0x18caa4){socket[_0xad86('0x71')]('userMailQueue:save',{'UserId':_0x18caa4['id'],'MailQueueId':_0xfa513f['id']});});});});});}})[_0xad86('0x29')](respondWithStatusCode(_0x2384df,null))['catch'](handleError(_0x2384df,null));};exports['removeTeams']=function(_0x52dfaa,_0x501e86,_0x4788c7){return db[_0xad86('0x65')][_0xad86('0x49')]({'where':{'id':_0x52dfaa[_0xad86('0x3a')][_0xad86('0x68')]},'attributes':['id'],'include':[{'model':db[_0xad86('0x5e')],'as':_0xad86('0x69'),'attributes':['id'],'raw':!![]}]})[_0xad86('0x29')](handleEntityNotFound(_0x501e86,null))[_0xad86('0x29')](function(_0x5494d1){var _0x32116e=_['map'](_0x5494d1,'id');var _0x49eaa5=[];var _0x37163e=[];var _0x3620c2=squel['select']();_0x3620c2[_0xad86('0x72')](_0xad86('0x73'))[_0xad86('0x74')]('team_has_mail_queues','tq')[_0xad86('0x75')](_0xad86('0x76'),'ut',_0xad86('0x77'))['where'](_0xad86('0x78'),_0x52dfaa[_0xad86('0x4c')]['id']);for(var _0x510703=0x0;_0x510703<_0x5494d1[_0xad86('0x4d')];_0x510703+=0x1){let _0x42f49a=_0x5494d1[_0x510703];for(var _0x905fa4=0x0;_0x905fa4<_0x42f49a[_0xad86('0x69')][_0xad86('0x4d')];_0x905fa4+=0x1){let _0x2eac3d=_0x42f49a['Agents'][_0x905fa4];var _0x3c1668=_0x3620c2[_0xad86('0x79')]();_0x3c1668[_0xad86('0x40')](_0xad86('0x7a'),_0x2eac3d['id']);_0x37163e[_0xad86('0x7b')](db[_0xad86('0x6d')]['query'](_0x3c1668['toString'](),{'type':db['sequelize'][_0xad86('0x7c')][_0xad86('0x7d')]})[_0xad86('0x29')](function(_0x48752e){if(_0x48752e[_0xad86('0x4d')]===0x1){return _0x2eac3d['id'];}else{var _0x4110d4=_[_0xad86('0x7e')](_[_0xad86('0x32')](_0x48752e,_0xad86('0x7f')),function(_0x522af4){return _[_0xad86('0x80')](_0x32116e,_0x522af4);});if(_0x4110d4){return _0x2eac3d['id'];}}}));}}return BPromise['all'](_0x37163e)['then'](function(_0x32fd8d){_0x49eaa5=_(_0x49eaa5)[_0xad86('0x81')](_0x32fd8d)[_0xad86('0x82')]()[_0xad86('0x83')]();return db[_0xad86('0x33')]['find']({'where':{'id':_0x52dfaa['params']['id']}})[_0xad86('0x29')](function(_0x4f2285){return db['sequelize'][_0xad86('0x6e')](function(_0x5d9379){return _0x4f2285[_0xad86('0x84')](_0x52dfaa['query'][_0xad86('0x68')],{'transaction':_0x5d9379})['then'](function(){if(!_[_0xad86('0x85')](_0x49eaa5)){return _0x4f2285[_0xad86('0x86')](_0x49eaa5,{'transaction':_0x5d9379});}})['then'](function(){_0x49eaa5[_0xad86('0x70')](function(_0x15afb5){socket[_0xad86('0x71')]('userMailQueue:remove',{'UserId':_0x15afb5,'MailQueueId':_0x4f2285['id']});});});});});});})[_0xad86('0x29')](respondWithStatusCode(_0x501e86,null))[_0xad86('0x4f')](handleError(_0x501e86,null));};exports[_0xad86('0x87')]=function(_0x591727,_0x87ec41,_0x1a82fe){return db[_0xad86('0x33')][_0xad86('0x4e')]({'where':{'id':_0x591727['params']['id']}})[_0xad86('0x29')](handleEntityNotFound(_0x87ec41,null))['then'](function(_0x274b9b){if(_0x274b9b){return _0x274b9b[_0xad86('0x87')](_0x591727[_0xad86('0x51')][_0xad86('0x68')],_[_0xad86('0x88')](_0x591727[_0xad86('0x51')],[_0xad86('0x68'),'id'])||{})['spread'](function(_0x1b0d28){for(var _0x599dfb=0x0;_0x599dfb<_0x591727[_0xad86('0x51')][_0xad86('0x68')]['length'];_0x599dfb+=0x1){socket[_0xad86('0x71')]('userMailQueue:save',{'UserId':Number(_0x591727[_0xad86('0x51')][_0xad86('0x68')][_0x599dfb]),'MailQueueId':Number(_0x591727[_0xad86('0x4c')]['id'])});}return _0x1b0d28;});}})[_0xad86('0x29')](respondWithResult(_0x87ec41,null))[_0xad86('0x4f')](handleError(_0x87ec41,null));};exports[_0xad86('0x86')]=function(_0xd29778,_0x48713b,_0x511bd2){return db[_0xad86('0x33')][_0xad86('0x4e')]({'where':{'id':_0xd29778[_0xad86('0x4c')]['id']}})[_0xad86('0x29')](handleEntityNotFound(_0x48713b,null))['then'](function(_0x1fb57a){if(_0x1fb57a){return _0x1fb57a['removeAgents'](_0xd29778['query'][_0xad86('0x68')])[_0xad86('0x29')](function(){if(_['isArray'](_0xd29778['query'][_0xad86('0x68')])){for(var _0x40617f=0x0;_0x40617f<_0xd29778[_0xad86('0x3a')][_0xad86('0x68')][_0xad86('0x4d')];_0x40617f+=0x1){socket[_0xad86('0x71')](_0xad86('0x89'),{'UserId':Number(_0xd29778['query'][_0xad86('0x68')][_0x40617f]),'MailQueueId':Number(_0xd29778['params']['id'])});}}else{socket['emit'](_0xad86('0x89'),{'UserId':Number(_0xd29778['query']['ids']),'MailQueueId':Number(_0xd29778[_0xad86('0x4c')]['id'])});}});}})[_0xad86('0x29')](respondWithStatusCode(_0x48713b,null))['catch'](handleError(_0x48713b,null));};exports[_0xad86('0x8a')]=function(_0x55796e,_0x361bfd,_0x455170){var _0x337ed7={};var _0x2864c1={};var _0x2af870;var _0x19c98a;return db[_0xad86('0x33')]['findOne']({'where':{'id':_0x55796e['params']['id']}})['then'](handleEntityNotFound(_0x361bfd,null))[_0xad86('0x29')](function(_0x299034){if(_0x299034){_0x2af870=_0x299034;_0x2864c1['model']=_[_0xad86('0x39')](db[_0xad86('0x5e')][_0xad86('0x34')]);_0x2864c1[_0xad86('0x3a')]=_[_0xad86('0x39')](_0x55796e[_0xad86('0x3a')]);_0x2864c1[_0xad86('0x41')]=_['intersection'](_0x2864c1[_0xad86('0x38')],_0x2864c1['query']);_0x337ed7[_0xad86('0x3d')]=_[_0xad86('0x3b')](_0x2864c1[_0xad86('0x38')],qs[_0xad86('0x3c')](_0x55796e[_0xad86('0x3a')]['fields']));_0x337ed7['attributes']=_0x337ed7[_0xad86('0x3d')][_0xad86('0x4d')]?_0x337ed7[_0xad86('0x3d')]:_0x2864c1[_0xad86('0x38')];_0x337ed7['order']=qs[_0xad86('0x3f')](_0x55796e[_0xad86('0x3a')][_0xad86('0x3f')]);_0x337ed7[_0xad86('0x40')]=qs[_0xad86('0x41')](_[_0xad86('0x42')](_0x55796e[_0xad86('0x3a')],_0x2864c1[_0xad86('0x41')]));if(_0x55796e[_0xad86('0x3a')][_0xad86('0x43')]){_0x337ed7['where']=_['merge'](_0x337ed7['where'],{'$or':_[_0xad86('0x32')](_0x337ed7[_0xad86('0x3d')],function(_0x5a210a){var _0x1c5cca={};_0x1c5cca[_0x5a210a]={'$like':'%'+_0x55796e[_0xad86('0x3a')][_0xad86('0x43')]+'%'};return _0x1c5cca;})});}_0x337ed7=_[_0xad86('0x44')]({},_0x337ed7,_0x55796e[_0xad86('0x46')]);return _0x2af870[_0xad86('0x8a')](_0x337ed7);}})[_0xad86('0x29')](function(_0x2067d2){if(_0x2067d2){_0x19c98a=_0x2067d2[_0xad86('0x4d')];if(!_0x55796e[_0xad86('0x3a')][_0xad86('0x5c')]('nolimit')){_0x337ed7[_0xad86('0x24')]=qs[_0xad86('0x24')](_0x55796e[_0xad86('0x3a')][_0xad86('0x24')]);_0x337ed7['offset']=qs[_0xad86('0x21')](_0x55796e[_0xad86('0x3a')][_0xad86('0x21')]);}return _0x2af870['getAgents'](_0x337ed7);}})[_0xad86('0x29')](function(_0x5dd8b0){if(_0x5dd8b0){return _0x5dd8b0?{'count':_0x19c98a,'rows':_0x5dd8b0}:null;}})[_0xad86('0x29')](respondWithResult(_0x361bfd,null))[_0xad86('0x4f')](handleError(_0x361bfd,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index cf8341b..4d00235 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 _0xf6e5=['hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','emit'];(function(_0x321a6d,_0x3f2c98){var _0x1e3d8a=function(_0x193a51){while(--_0x193a51){_0x321a6d['push'](_0x321a6d['shift']());}};_0x1e3d8a(++_0x3f2c98);}(_0xf6e5,0x10b));var _0x5f6e=function(_0x2d58bc,_0x240ec3){_0x2d58bc=_0x2d58bc-0x0;var _0x4184eb=_0xf6e5[_0x2d58bc];return _0x4184eb;};'use strict';var EventEmitter=require(_0x5f6e('0x0'));var MailQueue=require(_0x5f6e('0x1'))['db'][_0x5f6e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5f6e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1d0488){return function(_0x511984,_0x36aa79,_0x761a8){MailQueueEvents['emit'](_0x1d0488+':'+_0x511984['id'],_0x511984);MailQueueEvents[_0x5f6e('0x4')](_0x1d0488,_0x511984);_0x761a8(null);};}for(var e in events){if(events[_0x5f6e('0x5')](e)){var event=events[e];MailQueue[_0x5f6e('0x6')](e,emitEvent(event));}}module[_0x5f6e('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x71f7=['hook','setMaxListeners','remove','emit'];(function(_0x3ddda7,_0x39eaf3){var _0x38f5b4=function(_0x49be31){while(--_0x49be31){_0x3ddda7['push'](_0x3ddda7['shift']());}};_0x38f5b4(++_0x39eaf3);}(_0x71f7,0x155));var _0x771f=function(_0x158e13,_0x23dbd5){_0x158e13=_0x158e13-0x0;var _0x1cda0b=_0x71f7[_0x158e13];return _0x1cda0b;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x771f('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x771f('0x1')};function emitEvent(_0x58a007){return function(_0x53e135,_0x35ad25,_0x4d0b8c){MailQueueEvents[_0x771f('0x2')](_0x58a007+':'+_0x53e135['id'],_0x53e135);MailQueueEvents[_0x771f('0x2')](_0x58a007,_0x53e135);_0x4d0b8c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x771f('0x3')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6f1faf6..2c96eeb 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 _0x4da9=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x4da9,0x14b));var _0x94da=function(_0x1180b2,_0x29b21b){_0x1180b2=_0x1180b2-0x0;var _0x51fbd6=_0x4da9[_0x1180b2];return _0x51fbd6;};'use strict';var _=require(_0x94da('0x0'));var util=require(_0x94da('0x1'));var logger=require(_0x94da('0x2'))(_0x94da('0x3'));var moment=require(_0x94da('0x4'));var BPromise=require(_0x94da('0x5'));var rp=require(_0x94da('0x6'));var fs=require('fs');var path=require(_0x94da('0x7'));var rimraf=require(_0x94da('0x8'));var config=require(_0x94da('0x9'));var attributes=require(_0x94da('0xa'));module['exports']=function(_0x15916b,_0x18dade){return _0x15916b[_0x94da('0xb')](_0x94da('0xc'),attributes,{'tableName':_0x94da('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf69a=['request-promise','path','rimraf','./mailQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x4b793b,_0x1ee112){var _0xcfbd6a=function(_0x2eb91c){while(--_0x2eb91c){_0x4b793b['push'](_0x4b793b['shift']());}};_0xcfbd6a(++_0x1ee112);}(_0xf69a,0x187));var _0xaf69=function(_0x34068f,_0x5758e4){_0x34068f=_0x34068f-0x0;var _0x351894=_0xf69a[_0x34068f];return _0x351894;};'use strict';var _=require(_0xaf69('0x0'));var util=require(_0xaf69('0x1'));var logger=require(_0xaf69('0x2'))(_0xaf69('0x3'));var moment=require(_0xaf69('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf69('0x5'));var fs=require('fs');var path=require(_0xaf69('0x6'));var rimraf=require(_0xaf69('0x7'));var config=require('../../config/environment');var attributes=require(_0xaf69('0x8'));module[_0xaf69('0x9')]=function(_0x5108d8,_0x99b418){return _0x5108d8[_0xaf69('0xa')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index bc840b4..1fc86e5 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 _0xa269=['request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','options','raw','where','include','map','model','attributes','GetMailQueue','ShowMailQueue','MailQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register'];(function(_0x164f7b,_0x1ecb55){var _0x52215b=function(_0x35c642){while(--_0x35c642){_0x164f7b['push'](_0x164f7b['shift']());}};_0x52215b(++_0x1ecb55);}(_0xa269,0xd3));var _0x9a26=function(_0xe83225,_0x2875eb){_0xe83225=_0xe83225-0x0;var _0x33be86=_0xa269[_0xe83225];return _0x33be86;};'use strict';var _=require(_0x9a26('0x0'));var util=require(_0x9a26('0x1'));var moment=require(_0x9a26('0x2'));var BPromise=require(_0x9a26('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a26('0x4'));var db=require(_0x9a26('0x5'))['db'];var utils=require(_0x9a26('0x6'));var logger=require('../../config/logger')(_0x9a26('0x7'));var config=require(_0x9a26('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a26('0x9')][_0x9a26('0xa')]({'port':0x232a});config[_0x9a26('0xb')]=_[_0x9a26('0xc')](config[_0x9a26('0xb')],{'host':_0x9a26('0xd'),'port':0x18eb});var socket=require(_0x9a26('0xe'))(new Redis(config[_0x9a26('0xb')]));require(_0x9a26('0xf'))[_0x9a26('0x10')](socket);function respondWithRpcPromise(_0x50b98f,_0x518f8f,_0x3d8422){return new BPromise(function(_0x3f2ec8,_0x3fce55){return client[_0x9a26('0x11')](_0x50b98f,_0x3d8422)[_0x9a26('0x12')](function(_0x1d3fa9){logger[_0x9a26('0x13')](_0x9a26('0x14'),_0x518f8f,_0x9a26('0x15'));logger[_0x9a26('0x16')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x518f8f,_0x9a26('0x15'),JSON[_0x9a26('0x17')](_0x1d3fa9));if(_0x1d3fa9[_0x9a26('0x18')]){if(_0x1d3fa9['error']['code']===0x1f4){logger[_0x9a26('0x18')](_0x9a26('0x14'),_0x518f8f,_0x1d3fa9[_0x9a26('0x18')][_0x9a26('0x19')]);return _0x3fce55(_0x1d3fa9['error']['message']);}logger['error'](_0x9a26('0x14'),_0x518f8f,_0x1d3fa9[_0x9a26('0x18')]['message']);return _0x3f2ec8(_0x1d3fa9[_0x9a26('0x18')][_0x9a26('0x19')]);}else{logger[_0x9a26('0x13')](_0x9a26('0x14'),_0x518f8f,_0x9a26('0x15'));_0x3f2ec8(_0x1d3fa9['result']['message']);}})[_0x9a26('0x1a')](function(_0x48c651){logger[_0x9a26('0x18')](_0x9a26('0x14'),_0x518f8f,_0x48c651);_0x3fce55(_0x48c651);});});}exports['GetMailQueue']=function(_0x4ef8af){var _0x4de744=this;return new Promise(function(_0x30539a,_0x931dbf){return db['MailQueue']['findAll']({'raw':_0x4ef8af[_0x9a26('0x1b')]?_0x4ef8af['options'][_0x9a26('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ef8af['options']?_0x4ef8af[_0x9a26('0x1b')][_0x9a26('0x1d')]||null:null,'attributes':_0x4ef8af[_0x9a26('0x1b')]?_0x4ef8af['options']['attributes']||null:null,'limit':_0x4ef8af[_0x9a26('0x1b')]?_0x4ef8af[_0x9a26('0x1b')]['limit']||null:null,'include':_0x4ef8af[_0x9a26('0x1b')]?_0x4ef8af[_0x9a26('0x1b')][_0x9a26('0x1e')]?_[_0x9a26('0x1f')](_0x4ef8af[_0x9a26('0x1b')]['include'],function(_0x3a4961){return{'model':db[_0x3a4961[_0x9a26('0x20')]],'as':_0x3a4961['as'],'attributes':_0x3a4961[_0x9a26('0x21')],'include':_0x3a4961[_0x9a26('0x1e')]?_[_0x9a26('0x1f')](_0x3a4961['include'],function(_0x24bef8){return{'model':db[_0x24bef8[_0x9a26('0x20')]],'as':_0x24bef8['as'],'attributes':_0x24bef8[_0x9a26('0x21')],'include':_0x24bef8[_0x9a26('0x1e')]?_[_0x9a26('0x1f')](_0x24bef8['include'],function(_0x76eac7){return{'model':db[_0x76eac7[_0x9a26('0x20')]],'as':_0x76eac7['as'],'attributes':_0x76eac7[_0x9a26('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9a26('0x12')](function(_0x1830bb){logger['info'](_0x9a26('0x22'),_0x4ef8af);logger['debug']('GetMailQueue',_0x4ef8af,JSON[_0x9a26('0x17')](_0x1830bb));_0x30539a(_0x1830bb);})[_0x9a26('0x1a')](function(_0x33c0ef){logger[_0x9a26('0x18')](_0x9a26('0x22'),_0x33c0ef[_0x9a26('0x19')],_0x4ef8af);_0x931dbf(_0x4de744[_0x9a26('0x18')](0x1f4,_0x33c0ef['message']));});});};exports[_0x9a26('0x23')]=function(_0x12cf9e){var _0x3c1360=this;return new Promise(function(_0x59a5d5,_0x42b361){return db[_0x9a26('0x24')][_0x9a26('0x25')]({'raw':_0x12cf9e[_0x9a26('0x1b')]?_0x12cf9e['options']['raw']===undefined?!![]:![]:!![],'where':_0x12cf9e[_0x9a26('0x1b')]?_0x12cf9e['options'][_0x9a26('0x1d')]||null:null,'attributes':_0x12cf9e[_0x9a26('0x1b')]?_0x12cf9e['options'][_0x9a26('0x21')]||null:null,'include':_0x12cf9e[_0x9a26('0x1b')]?_0x12cf9e['options'][_0x9a26('0x1e')]?_[_0x9a26('0x1f')](_0x12cf9e[_0x9a26('0x1b')]['include'],function(_0x174026){return{'model':db[_0x174026[_0x9a26('0x20')]],'as':_0x174026['as'],'attributes':_0x174026[_0x9a26('0x21')],'include':_0x174026[_0x9a26('0x1e')]?_[_0x9a26('0x1f')](_0x174026[_0x9a26('0x1e')],function(_0x564c54){return{'model':db[_0x564c54[_0x9a26('0x20')]],'as':_0x564c54['as'],'attributes':_0x564c54[_0x9a26('0x21')],'include':_0x564c54[_0x9a26('0x1e')]?_['map'](_0x564c54['include'],function(_0x2f9de1){return{'model':db[_0x2f9de1[_0x9a26('0x20')]],'as':_0x2f9de1['as'],'attributes':_0x2f9de1[_0x9a26('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x589c3f){logger[_0x9a26('0x13')](_0x9a26('0x23'),_0x12cf9e);logger[_0x9a26('0x16')](_0x9a26('0x23'),_0x12cf9e,JSON[_0x9a26('0x17')](_0x589c3f));_0x59a5d5(_0x589c3f);})[_0x9a26('0x1a')](function(_0x37f812){logger[_0x9a26('0x18')](_0x9a26('0x23'),_0x37f812[_0x9a26('0x19')],_0x12cf9e);_0x42b361(_0x3c1360[_0x9a26('0x18')](0x1f4,_0x37f812['message']));});});}; \ No newline at end of file +var _0x1c81=['register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetMailQueue','MailQueue','findAll','options','attributes','limit','include','map','model','ShowMailQueue','find','raw','where','lodash','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket'];(function(_0x1f728f,_0x2963f1){var _0x2ecf74=function(_0x2df5b7){while(--_0x2df5b7){_0x1f728f['push'](_0x1f728f['shift']());}};_0x2ecf74(++_0x2963f1);}(_0x1c81,0x8b));var _0x11c8=function(_0x302d01,_0x3584c9){_0x302d01=_0x302d01-0x0;var _0x557022=_0x1c81[_0x302d01];return _0x557022;};'use strict';var _=require(_0x11c8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x11c8('0x1'));var rs=require(_0x11c8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x11c8('0x3'))(_0x11c8('0x4'));var config=require('../../config/environment');var jayson=require(_0x11c8('0x5'));var client=jayson[_0x11c8('0x6')][_0x11c8('0x7')]({'port':0x232a});config[_0x11c8('0x8')]=_[_0x11c8('0x9')](config[_0x11c8('0x8')],{'host':_0x11c8('0xa'),'port':0x18eb});var socket=require(_0x11c8('0xb'))(new Redis(config[_0x11c8('0x8')]));require(_0x11c8('0xc'))[_0x11c8('0xd')](socket);function respondWithRpcPromise(_0x3aac32,_0x374107,_0xf1af51){return new BPromise(function(_0x77a99d,_0x37e94e){return client[_0x11c8('0xe')](_0x3aac32,_0xf1af51)[_0x11c8('0xf')](function(_0x4e82eb){logger['info'](_0x11c8('0x10'),_0x374107,_0x11c8('0x11'));logger[_0x11c8('0x12')](_0x11c8('0x13'),_0x374107,_0x11c8('0x11'),JSON[_0x11c8('0x14')](_0x4e82eb));if(_0x4e82eb[_0x11c8('0x15')]){if(_0x4e82eb[_0x11c8('0x15')]['code']===0x1f4){logger[_0x11c8('0x15')](_0x11c8('0x10'),_0x374107,_0x4e82eb['error'][_0x11c8('0x16')]);return _0x37e94e(_0x4e82eb['error'][_0x11c8('0x16')]);}logger[_0x11c8('0x15')](_0x11c8('0x10'),_0x374107,_0x4e82eb[_0x11c8('0x15')]['message']);return _0x77a99d(_0x4e82eb['error'][_0x11c8('0x16')]);}else{logger[_0x11c8('0x17')](_0x11c8('0x10'),_0x374107,_0x11c8('0x11'));_0x77a99d(_0x4e82eb['result'][_0x11c8('0x16')]);}})[_0x11c8('0x18')](function(_0x57a65c){logger[_0x11c8('0x15')](_0x11c8('0x10'),_0x374107,_0x57a65c);_0x37e94e(_0x57a65c);});});}exports[_0x11c8('0x19')]=function(_0x4b718c){var _0x38d14c=this;return new Promise(function(_0x4d5797,_0x5cca92){return db[_0x11c8('0x1a')][_0x11c8('0x1b')]({'raw':_0x4b718c['options']?_0x4b718c[_0x11c8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4b718c['options']?_0x4b718c['options']['where']||null:null,'attributes':_0x4b718c['options']?_0x4b718c[_0x11c8('0x1c')][_0x11c8('0x1d')]||null:null,'limit':_0x4b718c[_0x11c8('0x1c')]?_0x4b718c[_0x11c8('0x1c')][_0x11c8('0x1e')]||null:null,'include':_0x4b718c['options']?_0x4b718c['options'][_0x11c8('0x1f')]?_[_0x11c8('0x20')](_0x4b718c[_0x11c8('0x1c')][_0x11c8('0x1f')],function(_0x1031ea){return{'model':db[_0x1031ea[_0x11c8('0x21')]],'as':_0x1031ea['as'],'attributes':_0x1031ea['attributes'],'include':_0x1031ea[_0x11c8('0x1f')]?_[_0x11c8('0x20')](_0x1031ea[_0x11c8('0x1f')],function(_0x323cd3){return{'model':db[_0x323cd3['model']],'as':_0x323cd3['as'],'attributes':_0x323cd3[_0x11c8('0x1d')],'include':_0x323cd3[_0x11c8('0x1f')]?_[_0x11c8('0x20')](_0x323cd3[_0x11c8('0x1f')],function(_0x554636){return{'model':db[_0x554636['model']],'as':_0x554636['as'],'attributes':_0x554636['attributes']};}):[]};}):[]};}):[]:[]})[_0x11c8('0xf')](function(_0x476be0){logger[_0x11c8('0x17')](_0x11c8('0x19'),_0x4b718c);logger['debug']('GetMailQueue',_0x4b718c,JSON[_0x11c8('0x14')](_0x476be0));_0x4d5797(_0x476be0);})['catch'](function(_0x2361e8){logger['error'](_0x11c8('0x19'),_0x2361e8['message'],_0x4b718c);_0x5cca92(_0x38d14c['error'](0x1f4,_0x2361e8[_0x11c8('0x16')]));});});};exports[_0x11c8('0x22')]=function(_0x1487bb){var _0xf2ba3e=this;return new Promise(function(_0xb74e90,_0x7400fb){return db[_0x11c8('0x1a')][_0x11c8('0x23')]({'raw':_0x1487bb[_0x11c8('0x1c')]?_0x1487bb[_0x11c8('0x1c')][_0x11c8('0x24')]===undefined?!![]:![]:!![],'where':_0x1487bb[_0x11c8('0x1c')]?_0x1487bb[_0x11c8('0x1c')][_0x11c8('0x25')]||null:null,'attributes':_0x1487bb[_0x11c8('0x1c')]?_0x1487bb[_0x11c8('0x1c')][_0x11c8('0x1d')]||null:null,'include':_0x1487bb[_0x11c8('0x1c')]?_0x1487bb[_0x11c8('0x1c')][_0x11c8('0x1f')]?_[_0x11c8('0x20')](_0x1487bb['options'][_0x11c8('0x1f')],function(_0x64cd16){return{'model':db[_0x64cd16['model']],'as':_0x64cd16['as'],'attributes':_0x64cd16[_0x11c8('0x1d')],'include':_0x64cd16[_0x11c8('0x1f')]?_['map'](_0x64cd16[_0x11c8('0x1f')],function(_0x3dd1c2){return{'model':db[_0x3dd1c2['model']],'as':_0x3dd1c2['as'],'attributes':_0x3dd1c2[_0x11c8('0x1d')],'include':_0x3dd1c2[_0x11c8('0x1f')]?_[_0x11c8('0x20')](_0x3dd1c2[_0x11c8('0x1f')],function(_0x2220c){return{'model':db[_0x2220c[_0x11c8('0x21')]],'as':_0x2220c['as'],'attributes':_0x2220c[_0x11c8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x11c8('0xf')](function(_0x49958d){logger[_0x11c8('0x17')](_0x11c8('0x22'),_0x1487bb);logger[_0x11c8('0x12')](_0x11c8('0x22'),_0x1487bb,JSON[_0x11c8('0x14')](_0x49958d));_0xb74e90(_0x49958d);})[_0x11c8('0x18')](function(_0x31311d){logger[_0x11c8('0x15')](_0x11c8('0x22'),_0x31311d[_0x11c8('0x16')],_0x1487bb);_0x7400fb(_0xf2ba3e[_0x11c8('0x15')](0x1f4,_0x31311d[_0x11c8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9804a54..ee82467 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 _0x36e1=['save','remove','emit','register','length','mailQueue:','./mailQueue.events'];(function(_0x312ad6,_0x5dcca8){var _0x1069dc=function(_0x42446d){while(--_0x42446d){_0x312ad6['push'](_0x312ad6['shift']());}};_0x1069dc(++_0x5dcca8);}(_0x36e1,0x187));var _0x136e=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0x36e1[_0x1ca9e9];return _0x309f3c;};'use strict';var MailQueueEvents=require(_0x136e('0x0'));var events=[_0x136e('0x1'),_0x136e('0x2'),'update'];function createListener(_0x2cef5b,_0x157a53){return function(_0x1ad6be){_0x157a53[_0x136e('0x3')](_0x2cef5b,_0x1ad6be);};}function removeListener(_0x16b507,_0x5ed975){return function(){MailQueueEvents['removeListener'](_0x16b507,_0x5ed975);};}exports[_0x136e('0x4')]=function(_0x1cbce5){for(var _0x5163da=0x0,_0x46110e=events[_0x136e('0x5')];_0x5163da<_0x46110e;_0x5163da++){var _0x3b241f=events[_0x5163da];var _0x15ec52=createListener(_0x136e('0x6')+_0x3b241f,_0x1cbce5);MailQueueEvents['on'](_0x3b241f,_0x15ec52);}}; \ No newline at end of file +var _0x361a=['register','length','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x361a,0x102));var _0xa361=function(_0x45158b,_0x45bc1e){_0x45158b=_0x45158b-0x0;var _0x1f4075=_0x361a[_0x45158b];return _0x1f4075;};'use strict';var MailQueueEvents=require(_0xa361('0x0'));var events=[_0xa361('0x1'),_0xa361('0x2'),_0xa361('0x3')];function createListener(_0x531e30,_0x2ea24f){return function(_0x2d53cf){_0x2ea24f[_0xa361('0x4')](_0x531e30,_0x2d53cf);};}function removeListener(_0x4ed762,_0x1a8ad1){return function(){MailQueueEvents[_0xa361('0x5')](_0x4ed762,_0x1a8ad1);};}exports[_0xa361('0x6')]=function(_0x2df977){for(var _0x2145de=0x0,_0x5ec147=events[_0xa361('0x7')];_0x2145de<_0x5ec147;_0x2145de++){var _0x10541a=events[_0x2145de];var _0x383d1f=createListener('mailQueue:'+_0x10541a,_0x2df977);MailQueueEvents['on'](_0x10541a,_0x383d1f);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index f5c9b87..743245d 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 _0x0f1d=['show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5ee07f,_0x495288){var _0x443401=function(_0x125fe3){while(--_0x125fe3){_0x5ee07f['push'](_0x5ee07f['shift']());}};_0x443401(++_0x495288);}(_0x0f1d,0x8a));var _0xd0f1=function(_0x416d75,_0x2c8e81){_0x416d75=_0x416d75-0x0;var _0x10af66=_0x0f1d[_0x416d75];return _0x10af66;};'use strict';var multer=require(_0xd0f1('0x0'));var util=require(_0xd0f1('0x1'));var path=require(_0xd0f1('0x2'));var timeout=require(_0xd0f1('0x3'));var express=require(_0xd0f1('0x4'));var router=express[_0xd0f1('0x5')]();var fs_extra=require(_0xd0f1('0x6'));var auth=require(_0xd0f1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd0f1('0x8'));var controller=require(_0xd0f1('0x9'));router[_0xd0f1('0xa')]('/',auth[_0xd0f1('0xb')](),controller[_0xd0f1('0xc')]);router[_0xd0f1('0xa')](_0xd0f1('0xd'),auth[_0xd0f1('0xb')](),controller[_0xd0f1('0xe')]);router['get'](_0xd0f1('0xf'),auth[_0xd0f1('0xb')](),controller[_0xd0f1('0x10')]);router['post']('/',auth[_0xd0f1('0xb')](),controller[_0xd0f1('0x11')]);router[_0xd0f1('0x12')](_0xd0f1('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xd0f1('0x13')](_0xd0f1('0xf'),auth['isAuthenticated'](),controller[_0xd0f1('0x14')]);module[_0xd0f1('0x15')]=router; \ No newline at end of file +var _0x45c1=['describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1acdd7,_0x1b63d6){var _0x5eed04=function(_0x5d4335){while(--_0x5d4335){_0x1acdd7['push'](_0x1acdd7['shift']());}};_0x5eed04(++_0x1b63d6);}(_0x45c1,0x135));var _0x145c=function(_0x5de441,_0x96ed67){_0x5de441=_0x5de441-0x0;var _0xb956d4=_0x45c1[_0x5de441];return _0xb956d4;};'use strict';var multer=require(_0x145c('0x0'));var util=require(_0x145c('0x1'));var path=require(_0x145c('0x2'));var timeout=require('connect-timeout');var express=require(_0x145c('0x3'));var router=express[_0x145c('0x4')]();var fs_extra=require(_0x145c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x145c('0x6'));var config=require(_0x145c('0x7'));var controller=require(_0x145c('0x8'));router[_0x145c('0x9')]('/',auth[_0x145c('0xa')](),controller[_0x145c('0xb')]);router['get'](_0x145c('0xc'),auth[_0x145c('0xa')](),controller[_0x145c('0xd')]);router[_0x145c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x145c('0xe')]);router[_0x145c('0xf')]('/',auth[_0x145c('0xa')](),controller[_0x145c('0x10')]);router[_0x145c('0x11')](_0x145c('0x12'),auth[_0x145c('0xa')](),controller[_0x145c('0x13')]);router[_0x145c('0x14')](_0x145c('0x12'),auth[_0x145c('0xa')](),controller[_0x145c('0x15')]);module[_0x145c('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 3c3d100..db318d2 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 _0x98d8=['STRING','DATE','moment','sequelize','exports'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0x98d8,0x11a));var _0x898d=function(_0x1830a9,_0x1583bd){_0x1830a9=_0x1830a9-0x0;var _0x2b6166=_0x98d8[_0x1830a9];return _0x2b6166;};'use strict';var moment=require(_0x898d('0x0'));var Sequelize=require(_0x898d('0x1'));module[_0x898d('0x2')]={'uniqueid':{'type':Sequelize[_0x898d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x898d('0x3')]},'joinAt':{'type':Sequelize[_0x898d('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x898d('0x3')]}}; \ No newline at end of file +var _0xbe43=['sequelize','exports','STRING','DATE','moment'];(function(_0x277c93,_0x33a8bb){var _0x1bc988=function(_0x4c1ffb){while(--_0x4c1ffb){_0x277c93['push'](_0x277c93['shift']());}};_0x1bc988(++_0x33a8bb);}(_0xbe43,0x1bc));var _0x3be4=function(_0x349d51,_0x514406){_0x349d51=_0x349d51-0x0;var _0x5ab01a=_0xbe43[_0x349d51];return _0x5ab01a;};'use strict';var moment=require(_0x3be4('0x0'));var Sequelize=require(_0x3be4('0x1'));module[_0x3be4('0x2')]={'uniqueid':{'type':Sequelize[_0x3be4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3be4('0x3')]},'joinAt':{'type':Sequelize[_0x3be4('0x4')]},'leaveAt':{'type':Sequelize[_0x3be4('0x4')]},'acceptAt':{'type':Sequelize[_0x3be4('0x4')]},'exitAt':{'type':Sequelize[_0x3be4('0x4')]},'reason':{'type':Sequelize[_0x3be4('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 1c65399..028ca9d 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 _0x3d04=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset'];(function(_0x1102ef,_0x38b770){var _0x48e24b=function(_0x1d3cd0){while(--_0x1d3cd0){_0x1102ef['push'](_0x1102ef['shift']());}};_0x48e24b(++_0x38b770);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x43d0('0x0'));var rimraf=require(_0x43d0('0x1'));var zipdir=require(_0x43d0('0x2'));var jsonpatch=require(_0x43d0('0x3'));var rp=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var BPromise=require(_0x43d0('0x6'));var Mustache=require(_0x43d0('0x7'));var util=require('util');var path=require(_0x43d0('0x8'));var sox=require(_0x43d0('0x9'));var csv=require(_0x43d0('0xa'));var ejs=require(_0x43d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43d0('0xc'));var deskjs=require(_0x43d0('0xd'));var toCsv=require(_0x43d0('0xa'));var querystring=require(_0x43d0('0xe'));var Papa=require(_0x43d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43d0('0x11'))(_0x43d0('0x12'));var utils=require(_0x43d0('0x13'));var config=require(_0x43d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x43d0('0x15'))['db'];function respondWithStatusCode(_0x23daaa,_0x546b23){_0x546b23=_0x546b23||0xcc;return function(_0x29773b){if(_0x29773b){return _0x23daaa[_0x43d0('0x16')](_0x546b23);}return _0x23daaa[_0x43d0('0x17')](_0x546b23)['end']();};}function respondWithResult(_0xd262a8,_0x2454fa){_0x2454fa=_0x2454fa||0xc8;return function(_0x436130){if(_0x436130){return _0xd262a8['status'](_0x2454fa)[_0x43d0('0x18')](_0x436130);}};}function respondWithFilteredResult(_0x357f87,_0x44e6ec){return function(_0x1218b5){if(_0x1218b5){var _0x91b4a1=typeof _0x44e6ec['offset']==='undefined'&&typeof _0x44e6ec[_0x43d0('0x19')]===_0x43d0('0x1a');var _0x35decf=_0x1218b5['count'];var _0x2c641e=_0x91b4a1?0x0:_0x44e6ec['offset'];var _0x2c9d06=_0x91b4a1?_0x1218b5[_0x43d0('0x1b')]:_0x44e6ec[_0x43d0('0x1c')]+_0x44e6ec['limit'];var _0x3d7dcc;if(_0x2c9d06>=_0x35decf){_0x2c9d06=_0x35decf;_0x3d7dcc=0xc8;}else{_0x3d7dcc=0xce;}_0x357f87[_0x43d0('0x17')](_0x3d7dcc);return _0x357f87['set'](_0x43d0('0x1d'),_0x2c641e+'-'+_0x2c9d06+'/'+_0x35decf)[_0x43d0('0x18')](_0x1218b5);}return null;};}function patchUpdates(_0x348429){return function(_0x248622){try{jsonpatch[_0x43d0('0x1e')](_0x248622,_0x348429,!![]);}catch(_0x28381b){return BPromise[_0x43d0('0x1f')](_0x28381b);}return _0x248622[_0x43d0('0x20')]();};}function saveUpdates(_0x30febc,_0xc8a644){return function(_0xec5f07){if(_0xec5f07){return _0xec5f07[_0x43d0('0x21')](_0x30febc)[_0x43d0('0x22')](function(_0xbc72e6){return _0xbc72e6;});}return null;};}function removeEntity(_0x2efd77,_0x48aa18){return function(_0x2c7b24){if(_0x2c7b24){return _0x2c7b24[_0x43d0('0x23')]()['then'](function(){_0x2efd77[_0x43d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29c111,_0x44497b){return function(_0x5dd310){if(!_0x5dd310){_0x29c111[_0x43d0('0x16')](0x194);}return _0x5dd310;};}function handleError(_0x238c64,_0x5ac4c0){_0x5ac4c0=_0x5ac4c0||0x1f4;return function(_0x12df30){logger[_0x43d0('0x24')](_0x12df30[_0x43d0('0x25')]);if(_0x12df30['name']){delete _0x12df30[_0x43d0('0x26')];}_0x238c64[_0x43d0('0x17')](_0x5ac4c0)[_0x43d0('0x27')](_0x12df30);};}exports[_0x43d0('0x28')]=function(_0x37d78f,_0x440ecb){var _0x31a057={},_0x4a3cd4={},_0x2b0784={'count':0x0,'rows':[]};var _0x2f5bc5=_[_0x43d0('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x52c37b){return{'name':_0x52c37b[_0x43d0('0x2a')],'type':_0x52c37b[_0x43d0('0x2b')][_0x43d0('0x2c')]};});_0x4a3cd4[_0x43d0('0x2d')]=_[_0x43d0('0x29')](_0x2f5bc5,_0x43d0('0x26'));_0x4a3cd4['query']=_[_0x43d0('0x2e')](_0x37d78f[_0x43d0('0x2f')]);_0x4a3cd4[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x4a3cd4[_0x43d0('0x2d')],_0x4a3cd4[_0x43d0('0x2f')]);_0x31a057[_0x43d0('0x32')]=_[_0x43d0('0x31')](_0x4a3cd4[_0x43d0('0x2d')],qs[_0x43d0('0x33')](_0x37d78f[_0x43d0('0x2f')]['fields']));_0x31a057[_0x43d0('0x32')]=_0x31a057[_0x43d0('0x32')][_0x43d0('0x34')]?_0x31a057[_0x43d0('0x32')]:_0x4a3cd4['model'];if(!_0x37d78f[_0x43d0('0x2f')]['hasOwnProperty'](_0x43d0('0x35'))){_0x31a057[_0x43d0('0x19')]=qs['limit'](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x19')]);_0x31a057[_0x43d0('0x1c')]=qs[_0x43d0('0x1c')](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x1c')]);}_0x31a057[_0x43d0('0x36')]=qs[_0x43d0('0x37')](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x37')]);_0x31a057[_0x43d0('0x38')]=qs['filters'](_[_0x43d0('0x39')](_0x37d78f[_0x43d0('0x2f')],_0x4a3cd4[_0x43d0('0x30')]),_0x2f5bc5);if(_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x3a')]){_0x31a057[_0x43d0('0x38')]=_[_0x43d0('0x3b')](_0x31a057[_0x43d0('0x38')],{'$or':_[_0x43d0('0x29')](_0x2f5bc5,function(_0x43bcc5){if(_0x43bcc5[_0x43d0('0x2b')]!==_0x43d0('0x3c')){var _0x19843c={};_0x19843c[_0x43bcc5[_0x43d0('0x26')]]={'$like':'%'+_0x37d78f['query'][_0x43d0('0x3a')]+'%'};return _0x19843c;}})});}_0x31a057=_[_0x43d0('0x3b')]({},_0x31a057,_0x37d78f[_0x43d0('0x3d')]);var _0xc3f9c7={'where':_0x31a057[_0x43d0('0x38')]};return db[_0x43d0('0x3e')][_0x43d0('0x1b')](_0xc3f9c7)[_0x43d0('0x22')](function(_0x4ae965){_0x2b0784['count']=_0x4ae965;if(_0x37d78f[_0x43d0('0x2f')]['includeAll']){_0x31a057['include']=[{'all':!![]}];}return db[_0x43d0('0x3e')]['findAll'](_0x31a057);})[_0x43d0('0x22')](function(_0x5027d0){_0x2b0784[_0x43d0('0x3f')]=_0x5027d0;return _0x2b0784;})['then'](respondWithFilteredResult(_0x440ecb,_0x31a057))[_0x43d0('0x40')](handleError(_0x440ecb,null));};exports[_0x43d0('0x41')]=function(_0x468b32,_0x4e817e){var _0x3eb2e9={'raw':!![],'where':{'id':_0x468b32[_0x43d0('0x42')]['id']}},_0x520406={};_0x520406['model']=_['keys'](db[_0x43d0('0x3e')][_0x43d0('0x43')]);_0x520406['query']=_[_0x43d0('0x2e')](_0x468b32[_0x43d0('0x2f')]);_0x520406[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x520406[_0x43d0('0x2d')],_0x520406['query']);_0x3eb2e9[_0x43d0('0x32')]=_[_0x43d0('0x31')](_0x520406[_0x43d0('0x2d')],qs[_0x43d0('0x33')](_0x468b32['query'][_0x43d0('0x33')]));_0x3eb2e9[_0x43d0('0x32')]=_0x3eb2e9[_0x43d0('0x32')][_0x43d0('0x34')]?_0x3eb2e9[_0x43d0('0x32')]:_0x520406['model'];if(_0x468b32[_0x43d0('0x2f')][_0x43d0('0x44')]){_0x3eb2e9['include']=[{'all':!![]}];}_0x3eb2e9=_[_0x43d0('0x3b')]({},_0x3eb2e9,_0x468b32[_0x43d0('0x3d')]);return db[_0x43d0('0x3e')]['find'](_0x3eb2e9)[_0x43d0('0x22')](handleEntityNotFound(_0x4e817e,null))['then'](respondWithResult(_0x4e817e,null))[_0x43d0('0x40')](handleError(_0x4e817e,null));};exports['create']=function(_0x1f55e9,_0x269d99){return db[_0x43d0('0x3e')][_0x43d0('0x45')](_0x1f55e9[_0x43d0('0x46')],{})['then'](respondWithResult(_0x269d99,0xc9))[_0x43d0('0x40')](handleError(_0x269d99,null));};exports['update']=function(_0x5a6364,_0x3e7392){if(_0x5a6364[_0x43d0('0x46')]['id']){delete _0x5a6364[_0x43d0('0x46')]['id'];}return db[_0x43d0('0x3e')][_0x43d0('0x47')]({'where':{'id':_0x5a6364[_0x43d0('0x42')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x3e7392,null))[_0x43d0('0x22')](saveUpdates(_0x5a6364[_0x43d0('0x46')],null))[_0x43d0('0x22')](respondWithResult(_0x3e7392,null))[_0x43d0('0x40')](handleError(_0x3e7392,null));};exports['destroy']=function(_0x338203,_0xd78af1){return db[_0x43d0('0x3e')]['find']({'where':{'id':_0x338203[_0x43d0('0x42')]['id']}})['then'](handleEntityNotFound(_0xd78af1,null))['then'](removeEntity(_0xd78af1,null))[_0x43d0('0x40')](handleError(_0xd78af1,null));};exports[_0x43d0('0x48')]=function(_0x234571,_0x127815){return db[_0x43d0('0x3e')]['describe']()['then'](respondWithResult(_0x127815,null))[_0x43d0('0x40')](handleError(_0x127815,null));}; \ No newline at end of file +var _0x9536=['rawAttributes','intersection','length','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','MailQueueReport','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9536,0x179));var _0x6953=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0x9536[_0xd8a8af];return _0x5b7278;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':!![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));};exports[_0x6953('0x49')]=function(_0x50b962,_0x5f15b0){return db['MailQueueReport']['describe']()[_0x6953('0x3c')](respondWithResult(_0x5f15b0,null))[_0x6953('0x41')](handleError(_0x5f15b0,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index ca5d2a0..1c5ed3f 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 _0x9278=['moment','bluebird','request-promise','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','../../config/logger','api'];(function(_0x233863,_0x5c9afb){var _0x15f0b9=function(_0x4db234){while(--_0x4db234){_0x233863['push'](_0x233863['shift']());}};_0x15f0b9(++_0x5c9afb);}(_0x9278,0x1c5));var _0x8927=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9278[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x8927('0x0'));var util=require('util');var logger=require(_0x8927('0x1'))(_0x8927('0x2'));var moment=require(_0x8927('0x3'));var BPromise=require(_0x8927('0x4'));var rp=require(_0x8927('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8927('0x6'));var config=require('../../config/environment');var attributes=require(_0x8927('0x7'));module[_0x8927('0x8')]=function(_0x56cb52,_0x308ad1){return _0x56cb52[_0x8927('0x9')](_0x8927('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8927('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5434=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5865ec,_0xf3b75c){var _0x92880b=function(_0x90edfc){while(--_0x90edfc){_0x5865ec['push'](_0x5865ec['shift']());}};_0x92880b(++_0xf3b75c);}(_0x5434,0x105));var _0x4543=function(_0x6bb91e,_0x2491da){_0x6bb91e=_0x6bb91e-0x0;var _0x5bc507=_0x5434[_0x6bb91e];return _0x5bc507;};'use strict';var _=require('lodash');var util=require(_0x4543('0x0'));var logger=require(_0x4543('0x1'))(_0x4543('0x2'));var moment=require('moment');var BPromise=require(_0x4543('0x3'));var rp=require(_0x4543('0x4'));var fs=require('fs');var path=require(_0x4543('0x5'));var rimraf=require(_0x4543('0x6'));var config=require(_0x4543('0x7'));var attributes=require(_0x4543('0x8'));module[_0x4543('0x9')]=function(_0x517c1e,_0x264030){return _0x517c1e[_0x4543('0xa')](_0x4543('0xb'),attributes,{'tableName':_0x4543('0xc'),'paranoid':![],'indexes':[{'name':_0x4543('0xd'),'fields':[_0x4543('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index c6cfc39..647a72e 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x706d5e,_0x247350){var _0x3febed=function(_0x234ad1){while(--_0x234ad1){_0x706d5e['push'](_0x706d5e['shift']());}};_0x3febed(++_0x247350);}(_0x326f,0xd1));var _0xf326=function(_0x255c35,_0x1aaa34){_0x255c35=_0x255c35-0x0;var _0x46b766=_0x326f[_0x255c35];return _0x46b766;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x837787,_0x3fe7bd){var _0x4d111f=function(_0x508a40){while(--_0x508a40){_0x837787['push'](_0x837787['shift']());}};_0x4d111f(++_0x3fe7bd);}(_0x326f,0xd1));var _0xf326=function(_0x2f2a5f,_0x49a2ec){_0x2f2a5f=_0x2f2a5f-0x0;var _0x5bcbbf=_0x326f[_0x2f2a5f];return _0x5bcbbf;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 15463c1..8ccd77c 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1303b6,_0x3d7288){var _0x4a983f=function(_0x77db26){while(--_0x77db26){_0x1303b6['push'](_0x1303b6['shift']());}};_0x4a983f(++_0x3d7288);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x411dc0,_0x1d46d6){var _0x208d5f=function(_0x3bdc09){while(--_0x3bdc09){_0x411dc0['push'](_0x411dc0['shift']());}};_0x208d5f(++_0x1d46d6);}(_0xe706,0xa3));var _0x6e70=function(_0x469d01,_0x18c899){_0x469d01=_0x469d01-0x0;var _0x5078d3=_0xe706[_0x469d01];return _0x5078d3;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 2838fc8..3ce5a37 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 _0x05d0=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x38616d,_0x22fbe5){var _0x505626=function(_0x5b3a5a){while(--_0x5b3a5a){_0x38616d['push'](_0x38616d['shift']());}};_0x505626(++_0x22fbe5);}(_0x05d0,0x101));var _0x005d=function(_0x32ee36,_0x3fd261){_0x32ee36=_0x32ee36-0x0;var _0x403c04=_0x05d0[_0x32ee36];return _0x403c04;};'use strict';var Sequelize=require(_0x005d('0x0'));module[_0x005d('0x1')]={'description':{'type':Sequelize[_0x005d('0x2')]},'host':{'type':Sequelize[_0x005d('0x2')]},'authentication':{'type':Sequelize[_0x005d('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x005d('0x2')]},'password':{'type':Sequelize[_0x005d('0x2')]},'port':{'type':Sequelize[_0x005d('0x4')]},'tls':{'type':Sequelize[_0x005d('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x005d('0x5')},'connTimeout':{'type':Sequelize[_0x005d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x005d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9c5b=['INTEGER','BOOLEAN','INBOX','exports','STRING'];(function(_0x5a8fad,_0x3feb4f){var _0x2791d8=function(_0x2987c6){while(--_0x2987c6){_0x5a8fad['push'](_0x5a8fad['shift']());}};_0x2791d8(++_0x3feb4f);}(_0x9c5b,0x9e));var _0xb9c5=function(_0x2ec554,_0x769518){_0x2ec554=_0x2ec554-0x0;var _0xc40219=_0x9c5b[_0x2ec554];return _0xc40219;};'use strict';var Sequelize=require('sequelize');module[_0xb9c5('0x0')]={'description':{'type':Sequelize[_0xb9c5('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb9c5('0x1')]},'port':{'type':Sequelize[_0xb9c5('0x2')]},'tls':{'type':Sequelize[_0xb9c5('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb9c5('0x1')],'defaultValue':_0xb9c5('0x4')},'connTimeout':{'type':Sequelize[_0xb9c5('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb9c5('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb9c5('0x1')]},'modernAuthentication':{'type':Sequelize[_0xb9c5('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 7d52f8f..d889232 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 _0x4340=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in'];(function(_0x1bfba1,_0x142125){var _0xa19ad7=function(_0x1e9389){while(--_0x1e9389){_0x1bfba1['push'](_0x1bfba1['shift']());}};_0xa19ad7(++_0x142125);}(_0x4340,0x186));var _0x0434=function(_0x5f2f37,_0x86b3a9){_0x5f2f37=_0x5f2f37-0x0;var _0x2df44c=_0x4340[_0x5f2f37];return _0x2df44c;};'use strict';var _=require(_0x0434('0x0'));var util=require(_0x0434('0x1'));var logger=require(_0x0434('0x2'))(_0x0434('0x3'));var moment=require(_0x0434('0x4'));var BPromise=require(_0x0434('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0434('0x6'));var rimraf=require(_0x0434('0x7'));var config=require(_0x0434('0x8'));var attributes=require(_0x0434('0x9'));module['exports']=function(_0x545fee,_0x94931b){return _0x545fee[_0x0434('0xa')](_0x0434('0xb'),attributes,{'tableName':_0x0434('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49b2=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x49b2,0x15f));var _0x249b=function(_0xf2d1c2,_0x282179){_0xf2d1c2=_0xf2d1c2-0x0;var _0x7c7a39=_0x49b2[_0xf2d1c2];return _0x7c7a39;};'use strict';var _=require(_0x249b('0x0'));var util=require(_0x249b('0x1'));var logger=require('../../config/logger')(_0x249b('0x2'));var moment=require(_0x249b('0x3'));var BPromise=require(_0x249b('0x4'));var rp=require(_0x249b('0x5'));var fs=require('fs');var path=require(_0x249b('0x6'));var rimraf=require(_0x249b('0x7'));var config=require(_0x249b('0x8'));var attributes=require(_0x249b('0x9'));module[_0x249b('0xa')]=function(_0x5f5b75,_0x5421a6){return _0x5f5b75[_0x249b('0xb')]('MailServerIn',attributes,{'tableName':_0x249b('0xc'),'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 49dc165..3f21d6e 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 _0x0506=['MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','options','attributes','limit','include','map','model','then','lodash','util','moment','../../config/utils','rpc','client','http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x0506,0x1d1));var _0x6050=function(_0x3bbb33,_0x47d47e){_0x3bbb33=_0x3bbb33-0x0;var _0x8e3c6e=_0x0506[_0x3bbb33];return _0x8e3c6e;};'use strict';var _=require(_0x6050('0x0'));var util=require(_0x6050('0x1'));var moment=require(_0x6050('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6050('0x3'));var logger=require('../../config/logger')(_0x6050('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6050('0x5')][_0x6050('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2a3644,_0x1a89fb,_0x3512ba){return new BPromise(function(_0xf64de5,_0x4068d3){return client[_0x6050('0x7')](_0x2a3644,_0x3512ba)['then'](function(_0x312217){logger['info'](_0x6050('0x8'),_0x1a89fb,_0x6050('0x9'));logger[_0x6050('0xa')](_0x6050('0xb'),_0x1a89fb,_0x6050('0x9'),JSON[_0x6050('0xc')](_0x312217));if(_0x312217[_0x6050('0xd')]){if(_0x312217[_0x6050('0xd')][_0x6050('0xe')]===0x1f4){logger[_0x6050('0xd')]('MailServerIn,\x20%s,\x20%s',_0x1a89fb,_0x312217[_0x6050('0xd')]['message']);return _0x4068d3(_0x312217[_0x6050('0xd')][_0x6050('0xf')]);}logger[_0x6050('0xd')](_0x6050('0x8'),_0x1a89fb,_0x312217['error'][_0x6050('0xf')]);return _0xf64de5(_0x312217['error'][_0x6050('0xf')]);}else{logger[_0x6050('0x10')](_0x6050('0x8'),_0x1a89fb,_0x6050('0x9'));_0xf64de5(_0x312217[_0x6050('0x11')][_0x6050('0xf')]);}})[_0x6050('0x12')](function(_0x388de4){logger[_0x6050('0xd')](_0x6050('0x8'),_0x1a89fb,_0x388de4);_0x4068d3(_0x388de4);});});}exports[_0x6050('0x13')]=function(_0x347899){var _0x47f33f=this;return new Promise(function(_0x1dd507,_0x3e1ef6){return db[_0x6050('0x14')]['findAll']({'raw':_0x347899['options']?_0x347899['options']['raw']===undefined?!![]:![]:!![],'where':_0x347899[_0x6050('0x15')]?_0x347899[_0x6050('0x15')]['where']||null:null,'attributes':_0x347899[_0x6050('0x15')]?_0x347899[_0x6050('0x15')][_0x6050('0x16')]||null:null,'limit':_0x347899[_0x6050('0x15')]?_0x347899[_0x6050('0x15')][_0x6050('0x17')]||null:null,'include':_0x347899['options']?_0x347899[_0x6050('0x15')][_0x6050('0x18')]?_[_0x6050('0x19')](_0x347899[_0x6050('0x15')][_0x6050('0x18')],function(_0x178d58){return{'model':db[_0x178d58[_0x6050('0x1a')]],'as':_0x178d58['as'],'attributes':_0x178d58[_0x6050('0x16')],'include':_0x178d58['include']?_[_0x6050('0x19')](_0x178d58['include'],function(_0x2a991b){return{'model':db[_0x2a991b[_0x6050('0x1a')]],'as':_0x2a991b['as'],'attributes':_0x2a991b[_0x6050('0x16')],'include':_0x2a991b[_0x6050('0x18')]?_[_0x6050('0x19')](_0x2a991b[_0x6050('0x18')],function(_0x4b46e0){return{'model':db[_0x4b46e0[_0x6050('0x1a')]],'as':_0x4b46e0['as'],'attributes':_0x4b46e0[_0x6050('0x16')]};}):[]};}):[]};}):[]:[]})[_0x6050('0x1b')](function(_0x38d135){logger['info'](_0x6050('0x13'),_0x347899);logger[_0x6050('0xa')](_0x6050('0x13'),_0x347899,JSON[_0x6050('0xc')](_0x38d135));_0x1dd507(_0x38d135);})[_0x6050('0x12')](function(_0x1cc3c0){logger[_0x6050('0xd')]('GetMailServerIn',_0x1cc3c0[_0x6050('0xf')],_0x347899);_0x3e1ef6(_0x47f33f[_0x6050('0xd')](0x1f4,_0x1cc3c0[_0x6050('0xf')]));});});}; \ No newline at end of file +var _0xad9c=['model','debug','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0xad9c,0x143));var _0xcad9=function(_0x39fced,_0x52380d){_0x39fced=_0x39fced-0x0;var _0x3e04ef=_0xad9c[_0x39fced];return _0x3e04ef;};'use strict';var _=require(_0xcad9('0x0'));var util=require(_0xcad9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcad9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcad9('0x3'))['db'];var utils=require(_0xcad9('0x4'));var logger=require(_0xcad9('0x5'))(_0xcad9('0x6'));var config=require(_0xcad9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcad9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24f293,_0x4d05fb,_0x33fb03){return new BPromise(function(_0xbe0448,_0x26a398){return client[_0xcad9('0x9')](_0x24f293,_0x33fb03)[_0xcad9('0xa')](function(_0x11cdc2){logger[_0xcad9('0xb')](_0xcad9('0xc'),_0x4d05fb,_0xcad9('0xd'));logger['debug'](_0xcad9('0xe'),_0x4d05fb,_0xcad9('0xd'),JSON[_0xcad9('0xf')](_0x11cdc2));if(_0x11cdc2[_0xcad9('0x10')]){if(_0x11cdc2['error'][_0xcad9('0x11')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x4d05fb,_0x11cdc2[_0xcad9('0x10')][_0xcad9('0x12')]);return _0x26a398(_0x11cdc2[_0xcad9('0x10')][_0xcad9('0x12')]);}logger[_0xcad9('0x10')](_0xcad9('0xc'),_0x4d05fb,_0x11cdc2['error'][_0xcad9('0x12')]);return _0xbe0448(_0x11cdc2[_0xcad9('0x10')][_0xcad9('0x12')]);}else{logger['info'](_0xcad9('0xc'),_0x4d05fb,_0xcad9('0xd'));_0xbe0448(_0x11cdc2[_0xcad9('0x13')][_0xcad9('0x12')]);}})['catch'](function(_0x33f829){logger['error']('MailServerIn,\x20%s,\x20%s',_0x4d05fb,_0x33f829);_0x26a398(_0x33f829);});});}exports[_0xcad9('0x14')]=function(_0x30e48d){var _0x5c74cf=this;return new Promise(function(_0x1a4a62,_0x19547d){return db[_0xcad9('0x15')]['findAll']({'raw':_0x30e48d[_0xcad9('0x16')]?_0x30e48d[_0xcad9('0x16')][_0xcad9('0x17')]===undefined?!![]:![]:!![],'where':_0x30e48d[_0xcad9('0x16')]?_0x30e48d['options'][_0xcad9('0x18')]||null:null,'attributes':_0x30e48d[_0xcad9('0x16')]?_0x30e48d[_0xcad9('0x16')][_0xcad9('0x19')]||null:null,'limit':_0x30e48d[_0xcad9('0x16')]?_0x30e48d['options'][_0xcad9('0x1a')]||null:null,'include':_0x30e48d['options']?_0x30e48d[_0xcad9('0x16')][_0xcad9('0x1b')]?_[_0xcad9('0x1c')](_0x30e48d['options'][_0xcad9('0x1b')],function(_0x3ab390){return{'model':db[_0x3ab390[_0xcad9('0x1d')]],'as':_0x3ab390['as'],'attributes':_0x3ab390['attributes'],'include':_0x3ab390[_0xcad9('0x1b')]?_[_0xcad9('0x1c')](_0x3ab390[_0xcad9('0x1b')],function(_0x4e45de){return{'model':db[_0x4e45de[_0xcad9('0x1d')]],'as':_0x4e45de['as'],'attributes':_0x4e45de[_0xcad9('0x19')],'include':_0x4e45de[_0xcad9('0x1b')]?_[_0xcad9('0x1c')](_0x4e45de['include'],function(_0x3db40a){return{'model':db[_0x3db40a[_0xcad9('0x1d')]],'as':_0x3db40a['as'],'attributes':_0x3db40a[_0xcad9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43de88){logger['info'](_0xcad9('0x14'),_0x30e48d);logger[_0xcad9('0x1e')](_0xcad9('0x14'),_0x30e48d,JSON['stringify'](_0x43de88));_0x1a4a62(_0x43de88);})[_0xcad9('0x1f')](function(_0x2ba038){logger[_0xcad9('0x10')]('GetMailServerIn',_0x2ba038['message'],_0x30e48d);_0x19547d(_0x5c74cf[_0xcad9('0x10')](0x1f4,_0x2ba038[_0xcad9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 83fd7be..da8f99a 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index fe35c15..becdba9 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 _0x4483=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x37f0a0,_0x4cf2c5){var _0x5f3eec=function(_0x578c45){while(--_0x578c45){_0x37f0a0['push'](_0x37f0a0['shift']());}};_0x5f3eec(++_0x4cf2c5);}(_0x4483,0x1a3));var _0x3448=function(_0x4c1f03,_0x537e81){_0x4c1f03=_0x4c1f03-0x0;var _0x32ffd8=_0x4483[_0x4c1f03];return _0x32ffd8;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'description':{'type':Sequelize[_0x3448('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x3448('0x2')]},'pass':{'type':Sequelize[_0x3448('0x2')]},'port':{'type':Sequelize[_0x3448('0x3')]},'secure':{'type':Sequelize[_0x3448('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x3448('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3448('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x282b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x63a88f,_0x4bddd5){var _0x2e7dfe=function(_0x203fe5){while(--_0x203fe5){_0x63a88f['push'](_0x63a88f['shift']());}};_0x2e7dfe(++_0x4bddd5);}(_0x282b,0xec));var _0xb282=function(_0x3420b7,_0x3f42f1){_0x3420b7=_0x3420b7-0x0;var _0x4dddc9=_0x282b[_0x3420b7];return _0x4dddc9;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'description':{'type':Sequelize[_0xb282('0x2')]},'host':{'type':Sequelize[_0xb282('0x2')]},'user':{'type':Sequelize[_0xb282('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xb282('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb282('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xb282('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 5131a38..367d2e4 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 _0x4eff=['bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','MailServerOut','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x45ee80,_0x556689){var _0x350e98=function(_0x96e156){while(--_0x96e156){_0x45ee80['push'](_0x45ee80['shift']());}};_0x350e98(++_0x556689);}(_0x4eff,0xd5));var _0xf4ef=function(_0x40a661,_0x4ff4e0){_0x40a661=_0x40a661-0x0;var _0x58ae5b=_0x4eff[_0x40a661];return _0x58ae5b;};'use strict';var emlformat=require(_0xf4ef('0x0'));var rimraf=require(_0xf4ef('0x1'));var zipdir=require(_0xf4ef('0x2'));var jsonpatch=require(_0xf4ef('0x3'));var rp=require(_0xf4ef('0x4'));var moment=require(_0xf4ef('0x5'));var BPromise=require(_0xf4ef('0x6'));var Mustache=require(_0xf4ef('0x7'));var util=require(_0xf4ef('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf4ef('0x9'));var ejs=require(_0xf4ef('0xa'));var fs=require('fs');var fs_extra=require(_0xf4ef('0xb'));var _=require(_0xf4ef('0xc'));var squel=require(_0xf4ef('0xd'));var crypto=require(_0xf4ef('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf4ef('0x9'));var querystring=require(_0xf4ef('0xf'));var Papa=require('papaparse');var Redis=require(_0xf4ef('0x10'));var authService=require(_0xf4ef('0x11'));var qs=require(_0xf4ef('0x12'));var as=require(_0xf4ef('0x13'));var hardwareService=require(_0xf4ef('0x14'));var logger=require(_0xf4ef('0x15'))('api');var utils=require(_0xf4ef('0x16'));var config=require(_0xf4ef('0x17'));var licenseUtil=require(_0xf4ef('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x442f4c,_0x224e33){_0x224e33=_0x224e33||0xcc;return function(_0x8fede0){if(_0x8fede0){return _0x442f4c['sendStatus'](_0x224e33);}return _0x442f4c['status'](_0x224e33)[_0xf4ef('0x19')]();};}function respondWithResult(_0x2df024,_0x56a253){_0x56a253=_0x56a253||0xc8;return function(_0x292574){if(_0x292574){return _0x2df024[_0xf4ef('0x1a')](_0x56a253)[_0xf4ef('0x1b')](_0x292574);}};}function respondWithFilteredResult(_0x5795de,_0x5db47c){return function(_0x4153d3){if(_0x4153d3){var _0x502acf=typeof _0x5db47c[_0xf4ef('0x1c')]===_0xf4ef('0x1d')&&typeof _0x5db47c[_0xf4ef('0x1e')]===_0xf4ef('0x1d');var _0x3b4ebe=_0x4153d3['count'];var _0xc13413=_0x502acf?0x0:_0x5db47c[_0xf4ef('0x1c')];var _0x55e739=_0x502acf?_0x4153d3[_0xf4ef('0x1f')]:_0x5db47c[_0xf4ef('0x1c')]+_0x5db47c[_0xf4ef('0x1e')];var _0x17e83f;if(_0x55e739>=_0x3b4ebe){_0x55e739=_0x3b4ebe;_0x17e83f=0xc8;}else{_0x17e83f=0xce;}_0x5795de['status'](_0x17e83f);return _0x5795de[_0xf4ef('0x20')](_0xf4ef('0x21'),_0xc13413+'-'+_0x55e739+'/'+_0x3b4ebe)[_0xf4ef('0x1b')](_0x4153d3);}return null;};}function patchUpdates(_0x32da42){return function(_0x5a869d){try{jsonpatch[_0xf4ef('0x22')](_0x5a869d,_0x32da42,!![]);}catch(_0x57ac39){return BPromise[_0xf4ef('0x23')](_0x57ac39);}return _0x5a869d[_0xf4ef('0x24')]();};}function saveUpdates(_0x4b218e,_0x3b6036){return function(_0x288abe){if(_0x288abe){return _0x288abe[_0xf4ef('0x25')](_0x4b218e)['then'](function(_0x2f72b0){return _0x2f72b0;});}return null;};}function removeEntity(_0x332dd7,_0x5d5129){return function(_0x10db60){if(_0x10db60){return _0x10db60['destroy']()[_0xf4ef('0x26')](function(){_0x332dd7[_0xf4ef('0x1a')](0xcc)[_0xf4ef('0x19')]();});}};}function handleEntityNotFound(_0x15cb02,_0x3de0ca){return function(_0x2455ea){if(!_0x2455ea){_0x15cb02['sendStatus'](0x194);}return _0x2455ea;};}function handleError(_0x1b6363,_0x4cbe76){_0x4cbe76=_0x4cbe76||0x1f4;return function(_0x18e3bf){logger[_0xf4ef('0x27')](_0x18e3bf[_0xf4ef('0x28')]);if(_0x18e3bf[_0xf4ef('0x29')]){delete _0x18e3bf[_0xf4ef('0x29')];}_0x1b6363['status'](_0x4cbe76)[_0xf4ef('0x2a')](_0x18e3bf);};}exports[_0xf4ef('0x2b')]=function(_0x3d3c52,_0x42e7d9){var _0x5d53c3={},_0x1b13a9={},_0x240dc0={'count':0x0,'rows':[]};var _0x54e928=_[_0xf4ef('0x2c')](db[_0xf4ef('0x2d')]['rawAttributes'],function(_0x3dcd3e){return{'name':_0x3dcd3e[_0xf4ef('0x2e')],'type':_0x3dcd3e[_0xf4ef('0x2f')]['key']};});_0x1b13a9[_0xf4ef('0x30')]=_[_0xf4ef('0x2c')](_0x54e928,'name');_0x1b13a9[_0xf4ef('0x31')]=_['keys'](_0x3d3c52[_0xf4ef('0x31')]);_0x1b13a9[_0xf4ef('0x32')]=_[_0xf4ef('0x33')](_0x1b13a9['model'],_0x1b13a9[_0xf4ef('0x31')]);_0x5d53c3['attributes']=_[_0xf4ef('0x33')](_0x1b13a9[_0xf4ef('0x30')],qs[_0xf4ef('0x34')](_0x3d3c52[_0xf4ef('0x31')]['fields']));_0x5d53c3[_0xf4ef('0x35')]=_0x5d53c3['attributes'][_0xf4ef('0x36')]?_0x5d53c3[_0xf4ef('0x35')]:_0x1b13a9['model'];if(!_0x3d3c52[_0xf4ef('0x31')][_0xf4ef('0x37')](_0xf4ef('0x38'))){_0x5d53c3[_0xf4ef('0x1e')]=qs[_0xf4ef('0x1e')](_0x3d3c52[_0xf4ef('0x31')][_0xf4ef('0x1e')]);_0x5d53c3[_0xf4ef('0x1c')]=qs[_0xf4ef('0x1c')](_0x3d3c52[_0xf4ef('0x31')][_0xf4ef('0x1c')]);}_0x5d53c3[_0xf4ef('0x39')]=qs[_0xf4ef('0x3a')](_0x3d3c52[_0xf4ef('0x31')][_0xf4ef('0x3a')]);_0x5d53c3['where']=qs[_0xf4ef('0x32')](_[_0xf4ef('0x3b')](_0x3d3c52[_0xf4ef('0x31')],_0x1b13a9['filters']),_0x54e928);if(_0x3d3c52['query']['filter']){_0x5d53c3[_0xf4ef('0x3c')]=_[_0xf4ef('0x3d')](_0x5d53c3[_0xf4ef('0x3c')],{'$or':_[_0xf4ef('0x2c')](_0x54e928,function(_0x2f25d3){if(_0x2f25d3[_0xf4ef('0x2f')]!==_0xf4ef('0x3e')){var _0x1a5160={};_0x1a5160[_0x2f25d3['name']]={'$like':'%'+_0x3d3c52[_0xf4ef('0x31')][_0xf4ef('0x3f')]+'%'};return _0x1a5160;}})});}_0x5d53c3=_[_0xf4ef('0x3d')]({},_0x5d53c3,_0x3d3c52['options']);var _0x15b857={'where':_0x5d53c3[_0xf4ef('0x3c')]};return db[_0xf4ef('0x2d')][_0xf4ef('0x1f')](_0x15b857)[_0xf4ef('0x26')](function(_0x4c6f4b){_0x240dc0[_0xf4ef('0x1f')]=_0x4c6f4b;if(_0x3d3c52[_0xf4ef('0x31')][_0xf4ef('0x40')]){_0x5d53c3['include']=[{'all':!![]}];}return db[_0xf4ef('0x2d')][_0xf4ef('0x41')](_0x5d53c3);})['then'](function(_0xf447b7){_0x240dc0[_0xf4ef('0x42')]=_0xf447b7;return _0x240dc0;})['then'](respondWithFilteredResult(_0x42e7d9,_0x5d53c3))['catch'](handleError(_0x42e7d9,null));};exports['show']=function(_0x2a398b,_0x12d5e9){var _0x972f3b={'raw':!![],'where':{'id':_0x2a398b[_0xf4ef('0x43')]['id']}},_0x4fd9dd={};_0x4fd9dd[_0xf4ef('0x30')]=_['keys'](db[_0xf4ef('0x2d')]['rawAttributes']);_0x4fd9dd['query']=_['keys'](_0x2a398b[_0xf4ef('0x31')]);_0x4fd9dd['filters']=_[_0xf4ef('0x33')](_0x4fd9dd[_0xf4ef('0x30')],_0x4fd9dd[_0xf4ef('0x31')]);_0x972f3b[_0xf4ef('0x35')]=_[_0xf4ef('0x33')](_0x4fd9dd['model'],qs['fields'](_0x2a398b['query'][_0xf4ef('0x34')]));_0x972f3b[_0xf4ef('0x35')]=_0x972f3b['attributes'][_0xf4ef('0x36')]?_0x972f3b['attributes']:_0x4fd9dd[_0xf4ef('0x30')];if(_0x2a398b[_0xf4ef('0x31')][_0xf4ef('0x40')]){_0x972f3b['include']=[{'all':!![]}];}_0x972f3b=_['merge']({},_0x972f3b,_0x2a398b['options']);return db[_0xf4ef('0x2d')][_0xf4ef('0x44')](_0x972f3b)[_0xf4ef('0x26')](handleEntityNotFound(_0x12d5e9,null))[_0xf4ef('0x26')](respondWithResult(_0x12d5e9,null))[_0xf4ef('0x45')](handleError(_0x12d5e9,null));};exports[_0xf4ef('0x46')]=function(_0x5a57ed,_0x10a004){return db[_0xf4ef('0x2d')][_0xf4ef('0x46')](_0x5a57ed[_0xf4ef('0x47')],{})['then'](respondWithResult(_0x10a004,0xc9))['catch'](handleError(_0x10a004,null));};exports[_0xf4ef('0x25')]=function(_0x5e6014,_0x5ab43f){if(_0x5e6014['body']['id']){delete _0x5e6014[_0xf4ef('0x47')]['id'];}return db[_0xf4ef('0x2d')][_0xf4ef('0x44')]({'where':{'id':_0x5e6014[_0xf4ef('0x43')]['id']}})[_0xf4ef('0x26')](handleEntityNotFound(_0x5ab43f,null))['then'](saveUpdates(_0x5e6014['body'],null))[_0xf4ef('0x26')](respondWithResult(_0x5ab43f,null))['catch'](handleError(_0x5ab43f,null));};exports[_0xf4ef('0x48')]=function(_0x477da8,_0x3d7bc0){return db[_0xf4ef('0x2d')][_0xf4ef('0x44')]({'where':{'id':_0x477da8[_0xf4ef('0x43')]['id']}})[_0xf4ef('0x26')](handleEntityNotFound(_0x3d7bc0,null))[_0xf4ef('0x26')](removeEntity(_0x3d7bc0,null))[_0xf4ef('0x45')](handleError(_0x3d7bc0,null));}; \ No newline at end of file +var _0xf5f3=['fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','create','body','find','rimraf'];(function(_0x53a82f,_0x3c21cd){var _0x24c906=function(_0x36d253){while(--_0x36d253){_0x53a82f['push'](_0x53a82f['shift']());}};_0x24c906(++_0x3c21cd);}(_0xf5f3,0xd4));var _0x3f5f=function(_0x5a5468,_0x36218f){_0x5a5468=_0x5a5468-0x0;var _0x456729=_0xf5f3[_0x5a5468];return _0x456729;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f5f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f5f('0x1'));var rp=require(_0x3f5f('0x2'));var moment=require(_0x3f5f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3f5f('0x4'));var util=require(_0x3f5f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x3f5f('0x6'));var ejs=require(_0x3f5f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3f5f('0x8'));var crypto=require(_0x3f5f('0x9'));var jsforce=require(_0x3f5f('0xa'));var deskjs=require(_0x3f5f('0xb'));var toCsv=require(_0x3f5f('0x6'));var querystring=require(_0x3f5f('0xc'));var Papa=require(_0x3f5f('0xd'));var Redis=require(_0x3f5f('0xe'));var authService=require(_0x3f5f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3f5f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3f5f('0x11'));var config=require(_0x3f5f('0x12'));var licenseUtil=require(_0x3f5f('0x13'));var db=require(_0x3f5f('0x14'))['db'];function respondWithStatusCode(_0x3a56d4,_0x32e969){_0x32e969=_0x32e969||0xcc;return function(_0x4b73bd){if(_0x4b73bd){return _0x3a56d4['sendStatus'](_0x32e969);}return _0x3a56d4[_0x3f5f('0x15')](_0x32e969)[_0x3f5f('0x16')]();};}function respondWithResult(_0x522509,_0x275691){_0x275691=_0x275691||0xc8;return function(_0x124adb){if(_0x124adb){return _0x522509[_0x3f5f('0x15')](_0x275691)[_0x3f5f('0x17')](_0x124adb);}};}function respondWithFilteredResult(_0x3ceace,_0x25f316){return function(_0x1e3ab1){if(_0x1e3ab1){var _0x42cbf8=typeof _0x25f316[_0x3f5f('0x18')]==='undefined'&&typeof _0x25f316[_0x3f5f('0x19')]===_0x3f5f('0x1a');var _0x2b74a0=_0x1e3ab1[_0x3f5f('0x1b')];var _0x227a97=_0x42cbf8?0x0:_0x25f316[_0x3f5f('0x18')];var _0x47bc22=_0x42cbf8?_0x1e3ab1[_0x3f5f('0x1b')]:_0x25f316[_0x3f5f('0x18')]+_0x25f316[_0x3f5f('0x19')];var _0x395e16;if(_0x47bc22>=_0x2b74a0){_0x47bc22=_0x2b74a0;_0x395e16=0xc8;}else{_0x395e16=0xce;}_0x3ceace[_0x3f5f('0x15')](_0x395e16);return _0x3ceace[_0x3f5f('0x1c')](_0x3f5f('0x1d'),_0x227a97+'-'+_0x47bc22+'/'+_0x2b74a0)[_0x3f5f('0x17')](_0x1e3ab1);}return null;};}function patchUpdates(_0x3a2d21){return function(_0x38007b){try{jsonpatch[_0x3f5f('0x1e')](_0x38007b,_0x3a2d21,!![]);}catch(_0x89949d){return BPromise[_0x3f5f('0x1f')](_0x89949d);}return _0x38007b[_0x3f5f('0x20')]();};}function saveUpdates(_0x42c5d7,_0x5b2b39){return function(_0x1e74d1){if(_0x1e74d1){return _0x1e74d1[_0x3f5f('0x21')](_0x42c5d7)[_0x3f5f('0x22')](function(_0x279627){return _0x279627;});}return null;};}function removeEntity(_0x53c0d0,_0x185668){return function(_0x3c4b26){if(_0x3c4b26){return _0x3c4b26[_0x3f5f('0x23')]()[_0x3f5f('0x22')](function(){_0x53c0d0[_0x3f5f('0x15')](0xcc)[_0x3f5f('0x16')]();});}};}function handleEntityNotFound(_0x12a4af,_0x7d1e7b){return function(_0x51d4ba){if(!_0x51d4ba){_0x12a4af['sendStatus'](0x194);}return _0x51d4ba;};}function handleError(_0x2dfeca,_0x147f9e){_0x147f9e=_0x147f9e||0x1f4;return function(_0x4b58f1){logger[_0x3f5f('0x24')](_0x4b58f1[_0x3f5f('0x25')]);if(_0x4b58f1['name']){delete _0x4b58f1[_0x3f5f('0x26')];}_0x2dfeca[_0x3f5f('0x15')](_0x147f9e)[_0x3f5f('0x27')](_0x4b58f1);};}exports['index']=function(_0x25ca4c,_0x4eb3e6){var _0x59e65a={},_0x1d80f0={},_0x401594={'count':0x0,'rows':[]};var _0x28e844=_[_0x3f5f('0x28')](db[_0x3f5f('0x29')]['rawAttributes'],function(_0x329d57){return{'name':_0x329d57[_0x3f5f('0x2a')],'type':_0x329d57[_0x3f5f('0x2b')][_0x3f5f('0x2c')]};});_0x1d80f0[_0x3f5f('0x2d')]=_[_0x3f5f('0x28')](_0x28e844,'name');_0x1d80f0[_0x3f5f('0x2e')]=_[_0x3f5f('0x2f')](_0x25ca4c[_0x3f5f('0x2e')]);_0x1d80f0[_0x3f5f('0x30')]=_[_0x3f5f('0x31')](_0x1d80f0[_0x3f5f('0x2d')],_0x1d80f0[_0x3f5f('0x2e')]);_0x59e65a['attributes']=_[_0x3f5f('0x31')](_0x1d80f0[_0x3f5f('0x2d')],qs['fields'](_0x25ca4c[_0x3f5f('0x2e')][_0x3f5f('0x32')]));_0x59e65a[_0x3f5f('0x33')]=_0x59e65a[_0x3f5f('0x33')][_0x3f5f('0x34')]?_0x59e65a[_0x3f5f('0x33')]:_0x1d80f0[_0x3f5f('0x2d')];if(!_0x25ca4c[_0x3f5f('0x2e')][_0x3f5f('0x35')](_0x3f5f('0x36'))){_0x59e65a[_0x3f5f('0x19')]=qs[_0x3f5f('0x19')](_0x25ca4c[_0x3f5f('0x2e')]['limit']);_0x59e65a[_0x3f5f('0x18')]=qs[_0x3f5f('0x18')](_0x25ca4c[_0x3f5f('0x2e')]['offset']);}_0x59e65a[_0x3f5f('0x37')]=qs['sort'](_0x25ca4c[_0x3f5f('0x2e')]['sort']);_0x59e65a[_0x3f5f('0x38')]=qs[_0x3f5f('0x30')](_[_0x3f5f('0x39')](_0x25ca4c[_0x3f5f('0x2e')],_0x1d80f0[_0x3f5f('0x30')]),_0x28e844);if(_0x25ca4c[_0x3f5f('0x2e')][_0x3f5f('0x3a')]){_0x59e65a[_0x3f5f('0x38')]=_[_0x3f5f('0x3b')](_0x59e65a[_0x3f5f('0x38')],{'$or':_[_0x3f5f('0x28')](_0x28e844,function(_0x1a3c6e){if(_0x1a3c6e[_0x3f5f('0x2b')]!==_0x3f5f('0x3c')){var _0x5794c4={};_0x5794c4[_0x1a3c6e[_0x3f5f('0x26')]]={'$like':'%'+_0x25ca4c['query'][_0x3f5f('0x3a')]+'%'};return _0x5794c4;}})});}_0x59e65a=_[_0x3f5f('0x3b')]({},_0x59e65a,_0x25ca4c[_0x3f5f('0x3d')]);var _0x1f1cb9={'where':_0x59e65a[_0x3f5f('0x38')]};return db[_0x3f5f('0x29')][_0x3f5f('0x1b')](_0x1f1cb9)[_0x3f5f('0x22')](function(_0x2d606a){_0x401594[_0x3f5f('0x1b')]=_0x2d606a;if(_0x25ca4c[_0x3f5f('0x2e')][_0x3f5f('0x3e')]){_0x59e65a[_0x3f5f('0x3f')]=[{'all':!![]}];}return db[_0x3f5f('0x29')]['findAll'](_0x59e65a);})[_0x3f5f('0x22')](function(_0x353d90){_0x401594[_0x3f5f('0x40')]=_0x353d90;return _0x401594;})['then'](respondWithFilteredResult(_0x4eb3e6,_0x59e65a))[_0x3f5f('0x41')](handleError(_0x4eb3e6,null));};exports['show']=function(_0x36d21d,_0x3b69c2){var _0x4650c4={'raw':!![],'where':{'id':_0x36d21d[_0x3f5f('0x42')]['id']}},_0x4c8946={};_0x4c8946[_0x3f5f('0x2d')]=_['keys'](db['MailServerOut'][_0x3f5f('0x43')]);_0x4c8946['query']=_[_0x3f5f('0x2f')](_0x36d21d[_0x3f5f('0x2e')]);_0x4c8946[_0x3f5f('0x30')]=_[_0x3f5f('0x31')](_0x4c8946[_0x3f5f('0x2d')],_0x4c8946[_0x3f5f('0x2e')]);_0x4650c4[_0x3f5f('0x33')]=_['intersection'](_0x4c8946['model'],qs[_0x3f5f('0x32')](_0x36d21d[_0x3f5f('0x2e')][_0x3f5f('0x32')]));_0x4650c4['attributes']=_0x4650c4[_0x3f5f('0x33')][_0x3f5f('0x34')]?_0x4650c4['attributes']:_0x4c8946[_0x3f5f('0x2d')];if(_0x36d21d['query'][_0x3f5f('0x3e')]){_0x4650c4['include']=[{'all':!![]}];}_0x4650c4=_[_0x3f5f('0x3b')]({},_0x4650c4,_0x36d21d['options']);return db['MailServerOut']['find'](_0x4650c4)['then'](handleEntityNotFound(_0x3b69c2,null))[_0x3f5f('0x22')](respondWithResult(_0x3b69c2,null))[_0x3f5f('0x41')](handleError(_0x3b69c2,null));};exports['create']=function(_0x58cc61,_0x43c3e8){return db['MailServerOut'][_0x3f5f('0x44')](_0x58cc61['body'],{})[_0x3f5f('0x22')](respondWithResult(_0x43c3e8,0xc9))['catch'](handleError(_0x43c3e8,null));};exports[_0x3f5f('0x21')]=function(_0xdccb87,_0x2181cc){if(_0xdccb87[_0x3f5f('0x45')]['id']){delete _0xdccb87['body']['id'];}return db['MailServerOut'][_0x3f5f('0x46')]({'where':{'id':_0xdccb87[_0x3f5f('0x42')]['id']}})[_0x3f5f('0x22')](handleEntityNotFound(_0x2181cc,null))[_0x3f5f('0x22')](saveUpdates(_0xdccb87['body'],null))['then'](respondWithResult(_0x2181cc,null))['catch'](handleError(_0x2181cc,null));};exports[_0x3f5f('0x23')]=function(_0x1c4002,_0x48d43c){return db[_0x3f5f('0x29')]['find']({'where':{'id':_0x1c4002[_0x3f5f('0x42')]['id']}})[_0x3f5f('0x22')](handleEntityNotFound(_0x48d43c,null))[_0x3f5f('0x22')](removeEntity(_0x48d43c,null))[_0x3f5f('0x41')](handleError(_0x48d43c,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 556c118..a5aabce 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 _0xea0d=['MailServerOut','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x51bfe2,_0x3c2793){var _0x2fa039=function(_0x25d0f7){while(--_0x25d0f7){_0x51bfe2['push'](_0x51bfe2['shift']());}};_0x2fa039(++_0x3c2793);}(_0xea0d,0x14b));var _0xdea0=function(_0x52eb16,_0x89c3d8){_0x52eb16=_0x52eb16-0x0;var _0x382d3f=_0xea0d[_0x52eb16];return _0x382d3f;};'use strict';var _=require(_0xdea0('0x0'));var util=require(_0xdea0('0x1'));var logger=require(_0xdea0('0x2'))('api');var moment=require(_0xdea0('0x3'));var BPromise=require(_0xdea0('0x4'));var rp=require(_0xdea0('0x5'));var fs=require('fs');var path=require(_0xdea0('0x6'));var rimraf=require(_0xdea0('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0xdea0('0x8')]=function(_0x33a7b8,_0x51e8fa){return _0x33a7b8[_0xdea0('0x9')](_0xdea0('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bea=['./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xcf6948,_0x25a965){var _0x56920e=function(_0x537149){while(--_0x537149){_0xcf6948['push'](_0xcf6948['shift']());}};_0x56920e(++_0x25a965);}(_0x1bea,0x1f1));var _0xa1be=function(_0x430d8a,_0xe4c35a){_0x430d8a=_0x430d8a-0x0;var _0x946c69=_0x1bea[_0x430d8a];return _0x946c69;};'use strict';var _=require(_0xa1be('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa1be('0x1'));var moment=require(_0xa1be('0x2'));var BPromise=require(_0xa1be('0x3'));var rp=require(_0xa1be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1be('0x5'));var config=require(_0xa1be('0x6'));var attributes=require(_0xa1be('0x7'));module[_0xa1be('0x8')]=function(_0x15b035,_0x48f25d){return _0x15b035[_0xa1be('0x9')](_0xa1be('0xa'),attributes,{'tableName':_0xa1be('0xb'),'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 9b91ef6..e52ca18 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x32748a,_0x24ce7a){var _0x46955b=function(_0x3af245){while(--_0x3af245){_0x32748a['push'](_0x32748a['shift']());}};_0x46955b(++_0x24ce7a);}(_0xdb28,0x106));var _0x8db2=function(_0x1acc10,_0x193178){_0x1acc10=_0x1acc10-0x0;var _0x14e8be=_0xdb28[_0x1acc10];return _0x14e8be;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\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(_0xb1d5f5,_0x3acc57){var _0x2fb3c4=function(_0x13b940){while(--_0x13b940){_0xb1d5f5['push'](_0xb1d5f5['shift']());}};_0x2fb3c4(++_0x3acc57);}(_0x1261,0x144));var _0x1126=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x1261[_0x43444b];return _0x392fe5;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a0efd67..a58943c 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 _0x00c3=['get','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x00c3,0x198));var _0x300c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x00c3[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x300c('0x0'));var util=require(_0x300c('0x1'));var path=require(_0x300c('0x2'));var timeout=require(_0x300c('0x3'));var express=require('express');var router=express[_0x300c('0x4')]();var fs_extra=require(_0x300c('0x5'));var auth=require(_0x300c('0x6'));var interaction=require(_0x300c('0x7'));var config=require(_0x300c('0x8'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x300c('0x9')](),controller['index']);router['get'](_0x300c('0xa'),auth[_0x300c('0x9')](),controller[_0x300c('0xb')]);router[_0x300c('0xc')](_0x300c('0xd'),auth[_0x300c('0x9')](),controller[_0x300c('0xe')]);router[_0x300c('0xf')]('/',auth['isAuthenticated'](),controller[_0x300c('0x10')]);router['put'](_0x300c('0xd'),auth[_0x300c('0x9')](),controller[_0x300c('0x11')]);router[_0x300c('0x12')](_0x300c('0xd'),auth[_0x300c('0x9')](),controller[_0x300c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7a31=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','put','/:id','update','delete','destroy','exports','util'];(function(_0x24e2a3,_0x534875){var _0x3e82f4=function(_0x48a8ee){while(--_0x48a8ee){_0x24e2a3['push'](_0x24e2a3['shift']());}};_0x3e82f4(++_0x534875);}(_0x7a31,0x168));var _0x17a3=function(_0xb3fe05,_0x3073a1){_0xb3fe05=_0xb3fe05-0x0;var _0x576b66=_0x7a31[_0xb3fe05];return _0x576b66;};'use strict';var multer=require('multer');var util=require(_0x17a3('0x0'));var path=require(_0x17a3('0x1'));var timeout=require(_0x17a3('0x2'));var express=require(_0x17a3('0x3'));var router=express['Router']();var fs_extra=require(_0x17a3('0x4'));var auth=require(_0x17a3('0x5'));var interaction=require(_0x17a3('0x6'));var config=require('../../config/environment');var controller=require(_0x17a3('0x7'));router[_0x17a3('0x8')]('/',auth['isAuthenticated'](),controller[_0x17a3('0x9')]);router[_0x17a3('0x8')](_0x17a3('0xa'),auth[_0x17a3('0xb')](),controller[_0x17a3('0xc')]);router['get']('/:id',auth[_0x17a3('0xb')](),controller['show']);router['post']('/',auth[_0x17a3('0xb')](),controller['create']);router[_0x17a3('0xd')](_0x17a3('0xe'),auth[_0x17a3('0xb')](),controller[_0x17a3('0xf')]);router[_0x17a3('0x10')](_0x17a3('0xe'),auth[_0x17a3('0xb')](),controller[_0x17a3('0x11')]);module[_0x17a3('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 8d0f8bd..c08f605 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 _0xafc4=['STRING','sequelize'];(function(_0x5a9ab7,_0x264bf7){var _0x10b5be=function(_0x4e4507){while(--_0x4e4507){_0x5a9ab7['push'](_0x5a9ab7['shift']());}};_0x10b5be(++_0x264bf7);}(_0xafc4,0x69));var _0x4afc=function(_0x16d5e4,_0x1a7d08){_0x16d5e4=_0x16d5e4-0x0;var _0x4592ee=_0xafc4[_0x16d5e4];return _0x4592ee;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4afc('0x1')]}}; \ No newline at end of file +var _0xb091=['exports','STRING','name'];(function(_0x2ac475,_0x5d4058){var _0x1dd0de=function(_0x261181){while(--_0x261181){_0x2ac475['push'](_0x2ac475['shift']());}};_0x1dd0de(++_0x5d4058);}(_0xb091,0x16e));var _0x1b09=function(_0x6e347f,_0x1760ce){_0x6e347f=_0x6e347f-0x0;var _0xe94bcd=_0xb091[_0x6e347f];return _0xe94bcd;};'use strict';var Sequelize=require('sequelize');module[_0x1b09('0x0')]={'name':{'type':Sequelize[_0x1b09('0x1')],'unique':_0x1b09('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1b09('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index df37fdb..97bd8df 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 _0x5bc1=['index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','options','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','send'];(function(_0x2e1d0d,_0x449fcb){var _0x3ff2b6=function(_0x8b7369){while(--_0x8b7369){_0x2e1d0d['push'](_0x2e1d0d['shift']());}};_0x3ff2b6(++_0x449fcb);}(_0x5bc1,0xf8));var _0x15bc=function(_0x1734ab,_0x254bb2){_0x1734ab=_0x1734ab-0x0;var _0x41008e=_0x5bc1[_0x1734ab];return _0x41008e;};'use strict';var emlformat=require(_0x15bc('0x0'));var rimraf=require(_0x15bc('0x1'));var zipdir=require(_0x15bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15bc('0x3'));var moment=require(_0x15bc('0x4'));var BPromise=require(_0x15bc('0x5'));var Mustache=require(_0x15bc('0x6'));var util=require(_0x15bc('0x7'));var path=require(_0x15bc('0x8'));var sox=require(_0x15bc('0x9'));var csv=require(_0x15bc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x15bc('0xb'));var crypto=require(_0x15bc('0xc'));var jsforce=require(_0x15bc('0xd'));var deskjs=require(_0x15bc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x15bc('0xf'));var Redis=require(_0x15bc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x15bc('0x11'));var hardwareService=require(_0x15bc('0x12'));var logger=require('../../config/logger')(_0x15bc('0x13'));var utils=require(_0x15bc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x15bc('0x15'));var db=require(_0x15bc('0x16'))['db'];function respondWithStatusCode(_0x4f107c,_0x4f9ed9){_0x4f9ed9=_0x4f9ed9||0xcc;return function(_0x3821da){if(_0x3821da){return _0x4f107c[_0x15bc('0x17')](_0x4f9ed9);}return _0x4f107c[_0x15bc('0x18')](_0x4f9ed9)[_0x15bc('0x19')]();};}function respondWithResult(_0x4ac1f5,_0x3da703){_0x3da703=_0x3da703||0xc8;return function(_0x196e31){if(_0x196e31){return _0x4ac1f5[_0x15bc('0x18')](_0x3da703)[_0x15bc('0x1a')](_0x196e31);}};}function respondWithFilteredResult(_0x1cd724,_0x400104){return function(_0x4e0688){if(_0x4e0688){var _0x28abbf=typeof _0x400104[_0x15bc('0x1b')]===_0x15bc('0x1c')&&typeof _0x400104[_0x15bc('0x1d')]===_0x15bc('0x1c');var _0xa8d7fe=_0x4e0688['count'];var _0xd7f74=_0x28abbf?0x0:_0x400104['offset'];var _0x1bcab9=_0x28abbf?_0x4e0688[_0x15bc('0x1e')]:_0x400104[_0x15bc('0x1b')]+_0x400104[_0x15bc('0x1d')];var _0x53a02d;if(_0x1bcab9>=_0xa8d7fe){_0x1bcab9=_0xa8d7fe;_0x53a02d=0xc8;}else{_0x53a02d=0xce;}_0x1cd724[_0x15bc('0x18')](_0x53a02d);return _0x1cd724[_0x15bc('0x1f')](_0x15bc('0x20'),_0xd7f74+'-'+_0x1bcab9+'/'+_0xa8d7fe)['json'](_0x4e0688);}return null;};}function patchUpdates(_0x3be890){return function(_0x54e9fb){try{jsonpatch[_0x15bc('0x21')](_0x54e9fb,_0x3be890,!![]);}catch(_0x4853ee){return BPromise[_0x15bc('0x22')](_0x4853ee);}return _0x54e9fb['save']();};}function saveUpdates(_0xbec85d,_0x46a09b){return function(_0x2469a2){if(_0x2469a2){return _0x2469a2['update'](_0xbec85d)['then'](function(_0x331ecd){return _0x331ecd;});}return null;};}function removeEntity(_0x18656b,_0xcf2efd){return function(_0x15d35c){if(_0x15d35c){return _0x15d35c['destroy']()[_0x15bc('0x23')](function(){_0x18656b['status'](0xcc)[_0x15bc('0x19')]();});}};}function handleEntityNotFound(_0x53869b,_0xab443d){return function(_0x555c5e){if(!_0x555c5e){_0x53869b['sendStatus'](0x194);}return _0x555c5e;};}function handleError(_0x263889,_0x7dc462){_0x7dc462=_0x7dc462||0x1f4;return function(_0x4026b5){logger[_0x15bc('0x24')](_0x4026b5[_0x15bc('0x25')]);if(_0x4026b5[_0x15bc('0x26')]){delete _0x4026b5[_0x15bc('0x26')];}_0x263889[_0x15bc('0x18')](_0x7dc462)[_0x15bc('0x27')](_0x4026b5);};}exports[_0x15bc('0x28')]=function(_0x1ec291,_0x4773e8){var _0xb2d755={},_0x28d77d={},_0x3c6317={'count':0x0,'rows':[]};var _0x7a2dc7=_[_0x15bc('0x29')](db[_0x15bc('0x2a')][_0x15bc('0x2b')],function(_0x3fed13){return{'name':_0x3fed13[_0x15bc('0x2c')],'type':_0x3fed13['type'][_0x15bc('0x2d')]};});_0x28d77d[_0x15bc('0x2e')]=_[_0x15bc('0x29')](_0x7a2dc7,_0x15bc('0x26'));_0x28d77d[_0x15bc('0x2f')]=_[_0x15bc('0x30')](_0x1ec291[_0x15bc('0x2f')]);_0x28d77d[_0x15bc('0x31')]=_[_0x15bc('0x32')](_0x28d77d[_0x15bc('0x2e')],_0x28d77d['query']);_0xb2d755['attributes']=_[_0x15bc('0x32')](_0x28d77d['model'],qs[_0x15bc('0x33')](_0x1ec291[_0x15bc('0x2f')]['fields']));_0xb2d755[_0x15bc('0x34')]=_0xb2d755['attributes']['length']?_0xb2d755['attributes']:_0x28d77d['model'];if(!_0x1ec291[_0x15bc('0x2f')]['hasOwnProperty'](_0x15bc('0x35'))){_0xb2d755['limit']=qs[_0x15bc('0x1d')](_0x1ec291['query']['limit']);_0xb2d755['offset']=qs[_0x15bc('0x1b')](_0x1ec291['query']['offset']);}_0xb2d755['order']=qs[_0x15bc('0x36')](_0x1ec291[_0x15bc('0x2f')][_0x15bc('0x36')]);_0xb2d755[_0x15bc('0x37')]=qs['filters'](_['pick'](_0x1ec291[_0x15bc('0x2f')],_0x28d77d['filters']),_0x7a2dc7);if(_0x1ec291[_0x15bc('0x2f')][_0x15bc('0x38')]){_0xb2d755[_0x15bc('0x37')]=_[_0x15bc('0x39')](_0xb2d755[_0x15bc('0x37')],{'$or':_[_0x15bc('0x29')](_0x7a2dc7,function(_0x115cb4){if(_0x115cb4[_0x15bc('0x3a')]!=='VIRTUAL'){var _0x40445a={};_0x40445a[_0x115cb4[_0x15bc('0x26')]]={'$like':'%'+_0x1ec291['query'][_0x15bc('0x38')]+'%'};return _0x40445a;}})});}_0xb2d755=_[_0x15bc('0x39')]({},_0xb2d755,_0x1ec291['options']);var _0xd9b848={'where':_0xb2d755[_0x15bc('0x37')]};return db[_0x15bc('0x2a')]['count'](_0xd9b848)['then'](function(_0x224c11){_0x3c6317[_0x15bc('0x1e')]=_0x224c11;if(_0x1ec291[_0x15bc('0x2f')][_0x15bc('0x3b')]){_0xb2d755[_0x15bc('0x3c')]=[{'all':!![]}];}return db['MailSubstatus'][_0x15bc('0x3d')](_0xb2d755);})[_0x15bc('0x23')](function(_0x4989bc){_0x3c6317[_0x15bc('0x3e')]=_0x4989bc;return _0x3c6317;})[_0x15bc('0x23')](respondWithFilteredResult(_0x4773e8,_0xb2d755))[_0x15bc('0x3f')](handleError(_0x4773e8,null));};exports[_0x15bc('0x40')]=function(_0x333e0a,_0x213f19){var _0x17b485={'raw':!![],'where':{'id':_0x333e0a['params']['id']}},_0xa5046e={};_0xa5046e[_0x15bc('0x2e')]=_[_0x15bc('0x30')](db[_0x15bc('0x2a')][_0x15bc('0x2b')]);_0xa5046e[_0x15bc('0x2f')]=_[_0x15bc('0x30')](_0x333e0a[_0x15bc('0x2f')]);_0xa5046e['filters']=_[_0x15bc('0x32')](_0xa5046e[_0x15bc('0x2e')],_0xa5046e[_0x15bc('0x2f')]);_0x17b485[_0x15bc('0x34')]=_[_0x15bc('0x32')](_0xa5046e[_0x15bc('0x2e')],qs[_0x15bc('0x33')](_0x333e0a[_0x15bc('0x2f')]['fields']));_0x17b485['attributes']=_0x17b485[_0x15bc('0x34')]['length']?_0x17b485['attributes']:_0xa5046e[_0x15bc('0x2e')];if(_0x333e0a[_0x15bc('0x2f')][_0x15bc('0x3b')]){_0x17b485[_0x15bc('0x3c')]=[{'all':!![]}];}_0x17b485=_[_0x15bc('0x39')]({},_0x17b485,_0x333e0a[_0x15bc('0x41')]);return db['MailSubstatus'][_0x15bc('0x42')](_0x17b485)[_0x15bc('0x23')](handleEntityNotFound(_0x213f19,null))[_0x15bc('0x23')](respondWithResult(_0x213f19,null))[_0x15bc('0x3f')](handleError(_0x213f19,null));};exports[_0x15bc('0x43')]=function(_0x3a341d,_0x599866){return db[_0x15bc('0x2a')][_0x15bc('0x43')](_0x3a341d['body'],{})[_0x15bc('0x23')](respondWithResult(_0x599866,0xc9))[_0x15bc('0x3f')](handleError(_0x599866,null));};exports[_0x15bc('0x44')]=function(_0x207f6e,_0xe96c59){if(_0x207f6e[_0x15bc('0x45')]['id']){delete _0x207f6e[_0x15bc('0x45')]['id'];}return db[_0x15bc('0x2a')]['find']({'where':{'id':_0x207f6e['params']['id']}})[_0x15bc('0x23')](handleEntityNotFound(_0xe96c59,null))[_0x15bc('0x23')](saveUpdates(_0x207f6e['body'],null))[_0x15bc('0x23')](respondWithResult(_0xe96c59,null))[_0x15bc('0x3f')](handleError(_0xe96c59,null));};exports['destroy']=function(_0x3dfae8,_0xadeab3){return db[_0x15bc('0x2a')][_0x15bc('0x42')]({'where':{'id':_0x3dfae8[_0x15bc('0x46')]['id']}})[_0x15bc('0x23')](handleEntityNotFound(_0xadeab3,null))['then'](removeEntity(_0xadeab3,null))['catch'](handleError(_0xadeab3,null));};exports[_0x15bc('0x47')]=function(_0x2168fd,_0x4b6421){return db[_0x15bc('0x2a')][_0x15bc('0x47')]()[_0x15bc('0x23')](respondWithResult(_0x4b6421,null))[_0x15bc('0x3f')](handleError(_0x4b6421,null));}; \ No newline at end of file +var _0x3e65=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','update','then','destroy','end','error','name','send','map','MailSubstatus','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','show','params','include','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x14938b,_0x44bed3){var _0x1c0f78=function(_0x43a3cf){while(--_0x43a3cf){_0x14938b['push'](_0x14938b['shift']());}};_0x1c0f78(++_0x44bed3);}(_0x3e65,0x1a3));var _0x53e6=function(_0x351a04,_0x3c3e08){_0x351a04=_0x351a04-0x0;var _0x3280ec=_0x3e65[_0x351a04];return _0x3280ec;};'use strict';var emlformat=require(_0x53e6('0x0'));var rimraf=require(_0x53e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53e6('0x2'));var rp=require(_0x53e6('0x3'));var moment=require(_0x53e6('0x4'));var BPromise=require(_0x53e6('0x5'));var Mustache=require(_0x53e6('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x53e6('0x7'));var ejs=require(_0x53e6('0x8'));var fs=require('fs');var fs_extra=require(_0x53e6('0x9'));var _=require(_0x53e6('0xa'));var squel=require(_0x53e6('0xb'));var crypto=require(_0x53e6('0xc'));var jsforce=require(_0x53e6('0xd'));var deskjs=require(_0x53e6('0xe'));var toCsv=require(_0x53e6('0x7'));var querystring=require(_0x53e6('0xf'));var Papa=require('papaparse');var Redis=require(_0x53e6('0x10'));var authService=require(_0x53e6('0x11'));var qs=require(_0x53e6('0x12'));var as=require(_0x53e6('0x13'));var hardwareService=require(_0x53e6('0x14'));var logger=require(_0x53e6('0x15'))(_0x53e6('0x16'));var utils=require(_0x53e6('0x17'));var config=require(_0x53e6('0x18'));var licenseUtil=require(_0x53e6('0x19'));var db=require(_0x53e6('0x1a'))['db'];function respondWithStatusCode(_0x1e856d,_0x4a083d){_0x4a083d=_0x4a083d||0xcc;return function(_0x184612){if(_0x184612){return _0x1e856d[_0x53e6('0x1b')](_0x4a083d);}return _0x1e856d[_0x53e6('0x1c')](_0x4a083d)['end']();};}function respondWithResult(_0x36649e,_0x1c2c21){_0x1c2c21=_0x1c2c21||0xc8;return function(_0x5c9774){if(_0x5c9774){return _0x36649e[_0x53e6('0x1c')](_0x1c2c21)[_0x53e6('0x1d')](_0x5c9774);}};}function respondWithFilteredResult(_0x4e94be,_0x357db6){return function(_0x4c7269){if(_0x4c7269){var _0x216806=typeof _0x357db6[_0x53e6('0x1e')]===_0x53e6('0x1f')&&typeof _0x357db6['limit']===_0x53e6('0x1f');var _0x5fa995=_0x4c7269['count'];var _0x4e551a=_0x216806?0x0:_0x357db6['offset'];var _0x8a09da=_0x216806?_0x4c7269[_0x53e6('0x20')]:_0x357db6[_0x53e6('0x1e')]+_0x357db6[_0x53e6('0x21')];var _0x16a102;if(_0x8a09da>=_0x5fa995){_0x8a09da=_0x5fa995;_0x16a102=0xc8;}else{_0x16a102=0xce;}_0x4e94be[_0x53e6('0x1c')](_0x16a102);return _0x4e94be['set']('Content-Range',_0x4e551a+'-'+_0x8a09da+'/'+_0x5fa995)[_0x53e6('0x1d')](_0x4c7269);}return null;};}function patchUpdates(_0x52eb70){return function(_0x1b6321){try{jsonpatch['apply'](_0x1b6321,_0x52eb70,!![]);}catch(_0x591c0d){return BPromise['reject'](_0x591c0d);}return _0x1b6321['save']();};}function saveUpdates(_0x595289,_0x478cf0){return function(_0x47c49c){if(_0x47c49c){return _0x47c49c[_0x53e6('0x22')](_0x595289)[_0x53e6('0x23')](function(_0x2ce8f0){return _0x2ce8f0;});}return null;};}function removeEntity(_0x5a3191,_0x72feda){return function(_0x5bb579){if(_0x5bb579){return _0x5bb579[_0x53e6('0x24')]()[_0x53e6('0x23')](function(){_0x5a3191[_0x53e6('0x1c')](0xcc)[_0x53e6('0x25')]();});}};}function handleEntityNotFound(_0x285b07,_0xb8ab49){return function(_0x592867){if(!_0x592867){_0x285b07[_0x53e6('0x1b')](0x194);}return _0x592867;};}function handleError(_0x15409c,_0x262b4d){_0x262b4d=_0x262b4d||0x1f4;return function(_0xf52a5d){logger[_0x53e6('0x26')](_0xf52a5d['stack']);if(_0xf52a5d[_0x53e6('0x27')]){delete _0xf52a5d[_0x53e6('0x27')];}_0x15409c[_0x53e6('0x1c')](_0x262b4d)[_0x53e6('0x28')](_0xf52a5d);};}exports['index']=function(_0x2fa375,_0x189044){var _0x4adf88={},_0x5e92b1={},_0x4c0a9d={'count':0x0,'rows':[]};var _0x30c190=_[_0x53e6('0x29')](db[_0x53e6('0x2a')][_0x53e6('0x2b')],function(_0xd5547){return{'name':_0xd5547[_0x53e6('0x2c')],'type':_0xd5547[_0x53e6('0x2d')]['key']};});_0x5e92b1['model']=_[_0x53e6('0x29')](_0x30c190,'name');_0x5e92b1[_0x53e6('0x2e')]=_[_0x53e6('0x2f')](_0x2fa375[_0x53e6('0x2e')]);_0x5e92b1[_0x53e6('0x30')]=_[_0x53e6('0x31')](_0x5e92b1[_0x53e6('0x32')],_0x5e92b1['query']);_0x4adf88[_0x53e6('0x33')]=_[_0x53e6('0x31')](_0x5e92b1['model'],qs[_0x53e6('0x34')](_0x2fa375[_0x53e6('0x2e')][_0x53e6('0x34')]));_0x4adf88[_0x53e6('0x33')]=_0x4adf88[_0x53e6('0x33')][_0x53e6('0x35')]?_0x4adf88[_0x53e6('0x33')]:_0x5e92b1[_0x53e6('0x32')];if(!_0x2fa375['query'][_0x53e6('0x36')](_0x53e6('0x37'))){_0x4adf88[_0x53e6('0x21')]=qs[_0x53e6('0x21')](_0x2fa375[_0x53e6('0x2e')][_0x53e6('0x21')]);_0x4adf88[_0x53e6('0x1e')]=qs[_0x53e6('0x1e')](_0x2fa375[_0x53e6('0x2e')][_0x53e6('0x1e')]);}_0x4adf88[_0x53e6('0x38')]=qs['sort'](_0x2fa375[_0x53e6('0x2e')][_0x53e6('0x39')]);_0x4adf88[_0x53e6('0x3a')]=qs[_0x53e6('0x30')](_['pick'](_0x2fa375[_0x53e6('0x2e')],_0x5e92b1[_0x53e6('0x30')]),_0x30c190);if(_0x2fa375['query'][_0x53e6('0x3b')]){_0x4adf88[_0x53e6('0x3a')]=_[_0x53e6('0x3c')](_0x4adf88['where'],{'$or':_[_0x53e6('0x29')](_0x30c190,function(_0x314cfd){if(_0x314cfd[_0x53e6('0x2d')]!=='VIRTUAL'){var _0x277e62={};_0x277e62[_0x314cfd['name']]={'$like':'%'+_0x2fa375[_0x53e6('0x2e')]['filter']+'%'};return _0x277e62;}})});}_0x4adf88=_['merge']({},_0x4adf88,_0x2fa375[_0x53e6('0x3d')]);var _0x16f9c9={'where':_0x4adf88['where']};return db[_0x53e6('0x2a')][_0x53e6('0x20')](_0x16f9c9)[_0x53e6('0x23')](function(_0x4f1c57){_0x4c0a9d['count']=_0x4f1c57;if(_0x2fa375[_0x53e6('0x2e')][_0x53e6('0x3e')]){_0x4adf88['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x53e6('0x3f')](_0x4adf88);})[_0x53e6('0x23')](function(_0x4a06b0){_0x4c0a9d['rows']=_0x4a06b0;return _0x4c0a9d;})[_0x53e6('0x23')](respondWithFilteredResult(_0x189044,_0x4adf88))['catch'](handleError(_0x189044,null));};exports[_0x53e6('0x40')]=function(_0xcf2b33,_0x483d0b){var _0x5c65f7={'raw':!![],'where':{'id':_0xcf2b33[_0x53e6('0x41')]['id']}},_0x22565b={};_0x22565b['model']=_['keys'](db[_0x53e6('0x2a')][_0x53e6('0x2b')]);_0x22565b[_0x53e6('0x2e')]=_[_0x53e6('0x2f')](_0xcf2b33[_0x53e6('0x2e')]);_0x22565b['filters']=_['intersection'](_0x22565b[_0x53e6('0x32')],_0x22565b['query']);_0x5c65f7[_0x53e6('0x33')]=_[_0x53e6('0x31')](_0x22565b[_0x53e6('0x32')],qs[_0x53e6('0x34')](_0xcf2b33[_0x53e6('0x2e')][_0x53e6('0x34')]));_0x5c65f7['attributes']=_0x5c65f7[_0x53e6('0x33')][_0x53e6('0x35')]?_0x5c65f7['attributes']:_0x22565b[_0x53e6('0x32')];if(_0xcf2b33[_0x53e6('0x2e')][_0x53e6('0x3e')]){_0x5c65f7[_0x53e6('0x42')]=[{'all':!![]}];}_0x5c65f7=_[_0x53e6('0x3c')]({},_0x5c65f7,_0xcf2b33[_0x53e6('0x3d')]);return db['MailSubstatus'][_0x53e6('0x43')](_0x5c65f7)[_0x53e6('0x23')](handleEntityNotFound(_0x483d0b,null))[_0x53e6('0x23')](respondWithResult(_0x483d0b,null))[_0x53e6('0x44')](handleError(_0x483d0b,null));};exports[_0x53e6('0x45')]=function(_0x4afc1b,_0x51dff6){return db['MailSubstatus'][_0x53e6('0x45')](_0x4afc1b[_0x53e6('0x46')],{})[_0x53e6('0x23')](respondWithResult(_0x51dff6,0xc9))[_0x53e6('0x44')](handleError(_0x51dff6,null));};exports[_0x53e6('0x22')]=function(_0x2e1f42,_0x55d6d4){if(_0x2e1f42[_0x53e6('0x46')]['id']){delete _0x2e1f42['body']['id'];}return db[_0x53e6('0x2a')][_0x53e6('0x43')]({'where':{'id':_0x2e1f42['params']['id']}})['then'](handleEntityNotFound(_0x55d6d4,null))[_0x53e6('0x23')](saveUpdates(_0x2e1f42[_0x53e6('0x46')],null))['then'](respondWithResult(_0x55d6d4,null))['catch'](handleError(_0x55d6d4,null));};exports[_0x53e6('0x24')]=function(_0x23f717,_0x26cbc6){return db['MailSubstatus']['find']({'where':{'id':_0x23f717[_0x53e6('0x41')]['id']}})[_0x53e6('0x23')](handleEntityNotFound(_0x26cbc6,null))[_0x53e6('0x23')](removeEntity(_0x26cbc6,null))['catch'](handleError(_0x26cbc6,null));};exports['describe']=function(_0x58ddee,_0x2dd759){return db['MailSubstatus']['describe']()[_0x53e6('0x23')](respondWithResult(_0x2dd759,null))['catch'](handleError(_0x2dd759,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 91592d8..b7b9704 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 _0x180a=['events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x40427b,_0x5d641a){var _0x1264f1=function(_0x45efbe){while(--_0x45efbe){_0x40427b['push'](_0x40427b['shift']());}};_0x1264f1(++_0x5d641a);}(_0x180a,0x88));var _0xa180=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x180a[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0xa180('0x0'));var MailSubstatus=require(_0xa180('0x1'))['db'][_0xa180('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xa180('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x5112fb){return function(_0x2aa475,_0x5124b1,_0x437a1f){MailSubstatusEvents[_0xa180('0x4')](_0x5112fb+':'+_0x2aa475['id'],_0x2aa475);MailSubstatusEvents[_0xa180('0x4')](_0x5112fb,_0x2aa475);_0x437a1f(null);};}for(var e in events){if(events[_0xa180('0x5')](e)){var event=events[e];MailSubstatus[_0xa180('0x6')](e,emitEvent(event));}}module[_0xa180('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x9e6e=['events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x9e6e,0xf8));var _0xe9e6=function(_0x46307f,_0x55db2f){_0x46307f=_0x46307f-0x0;var _0x5a3320=_0x9e6e[_0x46307f];return _0x5a3320;};'use strict';var EventEmitter=require(_0xe9e6('0x0'));var MailSubstatus=require(_0xe9e6('0x1'))['db'][_0xe9e6('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe9e6('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x33a46){return function(_0x3859f3,_0x51988d,_0xc4e872){MailSubstatusEvents[_0xe9e6('0x4')](_0x33a46+':'+_0x3859f3['id'],_0x3859f3);MailSubstatusEvents['emit'](_0x33a46,_0x3859f3);_0xc4e872(null);};}for(var e in events){if(events[_0xe9e6('0x5')](e)){var event=events[e];MailSubstatus[_0xe9e6('0x6')](e,emitEvent(event));}}module[_0xe9e6('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 80766f4..d1207cd 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 _0xc77f=['update','name','_previousDataValues','then','catch','./mailSubstatus.attributes','models','MailSubstatus','mail_substatuses'];(function(_0x216687,_0x22dc4c){var _0xd1a759=function(_0x47fa38){while(--_0x47fa38){_0x216687['push'](_0x216687['shift']());}};_0xd1a759(++_0x22dc4c);}(_0xc77f,0x1d9));var _0xfc77=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0xc77f[_0x414655];return _0x237884;};'use strict';var attributes=require(_0xfc77('0x0'));module['exports']=function(_0x5478f0){var _0x1a4ebc=_0x5478f0[_0xfc77('0x1')];return _0x5478f0['define'](_0xfc77('0x2'),attributes,{'tableName':_0xfc77('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x321416,_0x5e0034,_0x52a0b4){return _0x1a4ebc['Condition'][_0xfc77('0x4')]({'value':_0x321416[_0xfc77('0x5')]},{'where':{'field':'mailSubstatus','value':_0x321416[_0xfc77('0x6')][_0xfc77('0x5')]}})[_0xfc77('0x7')](function(){_0x52a0b4();})[_0xfc77('0x8')](function(_0x82ed09){_0x52a0b4(_0x82ed09);});}}});}; \ No newline at end of file +var _0xce0d=['./mailSubstatus.attributes','exports','models','define','update','name','mailSubstatus','_previousDataValues','then'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xce0d,0x1e6));var _0xdce0=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0xce0d[_0x189d3c];return _0x485959;};'use strict';var attributes=require(_0xdce0('0x0'));module[_0xdce0('0x1')]=function(_0x334aea){var _0x4fb712=_0x334aea[_0xdce0('0x2')];return _0x334aea[_0xdce0('0x3')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x252cec,_0x3609ea,_0x5b226c){return _0x4fb712['Condition'][_0xdce0('0x4')]({'value':_0x252cec[_0xdce0('0x5')]},{'where':{'field':_0xdce0('0x6'),'value':_0x252cec[_0xdce0('0x7')]['name']}})[_0xdce0('0x8')](function(){_0x5b226c();})['catch'](function(_0x214198){_0x5b226c(_0x214198);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 0afe862..5d6000f 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 _0xb398=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x1f77db,_0x7f6374){var _0x1ce0a0=function(_0x3f5ad9){while(--_0x3f5ad9){_0x1f77db['push'](_0x1f77db['shift']());}};_0x1ce0a0(++_0x7f6374);}(_0xb398,0x128));var _0x8b39=function(_0x11f7aa,_0x532af2){_0x11f7aa=_0x11f7aa-0x0;var _0x11a86b=_0xb398[_0x11f7aa];return _0x11a86b;};'use strict';var _=require(_0x8b39('0x0'));var util=require(_0x8b39('0x1'));var moment=require(_0x8b39('0x2'));var BPromise=require(_0x8b39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b39('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b39('0x5'));var logger=require('../../config/logger')(_0x8b39('0x6'));var config=require(_0x8b39('0x7'));var jayson=require(_0x8b39('0x8'));var client=jayson[_0x8b39('0x9')][_0x8b39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4989c3,_0x12bdb8,_0x3f1de0){return new BPromise(function(_0x143979,_0xc1fd21){return client[_0x8b39('0xb')](_0x4989c3,_0x3f1de0)[_0x8b39('0xc')](function(_0xce78e0){logger['info'](_0x8b39('0xd'),_0x12bdb8,_0x8b39('0xe'));logger[_0x8b39('0xf')](_0x8b39('0x10'),_0x12bdb8,_0x8b39('0xe'),JSON[_0x8b39('0x11')](_0xce78e0));if(_0xce78e0[_0x8b39('0x12')]){if(_0xce78e0[_0x8b39('0x12')]['code']===0x1f4){logger[_0x8b39('0x12')](_0x8b39('0xd'),_0x12bdb8,_0xce78e0[_0x8b39('0x12')][_0x8b39('0x13')]);return _0xc1fd21(_0xce78e0['error'][_0x8b39('0x13')]);}logger[_0x8b39('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x12bdb8,_0xce78e0[_0x8b39('0x12')]['message']);return _0x143979(_0xce78e0['error'][_0x8b39('0x13')]);}else{logger[_0x8b39('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x12bdb8,'request\x20sent');_0x143979(_0xce78e0[_0x8b39('0x15')][_0x8b39('0x13')]);}})[_0x8b39('0x16')](function(_0x3318da){logger['error'](_0x8b39('0xd'),_0x12bdb8,_0x3318da);_0xc1fd21(_0x3318da);});});} \ No newline at end of file +var _0xecc0=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2efd1d,_0x44f696){var _0x1ef3f6=function(_0x25da5f){while(--_0x25da5f){_0x2efd1d['push'](_0x2efd1d['shift']());}};_0x1ef3f6(++_0x44f696);}(_0xecc0,0x121));var _0x0ecc=function(_0x32d196,_0x348ec6){_0x32d196=_0x32d196-0x0;var _0x2bacfd=_0xecc0[_0x32d196];return _0x2bacfd;};'use strict';var _=require(_0x0ecc('0x0'));var util=require(_0x0ecc('0x1'));var moment=require(_0x0ecc('0x2'));var BPromise=require(_0x0ecc('0x3'));var rs=require(_0x0ecc('0x4'));var fs=require('fs');var Redis=require(_0x0ecc('0x5'));var db=require(_0x0ecc('0x6'))['db'];var utils=require(_0x0ecc('0x7'));var logger=require(_0x0ecc('0x8'))(_0x0ecc('0x9'));var config=require(_0x0ecc('0xa'));var jayson=require(_0x0ecc('0xb'));var client=jayson[_0x0ecc('0xc')][_0x0ecc('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x20eb4b,_0x2af57b,_0xe56746){return new BPromise(function(_0x192e12,_0x253a5b){return client[_0x0ecc('0xe')](_0x20eb4b,_0xe56746)[_0x0ecc('0xf')](function(_0x4b9a1d){logger['info'](_0x0ecc('0x10'),_0x2af57b,'request\x20sent');logger[_0x0ecc('0x11')](_0x0ecc('0x12'),_0x2af57b,'request\x20sent',JSON[_0x0ecc('0x13')](_0x4b9a1d));if(_0x4b9a1d[_0x0ecc('0x14')]){if(_0x4b9a1d[_0x0ecc('0x14')][_0x0ecc('0x15')]===0x1f4){logger[_0x0ecc('0x14')](_0x0ecc('0x10'),_0x2af57b,_0x4b9a1d[_0x0ecc('0x14')][_0x0ecc('0x16')]);return _0x253a5b(_0x4b9a1d[_0x0ecc('0x14')][_0x0ecc('0x16')]);}logger[_0x0ecc('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x2af57b,_0x4b9a1d['error'][_0x0ecc('0x16')]);return _0x192e12(_0x4b9a1d['error'][_0x0ecc('0x16')]);}else{logger[_0x0ecc('0x17')]('MailSubstatus,\x20%s,\x20%s',_0x2af57b,'request\x20sent');_0x192e12(_0x4b9a1d[_0x0ecc('0x18')][_0x0ecc('0x16')]);}})[_0x0ecc('0x19')](function(_0x41a020){logger[_0x0ecc('0x14')](_0x0ecc('0x10'),_0x2af57b,_0x41a020);_0x253a5b(_0x41a020);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index b945908..5c35e7e 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 _0x8df9=['put','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id','create'];(function(_0x3d9d4e,_0x5dc187){var _0x4058d4=function(_0x143ec6){while(--_0x143ec6){_0x3d9d4e['push'](_0x3d9d4e['shift']());}};_0x4058d4(++_0x5dc187);}(_0x8df9,0xbe));var _0x98df=function(_0x4e3415,_0x41d594){_0x4e3415=_0x4e3415-0x0;var _0x1a47e8=_0x8df9[_0x4e3415];return _0x1a47e8;};'use strict';var multer=require(_0x98df('0x0'));var util=require('util');var path=require(_0x98df('0x1'));var timeout=require('connect-timeout');var express=require(_0x98df('0x2'));var router=express[_0x98df('0x3')]();var fs_extra=require(_0x98df('0x4'));var auth=require(_0x98df('0x5'));var interaction=require(_0x98df('0x6'));var config=require(_0x98df('0x7'));var controller=require(_0x98df('0x8'));router[_0x98df('0x9')]('/',auth[_0x98df('0xa')](),controller['index']);router['get']('/describe',auth[_0x98df('0xa')](),controller[_0x98df('0xb')]);router[_0x98df('0x9')](_0x98df('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x98df('0xa')](),controller[_0x98df('0xd')]);router[_0x98df('0xe')](_0x98df('0xc'),auth[_0x98df('0xa')](),controller['update']);router[_0x98df('0xf')](_0x98df('0xc'),auth[_0x98df('0xa')](),controller['destroy']);module[_0x98df('0x10')]=router; \ No newline at end of file +var _0xdbf2=['put','/:id','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x37fa2b,_0x3adbf7){var _0x44efee=function(_0x5bf7ce){while(--_0x5bf7ce){_0x37fa2b['push'](_0x37fa2b['shift']());}};_0x44efee(++_0x3adbf7);}(_0xdbf2,0x1bd));var _0x2dbf=function(_0x45a884,_0x461e50){_0x45a884=_0x45a884-0x0;var _0x4c985e=_0xdbf2[_0x45a884];return _0x4c985e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2dbf('0x0'));var timeout=require(_0x2dbf('0x1'));var express=require(_0x2dbf('0x2'));var router=express[_0x2dbf('0x3')]();var fs_extra=require(_0x2dbf('0x4'));var auth=require(_0x2dbf('0x5'));var interaction=require(_0x2dbf('0x6'));var config=require(_0x2dbf('0x7'));var controller=require(_0x2dbf('0x8'));router[_0x2dbf('0x9')]('/',auth[_0x2dbf('0xa')](),controller[_0x2dbf('0xb')]);router[_0x2dbf('0x9')](_0x2dbf('0xc'),auth['isAuthenticated'](),controller[_0x2dbf('0xd')]);router[_0x2dbf('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2dbf('0xe')]);router[_0x2dbf('0xf')]('/',auth[_0x2dbf('0xa')](),controller[_0x2dbf('0x10')]);router[_0x2dbf('0x11')](_0x2dbf('0x12'),auth[_0x2dbf('0xa')](),controller[_0x2dbf('0x13')]);router['delete']('/:id',auth[_0x2dbf('0xa')](),controller['destroy']);module[_0x2dbf('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 743b63f..b568a36 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x2f3738,_0x115a52){var _0x3dfa2c=function(_0x91434d){while(--_0x91434d){_0x2f3738['push'](_0x2f3738['shift']());}};_0x3dfa2c(++_0x115a52);}(_0x34e8,0x12c));var _0x834e=function(_0x532b7f,_0x29140e){_0x532b7f=_0x532b7f-0x0;var _0x276b92=_0x34e8[_0x532b7f];return _0x276b92;};'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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4abd72,_0x51cbef){var _0x55bc37=function(_0x12ab3b){while(--_0x12ab3b){_0x4abd72['push'](_0x4abd72['shift']());}};_0x55bc37(++_0x51cbef);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0xf3cd[_0x35a274];return _0x40d905;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 56a3e7c..ee2277c 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 _0x4559=['bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','then','destroy','end','stack','name','send','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x15cf2a,_0x299a72){var _0x2adf88=function(_0x51770d){while(--_0x51770d){_0x15cf2a['push'](_0x15cf2a['shift']());}};_0x2adf88(++_0x299a72);}(_0x4559,0x1e4));var _0x9455=function(_0x5a3f92,_0x23e7df){_0x5a3f92=_0x5a3f92-0x0;var _0x467063=_0x4559[_0x5a3f92];return _0x467063;};'use strict';var emlformat=require(_0x9455('0x0'));var rimraf=require(_0x9455('0x1'));var zipdir=require(_0x9455('0x2'));var jsonpatch=require(_0x9455('0x3'));var rp=require(_0x9455('0x4'));var moment=require(_0x9455('0x5'));var BPromise=require(_0x9455('0x6'));var Mustache=require(_0x9455('0x7'));var util=require('util');var path=require(_0x9455('0x8'));var sox=require(_0x9455('0x9'));var csv=require(_0x9455('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9455('0xb'));var _=require('lodash');var squel=require(_0x9455('0xc'));var crypto=require(_0x9455('0xd'));var jsforce=require(_0x9455('0xe'));var deskjs=require(_0x9455('0xf'));var toCsv=require(_0x9455('0xa'));var querystring=require(_0x9455('0x10'));var Papa=require(_0x9455('0x11'));var Redis=require(_0x9455('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9455('0x13'));var logger=require('../../config/logger')(_0x9455('0x14'));var utils=require('../../config/utils');var config=require(_0x9455('0x15'));var licenseUtil=require(_0x9455('0x16'));var db=require(_0x9455('0x17'))['db'];function respondWithStatusCode(_0x1db671,_0x1c8a3f){_0x1c8a3f=_0x1c8a3f||0xcc;return function(_0x20dcc9){if(_0x20dcc9){return _0x1db671[_0x9455('0x18')](_0x1c8a3f);}return _0x1db671['status'](_0x1c8a3f)['end']();};}function respondWithResult(_0x56f849,_0x4be122){_0x4be122=_0x4be122||0xc8;return function(_0x2f70fc){if(_0x2f70fc){return _0x56f849[_0x9455('0x19')](_0x4be122)[_0x9455('0x1a')](_0x2f70fc);}};}function respondWithFilteredResult(_0x16836f,_0x47d6f6){return function(_0xe85638){if(_0xe85638){var _0xdcbffd=typeof _0x47d6f6[_0x9455('0x1b')]===_0x9455('0x1c')&&typeof _0x47d6f6[_0x9455('0x1d')]===_0x9455('0x1c');var _0x38b8ef=_0xe85638['count'];var _0x213772=_0xdcbffd?0x0:_0x47d6f6[_0x9455('0x1b')];var _0x32af50=_0xdcbffd?_0xe85638['count']:_0x47d6f6[_0x9455('0x1b')]+_0x47d6f6[_0x9455('0x1d')];var _0x1d646e;if(_0x32af50>=_0x38b8ef){_0x32af50=_0x38b8ef;_0x1d646e=0xc8;}else{_0x1d646e=0xce;}_0x16836f['status'](_0x1d646e);return _0x16836f[_0x9455('0x1e')]('Content-Range',_0x213772+'-'+_0x32af50+'/'+_0x38b8ef)['json'](_0xe85638);}return null;};}function patchUpdates(_0x1bbc9a){return function(_0x16da08){try{jsonpatch['apply'](_0x16da08,_0x1bbc9a,!![]);}catch(_0x2f2b65){return BPromise['reject'](_0x2f2b65);}return _0x16da08['save']();};}function saveUpdates(_0x25cf40,_0x443eda){return function(_0xb85026){if(_0xb85026){return _0xb85026['update'](_0x25cf40)[_0x9455('0x1f')](function(_0x47d1c5){return _0x47d1c5;});}return null;};}function removeEntity(_0x5994fe,_0x295b26){return function(_0x3cbee2){if(_0x3cbee2){return _0x3cbee2[_0x9455('0x20')]()['then'](function(){_0x5994fe[_0x9455('0x19')](0xcc)[_0x9455('0x21')]();});}};}function handleEntityNotFound(_0x1ec856,_0x56f570){return function(_0x2dabeb){if(!_0x2dabeb){_0x1ec856[_0x9455('0x18')](0x194);}return _0x2dabeb;};}function handleError(_0x2bd8cb,_0x56f2e0){_0x56f2e0=_0x56f2e0||0x1f4;return function(_0x4f0e98){logger['error'](_0x4f0e98[_0x9455('0x22')]);if(_0x4f0e98[_0x9455('0x23')]){delete _0x4f0e98[_0x9455('0x23')];}_0x2bd8cb[_0x9455('0x19')](_0x56f2e0)[_0x9455('0x24')](_0x4f0e98);};}exports['index']=function(_0x302280,_0x21d23a){var _0x5d8b67={},_0x25a08e={},_0x110f90={'count':0x0,'rows':[]};var _0x565c99=_['map'](db[_0x9455('0x25')][_0x9455('0x26')],function(_0x4a0cd8){return{'name':_0x4a0cd8[_0x9455('0x27')],'type':_0x4a0cd8[_0x9455('0x28')][_0x9455('0x29')]};});_0x25a08e[_0x9455('0x2a')]=_[_0x9455('0x2b')](_0x565c99,_0x9455('0x23'));_0x25a08e[_0x9455('0x2c')]=_[_0x9455('0x2d')](_0x302280[_0x9455('0x2c')]);_0x25a08e[_0x9455('0x2e')]=_[_0x9455('0x2f')](_0x25a08e[_0x9455('0x2a')],_0x25a08e['query']);_0x5d8b67[_0x9455('0x30')]=_['intersection'](_0x25a08e[_0x9455('0x2a')],qs[_0x9455('0x31')](_0x302280[_0x9455('0x2c')][_0x9455('0x31')]));_0x5d8b67['attributes']=_0x5d8b67['attributes']['length']?_0x5d8b67[_0x9455('0x30')]:_0x25a08e[_0x9455('0x2a')];if(!_0x302280['query'][_0x9455('0x32')]('nolimit')){_0x5d8b67['limit']=qs[_0x9455('0x1d')](_0x302280[_0x9455('0x2c')][_0x9455('0x1d')]);_0x5d8b67['offset']=qs[_0x9455('0x1b')](_0x302280['query']['offset']);}_0x5d8b67['order']=qs[_0x9455('0x33')](_0x302280['query'][_0x9455('0x33')]);_0x5d8b67[_0x9455('0x34')]=qs[_0x9455('0x2e')](_['pick'](_0x302280[_0x9455('0x2c')],_0x25a08e[_0x9455('0x2e')]),_0x565c99);if(_0x302280[_0x9455('0x2c')][_0x9455('0x35')]){_0x5d8b67[_0x9455('0x34')]=_['merge'](_0x5d8b67[_0x9455('0x34')],{'$or':_[_0x9455('0x2b')](_0x565c99,function(_0x487241){if(_0x487241['type']!==_0x9455('0x36')){var _0x39e548={};_0x39e548[_0x487241[_0x9455('0x23')]]={'$like':'%'+_0x302280['query'][_0x9455('0x35')]+'%'};return _0x39e548;}})});}_0x5d8b67=_[_0x9455('0x37')]({},_0x5d8b67,_0x302280[_0x9455('0x38')]);var _0x344faf={'where':_0x5d8b67[_0x9455('0x34')]};return db[_0x9455('0x25')][_0x9455('0x39')](_0x344faf)[_0x9455('0x1f')](function(_0x54e689){_0x110f90[_0x9455('0x39')]=_0x54e689;if(_0x302280[_0x9455('0x2c')][_0x9455('0x3a')]){_0x5d8b67[_0x9455('0x3b')]=[{'all':!![]}];}return db[_0x9455('0x25')][_0x9455('0x3c')](_0x5d8b67);})[_0x9455('0x1f')](function(_0x18a25f){_0x110f90[_0x9455('0x3d')]=_0x18a25f;return _0x110f90;})['then'](respondWithFilteredResult(_0x21d23a,_0x5d8b67))[_0x9455('0x3e')](handleError(_0x21d23a,null));};exports['show']=function(_0x29542d,_0x1bb175){var _0xc469a={'raw':!![],'where':{'id':_0x29542d[_0x9455('0x3f')]['id']}},_0x59626c={};_0x59626c[_0x9455('0x2a')]=_[_0x9455('0x2d')](db[_0x9455('0x25')][_0x9455('0x26')]);_0x59626c[_0x9455('0x2c')]=_[_0x9455('0x2d')](_0x29542d[_0x9455('0x2c')]);_0x59626c[_0x9455('0x2e')]=_[_0x9455('0x2f')](_0x59626c[_0x9455('0x2a')],_0x59626c[_0x9455('0x2c')]);_0xc469a[_0x9455('0x30')]=_[_0x9455('0x2f')](_0x59626c[_0x9455('0x2a')],qs[_0x9455('0x31')](_0x29542d[_0x9455('0x2c')][_0x9455('0x31')]));_0xc469a[_0x9455('0x30')]=_0xc469a[_0x9455('0x30')][_0x9455('0x40')]?_0xc469a[_0x9455('0x30')]:_0x59626c[_0x9455('0x2a')];if(_0x29542d[_0x9455('0x2c')][_0x9455('0x3a')]){_0xc469a[_0x9455('0x3b')]=[{'all':!![]}];}_0xc469a=_[_0x9455('0x37')]({},_0xc469a,_0x29542d[_0x9455('0x38')]);return db[_0x9455('0x25')][_0x9455('0x41')](_0xc469a)[_0x9455('0x1f')](handleEntityNotFound(_0x1bb175,null))[_0x9455('0x1f')](respondWithResult(_0x1bb175,null))[_0x9455('0x3e')](handleError(_0x1bb175,null));};exports[_0x9455('0x42')]=function(_0x30a8a6,_0x4af1a5){return db['MailTransferReport'][_0x9455('0x42')](_0x30a8a6[_0x9455('0x43')],{})[_0x9455('0x1f')](respondWithResult(_0x4af1a5,0xc9))['catch'](handleError(_0x4af1a5,null));};exports[_0x9455('0x44')]=function(_0x107775,_0x4fa26a){if(_0x107775[_0x9455('0x43')]['id']){delete _0x107775[_0x9455('0x43')]['id'];}return db[_0x9455('0x25')][_0x9455('0x41')]({'where':{'id':_0x107775[_0x9455('0x3f')]['id']}})[_0x9455('0x1f')](handleEntityNotFound(_0x4fa26a,null))[_0x9455('0x1f')](saveUpdates(_0x107775[_0x9455('0x43')],null))['then'](respondWithResult(_0x4fa26a,null))['catch'](handleError(_0x4fa26a,null));};exports[_0x9455('0x20')]=function(_0x201e1f,_0x35db2c){return db[_0x9455('0x25')][_0x9455('0x41')]({'where':{'id':_0x201e1f[_0x9455('0x3f')]['id']}})[_0x9455('0x1f')](handleEntityNotFound(_0x35db2c,null))[_0x9455('0x1f')](removeEntity(_0x35db2c,null))['catch'](handleError(_0x35db2c,null));};exports['describe']=function(_0x3aab4a,_0x34c975){return db['MailTransferReport'][_0x9455('0x45')]()[_0x9455('0x1f')](respondWithResult(_0x34c975,null))['catch'](handleError(_0x34c975,null));}; \ No newline at end of file +var _0xfa16=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','reject','save','then','destroy','error','stack','name','send','index','MailTransferReport','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','map','VIRTUAL','filter','includeAll','include','findAll','catch','show','keys','rawAttributes','find','create','body','update','params'];(function(_0x21468d,_0xfa02a6){var _0x137050=function(_0x4c4bf6){while(--_0x4c4bf6){_0x21468d['push'](_0x21468d['shift']());}};_0x137050(++_0xfa02a6);}(_0xfa16,0x11d));var _0x6fa1=function(_0x1ec9e1,_0x2c15d0){_0x1ec9e1=_0x1ec9e1-0x0;var _0x375531=_0xfa16[_0x1ec9e1];return _0x375531;};'use strict';var emlformat=require(_0x6fa1('0x0'));var rimraf=require(_0x6fa1('0x1'));var zipdir=require(_0x6fa1('0x2'));var jsonpatch=require(_0x6fa1('0x3'));var rp=require(_0x6fa1('0x4'));var moment=require(_0x6fa1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6fa1('0x6'));var path=require(_0x6fa1('0x7'));var sox=require('sox');var csv=require(_0x6fa1('0x8'));var ejs=require(_0x6fa1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6fa1('0xa'));var squel=require(_0x6fa1('0xb'));var crypto=require('crypto');var jsforce=require(_0x6fa1('0xc'));var deskjs=require(_0x6fa1('0xd'));var toCsv=require(_0x6fa1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6fa1('0xe'));var qs=require(_0x6fa1('0xf'));var as=require(_0x6fa1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fa1('0x11'))(_0x6fa1('0x12'));var utils=require(_0x6fa1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6fa1('0x14'));var db=require(_0x6fa1('0x15'))['db'];function respondWithStatusCode(_0x10cb28,_0x57df63){_0x57df63=_0x57df63||0xcc;return function(_0x5d2943){if(_0x5d2943){return _0x10cb28[_0x6fa1('0x16')](_0x57df63);}return _0x10cb28[_0x6fa1('0x17')](_0x57df63)[_0x6fa1('0x18')]();};}function respondWithResult(_0x3812fd,_0x4b008c){_0x4b008c=_0x4b008c||0xc8;return function(_0x577998){if(_0x577998){return _0x3812fd[_0x6fa1('0x17')](_0x4b008c)[_0x6fa1('0x19')](_0x577998);}};}function respondWithFilteredResult(_0x219f58,_0x6a8ecc){return function(_0x5ac3e4){if(_0x5ac3e4){var _0x5e67f0=typeof _0x6a8ecc['offset']===_0x6fa1('0x1a')&&typeof _0x6a8ecc['limit']===_0x6fa1('0x1a');var _0x4945d9=_0x5ac3e4[_0x6fa1('0x1b')];var _0x175ece=_0x5e67f0?0x0:_0x6a8ecc[_0x6fa1('0x1c')];var _0x2b63eb=_0x5e67f0?_0x5ac3e4[_0x6fa1('0x1b')]:_0x6a8ecc['offset']+_0x6a8ecc['limit'];var _0x2a740e;if(_0x2b63eb>=_0x4945d9){_0x2b63eb=_0x4945d9;_0x2a740e=0xc8;}else{_0x2a740e=0xce;}_0x219f58['status'](_0x2a740e);return _0x219f58['set'](_0x6fa1('0x1d'),_0x175ece+'-'+_0x2b63eb+'/'+_0x4945d9)[_0x6fa1('0x19')](_0x5ac3e4);}return null;};}function patchUpdates(_0xbfd984){return function(_0x49c7d8){try{jsonpatch['apply'](_0x49c7d8,_0xbfd984,!![]);}catch(_0x539c5c){return BPromise[_0x6fa1('0x1e')](_0x539c5c);}return _0x49c7d8[_0x6fa1('0x1f')]();};}function saveUpdates(_0x279012,_0x15b41a){return function(_0x2228b0){if(_0x2228b0){return _0x2228b0['update'](_0x279012)[_0x6fa1('0x20')](function(_0x5d891f){return _0x5d891f;});}return null;};}function removeEntity(_0x22a13e,_0x37bc21){return function(_0x5ad9f5){if(_0x5ad9f5){return _0x5ad9f5[_0x6fa1('0x21')]()['then'](function(){_0x22a13e[_0x6fa1('0x17')](0xcc)[_0x6fa1('0x18')]();});}};}function handleEntityNotFound(_0x4664ea,_0x52c43e){return function(_0x47f70c){if(!_0x47f70c){_0x4664ea[_0x6fa1('0x16')](0x194);}return _0x47f70c;};}function handleError(_0x2bf662,_0x275dfe){_0x275dfe=_0x275dfe||0x1f4;return function(_0x22cc7f){logger[_0x6fa1('0x22')](_0x22cc7f[_0x6fa1('0x23')]);if(_0x22cc7f[_0x6fa1('0x24')]){delete _0x22cc7f[_0x6fa1('0x24')];}_0x2bf662[_0x6fa1('0x17')](_0x275dfe)[_0x6fa1('0x25')](_0x22cc7f);};}exports[_0x6fa1('0x26')]=function(_0x4ccd9b,_0x45ed58){var _0x34f1f2={},_0x537182={},_0x1d3bd9={'count':0x0,'rows':[]};var _0xdfb2b5=_['map'](db[_0x6fa1('0x27')]['rawAttributes'],function(_0x594f1b){return{'name':_0x594f1b['fieldName'],'type':_0x594f1b['type'][_0x6fa1('0x28')]};});_0x537182[_0x6fa1('0x29')]=_['map'](_0xdfb2b5,_0x6fa1('0x24'));_0x537182[_0x6fa1('0x2a')]=_['keys'](_0x4ccd9b[_0x6fa1('0x2a')]);_0x537182[_0x6fa1('0x2b')]=_[_0x6fa1('0x2c')](_0x537182[_0x6fa1('0x29')],_0x537182[_0x6fa1('0x2a')]);_0x34f1f2[_0x6fa1('0x2d')]=_[_0x6fa1('0x2c')](_0x537182[_0x6fa1('0x29')],qs[_0x6fa1('0x2e')](_0x4ccd9b['query'][_0x6fa1('0x2e')]));_0x34f1f2[_0x6fa1('0x2d')]=_0x34f1f2[_0x6fa1('0x2d')][_0x6fa1('0x2f')]?_0x34f1f2[_0x6fa1('0x2d')]:_0x537182['model'];if(!_0x4ccd9b[_0x6fa1('0x2a')][_0x6fa1('0x30')](_0x6fa1('0x31'))){_0x34f1f2[_0x6fa1('0x32')]=qs['limit'](_0x4ccd9b['query'][_0x6fa1('0x32')]);_0x34f1f2[_0x6fa1('0x1c')]=qs['offset'](_0x4ccd9b[_0x6fa1('0x2a')]['offset']);}_0x34f1f2[_0x6fa1('0x33')]=qs[_0x6fa1('0x34')](_0x4ccd9b[_0x6fa1('0x2a')]['sort']);_0x34f1f2['where']=qs[_0x6fa1('0x2b')](_['pick'](_0x4ccd9b['query'],_0x537182[_0x6fa1('0x2b')]),_0xdfb2b5);if(_0x4ccd9b[_0x6fa1('0x2a')]['filter']){_0x34f1f2[_0x6fa1('0x35')]=_[_0x6fa1('0x36')](_0x34f1f2['where'],{'$or':_[_0x6fa1('0x37')](_0xdfb2b5,function(_0x230526){if(_0x230526['type']!==_0x6fa1('0x38')){var _0x247670={};_0x247670[_0x230526[_0x6fa1('0x24')]]={'$like':'%'+_0x4ccd9b[_0x6fa1('0x2a')][_0x6fa1('0x39')]+'%'};return _0x247670;}})});}_0x34f1f2=_[_0x6fa1('0x36')]({},_0x34f1f2,_0x4ccd9b['options']);var _0x3e2291={'where':_0x34f1f2[_0x6fa1('0x35')]};return db[_0x6fa1('0x27')][_0x6fa1('0x1b')](_0x3e2291)[_0x6fa1('0x20')](function(_0x4661ff){_0x1d3bd9['count']=_0x4661ff;if(_0x4ccd9b[_0x6fa1('0x2a')][_0x6fa1('0x3a')]){_0x34f1f2[_0x6fa1('0x3b')]=[{'all':!![]}];}return db[_0x6fa1('0x27')][_0x6fa1('0x3c')](_0x34f1f2);})['then'](function(_0xdc5225){_0x1d3bd9['rows']=_0xdc5225;return _0x1d3bd9;})['then'](respondWithFilteredResult(_0x45ed58,_0x34f1f2))[_0x6fa1('0x3d')](handleError(_0x45ed58,null));};exports[_0x6fa1('0x3e')]=function(_0x54a207,_0x31d1a0){var _0xd31ee={'raw':!![],'where':{'id':_0x54a207['params']['id']}},_0x291b6a={};_0x291b6a[_0x6fa1('0x29')]=_[_0x6fa1('0x3f')](db[_0x6fa1('0x27')][_0x6fa1('0x40')]);_0x291b6a[_0x6fa1('0x2a')]=_[_0x6fa1('0x3f')](_0x54a207[_0x6fa1('0x2a')]);_0x291b6a[_0x6fa1('0x2b')]=_[_0x6fa1('0x2c')](_0x291b6a[_0x6fa1('0x29')],_0x291b6a[_0x6fa1('0x2a')]);_0xd31ee[_0x6fa1('0x2d')]=_[_0x6fa1('0x2c')](_0x291b6a[_0x6fa1('0x29')],qs[_0x6fa1('0x2e')](_0x54a207['query']['fields']));_0xd31ee['attributes']=_0xd31ee[_0x6fa1('0x2d')][_0x6fa1('0x2f')]?_0xd31ee['attributes']:_0x291b6a[_0x6fa1('0x29')];if(_0x54a207['query'][_0x6fa1('0x3a')]){_0xd31ee[_0x6fa1('0x3b')]=[{'all':!![]}];}_0xd31ee=_[_0x6fa1('0x36')]({},_0xd31ee,_0x54a207['options']);return db[_0x6fa1('0x27')][_0x6fa1('0x41')](_0xd31ee)[_0x6fa1('0x20')](handleEntityNotFound(_0x31d1a0,null))[_0x6fa1('0x20')](respondWithResult(_0x31d1a0,null))[_0x6fa1('0x3d')](handleError(_0x31d1a0,null));};exports[_0x6fa1('0x42')]=function(_0x202599,_0x3e9440){return db[_0x6fa1('0x27')][_0x6fa1('0x42')](_0x202599[_0x6fa1('0x43')],{})[_0x6fa1('0x20')](respondWithResult(_0x3e9440,0xc9))[_0x6fa1('0x3d')](handleError(_0x3e9440,null));};exports[_0x6fa1('0x44')]=function(_0x3d5857,_0x2fb613){if(_0x3d5857['body']['id']){delete _0x3d5857['body']['id'];}return db[_0x6fa1('0x27')][_0x6fa1('0x41')]({'where':{'id':_0x3d5857[_0x6fa1('0x45')]['id']}})[_0x6fa1('0x20')](handleEntityNotFound(_0x2fb613,null))[_0x6fa1('0x20')](saveUpdates(_0x3d5857[_0x6fa1('0x43')],null))[_0x6fa1('0x20')](respondWithResult(_0x2fb613,null))['catch'](handleError(_0x2fb613,null));};exports[_0x6fa1('0x21')]=function(_0x3b6b8b,_0x2e7a58){return db[_0x6fa1('0x27')]['find']({'where':{'id':_0x3b6b8b['params']['id']}})[_0x6fa1('0x20')](handleEntityNotFound(_0x2e7a58,null))['then'](removeEntity(_0x2e7a58,null))[_0x6fa1('0x3d')](handleError(_0x2e7a58,null));};exports[_0x6fa1('0x46')]=function(_0x475187,_0x30f33c){return db['MailTransferReport'][_0x6fa1('0x46')]()['then'](respondWithResult(_0x30f33c,null))['catch'](handleError(_0x30f33c,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9aecdce..1d3c073 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 _0x9ade=['util','moment','request-promise','path','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x49e455,_0x2656e3){var _0x17d8b3=function(_0x11394c){while(--_0x11394c){_0x49e455['push'](_0x49e455['shift']());}};_0x17d8b3(++_0x2656e3);}(_0x9ade,0x107));var _0xe9ad=function(_0x348021,_0x24fc80){_0x348021=_0x348021-0x0;var _0x426682=_0x9ade[_0x348021];return _0x426682;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe9ad('0x2'));var BPromise=require('bluebird');var rp=require(_0xe9ad('0x3'));var fs=require('fs');var path=require(_0xe9ad('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe9ad('0x5'));module[_0xe9ad('0x6')]=function(_0xdd1549,_0x3e4092){return _0xdd1549[_0xe9ad('0x7')](_0xe9ad('0x8'),attributes,{'tableName':_0xe9ad('0x9'),'paranoid':![],'indexes':[{'name':_0xe9ad('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5df9=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x17b22c,_0x4b6ca2){var _0x197557=function(_0x396505){while(--_0x396505){_0x17b22c['push'](_0x17b22c['shift']());}};_0x197557(++_0x4b6ca2);}(_0x5df9,0xea));var _0x95df=function(_0x4e518,_0x2b7bdb){_0x4e518=_0x4e518-0x0;var _0xc2b47b=_0x5df9[_0x4e518];return _0xc2b47b;};'use strict';var _=require('lodash');var util=require(_0x95df('0x0'));var logger=require(_0x95df('0x1'))(_0x95df('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x95df('0x3'));var fs=require('fs');var path=require(_0x95df('0x4'));var rimraf=require('rimraf');var config=require(_0x95df('0x5'));var attributes=require(_0x95df('0x6'));module[_0x95df('0x7')]=function(_0x2658ce,_0x49414f){return _0x2658ce[_0x95df('0x8')](_0x95df('0x9'),attributes,{'tableName':_0x95df('0xa'),'paranoid':![],'indexes':[{'name':_0x95df('0xb'),'fields':[_0x95df('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index e3f47f5..22f69a9 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 _0xba8b=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4ce632,_0x53f8aa){var _0x211ab0=function(_0x19f360){while(--_0x19f360){_0x4ce632['push'](_0x4ce632['shift']());}};_0x211ab0(++_0x53f8aa);}(_0xba8b,0x173));var _0xbba8=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xba8b[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xbba8('0x0'));var util=require(_0xbba8('0x1'));var moment=require(_0xbba8('0x2'));var BPromise=require(_0xbba8('0x3'));var rs=require(_0xbba8('0x4'));var fs=require('fs');var Redis=require(_0xbba8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbba8('0x6'));var logger=require('../../config/logger')(_0xbba8('0x7'));var config=require(_0xbba8('0x8'));var jayson=require(_0xbba8('0x9'));var client=jayson[_0xbba8('0xa')][_0xbba8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a96b8,_0x5f1b1e,_0x4a8998){return new BPromise(function(_0x265dab,_0x4341c8){return client['request'](_0x1a96b8,_0x4a8998)[_0xbba8('0xc')](function(_0xdaf01a){logger[_0xbba8('0xd')](_0xbba8('0xe'),_0x5f1b1e,_0xbba8('0xf'));logger['debug'](_0xbba8('0x10'),_0x5f1b1e,_0xbba8('0xf'),JSON[_0xbba8('0x11')](_0xdaf01a));if(_0xdaf01a['error']){if(_0xdaf01a[_0xbba8('0x12')][_0xbba8('0x13')]===0x1f4){logger[_0xbba8('0x12')](_0xbba8('0xe'),_0x5f1b1e,_0xdaf01a[_0xbba8('0x12')]['message']);return _0x4341c8(_0xdaf01a[_0xbba8('0x12')]['message']);}logger['error'](_0xbba8('0xe'),_0x5f1b1e,_0xdaf01a[_0xbba8('0x12')][_0xbba8('0x14')]);return _0x265dab(_0xdaf01a[_0xbba8('0x12')]['message']);}else{logger[_0xbba8('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x5f1b1e,'request\x20sent');_0x265dab(_0xdaf01a['result']['message']);}})[_0xbba8('0x15')](function(_0x2ae25b){logger['error'](_0xbba8('0xe'),_0x5f1b1e,_0x2ae25b);_0x4341c8(_0x2ae25b);});});} \ No newline at end of file +var _0xf23e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xb3debb,_0x3fbece){var _0x38df7f=function(_0x5e386c){while(--_0x5e386c){_0xb3debb['push'](_0xb3debb['shift']());}};_0x38df7f(++_0x3fbece);}(_0xf23e,0xd2));var _0xef23=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xf23e[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0xef23('0x0'));var util=require(_0xef23('0x1'));var moment=require('moment');var BPromise=require(_0xef23('0x2'));var rs=require(_0xef23('0x3'));var fs=require('fs');var Redis=require(_0xef23('0x4'));var db=require(_0xef23('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xef23('0x6'));var config=require(_0xef23('0x7'));var jayson=require(_0xef23('0x8'));var client=jayson[_0xef23('0x9')][_0xef23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30d648,_0x4c785d,_0x562f97){return new BPromise(function(_0x24d9b5,_0x482acb){return client[_0xef23('0xb')](_0x30d648,_0x562f97)[_0xef23('0xc')](function(_0x459af1){logger[_0xef23('0xd')](_0xef23('0xe'),_0x4c785d,_0xef23('0xf'));logger[_0xef23('0x10')](_0xef23('0x11'),_0x4c785d,'request\x20sent',JSON[_0xef23('0x12')](_0x459af1));if(_0x459af1[_0xef23('0x13')]){if(_0x459af1['error'][_0xef23('0x14')]===0x1f4){logger[_0xef23('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x4c785d,_0x459af1[_0xef23('0x13')]['message']);return _0x482acb(_0x459af1['error']['message']);}logger[_0xef23('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x4c785d,_0x459af1[_0xef23('0x13')][_0xef23('0x15')]);return _0x24d9b5(_0x459af1[_0xef23('0x13')][_0xef23('0x15')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x4c785d,'request\x20sent');_0x24d9b5(_0x459af1[_0xef23('0x16')][_0xef23('0x15')]);}})[_0xef23('0x17')](function(_0x12ca40){logger[_0xef23('0x13')](_0xef23('0xe'),_0x4c785d,_0x12ca40);_0x482acb(_0x12ca40);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index c985b9f..ee0268e 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 _0x3254=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x2e9f00,_0x5bb3f8){var _0x1c9f52=function(_0x19f523){while(--_0x19f523){_0x2e9f00['push'](_0x2e9f00['shift']());}};_0x1c9f52(++_0x5bb3f8);}(_0x3254,0x79));var _0x4325=function(_0x20f7d9,_0x4d424e){_0x20f7d9=_0x20f7d9-0x0;var _0x3ad64b=_0x3254[_0x20f7d9];return _0x3ad64b;};'use strict';var multer=require(_0x4325('0x0'));var util=require(_0x4325('0x1'));var path=require(_0x4325('0x2'));var timeout=require('connect-timeout');var express=require(_0x4325('0x3'));var router=express[_0x4325('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4325('0x5'));var interaction=require(_0x4325('0x6'));var config=require(_0x4325('0x7'));var controller=require(_0x4325('0x8'));router[_0x4325('0x9')]('/',auth[_0x4325('0xa')](),controller[_0x4325('0xb')]);router[_0x4325('0x9')](_0x4325('0xc'),auth[_0x4325('0xa')](),controller[_0x4325('0xd')]);router[_0x4325('0x9')](_0x4325('0xe'),auth[_0x4325('0xa')](),controller[_0x4325('0xf')]);router[_0x4325('0x10')]('/',auth[_0x4325('0xa')](),controller[_0x4325('0x11')]);router[_0x4325('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4325('0x13')]);router[_0x4325('0x14')](_0x4325('0xe'),auth[_0x4325('0xa')](),controller[_0x4325('0x15')]);module[_0x4325('0x16')]=router; \ No newline at end of file +var _0xe56c=['../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x563e99,_0x181622){var _0x196311=function(_0x2d7dac){while(--_0x2d7dac){_0x563e99['push'](_0x563e99['shift']());}};_0x196311(++_0x181622);}(_0xe56c,0xca));var _0xce56=function(_0x475d21,_0x5f02ae){_0x475d21=_0x475d21-0x0;var _0x2c7534=_0xe56c[_0x475d21];return _0x2c7534;};'use strict';var multer=require('multer');var util=require(_0xce56('0x0'));var path=require(_0xce56('0x1'));var timeout=require(_0xce56('0x2'));var express=require('express');var router=express[_0xce56('0x3')]();var fs_extra=require(_0xce56('0x4'));var auth=require(_0xce56('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xce56('0x6'));var controller=require('./memberReport.controller');router[_0xce56('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xce56('0x8')](),controller[_0xce56('0x9')]);router[_0xce56('0x7')](_0xce56('0xa'),auth[_0xce56('0x8')](),controller[_0xce56('0xb')]);router[_0xce56('0xc')]('/',auth[_0xce56('0x8')](),controller[_0xce56('0xd')]);router['put'](_0xce56('0xa'),auth['isAuthenticated'](),controller[_0xce56('0xe')]);router['delete'](_0xce56('0xa'),auth[_0xce56('0x8')](),controller['destroy']);module[_0xce56('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 38fa1c8..cc7535c 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 _0x62bf=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','exitAt','setDataValue'];(function(_0x504cea,_0x421102){var _0x18cdba=function(_0x1fc7d0){while(--_0x1fc7d0){_0x504cea['push'](_0x504cea['shift']());}};_0x18cdba(++_0x421102);}(_0x62bf,0x14a));var _0xf62b=function(_0x436f33,_0xd8282e){_0x436f33=_0x436f33-0x0;var _0x380393=_0x62bf[_0x436f33];return _0x380393;};'use strict';var Sequelize=require(_0xf62b('0x0'));var moment=require(_0xf62b('0x1'));module[_0xf62b('0x2')]={'channel':{'type':Sequelize[_0xf62b('0x3')]},'membername':{'type':Sequelize[_0xf62b('0x3')]},'interface':{'type':Sequelize[_0xf62b('0x3')]},'type':{'type':Sequelize[_0xf62b('0x3')],'defaultValue':_0xf62b('0x4'),'comment':_0xf62b('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xf62b('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1c778e){var _0x2700f8=moment(_0x1c778e);var _0x26f7a8=moment(this[_0xf62b('0x7')](_0xf62b('0x8')));var _0xa9f403=_0x2700f8[_0xf62b('0x9')](_0x26f7a8,'seconds');this['setDataValue'](_0xf62b('0xa'),_0x1c778e);this[_0xf62b('0xb')](_0xf62b('0xc'),_0xa9f403>=0x0?_0xa9f403:null);}},'data1':{'type':Sequelize[_0xf62b('0x3')],'comment':_0xf62b('0xd')},'data2':{'type':Sequelize[_0xf62b('0x3')],'comment':_0xf62b('0xe')},'data3':{'type':Sequelize[_0xf62b('0x3')],'comment':_0xf62b('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0xf62b('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0xf62b('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xf62b('0x12')]},'uniqueid':{'type':Sequelize[_0xf62b('0x3')]}}; \ No newline at end of file +var _0x6055=['seconds','setDataValue','exitAt','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff'];(function(_0x41930d,_0x478ed3){var _0x455ade=function(_0x24cb07){while(--_0x24cb07){_0x41930d['push'](_0x41930d['shift']());}};_0x455ade(++_0x478ed3);}(_0x6055,0x9b));var _0x5605=function(_0x255b6c,_0x44c7f4){_0x255b6c=_0x255b6c-0x0;var _0x21b107=_0x6055[_0x255b6c];return _0x21b107;};'use strict';var Sequelize=require(_0x5605('0x0'));var moment=require(_0x5605('0x1'));module[_0x5605('0x2')]={'channel':{'type':Sequelize[_0x5605('0x3')]},'membername':{'type':Sequelize[_0x5605('0x3')]},'interface':{'type':Sequelize[_0x5605('0x3')]},'type':{'type':Sequelize[_0x5605('0x3')],'defaultValue':_0x5605('0x4'),'comment':_0x5605('0x5')},'duration':{'type':Sequelize[_0x5605('0x6')]},'enterAt':{'type':Sequelize[_0x5605('0x7')]},'exitAt':{'type':Sequelize[_0x5605('0x7')],'set':function(_0x23f63d){var _0x82aa72=moment(_0x23f63d);var _0x3a8d2c=moment(this['getDataValue'](_0x5605('0x8')));var _0x56424e=_0x82aa72[_0x5605('0x9')](_0x3a8d2c,_0x5605('0xa'));this[_0x5605('0xb')](_0x5605('0xc'),_0x23f63d);this[_0x5605('0xb')]('duration',_0x56424e>=0x0?_0x56424e:null);}},'data1':{'type':Sequelize[_0x5605('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x5605('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x5605('0x3')],'comment':_0x5605('0xd')},'data4':{'type':Sequelize[_0x5605('0x3')],'comment':_0x5605('0xe')},'data5':{'type':Sequelize[_0x5605('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x5605('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 28eff50..01e2b3b 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x34e8,0x12c));var _0x834e=function(_0x4e726f,_0x21e8cb){_0x4e726f=_0x4e726f-0x0;var _0x28ad49=_0x34e8[_0x4e726f];return _0x28ad49;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _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(_0x222c59,_0x40783f){var _0x1b9ee3=function(_0x3d7100){while(--_0x3d7100){_0x222c59['push'](_0x222c59['shift']());}};_0x1b9ee3(++_0x40783f);}(_0x008c,0x188));var _0xc008=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x008c[_0x17406e];return _0x2bfc5a;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 3444a57..a7377d2 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 _0xc164=['rimraf','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5832ad,_0x4a4251){var _0x468b42=function(_0x645688){while(--_0x645688){_0x5832ad['push'](_0x5832ad['shift']());}};_0x468b42(++_0x4a4251);}(_0xc164,0x18e));var _0x4c16=function(_0x539082,_0x1e8ef9){_0x539082=_0x539082-0x0;var _0x356bc6=_0xc164[_0x539082];return _0x356bc6;};'use strict';var _=require('lodash');var util=require(_0x4c16('0x0'));var logger=require(_0x4c16('0x1'))(_0x4c16('0x2'));var moment=require(_0x4c16('0x3'));var BPromise=require(_0x4c16('0x4'));var rp=require(_0x4c16('0x5'));var fs=require('fs');var path=require(_0x4c16('0x6'));var rimraf=require(_0x4c16('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c16('0x8'));module[_0x4c16('0x9')]=function(_0x37810f,_0x45bcd5){return _0x37810f[_0x4c16('0xa')]('MemberReport',attributes,{'tableName':_0x4c16('0xb'),'paranoid':![],'indexes':[{'name':_0x4c16('0xc'),'fields':[_0x4c16('0xd'),_0x4c16('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9652=['interface','lodash','../../config/logger','moment','bluebird','../../config/environment','./memberReport.attributes','define','report_member','membername_interface','membername'];(function(_0xfc282f,_0x10295d){var _0x38f8bf=function(_0x59dcea){while(--_0x59dcea){_0xfc282f['push'](_0xfc282f['shift']());}};_0x38f8bf(++_0x10295d);}(_0x9652,0x198));var _0x2965=function(_0x59be39,_0x38558d){_0x59be39=_0x59be39-0x0;var _0x136795=_0x9652[_0x59be39];return _0x136795;};'use strict';var _=require(_0x2965('0x0'));var util=require('util');var logger=require(_0x2965('0x1'))('api');var moment=require(_0x2965('0x2'));var BPromise=require(_0x2965('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2965('0x4'));var attributes=require(_0x2965('0x5'));module['exports']=function(_0x59022e,_0x31c36d){return _0x59022e[_0x2965('0x6')]('MemberReport',attributes,{'tableName':_0x2965('0x7'),'paranoid':![],'indexes':[{'name':_0x2965('0x8'),'fields':[_0x2965('0x9'),_0x2965('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 75e2527..1194e59 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 _0x4c60=['message','info','catch','GetMemberReport','MemberReport','findAll','options','attributes','limit','map','include','model','create','raw','CreateMemberReport','UpdateMemberReport','update','body','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4c60,0xc1));var _0x04c6=function(_0x23f929,_0x2f68dc){_0x23f929=_0x23f929-0x0;var _0x314cd9=_0x4c60[_0x23f929];return _0x314cd9;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('MemberReport,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});}exports[_0x04c6('0x14')]=function(_0x21674a){var _0x423ea9=this;return new Promise(function(_0x47f400,_0x142065){return db[_0x04c6('0x15')][_0x04c6('0x16')]({'raw':_0x21674a['options']?_0x21674a['options']['raw']===undefined?!![]:![]:!![],'where':_0x21674a[_0x04c6('0x17')]?_0x21674a[_0x04c6('0x17')]['where']||null:null,'attributes':_0x21674a['options']?_0x21674a[_0x04c6('0x17')][_0x04c6('0x18')]||null:null,'limit':_0x21674a[_0x04c6('0x17')]?_0x21674a['options'][_0x04c6('0x19')]||null:null,'include':_0x21674a[_0x04c6('0x17')]?_0x21674a[_0x04c6('0x17')]['include']?_[_0x04c6('0x1a')](_0x21674a[_0x04c6('0x17')]['include'],function(_0x54a8b0){return{'model':db[_0x54a8b0['model']],'as':_0x54a8b0['as'],'attributes':_0x54a8b0[_0x04c6('0x18')],'include':_0x54a8b0[_0x04c6('0x1b')]?_[_0x04c6('0x1a')](_0x54a8b0[_0x04c6('0x1b')],function(_0x3e1328){return{'model':db[_0x3e1328['model']],'as':_0x3e1328['as'],'attributes':_0x3e1328['attributes'],'include':_0x3e1328[_0x04c6('0x1b')]?_[_0x04c6('0x1a')](_0x3e1328[_0x04c6('0x1b')],function(_0x3233d7){return{'model':db[_0x3233d7[_0x04c6('0x1c')]],'as':_0x3233d7['as'],'attributes':_0x3233d7[_0x04c6('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d0d3f){logger[_0x04c6('0x12')]('GetMemberReport',_0x21674a);logger[_0x04c6('0xb')](_0x04c6('0x14'),_0x21674a,JSON['stringify'](_0x1d0d3f));_0x47f400(_0x1d0d3f);})['catch'](function(_0x115d84){logger[_0x04c6('0xe')](_0x04c6('0x14'),_0x115d84[_0x04c6('0x11')],_0x21674a);_0x142065(_0x423ea9[_0x04c6('0xe')](0x1f4,_0x115d84[_0x04c6('0x11')]));});});};exports['CreateMemberReport']=function(_0x5d8c88){var _0x4fd842=this;return new Promise(function(_0x375a03,_0x5241b5){return db[_0x04c6('0x15')][_0x04c6('0x1d')](_0x5d8c88['body'],{'raw':_0x5d8c88[_0x04c6('0x17')]?_0x5d8c88[_0x04c6('0x17')][_0x04c6('0x1e')]===undefined?!![]:![]:!![]})[_0x04c6('0xa')](function(_0x5b2056){logger[_0x04c6('0x12')](_0x04c6('0x1f'),_0x5d8c88);logger[_0x04c6('0xb')](_0x04c6('0x1f'),_0x5d8c88,JSON[_0x04c6('0xd')](_0x5b2056));_0x375a03(_0x5b2056);})[_0x04c6('0x13')](function(_0x3e59b2){logger[_0x04c6('0xe')](_0x04c6('0x1f'),_0x3e59b2[_0x04c6('0x11')],_0x5d8c88);_0x5241b5(_0x4fd842[_0x04c6('0xe')](0x1f4,_0x3e59b2[_0x04c6('0x11')]));});});};exports[_0x04c6('0x20')]=function(_0x3d56ea){var _0x209f88=this;return new Promise(function(_0x5bb584,_0x5cc26c){return db[_0x04c6('0x15')][_0x04c6('0x21')](_0x3d56ea[_0x04c6('0x22')],{'raw':_0x3d56ea['options']?_0x3d56ea[_0x04c6('0x17')][_0x04c6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d56ea['options']?_0x3d56ea['options']['where']||null:null,'attributes':_0x3d56ea[_0x04c6('0x17')]?_0x3d56ea[_0x04c6('0x17')]['attributes']||null:null,'limit':_0x3d56ea[_0x04c6('0x17')]?_0x3d56ea['options'][_0x04c6('0x19')]||null:null})[_0x04c6('0xa')](function(_0x3806ea){logger[_0x04c6('0x12')]('UpdateMemberReport',_0x3d56ea);logger['debug'](_0x04c6('0x20'),_0x3d56ea,JSON[_0x04c6('0xd')](_0x3806ea));_0x5bb584(_0x3806ea);})['catch'](function(_0x3f4fad){logger['error']('UpdateMemberReport',_0x3f4fad[_0x04c6('0x11')],_0x3d56ea);_0x5cc26c(_0x209f88['error'](0x1f4,_0x3f4fad[_0x04c6('0x11')]));});});}; \ No newline at end of file +var _0x75a2=['info','result','catch','GetMemberReport','MemberReport','options','where','limit','map','include','model','attributes','CreateMemberReport','body','raw','update','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','then','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message'];(function(_0x20dcb3,_0x2e2d7d){var _0x27aaf2=function(_0x3db99b){while(--_0x3db99b){_0x20dcb3['push'](_0x20dcb3['shift']());}};_0x27aaf2(++_0x2e2d7d);}(_0x75a2,0x187));var _0x275a=function(_0x1d9e9f,_0x506592){_0x1d9e9f=_0x1d9e9f-0x0;var _0x2329f6=_0x75a2[_0x1d9e9f];return _0x2329f6;};'use strict';var _=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var moment=require(_0x275a('0x2'));var BPromise=require('bluebird');var rs=require(_0x275a('0x3'));var fs=require('fs');var Redis=require(_0x275a('0x4'));var db=require(_0x275a('0x5'))['db'];var utils=require(_0x275a('0x6'));var logger=require('../../config/logger')(_0x275a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32f0cb,_0x12cad9,_0x17ad5e){return new BPromise(function(_0x38b303,_0x525950){return client['request'](_0x32f0cb,_0x17ad5e)[_0x275a('0x8')](function(_0x46f9c7){logger['info']('MemberReport,\x20%s,\x20%s',_0x12cad9,'request\x20sent');logger[_0x275a('0x9')](_0x275a('0xa'),_0x12cad9,_0x275a('0xb'),JSON[_0x275a('0xc')](_0x46f9c7));if(_0x46f9c7[_0x275a('0xd')]){if(_0x46f9c7[_0x275a('0xd')][_0x275a('0xe')]===0x1f4){logger[_0x275a('0xd')](_0x275a('0xf'),_0x12cad9,_0x46f9c7[_0x275a('0xd')][_0x275a('0x10')]);return _0x525950(_0x46f9c7['error'][_0x275a('0x10')]);}logger[_0x275a('0xd')]('MemberReport,\x20%s,\x20%s',_0x12cad9,_0x46f9c7['error'][_0x275a('0x10')]);return _0x38b303(_0x46f9c7[_0x275a('0xd')][_0x275a('0x10')]);}else{logger[_0x275a('0x11')](_0x275a('0xf'),_0x12cad9,_0x275a('0xb'));_0x38b303(_0x46f9c7[_0x275a('0x12')][_0x275a('0x10')]);}})[_0x275a('0x13')](function(_0x58e54d){logger['error'](_0x275a('0xf'),_0x12cad9,_0x58e54d);_0x525950(_0x58e54d);});});}exports[_0x275a('0x14')]=function(_0x50374a){var _0x127da5=this;return new Promise(function(_0x59d755,_0x35b47b){return db[_0x275a('0x15')]['findAll']({'raw':_0x50374a[_0x275a('0x16')]?_0x50374a[_0x275a('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x50374a['options']?_0x50374a[_0x275a('0x16')][_0x275a('0x17')]||null:null,'attributes':_0x50374a['options']?_0x50374a['options']['attributes']||null:null,'limit':_0x50374a[_0x275a('0x16')]?_0x50374a[_0x275a('0x16')][_0x275a('0x18')]||null:null,'include':_0x50374a[_0x275a('0x16')]?_0x50374a[_0x275a('0x16')]['include']?_[_0x275a('0x19')](_0x50374a[_0x275a('0x16')][_0x275a('0x1a')],function(_0x21a0ee){return{'model':db[_0x21a0ee[_0x275a('0x1b')]],'as':_0x21a0ee['as'],'attributes':_0x21a0ee['attributes'],'include':_0x21a0ee[_0x275a('0x1a')]?_[_0x275a('0x19')](_0x21a0ee[_0x275a('0x1a')],function(_0x1441c3){return{'model':db[_0x1441c3[_0x275a('0x1b')]],'as':_0x1441c3['as'],'attributes':_0x1441c3[_0x275a('0x1c')],'include':_0x1441c3[_0x275a('0x1a')]?_[_0x275a('0x19')](_0x1441c3[_0x275a('0x1a')],function(_0x3ad063){return{'model':db[_0x3ad063['model']],'as':_0x3ad063['as'],'attributes':_0x3ad063[_0x275a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x275a('0x8')](function(_0x57c10b){logger[_0x275a('0x11')](_0x275a('0x14'),_0x50374a);logger[_0x275a('0x9')](_0x275a('0x14'),_0x50374a,JSON['stringify'](_0x57c10b));_0x59d755(_0x57c10b);})[_0x275a('0x13')](function(_0x440157){logger[_0x275a('0xd')](_0x275a('0x14'),_0x440157[_0x275a('0x10')],_0x50374a);_0x35b47b(_0x127da5[_0x275a('0xd')](0x1f4,_0x440157[_0x275a('0x10')]));});});};exports[_0x275a('0x1d')]=function(_0xe22b72){var _0x2b4683=this;return new Promise(function(_0x50d998,_0x2c3608){return db[_0x275a('0x15')]['create'](_0xe22b72[_0x275a('0x1e')],{'raw':_0xe22b72[_0x275a('0x16')]?_0xe22b72[_0x275a('0x16')][_0x275a('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x281437){logger[_0x275a('0x11')](_0x275a('0x1d'),_0xe22b72);logger[_0x275a('0x9')](_0x275a('0x1d'),_0xe22b72,JSON['stringify'](_0x281437));_0x50d998(_0x281437);})[_0x275a('0x13')](function(_0x334403){logger[_0x275a('0xd')]('CreateMemberReport',_0x334403[_0x275a('0x10')],_0xe22b72);_0x2c3608(_0x2b4683['error'](0x1f4,_0x334403[_0x275a('0x10')]));});});};exports['UpdateMemberReport']=function(_0x4ea389){var _0x259b00=this;return new Promise(function(_0x34c086,_0x946a67){return db['MemberReport'][_0x275a('0x20')](_0x4ea389[_0x275a('0x1e')],{'raw':_0x4ea389[_0x275a('0x16')]?_0x4ea389[_0x275a('0x16')][_0x275a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ea389[_0x275a('0x16')]?_0x4ea389[_0x275a('0x16')][_0x275a('0x17')]||null:null,'attributes':_0x4ea389['options']?_0x4ea389[_0x275a('0x16')][_0x275a('0x1c')]||null:null,'limit':_0x4ea389[_0x275a('0x16')]?_0x4ea389['options'][_0x275a('0x18')]||null:null})[_0x275a('0x8')](function(_0x1d068a){logger['info'](_0x275a('0x21'),_0x4ea389);logger[_0x275a('0x9')]('UpdateMemberReport',_0x4ea389,JSON[_0x275a('0xc')](_0x1d068a));_0x34c086(_0x1d068a);})[_0x275a('0x13')](function(_0x47ce00){logger[_0x275a('0xd')]('UpdateMemberReport',_0x47ce00[_0x275a('0x10')],_0x4ea389);_0x946a67(_0x259b00[_0x275a('0xd')](0x1f4,_0x47ce00['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 0ea3097..e59de99 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 _0x4a99=['./migration.controller','index','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x47402c,_0x4202f3){var _0x4a5016=function(_0x9040b5){while(--_0x9040b5){_0x47402c['push'](_0x47402c['shift']());}};_0x4a5016(++_0x4202f3);}(_0x4a99,0x1aa));var _0x94a9=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4a99[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x94a9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x94a9('0x1'));var express=require(_0x94a9('0x2'));var router=express['Router']();var fs_extra=require(_0x94a9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x94a9('0x4'));var config=require(_0x94a9('0x5'));var controller=require(_0x94a9('0x6'));router['get']('/',controller[_0x94a9('0x7')]);module[_0x94a9('0x8')]=router; \ No newline at end of file +var _0xbfa3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','util','path','connect-timeout','express'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbfa3,0x70));var _0x3bfa=function(_0x207372,_0x1c4519){_0x207372=_0x207372-0x0;var _0x1dbcbd=_0xbfa3[_0x207372];return _0x1dbcbd;};'use strict';var multer=require(_0x3bfa('0x0'));var util=require(_0x3bfa('0x1'));var path=require(_0x3bfa('0x2'));var timeout=require(_0x3bfa('0x3'));var express=require(_0x3bfa('0x4'));var router=express[_0x3bfa('0x5')]();var fs_extra=require(_0x3bfa('0x6'));var auth=require(_0x3bfa('0x7'));var interaction=require(_0x3bfa('0x8'));var config=require(_0x3bfa('0x9'));var controller=require(_0x3bfa('0xa'));router[_0x3bfa('0xb')]('/',controller[_0x3bfa('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 24ff763..893d583 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 _0x9ab9=['version','sequelize','STRING'];(function(_0x5037ee,_0x180695){var _0x5972b2=function(_0x2a718b){while(--_0x2a718b){_0x5037ee['push'](_0x5037ee['shift']());}};_0x5972b2(++_0x180695);}(_0x9ab9,0xdf));var _0x99ab=function(_0x440a20,_0x410485){_0x440a20=_0x440a20-0x0;var _0x9f9aa=_0x9ab9[_0x440a20];return _0x9f9aa;};'use strict';var Sequelize=require(_0x99ab('0x0'));module['exports']={'version':{'type':Sequelize[_0x99ab('0x1')],'unique':_0x99ab('0x2')}}; \ No newline at end of file +var _0xb302=['version','exports'];(function(_0x3e7dd5,_0x5e6857){var _0x815404=function(_0x179abe){while(--_0x179abe){_0x3e7dd5['push'](_0x3e7dd5['shift']());}};_0x815404(++_0x5e6857);}(_0xb302,0x129));var _0x2b30=function(_0x12bc1a,_0x51bbff){_0x12bc1a=_0x12bc1a-0x0;var _0x78455b=_0xb302[_0x12bc1a];return _0x78455b;};'use strict';var Sequelize=require('sequelize');module[_0x2b30('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x2b30('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d86259b..a813d5a 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 _0xdb73=['error','name','send','index','map','Migration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','rimraf','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then'];(function(_0x4024cc,_0x1391be){var _0x4abfe3=function(_0x3d5260){while(--_0x3d5260){_0x4024cc['push'](_0x4024cc['shift']());}};_0x4abfe3(++_0x1391be);}(_0xdb73,0x98));var _0x3db7=function(_0x93d554,_0x19e296){_0x93d554=_0x93d554-0x0;var _0x2dac9a=_0xdb73[_0x93d554];return _0x2dac9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3db7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3db7('0x1'));var rp=require('request-promise');var moment=require(_0x3db7('0x2'));var BPromise=require(_0x3db7('0x3'));var Mustache=require('mustache');var util=require(_0x3db7('0x4'));var path=require('path');var sox=require(_0x3db7('0x5'));var csv=require('to-csv');var ejs=require(_0x3db7('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3db7('0x7'));var squel=require(_0x3db7('0x8'));var crypto=require(_0x3db7('0x9'));var jsforce=require(_0x3db7('0xa'));var deskjs=require(_0x3db7('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3db7('0xc'));var Papa=require(_0x3db7('0xd'));var Redis=require('ioredis');var authService=require(_0x3db7('0xe'));var qs=require(_0x3db7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3db7('0x10'));var logger=require(_0x3db7('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3db7('0x12'));var licenseUtil=require(_0x3db7('0x13'));var db=require(_0x3db7('0x14'))['db'];function respondWithStatusCode(_0x11885e,_0x3078eb){_0x3078eb=_0x3078eb||0xcc;return function(_0x5ddc84){if(_0x5ddc84){return _0x11885e[_0x3db7('0x15')](_0x3078eb);}return _0x11885e['status'](_0x3078eb)['end']();};}function respondWithResult(_0x24dbba,_0x5eddc8){_0x5eddc8=_0x5eddc8||0xc8;return function(_0xaccecd){if(_0xaccecd){return _0x24dbba[_0x3db7('0x16')](_0x5eddc8)[_0x3db7('0x17')](_0xaccecd);}};}function respondWithFilteredResult(_0x19f4f1,_0x441b3e){return function(_0x15c6a5){if(_0x15c6a5){var _0x335ad4=typeof _0x441b3e[_0x3db7('0x18')]===_0x3db7('0x19')&&typeof _0x441b3e['limit']===_0x3db7('0x19');var _0x4951d5=_0x15c6a5[_0x3db7('0x1a')];var _0x5784ef=_0x335ad4?0x0:_0x441b3e[_0x3db7('0x18')];var _0x21d203=_0x335ad4?_0x15c6a5[_0x3db7('0x1a')]:_0x441b3e['offset']+_0x441b3e[_0x3db7('0x1b')];var _0x224e8f;if(_0x21d203>=_0x4951d5){_0x21d203=_0x4951d5;_0x224e8f=0xc8;}else{_0x224e8f=0xce;}_0x19f4f1[_0x3db7('0x16')](_0x224e8f);return _0x19f4f1[_0x3db7('0x1c')](_0x3db7('0x1d'),_0x5784ef+'-'+_0x21d203+'/'+_0x4951d5)['json'](_0x15c6a5);}return null;};}function patchUpdates(_0x58d45){return function(_0x13dd7e){try{jsonpatch[_0x3db7('0x1e')](_0x13dd7e,_0x58d45,!![]);}catch(_0x569646){return BPromise[_0x3db7('0x1f')](_0x569646);}return _0x13dd7e['save']();};}function saveUpdates(_0x5e1875,_0x121d78){return function(_0xe59811){if(_0xe59811){return _0xe59811['update'](_0x5e1875)['then'](function(_0x3f2c0f){return _0x3f2c0f;});}return null;};}function removeEntity(_0x729e54,_0x574f49){return function(_0x3e075d){if(_0x3e075d){return _0x3e075d[_0x3db7('0x20')]()[_0x3db7('0x21')](function(){_0x729e54[_0x3db7('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b105e,_0x1f95a9){return function(_0x1f2eb0){if(!_0x1f2eb0){_0x4b105e[_0x3db7('0x15')](0x194);}return _0x1f2eb0;};}function handleError(_0x419edd,_0x352cf6){_0x352cf6=_0x352cf6||0x1f4;return function(_0x210ee7){logger[_0x3db7('0x22')](_0x210ee7['stack']);if(_0x210ee7[_0x3db7('0x23')]){delete _0x210ee7['name'];}_0x419edd['status'](_0x352cf6)[_0x3db7('0x24')](_0x210ee7);};}exports[_0x3db7('0x25')]=function(_0x30b989,_0xd3a658){var _0x2d6305={},_0x40fda3={},_0x9249c2={'count':0x0,'rows':[]};var _0x34b5b6=_[_0x3db7('0x26')](db[_0x3db7('0x27')][_0x3db7('0x28')],function(_0x55cd01){return{'name':_0x55cd01['fieldName'],'type':_0x55cd01[_0x3db7('0x29')][_0x3db7('0x2a')]};});_0x40fda3['model']=_[_0x3db7('0x26')](_0x34b5b6,_0x3db7('0x23'));_0x40fda3[_0x3db7('0x2b')]=_[_0x3db7('0x2c')](_0x30b989[_0x3db7('0x2b')]);_0x40fda3[_0x3db7('0x2d')]=_[_0x3db7('0x2e')](_0x40fda3[_0x3db7('0x2f')],_0x40fda3[_0x3db7('0x2b')]);_0x2d6305[_0x3db7('0x30')]=_[_0x3db7('0x2e')](_0x40fda3[_0x3db7('0x2f')],qs['fields'](_0x30b989[_0x3db7('0x2b')][_0x3db7('0x31')]));_0x2d6305['attributes']=_0x2d6305[_0x3db7('0x30')][_0x3db7('0x32')]?_0x2d6305[_0x3db7('0x30')]:_0x40fda3[_0x3db7('0x2f')];if(!_0x30b989[_0x3db7('0x2b')][_0x3db7('0x33')]('nolimit')){_0x2d6305['limit']=qs[_0x3db7('0x1b')](_0x30b989[_0x3db7('0x2b')]['limit']);_0x2d6305[_0x3db7('0x18')]=qs[_0x3db7('0x18')](_0x30b989[_0x3db7('0x2b')]['offset']);}_0x2d6305['order']=qs[_0x3db7('0x34')](_0x30b989[_0x3db7('0x2b')][_0x3db7('0x34')]);_0x2d6305[_0x3db7('0x35')]=qs[_0x3db7('0x2d')](_[_0x3db7('0x36')](_0x30b989['query'],_0x40fda3[_0x3db7('0x2d')]),_0x34b5b6);if(_0x30b989[_0x3db7('0x2b')][_0x3db7('0x37')]){_0x2d6305[_0x3db7('0x35')]=_[_0x3db7('0x38')](_0x2d6305[_0x3db7('0x35')],{'$or':_[_0x3db7('0x26')](_0x34b5b6,function(_0x8dd7ae){if(_0x8dd7ae[_0x3db7('0x29')]!==_0x3db7('0x39')){var _0xb01bed={};_0xb01bed[_0x8dd7ae['name']]={'$like':'%'+_0x30b989['query'][_0x3db7('0x37')]+'%'};return _0xb01bed;}})});}_0x2d6305=_['merge']({},_0x2d6305,_0x30b989[_0x3db7('0x3a')]);var _0x5ca449={'where':_0x2d6305[_0x3db7('0x35')]};return db[_0x3db7('0x27')]['count'](_0x5ca449)[_0x3db7('0x21')](function(_0x4b9971){_0x9249c2[_0x3db7('0x1a')]=_0x4b9971;if(_0x30b989[_0x3db7('0x2b')]['includeAll']){_0x2d6305[_0x3db7('0x3b')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x2d6305);})[_0x3db7('0x21')](function(_0x2b6df4){_0x9249c2[_0x3db7('0x3c')]=_0x2b6df4;return _0x9249c2;})['then'](respondWithFilteredResult(_0xd3a658,_0x2d6305))[_0x3db7('0x3d')](handleError(_0xd3a658,null));}; \ No newline at end of file +var _0xa404=['filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','sendStatus','stack','name','send','Migration','rawAttributes','type','key','map','query','keys'];(function(_0x5da897,_0x534461){var _0x1c6024=function(_0xcac13a){while(--_0xcac13a){_0x5da897['push'](_0x5da897['shift']());}};_0x1c6024(++_0x534461);}(_0xa404,0x1c2));var _0x4a40=function(_0xfa48c0,_0xf2b741){_0xfa48c0=_0xfa48c0-0x0;var _0x34ceeb=_0xa404[_0xfa48c0];return _0x34ceeb;};'use strict';var emlformat=require(_0x4a40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a40('0x1'));var jsonpatch=require(_0x4a40('0x2'));var rp=require(_0x4a40('0x3'));var moment=require('moment');var BPromise=require(_0x4a40('0x4'));var Mustache=require(_0x4a40('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4a40('0x6'));var csv=require(_0x4a40('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a40('0x8'));var _=require('lodash');var squel=require(_0x4a40('0x9'));var crypto=require(_0x4a40('0xa'));var jsforce=require(_0x4a40('0xb'));var deskjs=require(_0x4a40('0xc'));var toCsv=require(_0x4a40('0x7'));var querystring=require(_0x4a40('0xd'));var Papa=require(_0x4a40('0xe'));var Redis=require(_0x4a40('0xf'));var authService=require(_0x4a40('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a40('0x11'))(_0x4a40('0x12'));var utils=require(_0x4a40('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4a40('0x14'));var db=require(_0x4a40('0x15'))['db'];function respondWithStatusCode(_0x2adfbc,_0x40d505){_0x40d505=_0x40d505||0xcc;return function(_0x5f4969){if(_0x5f4969){return _0x2adfbc['sendStatus'](_0x40d505);}return _0x2adfbc[_0x4a40('0x16')](_0x40d505)['end']();};}function respondWithResult(_0x51089b,_0x44965d){_0x44965d=_0x44965d||0xc8;return function(_0x17ccf4){if(_0x17ccf4){return _0x51089b[_0x4a40('0x16')](_0x44965d)[_0x4a40('0x17')](_0x17ccf4);}};}function respondWithFilteredResult(_0x206390,_0x9ce59e){return function(_0x58151b){if(_0x58151b){var _0x21283b=typeof _0x9ce59e[_0x4a40('0x18')]===_0x4a40('0x19')&&typeof _0x9ce59e[_0x4a40('0x1a')]===_0x4a40('0x19');var _0x1c928d=_0x58151b[_0x4a40('0x1b')];var _0x4fc49b=_0x21283b?0x0:_0x9ce59e['offset'];var _0x30f78e=_0x21283b?_0x58151b['count']:_0x9ce59e['offset']+_0x9ce59e['limit'];var _0x17b927;if(_0x30f78e>=_0x1c928d){_0x30f78e=_0x1c928d;_0x17b927=0xc8;}else{_0x17b927=0xce;}_0x206390[_0x4a40('0x16')](_0x17b927);return _0x206390[_0x4a40('0x1c')](_0x4a40('0x1d'),_0x4fc49b+'-'+_0x30f78e+'/'+_0x1c928d)[_0x4a40('0x17')](_0x58151b);}return null;};}function patchUpdates(_0x10e66){return function(_0x1d3d93){try{jsonpatch[_0x4a40('0x1e')](_0x1d3d93,_0x10e66,!![]);}catch(_0x5c7143){return BPromise['reject'](_0x5c7143);}return _0x1d3d93['save']();};}function saveUpdates(_0x481fd0,_0x839514){return function(_0x59e35e){if(_0x59e35e){return _0x59e35e[_0x4a40('0x1f')](_0x481fd0)[_0x4a40('0x20')](function(_0x1ddcd1){return _0x1ddcd1;});}return null;};}function removeEntity(_0x4c5e38,_0x590762){return function(_0x5e4ed9){if(_0x5e4ed9){return _0x5e4ed9[_0x4a40('0x21')]()[_0x4a40('0x20')](function(){_0x4c5e38[_0x4a40('0x16')](0xcc)[_0x4a40('0x22')]();});}};}function handleEntityNotFound(_0x41c464,_0x34c57e){return function(_0x2fa8e6){if(!_0x2fa8e6){_0x41c464[_0x4a40('0x23')](0x194);}return _0x2fa8e6;};}function handleError(_0x1ec07f,_0x525a34){_0x525a34=_0x525a34||0x1f4;return function(_0x3405b8){logger['error'](_0x3405b8[_0x4a40('0x24')]);if(_0x3405b8[_0x4a40('0x25')]){delete _0x3405b8[_0x4a40('0x25')];}_0x1ec07f[_0x4a40('0x16')](_0x525a34)[_0x4a40('0x26')](_0x3405b8);};}exports['index']=function(_0x136739,_0x30992){var _0x54c015={},_0x520337={},_0xe119bb={'count':0x0,'rows':[]};var _0x18c204=_['map'](db[_0x4a40('0x27')][_0x4a40('0x28')],function(_0x458fe5){return{'name':_0x458fe5['fieldName'],'type':_0x458fe5[_0x4a40('0x29')][_0x4a40('0x2a')]};});_0x520337['model']=_[_0x4a40('0x2b')](_0x18c204,'name');_0x520337[_0x4a40('0x2c')]=_[_0x4a40('0x2d')](_0x136739[_0x4a40('0x2c')]);_0x520337[_0x4a40('0x2e')]=_['intersection'](_0x520337[_0x4a40('0x2f')],_0x520337[_0x4a40('0x2c')]);_0x54c015[_0x4a40('0x30')]=_['intersection'](_0x520337[_0x4a40('0x2f')],qs['fields'](_0x136739[_0x4a40('0x2c')][_0x4a40('0x31')]));_0x54c015[_0x4a40('0x30')]=_0x54c015[_0x4a40('0x30')][_0x4a40('0x32')]?_0x54c015[_0x4a40('0x30')]:_0x520337[_0x4a40('0x2f')];if(!_0x136739[_0x4a40('0x2c')][_0x4a40('0x33')](_0x4a40('0x34'))){_0x54c015['limit']=qs[_0x4a40('0x1a')](_0x136739['query']['limit']);_0x54c015[_0x4a40('0x18')]=qs[_0x4a40('0x18')](_0x136739[_0x4a40('0x2c')][_0x4a40('0x18')]);}_0x54c015[_0x4a40('0x35')]=qs[_0x4a40('0x36')](_0x136739[_0x4a40('0x2c')][_0x4a40('0x36')]);_0x54c015[_0x4a40('0x37')]=qs[_0x4a40('0x2e')](_['pick'](_0x136739[_0x4a40('0x2c')],_0x520337[_0x4a40('0x2e')]),_0x18c204);if(_0x136739[_0x4a40('0x2c')][_0x4a40('0x38')]){_0x54c015[_0x4a40('0x37')]=_[_0x4a40('0x39')](_0x54c015['where'],{'$or':_[_0x4a40('0x2b')](_0x18c204,function(_0xd28395){if(_0xd28395[_0x4a40('0x29')]!=='VIRTUAL'){var _0x468266={};_0x468266[_0xd28395[_0x4a40('0x25')]]={'$like':'%'+_0x136739[_0x4a40('0x2c')][_0x4a40('0x38')]+'%'};return _0x468266;}})});}_0x54c015=_['merge']({},_0x54c015,_0x136739[_0x4a40('0x3a')]);var _0x116d28={'where':_0x54c015[_0x4a40('0x37')]};return db['Migration'][_0x4a40('0x1b')](_0x116d28)[_0x4a40('0x20')](function(_0x239589){_0xe119bb[_0x4a40('0x1b')]=_0x239589;if(_0x136739['query']['includeAll']){_0x54c015[_0x4a40('0x3b')]=[{'all':!![]}];}return db[_0x4a40('0x27')][_0x4a40('0x3c')](_0x54c015);})[_0x4a40('0x20')](function(_0x3a6d2a){_0xe119bb[_0x4a40('0x3d')]=_0x3a6d2a;return _0xe119bb;})['then'](respondWithFilteredResult(_0x30992,_0x54c015))['catch'](handleError(_0x30992,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index efe6860..8e04345 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 _0xdcb2=['Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./migration.attributes','exports','define'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xdcb2,0x1d0));var _0x2dcb=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xdcb2[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x2dcb('0x0'));var util=require(_0x2dcb('0x1'));var logger=require(_0x2dcb('0x2'))(_0x2dcb('0x3'));var moment=require(_0x2dcb('0x4'));var BPromise=require(_0x2dcb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2dcb('0x6'));var rimraf=require(_0x2dcb('0x7'));var config=require(_0x2dcb('0x8'));var attributes=require(_0x2dcb('0x9'));module[_0x2dcb('0xa')]=function(_0xfad731,_0xdd4d1){return _0xfad731[_0x2dcb('0xb')](_0x2dcb('0xc'),attributes,{'tableName':_0x2dcb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b5c=['util','../../config/logger','moment','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8b5c,0x15b));var _0xc8b5=function(_0x2ad81c,_0x26cd73){_0x2ad81c=_0x2ad81c-0x0;var _0xdabdc8=_0x8b5c[_0x2ad81c];return _0xdabdc8;};'use strict';var _=require(_0xc8b5('0x0'));var util=require(_0xc8b5('0x1'));var logger=require(_0xc8b5('0x2'))('api');var moment=require(_0xc8b5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8b5('0x4'));var rimraf=require(_0xc8b5('0x5'));var config=require(_0xc8b5('0x6'));var attributes=require(_0xc8b5('0x7'));module[_0xc8b5('0x8')]=function(_0x64bf0e,_0x33526e){return _0x64bf0e[_0xc8b5('0x9')](_0xc8b5('0xa'),attributes,{'tableName':_0xc8b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 784cc9b..02c975f 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 _0x9c5e=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x173b65,_0x50300c){_0x173b65=_0x173b65-0x0;var _0x308c63=_0x9c5e[_0x173b65];return _0x308c63;};'use strict';var _=require(_0xe9c5('0x0'));var util=require(_0xe9c5('0x1'));var moment=require(_0xe9c5('0x2'));var BPromise=require(_0xe9c5('0x3'));var rs=require(_0xe9c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe9c5('0x5'))(_0xe9c5('0x6'));var config=require('../../config/environment');var jayson=require(_0xe9c5('0x7'));var client=jayson[_0xe9c5('0x8')][_0xe9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6f6045,_0x5b1c04,_0x2fa290){return new BPromise(function(_0x34ee69,_0x228ef3){return client[_0xe9c5('0xa')](_0x6f6045,_0x2fa290)['then'](function(_0x596f4c){logger[_0xe9c5('0xb')](_0xe9c5('0xc'),_0x5b1c04,_0xe9c5('0xd'));logger[_0xe9c5('0xe')](_0xe9c5('0xf'),_0x5b1c04,_0xe9c5('0xd'),JSON[_0xe9c5('0x10')](_0x596f4c));if(_0x596f4c[_0xe9c5('0x11')]){if(_0x596f4c[_0xe9c5('0x11')][_0xe9c5('0x12')]===0x1f4){logger[_0xe9c5('0x11')](_0xe9c5('0xc'),_0x5b1c04,_0x596f4c[_0xe9c5('0x11')][_0xe9c5('0x13')]);return _0x228ef3(_0x596f4c[_0xe9c5('0x11')][_0xe9c5('0x13')]);}logger['error'](_0xe9c5('0xc'),_0x5b1c04,_0x596f4c[_0xe9c5('0x11')][_0xe9c5('0x13')]);return _0x34ee69(_0x596f4c[_0xe9c5('0x11')][_0xe9c5('0x13')]);}else{logger[_0xe9c5('0xb')]('Migration,\x20%s,\x20%s',_0x5b1c04,_0xe9c5('0xd'));_0x34ee69(_0x596f4c[_0xe9c5('0x14')]['message']);}})[_0xe9c5('0x15')](function(_0x45d18d){logger[_0xe9c5('0x11')](_0xe9c5('0xc'),_0x5b1c04,_0x45d18d);_0x228ef3(_0x45d18d);});});} \ No newline at end of file +var _0x122a=['bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','request\x20sent','catch','lodash','util','moment'];(function(_0x510ff1,_0x266428){var _0x3b8c58=function(_0x1d2735){while(--_0x1d2735){_0x510ff1['push'](_0x510ff1['shift']());}};_0x3b8c58(++_0x266428);}(_0x122a,0xba));var _0xa122=function(_0x30f61b,_0x5f0ae7){_0x30f61b=_0x30f61b-0x0;var _0xa480b2=_0x122a[_0x30f61b];return _0xa480b2;};'use strict';var _=require(_0xa122('0x0'));var util=require(_0xa122('0x1'));var moment=require(_0xa122('0x2'));var BPromise=require(_0xa122('0x3'));var rs=require(_0xa122('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa122('0x5'));var logger=require('../../config/logger')(_0xa122('0x6'));var config=require(_0xa122('0x7'));var jayson=require(_0xa122('0x8'));var client=jayson[_0xa122('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x576d57,_0x5157f6,_0x23e139){return new BPromise(function(_0x190f74,_0x4d180f){return client[_0xa122('0xa')](_0x576d57,_0x23e139)[_0xa122('0xb')](function(_0x2046c4){logger[_0xa122('0xc')]('Migration,\x20%s,\x20%s',_0x5157f6,'request\x20sent');logger['debug'](_0xa122('0xd'),_0x5157f6,'request\x20sent',JSON[_0xa122('0xe')](_0x2046c4));if(_0x2046c4[_0xa122('0xf')]){if(_0x2046c4['error'][_0xa122('0x10')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x5157f6,_0x2046c4[_0xa122('0xf')][_0xa122('0x11')]);return _0x4d180f(_0x2046c4['error'][_0xa122('0x11')]);}logger[_0xa122('0xf')](_0xa122('0x12'),_0x5157f6,_0x2046c4['error'][_0xa122('0x11')]);return _0x190f74(_0x2046c4[_0xa122('0xf')][_0xa122('0x11')]);}else{logger[_0xa122('0xc')](_0xa122('0x12'),_0x5157f6,_0xa122('0x13'));_0x190f74(_0x2046c4['result'][_0xa122('0x11')]);}})[_0xa122('0x14')](function(_0xf1b733){logger[_0xa122('0xf')](_0xa122('0x12'),_0x5157f6,_0xf1b733);_0x4d180f(_0xf1b733);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index af45e24..6a7efeb 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 _0xda81=['fs-extra','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda81,0x1c3));var _0x1da8=function(_0x14630a,_0x33865a){_0x14630a=_0x14630a-0x0;var _0x1ee906=_0xda81[_0x14630a];return _0x1ee906;};'use strict';var multer=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var path=require(_0x1da8('0x2'));var timeout=require('connect-timeout');var express=require(_0x1da8('0x3'));var router=express[_0x1da8('0x4')]();var fs_extra=require(_0x1da8('0x5'));var auth=require(_0x1da8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1da8('0x7'));var controller=require(_0x1da8('0x8'));router['get']('/',auth[_0x1da8('0x9')](),controller['index']);router[_0x1da8('0xa')](_0x1da8('0xb'),auth[_0x1da8('0x9')](),controller[_0x1da8('0xc')]);router[_0x1da8('0xd')]('/',auth[_0x1da8('0x9')](),controller[_0x1da8('0xe')]);router[_0x1da8('0xf')](_0x1da8('0xb'),auth['isAuthenticated'](),controller[_0x1da8('0x10')]);router[_0x1da8('0x11')](_0x1da8('0xb'),auth[_0x1da8('0x9')](),controller[_0x1da8('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4baf=['./network.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x33d286,_0x1d83b7){var _0xd4859a=function(_0x2bedc2){while(--_0x2bedc2){_0x33d286['push'](_0x33d286['shift']());}};_0xd4859a(++_0x1d83b7);}(_0x4baf,0xb4));var _0xf4ba=function(_0xf7b86f,_0x3f21ed){_0xf7b86f=_0xf7b86f-0x0;var _0x335889=_0x4baf[_0xf7b86f];return _0x335889;};'use strict';var multer=require(_0xf4ba('0x0'));var util=require('util');var path=require(_0xf4ba('0x1'));var timeout=require(_0xf4ba('0x2'));var express=require(_0xf4ba('0x3'));var router=express[_0xf4ba('0x4')]();var fs_extra=require(_0xf4ba('0x5'));var auth=require(_0xf4ba('0x6'));var interaction=require(_0xf4ba('0x7'));var config=require(_0xf4ba('0x8'));var controller=require(_0xf4ba('0x9'));router['get']('/',auth[_0xf4ba('0xa')](),controller['index']);router[_0xf4ba('0xb')](_0xf4ba('0xc'),auth['isAuthenticated'](),controller[_0xf4ba('0xd')]);router[_0xf4ba('0xe')]('/',auth[_0xf4ba('0xa')](),controller[_0xf4ba('0xf')]);router[_0xf4ba('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf4ba('0x11')]);router[_0xf4ba('0x12')](_0xf4ba('0xc'),auth['isAuthenticated'](),controller[_0xf4ba('0x13')]);module[_0xf4ba('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 7c5b7ee..b0ca1dc 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 _0x53cb=['localnet','turn','STRING','ENUM'];(function(_0x4c8d36,_0x3de957){var _0x399631=function(_0x2f7e15){while(--_0x2f7e15){_0x4c8d36['push'](_0x4c8d36['shift']());}};_0x399631(++_0x3de957);}(_0x53cb,0xab));var _0xb53c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x53cb[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb53c('0x0')](_0xb53c('0x1'),'externip','stun',_0xb53c('0x2'))},'value':{'type':Sequelize[_0xb53c('0x3')]},'username':{'type':Sequelize[_0xb53c('0x3')]},'password':{'type':Sequelize[_0xb53c('0x3')]}}; \ No newline at end of file +var _0x31e2=['STRING','exports','ENUM','localnet','stun','turn'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x31e2,0xf1));var _0x231e=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0x31e2[_0x3b4b1d];return _0x488c36;};'use strict';var Sequelize=require('sequelize');module[_0x231e('0x0')]={'type':{'type':Sequelize[_0x231e('0x1')](_0x231e('0x2'),'externip',_0x231e('0x3'),_0x231e('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x231e('0x5')]},'password':{'type':Sequelize[_0x231e('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index cd34667..17bbbfa 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 _0x8fba=['server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','join','server/files/templates/network.ejs','utf8','toLowerCase','TURN','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','format','path','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Network','rows','show','params','find','create','body','findAll','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so'];(function(_0x374461,_0x3878fd){var _0x59b63c=function(_0x44b90d){while(--_0x44b90d){_0x374461['push'](_0x374461['shift']());}};_0x59b63c(++_0x3878fd);}(_0x8fba,0xb6));var _0xa8fb=function(_0x582a1d,_0x1d0b86){_0x582a1d=_0x582a1d-0x0;var _0x3b03e1=_0x8fba[_0x582a1d];return _0x3b03e1;};'use strict';var util=require('util');var path=require(_0xa8fb('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa8fb('0x1'));var qs=require(_0xa8fb('0x2'));var logger=require(_0xa8fb('0x3'))('api');var config=require(_0xa8fb('0x4'));var db=require(_0xa8fb('0x5'))['db'];var jayson=require(_0xa8fb('0x6'));var client=jayson['client'][_0xa8fb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ecbba,_0x5ea98d,_0x1b645c,_0x396474){return new Promise(function(_0x2eb6c4,_0x2b853b){var _0x244835=_0x396474||client;return _0x244835['request'](_0x2ecbba,_0x1b645c)[_0xa8fb('0x8')](function(_0x3b8c58){logger[_0xa8fb('0x9')](_0xa8fb('0xa'),_0x5ea98d,_0xa8fb('0xb'));logger[_0xa8fb('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x5ea98d,_0xa8fb('0xb'),JSON[_0xa8fb('0xd')](_0x3b8c58));if(_0x3b8c58[_0xa8fb('0xe')]){if(_0x3b8c58[_0xa8fb('0xe')][_0xa8fb('0xf')]===0x1f4){logger[_0xa8fb('0xe')](_0xa8fb('0xa'),_0x5ea98d,_0x3b8c58[_0xa8fb('0xe')][_0xa8fb('0x10')]);return _0x2b853b(_0x3b8c58[_0xa8fb('0xe')][_0xa8fb('0x10')]);}logger[_0xa8fb('0xe')]('Network,\x20%s,\x20%s',_0x5ea98d,_0x3b8c58[_0xa8fb('0xe')][_0xa8fb('0x10')]);return _0x2eb6c4(_0x3b8c58[_0xa8fb('0xe')]['message']);}else{logger[_0xa8fb('0x9')](_0xa8fb('0xa'),_0x5ea98d,'request\x20sent');_0x2eb6c4(_0x3b8c58[_0xa8fb('0x11')][_0xa8fb('0x10')]);}})[_0xa8fb('0x12')](function(_0x249760){logger[_0xa8fb('0xe')](_0xa8fb('0xa'),_0x5ea98d,_0x249760);_0x2b853b(_0x249760);});});}function respondWithResult(_0x5802e9,_0x23068f){_0x23068f=_0x23068f||0xc8;return function(_0x137975){if(_0x137975){return _0x5802e9[_0xa8fb('0x13')](_0x23068f)[_0xa8fb('0x14')](_0x137975);}};}function respondWithFilteredResult(_0x36a175,_0x51cbc0){return function(_0x7e4a46){if(_0x7e4a46){var _0x1be848=typeof _0x51cbc0[_0xa8fb('0x15')]==='undefined'&&typeof _0x51cbc0[_0xa8fb('0x16')]===_0xa8fb('0x17');var _0x4e33a3=_0x7e4a46[_0xa8fb('0x18')];var _0x2e446a=_0x1be848?0x0:_0x51cbc0[_0xa8fb('0x15')];var _0x402149=_0x1be848?_0x7e4a46[_0xa8fb('0x18')]:_0x51cbc0['offset']+_0x51cbc0[_0xa8fb('0x16')];var _0xb3bb6e;if(_0x402149>=_0x4e33a3){_0x402149=_0x4e33a3;_0xb3bb6e=0xc8;}else{_0xb3bb6e=0xce;}_0x36a175[_0xa8fb('0x13')](_0xb3bb6e);return _0x36a175[_0xa8fb('0x19')](_0xa8fb('0x1a'),_0x2e446a+'-'+_0x402149+'/'+_0x4e33a3)[_0xa8fb('0x14')](_0x7e4a46);}return null;};}function saveUpdates(_0x43e936){return function(_0x2d9a83){if(_0x2d9a83){return _0x2d9a83[_0xa8fb('0x1b')](_0x43e936)[_0xa8fb('0x8')](function(_0x5cacbe){return _0x5cacbe;});}return null;};}function removeEntity(_0x1d6b91){return function(_0x245ade){if(_0x245ade){return _0x245ade[_0xa8fb('0x1c')]()[_0xa8fb('0x8')](function(){_0x1d6b91[_0xa8fb('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff798){return function(_0x5cb961){if(!_0x5cb961){_0x1ff798[_0xa8fb('0x1d')](0x194);}return _0x5cb961;};}function handleError(_0x44bdc4,_0x23a4a9){_0x23a4a9=_0x23a4a9||0x1f4;return function(_0x339b08){logger[_0xa8fb('0xe')](_0x339b08[_0xa8fb('0x1e')]);if(_0x339b08['name']){delete _0x339b08['name'];}_0x44bdc4[_0xa8fb('0x13')](_0x23a4a9)[_0xa8fb('0x1f')](_0x339b08);};}exports[_0xa8fb('0x20')]=function(_0x3b4a84,_0x36f014){var _0x396a51={},_0x41fbcb={},_0xb19b44={'count':0x0,'rows':[]};var _0x52d032=_[_0xa8fb('0x21')](db['Network'][_0xa8fb('0x22')],function(_0x5605c1){return{'name':_0x5605c1[_0xa8fb('0x23')],'type':_0x5605c1[_0xa8fb('0x24')][_0xa8fb('0x25')]};});_0x41fbcb[_0xa8fb('0x26')]=_[_0xa8fb('0x21')](_0x52d032,_0xa8fb('0x27'));_0x41fbcb[_0xa8fb('0x28')]=_[_0xa8fb('0x29')](_0x3b4a84['query']);_0x41fbcb[_0xa8fb('0x2a')]=_[_0xa8fb('0x2b')](_0x41fbcb[_0xa8fb('0x26')],_0x41fbcb[_0xa8fb('0x28')]);_0x396a51[_0xa8fb('0x2c')]=_['intersection'](_0x41fbcb['model'],qs[_0xa8fb('0x2d')](_0x3b4a84['query'][_0xa8fb('0x2d')]));_0x396a51[_0xa8fb('0x2c')]=_0x396a51[_0xa8fb('0x2c')][_0xa8fb('0x2e')]?_0x396a51['attributes']:_0x41fbcb['model'];if(!_0x3b4a84[_0xa8fb('0x28')][_0xa8fb('0x2f')](_0xa8fb('0x30'))){_0x396a51[_0xa8fb('0x16')]=qs['limit'](_0x3b4a84[_0xa8fb('0x28')][_0xa8fb('0x16')]);_0x396a51[_0xa8fb('0x15')]=qs['offset'](_0x3b4a84['query'][_0xa8fb('0x15')]);}_0x396a51[_0xa8fb('0x31')]=qs['sort'](_0x3b4a84[_0xa8fb('0x28')][_0xa8fb('0x32')]);_0x396a51[_0xa8fb('0x33')]=qs[_0xa8fb('0x2a')](_[_0xa8fb('0x34')](_0x3b4a84[_0xa8fb('0x28')],_0x41fbcb['filters']),_0x52d032);if(_0x3b4a84[_0xa8fb('0x28')]['filter']){_0x396a51['where']=_['merge'](_0x396a51[_0xa8fb('0x33')],{'$or':_[_0xa8fb('0x21')](_0x52d032,function(_0x53a5e9){if(_0x53a5e9[_0xa8fb('0x24')]!=='VIRTUAL'){var _0x100ae5={};_0x100ae5[_0x53a5e9[_0xa8fb('0x27')]]={'$like':'%'+_0x3b4a84[_0xa8fb('0x28')][_0xa8fb('0x35')]+'%'};return _0x100ae5;}})});}_0x396a51=_[_0xa8fb('0x36')]({},_0x396a51,_0x3b4a84[_0xa8fb('0x37')]);var _0x21d6b1={'where':_0x396a51[_0xa8fb('0x33')]};return db['Network']['count'](_0x21d6b1)[_0xa8fb('0x8')](function(_0x14292c){_0xb19b44['count']=_0x14292c;if(_0x3b4a84[_0xa8fb('0x28')][_0xa8fb('0x38')]){_0x396a51[_0xa8fb('0x39')]=[{'all':!![]}];}return db[_0xa8fb('0x3a')]['findAll'](_0x396a51);})[_0xa8fb('0x8')](function(_0x1a22fc){_0xb19b44[_0xa8fb('0x3b')]=_0x1a22fc;return _0xb19b44;})['then'](respondWithFilteredResult(_0x36f014,_0x396a51))[_0xa8fb('0x12')](handleError(_0x36f014,null));};exports[_0xa8fb('0x3c')]=function(_0x4ca893,_0x372126){var _0xa4c7b9={'raw':!![],'where':{'id':_0x4ca893[_0xa8fb('0x3d')]['id']}},_0x301c3a={};_0x301c3a['model']=_[_0xa8fb('0x29')](db[_0xa8fb('0x3a')][_0xa8fb('0x22')]);_0x301c3a[_0xa8fb('0x28')]=_['keys'](_0x4ca893[_0xa8fb('0x28')]);_0x301c3a[_0xa8fb('0x2a')]=_[_0xa8fb('0x2b')](_0x301c3a['model'],_0x301c3a['query']);_0xa4c7b9[_0xa8fb('0x2c')]=_['intersection'](_0x301c3a[_0xa8fb('0x26')],qs[_0xa8fb('0x2d')](_0x4ca893[_0xa8fb('0x28')][_0xa8fb('0x2d')]));_0xa4c7b9[_0xa8fb('0x2c')]=_0xa4c7b9[_0xa8fb('0x2c')][_0xa8fb('0x2e')]?_0xa4c7b9[_0xa8fb('0x2c')]:_0x301c3a['model'];if(_0x4ca893[_0xa8fb('0x28')][_0xa8fb('0x38')]){_0xa4c7b9[_0xa8fb('0x39')]=[{'all':!![]}];}_0xa4c7b9=_['merge']({},_0xa4c7b9,_0x4ca893['options']);return db[_0xa8fb('0x3a')][_0xa8fb('0x3e')](_0xa4c7b9)[_0xa8fb('0x8')](handleEntityNotFound(_0x372126,null))[_0xa8fb('0x8')](respondWithResult(_0x372126,null))[_0xa8fb('0x12')](handleError(_0x372126,null));};exports[_0xa8fb('0x3f')]=function(_0x20a21b,_0x59ad97){var _0x45b9b7;return db['Network'][_0xa8fb('0x3f')](_0x20a21b[_0xa8fb('0x40')],{'raw':!![]})[_0xa8fb('0x8')](function(_0x334b9e){_0x45b9b7=_0x334b9e;return db['Network'][_0xa8fb('0x41')]({'where':{'type':_0x20a21b[_0xa8fb('0x40')]['type']},'raw':!![]});})['then'](function(_0x19da13){if(_0x45b9b7['type'][_0xa8fb('0x42')]()==_0xa8fb('0x43')){var _0x533900=fs[_0xa8fb('0x44')](path['join'](config[_0xa8fb('0x45')],_0xa8fb('0x46')),'utf8');var _0x55f733=ejs[_0xa8fb('0x47')](_0x533900,{'networks':_0x19da13||[]});fs[_0xa8fb('0x48')](_0xa8fb('0x49'),_0x55f733);return respondWithRpcPromise(_0xa8fb('0x4a'),_0xa8fb('0x3f'),{'module':_0xa8fb('0x4b')});}else if(_0x45b9b7[_0xa8fb('0x24')]['toUpperCase']()=='TURN'){var _0x38aef1=fs[_0xa8fb('0x44')](path['join'](config[_0xa8fb('0x45')],_0xa8fb('0x4c')),'utf8');var _0x5f545e=ejs['render'](_0x38aef1,{'networks':_0x19da13||[]});fs[_0xa8fb('0x48')](_0xa8fb('0x4d'),_0x5f545e);return respondWithRpcPromise(_0xa8fb('0x4a'),_0xa8fb('0x3f'),{'module':_0xa8fb('0x4b')});}else{var _0xb2098b=fs[_0xa8fb('0x44')](path[_0xa8fb('0x4e')](config['root'],_0xa8fb('0x4f')),_0xa8fb('0x50'));var _0x26f048=ejs[_0xa8fb('0x47')](_0xb2098b,{'networks':_0x19da13||[]});fs[_0xa8fb('0x48')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x20a21b[_0xa8fb('0x40')][_0xa8fb('0x24')][_0xa8fb('0x51')]()),_0x26f048);return respondWithRpcPromise(_0xa8fb('0x4a'),_0xa8fb('0x3f'),{'module':'chan_sip.so'});}})['then'](function(){return _0x45b9b7;})[_0xa8fb('0x8')](respondWithResult(_0x59ad97,0xc9))[_0xa8fb('0x12')](handleError(_0x59ad97,null));};exports['update']=function(_0x2a676b,_0x6cbb11){var _0x5e7f65;return db['Network'][_0xa8fb('0x3e')]({'where':{'id':_0x2a676b[_0xa8fb('0x3d')]['id']}})['then'](handleEntityNotFound(_0x6cbb11,null))['then'](saveUpdates(_0x2a676b[_0xa8fb('0x40')],null))[_0xa8fb('0x8')](function(_0x1bc6a6){if(_0x1bc6a6){_0x5e7f65=_0x1bc6a6;return db[_0xa8fb('0x3a')][_0xa8fb('0x41')]({'where':{'type':_0x5e7f65[_0xa8fb('0x24')]},'raw':!![]});}return null;})['then'](function(_0x277838){if(_0x5e7f65[_0xa8fb('0x24')][_0xa8fb('0x42')]()=='STUN'){var _0x289033=fs[_0xa8fb('0x44')](path['join'](config[_0xa8fb('0x45')],'server/files/templates/stun_multiple.ejs'),_0xa8fb('0x50'));var _0x2ecbd9=ejs[_0xa8fb('0x47')](_0x289033,{'networks':_0x277838||[]});fs[_0xa8fb('0x48')](_0xa8fb('0x49'),_0x2ecbd9);return respondWithRpcPromise(_0xa8fb('0x4a'),_0xa8fb('0x1b'),{'module':_0xa8fb('0x4b')});}else if(_0x5e7f65['type'][_0xa8fb('0x42')]()==_0xa8fb('0x52')){var _0x5c917b=fs[_0xa8fb('0x44')](path['join'](config[_0xa8fb('0x45')],_0xa8fb('0x4c')),_0xa8fb('0x50'));var _0x15fbef=ejs[_0xa8fb('0x47')](_0x5c917b,{'networks':_0x277838||[]});fs['writeFileSync'](_0xa8fb('0x4d'),_0x15fbef);return respondWithRpcPromise(_0xa8fb('0x4a'),_0xa8fb('0x1b'),{'module':_0xa8fb('0x4b')});}else{var _0x5caa30=fs[_0xa8fb('0x44')](path[_0xa8fb('0x4e')](config[_0xa8fb('0x45')],_0xa8fb('0x4f')),_0xa8fb('0x50'));var _0x3864af=ejs[_0xa8fb('0x47')](_0x5caa30,{'networks':_0x277838||[]});fs['writeFileSync'](util['format'](_0xa8fb('0x53'),_0x2a676b[_0xa8fb('0x40')]['type'][_0xa8fb('0x51')]()),_0x3864af);return respondWithRpcPromise('Reload','update',{'module':_0xa8fb('0x54')});}})[_0xa8fb('0x8')](function(_0x306f7e){if(_0x306f7e){return _0x5e7f65;}return null;})[_0xa8fb('0x8')](respondWithResult(_0x6cbb11,null))[_0xa8fb('0x12')](handleError(_0x6cbb11,null));};exports[_0xa8fb('0x1c')]=function(_0x42081e,_0x36733b){var _0x4a1731;return db[_0xa8fb('0x3a')][_0xa8fb('0x3e')]({'where':{'id':_0x42081e[_0xa8fb('0x3d')]['id']}})[_0xa8fb('0x8')](function(_0xf4ec9b){_0x4a1731=_0xf4ec9b;return _0xf4ec9b;})[_0xa8fb('0x8')](handleEntityNotFound(_0x36733b,null))[_0xa8fb('0x8')](removeEntity(_0x36733b,null))[_0xa8fb('0x8')](function(){if(_0x4a1731){return db[_0xa8fb('0x3a')][_0xa8fb('0x41')]({'where':{'type':_0x4a1731['type']},'raw':!![]});}})[_0xa8fb('0x8')](function(_0x18d55f){if(_0x4a1731[_0xa8fb('0x24')][_0xa8fb('0x42')]()==_0xa8fb('0x43')){var _0x14a01f=fs[_0xa8fb('0x44')](path[_0xa8fb('0x4e')](config[_0xa8fb('0x45')],'server/files/templates/stun_multiple.ejs'),_0xa8fb('0x50'));var _0x4d8fcb=ejs['render'](_0x14a01f,{'networks':_0x18d55f||[]});fs['writeFileSync'](_0xa8fb('0x49'),_0x4d8fcb);return respondWithRpcPromise(_0xa8fb('0x4a'),_0xa8fb('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x4a1731[_0xa8fb('0x24')][_0xa8fb('0x42')]()==_0xa8fb('0x52')){var _0x43eb2d=fs[_0xa8fb('0x44')](path[_0xa8fb('0x4e')](config[_0xa8fb('0x45')],_0xa8fb('0x4c')),'utf8');var _0x38a92f=ejs[_0xa8fb('0x47')](_0x43eb2d,{'networks':_0x18d55f||[]});fs[_0xa8fb('0x48')](_0xa8fb('0x4d'),_0x38a92f);return respondWithRpcPromise(_0xa8fb('0x4a'),_0xa8fb('0x1c'),{'module':_0xa8fb('0x4b')});}else{var _0x5ba7df=fs[_0xa8fb('0x44')](path[_0xa8fb('0x4e')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x459d17=ejs[_0xa8fb('0x47')](_0x5ba7df,{'networks':_0x18d55f||[]});fs['writeFileSync'](util[_0xa8fb('0x55')](_0xa8fb('0x53'),_0x4a1731[_0xa8fb('0x24')][_0xa8fb('0x51')]()),_0x459d17);return respondWithRpcPromise(_0xa8fb('0x4a'),_0xa8fb('0x1c'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x36733b,null));}; \ No newline at end of file +var _0x0108=['http','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','json','offset','undefined','limit','count','status','Content-Range','update','end','sendStatus','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','rawAttributes','Network','find','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','format','toLowerCase','Reload','chan_sip.so','params','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','STUN','destroy','util','path','ejs','lodash','api','../../config/environment','../../mysqldb','jayson/promise'];(function(_0x5a252f,_0x9b355d){var _0x246e5e=function(_0x3a3c3d){while(--_0x3a3c3d){_0x5a252f['push'](_0x5a252f['shift']());}};_0x246e5e(++_0x9b355d);}(_0x0108,0xa4));var _0x8010=function(_0xe2a1aa,_0x525d7b){_0xe2a1aa=_0xe2a1aa-0x0;var _0x5a8362=_0x0108[_0xe2a1aa];return _0x5a8362;};'use strict';var util=require(_0x8010('0x0'));var path=require(_0x8010('0x1'));var ejs=require(_0x8010('0x2'));var fs=require('fs');var _=require(_0x8010('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8010('0x4'));var config=require(_0x8010('0x5'));var db=require(_0x8010('0x6'))['db'];var jayson=require(_0x8010('0x7'));var client=jayson['client'][_0x8010('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bf73a,_0x5efa7b,_0x25f24b,_0x2e5bca){return new Promise(function(_0x47b28b,_0x5e496d){var _0x300c36=_0x2e5bca||client;return _0x300c36[_0x8010('0x9')](_0x4bf73a,_0x25f24b)[_0x8010('0xa')](function(_0x465b75){logger[_0x8010('0xb')](_0x8010('0xc'),_0x5efa7b,'request\x20sent');logger['debug'](_0x8010('0xd'),_0x5efa7b,_0x8010('0xe'),JSON[_0x8010('0xf')](_0x465b75));if(_0x465b75[_0x8010('0x10')]){if(_0x465b75[_0x8010('0x10')][_0x8010('0x11')]===0x1f4){logger[_0x8010('0x10')]('Network,\x20%s,\x20%s',_0x5efa7b,_0x465b75[_0x8010('0x10')][_0x8010('0x12')]);return _0x5e496d(_0x465b75[_0x8010('0x10')]['message']);}logger[_0x8010('0x10')](_0x8010('0xc'),_0x5efa7b,_0x465b75[_0x8010('0x10')][_0x8010('0x12')]);return _0x47b28b(_0x465b75[_0x8010('0x10')][_0x8010('0x12')]);}else{logger[_0x8010('0xb')](_0x8010('0xc'),_0x5efa7b,'request\x20sent');_0x47b28b(_0x465b75[_0x8010('0x13')][_0x8010('0x12')]);}})[_0x8010('0x14')](function(_0x2fcaf3){logger[_0x8010('0x10')](_0x8010('0xc'),_0x5efa7b,_0x2fcaf3);_0x5e496d(_0x2fcaf3);});});}function respondWithResult(_0x5bb6b7,_0x37d48f){_0x37d48f=_0x37d48f||0xc8;return function(_0x5393c2){if(_0x5393c2){return _0x5bb6b7['status'](_0x37d48f)[_0x8010('0x15')](_0x5393c2);}};}function respondWithFilteredResult(_0x35537b,_0x5848e0){return function(_0x14804d){if(_0x14804d){var _0x47ddaa=typeof _0x5848e0[_0x8010('0x16')]===_0x8010('0x17')&&typeof _0x5848e0[_0x8010('0x18')]===_0x8010('0x17');var _0x44f3e0=_0x14804d[_0x8010('0x19')];var _0x219870=_0x47ddaa?0x0:_0x5848e0[_0x8010('0x16')];var _0x275e7f=_0x47ddaa?_0x14804d[_0x8010('0x19')]:_0x5848e0[_0x8010('0x16')]+_0x5848e0[_0x8010('0x18')];var _0x3ddcca;if(_0x275e7f>=_0x44f3e0){_0x275e7f=_0x44f3e0;_0x3ddcca=0xc8;}else{_0x3ddcca=0xce;}_0x35537b[_0x8010('0x1a')](_0x3ddcca);return _0x35537b['set'](_0x8010('0x1b'),_0x219870+'-'+_0x275e7f+'/'+_0x44f3e0)[_0x8010('0x15')](_0x14804d);}return null;};}function saveUpdates(_0x119474){return function(_0x1e9181){if(_0x1e9181){return _0x1e9181[_0x8010('0x1c')](_0x119474)[_0x8010('0xa')](function(_0x2e0fda){return _0x2e0fda;});}return null;};}function removeEntity(_0x1c6231){return function(_0x45353f){if(_0x45353f){return _0x45353f['destroy']()[_0x8010('0xa')](function(){_0x1c6231[_0x8010('0x1a')](0xcc)[_0x8010('0x1d')]();});}};}function handleEntityNotFound(_0x59a570){return function(_0x1a6543){if(!_0x1a6543){_0x59a570[_0x8010('0x1e')](0x194);}return _0x1a6543;};}function handleError(_0x464e3e,_0x1a2690){_0x1a2690=_0x1a2690||0x1f4;return function(_0x1063ef){logger['error'](_0x1063ef[_0x8010('0x1f')]);if(_0x1063ef['name']){delete _0x1063ef[_0x8010('0x20')];}_0x464e3e[_0x8010('0x1a')](_0x1a2690)[_0x8010('0x21')](_0x1063ef);};}exports[_0x8010('0x22')]=function(_0x2ca7c9,_0x2bf77d){var _0x50f3f2={},_0x41ee51={},_0x7101cc={'count':0x0,'rows':[]};var _0x4edeb2=_['map'](db['Network']['rawAttributes'],function(_0x5ba0f5){return{'name':_0x5ba0f5[_0x8010('0x23')],'type':_0x5ba0f5[_0x8010('0x24')][_0x8010('0x25')]};});_0x41ee51[_0x8010('0x26')]=_[_0x8010('0x27')](_0x4edeb2,_0x8010('0x20'));_0x41ee51[_0x8010('0x28')]=_['keys'](_0x2ca7c9[_0x8010('0x28')]);_0x41ee51[_0x8010('0x29')]=_[_0x8010('0x2a')](_0x41ee51[_0x8010('0x26')],_0x41ee51[_0x8010('0x28')]);_0x50f3f2[_0x8010('0x2b')]=_[_0x8010('0x2a')](_0x41ee51['model'],qs['fields'](_0x2ca7c9[_0x8010('0x28')][_0x8010('0x2c')]));_0x50f3f2[_0x8010('0x2b')]=_0x50f3f2[_0x8010('0x2b')][_0x8010('0x2d')]?_0x50f3f2[_0x8010('0x2b')]:_0x41ee51[_0x8010('0x26')];if(!_0x2ca7c9['query'][_0x8010('0x2e')]('nolimit')){_0x50f3f2[_0x8010('0x18')]=qs['limit'](_0x2ca7c9[_0x8010('0x28')][_0x8010('0x18')]);_0x50f3f2['offset']=qs[_0x8010('0x16')](_0x2ca7c9[_0x8010('0x28')][_0x8010('0x16')]);}_0x50f3f2['order']=qs['sort'](_0x2ca7c9[_0x8010('0x28')]['sort']);_0x50f3f2[_0x8010('0x2f')]=qs[_0x8010('0x29')](_[_0x8010('0x30')](_0x2ca7c9[_0x8010('0x28')],_0x41ee51[_0x8010('0x29')]),_0x4edeb2);if(_0x2ca7c9['query'][_0x8010('0x31')]){_0x50f3f2[_0x8010('0x2f')]=_[_0x8010('0x32')](_0x50f3f2[_0x8010('0x2f')],{'$or':_[_0x8010('0x27')](_0x4edeb2,function(_0x201842){if(_0x201842[_0x8010('0x24')]!==_0x8010('0x33')){var _0x40355a={};_0x40355a[_0x201842[_0x8010('0x20')]]={'$like':'%'+_0x2ca7c9[_0x8010('0x28')][_0x8010('0x31')]+'%'};return _0x40355a;}})});}_0x50f3f2=_[_0x8010('0x32')]({},_0x50f3f2,_0x2ca7c9[_0x8010('0x34')]);var _0x5d627f={'where':_0x50f3f2['where']};return db['Network'][_0x8010('0x19')](_0x5d627f)[_0x8010('0xa')](function(_0x82892d){_0x7101cc[_0x8010('0x19')]=_0x82892d;if(_0x2ca7c9[_0x8010('0x28')][_0x8010('0x35')]){_0x50f3f2[_0x8010('0x36')]=[{'all':!![]}];}return db['Network'][_0x8010('0x37')](_0x50f3f2);})[_0x8010('0xa')](function(_0x2db19a){_0x7101cc[_0x8010('0x38')]=_0x2db19a;return _0x7101cc;})[_0x8010('0xa')](respondWithFilteredResult(_0x2bf77d,_0x50f3f2))[_0x8010('0x14')](handleError(_0x2bf77d,null));};exports[_0x8010('0x39')]=function(_0xb9d45b,_0x545312){var _0x22bee2={'raw':!![],'where':{'id':_0xb9d45b['params']['id']}},_0x7564c7={};_0x7564c7[_0x8010('0x26')]=_[_0x8010('0x3a')](db['Network'][_0x8010('0x3b')]);_0x7564c7[_0x8010('0x28')]=_[_0x8010('0x3a')](_0xb9d45b[_0x8010('0x28')]);_0x7564c7[_0x8010('0x29')]=_[_0x8010('0x2a')](_0x7564c7[_0x8010('0x26')],_0x7564c7[_0x8010('0x28')]);_0x22bee2['attributes']=_[_0x8010('0x2a')](_0x7564c7['model'],qs['fields'](_0xb9d45b[_0x8010('0x28')][_0x8010('0x2c')]));_0x22bee2[_0x8010('0x2b')]=_0x22bee2[_0x8010('0x2b')]['length']?_0x22bee2['attributes']:_0x7564c7['model'];if(_0xb9d45b[_0x8010('0x28')][_0x8010('0x35')]){_0x22bee2[_0x8010('0x36')]=[{'all':!![]}];}_0x22bee2=_['merge']({},_0x22bee2,_0xb9d45b[_0x8010('0x34')]);return db[_0x8010('0x3c')][_0x8010('0x3d')](_0x22bee2)[_0x8010('0xa')](handleEntityNotFound(_0x545312,null))[_0x8010('0xa')](respondWithResult(_0x545312,null))[_0x8010('0x14')](handleError(_0x545312,null));};exports[_0x8010('0x3e')]=function(_0x4cbeaf,_0x32d147){var _0x4d1192;return db[_0x8010('0x3c')][_0x8010('0x3e')](_0x4cbeaf['body'],{'raw':!![]})[_0x8010('0xa')](function(_0x111a9f){_0x4d1192=_0x111a9f;return db[_0x8010('0x3c')][_0x8010('0x37')]({'where':{'type':_0x4cbeaf[_0x8010('0x3f')]['type']},'raw':!![]});})['then'](function(_0x5467cc){if(_0x4d1192[_0x8010('0x24')][_0x8010('0x40')]()=='STUN'){var _0xcb5c3e=fs[_0x8010('0x41')](path[_0x8010('0x42')](config[_0x8010('0x43')],_0x8010('0x44')),_0x8010('0x45'));var _0x94a9f3=ejs[_0x8010('0x46')](_0xcb5c3e,{'networks':_0x5467cc||[]});fs['writeFileSync'](_0x8010('0x47'),_0x94a9f3);return respondWithRpcPromise('Reload','create',{'module':_0x8010('0x48')});}else if(_0x4d1192[_0x8010('0x24')]['toUpperCase']()==_0x8010('0x49')){var _0x3289b7=fs['readFileSync'](path[_0x8010('0x42')](config[_0x8010('0x43')],_0x8010('0x4a')),_0x8010('0x45'));var _0x1b2f6d=ejs['render'](_0x3289b7,{'networks':_0x5467cc||[]});fs[_0x8010('0x4b')](_0x8010('0x4c'),_0x1b2f6d);return respondWithRpcPromise('Reload',_0x8010('0x3e'),{'module':_0x8010('0x48')});}else{var _0x373a2f=fs[_0x8010('0x41')](path['join'](config[_0x8010('0x43')],'server/files/templates/network.ejs'),'utf8');var _0x4741b7=ejs['render'](_0x373a2f,{'networks':_0x5467cc||[]});fs[_0x8010('0x4b')](util[_0x8010('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x4cbeaf[_0x8010('0x3f')][_0x8010('0x24')][_0x8010('0x4e')]()),_0x4741b7);return respondWithRpcPromise(_0x8010('0x4f'),_0x8010('0x3e'),{'module':_0x8010('0x50')});}})[_0x8010('0xa')](function(){return _0x4d1192;})[_0x8010('0xa')](respondWithResult(_0x32d147,0xc9))['catch'](handleError(_0x32d147,null));};exports[_0x8010('0x1c')]=function(_0x243721,_0x29e685){var _0x288479;return db[_0x8010('0x3c')][_0x8010('0x3d')]({'where':{'id':_0x243721[_0x8010('0x51')]['id']}})['then'](handleEntityNotFound(_0x29e685,null))[_0x8010('0xa')](saveUpdates(_0x243721[_0x8010('0x3f')],null))[_0x8010('0xa')](function(_0x28279e){if(_0x28279e){_0x288479=_0x28279e;return db['Network'][_0x8010('0x37')]({'where':{'type':_0x288479['type']},'raw':!![]});}return null;})[_0x8010('0xa')](function(_0x776cce){if(_0x288479[_0x8010('0x24')][_0x8010('0x40')]()=='STUN'){var _0x217f04=fs[_0x8010('0x41')](path[_0x8010('0x42')](config[_0x8010('0x43')],_0x8010('0x44')),_0x8010('0x45'));var _0x382baf=ejs[_0x8010('0x46')](_0x217f04,{'networks':_0x776cce||[]});fs[_0x8010('0x4b')](_0x8010('0x47'),_0x382baf);return respondWithRpcPromise(_0x8010('0x4f'),'update',{'module':'res_stun_monitor.so'});}else if(_0x288479['type'][_0x8010('0x40')]()==_0x8010('0x49')){var _0x520f26=fs[_0x8010('0x41')](path[_0x8010('0x42')](config['root'],_0x8010('0x4a')),_0x8010('0x45'));var _0x21fb77=ejs[_0x8010('0x46')](_0x520f26,{'networks':_0x776cce||[]});fs[_0x8010('0x4b')](_0x8010('0x4c'),_0x21fb77);return respondWithRpcPromise(_0x8010('0x4f'),_0x8010('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x12493c=fs[_0x8010('0x41')](path['join'](config[_0x8010('0x43')],_0x8010('0x52')),_0x8010('0x45'));var _0x515277=ejs[_0x8010('0x46')](_0x12493c,{'networks':_0x776cce||[]});fs['writeFileSync'](util['format'](_0x8010('0x53'),_0x243721['body']['type'][_0x8010('0x4e')]()),_0x515277);return respondWithRpcPromise(_0x8010('0x4f'),_0x8010('0x1c'),{'module':_0x8010('0x50')});}})[_0x8010('0xa')](function(_0x639fa3){if(_0x639fa3){return _0x288479;}return null;})[_0x8010('0xa')](respondWithResult(_0x29e685,null))[_0x8010('0x14')](handleError(_0x29e685,null));};exports['destroy']=function(_0x4e6a8e,_0x4c72da){var _0x3e0ff7;return db[_0x8010('0x3c')][_0x8010('0x3d')]({'where':{'id':_0x4e6a8e['params']['id']}})[_0x8010('0xa')](function(_0x53391f){_0x3e0ff7=_0x53391f;return _0x53391f;})['then'](handleEntityNotFound(_0x4c72da,null))[_0x8010('0xa')](removeEntity(_0x4c72da,null))['then'](function(){if(_0x3e0ff7){return db[_0x8010('0x3c')]['findAll']({'where':{'type':_0x3e0ff7[_0x8010('0x24')]},'raw':!![]});}})[_0x8010('0xa')](function(_0x11cdc7){if(_0x3e0ff7[_0x8010('0x24')]['toUpperCase']()==_0x8010('0x54')){var _0x3e326e=fs[_0x8010('0x41')](path['join'](config[_0x8010('0x43')],_0x8010('0x44')),'utf8');var _0x15233a=ejs['render'](_0x3e326e,{'networks':_0x11cdc7||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x15233a);return respondWithRpcPromise(_0x8010('0x4f'),_0x8010('0x55'),{'module':_0x8010('0x48')});}else if(_0x3e0ff7[_0x8010('0x24')]['toUpperCase']()==_0x8010('0x49')){var _0x3bde59=fs[_0x8010('0x41')](path[_0x8010('0x42')](config[_0x8010('0x43')],_0x8010('0x4a')),_0x8010('0x45'));var _0x51c7d5=ejs[_0x8010('0x46')](_0x3bde59,{'networks':_0x11cdc7||[]});fs[_0x8010('0x4b')](_0x8010('0x4c'),_0x51c7d5);return respondWithRpcPromise(_0x8010('0x4f'),_0x8010('0x55'),{'module':_0x8010('0x48')});}else{var _0x4bea2f=fs['readFileSync'](path[_0x8010('0x42')](config['root'],_0x8010('0x52')),'utf8');var _0x8f7feb=ejs[_0x8010('0x46')](_0x4bea2f,{'networks':_0x11cdc7||[]});fs[_0x8010('0x4b')](util[_0x8010('0x4d')](_0x8010('0x53'),_0x3e0ff7[_0x8010('0x24')][_0x8010('0x4e')]()),_0x8f7feb);return respondWithRpcPromise(_0x8010('0x4f'),'destroy',{'module':_0x8010('0x50')});}})[_0x8010('0x14')](handleError(_0x4c72da,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 90b336b..6343842 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 _0x6a24=['util','api','moment','bluebird','request-promise','path','../../config/environment','./network.attributes','network','lodash'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x6a24,0xd1));var _0x46a2=function(_0x48fca8,_0x5f5d45){_0x48fca8=_0x48fca8-0x0;var _0x5c4ca8=_0x6a24[_0x48fca8];return _0x5c4ca8;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var logger=require('../../config/logger')(_0x46a2('0x2'));var moment=require(_0x46a2('0x3'));var BPromise=require(_0x46a2('0x4'));var rp=require(_0x46a2('0x5'));var fs=require('fs');var path=require(_0x46a2('0x6'));var rimraf=require('rimraf');var config=require(_0x46a2('0x7'));var attributes=require(_0x46a2('0x8'));module['exports']=function(_0x22de0d,_0x8b6541){return _0x22de0d['define']('Network',attributes,{'tableName':_0x46a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa699=['Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x352f07,_0x550a55){var _0x387eba=function(_0x1d337b){while(--_0x1d337b){_0x352f07['push'](_0x352f07['shift']());}};_0x387eba(++_0x550a55);}(_0xa699,0x6b));var _0x9a69=function(_0x47a5bd,_0x508329){_0x47a5bd=_0x47a5bd-0x0;var _0x5c2184=_0xa699[_0x47a5bd];return _0x5c2184;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var logger=require(_0x9a69('0x2'))(_0x9a69('0x3'));var moment=require(_0x9a69('0x4'));var BPromise=require(_0x9a69('0x5'));var rp=require(_0x9a69('0x6'));var fs=require('fs');var path=require(_0x9a69('0x7'));var rimraf=require(_0x9a69('0x8'));var config=require(_0x9a69('0x9'));var attributes=require(_0x9a69('0xa'));module[_0x9a69('0xb')]=function(_0x15f2fc,_0x58eb4d){return _0x15f2fc[_0x9a69('0xc')](_0x9a69('0xd'),attributes,{'tableName':_0x9a69('0xe'),'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 41b0a90..e6b1868 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x8a948,_0x38a94e){var _0x4c0039=function(_0x2c72b6){while(--_0x2c72b6){_0x8a948['push'](_0x8a948['shift']());}};_0x4c0039(++_0x38a94e);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x2bbf0f,_0xc8790d){_0x2bbf0f=_0x2bbf0f-0x0;var _0x538a6a=_0x7a54[_0x2bbf0f];return _0x538a6a;};'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 e76683f..cd78162 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 _0x46ec=['multer','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeAnswers','exports'];(function(_0x32f74b,_0x10ff30){var _0x505fc8=function(_0x8b0e4a){while(--_0x8b0e4a){_0x32f74b['push'](_0x32f74b['shift']());}};_0x505fc8(++_0x10ff30);}(_0x46ec,0xa5));var _0xc46e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x46ec[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc46e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc46e('0x1'));var express=require('express');var router=express[_0xc46e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc46e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc46e('0x4'));var controller=require('./openchannelAccount.controller');router[_0xc46e('0x5')]('/',auth['isAuthenticated'](),controller[_0xc46e('0x6')]);router[_0xc46e('0x5')](_0xc46e('0x7'),auth['isAuthenticated'](),controller[_0xc46e('0x8')]);router['get'](_0xc46e('0x9'),auth[_0xc46e('0xa')](),controller['show']);router[_0xc46e('0x5')](_0xc46e('0xb'),auth['isAuthenticated'](),controller[_0xc46e('0xc')]);router[_0xc46e('0x5')](_0xc46e('0xd'),auth[_0xc46e('0xa')](),controller['getAnswers']);router[_0xc46e('0x5')](_0xc46e('0xe'),auth['isAuthenticated'](),controller[_0xc46e('0xf')]);router[_0xc46e('0x5')](_0xc46e('0x10'),auth[_0xc46e('0xa')](),controller[_0xc46e('0x11')]);router['get'](_0xc46e('0x12'),auth[_0xc46e('0xa')](),controller[_0xc46e('0x13')]);router['post']('/',auth[_0xc46e('0xa')](),controller[_0xc46e('0x14')]);router[_0xc46e('0x15')](_0xc46e('0xb'),auth['isAuthenticated'](),controller[_0xc46e('0x16')]);router[_0xc46e('0x15')](_0xc46e('0xd'),auth[_0xc46e('0xa')](),controller[_0xc46e('0x17')]);router[_0xc46e('0x15')]('/:id/notify',controller['notify']);router['post'](_0xc46e('0xe'),auth['isAuthenticated'](),controller[_0xc46e('0x18')]);router['post']('/:id/users',auth[_0xc46e('0xa')](),controller[_0xc46e('0x19')]);router[_0xc46e('0x15')](_0xc46e('0x1a'),auth[_0xc46e('0xa')](),controller['send']);router[_0xc46e('0x1b')](_0xc46e('0x9'),auth[_0xc46e('0xa')](),controller[_0xc46e('0x1c')]);router[_0xc46e('0x1d')](_0xc46e('0x9'),auth[_0xc46e('0xa')](),controller[_0xc46e('0x1e')]);router[_0xc46e('0x1d')](_0xc46e('0xb'),auth[_0xc46e('0xa')](),controller['removeDispositions']);router[_0xc46e('0x1d')](_0xc46e('0xd'),auth[_0xc46e('0xa')](),controller[_0xc46e('0x1f')]);router[_0xc46e('0x1d')](_0xc46e('0x12'),auth[_0xc46e('0xa')](),controller['removeAgents']);module[_0xc46e('0x20')]=router; \ No newline at end of file +var _0x84f3=['../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','addAnswer','addApplications','/:id/users','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x84f3,0xb2));var _0x384f=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x84f3[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require(_0x384f('0x0'));var util=require(_0x384f('0x1'));var path=require('path');var timeout=require(_0x384f('0x2'));var express=require(_0x384f('0x3'));var router=express[_0x384f('0x4')]();var fs_extra=require(_0x384f('0x5'));var auth=require(_0x384f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x384f('0x7'));var controller=require(_0x384f('0x8'));router[_0x384f('0x9')]('/',auth[_0x384f('0xa')](),controller[_0x384f('0xb')]);router[_0x384f('0x9')]('/describe',auth[_0x384f('0xa')](),controller[_0x384f('0xc')]);router[_0x384f('0x9')](_0x384f('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x384f('0xe'),auth[_0x384f('0xa')](),controller['getDispositions']);router['get'](_0x384f('0xf'),auth['isAuthenticated'](),controller[_0x384f('0x10')]);router[_0x384f('0x9')](_0x384f('0x11'),auth[_0x384f('0xa')](),controller[_0x384f('0x12')]);router[_0x384f('0x9')](_0x384f('0x13'),auth[_0x384f('0xa')](),controller[_0x384f('0x14')]);router[_0x384f('0x9')]('/:id/users',auth[_0x384f('0xa')](),controller[_0x384f('0x15')]);router[_0x384f('0x16')]('/',auth[_0x384f('0xa')](),controller[_0x384f('0x17')]);router[_0x384f('0x16')](_0x384f('0xe'),auth[_0x384f('0xa')](),controller[_0x384f('0x18')]);router[_0x384f('0x16')](_0x384f('0xf'),auth[_0x384f('0xa')](),controller[_0x384f('0x19')]);router[_0x384f('0x16')]('/:id/notify',controller['notify']);router[_0x384f('0x16')]('/:id/applications',auth['isAuthenticated'](),controller[_0x384f('0x1a')]);router[_0x384f('0x16')](_0x384f('0x1b'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0x384f('0x1c'),auth['isAuthenticated'](),controller[_0x384f('0x1d')]);router[_0x384f('0x1e')](_0x384f('0xd'),auth[_0x384f('0xa')](),controller[_0x384f('0x1f')]);router[_0x384f('0x20')](_0x384f('0xd'),auth[_0x384f('0xa')](),controller[_0x384f('0x21')]);router[_0x384f('0x20')](_0x384f('0xe'),auth[_0x384f('0xa')](),controller[_0x384f('0x22')]);router[_0x384f('0x20')](_0x384f('0xf'),auth[_0x384f('0xa')](),controller[_0x384f('0x23')]);router['delete'](_0x384f('0x1b'),auth[_0x384f('0xa')](),controller['removeAgents']);module[_0x384f('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 4ac8b54..458e28a 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 _0x653e=['exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x38641d,_0xde6eb7){var _0x433463=function(_0x43dd3a){while(--_0x43dd3a){_0x38641d['push'](_0x38641d['shift']());}};_0x433463(++_0xde6eb7);}(_0x653e,0x6e));var _0xe653=function(_0x293a6b,_0x3b9ede){_0x293a6b=_0x293a6b-0x0;var _0x2d371c=_0x653e[_0x293a6b];return _0x2d371c;};'use strict';var Sequelize=require(_0xe653('0x0'));var rs=require(_0xe653('0x1'));module[_0xe653('0x2')]={'name':{'type':Sequelize[_0xe653('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe653('0x3')]},'token':{'type':Sequelize[_0xe653('0x3')],'defaultValue':function(){return rs[_0xe653('0x4')]();}},'replyUri':{'type':Sequelize[_0xe653('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe653('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe653('0x5')],'defaultValue':function(){return _0xe653('0x6');}},'notificationSound':{'type':Sequelize[_0xe653('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe653('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe653('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe653('0x3')]},'queueTransfer':{'type':Sequelize[_0xe653('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe653('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe653('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe653('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe653('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xe653('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xe653('0x7')],'defaultValue':![],'comment':_0xe653('0xa'),'set':function(_0x2bb0c0){if(!_0x2bb0c0)this[_0xe653('0xb')](_0xe653('0xc'),null);this[_0xe653('0xb')](_0xe653('0xd'),_0x2bb0c0);}}}; \ No newline at end of file +var _0x2cc4=['generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING'];(function(_0x556771,_0x2fb3f0){var _0x583a14=function(_0x5a30ae){while(--_0x5a30ae){_0x556771['push'](_0x556771['shift']());}};_0x583a14(++_0x2fb3f0);}(_0x2cc4,0x15a));var _0x42cc=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0x2cc4[_0x35d775];return _0x59384d;};'use strict';var Sequelize=require(_0x42cc('0x0'));var rs=require(_0x42cc('0x1'));module[_0x42cc('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x42cc('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x42cc('0x4')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x42cc('0x5')]();}},'replyUri':{'type':Sequelize[_0x42cc('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x42cc('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x42cc('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x42cc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x42cc('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x42cc('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x42cc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x42cc('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x42cc('0x7')],'defaultValue':![],'comment':_0x42cc('0x9'),'set':function(_0x1daacd){if(!_0x1daacd)this[_0x42cc('0xa')](_0x42cc('0xb'),null);this[_0x42cc('0xa')](_0x42cc('0xc'),_0x1daacd);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 4242b2d..85bd023 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 _0xc964=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','lastName','threadId','OpenchannelInteraction','externalUrl','spread','contact','firstName','messageId','interaction','created','autoclose','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','color','tag','addAgents','omit','userOpenchannelAccount:save','isArray','emit','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','./openchannelAccount.socket','register','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','get','OpenchannelAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model'];(function(_0x22a91c,_0x5ce13f){var _0x733c2f=function(_0x1ef119){while(--_0x1ef119){_0x22a91c['push'](_0x22a91c['shift']());}};_0x733c2f(++_0x5ce13f);}(_0xc964,0x7e));var _0x4c96=function(_0x186599,_0x3427da){_0x186599=_0x186599-0x0;var _0x25fb1b=_0xc964[_0x186599];return _0x25fb1b;};'use strict';var emlformat=require(_0x4c96('0x0'));var rimraf=require(_0x4c96('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c96('0x2'));var rp=require(_0x4c96('0x3'));var moment=require(_0x4c96('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4c96('0x5'));var util=require('util');var path=require(_0x4c96('0x6'));var sox=require(_0x4c96('0x7'));var csv=require(_0x4c96('0x8'));var ejs=require(_0x4c96('0x9'));var fs=require('fs');var fs_extra=require(_0x4c96('0xa'));var _=require(_0x4c96('0xb'));var squel=require(_0x4c96('0xc'));var crypto=require('crypto');var jsforce=require(_0x4c96('0xd'));var deskjs=require(_0x4c96('0xe'));var toCsv=require(_0x4c96('0x8'));var querystring=require('querystring');var Papa=require(_0x4c96('0xf'));var Redis=require(_0x4c96('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c96('0x11'));var logger=require(_0x4c96('0x12'))(_0x4c96('0x13'));var utils=require('../../config/utils');var config=require(_0x4c96('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4c96('0x15')]=_[_0x4c96('0x16')](config[_0x4c96('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c96('0x15')]));require(_0x4c96('0x17'))[_0x4c96('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4c96('0x19')][_0x4c96('0x1a')]({'port':0x232c});var client9002=jayson[_0x4c96('0x19')][_0x4c96('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x433608,_0x66964b,_0xeb18f3,_0x4a3fca){return new BPromise(function(_0x388237,_0x5eef93){var _0x2e8b8d=_0x4a3fca||client;return _0x2e8b8d['request'](_0x433608,_0xeb18f3)[_0x4c96('0x1b')](function(_0x494a26){logger[_0x4c96('0x1c')](_0x4c96('0x1d'),_0x66964b,_0x4c96('0x1e'));logger[_0x4c96('0x1f')](_0x4c96('0x20'),_0x66964b,_0x4c96('0x1e'),JSON[_0x4c96('0x21')](_0x494a26));if(_0x494a26[_0x4c96('0x22')]){if(_0x494a26[_0x4c96('0x22')][_0x4c96('0x23')]===0x1f4){logger[_0x4c96('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x66964b,_0x494a26['error']['message']);return _0x5eef93(_0x494a26[_0x4c96('0x22')][_0x4c96('0x24')]);}logger[_0x4c96('0x22')](_0x4c96('0x1d'),_0x66964b,_0x494a26[_0x4c96('0x22')][_0x4c96('0x24')]);return _0x388237(_0x494a26['error'][_0x4c96('0x24')]);}else{logger[_0x4c96('0x1c')](_0x4c96('0x1d'),_0x66964b,_0x4c96('0x1e'));_0x388237(_0x494a26[_0x4c96('0x25')][_0x4c96('0x24')]);}})['catch'](function(_0x367d99){logger[_0x4c96('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x66964b,_0x367d99);_0x5eef93(_0x367d99);});});}function respondWithStatusCode(_0x146f8a,_0x53ea2f){_0x53ea2f=_0x53ea2f||0xcc;return function(_0x2d8959){if(_0x2d8959){return _0x146f8a[_0x4c96('0x26')](_0x53ea2f);}return _0x146f8a[_0x4c96('0x27')](_0x53ea2f)[_0x4c96('0x28')]();};}function respondWithResult(_0x59a913,_0x20c94f){_0x20c94f=_0x20c94f||0xc8;return function(_0x80b4fb){if(_0x80b4fb){return _0x59a913[_0x4c96('0x27')](_0x20c94f)[_0x4c96('0x29')](_0x80b4fb);}};}function respondWithFilteredResult(_0x280c6b,_0x2c1d1a){return function(_0x57d5b9){if(_0x57d5b9){var _0x233610=typeof _0x2c1d1a[_0x4c96('0x2a')]===_0x4c96('0x2b')&&typeof _0x2c1d1a[_0x4c96('0x2c')]===_0x4c96('0x2b');var _0x1712c4=_0x57d5b9['count'];var _0x5e2683=_0x233610?0x0:_0x2c1d1a[_0x4c96('0x2a')];var _0x454252=_0x233610?_0x57d5b9[_0x4c96('0x2d')]:_0x2c1d1a[_0x4c96('0x2a')]+_0x2c1d1a[_0x4c96('0x2c')];var _0x5dee7c;if(_0x454252>=_0x1712c4){_0x454252=_0x1712c4;_0x5dee7c=0xc8;}else{_0x5dee7c=0xce;}_0x280c6b[_0x4c96('0x27')](_0x5dee7c);return _0x280c6b['set'](_0x4c96('0x2e'),_0x5e2683+'-'+_0x454252+'/'+_0x1712c4)['json'](_0x57d5b9);}return null;};}function patchUpdates(_0x1542cc){return function(_0x24253c){try{jsonpatch[_0x4c96('0x2f')](_0x24253c,_0x1542cc,!![]);}catch(_0xe68393){return BPromise[_0x4c96('0x30')](_0xe68393);}return _0x24253c[_0x4c96('0x31')]();};}function saveUpdates(_0x101faf,_0x4e622e){return function(_0x176ecf){if(_0x176ecf){return _0x176ecf[_0x4c96('0x32')](_0x101faf)[_0x4c96('0x1b')](function(_0x39a7ae){return _0x39a7ae;});}return null;};}function removeEntity(_0x4255c5,_0xa1e751){return function(_0x209274){if(_0x209274){return _0x209274['destroy']()[_0x4c96('0x1b')](function(){var _0x37efb9=_0x209274[_0x4c96('0x33')]({'plain':!![]});var _0x5d1dfd=_0x4c96('0x34');return db['UserProfileResource'][_0x4c96('0x35')]({'where':{'type':_0x5d1dfd,'resourceId':_0x37efb9['id']}})['then'](function(){return _0x209274;});})[_0x4c96('0x1b')](function(){_0x4255c5[_0x4c96('0x27')](0xcc)[_0x4c96('0x28')]();});}};}function handleEntityNotFound(_0x47c1ce,_0x5d0f4e){return function(_0x367230){if(!_0x367230){_0x47c1ce[_0x4c96('0x26')](0x194);}return _0x367230;};}function handleError(_0x4f9cad,_0x2ad06d){_0x2ad06d=_0x2ad06d||0x1f4;return function(_0x101670){logger[_0x4c96('0x22')](_0x101670[_0x4c96('0x36')]);if(_0x101670['name']){delete _0x101670[_0x4c96('0x37')];}_0x4f9cad[_0x4c96('0x27')](_0x2ad06d)[_0x4c96('0x38')](_0x101670);};}exports[_0x4c96('0x39')]=function(_0x2df399,_0x5be1c3){var _0x46a958={'include':[{'model':db[_0x4c96('0x3a')],'as':_0x4c96('0x3b')}]},_0x953d00={},_0x5615f2={'count':0x0,'rows':[]};var _0x17363d=_[_0x4c96('0x3c')](db[_0x4c96('0x3d')][_0x4c96('0x3e')],function(_0x197327){return{'name':_0x197327['fieldName'],'type':_0x197327[_0x4c96('0x3f')][_0x4c96('0x40')]};});_0x953d00[_0x4c96('0x41')]=_[_0x4c96('0x3c')](_0x17363d,_0x4c96('0x37'));_0x953d00[_0x4c96('0x42')]=_[_0x4c96('0x43')](_0x2df399[_0x4c96('0x42')]);_0x953d00[_0x4c96('0x44')]=_[_0x4c96('0x45')](_0x953d00['model'],_0x953d00[_0x4c96('0x42')]);_0x46a958[_0x4c96('0x46')]=_[_0x4c96('0x45')](_0x953d00[_0x4c96('0x41')],qs[_0x4c96('0x47')](_0x2df399['query'][_0x4c96('0x47')]));_0x46a958[_0x4c96('0x46')]=_0x46a958[_0x4c96('0x46')][_0x4c96('0x48')]?_0x46a958['attributes']:_0x953d00[_0x4c96('0x41')];if(!_0x2df399[_0x4c96('0x42')][_0x4c96('0x49')](_0x4c96('0x4a'))){_0x46a958[_0x4c96('0x2c')]=qs['limit'](_0x2df399[_0x4c96('0x42')][_0x4c96('0x2c')]);_0x46a958[_0x4c96('0x2a')]=qs[_0x4c96('0x2a')](_0x2df399[_0x4c96('0x42')]['offset']);}_0x46a958['order']=qs[_0x4c96('0x4b')](_0x2df399['query']['sort']);_0x46a958[_0x4c96('0x4c')]=qs[_0x4c96('0x44')](_[_0x4c96('0x4d')](_0x2df399[_0x4c96('0x42')],_0x953d00[_0x4c96('0x44')]),_0x17363d);if(_0x2df399[_0x4c96('0x42')][_0x4c96('0x4e')]){_0x46a958[_0x4c96('0x4c')]=_[_0x4c96('0x4f')](_0x46a958['where'],{'$or':_[_0x4c96('0x3c')](_0x17363d,function(_0x3f52ce){if(_0x3f52ce[_0x4c96('0x3f')]!==_0x4c96('0x50')){var _0x39be8f={};_0x39be8f[_0x3f52ce['name']]={'$like':'%'+_0x2df399[_0x4c96('0x42')][_0x4c96('0x4e')]+'%'};return _0x39be8f;}})});}_0x46a958=_['merge']({},_0x46a958,_0x2df399['options']);var _0x106620={'where':_0x46a958[_0x4c96('0x4c')]};return db[_0x4c96('0x3d')]['count'](_0x106620)[_0x4c96('0x1b')](function(_0x43d202){_0x5615f2['count']=_0x43d202;if(_0x2df399[_0x4c96('0x42')][_0x4c96('0x51')]){_0x46a958[_0x4c96('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x46a958);})['then'](function(_0x5e60f6){_0x5615f2[_0x4c96('0x53')]=_0x5e60f6;return _0x5615f2;})[_0x4c96('0x1b')](respondWithFilteredResult(_0x5be1c3,_0x46a958))[_0x4c96('0x54')](handleError(_0x5be1c3,null));};exports[_0x4c96('0x55')]=function(_0x3df197,_0x2417af){var _0x175a8a={'raw':![],'where':{'id':_0x3df197[_0x4c96('0x56')]['id']},'include':[{'model':db[_0x4c96('0x3a')],'as':_0x4c96('0x3b')}]},_0x10c05a={};_0x10c05a[_0x4c96('0x41')]=_['keys'](db['OpenchannelAccount'][_0x4c96('0x3e')]);_0x10c05a[_0x4c96('0x42')]=_['keys'](_0x3df197[_0x4c96('0x42')]);_0x10c05a[_0x4c96('0x44')]=_[_0x4c96('0x45')](_0x10c05a[_0x4c96('0x41')],_0x10c05a[_0x4c96('0x42')]);_0x175a8a[_0x4c96('0x46')]=_['intersection'](_0x10c05a[_0x4c96('0x41')],qs['fields'](_0x3df197[_0x4c96('0x42')][_0x4c96('0x47')]));_0x175a8a[_0x4c96('0x46')]=_0x175a8a[_0x4c96('0x46')][_0x4c96('0x48')]?_0x175a8a[_0x4c96('0x46')]:_0x10c05a['model'];if(_0x3df197[_0x4c96('0x42')][_0x4c96('0x51')]){_0x175a8a[_0x4c96('0x52')]=[{'all':!![]}];}_0x175a8a=_['merge']({},_0x175a8a,_0x3df197[_0x4c96('0x57')]);return db['OpenchannelAccount'][_0x4c96('0x58')](_0x175a8a)[_0x4c96('0x1b')](handleEntityNotFound(_0x2417af,null))['then'](respondWithResult(_0x2417af,null))['catch'](handleError(_0x2417af,null));};exports[_0x4c96('0x59')]=function(_0x3812fc,_0x360592){return db[_0x4c96('0x3d')][_0x4c96('0x59')](_0x3812fc[_0x4c96('0x5a')],{})['then'](function(_0x211b59){var _0x2f003b=_0x3812fc[_0x4c96('0x5b')][_0x4c96('0x33')]({'plain':!![]});if(!_0x2f003b)throw new Error(_0x4c96('0x5c'));if(_0x2f003b['role']===_0x4c96('0x5b')){var _0x22dda3=_0x211b59[_0x4c96('0x33')]({'plain':!![]});var _0x428643='OpenchannelAccounts';return db[_0x4c96('0x5d')][_0x4c96('0x58')]({'where':{'name':_0x428643,'userProfileId':_0x2f003b[_0x4c96('0x5e')]},'raw':!![]})[_0x4c96('0x1b')](function(_0x5337c2){if(_0x5337c2&&_0x5337c2['autoAssociation']===0x0){return db[_0x4c96('0x5f')]['create']({'name':_0x22dda3[_0x4c96('0x37')],'resourceId':_0x22dda3['id'],'type':_0x5337c2[_0x4c96('0x37')],'sectionId':_0x5337c2['id']},{})['then'](function(){return _0x211b59;});}else{return _0x211b59;}})[_0x4c96('0x54')](function(_0x36a2ef){logger[_0x4c96('0x22')](_0x4c96('0x60'),_0x36a2ef);throw _0x36a2ef;});}return _0x211b59;})[_0x4c96('0x1b')](respondWithResult(_0x360592,0xc9))[_0x4c96('0x54')](handleError(_0x360592,null));};exports[_0x4c96('0x32')]=function(_0x25e57e,_0x1e620d){if(_0x25e57e[_0x4c96('0x5a')]['id']){delete _0x25e57e[_0x4c96('0x5a')]['id'];}return db[_0x4c96('0x3d')][_0x4c96('0x58')]({'where':{'id':_0x25e57e[_0x4c96('0x56')]['id']},'include':[{'model':db[_0x4c96('0x3a')],'as':_0x4c96('0x3b')}]})[_0x4c96('0x1b')](handleEntityNotFound(_0x1e620d,null))[_0x4c96('0x1b')](saveUpdates(_0x25e57e[_0x4c96('0x5a')],null))[_0x4c96('0x1b')](respondWithResult(_0x1e620d,null))['catch'](handleError(_0x1e620d,null));};exports[_0x4c96('0x35')]=function(_0x4f2d3c,_0x2e9231){return db[_0x4c96('0x3d')][_0x4c96('0x58')]({'where':{'id':_0x4f2d3c['params']['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0x2e9231,null))[_0x4c96('0x1b')](removeEntity(_0x2e9231,null))['catch'](handleError(_0x2e9231,null));};exports['describe']=function(_0x18aef1,_0x625761){return db[_0x4c96('0x3d')][_0x4c96('0x61')]()[_0x4c96('0x1b')](respondWithResult(_0x625761,null))['catch'](handleError(_0x625761,null));};exports[_0x4c96('0x62')]=function(_0x2708fb,_0x412814,_0x3d95f3){if(_0x2708fb[_0x4c96('0x5a')]['id']){delete _0x2708fb[_0x4c96('0x5a')]['id'];}return db[_0x4c96('0x3d')][_0x4c96('0x58')]({'where':{'id':_0x2708fb[_0x4c96('0x56')]['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0x412814,null))['then'](function(_0x553a46){if(_0x553a46){_0x2708fb[_0x4c96('0x5a')][_0x4c96('0x63')]=_0x553a46['id'];return db[_0x4c96('0x64')][_0x4c96('0x59')](_0x2708fb['body']);}})[_0x4c96('0x1b')](respondWithResult(_0x412814,null))['catch'](handleError(_0x412814,null));};exports[_0x4c96('0x65')]=function(_0x4b5dd7,_0x457e7b,_0xbf27ff){var _0x1fc5cb={'raw':![],'where':{}};var _0x5e1e45={};var _0x2518bc={'count':0x0,'rows':[]};return db[_0x4c96('0x3d')][_0x4c96('0x66')]({'where':{'id':_0x4b5dd7[_0x4c96('0x56')]['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0x457e7b,null))[_0x4c96('0x1b')](function(_0x35c3d2){if(_0x35c3d2){_0x5e1e45[_0x4c96('0x41')]=_[_0x4c96('0x43')](db[_0x4c96('0x64')]['rawAttributes']);_0x5e1e45[_0x4c96('0x42')]=_[_0x4c96('0x43')](_0x4b5dd7[_0x4c96('0x42')]);_0x5e1e45[_0x4c96('0x44')]=_[_0x4c96('0x45')](_0x5e1e45[_0x4c96('0x41')],_0x5e1e45['query']);_0x1fc5cb[_0x4c96('0x46')]=_['intersection'](_0x5e1e45[_0x4c96('0x41')],qs[_0x4c96('0x47')](_0x4b5dd7[_0x4c96('0x42')]['fields']));_0x1fc5cb[_0x4c96('0x46')]=_0x1fc5cb[_0x4c96('0x46')][_0x4c96('0x48')]?_0x1fc5cb[_0x4c96('0x46')]:_0x5e1e45[_0x4c96('0x41')];if(!_0x4b5dd7['query']['hasOwnProperty'](_0x4c96('0x4a'))){_0x1fc5cb[_0x4c96('0x2c')]=qs[_0x4c96('0x2c')](_0x4b5dd7[_0x4c96('0x42')][_0x4c96('0x2c')]);_0x1fc5cb[_0x4c96('0x2a')]=qs['offset'](_0x4b5dd7[_0x4c96('0x42')][_0x4c96('0x2a')]);}_0x1fc5cb[_0x4c96('0x67')]=qs[_0x4c96('0x4b')](_0x4b5dd7[_0x4c96('0x42')][_0x4c96('0x4b')]);_0x1fc5cb[_0x4c96('0x4c')]=qs[_0x4c96('0x44')](_['pick'](_0x4b5dd7[_0x4c96('0x42')],_0x5e1e45[_0x4c96('0x44')]));_0x1fc5cb['where'][_0x4c96('0x63')]=_0x35c3d2['id'];if(_0x4b5dd7[_0x4c96('0x42')][_0x4c96('0x4e')]){_0x1fc5cb['where']=_[_0x4c96('0x4f')](_0x1fc5cb['where'],{'$or':_[_0x4c96('0x3c')](_0x1fc5cb['attributes'],function(_0x3eebc6){var _0x401c0d={};_0x401c0d[_0x3eebc6]={'$like':'%'+_0x4b5dd7[_0x4c96('0x42')]['filter']+'%'};return _0x401c0d;})});}_0x1fc5cb=_['merge']({},_0x1fc5cb,_0x4b5dd7[_0x4c96('0x57')]);return db[_0x4c96('0x64')][_0x4c96('0x2d')]({'where':_0x1fc5cb[_0x4c96('0x4c')]})['then'](function(_0x51f3ed){_0x2518bc['count']=_0x51f3ed;if(_0x4b5dd7['query']['includeAll']){_0x1fc5cb[_0x4c96('0x52')]=[{'all':!![]}];}return db[_0x4c96('0x64')][_0x4c96('0x68')](_0x1fc5cb);})[_0x4c96('0x1b')](function(_0x2593cb){_0x2518bc[_0x4c96('0x53')]=_0x2593cb;return _0x2518bc;});}})['then'](respondWithFilteredResult(_0x457e7b,_0x1fc5cb))[_0x4c96('0x54')](handleError(_0x457e7b,null));};exports[_0x4c96('0x69')]=function(_0x308361,_0x17bbd8,_0x74935f){return db[_0x4c96('0x3d')]['find']({'where':{'id':_0x308361[_0x4c96('0x56')]['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0x17bbd8,null))[_0x4c96('0x1b')](function(_0x241db5){if(_0x241db5){return _0x241db5[_0x4c96('0x69')](_0x308361[_0x4c96('0x42')][_0x4c96('0x6a')]);}})['then'](respondWithStatusCode(_0x17bbd8,null))[_0x4c96('0x54')](handleError(_0x17bbd8,null));};exports[_0x4c96('0x6b')]=function(_0x1587c7,_0x382720,_0x5cc4cc){if(_0x1587c7['body']['id']){delete _0x1587c7[_0x4c96('0x5a')]['id'];}return db[_0x4c96('0x3d')][_0x4c96('0x58')]({'where':{'id':_0x1587c7['params']['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0x382720,null))[_0x4c96('0x1b')](function(_0x165f11){if(_0x165f11){_0x1587c7[_0x4c96('0x5a')][_0x4c96('0x63')]=_0x165f11['id'];return db[_0x4c96('0x6c')]['create'](_0x1587c7[_0x4c96('0x5a')]);}})['then'](respondWithResult(_0x382720,null))[_0x4c96('0x54')](handleError(_0x382720,null));};exports[_0x4c96('0x6d')]=function(_0x303f8d,_0x10887d,_0x293f22){var _0x47bb03={'raw':![],'where':{}};var _0x5bb2dc={};var _0xbd2102={'count':0x0,'rows':[]};return db[_0x4c96('0x3d')][_0x4c96('0x66')]({'where':{'id':_0x303f8d[_0x4c96('0x56')]['id']}})['then'](handleEntityNotFound(_0x10887d,null))[_0x4c96('0x1b')](function(_0x1dcb01){if(_0x1dcb01){_0x5bb2dc[_0x4c96('0x41')]=_[_0x4c96('0x43')](db['CannedAnswer']['rawAttributes']);_0x5bb2dc[_0x4c96('0x42')]=_[_0x4c96('0x43')](_0x303f8d[_0x4c96('0x42')]);_0x5bb2dc[_0x4c96('0x44')]=_['intersection'](_0x5bb2dc['model'],_0x5bb2dc['query']);_0x47bb03[_0x4c96('0x46')]=_['intersection'](_0x5bb2dc['model'],qs['fields'](_0x303f8d[_0x4c96('0x42')][_0x4c96('0x47')]));_0x47bb03[_0x4c96('0x46')]=_0x47bb03[_0x4c96('0x46')][_0x4c96('0x48')]?_0x47bb03['attributes']:_0x5bb2dc['model'];if(!_0x303f8d[_0x4c96('0x42')][_0x4c96('0x49')](_0x4c96('0x4a'))){_0x47bb03['limit']=qs[_0x4c96('0x2c')](_0x303f8d[_0x4c96('0x42')][_0x4c96('0x2c')]);_0x47bb03[_0x4c96('0x2a')]=qs['offset'](_0x303f8d[_0x4c96('0x42')][_0x4c96('0x2a')]);}_0x47bb03[_0x4c96('0x67')]=qs[_0x4c96('0x4b')](_0x303f8d[_0x4c96('0x42')][_0x4c96('0x4b')]);_0x47bb03['where']=qs['filters'](_['pick'](_0x303f8d[_0x4c96('0x42')],_0x5bb2dc[_0x4c96('0x44')]));_0x47bb03[_0x4c96('0x4c')][_0x4c96('0x63')]=_0x1dcb01['id'];if(_0x303f8d[_0x4c96('0x42')][_0x4c96('0x4e')]){_0x47bb03[_0x4c96('0x4c')]=_[_0x4c96('0x4f')](_0x47bb03[_0x4c96('0x4c')],{'$or':_[_0x4c96('0x3c')](_0x47bb03[_0x4c96('0x46')],function(_0x44b22c){var _0x20d60b={};_0x20d60b[_0x44b22c]={'$like':'%'+_0x303f8d['query'][_0x4c96('0x4e')]+'%'};return _0x20d60b;})});}_0x47bb03=_[_0x4c96('0x4f')]({},_0x47bb03,_0x303f8d[_0x4c96('0x57')]);return db[_0x4c96('0x6c')]['count']({'where':_0x47bb03[_0x4c96('0x4c')]})[_0x4c96('0x1b')](function(_0x53f8e1){_0xbd2102[_0x4c96('0x2d')]=_0x53f8e1;if(_0x303f8d[_0x4c96('0x42')]['includeAll']){_0x47bb03[_0x4c96('0x52')]=[{'all':!![]}];}return db[_0x4c96('0x6c')]['findAll'](_0x47bb03);})[_0x4c96('0x1b')](function(_0x59226a){_0xbd2102[_0x4c96('0x53')]=_0x59226a;return _0xbd2102;});}})[_0x4c96('0x1b')](respondWithFilteredResult(_0x10887d,_0x47bb03))['catch'](handleError(_0x10887d,null));};exports[_0x4c96('0x6e')]=function(_0x699c93,_0xdb3a74,_0x24eb26){return db[_0x4c96('0x3d')][_0x4c96('0x58')]({'where':{'id':_0x699c93[_0x4c96('0x56')]['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0xdb3a74,null))[_0x4c96('0x1b')](function(_0x44b0a7){if(_0x44b0a7){return _0x44b0a7[_0x4c96('0x6e')](_0x699c93[_0x4c96('0x42')][_0x4c96('0x6a')]);}})[_0x4c96('0x1b')](respondWithStatusCode(_0xdb3a74,null))[_0x4c96('0x54')](handleError(_0xdb3a74,null));};exports['notify']=function(_0x50d60c,_0x2f44da,_0xc28191){var _0x15eafe={'body':_0x50d60c[_0x4c96('0x5a')],'channel':_0x4c96('0x6f')};var _0x37f937=[];var _0xf69c5a=[];var _0x4e4eb2={};var _0x345b7a=![];return db[_0x4c96('0x70')]['describe']()[_0x4c96('0x1b')](function(_0x5bb21f){if(!_0x5bb21f){throw new db[(_0x4c96('0x71'))][(_0x4c96('0x72'))](_0x4c96('0x73'));}_0x37f937=_['difference'](_[_0x4c96('0x43')](_0x5bb21f),[_0x4c96('0x74'),_0x4c96('0x75')]);_0xf69c5a=_[_0x4c96('0x76')](_[_0x4c96('0x43')](_0x5bb21f),[_0x4c96('0x74'),'updatedAt',_0x4c96('0x77'),_0x4c96('0x78')]);if(_0x50d60c[_0x4c96('0x5a')]['id']){delete _0x50d60c[_0x4c96('0x5a')]['id'];}if(_['isNil'](_0x50d60c['body'][_0x4c96('0x79')])){throw new db[(_0x4c96('0x71'))][(_0x4c96('0x72'))](_0x4c96('0x7a'));}if(_['isNil'](_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x5a')])||_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x5a')]===''){throw new db['Sequelize']['ValidationError'](_0x4c96('0x7b'));}if(_[_0x4c96('0x7c')](_0x50d60c['body'][_0x4c96('0x7d')])){throw new db['Sequelize'][(_0x4c96('0x72'))](_0x4c96('0x7e')+_0xf69c5a);}if(!_[_0x4c96('0x7f')](_0xf69c5a,_0x50d60c['body'][_0x4c96('0x7d')])){throw new db[(_0x4c96('0x71'))]['ValidationError'](_0x4c96('0x80')+_0xf69c5a);}_0x4e4eb2[_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x7d')]]=_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x79')];})['then'](function(){return db['OpenchannelAccount'][_0x4c96('0x58')]({'where':{'id':_0x50d60c[_0x4c96('0x56')]['id']},'include':[{'model':db[_0x4c96('0x81')],'as':_0x4c96('0x82'),'include':[{'model':db[_0x4c96('0x70')],'as':_0x4c96('0x83'),'where':_0x4e4eb2,'limit':0x1,'order':[[_0x4c96('0x75'),_0x4c96('0x84')]]}]},{'model':db[_0x4c96('0x85')],'as':_0x4c96('0x86')}]});})[_0x4c96('0x1b')](handleEntityNotFound(_0x2f44da,null))['then'](function(_0x183175){if(_0x183175&&_0x183175[_0x4c96('0x82')]){_0x15eafe[_0x4c96('0x87')]=_0x183175;_0x15eafe[_0x4c96('0x88')]=_0x183175['Applications'];_0x15eafe['list']=_0x183175[_0x4c96('0x82')];_0x15eafe[_0x4c96('0x88')]=_[_0x4c96('0x89')](_0x15eafe[_0x4c96('0x88')],[_0x4c96('0x8a')],[_0x4c96('0x8b')]);if(_0x15eafe['account'][_0x4c96('0x86')]){delete _0x15eafe[_0x4c96('0x87')][_0x4c96('0x86')];}if(_0x15eafe[_0x4c96('0x87')]['List']&&_0x15eafe['account']['List'][_0x4c96('0x83')][_0x4c96('0x48')]){return _0x15eafe[_0x4c96('0x87')]['List'][_0x4c96('0x83')][0x0];}var _0x5815f2=_['defaults'](_0x50d60c[_0x4c96('0x5a')],{'firstName':_0x50d60c['body'][_0x4c96('0x79')],'ListId':_0x183175['ListId']});_0x5815f2[_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x7d')]]=_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x79')];return db[_0x4c96('0x70')][_0x4c96('0x59')](_0x5815f2,{'fields':_0x37f937,'raw':!![]});}})['then'](handleEntityNotFound(_0x2f44da,null))[_0x4c96('0x1b')](function(_0x13c2cc){_0x15eafe['contact']=_0x13c2cc;if(_0x13c2cc){var _0x48906f={'ContactId':_0x13c2cc['id'],'OpenchannelAccountId':_0x50d60c[_0x4c96('0x56')]['id'],'from':(_0x13c2cc['firstName']||'')+'\x20'+(_0x13c2cc[_0x4c96('0x8c')]||'')};var _0x464e83={'OpenchannelAccountId':_0x50d60c[_0x4c96('0x56')]['id'],'closed':![]};if(_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x8d')]){_0x464e83[_0x4c96('0x8d')]=_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x8d')];return db[_0x4c96('0x8e')]['find']({'where':_0x464e83})[_0x4c96('0x1b')](function(_0x3ec633){if(_0x3ec633){return[_0x3ec633,![]];}_0x48906f[_0x4c96('0x8d')]=_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x8d')];_0x48906f[_0x4c96('0x8f')]=_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x8f')];return db[_0x4c96('0x8e')][_0x4c96('0x59')](_0x48906f)[_0x4c96('0x1b')](function(_0x43e12d){return[_0x43e12d,!![]];});});}else{_0x464e83[_0x4c96('0x8d')]=null;}_0x464e83['ContactId']=_0x13c2cc['id'];return db[_0x4c96('0x8e')][_0x4c96('0x58')]({'where':_0x464e83})[_0x4c96('0x1b')](function(_0x40b229){if(_0x40b229){return[_0x40b229,![]];}return db[_0x4c96('0x8e')][_0x4c96('0x59')](_0x48906f)[_0x4c96('0x1b')](function(_0x34b299){return[_0x34b299,!![]];});});}})[_0x4c96('0x90')](function(_0x324e8c,_0x5e2495){if(_0x324e8c){_0x345b7a=_0x5e2495;if(!_0x5e2495){var _0x799fd={'from':(_0x15eafe[_0x4c96('0x91')][_0x4c96('0x92')]||'')+'\x20'+(_0x15eafe[_0x4c96('0x91')][_0x4c96('0x8c')]||'')};if(_0x50d60c['body'][_0x4c96('0x8d')]&&_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x93')]&&_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x8d')]!=_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x93')]){_0x799fd[_0x4c96('0x8d')]=_0x50d60c[_0x4c96('0x5a')]['messageId'];}return _0x324e8c['update'](_0x799fd);}else{return _0x324e8c;}}})[_0x4c96('0x1b')](function(_0x2732de){_0x15eafe[_0x4c96('0x94')]=_0x2732de['get']({'plain':!![]});_0x15eafe[_0x4c96('0x94')][_0x4c96('0x95')]=_0x345b7a;if(_0x15eafe[_0x4c96('0x94')][_0x4c96('0x95')]){if(_0x15eafe[_0x4c96('0x87')][_0x4c96('0x96')]){_0x15eafe['applications']['push']({'id':0x0,'priority':_0x15eafe[_0x4c96('0x88')][_0x4c96('0x48')]+0x1,'app':'close','appdata':_0x4c96('0x97'),'interval':_0x4c96('0x98')});}}return db['OpenchannelMessage'][_0x4c96('0x59')]({'body':_0x50d60c[_0x4c96('0x5a')][_0x4c96('0x5a')],'OpenchannelAccountId':_0x50d60c[_0x4c96('0x56')]['id'],'OpenchannelInteractionId':_0x2732de['id'],'direction':'in','ContactId':_0x15eafe[_0x4c96('0x91')]['id'],'AttachmentId':_0x50d60c['body'][_0x4c96('0x99')]});})['then'](function(_0x303cdb){_0x15eafe[_0x4c96('0x24')]=_0x303cdb;if(_0x15eafe[_0x4c96('0x94')][_0x4c96('0x9a')]){return db[_0x4c96('0x9b')][_0x4c96('0x58')]({'attributes':['id','name'],'where':{'id':_0x15eafe[_0x4c96('0x94')]['UserId']}})[_0x4c96('0x1b')](function(_0x13957e){if(_0x13957e){_0x15eafe[_0x4c96('0x88')][_0x4c96('0x9c')]({'id':0x0,'priority':0x0,'app':_0x4c96('0x9d'),'appdata':_0x13957e[_0x4c96('0x37')]+','+(_0x15eafe[_0x4c96('0x87')][_0x4c96('0x9e')]||0xa),'interval':_0x4c96('0x98')});_0x15eafe[_0x4c96('0x9f')]=![];}return respondWithRpcPromise('Start',_0x4c96('0xa0'),_0x15eafe);});}return respondWithRpcPromise(_0x4c96('0xa1'),'startRouting',_0x15eafe);})[_0x4c96('0x1b')](function(_0x24e697){respondWithRpcPromise(_0x4c96('0xa2'),_0x4c96('0xa2'),{'event':'notify','message':_0x24e697},client9002);return _0x24e697;})['then'](respondWithResult(_0x2f44da,null))[_0x4c96('0x54')](handleError(_0x2f44da,null));};exports[_0x4c96('0xa3')]=function(_0x462716,_0x5a4288){var _0x62c66a=_0x462716[_0x4c96('0x56')]['id'];var _0x47ae51=_0x462716[_0x4c96('0x5a')];var _0x5acb3c=0xc8;var _0x344806=null;return db[_0x4c96('0xa4')][_0x4c96('0xa5')]({'isolationLevel':db[_0x4c96('0xa4')][_0x4c96('0xa6')][_0x4c96('0xa7')][_0x4c96('0xa8')]},function(_0x14f0be){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x62c66a},'transaction':_0x14f0be})[_0x4c96('0x1b')](function(_0x137df0){if(_0x137df0){return db[_0x4c96('0x85')][_0x4c96('0x35')]({'where':{'OpenchannelAccountId':_0x62c66a},'transaction':_0x14f0be})[_0x4c96('0x1b')](function(){var _0x373b1f=_[_0x4c96('0x3c')](_0x47ae51,function(_0x466ecb){_0x466ecb['OpenchannelAccountId']=_0x62c66a;return _0x466ecb;});return db['OpenchannelApplication'][_0x4c96('0xa9')](_0x373b1f,{'transaction':_0x14f0be});});}else{_0x5acb3c=0x194;_0x344806=[];}});})[_0x4c96('0x1b')](function(){if(_0x5acb3c!==0x194){return db[_0x4c96('0x85')][_0x4c96('0xaa')]({'where':{'OpenchannelAccountId':_0x62c66a},'order':'priority'})[_0x4c96('0x1b')](function(_0x4f4015){_0x344806=_0x4f4015;});}})[_0x4c96('0x54')](function(_0x45beae){_0x5acb3c=0x1f4;logger[_0x4c96('0x22')](_0x45beae['stack']);if(_0x45beae[_0x4c96('0x37')]){delete _0x45beae[_0x4c96('0x37')];}_0x344806=_0x45beae;})[_0x4c96('0xab')](function(){if(_0x344806===null){_0x5a4288[_0x4c96('0x26')](_0x5acb3c);}else{if(_0x5acb3c===0x1f4){_0x5a4288[_0x4c96('0x27')](_0x5acb3c)[_0x4c96('0x38')](_0x344806);}else{_0x5a4288[_0x4c96('0x27')](_0x5acb3c)[_0x4c96('0x29')](_0x344806);}}});};exports[_0x4c96('0xac')]=function(_0x117014,_0x1729cd,_0x501e2d){var _0x1a065d={};var _0x52b290={};var _0x48b7c9;var _0x4420f9;return db[_0x4c96('0x3d')][_0x4c96('0x66')]({'where':{'id':_0x117014[_0x4c96('0x56')]['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0x1729cd,null))[_0x4c96('0x1b')](function(_0x478f4d){if(_0x478f4d){_0x48b7c9=_0x478f4d;_0x52b290[_0x4c96('0x41')]=_['keys'](db[_0x4c96('0x85')][_0x4c96('0x3e')]);_0x52b290[_0x4c96('0x42')]=_['keys'](_0x117014['query']);_0x52b290['filters']=_[_0x4c96('0x45')](_0x52b290[_0x4c96('0x41')],_0x52b290[_0x4c96('0x42')]);_0x1a065d[_0x4c96('0x46')]=_[_0x4c96('0x45')](_0x52b290['model'],qs[_0x4c96('0x47')](_0x117014[_0x4c96('0x42')][_0x4c96('0x47')]));_0x1a065d[_0x4c96('0x46')]=_0x1a065d['attributes'][_0x4c96('0x48')]?_0x1a065d[_0x4c96('0x46')]:_0x52b290['model'];_0x1a065d[_0x4c96('0x67')]=qs[_0x4c96('0x4b')](_0x117014[_0x4c96('0x42')][_0x4c96('0x4b')]);_0x1a065d[_0x4c96('0x4c')]=qs[_0x4c96('0x44')](_[_0x4c96('0x4d')](_0x117014['query'],_0x52b290[_0x4c96('0x44')]));if(_0x117014[_0x4c96('0x42')][_0x4c96('0x4e')]){_0x1a065d[_0x4c96('0x4c')]=_[_0x4c96('0x4f')](_0x1a065d[_0x4c96('0x4c')],{'$or':_[_0x4c96('0x3c')](_0x1a065d[_0x4c96('0x46')],function(_0x3c76c2){var _0x2c79e1={};_0x2c79e1[_0x3c76c2]={'$like':'%'+_0x117014[_0x4c96('0x42')][_0x4c96('0x4e')]+'%'};return _0x2c79e1;})});}_0x1a065d=_['merge']({},_0x1a065d,_0x117014[_0x4c96('0x57')]);return _0x48b7c9[_0x4c96('0xac')](_0x1a065d);}})['then'](function(_0xf361b6){if(_0xf361b6){_0x4420f9=_0xf361b6['length'];if(!_0x117014[_0x4c96('0x42')]['hasOwnProperty']('nolimit')){_0x1a065d[_0x4c96('0x2c')]=qs[_0x4c96('0x2c')](_0x117014['query'][_0x4c96('0x2c')]);_0x1a065d[_0x4c96('0x2a')]=qs[_0x4c96('0x2a')](_0x117014[_0x4c96('0x42')][_0x4c96('0x2a')]);}return _0x48b7c9[_0x4c96('0xac')](_0x1a065d);}})[_0x4c96('0x1b')](function(_0x1516d1){if(_0x1516d1){return _0x1516d1?{'count':_0x4420f9,'rows':_0x1516d1}:null;}})[_0x4c96('0x1b')](respondWithResult(_0x1729cd,null))[_0x4c96('0x54')](handleError(_0x1729cd,null));};exports[_0x4c96('0xad')]=function(_0x2ffa9e,_0x5b5302,_0xadb29){var _0x1ca80e={'raw':![],'where':{}};var _0x3dc395={};var _0x4d0bf1={'count':0x0,'rows':[]};return db[_0x4c96('0x3d')][_0x4c96('0x66')]({'where':{'id':_0x2ffa9e[_0x4c96('0x56')]['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0x5b5302,null))[_0x4c96('0x1b')](function(_0x2f4277){if(_0x2f4277){_0x3dc395['model']=_[_0x4c96('0x43')](db['OpenchannelInteraction'][_0x4c96('0x3e')]);_0x3dc395['query']=_[_0x4c96('0x43')](_0x2ffa9e[_0x4c96('0x42')]);_0x3dc395['filters']=_[_0x4c96('0x45')](_0x3dc395[_0x4c96('0x41')],_0x3dc395[_0x4c96('0x42')]);_0x1ca80e[_0x4c96('0x46')]=_[_0x4c96('0x45')](_0x3dc395[_0x4c96('0x41')],qs[_0x4c96('0x47')](_0x2ffa9e['query'][_0x4c96('0x47')]));_0x1ca80e[_0x4c96('0x46')]=_0x1ca80e[_0x4c96('0x46')][_0x4c96('0x48')]?_0x1ca80e[_0x4c96('0x46')]:_0x3dc395[_0x4c96('0x41')];if(!_0x2ffa9e[_0x4c96('0x42')][_0x4c96('0x49')](_0x4c96('0x4a'))){_0x1ca80e[_0x4c96('0x2c')]=qs[_0x4c96('0x2c')](_0x2ffa9e['query'][_0x4c96('0x2c')]);_0x1ca80e[_0x4c96('0x2a')]=qs['offset'](_0x2ffa9e[_0x4c96('0x42')][_0x4c96('0x2a')]);}_0x1ca80e[_0x4c96('0x67')]=qs['sort'](_0x2ffa9e[_0x4c96('0x42')][_0x4c96('0x4b')]);_0x1ca80e[_0x4c96('0x4c')]=qs[_0x4c96('0x44')](_[_0x4c96('0x4d')](_0x2ffa9e[_0x4c96('0x42')],_0x3dc395[_0x4c96('0x44')]));_0x1ca80e[_0x4c96('0x4c')][_0x4c96('0x63')]=_0x2f4277['id'];if(_0x2ffa9e['query'][_0x4c96('0x4e')]){_0x1ca80e[_0x4c96('0x4c')]=_['merge'](_0x1ca80e[_0x4c96('0x4c')],{'$or':_[_0x4c96('0x3c')](_0x1ca80e[_0x4c96('0x46')],function(_0x34d52d){var _0x54a472={};_0x54a472[_0x34d52d]={'$like':'%'+_0x2ffa9e[_0x4c96('0x42')][_0x4c96('0x4e')]+'%'};return _0x54a472;})});}_0x1ca80e=_[_0x4c96('0x4f')]({},_0x1ca80e,_0x2ffa9e[_0x4c96('0x57')]);return db['OpenchannelInteraction'][_0x4c96('0x2d')]({'where':_0x1ca80e[_0x4c96('0x4c')]})['then'](function(_0x7977a9){_0x4d0bf1[_0x4c96('0x2d')]=_0x7977a9;if(_0x2ffa9e[_0x4c96('0x42')][_0x4c96('0x51')]){_0x1ca80e[_0x4c96('0x52')]=[{'model':db[_0x4c96('0x70')],'as':_0x4c96('0xae'),'required':![]},{'model':db[_0x4c96('0x9b')],'as':_0x4c96('0xaf'),'attributes':[_0x4c96('0x37'),'fullname',_0x4c96('0xb0')],'required':![]},{'model':db[_0x4c96('0xb1')],'as':'Tags','attributes':['id',_0x4c96('0x37'),_0x4c96('0xb2')],'where':_0x2ffa9e[_0x4c96('0x42')][_0x4c96('0xb3')]?{'id':_0x2ffa9e[_0x4c96('0x42')]['tag']}:undefined,'required':_0x2ffa9e[_0x4c96('0x42')][_0x4c96('0xb3')]?!![]:![]}];}return db[_0x4c96('0x8e')]['findAll'](_0x1ca80e);})[_0x4c96('0x1b')](function(_0x5809ed){_0x4d0bf1[_0x4c96('0x53')]=_0x5809ed;return _0x4d0bf1;});}})[_0x4c96('0x1b')](respondWithFilteredResult(_0x5b5302,_0x1ca80e))[_0x4c96('0x54')](handleError(_0x5b5302,null));};exports[_0x4c96('0xb4')]=function(_0x153855,_0x4a2965,_0x23cd13){return db[_0x4c96('0x3d')][_0x4c96('0x58')]({'where':{'id':_0x153855['params']['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0x4a2965,null))[_0x4c96('0x1b')](function(_0x4f1e65){if(_0x4f1e65){return _0x4f1e65[_0x4c96('0xb4')](_0x153855[_0x4c96('0x5a')][_0x4c96('0x6a')],_[_0x4c96('0xb5')](_0x153855[_0x4c96('0x5a')],['ids','id'])||{})[_0x4c96('0x90')](function(_0x4be7f1){for(var _0x1bf272=0x0;_0x1bf272<_0x153855[_0x4c96('0x5a')]['ids'][_0x4c96('0x48')];_0x1bf272+=0x1){socket['emit'](_0x4c96('0xb6'),{'UserId':Number(_0x153855[_0x4c96('0x5a')][_0x4c96('0x6a')][_0x1bf272]),'OpenchannelAccountId':Number(_0x153855[_0x4c96('0x56')]['id'])});}return _0x4be7f1;});}})[_0x4c96('0x1b')](respondWithResult(_0x4a2965,null))[_0x4c96('0x54')](handleError(_0x4a2965,null));};exports['removeAgents']=function(_0x2d4da0,_0x27ea1b,_0x543e8b){return db[_0x4c96('0x3d')][_0x4c96('0x58')]({'where':{'id':_0x2d4da0[_0x4c96('0x56')]['id']}})['then'](handleEntityNotFound(_0x27ea1b,null))[_0x4c96('0x1b')](function(_0x1af496){if(_0x1af496){return _0x1af496['removeAgents'](_0x2d4da0['query']['ids'])[_0x4c96('0x1b')](function(){if(_[_0x4c96('0xb7')](_0x2d4da0[_0x4c96('0x42')][_0x4c96('0x6a')])){for(var _0x45f85a=0x0;_0x45f85a<_0x2d4da0[_0x4c96('0x42')][_0x4c96('0x6a')][_0x4c96('0x48')];_0x45f85a+=0x1){socket[_0x4c96('0xb8')](_0x4c96('0xb9'),{'UserId':Number(_0x2d4da0[_0x4c96('0x42')]['ids'][_0x45f85a]),'OpenchannelAccountId':Number(_0x2d4da0[_0x4c96('0x56')]['id'])});}}else{socket[_0x4c96('0xb8')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2d4da0['query'][_0x4c96('0x6a')]),'OpenchannelAccountId':Number(_0x2d4da0[_0x4c96('0x56')]['id'])});}});}})[_0x4c96('0x1b')](respondWithStatusCode(_0x27ea1b,null))[_0x4c96('0x54')](handleError(_0x27ea1b,null));};exports['getAgents']=function(_0x11b219,_0xa6dba2,_0x61a6fd){var _0xcfc659={};var _0x3df5d1={};var _0xbdcf7;var _0x4ea9e9;return db[_0x4c96('0x3d')][_0x4c96('0x66')]({'where':{'id':_0x11b219[_0x4c96('0x56')]['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0xa6dba2,null))['then'](function(_0x3f533a){if(_0x3f533a){_0xbdcf7=_0x3f533a;_0x3df5d1[_0x4c96('0x41')]=_[_0x4c96('0x43')](db[_0x4c96('0x9b')]['rawAttributes']);_0x3df5d1[_0x4c96('0x42')]=_[_0x4c96('0x43')](_0x11b219[_0x4c96('0x42')]);_0x3df5d1['filters']=_['intersection'](_0x3df5d1[_0x4c96('0x41')],_0x3df5d1['query']);_0xcfc659[_0x4c96('0x46')]=_['intersection'](_0x3df5d1['model'],qs['fields'](_0x11b219[_0x4c96('0x42')][_0x4c96('0x47')]));_0xcfc659[_0x4c96('0x46')]=_0xcfc659['attributes'][_0x4c96('0x48')]?_0xcfc659[_0x4c96('0x46')]:_0x3df5d1[_0x4c96('0x41')];_0xcfc659[_0x4c96('0x67')]=qs[_0x4c96('0x4b')](_0x11b219['query'][_0x4c96('0x4b')]);_0xcfc659[_0x4c96('0x4c')]=qs[_0x4c96('0x44')](_['pick'](_0x11b219['query'],_0x3df5d1[_0x4c96('0x44')]));if(_0x11b219['query'][_0x4c96('0x4e')]){_0xcfc659[_0x4c96('0x4c')]=_[_0x4c96('0x4f')](_0xcfc659[_0x4c96('0x4c')],{'$or':_[_0x4c96('0x3c')](_0xcfc659[_0x4c96('0x46')],function(_0x48557a){var _0x4275f8={};_0x4275f8[_0x48557a]={'$like':'%'+_0x11b219[_0x4c96('0x42')][_0x4c96('0x4e')]+'%'};return _0x4275f8;})});}_0xcfc659=_[_0x4c96('0x4f')]({},_0xcfc659,_0x11b219[_0x4c96('0x57')]);return _0xbdcf7['getAgents'](_0xcfc659);}})[_0x4c96('0x1b')](function(_0xf5e8c1){if(_0xf5e8c1){_0x4ea9e9=_0xf5e8c1[_0x4c96('0x48')];if(!_0x11b219[_0x4c96('0x42')][_0x4c96('0x49')](_0x4c96('0x4a'))){_0xcfc659[_0x4c96('0x2c')]=qs[_0x4c96('0x2c')](_0x11b219[_0x4c96('0x42')][_0x4c96('0x2c')]);_0xcfc659[_0x4c96('0x2a')]=qs['offset'](_0x11b219[_0x4c96('0x42')]['offset']);}return _0xbdcf7[_0x4c96('0xba')](_0xcfc659);}})[_0x4c96('0x1b')](function(_0x49250b){if(_0x49250b){return _0x49250b?{'count':_0x4ea9e9,'rows':_0x49250b}:null;}})['then'](respondWithResult(_0xa6dba2,null))[_0x4c96('0x54')](handleError(_0xa6dba2,null));};exports[_0x4c96('0x38')]=function(_0x5d3194,_0x12fe3a,_0x4d9735){var _0x4b7308,_0x18f7e6,_0xe8f557;if(_[_0x4c96('0x7c')](_0x5d3194[_0x4c96('0x5a')][_0x4c96('0x5a')])||_0x5d3194['body'][_0x4c96('0x5a')]===''){throw new db[(_0x4c96('0x71'))][(_0x4c96('0x72'))](_0x4c96('0x7b'));}if(_[_0x4c96('0x7c')](_0x5d3194[_0x4c96('0x5a')]['to'])){}_0x4b7308=_0x5d3194['body']['to'];return db[_0x4c96('0x3d')]['findOne']({'where':{'id':_0x5d3194[_0x4c96('0x56')]['id']}})[_0x4c96('0x1b')](handleEntityNotFound(_0x12fe3a,null))['then'](function(_0x17512d){if(_0x17512d){return db[_0x4c96('0x3d')][_0x4c96('0x58')]({'where':{'id':_0x17512d['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4c96('0x70')],'as':_0x4c96('0x83'),'where':{[_0x17512d['mapKey']]:_0x4b7308},'limit':0x1,'order':[['updatedAt',_0x4c96('0x84')]]}]}]})[_0x4c96('0x1b')](handleEntityNotFound(_0x12fe3a,null))[_0x4c96('0x1b')](function(_0x4e5eb2){if(_0x4e5eb2&&_0x4e5eb2[_0x4c96('0x82')]){_0x18f7e6=_0x4e5eb2[_0x4c96('0x33')]({'plain':!![]});if(_0x18f7e6[_0x4c96('0x82')]&&_0x18f7e6[_0x4c96('0x82')][_0x4c96('0x83')]['length']){return _0x18f7e6[_0x4c96('0x82')][_0x4c96('0x83')][0x0];}return db[_0x4c96('0x70')]['create'](_[_0x4c96('0x16')](_0x5d3194[_0x4c96('0x5a')],{'firstName':_0x4b7308,[_0x4e5eb2[_0x4c96('0x7d')]]:_0x4b7308,'phone':_0x4b7308,'ListId':_0x18f7e6[_0x4c96('0x78')]}));}})[_0x4c96('0x1b')](handleEntityNotFound(_0x12fe3a,null))[_0x4c96('0x1b')](function(_0x1fb2ba){if(_0x1fb2ba){_0xe8f557=_0x1fb2ba;return db[_0x4c96('0x8e')][_0x4c96('0x58')]({'where':{'ContactId':_0xe8f557['id'],'closed':![],'OpenchannelAccountId':_0x18f7e6['id']}})[_0x4c96('0x1b')](function(_0x3ed494){if(_0x3ed494){return[_0x3ed494,![]];}return db[_0x4c96('0x8e')][_0x4c96('0x59')]({'UserId':_0x5d3194['user']['id'],'ContactId':_0xe8f557['id'],'OpenchannelAccountId':_0x18f7e6['id'],'lastMsgDirection':_0x4c96('0xbb'),'firstMsgDirection':_0x4c96('0xbb'),'Messages':[_['merge'](_0x5d3194[_0x4c96('0x5a')],{'read':![],'body':_0x5d3194[_0x4c96('0x5a')][_0x4c96('0x5a')],'OpenchannelAccountId':_0x18f7e6['id'],'UserId':_0x5d3194[_0x4c96('0x5b')]['id'],'ContactId':_0xe8f557['id']})]},{'include':[{'model':db[_0x4c96('0xbc')],'as':_0x4c96('0xbd')}]})['then'](function(_0x419202){return[_0x419202,!![]];});});}})['spread'](function(_0x3c9723,_0x56ce67){if(_0x56ce67){return _0x3c9723;}return db[_0x4c96('0xbc')][_0x4c96('0x59')](_['merge'](_0x5d3194[_0x4c96('0x5a')],{'read':![],'body':_0x5d3194[_0x4c96('0x5a')]['body'],'OpenchannelAccountId':_0x18f7e6['id'],'OpenchannelInteractionId':_0x3c9723['id'],'UserId':_0x5d3194[_0x4c96('0x5b')]['id'],'ContactId':_0xe8f557['id']}))[_0x4c96('0x1b')](function(_0x234603){_0x3c9723[_0x4c96('0xbe')]['Messages']=[];_0x3c9723[_0x4c96('0xbe')][_0x4c96('0xbd')][_0x4c96('0xbf')](_0x234603[_0x4c96('0xbe')]);return _0x3c9723;});});}})[_0x4c96('0x1b')](respondWithResult(_0x12fe3a,null))[_0x4c96('0x54')](handleError(_0x12fe3a,null));}; \ No newline at end of file +var _0x194c=['findAndCountAll','finally','getApplications','rawAttributes','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','removeAgents','emit','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','includeAll','rows','show','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','length','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','lastName','threadId','externalUrl','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','close','OpenchannelMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate'];(function(_0x1f2009,_0x4b80bb){var _0x9827e6=function(_0x12d935){while(--_0x12d935){_0x1f2009['push'](_0x1f2009['shift']());}};_0x9827e6(++_0x4b80bb);}(_0x194c,0x19b));var _0xc194=function(_0x389e35,_0x23a3af){_0x389e35=_0x389e35-0x0;var _0x2e90c4=_0x194c[_0x389e35];return _0x2e90c4;};'use strict';var emlformat=require(_0xc194('0x0'));var rimraf=require(_0xc194('0x1'));var zipdir=require(_0xc194('0x2'));var jsonpatch=require(_0xc194('0x3'));var rp=require(_0xc194('0x4'));var moment=require(_0xc194('0x5'));var BPromise=require(_0xc194('0x6'));var Mustache=require('mustache');var util=require(_0xc194('0x7'));var path=require(_0xc194('0x8'));var sox=require(_0xc194('0x9'));var csv=require(_0xc194('0xa'));var ejs=require(_0xc194('0xb'));var fs=require('fs');var fs_extra=require(_0xc194('0xc'));var _=require(_0xc194('0xd'));var squel=require(_0xc194('0xe'));var crypto=require(_0xc194('0xf'));var jsforce=require(_0xc194('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc194('0xa'));var querystring=require('querystring');var Papa=require(_0xc194('0x11'));var Redis=require(_0xc194('0x12'));var authService=require(_0xc194('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc194('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc194('0x15'));var utils=require(_0xc194('0x16'));var config=require(_0xc194('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc194('0x18'))['db'];config[_0xc194('0x19')]=_[_0xc194('0x1a')](config[_0xc194('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xc194('0x1b'))(new Redis(config['redis']));require(_0xc194('0x1c'))[_0xc194('0x1d')](socket);var jayson=require(_0xc194('0x1e'));var client=jayson['client'][_0xc194('0x1f')]({'port':0x232c});var client9002=jayson[_0xc194('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ba88f,_0x462ca3,_0x34a5d5,_0x4c41b7){return new BPromise(function(_0x5594d,_0x4768b8){var _0x33922e=_0x4c41b7||client;return _0x33922e[_0xc194('0x21')](_0x2ba88f,_0x34a5d5)[_0xc194('0x22')](function(_0x3cc715){logger['info'](_0xc194('0x23'),_0x462ca3,'request\x20sent');logger[_0xc194('0x24')](_0xc194('0x25'),_0x462ca3,_0xc194('0x26'),JSON[_0xc194('0x27')](_0x3cc715));if(_0x3cc715[_0xc194('0x28')]){if(_0x3cc715[_0xc194('0x28')][_0xc194('0x29')]===0x1f4){logger[_0xc194('0x28')](_0xc194('0x23'),_0x462ca3,_0x3cc715['error'][_0xc194('0x2a')]);return _0x4768b8(_0x3cc715[_0xc194('0x28')]['message']);}logger[_0xc194('0x28')](_0xc194('0x23'),_0x462ca3,_0x3cc715[_0xc194('0x28')][_0xc194('0x2a')]);return _0x5594d(_0x3cc715['error'][_0xc194('0x2a')]);}else{logger[_0xc194('0x2b')](_0xc194('0x23'),_0x462ca3,_0xc194('0x26'));_0x5594d(_0x3cc715[_0xc194('0x2c')]['message']);}})['catch'](function(_0x229a0c){logger[_0xc194('0x28')](_0xc194('0x23'),_0x462ca3,_0x229a0c);_0x4768b8(_0x229a0c);});});}function respondWithStatusCode(_0x5d3883,_0x98b085){_0x98b085=_0x98b085||0xcc;return function(_0x8af06){if(_0x8af06){return _0x5d3883['sendStatus'](_0x98b085);}return _0x5d3883['status'](_0x98b085)[_0xc194('0x2d')]();};}function respondWithResult(_0x215169,_0x5ee5d0){_0x5ee5d0=_0x5ee5d0||0xc8;return function(_0x45d5b7){if(_0x45d5b7){return _0x215169['status'](_0x5ee5d0)[_0xc194('0x2e')](_0x45d5b7);}};}function respondWithFilteredResult(_0x1ecb8d,_0x2a9090){return function(_0x370f90){if(_0x370f90){var _0x1e30a9=typeof _0x2a9090[_0xc194('0x2f')]==='undefined'&&typeof _0x2a9090[_0xc194('0x30')]===_0xc194('0x31');var _0x594ab0=_0x370f90[_0xc194('0x32')];var _0x364641=_0x1e30a9?0x0:_0x2a9090[_0xc194('0x2f')];var _0x2bbb47=_0x1e30a9?_0x370f90['count']:_0x2a9090[_0xc194('0x2f')]+_0x2a9090[_0xc194('0x30')];var _0x54b6e9;if(_0x2bbb47>=_0x594ab0){_0x2bbb47=_0x594ab0;_0x54b6e9=0xc8;}else{_0x54b6e9=0xce;}_0x1ecb8d[_0xc194('0x33')](_0x54b6e9);return _0x1ecb8d[_0xc194('0x34')](_0xc194('0x35'),_0x364641+'-'+_0x2bbb47+'/'+_0x594ab0)['json'](_0x370f90);}return null;};}function patchUpdates(_0x39a734){return function(_0x4fb75a){try{jsonpatch[_0xc194('0x36')](_0x4fb75a,_0x39a734,!![]);}catch(_0x45b007){return BPromise[_0xc194('0x37')](_0x45b007);}return _0x4fb75a[_0xc194('0x38')]();};}function saveUpdates(_0x1a3bc5,_0x5d3c9e){return function(_0x15308f){if(_0x15308f){return _0x15308f[_0xc194('0x39')](_0x1a3bc5)[_0xc194('0x22')](function(_0x4a003b){return _0x4a003b;});}return null;};}function removeEntity(_0xc2cb8e,_0xe016c){return function(_0x278342){if(_0x278342){return _0x278342[_0xc194('0x3a')]()[_0xc194('0x22')](function(){var _0x9de385=_0x278342[_0xc194('0x3b')]({'plain':!![]});var _0x22b26e=_0xc194('0x3c');return db[_0xc194('0x3d')][_0xc194('0x3a')]({'where':{'type':_0x22b26e,'resourceId':_0x9de385['id']}})[_0xc194('0x22')](function(){return _0x278342;});})[_0xc194('0x22')](function(){_0xc2cb8e[_0xc194('0x33')](0xcc)[_0xc194('0x2d')]();});}};}function handleEntityNotFound(_0x543776,_0x284c2d){return function(_0x1475fd){if(!_0x1475fd){_0x543776[_0xc194('0x3e')](0x194);}return _0x1475fd;};}function handleError(_0x57d952,_0x27b879){_0x27b879=_0x27b879||0x1f4;return function(_0x2952bc){logger[_0xc194('0x28')](_0x2952bc[_0xc194('0x3f')]);if(_0x2952bc[_0xc194('0x40')]){delete _0x2952bc['name'];}_0x57d952[_0xc194('0x33')](_0x27b879)[_0xc194('0x41')](_0x2952bc);};}exports[_0xc194('0x42')]=function(_0x223a8e,_0x4dc68b){var _0x331f6f={'include':[{'model':db[_0xc194('0x43')],'as':_0xc194('0x44')}]},_0x4d06a7={},_0x86079={'count':0x0,'rows':[]};var _0x3c9a0e=_['map'](db[_0xc194('0x45')]['rawAttributes'],function(_0x3fd12d){return{'name':_0x3fd12d['fieldName'],'type':_0x3fd12d[_0xc194('0x46')][_0xc194('0x47')]};});_0x4d06a7[_0xc194('0x48')]=_['map'](_0x3c9a0e,_0xc194('0x40'));_0x4d06a7[_0xc194('0x49')]=_[_0xc194('0x4a')](_0x223a8e[_0xc194('0x49')]);_0x4d06a7['filters']=_[_0xc194('0x4b')](_0x4d06a7['model'],_0x4d06a7['query']);_0x331f6f[_0xc194('0x4c')]=_[_0xc194('0x4b')](_0x4d06a7[_0xc194('0x48')],qs[_0xc194('0x4d')](_0x223a8e[_0xc194('0x49')][_0xc194('0x4d')]));_0x331f6f[_0xc194('0x4c')]=_0x331f6f[_0xc194('0x4c')]['length']?_0x331f6f[_0xc194('0x4c')]:_0x4d06a7[_0xc194('0x48')];if(!_0x223a8e[_0xc194('0x49')][_0xc194('0x4e')](_0xc194('0x4f'))){_0x331f6f[_0xc194('0x30')]=qs[_0xc194('0x30')](_0x223a8e[_0xc194('0x49')][_0xc194('0x30')]);_0x331f6f[_0xc194('0x2f')]=qs[_0xc194('0x2f')](_0x223a8e[_0xc194('0x49')][_0xc194('0x2f')]);}_0x331f6f[_0xc194('0x50')]=qs[_0xc194('0x51')](_0x223a8e[_0xc194('0x49')][_0xc194('0x51')]);_0x331f6f[_0xc194('0x52')]=qs[_0xc194('0x53')](_[_0xc194('0x54')](_0x223a8e[_0xc194('0x49')],_0x4d06a7[_0xc194('0x53')]),_0x3c9a0e);if(_0x223a8e[_0xc194('0x49')]['filter']){_0x331f6f[_0xc194('0x52')]=_[_0xc194('0x55')](_0x331f6f['where'],{'$or':_[_0xc194('0x56')](_0x3c9a0e,function(_0x17baee){if(_0x17baee['type']!==_0xc194('0x57')){var _0x1d323f={};_0x1d323f[_0x17baee['name']]={'$like':'%'+_0x223a8e['query'][_0xc194('0x58')]+'%'};return _0x1d323f;}})});}_0x331f6f=_[_0xc194('0x55')]({},_0x331f6f,_0x223a8e['options']);var _0x1e68ab={'where':_0x331f6f[_0xc194('0x52')]};return db[_0xc194('0x45')]['count'](_0x1e68ab)[_0xc194('0x22')](function(_0x3b05e7){_0x86079[_0xc194('0x32')]=_0x3b05e7;if(_0x223a8e['query'][_0xc194('0x59')]){_0x331f6f['include']=[{'all':!![]}];}return db[_0xc194('0x45')]['findAll'](_0x331f6f);})['then'](function(_0x1ce027){_0x86079[_0xc194('0x5a')]=_0x1ce027;return _0x86079;})[_0xc194('0x22')](respondWithFilteredResult(_0x4dc68b,_0x331f6f))['catch'](handleError(_0x4dc68b,null));};exports[_0xc194('0x5b')]=function(_0x4302ba,_0x3ab08a){var _0x124478={'raw':![],'where':{'id':_0x4302ba['params']['id']},'include':[{'model':db['Pause'],'as':_0xc194('0x44')}]},_0x4a1c84={};_0x4a1c84[_0xc194('0x48')]=_[_0xc194('0x4a')](db['OpenchannelAccount']['rawAttributes']);_0x4a1c84['query']=_[_0xc194('0x4a')](_0x4302ba[_0xc194('0x49')]);_0x4a1c84[_0xc194('0x53')]=_[_0xc194('0x4b')](_0x4a1c84[_0xc194('0x48')],_0x4a1c84['query']);_0x124478[_0xc194('0x4c')]=_[_0xc194('0x4b')](_0x4a1c84[_0xc194('0x48')],qs[_0xc194('0x4d')](_0x4302ba['query'][_0xc194('0x4d')]));_0x124478['attributes']=_0x124478['attributes']['length']?_0x124478[_0xc194('0x4c')]:_0x4a1c84[_0xc194('0x48')];if(_0x4302ba[_0xc194('0x49')][_0xc194('0x59')]){_0x124478[_0xc194('0x5c')]=[{'all':!![]}];}_0x124478=_['merge']({},_0x124478,_0x4302ba[_0xc194('0x5d')]);return db[_0xc194('0x45')]['find'](_0x124478)[_0xc194('0x22')](handleEntityNotFound(_0x3ab08a,null))[_0xc194('0x22')](respondWithResult(_0x3ab08a,null))['catch'](handleError(_0x3ab08a,null));};exports[_0xc194('0x5e')]=function(_0x5f181c,_0x414c95){return db[_0xc194('0x45')][_0xc194('0x5e')](_0x5f181c['body'],{})['then'](function(_0x1a838b){var _0x59a979=_0x5f181c[_0xc194('0x5f')]['get']({'plain':!![]});if(!_0x59a979)throw new Error(_0xc194('0x60'));if(_0x59a979[_0xc194('0x61')]===_0xc194('0x5f')){var _0x4833b7=_0x1a838b[_0xc194('0x3b')]({'plain':!![]});var _0x3b84f7=_0xc194('0x3c');return db[_0xc194('0x62')][_0xc194('0x63')]({'where':{'name':_0x3b84f7,'userProfileId':_0x59a979['userProfileId']},'raw':!![]})['then'](function(_0x584abd){if(_0x584abd&&_0x584abd[_0xc194('0x64')]===0x0){return db[_0xc194('0x3d')][_0xc194('0x5e')]({'name':_0x4833b7['name'],'resourceId':_0x4833b7['id'],'type':_0x584abd[_0xc194('0x40')],'sectionId':_0x584abd['id']},{})[_0xc194('0x22')](function(){return _0x1a838b;});}else{return _0x1a838b;}})[_0xc194('0x65')](function(_0x2fc830){logger[_0xc194('0x28')](_0xc194('0x66'),_0x2fc830);throw _0x2fc830;});}return _0x1a838b;})[_0xc194('0x22')](respondWithResult(_0x414c95,0xc9))[_0xc194('0x65')](handleError(_0x414c95,null));};exports['update']=function(_0x2753c2,_0x4716c6){if(_0x2753c2['body']['id']){delete _0x2753c2['body']['id'];}return db[_0xc194('0x45')]['find']({'where':{'id':_0x2753c2[_0xc194('0x67')]['id']},'include':[{'model':db[_0xc194('0x43')],'as':_0xc194('0x44')}]})[_0xc194('0x22')](handleEntityNotFound(_0x4716c6,null))[_0xc194('0x22')](saveUpdates(_0x2753c2[_0xc194('0x68')],null))[_0xc194('0x22')](respondWithResult(_0x4716c6,null))[_0xc194('0x65')](handleError(_0x4716c6,null));};exports[_0xc194('0x3a')]=function(_0x160445,_0x2a4cd7){return db[_0xc194('0x45')][_0xc194('0x63')]({'where':{'id':_0x160445[_0xc194('0x67')]['id']}})[_0xc194('0x22')](handleEntityNotFound(_0x2a4cd7,null))[_0xc194('0x22')](removeEntity(_0x2a4cd7,null))[_0xc194('0x65')](handleError(_0x2a4cd7,null));};exports['describe']=function(_0x22d8e1,_0x56f51e){return db[_0xc194('0x45')][_0xc194('0x69')]()[_0xc194('0x22')](respondWithResult(_0x56f51e,null))[_0xc194('0x65')](handleError(_0x56f51e,null));};exports['addDisposition']=function(_0x557616,_0x4683c0,_0x4ed166){if(_0x557616[_0xc194('0x68')]['id']){delete _0x557616['body']['id'];}return db[_0xc194('0x45')][_0xc194('0x63')]({'where':{'id':_0x557616['params']['id']}})[_0xc194('0x22')](handleEntityNotFound(_0x4683c0,null))[_0xc194('0x22')](function(_0x10279c){if(_0x10279c){_0x557616[_0xc194('0x68')][_0xc194('0x6a')]=_0x10279c['id'];return db[_0xc194('0x6b')][_0xc194('0x5e')](_0x557616[_0xc194('0x68')]);}})['then'](respondWithResult(_0x4683c0,null))[_0xc194('0x65')](handleError(_0x4683c0,null));};exports[_0xc194('0x6c')]=function(_0x2b0a9b,_0x49dc60,_0x147923){var _0xafbd80={'raw':![],'where':{}};var _0x4bcbee={};var _0x39e19d={'count':0x0,'rows':[]};return db[_0xc194('0x45')][_0xc194('0x6d')]({'where':{'id':_0x2b0a9b['params']['id']}})[_0xc194('0x22')](handleEntityNotFound(_0x49dc60,null))[_0xc194('0x22')](function(_0x52e633){if(_0x52e633){_0x4bcbee[_0xc194('0x48')]=_[_0xc194('0x4a')](db[_0xc194('0x6b')]['rawAttributes']);_0x4bcbee['query']=_['keys'](_0x2b0a9b[_0xc194('0x49')]);_0x4bcbee[_0xc194('0x53')]=_[_0xc194('0x4b')](_0x4bcbee[_0xc194('0x48')],_0x4bcbee[_0xc194('0x49')]);_0xafbd80[_0xc194('0x4c')]=_['intersection'](_0x4bcbee[_0xc194('0x48')],qs[_0xc194('0x4d')](_0x2b0a9b['query']['fields']));_0xafbd80[_0xc194('0x4c')]=_0xafbd80[_0xc194('0x4c')][_0xc194('0x6e')]?_0xafbd80[_0xc194('0x4c')]:_0x4bcbee[_0xc194('0x48')];if(!_0x2b0a9b[_0xc194('0x49')][_0xc194('0x4e')](_0xc194('0x4f'))){_0xafbd80[_0xc194('0x30')]=qs['limit'](_0x2b0a9b[_0xc194('0x49')]['limit']);_0xafbd80[_0xc194('0x2f')]=qs['offset'](_0x2b0a9b[_0xc194('0x49')]['offset']);}_0xafbd80['order']=qs['sort'](_0x2b0a9b['query'][_0xc194('0x51')]);_0xafbd80['where']=qs['filters'](_['pick'](_0x2b0a9b[_0xc194('0x49')],_0x4bcbee[_0xc194('0x53')]));_0xafbd80[_0xc194('0x52')][_0xc194('0x6a')]=_0x52e633['id'];if(_0x2b0a9b[_0xc194('0x49')][_0xc194('0x58')]){_0xafbd80[_0xc194('0x52')]=_[_0xc194('0x55')](_0xafbd80[_0xc194('0x52')],{'$or':_[_0xc194('0x56')](_0xafbd80['attributes'],function(_0x2a0341){var _0x215498={};_0x215498[_0x2a0341]={'$like':'%'+_0x2b0a9b['query']['filter']+'%'};return _0x215498;})});}_0xafbd80=_['merge']({},_0xafbd80,_0x2b0a9b[_0xc194('0x5d')]);return db[_0xc194('0x6b')][_0xc194('0x32')]({'where':_0xafbd80[_0xc194('0x52')]})['then'](function(_0xb38f37){_0x39e19d[_0xc194('0x32')]=_0xb38f37;if(_0x2b0a9b[_0xc194('0x49')][_0xc194('0x59')]){_0xafbd80['include']=[{'all':!![]}];}return db[_0xc194('0x6b')][_0xc194('0x6f')](_0xafbd80);})['then'](function(_0x512dcf){_0x39e19d[_0xc194('0x5a')]=_0x512dcf;return _0x39e19d;});}})[_0xc194('0x22')](respondWithFilteredResult(_0x49dc60,_0xafbd80))[_0xc194('0x65')](handleError(_0x49dc60,null));};exports[_0xc194('0x70')]=function(_0x52b62e,_0x280624,_0x5ad9c9){return db[_0xc194('0x45')][_0xc194('0x63')]({'where':{'id':_0x52b62e['params']['id']}})[_0xc194('0x22')](handleEntityNotFound(_0x280624,null))['then'](function(_0xeae98e){if(_0xeae98e){return _0xeae98e['removeDispositions'](_0x52b62e[_0xc194('0x49')][_0xc194('0x71')]);}})[_0xc194('0x22')](respondWithStatusCode(_0x280624,null))[_0xc194('0x65')](handleError(_0x280624,null));};exports[_0xc194('0x72')]=function(_0x46189f,_0xb78c45,_0x410a3b){if(_0x46189f[_0xc194('0x68')]['id']){delete _0x46189f[_0xc194('0x68')]['id'];}return db[_0xc194('0x45')][_0xc194('0x63')]({'where':{'id':_0x46189f[_0xc194('0x67')]['id']}})[_0xc194('0x22')](handleEntityNotFound(_0xb78c45,null))['then'](function(_0x2ee1f2){if(_0x2ee1f2){_0x46189f[_0xc194('0x68')][_0xc194('0x6a')]=_0x2ee1f2['id'];return db['CannedAnswer'][_0xc194('0x5e')](_0x46189f[_0xc194('0x68')]);}})[_0xc194('0x22')](respondWithResult(_0xb78c45,null))[_0xc194('0x65')](handleError(_0xb78c45,null));};exports[_0xc194('0x73')]=function(_0x1904e8,_0x5a63b1,_0x51fb04){var _0x3ab4e0={'raw':![],'where':{}};var _0x3dff4f={};var _0x1f7c5d={'count':0x0,'rows':[]};return db[_0xc194('0x45')][_0xc194('0x6d')]({'where':{'id':_0x1904e8[_0xc194('0x67')]['id']}})[_0xc194('0x22')](handleEntityNotFound(_0x5a63b1,null))['then'](function(_0x3227dc){if(_0x3227dc){_0x3dff4f[_0xc194('0x48')]=_[_0xc194('0x4a')](db[_0xc194('0x74')]['rawAttributes']);_0x3dff4f[_0xc194('0x49')]=_[_0xc194('0x4a')](_0x1904e8[_0xc194('0x49')]);_0x3dff4f['filters']=_[_0xc194('0x4b')](_0x3dff4f[_0xc194('0x48')],_0x3dff4f[_0xc194('0x49')]);_0x3ab4e0[_0xc194('0x4c')]=_[_0xc194('0x4b')](_0x3dff4f[_0xc194('0x48')],qs[_0xc194('0x4d')](_0x1904e8['query'][_0xc194('0x4d')]));_0x3ab4e0['attributes']=_0x3ab4e0['attributes']['length']?_0x3ab4e0[_0xc194('0x4c')]:_0x3dff4f[_0xc194('0x48')];if(!_0x1904e8[_0xc194('0x49')][_0xc194('0x4e')]('nolimit')){_0x3ab4e0[_0xc194('0x30')]=qs[_0xc194('0x30')](_0x1904e8['query']['limit']);_0x3ab4e0['offset']=qs[_0xc194('0x2f')](_0x1904e8[_0xc194('0x49')]['offset']);}_0x3ab4e0[_0xc194('0x50')]=qs[_0xc194('0x51')](_0x1904e8[_0xc194('0x49')]['sort']);_0x3ab4e0[_0xc194('0x52')]=qs[_0xc194('0x53')](_['pick'](_0x1904e8[_0xc194('0x49')],_0x3dff4f['filters']));_0x3ab4e0[_0xc194('0x52')][_0xc194('0x6a')]=_0x3227dc['id'];if(_0x1904e8[_0xc194('0x49')]['filter']){_0x3ab4e0[_0xc194('0x52')]=_[_0xc194('0x55')](_0x3ab4e0[_0xc194('0x52')],{'$or':_[_0xc194('0x56')](_0x3ab4e0[_0xc194('0x4c')],function(_0x2935b2){var _0x9d157a={};_0x9d157a[_0x2935b2]={'$like':'%'+_0x1904e8[_0xc194('0x49')][_0xc194('0x58')]+'%'};return _0x9d157a;})});}_0x3ab4e0=_[_0xc194('0x55')]({},_0x3ab4e0,_0x1904e8[_0xc194('0x5d')]);return db[_0xc194('0x74')]['count']({'where':_0x3ab4e0[_0xc194('0x52')]})[_0xc194('0x22')](function(_0x5be4df){_0x1f7c5d[_0xc194('0x32')]=_0x5be4df;if(_0x1904e8[_0xc194('0x49')][_0xc194('0x59')]){_0x3ab4e0[_0xc194('0x5c')]=[{'all':!![]}];}return db[_0xc194('0x74')][_0xc194('0x6f')](_0x3ab4e0);})[_0xc194('0x22')](function(_0x3b35f1){_0x1f7c5d['rows']=_0x3b35f1;return _0x1f7c5d;});}})['then'](respondWithFilteredResult(_0x5a63b1,_0x3ab4e0))[_0xc194('0x65')](handleError(_0x5a63b1,null));};exports[_0xc194('0x75')]=function(_0x5c67cb,_0xc78307,_0xd6f856){return db['OpenchannelAccount'][_0xc194('0x63')]({'where':{'id':_0x5c67cb[_0xc194('0x67')]['id']}})[_0xc194('0x22')](handleEntityNotFound(_0xc78307,null))[_0xc194('0x22')](function(_0x5cb02f){if(_0x5cb02f){return _0x5cb02f['removeAnswers'](_0x5c67cb[_0xc194('0x49')][_0xc194('0x71')]);}})['then'](respondWithStatusCode(_0xc78307,null))['catch'](handleError(_0xc78307,null));};exports['notify']=function(_0x3c5984,_0x50ea5f,_0x405895){var _0x56e97b={'body':_0x3c5984[_0xc194('0x68')],'channel':_0xc194('0x76')};var _0x3b4265=[];var _0x5606c8=[];var _0x341686={};var _0x188a1f=![];return db[_0xc194('0x77')][_0xc194('0x69')]()[_0xc194('0x22')](function(_0xd9383e){if(!_0xd9383e){throw new db[(_0xc194('0x78'))][(_0xc194('0x79'))]('no\x20available\x20attributes');}_0x3b4265=_['difference'](_[_0xc194('0x4a')](_0xd9383e),[_0xc194('0x7a'),_0xc194('0x7b')]);_0x5606c8=_[_0xc194('0x7c')](_['keys'](_0xd9383e),[_0xc194('0x7a'),_0xc194('0x7b'),_0xc194('0x7d'),_0xc194('0x7e')]);if(_0x3c5984[_0xc194('0x68')]['id']){delete _0x3c5984[_0xc194('0x68')]['id'];}if(_[_0xc194('0x7f')](_0x3c5984['body'][_0xc194('0x80')])){throw new db[(_0xc194('0x78'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x3c5984['body']['body'])||_0x3c5984[_0xc194('0x68')][_0xc194('0x68')]===''){throw new db[(_0xc194('0x78'))][(_0xc194('0x79'))](_0xc194('0x81'));}if(_[_0xc194('0x7f')](_0x3c5984['body']['mapKey'])){throw new db[(_0xc194('0x78'))][(_0xc194('0x79'))](_0xc194('0x82')+_0x5606c8);}if(!_[_0xc194('0x83')](_0x5606c8,_0x3c5984['body'][_0xc194('0x84')])){throw new db[(_0xc194('0x78'))][(_0xc194('0x79'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5606c8);}_0x341686[_0x3c5984['body'][_0xc194('0x84')]]=_0x3c5984[_0xc194('0x68')][_0xc194('0x80')];})['then'](function(){return db[_0xc194('0x45')][_0xc194('0x63')]({'where':{'id':_0x3c5984[_0xc194('0x67')]['id']},'include':[{'model':db[_0xc194('0x85')],'as':_0xc194('0x86'),'include':[{'model':db[_0xc194('0x77')],'as':_0xc194('0x87'),'where':_0x341686,'limit':0x1,'order':[[_0xc194('0x7b'),'DESC']]}]},{'model':db[_0xc194('0x88')],'as':_0xc194('0x89')}]});})[_0xc194('0x22')](handleEntityNotFound(_0x50ea5f,null))[_0xc194('0x22')](function(_0x28f9ab){if(_0x28f9ab&&_0x28f9ab[_0xc194('0x86')]){_0x56e97b[_0xc194('0x8a')]=_0x28f9ab;_0x56e97b[_0xc194('0x8b')]=_0x28f9ab[_0xc194('0x89')];_0x56e97b[_0xc194('0x8c')]=_0x28f9ab[_0xc194('0x86')];_0x56e97b[_0xc194('0x8b')]=_[_0xc194('0x8d')](_0x56e97b[_0xc194('0x8b')],[_0xc194('0x8e')],[_0xc194('0x8f')]);if(_0x56e97b[_0xc194('0x8a')]['Applications']){delete _0x56e97b[_0xc194('0x8a')][_0xc194('0x89')];}if(_0x56e97b[_0xc194('0x8a')][_0xc194('0x86')]&&_0x56e97b[_0xc194('0x8a')][_0xc194('0x86')][_0xc194('0x87')][_0xc194('0x6e')]){return _0x56e97b[_0xc194('0x8a')][_0xc194('0x86')][_0xc194('0x87')][0x0];}var _0x18a5ac=_['defaults'](_0x3c5984[_0xc194('0x68')],{'firstName':_0x3c5984[_0xc194('0x68')]['from'],'ListId':_0x28f9ab[_0xc194('0x7e')]});_0x18a5ac[_0x3c5984['body']['mapKey']]=_0x3c5984[_0xc194('0x68')][_0xc194('0x80')];return db[_0xc194('0x77')]['create'](_0x18a5ac,{'fields':_0x3b4265,'raw':!![]});}})[_0xc194('0x22')](handleEntityNotFound(_0x50ea5f,null))['then'](function(_0x69fe40){_0x56e97b[_0xc194('0x90')]=_0x69fe40;if(_0x69fe40){var _0x159b0d={'ContactId':_0x69fe40['id'],'OpenchannelAccountId':_0x3c5984[_0xc194('0x67')]['id'],'from':(_0x69fe40['firstName']||'')+'\x20'+(_0x69fe40[_0xc194('0x91')]||'')};var _0x2871be={'OpenchannelAccountId':_0x3c5984[_0xc194('0x67')]['id'],'closed':![]};if(_0x3c5984[_0xc194('0x68')][_0xc194('0x92')]){_0x2871be[_0xc194('0x92')]=_0x3c5984[_0xc194('0x68')][_0xc194('0x92')];return db['OpenchannelInteraction'][_0xc194('0x63')]({'where':_0x2871be})[_0xc194('0x22')](function(_0x22d751){if(_0x22d751){return[_0x22d751,![]];}_0x159b0d[_0xc194('0x92')]=_0x3c5984[_0xc194('0x68')][_0xc194('0x92')];_0x159b0d[_0xc194('0x93')]=_0x3c5984[_0xc194('0x68')][_0xc194('0x93')];return db['OpenchannelInteraction'][_0xc194('0x5e')](_0x159b0d)[_0xc194('0x22')](function(_0x16a841){return[_0x16a841,!![]];});});}else{_0x2871be[_0xc194('0x92')]=null;}_0x2871be['ContactId']=_0x69fe40['id'];return db[_0xc194('0x94')][_0xc194('0x63')]({'where':_0x2871be})[_0xc194('0x22')](function(_0x1c5d1f){if(_0x1c5d1f){return[_0x1c5d1f,![]];}return db[_0xc194('0x94')][_0xc194('0x5e')](_0x159b0d)[_0xc194('0x22')](function(_0xc9a057){return[_0xc9a057,!![]];});});}})[_0xc194('0x95')](function(_0x3f6599,_0x1a2840){if(_0x3f6599){_0x188a1f=_0x1a2840;if(!_0x1a2840){var _0x505b83={'from':(_0x56e97b[_0xc194('0x90')]['firstName']||'')+'\x20'+(_0x56e97b[_0xc194('0x90')]['lastName']||'')};if(_0x3c5984[_0xc194('0x68')][_0xc194('0x92')]&&_0x3c5984['body'][_0xc194('0x96')]&&_0x3c5984[_0xc194('0x68')]['threadId']!=_0x3c5984[_0xc194('0x68')][_0xc194('0x96')]){_0x505b83[_0xc194('0x92')]=_0x3c5984[_0xc194('0x68')]['messageId'];}return _0x3f6599[_0xc194('0x39')](_0x505b83);}else{return _0x3f6599;}}})[_0xc194('0x22')](function(_0x1944e3){_0x56e97b[_0xc194('0x97')]=_0x1944e3[_0xc194('0x3b')]({'plain':!![]});_0x56e97b[_0xc194('0x97')][_0xc194('0x98')]=_0x188a1f;if(_0x56e97b[_0xc194('0x97')][_0xc194('0x98')]){if(_0x56e97b[_0xc194('0x8a')][_0xc194('0x99')]){_0x56e97b[_0xc194('0x8b')]['push']({'id':0x0,'priority':_0x56e97b['applications'][_0xc194('0x6e')]+0x1,'app':_0xc194('0x9a'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xc194('0x9b')][_0xc194('0x5e')]({'body':_0x3c5984[_0xc194('0x68')][_0xc194('0x68')],'OpenchannelAccountId':_0x3c5984[_0xc194('0x67')]['id'],'OpenchannelInteractionId':_0x1944e3['id'],'direction':'in','ContactId':_0x56e97b[_0xc194('0x90')]['id'],'AttachmentId':_0x3c5984[_0xc194('0x68')][_0xc194('0x9c')]});})[_0xc194('0x22')](function(_0x5c9849){_0x56e97b['message']=_0x5c9849;if(_0x56e97b[_0xc194('0x97')]['UserId']){return db['User'][_0xc194('0x63')]({'attributes':['id',_0xc194('0x40')],'where':{'id':_0x56e97b[_0xc194('0x97')][_0xc194('0x9d')]}})['then'](function(_0x519a1f){if(_0x519a1f){_0x56e97b[_0xc194('0x8b')][_0xc194('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x519a1f[_0xc194('0x40')]+','+(_0x56e97b['account'][_0xc194('0x9f')]||0xa),'interval':_0xc194('0xa0')});_0x56e97b[_0xc194('0xa1')]=![];}return respondWithRpcPromise(_0xc194('0xa2'),_0xc194('0xa3'),_0x56e97b);});}return respondWithRpcPromise(_0xc194('0xa2'),_0xc194('0xa3'),_0x56e97b);})[_0xc194('0x22')](function(_0x212337){respondWithRpcPromise(_0xc194('0xa4'),'EventManager',{'event':_0xc194('0xa5'),'message':_0x212337},client9002);return _0x212337;})[_0xc194('0x22')](respondWithResult(_0x50ea5f,null))[_0xc194('0x65')](handleError(_0x50ea5f,null));};exports[_0xc194('0xa6')]=function(_0x33e512,_0x2ccdfe){var _0x1c46d5=_0x33e512['params']['id'];var _0x420b27=_0x33e512[_0xc194('0x68')];var _0x24c2c9=0xc8;var _0xeae77b=null;return db['sequelize'][_0xc194('0xa7')]({'isolationLevel':db['sequelize']['Transaction'][_0xc194('0xa8')][_0xc194('0xa9')]},function(_0x387d44){return db[_0xc194('0x45')][_0xc194('0x6d')]({'where':{'id':_0x1c46d5},'transaction':_0x387d44})[_0xc194('0x22')](function(_0x4ec7ae){if(_0x4ec7ae){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x1c46d5},'transaction':_0x387d44})[_0xc194('0x22')](function(){var _0x3cd63c=_[_0xc194('0x56')](_0x420b27,function(_0x1d5563){_0x1d5563['OpenchannelAccountId']=_0x1c46d5;return _0x1d5563;});return db[_0xc194('0x88')][_0xc194('0xaa')](_0x3cd63c,{'transaction':_0x387d44});});}else{_0x24c2c9=0x194;_0xeae77b=[];}});})['then'](function(){if(_0x24c2c9!==0x194){return db[_0xc194('0x88')][_0xc194('0xab')]({'where':{'OpenchannelAccountId':_0x1c46d5},'order':_0xc194('0x8e')})[_0xc194('0x22')](function(_0x46965a){_0xeae77b=_0x46965a;});}})[_0xc194('0x65')](function(_0x526664){_0x24c2c9=0x1f4;logger[_0xc194('0x28')](_0x526664[_0xc194('0x3f')]);if(_0x526664[_0xc194('0x40')]){delete _0x526664[_0xc194('0x40')];}_0xeae77b=_0x526664;})[_0xc194('0xac')](function(){if(_0xeae77b===null){_0x2ccdfe[_0xc194('0x3e')](_0x24c2c9);}else{if(_0x24c2c9===0x1f4){_0x2ccdfe[_0xc194('0x33')](_0x24c2c9)[_0xc194('0x41')](_0xeae77b);}else{_0x2ccdfe[_0xc194('0x33')](_0x24c2c9)[_0xc194('0x2e')](_0xeae77b);}}});};exports[_0xc194('0xad')]=function(_0x5a1663,_0x26cc24,_0x54ea71){var _0x31cb4f={};var _0x33156d={};var _0xf42bd0;var _0x38a988;return db['OpenchannelAccount'][_0xc194('0x6d')]({'where':{'id':_0x5a1663[_0xc194('0x67')]['id']}})[_0xc194('0x22')](handleEntityNotFound(_0x26cc24,null))[_0xc194('0x22')](function(_0x32f3bf){if(_0x32f3bf){_0xf42bd0=_0x32f3bf;_0x33156d[_0xc194('0x48')]=_['keys'](db[_0xc194('0x88')][_0xc194('0xae')]);_0x33156d['query']=_['keys'](_0x5a1663[_0xc194('0x49')]);_0x33156d[_0xc194('0x53')]=_[_0xc194('0x4b')](_0x33156d[_0xc194('0x48')],_0x33156d[_0xc194('0x49')]);_0x31cb4f['attributes']=_[_0xc194('0x4b')](_0x33156d['model'],qs[_0xc194('0x4d')](_0x5a1663[_0xc194('0x49')][_0xc194('0x4d')]));_0x31cb4f[_0xc194('0x4c')]=_0x31cb4f[_0xc194('0x4c')][_0xc194('0x6e')]?_0x31cb4f[_0xc194('0x4c')]:_0x33156d[_0xc194('0x48')];_0x31cb4f['order']=qs['sort'](_0x5a1663[_0xc194('0x49')][_0xc194('0x51')]);_0x31cb4f['where']=qs[_0xc194('0x53')](_[_0xc194('0x54')](_0x5a1663[_0xc194('0x49')],_0x33156d[_0xc194('0x53')]));if(_0x5a1663[_0xc194('0x49')][_0xc194('0x58')]){_0x31cb4f[_0xc194('0x52')]=_['merge'](_0x31cb4f[_0xc194('0x52')],{'$or':_[_0xc194('0x56')](_0x31cb4f[_0xc194('0x4c')],function(_0x2e0198){var _0x4f15ea={};_0x4f15ea[_0x2e0198]={'$like':'%'+_0x5a1663[_0xc194('0x49')][_0xc194('0x58')]+'%'};return _0x4f15ea;})});}_0x31cb4f=_[_0xc194('0x55')]({},_0x31cb4f,_0x5a1663['options']);return _0xf42bd0[_0xc194('0xad')](_0x31cb4f);}})[_0xc194('0x22')](function(_0x34906a){if(_0x34906a){_0x38a988=_0x34906a['length'];if(!_0x5a1663[_0xc194('0x49')]['hasOwnProperty']('nolimit')){_0x31cb4f[_0xc194('0x30')]=qs['limit'](_0x5a1663[_0xc194('0x49')][_0xc194('0x30')]);_0x31cb4f['offset']=qs[_0xc194('0x2f')](_0x5a1663[_0xc194('0x49')]['offset']);}return _0xf42bd0[_0xc194('0xad')](_0x31cb4f);}})[_0xc194('0x22')](function(_0x222acd){if(_0x222acd){return _0x222acd?{'count':_0x38a988,'rows':_0x222acd}:null;}})['then'](respondWithResult(_0x26cc24,null))['catch'](handleError(_0x26cc24,null));};exports[_0xc194('0xaf')]=function(_0x121e2c,_0x5bec13,_0x420869){var _0x64f29={'raw':![],'where':{}};var _0x495f04={};var _0x30cc2a={'count':0x0,'rows':[]};return db[_0xc194('0x45')][_0xc194('0x6d')]({'where':{'id':_0x121e2c[_0xc194('0x67')]['id']}})[_0xc194('0x22')](handleEntityNotFound(_0x5bec13,null))[_0xc194('0x22')](function(_0x538da5){if(_0x538da5){_0x495f04[_0xc194('0x48')]=_[_0xc194('0x4a')](db[_0xc194('0x94')]['rawAttributes']);_0x495f04[_0xc194('0x49')]=_[_0xc194('0x4a')](_0x121e2c[_0xc194('0x49')]);_0x495f04['filters']=_[_0xc194('0x4b')](_0x495f04[_0xc194('0x48')],_0x495f04['query']);_0x64f29[_0xc194('0x4c')]=_['intersection'](_0x495f04[_0xc194('0x48')],qs[_0xc194('0x4d')](_0x121e2c[_0xc194('0x49')][_0xc194('0x4d')]));_0x64f29[_0xc194('0x4c')]=_0x64f29['attributes'][_0xc194('0x6e')]?_0x64f29[_0xc194('0x4c')]:_0x495f04[_0xc194('0x48')];if(!_0x121e2c[_0xc194('0x49')][_0xc194('0x4e')](_0xc194('0x4f'))){_0x64f29[_0xc194('0x30')]=qs[_0xc194('0x30')](_0x121e2c['query'][_0xc194('0x30')]);_0x64f29[_0xc194('0x2f')]=qs[_0xc194('0x2f')](_0x121e2c[_0xc194('0x49')][_0xc194('0x2f')]);}_0x64f29[_0xc194('0x50')]=qs[_0xc194('0x51')](_0x121e2c[_0xc194('0x49')][_0xc194('0x51')]);_0x64f29['where']=qs['filters'](_['pick'](_0x121e2c['query'],_0x495f04[_0xc194('0x53')]));_0x64f29[_0xc194('0x52')]['OpenchannelAccountId']=_0x538da5['id'];if(_0x121e2c[_0xc194('0x49')][_0xc194('0x58')]){_0x64f29['where']=_[_0xc194('0x55')](_0x64f29[_0xc194('0x52')],{'$or':_['map'](_0x64f29['attributes'],function(_0x5b00a6){var _0x31e602={};_0x31e602[_0x5b00a6]={'$like':'%'+_0x121e2c['query']['filter']+'%'};return _0x31e602;})});}_0x64f29=_[_0xc194('0x55')]({},_0x64f29,_0x121e2c[_0xc194('0x5d')]);return db[_0xc194('0x94')]['count']({'where':_0x64f29[_0xc194('0x52')]})[_0xc194('0x22')](function(_0x358f90){_0x30cc2a[_0xc194('0x32')]=_0x358f90;if(_0x121e2c[_0xc194('0x49')][_0xc194('0x59')]){_0x64f29[_0xc194('0x5c')]=[{'model':db[_0xc194('0x77')],'as':_0xc194('0xb0'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xc194('0x40'),_0xc194('0xb1'),_0xc194('0xb2')],'required':![]},{'model':db[_0xc194('0xb3')],'as':_0xc194('0xb4'),'attributes':['id',_0xc194('0x40'),_0xc194('0xb5')],'where':_0x121e2c['query'][_0xc194('0xb6')]?{'id':_0x121e2c[_0xc194('0x49')][_0xc194('0xb6')]}:undefined,'required':_0x121e2c[_0xc194('0x49')][_0xc194('0xb6')]?!![]:![]}];}return db[_0xc194('0x94')][_0xc194('0x6f')](_0x64f29);})[_0xc194('0x22')](function(_0x1404cd){_0x30cc2a['rows']=_0x1404cd;return _0x30cc2a;});}})['then'](respondWithFilteredResult(_0x5bec13,_0x64f29))['catch'](handleError(_0x5bec13,null));};exports[_0xc194('0xb7')]=function(_0x1aa3f5,_0x2c1206,_0xb73dfe){return db['OpenchannelAccount'][_0xc194('0x63')]({'where':{'id':_0x1aa3f5[_0xc194('0x67')]['id']}})[_0xc194('0x22')](handleEntityNotFound(_0x2c1206,null))[_0xc194('0x22')](function(_0x43ac92){if(_0x43ac92){return _0x43ac92[_0xc194('0xb7')](_0x1aa3f5[_0xc194('0x68')][_0xc194('0x71')],_[_0xc194('0xb8')](_0x1aa3f5[_0xc194('0x68')],[_0xc194('0x71'),'id'])||{})['spread'](function(_0xfe0915){for(var _0x54a446=0x0;_0x54a446<_0x1aa3f5[_0xc194('0x68')][_0xc194('0x71')][_0xc194('0x6e')];_0x54a446+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x1aa3f5[_0xc194('0x68')][_0xc194('0x71')][_0x54a446]),'OpenchannelAccountId':Number(_0x1aa3f5[_0xc194('0x67')]['id'])});}return _0xfe0915;});}})[_0xc194('0x22')](respondWithResult(_0x2c1206,null))[_0xc194('0x65')](handleError(_0x2c1206,null));};exports[_0xc194('0xb9')]=function(_0x3a7642,_0xdf6a7a,_0x3a35c2){return db[_0xc194('0x45')][_0xc194('0x63')]({'where':{'id':_0x3a7642[_0xc194('0x67')]['id']}})[_0xc194('0x22')](handleEntityNotFound(_0xdf6a7a,null))[_0xc194('0x22')](function(_0x2802c4){if(_0x2802c4){return _0x2802c4[_0xc194('0xb9')](_0x3a7642['query'][_0xc194('0x71')])[_0xc194('0x22')](function(){if(_['isArray'](_0x3a7642[_0xc194('0x49')][_0xc194('0x71')])){for(var _0x5c76e4=0x0;_0x5c76e4<_0x3a7642['query'][_0xc194('0x71')][_0xc194('0x6e')];_0x5c76e4+=0x1){socket[_0xc194('0xba')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3a7642[_0xc194('0x49')][_0xc194('0x71')][_0x5c76e4]),'OpenchannelAccountId':Number(_0x3a7642[_0xc194('0x67')]['id'])});}}else{socket[_0xc194('0xba')](_0xc194('0xbb'),{'UserId':Number(_0x3a7642['query'][_0xc194('0x71')]),'OpenchannelAccountId':Number(_0x3a7642[_0xc194('0x67')]['id'])});}});}})[_0xc194('0x22')](respondWithStatusCode(_0xdf6a7a,null))[_0xc194('0x65')](handleError(_0xdf6a7a,null));};exports[_0xc194('0xbc')]=function(_0x13bf5f,_0x1a9020,_0x45ca63){var _0x3142e1={};var _0x193d1f={};var _0x46b75f;var _0x39b22b;return db[_0xc194('0x45')][_0xc194('0x6d')]({'where':{'id':_0x13bf5f[_0xc194('0x67')]['id']}})[_0xc194('0x22')](handleEntityNotFound(_0x1a9020,null))[_0xc194('0x22')](function(_0x346b3f){if(_0x346b3f){_0x46b75f=_0x346b3f;_0x193d1f[_0xc194('0x48')]=_['keys'](db['User'][_0xc194('0xae')]);_0x193d1f['query']=_[_0xc194('0x4a')](_0x13bf5f[_0xc194('0x49')]);_0x193d1f[_0xc194('0x53')]=_['intersection'](_0x193d1f['model'],_0x193d1f[_0xc194('0x49')]);_0x3142e1[_0xc194('0x4c')]=_[_0xc194('0x4b')](_0x193d1f[_0xc194('0x48')],qs[_0xc194('0x4d')](_0x13bf5f[_0xc194('0x49')][_0xc194('0x4d')]));_0x3142e1[_0xc194('0x4c')]=_0x3142e1[_0xc194('0x4c')][_0xc194('0x6e')]?_0x3142e1[_0xc194('0x4c')]:_0x193d1f['model'];_0x3142e1[_0xc194('0x50')]=qs[_0xc194('0x51')](_0x13bf5f['query'][_0xc194('0x51')]);_0x3142e1[_0xc194('0x52')]=qs['filters'](_[_0xc194('0x54')](_0x13bf5f['query'],_0x193d1f[_0xc194('0x53')]));if(_0x13bf5f[_0xc194('0x49')][_0xc194('0x58')]){_0x3142e1['where']=_['merge'](_0x3142e1[_0xc194('0x52')],{'$or':_[_0xc194('0x56')](_0x3142e1[_0xc194('0x4c')],function(_0x27504b){var _0x44525c={};_0x44525c[_0x27504b]={'$like':'%'+_0x13bf5f[_0xc194('0x49')]['filter']+'%'};return _0x44525c;})});}_0x3142e1=_[_0xc194('0x55')]({},_0x3142e1,_0x13bf5f[_0xc194('0x5d')]);return _0x46b75f[_0xc194('0xbc')](_0x3142e1);}})[_0xc194('0x22')](function(_0x16f46e){if(_0x16f46e){_0x39b22b=_0x16f46e[_0xc194('0x6e')];if(!_0x13bf5f[_0xc194('0x49')][_0xc194('0x4e')](_0xc194('0x4f'))){_0x3142e1[_0xc194('0x30')]=qs[_0xc194('0x30')](_0x13bf5f[_0xc194('0x49')][_0xc194('0x30')]);_0x3142e1[_0xc194('0x2f')]=qs[_0xc194('0x2f')](_0x13bf5f[_0xc194('0x49')][_0xc194('0x2f')]);}return _0x46b75f[_0xc194('0xbc')](_0x3142e1);}})['then'](function(_0x319e52){if(_0x319e52){return _0x319e52?{'count':_0x39b22b,'rows':_0x319e52}:null;}})[_0xc194('0x22')](respondWithResult(_0x1a9020,null))[_0xc194('0x65')](handleError(_0x1a9020,null));};exports[_0xc194('0x41')]=function(_0x1d929f,_0x1a1434,_0x1298bf){var _0x2f3945,_0x381569,_0xa0461c;if(_[_0xc194('0x7f')](_0x1d929f['body'][_0xc194('0x68')])||_0x1d929f[_0xc194('0x68')][_0xc194('0x68')]===''){throw new db['Sequelize']['ValidationError'](_0xc194('0x81'));}if(_[_0xc194('0x7f')](_0x1d929f['body']['to'])){}_0x2f3945=_0x1d929f[_0xc194('0x68')]['to'];return db[_0xc194('0x45')][_0xc194('0x6d')]({'where':{'id':_0x1d929f[_0xc194('0x67')]['id']}})[_0xc194('0x22')](handleEntityNotFound(_0x1a1434,null))[_0xc194('0x22')](function(_0xa13f6d){if(_0xa13f6d){return db[_0xc194('0x45')][_0xc194('0x63')]({'where':{'id':_0xa13f6d['id']},'include':[{'model':db[_0xc194('0x85')],'as':_0xc194('0x86'),'include':[{'model':db['CmContact'],'as':_0xc194('0x87'),'where':{[_0xa13f6d[_0xc194('0x84')]]:_0x2f3945},'limit':0x1,'order':[[_0xc194('0x7b'),_0xc194('0xbd')]]}]}]})[_0xc194('0x22')](handleEntityNotFound(_0x1a1434,null))[_0xc194('0x22')](function(_0x4ae53b){if(_0x4ae53b&&_0x4ae53b[_0xc194('0x86')]){_0x381569=_0x4ae53b['get']({'plain':!![]});if(_0x381569['List']&&_0x381569[_0xc194('0x86')][_0xc194('0x87')][_0xc194('0x6e')]){return _0x381569['List'][_0xc194('0x87')][0x0];}return db[_0xc194('0x77')]['create'](_[_0xc194('0x1a')](_0x1d929f[_0xc194('0x68')],{'firstName':_0x2f3945,[_0x4ae53b[_0xc194('0x84')]]:_0x2f3945,'phone':_0x2f3945,'ListId':_0x381569[_0xc194('0x7e')]}));}})['then'](handleEntityNotFound(_0x1a1434,null))[_0xc194('0x22')](function(_0x105863){if(_0x105863){_0xa0461c=_0x105863;return db[_0xc194('0x94')]['find']({'where':{'ContactId':_0xa0461c['id'],'closed':![],'OpenchannelAccountId':_0x381569['id']}})[_0xc194('0x22')](function(_0x25dcdb){if(_0x25dcdb){return[_0x25dcdb,![]];}return db[_0xc194('0x94')][_0xc194('0x5e')]({'UserId':_0x1d929f[_0xc194('0x5f')]['id'],'ContactId':_0xa0461c['id'],'OpenchannelAccountId':_0x381569['id'],'lastMsgDirection':_0xc194('0xbe'),'firstMsgDirection':_0xc194('0xbe'),'Messages':[_['merge'](_0x1d929f[_0xc194('0x68')],{'read':![],'body':_0x1d929f[_0xc194('0x68')]['body'],'OpenchannelAccountId':_0x381569['id'],'UserId':_0x1d929f[_0xc194('0x5f')]['id'],'ContactId':_0xa0461c['id']})]},{'include':[{'model':db[_0xc194('0x9b')],'as':_0xc194('0xbf')}]})[_0xc194('0x22')](function(_0x4f3898){return[_0x4f3898,!![]];});});}})['spread'](function(_0x204410,_0x7e2bac){if(_0x7e2bac){return _0x204410;}return db[_0xc194('0x9b')][_0xc194('0x5e')](_['merge'](_0x1d929f[_0xc194('0x68')],{'read':![],'body':_0x1d929f['body'][_0xc194('0x68')],'OpenchannelAccountId':_0x381569['id'],'OpenchannelInteractionId':_0x204410['id'],'UserId':_0x1d929f[_0xc194('0x5f')]['id'],'ContactId':_0xa0461c['id']}))[_0xc194('0x22')](function(_0x23b122){_0x204410[_0xc194('0xc0')][_0xc194('0xbf')]=[];_0x204410[_0xc194('0xc0')][_0xc194('0xbf')][_0xc194('0xc1')](_0x23b122[_0xc194('0xc0')]);return _0x204410;});});}})['then'](respondWithResult(_0x1a1434,null))[_0xc194('0x65')](handleError(_0x1a1434,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 2add5b8..7944d6c 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 _0x1be1=['OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x2cb0ea,_0x8ca503){var _0x1069f0=function(_0x17e3b5){while(--_0x17e3b5){_0x2cb0ea['push'](_0x2cb0ea['shift']());}};_0x1069f0(++_0x8ca503);}(_0x1be1,0x192));var _0x11be=function(_0x528818,_0x516cbb){_0x528818=_0x528818-0x0;var _0x298e32=_0x1be1[_0x528818];return _0x298e32;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x11be('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x11be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11be('0x2'),'afterDestroy':_0x11be('0x3')};function emitEvent(_0x200b2a){return function(_0x318d41,_0x504d3a,_0x3ce56d){OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a+':'+_0x318d41['id'],_0x318d41);OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a,_0x318d41);_0x3ce56d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x11be('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x4483=['../../mysqldb','OpenchannelAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4483,0x1a3));var _0x3448=function(_0x51835c,_0x54e342){_0x51835c=_0x51835c-0x0;var _0x4bf8a6=_0x4483[_0x51835c];return _0x4bf8a6;};'use strict';var EventEmitter=require(_0x3448('0x0'));var OpenchannelAccount=require(_0x3448('0x1'))['db'][_0x3448('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3448('0x3'),'afterUpdate':_0x3448('0x4'),'afterDestroy':_0x3448('0x5')};function emitEvent(_0x3a7178){return function(_0xef1a93,_0x5f5163,_0xeb5b8){OpenchannelAccountEvents[_0x3448('0x6')](_0x3a7178+':'+_0xef1a93['id'],_0xef1a93);OpenchannelAccountEvents[_0x3448('0x6')](_0x3a7178,_0xef1a93);_0xeb5b8(null);};}for(var e in events){if(events[_0x3448('0x7')](e)){var event=events[e];OpenchannelAccount[_0x3448('0x8')](e,emitEvent(event));}}module[_0x3448('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index cdc729b..2a84df2 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(_0x26a929,_0x4c3a61){var _0xc3782=function(_0x34935b){while(--_0x34935b){_0x26a929['push'](_0x26a929['shift']());}};_0xc3782(++_0x4c3a61);}(_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 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(_0xf45674,_0x24962e){var _0x2d2a2e=function(_0x2b6b46){while(--_0x2b6b46){_0xf45674['push'](_0xf45674['shift']());}};_0x2d2a2e(++_0x24962e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 ee7854e..c11bdae 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 _0x073e=['../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../config/utils'];(function(_0x56ebf6,_0x5eb913){var _0x129045=function(_0x43528){while(--_0x43528){_0x56ebf6['push'](_0x56ebf6['shift']());}};_0x129045(++_0x5eb913);}(_0x073e,0x181));var _0xe073=function(_0x26ffba,_0x28c3f3){_0x26ffba=_0x26ffba-0x0;var _0x21243b=_0x073e[_0x26ffba];return _0x21243b;};'use strict';var _=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var moment=require(_0xe073('0x2'));var BPromise=require(_0xe073('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe073('0x4'));var logger=require(_0xe073('0x5'))(_0xe073('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe073('0x7')]({'port':0x232a});config[_0xe073('0x8')]=_[_0xe073('0x9')](config[_0xe073('0x8')],{'host':_0xe073('0xa'),'port':0x18eb});var socket=require(_0xe073('0xb'))(new Redis(config['redis']));require(_0xe073('0xc'))[_0xe073('0xd')](socket);function respondWithRpcPromise(_0x46757c,_0x118048,_0x4fccb1){return new BPromise(function(_0x47ac27,_0x32878f){return client[_0xe073('0xe')](_0x46757c,_0x4fccb1)[_0xe073('0xf')](function(_0x3a9df1){logger[_0xe073('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x118048,_0xe073('0x11'));logger['debug'](_0xe073('0x12'),_0x118048,'request\x20sent',JSON[_0xe073('0x13')](_0x3a9df1));if(_0x3a9df1['error']){if(_0x3a9df1[_0xe073('0x14')][_0xe073('0x15')]===0x1f4){logger[_0xe073('0x14')](_0xe073('0x16'),_0x118048,_0x3a9df1[_0xe073('0x14')][_0xe073('0x17')]);return _0x32878f(_0x3a9df1[_0xe073('0x14')][_0xe073('0x17')]);}logger[_0xe073('0x14')](_0xe073('0x16'),_0x118048,_0x3a9df1[_0xe073('0x14')]['message']);return _0x47ac27(_0x3a9df1['error']['message']);}else{logger[_0xe073('0x10')](_0xe073('0x16'),_0x118048,_0xe073('0x11'));_0x47ac27(_0x3a9df1[_0xe073('0x18')]['message']);}})[_0xe073('0x19')](function(_0x103a51){logger[_0xe073('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x118048,_0x103a51);_0x32878f(_0x103a51);});});} \ No newline at end of file +var _0xb9a7=['catch','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x4de013,_0x3ebd8e){var _0x2e079d=function(_0x4e18c0){while(--_0x4e18c0){_0x4de013['push'](_0x4de013['shift']());}};_0x2e079d(++_0x3ebd8e);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xb9a7[_0x1b2ff7];return _0x31656a;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});config[_0x7b9a('0x9')]=_[_0x7b9a('0xa')](config[_0x7b9a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b9a('0xb'))(new Redis(config[_0x7b9a('0x9')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x47e220,_0x15bc5b,_0x31f3b7){return new BPromise(function(_0x4cf090,_0x32c85d){return client['request'](_0x47e220,_0x31f3b7)[_0x7b9a('0xc')](function(_0x597732){logger[_0x7b9a('0xd')](_0x7b9a('0xe'),_0x15bc5b,_0x7b9a('0xf'));logger['debug'](_0x7b9a('0x10'),_0x15bc5b,_0x7b9a('0xf'),JSON['stringify'](_0x597732));if(_0x597732[_0x7b9a('0x11')]){if(_0x597732[_0x7b9a('0x11')]['code']===0x1f4){logger[_0x7b9a('0x11')](_0x7b9a('0xe'),_0x15bc5b,_0x597732[_0x7b9a('0x11')][_0x7b9a('0x12')]);return _0x32c85d(_0x597732[_0x7b9a('0x11')][_0x7b9a('0x12')]);}logger[_0x7b9a('0x11')](_0x7b9a('0xe'),_0x15bc5b,_0x597732[_0x7b9a('0x11')]['message']);return _0x4cf090(_0x597732[_0x7b9a('0x11')]['message']);}else{logger[_0x7b9a('0xd')](_0x7b9a('0xe'),_0x15bc5b,_0x7b9a('0xf'));_0x4cf090(_0x597732[_0x7b9a('0x13')][_0x7b9a('0x12')]);}})[_0x7b9a('0x14')](function(_0x27ad55){logger[_0x7b9a('0x11')](_0x7b9a('0xe'),_0x15bc5b,_0x27ad55);_0x32c85d(_0x27ad55);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 491174a..36bb72c 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 _0x9234=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','remove','update'];(function(_0x36385f,_0x2936d0){var _0x70e38c=function(_0x47c0d8){while(--_0x47c0d8){_0x36385f['push'](_0x36385f['shift']());}};_0x70e38c(++_0x2936d0);}(_0x9234,0x1bd));var _0x4923=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0x9234[_0x17e771];return _0x1f3a6d;};'use strict';var OpenchannelAccountEvents=require(_0x4923('0x0'));var events=['save',_0x4923('0x1'),_0x4923('0x2')];function createListener(_0x1f0d3a,_0x34915b){return function(_0x481178){_0x34915b[_0x4923('0x3')](_0x1f0d3a,_0x481178);};}function removeListener(_0x436ce1,_0x4bf615){return function(){OpenchannelAccountEvents[_0x4923('0x4')](_0x436ce1,_0x4bf615);};}exports[_0x4923('0x5')]=function(_0x526ad7){for(var _0x3c5e3f=0x0,_0x17b854=events[_0x4923('0x6')];_0x3c5e3f<_0x17b854;_0x3c5e3f++){var _0x2de396=events[_0x3c5e3f];var _0x548676=createListener(_0x4923('0x7')+_0x2de396,_0x526ad7);OpenchannelAccountEvents['on'](_0x2de396,_0x548676);}}; \ No newline at end of file +var _0xce25=['openchannelAccount:','remove','emit','removeListener','length'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xce25,0x196));var _0x5ce2=function(_0x2fdc26,_0x1268e1){_0x2fdc26=_0x2fdc26-0x0;var _0x1abf21=_0xce25[_0x2fdc26];return _0x1abf21;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x5ce2('0x0'),'update'];function createListener(_0x57ab25,_0x4dc355){return function(_0x5c8966){_0x4dc355[_0x5ce2('0x1')](_0x57ab25,_0x5c8966);};}function removeListener(_0x58f9eb,_0x3f4b36){return function(){OpenchannelAccountEvents[_0x5ce2('0x2')](_0x58f9eb,_0x3f4b36);};}exports['register']=function(_0x57a7a5){for(var _0x41fb85=0x0,_0x417149=events[_0x5ce2('0x3')];_0x41fb85<_0x417149;_0x41fb85++){var _0xcb80ee=events[_0x41fb85];var _0x4a57a6=createListener(_0x5ce2('0x4')+_0xcb80ee,_0x57a7a5);OpenchannelAccountEvents['on'](_0xcb80ee,_0x4a57a6);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 74048ef..6e085fa 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 _0x0b78=['put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0b78,0x1a7));var _0x80b7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0b78[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var path=require(_0x80b7('0x2'));var timeout=require(_0x80b7('0x3'));var express=require(_0x80b7('0x4'));var router=express[_0x80b7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x80b7('0x6'));var config=require('../../config/environment');var controller=require(_0x80b7('0x7'));router[_0x80b7('0x8')]('/',auth[_0x80b7('0x9')](),controller[_0x80b7('0xa')]);router['get']('/:id',auth[_0x80b7('0x9')](),controller[_0x80b7('0xb')]);router[_0x80b7('0xc')]('/',auth[_0x80b7('0x9')](),controller[_0x80b7('0xd')]);router[_0x80b7('0xe')](_0x80b7('0xf'),auth[_0x80b7('0x9')](),controller[_0x80b7('0x10')]);router[_0x80b7('0x11')](_0x80b7('0xf'),auth[_0x80b7('0x9')](),controller['destroy']);module[_0x80b7('0x12')]=router; \ No newline at end of file +var _0xacd7=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x2ea087,_0x17f324){var _0x23ebac=function(_0x5575d8){while(--_0x5575d8){_0x2ea087['push'](_0x2ea087['shift']());}};_0x23ebac(++_0x17f324);}(_0xacd7,0x1af));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7acd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7acd('0x1'));var express=require('express');var router=express[_0x7acd('0x2')]();var fs_extra=require(_0x7acd('0x3'));var auth=require(_0x7acd('0x4'));var interaction=require(_0x7acd('0x5'));var config=require(_0x7acd('0x6'));var controller=require('./openchannelApplication.controller');router[_0x7acd('0x7')]('/',auth[_0x7acd('0x8')](),controller[_0x7acd('0x9')]);router[_0x7acd('0x7')](_0x7acd('0xa'),auth[_0x7acd('0x8')](),controller[_0x7acd('0xb')]);router[_0x7acd('0xc')]('/',auth[_0x7acd('0x8')](),controller[_0x7acd('0xd')]);router[_0x7acd('0xe')](_0x7acd('0xa'),auth[_0x7acd('0x8')](),controller['update']);router[_0x7acd('0xf')](_0x7acd('0xa'),auth[_0x7acd('0x8')](),controller[_0x7acd('0x10')]);module[_0x7acd('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index f5196e2..b8bb401 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 _0xe37b=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x5f06f4,_0x9c4c81){var _0x2ac76d=function(_0x10d710){while(--_0x10d710){_0x5f06f4['push'](_0x5f06f4['shift']());}};_0x2ac76d(++_0x9c4c81);}(_0xe37b,0x1a2));var _0xbe37=function(_0x3ccf2e,_0x54096c){_0x3ccf2e=_0x3ccf2e-0x0;var _0x5979a0=_0xe37b[_0x3ccf2e];return _0x5979a0;};'use strict';var Sequelize=require(_0xbe37('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbe37('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbe37('0x2')],'allowNull':![],'defaultValue':_0xbe37('0x3')},'appdata':{'type':Sequelize[_0xbe37('0x4')]()},'description':{'type':Sequelize[_0xbe37('0x2')]},'interval':{'type':Sequelize[_0xbe37('0x2')],'defaultValue':_0xbe37('0x5')}}; \ No newline at end of file +var _0x9375=['sequelize','STRING','noop','TEXT','*,*,*,*'];(function(_0x1d41a2,_0x33011b){var _0x241d1c=function(_0x1c8b0a){while(--_0x1c8b0a){_0x1d41a2['push'](_0x1d41a2['shift']());}};_0x241d1c(++_0x33011b);}(_0x9375,0xd2));var _0x5937=function(_0x35cb6b,_0x5cb855){_0x35cb6b=_0x35cb6b-0x0;var _0x501672=_0x9375[_0x35cb6b];return _0x501672;};'use strict';var Sequelize=require(_0x5937('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5937('0x1')],'allowNull':![],'defaultValue':_0x5937('0x2')},'appdata':{'type':Sequelize[_0x5937('0x3')]()},'description':{'type':Sequelize[_0x5937('0x1')]},'interval':{'type':Sequelize[_0x5937('0x1')],'defaultValue':_0x5937('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b6c66ea..266ca6d 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 _0xbde6=['to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','map','OpenchannelApplication','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xbde6,0xd3));var _0x6bde=function(_0x23e466,_0x1f98ff){_0x23e466=_0x23e466-0x0;var _0x449b48=_0xbde6[_0x23e466];return _0x449b48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6bde('0x0'));var zipdir=require(_0x6bde('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6bde('0x2'));var moment=require('moment');var BPromise=require(_0x6bde('0x3'));var Mustache=require(_0x6bde('0x4'));var util=require(_0x6bde('0x5'));var path=require(_0x6bde('0x6'));var sox=require(_0x6bde('0x7'));var csv=require(_0x6bde('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6bde('0x9'));var squel=require(_0x6bde('0xa'));var crypto=require(_0x6bde('0xb'));var jsforce=require(_0x6bde('0xc'));var deskjs=require(_0x6bde('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6bde('0xe'));var Redis=require(_0x6bde('0xf'));var authService=require(_0x6bde('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6bde('0x11'));var hardwareService=require(_0x6bde('0x12'));var logger=require(_0x6bde('0x13'))('api');var utils=require(_0x6bde('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6bde('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x597d2c,_0x319bdc){_0x319bdc=_0x319bdc||0xcc;return function(_0x5dd4f1){if(_0x5dd4f1){return _0x597d2c[_0x6bde('0x16')](_0x319bdc);}return _0x597d2c['status'](_0x319bdc)[_0x6bde('0x17')]();};}function respondWithResult(_0x3a8b58,_0x4814b8){_0x4814b8=_0x4814b8||0xc8;return function(_0x624735){if(_0x624735){return _0x3a8b58[_0x6bde('0x18')](_0x4814b8)[_0x6bde('0x19')](_0x624735);}};}function respondWithFilteredResult(_0x2c0924,_0x596bbd){return function(_0x3a870d){if(_0x3a870d){var _0x3449f8=typeof _0x596bbd['offset']===_0x6bde('0x1a')&&typeof _0x596bbd[_0x6bde('0x1b')]===_0x6bde('0x1a');var _0x485c10=_0x3a870d[_0x6bde('0x1c')];var _0x41ec61=_0x3449f8?0x0:_0x596bbd[_0x6bde('0x1d')];var _0x513e38=_0x3449f8?_0x3a870d['count']:_0x596bbd[_0x6bde('0x1d')]+_0x596bbd[_0x6bde('0x1b')];var _0x157b80;if(_0x513e38>=_0x485c10){_0x513e38=_0x485c10;_0x157b80=0xc8;}else{_0x157b80=0xce;}_0x2c0924[_0x6bde('0x18')](_0x157b80);return _0x2c0924[_0x6bde('0x1e')](_0x6bde('0x1f'),_0x41ec61+'-'+_0x513e38+'/'+_0x485c10)[_0x6bde('0x19')](_0x3a870d);}return null;};}function patchUpdates(_0x4a0004){return function(_0x3ac60b){try{jsonpatch[_0x6bde('0x20')](_0x3ac60b,_0x4a0004,!![]);}catch(_0x3d4ed7){return BPromise[_0x6bde('0x21')](_0x3d4ed7);}return _0x3ac60b['save']();};}function saveUpdates(_0x218047,_0x3f30b7){return function(_0x29c308){if(_0x29c308){return _0x29c308['update'](_0x218047)['then'](function(_0x3b85de){return _0x3b85de;});}return null;};}function removeEntity(_0x2ad926,_0x16d2a6){return function(_0x33ba04){if(_0x33ba04){return _0x33ba04[_0x6bde('0x22')]()[_0x6bde('0x23')](function(){_0x2ad926['status'](0xcc)[_0x6bde('0x17')]();});}};}function handleEntityNotFound(_0x5d40ab,_0x4105c0){return function(_0x3e4d00){if(!_0x3e4d00){_0x5d40ab[_0x6bde('0x16')](0x194);}return _0x3e4d00;};}function handleError(_0x143cf8,_0x467a80){_0x467a80=_0x467a80||0x1f4;return function(_0x2391f6){logger[_0x6bde('0x24')](_0x2391f6[_0x6bde('0x25')]);if(_0x2391f6[_0x6bde('0x26')]){delete _0x2391f6['name'];}_0x143cf8[_0x6bde('0x18')](_0x467a80)[_0x6bde('0x27')](_0x2391f6);};}exports[_0x6bde('0x28')]=function(_0x2e11ce,_0x3c2093){var _0x5b119f={},_0x2ee7bc={},_0x401305={'count':0x0,'rows':[]};var _0x3e5c25=_[_0x6bde('0x29')](db[_0x6bde('0x2a')]['rawAttributes'],function(_0x1dda99){return{'name':_0x1dda99[_0x6bde('0x2b')],'type':_0x1dda99['type'][_0x6bde('0x2c')]};});_0x2ee7bc[_0x6bde('0x2d')]=_[_0x6bde('0x29')](_0x3e5c25,_0x6bde('0x26'));_0x2ee7bc[_0x6bde('0x2e')]=_[_0x6bde('0x2f')](_0x2e11ce[_0x6bde('0x2e')]);_0x2ee7bc[_0x6bde('0x30')]=_[_0x6bde('0x31')](_0x2ee7bc[_0x6bde('0x2d')],_0x2ee7bc[_0x6bde('0x2e')]);_0x5b119f['attributes']=_[_0x6bde('0x31')](_0x2ee7bc[_0x6bde('0x2d')],qs['fields'](_0x2e11ce[_0x6bde('0x2e')][_0x6bde('0x32')]));_0x5b119f[_0x6bde('0x33')]=_0x5b119f[_0x6bde('0x33')][_0x6bde('0x34')]?_0x5b119f[_0x6bde('0x33')]:_0x2ee7bc['model'];if(!_0x2e11ce[_0x6bde('0x2e')]['hasOwnProperty'](_0x6bde('0x35'))){_0x5b119f[_0x6bde('0x1b')]=qs['limit'](_0x2e11ce['query'][_0x6bde('0x1b')]);_0x5b119f[_0x6bde('0x1d')]=qs[_0x6bde('0x1d')](_0x2e11ce[_0x6bde('0x2e')]['offset']);}_0x5b119f[_0x6bde('0x36')]=qs[_0x6bde('0x37')](_0x2e11ce[_0x6bde('0x2e')][_0x6bde('0x37')]);_0x5b119f[_0x6bde('0x38')]=qs[_0x6bde('0x30')](_[_0x6bde('0x39')](_0x2e11ce[_0x6bde('0x2e')],_0x2ee7bc[_0x6bde('0x30')]),_0x3e5c25);if(_0x2e11ce['query'][_0x6bde('0x3a')]){_0x5b119f[_0x6bde('0x38')]=_[_0x6bde('0x3b')](_0x5b119f['where'],{'$or':_[_0x6bde('0x29')](_0x3e5c25,function(_0xea56ef){if(_0xea56ef[_0x6bde('0x3c')]!==_0x6bde('0x3d')){var _0x5052f0={};_0x5052f0[_0xea56ef['name']]={'$like':'%'+_0x2e11ce[_0x6bde('0x2e')][_0x6bde('0x3a')]+'%'};return _0x5052f0;}})});}_0x5b119f=_['merge']({},_0x5b119f,_0x2e11ce[_0x6bde('0x3e')]);var _0x20b85e={'where':_0x5b119f[_0x6bde('0x38')]};return db[_0x6bde('0x2a')]['count'](_0x20b85e)['then'](function(_0x26400d){_0x401305[_0x6bde('0x1c')]=_0x26400d;if(_0x2e11ce[_0x6bde('0x2e')]['includeAll']){_0x5b119f['include']=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x5b119f);})['then'](function(_0x36cbd6){_0x401305[_0x6bde('0x3f')]=_0x36cbd6;return _0x401305;})[_0x6bde('0x23')](respondWithFilteredResult(_0x3c2093,_0x5b119f))[_0x6bde('0x40')](handleError(_0x3c2093,null));};exports[_0x6bde('0x41')]=function(_0xc6a871,_0xd6c8ca){var _0x44e91d={'raw':!![],'where':{'id':_0xc6a871[_0x6bde('0x42')]['id']}},_0x4f76fd={};_0x4f76fd['model']=_[_0x6bde('0x2f')](db[_0x6bde('0x2a')][_0x6bde('0x43')]);_0x4f76fd[_0x6bde('0x2e')]=_[_0x6bde('0x2f')](_0xc6a871['query']);_0x4f76fd[_0x6bde('0x30')]=_[_0x6bde('0x31')](_0x4f76fd[_0x6bde('0x2d')],_0x4f76fd[_0x6bde('0x2e')]);_0x44e91d[_0x6bde('0x33')]=_[_0x6bde('0x31')](_0x4f76fd['model'],qs[_0x6bde('0x32')](_0xc6a871[_0x6bde('0x2e')][_0x6bde('0x32')]));_0x44e91d['attributes']=_0x44e91d[_0x6bde('0x33')][_0x6bde('0x34')]?_0x44e91d[_0x6bde('0x33')]:_0x4f76fd['model'];if(_0xc6a871[_0x6bde('0x2e')][_0x6bde('0x44')]){_0x44e91d[_0x6bde('0x45')]=[{'all':!![]}];}_0x44e91d=_[_0x6bde('0x3b')]({},_0x44e91d,_0xc6a871[_0x6bde('0x3e')]);return db['OpenchannelApplication'][_0x6bde('0x46')](_0x44e91d)[_0x6bde('0x23')](handleEntityNotFound(_0xd6c8ca,null))[_0x6bde('0x23')](respondWithResult(_0xd6c8ca,null))[_0x6bde('0x40')](handleError(_0xd6c8ca,null));};exports[_0x6bde('0x47')]=function(_0x4f5d9f,_0x2a6a79){return db[_0x6bde('0x2a')][_0x6bde('0x47')](_0x4f5d9f[_0x6bde('0x48')],{})[_0x6bde('0x23')](respondWithResult(_0x2a6a79,0xc9))[_0x6bde('0x40')](handleError(_0x2a6a79,null));};exports['update']=function(_0x22f13e,_0x43d3ec){if(_0x22f13e[_0x6bde('0x48')]['id']){delete _0x22f13e[_0x6bde('0x48')]['id'];}return db[_0x6bde('0x2a')][_0x6bde('0x46')]({'where':{'id':_0x22f13e[_0x6bde('0x42')]['id']}})[_0x6bde('0x23')](handleEntityNotFound(_0x43d3ec,null))[_0x6bde('0x23')](saveUpdates(_0x22f13e['body'],null))[_0x6bde('0x23')](respondWithResult(_0x43d3ec,null))['catch'](handleError(_0x43d3ec,null));};exports[_0x6bde('0x22')]=function(_0x27eb46,_0x2921d0){return db[_0x6bde('0x2a')][_0x6bde('0x46')]({'where':{'id':_0x27eb46[_0x6bde('0x42')]['id']}})[_0x6bde('0x23')](handleEntityNotFound(_0x2921d0,null))['then'](removeEntity(_0x2921d0,null))[_0x6bde('0x40')](handleError(_0x2921d0,null));}; \ No newline at end of file +var _0xe92a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','OpenchannelApplication','rawAttributes','key','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','fields','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x4ddbcf,_0xd822b0){var _0x45da65=function(_0x362027){while(--_0x362027){_0x4ddbcf['push'](_0x4ddbcf['shift']());}};_0x45da65(++_0xd822b0);}(_0xe92a,0x85));var _0xae92=function(_0x398c23,_0x294a30){_0x398c23=_0x398c23-0x0;var _0x5392c0=_0xe92a[_0x398c23];return _0x5392c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae92('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae92('0x1'));var rp=require(_0xae92('0x2'));var moment=require(_0xae92('0x3'));var BPromise=require(_0xae92('0x4'));var Mustache=require('mustache');var util=require(_0xae92('0x5'));var path=require('path');var sox=require(_0xae92('0x6'));var csv=require(_0xae92('0x7'));var ejs=require(_0xae92('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae92('0x9'));var squel=require(_0xae92('0xa'));var crypto=require('crypto');var jsforce=require(_0xae92('0xb'));var deskjs=require(_0xae92('0xc'));var toCsv=require('to-csv');var querystring=require(_0xae92('0xd'));var Papa=require(_0xae92('0xe'));var Redis=require('ioredis');var authService=require(_0xae92('0xf'));var qs=require(_0xae92('0x10'));var as=require(_0xae92('0x11'));var hardwareService=require(_0xae92('0x12'));var logger=require(_0xae92('0x13'))(_0xae92('0x14'));var utils=require(_0xae92('0x15'));var config=require(_0xae92('0x16'));var licenseUtil=require(_0xae92('0x17'));var db=require(_0xae92('0x18'))['db'];function respondWithStatusCode(_0x5ba226,_0x51e4ea){_0x51e4ea=_0x51e4ea||0xcc;return function(_0x57332b){if(_0x57332b){return _0x5ba226[_0xae92('0x19')](_0x51e4ea);}return _0x5ba226[_0xae92('0x1a')](_0x51e4ea)[_0xae92('0x1b')]();};}function respondWithResult(_0x4aafdf,_0x1de825){_0x1de825=_0x1de825||0xc8;return function(_0x534e91){if(_0x534e91){return _0x4aafdf['status'](_0x1de825)[_0xae92('0x1c')](_0x534e91);}};}function respondWithFilteredResult(_0x116806,_0x13ae2c){return function(_0x5157d9){if(_0x5157d9){var _0x5f0414=typeof _0x13ae2c['offset']===_0xae92('0x1d')&&typeof _0x13ae2c[_0xae92('0x1e')]===_0xae92('0x1d');var _0xf12372=_0x5157d9[_0xae92('0x1f')];var _0x5443df=_0x5f0414?0x0:_0x13ae2c['offset'];var _0x116898=_0x5f0414?_0x5157d9['count']:_0x13ae2c[_0xae92('0x20')]+_0x13ae2c['limit'];var _0x2842d7;if(_0x116898>=_0xf12372){_0x116898=_0xf12372;_0x2842d7=0xc8;}else{_0x2842d7=0xce;}_0x116806[_0xae92('0x1a')](_0x2842d7);return _0x116806[_0xae92('0x21')](_0xae92('0x22'),_0x5443df+'-'+_0x116898+'/'+_0xf12372)['json'](_0x5157d9);}return null;};}function patchUpdates(_0x186297){return function(_0x5738b1){try{jsonpatch[_0xae92('0x23')](_0x5738b1,_0x186297,!![]);}catch(_0x3d6c5d){return BPromise[_0xae92('0x24')](_0x3d6c5d);}return _0x5738b1['save']();};}function saveUpdates(_0x29fd3d,_0x5c637c){return function(_0x4ca592){if(_0x4ca592){return _0x4ca592[_0xae92('0x25')](_0x29fd3d)[_0xae92('0x26')](function(_0x1878be){return _0x1878be;});}return null;};}function removeEntity(_0x55267a,_0x3c44a1){return function(_0x4d38d0){if(_0x4d38d0){return _0x4d38d0[_0xae92('0x27')]()[_0xae92('0x26')](function(){_0x55267a[_0xae92('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x183ede,_0x1c88b2){return function(_0x255e34){if(!_0x255e34){_0x183ede[_0xae92('0x19')](0x194);}return _0x255e34;};}function handleError(_0x5973b9,_0x15d716){_0x15d716=_0x15d716||0x1f4;return function(_0x5a1022){logger[_0xae92('0x28')](_0x5a1022[_0xae92('0x29')]);if(_0x5a1022[_0xae92('0x2a')]){delete _0x5a1022[_0xae92('0x2a')];}_0x5973b9[_0xae92('0x1a')](_0x15d716)['send'](_0x5a1022);};}exports[_0xae92('0x2b')]=function(_0x3fc74e,_0x1eec51){var _0x2a9bd2={},_0x454aeb={},_0xc05e83={'count':0x0,'rows':[]};var _0x530efd=_[_0xae92('0x2c')](db[_0xae92('0x2d')][_0xae92('0x2e')],function(_0x10ef52){return{'name':_0x10ef52['fieldName'],'type':_0x10ef52['type'][_0xae92('0x2f')]};});_0x454aeb['model']=_[_0xae92('0x2c')](_0x530efd,_0xae92('0x2a'));_0x454aeb[_0xae92('0x30')]=_['keys'](_0x3fc74e['query']);_0x454aeb[_0xae92('0x31')]=_[_0xae92('0x32')](_0x454aeb[_0xae92('0x33')],_0x454aeb['query']);_0x2a9bd2['attributes']=_[_0xae92('0x32')](_0x454aeb[_0xae92('0x33')],qs['fields'](_0x3fc74e[_0xae92('0x30')]['fields']));_0x2a9bd2[_0xae92('0x34')]=_0x2a9bd2[_0xae92('0x34')]['length']?_0x2a9bd2[_0xae92('0x34')]:_0x454aeb['model'];if(!_0x3fc74e['query'][_0xae92('0x35')](_0xae92('0x36'))){_0x2a9bd2[_0xae92('0x1e')]=qs[_0xae92('0x1e')](_0x3fc74e[_0xae92('0x30')]['limit']);_0x2a9bd2[_0xae92('0x20')]=qs[_0xae92('0x20')](_0x3fc74e[_0xae92('0x30')][_0xae92('0x20')]);}_0x2a9bd2[_0xae92('0x37')]=qs[_0xae92('0x38')](_0x3fc74e['query'][_0xae92('0x38')]);_0x2a9bd2[_0xae92('0x39')]=qs['filters'](_['pick'](_0x3fc74e['query'],_0x454aeb[_0xae92('0x31')]),_0x530efd);if(_0x3fc74e[_0xae92('0x30')]['filter']){_0x2a9bd2[_0xae92('0x39')]=_[_0xae92('0x3a')](_0x2a9bd2[_0xae92('0x39')],{'$or':_[_0xae92('0x2c')](_0x530efd,function(_0x411e77){if(_0x411e77[_0xae92('0x3b')]!==_0xae92('0x3c')){var _0x41dfbf={};_0x41dfbf[_0x411e77[_0xae92('0x2a')]]={'$like':'%'+_0x3fc74e['query'][_0xae92('0x3d')]+'%'};return _0x41dfbf;}})});}_0x2a9bd2=_['merge']({},_0x2a9bd2,_0x3fc74e[_0xae92('0x3e')]);var _0x46b16e={'where':_0x2a9bd2[_0xae92('0x39')]};return db['OpenchannelApplication']['count'](_0x46b16e)[_0xae92('0x26')](function(_0x274526){_0xc05e83[_0xae92('0x1f')]=_0x274526;if(_0x3fc74e[_0xae92('0x30')][_0xae92('0x3f')]){_0x2a9bd2[_0xae92('0x40')]=[{'all':!![]}];}return db[_0xae92('0x2d')]['findAll'](_0x2a9bd2);})[_0xae92('0x26')](function(_0x3b4f8f){_0xc05e83[_0xae92('0x41')]=_0x3b4f8f;return _0xc05e83;})[_0xae92('0x26')](respondWithFilteredResult(_0x1eec51,_0x2a9bd2))[_0xae92('0x42')](handleError(_0x1eec51,null));};exports[_0xae92('0x43')]=function(_0x30070a,_0x15324f){var _0x40c099={'raw':!![],'where':{'id':_0x30070a[_0xae92('0x44')]['id']}},_0x1003bb={};_0x1003bb[_0xae92('0x33')]=_[_0xae92('0x45')](db[_0xae92('0x2d')][_0xae92('0x2e')]);_0x1003bb[_0xae92('0x30')]=_['keys'](_0x30070a[_0xae92('0x30')]);_0x1003bb[_0xae92('0x31')]=_[_0xae92('0x32')](_0x1003bb['model'],_0x1003bb['query']);_0x40c099[_0xae92('0x34')]=_['intersection'](_0x1003bb[_0xae92('0x33')],qs[_0xae92('0x46')](_0x30070a[_0xae92('0x30')][_0xae92('0x46')]));_0x40c099['attributes']=_0x40c099[_0xae92('0x34')]['length']?_0x40c099[_0xae92('0x34')]:_0x1003bb[_0xae92('0x33')];if(_0x30070a[_0xae92('0x30')][_0xae92('0x3f')]){_0x40c099[_0xae92('0x40')]=[{'all':!![]}];}_0x40c099=_[_0xae92('0x3a')]({},_0x40c099,_0x30070a[_0xae92('0x3e')]);return db[_0xae92('0x2d')][_0xae92('0x47')](_0x40c099)[_0xae92('0x26')](handleEntityNotFound(_0x15324f,null))[_0xae92('0x26')](respondWithResult(_0x15324f,null))[_0xae92('0x42')](handleError(_0x15324f,null));};exports[_0xae92('0x48')]=function(_0x1cd941,_0x3ac312){return db[_0xae92('0x2d')][_0xae92('0x48')](_0x1cd941[_0xae92('0x49')],{})['then'](respondWithResult(_0x3ac312,0xc9))[_0xae92('0x42')](handleError(_0x3ac312,null));};exports[_0xae92('0x25')]=function(_0x5ded12,_0x4f084e){if(_0x5ded12[_0xae92('0x49')]['id']){delete _0x5ded12['body']['id'];}return db[_0xae92('0x2d')]['find']({'where':{'id':_0x5ded12[_0xae92('0x44')]['id']}})[_0xae92('0x26')](handleEntityNotFound(_0x4f084e,null))['then'](saveUpdates(_0x5ded12[_0xae92('0x49')],null))['then'](respondWithResult(_0x4f084e,null))[_0xae92('0x42')](handleError(_0x4f084e,null));};exports[_0xae92('0x27')]=function(_0x1e3d89,_0x4911b2){return db[_0xae92('0x2d')]['find']({'where':{'id':_0x1e3d89[_0xae92('0x44')]['id']}})[_0xae92('0x26')](handleEntityNotFound(_0x4911b2,null))['then'](removeEntity(_0x4911b2,null))[_0xae92('0x42')](handleError(_0x4911b2,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 132ec38..1010448 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 _0x82d3=['path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x27f36c,_0x48de51){var _0x3cdebe=function(_0x218f5a){while(--_0x218f5a){_0x27f36c['push'](_0x27f36c['shift']());}};_0x3cdebe(++_0x48de51);}(_0x82d3,0x182));var _0x382d=function(_0x4a4f4a,_0x44e8ed){_0x4a4f4a=_0x4a4f4a-0x0;var _0x340750=_0x82d3[_0x4a4f4a];return _0x340750;};'use strict';var _=require(_0x382d('0x0'));var util=require(_0x382d('0x1'));var logger=require(_0x382d('0x2'))(_0x382d('0x3'));var moment=require('moment');var BPromise=require(_0x382d('0x4'));var rp=require(_0x382d('0x5'));var fs=require('fs');var path=require(_0x382d('0x6'));var rimraf=require(_0x382d('0x7'));var config=require(_0x382d('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0x382d('0x9')]=function(_0x4217e8,_0x14028e){return _0x4217e8[_0x382d('0xa')](_0x382d('0xb'),attributes,{'tableName':_0x382d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x382d('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe60b=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','OpenchannelApplication'];(function(_0x1ee04d,_0x4b9f61){var _0x46a06e=function(_0x515e3a){while(--_0x515e3a){_0x1ee04d['push'](_0x1ee04d['shift']());}};_0x46a06e(++_0x4b9f61);}(_0xe60b,0xc3));var _0xbe60=function(_0x5ea50f,_0x372820){_0x5ea50f=_0x5ea50f-0x0;var _0x5c44aa=_0xe60b[_0x5ea50f];return _0x5c44aa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbe60('0x0'))(_0xbe60('0x1'));var moment=require(_0xbe60('0x2'));var BPromise=require(_0xbe60('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe60('0x4'));var rimraf=require(_0xbe60('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xbe60('0x6')]=function(_0x1ab7d1,_0x56827a){return _0x1ab7d1[_0xbe60('0x7')](_0xbe60('0x8'),attributes,{'tableName':_0xbe60('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe60('0xa'),'collate':_0xbe60('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index a121076..3e3de4e 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 _0xb480=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','UpdateOpenchannelApplication','update','body','options','where','attributes','lodash'];(function(_0x144afa,_0x5b9c2c){var _0x151dc2=function(_0x32f4be){while(--_0x32f4be){_0x144afa['push'](_0x144afa['shift']());}};_0x151dc2(++_0x5b9c2c);}(_0xb480,0xae));var _0x0b48=function(_0x4996b5,_0x3dd11c){_0x4996b5=_0x4996b5-0x0;var _0x368f55=_0xb480[_0x4996b5];return _0x368f55;};'use strict';var _=require(_0x0b48('0x0'));var util=require('util');var moment=require(_0x0b48('0x1'));var BPromise=require(_0x0b48('0x2'));var rs=require(_0x0b48('0x3'));var fs=require('fs');var Redis=require(_0x0b48('0x4'));var db=require(_0x0b48('0x5'))['db'];var utils=require(_0x0b48('0x6'));var logger=require(_0x0b48('0x7'))(_0x0b48('0x8'));var config=require('../../config/environment');var jayson=require(_0x0b48('0x9'));var client=jayson['client'][_0x0b48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf8ed5c,_0x340d26,_0x4285cd){return new BPromise(function(_0xa3d660,_0x146a06){return client[_0x0b48('0xb')](_0xf8ed5c,_0x4285cd)[_0x0b48('0xc')](function(_0x2ddd21){logger['info'](_0x0b48('0xd'),_0x340d26,_0x0b48('0xe'));logger[_0x0b48('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x340d26,'request\x20sent',JSON['stringify'](_0x2ddd21));if(_0x2ddd21[_0x0b48('0x10')]){if(_0x2ddd21[_0x0b48('0x10')]['code']===0x1f4){logger['error'](_0x0b48('0xd'),_0x340d26,_0x2ddd21[_0x0b48('0x10')][_0x0b48('0x11')]);return _0x146a06(_0x2ddd21[_0x0b48('0x10')][_0x0b48('0x11')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x340d26,_0x2ddd21[_0x0b48('0x10')][_0x0b48('0x11')]);return _0xa3d660(_0x2ddd21[_0x0b48('0x10')][_0x0b48('0x11')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x340d26,_0x0b48('0xe'));_0xa3d660(_0x2ddd21['result'][_0x0b48('0x11')]);}})[_0x0b48('0x12')](function(_0x189891){logger[_0x0b48('0x10')](_0x0b48('0xd'),_0x340d26,_0x189891);_0x146a06(_0x189891);});});}exports[_0x0b48('0x13')]=function(_0x25a9dd){var _0x56cd2b=this;return new Promise(function(_0x29b182,_0x27270f){return db['OpenchannelApplication'][_0x0b48('0x14')](_0x25a9dd[_0x0b48('0x15')],{'raw':_0x25a9dd[_0x0b48('0x16')]?_0x25a9dd[_0x0b48('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25a9dd['options']?_0x25a9dd['options'][_0x0b48('0x17')]||null:null,'attributes':_0x25a9dd['options']?_0x25a9dd[_0x0b48('0x16')][_0x0b48('0x18')]||null:null,'limit':_0x25a9dd[_0x0b48('0x16')]?_0x25a9dd['options']['limit']||null:null})[_0x0b48('0xc')](function(_0x43b9b1){logger['info'](_0x0b48('0x13'),_0x25a9dd);logger[_0x0b48('0xf')](_0x0b48('0x13'),_0x25a9dd,JSON['stringify'](_0x43b9b1));_0x29b182(_0x43b9b1);})['catch'](function(_0x182814){logger[_0x0b48('0x10')]('UpdateOpenchannelApplication',_0x182814['message'],_0x25a9dd);_0x27270f(_0x56cd2b[_0x0b48('0x10')](0x1f4,_0x182814['message']));});});}; \ No newline at end of file +var _0x362b=['body','options','raw','limit','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x362b,0x18c));var _0xb362=function(_0x3e1c70,_0x2ac2f5){_0x3e1c70=_0x3e1c70-0x0;var _0x4bf3fb=_0x362b[_0x3e1c70];return _0x4bf3fb;};'use strict';var _=require('lodash');var util=require(_0xb362('0x0'));var moment=require('moment');var BPromise=require(_0xb362('0x1'));var rs=require(_0xb362('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb362('0x3'))['db'];var utils=require(_0xb362('0x4'));var logger=require(_0xb362('0x5'))(_0xb362('0x6'));var config=require(_0xb362('0x7'));var jayson=require(_0xb362('0x8'));var client=jayson[_0xb362('0x9')][_0xb362('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x186e01,_0x533249,_0x3760ae){return new BPromise(function(_0x23e963,_0x17e30f){return client[_0xb362('0xb')](_0x186e01,_0x3760ae)['then'](function(_0x18ccdf){logger[_0xb362('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x533249,_0xb362('0xd'));logger[_0xb362('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x533249,'request\x20sent',JSON[_0xb362('0xf')](_0x18ccdf));if(_0x18ccdf[_0xb362('0x10')]){if(_0x18ccdf[_0xb362('0x10')]['code']===0x1f4){logger[_0xb362('0x10')](_0xb362('0x11'),_0x533249,_0x18ccdf[_0xb362('0x10')]['message']);return _0x17e30f(_0x18ccdf[_0xb362('0x10')]['message']);}logger[_0xb362('0x10')](_0xb362('0x11'),_0x533249,_0x18ccdf['error'][_0xb362('0x12')]);return _0x23e963(_0x18ccdf[_0xb362('0x10')][_0xb362('0x12')]);}else{logger[_0xb362('0xc')](_0xb362('0x11'),_0x533249,_0xb362('0xd'));_0x23e963(_0x18ccdf[_0xb362('0x13')][_0xb362('0x12')]);}})[_0xb362('0x14')](function(_0x8dfcd7){logger[_0xb362('0x10')](_0xb362('0x11'),_0x533249,_0x8dfcd7);_0x17e30f(_0x8dfcd7);});});}exports[_0xb362('0x15')]=function(_0x41bc31){var _0x5b7c9d=this;return new Promise(function(_0x92e8c0,_0x98908b){return db[_0xb362('0x16')][_0xb362('0x17')](_0x41bc31[_0xb362('0x18')],{'raw':_0x41bc31[_0xb362('0x19')]?_0x41bc31['options'][_0xb362('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41bc31['options']?_0x41bc31['options']['where']||null:null,'attributes':_0x41bc31[_0xb362('0x19')]?_0x41bc31['options']['attributes']||null:null,'limit':_0x41bc31[_0xb362('0x19')]?_0x41bc31[_0xb362('0x19')][_0xb362('0x1b')]||null:null})['then'](function(_0xe84763){logger[_0xb362('0xc')](_0xb362('0x15'),_0x41bc31);logger[_0xb362('0xe')](_0xb362('0x15'),_0x41bc31,JSON[_0xb362('0xf')](_0xe84763));_0x92e8c0(_0xe84763);})[_0xb362('0x14')](function(_0x32aeb6){logger[_0xb362('0x10')](_0xb362('0x15'),_0x32aeb6[_0xb362('0x12')],_0x41bc31);_0x98908b(_0x5b7c9d[_0xb362('0x10')](0x1f4,_0x32aeb6[_0xb362('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index d2cdc99..3a04299 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 _0x9cc5=['./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','getMessages','/:id/download','/:id/messages','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1adf3d,_0x4991c1){var _0xeada7c=function(_0xb6ec10){while(--_0xb6ec10){_0x1adf3d['push'](_0x1adf3d['shift']());}};_0xeada7c(++_0x4991c1);}(_0x9cc5,0xef));var _0x59cc=function(_0x446f15,_0xffa7bf){_0x446f15=_0x446f15-0x0;var _0x2e9a23=_0x9cc5[_0x446f15];return _0x2e9a23;};'use strict';var multer=require(_0x59cc('0x0'));var util=require('util');var path=require(_0x59cc('0x1'));var timeout=require(_0x59cc('0x2'));var express=require(_0x59cc('0x3'));var router=express[_0x59cc('0x4')]();var fs_extra=require(_0x59cc('0x5'));var auth=require(_0x59cc('0x6'));var interaction=require(_0x59cc('0x7'));var config=require(_0x59cc('0x8'));var controller=require(_0x59cc('0x9'));router[_0x59cc('0xa')]('/',auth[_0x59cc('0xb')](),controller['index']);router[_0x59cc('0xa')](_0x59cc('0xc'),auth[_0x59cc('0xb')](),controller[_0x59cc('0xd')]);router[_0x59cc('0xa')](_0x59cc('0xe'),auth[_0x59cc('0xb')](),controller['show']);router[_0x59cc('0xa')]('/:id/messages',auth[_0x59cc('0xb')](),controller[_0x59cc('0xf')]);router[_0x59cc('0xa')](_0x59cc('0x10'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x59cc('0xb')](),controller['create']);router['post'](_0x59cc('0x11'),auth[_0x59cc('0xb')](),controller['addMessage']);router[_0x59cc('0x12')](_0x59cc('0x13'),auth[_0x59cc('0xb')](),interaction[_0x59cc('0x14')](_0x59cc('0x15'),_0x59cc('0x16')),controller[_0x59cc('0x17')]);router[_0x59cc('0x18')](_0x59cc('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0x59cc('0x15'),_0x59cc('0x19')),controller[_0x59cc('0x1a')]);router[_0x59cc('0x1b')](_0x59cc('0xe'),auth[_0x59cc('0xb')](),interaction[_0x59cc('0x14')](_0x59cc('0x15'),_0x59cc('0x1c')),controller['destroy']);router['delete']('/:id/tags',auth[_0x59cc('0xb')](),controller[_0x59cc('0x1d')]);module[_0x59cc('0x1e')]=router; \ No newline at end of file +var _0x04ad=['addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','openchannelinteraction:destroy','destroy','delete','removeTags','path','express','Router','fs-extra','../../components/auth/service','index','get','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','create'];(function(_0x5d60f7,_0x41b230){var _0x44e9a2=function(_0x3d4a58){while(--_0x3d4a58){_0x5d60f7['push'](_0x5d60f7['shift']());}};_0x44e9a2(++_0x41b230);}(_0x04ad,0xc8));var _0xd04a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x04ad[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd04a('0x0'));var timeout=require('connect-timeout');var express=require(_0xd04a('0x1'));var router=express[_0xd04a('0x2')]();var fs_extra=require(_0xd04a('0x3'));var auth=require(_0xd04a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd04a('0x5')]);router[_0xd04a('0x6')](_0xd04a('0x7'),auth[_0xd04a('0x8')](),controller[_0xd04a('0x9')]);router[_0xd04a('0x6')](_0xd04a('0xa'),auth[_0xd04a('0x8')](),controller['show']);router[_0xd04a('0x6')](_0xd04a('0xb'),auth['isAuthenticated'](),controller[_0xd04a('0xc')]);router[_0xd04a('0x6')](_0xd04a('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xd04a('0xe')]('/',auth[_0xd04a('0x8')](),controller[_0xd04a('0xf')]);router['post']('/:id/messages',auth[_0xd04a('0x8')](),controller[_0xd04a('0x10')]);router[_0xd04a('0xe')]('/:id/tags',auth[_0xd04a('0x8')](),interaction[_0xd04a('0x11')](_0xd04a('0x12'),_0xd04a('0x13')),controller[_0xd04a('0x14')]);router[_0xd04a('0x15')](_0xd04a('0xa'),auth['isAuthenticated'](),interaction[_0xd04a('0x11')](_0xd04a('0x12'),_0xd04a('0x16')),controller['update']);router['delete'](_0xd04a('0xa'),auth[_0xd04a('0x8')](),interaction[_0xd04a('0x11')](_0xd04a('0x12'),_0xd04a('0x17')),controller[_0xd04a('0x18')]);router[_0xd04a('0x19')]('/:id/tags',auth[_0xd04a('0x8')](),controller[_0xd04a('0x1a')]);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 bd9fbc1..4125bc2 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 _0xa7dc=['BOOLEAN','STRING','DATE','ENUM','out','sequelize','exports'];(function(_0x2a27f0,_0x113a43){var _0xd6268d=function(_0x25dc19){while(--_0x25dc19){_0x2a27f0['push'](_0x2a27f0['shift']());}};_0xd6268d(++_0x113a43);}(_0xa7dc,0x11d));var _0xca7d=function(_0x7b4581,_0x36c68e){_0x7b4581=_0x7b4581-0x0;var _0x1e33f2=_0xa7dc[_0x7b4581];return _0x1e33f2;};'use strict';var Sequelize=require(_0xca7d('0x0'));module[_0xca7d('0x1')]={'closed':{'type':Sequelize[_0xca7d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xca7d('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xca7d('0x3')]},'note':{'type':Sequelize[_0xca7d('0x3')]},'read1stAt':{'type':Sequelize[_0xca7d('0x4')]},'threadId':{'type':Sequelize[_0xca7d('0x3')]},'externalUrl':{'type':Sequelize[_0xca7d('0x3')]},'lastMsgAt':{'type':Sequelize[_0xca7d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xca7d('0x5')]('in',_0xca7d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xca7d('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xca7d('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x84ab=['DATE','STRING','out','sequelize','exports','BOOLEAN'];(function(_0x450aaf,_0x17e61c){var _0x5a6660=function(_0x10860f){while(--_0x10860f){_0x450aaf['push'](_0x450aaf['shift']());}};_0x5a6660(++_0x17e61c);}(_0x84ab,0x12f));var _0xb84a=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x84ab[_0x285824];return _0x311d7e;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'closed':{'type':Sequelize[_0xb84a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb84a('0x3')]},'disposition':{'type':Sequelize[_0xb84a('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb84a('0x4')]},'note':{'type':Sequelize[_0xb84a('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xb84a('0x4')]},'externalUrl':{'type':Sequelize[_0xb84a('0x4')]},'lastMsgAt':{'type':Sequelize[_0xb84a('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb84a('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xb84a('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 9f38d84..c8c2aeb 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 _0x4065=['path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','stack','name','send','OpenchannelInteraction','rawAttributes','fieldName','getOptions','findAll','openchannel','user','catch','type','query','from','params','keys','filters','intersection','attributes','fields','length','model','includeAll','merge','options','create','update','body','find','describe','addMessage','OpenchannelMessage','ids','getMessages','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','include','rows','addTags','setTags','omit','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','toString','root','server','files','attachments','join','transcript-%d-%s.zip','push','User','fullname','firstName','lastName','Attachment','Messages','createdAt','OpenchannelAccount','Owner','mkdirSync','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','map','basename','createReadStream','createWriteStream','direction','out','System','Contact','secret','read','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util'];(function(_0x441563,_0x1d4a28){var _0x2369ec=function(_0x1f97ba){while(--_0x1f97ba){_0x441563['push'](_0x441563['shift']());}};_0x2369ec(++_0x1d4a28);}(_0x4065,0x174));var _0x5406=function(_0x1acaf0,_0xe06ccc){_0x1acaf0=_0x1acaf0-0x0;var _0x2e16c0=_0x4065[_0x1acaf0];return _0x2e16c0;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5406('0x0'));var moment=require(_0x5406('0x1'));var util=require(_0x5406('0x2'));var path=require(_0x5406('0x3'));var ejs=require(_0x5406('0x4'));var fs=require('fs');var _=require(_0x5406('0x5'));var Redis=require(_0x5406('0x6'));var interaction=require(_0x5406('0x7'));var qs=require(_0x5406('0x8'));var pdf=require(_0x5406('0x9'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x5406('0xa'))['db'];config[_0x5406('0xb')]=_[_0x5406('0xc')](config[_0x5406('0xb')],{'host':_0x5406('0xd'),'port':0x18eb});var socket=require(_0x5406('0xe'))(new Redis(config[_0x5406('0xb')]));require('./openchannelInteraction.socket')[_0x5406('0xf')](socket);function respondWithStatusCode(_0xa3cdd0,_0x43698f){_0x43698f=_0x43698f||0xcc;return function(_0x5d006b){if(_0x5d006b){return _0xa3cdd0[_0x5406('0x10')](_0x43698f);}return _0xa3cdd0[_0x5406('0x11')](_0x43698f)[_0x5406('0x12')]();};}function respondWithResult(_0x252e25,_0x445efb){_0x445efb=_0x445efb||0xc8;return function(_0x1ddd9d){if(_0x1ddd9d){return _0x252e25[_0x5406('0x11')](_0x445efb)[_0x5406('0x13')](_0x1ddd9d);}};}function respondWithFilteredResult(_0x4879e5,_0x39984f){return function(_0x5e8c1a){if(_0x5e8c1a){var _0x4db158=typeof _0x39984f[_0x5406('0x14')]===_0x5406('0x15')&&typeof _0x39984f[_0x5406('0x16')]===_0x5406('0x15');var _0xc28f5=_0x5e8c1a[_0x5406('0x17')];var _0x192d58=_0x4db158?0x0:_0x39984f[_0x5406('0x14')];var _0x7ee214=_0x4db158?_0x5e8c1a['count']:_0x39984f[_0x5406('0x14')]+_0x39984f[_0x5406('0x16')];var _0x2f05ca;if(_0x7ee214>=_0xc28f5){_0x7ee214=_0xc28f5;_0x2f05ca=0xc8;}else{_0x2f05ca=0xce;}_0x4879e5['status'](_0x2f05ca);return _0x4879e5['set'](_0x5406('0x18'),_0x192d58+'-'+_0x7ee214+'/'+_0xc28f5)['json'](_0x5e8c1a);}return null;};}function saveUpdates(_0x5b1eec){return function(_0x446ad5){if(_0x446ad5){return _0x446ad5['update'](_0x5b1eec)[_0x5406('0x19')](function(_0x7d2b6e){return _0x7d2b6e;});}return null;};}function removeEntity(_0x2390ed){return function(_0x5b8946){if(_0x5b8946){return _0x5b8946[_0x5406('0x1a')]()[_0x5406('0x19')](function(){_0x2390ed[_0x5406('0x11')](0xcc)[_0x5406('0x12')]();});}};}function handleEntityNotFound(_0x28bae0){return function(_0x274a27){if(!_0x274a27){_0x28bae0[_0x5406('0x10')](0x194);}return _0x274a27;};}function handleError(_0x2bf6d6,_0x3ecc37){_0x3ecc37=_0x3ecc37||0x1f4;return function(_0x206b35){logger['error'](_0x206b35[_0x5406('0x1b')]);if(_0x206b35[_0x5406('0x1c')]){delete _0x206b35[_0x5406('0x1c')];}_0x2bf6d6[_0x5406('0x11')](_0x3ecc37)[_0x5406('0x1d')](_0x206b35);};}exports['index']=function(_0x2bb89a,_0x3f1265){var _0x426f12={};var _0x56528e=_['map'](db[_0x5406('0x1e')][_0x5406('0x1f')],function(_0x3ca69a){return{'name':_0x3ca69a[_0x5406('0x20')],'type':_0x3ca69a['type']['key']};});_0x426f12=qs[_0x5406('0x21')](_0x56528e,_0x2bb89a);return interaction[_0x5406('0x22')](_0x5406('0x23'),_0x2bb89a['query'],_0x2bb89a[_0x5406('0x24')],_0x426f12,_0x56528e)['then'](respondWithFilteredResult(_0x3f1265,_0x426f12))[_0x5406('0x25')](handleError(_0x3f1265,null));};exports['show']=function(_0x204cbe,_0x232f2c){var _0x1386c4={};if(_0x204cbe['query'][_0x5406('0x26')]&&_0x204cbe[_0x5406('0x27')][_0x5406('0x26')]===_0x5406('0x28')){_0x1386c4[_0x5406('0x28')]=_0x204cbe['params']['id'];}else{_0x1386c4['id']=_0x204cbe[_0x5406('0x29')]['id'];}var _0x2889ee={'raw':![],'where':_0x1386c4},_0x135e33={};_0x135e33['model']=_[_0x5406('0x2a')](db[_0x5406('0x1e')][_0x5406('0x1f')]);_0x135e33[_0x5406('0x27')]=_[_0x5406('0x2a')](_0x204cbe[_0x5406('0x27')]);_0x135e33[_0x5406('0x2b')]=_[_0x5406('0x2c')](_0x135e33['model'],_0x135e33[_0x5406('0x27')]);_0x2889ee[_0x5406('0x2d')]=_['intersection'](_0x135e33['model'],qs[_0x5406('0x2e')](_0x204cbe[_0x5406('0x27')][_0x5406('0x2e')]));_0x2889ee[_0x5406('0x2d')]=_0x2889ee['attributes'][_0x5406('0x2f')]?_0x2889ee['attributes']:_0x135e33[_0x5406('0x30')];if(_0x204cbe[_0x5406('0x27')][_0x5406('0x31')]){_0x2889ee['include']=[{'all':!![]}];}_0x2889ee=_[_0x5406('0x32')]({},_0x2889ee,_0x204cbe[_0x5406('0x33')]);return db[_0x5406('0x1e')]['find'](_0x2889ee)['then'](handleEntityNotFound(_0x232f2c,null))[_0x5406('0x19')](respondWithResult(_0x232f2c,null))[_0x5406('0x25')](handleError(_0x232f2c,null));};exports[_0x5406('0x34')]=function(_0x152cce,_0x157d2e){return db[_0x5406('0x1e')][_0x5406('0x34')](_0x152cce['body'],{})['then'](respondWithResult(_0x157d2e,0xc9))[_0x5406('0x25')](handleError(_0x157d2e,null));};exports[_0x5406('0x35')]=function(_0x2f11b5,_0x35ce2b){if(_0x2f11b5[_0x5406('0x36')]['id']){delete _0x2f11b5['body']['id'];}return db[_0x5406('0x1e')]['find']({'where':{'id':_0x2f11b5[_0x5406('0x29')]['id']}})[_0x5406('0x19')](handleEntityNotFound(_0x35ce2b,null))[_0x5406('0x19')](saveUpdates(_0x2f11b5[_0x5406('0x36')],null))[_0x5406('0x19')](respondWithResult(_0x35ce2b,null))['catch'](handleError(_0x35ce2b,null));};exports['destroy']=function(_0x17e7aa,_0x326498){return db['OpenchannelInteraction'][_0x5406('0x37')]({'where':{'id':_0x17e7aa[_0x5406('0x29')]['id']}})[_0x5406('0x19')](handleEntityNotFound(_0x326498,null))[_0x5406('0x19')](removeEntity(_0x326498,null))[_0x5406('0x25')](handleError(_0x326498,null));};exports[_0x5406('0x38')]=function(_0x3e17fa,_0x230ce0){return db[_0x5406('0x1e')][_0x5406('0x38')]()[_0x5406('0x19')](respondWithResult(_0x230ce0,null))[_0x5406('0x25')](handleError(_0x230ce0,null));};exports[_0x5406('0x39')]=function(_0x48953e,_0x1f1a4d){return db[_0x5406('0x3a')][_0x5406('0x37')]({'where':{'id':_0x48953e[_0x5406('0x29')]['id']}})['then'](handleEntityNotFound(_0x1f1a4d,null))['then'](function(_0x30d777){if(_0x30d777){return _0x30d777[_0x5406('0x39')](_0x48953e[_0x5406('0x36')][_0x5406('0x3b')],_['omit'](_0x48953e[_0x5406('0x36')],[_0x5406('0x3b'),'id'])||{});}})[_0x5406('0x19')](respondWithResult(_0x1f1a4d,null))['catch'](handleError(_0x1f1a4d,null));};exports[_0x5406('0x3c')]=function(_0x35c8da,_0x23f42f){var _0x48abe0={'raw':![],'where':{}};var _0x52b8b6={};var _0xb5d772={'count':0x0,'rows':[]};return db[_0x5406('0x1e')]['findOne']({'where':{'id':_0x35c8da[_0x5406('0x29')]['id']}})[_0x5406('0x19')](handleEntityNotFound(_0x23f42f,null))[_0x5406('0x19')](function(_0x533abf){if(_0x533abf){_0x52b8b6[_0x5406('0x30')]=_['keys'](db[_0x5406('0x3a')][_0x5406('0x1f')]);_0x52b8b6[_0x5406('0x27')]=_[_0x5406('0x2a')](_0x35c8da[_0x5406('0x27')]);_0x52b8b6[_0x5406('0x2b')]=_['intersection'](_0x52b8b6[_0x5406('0x30')],_0x52b8b6[_0x5406('0x27')]);_0x48abe0[_0x5406('0x2d')]=_[_0x5406('0x2c')](_0x52b8b6[_0x5406('0x30')],qs[_0x5406('0x2e')](_0x35c8da['query'][_0x5406('0x2e')]));_0x48abe0[_0x5406('0x2d')]=_0x48abe0['attributes'][_0x5406('0x2f')]?_0x48abe0['attributes']:_0x52b8b6[_0x5406('0x30')];if(!_0x35c8da[_0x5406('0x27')]['hasOwnProperty']('nolimit')){_0x48abe0['limit']=qs['limit'](_0x35c8da[_0x5406('0x27')][_0x5406('0x16')]);_0x48abe0[_0x5406('0x14')]=qs[_0x5406('0x14')](_0x35c8da[_0x5406('0x27')][_0x5406('0x14')]);}_0x48abe0[_0x5406('0x3d')]=qs[_0x5406('0x3e')](_0x35c8da[_0x5406('0x27')][_0x5406('0x3e')]);_0x48abe0[_0x5406('0x3f')]=qs['filters'](_[_0x5406('0x40')](_0x35c8da[_0x5406('0x27')],_0x52b8b6['filters']));_0x48abe0[_0x5406('0x3f')][_0x5406('0x41')]=_0x533abf['id'];if(_0x35c8da[_0x5406('0x27')][_0x5406('0x42')]){_0x48abe0[_0x5406('0x3f')]=_['merge'](_0x48abe0[_0x5406('0x3f')],{'$or':_['map'](_0x48abe0[_0x5406('0x2d')],function(_0x30f151){var _0x596489={};_0x596489[_0x30f151]={'$like':'%'+_0x35c8da['query'][_0x5406('0x42')]+'%'};return _0x596489;})});}if(_0x35c8da[_0x5406('0x27')][_0x5406('0x43')]){var _0x3bc947=_0x35c8da[_0x5406('0x27')][_0x5406('0x43')][_0x5406('0x44')](',');var _0x4d9767={};_0x4d9767[_0x3bc947[0x0]]={'$gte':moment(_0x3bc947[0x1])[_0x5406('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x48abe0[_0x5406('0x3f')]=_['merge'](_0x48abe0['where'],_0x4d9767);}_0x48abe0=_['merge']({},_0x48abe0,_0x35c8da[_0x5406('0x33')]);return db[_0x5406('0x3a')][_0x5406('0x17')]({'where':_0x48abe0['where']})[_0x5406('0x19')](function(_0x512db7){_0xb5d772[_0x5406('0x17')]=_0x512db7;if(_0x35c8da[_0x5406('0x27')]['includeAll']){_0x48abe0[_0x5406('0x46')]=[{'all':!![]}];}return db[_0x5406('0x3a')][_0x5406('0x22')](_0x48abe0);})[_0x5406('0x19')](function(_0x3a7bcb){_0xb5d772[_0x5406('0x47')]=_0x3a7bcb;return _0xb5d772;});}})[_0x5406('0x19')](respondWithFilteredResult(_0x23f42f,_0x48abe0))[_0x5406('0x25')](handleError(_0x23f42f,null));};exports[_0x5406('0x48')]=function(_0x457c6e,_0x1eef54){return db[_0x5406('0x1e')][_0x5406('0x37')]({'where':{'id':_0x457c6e[_0x5406('0x29')]['id']}})['then'](handleEntityNotFound(_0x1eef54,null))[_0x5406('0x19')](function(_0x5f46f4){if(_0x5f46f4){return _0x5f46f4[_0x5406('0x49')](_0x457c6e[_0x5406('0x36')][_0x5406('0x3b')],_[_0x5406('0x4a')](_0x457c6e[_0x5406('0x36')],[_0x5406('0x3b'),'id'])||{})[_0x5406('0x4b')](function(){return db[_0x5406('0x4c')][_0x5406('0x22')]({'attributes':['id',_0x5406('0x1c'),'color'],'where':{'id':_0x457c6e[_0x5406('0x36')]['ids']}});})[_0x5406('0x19')](function(_0x46ae09){socket[_0x5406('0x4d')](_0x5406('0x4e'),{'id':Number(_0x457c6e[_0x5406('0x29')]['id']),'tags':_0x46ae09||[]});return{'id':Number(_0x457c6e[_0x5406('0x29')]['id']),'tags':_0x46ae09||[]};});}})['then'](respondWithResult(_0x1eef54,null))[_0x5406('0x25')](handleError(_0x1eef54,null));};exports['removeTags']=function(_0x43e0cd,_0x25bb80){return db[_0x5406('0x1e')]['find']({'where':{'id':_0x43e0cd[_0x5406('0x29')]['id']}})[_0x5406('0x19')](handleEntityNotFound(_0x25bb80,null))[_0x5406('0x19')](function(_0x1ee8ea){if(_0x1ee8ea){return _0x1ee8ea[_0x5406('0x4f')](_0x43e0cd[_0x5406('0x27')][_0x5406('0x3b')]);}})[_0x5406('0x19')](respondWithStatusCode(_0x25bb80,null))['catch'](handleError(_0x25bb80,null));};exports[_0x5406('0x50')]=function(_0x496a29,_0x2532f6){var _0x272da8=moment()['unix']()[_0x5406('0x51')]();var _0x4b6131=path['join'](config[_0x5406('0x52')],_0x5406('0x53'),'files','tmp');var _0xc77d64=path['join'](config[_0x5406('0x52')],'server',_0x5406('0x54'),_0x5406('0x55'));var _0x43f3a8=path[_0x5406('0x56')](_0x4b6131,_0x272da8);var _0x4dab4e=util['format'](_0x5406('0x57'),_0x496a29['params']['id'],_0x272da8);var _0xa25520=path['join'](_0x4b6131,_0x4dab4e);var _0x229210=[];_0x229210[_0x5406('0x58')]({'model':db[_0x5406('0x59')],'as':_0x5406('0x59'),'attributes':['id',_0x5406('0x5a')],'raw':!![]});_0x229210[_0x5406('0x58')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x5406('0x5b'),_0x5406('0x5c')],'raw':!![]});if(_0x496a29['query'][_0x5406('0x55')]){_0x229210[_0x5406('0x58')]({'model':db[_0x5406('0x5d')],'as':'Attachment','raw':!![]});}var _0x806521=[{'model':db[_0x5406('0x3a')],'as':_0x5406('0x5e'),'attributes':['id',_0x5406('0x36'),_0x5406('0x5f'),'direction','secret','read'],'include':_0x229210}];_0x806521[_0x5406('0x58')]({'model':db[_0x5406('0x60')],'as':'Account','attributes':['id',_0x5406('0x1c')]});_0x806521[_0x5406('0x58')]({'model':db[_0x5406('0x59')],'as':_0x5406('0x61'),'attributes':['id','fullname']});return db['OpenchannelInteraction']['find']({'where':{'id':_0x496a29[_0x5406('0x29')]['id']},'include':_0x806521})['then'](handleEntityNotFound(_0x2532f6,null))[_0x5406('0x19')](function(_0xb2c0a7){if(_0xb2c0a7){var _0x233ab9=_0xb2c0a7['get']({'plain':!![]});fs[_0x5406('0x62')](_0x43f3a8);var _0xc45c6f={'channel':'Openchannel','account':_0x233ab9[_0x5406('0x63')][_0x5406('0x1c')],'agent':_0x233ab9[_0x5406('0x61')]?_0x233ab9['Owner'][_0x5406('0x5a')]:_0x5406('0x64'),'createdAt':moment(_0x233ab9[_0x5406('0x5f')])['format'](_0x5406('0x65'))[_0x5406('0x51')](),'closedAt':_0x233ab9[_0x5406('0x66')]?moment(_0x233ab9[_0x5406('0x67')])['format'](_0x5406('0x65'))[_0x5406('0x51')]():'','disposition':_0x233ab9[_0x5406('0x68')],'visibility':_0x233ab9[_0x5406('0x69')]?_0x5406('0x6a'):_0x5406('0x6b'),'messages':_(_0x233ab9[_0x5406('0x5e')])['filter']({'secret':![]})[_0x5406('0x6c')](function(_0x339163){if(_0x339163[_0x5406('0x5d')]){var _0xbd8d0f=path[_0x5406('0x56')](_0xc77d64,_0x339163['Attachment'][_0x5406('0x6d')]);if(fs['existsSync'](_0xbd8d0f)){fs[_0x5406('0x6e')](_0xbd8d0f)['pipe'](fs[_0x5406('0x6f')](path[_0x5406('0x56')](_0x43f3a8,_0x339163['Attachment'][_0x5406('0x6d')])));}}return{'date':moment(_0x339163[_0x5406('0x5f')])[_0x5406('0x45')](_0x5406('0x65'))[_0x5406('0x51')](),'sender':_0x339163[_0x5406('0x70')]===_0x5406('0x71')?_0x339163['User']?_0x339163['User'][_0x5406('0x5a')]:_0x5406('0x72'):_0x339163[_0x5406('0x73')][_0x5406('0x5b')]+(_0x339163[_0x5406('0x73')][_0x5406('0x5c')]?'\x20'+_0x339163[_0x5406('0x73')][_0x5406('0x5c')]:''),'body':_0x339163[_0x5406('0x5d')]?_0x339163[_0x5406('0x5d')]['basename']:_0x339163['body'],'direction':_0x339163[_0x5406('0x70')]===_0x5406('0x71')?'A':'C','secret':_0x339163[_0x5406('0x74')],'read':_0x339163[_0x5406('0x75')],'attachment':_0x339163['Attachment']};})['value']()};return ejs['renderFile'](path[_0x5406('0x56')](config[_0x5406('0x52')],_0x5406('0x53'),_0x5406('0x76'),_0x5406('0x77')),{'interaction':_0xc45c6f})[_0x5406('0x19')](function(_0x2a079c){var _0x5505b0=path[_0x5406('0x56')](_0x43f3a8,_0x5406('0x78')+_0x233ab9['id']+'-'+_0x272da8+'.pdf');var _0x2810ce={'path':_0x5505b0,'channel':'Openchannel','interactionId':_0x233ab9['id']};return pdf[_0x5406('0x79')](_0x2a079c,_0x2810ce);})['then'](function(){return new Promise(function(_0x1758a6,_0x339a22){zipdir(_0x43f3a8,{'saveTo':_0xa25520},function(_0x12a860,_0x28cd9d){if(_0x12a860)return _0x339a22(_0x12a860);return _0x1758a6(_0x28cd9d);});})[_0x5406('0x19')](function(){return new Promise(function(_0x22e18b,_0x580941){rimraf(_0x43f3a8,function(_0x4002ec){if(_0x4002ec)_0x580941(_0x4002ec);return _0x22e18b();});});})[_0x5406('0x19')](function(){return _0x2532f6['download'](_0xa25520,_0x4dab4e,function(_0x4f63b4){if(_0x4f63b4){logger[_0x5406('0x7a')](_0x5406('0x7b'),_0x4f63b4);}else{fs[_0x5406('0x7c')](_0xa25520);}});});});}else{return _0x2532f6[_0x5406('0x10')](0xc8);}})[_0x5406('0x25')](handleError(_0x2532f6,null));}; \ No newline at end of file +var _0x4378=['findAll','user','catch','show','query','from','params','keys','OpenchannelInteraction','filters','intersection','attributes','model','fields','includeAll','include','options','create','body','find','describe','addMessage','OpenchannelMessage','omit','ids','findOne','hasOwnProperty','nolimit','order','sort','pick','where','OpenchannelInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','threadId','Public','Private','filter','basename','createReadStream','pipe','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x4378,0x161));var _0x8437=function(_0x36b7f1,_0x67defb){_0x36b7f1=_0x36b7f1-0x0;var _0x3ee447=_0x4378[_0x36b7f1];return _0x3ee447;};'use strict';var rimraf=require(_0x8437('0x0'));var zipdir=require(_0x8437('0x1'));var moment=require(_0x8437('0x2'));var util=require(_0x8437('0x3'));var path=require(_0x8437('0x4'));var ejs=require(_0x8437('0x5'));var fs=require('fs');var _=require(_0x8437('0x6'));var Redis=require(_0x8437('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x8437('0x8'))(_0x8437('0x9'));var config=require(_0x8437('0xa'));var db=require(_0x8437('0xb'))['db'];config[_0x8437('0xc')]=_[_0x8437('0xd')](config[_0x8437('0xc')],{'host':_0x8437('0xe'),'port':0x18eb});var socket=require(_0x8437('0xf'))(new Redis(config[_0x8437('0xc')]));require('./openchannelInteraction.socket')[_0x8437('0x10')](socket);function respondWithStatusCode(_0x35cb33,_0x54de65){_0x54de65=_0x54de65||0xcc;return function(_0x4cf5ab){if(_0x4cf5ab){return _0x35cb33[_0x8437('0x11')](_0x54de65);}return _0x35cb33[_0x8437('0x12')](_0x54de65)[_0x8437('0x13')]();};}function respondWithResult(_0x13775f,_0x1ff82e){_0x1ff82e=_0x1ff82e||0xc8;return function(_0x28843b){if(_0x28843b){return _0x13775f['status'](_0x1ff82e)['json'](_0x28843b);}};}function respondWithFilteredResult(_0xead6f0,_0x8adade){return function(_0x2a07f4){if(_0x2a07f4){var _0x54cdf5=typeof _0x8adade[_0x8437('0x14')]===_0x8437('0x15')&&typeof _0x8adade['limit']===_0x8437('0x15');var _0x2846e2=_0x2a07f4[_0x8437('0x16')];var _0x335db8=_0x54cdf5?0x0:_0x8adade[_0x8437('0x14')];var _0x2ab645=_0x54cdf5?_0x2a07f4[_0x8437('0x16')]:_0x8adade[_0x8437('0x14')]+_0x8adade[_0x8437('0x17')];var _0x223813;if(_0x2ab645>=_0x2846e2){_0x2ab645=_0x2846e2;_0x223813=0xc8;}else{_0x223813=0xce;}_0xead6f0[_0x8437('0x12')](_0x223813);return _0xead6f0[_0x8437('0x18')](_0x8437('0x19'),_0x335db8+'-'+_0x2ab645+'/'+_0x2846e2)[_0x8437('0x1a')](_0x2a07f4);}return null;};}function saveUpdates(_0x130897){return function(_0x262545){if(_0x262545){return _0x262545[_0x8437('0x1b')](_0x130897)[_0x8437('0x1c')](function(_0xb857d2){return _0xb857d2;});}return null;};}function removeEntity(_0x2302dd){return function(_0x4c4c04){if(_0x4c4c04){return _0x4c4c04[_0x8437('0x1d')]()['then'](function(){_0x2302dd[_0x8437('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x180469){return function(_0xd89b2e){if(!_0xd89b2e){_0x180469[_0x8437('0x11')](0x194);}return _0xd89b2e;};}function handleError(_0x11d847,_0x18bb12){_0x18bb12=_0x18bb12||0x1f4;return function(_0x5d6374){logger[_0x8437('0x1e')](_0x5d6374['stack']);if(_0x5d6374['name']){delete _0x5d6374[_0x8437('0x1f')];}_0x11d847[_0x8437('0x12')](_0x18bb12)[_0x8437('0x20')](_0x5d6374);};}exports[_0x8437('0x21')]=function(_0x5dca09,_0x452997){var _0x34e04b={};var _0x15b2f0=_[_0x8437('0x22')](db['OpenchannelInteraction'][_0x8437('0x23')],function(_0x41c92a){return{'name':_0x41c92a[_0x8437('0x24')],'type':_0x41c92a[_0x8437('0x25')][_0x8437('0x26')]};});_0x34e04b=qs[_0x8437('0x27')](_0x15b2f0,_0x5dca09);return interaction[_0x8437('0x28')]('openchannel',_0x5dca09['query'],_0x5dca09[_0x8437('0x29')],_0x34e04b,_0x15b2f0)[_0x8437('0x1c')](respondWithFilteredResult(_0x452997,_0x34e04b))[_0x8437('0x2a')](handleError(_0x452997,null));};exports[_0x8437('0x2b')]=function(_0x5e9759,_0x399389){var _0x29437b={};if(_0x5e9759[_0x8437('0x2c')][_0x8437('0x25')]&&_0x5e9759[_0x8437('0x2c')][_0x8437('0x25')]===_0x8437('0x2d')){_0x29437b[_0x8437('0x2d')]=_0x5e9759['params']['id'];}else{_0x29437b['id']=_0x5e9759[_0x8437('0x2e')]['id'];}var _0x884cc6={'raw':![],'where':_0x29437b},_0x2f745b={};_0x2f745b['model']=_[_0x8437('0x2f')](db[_0x8437('0x30')][_0x8437('0x23')]);_0x2f745b[_0x8437('0x2c')]=_[_0x8437('0x2f')](_0x5e9759[_0x8437('0x2c')]);_0x2f745b[_0x8437('0x31')]=_[_0x8437('0x32')](_0x2f745b['model'],_0x2f745b[_0x8437('0x2c')]);_0x884cc6[_0x8437('0x33')]=_[_0x8437('0x32')](_0x2f745b[_0x8437('0x34')],qs[_0x8437('0x35')](_0x5e9759['query'][_0x8437('0x35')]));_0x884cc6[_0x8437('0x33')]=_0x884cc6[_0x8437('0x33')]['length']?_0x884cc6[_0x8437('0x33')]:_0x2f745b['model'];if(_0x5e9759['query'][_0x8437('0x36')]){_0x884cc6[_0x8437('0x37')]=[{'all':!![]}];}_0x884cc6=_['merge']({},_0x884cc6,_0x5e9759[_0x8437('0x38')]);return db[_0x8437('0x30')]['find'](_0x884cc6)[_0x8437('0x1c')](handleEntityNotFound(_0x399389,null))[_0x8437('0x1c')](respondWithResult(_0x399389,null))[_0x8437('0x2a')](handleError(_0x399389,null));};exports['create']=function(_0x3f8fda,_0x5c52c5){return db[_0x8437('0x30')][_0x8437('0x39')](_0x3f8fda[_0x8437('0x3a')],{})[_0x8437('0x1c')](respondWithResult(_0x5c52c5,0xc9))[_0x8437('0x2a')](handleError(_0x5c52c5,null));};exports[_0x8437('0x1b')]=function(_0x4295aa,_0x4f9bfd){if(_0x4295aa[_0x8437('0x3a')]['id']){delete _0x4295aa[_0x8437('0x3a')]['id'];}return db[_0x8437('0x30')]['find']({'where':{'id':_0x4295aa['params']['id']}})['then'](handleEntityNotFound(_0x4f9bfd,null))['then'](saveUpdates(_0x4295aa['body'],null))[_0x8437('0x1c')](respondWithResult(_0x4f9bfd,null))['catch'](handleError(_0x4f9bfd,null));};exports['destroy']=function(_0x2d3947,_0x9fb77a){return db[_0x8437('0x30')][_0x8437('0x3b')]({'where':{'id':_0x2d3947[_0x8437('0x2e')]['id']}})[_0x8437('0x1c')](handleEntityNotFound(_0x9fb77a,null))['then'](removeEntity(_0x9fb77a,null))[_0x8437('0x2a')](handleError(_0x9fb77a,null));};exports[_0x8437('0x3c')]=function(_0x4c5538,_0x35dd78){return db[_0x8437('0x30')][_0x8437('0x3c')]()[_0x8437('0x1c')](respondWithResult(_0x35dd78,null))[_0x8437('0x2a')](handleError(_0x35dd78,null));};exports[_0x8437('0x3d')]=function(_0x117218,_0x71dd79){return db[_0x8437('0x3e')]['find']({'where':{'id':_0x117218[_0x8437('0x2e')]['id']}})['then'](handleEntityNotFound(_0x71dd79,null))[_0x8437('0x1c')](function(_0x254ae4){if(_0x254ae4){return _0x254ae4[_0x8437('0x3d')](_0x117218[_0x8437('0x3a')]['ids'],_[_0x8437('0x3f')](_0x117218[_0x8437('0x3a')],[_0x8437('0x40'),'id'])||{});}})[_0x8437('0x1c')](respondWithResult(_0x71dd79,null))[_0x8437('0x2a')](handleError(_0x71dd79,null));};exports['getMessages']=function(_0x1af10f,_0x4e4165){var _0x5f08bd={'raw':![],'where':{}};var _0x1d0139={};var _0x3838d1={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x8437('0x41')]({'where':{'id':_0x1af10f['params']['id']}})['then'](handleEntityNotFound(_0x4e4165,null))[_0x8437('0x1c')](function(_0x275c6d){if(_0x275c6d){_0x1d0139[_0x8437('0x34')]=_[_0x8437('0x2f')](db[_0x8437('0x3e')]['rawAttributes']);_0x1d0139[_0x8437('0x2c')]=_['keys'](_0x1af10f['query']);_0x1d0139['filters']=_[_0x8437('0x32')](_0x1d0139[_0x8437('0x34')],_0x1d0139[_0x8437('0x2c')]);_0x5f08bd['attributes']=_[_0x8437('0x32')](_0x1d0139[_0x8437('0x34')],qs['fields'](_0x1af10f[_0x8437('0x2c')]['fields']));_0x5f08bd[_0x8437('0x33')]=_0x5f08bd[_0x8437('0x33')]['length']?_0x5f08bd[_0x8437('0x33')]:_0x1d0139[_0x8437('0x34')];if(!_0x1af10f['query'][_0x8437('0x42')](_0x8437('0x43'))){_0x5f08bd['limit']=qs[_0x8437('0x17')](_0x1af10f[_0x8437('0x2c')][_0x8437('0x17')]);_0x5f08bd['offset']=qs['offset'](_0x1af10f[_0x8437('0x2c')][_0x8437('0x14')]);}_0x5f08bd[_0x8437('0x44')]=qs[_0x8437('0x45')](_0x1af10f[_0x8437('0x2c')]['sort']);_0x5f08bd['where']=qs[_0x8437('0x31')](_[_0x8437('0x46')](_0x1af10f[_0x8437('0x2c')],_0x1d0139[_0x8437('0x31')]));_0x5f08bd[_0x8437('0x47')][_0x8437('0x48')]=_0x275c6d['id'];if(_0x1af10f[_0x8437('0x2c')]['filter']){_0x5f08bd[_0x8437('0x47')]=_['merge'](_0x5f08bd[_0x8437('0x47')],{'$or':_['map'](_0x5f08bd[_0x8437('0x33')],function(_0x1894a4){var _0x1ab70d={};_0x1ab70d[_0x1894a4]={'$like':'%'+_0x1af10f[_0x8437('0x2c')]['filter']+'%'};return _0x1ab70d;})});}if(_0x1af10f[_0x8437('0x2c')][_0x8437('0x49')]){var _0x432103=_0x1af10f[_0x8437('0x2c')]['$gte']['split'](',');var _0x30a19f={};_0x30a19f[_0x432103[0x0]]={'$gte':moment(_0x432103[0x1])[_0x8437('0x4a')](_0x8437('0x4b'))};_0x5f08bd[_0x8437('0x47')]=_[_0x8437('0x4c')](_0x5f08bd['where'],_0x30a19f);}_0x5f08bd=_[_0x8437('0x4c')]({},_0x5f08bd,_0x1af10f[_0x8437('0x38')]);return db['OpenchannelMessage'][_0x8437('0x16')]({'where':_0x5f08bd[_0x8437('0x47')]})[_0x8437('0x1c')](function(_0x1705ce){_0x3838d1[_0x8437('0x16')]=_0x1705ce;if(_0x1af10f[_0x8437('0x2c')]['includeAll']){_0x5f08bd[_0x8437('0x37')]=[{'all':!![]}];}return db[_0x8437('0x3e')][_0x8437('0x28')](_0x5f08bd);})[_0x8437('0x1c')](function(_0x21fa72){_0x3838d1[_0x8437('0x4d')]=_0x21fa72;return _0x3838d1;});}})[_0x8437('0x1c')](respondWithFilteredResult(_0x4e4165,_0x5f08bd))['catch'](handleError(_0x4e4165,null));};exports['addTags']=function(_0x3aace2,_0x3acfeb){return db[_0x8437('0x30')][_0x8437('0x3b')]({'where':{'id':_0x3aace2[_0x8437('0x2e')]['id']}})[_0x8437('0x1c')](handleEntityNotFound(_0x3acfeb,null))['then'](function(_0x3ddee0){if(_0x3ddee0){return _0x3ddee0['setTags'](_0x3aace2[_0x8437('0x3a')][_0x8437('0x40')],_[_0x8437('0x3f')](_0x3aace2[_0x8437('0x3a')],[_0x8437('0x40'),'id'])||{})[_0x8437('0x4e')](function(){return db['Tag'][_0x8437('0x28')]({'attributes':['id',_0x8437('0x1f'),_0x8437('0x4f')],'where':{'id':_0x3aace2['body']['ids']}});})[_0x8437('0x1c')](function(_0x1bb75d){socket[_0x8437('0x50')](_0x8437('0x51'),{'id':Number(_0x3aace2[_0x8437('0x2e')]['id']),'tags':_0x1bb75d||[]});return{'id':Number(_0x3aace2['params']['id']),'tags':_0x1bb75d||[]};});}})[_0x8437('0x1c')](respondWithResult(_0x3acfeb,null))[_0x8437('0x2a')](handleError(_0x3acfeb,null));};exports[_0x8437('0x52')]=function(_0x3d1ea3,_0x2eead1){return db[_0x8437('0x30')][_0x8437('0x3b')]({'where':{'id':_0x3d1ea3[_0x8437('0x2e')]['id']}})[_0x8437('0x1c')](handleEntityNotFound(_0x2eead1,null))[_0x8437('0x1c')](function(_0x15bdb5){if(_0x15bdb5){return _0x15bdb5['removeTags'](_0x3d1ea3[_0x8437('0x2c')][_0x8437('0x40')]);}})[_0x8437('0x1c')](respondWithStatusCode(_0x2eead1,null))[_0x8437('0x2a')](handleError(_0x2eead1,null));};exports[_0x8437('0x53')]=function(_0x42621f,_0x2d3f6c){var _0x49f468=moment()[_0x8437('0x54')]()[_0x8437('0x55')]();var _0x1086fc=path[_0x8437('0x56')](config['root'],'server',_0x8437('0x57'),_0x8437('0x58'));var _0x114d48=path[_0x8437('0x56')](config[_0x8437('0x59')],_0x8437('0x5a'),_0x8437('0x57'),_0x8437('0x5b'));var _0x5e96da=path[_0x8437('0x56')](_0x1086fc,_0x49f468);var _0x2a4eb8=util[_0x8437('0x4a')](_0x8437('0x5c'),_0x42621f[_0x8437('0x2e')]['id'],_0x49f468);var _0x251084=path['join'](_0x1086fc,_0x2a4eb8);var _0x36c476=[];_0x36c476['push']({'model':db[_0x8437('0x5d')],'as':_0x8437('0x5d'),'attributes':['id',_0x8437('0x5e')],'raw':!![]});_0x36c476[_0x8437('0x5f')]({'model':db[_0x8437('0x60')],'as':_0x8437('0x61'),'attributes':['id',_0x8437('0x62'),_0x8437('0x63')],'raw':!![]});if(_0x42621f[_0x8437('0x2c')][_0x8437('0x5b')]){_0x36c476[_0x8437('0x5f')]({'model':db[_0x8437('0x64')],'as':_0x8437('0x64'),'raw':!![]});}var _0x25d31b=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id','body',_0x8437('0x65'),_0x8437('0x66'),_0x8437('0x67'),_0x8437('0x68')],'include':_0x36c476}];_0x25d31b[_0x8437('0x5f')]({'model':db[_0x8437('0x69')],'as':_0x8437('0x6a'),'attributes':['id','name']});_0x25d31b[_0x8437('0x5f')]({'model':db[_0x8437('0x5d')],'as':_0x8437('0x6b'),'attributes':['id',_0x8437('0x5e')]});return db['OpenchannelInteraction'][_0x8437('0x3b')]({'where':{'id':_0x42621f[_0x8437('0x2e')]['id']},'include':_0x25d31b})[_0x8437('0x1c')](handleEntityNotFound(_0x2d3f6c,null))[_0x8437('0x1c')](function(_0x5b26d4){if(_0x5b26d4){var _0x25f128=_0x5b26d4[_0x8437('0x6c')]({'plain':!![]});fs[_0x8437('0x6d')](_0x5e96da);var _0xb64a9={'channel':'Openchannel','account':_0x25f128[_0x8437('0x6a')][_0x8437('0x1f')],'agent':_0x25f128[_0x8437('0x6b')]?_0x25f128[_0x8437('0x6b')][_0x8437('0x5e')]:_0x8437('0x6e'),'createdAt':moment(_0x25f128[_0x8437('0x65')])[_0x8437('0x4a')](_0x8437('0x4b'))[_0x8437('0x55')](),'closedAt':_0x25f128[_0x8437('0x6f')]?moment(_0x25f128[_0x8437('0x70')])['format'](_0x8437('0x4b'))[_0x8437('0x55')]():'','disposition':_0x25f128['disposition'],'visibility':_0x25f128[_0x8437('0x71')]?_0x8437('0x72'):_0x8437('0x73'),'messages':_(_0x25f128['Messages'])[_0x8437('0x74')]({'secret':![]})[_0x8437('0x22')](function(_0x172939){if(_0x172939[_0x8437('0x64')]){var _0x133fd9=path[_0x8437('0x56')](_0x114d48,_0x172939['Attachment'][_0x8437('0x75')]);if(fs['existsSync'](_0x133fd9)){fs[_0x8437('0x76')](_0x133fd9)[_0x8437('0x77')](fs['createWriteStream'](path[_0x8437('0x56')](_0x5e96da,_0x172939['Attachment'][_0x8437('0x75')])));}}return{'date':moment(_0x172939[_0x8437('0x65')])[_0x8437('0x4a')](_0x8437('0x4b'))[_0x8437('0x55')](),'sender':_0x172939['direction']===_0x8437('0x78')?_0x172939['User']?_0x172939[_0x8437('0x5d')]['fullname']:_0x8437('0x79'):_0x172939[_0x8437('0x61')][_0x8437('0x62')]+(_0x172939[_0x8437('0x61')][_0x8437('0x63')]?'\x20'+_0x172939['Contact'][_0x8437('0x63')]:''),'body':_0x172939['Attachment']?_0x172939[_0x8437('0x64')][_0x8437('0x75')]:_0x172939['body'],'direction':_0x172939[_0x8437('0x66')]==='out'?'A':'C','secret':_0x172939['secret'],'read':_0x172939['read'],'attachment':_0x172939['Attachment']};})[_0x8437('0x7a')]()};return ejs[_0x8437('0x7b')](path[_0x8437('0x56')](config[_0x8437('0x59')],_0x8437('0x5a'),_0x8437('0x7c'),_0x8437('0x7d')),{'interaction':_0xb64a9})['then'](function(_0x5a9d13){var _0x238cd7=path['join'](_0x5e96da,_0x8437('0x7e')+_0x25f128['id']+'-'+_0x49f468+_0x8437('0x7f'));var _0x44d20f={'path':_0x238cd7,'channel':'Openchannel','interactionId':_0x25f128['id']};return pdf[_0x8437('0x80')](_0x5a9d13,_0x44d20f);})[_0x8437('0x1c')](function(){return new Promise(function(_0x9ca185,_0x56576f){zipdir(_0x5e96da,{'saveTo':_0x251084},function(_0x2637c6,_0x202488){if(_0x2637c6)return _0x56576f(_0x2637c6);return _0x9ca185(_0x202488);});})[_0x8437('0x1c')](function(){return new Promise(function(_0x41d0d7,_0x1ebb8c){rimraf(_0x5e96da,function(_0x2126e1){if(_0x2126e1)_0x1ebb8c(_0x2126e1);return _0x41d0d7();});});})[_0x8437('0x1c')](function(){return _0x2d3f6c[_0x8437('0x53')](_0x251084,_0x2a4eb8,function(_0x394758){if(_0x394758){logger['error'](_0x8437('0x81'),_0x394758);}else{fs[_0x8437('0x82')](_0x251084);}});});});}else{return _0x2d3f6c[_0x8437('0x11')](0xc8);}})[_0x8437('0x2a')](handleError(_0x2d3f6c,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b4f935f..14cc853 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 _0xc314=['emit','hasOwnProperty','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x4b6420,_0x126201){var _0x37076f=function(_0x3ee471){while(--_0x3ee471){_0x4b6420['push'](_0x4b6420['shift']());}};_0x37076f(++_0x126201);}(_0xc314,0x13e));var _0x4c31=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc314[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x4c31('0x0'))['db'][_0x4c31('0x1')];var OpenchannelMessage=require(_0x4c31('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4c31('0x2')](0x0);var events={'afterCreate':_0x4c31('0x3'),'afterUpdate':_0x4c31('0x4'),'afterDestroy':_0x4c31('0x5')};function emitEvent(_0x2e40bb){return function(_0x171f16,_0x12f88a,_0x5259e6){_0x171f16[_0x4c31('0x6')]({'attributes':['id'],'raw':!![]})[_0x4c31('0x7')](function(_0x1ee41b){_0x171f16[_0x4c31('0x8')](_0x4c31('0x9'),_0x1ee41b[_0x4c31('0xa')](function(_0x207c56){return{'id':_0x207c56['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x171f16['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4c31('0x7')](function(_0x559fba){_0x171f16['setDataValue'](_0x4c31('0xb'),_0x559fba['length']);OpenchannelInteractionEvents[_0x4c31('0xc')](_0x2e40bb+':'+_0x171f16['id'],_0x171f16);OpenchannelInteractionEvents['emit'](_0x2e40bb,_0x171f16);_0x5259e6(null);})['catch'](_0x5259e6(null));};}for(var e in events){if(events[_0x4c31('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x4c31('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x68fa=['emit','hasOwnProperty','exports','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x68fa,0x173));var _0xa68f=function(_0x534eb2,_0x2b9f02){_0x534eb2=_0x534eb2-0x0;var _0xfae93b=_0x68fa[_0x534eb2];return _0xfae93b;};'use strict';var EventEmitter=require(_0xa68f('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xa68f('0x1')];var OpenchannelMessage=require(_0xa68f('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa68f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa68f('0x4'),'afterDestroy':_0xa68f('0x5')};function emitEvent(_0x47dc72){return function(_0x34fee1,_0x27096a,_0x5c736e){_0x34fee1[_0xa68f('0x6')]({'attributes':['id'],'raw':!![]})[_0xa68f('0x7')](function(_0xfd9de0){_0x34fee1[_0xa68f('0x8')]('Users',_0xfd9de0[_0xa68f('0x9')](function(_0x233bc1){return{'id':_0x233bc1['id']};}));return OpenchannelMessage[_0xa68f('0xa')]({'where':{'OpenchannelInteractionId':_0x34fee1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa68f('0x7')](function(_0x51306b){_0x34fee1['setDataValue'](_0xa68f('0xb'),_0x51306b[_0xa68f('0xc')]);OpenchannelInteractionEvents[_0xa68f('0xd')](_0x47dc72+':'+_0x34fee1['id'],_0x34fee1);OpenchannelInteractionEvents[_0xa68f('0xd')](_0x47dc72,_0x34fee1);_0x5c736e(null);})['catch'](_0x5c736e(null));};}for(var e in events){if(events[_0xa68f('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xa68f('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 5911330..74abdc6 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 _0x78d3=['exports','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes'];(function(_0x3a4425,_0x1de5cb){var _0x26976d=function(_0x32135a){while(--_0x32135a){_0x3a4425['push'](_0x3a4425['shift']());}};_0x26976d(++_0x1de5cb);}(_0x78d3,0x73));var _0x378d=function(_0xa72bc8,_0x1be9ba){_0xa72bc8=_0xa72bc8-0x0;var _0x163d97=_0x78d3[_0xa72bc8];return _0x163d97;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var logger=require(_0x378d('0x2'))(_0x378d('0x3'));var moment=require(_0x378d('0x4'));var BPromise=require(_0x378d('0x5'));var rp=require(_0x378d('0x6'));var fs=require('fs');var path=require(_0x378d('0x7'));var rimraf=require(_0x378d('0x8'));var config=require(_0x378d('0x9'));var attributes=require(_0x378d('0xa'));module[_0x378d('0xb')]=function(_0xc18c0b,_0x59117c){return _0xc18c0b['define']('OpenchannelInteraction',attributes,{'tableName':_0x378d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x378d('0xd'),'hooks':{'beforeUpdate':function(_0x19beb8,_0x3bab19,_0x4698d9){if(_0x19beb8[_0x378d('0xe')](_0x378d('0xf'))){_0x19beb8['closedAt']=moment()[_0x378d('0x10')](_0x378d('0x11'));}_0x4698d9(null,_0x19beb8);}}});}; \ No newline at end of file +var _0x6f4e=['util','../../config/logger','api','moment','bluebird','path','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','lodash'];(function(_0xd21d48,_0x1c7cec){var _0x2f1b50=function(_0x5bca87){while(--_0x5bca87){_0xd21d48['push'](_0xd21d48['shift']());}};_0x2f1b50(++_0x1c7cec);}(_0x6f4e,0x120));var _0xe6f4=function(_0x168c3b,_0xdf3810){_0x168c3b=_0x168c3b-0x0;var _0xcef122=_0x6f4e[_0x168c3b];return _0xcef122;};'use strict';var _=require(_0xe6f4('0x0'));var util=require(_0xe6f4('0x1'));var logger=require(_0xe6f4('0x2'))(_0xe6f4('0x3'));var moment=require(_0xe6f4('0x4'));var BPromise=require(_0xe6f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6f4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe6f4('0x7'));module[_0xe6f4('0x8')]=function(_0x2a8f28,_0x4c0352){return _0x2a8f28[_0xe6f4('0x9')](_0xe6f4('0xa'),attributes,{'tableName':_0xe6f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe6f4('0xc'),'collate':_0xe6f4('0xd'),'hooks':{'beforeUpdate':function(_0x1104ea,_0x289b9d,_0x529b5e){if(_0x1104ea[_0xe6f4('0xe')]('closed')){_0x1104ea[_0xe6f4('0xf')]=moment()[_0xe6f4('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x529b5e(null,_0x1104ea);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 8fdb916..f46ca62 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 _0x79ab=['AddTagsToOpenchannelInteraction','find','ids','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','OpenchannelInteraction','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x79ab,0x133));var _0xb79a=function(_0x2ea08a,_0x240f73){_0x2ea08a=_0x2ea08a-0x0;var _0x5401ad=_0x79ab[_0x2ea08a];return _0x5401ad;};'use strict';var _=require(_0xb79a('0x0'));var util=require(_0xb79a('0x1'));var moment=require(_0xb79a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb79a('0x3'))['db'];var utils=require(_0xb79a('0x4'));var logger=require(_0xb79a('0x5'))('rpc');var config=require(_0xb79a('0x6'));var jayson=require(_0xb79a('0x7'));var client=jayson[_0xb79a('0x8')][_0xb79a('0x9')]({'port':0x232a});config[_0xb79a('0xa')]=_[_0xb79a('0xb')](config[_0xb79a('0xa')],{'host':_0xb79a('0xc'),'port':0x18eb});var socket=require(_0xb79a('0xd'))(new Redis(config['redis']));require(_0xb79a('0xe'))[_0xb79a('0xf')](socket);function respondWithRpcPromise(_0x2acf8f,_0x95b607,_0x482de2){return new BPromise(function(_0x4642dd,_0x651e36){return client[_0xb79a('0x10')](_0x2acf8f,_0x482de2)[_0xb79a('0x11')](function(_0x321fce){logger[_0xb79a('0x12')](_0xb79a('0x13'),_0x95b607,_0xb79a('0x14'));logger[_0xb79a('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x95b607,_0xb79a('0x14'),JSON[_0xb79a('0x16')](_0x321fce));if(_0x321fce[_0xb79a('0x17')]){if(_0x321fce[_0xb79a('0x17')]['code']===0x1f4){logger['error'](_0xb79a('0x13'),_0x95b607,_0x321fce[_0xb79a('0x17')]['message']);return _0x651e36(_0x321fce[_0xb79a('0x17')][_0xb79a('0x18')]);}logger[_0xb79a('0x17')](_0xb79a('0x13'),_0x95b607,_0x321fce[_0xb79a('0x17')]['message']);return _0x4642dd(_0x321fce[_0xb79a('0x17')]['message']);}else{logger[_0xb79a('0x12')](_0xb79a('0x13'),_0x95b607,_0xb79a('0x14'));_0x4642dd(_0x321fce[_0xb79a('0x19')][_0xb79a('0x18')]);}})[_0xb79a('0x1a')](function(_0x3a60b3){logger[_0xb79a('0x17')](_0xb79a('0x13'),_0x95b607,_0x3a60b3);_0x651e36(_0x3a60b3);});});}exports['UpdateOpenchannelInteraction']=function(_0x1afdc0){var _0x28a82e=this;return new Promise(function(_0x13f697,_0x142c66){return db[_0xb79a('0x1b')]['update'](_0x1afdc0[_0xb79a('0x1c')],{'raw':_0x1afdc0[_0xb79a('0x1d')]?_0x1afdc0[_0xb79a('0x1d')][_0xb79a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1afdc0[_0xb79a('0x1d')]?_0x1afdc0[_0xb79a('0x1d')][_0xb79a('0x1f')]||null:null,'attributes':_0x1afdc0[_0xb79a('0x1d')]?_0x1afdc0['options'][_0xb79a('0x20')]||null:null,'limit':_0x1afdc0[_0xb79a('0x1d')]?_0x1afdc0[_0xb79a('0x1d')][_0xb79a('0x21')]||null:null})[_0xb79a('0x11')](function(_0x3cf54d){logger[_0xb79a('0x12')](_0xb79a('0x22'),_0x1afdc0);logger[_0xb79a('0x15')](_0xb79a('0x22'),_0x1afdc0,JSON[_0xb79a('0x16')](_0x3cf54d));_0x13f697(_0x3cf54d);})[_0xb79a('0x1a')](function(_0x475914){logger[_0xb79a('0x17')](_0xb79a('0x22'),_0x475914[_0xb79a('0x18')],_0x1afdc0);_0x142c66(_0x28a82e[_0xb79a('0x17')](0x1f4,_0x475914[_0xb79a('0x18')]));});});};exports[_0xb79a('0x23')]=function(_0x22a91e){return new Promise(function(_0x93e84e,_0xb5ada2){return db[_0xb79a('0x1b')][_0xb79a('0x24')]({'where':_0x22a91e[_0xb79a('0x1d')]?_0x22a91e[_0xb79a('0x1d')][_0xb79a('0x1f')]||null:null})[_0xb79a('0x11')](function(_0xfea664){if(_0xfea664){return _0xfea664['addTags'](_0x22a91e[_0xb79a('0x1c')][_0xb79a('0x25')],_['omit'](_0x22a91e[_0xb79a('0x1c')],[_0xb79a('0x25'),'id'])||{});}})['spread'](function(_0x5e6934){logger['info']('AddTags',_0x22a91e);logger['debug']('AddTags',_0x22a91e,JSON['stringify'](_0x5e6934));_0x93e84e(_0x5e6934);})['catch'](function(_0x4b6736){logger['error']('AddTags',_0x4b6736[_0xb79a('0x18')],_0x22a91e);_0xb5ada2(_this[_0xb79a('0x17')](0x1f4,_0x4b6736[_0xb79a('0x18')]));});});}; \ No newline at end of file +var _0xf145=['request','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','then','ids','omit','spread','AddTags','stringify','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register'];(function(_0x502773,_0xe55d92){var _0x568f34=function(_0x44a7f9){while(--_0x44a7f9){_0x502773['push'](_0x502773['shift']());}};_0x568f34(++_0xe55d92);}(_0xf145,0x8a));var _0x5f14=function(_0x331ce0,_0xe335b9){_0x331ce0=_0x331ce0-0x0;var _0x31c3c7=_0xf145[_0x331ce0];return _0x31c3c7;};'use strict';var _=require(_0x5f14('0x0'));var util=require(_0x5f14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5f14('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f14('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5f14('0x4'));var config=require(_0x5f14('0x5'));var jayson=require(_0x5f14('0x6'));var client=jayson[_0x5f14('0x7')][_0x5f14('0x8')]({'port':0x232a});config[_0x5f14('0x9')]=_[_0x5f14('0xa')](config[_0x5f14('0x9')],{'host':_0x5f14('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5f14('0xc'))[_0x5f14('0xd')](socket);function respondWithRpcPromise(_0x1d9816,_0x247d46,_0x14de75){return new BPromise(function(_0x40ba49,_0x3e337b){return client[_0x5f14('0xe')](_0x1d9816,_0x14de75)['then'](function(_0x55f619){logger['info'](_0x5f14('0xf'),_0x247d46,_0x5f14('0x10'));logger[_0x5f14('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x247d46,_0x5f14('0x10'),JSON['stringify'](_0x55f619));if(_0x55f619[_0x5f14('0x12')]){if(_0x55f619['error'][_0x5f14('0x13')]===0x1f4){logger[_0x5f14('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x247d46,_0x55f619[_0x5f14('0x12')]['message']);return _0x3e337b(_0x55f619['error'][_0x5f14('0x14')]);}logger[_0x5f14('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x247d46,_0x55f619[_0x5f14('0x12')][_0x5f14('0x14')]);return _0x40ba49(_0x55f619[_0x5f14('0x12')]['message']);}else{logger[_0x5f14('0x15')](_0x5f14('0xf'),_0x247d46,_0x5f14('0x10'));_0x40ba49(_0x55f619[_0x5f14('0x16')][_0x5f14('0x14')]);}})['catch'](function(_0x5a476b){logger[_0x5f14('0x12')](_0x5f14('0xf'),_0x247d46,_0x5a476b);_0x3e337b(_0x5a476b);});});}exports[_0x5f14('0x17')]=function(_0x23b8ec){var _0x179bcc=this;return new Promise(function(_0x34b521,_0x1b839f){return db[_0x5f14('0x18')][_0x5f14('0x19')](_0x23b8ec[_0x5f14('0x1a')],{'raw':_0x23b8ec[_0x5f14('0x1b')]?_0x23b8ec[_0x5f14('0x1b')][_0x5f14('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23b8ec['options']?_0x23b8ec[_0x5f14('0x1b')][_0x5f14('0x1d')]||null:null,'attributes':_0x23b8ec[_0x5f14('0x1b')]?_0x23b8ec[_0x5f14('0x1b')][_0x5f14('0x1e')]||null:null,'limit':_0x23b8ec[_0x5f14('0x1b')]?_0x23b8ec['options']['limit']||null:null})['then'](function(_0xd32bd2){logger[_0x5f14('0x15')](_0x5f14('0x17'),_0x23b8ec);logger[_0x5f14('0x11')](_0x5f14('0x17'),_0x23b8ec,JSON['stringify'](_0xd32bd2));_0x34b521(_0xd32bd2);})['catch'](function(_0x114542){logger[_0x5f14('0x12')](_0x5f14('0x17'),_0x114542['message'],_0x23b8ec);_0x1b839f(_0x179bcc[_0x5f14('0x12')](0x1f4,_0x114542[_0x5f14('0x14')]));});});};exports[_0x5f14('0x1f')]=function(_0x46719){return new Promise(function(_0x484e0a,_0x592697){return db['OpenchannelInteraction']['find']({'where':_0x46719[_0x5f14('0x1b')]?_0x46719[_0x5f14('0x1b')]['where']||null:null})[_0x5f14('0x20')](function(_0x1757d7){if(_0x1757d7){return _0x1757d7['addTags'](_0x46719['body'][_0x5f14('0x21')],_[_0x5f14('0x22')](_0x46719[_0x5f14('0x1a')],[_0x5f14('0x21'),'id'])||{});}})[_0x5f14('0x23')](function(_0x207d8b){logger[_0x5f14('0x15')]('AddTags',_0x46719);logger[_0x5f14('0x11')](_0x5f14('0x24'),_0x46719,JSON[_0x5f14('0x25')](_0x207d8b));_0x484e0a(_0x207d8b);})['catch'](function(_0x1846ff){logger[_0x5f14('0x12')]('AddTags',_0x1846ff[_0x5f14('0x14')],_0x46719);_0x592697(_this['error'](0x1f4,_0x1846ff[_0x5f14('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 6692588..51abd5b 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 _0xa3a5=['length','./openchannelInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3a5,0x119));var _0x5a3a=function(_0xdc1af4,_0x4ed6f1){_0xdc1af4=_0xdc1af4-0x0;var _0x231abb=_0xa3a5[_0xdc1af4];return _0x231abb;};'use strict';var OpenchannelInteractionEvents=require(_0x5a3a('0x0'));var events=[_0x5a3a('0x1'),_0x5a3a('0x2'),_0x5a3a('0x3')];function createListener(_0x3e7746,_0x192de8){return function(_0x1b5ac4){_0x192de8[_0x5a3a('0x4')](_0x3e7746,_0x1b5ac4);};}function removeListener(_0x5dc932,_0x42f9b3){return function(){OpenchannelInteractionEvents[_0x5a3a('0x5')](_0x5dc932,_0x42f9b3);};}exports[_0x5a3a('0x6')]=function(_0xbfb1f){for(var _0x47775e=0x0,_0xdf9a91=events[_0x5a3a('0x7')];_0x47775e<_0xdf9a91;_0x47775e++){var _0x21516c=events[_0x47775e];var _0x320446=createListener('openchannelInteraction:'+_0x21516c,_0xbfb1f);OpenchannelInteractionEvents['on'](_0x21516c,_0x320446);}}; \ No newline at end of file +var _0x0e99=['register','length','./openchannelInteraction.events','save','remove','emit','removeListener'];(function(_0x3e995d,_0x5936ba){var _0x13822f=function(_0x4ae0af){while(--_0x4ae0af){_0x3e995d['push'](_0x3e995d['shift']());}};_0x13822f(++_0x5936ba);}(_0x0e99,0x1c2));var _0x90e9=function(_0xa04235,_0x41ada4){_0xa04235=_0xa04235-0x0;var _0x16caff=_0x0e99[_0xa04235];return _0x16caff;};'use strict';var OpenchannelInteractionEvents=require(_0x90e9('0x0'));var events=[_0x90e9('0x1'),_0x90e9('0x2'),'update'];function createListener(_0x24721f,_0x34226f){return function(_0x440da8){_0x34226f[_0x90e9('0x3')](_0x24721f,_0x440da8);};}function removeListener(_0x240b8b,_0x332c90){return function(){OpenchannelInteractionEvents[_0x90e9('0x4')](_0x240b8b,_0x332c90);};}exports[_0x90e9('0x5')]=function(_0x49503c){for(var _0x3485c9=0x0,_0x50e4c2=events[_0x90e9('0x6')];_0x3485c9<_0x50e4c2;_0x3485c9++){var _0xe85eb9=events[_0x3485c9];var _0x54c15f=createListener('openchannelInteraction:'+_0xe85eb9,_0x49503c);OpenchannelInteractionEvents['on'](_0xe85eb9,_0x54c15f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 46b0d09..e612369 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x1ccc19,_0x2a5e47){var _0x393065=function(_0x1ffa38){while(--_0x1ffa38){_0x1ccc19['push'](_0x1ccc19['shift']());}};_0x393065(++_0x2a5e47);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0xcb91[_0x40911a];return _0x27e8e3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0xcb91[_0x30d87a];return _0x48f64b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 621d12a..9a63ae4 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 _0x8a5c=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x1fc1af,_0x46bd5d){var _0x5d2eb0=function(_0xc10ec3){while(--_0xc10ec3){_0x1fc1af['push'](_0x1fc1af['shift']());}};_0x5d2eb0(++_0x46bd5d);}(_0x8a5c,0x136));var _0xc8a5=function(_0x1d158d,_0x1dd303){_0x1d158d=_0x1d158d-0x0;var _0x51b8c4=_0x8a5c[_0x1d158d];return _0x51b8c4;};'use strict';var Sequelize=require(_0xc8a5('0x0'));module[_0xc8a5('0x1')]={'body':{'type':Sequelize[_0xc8a5('0x2')](_0xc8a5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc8a5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc8a5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc8a5('0x5')]('in',_0xc8a5('0x6')),'defaultValue':_0xc8a5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc8a5('0x7')]},'providerResponse':{'type':Sequelize[_0xc8a5('0x2')]}}; \ No newline at end of file +var _0xdaa8=['TEXT','medium','STRING','sequelize','exports'];(function(_0x2d0353,_0xb5684d){var _0xdd1c42=function(_0x1a8b04){while(--_0x1a8b04){_0x2d0353['push'](_0x2d0353['shift']());}};_0xdd1c42(++_0xb5684d);}(_0xdaa8,0xe4));var _0x8daa=function(_0xd746bf,_0x40c39d){_0xd746bf=_0xd746bf-0x0;var _0x4618ce=_0xdaa8[_0xd746bf];return _0x4618ce;};'use strict';var Sequelize=require(_0x8daa('0x0'));module[_0x8daa('0x1')]={'body':{'type':Sequelize[_0x8daa('0x2')](_0x8daa('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x8daa('0x4')]},'providerResponse':{'type':Sequelize[_0x8daa('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f80bc48..14596a8 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 _0x321b=['redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','find','create','body','params','describe','accept','openchannel','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','user','role','null','acceptMessage','sequelize','Sequelize','contact','User','fullname','email','internal','agent','manual','SIP/%s','channel','event','EventManager','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','format','motionChannel','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x519c72,_0x4baade){var _0x2f879f=function(_0x48978f){while(--_0x48978f){_0x519c72['push'](_0x519c72['shift']());}};_0x2f879f(++_0x4baade);}(_0x321b,0x161));var _0xb321=function(_0x251e82,_0x1d3fea){_0x251e82=_0x251e82-0x0;var _0x1d97ea=_0x321b[_0x251e82];return _0x1d97ea;};'use strict';var emlformat=require(_0xb321('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb321('0x1'));var jsonpatch=require(_0xb321('0x2'));var rp=require('request-promise');var moment=require(_0xb321('0x3'));var BPromise=require(_0xb321('0x4'));var Mustache=require(_0xb321('0x5'));var util=require(_0xb321('0x6'));var path=require(_0xb321('0x7'));var sox=require(_0xb321('0x8'));var csv=require(_0xb321('0x9'));var ejs=require(_0xb321('0xa'));var fs=require('fs');var fs_extra=require(_0xb321('0xb'));var _=require(_0xb321('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb321('0xd'));var deskjs=require(_0xb321('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb321('0xf'));var Redis=require(_0xb321('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb321('0x11'));var hardwareService=require(_0xb321('0x12'));var logger=require(_0xb321('0x13'))(_0xb321('0x14'));var utils=require(_0xb321('0x15'));var config=require(_0xb321('0x16'));var licenseUtil=require(_0xb321('0x17'));var db=require(_0xb321('0x18'))['db'];config[_0xb321('0x19')]=_[_0xb321('0x1a')](config[_0xb321('0x19')],{'host':_0xb321('0x1b'),'port':0x18eb});var socket=require(_0xb321('0x1c'))(new Redis(config[_0xb321('0x19')]));require(_0xb321('0x1d'))[_0xb321('0x1e')](socket);var jayson=require(_0xb321('0x1f'));var client=jayson[_0xb321('0x20')][_0xb321('0x21')]({'port':0x232c});var client9002=jayson[_0xb321('0x20')][_0xb321('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3d2c19,_0x22cba9,_0xe60ad0,_0x938e02){return new BPromise(function(_0x5c2171,_0x4208bc){var _0x584431=_0x938e02||client;return _0x584431['request'](_0x3d2c19,_0xe60ad0)[_0xb321('0x22')](function(_0x5d3266){logger[_0xb321('0x23')](_0xb321('0x24'),_0x22cba9,_0xb321('0x25'));logger['debug'](_0xb321('0x26'),_0x22cba9,'request\x20sent',JSON[_0xb321('0x27')](_0x5d3266));if(_0x5d3266['error']){if(_0x5d3266[_0xb321('0x28')]['code']===0x1f4){logger['error'](_0xb321('0x24'),_0x22cba9,_0x5d3266[_0xb321('0x28')][_0xb321('0x29')]);return _0x4208bc(_0x5d3266['error'][_0xb321('0x29')]);}logger['error'](_0xb321('0x24'),_0x22cba9,_0x5d3266[_0xb321('0x28')][_0xb321('0x29')]);return _0x5c2171(_0x5d3266[_0xb321('0x28')][_0xb321('0x29')]);}else{logger[_0xb321('0x23')](_0xb321('0x24'),_0x22cba9,_0xb321('0x25'));_0x5c2171(_0x5d3266[_0xb321('0x2a')][_0xb321('0x29')]);}})[_0xb321('0x2b')](function(_0x176bc2){logger[_0xb321('0x28')](_0xb321('0x24'),_0x22cba9,_0x176bc2);_0x4208bc(_0x176bc2);});});}function respondWithStatusCode(_0x2177e4,_0x8e9379){_0x8e9379=_0x8e9379||0xcc;return function(_0x422caa){if(_0x422caa){return _0x2177e4[_0xb321('0x2c')](_0x8e9379);}return _0x2177e4[_0xb321('0x2d')](_0x8e9379)['end']();};}function respondWithResult(_0x1a6e02,_0x4fbeb7){_0x4fbeb7=_0x4fbeb7||0xc8;return function(_0x3145d9){if(_0x3145d9){return _0x1a6e02[_0xb321('0x2d')](_0x4fbeb7)[_0xb321('0x2e')](_0x3145d9);}};}function respondWithFilteredResult(_0x4483a7,_0x3998a9){return function(_0x38b025){if(_0x38b025){var _0x20fc54=typeof _0x3998a9[_0xb321('0x2f')]==='undefined'&&typeof _0x3998a9[_0xb321('0x30')]===_0xb321('0x31');var _0x1c5b83=_0x38b025[_0xb321('0x32')];var _0x87225e=_0x20fc54?0x0:_0x3998a9[_0xb321('0x2f')];var _0x39f92d=_0x20fc54?_0x38b025['count']:_0x3998a9[_0xb321('0x2f')]+_0x3998a9[_0xb321('0x30')];var _0x9bb5f0;if(_0x39f92d>=_0x1c5b83){_0x39f92d=_0x1c5b83;_0x9bb5f0=0xc8;}else{_0x9bb5f0=0xce;}_0x4483a7[_0xb321('0x2d')](_0x9bb5f0);return _0x4483a7[_0xb321('0x33')](_0xb321('0x34'),_0x87225e+'-'+_0x39f92d+'/'+_0x1c5b83)[_0xb321('0x2e')](_0x38b025);}return null;};}function patchUpdates(_0x30d7b8){return function(_0x315b4e){try{jsonpatch[_0xb321('0x35')](_0x315b4e,_0x30d7b8,!![]);}catch(_0x264ac3){return BPromise[_0xb321('0x36')](_0x264ac3);}return _0x315b4e[_0xb321('0x37')]();};}function saveUpdates(_0xebd403,_0x51de42){return function(_0x294292){if(_0x294292){return _0x294292[_0xb321('0x38')](_0xebd403)['then'](function(_0x404419){return _0x404419;});}return null;};}function removeEntity(_0x29a439,_0x3510f9){return function(_0x2eff40){if(_0x2eff40){return _0x2eff40[_0xb321('0x39')]()[_0xb321('0x22')](function(){_0x29a439[_0xb321('0x2d')](0xcc)[_0xb321('0x3a')]();});}};}function handleEntityNotFound(_0x1cfec2,_0x1f543e){return function(_0x51b52a){if(!_0x51b52a){_0x1cfec2[_0xb321('0x2c')](0x194);}return _0x51b52a;};}function handleError(_0x39c58,_0x1e4f6c){_0x1e4f6c=_0x1e4f6c||0x1f4;return function(_0x58dab3){logger[_0xb321('0x28')](_0x58dab3[_0xb321('0x3b')]);if(_0x58dab3[_0xb321('0x3c')]){delete _0x58dab3[_0xb321('0x3c')];}_0x39c58[_0xb321('0x2d')](_0x1e4f6c)[_0xb321('0x3d')](_0x58dab3);};}exports['index']=function(_0x1d343e,_0x213e78){var _0x3d088b={},_0x158f07={},_0x561c1a={'count':0x0,'rows':[]};var _0x39a9c4=_[_0xb321('0x3e')](db[_0xb321('0x3f')][_0xb321('0x40')],function(_0x85d9ba){return{'name':_0x85d9ba[_0xb321('0x41')],'type':_0x85d9ba[_0xb321('0x42')][_0xb321('0x43')]};});_0x158f07[_0xb321('0x44')]=_[_0xb321('0x3e')](_0x39a9c4,_0xb321('0x3c'));_0x158f07[_0xb321('0x45')]=_[_0xb321('0x46')](_0x1d343e[_0xb321('0x45')]);_0x158f07[_0xb321('0x47')]=_['intersection'](_0x158f07[_0xb321('0x44')],_0x158f07[_0xb321('0x45')]);_0x3d088b['attributes']=_[_0xb321('0x48')](_0x158f07[_0xb321('0x44')],qs['fields'](_0x1d343e['query'][_0xb321('0x49')]));_0x3d088b[_0xb321('0x4a')]=_0x3d088b[_0xb321('0x4a')][_0xb321('0x4b')]?_0x3d088b['attributes']:_0x158f07['model'];if(!_0x1d343e[_0xb321('0x45')][_0xb321('0x4c')]('nolimit')){_0x3d088b[_0xb321('0x30')]=qs['limit'](_0x1d343e[_0xb321('0x45')][_0xb321('0x30')]);_0x3d088b[_0xb321('0x2f')]=qs[_0xb321('0x2f')](_0x1d343e[_0xb321('0x45')]['offset']);}_0x3d088b['order']=qs[_0xb321('0x4d')](_0x1d343e[_0xb321('0x45')][_0xb321('0x4d')]);_0x3d088b['where']=qs[_0xb321('0x47')](_['pick'](_0x1d343e[_0xb321('0x45')],_0x158f07[_0xb321('0x47')]),_0x39a9c4);if(_0x1d343e[_0xb321('0x45')][_0xb321('0x4e')]){_0x3d088b[_0xb321('0x4f')]=_[_0xb321('0x50')](_0x3d088b['where'],{'$or':_[_0xb321('0x3e')](_0x39a9c4,function(_0x11be6a){if(_0x11be6a[_0xb321('0x42')]!==_0xb321('0x51')){var _0x4d5180={};_0x4d5180[_0x11be6a[_0xb321('0x3c')]]={'$like':'%'+_0x1d343e[_0xb321('0x45')][_0xb321('0x4e')]+'%'};return _0x4d5180;}})});}_0x3d088b=_[_0xb321('0x50')]({},_0x3d088b,_0x1d343e[_0xb321('0x52')]);var _0x3f5598={'where':_0x3d088b[_0xb321('0x4f')]};return db[_0xb321('0x3f')][_0xb321('0x32')](_0x3f5598)[_0xb321('0x22')](function(_0x142a4b){_0x561c1a[_0xb321('0x32')]=_0x142a4b;if(_0x1d343e[_0xb321('0x45')][_0xb321('0x53')]){_0x3d088b[_0xb321('0x54')]=[{'all':!![]}];}return db[_0xb321('0x3f')][_0xb321('0x55')](_0x3d088b);})[_0xb321('0x22')](function(_0x40ab2e){_0x561c1a['rows']=_0x40ab2e;return _0x561c1a;})['then'](respondWithFilteredResult(_0x213e78,_0x3d088b))['catch'](handleError(_0x213e78,null));};exports['show']=function(_0x5c1573,_0x5bdf2b){var _0x10ff6a={'raw':!![],'where':{'id':_0x5c1573['params']['id']}},_0x1d5d95={};_0x1d5d95['model']=_[_0xb321('0x46')](db['OpenchannelMessage'][_0xb321('0x40')]);_0x1d5d95[_0xb321('0x45')]=_['keys'](_0x5c1573[_0xb321('0x45')]);_0x1d5d95[_0xb321('0x47')]=_[_0xb321('0x48')](_0x1d5d95['model'],_0x1d5d95[_0xb321('0x45')]);_0x10ff6a['attributes']=_[_0xb321('0x48')](_0x1d5d95[_0xb321('0x44')],qs[_0xb321('0x49')](_0x5c1573[_0xb321('0x45')][_0xb321('0x49')]));_0x10ff6a[_0xb321('0x4a')]=_0x10ff6a[_0xb321('0x4a')]['length']?_0x10ff6a[_0xb321('0x4a')]:_0x1d5d95['model'];if(_0x5c1573[_0xb321('0x45')]['includeAll']){_0x10ff6a[_0xb321('0x54')]=[{'all':!![]}];}_0x10ff6a=_[_0xb321('0x50')]({},_0x10ff6a,_0x5c1573[_0xb321('0x52')]);return db[_0xb321('0x3f')][_0xb321('0x56')](_0x10ff6a)[_0xb321('0x22')](handleEntityNotFound(_0x5bdf2b,null))[_0xb321('0x22')](respondWithResult(_0x5bdf2b,null))['catch'](handleError(_0x5bdf2b,null));};exports[_0xb321('0x57')]=function(_0x40da31,_0x2ce66d){return db[_0xb321('0x3f')][_0xb321('0x57')](_0x40da31[_0xb321('0x58')],{})[_0xb321('0x22')](respondWithResult(_0x2ce66d,0xc9))[_0xb321('0x2b')](handleError(_0x2ce66d,null));};exports['update']=function(_0x6cbfce,_0x3c1f9a){if(_0x6cbfce[_0xb321('0x58')]['id']){delete _0x6cbfce[_0xb321('0x58')]['id'];}return db[_0xb321('0x3f')][_0xb321('0x56')]({'where':{'id':_0x6cbfce[_0xb321('0x59')]['id']}})[_0xb321('0x22')](handleEntityNotFound(_0x3c1f9a,null))['then'](saveUpdates(_0x6cbfce[_0xb321('0x58')],null))['then'](respondWithResult(_0x3c1f9a,null))[_0xb321('0x2b')](handleError(_0x3c1f9a,null));};exports[_0xb321('0x39')]=function(_0x1a6742,_0x25e2e3){return db[_0xb321('0x3f')][_0xb321('0x56')]({'where':{'id':_0x1a6742[_0xb321('0x59')]['id']}})[_0xb321('0x22')](handleEntityNotFound(_0x25e2e3,null))['then'](removeEntity(_0x25e2e3,null))[_0xb321('0x2b')](handleError(_0x25e2e3,null));};exports['describe']=function(_0x1de266,_0x30ebdc){return db[_0xb321('0x3f')][_0xb321('0x5a')]()[_0xb321('0x22')](respondWithResult(_0x30ebdc,null))[_0xb321('0x2b')](handleError(_0x30ebdc,null));};var interaction_log=require(_0xb321('0x13'))('openchannel-interactions');exports[_0xb321('0x5b')]=function(_0x29cd78,_0x116988,_0x437313){var _0x4ece14={'agent':{},'channel':_0xb321('0x5c')};if(_0x29cd78[_0xb321('0x58')]['id']){delete _0x29cd78[_0xb321('0x58')]['id'];}_0x29cd78['body']['read']=!![];_0x29cd78[_0xb321('0x58')]['readAt']=moment()['format'](_0xb321('0x5d'));_0x29cd78['body'][_0xb321('0x5e')]=_0x29cd78[_0xb321('0x58')][_0xb321('0x5e')]||_0x29cd78['user']['id'];_0x4ece14['agent']['id']=_0x29cd78[_0xb321('0x58')][_0xb321('0x5e')];return db[_0xb321('0x3f')][_0xb321('0x56')]({'where':{'id':_0x29cd78[_0xb321('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x116988,null))[_0xb321('0x22')](saveUpdates(_0x29cd78[_0xb321('0x58')],null))[_0xb321('0x22')](function(_0x48965d){if(_0x48965d){_0x4ece14[_0xb321('0x29')]=_0x48965d[_0xb321('0x5f')]({'plain':!![]});return db[_0xb321('0x60')]['find']({'where':{'id':_0x48965d[_0xb321('0x61')]}});}return null;})[_0xb321('0x22')](handleEntityNotFound(_0x116988,null))[_0xb321('0x22')](function(_0x3f2adc){if(_0x3f2adc){return _0x3f2adc[_0xb321('0x38')]({'UserId':_0x29cd78[_0xb321('0x58')][_0xb321('0x5e')],'read1stAt':_['isNil'](_0x3f2adc['read1stAt'])?moment()['format'](_0xb321('0x5d')):undefined});}return null;})['then'](function(_0x2421eb){if(_0x2421eb){_0x4ece14[_0xb321('0x62')]=_0x2421eb[_0xb321('0x5f')]({'plain':!![]});interaction_log[_0xb321('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x29cd78[_0xb321('0x63')]['id'],_0x29cd78[_0xb321('0x63')][_0xb321('0x3c')],_0x29cd78[_0xb321('0x63')][_0xb321('0x64')],_0x4ece14['interaction']['id'],_0x29cd78[_0xb321('0x58')]?JSON['stringify'](_0x29cd78[_0xb321('0x58')]):_0xb321('0x65'));return respondWithRpcPromise('AcceptMessage',_0xb321('0x66'),_0x4ece14);}return null;})[_0xb321('0x22')](function(_0x26e279){var _0x4ba64e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x26e279[_0xb321('0x29')]['ContactId'];return db[_0xb321('0x67')]['query'](_0x4ba64e,{'type':db[_0xb321('0x68')]['QueryTypes']['SELECT'],'raw':!![]})[_0xb321('0x22')](function(_0x54f039){return _0x54f039;});})[_0xb321('0x22')](function(_0x5172ec){if(_0x5172ec){_0x4ece14[_0xb321('0x29')][_0xb321('0x69')]=_0x5172ec[0x0];if(!_0x29cd78[_0xb321('0x58')][_0xb321('0x5e')])return;return db[_0xb321('0x6a')][_0xb321('0x56')]({'where':{'id':_0x29cd78['body'][_0xb321('0x5e')],'role':'agent'},'attributes':['id',_0xb321('0x3c'),_0xb321('0x6b'),_0xb321('0x6c'),_0xb321('0x6d')],'raw':!![]});}return null;})[_0xb321('0x22')](function(_0x2afa67){if(!_0x2afa67)return null;_0x4ece14[_0xb321('0x29')][_0xb321('0x6e')]=_0x2afa67;return _0x4ece14;})[_0xb321('0x22')](function(_0x132df7){if(_0x132df7){if(_0x29cd78[_0xb321('0x58')][_0xb321('0x6f')]){_0x4ece14['message']['interface']=util['format'](_0xb321('0x70'),_0x29cd78[_0xb321('0x63')]['name']);_0x4ece14[_0xb321('0x29')][_0xb321('0x71')]=_0x4ece14[_0xb321('0x71')];_0x4ece14[_0xb321('0x29')]['motionChannel']=_0x4ece14['channel'];_0x4ece14[_0xb321('0x29')][_0xb321('0x72')]=_0xb321('0x5b');return respondWithRpcPromise(_0xb321('0x73'),_0xb321('0x73'),{'event':'acceptmessage','message':_0x4ece14[_0xb321('0x29')]},client9002)[_0xb321('0x22')](function(){return _0x4ece14;});}return _0x4ece14;}return null;})[_0xb321('0x22')](respondWithResult(_0x116988,null))[_0xb321('0x2b')](handleError(_0x116988,null));};var interaction_log=require('../../config/logger')(_0xb321('0x74'));exports['reject']=function(_0x1d1f03,_0x541ca7,_0x4d44b0){var _0x52f6a6={'agent':{},'channel':'openchannel'};if(_0x1d1f03[_0xb321('0x58')]['id']){delete _0x1d1f03['body']['id'];}_0x1d1f03[_0xb321('0x58')]['UserId']=_0x1d1f03[_0xb321('0x58')][_0xb321('0x5e')]||_0x1d1f03['user']['id'];_0x52f6a6['agent']['id']=_0x1d1f03[_0xb321('0x58')][_0xb321('0x5e')];return db['OpenchannelMessage'][_0xb321('0x56')]({'where':{'id':_0x1d1f03[_0xb321('0x59')]['id'],'UserId':null}})[_0xb321('0x22')](handleEntityNotFound(_0x541ca7,null))[_0xb321('0x22')](function(_0x12fcf5){if(_0x12fcf5){_0x52f6a6[_0xb321('0x29')]=_0x12fcf5[_0xb321('0x5f')]({'plain':!![]});return db[_0xb321('0x60')][_0xb321('0x56')]({'where':{'id':_0x12fcf5[_0xb321('0x61')]}});}return null;})[_0xb321('0x22')](handleEntityNotFound(_0x541ca7,null))[_0xb321('0x22')](function(_0x426fe7){if(_0x426fe7){_0x52f6a6[_0xb321('0x62')]=_0x426fe7[_0xb321('0x5f')]({'plain':!![]});interaction_log['info'](_0xb321('0x75'),_0x1d1f03[_0xb321('0x63')]['id'],_0x1d1f03[_0xb321('0x63')][_0xb321('0x3c')],_0x1d1f03['user'][_0xb321('0x64')],_0x52f6a6[_0xb321('0x62')]['id'],_0x1d1f03['body']?JSON[_0xb321('0x27')](_0x1d1f03[_0xb321('0x58')]):_0xb321('0x65'));return respondWithRpcPromise(_0xb321('0x76'),_0xb321('0x77'),_0x52f6a6);}return null;})[_0xb321('0x22')](function(_0x40f618){var _0x16c069=_0xb321('0x78')+_0x40f618[_0xb321('0x29')][_0xb321('0x79')];return db[_0xb321('0x67')][_0xb321('0x45')](_0x16c069,{'type':db['Sequelize'][_0xb321('0x7a')][_0xb321('0x7b')],'raw':!![]})['then'](function(_0x2c488a){return _0x2c488a;});})[_0xb321('0x22')](function(_0x5e15a9){if(_0x5e15a9){_0x52f6a6['message']['contact']=_0x5e15a9[0x0];if(!_0x1d1f03['body'][_0xb321('0x5e')])return;return db['User'][_0xb321('0x56')]({'where':{'id':_0x1d1f03[_0xb321('0x58')][_0xb321('0x5e')],'role':'agent'},'attributes':['id',_0xb321('0x3c'),_0xb321('0x6b'),_0xb321('0x6c'),_0xb321('0x6d')],'raw':!![]});}return null;})['then'](function(_0x59f6d9){if(!_0x59f6d9)return null;_0x52f6a6[_0xb321('0x29')][_0xb321('0x6e')]=_0x59f6d9;return _0x52f6a6;})[_0xb321('0x22')](function(_0x468664){if(_0x468664){_0x468664[_0xb321('0x29')]['interface']=util[_0xb321('0x7c')](_0xb321('0x70'),_0x1d1f03['user'][_0xb321('0x3c')]);_0x468664[_0xb321('0x29')][_0xb321('0x71')]=_0x52f6a6[_0xb321('0x71')];_0x468664['message'][_0xb321('0x7d')]=_0x52f6a6[_0xb321('0x71')];_0x468664[_0xb321('0x29')]['event']=_0xb321('0x36');respondWithRpcPromise(_0xb321('0x73'),_0xb321('0x73'),{'event':'rejectmessage','message':_0x468664[_0xb321('0x29')]},client9002);return _0x52f6a6;}return null;})['then'](respondWithResult(_0x541ca7,null))[_0xb321('0x2b')](handleError(_0x541ca7,null));}; \ No newline at end of file +var _0xc4f3=['merge','map','VIRTUAL','filter','options','includeAll','include','params','fields','find','create','body','describe','../../config/logger','openchannel-interactions','accept','read','readAt','format','UserId','OpenchannelInteraction','OpenchannelInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','internal','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick'];(function(_0x3fcea2,_0x53a45f){var _0x2e9114=function(_0x1d8180){while(--_0x1d8180){_0x3fcea2['push'](_0x3fcea2['shift']());}};_0x2e9114(++_0x53a45f);}(_0xc4f3,0xbd));var _0x3c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3c4f('0x0'));var rimraf=require(_0x3c4f('0x1'));var zipdir=require(_0x3c4f('0x2'));var jsonpatch=require(_0x3c4f('0x3'));var rp=require(_0x3c4f('0x4'));var moment=require(_0x3c4f('0x5'));var BPromise=require(_0x3c4f('0x6'));var Mustache=require(_0x3c4f('0x7'));var util=require(_0x3c4f('0x8'));var path=require(_0x3c4f('0x9'));var sox=require('sox');var csv=require(_0x3c4f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c4f('0xb'));var _=require(_0x3c4f('0xc'));var squel=require('squel');var crypto=require(_0x3c4f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3c4f('0xe'));var toCsv=require(_0x3c4f('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c4f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3c4f('0x10'));var as=require(_0x3c4f('0x11'));var hardwareService=require(_0x3c4f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3c4f('0x13'));var config=require(_0x3c4f('0x14'));var licenseUtil=require(_0x3c4f('0x15'));var db=require('../../mysqldb')['db'];config[_0x3c4f('0x16')]=_[_0x3c4f('0x17')](config[_0x3c4f('0x16')],{'host':_0x3c4f('0x18'),'port':0x18eb});var socket=require(_0x3c4f('0x19'))(new Redis(config[_0x3c4f('0x16')]));require(_0x3c4f('0x1a'))[_0x3c4f('0x1b')](socket);var jayson=require(_0x3c4f('0x1c'));var client=jayson[_0x3c4f('0x1d')][_0x3c4f('0x1e')]({'port':0x232c});var client9002=jayson[_0x3c4f('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x498bb4,_0x5232f4,_0x2c66de,_0x5bf365){return new BPromise(function(_0x4d05e6,_0x432a2c){var _0x7c5c86=_0x5bf365||client;return _0x7c5c86[_0x3c4f('0x1f')](_0x498bb4,_0x2c66de)['then'](function(_0x58f856){logger[_0x3c4f('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x5232f4,_0x3c4f('0x21'));logger[_0x3c4f('0x22')](_0x3c4f('0x23'),_0x5232f4,'request\x20sent',JSON['stringify'](_0x58f856));if(_0x58f856[_0x3c4f('0x24')]){if(_0x58f856[_0x3c4f('0x24')][_0x3c4f('0x25')]===0x1f4){logger[_0x3c4f('0x24')](_0x3c4f('0x26'),_0x5232f4,_0x58f856[_0x3c4f('0x24')]['message']);return _0x432a2c(_0x58f856[_0x3c4f('0x24')]['message']);}logger[_0x3c4f('0x24')](_0x3c4f('0x26'),_0x5232f4,_0x58f856[_0x3c4f('0x24')][_0x3c4f('0x27')]);return _0x4d05e6(_0x58f856[_0x3c4f('0x24')][_0x3c4f('0x27')]);}else{logger[_0x3c4f('0x20')](_0x3c4f('0x26'),_0x5232f4,_0x3c4f('0x21'));_0x4d05e6(_0x58f856[_0x3c4f('0x28')][_0x3c4f('0x27')]);}})[_0x3c4f('0x29')](function(_0x3d6cf0){logger[_0x3c4f('0x24')](_0x3c4f('0x26'),_0x5232f4,_0x3d6cf0);_0x432a2c(_0x3d6cf0);});});}function respondWithStatusCode(_0x574fca,_0x1672f0){_0x1672f0=_0x1672f0||0xcc;return function(_0x868260){if(_0x868260){return _0x574fca['sendStatus'](_0x1672f0);}return _0x574fca[_0x3c4f('0x2a')](_0x1672f0)[_0x3c4f('0x2b')]();};}function respondWithResult(_0x2b1504,_0xf5880e){_0xf5880e=_0xf5880e||0xc8;return function(_0x55f042){if(_0x55f042){return _0x2b1504[_0x3c4f('0x2a')](_0xf5880e)[_0x3c4f('0x2c')](_0x55f042);}};}function respondWithFilteredResult(_0x562289,_0x131ca6){return function(_0x5bcf7a){if(_0x5bcf7a){var _0x30f213=typeof _0x131ca6['offset']===_0x3c4f('0x2d')&&typeof _0x131ca6[_0x3c4f('0x2e')]==='undefined';var _0x4fbc18=_0x5bcf7a[_0x3c4f('0x2f')];var _0x1df329=_0x30f213?0x0:_0x131ca6[_0x3c4f('0x30')];var _0x3a3deb=_0x30f213?_0x5bcf7a['count']:_0x131ca6['offset']+_0x131ca6[_0x3c4f('0x2e')];var _0x191c7f;if(_0x3a3deb>=_0x4fbc18){_0x3a3deb=_0x4fbc18;_0x191c7f=0xc8;}else{_0x191c7f=0xce;}_0x562289[_0x3c4f('0x2a')](_0x191c7f);return _0x562289[_0x3c4f('0x31')]('Content-Range',_0x1df329+'-'+_0x3a3deb+'/'+_0x4fbc18)[_0x3c4f('0x2c')](_0x5bcf7a);}return null;};}function patchUpdates(_0x28981c){return function(_0x39a680){try{jsonpatch[_0x3c4f('0x32')](_0x39a680,_0x28981c,!![]);}catch(_0x12f2b9){return BPromise[_0x3c4f('0x33')](_0x12f2b9);}return _0x39a680[_0x3c4f('0x34')]();};}function saveUpdates(_0x302c40,_0x509790){return function(_0x5dbfeb){if(_0x5dbfeb){return _0x5dbfeb[_0x3c4f('0x35')](_0x302c40)['then'](function(_0x182a43){return _0x182a43;});}return null;};}function removeEntity(_0x339d8e,_0x2a173d){return function(_0x4f5042){if(_0x4f5042){return _0x4f5042[_0x3c4f('0x36')]()[_0x3c4f('0x37')](function(){_0x339d8e[_0x3c4f('0x2a')](0xcc)[_0x3c4f('0x2b')]();});}};}function handleEntityNotFound(_0x3b6c08,_0x19867d){return function(_0x157391){if(!_0x157391){_0x3b6c08[_0x3c4f('0x38')](0x194);}return _0x157391;};}function handleError(_0x659b2a,_0x46d9b1){_0x46d9b1=_0x46d9b1||0x1f4;return function(_0x5cdedc){logger['error'](_0x5cdedc[_0x3c4f('0x39')]);if(_0x5cdedc[_0x3c4f('0x3a')]){delete _0x5cdedc[_0x3c4f('0x3a')];}_0x659b2a['status'](_0x46d9b1)[_0x3c4f('0x3b')](_0x5cdedc);};}exports[_0x3c4f('0x3c')]=function(_0x4fadad,_0x1f23de){var _0x322db0={},_0x5c32ec={},_0x2febf9={'count':0x0,'rows':[]};var _0x1a0dc6=_['map'](db[_0x3c4f('0x3d')][_0x3c4f('0x3e')],function(_0x37136a){return{'name':_0x37136a['fieldName'],'type':_0x37136a[_0x3c4f('0x3f')][_0x3c4f('0x40')]};});_0x5c32ec[_0x3c4f('0x41')]=_['map'](_0x1a0dc6,_0x3c4f('0x3a'));_0x5c32ec[_0x3c4f('0x42')]=_[_0x3c4f('0x43')](_0x4fadad[_0x3c4f('0x42')]);_0x5c32ec[_0x3c4f('0x44')]=_[_0x3c4f('0x45')](_0x5c32ec['model'],_0x5c32ec[_0x3c4f('0x42')]);_0x322db0[_0x3c4f('0x46')]=_['intersection'](_0x5c32ec[_0x3c4f('0x41')],qs['fields'](_0x4fadad[_0x3c4f('0x42')]['fields']));_0x322db0[_0x3c4f('0x46')]=_0x322db0[_0x3c4f('0x46')][_0x3c4f('0x47')]?_0x322db0[_0x3c4f('0x46')]:_0x5c32ec[_0x3c4f('0x41')];if(!_0x4fadad[_0x3c4f('0x42')]['hasOwnProperty'](_0x3c4f('0x48'))){_0x322db0[_0x3c4f('0x2e')]=qs['limit'](_0x4fadad[_0x3c4f('0x42')]['limit']);_0x322db0[_0x3c4f('0x30')]=qs[_0x3c4f('0x30')](_0x4fadad['query'][_0x3c4f('0x30')]);}_0x322db0[_0x3c4f('0x49')]=qs['sort'](_0x4fadad[_0x3c4f('0x42')][_0x3c4f('0x4a')]);_0x322db0[_0x3c4f('0x4b')]=qs[_0x3c4f('0x44')](_[_0x3c4f('0x4c')](_0x4fadad[_0x3c4f('0x42')],_0x5c32ec[_0x3c4f('0x44')]),_0x1a0dc6);if(_0x4fadad['query']['filter']){_0x322db0[_0x3c4f('0x4b')]=_[_0x3c4f('0x4d')](_0x322db0[_0x3c4f('0x4b')],{'$or':_[_0x3c4f('0x4e')](_0x1a0dc6,function(_0x5afebd){if(_0x5afebd[_0x3c4f('0x3f')]!==_0x3c4f('0x4f')){var _0x3bb45b={};_0x3bb45b[_0x5afebd[_0x3c4f('0x3a')]]={'$like':'%'+_0x4fadad['query'][_0x3c4f('0x50')]+'%'};return _0x3bb45b;}})});}_0x322db0=_[_0x3c4f('0x4d')]({},_0x322db0,_0x4fadad[_0x3c4f('0x51')]);var _0xcb45e5={'where':_0x322db0[_0x3c4f('0x4b')]};return db['OpenchannelMessage'][_0x3c4f('0x2f')](_0xcb45e5)[_0x3c4f('0x37')](function(_0x22e95b){_0x2febf9[_0x3c4f('0x2f')]=_0x22e95b;if(_0x4fadad[_0x3c4f('0x42')][_0x3c4f('0x52')]){_0x322db0[_0x3c4f('0x53')]=[{'all':!![]}];}return db[_0x3c4f('0x3d')]['findAll'](_0x322db0);})[_0x3c4f('0x37')](function(_0x7f84ea){_0x2febf9['rows']=_0x7f84ea;return _0x2febf9;})[_0x3c4f('0x37')](respondWithFilteredResult(_0x1f23de,_0x322db0))['catch'](handleError(_0x1f23de,null));};exports['show']=function(_0x398242,_0x518c12){var _0x3efa08={'raw':!![],'where':{'id':_0x398242[_0x3c4f('0x54')]['id']}},_0x300654={};_0x300654['model']=_[_0x3c4f('0x43')](db[_0x3c4f('0x3d')][_0x3c4f('0x3e')]);_0x300654[_0x3c4f('0x42')]=_[_0x3c4f('0x43')](_0x398242[_0x3c4f('0x42')]);_0x300654[_0x3c4f('0x44')]=_[_0x3c4f('0x45')](_0x300654[_0x3c4f('0x41')],_0x300654['query']);_0x3efa08[_0x3c4f('0x46')]=_[_0x3c4f('0x45')](_0x300654[_0x3c4f('0x41')],qs['fields'](_0x398242['query'][_0x3c4f('0x55')]));_0x3efa08[_0x3c4f('0x46')]=_0x3efa08[_0x3c4f('0x46')][_0x3c4f('0x47')]?_0x3efa08['attributes']:_0x300654[_0x3c4f('0x41')];if(_0x398242[_0x3c4f('0x42')][_0x3c4f('0x52')]){_0x3efa08[_0x3c4f('0x53')]=[{'all':!![]}];}_0x3efa08=_[_0x3c4f('0x4d')]({},_0x3efa08,_0x398242[_0x3c4f('0x51')]);return db[_0x3c4f('0x3d')][_0x3c4f('0x56')](_0x3efa08)[_0x3c4f('0x37')](handleEntityNotFound(_0x518c12,null))[_0x3c4f('0x37')](respondWithResult(_0x518c12,null))[_0x3c4f('0x29')](handleError(_0x518c12,null));};exports[_0x3c4f('0x57')]=function(_0x585845,_0x1f1714){return db['OpenchannelMessage'][_0x3c4f('0x57')](_0x585845['body'],{})[_0x3c4f('0x37')](respondWithResult(_0x1f1714,0xc9))[_0x3c4f('0x29')](handleError(_0x1f1714,null));};exports[_0x3c4f('0x35')]=function(_0x210171,_0x136ee9){if(_0x210171['body']['id']){delete _0x210171[_0x3c4f('0x58')]['id'];}return db[_0x3c4f('0x3d')][_0x3c4f('0x56')]({'where':{'id':_0x210171[_0x3c4f('0x54')]['id']}})['then'](handleEntityNotFound(_0x136ee9,null))[_0x3c4f('0x37')](saveUpdates(_0x210171[_0x3c4f('0x58')],null))[_0x3c4f('0x37')](respondWithResult(_0x136ee9,null))['catch'](handleError(_0x136ee9,null));};exports[_0x3c4f('0x36')]=function(_0x1840d2,_0x28d06f){return db[_0x3c4f('0x3d')]['find']({'where':{'id':_0x1840d2[_0x3c4f('0x54')]['id']}})[_0x3c4f('0x37')](handleEntityNotFound(_0x28d06f,null))['then'](removeEntity(_0x28d06f,null))[_0x3c4f('0x29')](handleError(_0x28d06f,null));};exports[_0x3c4f('0x59')]=function(_0x4ac35f,_0x46dfc8){return db[_0x3c4f('0x3d')][_0x3c4f('0x59')]()[_0x3c4f('0x37')](respondWithResult(_0x46dfc8,null))['catch'](handleError(_0x46dfc8,null));};var interaction_log=require(_0x3c4f('0x5a'))(_0x3c4f('0x5b'));exports[_0x3c4f('0x5c')]=function(_0x4ab732,_0x294573,_0x3dd543){var _0x54d37c={'agent':{},'channel':'openchannel'};if(_0x4ab732[_0x3c4f('0x58')]['id']){delete _0x4ab732['body']['id'];}_0x4ab732['body'][_0x3c4f('0x5d')]=!![];_0x4ab732[_0x3c4f('0x58')][_0x3c4f('0x5e')]=moment()[_0x3c4f('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ab732['body'][_0x3c4f('0x60')]=_0x4ab732[_0x3c4f('0x58')]['UserId']||_0x4ab732['user']['id'];_0x54d37c['agent']['id']=_0x4ab732[_0x3c4f('0x58')][_0x3c4f('0x60')];return db[_0x3c4f('0x3d')]['find']({'where':{'id':_0x4ab732['params']['id'],'UserId':null}})[_0x3c4f('0x37')](handleEntityNotFound(_0x294573,null))['then'](saveUpdates(_0x4ab732['body'],null))[_0x3c4f('0x37')](function(_0x7c44a){if(_0x7c44a){_0x54d37c['message']=_0x7c44a['get']({'plain':!![]});return db[_0x3c4f('0x61')][_0x3c4f('0x56')]({'where':{'id':_0x7c44a[_0x3c4f('0x62')]}});}return null;})[_0x3c4f('0x37')](handleEntityNotFound(_0x294573,null))[_0x3c4f('0x37')](function(_0x104867){if(_0x104867){return _0x104867[_0x3c4f('0x35')]({'UserId':_0x4ab732[_0x3c4f('0x58')][_0x3c4f('0x60')],'read1stAt':_[_0x3c4f('0x63')](_0x104867['read1stAt'])?moment()['format'](_0x3c4f('0x64')):undefined});}return null;})[_0x3c4f('0x37')](function(_0x247c03){if(_0x247c03){_0x54d37c[_0x3c4f('0x65')]=_0x247c03['get']({'plain':!![]});interaction_log[_0x3c4f('0x20')](_0x3c4f('0x66'),_0x4ab732[_0x3c4f('0x67')]['id'],_0x4ab732[_0x3c4f('0x67')]['name'],_0x4ab732[_0x3c4f('0x67')]['role'],_0x54d37c[_0x3c4f('0x65')]['id'],_0x4ab732[_0x3c4f('0x58')]?JSON[_0x3c4f('0x68')](_0x4ab732[_0x3c4f('0x58')]):_0x3c4f('0x69'));return respondWithRpcPromise(_0x3c4f('0x6a'),_0x3c4f('0x6b'),_0x54d37c);}return null;})[_0x3c4f('0x37')](function(_0x17fe45){var _0x18767f=_0x3c4f('0x6c')+_0x17fe45['message'][_0x3c4f('0x6d')];return db[_0x3c4f('0x6e')][_0x3c4f('0x42')](_0x18767f,{'type':db[_0x3c4f('0x6f')][_0x3c4f('0x70')]['SELECT'],'raw':!![]})[_0x3c4f('0x37')](function(_0x3d78c0){return _0x3d78c0;});})[_0x3c4f('0x37')](function(_0x417610){if(_0x417610){_0x54d37c['message'][_0x3c4f('0x71')]=_0x417610[0x0];if(!_0x4ab732[_0x3c4f('0x58')][_0x3c4f('0x60')])return;return db[_0x3c4f('0x72')][_0x3c4f('0x56')]({'where':{'id':_0x4ab732['body'][_0x3c4f('0x60')],'role':_0x3c4f('0x73')},'attributes':['id',_0x3c4f('0x3a'),_0x3c4f('0x74'),_0x3c4f('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x537b1e){if(!_0x537b1e)return null;_0x54d37c[_0x3c4f('0x27')][_0x3c4f('0x73')]=_0x537b1e;return _0x54d37c;})['then'](function(_0x1bbb1d){if(_0x1bbb1d){if(_0x4ab732[_0x3c4f('0x58')][_0x3c4f('0x76')]){_0x54d37c[_0x3c4f('0x27')][_0x3c4f('0x77')]=util[_0x3c4f('0x5f')](_0x3c4f('0x78'),_0x4ab732[_0x3c4f('0x67')][_0x3c4f('0x3a')]);_0x54d37c[_0x3c4f('0x27')]['channel']=_0x54d37c[_0x3c4f('0x79')];_0x54d37c[_0x3c4f('0x27')]['motionChannel']=_0x54d37c['channel'];_0x54d37c[_0x3c4f('0x27')][_0x3c4f('0x7a')]=_0x3c4f('0x5c');return respondWithRpcPromise('EventManager',_0x3c4f('0x7b'),{'event':_0x3c4f('0x7c'),'message':_0x54d37c[_0x3c4f('0x27')]},client9002)[_0x3c4f('0x37')](function(){return _0x54d37c;});}return _0x54d37c;}return null;})[_0x3c4f('0x37')](respondWithResult(_0x294573,null))[_0x3c4f('0x29')](handleError(_0x294573,null));};var interaction_log=require('../../config/logger')(_0x3c4f('0x5b'));exports['reject']=function(_0x2b4191,_0x48470e,_0x7c84de){var _0x201ed1={'agent':{},'channel':_0x3c4f('0x7d')};if(_0x2b4191['body']['id']){delete _0x2b4191[_0x3c4f('0x58')]['id'];}_0x2b4191['body'][_0x3c4f('0x60')]=_0x2b4191[_0x3c4f('0x58')]['UserId']||_0x2b4191[_0x3c4f('0x67')]['id'];_0x201ed1[_0x3c4f('0x73')]['id']=_0x2b4191[_0x3c4f('0x58')][_0x3c4f('0x60')];return db[_0x3c4f('0x3d')][_0x3c4f('0x56')]({'where':{'id':_0x2b4191[_0x3c4f('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x48470e,null))[_0x3c4f('0x37')](function(_0x1ab7ce){if(_0x1ab7ce){_0x201ed1[_0x3c4f('0x27')]=_0x1ab7ce[_0x3c4f('0x7e')]({'plain':!![]});return db[_0x3c4f('0x61')]['find']({'where':{'id':_0x1ab7ce['OpenchannelInteractionId']}});}return null;})[_0x3c4f('0x37')](handleEntityNotFound(_0x48470e,null))['then'](function(_0x3fe080){if(_0x3fe080){_0x201ed1['interaction']=_0x3fe080[_0x3c4f('0x7e')]({'plain':!![]});interaction_log[_0x3c4f('0x20')](_0x3c4f('0x7f'),_0x2b4191[_0x3c4f('0x67')]['id'],_0x2b4191['user'][_0x3c4f('0x3a')],_0x2b4191[_0x3c4f('0x67')]['role'],_0x201ed1[_0x3c4f('0x65')]['id'],_0x2b4191[_0x3c4f('0x58')]?JSON[_0x3c4f('0x68')](_0x2b4191['body']):'null');return respondWithRpcPromise(_0x3c4f('0x80'),_0x3c4f('0x81'),_0x201ed1);}return null;})['then'](function(_0x53f5d1){var _0x35e737='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x53f5d1[_0x3c4f('0x27')][_0x3c4f('0x6d')];return db[_0x3c4f('0x6e')][_0x3c4f('0x42')](_0x35e737,{'type':db[_0x3c4f('0x6f')][_0x3c4f('0x70')][_0x3c4f('0x82')],'raw':!![]})[_0x3c4f('0x37')](function(_0x199024){return _0x199024;});})[_0x3c4f('0x37')](function(_0x5aa5d8){if(_0x5aa5d8){_0x201ed1[_0x3c4f('0x27')][_0x3c4f('0x71')]=_0x5aa5d8[0x0];if(!_0x2b4191['body'][_0x3c4f('0x60')])return;return db[_0x3c4f('0x72')][_0x3c4f('0x56')]({'where':{'id':_0x2b4191[_0x3c4f('0x58')]['UserId'],'role':_0x3c4f('0x73')},'attributes':['id',_0x3c4f('0x3a'),'fullname','email',_0x3c4f('0x83')],'raw':!![]});}return null;})['then'](function(_0x5e596f){if(!_0x5e596f)return null;_0x201ed1[_0x3c4f('0x27')][_0x3c4f('0x73')]=_0x5e596f;return _0x201ed1;})[_0x3c4f('0x37')](function(_0x2eb508){if(_0x2eb508){_0x2eb508[_0x3c4f('0x27')]['interface']=util[_0x3c4f('0x5f')](_0x3c4f('0x78'),_0x2b4191['user'][_0x3c4f('0x3a')]);_0x2eb508['message'][_0x3c4f('0x79')]=_0x201ed1[_0x3c4f('0x79')];_0x2eb508['message']['motionChannel']=_0x201ed1[_0x3c4f('0x79')];_0x2eb508['message'][_0x3c4f('0x7a')]=_0x3c4f('0x33');respondWithRpcPromise(_0x3c4f('0x7b'),'EventManager',{'event':_0x3c4f('0x84'),'message':_0x2eb508[_0x3c4f('0x27')]},client9002);return _0x201ed1;}return null;})['then'](respondWithResult(_0x48470e,null))[_0x3c4f('0x29')](handleError(_0x48470e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1297528..c23699c 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 _0x076c=['events','save','update','emit','hasOwnProperty','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x076c,0x1f2));var _0xc076=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x076c[_0x5416db];return _0x243e35;};'use strict';var EventEmitter=require(_0xc076('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc076('0x1'),'afterUpdate':_0xc076('0x2'),'afterDestroy':'remove'};function emitEvent(_0x45caf4){return function(_0x55ebbf,_0x458680,_0x45cadb){OpenchannelMessageEvents[_0xc076('0x3')](_0x45caf4+':'+_0x55ebbf['id'],_0x55ebbf);OpenchannelMessageEvents['emit'](_0x45caf4,_0x55ebbf);_0x45cadb(null);};}for(var e in events){if(events[_0xc076('0x4')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xc076('0x5')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xac94=['OpenchannelMessage','setMaxListeners','save','hasOwnProperty','hook','exports','events'];(function(_0x545ac5,_0x5da192){var _0x13c202=function(_0x4e87fc){while(--_0x4e87fc){_0x545ac5['push'](_0x545ac5['shift']());}};_0x13c202(++_0x5da192);}(_0xac94,0x164));var _0x4ac9=function(_0x5b2224,_0x5f4146){_0x5b2224=_0x5b2224-0x0;var _0x4f7b51=_0xac94[_0x5b2224];return _0x4f7b51;};'use strict';var EventEmitter=require(_0x4ac9('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x4ac9('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4ac9('0x2')](0x0);var events={'afterCreate':_0x4ac9('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e6eae){return function(_0x2ca902,_0x16aaca,_0xe398ef){OpenchannelMessageEvents['emit'](_0x3e6eae+':'+_0x2ca902['id'],_0x2ca902);OpenchannelMessageEvents['emit'](_0x3e6eae,_0x2ca902);_0xe398ef(null);};}for(var e in events){if(events[_0x4ac9('0x4')](e)){var event=events[e];OpenchannelMessage[_0x4ac9('0x5')](e,emitEvent(event));}}module[_0x4ac9('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index e03ddf9..8f0c06b 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 _0x495e=['replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','POST','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','CmContact','find','OpenchannelAccountId','Interactions','Contact','keys'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x495e,0x1e6));var _0xe495=function(_0x5c814d,_0x4d81c7){_0x5c814d=_0x5c814d-0x0;var _0x89b71=_0x495e[_0x5c814d];return _0x89b71;};'use strict';var _=require(_0xe495('0x0'));var util=require(_0xe495('0x1'));var logger=require('../../config/logger')(_0xe495('0x2'));var moment=require(_0xe495('0x3'));var BPromise=require(_0xe495('0x4'));var rp=require(_0xe495('0x5'));var fs=require('fs');var path=require(_0xe495('0x6'));var rimraf=require(_0xe495('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x8c4c03,_0x29e40f){return _0x8c4c03[_0xe495('0x8')](_0xe495('0x9'),attributes,{'tableName':_0xe495('0xa'),'paranoid':![],'indexes':[{'name':_0xe495('0xb'),'fields':[_0xe495('0xc')],'type':_0xe495('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e6dfb,_0x16b6fa,_0x52cf6b){var _0x149c2e=_0x8c4c03[_0xe495('0xe')];var _0x3a45ce=_0x2e6dfb[_0xe495('0xf')]({'plain':!![]});if(_0x3a45ce[_0xe495('0x10')][_0xe495('0x11')]()==='in'||_0x3a45ce['direction'][_0xe495('0x11')]()===_0xe495('0x12')&&!_0x3a45ce[_0xe495('0x13')]&&!_[_0xe495('0x14')](_0x3a45ce[_0xe495('0x15')])){_0x149c2e[_0xe495('0x16')][_0xe495('0x17')]({'where':{'id':_0x3a45ce[_0xe495('0x18')]}})[_0xe495('0x19')](function(_0x38b728){if(_0x38b728){_0x38b728['update']({'lastMsgAt':_0x3a45ce[_0xe495('0x1a')],'lastMsgDirection':_0x3a45ce[_0xe495('0x10')][_0xe495('0x11')]()});}})[_0xe495('0x1b')](function(_0x354524){console['error'](_0x354524);});}if(_0x3a45ce[_0xe495('0x10')]==='out'&&!_0x3a45ce[_0xe495('0x13')]){var _0x28bb5f;_0x149c2e[_0xe495('0x1c')]['describe']()[_0xe495('0x19')](function(_0x12b707){return _0x149c2e['OpenchannelAccount'][_0xe495('0x1d')]({'where':{'id':_0x3a45ce[_0xe495('0x1e')]},'include':[{'model':_0x149c2e[_0xe495('0x16')],'as':_0xe495('0x1f'),'where':{'id':_0x3a45ce[_0xe495('0x18')]},'limit':0x1,'include':[{'model':_0x149c2e[_0xe495('0x1c')],'as':_0xe495('0x20'),'attributes':_[_0xe495('0x21')](_0x12b707)}]}]});})['then'](function(_0x45fd99){_0x28bb5f=_0x45fd99[_0xe495('0xf')]({'plain':!![]});if(_0x28bb5f&&_0x28bb5f[_0xe495('0x22')]){logger[_0xe495('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0xe495('0x24'),util[_0xe495('0x25')](_0xe495('0x26'),_0x3a45ce['id'],_0x28bb5f[_0xe495('0x22')]));if(_0x28bb5f['Interactions']&&_0x28bb5f['Interactions'][_0xe495('0x27')]){_0x3a45ce[_0xe495('0x28')]=_[_0xe495('0x29')](_0x28bb5f[_0xe495('0x1f')][0x0],_0xe495('0x20'));_0x3a45ce['Contact']=_0x28bb5f[_0xe495('0x1f')][0x0][_0xe495('0x20')];}var _0x16b6fa={'method':'POST','uri':encodeURI(_0x28bb5f[_0xe495('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x16b6fa[_0xe495('0x2a')]){case _0xe495('0x2b'):_0x16b6fa['qs']=_0x3a45ce;break;case _0xe495('0x2c'):_0x16b6fa['body']=_0x3a45ce;break;}return rp(_0x16b6fa)[_0xe495('0x19')](function(_0x17138a){logger['info'](_0xe495('0x2d'),_0xe495('0x24'),util['format'](_0xe495('0x2e'),_0x3a45ce['id'],_0x28bb5f['replyUri']));if(_0x17138a[_0xe495('0xc')]['threadId']&&_0x17138a['body']['threadId']!=_0x3a45ce[_0xe495('0x28')][_0xe495('0x2f')]){return _0x149c2e[_0xe495('0x16')][_0xe495('0x30')]({'threadId':_0x17138a['body']['threadId']},{'where':{'id':_0x3a45ce[_0xe495('0x28')]['id']}});}else{return;}})['then'](function(){return _0x2e6dfb[_0xe495('0x30')]({'read':!![]});})[_0xe495('0x1b')](function(_0x2a61ca){logger['error'](_0xe495('0x2d'),_0xe495('0x24'),util[_0xe495('0x31')](_0x2a61ca,{'showHidden':![],'depth':null}));_0x52cf6b();});}else{_0x52cf6b();}})[_0xe495('0x32')](function(){_0x52cf6b();});}else{_0x52cf6b();}}},'charset':'utf8mb4','collate':_0xe495('0x33')});}; \ No newline at end of file +var _0x125d=['then','createdAt','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId'];(function(_0x5d52d1,_0x2453e1){var _0x5877d4=function(_0x44d222){while(--_0x44d222){_0x5d52d1['push'](_0x5d52d1['shift']());}};_0x5877d4(++_0x2453e1);}(_0x125d,0x149));var _0xd125=function(_0x2b35a0,_0xf65192){_0x2b35a0=_0x2b35a0-0x0;var _0x4ad14a=_0x125d[_0x2b35a0];return _0x4ad14a;};'use strict';var _=require('lodash');var util=require(_0xd125('0x0'));var logger=require('../../config/logger')(_0xd125('0x1'));var moment=require('moment');var BPromise=require(_0xd125('0x2'));var rp=require(_0xd125('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd125('0x4'));var config=require(_0xd125('0x5'));var attributes=require(_0xd125('0x6'));module[_0xd125('0x7')]=function(_0x3dee70,_0x4bb711){return _0x3dee70['define']('OpenchannelMessage',attributes,{'tableName':_0xd125('0x8'),'paranoid':![],'indexes':[{'name':_0xd125('0x9'),'fields':[_0xd125('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x36fb55,_0x3c953e,_0x4d64f7){var _0x1a9e6b=_0x3dee70[_0xd125('0xb')];var _0x24e992=_0x36fb55[_0xd125('0xc')]({'plain':!![]});if(_0x24e992[_0xd125('0xd')][_0xd125('0xe')]()==='in'||_0x24e992[_0xd125('0xd')]['toLowerCase']()===_0xd125('0xf')&&!_0x24e992['secret']&&!_[_0xd125('0x10')](_0x24e992[_0xd125('0x11')])){_0x1a9e6b[_0xd125('0x12')][_0xd125('0x13')]({'where':{'id':_0x24e992[_0xd125('0x14')]}})[_0xd125('0x15')](function(_0x59fadb){if(_0x59fadb){_0x59fadb['update']({'lastMsgAt':_0x24e992[_0xd125('0x16')],'lastMsgDirection':_0x24e992[_0xd125('0xd')]['toLowerCase']()});}})['catch'](function(_0x1b2338){console[_0xd125('0x17')](_0x1b2338);});}if(_0x24e992[_0xd125('0xd')]===_0xd125('0xf')&&!_0x24e992[_0xd125('0x18')]){var _0x538466;_0x1a9e6b[_0xd125('0x19')][_0xd125('0x1a')]()[_0xd125('0x15')](function(_0x28485a){return _0x1a9e6b[_0xd125('0x1b')][_0xd125('0x1c')]({'where':{'id':_0x24e992[_0xd125('0x1d')]},'include':[{'model':_0x1a9e6b[_0xd125('0x12')],'as':_0xd125('0x1e'),'where':{'id':_0x24e992[_0xd125('0x14')]},'limit':0x1,'include':[{'model':_0x1a9e6b[_0xd125('0x19')],'as':_0xd125('0x1f'),'attributes':_[_0xd125('0x20')](_0x28485a)}]}]});})['then'](function(_0xb12707){_0x538466=_0xb12707[_0xd125('0xc')]({'plain':!![]});if(_0x538466&&_0x538466[_0xd125('0x21')]){logger['info'](_0xd125('0x22'),_0xd125('0x23'),util[_0xd125('0x24')](_0xd125('0x25'),_0x24e992['id'],_0x538466[_0xd125('0x21')]));if(_0x538466[_0xd125('0x1e')]&&_0x538466[_0xd125('0x1e')][_0xd125('0x26')]){_0x24e992[_0xd125('0x27')]=_['omit'](_0x538466['Interactions'][0x0],_0xd125('0x1f'));_0x24e992[_0xd125('0x1f')]=_0x538466['Interactions'][0x0]['Contact'];}var _0x3c953e={'method':_0xd125('0x28'),'uri':encodeURI(_0x538466['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3c953e[_0xd125('0x29')]){case'GET':_0x3c953e['qs']=_0x24e992;break;case _0xd125('0x28'):_0x3c953e[_0xd125('0xa')]=_0x24e992;break;}return rp(_0x3c953e)[_0xd125('0x15')](function(_0x278548){logger['info'](_0xd125('0x22'),_0xd125('0x23'),util[_0xd125('0x24')](_0xd125('0x2a'),_0x24e992['id'],_0x538466[_0xd125('0x21')]));if(_0x278548[_0xd125('0xa')][_0xd125('0x2b')]&&_0x278548['body'][_0xd125('0x2b')]!=_0x24e992[_0xd125('0x27')][_0xd125('0x2b')]){return _0x1a9e6b[_0xd125('0x12')]['update']({'threadId':_0x278548['body'][_0xd125('0x2b')]},{'where':{'id':_0x24e992[_0xd125('0x27')]['id']}});}else{return;}})[_0xd125('0x15')](function(){return _0x36fb55[_0xd125('0x2c')]({'read':!![]});})[_0xd125('0x2d')](function(_0x21a75c){logger[_0xd125('0x17')](_0xd125('0x22'),_0xd125('0x23'),util[_0xd125('0x2e')](_0x21a75c,{'showHidden':![],'depth':null}));_0x4d64f7();});}else{_0x4d64f7();}})[_0xd125('0x2f')](function(){_0x4d64f7();});}else{_0x4d64f7();}}},'charset':_0xd125('0x30'),'collate':_0xd125('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6d97bb5..f081229 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b00a0,_0x3430e1){var _0x3fb7ce=function(_0x5a975c){while(--_0x5a975c){_0x5b00a0['push'](_0x5b00a0['shift']());}};_0x3fb7ce(++_0x3430e1);}(_0x1261,0x144));var _0x1126=function(_0x161f03,_0x5d141b){_0x161f03=_0x161f03-0x0;var _0x2f396f=_0x1261[_0x161f03];return _0x2f396f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _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(_0x250d91,_0x423b8a){var _0x155861=function(_0x10340c){while(--_0x10340c){_0x250d91['push'](_0x250d91['shift']());}};_0x155861(++_0x423b8a);}(_0x1261,0x144));var _0x1126=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0x1261[_0x378891];return _0xfbfda2;};'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 94c188d..e1d217f 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 _0x4569=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x298c06,_0x479604){var _0x2466ea=function(_0x2bd0e4){while(--_0x2bd0e4){_0x298c06['push'](_0x298c06['shift']());}};_0x2466ea(++_0x479604);}(_0x4569,0xed));var _0x9456=function(_0x1b33fb,_0xb15df4){_0x1b33fb=_0x1b33fb-0x0;var _0xa26231=_0x4569[_0x1b33fb];return _0xa26231;};'use strict';var OpenchannelMessageEvents=require(_0x9456('0x0'));var events=[_0x9456('0x1'),_0x9456('0x2'),_0x9456('0x3')];function createListener(_0x91472,_0x6d4840){return function(_0x1bc75b){_0x6d4840[_0x9456('0x4')](_0x91472,_0x1bc75b);};}function removeListener(_0x5f084d,_0x3a0796){return function(){OpenchannelMessageEvents[_0x9456('0x5')](_0x5f084d,_0x3a0796);};}exports[_0x9456('0x6')]=function(_0x59c97e){for(var _0xf11ccc=0x0,_0x442c85=events[_0x9456('0x7')];_0xf11ccc<_0x442c85;_0xf11ccc++){var _0x545569=events[_0xf11ccc];var _0x54fb4c=createListener(_0x9456('0x8')+_0x545569,_0x59c97e);OpenchannelMessageEvents['on'](_0x545569,_0x54fb4c);}}; \ No newline at end of file +var _0x93bb=['update','emit','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x32b27e,_0x39c1de){var _0x11ed70=function(_0x394eb9){while(--_0x394eb9){_0x32b27e['push'](_0x32b27e['shift']());}};_0x11ed70(++_0x39c1de);}(_0x93bb,0x135));var _0xb93b=function(_0x114510,_0x1165d9){_0x114510=_0x114510-0x0;var _0x5913f8=_0x93bb[_0x114510];return _0x5913f8;};'use strict';var OpenchannelMessageEvents=require(_0xb93b('0x0'));var events=[_0xb93b('0x1'),_0xb93b('0x2'),_0xb93b('0x3')];function createListener(_0xef52ba,_0x9b62ab){return function(_0x3ae317){_0x9b62ab[_0xb93b('0x4')](_0xef52ba,_0x3ae317);};}function removeListener(_0x3eb285,_0x355196){return function(){OpenchannelMessageEvents['removeListener'](_0x3eb285,_0x355196);};}exports[_0xb93b('0x5')]=function(_0x1ec4dd){for(var _0x4e89c7=0x0,_0x3c4dcf=events[_0xb93b('0x6')];_0x4e89c7<_0x3c4dcf;_0x4e89c7++){var _0x516b0b=events[_0x4e89c7];var _0x35c135=createListener(_0xb93b('0x7')+_0x516b0b,_0x1ec4dd);OpenchannelMessageEvents['on'](_0x516b0b,_0x35c135);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index a1e37bb..3bcd8cc 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 _0xaea5=['isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xaea5,0x1c1));var _0x5aea=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xaea5[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x5aea('0x0'));var util=require(_0x5aea('0x1'));var path=require(_0x5aea('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5aea('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5aea('0x4'));var interaction=require(_0x5aea('0x5'));var config=require(_0x5aea('0x6'));var controller=require(_0x5aea('0x7'));router[_0x5aea('0x8')]('/',auth['isAuthenticated'](),controller[_0x5aea('0x9')]);router[_0x5aea('0x8')]('/describe',auth[_0x5aea('0xa')](),controller['describe']);router[_0x5aea('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5aea('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x5aea('0xb')]);router[_0x5aea('0x8')](_0x5aea('0xc'),auth[_0x5aea('0xa')](),controller[_0x5aea('0xd')]);router['get'](_0x5aea('0xe'),auth[_0x5aea('0xa')](),controller[_0x5aea('0xf')]);router[_0x5aea('0x10')]('/',auth[_0x5aea('0xa')](),controller['create']);router['post'](_0x5aea('0xc'),auth[_0x5aea('0xa')](),controller[_0x5aea('0x11')]);router['post']('/:id/users',auth[_0x5aea('0xa')](),controller[_0x5aea('0x12')]);router[_0x5aea('0x13')](_0x5aea('0x14'),auth['isAuthenticated'](),controller[_0x5aea('0x15')]);router[_0x5aea('0x16')](_0x5aea('0x14'),auth['isAuthenticated'](),controller[_0x5aea('0x17')]);router[_0x5aea('0x16')]('/:id/teams',auth[_0x5aea('0xa')](),controller[_0x5aea('0x18')]);router['delete'](_0x5aea('0xe'),auth['isAuthenticated'](),controller[_0x5aea('0x19')]);module[_0x5aea('0x1a')]=router; \ No newline at end of file +var _0x3b65=['show','/:id/members','getMembers','/:id/teams','/:id/users','create','post','addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0xb791ab,_0x1052fe){var _0x538832=function(_0x1026db){while(--_0x1026db){_0xb791ab['push'](_0xb791ab['shift']());}};_0x538832(++_0x1052fe);}(_0x3b65,0x1a3));var _0x53b6=function(_0xf6c699,_0x41ead6){_0xf6c699=_0xf6c699-0x0;var _0x46fbef=_0x3b65[_0xf6c699];return _0x46fbef;};'use strict';var multer=require(_0x53b6('0x0'));var util=require(_0x53b6('0x1'));var path=require(_0x53b6('0x2'));var timeout=require(_0x53b6('0x3'));var express=require(_0x53b6('0x4'));var router=express[_0x53b6('0x5')]();var fs_extra=require(_0x53b6('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x53b6('0x7'));var controller=require('./openchannelQueue.controller');router[_0x53b6('0x8')]('/',auth[_0x53b6('0x9')](),controller['index']);router[_0x53b6('0x8')](_0x53b6('0xa'),auth[_0x53b6('0x9')](),controller[_0x53b6('0xb')]);router[_0x53b6('0x8')](_0x53b6('0xc'),auth[_0x53b6('0x9')](),controller[_0x53b6('0xd')]);router[_0x53b6('0x8')](_0x53b6('0xe'),auth[_0x53b6('0x9')](),controller[_0x53b6('0xf')]);router[_0x53b6('0x8')](_0x53b6('0x10'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x53b6('0x11'),auth[_0x53b6('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x53b6('0x12')]);router[_0x53b6('0x13')](_0x53b6('0x10'),auth[_0x53b6('0x9')](),controller[_0x53b6('0x14')]);router['post']('/:id/users',auth[_0x53b6('0x9')](),controller[_0x53b6('0x15')]);router[_0x53b6('0x16')](_0x53b6('0xc'),auth['isAuthenticated'](),controller[_0x53b6('0x17')]);router[_0x53b6('0x18')](_0x53b6('0xc'),auth[_0x53b6('0x9')](),controller['destroy']);router[_0x53b6('0x18')](_0x53b6('0x10'),auth[_0x53b6('0x9')](),controller[_0x53b6('0x19')]);router[_0x53b6('0x18')](_0x53b6('0x11'),auth[_0x53b6('0x9')](),controller['removeAgents']);module[_0x53b6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 32a4b69..442d325 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 _0xa34e=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4ee949,_0x439a41){var _0x37d68f=function(_0x474369){while(--_0x474369){_0x4ee949['push'](_0x4ee949['shift']());}};_0x37d68f(++_0x439a41);}(_0xa34e,0x178));var _0xea34=function(_0x17c10a,_0xc9ee44){_0x17c10a=_0x17c10a-0x0;var _0x149440=_0xa34e[_0x17c10a];return _0x149440;};'use strict';var Sequelize=require(_0xea34('0x0'));module[_0xea34('0x1')]={'name':{'type':Sequelize[_0xea34('0x2')],'unique':_0xea34('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea34('0x2')]},'timeout':{'type':Sequelize[_0xea34('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea34('0x5')](_0xea34('0x6'),_0xea34('0x7'),_0xea34('0x8'))}}; \ No newline at end of file +var _0x5664=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x5664,0x1d4));var _0x4566=function(_0x4914ad,_0x551a18){_0x4914ad=_0x4914ad-0x0;var _0x3cd61f=_0x5664[_0x4914ad];return _0x3cd61f;};'use strict';var Sequelize=require(_0x4566('0x0'));module[_0x4566('0x1')]={'name':{'type':Sequelize[_0x4566('0x2')],'unique':_0x4566('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4566('0x2')]},'timeout':{'type':Sequelize[_0x4566('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4566('0x5')](_0x4566('0x6'),_0x4566('0x7'),_0x4566('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index d65f7fa..9e90fea 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 _0xf721=['name','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','pick','filter','where','options','OpenchannelQueue','includeAll','rows','catch','show','params','rawAttributes','include','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','describe','getMembers','hasOwnProperty','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','sequelize','each','findOrCreate','userOpenchannelQueue:save','removeTeams','findAll','select','tq.TeamId','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','emit','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','sendStatus','end','status','offset','undefined','count','set','json','apply','save','update','get','OpenchannelQueues','UserProfileResource','destroy','then','stack','index','map','fieldName','type','key','model'];(function(_0x451999,_0x1b3908){var _0x1b696e=function(_0x259ab1){while(--_0x259ab1){_0x451999['push'](_0x451999['shift']());}};_0x1b696e(++_0x1b3908);}(_0xf721,0x1ec));var _0x1f72=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0xf721[_0x25e109];return _0xc0f7d6;};'use strict';var emlformat=require(_0x1f72('0x0'));var rimraf=require(_0x1f72('0x1'));var zipdir=require(_0x1f72('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1f72('0x3'));var util=require(_0x1f72('0x4'));var path=require('path');var sox=require(_0x1f72('0x5'));var csv=require(_0x1f72('0x6'));var ejs=require(_0x1f72('0x7'));var fs=require('fs');var fs_extra=require(_0x1f72('0x8'));var _=require(_0x1f72('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1f72('0xa'));var deskjs=require(_0x1f72('0xb'));var toCsv=require(_0x1f72('0x6'));var querystring=require(_0x1f72('0xc'));var Papa=require('papaparse');var Redis=require(_0x1f72('0xd'));var authService=require(_0x1f72('0xe'));var qs=require(_0x1f72('0xf'));var as=require(_0x1f72('0x10'));var hardwareService=require(_0x1f72('0x11'));var logger=require(_0x1f72('0x12'))(_0x1f72('0x13'));var utils=require(_0x1f72('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1f72('0x15'));var db=require(_0x1f72('0x16'))['db'];config[_0x1f72('0x17')]=_['defaults'](config[_0x1f72('0x17')],{'host':_0x1f72('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x1b1518,_0x27cae2){_0x27cae2=_0x27cae2||0xcc;return function(_0x1ce52c){if(_0x1ce52c){return _0x1b1518[_0x1f72('0x19')](_0x27cae2);}return _0x1b1518['status'](_0x27cae2)[_0x1f72('0x1a')]();};}function respondWithResult(_0x4e12b4,_0x9367e4){_0x9367e4=_0x9367e4||0xc8;return function(_0x1bfdbf){if(_0x1bfdbf){return _0x4e12b4[_0x1f72('0x1b')](_0x9367e4)['json'](_0x1bfdbf);}};}function respondWithFilteredResult(_0x3633c0,_0x423e7b){return function(_0x2c84f9){if(_0x2c84f9){var _0x2e3313=typeof _0x423e7b[_0x1f72('0x1c')]===_0x1f72('0x1d')&&typeof _0x423e7b['limit']==='undefined';var _0x15335a=_0x2c84f9[_0x1f72('0x1e')];var _0x158cb8=_0x2e3313?0x0:_0x423e7b[_0x1f72('0x1c')];var _0x2c7c89=_0x2e3313?_0x2c84f9[_0x1f72('0x1e')]:_0x423e7b['offset']+_0x423e7b['limit'];var _0x56efec;if(_0x2c7c89>=_0x15335a){_0x2c7c89=_0x15335a;_0x56efec=0xc8;}else{_0x56efec=0xce;}_0x3633c0['status'](_0x56efec);return _0x3633c0[_0x1f72('0x1f')]('Content-Range',_0x158cb8+'-'+_0x2c7c89+'/'+_0x15335a)[_0x1f72('0x20')](_0x2c84f9);}return null;};}function patchUpdates(_0x7a301c){return function(_0x272f55){try{jsonpatch[_0x1f72('0x21')](_0x272f55,_0x7a301c,!![]);}catch(_0x4369a6){return BPromise['reject'](_0x4369a6);}return _0x272f55[_0x1f72('0x22')]();};}function saveUpdates(_0x48bde3,_0x3c0be5){return function(_0x31f19f){if(_0x31f19f){return _0x31f19f[_0x1f72('0x23')](_0x48bde3)['then'](function(_0x48c40d){return _0x48c40d;});}return null;};}function removeEntity(_0xe414b6,_0x358c75){return function(_0x2255a7){if(_0x2255a7){return _0x2255a7['destroy']()['then'](function(){var _0x3b1fe7=_0x2255a7[_0x1f72('0x24')]({'plain':!![]});var _0x4360b8=_0x1f72('0x25');return db[_0x1f72('0x26')][_0x1f72('0x27')]({'where':{'type':_0x4360b8,'resourceId':_0x3b1fe7['id']}})[_0x1f72('0x28')](function(){return _0x2255a7;});})[_0x1f72('0x28')](function(){_0xe414b6[_0x1f72('0x1b')](0xcc)[_0x1f72('0x1a')]();});}};}function handleEntityNotFound(_0x21cb8f,_0x9ef45b){return function(_0x4c4e41){if(!_0x4c4e41){_0x21cb8f[_0x1f72('0x19')](0x194);}return _0x4c4e41;};}function handleError(_0x193bf6,_0x8f362d){_0x8f362d=_0x8f362d||0x1f4;return function(_0x3390cf){logger['error'](_0x3390cf[_0x1f72('0x29')]);if(_0x3390cf['name']){delete _0x3390cf['name'];}_0x193bf6['status'](_0x8f362d)['send'](_0x3390cf);};}exports[_0x1f72('0x2a')]=function(_0x1010a8,_0x3d362d){var _0x56a898={},_0x3364ac={},_0xedab3f={'count':0x0,'rows':[]};var _0x4c8670=_[_0x1f72('0x2b')](db['OpenchannelQueue']['rawAttributes'],function(_0x4dfc2b){return{'name':_0x4dfc2b[_0x1f72('0x2c')],'type':_0x4dfc2b[_0x1f72('0x2d')][_0x1f72('0x2e')]};});_0x3364ac[_0x1f72('0x2f')]=_[_0x1f72('0x2b')](_0x4c8670,_0x1f72('0x30'));_0x3364ac['query']=_[_0x1f72('0x31')](_0x1010a8[_0x1f72('0x32')]);_0x3364ac['filters']=_[_0x1f72('0x33')](_0x3364ac[_0x1f72('0x2f')],_0x3364ac[_0x1f72('0x32')]);_0x56a898[_0x1f72('0x34')]=_['intersection'](_0x3364ac[_0x1f72('0x2f')],qs[_0x1f72('0x35')](_0x1010a8[_0x1f72('0x32')][_0x1f72('0x35')]));_0x56a898[_0x1f72('0x34')]=_0x56a898[_0x1f72('0x34')][_0x1f72('0x36')]?_0x56a898[_0x1f72('0x34')]:_0x3364ac[_0x1f72('0x2f')];if(!_0x1010a8[_0x1f72('0x32')]['hasOwnProperty'](_0x1f72('0x37'))){_0x56a898[_0x1f72('0x38')]=qs[_0x1f72('0x38')](_0x1010a8['query'][_0x1f72('0x38')]);_0x56a898['offset']=qs[_0x1f72('0x1c')](_0x1010a8[_0x1f72('0x32')][_0x1f72('0x1c')]);}_0x56a898[_0x1f72('0x39')]=qs[_0x1f72('0x3a')](_0x1010a8[_0x1f72('0x32')][_0x1f72('0x3a')]);_0x56a898['where']=qs[_0x1f72('0x3b')](_[_0x1f72('0x3c')](_0x1010a8['query'],_0x3364ac[_0x1f72('0x3b')]),_0x4c8670);if(_0x1010a8['query'][_0x1f72('0x3d')]){_0x56a898[_0x1f72('0x3e')]=_['merge'](_0x56a898[_0x1f72('0x3e')],{'$or':_[_0x1f72('0x2b')](_0x4c8670,function(_0x234241){if(_0x234241[_0x1f72('0x2d')]!=='VIRTUAL'){var _0x5ec9ef={};_0x5ec9ef[_0x234241[_0x1f72('0x30')]]={'$like':'%'+_0x1010a8['query']['filter']+'%'};return _0x5ec9ef;}})});}_0x56a898=_['merge']({},_0x56a898,_0x1010a8[_0x1f72('0x3f')]);var _0x433200={'where':_0x56a898[_0x1f72('0x3e')]};return db[_0x1f72('0x40')][_0x1f72('0x1e')](_0x433200)['then'](function(_0x21a8e0){_0xedab3f[_0x1f72('0x1e')]=_0x21a8e0;if(_0x1010a8[_0x1f72('0x32')][_0x1f72('0x41')]){_0x56a898['include']=[{'all':!![]}];}return db[_0x1f72('0x40')]['findAll'](_0x56a898);})['then'](function(_0x59f95d){_0xedab3f[_0x1f72('0x42')]=_0x59f95d;return _0xedab3f;})[_0x1f72('0x28')](respondWithFilteredResult(_0x3d362d,_0x56a898))[_0x1f72('0x43')](handleError(_0x3d362d,null));};exports[_0x1f72('0x44')]=function(_0x11d916,_0x5d7911){var _0x25b262={'raw':!![],'where':{'id':_0x11d916[_0x1f72('0x45')]['id']}},_0x5ae959={};_0x5ae959['model']=_['keys'](db[_0x1f72('0x40')][_0x1f72('0x46')]);_0x5ae959['query']=_[_0x1f72('0x31')](_0x11d916[_0x1f72('0x32')]);_0x5ae959['filters']=_[_0x1f72('0x33')](_0x5ae959[_0x1f72('0x2f')],_0x5ae959[_0x1f72('0x32')]);_0x25b262[_0x1f72('0x34')]=_[_0x1f72('0x33')](_0x5ae959[_0x1f72('0x2f')],qs[_0x1f72('0x35')](_0x11d916['query'][_0x1f72('0x35')]));_0x25b262[_0x1f72('0x34')]=_0x25b262[_0x1f72('0x34')][_0x1f72('0x36')]?_0x25b262['attributes']:_0x5ae959[_0x1f72('0x2f')];if(_0x11d916[_0x1f72('0x32')][_0x1f72('0x41')]){_0x25b262[_0x1f72('0x47')]=[{'all':!![]}];}_0x25b262=_[_0x1f72('0x48')]({},_0x25b262,_0x11d916['options']);return db[_0x1f72('0x40')]['find'](_0x25b262)[_0x1f72('0x28')](handleEntityNotFound(_0x5d7911,null))[_0x1f72('0x28')](respondWithResult(_0x5d7911,null))[_0x1f72('0x43')](handleError(_0x5d7911,null));};exports[_0x1f72('0x49')]=function(_0x4df6c8,_0x556dbf){return db[_0x1f72('0x40')][_0x1f72('0x49')](_0x4df6c8[_0x1f72('0x4a')],{})[_0x1f72('0x28')](function(_0x692a6c){var _0x2af86d=_0x4df6c8[_0x1f72('0x4b')][_0x1f72('0x24')]({'plain':!![]});if(!_0x2af86d)throw new Error(_0x1f72('0x4c'));if(_0x2af86d['role']==='user'){var _0x5c3fa9=_0x692a6c[_0x1f72('0x24')]({'plain':!![]});var _0x319456=_0x1f72('0x25');return db[_0x1f72('0x4d')][_0x1f72('0x4e')]({'where':{'name':_0x319456,'userProfileId':_0x2af86d[_0x1f72('0x4f')]},'raw':!![]})[_0x1f72('0x28')](function(_0x482544){if(_0x482544&&_0x482544[_0x1f72('0x50')]===0x0){return db[_0x1f72('0x26')][_0x1f72('0x49')]({'name':_0x5c3fa9[_0x1f72('0x30')],'resourceId':_0x5c3fa9['id'],'type':_0x482544[_0x1f72('0x30')],'sectionId':_0x482544['id']},{})[_0x1f72('0x28')](function(){return _0x692a6c;});}else{return _0x692a6c;}})[_0x1f72('0x43')](function(_0x112f49){logger[_0x1f72('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x112f49);throw _0x112f49;});}return _0x692a6c;})['then'](respondWithResult(_0x556dbf,0xc9))[_0x1f72('0x43')](handleError(_0x556dbf,null));};exports['update']=function(_0x1f4f2a,_0x3faf29){if(_0x1f4f2a[_0x1f72('0x4a')]['id']){delete _0x1f4f2a[_0x1f72('0x4a')]['id'];}return db[_0x1f72('0x40')][_0x1f72('0x4e')]({'where':{'id':_0x1f4f2a[_0x1f72('0x45')]['id']}})[_0x1f72('0x28')](handleEntityNotFound(_0x3faf29,null))['then'](saveUpdates(_0x1f4f2a[_0x1f72('0x4a')],null))['then'](respondWithResult(_0x3faf29,null))['catch'](handleError(_0x3faf29,null));};exports['destroy']=function(_0x2e7876,_0x30ae6b){return db[_0x1f72('0x40')][_0x1f72('0x4e')]({'where':{'id':_0x2e7876[_0x1f72('0x45')]['id']}})[_0x1f72('0x28')](handleEntityNotFound(_0x30ae6b,null))[_0x1f72('0x28')](removeEntity(_0x30ae6b,null))['catch'](handleError(_0x30ae6b,null));};exports[_0x1f72('0x52')]=function(_0x1e8211,_0x54d037){return db[_0x1f72('0x40')][_0x1f72('0x52')]()[_0x1f72('0x28')](respondWithResult(_0x54d037,null))[_0x1f72('0x43')](handleError(_0x54d037,null));};exports[_0x1f72('0x53')]=function(_0x21d0bd,_0x4ff571,_0x358348){var _0x41f8e2={'raw':!![],'where':{}},_0x3f2190={},_0x3f0faf;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x21d0bd[_0x1f72('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ff571,null))[_0x1f72('0x28')](function(_0xca5a8b){if(_0xca5a8b){_0x3f0faf=_0xca5a8b[_0x1f72('0x24')]({'plain':!![]});_0x3f2190['model']=_['keys'](db['UserOpenchannelQueue'][_0x1f72('0x46')]);_0x3f2190[_0x1f72('0x32')]=_[_0x1f72('0x31')](_0x21d0bd[_0x1f72('0x32')]);_0x3f2190['filters']=_[_0x1f72('0x33')](_0x3f2190[_0x1f72('0x2f')],_0x3f2190[_0x1f72('0x32')]);_0x41f8e2['attributes']=_[_0x1f72('0x33')](_0x3f2190['model'],qs[_0x1f72('0x35')](_0x21d0bd[_0x1f72('0x32')][_0x1f72('0x35')]));_0x41f8e2['attributes']=_0x41f8e2[_0x1f72('0x34')]['length']?_0x41f8e2[_0x1f72('0x34')]:_0x3f2190['model'];if(!_0x21d0bd['query'][_0x1f72('0x54')](_0x1f72('0x37'))){_0x41f8e2[_0x1f72('0x38')]=qs[_0x1f72('0x38')](_0x21d0bd[_0x1f72('0x32')]['limit']);_0x41f8e2[_0x1f72('0x1c')]=qs['offset'](_0x21d0bd[_0x1f72('0x32')][_0x1f72('0x1c')]);}_0x41f8e2['order']=qs[_0x1f72('0x3a')](_0x21d0bd[_0x1f72('0x32')][_0x1f72('0x3a')]);_0x41f8e2['where']=qs[_0x1f72('0x3b')](_[_0x1f72('0x3c')](_0x21d0bd[_0x1f72('0x32')],_0x3f2190['filters']));_0x41f8e2[_0x1f72('0x3e')][_0x1f72('0x55')]=_0xca5a8b['id'];if(_0x21d0bd[_0x1f72('0x32')][_0x1f72('0x3d')]){_0x41f8e2[_0x1f72('0x3e')]=_[_0x1f72('0x48')](_0x41f8e2[_0x1f72('0x3e')],{'$or':_['map'](_0x41f8e2['attributes'],function(_0x2eb0e7){var _0x17baf1={};_0x17baf1[_0x2eb0e7]={'$like':'%'+_0x21d0bd[_0x1f72('0x32')][_0x1f72('0x3d')]+'%'};return _0x17baf1;})});}_0x41f8e2=_[_0x1f72('0x48')]({},_0x41f8e2,_0x21d0bd[_0x1f72('0x3f')]);return db[_0x1f72('0x56')]['findAll'](_0x41f8e2);}})[_0x1f72('0x28')](function(_0x111b02){if(_0x111b02){return db[_0x1f72('0x57')][_0x1f72('0x58')]({'where':{'id':_[_0x1f72('0x2b')](_0x111b02,_0x1f72('0x59')),'role':_0x1f72('0x5a')},'attributes':['id',_0x1f72('0x30'),_0x1f72('0x5b'),_0x1f72('0x5c'),_0x1f72('0x5d')]});}})['then'](function(_0x2aafd5){if(_0x2aafd5){return{'count':_0x2aafd5[_0x1f72('0x1e')],'rows':_['map'](_0x2aafd5[_0x1f72('0x42')],function(_0x4e38d7){return{'membername':_0x4e38d7[_0x1f72('0x30')],'UserId':_0x4e38d7['id'],'queue_name':_0x3f0faf['name'],'OpenchannelQueueId':_0x3f0faf['id'],'interface':util[_0x1f72('0x5e')]('%s/%s',_0x1f72('0x5f'),_0x4e38d7[_0x1f72('0x30')]),'penalty':0x0,'paused':_0x4e38d7[_0x1f72('0x5b')],'createdAt':_0x4e38d7[_0x1f72('0x5d')],'updatedAt':_0x4e38d7[_0x1f72('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1f72('0x28')](respondWithFilteredResult(_0x4ff571,_0x41f8e2))[_0x1f72('0x43')](handleError(_0x4ff571,null));};exports[_0x1f72('0x60')]=function(_0x1ed0b7,_0x5da97c,_0x3058a7){var _0x288659={};var _0x53deec={};var _0x36d046;var _0x303743;return db[_0x1f72('0x40')]['findOne']({'where':{'id':_0x1ed0b7[_0x1f72('0x45')]['id']}})['then'](handleEntityNotFound(_0x5da97c,null))[_0x1f72('0x28')](function(_0x43d86a){if(_0x43d86a){_0x36d046=_0x43d86a;_0x53deec[_0x1f72('0x2f')]=_['keys'](db['Team'][_0x1f72('0x46')]);_0x53deec[_0x1f72('0x32')]=_[_0x1f72('0x31')](_0x1ed0b7['query']);_0x53deec['filters']=_[_0x1f72('0x33')](_0x53deec['model'],_0x53deec['query']);_0x288659[_0x1f72('0x34')]=_['intersection'](_0x53deec['model'],qs[_0x1f72('0x35')](_0x1ed0b7['query'][_0x1f72('0x35')]));_0x288659[_0x1f72('0x34')]=_0x288659[_0x1f72('0x34')]['length']?_0x288659['attributes']:_0x53deec[_0x1f72('0x2f')];_0x288659[_0x1f72('0x39')]=qs[_0x1f72('0x3a')](_0x1ed0b7[_0x1f72('0x32')][_0x1f72('0x3a')]);_0x288659[_0x1f72('0x3e')]=qs['filters'](_[_0x1f72('0x3c')](_0x1ed0b7[_0x1f72('0x32')],_0x53deec['filters']));if(_0x1ed0b7['query'][_0x1f72('0x3d')]){_0x288659[_0x1f72('0x3e')]=_[_0x1f72('0x48')](_0x288659[_0x1f72('0x3e')],{'$or':_[_0x1f72('0x2b')](_0x288659['attributes'],function(_0x57f53e){var _0x1a439f={};_0x1a439f[_0x57f53e]={'$like':'%'+_0x1ed0b7[_0x1f72('0x32')][_0x1f72('0x3d')]+'%'};return _0x1a439f;})});}_0x288659=_[_0x1f72('0x48')]({},_0x288659,_0x1ed0b7[_0x1f72('0x3f')]);return _0x36d046['getTeams'](_0x288659);}})[_0x1f72('0x28')](function(_0x453e44){if(_0x453e44){_0x303743=_0x453e44[_0x1f72('0x36')];if(!_0x1ed0b7[_0x1f72('0x32')][_0x1f72('0x54')]('nolimit')){_0x288659['limit']=qs[_0x1f72('0x38')](_0x1ed0b7[_0x1f72('0x32')]['limit']);_0x288659[_0x1f72('0x1c')]=qs[_0x1f72('0x1c')](_0x1ed0b7[_0x1f72('0x32')][_0x1f72('0x1c')]);}return _0x36d046[_0x1f72('0x60')](_0x288659);}})[_0x1f72('0x28')](function(_0x247a36){if(_0x247a36){return _0x247a36?{'count':_0x303743,'rows':_0x247a36}:null;}})[_0x1f72('0x28')](respondWithResult(_0x5da97c,null))[_0x1f72('0x43')](handleError(_0x5da97c,null));};exports[_0x1f72('0x61')]=function(_0x4686e5,_0x1d689d,_0x21f4d4){var _0x24019c=_0x4686e5[_0x1f72('0x4a')][_0x1f72('0x62')];return db[_0x1f72('0x63')]['findAll']({'where':{'id':_0x24019c},'attributes':['id'],'include':[{'model':db[_0x1f72('0x57')],'as':_0x1f72('0x64'),'attributes':['id','name','online',_0x1f72('0x65'),_0x1f72('0x66')],'raw':!![]}]})[_0x1f72('0x28')](function(_0x775246){if(_0x775246){var _0x2b5f9f=_['flatMap'](_0x775246,function(_0xe464c3){var _0x536bdc=_0xe464c3[_0x1f72('0x24')]({'plain':!![]});return _0x536bdc[_0x1f72('0x64')];});return db[_0x1f72('0x40')]['find']({'where':{'id':_0x4686e5[_0x1f72('0x45')]['id']}})[_0x1f72('0x28')](function(_0x298a6f){return db[_0x1f72('0x67')]['transaction'](function(_0x450760){return _0x298a6f[_0x1f72('0x61')](_0x24019c,{'transaction':_0x450760})['then'](function(){return BPromise[_0x1f72('0x68')](_0x2b5f9f,function(_0x52569a){return db['UserOpenchannelQueue'][_0x1f72('0x69')]({'where':{'UserId':_0x52569a['id'],'OpenchannelQueueId':_0x4686e5[_0x1f72('0x45')]['id']},'transaction':_0x450760});});})[_0x1f72('0x28')](function(){_0x2b5f9f['forEach'](function(_0x446860){socket['emit'](_0x1f72('0x6a'),{'UserId':_0x446860['id'],'OpenchannelQueueId':_0x298a6f['id']});});});});});}})['then'](respondWithStatusCode(_0x1d689d,null))[_0x1f72('0x43')](handleError(_0x1d689d,null));};exports[_0x1f72('0x6b')]=function(_0x39359c,_0x281f9a,_0x292562){return db['Team'][_0x1f72('0x6c')]({'where':{'id':_0x39359c[_0x1f72('0x32')][_0x1f72('0x62')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1f72('0x64'),'attributes':['id'],'raw':!![]}]})[_0x1f72('0x28')](handleEntityNotFound(_0x281f9a,null))[_0x1f72('0x28')](function(_0x2f2993){var _0x299b92=_[_0x1f72('0x2b')](_0x2f2993,'id');var _0x241855=[];var _0x305799=[];var _0x398a70=squel[_0x1f72('0x6d')]();_0x398a70['field'](_0x1f72('0x6e'))[_0x1f72('0x6f')](_0x1f72('0x70'),'tq')['join']('user_has_teams','ut',_0x1f72('0x71'))['where']('OpenchannelQueueId\x20=\x20?',_0x39359c[_0x1f72('0x45')]['id']);for(var _0x4426e9=0x0;_0x4426e9<_0x2f2993[_0x1f72('0x36')];_0x4426e9+=0x1){let _0x68ebad=_0x2f2993[_0x4426e9];for(var _0xb45a06=0x0;_0xb45a06<_0x68ebad[_0x1f72('0x64')]['length'];_0xb45a06+=0x1){let _0x4d01d5=_0x68ebad[_0x1f72('0x64')][_0xb45a06];var _0x3efd57=_0x398a70[_0x1f72('0x72')]();_0x3efd57[_0x1f72('0x3e')](_0x1f72('0x73'),_0x4d01d5['id']);_0x305799[_0x1f72('0x74')](db[_0x1f72('0x67')][_0x1f72('0x32')](_0x3efd57[_0x1f72('0x75')](),{'type':db[_0x1f72('0x67')][_0x1f72('0x76')][_0x1f72('0x77')]})[_0x1f72('0x28')](function(_0x49a102){if(_0x49a102['length']===0x1){return _0x4d01d5['id'];}else{var _0x396522=_[_0x1f72('0x78')](_[_0x1f72('0x2b')](_0x49a102,_0x1f72('0x79')),function(_0x48eebd){return _[_0x1f72('0x7a')](_0x299b92,_0x48eebd);});if(_0x396522){return _0x4d01d5['id'];}}}));}}return BPromise[_0x1f72('0x7b')](_0x305799)[_0x1f72('0x28')](function(_0x151035){_0x241855=_(_0x241855)[_0x1f72('0x7c')](_0x151035)[_0x1f72('0x7d')]()['value']();return db['OpenchannelQueue'][_0x1f72('0x4e')]({'where':{'id':_0x39359c[_0x1f72('0x45')]['id']}})[_0x1f72('0x28')](function(_0x6bd934){return db[_0x1f72('0x67')]['transaction'](function(_0x269916){return _0x6bd934[_0x1f72('0x6b')](_0x39359c[_0x1f72('0x32')]['ids'],{'transaction':_0x269916})[_0x1f72('0x28')](function(){if(!_[_0x1f72('0x7e')](_0x241855)){return _0x6bd934[_0x1f72('0x7f')](_0x241855,{'transaction':_0x269916});}})[_0x1f72('0x28')](function(){_0x241855[_0x1f72('0x80')](function(_0x4a7f63){socket[_0x1f72('0x81')](_0x1f72('0x82'),{'UserId':_0x4a7f63,'OpenchannelQueueId':_0x6bd934['id']});});});});});});})[_0x1f72('0x28')](respondWithStatusCode(_0x281f9a,null))[_0x1f72('0x43')](handleError(_0x281f9a,null));};exports['addAgents']=function(_0x50437b,_0x1590e9,_0x3a5a9e){return db[_0x1f72('0x40')][_0x1f72('0x4e')]({'where':{'id':_0x50437b[_0x1f72('0x45')]['id']}})[_0x1f72('0x28')](handleEntityNotFound(_0x1590e9,null))['then'](function(_0x3c0ed3){if(_0x3c0ed3){return _0x3c0ed3[_0x1f72('0x83')](_0x50437b['body']['ids'],_['omit'](_0x50437b[_0x1f72('0x4a')],['ids','id'])||{})[_0x1f72('0x84')](function(_0x119911){for(var _0x280b66=0x0;_0x280b66<_0x50437b[_0x1f72('0x4a')][_0x1f72('0x62')][_0x1f72('0x36')];_0x280b66+=0x1){socket[_0x1f72('0x81')](_0x1f72('0x6a'),{'UserId':Number(_0x50437b[_0x1f72('0x4a')]['ids'][_0x280b66]),'OpenchannelQueueId':Number(_0x50437b[_0x1f72('0x45')]['id'])});}return _0x119911;});}})[_0x1f72('0x28')](respondWithResult(_0x1590e9,null))[_0x1f72('0x43')](handleError(_0x1590e9,null));};exports[_0x1f72('0x7f')]=function(_0x334f17,_0x35ca9f,_0x378b09){return db[_0x1f72('0x40')][_0x1f72('0x4e')]({'where':{'id':_0x334f17[_0x1f72('0x45')]['id']}})[_0x1f72('0x28')](handleEntityNotFound(_0x35ca9f,null))[_0x1f72('0x28')](function(_0x20d3f5){if(_0x20d3f5){return _0x20d3f5[_0x1f72('0x7f')](_0x334f17[_0x1f72('0x32')][_0x1f72('0x62')])[_0x1f72('0x28')](function(){if(_[_0x1f72('0x85')](_0x334f17[_0x1f72('0x32')]['ids'])){for(var _0x494242=0x0;_0x494242<_0x334f17[_0x1f72('0x32')][_0x1f72('0x62')][_0x1f72('0x36')];_0x494242+=0x1){socket[_0x1f72('0x81')](_0x1f72('0x82'),{'UserId':Number(_0x334f17[_0x1f72('0x32')]['ids'][_0x494242]),'OpenchannelQueueId':Number(_0x334f17[_0x1f72('0x45')]['id'])});}}else{socket['emit'](_0x1f72('0x82'),{'UserId':Number(_0x334f17[_0x1f72('0x32')]['ids']),'OpenchannelQueueId':Number(_0x334f17[_0x1f72('0x45')]['id'])});}});}})[_0x1f72('0x28')](respondWithStatusCode(_0x35ca9f,null))[_0x1f72('0x43')](handleError(_0x35ca9f,null));};exports[_0x1f72('0x86')]=function(_0x419be5,_0x37b19d,_0xba914d){var _0x57d892={};var _0x55b8e5={};var _0x1b2212;var _0x37f235;return db[_0x1f72('0x40')]['findOne']({'where':{'id':_0x419be5[_0x1f72('0x45')]['id']}})['then'](handleEntityNotFound(_0x37b19d,null))[_0x1f72('0x28')](function(_0x5617b9){if(_0x5617b9){_0x1b2212=_0x5617b9;_0x55b8e5[_0x1f72('0x2f')]=_['keys'](db[_0x1f72('0x57')][_0x1f72('0x46')]);_0x55b8e5['query']=_[_0x1f72('0x31')](_0x419be5[_0x1f72('0x32')]);_0x55b8e5[_0x1f72('0x3b')]=_['intersection'](_0x55b8e5[_0x1f72('0x2f')],_0x55b8e5[_0x1f72('0x32')]);_0x57d892[_0x1f72('0x34')]=_[_0x1f72('0x33')](_0x55b8e5[_0x1f72('0x2f')],qs['fields'](_0x419be5[_0x1f72('0x32')][_0x1f72('0x35')]));_0x57d892[_0x1f72('0x34')]=_0x57d892[_0x1f72('0x34')][_0x1f72('0x36')]?_0x57d892[_0x1f72('0x34')]:_0x55b8e5[_0x1f72('0x2f')];_0x57d892[_0x1f72('0x39')]=qs[_0x1f72('0x3a')](_0x419be5[_0x1f72('0x32')][_0x1f72('0x3a')]);_0x57d892[_0x1f72('0x3e')]=qs[_0x1f72('0x3b')](_['pick'](_0x419be5[_0x1f72('0x32')],_0x55b8e5[_0x1f72('0x3b')]));if(_0x419be5[_0x1f72('0x32')][_0x1f72('0x3d')]){_0x57d892['where']=_['merge'](_0x57d892[_0x1f72('0x3e')],{'$or':_[_0x1f72('0x2b')](_0x57d892[_0x1f72('0x34')],function(_0x4d6d5d){var _0x185628={};_0x185628[_0x4d6d5d]={'$like':'%'+_0x419be5[_0x1f72('0x32')][_0x1f72('0x3d')]+'%'};return _0x185628;})});}_0x57d892=_[_0x1f72('0x48')]({},_0x57d892,_0x419be5[_0x1f72('0x3f')]);return _0x1b2212[_0x1f72('0x86')](_0x57d892);}})[_0x1f72('0x28')](function(_0x5d22c3){if(_0x5d22c3){_0x37f235=_0x5d22c3[_0x1f72('0x36')];if(!_0x419be5[_0x1f72('0x32')][_0x1f72('0x54')](_0x1f72('0x37'))){_0x57d892[_0x1f72('0x38')]=qs[_0x1f72('0x38')](_0x419be5[_0x1f72('0x32')][_0x1f72('0x38')]);_0x57d892[_0x1f72('0x1c')]=qs['offset'](_0x419be5[_0x1f72('0x32')]['offset']);}return _0x1b2212[_0x1f72('0x86')](_0x57d892);}})[_0x1f72('0x28')](function(_0x4daaa9){if(_0x4daaa9){return _0x4daaa9?{'count':_0x37f235,'rows':_0x4daaa9}:null;}})['then'](respondWithResult(_0x37b19d,null))[_0x1f72('0x43')](handleError(_0x37b19d,null));}; \ No newline at end of file +var _0x0ed2=['fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','name','options','include','findAll','rows','show','params','keys','intersection','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','findOne','rawAttributes','User','findAndCountAll','UserId','createdAt','format','%s/%s','openchannelPause','updatedAt','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','compact','value','removeTeams','ids','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','send','index','map','OpenchannelQueue'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x0ed2,0x171));var _0x20ed=function(_0x86c887,_0x5cff86){_0x86c887=_0x86c887-0x0;var _0x2d328d=_0x0ed2[_0x86c887];return _0x2d328d;};'use strict';var emlformat=require(_0x20ed('0x0'));var rimraf=require(_0x20ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x20ed('0x2'));var moment=require('moment');var BPromise=require(_0x20ed('0x3'));var Mustache=require(_0x20ed('0x4'));var util=require(_0x20ed('0x5'));var path=require(_0x20ed('0x6'));var sox=require(_0x20ed('0x7'));var csv=require(_0x20ed('0x8'));var ejs=require(_0x20ed('0x9'));var fs=require('fs');var fs_extra=require(_0x20ed('0xa'));var _=require(_0x20ed('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x20ed('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x20ed('0x8'));var querystring=require(_0x20ed('0xd'));var Papa=require('papaparse');var Redis=require(_0x20ed('0xe'));var authService=require(_0x20ed('0xf'));var qs=require(_0x20ed('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20ed('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x20ed('0x12'));var config=require(_0x20ed('0x13'));var licenseUtil=require(_0x20ed('0x14'));var db=require(_0x20ed('0x15'))['db'];config[_0x20ed('0x16')]=_[_0x20ed('0x17')](config[_0x20ed('0x16')],{'host':_0x20ed('0x18'),'port':0x18eb});var socket=require(_0x20ed('0x19'))(new Redis(config[_0x20ed('0x16')]));require(_0x20ed('0x1a'))[_0x20ed('0x1b')](socket);function respondWithStatusCode(_0x54d679,_0x4c3d7b){_0x4c3d7b=_0x4c3d7b||0xcc;return function(_0x398b0b){if(_0x398b0b){return _0x54d679[_0x20ed('0x1c')](_0x4c3d7b);}return _0x54d679[_0x20ed('0x1d')](_0x4c3d7b)[_0x20ed('0x1e')]();};}function respondWithResult(_0x21dfc5,_0x4bf43b){_0x4bf43b=_0x4bf43b||0xc8;return function(_0x257c2c){if(_0x257c2c){return _0x21dfc5[_0x20ed('0x1d')](_0x4bf43b)[_0x20ed('0x1f')](_0x257c2c);}};}function respondWithFilteredResult(_0x277ac6,_0x200648){return function(_0x1904a7){if(_0x1904a7){var _0x41dc2c=typeof _0x200648['offset']===_0x20ed('0x20')&&typeof _0x200648['limit']===_0x20ed('0x20');var _0x2711f9=_0x1904a7['count'];var _0xb5ac17=_0x41dc2c?0x0:_0x200648[_0x20ed('0x21')];var _0x191496=_0x41dc2c?_0x1904a7[_0x20ed('0x22')]:_0x200648[_0x20ed('0x21')]+_0x200648[_0x20ed('0x23')];var _0x307490;if(_0x191496>=_0x2711f9){_0x191496=_0x2711f9;_0x307490=0xc8;}else{_0x307490=0xce;}_0x277ac6[_0x20ed('0x1d')](_0x307490);return _0x277ac6[_0x20ed('0x24')](_0x20ed('0x25'),_0xb5ac17+'-'+_0x191496+'/'+_0x2711f9)[_0x20ed('0x1f')](_0x1904a7);}return null;};}function patchUpdates(_0x14edd4){return function(_0x40915d){try{jsonpatch[_0x20ed('0x26')](_0x40915d,_0x14edd4,!![]);}catch(_0x39db5a){return BPromise['reject'](_0x39db5a);}return _0x40915d[_0x20ed('0x27')]();};}function saveUpdates(_0x4184f6,_0x3c0b3f){return function(_0x4481da){if(_0x4481da){return _0x4481da[_0x20ed('0x28')](_0x4184f6)[_0x20ed('0x29')](function(_0x2a9863){return _0x2a9863;});}return null;};}function removeEntity(_0x40e07f,_0x43e6e3){return function(_0x5992fd){if(_0x5992fd){return _0x5992fd[_0x20ed('0x2a')]()[_0x20ed('0x29')](function(){var _0x3c3c39=_0x5992fd[_0x20ed('0x2b')]({'plain':!![]});var _0x2c9185=_0x20ed('0x2c');return db[_0x20ed('0x2d')]['destroy']({'where':{'type':_0x2c9185,'resourceId':_0x3c3c39['id']}})[_0x20ed('0x29')](function(){return _0x5992fd;});})[_0x20ed('0x29')](function(){_0x40e07f[_0x20ed('0x1d')](0xcc)[_0x20ed('0x1e')]();});}};}function handleEntityNotFound(_0x570375,_0x3b788a){return function(_0x3773f1){if(!_0x3773f1){_0x570375['sendStatus'](0x194);}return _0x3773f1;};}function handleError(_0x2b119c,_0x2915c5){_0x2915c5=_0x2915c5||0x1f4;return function(_0x4d7c13){logger['error'](_0x4d7c13[_0x20ed('0x2e')]);if(_0x4d7c13['name']){delete _0x4d7c13['name'];}_0x2b119c[_0x20ed('0x1d')](_0x2915c5)[_0x20ed('0x2f')](_0x4d7c13);};}exports[_0x20ed('0x30')]=function(_0x51be97,_0x143a00){var _0x2b991e={},_0x2d2994={},_0x144228={'count':0x0,'rows':[]};var _0x5e5e10=_[_0x20ed('0x31')](db[_0x20ed('0x32')]['rawAttributes'],function(_0x2597ac){return{'name':_0x2597ac[_0x20ed('0x33')],'type':_0x2597ac[_0x20ed('0x34')][_0x20ed('0x35')]};});_0x2d2994[_0x20ed('0x36')]=_['map'](_0x5e5e10,'name');_0x2d2994['query']=_['keys'](_0x51be97[_0x20ed('0x37')]);_0x2d2994['filters']=_['intersection'](_0x2d2994[_0x20ed('0x36')],_0x2d2994[_0x20ed('0x37')]);_0x2b991e[_0x20ed('0x38')]=_['intersection'](_0x2d2994[_0x20ed('0x36')],qs[_0x20ed('0x39')](_0x51be97['query'][_0x20ed('0x39')]));_0x2b991e[_0x20ed('0x38')]=_0x2b991e[_0x20ed('0x38')][_0x20ed('0x3a')]?_0x2b991e[_0x20ed('0x38')]:_0x2d2994[_0x20ed('0x36')];if(!_0x51be97[_0x20ed('0x37')][_0x20ed('0x3b')](_0x20ed('0x3c'))){_0x2b991e[_0x20ed('0x23')]=qs['limit'](_0x51be97['query'][_0x20ed('0x23')]);_0x2b991e[_0x20ed('0x21')]=qs[_0x20ed('0x21')](_0x51be97[_0x20ed('0x37')][_0x20ed('0x21')]);}_0x2b991e[_0x20ed('0x3d')]=qs[_0x20ed('0x3e')](_0x51be97[_0x20ed('0x37')][_0x20ed('0x3e')]);_0x2b991e[_0x20ed('0x3f')]=qs[_0x20ed('0x40')](_[_0x20ed('0x41')](_0x51be97[_0x20ed('0x37')],_0x2d2994[_0x20ed('0x40')]),_0x5e5e10);if(_0x51be97[_0x20ed('0x37')][_0x20ed('0x42')]){_0x2b991e[_0x20ed('0x3f')]=_[_0x20ed('0x43')](_0x2b991e[_0x20ed('0x3f')],{'$or':_[_0x20ed('0x31')](_0x5e5e10,function(_0x1d18b6){if(_0x1d18b6[_0x20ed('0x34')]!=='VIRTUAL'){var _0x1faea0={};_0x1faea0[_0x1d18b6[_0x20ed('0x44')]]={'$like':'%'+_0x51be97[_0x20ed('0x37')]['filter']+'%'};return _0x1faea0;}})});}_0x2b991e=_[_0x20ed('0x43')]({},_0x2b991e,_0x51be97[_0x20ed('0x45')]);var _0x59c4d6={'where':_0x2b991e[_0x20ed('0x3f')]};return db[_0x20ed('0x32')][_0x20ed('0x22')](_0x59c4d6)['then'](function(_0x4fb0ed){_0x144228[_0x20ed('0x22')]=_0x4fb0ed;if(_0x51be97['query']['includeAll']){_0x2b991e[_0x20ed('0x46')]=[{'all':!![]}];}return db[_0x20ed('0x32')][_0x20ed('0x47')](_0x2b991e);})[_0x20ed('0x29')](function(_0x3b1ba4){_0x144228[_0x20ed('0x48')]=_0x3b1ba4;return _0x144228;})['then'](respondWithFilteredResult(_0x143a00,_0x2b991e))['catch'](handleError(_0x143a00,null));};exports[_0x20ed('0x49')]=function(_0x2bd2bd,_0x541a21){var _0x11e3fa={'raw':!![],'where':{'id':_0x2bd2bd[_0x20ed('0x4a')]['id']}},_0x2eccb1={};_0x2eccb1[_0x20ed('0x36')]=_[_0x20ed('0x4b')](db[_0x20ed('0x32')]['rawAttributes']);_0x2eccb1['query']=_[_0x20ed('0x4b')](_0x2bd2bd[_0x20ed('0x37')]);_0x2eccb1[_0x20ed('0x40')]=_[_0x20ed('0x4c')](_0x2eccb1[_0x20ed('0x36')],_0x2eccb1[_0x20ed('0x37')]);_0x11e3fa[_0x20ed('0x38')]=_['intersection'](_0x2eccb1[_0x20ed('0x36')],qs[_0x20ed('0x39')](_0x2bd2bd[_0x20ed('0x37')][_0x20ed('0x39')]));_0x11e3fa[_0x20ed('0x38')]=_0x11e3fa['attributes'][_0x20ed('0x3a')]?_0x11e3fa[_0x20ed('0x38')]:_0x2eccb1[_0x20ed('0x36')];if(_0x2bd2bd['query'][_0x20ed('0x4d')]){_0x11e3fa['include']=[{'all':!![]}];}_0x11e3fa=_[_0x20ed('0x43')]({},_0x11e3fa,_0x2bd2bd['options']);return db[_0x20ed('0x32')]['find'](_0x11e3fa)[_0x20ed('0x29')](handleEntityNotFound(_0x541a21,null))[_0x20ed('0x29')](respondWithResult(_0x541a21,null))['catch'](handleError(_0x541a21,null));};exports[_0x20ed('0x4e')]=function(_0x548898,_0x2480d8){return db[_0x20ed('0x32')]['create'](_0x548898[_0x20ed('0x4f')],{})[_0x20ed('0x29')](function(_0x4fde20){var _0x5dd04a=_0x548898['user'][_0x20ed('0x2b')]({'plain':!![]});if(!_0x5dd04a)throw new Error(_0x20ed('0x50'));if(_0x5dd04a['role']===_0x20ed('0x51')){var _0x39d6ee=_0x4fde20[_0x20ed('0x2b')]({'plain':!![]});var _0x2dde96=_0x20ed('0x2c');return db[_0x20ed('0x52')][_0x20ed('0x53')]({'where':{'name':_0x2dde96,'userProfileId':_0x5dd04a['userProfileId']},'raw':!![]})[_0x20ed('0x29')](function(_0x34f672){if(_0x34f672&&_0x34f672[_0x20ed('0x54')]===0x0){return db['UserProfileResource'][_0x20ed('0x4e')]({'name':_0x39d6ee[_0x20ed('0x44')],'resourceId':_0x39d6ee['id'],'type':_0x34f672[_0x20ed('0x44')],'sectionId':_0x34f672['id']},{})[_0x20ed('0x29')](function(){return _0x4fde20;});}else{return _0x4fde20;}})['catch'](function(_0x3929df){logger['error'](_0x20ed('0x55'),_0x3929df);throw _0x3929df;});}return _0x4fde20;})['then'](respondWithResult(_0x2480d8,0xc9))['catch'](handleError(_0x2480d8,null));};exports[_0x20ed('0x28')]=function(_0x3046f8,_0x2eb5fb){if(_0x3046f8[_0x20ed('0x4f')]['id']){delete _0x3046f8['body']['id'];}return db[_0x20ed('0x32')]['find']({'where':{'id':_0x3046f8[_0x20ed('0x4a')]['id']}})[_0x20ed('0x29')](handleEntityNotFound(_0x2eb5fb,null))[_0x20ed('0x29')](saveUpdates(_0x3046f8[_0x20ed('0x4f')],null))[_0x20ed('0x29')](respondWithResult(_0x2eb5fb,null))[_0x20ed('0x56')](handleError(_0x2eb5fb,null));};exports[_0x20ed('0x2a')]=function(_0x3f4d1a,_0x39877b){return db['OpenchannelQueue']['find']({'where':{'id':_0x3f4d1a[_0x20ed('0x4a')]['id']}})[_0x20ed('0x29')](handleEntityNotFound(_0x39877b,null))[_0x20ed('0x29')](removeEntity(_0x39877b,null))[_0x20ed('0x56')](handleError(_0x39877b,null));};exports[_0x20ed('0x57')]=function(_0x3f2101,_0x11de21){return db[_0x20ed('0x32')]['describe']()['then'](respondWithResult(_0x11de21,null))[_0x20ed('0x56')](handleError(_0x11de21,null));};exports[_0x20ed('0x58')]=function(_0x5f1eb8,_0x4d9f8f,_0x4c7448){var _0x3b4e2e={'raw':!![],'where':{}},_0x3cb034={},_0x4b7fbc;return db['OpenchannelQueue'][_0x20ed('0x59')]({'where':{'id':_0x5f1eb8[_0x20ed('0x4a')]['id']}})[_0x20ed('0x29')](handleEntityNotFound(_0x4d9f8f,null))[_0x20ed('0x29')](function(_0x13fe51){if(_0x13fe51){_0x4b7fbc=_0x13fe51['get']({'plain':!![]});_0x3cb034[_0x20ed('0x36')]=_[_0x20ed('0x4b')](db['UserOpenchannelQueue'][_0x20ed('0x5a')]);_0x3cb034['query']=_['keys'](_0x5f1eb8[_0x20ed('0x37')]);_0x3cb034['filters']=_['intersection'](_0x3cb034[_0x20ed('0x36')],_0x3cb034['query']);_0x3b4e2e[_0x20ed('0x38')]=_['intersection'](_0x3cb034[_0x20ed('0x36')],qs[_0x20ed('0x39')](_0x5f1eb8['query']['fields']));_0x3b4e2e[_0x20ed('0x38')]=_0x3b4e2e[_0x20ed('0x38')][_0x20ed('0x3a')]?_0x3b4e2e[_0x20ed('0x38')]:_0x3cb034[_0x20ed('0x36')];if(!_0x5f1eb8[_0x20ed('0x37')][_0x20ed('0x3b')](_0x20ed('0x3c'))){_0x3b4e2e['limit']=qs[_0x20ed('0x23')](_0x5f1eb8[_0x20ed('0x37')]['limit']);_0x3b4e2e[_0x20ed('0x21')]=qs[_0x20ed('0x21')](_0x5f1eb8[_0x20ed('0x37')][_0x20ed('0x21')]);}_0x3b4e2e[_0x20ed('0x3d')]=qs[_0x20ed('0x3e')](_0x5f1eb8[_0x20ed('0x37')][_0x20ed('0x3e')]);_0x3b4e2e[_0x20ed('0x3f')]=qs[_0x20ed('0x40')](_[_0x20ed('0x41')](_0x5f1eb8['query'],_0x3cb034[_0x20ed('0x40')]));_0x3b4e2e[_0x20ed('0x3f')]['OpenchannelQueueId']=_0x13fe51['id'];if(_0x5f1eb8['query'][_0x20ed('0x42')]){_0x3b4e2e[_0x20ed('0x3f')]=_[_0x20ed('0x43')](_0x3b4e2e[_0x20ed('0x3f')],{'$or':_['map'](_0x3b4e2e['attributes'],function(_0x26e1e2){var _0x55a987={};_0x55a987[_0x26e1e2]={'$like':'%'+_0x5f1eb8[_0x20ed('0x37')][_0x20ed('0x42')]+'%'};return _0x55a987;})});}_0x3b4e2e=_[_0x20ed('0x43')]({},_0x3b4e2e,_0x5f1eb8[_0x20ed('0x45')]);return db['UserOpenchannelQueue'][_0x20ed('0x47')](_0x3b4e2e);}})[_0x20ed('0x29')](function(_0x1f60e2){if(_0x1f60e2){return db[_0x20ed('0x5b')][_0x20ed('0x5c')]({'where':{'id':_['map'](_0x1f60e2,_0x20ed('0x5d')),'role':'agent'},'attributes':['id',_0x20ed('0x44'),'openchannelPause','updatedAt',_0x20ed('0x5e')]});}})[_0x20ed('0x29')](function(_0x2ee8c2){if(_0x2ee8c2){return{'count':_0x2ee8c2['count'],'rows':_[_0x20ed('0x31')](_0x2ee8c2['rows'],function(_0x287eae){return{'membername':_0x287eae[_0x20ed('0x44')],'UserId':_0x287eae['id'],'queue_name':_0x4b7fbc[_0x20ed('0x44')],'OpenchannelQueueId':_0x4b7fbc['id'],'interface':util[_0x20ed('0x5f')](_0x20ed('0x60'),'SIP',_0x287eae[_0x20ed('0x44')]),'penalty':0x0,'paused':_0x287eae[_0x20ed('0x61')],'createdAt':_0x287eae[_0x20ed('0x5e')],'updatedAt':_0x287eae[_0x20ed('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d9f8f,_0x3b4e2e))[_0x20ed('0x56')](handleError(_0x4d9f8f,null));};exports[_0x20ed('0x63')]=function(_0x2daf1c,_0x2a8790,_0x5c9b3b){var _0xf75894={};var _0x14726f={};var _0xfb1d7;var _0x57134e;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2daf1c[_0x20ed('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a8790,null))[_0x20ed('0x29')](function(_0x29c36a){if(_0x29c36a){_0xfb1d7=_0x29c36a;_0x14726f[_0x20ed('0x36')]=_[_0x20ed('0x4b')](db[_0x20ed('0x64')][_0x20ed('0x5a')]);_0x14726f[_0x20ed('0x37')]=_['keys'](_0x2daf1c[_0x20ed('0x37')]);_0x14726f['filters']=_[_0x20ed('0x4c')](_0x14726f[_0x20ed('0x36')],_0x14726f[_0x20ed('0x37')]);_0xf75894[_0x20ed('0x38')]=_[_0x20ed('0x4c')](_0x14726f[_0x20ed('0x36')],qs[_0x20ed('0x39')](_0x2daf1c[_0x20ed('0x37')][_0x20ed('0x39')]));_0xf75894[_0x20ed('0x38')]=_0xf75894[_0x20ed('0x38')][_0x20ed('0x3a')]?_0xf75894[_0x20ed('0x38')]:_0x14726f[_0x20ed('0x36')];_0xf75894[_0x20ed('0x3d')]=qs[_0x20ed('0x3e')](_0x2daf1c[_0x20ed('0x37')][_0x20ed('0x3e')]);_0xf75894[_0x20ed('0x3f')]=qs[_0x20ed('0x40')](_[_0x20ed('0x41')](_0x2daf1c['query'],_0x14726f[_0x20ed('0x40')]));if(_0x2daf1c['query'][_0x20ed('0x42')]){_0xf75894['where']=_[_0x20ed('0x43')](_0xf75894[_0x20ed('0x3f')],{'$or':_[_0x20ed('0x31')](_0xf75894[_0x20ed('0x38')],function(_0xff57dc){var _0x54ea66={};_0x54ea66[_0xff57dc]={'$like':'%'+_0x2daf1c[_0x20ed('0x37')][_0x20ed('0x42')]+'%'};return _0x54ea66;})});}_0xf75894=_[_0x20ed('0x43')]({},_0xf75894,_0x2daf1c[_0x20ed('0x45')]);return _0xfb1d7[_0x20ed('0x63')](_0xf75894);}})[_0x20ed('0x29')](function(_0x1488c7){if(_0x1488c7){_0x57134e=_0x1488c7[_0x20ed('0x3a')];if(!_0x2daf1c[_0x20ed('0x37')][_0x20ed('0x3b')]('nolimit')){_0xf75894[_0x20ed('0x23')]=qs[_0x20ed('0x23')](_0x2daf1c[_0x20ed('0x37')][_0x20ed('0x23')]);_0xf75894[_0x20ed('0x21')]=qs[_0x20ed('0x21')](_0x2daf1c[_0x20ed('0x37')][_0x20ed('0x21')]);}return _0xfb1d7[_0x20ed('0x63')](_0xf75894);}})['then'](function(_0x2773d5){if(_0x2773d5){return _0x2773d5?{'count':_0x57134e,'rows':_0x2773d5}:null;}})['then'](respondWithResult(_0x2a8790,null))[_0x20ed('0x56')](handleError(_0x2a8790,null));};exports['addTeams']=function(_0x427fd1,_0x5bd30e,_0x46ea15){var _0x29161d=_0x427fd1[_0x20ed('0x4f')]['ids'];return db[_0x20ed('0x64')][_0x20ed('0x47')]({'where':{'id':_0x29161d},'attributes':['id'],'include':[{'model':db[_0x20ed('0x5b')],'as':_0x20ed('0x65'),'attributes':['id','name',_0x20ed('0x66'),_0x20ed('0x67'),_0x20ed('0x68')],'raw':!![]}]})[_0x20ed('0x29')](function(_0x5205a5){if(_0x5205a5){var _0x254b5a=_[_0x20ed('0x69')](_0x5205a5,function(_0x6fce63){var _0x2a93ac=_0x6fce63['get']({'plain':!![]});return _0x2a93ac[_0x20ed('0x65')];});return db[_0x20ed('0x32')][_0x20ed('0x53')]({'where':{'id':_0x427fd1['params']['id']}})[_0x20ed('0x29')](function(_0x4104e0){return db[_0x20ed('0x6a')]['transaction'](function(_0x53210b){return _0x4104e0[_0x20ed('0x6b')](_0x29161d,{'transaction':_0x53210b})[_0x20ed('0x29')](function(){return BPromise['each'](_0x254b5a,function(_0x4381e1){return db['UserOpenchannelQueue'][_0x20ed('0x6c')]({'where':{'UserId':_0x4381e1['id'],'OpenchannelQueueId':_0x427fd1[_0x20ed('0x4a')]['id']},'transaction':_0x53210b});});})[_0x20ed('0x29')](function(){_0x254b5a['forEach'](function(_0x44f2a1){socket[_0x20ed('0x6d')](_0x20ed('0x6e'),{'UserId':_0x44f2a1['id'],'OpenchannelQueueId':_0x4104e0['id']});});});});});}})[_0x20ed('0x29')](respondWithStatusCode(_0x5bd30e,null))[_0x20ed('0x56')](handleError(_0x5bd30e,null));};exports['removeTeams']=function(_0x417c41,_0x114ff8,_0x4b2b51){return db['Team'][_0x20ed('0x47')]({'where':{'id':_0x417c41[_0x20ed('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x20ed('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x20ed('0x29')](handleEntityNotFound(_0x114ff8,null))['then'](function(_0x14ae36){var _0x297267=_[_0x20ed('0x31')](_0x14ae36,'id');var _0x3f47de=[];var _0x37f23e=[];var _0x392916=squel[_0x20ed('0x6f')]();_0x392916['field'](_0x20ed('0x70'))[_0x20ed('0x71')](_0x20ed('0x72'),'tq')[_0x20ed('0x73')](_0x20ed('0x74'),'ut',_0x20ed('0x75'))[_0x20ed('0x3f')](_0x20ed('0x76'),_0x417c41[_0x20ed('0x4a')]['id']);for(var _0x1a34a3=0x0;_0x1a34a3<_0x14ae36[_0x20ed('0x3a')];_0x1a34a3+=0x1){let _0x5c9282=_0x14ae36[_0x1a34a3];for(var _0x3ebb50=0x0;_0x3ebb50<_0x5c9282[_0x20ed('0x65')][_0x20ed('0x3a')];_0x3ebb50+=0x1){let _0x1c9220=_0x5c9282[_0x20ed('0x65')][_0x3ebb50];var _0x581240=_0x392916[_0x20ed('0x77')]();_0x581240['where'](_0x20ed('0x78'),_0x1c9220['id']);_0x37f23e[_0x20ed('0x79')](db[_0x20ed('0x6a')]['query'](_0x581240[_0x20ed('0x7a')](),{'type':db[_0x20ed('0x6a')][_0x20ed('0x7b')]['SELECT']})[_0x20ed('0x29')](function(_0x337004){if(_0x337004[_0x20ed('0x3a')]===0x1){return _0x1c9220['id'];}else{var _0x339631=_[_0x20ed('0x7c')](_[_0x20ed('0x31')](_0x337004,_0x20ed('0x7d')),function(_0x37b83b){return _[_0x20ed('0x7e')](_0x297267,_0x37b83b);});if(_0x339631){return _0x1c9220['id'];}}}));}}return BPromise['all'](_0x37f23e)[_0x20ed('0x29')](function(_0x5915e7){_0x3f47de=_(_0x3f47de)[_0x20ed('0x7f')](_0x5915e7)[_0x20ed('0x80')]()[_0x20ed('0x81')]();return db[_0x20ed('0x32')]['find']({'where':{'id':_0x417c41[_0x20ed('0x4a')]['id']}})[_0x20ed('0x29')](function(_0x225dbb){return db[_0x20ed('0x6a')]['transaction'](function(_0x4eeff9){return _0x225dbb[_0x20ed('0x82')](_0x417c41['query'][_0x20ed('0x83')],{'transaction':_0x4eeff9})[_0x20ed('0x29')](function(){if(!_[_0x20ed('0x84')](_0x3f47de)){return _0x225dbb['removeAgents'](_0x3f47de,{'transaction':_0x4eeff9});}})[_0x20ed('0x29')](function(){_0x3f47de[_0x20ed('0x85')](function(_0x1fe9ac){socket[_0x20ed('0x6d')](_0x20ed('0x86'),{'UserId':_0x1fe9ac,'OpenchannelQueueId':_0x225dbb['id']});});});});});});})[_0x20ed('0x29')](respondWithStatusCode(_0x114ff8,null))[_0x20ed('0x56')](handleError(_0x114ff8,null));};exports[_0x20ed('0x87')]=function(_0x500077,_0x2d9a14,_0x1c5100){return db['OpenchannelQueue']['find']({'where':{'id':_0x500077[_0x20ed('0x4a')]['id']}})[_0x20ed('0x29')](handleEntityNotFound(_0x2d9a14,null))[_0x20ed('0x29')](function(_0x2a0e89){if(_0x2a0e89){return _0x2a0e89[_0x20ed('0x87')](_0x500077[_0x20ed('0x4f')][_0x20ed('0x83')],_[_0x20ed('0x88')](_0x500077['body'],[_0x20ed('0x83'),'id'])||{})[_0x20ed('0x89')](function(_0x1b30ab){for(var _0x217567=0x0;_0x217567<_0x500077[_0x20ed('0x4f')][_0x20ed('0x83')][_0x20ed('0x3a')];_0x217567+=0x1){socket[_0x20ed('0x6d')](_0x20ed('0x6e'),{'UserId':Number(_0x500077[_0x20ed('0x4f')]['ids'][_0x217567]),'OpenchannelQueueId':Number(_0x500077[_0x20ed('0x4a')]['id'])});}return _0x1b30ab;});}})[_0x20ed('0x29')](respondWithResult(_0x2d9a14,null))[_0x20ed('0x56')](handleError(_0x2d9a14,null));};exports[_0x20ed('0x8a')]=function(_0x400347,_0x37b8aa,_0x1f9dcb){return db[_0x20ed('0x32')]['find']({'where':{'id':_0x400347[_0x20ed('0x4a')]['id']}})[_0x20ed('0x29')](handleEntityNotFound(_0x37b8aa,null))['then'](function(_0x1f9600){if(_0x1f9600){return _0x1f9600['removeAgents'](_0x400347[_0x20ed('0x37')][_0x20ed('0x83')])[_0x20ed('0x29')](function(){if(_['isArray'](_0x400347[_0x20ed('0x37')][_0x20ed('0x83')])){for(var _0x5498f3=0x0;_0x5498f3<_0x400347[_0x20ed('0x37')][_0x20ed('0x83')]['length'];_0x5498f3+=0x1){socket['emit'](_0x20ed('0x86'),{'UserId':Number(_0x400347[_0x20ed('0x37')][_0x20ed('0x83')][_0x5498f3]),'OpenchannelQueueId':Number(_0x400347[_0x20ed('0x4a')]['id'])});}}else{socket[_0x20ed('0x6d')](_0x20ed('0x86'),{'UserId':Number(_0x400347[_0x20ed('0x37')][_0x20ed('0x83')]),'OpenchannelQueueId':Number(_0x400347[_0x20ed('0x4a')]['id'])});}});}})[_0x20ed('0x29')](respondWithStatusCode(_0x37b8aa,null))[_0x20ed('0x56')](handleError(_0x37b8aa,null));};exports[_0x20ed('0x8b')]=function(_0x5d9768,_0x1672ab,_0x50b44b){var _0x30c546={};var _0x4ed89b={};var _0x140685;var _0x5208a2;return db['OpenchannelQueue'][_0x20ed('0x59')]({'where':{'id':_0x5d9768[_0x20ed('0x4a')]['id']}})[_0x20ed('0x29')](handleEntityNotFound(_0x1672ab,null))[_0x20ed('0x29')](function(_0xa1159d){if(_0xa1159d){_0x140685=_0xa1159d;_0x4ed89b[_0x20ed('0x36')]=_[_0x20ed('0x4b')](db['User'][_0x20ed('0x5a')]);_0x4ed89b[_0x20ed('0x37')]=_[_0x20ed('0x4b')](_0x5d9768[_0x20ed('0x37')]);_0x4ed89b[_0x20ed('0x40')]=_[_0x20ed('0x4c')](_0x4ed89b[_0x20ed('0x36')],_0x4ed89b[_0x20ed('0x37')]);_0x30c546[_0x20ed('0x38')]=_[_0x20ed('0x4c')](_0x4ed89b[_0x20ed('0x36')],qs[_0x20ed('0x39')](_0x5d9768[_0x20ed('0x37')]['fields']));_0x30c546[_0x20ed('0x38')]=_0x30c546[_0x20ed('0x38')][_0x20ed('0x3a')]?_0x30c546[_0x20ed('0x38')]:_0x4ed89b['model'];_0x30c546[_0x20ed('0x3d')]=qs['sort'](_0x5d9768[_0x20ed('0x37')][_0x20ed('0x3e')]);_0x30c546[_0x20ed('0x3f')]=qs[_0x20ed('0x40')](_['pick'](_0x5d9768[_0x20ed('0x37')],_0x4ed89b[_0x20ed('0x40')]));if(_0x5d9768[_0x20ed('0x37')]['filter']){_0x30c546['where']=_[_0x20ed('0x43')](_0x30c546['where'],{'$or':_['map'](_0x30c546[_0x20ed('0x38')],function(_0x29c6db){var _0x1f2976={};_0x1f2976[_0x29c6db]={'$like':'%'+_0x5d9768[_0x20ed('0x37')][_0x20ed('0x42')]+'%'};return _0x1f2976;})});}_0x30c546=_['merge']({},_0x30c546,_0x5d9768['options']);return _0x140685[_0x20ed('0x8b')](_0x30c546);}})[_0x20ed('0x29')](function(_0x1c2944){if(_0x1c2944){_0x5208a2=_0x1c2944[_0x20ed('0x3a')];if(!_0x5d9768[_0x20ed('0x37')][_0x20ed('0x3b')]('nolimit')){_0x30c546[_0x20ed('0x23')]=qs[_0x20ed('0x23')](_0x5d9768[_0x20ed('0x37')][_0x20ed('0x23')]);_0x30c546['offset']=qs[_0x20ed('0x21')](_0x5d9768[_0x20ed('0x37')]['offset']);}return _0x140685[_0x20ed('0x8b')](_0x30c546);}})[_0x20ed('0x29')](function(_0x335188){if(_0x335188){return _0x335188?{'count':_0x5208a2,'rows':_0x335188}:null;}})[_0x20ed('0x29')](respondWithResult(_0x1672ab,null))[_0x20ed('0x56')](handleError(_0x1672ab,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index f237797..04b338a 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 _0x73e4=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x3d67e2,_0x152bea){var _0x4a8e99=function(_0x3951b3){while(--_0x3951b3){_0x3d67e2['push'](_0x3d67e2['shift']());}};_0x4a8e99(++_0x152bea);}(_0x73e4,0x7d));var _0x473e=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0x73e4[_0x90f34f];return _0x4b18cf;};'use strict';var EventEmitter=require(_0x473e('0x0'));var OpenchannelQueue=require(_0x473e('0x1'))['db'][_0x473e('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x473e('0x3')](0x0);var events={'afterCreate':_0x473e('0x4'),'afterUpdate':_0x473e('0x5'),'afterDestroy':_0x473e('0x6')};function emitEvent(_0x4bdb5b){return function(_0x5e2394,_0x56b8a1,_0x4cef3a){OpenchannelQueueEvents['emit'](_0x4bdb5b+':'+_0x5e2394['id'],_0x5e2394);OpenchannelQueueEvents[_0x473e('0x7')](_0x4bdb5b,_0x5e2394);_0x4cef3a(null);};}for(var e in events){if(events[_0x473e('0x8')](e)){var event=events[e];OpenchannelQueue[_0x473e('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xb473=['emit','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x1dfdbd,_0xeac1e){var _0x41f46d=function(_0x541caf){while(--_0x541caf){_0x1dfdbd['push'](_0x1dfdbd['shift']());}};_0x41f46d(++_0xeac1e);}(_0xb473,0x16b));var _0x3b47=function(_0x561771,_0x554760){_0x561771=_0x561771-0x0;var _0x54d16e=_0xb473[_0x561771];return _0x54d16e;};'use strict';var EventEmitter=require(_0x3b47('0x0'));var OpenchannelQueue=require(_0x3b47('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3b47('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b47('0x3'),'afterDestroy':_0x3b47('0x4')};function emitEvent(_0x5ddc9a){return function(_0x3f3790,_0x175c4e,_0x311fb0){OpenchannelQueueEvents[_0x3b47('0x5')](_0x5ddc9a+':'+_0x3f3790['id'],_0x3f3790);OpenchannelQueueEvents[_0x3b47('0x5')](_0x5ddc9a,_0x3f3790);_0x311fb0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x3b47('0x6')](e,emitEvent(event));}}module[_0x3b47('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 24dfc87..b80ac60 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 _0x8f47=['path','../../config/environment','openchannel_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8f47,0x1c3));var _0x78f4=function(_0x4e294f,_0x14d4d9){_0x4e294f=_0x4e294f-0x0;var _0xb92bf7=_0x8f47[_0x4e294f];return _0xb92bf7;};'use strict';var _=require(_0x78f4('0x0'));var util=require('util');var logger=require(_0x78f4('0x1'))(_0x78f4('0x2'));var moment=require(_0x78f4('0x3'));var BPromise=require(_0x78f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78f4('0x5'));var rimraf=require('rimraf');var config=require(_0x78f4('0x6'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x589727,_0x216a04){return _0x589727['define']('OpenchannelQueue',attributes,{'tableName':_0x78f4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98cb=['../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x18ebfb,_0x118829){var _0x202a3e=function(_0x17542b){while(--_0x17542b){_0x18ebfb['push'](_0x18ebfb['shift']());}};_0x202a3e(++_0x118829);}(_0x98cb,0x101));var _0xb98c=function(_0x193cad,_0xc11234){_0x193cad=_0x193cad-0x0;var _0x16d5dd=_0x98cb[_0x193cad];return _0x16d5dd;};'use strict';var _=require(_0xb98c('0x0'));var util=require(_0xb98c('0x1'));var logger=require(_0xb98c('0x2'))(_0xb98c('0x3'));var moment=require('moment');var BPromise=require(_0xb98c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb98c('0x5'));var rimraf=require(_0xb98c('0x6'));var config=require(_0xb98c('0x7'));var attributes=require(_0xb98c('0x8'));module[_0xb98c('0x9')]=function(_0x2e3248,_0x518072){return _0x2e3248[_0xb98c('0xa')]('OpenchannelQueue',attributes,{'tableName':_0xb98c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index a36b1ca..e6b0ed6 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 _0x14f6=['message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','then','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x288fb8,_0x3606df){var _0x8f14b5=function(_0x4839d3){while(--_0x4839d3){_0x288fb8['push'](_0x288fb8['shift']());}};_0x8f14b5(++_0x3606df);}(_0x14f6,0x1d8));var _0x614f=function(_0x1ba717,_0xb9193a){_0x1ba717=_0x1ba717-0x0;var _0x208f52=_0x14f6[_0x1ba717];return _0x208f52;};'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(_0x614f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x614f('0x6'))(_0x614f('0x7'));var config=require(_0x614f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x614f('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x614f('0xa')]));require(_0x614f('0xb'))[_0x614f('0xc')](socket);function respondWithRpcPromise(_0x53954a,_0x13ce93,_0x4774ec){return new BPromise(function(_0x24953d,_0x2ce3d6){return client[_0x614f('0xd')](_0x53954a,_0x4774ec)['then'](function(_0x25449f){logger[_0x614f('0xe')](_0x614f('0xf'),_0x13ce93,_0x614f('0x10'));logger[_0x614f('0x11')](_0x614f('0x12'),_0x13ce93,_0x614f('0x10'),JSON[_0x614f('0x13')](_0x25449f));if(_0x25449f[_0x614f('0x14')]){if(_0x25449f[_0x614f('0x14')][_0x614f('0x15')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x13ce93,_0x25449f[_0x614f('0x14')][_0x614f('0x16')]);return _0x2ce3d6(_0x25449f['error']['message']);}logger[_0x614f('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x13ce93,_0x25449f[_0x614f('0x14')]['message']);return _0x24953d(_0x25449f[_0x614f('0x14')]['message']);}else{logger['info'](_0x614f('0xf'),_0x13ce93,_0x614f('0x10'));_0x24953d(_0x25449f[_0x614f('0x17')][_0x614f('0x16')]);}})[_0x614f('0x18')](function(_0x5a7b09){logger[_0x614f('0x14')](_0x614f('0xf'),_0x13ce93,_0x5a7b09);_0x2ce3d6(_0x5a7b09);});});}exports[_0x614f('0x19')]=function(_0x2e0ba6){var _0x5cadc6=this;return new Promise(function(_0x4be7e8,_0x37f216){return db[_0x614f('0x1a')][_0x614f('0x1b')]({'raw':_0x2e0ba6[_0x614f('0x1c')]?_0x2e0ba6['options'][_0x614f('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e0ba6[_0x614f('0x1c')]?_0x2e0ba6['options'][_0x614f('0x1e')]||null:null,'attributes':_0x2e0ba6['options']?_0x2e0ba6[_0x614f('0x1c')][_0x614f('0x1f')]||null:null,'limit':_0x2e0ba6['options']?_0x2e0ba6['options']['limit']||null:null,'include':_0x2e0ba6['options']?_0x2e0ba6['options'][_0x614f('0x20')]?_[_0x614f('0x21')](_0x2e0ba6[_0x614f('0x1c')][_0x614f('0x20')],function(_0x47e7f6){return{'model':db[_0x47e7f6['model']],'as':_0x47e7f6['as'],'attributes':_0x47e7f6[_0x614f('0x1f')],'include':_0x47e7f6[_0x614f('0x20')]?_[_0x614f('0x21')](_0x47e7f6['include'],function(_0x355f0d){return{'model':db[_0x355f0d['model']],'as':_0x355f0d['as'],'attributes':_0x355f0d[_0x614f('0x1f')],'include':_0x355f0d[_0x614f('0x20')]?_[_0x614f('0x21')](_0x355f0d[_0x614f('0x20')],function(_0x5053f3){return{'model':db[_0x5053f3[_0x614f('0x22')]],'as':_0x5053f3['as'],'attributes':_0x5053f3['attributes']};}):[]};}):[]};}):[]:[]})[_0x614f('0x23')](function(_0x2586cf){logger[_0x614f('0xe')](_0x614f('0x19'),_0x2e0ba6);logger[_0x614f('0x11')](_0x614f('0x19'),_0x2e0ba6,JSON[_0x614f('0x13')](_0x2586cf));_0x4be7e8(_0x2586cf);})['catch'](function(_0x674eb0){logger[_0x614f('0x14')](_0x614f('0x19'),_0x674eb0['message'],_0x2e0ba6);_0x37f216(_0x5cadc6[_0x614f('0x14')](0x1f4,_0x674eb0['message']));});});};exports[_0x614f('0x24')]=function(_0x47a844){var _0x1a288b=this;return new Promise(function(_0x366d52,_0x4acbb9){return db[_0x614f('0x1a')][_0x614f('0x25')]({'raw':_0x47a844[_0x614f('0x1c')]?_0x47a844['options']['raw']===undefined?!![]:![]:!![],'where':_0x47a844[_0x614f('0x1c')]?_0x47a844[_0x614f('0x1c')][_0x614f('0x1e')]||null:null,'attributes':_0x47a844['options']?_0x47a844[_0x614f('0x1c')][_0x614f('0x1f')]||null:null,'include':_0x47a844[_0x614f('0x1c')]?_0x47a844[_0x614f('0x1c')]['include']?_[_0x614f('0x21')](_0x47a844[_0x614f('0x1c')][_0x614f('0x20')],function(_0x467e3c){return{'model':db[_0x467e3c[_0x614f('0x22')]],'as':_0x467e3c['as'],'attributes':_0x467e3c[_0x614f('0x1f')],'include':_0x467e3c[_0x614f('0x20')]?_[_0x614f('0x21')](_0x467e3c['include'],function(_0x441eb3){return{'model':db[_0x441eb3[_0x614f('0x22')]],'as':_0x441eb3['as'],'attributes':_0x441eb3[_0x614f('0x1f')],'include':_0x441eb3[_0x614f('0x20')]?_[_0x614f('0x21')](_0x441eb3[_0x614f('0x20')],function(_0x2a34c9){return{'model':db[_0x2a34c9[_0x614f('0x22')]],'as':_0x2a34c9['as'],'attributes':_0x2a34c9[_0x614f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x614f('0x23')](function(_0x2e1ff9){logger[_0x614f('0xe')](_0x614f('0x24'),_0x47a844);logger[_0x614f('0x11')](_0x614f('0x24'),_0x47a844,JSON[_0x614f('0x13')](_0x2e1ff9));_0x366d52(_0x2e1ff9);})[_0x614f('0x18')](function(_0x350ad6){logger['error'](_0x614f('0x24'),_0x350ad6['message'],_0x47a844);_0x4acbb9(_0x1a288b[_0x614f('0x14')](0x1f4,_0x350ad6['message']));});});}; \ No newline at end of file +var _0x9c5b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueue,\x20%s,\x20%s','message','catch','findAll','raw','options','where','attributes','include','map','model','GetOpenchannelQueue','debug','stringify','ShowOpenchannelQueue','OpenchannelQueue','lodash','moment','bluebird','randomstring'];(function(_0xa164df,_0x5d69eb){var _0x29b157=function(_0x3e601d){while(--_0x3e601d){_0xa164df['push'](_0xa164df['shift']());}};_0x29b157(++_0x5d69eb);}(_0x9c5b,0x1d0));var _0xb9c5=function(_0x3e3f27,_0x2c2ecf){_0x3e3f27=_0x3e3f27-0x0;var _0x15c868=_0x9c5b[_0x3e3f27];return _0x15c868;};'use strict';var _=require(_0xb9c5('0x0'));var util=require('util');var moment=require(_0xb9c5('0x1'));var BPromise=require(_0xb9c5('0x2'));var rs=require(_0xb9c5('0x3'));var fs=require('fs');var Redis=require(_0xb9c5('0x4'));var db=require(_0xb9c5('0x5'))['db'];var utils=require(_0xb9c5('0x6'));var logger=require(_0xb9c5('0x7'))(_0xb9c5('0x8'));var config=require('../../config/environment');var jayson=require(_0xb9c5('0x9'));var client=jayson['client'][_0xb9c5('0xa')]({'port':0x232a});config[_0xb9c5('0xb')]=_[_0xb9c5('0xc')](config[_0xb9c5('0xb')],{'host':_0xb9c5('0xd'),'port':0x18eb});var socket=require(_0xb9c5('0xe'))(new Redis(config[_0xb9c5('0xb')]));require(_0xb9c5('0xf'))['register'](socket);function respondWithRpcPromise(_0x4e71df,_0x220fca,_0x5e1187){return new BPromise(function(_0x3d1a8f,_0x1c5f2f){return client[_0xb9c5('0x10')](_0x4e71df,_0x5e1187)[_0xb9c5('0x11')](function(_0x4251ef){logger[_0xb9c5('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x220fca,_0xb9c5('0x13'));logger['debug'](_0xb9c5('0x14'),_0x220fca,_0xb9c5('0x13'),JSON['stringify'](_0x4251ef));if(_0x4251ef[_0xb9c5('0x15')]){if(_0x4251ef[_0xb9c5('0x15')][_0xb9c5('0x16')]===0x1f4){logger['error'](_0xb9c5('0x17'),_0x220fca,_0x4251ef[_0xb9c5('0x15')][_0xb9c5('0x18')]);return _0x1c5f2f(_0x4251ef['error']['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x220fca,_0x4251ef[_0xb9c5('0x15')][_0xb9c5('0x18')]);return _0x3d1a8f(_0x4251ef[_0xb9c5('0x15')]['message']);}else{logger['info'](_0xb9c5('0x17'),_0x220fca,'request\x20sent');_0x3d1a8f(_0x4251ef['result'][_0xb9c5('0x18')]);}})[_0xb9c5('0x19')](function(_0x284a85){logger[_0xb9c5('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x220fca,_0x284a85);_0x1c5f2f(_0x284a85);});});}exports['GetOpenchannelQueue']=function(_0x2ffbaf){var _0x431ea2=this;return new Promise(function(_0x19c5ab,_0x28d089){return db['OpenchannelQueue'][_0xb9c5('0x1a')]({'raw':_0x2ffbaf['options']?_0x2ffbaf['options'][_0xb9c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ffbaf[_0xb9c5('0x1c')]?_0x2ffbaf['options'][_0xb9c5('0x1d')]||null:null,'attributes':_0x2ffbaf[_0xb9c5('0x1c')]?_0x2ffbaf[_0xb9c5('0x1c')][_0xb9c5('0x1e')]||null:null,'limit':_0x2ffbaf[_0xb9c5('0x1c')]?_0x2ffbaf[_0xb9c5('0x1c')]['limit']||null:null,'include':_0x2ffbaf[_0xb9c5('0x1c')]?_0x2ffbaf['options'][_0xb9c5('0x1f')]?_[_0xb9c5('0x20')](_0x2ffbaf['options'][_0xb9c5('0x1f')],function(_0x23452d){return{'model':db[_0x23452d['model']],'as':_0x23452d['as'],'attributes':_0x23452d[_0xb9c5('0x1e')],'include':_0x23452d['include']?_[_0xb9c5('0x20')](_0x23452d[_0xb9c5('0x1f')],function(_0x2d2973){return{'model':db[_0x2d2973[_0xb9c5('0x21')]],'as':_0x2d2973['as'],'attributes':_0x2d2973['attributes'],'include':_0x2d2973[_0xb9c5('0x1f')]?_['map'](_0x2d2973[_0xb9c5('0x1f')],function(_0x13366c){return{'model':db[_0x13366c['model']],'as':_0x13366c['as'],'attributes':_0x13366c[_0xb9c5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb9c5('0x11')](function(_0x2fc408){logger[_0xb9c5('0x12')](_0xb9c5('0x22'),_0x2ffbaf);logger[_0xb9c5('0x23')](_0xb9c5('0x22'),_0x2ffbaf,JSON[_0xb9c5('0x24')](_0x2fc408));_0x19c5ab(_0x2fc408);})[_0xb9c5('0x19')](function(_0xa7a014){logger['error'](_0xb9c5('0x22'),_0xa7a014[_0xb9c5('0x18')],_0x2ffbaf);_0x28d089(_0x431ea2[_0xb9c5('0x15')](0x1f4,_0xa7a014[_0xb9c5('0x18')]));});});};exports[_0xb9c5('0x25')]=function(_0x241cb0){var _0x33550a=this;return new Promise(function(_0x1eff05,_0x923dc){return db[_0xb9c5('0x26')]['find']({'raw':_0x241cb0[_0xb9c5('0x1c')]?_0x241cb0[_0xb9c5('0x1c')][_0xb9c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x241cb0[_0xb9c5('0x1c')]?_0x241cb0['options'][_0xb9c5('0x1d')]||null:null,'attributes':_0x241cb0[_0xb9c5('0x1c')]?_0x241cb0[_0xb9c5('0x1c')][_0xb9c5('0x1e')]||null:null,'include':_0x241cb0[_0xb9c5('0x1c')]?_0x241cb0[_0xb9c5('0x1c')][_0xb9c5('0x1f')]?_['map'](_0x241cb0[_0xb9c5('0x1c')][_0xb9c5('0x1f')],function(_0x3f8564){return{'model':db[_0x3f8564[_0xb9c5('0x21')]],'as':_0x3f8564['as'],'attributes':_0x3f8564[_0xb9c5('0x1e')],'include':_0x3f8564[_0xb9c5('0x1f')]?_[_0xb9c5('0x20')](_0x3f8564[_0xb9c5('0x1f')],function(_0x30d4ba){return{'model':db[_0x30d4ba['model']],'as':_0x30d4ba['as'],'attributes':_0x30d4ba[_0xb9c5('0x1e')],'include':_0x30d4ba[_0xb9c5('0x1f')]?_[_0xb9c5('0x20')](_0x30d4ba['include'],function(_0x3871a4){return{'model':db[_0x3871a4['model']],'as':_0x3871a4['as'],'attributes':_0x3871a4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb9c5('0x11')](function(_0x55b406){logger[_0xb9c5('0x12')](_0xb9c5('0x25'),_0x241cb0);logger['debug'](_0xb9c5('0x25'),_0x241cb0,JSON['stringify'](_0x55b406));_0x1eff05(_0x55b406);})[_0xb9c5('0x19')](function(_0xf86b8f){logger[_0xb9c5('0x15')]('ShowOpenchannelQueue',_0xf86b8f[_0xb9c5('0x18')],_0x241cb0);_0x923dc(_0x33550a[_0xb9c5('0x15')](0x1f4,_0xf86b8f[_0xb9c5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 544120d..c10b0a7 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 _0xfdda=['update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x14e1f2,_0x30d654){var _0x281406=function(_0x331f40){while(--_0x331f40){_0x14e1f2['push'](_0x14e1f2['shift']());}};_0x281406(++_0x30d654);}(_0xfdda,0xf0));var _0xafdd=function(_0x1b8c71,_0x41d8ab){_0x1b8c71=_0x1b8c71-0x0;var _0x539905=_0xfdda[_0x1b8c71];return _0x539905;};'use strict';var OpenchannelQueueEvents=require(_0xafdd('0x0'));var events=[_0xafdd('0x1'),_0xafdd('0x2'),_0xafdd('0x3')];function createListener(_0x2d60e3,_0x1c95fa){return function(_0x3cd965){_0x1c95fa[_0xafdd('0x4')](_0x2d60e3,_0x3cd965);};}function removeListener(_0x4d8784,_0x17f0f1){return function(){OpenchannelQueueEvents[_0xafdd('0x5')](_0x4d8784,_0x17f0f1);};}exports[_0xafdd('0x6')]=function(_0x56eff6){for(var _0x1aa415=0x0,_0x29444c=events[_0xafdd('0x7')];_0x1aa415<_0x29444c;_0x1aa415++){var _0x32c39f=events[_0x1aa415];var _0x3ded69=createListener(_0xafdd('0x8')+_0x32c39f,_0x56eff6);OpenchannelQueueEvents['on'](_0x32c39f,_0x3ded69);}}; \ No newline at end of file +var _0x3200=['length','./openchannelQueue.events','save','remove','emit','removeListener','register'];(function(_0x59334c,_0x170037){var _0x490338=function(_0x2efc68){while(--_0x2efc68){_0x59334c['push'](_0x59334c['shift']());}};_0x490338(++_0x170037);}(_0x3200,0x1dd));var _0x0320=function(_0x28ea42,_0x2b4580){_0x28ea42=_0x28ea42-0x0;var _0x2a354e=_0x3200[_0x28ea42];return _0x2a354e;};'use strict';var OpenchannelQueueEvents=require(_0x0320('0x0'));var events=[_0x0320('0x1'),_0x0320('0x2'),'update'];function createListener(_0x2c1083,_0x51a97a){return function(_0x22e613){_0x51a97a[_0x0320('0x3')](_0x2c1083,_0x22e613);};}function removeListener(_0x422eef,_0x387e92){return function(){OpenchannelQueueEvents[_0x0320('0x4')](_0x422eef,_0x387e92);};}exports[_0x0320('0x5')]=function(_0x5e7486){for(var _0x3f31d0=0x0,_0x5994f9=events[_0x0320('0x6')];_0x3f31d0<_0x5994f9;_0x3f31d0++){var _0x5d65c0=events[_0x3f31d0];var _0x591092=createListener('openchannelQueue:'+_0x5d65c0,_0x5e7486);OpenchannelQueueEvents['on'](_0x5d65c0,_0x591092);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index c9c5275..77547c1 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 _0xe699=['../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x4f932d,_0x14c0b3){var _0x4d1aee=function(_0x33bcc4){while(--_0x33bcc4){_0x4f932d['push'](_0x4f932d['shift']());}};_0x4d1aee(++_0x14c0b3);}(_0xe699,0x163));var _0x9e69=function(_0x3c14f3,_0x11659b){_0x3c14f3=_0x3c14f3-0x0;var _0x5e172a=_0xe699[_0x3c14f3];return _0x5e172a;};'use strict';var multer=require(_0x9e69('0x0'));var util=require(_0x9e69('0x1'));var path=require('path');var timeout=require(_0x9e69('0x2'));var express=require(_0x9e69('0x3'));var router=express[_0x9e69('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9e69('0x5'));var config=require(_0x9e69('0x6'));var controller=require(_0x9e69('0x7'));router[_0x9e69('0x8')]('/',auth['isAuthenticated'](),controller[_0x9e69('0x9')]);router[_0x9e69('0x8')](_0x9e69('0xa'),auth['isAuthenticated'](),controller[_0x9e69('0xb')]);router['get'](_0x9e69('0xc'),auth[_0x9e69('0xd')](),controller[_0x9e69('0xe')]);router['post']('/',auth[_0x9e69('0xd')](),controller[_0x9e69('0xf')]);router['put'](_0x9e69('0xc'),auth['isAuthenticated'](),controller[_0x9e69('0x10')]);router[_0x9e69('0x11')](_0x9e69('0xc'),auth[_0x9e69('0xd')](),controller[_0x9e69('0x12')]);module[_0x9e69('0x13')]=router; \ No newline at end of file +var _0x5f22=['describe','/:id','show','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x12f091,_0x285c9d){var _0x2c285b=function(_0x35c4fb){while(--_0x35c4fb){_0x12f091['push'](_0x12f091['shift']());}};_0x2c285b(++_0x285c9d);}(_0x5f22,0x1ac));var _0x25f2=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x5f22[_0x213518];return _0x1baf75;};'use strict';var multer=require(_0x25f2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x25f2('0x1'));var express=require(_0x25f2('0x2'));var router=express['Router']();var fs_extra=require(_0x25f2('0x3'));var auth=require(_0x25f2('0x4'));var interaction=require(_0x25f2('0x5'));var config=require(_0x25f2('0x6'));var controller=require(_0x25f2('0x7'));router[_0x25f2('0x8')]('/',auth[_0x25f2('0x9')](),controller[_0x25f2('0xa')]);router[_0x25f2('0x8')](_0x25f2('0xb'),auth[_0x25f2('0x9')](),controller[_0x25f2('0xc')]);router[_0x25f2('0x8')](_0x25f2('0xd'),auth['isAuthenticated'](),controller[_0x25f2('0xe')]);router['post']('/',auth[_0x25f2('0x9')](),controller['create']);router[_0x25f2('0xf')]('/:id',auth[_0x25f2('0x9')](),controller[_0x25f2('0x10')]);router[_0x25f2('0x11')](_0x25f2('0xd'),auth[_0x25f2('0x9')](),controller[_0x25f2('0x12')]);module[_0x25f2('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 f28db26..d7082c7 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 _0x359b=['STRING','DATE','moment','sequelize','exports'];(function(_0x326fb8,_0x30c64c){var _0x2a6084=function(_0x27e6f3){while(--_0x27e6f3){_0x326fb8['push'](_0x326fb8['shift']());}};_0x2a6084(++_0x30c64c);}(_0x359b,0x7a));var _0xb359=function(_0x2b741a,_0x425bf0){_0x2b741a=_0x2b741a-0x0;var _0x282596=_0x359b[_0x2b741a];return _0x282596;};'use strict';var moment=require(_0xb359('0x0'));var Sequelize=require(_0xb359('0x1'));module[_0xb359('0x2')]={'uniqueid':{'type':Sequelize[_0xb359('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb359('0x3')]},'joinAt':{'type':Sequelize[_0xb359('0x4')]},'leaveAt':{'type':Sequelize[_0xb359('0x4')]},'acceptAt':{'type':Sequelize[_0xb359('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb359('0x3')]}}; \ No newline at end of file +var _0x10dc=['sequelize','STRING','DATE','moment'];(function(_0x34466e,_0x1b30f2){var _0x33c694=function(_0x27f99b){while(--_0x27f99b){_0x34466e['push'](_0x34466e['shift']());}};_0x33c694(++_0x1b30f2);}(_0x10dc,0x107));var _0xc10d=function(_0x43d952,_0x453ec9){_0x43d952=_0x43d952-0x0;var _0x1c53b5=_0x10dc[_0x43d952];return _0x1c53b5;};'use strict';var moment=require(_0xc10d('0x0'));var Sequelize=require(_0xc10d('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc10d('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc10d('0x3')]},'leaveAt':{'type':Sequelize[_0xc10d('0x3')]},'acceptAt':{'type':Sequelize[_0xc10d('0x3')]},'exitAt':{'type':Sequelize[_0xc10d('0x3')]},'reason':{'type':Sequelize[_0xc10d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 4651989..b3b6a41 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 _0x544c=['ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','OpenchannelQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv'];(function(_0x642d80,_0x504f84){var _0x21d70a=function(_0x4666d7){while(--_0x4666d7){_0x642d80['push'](_0x642d80['shift']());}};_0x21d70a(++_0x504f84);}(_0x544c,0xd7));var _0xc544=function(_0xbe48c2,_0x3db103){_0xbe48c2=_0xbe48c2-0x0;var _0x39a679=_0x544c[_0xbe48c2];return _0x39a679;};'use strict';var emlformat=require(_0xc544('0x0'));var rimraf=require(_0xc544('0x1'));var zipdir=require(_0xc544('0x2'));var jsonpatch=require(_0xc544('0x3'));var rp=require(_0xc544('0x4'));var moment=require('moment');var BPromise=require(_0xc544('0x5'));var Mustache=require(_0xc544('0x6'));var util=require(_0xc544('0x7'));var path=require(_0xc544('0x8'));var sox=require('sox');var csv=require(_0xc544('0x9'));var ejs=require(_0xc544('0xa'));var fs=require('fs');var fs_extra=require(_0xc544('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc544('0xc'));var deskjs=require(_0xc544('0xd'));var toCsv=require(_0xc544('0x9'));var querystring=require(_0xc544('0xe'));var Papa=require(_0xc544('0xf'));var Redis=require('ioredis');var authService=require(_0xc544('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc544('0x11'))(_0xc544('0x12'));var utils=require(_0xc544('0x13'));var config=require(_0xc544('0x14'));var licenseUtil=require(_0xc544('0x15'));var db=require(_0xc544('0x16'))['db'];function respondWithStatusCode(_0x27e89a,_0x30788a){_0x30788a=_0x30788a||0xcc;return function(_0x21cd01){if(_0x21cd01){return _0x27e89a['sendStatus'](_0x30788a);}return _0x27e89a[_0xc544('0x17')](_0x30788a)[_0xc544('0x18')]();};}function respondWithResult(_0x1a40b2,_0x548e85){_0x548e85=_0x548e85||0xc8;return function(_0x301780){if(_0x301780){return _0x1a40b2['status'](_0x548e85)[_0xc544('0x19')](_0x301780);}};}function respondWithFilteredResult(_0x27d893,_0x291d89){return function(_0x1bbce4){if(_0x1bbce4){var _0x167de2=typeof _0x291d89['offset']===_0xc544('0x1a')&&typeof _0x291d89[_0xc544('0x1b')]===_0xc544('0x1a');var _0x464a2a=_0x1bbce4[_0xc544('0x1c')];var _0x5e86ab=_0x167de2?0x0:_0x291d89[_0xc544('0x1d')];var _0x20cb68=_0x167de2?_0x1bbce4['count']:_0x291d89['offset']+_0x291d89[_0xc544('0x1b')];var _0xa048db;if(_0x20cb68>=_0x464a2a){_0x20cb68=_0x464a2a;_0xa048db=0xc8;}else{_0xa048db=0xce;}_0x27d893[_0xc544('0x17')](_0xa048db);return _0x27d893[_0xc544('0x1e')](_0xc544('0x1f'),_0x5e86ab+'-'+_0x20cb68+'/'+_0x464a2a)[_0xc544('0x19')](_0x1bbce4);}return null;};}function patchUpdates(_0xeffa42){return function(_0x495414){try{jsonpatch[_0xc544('0x20')](_0x495414,_0xeffa42,!![]);}catch(_0x350db5){return BPromise[_0xc544('0x21')](_0x350db5);}return _0x495414['save']();};}function saveUpdates(_0x15ffdf,_0x2d91ab){return function(_0x3c16eb){if(_0x3c16eb){return _0x3c16eb[_0xc544('0x22')](_0x15ffdf)[_0xc544('0x23')](function(_0x159b72){return _0x159b72;});}return null;};}function removeEntity(_0x561fbe,_0x2a8116){return function(_0x553b95){if(_0x553b95){return _0x553b95[_0xc544('0x24')]()[_0xc544('0x23')](function(){_0x561fbe[_0xc544('0x17')](0xcc)[_0xc544('0x18')]();});}};}function handleEntityNotFound(_0x4be661,_0x32c6d7){return function(_0x106853){if(!_0x106853){_0x4be661[_0xc544('0x25')](0x194);}return _0x106853;};}function handleError(_0x21b596,_0x2b407b){_0x2b407b=_0x2b407b||0x1f4;return function(_0xff040f){logger[_0xc544('0x26')](_0xff040f[_0xc544('0x27')]);if(_0xff040f[_0xc544('0x28')]){delete _0xff040f[_0xc544('0x28')];}_0x21b596[_0xc544('0x17')](_0x2b407b)[_0xc544('0x29')](_0xff040f);};}exports['index']=function(_0x15279e,_0x5da584){var _0xc91208={},_0xedd518={},_0x378fe3={'count':0x0,'rows':[]};var _0x582fe7=_[_0xc544('0x2a')](db[_0xc544('0x2b')]['rawAttributes'],function(_0xb14978){return{'name':_0xb14978[_0xc544('0x2c')],'type':_0xb14978[_0xc544('0x2d')]['key']};});_0xedd518[_0xc544('0x2e')]=_[_0xc544('0x2a')](_0x582fe7,'name');_0xedd518[_0xc544('0x2f')]=_[_0xc544('0x30')](_0x15279e[_0xc544('0x2f')]);_0xedd518[_0xc544('0x31')]=_[_0xc544('0x32')](_0xedd518[_0xc544('0x2e')],_0xedd518[_0xc544('0x2f')]);_0xc91208[_0xc544('0x33')]=_[_0xc544('0x32')](_0xedd518['model'],qs[_0xc544('0x34')](_0x15279e[_0xc544('0x2f')][_0xc544('0x34')]));_0xc91208[_0xc544('0x33')]=_0xc91208['attributes'][_0xc544('0x35')]?_0xc91208[_0xc544('0x33')]:_0xedd518[_0xc544('0x2e')];if(!_0x15279e['query'][_0xc544('0x36')](_0xc544('0x37'))){_0xc91208['limit']=qs['limit'](_0x15279e[_0xc544('0x2f')]['limit']);_0xc91208[_0xc544('0x1d')]=qs[_0xc544('0x1d')](_0x15279e[_0xc544('0x2f')][_0xc544('0x1d')]);}_0xc91208[_0xc544('0x38')]=qs[_0xc544('0x39')](_0x15279e[_0xc544('0x2f')][_0xc544('0x39')]);_0xc91208[_0xc544('0x3a')]=qs[_0xc544('0x31')](_[_0xc544('0x3b')](_0x15279e[_0xc544('0x2f')],_0xedd518['filters']),_0x582fe7);if(_0x15279e[_0xc544('0x2f')][_0xc544('0x3c')]){_0xc91208[_0xc544('0x3a')]=_[_0xc544('0x3d')](_0xc91208[_0xc544('0x3a')],{'$or':_[_0xc544('0x2a')](_0x582fe7,function(_0x5a4df9){if(_0x5a4df9[_0xc544('0x2d')]!==_0xc544('0x3e')){var _0x4e6488={};_0x4e6488[_0x5a4df9['name']]={'$like':'%'+_0x15279e['query'][_0xc544('0x3c')]+'%'};return _0x4e6488;}})});}_0xc91208=_[_0xc544('0x3d')]({},_0xc91208,_0x15279e[_0xc544('0x3f')]);var _0x117eb6={'where':_0xc91208['where']};return db['OpenchannelQueueReport'][_0xc544('0x1c')](_0x117eb6)[_0xc544('0x23')](function(_0x28edcd){_0x378fe3[_0xc544('0x1c')]=_0x28edcd;if(_0x15279e[_0xc544('0x2f')][_0xc544('0x40')]){_0xc91208[_0xc544('0x41')]=[{'all':!![]}];}return db[_0xc544('0x2b')][_0xc544('0x42')](_0xc91208);})[_0xc544('0x23')](function(_0x430b20){_0x378fe3[_0xc544('0x43')]=_0x430b20;return _0x378fe3;})[_0xc544('0x23')](respondWithFilteredResult(_0x5da584,_0xc91208))[_0xc544('0x44')](handleError(_0x5da584,null));};exports[_0xc544('0x45')]=function(_0x1d6d26,_0x333355){var _0x2e266e={'raw':!![],'where':{'id':_0x1d6d26[_0xc544('0x46')]['id']}},_0x2e141d={};_0x2e141d[_0xc544('0x2e')]=_[_0xc544('0x30')](db[_0xc544('0x2b')]['rawAttributes']);_0x2e141d[_0xc544('0x2f')]=_['keys'](_0x1d6d26[_0xc544('0x2f')]);_0x2e141d[_0xc544('0x31')]=_[_0xc544('0x32')](_0x2e141d[_0xc544('0x2e')],_0x2e141d[_0xc544('0x2f')]);_0x2e266e['attributes']=_[_0xc544('0x32')](_0x2e141d[_0xc544('0x2e')],qs[_0xc544('0x34')](_0x1d6d26['query']['fields']));_0x2e266e[_0xc544('0x33')]=_0x2e266e['attributes']['length']?_0x2e266e[_0xc544('0x33')]:_0x2e141d[_0xc544('0x2e')];if(_0x1d6d26['query']['includeAll']){_0x2e266e[_0xc544('0x41')]=[{'all':!![]}];}_0x2e266e=_['merge']({},_0x2e266e,_0x1d6d26[_0xc544('0x3f')]);return db[_0xc544('0x2b')][_0xc544('0x47')](_0x2e266e)[_0xc544('0x23')](handleEntityNotFound(_0x333355,null))[_0xc544('0x23')](respondWithResult(_0x333355,null))[_0xc544('0x44')](handleError(_0x333355,null));};exports[_0xc544('0x48')]=function(_0x1e5cb1,_0x57ed8c){return db['OpenchannelQueueReport']['create'](_0x1e5cb1[_0xc544('0x49')],{})['then'](respondWithResult(_0x57ed8c,0xc9))[_0xc544('0x44')](handleError(_0x57ed8c,null));};exports[_0xc544('0x22')]=function(_0x32324e,_0x301034){if(_0x32324e['body']['id']){delete _0x32324e[_0xc544('0x49')]['id'];}return db[_0xc544('0x2b')]['find']({'where':{'id':_0x32324e[_0xc544('0x46')]['id']}})['then'](handleEntityNotFound(_0x301034,null))[_0xc544('0x23')](saveUpdates(_0x32324e[_0xc544('0x49')],null))['then'](respondWithResult(_0x301034,null))[_0xc544('0x44')](handleError(_0x301034,null));};exports[_0xc544('0x24')]=function(_0x360647,_0x1a7460){return db[_0xc544('0x2b')][_0xc544('0x47')]({'where':{'id':_0x360647[_0xc544('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a7460,null))[_0xc544('0x23')](removeEntity(_0x1a7460,null))['catch'](handleError(_0x1a7460,null));};exports[_0xc544('0x4a')]=function(_0x159e1f,_0x233e00){return db[_0xc544('0x2b')][_0xc544('0x4a')]()[_0xc544('0x23')](respondWithResult(_0x233e00,null))[_0xc544('0x44')](handleError(_0x233e00,null));}; \ No newline at end of file +var _0xb804=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set','apply','save','then','sendStatus','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','update','find','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x36865c,_0x18d640){var _0x1ae6f9=function(_0x38e1e9){while(--_0x38e1e9){_0x36865c['push'](_0x36865c['shift']());}};_0x1ae6f9(++_0x18d640);}(_0xb804,0xd4));var _0x4b80=function(_0xf3b06f,_0x489959){_0xf3b06f=_0xf3b06f-0x0;var _0x531640=_0xb804[_0xf3b06f];return _0x531640;};'use strict';var emlformat=require(_0x4b80('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b80('0x1'));var jsonpatch=require(_0x4b80('0x2'));var rp=require('request-promise');var moment=require(_0x4b80('0x3'));var BPromise=require(_0x4b80('0x4'));var Mustache=require(_0x4b80('0x5'));var util=require(_0x4b80('0x6'));var path=require(_0x4b80('0x7'));var sox=require('sox');var csv=require(_0x4b80('0x8'));var ejs=require(_0x4b80('0x9'));var fs=require('fs');var fs_extra=require(_0x4b80('0xa'));var _=require('lodash');var squel=require(_0x4b80('0xb'));var crypto=require(_0x4b80('0xc'));var jsforce=require(_0x4b80('0xd'));var deskjs=require(_0x4b80('0xe'));var toCsv=require(_0x4b80('0x8'));var querystring=require(_0x4b80('0xf'));var Papa=require(_0x4b80('0x10'));var Redis=require(_0x4b80('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4b80('0x12'));var as=require(_0x4b80('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b80('0x14'))(_0x4b80('0x15'));var utils=require(_0x4b80('0x16'));var config=require(_0x4b80('0x17'));var licenseUtil=require(_0x4b80('0x18'));var db=require(_0x4b80('0x19'))['db'];function respondWithStatusCode(_0x5eed42,_0x501bf8){_0x501bf8=_0x501bf8||0xcc;return function(_0x513711){if(_0x513711){return _0x5eed42['sendStatus'](_0x501bf8);}return _0x5eed42['status'](_0x501bf8)[_0x4b80('0x1a')]();};}function respondWithResult(_0x40d1e5,_0xd95dde){_0xd95dde=_0xd95dde||0xc8;return function(_0x98c9b2){if(_0x98c9b2){return _0x40d1e5['status'](_0xd95dde)[_0x4b80('0x1b')](_0x98c9b2);}};}function respondWithFilteredResult(_0x417a64,_0x2e56e1){return function(_0x98c94d){if(_0x98c94d){var _0x5bc702=typeof _0x2e56e1['offset']===_0x4b80('0x1c')&&typeof _0x2e56e1[_0x4b80('0x1d')]==='undefined';var _0x54d7da=_0x98c94d[_0x4b80('0x1e')];var _0x14baf1=_0x5bc702?0x0:_0x2e56e1[_0x4b80('0x1f')];var _0xa7d276=_0x5bc702?_0x98c94d['count']:_0x2e56e1['offset']+_0x2e56e1[_0x4b80('0x1d')];var _0x32987b;if(_0xa7d276>=_0x54d7da){_0xa7d276=_0x54d7da;_0x32987b=0xc8;}else{_0x32987b=0xce;}_0x417a64[_0x4b80('0x20')](_0x32987b);return _0x417a64[_0x4b80('0x21')]('Content-Range',_0x14baf1+'-'+_0xa7d276+'/'+_0x54d7da)[_0x4b80('0x1b')](_0x98c94d);}return null;};}function patchUpdates(_0x169b9f){return function(_0x46ea4f){try{jsonpatch[_0x4b80('0x22')](_0x46ea4f,_0x169b9f,!![]);}catch(_0x5cfc2a){return BPromise['reject'](_0x5cfc2a);}return _0x46ea4f[_0x4b80('0x23')]();};}function saveUpdates(_0xca6725,_0x520fe7){return function(_0x44fa14){if(_0x44fa14){return _0x44fa14['update'](_0xca6725)[_0x4b80('0x24')](function(_0x3ee8f6){return _0x3ee8f6;});}return null;};}function removeEntity(_0x594f1e,_0x1b836d){return function(_0xb86171){if(_0xb86171){return _0xb86171['destroy']()[_0x4b80('0x24')](function(){_0x594f1e[_0x4b80('0x20')](0xcc)[_0x4b80('0x1a')]();});}};}function handleEntityNotFound(_0x380a5e,_0x33065f){return function(_0x9cf725){if(!_0x9cf725){_0x380a5e[_0x4b80('0x25')](0x194);}return _0x9cf725;};}function handleError(_0x546c25,_0x3d50d8){_0x3d50d8=_0x3d50d8||0x1f4;return function(_0xfcb798){logger['error'](_0xfcb798[_0x4b80('0x26')]);if(_0xfcb798[_0x4b80('0x27')]){delete _0xfcb798[_0x4b80('0x27')];}_0x546c25[_0x4b80('0x20')](_0x3d50d8)[_0x4b80('0x28')](_0xfcb798);};}exports[_0x4b80('0x29')]=function(_0x4733ad,_0x2df336){var _0x3a7f26={},_0x372359={},_0x38a9dc={'count':0x0,'rows':[]};var _0x36e0ab=_[_0x4b80('0x2a')](db[_0x4b80('0x2b')][_0x4b80('0x2c')],function(_0x35683b){return{'name':_0x35683b[_0x4b80('0x2d')],'type':_0x35683b['type']['key']};});_0x372359[_0x4b80('0x2e')]=_[_0x4b80('0x2a')](_0x36e0ab,'name');_0x372359['query']=_[_0x4b80('0x2f')](_0x4733ad[_0x4b80('0x30')]);_0x372359[_0x4b80('0x31')]=_[_0x4b80('0x32')](_0x372359[_0x4b80('0x2e')],_0x372359[_0x4b80('0x30')]);_0x3a7f26[_0x4b80('0x33')]=_[_0x4b80('0x32')](_0x372359[_0x4b80('0x2e')],qs[_0x4b80('0x34')](_0x4733ad[_0x4b80('0x30')][_0x4b80('0x34')]));_0x3a7f26[_0x4b80('0x33')]=_0x3a7f26[_0x4b80('0x33')][_0x4b80('0x35')]?_0x3a7f26[_0x4b80('0x33')]:_0x372359[_0x4b80('0x2e')];if(!_0x4733ad['query'][_0x4b80('0x36')](_0x4b80('0x37'))){_0x3a7f26['limit']=qs[_0x4b80('0x1d')](_0x4733ad['query']['limit']);_0x3a7f26['offset']=qs['offset'](_0x4733ad[_0x4b80('0x30')][_0x4b80('0x1f')]);}_0x3a7f26[_0x4b80('0x38')]=qs[_0x4b80('0x39')](_0x4733ad[_0x4b80('0x30')][_0x4b80('0x39')]);_0x3a7f26['where']=qs[_0x4b80('0x31')](_[_0x4b80('0x3a')](_0x4733ad[_0x4b80('0x30')],_0x372359[_0x4b80('0x31')]),_0x36e0ab);if(_0x4733ad['query'][_0x4b80('0x3b')]){_0x3a7f26[_0x4b80('0x3c')]=_[_0x4b80('0x3d')](_0x3a7f26[_0x4b80('0x3c')],{'$or':_[_0x4b80('0x2a')](_0x36e0ab,function(_0x4b6bbc){if(_0x4b6bbc[_0x4b80('0x3e')]!==_0x4b80('0x3f')){var _0xf55687={};_0xf55687[_0x4b6bbc[_0x4b80('0x27')]]={'$like':'%'+_0x4733ad[_0x4b80('0x30')][_0x4b80('0x3b')]+'%'};return _0xf55687;}})});}_0x3a7f26=_[_0x4b80('0x3d')]({},_0x3a7f26,_0x4733ad[_0x4b80('0x40')]);var _0x495762={'where':_0x3a7f26[_0x4b80('0x3c')]};return db[_0x4b80('0x2b')][_0x4b80('0x1e')](_0x495762)[_0x4b80('0x24')](function(_0x58e2f3){_0x38a9dc[_0x4b80('0x1e')]=_0x58e2f3;if(_0x4733ad[_0x4b80('0x30')][_0x4b80('0x41')]){_0x3a7f26['include']=[{'all':!![]}];}return db[_0x4b80('0x2b')]['findAll'](_0x3a7f26);})[_0x4b80('0x24')](function(_0x1f6676){_0x38a9dc[_0x4b80('0x42')]=_0x1f6676;return _0x38a9dc;})[_0x4b80('0x24')](respondWithFilteredResult(_0x2df336,_0x3a7f26))[_0x4b80('0x43')](handleError(_0x2df336,null));};exports[_0x4b80('0x44')]=function(_0x35080d,_0x4e547c){var _0x4d11e3={'raw':!![],'where':{'id':_0x35080d[_0x4b80('0x45')]['id']}},_0x56545f={};_0x56545f['model']=_[_0x4b80('0x2f')](db['OpenchannelQueueReport'][_0x4b80('0x2c')]);_0x56545f[_0x4b80('0x30')]=_[_0x4b80('0x2f')](_0x35080d[_0x4b80('0x30')]);_0x56545f['filters']=_[_0x4b80('0x32')](_0x56545f[_0x4b80('0x2e')],_0x56545f[_0x4b80('0x30')]);_0x4d11e3[_0x4b80('0x33')]=_[_0x4b80('0x32')](_0x56545f['model'],qs[_0x4b80('0x34')](_0x35080d[_0x4b80('0x30')]['fields']));_0x4d11e3[_0x4b80('0x33')]=_0x4d11e3[_0x4b80('0x33')]['length']?_0x4d11e3[_0x4b80('0x33')]:_0x56545f[_0x4b80('0x2e')];if(_0x35080d[_0x4b80('0x30')][_0x4b80('0x41')]){_0x4d11e3[_0x4b80('0x46')]=[{'all':!![]}];}_0x4d11e3=_['merge']({},_0x4d11e3,_0x35080d['options']);return db[_0x4b80('0x2b')]['find'](_0x4d11e3)[_0x4b80('0x24')](handleEntityNotFound(_0x4e547c,null))[_0x4b80('0x24')](respondWithResult(_0x4e547c,null))['catch'](handleError(_0x4e547c,null));};exports[_0x4b80('0x47')]=function(_0x1dc469,_0x50a3c1){return db[_0x4b80('0x2b')]['create'](_0x1dc469[_0x4b80('0x48')],{})['then'](respondWithResult(_0x50a3c1,0xc9))['catch'](handleError(_0x50a3c1,null));};exports[_0x4b80('0x49')]=function(_0x20c2a4,_0x36befd){if(_0x20c2a4['body']['id']){delete _0x20c2a4[_0x4b80('0x48')]['id'];}return db[_0x4b80('0x2b')][_0x4b80('0x4a')]({'where':{'id':_0x20c2a4[_0x4b80('0x45')]['id']}})[_0x4b80('0x24')](handleEntityNotFound(_0x36befd,null))['then'](saveUpdates(_0x20c2a4[_0x4b80('0x48')],null))[_0x4b80('0x24')](respondWithResult(_0x36befd,null))[_0x4b80('0x43')](handleError(_0x36befd,null));};exports[_0x4b80('0x4b')]=function(_0x590381,_0x321d5f){return db[_0x4b80('0x2b')][_0x4b80('0x4a')]({'where':{'id':_0x590381[_0x4b80('0x45')]['id']}})['then'](handleEntityNotFound(_0x321d5f,null))[_0x4b80('0x24')](removeEntity(_0x321d5f,null))['catch'](handleError(_0x321d5f,null));};exports[_0x4b80('0x4c')]=function(_0x31fcbd,_0x36bf76){return db[_0x4b80('0x2b')]['describe']()[_0x4b80('0x24')](respondWithResult(_0x36bf76,null))['catch'](handleError(_0x36bf76,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index b092c01..daf28fc 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x20244d,_0x143894){var _0x50d712=function(_0x15c451){while(--_0x15c451){_0x20244d['push'](_0x20244d['shift']());}};_0x50d712(++_0x143894);}(_0xe14b,0x93));var _0xbe14=function(_0x402de0,_0x40cfda){_0x402de0=_0x402de0-0x0;var _0x403c9a=_0xe14b[_0x402de0];return _0x403c9a;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x814b,0x1a2));var _0xb814=function(_0x425d5e,_0x3b9040){_0x425d5e=_0x425d5e-0x0;var _0x3cc67b=_0x814b[_0x425d5e];return _0x3cc67b;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 478bdde..6e88807 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 _0x4c99=['moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','update','attributes','limit','UpdateOpenchannelQueueReport','lodash'];(function(_0x438182,_0x389269){var _0x5df065=function(_0xb24d22){while(--_0xb24d22){_0x438182['push'](_0x438182['shift']());}};_0x5df065(++_0x389269);}(_0x4c99,0x1ec));var _0x94c9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4c99[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x94c9('0x0'));var util=require('util');var moment=require(_0x94c9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94c9('0x2'))['db'];var utils=require(_0x94c9('0x3'));var logger=require('../../config/logger')(_0x94c9('0x4'));var config=require(_0x94c9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x94c9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ebd2b,_0x49b85b,_0x23d961){return new BPromise(function(_0x4403ba,_0x3a1743){return client[_0x94c9('0x7')](_0x4ebd2b,_0x23d961)[_0x94c9('0x8')](function(_0x1c0983){logger[_0x94c9('0x9')](_0x94c9('0xa'),_0x49b85b,_0x94c9('0xb'));logger[_0x94c9('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x49b85b,_0x94c9('0xb'),JSON[_0x94c9('0xd')](_0x1c0983));if(_0x1c0983[_0x94c9('0xe')]){if(_0x1c0983['error'][_0x94c9('0xf')]===0x1f4){logger[_0x94c9('0xe')](_0x94c9('0xa'),_0x49b85b,_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);return _0x3a1743(_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);}logger[_0x94c9('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x49b85b,_0x1c0983['error']['message']);return _0x4403ba(_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);}else{logger['info'](_0x94c9('0xa'),_0x49b85b,_0x94c9('0xb'));_0x4403ba(_0x1c0983[_0x94c9('0x11')]['message']);}})['catch'](function(_0x447937){logger[_0x94c9('0xe')](_0x94c9('0xa'),_0x49b85b,_0x447937);_0x3a1743(_0x447937);});});}exports[_0x94c9('0x12')]=function(_0x5ab49f){var _0xb3d5d6=this;return new Promise(function(_0x2bca02,_0x3a38cc){return db[_0x94c9('0x13')][_0x94c9('0x14')](_0x5ab49f[_0x94c9('0x15')],{'raw':_0x5ab49f[_0x94c9('0x16')]?_0x5ab49f['options'][_0x94c9('0x17')]===undefined?!![]:![]:!![]})[_0x94c9('0x8')](function(_0x4d7a9b){logger[_0x94c9('0x9')](_0x94c9('0x12'),_0x5ab49f);logger[_0x94c9('0xc')](_0x94c9('0x12'),_0x5ab49f,JSON[_0x94c9('0xd')](_0x4d7a9b));_0x2bca02(_0x4d7a9b);})[_0x94c9('0x18')](function(_0x410f00){logger[_0x94c9('0xe')](_0x94c9('0x12'),_0x410f00[_0x94c9('0x10')],_0x5ab49f);_0x3a38cc(_0xb3d5d6['error'](0x1f4,_0x410f00[_0x94c9('0x10')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0xf5ce65){var _0x497c31=this;return new Promise(function(_0x21ffd9,_0x12b535){return db[_0x94c9('0x13')][_0x94c9('0x19')](_0xf5ce65[_0x94c9('0x15')],{'raw':_0xf5ce65[_0x94c9('0x16')]?_0xf5ce65['options'][_0x94c9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf5ce65[_0x94c9('0x16')]?_0xf5ce65[_0x94c9('0x16')]['where']||null:null,'attributes':_0xf5ce65[_0x94c9('0x16')]?_0xf5ce65['options'][_0x94c9('0x1a')]||null:null,'limit':_0xf5ce65[_0x94c9('0x16')]?_0xf5ce65[_0x94c9('0x16')][_0x94c9('0x1b')]||null:null})[_0x94c9('0x8')](function(_0x46a8fc){logger['info'](_0x94c9('0x1c'),_0xf5ce65);logger[_0x94c9('0xc')](_0x94c9('0x1c'),_0xf5ce65,JSON['stringify'](_0x46a8fc));_0x21ffd9(_0x46a8fc);})[_0x94c9('0x18')](function(_0x1e7b25){logger[_0x94c9('0xe')](_0x94c9('0x1c'),_0x1e7b25['message'],_0xf5ce65);_0x12b535(_0x497c31[_0x94c9('0xe')](0x1f4,_0x1e7b25[_0x94c9('0x10')]));});});}; \ No newline at end of file +var _0x5c00=['catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x580268,_0x10c333){var _0x4ca0b2=function(_0xf12d22){while(--_0xf12d22){_0x580268['push'](_0x580268['shift']());}};_0x4ca0b2(++_0x10c333);}(_0x5c00,0x17e));var _0x05c0=function(_0x3eb211,_0x4a2e7f){_0x3eb211=_0x3eb211-0x0;var _0xb32a15=_0x5c00[_0x3eb211];return _0xb32a15;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});}exports[_0x05c0('0x16')]=function(_0x521cbd){var _0x422401=this;return new Promise(function(_0x1230e5,_0x4613c0){return db['OpenchannelQueueReport'][_0x05c0('0x17')](_0x521cbd[_0x05c0('0x18')],{'raw':_0x521cbd[_0x05c0('0x19')]?_0x521cbd[_0x05c0('0x19')][_0x05c0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x407c1f){logger[_0x05c0('0xc')]('CreateOpenchannelQueueReport',_0x521cbd);logger['debug']('CreateOpenchannelQueueReport',_0x521cbd,JSON[_0x05c0('0x10')](_0x407c1f));_0x1230e5(_0x407c1f);})[_0x05c0('0x15')](function(_0x83f29){logger[_0x05c0('0x11')](_0x05c0('0x16'),_0x83f29[_0x05c0('0x13')],_0x521cbd);_0x4613c0(_0x422401[_0x05c0('0x11')](0x1f4,_0x83f29['message']));});});};exports[_0x05c0('0x1b')]=function(_0x1abbf3){var _0x4ba978=this;return new Promise(function(_0x530966,_0x4da6d6){return db['OpenchannelQueueReport']['update'](_0x1abbf3[_0x05c0('0x18')],{'raw':_0x1abbf3[_0x05c0('0x19')]?_0x1abbf3['options'][_0x05c0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1abbf3[_0x05c0('0x19')]?_0x1abbf3[_0x05c0('0x19')][_0x05c0('0x1c')]||null:null,'attributes':_0x1abbf3['options']?_0x1abbf3[_0x05c0('0x19')][_0x05c0('0x1d')]||null:null,'limit':_0x1abbf3[_0x05c0('0x19')]?_0x1abbf3[_0x05c0('0x19')][_0x05c0('0x1e')]||null:null})[_0x05c0('0xb')](function(_0x57886b){logger['info'](_0x05c0('0x1b'),_0x1abbf3);logger[_0x05c0('0xf')](_0x05c0('0x1b'),_0x1abbf3,JSON[_0x05c0('0x10')](_0x57886b));_0x530966(_0x57886b);})[_0x05c0('0x15')](function(_0x1e00c5){logger[_0x05c0('0x11')](_0x05c0('0x1b'),_0x1e00c5[_0x05c0('0x13')],_0x1abbf3);_0x4da6d6(_0x4ba978[_0x05c0('0x11')](0x1f4,_0x1e00c5[_0x05c0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 4a50a2e..0c04dd2 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 _0xbabe=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','show','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x32cc2b,_0x1874f9){var _0x5d8e61=function(_0x552b17){while(--_0x552b17){_0x32cc2b['push'](_0x32cc2b['shift']());}};_0x5d8e61(++_0x1874f9);}(_0xbabe,0x165));var _0xebab=function(_0x51a27a,_0x3b6529){_0x51a27a=_0x51a27a-0x0;var _0x265fbb=_0xbabe[_0x51a27a];return _0x265fbb;};'use strict';var multer=require(_0xebab('0x0'));var util=require(_0xebab('0x1'));var path=require('path');var timeout=require(_0xebab('0x2'));var express=require(_0xebab('0x3'));var router=express[_0xebab('0x4')]();var fs_extra=require(_0xebab('0x5'));var auth=require(_0xebab('0x6'));var interaction=require(_0xebab('0x7'));var config=require('../../config/environment');var controller=require(_0xebab('0x8'));router[_0xebab('0x9')]('/',auth[_0xebab('0xa')](),controller[_0xebab('0xb')]);router[_0xebab('0x9')]('/describe',auth[_0xebab('0xa')](),controller[_0xebab('0xc')]);router[_0xebab('0x9')]('/:id',auth[_0xebab('0xa')](),controller[_0xebab('0xd')]);router['post']('/',auth[_0xebab('0xa')](),controller['create']);router[_0xebab('0xe')](_0xebab('0xf'),auth[_0xebab('0xa')](),controller[_0xebab('0x10')]);router[_0xebab('0x11')]('/:id',auth[_0xebab('0xa')](),controller[_0xebab('0x12')]);module[_0xebab('0x13')]=router; \ No newline at end of file +var _0x8030=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','create','put','/:id','update','destroy','multer'];(function(_0x35561d,_0x59a5cf){var _0x2ccc5b=function(_0x6d37d2){while(--_0x6d37d2){_0x35561d['push'](_0x35561d['shift']());}};_0x2ccc5b(++_0x59a5cf);}(_0x8030,0x1db));var _0x0803=function(_0x39954a,_0x601a95){_0x39954a=_0x39954a-0x0;var _0x134f26=_0x8030[_0x39954a];return _0x134f26;};'use strict';var multer=require(_0x0803('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0803('0x1'));var express=require('express');var router=express[_0x0803('0x2')]();var fs_extra=require(_0x0803('0x3'));var auth=require(_0x0803('0x4'));var interaction=require(_0x0803('0x5'));var config=require(_0x0803('0x6'));var controller=require(_0x0803('0x7'));router[_0x0803('0x8')]('/',auth[_0x0803('0x9')](),controller[_0x0803('0xa')]);router['get'](_0x0803('0xb'),auth[_0x0803('0x9')](),controller['describe']);router[_0x0803('0x8')]('/:id',auth[_0x0803('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0803('0xc')]);router[_0x0803('0xd')](_0x0803('0xe'),auth[_0x0803('0x9')](),controller[_0x0803('0xf')]);router['delete'](_0x0803('0xe'),auth[_0x0803('0x9')](),controller[_0x0803('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index c2ac0f1..c3ed6f8 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3b8ed6,_0x3b5bb6){var _0x2e6223=function(_0x285c81){while(--_0x285c81){_0x3b8ed6['push'](_0x3b8ed6['shift']());}};_0x2e6223(++_0x3b5bb6);}(_0x34e8,0x12c));var _0x834e=function(_0x147598,_0x1a3851){_0x147598=_0x147598-0x0;var _0x555ea8=_0x34e8[_0x147598];return _0x555ea8;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5a8442,_0x2b3948){var _0x37b32f=function(_0x4a1e1b){while(--_0x4a1e1b){_0x5a8442['push'](_0x5a8442['shift']());}};_0x37b32f(++_0x2b3948);}(_0x34e8,0x12c));var _0x834e=function(_0x24bab0,_0x573a05){_0x24bab0=_0x24bab0-0x0;var _0x11ec94=_0x34e8[_0x24bab0];return _0x11ec94;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index afaa092..44c0905 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 _0x9352=['filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','count','includeAll','include','findAll','catch','show','params','merge','options','find','create','body','describe','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys'];(function(_0x5696e5,_0x1790e3){var _0x1e6f57=function(_0xda93de){while(--_0xda93de){_0x5696e5['push'](_0x5696e5['shift']());}};_0x1e6f57(++_0x1790e3);}(_0x9352,0xa9));var _0x2935=function(_0x2cff85,_0x5b6cb2){_0x2cff85=_0x2cff85-0x0;var _0x29dbff=_0x9352[_0x2cff85];return _0x29dbff;};'use strict';var emlformat=require(_0x2935('0x0'));var rimraf=require(_0x2935('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2935('0x2'));var moment=require('moment');var BPromise=require(_0x2935('0x3'));var Mustache=require('mustache');var util=require(_0x2935('0x4'));var path=require(_0x2935('0x5'));var sox=require(_0x2935('0x6'));var csv=require(_0x2935('0x7'));var ejs=require(_0x2935('0x8'));var fs=require('fs');var fs_extra=require(_0x2935('0x9'));var _=require(_0x2935('0xa'));var squel=require(_0x2935('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2935('0xc'));var toCsv=require(_0x2935('0x7'));var querystring=require(_0x2935('0xd'));var Papa=require(_0x2935('0xe'));var Redis=require(_0x2935('0xf'));var authService=require(_0x2935('0x10'));var qs=require(_0x2935('0x11'));var as=require(_0x2935('0x12'));var hardwareService=require(_0x2935('0x13'));var logger=require(_0x2935('0x14'))(_0x2935('0x15'));var utils=require('../../config/utils');var config=require(_0x2935('0x16'));var licenseUtil=require(_0x2935('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2df463,_0x592280){_0x592280=_0x592280||0xcc;return function(_0x57016b){if(_0x57016b){return _0x2df463[_0x2935('0x18')](_0x592280);}return _0x2df463[_0x2935('0x19')](_0x592280)[_0x2935('0x1a')]();};}function respondWithResult(_0x1d7777,_0x1793ec){_0x1793ec=_0x1793ec||0xc8;return function(_0x109c2f){if(_0x109c2f){return _0x1d7777[_0x2935('0x19')](_0x1793ec)[_0x2935('0x1b')](_0x109c2f);}};}function respondWithFilteredResult(_0x3227c6,_0x24a9b4){return function(_0x5d3d43){if(_0x5d3d43){var _0x1fc5e8=typeof _0x24a9b4[_0x2935('0x1c')]===_0x2935('0x1d')&&typeof _0x24a9b4[_0x2935('0x1e')]===_0x2935('0x1d');var _0x5af25b=_0x5d3d43['count'];var _0x44923c=_0x1fc5e8?0x0:_0x24a9b4[_0x2935('0x1c')];var _0x125e7b=_0x1fc5e8?_0x5d3d43['count']:_0x24a9b4[_0x2935('0x1c')]+_0x24a9b4[_0x2935('0x1e')];var _0x5aa518;if(_0x125e7b>=_0x5af25b){_0x125e7b=_0x5af25b;_0x5aa518=0xc8;}else{_0x5aa518=0xce;}_0x3227c6[_0x2935('0x19')](_0x5aa518);return _0x3227c6[_0x2935('0x1f')](_0x2935('0x20'),_0x44923c+'-'+_0x125e7b+'/'+_0x5af25b)[_0x2935('0x1b')](_0x5d3d43);}return null;};}function patchUpdates(_0x32a327){return function(_0x408e22){try{jsonpatch['apply'](_0x408e22,_0x32a327,!![]);}catch(_0x5c60e1){return BPromise[_0x2935('0x21')](_0x5c60e1);}return _0x408e22[_0x2935('0x22')]();};}function saveUpdates(_0x4d5a7e,_0x5c1dcb){return function(_0x531f7c){if(_0x531f7c){return _0x531f7c[_0x2935('0x23')](_0x4d5a7e)[_0x2935('0x24')](function(_0x274c8){return _0x274c8;});}return null;};}function removeEntity(_0x27ec0b,_0x15a481){return function(_0x13bdb5){if(_0x13bdb5){return _0x13bdb5[_0x2935('0x25')]()['then'](function(){_0x27ec0b[_0x2935('0x19')](0xcc)[_0x2935('0x1a')]();});}};}function handleEntityNotFound(_0xc92adc,_0x2caab0){return function(_0x2277d9){if(!_0x2277d9){_0xc92adc[_0x2935('0x18')](0x194);}return _0x2277d9;};}function handleError(_0xc88df,_0xbc88b2){_0xbc88b2=_0xbc88b2||0x1f4;return function(_0x5ee609){logger[_0x2935('0x26')](_0x5ee609['stack']);if(_0x5ee609['name']){delete _0x5ee609[_0x2935('0x27')];}_0xc88df[_0x2935('0x19')](_0xbc88b2)[_0x2935('0x28')](_0x5ee609);};}exports[_0x2935('0x29')]=function(_0x5f4f96,_0x3326dc){var _0x475bbd={},_0x1c7d5f={},_0x3d4309={'count':0x0,'rows':[]};var _0x445120=_[_0x2935('0x2a')](db[_0x2935('0x2b')][_0x2935('0x2c')],function(_0x43bf02){return{'name':_0x43bf02[_0x2935('0x2d')],'type':_0x43bf02[_0x2935('0x2e')]['key']};});_0x1c7d5f[_0x2935('0x2f')]=_[_0x2935('0x2a')](_0x445120,_0x2935('0x27'));_0x1c7d5f[_0x2935('0x30')]=_[_0x2935('0x31')](_0x5f4f96['query']);_0x1c7d5f[_0x2935('0x32')]=_[_0x2935('0x33')](_0x1c7d5f[_0x2935('0x2f')],_0x1c7d5f['query']);_0x475bbd['attributes']=_[_0x2935('0x33')](_0x1c7d5f[_0x2935('0x2f')],qs[_0x2935('0x34')](_0x5f4f96[_0x2935('0x30')][_0x2935('0x34')]));_0x475bbd[_0x2935('0x35')]=_0x475bbd[_0x2935('0x35')][_0x2935('0x36')]?_0x475bbd[_0x2935('0x35')]:_0x1c7d5f[_0x2935('0x2f')];if(!_0x5f4f96[_0x2935('0x30')]['hasOwnProperty'](_0x2935('0x37'))){_0x475bbd[_0x2935('0x1e')]=qs[_0x2935('0x1e')](_0x5f4f96[_0x2935('0x30')][_0x2935('0x1e')]);_0x475bbd[_0x2935('0x1c')]=qs[_0x2935('0x1c')](_0x5f4f96[_0x2935('0x30')][_0x2935('0x1c')]);}_0x475bbd[_0x2935('0x38')]=qs[_0x2935('0x39')](_0x5f4f96[_0x2935('0x30')]['sort']);_0x475bbd['where']=qs[_0x2935('0x32')](_['pick'](_0x5f4f96[_0x2935('0x30')],_0x1c7d5f['filters']),_0x445120);if(_0x5f4f96[_0x2935('0x30')]['filter']){_0x475bbd['where']=_['merge'](_0x475bbd['where'],{'$or':_[_0x2935('0x2a')](_0x445120,function(_0x20f948){if(_0x20f948[_0x2935('0x2e')]!=='VIRTUAL'){var _0x83afd7={};_0x83afd7[_0x20f948[_0x2935('0x27')]]={'$like':'%'+_0x5f4f96[_0x2935('0x30')][_0x2935('0x3a')]+'%'};return _0x83afd7;}})});}_0x475bbd=_['merge']({},_0x475bbd,_0x5f4f96['options']);var _0x2deab1={'where':_0x475bbd[_0x2935('0x3b')]};return db[_0x2935('0x2b')]['count'](_0x2deab1)['then'](function(_0x9ec12c){_0x3d4309[_0x2935('0x3c')]=_0x9ec12c;if(_0x5f4f96[_0x2935('0x30')][_0x2935('0x3d')]){_0x475bbd[_0x2935('0x3e')]=[{'all':!![]}];}return db[_0x2935('0x2b')][_0x2935('0x3f')](_0x475bbd);})[_0x2935('0x24')](function(_0x4f284a){_0x3d4309['rows']=_0x4f284a;return _0x3d4309;})['then'](respondWithFilteredResult(_0x3326dc,_0x475bbd))[_0x2935('0x40')](handleError(_0x3326dc,null));};exports[_0x2935('0x41')]=function(_0x36ccb0,_0x16c265){var _0x5da963={'raw':!![],'where':{'id':_0x36ccb0[_0x2935('0x42')]['id']}},_0x59c942={};_0x59c942[_0x2935('0x2f')]=_['keys'](db[_0x2935('0x2b')]['rawAttributes']);_0x59c942[_0x2935('0x30')]=_[_0x2935('0x31')](_0x36ccb0['query']);_0x59c942[_0x2935('0x32')]=_['intersection'](_0x59c942[_0x2935('0x2f')],_0x59c942[_0x2935('0x30')]);_0x5da963['attributes']=_[_0x2935('0x33')](_0x59c942['model'],qs[_0x2935('0x34')](_0x36ccb0[_0x2935('0x30')]['fields']));_0x5da963['attributes']=_0x5da963[_0x2935('0x35')][_0x2935('0x36')]?_0x5da963[_0x2935('0x35')]:_0x59c942[_0x2935('0x2f')];if(_0x36ccb0[_0x2935('0x30')]['includeAll']){_0x5da963[_0x2935('0x3e')]=[{'all':!![]}];}_0x5da963=_[_0x2935('0x43')]({},_0x5da963,_0x36ccb0[_0x2935('0x44')]);return db['OpenchannelTransferReport'][_0x2935('0x45')](_0x5da963)[_0x2935('0x24')](handleEntityNotFound(_0x16c265,null))[_0x2935('0x24')](respondWithResult(_0x16c265,null))['catch'](handleError(_0x16c265,null));};exports[_0x2935('0x46')]=function(_0x3f437c,_0x4ddccf){return db[_0x2935('0x2b')][_0x2935('0x46')](_0x3f437c[_0x2935('0x47')],{})[_0x2935('0x24')](respondWithResult(_0x4ddccf,0xc9))[_0x2935('0x40')](handleError(_0x4ddccf,null));};exports[_0x2935('0x23')]=function(_0x4c4faa,_0x4c8305){if(_0x4c4faa[_0x2935('0x47')]['id']){delete _0x4c4faa['body']['id'];}return db[_0x2935('0x2b')][_0x2935('0x45')]({'where':{'id':_0x4c4faa[_0x2935('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c8305,null))['then'](saveUpdates(_0x4c4faa[_0x2935('0x47')],null))[_0x2935('0x24')](respondWithResult(_0x4c8305,null))[_0x2935('0x40')](handleError(_0x4c8305,null));};exports['destroy']=function(_0x286d5f,_0x4775cd){return db[_0x2935('0x2b')][_0x2935('0x45')]({'where':{'id':_0x286d5f[_0x2935('0x42')]['id']}})[_0x2935('0x24')](handleEntityNotFound(_0x4775cd,null))[_0x2935('0x24')](removeEntity(_0x4775cd,null))[_0x2935('0x40')](handleError(_0x4775cd,null));};exports[_0x2935('0x48')]=function(_0x404d57,_0x1a2f78){return db[_0x2935('0x2b')][_0x2935('0x48')]()[_0x2935('0x24')](respondWithResult(_0x1a2f78,null))['catch'](handleError(_0x1a2f78,null));}; \ No newline at end of file +var _0xce8a=['crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','rimraf','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x59175d,_0x431b73){var _0x372dcf=function(_0x32621c){while(--_0x32621c){_0x59175d['push'](_0x59175d['shift']());}};_0x372dcf(++_0x431b73);}(_0xce8a,0x85));var _0xace8=function(_0x9af233,_0x26f5f1){_0x9af233=_0x9af233-0x0;var _0xf5ec4f=_0xce8a[_0x9af233];return _0xf5ec4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xace8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xace8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xace8('0x2'));var util=require(_0xace8('0x3'));var path=require('path');var sox=require(_0xace8('0x4'));var csv=require(_0xace8('0x5'));var ejs=require(_0xace8('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xace8('0x7'));var squel=require(_0xace8('0x8'));var crypto=require(_0xace8('0x9'));var jsforce=require(_0xace8('0xa'));var deskjs=require(_0xace8('0xb'));var toCsv=require(_0xace8('0x5'));var querystring=require('querystring');var Papa=require(_0xace8('0xc'));var Redis=require('ioredis');var authService=require(_0xace8('0xd'));var qs=require(_0xace8('0xe'));var as=require(_0xace8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xace8('0x10'))(_0xace8('0x11'));var utils=require(_0xace8('0x12'));var config=require(_0xace8('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xace8('0x14'))['db'];function respondWithStatusCode(_0x46d75b,_0xf78334){_0xf78334=_0xf78334||0xcc;return function(_0x163857){if(_0x163857){return _0x46d75b[_0xace8('0x15')](_0xf78334);}return _0x46d75b[_0xace8('0x16')](_0xf78334)[_0xace8('0x17')]();};}function respondWithResult(_0xe8f898,_0x255410){_0x255410=_0x255410||0xc8;return function(_0xc9bc43){if(_0xc9bc43){return _0xe8f898['status'](_0x255410)['json'](_0xc9bc43);}};}function respondWithFilteredResult(_0x2f0565,_0x1af5ef){return function(_0x4f02ad){if(_0x4f02ad){var _0x562175=typeof _0x1af5ef['offset']===_0xace8('0x18')&&typeof _0x1af5ef[_0xace8('0x19')]===_0xace8('0x18');var _0x38317c=_0x4f02ad[_0xace8('0x1a')];var _0x377387=_0x562175?0x0:_0x1af5ef[_0xace8('0x1b')];var _0x155c56=_0x562175?_0x4f02ad[_0xace8('0x1a')]:_0x1af5ef[_0xace8('0x1b')]+_0x1af5ef[_0xace8('0x19')];var _0x696763;if(_0x155c56>=_0x38317c){_0x155c56=_0x38317c;_0x696763=0xc8;}else{_0x696763=0xce;}_0x2f0565[_0xace8('0x16')](_0x696763);return _0x2f0565[_0xace8('0x1c')](_0xace8('0x1d'),_0x377387+'-'+_0x155c56+'/'+_0x38317c)['json'](_0x4f02ad);}return null;};}function patchUpdates(_0x1548a5){return function(_0x1530ee){try{jsonpatch[_0xace8('0x1e')](_0x1530ee,_0x1548a5,!![]);}catch(_0x4584ed){return BPromise['reject'](_0x4584ed);}return _0x1530ee['save']();};}function saveUpdates(_0xdded89,_0x4f755f){return function(_0x277b67){if(_0x277b67){return _0x277b67['update'](_0xdded89)[_0xace8('0x1f')](function(_0x4248eb){return _0x4248eb;});}return null;};}function removeEntity(_0x4719f1,_0x1876e4){return function(_0x243ccb){if(_0x243ccb){return _0x243ccb[_0xace8('0x20')]()[_0xace8('0x1f')](function(){_0x4719f1[_0xace8('0x16')](0xcc)[_0xace8('0x17')]();});}};}function handleEntityNotFound(_0x4295fc,_0x2177b2){return function(_0x5e3446){if(!_0x5e3446){_0x4295fc[_0xace8('0x15')](0x194);}return _0x5e3446;};}function handleError(_0x79b042,_0x5df6cb){_0x5df6cb=_0x5df6cb||0x1f4;return function(_0x34f82a){logger[_0xace8('0x21')](_0x34f82a[_0xace8('0x22')]);if(_0x34f82a[_0xace8('0x23')]){delete _0x34f82a['name'];}_0x79b042[_0xace8('0x16')](_0x5df6cb)[_0xace8('0x24')](_0x34f82a);};}exports[_0xace8('0x25')]=function(_0x15f6cf,_0x1d7a95){var _0x3ac2bb={},_0x504b48={},_0x53a548={'count':0x0,'rows':[]};var _0x269204=_['map'](db[_0xace8('0x26')][_0xace8('0x27')],function(_0x4910a1){return{'name':_0x4910a1[_0xace8('0x28')],'type':_0x4910a1[_0xace8('0x29')][_0xace8('0x2a')]};});_0x504b48[_0xace8('0x2b')]=_[_0xace8('0x2c')](_0x269204,_0xace8('0x23'));_0x504b48[_0xace8('0x2d')]=_['keys'](_0x15f6cf[_0xace8('0x2d')]);_0x504b48[_0xace8('0x2e')]=_[_0xace8('0x2f')](_0x504b48[_0xace8('0x2b')],_0x504b48[_0xace8('0x2d')]);_0x3ac2bb[_0xace8('0x30')]=_['intersection'](_0x504b48[_0xace8('0x2b')],qs['fields'](_0x15f6cf[_0xace8('0x2d')][_0xace8('0x31')]));_0x3ac2bb['attributes']=_0x3ac2bb[_0xace8('0x30')][_0xace8('0x32')]?_0x3ac2bb[_0xace8('0x30')]:_0x504b48['model'];if(!_0x15f6cf[_0xace8('0x2d')][_0xace8('0x33')](_0xace8('0x34'))){_0x3ac2bb[_0xace8('0x19')]=qs['limit'](_0x15f6cf['query'][_0xace8('0x19')]);_0x3ac2bb['offset']=qs[_0xace8('0x1b')](_0x15f6cf['query']['offset']);}_0x3ac2bb[_0xace8('0x35')]=qs[_0xace8('0x36')](_0x15f6cf[_0xace8('0x2d')][_0xace8('0x36')]);_0x3ac2bb[_0xace8('0x37')]=qs[_0xace8('0x2e')](_[_0xace8('0x38')](_0x15f6cf[_0xace8('0x2d')],_0x504b48[_0xace8('0x2e')]),_0x269204);if(_0x15f6cf[_0xace8('0x2d')]['filter']){_0x3ac2bb[_0xace8('0x37')]=_[_0xace8('0x39')](_0x3ac2bb[_0xace8('0x37')],{'$or':_[_0xace8('0x2c')](_0x269204,function(_0x395816){if(_0x395816[_0xace8('0x29')]!==_0xace8('0x3a')){var _0x4aacbf={};_0x4aacbf[_0x395816[_0xace8('0x23')]]={'$like':'%'+_0x15f6cf['query'][_0xace8('0x3b')]+'%'};return _0x4aacbf;}})});}_0x3ac2bb=_[_0xace8('0x39')]({},_0x3ac2bb,_0x15f6cf['options']);var _0x57340b={'where':_0x3ac2bb['where']};return db[_0xace8('0x26')]['count'](_0x57340b)['then'](function(_0x178f24){_0x53a548[_0xace8('0x1a')]=_0x178f24;if(_0x15f6cf['query'][_0xace8('0x3c')]){_0x3ac2bb[_0xace8('0x3d')]=[{'all':!![]}];}return db[_0xace8('0x26')][_0xace8('0x3e')](_0x3ac2bb);})['then'](function(_0x1e697e){_0x53a548['rows']=_0x1e697e;return _0x53a548;})[_0xace8('0x1f')](respondWithFilteredResult(_0x1d7a95,_0x3ac2bb))[_0xace8('0x3f')](handleError(_0x1d7a95,null));};exports[_0xace8('0x40')]=function(_0x5d5b2e,_0x1e3ad8){var _0x1218ed={'raw':!![],'where':{'id':_0x5d5b2e[_0xace8('0x41')]['id']}},_0x4ff3f5={};_0x4ff3f5[_0xace8('0x2b')]=_['keys'](db['OpenchannelTransferReport']['rawAttributes']);_0x4ff3f5['query']=_[_0xace8('0x42')](_0x5d5b2e[_0xace8('0x2d')]);_0x4ff3f5['filters']=_[_0xace8('0x2f')](_0x4ff3f5[_0xace8('0x2b')],_0x4ff3f5[_0xace8('0x2d')]);_0x1218ed['attributes']=_[_0xace8('0x2f')](_0x4ff3f5['model'],qs['fields'](_0x5d5b2e[_0xace8('0x2d')][_0xace8('0x31')]));_0x1218ed[_0xace8('0x30')]=_0x1218ed[_0xace8('0x30')][_0xace8('0x32')]?_0x1218ed[_0xace8('0x30')]:_0x4ff3f5[_0xace8('0x2b')];if(_0x5d5b2e[_0xace8('0x2d')][_0xace8('0x3c')]){_0x1218ed[_0xace8('0x3d')]=[{'all':!![]}];}_0x1218ed=_[_0xace8('0x39')]({},_0x1218ed,_0x5d5b2e['options']);return db[_0xace8('0x26')][_0xace8('0x43')](_0x1218ed)[_0xace8('0x1f')](handleEntityNotFound(_0x1e3ad8,null))['then'](respondWithResult(_0x1e3ad8,null))[_0xace8('0x3f')](handleError(_0x1e3ad8,null));};exports['create']=function(_0x4d951c,_0x3df333){return db[_0xace8('0x26')][_0xace8('0x44')](_0x4d951c['body'],{})[_0xace8('0x1f')](respondWithResult(_0x3df333,0xc9))[_0xace8('0x3f')](handleError(_0x3df333,null));};exports['update']=function(_0x3c9559,_0x21de20){if(_0x3c9559[_0xace8('0x45')]['id']){delete _0x3c9559[_0xace8('0x45')]['id'];}return db['OpenchannelTransferReport'][_0xace8('0x43')]({'where':{'id':_0x3c9559['params']['id']}})['then'](handleEntityNotFound(_0x21de20,null))[_0xace8('0x1f')](saveUpdates(_0x3c9559[_0xace8('0x45')],null))[_0xace8('0x1f')](respondWithResult(_0x21de20,null))[_0xace8('0x3f')](handleError(_0x21de20,null));};exports[_0xace8('0x20')]=function(_0x2e8572,_0x1339a2){return db[_0xace8('0x26')]['find']({'where':{'id':_0x2e8572['params']['id']}})['then'](handleEntityNotFound(_0x1339a2,null))[_0xace8('0x1f')](removeEntity(_0x1339a2,null))[_0xace8('0x3f')](handleError(_0x1339a2,null));};exports[_0xace8('0x46')]=function(_0x5895a7,_0x5e4a91){return db[_0xace8('0x26')]['describe']()['then'](respondWithResult(_0x5e4a91,null))['catch'](handleError(_0x5e4a91,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 91884b7..139aff9 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 _0xabbd=['bluebird','request-promise','rimraf','../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0xc183d4,_0x1d8e6c){var _0x2e38a8=function(_0x34b7b2){while(--_0x34b7b2){_0xc183d4['push'](_0xc183d4['shift']());}};_0x2e38a8(++_0x1d8e6c);}(_0xabbd,0x166));var _0xdabb=function(_0x5c45cf,_0x1b2b16){_0x5c45cf=_0x5c45cf-0x0;var _0x3feb27=_0xabbd[_0x5c45cf];return _0x3feb27;};'use strict';var _=require(_0xdabb('0x0'));var util=require(_0xdabb('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdabb('0x2'));var rp=require(_0xdabb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdabb('0x4'));var config=require(_0xdabb('0x5'));var attributes=require('./openchannelTransferReport.attributes');module[_0xdabb('0x6')]=function(_0x5263fd,_0x9021e){return _0x5263fd['define'](_0xdabb('0x7'),attributes,{'tableName':_0xdabb('0x8'),'paranoid':![],'indexes':[{'name':_0xdabb('0x9'),'fields':[_0xdabb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cbf=['report_openchannel_transfer','uniqueid','lodash','util','moment','bluebird','request-promise','rimraf','exports','define'];(function(_0x37978c,_0x29ed82){var _0x18306c=function(_0x47880c){while(--_0x47880c){_0x37978c['push'](_0x37978c['shift']());}};_0x18306c(++_0x29ed82);}(_0x4cbf,0x174));var _0xf4cb=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x4cbf[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0xf4cb('0x0'));var util=require(_0xf4cb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf4cb('0x2'));var BPromise=require(_0xf4cb('0x3'));var rp=require(_0xf4cb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf4cb('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0xf4cb('0x6')]=function(_0x5aa409,_0x5933ce){return _0x5aa409[_0xf4cb('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0xf4cb('0x8'),'paranoid':![],'indexes':[{'name':_0xf4cb('0x9'),'fields':[_0xf4cb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index bf845aa..ece3fb0 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 _0x6011=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','ioredis','../../mysqldb'];(function(_0x2292a5,_0x2733a){var _0x2f0487=function(_0x1d6a01){while(--_0x1d6a01){_0x2292a5['push'](_0x2292a5['shift']());}};_0x2f0487(++_0x2733a);}(_0x6011,0x196));var _0x1601=function(_0x2b7a8e,_0x122416){_0x2b7a8e=_0x2b7a8e-0x0;var _0x519b8b=_0x6011[_0x2b7a8e];return _0x519b8b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1601('0x0'));var db=require(_0x1601('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x1601('0x2'))(_0x1601('0x3'));var config=require(_0x1601('0x4'));var jayson=require(_0x1601('0x5'));var client=jayson[_0x1601('0x6')][_0x1601('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x277bfc,_0x1e7cf6,_0x18e06c){return new BPromise(function(_0x99dee1,_0x55b751){return client[_0x1601('0x8')](_0x277bfc,_0x18e06c)[_0x1601('0x9')](function(_0x1e3488){logger[_0x1601('0xa')](_0x1601('0xb'),_0x1e7cf6,'request\x20sent');logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x1e7cf6,_0x1601('0xc'),JSON['stringify'](_0x1e3488));if(_0x1e3488[_0x1601('0xd')]){if(_0x1e3488[_0x1601('0xd')][_0x1601('0xe')]===0x1f4){logger[_0x1601('0xd')](_0x1601('0xb'),_0x1e7cf6,_0x1e3488[_0x1601('0xd')][_0x1601('0xf')]);return _0x55b751(_0x1e3488[_0x1601('0xd')]['message']);}logger[_0x1601('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1e7cf6,_0x1e3488[_0x1601('0xd')]['message']);return _0x99dee1(_0x1e3488[_0x1601('0xd')][_0x1601('0xf')]);}else{logger['info'](_0x1601('0xb'),_0x1e7cf6,_0x1601('0xc'));_0x99dee1(_0x1e3488[_0x1601('0x10')]['message']);}})['catch'](function(_0x24c0ab){logger[_0x1601('0xd')](_0x1601('0xb'),_0x1e7cf6,_0x24c0ab);_0x55b751(_0x24c0ab);});});} \ No newline at end of file +var _0x9b67=['code','message','OpenchannelTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x94ba8d,_0xd53c4c){var _0x406a50=function(_0x391faa){while(--_0x391faa){_0x94ba8d['push'](_0x94ba8d['shift']());}};_0x406a50(++_0xd53c4c);}(_0x9b67,0xf6));var _0x79b6=function(_0x1104a3,_0x447f40){_0x1104a3=_0x1104a3-0x0;var _0x2c64a1=_0x9b67[_0x1104a3];return _0x2c64a1;};'use strict';var _=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var moment=require(_0x79b6('0x2'));var BPromise=require(_0x79b6('0x3'));var rs=require(_0x79b6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79b6('0x5'))['db'];var utils=require(_0x79b6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x79b6('0x7'));var jayson=require(_0x79b6('0x8'));var client=jayson[_0x79b6('0x9')][_0x79b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfa6a05,_0x128543,_0x34adbe){return new BPromise(function(_0x58ae2d,_0x1270a7){return client[_0x79b6('0xb')](_0xfa6a05,_0x34adbe)[_0x79b6('0xc')](function(_0x3d28cd){logger[_0x79b6('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x128543,_0x79b6('0xe'));logger[_0x79b6('0xf')](_0x79b6('0x10'),_0x128543,_0x79b6('0xe'),JSON['stringify'](_0x3d28cd));if(_0x3d28cd['error']){if(_0x3d28cd[_0x79b6('0x11')][_0x79b6('0x12')]===0x1f4){logger[_0x79b6('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x128543,_0x3d28cd[_0x79b6('0x11')][_0x79b6('0x13')]);return _0x1270a7(_0x3d28cd[_0x79b6('0x11')][_0x79b6('0x13')]);}logger[_0x79b6('0x11')](_0x79b6('0x14'),_0x128543,_0x3d28cd[_0x79b6('0x11')][_0x79b6('0x13')]);return _0x58ae2d(_0x3d28cd[_0x79b6('0x11')][_0x79b6('0x13')]);}else{logger[_0x79b6('0xd')](_0x79b6('0x14'),_0x128543,_0x79b6('0xe'));_0x58ae2d(_0x3d28cd['result'][_0x79b6('0x13')]);}})[_0x79b6('0x15')](function(_0xc36fd3){logger[_0x79b6('0x11')](_0x79b6('0x14'),_0x128543,_0xc36fd3);_0x1270a7(_0xc36fd3);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 397a16e..a0e62f0 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 _0xb7cb=['create','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2583a7,_0x3beef9){var _0x35de7b=function(_0x29e036){while(--_0x29e036){_0x2583a7['push'](_0x2583a7['shift']());}};_0x35de7b(++_0x3beef9);}(_0xb7cb,0x157));var _0xbb7c=function(_0x1b40b5,_0x25e063){_0x1b40b5=_0x1b40b5-0x0;var _0x5f0a6e=_0xb7cb[_0x1b40b5];return _0x5f0a6e;};'use strict';var multer=require(_0xbb7c('0x0'));var util=require(_0xbb7c('0x1'));var path=require(_0xbb7c('0x2'));var timeout=require(_0xbb7c('0x3'));var express=require(_0xbb7c('0x4'));var router=express[_0xbb7c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbb7c('0x6'));var interaction=require(_0xbb7c('0x7'));var config=require(_0xbb7c('0x8'));var controller=require('./pause.controller');router[_0xbb7c('0x9')]('/',auth[_0xbb7c('0xa')](),controller[_0xbb7c('0xb')]);router['get'](_0xbb7c('0xc'),auth[_0xbb7c('0xa')](),controller[_0xbb7c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb7c('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbb7c('0xf')](_0xbb7c('0xc'),auth[_0xbb7c('0xa')](),controller['destroy']);module[_0xbb7c('0x10')]=router; \ No newline at end of file +var _0x1d60=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x2ca934,_0x5b51e5){var _0x4b27bd=function(_0x2aaabb){while(--_0x2aaabb){_0x2ca934['push'](_0x2ca934['shift']());}};_0x4b27bd(++_0x5b51e5);}(_0x1d60,0x6e));var _0x01d6=function(_0xd6a3d6,_0x40338e){_0xd6a3d6=_0xd6a3d6-0x0;var _0x62a7ee=_0x1d60[_0xd6a3d6];return _0x62a7ee;};'use strict';var multer=require(_0x01d6('0x0'));var util=require(_0x01d6('0x1'));var path=require(_0x01d6('0x2'));var timeout=require(_0x01d6('0x3'));var express=require(_0x01d6('0x4'));var router=express[_0x01d6('0x5')]();var fs_extra=require(_0x01d6('0x6'));var auth=require(_0x01d6('0x7'));var interaction=require(_0x01d6('0x8'));var config=require(_0x01d6('0x9'));var controller=require(_0x01d6('0xa'));router[_0x01d6('0xb')]('/',auth[_0x01d6('0xc')](),controller[_0x01d6('0xd')]);router[_0x01d6('0xb')]('/:id',auth[_0x01d6('0xc')](),controller[_0x01d6('0xe')]);router['post']('/',auth[_0x01d6('0xc')](),controller[_0x01d6('0xf')]);router[_0x01d6('0x10')](_0x01d6('0x11'),auth[_0x01d6('0xc')](),controller[_0x01d6('0x12')]);router[_0x01d6('0x13')]('/:id',auth[_0x01d6('0xc')](),controller[_0x01d6('0x14')]);module[_0x01d6('0x15')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index d4e6256..c4f892e 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 _0xc471=['STRING','name'];(function(_0x11a7ba,_0x1cfcfe){var _0x310c5a=function(_0x104048){while(--_0x104048){_0x11a7ba['push'](_0x11a7ba['shift']());}};_0x310c5a(++_0x1cfcfe);}(_0xc471,0x68));var _0x1c47=function(_0x2bc362,_0xa380e3){_0x2bc362=_0x2bc362-0x0;var _0x1f13e2=_0xc471[_0x2bc362];return _0x1f13e2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1c47('0x0')],'unique':_0x1c47('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x1c47('0x0')]}}; \ No newline at end of file +var _0x80dd=['STRING','sequelize','exports'];(function(_0xc858d0,_0x1c7cf0){var _0x42ae20=function(_0x49815f){while(--_0x49815f){_0xc858d0['push'](_0xc858d0['shift']());}};_0x42ae20(++_0x1c7cf0);}(_0x80dd,0x1d8));var _0xd80d=function(_0x3aac77,_0x16dbe5){_0x3aac77=_0x3aac77-0x0;var _0x34be18=_0x80dd[_0x3aac77];return _0x34be18;};'use strict';var Sequelize=require(_0xd80d('0x0'));module[_0xd80d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd80d('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 86fcab2..00ce159 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 _0xabf6=['VIRTUAL','options','Pause','then','includeAll','include','findAll','rows','catch','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','Pauses','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge'];(function(_0x300809,_0x1b16a5){var _0x2ea75e=function(_0x47d968){while(--_0x47d968){_0x300809['push'](_0x300809['shift']());}};_0x2ea75e(++_0x1b16a5);}(_0xabf6,0xba));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6abf('0x0'));var zipdir=require(_0x6abf('0x1'));var jsonpatch=require(_0x6abf('0x2'));var rp=require(_0x6abf('0x3'));var moment=require(_0x6abf('0x4'));var BPromise=require(_0x6abf('0x5'));var Mustache=require(_0x6abf('0x6'));var util=require(_0x6abf('0x7'));var path=require('path');var sox=require(_0x6abf('0x8'));var csv=require('to-csv');var ejs=require(_0x6abf('0x9'));var fs=require('fs');var fs_extra=require(_0x6abf('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6abf('0xb'));var jsforce=require(_0x6abf('0xc'));var deskjs=require(_0x6abf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6abf('0xe'));var Papa=require(_0x6abf('0xf'));var Redis=require(_0x6abf('0x10'));var authService=require(_0x6abf('0x11'));var qs=require(_0x6abf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6abf('0x13'));var logger=require(_0x6abf('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6abf('0x15'));var licenseUtil=require(_0x6abf('0x16'));var db=require(_0x6abf('0x17'))['db'];function respondWithStatusCode(_0x272ed6,_0x223911){_0x223911=_0x223911||0xcc;return function(_0x1f042f){if(_0x1f042f){return _0x272ed6[_0x6abf('0x18')](_0x223911);}return _0x272ed6['status'](_0x223911)[_0x6abf('0x19')]();};}function respondWithResult(_0x45b83a,_0x43be3c){_0x43be3c=_0x43be3c||0xc8;return function(_0xc06c41){if(_0xc06c41){return _0x45b83a[_0x6abf('0x1a')](_0x43be3c)[_0x6abf('0x1b')](_0xc06c41);}};}function respondWithFilteredResult(_0x374acd,_0x1b3915){return function(_0x5d0d68){if(_0x5d0d68){var _0x11ed27=typeof _0x1b3915[_0x6abf('0x1c')]===_0x6abf('0x1d')&&typeof _0x1b3915[_0x6abf('0x1e')]===_0x6abf('0x1d');var _0x19e8aa=_0x5d0d68['count'];var _0x52177c=_0x11ed27?0x0:_0x1b3915[_0x6abf('0x1c')];var _0x1c58d4=_0x11ed27?_0x5d0d68[_0x6abf('0x1f')]:_0x1b3915[_0x6abf('0x1c')]+_0x1b3915['limit'];var _0x3b1016;if(_0x1c58d4>=_0x19e8aa){_0x1c58d4=_0x19e8aa;_0x3b1016=0xc8;}else{_0x3b1016=0xce;}_0x374acd[_0x6abf('0x1a')](_0x3b1016);return _0x374acd[_0x6abf('0x20')](_0x6abf('0x21'),_0x52177c+'-'+_0x1c58d4+'/'+_0x19e8aa)[_0x6abf('0x1b')](_0x5d0d68);}return null;};}function patchUpdates(_0x473cb4){return function(_0x591885){try{jsonpatch[_0x6abf('0x22')](_0x591885,_0x473cb4,!![]);}catch(_0x46bc4c){return BPromise[_0x6abf('0x23')](_0x46bc4c);}return _0x591885[_0x6abf('0x24')]();};}function saveUpdates(_0x44f86d,_0x5844e1){return function(_0x3d7f94){if(_0x3d7f94){return _0x3d7f94[_0x6abf('0x25')](_0x44f86d)['then'](function(_0x163b20){return _0x163b20;});}return null;};}function removeEntity(_0x574792,_0x4b7790){return function(_0x210863){if(_0x210863){return _0x210863['destroy']()['then'](function(){var _0xba3d66=_0x210863['get']({'plain':!![]});var _0x3a6ffc=_0x6abf('0x26');return db[_0x6abf('0x27')][_0x6abf('0x28')]({'where':{'type':_0x3a6ffc,'resourceId':_0xba3d66['id']}})['then'](function(){return _0x210863;});})['then'](function(){_0x574792[_0x6abf('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58b8e6,_0x499204){return function(_0x688d0d){if(!_0x688d0d){_0x58b8e6[_0x6abf('0x18')](0x194);}return _0x688d0d;};}function handleError(_0xb71cbe,_0x4e87dd){_0x4e87dd=_0x4e87dd||0x1f4;return function(_0x4ae152){logger[_0x6abf('0x29')](_0x4ae152[_0x6abf('0x2a')]);if(_0x4ae152[_0x6abf('0x2b')]){delete _0x4ae152[_0x6abf('0x2b')];}_0xb71cbe[_0x6abf('0x1a')](_0x4e87dd)[_0x6abf('0x2c')](_0x4ae152);};}exports[_0x6abf('0x2d')]=function(_0x4dbe84,_0x5db4c9){var _0x8fbb4f={},_0x1b02ad={},_0x233245={'count':0x0,'rows':[]};var _0x43b3fa=_[_0x6abf('0x2e')](db['Pause'][_0x6abf('0x2f')],function(_0x4db3cc){return{'name':_0x4db3cc['fieldName'],'type':_0x4db3cc[_0x6abf('0x30')][_0x6abf('0x31')]};});_0x1b02ad[_0x6abf('0x32')]=_[_0x6abf('0x2e')](_0x43b3fa,_0x6abf('0x2b'));_0x1b02ad[_0x6abf('0x33')]=_['keys'](_0x4dbe84[_0x6abf('0x33')]);_0x1b02ad[_0x6abf('0x34')]=_[_0x6abf('0x35')](_0x1b02ad[_0x6abf('0x32')],_0x1b02ad[_0x6abf('0x33')]);_0x8fbb4f['attributes']=_['intersection'](_0x1b02ad['model'],qs[_0x6abf('0x36')](_0x4dbe84[_0x6abf('0x33')][_0x6abf('0x36')]));_0x8fbb4f['attributes']=_0x8fbb4f[_0x6abf('0x37')][_0x6abf('0x38')]?_0x8fbb4f[_0x6abf('0x37')]:_0x1b02ad['model'];if(!_0x4dbe84[_0x6abf('0x33')][_0x6abf('0x39')]('nolimit')){_0x8fbb4f[_0x6abf('0x1e')]=qs[_0x6abf('0x1e')](_0x4dbe84[_0x6abf('0x33')]['limit']);_0x8fbb4f[_0x6abf('0x1c')]=qs[_0x6abf('0x1c')](_0x4dbe84[_0x6abf('0x33')][_0x6abf('0x1c')]);}_0x8fbb4f['order']=qs[_0x6abf('0x3a')](_0x4dbe84[_0x6abf('0x33')][_0x6abf('0x3a')]);_0x8fbb4f[_0x6abf('0x3b')]=qs[_0x6abf('0x34')](_[_0x6abf('0x3c')](_0x4dbe84[_0x6abf('0x33')],_0x1b02ad[_0x6abf('0x34')]),_0x43b3fa);if(_0x4dbe84[_0x6abf('0x33')][_0x6abf('0x3d')]){_0x8fbb4f[_0x6abf('0x3b')]=_[_0x6abf('0x3e')](_0x8fbb4f[_0x6abf('0x3b')],{'$or':_[_0x6abf('0x2e')](_0x43b3fa,function(_0xe501b7){if(_0xe501b7[_0x6abf('0x30')]!==_0x6abf('0x3f')){var _0x23e56a={};_0x23e56a[_0xe501b7[_0x6abf('0x2b')]]={'$like':'%'+_0x4dbe84['query'][_0x6abf('0x3d')]+'%'};return _0x23e56a;}})});}_0x8fbb4f=_['merge']({},_0x8fbb4f,_0x4dbe84[_0x6abf('0x40')]);var _0x76f13d={'where':_0x8fbb4f[_0x6abf('0x3b')]};return db[_0x6abf('0x41')][_0x6abf('0x1f')](_0x76f13d)[_0x6abf('0x42')](function(_0x3b7255){_0x233245[_0x6abf('0x1f')]=_0x3b7255;if(_0x4dbe84[_0x6abf('0x33')][_0x6abf('0x43')]){_0x8fbb4f[_0x6abf('0x44')]=[{'all':!![]}];}return db[_0x6abf('0x41')][_0x6abf('0x45')](_0x8fbb4f);})[_0x6abf('0x42')](function(_0x31f40){_0x233245[_0x6abf('0x46')]=_0x31f40;return _0x233245;})['then'](respondWithFilteredResult(_0x5db4c9,_0x8fbb4f))[_0x6abf('0x47')](handleError(_0x5db4c9,null));};exports['show']=function(_0x1030fd,_0xbce7ad){var _0x26e599={'raw':!![],'where':{'id':_0x1030fd[_0x6abf('0x48')]['id']}},_0x4ed103={};_0x4ed103[_0x6abf('0x32')]=_[_0x6abf('0x49')](db[_0x6abf('0x41')][_0x6abf('0x2f')]);_0x4ed103[_0x6abf('0x33')]=_['keys'](_0x1030fd[_0x6abf('0x33')]);_0x4ed103['filters']=_[_0x6abf('0x35')](_0x4ed103[_0x6abf('0x32')],_0x4ed103[_0x6abf('0x33')]);_0x26e599[_0x6abf('0x37')]=_[_0x6abf('0x35')](_0x4ed103[_0x6abf('0x32')],qs[_0x6abf('0x36')](_0x1030fd[_0x6abf('0x33')][_0x6abf('0x36')]));_0x26e599[_0x6abf('0x37')]=_0x26e599[_0x6abf('0x37')][_0x6abf('0x38')]?_0x26e599[_0x6abf('0x37')]:_0x4ed103['model'];if(_0x1030fd['query'][_0x6abf('0x43')]){_0x26e599[_0x6abf('0x44')]=[{'all':!![]}];}_0x26e599=_[_0x6abf('0x3e')]({},_0x26e599,_0x1030fd['options']);return db[_0x6abf('0x41')][_0x6abf('0x4a')](_0x26e599)['then'](handleEntityNotFound(_0xbce7ad,null))[_0x6abf('0x42')](respondWithResult(_0xbce7ad,null))[_0x6abf('0x47')](handleError(_0xbce7ad,null));};exports[_0x6abf('0x4b')]=function(_0x39af66,_0x1aaaab){return db[_0x6abf('0x41')][_0x6abf('0x4b')](_0x39af66['body'],{})['then'](function(_0x41a709){var _0x21c4f7=_0x39af66[_0x6abf('0x4c')][_0x6abf('0x4d')]({'plain':!![]});if(!_0x21c4f7)throw new Error(_0x6abf('0x4e'));if(_0x21c4f7[_0x6abf('0x4f')]==='user'){var _0x364562=_0x41a709[_0x6abf('0x4d')]({'plain':!![]});var _0x4e906b='Pauses';return db[_0x6abf('0x50')]['find']({'where':{'name':_0x4e906b,'userProfileId':_0x21c4f7[_0x6abf('0x51')]},'raw':!![]})[_0x6abf('0x42')](function(_0x1ec15f){if(_0x1ec15f&&_0x1ec15f['autoAssociation']===0x0){return db[_0x6abf('0x27')]['create']({'name':_0x364562[_0x6abf('0x2b')],'resourceId':_0x364562['id'],'type':_0x1ec15f[_0x6abf('0x2b')],'sectionId':_0x1ec15f['id']},{})[_0x6abf('0x42')](function(){return _0x41a709;});}else{return _0x41a709;}})['catch'](function(_0x54bb79){logger[_0x6abf('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54bb79);throw _0x54bb79;});}return _0x41a709;})[_0x6abf('0x42')](respondWithResult(_0x1aaaab,0xc9))[_0x6abf('0x47')](handleError(_0x1aaaab,null));};exports[_0x6abf('0x25')]=function(_0x560857,_0x1789b9){if(_0x560857['body']['id']){delete _0x560857['body']['id'];}return db[_0x6abf('0x41')][_0x6abf('0x4a')]({'where':{'id':_0x560857[_0x6abf('0x48')]['id']}})['then'](handleEntityNotFound(_0x1789b9,null))['then'](saveUpdates(_0x560857[_0x6abf('0x52')],null))[_0x6abf('0x42')](respondWithResult(_0x1789b9,null))[_0x6abf('0x47')](handleError(_0x1789b9,null));};exports['destroy']=function(_0x1fb1f6,_0x33d27b){return db[_0x6abf('0x41')][_0x6abf('0x4a')]({'where':{'id':_0x1fb1f6['params']['id']}})[_0x6abf('0x42')](handleEntityNotFound(_0x33d27b,null))[_0x6abf('0x42')](removeEntity(_0x33d27b,null))[_0x6abf('0x47')](handleError(_0x33d27b,null));}; \ No newline at end of file +var _0x6de0=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','options','find','create','body','user','role','Pauses','UserProfileSection','autoAssociation','UserProfileResource','error','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x6de0,0x163));var _0x06de=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6de0[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x06de('0x0'));var rimraf=require(_0x06de('0x1'));var zipdir=require(_0x06de('0x2'));var jsonpatch=require(_0x06de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x06de('0x4'));var Mustache=require(_0x06de('0x5'));var util=require(_0x06de('0x6'));var path=require(_0x06de('0x7'));var sox=require(_0x06de('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x06de('0x9'));var _=require('lodash');var squel=require(_0x06de('0xa'));var crypto=require('crypto');var jsforce=require(_0x06de('0xb'));var deskjs=require(_0x06de('0xc'));var toCsv=require(_0x06de('0xd'));var querystring=require(_0x06de('0xe'));var Papa=require(_0x06de('0xf'));var Redis=require('ioredis');var authService=require(_0x06de('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x06de('0x11'));var hardwareService=require(_0x06de('0x12'));var logger=require(_0x06de('0x13'))(_0x06de('0x14'));var utils=require('../../config/utils');var config=require(_0x06de('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x06de('0x16'))['db'];function respondWithStatusCode(_0x5db405,_0x5ae352){_0x5ae352=_0x5ae352||0xcc;return function(_0x30b360){if(_0x30b360){return _0x5db405[_0x06de('0x17')](_0x5ae352);}return _0x5db405[_0x06de('0x18')](_0x5ae352)[_0x06de('0x19')]();};}function respondWithResult(_0x4b17a9,_0x46faab){_0x46faab=_0x46faab||0xc8;return function(_0x54baf7){if(_0x54baf7){return _0x4b17a9[_0x06de('0x18')](_0x46faab)['json'](_0x54baf7);}};}function respondWithFilteredResult(_0x5d3984,_0x3b607d){return function(_0x2d69f2){if(_0x2d69f2){var _0x46f68a=typeof _0x3b607d[_0x06de('0x1a')]===_0x06de('0x1b')&&typeof _0x3b607d[_0x06de('0x1c')]===_0x06de('0x1b');var _0x3a2de5=_0x2d69f2[_0x06de('0x1d')];var _0x2ae30e=_0x46f68a?0x0:_0x3b607d['offset'];var _0x62c077=_0x46f68a?_0x2d69f2[_0x06de('0x1d')]:_0x3b607d['offset']+_0x3b607d[_0x06de('0x1c')];var _0x2fed76;if(_0x62c077>=_0x3a2de5){_0x62c077=_0x3a2de5;_0x2fed76=0xc8;}else{_0x2fed76=0xce;}_0x5d3984[_0x06de('0x18')](_0x2fed76);return _0x5d3984[_0x06de('0x1e')](_0x06de('0x1f'),_0x2ae30e+'-'+_0x62c077+'/'+_0x3a2de5)['json'](_0x2d69f2);}return null;};}function patchUpdates(_0x48fd3e){return function(_0x31c0a8){try{jsonpatch['apply'](_0x31c0a8,_0x48fd3e,!![]);}catch(_0x5b3fb1){return BPromise[_0x06de('0x20')](_0x5b3fb1);}return _0x31c0a8[_0x06de('0x21')]();};}function saveUpdates(_0x429811,_0x23e356){return function(_0x176cad){if(_0x176cad){return _0x176cad[_0x06de('0x22')](_0x429811)[_0x06de('0x23')](function(_0x43773c){return _0x43773c;});}return null;};}function removeEntity(_0xbaf51d,_0x3b15ef){return function(_0x19a2ba){if(_0x19a2ba){return _0x19a2ba[_0x06de('0x24')]()[_0x06de('0x23')](function(){var _0x23e09c=_0x19a2ba[_0x06de('0x25')]({'plain':!![]});var _0x422efb='Pauses';return db['UserProfileResource'][_0x06de('0x24')]({'where':{'type':_0x422efb,'resourceId':_0x23e09c['id']}})['then'](function(){return _0x19a2ba;});})[_0x06de('0x23')](function(){_0xbaf51d['status'](0xcc)[_0x06de('0x19')]();});}};}function handleEntityNotFound(_0x20330a,_0x34b11c){return function(_0xa35acb){if(!_0xa35acb){_0x20330a[_0x06de('0x17')](0x194);}return _0xa35acb;};}function handleError(_0x40e729,_0x5c425c){_0x5c425c=_0x5c425c||0x1f4;return function(_0x1798b4){logger['error'](_0x1798b4[_0x06de('0x26')]);if(_0x1798b4['name']){delete _0x1798b4[_0x06de('0x27')];}_0x40e729[_0x06de('0x18')](_0x5c425c)[_0x06de('0x28')](_0x1798b4);};}exports[_0x06de('0x29')]=function(_0x16daa8,_0x1ea958){var _0xf59056={},_0x523859={},_0x5dc0cb={'count':0x0,'rows':[]};var _0x405114=_[_0x06de('0x2a')](db[_0x06de('0x2b')][_0x06de('0x2c')],function(_0x548d5d){return{'name':_0x548d5d[_0x06de('0x2d')],'type':_0x548d5d[_0x06de('0x2e')][_0x06de('0x2f')]};});_0x523859[_0x06de('0x30')]=_[_0x06de('0x2a')](_0x405114,_0x06de('0x27'));_0x523859[_0x06de('0x31')]=_[_0x06de('0x32')](_0x16daa8[_0x06de('0x31')]);_0x523859[_0x06de('0x33')]=_[_0x06de('0x34')](_0x523859[_0x06de('0x30')],_0x523859[_0x06de('0x31')]);_0xf59056[_0x06de('0x35')]=_[_0x06de('0x34')](_0x523859[_0x06de('0x30')],qs[_0x06de('0x36')](_0x16daa8['query'][_0x06de('0x36')]));_0xf59056['attributes']=_0xf59056[_0x06de('0x35')][_0x06de('0x37')]?_0xf59056['attributes']:_0x523859[_0x06de('0x30')];if(!_0x16daa8['query'][_0x06de('0x38')](_0x06de('0x39'))){_0xf59056['limit']=qs[_0x06de('0x1c')](_0x16daa8['query'][_0x06de('0x1c')]);_0xf59056[_0x06de('0x1a')]=qs[_0x06de('0x1a')](_0x16daa8['query']['offset']);}_0xf59056[_0x06de('0x3a')]=qs['sort'](_0x16daa8[_0x06de('0x31')]['sort']);_0xf59056[_0x06de('0x3b')]=qs['filters'](_[_0x06de('0x3c')](_0x16daa8['query'],_0x523859[_0x06de('0x33')]),_0x405114);if(_0x16daa8[_0x06de('0x31')][_0x06de('0x3d')]){_0xf59056[_0x06de('0x3b')]=_['merge'](_0xf59056[_0x06de('0x3b')],{'$or':_['map'](_0x405114,function(_0x444061){if(_0x444061[_0x06de('0x2e')]!==_0x06de('0x3e')){var _0xdcb66b={};_0xdcb66b[_0x444061[_0x06de('0x27')]]={'$like':'%'+_0x16daa8[_0x06de('0x31')]['filter']+'%'};return _0xdcb66b;}})});}_0xf59056=_[_0x06de('0x3f')]({},_0xf59056,_0x16daa8['options']);var _0x39ebc1={'where':_0xf59056['where']};return db[_0x06de('0x2b')][_0x06de('0x1d')](_0x39ebc1)[_0x06de('0x23')](function(_0xc1d827){_0x5dc0cb['count']=_0xc1d827;if(_0x16daa8[_0x06de('0x31')][_0x06de('0x40')]){_0xf59056[_0x06de('0x41')]=[{'all':!![]}];}return db[_0x06de('0x2b')]['findAll'](_0xf59056);})[_0x06de('0x23')](function(_0x1bc45a){_0x5dc0cb[_0x06de('0x42')]=_0x1bc45a;return _0x5dc0cb;})[_0x06de('0x23')](respondWithFilteredResult(_0x1ea958,_0xf59056))[_0x06de('0x43')](handleError(_0x1ea958,null));};exports[_0x06de('0x44')]=function(_0x505420,_0x44f6cb){var _0x42121c={'raw':!![],'where':{'id':_0x505420['params']['id']}},_0x52be82={};_0x52be82[_0x06de('0x30')]=_[_0x06de('0x32')](db[_0x06de('0x2b')]['rawAttributes']);_0x52be82[_0x06de('0x31')]=_['keys'](_0x505420[_0x06de('0x31')]);_0x52be82[_0x06de('0x33')]=_[_0x06de('0x34')](_0x52be82[_0x06de('0x30')],_0x52be82['query']);_0x42121c[_0x06de('0x35')]=_['intersection'](_0x52be82[_0x06de('0x30')],qs[_0x06de('0x36')](_0x505420[_0x06de('0x31')][_0x06de('0x36')]));_0x42121c['attributes']=_0x42121c[_0x06de('0x35')][_0x06de('0x37')]?_0x42121c[_0x06de('0x35')]:_0x52be82[_0x06de('0x30')];if(_0x505420[_0x06de('0x31')][_0x06de('0x40')]){_0x42121c[_0x06de('0x41')]=[{'all':!![]}];}_0x42121c=_['merge']({},_0x42121c,_0x505420[_0x06de('0x45')]);return db[_0x06de('0x2b')][_0x06de('0x46')](_0x42121c)['then'](handleEntityNotFound(_0x44f6cb,null))[_0x06de('0x23')](respondWithResult(_0x44f6cb,null))['catch'](handleError(_0x44f6cb,null));};exports[_0x06de('0x47')]=function(_0x2a037d,_0x338394){return db['Pause'][_0x06de('0x47')](_0x2a037d[_0x06de('0x48')],{})[_0x06de('0x23')](function(_0x58cef6){var _0x5f2f31=_0x2a037d[_0x06de('0x49')][_0x06de('0x25')]({'plain':!![]});if(!_0x5f2f31)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f2f31[_0x06de('0x4a')]===_0x06de('0x49')){var _0x3d95a7=_0x58cef6[_0x06de('0x25')]({'plain':!![]});var _0x40f520=_0x06de('0x4b');return db[_0x06de('0x4c')][_0x06de('0x46')]({'where':{'name':_0x40f520,'userProfileId':_0x5f2f31['userProfileId']},'raw':!![]})[_0x06de('0x23')](function(_0x4de37c){if(_0x4de37c&&_0x4de37c[_0x06de('0x4d')]===0x0){return db[_0x06de('0x4e')]['create']({'name':_0x3d95a7[_0x06de('0x27')],'resourceId':_0x3d95a7['id'],'type':_0x4de37c['name'],'sectionId':_0x4de37c['id']},{})[_0x06de('0x23')](function(){return _0x58cef6;});}else{return _0x58cef6;}})[_0x06de('0x43')](function(_0x1b6fde){logger[_0x06de('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b6fde);throw _0x1b6fde;});}return _0x58cef6;})[_0x06de('0x23')](respondWithResult(_0x338394,0xc9))[_0x06de('0x43')](handleError(_0x338394,null));};exports[_0x06de('0x22')]=function(_0x18e868,_0x117f26){if(_0x18e868[_0x06de('0x48')]['id']){delete _0x18e868[_0x06de('0x48')]['id'];}return db[_0x06de('0x2b')]['find']({'where':{'id':_0x18e868[_0x06de('0x50')]['id']}})[_0x06de('0x23')](handleEntityNotFound(_0x117f26,null))['then'](saveUpdates(_0x18e868[_0x06de('0x48')],null))[_0x06de('0x23')](respondWithResult(_0x117f26,null))['catch'](handleError(_0x117f26,null));};exports['destroy']=function(_0x313e0e,_0x39a394){return db[_0x06de('0x2b')]['find']({'where':{'id':_0x313e0e[_0x06de('0x50')]['id']}})[_0x06de('0x23')](handleEntityNotFound(_0x39a394,null))[_0x06de('0x23')](removeEntity(_0x39a394,null))[_0x06de('0x43')](handleError(_0x39a394,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 294c8c8..e55ca40 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 _0x55ca=['./pause.attributes','exports','define','tools_pauses','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x55ca,0x126));var _0xa55c=function(_0x237815,_0x1ef2b0){_0x237815=_0x237815-0x0;var _0x5498ee=_0x55ca[_0x237815];return _0x5498ee;};'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')]('Pause',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','Pause','tools_pauses','lodash','util'];(function(_0x448ef3,_0x2f42d0){var _0x45b6fd=function(_0x421c32){while(--_0x421c32){_0x448ef3['push'](_0x448ef3['shift']());}};_0x45b6fd(++_0x2f42d0);}(_0x5fab,0x177));var _0xb5fa=function(_0x310a23,_0x49f6b5){_0x310a23=_0x310a23-0x0;var _0x50fe57=_0x5fab[_0x310a23];return _0x50fe57;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index e8b4972..95aa8a3 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(_0x4a4b58,_0x29f567){var _0x4ab2d0=function(_0x3d4195){while(--_0x3d4195){_0x4a4b58['push'](_0x4a4b58['shift']());}};_0x4ab2d0(++_0x29f567);}(_0x7a54,0x106));var _0x47a5=function(_0x55ad81,_0xd5fdf9){_0x55ad81=_0x55ad81-0x0;var _0x2d575c=_0x7a54[_0x55ad81];return _0x2d575c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x1a6cd6,_0x170e5c){var _0x36092c=function(_0x271845){while(--_0x271845){_0x1a6cd6['push'](_0x1a6cd6['shift']());}};_0x36092c(++_0x170e5c);}(_0xb10b,0x12a));var _0xbb10=function(_0x25d4b1,_0x4e896d){_0x25d4b1=_0x25d4b1-0x0;var _0x2d51a5=_0xb10b[_0x25d4b1];return _0x2d51a5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 81f9e88..cd558ac 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 _0xbb53=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/webhook','webhookGet','show','/:id/download','download','root','originalname','replace','%s-%s%s','basename','extname','post','single','upload','webhookPost','/:id','update','delete'];(function(_0x29183b,_0x8296f3){var _0x3cdbbf=function(_0x5d3909){while(--_0x5d3909){_0x29183b['push'](_0x29183b['shift']());}};_0x3cdbbf(++_0x8296f3);}(_0xbb53,0x121));var _0x3bb5=function(_0x5538a4,_0xe0b8b0){_0x5538a4=_0x5538a4-0x0;var _0x530a52=_0xbb53[_0x5538a4];return _0x530a52;};'use strict';var multer=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var path=require(_0x3bb5('0x2'));var timeout=require(_0x3bb5('0x3'));var express=require(_0x3bb5('0x4'));var router=express[_0x3bb5('0x5')]();var fs_extra=require(_0x3bb5('0x6'));var auth=require(_0x3bb5('0x7'));var interaction=require(_0x3bb5('0x8'));var config=require(_0x3bb5('0x9'));var controller=require('./plugin.controller');router['get']('/',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0xb')]);router[_0x3bb5('0xc')](_0x3bb5('0xd'),controller[_0x3bb5('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3bb5('0xf')]);router[_0x3bb5('0xc')](_0x3bb5('0x10'),auth['isAuthenticated'](),controller[_0x3bb5('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53af18,_0xd8d9bf,_0x2b915a){_0x2b915a(null,path['join'](config[_0x3bb5('0x12')],'server/files/plugins'));},'filename':function(_0x69f59a,_0x511bd8,_0x526bf0){_0x511bd8[_0x3bb5('0x13')]=_0x511bd8[_0x3bb5('0x13')][_0x3bb5('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x526bf0(null,util['format'](_0x3bb5('0x15'),path[_0x3bb5('0x16')](_0x511bd8['originalname'],path[_0x3bb5('0x17')](_0x511bd8[_0x3bb5('0x13')])),Date['now'](),path['extname'](_0x511bd8['originalname'])));}})});router[_0x3bb5('0x18')]('/',upload[_0x3bb5('0x19')]('file'),controller[_0x3bb5('0x1a')]);router[_0x3bb5('0x18')](_0x3bb5('0xd'),controller[_0x3bb5('0x1b')]);router['put'](_0x3bb5('0x1c'),auth[_0x3bb5('0xa')](),controller[_0x3bb5('0x1d')]);router['delete']('/:id',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0x1e')]);module[_0x3bb5('0x1f')]=router; \ No newline at end of file +var _0x9bde=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','now','post','file','upload','webhookPost','put','delete'];(function(_0x58c0e2,_0x288485){var _0x1cb5b1=function(_0x4ee413){while(--_0x4ee413){_0x58c0e2['push'](_0x58c0e2['shift']());}};_0x1cb5b1(++_0x288485);}(_0x9bde,0xe1));var _0xe9bd=function(_0x58054e,_0xccc3fe){_0x58054e=_0x58054e-0x0;var _0x4272d8=_0x9bde[_0x58054e];return _0x4272d8;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),controller[_0xe9bd('0xb')]);router[_0xe9bd('0x8')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0x8')](_0xe9bd('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xe9bd('0x10')]({'destination':function(_0x145521,_0x2601ac,_0x581ab9){_0x581ab9(null,path[_0xe9bd('0x11')](config[_0xe9bd('0x12')],_0xe9bd('0x13')));},'filename':function(_0x141587,_0x5e022a,_0x2c1d98){_0x5e022a['originalname']=_0x5e022a[_0xe9bd('0x14')][_0xe9bd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c1d98(null,util[_0xe9bd('0x16')]('%s-%s%s',path['basename'](_0x5e022a[_0xe9bd('0x14')],path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])),Date[_0xe9bd('0x18')](),path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])));}})});router[_0xe9bd('0x19')]('/',upload['single'](_0xe9bd('0x1a')),controller[_0xe9bd('0x1b')]);router[_0xe9bd('0x19')]('/webhook',controller[_0xe9bd('0x1c')]);router[_0xe9bd('0x1d')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller['update']);router[_0xe9bd('0x1e')]('/:id',auth[_0xe9bd('0xd')](),controller['delete']);module[_0xe9bd('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 0d07a6f..b294fb8 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 _0x1f85=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','exports','STRING','ENUM','html','script','TEXT','BOOLEAN'];(function(_0xff9b9d,_0x55eb38){var _0x267e23=function(_0x3831a1){while(--_0x3831a1){_0xff9b9d['push'](_0xff9b9d['shift']());}};_0x267e23(++_0x55eb38);}(_0x1f85,0xdf));var _0x51f8=function(_0x55c63e,_0xaf1a81){_0x55c63e=_0x55c63e-0x0;var _0x4ace93=_0x1f85[_0x55c63e];return _0x4ace93;};'use strict';var Sequelize=require('sequelize');module[_0x51f8('0x0')]={'name':{'type':Sequelize[_0x51f8('0x1')]},'type':{'type':Sequelize[_0x51f8('0x2')](_0x51f8('0x3'),_0x51f8('0x4'))},'description':{'type':Sequelize[_0x51f8('0x5')]},'version':{'type':Sequelize[_0x51f8('0x5')]},'path':{'type':Sequelize[_0x51f8('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x51f8('0x6')],'defaultValue':0x0,'comment':_0x51f8('0x7')},'sidebar':{'type':Sequelize[_0x51f8('0x2')](_0x51f8('0x8'),'agentOnly',_0x51f8('0x9'),'never'),'defaultValue':_0x51f8('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x51f8('0x1')]},'adminUrl':{'type':Sequelize[_0x51f8('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x51f8('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe51a=['TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script'];(function(_0x2ac94a,_0x1a4c6c){var _0x25f75d=function(_0x34670d){while(--_0x34670d){_0x2ac94a['push'](_0x2ac94a['shift']());}};_0x25f75d(++_0x1a4c6c);}(_0xe51a,0x133));var _0xae51=function(_0x1fc05d,_0x510bd7){_0x1fc05d=_0x1fc05d-0x0;var _0x2d977c=_0xe51a[_0x1fc05d];return _0x2d977c;};'use strict';var Sequelize=require('sequelize');module[_0xae51('0x0')]={'name':{'type':Sequelize[_0xae51('0x1')]},'type':{'type':Sequelize[_0xae51('0x2')](_0xae51('0x3'),_0xae51('0x4'))},'description':{'type':Sequelize[_0xae51('0x5')]},'version':{'type':Sequelize[_0xae51('0x5')]},'path':{'type':Sequelize[_0xae51('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xae51('0x6')],'defaultValue':0x0,'comment':_0xae51('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xae51('0x8'),_0xae51('0x9'),_0xae51('0xa')),'defaultValue':_0xae51('0x9'),'comment':_0xae51('0xb')},'icon':{'type':Sequelize[_0xae51('0x1')]},'adminUrl':{'type':Sequelize[_0xae51('0x1')]},'agentUrl':{'type':Sequelize[_0xae51('0x1')]},'scriptName':{'type':Sequelize[_0xae51('0x1')]},'scriptPath':{'type':Sequelize[_0xae51('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 27d3a65..5980e7c 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 _0x60ae=['unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','parameters','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','headers','content-length','set','endsWith','statusCode','webhookPost','%s%s','content-type','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','rimraf','archiver','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','Plugin','includeAll','include','findAll','rows','catch','show','params','find','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin'];(function(_0x5b6ed8,_0x4ee6b4){var _0x4c0458=function(_0x20ed6f){while(--_0x20ed6f){_0x5b6ed8['push'](_0x5b6ed8['shift']());}};_0x4c0458(++_0x4ee6b4);}(_0x60ae,0x1b0));var _0xe60a=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0x60ae[_0x42c6f1];return _0x3c7398;};'use strict';var emlformat=require(_0xe60a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe60a('0x1'));var jsonpatch=require(_0xe60a('0x2'));var rp=require(_0xe60a('0x3'));var moment=require(_0xe60a('0x4'));var BPromise=require(_0xe60a('0x5'));var Mustache=require('mustache');var util=require(_0xe60a('0x6'));var path=require(_0xe60a('0x7'));var sox=require(_0xe60a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe60a('0x9'));var _=require(_0xe60a('0xa'));var squel=require(_0xe60a('0xb'));var crypto=require(_0xe60a('0xc'));var jsforce=require(_0xe60a('0xd'));var deskjs=require(_0xe60a('0xe'));var toCsv=require(_0xe60a('0xf'));var querystring=require(_0xe60a('0x10'));var Papa=require(_0xe60a('0x11'));var extract=require(_0xe60a('0x12'));var rimraf=require(_0xe60a('0x13'));var archiver=require(_0xe60a('0x14'));var Redis=require('ioredis');var authService=require(_0xe60a('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe60a('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe60a('0x17'));var config=require(_0xe60a('0x18'));var licenseUtil=require(_0xe60a('0x19'));var db=require(_0xe60a('0x1a'))['db'];config[_0xe60a('0x1b')]=_[_0xe60a('0x1c')](config[_0xe60a('0x1b')],{'host':_0xe60a('0x1d'),'port':0x18eb});var socket=require(_0xe60a('0x1e'))(new Redis(config[_0xe60a('0x1b')]));require(_0xe60a('0x1f'))[_0xe60a('0x20')](socket);function respondWithStatusCode(_0x50a68b,_0x1c8610){_0x1c8610=_0x1c8610||0xcc;return function(_0x3d6b6f){if(_0x3d6b6f){return _0x50a68b[_0xe60a('0x21')](_0x1c8610);}return _0x50a68b[_0xe60a('0x22')](_0x1c8610)[_0xe60a('0x23')]();};}function respondWithResult(_0x4d3d3b,_0x271d27){_0x271d27=_0x271d27||0xc8;return function(_0x4abbb5){if(_0x4abbb5){return _0x4d3d3b[_0xe60a('0x22')](_0x271d27)[_0xe60a('0x24')](_0x4abbb5);}};}function respondWithFilteredResult(_0x36bf4e,_0x56ab33){return function(_0x57695f){if(_0x57695f){var _0x11e757=typeof _0x56ab33[_0xe60a('0x25')]===_0xe60a('0x26')&&typeof _0x56ab33[_0xe60a('0x27')]===_0xe60a('0x26');var _0xd11c29=_0x57695f[_0xe60a('0x28')];var _0x5dafec=_0x11e757?0x0:_0x56ab33[_0xe60a('0x25')];var _0x363527=_0x11e757?_0x57695f[_0xe60a('0x28')]:_0x56ab33[_0xe60a('0x25')]+_0x56ab33[_0xe60a('0x27')];var _0x2d03fd;if(_0x363527>=_0xd11c29){_0x363527=_0xd11c29;_0x2d03fd=0xc8;}else{_0x2d03fd=0xce;}_0x36bf4e[_0xe60a('0x22')](_0x2d03fd);return _0x36bf4e['set'](_0xe60a('0x29'),_0x5dafec+'-'+_0x363527+'/'+_0xd11c29)[_0xe60a('0x24')](_0x57695f);}return null;};}function patchUpdates(_0x3bf3fb){return function(_0x5e5d79){try{jsonpatch[_0xe60a('0x2a')](_0x5e5d79,_0x3bf3fb,!![]);}catch(_0x409ba9){return BPromise['reject'](_0x409ba9);}return _0x5e5d79['save']();};}function saveUpdates(_0x418157,_0x439a57){return function(_0x2f856d){if(_0x2f856d){return _0x2f856d['update'](_0x418157)[_0xe60a('0x2b')](function(_0x28abff){return _0x28abff;});}return null;};}function removeEntity(_0x36cde6,_0x3f0e97){return function(_0x5b6078){if(_0x5b6078){return _0x5b6078[_0xe60a('0x2c')]()[_0xe60a('0x2b')](function(){var _0x313646=_0x5b6078[_0xe60a('0x2d')]({'plain':!![]});var _0x5514fd=_0xe60a('0x2e');return db[_0xe60a('0x2f')][_0xe60a('0x2c')]({'where':{'type':_0x5514fd,'resourceId':_0x313646['id']}})['then'](function(){return _0x5b6078;});})[_0xe60a('0x2b')](function(){_0x36cde6[_0xe60a('0x22')](0xcc)[_0xe60a('0x23')]();});}};}function handleEntityNotFound(_0x5667dc,_0x2f74eb){return function(_0x2b71a5){if(!_0x2b71a5){_0x5667dc[_0xe60a('0x21')](0x194);}return _0x2b71a5;};}function handleError(_0x14b41e,_0x304ece){_0x304ece=_0x304ece||0x1f4;return function(_0x2c9927){logger[_0xe60a('0x30')](_0x2c9927[_0xe60a('0x31')]);if(_0x2c9927[_0xe60a('0x32')]){delete _0x2c9927[_0xe60a('0x32')];}_0x14b41e[_0xe60a('0x22')](_0x304ece)[_0xe60a('0x33')](_0x2c9927);};}exports[_0xe60a('0x34')]=function(_0x36807f,_0x45b0cf){var _0x16a1af={},_0x3a462e={},_0x5c5180={'count':0x0,'rows':[]};var _0x421ea5=_[_0xe60a('0x35')](db['Plugin'][_0xe60a('0x36')],function(_0x46447f){return{'name':_0x46447f[_0xe60a('0x37')],'type':_0x46447f[_0xe60a('0x38')][_0xe60a('0x39')]};});_0x3a462e['model']=_['map'](_0x421ea5,_0xe60a('0x32'));_0x3a462e[_0xe60a('0x3a')]=_[_0xe60a('0x3b')](_0x36807f[_0xe60a('0x3a')]);_0x3a462e[_0xe60a('0x3c')]=_[_0xe60a('0x3d')](_0x3a462e[_0xe60a('0x3e')],_0x3a462e[_0xe60a('0x3a')]);_0x16a1af[_0xe60a('0x3f')]=_['intersection'](_0x3a462e[_0xe60a('0x3e')],qs['fields'](_0x36807f[_0xe60a('0x3a')][_0xe60a('0x40')]));_0x16a1af[_0xe60a('0x3f')]=_0x16a1af[_0xe60a('0x3f')][_0xe60a('0x41')]?_0x16a1af[_0xe60a('0x3f')]:_0x3a462e[_0xe60a('0x3e')];if(!_0x36807f['query'][_0xe60a('0x42')](_0xe60a('0x43'))){_0x16a1af[_0xe60a('0x27')]=qs['limit'](_0x36807f[_0xe60a('0x3a')][_0xe60a('0x27')]);_0x16a1af['offset']=qs['offset'](_0x36807f['query'][_0xe60a('0x25')]);}_0x16a1af[_0xe60a('0x44')]=qs[_0xe60a('0x45')](_0x36807f[_0xe60a('0x3a')][_0xe60a('0x45')]);_0x16a1af[_0xe60a('0x46')]=qs[_0xe60a('0x3c')](_[_0xe60a('0x47')](_0x36807f['query'],_0x3a462e[_0xe60a('0x3c')]),_0x421ea5);if(_0x36807f[_0xe60a('0x3a')]['filter']){_0x16a1af['where']=_[_0xe60a('0x48')](_0x16a1af[_0xe60a('0x46')],{'$or':_['map'](_0x421ea5,function(_0xf3b0d6){if(_0xf3b0d6['type']!=='VIRTUAL'){var _0x3c0ed2={};_0x3c0ed2[_0xf3b0d6[_0xe60a('0x32')]]={'$like':'%'+_0x36807f['query'][_0xe60a('0x49')]+'%'};return _0x3c0ed2;}})});}_0x16a1af=_[_0xe60a('0x48')]({},_0x16a1af,_0x36807f[_0xe60a('0x4a')]);var _0xbb7ee9={'where':_0x16a1af['where']};return db[_0xe60a('0x4b')]['count'](_0xbb7ee9)[_0xe60a('0x2b')](function(_0x5b1463){_0x5c5180['count']=_0x5b1463;if(_0x36807f[_0xe60a('0x3a')][_0xe60a('0x4c')]){_0x16a1af[_0xe60a('0x4d')]=[{'all':!![]}];}return db[_0xe60a('0x4b')][_0xe60a('0x4e')](_0x16a1af);})['then'](function(_0x35ccc0){_0x5c5180[_0xe60a('0x4f')]=_0x35ccc0;return _0x5c5180;})[_0xe60a('0x2b')](respondWithFilteredResult(_0x45b0cf,_0x16a1af))[_0xe60a('0x50')](handleError(_0x45b0cf,null));};exports[_0xe60a('0x51')]=function(_0x2ced3e,_0x22fd04){var _0x26c449={'raw':!![],'where':{'id':_0x2ced3e[_0xe60a('0x52')]['id']}},_0x428f97={};_0x428f97[_0xe60a('0x3e')]=_[_0xe60a('0x3b')](db[_0xe60a('0x4b')]['rawAttributes']);_0x428f97['query']=_[_0xe60a('0x3b')](_0x2ced3e[_0xe60a('0x3a')]);_0x428f97[_0xe60a('0x3c')]=_[_0xe60a('0x3d')](_0x428f97['model'],_0x428f97[_0xe60a('0x3a')]);_0x26c449[_0xe60a('0x3f')]=_[_0xe60a('0x3d')](_0x428f97['model'],qs[_0xe60a('0x40')](_0x2ced3e[_0xe60a('0x3a')]['fields']));_0x26c449[_0xe60a('0x3f')]=_0x26c449[_0xe60a('0x3f')][_0xe60a('0x41')]?_0x26c449[_0xe60a('0x3f')]:_0x428f97[_0xe60a('0x3e')];if(_0x2ced3e['query'][_0xe60a('0x4c')]){_0x26c449[_0xe60a('0x4d')]=[{'all':!![]}];}_0x26c449=_[_0xe60a('0x48')]({},_0x26c449,_0x2ced3e['options']);return db[_0xe60a('0x4b')]['find'](_0x26c449)[_0xe60a('0x2b')](handleEntityNotFound(_0x22fd04,null))['then'](respondWithResult(_0x22fd04,null))[_0xe60a('0x50')](handleError(_0x22fd04,null));};exports['download']=function(_0x5ce3f1,_0x9318bb,_0x2c763d){return db[_0xe60a('0x4b')][_0xe60a('0x53')]({'where':{'id':_0x5ce3f1[_0xe60a('0x52')]['id']},'attributes':[_0xe60a('0x32'),_0xe60a('0x7')],'raw':!![]})[_0xe60a('0x2b')](handleEntityNotFound(_0x9318bb,null))[_0xe60a('0x2b')](function(_0x3a8860){if(_0x3a8860){var _0x33787b=path[_0xe60a('0x54')](config['root'],_0xe60a('0x55'),util[_0xe60a('0x56')](_0xe60a('0x57'),path[_0xe60a('0x58')](_0x3a8860[_0xe60a('0x7')])));var _0x18e875=fs[_0xe60a('0x59')](_0x33787b);var _0x1ce63c=archiver(_0xe60a('0x5a'),{'zlib':{'level':0x9}});_0x1ce63c['on'](_0xe60a('0x5b'),function(_0x225b16){if(_0x225b16[_0xe60a('0x5c')]===_0xe60a('0x5d')){logger['error'](_0x225b16);}else{throw new db[(_0xe60a('0x5e'))][(_0xe60a('0x5f'))](_0xe60a('0x60'));}});_0x1ce63c['on']('error',function(_0x3e6c8c){throw new db[(_0xe60a('0x5e'))][(_0xe60a('0x5f'))](_0xe60a('0x60'));});_0x1ce63c['pipe'](_0x18e875);_0x1ce63c['glob'](_0xe60a('0x61'),{'cwd':path[_0xe60a('0x54')](config[_0xe60a('0x62')],_0xe60a('0x55'),path[_0xe60a('0x63')](_0x3a8860[_0xe60a('0x7')])),'ignore':[path[_0xe60a('0x54')](path[_0xe60a('0x58')](_0x3a8860[_0xe60a('0x7')]),_0xe60a('0x64')),path[_0xe60a('0x54')](path['basename'](_0x3a8860[_0xe60a('0x7')]),_0xe60a('0x65'))],'nodir':!![]})[_0xe60a('0x66')]();_0x18e875['on'](_0xe60a('0x67'),function(){if(!fs[_0xe60a('0x68')](_0x33787b)){throw new db[(_0xe60a('0x5e'))]['Error'](_0xe60a('0x69'));}return _0x9318bb[_0xe60a('0x6a')](_0x33787b,util[_0xe60a('0x56')]('%s.zip',path[_0xe60a('0x58')](_0x3a8860[_0xe60a('0x7')])),function(_0x4e4723){if(_0x4e4723){throw new db[(_0xe60a('0x5e'))][(_0xe60a('0x5f'))](_0xe60a('0x6b'));}fs[_0xe60a('0x6c')](_0x33787b);logger[_0xe60a('0x6d')](_0xe60a('0x6e'));logger[_0xe60a('0x6d')](_0xe60a('0x6f'));});});}return null;})['catch'](handleError(_0x9318bb,null));};exports['upload']=function(_0x506104,_0x30bcb4,_0x87f679){var _0x52eb59=path[_0xe60a('0x58')](_0x506104[_0xe60a('0x70')][_0xe60a('0x71')],path[_0xe60a('0x72')](_0x506104['file'][_0xe60a('0x71')]));var _0x2b2a7a=path['join'](config[_0xe60a('0x62')],_0xe60a('0x55'),_0x506104[_0xe60a('0x70')][_0xe60a('0x71')]);var _0x1ef490=path[_0xe60a('0x54')](config['root'],_0xe60a('0x55'),_0x52eb59);logger[_0xe60a('0x6d')]('Plugin\x20upload\x20filepath:\x20%s',_0x2b2a7a);logger[_0xe60a('0x6d')](_0xe60a('0x73'),_0x1ef490);try{fs[_0xe60a('0x74')](_0x2b2a7a,parseInt(_0xe60a('0x75'),0x8));extract(_0x2b2a7a,{'dir':_0x1ef490},function(_0xeef3f1){if(_0xeef3f1){logger['error'](_0xeef3f1);handleError(_0xeef3f1,!![]);};var _0x3c364a=fs[_0xe60a('0x76')](_0x1ef490);if(_0x3c364a[_0xe60a('0x41')]>0x1){removeReferences(_0x2b2a7a,_0x1ef490);logger[_0xe60a('0x30')](_0xe60a('0x77'));return _0x87f679(new Error(_0xe60a('0x77')));}var _0x2e2930=fs[_0xe60a('0x78')](path[_0xe60a('0x54')](_0x1ef490,_0x3c364a[0x0]));if(_0x2e2930[_0xe60a('0x79')]()){removeReferences(_0x2b2a7a,_0x1ef490);logger[_0xe60a('0x30')](_0xe60a('0x77'));return _0x87f679(new Error(_0xe60a('0x77')));}if(_0x2e2930[_0xe60a('0x7a')]()){var _0x18c3c1=fs[_0xe60a('0x76')](path[_0xe60a('0x54')](_0x1ef490,_0x3c364a[0x0]));if(_0x18c3c1[_0xe60a('0x41')]===0x0){removeReferences(_0x2b2a7a,_0x1ef490);logger['error'](_0xe60a('0x77'));return _0x87f679(new Error(_0xe60a('0x77')));}var _0x7297d=_0x18c3c1['some'](function(_0x18ca29){return _0x18ca29===_0xe60a('0x7b');});if(!_0x7297d){return _0x87f679(new Error('Plugin\x20manifest\x20missing'));}var _0x2d1ac9=fs[_0xe60a('0x7c')](path[_0xe60a('0x54')](_0x1ef490,_0x3c364a[0x0],'manifest.json'));var _0x2bbd59=JSON[_0xe60a('0x7d')](_0x2d1ac9);if(_0xe60a('0x26')==typeof _0x2bbd59['name']){return _0x87f679(new Error(_0xe60a('0x7e')));}if(_0xe60a('0x26')==typeof _0x2bbd59[_0xe60a('0x38')]){return _0x87f679(new Error(_0xe60a('0x7f')));}if(_0xe60a('0x26')==typeof _0x2bbd59['version']){return _0x87f679(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x2bbd59['parameters']){return _0x87f679(new Error(_0xe60a('0x80')));}if(_0x2bbd59['type']===_0xe60a('0x81')){if(_0xe60a('0x26')==typeof _0x2bbd59['parameters'][_0xe60a('0x82')]){return _0x87f679(new Error(_0xe60a('0x83')));}if(_0xe60a('0x26')==typeof _0x2bbd59['parameters']['views'][_0xe60a('0x84')]&&_0xe60a('0x26')==typeof _0x2bbd59['parameters']['views'][_0xe60a('0x85')]){return _0x87f679(new Error(_0xe60a('0x86')));}}else if(_0x2bbd59[_0xe60a('0x38')]===_0xe60a('0x87')){if(_0xe60a('0x26')==typeof _0x2bbd59[_0xe60a('0x88')][_0xe60a('0x89')]){return _0x87f679(new Error(_0xe60a('0x8a')));}if('undefined'==typeof _0x2bbd59[_0xe60a('0x88')][_0xe60a('0x8b')]){return _0x87f679(new Error(_0xe60a('0x8c')));}}else{return _0x87f679(new Error(_0xe60a('0x8d')));}var _0x6eed54=_0x2bbd59[_0xe60a('0x32')];var _0x20c8aa=_0x2bbd59[_0xe60a('0x8e')];var _0x5e15ab=_0x2bbd59[_0xe60a('0x38')];var _0x4f3dae=_0x2bbd59[_0xe60a('0x8f')]?_0x2bbd59['sidebar']:_0xe60a('0x90');var _0x21b66e=_0x2bbd59[_0xe60a('0x91')]?_0x2bbd59['icon']:_0xe60a('0x92');var _0x47a874='';var _0x469593='';var _0x56cbc2='';var _0x570e1d='';var _0x1299d2=_0x2bbd59[_0xe60a('0x93')];if(_0x5e15ab===_0xe60a('0x81')){if(_0xe60a('0x26')!=typeof _0x2bbd59[_0xe60a('0x88')][_0xe60a('0x82')][_0xe60a('0x84')]){var _0x52560c=_0x2bbd59[_0xe60a('0x88')][_0xe60a('0x82')][_0xe60a('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0x52560c)){_0x47a874=path[_0xe60a('0x54')]('plugins',_0x52eb59,_0x3c364a[0x0],_0x52560c);}else{_0x47a874=_0x52560c;}}else{logger['info'](_0xe60a('0x94'));}if('undefined'!=typeof _0x2bbd59['parameters'][_0xe60a('0x82')][_0xe60a('0x85')]){var _0x5db8bb=_0x2bbd59['parameters'][_0xe60a('0x82')][_0xe60a('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xe60a('0x95')](_0x5db8bb)){_0x469593=path[_0xe60a('0x54')]('plugins',_0x52eb59,_0x3c364a[0x0],_0x5db8bb);}else{_0x469593=_0x5db8bb;}}else{logger[_0xe60a('0x6d')](_0xe60a('0x96'));}}else if(_0x5e15ab===_0xe60a('0x87')){_0x56cbc2=_0x2bbd59[_0xe60a('0x88')][_0xe60a('0x89')];_0x570e1d=_0x2bbd59[_0xe60a('0x88')][_0xe60a('0x8b')];if(_0xe60a('0x26')!=typeof _0x2bbd59['parameters']['views']){if(_0xe60a('0x26')!=typeof _0x2bbd59['parameters'][_0xe60a('0x82')][_0xe60a('0x84')]){var _0x52560c=_0x2bbd59[_0xe60a('0x88')][_0xe60a('0x82')][_0xe60a('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xe60a('0x95')](_0x52560c)){_0x47a874=path['join'](_0xe60a('0x97'),_0x52eb59,_0x3c364a[0x0],_0x52560c);}else{_0x47a874=_0x52560c;}}if(_0xe60a('0x26')!=typeof _0x2bbd59[_0xe60a('0x88')][_0xe60a('0x82')]['agent']){var _0x5db8bb=_0x2bbd59[_0xe60a('0x88')][_0xe60a('0x82')][_0xe60a('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xe60a('0x95')](_0x5db8bb)){_0x469593=path[_0xe60a('0x54')](_0xe60a('0x97'),_0x52eb59,_0x3c364a[0x0],_0x5db8bb);}else{_0x469593=_0x5db8bb;}}}}var _0x4de905={'name':_0x6eed54,'description':_0x20c8aa,'path':path[_0xe60a('0x54')](_0x52eb59,_0x3c364a[0x0]),'type':_0x5e15ab,'sidebar':_0x4f3dae,'icon':_0x21b66e,'adminUrl':_0x47a874,'agentUrl':_0x469593,'scriptName':_0x56cbc2,'scriptPath':_0x570e1d,'version':_0x1299d2};removeReferences(_0x2b2a7a,null);return db['Plugin'][_0xe60a('0x98')](_0x4de905)['then'](function(_0x134da7){var _0x1e0842={'role':_0x506104['body'][_0xe60a('0x99')],'userProfileId':_0x506104[_0xe60a('0x9a')][_0xe60a('0x9b')]};if(!_0x1e0842)throw new Error(_0xe60a('0x9c'));if(_0x1e0842['role']===_0xe60a('0x9d')){var _0x388604=_0x134da7['get']({'plain':!![]});return db[_0xe60a('0x9e')][_0xe60a('0x53')]({'where':{'name':'Plugins','userProfileId':_0x1e0842['userProfileId']},'raw':!![]})[_0xe60a('0x2b')](function(_0x55d1da){if(_0x55d1da&&_0x55d1da[_0xe60a('0x9f')]===0x0){return db[_0xe60a('0x2f')][_0xe60a('0x98')]({'name':_0x388604['name'],'resourceId':_0x388604['id'],'type':_0x55d1da[_0xe60a('0x32')],'sectionId':_0x55d1da['id']},{})[_0xe60a('0x2b')](function(){return _0x134da7;});}else{return _0x134da7;}})[_0xe60a('0x50')](function(_0x142aaf){logger[_0xe60a('0x30')](_0xe60a('0xa0'),_0x142aaf);throw _0x142aaf;});}return _0x134da7;})['then'](respondWithResult(_0x30bcb4,null))[_0xe60a('0x50')](handleError(_0x30bcb4,null));}});}catch(_0x229f2d){_0x30bcb4[_0xe60a('0x22')](0x1f4)[_0xe60a('0x33')](_0x229f2d);}};function removeReferences(_0x25c770,_0x27bf5f){try{if(_0x25c770){fs['unlinkSync'](_0x25c770);logger[_0xe60a('0x6d')](_0xe60a('0xa1'));}if(_0x27bf5f){rimraf(_0x27bf5f,function(){});logger[_0xe60a('0x6d')](_0xe60a('0xa2'));}}catch(_0x156fd3){logger[_0xe60a('0x30')](_0x156fd3);}}exports[_0xe60a('0xa3')]=function(_0x5936f0,_0x147d40,_0x24e534){return db['Plugin']['find']({'where':{'id':_0x5936f0['params']['id']}})[_0xe60a('0x2b')](handleEntityNotFound(_0x147d40,null))[_0xe60a('0x2b')](saveUpdates(_0x5936f0[_0xe60a('0x9a')],null))[_0xe60a('0x2b')](respondWithResult(_0x147d40,null))['catch'](handleError(_0x147d40,null));};exports[_0xe60a('0xa4')]=function(_0x2e0dc7,_0x23aaa0,_0x4b3db1){return db[_0xe60a('0x4b')][_0xe60a('0x53')]({'where':{'id':_0x2e0dc7[_0xe60a('0x52')]['id']}})[_0xe60a('0x2b')](function(_0x1ed757){if(_0x1ed757){return _0x1ed757['destroy']();}})['then'](function(_0x4b44e4){rimraf(path[_0xe60a('0x54')](config[_0xe60a('0x62')],_0xe60a('0x55'),path[_0xe60a('0x63')](_0x4b44e4[_0xe60a('0x7')])),function(){});return _0x4b44e4;})[_0xe60a('0x2b')](handleEntityNotFound(_0x23aaa0,null))['then'](respondWithStatusCode(_0x23aaa0,null))['catch'](handleError(_0x23aaa0,null));};exports[_0xe60a('0xa5')]=function(_0xfa0785,_0x5de7d6,_0x471a27){return BPromise[_0xe60a('0xa6')]()[_0xe60a('0x2b')](function(){if(!_0xfa0785['query'][_0xe60a('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xfa0785[_0xe60a('0x3a')][_0xe60a('0xa7')]){throw new Error(_0xe60a('0xa8'));}var _0x3334e4=_0xfa0785['query'][_0xe60a('0xa9')]?_0xfa0785[_0xe60a('0x3a')][_0xe60a('0xa9')]+':'+_0xfa0785[_0xe60a('0x3a')]['port']:_0xe60a('0xaa')+_0xfa0785[_0xe60a('0x3a')][_0xe60a('0xa7')];var _0x1325ef=_0xfa0785[_0xe60a('0x3a')][_0xe60a('0x24')]?_0xfa0785[_0xe60a('0x3a')][_0xe60a('0x24')]:!![];var _0x24c472=_0xfa0785[_0xe60a('0x3a')][_0xe60a('0xab')]?_0xfa0785[_0xe60a('0x3a')][_0xe60a('0xab')]:null;var _0x118dd0={'method':_0xfa0785['method'],'uri':util[_0xe60a('0x56')]('%s%s',_0x3334e4,_0xfa0785[_0xe60a('0x3a')]['path']),'json':_0x1325ef,'resolveWithFullResponse':!![],'encoding':_0x24c472,'qs':_0xfa0785[_0xe60a('0x3a')]};if(_0xfa0785[_0xe60a('0xac')]){_0x118dd0['headers']=_0xfa0785[_0xe60a('0xac')];if(_0x118dd0['headers'][_0xe60a('0xad')]){delete _0x118dd0['headers'][_0xe60a('0xad')];}}if(_0x118dd0[_0xe60a('0xac')]['content-type']){delete _0x118dd0[_0xe60a('0xac')]['content-type'];}return rp(_0x118dd0);})[_0xe60a('0x2b')](function(_0x2d8be0){if(_0x2d8be0){_0x5de7d6[_0xe60a('0xae')](_0x2d8be0[_0xe60a('0xac')]);logger['info'](_0x2d8be0[_0xe60a('0x9a')]);if(_[_0xe60a('0xaf')](_0xfa0785[_0xe60a('0x3a')]['path'],'download')&&_0x2d8be0[_0xe60a('0xb0')]==0x1f4){return _0x5de7d6['sendStatus'](_0x2d8be0[_0xe60a('0xb0')]);}else{return _0x5de7d6[_0xe60a('0x22')](_0x2d8be0[_0xe60a('0xb0')])[_0xe60a('0x33')](_0x2d8be0['body']);}}else{return _0x5de7d6['sendStatus'](0xc8);}})[_0xe60a('0x50')](handleError(_0x5de7d6,null));};exports[_0xe60a('0xb1')]=function(_0x1cf124,_0x22969e,_0x5a96ba){return BPromise[_0xe60a('0xa6')]()[_0xe60a('0x2b')](function(){if(!_0x1cf124[_0xe60a('0x3a')][_0xe60a('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1cf124[_0xe60a('0x3a')][_0xe60a('0xa7')]){throw new Error(_0xe60a('0xa8'));}var _0x39ead4=_0x1cf124['query'][_0xe60a('0xa9')]?_0x1cf124[_0xe60a('0x3a')]['hostname']+':'+_0x1cf124['query'][_0xe60a('0xa7')]:_0xe60a('0xaa')+_0x1cf124[_0xe60a('0x3a')][_0xe60a('0xa7')];var _0x33e21b=_0x1cf124[_0xe60a('0x3a')][_0xe60a('0x24')]?_0x1cf124[_0xe60a('0x3a')][_0xe60a('0x24')]:!![];var _0x20aa66=_0x1cf124[_0xe60a('0x3a')][_0xe60a('0xab')]?_0x1cf124['query']['encoding']:null;var _0x3d5a9b={'method':_0x1cf124['method'],'uri':util[_0xe60a('0x56')](_0xe60a('0xb2'),_0x39ead4,_0x1cf124['query'][_0xe60a('0x7')]),'json':_0x33e21b,'resolveWithFullResponse':!![],'encoding':_0x20aa66,'body':_0x1cf124[_0xe60a('0x9a')]};if(_0x1cf124['headers']){_0x3d5a9b[_0xe60a('0xac')]=_0x1cf124[_0xe60a('0xac')];if(_0x3d5a9b['headers'][_0xe60a('0xad')]){delete _0x3d5a9b[_0xe60a('0xac')][_0xe60a('0xad')];}}if(_0x3d5a9b[_0xe60a('0xac')][_0xe60a('0xb3')]){delete _0x3d5a9b['headers']['content-type'];}return rp(_0x3d5a9b);})[_0xe60a('0x2b')](function(_0x3fa075){if(_0x3fa075){_0x22969e[_0xe60a('0xae')](_0x3fa075['headers']);logger[_0xe60a('0x6d')](_0x3fa075['body']);return _0x22969e[_0xe60a('0x22')](_0x3fa075[_0xe60a('0xb0')])[_0xe60a('0x33')](_0x3fa075[_0xe60a('0x9a')]);}else{return _0x22969e[_0xe60a('0x21')](0xc8);}})['catch'](handleError(_0x22969e,null));}; \ No newline at end of file +var _0x59db=['Invalid\x20plugin\x20structure','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','create','webhookGet','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','http://localhost:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Plugins','UserProfileResource','end','error','stack','name','send','map','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','type','filter','options','includeAll','include','Plugin','findAll','rows','show','params','rawAttributes','length','find','catch','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x59db,0xda));var _0xb59d=function(_0x2ee4a0,_0xe398a6){_0x2ee4a0=_0x2ee4a0-0x0;var _0x35baa7=_0x59db[_0x2ee4a0];return _0x35baa7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb59d('0x0'));var zipdir=require(_0xb59d('0x1'));var jsonpatch=require(_0xb59d('0x2'));var rp=require(_0xb59d('0x3'));var moment=require(_0xb59d('0x4'));var BPromise=require(_0xb59d('0x5'));var Mustache=require(_0xb59d('0x6'));var util=require('util');var path=require(_0xb59d('0x7'));var sox=require('sox');var csv=require(_0xb59d('0x8'));var ejs=require(_0xb59d('0x9'));var fs=require('fs');var fs_extra=require(_0xb59d('0xa'));var _=require(_0xb59d('0xb'));var squel=require(_0xb59d('0xc'));var crypto=require(_0xb59d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb59d('0xe'));var toCsv=require(_0xb59d('0x8'));var querystring=require(_0xb59d('0xf'));var Papa=require(_0xb59d('0x10'));var extract=require(_0xb59d('0x11'));var rimraf=require('rimraf');var archiver=require(_0xb59d('0x12'));var Redis=require(_0xb59d('0x13'));var authService=require(_0xb59d('0x14'));var qs=require(_0xb59d('0x15'));var as=require(_0xb59d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb59d('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb59d('0x18'))['db'];config[_0xb59d('0x19')]=_[_0xb59d('0x1a')](config[_0xb59d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb59d('0x1b'))(new Redis(config[_0xb59d('0x19')]));require(_0xb59d('0x1c'))[_0xb59d('0x1d')](socket);function respondWithStatusCode(_0x57cd1a,_0x33f5e4){_0x33f5e4=_0x33f5e4||0xcc;return function(_0x5efc6e){if(_0x5efc6e){return _0x57cd1a[_0xb59d('0x1e')](_0x33f5e4);}return _0x57cd1a[_0xb59d('0x1f')](_0x33f5e4)['end']();};}function respondWithResult(_0x34adf8,_0x25236d){_0x25236d=_0x25236d||0xc8;return function(_0x482335){if(_0x482335){return _0x34adf8[_0xb59d('0x1f')](_0x25236d)['json'](_0x482335);}};}function respondWithFilteredResult(_0x266c5b,_0x480b14){return function(_0x3a099c){if(_0x3a099c){var _0x581018=typeof _0x480b14[_0xb59d('0x20')]===_0xb59d('0x21')&&typeof _0x480b14['limit']===_0xb59d('0x21');var _0x2a3236=_0x3a099c['count'];var _0x2a08a3=_0x581018?0x0:_0x480b14[_0xb59d('0x20')];var _0x25558f=_0x581018?_0x3a099c[_0xb59d('0x22')]:_0x480b14['offset']+_0x480b14[_0xb59d('0x23')];var _0x272038;if(_0x25558f>=_0x2a3236){_0x25558f=_0x2a3236;_0x272038=0xc8;}else{_0x272038=0xce;}_0x266c5b[_0xb59d('0x1f')](_0x272038);return _0x266c5b[_0xb59d('0x24')](_0xb59d('0x25'),_0x2a08a3+'-'+_0x25558f+'/'+_0x2a3236)[_0xb59d('0x26')](_0x3a099c);}return null;};}function patchUpdates(_0x3b8476){return function(_0x168edf){try{jsonpatch['apply'](_0x168edf,_0x3b8476,!![]);}catch(_0x34edbe){return BPromise[_0xb59d('0x27')](_0x34edbe);}return _0x168edf[_0xb59d('0x28')]();};}function saveUpdates(_0x396022,_0x188fe1){return function(_0x560462){if(_0x560462){return _0x560462[_0xb59d('0x29')](_0x396022)[_0xb59d('0x2a')](function(_0x6c0f43){return _0x6c0f43;});}return null;};}function removeEntity(_0x22367c,_0x5edb97){return function(_0x24e1df){if(_0x24e1df){return _0x24e1df[_0xb59d('0x2b')]()['then'](function(){var _0x172149=_0x24e1df[_0xb59d('0x2c')]({'plain':!![]});var _0x99d4c8=_0xb59d('0x2d');return db[_0xb59d('0x2e')][_0xb59d('0x2b')]({'where':{'type':_0x99d4c8,'resourceId':_0x172149['id']}})['then'](function(){return _0x24e1df;});})[_0xb59d('0x2a')](function(){_0x22367c[_0xb59d('0x1f')](0xcc)[_0xb59d('0x2f')]();});}};}function handleEntityNotFound(_0x68de05,_0x2334aa){return function(_0x2fe29e){if(!_0x2fe29e){_0x68de05[_0xb59d('0x1e')](0x194);}return _0x2fe29e;};}function handleError(_0x5e18b5,_0x24b530){_0x24b530=_0x24b530||0x1f4;return function(_0x2fe119){logger[_0xb59d('0x30')](_0x2fe119[_0xb59d('0x31')]);if(_0x2fe119['name']){delete _0x2fe119[_0xb59d('0x32')];}_0x5e18b5[_0xb59d('0x1f')](_0x24b530)[_0xb59d('0x33')](_0x2fe119);};}exports['index']=function(_0x54d65b,_0x148199){var _0x2f0a35={},_0x42b27e={},_0x540838={'count':0x0,'rows':[]};var _0x380df6=_[_0xb59d('0x34')](db['Plugin']['rawAttributes'],function(_0x5b9429){return{'name':_0x5b9429['fieldName'],'type':_0x5b9429['type']['key']};});_0x42b27e[_0xb59d('0x35')]=_[_0xb59d('0x34')](_0x380df6,_0xb59d('0x32'));_0x42b27e[_0xb59d('0x36')]=_[_0xb59d('0x37')](_0x54d65b['query']);_0x42b27e[_0xb59d('0x38')]=_[_0xb59d('0x39')](_0x42b27e[_0xb59d('0x35')],_0x42b27e[_0xb59d('0x36')]);_0x2f0a35[_0xb59d('0x3a')]=_[_0xb59d('0x39')](_0x42b27e[_0xb59d('0x35')],qs[_0xb59d('0x3b')](_0x54d65b[_0xb59d('0x36')]['fields']));_0x2f0a35['attributes']=_0x2f0a35[_0xb59d('0x3a')]['length']?_0x2f0a35[_0xb59d('0x3a')]:_0x42b27e['model'];if(!_0x54d65b[_0xb59d('0x36')][_0xb59d('0x3c')]('nolimit')){_0x2f0a35[_0xb59d('0x23')]=qs[_0xb59d('0x23')](_0x54d65b[_0xb59d('0x36')][_0xb59d('0x23')]);_0x2f0a35['offset']=qs[_0xb59d('0x20')](_0x54d65b[_0xb59d('0x36')][_0xb59d('0x20')]);}_0x2f0a35['order']=qs[_0xb59d('0x3d')](_0x54d65b[_0xb59d('0x36')][_0xb59d('0x3d')]);_0x2f0a35[_0xb59d('0x3e')]=qs[_0xb59d('0x38')](_[_0xb59d('0x3f')](_0x54d65b['query'],_0x42b27e[_0xb59d('0x38')]),_0x380df6);if(_0x54d65b['query']['filter']){_0x2f0a35['where']=_['merge'](_0x2f0a35['where'],{'$or':_[_0xb59d('0x34')](_0x380df6,function(_0x12a920){if(_0x12a920[_0xb59d('0x40')]!=='VIRTUAL'){var _0x4f959f={};_0x4f959f[_0x12a920[_0xb59d('0x32')]]={'$like':'%'+_0x54d65b[_0xb59d('0x36')][_0xb59d('0x41')]+'%'};return _0x4f959f;}})});}_0x2f0a35=_['merge']({},_0x2f0a35,_0x54d65b[_0xb59d('0x42')]);var _0x303168={'where':_0x2f0a35['where']};return db['Plugin']['count'](_0x303168)[_0xb59d('0x2a')](function(_0x5564e6){_0x540838[_0xb59d('0x22')]=_0x5564e6;if(_0x54d65b[_0xb59d('0x36')][_0xb59d('0x43')]){_0x2f0a35[_0xb59d('0x44')]=[{'all':!![]}];}return db[_0xb59d('0x45')][_0xb59d('0x46')](_0x2f0a35);})['then'](function(_0x62f0b6){_0x540838[_0xb59d('0x47')]=_0x62f0b6;return _0x540838;})['then'](respondWithFilteredResult(_0x148199,_0x2f0a35))['catch'](handleError(_0x148199,null));};exports[_0xb59d('0x48')]=function(_0x553f0d,_0x2a5c8e){var _0x50153f={'raw':!![],'where':{'id':_0x553f0d[_0xb59d('0x49')]['id']}},_0x5065c4={};_0x5065c4['model']=_['keys'](db[_0xb59d('0x45')][_0xb59d('0x4a')]);_0x5065c4[_0xb59d('0x36')]=_[_0xb59d('0x37')](_0x553f0d[_0xb59d('0x36')]);_0x5065c4[_0xb59d('0x38')]=_[_0xb59d('0x39')](_0x5065c4[_0xb59d('0x35')],_0x5065c4[_0xb59d('0x36')]);_0x50153f[_0xb59d('0x3a')]=_['intersection'](_0x5065c4['model'],qs[_0xb59d('0x3b')](_0x553f0d[_0xb59d('0x36')]['fields']));_0x50153f[_0xb59d('0x3a')]=_0x50153f[_0xb59d('0x3a')][_0xb59d('0x4b')]?_0x50153f[_0xb59d('0x3a')]:_0x5065c4[_0xb59d('0x35')];if(_0x553f0d['query'][_0xb59d('0x43')]){_0x50153f[_0xb59d('0x44')]=[{'all':!![]}];}_0x50153f=_['merge']({},_0x50153f,_0x553f0d[_0xb59d('0x42')]);return db[_0xb59d('0x45')][_0xb59d('0x4c')](_0x50153f)['then'](handleEntityNotFound(_0x2a5c8e,null))[_0xb59d('0x2a')](respondWithResult(_0x2a5c8e,null))[_0xb59d('0x4d')](handleError(_0x2a5c8e,null));};exports[_0xb59d('0x4e')]=function(_0x2b8e15,_0x281af5,_0x40b570){return db[_0xb59d('0x45')][_0xb59d('0x4c')]({'where':{'id':_0x2b8e15[_0xb59d('0x49')]['id']},'attributes':[_0xb59d('0x32'),_0xb59d('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x281af5,null))['then'](function(_0x58fdc7){if(_0x58fdc7){var _0x2477f6=path[_0xb59d('0x4f')](config[_0xb59d('0x50')],_0xb59d('0x51'),util[_0xb59d('0x52')](_0xb59d('0x53'),path[_0xb59d('0x54')](_0x58fdc7[_0xb59d('0x7')])));var _0x241f2e=fs[_0xb59d('0x55')](_0x2477f6);var _0x585995=archiver(_0xb59d('0x56'),{'zlib':{'level':0x9}});_0x585995['on'](_0xb59d('0x57'),function(_0x1b811d){if(_0x1b811d['code']===_0xb59d('0x58')){logger[_0xb59d('0x30')](_0x1b811d);}else{throw new db[(_0xb59d('0x59'))][(_0xb59d('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x585995['on'](_0xb59d('0x30'),function(_0x5eda40){throw new db[(_0xb59d('0x59'))][(_0xb59d('0x5a'))](_0xb59d('0x5b'));});_0x585995['pipe'](_0x241f2e);_0x585995['glob'](_0xb59d('0x5c'),{'cwd':path['join'](config[_0xb59d('0x50')],'server/files/plugins',path[_0xb59d('0x5d')](_0x58fdc7[_0xb59d('0x7')])),'ignore':[path[_0xb59d('0x4f')](path['basename'](_0x58fdc7[_0xb59d('0x7')]),_0xb59d('0x5e')),path[_0xb59d('0x4f')](path[_0xb59d('0x54')](_0x58fdc7[_0xb59d('0x7')]),_0xb59d('0x5f'))],'nodir':!![]})['finalize']();_0x241f2e['on'](_0xb59d('0x60'),function(){if(!fs[_0xb59d('0x61')](_0x2477f6)){throw new db['Sequelize'][(_0xb59d('0x5a'))](_0xb59d('0x62'));}return _0x281af5[_0xb59d('0x4e')](_0x2477f6,util[_0xb59d('0x52')](_0xb59d('0x53'),path[_0xb59d('0x54')](_0x58fdc7[_0xb59d('0x7')])),function(_0x1001f7){if(_0x1001f7){throw new db['Sequelize']['Error'](_0xb59d('0x63'));}fs[_0xb59d('0x64')](_0x2477f6);logger[_0xb59d('0x65')](_0xb59d('0x66'));logger[_0xb59d('0x65')]('Temporary\x20file\x20removed');});});}return null;})[_0xb59d('0x4d')](handleError(_0x281af5,null));};exports[_0xb59d('0x67')]=function(_0x2cd334,_0xde8f63,_0x55e3fb){var _0x317100=path['basename'](_0x2cd334[_0xb59d('0x68')]['filename'],path[_0xb59d('0x69')](_0x2cd334['file']['filename']));var _0x37edf9=path['join'](config[_0xb59d('0x50')],_0xb59d('0x51'),_0x2cd334[_0xb59d('0x68')][_0xb59d('0x6a')]);var _0x223668=path[_0xb59d('0x4f')](config[_0xb59d('0x50')],_0xb59d('0x51'),_0x317100);logger[_0xb59d('0x65')](_0xb59d('0x6b'),_0x37edf9);logger[_0xb59d('0x65')](_0xb59d('0x6c'),_0x223668);try{fs[_0xb59d('0x6d')](_0x37edf9,parseInt(_0xb59d('0x6e'),0x8));extract(_0x37edf9,{'dir':_0x223668},function(_0x115aa0){if(_0x115aa0){logger['error'](_0x115aa0);handleError(_0x115aa0,!![]);};var _0xe37756=fs[_0xb59d('0x6f')](_0x223668);if(_0xe37756[_0xb59d('0x4b')]>0x1){removeReferences(_0x37edf9,_0x223668);logger[_0xb59d('0x30')](_0xb59d('0x70'));return _0x55e3fb(new Error(_0xb59d('0x70')));}var _0x2d6398=fs['lstatSync'](path[_0xb59d('0x4f')](_0x223668,_0xe37756[0x0]));if(_0x2d6398[_0xb59d('0x71')]()){removeReferences(_0x37edf9,_0x223668);logger['error']('Invalid\x20plugin\x20structure');return _0x55e3fb(new Error(_0xb59d('0x70')));}if(_0x2d6398['isDirectory']()){var _0x4cad07=fs[_0xb59d('0x6f')](path['join'](_0x223668,_0xe37756[0x0]));if(_0x4cad07['length']===0x0){removeReferences(_0x37edf9,_0x223668);logger[_0xb59d('0x30')](_0xb59d('0x70'));return _0x55e3fb(new Error(_0xb59d('0x70')));}var _0x435577=_0x4cad07[_0xb59d('0x72')](function(_0x4a6fd0){return _0x4a6fd0===_0xb59d('0x73');});if(!_0x435577){return _0x55e3fb(new Error(_0xb59d('0x74')));}var _0x12a7d6=fs[_0xb59d('0x75')](path[_0xb59d('0x4f')](_0x223668,_0xe37756[0x0],'manifest.json'));var _0x4846b5=JSON['parse'](_0x12a7d6);if(_0xb59d('0x21')==typeof _0x4846b5[_0xb59d('0x32')]){return _0x55e3fb(new Error(_0xb59d('0x76')));}if(_0xb59d('0x21')==typeof _0x4846b5[_0xb59d('0x40')]){return _0x55e3fb(new Error(_0xb59d('0x77')));}if(_0xb59d('0x21')==typeof _0x4846b5[_0xb59d('0x78')]){return _0x55e3fb(new Error(_0xb59d('0x79')));}if(_0xb59d('0x21')==typeof _0x4846b5['parameters']){return _0x55e3fb(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4846b5[_0xb59d('0x40')]===_0xb59d('0x7a')){if(_0xb59d('0x21')==typeof _0x4846b5[_0xb59d('0x7b')]['views']){return _0x55e3fb(new Error(_0xb59d('0x7c')));}if(_0xb59d('0x21')==typeof _0x4846b5[_0xb59d('0x7b')][_0xb59d('0x7d')][_0xb59d('0x7e')]&&_0xb59d('0x21')==typeof _0x4846b5[_0xb59d('0x7b')]['views'][_0xb59d('0x7f')]){return _0x55e3fb(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4846b5['type']===_0xb59d('0x80')){if(_0xb59d('0x21')==typeof _0x4846b5['parameters'][_0xb59d('0x81')]){return _0x55e3fb(new Error(_0xb59d('0x82')));}if('undefined'==typeof _0x4846b5['parameters'][_0xb59d('0x83')]){return _0x55e3fb(new Error(_0xb59d('0x84')));}}else{return _0x55e3fb(new Error(_0xb59d('0x85')));}var _0x1a2bfc=_0x4846b5['name'];var _0x4031cd=_0x4846b5[_0xb59d('0x86')];var _0x360f40=_0x4846b5[_0xb59d('0x40')];var _0x4d3d0d=_0x4846b5[_0xb59d('0x87')]?_0x4846b5[_0xb59d('0x87')]:_0xb59d('0x88');var _0x18bc33=_0x4846b5[_0xb59d('0x89')]?_0x4846b5[_0xb59d('0x89')]:_0xb59d('0x8a');var _0x557c5c='';var _0x1fcc35='';var _0x10348b='';var _0x18c85e='';var _0x53a619=_0x4846b5['version'];if(_0x360f40===_0xb59d('0x7a')){if(_0xb59d('0x21')!=typeof _0x4846b5[_0xb59d('0x7b')]['views'][_0xb59d('0x7e')]){var _0x3774cf=_0x4846b5[_0xb59d('0x7b')]['views'][_0xb59d('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xb59d('0x8b')](_0x3774cf)){_0x557c5c=path[_0xb59d('0x4f')](_0xb59d('0x8c'),_0x317100,_0xe37756[0x0],_0x3774cf);}else{_0x557c5c=_0x3774cf;}}else{logger[_0xb59d('0x65')](_0xb59d('0x8d'));}if('undefined'!=typeof _0x4846b5['parameters'][_0xb59d('0x7d')][_0xb59d('0x7f')]){var _0x57293f=_0x4846b5['parameters'][_0xb59d('0x7d')][_0xb59d('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xb59d('0x8b')](_0x57293f)){_0x1fcc35=path['join'](_0xb59d('0x8c'),_0x317100,_0xe37756[0x0],_0x57293f);}else{_0x1fcc35=_0x57293f;}}else{logger[_0xb59d('0x65')](_0xb59d('0x8e'));}}else if(_0x360f40===_0xb59d('0x80')){_0x10348b=_0x4846b5[_0xb59d('0x7b')]['scriptName'];_0x18c85e=_0x4846b5[_0xb59d('0x7b')][_0xb59d('0x83')];if(_0xb59d('0x21')!=typeof _0x4846b5['parameters'][_0xb59d('0x7d')]){if('undefined'!=typeof _0x4846b5[_0xb59d('0x7b')][_0xb59d('0x7d')][_0xb59d('0x7e')]){var _0x3774cf=_0x4846b5[_0xb59d('0x7b')][_0xb59d('0x7d')][_0xb59d('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3774cf)){_0x557c5c=path['join'](_0xb59d('0x8c'),_0x317100,_0xe37756[0x0],_0x3774cf);}else{_0x557c5c=_0x3774cf;}}if(_0xb59d('0x21')!=typeof _0x4846b5['parameters']['views'][_0xb59d('0x7f')]){var _0x57293f=_0x4846b5[_0xb59d('0x7b')][_0xb59d('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x57293f)){_0x1fcc35=path[_0xb59d('0x4f')]('plugins',_0x317100,_0xe37756[0x0],_0x57293f);}else{_0x1fcc35=_0x57293f;}}}}var _0x5dbcd5={'name':_0x1a2bfc,'description':_0x4031cd,'path':path[_0xb59d('0x4f')](_0x317100,_0xe37756[0x0]),'type':_0x360f40,'sidebar':_0x4d3d0d,'icon':_0x18bc33,'adminUrl':_0x557c5c,'agentUrl':_0x1fcc35,'scriptName':_0x10348b,'scriptPath':_0x18c85e,'version':_0x53a619};removeReferences(_0x37edf9,null);return db[_0xb59d('0x45')]['create'](_0x5dbcd5)[_0xb59d('0x2a')](function(_0x4c7cf4){var _0x4b42a6={'role':_0x2cd334[_0xb59d('0x8f')][_0xb59d('0x90')],'userProfileId':_0x2cd334[_0xb59d('0x8f')][_0xb59d('0x91')]};if(!_0x4b42a6)throw new Error(_0xb59d('0x92'));if(_0x4b42a6[_0xb59d('0x90')]===_0xb59d('0x93')){var _0x459008=_0x4c7cf4['get']({'plain':!![]});return db[_0xb59d('0x94')][_0xb59d('0x4c')]({'where':{'name':'Plugins','userProfileId':_0x4b42a6['userProfileId']},'raw':!![]})[_0xb59d('0x2a')](function(_0x144e20){if(_0x144e20&&_0x144e20['autoAssociation']===0x0){return db[_0xb59d('0x2e')][_0xb59d('0x95')]({'name':_0x459008['name'],'resourceId':_0x459008['id'],'type':_0x144e20['name'],'sectionId':_0x144e20['id']},{})['then'](function(){return _0x4c7cf4;});}else{return _0x4c7cf4;}})[_0xb59d('0x4d')](function(_0x233454){logger[_0xb59d('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233454);throw _0x233454;});}return _0x4c7cf4;})[_0xb59d('0x2a')](respondWithResult(_0xde8f63,null))['catch'](handleError(_0xde8f63,null));}});}catch(_0x2d15f3){_0xde8f63[_0xb59d('0x1f')](0x1f4)[_0xb59d('0x33')](_0x2d15f3);}};function removeReferences(_0xd95468,_0x388069){try{if(_0xd95468){fs['unlinkSync'](_0xd95468);logger[_0xb59d('0x65')]('Zip\x20archive\x20removed');}if(_0x388069){rimraf(_0x388069,function(){});logger[_0xb59d('0x65')]('Extracted\x20folder\x20removed');}}catch(_0x5941f1){logger[_0xb59d('0x30')](_0x5941f1);}}exports[_0xb59d('0x29')]=function(_0x5e08ad,_0x2e0107,_0x32b4e4){return db[_0xb59d('0x45')][_0xb59d('0x4c')]({'where':{'id':_0x5e08ad[_0xb59d('0x49')]['id']}})[_0xb59d('0x2a')](handleEntityNotFound(_0x2e0107,null))['then'](saveUpdates(_0x5e08ad[_0xb59d('0x8f')],null))[_0xb59d('0x2a')](respondWithResult(_0x2e0107,null))[_0xb59d('0x4d')](handleError(_0x2e0107,null));};exports['delete']=function(_0x30ec24,_0x3d2170,_0x191364){return db['Plugin']['find']({'where':{'id':_0x30ec24[_0xb59d('0x49')]['id']}})[_0xb59d('0x2a')](function(_0x18a422){if(_0x18a422){return _0x18a422[_0xb59d('0x2b')]();}})[_0xb59d('0x2a')](function(_0x218e46){rimraf(path['join'](config[_0xb59d('0x50')],'server/files/plugins',path[_0xb59d('0x5d')](_0x218e46[_0xb59d('0x7')])),function(){});return _0x218e46;})[_0xb59d('0x2a')](handleEntityNotFound(_0x3d2170,null))[_0xb59d('0x2a')](respondWithStatusCode(_0x3d2170,null))[_0xb59d('0x4d')](handleError(_0x3d2170,null));};exports[_0xb59d('0x96')]=function(_0x40d5f2,_0x5644d8,_0x299e5c){return BPromise['resolve']()[_0xb59d('0x2a')](function(){if(!_0x40d5f2['query'][_0xb59d('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x40d5f2[_0xb59d('0x36')][_0xb59d('0x97')]){throw new Error(_0xb59d('0x98'));}var _0x37f443=_0x40d5f2[_0xb59d('0x36')][_0xb59d('0x99')]?_0x40d5f2['query'][_0xb59d('0x99')]+':'+_0x40d5f2[_0xb59d('0x36')][_0xb59d('0x97')]:'http://localhost:'+_0x40d5f2[_0xb59d('0x36')][_0xb59d('0x97')];var _0x547176=_0x40d5f2[_0xb59d('0x36')][_0xb59d('0x26')]?_0x40d5f2[_0xb59d('0x36')][_0xb59d('0x26')]:!![];var _0x459aa2=_0x40d5f2[_0xb59d('0x36')][_0xb59d('0x9a')]?_0x40d5f2[_0xb59d('0x36')][_0xb59d('0x9a')]:null;var _0x263191={'method':_0x40d5f2[_0xb59d('0x9b')],'uri':util['format'](_0xb59d('0x9c'),_0x37f443,_0x40d5f2['query'][_0xb59d('0x7')]),'json':_0x547176,'resolveWithFullResponse':!![],'encoding':_0x459aa2,'qs':_0x40d5f2[_0xb59d('0x36')]};if(_0x40d5f2['headers']){_0x263191[_0xb59d('0x9d')]=_0x40d5f2[_0xb59d('0x9d')];if(_0x263191[_0xb59d('0x9d')]['content-length']){delete _0x263191[_0xb59d('0x9d')][_0xb59d('0x9e')];}}if(_0x263191[_0xb59d('0x9d')][_0xb59d('0x9f')]){delete _0x263191[_0xb59d('0x9d')]['content-type'];}return rp(_0x263191);})[_0xb59d('0x2a')](function(_0x30ce9a){if(_0x30ce9a){_0x5644d8[_0xb59d('0x24')](_0x30ce9a[_0xb59d('0x9d')]);logger['info'](_0x30ce9a['body']);if(_[_0xb59d('0xa0')](_0x40d5f2[_0xb59d('0x36')]['path'],_0xb59d('0x4e'))&&_0x30ce9a[_0xb59d('0xa1')]==0x1f4){return _0x5644d8['sendStatus'](_0x30ce9a[_0xb59d('0xa1')]);}else{return _0x5644d8[_0xb59d('0x1f')](_0x30ce9a[_0xb59d('0xa1')])[_0xb59d('0x33')](_0x30ce9a[_0xb59d('0x8f')]);}}else{return _0x5644d8[_0xb59d('0x1e')](0xc8);}})['catch'](handleError(_0x5644d8,null));};exports['webhookPost']=function(_0x2ea001,_0x249dd9,_0x3d5423){return BPromise[_0xb59d('0xa2')]()[_0xb59d('0x2a')](function(){if(!_0x2ea001[_0xb59d('0x36')][_0xb59d('0x7')]){throw new Error(_0xb59d('0xa3'));}if(!_0x2ea001['query'][_0xb59d('0x97')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3808f5=_0x2ea001[_0xb59d('0x36')][_0xb59d('0x99')]?_0x2ea001['query'][_0xb59d('0x99')]+':'+_0x2ea001['query'][_0xb59d('0x97')]:_0xb59d('0xa4')+_0x2ea001['query'][_0xb59d('0x97')];var _0x1790b6=_0x2ea001[_0xb59d('0x36')]['json']?_0x2ea001[_0xb59d('0x36')][_0xb59d('0x26')]:!![];var _0x542ca9=_0x2ea001[_0xb59d('0x36')][_0xb59d('0x9a')]?_0x2ea001[_0xb59d('0x36')]['encoding']:null;var _0x5dd463={'method':_0x2ea001[_0xb59d('0x9b')],'uri':util[_0xb59d('0x52')](_0xb59d('0x9c'),_0x3808f5,_0x2ea001[_0xb59d('0x36')][_0xb59d('0x7')]),'json':_0x1790b6,'resolveWithFullResponse':!![],'encoding':_0x542ca9,'body':_0x2ea001[_0xb59d('0x8f')]};if(_0x2ea001['headers']){_0x5dd463[_0xb59d('0x9d')]=_0x2ea001[_0xb59d('0x9d')];if(_0x5dd463[_0xb59d('0x9d')][_0xb59d('0x9e')]){delete _0x5dd463[_0xb59d('0x9d')][_0xb59d('0x9e')];}}if(_0x5dd463[_0xb59d('0x9d')][_0xb59d('0x9f')]){delete _0x5dd463[_0xb59d('0x9d')][_0xb59d('0x9f')];}return rp(_0x5dd463);})['then'](function(_0x4c37f7){if(_0x4c37f7){_0x249dd9[_0xb59d('0x24')](_0x4c37f7[_0xb59d('0x9d')]);logger[_0xb59d('0x65')](_0x4c37f7[_0xb59d('0x8f')]);return _0x249dd9['status'](_0x4c37f7['statusCode'])['send'](_0x4c37f7[_0xb59d('0x8f')]);}else{return _0x249dd9['sendStatus'](0xc8);}})[_0xb59d('0x4d')](handleError(_0x249dd9,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 63e0acf..ce33acd 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 _0xe978=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','update','remove'];(function(_0x450274,_0x31a442){var _0x26a500=function(_0x3428b5){while(--_0x3428b5){_0x450274['push'](_0x450274['shift']());}};_0x26a500(++_0x31a442);}(_0xe978,0x70));var _0x8e97=function(_0x56ad64,_0x46654a){_0x56ad64=_0x56ad64-0x0;var _0x7a0f1e=_0xe978[_0x56ad64];return _0x7a0f1e;};'use strict';var EventEmitter=require(_0x8e97('0x0'));var Plugin=require(_0x8e97('0x1'))['db'][_0x8e97('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e97('0x3'),'afterDestroy':_0x8e97('0x4')};function emitEvent(_0x16e587){return function(_0x3e3a3a,_0x1e27f7,_0x4f11c9){PluginEvents[_0x8e97('0x5')](_0x16e587+':'+_0x3e3a3a['id'],_0x3e3a3a);PluginEvents[_0x8e97('0x5')](_0x16e587,_0x3e3a3a);_0x4f11c9(null);};}for(var e in events){if(events[_0x8e97('0x6')](e)){var event=events[e];Plugin[_0x8e97('0x7')](e,emitEvent(event));}}module[_0x8e97('0x8')]=PluginEvents; \ No newline at end of file +var _0xcfcb=['hook','exports','events','save','update','remove','emit','hasOwnProperty'];(function(_0xd5584e,_0x251c06){var _0xdc594e=function(_0x2b9c26){while(--_0x2b9c26){_0xd5584e['push'](_0xd5584e['shift']());}};_0xdc594e(++_0x251c06);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x1d06a5,_0x4fc577){_0x1d06a5=_0x1d06a5-0x0;var _0xbaab59=_0xcfcb[_0x1d06a5];return _0xbaab59;};'use strict';var EventEmitter=require(_0xbcfc('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbcfc('0x1'),'afterUpdate':_0xbcfc('0x2'),'afterDestroy':_0xbcfc('0x3')};function emitEvent(_0x16bde0){return function(_0x38bab3,_0x32707d,_0x83687c){PluginEvents[_0xbcfc('0x4')](_0x16bde0+':'+_0x38bab3['id'],_0x38bab3);PluginEvents[_0xbcfc('0x4')](_0x16bde0,_0x38bab3);_0x83687c(null);};}for(var e in events){if(events[_0xbcfc('0x5')](e)){var event=events[e];Plugin[_0xbcfc('0x6')](e,emitEvent(event));}}module[_0xbcfc('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 6cec029..e80185e 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 _0xd928=['bluebird','path','rimraf','../../config/environment','exports','define','Plugin','util','api'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0xd928,0x85));var _0x8d92=function(_0x4677fd,_0x584959){_0x4677fd=_0x4677fd-0x0;var _0x19f482=_0xd928[_0x4677fd];return _0x19f482;};'use strict';var _=require('lodash');var util=require(_0x8d92('0x0'));var logger=require('../../config/logger')(_0x8d92('0x1'));var moment=require('moment');var BPromise=require(_0x8d92('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d92('0x3'));var rimraf=require(_0x8d92('0x4'));var config=require(_0x8d92('0x5'));var attributes=require('./plugin.attributes');module[_0x8d92('0x6')]=function(_0x19e050,_0x2b42eb){return _0x19e050[_0x8d92('0x7')](_0x8d92('0x8'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46e8=['define','Plugin','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x2510f9,_0x5bc462){var _0x3d348f=function(_0x15921a){while(--_0x15921a){_0x2510f9['push'](_0x2510f9['shift']());}};_0x3d348f(++_0x5bc462);}(_0x46e8,0x1c5));var _0x846e=function(_0x54aea5,_0x140000){_0x54aea5=_0x54aea5-0x0;var _0x1aada3=_0x46e8[_0x54aea5];return _0x1aada3;};'use strict';var _=require(_0x846e('0x0'));var util=require(_0x846e('0x1'));var logger=require(_0x846e('0x2'))(_0x846e('0x3'));var moment=require(_0x846e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x846e('0x5'));var config=require(_0x846e('0x6'));var attributes=require(_0x846e('0x7'));module[_0x846e('0x8')]=function(_0x4443a2,_0x3144c8){return _0x4443a2[_0x846e('0x9')](_0x846e('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 9012017..bb91d33 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 _0x730a=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x730a,0x101));var _0xa730=function(_0x13b796,_0x19507b){_0x13b796=_0x13b796-0x0;var _0x54757d=_0x730a[_0x13b796];return _0x54757d;};'use strict';var _=require('lodash');var util=require(_0xa730('0x0'));var moment=require(_0xa730('0x1'));var BPromise=require(_0xa730('0x2'));var rs=require(_0xa730('0x3'));var fs=require('fs');var Redis=require(_0xa730('0x4'));var db=require(_0xa730('0x5'))['db'];var utils=require(_0xa730('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa730('0x7'));var client=jayson[_0xa730('0x8')][_0xa730('0x9')]({'port':0x232a});config['redis']=_[_0xa730('0xa')](config[_0xa730('0xb')],{'host':_0xa730('0xc'),'port':0x18eb});var socket=require(_0xa730('0xd'))(new Redis(config[_0xa730('0xb')]));require(_0xa730('0xe'))[_0xa730('0xf')](socket);function respondWithRpcPromise(_0x5080f1,_0xba074a,_0x289e8e){return new BPromise(function(_0x333ca2,_0x33e1a8){return client['request'](_0x5080f1,_0x289e8e)['then'](function(_0x511eee){logger[_0xa730('0x10')](_0xa730('0x11'),_0xba074a,_0xa730('0x12'));logger[_0xa730('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0xba074a,_0xa730('0x12'),JSON[_0xa730('0x14')](_0x511eee));if(_0x511eee[_0xa730('0x15')]){if(_0x511eee[_0xa730('0x15')][_0xa730('0x16')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0xba074a,_0x511eee['error'][_0xa730('0x17')]);return _0x33e1a8(_0x511eee[_0xa730('0x15')][_0xa730('0x17')]);}logger[_0xa730('0x15')]('Plugin,\x20%s,\x20%s',_0xba074a,_0x511eee['error'][_0xa730('0x17')]);return _0x333ca2(_0x511eee[_0xa730('0x15')]['message']);}else{logger[_0xa730('0x10')](_0xa730('0x11'),_0xba074a,_0xa730('0x12'));_0x333ca2(_0x511eee[_0xa730('0x18')][_0xa730('0x17')]);}})[_0xa730('0x19')](function(_0x20c005){logger[_0xa730('0x15')](_0xa730('0x11'),_0xba074a,_0x20c005);_0x33e1a8(_0x20c005);});});}exports[_0xa730('0x1a')]=function(_0x369c5d){var _0x301b56=this;return new Promise(function(_0x3c14e9,_0x12e208){return db[_0xa730('0x1b')][_0xa730('0x1c')](_0x369c5d[_0xa730('0x1d')],{'raw':_0x369c5d['options']?_0x369c5d[_0xa730('0x1e')][_0xa730('0x1f')]===undefined?!![]:![]:!![]})[_0xa730('0x20')](function(_0x17cca4){logger[_0xa730('0x10')](_0xa730('0x1a'),_0x369c5d);logger[_0xa730('0x13')](_0xa730('0x1a'),_0x369c5d,JSON[_0xa730('0x14')](_0x17cca4));_0x3c14e9(_0x17cca4);})[_0xa730('0x19')](function(_0x18145d){logger[_0xa730('0x15')](_0xa730('0x1a'),_0x18145d[_0xa730('0x17')],_0x369c5d);_0x12e208(_0x301b56[_0xa730('0x15')](0x1f4,_0x18145d['message']));});});}; \ No newline at end of file +var _0x1a76=['jayson/promise','http','redis','defaults','localhost','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Plugin','create','options','raw','CreatePlugin','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x3e6e52,_0x1d3114){var _0x3d7618=function(_0x10e2c5){while(--_0x10e2c5){_0x3e6e52['push'](_0x3e6e52['shift']());}};_0x3d7618(++_0x1d3114);}(_0x1a76,0xf1));var _0x61a7=function(_0x4d30ac,_0x112604){_0x4d30ac=_0x4d30ac-0x0;var _0x279f70=_0x1a76[_0x4d30ac];return _0x279f70;};'use strict';var _=require('lodash');var util=require(_0x61a7('0x0'));var moment=require(_0x61a7('0x1'));var BPromise=require(_0x61a7('0x2'));var rs=require(_0x61a7('0x3'));var fs=require('fs');var Redis=require(_0x61a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x61a7('0x5'));var logger=require('../../config/logger')(_0x61a7('0x6'));var config=require('../../config/environment');var jayson=require(_0x61a7('0x7'));var client=jayson['client'][_0x61a7('0x8')]({'port':0x232a});config[_0x61a7('0x9')]=_[_0x61a7('0xa')](config['redis'],{'host':_0x61a7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x61a7('0xc'))[_0x61a7('0xd')](socket);function respondWithRpcPromise(_0x43f09a,_0x60bbdc,_0x2900b8){return new BPromise(function(_0x5423ac,_0xf7b6dc){return client['request'](_0x43f09a,_0x2900b8)[_0x61a7('0xe')](function(_0x43112d){logger[_0x61a7('0xf')](_0x61a7('0x10'),_0x60bbdc,_0x61a7('0x11'));logger[_0x61a7('0x12')](_0x61a7('0x13'),_0x60bbdc,'request\x20sent',JSON[_0x61a7('0x14')](_0x43112d));if(_0x43112d[_0x61a7('0x15')]){if(_0x43112d[_0x61a7('0x15')][_0x61a7('0x16')]===0x1f4){logger[_0x61a7('0x15')](_0x61a7('0x10'),_0x60bbdc,_0x43112d[_0x61a7('0x15')]['message']);return _0xf7b6dc(_0x43112d[_0x61a7('0x15')][_0x61a7('0x17')]);}logger[_0x61a7('0x15')](_0x61a7('0x10'),_0x60bbdc,_0x43112d[_0x61a7('0x15')][_0x61a7('0x17')]);return _0x5423ac(_0x43112d[_0x61a7('0x15')][_0x61a7('0x17')]);}else{logger[_0x61a7('0xf')](_0x61a7('0x10'),_0x60bbdc,_0x61a7('0x11'));_0x5423ac(_0x43112d[_0x61a7('0x18')][_0x61a7('0x17')]);}})[_0x61a7('0x19')](function(_0x53e0f6){logger[_0x61a7('0x15')]('Plugin,\x20%s,\x20%s',_0x60bbdc,_0x53e0f6);_0xf7b6dc(_0x53e0f6);});});}exports['CreatePlugin']=function(_0x58e3cb){var _0x35ba7d=this;return new Promise(function(_0x4ac5fa,_0x489ee6){return db[_0x61a7('0x1a')][_0x61a7('0x1b')](_0x58e3cb['body'],{'raw':_0x58e3cb[_0x61a7('0x1c')]?_0x58e3cb[_0x61a7('0x1c')][_0x61a7('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x4c6115){logger[_0x61a7('0xf')]('CreatePlugin',_0x58e3cb);logger['debug'](_0x61a7('0x1e'),_0x58e3cb,JSON[_0x61a7('0x14')](_0x4c6115));_0x4ac5fa(_0x4c6115);})[_0x61a7('0x19')](function(_0x3543f6){logger[_0x61a7('0x15')](_0x61a7('0x1e'),_0x3543f6['message'],_0x58e3cb);_0x489ee6(_0x35ba7d[_0x61a7('0x15')](0x1f4,_0x3543f6[_0x61a7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c21b7e4..7b93c02 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 _0xe384=['update','emit','register','plugin:','./plugin.events','remove'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xe384,0x160));var _0x4e38=function(_0x5a7789,_0x227fef){_0x5a7789=_0x5a7789-0x0;var _0xd58b00=_0xe384[_0x5a7789];return _0xd58b00;};'use strict';var PluginEvents=require(_0x4e38('0x0'));var events=['save',_0x4e38('0x1'),_0x4e38('0x2')];function createListener(_0x521a6f,_0x4820f4){return function(_0x5164a5){_0x4820f4[_0x4e38('0x3')](_0x521a6f,_0x5164a5);};}function removeListener(_0x1c4e12,_0x4a97d6){return function(){PluginEvents['removeListener'](_0x1c4e12,_0x4a97d6);};}exports[_0x4e38('0x4')]=function(_0x5a34a1){for(var _0x52fd5e=0x0,_0x2a1873=events['length'];_0x52fd5e<_0x2a1873;_0x52fd5e++){var _0x582197=events[_0x52fd5e];var _0x1030fd=createListener(_0x4e38('0x5')+_0x582197,_0x5a34a1);PluginEvents['on'](_0x582197,_0x1030fd);}}; \ No newline at end of file +var _0x0716=['length','plugin:','./plugin.events','update','emit','removeListener'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x0716,0xda));var _0x6071=function(_0x33199e,_0x428ded){_0x33199e=_0x33199e-0x0;var _0x2eef3c=_0x0716[_0x33199e];return _0x2eef3c;};'use strict';var PluginEvents=require(_0x6071('0x0'));var events=['save','remove',_0x6071('0x1')];function createListener(_0x5bc2a7,_0x37d768){return function(_0x108713){_0x37d768[_0x6071('0x2')](_0x5bc2a7,_0x108713);};}function removeListener(_0x49e237,_0x338abe){return function(){PluginEvents[_0x6071('0x3')](_0x49e237,_0x338abe);};}exports['register']=function(_0x57489b){for(var _0x3bbe03=0x0,_0x1fd085=events[_0x6071('0x4')];_0x3bbe03<_0x1fd085;_0x3bbe03++){var _0x4ffbb7=events[_0x3bbe03];var _0x3fa60d=createListener(_0x6071('0x5')+_0x4ffbb7,_0x57489b);PluginEvents['on'](_0x4ffbb7,_0x3fa60d);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4f029a4..0a0633d 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(_0x24aea5,_0x57d492){var _0x3c97ec=function(_0x521f05){while(--_0x521f05){_0x24aea5['push'](_0x24aea5['shift']());}};_0x3c97ec(++_0x57d492);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0xb0546e,_0x2bb10c){var _0x47b8ae=function(_0x4299dc){while(--_0x4299dc){_0xb0546e['push'](_0xb0546e['shift']());}};_0x47b8ae(++_0x2bb10c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 b0c9477..e5775e3 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3667=['lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','create','body','join','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','params','destroy','delete'];(function(_0x560fdb,_0xe678c1){var _0x18ef38=function(_0x1c7361){while(--_0x1c7361){_0x560fdb['push'](_0x560fdb['shift']());}};_0x18ef38(++_0xe678c1);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var pm2=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var path=require(_0x7366('0x4'));var exec=require('child_process')[_0x7366('0x5')];var BPromise=require(_0x7366('0x6'));function handleEntityNotFound(_0x4b32a7,_0x27726b){return function(_0x22bfc0){if(!_0x22bfc0){_0x4b32a7[_0x7366('0x7')](0x194);;}return _0x22bfc0;};}function respondWithResult(_0x1c0cf4,_0x101e3d){_0x101e3d=_0x101e3d||0xc8;return function(_0x589397){if(_0x589397){return _0x1c0cf4[_0x7366('0x8')](_0x101e3d)[_0x7366('0x9')](_0x589397);}return null;};}function handleError(_0x2dd32b,_0x26e9a9){_0x26e9a9=_0x26e9a9||0x1f4;return function(_0x171fe2){logger[_0x7366('0xa')](_0x171fe2[_0x7366('0xb')]);if(_0x171fe2[_0x7366('0xc')]){delete _0x171fe2[_0x7366('0xc')];}_0x2dd32b[_0x7366('0x8')](_0x26e9a9)[_0x7366('0xd')](_0x171fe2);};}function execChildProcess(){return new BPromise(function(_0x2d7e38,_0x57ea7f){exec(_0x7366('0xe'),function(_0x2694fc,_0xbcd488,_0x4718db){logger[_0x7366('0xf')](_0xbcd488);logger[_0x7366('0xf')](_0x4718db);if(_0x2694fc){logger[_0x7366('0xa')](_0x2694fc);return _0x57ea7f(_0x2694fc);}return _0x2d7e38(_0xbcd488);});});}exports[_0x7366('0x10')]=function(_0x37e47e,_0x1813b7){return pm2[_0x7366('0x11')]()[_0x7366('0x12')](function(_0x27500c){if(_0x27500c){var _0x22562f=_[_0x7366('0x13')](_0x27500c,function(_0x4dd111){return _0x4dd111[_0x7366('0xc')]===_0x7366('0x14')||_0x4dd111[_0x7366('0xc')]===_0x7366('0x15');});return{'rows':_0x22562f,'count':_0x22562f[_0x7366('0x16')]};}return null;})[_0x7366('0x12')](respondWithResult(_0x1813b7,null))[_0x7366('0x17')](handleError(_0x1813b7,null));};exports[_0x7366('0x18')]=function(_0x83e5d5,_0x41113f){return pm2[_0x7366('0x19')](_0x83e5d5['params']['id'])[_0x7366('0x12')](respondWithResult(_0x41113f,null))['then'](handleEntityNotFound(_0x41113f,null))[_0x7366('0x17')](handleError(_0x41113f,null));};exports[_0x7366('0x1a')]=function(_0x3f23cd,_0x52b43e){if(_0x3f23cd[_0x7366('0x1b')][_0x7366('0xc')]&&_0x3f23cd[_0x7366('0x1b')]['script']){var _0x16e038=path[_0x7366('0x1c')](__dirname,'../../files/plugins',_0x3f23cd[_0x7366('0x1b')][_0x7366('0x1d')]);var _0xaab659=process[_0x7366('0x1e')]();process[_0x7366('0x1f')](path[_0x7366('0x20')](_0x16e038));return execChildProcess()[_0x7366('0x12')](function(_0x22ed7e){process[_0x7366('0x1f')](_0xaab659);return pm2[_0x7366('0x21')]({'name':_0x3f23cd[_0x7366('0x1b')][_0x7366('0xc')],'script':_0x16e038});})[_0x7366('0x12')](function(_0x563b22){pm2[_0x7366('0x22')]();return _0x563b22[0x0];})['then'](respondWithResult(_0x52b43e,0xc9))[_0x7366('0x17')](handleError(_0x52b43e,null));}else{return _0x52b43e['status'](0x1f4)['send']({'message':_0x7366('0x23')});}};exports['update']=function(_0x254374,_0x4ac138){if(_0x254374[_0x7366('0x1b')]['id']){delete _0x254374[_0x7366('0x1b')]['id'];}var _0x5c37e2={'online':_0x7366('0x24'),'stopped':'stop'};if(_0x5c37e2[_0x7366('0x25')](_0x254374[_0x7366('0x1b')]['status'])){return pm2[_0x5c37e2[_0x254374[_0x7366('0x1b')]['status']]](_0x254374[_0x7366('0x26')]['id'])[_0x7366('0x12')](respondWithResult(_0x4ac138,0xc8))[_0x7366('0x17')](handleError(_0x4ac138,null));}else{return _0x4ac138[_0x7366('0x8')](0x1f4)[_0x7366('0xd')]({'message':'Unknown\x20status'});}};exports[_0x7366('0x27')]=function(_0x447807,_0x538d42){if(_0x447807['body']['id']){delete _0x447807['body']['id'];}if(_0x447807['params']['id']){return pm2[_0x7366('0x28')](_0x447807[_0x7366('0x26')]['id'])[_0x7366('0x12')](function(_0x15286a){pm2['dump']();return _0x15286a[0x0];})[_0x7366('0x12')](respondWithResult(_0x538d42,null))[_0x7366('0x17')](handleError(_0x538d42,null));}else{return _0x538d42[_0x7366('0x8')](0x1f4)[_0x7366('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x39cb=['create','body','join','../../files/plugins','cwd','chdir','start','send','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','../../config/pm2','../../config/logger','path','child_process','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','then','reject','express','motion2','length','catch','show','describe','params'];(function(_0x4c1bdb,_0x8ef773){var _0x113ea2=function(_0x5e247a){while(--_0x5e247a){_0x4c1bdb['push'](_0x4c1bdb['shift']());}};_0x113ea2(++_0x8ef773);}(_0x39cb,0x1bd));var _0xb39c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x39cb[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var pm2=require(_0xb39c('0x0'));var logger=require(_0xb39c('0x1'))('api');var path=require(_0xb39c('0x2'));var exec=require(_0xb39c('0x3'))['exec'];var BPromise=require(_0xb39c('0x4'));function handleEntityNotFound(_0x285eca,_0x398d07){return function(_0x2bca14){if(!_0x2bca14){_0x285eca[_0xb39c('0x5')](0x194);;}return _0x2bca14;};}function respondWithResult(_0x4ae4cf,_0x32cdcd){_0x32cdcd=_0x32cdcd||0xc8;return function(_0x2fc868){if(_0x2fc868){return _0x4ae4cf[_0xb39c('0x6')](_0x32cdcd)[_0xb39c('0x7')](_0x2fc868);}return null;};}function handleError(_0x47d6d7,_0x5ae14a){_0x5ae14a=_0x5ae14a||0x1f4;return function(_0x41557b){logger[_0xb39c('0x8')](_0x41557b[_0xb39c('0x9')]);if(_0x41557b[_0xb39c('0xa')]){delete _0x41557b['name'];}_0x47d6d7['status'](_0x5ae14a)['send'](_0x41557b);};}function execChildProcess(){return new BPromise(function(_0x1de94f,_0x497ffc){exec(_0xb39c('0xb'),function(_0x1088ee,_0x433ee8,_0x340622){logger[_0xb39c('0xc')](_0x433ee8);logger[_0xb39c('0xc')](_0x340622);if(_0x1088ee){logger['error'](_0x1088ee);return _0x497ffc(_0x1088ee);}return _0x1de94f(_0x433ee8);});});}exports[_0xb39c('0xd')]=function(_0x468995,_0x2620cd){return pm2['list']()[_0xb39c('0xe')](function(_0x40a6d3){if(_0x40a6d3){var _0x42a203=_[_0xb39c('0xf')](_0x40a6d3,function(_0x469fa9){return _0x469fa9[_0xb39c('0xa')]===_0xb39c('0x10')||_0x469fa9['name']===_0xb39c('0x11');});return{'rows':_0x42a203,'count':_0x42a203[_0xb39c('0x12')]};}return null;})[_0xb39c('0xe')](respondWithResult(_0x2620cd,null))[_0xb39c('0x13')](handleError(_0x2620cd,null));};exports[_0xb39c('0x14')]=function(_0x3b7fad,_0x1a2f48){return pm2[_0xb39c('0x15')](_0x3b7fad[_0xb39c('0x16')]['id'])[_0xb39c('0xe')](respondWithResult(_0x1a2f48,null))['then'](handleEntityNotFound(_0x1a2f48,null))[_0xb39c('0x13')](handleError(_0x1a2f48,null));};exports[_0xb39c('0x17')]=function(_0x28bbe1,_0x447352){if(_0x28bbe1['body'][_0xb39c('0xa')]&&_0x28bbe1[_0xb39c('0x18')]['script']){var _0x2d8e93=path[_0xb39c('0x19')](__dirname,_0xb39c('0x1a'),_0x28bbe1['body']['script']);var _0x2789fd=process[_0xb39c('0x1b')]();process[_0xb39c('0x1c')](path['dirname'](_0x2d8e93));return execChildProcess()[_0xb39c('0xe')](function(_0x438207){process[_0xb39c('0x1c')](_0x2789fd);return pm2[_0xb39c('0x1d')]({'name':_0x28bbe1[_0xb39c('0x18')]['name'],'script':_0x2d8e93});})[_0xb39c('0xe')](function(_0xbeab7e){pm2['dump']();return _0xbeab7e[0x0];})[_0xb39c('0xe')](respondWithResult(_0x447352,0xc9))[_0xb39c('0x13')](handleError(_0x447352,null));}else{return _0x447352[_0xb39c('0x6')](0x1f4)[_0xb39c('0x1e')]({'message':_0xb39c('0x1f')});}};exports['update']=function(_0x23a2f1,_0x299c27){if(_0x23a2f1[_0xb39c('0x18')]['id']){delete _0x23a2f1['body']['id'];}var _0x41fff2={'online':_0xb39c('0x20'),'stopped':'stop'};if(_0x41fff2[_0xb39c('0x21')](_0x23a2f1[_0xb39c('0x18')][_0xb39c('0x6')])){return pm2[_0x41fff2[_0x23a2f1['body'][_0xb39c('0x6')]]](_0x23a2f1[_0xb39c('0x16')]['id'])['then'](respondWithResult(_0x299c27,0xc8))[_0xb39c('0x13')](handleError(_0x299c27,null));}else{return _0x299c27['status'](0x1f4)[_0xb39c('0x1e')]({'message':_0xb39c('0x22')});}};exports[_0xb39c('0x23')]=function(_0x7339b4,_0x17eb7b){if(_0x7339b4['body']['id']){delete _0x7339b4[_0xb39c('0x18')]['id'];}if(_0x7339b4['params']['id']){return pm2[_0xb39c('0x24')](_0x7339b4['params']['id'])[_0xb39c('0xe')](function(_0xe2111a){pm2[_0xb39c('0x25')]();return _0xe2111a[0x0];})[_0xb39c('0xe')](respondWithResult(_0x17eb7b,null))['catch'](handleError(_0x17eb7b,null));}else{return _0x17eb7b['status'](0x1f4)[_0xb39c('0x1e')]({'message':_0xb39c('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index f5887f8..cd86121 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 _0xe2be=['exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','getQueues'];(function(_0x13a320,_0x1e3870){var _0x4c913a=function(_0x284da2){while(--_0x284da2){_0x13a320['push'](_0x13a320['shift']());}};_0x4c913a(++_0x1e3870);}(_0xe2be,0x6f));var _0xee2b=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xe2be[_0x1ddedd];return _0xa3e1ac;};'use strict';var express=require(_0xee2b('0x0'));var router=express[_0xee2b('0x1')]();var auth=require(_0xee2b('0x2'));var controller=require(_0xee2b('0x3'));router[_0xee2b('0x4')](_0xee2b('0x5'),auth[_0xee2b('0x6')](),controller[_0xee2b('0x7')]);router[_0xee2b('0x4')]('/queues',auth[_0xee2b('0x6')](),controller[_0xee2b('0x8')]);module[_0xee2b('0x9')]=router; \ No newline at end of file +var _0x184c=['get','isAuthenticated','getAgents','getQueues','exports','express','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x184c,0x140));var _0xc184=function(_0x4a5abe,_0x5b1426){_0x4a5abe=_0x4a5abe-0x0;var _0x4169f0=_0x184c[_0x4a5abe];return _0x4169f0;};'use strict';var express=require(_0xc184('0x0'));var router=express[_0xc184('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0xc184('0x2')]('/agents',auth[_0xc184('0x3')](),controller[_0xc184('0x4')]);router[_0xc184('0x2')]('/queues',auth[_0xc184('0x3')](),controller[_0xc184('0x5')]);module[_0xc184('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index a5651d0..8a095c1 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 _0x6d25=['pick','getQueues','format','startCase','Queue','name','voice','outbound','dialActive','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','catch','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','getAgents','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','join','order','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','online','getOptions','raw','forEach','push','Pause','where','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','rows','filterAgentAttributes','merge','Status','sortAgentsByStatus','fields'];(function(_0x52e8d8,_0x130183){var _0x37f544=function(_0x54349a){while(--_0x54349a){_0x52e8d8['push'](_0x52e8d8['shift']());}};_0x37f544(++_0x130183);}(_0x6d25,0x153));var _0x56d2=function(_0x3d9010,_0x2d0e8a){_0x3d9010=_0x3d9010-0x0;var _0x33c7b0=_0x6d25[_0x3d9010];return _0x33c7b0;};'use strict';var _=require(_0x56d2('0x0'));var util=require(_0x56d2('0x1'));var rta=require(_0x56d2('0x2'));var rtq=require(_0x56d2('0x3'));var qs=require(_0x56d2('0x4'));var utils=require('../../config/utils');var db=require(_0x56d2('0x5'))['db'];var APIBadRequestError=require(_0x56d2('0x6'))[_0x56d2('0x7')];var APIHandleError=require(_0x56d2('0x6'))[_0x56d2('0x8')];function respondWithFilteredResult(_0x2c1441,_0x4c6a35){return function(_0xcae014){if(_0xcae014){var _0x44c2f2=typeof _0x4c6a35[_0x56d2('0x9')]===_0x56d2('0xa')&&typeof _0x4c6a35[_0x56d2('0xb')]===_0x56d2('0xa');var _0x3a9378=_0xcae014['count'];var _0x52ff6b=_0x44c2f2?0x0:_0x4c6a35['offset'];var _0x41db0f=_0x44c2f2?_0xcae014[_0x56d2('0xc')]:_0x4c6a35['offset']+_0x4c6a35['limit'];var _0x217d9d;if(_0x41db0f>=_0x3a9378){_0x41db0f=_0x3a9378;_0x217d9d=0xc8;}else{_0x217d9d=0xce;}_0x2c1441[_0x56d2('0xd')](_0x217d9d);return _0x2c1441[_0x56d2('0xe')]('Content-Range',_0x52ff6b+'-'+_0x41db0f+'/'+_0x3a9378)['json'](_0xcae014);}return null;};}exports[_0x56d2('0xf')]=function(_0x46c8ec,_0x22e6a5){var _0x549acc={'count':0x0,'rows':[]};var _0x477d24={};var _0x49e4b0;var _0x220573=utils['getChannels']();var _0x2844b6;var _0x5a5149;var _0x4d1c23=_0x46c8ec[_0x56d2('0x10')]['globalQueueFilter'];var _0x44b3c6=_0x46c8ec[_0x56d2('0x10')][_0x56d2('0x11')];var _0x4528ef=_0x46c8ec[_0x56d2('0x10')][_0x56d2('0x12')];var _0x2e96ab=_0x44b3c6===_0x56d2('0x13')||_0x44b3c6===_0x56d2('0x14')?!![]:![];var _0x23fdc1=[];var _0x1515a6;var _0x17e960;Promise[_0x56d2('0x15')]()[_0x56d2('0x16')](function(){if(_0x46c8ec[_0x56d2('0x10')]['channel']){if(!utils[_0x56d2('0x17')](_0x46c8ec[_0x56d2('0x10')][_0x56d2('0x18')])){throw new APIBadRequestError(util['format'](_0x56d2('0x19'),_0x46c8ec['query'][_0x56d2('0x18')]));}_0x49e4b0=_0x46c8ec['query'][_0x56d2('0x18')][_0x56d2('0x1a')]();}if(!_0x46c8ec['query']['sort']||!_0x46c8ec[_0x56d2('0x10')][_0x56d2('0x1b')][_0x56d2('0x1c')](_0x56d2('0x1d'))){_0x46c8ec[_0x56d2('0x10')][_0x56d2('0x1b')]=rta[_0x56d2('0x1e')](_0x46c8ec[_0x56d2('0x10')][_0x56d2('0x1b')]);return;}var _0x5d9fc4=rta[_0x56d2('0x1f')](_0x46c8ec['query'][_0x56d2('0x1b')]);_0x46c8ec[_0x56d2('0x10')][_0x56d2('0x1b')]=_0x5d9fc4['fields'][_0x56d2('0x20')](',');_0x1515a6=_0x5d9fc4[_0x56d2('0x21')];})[_0x56d2('0x16')](function(){if(!_0x4d1c23){return[];}return rta['getAgentIdsByQueues'](_0x4d1c23,_0x49e4b0);})[_0x56d2('0x16')](function(_0x55ba75){_0x23fdc1=_0x55ba75;return rta['getRealtimeAgents']();})[_0x56d2('0x16')](function(_0x3dd071){_0x5a5149=_0x3dd071['rows'];if((!_0x44b3c6||_0x2e96ab)&&!_0x1515a6){return _0x23fdc1;}if(_0x1515a6&&!_0x44b3c6){return rta[_0x56d2('0x22')](_0x5a5149,_0x23fdc1,_0x1515a6);}else{return rta[_0x56d2('0x23')](_0x5a5149,_0x23fdc1,_0x44b3c6);}})[_0x56d2('0x16')](function(_0x24d029){_0x23fdc1=_0x24d029;var _0x29a7d7=![];if(_0x23fdc1[_0x56d2('0x24')]===0x0){if(_0x4d1c23||_0x44b3c6){_0x29a7d7=!![];}if(_0x2e96ab){_0x29a7d7=![];}}if(_0x29a7d7){return _0x549acc;}var _0x47d432=_[_0x56d2('0x25')](db[_0x56d2('0x26')][_0x56d2('0x27')],function(_0x3b974d){return{'name':_0x3b974d[_0x56d2('0x28')],'type':_0x3b974d[_0x56d2('0x29')][_0x56d2('0x2a')]};});_0x46c8ec[_0x56d2('0x10')][_0x56d2('0x2b')]=_0x56d2('0x2c');_0x46c8ec['query'][_0x56d2('0x2d')]=!![];_0x477d24=qs[_0x56d2('0x2e')](_0x47d432,_0x46c8ec);_0x477d24[_0x56d2('0x2f')]=!![];var _0x5bdbd8=[];if(_0x23fdc1['length']>0x0){_0x5bdbd8['push']({'id':{'$in':_0x23fdc1}});if(_0x1515a6&&!_0x44b3c6){_0x17e960=[db['sequelize']['literal']('FIELD(id,'+_0x23fdc1+')')];_0x477d24[_0x56d2('0x21')]=_0x17e960;}}if(_0x2e96ab){_0x220573[_0x56d2('0x30')](function(_0x16ba0a){var _0x310c7d=!![];if(_0x44b3c6===_0x56d2('0x14')&&_0x49e4b0!==_0x16ba0a){_0x310c7d=![];}_0x5bdbd8[_0x56d2('0x31')]({[_0x16ba0a+_0x56d2('0x32')]:_0x310c7d});});if(_0x4528ef){_0x5bdbd8[_0x56d2('0x31')]({'pauseType':_0x4528ef});}}else if(_0x44b3c6){_0x220573[_0x56d2('0x30')](function(_0x1eaa90){_0x5bdbd8[_0x56d2('0x31')]({[_0x1eaa90+_0x56d2('0x32')]:![]});});}_0x477d24['where']=_['merge'](_0x477d24[_0x56d2('0x33')],{'$and':_0x5bdbd8});if(_0x46c8ec[_0x56d2('0x34')][_0x56d2('0x2b')]===_0x56d2('0x34')){var _0x56a2d7={'params':{'id':_0x46c8ec['user'][_0x56d2('0x35')]},'query':{'section':_0x56d2('0x36'),'role':_0x56d2('0x2c'),'online':!![],'raw':!![],'ids':_0x23fdc1,'customSorting':_0x17e960}};if(_0x2e96ab){_0x56a2d7[_0x56d2('0x10')][_0x56d2('0x37')]=_0x5bdbd8;}_0x56a2d7['query']=Object[_0x56d2('0x38')](_0x56a2d7['query'],_0x46c8ec[_0x56d2('0x10')]);delete _0x56a2d7[_0x56d2('0x10')]['id'];return db[_0x56d2('0x39')][_0x56d2('0x3a')](_0x56a2d7);}return db['User'][_0x56d2('0x3b')](_0x477d24);})[_0x56d2('0x16')](function(_0x5b2b1c){_0x549acc[_0x56d2('0xc')]=_0x5b2b1c[_0x56d2('0xc')];_0x2844b6=_0x5b2b1c[_0x56d2('0x3c')];return _0x2844b6[_0x56d2('0x25')](function(_0x1dd458){var _0x550a68=_['find'](_0x5a5149,['id',_0x1dd458['id']]);if(_0x550a68){var _0x196f48=rta[_0x56d2('0x3d')](_0x550a68);_[_0x56d2('0x3e')](_0x1dd458,_0x196f48);}_0x1dd458['globalStatus']=rta['getAgentStatus'](_0x1dd458);if(_0x1dd458[_0x56d2('0x1d')]['includes'](_0x56d2('0x13'))){_0x220573[_0x56d2('0x30')](function(_0x6e5729){if(_0x1dd458[_0x6e5729+_0x56d2('0x32')]){_0x1dd458[_0x6e5729+_0x56d2('0x3f')]='pause';}});}return _0x1dd458;});})[_0x56d2('0x16')](function(_0x44ceb1){if(!_0x1515a6||_0x17e960){return _0x44ceb1;}return rta[_0x56d2('0x40')](_0x44ceb1,_0x1515a6);})[_0x56d2('0x16')](function(_0x37060f){var _0x833c3c=null;if(_0x46c8ec[_0x56d2('0x10')][_0x56d2('0x41')]){var _0x51ae60=_0x46c8ec[_0x56d2('0x10')][_0x56d2('0x41')]['split'](',');_0x833c3c=_0x37060f[_0x56d2('0x25')](function(_0x2cd0cd){return _[_0x56d2('0x42')](_0x2cd0cd,_0x51ae60);});}_0x549acc[_0x56d2('0x3c')]=_0x833c3c||_0x37060f;return _0x549acc;})[_0x56d2('0x16')](respondWithFilteredResult(_0x22e6a5,_0x477d24))['catch'](APIHandleError(_0x22e6a5));};exports[_0x56d2('0x43')]=function(_0x39f97c,_0x5d5178){var _0x24e355={'count':0x0,'rows':[]};var _0x49953a={};var _0x467db2;var _0x177ae0;var _0x4f4ff7;Promise['resolve']()[_0x56d2('0x16')](function(){if(_0x39f97c[_0x56d2('0x10')]['channel']){if(!utils['isValidChannel'](_0x39f97c[_0x56d2('0x10')][_0x56d2('0x18')])){throw new APIBadRequestError(util[_0x56d2('0x44')](_0x56d2('0x19'),_0x39f97c[_0x56d2('0x10')][_0x56d2('0x18')]));}_0x467db2=_0x39f97c['query']['channel'][_0x56d2('0x1a')]();}var _0x10d7d6=_[_0x56d2('0x45')](_0x467db2)+_0x56d2('0x46');var _0x2ad93c=_[_0x56d2('0x25')](db[_0x10d7d6][_0x56d2('0x27')],function(_0x29ef72){return{'name':_0x29ef72[_0x56d2('0x28')],'type':_0x29ef72['type'][_0x56d2('0x2a')]};});if(!_0x39f97c[_0x56d2('0x10')][_0x56d2('0x41')]){var _0x1467ee=['id',_0x56d2('0x47')];if(_0x467db2===_0x56d2('0x48')){_0x1467ee[_0x56d2('0x31')]('type');if(_0x39f97c['query'][_0x56d2('0x29')]===_0x56d2('0x49')){_0x1467ee[_0x56d2('0x31')]([_0x56d2('0x4a'),'dialMethod']);}}_0x39f97c[_0x56d2('0x10')][_0x56d2('0x41')]=_0x1467ee[_0x56d2('0x20')](',');}_0x49953a=qs[_0x56d2('0x2e')](_0x2ad93c,_0x39f97c);if(_0x39f97c[_0x56d2('0x34')][_0x56d2('0x2b')]===_0x56d2('0x34')){var _0x11f371={'params':{'id':_0x39f97c['user'][_0x56d2('0x35')]},'query':{'section':_0x467db2==='voice'&&_0x39f97c[_0x56d2('0x10')][_0x56d2('0x29')]===_0x56d2('0x49')?_0x56d2('0x4b'):_[_0x56d2('0x45')](_0x467db2)+_0x56d2('0x4c'),'type':_0x39f97c[_0x56d2('0x10')]['type'],'nolimit':!![],'sort':_0x56d2('0x47'),'filter':_0x39f97c['query'][_0x56d2('0x4d')]}};return db[_0x56d2('0x39')][_0x56d2('0x3a')](_0x11f371);}return db[_0x10d7d6][_0x56d2('0x3b')](_0x49953a);})['then'](function(_0x5f3b92){_0x24e355[_0x56d2('0xc')]=_0x5f3b92[_0x56d2('0xc')];_0x177ae0=_0x5f3b92[_0x56d2('0x3c')];return rtq[_0x56d2('0x4e')](_0x39f97c,_0x467db2);})[_0x56d2('0x16')](function(_0x12f900){_0x4f4ff7=_0x12f900[_0x56d2('0x3c')];return rtq[_0x56d2('0x4f')](_0x177ae0,_0x4f4ff7,_0x467db2,_0x39f97c[_0x56d2('0x10')][_0x56d2('0x29')]);})['then'](function(_0x1f7b2f){_0x24e355[_0x56d2('0x3c')]=_0x1f7b2f;return _0x24e355;})[_0x56d2('0x16')](respondWithFilteredResult(_0x5d5178,_0x49953a))[_0x56d2('0x50')](APIHandleError(_0x5d5178));}; \ No newline at end of file +var _0x08d2=['../../errors/api','APIBadRequestError','offset','limit','undefined','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','online','sequelize','literal','FIELD(id,','forEach','push','Pause','where','user','userProfileId','Agents','extraQueryConditions','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','merge','getAgentStatus','includes','Status','sortAgentsByStatus','split','catch','getQueues','toLowerCase','startCase','Queue','name','voice','outbound','dialActive','getOptions','QueueCampaigns','filter','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../mysqldb'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x08d2,0x1a3));var _0x208d=function(_0x2d743e,_0x5ede99){_0x2d743e=_0x2d743e-0x0;var _0x5a42ac=_0x08d2[_0x2d743e];return _0x5a42ac;};'use strict';var _=require(_0x208d('0x0'));var util=require(_0x208d('0x1'));var rta=require(_0x208d('0x2'));var rtq=require(_0x208d('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0x208d('0x4'));var db=require(_0x208d('0x5'))['db'];var APIBadRequestError=require(_0x208d('0x6'))[_0x208d('0x7')];var APIHandleError=require(_0x208d('0x6'))['handleError'];function respondWithFilteredResult(_0x3fd875,_0x5356c3){return function(_0x2bbe10){if(_0x2bbe10){var _0x38ec7d=typeof _0x5356c3[_0x208d('0x8')]==='undefined'&&typeof _0x5356c3[_0x208d('0x9')]===_0x208d('0xa');var _0x44d638=_0x2bbe10[_0x208d('0xb')];var _0x4bfecc=_0x38ec7d?0x0:_0x5356c3['offset'];var _0x8205c4=_0x38ec7d?_0x2bbe10[_0x208d('0xb')]:_0x5356c3[_0x208d('0x8')]+_0x5356c3[_0x208d('0x9')];var _0x456ba9;if(_0x8205c4>=_0x44d638){_0x8205c4=_0x44d638;_0x456ba9=0xc8;}else{_0x456ba9=0xce;}_0x3fd875[_0x208d('0xc')](_0x456ba9);return _0x3fd875[_0x208d('0xd')](_0x208d('0xe'),_0x4bfecc+'-'+_0x8205c4+'/'+_0x44d638)[_0x208d('0xf')](_0x2bbe10);}return null;};}exports[_0x208d('0x10')]=function(_0x31e996,_0x5ba0db){var _0x35ad7a={'count':0x0,'rows':[]};var _0x2315ed={};var _0x579164;var _0x3889b0=utils[_0x208d('0x11')]();var _0x21e7a6;var _0x13bdfc;var _0xa81a17=_0x31e996[_0x208d('0x12')][_0x208d('0x13')];var _0x47dab3=_0x31e996['query'][_0x208d('0x14')];var _0x35c5d4=_0x31e996[_0x208d('0x12')][_0x208d('0x15')];var _0x4ddcd8=_0x47dab3===_0x208d('0x16')||_0x47dab3===_0x208d('0x17')?!![]:![];var _0x11fff4=[];var _0x47b5de;var _0x18495a;Promise[_0x208d('0x18')]()[_0x208d('0x19')](function(){if(_0x31e996[_0x208d('0x12')][_0x208d('0x1a')]){if(!utils[_0x208d('0x1b')](_0x31e996['query'][_0x208d('0x1a')])){throw new APIBadRequestError(util[_0x208d('0x1c')](_0x208d('0x1d'),_0x31e996['query']['channel']));}_0x579164=_0x31e996[_0x208d('0x12')][_0x208d('0x1a')]['toLowerCase']();}if(!_0x31e996['query']['sort']||!_0x31e996[_0x208d('0x12')][_0x208d('0x1e')]['includes'](_0x208d('0x1f'))){_0x31e996[_0x208d('0x12')]['sort']=rta[_0x208d('0x20')](_0x31e996['query']['sort']);return;}var _0xe2c8b9=rta[_0x208d('0x21')](_0x31e996['query'][_0x208d('0x1e')]);_0x31e996['query'][_0x208d('0x1e')]=_0xe2c8b9[_0x208d('0x22')][_0x208d('0x23')](',');_0x47b5de=_0xe2c8b9[_0x208d('0x24')];})['then'](function(){if(!_0xa81a17){return[];}return rta['getAgentIdsByQueues'](_0xa81a17,_0x579164);})[_0x208d('0x19')](function(_0x17ae55){_0x11fff4=_0x17ae55;return rta[_0x208d('0x25')]();})[_0x208d('0x19')](function(_0x5b452a){_0x13bdfc=_0x5b452a[_0x208d('0x26')];if((!_0x47dab3||_0x4ddcd8)&&!_0x47b5de){return _0x11fff4;}if(_0x47b5de&&!_0x47dab3){return rta[_0x208d('0x27')](_0x13bdfc,_0x11fff4,_0x47b5de);}else{return rta['getAgentIdsByStatus'](_0x13bdfc,_0x11fff4,_0x47dab3);}})[_0x208d('0x19')](function(_0x4f61d7){_0x11fff4=_0x4f61d7;var _0xb740c2=![];if(_0x11fff4[_0x208d('0x28')]===0x0){if(_0xa81a17||_0x47dab3){_0xb740c2=!![];}if(_0x4ddcd8){_0xb740c2=![];}}if(_0xb740c2){return _0x35ad7a;}var _0xf3474f=_[_0x208d('0x29')](db[_0x208d('0x2a')][_0x208d('0x2b')],function(_0x140e97){return{'name':_0x140e97[_0x208d('0x2c')],'type':_0x140e97[_0x208d('0x2d')][_0x208d('0x2e')]};});_0x31e996[_0x208d('0x12')][_0x208d('0x2f')]=_0x208d('0x30');_0x31e996['query'][_0x208d('0x31')]=!![];_0x2315ed=qs['getOptions'](_0xf3474f,_0x31e996);_0x2315ed['raw']=!![];var _0x43dd1c=[];if(_0x11fff4[_0x208d('0x28')]>0x0){_0x43dd1c['push']({'id':{'$in':_0x11fff4}});if(_0x47b5de&&!_0x47dab3){_0x18495a=[db[_0x208d('0x32')][_0x208d('0x33')](_0x208d('0x34')+_0x11fff4+')')];_0x2315ed[_0x208d('0x24')]=_0x18495a;}}if(_0x4ddcd8){_0x3889b0[_0x208d('0x35')](function(_0x2b6b30){var _0x129e2f=!![];if(_0x47dab3===_0x208d('0x17')&&_0x579164!==_0x2b6b30){_0x129e2f=![];}_0x43dd1c[_0x208d('0x36')]({[_0x2b6b30+_0x208d('0x37')]:_0x129e2f});});if(_0x35c5d4){_0x43dd1c['push']({'pauseType':_0x35c5d4});}}else if(_0x47dab3){_0x3889b0[_0x208d('0x35')](function(_0x17caf5){_0x43dd1c[_0x208d('0x36')]({[_0x17caf5+_0x208d('0x37')]:![]});});}_0x2315ed['where']=_['merge'](_0x2315ed[_0x208d('0x38')],{'$and':_0x43dd1c});if(_0x31e996[_0x208d('0x39')][_0x208d('0x2f')]==='user'){var _0x12f608={'params':{'id':_0x31e996[_0x208d('0x39')][_0x208d('0x3a')]},'query':{'section':_0x208d('0x3b'),'role':_0x208d('0x30'),'online':!![],'raw':!![],'ids':_0x11fff4,'customSorting':_0x18495a}};if(_0x4ddcd8){_0x12f608['query'][_0x208d('0x3c')]=_0x43dd1c;}_0x12f608[_0x208d('0x12')]=Object['assign'](_0x12f608[_0x208d('0x12')],_0x31e996[_0x208d('0x12')]);delete _0x12f608[_0x208d('0x12')]['id'];return db[_0x208d('0x3d')][_0x208d('0x3e')](_0x12f608);}return db[_0x208d('0x2a')][_0x208d('0x3f')](_0x2315ed);})['then'](function(_0x35bd03){_0x35ad7a['count']=_0x35bd03[_0x208d('0xb')];_0x21e7a6=_0x35bd03[_0x208d('0x26')];return _0x21e7a6[_0x208d('0x29')](function(_0x3afd30){var _0x2a8c3d=_[_0x208d('0x40')](_0x13bdfc,['id',_0x3afd30['id']]);if(_0x2a8c3d){var _0x111b70=rta[_0x208d('0x41')](_0x2a8c3d);_[_0x208d('0x42')](_0x3afd30,_0x111b70);}_0x3afd30['globalStatus']=rta[_0x208d('0x43')](_0x3afd30);if(_0x3afd30['globalStatus'][_0x208d('0x44')](_0x208d('0x16'))){_0x3889b0[_0x208d('0x35')](function(_0x533457){if(_0x3afd30[_0x533457+_0x208d('0x37')]){_0x3afd30[_0x533457+_0x208d('0x45')]=_0x208d('0x16');}});}return _0x3afd30;});})['then'](function(_0x4b36d8){if(!_0x47b5de||_0x18495a){return _0x4b36d8;}return rta[_0x208d('0x46')](_0x4b36d8,_0x47b5de);})[_0x208d('0x19')](function(_0x51e248){var _0x546f68=null;if(_0x31e996[_0x208d('0x12')]['fields']){var _0x2bda7c=_0x31e996[_0x208d('0x12')][_0x208d('0x22')][_0x208d('0x47')](',');_0x546f68=_0x51e248[_0x208d('0x29')](function(_0x21b964){return _['pick'](_0x21b964,_0x2bda7c);});}_0x35ad7a[_0x208d('0x26')]=_0x546f68||_0x51e248;return _0x35ad7a;})[_0x208d('0x19')](respondWithFilteredResult(_0x5ba0db,_0x2315ed))[_0x208d('0x48')](APIHandleError(_0x5ba0db));};exports[_0x208d('0x49')]=function(_0x15e84c,_0x4b9d2e){var _0x557cb0={'count':0x0,'rows':[]};var _0xb935b8={};var _0x5ce5c0;var _0x138567;var _0x4f5a57;Promise[_0x208d('0x18')]()[_0x208d('0x19')](function(){if(_0x15e84c[_0x208d('0x12')][_0x208d('0x1a')]){if(!utils[_0x208d('0x1b')](_0x15e84c[_0x208d('0x12')][_0x208d('0x1a')])){throw new APIBadRequestError(util[_0x208d('0x1c')](_0x208d('0x1d'),_0x15e84c['query'][_0x208d('0x1a')]));}_0x5ce5c0=_0x15e84c['query'][_0x208d('0x1a')][_0x208d('0x4a')]();}var _0x43c333=_[_0x208d('0x4b')](_0x5ce5c0)+_0x208d('0x4c');var _0x5a257e=_[_0x208d('0x29')](db[_0x43c333]['rawAttributes'],function(_0x302847){return{'name':_0x302847[_0x208d('0x2c')],'type':_0x302847[_0x208d('0x2d')]['key']};});if(!_0x15e84c['query'][_0x208d('0x22')]){var _0x1f5ebc=['id',_0x208d('0x4d')];if(_0x5ce5c0===_0x208d('0x4e')){_0x1f5ebc['push'](_0x208d('0x2d'));if(_0x15e84c[_0x208d('0x12')][_0x208d('0x2d')]===_0x208d('0x4f')){_0x1f5ebc[_0x208d('0x36')]([_0x208d('0x50'),'dialMethod']);}}_0x15e84c['query'][_0x208d('0x22')]=_0x1f5ebc[_0x208d('0x23')](',');}_0xb935b8=qs[_0x208d('0x51')](_0x5a257e,_0x15e84c);if(_0x15e84c['user'][_0x208d('0x2f')]===_0x208d('0x39')){var _0x1d7bba={'params':{'id':_0x15e84c[_0x208d('0x39')][_0x208d('0x3a')]},'query':{'section':_0x5ce5c0===_0x208d('0x4e')&&_0x15e84c[_0x208d('0x12')][_0x208d('0x2d')]==='outbound'?_0x208d('0x52'):_[_0x208d('0x4b')](_0x5ce5c0)+'Queues','type':_0x15e84c['query'][_0x208d('0x2d')],'nolimit':!![],'sort':_0x208d('0x4d'),'filter':_0x15e84c[_0x208d('0x12')][_0x208d('0x53')]}};return db[_0x208d('0x3d')][_0x208d('0x3e')](_0x1d7bba);}return db[_0x43c333]['findAndCountAll'](_0xb935b8);})['then'](function(_0x39c665){_0x557cb0[_0x208d('0xb')]=_0x39c665[_0x208d('0xb')];_0x138567=_0x39c665[_0x208d('0x26')];return rtq[_0x208d('0x54')](_0x15e84c,_0x5ce5c0);})['then'](function(_0x2490f0){_0x4f5a57=_0x2490f0['rows'];return rtq['initializeQueues'](_0x138567,_0x4f5a57,_0x5ce5c0,_0x15e84c[_0x208d('0x12')]['type']);})['then'](function(_0x152dd2){_0x557cb0[_0x208d('0x26')]=_0x152dd2;return _0x557cb0;})[_0x208d('0x19')](respondWithFilteredResult(_0x4b9d2e,_0xb935b8))['catch'](APIHandleError(_0x4b9d2e));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d6601c5..5c939e4 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x19ab51,_0x460a06){var _0x2ff363=function(_0x16129c){while(--_0x16129c){_0x19ab51['push'](_0x19ab51['shift']());}};_0x2ff363(++_0x460a06);}(_0x70e0,0x17b));var _0x070e=function(_0x2a4594,_0x67d7a6){_0x2a4594=_0x2a4594-0x0;var _0x250c22=_0x70e0[_0x2a4594];return _0x250c22;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x402a6e,_0x520396){var _0x3676de=function(_0x1b2a58){while(--_0x1b2a58){_0x402a6e['push'](_0x402a6e['shift']());}};_0x3676de(++_0x520396);}(_0xe706,0xa3));var _0x6e70=function(_0x912e23,_0x15f457){_0x912e23=_0x912e23-0x0;var _0x453f72=_0xe706[_0x912e23];return _0x453f72;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 65f885e..85a74fb 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 _0xe928=['sequelize','exports','INTEGER','DATE','STRING'];(function(_0x707bd,_0xa35918){var _0x454003=function(_0x28085a){while(--_0x28085a){_0x707bd['push'](_0x707bd['shift']());}};_0x454003(++_0xa35918);}(_0xe928,0x145));var _0x8e92=function(_0x4ca9f9,_0x45f31a){_0x4ca9f9=_0x4ca9f9-0x0;var _0x57e224=_0xe928[_0x4ca9f9];return _0x57e224;};'use strict';var Sequelize=require(_0x8e92('0x0'));module[_0x8e92('0x1')]={'state':{'type':Sequelize[_0x8e92('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8e92('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8e92('0x3')]},'responsetime':{'type':Sequelize[_0x8e92('0x3')]},'ringtime':{'type':Sequelize[_0x8e92('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8e92('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8e92('0x4')]}}; \ No newline at end of file +var _0x74af=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x1736c7,_0x44bd92){var _0x47934b=function(_0x7fa816){while(--_0x7fa816){_0x1736c7['push'](_0x1736c7['shift']());}};_0x47934b(++_0x44bd92);}(_0x74af,0x178));var _0xf74a=function(_0x447d07,_0x53cad3){_0x447d07=_0x447d07-0x0;var _0x5a1a07=_0x74af[_0x447d07];return _0x5a1a07;};'use strict';var Sequelize=require(_0xf74a('0x0'));module[_0xf74a('0x1')]={'state':{'type':Sequelize[_0xf74a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf74a('0x3')]},'scheduledat':{'type':Sequelize[_0xf74a('0x4')]},'uniqueid':{'type':Sequelize[_0xf74a('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf74a('0x4')]},'ringtime':{'type':Sequelize[_0xf74a('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf74a('0x3')]},'campaigntype':{'type':Sequelize[_0xf74a('0x3')]},'membername':{'type':Sequelize[_0xf74a('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 69766ca..4aa6701 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 _0x7536=['request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7536,0x11b));var _0x6753=function(_0x300e96,_0x329b01){_0x300e96=_0x300e96-0x0;var _0x3a4fe6=_0x7536[_0x300e96];return _0x3a4fe6;};'use strict';var _=require(_0x6753('0x0'));var util=require('util');var logger=require(_0x6753('0x1'))(_0x6753('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6753('0x3'));var fs=require('fs');var path=require(_0x6753('0x4'));var rimraf=require('rimraf');var config=require(_0x6753('0x5'));var attributes=require(_0x6753('0x6'));module[_0x6753('0x7')]=function(_0x3ff2b4,_0x54296a){return _0x3ff2b4[_0x6753('0x8')](_0x6753('0x9'),attributes,{'tableName':_0x6753('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d68=['path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x24106c,_0x367a6f){var _0xbaeb73=function(_0x483603){while(--_0x483603){_0x24106c['push'](_0x24106c['shift']());}};_0xbaeb73(++_0x367a6f);}(_0x7d68,0x6f));var _0x87d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x87d6('0x0'));var util=require(_0x87d6('0x1'));var logger=require(_0x87d6('0x2'))('api');var moment=require(_0x87d6('0x3'));var BPromise=require(_0x87d6('0x4'));var rp=require(_0x87d6('0x5'));var fs=require('fs');var path=require(_0x87d6('0x6'));var rimraf=require(_0x87d6('0x7'));var config=require('../../config/environment');var attributes=require(_0x87d6('0x8'));module[_0x87d6('0x9')]=function(_0x527db9,_0x204429){return _0x527db9[_0x87d6('0xa')](_0x87d6('0xb'),attributes,{'tableName':_0x87d6('0xc'),'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 1f429f4..3d681cc 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 _0xcf27=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xcf27,0x78));var _0x7cf2=function(_0x108d43,_0x59374a){_0x108d43=_0x108d43-0x0;var _0x490078=_0xcf27[_0x108d43];return _0x490078;};'use strict';var _=require(_0x7cf2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7cf2('0x1'));var rs=require(_0x7cf2('0x2'));var fs=require('fs');var Redis=require(_0x7cf2('0x3'));var db=require(_0x7cf2('0x4'))['db'];var utils=require(_0x7cf2('0x5'));var logger=require(_0x7cf2('0x6'))(_0x7cf2('0x7'));var config=require(_0x7cf2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7cf2('0x9')][_0x7cf2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ad8a5,_0x3dabcd,_0x231654){return new BPromise(function(_0x4c18e8,_0x237bd9){return client[_0x7cf2('0xb')](_0x1ad8a5,_0x231654)[_0x7cf2('0xc')](function(_0x144d1f){logger[_0x7cf2('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x3dabcd,_0x7cf2('0xe'));logger[_0x7cf2('0xf')](_0x7cf2('0x10'),_0x3dabcd,'request\x20sent',JSON[_0x7cf2('0x11')](_0x144d1f));if(_0x144d1f['error']){if(_0x144d1f[_0x7cf2('0x12')]['code']===0x1f4){logger['error'](_0x7cf2('0x13'),_0x3dabcd,_0x144d1f['error'][_0x7cf2('0x14')]);return _0x237bd9(_0x144d1f[_0x7cf2('0x12')][_0x7cf2('0x14')]);}logger[_0x7cf2('0x12')](_0x7cf2('0x13'),_0x3dabcd,_0x144d1f[_0x7cf2('0x12')][_0x7cf2('0x14')]);return _0x4c18e8(_0x144d1f['error'][_0x7cf2('0x14')]);}else{logger['info'](_0x7cf2('0x13'),_0x3dabcd,_0x7cf2('0xe'));_0x4c18e8(_0x144d1f['result']['message']);}})[_0x7cf2('0x15')](function(_0x52d704){logger['error'](_0x7cf2('0x13'),_0x3dabcd,_0x52d704);_0x237bd9(_0x52d704);});});}exports[_0x7cf2('0x16')]=function(_0xecc35c){var _0x58460a=this;return new Promise(function(_0x10ffc4,_0x14db48){return db[_0x7cf2('0x17')]['create'](_0xecc35c[_0x7cf2('0x18')],{'raw':_0xecc35c[_0x7cf2('0x19')]?_0xecc35c[_0x7cf2('0x19')][_0x7cf2('0x1a')]===undefined?!![]:![]:!![]})[_0x7cf2('0xc')](function(_0x513936){logger['info']('CreateReportAgentPreview',_0xecc35c);logger[_0x7cf2('0xf')](_0x7cf2('0x16'),_0xecc35c,JSON['stringify'](_0x513936));_0x10ffc4(_0x513936);})['catch'](function(_0x331bb5){logger[_0x7cf2('0x12')]('CreateReportAgentPreview',_0x331bb5[_0x7cf2('0x14')],_0xecc35c);_0x14db48(_0x58460a[_0x7cf2('0x12')](0x1f4,_0x331bb5[_0x7cf2('0x14')]));});});}; \ No newline at end of file +var _0x5f1e=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x46948a,_0x14de36){var _0x474c3d=function(_0x57785f){while(--_0x57785f){_0x46948a['push'](_0x46948a['shift']());}};_0x474c3d(++_0x14de36);}(_0x5f1e,0x1cf));var _0xe5f1=function(_0x19a678,_0x32ce30){_0x19a678=_0x19a678-0x0;var _0xde64df=_0x5f1e[_0x19a678];return _0xde64df;};'use strict';var _=require(_0xe5f1('0x0'));var util=require('util');var moment=require(_0xe5f1('0x1'));var BPromise=require(_0xe5f1('0x2'));var rs=require(_0xe5f1('0x3'));var fs=require('fs');var Redis=require(_0xe5f1('0x4'));var db=require(_0xe5f1('0x5'))['db'];var utils=require(_0xe5f1('0x6'));var logger=require('../../config/logger')(_0xe5f1('0x7'));var config=require(_0xe5f1('0x8'));var jayson=require(_0xe5f1('0x9'));var client=jayson[_0xe5f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34c583,_0x48719f,_0x228eb1){return new BPromise(function(_0x37a34e,_0x287d9f){return client[_0xe5f1('0xb')](_0x34c583,_0x228eb1)[_0xe5f1('0xc')](function(_0x432e9a){logger[_0xe5f1('0xd')](_0xe5f1('0xe'),_0x48719f,_0xe5f1('0xf'));logger[_0xe5f1('0x10')](_0xe5f1('0x11'),_0x48719f,_0xe5f1('0xf'),JSON[_0xe5f1('0x12')](_0x432e9a));if(_0x432e9a[_0xe5f1('0x13')]){if(_0x432e9a[_0xe5f1('0x13')][_0xe5f1('0x14')]===0x1f4){logger['error'](_0xe5f1('0xe'),_0x48719f,_0x432e9a[_0xe5f1('0x13')]['message']);return _0x287d9f(_0x432e9a[_0xe5f1('0x13')][_0xe5f1('0x15')]);}logger[_0xe5f1('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x48719f,_0x432e9a[_0xe5f1('0x13')][_0xe5f1('0x15')]);return _0x37a34e(_0x432e9a[_0xe5f1('0x13')][_0xe5f1('0x15')]);}else{logger[_0xe5f1('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x48719f,'request\x20sent');_0x37a34e(_0x432e9a[_0xe5f1('0x16')][_0xe5f1('0x15')]);}})[_0xe5f1('0x17')](function(_0x401a44){logger[_0xe5f1('0x13')](_0xe5f1('0xe'),_0x48719f,_0x401a44);_0x287d9f(_0x401a44);});});}exports[_0xe5f1('0x18')]=function(_0x4ee111){var _0x2063e6=this;return new Promise(function(_0x4be461,_0x438952){return db[_0xe5f1('0x19')][_0xe5f1('0x1a')](_0x4ee111[_0xe5f1('0x1b')],{'raw':_0x4ee111['options']?_0x4ee111[_0xe5f1('0x1c')][_0xe5f1('0x1d')]===undefined?!![]:![]:!![]})[_0xe5f1('0xc')](function(_0x2cca45){logger['info'](_0xe5f1('0x18'),_0x4ee111);logger[_0xe5f1('0x10')](_0xe5f1('0x18'),_0x4ee111,JSON[_0xe5f1('0x12')](_0x2cca45));_0x4be461(_0x2cca45);})['catch'](function(_0x39bd51){logger['error'](_0xe5f1('0x18'),_0x39bd51[_0xe5f1('0x15')],_0x4ee111);_0x438952(_0x2063e6[_0xe5f1('0x13')](0x1f4,_0x39bd51[_0xe5f1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 4d79437..ca1f893 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 _0x8dd6=['/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound'];(function(_0x31ca69,_0x5d3033){var _0x2c104e=function(_0x58273e){while(--_0x58273e){_0x31ca69['push'](_0x31ca69['shift']());}};_0x2c104e(++_0x5d3033);}(_0x8dd6,0xcd));var _0x68dd=function(_0x10e9b1,_0x40bf94){_0x10e9b1=_0x10e9b1-0x0;var _0xa8058b=_0x8dd6[_0x10e9b1];return _0xa8058b;};'use strict';var multer=require(_0x68dd('0x0'));var util=require('util');var path=require(_0x68dd('0x1'));var express=require(_0x68dd('0x2'));var router=express[_0x68dd('0x3')]();var auth=require(_0x68dd('0x4'));var controller=require(_0x68dd('0x5'));router[_0x68dd('0x6')](_0x68dd('0x7'),auth[_0x68dd('0x8')](),controller['voiceChannels']);router[_0x68dd('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x68dd('0x9')]);router[_0x68dd('0x6')](_0x68dd('0xa'),auth[_0x68dd('0x8')](),controller[_0x68dd('0xb')]);router[_0x68dd('0x6')](_0x68dd('0xc'),auth[_0x68dd('0x8')](),controller[_0x68dd('0xd')]);router[_0x68dd('0x6')]('/chat/queues',auth[_0x68dd('0x8')](),controller[_0x68dd('0xe')]);router[_0x68dd('0x6')]('/mail/queues',auth[_0x68dd('0x8')](),controller['mailQueues']);router['get']('/mail/accounts',auth[_0x68dd('0x8')](),controller[_0x68dd('0xf')]);router[_0x68dd('0x6')](_0x68dd('0x10'),auth[_0x68dd('0x8')](),controller['openchannelQueues']);router[_0x68dd('0x6')](_0x68dd('0x11'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x12')]);router[_0x68dd('0x6')](_0x68dd('0x13'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x14')]);router['get']('/fax/queues',auth[_0x68dd('0x8')](),controller[_0x68dd('0x15')]);router['get'](_0x68dd('0x16'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x17')]);router[_0x68dd('0x6')](_0x68dd('0x18'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x19')]);router[_0x68dd('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x68dd('0x8')](),controller[_0x68dd('0x1a')]);router[_0x68dd('0x6')](_0x68dd('0x1b'),auth[_0x68dd('0x8')](),controller['voiceQueuesChannelHangup']);router[_0x68dd('0x6')](_0x68dd('0x1c'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x1d')]);router[_0x68dd('0x6')](_0x68dd('0x1e'),auth['isAuthenticated'](),controller[_0x68dd('0x1f')]);router['put']('/voice/queues/:id',auth[_0x68dd('0x8')](),controller[_0x68dd('0x20')]);router[_0x68dd('0x6')](_0x68dd('0x21'),auth['isAuthenticated'](),controller[_0x68dd('0x22')]);router[_0x68dd('0x6')](_0x68dd('0x23'),auth['isAuthenticated'](),controller[_0x68dd('0x24')]);router['get'](_0x68dd('0x25'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x26')]);router[_0x68dd('0x27')](_0x68dd('0x28'),auth['isAuthenticated'](),controller[_0x68dd('0x29')]);router['get']('/telephones',auth['isAuthenticated'](),controller[_0x68dd('0x2a')]);router[_0x68dd('0x6')](_0x68dd('0x2b'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x2c')]);router['get'](_0x68dd('0x2d'),auth[_0x68dd('0x8')](),controller['campaigns']);router[_0x68dd('0x6')](_0x68dd('0x2e'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x2f')]);router[_0x68dd('0x6')](_0x68dd('0x30'),auth['isAuthenticated'](),controller[_0x68dd('0x31')]);router[_0x68dd('0x6')](_0x68dd('0x32'),auth[_0x68dd('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x68dd('0x6')](_0x68dd('0x33'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x34')]);router[_0x68dd('0x6')](_0x68dd('0x35'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x68dd('0x6')]('/sms/queues/waitinginteractions',auth[_0x68dd('0x8')](),controller[_0x68dd('0x36')]);router[_0x68dd('0x6')](_0x68dd('0x37'),auth[_0x68dd('0x8')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x68dd('0x38'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x39')]);router['post']('/mail/queues/:id/notify',auth[_0x68dd('0x8')](),controller[_0x68dd('0x3a')](_0x68dd('0x3b')));router[_0x68dd('0x6')](_0x68dd('0x3c'),auth[_0x68dd('0x8')](),controller['showMailQueues']);router[_0x68dd('0x3d')](_0x68dd('0x3e'),auth['isAuthenticated'](),controller[_0x68dd('0x3a')](_0x68dd('0x3f')));router[_0x68dd('0x6')](_0x68dd('0x40'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x41')]);router[_0x68dd('0x3d')](_0x68dd('0x42'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x3a')](_0x68dd('0x43')));router[_0x68dd('0x6')]('/fax/queues/:id',auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x68dd('0x3d')]('/openchannel/queues/:id/notify',auth[_0x68dd('0x8')](),controller[_0x68dd('0x3a')]('openchannel'));router[_0x68dd('0x6')](_0x68dd('0x44'),auth['isAuthenticated'](),controller[_0x68dd('0x45')]);router[_0x68dd('0x3d')](_0x68dd('0x46'),auth['isAuthenticated'](),controller[_0x68dd('0x3a')](_0x68dd('0x47')));router['post'](_0x68dd('0x48'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x3a')](_0x68dd('0x49')));router[_0x68dd('0x6')](_0x68dd('0x4a'),auth['isAuthenticated'](),controller[_0x68dd('0x4b')]);router[_0x68dd('0x6')](_0x68dd('0x4c'),auth[_0x68dd('0x8')](),controller['showWhatsappQueues']);router[_0x68dd('0x3d')](_0x68dd('0x4d'),auth[_0x68dd('0x8')](),controller[_0x68dd('0x4e')]);module[_0x68dd('0x4f')]=router; \ No newline at end of file +var _0xda8e=['path','express','Router','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports'];(function(_0x3b6825,_0xd49210){var _0x25421a=function(_0x40589f){while(--_0x40589f){_0x3b6825['push'](_0x3b6825['shift']());}};_0x25421a(++_0xd49210);}(_0xda8e,0xa8));var _0xeda8=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0xda8e[_0x541ea6];return _0x3c3e84;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeda8('0x0'));var express=require(_0xeda8('0x1'));var router=express[_0xeda8('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0xeda8('0x3'));router[_0xeda8('0x4')]('/voice/channels',auth[_0xeda8('0x5')](),controller[_0xeda8('0x6')]);router['get'](_0xeda8('0x7'),auth['isAuthenticated'](),controller[_0xeda8('0x8')]);router[_0xeda8('0x4')](_0xeda8('0x9'),auth['isAuthenticated'](),controller[_0xeda8('0xa')]);router[_0xeda8('0x4')]('/voice/queues',auth[_0xeda8('0x5')](),controller[_0xeda8('0xb')]);router[_0xeda8('0x4')](_0xeda8('0xc'),auth[_0xeda8('0x5')](),controller[_0xeda8('0xd')]);router[_0xeda8('0x4')](_0xeda8('0xe'),auth[_0xeda8('0x5')](),controller[_0xeda8('0xf')]);router[_0xeda8('0x4')](_0xeda8('0x10'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x11')]);router['get'](_0xeda8('0x12'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x13')]);router[_0xeda8('0x4')](_0xeda8('0x14'),auth['isAuthenticated'](),controller[_0xeda8('0x15')]);router['get'](_0xeda8('0x16'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x17')]);router[_0xeda8('0x4')](_0xeda8('0x18'),auth[_0xeda8('0x5')](),controller['faxQueues']);router[_0xeda8('0x4')](_0xeda8('0x19'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x1a')]);router[_0xeda8('0x4')](_0xeda8('0x1b'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x1c')]);router['get'](_0xeda8('0x1d'),auth['isAuthenticated'](),controller[_0xeda8('0x1e')]);router[_0xeda8('0x4')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xeda8('0x5')](),controller[_0xeda8('0x1f')]);router[_0xeda8('0x4')](_0xeda8('0x20'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x21')]);router['get']('/voice/queues/:id',auth[_0xeda8('0x5')](),controller[_0xeda8('0x22')]);router[_0xeda8('0x23')](_0xeda8('0x24'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x25')]);router[_0xeda8('0x4')](_0xeda8('0x26'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x27')]);router[_0xeda8('0x4')](_0xeda8('0x28'),auth[_0xeda8('0x5')](),controller['outboundChannels']);router[_0xeda8('0x4')](_0xeda8('0x29'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x2a')]);router['put'](_0xeda8('0x2b'),auth['isAuthenticated'](),controller[_0xeda8('0x2c')]);router[_0xeda8('0x4')](_0xeda8('0x2d'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x2e')]);router[_0xeda8('0x4')](_0xeda8('0x2f'),auth['isAuthenticated'](),controller[_0xeda8('0x30')]);router[_0xeda8('0x4')](_0xeda8('0x31'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x32')]);router[_0xeda8('0x4')]('/fax/accounts',auth[_0xeda8('0x5')](),controller[_0xeda8('0x33')]);router[_0xeda8('0x4')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xeda8('0x4')](_0xeda8('0x34'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x35')]);router[_0xeda8('0x4')](_0xeda8('0x36'),auth['isAuthenticated'](),controller[_0xeda8('0x37')]);router['get'](_0xeda8('0x38'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x39')]);router[_0xeda8('0x4')]('/sms/queues/waitinginteractions',auth[_0xeda8('0x5')](),controller['smsQueuesWaitingInteractions']);router[_0xeda8('0x4')](_0xeda8('0x3a'),auth[_0xeda8('0x5')](),controller['whatsappQueuesWaitingInteractions']);router[_0xeda8('0x4')](_0xeda8('0x3b'),auth['isAuthenticated'](),controller[_0xeda8('0x3c')]);router[_0xeda8('0x3d')](_0xeda8('0x3e'),auth['isAuthenticated'](),controller[_0xeda8('0x3f')](_0xeda8('0x40')));router[_0xeda8('0x4')](_0xeda8('0x41'),auth['isAuthenticated'](),controller[_0xeda8('0x42')]);router[_0xeda8('0x3d')](_0xeda8('0x43'),auth['isAuthenticated'](),controller[_0xeda8('0x3f')](_0xeda8('0x44')));router['get']('/chat/queues/:id',auth[_0xeda8('0x5')](),controller[_0xeda8('0x45')]);router[_0xeda8('0x3d')](_0xeda8('0x46'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x3f')]('fax'));router[_0xeda8('0x4')](_0xeda8('0x47'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x48')]);router[_0xeda8('0x3d')](_0xeda8('0x49'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x3f')]('openchannel'));router[_0xeda8('0x4')]('/openchannel/queues/:id',auth[_0xeda8('0x5')](),controller[_0xeda8('0x4a')]);router[_0xeda8('0x3d')](_0xeda8('0x4b'),auth[_0xeda8('0x5')](),controller[_0xeda8('0x3f')]('sms'));router[_0xeda8('0x3d')](_0xeda8('0x4c'),auth['isAuthenticated'](),controller['queueNotify'](_0xeda8('0x4d')));router[_0xeda8('0x4')](_0xeda8('0x4e'),auth['isAuthenticated'](),controller[_0xeda8('0x4f')]);router[_0xeda8('0x4')](_0xeda8('0x50'),auth[_0xeda8('0x5')](),controller['showWhatsappQueues']);router['post'](_0xeda8('0x51'),auth['isAuthenticated'](),controller[_0xeda8('0x52')]);module[_0xeda8('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 6e1c747..974996a 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 _0x31f0=['YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','interface','SIP/%s','capacity','telephones','Telephones','trunks','Trunks','chatQueues','ChatQueues','MailQueues','showMailQueues','MailAccounts','OpenchannelQueues','smsQueues','SmsQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','uniq','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','InteractionId','From','create','Start','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','chat','agent','Agent\x20not\x20found','MessageId','TransferReport','agentTransferTimeout','bluebird','lodash','../../mysqldb','../../config/logger','api','jayson/promise','http','client','then','error','code','message','result','catch','status','sendStatus','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format'];(function(_0x542d80,_0x150561){var _0x1f4492=function(_0x542215){while(--_0x542215){_0x542d80['push'](_0x542d80['shift']());}};_0x1f4492(++_0x150561);}(_0x31f0,0xb7));var _0x031f=function(_0x216c6f,_0x5d16d7){_0x216c6f=_0x216c6f-0x0;var _0x3366af=_0x31f0[_0x216c6f];return _0x3366af;};'use strict';var BPromise=require(_0x031f('0x0'));var moment=require('moment');var _=require(_0x031f('0x1'));var util=require('util');var db=require(_0x031f('0x2'))['db'];var logger=require(_0x031f('0x3'))(_0x031f('0x4'));var jayson=require(_0x031f('0x5'));var amiClient=jayson['client'][_0x031f('0x6')]({'port':0x232a});var mailClient=jayson[_0x031f('0x7')]['http']({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){var _0x3e41ed=_0x365f59?_0x365f59:amiClient;return _0x3e41ed['request'](_0x3dc98e,_0x487e65)[_0x031f('0x8')](function(_0x24145f){if(_0x24145f[_0x031f('0x9')]){if(_0x24145f[_0x031f('0x9')][_0x031f('0xa')]===0x1f4){return _0x2569b6(_0x24145f[_0x031f('0x9')][_0x031f('0xb')]);}return _0x4300b4(_0x24145f[_0x031f('0x9')]['message']);}else{_0x4300b4(_0x24145f[_0x031f('0xc')]);}})[_0x031f('0xd')](function(_0x28da6e){_0x2569b6(_0x28da6e);});});}function respondWithResult(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xc8;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0xe')](_0x3819bb)['json'](_0x405896);}return _0x351052[_0x031f('0xf')](0x194);};}function handleError(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0x1f4;return function(_0x2e3dfe){logger[_0x031f('0x9')](_0x2e3dfe['stack']);if(_0x2e3dfe['name']){delete _0x2e3dfe[_0x031f('0x10')];}_0x23b40c[_0x031f('0xe')](_0x17a699)[_0x031f('0x11')](_0x2e3dfe);};}function findById(_0x286177){return function(_0x5196b1){if(!_[_0x031f('0x12')](_0x286177)&&!_[_0x031f('0x12')](_0x5196b1)&&!_['isNil'](_0x5196b1[_0x031f('0x13')])){return _['find'](_0x5196b1[_0x031f('0x13')],function(_0x5f2199){return _0x5f2199['id']==_0x286177;});}return null;};}exports[_0x031f('0x14')]=function(_0xaa155,_0x1ceddc){return respondWithRpcPromise(_0x031f('0x15'),_0xaa155[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x1ceddc,null))[_0x031f('0xd')](handleError(_0x1ceddc,null));};exports[_0x031f('0x17')]=function(_0x29dd6e,_0x48a76e){return respondWithRpcPromise(_0x031f('0x18'),_[_0x031f('0x19')](_0x29dd6e[_0x031f('0x16')],_0x29dd6e['params']))['then'](respondWithResult(_0x48a76e,null))[_0x031f('0xd')](handleError(_0x48a76e,null));};exports['voiceChannelStopMixMonitor']=function(_0x3472a2,_0x57f6c4){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x3472a2[_0x031f('0x16')],_0x3472a2[_0x031f('0x1a')]))[_0x031f('0x8')](respondWithResult(_0x57f6c4,null))[_0x031f('0xd')](handleError(_0x57f6c4,null));};exports['voiceQueues']=function(_0x374b65,_0x5a64c0){return respondWithRpcPromise(_0x031f('0x1b'),_0x374b65[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x5a64c0,null))['catch'](handleError(_0x5a64c0,null));};exports[_0x031f('0x1c')]=function(_0x3b2a51,_0x54b44e){return respondWithRpcPromise(_0x031f('0x1b'),_0x3b2a51[_0x031f('0x16')])[_0x031f('0x8')](findById(_0x3b2a51['params']['id']))[_0x031f('0x8')](respondWithResult(_0x54b44e,null))[_0x031f('0xd')](handleError(_0x54b44e,null));};exports[_0x031f('0x1d')]=function(_0xaf5bea,_0xfaa36){return respondWithRpcPromise(_0x031f('0x1e'),_['merge'](_0xaf5bea[_0x031f('0x1f')],_0xaf5bea[_0x031f('0x1a')]))[_0x031f('0x8')](respondWithResult(_0xfaa36,null))[_0x031f('0xd')](handleError(_0xfaa36,null));};exports[_0x031f('0x20')]=function(_0x2d24f0,_0x378692){return respondWithRpcPromise(_0x031f('0x21'),_[_0x031f('0x19')](_0x2d24f0[_0x031f('0x16')],_0x2d24f0[_0x031f('0x1a')]))['then'](respondWithResult(_0x378692,null))[_0x031f('0xd')](handleError(_0x378692,null));};exports[_0x031f('0x22')]=function(_0xb3a6bd,_0x2f2616){return respondWithRpcPromise(_0x031f('0x23'),_0xb3a6bd[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x2f2616,null))[_0x031f('0xd')](handleError(_0x2f2616,null));};exports[_0x031f('0x24')]=function(_0xb7284d,_0x12bd77){return respondWithRpcPromise(_0x031f('0x25'),_[_0x031f('0x19')](_0xb7284d['query'],_0xb7284d[_0x031f('0x1a')]))[_0x031f('0x8')](respondWithResult(_0x12bd77,null))['catch'](handleError(_0x12bd77,null));};exports[_0x031f('0x26')]=function(_0x1fde6b,_0x4ec696){return respondWithRpcPromise(_0x031f('0x27'),_[_0x031f('0x19')](_0x1fde6b[_0x031f('0x16')],_0x1fde6b[_0x031f('0x1a')]))['then'](respondWithResult(_0x4ec696,null))['catch'](handleError(_0x4ec696,null));};exports[_0x031f('0x28')]=function(_0x555b89,_0x43ab76){return respondWithRpcPromise(_0x031f('0x29'),_[_0x031f('0x19')](_0x555b89['query'],_0x555b89['params']))[_0x031f('0x8')](respondWithResult(_0x43ab76,null))['catch'](handleError(_0x43ab76,null));};exports['outbound']=function(_0x2d489a,_0x45e3a4){return respondWithRpcPromise(_0x031f('0x2a'),_0x2d489a[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x45e3a4,null))[_0x031f('0xd')](handleError(_0x45e3a4,null));};exports[_0x031f('0x2b')]=function(_0x55c85f,_0x17a970){return respondWithRpcPromise(_0x031f('0x2c'),_0x55c85f[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x17a970,null))['catch'](handleError(_0x17a970,null));};exports[_0x031f('0x2d')]=function(_0x10f590,_0x2dba8b){var _0x5895f6;return respondWithRpcPromise(_0x031f('0x2e'),_0x10f590[_0x031f('0x16')])['then'](function(_0x36bafa){_0x5895f6=_0x36bafa;return respondWithRpcPromise(_0x031f('0x2e'),_0x10f590['query'],routingClient);})['then'](function(_0x178135){return _[_0x031f('0x19')]({},_0x178135,_0x5895f6);})[_0x031f('0x8')](respondWithResult(_0x2dba8b,null))[_0x031f('0xd')](handleError(_0x2dba8b,null));};exports[_0x031f('0x2f')]=function(_0xf0fb95,_0xe07087){if(_0xf0fb95['body']&&_0xf0fb95[_0x031f('0x1f')][_0x031f('0x30')]&&_0xf0fb95['user']&&_0xf0fb95[_0x031f('0x31')]['name']){for(var _0x456a98 in _0xf0fb95[_0x031f('0x1f')]['interaction']){if(_0xf0fb95[_0x031f('0x1f')][_0x031f('0x30')][_0x031f('0x32')](_0x456a98)){db['MemberReport'][_0x031f('0x33')]({'where':{'channel':_0x456a98,'membername':_0xf0fb95[_0x031f('0x31')][_0x031f('0x10')],'type':_0x031f('0x34'),'exitAt':null,'uniqueid':_0xf0fb95[_0x031f('0x1f')][_0x031f('0x30')][_0x456a98]&&_0xf0fb95[_0x031f('0x1f')][_0x031f('0x30')][_0x456a98][_0x031f('0x35')]?{'$notIn':_0xf0fb95['body'][_0x031f('0x30')][_0x456a98]}:{'$ne':null}}})[_0x031f('0x8')](function(_0x28f2b3){var _0x3205ce=moment()[_0x031f('0x36')](_0x031f('0x37'));for(var _0x2111c5=0x0,_0x33d24b=_0x28f2b3[_0x031f('0x35')];_0x2111c5<_0x33d24b;_0x2111c5+=0x1){_0x28f2b3[_0x2111c5]['updateAttributes']({'exitAt':_0x3205ce});}});for(var _0x38539a=0x0;_0x38539a<_0xf0fb95['body']['interaction'][_0x456a98][_0x031f('0x35')];_0x38539a+=0x1){db[_0x031f('0x38')][_0x031f('0x39')]({'where':{'channel':_0x456a98,'membername':_0xf0fb95[_0x031f('0x31')][_0x031f('0x10')],'type':'INTERACTION','uniqueid':_0xf0fb95[_0x031f('0x1f')][_0x031f('0x30')][_0x456a98][_0x38539a],'exitAt':null},'defaults':{'channel':_0x456a98,'membername':_0xf0fb95[_0x031f('0x31')]['name'],'interface':_[_0x031f('0x12')](_0xf0fb95[_0x031f('0x31')][_0x031f('0x3a')])?util[_0x031f('0x36')](_0x031f('0x3b'),_0xf0fb95[_0x031f('0x31')]['name']):_0xf0fb95['user'][_0x031f('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x031f('0x36')](_0x031f('0x37')),'role':'agent','internal':_0xf0fb95[_0x031f('0x31')]['internal'],'uniqueid':_0xf0fb95['body'][_0x031f('0x30')][_0x456a98][_0x38539a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xf0fb95[_0x031f('0x1a')]['id'],'capacity':_0xf0fb95['body'][_0x031f('0x3c')]},routingClient)[_0x031f('0x8')](respondWithResult(_0xe07087,null))['catch'](handleError(_0xe07087,null));};exports[_0x031f('0x3d')]=function(_0x2e7abe,_0x57e32d){return respondWithRpcPromise(_0x031f('0x3e'),_0x2e7abe['query'])[_0x031f('0x8')](respondWithResult(_0x57e32d,null))['catch'](handleError(_0x57e32d,null));};exports[_0x031f('0x3f')]=function(_0x24848b,_0x393807){return respondWithRpcPromise(_0x031f('0x40'),_0x24848b[_0x031f('0x16')])['then'](respondWithResult(_0x393807,null))[_0x031f('0xd')](handleError(_0x393807,null));};exports['campaigns']=function(_0x186957,_0x414350){return respondWithRpcPromise('Campaigns',_0x186957[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x414350,null))['catch'](handleError(_0x414350,null));};exports[_0x031f('0x41')]=function(_0x154ad2,_0x22a547){return respondWithRpcPromise('ChatQueues',_0x154ad2[_0x031f('0x16')],routingClient)['then'](respondWithResult(_0x22a547,null))[_0x031f('0xd')](handleError(_0x22a547,null));};exports['showChatQueues']=function(_0x3bd6f4,_0x561a2b){return respondWithRpcPromise(_0x031f('0x42'),_0x3bd6f4[_0x031f('0x16')],routingClient)['then'](findById(_0x3bd6f4['params']['id']))[_0x031f('0x8')](respondWithResult(_0x561a2b,null))[_0x031f('0xd')](handleError(_0x561a2b,null));};exports['mailQueues']=function(_0x434c0f,_0xb44c73){return respondWithRpcPromise(_0x031f('0x43'),_0x434c0f[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0xb44c73,null))[_0x031f('0xd')](handleError(_0xb44c73,null));};exports[_0x031f('0x44')]=function(_0x405398,_0x4b25e5){return respondWithRpcPromise(_0x031f('0x43'),_0x405398[_0x031f('0x16')],routingClient)[_0x031f('0x8')](findById(_0x405398['params']['id']))[_0x031f('0x8')](respondWithResult(_0x4b25e5,null))[_0x031f('0xd')](handleError(_0x4b25e5,null));};exports['mailAccounts']=function(_0xb86dcd,_0x14506b){return respondWithRpcPromise(_0x031f('0x45'),_0xb86dcd[_0x031f('0x16')],mailClient)['then'](respondWithResult(_0x14506b,null))['catch'](handleError(_0x14506b,null));};exports['openchannelQueues']=function(_0x4e2d0d,_0x9f76f3){return respondWithRpcPromise(_0x031f('0x46'),_0x4e2d0d['query'],routingClient)[_0x031f('0x8')](respondWithResult(_0x9f76f3,null))[_0x031f('0xd')](handleError(_0x9f76f3,null));};exports['showOpenchannelQueues']=function(_0x110495,_0x26ecb0){return respondWithRpcPromise(_0x031f('0x46'),_0x110495[_0x031f('0x16')],routingClient)[_0x031f('0x8')](findById(_0x110495[_0x031f('0x1a')]['id']))[_0x031f('0x8')](respondWithResult(_0x26ecb0,null))[_0x031f('0xd')](handleError(_0x26ecb0,null));};exports[_0x031f('0x47')]=function(_0x557a32,_0x138e0d){return respondWithRpcPromise('SmsQueues',_0x557a32[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0x138e0d,null))[_0x031f('0xd')](handleError(_0x138e0d,null));};exports['showSmsQueues']=function(_0x4c1b74,_0xdb3d45){return respondWithRpcPromise(_0x031f('0x48'),_0x4c1b74[_0x031f('0x16')],routingClient)[_0x031f('0x8')](findById(_0x4c1b74['params']['id']))[_0x031f('0x8')](respondWithResult(_0xdb3d45,null))['catch'](handleError(_0xdb3d45,null));};exports['whatsappQueues']=function(_0x2179ee,_0x534bae){return respondWithRpcPromise('WhatsappQueues',_0x2179ee[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0x534bae,null))[_0x031f('0xd')](handleError(_0x534bae,null));};exports[_0x031f('0x49')]=function(_0xe125d9,_0x584899){return respondWithRpcPromise('WhatsappQueues',_0xe125d9[_0x031f('0x16')],routingClient)['then'](findById(_0xe125d9[_0x031f('0x1a')]['id']))[_0x031f('0x8')](respondWithResult(_0x584899,null))['catch'](handleError(_0x584899,null));};exports[_0x031f('0x4a')]=function(_0xee136c,_0x439095){return respondWithRpcPromise(_0x031f('0x4b'),_0xee136c[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0x439095,null))['catch'](handleError(_0x439095,null));};exports['showFaxQueues']=function(_0x3bcc7e,_0x232b62){return respondWithRpcPromise(_0x031f('0x4b'),_0x3bcc7e[_0x031f('0x16')],routingClient)[_0x031f('0x8')](findById(_0x3bcc7e[_0x031f('0x1a')]['id']))[_0x031f('0x8')](respondWithResult(_0x232b62,null))['catch'](handleError(_0x232b62,null));};exports['faxAccounts']=function(_0x4bd283,_0x5ddf46){return respondWithRpcPromise(_0x031f('0x4c'),_0x4bd283[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x5ddf46,null))['catch'](handleError(_0x5ddf46,null));};exports[_0x031f('0x4d')]=function(_0x2e56e3,_0x5133a6){return respondWithRpcPromise(_0x031f('0x4e'),_0x2e56e3[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0x5133a6,null))[_0x031f('0xd')](handleError(_0x5133a6,null));};exports[_0x031f('0x4f')]=function(_0x1e10f6,_0x982c1b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x1e10f6['query'],routingClient)[_0x031f('0x8')](respondWithResult(_0x982c1b,null))['catch'](handleError(_0x982c1b,null));};exports[_0x031f('0x50')]=function(_0x523f69,_0x13251c){return respondWithRpcPromise(_0x031f('0x51'),_0x523f69[_0x031f('0x16')],routingClient)['then'](respondWithResult(_0x13251c,null))[_0x031f('0xd')](handleError(_0x13251c,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0xa31a3,_0xffb00){return respondWithRpcPromise(_0x031f('0x51'),_0xa31a3['query'],routingClient)[_0x031f('0x8')](function(_0x398e7c){if(_0xa31a3[_0x031f('0x16')][_0x031f('0x52')]!==undefined){var _0x45330f=_(_0x398e7c['rows'])['filter']([_0xa31a3[_0x031f('0x16')][_0x031f('0x52')],_0xa31a3['params']['id']])[_0x031f('0x53')]('queue_id')[_0x031f('0x54')]()[_0x031f('0x55')]();return _0x398e7c[_0x031f('0x13')][_0x031f('0x56')](function(_0x52bb92){return _0x45330f[_0x031f('0x57')](_0x52bb92[_0x031f('0x58')])>-0x1;});}else{return _0x398e7c[_0x031f('0x13')]['filter'](function(_0x1328ba){return _0x1328ba[_0x031f('0x58')]===parseInt(_0xa31a3['params']['id']);});}})[_0x031f('0x8')](respondWithResult(_0xffb00,null))[_0x031f('0xd')](handleError(_0xffb00,null));};exports[_0x031f('0x59')]=function(_0x2fb2a8,_0x104025){return respondWithRpcPromise(_0x031f('0x5a'),_0x2fb2a8[_0x031f('0x16')],routingClient)['then'](respondWithResult(_0x104025,null))[_0x031f('0xd')](handleError(_0x104025,null));};exports[_0x031f('0x5b')]=function(_0x23cc40,_0x5b19c1){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x23cc40[_0x031f('0x16')],routingClient)['then'](respondWithResult(_0x5b19c1,null))['catch'](handleError(_0x5b19c1,null));};exports[_0x031f('0x5c')]=function(_0x184bbd,_0x1c8055){return respondWithRpcPromise(_0x031f('0x5d'),_0x184bbd[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0x1c8055,null))[_0x031f('0xd')](handleError(_0x1c8055,null));};exports[_0x031f('0x5e')]=function(_0xecbfed){return function(_0x30a3ea,_0x3166bb){var _0x49505e,_0x1a5fd2;var _0x2d867f=_[_0x031f('0x5f')](_0xecbfed);var _0x8290bf=_0xecbfed==='chat'?_0x031f('0x60'):'Account';return db[_0x2d867f+'Queue'][_0x031f('0x61')]({'raw':!![],'where':{'id':_0x30a3ea[_0x031f('0x1a')]['id']}})['then'](function(_0x510bb6){if(_[_0x031f('0x12')](_0x510bb6)){throw new Error(_0x2d867f+_0x031f('0x62'));}_0x49505e=_0x510bb6;return db[_0x2d867f+_0x031f('0x63')][_0x031f('0x61')]({'where':{'id':_0x30a3ea[_0x031f('0x1f')][_0x031f('0x64')]},'include':[{'model':db[_0x2d867f+'Interaction'],'as':_0x031f('0x65')},{'model':db[_0x2d867f+_0x8290bf],'as':_0x031f('0x66')}]});})['then'](function(_0x25ea89){if(_[_0x031f('0x12')](_0x25ea89)){throw new Error(_0x2d867f+_0x031f('0x67'));}_0x1a5fd2=_0x25ea89;return _0x25ea89[_0x031f('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x031f('0x8')](function(){var _0x20a8c6={'uniqueid':_0xecbfed+'.'+_0x1a5fd2['id']+'.'+_0x1a5fd2[_0x031f('0x65')]['id'],'FromUserId':_0x30a3ea['user']['id'],'type':_0x031f('0x69')};_0x20a8c6[_0x2d867f+'MessageId']=_0x1a5fd2['id'];_0x20a8c6[_0x2d867f+_0x031f('0x6a')]=_0x1a5fd2[_0x031f('0x65')]['id'];_0x20a8c6[_0x031f('0x6b')+_0x2d867f+_0x8290bf+'Id']=_0x1a5fd2['Account']['id'];_0x20a8c6['To'+_0x2d867f+'QueueId']=_0x49505e['id'];return db[_0x2d867f+'TransferReport'][_0x031f('0x6c')](_0x20a8c6);})[_0x031f('0x8')](function(){return respondWithRpcPromise(_0x031f('0x6d'),{'channel':_0xecbfed,'interaction':_0x1a5fd2[_0x031f('0x65')],'message':_0x1a5fd2,'account':_0x1a5fd2[_0x031f('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0x031f('0x69'),'appdata':_0x49505e[_0x031f('0x10')]+','+(_0x1a5fd2['Account']['queueTransferTimeout']||0x12c),'interval':_0x031f('0x6e')}]},routingClient);})[_0x031f('0x8')](respondWithResult(_0x3166bb,null))['catch'](handleError(_0x3166bb,null));};};exports[_0x031f('0x6f')]=function(_0x4afad0,_0x1c31d5){var _0x20d85a,_0x5a6db6;if(_[_0x031f('0x12')](_0x4afad0[_0x031f('0x1f')]['channel'])){throw new Error(_0x031f('0x70'));}var _0x3c7dee=_0x4afad0[_0x031f('0x1f')]['channel'];var _0xa9b5e2=_[_0x031f('0x5f')](_0x3c7dee);var _0x1f6f71=_0x3c7dee===_0x031f('0x71')?_0x031f('0x60'):_0x031f('0x66');return db['User'][_0x031f('0x61')]({'raw':!![],'where':{'id':_0x4afad0[_0x031f('0x1a')]['id'],'role':_0x031f('0x72')}})[_0x031f('0x8')](function(_0x4ef395){if(_[_0x031f('0x12')](_0x4ef395)){throw new Error(_0x031f('0x73'));}_0x20d85a=_0x4ef395;return db[_0xa9b5e2+'Message'][_0x031f('0x61')]({'where':{'id':_0x4afad0[_0x031f('0x1f')][_0x031f('0x64')]},'include':[{'model':db[_0xa9b5e2+_0x031f('0x65')],'as':_0x031f('0x65')},{'model':db[_0xa9b5e2+_0x1f6f71],'as':_0x031f('0x66')}]});})[_0x031f('0x8')](function(_0xb35eef){if(_[_0x031f('0x12')](_0xb35eef)){throw new Error(_0xa9b5e2+_0x031f('0x67'));}_0x5a6db6=_0xb35eef;return _0xb35eef[_0x031f('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x031f('0x8')](function(){var _0x4b077c={'uniqueid':_0x3c7dee+'.'+_0x5a6db6['id']+'.'+_0x5a6db6[_0x031f('0x65')]['id'],'FromUserId':_0x4afad0[_0x031f('0x31')]['id'],'type':'queue','ToUserId':_0x20d85a['id']};_0x4b077c[_0xa9b5e2+_0x031f('0x74')]=_0x5a6db6['id'];_0x4b077c[_0xa9b5e2+_0x031f('0x6a')]=_0x5a6db6[_0x031f('0x65')]['id'];_0x4b077c[_0x031f('0x6b')+_0xa9b5e2+_0x1f6f71+'Id']=_0x5a6db6[_0x031f('0x66')]['id'];return db[_0xa9b5e2+_0x031f('0x75')]['create'](_0x4b077c);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x3c7dee,'interaction':_0x5a6db6[_0x031f('0x65')],'message':_0x5a6db6,'account':_0x5a6db6[_0x031f('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20d85a[_0x031f('0x10')]+','+(_0x5a6db6[_0x031f('0x66')][_0x031f('0x76')]||0x12c),'interval':_0x031f('0x6e')}]},routingClient);})['then'](respondWithResult(_0x1c31d5,null))[_0x031f('0xd')](handleError(_0x1c31d5,null));}; \ No newline at end of file +var _0x5fd1=['findOrCreate','SIP/%s','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','MessageId','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','jayson/promise','client','http','then','error','message','result','catch','status','stack','name','send','isNil','find','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes'];(function(_0x16df8f,_0x3dbe15){var _0x56ffee=function(_0x23aa44){while(--_0x23aa44){_0x16df8f['push'](_0x16df8f['shift']());}};_0x56ffee(++_0x3dbe15);}(_0x5fd1,0x155));var _0x15fd=function(_0x14beba,_0xa2c951){_0x14beba=_0x14beba-0x0;var _0x3b97fe=_0x5fd1[_0x14beba];return _0x3b97fe;};'use strict';var BPromise=require(_0x15fd('0x0'));var moment=require('moment');var _=require(_0x15fd('0x1'));var util=require(_0x15fd('0x2'));var db=require(_0x15fd('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x15fd('0x4'));var amiClient=jayson[_0x15fd('0x5')][_0x15fd('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x15fd('0x6')]({'port':0x232b});var routingClient=jayson[_0x15fd('0x5')][_0x15fd('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){var _0x19806f=_0x534e63?_0x534e63:amiClient;return _0x19806f['request'](_0x2e88bf,_0x225728)[_0x15fd('0x7')](function(_0x5c9c63){if(_0x5c9c63[_0x15fd('0x8')]){if(_0x5c9c63[_0x15fd('0x8')]['code']===0x1f4){return _0x1ee117(_0x5c9c63['error']['message']);}return _0x210e90(_0x5c9c63[_0x15fd('0x8')][_0x15fd('0x9')]);}else{_0x210e90(_0x5c9c63[_0x15fd('0xa')]);}})[_0x15fd('0xb')](function(_0x311138){_0x1ee117(_0x311138);});});}function respondWithResult(_0x2e18ec,_0x346ab1){_0x346ab1=_0x346ab1||0xc8;return function(_0x2660db){if(_0x2660db){return _0x2e18ec[_0x15fd('0xc')](_0x346ab1)['json'](_0x2660db);}return _0x2e18ec['sendStatus'](0x194);};}function handleError(_0x5784a3,_0x3fda60){_0x3fda60=_0x3fda60||0x1f4;return function(_0x135a15){logger[_0x15fd('0x8')](_0x135a15[_0x15fd('0xd')]);if(_0x135a15[_0x15fd('0xe')]){delete _0x135a15[_0x15fd('0xe')];}_0x5784a3[_0x15fd('0xc')](_0x3fda60)[_0x15fd('0xf')](_0x135a15);};}function findById(_0x5aae13){return function(_0x4c7080){if(!_[_0x15fd('0x10')](_0x5aae13)&&!_['isNil'](_0x4c7080)&&!_[_0x15fd('0x10')](_0x4c7080['rows'])){return _[_0x15fd('0x11')](_0x4c7080[_0x15fd('0x12')],function(_0x855bae){return _0x855bae['id']==_0x5aae13;});}return null;};}exports['voiceChannels']=function(_0x367c36,_0x2ad0de){return respondWithRpcPromise(_0x15fd('0x13'),_0x367c36[_0x15fd('0x14')])[_0x15fd('0x7')](respondWithResult(_0x2ad0de,null))[_0x15fd('0xb')](handleError(_0x2ad0de,null));};exports[_0x15fd('0x15')]=function(_0x2f46f1,_0x1b8b9f){return respondWithRpcPromise(_0x15fd('0x16'),_[_0x15fd('0x17')](_0x2f46f1['query'],_0x2f46f1['params']))[_0x15fd('0x7')](respondWithResult(_0x1b8b9f,null))[_0x15fd('0xb')](handleError(_0x1b8b9f,null));};exports[_0x15fd('0x18')]=function(_0x118a2b,_0x24bdaf){return respondWithRpcPromise(_0x15fd('0x19'),_[_0x15fd('0x17')](_0x118a2b['query'],_0x118a2b[_0x15fd('0x1a')]))[_0x15fd('0x7')](respondWithResult(_0x24bdaf,null))[_0x15fd('0xb')](handleError(_0x24bdaf,null));};exports['voiceQueues']=function(_0x27528f,_0x49062f){return respondWithRpcPromise(_0x15fd('0x1b'),_0x27528f[_0x15fd('0x14')])[_0x15fd('0x7')](respondWithResult(_0x49062f,null))['catch'](handleError(_0x49062f,null));};exports[_0x15fd('0x1c')]=function(_0x1cbf2c,_0x24c541){return respondWithRpcPromise('VoiceQueues',_0x1cbf2c[_0x15fd('0x14')])['then'](findById(_0x1cbf2c[_0x15fd('0x1a')]['id']))[_0x15fd('0x7')](respondWithResult(_0x24c541,null))[_0x15fd('0xb')](handleError(_0x24c541,null));};exports[_0x15fd('0x1d')]=function(_0x233ed3,_0x6c213b){return respondWithRpcPromise(_0x15fd('0x1e'),_[_0x15fd('0x17')](_0x233ed3[_0x15fd('0x1f')],_0x233ed3[_0x15fd('0x1a')]))[_0x15fd('0x7')](respondWithResult(_0x6c213b,null))['catch'](handleError(_0x6c213b,null));};exports[_0x15fd('0x20')]=function(_0x2fe61e,_0x50381a){return respondWithRpcPromise(_0x15fd('0x21'),_[_0x15fd('0x17')](_0x2fe61e['query'],_0x2fe61e[_0x15fd('0x1a')]))[_0x15fd('0x7')](respondWithResult(_0x50381a,null))['catch'](handleError(_0x50381a,null));};exports[_0x15fd('0x22')]=function(_0x199647,_0x582af2){return respondWithRpcPromise(_0x15fd('0x23'),_0x199647[_0x15fd('0x14')])[_0x15fd('0x7')](respondWithResult(_0x582af2,null))['catch'](handleError(_0x582af2,null));};exports[_0x15fd('0x24')]=function(_0x7ac52b,_0x4228ea){return respondWithRpcPromise(_0x15fd('0x25'),_['merge'](_0x7ac52b[_0x15fd('0x14')],_0x7ac52b[_0x15fd('0x1a')]))[_0x15fd('0x7')](respondWithResult(_0x4228ea,null))[_0x15fd('0xb')](handleError(_0x4228ea,null));};exports[_0x15fd('0x26')]=function(_0x296a0c,_0x4d9ff5){return respondWithRpcPromise(_0x15fd('0x27'),_[_0x15fd('0x17')](_0x296a0c['query'],_0x296a0c[_0x15fd('0x1a')]))[_0x15fd('0x7')](respondWithResult(_0x4d9ff5,null))[_0x15fd('0xb')](handleError(_0x4d9ff5,null));};exports['voiceQueuesChannelRedirect']=function(_0x25d34e,_0x309851){return respondWithRpcPromise(_0x15fd('0x28'),_[_0x15fd('0x17')](_0x25d34e[_0x15fd('0x14')],_0x25d34e[_0x15fd('0x1a')]))['then'](respondWithResult(_0x309851,null))['catch'](handleError(_0x309851,null));};exports['outbound']=function(_0x340d17,_0x289710){return respondWithRpcPromise(_0x15fd('0x29'),_0x340d17['query'])['then'](respondWithResult(_0x289710,null))[_0x15fd('0xb')](handleError(_0x289710,null));};exports['outboundChannels']=function(_0x4f1c84,_0x4c1aa8){return respondWithRpcPromise(_0x15fd('0x2a'),_0x4f1c84[_0x15fd('0x14')])[_0x15fd('0x7')](respondWithResult(_0x4c1aa8,null))['catch'](handleError(_0x4c1aa8,null));};exports[_0x15fd('0x2b')]=function(_0x3a10e2,_0xd85d3e){var _0x5beb6e;return respondWithRpcPromise(_0x15fd('0x2c'),_0x3a10e2[_0x15fd('0x14')])[_0x15fd('0x7')](function(_0xe18038){_0x5beb6e=_0xe18038;return respondWithRpcPromise(_0x15fd('0x2c'),_0x3a10e2[_0x15fd('0x14')],routingClient);})[_0x15fd('0x7')](function(_0x12a894){return _[_0x15fd('0x17')]({},_0x12a894,_0x5beb6e);})['then'](respondWithResult(_0xd85d3e,null))[_0x15fd('0xb')](handleError(_0xd85d3e,null));};exports[_0x15fd('0x2d')]=function(_0x180433,_0x304736){if(_0x180433[_0x15fd('0x1f')]&&_0x180433[_0x15fd('0x1f')][_0x15fd('0x2e')]&&_0x180433[_0x15fd('0x2f')]&&_0x180433[_0x15fd('0x2f')][_0x15fd('0xe')]){for(var _0x2eb6b6 in _0x180433[_0x15fd('0x1f')][_0x15fd('0x2e')]){if(_0x180433[_0x15fd('0x1f')][_0x15fd('0x2e')]['hasOwnProperty'](_0x2eb6b6)){db[_0x15fd('0x30')][_0x15fd('0x31')]({'where':{'channel':_0x2eb6b6,'membername':_0x180433[_0x15fd('0x2f')][_0x15fd('0xe')],'type':_0x15fd('0x32'),'exitAt':null,'uniqueid':_0x180433[_0x15fd('0x1f')][_0x15fd('0x2e')][_0x2eb6b6]&&_0x180433[_0x15fd('0x1f')]['interaction'][_0x2eb6b6]['length']?{'$notIn':_0x180433[_0x15fd('0x1f')]['interaction'][_0x2eb6b6]}:{'$ne':null}}})[_0x15fd('0x7')](function(_0x2741d4){var _0x5e4b62=moment()[_0x15fd('0x33')](_0x15fd('0x34'));for(var _0x131eb4=0x0,_0x2611ba=_0x2741d4[_0x15fd('0x35')];_0x131eb4<_0x2611ba;_0x131eb4+=0x1){_0x2741d4[_0x131eb4][_0x15fd('0x36')]({'exitAt':_0x5e4b62});}});for(var _0x494f83=0x0;_0x494f83<_0x180433[_0x15fd('0x1f')][_0x15fd('0x2e')][_0x2eb6b6][_0x15fd('0x35')];_0x494f83+=0x1){db[_0x15fd('0x30')][_0x15fd('0x37')]({'where':{'channel':_0x2eb6b6,'membername':_0x180433[_0x15fd('0x2f')][_0x15fd('0xe')],'type':_0x15fd('0x32'),'uniqueid':_0x180433[_0x15fd('0x1f')][_0x15fd('0x2e')][_0x2eb6b6][_0x494f83],'exitAt':null},'defaults':{'channel':_0x2eb6b6,'membername':_0x180433[_0x15fd('0x2f')][_0x15fd('0xe')],'interface':_['isNil'](_0x180433[_0x15fd('0x2f')]['interface'])?util[_0x15fd('0x33')](_0x15fd('0x38'),_0x180433[_0x15fd('0x2f')]['name']):_0x180433[_0x15fd('0x2f')][_0x15fd('0x39')],'type':_0x15fd('0x32'),'enterAt':moment()[_0x15fd('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x15fd('0x3a'),'internal':_0x180433[_0x15fd('0x2f')][_0x15fd('0x3b')],'uniqueid':_0x180433[_0x15fd('0x1f')]['interaction'][_0x2eb6b6][_0x494f83]}});}}}}return respondWithRpcPromise(_0x15fd('0x3c'),{'id':_0x180433[_0x15fd('0x1a')]['id'],'capacity':_0x180433['body']['capacity']},routingClient)['then'](respondWithResult(_0x304736,null))[_0x15fd('0xb')](handleError(_0x304736,null));};exports[_0x15fd('0x3d')]=function(_0x366c49,_0x10cf04){return respondWithRpcPromise(_0x15fd('0x3e'),_0x366c49[_0x15fd('0x14')])['then'](respondWithResult(_0x10cf04,null))[_0x15fd('0xb')](handleError(_0x10cf04,null));};exports[_0x15fd('0x3f')]=function(_0xbb16ef,_0x516b25){return respondWithRpcPromise(_0x15fd('0x40'),_0xbb16ef['query'])[_0x15fd('0x7')](respondWithResult(_0x516b25,null))[_0x15fd('0xb')](handleError(_0x516b25,null));};exports[_0x15fd('0x41')]=function(_0x42d4de,_0x332df7){return respondWithRpcPromise(_0x15fd('0x42'),_0x42d4de[_0x15fd('0x14')])[_0x15fd('0x7')](respondWithResult(_0x332df7,null))[_0x15fd('0xb')](handleError(_0x332df7,null));};exports[_0x15fd('0x43')]=function(_0x1491a3,_0x36eaf7){return respondWithRpcPromise(_0x15fd('0x44'),_0x1491a3['query'],routingClient)[_0x15fd('0x7')](respondWithResult(_0x36eaf7,null))['catch'](handleError(_0x36eaf7,null));};exports[_0x15fd('0x45')]=function(_0x509aef,_0x25bdea){return respondWithRpcPromise(_0x15fd('0x44'),_0x509aef[_0x15fd('0x14')],routingClient)['then'](findById(_0x509aef['params']['id']))[_0x15fd('0x7')](respondWithResult(_0x25bdea,null))[_0x15fd('0xb')](handleError(_0x25bdea,null));};exports[_0x15fd('0x46')]=function(_0x30ab06,_0x5d94b3){return respondWithRpcPromise(_0x15fd('0x47'),_0x30ab06[_0x15fd('0x14')],routingClient)[_0x15fd('0x7')](respondWithResult(_0x5d94b3,null))[_0x15fd('0xb')](handleError(_0x5d94b3,null));};exports[_0x15fd('0x48')]=function(_0x321fe7,_0x59b3b4){return respondWithRpcPromise(_0x15fd('0x47'),_0x321fe7[_0x15fd('0x14')],routingClient)[_0x15fd('0x7')](findById(_0x321fe7[_0x15fd('0x1a')]['id']))[_0x15fd('0x7')](respondWithResult(_0x59b3b4,null))[_0x15fd('0xb')](handleError(_0x59b3b4,null));};exports['mailAccounts']=function(_0x4f2a17,_0x149b20){return respondWithRpcPromise(_0x15fd('0x49'),_0x4f2a17['query'],mailClient)[_0x15fd('0x7')](respondWithResult(_0x149b20,null))[_0x15fd('0xb')](handleError(_0x149b20,null));};exports['openchannelQueues']=function(_0x285fd5,_0x4626ac){return respondWithRpcPromise(_0x15fd('0x4a'),_0x285fd5['query'],routingClient)[_0x15fd('0x7')](respondWithResult(_0x4626ac,null))[_0x15fd('0xb')](handleError(_0x4626ac,null));};exports[_0x15fd('0x4b')]=function(_0x2db860,_0xa206b){return respondWithRpcPromise(_0x15fd('0x4a'),_0x2db860[_0x15fd('0x14')],routingClient)[_0x15fd('0x7')](findById(_0x2db860[_0x15fd('0x1a')]['id']))[_0x15fd('0x7')](respondWithResult(_0xa206b,null))['catch'](handleError(_0xa206b,null));};exports[_0x15fd('0x4c')]=function(_0x3a26c8,_0x5b720b){return respondWithRpcPromise('SmsQueues',_0x3a26c8[_0x15fd('0x14')],routingClient)[_0x15fd('0x7')](respondWithResult(_0x5b720b,null))[_0x15fd('0xb')](handleError(_0x5b720b,null));};exports[_0x15fd('0x4d')]=function(_0x12fd6c,_0x1b6f59){return respondWithRpcPromise('SmsQueues',_0x12fd6c[_0x15fd('0x14')],routingClient)[_0x15fd('0x7')](findById(_0x12fd6c[_0x15fd('0x1a')]['id']))[_0x15fd('0x7')](respondWithResult(_0x1b6f59,null))[_0x15fd('0xb')](handleError(_0x1b6f59,null));};exports[_0x15fd('0x4e')]=function(_0xf27ab4,_0x1fe6cb){return respondWithRpcPromise(_0x15fd('0x4f'),_0xf27ab4[_0x15fd('0x14')],routingClient)[_0x15fd('0x7')](respondWithResult(_0x1fe6cb,null))['catch'](handleError(_0x1fe6cb,null));};exports['showWhatsappQueues']=function(_0x8a8198,_0x24ea9b){return respondWithRpcPromise(_0x15fd('0x4f'),_0x8a8198[_0x15fd('0x14')],routingClient)[_0x15fd('0x7')](findById(_0x8a8198[_0x15fd('0x1a')]['id']))[_0x15fd('0x7')](respondWithResult(_0x24ea9b,null))['catch'](handleError(_0x24ea9b,null));};exports[_0x15fd('0x50')]=function(_0x5de222,_0xc8931e){return respondWithRpcPromise('FaxQueues',_0x5de222[_0x15fd('0x14')],routingClient)['then'](respondWithResult(_0xc8931e,null))[_0x15fd('0xb')](handleError(_0xc8931e,null));};exports[_0x15fd('0x51')]=function(_0x4390bc,_0x3d40f3){return respondWithRpcPromise(_0x15fd('0x52'),_0x4390bc[_0x15fd('0x14')],routingClient)[_0x15fd('0x7')](findById(_0x4390bc[_0x15fd('0x1a')]['id']))[_0x15fd('0x7')](respondWithResult(_0x3d40f3,null))['catch'](handleError(_0x3d40f3,null));};exports['faxAccounts']=function(_0x1ca245,_0x239a06){return respondWithRpcPromise(_0x15fd('0x53'),_0x1ca245['query'])[_0x15fd('0x7')](respondWithResult(_0x239a06,null))[_0x15fd('0xb')](handleError(_0x239a06,null));};exports[_0x15fd('0x54')]=function(_0x56cf8c,_0x3bf85b){return respondWithRpcPromise(_0x15fd('0x55'),_0x56cf8c['query'],routingClient)[_0x15fd('0x7')](respondWithResult(_0x3bf85b,null))['catch'](handleError(_0x3bf85b,null));};exports[_0x15fd('0x56')]=function(_0x40a8e9,_0x74f311){return respondWithRpcPromise(_0x15fd('0x57'),_0x40a8e9[_0x15fd('0x14')],routingClient)['then'](respondWithResult(_0x74f311,null))[_0x15fd('0xb')](handleError(_0x74f311,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x3c4ffa,_0x4a165f){return respondWithRpcPromise(_0x15fd('0x58'),_0x3c4ffa[_0x15fd('0x14')],routingClient)['then'](respondWithResult(_0x4a165f,null))[_0x15fd('0xb')](handleError(_0x4a165f,null));};exports[_0x15fd('0x59')]=function(_0x47f39a,_0x484cd1){return respondWithRpcPromise(_0x15fd('0x58'),_0x47f39a['query'],routingClient)[_0x15fd('0x7')](function(_0x2feba1){if(_0x47f39a[_0x15fd('0x14')][_0x15fd('0x5a')]!==undefined){var _0x2d1c93=_(_0x2feba1['rows'])[_0x15fd('0x5b')]([_0x47f39a[_0x15fd('0x14')]['type'],_0x47f39a[_0x15fd('0x1a')]['id']])[_0x15fd('0x5c')](_0x15fd('0x5d'))[_0x15fd('0x5e')]()[_0x15fd('0x5f')]();return _0x2feba1[_0x15fd('0x12')][_0x15fd('0x5b')](function(_0x39b777){return _0x2d1c93[_0x15fd('0x60')](_0x39b777[_0x15fd('0x5d')])>-0x1;});}else{return _0x2feba1[_0x15fd('0x12')][_0x15fd('0x5b')](function(_0x273311){return _0x273311[_0x15fd('0x5d')]===parseInt(_0x47f39a['params']['id']);});}})[_0x15fd('0x7')](respondWithResult(_0x484cd1,null))['catch'](handleError(_0x484cd1,null));};exports[_0x15fd('0x61')]=function(_0x43d0b0,_0x3bfa0b){return respondWithRpcPromise(_0x15fd('0x62'),_0x43d0b0['query'],routingClient)[_0x15fd('0x7')](respondWithResult(_0x3bfa0b,null))[_0x15fd('0xb')](handleError(_0x3bfa0b,null));};exports[_0x15fd('0x63')]=function(_0x873778,_0x4accfd){return respondWithRpcPromise(_0x15fd('0x64'),_0x873778[_0x15fd('0x14')],routingClient)['then'](respondWithResult(_0x4accfd,null))[_0x15fd('0xb')](handleError(_0x4accfd,null));};exports[_0x15fd('0x65')]=function(_0x128ee3,_0x57089a){return respondWithRpcPromise(_0x15fd('0x66'),_0x128ee3[_0x15fd('0x14')],routingClient)[_0x15fd('0x7')](respondWithResult(_0x57089a,null))[_0x15fd('0xb')](handleError(_0x57089a,null));};exports[_0x15fd('0x67')]=function(_0x2d24a2){return function(_0x4e36c0,_0x2b7737){var _0x15a645,_0x32a2a0;var _0x3bd3fb=_[_0x15fd('0x68')](_0x2d24a2);var _0x55e9dd=_0x2d24a2===_0x15fd('0x69')?_0x15fd('0x6a'):_0x15fd('0x6b');return db[_0x3bd3fb+_0x15fd('0x6c')][_0x15fd('0x6d')]({'raw':!![],'where':{'id':_0x4e36c0['params']['id']}})['then'](function(_0x3017c6){if(_[_0x15fd('0x10')](_0x3017c6)){throw new Error(_0x3bd3fb+_0x15fd('0x6e'));}_0x15a645=_0x3017c6;return db[_0x3bd3fb+_0x15fd('0x6f')][_0x15fd('0x6d')]({'where':{'id':_0x4e36c0[_0x15fd('0x1f')][_0x15fd('0x70')]},'include':[{'model':db[_0x3bd3fb+_0x15fd('0x71')],'as':_0x15fd('0x71')},{'model':db[_0x3bd3fb+_0x55e9dd],'as':'Account'}]});})[_0x15fd('0x7')](function(_0x23d547){if(_['isNil'](_0x23d547)){throw new Error(_0x3bd3fb+_0x15fd('0x72'));}_0x32a2a0=_0x23d547;return _0x23d547[_0x15fd('0x73')]({'read':0x0,'readAt':null,'UserId':null});})[_0x15fd('0x7')](function(){var _0x35ad47={'uniqueid':_0x2d24a2+'.'+_0x32a2a0['id']+'.'+_0x32a2a0['Interaction']['id'],'FromUserId':_0x4e36c0[_0x15fd('0x2f')]['id'],'type':_0x15fd('0x74')};_0x35ad47[_0x3bd3fb+'MessageId']=_0x32a2a0['id'];_0x35ad47[_0x3bd3fb+_0x15fd('0x75')]=_0x32a2a0[_0x15fd('0x71')]['id'];_0x35ad47[_0x15fd('0x76')+_0x3bd3fb+_0x55e9dd+'Id']=_0x32a2a0['Account']['id'];_0x35ad47['To'+_0x3bd3fb+_0x15fd('0x77')]=_0x15a645['id'];return db[_0x3bd3fb+_0x15fd('0x78')][_0x15fd('0x79')](_0x35ad47);})[_0x15fd('0x7')](function(){return respondWithRpcPromise(_0x15fd('0x7a'),{'channel':_0x2d24a2,'interaction':_0x32a2a0[_0x15fd('0x71')],'message':_0x32a2a0,'account':_0x32a2a0[_0x15fd('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x15fd('0x74'),'appdata':_0x15a645['name']+','+(_0x32a2a0[_0x15fd('0x6b')][_0x15fd('0x7b')]||0x12c),'interval':_0x15fd('0x7c')}]},routingClient);})[_0x15fd('0x7')](respondWithResult(_0x2b7737,null))[_0x15fd('0xb')](handleError(_0x2b7737,null));};};exports[_0x15fd('0x7d')]=function(_0x3ebb13,_0x939bfd){var _0x3a4731,_0x264a98;if(_[_0x15fd('0x10')](_0x3ebb13[_0x15fd('0x1f')][_0x15fd('0x7e')])){throw new Error(_0x15fd('0x7f'));}var _0x4221df=_0x3ebb13[_0x15fd('0x1f')][_0x15fd('0x7e')];var _0x255dd5=_[_0x15fd('0x68')](_0x4221df);var _0x178dac=_0x4221df===_0x15fd('0x69')?_0x15fd('0x6a'):_0x15fd('0x6b');return db[_0x15fd('0x80')][_0x15fd('0x6d')]({'raw':!![],'where':{'id':_0x3ebb13[_0x15fd('0x1a')]['id'],'role':'agent'}})[_0x15fd('0x7')](function(_0x39e232){if(_['isNil'](_0x39e232)){throw new Error(_0x15fd('0x81'));}_0x3a4731=_0x39e232;return db[_0x255dd5+_0x15fd('0x6f')][_0x15fd('0x6d')]({'where':{'id':_0x3ebb13[_0x15fd('0x1f')]['messageId']},'include':[{'model':db[_0x255dd5+'Interaction'],'as':_0x15fd('0x71')},{'model':db[_0x255dd5+_0x178dac],'as':'Account'}]});})[_0x15fd('0x7')](function(_0x3e47fe){if(_[_0x15fd('0x10')](_0x3e47fe)){throw new Error(_0x255dd5+_0x15fd('0x72'));}_0x264a98=_0x3e47fe;return _0x3e47fe[_0x15fd('0x73')]({'read':0x0,'readAt':null,'UserId':null});})[_0x15fd('0x7')](function(){var _0x1bd38c={'uniqueid':_0x4221df+'.'+_0x264a98['id']+'.'+_0x264a98['Interaction']['id'],'FromUserId':_0x3ebb13['user']['id'],'type':_0x15fd('0x74'),'ToUserId':_0x3a4731['id']};_0x1bd38c[_0x255dd5+_0x15fd('0x82')]=_0x264a98['id'];_0x1bd38c[_0x255dd5+_0x15fd('0x75')]=_0x264a98[_0x15fd('0x71')]['id'];_0x1bd38c[_0x15fd('0x76')+_0x255dd5+_0x178dac+'Id']=_0x264a98[_0x15fd('0x6b')]['id'];return db[_0x255dd5+'TransferReport']['create'](_0x1bd38c);})[_0x15fd('0x7')](function(){return respondWithRpcPromise(_0x15fd('0x7a'),{'channel':_0x4221df,'interaction':_0x264a98[_0x15fd('0x71')],'message':_0x264a98,'account':_0x264a98[_0x15fd('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x15fd('0x3a'),'appdata':_0x3a4731[_0x15fd('0xe')]+','+(_0x264a98['Account'][_0x15fd('0x83')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x15fd('0x7')](respondWithResult(_0x939bfd,null))[_0x15fd('0xb')](handleError(_0x939bfd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 02dd0d7..5f87ef9 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 _0x3b0a=['/:id/run','post','create','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','show'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0x3b0a,0x84));var _0xa3b0=function(_0x254181,_0x52b2b1){_0x254181=_0x254181-0x0;var _0x53bb4c=_0x3b0a[_0x254181];return _0x53bb4c;};'use strict';var multer=require(_0xa3b0('0x0'));var util=require('util');var path=require(_0xa3b0('0x1'));var timeout=require(_0xa3b0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa3b0('0x3'));var auth=require(_0xa3b0('0x4'));var interaction=require(_0xa3b0('0x5'));var config=require('../../config/environment');var controller=require(_0xa3b0('0x6'));router[_0xa3b0('0x7')]('/',auth[_0xa3b0('0x8')](),controller[_0xa3b0('0x9')]);router[_0xa3b0('0x7')](_0xa3b0('0xa'),auth[_0xa3b0('0x8')](),controller[_0xa3b0('0xb')]);router[_0xa3b0('0x7')](_0xa3b0('0xc'),auth[_0xa3b0('0x8')](),controller['run']);router[_0xa3b0('0xd')]('/',auth[_0xa3b0('0x8')](),controller[_0xa3b0('0xe')]);router['put']('/:id',auth[_0xa3b0('0x8')](),controller[_0xa3b0('0xf')]);router[_0xa3b0('0x10')](_0xa3b0('0xa'),auth[_0xa3b0('0x8')](),controller[_0xa3b0('0x11')]);module['exports']=router; \ No newline at end of file +var _0x41cb=['update','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','create','put'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x41cb,0x1a1));var _0xb41c=function(_0x1c60fe,_0x37e05c){_0x1c60fe=_0x1c60fe-0x0;var _0x259272=_0x41cb[_0x1c60fe];return _0x259272;};'use strict';var multer=require(_0xb41c('0x0'));var util=require('util');var path=require(_0xb41c('0x1'));var timeout=require(_0xb41c('0x2'));var express=require('express');var router=express[_0xb41c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb41c('0x4'));var config=require('../../config/environment');var controller=require(_0xb41c('0x5'));router[_0xb41c('0x6')]('/',auth[_0xb41c('0x7')](),controller[_0xb41c('0x8')]);router[_0xb41c('0x6')](_0xb41c('0x9'),auth[_0xb41c('0x7')](),controller[_0xb41c('0xa')]);router['get'](_0xb41c('0xb'),auth[_0xb41c('0x7')](),controller[_0xb41c('0xc')]);router['post']('/',auth[_0xb41c('0x7')](),controller[_0xb41c('0xd')]);router[_0xb41c('0xe')](_0xb41c('0x9'),auth[_0xb41c('0x7')](),controller[_0xb41c('0xf')]);router['delete'](_0xb41c('0x9'),auth['isAuthenticated'](),controller[_0xb41c('0x10')]);module[_0xb41c('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 5adc2bb..af074cb 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 _0x6b30=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','weeks','days','hours','minutes','csv','xlsx','custom','TEXT'];(function(_0x27b0f9,_0xa17083){var _0x373f6f=function(_0x548abf){while(--_0x548abf){_0x27b0f9['push'](_0x27b0f9['shift']());}};_0x373f6f(++_0xa17083);}(_0x6b30,0xa2));var _0x06b3=function(_0x212dad,_0xb862ef){_0x212dad=_0x212dad-0x0;var _0x4fea3f=_0x6b30[_0x212dad];return _0x4fea3f;};'use strict';var Sequelize=require(_0x06b3('0x0'));module[_0x06b3('0x1')]={'name':{'type':Sequelize[_0x06b3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x06b3('0x2')]},'active':{'type':Sequelize[_0x06b3('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x06b3('0x4')},'startAt':{'type':Sequelize[_0x06b3('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x06b3('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x06b3('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x06b3('0x7')](_0x06b3('0x8'),'quarters',_0x06b3('0x9'),_0x06b3('0xa'),_0x06b3('0xb'),_0x06b3('0xc'),_0x06b3('0xd')),'allowNull':![],'defaultValue':_0x06b3('0xb')},'output':{'type':Sequelize[_0x06b3('0x7')](_0x06b3('0xe'),'pdf',_0x06b3('0xf')),'allowNull':![],'defaultValue':_0x06b3('0xe')},'type':{'type':Sequelize['ENUM'](_0x06b3('0x10'),'default'),'allowNull':![],'defaultValue':_0x06b3('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x06b3('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x06b3('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x06b3('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbb65=['days','hours','minutes','pdf','xlsx','csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks'];(function(_0x3f996f,_0x1c3acd){var _0x407d5d=function(_0x4c800c){while(--_0x4c800c){_0x3f996f['push'](_0x3f996f['shift']());}};_0x407d5d(++_0x1c3acd);}(_0xbb65,0x171));var _0x5bb6=function(_0x5962b4,_0x1f0a1f){_0x5962b4=_0x5962b4-0x0;var _0x52d4a1=_0xbb65[_0x5962b4];return _0x52d4a1;};'use strict';var Sequelize=require(_0x5bb6('0x0'));module[_0x5bb6('0x1')]={'name':{'type':Sequelize[_0x5bb6('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5bb6('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5bb6('0x4')},'startAt':{'type':Sequelize[_0x5bb6('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5bb6('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5bb6('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5bb6('0x7')](_0x5bb6('0x8'),_0x5bb6('0x9'),'months',_0x5bb6('0xa'),_0x5bb6('0xb'),_0x5bb6('0xc'),_0x5bb6('0xd')),'allowNull':![],'defaultValue':_0x5bb6('0xb')},'output':{'type':Sequelize[_0x5bb6('0x7')]('csv',_0x5bb6('0xe'),_0x5bb6('0xf')),'allowNull':![],'defaultValue':_0x5bb6('0x10')},'type':{'type':Sequelize[_0x5bb6('0x7')](_0x5bb6('0x11'),'default'),'allowNull':![],'defaultValue':_0x5bb6('0x11')},'sendMail':{'type':Sequelize[_0x5bb6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5bb6('0x2')]},'cc':{'type':Sequelize[_0x5bb6('0x12')]},'bcc':{'type':Sequelize[_0x5bb6('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x5bb6('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 11e0984..4263787 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 _0xa563=['status','Content-Range','apply','reject','save','update','then','get','Scheduler','destroy','error','stack','name','send','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','Schedule','includeAll','include','findAll','rows','catch','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count'];(function(_0x2b350c,_0x3427b5){var _0xbb04c2=function(_0x2cb3c7){while(--_0x2cb3c7){_0x2b350c['push'](_0x2b350c['shift']());}};_0xbb04c2(++_0x3427b5);}(_0xa563,0x127));var _0x3a56=function(_0x1b0569,_0x1d4a6b){_0x1b0569=_0x1b0569-0x0;var _0x5df4c3=_0xa563[_0x1b0569];return _0x5df4c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a56('0x0'));var zipdir=require(_0x3a56('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a56('0x2'));var moment=require('moment');var BPromise=require(_0x3a56('0x3'));var Mustache=require(_0x3a56('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3a56('0x5'));var csv=require(_0x3a56('0x6'));var ejs=require(_0x3a56('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a56('0x8'));var squel=require(_0x3a56('0x9'));var crypto=require(_0x3a56('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3a56('0xb'));var toCsv=require(_0x3a56('0x6'));var querystring=require(_0x3a56('0xc'));var Papa=require(_0x3a56('0xd'));var Redis=require(_0x3a56('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3a56('0xf'));var as=require(_0x3a56('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a56('0x11'))(_0x3a56('0x12'));var utils=require('../../config/utils');var config=require(_0x3a56('0x13'));var licenseUtil=require(_0x3a56('0x14'));var db=require(_0x3a56('0x15'))['db'];function respondWithStatusCode(_0x4b460f,_0x5b2b89){_0x5b2b89=_0x5b2b89||0xcc;return function(_0x30acca){if(_0x30acca){return _0x4b460f[_0x3a56('0x16')](_0x5b2b89);}return _0x4b460f['status'](_0x5b2b89)[_0x3a56('0x17')]();};}function respondWithResult(_0x27bbda,_0x5e9597){_0x5e9597=_0x5e9597||0xc8;return function(_0x324ca0){if(_0x324ca0){return _0x27bbda['status'](_0x5e9597)[_0x3a56('0x18')](_0x324ca0);}};}function respondWithFilteredResult(_0x7a21fc,_0xc699ab){return function(_0x1f3679){if(_0x1f3679){var _0x484812=typeof _0xc699ab[_0x3a56('0x19')]===_0x3a56('0x1a')&&typeof _0xc699ab[_0x3a56('0x1b')]===_0x3a56('0x1a');var _0x51b254=_0x1f3679[_0x3a56('0x1c')];var _0x34d563=_0x484812?0x0:_0xc699ab[_0x3a56('0x19')];var _0x2bb31b=_0x484812?_0x1f3679[_0x3a56('0x1c')]:_0xc699ab['offset']+_0xc699ab['limit'];var _0xb6f769;if(_0x2bb31b>=_0x51b254){_0x2bb31b=_0x51b254;_0xb6f769=0xc8;}else{_0xb6f769=0xce;}_0x7a21fc[_0x3a56('0x1d')](_0xb6f769);return _0x7a21fc['set'](_0x3a56('0x1e'),_0x34d563+'-'+_0x2bb31b+'/'+_0x51b254)['json'](_0x1f3679);}return null;};}function patchUpdates(_0x34748e){return function(_0x5674cf){try{jsonpatch[_0x3a56('0x1f')](_0x5674cf,_0x34748e,!![]);}catch(_0x573101){return BPromise[_0x3a56('0x20')](_0x573101);}return _0x5674cf[_0x3a56('0x21')]();};}function saveUpdates(_0x28a233,_0x2f879a){return function(_0x15efea){if(_0x15efea){return _0x15efea[_0x3a56('0x22')](_0x28a233)[_0x3a56('0x23')](function(_0x2899d7){return _0x2899d7;});}return null;};}function removeEntity(_0x4e3921,_0x26c7ea){return function(_0x334ccd){if(_0x334ccd){return _0x334ccd['destroy']()['then'](function(){var _0x18a145=_0x334ccd[_0x3a56('0x24')]({'plain':!![]});var _0x49b930=_0x3a56('0x25');return db['UserProfileResource'][_0x3a56('0x26')]({'where':{'type':_0x49b930,'resourceId':_0x18a145['id']}})[_0x3a56('0x23')](function(){return _0x334ccd;});})[_0x3a56('0x23')](function(){_0x4e3921[_0x3a56('0x1d')](0xcc)[_0x3a56('0x17')]();});}};}function handleEntityNotFound(_0x268f02,_0x442a82){return function(_0x273fda){if(!_0x273fda){_0x268f02[_0x3a56('0x16')](0x194);}return _0x273fda;};}function handleError(_0x5e8b4b,_0x2943a0){_0x2943a0=_0x2943a0||0x1f4;return function(_0x18af9f){logger[_0x3a56('0x27')](_0x18af9f[_0x3a56('0x28')]);if(_0x18af9f[_0x3a56('0x29')]){delete _0x18af9f['name'];}_0x5e8b4b['status'](_0x2943a0)[_0x3a56('0x2a')](_0x18af9f);};}exports['index']=function(_0x12f198,_0x5bb783){var _0x3ad451={},_0x39b095={},_0x2235f0={'count':0x0,'rows':[]};var _0x29e19c=_['map'](db['Schedule'][_0x3a56('0x2b')],function(_0x14a4b2){return{'name':_0x14a4b2['fieldName'],'type':_0x14a4b2['type'][_0x3a56('0x2c')]};});_0x39b095[_0x3a56('0x2d')]=_[_0x3a56('0x2e')](_0x29e19c,_0x3a56('0x29'));_0x39b095[_0x3a56('0x2f')]=_[_0x3a56('0x30')](_0x12f198['query']);_0x39b095[_0x3a56('0x31')]=_[_0x3a56('0x32')](_0x39b095['model'],_0x39b095[_0x3a56('0x2f')]);_0x3ad451[_0x3a56('0x33')]=_['intersection'](_0x39b095[_0x3a56('0x2d')],qs[_0x3a56('0x34')](_0x12f198[_0x3a56('0x2f')]['fields']));_0x3ad451[_0x3a56('0x33')]=_0x3ad451[_0x3a56('0x33')][_0x3a56('0x35')]?_0x3ad451[_0x3a56('0x33')]:_0x39b095[_0x3a56('0x2d')];if(!_0x12f198[_0x3a56('0x2f')][_0x3a56('0x36')]('nolimit')){_0x3ad451[_0x3a56('0x1b')]=qs['limit'](_0x12f198['query']['limit']);_0x3ad451[_0x3a56('0x19')]=qs['offset'](_0x12f198[_0x3a56('0x2f')]['offset']);}_0x3ad451[_0x3a56('0x37')]=qs['sort'](_0x12f198['query'][_0x3a56('0x38')]);_0x3ad451['where']=qs['filters'](_['pick'](_0x12f198[_0x3a56('0x2f')],_0x39b095[_0x3a56('0x31')]),_0x29e19c);if(_0x12f198[_0x3a56('0x2f')][_0x3a56('0x39')]){_0x3ad451[_0x3a56('0x3a')]=_[_0x3a56('0x3b')](_0x3ad451[_0x3a56('0x3a')],{'$or':_['map'](_0x29e19c,function(_0x8df39e){if(_0x8df39e[_0x3a56('0x3c')]!==_0x3a56('0x3d')){var _0x2632b2={};_0x2632b2[_0x8df39e[_0x3a56('0x29')]]={'$like':'%'+_0x12f198[_0x3a56('0x2f')][_0x3a56('0x39')]+'%'};return _0x2632b2;}})});}_0x3ad451=_['merge']({},_0x3ad451,_0x12f198[_0x3a56('0x3e')]);var _0x463126={'where':_0x3ad451[_0x3a56('0x3a')]};return db[_0x3a56('0x3f')][_0x3a56('0x1c')](_0x463126)['then'](function(_0x1e6b2a){_0x2235f0['count']=_0x1e6b2a;if(_0x12f198[_0x3a56('0x2f')][_0x3a56('0x40')]){_0x3ad451[_0x3a56('0x41')]=[{'all':!![]}];}return db[_0x3a56('0x3f')][_0x3a56('0x42')](_0x3ad451);})[_0x3a56('0x23')](function(_0x1b75dc){_0x2235f0[_0x3a56('0x43')]=_0x1b75dc;return _0x2235f0;})[_0x3a56('0x23')](respondWithFilteredResult(_0x5bb783,_0x3ad451))[_0x3a56('0x44')](handleError(_0x5bb783,null));};exports['show']=function(_0x26d6aa,_0x2999c3){var _0x29ddab={'raw':![],'where':{'id':_0x26d6aa['params']['id']}},_0x3c10a2={};_0x3c10a2[_0x3a56('0x2d')]=_[_0x3a56('0x30')](db['Schedule'][_0x3a56('0x2b')]);_0x3c10a2[_0x3a56('0x2f')]=_[_0x3a56('0x30')](_0x26d6aa['query']);_0x3c10a2['filters']=_[_0x3a56('0x32')](_0x3c10a2[_0x3a56('0x2d')],_0x3c10a2[_0x3a56('0x2f')]);_0x29ddab[_0x3a56('0x33')]=_[_0x3a56('0x32')](_0x3c10a2[_0x3a56('0x2d')],qs[_0x3a56('0x34')](_0x26d6aa[_0x3a56('0x2f')][_0x3a56('0x34')]));_0x29ddab['attributes']=_0x29ddab[_0x3a56('0x33')]['length']?_0x29ddab[_0x3a56('0x33')]:_0x3c10a2[_0x3a56('0x2d')];if(_0x26d6aa[_0x3a56('0x2f')][_0x3a56('0x40')]){_0x29ddab[_0x3a56('0x41')]=[{'all':!![]}];}_0x29ddab=_['merge']({},_0x29ddab,_0x26d6aa[_0x3a56('0x3e')]);return db[_0x3a56('0x3f')][_0x3a56('0x45')](_0x29ddab)[_0x3a56('0x23')](handleEntityNotFound(_0x2999c3,null))[_0x3a56('0x23')](respondWithResult(_0x2999c3,null))['catch'](handleError(_0x2999c3,null));};exports[_0x3a56('0x46')]=function(_0x50850c,_0x362dd2){return db['Schedule'][_0x3a56('0x46')](_0x50850c[_0x3a56('0x47')],{})[_0x3a56('0x23')](function(_0x2d533c){var _0x1890ef=_0x50850c[_0x3a56('0x48')][_0x3a56('0x24')]({'plain':!![]});if(!_0x1890ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1890ef[_0x3a56('0x49')]==='user'){var _0x5bc4d4=_0x2d533c[_0x3a56('0x24')]({'plain':!![]});var _0x5d0483='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x5d0483,'userProfileId':_0x1890ef[_0x3a56('0x4a')]},'raw':!![]})['then'](function(_0x41f8df){if(_0x41f8df&&_0x41f8df[_0x3a56('0x4b')]===0x0){return db[_0x3a56('0x4c')][_0x3a56('0x46')]({'name':_0x5bc4d4[_0x3a56('0x29')],'resourceId':_0x5bc4d4['id'],'type':_0x41f8df[_0x3a56('0x29')],'sectionId':_0x41f8df['id']},{})[_0x3a56('0x23')](function(){return _0x2d533c;});}else{return _0x2d533c;}})['catch'](function(_0x2e4a89){logger['error'](_0x3a56('0x4d'),_0x2e4a89);throw _0x2e4a89;});}return _0x2d533c;})[_0x3a56('0x23')](respondWithResult(_0x362dd2,0xc9))[_0x3a56('0x44')](handleError(_0x362dd2,null));};exports[_0x3a56('0x22')]=function(_0x26284f,_0x33a1fa){if(_0x26284f['body']['id']){delete _0x26284f[_0x3a56('0x47')]['id'];}return db[_0x3a56('0x3f')][_0x3a56('0x45')]({'where':{'id':_0x26284f[_0x3a56('0x4e')]['id']}})['then'](handleEntityNotFound(_0x33a1fa,null))[_0x3a56('0x23')](saveUpdates(_0x26284f['body'],null))['then'](respondWithResult(_0x33a1fa,null))[_0x3a56('0x44')](handleError(_0x33a1fa,null));};exports[_0x3a56('0x26')]=function(_0x139976,_0x3b6a7c){return db['Schedule'][_0x3a56('0x45')]({'where':{'id':_0x139976[_0x3a56('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b6a7c,null))[_0x3a56('0x23')](removeEntity(_0x3b6a7c,null))['catch'](handleError(_0x3b6a7c,null));};exports[_0x3a56('0x4f')]=function(_0x46eb61,_0x4fd529,_0x52a229){var _0x5d003a=require(_0x3a56('0x50'));return db[_0x3a56('0x3f')][_0x3a56('0x45')]({'where':{'id':_0x46eb61['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4fd529,null))[_0x3a56('0x23')](function(){_0x5d003a[_0x3a56('0x4f')](_0x46eb61[_0x3a56('0x4e')]['id']);})[_0x3a56('0x23')](respondWithStatusCode(_0x4fd529,null))[_0x3a56('0x44')](handleError(_0x4fd529,null));}; \ No newline at end of file +var _0xf4f6=['user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','../../config/schedule','run','rimraf','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Schedule','include','findAll','catch','length','find','create','body'];(function(_0x23e81d,_0x1e6cf0){var _0x2d255d=function(_0x2f08dc){while(--_0x2f08dc){_0x23e81d['push'](_0x23e81d['shift']());}};_0x2d255d(++_0x1e6cf0);}(_0xf4f6,0x193));var _0x6f4f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf4f6[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f4f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f4f('0x1'));var rp=require(_0x6f4f('0x2'));var moment=require(_0x6f4f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6f4f('0x4'));var path=require(_0x6f4f('0x5'));var sox=require(_0x6f4f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f4f('0x7'));var _=require(_0x6f4f('0x8'));var squel=require(_0x6f4f('0x9'));var crypto=require('crypto');var jsforce=require(_0x6f4f('0xa'));var deskjs=require(_0x6f4f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6f4f('0xc'));var Redis=require(_0x6f4f('0xd'));var authService=require(_0x6f4f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6f4f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6f4f('0x10'));var utils=require('../../config/utils');var config=require(_0x6f4f('0x11'));var licenseUtil=require(_0x6f4f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23146c,_0x3305f6){_0x3305f6=_0x3305f6||0xcc;return function(_0x491b40){if(_0x491b40){return _0x23146c[_0x6f4f('0x13')](_0x3305f6);}return _0x23146c[_0x6f4f('0x14')](_0x3305f6)[_0x6f4f('0x15')]();};}function respondWithResult(_0x266600,_0x147c96){_0x147c96=_0x147c96||0xc8;return function(_0x1d97c4){if(_0x1d97c4){return _0x266600[_0x6f4f('0x14')](_0x147c96)[_0x6f4f('0x16')](_0x1d97c4);}};}function respondWithFilteredResult(_0x517435,_0x3eed2f){return function(_0x103faf){if(_0x103faf){var _0xfc00c0=typeof _0x3eed2f['offset']===_0x6f4f('0x17')&&typeof _0x3eed2f[_0x6f4f('0x18')]===_0x6f4f('0x17');var _0x56a57f=_0x103faf[_0x6f4f('0x19')];var _0x18e1dd=_0xfc00c0?0x0:_0x3eed2f['offset'];var _0x192926=_0xfc00c0?_0x103faf['count']:_0x3eed2f['offset']+_0x3eed2f[_0x6f4f('0x18')];var _0xfd4ab9;if(_0x192926>=_0x56a57f){_0x192926=_0x56a57f;_0xfd4ab9=0xc8;}else{_0xfd4ab9=0xce;}_0x517435['status'](_0xfd4ab9);return _0x517435[_0x6f4f('0x1a')](_0x6f4f('0x1b'),_0x18e1dd+'-'+_0x192926+'/'+_0x56a57f)[_0x6f4f('0x16')](_0x103faf);}return null;};}function patchUpdates(_0x3f6488){return function(_0x171634){try{jsonpatch[_0x6f4f('0x1c')](_0x171634,_0x3f6488,!![]);}catch(_0x1e4df1){return BPromise[_0x6f4f('0x1d')](_0x1e4df1);}return _0x171634['save']();};}function saveUpdates(_0x5f2958,_0x472589){return function(_0x234124){if(_0x234124){return _0x234124[_0x6f4f('0x1e')](_0x5f2958)[_0x6f4f('0x1f')](function(_0x12701e){return _0x12701e;});}return null;};}function removeEntity(_0x4fdcb0,_0x33a606){return function(_0x1cf61e){if(_0x1cf61e){return _0x1cf61e[_0x6f4f('0x20')]()[_0x6f4f('0x1f')](function(){var _0x37269b=_0x1cf61e[_0x6f4f('0x21')]({'plain':!![]});var _0x130fa4=_0x6f4f('0x22');return db[_0x6f4f('0x23')][_0x6f4f('0x20')]({'where':{'type':_0x130fa4,'resourceId':_0x37269b['id']}})[_0x6f4f('0x1f')](function(){return _0x1cf61e;});})[_0x6f4f('0x1f')](function(){_0x4fdcb0[_0x6f4f('0x14')](0xcc)[_0x6f4f('0x15')]();});}};}function handleEntityNotFound(_0x330683,_0x47ae77){return function(_0x5e4cb0){if(!_0x5e4cb0){_0x330683['sendStatus'](0x194);}return _0x5e4cb0;};}function handleError(_0x38cfd2,_0x13006e){_0x13006e=_0x13006e||0x1f4;return function(_0x2afc65){logger[_0x6f4f('0x24')](_0x2afc65[_0x6f4f('0x25')]);if(_0x2afc65[_0x6f4f('0x26')]){delete _0x2afc65[_0x6f4f('0x26')];}_0x38cfd2[_0x6f4f('0x14')](_0x13006e)[_0x6f4f('0x27')](_0x2afc65);};}exports['index']=function(_0x2871a7,_0x1698b8){var _0x52e64c={},_0x2d8047={},_0x1638a1={'count':0x0,'rows':[]};var _0x23c824=_[_0x6f4f('0x28')](db['Schedule'][_0x6f4f('0x29')],function(_0x2ca7ad){return{'name':_0x2ca7ad[_0x6f4f('0x2a')],'type':_0x2ca7ad[_0x6f4f('0x2b')][_0x6f4f('0x2c')]};});_0x2d8047['model']=_[_0x6f4f('0x28')](_0x23c824,_0x6f4f('0x26'));_0x2d8047['query']=_[_0x6f4f('0x2d')](_0x2871a7[_0x6f4f('0x2e')]);_0x2d8047['filters']=_[_0x6f4f('0x2f')](_0x2d8047[_0x6f4f('0x30')],_0x2d8047[_0x6f4f('0x2e')]);_0x52e64c[_0x6f4f('0x31')]=_[_0x6f4f('0x2f')](_0x2d8047[_0x6f4f('0x30')],qs[_0x6f4f('0x32')](_0x2871a7[_0x6f4f('0x2e')][_0x6f4f('0x32')]));_0x52e64c[_0x6f4f('0x31')]=_0x52e64c[_0x6f4f('0x31')]['length']?_0x52e64c[_0x6f4f('0x31')]:_0x2d8047[_0x6f4f('0x30')];if(!_0x2871a7['query'][_0x6f4f('0x33')](_0x6f4f('0x34'))){_0x52e64c[_0x6f4f('0x18')]=qs['limit'](_0x2871a7[_0x6f4f('0x2e')][_0x6f4f('0x18')]);_0x52e64c[_0x6f4f('0x35')]=qs[_0x6f4f('0x35')](_0x2871a7[_0x6f4f('0x2e')]['offset']);}_0x52e64c[_0x6f4f('0x36')]=qs['sort'](_0x2871a7['query'][_0x6f4f('0x37')]);_0x52e64c[_0x6f4f('0x38')]=qs[_0x6f4f('0x39')](_[_0x6f4f('0x3a')](_0x2871a7[_0x6f4f('0x2e')],_0x2d8047[_0x6f4f('0x39')]),_0x23c824);if(_0x2871a7['query'][_0x6f4f('0x3b')]){_0x52e64c['where']=_[_0x6f4f('0x3c')](_0x52e64c[_0x6f4f('0x38')],{'$or':_[_0x6f4f('0x28')](_0x23c824,function(_0x28c842){if(_0x28c842['type']!==_0x6f4f('0x3d')){var _0x2c73d1={};_0x2c73d1[_0x28c842[_0x6f4f('0x26')]]={'$like':'%'+_0x2871a7[_0x6f4f('0x2e')]['filter']+'%'};return _0x2c73d1;}})});}_0x52e64c=_[_0x6f4f('0x3c')]({},_0x52e64c,_0x2871a7[_0x6f4f('0x3e')]);var _0x476cb7={'where':_0x52e64c['where']};return db[_0x6f4f('0x3f')]['count'](_0x476cb7)['then'](function(_0x474113){_0x1638a1[_0x6f4f('0x19')]=_0x474113;if(_0x2871a7[_0x6f4f('0x2e')]['includeAll']){_0x52e64c[_0x6f4f('0x40')]=[{'all':!![]}];}return db['Schedule'][_0x6f4f('0x41')](_0x52e64c);})[_0x6f4f('0x1f')](function(_0x33c661){_0x1638a1['rows']=_0x33c661;return _0x1638a1;})[_0x6f4f('0x1f')](respondWithFilteredResult(_0x1698b8,_0x52e64c))[_0x6f4f('0x42')](handleError(_0x1698b8,null));};exports['show']=function(_0x5d1219,_0x3ca8cf){var _0x1526d7={'raw':![],'where':{'id':_0x5d1219['params']['id']}},_0x3d3cf4={};_0x3d3cf4[_0x6f4f('0x30')]=_['keys'](db[_0x6f4f('0x3f')][_0x6f4f('0x29')]);_0x3d3cf4[_0x6f4f('0x2e')]=_[_0x6f4f('0x2d')](_0x5d1219['query']);_0x3d3cf4[_0x6f4f('0x39')]=_[_0x6f4f('0x2f')](_0x3d3cf4[_0x6f4f('0x30')],_0x3d3cf4[_0x6f4f('0x2e')]);_0x1526d7[_0x6f4f('0x31')]=_['intersection'](_0x3d3cf4[_0x6f4f('0x30')],qs['fields'](_0x5d1219['query'][_0x6f4f('0x32')]));_0x1526d7['attributes']=_0x1526d7[_0x6f4f('0x31')][_0x6f4f('0x43')]?_0x1526d7[_0x6f4f('0x31')]:_0x3d3cf4[_0x6f4f('0x30')];if(_0x5d1219[_0x6f4f('0x2e')]['includeAll']){_0x1526d7[_0x6f4f('0x40')]=[{'all':!![]}];}_0x1526d7=_['merge']({},_0x1526d7,_0x5d1219['options']);return db[_0x6f4f('0x3f')][_0x6f4f('0x44')](_0x1526d7)[_0x6f4f('0x1f')](handleEntityNotFound(_0x3ca8cf,null))[_0x6f4f('0x1f')](respondWithResult(_0x3ca8cf,null))[_0x6f4f('0x42')](handleError(_0x3ca8cf,null));};exports[_0x6f4f('0x45')]=function(_0x269384,_0x316320){return db[_0x6f4f('0x3f')]['create'](_0x269384[_0x6f4f('0x46')],{})['then'](function(_0x5854a0){var _0x45f726=_0x269384[_0x6f4f('0x47')][_0x6f4f('0x21')]({'plain':!![]});if(!_0x45f726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45f726['role']===_0x6f4f('0x47')){var _0x4da4e8=_0x5854a0[_0x6f4f('0x21')]({'plain':!![]});var _0x1e32b5=_0x6f4f('0x22');return db[_0x6f4f('0x48')][_0x6f4f('0x44')]({'where':{'name':_0x1e32b5,'userProfileId':_0x45f726[_0x6f4f('0x49')]},'raw':!![]})['then'](function(_0x3e904d){if(_0x3e904d&&_0x3e904d[_0x6f4f('0x4a')]===0x0){return db['UserProfileResource'][_0x6f4f('0x45')]({'name':_0x4da4e8[_0x6f4f('0x26')],'resourceId':_0x4da4e8['id'],'type':_0x3e904d[_0x6f4f('0x26')],'sectionId':_0x3e904d['id']},{})[_0x6f4f('0x1f')](function(){return _0x5854a0;});}else{return _0x5854a0;}})[_0x6f4f('0x42')](function(_0x38e8c9){logger['error'](_0x6f4f('0x4b'),_0x38e8c9);throw _0x38e8c9;});}return _0x5854a0;})[_0x6f4f('0x1f')](respondWithResult(_0x316320,0xc9))['catch'](handleError(_0x316320,null));};exports[_0x6f4f('0x1e')]=function(_0x53d49f,_0x3b2c69){if(_0x53d49f['body']['id']){delete _0x53d49f['body']['id'];}return db[_0x6f4f('0x3f')][_0x6f4f('0x44')]({'where':{'id':_0x53d49f[_0x6f4f('0x4c')]['id']}})[_0x6f4f('0x1f')](handleEntityNotFound(_0x3b2c69,null))[_0x6f4f('0x1f')](saveUpdates(_0x53d49f['body'],null))[_0x6f4f('0x1f')](respondWithResult(_0x3b2c69,null))[_0x6f4f('0x42')](handleError(_0x3b2c69,null));};exports['destroy']=function(_0x3f5f5b,_0x1e6bcc){return db[_0x6f4f('0x3f')]['find']({'where':{'id':_0x3f5f5b['params']['id']}})[_0x6f4f('0x1f')](handleEntityNotFound(_0x1e6bcc,null))[_0x6f4f('0x1f')](removeEntity(_0x1e6bcc,null))[_0x6f4f('0x42')](handleError(_0x1e6bcc,null));};exports['run']=function(_0x4aecf1,_0x57cecb,_0x58be63){var _0x564627=require(_0x6f4f('0x4d'));return db[_0x6f4f('0x3f')][_0x6f4f('0x44')]({'where':{'id':_0x4aecf1[_0x6f4f('0x4c')]['id']},'raw':!![]})[_0x6f4f('0x1f')](handleEntityNotFound(_0x57cecb,null))[_0x6f4f('0x1f')](function(){_0x564627[_0x6f4f('0x4e')](_0x4aecf1[_0x6f4f('0x4c')]['id']);})['then'](respondWithStatusCode(_0x57cecb,null))[_0x6f4f('0x42')](handleError(_0x57cecb,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a07f17a..0efac60 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 _0x75ba=['lodash','../../config/logger','api','moment','bluebird','request-promise','./schedule.attributes','exports','define','Schedule'];(function(_0x2f2742,_0x1ef9d3){var _0x44954c=function(_0x268415){while(--_0x268415){_0x2f2742['push'](_0x2f2742['shift']());}};_0x44954c(++_0x1ef9d3);}(_0x75ba,0x154));var _0xa75b=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x75ba[_0x277107];return _0x1da046;};'use strict';var _=require(_0xa75b('0x0'));var util=require('util');var logger=require(_0xa75b('0x1'))(_0xa75b('0x2'));var moment=require(_0xa75b('0x3'));var BPromise=require(_0xa75b('0x4'));var rp=require(_0xa75b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa75b('0x6'));module[_0xa75b('0x7')]=function(_0x571540,_0x24350d){return _0x571540[_0xa75b('0x8')](_0xa75b('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x342f=['tools_schedules','lodash','api','request-promise','path','../../config/environment','./schedule.attributes','exports','Schedule'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x342f,0x172));var _0xf342=function(_0x5c416e,_0x469158){_0x5c416e=_0x5c416e-0x0;var _0x4f4f03=_0x342f[_0x5c416e];return _0x4f4f03;};'use strict';var _=require(_0xf342('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf342('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf342('0x2'));var fs=require('fs');var path=require(_0xf342('0x3'));var rimraf=require('rimraf');var config=require(_0xf342('0x4'));var attributes=require(_0xf342('0x5'));module[_0xf342('0x6')]=function(_0x373efa,_0x7a35ea){return _0x373efa['define'](_0xf342('0x7'),attributes,{'tableName':_0xf342('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index fe48ace..b67cc64 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 _0x6bd1=['http','request','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client'];(function(_0x3dae3c,_0x3d61c3){var _0x326b20=function(_0xa4ec0d){while(--_0xa4ec0d){_0x3dae3c['push'](_0x3dae3c['shift']());}};_0x326b20(++_0x3d61c3);}(_0x6bd1,0x76));var _0x16bd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6bd1[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x16bd('0x0'));var util=require(_0x16bd('0x1'));var moment=require('moment');var BPromise=require(_0x16bd('0x2'));var rs=require(_0x16bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x16bd('0x4'));var logger=require('../../config/logger')(_0x16bd('0x5'));var config=require('../../config/environment');var jayson=require(_0x16bd('0x6'));var client=jayson[_0x16bd('0x7')][_0x16bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16f5b4,_0x2eed75,_0x39e323){return new BPromise(function(_0x302e22,_0x212917){return client[_0x16bd('0x9')](_0x16f5b4,_0x39e323)['then'](function(_0x3005fe){logger['info'](_0x16bd('0xa'),_0x2eed75,'request\x20sent');logger[_0x16bd('0xb')](_0x16bd('0xc'),_0x2eed75,'request\x20sent',JSON[_0x16bd('0xd')](_0x3005fe));if(_0x3005fe[_0x16bd('0xe')]){if(_0x3005fe[_0x16bd('0xe')][_0x16bd('0xf')]===0x1f4){logger[_0x16bd('0xe')](_0x16bd('0xa'),_0x2eed75,_0x3005fe[_0x16bd('0xe')][_0x16bd('0x10')]);return _0x212917(_0x3005fe[_0x16bd('0xe')]['message']);}logger[_0x16bd('0xe')](_0x16bd('0xa'),_0x2eed75,_0x3005fe[_0x16bd('0xe')][_0x16bd('0x10')]);return _0x302e22(_0x3005fe[_0x16bd('0xe')][_0x16bd('0x10')]);}else{logger['info'](_0x16bd('0xa'),_0x2eed75,'request\x20sent');_0x302e22(_0x3005fe['result'][_0x16bd('0x10')]);}})[_0x16bd('0x11')](function(_0x1760a2){logger[_0x16bd('0xe')](_0x16bd('0xa'),_0x2eed75,_0x1760a2);_0x212917(_0x1760a2);});});} \ No newline at end of file +var _0x427a=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','Schedule,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring'];(function(_0x5e9250,_0x1991f2){var _0xe2e414=function(_0x118535){while(--_0x118535){_0x5e9250['push'](_0x5e9250['shift']());}};_0xe2e414(++_0x1991f2);}(_0x427a,0x18d));var _0xa427=function(_0x2cd051,_0x458b28){_0x2cd051=_0x2cd051-0x0;var _0x36a151=_0x427a[_0x2cd051];return _0x36a151;};'use strict';var _=require(_0xa427('0x0'));var util=require('util');var moment=require(_0xa427('0x1'));var BPromise=require('bluebird');var rs=require(_0xa427('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa427('0x3'))['db'];var utils=require(_0xa427('0x4'));var logger=require(_0xa427('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa427('0x6'));var client=jayson[_0xa427('0x7')][_0xa427('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e893a,_0x149f9f,_0x1611e2){return new BPromise(function(_0x595a1e,_0x402fe7){return client[_0xa427('0x9')](_0x1e893a,_0x1611e2)[_0xa427('0xa')](function(_0x8d0edc){logger[_0xa427('0xb')]('Schedule,\x20%s,\x20%s',_0x149f9f,_0xa427('0xc'));logger[_0xa427('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x149f9f,_0xa427('0xc'),JSON[_0xa427('0xe')](_0x8d0edc));if(_0x8d0edc[_0xa427('0xf')]){if(_0x8d0edc[_0xa427('0xf')]['code']===0x1f4){logger[_0xa427('0xf')]('Schedule,\x20%s,\x20%s',_0x149f9f,_0x8d0edc[_0xa427('0xf')]['message']);return _0x402fe7(_0x8d0edc['error']['message']);}logger[_0xa427('0xf')](_0xa427('0x10'),_0x149f9f,_0x8d0edc['error']['message']);return _0x595a1e(_0x8d0edc[_0xa427('0xf')][_0xa427('0x11')]);}else{logger[_0xa427('0xb')](_0xa427('0x10'),_0x149f9f,'request\x20sent');_0x595a1e(_0x8d0edc[_0xa427('0x12')][_0xa427('0x11')]);}})[_0xa427('0x13')](function(_0x85dcc8){logger[_0xa427('0xf')]('Schedule,\x20%s,\x20%s',_0x149f9f,_0x85dcc8);_0x402fe7(_0x85dcc8);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index cfe4a91..10a53b7 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 _0x8a32=['/:id/download','post','create','put','update','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x2f023d,_0x29dfe5){var _0x4ef240=function(_0x49f1ec){while(--_0x49f1ec){_0x2f023d['push'](_0x2f023d['shift']());}};_0x4ef240(++_0x29dfe5);}(_0x8a32,0x1e6));var _0x28a3=function(_0x54e4af,_0x2bc074){_0x54e4af=_0x54e4af-0x0;var _0x4ff256=_0x8a32[_0x54e4af];return _0x4ff256;};'use strict';var multer=require(_0x28a3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x28a3('0x1'));var router=express[_0x28a3('0x2')]();var fs_extra=require(_0x28a3('0x3'));var auth=require(_0x28a3('0x4'));var interaction=require(_0x28a3('0x5'));var config=require(_0x28a3('0x6'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0x28a3('0x7')](),controller[_0x28a3('0x8')]);router[_0x28a3('0x9')](_0x28a3('0xa'),auth['isAuthenticated'](),controller[_0x28a3('0xb')]);router[_0x28a3('0x9')](_0x28a3('0xc'),auth[_0x28a3('0x7')](),controller[_0x28a3('0xd')]);router[_0x28a3('0x9')](_0x28a3('0xe'),auth[_0x28a3('0x7')](),controller['download']);router[_0x28a3('0xf')]('/',auth[_0x28a3('0x7')](),controller[_0x28a3('0x10')]);router[_0x28a3('0x11')](_0x28a3('0xc'),auth['isAuthenticated'](),controller[_0x28a3('0x12')]);router['delete'](_0x28a3('0xc'),auth[_0x28a3('0x7')](),controller[_0x28a3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x379e=['/:id','show','download','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe'];(function(_0x160148,_0x5c0639){var _0x5d4a2c=function(_0x4e4317){while(--_0x4e4317){_0x160148['push'](_0x160148['shift']());}};_0x5d4a2c(++_0x5c0639);}(_0x379e,0x1a2));var _0xe379=function(_0x44ff6b,_0x13d8e9){_0x44ff6b=_0x44ff6b-0x0;var _0x402226=_0x379e[_0x44ff6b];return _0x402226;};'use strict';var multer=require(_0xe379('0x0'));var util=require(_0xe379('0x1'));var path=require('path');var timeout=require(_0xe379('0x2'));var express=require(_0xe379('0x3'));var router=express[_0xe379('0x4')]();var fs_extra=require(_0xe379('0x5'));var auth=require(_0xe379('0x6'));var interaction=require(_0xe379('0x7'));var config=require(_0xe379('0x8'));var controller=require(_0xe379('0x9'));router[_0xe379('0xa')]('/',auth[_0xe379('0xb')](),controller[_0xe379('0xc')]);router[_0xe379('0xa')]('/describe',auth[_0xe379('0xb')](),controller[_0xe379('0xd')]);router[_0xe379('0xa')](_0xe379('0xe'),auth[_0xe379('0xb')](),controller[_0xe379('0xf')]);router[_0xe379('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe379('0x10')]);router[_0xe379('0x11')]('/',auth[_0xe379('0xb')](),controller[_0xe379('0x12')]);router[_0xe379('0x13')](_0xe379('0xe'),auth[_0xe379('0xb')](),controller[_0xe379('0x14')]);router[_0xe379('0x15')](_0xe379('0xe'),auth['isAuthenticated'](),controller[_0xe379('0x16')]);module[_0xe379('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index f073295..be16d48 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 _0xa5c1=['extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','VIRTUAL','value'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x2c86d6,_0x237dd3){_0x2c86d6=_0x2c86d6-0x0;var _0x4a776c=_0xa5c1[_0x2c86d6];return _0x4a776c;};'use strict';var Sequelize=require(_0x1a5c('0x0'));var moment=require(_0x1a5c('0x1'));var path=require(_0x1a5c('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x1a5c('0x3')],'get':function(){return this['getDataValue'](_0x1a5c('0x4'))?path[_0x1a5c('0x5')](this[_0x1a5c('0x6')](_0x1a5c('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x1a5c('0x7')]},'channel':{'type':Sequelize[_0x1a5c('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x9853){var _0x580a2e=_0x9853[_0x1a5c('0x8')](/\\/g,'/');this[_0x1a5c('0x9')](_0x1a5c('0x4'),_0x580a2e);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x1a5c('0xa')],'set':function(_0x4c0bd2){this[_0x1a5c('0x9')](_0x1a5c('0xb'),moment()['subtract'](_0x4c0bd2,'ms'));this[_0x1a5c('0x9')](_0x1a5c('0xc'),moment());this['setDataValue'](_0x1a5c('0xd'),_0x4c0bd2);}},'startedAt':{'type':Sequelize[_0x1a5c('0xe')],'get':function(){return moment(this[_0x1a5c('0x6')](_0x1a5c('0xb')))[_0x1a5c('0xf')](_0x1a5c('0x10'))[_0x1a5c('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1a5c('0x6')](_0x1a5c('0xc')))['format'](_0x1a5c('0x10'))[_0x1a5c('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1a5c('0x6')](_0x1a5c('0x12')))[_0x1a5c('0xf')](_0x1a5c('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0x1a5c('0xe')],'get':function(){return moment(this['getDataValue'](_0x1a5c('0x13')))[_0x1a5c('0xf')](_0x1a5c('0x10'))['toString']();}}}; \ No newline at end of file +var _0x4d5a=['STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname'];(function(_0x312885,_0x4222f3){var _0x42415e=function(_0x580c61){while(--_0x580c61){_0x312885['push'](_0x312885['shift']());}};_0x42415e(++_0x4222f3);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4d5a[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa4d5('0x0'));var path=require(_0xa4d5('0x1'));var config=require(_0xa4d5('0x2'));module['exports']={'format':{'type':Sequelize[_0xa4d5('0x3')],'get':function(){return this[_0xa4d5('0x4')](_0xa4d5('0x5'))?path[_0xa4d5('0x6')](this['getDataValue'](_0xa4d5('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa4d5('0x7')],'set':function(_0x1856aa){var _0x166db3=_0x1856aa[_0xa4d5('0x8')](/\\/g,'/');this[_0xa4d5('0x9')](_0xa4d5('0x5'),_0x166db3);}},'rating':{'type':Sequelize[_0xa4d5('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5586de){this[_0xa4d5('0x9')](_0xa4d5('0xb'),moment()[_0xa4d5('0xc')](_0x5586de,'ms'));this[_0xa4d5('0x9')](_0xa4d5('0xd'),moment());this[_0xa4d5('0x9')](_0xa4d5('0xe'),_0x5586de);}},'startedAt':{'type':Sequelize[_0xa4d5('0xf')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0xa4d5('0x10')](_0xa4d5('0x11'))[_0xa4d5('0x12')]();}},'closedAt':{'type':Sequelize[_0xa4d5('0xf')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0xa4d5('0x10')](_0xa4d5('0x11'))[_0xa4d5('0x12')]();}},'createdAt':{'type':Sequelize[_0xa4d5('0xf')],'get':function(){return moment(this[_0xa4d5('0x4')](_0xa4d5('0x13')))['format']('MM-DD-YYYY\x20HH:mm')[_0xa4d5('0x12')]();}},'updatedAt':{'type':Sequelize[_0xa4d5('0xf')],'get':function(){return moment(this['getDataValue'](_0xa4d5('0x14')))[_0xa4d5('0x10')](_0xa4d5('0x11'))[_0xa4d5('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 5b09a03..98fdbec 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 _0xabce=['sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','include','rows','includeAll','find','catch','create','body','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','recording','join','root','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','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'];(function(_0x2141ee,_0x4181e5){var _0x5bdc07=function(_0x44df7a){while(--_0x44df7a){_0x2141ee['push'](_0x2141ee['shift']());}};_0x5bdc07(++_0x4181e5);}(_0xabce,0x103));var _0xeabc=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xabce[_0x134c2e];return _0x2825db;};'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(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}exports[_0xeabc('0x2a')]=function(_0x48fb52,_0x2163e6){var _0x38572d={},_0x2b568f={},_0x2f8633={'count':0x0,'rows':[]};var _0x149170=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')],function(_0x2915c1){return{'name':_0x2915c1['fieldName'],'type':_0x2915c1[_0xeabc('0x2e')]['key']};});_0x2b568f[_0xeabc('0x2f')]=_[_0xeabc('0x30')](_[_0xeabc('0x2b')](_0x149170,_0xeabc('0x28')),[_0xeabc('0x31')]);_0x2b568f[_0xeabc('0x32')]=_[_0xeabc('0x33')](_0x48fb52['query']);_0x2b568f[_0xeabc('0x34')]=_[_0xeabc('0x35')](_0x2b568f[_0xeabc('0x2f')],_0x2b568f['query']);_0x38572d[_0xeabc('0x36')]=_[_0xeabc('0x35')](_0x2b568f[_0xeabc('0x2f')],qs['fields'](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x37')]));_0x38572d[_0xeabc('0x36')]=_0x38572d['attributes'][_0xeabc('0x38')]?_0x38572d[_0xeabc('0x36')]:_0x2b568f['model'];if(!_0x48fb52['query'][_0xeabc('0x39')](_0xeabc('0x3a'))){_0x38572d['limit']=qs[_0xeabc('0x1d')](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x1d')]);_0x38572d[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x48fb52['query'][_0xeabc('0x1f')]);}_0x38572d['order']=qs[_0xeabc('0x3b')](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x3b')]);_0x38572d['where']=qs['filters'](_[_0xeabc('0x3c')](_0x48fb52['query'],_0x2b568f[_0xeabc('0x34')]),_0x149170);if(_0x48fb52['query']['filter']){_0x38572d['where']=_['merge'](_0x38572d[_0xeabc('0x3d')],{'$or':_['map'](_0x149170,function(_0x257fe8){if(_0x257fe8[_0xeabc('0x2e')]!=='VIRTUAL'){var _0xe8fa6e={};_0xe8fa6e[_0x257fe8['name']]={'$like':'%'+_0x48fb52[_0xeabc('0x32')]['filter']+'%'};return _0xe8fa6e;}})});}_0x38572d=_[_0xeabc('0x3e')]({},_0x38572d,_0x48fb52[_0xeabc('0x3f')]);var _0xeeef02={'where':_0x38572d['where']};return db['ScreenRecording']['count'](_0xeeef02)[_0xeabc('0x25')](function(_0x23fb33){_0x2f8633[_0xeabc('0x1e')]=_0x23fb33;if(_0x48fb52['query']['includeAll']){_0x38572d[_0xeabc('0x40')]=[{'all':!![]}];}return db[_0xeabc('0x2c')]['findAll'](_0x38572d);})[_0xeabc('0x25')](function(_0x5e0b78){_0x2f8633[_0xeabc('0x41')]=_0x5e0b78;return _0x2f8633;})['then'](respondWithFilteredResult(_0x2163e6,_0x38572d))['catch'](handleError(_0x2163e6,null));};exports['show']=function(_0x25958b,_0x37c926){var _0xd03226={'raw':![],'where':{'id':_0x25958b['params']['id']}},_0x3eeeb5={};_0x3eeeb5[_0xeabc('0x2f')]=_['keys'](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x3eeeb5[_0xeabc('0x32')]=_[_0xeabc('0x33')](_0x25958b[_0xeabc('0x32')]);_0x3eeeb5['filters']=_['intersection'](_0x3eeeb5[_0xeabc('0x2f')],_0x3eeeb5['query']);_0xd03226[_0xeabc('0x36')]=_[_0xeabc('0x35')](_0x3eeeb5['model'],qs[_0xeabc('0x37')](_0x25958b[_0xeabc('0x32')][_0xeabc('0x37')]));_0xd03226[_0xeabc('0x36')]=_0xd03226[_0xeabc('0x36')][_0xeabc('0x38')]?_0xd03226[_0xeabc('0x36')]:_0x3eeeb5['model'];if(_0x25958b[_0xeabc('0x32')][_0xeabc('0x42')]){_0xd03226[_0xeabc('0x40')]=[{'all':!![]}];}_0xd03226=_[_0xeabc('0x3e')]({},_0xd03226,_0x25958b[_0xeabc('0x3f')]);return db[_0xeabc('0x2c')][_0xeabc('0x43')](_0xd03226)[_0xeabc('0x25')](handleEntityNotFound(_0x37c926,null))[_0xeabc('0x25')](respondWithResult(_0x37c926,null))[_0xeabc('0x44')](handleError(_0x37c926,null));};exports['create']=function(_0x38356c,_0x2e6efb){return db[_0xeabc('0x2c')][_0xeabc('0x45')](_0x38356c[_0xeabc('0x46')],{})[_0xeabc('0x25')](respondWithResult(_0x2e6efb,0xc9))[_0xeabc('0x44')](handleError(_0x2e6efb,null));};exports['update']=function(_0x766743,_0x32e09b){if(_0x766743[_0xeabc('0x46')]['id']){delete _0x766743[_0xeabc('0x46')]['id'];}delete _0x766743[_0xeabc('0x46')]['duration'];delete _0x766743[_0xeabc('0x46')][_0xeabc('0x47')];delete _0x766743[_0xeabc('0x46')][_0xeabc('0x48')];delete _0x766743['body'][_0xeabc('0x49')];return db[_0xeabc('0x2c')]['find']({'where':{'id':_0x766743[_0xeabc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32e09b,null))[_0xeabc('0x25')](saveUpdates(_0x766743['body'],null))[_0xeabc('0x25')](respondWithResult(_0x32e09b,null))[_0xeabc('0x44')](handleError(_0x32e09b,null));};exports[_0xeabc('0x4b')]=function(_0x1524c3,_0x1ee837){return db[_0xeabc('0x2c')][_0xeabc('0x4b')]()[_0xeabc('0x25')](respondWithResult(_0x1ee837,null))[_0xeabc('0x44')](handleError(_0x1ee837,null));};exports[_0xeabc('0x4c')]=function(_0x48a13f,_0x180a14,_0x2537ab){var _0x4072cb=require(_0xeabc('0x4d'));var _0x555d6b=![];var _0x1cef45={};if(_0x48a13f[_0xeabc('0x32')][_0xeabc('0x2e')]&&_0x48a13f[_0xeabc('0x32')]['type']===_0xeabc('0x4e')){_0x1cef45[_0xeabc('0x4e')]=_0x48a13f[_0xeabc('0x4a')]['id'];}else{_0x1cef45['id']=_0x48a13f[_0xeabc('0x4a')]['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x43')]({'where':_0x1cef45,'attributes':['id',_0xeabc('0x49')],'raw':!![]})[_0xeabc('0x25')](handleEntityNotFound(_0x180a14,null))[_0xeabc('0x25')](function(_0x58ab08){if(_0x58ab08){var _0x4546c4=path['join'](config['root'],'server/files/screen_recordings',_0x58ab08[_0xeabc('0x49')]);var _0x8d4cca=util[_0xeabc('0x31')](_0xeabc('0x4f'),_0x4546c4);if(fs[_0xeabc('0x50')](_0x8d4cca)){_0x555d6b=!![];return _0x4072cb[_0xeabc('0x51')](_0x8d4cca,_0x4546c4,config['secrets'][_0xeabc('0x52')])[_0xeabc('0x25')](function(){return _0x58ab08;});}return _0x58ab08;}})[_0xeabc('0x25')](function(_0x104c1e){if(_0x104c1e){var _0x2ddc53=path[_0xeabc('0x53')](config[_0xeabc('0x54')],_0xeabc('0x55'),_0x104c1e['value']);if(!fs['existsSync'](_0x2ddc53)){throw new db[(_0xeabc('0x56'))][(_0xeabc('0x57'))](_0xeabc('0x58'));}if(_0x104c1e['filename']){return _0x180a14[_0xeabc('0x4c')](_0x2ddc53,_0x104c1e['filename']+path['extname'](_0x2ddc53),function(){if(_0x555d6b){fs[_0xeabc('0x59')](_0x2ddc53);}});}else{return _0x180a14[_0xeabc('0x4c')](_0x2ddc53,function(_0x13f04f){if(_0x555d6b){fs[_0xeabc('0x59')](_0x2ddc53);}});}}})[_0xeabc('0x44')](function(_0xc2ef0c){if(_0xc2ef0c['message']===_0xeabc('0x58')){_0x180a14[_0xeabc('0x1a')](0x194)[_0xeabc('0x29')](_0xeabc('0x5a'));}else{return handleError(_0x180a14,null);}});};exports[_0xeabc('0x5b')]=function(_0x514787,_0x5c61b4){return db[_0xeabc('0x2c')][_0xeabc('0x43')]({'where':{'id':_0x514787[_0xeabc('0x4a')]['id']}})[_0xeabc('0x25')](function(_0x1b61a8){if(_[_0xeabc('0x5c')](_0x1b61a8)){throw new ReferenceError(_0xeabc('0x5d'));}return _0x1b61a8;})[_0xeabc('0x25')](function(_0x3f829b){var _0x54d2b3=path[_0xeabc('0x53')](config['root'],_0xeabc('0x55'),_0x3f829b[_0xeabc('0x49')]);logger[_0xeabc('0x5e')](_0xeabc('0x5f'),_0x54d2b3);if(!_[_0xeabc('0x5c')](_0x3f829b[_0xeabc('0x49')])&&fs[_0xeabc('0x50')](_0x54d2b3)){logger[_0xeabc('0x5e')](_0xeabc('0x60')+_0x54d2b3+_0xeabc('0x61'));fs['unlinkSync'](_0x54d2b3);}_0x54d2b3=_0x54d2b3+_0xeabc('0x62');if(!_[_0xeabc('0x5c')](_0x3f829b[_0xeabc('0x49')])&&fs[_0xeabc('0x50')](_0x54d2b3)){logger['info'](_0xeabc('0x60')+_0x54d2b3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x54d2b3);}return _0x3f829b;})[_0xeabc('0x25')](function(_0x11bc62){if(!_0x11bc62)throw new InternalError();return _0x11bc62[_0xeabc('0x5b')]();})[_0xeabc('0x25')](function(){_0x5c61b4['status'](0xcc)['end']();})[_0xeabc('0x44')](handleError(_0x5c61b4,null));}; \ No newline at end of file +var _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x771e63,_0x5e93c7){var _0xfa2bc8=function(_0x593325){while(--_0x593325){_0x771e63['push'](_0x771e63['shift']());}};_0xfa2bc8(++_0x5e93c7);}(_0x33c5,0xe6));var _0x533c=function(_0x3b7cc9,_0x18cd9b){_0x3b7cc9=_0x3b7cc9-0x0;var _0x5751ea=_0x33c5[_0x3b7cc9];return _0x5751ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 381bf73..829e90f 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 _0xbca7=['rimraf','../../config/environment','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5db569,_0x25707b){var _0x247b44=function(_0x4b7dfd){while(--_0x4b7dfd){_0x5db569['push'](_0x5db569['shift']());}};_0x247b44(++_0x25707b);}(_0xbca7,0x1b6));var _0x7bca=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xbca7[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x7bca('0x0'));var util=require(_0x7bca('0x1'));var logger=require(_0x7bca('0x2'))(_0x7bca('0x3'));var moment=require(_0x7bca('0x4'));var BPromise=require(_0x7bca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7bca('0x6'));var config=require(_0x7bca('0x7'));var attributes=require('./screenRecording.attributes');module[_0x7bca('0x8')]=function(_0x1393de,_0x4f4d37){return _0x1393de[_0x7bca('0x9')]('ScreenRecording',attributes,{'tableName':_0x7bca('0xa'),'paranoid':![],'indexes':[{'name':_0x7bca('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6df6=['./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2bf861,_0x2e9ccd){var _0x468d8b=function(_0x2051b9){while(--_0x2051b9){_0x2bf861['push'](_0x2bf861['shift']());}};_0x468d8b(++_0x2e9ccd);}(_0x6df6,0xa0));var _0x66df=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0x6df6[_0x133277];return _0x5b4a22;};'use strict';var _=require(_0x66df('0x0'));var util=require(_0x66df('0x1'));var logger=require(_0x66df('0x2'))(_0x66df('0x3'));var moment=require(_0x66df('0x4'));var BPromise=require(_0x66df('0x5'));var rp=require(_0x66df('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66df('0x7'));var config=require(_0x66df('0x8'));var attributes=require(_0x66df('0x9'));module[_0x66df('0xa')]=function(_0x1abe5c,_0x22ce37){return _0x1abe5c['define']('ScreenRecording',attributes,{'tableName':_0x66df('0xb'),'paranoid':![],'indexes':[{'name':_0x66df('0xc'),'fields':[_0x66df('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index c11733c..246e40b 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 _0x92a1=['stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x5ee4ec,_0x2b5aad){var _0x27fa20=function(_0x59fbd4){while(--_0x59fbd4){_0x5ee4ec['push'](_0x5ee4ec['shift']());}};_0x27fa20(++_0x2b5aad);}(_0x92a1,0x66));var _0x192a=function(_0x29caf2,_0x21e2fb){_0x29caf2=_0x29caf2-0x0;var _0x31d5f4=_0x92a1[_0x29caf2];return _0x31d5f4;};'use strict';var _=require(_0x192a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x192a('0x1'));var rs=require(_0x192a('0x2'));var fs=require('fs');var Redis=require(_0x192a('0x3'));var db=require(_0x192a('0x4'))['db'];var utils=require(_0x192a('0x5'));var logger=require(_0x192a('0x6'))(_0x192a('0x7'));var config=require(_0x192a('0x8'));var jayson=require(_0x192a('0x9'));var client=jayson[_0x192a('0xa')][_0x192a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ef9f4,_0x46ccd3,_0x1db69b){return new BPromise(function(_0x1a6ef6,_0x11f441){return client[_0x192a('0xc')](_0x3ef9f4,_0x1db69b)['then'](function(_0x2ed04e){logger[_0x192a('0xd')](_0x192a('0xe'),_0x46ccd3,_0x192a('0xf'));logger[_0x192a('0x10')](_0x192a('0x11'),_0x46ccd3,_0x192a('0xf'),JSON[_0x192a('0x12')](_0x2ed04e));if(_0x2ed04e[_0x192a('0x13')]){if(_0x2ed04e['error'][_0x192a('0x14')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x46ccd3,_0x2ed04e[_0x192a('0x13')][_0x192a('0x15')]);return _0x11f441(_0x2ed04e[_0x192a('0x13')][_0x192a('0x15')]);}logger[_0x192a('0x13')](_0x192a('0xe'),_0x46ccd3,_0x2ed04e['error']['message']);return _0x1a6ef6(_0x2ed04e['error'][_0x192a('0x15')]);}else{logger[_0x192a('0xd')](_0x192a('0xe'),_0x46ccd3,_0x192a('0xf'));_0x1a6ef6(_0x2ed04e[_0x192a('0x16')]['message']);}})[_0x192a('0x17')](function(_0x16d55c){logger['error'](_0x192a('0xe'),_0x46ccd3,_0x16d55c);_0x11f441(_0x16d55c);});});} \ No newline at end of file +var _0xfd76=['debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x5d0755,_0x5dd13b){var _0x6565ba=function(_0x84e65b){while(--_0x84e65b){_0x5d0755['push'](_0x5d0755['shift']());}};_0x6565ba(++_0x5dd13b);}(_0xfd76,0x6c));var _0x6fd7=function(_0x58e61e,_0x43f377){_0x58e61e=_0x58e61e-0x0;var _0x40fecd=_0xfd76[_0x58e61e];return _0x40fecd;};'use strict';var _=require(_0x6fd7('0x0'));var util=require('util');var moment=require(_0x6fd7('0x1'));var BPromise=require(_0x6fd7('0x2'));var rs=require(_0x6fd7('0x3'));var fs=require('fs');var Redis=require(_0x6fd7('0x4'));var db=require(_0x6fd7('0x5'))['db'];var utils=require(_0x6fd7('0x6'));var logger=require(_0x6fd7('0x7'))(_0x6fd7('0x8'));var config=require(_0x6fd7('0x9'));var jayson=require(_0x6fd7('0xa'));var client=jayson[_0x6fd7('0xb')][_0x6fd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55c3f8,_0x34b58b,_0x33adb8){return new BPromise(function(_0x248812,_0x47b140){return client['request'](_0x55c3f8,_0x33adb8)[_0x6fd7('0xd')](function(_0x521187){logger[_0x6fd7('0xe')](_0x6fd7('0xf'),_0x34b58b,_0x6fd7('0x10'));logger[_0x6fd7('0x11')](_0x6fd7('0x12'),_0x34b58b,_0x6fd7('0x10'),JSON[_0x6fd7('0x13')](_0x521187));if(_0x521187['error']){if(_0x521187[_0x6fd7('0x14')][_0x6fd7('0x15')]===0x1f4){logger['error'](_0x6fd7('0xf'),_0x34b58b,_0x521187[_0x6fd7('0x14')][_0x6fd7('0x16')]);return _0x47b140(_0x521187[_0x6fd7('0x14')][_0x6fd7('0x16')]);}logger[_0x6fd7('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x34b58b,_0x521187['error'][_0x6fd7('0x16')]);return _0x248812(_0x521187[_0x6fd7('0x14')][_0x6fd7('0x16')]);}else{logger[_0x6fd7('0xe')](_0x6fd7('0xf'),_0x34b58b,_0x6fd7('0x10'));_0x248812(_0x521187[_0x6fd7('0x17')][_0x6fd7('0x16')]);}})[_0x6fd7('0x18')](function(_0xa23d33){logger['error'](_0x6fd7('0xf'),_0x34b58b,_0xa23d33);_0x47b140(_0xa23d33);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 46868a3..c4a25be 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 _0x0090=['post','/:id/logo','single','file','addLogo','diskStorage','format','addLogoLogin','addPreferred','favicon','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','%s%s','extname','originalname'];(function(_0x2ac25a,_0x57b18c){var _0x426691=function(_0x21ad41){while(--_0x21ad41){_0x2ac25a['push'](_0x2ac25a['shift']());}};_0x426691(++_0x57b18c);}(_0x0090,0x87));var _0x0009=function(_0x2aca0c,_0x5ad758){_0x2aca0c=_0x2aca0c-0x0;var _0x4add1d=_0x0090[_0x2aca0c];return _0x4add1d;};'use strict';var multer=require(_0x0009('0x0'));var util=require('util');var path=require(_0x0009('0x1'));var timeout=require(_0x0009('0x2'));var express=require('express');var router=express[_0x0009('0x3')]();var fs_extra=require(_0x0009('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0009('0x5'));var config=require(_0x0009('0x6'));var controller=require(_0x0009('0x7'));router['get']('/',auth[_0x0009('0x8')](),controller[_0x0009('0x9')]);router[_0x0009('0xa')](_0x0009('0xb'),controller[_0x0009('0xc')]);router[_0x0009('0xa')](_0x0009('0xd'),controller[_0x0009('0xe')]);router[_0x0009('0xa')]('/:id/logo',controller[_0x0009('0xf')]);router[_0x0009('0xa')]('/:id/logo_login',controller[_0x0009('0x10')]);router['get'](_0x0009('0x11'),controller[_0x0009('0x12')]);router['get'](_0x0009('0x13'),controller[_0x0009('0x14')]);router['get'](_0x0009('0x15'),controller[_0x0009('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15ab04,_0x7b8e05,_0x3277b9){_0x3277b9(null,path[_0x0009('0x17')](config[_0x0009('0x18')],_0x0009('0x19')));},'filename':function(_0x298368,_0x3d4f50,_0x5ea5a1){_0x5ea5a1(null,util['format'](_0x0009('0x1a'),'logo',path[_0x0009('0x1b')](_0x3d4f50[_0x0009('0x1c')])));}})});router[_0x0009('0x1d')](_0x0009('0x1e'),upload[_0x0009('0x1f')](_0x0009('0x20')),controller[_0x0009('0x21')]);var upload=multer({'storage':multer[_0x0009('0x22')]({'destination':function(_0x3a56e3,_0x3bff4f,_0xc780f6){_0xc780f6(null,path[_0x0009('0x17')](config['root'],_0x0009('0x19')));},'filename':function(_0x24aa3a,_0x493113,_0x5d5c1a){_0x5d5c1a(null,util[_0x0009('0x23')](_0x0009('0x1a'),'logologin',path[_0x0009('0x1b')](_0x493113['originalname'])));}})});router['post']('/:id/logo_login',upload[_0x0009('0x1f')](_0x0009('0x20')),controller[_0x0009('0x24')]);var upload=multer({'storage':multer[_0x0009('0x22')]({'destination':function(_0x444a8a,_0x578357,_0x20bdc5){_0x20bdc5(null,path['join'](config[_0x0009('0x18')],'server/files/images/logos/'));},'filename':function(_0x49a243,_0x2c6bcb,_0x4076e6){_0x4076e6(null,util[_0x0009('0x23')]('%s%s','preferred',path[_0x0009('0x1b')](_0x2c6bcb[_0x0009('0x1c')])));}})});router[_0x0009('0x1d')](_0x0009('0x13'),upload[_0x0009('0x1f')](_0x0009('0x20')),controller[_0x0009('0x25')]);var upload=multer({'storage':multer[_0x0009('0x22')]({'destination':function(_0x30dfc7,_0x206eea,_0x21bff1){_0x21bff1(null,path['join'](config[_0x0009('0x18')],_0x0009('0x19')));},'filename':function(_0x305d2e,_0x169a1d,_0x4ec4b8){_0x4ec4b8(null,util[_0x0009('0x23')]('%s%s',_0x0009('0x26'),path['extname'](_0x169a1d[_0x0009('0x1c')])));}})});router[_0x0009('0x1d')]('/:id/favicon',upload[_0x0009('0x1f')](_0x0009('0x20')),controller['addFavicon']);router['put']('/:id',auth[_0x0009('0x8')](),controller[_0x0009('0x27')]);module[_0x0009('0x28')]=router; \ No newline at end of file +var _0x2393=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','file','format','addLogoLogin','preferred','/:id/preferred','addPreferred','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router'];(function(_0x39b1bd,_0x554c9f){var _0x1dfb46=function(_0x4a15de){while(--_0x4a15de){_0x39b1bd['push'](_0x39b1bd['shift']());}};_0x1dfb46(++_0x554c9f);}(_0x2393,0x113));var _0x3239=function(_0x29ebb8,_0x51d0d8){_0x29ebb8=_0x29ebb8-0x0;var _0x10c623=_0x2393[_0x29ebb8];return _0x10c623;};'use strict';var multer=require(_0x3239('0x0'));var util=require('util');var path=require(_0x3239('0x1'));var timeout=require(_0x3239('0x2'));var express=require(_0x3239('0x3'));var router=express[_0x3239('0x4')]();var fs_extra=require(_0x3239('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3239('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x3239('0x7')]('/',auth[_0x3239('0x8')](),controller[_0x3239('0x9')]);router[_0x3239('0x7')](_0x3239('0xa'),controller['getDate']);router[_0x3239('0x7')](_0x3239('0xb'),controller[_0x3239('0xc')]);router[_0x3239('0x7')](_0x3239('0xd'),controller[_0x3239('0xe')]);router[_0x3239('0x7')](_0x3239('0xf'),controller['getLogoLogin']);router[_0x3239('0x7')]('/:id/gdpr',controller[_0x3239('0x10')]);router[_0x3239('0x7')]('/:id/preferred',controller[_0x3239('0x11')]);router[_0x3239('0x7')](_0x3239('0x12'),controller[_0x3239('0x13')]);var upload=multer({'storage':multer[_0x3239('0x14')]({'destination':function(_0x33f857,_0x2d146b,_0x35dbad){_0x35dbad(null,path[_0x3239('0x15')](config[_0x3239('0x16')],_0x3239('0x17')));},'filename':function(_0xa68949,_0x522aaf,_0x15a0ef){_0x15a0ef(null,util['format'](_0x3239('0x18'),_0x3239('0x19'),path[_0x3239('0x1a')](_0x522aaf[_0x3239('0x1b')])));}})});router[_0x3239('0x1c')](_0x3239('0xd'),upload[_0x3239('0x1d')](_0x3239('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0x3239('0x14')]({'destination':function(_0x5d5847,_0x37793e,_0xf1332f){_0xf1332f(null,path[_0x3239('0x15')](config['root'],'server/files/images/logos/'));},'filename':function(_0x2b8992,_0x3edb5c,_0x2ac326){_0x2ac326(null,util[_0x3239('0x1f')](_0x3239('0x18'),'logologin',path[_0x3239('0x1a')](_0x3edb5c['originalname'])));}})});router[_0x3239('0x1c')](_0x3239('0xf'),upload[_0x3239('0x1d')](_0x3239('0x1e')),controller[_0x3239('0x20')]);var upload=multer({'storage':multer[_0x3239('0x14')]({'destination':function(_0xf7c836,_0x325472,_0x4c1220){_0x4c1220(null,path[_0x3239('0x15')](config['root'],_0x3239('0x17')));},'filename':function(_0x33e92d,_0x143630,_0x2b60bf){_0x2b60bf(null,util[_0x3239('0x1f')]('%s%s',_0x3239('0x21'),path['extname'](_0x143630[_0x3239('0x1b')])));}})});router[_0x3239('0x1c')](_0x3239('0x22'),upload['single']('file'),controller[_0x3239('0x23')]);var upload=multer({'storage':multer[_0x3239('0x14')]({'destination':function(_0x5f5627,_0x55a035,_0x1e9bd7){_0x1e9bd7(null,path['join'](config[_0x3239('0x16')],_0x3239('0x17')));},'filename':function(_0x1f7702,_0x4b09ed,_0x44afa0){_0x44afa0(null,util['format'](_0x3239('0x18'),'favicon',path[_0x3239('0x1a')](_0x4b09ed[_0x3239('0x1b')])));}})});router['post'](_0x3239('0x12'),upload[_0x3239('0x1d')](_0x3239('0x1e')),controller[_0x3239('0x24')]);router[_0x3239('0x25')](_0x3239('0xb'),auth[_0x3239('0x8')](),controller[_0x3239('0x26')]);module[_0x3239('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e320c66..a0625bf 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(_0x4db5ce,_0x4090d6){var _0x5ef7f8=function(_0x73c789){while(--_0x73c789){_0x4db5ce['push'](_0x4db5ce['shift']());}};_0x5ef7f8(++_0x4090d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x87d3ea,_0x1e94e1){var _0x34dbfb=function(_0xe45088){while(--_0xe45088){_0x87d3ea['push'](_0x87d3ea['shift']());}};_0x34dbfb(++_0x1e94e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 8c8ba12..cc8c091 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 _0x6737=['ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','stack','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','show','Setting','body','find','params','addLogo','file','filename','addLogoLogin','getLogo','logo','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','\x20not\x20found','download','server/files/images/logos','getLicense','preferred','favicon','loginLogo','default_loginLogo.svg','Sequelize','ValidationError','gdpr','securePassword','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x6737,0xe2));var _0x7673=function(_0x1b5145,_0x3278b7){_0x1b5145=_0x1b5145-0x0;var _0x2d84ff=_0x6737[_0x1b5145];return _0x2d84ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7673('0x0'));var zipdir=require(_0x7673('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7673('0x2'));var moment=require(_0x7673('0x3'));var BPromise=require(_0x7673('0x4'));var Mustache=require(_0x7673('0x5'));var util=require('util');var path=require(_0x7673('0x6'));var sox=require(_0x7673('0x7'));var csv=require('to-csv');var ejs=require(_0x7673('0x8'));var fs=require('fs');var fs_extra=require(_0x7673('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7673('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7673('0xb'));var Papa=require(_0x7673('0xc'));var Redis=require('ioredis');var authService=require(_0x7673('0xd'));var qs=require(_0x7673('0xe'));var as=require(_0x7673('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7673('0x10'));var utils=require('../../config/utils');var config=require(_0x7673('0x11'));var licenseUtil=require(_0x7673('0x12'));var db=require(_0x7673('0x13'))['db'];var jayson=require(_0x7673('0x14'));var client=jayson[_0x7673('0x15')][_0x7673('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x1c57a5,_0x457ffe,_0x1da115,_0x20a649){return new BPromise(function(_0x5c8626,_0x26f0c4){var _0x4738bd=_0x20a649||client;return _0x4738bd[_0x7673('0x17')](_0x1c57a5,_0x1da115)[_0x7673('0x18')](function(_0x224cea){logger[_0x7673('0x19')](_0x7673('0x1a'),_0x457ffe,'request\x20sent');logger['debug'](_0x7673('0x1b'),_0x457ffe,_0x7673('0x1c'),JSON['stringify'](_0x224cea));if(_0x224cea[_0x7673('0x1d')]){if(_0x224cea[_0x7673('0x1d')]['code']===0x1f4){logger[_0x7673('0x1d')](_0x7673('0x1a'),_0x457ffe,_0x224cea[_0x7673('0x1d')]['message']);return _0x26f0c4(_0x224cea['error'][_0x7673('0x1e')]);}logger[_0x7673('0x1d')]('Setting,\x20%s,\x20%s',_0x457ffe,_0x224cea[_0x7673('0x1d')][_0x7673('0x1e')]);return _0x5c8626(_0x224cea[_0x7673('0x1d')][_0x7673('0x1e')]);}else{logger[_0x7673('0x19')](_0x7673('0x1a'),_0x457ffe,'request\x20sent');_0x5c8626(_0x224cea['result'][_0x7673('0x1e')]);}})[_0x7673('0x1f')](function(_0x12bdea){logger[_0x7673('0x1d')](_0x7673('0x1a'),_0x457ffe,_0x12bdea);_0x26f0c4(_0x12bdea);});});}function respondWithStatusCode(_0x54f38d,_0x2009e1){_0x2009e1=_0x2009e1||0xcc;return function(_0x3b2a75){if(_0x3b2a75){return _0x54f38d[_0x7673('0x20')](_0x2009e1);}return _0x54f38d[_0x7673('0x21')](_0x2009e1)[_0x7673('0x22')]();};}function respondWithResult(_0x30c42e,_0x538280){_0x538280=_0x538280||0xc8;return function(_0x14e3ed){if(_0x14e3ed){return _0x30c42e[_0x7673('0x21')](_0x538280)[_0x7673('0x23')](_0x14e3ed);}};}function respondWithFilteredResult(_0x191bf4,_0x5a98fe){return function(_0x5e2cd7){if(_0x5e2cd7){var _0x16f35e=typeof _0x5a98fe[_0x7673('0x24')]===_0x7673('0x25')&&typeof _0x5a98fe[_0x7673('0x26')]===_0x7673('0x25');var _0x45a045=_0x5e2cd7[_0x7673('0x27')];var _0x5a59f9=_0x16f35e?0x0:_0x5a98fe['offset'];var _0x341f9e=_0x16f35e?_0x5e2cd7[_0x7673('0x27')]:_0x5a98fe[_0x7673('0x24')]+_0x5a98fe[_0x7673('0x26')];var _0x12ac6b;if(_0x341f9e>=_0x45a045){_0x341f9e=_0x45a045;_0x12ac6b=0xc8;}else{_0x12ac6b=0xce;}_0x191bf4[_0x7673('0x21')](_0x12ac6b);return _0x191bf4[_0x7673('0x28')]('Content-Range',_0x5a59f9+'-'+_0x341f9e+'/'+_0x45a045)['json'](_0x5e2cd7);}return null;};}function patchUpdates(_0xe7e528){return function(_0x36c841){try{jsonpatch[_0x7673('0x29')](_0x36c841,_0xe7e528,!![]);}catch(_0xf5097a){return BPromise['reject'](_0xf5097a);}return _0x36c841[_0x7673('0x2a')]();};}function saveUpdates(_0x497760,_0x15f6a7){return function(_0x139717){if(_0x139717){return _0x139717[_0x7673('0x2b')](_0x497760)[_0x7673('0x18')](function(_0x2be805){return _0x2be805;});}return null;};}function removeEntity(_0x380282,_0x2cb973){return function(_0xc13d6){if(_0xc13d6){return _0xc13d6[_0x7673('0x2c')]()[_0x7673('0x18')](function(){_0x380282[_0x7673('0x21')](0xcc)[_0x7673('0x22')]();});}};}function handleEntityNotFound(_0x26cccd,_0x485b39){return function(_0x32ee3d){if(!_0x32ee3d){_0x26cccd[_0x7673('0x20')](0x194);}return _0x32ee3d;};}function handleError(_0x417c83,_0x215f81){_0x215f81=_0x215f81||0x1f4;return function(_0x30ddec){logger[_0x7673('0x1d')](_0x30ddec[_0x7673('0x2d')]);if(_0x30ddec['name']){delete _0x30ddec['name'];}_0x417c83[_0x7673('0x21')](_0x215f81)[_0x7673('0x2e')](_0x30ddec);};}exports[_0x7673('0x2f')]=function(_0x36d77a,_0x78fecd){var _0x101e03={},_0x159afd={},_0x47c9a3={'count':0x0,'rows':[]};var _0x2845f6=_[_0x7673('0x30')](db['Setting'][_0x7673('0x31')],function(_0x400f3c){return{'name':_0x400f3c[_0x7673('0x32')],'type':_0x400f3c[_0x7673('0x33')]['key']};});_0x159afd[_0x7673('0x34')]=_[_0x7673('0x30')](_0x2845f6,'name');_0x159afd[_0x7673('0x35')]=_[_0x7673('0x36')](_0x36d77a[_0x7673('0x35')]);_0x159afd['filters']=_[_0x7673('0x37')](_0x159afd[_0x7673('0x34')],_0x159afd[_0x7673('0x35')]);_0x101e03['attributes']=_['intersection'](_0x159afd[_0x7673('0x34')],qs['fields'](_0x36d77a['query'][_0x7673('0x38')]));_0x101e03[_0x7673('0x39')]=_0x101e03['attributes'][_0x7673('0x3a')]?_0x101e03[_0x7673('0x39')]:_0x159afd[_0x7673('0x34')];if(!_0x36d77a[_0x7673('0x35')][_0x7673('0x3b')](_0x7673('0x3c'))){_0x101e03['limit']=qs[_0x7673('0x26')](_0x36d77a['query'][_0x7673('0x26')]);_0x101e03['offset']=qs[_0x7673('0x24')](_0x36d77a[_0x7673('0x35')]['offset']);}_0x101e03['order']=qs[_0x7673('0x3d')](_0x36d77a['query'][_0x7673('0x3d')]);_0x101e03[_0x7673('0x3e')]=qs[_0x7673('0x3f')](_[_0x7673('0x40')](_0x36d77a[_0x7673('0x35')],_0x159afd['filters']),_0x2845f6);if(_0x36d77a['query'][_0x7673('0x41')]){_0x101e03[_0x7673('0x3e')]=_['merge'](_0x101e03[_0x7673('0x3e')],{'$or':_[_0x7673('0x30')](_0x2845f6,function(_0x143d0f){if(_0x143d0f['type']!==_0x7673('0x42')){var _0x378648={};_0x378648[_0x143d0f[_0x7673('0x43')]]={'$like':'%'+_0x36d77a[_0x7673('0x35')][_0x7673('0x41')]+'%'};return _0x378648;}})});}_0x101e03=_[_0x7673('0x44')]({},_0x101e03,_0x36d77a[_0x7673('0x45')]);var _0x232576={'where':_0x101e03[_0x7673('0x3e')]};return db['Setting'][_0x7673('0x27')](_0x232576)[_0x7673('0x18')](function(_0x624015){_0x47c9a3[_0x7673('0x27')]=_0x624015;if(_0x36d77a[_0x7673('0x35')][_0x7673('0x46')]){_0x101e03[_0x7673('0x47')]=[{'all':!![]}];}return db['Setting'][_0x7673('0x48')](_0x101e03);})[_0x7673('0x18')](function(_0x461ac3){_0x47c9a3[_0x7673('0x49')]=_0x461ac3;return _0x47c9a3;})[_0x7673('0x18')](respondWithFilteredResult(_0x78fecd,_0x101e03))['catch'](handleError(_0x78fecd,null));};exports[_0x7673('0x4a')]=function(_0x1a5a91,_0x432c09){var _0x2397fb={'raw':![],'where':{'id':_0x1a5a91['params']['id']}},_0x3f76a3={};_0x3f76a3['model']=_[_0x7673('0x36')](db[_0x7673('0x4b')]['rawAttributes']);_0x3f76a3[_0x7673('0x35')]=_[_0x7673('0x36')](_0x1a5a91[_0x7673('0x35')]);_0x3f76a3[_0x7673('0x3f')]=_[_0x7673('0x37')](_0x3f76a3['model'],_0x3f76a3[_0x7673('0x35')]);_0x2397fb[_0x7673('0x39')]=_[_0x7673('0x37')](_0x3f76a3[_0x7673('0x34')],qs['fields'](_0x1a5a91[_0x7673('0x35')][_0x7673('0x38')]));_0x2397fb[_0x7673('0x39')]=_0x2397fb[_0x7673('0x39')][_0x7673('0x3a')]?_0x2397fb[_0x7673('0x39')]:_0x3f76a3[_0x7673('0x34')];if(_0x1a5a91[_0x7673('0x35')][_0x7673('0x46')]){_0x2397fb[_0x7673('0x47')]=[{'all':!![]}];}_0x2397fb=_[_0x7673('0x44')]({},_0x2397fb,_0x1a5a91['options']);return db[_0x7673('0x4b')]['find'](_0x2397fb)[_0x7673('0x18')](handleEntityNotFound(_0x432c09,null))[_0x7673('0x18')](respondWithResult(_0x432c09,null))[_0x7673('0x1f')](handleError(_0x432c09,null));};exports['update']=function(_0x185ec5,_0x23df73){if(_0x185ec5[_0x7673('0x4c')]['id']){delete _0x185ec5[_0x7673('0x4c')]['id'];}return db[_0x7673('0x4b')][_0x7673('0x4d')]({'where':{'id':_0x185ec5[_0x7673('0x4e')]['id']}})[_0x7673('0x18')](handleEntityNotFound(_0x23df73,null))[_0x7673('0x18')](saveUpdates(_0x185ec5[_0x7673('0x4c')],null))[_0x7673('0x18')](respondWithResult(_0x23df73,null))[_0x7673('0x1f')](handleError(_0x23df73,null));};exports[_0x7673('0x4f')]=function(_0xb3c9e9,_0x59bcf3,_0x29dc1a){if(_0xb3c9e9['file']&&_0xb3c9e9[_0x7673('0x50')][_0x7673('0x51')]){_0xb3c9e9[_0x7673('0x4c')]['logo']=_0xb3c9e9[_0x7673('0x50')]['filename'];}return db['Setting'][_0x7673('0x4d')]({'where':{'id':_0xb3c9e9['params']['id']}})['then'](handleEntityNotFound(_0x59bcf3,null))[_0x7673('0x18')](saveUpdates(_0xb3c9e9[_0x7673('0x4c')],null))[_0x7673('0x18')](respondWithResult(_0x59bcf3,null))[_0x7673('0x1f')](handleError(_0x59bcf3,null));};exports[_0x7673('0x52')]=function(_0x2fc43d,_0x151276,_0xb72b1c){if(_0x2fc43d[_0x7673('0x50')]&&_0x2fc43d[_0x7673('0x50')][_0x7673('0x51')]){_0x2fc43d['body']['loginLogo']=_0x2fc43d[_0x7673('0x50')][_0x7673('0x51')];}return db[_0x7673('0x4b')][_0x7673('0x4d')]({'where':{'id':_0x2fc43d[_0x7673('0x4e')]['id']}})['then'](handleEntityNotFound(_0x151276,null))['then'](saveUpdates(_0x2fc43d[_0x7673('0x4c')],null))[_0x7673('0x18')](respondWithResult(_0x151276,null))[_0x7673('0x1f')](handleError(_0x151276,null));};var utilLicense=require(_0x7673('0x12'));exports[_0x7673('0x53')]=function(_0x47b5b3,_0x3713c1,_0x37f371){var _0x1cf039='server/files/images/logos';var _0x60d646={'custom':![]};return utilLicense['getLicense']()[_0x7673('0x18')](function(_0x44c4d9){if(_0x44c4d9){_0x60d646=_0x44c4d9;}return db[_0x7673('0x4b')]['find']({'where':{'id':_0x47b5b3[_0x7673('0x4e')]['id']},'attributes':[_0x7673('0x54'),'loginLogo','preferred','favicon',_0x7673('0x55'),_0x7673('0x56'),_0x7673('0x57'),_0x7673('0x58')],'raw':!![]});})['then'](handleEntityNotFound(_0x3713c1,null))[_0x7673('0x18')](function(_0x513daa){if(_0x513daa){var _0x94bd14=_0x513daa[_0x7673('0x54')]&&fs[_0x7673('0x59')](path[_0x7673('0x5a')](config['root'],_0x1cf039,_[_0x7673('0x5b')](_0x513daa[_0x7673('0x54')])))?path[_0x7673('0x5a')](config['root'],_0x1cf039,_['toLower'](_0x513daa[_0x7673('0x54')])):path[_0x7673('0x5a')](config[_0x7673('0x5c')],_0x1cf039,_[_0x7673('0x5b')](_0x7673('0x5d')));var _0x58311e=_0x7673('0x5e')+_[_0x7673('0x5f')]('logo');if(_0x513daa[_0x58311e]||!_0x60d646['custom']){_0x94bd14=path['join'](config[_0x7673('0x5c')],_0x1cf039,_[_0x7673('0x5b')]('default_logo.svg'));}if(!fs[_0x7673('0x59')](_0x94bd14)){throw new db['Sequelize']['ValidationError'](_[_0x7673('0x5f')](_0x7673('0x54'))+_0x7673('0x60'));}return _0x3713c1[_0x7673('0x61')](_0x94bd14);}})['catch'](handleError(_0x3713c1,null));};var utilLicense=require(_0x7673('0x12'));exports['getLogoLogin']=function(_0x1868ed,_0x298045,_0x204f21){var _0x3a12e7=_0x7673('0x62');var _0x25e886={'custom':![]};return utilLicense[_0x7673('0x63')]()['then'](function(_0x520e00){if(_0x520e00){_0x25e886=_0x520e00;}return db[_0x7673('0x4b')][_0x7673('0x4d')]({'where':{'id':_0x1868ed[_0x7673('0x4e')]['id']},'attributes':[_0x7673('0x54'),'loginLogo',_0x7673('0x64'),_0x7673('0x65'),_0x7673('0x55'),_0x7673('0x56'),_0x7673('0x57'),'defaultFavicon'],'raw':!![]});})[_0x7673('0x18')](handleEntityNotFound(_0x298045,null))[_0x7673('0x18')](function(_0xe587bf){if(_0xe587bf){var _0x4f35a3=_0xe587bf[_0x7673('0x66')]&&fs[_0x7673('0x59')](path[_0x7673('0x5a')](config[_0x7673('0x5c')],_0x3a12e7,_[_0x7673('0x5b')](_0xe587bf[_0x7673('0x66')])))?path['join'](config[_0x7673('0x5c')],_0x3a12e7,_[_0x7673('0x5b')](_0xe587bf[_0x7673('0x66')])):path[_0x7673('0x5a')](config[_0x7673('0x5c')],_0x3a12e7,_[_0x7673('0x5b')]('default_loginLogo.svg'));var _0xbfda26=_0x7673('0x5e')+_[_0x7673('0x5f')](_0x7673('0x66'));if(_0xe587bf[_0xbfda26]||!_0x25e886['custom']){_0x4f35a3=path[_0x7673('0x5a')](config[_0x7673('0x5c')],_0x3a12e7,_[_0x7673('0x5b')](_0x7673('0x67')));}if(!fs[_0x7673('0x59')](_0x4f35a3)){throw new db[(_0x7673('0x68'))][(_0x7673('0x69'))](_[_0x7673('0x5f')](_0x7673('0x66'))+_0x7673('0x60'));}return _0x298045['download'](_0x4f35a3);}})['catch'](handleError(_0x298045,null));};exports[_0x7673('0x6a')]=function(_0x2bf4c7,_0x36f3e9){return db['Setting'][_0x7673('0x4d')]({'where':{'id':_0x2bf4c7[_0x7673('0x4e')]['id']},'attributes':[_0x7673('0x6b')]})['then'](respondWithResult(_0x36f3e9,null))[_0x7673('0x1f')](handleError(_0x36f3e9,null));};exports['addPreferred']=function(_0x1aca90,_0x3e6317,_0x4c7b28){if(_0x1aca90['file']&&_0x1aca90[_0x7673('0x50')][_0x7673('0x51')]){_0x1aca90['body']['preferred']=_0x1aca90[_0x7673('0x50')]['filename'];}return db[_0x7673('0x4b')][_0x7673('0x4d')]({'where':{'id':_0x1aca90[_0x7673('0x4e')]['id']}})[_0x7673('0x18')](handleEntityNotFound(_0x3e6317,null))[_0x7673('0x18')](saveUpdates(_0x1aca90[_0x7673('0x4c')],null))[_0x7673('0x18')](respondWithResult(_0x3e6317,null))[_0x7673('0x1f')](handleError(_0x3e6317,null));};var utilLicense=require(_0x7673('0x12'));exports['getPreferred']=function(_0xf324d9,_0x28ed04,_0x247ca8){var _0x47ac80=_0x7673('0x62');var _0x3071ef={'custom':![]};return utilLicense[_0x7673('0x63')]()[_0x7673('0x18')](function(_0x21fedb){if(_0x21fedb){_0x3071ef=_0x21fedb;}return db[_0x7673('0x4b')][_0x7673('0x4d')]({'where':{'id':_0xf324d9['params']['id']},'attributes':[_0x7673('0x54'),'loginLogo',_0x7673('0x64'),_0x7673('0x65'),_0x7673('0x55'),_0x7673('0x56'),'defaultPreferred',_0x7673('0x58')],'raw':!![]});})[_0x7673('0x18')](handleEntityNotFound(_0x28ed04,null))[_0x7673('0x18')](function(_0x541a8a){if(_0x541a8a){var _0x242240=_0x541a8a[_0x7673('0x64')]&&fs[_0x7673('0x59')](path[_0x7673('0x5a')](config['root'],_0x47ac80,_[_0x7673('0x5b')](_0x541a8a[_0x7673('0x64')])))?path['join'](config[_0x7673('0x5c')],_0x47ac80,_[_0x7673('0x5b')](_0x541a8a['preferred'])):path[_0x7673('0x5a')](config['root'],_0x47ac80,_[_0x7673('0x5b')]('default_preferred.png'));var _0x390668=_0x7673('0x5e')+_[_0x7673('0x5f')](_0x7673('0x64'));if(_0x541a8a[_0x390668]||!_0x3071ef[_0x7673('0x6c')]||!_0x3071ef[_0x7673('0x64')]){_0x242240=path[_0x7673('0x5a')](config[_0x7673('0x5c')],_0x47ac80,_['toLower']('default_preferred.png'));}if(!fs[_0x7673('0x59')](_0x242240)){throw new db[(_0x7673('0x68'))][(_0x7673('0x69'))](_[_0x7673('0x5f')]('preferred')+_0x7673('0x60'));}return _0x28ed04[_0x7673('0x61')](_0x242240);}})[_0x7673('0x1f')](handleError(_0x28ed04,null));};exports[_0x7673('0x6d')]=function(_0x307617,_0x461cc8,_0x4c24a6){if(_0x307617[_0x7673('0x50')]&&_0x307617['file'][_0x7673('0x51')]){_0x307617[_0x7673('0x4c')][_0x7673('0x65')]=_0x307617[_0x7673('0x50')][_0x7673('0x51')];}return db[_0x7673('0x4b')][_0x7673('0x4d')]({'where':{'id':_0x307617[_0x7673('0x4e')]['id']}})[_0x7673('0x18')](handleEntityNotFound(_0x461cc8,null))[_0x7673('0x18')](saveUpdates(_0x307617[_0x7673('0x4c')],null))[_0x7673('0x18')](respondWithResult(_0x461cc8,null))[_0x7673('0x1f')](handleError(_0x461cc8,null));};var utilLicense=require('../../config/license/util');exports[_0x7673('0x6e')]=function(_0x478dc3,_0xc667a3,_0x4b8a8b){var _0x35074b=_0x7673('0x62');var _0x3eb426={'custom':![]};return utilLicense[_0x7673('0x63')]()[_0x7673('0x18')](function(_0x3fd1e8){if(_0x3fd1e8){_0x3eb426=_0x3fd1e8;}return db[_0x7673('0x4b')][_0x7673('0x4d')]({'where':{'id':_0x478dc3[_0x7673('0x4e')]['id']},'attributes':[_0x7673('0x54'),'loginLogo','preferred',_0x7673('0x65'),'defaultLogo','defaultLoginLogo',_0x7673('0x57'),_0x7673('0x58')],'raw':!![]});})[_0x7673('0x18')](handleEntityNotFound(_0xc667a3,null))['then'](function(_0xe467db){if(_0xe467db){var _0x4792b9=_0xe467db[_0x7673('0x65')]&&fs['existsSync'](path[_0x7673('0x5a')](config[_0x7673('0x5c')],_0x35074b,_[_0x7673('0x5b')](_0xe467db['favicon'])))?path[_0x7673('0x5a')](config['root'],_0x35074b,_[_0x7673('0x5b')](_0xe467db[_0x7673('0x65')])):path[_0x7673('0x5a')](config[_0x7673('0x5c')],_0x35074b,_[_0x7673('0x5b')](_0x7673('0x6f')));var _0x179610=_0x7673('0x5e')+_[_0x7673('0x5f')]('favicon');if(_0xe467db[_0x179610]||!_0x3eb426['custom']){_0x4792b9=path[_0x7673('0x5a')](config[_0x7673('0x5c')],_0x35074b,_['toLower'](_0x7673('0x6f')));}if(!fs[_0x7673('0x59')](_0x4792b9)){throw new db[(_0x7673('0x68'))][(_0x7673('0x69'))](_[_0x7673('0x5f')](_0x7673('0x65'))+_0x7673('0x60'));}return _0xc667a3[_0x7673('0x61')](_0x4792b9);}})['catch'](handleError(_0xc667a3,null));};exports[_0x7673('0x70')]=function(_0x21b7ad,_0x28171b){var _0x593182={'offset':moment()[_0x7673('0x71')]()};_0x593182[_0x7673('0x72')]=moment()[_0x7673('0x71')](_0x593182[_0x7673('0x24')])[_0x7673('0x73')](_0x7673('0x74'));return _0x28171b[_0x7673('0x21')](0xc8)['send'](_0x593182);}; \ No newline at end of file +var _0x8c32=['addFavicon','getFavicon','default_favicon.ico','getDate','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Setting','include','findAll','rows','params','includeAll','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','securePassword','addPreferred','default_preferred.png','custom'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x8c32,0x89));var _0x28c3=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8c32[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0x28c3('0x0'));var rimraf=require(_0x28c3('0x1'));var zipdir=require(_0x28c3('0x2'));var jsonpatch=require(_0x28c3('0x3'));var rp=require('request-promise');var moment=require(_0x28c3('0x4'));var BPromise=require(_0x28c3('0x5'));var Mustache=require(_0x28c3('0x6'));var util=require('util');var path=require(_0x28c3('0x7'));var sox=require(_0x28c3('0x8'));var csv=require('to-csv');var ejs=require(_0x28c3('0x9'));var fs=require('fs');var fs_extra=require(_0x28c3('0xa'));var _=require(_0x28c3('0xb'));var squel=require(_0x28c3('0xc'));var crypto=require(_0x28c3('0xd'));var jsforce=require(_0x28c3('0xe'));var deskjs=require(_0x28c3('0xf'));var toCsv=require(_0x28c3('0x10'));var querystring=require(_0x28c3('0x11'));var Papa=require(_0x28c3('0x12'));var Redis=require(_0x28c3('0x13'));var authService=require(_0x28c3('0x14'));var qs=require(_0x28c3('0x15'));var as=require(_0x28c3('0x16'));var hardwareService=require(_0x28c3('0x17'));var logger=require(_0x28c3('0x18'))('api');var utils=require(_0x28c3('0x19'));var config=require(_0x28c3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x28c3('0x1b'));var client=jayson[_0x28c3('0x1c')][_0x28c3('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4dc7a0,_0x6afc54,_0x7ed0a4,_0x524b6a){return new BPromise(function(_0x109b98,_0x20f629){var _0x2d48fe=_0x524b6a||client;return _0x2d48fe[_0x28c3('0x1e')](_0x4dc7a0,_0x7ed0a4)[_0x28c3('0x1f')](function(_0x8904d3){logger['info']('Setting,\x20%s,\x20%s',_0x6afc54,_0x28c3('0x20'));logger[_0x28c3('0x21')](_0x28c3('0x22'),_0x6afc54,'request\x20sent',JSON[_0x28c3('0x23')](_0x8904d3));if(_0x8904d3[_0x28c3('0x24')]){if(_0x8904d3[_0x28c3('0x24')][_0x28c3('0x25')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x6afc54,_0x8904d3[_0x28c3('0x24')][_0x28c3('0x26')]);return _0x20f629(_0x8904d3[_0x28c3('0x24')][_0x28c3('0x26')]);}logger[_0x28c3('0x24')](_0x28c3('0x27'),_0x6afc54,_0x8904d3[_0x28c3('0x24')][_0x28c3('0x26')]);return _0x109b98(_0x8904d3[_0x28c3('0x24')]['message']);}else{logger[_0x28c3('0x28')](_0x28c3('0x27'),_0x6afc54,_0x28c3('0x20'));_0x109b98(_0x8904d3[_0x28c3('0x29')][_0x28c3('0x26')]);}})[_0x28c3('0x2a')](function(_0x180494){logger[_0x28c3('0x24')](_0x28c3('0x27'),_0x6afc54,_0x180494);_0x20f629(_0x180494);});});}function respondWithStatusCode(_0x313778,_0x1176d1){_0x1176d1=_0x1176d1||0xcc;return function(_0x20713a){if(_0x20713a){return _0x313778[_0x28c3('0x2b')](_0x1176d1);}return _0x313778['status'](_0x1176d1)[_0x28c3('0x2c')]();};}function respondWithResult(_0x2a8cc3,_0x1c0985){_0x1c0985=_0x1c0985||0xc8;return function(_0x4d2ac7){if(_0x4d2ac7){return _0x2a8cc3[_0x28c3('0x2d')](_0x1c0985)[_0x28c3('0x2e')](_0x4d2ac7);}};}function respondWithFilteredResult(_0xb0ca79,_0x1dabc9){return function(_0x357ed5){if(_0x357ed5){var _0x17cccb=typeof _0x1dabc9[_0x28c3('0x2f')]===_0x28c3('0x30')&&typeof _0x1dabc9[_0x28c3('0x31')]===_0x28c3('0x30');var _0x3b6346=_0x357ed5['count'];var _0x553dbd=_0x17cccb?0x0:_0x1dabc9[_0x28c3('0x2f')];var _0xedb1dd=_0x17cccb?_0x357ed5[_0x28c3('0x32')]:_0x1dabc9[_0x28c3('0x2f')]+_0x1dabc9[_0x28c3('0x31')];var _0x1ea4d6;if(_0xedb1dd>=_0x3b6346){_0xedb1dd=_0x3b6346;_0x1ea4d6=0xc8;}else{_0x1ea4d6=0xce;}_0xb0ca79['status'](_0x1ea4d6);return _0xb0ca79[_0x28c3('0x33')](_0x28c3('0x34'),_0x553dbd+'-'+_0xedb1dd+'/'+_0x3b6346)['json'](_0x357ed5);}return null;};}function patchUpdates(_0x29d62a){return function(_0x26ac0d){try{jsonpatch[_0x28c3('0x35')](_0x26ac0d,_0x29d62a,!![]);}catch(_0x4acd42){return BPromise[_0x28c3('0x36')](_0x4acd42);}return _0x26ac0d['save']();};}function saveUpdates(_0x66d986,_0x4194e3){return function(_0x16265a){if(_0x16265a){return _0x16265a[_0x28c3('0x37')](_0x66d986)[_0x28c3('0x1f')](function(_0x23d6ee){return _0x23d6ee;});}return null;};}function removeEntity(_0x26a1c6,_0x528267){return function(_0x5a96c1){if(_0x5a96c1){return _0x5a96c1[_0x28c3('0x38')]()['then'](function(){_0x26a1c6[_0x28c3('0x2d')](0xcc)[_0x28c3('0x2c')]();});}};}function handleEntityNotFound(_0x5efbf7,_0x29c0c9){return function(_0xa92852){if(!_0xa92852){_0x5efbf7[_0x28c3('0x2b')](0x194);}return _0xa92852;};}function handleError(_0x298fdd,_0x148a40){_0x148a40=_0x148a40||0x1f4;return function(_0x265a95){logger['error'](_0x265a95[_0x28c3('0x39')]);if(_0x265a95['name']){delete _0x265a95[_0x28c3('0x3a')];}_0x298fdd[_0x28c3('0x2d')](_0x148a40)[_0x28c3('0x3b')](_0x265a95);};}exports[_0x28c3('0x3c')]=function(_0x3d6389,_0x588911){var _0xbcf38d={},_0x71404b={},_0x84dc3d={'count':0x0,'rows':[]};var _0x3f7986=_[_0x28c3('0x3d')](db['Setting'][_0x28c3('0x3e')],function(_0x2ff50f){return{'name':_0x2ff50f[_0x28c3('0x3f')],'type':_0x2ff50f[_0x28c3('0x40')][_0x28c3('0x41')]};});_0x71404b[_0x28c3('0x42')]=_[_0x28c3('0x3d')](_0x3f7986,_0x28c3('0x3a'));_0x71404b[_0x28c3('0x43')]=_[_0x28c3('0x44')](_0x3d6389[_0x28c3('0x43')]);_0x71404b[_0x28c3('0x45')]=_[_0x28c3('0x46')](_0x71404b[_0x28c3('0x42')],_0x71404b[_0x28c3('0x43')]);_0xbcf38d['attributes']=_['intersection'](_0x71404b['model'],qs['fields'](_0x3d6389[_0x28c3('0x43')][_0x28c3('0x47')]));_0xbcf38d['attributes']=_0xbcf38d[_0x28c3('0x48')][_0x28c3('0x49')]?_0xbcf38d[_0x28c3('0x48')]:_0x71404b[_0x28c3('0x42')];if(!_0x3d6389[_0x28c3('0x43')][_0x28c3('0x4a')](_0x28c3('0x4b'))){_0xbcf38d[_0x28c3('0x31')]=qs[_0x28c3('0x31')](_0x3d6389['query'][_0x28c3('0x31')]);_0xbcf38d['offset']=qs['offset'](_0x3d6389['query'][_0x28c3('0x2f')]);}_0xbcf38d['order']=qs[_0x28c3('0x4c')](_0x3d6389['query'][_0x28c3('0x4c')]);_0xbcf38d[_0x28c3('0x4d')]=qs[_0x28c3('0x45')](_[_0x28c3('0x4e')](_0x3d6389[_0x28c3('0x43')],_0x71404b[_0x28c3('0x45')]),_0x3f7986);if(_0x3d6389[_0x28c3('0x43')][_0x28c3('0x4f')]){_0xbcf38d[_0x28c3('0x4d')]=_['merge'](_0xbcf38d[_0x28c3('0x4d')],{'$or':_[_0x28c3('0x3d')](_0x3f7986,function(_0x4333f5){if(_0x4333f5[_0x28c3('0x40')]!=='VIRTUAL'){var _0x483249={};_0x483249[_0x4333f5['name']]={'$like':'%'+_0x3d6389['query'][_0x28c3('0x4f')]+'%'};return _0x483249;}})});}_0xbcf38d=_[_0x28c3('0x50')]({},_0xbcf38d,_0x3d6389[_0x28c3('0x51')]);var _0x2c668a={'where':_0xbcf38d[_0x28c3('0x4d')]};return db[_0x28c3('0x52')][_0x28c3('0x32')](_0x2c668a)[_0x28c3('0x1f')](function(_0x19ce51){_0x84dc3d['count']=_0x19ce51;if(_0x3d6389[_0x28c3('0x43')]['includeAll']){_0xbcf38d[_0x28c3('0x53')]=[{'all':!![]}];}return db[_0x28c3('0x52')][_0x28c3('0x54')](_0xbcf38d);})[_0x28c3('0x1f')](function(_0x3140db){_0x84dc3d[_0x28c3('0x55')]=_0x3140db;return _0x84dc3d;})['then'](respondWithFilteredResult(_0x588911,_0xbcf38d))[_0x28c3('0x2a')](handleError(_0x588911,null));};exports['show']=function(_0x372e6e,_0x1da486){var _0x1f44c3={'raw':![],'where':{'id':_0x372e6e[_0x28c3('0x56')]['id']}},_0x4be28f={};_0x4be28f[_0x28c3('0x42')]=_[_0x28c3('0x44')](db[_0x28c3('0x52')]['rawAttributes']);_0x4be28f[_0x28c3('0x43')]=_[_0x28c3('0x44')](_0x372e6e[_0x28c3('0x43')]);_0x4be28f[_0x28c3('0x45')]=_[_0x28c3('0x46')](_0x4be28f['model'],_0x4be28f[_0x28c3('0x43')]);_0x1f44c3[_0x28c3('0x48')]=_[_0x28c3('0x46')](_0x4be28f[_0x28c3('0x42')],qs[_0x28c3('0x47')](_0x372e6e[_0x28c3('0x43')]['fields']));_0x1f44c3[_0x28c3('0x48')]=_0x1f44c3[_0x28c3('0x48')][_0x28c3('0x49')]?_0x1f44c3[_0x28c3('0x48')]:_0x4be28f[_0x28c3('0x42')];if(_0x372e6e[_0x28c3('0x43')][_0x28c3('0x57')]){_0x1f44c3[_0x28c3('0x53')]=[{'all':!![]}];}_0x1f44c3=_['merge']({},_0x1f44c3,_0x372e6e[_0x28c3('0x51')]);return db[_0x28c3('0x52')][_0x28c3('0x58')](_0x1f44c3)[_0x28c3('0x1f')](handleEntityNotFound(_0x1da486,null))[_0x28c3('0x1f')](respondWithResult(_0x1da486,null))[_0x28c3('0x2a')](handleError(_0x1da486,null));};exports[_0x28c3('0x37')]=function(_0x20e626,_0x5eb678){if(_0x20e626['body']['id']){delete _0x20e626[_0x28c3('0x59')]['id'];}return db[_0x28c3('0x52')][_0x28c3('0x58')]({'where':{'id':_0x20e626[_0x28c3('0x56')]['id']}})['then'](handleEntityNotFound(_0x5eb678,null))[_0x28c3('0x1f')](saveUpdates(_0x20e626['body'],null))[_0x28c3('0x1f')](respondWithResult(_0x5eb678,null))[_0x28c3('0x2a')](handleError(_0x5eb678,null));};exports[_0x28c3('0x5a')]=function(_0x4c65e9,_0x5d066a,_0x23855c){if(_0x4c65e9['file']&&_0x4c65e9[_0x28c3('0x5b')][_0x28c3('0x5c')]){_0x4c65e9['body'][_0x28c3('0x5d')]=_0x4c65e9[_0x28c3('0x5b')][_0x28c3('0x5c')];}return db['Setting'][_0x28c3('0x58')]({'where':{'id':_0x4c65e9[_0x28c3('0x56')]['id']}})[_0x28c3('0x1f')](handleEntityNotFound(_0x5d066a,null))['then'](saveUpdates(_0x4c65e9[_0x28c3('0x59')],null))[_0x28c3('0x1f')](respondWithResult(_0x5d066a,null))[_0x28c3('0x2a')](handleError(_0x5d066a,null));};exports[_0x28c3('0x5e')]=function(_0x23eaca,_0xd820d2,_0x483dbe){if(_0x23eaca[_0x28c3('0x5b')]&&_0x23eaca[_0x28c3('0x5b')][_0x28c3('0x5c')]){_0x23eaca[_0x28c3('0x59')][_0x28c3('0x5f')]=_0x23eaca[_0x28c3('0x5b')]['filename'];}return db['Setting'][_0x28c3('0x58')]({'where':{'id':_0x23eaca[_0x28c3('0x56')]['id']}})[_0x28c3('0x1f')](handleEntityNotFound(_0xd820d2,null))['then'](saveUpdates(_0x23eaca['body'],null))[_0x28c3('0x1f')](respondWithResult(_0xd820d2,null))[_0x28c3('0x2a')](handleError(_0xd820d2,null));};var utilLicense=require(_0x28c3('0x60'));exports[_0x28c3('0x61')]=function(_0x17d1c8,_0x466f66,_0x113222){var _0x436c3a=_0x28c3('0x62');var _0x7bd053={'custom':![]};return utilLicense[_0x28c3('0x63')]()[_0x28c3('0x1f')](function(_0x467932){if(_0x467932){_0x7bd053=_0x467932;}return db[_0x28c3('0x52')][_0x28c3('0x58')]({'where':{'id':_0x17d1c8[_0x28c3('0x56')]['id']},'attributes':[_0x28c3('0x5d'),_0x28c3('0x5f'),_0x28c3('0x64'),_0x28c3('0x65'),_0x28c3('0x66'),_0x28c3('0x67'),'defaultPreferred',_0x28c3('0x68')],'raw':!![]});})[_0x28c3('0x1f')](handleEntityNotFound(_0x466f66,null))[_0x28c3('0x1f')](function(_0x2ced16){if(_0x2ced16){var _0x413542=_0x2ced16['logo']&&fs[_0x28c3('0x69')](path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x436c3a,_[_0x28c3('0x6c')](_0x2ced16['logo'])))?path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x436c3a,_[_0x28c3('0x6c')](_0x2ced16[_0x28c3('0x5d')])):path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x436c3a,_[_0x28c3('0x6c')](_0x28c3('0x6d')));var _0x19d2bb=_0x28c3('0x6e')+_[_0x28c3('0x6f')](_0x28c3('0x5d'));if(_0x2ced16[_0x19d2bb]||!_0x7bd053['custom']){_0x413542=path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x436c3a,_[_0x28c3('0x6c')](_0x28c3('0x6d')));}if(!fs[_0x28c3('0x69')](_0x413542)){throw new db[(_0x28c3('0x70'))][(_0x28c3('0x71'))](_[_0x28c3('0x6f')]('logo')+_0x28c3('0x72'));}return _0x466f66[_0x28c3('0x73')](_0x413542);}})['catch'](handleError(_0x466f66,null));};var utilLicense=require('../../config/license/util');exports[_0x28c3('0x74')]=function(_0x926d9a,_0x24c9ca,_0x41a5e2){var _0x5de5e4=_0x28c3('0x62');var _0xf528e5={'custom':![]};return utilLicense['getLicense']()[_0x28c3('0x1f')](function(_0x38d832){if(_0x38d832){_0xf528e5=_0x38d832;}return db[_0x28c3('0x52')][_0x28c3('0x58')]({'where':{'id':_0x926d9a[_0x28c3('0x56')]['id']},'attributes':[_0x28c3('0x5d'),'loginLogo',_0x28c3('0x64'),_0x28c3('0x65'),_0x28c3('0x66'),'defaultLoginLogo',_0x28c3('0x75'),_0x28c3('0x68')],'raw':!![]});})[_0x28c3('0x1f')](handleEntityNotFound(_0x24c9ca,null))[_0x28c3('0x1f')](function(_0x1ee7b8){if(_0x1ee7b8){var _0x442900=_0x1ee7b8['loginLogo']&&fs['existsSync'](path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x5de5e4,_[_0x28c3('0x6c')](_0x1ee7b8['loginLogo'])))?path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x5de5e4,_[_0x28c3('0x6c')](_0x1ee7b8[_0x28c3('0x5f')])):path['join'](config[_0x28c3('0x6b')],_0x5de5e4,_[_0x28c3('0x6c')]('default_loginLogo.svg'));var _0x308222=_0x28c3('0x6e')+_[_0x28c3('0x6f')](_0x28c3('0x5f'));if(_0x1ee7b8[_0x308222]||!_0xf528e5['custom']){_0x442900=path['join'](config[_0x28c3('0x6b')],_0x5de5e4,_[_0x28c3('0x6c')](_0x28c3('0x76')));}if(!fs[_0x28c3('0x69')](_0x442900)){throw new db[(_0x28c3('0x70'))][(_0x28c3('0x71'))](_['upperFirst'](_0x28c3('0x5f'))+_0x28c3('0x72'));}return _0x24c9ca['download'](_0x442900);}})[_0x28c3('0x2a')](handleError(_0x24c9ca,null));};exports['gdpr']=function(_0x510c0d,_0x4aae5e){return db[_0x28c3('0x52')]['find']({'where':{'id':_0x510c0d[_0x28c3('0x56')]['id']},'attributes':[_0x28c3('0x77')]})[_0x28c3('0x1f')](respondWithResult(_0x4aae5e,null))['catch'](handleError(_0x4aae5e,null));};exports[_0x28c3('0x78')]=function(_0x2ed85c,_0x3cbb95,_0x2c9174){if(_0x2ed85c[_0x28c3('0x5b')]&&_0x2ed85c[_0x28c3('0x5b')][_0x28c3('0x5c')]){_0x2ed85c[_0x28c3('0x59')]['preferred']=_0x2ed85c[_0x28c3('0x5b')]['filename'];}return db[_0x28c3('0x52')][_0x28c3('0x58')]({'where':{'id':_0x2ed85c[_0x28c3('0x56')]['id']}})[_0x28c3('0x1f')](handleEntityNotFound(_0x3cbb95,null))[_0x28c3('0x1f')](saveUpdates(_0x2ed85c[_0x28c3('0x59')],null))[_0x28c3('0x1f')](respondWithResult(_0x3cbb95,null))[_0x28c3('0x2a')](handleError(_0x3cbb95,null));};var utilLicense=require(_0x28c3('0x60'));exports['getPreferred']=function(_0x5b5026,_0x28c36c,_0x221581){var _0x616cbb=_0x28c3('0x62');var _0x3f04a0={'custom':![]};return utilLicense['getLicense']()[_0x28c3('0x1f')](function(_0x160935){if(_0x160935){_0x3f04a0=_0x160935;}return db[_0x28c3('0x52')][_0x28c3('0x58')]({'where':{'id':_0x5b5026[_0x28c3('0x56')]['id']},'attributes':[_0x28c3('0x5d'),_0x28c3('0x5f'),_0x28c3('0x64'),_0x28c3('0x65'),_0x28c3('0x66'),_0x28c3('0x67'),_0x28c3('0x75'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x28c36c,null))[_0x28c3('0x1f')](function(_0x4b06ef){if(_0x4b06ef){var _0x1575e6=_0x4b06ef['preferred']&&fs[_0x28c3('0x69')](path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x616cbb,_[_0x28c3('0x6c')](_0x4b06ef[_0x28c3('0x64')])))?path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x616cbb,_[_0x28c3('0x6c')](_0x4b06ef[_0x28c3('0x64')])):path[_0x28c3('0x6a')](config['root'],_0x616cbb,_[_0x28c3('0x6c')](_0x28c3('0x79')));var _0xb40248=_0x28c3('0x6e')+_['upperFirst'](_0x28c3('0x64'));if(_0x4b06ef[_0xb40248]||!_0x3f04a0[_0x28c3('0x7a')]||!_0x3f04a0[_0x28c3('0x64')]){_0x1575e6=path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x616cbb,_['toLower'](_0x28c3('0x79')));}if(!fs['existsSync'](_0x1575e6)){throw new db[(_0x28c3('0x70'))][(_0x28c3('0x71'))](_[_0x28c3('0x6f')](_0x28c3('0x64'))+'\x20not\x20found');}return _0x28c36c[_0x28c3('0x73')](_0x1575e6);}})['catch'](handleError(_0x28c36c,null));};exports[_0x28c3('0x7b')]=function(_0x258e5d,_0x6c22c1,_0x4459ec){if(_0x258e5d[_0x28c3('0x5b')]&&_0x258e5d['file'][_0x28c3('0x5c')]){_0x258e5d[_0x28c3('0x59')]['favicon']=_0x258e5d['file']['filename'];}return db['Setting'][_0x28c3('0x58')]({'where':{'id':_0x258e5d[_0x28c3('0x56')]['id']}})['then'](handleEntityNotFound(_0x6c22c1,null))[_0x28c3('0x1f')](saveUpdates(_0x258e5d['body'],null))[_0x28c3('0x1f')](respondWithResult(_0x6c22c1,null))[_0x28c3('0x2a')](handleError(_0x6c22c1,null));};var utilLicense=require(_0x28c3('0x60'));exports[_0x28c3('0x7c')]=function(_0x11018e,_0x5f45e7,_0x3cea11){var _0x3e3b17=_0x28c3('0x62');var _0x1ec58c={'custom':![]};return utilLicense[_0x28c3('0x63')]()[_0x28c3('0x1f')](function(_0x30f8c7){if(_0x30f8c7){_0x1ec58c=_0x30f8c7;}return db[_0x28c3('0x52')][_0x28c3('0x58')]({'where':{'id':_0x11018e['params']['id']},'attributes':['logo',_0x28c3('0x5f'),_0x28c3('0x64'),'favicon',_0x28c3('0x66'),_0x28c3('0x67'),_0x28c3('0x75'),_0x28c3('0x68')],'raw':!![]});})[_0x28c3('0x1f')](handleEntityNotFound(_0x5f45e7,null))[_0x28c3('0x1f')](function(_0x2ce57a){if(_0x2ce57a){var _0x8ec8e2=_0x2ce57a[_0x28c3('0x65')]&&fs[_0x28c3('0x69')](path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x3e3b17,_['toLower'](_0x2ce57a['favicon'])))?path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x3e3b17,_[_0x28c3('0x6c')](_0x2ce57a[_0x28c3('0x65')])):path['join'](config[_0x28c3('0x6b')],_0x3e3b17,_['toLower'](_0x28c3('0x7d')));var _0x1b7683='default'+_['upperFirst'](_0x28c3('0x65'));if(_0x2ce57a[_0x1b7683]||!_0x1ec58c[_0x28c3('0x7a')]){_0x8ec8e2=path[_0x28c3('0x6a')](config[_0x28c3('0x6b')],_0x3e3b17,_[_0x28c3('0x6c')](_0x28c3('0x7d')));}if(!fs['existsSync'](_0x8ec8e2)){throw new db['Sequelize']['ValidationError'](_[_0x28c3('0x6f')]('favicon')+_0x28c3('0x72'));}return _0x5f45e7[_0x28c3('0x73')](_0x8ec8e2);}})[_0x28c3('0x2a')](handleError(_0x5f45e7,null));};exports[_0x28c3('0x7e')]=function(_0x5f1b09,_0x5c4458){var _0x1d4918={'offset':moment()['utcOffset']()};_0x1d4918[_0x28c3('0x7f')]=moment()['utcOffset'](_0x1d4918[_0x28c3('0x2f')])[_0x28c3('0x80')](_0x28c3('0x81'));return _0x5c4458['status'](0xc8)[_0x28c3('0x3b')](_0x1d4918);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 621d59b..f900350 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x7217,0x19e));var _0x7721=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7217[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 7e2fcac..76d54d2 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 _0x4674=['message','result','catch','ShowSetting','find','options','attributes','map','include','model','stringify','lodash','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x4674,0x1df));var _0x4467=function(_0x34efc4,_0x994a8d){_0x34efc4=_0x34efc4-0x0;var _0x4eb8ec=_0x4674[_0x34efc4];return _0x4eb8ec;};'use strict';var _=require(_0x4467('0x0'));var util=require('util');var moment=require(_0x4467('0x1'));var BPromise=require(_0x4467('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4467('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4467('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4467('0x5'));var client=jayson['client'][_0x4467('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x31743f,_0x23c158,_0x47108e){return new BPromise(function(_0x56c237,_0x30b873){return client[_0x4467('0x7')](_0x31743f,_0x47108e)[_0x4467('0x8')](function(_0x55a89f){logger[_0x4467('0x9')](_0x4467('0xa'),_0x23c158,'request\x20sent');logger[_0x4467('0xb')]('Setting,\x20%s,\x20%s,\x20%s',_0x23c158,_0x4467('0xc'),JSON['stringify'](_0x55a89f));if(_0x55a89f[_0x4467('0xd')]){if(_0x55a89f[_0x4467('0xd')][_0x4467('0xe')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x23c158,_0x55a89f[_0x4467('0xd')][_0x4467('0xf')]);return _0x30b873(_0x55a89f[_0x4467('0xd')][_0x4467('0xf')]);}logger['error']('Setting,\x20%s,\x20%s',_0x23c158,_0x55a89f[_0x4467('0xd')][_0x4467('0xf')]);return _0x56c237(_0x55a89f[_0x4467('0xd')][_0x4467('0xf')]);}else{logger[_0x4467('0x9')](_0x4467('0xa'),_0x23c158,'request\x20sent');_0x56c237(_0x55a89f[_0x4467('0x10')]['message']);}})[_0x4467('0x11')](function(_0x3143e7){logger[_0x4467('0xd')]('Setting,\x20%s,\x20%s',_0x23c158,_0x3143e7);_0x30b873(_0x3143e7);});});}exports[_0x4467('0x12')]=function(_0x59256e){var _0x13e68b=this;return new Promise(function(_0x334468,_0x9251de){return db['Setting'][_0x4467('0x13')]({'raw':_0x59256e[_0x4467('0x14')]?_0x59256e['options']['raw']===undefined?!![]:![]:!![],'where':_0x59256e[_0x4467('0x14')]?_0x59256e['options']['where']||null:null,'attributes':_0x59256e[_0x4467('0x14')]?_0x59256e[_0x4467('0x14')][_0x4467('0x15')]||null:null,'include':_0x59256e['options']?_0x59256e['options']['include']?_[_0x4467('0x16')](_0x59256e['options'][_0x4467('0x17')],function(_0x5c5203){return{'model':db[_0x5c5203[_0x4467('0x18')]],'as':_0x5c5203['as'],'attributes':_0x5c5203[_0x4467('0x15')],'include':_0x5c5203[_0x4467('0x17')]?_['map'](_0x5c5203['include'],function(_0x333264){return{'model':db[_0x333264[_0x4467('0x18')]],'as':_0x333264['as'],'attributes':_0x333264[_0x4467('0x15')],'include':_0x333264[_0x4467('0x17')]?_['map'](_0x333264['include'],function(_0x305b85){return{'model':db[_0x305b85['model']],'as':_0x305b85['as'],'attributes':_0x305b85[_0x4467('0x15')]};}):[]};}):[]};}):[]:[]})[_0x4467('0x8')](function(_0x1cf828){logger[_0x4467('0x9')]('ShowSetting',_0x59256e);logger[_0x4467('0xb')](_0x4467('0x12'),_0x59256e,JSON[_0x4467('0x19')](_0x1cf828));_0x334468(_0x1cf828);})[_0x4467('0x11')](function(_0xe3ca85){logger[_0x4467('0xd')](_0x4467('0x12'),_0xe3ca85[_0x4467('0xf')],_0x59256e);_0x9251de(_0x13e68b[_0x4467('0xd')](0x1f4,_0xe3ca85['message']));});});}; \ No newline at end of file +var _0x1b0b=['util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSetting','Setting','options','raw','attributes','include','map','model','debug','catch','lodash'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x1b0b,0x77));var _0xb1b0=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x1b0b[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xb1b0('0x0'));var util=require(_0xb1b0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb1b0('0x2'));var fs=require('fs');var Redis=require(_0xb1b0('0x3'));var db=require(_0xb1b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1b0('0x5'))(_0xb1b0('0x6'));var config=require(_0xb1b0('0x7'));var jayson=require(_0xb1b0('0x8'));var client=jayson[_0xb1b0('0x9')][_0xb1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c160e,_0x162c98,_0x93ccaf){return new BPromise(function(_0x261353,_0x211a65){return client[_0xb1b0('0xb')](_0x2c160e,_0x93ccaf)[_0xb1b0('0xc')](function(_0x1fcd5a){logger[_0xb1b0('0xd')](_0xb1b0('0xe'),_0x162c98,_0xb1b0('0xf'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x162c98,'request\x20sent',JSON[_0xb1b0('0x10')](_0x1fcd5a));if(_0x1fcd5a[_0xb1b0('0x11')]){if(_0x1fcd5a[_0xb1b0('0x11')]['code']===0x1f4){logger[_0xb1b0('0x11')](_0xb1b0('0xe'),_0x162c98,_0x1fcd5a[_0xb1b0('0x11')][_0xb1b0('0x12')]);return _0x211a65(_0x1fcd5a[_0xb1b0('0x11')][_0xb1b0('0x12')]);}logger['error'](_0xb1b0('0xe'),_0x162c98,_0x1fcd5a[_0xb1b0('0x11')][_0xb1b0('0x12')]);return _0x261353(_0x1fcd5a[_0xb1b0('0x11')]['message']);}else{logger[_0xb1b0('0xd')]('Setting,\x20%s,\x20%s',_0x162c98,'request\x20sent');_0x261353(_0x1fcd5a[_0xb1b0('0x13')][_0xb1b0('0x12')]);}})['catch'](function(_0x2f8f50){logger['error'](_0xb1b0('0xe'),_0x162c98,_0x2f8f50);_0x211a65(_0x2f8f50);});});}exports[_0xb1b0('0x14')]=function(_0x2f0db7){var _0x358fb0=this;return new Promise(function(_0x29409d,_0x590e3e){return db[_0xb1b0('0x15')]['find']({'raw':_0x2f0db7[_0xb1b0('0x16')]?_0x2f0db7['options'][_0xb1b0('0x17')]===undefined?!![]:![]:!![],'where':_0x2f0db7[_0xb1b0('0x16')]?_0x2f0db7[_0xb1b0('0x16')]['where']||null:null,'attributes':_0x2f0db7['options']?_0x2f0db7['options'][_0xb1b0('0x18')]||null:null,'include':_0x2f0db7['options']?_0x2f0db7[_0xb1b0('0x16')][_0xb1b0('0x19')]?_[_0xb1b0('0x1a')](_0x2f0db7[_0xb1b0('0x16')][_0xb1b0('0x19')],function(_0x201829){return{'model':db[_0x201829[_0xb1b0('0x1b')]],'as':_0x201829['as'],'attributes':_0x201829[_0xb1b0('0x18')],'include':_0x201829[_0xb1b0('0x19')]?_[_0xb1b0('0x1a')](_0x201829[_0xb1b0('0x19')],function(_0x2d5c3c){return{'model':db[_0x2d5c3c['model']],'as':_0x2d5c3c['as'],'attributes':_0x2d5c3c[_0xb1b0('0x18')],'include':_0x2d5c3c['include']?_['map'](_0x2d5c3c['include'],function(_0x566046){return{'model':db[_0x566046['model']],'as':_0x566046['as'],'attributes':_0x566046[_0xb1b0('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb1b0('0xc')](function(_0x35f81b){logger[_0xb1b0('0xd')](_0xb1b0('0x14'),_0x2f0db7);logger[_0xb1b0('0x1c')]('ShowSetting',_0x2f0db7,JSON[_0xb1b0('0x10')](_0x35f81b));_0x29409d(_0x35f81b);})[_0xb1b0('0x1d')](function(_0x46e70e){logger[_0xb1b0('0x11')](_0xb1b0('0x14'),_0x46e70e[_0xb1b0('0x12')],_0x2f0db7);_0x590e3e(_0x358fb0[_0xb1b0('0x11')](0x1f4,_0x46e70e[_0xb1b0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 0fe3b87..c28c775 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 _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x4427a0,_0x39edb4){var _0x2a9ccf=function(_0x39e02b){while(--_0x39e02b){_0x4427a0['push'](_0x4427a0['shift']());}};_0x2a9ccf(++_0x39edb4);}(_0x326f,0xd1));var _0xf326=function(_0x42eccb,_0x14ea31){_0x42eccb=_0x42eccb-0x0;var _0x29963e=_0x326f[_0x42eccb];return _0x29963e;};'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',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file +var _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x262417,_0x9b9f85){var _0x4404f7=function(_0x13354f){while(--_0x13354f){_0x262417['push'](_0x262417['shift']());}};_0x4404f7(++_0x9b9f85);}(_0x5fab,0x177));var _0xb5fa=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0x5fab[_0x4ac48d];return _0x7537af;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index bd1a093..e6c68cc 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 _0xe778=['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','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','intelepeer','BOOLEAN'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xe778,0x192));var _0x8e77=function(_0x3a7abb,_0x216dfd){_0x3a7abb=_0x3a7abb-0x0;var _0x10091c=_0xe778[_0x3a7abb];return _0x10091c;};'use strict';var Sequelize=require(_0x8e77('0x0'));var rs=require(_0x8e77('0x1'));module[_0x8e77('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x8e77('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8e77('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x8e77('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8e77('0x5')]();}},'phone':{'type':Sequelize[_0x8e77('0x4')]},'type':{'type':Sequelize[_0x8e77('0x6')](_0x8e77('0x7'),_0x8e77('0x8'),_0x8e77('0x9'),_0x8e77('0xa'),_0x8e77('0xb'),_0x8e77('0xc'),'bandwidth',_0x8e77('0xd'),'infobip',_0x8e77('0xe'))},'accountSid':{'type':Sequelize[_0x8e77('0x4')]},'authId':{'type':Sequelize[_0x8e77('0x4')]},'authToken':{'type':Sequelize[_0x8e77('0x4')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x8e77('0x4')]},'password':{'type':Sequelize[_0x8e77('0x4')]},'apiKey':{'type':Sequelize[_0x8e77('0x4')]},'applicationId':{'type':Sequelize[_0x8e77('0x4')]},'accountId':{'type':Sequelize[_0x8e77('0x4')]},'senderString':{'type':Sequelize[_0x8e77('0x4')]},'deliveryReport':{'type':Sequelize[_0x8e77('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x8e77('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8e77('0x10');}},'notificationSound':{'type':Sequelize[_0x8e77('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8e77('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8e77('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8e77('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8e77('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8e77('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8e77('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8e77('0x11')],'comment':_0x8e77('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8e77('0x13'),'set':function(_0x58b9c6){if(!_0x58b9c6)this[_0x8e77('0x14')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x8e77('0x15'),_0x58b9c6);}}}; \ No newline at end of file +var _0xab55=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','twilio','skebby','plivo','clickatell','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0xab55,0x192));var _0x5ab5=function(_0x1d0860,_0x555637){_0x1d0860=_0x1d0860-0x0;var _0x543edf=_0xab55[_0x1d0860];return _0x543edf;};'use strict';var Sequelize=require(_0x5ab5('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x5ab5('0x1')],'unique':_0x5ab5('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x5ab5('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x5ab5('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x5ab5('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x5ab5('0x1')]},'type':{'type':Sequelize[_0x5ab5('0x3')](_0x5ab5('0x4'),_0x5ab5('0x5'),'connectel','clicksend',_0x5ab5('0x6'),_0x5ab5('0x7'),_0x5ab5('0x8'),_0x5ab5('0x9'),_0x5ab5('0xa'),_0x5ab5('0xb'))},'accountSid':{'type':Sequelize[_0x5ab5('0x1')]},'authId':{'type':Sequelize[_0x5ab5('0x1')]},'authToken':{'type':Sequelize[_0x5ab5('0x1')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5ab5('0x1')]},'apiKey':{'type':Sequelize[_0x5ab5('0x1')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x5ab5('0x1')]},'senderString':{'type':Sequelize[_0x5ab5('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x5ab5('0x1')]},'notificationTemplate':{'type':Sequelize[_0x5ab5('0xc')],'defaultValue':function(){return _0x5ab5('0xd');}},'notificationSound':{'type':Sequelize[_0x5ab5('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5ab5('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5ab5('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5ab5('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5ab5('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5ab5('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5ab5('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5ab5('0xf')],'comment':_0x5ab5('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x5ab5('0xe')],'defaultValue':![],'comment':_0x5ab5('0x11'),'set':function(_0x394c9c){if(!_0x394c9c)this[_0x5ab5('0x12')](_0x5ab5('0x13'),null);this[_0x5ab5('0x12')](_0x5ab5('0x14'),_0x394c9c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 98cba33..56c2360 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 _0x94a7=['statusInt','message_id','status_code','groupName','DELIVERED','clicksend','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','SmsAccounts','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','order','rows','removeDispositions','ids','SmsAccountId','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','Contacts','DESC','list','defaults','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','twilio','Content-Type','send','\x0a','sequelize','Transaction','ISOLATION_LEVELS','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid'];(function(_0x58ad1b,_0x51dd18){var _0x2c8123=function(_0x19fed5){while(--_0x19fed5){_0x58ad1b['push'](_0x58ad1b['shift']());}};_0x2c8123(++_0x51dd18);}(_0x94a7,0x1eb));var _0x794a=function(_0x41e4e9,_0x1f4109){_0x41e4e9=_0x41e4e9-0x0;var _0x1c94f5=_0x94a7[_0x41e4e9];return _0x1c94f5;};'use strict';var emlformat=require(_0x794a('0x0'));var rimraf=require(_0x794a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x794a('0x2'));var rp=require(_0x794a('0x3'));var moment=require(_0x794a('0x4'));var BPromise=require(_0x794a('0x5'));var Mustache=require(_0x794a('0x6'));var util=require(_0x794a('0x7'));var path=require('path');var sox=require(_0x794a('0x8'));var csv=require(_0x794a('0x9'));var ejs=require(_0x794a('0xa'));var fs=require('fs');var fs_extra=require(_0x794a('0xb'));var _=require(_0x794a('0xc'));var squel=require(_0x794a('0xd'));var crypto=require(_0x794a('0xe'));var jsforce=require(_0x794a('0xf'));var deskjs=require(_0x794a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x794a('0x11'));var Papa=require('papaparse');var Redis=require(_0x794a('0x12'));var authService=require(_0x794a('0x13'));var qs=require(_0x794a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x794a('0x15'));var logger=require('../../config/logger')(_0x794a('0x16'));var utils=require(_0x794a('0x17'));var config=require(_0x794a('0x18'));var licenseUtil=require(_0x794a('0x19'));var db=require(_0x794a('0x1a'))['db'];config[_0x794a('0x1b')]=_['defaults'](config[_0x794a('0x1b')],{'host':_0x794a('0x1c'),'port':0x18eb});var socket=require(_0x794a('0x1d'))(new Redis(config[_0x794a('0x1b')]));require(_0x794a('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x794a('0x1f')][_0x794a('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x32e501,_0x42d72a,_0x31a4b7,_0x300733){return new BPromise(function(_0x15ea52,_0x28962b){var _0xde1f12=_0x300733||client;return _0xde1f12[_0x794a('0x21')](_0x32e501,_0x31a4b7)['then'](function(_0x3ed4d6){logger[_0x794a('0x22')](_0x794a('0x23'),_0x42d72a,_0x794a('0x24'));logger[_0x794a('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x42d72a,'request\x20sent',JSON['stringify'](_0x3ed4d6));if(_0x3ed4d6[_0x794a('0x26')]){if(_0x3ed4d6[_0x794a('0x26')][_0x794a('0x27')]===0x1f4){logger[_0x794a('0x26')](_0x794a('0x23'),_0x42d72a,_0x3ed4d6[_0x794a('0x26')][_0x794a('0x28')]);return _0x28962b(_0x3ed4d6[_0x794a('0x26')][_0x794a('0x28')]);}logger[_0x794a('0x26')](_0x794a('0x23'),_0x42d72a,_0x3ed4d6[_0x794a('0x26')][_0x794a('0x28')]);return _0x15ea52(_0x3ed4d6['error'][_0x794a('0x28')]);}else{logger['info'](_0x794a('0x23'),_0x42d72a,_0x794a('0x24'));_0x15ea52(_0x3ed4d6[_0x794a('0x29')]['message']);}})['catch'](function(_0x521365){logger[_0x794a('0x26')](_0x794a('0x23'),_0x42d72a,_0x521365);_0x28962b(_0x521365);});});}function respondWithStatusCode(_0x4a23f8,_0x293c7c){_0x293c7c=_0x293c7c||0xcc;return function(_0x3bb6eb){if(_0x3bb6eb){return _0x4a23f8[_0x794a('0x2a')](_0x293c7c);}return _0x4a23f8[_0x794a('0x2b')](_0x293c7c)[_0x794a('0x2c')]();};}function respondWithResult(_0x4d6827,_0x3a129a){_0x3a129a=_0x3a129a||0xc8;return function(_0x30e9bf){if(_0x30e9bf){return _0x4d6827[_0x794a('0x2b')](_0x3a129a)[_0x794a('0x2d')](_0x30e9bf);}};}function respondWithFilteredResult(_0x1bd3cd,_0x3e4663){return function(_0x48d06b){if(_0x48d06b){var _0x469591=typeof _0x3e4663[_0x794a('0x2e')]==='undefined'&&typeof _0x3e4663[_0x794a('0x2f')]===_0x794a('0x30');var _0x1b9a62=_0x48d06b[_0x794a('0x31')];var _0x50e0de=_0x469591?0x0:_0x3e4663['offset'];var _0x21326e=_0x469591?_0x48d06b[_0x794a('0x31')]:_0x3e4663[_0x794a('0x2e')]+_0x3e4663['limit'];var _0x571df6;if(_0x21326e>=_0x1b9a62){_0x21326e=_0x1b9a62;_0x571df6=0xc8;}else{_0x571df6=0xce;}_0x1bd3cd['status'](_0x571df6);return _0x1bd3cd[_0x794a('0x32')](_0x794a('0x33'),_0x50e0de+'-'+_0x21326e+'/'+_0x1b9a62)[_0x794a('0x2d')](_0x48d06b);}return null;};}function patchUpdates(_0x43f48e){return function(_0x22f972){try{jsonpatch[_0x794a('0x34')](_0x22f972,_0x43f48e,!![]);}catch(_0x2ec6e6){return BPromise[_0x794a('0x35')](_0x2ec6e6);}return _0x22f972[_0x794a('0x36')]();};}function saveUpdates(_0x5ad488,_0x3a8c6c){return function(_0x4606b6){if(_0x4606b6){return _0x4606b6[_0x794a('0x37')](_0x5ad488)[_0x794a('0x38')](function(_0x366eda){return _0x366eda;});}return null;};}function removeEntity(_0x180ed3,_0x27e05d){return function(_0x12f5a1){if(_0x12f5a1){return _0x12f5a1[_0x794a('0x39')]()[_0x794a('0x38')](function(){var _0x146ced=_0x12f5a1['get']({'plain':!![]});var _0x35ce60=_0x794a('0x3a');return db['UserProfileResource'][_0x794a('0x39')]({'where':{'type':_0x35ce60,'resourceId':_0x146ced['id']}})[_0x794a('0x38')](function(){return _0x12f5a1;});})[_0x794a('0x38')](function(){_0x180ed3[_0x794a('0x2b')](0xcc)[_0x794a('0x2c')]();});}};}function handleEntityNotFound(_0x549e92,_0x26a64a){return function(_0x4834ef){if(!_0x4834ef){_0x549e92[_0x794a('0x2a')](0x194);}return _0x4834ef;};}function handleError(_0x25e848,_0x273c9a){_0x273c9a=_0x273c9a||0x1f4;return function(_0x33a8f3){logger[_0x794a('0x26')](_0x33a8f3[_0x794a('0x3b')]);if(_0x33a8f3[_0x794a('0x3c')]){delete _0x33a8f3[_0x794a('0x3c')];}_0x25e848[_0x794a('0x2b')](_0x273c9a)['send'](_0x33a8f3);};}exports['index']=function(_0x435773,_0x1cf834){var _0x3eba9c={'include':[{'model':db[_0x794a('0x3d')],'as':_0x794a('0x3e')}]},_0x5bb4bc={},_0x4388bb={'count':0x0,'rows':[]};var _0x56c84f=_[_0x794a('0x3f')](db[_0x794a('0x40')][_0x794a('0x41')],function(_0x31930c){return{'name':_0x31930c[_0x794a('0x42')],'type':_0x31930c[_0x794a('0x43')][_0x794a('0x44')]};});_0x5bb4bc[_0x794a('0x45')]=_[_0x794a('0x3f')](_0x56c84f,'name');_0x5bb4bc[_0x794a('0x46')]=_[_0x794a('0x47')](_0x435773[_0x794a('0x46')]);_0x5bb4bc[_0x794a('0x48')]=_[_0x794a('0x49')](_0x5bb4bc[_0x794a('0x45')],_0x5bb4bc[_0x794a('0x46')]);_0x3eba9c[_0x794a('0x4a')]=_[_0x794a('0x49')](_0x5bb4bc[_0x794a('0x45')],qs[_0x794a('0x4b')](_0x435773[_0x794a('0x46')][_0x794a('0x4b')]));_0x3eba9c[_0x794a('0x4a')]=_0x3eba9c[_0x794a('0x4a')][_0x794a('0x4c')]?_0x3eba9c[_0x794a('0x4a')]:_0x5bb4bc[_0x794a('0x45')];if(!_0x435773['query'][_0x794a('0x4d')](_0x794a('0x4e'))){_0x3eba9c[_0x794a('0x2f')]=qs['limit'](_0x435773['query'][_0x794a('0x2f')]);_0x3eba9c[_0x794a('0x2e')]=qs['offset'](_0x435773[_0x794a('0x46')][_0x794a('0x2e')]);}_0x3eba9c['order']=qs[_0x794a('0x4f')](_0x435773[_0x794a('0x46')][_0x794a('0x4f')]);_0x3eba9c[_0x794a('0x50')]=qs['filters'](_[_0x794a('0x51')](_0x435773['query'],_0x5bb4bc['filters']),_0x56c84f);if(_0x435773[_0x794a('0x46')][_0x794a('0x52')]){_0x3eba9c['where']=_[_0x794a('0x53')](_0x3eba9c[_0x794a('0x50')],{'$or':_[_0x794a('0x3f')](_0x56c84f,function(_0x2ce0b7){if(_0x2ce0b7[_0x794a('0x43')]!==_0x794a('0x54')){var _0x4cb1af={};_0x4cb1af[_0x2ce0b7[_0x794a('0x3c')]]={'$like':'%'+_0x435773[_0x794a('0x46')][_0x794a('0x52')]+'%'};return _0x4cb1af;}})});}_0x3eba9c=_[_0x794a('0x53')]({},_0x3eba9c,_0x435773[_0x794a('0x55')]);var _0x6b228c={'where':_0x3eba9c['where']};return db[_0x794a('0x40')][_0x794a('0x31')](_0x6b228c)[_0x794a('0x38')](function(_0x1f97d3){_0x4388bb['count']=_0x1f97d3;if(_0x435773[_0x794a('0x46')][_0x794a('0x56')]){_0x3eba9c[_0x794a('0x57')]=[{'all':!![]}];}return db[_0x794a('0x40')][_0x794a('0x58')](_0x3eba9c);})[_0x794a('0x38')](function(_0x3fa0f3){_0x4388bb['rows']=_0x3fa0f3;return _0x4388bb;})[_0x794a('0x38')](respondWithFilteredResult(_0x1cf834,_0x3eba9c))['catch'](handleError(_0x1cf834,null));};exports[_0x794a('0x59')]=function(_0x24e7f8,_0xfe3e2d){var _0x4fa3b9={'raw':![],'where':{'id':_0x24e7f8[_0x794a('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x794a('0x3e')}]},_0x5c414d={};_0x5c414d[_0x794a('0x45')]=_['keys'](db[_0x794a('0x40')][_0x794a('0x41')]);_0x5c414d[_0x794a('0x46')]=_[_0x794a('0x47')](_0x24e7f8['query']);_0x5c414d[_0x794a('0x48')]=_[_0x794a('0x49')](_0x5c414d[_0x794a('0x45')],_0x5c414d[_0x794a('0x46')]);_0x4fa3b9['attributes']=_[_0x794a('0x49')](_0x5c414d['model'],qs[_0x794a('0x4b')](_0x24e7f8[_0x794a('0x46')][_0x794a('0x4b')]));_0x4fa3b9['attributes']=_0x4fa3b9[_0x794a('0x4a')][_0x794a('0x4c')]?_0x4fa3b9[_0x794a('0x4a')]:_0x5c414d[_0x794a('0x45')];if(_0x24e7f8[_0x794a('0x46')][_0x794a('0x56')]){_0x4fa3b9[_0x794a('0x57')]=[{'all':!![]}];}_0x4fa3b9=_['merge']({},_0x4fa3b9,_0x24e7f8[_0x794a('0x55')]);return db['SmsAccount']['find'](_0x4fa3b9)[_0x794a('0x38')](handleEntityNotFound(_0xfe3e2d,null))[_0x794a('0x38')](respondWithResult(_0xfe3e2d,null))[_0x794a('0x5b')](handleError(_0xfe3e2d,null));};exports[_0x794a('0x5c')]=function(_0x4db406,_0x1cbca1){return db[_0x794a('0x40')][_0x794a('0x5c')](_0x4db406[_0x794a('0x5d')],{})[_0x794a('0x38')](function(_0x17c5a6){var _0x56712c=_0x4db406['user'][_0x794a('0x5e')]({'plain':!![]});if(!_0x56712c)throw new Error(_0x794a('0x5f'));if(_0x56712c['role']===_0x794a('0x60')){var _0x3e30b4=_0x17c5a6['get']({'plain':!![]});var _0x8c0607=_0x794a('0x3a');return db[_0x794a('0x61')][_0x794a('0x62')]({'where':{'name':_0x8c0607,'userProfileId':_0x56712c['userProfileId']},'raw':!![]})[_0x794a('0x38')](function(_0x526127){if(_0x526127&&_0x526127[_0x794a('0x63')]===0x0){return db[_0x794a('0x64')][_0x794a('0x5c')]({'name':_0x3e30b4[_0x794a('0x3c')],'resourceId':_0x3e30b4['id'],'type':_0x526127['name'],'sectionId':_0x526127['id']},{})[_0x794a('0x38')](function(){return _0x17c5a6;});}else{return _0x17c5a6;}})[_0x794a('0x5b')](function(_0x11359e){logger[_0x794a('0x26')](_0x794a('0x65'),_0x11359e);throw _0x11359e;});}return _0x17c5a6;})[_0x794a('0x38')](respondWithResult(_0x1cbca1,0xc9))[_0x794a('0x5b')](handleError(_0x1cbca1,null));};exports[_0x794a('0x37')]=function(_0x1fad54,_0x23eb11){if(_0x1fad54[_0x794a('0x5d')]['id']){delete _0x1fad54[_0x794a('0x5d')]['id'];}return db[_0x794a('0x40')][_0x794a('0x62')]({'where':{'id':_0x1fad54[_0x794a('0x5a')]['id']},'include':[{'model':db[_0x794a('0x3d')],'as':_0x794a('0x3e')}]})[_0x794a('0x38')](handleEntityNotFound(_0x23eb11,null))['then'](saveUpdates(_0x1fad54['body'],null))[_0x794a('0x38')](respondWithResult(_0x23eb11,null))[_0x794a('0x5b')](handleError(_0x23eb11,null));};exports['destroy']=function(_0x521f54,_0x442e6c){return db['SmsAccount'][_0x794a('0x62')]({'where':{'id':_0x521f54['params']['id']}})['then'](handleEntityNotFound(_0x442e6c,null))['then'](removeEntity(_0x442e6c,null))['catch'](handleError(_0x442e6c,null));};exports[_0x794a('0x66')]=function(_0x404088,_0x3a087d){return db[_0x794a('0x40')][_0x794a('0x66')]()[_0x794a('0x38')](respondWithResult(_0x3a087d,null))[_0x794a('0x5b')](handleError(_0x3a087d,null));};exports[_0x794a('0x67')]=function(_0x3cecf9,_0x609116,_0x3078ba){if(_0x3cecf9[_0x794a('0x5d')]['id']){delete _0x3cecf9[_0x794a('0x5d')]['id'];}return db[_0x794a('0x40')][_0x794a('0x62')]({'where':{'id':_0x3cecf9[_0x794a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x609116,null))[_0x794a('0x38')](function(_0x2a90b6){if(_0x2a90b6){_0x3cecf9[_0x794a('0x5d')]['SmsAccountId']=_0x2a90b6['id'];return db[_0x794a('0x68')][_0x794a('0x5c')](_0x3cecf9[_0x794a('0x5d')]);}})[_0x794a('0x38')](respondWithResult(_0x609116,null))[_0x794a('0x5b')](handleError(_0x609116,null));};exports[_0x794a('0x69')]=function(_0x580a63,_0x17ce5b,_0x5e676d){var _0x1e71ec={'raw':![],'where':{}};var _0x14be2b={};var _0x473eef={'count':0x0,'rows':[]};return db['SmsAccount'][_0x794a('0x6a')]({'where':{'id':_0x580a63[_0x794a('0x5a')]['id']}})[_0x794a('0x38')](handleEntityNotFound(_0x17ce5b,null))[_0x794a('0x38')](function(_0x35d9d7){if(_0x35d9d7){_0x14be2b[_0x794a('0x45')]=_[_0x794a('0x47')](db[_0x794a('0x68')]['rawAttributes']);_0x14be2b[_0x794a('0x46')]=_[_0x794a('0x47')](_0x580a63['query']);_0x14be2b[_0x794a('0x48')]=_[_0x794a('0x49')](_0x14be2b[_0x794a('0x45')],_0x14be2b['query']);_0x1e71ec[_0x794a('0x4a')]=_[_0x794a('0x49')](_0x14be2b[_0x794a('0x45')],qs[_0x794a('0x4b')](_0x580a63['query'][_0x794a('0x4b')]));_0x1e71ec['attributes']=_0x1e71ec[_0x794a('0x4a')][_0x794a('0x4c')]?_0x1e71ec[_0x794a('0x4a')]:_0x14be2b[_0x794a('0x45')];if(!_0x580a63['query'][_0x794a('0x4d')](_0x794a('0x4e'))){_0x1e71ec[_0x794a('0x2f')]=qs[_0x794a('0x2f')](_0x580a63[_0x794a('0x46')][_0x794a('0x2f')]);_0x1e71ec[_0x794a('0x2e')]=qs[_0x794a('0x2e')](_0x580a63['query'][_0x794a('0x2e')]);}_0x1e71ec[_0x794a('0x6b')]=qs[_0x794a('0x4f')](_0x580a63['query'][_0x794a('0x4f')]);_0x1e71ec[_0x794a('0x50')]=qs[_0x794a('0x48')](_[_0x794a('0x51')](_0x580a63['query'],_0x14be2b[_0x794a('0x48')]));_0x1e71ec[_0x794a('0x50')]['SmsAccountId']=_0x35d9d7['id'];if(_0x580a63[_0x794a('0x46')][_0x794a('0x52')]){_0x1e71ec['where']=_[_0x794a('0x53')](_0x1e71ec[_0x794a('0x50')],{'$or':_[_0x794a('0x3f')](_0x1e71ec[_0x794a('0x4a')],function(_0x5c6f13){var _0xb2e038={};_0xb2e038[_0x5c6f13]={'$like':'%'+_0x580a63[_0x794a('0x46')][_0x794a('0x52')]+'%'};return _0xb2e038;})});}_0x1e71ec=_[_0x794a('0x53')]({},_0x1e71ec,_0x580a63['options']);return db[_0x794a('0x68')][_0x794a('0x31')]({'where':_0x1e71ec['where']})[_0x794a('0x38')](function(_0x645cf3){_0x473eef['count']=_0x645cf3;if(_0x580a63[_0x794a('0x46')]['includeAll']){_0x1e71ec['include']=[{'all':!![]}];}return db[_0x794a('0x68')][_0x794a('0x58')](_0x1e71ec);})['then'](function(_0x2871df){_0x473eef[_0x794a('0x6c')]=_0x2871df;return _0x473eef;});}})['then'](respondWithFilteredResult(_0x17ce5b,_0x1e71ec))[_0x794a('0x5b')](handleError(_0x17ce5b,null));};exports[_0x794a('0x6d')]=function(_0x15b807,_0x19817c,_0x1b0741){return db[_0x794a('0x40')][_0x794a('0x62')]({'where':{'id':_0x15b807[_0x794a('0x5a')]['id']}})[_0x794a('0x38')](handleEntityNotFound(_0x19817c,null))[_0x794a('0x38')](function(_0x16e7e8){if(_0x16e7e8){return _0x16e7e8[_0x794a('0x6d')](_0x15b807[_0x794a('0x46')][_0x794a('0x6e')]);}})[_0x794a('0x38')](respondWithStatusCode(_0x19817c,null))[_0x794a('0x5b')](handleError(_0x19817c,null));};exports['addAnswer']=function(_0x301b99,_0x4a27bd,_0x1e124b){if(_0x301b99[_0x794a('0x5d')]['id']){delete _0x301b99[_0x794a('0x5d')]['id'];}return db[_0x794a('0x40')]['find']({'where':{'id':_0x301b99[_0x794a('0x5a')]['id']}})[_0x794a('0x38')](handleEntityNotFound(_0x4a27bd,null))[_0x794a('0x38')](function(_0x4d9d70){if(_0x4d9d70){_0x301b99[_0x794a('0x5d')][_0x794a('0x6f')]=_0x4d9d70['id'];return db[_0x794a('0x70')][_0x794a('0x5c')](_0x301b99[_0x794a('0x5d')]);}})[_0x794a('0x38')](respondWithResult(_0x4a27bd,null))[_0x794a('0x5b')](handleError(_0x4a27bd,null));};exports[_0x794a('0x71')]=function(_0x5918f3,_0x81c80a,_0x290cc1){var _0x4d9441={'raw':![],'where':{}};var _0x25b53c={};var _0x58ec9b={'count':0x0,'rows':[]};return db[_0x794a('0x40')][_0x794a('0x6a')]({'where':{'id':_0x5918f3[_0x794a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x81c80a,null))[_0x794a('0x38')](function(_0xe8384a){if(_0xe8384a){_0x25b53c['model']=_[_0x794a('0x47')](db[_0x794a('0x70')][_0x794a('0x41')]);_0x25b53c[_0x794a('0x46')]=_[_0x794a('0x47')](_0x5918f3[_0x794a('0x46')]);_0x25b53c[_0x794a('0x48')]=_['intersection'](_0x25b53c['model'],_0x25b53c[_0x794a('0x46')]);_0x4d9441[_0x794a('0x4a')]=_[_0x794a('0x49')](_0x25b53c[_0x794a('0x45')],qs['fields'](_0x5918f3[_0x794a('0x46')][_0x794a('0x4b')]));_0x4d9441[_0x794a('0x4a')]=_0x4d9441['attributes'][_0x794a('0x4c')]?_0x4d9441[_0x794a('0x4a')]:_0x25b53c[_0x794a('0x45')];if(!_0x5918f3[_0x794a('0x46')][_0x794a('0x4d')](_0x794a('0x4e'))){_0x4d9441['limit']=qs[_0x794a('0x2f')](_0x5918f3[_0x794a('0x46')][_0x794a('0x2f')]);_0x4d9441[_0x794a('0x2e')]=qs['offset'](_0x5918f3[_0x794a('0x46')][_0x794a('0x2e')]);}_0x4d9441[_0x794a('0x6b')]=qs[_0x794a('0x4f')](_0x5918f3['query'][_0x794a('0x4f')]);_0x4d9441['where']=qs[_0x794a('0x48')](_[_0x794a('0x51')](_0x5918f3[_0x794a('0x46')],_0x25b53c[_0x794a('0x48')]));_0x4d9441[_0x794a('0x50')][_0x794a('0x6f')]=_0xe8384a['id'];if(_0x5918f3[_0x794a('0x46')][_0x794a('0x52')]){_0x4d9441[_0x794a('0x50')]=_['merge'](_0x4d9441[_0x794a('0x50')],{'$or':_[_0x794a('0x3f')](_0x4d9441[_0x794a('0x4a')],function(_0x5e0308){var _0x59480e={};_0x59480e[_0x5e0308]={'$like':'%'+_0x5918f3[_0x794a('0x46')][_0x794a('0x52')]+'%'};return _0x59480e;})});}_0x4d9441=_[_0x794a('0x53')]({},_0x4d9441,_0x5918f3[_0x794a('0x55')]);return db[_0x794a('0x70')][_0x794a('0x31')]({'where':_0x4d9441['where']})[_0x794a('0x38')](function(_0x4d1fc2){_0x58ec9b[_0x794a('0x31')]=_0x4d1fc2;if(_0x5918f3[_0x794a('0x46')][_0x794a('0x56')]){_0x4d9441[_0x794a('0x57')]=[{'all':!![]}];}return db[_0x794a('0x70')][_0x794a('0x58')](_0x4d9441);})[_0x794a('0x38')](function(_0x4b9895){_0x58ec9b[_0x794a('0x6c')]=_0x4b9895;return _0x58ec9b;});}})['then'](respondWithFilteredResult(_0x81c80a,_0x4d9441))[_0x794a('0x5b')](handleError(_0x81c80a,null));};exports[_0x794a('0x72')]=function(_0x5a5364,_0x432f9f,_0x428b83){return db['SmsAccount'][_0x794a('0x62')]({'where':{'id':_0x5a5364[_0x794a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x432f9f,null))[_0x794a('0x38')](function(_0x1b3c98){if(_0x1b3c98){return _0x1b3c98[_0x794a('0x72')](_0x5a5364[_0x794a('0x46')][_0x794a('0x6e')]);}})['then'](respondWithStatusCode(_0x432f9f,null))[_0x794a('0x5b')](handleError(_0x432f9f,null));};exports[_0x794a('0x73')]=function(_0x4a1197,_0x5b1f6f,_0x206f6c){var _0x31a59e={'channel':_0x794a('0x74')};var _0x9f7e25=[];var _0x4e1a28=[];var _0xf5a183={};return db['SmsAccount'][_0x794a('0x62')]({'where':{'id':_0x4a1197['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x794a('0x75')}]})[_0x794a('0x38')](handleEntityNotFound(_0x5b1f6f,null))[_0x794a('0x38')](function(_0x159699){_0x31a59e[_0x794a('0x76')]=_0x159699;_0x31a59e[_0x794a('0x77')]=_[_0x794a('0x78')](_0x159699['Applications'],[_0x794a('0x79')],['asc']);if(_0x31a59e[_0x794a('0x76')]['Applications']){delete _0x31a59e[_0x794a('0x76')][_0x794a('0x75')];}return db['CmContact']['describe']();})[_0x794a('0x38')](function(_0x4fb11c){if(!_0x4fb11c){throw new db[(_0x794a('0x7a'))][(_0x794a('0x7b'))](_0x794a('0x7c'));}_0x9f7e25=_[_0x794a('0x7d')](_['keys'](_0x4fb11c),['createdAt',_0x794a('0x7e')]);_0x4e1a28=_['difference'](_[_0x794a('0x47')](_0x4fb11c),[_0x794a('0x7f'),'updatedAt',_0x794a('0x80'),_0x794a('0x81')]);_0x31a59e[_0x794a('0x5d')]={'mapKey':_0x794a('0x82')};if(_0x31a59e[_0x794a('0x76')][_0x794a('0x43')]){switch(_0x31a59e[_0x794a('0x76')][_0x794a('0x43')]){case'twilio':_0x31a59e[_0x794a('0x5d')][_0x794a('0x83')]=_0x4a1197['body'][_0x794a('0x84')];_0x31a59e[_0x794a('0x5d')]['body']=_0x4a1197[_0x794a('0x5d')][_0x794a('0x85')];_0x31a59e['body'][_0x794a('0x86')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x87')];break;case _0x794a('0x88'):_0x31a59e[_0x794a('0x5d')][_0x794a('0x83')]='+'+_0x4a1197[_0x794a('0x5d')][_0x794a('0x89')];_0x31a59e[_0x794a('0x5d')][_0x794a('0x5d')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x8a')];break;case _0x794a('0x8b'):_0x31a59e['body'][_0x794a('0x83')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x83')];_0x31a59e[_0x794a('0x5d')][_0x794a('0x5d')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x28')];break;case'clicksend':_0x31a59e[_0x794a('0x5d')][_0x794a('0x83')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x83')];_0x31a59e[_0x794a('0x5d')][_0x794a('0x5d')]=_0x4a1197[_0x794a('0x5d')]['body'];_0x31a59e['body'][_0x794a('0x86')]=_0x4a1197[_0x794a('0x5d')]['message_id'];break;case _0x794a('0x8c'):_0x31a59e[_0x794a('0x5d')]['from']=_0x4a1197[_0x794a('0x5d')]['From'];_0x31a59e[_0x794a('0x5d')]['body']=_0x4a1197[_0x794a('0x5d')][_0x794a('0x8d')];_0x31a59e[_0x794a('0x5d')][_0x794a('0x86')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x8e')];break;case _0x794a('0x8f'):_0x31a59e[_0x794a('0x5d')][_0x794a('0x83')]='+'+_0x4a1197['body']['results'][0x0][_0x794a('0x83')];_0x31a59e['body'][_0x794a('0x5d')]=_0x4a1197['body'][_0x794a('0x90')][0x0][_0x794a('0x8a')];_0x31a59e[_0x794a('0x5d')][_0x794a('0x86')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x90')][0x0][_0x794a('0x86')];break;case _0x794a('0x91'):_0x31a59e[_0x794a('0x5d')][_0x794a('0x83')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x92')];_0x31a59e[_0x794a('0x5d')][_0x794a('0x5d')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x93')][_0x794a('0x28')];break;case _0x794a('0x94'):_0x31a59e[_0x794a('0x5d')]['from']=_0x4a1197[_0x794a('0x5d')][_0x794a('0x95')];_0x31a59e['body']['body']=_0x4a1197[_0x794a('0x5d')][_0x794a('0x8a')];_0x31a59e[_0x794a('0x5d')][_0x794a('0x86')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x96')];break;case _0x794a('0x97'):_0x31a59e[_0x794a('0x5d')][_0x794a('0x86')]=_0x4a1197[_0x794a('0x5d')][0x0][_0x794a('0x28')]['id'];_0x31a59e['body'][_0x794a('0x83')]=_0x4a1197['body'][0x0]['message'][_0x794a('0x83')];_0x31a59e[_0x794a('0x5d')][_0x794a('0x5d')]=_0x4a1197[_0x794a('0x5d')][0x0][_0x794a('0x28')][_0x794a('0x8a')];break;case _0x794a('0x98'):_0x31a59e[_0x794a('0x5d')][_0x794a('0x83')]=_0x4a1197[_0x794a('0x5d')][_0x794a('0x83')];_0x31a59e[_0x794a('0x5d')][_0x794a('0x5d')]=_0x4a1197['body'][_0x794a('0x28')];_0x31a59e[_0x794a('0x5d')]['messageId']=_0x4a1197[_0x794a('0x5d')]['refid'];break;}}if(_0x31a59e[_0x794a('0x5d')]['id']){delete _0x31a59e[_0x794a('0x5d')]['id'];}if(_[_0x794a('0x99')](_0x31a59e[_0x794a('0x5d')]['from'])){throw new db[(_0x794a('0x7a'))][(_0x794a('0x7b'))]('from\x20is\x20mandatory');}if(_[_0x794a('0x99')](_0x31a59e['body'][_0x794a('0x5d')])||_0x31a59e[_0x794a('0x5d')][_0x794a('0x5d')]===''){throw new db[(_0x794a('0x7a'))]['ValidationError'](_0x794a('0x9a'));}if(_[_0x794a('0x99')](_0x31a59e[_0x794a('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x794a('0x7b'))](_0x794a('0x9b')+_0x4e1a28);}if(!_['includes'](_0x4e1a28,_0x31a59e[_0x794a('0x5d')]['mapKey'])){throw new db[(_0x794a('0x7a'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1a28);}_0xf5a183[_0x31a59e[_0x794a('0x5d')][_0x794a('0x9c')]]=_0x31a59e[_0x794a('0x5d')][_0x794a('0x83')];return db[_0x794a('0x9d')][_0x794a('0x62')]({'where':{'id':_0x31a59e[_0x794a('0x76')]['ListId']},'include':[{'model':db[_0x794a('0x9e')],'as':_0x794a('0x9f'),'where':_0xf5a183,'limit':0x1,'order':[[_0x794a('0x7e'),_0x794a('0xa0')]]}]});})[_0x794a('0x38')](handleEntityNotFound(_0x5b1f6f,null))[_0x794a('0x38')](function(_0x54ef99){if(_0x54ef99){_0x31a59e[_0x794a('0xa1')]=_['omit'](_0x54ef99,['Contacts']);if(_0x54ef99[_0x794a('0x9f')][_0x794a('0x4c')]){return _0x54ef99[_0x794a('0x9f')][0x0];}var _0x137662=_[_0x794a('0xa2')](_0x31a59e[_0x794a('0x5d')],{'firstName':_0x31a59e[_0x794a('0x5d')]['from'],'ListId':_0x54ef99['id']});_0x137662[_0x31a59e['body'][_0x794a('0x9c')]]=_0x31a59e[_0x794a('0x5d')][_0x794a('0x83')];return db[_0x794a('0x9e')]['create'](_0x137662,{'fields':_0x9f7e25,'raw':!![]});}})[_0x794a('0x38')](handleEntityNotFound(_0x5b1f6f,null))[_0x794a('0x38')](function(_0x444c7f){if(_0x444c7f){_0x31a59e[_0x794a('0xa3')]=_0x444c7f;var _0x58ba9d={'ContactId':_0x444c7f['id'],'phone':_0x31a59e[_0x794a('0x5d')][_0x794a('0x83')],'SmsAccountId':_0x4a1197[_0x794a('0x5a')]['id']};var _0x5abffa={'ContactId':_0x444c7f['id'],'SmsAccountId':_0x4a1197[_0x794a('0x5a')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x5abffa})[_0x794a('0x38')](function(_0x36a5ee){if(_0x36a5ee){return[_0x36a5ee,![]];}return db[_0x794a('0xa4')][_0x794a('0x5c')](_0x58ba9d)[_0x794a('0x38')](function(_0x2fea7f){return[_0x2fea7f,!![]];});});}})[_0x794a('0xa5')](function(_0x4f7bee,_0x5e62bd){_0x31a59e[_0x794a('0xa6')]=_0x4f7bee['get']({'plain':!![]});_0x31a59e['interaction']['created']=![];if(_0x5e62bd){if(_0x31a59e[_0x794a('0x76')][_0x794a('0xa7')]){_0x31a59e[_0x794a('0x77')][_0x794a('0xa8')]({'id':0x0,'priority':_0x31a59e[_0x794a('0x77')][_0x794a('0x4c')]+0x1,'app':_0x794a('0xa9'),'appdata':_0x794a('0xaa'),'interval':_0x794a('0xab')});}_0x31a59e[_0x794a('0xa6')]['created']=!![];}return db['SmsMessage']['create']({'phone':_0x31a59e[_0x794a('0x5d')][_0x794a('0x83')],'messageId':_0x31a59e['body'][_0x794a('0x86')],'body':_0x31a59e['body']['body'],'SmsAccountId':_0x4a1197[_0x794a('0x5a')]['id'],'SmsInteractionId':_0x4f7bee['id'],'direction':'in','ContactId':_0x4f7bee[_0x794a('0xac')],'AttachmentId':_0x31a59e[_0x794a('0x5d')][_0x794a('0xad')]});})[_0x794a('0x38')](function(_0x59f20f){_0x31a59e[_0x794a('0x28')]=_0x59f20f;if(_0x31a59e['interaction'][_0x794a('0xae')]){return db[_0x794a('0xaf')][_0x794a('0x62')]({'attributes':['id',_0x794a('0x3c')],'where':{'id':_0x31a59e['interaction'][_0x794a('0xae')]}})[_0x794a('0x38')](function(_0x4a3989){if(_0x4a3989){_0x31a59e[_0x794a('0x77')]['unshift']({'id':0x0,'priority':0x0,'app':_0x794a('0xb0'),'appdata':_0x4a3989[_0x794a('0x3c')]+','+(_0x31a59e[_0x794a('0x76')][_0x794a('0xb1')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x794a('0xb2'),_0x794a('0xb3'),_0x31a59e);});}return respondWithRpcPromise('Start',_0x794a('0xb3'),_0x31a59e);})[_0x794a('0x38')](function(_0x53c1f2){if(_0x53c1f2){var _0x2fc2aa=0xc8;var _0x728eea=_0x794a('0xb4');logger[_0x794a('0x22')](_0x794a('0xb5'),_0x728eea,_0x2fc2aa,'entity\x20found');logger[_0x794a('0x25')](_0x794a('0xb6'),_0x728eea,_0x2fc2aa,_0x794a('0xb7'),JSON[_0x794a('0xb8')](_0x53c1f2));if(_0x31a59e['account'][_0x794a('0x43')]===_0x794a('0xb9')){return _0x5b1f6f['status'](_0x2fc2aa)[_0x794a('0x32')](_0x794a('0xba'),'text/xml')[_0x794a('0xbb')](_0x794a('0xbc'));}else{return _0x5b1f6f['status'](_0x2fc2aa)[_0x794a('0x2d')](_0x53c1f2);}}})[_0x794a('0x5b')](handleError(_0x5b1f6f,null));};exports['addApplications']=function(_0x3edda7,_0x5a918d){var _0xff40a0=_0x3edda7[_0x794a('0x5a')]['id'];var _0x213cb1=_0x3edda7[_0x794a('0x5d')];var _0x9343ca=0xc8;var _0x3151b8=null;return db[_0x794a('0xbd')]['transaction']({'isolationLevel':db[_0x794a('0xbd')][_0x794a('0xbe')][_0x794a('0xbf')]['READ_COMMITTED']},function(_0x55d881){return db[_0x794a('0x40')][_0x794a('0x6a')]({'where':{'id':_0xff40a0},'transaction':_0x55d881})[_0x794a('0x38')](function(_0x120a94){if(_0x120a94){return db[_0x794a('0xc0')][_0x794a('0x39')]({'where':{'SmsAccountId':_0xff40a0},'transaction':_0x55d881})['then'](function(){var _0x33cd20=_[_0x794a('0x3f')](_0x213cb1,function(_0x57d729){_0x57d729['SmsAccountId']=_0xff40a0;return _0x57d729;});return db[_0x794a('0xc0')][_0x794a('0xc1')](_0x33cd20,{'transaction':_0x55d881});});}else{_0x9343ca=0x194;_0x3151b8=[];}});})[_0x794a('0x38')](function(){if(_0x9343ca!==0x194){return db[_0x794a('0xc0')][_0x794a('0xc2')]({'where':{'SmsAccountId':_0xff40a0},'order':'priority'})[_0x794a('0x38')](function(_0x27fcaa){_0x3151b8=_0x27fcaa;});}})['catch'](function(_0x58ea0d){_0x9343ca=0x1f4;logger['error'](_0x58ea0d[_0x794a('0x3b')]);if(_0x58ea0d[_0x794a('0x3c')]){delete _0x58ea0d[_0x794a('0x3c')];}_0x3151b8=_0x58ea0d;})[_0x794a('0xc3')](function(){if(_0x3151b8===null){_0x5a918d['sendStatus'](_0x9343ca);}else{if(_0x9343ca===0x1f4){_0x5a918d['status'](_0x9343ca)['send'](_0x3151b8);}else{_0x5a918d[_0x794a('0x2b')](_0x9343ca)[_0x794a('0x2d')](_0x3151b8);}}});};exports[_0x794a('0xc4')]=function(_0xef78c1,_0x2f4699,_0xfb9809){var _0x7ee27e={};var _0x6de2ca={};var _0x403f27;var _0x5afe3d;return db['SmsAccount']['findOne']({'where':{'id':_0xef78c1[_0x794a('0x5a')]['id']}})[_0x794a('0x38')](handleEntityNotFound(_0x2f4699,null))[_0x794a('0x38')](function(_0x3817a8){if(_0x3817a8){_0x403f27=_0x3817a8;_0x6de2ca[_0x794a('0x45')]=_['keys'](db[_0x794a('0xc0')]['rawAttributes']);_0x6de2ca[_0x794a('0x46')]=_[_0x794a('0x47')](_0xef78c1[_0x794a('0x46')]);_0x6de2ca[_0x794a('0x48')]=_[_0x794a('0x49')](_0x6de2ca[_0x794a('0x45')],_0x6de2ca[_0x794a('0x46')]);_0x7ee27e[_0x794a('0x4a')]=_[_0x794a('0x49')](_0x6de2ca[_0x794a('0x45')],qs['fields'](_0xef78c1[_0x794a('0x46')]['fields']));_0x7ee27e[_0x794a('0x4a')]=_0x7ee27e[_0x794a('0x4a')]['length']?_0x7ee27e['attributes']:_0x6de2ca[_0x794a('0x45')];_0x7ee27e[_0x794a('0x6b')]=qs[_0x794a('0x4f')](_0xef78c1[_0x794a('0x46')][_0x794a('0x4f')]);_0x7ee27e[_0x794a('0x50')]=qs[_0x794a('0x48')](_[_0x794a('0x51')](_0xef78c1['query'],_0x6de2ca[_0x794a('0x48')]));if(_0xef78c1['query'][_0x794a('0x52')]){_0x7ee27e[_0x794a('0x50')]=_[_0x794a('0x53')](_0x7ee27e[_0x794a('0x50')],{'$or':_[_0x794a('0x3f')](_0x7ee27e[_0x794a('0x4a')],function(_0x44808b){var _0x10baad={};_0x10baad[_0x44808b]={'$like':'%'+_0xef78c1['query'][_0x794a('0x52')]+'%'};return _0x10baad;})});}_0x7ee27e=_[_0x794a('0x53')]({},_0x7ee27e,_0xef78c1[_0x794a('0x55')]);return _0x403f27['getApplications'](_0x7ee27e);}})['then'](function(_0x479dab){if(_0x479dab){_0x5afe3d=_0x479dab[_0x794a('0x4c')];if(!_0xef78c1['query'][_0x794a('0x4d')](_0x794a('0x4e'))){_0x7ee27e[_0x794a('0x2f')]=qs[_0x794a('0x2f')](_0xef78c1[_0x794a('0x46')][_0x794a('0x2f')]);_0x7ee27e[_0x794a('0x2e')]=qs['offset'](_0xef78c1[_0x794a('0x46')]['offset']);}return _0x403f27[_0x794a('0xc4')](_0x7ee27e);}})['then'](function(_0xbddc05){if(_0xbddc05){return _0xbddc05?{'count':_0x5afe3d,'rows':_0xbddc05}:null;}})['then'](respondWithResult(_0x2f4699,null))[_0x794a('0x5b')](handleError(_0x2f4699,null));};exports[_0x794a('0xc5')]=function(_0x3ca04f,_0x47473f,_0x434ca5){var _0x56ea71={'raw':![],'where':{}};var _0x31ba37={};var _0x9d4689={'count':0x0,'rows':[]};return db[_0x794a('0x40')][_0x794a('0x6a')]({'where':{'id':_0x3ca04f[_0x794a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x47473f,null))[_0x794a('0x38')](function(_0x438893){if(_0x438893){_0x31ba37[_0x794a('0x45')]=_[_0x794a('0x47')](db['SmsInteraction']['rawAttributes']);_0x31ba37['query']=_[_0x794a('0x47')](_0x3ca04f[_0x794a('0x46')]);_0x31ba37['filters']=_['intersection'](_0x31ba37[_0x794a('0x45')],_0x31ba37[_0x794a('0x46')]);_0x56ea71[_0x794a('0x4a')]=_[_0x794a('0x49')](_0x31ba37[_0x794a('0x45')],qs[_0x794a('0x4b')](_0x3ca04f[_0x794a('0x46')]['fields']));_0x56ea71['attributes']=_0x56ea71[_0x794a('0x4a')][_0x794a('0x4c')]?_0x56ea71['attributes']:_0x31ba37[_0x794a('0x45')];if(!_0x3ca04f[_0x794a('0x46')][_0x794a('0x4d')]('nolimit')){_0x56ea71[_0x794a('0x2f')]=qs[_0x794a('0x2f')](_0x3ca04f[_0x794a('0x46')]['limit']);_0x56ea71[_0x794a('0x2e')]=qs[_0x794a('0x2e')](_0x3ca04f['query'][_0x794a('0x2e')]);}_0x56ea71[_0x794a('0x6b')]=qs[_0x794a('0x4f')](_0x3ca04f[_0x794a('0x46')][_0x794a('0x4f')]);_0x56ea71[_0x794a('0x50')]=qs[_0x794a('0x48')](_[_0x794a('0x51')](_0x3ca04f[_0x794a('0x46')],_0x31ba37['filters']));_0x56ea71[_0x794a('0x50')]['SmsAccountId']=_0x438893['id'];if(_0x3ca04f[_0x794a('0x46')]['filter']){_0x56ea71[_0x794a('0x50')]=_['merge'](_0x56ea71['where'],{'$or':_[_0x794a('0x3f')](_0x56ea71[_0x794a('0x4a')],function(_0x20d866){var _0x367217={};_0x367217[_0x20d866]={'$like':'%'+_0x3ca04f[_0x794a('0x46')]['filter']+'%'};return _0x367217;})});}_0x56ea71=_[_0x794a('0x53')]({},_0x56ea71,_0x3ca04f['options']);return db[_0x794a('0xa4')]['count']({'where':_0x56ea71[_0x794a('0x50')]})[_0x794a('0x38')](function(_0x30b675){_0x9d4689['count']=_0x30b675;if(_0x3ca04f[_0x794a('0x46')][_0x794a('0x56')]){_0x56ea71[_0x794a('0x57')]=[{'model':db[_0x794a('0x9e')],'as':_0x794a('0xc6'),'required':![]},{'model':db['User'],'as':_0x794a('0xc7'),'attributes':['name',_0x794a('0xc8'),_0x794a('0xc9')],'required':![]},{'model':db[_0x794a('0xca')],'as':_0x794a('0xcb'),'attributes':['id',_0x794a('0x3c'),'color'],'where':_0x3ca04f[_0x794a('0x46')][_0x794a('0xcc')]?{'id':_0x3ca04f[_0x794a('0x46')][_0x794a('0xcc')]}:undefined,'required':_0x3ca04f[_0x794a('0x46')][_0x794a('0xcc')]?!![]:![]}];}return db[_0x794a('0xa4')]['findAll'](_0x56ea71);})[_0x794a('0x38')](function(_0x45c45e){_0x9d4689[_0x794a('0x6c')]=_0x45c45e;return _0x9d4689;});}})['then'](respondWithFilteredResult(_0x47473f,_0x56ea71))[_0x794a('0x5b')](handleError(_0x47473f,null));};exports[_0x794a('0xbb')]=function(_0x50bd93,_0x37af5e,_0xd580e6){var _0x45b20f,_0x5a7406,_0x4582d8;if(_['isNil'](_0x50bd93[_0x794a('0x5d')][_0x794a('0x5d')])||_0x50bd93[_0x794a('0x5d')]['body']===''){throw new db[(_0x794a('0x7a'))]['ValidationError'](_0x794a('0x9a'));}if(_[_0x794a('0x99')](_0x50bd93[_0x794a('0x5d')]['to'])){throw new db[(_0x794a('0x7a'))][(_0x794a('0x7b'))]('to\x20is\x20mandatory');}_0x45b20f=_0x50bd93[_0x794a('0x5d')]['to'];return db[_0x794a('0x40')]['find']({'where':{'id':_0x50bd93[_0x794a('0x5a')]['id']},'include':[{'model':db[_0x794a('0x9d')],'as':_0x794a('0xcd'),'include':[{'model':db[_0x794a('0x9e')],'as':_0x794a('0x9f'),'where':{'mobile':_0x45b20f},'limit':0x1,'order':[['updatedAt',_0x794a('0xa0')]]}]}]})[_0x794a('0x38')](handleEntityNotFound(_0x37af5e,null))[_0x794a('0x38')](function(_0x239f24){if(_0x239f24&&_0x239f24[_0x794a('0xcd')]){_0x5a7406=_0x239f24[_0x794a('0x5e')]({'plain':!![]});if(_0x5a7406[_0x794a('0xcd')]&&_0x5a7406[_0x794a('0xcd')][_0x794a('0x9f')][_0x794a('0x4c')]){return _0x5a7406[_0x794a('0xcd')][_0x794a('0x9f')][0x0];}return db[_0x794a('0x9e')]['create'](_[_0x794a('0xa2')](_0x50bd93['body'],{'firstName':_0x45b20f,'mobile':_0x45b20f,'phone':_0x45b20f,'ListId':_0x5a7406[_0x794a('0x81')]}));}})[_0x794a('0x38')](handleEntityNotFound(_0x37af5e,null))[_0x794a('0x38')](function(_0x2554f9){if(_0x2554f9){_0x4582d8=_0x2554f9;return db[_0x794a('0xa4')]['find']({'where':{'ContactId':_0x4582d8['id'],'closed':![],'SmsAccountId':_0x5a7406['id']}})['then'](function(_0x1e994b){if(_0x1e994b){return[_0x1e994b,![]];}return db[_0x794a('0xa4')][_0x794a('0x5c')]({'UserId':_0x50bd93[_0x794a('0x60')]['id'],'ContactId':_0x4582d8['id'],'SmsAccountId':_0x5a7406['id'],'phone':_0x45b20f,'firstMsgDirection':_0x794a('0xce'),'Messages':[_[_0x794a('0x53')](_0x50bd93[_0x794a('0x5d')],{'read':![],'body':_0x50bd93['body'][_0x794a('0x5d')],'phone':_0x45b20f,'SmsAccountId':_0x5a7406['id'],'UserId':_0x50bd93[_0x794a('0x60')]['id'],'ContactId':_0x4582d8['id']})]},{'include':[{'model':db[_0x794a('0xcf')],'as':_0x794a('0xd0')}]})[_0x794a('0x38')](function(_0x4e2714){return[_0x4e2714,!![]];});});}})[_0x794a('0xa5')](function(_0x44d515,_0x3ec44d){if(_0x3ec44d){return _0x44d515;}return db[_0x794a('0xcf')]['create'](_[_0x794a('0x53')](_0x50bd93[_0x794a('0x5d')],{'read':![],'body':_0x50bd93[_0x794a('0x5d')][_0x794a('0x5d')],'phone':_0x45b20f,'SmsAccountId':_0x5a7406['id'],'SmsInteractionId':_0x44d515['id'],'UserId':_0x50bd93[_0x794a('0x60')]['id'],'ContactId':_0x4582d8['id']}))['then'](function(_0x3c2a79){_0x44d515['dataValues']['Messages']=[];_0x44d515['dataValues'][_0x794a('0xd0')][_0x794a('0xa8')](_0x3c2a79[_0x794a('0xd1')]);return _0x44d515;});})['then'](respondWithResult(_0x37af5e,null))['catch'](handleError(_0x37af5e,null));};exports[_0x794a('0x2b')]=function(_0x439668,_0x31cf29,_0x128961){if(_0x439668[_0x794a('0x5d')]['id']){delete _0x439668[_0x794a('0x5d')]['id'];}var _0x32adce,_0x5f2422,_0x54954d;return db[_0x794a('0x40')][_0x794a('0x62')]({'where':{'id':_0x439668['params']['id']}})[_0x794a('0x38')](handleEntityNotFound(_0x31cf29,null))[_0x794a('0x38')](function(_0x56735c){if(_0x56735c){_0x54954d=_0x56735c;logger[_0x794a('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x794a('0x2b'),_0x794a('0xd2'),_0x56735c[_0x794a('0x43')],util[_0x794a('0xd3')](_0x439668[_0x794a('0x5d')],{'showHidden':![],'depth':null}));switch(_0x56735c[_0x794a('0x43')]){case _0x794a('0x88'):if(_0x439668['body'][_0x794a('0xd4')]&&_0x439668[_0x794a('0x5d')]['status']){_0x5f2422=_0x439668[_0x794a('0x5d')][_0x794a('0x2b')];return db['SmsMessage'][_0x794a('0x62')]({'where':{'messageId':_0x439668[_0x794a('0x5d')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x439668[_0x794a('0x5d')][_0x794a('0xd5')]&&_0x439668[_0x794a('0x5d')]['statusInt']){_0x5f2422=_0x439668[_0x794a('0x5d')][_0x794a('0xd6')];return db[_0x794a('0xcf')][_0x794a('0x62')]({'where':{'messageId':_0x439668['body'][_0x794a('0xd5')]}});}break;case'clicksend':if(_0x439668[_0x794a('0x5d')][_0x794a('0xd7')]&&_0x439668[_0x794a('0x5d')][_0x794a('0xd8')]){_0x5f2422=_0x439668[_0x794a('0x5d')][_0x794a('0xd8')];return db[_0x794a('0xcf')][_0x794a('0x62')]({'where':{'messageId':_0x439668[_0x794a('0x5d')][_0x794a('0xd7')]}});}break;case _0x794a('0x8f'):var _0x4a15b5=_0x439668[_0x794a('0x5d')][_0x794a('0x90')][0x0];if(_0x4a15b5['messageId']&&_0x4a15b5['status'][_0x794a('0xd9')]===_0x794a('0xda')){_0x5f2422=_0x4a15b5[_0x794a('0x2b')][_0x794a('0xd9')];return db[_0x794a('0xcf')][_0x794a('0x62')]({'where':{'messageId':_0x4a15b5[_0x794a('0x86')]}});}break;case _0x794a('0x94'):if(_0x439668['body'][_0x794a('0x86')]&&_0x439668[_0x794a('0x5d')]['status']){_0x5f2422=_0x439668[_0x794a('0x5d')][_0x794a('0x2b')];return db['SmsMessage'][_0x794a('0x62')]({'where':{'messageId':_0x439668['body'][_0x794a('0x86')]}});}break;case _0x794a('0x97'):if(_0x439668[_0x794a('0x5d')][0x0][_0x794a('0x28')]['id']){_0x5f2422=_0x439668[_0x794a('0x5d')][0x0][_0x794a('0x43')];return db['SmsMessage'][_0x794a('0x62')]({'where':{'messageId':_0x439668[_0x794a('0x5d')][0x0][_0x794a('0x28')]['id']}});}break;case _0x794a('0x98'):if(_0x439668[_0x794a('0x5d')]['redif']&&_0x439668[_0x794a('0x5d')]['status']){_0x5f2422=_0x439668[_0x794a('0x5d')]['status'];return db[_0x794a('0xcf')][_0x794a('0x62')]({'where':{'messageId':_0x439668[_0x794a('0x5d')]['redif']}});}break;}}})[_0x794a('0x38')](handleEntityNotFound(_0x31cf29,null))[_0x794a('0x38')](function(_0xa26988){if(_0xa26988){_0x32adce=_0xa26988;switch(_0x54954d['type']){case _0x794a('0x88'):if(_0x5f2422===_0x794a('0xda')){return _0x32adce[_0x794a('0x37')]({'read':!![]});}else{logger[_0x794a('0x26')](_0x794a('0xb5'),_0x794a('0x2b'),'skebby',util[_0x794a('0xd3')](_0x439668[_0x794a('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x794a('0x8b'):if(_0x5f2422==='1'){return _0x32adce['update']({'read':!![]});}else{logger['error'](_0x794a('0xb5'),_0x794a('0x2b'),'skebby',util[_0x794a('0xd3')](_0x439668[_0x794a('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x794a('0xdb'):if(!_0x439668[_0x794a('0x5d')][_0x794a('0xdc')]&&_0x5f2422>=0xc8&&_0x5f2422<=0xce){return _0x32adce[_0x794a('0x37')]({'read':!![]});}else{logger['error'](_0x794a('0xb5'),_0x794a('0x2b'),_0x794a('0xdb'),util[_0x794a('0xd3')](_0x439668['body'],{'showHidden':![],'depth':null}));}break;case _0x794a('0x8f'):var _0xf84313=_0x439668[_0x794a('0x5d')][_0x794a('0x90')][0x0];if(_0xf84313[_0x794a('0x2b')]['groupName']==='DELIVERED'){return _0x32adce[_0x794a('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x794a('0x8f'),util[_0x794a('0xd3')](_0x439668['body'],{'showHidden':![],'depth':null}));}break;case _0x794a('0x94'):if(_0x5f2422==_0x794a('0xdd')||_0x5f2422==_0x794a('0xde')){return _0x32adce[_0x794a('0x37')]({'read':!![]});}else{logger[_0x794a('0x26')](_0x794a('0xb5'),'status',_0x794a('0x94'),util[_0x794a('0xd3')](_0x439668[_0x794a('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x794a('0x97'):if(_0x5f2422=='message-delivered'){return _0x32adce['update']({'read':!![]});}else{logger[_0x794a('0x26')](_0x794a('0xb5'),_0x794a('0x2b'),_0x794a('0x97'),util[_0x794a('0xd3')](_0x439668[_0x794a('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x794a('0x98'):if(_0x5f2422===_0x794a('0xdf')||_0x5f2422===_0x794a('0xe0')){return _0x32adce[_0x794a('0x37')]({'read':!![]});}else{logger[_0x794a('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x794a('0x2b'),_0x794a('0x98'),util[_0x794a('0xd3')](_0x439668[_0x794a('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x32adce;}})[_0x794a('0x38')](respondWithResult(_0x31cf29,null))[_0x794a('0x5b')](handleError(_0x31cf29,null));};exports[_0x794a('0xe1')]=function(_0x1a65a4,_0x264215,_0x5c9aab){var _0x38ecff,_0x3be678,_0x557ab2;return db[_0x794a('0x40')][_0x794a('0x62')]({'where':{'id':_0x1a65a4[_0x794a('0x5a')]['id']}})[_0x794a('0x38')](handleEntityNotFound(_0x264215,null))['then'](function(_0x34449f){if(_0x34449f){_0x557ab2=_0x34449f;logger[_0x794a('0x25')](_0x794a('0xb5'),_0x794a('0x2b'),'received\x20delivery\x20report\x20from',_0x34449f[_0x794a('0x43')],util[_0x794a('0xd3')](_0x1a65a4[_0x794a('0x46')],{'showHidden':![],'depth':null}));switch(_0x34449f[_0x794a('0x43')]){case _0x794a('0x91'):if(_0x1a65a4['query'][_0x794a('0xe2')]&&_0x1a65a4['query'][_0x794a('0xe3')]){_0x3be678=_0x1a65a4[_0x794a('0x46')][_0x794a('0xe3')];return db['SmsMessage']['find']({'where':{'messageId':_0x1a65a4['query'][_0x794a('0xe2')]}});}break;}}})[_0x794a('0x38')](handleEntityNotFound(_0x264215,null))[_0x794a('0x38')](function(_0x3605ec){if(_0x3605ec){_0x38ecff=_0x3605ec;switch(_0x557ab2[_0x794a('0x43')]){case _0x794a('0x91'):if(_0x3be678==='2'||_0x3be678==='6'){return _0x38ecff['update']({'read':!![]});}else{logger[_0x794a('0x26')](_0x794a('0xb5'),_0x794a('0x2b'),_0x794a('0x91'),util[_0x794a('0xd3')](_0x1a65a4[_0x794a('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x38ecff;}})[_0x794a('0x38')](respondWithResult(_0x264215,null))['catch'](handleError(_0x264215,null));};exports[_0x794a('0xe4')]=function(_0x3330dd,_0x4bb4e0,_0x45368c){return db[_0x794a('0x40')][_0x794a('0x62')]({'where':{'id':_0x3330dd[_0x794a('0x5a')]['id']}})[_0x794a('0x38')](handleEntityNotFound(_0x4bb4e0,null))[_0x794a('0x38')](function(_0x1cfd2f){if(_0x1cfd2f){return _0x1cfd2f[_0x794a('0xe4')](_0x3330dd[_0x794a('0x5d')]['ids'],_['omit'](_0x3330dd[_0x794a('0x5d')],[_0x794a('0x6e'),'id'])||{})[_0x794a('0xa5')](function(_0x263c14){for(var _0x2ec597=0x0;_0x2ec597<_0x3330dd['body'][_0x794a('0x6e')][_0x794a('0x4c')];_0x2ec597+=0x1){socket[_0x794a('0xe5')](_0x794a('0xe6'),{'UserId':Number(_0x3330dd[_0x794a('0x5d')][_0x794a('0x6e')][_0x2ec597]),'SmsAccountId':Number(_0x3330dd['params']['id'])});}return _0x263c14;});}})['then'](respondWithResult(_0x4bb4e0,null))[_0x794a('0x5b')](handleError(_0x4bb4e0,null));};exports[_0x794a('0xe7')]=function(_0x2eb3a6,_0x4e7a2e,_0x57767d){return db[_0x794a('0x40')][_0x794a('0x62')]({'where':{'id':_0x2eb3a6['params']['id']}})[_0x794a('0x38')](handleEntityNotFound(_0x4e7a2e,null))[_0x794a('0x38')](function(_0x5dea43){if(_0x5dea43){return _0x5dea43[_0x794a('0xe7')](_0x2eb3a6['query'][_0x794a('0x6e')])[_0x794a('0x38')](function(){if(_[_0x794a('0xe8')](_0x2eb3a6[_0x794a('0x46')][_0x794a('0x6e')])){for(var _0x343249=0x0;_0x343249<_0x2eb3a6[_0x794a('0x46')]['ids']['length'];_0x343249+=0x1){socket['emit'](_0x794a('0xe9'),{'UserId':Number(_0x2eb3a6['query'][_0x794a('0x6e')][_0x343249]),'SmsAccountId':Number(_0x2eb3a6[_0x794a('0x5a')]['id'])});}}else{socket[_0x794a('0xe5')](_0x794a('0xe9'),{'UserId':Number(_0x2eb3a6['query'][_0x794a('0x6e')]),'SmsAccountId':Number(_0x2eb3a6['params']['id'])});}});}})[_0x794a('0x38')](respondWithStatusCode(_0x4e7a2e,null))[_0x794a('0x5b')](handleError(_0x4e7a2e,null));};exports['getAgents']=function(_0x16635f,_0x3449ba,_0x57ee5c){var _0x3eb415={};var _0x128b9d={};var _0xd2225b;var _0x45c681;return db['SmsAccount'][_0x794a('0x6a')]({'where':{'id':_0x16635f['params']['id']}})[_0x794a('0x38')](handleEntityNotFound(_0x3449ba,null))[_0x794a('0x38')](function(_0x6a6680){if(_0x6a6680){_0xd2225b=_0x6a6680;_0x128b9d[_0x794a('0x45')]=_[_0x794a('0x47')](db[_0x794a('0xaf')][_0x794a('0x41')]);_0x128b9d[_0x794a('0x46')]=_[_0x794a('0x47')](_0x16635f[_0x794a('0x46')]);_0x128b9d['filters']=_[_0x794a('0x49')](_0x128b9d['model'],_0x128b9d[_0x794a('0x46')]);_0x3eb415[_0x794a('0x4a')]=_[_0x794a('0x49')](_0x128b9d['model'],qs['fields'](_0x16635f[_0x794a('0x46')][_0x794a('0x4b')]));_0x3eb415[_0x794a('0x4a')]=_0x3eb415[_0x794a('0x4a')][_0x794a('0x4c')]?_0x3eb415[_0x794a('0x4a')]:_0x128b9d['model'];_0x3eb415[_0x794a('0x6b')]=qs[_0x794a('0x4f')](_0x16635f[_0x794a('0x46')]['sort']);_0x3eb415[_0x794a('0x50')]=qs[_0x794a('0x48')](_[_0x794a('0x51')](_0x16635f[_0x794a('0x46')],_0x128b9d[_0x794a('0x48')]));if(_0x16635f['query'][_0x794a('0x52')]){_0x3eb415[_0x794a('0x50')]=_[_0x794a('0x53')](_0x3eb415[_0x794a('0x50')],{'$or':_[_0x794a('0x3f')](_0x3eb415['attributes'],function(_0x96ff75){var _0x49a11e={};_0x49a11e[_0x96ff75]={'$like':'%'+_0x16635f['query'][_0x794a('0x52')]+'%'};return _0x49a11e;})});}_0x3eb415=_['merge']({},_0x3eb415,_0x16635f[_0x794a('0x55')]);return _0xd2225b[_0x794a('0xea')](_0x3eb415);}})['then'](function(_0x37e00a){if(_0x37e00a){_0x45c681=_0x37e00a[_0x794a('0x4c')];if(!_0x16635f[_0x794a('0x46')][_0x794a('0x4d')]('nolimit')){_0x3eb415[_0x794a('0x2f')]=qs[_0x794a('0x2f')](_0x16635f[_0x794a('0x46')]['limit']);_0x3eb415[_0x794a('0x2e')]=qs[_0x794a('0x2e')](_0x16635f['query'][_0x794a('0x2e')]);}return _0xd2225b[_0x794a('0xea')](_0x3eb415);}})[_0x794a('0x38')](function(_0x36919d){if(_0x36919d){return _0x36919d?{'count':_0x45c681,'rows':_0x36919d}:null;}})['then'](respondWithResult(_0x3449ba,null))[_0x794a('0x5b')](handleError(_0x3449ba,null));}; \ No newline at end of file +var _0xb943=['set','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','rawAttributes','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','orderBy','priority','asc','Sequelize','ValidationError','difference','createdAt','CompanyId','mobile','Body','MessageSid','skebby','from','text','messageId','message_id','plivo','From','Text','MessageUUID','infobip','results','segmentedMessage','clickatell','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','ListId','CmContact','updatedAt','DESC','list','omit','Contacts','SmsInteraction','interaction','created','autoclose','push','close','SmsMessage','ContactId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','\x0a','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','tag','List','out','spread','dataValues','Messages','inspect','skebby_dispatch_id','connectel','statusInt','requestid','status_code','groupName','DELIVERED','bandwidth','redif','clicksend','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','offset','undefined','limit'];(function(_0x513441,_0x20bfba){var _0x5a49c8=function(_0x2cc7d9){while(--_0x2cc7d9){_0x513441['push'](_0x513441['shift']());}};_0x5a49c8(++_0x20bfba);}(_0xb943,0x19e));var _0x3b94=function(_0x1412f8,_0x5a4782){_0x1412f8=_0x1412f8-0x0;var _0x5b0803=_0xb943[_0x1412f8];return _0x5b0803;};'use strict';var emlformat=require(_0x3b94('0x0'));var rimraf=require(_0x3b94('0x1'));var zipdir=require(_0x3b94('0x2'));var jsonpatch=require(_0x3b94('0x3'));var rp=require('request-promise');var moment=require(_0x3b94('0x4'));var BPromise=require(_0x3b94('0x5'));var Mustache=require(_0x3b94('0x6'));var util=require(_0x3b94('0x7'));var path=require('path');var sox=require(_0x3b94('0x8'));var csv=require(_0x3b94('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b94('0xa'));var squel=require(_0x3b94('0xb'));var crypto=require('crypto');var jsforce=require(_0x3b94('0xc'));var deskjs=require(_0x3b94('0xd'));var toCsv=require(_0x3b94('0x9'));var querystring=require(_0x3b94('0xe'));var Papa=require(_0x3b94('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b94('0x10'));var as=require(_0x3b94('0x11'));var hardwareService=require(_0x3b94('0x12'));var logger=require(_0x3b94('0x13'))(_0x3b94('0x14'));var utils=require(_0x3b94('0x15'));var config=require(_0x3b94('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b94('0x17'))['db'];config[_0x3b94('0x18')]=_[_0x3b94('0x19')](config[_0x3b94('0x18')],{'host':_0x3b94('0x1a'),'port':0x18eb});var socket=require(_0x3b94('0x1b'))(new Redis(config[_0x3b94('0x18')]));require(_0x3b94('0x1c'))[_0x3b94('0x1d')](socket);var jayson=require(_0x3b94('0x1e'));var client=jayson[_0x3b94('0x1f')][_0x3b94('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x51cad8,_0x4d35ce,_0x76a2c5,_0x178a6a){return new BPromise(function(_0x28afea,_0x49fd62){var _0x1e18bf=_0x178a6a||client;return _0x1e18bf[_0x3b94('0x21')](_0x51cad8,_0x76a2c5)[_0x3b94('0x22')](function(_0x4ba995){logger[_0x3b94('0x23')](_0x3b94('0x24'),_0x4d35ce,_0x3b94('0x25'));logger[_0x3b94('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d35ce,_0x3b94('0x25'),JSON[_0x3b94('0x27')](_0x4ba995));if(_0x4ba995[_0x3b94('0x28')]){if(_0x4ba995[_0x3b94('0x28')][_0x3b94('0x29')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4d35ce,_0x4ba995[_0x3b94('0x28')][_0x3b94('0x2a')]);return _0x49fd62(_0x4ba995[_0x3b94('0x28')][_0x3b94('0x2a')]);}logger[_0x3b94('0x28')](_0x3b94('0x24'),_0x4d35ce,_0x4ba995[_0x3b94('0x28')][_0x3b94('0x2a')]);return _0x28afea(_0x4ba995[_0x3b94('0x28')][_0x3b94('0x2a')]);}else{logger[_0x3b94('0x23')](_0x3b94('0x24'),_0x4d35ce,_0x3b94('0x25'));_0x28afea(_0x4ba995[_0x3b94('0x2b')][_0x3b94('0x2a')]);}})['catch'](function(_0x327d32){logger[_0x3b94('0x28')](_0x3b94('0x24'),_0x4d35ce,_0x327d32);_0x49fd62(_0x327d32);});});}function respondWithStatusCode(_0x378337,_0x73bd91){_0x73bd91=_0x73bd91||0xcc;return function(_0x119932){if(_0x119932){return _0x378337['sendStatus'](_0x73bd91);}return _0x378337[_0x3b94('0x2c')](_0x73bd91)[_0x3b94('0x2d')]();};}function respondWithResult(_0x145d88,_0x4a5cb4){_0x4a5cb4=_0x4a5cb4||0xc8;return function(_0x353b9b){if(_0x353b9b){return _0x145d88[_0x3b94('0x2c')](_0x4a5cb4)[_0x3b94('0x2e')](_0x353b9b);}};}function respondWithFilteredResult(_0x10f3b0,_0x4bc253){return function(_0x366982){if(_0x366982){var _0xb9ddbd=typeof _0x4bc253[_0x3b94('0x2f')]===_0x3b94('0x30')&&typeof _0x4bc253[_0x3b94('0x31')]===_0x3b94('0x30');var _0x55716d=_0x366982['count'];var _0x20b6d9=_0xb9ddbd?0x0:_0x4bc253[_0x3b94('0x2f')];var _0x48fa4a=_0xb9ddbd?_0x366982['count']:_0x4bc253[_0x3b94('0x2f')]+_0x4bc253['limit'];var _0x46f78e;if(_0x48fa4a>=_0x55716d){_0x48fa4a=_0x55716d;_0x46f78e=0xc8;}else{_0x46f78e=0xce;}_0x10f3b0[_0x3b94('0x2c')](_0x46f78e);return _0x10f3b0[_0x3b94('0x32')]('Content-Range',_0x20b6d9+'-'+_0x48fa4a+'/'+_0x55716d)[_0x3b94('0x2e')](_0x366982);}return null;};}function patchUpdates(_0x72eaa4){return function(_0xcd56a4){try{jsonpatch[_0x3b94('0x33')](_0xcd56a4,_0x72eaa4,!![]);}catch(_0x384252){return BPromise[_0x3b94('0x34')](_0x384252);}return _0xcd56a4[_0x3b94('0x35')]();};}function saveUpdates(_0x1bc405,_0x23237a){return function(_0x5ea45b){if(_0x5ea45b){return _0x5ea45b[_0x3b94('0x36')](_0x1bc405)[_0x3b94('0x22')](function(_0x3c5563){return _0x3c5563;});}return null;};}function removeEntity(_0x4e157d,_0x79fa46){return function(_0x5383df){if(_0x5383df){return _0x5383df['destroy']()[_0x3b94('0x22')](function(){var _0x1451d5=_0x5383df[_0x3b94('0x37')]({'plain':!![]});var _0x24443e=_0x3b94('0x38');return db[_0x3b94('0x39')][_0x3b94('0x3a')]({'where':{'type':_0x24443e,'resourceId':_0x1451d5['id']}})['then'](function(){return _0x5383df;});})[_0x3b94('0x22')](function(){_0x4e157d['status'](0xcc)[_0x3b94('0x2d')]();});}};}function handleEntityNotFound(_0x408909,_0x5ad8ee){return function(_0x2bd717){if(!_0x2bd717){_0x408909[_0x3b94('0x3b')](0x194);}return _0x2bd717;};}function handleError(_0x13dc5c,_0x487ec5){_0x487ec5=_0x487ec5||0x1f4;return function(_0x41febd){logger[_0x3b94('0x28')](_0x41febd[_0x3b94('0x3c')]);if(_0x41febd[_0x3b94('0x3d')]){delete _0x41febd[_0x3b94('0x3d')];}_0x13dc5c[_0x3b94('0x2c')](_0x487ec5)[_0x3b94('0x3e')](_0x41febd);};}exports[_0x3b94('0x3f')]=function(_0x39a649,_0x49bc06){var _0x4a3645={'include':[{'model':db[_0x3b94('0x40')],'as':_0x3b94('0x41')}]},_0x5df20b={},_0x1851d8={'count':0x0,'rows':[]};var _0x2dd330=_['map'](db[_0x3b94('0x42')]['rawAttributes'],function(_0x1b892e){return{'name':_0x1b892e[_0x3b94('0x43')],'type':_0x1b892e[_0x3b94('0x44')][_0x3b94('0x45')]};});_0x5df20b['model']=_[_0x3b94('0x46')](_0x2dd330,_0x3b94('0x3d'));_0x5df20b[_0x3b94('0x47')]=_[_0x3b94('0x48')](_0x39a649[_0x3b94('0x47')]);_0x5df20b[_0x3b94('0x49')]=_[_0x3b94('0x4a')](_0x5df20b['model'],_0x5df20b['query']);_0x4a3645[_0x3b94('0x4b')]=_[_0x3b94('0x4a')](_0x5df20b[_0x3b94('0x4c')],qs[_0x3b94('0x4d')](_0x39a649[_0x3b94('0x47')]['fields']));_0x4a3645[_0x3b94('0x4b')]=_0x4a3645[_0x3b94('0x4b')][_0x3b94('0x4e')]?_0x4a3645[_0x3b94('0x4b')]:_0x5df20b['model'];if(!_0x39a649[_0x3b94('0x47')][_0x3b94('0x4f')](_0x3b94('0x50'))){_0x4a3645[_0x3b94('0x31')]=qs[_0x3b94('0x31')](_0x39a649[_0x3b94('0x47')][_0x3b94('0x31')]);_0x4a3645[_0x3b94('0x2f')]=qs['offset'](_0x39a649['query'][_0x3b94('0x2f')]);}_0x4a3645[_0x3b94('0x51')]=qs[_0x3b94('0x52')](_0x39a649[_0x3b94('0x47')]['sort']);_0x4a3645[_0x3b94('0x53')]=qs[_0x3b94('0x49')](_['pick'](_0x39a649[_0x3b94('0x47')],_0x5df20b[_0x3b94('0x49')]),_0x2dd330);if(_0x39a649[_0x3b94('0x47')][_0x3b94('0x54')]){_0x4a3645[_0x3b94('0x53')]=_['merge'](_0x4a3645[_0x3b94('0x53')],{'$or':_[_0x3b94('0x46')](_0x2dd330,function(_0x42134f){if(_0x42134f[_0x3b94('0x44')]!==_0x3b94('0x55')){var _0x414d38={};_0x414d38[_0x42134f[_0x3b94('0x3d')]]={'$like':'%'+_0x39a649['query'][_0x3b94('0x54')]+'%'};return _0x414d38;}})});}_0x4a3645=_[_0x3b94('0x56')]({},_0x4a3645,_0x39a649[_0x3b94('0x57')]);var _0x374ed4={'where':_0x4a3645['where']};return db['SmsAccount'][_0x3b94('0x58')](_0x374ed4)[_0x3b94('0x22')](function(_0x7edb73){_0x1851d8[_0x3b94('0x58')]=_0x7edb73;if(_0x39a649['query'][_0x3b94('0x59')]){_0x4a3645['include']=[{'all':!![]}];}return db[_0x3b94('0x42')][_0x3b94('0x5a')](_0x4a3645);})[_0x3b94('0x22')](function(_0xc0b1ce){_0x1851d8[_0x3b94('0x5b')]=_0xc0b1ce;return _0x1851d8;})[_0x3b94('0x22')](respondWithFilteredResult(_0x49bc06,_0x4a3645))[_0x3b94('0x5c')](handleError(_0x49bc06,null));};exports[_0x3b94('0x5d')]=function(_0x426c9c,_0x54befc){var _0x378182={'raw':![],'where':{'id':_0x426c9c[_0x3b94('0x5e')]['id']},'include':[{'model':db[_0x3b94('0x40')],'as':_0x3b94('0x41')}]},_0x28ec14={};_0x28ec14[_0x3b94('0x4c')]=_[_0x3b94('0x48')](db[_0x3b94('0x42')]['rawAttributes']);_0x28ec14[_0x3b94('0x47')]=_[_0x3b94('0x48')](_0x426c9c['query']);_0x28ec14[_0x3b94('0x49')]=_[_0x3b94('0x4a')](_0x28ec14[_0x3b94('0x4c')],_0x28ec14[_0x3b94('0x47')]);_0x378182[_0x3b94('0x4b')]=_[_0x3b94('0x4a')](_0x28ec14['model'],qs['fields'](_0x426c9c['query']['fields']));_0x378182[_0x3b94('0x4b')]=_0x378182[_0x3b94('0x4b')][_0x3b94('0x4e')]?_0x378182[_0x3b94('0x4b')]:_0x28ec14['model'];if(_0x426c9c[_0x3b94('0x47')][_0x3b94('0x59')]){_0x378182[_0x3b94('0x5f')]=[{'all':!![]}];}_0x378182=_['merge']({},_0x378182,_0x426c9c[_0x3b94('0x57')]);return db[_0x3b94('0x42')][_0x3b94('0x60')](_0x378182)[_0x3b94('0x22')](handleEntityNotFound(_0x54befc,null))['then'](respondWithResult(_0x54befc,null))[_0x3b94('0x5c')](handleError(_0x54befc,null));};exports['create']=function(_0x4d37c9,_0x403db5){return db[_0x3b94('0x42')][_0x3b94('0x61')](_0x4d37c9[_0x3b94('0x62')],{})[_0x3b94('0x22')](function(_0x29a9e9){var _0x143bda=_0x4d37c9[_0x3b94('0x63')][_0x3b94('0x37')]({'plain':!![]});if(!_0x143bda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x143bda[_0x3b94('0x64')]===_0x3b94('0x63')){var _0x37f2f1=_0x29a9e9['get']({'plain':!![]});var _0x270074='SmsAccounts';return db[_0x3b94('0x65')]['find']({'where':{'name':_0x270074,'userProfileId':_0x143bda[_0x3b94('0x66')]},'raw':!![]})[_0x3b94('0x22')](function(_0x57188f){if(_0x57188f&&_0x57188f[_0x3b94('0x67')]===0x0){return db[_0x3b94('0x39')][_0x3b94('0x61')]({'name':_0x37f2f1['name'],'resourceId':_0x37f2f1['id'],'type':_0x57188f[_0x3b94('0x3d')],'sectionId':_0x57188f['id']},{})[_0x3b94('0x22')](function(){return _0x29a9e9;});}else{return _0x29a9e9;}})[_0x3b94('0x5c')](function(_0x5d9bd6){logger[_0x3b94('0x28')](_0x3b94('0x68'),_0x5d9bd6);throw _0x5d9bd6;});}return _0x29a9e9;})[_0x3b94('0x22')](respondWithResult(_0x403db5,0xc9))[_0x3b94('0x5c')](handleError(_0x403db5,null));};exports[_0x3b94('0x36')]=function(_0x541023,_0x5dce8d){if(_0x541023['body']['id']){delete _0x541023[_0x3b94('0x62')]['id'];}return db['SmsAccount'][_0x3b94('0x60')]({'where':{'id':_0x541023[_0x3b94('0x5e')]['id']},'include':[{'model':db[_0x3b94('0x40')],'as':'mandatoryDispositionPause'}]})[_0x3b94('0x22')](handleEntityNotFound(_0x5dce8d,null))[_0x3b94('0x22')](saveUpdates(_0x541023[_0x3b94('0x62')],null))[_0x3b94('0x22')](respondWithResult(_0x5dce8d,null))[_0x3b94('0x5c')](handleError(_0x5dce8d,null));};exports[_0x3b94('0x3a')]=function(_0x142492,_0x5a810a){return db[_0x3b94('0x42')][_0x3b94('0x60')]({'where':{'id':_0x142492[_0x3b94('0x5e')]['id']}})[_0x3b94('0x22')](handleEntityNotFound(_0x5a810a,null))['then'](removeEntity(_0x5a810a,null))['catch'](handleError(_0x5a810a,null));};exports[_0x3b94('0x69')]=function(_0x2f1845,_0x3c602d){return db[_0x3b94('0x42')][_0x3b94('0x69')]()[_0x3b94('0x22')](respondWithResult(_0x3c602d,null))[_0x3b94('0x5c')](handleError(_0x3c602d,null));};exports[_0x3b94('0x6a')]=function(_0x48b4b8,_0x391c29,_0x5eb183){if(_0x48b4b8[_0x3b94('0x62')]['id']){delete _0x48b4b8[_0x3b94('0x62')]['id'];}return db[_0x3b94('0x42')][_0x3b94('0x60')]({'where':{'id':_0x48b4b8['params']['id']}})[_0x3b94('0x22')](handleEntityNotFound(_0x391c29,null))[_0x3b94('0x22')](function(_0x3b07dc){if(_0x3b07dc){_0x48b4b8['body'][_0x3b94('0x6b')]=_0x3b07dc['id'];return db[_0x3b94('0x6c')][_0x3b94('0x61')](_0x48b4b8['body']);}})['then'](respondWithResult(_0x391c29,null))[_0x3b94('0x5c')](handleError(_0x391c29,null));};exports[_0x3b94('0x6d')]=function(_0x587a3c,_0x426027,_0x4bd153){var _0x44258c={'raw':![],'where':{}};var _0x59261b={};var _0x8dcb04={'count':0x0,'rows':[]};return db[_0x3b94('0x42')][_0x3b94('0x6e')]({'where':{'id':_0x587a3c[_0x3b94('0x5e')]['id']}})[_0x3b94('0x22')](handleEntityNotFound(_0x426027,null))[_0x3b94('0x22')](function(_0x5d7f12){if(_0x5d7f12){_0x59261b[_0x3b94('0x4c')]=_[_0x3b94('0x48')](db[_0x3b94('0x6c')]['rawAttributes']);_0x59261b['query']=_[_0x3b94('0x48')](_0x587a3c[_0x3b94('0x47')]);_0x59261b[_0x3b94('0x49')]=_[_0x3b94('0x4a')](_0x59261b['model'],_0x59261b[_0x3b94('0x47')]);_0x44258c[_0x3b94('0x4b')]=_['intersection'](_0x59261b['model'],qs[_0x3b94('0x4d')](_0x587a3c[_0x3b94('0x47')][_0x3b94('0x4d')]));_0x44258c['attributes']=_0x44258c[_0x3b94('0x4b')][_0x3b94('0x4e')]?_0x44258c['attributes']:_0x59261b[_0x3b94('0x4c')];if(!_0x587a3c[_0x3b94('0x47')][_0x3b94('0x4f')](_0x3b94('0x50'))){_0x44258c[_0x3b94('0x31')]=qs[_0x3b94('0x31')](_0x587a3c[_0x3b94('0x47')][_0x3b94('0x31')]);_0x44258c[_0x3b94('0x2f')]=qs['offset'](_0x587a3c[_0x3b94('0x47')][_0x3b94('0x2f')]);}_0x44258c[_0x3b94('0x51')]=qs[_0x3b94('0x52')](_0x587a3c['query'][_0x3b94('0x52')]);_0x44258c[_0x3b94('0x53')]=qs[_0x3b94('0x49')](_[_0x3b94('0x6f')](_0x587a3c[_0x3b94('0x47')],_0x59261b[_0x3b94('0x49')]));_0x44258c[_0x3b94('0x53')]['SmsAccountId']=_0x5d7f12['id'];if(_0x587a3c[_0x3b94('0x47')]['filter']){_0x44258c[_0x3b94('0x53')]=_['merge'](_0x44258c[_0x3b94('0x53')],{'$or':_[_0x3b94('0x46')](_0x44258c[_0x3b94('0x4b')],function(_0x15b5b7){var _0x13a559={};_0x13a559[_0x15b5b7]={'$like':'%'+_0x587a3c['query'][_0x3b94('0x54')]+'%'};return _0x13a559;})});}_0x44258c=_[_0x3b94('0x56')]({},_0x44258c,_0x587a3c[_0x3b94('0x57')]);return db[_0x3b94('0x6c')][_0x3b94('0x58')]({'where':_0x44258c[_0x3b94('0x53')]})[_0x3b94('0x22')](function(_0xb93bcc){_0x8dcb04[_0x3b94('0x58')]=_0xb93bcc;if(_0x587a3c['query']['includeAll']){_0x44258c[_0x3b94('0x5f')]=[{'all':!![]}];}return db[_0x3b94('0x6c')][_0x3b94('0x5a')](_0x44258c);})['then'](function(_0x4ce41f){_0x8dcb04[_0x3b94('0x5b')]=_0x4ce41f;return _0x8dcb04;});}})[_0x3b94('0x22')](respondWithFilteredResult(_0x426027,_0x44258c))[_0x3b94('0x5c')](handleError(_0x426027,null));};exports[_0x3b94('0x70')]=function(_0x270ca5,_0x397e11,_0x164366){return db['SmsAccount'][_0x3b94('0x60')]({'where':{'id':_0x270ca5[_0x3b94('0x5e')]['id']}})[_0x3b94('0x22')](handleEntityNotFound(_0x397e11,null))['then'](function(_0x16ce5d){if(_0x16ce5d){return _0x16ce5d[_0x3b94('0x70')](_0x270ca5[_0x3b94('0x47')]['ids']);}})[_0x3b94('0x22')](respondWithStatusCode(_0x397e11,null))[_0x3b94('0x5c')](handleError(_0x397e11,null));};exports[_0x3b94('0x71')]=function(_0x4c7700,_0x21f6bd,_0x210940){if(_0x4c7700['body']['id']){delete _0x4c7700[_0x3b94('0x62')]['id'];}return db[_0x3b94('0x42')]['find']({'where':{'id':_0x4c7700['params']['id']}})[_0x3b94('0x22')](handleEntityNotFound(_0x21f6bd,null))[_0x3b94('0x22')](function(_0x1ad904){if(_0x1ad904){_0x4c7700['body']['SmsAccountId']=_0x1ad904['id'];return db[_0x3b94('0x72')][_0x3b94('0x61')](_0x4c7700[_0x3b94('0x62')]);}})[_0x3b94('0x22')](respondWithResult(_0x21f6bd,null))[_0x3b94('0x5c')](handleError(_0x21f6bd,null));};exports[_0x3b94('0x73')]=function(_0x3838b1,_0x59750e,_0x247497){var _0x4567c2={'raw':![],'where':{}};var _0x5a1fe8={};var _0x454e9c={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3b94('0x6e')]({'where':{'id':_0x3838b1[_0x3b94('0x5e')]['id']}})['then'](handleEntityNotFound(_0x59750e,null))[_0x3b94('0x22')](function(_0x387ee1){if(_0x387ee1){_0x5a1fe8[_0x3b94('0x4c')]=_[_0x3b94('0x48')](db['CannedAnswer'][_0x3b94('0x74')]);_0x5a1fe8[_0x3b94('0x47')]=_[_0x3b94('0x48')](_0x3838b1[_0x3b94('0x47')]);_0x5a1fe8[_0x3b94('0x49')]=_['intersection'](_0x5a1fe8[_0x3b94('0x4c')],_0x5a1fe8[_0x3b94('0x47')]);_0x4567c2[_0x3b94('0x4b')]=_[_0x3b94('0x4a')](_0x5a1fe8[_0x3b94('0x4c')],qs['fields'](_0x3838b1[_0x3b94('0x47')][_0x3b94('0x4d')]));_0x4567c2[_0x3b94('0x4b')]=_0x4567c2[_0x3b94('0x4b')][_0x3b94('0x4e')]?_0x4567c2[_0x3b94('0x4b')]:_0x5a1fe8[_0x3b94('0x4c')];if(!_0x3838b1['query']['hasOwnProperty'](_0x3b94('0x50'))){_0x4567c2[_0x3b94('0x31')]=qs[_0x3b94('0x31')](_0x3838b1[_0x3b94('0x47')][_0x3b94('0x31')]);_0x4567c2[_0x3b94('0x2f')]=qs[_0x3b94('0x2f')](_0x3838b1[_0x3b94('0x47')][_0x3b94('0x2f')]);}_0x4567c2[_0x3b94('0x51')]=qs[_0x3b94('0x52')](_0x3838b1[_0x3b94('0x47')][_0x3b94('0x52')]);_0x4567c2[_0x3b94('0x53')]=qs[_0x3b94('0x49')](_[_0x3b94('0x6f')](_0x3838b1[_0x3b94('0x47')],_0x5a1fe8[_0x3b94('0x49')]));_0x4567c2[_0x3b94('0x53')][_0x3b94('0x6b')]=_0x387ee1['id'];if(_0x3838b1['query'][_0x3b94('0x54')]){_0x4567c2[_0x3b94('0x53')]=_[_0x3b94('0x56')](_0x4567c2['where'],{'$or':_[_0x3b94('0x46')](_0x4567c2[_0x3b94('0x4b')],function(_0x47c20f){var _0x35bce4={};_0x35bce4[_0x47c20f]={'$like':'%'+_0x3838b1[_0x3b94('0x47')]['filter']+'%'};return _0x35bce4;})});}_0x4567c2=_[_0x3b94('0x56')]({},_0x4567c2,_0x3838b1[_0x3b94('0x57')]);return db[_0x3b94('0x72')]['count']({'where':_0x4567c2[_0x3b94('0x53')]})[_0x3b94('0x22')](function(_0x3471fb){_0x454e9c[_0x3b94('0x58')]=_0x3471fb;if(_0x3838b1['query']['includeAll']){_0x4567c2[_0x3b94('0x5f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3b94('0x5a')](_0x4567c2);})[_0x3b94('0x22')](function(_0x2bafa0){_0x454e9c[_0x3b94('0x5b')]=_0x2bafa0;return _0x454e9c;});}})[_0x3b94('0x22')](respondWithFilteredResult(_0x59750e,_0x4567c2))[_0x3b94('0x5c')](handleError(_0x59750e,null));};exports['removeAnswers']=function(_0x23a5e7,_0x4fb9b0,_0x48b810){return db[_0x3b94('0x42')][_0x3b94('0x60')]({'where':{'id':_0x23a5e7[_0x3b94('0x5e')]['id']}})[_0x3b94('0x22')](handleEntityNotFound(_0x4fb9b0,null))[_0x3b94('0x22')](function(_0x581306){if(_0x581306){return _0x581306[_0x3b94('0x75')](_0x23a5e7[_0x3b94('0x47')][_0x3b94('0x76')]);}})[_0x3b94('0x22')](respondWithStatusCode(_0x4fb9b0,null))['catch'](handleError(_0x4fb9b0,null));};exports[_0x3b94('0x77')]=function(_0x34c5d7,_0x437878,_0x37c515){var _0x542e1e={'channel':_0x3b94('0x78')};var _0x2392d3=[];var _0x13abe3=[];var _0x40aa53={};return db[_0x3b94('0x42')][_0x3b94('0x60')]({'where':{'id':_0x34c5d7['params']['id']},'include':[{'model':db[_0x3b94('0x79')],'as':_0x3b94('0x7a')}]})[_0x3b94('0x22')](handleEntityNotFound(_0x437878,null))[_0x3b94('0x22')](function(_0x405aba){_0x542e1e[_0x3b94('0x7b')]=_0x405aba;_0x542e1e['applications']=_[_0x3b94('0x7c')](_0x405aba[_0x3b94('0x7a')],[_0x3b94('0x7d')],[_0x3b94('0x7e')]);if(_0x542e1e['account'][_0x3b94('0x7a')]){delete _0x542e1e['account'][_0x3b94('0x7a')];}return db['CmContact'][_0x3b94('0x69')]();})[_0x3b94('0x22')](function(_0x13c5db){if(!_0x13c5db){throw new db[(_0x3b94('0x7f'))][(_0x3b94('0x80'))]('no\x20available\x20attributes');}_0x2392d3=_[_0x3b94('0x81')](_[_0x3b94('0x48')](_0x13c5db),[_0x3b94('0x82'),'updatedAt']);_0x13abe3=_['difference'](_[_0x3b94('0x48')](_0x13c5db),['createdAt','updatedAt',_0x3b94('0x83'),'ListId']);_0x542e1e[_0x3b94('0x62')]={'mapKey':_0x3b94('0x84')};if(_0x542e1e[_0x3b94('0x7b')]['type']){switch(_0x542e1e[_0x3b94('0x7b')][_0x3b94('0x44')]){case'twilio':_0x542e1e[_0x3b94('0x62')]['from']=_0x34c5d7[_0x3b94('0x62')]['From'];_0x542e1e[_0x3b94('0x62')][_0x3b94('0x62')]=_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x85')];_0x542e1e[_0x3b94('0x62')]['messageId']=_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x86')];break;case _0x3b94('0x87'):_0x542e1e[_0x3b94('0x62')][_0x3b94('0x88')]='+'+_0x34c5d7[_0x3b94('0x62')]['sender'];_0x542e1e[_0x3b94('0x62')]['body']=_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x89')];break;case'connectel':_0x542e1e[_0x3b94('0x62')]['from']=_0x34c5d7['body'][_0x3b94('0x88')];_0x542e1e['body']['body']=_0x34c5d7[_0x3b94('0x62')]['message'];break;case'clicksend':_0x542e1e[_0x3b94('0x62')][_0x3b94('0x88')]=_0x34c5d7['body'][_0x3b94('0x88')];_0x542e1e[_0x3b94('0x62')][_0x3b94('0x62')]=_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x62')];_0x542e1e[_0x3b94('0x62')][_0x3b94('0x8a')]=_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x8b')];break;case _0x3b94('0x8c'):_0x542e1e[_0x3b94('0x62')][_0x3b94('0x88')]=_0x34c5d7['body'][_0x3b94('0x8d')];_0x542e1e['body'][_0x3b94('0x62')]=_0x34c5d7['body'][_0x3b94('0x8e')];_0x542e1e[_0x3b94('0x62')][_0x3b94('0x8a')]=_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x8f')];break;case _0x3b94('0x90'):_0x542e1e['body'][_0x3b94('0x88')]='+'+_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x91')][0x0]['from'];_0x542e1e[_0x3b94('0x62')][_0x3b94('0x62')]=_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x91')][0x0]['text'];_0x542e1e[_0x3b94('0x62')][_0x3b94('0x8a')]=_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x91')][0x0][_0x3b94('0x8a')];break;case'csc':_0x542e1e[_0x3b94('0x62')][_0x3b94('0x88')]=_0x34c5d7['body']['originatingAddress'];_0x542e1e[_0x3b94('0x62')][_0x3b94('0x62')]=_0x34c5d7['body'][_0x3b94('0x92')][_0x3b94('0x2a')];break;case _0x3b94('0x93'):_0x542e1e[_0x3b94('0x62')][_0x3b94('0x88')]=_0x34c5d7[_0x3b94('0x62')]['fromNumber'];_0x542e1e['body']['body']=_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x89')];_0x542e1e[_0x3b94('0x62')][_0x3b94('0x8a')]=_0x34c5d7[_0x3b94('0x62')]['replyMessageId'];break;case'bandwidth':_0x542e1e[_0x3b94('0x62')]['messageId']=_0x34c5d7['body'][0x0][_0x3b94('0x2a')]['id'];_0x542e1e[_0x3b94('0x62')]['from']=_0x34c5d7['body'][0x0][_0x3b94('0x2a')][_0x3b94('0x88')];_0x542e1e[_0x3b94('0x62')]['body']=_0x34c5d7[_0x3b94('0x62')][0x0]['message'][_0x3b94('0x89')];break;case _0x3b94('0x94'):_0x542e1e['body'][_0x3b94('0x88')]=_0x34c5d7['body'][_0x3b94('0x88')];_0x542e1e[_0x3b94('0x62')]['body']=_0x34c5d7[_0x3b94('0x62')]['message'];_0x542e1e[_0x3b94('0x62')][_0x3b94('0x8a')]=_0x34c5d7[_0x3b94('0x62')][_0x3b94('0x95')];break;}}if(_0x542e1e[_0x3b94('0x62')]['id']){delete _0x542e1e['body']['id'];}if(_[_0x3b94('0x96')](_0x542e1e['body']['from'])){throw new db[(_0x3b94('0x7f'))]['ValidationError'](_0x3b94('0x97'));}if(_[_0x3b94('0x96')](_0x542e1e[_0x3b94('0x62')]['body'])||_0x542e1e[_0x3b94('0x62')][_0x3b94('0x62')]===''){throw new db['Sequelize']['ValidationError'](_0x3b94('0x98'));}if(_[_0x3b94('0x96')](_0x542e1e[_0x3b94('0x62')]['mapKey'])){throw new db[(_0x3b94('0x7f'))][(_0x3b94('0x80'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13abe3);}if(!_[_0x3b94('0x99')](_0x13abe3,_0x542e1e[_0x3b94('0x62')]['mapKey'])){throw new db[(_0x3b94('0x7f'))][(_0x3b94('0x80'))](_0x3b94('0x9a')+_0x13abe3);}_0x40aa53[_0x542e1e[_0x3b94('0x62')][_0x3b94('0x9b')]]=_0x542e1e[_0x3b94('0x62')][_0x3b94('0x88')];return db[_0x3b94('0x9c')]['find']({'where':{'id':_0x542e1e[_0x3b94('0x7b')][_0x3b94('0x9d')]},'include':[{'model':db[_0x3b94('0x9e')],'as':'Contacts','where':_0x40aa53,'limit':0x1,'order':[[_0x3b94('0x9f'),_0x3b94('0xa0')]]}]});})['then'](handleEntityNotFound(_0x437878,null))['then'](function(_0x28f295){if(_0x28f295){_0x542e1e[_0x3b94('0xa1')]=_[_0x3b94('0xa2')](_0x28f295,[_0x3b94('0xa3')]);if(_0x28f295[_0x3b94('0xa3')][_0x3b94('0x4e')]){return _0x28f295['Contacts'][0x0];}var _0x3cd41b=_[_0x3b94('0x19')](_0x542e1e['body'],{'firstName':_0x542e1e['body'][_0x3b94('0x88')],'ListId':_0x28f295['id']});_0x3cd41b[_0x542e1e[_0x3b94('0x62')][_0x3b94('0x9b')]]=_0x542e1e[_0x3b94('0x62')][_0x3b94('0x88')];return db[_0x3b94('0x9e')]['create'](_0x3cd41b,{'fields':_0x2392d3,'raw':!![]});}})[_0x3b94('0x22')](handleEntityNotFound(_0x437878,null))[_0x3b94('0x22')](function(_0x151f03){if(_0x151f03){_0x542e1e['contact']=_0x151f03;var _0x543ae3={'ContactId':_0x151f03['id'],'phone':_0x542e1e['body'][_0x3b94('0x88')],'SmsAccountId':_0x34c5d7['params']['id']};var _0x5bb983={'ContactId':_0x151f03['id'],'SmsAccountId':_0x34c5d7[_0x3b94('0x5e')]['id'],'closed':![]};return db[_0x3b94('0xa4')]['find']({'where':_0x5bb983})[_0x3b94('0x22')](function(_0x5da6cd){if(_0x5da6cd){return[_0x5da6cd,![]];}return db['SmsInteraction'][_0x3b94('0x61')](_0x543ae3)[_0x3b94('0x22')](function(_0xc9713e){return[_0xc9713e,!![]];});});}})['spread'](function(_0x13a575,_0x5a5cbd){_0x542e1e[_0x3b94('0xa5')]=_0x13a575[_0x3b94('0x37')]({'plain':!![]});_0x542e1e[_0x3b94('0xa5')][_0x3b94('0xa6')]=![];if(_0x5a5cbd){if(_0x542e1e['account'][_0x3b94('0xa7')]){_0x542e1e['applications'][_0x3b94('0xa8')]({'id':0x0,'priority':_0x542e1e['applications'][_0x3b94('0x4e')]+0x1,'app':_0x3b94('0xa9'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x542e1e[_0x3b94('0xa5')]['created']=!![];}return db[_0x3b94('0xaa')][_0x3b94('0x61')]({'phone':_0x542e1e['body'][_0x3b94('0x88')],'messageId':_0x542e1e['body']['messageId'],'body':_0x542e1e[_0x3b94('0x62')]['body'],'SmsAccountId':_0x34c5d7['params']['id'],'SmsInteractionId':_0x13a575['id'],'direction':'in','ContactId':_0x13a575[_0x3b94('0xab')],'AttachmentId':_0x542e1e[_0x3b94('0x62')]['AttachmentId']});})[_0x3b94('0x22')](function(_0x44e8db){_0x542e1e[_0x3b94('0x2a')]=_0x44e8db;if(_0x542e1e['interaction'][_0x3b94('0xac')]){return db[_0x3b94('0xad')][_0x3b94('0x60')]({'attributes':['id','name'],'where':{'id':_0x542e1e['interaction'][_0x3b94('0xac')]}})[_0x3b94('0x22')](function(_0x4539b2){if(_0x4539b2){_0x542e1e['applications'][_0x3b94('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4539b2[_0x3b94('0x3d')]+','+(_0x542e1e['account'][_0x3b94('0xaf')]||0xa),'interval':_0x3b94('0xb0')});}return respondWithRpcPromise('Start',_0x3b94('0xb1'),_0x542e1e);});}return respondWithRpcPromise(_0x3b94('0xb2'),_0x3b94('0xb1'),_0x542e1e);})[_0x3b94('0x22')](function(_0x4218aa){if(_0x4218aa){var _0x22d392=0xc8;var _0xc49fa0=_0x3b94('0xb3');logger['info'](_0x3b94('0xb4'),_0xc49fa0,_0x22d392,_0x3b94('0xb5'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xc49fa0,_0x22d392,_0x3b94('0xb5'),JSON[_0x3b94('0x27')](_0x4218aa));if(_0x542e1e[_0x3b94('0x7b')][_0x3b94('0x44')]===_0x3b94('0xb6')){return _0x437878[_0x3b94('0x2c')](_0x22d392)[_0x3b94('0x32')](_0x3b94('0xb7'),'text/xml')['send'](_0x3b94('0xb8'));}else{return _0x437878[_0x3b94('0x2c')](_0x22d392)[_0x3b94('0x2e')](_0x4218aa);}}})[_0x3b94('0x5c')](handleError(_0x437878,null));};exports[_0x3b94('0xb9')]=function(_0x22c6cd,_0x5ab077){var _0x364e52=_0x22c6cd[_0x3b94('0x5e')]['id'];var _0x4ae6b3=_0x22c6cd['body'];var _0x420d6b=0xc8;var _0x211f48=null;return db['sequelize'][_0x3b94('0xba')]({'isolationLevel':db[_0x3b94('0xbb')][_0x3b94('0xbc')]['ISOLATION_LEVELS'][_0x3b94('0xbd')]},function(_0x2c0a8b){return db[_0x3b94('0x42')][_0x3b94('0x6e')]({'where':{'id':_0x364e52},'transaction':_0x2c0a8b})[_0x3b94('0x22')](function(_0x2bea69){if(_0x2bea69){return db[_0x3b94('0x79')][_0x3b94('0x3a')]({'where':{'SmsAccountId':_0x364e52},'transaction':_0x2c0a8b})[_0x3b94('0x22')](function(){var _0x5aeb1e=_[_0x3b94('0x46')](_0x4ae6b3,function(_0x559138){_0x559138['SmsAccountId']=_0x364e52;return _0x559138;});return db[_0x3b94('0x79')]['bulkCreate'](_0x5aeb1e,{'transaction':_0x2c0a8b});});}else{_0x420d6b=0x194;_0x211f48=[];}});})[_0x3b94('0x22')](function(){if(_0x420d6b!==0x194){return db[_0x3b94('0x79')][_0x3b94('0xbe')]({'where':{'SmsAccountId':_0x364e52},'order':_0x3b94('0x7d')})['then'](function(_0x2d8d66){_0x211f48=_0x2d8d66;});}})[_0x3b94('0x5c')](function(_0x3d3639){_0x420d6b=0x1f4;logger[_0x3b94('0x28')](_0x3d3639[_0x3b94('0x3c')]);if(_0x3d3639[_0x3b94('0x3d')]){delete _0x3d3639[_0x3b94('0x3d')];}_0x211f48=_0x3d3639;})['finally'](function(){if(_0x211f48===null){_0x5ab077['sendStatus'](_0x420d6b);}else{if(_0x420d6b===0x1f4){_0x5ab077[_0x3b94('0x2c')](_0x420d6b)['send'](_0x211f48);}else{_0x5ab077[_0x3b94('0x2c')](_0x420d6b)[_0x3b94('0x2e')](_0x211f48);}}});};exports['getApplications']=function(_0xfbe611,_0x2ae149,_0x549027){var _0x35a56e={};var _0x4d9d94={};var _0x55378c;var _0x3281aa;return db[_0x3b94('0x42')][_0x3b94('0x6e')]({'where':{'id':_0xfbe611[_0x3b94('0x5e')]['id']}})[_0x3b94('0x22')](handleEntityNotFound(_0x2ae149,null))['then'](function(_0x2c8ff6){if(_0x2c8ff6){_0x55378c=_0x2c8ff6;_0x4d9d94[_0x3b94('0x4c')]=_[_0x3b94('0x48')](db[_0x3b94('0x79')][_0x3b94('0x74')]);_0x4d9d94['query']=_[_0x3b94('0x48')](_0xfbe611[_0x3b94('0x47')]);_0x4d9d94[_0x3b94('0x49')]=_[_0x3b94('0x4a')](_0x4d9d94[_0x3b94('0x4c')],_0x4d9d94[_0x3b94('0x47')]);_0x35a56e['attributes']=_[_0x3b94('0x4a')](_0x4d9d94['model'],qs['fields'](_0xfbe611[_0x3b94('0x47')][_0x3b94('0x4d')]));_0x35a56e['attributes']=_0x35a56e[_0x3b94('0x4b')][_0x3b94('0x4e')]?_0x35a56e['attributes']:_0x4d9d94[_0x3b94('0x4c')];_0x35a56e[_0x3b94('0x51')]=qs[_0x3b94('0x52')](_0xfbe611[_0x3b94('0x47')][_0x3b94('0x52')]);_0x35a56e['where']=qs[_0x3b94('0x49')](_[_0x3b94('0x6f')](_0xfbe611[_0x3b94('0x47')],_0x4d9d94[_0x3b94('0x49')]));if(_0xfbe611[_0x3b94('0x47')][_0x3b94('0x54')]){_0x35a56e[_0x3b94('0x53')]=_[_0x3b94('0x56')](_0x35a56e[_0x3b94('0x53')],{'$or':_['map'](_0x35a56e[_0x3b94('0x4b')],function(_0x40a1ed){var _0x1ea955={};_0x1ea955[_0x40a1ed]={'$like':'%'+_0xfbe611['query'][_0x3b94('0x54')]+'%'};return _0x1ea955;})});}_0x35a56e=_[_0x3b94('0x56')]({},_0x35a56e,_0xfbe611['options']);return _0x55378c[_0x3b94('0xbf')](_0x35a56e);}})['then'](function(_0x307aa3){if(_0x307aa3){_0x3281aa=_0x307aa3['length'];if(!_0xfbe611[_0x3b94('0x47')]['hasOwnProperty'](_0x3b94('0x50'))){_0x35a56e['limit']=qs[_0x3b94('0x31')](_0xfbe611['query'][_0x3b94('0x31')]);_0x35a56e['offset']=qs[_0x3b94('0x2f')](_0xfbe611[_0x3b94('0x47')][_0x3b94('0x2f')]);}return _0x55378c[_0x3b94('0xbf')](_0x35a56e);}})['then'](function(_0x819ebb){if(_0x819ebb){return _0x819ebb?{'count':_0x3281aa,'rows':_0x819ebb}:null;}})[_0x3b94('0x22')](respondWithResult(_0x2ae149,null))[_0x3b94('0x5c')](handleError(_0x2ae149,null));};exports[_0x3b94('0xc0')]=function(_0x8e0cbd,_0x22b18e,_0x46204a){var _0x29fafe={'raw':![],'where':{}};var _0x517be2={};var _0x178d65={'count':0x0,'rows':[]};return db[_0x3b94('0x42')]['findOne']({'where':{'id':_0x8e0cbd[_0x3b94('0x5e')]['id']}})[_0x3b94('0x22')](handleEntityNotFound(_0x22b18e,null))['then'](function(_0x53b165){if(_0x53b165){_0x517be2[_0x3b94('0x4c')]=_[_0x3b94('0x48')](db[_0x3b94('0xa4')][_0x3b94('0x74')]);_0x517be2['query']=_[_0x3b94('0x48')](_0x8e0cbd[_0x3b94('0x47')]);_0x517be2[_0x3b94('0x49')]=_['intersection'](_0x517be2[_0x3b94('0x4c')],_0x517be2['query']);_0x29fafe[_0x3b94('0x4b')]=_[_0x3b94('0x4a')](_0x517be2[_0x3b94('0x4c')],qs['fields'](_0x8e0cbd[_0x3b94('0x47')]['fields']));_0x29fafe[_0x3b94('0x4b')]=_0x29fafe['attributes']['length']?_0x29fafe[_0x3b94('0x4b')]:_0x517be2[_0x3b94('0x4c')];if(!_0x8e0cbd['query']['hasOwnProperty'](_0x3b94('0x50'))){_0x29fafe[_0x3b94('0x31')]=qs[_0x3b94('0x31')](_0x8e0cbd[_0x3b94('0x47')][_0x3b94('0x31')]);_0x29fafe[_0x3b94('0x2f')]=qs[_0x3b94('0x2f')](_0x8e0cbd[_0x3b94('0x47')][_0x3b94('0x2f')]);}_0x29fafe[_0x3b94('0x51')]=qs[_0x3b94('0x52')](_0x8e0cbd[_0x3b94('0x47')][_0x3b94('0x52')]);_0x29fafe[_0x3b94('0x53')]=qs['filters'](_[_0x3b94('0x6f')](_0x8e0cbd[_0x3b94('0x47')],_0x517be2['filters']));_0x29fafe[_0x3b94('0x53')][_0x3b94('0x6b')]=_0x53b165['id'];if(_0x8e0cbd[_0x3b94('0x47')][_0x3b94('0x54')]){_0x29fafe[_0x3b94('0x53')]=_[_0x3b94('0x56')](_0x29fafe[_0x3b94('0x53')],{'$or':_['map'](_0x29fafe[_0x3b94('0x4b')],function(_0x1810cc){var _0x2aaea2={};_0x2aaea2[_0x1810cc]={'$like':'%'+_0x8e0cbd[_0x3b94('0x47')][_0x3b94('0x54')]+'%'};return _0x2aaea2;})});}_0x29fafe=_[_0x3b94('0x56')]({},_0x29fafe,_0x8e0cbd[_0x3b94('0x57')]);return db['SmsInteraction']['count']({'where':_0x29fafe[_0x3b94('0x53')]})['then'](function(_0x4faf72){_0x178d65[_0x3b94('0x58')]=_0x4faf72;if(_0x8e0cbd[_0x3b94('0x47')]['includeAll']){_0x29fafe[_0x3b94('0x5f')]=[{'model':db[_0x3b94('0x9e')],'as':_0x3b94('0xc1'),'required':![]},{'model':db['User'],'as':_0x3b94('0xc2'),'attributes':[_0x3b94('0x3d'),_0x3b94('0xc3'),_0x3b94('0xc4')],'required':![]},{'model':db[_0x3b94('0xc5')],'as':'Tags','attributes':['id',_0x3b94('0x3d'),'color'],'where':_0x8e0cbd[_0x3b94('0x47')][_0x3b94('0xc6')]?{'id':_0x8e0cbd[_0x3b94('0x47')][_0x3b94('0xc6')]}:undefined,'required':_0x8e0cbd[_0x3b94('0x47')][_0x3b94('0xc6')]?!![]:![]}];}return db[_0x3b94('0xa4')][_0x3b94('0x5a')](_0x29fafe);})[_0x3b94('0x22')](function(_0x297530){_0x178d65[_0x3b94('0x5b')]=_0x297530;return _0x178d65;});}})[_0x3b94('0x22')](respondWithFilteredResult(_0x22b18e,_0x29fafe))[_0x3b94('0x5c')](handleError(_0x22b18e,null));};exports[_0x3b94('0x3e')]=function(_0x13cf11,_0x85a171,_0x2fdead){var _0x16657e,_0x44bc86,_0x3b2300;if(_[_0x3b94('0x96')](_0x13cf11[_0x3b94('0x62')][_0x3b94('0x62')])||_0x13cf11[_0x3b94('0x62')]['body']===''){throw new db[(_0x3b94('0x7f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3b94('0x96')](_0x13cf11[_0x3b94('0x62')]['to'])){throw new db[(_0x3b94('0x7f'))][(_0x3b94('0x80'))]('to\x20is\x20mandatory');}_0x16657e=_0x13cf11[_0x3b94('0x62')]['to'];return db[_0x3b94('0x42')][_0x3b94('0x60')]({'where':{'id':_0x13cf11['params']['id']},'include':[{'model':db[_0x3b94('0x9c')],'as':_0x3b94('0xc7'),'include':[{'model':db['CmContact'],'as':_0x3b94('0xa3'),'where':{'mobile':_0x16657e},'limit':0x1,'order':[[_0x3b94('0x9f'),_0x3b94('0xa0')]]}]}]})[_0x3b94('0x22')](handleEntityNotFound(_0x85a171,null))[_0x3b94('0x22')](function(_0x532e7d){if(_0x532e7d&&_0x532e7d['List']){_0x44bc86=_0x532e7d[_0x3b94('0x37')]({'plain':!![]});if(_0x44bc86[_0x3b94('0xc7')]&&_0x44bc86[_0x3b94('0xc7')][_0x3b94('0xa3')][_0x3b94('0x4e')]){return _0x44bc86[_0x3b94('0xc7')][_0x3b94('0xa3')][0x0];}return db[_0x3b94('0x9e')][_0x3b94('0x61')](_['defaults'](_0x13cf11['body'],{'firstName':_0x16657e,'mobile':_0x16657e,'phone':_0x16657e,'ListId':_0x44bc86[_0x3b94('0x9d')]}));}})[_0x3b94('0x22')](handleEntityNotFound(_0x85a171,null))['then'](function(_0x3d9371){if(_0x3d9371){_0x3b2300=_0x3d9371;return db['SmsInteraction'][_0x3b94('0x60')]({'where':{'ContactId':_0x3b2300['id'],'closed':![],'SmsAccountId':_0x44bc86['id']}})[_0x3b94('0x22')](function(_0x32d5af){if(_0x32d5af){return[_0x32d5af,![]];}return db[_0x3b94('0xa4')][_0x3b94('0x61')]({'UserId':_0x13cf11[_0x3b94('0x63')]['id'],'ContactId':_0x3b2300['id'],'SmsAccountId':_0x44bc86['id'],'phone':_0x16657e,'firstMsgDirection':_0x3b94('0xc8'),'Messages':[_[_0x3b94('0x56')](_0x13cf11[_0x3b94('0x62')],{'read':![],'body':_0x13cf11[_0x3b94('0x62')][_0x3b94('0x62')],'phone':_0x16657e,'SmsAccountId':_0x44bc86['id'],'UserId':_0x13cf11[_0x3b94('0x63')]['id'],'ContactId':_0x3b2300['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x3b94('0x22')](function(_0x556462){return[_0x556462,!![]];});});}})[_0x3b94('0xc9')](function(_0x7c0308,_0x12917b){if(_0x12917b){return _0x7c0308;}return db['SmsMessage'][_0x3b94('0x61')](_[_0x3b94('0x56')](_0x13cf11[_0x3b94('0x62')],{'read':![],'body':_0x13cf11[_0x3b94('0x62')][_0x3b94('0x62')],'phone':_0x16657e,'SmsAccountId':_0x44bc86['id'],'SmsInteractionId':_0x7c0308['id'],'UserId':_0x13cf11[_0x3b94('0x63')]['id'],'ContactId':_0x3b2300['id']}))['then'](function(_0x519f68){_0x7c0308[_0x3b94('0xca')][_0x3b94('0xcb')]=[];_0x7c0308[_0x3b94('0xca')]['Messages'][_0x3b94('0xa8')](_0x519f68[_0x3b94('0xca')]);return _0x7c0308;});})[_0x3b94('0x22')](respondWithResult(_0x85a171,null))[_0x3b94('0x5c')](handleError(_0x85a171,null));};exports[_0x3b94('0x2c')]=function(_0x339c22,_0x1d3712,_0x3514e1){if(_0x339c22[_0x3b94('0x62')]['id']){delete _0x339c22[_0x3b94('0x62')]['id'];}var _0xdf8c6c,_0x53182f,_0x4cd913;return db[_0x3b94('0x42')][_0x3b94('0x60')]({'where':{'id':_0x339c22['params']['id']}})['then'](handleEntityNotFound(_0x1d3712,null))['then'](function(_0x10783d){if(_0x10783d){_0x4cd913=_0x10783d;logger['debug'](_0x3b94('0xb4'),_0x3b94('0x2c'),'received\x20delivery\x20report\x20from',_0x10783d['type'],util[_0x3b94('0xcc')](_0x339c22[_0x3b94('0x62')],{'showHidden':![],'depth':null}));switch(_0x10783d['type']){case'skebby':if(_0x339c22[_0x3b94('0x62')][_0x3b94('0xcd')]&&_0x339c22[_0x3b94('0x62')][_0x3b94('0x2c')]){_0x53182f=_0x339c22[_0x3b94('0x62')][_0x3b94('0x2c')];return db[_0x3b94('0xaa')][_0x3b94('0x60')]({'where':{'messageId':_0x339c22[_0x3b94('0x62')][_0x3b94('0xcd')]}});}break;case _0x3b94('0xce'):if(_0x339c22[_0x3b94('0x62')]['requestid']&&_0x339c22[_0x3b94('0x62')][_0x3b94('0xcf')]){_0x53182f=_0x339c22[_0x3b94('0x62')][_0x3b94('0xcf')];return db[_0x3b94('0xaa')][_0x3b94('0x60')]({'where':{'messageId':_0x339c22[_0x3b94('0x62')][_0x3b94('0xd0')]}});}break;case'clicksend':if(_0x339c22[_0x3b94('0x62')]['message_id']&&_0x339c22[_0x3b94('0x62')][_0x3b94('0xd1')]){_0x53182f=_0x339c22[_0x3b94('0x62')][_0x3b94('0xd1')];return db[_0x3b94('0xaa')][_0x3b94('0x60')]({'where':{'messageId':_0x339c22[_0x3b94('0x62')][_0x3b94('0x8b')]}});}break;case'infobip':var _0x3e5e8f=_0x339c22[_0x3b94('0x62')][_0x3b94('0x91')][0x0];if(_0x3e5e8f[_0x3b94('0x8a')]&&_0x3e5e8f[_0x3b94('0x2c')][_0x3b94('0xd2')]===_0x3b94('0xd3')){_0x53182f=_0x3e5e8f[_0x3b94('0x2c')][_0x3b94('0xd2')];return db[_0x3b94('0xaa')][_0x3b94('0x60')]({'where':{'messageId':_0x3e5e8f[_0x3b94('0x8a')]}});}break;case'clickatell':if(_0x339c22[_0x3b94('0x62')]['messageId']&&_0x339c22[_0x3b94('0x62')][_0x3b94('0x2c')]){_0x53182f=_0x339c22[_0x3b94('0x62')][_0x3b94('0x2c')];return db[_0x3b94('0xaa')][_0x3b94('0x60')]({'where':{'messageId':_0x339c22[_0x3b94('0x62')][_0x3b94('0x8a')]}});}break;case _0x3b94('0xd4'):if(_0x339c22[_0x3b94('0x62')][0x0]['message']['id']){_0x53182f=_0x339c22['body'][0x0][_0x3b94('0x44')];return db[_0x3b94('0xaa')][_0x3b94('0x60')]({'where':{'messageId':_0x339c22[_0x3b94('0x62')][0x0][_0x3b94('0x2a')]['id']}});}break;case'intelepeer':if(_0x339c22[_0x3b94('0x62')][_0x3b94('0xd5')]&&_0x339c22['body'][_0x3b94('0x2c')]){_0x53182f=_0x339c22['body'][_0x3b94('0x2c')];return db[_0x3b94('0xaa')][_0x3b94('0x60')]({'where':{'messageId':_0x339c22['body'][_0x3b94('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x1d3712,null))[_0x3b94('0x22')](function(_0x1e92ee){if(_0x1e92ee){_0xdf8c6c=_0x1e92ee;switch(_0x4cd913['type']){case _0x3b94('0x87'):if(_0x53182f===_0x3b94('0xd3')){return _0xdf8c6c[_0x3b94('0x36')]({'read':!![]});}else{logger[_0x3b94('0x28')](_0x3b94('0xb4'),_0x3b94('0x2c'),_0x3b94('0x87'),util[_0x3b94('0xcc')](_0x339c22[_0x3b94('0x62')],{'showHidden':![],'depth':null}));}break;case _0x3b94('0xce'):if(_0x53182f==='1'){return _0xdf8c6c[_0x3b94('0x36')]({'read':!![]});}else{logger[_0x3b94('0x28')](_0x3b94('0xb4'),_0x3b94('0x2c'),_0x3b94('0x87'),util['inspect'](_0x339c22[_0x3b94('0x62')],{'showHidden':![],'depth':null}));}break;case _0x3b94('0xd6'):if(!_0x339c22[_0x3b94('0x62')][_0x3b94('0xd7')]&&_0x53182f>=0xc8&&_0x53182f<=0xce){return _0xdf8c6c[_0x3b94('0x36')]({'read':!![]});}else{logger[_0x3b94('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3b94('0x2c'),'clicksend',util['inspect'](_0x339c22[_0x3b94('0x62')],{'showHidden':![],'depth':null}));}break;case _0x3b94('0x90'):var _0x1d146a=_0x339c22['body'][_0x3b94('0x91')][0x0];if(_0x1d146a[_0x3b94('0x2c')]['groupName']===_0x3b94('0xd3')){return _0xdf8c6c['update']({'read':!![]});}else{logger['error'](_0x3b94('0xb4'),_0x3b94('0x2c'),_0x3b94('0x90'),util['inspect'](_0x339c22[_0x3b94('0x62')],{'showHidden':![],'depth':null}));}break;case _0x3b94('0x93'):if(_0x53182f==_0x3b94('0xd8')||_0x53182f==_0x3b94('0xd9')){return _0xdf8c6c[_0x3b94('0x36')]({'read':!![]});}else{logger[_0x3b94('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3b94('0x2c'),_0x3b94('0x93'),util[_0x3b94('0xcc')](_0x339c22[_0x3b94('0x62')],{'showHidden':![],'depth':null}));}break;case _0x3b94('0xd4'):if(_0x53182f==_0x3b94('0xda')){return _0xdf8c6c['update']({'read':!![]});}else{logger[_0x3b94('0x28')](_0x3b94('0xb4'),'status',_0x3b94('0xd4'),util[_0x3b94('0xcc')](_0x339c22[_0x3b94('0x62')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x53182f===_0x3b94('0xdb')||_0x53182f===_0x3b94('0xdc')){return _0xdf8c6c[_0x3b94('0x36')]({'read':!![]});}else{logger[_0x3b94('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3b94('0x2c'),_0x3b94('0x94'),util[_0x3b94('0xcc')](_0x339c22[_0x3b94('0x62')],{'showHidden':![],'depth':null}));}break;}return _0xdf8c6c;}})[_0x3b94('0x22')](respondWithResult(_0x1d3712,null))[_0x3b94('0x5c')](handleError(_0x1d3712,null));};exports[_0x3b94('0xdd')]=function(_0x17a5b5,_0x31be8a,_0x26b242){var _0x236649,_0x3c7c53,_0x1d54e1;return db[_0x3b94('0x42')][_0x3b94('0x60')]({'where':{'id':_0x17a5b5[_0x3b94('0x5e')]['id']}})['then'](handleEntityNotFound(_0x31be8a,null))[_0x3b94('0x22')](function(_0x2f50e7){if(_0x2f50e7){_0x1d54e1=_0x2f50e7;logger[_0x3b94('0x26')](_0x3b94('0xb4'),_0x3b94('0x2c'),'received\x20delivery\x20report\x20from',_0x2f50e7[_0x3b94('0x44')],util[_0x3b94('0xcc')](_0x17a5b5[_0x3b94('0x47')],{'showHidden':![],'depth':null}));switch(_0x2f50e7[_0x3b94('0x44')]){case _0x3b94('0xde'):if(_0x17a5b5[_0x3b94('0x47')][_0x3b94('0xdf')]&&_0x17a5b5[_0x3b94('0x47')][_0x3b94('0xe0')]){_0x3c7c53=_0x17a5b5[_0x3b94('0x47')][_0x3b94('0xe0')];return db[_0x3b94('0xaa')][_0x3b94('0x60')]({'where':{'messageId':_0x17a5b5[_0x3b94('0x47')]['message-id']}});}break;}}})[_0x3b94('0x22')](handleEntityNotFound(_0x31be8a,null))[_0x3b94('0x22')](function(_0x2565c9){if(_0x2565c9){_0x236649=_0x2565c9;switch(_0x1d54e1[_0x3b94('0x44')]){case'csc':if(_0x3c7c53==='2'||_0x3c7c53==='6'){return _0x236649[_0x3b94('0x36')]({'read':!![]});}else{logger[_0x3b94('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3b94('0x2c'),_0x3b94('0xde'),util['inspect'](_0x17a5b5[_0x3b94('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x236649;}})[_0x3b94('0x22')](respondWithResult(_0x31be8a,null))[_0x3b94('0x5c')](handleError(_0x31be8a,null));};exports['addAgents']=function(_0x4d4539,_0x391925,_0x18a094){return db[_0x3b94('0x42')][_0x3b94('0x60')]({'where':{'id':_0x4d4539[_0x3b94('0x5e')]['id']}})[_0x3b94('0x22')](handleEntityNotFound(_0x391925,null))['then'](function(_0x154dbe){if(_0x154dbe){return _0x154dbe[_0x3b94('0xe1')](_0x4d4539[_0x3b94('0x62')][_0x3b94('0x76')],_[_0x3b94('0xa2')](_0x4d4539['body'],[_0x3b94('0x76'),'id'])||{})[_0x3b94('0xc9')](function(_0x2bbfb5){for(var _0x1c13ee=0x0;_0x1c13ee<_0x4d4539[_0x3b94('0x62')]['ids'][_0x3b94('0x4e')];_0x1c13ee+=0x1){socket['emit'](_0x3b94('0xe2'),{'UserId':Number(_0x4d4539[_0x3b94('0x62')][_0x3b94('0x76')][_0x1c13ee]),'SmsAccountId':Number(_0x4d4539[_0x3b94('0x5e')]['id'])});}return _0x2bbfb5;});}})[_0x3b94('0x22')](respondWithResult(_0x391925,null))[_0x3b94('0x5c')](handleError(_0x391925,null));};exports['removeAgents']=function(_0x3dab59,_0x442197,_0x43c6c2){return db[_0x3b94('0x42')][_0x3b94('0x60')]({'where':{'id':_0x3dab59[_0x3b94('0x5e')]['id']}})[_0x3b94('0x22')](handleEntityNotFound(_0x442197,null))[_0x3b94('0x22')](function(_0x18553c){if(_0x18553c){return _0x18553c[_0x3b94('0xe3')](_0x3dab59[_0x3b94('0x47')][_0x3b94('0x76')])[_0x3b94('0x22')](function(){if(_[_0x3b94('0xe4')](_0x3dab59[_0x3b94('0x47')][_0x3b94('0x76')])){for(var _0x2ab27d=0x0;_0x2ab27d<_0x3dab59[_0x3b94('0x47')]['ids'][_0x3b94('0x4e')];_0x2ab27d+=0x1){socket[_0x3b94('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x3dab59[_0x3b94('0x47')][_0x3b94('0x76')][_0x2ab27d]),'SmsAccountId':Number(_0x3dab59[_0x3b94('0x5e')]['id'])});}}else{socket[_0x3b94('0xe5')](_0x3b94('0xe6'),{'UserId':Number(_0x3dab59['query'][_0x3b94('0x76')]),'SmsAccountId':Number(_0x3dab59[_0x3b94('0x5e')]['id'])});}});}})[_0x3b94('0x22')](respondWithStatusCode(_0x442197,null))[_0x3b94('0x5c')](handleError(_0x442197,null));};exports[_0x3b94('0xe7')]=function(_0x4ab07b,_0x2bb6e3,_0x588ce2){var _0x3d475d={};var _0x4b9353={};var _0x5ca2ee;var _0x2d1a85;return db[_0x3b94('0x42')][_0x3b94('0x6e')]({'where':{'id':_0x4ab07b[_0x3b94('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2bb6e3,null))[_0x3b94('0x22')](function(_0x378af7){if(_0x378af7){_0x5ca2ee=_0x378af7;_0x4b9353[_0x3b94('0x4c')]=_[_0x3b94('0x48')](db[_0x3b94('0xad')][_0x3b94('0x74')]);_0x4b9353['query']=_[_0x3b94('0x48')](_0x4ab07b[_0x3b94('0x47')]);_0x4b9353[_0x3b94('0x49')]=_[_0x3b94('0x4a')](_0x4b9353[_0x3b94('0x4c')],_0x4b9353[_0x3b94('0x47')]);_0x3d475d[_0x3b94('0x4b')]=_[_0x3b94('0x4a')](_0x4b9353[_0x3b94('0x4c')],qs[_0x3b94('0x4d')](_0x4ab07b['query'][_0x3b94('0x4d')]));_0x3d475d[_0x3b94('0x4b')]=_0x3d475d[_0x3b94('0x4b')][_0x3b94('0x4e')]?_0x3d475d[_0x3b94('0x4b')]:_0x4b9353[_0x3b94('0x4c')];_0x3d475d[_0x3b94('0x51')]=qs[_0x3b94('0x52')](_0x4ab07b[_0x3b94('0x47')][_0x3b94('0x52')]);_0x3d475d[_0x3b94('0x53')]=qs[_0x3b94('0x49')](_['pick'](_0x4ab07b[_0x3b94('0x47')],_0x4b9353[_0x3b94('0x49')]));if(_0x4ab07b[_0x3b94('0x47')][_0x3b94('0x54')]){_0x3d475d['where']=_[_0x3b94('0x56')](_0x3d475d['where'],{'$or':_[_0x3b94('0x46')](_0x3d475d[_0x3b94('0x4b')],function(_0x43787c){var _0x419042={};_0x419042[_0x43787c]={'$like':'%'+_0x4ab07b[_0x3b94('0x47')]['filter']+'%'};return _0x419042;})});}_0x3d475d=_[_0x3b94('0x56')]({},_0x3d475d,_0x4ab07b['options']);return _0x5ca2ee[_0x3b94('0xe7')](_0x3d475d);}})['then'](function(_0x246ecd){if(_0x246ecd){_0x2d1a85=_0x246ecd['length'];if(!_0x4ab07b[_0x3b94('0x47')][_0x3b94('0x4f')](_0x3b94('0x50'))){_0x3d475d[_0x3b94('0x31')]=qs['limit'](_0x4ab07b[_0x3b94('0x47')][_0x3b94('0x31')]);_0x3d475d['offset']=qs[_0x3b94('0x2f')](_0x4ab07b[_0x3b94('0x47')][_0x3b94('0x2f')]);}return _0x5ca2ee[_0x3b94('0xe7')](_0x3d475d);}})['then'](function(_0x25315f){if(_0x25315f){return _0x25315f?{'count':_0x2d1a85,'rows':_0x25315f}:null;}})[_0x3b94('0x22')](respondWithResult(_0x2bb6e3,null))[_0x3b94('0x5c')](handleError(_0x2bb6e3,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2502ccb..5a71bc3 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 _0x8d3e=['../../mysqldb','SmsAccount','update','remove','hasOwnProperty','hook','events'];(function(_0xbf09ab,_0x251a19){var _0x2a9aef=function(_0x22d793){while(--_0x22d793){_0xbf09ab['push'](_0xbf09ab['shift']());}};_0x2a9aef(++_0x251a19);}(_0x8d3e,0x164));var _0xe8d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d3e[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xe8d3('0x0'));var SmsAccount=require(_0xe8d3('0x1'))['db'][_0xe8d3('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe8d3('0x3'),'afterDestroy':_0xe8d3('0x4')};function emitEvent(_0x13f05d){return function(_0x5a44f5,_0x568a6c,_0x2a361e){SmsAccountEvents['emit'](_0x13f05d+':'+_0x5a44f5['id'],_0x5a44f5);SmsAccountEvents['emit'](_0x13f05d,_0x5a44f5);_0x2a361e(null);};}for(var e in events){if(events[_0xe8d3('0x5')](e)){var event=events[e];SmsAccount[_0xe8d3('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xb535=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb535,0x12c));var _0x5b53=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xb535[_0x481bf7];return _0x461787;};'use strict';var EventEmitter=require(_0x5b53('0x0'));var SmsAccount=require(_0x5b53('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5b53('0x2')](0x0);var events={'afterCreate':_0x5b53('0x3'),'afterUpdate':_0x5b53('0x4'),'afterDestroy':_0x5b53('0x5')};function emitEvent(_0x106a3c){return function(_0x3dade5,_0x4f50ce,_0x4fbd7a){SmsAccountEvents[_0x5b53('0x6')](_0x106a3c+':'+_0x3dade5['id'],_0x3dade5);SmsAccountEvents[_0x5b53('0x6')](_0x106a3c,_0x3dade5);_0x4fbd7a(null);};}for(var e in events){if(events[_0x5b53('0x7')](e)){var event=events[e];SmsAccount[_0x5b53('0x8')](e,emitEvent(event));}}module[_0x5b53('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 9589ffa..abb6d99 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 _0x2402=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','../../config/logger','api'];(function(_0x5d61fa,_0x5428fe){var _0x271751=function(_0xa87023){while(--_0xa87023){_0x5d61fa['push'](_0x5d61fa['shift']());}};_0x271751(++_0x5428fe);}(_0x2402,0xd9));var _0x2240=function(_0x5cda7e,_0x4bbe98){_0x5cda7e=_0x5cda7e-0x0;var _0x430ee4=_0x2402[_0x5cda7e];return _0x430ee4;};'use strict';var _=require(_0x2240('0x0'));var util=require('util');var logger=require(_0x2240('0x1'))(_0x2240('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2240('0x3'));var fs=require('fs');var path=require(_0x2240('0x4'));var rimraf=require(_0x2240('0x5'));var config=require(_0x2240('0x6'));var attributes=require(_0x2240('0x7'));module[_0x2240('0x8')]=function(_0x5abe0a,_0x216282){return _0x5abe0a['define'](_0x2240('0x9'),attributes,{'tableName':_0x2240('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0729=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','util','../../config/logger','api','moment'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x0729,0x98));var _0x9072=function(_0x5ade4e,_0x1184e6){_0x5ade4e=_0x5ade4e-0x0;var _0x3ffe52=_0x0729[_0x5ade4e];return _0x3ffe52;};'use strict';var _=require('lodash');var util=require(_0x9072('0x0'));var logger=require(_0x9072('0x1'))(_0x9072('0x2'));var moment=require(_0x9072('0x3'));var BPromise=require('bluebird');var rp=require(_0x9072('0x4'));var fs=require('fs');var path=require(_0x9072('0x5'));var rimraf=require(_0x9072('0x6'));var config=require(_0x9072('0x7'));var attributes=require(_0x9072('0x8'));module[_0x9072('0x9')]=function(_0x1d04ac,_0x5d1585){return _0x1d04ac[_0x9072('0xa')](_0x9072('0xb'),attributes,{'tableName':_0x9072('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 464fab9..092c9a2 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 _0x4531=['model','attributes','stringify','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','include','map'];(function(_0x26299e,_0x394ad1){var _0x6c4f4a=function(_0x539ae9){while(--_0x539ae9){_0x26299e['push'](_0x26299e['shift']());}};_0x6c4f4a(++_0x394ad1);}(_0x4531,0x1ca));var _0x1453=function(_0x4a4219,_0x55d299){_0x4a4219=_0x4a4219-0x0;var _0x1bb2a7=_0x4531[_0x4a4219];return _0x1bb2a7;};'use strict';var _=require('lodash');var util=require(_0x1453('0x0'));var moment=require('moment');var BPromise=require(_0x1453('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1453('0x2'))['db'];var utils=require(_0x1453('0x3'));var logger=require(_0x1453('0x4'))('rpc');var config=require(_0x1453('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1453('0x6')]({'port':0x232a});config[_0x1453('0x7')]=_[_0x1453('0x8')](config[_0x1453('0x7')],{'host':_0x1453('0x9'),'port':0x18eb});var socket=require(_0x1453('0xa'))(new Redis(config[_0x1453('0x7')]));require(_0x1453('0xb'))[_0x1453('0xc')](socket);function respondWithRpcPromise(_0x5c9861,_0x5489c8,_0x44c150){return new BPromise(function(_0x2e6276,_0x2dec1a){return client[_0x1453('0xd')](_0x5c9861,_0x44c150)[_0x1453('0xe')](function(_0x425dcb){logger[_0x1453('0xf')](_0x1453('0x10'),_0x5489c8,_0x1453('0x11'));logger[_0x1453('0x12')](_0x1453('0x13'),_0x5489c8,'request\x20sent',JSON['stringify'](_0x425dcb));if(_0x425dcb[_0x1453('0x14')]){if(_0x425dcb[_0x1453('0x14')][_0x1453('0x15')]===0x1f4){logger['error'](_0x1453('0x10'),_0x5489c8,_0x425dcb[_0x1453('0x14')][_0x1453('0x16')]);return _0x2dec1a(_0x425dcb['error']['message']);}logger[_0x1453('0x14')]('SmsAccount,\x20%s,\x20%s',_0x5489c8,_0x425dcb['error'][_0x1453('0x16')]);return _0x2e6276(_0x425dcb[_0x1453('0x14')]['message']);}else{logger['info'](_0x1453('0x10'),_0x5489c8,'request\x20sent');_0x2e6276(_0x425dcb[_0x1453('0x17')][_0x1453('0x16')]);}})[_0x1453('0x18')](function(_0x4ce685){logger['error'](_0x1453('0x10'),_0x5489c8,_0x4ce685);_0x2dec1a(_0x4ce685);});});}exports[_0x1453('0x19')]=function(_0x484d47){var _0x27ab47=this;return new Promise(function(_0x491d89,_0x20f2fa){return db[_0x1453('0x1a')][_0x1453('0x1b')]({'raw':_0x484d47[_0x1453('0x1c')]?_0x484d47[_0x1453('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x484d47[_0x1453('0x1c')]?_0x484d47[_0x1453('0x1c')][_0x1453('0x1d')]||null:null,'attributes':_0x484d47['options']?_0x484d47[_0x1453('0x1c')]['attributes']||null:null,'include':_0x484d47[_0x1453('0x1c')]?_0x484d47[_0x1453('0x1c')][_0x1453('0x1e')]?_[_0x1453('0x1f')](_0x484d47[_0x1453('0x1c')]['include'],function(_0x564068){return{'model':db[_0x564068[_0x1453('0x20')]],'as':_0x564068['as'],'attributes':_0x564068[_0x1453('0x21')],'include':_0x564068['include']?_[_0x1453('0x1f')](_0x564068['include'],function(_0x46c412){return{'model':db[_0x46c412[_0x1453('0x20')]],'as':_0x46c412['as'],'attributes':_0x46c412[_0x1453('0x21')],'include':_0x46c412[_0x1453('0x1e')]?_[_0x1453('0x1f')](_0x46c412['include'],function(_0x544bcb){return{'model':db[_0x544bcb[_0x1453('0x20')]],'as':_0x544bcb['as'],'attributes':_0x544bcb[_0x1453('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b4586){logger[_0x1453('0xf')]('ShowSmsAccount',_0x484d47);logger['debug'](_0x1453('0x19'),_0x484d47,JSON[_0x1453('0x22')](_0x2b4586));_0x491d89(_0x2b4586);})[_0x1453('0x18')](function(_0x30d56c){logger[_0x1453('0x14')]('ShowSmsAccount',_0x30d56c[_0x1453('0x16')],_0x484d47);_0x20f2fa(_0x27ab47[_0x1453('0x14')](0x1f4,_0x30d56c[_0x1453('0x16')]));});});}; \ No newline at end of file +var _0x4bef=['defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SmsAccount','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','debug','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x485b3e,_0x4e1670){var _0x1e1857=function(_0x4e955a){while(--_0x4e955a){_0x485b3e['push'](_0x485b3e['shift']());}};_0x1e1857(++_0x4e1670);}(_0x4bef,0x196));var _0xf4be=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x4bef[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xf4be('0x0'));var util=require(_0xf4be('0x1'));var moment=require(_0xf4be('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4be('0x4'))['db'];var utils=require(_0xf4be('0x5'));var logger=require(_0xf4be('0x6'))(_0xf4be('0x7'));var config=require(_0xf4be('0x8'));var jayson=require(_0xf4be('0x9'));var client=jayson[_0xf4be('0xa')][_0xf4be('0xb')]({'port':0x232a});config['redis']=_[_0xf4be('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf4be('0xd'))(new Redis(config['redis']));require(_0xf4be('0xe'))[_0xf4be('0xf')](socket);function respondWithRpcPromise(_0x25285e,_0x2d367f,_0x553b29){return new BPromise(function(_0x358759,_0x49fdca){return client[_0xf4be('0x10')](_0x25285e,_0x553b29)[_0xf4be('0x11')](function(_0x26056c){logger[_0xf4be('0x12')](_0xf4be('0x13'),_0x2d367f,_0xf4be('0x14'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2d367f,_0xf4be('0x14'),JSON['stringify'](_0x26056c));if(_0x26056c[_0xf4be('0x15')]){if(_0x26056c[_0xf4be('0x15')][_0xf4be('0x16')]===0x1f4){logger[_0xf4be('0x15')]('SmsAccount,\x20%s,\x20%s',_0x2d367f,_0x26056c[_0xf4be('0x15')][_0xf4be('0x17')]);return _0x49fdca(_0x26056c['error'][_0xf4be('0x17')]);}logger['error'](_0xf4be('0x13'),_0x2d367f,_0x26056c[_0xf4be('0x15')]['message']);return _0x358759(_0x26056c['error'][_0xf4be('0x17')]);}else{logger[_0xf4be('0x12')]('SmsAccount,\x20%s,\x20%s',_0x2d367f,_0xf4be('0x14'));_0x358759(_0x26056c[_0xf4be('0x18')][_0xf4be('0x17')]);}})[_0xf4be('0x19')](function(_0x3d2791){logger[_0xf4be('0x15')]('SmsAccount,\x20%s,\x20%s',_0x2d367f,_0x3d2791);_0x49fdca(_0x3d2791);});});}exports['ShowSmsAccount']=function(_0x2dd7b7){var _0x25e2e5=this;return new Promise(function(_0x1ae355,_0x423fa8){return db[_0xf4be('0x1a')][_0xf4be('0x1b')]({'raw':_0x2dd7b7[_0xf4be('0x1c')]?_0x2dd7b7['options'][_0xf4be('0x1d')]===undefined?!![]:![]:!![],'where':_0x2dd7b7[_0xf4be('0x1c')]?_0x2dd7b7[_0xf4be('0x1c')][_0xf4be('0x1e')]||null:null,'attributes':_0x2dd7b7[_0xf4be('0x1c')]?_0x2dd7b7[_0xf4be('0x1c')][_0xf4be('0x1f')]||null:null,'include':_0x2dd7b7['options']?_0x2dd7b7[_0xf4be('0x1c')][_0xf4be('0x20')]?_[_0xf4be('0x21')](_0x2dd7b7['options']['include'],function(_0x556435){return{'model':db[_0x556435[_0xf4be('0x22')]],'as':_0x556435['as'],'attributes':_0x556435[_0xf4be('0x1f')],'include':_0x556435['include']?_[_0xf4be('0x21')](_0x556435[_0xf4be('0x20')],function(_0x4a40d0){return{'model':db[_0x4a40d0[_0xf4be('0x22')]],'as':_0x4a40d0['as'],'attributes':_0x4a40d0[_0xf4be('0x1f')],'include':_0x4a40d0[_0xf4be('0x20')]?_[_0xf4be('0x21')](_0x4a40d0[_0xf4be('0x20')],function(_0x1f0162){return{'model':db[_0x1f0162[_0xf4be('0x22')]],'as':_0x1f0162['as'],'attributes':_0x1f0162['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aef7b){logger[_0xf4be('0x12')](_0xf4be('0x23'),_0x2dd7b7);logger[_0xf4be('0x24')](_0xf4be('0x23'),_0x2dd7b7,JSON[_0xf4be('0x25')](_0x4aef7b));_0x1ae355(_0x4aef7b);})['catch'](function(_0xfcb51e){logger[_0xf4be('0x15')](_0xf4be('0x23'),_0xfcb51e[_0xf4be('0x17')],_0x2dd7b7);_0x423fa8(_0x25e2e5[_0xf4be('0x15')](0x1f4,_0xfcb51e[_0xf4be('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0f5cb09..8ff23b7 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(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_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 9835176..45e3dc7 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x6b5af4,_0x1a502e){var _0x4d69ed=function(_0x155973){while(--_0x155973){_0x6b5af4['push'](_0x6b5af4['shift']());}};_0x4d69ed(++_0x1a502e);}(_0x7217,0x19e));var _0x7721=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x7217[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x25feab,_0x30eeb2){var _0x8403fa=function(_0x47a948){while(--_0x47a948){_0x25feab['push'](_0x25feab['shift']());}};_0x8403fa(++_0x30eeb2);}(_0x7217,0x19e));var _0x7721=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x7217[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 732d97e..1c3e2ad 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 _0x9bee=['STRING','*,*,*,*','sequelize','INTEGER','TEXT'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0x9bee,0x1ab));var _0xe9be=function(_0x8870db,_0x592388){_0x8870db=_0x8870db-0x0;var _0x297680=_0x9bee[_0x8870db];return _0x297680;};'use strict';var Sequelize=require(_0xe9be('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe9be('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe9be('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe9be('0x3')],'defaultValue':_0xe9be('0x4')}}; \ No newline at end of file +var _0x70d8=['exports','noop','STRING','*,*,*,*'];(function(_0x35f45b,_0x50797e){var _0x4070c4=function(_0x13f6a7){while(--_0x13f6a7){_0x35f45b['push'](_0x35f45b['shift']());}};_0x4070c4(++_0x50797e);}(_0x70d8,0x12c));var _0x870d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x70d8[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0x870d('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x870d('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x870d('0x2')]},'interval':{'type':Sequelize[_0x870d('0x2')],'defaultValue':_0x870d('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e882b2d..0d99347 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 _0xc888=['end','error','name','send','index','SmsApplication','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','merge','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x351a57,_0x3091a5){var _0x15564f=function(_0x37fcce){while(--_0x37fcce){_0x351a57['push'](_0x351a57['shift']());}};_0x15564f(++_0x3091a5);}(_0xc888,0x72));var _0x8c88=function(_0x19abc7,_0x5aadb6){_0x19abc7=_0x19abc7-0x0;var _0xc24f10=_0xc888[_0x19abc7];return _0xc24f10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c88('0x0'));var zipdir=require(_0x8c88('0x1'));var jsonpatch=require(_0x8c88('0x2'));var rp=require(_0x8c88('0x3'));var moment=require(_0x8c88('0x4'));var BPromise=require(_0x8c88('0x5'));var Mustache=require(_0x8c88('0x6'));var util=require('util');var path=require(_0x8c88('0x7'));var sox=require(_0x8c88('0x8'));var csv=require('to-csv');var ejs=require(_0x8c88('0x9'));var fs=require('fs');var fs_extra=require(_0x8c88('0xa'));var _=require(_0x8c88('0xb'));var squel=require(_0x8c88('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c88('0xd'));var deskjs=require(_0x8c88('0xe'));var toCsv=require(_0x8c88('0xf'));var querystring=require(_0x8c88('0x10'));var Papa=require(_0x8c88('0x11'));var Redis=require(_0x8c88('0x12'));var authService=require(_0x8c88('0x13'));var qs=require(_0x8c88('0x14'));var as=require(_0x8c88('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c88('0x16'))(_0x8c88('0x17'));var utils=require(_0x8c88('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8c88('0x19'))['db'];function respondWithStatusCode(_0x28a2b3,_0x81abf0){_0x81abf0=_0x81abf0||0xcc;return function(_0x41d63f){if(_0x41d63f){return _0x28a2b3[_0x8c88('0x1a')](_0x81abf0);}return _0x28a2b3['status'](_0x81abf0)['end']();};}function respondWithResult(_0x489778,_0x5e7e57){_0x5e7e57=_0x5e7e57||0xc8;return function(_0x164ff5){if(_0x164ff5){return _0x489778[_0x8c88('0x1b')](_0x5e7e57)['json'](_0x164ff5);}};}function respondWithFilteredResult(_0x446ed0,_0x29afec){return function(_0x2077e2){if(_0x2077e2){var _0x34093d=typeof _0x29afec[_0x8c88('0x1c')]===_0x8c88('0x1d')&&typeof _0x29afec[_0x8c88('0x1e')]===_0x8c88('0x1d');var _0x5ec81e=_0x2077e2[_0x8c88('0x1f')];var _0x15279c=_0x34093d?0x0:_0x29afec['offset'];var _0x24185e=_0x34093d?_0x2077e2[_0x8c88('0x1f')]:_0x29afec[_0x8c88('0x1c')]+_0x29afec[_0x8c88('0x1e')];var _0x5a1ed8;if(_0x24185e>=_0x5ec81e){_0x24185e=_0x5ec81e;_0x5a1ed8=0xc8;}else{_0x5a1ed8=0xce;}_0x446ed0[_0x8c88('0x1b')](_0x5a1ed8);return _0x446ed0['set'](_0x8c88('0x20'),_0x15279c+'-'+_0x24185e+'/'+_0x5ec81e)[_0x8c88('0x21')](_0x2077e2);}return null;};}function patchUpdates(_0x209389){return function(_0x4bbeee){try{jsonpatch[_0x8c88('0x22')](_0x4bbeee,_0x209389,!![]);}catch(_0x270ea3){return BPromise[_0x8c88('0x23')](_0x270ea3);}return _0x4bbeee[_0x8c88('0x24')]();};}function saveUpdates(_0x23f72c,_0x203aa7){return function(_0x3273dd){if(_0x3273dd){return _0x3273dd[_0x8c88('0x25')](_0x23f72c)[_0x8c88('0x26')](function(_0x22b61d){return _0x22b61d;});}return null;};}function removeEntity(_0x37ca89,_0x264160){return function(_0x1896e3){if(_0x1896e3){return _0x1896e3[_0x8c88('0x27')]()[_0x8c88('0x26')](function(){_0x37ca89[_0x8c88('0x1b')](0xcc)[_0x8c88('0x28')]();});}};}function handleEntityNotFound(_0x2b8bc9,_0x25a85c){return function(_0x16d9c2){if(!_0x16d9c2){_0x2b8bc9[_0x8c88('0x1a')](0x194);}return _0x16d9c2;};}function handleError(_0xb283b9,_0x4afaed){_0x4afaed=_0x4afaed||0x1f4;return function(_0x35b7d2){logger[_0x8c88('0x29')](_0x35b7d2['stack']);if(_0x35b7d2[_0x8c88('0x2a')]){delete _0x35b7d2[_0x8c88('0x2a')];}_0xb283b9[_0x8c88('0x1b')](_0x4afaed)[_0x8c88('0x2b')](_0x35b7d2);};}exports[_0x8c88('0x2c')]=function(_0x3ff217,_0x2d7102){var _0x36b75f={},_0x5c94c6={},_0x29ecb1={'count':0x0,'rows':[]};var _0x49a123=_['map'](db[_0x8c88('0x2d')]['rawAttributes'],function(_0x33453e){return{'name':_0x33453e['fieldName'],'type':_0x33453e['type']['key']};});_0x5c94c6[_0x8c88('0x2e')]=_[_0x8c88('0x2f')](_0x49a123,_0x8c88('0x2a'));_0x5c94c6[_0x8c88('0x30')]=_[_0x8c88('0x31')](_0x3ff217[_0x8c88('0x30')]);_0x5c94c6['filters']=_[_0x8c88('0x32')](_0x5c94c6[_0x8c88('0x2e')],_0x5c94c6['query']);_0x36b75f[_0x8c88('0x33')]=_[_0x8c88('0x32')](_0x5c94c6['model'],qs['fields'](_0x3ff217[_0x8c88('0x30')]['fields']));_0x36b75f[_0x8c88('0x33')]=_0x36b75f[_0x8c88('0x33')][_0x8c88('0x34')]?_0x36b75f[_0x8c88('0x33')]:_0x5c94c6['model'];if(!_0x3ff217['query'][_0x8c88('0x35')](_0x8c88('0x36'))){_0x36b75f[_0x8c88('0x1e')]=qs[_0x8c88('0x1e')](_0x3ff217[_0x8c88('0x30')]['limit']);_0x36b75f[_0x8c88('0x1c')]=qs[_0x8c88('0x1c')](_0x3ff217[_0x8c88('0x30')][_0x8c88('0x1c')]);}_0x36b75f[_0x8c88('0x37')]=qs[_0x8c88('0x38')](_0x3ff217['query']['sort']);_0x36b75f[_0x8c88('0x39')]=qs[_0x8c88('0x3a')](_[_0x8c88('0x3b')](_0x3ff217[_0x8c88('0x30')],_0x5c94c6['filters']),_0x49a123);if(_0x3ff217[_0x8c88('0x30')]['filter']){_0x36b75f['where']=_['merge'](_0x36b75f[_0x8c88('0x39')],{'$or':_[_0x8c88('0x2f')](_0x49a123,function(_0x512e4a){if(_0x512e4a[_0x8c88('0x3c')]!==_0x8c88('0x3d')){var _0xb64c39={};_0xb64c39[_0x512e4a[_0x8c88('0x2a')]]={'$like':'%'+_0x3ff217[_0x8c88('0x30')][_0x8c88('0x3e')]+'%'};return _0xb64c39;}})});}_0x36b75f=_['merge']({},_0x36b75f,_0x3ff217[_0x8c88('0x3f')]);var _0x1aabbf={'where':_0x36b75f[_0x8c88('0x39')]};return db[_0x8c88('0x2d')][_0x8c88('0x1f')](_0x1aabbf)[_0x8c88('0x26')](function(_0x41f6b9){_0x29ecb1['count']=_0x41f6b9;if(_0x3ff217[_0x8c88('0x30')][_0x8c88('0x40')]){_0x36b75f[_0x8c88('0x41')]=[{'all':!![]}];}return db[_0x8c88('0x2d')][_0x8c88('0x42')](_0x36b75f);})[_0x8c88('0x26')](function(_0x289afc){_0x29ecb1[_0x8c88('0x43')]=_0x289afc;return _0x29ecb1;})['then'](respondWithFilteredResult(_0x2d7102,_0x36b75f))['catch'](handleError(_0x2d7102,null));};exports[_0x8c88('0x44')]=function(_0x2cfd64,_0x2d73f0){var _0x4eb09a={'raw':!![],'where':{'id':_0x2cfd64[_0x8c88('0x45')]['id']}},_0x312b3b={};_0x312b3b[_0x8c88('0x2e')]=_[_0x8c88('0x31')](db[_0x8c88('0x2d')][_0x8c88('0x46')]);_0x312b3b[_0x8c88('0x30')]=_['keys'](_0x2cfd64[_0x8c88('0x30')]);_0x312b3b[_0x8c88('0x3a')]=_[_0x8c88('0x32')](_0x312b3b[_0x8c88('0x2e')],_0x312b3b['query']);_0x4eb09a[_0x8c88('0x33')]=_['intersection'](_0x312b3b[_0x8c88('0x2e')],qs[_0x8c88('0x47')](_0x2cfd64['query'][_0x8c88('0x47')]));_0x4eb09a[_0x8c88('0x33')]=_0x4eb09a[_0x8c88('0x33')][_0x8c88('0x34')]?_0x4eb09a[_0x8c88('0x33')]:_0x312b3b[_0x8c88('0x2e')];if(_0x2cfd64[_0x8c88('0x30')][_0x8c88('0x40')]){_0x4eb09a[_0x8c88('0x41')]=[{'all':!![]}];}_0x4eb09a=_[_0x8c88('0x48')]({},_0x4eb09a,_0x2cfd64[_0x8c88('0x3f')]);return db['SmsApplication'][_0x8c88('0x49')](_0x4eb09a)[_0x8c88('0x26')](handleEntityNotFound(_0x2d73f0,null))[_0x8c88('0x26')](respondWithResult(_0x2d73f0,null))[_0x8c88('0x4a')](handleError(_0x2d73f0,null));};exports[_0x8c88('0x4b')]=function(_0x56babd,_0x18b244){return db['SmsApplication']['create'](_0x56babd['body'],{})[_0x8c88('0x26')](respondWithResult(_0x18b244,0xc9))['catch'](handleError(_0x18b244,null));};exports[_0x8c88('0x25')]=function(_0x5e36f0,_0xfd693c){if(_0x5e36f0['body']['id']){delete _0x5e36f0[_0x8c88('0x4c')]['id'];}return db[_0x8c88('0x2d')][_0x8c88('0x49')]({'where':{'id':_0x5e36f0['params']['id']}})[_0x8c88('0x26')](handleEntityNotFound(_0xfd693c,null))['then'](saveUpdates(_0x5e36f0[_0x8c88('0x4c')],null))[_0x8c88('0x26')](respondWithResult(_0xfd693c,null))[_0x8c88('0x4a')](handleError(_0xfd693c,null));};exports['destroy']=function(_0x1e5a56,_0x3f6612){return db[_0x8c88('0x2d')][_0x8c88('0x49')]({'where':{'id':_0x1e5a56[_0x8c88('0x45')]['id']}})[_0x8c88('0x26')](handleEntityNotFound(_0x3f6612,null))[_0x8c88('0x26')](removeEntity(_0x3f6612,null))['catch'](handleError(_0x3f6612,null));}; \ No newline at end of file +var _0x0487=['merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','SmsApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0487,0xea));var _0x7048=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x0487[_0xf48cce];return _0x2a5c38;};'use strict';var emlformat=require(_0x7048('0x0'));var rimraf=require(_0x7048('0x1'));var zipdir=require(_0x7048('0x2'));var jsonpatch=require(_0x7048('0x3'));var rp=require(_0x7048('0x4'));var moment=require(_0x7048('0x5'));var BPromise=require(_0x7048('0x6'));var Mustache=require(_0x7048('0x7'));var util=require(_0x7048('0x8'));var path=require(_0x7048('0x9'));var sox=require(_0x7048('0xa'));var csv=require(_0x7048('0xb'));var ejs=require(_0x7048('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7048('0xd'));var squel=require('squel');var crypto=require(_0x7048('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7048('0xb'));var querystring=require(_0x7048('0xf'));var Papa=require(_0x7048('0x10'));var Redis=require(_0x7048('0x11'));var authService=require(_0x7048('0x12'));var qs=require(_0x7048('0x13'));var as=require(_0x7048('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7048('0x15'))(_0x7048('0x16'));var utils=require(_0x7048('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7048('0x18'))['db'];function respondWithStatusCode(_0x1ba45f,_0x437b0e){_0x437b0e=_0x437b0e||0xcc;return function(_0xeccec4){if(_0xeccec4){return _0x1ba45f['sendStatus'](_0x437b0e);}return _0x1ba45f[_0x7048('0x19')](_0x437b0e)['end']();};}function respondWithResult(_0x2d7925,_0x326b1c){_0x326b1c=_0x326b1c||0xc8;return function(_0x1fb5d2){if(_0x1fb5d2){return _0x2d7925[_0x7048('0x19')](_0x326b1c)[_0x7048('0x1a')](_0x1fb5d2);}};}function respondWithFilteredResult(_0xaf9f17,_0x1d2507){return function(_0x4ca757){if(_0x4ca757){var _0x2d3eea=typeof _0x1d2507[_0x7048('0x1b')]===_0x7048('0x1c')&&typeof _0x1d2507[_0x7048('0x1d')]===_0x7048('0x1c');var _0x401e92=_0x4ca757[_0x7048('0x1e')];var _0x24626c=_0x2d3eea?0x0:_0x1d2507[_0x7048('0x1b')];var _0xda35a0=_0x2d3eea?_0x4ca757['count']:_0x1d2507[_0x7048('0x1b')]+_0x1d2507[_0x7048('0x1d')];var _0x1f2205;if(_0xda35a0>=_0x401e92){_0xda35a0=_0x401e92;_0x1f2205=0xc8;}else{_0x1f2205=0xce;}_0xaf9f17[_0x7048('0x19')](_0x1f2205);return _0xaf9f17[_0x7048('0x1f')](_0x7048('0x20'),_0x24626c+'-'+_0xda35a0+'/'+_0x401e92)[_0x7048('0x1a')](_0x4ca757);}return null;};}function patchUpdates(_0x595207){return function(_0x22a485){try{jsonpatch['apply'](_0x22a485,_0x595207,!![]);}catch(_0x38a858){return BPromise[_0x7048('0x21')](_0x38a858);}return _0x22a485[_0x7048('0x22')]();};}function saveUpdates(_0x4fc24a,_0x500439){return function(_0x1eab41){if(_0x1eab41){return _0x1eab41[_0x7048('0x23')](_0x4fc24a)[_0x7048('0x24')](function(_0x5f380e){return _0x5f380e;});}return null;};}function removeEntity(_0x42fa3c,_0x5ec5ea){return function(_0x2f1ed3){if(_0x2f1ed3){return _0x2f1ed3[_0x7048('0x25')]()[_0x7048('0x24')](function(){_0x42fa3c['status'](0xcc)[_0x7048('0x26')]();});}};}function handleEntityNotFound(_0x3c5183,_0x207767){return function(_0x452f02){if(!_0x452f02){_0x3c5183['sendStatus'](0x194);}return _0x452f02;};}function handleError(_0xe4652d,_0x33a954){_0x33a954=_0x33a954||0x1f4;return function(_0x546667){logger[_0x7048('0x27')](_0x546667[_0x7048('0x28')]);if(_0x546667[_0x7048('0x29')]){delete _0x546667['name'];}_0xe4652d[_0x7048('0x19')](_0x33a954)['send'](_0x546667);};}exports[_0x7048('0x2a')]=function(_0x1f4065,_0x531409){var _0x300c51={},_0x1f35e7={},_0x19653b={'count':0x0,'rows':[]};var _0x403dec=_[_0x7048('0x2b')](db[_0x7048('0x2c')][_0x7048('0x2d')],function(_0x4f1c21){return{'name':_0x4f1c21['fieldName'],'type':_0x4f1c21[_0x7048('0x2e')][_0x7048('0x2f')]};});_0x1f35e7[_0x7048('0x30')]=_['map'](_0x403dec,_0x7048('0x29'));_0x1f35e7[_0x7048('0x31')]=_[_0x7048('0x32')](_0x1f4065[_0x7048('0x31')]);_0x1f35e7[_0x7048('0x33')]=_[_0x7048('0x34')](_0x1f35e7['model'],_0x1f35e7['query']);_0x300c51[_0x7048('0x35')]=_[_0x7048('0x34')](_0x1f35e7[_0x7048('0x30')],qs[_0x7048('0x36')](_0x1f4065['query'][_0x7048('0x36')]));_0x300c51['attributes']=_0x300c51[_0x7048('0x35')][_0x7048('0x37')]?_0x300c51[_0x7048('0x35')]:_0x1f35e7['model'];if(!_0x1f4065[_0x7048('0x31')][_0x7048('0x38')](_0x7048('0x39'))){_0x300c51['limit']=qs['limit'](_0x1f4065[_0x7048('0x31')][_0x7048('0x1d')]);_0x300c51[_0x7048('0x1b')]=qs[_0x7048('0x1b')](_0x1f4065['query'][_0x7048('0x1b')]);}_0x300c51['order']=qs[_0x7048('0x3a')](_0x1f4065['query'][_0x7048('0x3a')]);_0x300c51[_0x7048('0x3b')]=qs[_0x7048('0x33')](_[_0x7048('0x3c')](_0x1f4065[_0x7048('0x31')],_0x1f35e7['filters']),_0x403dec);if(_0x1f4065[_0x7048('0x31')][_0x7048('0x3d')]){_0x300c51[_0x7048('0x3b')]=_[_0x7048('0x3e')](_0x300c51[_0x7048('0x3b')],{'$or':_[_0x7048('0x2b')](_0x403dec,function(_0x4cc512){if(_0x4cc512[_0x7048('0x2e')]!==_0x7048('0x3f')){var _0x8c7320={};_0x8c7320[_0x4cc512[_0x7048('0x29')]]={'$like':'%'+_0x1f4065['query'][_0x7048('0x3d')]+'%'};return _0x8c7320;}})});}_0x300c51=_[_0x7048('0x3e')]({},_0x300c51,_0x1f4065[_0x7048('0x40')]);var _0x323894={'where':_0x300c51[_0x7048('0x3b')]};return db[_0x7048('0x2c')][_0x7048('0x1e')](_0x323894)[_0x7048('0x24')](function(_0x1199c6){_0x19653b[_0x7048('0x1e')]=_0x1199c6;if(_0x1f4065['query'][_0x7048('0x41')]){_0x300c51[_0x7048('0x42')]=[{'all':!![]}];}return db[_0x7048('0x2c')][_0x7048('0x43')](_0x300c51);})[_0x7048('0x24')](function(_0x56c9d8){_0x19653b['rows']=_0x56c9d8;return _0x19653b;})['then'](respondWithFilteredResult(_0x531409,_0x300c51))['catch'](handleError(_0x531409,null));};exports[_0x7048('0x44')]=function(_0x484294,_0xf761e0){var _0x49db51={'raw':!![],'where':{'id':_0x484294[_0x7048('0x45')]['id']}},_0xfe8d9c={};_0xfe8d9c['model']=_[_0x7048('0x32')](db[_0x7048('0x2c')][_0x7048('0x2d')]);_0xfe8d9c[_0x7048('0x31')]=_[_0x7048('0x32')](_0x484294[_0x7048('0x31')]);_0xfe8d9c[_0x7048('0x33')]=_['intersection'](_0xfe8d9c[_0x7048('0x30')],_0xfe8d9c[_0x7048('0x31')]);_0x49db51[_0x7048('0x35')]=_[_0x7048('0x34')](_0xfe8d9c[_0x7048('0x30')],qs[_0x7048('0x36')](_0x484294[_0x7048('0x31')][_0x7048('0x36')]));_0x49db51[_0x7048('0x35')]=_0x49db51[_0x7048('0x35')][_0x7048('0x37')]?_0x49db51['attributes']:_0xfe8d9c[_0x7048('0x30')];if(_0x484294[_0x7048('0x31')]['includeAll']){_0x49db51[_0x7048('0x42')]=[{'all':!![]}];}_0x49db51=_['merge']({},_0x49db51,_0x484294['options']);return db['SmsApplication'][_0x7048('0x46')](_0x49db51)[_0x7048('0x24')](handleEntityNotFound(_0xf761e0,null))['then'](respondWithResult(_0xf761e0,null))['catch'](handleError(_0xf761e0,null));};exports[_0x7048('0x47')]=function(_0x24941d,_0x3e264c){return db[_0x7048('0x2c')]['create'](_0x24941d[_0x7048('0x48')],{})[_0x7048('0x24')](respondWithResult(_0x3e264c,0xc9))['catch'](handleError(_0x3e264c,null));};exports[_0x7048('0x23')]=function(_0x226d25,_0x228611){if(_0x226d25['body']['id']){delete _0x226d25['body']['id'];}return db[_0x7048('0x2c')][_0x7048('0x46')]({'where':{'id':_0x226d25['params']['id']}})[_0x7048('0x24')](handleEntityNotFound(_0x228611,null))[_0x7048('0x24')](saveUpdates(_0x226d25[_0x7048('0x48')],null))['then'](respondWithResult(_0x228611,null))[_0x7048('0x49')](handleError(_0x228611,null));};exports[_0x7048('0x25')]=function(_0x4162c5,_0x5d3e5d){return db[_0x7048('0x2c')][_0x7048('0x46')]({'where':{'id':_0x4162c5['params']['id']}})[_0x7048('0x24')](handleEntityNotFound(_0x5d3e5d,null))[_0x7048('0x24')](removeEntity(_0x5d3e5d,null))[_0x7048('0x49')](handleError(_0x5d3e5d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 439c5e3..91cd8ca 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 _0x2dd9=['utf8mb4_unicode_ci','lodash','api','moment','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4'];(function(_0x1185d7,_0x1164c1){var _0x25e58e=function(_0x27ae05){while(--_0x27ae05){_0x1185d7['push'](_0x1185d7['shift']());}};_0x25e58e(++_0x1164c1);}(_0x2dd9,0xde));var _0x92dd=function(_0x30fde1,_0x37b92e){_0x30fde1=_0x30fde1-0x0;var _0x5789aa=_0x2dd9[_0x30fde1];return _0x5789aa;};'use strict';var _=require(_0x92dd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x92dd('0x1'));var moment=require(_0x92dd('0x2'));var BPromise=require('bluebird');var rp=require(_0x92dd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92dd('0x4'));var config=require(_0x92dd('0x5'));var attributes=require(_0x92dd('0x6'));module[_0x92dd('0x7')]=function(_0x411044,_0x35373d){return _0x411044[_0x92dd('0x8')](_0x92dd('0x9'),attributes,{'tableName':_0x92dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x92dd('0xb'),'collate':_0x92dd('0xc')});}; \ No newline at end of file +var _0x8fc5=['moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','define','SmsApplication','util','api'];(function(_0x3b57fc,_0x1fbf22){var _0x146f10=function(_0x857ac3){while(--_0x857ac3){_0x3b57fc['push'](_0x3b57fc['shift']());}};_0x146f10(++_0x1fbf22);}(_0x8fc5,0x1ca));var _0x58fc=function(_0x5ade69,_0x8eeaa3){_0x5ade69=_0x5ade69-0x0;var _0x161671=_0x8fc5[_0x5ade69];return _0x161671;};'use strict';var _=require('lodash');var util=require(_0x58fc('0x0'));var logger=require('../../config/logger')(_0x58fc('0x1'));var moment=require(_0x58fc('0x2'));var BPromise=require(_0x58fc('0x3'));var rp=require(_0x58fc('0x4'));var fs=require('fs');var path=require(_0x58fc('0x5'));var rimraf=require('rimraf');var config=require(_0x58fc('0x6'));var attributes=require(_0x58fc('0x7'));module['exports']=function(_0x1f0c3d,_0x488955){return _0x1f0c3d[_0x58fc('0x8')](_0x58fc('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index dbd6244..cb0c6d8 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 _0xa5dd=['request','then','request\x20sent','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4e95d3,_0x24605c){var _0x4fef6b=function(_0x3cf293){while(--_0x3cf293){_0x4e95d3['push'](_0x4e95d3['shift']());}};_0x4fef6b(++_0x24605c);}(_0xa5dd,0x101));var _0xda5d=function(_0x222e1a,_0x30c00e){_0x222e1a=_0x222e1a-0x0;var _0x43f684=_0xa5dd[_0x222e1a];return _0x43f684;};'use strict';var _=require(_0xda5d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda5d('0x1'));var rs=require(_0xda5d('0x2'));var fs=require('fs');var Redis=require(_0xda5d('0x3'));var db=require(_0xda5d('0x4'))['db'];var utils=require(_0xda5d('0x5'));var logger=require('../../config/logger')(_0xda5d('0x6'));var config=require(_0xda5d('0x7'));var jayson=require(_0xda5d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x461283,_0x91cf4e,_0x432097){return new BPromise(function(_0x402aa8,_0x1c1e2d){return client[_0xda5d('0x9')](_0x461283,_0x432097)[_0xda5d('0xa')](function(_0x3d5c69){logger['info']('SmsApplication,\x20%s,\x20%s',_0x91cf4e,_0xda5d('0xb'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x91cf4e,_0xda5d('0xb'),JSON[_0xda5d('0xc')](_0x3d5c69));if(_0x3d5c69['error']){if(_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xe')]===0x1f4){logger[_0xda5d('0xd')]('SmsApplication,\x20%s,\x20%s',_0x91cf4e,_0x3d5c69['error'][_0xda5d('0xf')]);return _0x1c1e2d(_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xf')]);}logger[_0xda5d('0xd')](_0xda5d('0x10'),_0x91cf4e,_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xf')]);return _0x402aa8(_0x3d5c69['error']['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x91cf4e,'request\x20sent');_0x402aa8(_0x3d5c69[_0xda5d('0x11')][_0xda5d('0xf')]);}})[_0xda5d('0x12')](function(_0x388f40){logger[_0xda5d('0xd')](_0xda5d('0x10'),_0x91cf4e,_0x388f40);_0x1c1e2d(_0x388f40);});});} \ No newline at end of file +var _0xb2f3=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s'];(function(_0x178caa,_0x2efbc7){var _0x1caf1d=function(_0x3da22b){while(--_0x3da22b){_0x178caa['push'](_0x178caa['shift']());}};_0x1caf1d(++_0x2efbc7);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xb2f3[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x3b2f('0x0'));var util=require(_0x3b2f('0x1'));var moment=require(_0x3b2f('0x2'));var BPromise=require(_0x3b2f('0x3'));var rs=require(_0x3b2f('0x4'));var fs=require('fs');var Redis=require(_0x3b2f('0x5'));var db=require(_0x3b2f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b2f('0x7'))(_0x3b2f('0x8'));var config=require(_0x3b2f('0x9'));var jayson=require(_0x3b2f('0xa'));var client=jayson[_0x3b2f('0xb')][_0x3b2f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26719d,_0x4b3632,_0x200ca4){return new BPromise(function(_0x56e425,_0x266ed2){return client[_0x3b2f('0xd')](_0x26719d,_0x200ca4)[_0x3b2f('0xe')](function(_0x25134f){logger['info']('SmsApplication,\x20%s,\x20%s',_0x4b3632,_0x3b2f('0xf'));logger[_0x3b2f('0x10')](_0x3b2f('0x11'),_0x4b3632,_0x3b2f('0xf'),JSON[_0x3b2f('0x12')](_0x25134f));if(_0x25134f[_0x3b2f('0x13')]){if(_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x14')]===0x1f4){logger[_0x3b2f('0x13')](_0x3b2f('0x15'),_0x4b3632,_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x16')]);return _0x266ed2(_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x16')]);}logger[_0x3b2f('0x13')]('SmsApplication,\x20%s,\x20%s',_0x4b3632,_0x25134f[_0x3b2f('0x13')]['message']);return _0x56e425(_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x16')]);}else{logger['info'](_0x3b2f('0x15'),_0x4b3632,'request\x20sent');_0x56e425(_0x25134f[_0x3b2f('0x17')][_0x3b2f('0x16')]);}})[_0x3b2f('0x18')](function(_0xd2b1e9){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4b3632,_0xd2b1e9);_0x266ed2(_0xd2b1e9);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9729306..cb92ad0 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 _0x5eb8=['smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x17bde8,_0x2487e9){var _0x36f3d7=function(_0x2b689d){while(--_0x2b689d){_0x17bde8['push'](_0x17bde8['shift']());}};_0x36f3d7(++_0x2487e9);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x5eb8[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x14')]('/',auth['isAuthenticated'](),controller[_0x85eb('0x15')]);router[_0x85eb('0x14')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller['addMessage']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),interaction[_0x85eb('0x17')](_0x85eb('0x18'),_0x85eb('0x19')),controller[_0x85eb('0x1a')]);router[_0x85eb('0x1b')]('/:id',auth[_0x85eb('0xa')](),interaction['tracked'](_0x85eb('0x18'),_0x85eb('0x1c')),controller[_0x85eb('0x1d')]);router[_0x85eb('0x1e')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x85eb('0x18'),_0x85eb('0x1f')),controller[_0x85eb('0x20')]);router[_0x85eb('0x1e')](_0x85eb('0x16'),auth[_0x85eb('0xa')](),controller['removeTags']);module[_0x85eb('0x21')]=router; \ No newline at end of file +var _0x9c00=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','removeTags'];(function(_0x1ce7d5,_0x5198eb){var _0x586b82=function(_0x49cb85){while(--_0x49cb85){_0x1ce7d5['push'](_0x1ce7d5['shift']());}};_0x586b82(++_0x5198eb);}(_0x9c00,0x1a0));var _0x09c0=function(_0x802997,_0x5534a2){_0x802997=_0x802997-0x0;var _0x35c641=_0x9c00[_0x802997];return _0x35c641;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0x8')](_0x09c0('0xf'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0x11')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0x12')]);router[_0x09c0('0x11')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x13')]);router[_0x09c0('0x11')](_0x09c0('0x14'),auth[_0x09c0('0xa')](),interaction[_0x09c0('0x15')](_0x09c0('0x16'),_0x09c0('0x17')),controller[_0x09c0('0x18')]);router[_0x09c0('0x19')](_0x09c0('0x1a'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x09c0('0x1b')),controller[_0x09c0('0x1c')]);router[_0x09c0('0x1d')](_0x09c0('0x1a'),auth['isAuthenticated'](),interaction[_0x09c0('0x15')]('sms','smsinteraction:destroy'),controller[_0x09c0('0x1e')]);router['delete'](_0x09c0('0x14'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f2d4816..c6b2d9f 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 _0x7dee=['BOOLEAN','sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x158d35,_0x3457e7){var _0x3e70ce=function(_0x1b7f4a){while(--_0x1b7f4a){_0x158d35['push'](_0x158d35['shift']());}};_0x3e70ce(++_0x3457e7);}(_0x7dee,0xb0));var _0xe7de=function(_0x37446c,_0x2ec92d){_0x37446c=_0x37446c-0x0;var _0x34d055=_0x7dee[_0x37446c];return _0x34d055;};'use strict';var Sequelize=require(_0xe7de('0x0'));var moment=require('moment');module[_0xe7de('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe7de('0x2')]},'disposition':{'type':Sequelize[_0xe7de('0x3')]},'secondDisposition':{'type':Sequelize[_0xe7de('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe7de('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe7de('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe7de('0x4')]('in',_0xe7de('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe7de('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe7de('0x4')]('in',_0xe7de('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe7de('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x3435=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x3435,0xfa));var _0x5343=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x3435[_0xda464c];return _0x19e222;};'use strict';var Sequelize=require(_0x5343('0x0'));var moment=require(_0x5343('0x1'));module[_0x5343('0x2')]={'closed':{'type':Sequelize[_0x5343('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5343('0x4')]},'disposition':{'type':Sequelize[_0x5343('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5343('0x5')]},'note':{'type':Sequelize[_0x5343('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5343('0x6')]('in',_0x5343('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5343('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5343('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 f6d6630..144f494 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 _0x4f1c=['where','filters','pick','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','omit','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','User','fullname','CmContact','Contact','firstName','lastName','direction','SmsAccount','Account','push','Owner','get','mkdirSync','Sms','createdAt','closed','closedAt','Messages','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','moment','util','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','defaults','localhost','./smsInteraction.socket','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','update','then','destroy','error','stack','name','index','map','SmsInteraction','fieldName','type','key','sms','query','user','catch','show','params','model','rawAttributes','keys','intersection','attributes','length','includeAll','merge','find','create','body','describe','ids','getMessages','SmsMessage','fields','hasOwnProperty','order','sort'];(function(_0x372077,_0x26265a){var _0x5cffe8=function(_0x587dc7){while(--_0x587dc7){_0x372077['push'](_0x372077['shift']());}};_0x5cffe8(++_0x26265a);}(_0x4f1c,0x18f));var _0xc4f1=function(_0x1bcda8,_0x3ec454){_0x1bcda8=_0x1bcda8-0x0;var _0x4dfeee=_0x4f1c[_0x1bcda8];return _0x4dfeee;};'use strict';var rimraf=require(_0xc4f1('0x0'));var zipdir=require(_0xc4f1('0x1'));var moment=require(_0xc4f1('0x2'));var BPromise=require('bluebird');var util=require(_0xc4f1('0x3'));var path=require(_0xc4f1('0x4'));var ejs=require(_0xc4f1('0x5'));var fs=require('fs');var _=require(_0xc4f1('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xc4f1('0x7'));var pdf=require(_0xc4f1('0x8'));var logger=require('../../config/logger')(_0xc4f1('0x9'));var config=require(_0xc4f1('0xa'));var db=require('../../mysqldb')['db'];config[_0xc4f1('0xb')]=_[_0xc4f1('0xc')](config[_0xc4f1('0xb')],{'host':_0xc4f1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4f1('0xb')]));require(_0xc4f1('0xe'))['register'](socket);function respondWithStatusCode(_0xd2a57f,_0x480b3d){_0x480b3d=_0x480b3d||0xcc;return function(_0x904c96){if(_0x904c96){return _0xd2a57f[_0xc4f1('0xf')](_0x480b3d);}return _0xd2a57f[_0xc4f1('0x10')](_0x480b3d)[_0xc4f1('0x11')]();};}function respondWithResult(_0x1108be,_0x14af9c){_0x14af9c=_0x14af9c||0xc8;return function(_0x37b428){if(_0x37b428){return _0x1108be[_0xc4f1('0x10')](_0x14af9c)['json'](_0x37b428);}};}function respondWithFilteredResult(_0x3012e8,_0x123bf0){return function(_0x288ee5){if(_0x288ee5){var _0x110980=typeof _0x123bf0['offset']===_0xc4f1('0x12')&&typeof _0x123bf0[_0xc4f1('0x13')]===_0xc4f1('0x12');var _0x477ba9=_0x288ee5[_0xc4f1('0x14')];var _0x28b63a=_0x110980?0x0:_0x123bf0['offset'];var _0x37338b=_0x110980?_0x288ee5[_0xc4f1('0x14')]:_0x123bf0[_0xc4f1('0x15')]+_0x123bf0[_0xc4f1('0x13')];var _0x2fc8ff;if(_0x37338b>=_0x477ba9){_0x37338b=_0x477ba9;_0x2fc8ff=0xc8;}else{_0x2fc8ff=0xce;}_0x3012e8[_0xc4f1('0x10')](_0x2fc8ff);return _0x3012e8['set'](_0xc4f1('0x16'),_0x28b63a+'-'+_0x37338b+'/'+_0x477ba9)[_0xc4f1('0x17')](_0x288ee5);}return null;};}function saveUpdates(_0x23f64d){return function(_0x499745){if(_0x499745){return _0x499745[_0xc4f1('0x18')](_0x23f64d)[_0xc4f1('0x19')](function(_0x4b0d7d){return _0x4b0d7d;});}return null;};}function removeEntity(_0x10cae7){return function(_0x4bbc67){if(_0x4bbc67){return _0x4bbc67[_0xc4f1('0x1a')]()['then'](function(){_0x10cae7[_0xc4f1('0x10')](0xcc)[_0xc4f1('0x11')]();});}};}function handleEntityNotFound(_0x2046fa){return function(_0x18c99f){if(!_0x18c99f){_0x2046fa['sendStatus'](0x194);}return _0x18c99f;};}function handleError(_0x3c3b20,_0x549ad7){_0x549ad7=_0x549ad7||0x1f4;return function(_0xb67b50){logger[_0xc4f1('0x1b')](_0xb67b50[_0xc4f1('0x1c')]);if(_0xb67b50[_0xc4f1('0x1d')]){delete _0xb67b50[_0xc4f1('0x1d')];}_0x3c3b20[_0xc4f1('0x10')](_0x549ad7)['send'](_0xb67b50);};}exports[_0xc4f1('0x1e')]=function(_0xe4f1b6,_0x106d91){var _0x136402={};var _0x56a4dd=_[_0xc4f1('0x1f')](db[_0xc4f1('0x20')]['rawAttributes'],function(_0x2e2c04){return{'name':_0x2e2c04[_0xc4f1('0x21')],'type':_0x2e2c04[_0xc4f1('0x22')][_0xc4f1('0x23')]};});_0x136402=qs['getOptions'](_0x56a4dd,_0xe4f1b6);return interaction['findAll'](_0xc4f1('0x24'),_0xe4f1b6[_0xc4f1('0x25')],_0xe4f1b6[_0xc4f1('0x26')],_0x136402,_0x56a4dd)[_0xc4f1('0x19')](respondWithFilteredResult(_0x106d91,_0x136402))[_0xc4f1('0x27')](handleError(_0x106d91,null));};exports[_0xc4f1('0x28')]=function(_0x18f0bc,_0x50a10a){var _0x13eefb={'raw':![],'where':{'id':_0x18f0bc[_0xc4f1('0x29')]['id']}},_0x47d5a8={};_0x47d5a8[_0xc4f1('0x2a')]=_['keys'](db[_0xc4f1('0x20')][_0xc4f1('0x2b')]);_0x47d5a8[_0xc4f1('0x25')]=_[_0xc4f1('0x2c')](_0x18f0bc[_0xc4f1('0x25')]);_0x47d5a8['filters']=_[_0xc4f1('0x2d')](_0x47d5a8[_0xc4f1('0x2a')],_0x47d5a8['query']);_0x13eefb[_0xc4f1('0x2e')]=_[_0xc4f1('0x2d')](_0x47d5a8[_0xc4f1('0x2a')],qs['fields'](_0x18f0bc[_0xc4f1('0x25')]['fields']));_0x13eefb[_0xc4f1('0x2e')]=_0x13eefb['attributes'][_0xc4f1('0x2f')]?_0x13eefb['attributes']:_0x47d5a8[_0xc4f1('0x2a')];if(_0x18f0bc[_0xc4f1('0x25')][_0xc4f1('0x30')]){_0x13eefb['include']=[{'all':!![]}];}_0x13eefb=_[_0xc4f1('0x31')]({},_0x13eefb,_0x18f0bc['options']);return db['SmsInteraction'][_0xc4f1('0x32')](_0x13eefb)['then'](handleEntityNotFound(_0x50a10a,null))[_0xc4f1('0x19')](respondWithResult(_0x50a10a,null))[_0xc4f1('0x27')](handleError(_0x50a10a,null));};exports['create']=function(_0x50de9,_0xfefacb){return db[_0xc4f1('0x20')][_0xc4f1('0x33')](_0x50de9[_0xc4f1('0x34')],{})[_0xc4f1('0x19')](respondWithResult(_0xfefacb,0xc9))[_0xc4f1('0x27')](handleError(_0xfefacb,null));};exports[_0xc4f1('0x18')]=function(_0x49767e,_0x185d41){if(_0x49767e[_0xc4f1('0x34')]['id']){delete _0x49767e[_0xc4f1('0x34')]['id'];}return db[_0xc4f1('0x20')][_0xc4f1('0x32')]({'where':{'id':_0x49767e[_0xc4f1('0x29')]['id']}})[_0xc4f1('0x19')](handleEntityNotFound(_0x185d41,null))[_0xc4f1('0x19')](saveUpdates(_0x49767e['body'],null))[_0xc4f1('0x19')](respondWithResult(_0x185d41,null))[_0xc4f1('0x27')](handleError(_0x185d41,null));};exports[_0xc4f1('0x1a')]=function(_0x1d7736,_0x40e6d8){return db[_0xc4f1('0x20')][_0xc4f1('0x32')]({'where':{'id':_0x1d7736[_0xc4f1('0x29')]['id']}})[_0xc4f1('0x19')](handleEntityNotFound(_0x40e6d8,null))[_0xc4f1('0x19')](removeEntity(_0x40e6d8,null))[_0xc4f1('0x27')](handleError(_0x40e6d8,null));};exports[_0xc4f1('0x35')]=function(_0x234f3b,_0x4e0a1e){return db[_0xc4f1('0x20')][_0xc4f1('0x35')]()[_0xc4f1('0x19')](respondWithResult(_0x4e0a1e,null))['catch'](handleError(_0x4e0a1e,null));};exports['addMessage']=function(_0x256213,_0x1fa483){return db['SmsMessage'][_0xc4f1('0x32')]({'where':{'id':_0x256213[_0xc4f1('0x29')]['id']}})[_0xc4f1('0x19')](handleEntityNotFound(_0x1fa483,null))[_0xc4f1('0x19')](function(_0x82aa34){if(_0x82aa34){return _0x82aa34['addMessage'](_0x256213[_0xc4f1('0x34')][_0xc4f1('0x36')],_['omit'](_0x256213[_0xc4f1('0x34')],[_0xc4f1('0x36'),'id'])||{});}})['then'](respondWithResult(_0x1fa483,null))['catch'](handleError(_0x1fa483,null));};exports[_0xc4f1('0x37')]=function(_0x397408,_0x24fc99){var _0x488478={'raw':![],'where':{}};var _0x5a667c={};var _0x18e0b0={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x397408[_0xc4f1('0x29')]['id']}})[_0xc4f1('0x19')](handleEntityNotFound(_0x24fc99,null))[_0xc4f1('0x19')](function(_0x91416){if(_0x91416){_0x5a667c['model']=_[_0xc4f1('0x2c')](db[_0xc4f1('0x38')][_0xc4f1('0x2b')]);_0x5a667c[_0xc4f1('0x25')]=_[_0xc4f1('0x2c')](_0x397408[_0xc4f1('0x25')]);_0x5a667c['filters']=_['intersection'](_0x5a667c[_0xc4f1('0x2a')],_0x5a667c[_0xc4f1('0x25')]);_0x488478[_0xc4f1('0x2e')]=_[_0xc4f1('0x2d')](_0x5a667c['model'],qs[_0xc4f1('0x39')](_0x397408[_0xc4f1('0x25')][_0xc4f1('0x39')]));_0x488478[_0xc4f1('0x2e')]=_0x488478[_0xc4f1('0x2e')][_0xc4f1('0x2f')]?_0x488478[_0xc4f1('0x2e')]:_0x5a667c[_0xc4f1('0x2a')];if(!_0x397408[_0xc4f1('0x25')][_0xc4f1('0x3a')]('nolimit')){_0x488478[_0xc4f1('0x13')]=qs[_0xc4f1('0x13')](_0x397408[_0xc4f1('0x25')][_0xc4f1('0x13')]);_0x488478[_0xc4f1('0x15')]=qs[_0xc4f1('0x15')](_0x397408['query'][_0xc4f1('0x15')]);}_0x488478[_0xc4f1('0x3b')]=qs[_0xc4f1('0x3c')](_0x397408[_0xc4f1('0x25')][_0xc4f1('0x3c')]);_0x488478[_0xc4f1('0x3d')]=qs[_0xc4f1('0x3e')](_[_0xc4f1('0x3f')](_0x397408[_0xc4f1('0x25')],_0x5a667c[_0xc4f1('0x3e')]));_0x488478[_0xc4f1('0x3d')][_0xc4f1('0x40')]=_0x91416['id'];if(_0x397408['query'][_0xc4f1('0x41')]){_0x488478['where']=_['merge'](_0x488478[_0xc4f1('0x3d')],{'$or':_['map'](_0x488478['attributes'],function(_0x2778ff){var _0x2acea4={};_0x2acea4[_0x2778ff]={'$like':'%'+_0x397408[_0xc4f1('0x25')][_0xc4f1('0x41')]+'%'};return _0x2acea4;})});}if(_0x397408['query'][_0xc4f1('0x42')]){var _0x2318b0=_0x397408['query'][_0xc4f1('0x42')]['split'](',');var _0xe735a1={};_0xe735a1[_0x2318b0[0x0]]={'$gte':moment(_0x2318b0[0x1])[_0xc4f1('0x43')](_0xc4f1('0x44'))};_0x488478[_0xc4f1('0x3d')]=_['merge'](_0x488478[_0xc4f1('0x3d')],_0xe735a1);}_0x488478=_[_0xc4f1('0x31')]({},_0x488478,_0x397408['options']);return db['SmsMessage']['count']({'where':_0x488478[_0xc4f1('0x3d')]})[_0xc4f1('0x19')](function(_0x2aa339){_0x18e0b0[_0xc4f1('0x14')]=_0x2aa339;if(_0x397408['query'][_0xc4f1('0x30')]){_0x488478['include']=[{'all':!![]}];}return db[_0xc4f1('0x38')][_0xc4f1('0x45')](_0x488478);})[_0xc4f1('0x19')](function(_0x2a7827){_0x18e0b0[_0xc4f1('0x46')]=_0x2a7827;return _0x18e0b0;});}})['then'](respondWithFilteredResult(_0x24fc99,_0x488478))[_0xc4f1('0x27')](handleError(_0x24fc99,null));};exports[_0xc4f1('0x47')]=function(_0x2640d6,_0x47d02d){return db[_0xc4f1('0x20')][_0xc4f1('0x32')]({'where':{'id':_0x2640d6[_0xc4f1('0x29')]['id']}})[_0xc4f1('0x19')](handleEntityNotFound(_0x47d02d,null))['then'](function(_0x2c8b35){if(_0x2c8b35){return _0x2c8b35[_0xc4f1('0x48')](_0x2640d6[_0xc4f1('0x34')][_0xc4f1('0x36')],_[_0xc4f1('0x49')](_0x2640d6[_0xc4f1('0x34')],[_0xc4f1('0x36'),'id'])||{})[_0xc4f1('0x4a')](function(){return db[_0xc4f1('0x4b')][_0xc4f1('0x45')]({'attributes':['id','name',_0xc4f1('0x4c')],'where':{'id':_0x2640d6[_0xc4f1('0x34')][_0xc4f1('0x36')]}});})[_0xc4f1('0x19')](function(_0x260b68){socket[_0xc4f1('0x4d')](_0xc4f1('0x4e'),{'id':Number(_0x2640d6['params']['id']),'tags':_0x260b68||[]});return{'id':Number(_0x2640d6[_0xc4f1('0x29')]['id']),'tags':_0x260b68||[]};});}})[_0xc4f1('0x19')](respondWithResult(_0x47d02d,null))[_0xc4f1('0x27')](handleError(_0x47d02d,null));};exports['removeTags']=function(_0x37d06e,_0x261d6a){return db[_0xc4f1('0x20')][_0xc4f1('0x32')]({'where':{'id':_0x37d06e[_0xc4f1('0x29')]['id']}})[_0xc4f1('0x19')](handleEntityNotFound(_0x261d6a,null))['then'](function(_0xfbce50){if(_0xfbce50){return _0xfbce50[_0xc4f1('0x4f')](_0x37d06e[_0xc4f1('0x25')][_0xc4f1('0x36')]);}})[_0xc4f1('0x19')](respondWithStatusCode(_0x261d6a,null))[_0xc4f1('0x27')](handleError(_0x261d6a,null));};exports[_0xc4f1('0x50')]=function(_0x5e0ed5,_0x30d699){var _0xb16e0a=moment()[_0xc4f1('0x51')]()[_0xc4f1('0x52')]();var _0x42f032=path[_0xc4f1('0x53')](config[_0xc4f1('0x54')],_0xc4f1('0x55'),'files',_0xc4f1('0x56'));var _0x4e742e=path[_0xc4f1('0x53')](_0x42f032,_0xb16e0a);var _0x4abb7b=util[_0xc4f1('0x43')]('transcript-%d-%s.zip',_0x5e0ed5[_0xc4f1('0x29')]['id'],_0xb16e0a);var _0x2a51d1=path['join'](_0x42f032,_0x4abb7b);var _0x13dbd9=[];_0x13dbd9['push']({'model':db['User'],'as':_0xc4f1('0x57'),'attributes':['id',_0xc4f1('0x58')],'raw':!![]});_0x13dbd9['push']({'model':db[_0xc4f1('0x59')],'as':_0xc4f1('0x5a'),'attributes':['id',_0xc4f1('0x5b'),_0xc4f1('0x5c')],'raw':!![]});var _0x4ac080=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xc4f1('0x34'),'createdAt',_0xc4f1('0x5d'),'secret','read'],'include':_0x13dbd9}];_0x4ac080['push']({'model':db[_0xc4f1('0x5e')],'as':_0xc4f1('0x5f'),'attributes':['id','name']});_0x4ac080[_0xc4f1('0x60')]({'model':db['User'],'as':_0xc4f1('0x61'),'attributes':['id',_0xc4f1('0x58')]});return db[_0xc4f1('0x20')][_0xc4f1('0x32')]({'where':{'id':_0x5e0ed5[_0xc4f1('0x29')]['id']},'include':_0x4ac080})[_0xc4f1('0x19')](handleEntityNotFound(_0x30d699,null))[_0xc4f1('0x19')](function(_0x20d58c){if(_0x20d58c){var _0x260c22=_0x20d58c[_0xc4f1('0x62')]({'plain':!![]});fs[_0xc4f1('0x63')](_0x4e742e);var _0xee22d8={'channel':_0xc4f1('0x64'),'account':_0x260c22[_0xc4f1('0x5f')][_0xc4f1('0x1d')],'agent':_0x260c22[_0xc4f1('0x61')]?_0x260c22[_0xc4f1('0x61')][_0xc4f1('0x58')]:'N.A.','createdAt':moment(_0x260c22[_0xc4f1('0x65')])[_0xc4f1('0x43')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc4f1('0x52')](),'closedAt':_0x260c22[_0xc4f1('0x66')]?moment(_0x260c22[_0xc4f1('0x67')])[_0xc4f1('0x43')](_0xc4f1('0x44'))['toString']():'','disposition':_0x260c22['disposition'],'messages':_(_0x260c22[_0xc4f1('0x68')])[_0xc4f1('0x41')]({'secret':![]})[_0xc4f1('0x1f')](function(_0x3b9098){return{'date':moment(_0x3b9098[_0xc4f1('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xc4f1('0x52')](),'sender':_0x3b9098[_0xc4f1('0x5d')]===_0xc4f1('0x69')?_0x3b9098[_0xc4f1('0x57')]?_0x3b9098['User'][_0xc4f1('0x58')]:_0xc4f1('0x6a'):_0x3b9098['Contact'][_0xc4f1('0x5b')]+(_0x3b9098['Contact'][_0xc4f1('0x5c')]?'\x20'+_0x3b9098['Contact'][_0xc4f1('0x5c')]:''),'body':_0x3b9098[_0xc4f1('0x34')],'direction':_0x3b9098[_0xc4f1('0x5d')]==='out'?'A':'C','secret':_0x3b9098['secret'],'read':_0x3b9098['read']};})[_0xc4f1('0x6b')]()};return ejs[_0xc4f1('0x6c')](path[_0xc4f1('0x53')](config[_0xc4f1('0x54')],_0xc4f1('0x55'),_0xc4f1('0x6d'),_0xc4f1('0x6e')),{'interaction':_0xee22d8})[_0xc4f1('0x19')](function(_0x2dca10){var _0x35d510=path[_0xc4f1('0x53')](_0x4e742e,_0xc4f1('0x6f')+_0x260c22['id']+'-'+_0xb16e0a+_0xc4f1('0x70'));var _0x446e1e={'path':_0x35d510,'channel':_0xc4f1('0x64'),'interactionId':_0x260c22['id']};return pdf[_0xc4f1('0x71')](_0x2dca10,_0x446e1e);})[_0xc4f1('0x19')](function(){return new BPromise(function(_0x56cc9b,_0x320be6){zipdir(_0x4e742e,{'saveTo':_0x2a51d1},function(_0x1f9ab9,_0x4d818a){if(_0x1f9ab9)return _0x320be6(_0x1f9ab9);return _0x56cc9b(_0x4d818a);});})['then'](function(){return new BPromise(function(_0x181e41,_0x51c8a0){rimraf(_0x4e742e,function(_0x5f4ed6){if(_0x5f4ed6)_0x51c8a0(_0x5f4ed6);return _0x181e41();});});})['then'](function(){return _0x30d699['download'](_0x2a51d1,_0x4abb7b,function(_0x21443d){if(_0x21443d){console['log'](_0xc4f1('0x72'),_0x21443d);}else{fs['unlinkSync'](_0x2a51d1);}});});});}else{return _0x30d699[_0xc4f1('0xf')](0xc8);}})[_0xc4f1('0x27')](handleError(_0x30d699,null));}; \ No newline at end of file +var _0xba98=['update','then','error','name','index','SmsInteraction','fieldName','type','key','getOptions','findAll','sms','user','catch','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','find','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','include','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','root','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','createdAt','secret','SmsAccount','Owner','get','mkdirSync','Sms','Account','toString','closed','disposition','Messages','map','direction','out','System','read','renderFile','join','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x261527,_0x4aa9f5){var _0x540a18=function(_0xd6cd8){while(--_0xd6cd8){_0x261527['push'](_0x261527['shift']());}};_0x540a18(++_0x4aa9f5);}(_0xba98,0xdd));var _0x8ba9=function(_0x1b4a68,_0x59c033){_0x1b4a68=_0x1b4a68-0x0;var _0x78e106=_0xba98[_0x1b4a68];return _0x78e106;};'use strict';var rimraf=require(_0x8ba9('0x0'));var zipdir=require(_0x8ba9('0x1'));var moment=require('moment');var BPromise=require(_0x8ba9('0x2'));var util=require(_0x8ba9('0x3'));var path=require(_0x8ba9('0x4'));var ejs=require(_0x8ba9('0x5'));var fs=require('fs');var _=require(_0x8ba9('0x6'));var Redis=require(_0x8ba9('0x7'));var interaction=require(_0x8ba9('0x8'));var qs=require(_0x8ba9('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x8ba9('0xa'))('api');var config=require(_0x8ba9('0xb'));var db=require(_0x8ba9('0xc'))['db'];config[_0x8ba9('0xd')]=_['defaults'](config[_0x8ba9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ba9('0xe'))(new Redis(config[_0x8ba9('0xd')]));require(_0x8ba9('0xf'))[_0x8ba9('0x10')](socket);function respondWithStatusCode(_0x5811f3,_0xd362a8){_0xd362a8=_0xd362a8||0xcc;return function(_0x729eab){if(_0x729eab){return _0x5811f3[_0x8ba9('0x11')](_0xd362a8);}return _0x5811f3['status'](_0xd362a8)[_0x8ba9('0x12')]();};}function respondWithResult(_0x4a44e6,_0x28b5e8){_0x28b5e8=_0x28b5e8||0xc8;return function(_0x428ea1){if(_0x428ea1){return _0x4a44e6[_0x8ba9('0x13')](_0x28b5e8)[_0x8ba9('0x14')](_0x428ea1);}};}function respondWithFilteredResult(_0x3ef351,_0x345293){return function(_0x125666){if(_0x125666){var _0x30d6de=typeof _0x345293[_0x8ba9('0x15')]===_0x8ba9('0x16')&&typeof _0x345293[_0x8ba9('0x17')]===_0x8ba9('0x16');var _0xe8ddd9=_0x125666[_0x8ba9('0x18')];var _0x97da73=_0x30d6de?0x0:_0x345293[_0x8ba9('0x15')];var _0x7d943b=_0x30d6de?_0x125666[_0x8ba9('0x18')]:_0x345293[_0x8ba9('0x15')]+_0x345293['limit'];var _0x356a6f;if(_0x7d943b>=_0xe8ddd9){_0x7d943b=_0xe8ddd9;_0x356a6f=0xc8;}else{_0x356a6f=0xce;}_0x3ef351[_0x8ba9('0x13')](_0x356a6f);return _0x3ef351[_0x8ba9('0x19')](_0x8ba9('0x1a'),_0x97da73+'-'+_0x7d943b+'/'+_0xe8ddd9)['json'](_0x125666);}return null;};}function saveUpdates(_0x157971){return function(_0x45dc70){if(_0x45dc70){return _0x45dc70[_0x8ba9('0x1b')](_0x157971)[_0x8ba9('0x1c')](function(_0xb55625){return _0xb55625;});}return null;};}function removeEntity(_0x266c4b){return function(_0x4612b0){if(_0x4612b0){return _0x4612b0['destroy']()[_0x8ba9('0x1c')](function(){_0x266c4b[_0x8ba9('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca71e){return function(_0x409291){if(!_0x409291){_0x3ca71e[_0x8ba9('0x11')](0x194);}return _0x409291;};}function handleError(_0x52ba8c,_0x124254){_0x124254=_0x124254||0x1f4;return function(_0x5af9f7){logger[_0x8ba9('0x1d')](_0x5af9f7['stack']);if(_0x5af9f7[_0x8ba9('0x1e')]){delete _0x5af9f7[_0x8ba9('0x1e')];}_0x52ba8c['status'](_0x124254)['send'](_0x5af9f7);};}exports[_0x8ba9('0x1f')]=function(_0x10e9b1,_0x1c3662){var _0x381b1e={};var _0x308eee=_['map'](db[_0x8ba9('0x20')]['rawAttributes'],function(_0x1fe5bb){return{'name':_0x1fe5bb[_0x8ba9('0x21')],'type':_0x1fe5bb[_0x8ba9('0x22')][_0x8ba9('0x23')]};});_0x381b1e=qs[_0x8ba9('0x24')](_0x308eee,_0x10e9b1);return interaction[_0x8ba9('0x25')](_0x8ba9('0x26'),_0x10e9b1['query'],_0x10e9b1[_0x8ba9('0x27')],_0x381b1e,_0x308eee)[_0x8ba9('0x1c')](respondWithFilteredResult(_0x1c3662,_0x381b1e))[_0x8ba9('0x28')](handleError(_0x1c3662,null));};exports['show']=function(_0x37cc23,_0x3900ad){var _0x297e47={'raw':![],'where':{'id':_0x37cc23['params']['id']}},_0x125485={};_0x125485[_0x8ba9('0x29')]=_[_0x8ba9('0x2a')](db['SmsInteraction'][_0x8ba9('0x2b')]);_0x125485[_0x8ba9('0x2c')]=_[_0x8ba9('0x2a')](_0x37cc23[_0x8ba9('0x2c')]);_0x125485[_0x8ba9('0x2d')]=_[_0x8ba9('0x2e')](_0x125485[_0x8ba9('0x29')],_0x125485[_0x8ba9('0x2c')]);_0x297e47[_0x8ba9('0x2f')]=_[_0x8ba9('0x2e')](_0x125485['model'],qs[_0x8ba9('0x30')](_0x37cc23['query'][_0x8ba9('0x30')]));_0x297e47[_0x8ba9('0x2f')]=_0x297e47[_0x8ba9('0x2f')][_0x8ba9('0x31')]?_0x297e47[_0x8ba9('0x2f')]:_0x125485[_0x8ba9('0x29')];if(_0x37cc23[_0x8ba9('0x2c')][_0x8ba9('0x32')]){_0x297e47['include']=[{'all':!![]}];}_0x297e47=_['merge']({},_0x297e47,_0x37cc23['options']);return db[_0x8ba9('0x20')][_0x8ba9('0x33')](_0x297e47)[_0x8ba9('0x1c')](handleEntityNotFound(_0x3900ad,null))[_0x8ba9('0x1c')](respondWithResult(_0x3900ad,null))[_0x8ba9('0x28')](handleError(_0x3900ad,null));};exports[_0x8ba9('0x34')]=function(_0x13e453,_0x3713e4){return db[_0x8ba9('0x20')][_0x8ba9('0x34')](_0x13e453[_0x8ba9('0x35')],{})[_0x8ba9('0x1c')](respondWithResult(_0x3713e4,0xc9))[_0x8ba9('0x28')](handleError(_0x3713e4,null));};exports[_0x8ba9('0x1b')]=function(_0x4a4000,_0xc981c3){if(_0x4a4000[_0x8ba9('0x35')]['id']){delete _0x4a4000[_0x8ba9('0x35')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x4a4000[_0x8ba9('0x36')]['id']}})[_0x8ba9('0x1c')](handleEntityNotFound(_0xc981c3,null))[_0x8ba9('0x1c')](saveUpdates(_0x4a4000['body'],null))['then'](respondWithResult(_0xc981c3,null))[_0x8ba9('0x28')](handleError(_0xc981c3,null));};exports['destroy']=function(_0x16e916,_0x42670a){return db[_0x8ba9('0x20')][_0x8ba9('0x33')]({'where':{'id':_0x16e916[_0x8ba9('0x36')]['id']}})[_0x8ba9('0x1c')](handleEntityNotFound(_0x42670a,null))[_0x8ba9('0x1c')](removeEntity(_0x42670a,null))[_0x8ba9('0x28')](handleError(_0x42670a,null));};exports[_0x8ba9('0x37')]=function(_0x126d51,_0x4c2341){return db['SmsInteraction'][_0x8ba9('0x37')]()['then'](respondWithResult(_0x4c2341,null))[_0x8ba9('0x28')](handleError(_0x4c2341,null));};exports[_0x8ba9('0x38')]=function(_0x40563b,_0x498d42){return db[_0x8ba9('0x39')]['find']({'where':{'id':_0x40563b[_0x8ba9('0x36')]['id']}})[_0x8ba9('0x1c')](handleEntityNotFound(_0x498d42,null))['then'](function(_0x38e127){if(_0x38e127){return _0x38e127[_0x8ba9('0x38')](_0x40563b[_0x8ba9('0x35')][_0x8ba9('0x3a')],_[_0x8ba9('0x3b')](_0x40563b[_0x8ba9('0x35')],[_0x8ba9('0x3a'),'id'])||{});}})[_0x8ba9('0x1c')](respondWithResult(_0x498d42,null))[_0x8ba9('0x28')](handleError(_0x498d42,null));};exports[_0x8ba9('0x3c')]=function(_0x3a2d5e,_0x3a3fe6){var _0x1bfa83={'raw':![],'where':{}};var _0x484a80={};var _0x4a0ff0={'count':0x0,'rows':[]};return db[_0x8ba9('0x20')]['findOne']({'where':{'id':_0x3a2d5e[_0x8ba9('0x36')]['id']}})[_0x8ba9('0x1c')](handleEntityNotFound(_0x3a3fe6,null))[_0x8ba9('0x1c')](function(_0x393820){if(_0x393820){_0x484a80['model']=_[_0x8ba9('0x2a')](db[_0x8ba9('0x39')]['rawAttributes']);_0x484a80[_0x8ba9('0x2c')]=_['keys'](_0x3a2d5e[_0x8ba9('0x2c')]);_0x484a80[_0x8ba9('0x2d')]=_[_0x8ba9('0x2e')](_0x484a80['model'],_0x484a80[_0x8ba9('0x2c')]);_0x1bfa83[_0x8ba9('0x2f')]=_[_0x8ba9('0x2e')](_0x484a80['model'],qs[_0x8ba9('0x30')](_0x3a2d5e[_0x8ba9('0x2c')][_0x8ba9('0x30')]));_0x1bfa83[_0x8ba9('0x2f')]=_0x1bfa83[_0x8ba9('0x2f')]['length']?_0x1bfa83[_0x8ba9('0x2f')]:_0x484a80[_0x8ba9('0x29')];if(!_0x3a2d5e['query'][_0x8ba9('0x3d')](_0x8ba9('0x3e'))){_0x1bfa83['limit']=qs['limit'](_0x3a2d5e[_0x8ba9('0x2c')][_0x8ba9('0x17')]);_0x1bfa83[_0x8ba9('0x15')]=qs[_0x8ba9('0x15')](_0x3a2d5e[_0x8ba9('0x2c')][_0x8ba9('0x15')]);}_0x1bfa83[_0x8ba9('0x3f')]=qs[_0x8ba9('0x40')](_0x3a2d5e['query'][_0x8ba9('0x40')]);_0x1bfa83['where']=qs['filters'](_[_0x8ba9('0x41')](_0x3a2d5e[_0x8ba9('0x2c')],_0x484a80['filters']));_0x1bfa83[_0x8ba9('0x42')]['SmsInteractionId']=_0x393820['id'];if(_0x3a2d5e[_0x8ba9('0x2c')][_0x8ba9('0x43')]){_0x1bfa83[_0x8ba9('0x42')]=_['merge'](_0x1bfa83[_0x8ba9('0x42')],{'$or':_['map'](_0x1bfa83[_0x8ba9('0x2f')],function(_0xa52349){var _0x28bb80={};_0x28bb80[_0xa52349]={'$like':'%'+_0x3a2d5e[_0x8ba9('0x2c')][_0x8ba9('0x43')]+'%'};return _0x28bb80;})});}if(_0x3a2d5e[_0x8ba9('0x2c')][_0x8ba9('0x44')]){var _0x5502b2=_0x3a2d5e[_0x8ba9('0x2c')]['$gte'][_0x8ba9('0x45')](',');var _0x586491={};_0x586491[_0x5502b2[0x0]]={'$gte':moment(_0x5502b2[0x1])[_0x8ba9('0x46')](_0x8ba9('0x47'))};_0x1bfa83['where']=_[_0x8ba9('0x48')](_0x1bfa83[_0x8ba9('0x42')],_0x586491);}_0x1bfa83=_[_0x8ba9('0x48')]({},_0x1bfa83,_0x3a2d5e['options']);return db[_0x8ba9('0x39')][_0x8ba9('0x18')]({'where':_0x1bfa83[_0x8ba9('0x42')]})[_0x8ba9('0x1c')](function(_0x79caa6){_0x4a0ff0[_0x8ba9('0x18')]=_0x79caa6;if(_0x3a2d5e[_0x8ba9('0x2c')][_0x8ba9('0x32')]){_0x1bfa83[_0x8ba9('0x49')]=[{'all':!![]}];}return db[_0x8ba9('0x39')][_0x8ba9('0x25')](_0x1bfa83);})[_0x8ba9('0x1c')](function(_0x1bc2ef){_0x4a0ff0[_0x8ba9('0x4a')]=_0x1bc2ef;return _0x4a0ff0;});}})[_0x8ba9('0x1c')](respondWithFilteredResult(_0x3a3fe6,_0x1bfa83))[_0x8ba9('0x28')](handleError(_0x3a3fe6,null));};exports[_0x8ba9('0x4b')]=function(_0x27bcb1,_0x40f190){return db['SmsInteraction'][_0x8ba9('0x33')]({'where':{'id':_0x27bcb1[_0x8ba9('0x36')]['id']}})[_0x8ba9('0x1c')](handleEntityNotFound(_0x40f190,null))[_0x8ba9('0x1c')](function(_0x3fea97){if(_0x3fea97){return _0x3fea97[_0x8ba9('0x4c')](_0x27bcb1[_0x8ba9('0x35')][_0x8ba9('0x3a')],_[_0x8ba9('0x3b')](_0x27bcb1[_0x8ba9('0x35')],[_0x8ba9('0x3a'),'id'])||{})[_0x8ba9('0x4d')](function(){return db[_0x8ba9('0x4e')][_0x8ba9('0x25')]({'attributes':['id',_0x8ba9('0x1e'),_0x8ba9('0x4f')],'where':{'id':_0x27bcb1[_0x8ba9('0x35')][_0x8ba9('0x3a')]}});})[_0x8ba9('0x1c')](function(_0x3f1e43){socket[_0x8ba9('0x50')](_0x8ba9('0x51'),{'id':Number(_0x27bcb1[_0x8ba9('0x36')]['id']),'tags':_0x3f1e43||[]});return{'id':Number(_0x27bcb1[_0x8ba9('0x36')]['id']),'tags':_0x3f1e43||[]};});}})[_0x8ba9('0x1c')](respondWithResult(_0x40f190,null))['catch'](handleError(_0x40f190,null));};exports['removeTags']=function(_0x14f521,_0x268020){return db[_0x8ba9('0x20')]['find']({'where':{'id':_0x14f521[_0x8ba9('0x36')]['id']}})['then'](handleEntityNotFound(_0x268020,null))[_0x8ba9('0x1c')](function(_0x4c2ead){if(_0x4c2ead){return _0x4c2ead[_0x8ba9('0x52')](_0x14f521[_0x8ba9('0x2c')]['ids']);}})[_0x8ba9('0x1c')](respondWithStatusCode(_0x268020,null))[_0x8ba9('0x28')](handleError(_0x268020,null));};exports[_0x8ba9('0x53')]=function(_0x41187e,_0x19f1f6){var _0xbf8ec1=moment()[_0x8ba9('0x54')]()['toString']();var _0x2dc148=path['join'](config[_0x8ba9('0x55')],'server',_0x8ba9('0x56'),_0x8ba9('0x57'));var _0x2701f3=path['join'](_0x2dc148,_0xbf8ec1);var _0x184490=util[_0x8ba9('0x46')](_0x8ba9('0x58'),_0x41187e[_0x8ba9('0x36')]['id'],_0xbf8ec1);var _0x170eb8=path['join'](_0x2dc148,_0x184490);var _0x352097=[];_0x352097[_0x8ba9('0x59')]({'model':db[_0x8ba9('0x5a')],'as':_0x8ba9('0x5a'),'attributes':['id',_0x8ba9('0x5b')],'raw':!![]});_0x352097['push']({'model':db[_0x8ba9('0x5c')],'as':_0x8ba9('0x5d'),'attributes':['id',_0x8ba9('0x5e'),_0x8ba9('0x5f')],'raw':!![]});var _0x5efade=[{'model':db[_0x8ba9('0x39')],'as':'Messages','attributes':['id',_0x8ba9('0x35'),_0x8ba9('0x60'),'direction',_0x8ba9('0x61'),'read'],'include':_0x352097}];_0x5efade[_0x8ba9('0x59')]({'model':db[_0x8ba9('0x62')],'as':'Account','attributes':['id',_0x8ba9('0x1e')]});_0x5efade[_0x8ba9('0x59')]({'model':db['User'],'as':_0x8ba9('0x63'),'attributes':['id',_0x8ba9('0x5b')]});return db[_0x8ba9('0x20')][_0x8ba9('0x33')]({'where':{'id':_0x41187e[_0x8ba9('0x36')]['id']},'include':_0x5efade})['then'](handleEntityNotFound(_0x19f1f6,null))[_0x8ba9('0x1c')](function(_0x4bd4da){if(_0x4bd4da){var _0x433d20=_0x4bd4da[_0x8ba9('0x64')]({'plain':!![]});fs[_0x8ba9('0x65')](_0x2701f3);var _0x512303={'channel':_0x8ba9('0x66'),'account':_0x433d20[_0x8ba9('0x67')][_0x8ba9('0x1e')],'agent':_0x433d20[_0x8ba9('0x63')]?_0x433d20[_0x8ba9('0x63')][_0x8ba9('0x5b')]:'N.A.','createdAt':moment(_0x433d20[_0x8ba9('0x60')])[_0x8ba9('0x46')](_0x8ba9('0x47'))[_0x8ba9('0x68')](),'closedAt':_0x433d20[_0x8ba9('0x69')]?moment(_0x433d20['closedAt'])[_0x8ba9('0x46')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x433d20[_0x8ba9('0x6a')],'messages':_(_0x433d20[_0x8ba9('0x6b')])[_0x8ba9('0x43')]({'secret':![]})[_0x8ba9('0x6c')](function(_0x2a4dd1){return{'date':moment(_0x2a4dd1[_0x8ba9('0x60')])['format'](_0x8ba9('0x47'))[_0x8ba9('0x68')](),'sender':_0x2a4dd1[_0x8ba9('0x6d')]===_0x8ba9('0x6e')?_0x2a4dd1[_0x8ba9('0x5a')]?_0x2a4dd1[_0x8ba9('0x5a')][_0x8ba9('0x5b')]:_0x8ba9('0x6f'):_0x2a4dd1[_0x8ba9('0x5d')]['firstName']+(_0x2a4dd1[_0x8ba9('0x5d')]['lastName']?'\x20'+_0x2a4dd1['Contact'][_0x8ba9('0x5f')]:''),'body':_0x2a4dd1['body'],'direction':_0x2a4dd1[_0x8ba9('0x6d')]===_0x8ba9('0x6e')?'A':'C','secret':_0x2a4dd1[_0x8ba9('0x61')],'read':_0x2a4dd1[_0x8ba9('0x70')]};})['value']()};return ejs[_0x8ba9('0x71')](path[_0x8ba9('0x72')](config[_0x8ba9('0x55')],_0x8ba9('0x73'),_0x8ba9('0x74'),_0x8ba9('0x75')),{'interaction':_0x512303})[_0x8ba9('0x1c')](function(_0x5802e1){var _0x5b2146=path[_0x8ba9('0x72')](_0x2701f3,_0x8ba9('0x76')+_0x433d20['id']+'-'+_0xbf8ec1+_0x8ba9('0x77'));var _0x265468={'path':_0x5b2146,'channel':'Sms','interactionId':_0x433d20['id']};return pdf[_0x8ba9('0x78')](_0x5802e1,_0x265468);})[_0x8ba9('0x1c')](function(){return new BPromise(function(_0x5c2687,_0x1fee93){zipdir(_0x2701f3,{'saveTo':_0x170eb8},function(_0x56912a,_0x421dbd){if(_0x56912a)return _0x1fee93(_0x56912a);return _0x5c2687(_0x421dbd);});})['then'](function(){return new BPromise(function(_0x4b96d9,_0x13d289){rimraf(_0x2701f3,function(_0x3e7dc8){if(_0x3e7dc8)_0x13d289(_0x3e7dc8);return _0x4b96d9();});});})[_0x8ba9('0x1c')](function(){return _0x19f1f6[_0x8ba9('0x53')](_0x170eb8,_0x184490,function(_0xce0f6e){if(_0xce0f6e){console[_0x8ba9('0x79')](_0x8ba9('0x7a'),_0xce0f6e);}else{fs[_0x8ba9('0x7b')](_0x170eb8);}});});});}else{return _0x19f1f6[_0x8ba9('0x11')](0xc8);}})[_0x8ba9('0x28')](handleError(_0x19f1f6,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index bb66d9c..f6ae302 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 _0xcf66=['setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','remove','getUsers'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xcf66,0x71));var _0x6cf6=function(_0x5bc1d6,_0x466c8e){_0x5bc1d6=_0x5bc1d6-0x0;var _0x4abadb=_0xcf66[_0x5bc1d6];return _0x4abadb;};'use strict';var EventEmitter=require(_0x6cf6('0x0'));var SmsInteraction=require(_0x6cf6('0x1'))['db'][_0x6cf6('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x6cf6('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6cf6('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6cf6('0x5')};function emitEvent(_0x45d0d8){return function(_0x57f22f,_0x39f1d6,_0x1fbedd){_0x57f22f[_0x6cf6('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x94c6a9){_0x57f22f[_0x6cf6('0x7')](_0x6cf6('0x8'),_0x94c6a9[_0x6cf6('0x9')](function(_0x175b18){return{'id':_0x175b18['id']};}));return SmsMessage[_0x6cf6('0xa')]({'where':{'SmsInteractionId':_0x57f22f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x58378c){_0x57f22f['setDataValue'](_0x6cf6('0xb'),_0x58378c['length']);SmsInteractionEvents[_0x6cf6('0xc')](_0x45d0d8+':'+_0x57f22f['id'],_0x57f22f);SmsInteractionEvents[_0x6cf6('0xc')](_0x45d0d8,_0x57f22f);_0x1fbedd(null);})[_0x6cf6('0xd')](_0x1fbedd(null));};}for(var e in events){if(events[_0x6cf6('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x5b12=['exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0xa57e2c,_0x259d77){var _0x18882a=function(_0x31a665){while(--_0x31a665){_0xa57e2c['push'](_0xa57e2c['shift']());}};_0x18882a(++_0x259d77);}(_0x5b12,0xa3));var _0x25b1=function(_0x5127fc,_0x10bab7){_0x5127fc=_0x5127fc-0x0;var _0x26ebf7=_0x5b12[_0x5127fc];return _0x26ebf7;};'use strict';var EventEmitter=require(_0x25b1('0x0'));var SmsInteraction=require(_0x25b1('0x1'))['db'][_0x25b1('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x25b1('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x25b1('0x4'),'afterUpdate':_0x25b1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x31f3fc){return function(_0x56378e,_0x5248c2,_0x35d90b){_0x56378e['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1f715d){_0x56378e[_0x25b1('0x6')](_0x25b1('0x7'),_0x1f715d[_0x25b1('0x8')](function(_0x1ed594){return{'id':_0x1ed594['id']};}));return SmsMessage[_0x25b1('0x9')]({'where':{'SmsInteractionId':_0x56378e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x25b1('0xa')](function(_0x6235e2){_0x56378e['setDataValue'](_0x25b1('0xb'),_0x6235e2[_0x25b1('0xc')]);SmsInteractionEvents[_0x25b1('0xd')](_0x31f3fc+':'+_0x56378e['id'],_0x56378e);SmsInteractionEvents[_0x25b1('0xd')](_0x31f3fc,_0x56378e);_0x35d90b(null);})[_0x25b1('0xe')](_0x35d90b(null));};}for(var e in events){if(events[_0x25b1('0xf')](e)){var event=events[e];SmsInteraction[_0x25b1('0x10')](e,emitEvent(event));}}module[_0x25b1('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0b450e1..d96cea2 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 _0xc8a3=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x15681c,_0x1de42e){var _0x1cddf6=function(_0x38a706){while(--_0x38a706){_0x15681c['push'](_0x15681c['shift']());}};_0x1cddf6(++_0x1de42e);}(_0xc8a3,0x1ae));var _0x3c8a=function(_0x3d46d5,_0x27ed3b){_0x3d46d5=_0x3d46d5-0x0;var _0x4b5f73=_0xc8a3[_0x3d46d5];return _0x4b5f73;};'use strict';var _=require(_0x3c8a('0x0'));var util=require(_0x3c8a('0x1'));var logger=require(_0x3c8a('0x2'))(_0x3c8a('0x3'));var moment=require(_0x3c8a('0x4'));var BPromise=require(_0x3c8a('0x5'));var rp=require(_0x3c8a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c8a('0x7'));var config=require(_0x3c8a('0x8'));var attributes=require(_0x3c8a('0x9'));module[_0x3c8a('0xa')]=function(_0x519e7c,_0x8af40a){return _0x519e7c[_0x3c8a('0xb')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46ac5c,_0x563f72,_0x3efd36){if(_0x46ac5c['changed']('closed')){_0x46ac5c['closedAt']=moment()[_0x3c8a('0xc')](_0x3c8a('0xd'));}_0x3efd36(null,_0x46ac5c);}}});}; \ No newline at end of file +var _0x8ed9=['sms_interactions','closed','closedAt','format','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5699a0,_0x26289e){var _0x14eff2=function(_0x473f75){while(--_0x473f75){_0x5699a0['push'](_0x5699a0['shift']());}};_0x14eff2(++_0x26289e);}(_0x8ed9,0xc7));var _0x98ed=function(_0x4e76da,_0x291b71){_0x4e76da=_0x4e76da-0x0;var _0x5f14e8=_0x8ed9[_0x4e76da];return _0x5f14e8;};'use strict';var _=require('lodash');var util=require(_0x98ed('0x0'));var logger=require('../../config/logger')(_0x98ed('0x1'));var moment=require(_0x98ed('0x2'));var BPromise=require(_0x98ed('0x3'));var rp=require(_0x98ed('0x4'));var fs=require('fs');var path=require(_0x98ed('0x5'));var rimraf=require(_0x98ed('0x6'));var config=require(_0x98ed('0x7'));var attributes=require('./smsInteraction.attributes');module[_0x98ed('0x8')]=function(_0x2bd6eb,_0x2cc532){return _0x2bd6eb['define']('SmsInteraction',attributes,{'tableName':_0x98ed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x37bc60,_0x417408,_0x2941ca){if(_0x37bc60['changed'](_0x98ed('0xa'))){_0x37bc60[_0x98ed('0xb')]=moment()[_0x98ed('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2941ca(null,_0x37bc60);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3462b43..5b75050 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 _0xccea=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','result','UpdateSmsInteraction','SmsInteraction','update','options','where','attributes','catch','AddTagsToSmsInteraction','then','omit','body','ids','spread','AddTags','stringify'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xccea,0x103));var _0xacce=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xccea[_0x298ed3];return _0x5aad28;};'use strict';var _=require('lodash');var util=require(_0xacce('0x0'));var moment=require(_0xacce('0x1'));var BPromise=require('bluebird');var rs=require(_0xacce('0x2'));var fs=require('fs');var Redis=require(_0xacce('0x3'));var db=require(_0xacce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xacce('0x5'))('rpc');var config=require(_0xacce('0x6'));var jayson=require(_0xacce('0x7'));var client=jayson['client'][_0xacce('0x8')]({'port':0x232a});config[_0xacce('0x9')]=_[_0xacce('0xa')](config[_0xacce('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xacce('0xb'))(new Redis(config[_0xacce('0x9')]));require(_0xacce('0xc'))['register'](socket);function respondWithRpcPromise(_0x362be2,_0xfb847c,_0x1f79cf){return new BPromise(function(_0x5aeac0,_0x16c4e3){return client[_0xacce('0xd')](_0x362be2,_0x1f79cf)['then'](function(_0x1a503b){logger[_0xacce('0xe')](_0xacce('0xf'),_0xfb847c,_0xacce('0x10'));logger[_0xacce('0x11')](_0xacce('0x12'),_0xfb847c,'request\x20sent',JSON['stringify'](_0x1a503b));if(_0x1a503b[_0xacce('0x13')]){if(_0x1a503b['error']['code']===0x1f4){logger[_0xacce('0x13')](_0xacce('0xf'),_0xfb847c,_0x1a503b[_0xacce('0x13')][_0xacce('0x14')]);return _0x16c4e3(_0x1a503b['error']['message']);}logger[_0xacce('0x13')](_0xacce('0xf'),_0xfb847c,_0x1a503b[_0xacce('0x13')][_0xacce('0x14')]);return _0x5aeac0(_0x1a503b['error'][_0xacce('0x14')]);}else{logger[_0xacce('0xe')](_0xacce('0xf'),_0xfb847c,'request\x20sent');_0x5aeac0(_0x1a503b[_0xacce('0x15')][_0xacce('0x14')]);}})['catch'](function(_0x307edc){logger[_0xacce('0x13')](_0xacce('0xf'),_0xfb847c,_0x307edc);_0x16c4e3(_0x307edc);});});}exports[_0xacce('0x16')]=function(_0xe58983){var _0xd64125=this;return new Promise(function(_0x4b0bd1,_0x25adb7){return db[_0xacce('0x17')][_0xacce('0x18')](_0xe58983['body'],{'raw':_0xe58983[_0xacce('0x19')]?_0xe58983[_0xacce('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe58983[_0xacce('0x19')]?_0xe58983[_0xacce('0x19')][_0xacce('0x1a')]||null:null,'attributes':_0xe58983['options']?_0xe58983[_0xacce('0x19')][_0xacce('0x1b')]||null:null,'limit':_0xe58983[_0xacce('0x19')]?_0xe58983[_0xacce('0x19')]['limit']||null:null})['then'](function(_0x357046){logger[_0xacce('0xe')](_0xacce('0x16'),_0xe58983);logger[_0xacce('0x11')]('UpdateSmsInteraction',_0xe58983,JSON['stringify'](_0x357046));_0x4b0bd1(_0x357046);})[_0xacce('0x1c')](function(_0x2b5f29){logger['error'](_0xacce('0x16'),_0x2b5f29[_0xacce('0x14')],_0xe58983);_0x25adb7(_0xd64125['error'](0x1f4,_0x2b5f29['message']));});});};exports[_0xacce('0x1d')]=function(_0x221bac){return new Promise(function(_0x4c9d48,_0x3030d9){return db[_0xacce('0x17')]['find']({'where':_0x221bac['options']?_0x221bac[_0xacce('0x19')]['where']||null:null})[_0xacce('0x1e')](function(_0x5316ef){if(_0x5316ef){return _0x5316ef['addTags'](_0x221bac['body']['ids'],_[_0xacce('0x1f')](_0x221bac[_0xacce('0x20')],[_0xacce('0x21'),'id'])||{});}})[_0xacce('0x22')](function(_0x44ee28){logger[_0xacce('0xe')]('AddTags',_0x221bac);logger[_0xacce('0x11')](_0xacce('0x23'),_0x221bac,JSON[_0xacce('0x24')](_0x44ee28));_0x4c9d48(_0x44ee28);})['catch'](function(_0x29d01e){logger[_0xacce('0x13')](_0xacce('0x23'),_0x29d01e[_0xacce('0x14')],_0x221bac);_0x3030d9(_this['error'](0x1f4,_0x29d01e[_0xacce('0x14')]));});});}; \ No newline at end of file +var _0x8a62=['ids','omit','AddTags','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','localhost','redis','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','options','raw','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','body'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8a62,0x9b));var _0x28a6=function(_0x2000dd,_0x234e25){_0x2000dd=_0x2000dd-0x0;var _0x4c6b54=_0x8a62[_0x2000dd];return _0x4c6b54;};'use strict';var _=require(_0x28a6('0x0'));var util=require('util');var moment=require(_0x28a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x28a6('0x2'));var fs=require('fs');var Redis=require(_0x28a6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x28a6('0x4'));var logger=require('../../config/logger')(_0x28a6('0x5'));var config=require(_0x28a6('0x6'));var jayson=require(_0x28a6('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x28a6('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28a6('0x9')]));require(_0x28a6('0xa'))[_0x28a6('0xb')](socket);function respondWithRpcPromise(_0x4b3462,_0x283c4f,_0x369ae3){return new BPromise(function(_0x12df82,_0x50cfb2){return client[_0x28a6('0xc')](_0x4b3462,_0x369ae3)[_0x28a6('0xd')](function(_0x5880f9){logger[_0x28a6('0xe')]('SmsInteraction,\x20%s,\x20%s',_0x283c4f,_0x28a6('0xf'));logger[_0x28a6('0x10')](_0x28a6('0x11'),_0x283c4f,_0x28a6('0xf'),JSON[_0x28a6('0x12')](_0x5880f9));if(_0x5880f9[_0x28a6('0x13')]){if(_0x5880f9[_0x28a6('0x13')]['code']===0x1f4){logger[_0x28a6('0x13')](_0x28a6('0x14'),_0x283c4f,_0x5880f9['error'][_0x28a6('0x15')]);return _0x50cfb2(_0x5880f9[_0x28a6('0x13')]['message']);}logger['error'](_0x28a6('0x14'),_0x283c4f,_0x5880f9[_0x28a6('0x13')][_0x28a6('0x15')]);return _0x12df82(_0x5880f9[_0x28a6('0x13')][_0x28a6('0x15')]);}else{logger[_0x28a6('0xe')](_0x28a6('0x14'),_0x283c4f,'request\x20sent');_0x12df82(_0x5880f9[_0x28a6('0x16')][_0x28a6('0x15')]);}})[_0x28a6('0x17')](function(_0x12c059){logger[_0x28a6('0x13')](_0x28a6('0x14'),_0x283c4f,_0x12c059);_0x50cfb2(_0x12c059);});});}exports['UpdateSmsInteraction']=function(_0x561ae5){var _0x329675=this;return new Promise(function(_0x4793a8,_0x37924e){return db[_0x28a6('0x18')][_0x28a6('0x19')](_0x561ae5['body'],{'raw':_0x561ae5[_0x28a6('0x1a')]?_0x561ae5[_0x28a6('0x1a')][_0x28a6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x561ae5['options']?_0x561ae5['options'][_0x28a6('0x1c')]||null:null,'attributes':_0x561ae5[_0x28a6('0x1a')]?_0x561ae5[_0x28a6('0x1a')]['attributes']||null:null,'limit':_0x561ae5[_0x28a6('0x1a')]?_0x561ae5['options'][_0x28a6('0x1d')]||null:null})[_0x28a6('0xd')](function(_0xc08303){logger[_0x28a6('0xe')](_0x28a6('0x1e'),_0x561ae5);logger[_0x28a6('0x10')](_0x28a6('0x1e'),_0x561ae5,JSON['stringify'](_0xc08303));_0x4793a8(_0xc08303);})[_0x28a6('0x17')](function(_0x549dc9){logger['error'](_0x28a6('0x1e'),_0x549dc9[_0x28a6('0x15')],_0x561ae5);_0x37924e(_0x329675[_0x28a6('0x13')](0x1f4,_0x549dc9[_0x28a6('0x15')]));});});};exports[_0x28a6('0x1f')]=function(_0xb8a548){return new Promise(function(_0x5510d1,_0x1172e3){return db[_0x28a6('0x18')][_0x28a6('0x20')]({'where':_0xb8a548['options']?_0xb8a548['options'][_0x28a6('0x1c')]||null:null})[_0x28a6('0xd')](function(_0x161131){if(_0x161131){return _0x161131[_0x28a6('0x21')](_0xb8a548[_0x28a6('0x22')][_0x28a6('0x23')],_[_0x28a6('0x24')](_0xb8a548['body'],[_0x28a6('0x23'),'id'])||{});}})['spread'](function(_0x30954b){logger[_0x28a6('0xe')](_0x28a6('0x25'),_0xb8a548);logger[_0x28a6('0x10')](_0x28a6('0x25'),_0xb8a548,JSON[_0x28a6('0x12')](_0x30954b));_0x5510d1(_0x30954b);})[_0x28a6('0x17')](function(_0x29c4ac){logger[_0x28a6('0x13')]('AddTags',_0x29c4ac['message'],_0xb8a548);_0x1172e3(_this[_0x28a6('0x13')](0x1f4,_0x29c4ac['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 77fe63b..3a18c20 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 _0xd2b9=['./smsInteraction.events','remove','removeListener','register'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xd2b9,0x84));var _0x9d2b=function(_0x291e73,_0x240beb){_0x291e73=_0x291e73-0x0;var _0x15a90f=_0xd2b9[_0x291e73];return _0x15a90f;};'use strict';var SmsInteractionEvents=require(_0x9d2b('0x0'));var events=['save',_0x9d2b('0x1'),'update'];function createListener(_0x163652,_0x542b4f){return function(_0x199be1){_0x542b4f['emit'](_0x163652,_0x199be1);};}function removeListener(_0x5b6b33,_0x28bbfb){return function(){SmsInteractionEvents[_0x9d2b('0x2')](_0x5b6b33,_0x28bbfb);};}exports[_0x9d2b('0x3')]=function(_0xb76e5e){for(var _0x232d22=0x0,_0x13dc0f=events['length'];_0x232d22<_0x13dc0f;_0x232d22++){var _0x40a8d5=events[_0x232d22];var _0x22efc2=createListener('smsInteraction:'+_0x40a8d5,_0xb76e5e);SmsInteractionEvents['on'](_0x40a8d5,_0x22efc2);}}; \ No newline at end of file +var _0xf882=['update','emit','register','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x323591,_0x518650){var _0x423982=function(_0x1b7a15){while(--_0x1b7a15){_0x323591['push'](_0x323591['shift']());}};_0x423982(++_0x518650);}(_0xf882,0xcd));var _0x2f88=function(_0x4ec43f,_0x3b3cba){_0x4ec43f=_0x4ec43f-0x0;var _0x49afc3=_0xf882[_0x4ec43f];return _0x49afc3;};'use strict';var SmsInteractionEvents=require(_0x2f88('0x0'));var events=[_0x2f88('0x1'),_0x2f88('0x2'),_0x2f88('0x3')];function createListener(_0x44c842,_0x1d0edd){return function(_0x584f0c){_0x1d0edd[_0x2f88('0x4')](_0x44c842,_0x584f0c);};}function removeListener(_0x24522f,_0x59555e){return function(){SmsInteractionEvents['removeListener'](_0x24522f,_0x59555e);};}exports[_0x2f88('0x5')]=function(_0x36a0f1){for(var _0x4ba175=0x0,_0x5b0935=events[_0x2f88('0x6')];_0x4ba175<_0x5b0935;_0x4ba175++){var _0xf8962b=events[_0x4ba175];var _0x1a5117=createListener(_0x2f88('0x7')+_0xf8962b,_0x36a0f1);SmsInteractionEvents['on'](_0xf8962b,_0x1a5117);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index bb70574..de4152b 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 _0x0c4f=['/describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x0c4f,0x199));var _0xf0c4=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x0c4f[_0x467488];return _0x56107f;};'use strict';var multer=require(_0xf0c4('0x0'));var util=require(_0xf0c4('0x1'));var path=require(_0xf0c4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf0c4('0x3')]();var fs_extra=require(_0xf0c4('0x4'));var auth=require(_0xf0c4('0x5'));var interaction=require(_0xf0c4('0x6'));var config=require('../../config/environment');var controller=require(_0xf0c4('0x7'));router[_0xf0c4('0x8')]('/',auth[_0xf0c4('0x9')](),controller[_0xf0c4('0xa')]);router[_0xf0c4('0x8')](_0xf0c4('0xb'),auth[_0xf0c4('0x9')](),controller['describe']);router[_0xf0c4('0x8')](_0xf0c4('0xc'),auth['isAuthenticated'](),controller[_0xf0c4('0xd')]);router['post']('/',auth[_0xf0c4('0x9')](),interaction[_0xf0c4('0xe')](_0xf0c4('0xf'),_0xf0c4('0x10')),controller[_0xf0c4('0x11')]);router[_0xf0c4('0x12')](_0xf0c4('0x13'),controller['status']);router[_0xf0c4('0x14')]('/:id',auth[_0xf0c4('0x9')](),controller[_0xf0c4('0x15')]);router[_0xf0c4('0x14')](_0xf0c4('0x16'),auth[_0xf0c4('0x9')](),controller[_0xf0c4('0x17')]);router[_0xf0c4('0x14')](_0xf0c4('0x18'),auth[_0xf0c4('0x9')](),controller['reject']);router[_0xf0c4('0x19')](_0xf0c4('0xc'),auth['isAuthenticated'](),controller[_0xf0c4('0x1a')]);module[_0xf0c4('0x1b')]=router; \ No newline at end of file +var _0xa3b7=['index','get','/describe','describe','show','post','tracked','sms','create','/:id/status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0xa3b7[_0x1fc1f9];return _0x4987ca;};'use strict';var multer=require(_0x7a3b('0x0'));var util=require('util');var path=require(_0x7a3b('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a3b('0x2'));var router=express[_0x7a3b('0x3')]();var fs_extra=require(_0x7a3b('0x4'));var auth=require(_0x7a3b('0x5'));var interaction=require(_0x7a3b('0x6'));var config=require(_0x7a3b('0x7'));var controller=require(_0x7a3b('0x8'));router['get']('/',auth[_0x7a3b('0x9')](),controller[_0x7a3b('0xa')]);router[_0x7a3b('0xb')](_0x7a3b('0xc'),auth[_0x7a3b('0x9')](),controller[_0x7a3b('0xd')]);router[_0x7a3b('0xb')]('/:id',auth[_0x7a3b('0x9')](),controller[_0x7a3b('0xe')]);router[_0x7a3b('0xf')]('/',auth[_0x7a3b('0x9')](),interaction[_0x7a3b('0x10')](_0x7a3b('0x11'),'smsmessage:create'),controller[_0x7a3b('0x12')]);router[_0x7a3b('0xf')](_0x7a3b('0x13'),controller['status']);router[_0x7a3b('0x14')](_0x7a3b('0x15'),auth['isAuthenticated'](),controller[_0x7a3b('0x16')]);router[_0x7a3b('0x14')](_0x7a3b('0x17'),auth['isAuthenticated'](),controller[_0x7a3b('0x18')]);router[_0x7a3b('0x14')](_0x7a3b('0x19'),auth['isAuthenticated'](),controller[_0x7a3b('0x1a')]);router[_0x7a3b('0x1b')]('/:id',auth[_0x7a3b('0x9')](),controller[_0x7a3b('0x1c')]);module[_0x7a3b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f8619c8..f122495 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 _0x1340=['BOOLEAN','out','STRING','DATE','exports','TEXT','medium'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0x1340,0x74));var _0x0134=function(_0x7c9c3f,_0x251793){_0x7c9c3f=_0x7c9c3f-0x0;var _0x4d14f8=_0x1340[_0x7c9c3f];return _0x4d14f8;};'use strict';var Sequelize=require('sequelize');module[_0x0134('0x0')]={'body':{'type':Sequelize[_0x0134('0x1')](_0x0134('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0134('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0134('0x4')),'defaultValue':_0x0134('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0134('0x5')](0xbe)},'phone':{'type':Sequelize[_0x0134('0x5')]},'readAt':{'type':Sequelize[_0x0134('0x6')]},'secret':{'type':Sequelize[_0x0134('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0134('0x5')]},'providerResponse':{'type':Sequelize[_0x0134('0x1')]}}; \ No newline at end of file +var _0x63b6=['DATE','sequelize','exports','TEXT','BOOLEAN','out','STRING'];(function(_0x54deeb,_0x5eef4b){var _0x253a7e=function(_0xf07c51){while(--_0xf07c51){_0x54deeb['push'](_0x54deeb['shift']());}};_0x253a7e(++_0x5eef4b);}(_0x63b6,0x127));var _0x663b=function(_0x5c23ab,_0x49c1b3){_0x5c23ab=_0x5c23ab-0x0;var _0x2bbd93=_0x63b6[_0x5c23ab];return _0x2bbd93;};'use strict';var Sequelize=require(_0x663b('0x0'));module[_0x663b('0x1')]={'body':{'type':Sequelize[_0x663b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x663b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x663b('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x663b('0x5')](0xbe)},'phone':{'type':Sequelize[_0x663b('0x5')]},'readAt':{'type':Sequelize[_0x663b('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x663b('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 92288db..c49aaff 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 _0x3274=['interface','rejectmessage','SmsAccount','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','plivio','infobip','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','find','describe','sms-interactions','accept','sms','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','RejectMessage','rejectMessage','ContactId','QueryTypes'];(function(_0x2ec6f5,_0x53bee4){var _0x9cab6e=function(_0x4a29ff){while(--_0x4a29ff){_0x2ec6f5['push'](_0x2ec6f5['shift']());}};_0x9cab6e(++_0x53bee4);}(_0x3274,0x134));var _0x4327=function(_0x560a20,_0x526cdb){_0x560a20=_0x560a20-0x0;var _0x37a0f4=_0x3274[_0x560a20];return _0x37a0f4;};'use strict';var emlformat=require(_0x4327('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4327('0x1'));var jsonpatch=require(_0x4327('0x2'));var rp=require('request-promise');var moment=require(_0x4327('0x3'));var BPromise=require(_0x4327('0x4'));var Mustache=require(_0x4327('0x5'));var util=require(_0x4327('0x6'));var path=require(_0x4327('0x7'));var sox=require(_0x4327('0x8'));var csv=require('to-csv');var ejs=require(_0x4327('0x9'));var fs=require('fs');var fs_extra=require(_0x4327('0xa'));var _=require('lodash');var squel=require(_0x4327('0xb'));var crypto=require(_0x4327('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4327('0xd'));var toCsv=require(_0x4327('0xe'));var querystring=require('querystring');var Papa=require(_0x4327('0xf'));var Redis=require('ioredis');var authService=require(_0x4327('0x10'));var qs=require(_0x4327('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4327('0x12'));var logger=require('../../config/logger')(_0x4327('0x13'));var utils=require(_0x4327('0x14'));var config=require(_0x4327('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4327('0x16'))['db'];config[_0x4327('0x17')]=_[_0x4327('0x18')](config['redis'],{'host':_0x4327('0x19'),'port':0x18eb});var socket=require(_0x4327('0x1a'))(new Redis(config[_0x4327('0x17')]));require('./smsMessage.socket')[_0x4327('0x1b')](socket);var jayson=require(_0x4327('0x1c'));var client=jayson[_0x4327('0x1d')][_0x4327('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x4327('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x15264b,_0x34ddfe,_0x46eba9,_0x382368){return new BPromise(function(_0xe86ae3,_0xb668bf){var _0x3a1eb4=_0x382368||client;return _0x3a1eb4['request'](_0x15264b,_0x46eba9)[_0x4327('0x1f')](function(_0x1d5042){logger[_0x4327('0x20')]('SmsMessage,\x20%s,\x20%s',_0x34ddfe,_0x4327('0x21'));logger[_0x4327('0x22')](_0x4327('0x23'),_0x34ddfe,'request\x20sent',JSON[_0x4327('0x24')](_0x1d5042));if(_0x1d5042['error']){if(_0x1d5042[_0x4327('0x25')][_0x4327('0x26')]===0x1f4){logger[_0x4327('0x25')]('SmsMessage,\x20%s,\x20%s',_0x34ddfe,_0x1d5042[_0x4327('0x25')]['message']);return _0xb668bf(_0x1d5042[_0x4327('0x25')][_0x4327('0x27')]);}logger[_0x4327('0x25')](_0x4327('0x28'),_0x34ddfe,_0x1d5042[_0x4327('0x25')][_0x4327('0x27')]);return _0xe86ae3(_0x1d5042['error']['message']);}else{logger[_0x4327('0x20')](_0x4327('0x28'),_0x34ddfe,_0x4327('0x21'));_0xe86ae3(_0x1d5042['result']['message']);}})[_0x4327('0x29')](function(_0x4a32a8){logger['error']('SmsMessage,\x20%s,\x20%s',_0x34ddfe,_0x4a32a8);_0xb668bf(_0x4a32a8);});});}function respondWithStatusCode(_0x597c4e,_0x1fd4a2){_0x1fd4a2=_0x1fd4a2||0xcc;return function(_0x2fbc77){if(_0x2fbc77){return _0x597c4e[_0x4327('0x2a')](_0x1fd4a2);}return _0x597c4e[_0x4327('0x2b')](_0x1fd4a2)[_0x4327('0x2c')]();};}function respondWithResult(_0x10a404,_0x26e1a3){_0x26e1a3=_0x26e1a3||0xc8;return function(_0x502905){if(_0x502905){return _0x10a404['status'](_0x26e1a3)[_0x4327('0x2d')](_0x502905);}};}function respondWithFilteredResult(_0x5258d3,_0x566dcd){return function(_0x5462e6){if(_0x5462e6){var _0x5b255a=typeof _0x566dcd[_0x4327('0x2e')]==='undefined'&&typeof _0x566dcd[_0x4327('0x2f')]===_0x4327('0x30');var _0x1488dd=_0x5462e6['count'];var _0x21649a=_0x5b255a?0x0:_0x566dcd[_0x4327('0x2e')];var _0x19f65a=_0x5b255a?_0x5462e6[_0x4327('0x31')]:_0x566dcd[_0x4327('0x2e')]+_0x566dcd[_0x4327('0x2f')];var _0x1a84b5;if(_0x19f65a>=_0x1488dd){_0x19f65a=_0x1488dd;_0x1a84b5=0xc8;}else{_0x1a84b5=0xce;}_0x5258d3[_0x4327('0x2b')](_0x1a84b5);return _0x5258d3[_0x4327('0x32')](_0x4327('0x33'),_0x21649a+'-'+_0x19f65a+'/'+_0x1488dd)['json'](_0x5462e6);}return null;};}function patchUpdates(_0x528f8e){return function(_0x50cda1){try{jsonpatch[_0x4327('0x34')](_0x50cda1,_0x528f8e,!![]);}catch(_0x4fd491){return BPromise[_0x4327('0x35')](_0x4fd491);}return _0x50cda1[_0x4327('0x36')]();};}function saveUpdates(_0x2dea46,_0x497e76){return function(_0x59e7ff){if(_0x59e7ff){return _0x59e7ff[_0x4327('0x37')](_0x2dea46)[_0x4327('0x1f')](function(_0x2fecce){return _0x2fecce;});}return null;};}function removeEntity(_0x46ca5c,_0x354f55){return function(_0x49ae67){if(_0x49ae67){return _0x49ae67[_0x4327('0x38')]()[_0x4327('0x1f')](function(){_0x46ca5c[_0x4327('0x2b')](0xcc)[_0x4327('0x2c')]();});}};}function handleEntityNotFound(_0xcaef42,_0x24d555){return function(_0x5ebbd8){if(!_0x5ebbd8){_0xcaef42[_0x4327('0x2a')](0x194);}return _0x5ebbd8;};}function handleError(_0x2a7945,_0x48e959){_0x48e959=_0x48e959||0x1f4;return function(_0x25b7a2){logger['error'](_0x25b7a2[_0x4327('0x39')]);if(_0x25b7a2[_0x4327('0x3a')]){delete _0x25b7a2[_0x4327('0x3a')];}_0x2a7945[_0x4327('0x2b')](_0x48e959)[_0x4327('0x3b')](_0x25b7a2);};}exports[_0x4327('0x3c')]=function(_0x5d720f,_0x414b9f){var _0x22f142={},_0x379ffd={},_0x2c5477={'count':0x0,'rows':[]};var _0x13579b=_[_0x4327('0x3d')](db[_0x4327('0x3e')][_0x4327('0x3f')],function(_0x26e06c){return{'name':_0x26e06c[_0x4327('0x40')],'type':_0x26e06c[_0x4327('0x41')][_0x4327('0x42')]};});_0x379ffd['model']=_[_0x4327('0x3d')](_0x13579b,_0x4327('0x3a'));_0x379ffd[_0x4327('0x43')]=_[_0x4327('0x44')](_0x5d720f[_0x4327('0x43')]);_0x379ffd[_0x4327('0x45')]=_[_0x4327('0x46')](_0x379ffd[_0x4327('0x47')],_0x379ffd[_0x4327('0x43')]);_0x22f142[_0x4327('0x48')]=_[_0x4327('0x46')](_0x379ffd[_0x4327('0x47')],qs[_0x4327('0x49')](_0x5d720f[_0x4327('0x43')]['fields']));_0x22f142['attributes']=_0x22f142[_0x4327('0x48')][_0x4327('0x4a')]?_0x22f142['attributes']:_0x379ffd[_0x4327('0x47')];if(!_0x5d720f[_0x4327('0x43')]['hasOwnProperty'](_0x4327('0x4b'))){_0x22f142['limit']=qs['limit'](_0x5d720f[_0x4327('0x43')][_0x4327('0x2f')]);_0x22f142['offset']=qs[_0x4327('0x2e')](_0x5d720f[_0x4327('0x43')][_0x4327('0x2e')]);}_0x22f142[_0x4327('0x4c')]=qs['sort'](_0x5d720f[_0x4327('0x43')][_0x4327('0x4d')]);_0x22f142[_0x4327('0x4e')]=qs[_0x4327('0x45')](_[_0x4327('0x4f')](_0x5d720f[_0x4327('0x43')],_0x379ffd[_0x4327('0x45')]),_0x13579b);if(_0x5d720f[_0x4327('0x43')][_0x4327('0x50')]){_0x22f142[_0x4327('0x4e')]=_[_0x4327('0x51')](_0x22f142[_0x4327('0x4e')],{'$or':_[_0x4327('0x3d')](_0x13579b,function(_0x2d3659){if(_0x2d3659[_0x4327('0x41')]!==_0x4327('0x52')){var _0x591a34={};_0x591a34[_0x2d3659[_0x4327('0x3a')]]={'$like':'%'+_0x5d720f['query'][_0x4327('0x50')]+'%'};return _0x591a34;}})});}_0x22f142=_[_0x4327('0x51')]({},_0x22f142,_0x5d720f[_0x4327('0x53')]);var _0x263a13={'where':_0x22f142[_0x4327('0x4e')]};return db[_0x4327('0x3e')][_0x4327('0x31')](_0x263a13)[_0x4327('0x1f')](function(_0x5aeacf){_0x2c5477[_0x4327('0x31')]=_0x5aeacf;if(_0x5d720f[_0x4327('0x43')][_0x4327('0x54')]){_0x22f142[_0x4327('0x55')]=[{'all':!![]}];}return db[_0x4327('0x3e')][_0x4327('0x56')](_0x22f142);})[_0x4327('0x1f')](function(_0x3c28a6){_0x2c5477[_0x4327('0x57')]=_0x3c28a6;return _0x2c5477;})[_0x4327('0x1f')](respondWithFilteredResult(_0x414b9f,_0x22f142))[_0x4327('0x29')](handleError(_0x414b9f,null));};exports[_0x4327('0x58')]=function(_0x2d9a36,_0x123c8c){var _0x388d42={'raw':!![],'where':{'id':_0x2d9a36[_0x4327('0x59')]['id']}},_0x4a2787={};_0x4a2787[_0x4327('0x47')]=_[_0x4327('0x44')](db[_0x4327('0x3e')][_0x4327('0x3f')]);_0x4a2787[_0x4327('0x43')]=_[_0x4327('0x44')](_0x2d9a36['query']);_0x4a2787[_0x4327('0x45')]=_[_0x4327('0x46')](_0x4a2787[_0x4327('0x47')],_0x4a2787[_0x4327('0x43')]);_0x388d42[_0x4327('0x48')]=_[_0x4327('0x46')](_0x4a2787[_0x4327('0x47')],qs['fields'](_0x2d9a36['query'][_0x4327('0x49')]));_0x388d42[_0x4327('0x48')]=_0x388d42[_0x4327('0x48')]['length']?_0x388d42['attributes']:_0x4a2787[_0x4327('0x47')];if(_0x2d9a36[_0x4327('0x43')][_0x4327('0x54')]){_0x388d42['include']=[{'all':!![]}];}_0x388d42=_[_0x4327('0x51')]({},_0x388d42,_0x2d9a36[_0x4327('0x53')]);return db['SmsMessage']['find'](_0x388d42)[_0x4327('0x1f')](handleEntityNotFound(_0x123c8c,null))[_0x4327('0x1f')](respondWithResult(_0x123c8c,null))[_0x4327('0x29')](handleError(_0x123c8c,null));};exports[_0x4327('0x5a')]=function(_0x1907ab,_0x363695){return db[_0x4327('0x3e')]['create'](_0x1907ab['body'],{})['then'](respondWithResult(_0x363695,0xc9))['catch'](handleError(_0x363695,null));};exports[_0x4327('0x37')]=function(_0x52287f,_0x5567dd){if(_0x52287f['body']['id']){delete _0x52287f['body']['id'];}return db[_0x4327('0x3e')][_0x4327('0x5b')]({'where':{'id':_0x52287f[_0x4327('0x59')]['id']}})[_0x4327('0x1f')](handleEntityNotFound(_0x5567dd,null))['then'](saveUpdates(_0x52287f['body'],null))[_0x4327('0x1f')](respondWithResult(_0x5567dd,null))[_0x4327('0x29')](handleError(_0x5567dd,null));};exports[_0x4327('0x38')]=function(_0x67ce6,_0x1e6dd5){return db[_0x4327('0x3e')][_0x4327('0x5b')]({'where':{'id':_0x67ce6[_0x4327('0x59')]['id']}})[_0x4327('0x1f')](handleEntityNotFound(_0x1e6dd5,null))[_0x4327('0x1f')](removeEntity(_0x1e6dd5,null))[_0x4327('0x29')](handleError(_0x1e6dd5,null));};exports[_0x4327('0x5c')]=function(_0x15d938,_0x4a63b6){return db[_0x4327('0x3e')][_0x4327('0x5c')]()[_0x4327('0x1f')](respondWithResult(_0x4a63b6,null))[_0x4327('0x29')](handleError(_0x4a63b6,null));};var interaction_log=require('../../config/logger')(_0x4327('0x5d'));exports[_0x4327('0x5e')]=function(_0x14db54,_0xb44c05,_0x37a9d0){var _0x3339f0={'agent':{},'channel':_0x4327('0x5f')};if(_0x14db54[_0x4327('0x60')]['id']){delete _0x14db54[_0x4327('0x60')]['id'];}_0x14db54[_0x4327('0x60')][_0x4327('0x61')]=!![];_0x14db54[_0x4327('0x60')][_0x4327('0x62')]=moment()[_0x4327('0x63')](_0x4327('0x64'));_0x14db54[_0x4327('0x60')]['UserId']=_0x14db54[_0x4327('0x60')]['UserId']||_0x14db54[_0x4327('0x65')]['id'];_0x3339f0[_0x4327('0x66')]['id']=_0x14db54[_0x4327('0x60')][_0x4327('0x67')];return db['SmsMessage'][_0x4327('0x5b')]({'where':{'id':_0x14db54[_0x4327('0x59')]['id'],'UserId':null}})[_0x4327('0x1f')](handleEntityNotFound(_0xb44c05,null))[_0x4327('0x1f')](saveUpdates(_0x14db54[_0x4327('0x60')],null))[_0x4327('0x1f')](function(_0x4cd51f){if(_0x4cd51f){_0x3339f0[_0x4327('0x27')]=_0x4cd51f[_0x4327('0x68')]({'plain':!![]});return db[_0x4327('0x69')][_0x4327('0x5b')]({'where':{'id':_0x4cd51f[_0x4327('0x6a')]}});}return null;})[_0x4327('0x1f')](handleEntityNotFound(_0xb44c05,null))[_0x4327('0x1f')](function(_0x5c309d){if(_0x5c309d){return _0x5c309d['update']({'UserId':_0x14db54[_0x4327('0x60')]['UserId'],'read1stAt':_[_0x4327('0x6b')](_0x5c309d[_0x4327('0x6c')])?moment()[_0x4327('0x63')](_0x4327('0x64')):undefined});}return null;})[_0x4327('0x1f')](function(_0x496366){if(_0x496366){_0x3339f0[_0x4327('0x6d')]=_0x496366[_0x4327('0x68')]({'plain':!![]});interaction_log[_0x4327('0x20')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x14db54['user']['id'],_0x14db54[_0x4327('0x65')][_0x4327('0x3a')],_0x14db54['user'][_0x4327('0x6e')],_0x3339f0[_0x4327('0x6d')]['id'],_0x14db54[_0x4327('0x60')]?JSON[_0x4327('0x24')](_0x14db54[_0x4327('0x60')]):_0x4327('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x4327('0x70'),_0x3339f0);}return null;})[_0x4327('0x1f')](function(_0x48d126){var _0x3323bc=_0x4327('0x71')+_0x48d126[_0x4327('0x27')]['ContactId'];return db[_0x4327('0x72')][_0x4327('0x43')](_0x3323bc,{'type':db[_0x4327('0x73')]['QueryTypes'][_0x4327('0x74')],'raw':!![]})[_0x4327('0x1f')](function(_0x5e1ce0){return _0x5e1ce0;});})[_0x4327('0x1f')](function(_0x35665a){if(_0x35665a){_0x3339f0[_0x4327('0x27')][_0x4327('0x75')]=_0x35665a[0x0];if(!_0x14db54[_0x4327('0x60')][_0x4327('0x67')])return;return db[_0x4327('0x76')][_0x4327('0x5b')]({'where':{'id':_0x14db54[_0x4327('0x60')][_0x4327('0x67')],'role':_0x4327('0x66')},'attributes':['id',_0x4327('0x3a'),_0x4327('0x77'),_0x4327('0x78'),_0x4327('0x79')],'raw':!![]});}return null;})[_0x4327('0x1f')](function(_0x7f82a5){if(!_0x7f82a5)return null;_0x3339f0[_0x4327('0x27')][_0x4327('0x66')]=_0x7f82a5;return _0x3339f0;})[_0x4327('0x1f')](function(_0x304397){if(_0x304397){if(_0x14db54[_0x4327('0x60')][_0x4327('0x7a')]){_0x3339f0[_0x4327('0x27')]['interface']=util['format'](_0x4327('0x7b'),_0x14db54[_0x4327('0x65')][_0x4327('0x3a')]);_0x3339f0[_0x4327('0x27')][_0x4327('0x7c')]=_0x3339f0['channel'];_0x3339f0[_0x4327('0x27')]['motionChannel']=_0x3339f0[_0x4327('0x7c')];_0x3339f0[_0x4327('0x27')][_0x4327('0x7d')]='accept';return respondWithRpcPromise('EventManager',_0x4327('0x7e'),{'event':_0x4327('0x7f'),'message':_0x3339f0['message']},client9002)['then'](function(){return _0x3339f0;});}return _0x3339f0;}return null;})['then'](respondWithResult(_0xb44c05,null))[_0x4327('0x29')](handleError(_0xb44c05,null));};var interaction_log=require(_0x4327('0x80'))(_0x4327('0x5d'));exports[_0x4327('0x35')]=function(_0x5a9b4b,_0x2e13a1,_0x45dc4d){var _0x37fb3b={'agent':{},'channel':'sms'};if(_0x5a9b4b[_0x4327('0x60')]['id']){delete _0x5a9b4b['body']['id'];}_0x5a9b4b['body'][_0x4327('0x67')]=_0x5a9b4b[_0x4327('0x60')][_0x4327('0x67')]||_0x5a9b4b[_0x4327('0x65')]['id'];_0x37fb3b[_0x4327('0x66')]['id']=_0x5a9b4b['body'][_0x4327('0x67')];return db[_0x4327('0x3e')][_0x4327('0x5b')]({'where':{'id':_0x5a9b4b[_0x4327('0x59')]['id'],'UserId':null}})[_0x4327('0x1f')](handleEntityNotFound(_0x2e13a1,null))[_0x4327('0x1f')](function(_0x335c1b){if(_0x335c1b){_0x37fb3b[_0x4327('0x27')]=_0x335c1b['get']({'plain':!![]});return db[_0x4327('0x69')][_0x4327('0x5b')]({'where':{'id':_0x335c1b[_0x4327('0x6a')]}});}return null;})[_0x4327('0x1f')](handleEntityNotFound(_0x2e13a1,null))[_0x4327('0x1f')](function(_0x4f4a3a){if(_0x4f4a3a){_0x37fb3b[_0x4327('0x6d')]=_0x4f4a3a['get']({'plain':!![]});interaction_log[_0x4327('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5a9b4b[_0x4327('0x65')]['id'],_0x5a9b4b['user'][_0x4327('0x3a')],_0x5a9b4b[_0x4327('0x65')][_0x4327('0x6e')],_0x37fb3b[_0x4327('0x6d')]['id'],_0x5a9b4b[_0x4327('0x60')]?JSON[_0x4327('0x24')](_0x5a9b4b[_0x4327('0x60')]):_0x4327('0x6f'));return respondWithRpcPromise(_0x4327('0x81'),_0x4327('0x82'),_0x37fb3b);}return null;})[_0x4327('0x1f')](function(_0x12c611){var _0x28ee6b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x12c611['message'][_0x4327('0x83')];return db[_0x4327('0x72')][_0x4327('0x43')](_0x28ee6b,{'type':db['Sequelize'][_0x4327('0x84')][_0x4327('0x74')],'raw':!![]})[_0x4327('0x1f')](function(_0x4905b1){return _0x4905b1;});})['then'](function(_0x7038d8){if(_0x7038d8){_0x37fb3b[_0x4327('0x27')][_0x4327('0x75')]=_0x7038d8[0x0];if(!_0x5a9b4b[_0x4327('0x60')][_0x4327('0x67')])return;return db[_0x4327('0x76')][_0x4327('0x5b')]({'where':{'id':_0x5a9b4b[_0x4327('0x60')]['UserId'],'role':_0x4327('0x66')},'attributes':['id',_0x4327('0x3a'),_0x4327('0x77'),_0x4327('0x78'),_0x4327('0x79')],'raw':!![]});}return null;})['then'](function(_0x5e808f){if(!_0x5e808f)return null;_0x37fb3b[_0x4327('0x27')][_0x4327('0x66')]=_0x5e808f;return _0x37fb3b;})[_0x4327('0x1f')](function(_0x42912c){if(_0x42912c){_0x42912c[_0x4327('0x27')][_0x4327('0x85')]=util[_0x4327('0x63')](_0x4327('0x7b'),_0x5a9b4b[_0x4327('0x65')][_0x4327('0x3a')]);_0x42912c['message']['channel']=_0x37fb3b['channel'];_0x42912c[_0x4327('0x27')]['motionChannel']=_0x37fb3b['channel'];_0x42912c[_0x4327('0x27')][_0x4327('0x7d')]='reject';respondWithRpcPromise(_0x4327('0x7e'),_0x4327('0x7e'),{'event':_0x4327('0x86'),'message':_0x42912c[_0x4327('0x27')]},client9002);return _0x37fb3b;}return null;})[_0x4327('0x1f')](respondWithResult(_0x2e13a1,null))['catch'](handleError(_0x2e13a1,null));};exports[_0x4327('0x2b')]=function(_0x4e990a,_0x4a3f34,_0x54ef6d){if(_0x4e990a[_0x4327('0x60')]['id']){delete _0x4e990a[_0x4327('0x60')]['id'];}var _0x2bc0a8;return db[_0x4327('0x3e')][_0x4327('0x5b')]({'where':{'id':_0x4e990a[_0x4327('0x59')]['id']}})[_0x4327('0x1f')](handleEntityNotFound(_0x4a3f34,null))[_0x4327('0x1f')](function(_0x1e5535){if(_0x1e5535){_0x2bc0a8=_0x1e5535;return db[_0x4327('0x87')][_0x4327('0x5b')]({'where':{'id':_0x1e5535['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x4a3f34,null))[_0x4327('0x1f')](function(_0x119895){if(_0x119895){logger['debug'](_0x4327('0x23'),_0x4327('0x2b'),'received\x20delivery\x20report\x20from',_0x119895[_0x4327('0x41')],util[_0x4327('0x88')](_0x4e990a[_0x4327('0x60')],{'showHidden':![],'depth':null}));switch(_0x119895[_0x4327('0x41')]){case _0x4327('0x89'):if(_0x4e990a[_0x4327('0x60')]['MessageSid']&&_0x4e990a['body'][_0x4327('0x8a')]===_0x2bc0a8[_0x4327('0x8b')]){return _0x2bc0a8[_0x4327('0x37')]({'read':!![]});}else{logger[_0x4327('0x25')](_0x4327('0x8c'),_0x4327('0x2b'),_0x4327('0x89'),util[_0x4327('0x88')](_0x4e990a[_0x4327('0x60')],{'showHidden':![],'depth':null}));}break;case _0x4327('0x8d'):if(_0x4e990a[_0x4327('0x60')]['MessageUUID']&&_0x4e990a['body'][_0x4327('0x8e')]===_0x2bc0a8[_0x4327('0x8b')]&&_[_0x4327('0x8f')]([_0x4327('0x90'),'delivered'],_0x4e990a[_0x4327('0x60')]['Status'])>=0x0){return _0x2bc0a8[_0x4327('0x37')]({'read':!![]});}else{logger[_0x4327('0x25')](_0x4327('0x8c'),_0x4327('0x2b'),_0x4327('0x91'),util[_0x4327('0x88')](_0x4e990a[_0x4327('0x60')],{'showHidden':![],'depth':null}));}break;case _0x4327('0x92'):var _0x1d07e4=_0x4e990a[_0x4327('0x60')]['results'][0x0];if(_0x1d07e4['status']['groupName']==='DELIVERED'){return _0x2bc0a8[_0x4327('0x37')]({'read':!![]});}else{logger['error'](_0x4327('0x8c'),_0x4327('0x2b'),'infobip',util['inspect'](_0x4e990a[_0x4327('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x2bc0a8;}})[_0x4327('0x1f')](respondWithResult(_0x4a3f34,null))[_0x4327('0x29')](handleError(_0x4a3f34,null));}; \ No newline at end of file +var _0xa93a=['format','interaction','get','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','fullname','email','SIP/%s','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','groupName','DELIVERED','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket','register','client','http','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','save','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','VIRTUAL','merge','options','where','SmsMessage','includeAll','include','findAll','show','params','model','intersection','find','create','body','update','describe','sms-interactions','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId'];(function(_0xd0ea7e,_0xa67ae6){var _0x52cad3=function(_0x4f8b5a){while(--_0x4f8b5a){_0xd0ea7e['push'](_0xd0ea7e['shift']());}};_0x52cad3(++_0xa67ae6);}(_0xa93a,0xb8));var _0xaa93=function(_0x3ca3aa,_0x1bc114){_0x3ca3aa=_0x3ca3aa-0x0;var _0x17cf3c=_0xa93a[_0x3ca3aa];return _0x17cf3c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa93('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaa93('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xaa93('0x2'));var util=require('util');var path=require(_0xaa93('0x3'));var sox=require(_0xaa93('0x4'));var csv=require(_0xaa93('0x5'));var ejs=require(_0xaa93('0x6'));var fs=require('fs');var fs_extra=require(_0xaa93('0x7'));var _=require('lodash');var squel=require(_0xaa93('0x8'));var crypto=require(_0xaa93('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xaa93('0xa'));var toCsv=require('to-csv');var querystring=require(_0xaa93('0xb'));var Papa=require(_0xaa93('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa93('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa93('0xe'))(_0xaa93('0xf'));var utils=require(_0xaa93('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa93('0x11'))['db'];config['redis']=_[_0xaa93('0x12')](config['redis'],{'host':_0xaa93('0x13'),'port':0x18eb});var socket=require(_0xaa93('0x14'))(new Redis(config[_0xaa93('0x15')]));require(_0xaa93('0x16'))[_0xaa93('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xaa93('0x18')]['http']({'port':0x232c});var client9002=jayson[_0xaa93('0x18')][_0xaa93('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x59d73c,_0x543a57,_0x1394d5,_0x665c32){return new BPromise(function(_0x1cc0bc,_0x33cab3){var _0x1f6d57=_0x665c32||client;return _0x1f6d57[_0xaa93('0x1a')](_0x59d73c,_0x1394d5)[_0xaa93('0x1b')](function(_0x28b89d){logger[_0xaa93('0x1c')]('SmsMessage,\x20%s,\x20%s',_0x543a57,_0xaa93('0x1d'));logger[_0xaa93('0x1e')](_0xaa93('0x1f'),_0x543a57,'request\x20sent',JSON[_0xaa93('0x20')](_0x28b89d));if(_0x28b89d[_0xaa93('0x21')]){if(_0x28b89d['error'][_0xaa93('0x22')]===0x1f4){logger['error'](_0xaa93('0x23'),_0x543a57,_0x28b89d['error'][_0xaa93('0x24')]);return _0x33cab3(_0x28b89d[_0xaa93('0x21')]['message']);}logger[_0xaa93('0x21')]('SmsMessage,\x20%s,\x20%s',_0x543a57,_0x28b89d[_0xaa93('0x21')][_0xaa93('0x24')]);return _0x1cc0bc(_0x28b89d['error']['message']);}else{logger[_0xaa93('0x1c')](_0xaa93('0x23'),_0x543a57,_0xaa93('0x1d'));_0x1cc0bc(_0x28b89d['result']['message']);}})[_0xaa93('0x25')](function(_0x51a0de){logger[_0xaa93('0x21')](_0xaa93('0x23'),_0x543a57,_0x51a0de);_0x33cab3(_0x51a0de);});});}function respondWithStatusCode(_0x1941b8,_0x584059){_0x584059=_0x584059||0xcc;return function(_0x2c2e8f){if(_0x2c2e8f){return _0x1941b8[_0xaa93('0x26')](_0x584059);}return _0x1941b8[_0xaa93('0x27')](_0x584059)[_0xaa93('0x28')]();};}function respondWithResult(_0x5333ad,_0x3e225f){_0x3e225f=_0x3e225f||0xc8;return function(_0x592f06){if(_0x592f06){return _0x5333ad['status'](_0x3e225f)['json'](_0x592f06);}};}function respondWithFilteredResult(_0x535a92,_0x3b7b4c){return function(_0x76cd82){if(_0x76cd82){var _0x46c3ae=typeof _0x3b7b4c[_0xaa93('0x29')]==='undefined'&&typeof _0x3b7b4c[_0xaa93('0x2a')]===_0xaa93('0x2b');var _0x3afae7=_0x76cd82[_0xaa93('0x2c')];var _0x1317e8=_0x46c3ae?0x0:_0x3b7b4c[_0xaa93('0x29')];var _0x455227=_0x46c3ae?_0x76cd82[_0xaa93('0x2c')]:_0x3b7b4c[_0xaa93('0x29')]+_0x3b7b4c[_0xaa93('0x2a')];var _0x5618af;if(_0x455227>=_0x3afae7){_0x455227=_0x3afae7;_0x5618af=0xc8;}else{_0x5618af=0xce;}_0x535a92['status'](_0x5618af);return _0x535a92['set'](_0xaa93('0x2d'),_0x1317e8+'-'+_0x455227+'/'+_0x3afae7)[_0xaa93('0x2e')](_0x76cd82);}return null;};}function patchUpdates(_0x47265e){return function(_0x4a1108){try{jsonpatch['apply'](_0x4a1108,_0x47265e,!![]);}catch(_0x469a0c){return BPromise['reject'](_0x469a0c);}return _0x4a1108[_0xaa93('0x2f')]();};}function saveUpdates(_0x42c42a,_0x1e9be3){return function(_0x1451df){if(_0x1451df){return _0x1451df['update'](_0x42c42a)[_0xaa93('0x1b')](function(_0x46f46d){return _0x46f46d;});}return null;};}function removeEntity(_0x1b6e9e,_0x390767){return function(_0x31de11){if(_0x31de11){return _0x31de11['destroy']()[_0xaa93('0x1b')](function(){_0x1b6e9e['status'](0xcc)[_0xaa93('0x28')]();});}};}function handleEntityNotFound(_0x465db0,_0xf6f427){return function(_0x1fb0e7){if(!_0x1fb0e7){_0x465db0[_0xaa93('0x26')](0x194);}return _0x1fb0e7;};}function handleError(_0x2313cb,_0x582829){_0x582829=_0x582829||0x1f4;return function(_0x548c0d){logger['error'](_0x548c0d[_0xaa93('0x30')]);if(_0x548c0d['name']){delete _0x548c0d[_0xaa93('0x31')];}_0x2313cb[_0xaa93('0x27')](_0x582829)['send'](_0x548c0d);};}exports[_0xaa93('0x32')]=function(_0x44fc71,_0x3c972e){var _0x355fc0={},_0x3b2c81={},_0x172c74={'count':0x0,'rows':[]};var _0x2b67c7=_[_0xaa93('0x33')](db['SmsMessage'][_0xaa93('0x34')],function(_0x2fede7){return{'name':_0x2fede7[_0xaa93('0x35')],'type':_0x2fede7[_0xaa93('0x36')]['key']};});_0x3b2c81['model']=_['map'](_0x2b67c7,'name');_0x3b2c81[_0xaa93('0x37')]=_[_0xaa93('0x38')](_0x44fc71[_0xaa93('0x37')]);_0x3b2c81[_0xaa93('0x39')]=_['intersection'](_0x3b2c81['model'],_0x3b2c81[_0xaa93('0x37')]);_0x355fc0[_0xaa93('0x3a')]=_['intersection'](_0x3b2c81['model'],qs[_0xaa93('0x3b')](_0x44fc71[_0xaa93('0x37')]['fields']));_0x355fc0[_0xaa93('0x3a')]=_0x355fc0['attributes'][_0xaa93('0x3c')]?_0x355fc0['attributes']:_0x3b2c81['model'];if(!_0x44fc71[_0xaa93('0x37')][_0xaa93('0x3d')]('nolimit')){_0x355fc0[_0xaa93('0x2a')]=qs[_0xaa93('0x2a')](_0x44fc71[_0xaa93('0x37')][_0xaa93('0x2a')]);_0x355fc0[_0xaa93('0x29')]=qs[_0xaa93('0x29')](_0x44fc71[_0xaa93('0x37')][_0xaa93('0x29')]);}_0x355fc0[_0xaa93('0x3e')]=qs['sort'](_0x44fc71[_0xaa93('0x37')][_0xaa93('0x3f')]);_0x355fc0['where']=qs['filters'](_[_0xaa93('0x40')](_0x44fc71[_0xaa93('0x37')],_0x3b2c81[_0xaa93('0x39')]),_0x2b67c7);if(_0x44fc71[_0xaa93('0x37')][_0xaa93('0x41')]){_0x355fc0['where']=_['merge'](_0x355fc0['where'],{'$or':_[_0xaa93('0x33')](_0x2b67c7,function(_0x4dfe00){if(_0x4dfe00[_0xaa93('0x36')]!==_0xaa93('0x42')){var _0x3d991d={};_0x3d991d[_0x4dfe00[_0xaa93('0x31')]]={'$like':'%'+_0x44fc71[_0xaa93('0x37')][_0xaa93('0x41')]+'%'};return _0x3d991d;}})});}_0x355fc0=_[_0xaa93('0x43')]({},_0x355fc0,_0x44fc71[_0xaa93('0x44')]);var _0x4de61={'where':_0x355fc0[_0xaa93('0x45')]};return db[_0xaa93('0x46')]['count'](_0x4de61)[_0xaa93('0x1b')](function(_0x483041){_0x172c74[_0xaa93('0x2c')]=_0x483041;if(_0x44fc71[_0xaa93('0x37')][_0xaa93('0x47')]){_0x355fc0[_0xaa93('0x48')]=[{'all':!![]}];}return db[_0xaa93('0x46')][_0xaa93('0x49')](_0x355fc0);})[_0xaa93('0x1b')](function(_0x2c7cc4){_0x172c74['rows']=_0x2c7cc4;return _0x172c74;})[_0xaa93('0x1b')](respondWithFilteredResult(_0x3c972e,_0x355fc0))[_0xaa93('0x25')](handleError(_0x3c972e,null));};exports[_0xaa93('0x4a')]=function(_0x2b28ce,_0x1978a0){var _0x293f56={'raw':!![],'where':{'id':_0x2b28ce[_0xaa93('0x4b')]['id']}},_0x5d2b3c={};_0x5d2b3c[_0xaa93('0x4c')]=_[_0xaa93('0x38')](db[_0xaa93('0x46')]['rawAttributes']);_0x5d2b3c['query']=_[_0xaa93('0x38')](_0x2b28ce[_0xaa93('0x37')]);_0x5d2b3c[_0xaa93('0x39')]=_[_0xaa93('0x4d')](_0x5d2b3c[_0xaa93('0x4c')],_0x5d2b3c[_0xaa93('0x37')]);_0x293f56[_0xaa93('0x3a')]=_[_0xaa93('0x4d')](_0x5d2b3c[_0xaa93('0x4c')],qs[_0xaa93('0x3b')](_0x2b28ce[_0xaa93('0x37')][_0xaa93('0x3b')]));_0x293f56[_0xaa93('0x3a')]=_0x293f56[_0xaa93('0x3a')]['length']?_0x293f56[_0xaa93('0x3a')]:_0x5d2b3c[_0xaa93('0x4c')];if(_0x2b28ce['query'][_0xaa93('0x47')]){_0x293f56['include']=[{'all':!![]}];}_0x293f56=_['merge']({},_0x293f56,_0x2b28ce[_0xaa93('0x44')]);return db[_0xaa93('0x46')][_0xaa93('0x4e')](_0x293f56)[_0xaa93('0x1b')](handleEntityNotFound(_0x1978a0,null))[_0xaa93('0x1b')](respondWithResult(_0x1978a0,null))['catch'](handleError(_0x1978a0,null));};exports['create']=function(_0x1d4517,_0x36684a){return db[_0xaa93('0x46')][_0xaa93('0x4f')](_0x1d4517[_0xaa93('0x50')],{})['then'](respondWithResult(_0x36684a,0xc9))[_0xaa93('0x25')](handleError(_0x36684a,null));};exports[_0xaa93('0x51')]=function(_0x50e70e,_0x439ffe){if(_0x50e70e[_0xaa93('0x50')]['id']){delete _0x50e70e[_0xaa93('0x50')]['id'];}return db[_0xaa93('0x46')][_0xaa93('0x4e')]({'where':{'id':_0x50e70e[_0xaa93('0x4b')]['id']}})['then'](handleEntityNotFound(_0x439ffe,null))['then'](saveUpdates(_0x50e70e[_0xaa93('0x50')],null))[_0xaa93('0x1b')](respondWithResult(_0x439ffe,null))['catch'](handleError(_0x439ffe,null));};exports['destroy']=function(_0x2ab945,_0x5c66b9){return db[_0xaa93('0x46')][_0xaa93('0x4e')]({'where':{'id':_0x2ab945['params']['id']}})[_0xaa93('0x1b')](handleEntityNotFound(_0x5c66b9,null))[_0xaa93('0x1b')](removeEntity(_0x5c66b9,null))[_0xaa93('0x25')](handleError(_0x5c66b9,null));};exports[_0xaa93('0x52')]=function(_0x4ffe17,_0x3838b6){return db['SmsMessage'][_0xaa93('0x52')]()[_0xaa93('0x1b')](respondWithResult(_0x3838b6,null))['catch'](handleError(_0x3838b6,null));};var interaction_log=require('../../config/logger')(_0xaa93('0x53'));exports['accept']=function(_0x4a8c2d,_0x2da5b6,_0x13d591){var _0x2a63b5={'agent':{},'channel':_0xaa93('0x54')};if(_0x4a8c2d['body']['id']){delete _0x4a8c2d['body']['id'];}_0x4a8c2d['body'][_0xaa93('0x55')]=!![];_0x4a8c2d['body']['readAt']=moment()['format'](_0xaa93('0x56'));_0x4a8c2d['body']['UserId']=_0x4a8c2d[_0xaa93('0x50')][_0xaa93('0x57')]||_0x4a8c2d[_0xaa93('0x58')]['id'];_0x2a63b5[_0xaa93('0x59')]['id']=_0x4a8c2d[_0xaa93('0x50')][_0xaa93('0x57')];return db['SmsMessage'][_0xaa93('0x4e')]({'where':{'id':_0x4a8c2d[_0xaa93('0x4b')]['id'],'UserId':null}})[_0xaa93('0x1b')](handleEntityNotFound(_0x2da5b6,null))[_0xaa93('0x1b')](saveUpdates(_0x4a8c2d[_0xaa93('0x50')],null))[_0xaa93('0x1b')](function(_0x4ad4a2){if(_0x4ad4a2){_0x2a63b5[_0xaa93('0x24')]=_0x4ad4a2['get']({'plain':!![]});return db[_0xaa93('0x5a')][_0xaa93('0x4e')]({'where':{'id':_0x4ad4a2[_0xaa93('0x5b')]}});}return null;})[_0xaa93('0x1b')](handleEntityNotFound(_0x2da5b6,null))['then'](function(_0x37a342){if(_0x37a342){return _0x37a342['update']({'UserId':_0x4a8c2d[_0xaa93('0x50')][_0xaa93('0x57')],'read1stAt':_['isNil'](_0x37a342['read1stAt'])?moment()[_0xaa93('0x5c')](_0xaa93('0x56')):undefined});}return null;})['then'](function(_0x3c5958){if(_0x3c5958){_0x2a63b5[_0xaa93('0x5d')]=_0x3c5958[_0xaa93('0x5e')]({'plain':!![]});interaction_log[_0xaa93('0x1c')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a8c2d['user']['id'],_0x4a8c2d[_0xaa93('0x58')][_0xaa93('0x31')],_0x4a8c2d[_0xaa93('0x58')]['role'],_0x2a63b5['interaction']['id'],_0x4a8c2d['body']?JSON[_0xaa93('0x20')](_0x4a8c2d[_0xaa93('0x50')]):_0xaa93('0x5f'));return respondWithRpcPromise(_0xaa93('0x60'),_0xaa93('0x61'),_0x2a63b5);}return null;})[_0xaa93('0x1b')](function(_0x433748){var _0x3790b2=_0xaa93('0x62')+_0x433748[_0xaa93('0x24')][_0xaa93('0x63')];return db[_0xaa93('0x64')][_0xaa93('0x37')](_0x3790b2,{'type':db[_0xaa93('0x65')]['QueryTypes'][_0xaa93('0x66')],'raw':!![]})[_0xaa93('0x1b')](function(_0x18bd8b){return _0x18bd8b;});})[_0xaa93('0x1b')](function(_0x2d2106){if(_0x2d2106){_0x2a63b5[_0xaa93('0x24')][_0xaa93('0x67')]=_0x2d2106[0x0];if(!_0x4a8c2d['body']['UserId'])return;return db[_0xaa93('0x68')]['find']({'where':{'id':_0x4a8c2d[_0xaa93('0x50')][_0xaa93('0x57')],'role':_0xaa93('0x59')},'attributes':['id',_0xaa93('0x31'),'fullname','email',_0xaa93('0x69')],'raw':!![]});}return null;})[_0xaa93('0x1b')](function(_0x2ceb96){if(!_0x2ceb96)return null;_0x2a63b5[_0xaa93('0x24')]['agent']=_0x2ceb96;return _0x2a63b5;})[_0xaa93('0x1b')](function(_0x2d6ca3){if(_0x2d6ca3){if(_0x4a8c2d['body'][_0xaa93('0x6a')]){_0x2a63b5[_0xaa93('0x24')][_0xaa93('0x6b')]=util['format']('SIP/%s',_0x4a8c2d['user'][_0xaa93('0x31')]);_0x2a63b5[_0xaa93('0x24')][_0xaa93('0x6c')]=_0x2a63b5[_0xaa93('0x6c')];_0x2a63b5[_0xaa93('0x24')][_0xaa93('0x6d')]=_0x2a63b5[_0xaa93('0x6c')];_0x2a63b5[_0xaa93('0x24')][_0xaa93('0x6e')]='accept';return respondWithRpcPromise(_0xaa93('0x6f'),'EventManager',{'event':_0xaa93('0x70'),'message':_0x2a63b5['message']},client9002)[_0xaa93('0x1b')](function(){return _0x2a63b5;});}return _0x2a63b5;}return null;})[_0xaa93('0x1b')](respondWithResult(_0x2da5b6,null))[_0xaa93('0x25')](handleError(_0x2da5b6,null));};var interaction_log=require(_0xaa93('0xe'))(_0xaa93('0x53'));exports[_0xaa93('0x71')]=function(_0x238148,_0x1b804c,_0x45c8dc){var _0x310ac8={'agent':{},'channel':'sms'};if(_0x238148['body']['id']){delete _0x238148[_0xaa93('0x50')]['id'];}_0x238148['body']['UserId']=_0x238148[_0xaa93('0x50')]['UserId']||_0x238148['user']['id'];_0x310ac8[_0xaa93('0x59')]['id']=_0x238148[_0xaa93('0x50')][_0xaa93('0x57')];return db[_0xaa93('0x46')][_0xaa93('0x4e')]({'where':{'id':_0x238148[_0xaa93('0x4b')]['id'],'UserId':null}})[_0xaa93('0x1b')](handleEntityNotFound(_0x1b804c,null))[_0xaa93('0x1b')](function(_0x2c6421){if(_0x2c6421){_0x310ac8[_0xaa93('0x24')]=_0x2c6421[_0xaa93('0x5e')]({'plain':!![]});return db[_0xaa93('0x5a')][_0xaa93('0x4e')]({'where':{'id':_0x2c6421[_0xaa93('0x5b')]}});}return null;})[_0xaa93('0x1b')](handleEntityNotFound(_0x1b804c,null))['then'](function(_0x1f675b){if(_0x1f675b){_0x310ac8[_0xaa93('0x5d')]=_0x1f675b['get']({'plain':!![]});interaction_log[_0xaa93('0x1c')](_0xaa93('0x72'),_0x238148[_0xaa93('0x58')]['id'],_0x238148['user']['name'],_0x238148[_0xaa93('0x58')][_0xaa93('0x73')],_0x310ac8[_0xaa93('0x5d')]['id'],_0x238148[_0xaa93('0x50')]?JSON[_0xaa93('0x20')](_0x238148[_0xaa93('0x50')]):'null');return respondWithRpcPromise(_0xaa93('0x74'),_0xaa93('0x75'),_0x310ac8);}return null;})[_0xaa93('0x1b')](function(_0x23fe7d){var _0x5a29bf=_0xaa93('0x62')+_0x23fe7d['message'][_0xaa93('0x63')];return db[_0xaa93('0x64')][_0xaa93('0x37')](_0x5a29bf,{'type':db[_0xaa93('0x65')]['QueryTypes']['SELECT'],'raw':!![]})[_0xaa93('0x1b')](function(_0xd599d6){return _0xd599d6;});})[_0xaa93('0x1b')](function(_0x55e816){if(_0x55e816){_0x310ac8[_0xaa93('0x24')][_0xaa93('0x67')]=_0x55e816[0x0];if(!_0x238148[_0xaa93('0x50')][_0xaa93('0x57')])return;return db[_0xaa93('0x68')][_0xaa93('0x4e')]({'where':{'id':_0x238148[_0xaa93('0x50')]['UserId'],'role':'agent'},'attributes':['id',_0xaa93('0x31'),_0xaa93('0x76'),_0xaa93('0x77'),_0xaa93('0x69')],'raw':!![]});}return null;})[_0xaa93('0x1b')](function(_0x3d8867){if(!_0x3d8867)return null;_0x310ac8[_0xaa93('0x24')][_0xaa93('0x59')]=_0x3d8867;return _0x310ac8;})[_0xaa93('0x1b')](function(_0x360cc3){if(_0x360cc3){_0x360cc3['message'][_0xaa93('0x6b')]=util[_0xaa93('0x5c')](_0xaa93('0x78'),_0x238148[_0xaa93('0x58')][_0xaa93('0x31')]);_0x360cc3[_0xaa93('0x24')][_0xaa93('0x6c')]=_0x310ac8[_0xaa93('0x6c')];_0x360cc3[_0xaa93('0x24')]['motionChannel']=_0x310ac8[_0xaa93('0x6c')];_0x360cc3[_0xaa93('0x24')][_0xaa93('0x6e')]=_0xaa93('0x71');respondWithRpcPromise(_0xaa93('0x6f'),_0xaa93('0x6f'),{'event':_0xaa93('0x79'),'message':_0x360cc3[_0xaa93('0x24')]},client9002);return _0x310ac8;}return null;})['then'](respondWithResult(_0x1b804c,null))['catch'](handleError(_0x1b804c,null));};exports[_0xaa93('0x27')]=function(_0x2f3cd2,_0x38ad98,_0x18ef08){if(_0x2f3cd2[_0xaa93('0x50')]['id']){delete _0x2f3cd2[_0xaa93('0x50')]['id'];}var _0xa6e395;return db[_0xaa93('0x46')][_0xaa93('0x4e')]({'where':{'id':_0x2f3cd2[_0xaa93('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38ad98,null))[_0xaa93('0x1b')](function(_0x360f5a){if(_0x360f5a){_0xa6e395=_0x360f5a;return db['SmsAccount']['find']({'where':{'id':_0x360f5a[_0xaa93('0x7a')]}});}})[_0xaa93('0x1b')](handleEntityNotFound(_0x38ad98,null))[_0xaa93('0x1b')](function(_0xccad4f){if(_0xccad4f){logger[_0xaa93('0x1e')](_0xaa93('0x1f'),_0xaa93('0x27'),'received\x20delivery\x20report\x20from',_0xccad4f[_0xaa93('0x36')],util[_0xaa93('0x7b')](_0x2f3cd2['body'],{'showHidden':![],'depth':null}));switch(_0xccad4f[_0xaa93('0x36')]){case _0xaa93('0x7c'):if(_0x2f3cd2[_0xaa93('0x50')][_0xaa93('0x7d')]&&_0x2f3cd2[_0xaa93('0x50')][_0xaa93('0x7d')]===_0xa6e395[_0xaa93('0x7e')]){return _0xa6e395[_0xaa93('0x51')]({'read':!![]});}else{logger[_0xaa93('0x21')](_0xaa93('0x7f'),'status','twilio',util[_0xaa93('0x7b')](_0x2f3cd2['body'],{'showHidden':![],'depth':null}));}break;case _0xaa93('0x80'):if(_0x2f3cd2['body'][_0xaa93('0x81')]&&_0x2f3cd2[_0xaa93('0x50')]['MessageUUID']===_0xa6e395[_0xaa93('0x7e')]&&_[_0xaa93('0x82')]([_0xaa93('0x83'),_0xaa93('0x84')],_0x2f3cd2[_0xaa93('0x50')]['Status'])>=0x0){return _0xa6e395[_0xaa93('0x51')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xaa93('0x85'),util[_0xaa93('0x7b')](_0x2f3cd2[_0xaa93('0x50')],{'showHidden':![],'depth':null}));}break;case _0xaa93('0x86'):var _0x1be539=_0x2f3cd2[_0xaa93('0x50')][_0xaa93('0x87')][0x0];if(_0x1be539['status'][_0xaa93('0x88')]===_0xaa93('0x89')){return _0xa6e395[_0xaa93('0x51')]({'read':!![]});}else{logger[_0xaa93('0x21')](_0xaa93('0x7f'),_0xaa93('0x27'),'infobip',util[_0xaa93('0x7b')](_0x2f3cd2[_0xaa93('0x50')],{'showHidden':![],'depth':null}));}break;}return _0xa6e395;}})[_0xaa93('0x1b')](respondWithResult(_0x38ad98,null))['catch'](handleError(_0x38ad98,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ffd8b07..efc1319 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 _0x9e34=['emit','hasOwnProperty','hook','../../mysqldb','SmsMessage','setMaxListeners','update','remove'];(function(_0x2a3ced,_0x4d01ac){var _0x2f3820=function(_0x513b7f){while(--_0x513b7f){_0x2a3ced['push'](_0x2a3ced['shift']());}};_0x2f3820(++_0x4d01ac);}(_0x9e34,0xcb));var _0x49e3=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x9e34[_0x35885a];return _0xe86249;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x49e3('0x0'))['db'][_0x49e3('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x49e3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x49e3('0x3'),'afterDestroy':_0x49e3('0x4')};function emitEvent(_0x3a109f){return function(_0x4ed82d,_0x24ffd1,_0x3dc339){SmsMessageEvents[_0x49e3('0x5')](_0x3a109f+':'+_0x4ed82d['id'],_0x4ed82d);SmsMessageEvents[_0x49e3('0x5')](_0x3a109f,_0x4ed82d);_0x3dc339(null);};}for(var e in events){if(events[_0x49e3('0x6')](e)){var event=events[e];SmsMessage[_0x49e3('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x463f=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save','remove','emit'];(function(_0x2104ec,_0x532762){var _0x1dc742=function(_0x5ac08f){while(--_0x5ac08f){_0x2104ec['push'](_0x2104ec['shift']());}};_0x1dc742(++_0x532762);}(_0x463f,0x1f2));var _0xf463=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x463f[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xf463('0x0'));var SmsMessage=require(_0xf463('0x1'))['db'][_0xf463('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf463('0x3'),'afterUpdate':'update','afterDestroy':_0xf463('0x4')};function emitEvent(_0x413959){return function(_0x353340,_0x4839c2,_0x1a47cb){SmsMessageEvents[_0xf463('0x5')](_0x413959+':'+_0x353340['id'],_0x353340);SmsMessageEvents['emit'](_0x413959,_0x353340);_0x1a47cb(null);};}for(var e in events){if(events[_0xf463('0x6')](e)){var event=events[e];SmsMessage[_0xf463('0x7')](e,emitEvent(event));}}module[_0xf463('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index cf6b3c0..9f1ac15 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 _0xc27c=['&password=','GET','split','sms','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','timestamp','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','accountId','/messages','applicationId','Bearer\x20','code','message','status','refid','intelepeer','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','update','error','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='];(function(_0x235fb9,_0x5d4582){var _0x807078=function(_0x145534){while(--_0x145534){_0x235fb9['push'](_0x235fb9['shift']());}};_0x807078(++_0x5d4582);}(_0xc27c,0x136));var _0xcc27=function(_0x558193,_0x1b3bd1){_0x558193=_0x558193-0x0;var _0x30ce37=_0xc27c[_0x558193];return _0x30ce37;};'use strict';var _=require(_0xcc27('0x0'));var util=require('util');var logger=require(_0xcc27('0x1'))(_0xcc27('0x2'));var moment=require(_0xcc27('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc27('0x4'));var fs=require('fs');var path=require(_0xcc27('0x5'));var rimraf=require('rimraf');var config=require(_0xcc27('0x6'));var attributes=require(_0xcc27('0x7'));module[_0xcc27('0x8')]=function(_0x2e15f3,_0x2c5cec){return _0x2e15f3['define'](_0xcc27('0x9'),attributes,{'tableName':_0xcc27('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xcc27('0xb')]},{'name':_0xcc27('0xc'),'fields':[_0xcc27('0xd')],'type':_0xcc27('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x326888,_0x3b1fdc,_0xcdd176){var _0x52d73f=_0x2e15f3['models'];var _0x31c463=_0x326888[_0xcc27('0xf')]({'plain':!![]});if(_0x31c463['direction']['toLowerCase']()==='in'||_0x31c463[_0xcc27('0x10')][_0xcc27('0x11')]()===_0xcc27('0x12')&&!_0x31c463[_0xcc27('0x13')]&&!_[_0xcc27('0x14')](_0x31c463[_0xcc27('0x15')])&&!_['isNil'](_0x31c463[_0xcc27('0x16')])){_0x52d73f[_0xcc27('0x17')][_0xcc27('0x18')]({'where':{'id':_0x31c463[_0xcc27('0x16')]}})[_0xcc27('0x19')](function(_0x25903e){if(_0x25903e){_0x25903e['update']({'lastMsgAt':_0x31c463[_0xcc27('0x1a')],'lastMsgDirection':_0x31c463[_0xcc27('0x10')][_0xcc27('0x11')]()});}})[_0xcc27('0x1b')](function(_0x2b6904){console['error'](_0x2b6904);});}if(_0x31c463[_0xcc27('0x10')]==='out'&&!_0x31c463['secret']){var _0xf71634;_0x52d73f[_0xcc27('0x1c')][_0xcc27('0x1d')]({'where':{'id':_0x31c463[_0xcc27('0x1e')]},'raw':!![]})[_0xcc27('0x19')](function(_0x5acacb){_0xf71634=_0x5acacb;if(_0xf71634&&_0xf71634[_0xcc27('0x1f')]){switch(_0xf71634[_0xcc27('0x1f')]){case _0xcc27('0x20'):var _0x2f0f23=require('twilio');if(_0xf71634[_0xcc27('0x21')]&&_0xf71634[_0xcc27('0x22')]&&_0xf71634['phone']){var _0x21570f=new _0x2f0f23(_0xf71634[_0xcc27('0x21')],_0xf71634['authToken']);_0x21570f[_0xcc27('0x23')][_0xcc27('0x24')]({'body':_0x31c463['body'],'to':_0x31c463[_0xcc27('0x25')],'from':_0xf71634[_0xcc27('0x25')],'statusCallback':_0xf71634[_0xcc27('0x26')]+_0xcc27('0x27')+_0x31c463['id']+_0xcc27('0x28')+_0xf71634[_0xcc27('0x29')]})[_0xcc27('0x19')](function(_0x83070b){if(_0x83070b[_0xcc27('0x2a')]){return _0x326888[_0xcc27('0x2b')]({'messageId':_0x83070b[_0xcc27('0x2a')]});}})[_0xcc27('0x1b')](function(_0xe86d20){logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x20'),util[_0xcc27('0x2f')](_0xe86d20,{'showHidden':![],'depth':null}));});}else{logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x20'),_0xcc27('0x30'));}break;case _0xcc27('0x31'):var _0xe3a17b=_0xcc27('0x32');if(_0xf71634[_0xcc27('0x33')]&&_0xf71634[_0xcc27('0x34')]){var _0xd1d37f={'recipient':[_0x31c463[_0xcc27('0x25')]],'message':_0x31c463[_0xcc27('0xd')],'message_type':_0xf71634['smsMethod']};if(_0xf71634['smsMethod']&&_0xf71634[_0xcc27('0x35')]!=='SI'){_0xd1d37f[_0xcc27('0x36')]=_0xf71634[_0xcc27('0x25')];}var _0x22fa6a={'url':_0xe3a17b+_0xcc27('0x37')+_0xf71634[_0xcc27('0x33')]+_0xcc27('0x38')+_0xf71634[_0xcc27('0x34')],'method':_0xcc27('0x39')};rp(_0x22fa6a)[_0xcc27('0x19')](function(_0x8780a9){var _0x38c047=_0x8780a9[_0xcc27('0x3a')](';');var _0x5a503a={'user_key':_0x38c047[0x0],'session_key':_0x38c047[0x1]};_0x22fa6a={'url':_0xe3a17b+_0xcc27('0x3b'),'method':'POST','headers':{'user_key':_0x5a503a['user_key'],'Session_key':_0x5a503a['session_key']},'json':!![],'body':_0xd1d37f};return rp(_0x22fa6a);})[_0xcc27('0x19')](function(_0x2e12eb){if(_0x2e12eb['total_sent']>=0x1){var _0x21ac8a={'messageId':_0x2e12eb[_0xcc27('0x3c')]};if(_0xf71634[_0xcc27('0x35')]!=='GP'||!_0xf71634[_0xcc27('0x3d')]){_0x21ac8a[_0xcc27('0x3e')]=!![];}return _0x326888[_0xcc27('0x2b')](_0x21ac8a);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc27('0x2e'),'skebby',util[_0xcc27('0x2f')](_0x2e12eb,{'showHidden':![],'depth':null}));}})[_0xcc27('0x1b')](function(_0x346e25){return logger[_0xcc27('0x2c')](_0xcc27('0x2d'),'afterCreate',_0xcc27('0x31'),util[_0xcc27('0x2f')](_0x346e25,{'showHidden':![],'depth':null}));});}else{logger[_0xcc27('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc27('0x2e'),_0xcc27('0x31'),_0xcc27('0x3f'));}break;case _0xcc27('0x40'):if(_0xf71634[_0xcc27('0x22')]){var _0x3bbb74={'recipient':_0x31c463[_0xcc27('0x25')],'message':_0x31c463[_0xcc27('0xd')],'sender':_0xf71634[_0xcc27('0x41')]||_0xf71634[_0xcc27('0x25')],'authorization':_0xf71634[_0xcc27('0x22')]};var _0x3b1fdc={'method':_0xcc27('0x42'),'uri':_0xcc27('0x43'),'body':_0x3bbb74,'json':!![]};rp(_0x3b1fdc)['then'](function(_0xdece5){var _0x32bf06={'messageId':_0xdece5['requestid']};if(!_0xf71634[_0xcc27('0x3d')]){_0x32bf06[_0xcc27('0x3e')]=!![];}return _0x326888[_0xcc27('0x2b')](_0x32bf06);})['catch'](function(_0x50bc3c){logger['error'](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x40'),util['inspect'](_0x50bc3c,{'showHidden':![],'depth':null}));});}else{logger[_0xcc27('0x2c')](_0xcc27('0x2d'),'afterCreate','connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0xf71634[_0xcc27('0x33')]&&_0xf71634[_0xcc27('0x34')]){var _0x3bbb74={'messages':[{'source':_0xcc27('0x44'),'to':_0x31c463[_0xcc27('0x25')],'body':_0x31c463[_0xcc27('0xd')],'from':_0xf71634['senderString']||_0xf71634[_0xcc27('0x25')]}]};var _0x49e3d8=util[_0xcc27('0x45')](_0xcc27('0x46'),_0xf71634[_0xcc27('0x33')],_0xf71634[_0xcc27('0x34')]);var _0x3b1fdc={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x3bbb74,'headers':{'Authorization':util[_0xcc27('0x45')](_0xcc27('0x47'),new Buffer(_0x49e3d8)[_0xcc27('0x48')](_0xcc27('0x49')))},'json':!![]};rp(_0x3b1fdc)[_0xcc27('0x19')](function(_0x469ad5){if(_0x469ad5[_0xcc27('0x4a')]>=0xc8&&_0x469ad5[_0xcc27('0x4a')]<=0xce){if(_0x469ad5[_0xcc27('0x4b')]&&_0x469ad5['data'][_0xcc27('0x4c')]>0x0){var _0x40b148=_[_0xcc27('0x4d')](_0x469ad5[_0xcc27('0x4b')][_0xcc27('0x23')]);var _0x1977ad={'messageId':_0x40b148['message_id']};if(!_0xf71634['deliveryReport']){_0x1977ad['read']=!![];}return _0x326888[_0xcc27('0x2b')](_0x1977ad);}else{logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x4e'),util[_0xcc27('0x2f')](_0x469ad5,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xcc27('0x2d'),_0xcc27('0x2e'),'clickSend',util[_0xcc27('0x2f')](_0x469ad5,{'showHidden':![],'depth':null}));}})[_0xcc27('0x1b')](function(_0x33dc9e){logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x4e'),util[_0xcc27('0x2f')](_0x33dc9e,{'showHidden':![],'depth':null}));});}else{logger[_0xcc27('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc27('0x2e'),'clickSend',_0xcc27('0x3f'));}break;case'plivo':if(_0xf71634[_0xcc27('0x4f')]&&_0xf71634[_0xcc27('0x22')]){var _0x3bbb74={'dst':_0x31c463['phone'],'text':_0x31c463[_0xcc27('0xd')],'src':_0xf71634[_0xcc27('0x41')]||_0xf71634[_0xcc27('0x25')],'url':_0xf71634[_0xcc27('0x26')]+_0xcc27('0x27')+_0x31c463['id']+_0xcc27('0x28')+_0xf71634[_0xcc27('0x29')]};var _0x49e3d8=util[_0xcc27('0x45')](_0xcc27('0x46'),_0xf71634[_0xcc27('0x4f')],_0xf71634[_0xcc27('0x22')]);var _0x3b1fdc={'method':_0xcc27('0x42'),'uri':util[_0xcc27('0x45')](_0xcc27('0x50'),_0xf71634['authId']),'body':_0x3bbb74,'headers':{'Authorization':util[_0xcc27('0x45')](_0xcc27('0x47'),new Buffer(_0x49e3d8)[_0xcc27('0x48')]('base64'))},'json':!![]};rp(_0x3b1fdc)['then'](function(_0x530932){var _0x208293={'messageId':_0x530932['message_uuid'][0x0]};return _0x326888[_0xcc27('0x2b')](_0x208293);})[_0xcc27('0x1b')](function(_0x3fb866){logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x51'),util[_0xcc27('0x2f')](_0x3fb866,{'showHidden':![],'depth':null}));});}else{logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x51'),_0xcc27('0x52'));}break;case _0xcc27('0x53'):if(_0xf71634[_0xcc27('0x33')]&&_0xf71634[_0xcc27('0x34')]){if(_0xf71634['baseUrl']){var _0x87ac1e={'method':_0xcc27('0x42'),'uri':_0xf71634[_0xcc27('0x54')]+_0xcc27('0x55'),'body':{'username':_0xf71634[_0xcc27('0x33')],'password':_0xf71634[_0xcc27('0x34')]},'json':!![]};return rp(_0x87ac1e)[_0xcc27('0x19')](function(_0x41670e){var _0xf42517={'method':_0xcc27('0x42'),'uri':_0xf71634['baseUrl']+_0xcc27('0x56'),'body':{'messages':[{'from':_0xf71634[_0xcc27('0x25')],'destinations':[{'to':_0x31c463[_0xcc27('0x25')]}],'text':_0x31c463[_0xcc27('0xd')],'notifyUrl':_0xf71634['remote']+'/api/sms/messages/'+_0x31c463['id']+_0xcc27('0x28')+_0xf71634[_0xcc27('0x29')],'notifyContentType':_0xcc27('0x57'),'callbackData':_0xf71634[_0xcc27('0x25')]+';'+_0x31c463['body']}]},'headers':{'Authorization':_0xcc27('0x58')+_0x41670e[_0xcc27('0x29')]},'json':!![]};return rp(_0xf42517)['then'](function(_0x55f1b6){if(_0x55f1b6[_0xcc27('0x23')]){var _0xaf983a={'messageId':_0x55f1b6[_0xcc27('0x23')][0x0][_0xcc27('0xb')]};if(!_0xf71634[_0xcc27('0x3d')]){_0xaf983a[_0xcc27('0x3e')]=!![];}return _0x326888['update'](_0xaf983a);}else{return logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x53'),util['inspect'](_0x55f1b6,{'showHidden':![],'depth':null}));}});})[_0xcc27('0x1b')](function(_0x2b0008){return logger['error'](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x53'),util[_0xcc27('0x2f')](_0x2b0008,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcc27('0x2d'),'afterCreate','infobip',_0xcc27('0x59'));}}else{logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),'infobip',_0xcc27('0x3f'));}break;case _0xcc27('0x5a'):var _0x4999b5=require(_0xcc27('0x5b'));if(_0xf71634[_0xcc27('0x5c')]){var _0xfcd536={};_0xfcd536['login']=_0xf71634[_0xcc27('0x33')];_0xfcd536[_0xcc27('0x25')]=_0x31c463['phone'];_0xfcd536['sender']=_0xf71634[_0xcc27('0x25')];_0xfcd536[_0xcc27('0x5d')]=_0x31c463['body'];_0xfcd536[_0xcc27('0x5e')]=+new Date();var _0x397e4f='';var _0x5de212='';var _0x296d52=Object['keys'](_0xfcd536);_0x296d52[_0xcc27('0x5f')]();for(var _0x4df053=0x0;_0x4df053<_0x296d52[_0xcc27('0x60')];_0x4df053++){if(_0x397e4f!=''){_0x397e4f+='&';}_0x397e4f+=_0x296d52[_0x4df053]+'='+encodeURIComponent(_0xfcd536[_0x296d52[_0x4df053]]);_0x5de212+=_0xfcd536[_0x296d52[_0x4df053]];}_0x5de212+=_0xf71634[_0xcc27('0x5c')];_0x5de212=_0x4999b5[_0xcc27('0x61')](_0xcc27('0x62'))[_0xcc27('0x2b')](_0x5de212)[_0xcc27('0x63')](_0xcc27('0x64'));if(_0x397e4f!==''){_0x397e4f+='&';}_0x397e4f+=_0xcc27('0x65')+_0x5de212;var _0x22fa6a={'method':'GET','uri':_0xf71634['baseUrl']+_0xcc27('0x66')+_0x397e4f,'json':!![]};return rp(_0x22fa6a)[_0xcc27('0x19')](function(_0x380b13){var _0x310daa=Object[_0xcc27('0x67')](_0x380b13);if(_0x380b13[_0x310daa[0x0]][_0xcc27('0x2c')]&&parseInt(_0x380b13[_0x310daa[0x0]][_0xcc27('0x2c')])===0x0){var _0x488fdc={'messageId':_0x380b13[_0x310daa[0x0]][_0xcc27('0x68')]};if(!_0xf71634['deliveryReport']){_0x488fdc[_0xcc27('0x3e')]=!![];}return _0x326888[_0xcc27('0x2b')](_0x488fdc);}else{return logger[_0xcc27('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc27('0x2e'),'csc',util[_0xcc27('0x2f')](_0x380b13[_0xcc27('0x2c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2e30d5){return logger[_0xcc27('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc27('0x2e'),_0xcc27('0x5a'),util[_0xcc27('0x2f')](_0x2e30d5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcc27('0x2d'),'afterCreate','csc',_0xcc27('0x69'));}break;case _0xcc27('0x6a'):if(_0xf71634['apiKey']){var _0xcd31e5={'method':_0xcc27('0x42'),'uri':_0xcc27('0x6b'),'headers':{'Authorization':_0xf71634[_0xcc27('0x5c')]},'body':{'content':_0x31c463[_0xcc27('0xd')],'to':[_0x31c463[_0xcc27('0x25')]],'from':_0xf71634[_0xcc27('0x25')],'binary':![],'clientMessageId':_0xcc27('0x6c'),'charset':'UTF-8'},'json':!![]};rp(_0xcd31e5)[_0xcc27('0x19')](function(_0x2a6b7b){if(!_0x2a6b7b[_0xcc27('0x2c')]){var _0x4a3c91={'messageId':_0x2a6b7b['messages'][0x0][_0xcc27('0x6d')]};if(!_0xf71634['deliveryReport']){_0x4a3c91['read']=!![];}return _0x326888['update'](_0x4a3c91);}else{return logger['error'](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x6a'),util[_0xcc27('0x2f')](_0x2a6b7b[_0xcc27('0x2c')],{'showHidden':![],'depth':null}));}})[_0xcc27('0x1b')](function(_0x31a409){return logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),'clickatell',util[_0xcc27('0x2f')](_0x31a409,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcc27('0x2d'),_0xcc27('0x2e'),'clickatell',_0xcc27('0x69'));}break;case _0xcc27('0x6e'):if(_0xf71634[_0xcc27('0x33')]&&_0xf71634[_0xcc27('0x34')]){var _0x49e3d8=util['format'](_0xcc27('0x46'),_0xf71634['username'],_0xf71634[_0xcc27('0x34')]);var _0x3b1fdc={'method':_0xcc27('0x42'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xf71634[_0xcc27('0x6f')]+_0xcc27('0x70'),'body':{'to':[_0x31c463['phone']],'text':_0x31c463[_0xcc27('0xd')],'from':_0xf71634['phone'],'applicationId':_0xf71634[_0xcc27('0x71')]},'headers':{'Authorization':util[_0xcc27('0x45')](_0xcc27('0x47'),new Buffer(_0x49e3d8)['toString'](_0xcc27('0x49')))},'json':!![]};rp(_0x3b1fdc)[_0xcc27('0x19')](function(_0x4626db){if(_0x4626db['id']){var _0x4d92e7={'messageId':_0x4626db['id']};return _0x326888[_0xcc27('0x2b')](_0x4d92e7);}else{logger[_0xcc27('0x2c')](_0xcc27('0x2d'),'afterCreate','bandwidth',util[_0xcc27('0x2f')](_0x4626db,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5f5afa){logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x6e'),util[_0xcc27('0x2f')](_0x5f5afa,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcc27('0x2d'),'afterCreate',_0xcc27('0x6e'),_0xcc27('0x3f'));}break;case'intelepeer':if(_0xf71634[_0xcc27('0x5c')]){var _0x4cecbc={};var _0x22fa6a={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xcc27('0x72')+_0xf71634[_0xcc27('0x5c')],'Content-Type':_0xcc27('0x57')},'body':{'from':_0xf71634[_0xcc27('0x25')],'to':_0x31c463[_0xcc27('0x25')],'text':_0x31c463[_0xcc27('0xd')]},'json':!![]};return rp(_0x22fa6a)[_0xcc27('0x19')](function(_0x20760f){if(_0x20760f[_0xcc27('0x73')]==0xca){_0x4cecbc[_0xcc27('0x74')]=_0x20760f;var _0x383ec8={'method':_0xcc27('0x42'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xcc27('0x72')+_0xf71634[_0xcc27('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x4cecbc['message']['refid']},'json':!![]};return rp(_0x383ec8)[_0xcc27('0x19')](function(_0xf34be7){_0x4cecbc[_0xcc27('0x75')]=_0xf34be7;var _0x5d9d46={'messageId':_0x4cecbc['message'][_0xcc27('0x76')],'read':!![]};return _0x326888['update'](_0x5d9d46);});}else{return logger[_0xcc27('0x2c')](_0xcc27('0x2d'),_0xcc27('0x2e'),_0xcc27('0x77'),util[_0xcc27('0x2f')](_0x20760f,{'showHidden':![],'depth':null}));}})[_0xcc27('0x1b')](function(_0x4afe9c){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc27('0x2e'),_0xcc27('0x77'),util[_0xcc27('0x2f')](_0x4afe9c,{'showHidden':![],'depth':null}));});}else{return logger[_0xcc27('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',_0xcc27('0x78'));}break;}}})['finally'](function(){_0xcdd176();});}else{_0xcdd176();}}},'charset':'utf8mb4','collate':_0xcc27('0x79')});}; \ No newline at end of file +var _0x35d1=['data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto','login','timestamp','keys','sort','length','apiKey','createHash','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','update','createdAt','catch','SmsAccount','SmsAccountId','then','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','clicksend','xCALLY\x20Motion','%s:%s','format','toString','base64','http_code'];(function(_0xc82f28,_0x24e29a){var _0x5608b1=function(_0x1e1ab5){while(--_0x1e1ab5){_0xc82f28['push'](_0xc82f28['shift']());}};_0x5608b1(++_0x24e29a);}(_0x35d1,0x127));var _0x135d=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x35d1[_0x4450b1];return _0x399b0b;};'use strict';var _=require(_0x135d('0x0'));var util=require(_0x135d('0x1'));var logger=require(_0x135d('0x2'))(_0x135d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x135d('0x4'));var fs=require('fs');var path=require(_0x135d('0x5'));var rimraf=require(_0x135d('0x6'));var config=require('../../config/environment');var attributes=require(_0x135d('0x7'));module[_0x135d('0x8')]=function(_0xeadf6a,_0x1d7ca9){return _0xeadf6a[_0x135d('0x9')](_0x135d('0xa'),attributes,{'tableName':_0x135d('0xb'),'paranoid':![],'indexes':[{'name':_0x135d('0xc'),'fields':['messageId']},{'name':_0x135d('0xd'),'fields':[_0x135d('0xe')],'type':_0x135d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x133f3e,_0x2c8285,_0x7dab73){var _0xc76cc6=_0xeadf6a['models'];var _0x505129=_0x133f3e[_0x135d('0x10')]({'plain':!![]});if(_0x505129[_0x135d('0x11')][_0x135d('0x12')]()==='in'||_0x505129[_0x135d('0x11')][_0x135d('0x12')]()===_0x135d('0x13')&&!_0x505129[_0x135d('0x14')]&&!_[_0x135d('0x15')](_0x505129[_0x135d('0x16')])&&!_[_0x135d('0x15')](_0x505129[_0x135d('0x17')])){_0xc76cc6[_0x135d('0x18')]['findOne']({'where':{'id':_0x505129[_0x135d('0x17')]}})['then'](function(_0x4dab2c){if(_0x4dab2c){_0x4dab2c[_0x135d('0x19')]({'lastMsgAt':_0x505129[_0x135d('0x1a')],'lastMsgDirection':_0x505129[_0x135d('0x11')][_0x135d('0x12')]()});}})[_0x135d('0x1b')](function(_0x249fbb){console['error'](_0x249fbb);});}if(_0x505129['direction']===_0x135d('0x13')&&!_0x505129[_0x135d('0x14')]){var _0x431c62;_0xc76cc6[_0x135d('0x1c')]['find']({'where':{'id':_0x505129[_0x135d('0x1d')]},'raw':!![]})[_0x135d('0x1e')](function(_0x16a1f3){_0x431c62=_0x16a1f3;if(_0x431c62&&_0x431c62['type']){switch(_0x431c62['type']){case _0x135d('0x1f'):var _0x4695be=require(_0x135d('0x1f'));if(_0x431c62[_0x135d('0x20')]&&_0x431c62[_0x135d('0x21')]&&_0x431c62[_0x135d('0x22')]){var _0x436654=new _0x4695be(_0x431c62['accountSid'],_0x431c62[_0x135d('0x21')]);_0x436654[_0x135d('0x23')][_0x135d('0x24')]({'body':_0x505129[_0x135d('0xe')],'to':_0x505129[_0x135d('0x22')],'from':_0x431c62[_0x135d('0x22')],'statusCallback':_0x431c62[_0x135d('0x25')]+'/api/sms/messages/'+_0x505129['id']+_0x135d('0x26')+_0x431c62[_0x135d('0x27')]})[_0x135d('0x1e')](function(_0x129a07){if(_0x129a07[_0x135d('0x28')]){return _0x133f3e[_0x135d('0x19')]({'messageId':_0x129a07[_0x135d('0x28')]});}})[_0x135d('0x1b')](function(_0x2c0e2d){logger['error'](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x1f'),util[_0x135d('0x2b')](_0x2c0e2d,{'showHidden':![],'depth':null}));});}else{logger[_0x135d('0x2c')](_0x135d('0x29'),_0x135d('0x2a'),'twilio',_0x135d('0x2d'));}break;case _0x135d('0x2e'):var _0x527cb1=_0x135d('0x2f');if(_0x431c62['username']&&_0x431c62[_0x135d('0x30')]){var _0xafcaa3={'recipient':[_0x505129[_0x135d('0x22')]],'message':_0x505129[_0x135d('0xe')],'message_type':_0x431c62['smsMethod']};if(_0x431c62['smsMethod']&&_0x431c62[_0x135d('0x31')]!=='SI'){_0xafcaa3[_0x135d('0x32')]=_0x431c62['phone'];}var _0x12fda9={'url':_0x527cb1+_0x135d('0x33')+_0x431c62[_0x135d('0x34')]+_0x135d('0x35')+_0x431c62[_0x135d('0x30')],'method':_0x135d('0x36')};rp(_0x12fda9)[_0x135d('0x1e')](function(_0x469e41){var _0x1d1f95=_0x469e41[_0x135d('0x37')](';');var _0x8263ae={'user_key':_0x1d1f95[0x0],'session_key':_0x1d1f95[0x1]};_0x12fda9={'url':_0x527cb1+_0x135d('0x38'),'method':_0x135d('0x39'),'headers':{'user_key':_0x8263ae[_0x135d('0x3a')],'Session_key':_0x8263ae[_0x135d('0x3b')]},'json':!![],'body':_0xafcaa3};return rp(_0x12fda9);})[_0x135d('0x1e')](function(_0x46035f){if(_0x46035f[_0x135d('0x3c')]>=0x1){var _0x48f9c7={'messageId':_0x46035f['internal_order_id']};if(_0x431c62[_0x135d('0x31')]!=='GP'||!_0x431c62[_0x135d('0x3d')]){_0x48f9c7[_0x135d('0x3e')]=!![];}return _0x133f3e['update'](_0x48f9c7);}else{return logger[_0x135d('0x2c')](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x2e'),util[_0x135d('0x2b')](_0x46035f,{'showHidden':![],'depth':null}));}})[_0x135d('0x1b')](function(_0x29cf06){return logger['error'](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x2e'),util['inspect'](_0x29cf06,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x2e'),_0x135d('0x3f'));}break;case _0x135d('0x40'):if(_0x431c62[_0x135d('0x21')]){var _0xd417e9={'recipient':_0x505129[_0x135d('0x22')],'message':_0x505129[_0x135d('0xe')],'sender':_0x431c62[_0x135d('0x41')]||_0x431c62['phone'],'authorization':_0x431c62[_0x135d('0x21')]};var _0x2c8285={'method':'POST','uri':_0x135d('0x42'),'body':_0xd417e9,'json':!![]};rp(_0x2c8285)['then'](function(_0x1c80ae){var _0x50458d={'messageId':_0x1c80ae['requestid']};if(!_0x431c62['deliveryReport']){_0x50458d[_0x135d('0x3e')]=!![];}return _0x133f3e[_0x135d('0x19')](_0x50458d);})[_0x135d('0x1b')](function(_0x2e9422){logger[_0x135d('0x2c')](_0x135d('0x29'),_0x135d('0x2a'),'connectel',util[_0x135d('0x2b')](_0x2e9422,{'showHidden':![],'depth':null}));});}else{logger[_0x135d('0x2c')](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x40'),'Missing\x20parameters:\x20authToken');}break;case _0x135d('0x43'):if(_0x431c62[_0x135d('0x34')]&&_0x431c62[_0x135d('0x30')]){var _0xd417e9={'messages':[{'source':_0x135d('0x44'),'to':_0x505129['phone'],'body':_0x505129[_0x135d('0xe')],'from':_0x431c62[_0x135d('0x41')]||_0x431c62['phone']}]};var _0x10dcf9=util['format'](_0x135d('0x45'),_0x431c62[_0x135d('0x34')],_0x431c62['password']);var _0x2c8285={'method':_0x135d('0x39'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xd417e9,'headers':{'Authorization':util[_0x135d('0x46')]('Basic\x20%s',new Buffer(_0x10dcf9)[_0x135d('0x47')](_0x135d('0x48')))},'json':!![]};rp(_0x2c8285)['then'](function(_0x45d2ca){if(_0x45d2ca[_0x135d('0x49')]>=0xc8&&_0x45d2ca['http_code']<=0xce){if(_0x45d2ca[_0x135d('0x4a')]&&_0x45d2ca['data'][_0x135d('0x4b')]>0x0){var _0x574cdf=_[_0x135d('0x4c')](_0x45d2ca[_0x135d('0x4a')][_0x135d('0x23')]);var _0x2e23c1={'messageId':_0x574cdf[_0x135d('0x4d')]};if(!_0x431c62[_0x135d('0x3d')]){_0x2e23c1[_0x135d('0x3e')]=!![];}return _0x133f3e[_0x135d('0x19')](_0x2e23c1);}else{logger['error'](_0x135d('0x29'),_0x135d('0x2a'),'clickSend',util['inspect'](_0x45d2ca,{'showHidden':![],'depth':null}));}}else{logger[_0x135d('0x2c')](_0x135d('0x29'),_0x135d('0x2a'),'clickSend',util[_0x135d('0x2b')](_0x45d2ca,{'showHidden':![],'depth':null}));}})[_0x135d('0x1b')](function(_0x2a6d56){logger[_0x135d('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x135d('0x4e'),util[_0x135d('0x2b')](_0x2a6d56,{'showHidden':![],'depth':null}));});}else{logger[_0x135d('0x2c')](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x4e'),_0x135d('0x3f'));}break;case _0x135d('0x4f'):if(_0x431c62[_0x135d('0x50')]&&_0x431c62[_0x135d('0x21')]){var _0xd417e9={'dst':_0x505129['phone'],'text':_0x505129[_0x135d('0xe')],'src':_0x431c62[_0x135d('0x41')]||_0x431c62[_0x135d('0x22')],'url':_0x431c62['remote']+_0x135d('0x51')+_0x505129['id']+'/status?token='+_0x431c62[_0x135d('0x27')]};var _0x10dcf9=util[_0x135d('0x46')](_0x135d('0x45'),_0x431c62[_0x135d('0x50')],_0x431c62[_0x135d('0x21')]);var _0x2c8285={'method':'POST','uri':util[_0x135d('0x46')](_0x135d('0x52'),_0x431c62[_0x135d('0x50')]),'body':_0xd417e9,'headers':{'Authorization':util[_0x135d('0x46')](_0x135d('0x53'),new Buffer(_0x10dcf9)[_0x135d('0x47')](_0x135d('0x48')))},'json':!![]};rp(_0x2c8285)['then'](function(_0x2e8329){var _0x5a29b5={'messageId':_0x2e8329[_0x135d('0x54')][0x0]};return _0x133f3e[_0x135d('0x19')](_0x5a29b5);})[_0x135d('0x1b')](function(_0x49ac71){logger[_0x135d('0x2c')](_0x135d('0x29'),'afterCreate','plivo',util[_0x135d('0x2b')](_0x49ac71,{'showHidden':![],'depth':null}));});}else{logger[_0x135d('0x2c')](_0x135d('0x29'),'afterCreate',_0x135d('0x4f'),_0x135d('0x55'));}break;case'infobip':if(_0x431c62[_0x135d('0x34')]&&_0x431c62[_0x135d('0x30')]){if(_0x431c62[_0x135d('0x56')]){var _0x32c2d1={'method':_0x135d('0x39'),'uri':_0x431c62[_0x135d('0x56')]+_0x135d('0x57'),'body':{'username':_0x431c62['username'],'password':_0x431c62['password']},'json':!![]};return rp(_0x32c2d1)[_0x135d('0x1e')](function(_0x18b20f){var _0x30962a={'method':_0x135d('0x39'),'uri':_0x431c62[_0x135d('0x56')]+_0x135d('0x58'),'body':{'messages':[{'from':_0x431c62[_0x135d('0x22')],'destinations':[{'to':_0x505129[_0x135d('0x22')]}],'text':_0x505129[_0x135d('0xe')],'notifyUrl':_0x431c62[_0x135d('0x25')]+_0x135d('0x51')+_0x505129['id']+_0x135d('0x26')+_0x431c62['token'],'notifyContentType':_0x135d('0x59'),'callbackData':_0x431c62[_0x135d('0x22')]+';'+_0x505129[_0x135d('0xe')]}]},'headers':{'Authorization':_0x135d('0x5a')+_0x18b20f[_0x135d('0x27')]},'json':!![]};return rp(_0x30962a)[_0x135d('0x1e')](function(_0x2d38d8){if(_0x2d38d8[_0x135d('0x23')]){var _0x20833d={'messageId':_0x2d38d8['messages'][0x0][_0x135d('0xc')]};if(!_0x431c62['deliveryReport']){_0x20833d[_0x135d('0x3e')]=!![];}return _0x133f3e[_0x135d('0x19')](_0x20833d);}else{return logger[_0x135d('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x135d('0x5b'),util[_0x135d('0x2b')](_0x2d38d8,{'showHidden':![],'depth':null}));}});})[_0x135d('0x1b')](function(_0x5015f9){return logger['error'](_0x135d('0x29'),'afterCreate',_0x135d('0x5b'),util['inspect'](_0x5015f9,{'showHidden':![],'depth':null}));});}else{logger[_0x135d('0x2c')](_0x135d('0x29'),'afterCreate',_0x135d('0x5b'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x135d('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x135d('0x2a'),_0x135d('0x5b'),_0x135d('0x3f'));}break;case _0x135d('0x5c'):var _0x3a9298=require(_0x135d('0x5d'));if(_0x431c62['apiKey']){var _0x5a00f2={};_0x5a00f2[_0x135d('0x5e')]=_0x431c62['username'];_0x5a00f2[_0x135d('0x22')]=_0x505129[_0x135d('0x22')];_0x5a00f2[_0x135d('0x32')]=_0x431c62['phone'];_0x5a00f2['text']=_0x505129[_0x135d('0xe')];_0x5a00f2[_0x135d('0x5f')]=+new Date();var _0xa659bf='';var _0x1eeba2='';var _0xb7d0c8=Object[_0x135d('0x60')](_0x5a00f2);_0xb7d0c8[_0x135d('0x61')]();for(var _0x4a4368=0x0;_0x4a4368<_0xb7d0c8[_0x135d('0x62')];_0x4a4368++){if(_0xa659bf!=''){_0xa659bf+='&';}_0xa659bf+=_0xb7d0c8[_0x4a4368]+'='+encodeURIComponent(_0x5a00f2[_0xb7d0c8[_0x4a4368]]);_0x1eeba2+=_0x5a00f2[_0xb7d0c8[_0x4a4368]];}_0x1eeba2+=_0x431c62[_0x135d('0x63')];_0x1eeba2=_0x3a9298[_0x135d('0x64')](_0x135d('0x65'))[_0x135d('0x19')](_0x1eeba2)[_0x135d('0x66')](_0x135d('0x67'));if(_0xa659bf!==''){_0xa659bf+='&';}_0xa659bf+=_0x135d('0x68')+_0x1eeba2;var _0x12fda9={'method':_0x135d('0x36'),'uri':_0x431c62[_0x135d('0x56')]+'/external/get/send.php?'+_0xa659bf,'json':!![]};return rp(_0x12fda9)[_0x135d('0x1e')](function(_0x3074c9){var _0x140239=Object['keys'](_0x3074c9);if(_0x3074c9[_0x140239[0x0]][_0x135d('0x2c')]&&parseInt(_0x3074c9[_0x140239[0x0]][_0x135d('0x2c')])===0x0){var _0x2fc167={'messageId':_0x3074c9[_0x140239[0x0]][_0x135d('0x69')]};if(!_0x431c62[_0x135d('0x3d')]){_0x2fc167['read']=!![];}return _0x133f3e[_0x135d('0x19')](_0x2fc167);}else{return logger[_0x135d('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x135d('0x2a'),_0x135d('0x5c'),util[_0x135d('0x2b')](_0x3074c9['error'],{'showHidden':![],'depth':null}));}})[_0x135d('0x1b')](function(_0x57fdb5){return logger[_0x135d('0x2c')](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x5c'),util[_0x135d('0x2b')](_0x57fdb5,{'showHidden':![],'depth':null}));});}else{logger[_0x135d('0x2c')](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x5c'),_0x135d('0x6a'));}break;case'clickatell':if(_0x431c62['apiKey']){var _0x5b2eb0={'method':'POST','uri':_0x135d('0x6b'),'headers':{'Authorization':_0x431c62[_0x135d('0x63')]},'body':{'content':_0x505129[_0x135d('0xe')],'to':[_0x505129[_0x135d('0x22')]],'from':_0x431c62[_0x135d('0x22')],'binary':![],'clientMessageId':_0x135d('0x6c'),'charset':_0x135d('0x6d')},'json':!![]};rp(_0x5b2eb0)[_0x135d('0x1e')](function(_0x3f2afc){if(!_0x3f2afc[_0x135d('0x2c')]){var _0x4e09a4={'messageId':_0x3f2afc[_0x135d('0x23')][0x0][_0x135d('0x6e')]};if(!_0x431c62['deliveryReport']){_0x4e09a4[_0x135d('0x3e')]=!![];}return _0x133f3e[_0x135d('0x19')](_0x4e09a4);}else{return logger[_0x135d('0x2c')](_0x135d('0x29'),_0x135d('0x2a'),'clickatell',util[_0x135d('0x2b')](_0x3f2afc[_0x135d('0x2c')],{'showHidden':![],'depth':null}));}})[_0x135d('0x1b')](function(_0x709dc5){return logger['error'](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x6f'),util[_0x135d('0x2b')](_0x709dc5,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',_0x135d('0x6a'));}break;case _0x135d('0x70'):if(_0x431c62[_0x135d('0x34')]&&_0x431c62[_0x135d('0x30')]){var _0x10dcf9=util['format'](_0x135d('0x45'),_0x431c62['username'],_0x431c62[_0x135d('0x30')]);var _0x2c8285={'method':'POST','uri':_0x135d('0x71')+_0x431c62['accountId']+'/messages','body':{'to':[_0x505129[_0x135d('0x22')]],'text':_0x505129[_0x135d('0xe')],'from':_0x431c62[_0x135d('0x22')],'applicationId':_0x431c62['applicationId']},'headers':{'Authorization':util[_0x135d('0x46')](_0x135d('0x53'),new Buffer(_0x10dcf9)[_0x135d('0x47')](_0x135d('0x48')))},'json':!![]};rp(_0x2c8285)[_0x135d('0x1e')](function(_0x411780){if(_0x411780['id']){var _0x373058={'messageId':_0x411780['id']};return _0x133f3e['update'](_0x373058);}else{logger[_0x135d('0x2c')](_0x135d('0x29'),_0x135d('0x2a'),'bandwidth',util[_0x135d('0x2b')](_0x411780,{'showHidden':![],'depth':null}));}})[_0x135d('0x1b')](function(_0x48b0e5){logger[_0x135d('0x2c')](_0x135d('0x29'),'afterCreate',_0x135d('0x70'),util[_0x135d('0x2b')](_0x48b0e5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x70'),_0x135d('0x3f'));}break;case _0x135d('0x72'):if(_0x431c62[_0x135d('0x63')]){var _0x5dad68={};var _0x12fda9={'method':_0x135d('0x39'),'uri':_0x135d('0x73'),'headers':{'Authorization':_0x135d('0x74')+_0x431c62['apiKey'],'Content-Type':_0x135d('0x59')},'body':{'from':_0x431c62['phone'],'to':_0x505129[_0x135d('0x22')],'text':_0x505129[_0x135d('0xe')]},'json':!![]};return rp(_0x12fda9)[_0x135d('0x1e')](function(_0x4e7877){if(_0x4e7877[_0x135d('0x75')]==0xca){_0x5dad68[_0x135d('0x76')]=_0x4e7877;var _0x3d5e47={'method':_0x135d('0x39'),'uri':_0x135d('0x77'),'headers':{'Authorization':_0x135d('0x74')+_0x431c62[_0x135d('0x63')],'Content-Type':_0x135d('0x59')},'body':{'refid':_0x5dad68[_0x135d('0x76')]['refid']},'json':!![]};return rp(_0x3d5e47)[_0x135d('0x1e')](function(_0x2d35ce){_0x5dad68['status']=_0x2d35ce;var _0x1090f0={'messageId':_0x5dad68[_0x135d('0x76')]['refid'],'read':!![]};return _0x133f3e[_0x135d('0x19')](_0x1090f0);});}else{return logger['error'](_0x135d('0x29'),'afterCreate','intelepeer',util['inspect'](_0x4e7877,{'showHidden':![],'depth':null}));}})[_0x135d('0x1b')](function(_0xe03d5b){return logger['error'](_0x135d('0x29'),_0x135d('0x2a'),_0x135d('0x72'),util[_0x135d('0x2b')](_0xe03d5b,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x135d('0x29'),_0x135d('0x2a'),'intelepeer',_0x135d('0x78'));}break;}}})[_0x135d('0x79')](function(){_0x7dab73();});}else{_0x7dab73();}}},'charset':_0x135d('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 36d312c..d013214 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 _0xd652=['code','message','request\x20sent','catch','CreateSmsMessage','create','body','options','raw','info','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd652,0xd0));var _0x2d65=function(_0x210411,_0xba06f4){_0x210411=_0x210411-0x0;var _0x367205=_0xd652[_0x210411];return _0x367205;};'use strict';var _=require(_0x2d65('0x0'));var util=require(_0x2d65('0x1'));var moment=require('moment');var BPromise=require(_0x2d65('0x2'));var rs=require(_0x2d65('0x3'));var fs=require('fs');var Redis=require(_0x2d65('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2d65('0x5'))(_0x2d65('0x6'));var config=require(_0x2d65('0x7'));var jayson=require(_0x2d65('0x8'));var client=jayson[_0x2d65('0x9')][_0x2d65('0xa')]({'port':0x232a});config[_0x2d65('0xb')]=_[_0x2d65('0xc')](config[_0x2d65('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d65('0xd'))(new Redis(config[_0x2d65('0xb')]));require(_0x2d65('0xe'))[_0x2d65('0xf')](socket);function respondWithRpcPromise(_0x2c71a6,_0x4d6ea0,_0x5ce741){return new BPromise(function(_0x2dc018,_0x52f94b){return client[_0x2d65('0x10')](_0x2c71a6,_0x5ce741)[_0x2d65('0x11')](function(_0x4f9439){logger['info'](_0x2d65('0x12'),_0x4d6ea0,'request\x20sent');logger[_0x2d65('0x13')](_0x2d65('0x14'),_0x4d6ea0,'request\x20sent',JSON[_0x2d65('0x15')](_0x4f9439));if(_0x4f9439[_0x2d65('0x16')]){if(_0x4f9439[_0x2d65('0x16')][_0x2d65('0x17')]===0x1f4){logger[_0x2d65('0x16')](_0x2d65('0x12'),_0x4d6ea0,_0x4f9439['error'][_0x2d65('0x18')]);return _0x52f94b(_0x4f9439['error']['message']);}logger['error'](_0x2d65('0x12'),_0x4d6ea0,_0x4f9439[_0x2d65('0x16')][_0x2d65('0x18')]);return _0x2dc018(_0x4f9439[_0x2d65('0x16')][_0x2d65('0x18')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x4d6ea0,_0x2d65('0x19'));_0x2dc018(_0x4f9439['result'][_0x2d65('0x18')]);}})[_0x2d65('0x1a')](function(_0x16544f){logger[_0x2d65('0x16')]('SmsMessage,\x20%s,\x20%s',_0x4d6ea0,_0x16544f);_0x52f94b(_0x16544f);});});}exports[_0x2d65('0x1b')]=function(_0x4bb85b){var _0x5e353d=this;return new Promise(function(_0x34e142,_0x212178){return db['SmsMessage'][_0x2d65('0x1c')](_0x4bb85b[_0x2d65('0x1d')],{'raw':_0x4bb85b[_0x2d65('0x1e')]?_0x4bb85b[_0x2d65('0x1e')][_0x2d65('0x1f')]===undefined?!![]:![]:!![]})[_0x2d65('0x11')](function(_0x45c6c0){logger[_0x2d65('0x20')](_0x2d65('0x1b'),_0x4bb85b);logger[_0x2d65('0x13')](_0x2d65('0x1b'),_0x4bb85b,JSON['stringify'](_0x45c6c0));_0x34e142(_0x45c6c0);})['catch'](function(_0x2c6ee9){logger[_0x2d65('0x16')](_0x2d65('0x1b'),_0x2c6ee9[_0x2d65('0x18')],_0x4bb85b);_0x212178(_0x5e353d[_0x2d65('0x16')](0x1f4,_0x2c6ee9['message']));});});}; \ No newline at end of file +var _0x8107=['http','redis','localhost','socket.io-emitter','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','create','options','CreateSmsMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x8107,0xce));var _0x7810=function(_0x4fcbec,_0x90e467){_0x4fcbec=_0x4fcbec-0x0;var _0x275177=_0x8107[_0x4fcbec];return _0x275177;};'use strict';var _=require(_0x7810('0x0'));var util=require(_0x7810('0x1'));var moment=require('moment');var BPromise=require(_0x7810('0x2'));var rs=require(_0x7810('0x3'));var fs=require('fs');var Redis=require(_0x7810('0x4'));var db=require(_0x7810('0x5'))['db'];var utils=require(_0x7810('0x6'));var logger=require('../../config/logger')(_0x7810('0x7'));var config=require(_0x7810('0x8'));var jayson=require(_0x7810('0x9'));var client=jayson[_0x7810('0xa')][_0x7810('0xb')]({'port':0x232a});config[_0x7810('0xc')]=_['defaults'](config[_0x7810('0xc')],{'host':_0x7810('0xd'),'port':0x18eb});var socket=require(_0x7810('0xe'))(new Redis(config[_0x7810('0xc')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4473e4,_0x73837f,_0x5bfb93){return new BPromise(function(_0x52da08,_0x468118){return client[_0x7810('0xf')](_0x4473e4,_0x5bfb93)[_0x7810('0x10')](function(_0x157d33){logger[_0x7810('0x11')](_0x7810('0x12'),_0x73837f,_0x7810('0x13'));logger[_0x7810('0x14')](_0x7810('0x15'),_0x73837f,_0x7810('0x13'),JSON['stringify'](_0x157d33));if(_0x157d33[_0x7810('0x16')]){if(_0x157d33[_0x7810('0x16')][_0x7810('0x17')]===0x1f4){logger[_0x7810('0x16')](_0x7810('0x12'),_0x73837f,_0x157d33[_0x7810('0x16')][_0x7810('0x18')]);return _0x468118(_0x157d33[_0x7810('0x16')][_0x7810('0x18')]);}logger[_0x7810('0x16')]('SmsMessage,\x20%s,\x20%s',_0x73837f,_0x157d33[_0x7810('0x16')]['message']);return _0x52da08(_0x157d33[_0x7810('0x16')][_0x7810('0x18')]);}else{logger[_0x7810('0x11')](_0x7810('0x12'),_0x73837f,_0x7810('0x13'));_0x52da08(_0x157d33[_0x7810('0x19')]['message']);}})[_0x7810('0x1a')](function(_0xc7d157){logger[_0x7810('0x16')](_0x7810('0x12'),_0x73837f,_0xc7d157);_0x468118(_0xc7d157);});});}exports['CreateSmsMessage']=function(_0x3b7104){var _0x146630=this;return new Promise(function(_0x5b35d3,_0xc8518d){return db[_0x7810('0x1b')][_0x7810('0x1c')](_0x3b7104['body'],{'raw':_0x3b7104[_0x7810('0x1d')]?_0x3b7104[_0x7810('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x7810('0x10')](function(_0x4a959c){logger[_0x7810('0x11')](_0x7810('0x1e'),_0x3b7104);logger[_0x7810('0x14')](_0x7810('0x1e'),_0x3b7104,JSON['stringify'](_0x4a959c));_0x5b35d3(_0x4a959c);})[_0x7810('0x1a')](function(_0x4535fb){logger['error']('CreateSmsMessage',_0x4535fb[_0x7810('0x18')],_0x3b7104);_0xc8518d(_0x146630[_0x7810('0x16')](0x1f4,_0x4535fb[_0x7810('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 3c49170..d813c91 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 _0xc54f=['./smsMessage.events','length','smsMessage:'];(function(_0x41738d,_0x436095){var _0x4a0c22=function(_0x118665){while(--_0x118665){_0x41738d['push'](_0x41738d['shift']());}};_0x4a0c22(++_0x436095);}(_0xc54f,0x108));var _0xfc54=function(_0x321292,_0x1e8697){_0x321292=_0x321292-0x0;var _0x47ded6=_0xc54f[_0x321292];return _0x47ded6;};'use strict';var SmsMessageEvents=require(_0xfc54('0x0'));var events=['save','remove','update'];function createListener(_0x2443d2,_0x33609b){return function(_0x1fb60f){_0x33609b['emit'](_0x2443d2,_0x1fb60f);};}function removeListener(_0x4b4346,_0x2bc714){return function(){SmsMessageEvents['removeListener'](_0x4b4346,_0x2bc714);};}exports['register']=function(_0x51587e){for(var _0x8408a1=0x0,_0x27d9fa=events[_0xfc54('0x1')];_0x8408a1<_0x27d9fa;_0x8408a1++){var _0x57a795=events[_0x8408a1];var _0x49afe1=createListener(_0xfc54('0x2')+_0x57a795,_0x51587e);SmsMessageEvents['on'](_0x57a795,_0x49afe1);}}; \ No newline at end of file +var _0x3bba=['length','smsMessage:','./smsMessage.events','save','update','emit','removeListener','register'];(function(_0x245c4f,_0x34b70f){var _0x3157a1=function(_0x18bfc7){while(--_0x18bfc7){_0x245c4f['push'](_0x245c4f['shift']());}};_0x3157a1(++_0x34b70f);}(_0x3bba,0x1d2));var _0xa3bb=function(_0x423f6e,_0x2d7a39){_0x423f6e=_0x423f6e-0x0;var _0x1a943e=_0x3bba[_0x423f6e];return _0x1a943e;};'use strict';var SmsMessageEvents=require(_0xa3bb('0x0'));var events=[_0xa3bb('0x1'),'remove',_0xa3bb('0x2')];function createListener(_0x18ba6a,_0x450304){return function(_0x1d1ace){_0x450304[_0xa3bb('0x3')](_0x18ba6a,_0x1d1ace);};}function removeListener(_0x240728,_0x1bccf5){return function(){SmsMessageEvents[_0xa3bb('0x4')](_0x240728,_0x1bccf5);};}exports[_0xa3bb('0x5')]=function(_0x320654){for(var _0x28e4b2=0x0,_0x3d5431=events[_0xa3bb('0x6')];_0x28e4b2<_0x3d5431;_0x28e4b2++){var _0x1a7876=events[_0x28e4b2];var _0x2e79bf=createListener(_0xa3bb('0x7')+_0x1a7876,_0x320654);SmsMessageEvents['on'](_0x1a7876,_0x2e79bf);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 4e40127..1b8d202 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 _0x2714=['getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','/:id','/:id/members','/:id/teams','getTeams','/:id/users'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x2714,0x155));var _0x4271=function(_0x1d66d5,_0xf9d343){_0x1d66d5=_0x1d66d5-0x0;var _0x55d82f=_0x2714[_0x1d66d5];return _0x55d82f;};'use strict';var multer=require(_0x4271('0x0'));var util=require(_0x4271('0x1'));var path=require(_0x4271('0x2'));var timeout=require(_0x4271('0x3'));var express=require(_0x4271('0x4'));var router=express[_0x4271('0x5')]();var fs_extra=require(_0x4271('0x6'));var auth=require(_0x4271('0x7'));var interaction=require(_0x4271('0x8'));var config=require(_0x4271('0x9'));var controller=require(_0x4271('0xa'));router[_0x4271('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4271('0xc'),auth[_0x4271('0xd')](),controller['describe']);router[_0x4271('0xb')](_0x4271('0xe'),auth[_0x4271('0xd')](),controller['show']);router['get'](_0x4271('0xf'),auth[_0x4271('0xd')](),controller['getMembers']);router['get'](_0x4271('0x10'),auth[_0x4271('0xd')](),controller[_0x4271('0x11')]);router[_0x4271('0xb')](_0x4271('0x12'),auth[_0x4271('0xd')](),controller[_0x4271('0x13')]);router[_0x4271('0x14')]('/',auth['isAuthenticated'](),controller[_0x4271('0x15')]);router[_0x4271('0x14')]('/:id/teams',auth[_0x4271('0xd')](),controller[_0x4271('0x16')]);router[_0x4271('0x14')]('/:id/users',auth[_0x4271('0xd')](),controller[_0x4271('0x17')]);router[_0x4271('0x18')](_0x4271('0xe'),auth[_0x4271('0xd')](),controller[_0x4271('0x19')]);router[_0x4271('0x1a')](_0x4271('0xe'),auth[_0x4271('0xd')](),controller[_0x4271('0x1b')]);router[_0x4271('0x1a')](_0x4271('0x10'),auth[_0x4271('0xd')](),controller['removeTeams']);router['delete'](_0x4271('0x12'),auth[_0x4271('0xd')](),controller[_0x4271('0x1c')]);module[_0x4271('0x1d')]=router; \ No newline at end of file +var _0x3819=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','path'];(function(_0x32c8e5,_0x175833){var _0x30cc52=function(_0x26d42b){while(--_0x26d42b){_0x32c8e5['push'](_0x32c8e5['shift']());}};_0x30cc52(++_0x175833);}(_0x3819,0x1b2));var _0x9381=function(_0x3ddf47,_0x4103a5){_0x3ddf47=_0x3ddf47-0x0;var _0x413175=_0x3819[_0x3ddf47];return _0x413175;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9381('0x0'));var timeout=require(_0x9381('0x1'));var express=require(_0x9381('0x2'));var router=express[_0x9381('0x3')]();var fs_extra=require(_0x9381('0x4'));var auth=require(_0x9381('0x5'));var interaction=require(_0x9381('0x6'));var config=require(_0x9381('0x7'));var controller=require('./smsQueue.controller');router[_0x9381('0x8')]('/',auth[_0x9381('0x9')](),controller[_0x9381('0xa')]);router[_0x9381('0x8')](_0x9381('0xb'),auth[_0x9381('0x9')](),controller['describe']);router[_0x9381('0x8')](_0x9381('0xc'),auth[_0x9381('0x9')](),controller['show']);router[_0x9381('0x8')](_0x9381('0xd'),auth[_0x9381('0x9')](),controller['getMembers']);router[_0x9381('0x8')](_0x9381('0xe'),auth[_0x9381('0x9')](),controller[_0x9381('0xf')]);router[_0x9381('0x8')](_0x9381('0x10'),auth[_0x9381('0x9')](),controller[_0x9381('0x11')]);router['post']('/',auth[_0x9381('0x9')](),controller[_0x9381('0x12')]);router[_0x9381('0x13')]('/:id/teams',auth[_0x9381('0x9')](),controller[_0x9381('0x14')]);router[_0x9381('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x9381('0x15')]);router[_0x9381('0x16')]('/:id',auth[_0x9381('0x9')](),controller[_0x9381('0x17')]);router[_0x9381('0x18')]('/:id',auth[_0x9381('0x9')](),controller[_0x9381('0x19')]);router['delete'](_0x9381('0xe'),auth['isAuthenticated'](),controller[_0x9381('0x1a')]);router[_0x9381('0x18')]('/:id/users',auth[_0x9381('0x9')](),controller[_0x9381('0x1b')]);module[_0x9381('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 13aa4db..4fa6883 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 _0xb683=['INTEGER','rrmemory','beepall','sequelize','STRING'];(function(_0x19f16a,_0x498777){var _0x2196e1=function(_0x241d53){while(--_0x241d53){_0x19f16a['push'](_0x19f16a['shift']());}};_0x2196e1(++_0x498777);}(_0xb683,0xc6));var _0x3b68=function(_0x30977b,_0x22be64){_0x30977b=_0x30977b-0x0;var _0x339a92=_0xb683[_0x30977b];return _0x339a92;};'use strict';var Sequelize=require(_0x3b68('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b68('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3b68('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3b68('0x3'),_0x3b68('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x65b0=['ENUM','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x65b0,0xdb));var _0x065b=function(_0x3fb3f1,_0x20e3f9){_0x3fb3f1=_0x3fb3f1-0x0;var _0x470fa0=_0x65b0[_0x3fb3f1];return _0x470fa0;};'use strict';var Sequelize=require(_0x065b('0x0'));module[_0x065b('0x1')]={'name':{'type':Sequelize[_0x065b('0x2')],'unique':_0x065b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x065b('0x2')]},'timeout':{'type':Sequelize[_0x065b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x065b('0x5')]('rrmemory','beepall',_0x065b('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 214b78e..665be78 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 _0x782e=['join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','value','isEmpty','removeAgents','emit','addAgents','omit','spread','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','rows','catch','show','params','SmsQueue','includeAll','include','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','format','%s/%s','SIP','smsPause','createdAt','updatedAt','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','team_has_sms_queues'];(function(_0x2d1cf5,_0x8212d4){var _0x3edb6e=function(_0x55854e){while(--_0x55854e){_0x2d1cf5['push'](_0x2d1cf5['shift']());}};_0x3edb6e(++_0x8212d4);}(_0x782e,0x1d4));var _0xe782=function(_0x4cc7db,_0x2047a5){_0x4cc7db=_0x4cc7db-0x0;var _0xde80fb=_0x782e[_0x4cc7db];return _0xde80fb;};'use strict';var emlformat=require(_0xe782('0x0'));var rimraf=require(_0xe782('0x1'));var zipdir=require(_0xe782('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe782('0x3'));var BPromise=require(_0xe782('0x4'));var Mustache=require(_0xe782('0x5'));var util=require(_0xe782('0x6'));var path=require(_0xe782('0x7'));var sox=require(_0xe782('0x8'));var csv=require(_0xe782('0x9'));var ejs=require(_0xe782('0xa'));var fs=require('fs');var fs_extra=require(_0xe782('0xb'));var _=require(_0xe782('0xc'));var squel=require(_0xe782('0xd'));var crypto=require(_0xe782('0xe'));var jsforce=require(_0xe782('0xf'));var deskjs=require(_0xe782('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe782('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe782('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe782('0x13'));var logger=require(_0xe782('0x14'))(_0xe782('0x15'));var utils=require(_0xe782('0x16'));var config=require(_0xe782('0x17'));var licenseUtil=require(_0xe782('0x18'));var db=require('../../mysqldb')['db'];config[_0xe782('0x19')]=_['defaults'](config[_0xe782('0x19')],{'host':_0xe782('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe782('0x19')]));require('./smsQueue.socket')[_0xe782('0x1b')](socket);function respondWithStatusCode(_0x3a3fe2,_0x1c6010){_0x1c6010=_0x1c6010||0xcc;return function(_0xa8d8c7){if(_0xa8d8c7){return _0x3a3fe2[_0xe782('0x1c')](_0x1c6010);}return _0x3a3fe2[_0xe782('0x1d')](_0x1c6010)[_0xe782('0x1e')]();};}function respondWithResult(_0x36b0ee,_0xd369ad){_0xd369ad=_0xd369ad||0xc8;return function(_0x30330d){if(_0x30330d){return _0x36b0ee[_0xe782('0x1d')](_0xd369ad)[_0xe782('0x1f')](_0x30330d);}};}function respondWithFilteredResult(_0xb9de4f,_0x508b4d){return function(_0xd0f314){if(_0xd0f314){var _0x3626b6=typeof _0x508b4d[_0xe782('0x20')]==='undefined'&&typeof _0x508b4d['limit']===_0xe782('0x21');var _0xf29563=_0xd0f314['count'];var _0x470423=_0x3626b6?0x0:_0x508b4d[_0xe782('0x20')];var _0x57f1a6=_0x3626b6?_0xd0f314['count']:_0x508b4d[_0xe782('0x20')]+_0x508b4d[_0xe782('0x22')];var _0x99eecf;if(_0x57f1a6>=_0xf29563){_0x57f1a6=_0xf29563;_0x99eecf=0xc8;}else{_0x99eecf=0xce;}_0xb9de4f['status'](_0x99eecf);return _0xb9de4f[_0xe782('0x23')](_0xe782('0x24'),_0x470423+'-'+_0x57f1a6+'/'+_0xf29563)[_0xe782('0x1f')](_0xd0f314);}return null;};}function patchUpdates(_0x9a2005){return function(_0x1f2bf5){try{jsonpatch[_0xe782('0x25')](_0x1f2bf5,_0x9a2005,!![]);}catch(_0x77a98c){return BPromise[_0xe782('0x26')](_0x77a98c);}return _0x1f2bf5[_0xe782('0x27')]();};}function saveUpdates(_0x5f20e4,_0x52b4df){return function(_0x2423be){if(_0x2423be){return _0x2423be[_0xe782('0x28')](_0x5f20e4)[_0xe782('0x29')](function(_0x194030){return _0x194030;});}return null;};}function removeEntity(_0x34d55c,_0x2521da){return function(_0x4deb87){if(_0x4deb87){return _0x4deb87['destroy']()[_0xe782('0x29')](function(){var _0xc58cc3=_0x4deb87[_0xe782('0x2a')]({'plain':!![]});var _0x291384=_0xe782('0x2b');return db[_0xe782('0x2c')]['destroy']({'where':{'type':_0x291384,'resourceId':_0xc58cc3['id']}})['then'](function(){return _0x4deb87;});})[_0xe782('0x29')](function(){_0x34d55c[_0xe782('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c7157,_0xb392e9){return function(_0xc02bf2){if(!_0xc02bf2){_0x4c7157['sendStatus'](0x194);}return _0xc02bf2;};}function handleError(_0x14076c,_0x3198bc){_0x3198bc=_0x3198bc||0x1f4;return function(_0x51514d){logger[_0xe782('0x2d')](_0x51514d[_0xe782('0x2e')]);if(_0x51514d[_0xe782('0x2f')]){delete _0x51514d[_0xe782('0x2f')];}_0x14076c[_0xe782('0x1d')](_0x3198bc)[_0xe782('0x30')](_0x51514d);};}exports[_0xe782('0x31')]=function(_0x3fcd13,_0x29bfe9){var _0x11a757={},_0x3b92e6={},_0x394701={'count':0x0,'rows':[]};var _0x3910d9=_[_0xe782('0x32')](db['SmsQueue'][_0xe782('0x33')],function(_0x2f0c15){return{'name':_0x2f0c15[_0xe782('0x34')],'type':_0x2f0c15[_0xe782('0x35')]['key']};});_0x3b92e6[_0xe782('0x36')]=_[_0xe782('0x32')](_0x3910d9,_0xe782('0x2f'));_0x3b92e6['query']=_[_0xe782('0x37')](_0x3fcd13[_0xe782('0x38')]);_0x3b92e6[_0xe782('0x39')]=_[_0xe782('0x3a')](_0x3b92e6['model'],_0x3b92e6[_0xe782('0x38')]);_0x11a757[_0xe782('0x3b')]=_[_0xe782('0x3a')](_0x3b92e6['model'],qs[_0xe782('0x3c')](_0x3fcd13[_0xe782('0x38')]['fields']));_0x11a757['attributes']=_0x11a757[_0xe782('0x3b')][_0xe782('0x3d')]?_0x11a757['attributes']:_0x3b92e6[_0xe782('0x36')];if(!_0x3fcd13[_0xe782('0x38')]['hasOwnProperty'](_0xe782('0x3e'))){_0x11a757[_0xe782('0x22')]=qs[_0xe782('0x22')](_0x3fcd13[_0xe782('0x38')]['limit']);_0x11a757[_0xe782('0x20')]=qs[_0xe782('0x20')](_0x3fcd13[_0xe782('0x38')][_0xe782('0x20')]);}_0x11a757[_0xe782('0x3f')]=qs[_0xe782('0x40')](_0x3fcd13['query'][_0xe782('0x40')]);_0x11a757[_0xe782('0x41')]=qs[_0xe782('0x39')](_[_0xe782('0x42')](_0x3fcd13[_0xe782('0x38')],_0x3b92e6[_0xe782('0x39')]),_0x3910d9);if(_0x3fcd13['query'][_0xe782('0x43')]){_0x11a757['where']=_[_0xe782('0x44')](_0x11a757['where'],{'$or':_['map'](_0x3910d9,function(_0x13288f){if(_0x13288f[_0xe782('0x35')]!==_0xe782('0x45')){var _0x2c13c4={};_0x2c13c4[_0x13288f[_0xe782('0x2f')]]={'$like':'%'+_0x3fcd13[_0xe782('0x38')][_0xe782('0x43')]+'%'};return _0x2c13c4;}})});}_0x11a757=_[_0xe782('0x44')]({},_0x11a757,_0x3fcd13['options']);var _0x56019d={'where':_0x11a757[_0xe782('0x41')]};return db['SmsQueue'][_0xe782('0x46')](_0x56019d)[_0xe782('0x29')](function(_0x1bba1a){_0x394701[_0xe782('0x46')]=_0x1bba1a;if(_0x3fcd13[_0xe782('0x38')]['includeAll']){_0x11a757['include']=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x11a757);})[_0xe782('0x29')](function(_0x33f000){_0x394701[_0xe782('0x47')]=_0x33f000;return _0x394701;})[_0xe782('0x29')](respondWithFilteredResult(_0x29bfe9,_0x11a757))[_0xe782('0x48')](handleError(_0x29bfe9,null));};exports[_0xe782('0x49')]=function(_0x26c9e7,_0x497a3c){var _0x2e44f5={'raw':!![],'where':{'id':_0x26c9e7[_0xe782('0x4a')]['id']}},_0x5cc5fb={};_0x5cc5fb[_0xe782('0x36')]=_[_0xe782('0x37')](db[_0xe782('0x4b')][_0xe782('0x33')]);_0x5cc5fb['query']=_[_0xe782('0x37')](_0x26c9e7[_0xe782('0x38')]);_0x5cc5fb[_0xe782('0x39')]=_[_0xe782('0x3a')](_0x5cc5fb['model'],_0x5cc5fb['query']);_0x2e44f5[_0xe782('0x3b')]=_['intersection'](_0x5cc5fb['model'],qs[_0xe782('0x3c')](_0x26c9e7[_0xe782('0x38')][_0xe782('0x3c')]));_0x2e44f5[_0xe782('0x3b')]=_0x2e44f5['attributes'][_0xe782('0x3d')]?_0x2e44f5['attributes']:_0x5cc5fb[_0xe782('0x36')];if(_0x26c9e7['query'][_0xe782('0x4c')]){_0x2e44f5[_0xe782('0x4d')]=[{'all':!![]}];}_0x2e44f5=_[_0xe782('0x44')]({},_0x2e44f5,_0x26c9e7[_0xe782('0x4e')]);return db['SmsQueue'][_0xe782('0x4f')](_0x2e44f5)[_0xe782('0x29')](handleEntityNotFound(_0x497a3c,null))[_0xe782('0x29')](respondWithResult(_0x497a3c,null))[_0xe782('0x48')](handleError(_0x497a3c,null));};exports['create']=function(_0x1deebb,_0x5d2dcf){return db['SmsQueue']['create'](_0x1deebb['body'],{})[_0xe782('0x29')](function(_0x446969){var _0xa72123=_0x1deebb[_0xe782('0x50')]['get']({'plain':!![]});if(!_0xa72123)throw new Error(_0xe782('0x51'));if(_0xa72123[_0xe782('0x52')]==='user'){var _0x8bd9ac=_0x446969[_0xe782('0x2a')]({'plain':!![]});var _0x1710c8=_0xe782('0x2b');return db[_0xe782('0x53')]['find']({'where':{'name':_0x1710c8,'userProfileId':_0xa72123[_0xe782('0x54')]},'raw':!![]})['then'](function(_0x278f0f){if(_0x278f0f&&_0x278f0f[_0xe782('0x55')]===0x0){return db[_0xe782('0x2c')][_0xe782('0x56')]({'name':_0x8bd9ac[_0xe782('0x2f')],'resourceId':_0x8bd9ac['id'],'type':_0x278f0f['name'],'sectionId':_0x278f0f['id']},{})['then'](function(){return _0x446969;});}else{return _0x446969;}})['catch'](function(_0x1c47a7){logger[_0xe782('0x2d')](_0xe782('0x57'),_0x1c47a7);throw _0x1c47a7;});}return _0x446969;})[_0xe782('0x29')](respondWithResult(_0x5d2dcf,0xc9))[_0xe782('0x48')](handleError(_0x5d2dcf,null));};exports['update']=function(_0x2bc8c0,_0x471d3f){if(_0x2bc8c0[_0xe782('0x58')]['id']){delete _0x2bc8c0[_0xe782('0x58')]['id'];}return db[_0xe782('0x4b')][_0xe782('0x4f')]({'where':{'id':_0x2bc8c0['params']['id']}})['then'](handleEntityNotFound(_0x471d3f,null))[_0xe782('0x29')](saveUpdates(_0x2bc8c0[_0xe782('0x58')],null))[_0xe782('0x29')](respondWithResult(_0x471d3f,null))['catch'](handleError(_0x471d3f,null));};exports[_0xe782('0x59')]=function(_0x3f30a2,_0x2fb288){return db[_0xe782('0x4b')]['find']({'where':{'id':_0x3f30a2['params']['id']}})[_0xe782('0x29')](handleEntityNotFound(_0x2fb288,null))[_0xe782('0x29')](removeEntity(_0x2fb288,null))[_0xe782('0x48')](handleError(_0x2fb288,null));};exports[_0xe782('0x5a')]=function(_0x2937b2,_0x2aa894){return db[_0xe782('0x4b')]['describe']()[_0xe782('0x29')](respondWithResult(_0x2aa894,null))[_0xe782('0x48')](handleError(_0x2aa894,null));};exports[_0xe782('0x5b')]=function(_0x1cff76,_0x26eb45,_0x4e1f2e){var _0x20fa61={'raw':!![],'where':{}},_0x18b8e8={},_0x3dcee2;return db[_0xe782('0x4b')][_0xe782('0x5c')]({'where':{'id':_0x1cff76['params']['id']}})[_0xe782('0x29')](handleEntityNotFound(_0x26eb45,null))[_0xe782('0x29')](function(_0x961164){if(_0x961164){_0x3dcee2=_0x961164[_0xe782('0x2a')]({'plain':!![]});_0x18b8e8[_0xe782('0x36')]=_['keys'](db[_0xe782('0x5d')][_0xe782('0x33')]);_0x18b8e8[_0xe782('0x38')]=_[_0xe782('0x37')](_0x1cff76[_0xe782('0x38')]);_0x18b8e8['filters']=_[_0xe782('0x3a')](_0x18b8e8['model'],_0x18b8e8[_0xe782('0x38')]);_0x20fa61[_0xe782('0x3b')]=_['intersection'](_0x18b8e8[_0xe782('0x36')],qs[_0xe782('0x3c')](_0x1cff76[_0xe782('0x38')]['fields']));_0x20fa61[_0xe782('0x3b')]=_0x20fa61['attributes']['length']?_0x20fa61['attributes']:_0x18b8e8['model'];if(!_0x1cff76['query'][_0xe782('0x5e')](_0xe782('0x3e'))){_0x20fa61[_0xe782('0x22')]=qs[_0xe782('0x22')](_0x1cff76[_0xe782('0x38')][_0xe782('0x22')]);_0x20fa61[_0xe782('0x20')]=qs['offset'](_0x1cff76[_0xe782('0x38')][_0xe782('0x20')]);}_0x20fa61['order']=qs[_0xe782('0x40')](_0x1cff76[_0xe782('0x38')][_0xe782('0x40')]);_0x20fa61[_0xe782('0x41')]=qs[_0xe782('0x39')](_['pick'](_0x1cff76[_0xe782('0x38')],_0x18b8e8[_0xe782('0x39')]));_0x20fa61[_0xe782('0x41')][_0xe782('0x5f')]=_0x961164['id'];if(_0x1cff76[_0xe782('0x38')][_0xe782('0x43')]){_0x20fa61['where']=_[_0xe782('0x44')](_0x20fa61[_0xe782('0x41')],{'$or':_['map'](_0x20fa61[_0xe782('0x3b')],function(_0x514bbb){var _0xee9e1b={};_0xee9e1b[_0x514bbb]={'$like':'%'+_0x1cff76[_0xe782('0x38')][_0xe782('0x43')]+'%'};return _0xee9e1b;})});}_0x20fa61=_['merge']({},_0x20fa61,_0x1cff76['options']);return db[_0xe782('0x5d')][_0xe782('0x60')](_0x20fa61);}})[_0xe782('0x29')](function(_0x393329){if(_0x393329){return db[_0xe782('0x61')][_0xe782('0x62')]({'where':{'id':_[_0xe782('0x32')](_0x393329,_0xe782('0x63')),'role':_0xe782('0x64')},'attributes':['id',_0xe782('0x2f'),'smsPause','updatedAt','createdAt']});}})[_0xe782('0x29')](function(_0x1f8fd8){if(_0x1f8fd8){return{'count':_0x1f8fd8['count'],'rows':_[_0xe782('0x32')](_0x1f8fd8[_0xe782('0x47')],function(_0x5b0d33){return{'membername':_0x5b0d33['name'],'UserId':_0x5b0d33['id'],'queue_name':_0x3dcee2[_0xe782('0x2f')],'SmsQueueId':_0x3dcee2['id'],'interface':util[_0xe782('0x65')](_0xe782('0x66'),_0xe782('0x67'),_0x5b0d33['name']),'penalty':0x0,'paused':_0x5b0d33[_0xe782('0x68')],'createdAt':_0x5b0d33[_0xe782('0x69')],'updatedAt':_0x5b0d33[_0xe782('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe782('0x29')](respondWithFilteredResult(_0x26eb45,_0x20fa61))[_0xe782('0x48')](handleError(_0x26eb45,null));};exports['getTeams']=function(_0x881a4d,_0xf9fcd3,_0x200628){var _0x15067d={};var _0x596b58={};var _0x420e4a;var _0x24864e;return db['SmsQueue'][_0xe782('0x5c')]({'where':{'id':_0x881a4d[_0xe782('0x4a')]['id']}})[_0xe782('0x29')](handleEntityNotFound(_0xf9fcd3,null))[_0xe782('0x29')](function(_0x24cd54){if(_0x24cd54){_0x420e4a=_0x24cd54;_0x596b58[_0xe782('0x36')]=_['keys'](db[_0xe782('0x6b')]['rawAttributes']);_0x596b58[_0xe782('0x38')]=_[_0xe782('0x37')](_0x881a4d[_0xe782('0x38')]);_0x596b58[_0xe782('0x39')]=_['intersection'](_0x596b58['model'],_0x596b58[_0xe782('0x38')]);_0x15067d[_0xe782('0x3b')]=_[_0xe782('0x3a')](_0x596b58[_0xe782('0x36')],qs[_0xe782('0x3c')](_0x881a4d[_0xe782('0x38')][_0xe782('0x3c')]));_0x15067d[_0xe782('0x3b')]=_0x15067d['attributes'][_0xe782('0x3d')]?_0x15067d['attributes']:_0x596b58['model'];_0x15067d['order']=qs[_0xe782('0x40')](_0x881a4d['query'][_0xe782('0x40')]);_0x15067d[_0xe782('0x41')]=qs[_0xe782('0x39')](_[_0xe782('0x42')](_0x881a4d[_0xe782('0x38')],_0x596b58['filters']));if(_0x881a4d[_0xe782('0x38')][_0xe782('0x43')]){_0x15067d[_0xe782('0x41')]=_[_0xe782('0x44')](_0x15067d[_0xe782('0x41')],{'$or':_[_0xe782('0x32')](_0x15067d['attributes'],function(_0x444a66){var _0x521d4b={};_0x521d4b[_0x444a66]={'$like':'%'+_0x881a4d['query'][_0xe782('0x43')]+'%'};return _0x521d4b;})});}_0x15067d=_[_0xe782('0x44')]({},_0x15067d,_0x881a4d['options']);return _0x420e4a['getTeams'](_0x15067d);}})[_0xe782('0x29')](function(_0x3d79e1){if(_0x3d79e1){_0x24864e=_0x3d79e1['length'];if(!_0x881a4d[_0xe782('0x38')][_0xe782('0x5e')](_0xe782('0x3e'))){_0x15067d['limit']=qs[_0xe782('0x22')](_0x881a4d[_0xe782('0x38')][_0xe782('0x22')]);_0x15067d[_0xe782('0x20')]=qs['offset'](_0x881a4d[_0xe782('0x38')][_0xe782('0x20')]);}return _0x420e4a['getTeams'](_0x15067d);}})['then'](function(_0x603b21){if(_0x603b21){return _0x603b21?{'count':_0x24864e,'rows':_0x603b21}:null;}})[_0xe782('0x29')](respondWithResult(_0xf9fcd3,null))[_0xe782('0x48')](handleError(_0xf9fcd3,null));};exports[_0xe782('0x6c')]=function(_0xd84778,_0x2035fa,_0x25666b){var _0x51b6e9=_0xd84778[_0xe782('0x58')][_0xe782('0x6d')];return db[_0xe782('0x6b')][_0xe782('0x60')]({'where':{'id':_0x51b6e9},'attributes':['id'],'include':[{'model':db[_0xe782('0x61')],'as':_0xe782('0x6e'),'attributes':['id',_0xe782('0x2f'),_0xe782('0x6f'),_0xe782('0x70'),_0xe782('0x71')],'raw':!![]}]})[_0xe782('0x29')](function(_0x18a14f){if(_0x18a14f){var _0x801ac7=_[_0xe782('0x72')](_0x18a14f,function(_0x53c890){var _0x45e584=_0x53c890[_0xe782('0x2a')]({'plain':!![]});return _0x45e584['Agents'];});return db['SmsQueue'][_0xe782('0x4f')]({'where':{'id':_0xd84778['params']['id']}})[_0xe782('0x29')](function(_0x1c85d7){return db['sequelize'][_0xe782('0x73')](function(_0x5181c7){return _0x1c85d7[_0xe782('0x6c')](_0x51b6e9,{'transaction':_0x5181c7})['then'](function(){return BPromise[_0xe782('0x74')](_0x801ac7,function(_0x569a98){return db[_0xe782('0x5d')][_0xe782('0x75')]({'where':{'UserId':_0x569a98['id'],'SmsQueueId':_0xd84778[_0xe782('0x4a')]['id']},'transaction':_0x5181c7});});})['then'](function(){_0x801ac7[_0xe782('0x76')](function(_0x313788){socket['emit']('userSmsQueue:save',{'UserId':_0x313788['id'],'SmsQueueId':_0x1c85d7['id']});});});});});}})[_0xe782('0x29')](respondWithStatusCode(_0x2035fa,null))[_0xe782('0x48')](handleError(_0x2035fa,null));};exports[_0xe782('0x77')]=function(_0x181a01,_0xc7226c,_0x1c10e5){return db[_0xe782('0x6b')][_0xe782('0x60')]({'where':{'id':_0x181a01[_0xe782('0x38')][_0xe782('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xe782('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe782('0x29')](handleEntityNotFound(_0xc7226c,null))['then'](function(_0x355437){var _0x5bfa9b=_[_0xe782('0x32')](_0x355437,'id');var _0x372a17=[];var _0x5d4e61=[];var _0x61d222=squel[_0xe782('0x78')]();_0x61d222[_0xe782('0x79')](_0xe782('0x7a'))['from'](_0xe782('0x7b'),'tq')[_0xe782('0x7c')]('user_has_teams','ut',_0xe782('0x7d'))[_0xe782('0x41')]('SmsQueueId\x20=\x20?',_0x181a01[_0xe782('0x4a')]['id']);for(var _0x183153=0x0;_0x183153<_0x355437[_0xe782('0x3d')];_0x183153+=0x1){let _0x4fbbdb=_0x355437[_0x183153];for(var _0x3efc09=0x0;_0x3efc09<_0x4fbbdb[_0xe782('0x6e')][_0xe782('0x3d')];_0x3efc09+=0x1){let _0x193328=_0x4fbbdb[_0xe782('0x6e')][_0x3efc09];var _0x3c36b4=_0x61d222[_0xe782('0x7e')]();_0x3c36b4['where'](_0xe782('0x7f'),_0x193328['id']);_0x5d4e61[_0xe782('0x80')](db[_0xe782('0x81')][_0xe782('0x38')](_0x3c36b4[_0xe782('0x82')](),{'type':db[_0xe782('0x81')][_0xe782('0x83')][_0xe782('0x84')]})[_0xe782('0x29')](function(_0x3fc6df){if(_0x3fc6df['length']===0x1){return _0x193328['id'];}else{var _0xbf7343=_[_0xe782('0x85')](_[_0xe782('0x32')](_0x3fc6df,'TeamId'),function(_0x48b2d3){return _[_0xe782('0x86')](_0x5bfa9b,_0x48b2d3);});if(_0xbf7343){return _0x193328['id'];}}}));}}return BPromise[_0xe782('0x87')](_0x5d4e61)[_0xe782('0x29')](function(_0x1280fb){_0x372a17=_(_0x372a17)[_0xe782('0x88')](_0x1280fb)['compact']()[_0xe782('0x89')]();return db['SmsQueue']['find']({'where':{'id':_0x181a01[_0xe782('0x4a')]['id']}})['then'](function(_0x21b436){return db[_0xe782('0x81')][_0xe782('0x73')](function(_0x139951){return _0x21b436[_0xe782('0x77')](_0x181a01[_0xe782('0x38')]['ids'],{'transaction':_0x139951})['then'](function(){if(!_[_0xe782('0x8a')](_0x372a17)){return _0x21b436[_0xe782('0x8b')](_0x372a17,{'transaction':_0x139951});}})[_0xe782('0x29')](function(){_0x372a17[_0xe782('0x76')](function(_0x970711){socket[_0xe782('0x8c')]('userSmsQueue:remove',{'UserId':_0x970711,'SmsQueueId':_0x21b436['id']});});});});});});})['then'](respondWithStatusCode(_0xc7226c,null))['catch'](handleError(_0xc7226c,null));};exports[_0xe782('0x8d')]=function(_0x1b9676,_0x5236bc,_0x30cb92){return db[_0xe782('0x4b')][_0xe782('0x4f')]({'where':{'id':_0x1b9676[_0xe782('0x4a')]['id']}})[_0xe782('0x29')](handleEntityNotFound(_0x5236bc,null))[_0xe782('0x29')](function(_0x3100dd){if(_0x3100dd){return _0x3100dd[_0xe782('0x8d')](_0x1b9676[_0xe782('0x58')][_0xe782('0x6d')],_[_0xe782('0x8e')](_0x1b9676['body'],[_0xe782('0x6d'),'id'])||{})[_0xe782('0x8f')](function(_0x3462d2){for(var _0x4115e4=0x0;_0x4115e4<_0x1b9676[_0xe782('0x58')]['ids'][_0xe782('0x3d')];_0x4115e4+=0x1){socket[_0xe782('0x8c')](_0xe782('0x90'),{'UserId':Number(_0x1b9676[_0xe782('0x58')]['ids'][_0x4115e4]),'SmsQueueId':Number(_0x1b9676[_0xe782('0x4a')]['id'])});}return _0x3462d2;});}})[_0xe782('0x29')](respondWithResult(_0x5236bc,null))['catch'](handleError(_0x5236bc,null));};exports['removeAgents']=function(_0x501c1c,_0x4353c2,_0x4b167d){return db[_0xe782('0x4b')][_0xe782('0x4f')]({'where':{'id':_0x501c1c[_0xe782('0x4a')]['id']}})[_0xe782('0x29')](handleEntityNotFound(_0x4353c2,null))[_0xe782('0x29')](function(_0x2b7f88){if(_0x2b7f88){return _0x2b7f88[_0xe782('0x8b')](_0x501c1c[_0xe782('0x38')][_0xe782('0x6d')])['then'](function(){if(_[_0xe782('0x91')](_0x501c1c['query'][_0xe782('0x6d')])){for(var _0x1b2e41=0x0;_0x1b2e41<_0x501c1c[_0xe782('0x38')]['ids'][_0xe782('0x3d')];_0x1b2e41+=0x1){socket[_0xe782('0x8c')](_0xe782('0x92'),{'UserId':Number(_0x501c1c[_0xe782('0x38')][_0xe782('0x6d')][_0x1b2e41]),'SmsQueueId':Number(_0x501c1c[_0xe782('0x4a')]['id'])});}}else{socket[_0xe782('0x8c')](_0xe782('0x92'),{'UserId':Number(_0x501c1c[_0xe782('0x38')]['ids']),'SmsQueueId':Number(_0x501c1c[_0xe782('0x4a')]['id'])});}});}})[_0xe782('0x29')](respondWithStatusCode(_0x4353c2,null))['catch'](handleError(_0x4353c2,null));};exports[_0xe782('0x93')]=function(_0x341fb6,_0x240c03,_0x317767){var _0x5e1b06={};var _0x1a187a={};var _0x35eb78;var _0x7d1cf3;return db[_0xe782('0x4b')][_0xe782('0x5c')]({'where':{'id':_0x341fb6[_0xe782('0x4a')]['id']}})['then'](handleEntityNotFound(_0x240c03,null))[_0xe782('0x29')](function(_0x362a3a){if(_0x362a3a){_0x35eb78=_0x362a3a;_0x1a187a[_0xe782('0x36')]=_[_0xe782('0x37')](db[_0xe782('0x61')]['rawAttributes']);_0x1a187a[_0xe782('0x38')]=_[_0xe782('0x37')](_0x341fb6['query']);_0x1a187a[_0xe782('0x39')]=_[_0xe782('0x3a')](_0x1a187a[_0xe782('0x36')],_0x1a187a['query']);_0x5e1b06['attributes']=_['intersection'](_0x1a187a[_0xe782('0x36')],qs[_0xe782('0x3c')](_0x341fb6[_0xe782('0x38')][_0xe782('0x3c')]));_0x5e1b06[_0xe782('0x3b')]=_0x5e1b06[_0xe782('0x3b')][_0xe782('0x3d')]?_0x5e1b06[_0xe782('0x3b')]:_0x1a187a[_0xe782('0x36')];_0x5e1b06['order']=qs[_0xe782('0x40')](_0x341fb6[_0xe782('0x38')][_0xe782('0x40')]);_0x5e1b06[_0xe782('0x41')]=qs['filters'](_[_0xe782('0x42')](_0x341fb6[_0xe782('0x38')],_0x1a187a[_0xe782('0x39')]));if(_0x341fb6[_0xe782('0x38')][_0xe782('0x43')]){_0x5e1b06[_0xe782('0x41')]=_[_0xe782('0x44')](_0x5e1b06[_0xe782('0x41')],{'$or':_[_0xe782('0x32')](_0x5e1b06['attributes'],function(_0x316634){var _0x4cc4a5={};_0x4cc4a5[_0x316634]={'$like':'%'+_0x341fb6[_0xe782('0x38')][_0xe782('0x43')]+'%'};return _0x4cc4a5;})});}_0x5e1b06=_[_0xe782('0x44')]({},_0x5e1b06,_0x341fb6[_0xe782('0x4e')]);return _0x35eb78[_0xe782('0x93')](_0x5e1b06);}})['then'](function(_0x168d36){if(_0x168d36){_0x7d1cf3=_0x168d36[_0xe782('0x3d')];if(!_0x341fb6[_0xe782('0x38')][_0xe782('0x5e')]('nolimit')){_0x5e1b06[_0xe782('0x22')]=qs['limit'](_0x341fb6[_0xe782('0x38')][_0xe782('0x22')]);_0x5e1b06[_0xe782('0x20')]=qs[_0xe782('0x20')](_0x341fb6[_0xe782('0x38')][_0xe782('0x20')]);}return _0x35eb78['getAgents'](_0x5e1b06);}})[_0xe782('0x29')](function(_0x398221){if(_0x398221){return _0x398221?{'count':_0x7d1cf3,'rows':_0x398221}:null;}})['then'](respondWithResult(_0x240c03,null))[_0xe782('0x48')](handleError(_0x240c03,null));}; \ No newline at end of file +var _0x1fed=['role','SmsQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserSmsQueue','User','findAndCountAll','UserId','agent','updatedAt','format','SIP','smsPause','createdAt','getTeams','pick','ids','Team','Agents','voicePause','transaction','addTeams','findOrCreate','emit','userSmsQueue:save','removeTeams','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','forEach','userSmsQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','get','error','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','SmsQueue','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user'];(function(_0x2c2185,_0x5a71cb){var _0x13e08e=function(_0x2be52c){while(--_0x2be52c){_0x2c2185['push'](_0x2c2185['shift']());}};_0x13e08e(++_0x5a71cb);}(_0x1fed,0x1d3));var _0xd1fe=function(_0x3bfe11,_0x573678){_0x3bfe11=_0x3bfe11-0x0;var _0x19f6b2=_0x1fed[_0x3bfe11];return _0x19f6b2;};'use strict';var emlformat=require(_0xd1fe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1fe('0x1'));var jsonpatch=require(_0xd1fe('0x2'));var rp=require(_0xd1fe('0x3'));var moment=require(_0xd1fe('0x4'));var BPromise=require(_0xd1fe('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1fe('0x6'));var sox=require('sox');var csv=require(_0xd1fe('0x7'));var ejs=require(_0xd1fe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd1fe('0x9'));var deskjs=require(_0xd1fe('0xa'));var toCsv=require(_0xd1fe('0x7'));var querystring=require(_0xd1fe('0xb'));var Papa=require(_0xd1fe('0xc'));var Redis=require('ioredis');var authService=require(_0xd1fe('0xd'));var qs=require(_0xd1fe('0xe'));var as=require(_0xd1fe('0xf'));var hardwareService=require(_0xd1fe('0x10'));var logger=require(_0xd1fe('0x11'))('api');var utils=require(_0xd1fe('0x12'));var config=require(_0xd1fe('0x13'));var licenseUtil=require(_0xd1fe('0x14'));var db=require(_0xd1fe('0x15'))['db'];config[_0xd1fe('0x16')]=_['defaults'](config[_0xd1fe('0x16')],{'host':_0xd1fe('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd1fe('0x16')]));require('./smsQueue.socket')[_0xd1fe('0x18')](socket);function respondWithStatusCode(_0x2f0796,_0x37c88e){_0x37c88e=_0x37c88e||0xcc;return function(_0x27b268){if(_0x27b268){return _0x2f0796[_0xd1fe('0x19')](_0x37c88e);}return _0x2f0796['status'](_0x37c88e)[_0xd1fe('0x1a')]();};}function respondWithResult(_0x3036cc,_0x510b53){_0x510b53=_0x510b53||0xc8;return function(_0x5e862a){if(_0x5e862a){return _0x3036cc[_0xd1fe('0x1b')](_0x510b53)['json'](_0x5e862a);}};}function respondWithFilteredResult(_0x2f44a1,_0x1b1116){return function(_0x22ae0b){if(_0x22ae0b){var _0x1e6be2=typeof _0x1b1116[_0xd1fe('0x1c')]===_0xd1fe('0x1d')&&typeof _0x1b1116[_0xd1fe('0x1e')]===_0xd1fe('0x1d');var _0x5ce356=_0x22ae0b['count'];var _0x4fc2f9=_0x1e6be2?0x0:_0x1b1116[_0xd1fe('0x1c')];var _0x2e0907=_0x1e6be2?_0x22ae0b[_0xd1fe('0x1f')]:_0x1b1116[_0xd1fe('0x1c')]+_0x1b1116[_0xd1fe('0x1e')];var _0x415352;if(_0x2e0907>=_0x5ce356){_0x2e0907=_0x5ce356;_0x415352=0xc8;}else{_0x415352=0xce;}_0x2f44a1[_0xd1fe('0x1b')](_0x415352);return _0x2f44a1[_0xd1fe('0x20')](_0xd1fe('0x21'),_0x4fc2f9+'-'+_0x2e0907+'/'+_0x5ce356)[_0xd1fe('0x22')](_0x22ae0b);}return null;};}function patchUpdates(_0x4ac933){return function(_0xc1d101){try{jsonpatch['apply'](_0xc1d101,_0x4ac933,!![]);}catch(_0x5cd548){return BPromise[_0xd1fe('0x23')](_0x5cd548);}return _0xc1d101[_0xd1fe('0x24')]();};}function saveUpdates(_0x109c4d,_0x297ba6){return function(_0x412a0b){if(_0x412a0b){return _0x412a0b['update'](_0x109c4d)['then'](function(_0xb57e72){return _0xb57e72;});}return null;};}function removeEntity(_0xe77dfa,_0x4a2c8f){return function(_0x2d7ab5){if(_0x2d7ab5){return _0x2d7ab5[_0xd1fe('0x25')]()[_0xd1fe('0x26')](function(){var _0x5c5782=_0x2d7ab5[_0xd1fe('0x27')]({'plain':!![]});var _0x2b4d98='SmsQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x2b4d98,'resourceId':_0x5c5782['id']}})['then'](function(){return _0x2d7ab5;});})[_0xd1fe('0x26')](function(){_0xe77dfa[_0xd1fe('0x1b')](0xcc)[_0xd1fe('0x1a')]();});}};}function handleEntityNotFound(_0x56510c,_0x4f366d){return function(_0x577a30){if(!_0x577a30){_0x56510c[_0xd1fe('0x19')](0x194);}return _0x577a30;};}function handleError(_0x57e02e,_0x2f1789){_0x2f1789=_0x2f1789||0x1f4;return function(_0x526caa){logger[_0xd1fe('0x28')](_0x526caa[_0xd1fe('0x29')]);if(_0x526caa[_0xd1fe('0x2a')]){delete _0x526caa[_0xd1fe('0x2a')];}_0x57e02e[_0xd1fe('0x1b')](_0x2f1789)[_0xd1fe('0x2b')](_0x526caa);};}exports[_0xd1fe('0x2c')]=function(_0x30972a,_0x5ebcd2){var _0x2390f0={},_0x34a558={},_0xf2cc8={'count':0x0,'rows':[]};var _0x39f588=_[_0xd1fe('0x2d')](db['SmsQueue']['rawAttributes'],function(_0xe7715d){return{'name':_0xe7715d[_0xd1fe('0x2e')],'type':_0xe7715d[_0xd1fe('0x2f')]['key']};});_0x34a558[_0xd1fe('0x30')]=_['map'](_0x39f588,'name');_0x34a558[_0xd1fe('0x31')]=_[_0xd1fe('0x32')](_0x30972a['query']);_0x34a558['filters']=_[_0xd1fe('0x33')](_0x34a558['model'],_0x34a558['query']);_0x2390f0['attributes']=_[_0xd1fe('0x33')](_0x34a558[_0xd1fe('0x30')],qs[_0xd1fe('0x34')](_0x30972a['query'][_0xd1fe('0x34')]));_0x2390f0[_0xd1fe('0x35')]=_0x2390f0[_0xd1fe('0x35')][_0xd1fe('0x36')]?_0x2390f0[_0xd1fe('0x35')]:_0x34a558[_0xd1fe('0x30')];if(!_0x30972a['query'][_0xd1fe('0x37')](_0xd1fe('0x38'))){_0x2390f0['limit']=qs['limit'](_0x30972a[_0xd1fe('0x31')][_0xd1fe('0x1e')]);_0x2390f0[_0xd1fe('0x1c')]=qs[_0xd1fe('0x1c')](_0x30972a[_0xd1fe('0x31')][_0xd1fe('0x1c')]);}_0x2390f0[_0xd1fe('0x39')]=qs[_0xd1fe('0x3a')](_0x30972a[_0xd1fe('0x31')][_0xd1fe('0x3a')]);_0x2390f0[_0xd1fe('0x3b')]=qs[_0xd1fe('0x3c')](_['pick'](_0x30972a[_0xd1fe('0x31')],_0x34a558[_0xd1fe('0x3c')]),_0x39f588);if(_0x30972a[_0xd1fe('0x31')]['filter']){_0x2390f0[_0xd1fe('0x3b')]=_[_0xd1fe('0x3d')](_0x2390f0['where'],{'$or':_[_0xd1fe('0x2d')](_0x39f588,function(_0x1264e8){if(_0x1264e8[_0xd1fe('0x2f')]!==_0xd1fe('0x3e')){var _0xf685c1={};_0xf685c1[_0x1264e8[_0xd1fe('0x2a')]]={'$like':'%'+_0x30972a[_0xd1fe('0x31')][_0xd1fe('0x3f')]+'%'};return _0xf685c1;}})});}_0x2390f0=_['merge']({},_0x2390f0,_0x30972a[_0xd1fe('0x40')]);var _0x4b2c74={'where':_0x2390f0[_0xd1fe('0x3b')]};return db[_0xd1fe('0x41')][_0xd1fe('0x1f')](_0x4b2c74)[_0xd1fe('0x26')](function(_0x31e97a){_0xf2cc8[_0xd1fe('0x1f')]=_0x31e97a;if(_0x30972a['query'][_0xd1fe('0x42')]){_0x2390f0[_0xd1fe('0x43')]=[{'all':!![]}];}return db[_0xd1fe('0x41')][_0xd1fe('0x44')](_0x2390f0);})[_0xd1fe('0x26')](function(_0x3bb170){_0xf2cc8[_0xd1fe('0x45')]=_0x3bb170;return _0xf2cc8;})[_0xd1fe('0x26')](respondWithFilteredResult(_0x5ebcd2,_0x2390f0))[_0xd1fe('0x46')](handleError(_0x5ebcd2,null));};exports[_0xd1fe('0x47')]=function(_0x467685,_0x99fe00){var _0x5821f8={'raw':!![],'where':{'id':_0x467685[_0xd1fe('0x48')]['id']}},_0x24c6bc={};_0x24c6bc['model']=_[_0xd1fe('0x32')](db['SmsQueue'][_0xd1fe('0x49')]);_0x24c6bc[_0xd1fe('0x31')]=_['keys'](_0x467685['query']);_0x24c6bc['filters']=_[_0xd1fe('0x33')](_0x24c6bc[_0xd1fe('0x30')],_0x24c6bc[_0xd1fe('0x31')]);_0x5821f8['attributes']=_['intersection'](_0x24c6bc['model'],qs[_0xd1fe('0x34')](_0x467685['query'][_0xd1fe('0x34')]));_0x5821f8[_0xd1fe('0x35')]=_0x5821f8[_0xd1fe('0x35')][_0xd1fe('0x36')]?_0x5821f8[_0xd1fe('0x35')]:_0x24c6bc[_0xd1fe('0x30')];if(_0x467685[_0xd1fe('0x31')][_0xd1fe('0x42')]){_0x5821f8['include']=[{'all':!![]}];}_0x5821f8=_[_0xd1fe('0x3d')]({},_0x5821f8,_0x467685[_0xd1fe('0x40')]);return db[_0xd1fe('0x41')]['find'](_0x5821f8)[_0xd1fe('0x26')](handleEntityNotFound(_0x99fe00,null))[_0xd1fe('0x26')](respondWithResult(_0x99fe00,null))[_0xd1fe('0x46')](handleError(_0x99fe00,null));};exports[_0xd1fe('0x4a')]=function(_0x55688c,_0x568fac){return db[_0xd1fe('0x41')][_0xd1fe('0x4a')](_0x55688c[_0xd1fe('0x4b')],{})[_0xd1fe('0x26')](function(_0x31f64b){var _0x58fcda=_0x55688c[_0xd1fe('0x4c')]['get']({'plain':!![]});if(!_0x58fcda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58fcda[_0xd1fe('0x4d')]===_0xd1fe('0x4c')){var _0x3dfca4=_0x31f64b['get']({'plain':!![]});var _0x777b06=_0xd1fe('0x4e');return db[_0xd1fe('0x4f')][_0xd1fe('0x50')]({'where':{'name':_0x777b06,'userProfileId':_0x58fcda[_0xd1fe('0x51')]},'raw':!![]})[_0xd1fe('0x26')](function(_0xa90a65){if(_0xa90a65&&_0xa90a65[_0xd1fe('0x52')]===0x0){return db[_0xd1fe('0x53')][_0xd1fe('0x4a')]({'name':_0x3dfca4[_0xd1fe('0x2a')],'resourceId':_0x3dfca4['id'],'type':_0xa90a65[_0xd1fe('0x2a')],'sectionId':_0xa90a65['id']},{})[_0xd1fe('0x26')](function(){return _0x31f64b;});}else{return _0x31f64b;}})[_0xd1fe('0x46')](function(_0x40ef1b){logger[_0xd1fe('0x28')](_0xd1fe('0x54'),_0x40ef1b);throw _0x40ef1b;});}return _0x31f64b;})[_0xd1fe('0x26')](respondWithResult(_0x568fac,0xc9))[_0xd1fe('0x46')](handleError(_0x568fac,null));};exports[_0xd1fe('0x55')]=function(_0x38b65b,_0x55d836){if(_0x38b65b[_0xd1fe('0x4b')]['id']){delete _0x38b65b[_0xd1fe('0x4b')]['id'];}return db['SmsQueue'][_0xd1fe('0x50')]({'where':{'id':_0x38b65b['params']['id']}})[_0xd1fe('0x26')](handleEntityNotFound(_0x55d836,null))[_0xd1fe('0x26')](saveUpdates(_0x38b65b[_0xd1fe('0x4b')],null))['then'](respondWithResult(_0x55d836,null))[_0xd1fe('0x46')](handleError(_0x55d836,null));};exports[_0xd1fe('0x25')]=function(_0x1975d4,_0x137feb){return db[_0xd1fe('0x41')]['find']({'where':{'id':_0x1975d4[_0xd1fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x137feb,null))[_0xd1fe('0x26')](removeEntity(_0x137feb,null))['catch'](handleError(_0x137feb,null));};exports[_0xd1fe('0x56')]=function(_0x580172,_0x55cff6){return db[_0xd1fe('0x41')]['describe']()[_0xd1fe('0x26')](respondWithResult(_0x55cff6,null))[_0xd1fe('0x46')](handleError(_0x55cff6,null));};exports['getMembers']=function(_0x1f2bf2,_0xb9f54a,_0x592bea){var _0xc7a786={'raw':!![],'where':{}},_0x4765c5={},_0x5add12;return db['SmsQueue'][_0xd1fe('0x57')]({'where':{'id':_0x1f2bf2[_0xd1fe('0x48')]['id']}})[_0xd1fe('0x26')](handleEntityNotFound(_0xb9f54a,null))['then'](function(_0x3a9120){if(_0x3a9120){_0x5add12=_0x3a9120[_0xd1fe('0x27')]({'plain':!![]});_0x4765c5['model']=_[_0xd1fe('0x32')](db[_0xd1fe('0x58')][_0xd1fe('0x49')]);_0x4765c5['query']=_['keys'](_0x1f2bf2[_0xd1fe('0x31')]);_0x4765c5[_0xd1fe('0x3c')]=_[_0xd1fe('0x33')](_0x4765c5[_0xd1fe('0x30')],_0x4765c5[_0xd1fe('0x31')]);_0xc7a786[_0xd1fe('0x35')]=_['intersection'](_0x4765c5[_0xd1fe('0x30')],qs['fields'](_0x1f2bf2[_0xd1fe('0x31')][_0xd1fe('0x34')]));_0xc7a786['attributes']=_0xc7a786[_0xd1fe('0x35')][_0xd1fe('0x36')]?_0xc7a786[_0xd1fe('0x35')]:_0x4765c5[_0xd1fe('0x30')];if(!_0x1f2bf2[_0xd1fe('0x31')][_0xd1fe('0x37')](_0xd1fe('0x38'))){_0xc7a786[_0xd1fe('0x1e')]=qs[_0xd1fe('0x1e')](_0x1f2bf2[_0xd1fe('0x31')][_0xd1fe('0x1e')]);_0xc7a786[_0xd1fe('0x1c')]=qs[_0xd1fe('0x1c')](_0x1f2bf2['query']['offset']);}_0xc7a786[_0xd1fe('0x39')]=qs[_0xd1fe('0x3a')](_0x1f2bf2[_0xd1fe('0x31')][_0xd1fe('0x3a')]);_0xc7a786[_0xd1fe('0x3b')]=qs[_0xd1fe('0x3c')](_['pick'](_0x1f2bf2['query'],_0x4765c5[_0xd1fe('0x3c')]));_0xc7a786[_0xd1fe('0x3b')]['SmsQueueId']=_0x3a9120['id'];if(_0x1f2bf2[_0xd1fe('0x31')][_0xd1fe('0x3f')]){_0xc7a786[_0xd1fe('0x3b')]=_[_0xd1fe('0x3d')](_0xc7a786[_0xd1fe('0x3b')],{'$or':_[_0xd1fe('0x2d')](_0xc7a786['attributes'],function(_0x3e4fbb){var _0x286944={};_0x286944[_0x3e4fbb]={'$like':'%'+_0x1f2bf2[_0xd1fe('0x31')][_0xd1fe('0x3f')]+'%'};return _0x286944;})});}_0xc7a786=_[_0xd1fe('0x3d')]({},_0xc7a786,_0x1f2bf2[_0xd1fe('0x40')]);return db['UserSmsQueue'][_0xd1fe('0x44')](_0xc7a786);}})[_0xd1fe('0x26')](function(_0x1ef042){if(_0x1ef042){return db[_0xd1fe('0x59')][_0xd1fe('0x5a')]({'where':{'id':_['map'](_0x1ef042,_0xd1fe('0x5b')),'role':_0xd1fe('0x5c')},'attributes':['id',_0xd1fe('0x2a'),'smsPause',_0xd1fe('0x5d'),'createdAt']});}})['then'](function(_0x3d8fa4){if(_0x3d8fa4){return{'count':_0x3d8fa4['count'],'rows':_[_0xd1fe('0x2d')](_0x3d8fa4[_0xd1fe('0x45')],function(_0x38fec7){return{'membername':_0x38fec7[_0xd1fe('0x2a')],'UserId':_0x38fec7['id'],'queue_name':_0x5add12[_0xd1fe('0x2a')],'SmsQueueId':_0x5add12['id'],'interface':util[_0xd1fe('0x5e')]('%s/%s',_0xd1fe('0x5f'),_0x38fec7[_0xd1fe('0x2a')]),'penalty':0x0,'paused':_0x38fec7[_0xd1fe('0x60')],'createdAt':_0x38fec7[_0xd1fe('0x61')],'updatedAt':_0x38fec7[_0xd1fe('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd1fe('0x26')](respondWithFilteredResult(_0xb9f54a,_0xc7a786))['catch'](handleError(_0xb9f54a,null));};exports[_0xd1fe('0x62')]=function(_0x14fa7c,_0x3338de,_0x595973){var _0x2ab9a8={};var _0xace6ae={};var _0x2a524d;var _0x3fae65;return db[_0xd1fe('0x41')][_0xd1fe('0x57')]({'where':{'id':_0x14fa7c['params']['id']}})[_0xd1fe('0x26')](handleEntityNotFound(_0x3338de,null))['then'](function(_0x425c23){if(_0x425c23){_0x2a524d=_0x425c23;_0xace6ae[_0xd1fe('0x30')]=_[_0xd1fe('0x32')](db['Team'][_0xd1fe('0x49')]);_0xace6ae['query']=_['keys'](_0x14fa7c[_0xd1fe('0x31')]);_0xace6ae[_0xd1fe('0x3c')]=_[_0xd1fe('0x33')](_0xace6ae[_0xd1fe('0x30')],_0xace6ae[_0xd1fe('0x31')]);_0x2ab9a8[_0xd1fe('0x35')]=_[_0xd1fe('0x33')](_0xace6ae[_0xd1fe('0x30')],qs[_0xd1fe('0x34')](_0x14fa7c[_0xd1fe('0x31')][_0xd1fe('0x34')]));_0x2ab9a8['attributes']=_0x2ab9a8[_0xd1fe('0x35')][_0xd1fe('0x36')]?_0x2ab9a8[_0xd1fe('0x35')]:_0xace6ae[_0xd1fe('0x30')];_0x2ab9a8['order']=qs['sort'](_0x14fa7c['query']['sort']);_0x2ab9a8['where']=qs[_0xd1fe('0x3c')](_[_0xd1fe('0x63')](_0x14fa7c[_0xd1fe('0x31')],_0xace6ae['filters']));if(_0x14fa7c['query'][_0xd1fe('0x3f')]){_0x2ab9a8[_0xd1fe('0x3b')]=_[_0xd1fe('0x3d')](_0x2ab9a8[_0xd1fe('0x3b')],{'$or':_['map'](_0x2ab9a8[_0xd1fe('0x35')],function(_0x448316){var _0xbd834={};_0xbd834[_0x448316]={'$like':'%'+_0x14fa7c[_0xd1fe('0x31')][_0xd1fe('0x3f')]+'%'};return _0xbd834;})});}_0x2ab9a8=_[_0xd1fe('0x3d')]({},_0x2ab9a8,_0x14fa7c[_0xd1fe('0x40')]);return _0x2a524d['getTeams'](_0x2ab9a8);}})[_0xd1fe('0x26')](function(_0x15f836){if(_0x15f836){_0x3fae65=_0x15f836['length'];if(!_0x14fa7c[_0xd1fe('0x31')][_0xd1fe('0x37')](_0xd1fe('0x38'))){_0x2ab9a8['limit']=qs[_0xd1fe('0x1e')](_0x14fa7c[_0xd1fe('0x31')][_0xd1fe('0x1e')]);_0x2ab9a8[_0xd1fe('0x1c')]=qs[_0xd1fe('0x1c')](_0x14fa7c['query'][_0xd1fe('0x1c')]);}return _0x2a524d[_0xd1fe('0x62')](_0x2ab9a8);}})[_0xd1fe('0x26')](function(_0xdd3025){if(_0xdd3025){return _0xdd3025?{'count':_0x3fae65,'rows':_0xdd3025}:null;}})['then'](respondWithResult(_0x3338de,null))[_0xd1fe('0x46')](handleError(_0x3338de,null));};exports['addTeams']=function(_0x1a35bb,_0x5afe31,_0x591831){var _0x511607=_0x1a35bb[_0xd1fe('0x4b')][_0xd1fe('0x64')];return db[_0xd1fe('0x65')]['findAll']({'where':{'id':_0x511607},'attributes':['id'],'include':[{'model':db[_0xd1fe('0x59')],'as':_0xd1fe('0x66'),'attributes':['id','name','online',_0xd1fe('0x67'),'interface'],'raw':!![]}]})[_0xd1fe('0x26')](function(_0x2f77bb){if(_0x2f77bb){var _0x115458=_['flatMap'](_0x2f77bb,function(_0x1cb770){var _0x3b056a=_0x1cb770[_0xd1fe('0x27')]({'plain':!![]});return _0x3b056a['Agents'];});return db[_0xd1fe('0x41')][_0xd1fe('0x50')]({'where':{'id':_0x1a35bb['params']['id']}})[_0xd1fe('0x26')](function(_0x4b0cff){return db['sequelize'][_0xd1fe('0x68')](function(_0x2367de){return _0x4b0cff[_0xd1fe('0x69')](_0x511607,{'transaction':_0x2367de})[_0xd1fe('0x26')](function(){return BPromise['each'](_0x115458,function(_0x3b1f58){return db['UserSmsQueue'][_0xd1fe('0x6a')]({'where':{'UserId':_0x3b1f58['id'],'SmsQueueId':_0x1a35bb[_0xd1fe('0x48')]['id']},'transaction':_0x2367de});});})[_0xd1fe('0x26')](function(){_0x115458['forEach'](function(_0x8aafe3){socket[_0xd1fe('0x6b')](_0xd1fe('0x6c'),{'UserId':_0x8aafe3['id'],'SmsQueueId':_0x4b0cff['id']});});});});});}})[_0xd1fe('0x26')](respondWithStatusCode(_0x5afe31,null))[_0xd1fe('0x46')](handleError(_0x5afe31,null));};exports[_0xd1fe('0x6d')]=function(_0x5a7b60,_0x43e125,_0x3a56cb){return db[_0xd1fe('0x65')][_0xd1fe('0x44')]({'where':{'id':_0x5a7b60[_0xd1fe('0x31')][_0xd1fe('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd1fe('0x26')](handleEntityNotFound(_0x43e125,null))[_0xd1fe('0x26')](function(_0x312314){var _0x102692=_[_0xd1fe('0x2d')](_0x312314,'id');var _0x10f5fd=[];var _0x2161f0=[];var _0x23b38e=squel['select']();_0x23b38e[_0xd1fe('0x6e')](_0xd1fe('0x6f'))['from']('team_has_sms_queues','tq')[_0xd1fe('0x70')](_0xd1fe('0x71'),'ut',_0xd1fe('0x72'))[_0xd1fe('0x3b')](_0xd1fe('0x73'),_0x5a7b60[_0xd1fe('0x48')]['id']);for(var _0x358872=0x0;_0x358872<_0x312314[_0xd1fe('0x36')];_0x358872+=0x1){let _0x142cf9=_0x312314[_0x358872];for(var _0x503d7e=0x0;_0x503d7e<_0x142cf9['Agents'][_0xd1fe('0x36')];_0x503d7e+=0x1){let _0xa183af=_0x142cf9[_0xd1fe('0x66')][_0x503d7e];var _0x1321b4=_0x23b38e[_0xd1fe('0x74')]();_0x1321b4[_0xd1fe('0x3b')](_0xd1fe('0x75'),_0xa183af['id']);_0x2161f0['push'](db[_0xd1fe('0x76')]['query'](_0x1321b4[_0xd1fe('0x77')](),{'type':db[_0xd1fe('0x76')][_0xd1fe('0x78')][_0xd1fe('0x79')]})[_0xd1fe('0x26')](function(_0x435933){if(_0x435933['length']===0x1){return _0xa183af['id'];}else{var _0x1e8b9a=_[_0xd1fe('0x7a')](_[_0xd1fe('0x2d')](_0x435933,_0xd1fe('0x7b')),function(_0x13f1cf){return _['includes'](_0x102692,_0x13f1cf);});if(_0x1e8b9a){return _0xa183af['id'];}}}));}}return BPromise[_0xd1fe('0x7c')](_0x2161f0)['then'](function(_0x2c9c98){_0x10f5fd=_(_0x10f5fd)[_0xd1fe('0x7d')](_0x2c9c98)[_0xd1fe('0x7e')]()[_0xd1fe('0x7f')]();return db['SmsQueue'][_0xd1fe('0x50')]({'where':{'id':_0x5a7b60[_0xd1fe('0x48')]['id']}})[_0xd1fe('0x26')](function(_0x45ffc3){return db[_0xd1fe('0x76')]['transaction'](function(_0x528af0){return _0x45ffc3['removeTeams'](_0x5a7b60['query'][_0xd1fe('0x64')],{'transaction':_0x528af0})[_0xd1fe('0x26')](function(){if(!_[_0xd1fe('0x80')](_0x10f5fd)){return _0x45ffc3['removeAgents'](_0x10f5fd,{'transaction':_0x528af0});}})[_0xd1fe('0x26')](function(){_0x10f5fd[_0xd1fe('0x81')](function(_0x542255){socket[_0xd1fe('0x6b')](_0xd1fe('0x82'),{'UserId':_0x542255,'SmsQueueId':_0x45ffc3['id']});});});});});});})[_0xd1fe('0x26')](respondWithStatusCode(_0x43e125,null))['catch'](handleError(_0x43e125,null));};exports[_0xd1fe('0x83')]=function(_0x4fb505,_0x53708c,_0x5c7048){return db[_0xd1fe('0x41')]['find']({'where':{'id':_0x4fb505['params']['id']}})[_0xd1fe('0x26')](handleEntityNotFound(_0x53708c,null))[_0xd1fe('0x26')](function(_0x2fd677){if(_0x2fd677){return _0x2fd677[_0xd1fe('0x83')](_0x4fb505[_0xd1fe('0x4b')][_0xd1fe('0x64')],_['omit'](_0x4fb505[_0xd1fe('0x4b')],['ids','id'])||{})[_0xd1fe('0x84')](function(_0x3333e3){for(var _0x48ce28=0x0;_0x48ce28<_0x4fb505[_0xd1fe('0x4b')][_0xd1fe('0x64')][_0xd1fe('0x36')];_0x48ce28+=0x1){socket['emit'](_0xd1fe('0x6c'),{'UserId':Number(_0x4fb505[_0xd1fe('0x4b')][_0xd1fe('0x64')][_0x48ce28]),'SmsQueueId':Number(_0x4fb505[_0xd1fe('0x48')]['id'])});}return _0x3333e3;});}})[_0xd1fe('0x26')](respondWithResult(_0x53708c,null))[_0xd1fe('0x46')](handleError(_0x53708c,null));};exports[_0xd1fe('0x85')]=function(_0x2f5f30,_0x1a6803,_0x47587b){return db['SmsQueue']['find']({'where':{'id':_0x2f5f30[_0xd1fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a6803,null))[_0xd1fe('0x26')](function(_0x470a31){if(_0x470a31){return _0x470a31[_0xd1fe('0x85')](_0x2f5f30[_0xd1fe('0x31')][_0xd1fe('0x64')])['then'](function(){if(_[_0xd1fe('0x86')](_0x2f5f30[_0xd1fe('0x31')]['ids'])){for(var _0x1808c7=0x0;_0x1808c7<_0x2f5f30[_0xd1fe('0x31')][_0xd1fe('0x64')][_0xd1fe('0x36')];_0x1808c7+=0x1){socket[_0xd1fe('0x6b')]('userSmsQueue:remove',{'UserId':Number(_0x2f5f30[_0xd1fe('0x31')]['ids'][_0x1808c7]),'SmsQueueId':Number(_0x2f5f30[_0xd1fe('0x48')]['id'])});}}else{socket[_0xd1fe('0x6b')](_0xd1fe('0x82'),{'UserId':Number(_0x2f5f30[_0xd1fe('0x31')][_0xd1fe('0x64')]),'SmsQueueId':Number(_0x2f5f30[_0xd1fe('0x48')]['id'])});}});}})[_0xd1fe('0x26')](respondWithStatusCode(_0x1a6803,null))[_0xd1fe('0x46')](handleError(_0x1a6803,null));};exports[_0xd1fe('0x87')]=function(_0x2fc1e2,_0x2510b9,_0x52010d){var _0x16c736={};var _0x48ad4f={};var _0x9d0772;var _0x595bda;return db[_0xd1fe('0x41')][_0xd1fe('0x57')]({'where':{'id':_0x2fc1e2[_0xd1fe('0x48')]['id']}})[_0xd1fe('0x26')](handleEntityNotFound(_0x2510b9,null))[_0xd1fe('0x26')](function(_0x1000d8){if(_0x1000d8){_0x9d0772=_0x1000d8;_0x48ad4f[_0xd1fe('0x30')]=_['keys'](db[_0xd1fe('0x59')]['rawAttributes']);_0x48ad4f[_0xd1fe('0x31')]=_['keys'](_0x2fc1e2[_0xd1fe('0x31')]);_0x48ad4f[_0xd1fe('0x3c')]=_[_0xd1fe('0x33')](_0x48ad4f[_0xd1fe('0x30')],_0x48ad4f['query']);_0x16c736[_0xd1fe('0x35')]=_[_0xd1fe('0x33')](_0x48ad4f['model'],qs[_0xd1fe('0x34')](_0x2fc1e2[_0xd1fe('0x31')][_0xd1fe('0x34')]));_0x16c736[_0xd1fe('0x35')]=_0x16c736[_0xd1fe('0x35')][_0xd1fe('0x36')]?_0x16c736[_0xd1fe('0x35')]:_0x48ad4f[_0xd1fe('0x30')];_0x16c736[_0xd1fe('0x39')]=qs['sort'](_0x2fc1e2[_0xd1fe('0x31')][_0xd1fe('0x3a')]);_0x16c736[_0xd1fe('0x3b')]=qs[_0xd1fe('0x3c')](_[_0xd1fe('0x63')](_0x2fc1e2['query'],_0x48ad4f[_0xd1fe('0x3c')]));if(_0x2fc1e2[_0xd1fe('0x31')][_0xd1fe('0x3f')]){_0x16c736['where']=_['merge'](_0x16c736[_0xd1fe('0x3b')],{'$or':_[_0xd1fe('0x2d')](_0x16c736[_0xd1fe('0x35')],function(_0x3b9528){var _0x1c262c={};_0x1c262c[_0x3b9528]={'$like':'%'+_0x2fc1e2['query']['filter']+'%'};return _0x1c262c;})});}_0x16c736=_[_0xd1fe('0x3d')]({},_0x16c736,_0x2fc1e2[_0xd1fe('0x40')]);return _0x9d0772[_0xd1fe('0x87')](_0x16c736);}})[_0xd1fe('0x26')](function(_0x231697){if(_0x231697){_0x595bda=_0x231697['length'];if(!_0x2fc1e2[_0xd1fe('0x31')][_0xd1fe('0x37')](_0xd1fe('0x38'))){_0x16c736[_0xd1fe('0x1e')]=qs[_0xd1fe('0x1e')](_0x2fc1e2['query']['limit']);_0x16c736[_0xd1fe('0x1c')]=qs['offset'](_0x2fc1e2[_0xd1fe('0x31')][_0xd1fe('0x1c')]);}return _0x9d0772[_0xd1fe('0x87')](_0x16c736);}})[_0xd1fe('0x26')](function(_0x6cdb7){if(_0x6cdb7){return _0x6cdb7?{'count':_0x595bda,'rows':_0x6cdb7}:null;}})['then'](respondWithResult(_0x2510b9,null))[_0xd1fe('0x46')](handleError(_0x2510b9,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f317f04..88dab9e 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 _0x2f3a=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x460494,_0x203017){var _0x12c43d=function(_0x2d2fa3){while(--_0x2d2fa3){_0x460494['push'](_0x460494['shift']());}};_0x12c43d(++_0x203017);}(_0x2f3a,0xb1));var _0xa2f3=function(_0x3b2406,_0x52379e){_0x3b2406=_0x3b2406-0x0;var _0x2f73d5=_0x2f3a[_0x3b2406];return _0x2f73d5;};'use strict';var EventEmitter=require(_0xa2f3('0x0'));var SmsQueue=require(_0xa2f3('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa2f3('0x2')](0x0);var events={'afterCreate':_0xa2f3('0x3'),'afterUpdate':_0xa2f3('0x4'),'afterDestroy':_0xa2f3('0x5')};function emitEvent(_0x28e067){return function(_0xb7feb7,_0x448b2d,_0x136ced){SmsQueueEvents[_0xa2f3('0x6')](_0x28e067+':'+_0xb7feb7['id'],_0xb7feb7);SmsQueueEvents[_0xa2f3('0x6')](_0x28e067,_0xb7feb7);_0x136ced(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xa2f3('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xf57e=['save','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf57e,0x1e4));var _0xef57=function(_0x2dba39,_0x246271){_0x2dba39=_0x2dba39-0x0;var _0x2fa940=_0xf57e[_0x2dba39];return _0x2fa940;};'use strict';var EventEmitter=require(_0xef57('0x0'));var SmsQueue=require(_0xef57('0x1'))['db'][_0xef57('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xef57('0x3')](0x0);var events={'afterCreate':_0xef57('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x29c542){return function(_0x11f9c9,_0x3a5be6,_0x1c8e0b){SmsQueueEvents['emit'](_0x29c542+':'+_0x11f9c9['id'],_0x11f9c9);SmsQueueEvents[_0xef57('0x5')](_0x29c542,_0x11f9c9);_0x1c8e0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xef57('0x6')](e,emitEvent(event));}}module[_0xef57('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 f7d1ce9..eb913e7 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 _0xdfff=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash'];(function(_0x54d164,_0x3be5ba){var _0xf58243=function(_0x58faf5){while(--_0x58faf5){_0x54d164['push'](_0x54d164['shift']());}};_0xf58243(++_0x3be5ba);}(_0xdfff,0x110));var _0xfdff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdfff[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfdff('0x0'));var util=require(_0xfdff('0x1'));var logger=require(_0xfdff('0x2'))(_0xfdff('0x3'));var moment=require(_0xfdff('0x4'));var BPromise=require('bluebird');var rp=require(_0xfdff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdff('0x6'));var config=require(_0xfdff('0x7'));var attributes=require(_0xfdff('0x8'));module[_0xfdff('0x9')]=function(_0x30d77d,_0x2253ef){return _0x30d77d[_0xfdff('0xa')](_0xfdff('0xb'),attributes,{'tableName':_0xfdff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4398=['api','moment','bluebird','request-promise','../../config/environment','./smsQueue.attributes','define','SmsQueue','lodash','util'];(function(_0x3d8ee5,_0x4b5ae0){var _0x1d8ac7=function(_0x4a6cd6){while(--_0x4a6cd6){_0x3d8ee5['push'](_0x3d8ee5['shift']());}};_0x1d8ac7(++_0x4b5ae0);}(_0x4398,0xee));var _0x8439=function(_0x5b355d,_0x3423d2){_0x5b355d=_0x5b355d-0x0;var _0x56b145=_0x4398[_0x5b355d];return _0x56b145;};'use strict';var _=require(_0x8439('0x0'));var util=require(_0x8439('0x1'));var logger=require('../../config/logger')(_0x8439('0x2'));var moment=require(_0x8439('0x3'));var BPromise=require(_0x8439('0x4'));var rp=require(_0x8439('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8439('0x6'));var attributes=require(_0x8439('0x7'));module['exports']=function(_0x16be11,_0x294ab1){return _0x16be11[_0x8439('0x8')](_0x8439('0x9'),attributes,{'tableName':'sms_queues','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 ddd9262..20cf515 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 _0x68dd=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowSmsQueue','stringify'];(function(_0x2610ab,_0x2ad02a){var _0x2ccfd6=function(_0x543595){while(--_0x543595){_0x2610ab['push'](_0x2610ab['shift']());}};_0x2ccfd6(++_0x2ad02a);}(_0x68dd,0x171));var _0xd68d=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x68dd[_0x555b2f];return _0x81c0a6;};'use strict';var _=require('lodash');var util=require(_0xd68d('0x0'));var moment=require(_0xd68d('0x1'));var BPromise=require(_0xd68d('0x2'));var rs=require(_0xd68d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd68d('0x4'))['db'];var utils=require(_0xd68d('0x5'));var logger=require(_0xd68d('0x6'))('rpc');var config=require(_0xd68d('0x7'));var jayson=require(_0xd68d('0x8'));var client=jayson[_0xd68d('0x9')][_0xd68d('0xa')]({'port':0x232a});config[_0xd68d('0xb')]=_[_0xd68d('0xc')](config['redis'],{'host':_0xd68d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd68d('0xb')]));require(_0xd68d('0xe'))[_0xd68d('0xf')](socket);function respondWithRpcPromise(_0xa68584,_0x28ad2b,_0x3596b2){return new BPromise(function(_0x51bd93,_0x387c25){return client[_0xd68d('0x10')](_0xa68584,_0x3596b2)[_0xd68d('0x11')](function(_0x2b0b1f){logger[_0xd68d('0x12')](_0xd68d('0x13'),_0x28ad2b,'request\x20sent');logger[_0xd68d('0x14')](_0xd68d('0x15'),_0x28ad2b,_0xd68d('0x16'),JSON['stringify'](_0x2b0b1f));if(_0x2b0b1f[_0xd68d('0x17')]){if(_0x2b0b1f[_0xd68d('0x17')][_0xd68d('0x18')]===0x1f4){logger[_0xd68d('0x17')](_0xd68d('0x13'),_0x28ad2b,_0x2b0b1f[_0xd68d('0x17')][_0xd68d('0x19')]);return _0x387c25(_0x2b0b1f['error'][_0xd68d('0x19')]);}logger[_0xd68d('0x17')]('SmsQueue,\x20%s,\x20%s',_0x28ad2b,_0x2b0b1f[_0xd68d('0x17')][_0xd68d('0x19')]);return _0x51bd93(_0x2b0b1f[_0xd68d('0x17')]['message']);}else{logger[_0xd68d('0x12')](_0xd68d('0x13'),_0x28ad2b,_0xd68d('0x16'));_0x51bd93(_0x2b0b1f['result']['message']);}})[_0xd68d('0x1a')](function(_0x5dc879){logger[_0xd68d('0x17')](_0xd68d('0x13'),_0x28ad2b,_0x5dc879);_0x387c25(_0x5dc879);});});}exports[_0xd68d('0x1b')]=function(_0x33791a){var _0xf0bd4f=this;return new Promise(function(_0x3fbfec,_0x3552b8){return db[_0xd68d('0x1c')][_0xd68d('0x1d')]({'raw':_0x33791a[_0xd68d('0x1e')]?_0x33791a[_0xd68d('0x1e')][_0xd68d('0x1f')]===undefined?!![]:![]:!![],'where':_0x33791a['options']?_0x33791a['options'][_0xd68d('0x20')]||null:null,'attributes':_0x33791a['options']?_0x33791a[_0xd68d('0x1e')][_0xd68d('0x21')]||null:null,'limit':_0x33791a[_0xd68d('0x1e')]?_0x33791a[_0xd68d('0x1e')][_0xd68d('0x22')]||null:null,'include':_0x33791a['options']?_0x33791a[_0xd68d('0x1e')][_0xd68d('0x23')]?_['map'](_0x33791a[_0xd68d('0x1e')][_0xd68d('0x23')],function(_0x266d76){return{'model':db[_0x266d76[_0xd68d('0x24')]],'as':_0x266d76['as'],'attributes':_0x266d76['attributes'],'include':_0x266d76[_0xd68d('0x23')]?_[_0xd68d('0x25')](_0x266d76[_0xd68d('0x23')],function(_0x53c20b){return{'model':db[_0x53c20b['model']],'as':_0x53c20b['as'],'attributes':_0x53c20b[_0xd68d('0x21')],'include':_0x53c20b[_0xd68d('0x23')]?_[_0xd68d('0x25')](_0x53c20b[_0xd68d('0x23')],function(_0x51e95a){return{'model':db[_0x51e95a['model']],'as':_0x51e95a['as'],'attributes':_0x51e95a[_0xd68d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd68d('0x11')](function(_0xef4e5){logger[_0xd68d('0x12')](_0xd68d('0x1b'),_0x33791a);logger['debug'](_0xd68d('0x1b'),_0x33791a,JSON['stringify'](_0xef4e5));_0x3fbfec(_0xef4e5);})[_0xd68d('0x1a')](function(_0x5494f1){logger[_0xd68d('0x17')](_0xd68d('0x1b'),_0x5494f1[_0xd68d('0x19')],_0x33791a);_0x3552b8(_0xf0bd4f[_0xd68d('0x17')](0x1f4,_0x5494f1['message']));});});};exports['ShowSmsQueue']=function(_0x1410a2){var _0x1e7208=this;return new Promise(function(_0x5104dc,_0x3f88c1){return db[_0xd68d('0x1c')][_0xd68d('0x26')]({'raw':_0x1410a2['options']?_0x1410a2['options'][_0xd68d('0x1f')]===undefined?!![]:![]:!![],'where':_0x1410a2[_0xd68d('0x1e')]?_0x1410a2['options'][_0xd68d('0x20')]||null:null,'attributes':_0x1410a2[_0xd68d('0x1e')]?_0x1410a2['options'][_0xd68d('0x21')]||null:null,'include':_0x1410a2[_0xd68d('0x1e')]?_0x1410a2[_0xd68d('0x1e')]['include']?_[_0xd68d('0x25')](_0x1410a2['options']['include'],function(_0x4d010c){return{'model':db[_0x4d010c['model']],'as':_0x4d010c['as'],'attributes':_0x4d010c['attributes'],'include':_0x4d010c[_0xd68d('0x23')]?_[_0xd68d('0x25')](_0x4d010c[_0xd68d('0x23')],function(_0x3ee6f8){return{'model':db[_0x3ee6f8['model']],'as':_0x3ee6f8['as'],'attributes':_0x3ee6f8[_0xd68d('0x21')],'include':_0x3ee6f8[_0xd68d('0x23')]?_[_0xd68d('0x25')](_0x3ee6f8[_0xd68d('0x23')],function(_0x298c99){return{'model':db[_0x298c99[_0xd68d('0x24')]],'as':_0x298c99['as'],'attributes':_0x298c99[_0xd68d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd68d('0x11')](function(_0x3f4f5f){logger['info'](_0xd68d('0x27'),_0x1410a2);logger[_0xd68d('0x14')](_0xd68d('0x27'),_0x1410a2,JSON[_0xd68d('0x28')](_0x3f4f5f));_0x5104dc(_0x3f4f5f);})['catch'](function(_0x16268b){logger[_0xd68d('0x17')]('ShowSmsQueue',_0x16268b[_0xd68d('0x19')],_0x1410a2);_0x3f88c1(_0x1e7208[_0xd68d('0x17')](0x1f4,_0x16268b['message']));});});}; \ No newline at end of file +var _0x020f=['result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','model','include','map','SmsQueue','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x45a5a3,_0x4bbd82){var _0x5ba07c=function(_0xaedf7f){while(--_0xaedf7f){_0x45a5a3['push'](_0x45a5a3['shift']());}};_0x5ba07c(++_0x4bbd82);}(_0x020f,0xa6));var _0xf020=function(_0x51ae54,_0x346bc3){_0x51ae54=_0x51ae54-0x0;var _0x16e760=_0x020f[_0x51ae54];return _0x16e760;};'use strict';var _=require(_0xf020('0x0'));var util=require(_0xf020('0x1'));var moment=require(_0xf020('0x2'));var BPromise=require('bluebird');var rs=require(_0xf020('0x3'));var fs=require('fs');var Redis=require(_0xf020('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf020('0x5'))(_0xf020('0x6'));var config=require('../../config/environment');var jayson=require(_0xf020('0x7'));var client=jayson['client'][_0xf020('0x8')]({'port':0x232a});config['redis']=_[_0xf020('0x9')](config[_0xf020('0xa')],{'host':_0xf020('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf020('0xc'))['register'](socket);function respondWithRpcPromise(_0x1e0c35,_0x1fa459,_0x2e423e){return new BPromise(function(_0x2396fa,_0x1427c6){return client[_0xf020('0xd')](_0x1e0c35,_0x2e423e)[_0xf020('0xe')](function(_0x5a938){logger[_0xf020('0xf')](_0xf020('0x10'),_0x1fa459,_0xf020('0x11'));logger[_0xf020('0x12')](_0xf020('0x13'),_0x1fa459,_0xf020('0x11'),JSON[_0xf020('0x14')](_0x5a938));if(_0x5a938['error']){if(_0x5a938[_0xf020('0x15')][_0xf020('0x16')]===0x1f4){logger[_0xf020('0x15')](_0xf020('0x10'),_0x1fa459,_0x5a938[_0xf020('0x15')][_0xf020('0x17')]);return _0x1427c6(_0x5a938[_0xf020('0x15')]['message']);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x1fa459,_0x5a938[_0xf020('0x15')][_0xf020('0x17')]);return _0x2396fa(_0x5a938[_0xf020('0x15')][_0xf020('0x17')]);}else{logger[_0xf020('0xf')](_0xf020('0x10'),_0x1fa459,'request\x20sent');_0x2396fa(_0x5a938[_0xf020('0x18')][_0xf020('0x17')]);}})[_0xf020('0x19')](function(_0x14c3a5){logger[_0xf020('0x15')]('SmsQueue,\x20%s,\x20%s',_0x1fa459,_0x14c3a5);_0x1427c6(_0x14c3a5);});});}exports[_0xf020('0x1a')]=function(_0x5d2821){var _0x558c31=this;return new Promise(function(_0x5f0991,_0x398dd4){return db['SmsQueue'][_0xf020('0x1b')]({'raw':_0x5d2821['options']?_0x5d2821[_0xf020('0x1c')][_0xf020('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d2821[_0xf020('0x1c')]?_0x5d2821[_0xf020('0x1c')][_0xf020('0x1e')]||null:null,'attributes':_0x5d2821[_0xf020('0x1c')]?_0x5d2821[_0xf020('0x1c')][_0xf020('0x1f')]||null:null,'limit':_0x5d2821['options']?_0x5d2821['options'][_0xf020('0x20')]||null:null,'include':_0x5d2821['options']?_0x5d2821[_0xf020('0x1c')]['include']?_['map'](_0x5d2821['options']['include'],function(_0x3102e4){return{'model':db[_0x3102e4[_0xf020('0x21')]],'as':_0x3102e4['as'],'attributes':_0x3102e4[_0xf020('0x1f')],'include':_0x3102e4[_0xf020('0x22')]?_['map'](_0x3102e4['include'],function(_0x10ffbe){return{'model':db[_0x10ffbe[_0xf020('0x21')]],'as':_0x10ffbe['as'],'attributes':_0x10ffbe[_0xf020('0x1f')],'include':_0x10ffbe[_0xf020('0x22')]?_[_0xf020('0x23')](_0x10ffbe['include'],function(_0x2e27c1){return{'model':db[_0x2e27c1[_0xf020('0x21')]],'as':_0x2e27c1['as'],'attributes':_0x2e27c1[_0xf020('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x180508){logger['info'](_0xf020('0x1a'),_0x5d2821);logger['debug'](_0xf020('0x1a'),_0x5d2821,JSON[_0xf020('0x14')](_0x180508));_0x5f0991(_0x180508);})[_0xf020('0x19')](function(_0xbd5a9a){logger['error'](_0xf020('0x1a'),_0xbd5a9a[_0xf020('0x17')],_0x5d2821);_0x398dd4(_0x558c31['error'](0x1f4,_0xbd5a9a[_0xf020('0x17')]));});});};exports['ShowSmsQueue']=function(_0x1bce78){var _0xc5c7b5=this;return new Promise(function(_0x187aee,_0x48c3a0){return db[_0xf020('0x24')]['find']({'raw':_0x1bce78[_0xf020('0x1c')]?_0x1bce78['options'][_0xf020('0x1d')]===undefined?!![]:![]:!![],'where':_0x1bce78['options']?_0x1bce78['options'][_0xf020('0x1e')]||null:null,'attributes':_0x1bce78[_0xf020('0x1c')]?_0x1bce78['options'][_0xf020('0x1f')]||null:null,'include':_0x1bce78[_0xf020('0x1c')]?_0x1bce78[_0xf020('0x1c')]['include']?_[_0xf020('0x23')](_0x1bce78[_0xf020('0x1c')]['include'],function(_0x3238bc){return{'model':db[_0x3238bc['model']],'as':_0x3238bc['as'],'attributes':_0x3238bc[_0xf020('0x1f')],'include':_0x3238bc[_0xf020('0x22')]?_[_0xf020('0x23')](_0x3238bc[_0xf020('0x22')],function(_0x3741ff){return{'model':db[_0x3741ff[_0xf020('0x21')]],'as':_0x3741ff['as'],'attributes':_0x3741ff[_0xf020('0x1f')],'include':_0x3741ff['include']?_[_0xf020('0x23')](_0x3741ff[_0xf020('0x22')],function(_0x3452ba){return{'model':db[_0x3452ba[_0xf020('0x21')]],'as':_0x3452ba['as'],'attributes':_0x3452ba[_0xf020('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf020('0xe')](function(_0x534492){logger[_0xf020('0xf')](_0xf020('0x25'),_0x1bce78);logger[_0xf020('0x12')](_0xf020('0x25'),_0x1bce78,JSON[_0xf020('0x14')](_0x534492));_0x187aee(_0x534492);})['catch'](function(_0x3dd167){logger[_0xf020('0x15')]('ShowSmsQueue',_0x3dd167['message'],_0x1bce78);_0x48c3a0(_0xc5c7b5[_0xf020('0x15')](0x1f4,_0x3dd167[_0xf020('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f9f45d2..7a2350c 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 _0x06d1=['remove','update','emit','removeListener','register','length','./smsQueue.events','save'];(function(_0x354c1b,_0x56d79b){var _0x2c70f4=function(_0x47bdf4){while(--_0x47bdf4){_0x354c1b['push'](_0x354c1b['shift']());}};_0x2c70f4(++_0x56d79b);}(_0x06d1,0x1ae));var _0x106d=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x06d1[_0x51020b];return _0x371e47;};'use strict';var SmsQueueEvents=require(_0x106d('0x0'));var events=[_0x106d('0x1'),_0x106d('0x2'),_0x106d('0x3')];function createListener(_0x453337,_0x396fc5){return function(_0x474c6d){_0x396fc5[_0x106d('0x4')](_0x453337,_0x474c6d);};}function removeListener(_0x5f45f7,_0x33d571){return function(){SmsQueueEvents[_0x106d('0x5')](_0x5f45f7,_0x33d571);};}exports[_0x106d('0x6')]=function(_0x259eca){for(var _0x1a522e=0x0,_0x434131=events[_0x106d('0x7')];_0x1a522e<_0x434131;_0x1a522e++){var _0x1a4aa8=events[_0x1a522e];var _0x1011c4=createListener('smsQueue:'+_0x1a4aa8,_0x259eca);SmsQueueEvents['on'](_0x1a4aa8,_0x1011c4);}}; \ No newline at end of file +var _0x03cd=['remove','update','emit','removeListener','length','smsQueue:'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x03cd,0x17a));var _0xd03c=function(_0x4a2bdc,_0xb5b754){_0x4a2bdc=_0x4a2bdc-0x0;var _0x55c248=_0x03cd[_0x4a2bdc];return _0x55c248;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0xd03c('0x0'),_0xd03c('0x1')];function createListener(_0x4db3d8,_0x388502){return function(_0x38b81a){_0x388502[_0xd03c('0x2')](_0x4db3d8,_0x38b81a);};}function removeListener(_0x14a669,_0x29faed){return function(){SmsQueueEvents[_0xd03c('0x3')](_0x14a669,_0x29faed);};}exports['register']=function(_0x1ad466){for(var _0x5ca316=0x0,_0x284c9d=events[_0xd03c('0x4')];_0x5ca316<_0x284c9d;_0x5ca316++){var _0x14d519=events[_0x5ca316];var _0x352844=createListener(_0xd03c('0x5')+_0x14d519,_0x1ad466);SmsQueueEvents['on'](_0x14d519,_0x352844);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 3f1db65..b058a8a 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 _0x31c2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x31c2,0x1e1));var _0x231c=function(_0x3144c2,_0x5601fa){_0x3144c2=_0x3144c2-0x0;var _0x2ecc4a=_0x31c2[_0x3144c2];return _0x2ecc4a;};'use strict';var multer=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var path=require(_0x231c('0x2'));var timeout=require(_0x231c('0x3'));var express=require(_0x231c('0x4'));var router=express[_0x231c('0x5')]();var fs_extra=require(_0x231c('0x6'));var auth=require(_0x231c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x231c('0x8'));router[_0x231c('0x9')]('/',auth[_0x231c('0xa')](),controller[_0x231c('0xb')]);router['get'](_0x231c('0xc'),auth['isAuthenticated'](),controller[_0x231c('0xd')]);router[_0x231c('0x9')](_0x231c('0xe'),auth['isAuthenticated'](),controller[_0x231c('0xf')]);router[_0x231c('0x10')]('/',auth[_0x231c('0xa')](),controller[_0x231c('0x11')]);router[_0x231c('0x12')](_0x231c('0xe'),auth[_0x231c('0xa')](),controller['update']);router[_0x231c('0x13')](_0x231c('0xe'),auth['isAuthenticated'](),controller[_0x231c('0x14')]);module[_0x231c('0x15')]=router; \ No newline at end of file +var _0xbb17=['../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x12f816,_0x4708cd){var _0x169f60=function(_0x51c3f7){while(--_0x51c3f7){_0x12f816['push'](_0x12f816['shift']());}};_0x169f60(++_0x4708cd);}(_0xbb17,0x90));var _0x7bb1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbb17[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x7bb1('0x0'));var util=require(_0x7bb1('0x1'));var path=require(_0x7bb1('0x2'));var timeout=require(_0x7bb1('0x3'));var express=require(_0x7bb1('0x4'));var router=express['Router']();var fs_extra=require(_0x7bb1('0x5'));var auth=require(_0x7bb1('0x6'));var interaction=require(_0x7bb1('0x7'));var config=require(_0x7bb1('0x8'));var controller=require(_0x7bb1('0x9'));router[_0x7bb1('0xa')]('/',auth['isAuthenticated'](),controller[_0x7bb1('0xb')]);router[_0x7bb1('0xa')]('/describe',auth[_0x7bb1('0xc')](),controller['describe']);router[_0x7bb1('0xa')](_0x7bb1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7bb1('0xe')]('/',auth['isAuthenticated'](),controller[_0x7bb1('0xf')]);router['put'](_0x7bb1('0xd'),auth[_0x7bb1('0xc')](),controller[_0x7bb1('0x10')]);router[_0x7bb1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7bb1('0x12')]);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 97d9f87..4c626f0 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 _0x82c2=['STRING','DATE','moment','sequelize'];(function(_0x404258,_0x3ffa48){var _0x3aaa38=function(_0x37c28b){while(--_0x37c28b){_0x404258['push'](_0x404258['shift']());}};_0x3aaa38(++_0x3ffa48);}(_0x82c2,0x1e6));var _0x282c=function(_0x129046,_0x519448){_0x129046=_0x129046-0x0;var _0x4d06d9=_0x82c2[_0x129046];return _0x4d06d9;};'use strict';var moment=require(_0x282c('0x0'));var Sequelize=require(_0x282c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x282c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x282c('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x282c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x89b8=['moment','sequelize','exports','STRING','DATE'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x89b8,0x19f));var _0x889b=function(_0x4f2ed2,_0x561adf){_0x4f2ed2=_0x4f2ed2-0x0;var _0x1e84d8=_0x89b8[_0x4f2ed2];return _0x1e84d8;};'use strict';var moment=require(_0x889b('0x0'));var Sequelize=require(_0x889b('0x1'));module[_0x889b('0x2')]={'uniqueid':{'type':Sequelize[_0x889b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x889b('0x3')]},'joinAt':{'type':Sequelize[_0x889b('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x889b('0x4')]},'exitAt':{'type':Sequelize[_0x889b('0x4')]},'reason':{'type':Sequelize[_0x889b('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a346a72..a392d8d 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 _0xb3a4=['intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','SmsQueueReport','then','include','findAll','rows','catch','includeAll','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x13282b,_0x327836){var _0x1d7c1d=function(_0x333900){while(--_0x333900){_0x13282b['push'](_0x13282b['shift']());}};_0x1d7c1d(++_0x327836);}(_0xb3a4,0xab));var _0x4b3a=function(_0x120a73,_0x4fc1d9){_0x120a73=_0x120a73-0x0;var _0xff8941=_0xb3a4[_0x120a73];return _0xff8941;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b3a('0x0'));var zipdir=require(_0x4b3a('0x1'));var jsonpatch=require(_0x4b3a('0x2'));var rp=require(_0x4b3a('0x3'));var moment=require(_0x4b3a('0x4'));var BPromise=require(_0x4b3a('0x5'));var Mustache=require(_0x4b3a('0x6'));var util=require(_0x4b3a('0x7'));var path=require(_0x4b3a('0x8'));var sox=require('sox');var csv=require(_0x4b3a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b3a('0xa'));var _=require(_0x4b3a('0xb'));var squel=require('squel');var crypto=require(_0x4b3a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4b3a('0xd'));var toCsv=require(_0x4b3a('0x9'));var querystring=require(_0x4b3a('0xe'));var Papa=require(_0x4b3a('0xf'));var Redis=require(_0x4b3a('0x10'));var authService=require(_0x4b3a('0x11'));var qs=require(_0x4b3a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b3a('0x13'));var logger=require(_0x4b3a('0x14'))(_0x4b3a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b3a('0x16'))['db'];function respondWithStatusCode(_0x424d9b,_0x509829){_0x509829=_0x509829||0xcc;return function(_0x36ea5c){if(_0x36ea5c){return _0x424d9b[_0x4b3a('0x17')](_0x509829);}return _0x424d9b[_0x4b3a('0x18')](_0x509829)[_0x4b3a('0x19')]();};}function respondWithResult(_0x72c124,_0x56d88b){_0x56d88b=_0x56d88b||0xc8;return function(_0x5dc1c){if(_0x5dc1c){return _0x72c124[_0x4b3a('0x18')](_0x56d88b)[_0x4b3a('0x1a')](_0x5dc1c);}};}function respondWithFilteredResult(_0x5a96db,_0x57c799){return function(_0x5def5c){if(_0x5def5c){var _0xffa97d=typeof _0x57c799[_0x4b3a('0x1b')]===_0x4b3a('0x1c')&&typeof _0x57c799[_0x4b3a('0x1d')]===_0x4b3a('0x1c');var _0x1c7675=_0x5def5c[_0x4b3a('0x1e')];var _0x2f0725=_0xffa97d?0x0:_0x57c799[_0x4b3a('0x1b')];var _0x43d429=_0xffa97d?_0x5def5c['count']:_0x57c799['offset']+_0x57c799[_0x4b3a('0x1d')];var _0x57e961;if(_0x43d429>=_0x1c7675){_0x43d429=_0x1c7675;_0x57e961=0xc8;}else{_0x57e961=0xce;}_0x5a96db[_0x4b3a('0x18')](_0x57e961);return _0x5a96db[_0x4b3a('0x1f')]('Content-Range',_0x2f0725+'-'+_0x43d429+'/'+_0x1c7675)['json'](_0x5def5c);}return null;};}function patchUpdates(_0x13d4c8){return function(_0x1b8628){try{jsonpatch[_0x4b3a('0x20')](_0x1b8628,_0x13d4c8,!![]);}catch(_0x2dc8e7){return BPromise[_0x4b3a('0x21')](_0x2dc8e7);}return _0x1b8628[_0x4b3a('0x22')]();};}function saveUpdates(_0x956c89,_0x45e01f){return function(_0x5f39c6){if(_0x5f39c6){return _0x5f39c6[_0x4b3a('0x23')](_0x956c89)['then'](function(_0xaca558){return _0xaca558;});}return null;};}function removeEntity(_0x304045,_0x4fd95d){return function(_0x49dfba){if(_0x49dfba){return _0x49dfba[_0x4b3a('0x24')]()['then'](function(){_0x304045['status'](0xcc)[_0x4b3a('0x19')]();});}};}function handleEntityNotFound(_0x579a9f,_0x4c1d4){return function(_0x45db7d){if(!_0x45db7d){_0x579a9f[_0x4b3a('0x17')](0x194);}return _0x45db7d;};}function handleError(_0x18589c,_0x85478f){_0x85478f=_0x85478f||0x1f4;return function(_0x21d959){logger[_0x4b3a('0x25')](_0x21d959[_0x4b3a('0x26')]);if(_0x21d959[_0x4b3a('0x27')]){delete _0x21d959[_0x4b3a('0x27')];}_0x18589c[_0x4b3a('0x18')](_0x85478f)['send'](_0x21d959);};}exports[_0x4b3a('0x28')]=function(_0x3b2bd4,_0x509fcd){var _0x57ae56={},_0x42ec65={},_0x48b80f={'count':0x0,'rows':[]};var _0x3862d9=_[_0x4b3a('0x29')](db['SmsQueueReport'][_0x4b3a('0x2a')],function(_0x1d38ed){return{'name':_0x1d38ed[_0x4b3a('0x2b')],'type':_0x1d38ed[_0x4b3a('0x2c')][_0x4b3a('0x2d')]};});_0x42ec65[_0x4b3a('0x2e')]=_[_0x4b3a('0x29')](_0x3862d9,_0x4b3a('0x27'));_0x42ec65[_0x4b3a('0x2f')]=_[_0x4b3a('0x30')](_0x3b2bd4[_0x4b3a('0x2f')]);_0x42ec65[_0x4b3a('0x31')]=_['intersection'](_0x42ec65[_0x4b3a('0x2e')],_0x42ec65['query']);_0x57ae56[_0x4b3a('0x32')]=_[_0x4b3a('0x33')](_0x42ec65[_0x4b3a('0x2e')],qs[_0x4b3a('0x34')](_0x3b2bd4[_0x4b3a('0x2f')]['fields']));_0x57ae56[_0x4b3a('0x32')]=_0x57ae56[_0x4b3a('0x32')][_0x4b3a('0x35')]?_0x57ae56['attributes']:_0x42ec65[_0x4b3a('0x2e')];if(!_0x3b2bd4[_0x4b3a('0x2f')][_0x4b3a('0x36')](_0x4b3a('0x37'))){_0x57ae56[_0x4b3a('0x1d')]=qs[_0x4b3a('0x1d')](_0x3b2bd4[_0x4b3a('0x2f')][_0x4b3a('0x1d')]);_0x57ae56[_0x4b3a('0x1b')]=qs[_0x4b3a('0x1b')](_0x3b2bd4[_0x4b3a('0x2f')][_0x4b3a('0x1b')]);}_0x57ae56['order']=qs[_0x4b3a('0x38')](_0x3b2bd4[_0x4b3a('0x2f')][_0x4b3a('0x38')]);_0x57ae56[_0x4b3a('0x39')]=qs[_0x4b3a('0x31')](_[_0x4b3a('0x3a')](_0x3b2bd4[_0x4b3a('0x2f')],_0x42ec65[_0x4b3a('0x31')]),_0x3862d9);if(_0x3b2bd4[_0x4b3a('0x2f')][_0x4b3a('0x3b')]){_0x57ae56['where']=_['merge'](_0x57ae56[_0x4b3a('0x39')],{'$or':_[_0x4b3a('0x29')](_0x3862d9,function(_0x46b55b){if(_0x46b55b[_0x4b3a('0x2c')]!==_0x4b3a('0x3c')){var _0x5cbcfd={};_0x5cbcfd[_0x46b55b['name']]={'$like':'%'+_0x3b2bd4[_0x4b3a('0x2f')][_0x4b3a('0x3b')]+'%'};return _0x5cbcfd;}})});}_0x57ae56=_[_0x4b3a('0x3d')]({},_0x57ae56,_0x3b2bd4[_0x4b3a('0x3e')]);var _0x4e21a3={'where':_0x57ae56['where']};return db[_0x4b3a('0x3f')][_0x4b3a('0x1e')](_0x4e21a3)[_0x4b3a('0x40')](function(_0x30bdc3){_0x48b80f[_0x4b3a('0x1e')]=_0x30bdc3;if(_0x3b2bd4[_0x4b3a('0x2f')]['includeAll']){_0x57ae56[_0x4b3a('0x41')]=[{'all':!![]}];}return db[_0x4b3a('0x3f')][_0x4b3a('0x42')](_0x57ae56);})[_0x4b3a('0x40')](function(_0x2ff35e){_0x48b80f[_0x4b3a('0x43')]=_0x2ff35e;return _0x48b80f;})[_0x4b3a('0x40')](respondWithFilteredResult(_0x509fcd,_0x57ae56))[_0x4b3a('0x44')](handleError(_0x509fcd,null));};exports['show']=function(_0x3b7860,_0x457fec){var _0x2d231e={'raw':!![],'where':{'id':_0x3b7860['params']['id']}},_0x1132c4={};_0x1132c4[_0x4b3a('0x2e')]=_[_0x4b3a('0x30')](db[_0x4b3a('0x3f')][_0x4b3a('0x2a')]);_0x1132c4[_0x4b3a('0x2f')]=_[_0x4b3a('0x30')](_0x3b7860[_0x4b3a('0x2f')]);_0x1132c4[_0x4b3a('0x31')]=_['intersection'](_0x1132c4['model'],_0x1132c4['query']);_0x2d231e[_0x4b3a('0x32')]=_[_0x4b3a('0x33')](_0x1132c4[_0x4b3a('0x2e')],qs[_0x4b3a('0x34')](_0x3b7860['query'][_0x4b3a('0x34')]));_0x2d231e[_0x4b3a('0x32')]=_0x2d231e[_0x4b3a('0x32')]['length']?_0x2d231e[_0x4b3a('0x32')]:_0x1132c4[_0x4b3a('0x2e')];if(_0x3b7860['query'][_0x4b3a('0x45')]){_0x2d231e[_0x4b3a('0x41')]=[{'all':!![]}];}_0x2d231e=_['merge']({},_0x2d231e,_0x3b7860[_0x4b3a('0x3e')]);return db[_0x4b3a('0x3f')][_0x4b3a('0x46')](_0x2d231e)[_0x4b3a('0x40')](handleEntityNotFound(_0x457fec,null))[_0x4b3a('0x40')](respondWithResult(_0x457fec,null))['catch'](handleError(_0x457fec,null));};exports['create']=function(_0x51a173,_0x206aeb){return db[_0x4b3a('0x3f')]['create'](_0x51a173[_0x4b3a('0x47')],{})[_0x4b3a('0x40')](respondWithResult(_0x206aeb,0xc9))[_0x4b3a('0x44')](handleError(_0x206aeb,null));};exports[_0x4b3a('0x23')]=function(_0x22ae37,_0x1490e2){if(_0x22ae37[_0x4b3a('0x47')]['id']){delete _0x22ae37[_0x4b3a('0x47')]['id'];}return db[_0x4b3a('0x3f')][_0x4b3a('0x46')]({'where':{'id':_0x22ae37[_0x4b3a('0x48')]['id']}})[_0x4b3a('0x40')](handleEntityNotFound(_0x1490e2,null))[_0x4b3a('0x40')](saveUpdates(_0x22ae37['body'],null))['then'](respondWithResult(_0x1490e2,null))[_0x4b3a('0x44')](handleError(_0x1490e2,null));};exports[_0x4b3a('0x24')]=function(_0x1c8b01,_0x2991ab){return db[_0x4b3a('0x3f')][_0x4b3a('0x46')]({'where':{'id':_0x1c8b01[_0x4b3a('0x48')]['id']}})['then'](handleEntityNotFound(_0x2991ab,null))[_0x4b3a('0x40')](removeEntity(_0x2991ab,null))[_0x4b3a('0x44')](handleError(_0x2991ab,null));};exports[_0x4b3a('0x49')]=function(_0x39d33e,_0xcf1510){return db[_0x4b3a('0x3f')][_0x4b3a('0x49')]()[_0x4b3a('0x40')](respondWithResult(_0xcf1510,null))[_0x4b3a('0x44')](handleError(_0xcf1510,null));}; \ No newline at end of file +var _0xc60f=['fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsQueueReport','includeAll','findAll','rows','catch','show','params','keys','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','send','map','rawAttributes'];(function(_0x2c3a88,_0x48637e){var _0x4a7925=function(_0x15780f){while(--_0x15780f){_0x2c3a88['push'](_0x2c3a88['shift']());}};_0x4a7925(++_0x48637e);}(_0xc60f,0x15c));var _0xfc60=function(_0xe5b3e1,_0x57a645){_0xe5b3e1=_0xe5b3e1-0x0;var _0x121dad=_0xc60f[_0xe5b3e1];return _0x121dad;};'use strict';var emlformat=require(_0xfc60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc60('0x1'));var jsonpatch=require(_0xfc60('0x2'));var rp=require(_0xfc60('0x3'));var moment=require(_0xfc60('0x4'));var BPromise=require(_0xfc60('0x5'));var Mustache=require(_0xfc60('0x6'));var util=require(_0xfc60('0x7'));var path=require(_0xfc60('0x8'));var sox=require('sox');var csv=require(_0xfc60('0x9'));var ejs=require(_0xfc60('0xa'));var fs=require('fs');var fs_extra=require(_0xfc60('0xb'));var _=require(_0xfc60('0xc'));var squel=require(_0xfc60('0xd'));var crypto=require(_0xfc60('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfc60('0xf'));var toCsv=require(_0xfc60('0x9'));var querystring=require(_0xfc60('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc60('0x11'));var authService=require(_0xfc60('0x12'));var qs=require(_0xfc60('0x13'));var as=require(_0xfc60('0x14'));var hardwareService=require(_0xfc60('0x15'));var logger=require('../../config/logger')(_0xfc60('0x16'));var utils=require(_0xfc60('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfc60('0x18'))['db'];function respondWithStatusCode(_0x18ef36,_0x1ff89a){_0x1ff89a=_0x1ff89a||0xcc;return function(_0x11047b){if(_0x11047b){return _0x18ef36['sendStatus'](_0x1ff89a);}return _0x18ef36['status'](_0x1ff89a)[_0xfc60('0x19')]();};}function respondWithResult(_0x46e2c9,_0x500b67){_0x500b67=_0x500b67||0xc8;return function(_0x17dee7){if(_0x17dee7){return _0x46e2c9['status'](_0x500b67)[_0xfc60('0x1a')](_0x17dee7);}};}function respondWithFilteredResult(_0x4f41b7,_0x119b82){return function(_0xa55e5e){if(_0xa55e5e){var _0x1e204b=typeof _0x119b82[_0xfc60('0x1b')]===_0xfc60('0x1c')&&typeof _0x119b82['limit']===_0xfc60('0x1c');var _0x52371=_0xa55e5e['count'];var _0x3e9ff0=_0x1e204b?0x0:_0x119b82[_0xfc60('0x1b')];var _0xe743ff=_0x1e204b?_0xa55e5e[_0xfc60('0x1d')]:_0x119b82[_0xfc60('0x1b')]+_0x119b82[_0xfc60('0x1e')];var _0x257429;if(_0xe743ff>=_0x52371){_0xe743ff=_0x52371;_0x257429=0xc8;}else{_0x257429=0xce;}_0x4f41b7['status'](_0x257429);return _0x4f41b7[_0xfc60('0x1f')](_0xfc60('0x20'),_0x3e9ff0+'-'+_0xe743ff+'/'+_0x52371)['json'](_0xa55e5e);}return null;};}function patchUpdates(_0x1af9bb){return function(_0x13395f){try{jsonpatch[_0xfc60('0x21')](_0x13395f,_0x1af9bb,!![]);}catch(_0x52b15b){return BPromise[_0xfc60('0x22')](_0x52b15b);}return _0x13395f[_0xfc60('0x23')]();};}function saveUpdates(_0x336219,_0x26d904){return function(_0x821783){if(_0x821783){return _0x821783[_0xfc60('0x24')](_0x336219)[_0xfc60('0x25')](function(_0x2d2289){return _0x2d2289;});}return null;};}function removeEntity(_0x32e7ff,_0x32faa5){return function(_0x1b0e6b){if(_0x1b0e6b){return _0x1b0e6b[_0xfc60('0x26')]()[_0xfc60('0x25')](function(){_0x32e7ff[_0xfc60('0x27')](0xcc)[_0xfc60('0x19')]();});}};}function handleEntityNotFound(_0x20f543,_0x2c4d0a){return function(_0x5188c5){if(!_0x5188c5){_0x20f543[_0xfc60('0x28')](0x194);}return _0x5188c5;};}function handleError(_0x57094c,_0x10d137){_0x10d137=_0x10d137||0x1f4;return function(_0x3d487a){logger[_0xfc60('0x29')](_0x3d487a[_0xfc60('0x2a')]);if(_0x3d487a['name']){delete _0x3d487a[_0xfc60('0x2b')];}_0x57094c[_0xfc60('0x27')](_0x10d137)[_0xfc60('0x2c')](_0x3d487a);};}exports['index']=function(_0x59bc4b,_0x12a682){var _0x54cd63={},_0x26d8ca={},_0x4def70={'count':0x0,'rows':[]};var _0x3dd39f=_[_0xfc60('0x2d')](db['SmsQueueReport'][_0xfc60('0x2e')],function(_0x20843a){return{'name':_0x20843a[_0xfc60('0x2f')],'type':_0x20843a[_0xfc60('0x30')][_0xfc60('0x31')]};});_0x26d8ca[_0xfc60('0x32')]=_[_0xfc60('0x2d')](_0x3dd39f,_0xfc60('0x2b'));_0x26d8ca['query']=_['keys'](_0x59bc4b[_0xfc60('0x33')]);_0x26d8ca[_0xfc60('0x34')]=_[_0xfc60('0x35')](_0x26d8ca[_0xfc60('0x32')],_0x26d8ca['query']);_0x54cd63[_0xfc60('0x36')]=_['intersection'](_0x26d8ca[_0xfc60('0x32')],qs['fields'](_0x59bc4b[_0xfc60('0x33')][_0xfc60('0x37')]));_0x54cd63[_0xfc60('0x36')]=_0x54cd63['attributes'][_0xfc60('0x38')]?_0x54cd63[_0xfc60('0x36')]:_0x26d8ca['model'];if(!_0x59bc4b[_0xfc60('0x33')][_0xfc60('0x39')](_0xfc60('0x3a'))){_0x54cd63['limit']=qs[_0xfc60('0x1e')](_0x59bc4b['query']['limit']);_0x54cd63['offset']=qs[_0xfc60('0x1b')](_0x59bc4b[_0xfc60('0x33')][_0xfc60('0x1b')]);}_0x54cd63[_0xfc60('0x3b')]=qs[_0xfc60('0x3c')](_0x59bc4b[_0xfc60('0x33')][_0xfc60('0x3c')]);_0x54cd63[_0xfc60('0x3d')]=qs[_0xfc60('0x34')](_[_0xfc60('0x3e')](_0x59bc4b[_0xfc60('0x33')],_0x26d8ca[_0xfc60('0x34')]),_0x3dd39f);if(_0x59bc4b['query']['filter']){_0x54cd63['where']=_[_0xfc60('0x3f')](_0x54cd63['where'],{'$or':_['map'](_0x3dd39f,function(_0x30cedd){if(_0x30cedd[_0xfc60('0x30')]!==_0xfc60('0x40')){var _0x468e0b={};_0x468e0b[_0x30cedd[_0xfc60('0x2b')]]={'$like':'%'+_0x59bc4b['query'][_0xfc60('0x41')]+'%'};return _0x468e0b;}})});}_0x54cd63=_[_0xfc60('0x3f')]({},_0x54cd63,_0x59bc4b[_0xfc60('0x42')]);var _0x1e24e3={'where':_0x54cd63[_0xfc60('0x3d')]};return db[_0xfc60('0x43')][_0xfc60('0x1d')](_0x1e24e3)[_0xfc60('0x25')](function(_0x5358e3){_0x4def70[_0xfc60('0x1d')]=_0x5358e3;if(_0x59bc4b[_0xfc60('0x33')][_0xfc60('0x44')]){_0x54cd63['include']=[{'all':!![]}];}return db[_0xfc60('0x43')][_0xfc60('0x45')](_0x54cd63);})[_0xfc60('0x25')](function(_0x1a2875){_0x4def70[_0xfc60('0x46')]=_0x1a2875;return _0x4def70;})[_0xfc60('0x25')](respondWithFilteredResult(_0x12a682,_0x54cd63))[_0xfc60('0x47')](handleError(_0x12a682,null));};exports[_0xfc60('0x48')]=function(_0x2b7989,_0xf89cdf){var _0x140f3e={'raw':!![],'where':{'id':_0x2b7989[_0xfc60('0x49')]['id']}},_0x626c1b={};_0x626c1b[_0xfc60('0x32')]=_[_0xfc60('0x4a')](db['SmsQueueReport'][_0xfc60('0x2e')]);_0x626c1b[_0xfc60('0x33')]=_[_0xfc60('0x4a')](_0x2b7989[_0xfc60('0x33')]);_0x626c1b[_0xfc60('0x34')]=_[_0xfc60('0x35')](_0x626c1b[_0xfc60('0x32')],_0x626c1b[_0xfc60('0x33')]);_0x140f3e[_0xfc60('0x36')]=_[_0xfc60('0x35')](_0x626c1b[_0xfc60('0x32')],qs[_0xfc60('0x37')](_0x2b7989['query'][_0xfc60('0x37')]));_0x140f3e[_0xfc60('0x36')]=_0x140f3e[_0xfc60('0x36')]['length']?_0x140f3e[_0xfc60('0x36')]:_0x626c1b[_0xfc60('0x32')];if(_0x2b7989[_0xfc60('0x33')]['includeAll']){_0x140f3e['include']=[{'all':!![]}];}_0x140f3e=_[_0xfc60('0x3f')]({},_0x140f3e,_0x2b7989[_0xfc60('0x42')]);return db['SmsQueueReport']['find'](_0x140f3e)[_0xfc60('0x25')](handleEntityNotFound(_0xf89cdf,null))['then'](respondWithResult(_0xf89cdf,null))[_0xfc60('0x47')](handleError(_0xf89cdf,null));};exports[_0xfc60('0x4b')]=function(_0xca568f,_0xbf89d1){return db[_0xfc60('0x43')][_0xfc60('0x4b')](_0xca568f['body'],{})[_0xfc60('0x25')](respondWithResult(_0xbf89d1,0xc9))[_0xfc60('0x47')](handleError(_0xbf89d1,null));};exports[_0xfc60('0x24')]=function(_0x231056,_0xf0e98){if(_0x231056[_0xfc60('0x4c')]['id']){delete _0x231056['body']['id'];}return db[_0xfc60('0x43')][_0xfc60('0x4d')]({'where':{'id':_0x231056['params']['id']}})['then'](handleEntityNotFound(_0xf0e98,null))['then'](saveUpdates(_0x231056['body'],null))[_0xfc60('0x25')](respondWithResult(_0xf0e98,null))[_0xfc60('0x47')](handleError(_0xf0e98,null));};exports[_0xfc60('0x26')]=function(_0x5b73e8,_0x317cfc){return db[_0xfc60('0x43')][_0xfc60('0x4d')]({'where':{'id':_0x5b73e8['params']['id']}})[_0xfc60('0x25')](handleEntityNotFound(_0x317cfc,null))['then'](removeEntity(_0x317cfc,null))[_0xfc60('0x47')](handleError(_0x317cfc,null));};exports['describe']=function(_0x4c139e,_0xd29df6){return db[_0xfc60('0x43')][_0xfc60('0x4e')]()['then'](respondWithResult(_0xd29df6,null))[_0xfc60('0x47')](handleError(_0xd29df6,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5bc70b0..cac6a8a 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ec92e,_0x50e39e){var _0x5a7f21=function(_0x8cd094){while(--_0x8cd094){_0x3ec92e['push'](_0x3ec92e['shift']());}};_0x5a7f21(++_0x50e39e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 63c100b..1454f89 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 _0xf857=['options','raw','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x4f772b,_0x5d3dac){var _0x5826be=function(_0x246dcb){while(--_0x246dcb){_0x4f772b['push'](_0x4f772b['shift']());}};_0x5826be(++_0x5d3dac);}(_0xf857,0xda));var _0x7f85=function(_0x538496,_0x7fb951){_0x538496=_0x538496-0x0;var _0x290912=_0xf857[_0x538496];return _0x290912;};'use strict';var _=require(_0x7f85('0x0'));var util=require(_0x7f85('0x1'));var moment=require(_0x7f85('0x2'));var BPromise=require(_0x7f85('0x3'));var rs=require(_0x7f85('0x4'));var fs=require('fs');var Redis=require(_0x7f85('0x5'));var db=require(_0x7f85('0x6'))['db'];var utils=require(_0x7f85('0x7'));var logger=require(_0x7f85('0x8'))(_0x7f85('0x9'));var config=require(_0x7f85('0xa'));var jayson=require(_0x7f85('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38446e,_0xd4d7f1,_0x3e1d82){return new BPromise(function(_0xff97,_0x1a6409){return client[_0x7f85('0xc')](_0x38446e,_0x3e1d82)[_0x7f85('0xd')](function(_0x234e2d){logger[_0x7f85('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0xd4d7f1,_0x7f85('0xf'));logger[_0x7f85('0x10')](_0x7f85('0x11'),_0xd4d7f1,'request\x20sent',JSON[_0x7f85('0x12')](_0x234e2d));if(_0x234e2d[_0x7f85('0x13')]){if(_0x234e2d[_0x7f85('0x13')][_0x7f85('0x14')]===0x1f4){logger[_0x7f85('0x13')](_0x7f85('0x15'),_0xd4d7f1,_0x234e2d['error'][_0x7f85('0x16')]);return _0x1a6409(_0x234e2d['error'][_0x7f85('0x16')]);}logger[_0x7f85('0x13')](_0x7f85('0x15'),_0xd4d7f1,_0x234e2d[_0x7f85('0x13')][_0x7f85('0x16')]);return _0xff97(_0x234e2d['error'][_0x7f85('0x16')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0xd4d7f1,_0x7f85('0xf'));_0xff97(_0x234e2d['result'][_0x7f85('0x16')]);}})[_0x7f85('0x17')](function(_0x2365c3){logger['error'](_0x7f85('0x15'),_0xd4d7f1,_0x2365c3);_0x1a6409(_0x2365c3);});});}exports[_0x7f85('0x18')]=function(_0x427603){var _0x537229=this;return new Promise(function(_0x10720c,_0x5a99d4){return db[_0x7f85('0x19')][_0x7f85('0x1a')](_0x427603['body'],{'raw':_0x427603[_0x7f85('0x1b')]?_0x427603[_0x7f85('0x1b')][_0x7f85('0x1c')]===undefined?!![]:![]:!![]})[_0x7f85('0xd')](function(_0x87091d){logger[_0x7f85('0xe')](_0x7f85('0x18'),_0x427603);logger[_0x7f85('0x10')](_0x7f85('0x18'),_0x427603,JSON[_0x7f85('0x12')](_0x87091d));_0x10720c(_0x87091d);})[_0x7f85('0x17')](function(_0x4ed004){logger[_0x7f85('0x13')]('CreateSmsQueueReport',_0x4ed004['message'],_0x427603);_0x5a99d4(_0x537229['error'](0x1f4,_0x4ed004[_0x7f85('0x16')]));});});};exports[_0x7f85('0x1d')]=function(_0x333eff){var _0x13e484=this;return new Promise(function(_0x3d9741,_0x5652c0){return db['SmsQueueReport'][_0x7f85('0x1e')](_0x333eff[_0x7f85('0x1f')],{'raw':_0x333eff[_0x7f85('0x1b')]?_0x333eff[_0x7f85('0x1b')][_0x7f85('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x333eff[_0x7f85('0x1b')]?_0x333eff[_0x7f85('0x1b')][_0x7f85('0x20')]||null:null,'attributes':_0x333eff[_0x7f85('0x1b')]?_0x333eff[_0x7f85('0x1b')][_0x7f85('0x21')]||null:null,'limit':_0x333eff['options']?_0x333eff[_0x7f85('0x1b')][_0x7f85('0x22')]||null:null})[_0x7f85('0xd')](function(_0x499f0d){logger[_0x7f85('0xe')]('UpdateSmsQueueReport',_0x333eff);logger[_0x7f85('0x10')](_0x7f85('0x1d'),_0x333eff,JSON[_0x7f85('0x12')](_0x499f0d));_0x3d9741(_0x499f0d);})[_0x7f85('0x17')](function(_0x40339c){logger['error'](_0x7f85('0x1d'),_0x40339c['message'],_0x333eff);_0x5652c0(_0x13e484['error'](0x1f4,_0x40339c[_0x7f85('0x16')]));});});}; \ No newline at end of file +var _0x635f=['code','message','catch','CreateSmsQueueReport','create','body','options','raw','info','SmsQueueReport','update','attributes','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0x635f,0x12d));var _0xf635=function(_0x149b7e,_0x62de3b){_0x149b7e=_0x149b7e-0x0;var _0x188b71=_0x635f[_0x149b7e];return _0x188b71;};'use strict';var _=require(_0xf635('0x0'));var util=require(_0xf635('0x1'));var moment=require(_0xf635('0x2'));var BPromise=require(_0xf635('0x3'));var rs=require(_0xf635('0x4'));var fs=require('fs');var Redis=require(_0xf635('0x5'));var db=require(_0xf635('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf635('0x7'))(_0xf635('0x8'));var config=require(_0xf635('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf635('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xef424c,_0x1fa878,_0x11e397){return new BPromise(function(_0x23066f,_0xdab9cc){return client[_0xf635('0xb')](_0xef424c,_0x11e397)[_0xf635('0xc')](function(_0x193615){logger['info'](_0xf635('0xd'),_0x1fa878,'request\x20sent');logger[_0xf635('0xe')](_0xf635('0xf'),_0x1fa878,_0xf635('0x10'),JSON[_0xf635('0x11')](_0x193615));if(_0x193615[_0xf635('0x12')]){if(_0x193615[_0xf635('0x12')][_0xf635('0x13')]===0x1f4){logger[_0xf635('0x12')](_0xf635('0xd'),_0x1fa878,_0x193615['error'][_0xf635('0x14')]);return _0xdab9cc(_0x193615[_0xf635('0x12')][_0xf635('0x14')]);}logger[_0xf635('0x12')](_0xf635('0xd'),_0x1fa878,_0x193615[_0xf635('0x12')][_0xf635('0x14')]);return _0x23066f(_0x193615[_0xf635('0x12')][_0xf635('0x14')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x1fa878,_0xf635('0x10'));_0x23066f(_0x193615['result'][_0xf635('0x14')]);}})[_0xf635('0x15')](function(_0xeb37c1){logger[_0xf635('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x1fa878,_0xeb37c1);_0xdab9cc(_0xeb37c1);});});}exports[_0xf635('0x16')]=function(_0x4ddf21){var _0x24f691=this;return new Promise(function(_0x5d7785,_0x5c9fe8){return db['SmsQueueReport'][_0xf635('0x17')](_0x4ddf21[_0xf635('0x18')],{'raw':_0x4ddf21['options']?_0x4ddf21[_0xf635('0x19')][_0xf635('0x1a')]===undefined?!![]:![]:!![]})[_0xf635('0xc')](function(_0x650f13){logger[_0xf635('0x1b')](_0xf635('0x16'),_0x4ddf21);logger[_0xf635('0xe')](_0xf635('0x16'),_0x4ddf21,JSON[_0xf635('0x11')](_0x650f13));_0x5d7785(_0x650f13);})[_0xf635('0x15')](function(_0x1ea035){logger[_0xf635('0x12')](_0xf635('0x16'),_0x1ea035[_0xf635('0x14')],_0x4ddf21);_0x5c9fe8(_0x24f691[_0xf635('0x12')](0x1f4,_0x1ea035['message']));});});};exports['UpdateSmsQueueReport']=function(_0x60cf0e){var _0x5b6f26=this;return new Promise(function(_0x408a51,_0x2b3f1f){return db[_0xf635('0x1c')][_0xf635('0x1d')](_0x60cf0e[_0xf635('0x18')],{'raw':_0x60cf0e[_0xf635('0x19')]?_0x60cf0e[_0xf635('0x19')][_0xf635('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x60cf0e[_0xf635('0x19')]?_0x60cf0e[_0xf635('0x19')]['where']||null:null,'attributes':_0x60cf0e['options']?_0x60cf0e[_0xf635('0x19')][_0xf635('0x1e')]||null:null,'limit':_0x60cf0e[_0xf635('0x19')]?_0x60cf0e[_0xf635('0x19')]['limit']||null:null})[_0xf635('0xc')](function(_0x412499){logger[_0xf635('0x1b')]('UpdateSmsQueueReport',_0x60cf0e);logger[_0xf635('0xe')](_0xf635('0x1f'),_0x60cf0e,JSON[_0xf635('0x11')](_0x412499));_0x408a51(_0x412499);})[_0xf635('0x15')](function(_0x50faef){logger['error'](_0xf635('0x1f'),_0x50faef[_0xf635('0x14')],_0x60cf0e);_0x2b3f1f(_0x5b6f26[_0xf635('0x12')](0x1f4,_0x50faef['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 03613b9..1e9ab50 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 _0xa3e6=['express','Router','fs-extra','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','describe','put','update','delete','/:id','destroy','multer','path'];(function(_0x5b278d,_0x1a3a8d){var _0x1777da=function(_0x37de6c){while(--_0x37de6c){_0x5b278d['push'](_0x5b278d['shift']());}};_0x1777da(++_0x1a3a8d);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x395007,_0x23ee1d){_0x395007=_0x395007-0x0;var _0x1dc2d0=_0xa3e6[_0x395007];return _0x1dc2d0;};'use strict';var multer=require(_0x6a3e('0x0'));var util=require('util');var path=require(_0x6a3e('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a3e('0x2'));var router=express[_0x6a3e('0x3')]();var fs_extra=require(_0x6a3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a3e('0x5'));var config=require('../../config/environment');var controller=require(_0x6a3e('0x6'));router[_0x6a3e('0x7')]('/',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0x9')]);router[_0x6a3e('0x7')]('/describe',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xa')]);router['get']('/:id',auth[_0x6a3e('0x8')](),controller['show']);router['post']('/',auth[_0x6a3e('0x8')](),controller['create']);router[_0x6a3e('0xb')]('/:id',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xc')]);router[_0x6a3e('0xd')](_0x6a3e('0xe'),auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x425d=['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','exports','multer','path','connect-timeout'];(function(_0x10abfe,_0x7a9ad6){var _0x473c1b=function(_0x392758){while(--_0x392758){_0x10abfe['push'](_0x10abfe['shift']());}};_0x473c1b(++_0x7a9ad6);}(_0x425d,0x1e0));var _0xd425=function(_0x3e3748,_0x118608){_0x3e3748=_0x3e3748-0x0;var _0x467996=_0x425d[_0x3e3748];return _0x467996;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0xb')]);router[_0xd425('0x9')](_0xd425('0xc'),auth['isAuthenticated'](),controller[_0xd425('0xd')]);router[_0xd425('0x9')](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0x11')]);router[_0xd425('0x12')](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0x13')]);router[_0xd425('0x14')](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0x15')]);module[_0xd425('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ebe61a0..385b18b 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0xe2a016,_0x493eef){var _0x5aece2=function(_0x4926eb){while(--_0x4926eb){_0xe2a016['push'](_0xe2a016['shift']());}};_0x5aece2(++_0x493eef);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x3618ea,_0x8c8578){var _0x3cbe77=function(_0x51c002){while(--_0x51c002){_0x3618ea['push'](_0x3618ea['shift']());}};_0x3cbe77(++_0x8c8578);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3dba6f,_0x35592f){_0x3dba6f=_0x3dba6f-0x0;var _0x34b95d=_0xf4eb[_0x3dba6f];return _0x34b95d;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 6b5aab0..9240fd9 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 _0x850f=['rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','describe','eml-format','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','SmsTransferReport'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x850f,0xfe));var _0xf850=function(_0x2785f2,_0x170dce){_0x2785f2=_0x2785f2-0x0;var _0x39ad95=_0x850f[_0x2785f2];return _0x39ad95;};'use strict';var emlformat=require(_0xf850('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf850('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf850('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf850('0x3'));var path=require(_0xf850('0x4'));var sox=require(_0xf850('0x5'));var csv=require(_0xf850('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf850('0x7'));var _=require(_0xf850('0x8'));var squel=require('squel');var crypto=require(_0xf850('0x9'));var jsforce=require(_0xf850('0xa'));var deskjs=require(_0xf850('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf850('0xc'));var Redis=require(_0xf850('0xd'));var authService=require(_0xf850('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf850('0xf'));var hardwareService=require(_0xf850('0x10'));var logger=require(_0xf850('0x11'))('api');var utils=require(_0xf850('0x12'));var config=require(_0xf850('0x13'));var licenseUtil=require(_0xf850('0x14'));var db=require(_0xf850('0x15'))['db'];function respondWithStatusCode(_0x452615,_0x8955a2){_0x8955a2=_0x8955a2||0xcc;return function(_0x47d06a){if(_0x47d06a){return _0x452615['sendStatus'](_0x8955a2);}return _0x452615['status'](_0x8955a2)[_0xf850('0x16')]();};}function respondWithResult(_0x100c7,_0x48dea0){_0x48dea0=_0x48dea0||0xc8;return function(_0xef7535){if(_0xef7535){return _0x100c7[_0xf850('0x17')](_0x48dea0)[_0xf850('0x18')](_0xef7535);}};}function respondWithFilteredResult(_0xfefdb3,_0x197b3b){return function(_0x1ecd6c){if(_0x1ecd6c){var _0xb6d1d3=typeof _0x197b3b[_0xf850('0x19')]===_0xf850('0x1a')&&typeof _0x197b3b[_0xf850('0x1b')]===_0xf850('0x1a');var _0x111f96=_0x1ecd6c[_0xf850('0x1c')];var _0x2eff22=_0xb6d1d3?0x0:_0x197b3b[_0xf850('0x19')];var _0x45a7ae=_0xb6d1d3?_0x1ecd6c[_0xf850('0x1c')]:_0x197b3b[_0xf850('0x19')]+_0x197b3b[_0xf850('0x1b')];var _0x1c0f5c;if(_0x45a7ae>=_0x111f96){_0x45a7ae=_0x111f96;_0x1c0f5c=0xc8;}else{_0x1c0f5c=0xce;}_0xfefdb3['status'](_0x1c0f5c);return _0xfefdb3[_0xf850('0x1d')](_0xf850('0x1e'),_0x2eff22+'-'+_0x45a7ae+'/'+_0x111f96)[_0xf850('0x18')](_0x1ecd6c);}return null;};}function patchUpdates(_0x56da0b){return function(_0x25f9b2){try{jsonpatch[_0xf850('0x1f')](_0x25f9b2,_0x56da0b,!![]);}catch(_0x30b1a2){return BPromise[_0xf850('0x20')](_0x30b1a2);}return _0x25f9b2[_0xf850('0x21')]();};}function saveUpdates(_0x8f5daa,_0x53ce2f){return function(_0x3d7ab5){if(_0x3d7ab5){return _0x3d7ab5['update'](_0x8f5daa)[_0xf850('0x22')](function(_0xf1e8d1){return _0xf1e8d1;});}return null;};}function removeEntity(_0xd04532,_0xf9ed7d){return function(_0x474a51){if(_0x474a51){return _0x474a51['destroy']()[_0xf850('0x22')](function(){_0xd04532[_0xf850('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3360de,_0x1bca50){return function(_0x2b893d){if(!_0x2b893d){_0x3360de[_0xf850('0x23')](0x194);}return _0x2b893d;};}function handleError(_0x21fa45,_0x219e36){_0x219e36=_0x219e36||0x1f4;return function(_0x339767){logger[_0xf850('0x24')](_0x339767['stack']);if(_0x339767[_0xf850('0x25')]){delete _0x339767[_0xf850('0x25')];}_0x21fa45[_0xf850('0x17')](_0x219e36)[_0xf850('0x26')](_0x339767);};}exports[_0xf850('0x27')]=function(_0x310fd4,_0x47e7d9){var _0x313d74={},_0x21ab43={},_0x565c5d={'count':0x0,'rows':[]};var _0x37faad=_[_0xf850('0x28')](db[_0xf850('0x29')][_0xf850('0x2a')],function(_0x44950d){return{'name':_0x44950d[_0xf850('0x2b')],'type':_0x44950d[_0xf850('0x2c')][_0xf850('0x2d')]};});_0x21ab43['model']=_[_0xf850('0x28')](_0x37faad,_0xf850('0x25'));_0x21ab43[_0xf850('0x2e')]=_['keys'](_0x310fd4[_0xf850('0x2e')]);_0x21ab43[_0xf850('0x2f')]=_[_0xf850('0x30')](_0x21ab43[_0xf850('0x31')],_0x21ab43[_0xf850('0x2e')]);_0x313d74['attributes']=_['intersection'](_0x21ab43[_0xf850('0x31')],qs[_0xf850('0x32')](_0x310fd4[_0xf850('0x2e')][_0xf850('0x32')]));_0x313d74[_0xf850('0x33')]=_0x313d74['attributes'][_0xf850('0x34')]?_0x313d74[_0xf850('0x33')]:_0x21ab43[_0xf850('0x31')];if(!_0x310fd4['query']['hasOwnProperty'](_0xf850('0x35'))){_0x313d74[_0xf850('0x1b')]=qs[_0xf850('0x1b')](_0x310fd4[_0xf850('0x2e')]['limit']);_0x313d74[_0xf850('0x19')]=qs[_0xf850('0x19')](_0x310fd4[_0xf850('0x2e')][_0xf850('0x19')]);}_0x313d74[_0xf850('0x36')]=qs[_0xf850('0x37')](_0x310fd4['query']['sort']);_0x313d74[_0xf850('0x38')]=qs[_0xf850('0x2f')](_['pick'](_0x310fd4[_0xf850('0x2e')],_0x21ab43['filters']),_0x37faad);if(_0x310fd4['query'][_0xf850('0x39')]){_0x313d74[_0xf850('0x38')]=_[_0xf850('0x3a')](_0x313d74[_0xf850('0x38')],{'$or':_[_0xf850('0x28')](_0x37faad,function(_0xbbf648){if(_0xbbf648[_0xf850('0x2c')]!==_0xf850('0x3b')){var _0xa9ed47={};_0xa9ed47[_0xbbf648[_0xf850('0x25')]]={'$like':'%'+_0x310fd4[_0xf850('0x2e')][_0xf850('0x39')]+'%'};return _0xa9ed47;}})});}_0x313d74=_[_0xf850('0x3a')]({},_0x313d74,_0x310fd4['options']);var _0x115caf={'where':_0x313d74[_0xf850('0x38')]};return db['SmsTransferReport']['count'](_0x115caf)[_0xf850('0x22')](function(_0x94e2d5){_0x565c5d[_0xf850('0x1c')]=_0x94e2d5;if(_0x310fd4['query'][_0xf850('0x3c')]){_0x313d74[_0xf850('0x3d')]=[{'all':!![]}];}return db[_0xf850('0x29')][_0xf850('0x3e')](_0x313d74);})['then'](function(_0x3e0d88){_0x565c5d[_0xf850('0x3f')]=_0x3e0d88;return _0x565c5d;})[_0xf850('0x22')](respondWithFilteredResult(_0x47e7d9,_0x313d74))[_0xf850('0x40')](handleError(_0x47e7d9,null));};exports[_0xf850('0x41')]=function(_0x23f217,_0x25c9f1){var _0x2e76d2={'raw':!![],'where':{'id':_0x23f217[_0xf850('0x42')]['id']}},_0x51d10b={};_0x51d10b[_0xf850('0x31')]=_[_0xf850('0x43')](db[_0xf850('0x29')]['rawAttributes']);_0x51d10b[_0xf850('0x2e')]=_[_0xf850('0x43')](_0x23f217[_0xf850('0x2e')]);_0x51d10b[_0xf850('0x2f')]=_[_0xf850('0x30')](_0x51d10b[_0xf850('0x31')],_0x51d10b[_0xf850('0x2e')]);_0x2e76d2[_0xf850('0x33')]=_[_0xf850('0x30')](_0x51d10b[_0xf850('0x31')],qs[_0xf850('0x32')](_0x23f217[_0xf850('0x2e')]['fields']));_0x2e76d2[_0xf850('0x33')]=_0x2e76d2[_0xf850('0x33')][_0xf850('0x34')]?_0x2e76d2[_0xf850('0x33')]:_0x51d10b['model'];if(_0x23f217[_0xf850('0x2e')][_0xf850('0x3c')]){_0x2e76d2[_0xf850('0x3d')]=[{'all':!![]}];}_0x2e76d2=_[_0xf850('0x3a')]({},_0x2e76d2,_0x23f217[_0xf850('0x44')]);return db['SmsTransferReport'][_0xf850('0x45')](_0x2e76d2)['then'](handleEntityNotFound(_0x25c9f1,null))[_0xf850('0x22')](respondWithResult(_0x25c9f1,null))[_0xf850('0x40')](handleError(_0x25c9f1,null));};exports['create']=function(_0xfd72cc,_0x276d50){return db[_0xf850('0x29')][_0xf850('0x46')](_0xfd72cc[_0xf850('0x47')],{})[_0xf850('0x22')](respondWithResult(_0x276d50,0xc9))[_0xf850('0x40')](handleError(_0x276d50,null));};exports[_0xf850('0x48')]=function(_0x400b87,_0x4d7721){if(_0x400b87[_0xf850('0x47')]['id']){delete _0x400b87['body']['id'];}return db['SmsTransferReport'][_0xf850('0x45')]({'where':{'id':_0x400b87[_0xf850('0x42')]['id']}})[_0xf850('0x22')](handleEntityNotFound(_0x4d7721,null))['then'](saveUpdates(_0x400b87['body'],null))[_0xf850('0x22')](respondWithResult(_0x4d7721,null))[_0xf850('0x40')](handleError(_0x4d7721,null));};exports['destroy']=function(_0x3876a0,_0xbf345){return db['SmsTransferReport'][_0xf850('0x45')]({'where':{'id':_0x3876a0[_0xf850('0x42')]['id']}})[_0xf850('0x22')](handleEntityNotFound(_0xbf345,null))['then'](removeEntity(_0xbf345,null))[_0xf850('0x40')](handleError(_0xbf345,null));};exports['describe']=function(_0x5d73ad,_0x3e2c3f){return db[_0xf850('0x29')][_0xf850('0x49')]()[_0xf850('0x22')](respondWithResult(_0x3e2c3f,null))['catch'](handleError(_0x3e2c3f,null));}; \ No newline at end of file +var _0x4ada=['util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','merge','VIRTUAL','SmsTransferReport','include','findAll','catch','show','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x25ec20,_0x6fd010){var _0x432c5=function(_0x29e714){while(--_0x29e714){_0x25ec20['push'](_0x25ec20['shift']());}};_0x432c5(++_0x6fd010);}(_0x4ada,0x1e9));var _0xa4ad=function(_0x3b26f2,_0x2e2ebb){_0x3b26f2=_0x3b26f2-0x0;var _0x587521=_0x4ada[_0x3b26f2];return _0x587521;};'use strict';var emlformat=require(_0xa4ad('0x0'));var rimraf=require(_0xa4ad('0x1'));var zipdir=require(_0xa4ad('0x2'));var jsonpatch=require(_0xa4ad('0x3'));var rp=require(_0xa4ad('0x4'));var moment=require(_0xa4ad('0x5'));var BPromise=require(_0xa4ad('0x6'));var Mustache=require(_0xa4ad('0x7'));var util=require(_0xa4ad('0x8'));var path=require(_0xa4ad('0x9'));var sox=require('sox');var csv=require(_0xa4ad('0xa'));var ejs=require(_0xa4ad('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa4ad('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa4ad('0xd'));var toCsv=require(_0xa4ad('0xa'));var querystring=require(_0xa4ad('0xe'));var Papa=require(_0xa4ad('0xf'));var Redis=require(_0xa4ad('0x10'));var authService=require(_0xa4ad('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa4ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4ad('0x13'))(_0xa4ad('0x14'));var utils=require(_0xa4ad('0x15'));var config=require(_0xa4ad('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4ad('0x17'))['db'];function respondWithStatusCode(_0x57b907,_0x1ec77e){_0x1ec77e=_0x1ec77e||0xcc;return function(_0x5c2948){if(_0x5c2948){return _0x57b907['sendStatus'](_0x1ec77e);}return _0x57b907[_0xa4ad('0x18')](_0x1ec77e)[_0xa4ad('0x19')]();};}function respondWithResult(_0x4a5c45,_0x51123b){_0x51123b=_0x51123b||0xc8;return function(_0x5710be){if(_0x5710be){return _0x4a5c45['status'](_0x51123b)[_0xa4ad('0x1a')](_0x5710be);}};}function respondWithFilteredResult(_0x3d9a37,_0x46043a){return function(_0x1adeef){if(_0x1adeef){var _0xb4af32=typeof _0x46043a[_0xa4ad('0x1b')]===_0xa4ad('0x1c')&&typeof _0x46043a[_0xa4ad('0x1d')]===_0xa4ad('0x1c');var _0x339a26=_0x1adeef[_0xa4ad('0x1e')];var _0x4c88eb=_0xb4af32?0x0:_0x46043a[_0xa4ad('0x1b')];var _0x51eabe=_0xb4af32?_0x1adeef[_0xa4ad('0x1e')]:_0x46043a[_0xa4ad('0x1b')]+_0x46043a['limit'];var _0xed11eb;if(_0x51eabe>=_0x339a26){_0x51eabe=_0x339a26;_0xed11eb=0xc8;}else{_0xed11eb=0xce;}_0x3d9a37[_0xa4ad('0x18')](_0xed11eb);return _0x3d9a37[_0xa4ad('0x1f')]('Content-Range',_0x4c88eb+'-'+_0x51eabe+'/'+_0x339a26)['json'](_0x1adeef);}return null;};}function patchUpdates(_0x4ae3fc){return function(_0x197a8a){try{jsonpatch[_0xa4ad('0x20')](_0x197a8a,_0x4ae3fc,!![]);}catch(_0x3c32b0){return BPromise['reject'](_0x3c32b0);}return _0x197a8a[_0xa4ad('0x21')]();};}function saveUpdates(_0x4b9d28,_0x4baa1f){return function(_0x597b39){if(_0x597b39){return _0x597b39[_0xa4ad('0x22')](_0x4b9d28)[_0xa4ad('0x23')](function(_0x145bf7){return _0x145bf7;});}return null;};}function removeEntity(_0x3e247e,_0x455dbf){return function(_0x220d43){if(_0x220d43){return _0x220d43['destroy']()[_0xa4ad('0x23')](function(){_0x3e247e[_0xa4ad('0x18')](0xcc)[_0xa4ad('0x19')]();});}};}function handleEntityNotFound(_0x248019,_0x4db64b){return function(_0x1f0e74){if(!_0x1f0e74){_0x248019['sendStatus'](0x194);}return _0x1f0e74;};}function handleError(_0x1451a4,_0x3af1a7){_0x3af1a7=_0x3af1a7||0x1f4;return function(_0x24b125){logger[_0xa4ad('0x24')](_0x24b125[_0xa4ad('0x25')]);if(_0x24b125[_0xa4ad('0x26')]){delete _0x24b125['name'];}_0x1451a4[_0xa4ad('0x18')](_0x3af1a7)[_0xa4ad('0x27')](_0x24b125);};}exports[_0xa4ad('0x28')]=function(_0x3a68e0,_0x3795f3){var _0x4a8805={},_0x22bab6={},_0x2f04db={'count':0x0,'rows':[]};var _0x45afde=_['map'](db['SmsTransferReport'][_0xa4ad('0x29')],function(_0x4745f9){return{'name':_0x4745f9[_0xa4ad('0x2a')],'type':_0x4745f9[_0xa4ad('0x2b')][_0xa4ad('0x2c')]};});_0x22bab6[_0xa4ad('0x2d')]=_[_0xa4ad('0x2e')](_0x45afde,_0xa4ad('0x26'));_0x22bab6[_0xa4ad('0x2f')]=_[_0xa4ad('0x30')](_0x3a68e0['query']);_0x22bab6['filters']=_[_0xa4ad('0x31')](_0x22bab6['model'],_0x22bab6[_0xa4ad('0x2f')]);_0x4a8805[_0xa4ad('0x32')]=_['intersection'](_0x22bab6[_0xa4ad('0x2d')],qs['fields'](_0x3a68e0['query'][_0xa4ad('0x33')]));_0x4a8805[_0xa4ad('0x32')]=_0x4a8805[_0xa4ad('0x32')]['length']?_0x4a8805['attributes']:_0x22bab6['model'];if(!_0x3a68e0['query'][_0xa4ad('0x34')]('nolimit')){_0x4a8805[_0xa4ad('0x1d')]=qs['limit'](_0x3a68e0[_0xa4ad('0x2f')][_0xa4ad('0x1d')]);_0x4a8805[_0xa4ad('0x1b')]=qs[_0xa4ad('0x1b')](_0x3a68e0[_0xa4ad('0x2f')]['offset']);}_0x4a8805['order']=qs[_0xa4ad('0x35')](_0x3a68e0[_0xa4ad('0x2f')]['sort']);_0x4a8805['where']=qs[_0xa4ad('0x36')](_[_0xa4ad('0x37')](_0x3a68e0[_0xa4ad('0x2f')],_0x22bab6[_0xa4ad('0x36')]),_0x45afde);if(_0x3a68e0[_0xa4ad('0x2f')][_0xa4ad('0x38')]){_0x4a8805[_0xa4ad('0x39')]=_[_0xa4ad('0x3a')](_0x4a8805['where'],{'$or':_[_0xa4ad('0x2e')](_0x45afde,function(_0x4bfc00){if(_0x4bfc00['type']!==_0xa4ad('0x3b')){var _0x134035={};_0x134035[_0x4bfc00[_0xa4ad('0x26')]]={'$like':'%'+_0x3a68e0[_0xa4ad('0x2f')][_0xa4ad('0x38')]+'%'};return _0x134035;}})});}_0x4a8805=_[_0xa4ad('0x3a')]({},_0x4a8805,_0x3a68e0['options']);var _0x42a5d9={'where':_0x4a8805[_0xa4ad('0x39')]};return db[_0xa4ad('0x3c')][_0xa4ad('0x1e')](_0x42a5d9)[_0xa4ad('0x23')](function(_0xdf5454){_0x2f04db['count']=_0xdf5454;if(_0x3a68e0[_0xa4ad('0x2f')]['includeAll']){_0x4a8805[_0xa4ad('0x3d')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xa4ad('0x3e')](_0x4a8805);})[_0xa4ad('0x23')](function(_0xc794f5){_0x2f04db['rows']=_0xc794f5;return _0x2f04db;})['then'](respondWithFilteredResult(_0x3795f3,_0x4a8805))[_0xa4ad('0x3f')](handleError(_0x3795f3,null));};exports[_0xa4ad('0x40')]=function(_0x3f9fe6,_0x48cc0d){var _0x54e58c={'raw':!![],'where':{'id':_0x3f9fe6['params']['id']}},_0x2b99b8={};_0x2b99b8[_0xa4ad('0x2d')]=_[_0xa4ad('0x30')](db[_0xa4ad('0x3c')]['rawAttributes']);_0x2b99b8[_0xa4ad('0x2f')]=_[_0xa4ad('0x30')](_0x3f9fe6[_0xa4ad('0x2f')]);_0x2b99b8[_0xa4ad('0x36')]=_[_0xa4ad('0x31')](_0x2b99b8[_0xa4ad('0x2d')],_0x2b99b8[_0xa4ad('0x2f')]);_0x54e58c[_0xa4ad('0x32')]=_[_0xa4ad('0x31')](_0x2b99b8[_0xa4ad('0x2d')],qs[_0xa4ad('0x33')](_0x3f9fe6[_0xa4ad('0x2f')][_0xa4ad('0x33')]));_0x54e58c[_0xa4ad('0x32')]=_0x54e58c[_0xa4ad('0x32')][_0xa4ad('0x41')]?_0x54e58c['attributes']:_0x2b99b8['model'];if(_0x3f9fe6[_0xa4ad('0x2f')][_0xa4ad('0x42')]){_0x54e58c[_0xa4ad('0x3d')]=[{'all':!![]}];}_0x54e58c=_[_0xa4ad('0x3a')]({},_0x54e58c,_0x3f9fe6['options']);return db['SmsTransferReport'][_0xa4ad('0x43')](_0x54e58c)[_0xa4ad('0x23')](handleEntityNotFound(_0x48cc0d,null))[_0xa4ad('0x23')](respondWithResult(_0x48cc0d,null))[_0xa4ad('0x3f')](handleError(_0x48cc0d,null));};exports[_0xa4ad('0x44')]=function(_0x4c914e,_0x4b53d8){return db['SmsTransferReport'][_0xa4ad('0x44')](_0x4c914e[_0xa4ad('0x45')],{})[_0xa4ad('0x23')](respondWithResult(_0x4b53d8,0xc9))[_0xa4ad('0x3f')](handleError(_0x4b53d8,null));};exports[_0xa4ad('0x22')]=function(_0x4b2635,_0x2842f4){if(_0x4b2635['body']['id']){delete _0x4b2635['body']['id'];}return db[_0xa4ad('0x3c')]['find']({'where':{'id':_0x4b2635['params']['id']}})[_0xa4ad('0x23')](handleEntityNotFound(_0x2842f4,null))['then'](saveUpdates(_0x4b2635[_0xa4ad('0x45')],null))[_0xa4ad('0x23')](respondWithResult(_0x2842f4,null))['catch'](handleError(_0x2842f4,null));};exports['destroy']=function(_0x5bc279,_0x1a5c08){return db['SmsTransferReport']['find']({'where':{'id':_0x5bc279['params']['id']}})['then'](handleEntityNotFound(_0x1a5c08,null))['then'](removeEntity(_0x1a5c08,null))['catch'](handleError(_0x1a5c08,null));};exports['describe']=function(_0x3b1026,_0x3dc8ef){return db[_0xa4ad('0x3c')][_0xa4ad('0x46')]()[_0xa4ad('0x23')](respondWithResult(_0x3dc8ef,null))[_0xa4ad('0x3f')](handleError(_0x3dc8ef,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 8ba1b16..91dd133 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 _0xc80f=['../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x261df0,_0x3598f5){var _0x9960b=function(_0x375aeb){while(--_0x375aeb){_0x261df0['push'](_0x261df0['shift']());}};_0x9960b(++_0x3598f5);}(_0xc80f,0x7e));var _0xfc80=function(_0x2c5b1d,_0x20dcf3){_0x2c5b1d=_0x2c5b1d-0x0;var _0x53238a=_0xc80f[_0x2c5b1d];return _0x53238a;};'use strict';var _=require(_0xfc80('0x0'));var util=require(_0xfc80('0x1'));var logger=require(_0xfc80('0x2'))(_0xfc80('0x3'));var moment=require(_0xfc80('0x4'));var BPromise=require(_0xfc80('0x5'));var rp=require(_0xfc80('0x6'));var fs=require('fs');var path=require(_0xfc80('0x7'));var rimraf=require(_0xfc80('0x8'));var config=require(_0xfc80('0x9'));var attributes=require(_0xfc80('0xa'));module[_0xfc80('0xb')]=function(_0x5d4560,_0xd96921){return _0x5d4560['define'](_0xfc80('0xc'),attributes,{'tableName':_0xfc80('0xd'),'paranoid':![],'indexes':[{'name':_0xfc80('0xe'),'fields':[_0xfc80('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x955d=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x128976,_0xa1735b){var _0x211258=function(_0x5e52c1){while(--_0x5e52c1){_0x128976['push'](_0x128976['shift']());}};_0x211258(++_0xa1735b);}(_0x955d,0x1d8));var _0xd955=function(_0x4f908c,_0x4ca65f){_0x4f908c=_0x4f908c-0x0;var _0x515fca=_0x955d[_0x4f908c];return _0x515fca;};'use strict';var _=require(_0xd955('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd955('0x1'));var moment=require(_0xd955('0x2'));var BPromise=require(_0xd955('0x3'));var rp=require(_0xd955('0x4'));var fs=require('fs');var path=require(_0xd955('0x5'));var rimraf=require('rimraf');var config=require(_0xd955('0x6'));var attributes=require(_0xd955('0x7'));module[_0xd955('0x8')]=function(_0x21b820,_0x17f240){return _0x21b820[_0xd955('0x9')](_0xd955('0xa'),attributes,{'tableName':_0xd955('0xb'),'paranoid':![],'indexes':[{'name':_0xd955('0xc'),'fields':[_0xd955('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 135d7dd..5120adf 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 _0xe5b3=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x4604ad,_0x2c516e){var _0x3ed8ef=function(_0x2cb13e){while(--_0x2cb13e){_0x4604ad['push'](_0x4604ad['shift']());}};_0x3ed8ef(++_0x2c516e);}(_0xe5b3,0x133));var _0x3e5b=function(_0x130b05,_0xbaa2ce){_0x130b05=_0x130b05-0x0;var _0x387c55=_0xe5b3[_0x130b05];return _0x387c55;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file +var _0xbf07=['request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment'];(function(_0x48f791,_0x495109){var _0x4ef8c7=function(_0x446f63){while(--_0x446f63){_0x48f791['push'](_0x48f791['shift']());}};_0x4ef8c7(++_0x495109);}(_0xbf07,0x77));var _0x7bf0=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0xbf07[_0x237546];return _0x233e29;};'use strict';var _=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var moment=require(_0x7bf0('0x2'));var BPromise=require(_0x7bf0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bf0('0x4'));var db=require(_0x7bf0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7bf0('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44f656,_0x50e680,_0x263964){return new BPromise(function(_0x536214,_0x415291){return client[_0x7bf0('0x7')](_0x44f656,_0x263964)[_0x7bf0('0x8')](function(_0x2565c7){logger[_0x7bf0('0x9')](_0x7bf0('0xa'),_0x50e680,'request\x20sent');logger[_0x7bf0('0xb')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x50e680,_0x7bf0('0xc'),JSON[_0x7bf0('0xd')](_0x2565c7));if(_0x2565c7[_0x7bf0('0xe')]){if(_0x2565c7[_0x7bf0('0xe')][_0x7bf0('0xf')]===0x1f4){logger[_0x7bf0('0xe')](_0x7bf0('0xa'),_0x50e680,_0x2565c7[_0x7bf0('0xe')][_0x7bf0('0x10')]);return _0x415291(_0x2565c7[_0x7bf0('0xe')][_0x7bf0('0x10')]);}logger[_0x7bf0('0xe')](_0x7bf0('0xa'),_0x50e680,_0x2565c7[_0x7bf0('0xe')][_0x7bf0('0x10')]);return _0x536214(_0x2565c7[_0x7bf0('0xe')][_0x7bf0('0x10')]);}else{logger[_0x7bf0('0x9')](_0x7bf0('0xa'),_0x50e680,_0x7bf0('0xc'));_0x536214(_0x2565c7['result'][_0x7bf0('0x10')]);}})[_0x7bf0('0x11')](function(_0x187489){logger[_0x7bf0('0xe')](_0x7bf0('0xa'),_0x50e680,_0x187489);_0x415291(_0x187489);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 23b2085..5c88575 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 _0xecec=['path','connect-timeout','express','fs-extra','../../config/environment','./sound.controller','isAuthenticated','index','get','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','post','single','file','create','put','/:id','update','delete','multer','util'];(function(_0x15f8ad,_0x5275c3){var _0xc0238a=function(_0x5550c8){while(--_0x5550c8){_0x15f8ad['push'](_0x15f8ad['shift']());}};_0xc0238a(++_0x5275c3);}(_0xecec,0xee));var _0xcece=function(_0x21c4a7,_0x50b98c){_0x21c4a7=_0x21c4a7-0x0;var _0x319787=_0xecec[_0x21c4a7];return _0x319787;};'use strict';var multer=require(_0xcece('0x0'));var util=require(_0xcece('0x1'));var path=require(_0xcece('0x2'));var timeout=require(_0xcece('0x3'));var express=require(_0xcece('0x4'));var router=express['Router']();var fs_extra=require(_0xcece('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcece('0x6'));var controller=require(_0xcece('0x7'));router['get']('/',auth[_0xcece('0x8')](),controller[_0xcece('0x9')]);router[_0xcece('0xa')]('/:id',auth[_0xcece('0x8')](),controller[_0xcece('0xb')]);router[_0xcece('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xcece('0xc')]);var upload=multer({'storage':multer[_0xcece('0xd')]({'destination':function(_0x160cea,_0x5f473e,_0x475175){_0x475175(null,path[_0xcece('0xe')](config[_0xcece('0xf')],_0xcece('0x10')));},'filename':function(_0x2c5490,_0x396acd,_0x5b3d8b){_0x396acd[_0xcece('0x11')]=_0x396acd[_0xcece('0x11')][_0xcece('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5b3d8b(null,util[_0xcece('0x13')]('%s-%s%s',path[_0xcece('0x14')](_0x396acd[_0xcece('0x11')],path[_0xcece('0x15')](_0x396acd['originalname'])),Date['now'](),path[_0xcece('0x15')](_0x396acd[_0xcece('0x11')])));}})});router[_0xcece('0x16')]('/',upload[_0xcece('0x17')](_0xcece('0x18')),controller[_0xcece('0x19')]);router[_0xcece('0x1a')](_0xcece('0x1b'),auth['isAuthenticated'](),controller[_0xcece('0x1c')]);router['delete'](_0xcece('0x1b'),auth['isAuthenticated'](),controller[_0xcece('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xd98b=['/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id'];(function(_0x468abf,_0x4f4d04){var _0x13a5fd=function(_0x19e0db){while(--_0x19e0db){_0x468abf['push'](_0x468abf['shift']());}};_0x13a5fd(++_0x4f4d04);}(_0xd98b,0x1b6));var _0xbd98=function(_0x51c560,_0x4e6c0e){_0x51c560=_0x51c560-0x0;var _0x594579=_0xd98b[_0x51c560];return _0x594579;};'use strict';var multer=require(_0xbd98('0x0'));var util=require(_0xbd98('0x1'));var path=require(_0xbd98('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbd98('0x3')]();var fs_extra=require(_0xbd98('0x4'));var auth=require(_0xbd98('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd98('0x6'));var controller=require(_0xbd98('0x7'));router[_0xbd98('0x8')]('/',auth[_0xbd98('0x9')](),controller[_0xbd98('0xa')]);router[_0xbd98('0x8')](_0xbd98('0xb'),auth[_0xbd98('0x9')](),controller['show']);router[_0xbd98('0x8')](_0xbd98('0xc'),auth[_0xbd98('0x9')](),controller[_0xbd98('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x120cd7,_0xa55e4c,_0x4db73c){_0x4db73c(null,path[_0xbd98('0xe')](config[_0xbd98('0xf')],_0xbd98('0x10')));},'filename':function(_0x2bfc45,_0x20d1fb,_0x3ec147){_0x20d1fb[_0xbd98('0x11')]=_0x20d1fb['originalname'][_0xbd98('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ec147(null,util[_0xbd98('0x13')](_0xbd98('0x14'),path[_0xbd98('0x15')](_0x20d1fb['originalname'],path[_0xbd98('0x16')](_0x20d1fb[_0xbd98('0x11')])),Date['now'](),path[_0xbd98('0x16')](_0x20d1fb['originalname'])));}})});router[_0xbd98('0x17')]('/',upload[_0xbd98('0x18')](_0xbd98('0x19')),controller[_0xbd98('0x1a')]);router[_0xbd98('0x1b')](_0xbd98('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xbd98('0x1c')](_0xbd98('0xb'),auth[_0xbd98('0x9')](),controller['delete']);module[_0xbd98('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 7a837a4..cfda955 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 _0x6419=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x2f52d1,_0x36e3b1){var _0x3f9871=function(_0x27379f){while(--_0x27379f){_0x2f52d1['push'](_0x2f52d1['shift']());}};_0x3f9871(++_0x36e3b1);}(_0x6419,0x80));var _0x9641=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6419[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x9641('0x0'));module[_0x9641('0x1')]={'name':{'type':Sequelize[_0x9641('0x2')],'unique':_0x9641('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x9641('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x9641('0x2')]},'original_format':{'type':Sequelize[_0x9641('0x2')]},'original_duration':{'type':Sequelize[_0x9641('0x4')]},'original_sampleCount':{'type':Sequelize[_0x9641('0x5')]},'original_channelCount':{'type':Sequelize[_0x9641('0x6')]},'original_bitRate':{'type':Sequelize[_0x9641('0x5')]},'original_sampleRate':{'type':Sequelize[_0x9641('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x9641('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x9641('0x5')]},'converted_channelCount':{'type':Sequelize[_0x9641('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xcf6f=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0xcf6ad0,_0x411f01){var _0x3629fd=function(_0xb35c1a){while(--_0xb35c1a){_0xcf6ad0['push'](_0xcf6ad0['shift']());}};_0x3629fd(++_0x411f01);}(_0xcf6f,0xc1));var _0xfcf6=function(_0x59e59d,_0x3f2671){_0x59e59d=_0x59e59d-0x0;var _0x2773a5=_0xcf6f[_0x59e59d];return _0x2773a5;};'use strict';var Sequelize=require(_0xfcf6('0x0'));module[_0xfcf6('0x1')]={'name':{'type':Sequelize[_0xfcf6('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xfcf6('0x2')]},'display_name':{'type':Sequelize[_0xfcf6('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xfcf6('0x2')]},'original_format':{'type':Sequelize[_0xfcf6('0x2')]},'original_duration':{'type':Sequelize[_0xfcf6('0x3')]},'original_sampleCount':{'type':Sequelize[_0xfcf6('0x4')]},'original_channelCount':{'type':Sequelize[_0xfcf6('0x5')]},'original_bitRate':{'type':Sequelize[_0xfcf6('0x4')]},'original_sampleRate':{'type':Sequelize[_0xfcf6('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xfcf6('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xfcf6('0x4')]},'converted_channelCount':{'type':Sequelize[_0xfcf6('0x5')]},'converted_bitRate':{'type':Sequelize[_0xfcf6('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xfcf6('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 398a9a0..5844357 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 _0x6da0=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','Sounds','UserProfileResource','end','error','name','send','index','map','Sound','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','includeAll','include','rows','catch','show','params','find','download','converted_format','join','root','server/files/sounds/converted','save_name','ValidationError','Sound\x20not\x20found','%s.%s','format','create','originalname','file','basename','filename','extname','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','wav','unlinkSync','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','start','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto'];(function(_0x3d5c66,_0x521d9e){var _0x9d2d66=function(_0x46b3eb){while(--_0x46b3eb){_0x3d5c66['push'](_0x3d5c66['shift']());}};_0x9d2d66(++_0x521d9e);}(_0x6da0,0xe7));var _0x06da=function(_0x1b17d6,_0x10ec3a){_0x1b17d6=_0x1b17d6-0x0;var _0x119a94=_0x6da0[_0x1b17d6];return _0x119a94;};'use strict';var emlformat=require(_0x06da('0x0'));var rimraf=require(_0x06da('0x1'));var zipdir=require(_0x06da('0x2'));var jsonpatch=require(_0x06da('0x3'));var rp=require(_0x06da('0x4'));var moment=require(_0x06da('0x5'));var BPromise=require(_0x06da('0x6'));var Mustache=require(_0x06da('0x7'));var util=require(_0x06da('0x8'));var path=require(_0x06da('0x9'));var sox=require('sox');var csv=require(_0x06da('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x06da('0xb'));var crypto=require(_0x06da('0xc'));var jsforce=require(_0x06da('0xd'));var deskjs=require(_0x06da('0xe'));var toCsv=require(_0x06da('0xa'));var querystring=require(_0x06da('0xf'));var Papa=require(_0x06da('0x10'));var Redis=require(_0x06da('0x11'));var authService=require(_0x06da('0x12'));var qs=require(_0x06da('0x13'));var as=require(_0x06da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x06da('0x15'));var utils=require(_0x06da('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x06da('0x17'));var db=require(_0x06da('0x18'))['db'];function respondWithStatusCode(_0x348451,_0x5a1783){_0x5a1783=_0x5a1783||0xcc;return function(_0x25ab83){if(_0x25ab83){return _0x348451[_0x06da('0x19')](_0x5a1783);}return _0x348451[_0x06da('0x1a')](_0x5a1783)['end']();};}function respondWithResult(_0x552443,_0x113186){_0x113186=_0x113186||0xc8;return function(_0x1693e8){if(_0x1693e8){return _0x552443[_0x06da('0x1a')](_0x113186)[_0x06da('0x1b')](_0x1693e8);}};}function respondWithFilteredResult(_0x5cf71b,_0x4ce220){return function(_0x3c27b9){if(_0x3c27b9){var _0x3202f3=typeof _0x4ce220[_0x06da('0x1c')]===_0x06da('0x1d')&&typeof _0x4ce220[_0x06da('0x1e')]===_0x06da('0x1d');var _0x26c5fa=_0x3c27b9[_0x06da('0x1f')];var _0x399b38=_0x3202f3?0x0:_0x4ce220[_0x06da('0x1c')];var _0x1231c4=_0x3202f3?_0x3c27b9[_0x06da('0x1f')]:_0x4ce220[_0x06da('0x1c')]+_0x4ce220[_0x06da('0x1e')];var _0x17f5e1;if(_0x1231c4>=_0x26c5fa){_0x1231c4=_0x26c5fa;_0x17f5e1=0xc8;}else{_0x17f5e1=0xce;}_0x5cf71b[_0x06da('0x1a')](_0x17f5e1);return _0x5cf71b['set'](_0x06da('0x20'),_0x399b38+'-'+_0x1231c4+'/'+_0x26c5fa)[_0x06da('0x1b')](_0x3c27b9);}return null;};}function patchUpdates(_0x33f52c){return function(_0x44766b){try{jsonpatch[_0x06da('0x21')](_0x44766b,_0x33f52c,!![]);}catch(_0xecbaec){return BPromise[_0x06da('0x22')](_0xecbaec);}return _0x44766b[_0x06da('0x23')]();};}function saveUpdates(_0x14c3c2,_0x13017b){return function(_0x46dede){if(_0x46dede){return _0x46dede[_0x06da('0x24')](_0x14c3c2)['then'](function(_0x505c2c){return _0x505c2c;});}return null;};}function removeEntity(_0x340cfd,_0x72fb8d){return function(_0x101259){if(_0x101259){return _0x101259[_0x06da('0x25')]()[_0x06da('0x26')](function(){var _0x4e9433=_0x101259['get']({'plain':!![]});var _0x3e5dbf=_0x06da('0x27');return db[_0x06da('0x28')][_0x06da('0x25')]({'where':{'type':_0x3e5dbf,'resourceId':_0x4e9433['id']}})[_0x06da('0x26')](function(){return _0x101259;});})[_0x06da('0x26')](function(){_0x340cfd[_0x06da('0x1a')](0xcc)[_0x06da('0x29')]();});}};}function handleEntityNotFound(_0x4f86b6,_0x1d6226){return function(_0x5b2281){if(!_0x5b2281){_0x4f86b6[_0x06da('0x19')](0x194);}return _0x5b2281;};}function handleError(_0x165e0b,_0x5ef80a){_0x5ef80a=_0x5ef80a||0x1f4;return function(_0xd57281){logger[_0x06da('0x2a')](_0xd57281['stack']);if(_0xd57281[_0x06da('0x2b')]){delete _0xd57281['name'];}_0x165e0b['status'](_0x5ef80a)[_0x06da('0x2c')](_0xd57281);};}exports[_0x06da('0x2d')]=function(_0x346c6c,_0x465e85){var _0x7a354c={},_0x1fc07d={},_0x2cf8ac={'count':0x0,'rows':[]};var _0x52b979=_[_0x06da('0x2e')](db[_0x06da('0x2f')][_0x06da('0x30')],function(_0x117679){return{'name':_0x117679['fieldName'],'type':_0x117679['type'][_0x06da('0x31')]};});_0x1fc07d['model']=_[_0x06da('0x2e')](_0x52b979,_0x06da('0x2b'));_0x1fc07d[_0x06da('0x32')]=_[_0x06da('0x33')](_0x346c6c[_0x06da('0x32')]);_0x1fc07d[_0x06da('0x34')]=_[_0x06da('0x35')](_0x1fc07d['model'],_0x1fc07d[_0x06da('0x32')]);_0x7a354c[_0x06da('0x36')]=_['intersection'](_0x1fc07d[_0x06da('0x37')],qs[_0x06da('0x38')](_0x346c6c[_0x06da('0x32')][_0x06da('0x38')]));_0x7a354c[_0x06da('0x36')]=_0x7a354c[_0x06da('0x36')][_0x06da('0x39')]?_0x7a354c[_0x06da('0x36')]:_0x1fc07d[_0x06da('0x37')];if(!_0x346c6c[_0x06da('0x32')][_0x06da('0x3a')](_0x06da('0x3b'))){_0x7a354c[_0x06da('0x1e')]=qs[_0x06da('0x1e')](_0x346c6c['query'][_0x06da('0x1e')]);_0x7a354c[_0x06da('0x1c')]=qs[_0x06da('0x1c')](_0x346c6c[_0x06da('0x32')][_0x06da('0x1c')]);}_0x7a354c[_0x06da('0x3c')]=qs['sort'](_0x346c6c[_0x06da('0x32')][_0x06da('0x3d')]);_0x7a354c['where']=qs['filters'](_[_0x06da('0x3e')](_0x346c6c[_0x06da('0x32')],_0x1fc07d[_0x06da('0x34')]),_0x52b979);if(_0x346c6c['query'][_0x06da('0x3f')]){_0x7a354c[_0x06da('0x40')]=_[_0x06da('0x41')](_0x7a354c[_0x06da('0x40')],{'$or':_[_0x06da('0x2e')](_0x52b979,function(_0x3726df){if(_0x3726df[_0x06da('0x42')]!=='VIRTUAL'){var _0x6b9e1e={};_0x6b9e1e[_0x3726df[_0x06da('0x2b')]]={'$like':'%'+_0x346c6c[_0x06da('0x32')][_0x06da('0x3f')]+'%'};return _0x6b9e1e;}})});}_0x7a354c=_[_0x06da('0x41')]({},_0x7a354c,_0x346c6c['options']);var _0x21da2d={'where':_0x7a354c[_0x06da('0x40')]};return db['Sound']['count'](_0x21da2d)[_0x06da('0x26')](function(_0x2e3576){_0x2cf8ac['count']=_0x2e3576;if(_0x346c6c[_0x06da('0x32')][_0x06da('0x43')]){_0x7a354c[_0x06da('0x44')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x7a354c);})[_0x06da('0x26')](function(_0x2f1500){_0x2cf8ac[_0x06da('0x45')]=_0x2f1500;return _0x2cf8ac;})['then'](respondWithFilteredResult(_0x465e85,_0x7a354c))[_0x06da('0x46')](handleError(_0x465e85,null));};exports[_0x06da('0x47')]=function(_0x39307e,_0x9c0b1a){var _0x25fcc2={'raw':!![],'where':{'id':_0x39307e[_0x06da('0x48')]['id']}},_0x128e56={};_0x128e56[_0x06da('0x37')]=_[_0x06da('0x33')](db[_0x06da('0x2f')]['rawAttributes']);_0x128e56[_0x06da('0x32')]=_['keys'](_0x39307e[_0x06da('0x32')]);_0x128e56[_0x06da('0x34')]=_['intersection'](_0x128e56[_0x06da('0x37')],_0x128e56[_0x06da('0x32')]);_0x25fcc2['attributes']=_[_0x06da('0x35')](_0x128e56[_0x06da('0x37')],qs['fields'](_0x39307e[_0x06da('0x32')][_0x06da('0x38')]));_0x25fcc2[_0x06da('0x36')]=_0x25fcc2[_0x06da('0x36')][_0x06da('0x39')]?_0x25fcc2[_0x06da('0x36')]:_0x128e56['model'];if(_0x39307e['query'][_0x06da('0x43')]){_0x25fcc2[_0x06da('0x44')]=[{'all':!![]}];}_0x25fcc2=_[_0x06da('0x41')]({},_0x25fcc2,_0x39307e['options']);return db[_0x06da('0x2f')][_0x06da('0x49')](_0x25fcc2)[_0x06da('0x26')](handleEntityNotFound(_0x9c0b1a,null))[_0x06da('0x26')](respondWithResult(_0x9c0b1a,null))[_0x06da('0x46')](handleError(_0x9c0b1a,null));};exports[_0x06da('0x4a')]=function(_0x4c809a,_0xf1bfcf,_0x2a677a){return db['Sound'][_0x06da('0x49')]({'where':{'id':_0x4c809a[_0x06da('0x48')]['id']},'attributes':[_0x06da('0x2b'),'save_name',_0x06da('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0xf1bfcf,null))[_0x06da('0x26')](function(_0x5175fd){if(_0x5175fd){if(!fs['existsSync'](path[_0x06da('0x4c')](config[_0x06da('0x4d')],_0x06da('0x4e'),_0x5175fd[_0x06da('0x4f')]+'.'+_0x5175fd[_0x06da('0x4b')]))){throw new db['Sequelize'][(_0x06da('0x50'))](_0x06da('0x51'));}return _0xf1bfcf[_0x06da('0x4a')](path[_0x06da('0x4c')](config[_0x06da('0x4d')],_0x06da('0x4e'),util['format'](_0x06da('0x52'),_0x5175fd[_0x06da('0x4f')],_0x5175fd['converted_format'])),util[_0x06da('0x53')](_0x06da('0x52'),_0x5175fd[_0x06da('0x2b')],_0x5175fd[_0x06da('0x4b')]));}return null;})[_0x06da('0x46')](handleError(_0xf1bfcf,null));};exports[_0x06da('0x54')]=function(_0x251da5,_0x3cd22a,_0x2af219){var _0x316ea4={'name':path['basename'](_0x251da5['file'][_0x06da('0x55')],path['extname'](_0x251da5[_0x06da('0x56')][_0x06da('0x55')])),'save_name':path[_0x06da('0x57')](_0x251da5[_0x06da('0x56')][_0x06da('0x58')],path[_0x06da('0x59')](_0x251da5[_0x06da('0x56')][_0x06da('0x58')])),'original_format':path[_0x06da('0x59')](_0x251da5[_0x06da('0x56')][_0x06da('0x55')])['substring'](0x1),'converted_format':'wav'};var _0x4df17e=path[_0x06da('0x4c')](config['root'],_0x06da('0x5a'),_0x251da5['file']['filename']);var _0x58f7aa=path[_0x06da('0x4c')](config['root'],_0x06da('0x4e'),util[_0x06da('0x53')](_0x06da('0x52'),path[_0x06da('0x57')](_0x251da5[_0x06da('0x56')]['filename'],path['extname'](_0x251da5[_0x06da('0x56')][_0x06da('0x58')])),_0x316ea4[_0x06da('0x4b')]));logger[_0x06da('0x5b')](_0x06da('0x5c'),_0x4df17e);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x58f7aa);try{fs[_0x06da('0x5d')](_0x4df17e,parseInt('0777',0x8));var _0x4aa149=sox[_0x06da('0x5e')](_0x4df17e,_0x58f7aa,{'sampleRate':0x1f40,'format':_0x06da('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4aa149['on']('error',function(_0x477fb3){fs[_0x06da('0x60')](_0x4df17e);_0x3cd22a[_0x06da('0x1a')](0x1f4)['send'](_0x477fb3);});_0x4aa149['on'](_0x06da('0x61'),function(_0x40d971){_0x316ea4[_0x06da('0x62')]=isNaN(_0x40d971[_0x06da('0x63')])?null:_0x40d971[_0x06da('0x63')]*0x3e8;_0x316ea4['original_sampleCount']=isNaN(_0x40d971[_0x06da('0x64')])?null:_0x40d971[_0x06da('0x64')];_0x316ea4['original_channelCount']=isNaN(_0x40d971[_0x06da('0x65')])?null:_0x40d971[_0x06da('0x65')];_0x316ea4[_0x06da('0x66')]=isNaN(_0x40d971['bitRate'])?null:_0x40d971[_0x06da('0x67')];_0x316ea4['original_sampleRate']=isNaN(_0x40d971[_0x06da('0x68')])?null:_0x40d971[_0x06da('0x68')];});_0x4aa149['on']('dest',function(_0x2591eb){_0x316ea4[_0x06da('0x69')]=isNaN(_0x2591eb[_0x06da('0x63')])?null:_0x2591eb[_0x06da('0x63')]*0x3e8;_0x316ea4[_0x06da('0x6a')]=isNaN(_0x2591eb[_0x06da('0x64')])?null:_0x2591eb[_0x06da('0x64')];_0x316ea4[_0x06da('0x6b')]=isNaN(_0x2591eb[_0x06da('0x65')])?null:_0x2591eb[_0x06da('0x65')];_0x316ea4[_0x06da('0x6c')]=isNaN(_0x2591eb[_0x06da('0x67')])?null:_0x2591eb[_0x06da('0x67')];_0x316ea4[_0x06da('0x6d')]=isNaN(_0x2591eb[_0x06da('0x68')])?null:_0x2591eb[_0x06da('0x68')];});_0x4aa149['on']('end',function(){fs['chmodSync'](_0x58f7aa,parseInt(_0x06da('0x6e'),0x8));return db['Sound'][_0x06da('0x54')](_0x316ea4)[_0x06da('0x26')](function(_0x39f558){var _0xdb5e50={'role':_0x251da5[_0x06da('0x6f')][_0x06da('0x70')],'userProfileId':_0x251da5['body'][_0x06da('0x71')]};if(!_0xdb5e50)throw new Error(_0x06da('0x72'));if(_0xdb5e50['role']===_0x06da('0x73')){var _0x5dd32a=_0x39f558[_0x06da('0x74')]({'plain':!![]});return db[_0x06da('0x75')][_0x06da('0x49')]({'where':{'name':'Sounds','userProfileId':_0xdb5e50['userProfileId']},'raw':!![]})[_0x06da('0x26')](function(_0x3630dc){if(_0x3630dc&&_0x3630dc['autoAssociation']===0x0){return db[_0x06da('0x28')][_0x06da('0x54')]({'name':_0x5dd32a['name'],'resourceId':_0x5dd32a['id'],'type':_0x3630dc[_0x06da('0x2b')],'sectionId':_0x3630dc['id']},{})[_0x06da('0x26')](function(){return _0x39f558;});}else{return _0x39f558;}})[_0x06da('0x46')](function(_0x1531fa){logger[_0x06da('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1531fa);throw _0x1531fa;});}return _0x39f558;})[_0x06da('0x26')](respondWithResult(_0x3cd22a,null))[_0x06da('0x46')](handleError(_0x3cd22a,null));});_0x4aa149[_0x06da('0x76')]();}catch(_0x40ce9c){_0x3cd22a[_0x06da('0x1a')](0x1f4)[_0x06da('0x2c')](_0x40ce9c);}};exports[_0x06da('0x24')]=function(_0x2a2ec7,_0x9c7dda,_0x115a9a){return db['Sound'][_0x06da('0x49')]({'where':{'id':_0x2a2ec7[_0x06da('0x48')]['id']}})[_0x06da('0x26')](handleEntityNotFound(_0x9c7dda,null))[_0x06da('0x26')](saveUpdates(_[_0x06da('0x3e')](_0x2a2ec7[_0x06da('0x6f')],[_0x06da('0x2b'),_0x06da('0x77')]),null))[_0x06da('0x26')](respondWithResult(_0x9c7dda,null))[_0x06da('0x46')](handleError(_0x9c7dda,null));};exports[_0x06da('0x78')]=function(_0x505bab,_0x3f5c0d,_0x228a98){return db[_0x06da('0x2f')][_0x06da('0x49')]({'where':{'id':_0x505bab['params']['id']}})[_0x06da('0x26')](function(_0x109895){if(_0x109895){return _0x109895[_0x06da('0x25')]();}})[_0x06da('0x26')](function(_0x5db4ee){var _0x3930b2=path[_0x06da('0x4c')](config['root'],'server/files/sounds/original',util[_0x06da('0x53')](_0x06da('0x52'),_0x5db4ee[_0x06da('0x4f')],_0x5db4ee[_0x06da('0x79')]));var _0x166d55=path[_0x06da('0x4c')](config[_0x06da('0x4d')],_0x06da('0x4e'),util[_0x06da('0x53')]('%s.%s',_0x5db4ee[_0x06da('0x4f')],_0x5db4ee[_0x06da('0x4b')]));fs[_0x06da('0x60')](_0x3930b2);fs['unlinkSync'](_0x166d55);return _0x5db4ee;})[_0x06da('0x26')](function(_0x3f0200){if(_0x3f0200){return _0x3f5c0d['status'](0xcc)[_0x06da('0x29')]();}})[_0x06da('0x26')](handleEntityNotFound(_0x3f5c0d,null))['catch'](handleError(_0x3f5c0d,null));}; \ No newline at end of file +var _0x3015=['catch','show','params','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','wav','src','original_duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','pick','description','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3015,0x12e));var _0x5301=function(_0xd97da2,_0x5b7169){_0xd97da2=_0xd97da2-0x0;var _0x4776b0=_0x3015[_0xd97da2];return _0x4776b0;};'use strict';var emlformat=require(_0x5301('0x0'));var rimraf=require(_0x5301('0x1'));var zipdir=require(_0x5301('0x2'));var jsonpatch=require(_0x5301('0x3'));var rp=require(_0x5301('0x4'));var moment=require(_0x5301('0x5'));var BPromise=require(_0x5301('0x6'));var Mustache=require('mustache');var util=require(_0x5301('0x7'));var path=require('path');var sox=require(_0x5301('0x8'));var csv=require('to-csv');var ejs=require(_0x5301('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5301('0xa'));var squel=require(_0x5301('0xb'));var crypto=require('crypto');var jsforce=require(_0x5301('0xc'));var deskjs=require(_0x5301('0xd'));var toCsv=require(_0x5301('0xe'));var querystring=require(_0x5301('0xf'));var Papa=require(_0x5301('0x10'));var Redis=require(_0x5301('0x11'));var authService=require(_0x5301('0x12'));var qs=require(_0x5301('0x13'));var as=require(_0x5301('0x14'));var hardwareService=require(_0x5301('0x15'));var logger=require(_0x5301('0x16'))(_0x5301('0x17'));var utils=require(_0x5301('0x18'));var config=require(_0x5301('0x19'));var licenseUtil=require(_0x5301('0x1a'));var db=require(_0x5301('0x1b'))['db'];function respondWithStatusCode(_0x508003,_0x1b4008){_0x1b4008=_0x1b4008||0xcc;return function(_0x5d268b){if(_0x5d268b){return _0x508003[_0x5301('0x1c')](_0x1b4008);}return _0x508003[_0x5301('0x1d')](_0x1b4008)[_0x5301('0x1e')]();};}function respondWithResult(_0x43d2ad,_0xf17c52){_0xf17c52=_0xf17c52||0xc8;return function(_0x1e2222){if(_0x1e2222){return _0x43d2ad['status'](_0xf17c52)[_0x5301('0x1f')](_0x1e2222);}};}function respondWithFilteredResult(_0x3273a1,_0x5b5dfc){return function(_0xbfb21b){if(_0xbfb21b){var _0x14c3b3=typeof _0x5b5dfc[_0x5301('0x20')]==='undefined'&&typeof _0x5b5dfc['limit']===_0x5301('0x21');var _0x2c1312=_0xbfb21b['count'];var _0x18bdb1=_0x14c3b3?0x0:_0x5b5dfc['offset'];var _0x48a49e=_0x14c3b3?_0xbfb21b[_0x5301('0x22')]:_0x5b5dfc['offset']+_0x5b5dfc[_0x5301('0x23')];var _0x5ae1d4;if(_0x48a49e>=_0x2c1312){_0x48a49e=_0x2c1312;_0x5ae1d4=0xc8;}else{_0x5ae1d4=0xce;}_0x3273a1[_0x5301('0x1d')](_0x5ae1d4);return _0x3273a1[_0x5301('0x24')]('Content-Range',_0x18bdb1+'-'+_0x48a49e+'/'+_0x2c1312)[_0x5301('0x1f')](_0xbfb21b);}return null;};}function patchUpdates(_0x90babd){return function(_0x2a7add){try{jsonpatch[_0x5301('0x25')](_0x2a7add,_0x90babd,!![]);}catch(_0x29e55b){return BPromise[_0x5301('0x26')](_0x29e55b);}return _0x2a7add[_0x5301('0x27')]();};}function saveUpdates(_0x4e5fbc,_0x3c912b){return function(_0x4d8707){if(_0x4d8707){return _0x4d8707[_0x5301('0x28')](_0x4e5fbc)[_0x5301('0x29')](function(_0xd97fe7){return _0xd97fe7;});}return null;};}function removeEntity(_0x35455f,_0x2c00b1){return function(_0x4ac8b5){if(_0x4ac8b5){return _0x4ac8b5[_0x5301('0x2a')]()['then'](function(){var _0x9d34f=_0x4ac8b5[_0x5301('0x2b')]({'plain':!![]});var _0xb417f='Sounds';return db[_0x5301('0x2c')]['destroy']({'where':{'type':_0xb417f,'resourceId':_0x9d34f['id']}})[_0x5301('0x29')](function(){return _0x4ac8b5;});})['then'](function(){_0x35455f[_0x5301('0x1d')](0xcc)[_0x5301('0x1e')]();});}};}function handleEntityNotFound(_0x11fb05,_0x46d193){return function(_0xf50c3c){if(!_0xf50c3c){_0x11fb05['sendStatus'](0x194);}return _0xf50c3c;};}function handleError(_0x5f00f2,_0x486d72){_0x486d72=_0x486d72||0x1f4;return function(_0x5101a4){logger[_0x5301('0x2d')](_0x5101a4['stack']);if(_0x5101a4[_0x5301('0x2e')]){delete _0x5101a4[_0x5301('0x2e')];}_0x5f00f2[_0x5301('0x1d')](_0x486d72)['send'](_0x5101a4);};}exports[_0x5301('0x2f')]=function(_0x2b00d5,_0x5ba9ea){var _0x1e49f0={},_0xfaea91={},_0x3d6668={'count':0x0,'rows':[]};var _0x1adfa1=_[_0x5301('0x30')](db[_0x5301('0x31')][_0x5301('0x32')],function(_0x4bcd22){return{'name':_0x4bcd22[_0x5301('0x33')],'type':_0x4bcd22[_0x5301('0x34')]['key']};});_0xfaea91[_0x5301('0x35')]=_[_0x5301('0x30')](_0x1adfa1,'name');_0xfaea91[_0x5301('0x36')]=_[_0x5301('0x37')](_0x2b00d5[_0x5301('0x36')]);_0xfaea91[_0x5301('0x38')]=_[_0x5301('0x39')](_0xfaea91[_0x5301('0x35')],_0xfaea91[_0x5301('0x36')]);_0x1e49f0[_0x5301('0x3a')]=_[_0x5301('0x39')](_0xfaea91[_0x5301('0x35')],qs[_0x5301('0x3b')](_0x2b00d5[_0x5301('0x36')][_0x5301('0x3b')]));_0x1e49f0['attributes']=_0x1e49f0[_0x5301('0x3a')][_0x5301('0x3c')]?_0x1e49f0['attributes']:_0xfaea91['model'];if(!_0x2b00d5[_0x5301('0x36')][_0x5301('0x3d')](_0x5301('0x3e'))){_0x1e49f0[_0x5301('0x23')]=qs[_0x5301('0x23')](_0x2b00d5[_0x5301('0x36')]['limit']);_0x1e49f0[_0x5301('0x20')]=qs[_0x5301('0x20')](_0x2b00d5[_0x5301('0x36')]['offset']);}_0x1e49f0['order']=qs[_0x5301('0x3f')](_0x2b00d5[_0x5301('0x36')][_0x5301('0x3f')]);_0x1e49f0['where']=qs[_0x5301('0x38')](_['pick'](_0x2b00d5[_0x5301('0x36')],_0xfaea91[_0x5301('0x38')]),_0x1adfa1);if(_0x2b00d5[_0x5301('0x36')][_0x5301('0x40')]){_0x1e49f0[_0x5301('0x41')]=_[_0x5301('0x42')](_0x1e49f0[_0x5301('0x41')],{'$or':_['map'](_0x1adfa1,function(_0x4f64eb){if(_0x4f64eb[_0x5301('0x34')]!=='VIRTUAL'){var _0x360b76={};_0x360b76[_0x4f64eb['name']]={'$like':'%'+_0x2b00d5[_0x5301('0x36')][_0x5301('0x40')]+'%'};return _0x360b76;}})});}_0x1e49f0=_['merge']({},_0x1e49f0,_0x2b00d5['options']);var _0x5a2ca0={'where':_0x1e49f0[_0x5301('0x41')]};return db[_0x5301('0x31')][_0x5301('0x22')](_0x5a2ca0)[_0x5301('0x29')](function(_0x272817){_0x3d6668[_0x5301('0x22')]=_0x272817;if(_0x2b00d5[_0x5301('0x36')][_0x5301('0x43')]){_0x1e49f0[_0x5301('0x44')]=[{'all':!![]}];}return db['Sound'][_0x5301('0x45')](_0x1e49f0);})[_0x5301('0x29')](function(_0x26f7b1){_0x3d6668['rows']=_0x26f7b1;return _0x3d6668;})['then'](respondWithFilteredResult(_0x5ba9ea,_0x1e49f0))[_0x5301('0x46')](handleError(_0x5ba9ea,null));};exports[_0x5301('0x47')]=function(_0x30dfcc,_0x206a95){var _0x3fbae3={'raw':!![],'where':{'id':_0x30dfcc[_0x5301('0x48')]['id']}},_0x1bbe82={};_0x1bbe82[_0x5301('0x35')]=_[_0x5301('0x37')](db[_0x5301('0x31')][_0x5301('0x32')]);_0x1bbe82[_0x5301('0x36')]=_[_0x5301('0x37')](_0x30dfcc['query']);_0x1bbe82['filters']=_[_0x5301('0x39')](_0x1bbe82[_0x5301('0x35')],_0x1bbe82['query']);_0x3fbae3[_0x5301('0x3a')]=_[_0x5301('0x39')](_0x1bbe82['model'],qs[_0x5301('0x3b')](_0x30dfcc[_0x5301('0x36')][_0x5301('0x3b')]));_0x3fbae3[_0x5301('0x3a')]=_0x3fbae3[_0x5301('0x3a')][_0x5301('0x3c')]?_0x3fbae3['attributes']:_0x1bbe82[_0x5301('0x35')];if(_0x30dfcc[_0x5301('0x36')][_0x5301('0x43')]){_0x3fbae3['include']=[{'all':!![]}];}_0x3fbae3=_[_0x5301('0x42')]({},_0x3fbae3,_0x30dfcc['options']);return db[_0x5301('0x31')][_0x5301('0x49')](_0x3fbae3)[_0x5301('0x29')](handleEntityNotFound(_0x206a95,null))['then'](respondWithResult(_0x206a95,null))[_0x5301('0x46')](handleError(_0x206a95,null));};exports[_0x5301('0x4a')]=function(_0x27ff00,_0x3fe943,_0x3fa1ae){return db[_0x5301('0x31')][_0x5301('0x49')]({'where':{'id':_0x27ff00['params']['id']},'attributes':[_0x5301('0x2e'),_0x5301('0x4b'),_0x5301('0x4c')],'raw':!![]})[_0x5301('0x29')](handleEntityNotFound(_0x3fe943,null))[_0x5301('0x29')](function(_0x1e14e8){if(_0x1e14e8){if(!fs[_0x5301('0x4d')](path[_0x5301('0x4e')](config[_0x5301('0x4f')],_0x5301('0x50'),_0x1e14e8['save_name']+'.'+_0x1e14e8[_0x5301('0x4c')]))){throw new db[(_0x5301('0x51'))][(_0x5301('0x52'))](_0x5301('0x53'));}return _0x3fe943['download'](path[_0x5301('0x4e')](config[_0x5301('0x4f')],_0x5301('0x50'),util[_0x5301('0x54')](_0x5301('0x55'),_0x1e14e8['save_name'],_0x1e14e8[_0x5301('0x4c')])),util[_0x5301('0x54')](_0x5301('0x55'),_0x1e14e8[_0x5301('0x2e')],_0x1e14e8[_0x5301('0x4c')]));}return null;})['catch'](handleError(_0x3fe943,null));};exports[_0x5301('0x56')]=function(_0x23fadb,_0x5aae1e,_0xdefd32){var _0xeed84e={'name':path[_0x5301('0x57')](_0x23fadb[_0x5301('0x58')][_0x5301('0x59')],path[_0x5301('0x5a')](_0x23fadb[_0x5301('0x58')][_0x5301('0x59')])),'save_name':path[_0x5301('0x57')](_0x23fadb[_0x5301('0x58')][_0x5301('0x5b')],path[_0x5301('0x5a')](_0x23fadb[_0x5301('0x58')][_0x5301('0x5b')])),'original_format':path['extname'](_0x23fadb[_0x5301('0x58')][_0x5301('0x59')])[_0x5301('0x5c')](0x1),'converted_format':'wav'};var _0xe6a04c=path[_0x5301('0x4e')](config[_0x5301('0x4f')],_0x5301('0x5d'),_0x23fadb['file'][_0x5301('0x5b')]);var _0x8e3d3=path[_0x5301('0x4e')](config['root'],_0x5301('0x50'),util[_0x5301('0x54')](_0x5301('0x55'),path[_0x5301('0x57')](_0x23fadb[_0x5301('0x58')]['filename'],path['extname'](_0x23fadb[_0x5301('0x58')][_0x5301('0x5b')])),_0xeed84e[_0x5301('0x4c')]));logger['info'](_0x5301('0x5e'),_0xe6a04c);logger[_0x5301('0x5f')](_0x5301('0x60'),_0x8e3d3);try{fs['chmodSync'](_0xe6a04c,parseInt(_0x5301('0x61'),0x8));var _0x45dbe7=sox['transcode'](_0xe6a04c,_0x8e3d3,{'sampleRate':0x1f40,'format':_0x5301('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x45dbe7['on']('error',function(_0x23af64){fs['unlinkSync'](_0xe6a04c);_0x5aae1e[_0x5301('0x1d')](0x1f4)['send'](_0x23af64);});_0x45dbe7['on'](_0x5301('0x63'),function(_0x324c04){_0xeed84e[_0x5301('0x64')]=isNaN(_0x324c04['duration'])?null:_0x324c04['duration']*0x3e8;_0xeed84e[_0x5301('0x65')]=isNaN(_0x324c04[_0x5301('0x66')])?null:_0x324c04[_0x5301('0x66')];_0xeed84e['original_channelCount']=isNaN(_0x324c04[_0x5301('0x67')])?null:_0x324c04[_0x5301('0x67')];_0xeed84e[_0x5301('0x68')]=isNaN(_0x324c04[_0x5301('0x69')])?null:_0x324c04[_0x5301('0x69')];_0xeed84e[_0x5301('0x6a')]=isNaN(_0x324c04['sampleRate'])?null:_0x324c04['sampleRate'];});_0x45dbe7['on'](_0x5301('0x6b'),function(_0x4556ac){_0xeed84e['converted_duration']=isNaN(_0x4556ac[_0x5301('0x6c')])?null:_0x4556ac[_0x5301('0x6c')]*0x3e8;_0xeed84e[_0x5301('0x6d')]=isNaN(_0x4556ac['sampleCount'])?null:_0x4556ac[_0x5301('0x66')];_0xeed84e[_0x5301('0x6e')]=isNaN(_0x4556ac[_0x5301('0x67')])?null:_0x4556ac['channelCount'];_0xeed84e[_0x5301('0x6f')]=isNaN(_0x4556ac[_0x5301('0x69')])?null:_0x4556ac['bitRate'];_0xeed84e[_0x5301('0x70')]=isNaN(_0x4556ac[_0x5301('0x71')])?null:_0x4556ac['sampleRate'];});_0x45dbe7['on'](_0x5301('0x1e'),function(){fs['chmodSync'](_0x8e3d3,parseInt(_0x5301('0x61'),0x8));return db[_0x5301('0x31')][_0x5301('0x56')](_0xeed84e)[_0x5301('0x29')](function(_0x170825){var _0x2f6e7c={'role':_0x23fadb[_0x5301('0x72')]['role'],'userProfileId':_0x23fadb['body'][_0x5301('0x73')]};if(!_0x2f6e7c)throw new Error(_0x5301('0x74'));if(_0x2f6e7c['role']==='user'){var _0xb27bd=_0x170825[_0x5301('0x2b')]({'plain':!![]});return db[_0x5301('0x75')][_0x5301('0x49')]({'where':{'name':'Sounds','userProfileId':_0x2f6e7c[_0x5301('0x73')]},'raw':!![]})[_0x5301('0x29')](function(_0x52d0a1){if(_0x52d0a1&&_0x52d0a1['autoAssociation']===0x0){return db[_0x5301('0x2c')]['create']({'name':_0xb27bd[_0x5301('0x2e')],'resourceId':_0xb27bd['id'],'type':_0x52d0a1[_0x5301('0x2e')],'sectionId':_0x52d0a1['id']},{})[_0x5301('0x29')](function(){return _0x170825;});}else{return _0x170825;}})['catch'](function(_0x5c6e10){logger[_0x5301('0x2d')](_0x5301('0x76'),_0x5c6e10);throw _0x5c6e10;});}return _0x170825;})[_0x5301('0x29')](respondWithResult(_0x5aae1e,null))[_0x5301('0x46')](handleError(_0x5aae1e,null));});_0x45dbe7['start']();}catch(_0xc5d023){_0x5aae1e[_0x5301('0x1d')](0x1f4)[_0x5301('0x77')](_0xc5d023);}};exports[_0x5301('0x28')]=function(_0x206754,_0x3583db,_0x56112a){return db['Sound']['find']({'where':{'id':_0x206754['params']['id']}})[_0x5301('0x29')](handleEntityNotFound(_0x3583db,null))['then'](saveUpdates(_[_0x5301('0x78')](_0x206754[_0x5301('0x72')],[_0x5301('0x2e'),_0x5301('0x79')]),null))[_0x5301('0x29')](respondWithResult(_0x3583db,null))[_0x5301('0x46')](handleError(_0x3583db,null));};exports['delete']=function(_0x5ad542,_0x2d0cbb,_0x12d453){return db['Sound'][_0x5301('0x49')]({'where':{'id':_0x5ad542[_0x5301('0x48')]['id']}})['then'](function(_0x20bf14){if(_0x20bf14){return _0x20bf14['destroy']();}})[_0x5301('0x29')](function(_0x48cec4){var _0x3e8caa=path[_0x5301('0x4e')](config[_0x5301('0x4f')],'server/files/sounds/original',util[_0x5301('0x54')](_0x5301('0x55'),_0x48cec4[_0x5301('0x4b')],_0x48cec4[_0x5301('0x7a')]));var _0x543962=path[_0x5301('0x4e')](config[_0x5301('0x4f')],_0x5301('0x50'),util[_0x5301('0x54')](_0x5301('0x55'),_0x48cec4['save_name'],_0x48cec4[_0x5301('0x4c')]));fs[_0x5301('0x7b')](_0x3e8caa);fs['unlinkSync'](_0x543962);return _0x48cec4;})[_0x5301('0x29')](function(_0x1f7cec){if(_0x1f7cec){return _0x2d0cbb[_0x5301('0x1d')](0xcc)['end']();}})[_0x5301('0x29')](handleEntityNotFound(_0x2d0cbb,null))[_0x5301('0x46')](handleError(_0x2d0cbb,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 8c273e9..dc29352 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 _0xf664=['exports','define','Sound','tools_sounds','lodash','api','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes'];(function(_0x1c67a2,_0x599648){var _0x4fbd8e=function(_0x2e465b){while(--_0x2e465b){_0x1c67a2['push'](_0x1c67a2['shift']());}};_0x4fbd8e(++_0x599648);}(_0xf664,0x1f3));var _0x4f66=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0xf664[_0x1ff575];return _0x48fc9e;};'use strict';var _=require(_0x4f66('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f66('0x1'));var moment=require('moment');var BPromise=require(_0x4f66('0x2'));var rp=require(_0x4f66('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f66('0x4'));var config=require(_0x4f66('0x5'));var attributes=require(_0x4f66('0x6'));module[_0x4f66('0x7')]=function(_0x3b290b,_0x18763c){return _0x3b290b[_0x4f66('0x8')](_0x4f66('0x9'),attributes,{'tableName':_0x4f66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe035=['../../config/logger','api','moment','bluebird','path','./sound.attributes','exports','define','Sound','lodash','util'];(function(_0x58fa36,_0x1756a8){var _0x11fb28=function(_0x38204b){while(--_0x38204b){_0x58fa36['push'](_0x58fa36['shift']());}};_0x11fb28(++_0x1756a8);}(_0xe035,0x1a0));var _0x5e03=function(_0x278455,_0x29bf0a){_0x278455=_0x278455-0x0;var _0x16ce7d=_0xe035[_0x278455];return _0x16ce7d;};'use strict';var _=require(_0x5e03('0x0'));var util=require(_0x5e03('0x1'));var logger=require(_0x5e03('0x2'))(_0x5e03('0x3'));var moment=require(_0x5e03('0x4'));var BPromise=require(_0x5e03('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e03('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5e03('0x7'));module[_0x5e03('0x8')]=function(_0x827b64,_0x8d5367){return _0x827b64[_0x5e03('0x9')](_0x5e03('0xa'),attributes,{'tableName':'tools_sounds','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 b93bd89..ab055f9 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 _0x48f7=['request','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSound','Sound','options','where','attributes','include','map','model','then','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xe4b973,_0x527de2){var _0x5ad4eb=function(_0x459ce3){while(--_0x459ce3){_0xe4b973['push'](_0xe4b973['shift']());}};_0x5ad4eb(++_0x527de2);}(_0x48f7,0x174));var _0x748f=function(_0xf3c72f,_0x2e992e){_0xf3c72f=_0xf3c72f-0x0;var _0x472c34=_0x48f7[_0xf3c72f];return _0x472c34;};'use strict';var _=require(_0x748f('0x0'));var util=require(_0x748f('0x1'));var moment=require(_0x748f('0x2'));var BPromise=require(_0x748f('0x3'));var rs=require(_0x748f('0x4'));var fs=require('fs');var Redis=require(_0x748f('0x5'));var db=require(_0x748f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x748f('0x7'))(_0x748f('0x8'));var config=require(_0x748f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x748f('0xa')][_0x748f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238949,_0x5d06e1,_0x292c28){return new BPromise(function(_0x534ec6,_0x32f7f8){return client[_0x748f('0xc')](_0x238949,_0x292c28)['then'](function(_0x3d0de5){logger['info'](_0x748f('0xd'),_0x5d06e1,_0x748f('0xe'));logger[_0x748f('0xf')](_0x748f('0x10'),_0x5d06e1,_0x748f('0xe'),JSON[_0x748f('0x11')](_0x3d0de5));if(_0x3d0de5['error']){if(_0x3d0de5[_0x748f('0x12')]['code']===0x1f4){logger[_0x748f('0x12')]('Sound,\x20%s,\x20%s',_0x5d06e1,_0x3d0de5['error'][_0x748f('0x13')]);return _0x32f7f8(_0x3d0de5[_0x748f('0x12')]['message']);}logger[_0x748f('0x12')](_0x748f('0xd'),_0x5d06e1,_0x3d0de5[_0x748f('0x12')]['message']);return _0x534ec6(_0x3d0de5[_0x748f('0x12')][_0x748f('0x13')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x5d06e1,_0x748f('0xe'));_0x534ec6(_0x3d0de5[_0x748f('0x14')][_0x748f('0x13')]);}})[_0x748f('0x15')](function(_0x549efd){logger[_0x748f('0x12')]('Sound,\x20%s,\x20%s',_0x5d06e1,_0x549efd);_0x32f7f8(_0x549efd);});});}exports[_0x748f('0x16')]=function(_0x15eff6){var _0x14a166=this;return new Promise(function(_0x8129c7,_0x2d354b){return db[_0x748f('0x17')]['find']({'raw':_0x15eff6[_0x748f('0x18')]?_0x15eff6[_0x748f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x15eff6[_0x748f('0x18')]?_0x15eff6[_0x748f('0x18')][_0x748f('0x19')]||null:null,'attributes':_0x15eff6[_0x748f('0x18')]?_0x15eff6[_0x748f('0x18')][_0x748f('0x1a')]||null:null,'include':_0x15eff6[_0x748f('0x18')]?_0x15eff6[_0x748f('0x18')][_0x748f('0x1b')]?_[_0x748f('0x1c')](_0x15eff6[_0x748f('0x18')]['include'],function(_0x3ff10f){return{'model':db[_0x3ff10f['model']],'as':_0x3ff10f['as'],'attributes':_0x3ff10f[_0x748f('0x1a')],'include':_0x3ff10f[_0x748f('0x1b')]?_[_0x748f('0x1c')](_0x3ff10f[_0x748f('0x1b')],function(_0x148a0d){return{'model':db[_0x148a0d[_0x748f('0x1d')]],'as':_0x148a0d['as'],'attributes':_0x148a0d[_0x748f('0x1a')],'include':_0x148a0d[_0x748f('0x1b')]?_[_0x748f('0x1c')](_0x148a0d[_0x748f('0x1b')],function(_0x33989d){return{'model':db[_0x33989d[_0x748f('0x1d')]],'as':_0x33989d['as'],'attributes':_0x33989d['attributes']};}):[]};}):[]};}):[]:[]})[_0x748f('0x1e')](function(_0x49a3a2){logger[_0x748f('0x1f')](_0x748f('0x16'),_0x15eff6);logger[_0x748f('0xf')](_0x748f('0x16'),_0x15eff6,JSON[_0x748f('0x11')](_0x49a3a2));_0x8129c7(_0x49a3a2);})['catch'](function(_0x1e60a1){logger[_0x748f('0x12')](_0x748f('0x16'),_0x1e60a1['message'],_0x15eff6);_0x2d354b(_0x14a166['error'](0x1f4,_0x1e60a1[_0x748f('0x13')]));});});}; \ No newline at end of file +var _0x9ee9=['rpc','../../config/environment','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSound','Sound','options','raw','where','attributes','include','map','model','debug','lodash','util','randomstring','../../config/utils'];(function(_0x191eb4,_0xa60c80){var _0x2e090a=function(_0x5522a7){while(--_0x5522a7){_0x191eb4['push'](_0x191eb4['shift']());}};_0x2e090a(++_0xa60c80);}(_0x9ee9,0xc0));var _0x99ee=function(_0x12f04a,_0x263d14){_0x12f04a=_0x12f04a-0x0;var _0x3be8bc=_0x9ee9[_0x12f04a];return _0x3be8bc;};'use strict';var _=require(_0x99ee('0x0'));var util=require(_0x99ee('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x99ee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x99ee('0x3'));var logger=require('../../config/logger')(_0x99ee('0x4'));var config=require(_0x99ee('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x99ee('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50be50,_0x14943d,_0x214941){return new BPromise(function(_0x1cb294,_0x162d99){return client[_0x99ee('0x7')](_0x50be50,_0x214941)[_0x99ee('0x8')](function(_0xad1ed6){logger[_0x99ee('0x9')](_0x99ee('0xa'),_0x14943d,_0x99ee('0xb'));logger['debug'](_0x99ee('0xc'),_0x14943d,_0x99ee('0xb'),JSON[_0x99ee('0xd')](_0xad1ed6));if(_0xad1ed6[_0x99ee('0xe')]){if(_0xad1ed6['error'][_0x99ee('0xf')]===0x1f4){logger['error'](_0x99ee('0xa'),_0x14943d,_0xad1ed6[_0x99ee('0xe')][_0x99ee('0x10')]);return _0x162d99(_0xad1ed6['error']['message']);}logger[_0x99ee('0xe')](_0x99ee('0xa'),_0x14943d,_0xad1ed6[_0x99ee('0xe')][_0x99ee('0x10')]);return _0x1cb294(_0xad1ed6[_0x99ee('0xe')][_0x99ee('0x10')]);}else{logger[_0x99ee('0x9')]('Sound,\x20%s,\x20%s',_0x14943d,_0x99ee('0xb'));_0x1cb294(_0xad1ed6['result'][_0x99ee('0x10')]);}})[_0x99ee('0x11')](function(_0x1a497c){logger['error'](_0x99ee('0xa'),_0x14943d,_0x1a497c);_0x162d99(_0x1a497c);});});}exports[_0x99ee('0x12')]=function(_0x1e9ab7){var _0x1e07e5=this;return new Promise(function(_0x786ce8,_0x4da86e){return db[_0x99ee('0x13')]['find']({'raw':_0x1e9ab7[_0x99ee('0x14')]?_0x1e9ab7['options'][_0x99ee('0x15')]===undefined?!![]:![]:!![],'where':_0x1e9ab7[_0x99ee('0x14')]?_0x1e9ab7[_0x99ee('0x14')][_0x99ee('0x16')]||null:null,'attributes':_0x1e9ab7[_0x99ee('0x14')]?_0x1e9ab7[_0x99ee('0x14')][_0x99ee('0x17')]||null:null,'include':_0x1e9ab7[_0x99ee('0x14')]?_0x1e9ab7['options'][_0x99ee('0x18')]?_[_0x99ee('0x19')](_0x1e9ab7[_0x99ee('0x14')][_0x99ee('0x18')],function(_0x377c8e){return{'model':db[_0x377c8e['model']],'as':_0x377c8e['as'],'attributes':_0x377c8e['attributes'],'include':_0x377c8e['include']?_[_0x99ee('0x19')](_0x377c8e[_0x99ee('0x18')],function(_0x54e944){return{'model':db[_0x54e944['model']],'as':_0x54e944['as'],'attributes':_0x54e944[_0x99ee('0x17')],'include':_0x54e944[_0x99ee('0x18')]?_[_0x99ee('0x19')](_0x54e944[_0x99ee('0x18')],function(_0x264def){return{'model':db[_0x264def[_0x99ee('0x1a')]],'as':_0x264def['as'],'attributes':_0x264def[_0x99ee('0x17')]};}):[]};}):[]};}):[]:[]})[_0x99ee('0x8')](function(_0x13a833){logger[_0x99ee('0x9')](_0x99ee('0x12'),_0x1e9ab7);logger[_0x99ee('0x1b')](_0x99ee('0x12'),_0x1e9ab7,JSON[_0x99ee('0xd')](_0x13a833));_0x786ce8(_0x13a833);})[_0x99ee('0x11')](function(_0x1f0fa6){logger[_0x99ee('0xe')](_0x99ee('0x12'),_0x1f0fa6[_0x99ee('0x10')],_0x1e9ab7);_0x4da86e(_0x1e07e5[_0x99ee('0xe')](0x1f4,_0x1f0fa6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b22900d..ec9ebc3 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x258a24,_0x2de4f2){_0x258a24=_0x258a24-0x0;var _0x2876ad=_0x9ffd[_0x258a24];return _0x2876ad;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3ae8f4,_0x2920f4){var _0x367312=function(_0x4dffbf){while(--_0x4dffbf){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x367312(++_0x2920f4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x0b0e[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 45669c3..2856f28 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 _0x6cfc=['STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x1b1aaf,_0x3275b7){var _0x1fe1ae=function(_0x1d31d4){while(--_0x1d31d4){_0x1b1aaf['push'](_0x1b1aaf['shift']());}};_0x1fe1ae(++_0x3275b7);}(_0x6cfc,0x13d));var _0xc6cf=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x6cfc[_0x45d1fd];return _0xd0e542;};'use strict';var Sequelize=require(_0xc6cf('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc6cf('0x1')]},'body':{'type':Sequelize[_0xc6cf('0x2')](_0xc6cf('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xc6cf('0x4')]('in',_0xc6cf('0x5')),'defaultValue':_0xc6cf('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xc6cf('0x1')]},'providerResponse':{'type':Sequelize[_0xc6cf('0x2')]}}; \ No newline at end of file +var _0x11a8=['ENUM','out','sequelize','exports','STRING'];(function(_0x36dd03,_0x5a7c41){var _0x13992f=function(_0x2a259b){while(--_0x2a259b){_0x36dd03['push'](_0x36dd03['shift']());}};_0x13992f(++_0x5a7c41);}(_0x11a8,0xac));var _0x811a=function(_0x48a8db,_0x495a7b){_0x48a8db=_0x48a8db-0x0;var _0x4ec17d=_0x11a8[_0x48a8db];return _0x4ec17d;};'use strict';var Sequelize=require(_0x811a('0x0'));module[_0x811a('0x1')]={'uniqueid':{'type':Sequelize[_0x811a('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x811a('0x3')]('in',_0x811a('0x4')),'defaultValue':_0x811a('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x811a('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 27a36b5..71d8023 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 _0x0447=['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','../../config/utils','sendStatus','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','SquareMessage','fieldName','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','show','rawAttributes','length','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0xdc063f,_0xd0b43d){var _0x27e428=function(_0x510121){while(--_0x510121){_0xdc063f['push'](_0xdc063f['shift']());}};_0x27e428(++_0xd0b43d);}(_0x0447,0x8b));var _0x7044=function(_0x4de226,_0xf589ec){_0x4de226=_0x4de226-0x0;var _0x2fb276=_0x0447[_0x4de226];return _0x2fb276;};'use strict';var emlformat=require(_0x7044('0x0'));var rimraf=require(_0x7044('0x1'));var zipdir=require(_0x7044('0x2'));var jsonpatch=require(_0x7044('0x3'));var rp=require(_0x7044('0x4'));var moment=require('moment');var BPromise=require(_0x7044('0x5'));var Mustache=require(_0x7044('0x6'));var util=require(_0x7044('0x7'));var path=require(_0x7044('0x8'));var sox=require(_0x7044('0x9'));var csv=require(_0x7044('0xa'));var ejs=require(_0x7044('0xb'));var fs=require('fs');var fs_extra=require(_0x7044('0xc'));var _=require(_0x7044('0xd'));var squel=require('squel');var crypto=require(_0x7044('0xe'));var jsforce=require(_0x7044('0xf'));var deskjs=require(_0x7044('0x10'));var toCsv=require(_0x7044('0xa'));var querystring=require('querystring');var Papa=require(_0x7044('0x11'));var Redis=require(_0x7044('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7044('0x13'));var as=require(_0x7044('0x14'));var hardwareService=require(_0x7044('0x15'));var logger=require(_0x7044('0x16'))('api');var utils=require(_0x7044('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe26cea,_0x41b118){_0x41b118=_0x41b118||0xcc;return function(_0xf01bdf){if(_0xf01bdf){return _0xe26cea[_0x7044('0x18')](_0x41b118);}return _0xe26cea['status'](_0x41b118)['end']();};}function respondWithResult(_0xd5ae12,_0x3316c4){_0x3316c4=_0x3316c4||0xc8;return function(_0x58eb57){if(_0x58eb57){return _0xd5ae12['status'](_0x3316c4)[_0x7044('0x19')](_0x58eb57);}};}function respondWithFilteredResult(_0x310535,_0x79f418){return function(_0x35769e){if(_0x35769e){var _0x2fecb1=typeof _0x79f418[_0x7044('0x1a')]==='undefined'&&typeof _0x79f418[_0x7044('0x1b')]===_0x7044('0x1c');var _0x1b6a10=_0x35769e[_0x7044('0x1d')];var _0x219486=_0x2fecb1?0x0:_0x79f418[_0x7044('0x1a')];var _0x4df89b=_0x2fecb1?_0x35769e[_0x7044('0x1d')]:_0x79f418[_0x7044('0x1a')]+_0x79f418[_0x7044('0x1b')];var _0x4e7285;if(_0x4df89b>=_0x1b6a10){_0x4df89b=_0x1b6a10;_0x4e7285=0xc8;}else{_0x4e7285=0xce;}_0x310535['status'](_0x4e7285);return _0x310535['set'](_0x7044('0x1e'),_0x219486+'-'+_0x4df89b+'/'+_0x1b6a10)[_0x7044('0x19')](_0x35769e);}return null;};}function patchUpdates(_0x2c5dcb){return function(_0x4104a9){try{jsonpatch[_0x7044('0x1f')](_0x4104a9,_0x2c5dcb,!![]);}catch(_0x4faffe){return BPromise[_0x7044('0x20')](_0x4faffe);}return _0x4104a9['save']();};}function saveUpdates(_0x4af476,_0x3db88b){return function(_0x8bd8c8){if(_0x8bd8c8){return _0x8bd8c8[_0x7044('0x21')](_0x4af476)[_0x7044('0x22')](function(_0x39d85e){return _0x39d85e;});}return null;};}function removeEntity(_0x105da8,_0x41a079){return function(_0x9452a1){if(_0x9452a1){return _0x9452a1[_0x7044('0x23')]()['then'](function(){_0x105da8['status'](0xcc)[_0x7044('0x24')]();});}};}function handleEntityNotFound(_0x16c18b,_0x1e065d){return function(_0x29caa4){if(!_0x29caa4){_0x16c18b[_0x7044('0x18')](0x194);}return _0x29caa4;};}function handleError(_0x3fb162,_0x25ccaf){_0x25ccaf=_0x25ccaf||0x1f4;return function(_0x45ae52){logger[_0x7044('0x25')](_0x45ae52[_0x7044('0x26')]);if(_0x45ae52[_0x7044('0x27')]){delete _0x45ae52[_0x7044('0x27')];}_0x3fb162['status'](_0x25ccaf)[_0x7044('0x28')](_0x45ae52);};}exports[_0x7044('0x29')]=function(_0x2614a3,_0x1a75ff){var _0x4b7de2={},_0x2261af={},_0x5dd28c={'count':0x0,'rows':[]};var _0x581f68=_['map'](db[_0x7044('0x2a')]['rawAttributes'],function(_0x28df42){return{'name':_0x28df42[_0x7044('0x2b')],'type':_0x28df42['type']['key']};});_0x2261af[_0x7044('0x2c')]=_['map'](_0x581f68,'name');_0x2261af['query']=_[_0x7044('0x2d')](_0x2614a3[_0x7044('0x2e')]);_0x2261af['filters']=_[_0x7044('0x2f')](_0x2261af[_0x7044('0x2c')],_0x2261af[_0x7044('0x2e')]);_0x4b7de2[_0x7044('0x30')]=_[_0x7044('0x2f')](_0x2261af['model'],qs[_0x7044('0x31')](_0x2614a3[_0x7044('0x2e')][_0x7044('0x31')]));_0x4b7de2[_0x7044('0x30')]=_0x4b7de2[_0x7044('0x30')]['length']?_0x4b7de2[_0x7044('0x30')]:_0x2261af[_0x7044('0x2c')];if(!_0x2614a3['query'][_0x7044('0x32')](_0x7044('0x33'))){_0x4b7de2[_0x7044('0x1b')]=qs[_0x7044('0x1b')](_0x2614a3[_0x7044('0x2e')][_0x7044('0x1b')]);_0x4b7de2['offset']=qs['offset'](_0x2614a3[_0x7044('0x2e')][_0x7044('0x1a')]);}_0x4b7de2['order']=qs[_0x7044('0x34')](_0x2614a3[_0x7044('0x2e')][_0x7044('0x34')]);_0x4b7de2[_0x7044('0x35')]=qs[_0x7044('0x36')](_[_0x7044('0x37')](_0x2614a3[_0x7044('0x2e')],_0x2261af[_0x7044('0x36')]),_0x581f68);if(_0x2614a3['query']['filter']){_0x4b7de2[_0x7044('0x35')]=_[_0x7044('0x38')](_0x4b7de2[_0x7044('0x35')],{'$or':_[_0x7044('0x39')](_0x581f68,function(_0x21bda2){if(_0x21bda2[_0x7044('0x3a')]!==_0x7044('0x3b')){var _0x4f6ca2={};_0x4f6ca2[_0x21bda2[_0x7044('0x27')]]={'$like':'%'+_0x2614a3[_0x7044('0x2e')][_0x7044('0x3c')]+'%'};return _0x4f6ca2;}})});}_0x4b7de2=_['merge']({},_0x4b7de2,_0x2614a3[_0x7044('0x3d')]);var _0x5ce758={'where':_0x4b7de2['where']};return db[_0x7044('0x2a')]['count'](_0x5ce758)[_0x7044('0x22')](function(_0x388627){_0x5dd28c[_0x7044('0x1d')]=_0x388627;if(_0x2614a3[_0x7044('0x2e')][_0x7044('0x3e')]){_0x4b7de2[_0x7044('0x3f')]=[{'all':!![]}];}return db[_0x7044('0x2a')][_0x7044('0x40')](_0x4b7de2);})[_0x7044('0x22')](function(_0x1b4f01){_0x5dd28c['rows']=_0x1b4f01;return _0x5dd28c;})['then'](respondWithFilteredResult(_0x1a75ff,_0x4b7de2))['catch'](handleError(_0x1a75ff,null));};exports[_0x7044('0x41')]=function(_0x294483,_0x43a43c){var _0x40d135={'raw':!![],'where':{'id':_0x294483['params']['id']}},_0x5c4d66={};_0x5c4d66['model']=_[_0x7044('0x2d')](db[_0x7044('0x2a')][_0x7044('0x42')]);_0x5c4d66[_0x7044('0x2e')]=_[_0x7044('0x2d')](_0x294483[_0x7044('0x2e')]);_0x5c4d66[_0x7044('0x36')]=_[_0x7044('0x2f')](_0x5c4d66[_0x7044('0x2c')],_0x5c4d66['query']);_0x40d135['attributes']=_['intersection'](_0x5c4d66[_0x7044('0x2c')],qs[_0x7044('0x31')](_0x294483[_0x7044('0x2e')][_0x7044('0x31')]));_0x40d135[_0x7044('0x30')]=_0x40d135[_0x7044('0x30')][_0x7044('0x43')]?_0x40d135['attributes']:_0x5c4d66['model'];if(_0x294483[_0x7044('0x2e')][_0x7044('0x3e')]){_0x40d135[_0x7044('0x3f')]=[{'all':!![]}];}_0x40d135=_[_0x7044('0x38')]({},_0x40d135,_0x294483[_0x7044('0x3d')]);return db[_0x7044('0x2a')]['find'](_0x40d135)['then'](handleEntityNotFound(_0x43a43c,null))['then'](respondWithResult(_0x43a43c,null))[_0x7044('0x44')](handleError(_0x43a43c,null));};exports[_0x7044('0x45')]=function(_0x38ac39,_0x353120){return db['SquareMessage'][_0x7044('0x45')](_0x38ac39[_0x7044('0x46')],{})[_0x7044('0x22')](respondWithResult(_0x353120,0xc9))['catch'](handleError(_0x353120,null));};exports[_0x7044('0x21')]=function(_0x45e599,_0x8ca211){if(_0x45e599['body']['id']){delete _0x45e599[_0x7044('0x46')]['id'];}return db[_0x7044('0x2a')][_0x7044('0x47')]({'where':{'id':_0x45e599[_0x7044('0x48')]['id']}})['then'](handleEntityNotFound(_0x8ca211,null))[_0x7044('0x22')](saveUpdates(_0x45e599[_0x7044('0x46')],null))['then'](respondWithResult(_0x8ca211,null))[_0x7044('0x44')](handleError(_0x8ca211,null));};exports[_0x7044('0x23')]=function(_0x1da055,_0x29641b){return db[_0x7044('0x2a')]['find']({'where':{'id':_0x1da055[_0x7044('0x48')]['id']}})[_0x7044('0x22')](handleEntityNotFound(_0x29641b,null))['then'](removeEntity(_0x29641b,null))['catch'](handleError(_0x29641b,null));}; \ No newline at end of file +var _0x202a=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','include','findAll','rows','catch','show','rawAttributes','includeAll','body','find','params','destroy','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/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','json','apply','update','then','sendStatus','error','stack','name','send','index','map','SquareMessage','fieldName','model','query','keys','filters'];(function(_0xb27371,_0x47fc76){var _0x67bcd0=function(_0xb4ea02){while(--_0xb4ea02){_0xb27371['push'](_0xb27371['shift']());}};_0x67bcd0(++_0x47fc76);}(_0x202a,0xf8));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa202('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa202('0x1'));var rp=require(_0xa202('0x2'));var moment=require(_0xa202('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa202('0x4'));var util=require(_0xa202('0x5'));var path=require(_0xa202('0x6'));var sox=require('sox');var csv=require(_0xa202('0x7'));var ejs=require(_0xa202('0x8'));var fs=require('fs');var fs_extra=require(_0xa202('0x9'));var _=require(_0xa202('0xa'));var squel=require(_0xa202('0xb'));var crypto=require(_0xa202('0xc'));var jsforce=require(_0xa202('0xd'));var deskjs=require(_0xa202('0xe'));var toCsv=require(_0xa202('0x7'));var querystring=require(_0xa202('0xf'));var Papa=require(_0xa202('0x10'));var Redis=require(_0xa202('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa202('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa202('0x13'));var logger=require(_0xa202('0x14'))('api');var utils=require(_0xa202('0x15'));var config=require(_0xa202('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa202('0x17'))['db'];function respondWithStatusCode(_0x6787f7,_0x745440){_0x745440=_0x745440||0xcc;return function(_0x1dca69){if(_0x1dca69){return _0x6787f7['sendStatus'](_0x745440);}return _0x6787f7[_0xa202('0x18')](_0x745440)[_0xa202('0x19')]();};}function respondWithResult(_0x3d83ee,_0x105350){_0x105350=_0x105350||0xc8;return function(_0x33294d){if(_0x33294d){return _0x3d83ee[_0xa202('0x18')](_0x105350)['json'](_0x33294d);}};}function respondWithFilteredResult(_0x6acd9a,_0x5cec1f){return function(_0x16b3d5){if(_0x16b3d5){var _0x2ef86f=typeof _0x5cec1f[_0xa202('0x1a')]===_0xa202('0x1b')&&typeof _0x5cec1f[_0xa202('0x1c')]===_0xa202('0x1b');var _0xac27e6=_0x16b3d5['count'];var _0x5ea51d=_0x2ef86f?0x0:_0x5cec1f[_0xa202('0x1a')];var _0x1f70d5=_0x2ef86f?_0x16b3d5['count']:_0x5cec1f[_0xa202('0x1a')]+_0x5cec1f[_0xa202('0x1c')];var _0x28d479;if(_0x1f70d5>=_0xac27e6){_0x1f70d5=_0xac27e6;_0x28d479=0xc8;}else{_0x28d479=0xce;}_0x6acd9a[_0xa202('0x18')](_0x28d479);return _0x6acd9a[_0xa202('0x1d')](_0xa202('0x1e'),_0x5ea51d+'-'+_0x1f70d5+'/'+_0xac27e6)[_0xa202('0x1f')](_0x16b3d5);}return null;};}function patchUpdates(_0xce5cc7){return function(_0x2e08cb){try{jsonpatch[_0xa202('0x20')](_0x2e08cb,_0xce5cc7,!![]);}catch(_0x266dd7){return BPromise['reject'](_0x266dd7);}return _0x2e08cb['save']();};}function saveUpdates(_0x2b8983,_0x8a840f){return function(_0x3666b7){if(_0x3666b7){return _0x3666b7[_0xa202('0x21')](_0x2b8983)[_0xa202('0x22')](function(_0x72b956){return _0x72b956;});}return null;};}function removeEntity(_0xbb4b2b,_0x155baf){return function(_0x3bb45a){if(_0x3bb45a){return _0x3bb45a['destroy']()[_0xa202('0x22')](function(){_0xbb4b2b['status'](0xcc)[_0xa202('0x19')]();});}};}function handleEntityNotFound(_0x4e771d,_0x550bb5){return function(_0x33012c){if(!_0x33012c){_0x4e771d[_0xa202('0x23')](0x194);}return _0x33012c;};}function handleError(_0x26541b,_0x4b215c){_0x4b215c=_0x4b215c||0x1f4;return function(_0x17c2b8){logger[_0xa202('0x24')](_0x17c2b8[_0xa202('0x25')]);if(_0x17c2b8[_0xa202('0x26')]){delete _0x17c2b8[_0xa202('0x26')];}_0x26541b[_0xa202('0x18')](_0x4b215c)[_0xa202('0x27')](_0x17c2b8);};}exports[_0xa202('0x28')]=function(_0x10975e,_0x5e3307){var _0x30f1c3={},_0x378d3d={},_0x9736d={'count':0x0,'rows':[]};var _0x4b8305=_[_0xa202('0x29')](db[_0xa202('0x2a')]['rawAttributes'],function(_0x3939c6){return{'name':_0x3939c6[_0xa202('0x2b')],'type':_0x3939c6['type']['key']};});_0x378d3d[_0xa202('0x2c')]=_['map'](_0x4b8305,'name');_0x378d3d[_0xa202('0x2d')]=_[_0xa202('0x2e')](_0x10975e[_0xa202('0x2d')]);_0x378d3d[_0xa202('0x2f')]=_[_0xa202('0x30')](_0x378d3d[_0xa202('0x2c')],_0x378d3d[_0xa202('0x2d')]);_0x30f1c3[_0xa202('0x31')]=_[_0xa202('0x30')](_0x378d3d[_0xa202('0x2c')],qs[_0xa202('0x32')](_0x10975e[_0xa202('0x2d')][_0xa202('0x32')]));_0x30f1c3[_0xa202('0x31')]=_0x30f1c3[_0xa202('0x31')][_0xa202('0x33')]?_0x30f1c3[_0xa202('0x31')]:_0x378d3d[_0xa202('0x2c')];if(!_0x10975e['query'][_0xa202('0x34')](_0xa202('0x35'))){_0x30f1c3[_0xa202('0x1c')]=qs[_0xa202('0x1c')](_0x10975e[_0xa202('0x2d')]['limit']);_0x30f1c3[_0xa202('0x1a')]=qs['offset'](_0x10975e['query'][_0xa202('0x1a')]);}_0x30f1c3[_0xa202('0x36')]=qs['sort'](_0x10975e[_0xa202('0x2d')][_0xa202('0x37')]);_0x30f1c3[_0xa202('0x38')]=qs[_0xa202('0x2f')](_[_0xa202('0x39')](_0x10975e[_0xa202('0x2d')],_0x378d3d['filters']),_0x4b8305);if(_0x10975e[_0xa202('0x2d')][_0xa202('0x3a')]){_0x30f1c3[_0xa202('0x38')]=_[_0xa202('0x3b')](_0x30f1c3['where'],{'$or':_[_0xa202('0x29')](_0x4b8305,function(_0x188db2){if(_0x188db2[_0xa202('0x3c')]!=='VIRTUAL'){var _0x16be42={};_0x16be42[_0x188db2['name']]={'$like':'%'+_0x10975e[_0xa202('0x2d')][_0xa202('0x3a')]+'%'};return _0x16be42;}})});}_0x30f1c3=_[_0xa202('0x3b')]({},_0x30f1c3,_0x10975e[_0xa202('0x3d')]);var _0x4a38a2={'where':_0x30f1c3['where']};return db[_0xa202('0x2a')][_0xa202('0x3e')](_0x4a38a2)['then'](function(_0x2bf33f){_0x9736d[_0xa202('0x3e')]=_0x2bf33f;if(_0x10975e['query']['includeAll']){_0x30f1c3[_0xa202('0x3f')]=[{'all':!![]}];}return db[_0xa202('0x2a')][_0xa202('0x40')](_0x30f1c3);})[_0xa202('0x22')](function(_0x1fa08e){_0x9736d[_0xa202('0x41')]=_0x1fa08e;return _0x9736d;})[_0xa202('0x22')](respondWithFilteredResult(_0x5e3307,_0x30f1c3))[_0xa202('0x42')](handleError(_0x5e3307,null));};exports[_0xa202('0x43')]=function(_0x5ecdb6,_0xed7568){var _0x52ba46={'raw':!![],'where':{'id':_0x5ecdb6['params']['id']}},_0xd3ce4b={};_0xd3ce4b['model']=_['keys'](db['SquareMessage'][_0xa202('0x44')]);_0xd3ce4b['query']=_['keys'](_0x5ecdb6['query']);_0xd3ce4b[_0xa202('0x2f')]=_[_0xa202('0x30')](_0xd3ce4b['model'],_0xd3ce4b[_0xa202('0x2d')]);_0x52ba46[_0xa202('0x31')]=_[_0xa202('0x30')](_0xd3ce4b[_0xa202('0x2c')],qs[_0xa202('0x32')](_0x5ecdb6[_0xa202('0x2d')]['fields']));_0x52ba46[_0xa202('0x31')]=_0x52ba46[_0xa202('0x31')]['length']?_0x52ba46['attributes']:_0xd3ce4b[_0xa202('0x2c')];if(_0x5ecdb6[_0xa202('0x2d')][_0xa202('0x45')]){_0x52ba46[_0xa202('0x3f')]=[{'all':!![]}];}_0x52ba46=_[_0xa202('0x3b')]({},_0x52ba46,_0x5ecdb6[_0xa202('0x3d')]);return db['SquareMessage']['find'](_0x52ba46)[_0xa202('0x22')](handleEntityNotFound(_0xed7568,null))['then'](respondWithResult(_0xed7568,null))[_0xa202('0x42')](handleError(_0xed7568,null));};exports['create']=function(_0x2136de,_0x5a70ad){return db[_0xa202('0x2a')]['create'](_0x2136de[_0xa202('0x46')],{})['then'](respondWithResult(_0x5a70ad,0xc9))['catch'](handleError(_0x5a70ad,null));};exports[_0xa202('0x21')]=function(_0x4623ca,_0x411f20){if(_0x4623ca['body']['id']){delete _0x4623ca[_0xa202('0x46')]['id'];}return db[_0xa202('0x2a')][_0xa202('0x47')]({'where':{'id':_0x4623ca[_0xa202('0x48')]['id']}})[_0xa202('0x22')](handleEntityNotFound(_0x411f20,null))[_0xa202('0x22')](saveUpdates(_0x4623ca[_0xa202('0x46')],null))[_0xa202('0x22')](respondWithResult(_0x411f20,null))['catch'](handleError(_0x411f20,null));};exports[_0xa202('0x49')]=function(_0x16d49f,_0x485f5e){return db['SquareMessage'][_0xa202('0x47')]({'where':{'id':_0x16d49f[_0xa202('0x48')]['id']}})['then'](handleEntityNotFound(_0x485f5e,null))[_0xa202('0x22')](removeEntity(_0x485f5e,null))[_0xa202('0x42')](handleError(_0x485f5e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6d54d01..867b2f0 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 _0xf9d7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash'];(function(_0x44f752,_0x3108c9){var _0x2fea3f=function(_0x18c6be){while(--_0x18c6be){_0x44f752['push'](_0x44f752['shift']());}};_0x2fea3f(++_0x3108c9);}(_0xf9d7,0xdf));var _0x7f9d=function(_0x46d613,_0xf6aa29){_0x46d613=_0x46d613-0x0;var _0x3494e1=_0xf9d7[_0x46d613];return _0x3494e1;};'use strict';var _=require(_0x7f9d('0x0'));var util=require(_0x7f9d('0x1'));var logger=require(_0x7f9d('0x2'))('api');var moment=require(_0x7f9d('0x3'));var BPromise=require(_0x7f9d('0x4'));var rp=require(_0x7f9d('0x5'));var fs=require('fs');var path=require(_0x7f9d('0x6'));var rimraf=require(_0x7f9d('0x7'));var config=require(_0x7f9d('0x8'));var attributes=require(_0x7f9d('0x9'));module[_0x7f9d('0xa')]=function(_0x597c1a,_0x35a7b6){return _0x597c1a[_0x7f9d('0xb')](_0x7f9d('0xc'),attributes,{'tableName':_0x7f9d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a50=['define','SquareMessage','square_messages','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a50,0x177));var _0x02a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x02a5('0x0'));var logger=require('../../config/logger')(_0x02a5('0x1'));var moment=require(_0x02a5('0x2'));var BPromise=require(_0x02a5('0x3'));var rp=require(_0x02a5('0x4'));var fs=require('fs');var path=require(_0x02a5('0x5'));var rimraf=require(_0x02a5('0x6'));var config=require(_0x02a5('0x7'));var attributes=require(_0x02a5('0x8'));module['exports']=function(_0x232204,_0x79dd13){return _0x232204[_0x02a5('0x9')](_0x02a5('0xa'),attributes,{'tableName':_0x02a5('0xb'),'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 d7dc67b..38f432e 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 _0x43e9=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','create','body','options','raw','CreateSquareMessage','catch','lodash','util','moment','bluebird'];(function(_0x58c0fd,_0x8abc7d){var _0x5b1e33=function(_0x1819c6){while(--_0x1819c6){_0x58c0fd['push'](_0x58c0fd['shift']());}};_0x5b1e33(++_0x8abc7d);}(_0x43e9,0xc4));var _0x943e=function(_0xab1d07,_0x1851e2){_0xab1d07=_0xab1d07-0x0;var _0x61b33d=_0x43e9[_0xab1d07];return _0x61b33d;};'use strict';var _=require(_0x943e('0x0'));var util=require(_0x943e('0x1'));var moment=require(_0x943e('0x2'));var BPromise=require(_0x943e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x943e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x943e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x943e('0x6'));var jayson=require(_0x943e('0x7'));var client=jayson[_0x943e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da1a6,_0xdb5441,_0x417e23){return new BPromise(function(_0x317113,_0x4ae2d0){return client[_0x943e('0x9')](_0x5da1a6,_0x417e23)[_0x943e('0xa')](function(_0x11c5b9){logger['info'](_0x943e('0xb'),_0xdb5441,_0x943e('0xc'));logger['debug'](_0x943e('0xd'),_0xdb5441,'request\x20sent',JSON[_0x943e('0xe')](_0x11c5b9));if(_0x11c5b9['error']){if(_0x11c5b9[_0x943e('0xf')]['code']===0x1f4){logger[_0x943e('0xf')](_0x943e('0xb'),_0xdb5441,_0x11c5b9[_0x943e('0xf')][_0x943e('0x10')]);return _0x4ae2d0(_0x11c5b9['error'][_0x943e('0x10')]);}logger[_0x943e('0xf')](_0x943e('0xb'),_0xdb5441,_0x11c5b9['error']['message']);return _0x317113(_0x11c5b9[_0x943e('0xf')]['message']);}else{logger[_0x943e('0x11')](_0x943e('0xb'),_0xdb5441,_0x943e('0xc'));_0x317113(_0x11c5b9[_0x943e('0x12')][_0x943e('0x10')]);}})['catch'](function(_0x4905fa){logger['error'](_0x943e('0xb'),_0xdb5441,_0x4905fa);_0x4ae2d0(_0x4905fa);});});}exports['CreateSquareMessage']=function(_0x1a027b){var _0x13a7a6=this;return new Promise(function(_0x5b718a,_0x16cb05){return db['SquareMessage'][_0x943e('0x13')](_0x1a027b[_0x943e('0x14')],{'raw':_0x1a027b[_0x943e('0x15')]?_0x1a027b[_0x943e('0x15')][_0x943e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1c93d8){logger['info'](_0x943e('0x17'),_0x1a027b);logger['debug'](_0x943e('0x17'),_0x1a027b,JSON['stringify'](_0x1c93d8));_0x5b718a(_0x1c93d8);})[_0x943e('0x18')](function(_0x5ea733){logger[_0x943e('0xf')](_0x943e('0x17'),_0x5ea733[_0x943e('0x10')],_0x1a027b);_0x16cb05(_0x13a7a6[_0x943e('0xf')](0x1f4,_0x5ea733[_0x943e('0x10')]));});});}; \ No newline at end of file +var _0x7253=['CreateSquareMessage','SquareMessage','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0x7253,0x1be));var _0x3725=function(_0xd148b1,_0x300e46){_0xd148b1=_0xd148b1-0x0;var _0x1153af=_0x7253[_0xd148b1];return _0x1153af;};'use strict';var _=require(_0x3725('0x0'));var util=require(_0x3725('0x1'));var moment=require(_0x3725('0x2'));var BPromise=require(_0x3725('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3725('0x4'));var db=require(_0x3725('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3725('0x6'))(_0x3725('0x7'));var config=require('../../config/environment');var jayson=require(_0x3725('0x8'));var client=jayson[_0x3725('0x9')][_0x3725('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1734,_0x4af058,_0x227b37){return new BPromise(function(_0x462516,_0x3e0a05){return client[_0x3725('0xb')](_0x4b1734,_0x227b37)['then'](function(_0x223fa4){logger['info'](_0x3725('0xc'),_0x4af058,'request\x20sent');logger[_0x3725('0xd')](_0x3725('0xe'),_0x4af058,'request\x20sent',JSON[_0x3725('0xf')](_0x223fa4));if(_0x223fa4[_0x3725('0x10')]){if(_0x223fa4[_0x3725('0x10')][_0x3725('0x11')]===0x1f4){logger[_0x3725('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4af058,_0x223fa4[_0x3725('0x10')]['message']);return _0x3e0a05(_0x223fa4['error']['message']);}logger[_0x3725('0x10')](_0x3725('0xc'),_0x4af058,_0x223fa4[_0x3725('0x10')]['message']);return _0x462516(_0x223fa4[_0x3725('0x10')][_0x3725('0x12')]);}else{logger[_0x3725('0x13')](_0x3725('0xc'),_0x4af058,'request\x20sent');_0x462516(_0x223fa4[_0x3725('0x14')][_0x3725('0x12')]);}})[_0x3725('0x15')](function(_0x2dd225){logger['error']('SquareMessage,\x20%s,\x20%s',_0x4af058,_0x2dd225);_0x3e0a05(_0x2dd225);});});}exports[_0x3725('0x16')]=function(_0xb06fcd){var _0x23af75=this;return new Promise(function(_0x2e3c7e,_0x155955){return db[_0x3725('0x17')]['create'](_0xb06fcd['body'],{'raw':_0xb06fcd[_0x3725('0x18')]?_0xb06fcd[_0x3725('0x18')][_0x3725('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x410040){logger['info'](_0x3725('0x16'),_0xb06fcd);logger[_0x3725('0xd')](_0x3725('0x16'),_0xb06fcd,JSON['stringify'](_0x410040));_0x2e3c7e(_0x410040);})[_0x3725('0x15')](function(_0x2aa373){logger[_0x3725('0x10')]('CreateSquareMessage',_0x2aa373['message'],_0xb06fcd);_0x155955(_0x23af75[_0x3725('0x10')](0x1f4,_0x2aa373['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 5658aab..4811d51 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 _0x77f4=['/:id','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','15s','test','post','put'];(function(_0x47fd17,_0x4f7037){var _0x353a4b=function(_0x16badc){while(--_0x16badc){_0x47fd17['push'](_0x47fd17['shift']());}};_0x353a4b(++_0x4f7037);}(_0x77f4,0x9b));var _0x477f=function(_0x1fff85,_0x48d856){_0x1fff85=_0x1fff85-0x0;var _0x3e0edd=_0x77f4[_0x1fff85];return _0x3e0edd;};'use strict';var multer=require('multer');var util=require(_0x477f('0x0'));var path=require(_0x477f('0x1'));var timeout=require(_0x477f('0x2'));var express=require(_0x477f('0x3'));var router=express[_0x477f('0x4')]();var fs_extra=require(_0x477f('0x5'));var auth=require(_0x477f('0x6'));var interaction=require(_0x477f('0x7'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x477f('0x8')]('/',auth[_0x477f('0x9')](),controller[_0x477f('0xa')]);router[_0x477f('0x8')]('/:id',auth[_0x477f('0x9')](),controller[_0x477f('0xb')]);router[_0x477f('0x8')]('/:id/test',auth[_0x477f('0x9')](),timeout(_0x477f('0xc')),controller[_0x477f('0xd')]);router[_0x477f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x477f('0xf')](_0x477f('0x10'),auth[_0x477f('0x9')](),controller['update']);router[_0x477f('0x11')](_0x477f('0x10'),auth[_0x477f('0x9')](),controller[_0x477f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x960c=['../../config/environment','./squareOdbc.controller','isAuthenticated','get','/:id','/:id/test','post','create','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xa2c51c,_0x98ad95){var _0x2f5401=function(_0xaa79c3){while(--_0xaa79c3){_0xa2c51c['push'](_0xa2c51c['shift']());}};_0x2f5401(++_0x98ad95);}(_0x960c,0xac));var _0xc960=function(_0xd4abe9,_0x311059){_0xd4abe9=_0xd4abe9-0x0;var _0x28907f=_0x960c[_0xd4abe9];return _0x28907f;};'use strict';var multer=require(_0xc960('0x0'));var util=require(_0xc960('0x1'));var path=require(_0xc960('0x2'));var timeout=require(_0xc960('0x3'));var express=require(_0xc960('0x4'));var router=express[_0xc960('0x5')]();var fs_extra=require(_0xc960('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc960('0x7'));var config=require(_0xc960('0x8'));var controller=require(_0xc960('0x9'));router['get']('/',auth[_0xc960('0xa')](),controller['index']);router[_0xc960('0xb')](_0xc960('0xc'),auth[_0xc960('0xa')](),controller['show']);router['get'](_0xc960('0xd'),auth[_0xc960('0xa')](),timeout('15s'),controller['test']);router[_0xc960('0xe')]('/',auth[_0xc960('0xa')](),controller[_0xc960('0xf')]);router[_0xc960('0x10')](_0xc960('0xc'),auth[_0xc960('0xa')](),controller['update']);router[_0xc960('0x11')](_0xc960('0xc'),auth[_0xc960('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index b175490..713e753 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 _0x8bfd=['name','sequelize','exports','STRING'];(function(_0x86597e,_0x41b085){var _0x25afe3=function(_0x4beb9f){while(--_0x4beb9f){_0x86597e['push'](_0x86597e['shift']());}};_0x25afe3(++_0x41b085);}(_0x8bfd,0xcd));var _0xd8bf=function(_0x2d747c,_0x851c49){_0x2d747c=_0x2d747c-0x0;var _0x2ac042=_0x8bfd[_0x2d747c];return _0x2ac042;};'use strict';var Sequelize=require(_0xd8bf('0x0'));module[_0xd8bf('0x1')]={'name':{'type':Sequelize[_0xd8bf('0x2')],'unique':_0xd8bf('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8bf('0x2')]}}; \ No newline at end of file +var _0xa6ea=['STRING','exports'];(function(_0xd12591,_0x456154){var _0x4f2e32=function(_0x4fc2c5){while(--_0x4fc2c5){_0xd12591['push'](_0xd12591['shift']());}};_0x4f2e32(++_0x456154);}(_0xa6ea,0xd7));var _0xaa6e=function(_0x4cef4c,_0x7f3b18){_0x4cef4c=_0x4cef4c-0x0;var _0xd5d4ec=_0xa6ea[_0x4cef4c];return _0xd5d4ec;};'use strict';var Sequelize=require('sequelize');module[_0xaa6e('0x0')]={'name':{'type':Sequelize[_0xaa6e('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'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 79ea0cc..9142654 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 _0xbe78=['mustache','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','get','ODBC','destroy','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','includeAll','include','findAll','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x141017,_0x4223ba){var _0x377c66=function(_0x3ca5e0){while(--_0x3ca5e0){_0x141017['push'](_0x141017['shift']());}};_0x377c66(++_0x4223ba);}(_0xbe78,0x156));var _0x8be7=function(_0x930141,_0x4367c2){_0x930141=_0x930141-0x0;var _0x5bbad7=_0xbe78[_0x930141];return _0x5bbad7;};'use strict';var emlformat=require(_0x8be7('0x0'));var rimraf=require(_0x8be7('0x1'));var zipdir=require(_0x8be7('0x2'));var jsonpatch=require(_0x8be7('0x3'));var rp=require('request-promise');var moment=require(_0x8be7('0x4'));var BPromise=require(_0x8be7('0x5'));var Mustache=require(_0x8be7('0x6'));var util=require(_0x8be7('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8be7('0x8'));var fs=require('fs');var fs_extra=require(_0x8be7('0x9'));var _=require(_0x8be7('0xa'));var squel=require(_0x8be7('0xb'));var crypto=require(_0x8be7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8be7('0xd'));var toCsv=require(_0x8be7('0xe'));var querystring=require(_0x8be7('0xf'));var Papa=require(_0x8be7('0x10'));var Redis=require(_0x8be7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8be7('0x12'));var as=require(_0x8be7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8be7('0x14'))(_0x8be7('0x15'));var utils=require(_0x8be7('0x16'));var config=require(_0x8be7('0x17'));var licenseUtil=require(_0x8be7('0x18'));var db=require(_0x8be7('0x19'))['db'];function respondWithStatusCode(_0x250580,_0x2c8288){_0x2c8288=_0x2c8288||0xcc;return function(_0x208d7b){if(_0x208d7b){return _0x250580[_0x8be7('0x1a')](_0x2c8288);}return _0x250580[_0x8be7('0x1b')](_0x2c8288)[_0x8be7('0x1c')]();};}function respondWithResult(_0x394c6a,_0x2d6a8f){_0x2d6a8f=_0x2d6a8f||0xc8;return function(_0x591b8c){if(_0x591b8c){return _0x394c6a['status'](_0x2d6a8f)[_0x8be7('0x1d')](_0x591b8c);}};}function respondWithFilteredResult(_0x10028b,_0x24a27d){return function(_0xae7a77){if(_0xae7a77){var _0x10b9c4=typeof _0x24a27d['offset']===_0x8be7('0x1e')&&typeof _0x24a27d[_0x8be7('0x1f')]==='undefined';var _0x37459c=_0xae7a77[_0x8be7('0x20')];var _0x31a8de=_0x10b9c4?0x0:_0x24a27d[_0x8be7('0x21')];var _0x4125b2=_0x10b9c4?_0xae7a77[_0x8be7('0x20')]:_0x24a27d['offset']+_0x24a27d[_0x8be7('0x1f')];var _0x255801;if(_0x4125b2>=_0x37459c){_0x4125b2=_0x37459c;_0x255801=0xc8;}else{_0x255801=0xce;}_0x10028b[_0x8be7('0x1b')](_0x255801);return _0x10028b[_0x8be7('0x22')](_0x8be7('0x23'),_0x31a8de+'-'+_0x4125b2+'/'+_0x37459c)['json'](_0xae7a77);}return null;};}function patchUpdates(_0x5d4a5f){return function(_0x3235c6){try{jsonpatch[_0x8be7('0x24')](_0x3235c6,_0x5d4a5f,!![]);}catch(_0x450a06){return BPromise['reject'](_0x450a06);}return _0x3235c6[_0x8be7('0x25')]();};}function saveUpdates(_0x435cb9,_0x548e91){return function(_0x229c3f){if(_0x229c3f){return _0x229c3f['update'](_0x435cb9)[_0x8be7('0x26')](function(_0x1c87c3){return _0x1c87c3;});}return null;};}function removeEntity(_0x3ba620,_0x4866d5){return function(_0x2bb6a5){if(_0x2bb6a5){return _0x2bb6a5['destroy']()[_0x8be7('0x26')](function(){var _0x35adb7=_0x2bb6a5[_0x8be7('0x27')]({'plain':!![]});var _0x728635=_0x8be7('0x28');return db['UserProfileResource'][_0x8be7('0x29')]({'where':{'type':_0x728635,'resourceId':_0x35adb7['id']}})[_0x8be7('0x26')](function(){return _0x2bb6a5;});})['then'](function(){_0x3ba620[_0x8be7('0x1b')](0xcc)[_0x8be7('0x1c')]();});}};}function handleEntityNotFound(_0x4cd245,_0x4a4434){return function(_0x5cba1f){if(!_0x5cba1f){_0x4cd245[_0x8be7('0x1a')](0x194);}return _0x5cba1f;};}function handleError(_0x12bcd8,_0xdcafbf){_0xdcafbf=_0xdcafbf||0x1f4;return function(_0x96851){logger[_0x8be7('0x2a')](_0x96851[_0x8be7('0x2b')]);if(_0x96851[_0x8be7('0x2c')]){delete _0x96851[_0x8be7('0x2c')];}_0x12bcd8[_0x8be7('0x1b')](_0xdcafbf)['send'](_0x96851);};}exports[_0x8be7('0x2d')]=function(_0x569921,_0x1f3ec4){var _0x487fef={},_0x5a4157={},_0x4fb9df={'count':0x0,'rows':[]};var _0x58ce42=_[_0x8be7('0x2e')](db[_0x8be7('0x2f')][_0x8be7('0x30')],function(_0x590887){return{'name':_0x590887[_0x8be7('0x31')],'type':_0x590887[_0x8be7('0x32')][_0x8be7('0x33')]};});_0x5a4157[_0x8be7('0x34')]=_[_0x8be7('0x2e')](_0x58ce42,_0x8be7('0x2c'));_0x5a4157[_0x8be7('0x35')]=_[_0x8be7('0x36')](_0x569921[_0x8be7('0x35')]);_0x5a4157[_0x8be7('0x37')]=_[_0x8be7('0x38')](_0x5a4157['model'],_0x5a4157[_0x8be7('0x35')]);_0x487fef[_0x8be7('0x39')]=_['intersection'](_0x5a4157[_0x8be7('0x34')],qs[_0x8be7('0x3a')](_0x569921['query']['fields']));_0x487fef[_0x8be7('0x39')]=_0x487fef[_0x8be7('0x39')][_0x8be7('0x3b')]?_0x487fef[_0x8be7('0x39')]:_0x5a4157[_0x8be7('0x34')];if(!_0x569921['query'][_0x8be7('0x3c')](_0x8be7('0x3d'))){_0x487fef[_0x8be7('0x1f')]=qs[_0x8be7('0x1f')](_0x569921['query'][_0x8be7('0x1f')]);_0x487fef[_0x8be7('0x21')]=qs['offset'](_0x569921[_0x8be7('0x35')][_0x8be7('0x21')]);}_0x487fef['order']=qs[_0x8be7('0x3e')](_0x569921[_0x8be7('0x35')][_0x8be7('0x3e')]);_0x487fef[_0x8be7('0x3f')]=qs[_0x8be7('0x37')](_['pick'](_0x569921['query'],_0x5a4157[_0x8be7('0x37')]),_0x58ce42);if(_0x569921['query']['filter']){_0x487fef[_0x8be7('0x3f')]=_[_0x8be7('0x40')](_0x487fef[_0x8be7('0x3f')],{'$or':_[_0x8be7('0x2e')](_0x58ce42,function(_0x3148c0){if(_0x3148c0[_0x8be7('0x32')]!=='VIRTUAL'){var _0x51cba7={};_0x51cba7[_0x3148c0[_0x8be7('0x2c')]]={'$like':'%'+_0x569921[_0x8be7('0x35')][_0x8be7('0x41')]+'%'};return _0x51cba7;}})});}_0x487fef=_[_0x8be7('0x40')]({},_0x487fef,_0x569921['options']);var _0x52a672={'where':_0x487fef[_0x8be7('0x3f')]};return db[_0x8be7('0x2f')][_0x8be7('0x20')](_0x52a672)[_0x8be7('0x26')](function(_0x68dfcb){_0x4fb9df[_0x8be7('0x20')]=_0x68dfcb;if(_0x569921[_0x8be7('0x35')][_0x8be7('0x42')]){_0x487fef[_0x8be7('0x43')]=[{'all':!![]}];}return db[_0x8be7('0x2f')][_0x8be7('0x44')](_0x487fef);})[_0x8be7('0x26')](function(_0x3e03ea){_0x4fb9df['rows']=_0x3e03ea;return _0x4fb9df;})[_0x8be7('0x26')](respondWithFilteredResult(_0x1f3ec4,_0x487fef))['catch'](handleError(_0x1f3ec4,null));};exports['show']=function(_0xb70fa2,_0x3a682e){var _0x2ad507={'raw':!![],'where':{'id':_0xb70fa2[_0x8be7('0x45')]['id']}},_0x497616={};_0x497616[_0x8be7('0x34')]=_['keys'](db[_0x8be7('0x2f')][_0x8be7('0x30')]);_0x497616[_0x8be7('0x35')]=_[_0x8be7('0x36')](_0xb70fa2[_0x8be7('0x35')]);_0x497616[_0x8be7('0x37')]=_[_0x8be7('0x38')](_0x497616[_0x8be7('0x34')],_0x497616[_0x8be7('0x35')]);_0x2ad507[_0x8be7('0x39')]=_[_0x8be7('0x38')](_0x497616[_0x8be7('0x34')],qs['fields'](_0xb70fa2[_0x8be7('0x35')][_0x8be7('0x3a')]));_0x2ad507[_0x8be7('0x39')]=_0x2ad507['attributes'][_0x8be7('0x3b')]?_0x2ad507[_0x8be7('0x39')]:_0x497616[_0x8be7('0x34')];if(_0xb70fa2[_0x8be7('0x35')][_0x8be7('0x42')]){_0x2ad507[_0x8be7('0x43')]=[{'all':!![]}];}_0x2ad507=_['merge']({},_0x2ad507,_0xb70fa2[_0x8be7('0x46')]);return db[_0x8be7('0x2f')]['find'](_0x2ad507)[_0x8be7('0x26')](handleEntityNotFound(_0x3a682e,null))['then'](respondWithResult(_0x3a682e,null))['catch'](handleError(_0x3a682e,null));};exports['create']=function(_0x484a46,_0x527acc){return db[_0x8be7('0x2f')][_0x8be7('0x47')](_0x484a46[_0x8be7('0x48')],{})['then'](function(_0x1e1a8e){var _0x26a4f7=_0x484a46[_0x8be7('0x49')][_0x8be7('0x27')]({'plain':!![]});if(!_0x26a4f7)throw new Error(_0x8be7('0x4a'));if(_0x26a4f7[_0x8be7('0x4b')]===_0x8be7('0x49')){var _0x3b0056=_0x1e1a8e[_0x8be7('0x27')]({'plain':!![]});var _0x5888f7=_0x8be7('0x28');return db[_0x8be7('0x4c')][_0x8be7('0x4d')]({'where':{'name':_0x5888f7,'userProfileId':_0x26a4f7[_0x8be7('0x4e')]},'raw':!![]})[_0x8be7('0x26')](function(_0x5d621c){if(_0x5d621c&&_0x5d621c['autoAssociation']===0x0){return db[_0x8be7('0x4f')]['create']({'name':_0x3b0056[_0x8be7('0x2c')],'resourceId':_0x3b0056['id'],'type':_0x5d621c['name'],'sectionId':_0x5d621c['id']},{})[_0x8be7('0x26')](function(){return _0x1e1a8e;});}else{return _0x1e1a8e;}})[_0x8be7('0x50')](function(_0x4690f8){logger[_0x8be7('0x2a')](_0x8be7('0x51'),_0x4690f8);throw _0x4690f8;});}return _0x1e1a8e;})[_0x8be7('0x26')](respondWithResult(_0x527acc,0xc9))[_0x8be7('0x50')](handleError(_0x527acc,null));};exports[_0x8be7('0x52')]=function(_0x141d63,_0x5cba43){if(_0x141d63[_0x8be7('0x48')]['id']){delete _0x141d63[_0x8be7('0x48')]['id'];}return db[_0x8be7('0x2f')][_0x8be7('0x4d')]({'where':{'id':_0x141d63[_0x8be7('0x45')]['id']}})[_0x8be7('0x26')](handleEntityNotFound(_0x5cba43,null))['then'](saveUpdates(_0x141d63[_0x8be7('0x48')],null))['then'](respondWithResult(_0x5cba43,null))[_0x8be7('0x50')](handleError(_0x5cba43,null));};exports[_0x8be7('0x29')]=function(_0x165aff,_0x18fe3e){return db['SquareOdbc'][_0x8be7('0x4d')]({'where':{'id':_0x165aff[_0x8be7('0x45')]['id']}})[_0x8be7('0x26')](handleEntityNotFound(_0x18fe3e,null))[_0x8be7('0x26')](removeEntity(_0x18fe3e,null))['catch'](handleError(_0x18fe3e,null));};exports[_0x8be7('0x53')]=function(_0x2d6485,_0xc1811b,_0x46fd82){var _0x4b747c;return db[_0x8be7('0x2f')][_0x8be7('0x4d')]({'where':{'id':_0x2d6485[_0x8be7('0x45')]['id']},'attributes':['id',_0x8be7('0x54')]})['then'](handleEntityNotFound(_0xc1811b,null))[_0x8be7('0x26')](function(_0x4ac99b){if(_0x4ac99b){var _0x4b2863=require(_0x8be7('0x55'))();_0x4b2863[_0x8be7('0x56')](_0x4ac99b[_0x8be7('0x54')]);_0x4b2863['closeSync']();return _0x4ac99b;}})[_0x8be7('0x26')](respondWithResult(_0xc1811b,null))[_0x8be7('0x50')](handleError(_0xc1811b,null));}; \ No newline at end of file +var _0x35ae=['rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','merge','where','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','get','ODBC','end','error','stack','name','send','index','SquareOdbc'];(function(_0x1b9257,_0x238441){var _0x7fb9b7=function(_0x23441c){while(--_0x23441c){_0x1b9257['push'](_0x1b9257['shift']());}};_0x7fb9b7(++_0x238441);}(_0x35ae,0xe9));var _0xe35a=function(_0x1bda37,_0x239c41){_0x1bda37=_0x1bda37-0x0;var _0x51bf0f=_0x35ae[_0x1bda37];return _0x51bf0f;};'use strict';var emlformat=require(_0xe35a('0x0'));var rimraf=require(_0xe35a('0x1'));var zipdir=require(_0xe35a('0x2'));var jsonpatch=require(_0xe35a('0x3'));var rp=require(_0xe35a('0x4'));var moment=require(_0xe35a('0x5'));var BPromise=require(_0xe35a('0x6'));var Mustache=require('mustache');var util=require(_0xe35a('0x7'));var path=require(_0xe35a('0x8'));var sox=require(_0xe35a('0x9'));var csv=require(_0xe35a('0xa'));var ejs=require(_0xe35a('0xb'));var fs=require('fs');var fs_extra=require(_0xe35a('0xc'));var _=require(_0xe35a('0xd'));var squel=require(_0xe35a('0xe'));var crypto=require(_0xe35a('0xf'));var jsforce=require(_0xe35a('0x10'));var deskjs=require(_0xe35a('0x11'));var toCsv=require(_0xe35a('0xa'));var querystring=require('querystring');var Papa=require(_0xe35a('0x12'));var Redis=require(_0xe35a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe35a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe35a('0x15'));var logger=require(_0xe35a('0x16'))(_0xe35a('0x17'));var utils=require(_0xe35a('0x18'));var config=require(_0xe35a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe35a('0x1a'))['db'];function respondWithStatusCode(_0x28612c,_0x4623a0){_0x4623a0=_0x4623a0||0xcc;return function(_0x2f034f){if(_0x2f034f){return _0x28612c[_0xe35a('0x1b')](_0x4623a0);}return _0x28612c['status'](_0x4623a0)['end']();};}function respondWithResult(_0x542efa,_0x629376){_0x629376=_0x629376||0xc8;return function(_0x48e177){if(_0x48e177){return _0x542efa[_0xe35a('0x1c')](_0x629376)['json'](_0x48e177);}};}function respondWithFilteredResult(_0x28ad36,_0x3b6363){return function(_0x33e47a){if(_0x33e47a){var _0x2f14fe=typeof _0x3b6363[_0xe35a('0x1d')]===_0xe35a('0x1e')&&typeof _0x3b6363[_0xe35a('0x1f')]===_0xe35a('0x1e');var _0x32440e=_0x33e47a[_0xe35a('0x20')];var _0x5ea3a8=_0x2f14fe?0x0:_0x3b6363[_0xe35a('0x1d')];var _0x5a7047=_0x2f14fe?_0x33e47a[_0xe35a('0x20')]:_0x3b6363[_0xe35a('0x1d')]+_0x3b6363[_0xe35a('0x1f')];var _0xf8a606;if(_0x5a7047>=_0x32440e){_0x5a7047=_0x32440e;_0xf8a606=0xc8;}else{_0xf8a606=0xce;}_0x28ad36[_0xe35a('0x1c')](_0xf8a606);return _0x28ad36[_0xe35a('0x21')](_0xe35a('0x22'),_0x5ea3a8+'-'+_0x5a7047+'/'+_0x32440e)[_0xe35a('0x23')](_0x33e47a);}return null;};}function patchUpdates(_0x4e5561){return function(_0x4f37df){try{jsonpatch['apply'](_0x4f37df,_0x4e5561,!![]);}catch(_0xc2b243){return BPromise[_0xe35a('0x24')](_0xc2b243);}return _0x4f37df[_0xe35a('0x25')]();};}function saveUpdates(_0x357d5d,_0x37d31d){return function(_0x290fb0){if(_0x290fb0){return _0x290fb0['update'](_0x357d5d)['then'](function(_0x21d522){return _0x21d522;});}return null;};}function removeEntity(_0x4abf25,_0x346a05){return function(_0x49b8fb){if(_0x49b8fb){return _0x49b8fb[_0xe35a('0x26')]()[_0xe35a('0x27')](function(){var _0x4a1d76=_0x49b8fb[_0xe35a('0x28')]({'plain':!![]});var _0x5d2c94=_0xe35a('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x5d2c94,'resourceId':_0x4a1d76['id']}})['then'](function(){return _0x49b8fb;});})[_0xe35a('0x27')](function(){_0x4abf25[_0xe35a('0x1c')](0xcc)[_0xe35a('0x2a')]();});}};}function handleEntityNotFound(_0xbd32c7,_0x5d4917){return function(_0xa0006a){if(!_0xa0006a){_0xbd32c7[_0xe35a('0x1b')](0x194);}return _0xa0006a;};}function handleError(_0x2b6ece,_0x134440){_0x134440=_0x134440||0x1f4;return function(_0x590e8a){logger[_0xe35a('0x2b')](_0x590e8a[_0xe35a('0x2c')]);if(_0x590e8a[_0xe35a('0x2d')]){delete _0x590e8a[_0xe35a('0x2d')];}_0x2b6ece[_0xe35a('0x1c')](_0x134440)[_0xe35a('0x2e')](_0x590e8a);};}exports[_0xe35a('0x2f')]=function(_0x4ab6a6,_0x496518){var _0x403a3a={},_0x3d8a11={},_0xeb3629={'count':0x0,'rows':[]};var _0x56631a=_['map'](db[_0xe35a('0x30')][_0xe35a('0x31')],function(_0x31f10a){return{'name':_0x31f10a[_0xe35a('0x32')],'type':_0x31f10a['type'][_0xe35a('0x33')]};});_0x3d8a11[_0xe35a('0x34')]=_[_0xe35a('0x35')](_0x56631a,_0xe35a('0x2d'));_0x3d8a11[_0xe35a('0x36')]=_[_0xe35a('0x37')](_0x4ab6a6[_0xe35a('0x36')]);_0x3d8a11['filters']=_[_0xe35a('0x38')](_0x3d8a11[_0xe35a('0x34')],_0x3d8a11[_0xe35a('0x36')]);_0x403a3a[_0xe35a('0x39')]=_[_0xe35a('0x38')](_0x3d8a11[_0xe35a('0x34')],qs[_0xe35a('0x3a')](_0x4ab6a6[_0xe35a('0x36')][_0xe35a('0x3a')]));_0x403a3a[_0xe35a('0x39')]=_0x403a3a[_0xe35a('0x39')][_0xe35a('0x3b')]?_0x403a3a[_0xe35a('0x39')]:_0x3d8a11[_0xe35a('0x34')];if(!_0x4ab6a6[_0xe35a('0x36')][_0xe35a('0x3c')](_0xe35a('0x3d'))){_0x403a3a['limit']=qs[_0xe35a('0x1f')](_0x4ab6a6['query'][_0xe35a('0x1f')]);_0x403a3a[_0xe35a('0x1d')]=qs['offset'](_0x4ab6a6[_0xe35a('0x36')][_0xe35a('0x1d')]);}_0x403a3a[_0xe35a('0x3e')]=qs['sort'](_0x4ab6a6['query'][_0xe35a('0x3f')]);_0x403a3a['where']=qs['filters'](_[_0xe35a('0x40')](_0x4ab6a6[_0xe35a('0x36')],_0x3d8a11[_0xe35a('0x41')]),_0x56631a);if(_0x4ab6a6[_0xe35a('0x36')]['filter']){_0x403a3a['where']=_[_0xe35a('0x42')](_0x403a3a[_0xe35a('0x43')],{'$or':_['map'](_0x56631a,function(_0x52ae17){if(_0x52ae17[_0xe35a('0x44')]!==_0xe35a('0x45')){var _0x5047ac={};_0x5047ac[_0x52ae17['name']]={'$like':'%'+_0x4ab6a6[_0xe35a('0x36')][_0xe35a('0x46')]+'%'};return _0x5047ac;}})});}_0x403a3a=_[_0xe35a('0x42')]({},_0x403a3a,_0x4ab6a6['options']);var _0x1c2d68={'where':_0x403a3a['where']};return db['SquareOdbc'][_0xe35a('0x20')](_0x1c2d68)[_0xe35a('0x27')](function(_0x536610){_0xeb3629[_0xe35a('0x20')]=_0x536610;if(_0x4ab6a6[_0xe35a('0x36')][_0xe35a('0x47')]){_0x403a3a['include']=[{'all':!![]}];}return db['SquareOdbc'][_0xe35a('0x48')](_0x403a3a);})[_0xe35a('0x27')](function(_0x465d45){_0xeb3629[_0xe35a('0x49')]=_0x465d45;return _0xeb3629;})[_0xe35a('0x27')](respondWithFilteredResult(_0x496518,_0x403a3a))[_0xe35a('0x4a')](handleError(_0x496518,null));};exports[_0xe35a('0x4b')]=function(_0x1446f5,_0xb45e02){var _0x35c328={'raw':!![],'where':{'id':_0x1446f5[_0xe35a('0x4c')]['id']}},_0x58dbe3={};_0x58dbe3[_0xe35a('0x34')]=_[_0xe35a('0x37')](db['SquareOdbc'][_0xe35a('0x31')]);_0x58dbe3[_0xe35a('0x36')]=_[_0xe35a('0x37')](_0x1446f5[_0xe35a('0x36')]);_0x58dbe3['filters']=_[_0xe35a('0x38')](_0x58dbe3[_0xe35a('0x34')],_0x58dbe3[_0xe35a('0x36')]);_0x35c328[_0xe35a('0x39')]=_[_0xe35a('0x38')](_0x58dbe3[_0xe35a('0x34')],qs[_0xe35a('0x3a')](_0x1446f5[_0xe35a('0x36')][_0xe35a('0x3a')]));_0x35c328[_0xe35a('0x39')]=_0x35c328[_0xe35a('0x39')]['length']?_0x35c328[_0xe35a('0x39')]:_0x58dbe3[_0xe35a('0x34')];if(_0x1446f5[_0xe35a('0x36')][_0xe35a('0x47')]){_0x35c328[_0xe35a('0x4d')]=[{'all':!![]}];}_0x35c328=_['merge']({},_0x35c328,_0x1446f5[_0xe35a('0x4e')]);return db['SquareOdbc'][_0xe35a('0x4f')](_0x35c328)[_0xe35a('0x27')](handleEntityNotFound(_0xb45e02,null))[_0xe35a('0x27')](respondWithResult(_0xb45e02,null))['catch'](handleError(_0xb45e02,null));};exports['create']=function(_0x429cd3,_0xfb559e){return db[_0xe35a('0x30')][_0xe35a('0x50')](_0x429cd3['body'],{})[_0xe35a('0x27')](function(_0x585228){var _0x50d3a7=_0x429cd3[_0xe35a('0x51')][_0xe35a('0x28')]({'plain':!![]});if(!_0x50d3a7)throw new Error(_0xe35a('0x52'));if(_0x50d3a7[_0xe35a('0x53')]===_0xe35a('0x51')){var _0x3dee96=_0x585228[_0xe35a('0x28')]({'plain':!![]});var _0x25c570=_0xe35a('0x29');return db[_0xe35a('0x54')][_0xe35a('0x4f')]({'where':{'name':_0x25c570,'userProfileId':_0x50d3a7['userProfileId']},'raw':!![]})[_0xe35a('0x27')](function(_0x211c65){if(_0x211c65&&_0x211c65[_0xe35a('0x55')]===0x0){return db[_0xe35a('0x56')][_0xe35a('0x50')]({'name':_0x3dee96[_0xe35a('0x2d')],'resourceId':_0x3dee96['id'],'type':_0x211c65[_0xe35a('0x2d')],'sectionId':_0x211c65['id']},{})[_0xe35a('0x27')](function(){return _0x585228;});}else{return _0x585228;}})[_0xe35a('0x4a')](function(_0xb90e41){logger['error'](_0xe35a('0x57'),_0xb90e41);throw _0xb90e41;});}return _0x585228;})[_0xe35a('0x27')](respondWithResult(_0xfb559e,0xc9))['catch'](handleError(_0xfb559e,null));};exports[_0xe35a('0x58')]=function(_0x56f2ea,_0x46b8f){if(_0x56f2ea[_0xe35a('0x59')]['id']){delete _0x56f2ea['body']['id'];}return db[_0xe35a('0x30')][_0xe35a('0x4f')]({'where':{'id':_0x56f2ea[_0xe35a('0x4c')]['id']}})[_0xe35a('0x27')](handleEntityNotFound(_0x46b8f,null))[_0xe35a('0x27')](saveUpdates(_0x56f2ea['body'],null))[_0xe35a('0x27')](respondWithResult(_0x46b8f,null))['catch'](handleError(_0x46b8f,null));};exports['destroy']=function(_0x3e93f5,_0x53ebda){return db[_0xe35a('0x30')]['find']({'where':{'id':_0x3e93f5[_0xe35a('0x4c')]['id']}})[_0xe35a('0x27')](handleEntityNotFound(_0x53ebda,null))[_0xe35a('0x27')](removeEntity(_0x53ebda,null))[_0xe35a('0x4a')](handleError(_0x53ebda,null));};exports[_0xe35a('0x5a')]=function(_0x1209af,_0x2d17cd,_0x56707e){var _0x1e22ad;return db[_0xe35a('0x30')][_0xe35a('0x4f')]({'where':{'id':_0x1209af['params']['id']},'attributes':['id',_0xe35a('0x5b')]})[_0xe35a('0x27')](handleEntityNotFound(_0x2d17cd,null))[_0xe35a('0x27')](function(_0x4fd735){if(_0x4fd735){var _0x2b9908=require('odbc')();_0x2b9908[_0xe35a('0x5c')](_0x4fd735[_0xe35a('0x5b')]);_0x2b9908[_0xe35a('0x5d')]();return _0x4fd735;}})[_0xe35a('0x27')](respondWithResult(_0x2d17cd,null))[_0xe35a('0x4a')](handleError(_0x2d17cd,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d22f763..8a2081a 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 _0x717b=['SquareOdbc','api','bluebird','path','rimraf','exports'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x717b,0xc1));var _0xb717=function(_0x1b1c9f,_0x1f4f1c){_0x1b1c9f=_0x1b1c9f-0x0;var _0x351eb7=_0x717b[_0x1b1c9f];return _0x351eb7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb717('0x0'));var moment=require('moment');var BPromise=require(_0xb717('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb717('0x2'));var rimraf=require(_0xb717('0x3'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xb717('0x4')]=function(_0x309f88,_0x5dd2fc){return _0x309f88['define'](_0xb717('0x5'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x271d=['SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./squareOdbc.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x271d,0x91));var _0xd271=function(_0x32463a,_0x149570){_0x32463a=_0x32463a-0x0;var _0x266956=_0x271d[_0x32463a];return _0x266956;};'use strict';var _=require(_0xd271('0x0'));var util=require(_0xd271('0x1'));var logger=require(_0xd271('0x2'))(_0xd271('0x3'));var moment=require(_0xd271('0x4'));var BPromise=require(_0xd271('0x5'));var rp=require(_0xd271('0x6'));var fs=require('fs');var path=require(_0xd271('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd271('0x8'));module[_0xd271('0x9')]=function(_0x3654ac,_0x3cb5c9){return _0x3654ac[_0xd271('0xa')](_0xd271('0xb'),attributes,{'tableName':_0xd271('0xc'),'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 e268059..6d33c84 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 _0xb58f=['then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','model','include','info','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x565a98,_0x569185){var _0x537e3e=function(_0x1c6c85){while(--_0x1c6c85){_0x565a98['push'](_0x565a98['shift']());}};_0x537e3e(++_0x569185);}(_0xb58f,0xfb));var _0xfb58=function(_0x302a8d,_0x2d36ee){_0x302a8d=_0x302a8d-0x0;var _0x6f6eae=_0xb58f[_0x302a8d];return _0x6f6eae;};'use strict';var _=require(_0xfb58('0x0'));var util=require(_0xfb58('0x1'));var moment=require(_0xfb58('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb58('0x3'))['db'];var utils=require(_0xfb58('0x4'));var logger=require(_0xfb58('0x5'))(_0xfb58('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfb58('0x7')][_0xfb58('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fee7a,_0x3ad991,_0x33a1d6){return new BPromise(function(_0x315cd0,_0x4062eb){return client[_0xfb58('0x9')](_0x2fee7a,_0x33a1d6)[_0xfb58('0xa')](function(_0x120e25){logger['info'](_0xfb58('0xb'),_0x3ad991,_0xfb58('0xc'));logger[_0xfb58('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3ad991,'request\x20sent',JSON['stringify'](_0x120e25));if(_0x120e25['error']){if(_0x120e25['error'][_0xfb58('0xe')]===0x1f4){logger['error'](_0xfb58('0xb'),_0x3ad991,_0x120e25[_0xfb58('0xf')][_0xfb58('0x10')]);return _0x4062eb(_0x120e25[_0xfb58('0xf')][_0xfb58('0x10')]);}logger[_0xfb58('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x3ad991,_0x120e25[_0xfb58('0xf')]['message']);return _0x315cd0(_0x120e25[_0xfb58('0xf')][_0xfb58('0x10')]);}else{logger['info'](_0xfb58('0xb'),_0x3ad991,_0xfb58('0xc'));_0x315cd0(_0x120e25[_0xfb58('0x11')][_0xfb58('0x10')]);}})['catch'](function(_0x3a4fc7){logger[_0xfb58('0xf')](_0xfb58('0xb'),_0x3ad991,_0x3a4fc7);_0x4062eb(_0x3a4fc7);});});}exports[_0xfb58('0x12')]=function(_0x547dc4){var _0x38dfe4=this;return new Promise(function(_0x480c42,_0x18a638){return db[_0xfb58('0x13')][_0xfb58('0x14')]({'raw':_0x547dc4[_0xfb58('0x15')]?_0x547dc4['options'][_0xfb58('0x16')]===undefined?!![]:![]:!![],'where':_0x547dc4[_0xfb58('0x15')]?_0x547dc4[_0xfb58('0x15')][_0xfb58('0x17')]||null:null,'attributes':_0x547dc4[_0xfb58('0x15')]?_0x547dc4['options'][_0xfb58('0x18')]||null:null,'include':_0x547dc4[_0xfb58('0x15')]?_0x547dc4[_0xfb58('0x15')]['include']?_[_0xfb58('0x19')](_0x547dc4[_0xfb58('0x15')]['include'],function(_0x162bf2){return{'model':db[_0x162bf2[_0xfb58('0x1a')]],'as':_0x162bf2['as'],'attributes':_0x162bf2['attributes'],'include':_0x162bf2[_0xfb58('0x1b')]?_['map'](_0x162bf2['include'],function(_0x31eb59){return{'model':db[_0x31eb59['model']],'as':_0x31eb59['as'],'attributes':_0x31eb59[_0xfb58('0x18')],'include':_0x31eb59[_0xfb58('0x1b')]?_[_0xfb58('0x19')](_0x31eb59[_0xfb58('0x1b')],function(_0x4113af){return{'model':db[_0x4113af['model']],'as':_0x4113af['as'],'attributes':_0x4113af[_0xfb58('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfb58('0xa')](function(_0x193827){logger[_0xfb58('0x1c')](_0xfb58('0x12'),_0x547dc4);logger['debug']('ShowSquareOdbc',_0x547dc4,JSON['stringify'](_0x193827));_0x480c42(_0x193827);})['catch'](function(_0x51a1a1){logger[_0xfb58('0xf')]('ShowSquareOdbc',_0x51a1a1[_0xfb58('0x10')],_0x547dc4);_0x18a638(_0x38dfe4[_0xfb58('0xf')](0x1f4,_0x51a1a1[_0xfb58('0x10')]));});});}; \ No newline at end of file +var _0x2aec=['code','message','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','attributes','model','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SquareOdbc,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x2af600,_0x487e4c){var _0x3af977=function(_0x1a7723){while(--_0x1a7723){_0x2af600['push'](_0x2af600['shift']());}};_0x3af977(++_0x487e4c);}(_0x2aec,0xed));var _0xc2ae=function(_0x230ea8,_0x40d8ce){_0x230ea8=_0x230ea8-0x0;var _0x57f219=_0x2aec[_0x230ea8];return _0x57f219;};'use strict';var _=require(_0xc2ae('0x0'));var util=require(_0xc2ae('0x1'));var moment=require(_0xc2ae('0x2'));var BPromise=require(_0xc2ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2ae('0x4'));var db=require(_0xc2ae('0x5'))['db'];var utils=require(_0xc2ae('0x6'));var logger=require(_0xc2ae('0x7'))(_0xc2ae('0x8'));var config=require(_0xc2ae('0x9'));var jayson=require(_0xc2ae('0xa'));var client=jayson['client'][_0xc2ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a3be3,_0x482807,_0x18d73c){return new BPromise(function(_0x15dc54,_0x117cf9){return client['request'](_0x4a3be3,_0x18d73c)[_0xc2ae('0xc')](function(_0x22f037){logger[_0xc2ae('0xd')](_0xc2ae('0xe'),_0x482807,'request\x20sent');logger[_0xc2ae('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x482807,_0xc2ae('0x10'),JSON[_0xc2ae('0x11')](_0x22f037));if(_0x22f037[_0xc2ae('0x12')]){if(_0x22f037['error'][_0xc2ae('0x13')]===0x1f4){logger[_0xc2ae('0x12')](_0xc2ae('0xe'),_0x482807,_0x22f037[_0xc2ae('0x12')]['message']);return _0x117cf9(_0x22f037[_0xc2ae('0x12')]['message']);}logger[_0xc2ae('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x482807,_0x22f037[_0xc2ae('0x12')][_0xc2ae('0x14')]);return _0x15dc54(_0x22f037[_0xc2ae('0x12')][_0xc2ae('0x14')]);}else{logger[_0xc2ae('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x482807,_0xc2ae('0x10'));_0x15dc54(_0x22f037['result'][_0xc2ae('0x14')]);}})['catch'](function(_0x155306){logger['error'](_0xc2ae('0xe'),_0x482807,_0x155306);_0x117cf9(_0x155306);});});}exports[_0xc2ae('0x15')]=function(_0x56536e){var _0x38b3da=this;return new Promise(function(_0x30ea9d,_0x42c4df){return db[_0xc2ae('0x16')][_0xc2ae('0x17')]({'raw':_0x56536e['options']?_0x56536e[_0xc2ae('0x18')][_0xc2ae('0x19')]===undefined?!![]:![]:!![],'where':_0x56536e['options']?_0x56536e[_0xc2ae('0x18')][_0xc2ae('0x1a')]||null:null,'attributes':_0x56536e[_0xc2ae('0x18')]?_0x56536e[_0xc2ae('0x18')]['attributes']||null:null,'include':_0x56536e[_0xc2ae('0x18')]?_0x56536e[_0xc2ae('0x18')][_0xc2ae('0x1b')]?_[_0xc2ae('0x1c')](_0x56536e['options'][_0xc2ae('0x1b')],function(_0x41858a){return{'model':db[_0x41858a['model']],'as':_0x41858a['as'],'attributes':_0x41858a[_0xc2ae('0x1d')],'include':_0x41858a['include']?_[_0xc2ae('0x1c')](_0x41858a['include'],function(_0x1db2f1){return{'model':db[_0x1db2f1[_0xc2ae('0x1e')]],'as':_0x1db2f1['as'],'attributes':_0x1db2f1[_0xc2ae('0x1d')],'include':_0x1db2f1['include']?_[_0xc2ae('0x1c')](_0x1db2f1[_0xc2ae('0x1b')],function(_0x2db82a){return{'model':db[_0x2db82a['model']],'as':_0x2db82a['as'],'attributes':_0x2db82a[_0xc2ae('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc2ae('0xc')](function(_0x47dfcd){logger[_0xc2ae('0xd')](_0xc2ae('0x15'),_0x56536e);logger[_0xc2ae('0xf')](_0xc2ae('0x15'),_0x56536e,JSON['stringify'](_0x47dfcd));_0x30ea9d(_0x47dfcd);})[_0xc2ae('0x1f')](function(_0x3b4aa2){logger[_0xc2ae('0x12')](_0xc2ae('0x15'),_0x3b4aa2[_0xc2ae('0x14')],_0x56536e);_0x42c4df(_0x38b3da[_0xc2ae('0x12')](0x1f4,_0x3b4aa2[_0xc2ae('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e7b2cdc..9fa2675 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 _0x2851=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','update','destroy','multer','Router','fs-extra'];(function(_0x355cac,_0xc13ea1){var _0x4d6d62=function(_0x3fbff1){while(--_0x3fbff1){_0x355cac['push'](_0x355cac['shift']());}};_0x4d6d62(++_0xc13ea1);}(_0x2851,0x7f));var _0x1285=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2851[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x1285('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1285('0x1')]();var fs_extra=require(_0x1285('0x2'));var auth=require(_0x1285('0x3'));var interaction=require(_0x1285('0x4'));var config=require(_0x1285('0x5'));var controller=require('./squareProject.controller');router[_0x1285('0x6')]('/',auth[_0x1285('0x7')](),controller['index']);router['get'](_0x1285('0x8'),auth[_0x1285('0x7')](),controller[_0x1285('0x9')]);router['post']('/',auth[_0x1285('0x7')](),controller[_0x1285('0xa')]);router['put'](_0x1285('0x8'),auth['isAuthenticated'](),controller[_0x1285('0xb')]);router['delete']('/:id',auth[_0x1285('0x7')](),controller[_0x1285('0xc')]);module['exports']=router; \ No newline at end of file +var _0x6384=['post','isAuthenticated','put','update','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id'];(function(_0x5c9f29,_0x246bd4){var _0x22fc8d=function(_0x22324c){while(--_0x22324c){_0x5c9f29['push'](_0x5c9f29['shift']());}};_0x22fc8d(++_0x246bd4);}(_0x6384,0x1c0));var _0x4638=function(_0x9d1102,_0x5c55c9){_0x9d1102=_0x9d1102-0x0;var _0x2c668e=_0x6384[_0x9d1102];return _0x2c668e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4638('0x0'));var timeout=require('connect-timeout');var express=require(_0x4638('0x1'));var router=express[_0x4638('0x2')]();var fs_extra=require(_0x4638('0x3'));var auth=require(_0x4638('0x4'));var interaction=require(_0x4638('0x5'));var config=require(_0x4638('0x6'));var controller=require(_0x4638('0x7'));router[_0x4638('0x8')]('/',auth['isAuthenticated'](),controller[_0x4638('0x9')]);router[_0x4638('0x8')](_0x4638('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4638('0xb')]('/',auth[_0x4638('0xc')](),controller['create']);router[_0x4638('0xd')](_0x4638('0xa'),auth[_0x4638('0xc')](),controller[_0x4638('0xe')]);router[_0x4638('0xf')](_0x4638('0xa'),auth[_0x4638('0xc')](),controller['destroy']);module[_0x4638('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 16d94db..8db7798 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 _0xece1=['utf8','DATE','sequelize','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','production'];(function(_0x2823c6,_0x357e98){var _0xe3ea8=function(_0x25a4be){while(--_0x25a4be){_0x2823c6['push'](_0x2823c6['shift']());}};_0xe3ea8(++_0x357e98);}(_0xece1,0xda));var _0x1ece=function(_0x2a3fe6,_0x7d2f2a){_0x2a3fe6=_0x2a3fe6-0x0;var _0x8712ff=_0xece1[_0x2a3fe6];return _0x8712ff;};'use strict';var Sequelize=require(_0x1ece('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1ece('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x1ece('0x2')]},'notes':{'type':Sequelize[_0x1ece('0x3')]},'preproduction':{'type':Sequelize[_0x1ece('0x4')](_0x1ece('0x5')),'get':function(){if(this[_0x1ece('0x6')]('preproduction')){return this[_0x1ece('0x6')](_0x1ece('0x7'))[_0x1ece('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x1ece('0x4')](_0x1ece('0x5')),'get':function(){if(this[_0x1ece('0x6')](_0x1ece('0x9'))){return this[_0x1ece('0x6')]('production')['toString'](_0x1ece('0xa'));}}},'savedAt':{'type':Sequelize[_0x1ece('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xfdc6=['DATE','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','production','toString','utf8'];(function(_0x2c239a,_0x4a6fbf){var _0x54b09e=function(_0x1b334e){while(--_0x1b334e){_0x2c239a['push'](_0x2c239a['shift']());}};_0x54b09e(++_0x4a6fbf);}(_0xfdc6,0xf3));var _0x6fdc=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0xfdc6[_0x12a2a6];return _0x1754ae;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6fdc('0x0')],'unique':_0x6fdc('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x6fdc('0x2')]},'preproduction':{'type':Sequelize[_0x6fdc('0x3')](_0x6fdc('0x4')),'get':function(){if(this[_0x6fdc('0x5')](_0x6fdc('0x6'))){return this['getDataValue'](_0x6fdc('0x6'))['toString']('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x6fdc('0x4')),'get':function(){if(this[_0x6fdc('0x5')](_0x6fdc('0x7'))){return this[_0x6fdc('0x5')]('production')[_0x6fdc('0x8')](_0x6fdc('0x9'));}}},'savedAt':{'type':Sequelize[_0x6fdc('0xa')]},'publishedAt':{'type':Sequelize[_0x6fdc('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 890b167..7b0c80f 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 _0x7f20=['autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','SquareProjects','publish','agi','end','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','show','params','options','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId'];(function(_0x27b588,_0x176012){var _0x1ed0c0=function(_0x5b8f06){while(--_0x5b8f06){_0x27b588['push'](_0x27b588['shift']());}};_0x1ed0c0(++_0x176012);}(_0x7f20,0x163));var _0x07f2=function(_0x263402,_0x9e792e){_0x263402=_0x263402-0x0;var _0x4b886b=_0x7f20[_0x263402];return _0x4b886b;};'use strict';var _=require(_0x07f2('0x0'));var Redis=require(_0x07f2('0x1'));var qs=require(_0x07f2('0x2'));var logger=require(_0x07f2('0x3'))('api');var config=require('../../config/environment');var db=require(_0x07f2('0x4'))['db'];config[_0x07f2('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x07f2('0x6'))(new Redis(config[_0x07f2('0x5')]));require(_0x07f2('0x7'))[_0x07f2('0x8')](socket);function respondWithResult(_0x3cbb03,_0x124ec5){_0x124ec5=_0x124ec5||0xc8;return function(_0x10b8df){if(_0x10b8df){return _0x3cbb03[_0x07f2('0x9')](_0x124ec5)[_0x07f2('0xa')](_0x10b8df);}};}function respondWithFilteredResult(_0x97ee16,_0xee98d0){return function(_0x3cc594){if(_0x3cc594){var _0x5473c9=typeof _0xee98d0[_0x07f2('0xb')]===_0x07f2('0xc')&&typeof _0xee98d0['limit']===_0x07f2('0xc');var _0x30fac2=_0x3cc594['count'];var _0x33b3b9=_0x5473c9?0x0:_0xee98d0[_0x07f2('0xb')];var _0x58423c=_0x5473c9?_0x3cc594[_0x07f2('0xd')]:_0xee98d0[_0x07f2('0xb')]+_0xee98d0[_0x07f2('0xe')];var _0x2a8995;if(_0x58423c>=_0x30fac2){_0x58423c=_0x30fac2;_0x2a8995=0xc8;}else{_0x2a8995=0xce;}_0x97ee16[_0x07f2('0x9')](_0x2a8995);return _0x97ee16[_0x07f2('0xf')](_0x07f2('0x10'),_0x33b3b9+'-'+_0x58423c+'/'+_0x30fac2)[_0x07f2('0xa')](_0x3cc594);}return null;};}function saveUpdates(_0xcc365f){return function(_0x1fda3b){if(_0x1fda3b){return _0x1fda3b[_0x07f2('0x11')](_0xcc365f)[_0x07f2('0x12')](function(_0x3f8df8){return _0x3f8df8;});}return null;};}function removeEntity(_0x51cb6a){return function(_0xda2131){if(_0xda2131){return _0xda2131[_0x07f2('0x13')]()[_0x07f2('0x12')](function(){var _0x10125f=_0xda2131[_0x07f2('0x14')]({'plain':!![]});var _0x4bca24=_0x07f2('0x15');return db['UserProfileResource'][_0x07f2('0x13')]({'where':{'type':_0x4bca24,'resourceId':_0x10125f['id']}})[_0x07f2('0x12')](function(){return _0xda2131;});})[_0x07f2('0x12')](function(){var _0x1b2d36=new Redis(config[_0x07f2('0x5')]);_0x1b2d36[_0x07f2('0x16')](_0x07f2('0x17'),JSON['stringify']({'id':_0xda2131['id'],'deleted':!![]}));})[_0x07f2('0x12')](function(){_0x51cb6a[_0x07f2('0x9')](0xcc)[_0x07f2('0x18')]();});}};}function handleEntityNotFound(_0x17e1ad){return function(_0x190bba){if(!_0x190bba){_0x17e1ad[_0x07f2('0x19')](0x194);}return _0x190bba;};}function handleError(_0x5bb4d8,_0x1195f6){_0x1195f6=_0x1195f6||0x1f4;return function(_0x91058f){logger[_0x07f2('0x1a')](_0x91058f[_0x07f2('0x1b')]);if(_0x91058f[_0x07f2('0x1c')]){delete _0x91058f[_0x07f2('0x1c')];}_0x5bb4d8['status'](_0x1195f6)[_0x07f2('0x1d')](_0x91058f);};}exports[_0x07f2('0x1e')]=function(_0xaa52,_0x5668ec){var _0xa264d6={},_0xcae913={},_0x5c12c9={'count':0x0,'rows':[]};var _0x333db5=_[_0x07f2('0x1f')](db[_0x07f2('0x20')][_0x07f2('0x21')],function(_0x286d1c){return{'name':_0x286d1c[_0x07f2('0x22')],'type':_0x286d1c['type'][_0x07f2('0x23')]};});_0xcae913[_0x07f2('0x24')]=_[_0x07f2('0x1f')](_0x333db5,_0x07f2('0x1c'));_0xcae913['query']=_[_0x07f2('0x25')](_0xaa52[_0x07f2('0x26')]);_0xcae913[_0x07f2('0x27')]=_[_0x07f2('0x28')](_0xcae913[_0x07f2('0x24')],_0xcae913['query']);_0xa264d6[_0x07f2('0x29')]=_[_0x07f2('0x28')](_0xcae913[_0x07f2('0x24')],qs['fields'](_0xaa52['query'][_0x07f2('0x2a')]));_0xa264d6[_0x07f2('0x29')]=_0xa264d6[_0x07f2('0x29')][_0x07f2('0x2b')]?_0xa264d6[_0x07f2('0x29')]:_0xcae913['model'];if(!_0xaa52['query'][_0x07f2('0x2c')]('nolimit')){_0xa264d6[_0x07f2('0xe')]=qs[_0x07f2('0xe')](_0xaa52[_0x07f2('0x26')][_0x07f2('0xe')]);_0xa264d6[_0x07f2('0xb')]=qs[_0x07f2('0xb')](_0xaa52['query'][_0x07f2('0xb')]);}_0xa264d6[_0x07f2('0x2d')]=qs[_0x07f2('0x2e')](_0xaa52[_0x07f2('0x26')][_0x07f2('0x2e')]);_0xa264d6[_0x07f2('0x2f')]=qs[_0x07f2('0x27')](_[_0x07f2('0x30')](_0xaa52['query'],_0xcae913['filters']),_0x333db5);if(_0xaa52[_0x07f2('0x26')]['filter']){_0xa264d6['where']=_[_0x07f2('0x31')](_0xa264d6[_0x07f2('0x2f')],{'$or':_[_0x07f2('0x1f')](_0x333db5,function(_0x2d4700){if(_0x2d4700['type']!==_0x07f2('0x32')){var _0x25cc8b={};_0x25cc8b[_0x2d4700[_0x07f2('0x1c')]]={'$like':'%'+_0xaa52[_0x07f2('0x26')][_0x07f2('0x33')]+'%'};return _0x25cc8b;}})});}_0xa264d6=_['merge']({},_0xa264d6,_0xaa52['options']);var _0x73539f={'where':_0xa264d6['where']};return db['SquareProject']['count'](_0x73539f)[_0x07f2('0x12')](function(_0x5527e2){_0x5c12c9[_0x07f2('0xd')]=_0x5527e2;if(_0xaa52[_0x07f2('0x26')][_0x07f2('0x34')]){_0xa264d6[_0x07f2('0x35')]=[{'all':!![]}];}return db[_0x07f2('0x20')]['findAll'](_0xa264d6);})[_0x07f2('0x12')](function(_0x52d974){_0x5c12c9['rows']=_0x52d974;return _0x5c12c9;})[_0x07f2('0x12')](respondWithFilteredResult(_0x5668ec,_0xa264d6))['catch'](handleError(_0x5668ec,null));};exports[_0x07f2('0x36')]=function(_0x11670d,_0x24ae49){var _0x40cdee={'raw':![],'where':{'id':_0x11670d[_0x07f2('0x37')]['id']}},_0x549ab4={};_0x549ab4[_0x07f2('0x24')]=_[_0x07f2('0x25')](db[_0x07f2('0x20')][_0x07f2('0x21')]);_0x549ab4[_0x07f2('0x26')]=_['keys'](_0x11670d[_0x07f2('0x26')]);_0x549ab4[_0x07f2('0x27')]=_[_0x07f2('0x28')](_0x549ab4[_0x07f2('0x24')],_0x549ab4[_0x07f2('0x26')]);_0x40cdee[_0x07f2('0x29')]=_['intersection'](_0x549ab4['model'],qs[_0x07f2('0x2a')](_0x11670d['query']['fields']));_0x40cdee['attributes']=_0x40cdee[_0x07f2('0x29')][_0x07f2('0x2b')]?_0x40cdee[_0x07f2('0x29')]:_0x549ab4[_0x07f2('0x24')];if(_0x11670d[_0x07f2('0x26')][_0x07f2('0x34')]){_0x40cdee[_0x07f2('0x35')]=[{'all':!![]}];}_0x40cdee=_[_0x07f2('0x31')]({},_0x40cdee,_0x11670d[_0x07f2('0x38')]);return db[_0x07f2('0x20')][_0x07f2('0x39')](_0x40cdee)[_0x07f2('0x12')](handleEntityNotFound(_0x24ae49,null))[_0x07f2('0x12')](respondWithResult(_0x24ae49,null))[_0x07f2('0x3a')](handleError(_0x24ae49,null));};exports['create']=function(_0x23f524,_0x4b435c){return db[_0x07f2('0x20')]['create'](_0x23f524[_0x07f2('0x3b')],{})['then'](function(_0x3adf66){var _0x3eff96=_0x23f524['user'][_0x07f2('0x14')]({'plain':!![]});if(!_0x3eff96)throw new Error(_0x07f2('0x3c'));if(_0x3eff96[_0x07f2('0x3d')]===_0x07f2('0x3e')){var _0x3a96ef=_0x3adf66[_0x07f2('0x14')]({'plain':!![]});var _0x53d3c9=_0x07f2('0x15');return db[_0x07f2('0x3f')][_0x07f2('0x39')]({'where':{'name':_0x53d3c9,'userProfileId':_0x3eff96[_0x07f2('0x40')]},'raw':!![]})[_0x07f2('0x12')](function(_0x109a77){if(_0x109a77&&_0x109a77[_0x07f2('0x41')]===0x0){return db['UserProfileResource'][_0x07f2('0x42')]({'name':_0x3a96ef['name'],'resourceId':_0x3a96ef['id'],'type':_0x109a77[_0x07f2('0x1c')],'sectionId':_0x109a77['id']},{})[_0x07f2('0x12')](function(){return _0x3adf66;});}else{return _0x3adf66;}})['catch'](function(_0x395c81){logger[_0x07f2('0x1a')](_0x07f2('0x43'),_0x395c81);throw _0x395c81;});}return _0x3adf66;})[_0x07f2('0x12')](respondWithResult(_0x4b435c,0xc9))[_0x07f2('0x3a')](handleError(_0x4b435c,null));};exports['update']=function(_0x387120,_0x2ca7d1){if(_0x387120[_0x07f2('0x3b')]['id']){delete _0x387120['body']['id'];}return db[_0x07f2('0x20')][_0x07f2('0x39')]({'where':{'id':_0x387120[_0x07f2('0x37')]['id']}})[_0x07f2('0x12')](handleEntityNotFound(_0x2ca7d1,null))['then'](saveUpdates(_0x387120[_0x07f2('0x3b')],null))['then'](function(_0x2f3ea6){if(!_0x2f3ea6)return;var _0x3ce06a=_0x2f3ea6[_0x07f2('0x14')]({'plain':!![]});return _0x3ce06a;})['then'](function(_0x195755){var _0x2f9176=new Redis(config[_0x07f2('0x5')]);_0x2f9176['publish'](_0x07f2('0x17'),JSON[_0x07f2('0x44')](_[_0x07f2('0x30')](_0x195755,['id','name',_0x07f2('0x45')])));return _0x195755;})[_0x07f2('0x12')](respondWithResult(_0x2ca7d1,null))['catch'](handleError(_0x2ca7d1,null));};exports[_0x07f2('0x13')]=function(_0x4e066b,_0x5cbcd4){return db[_0x07f2('0x20')]['find']({'where':{'id':_0x4e066b[_0x07f2('0x37')]['id']}})[_0x07f2('0x12')](handleEntityNotFound(_0x5cbcd4,null))[_0x07f2('0x12')](removeEntity(_0x5cbcd4,null))[_0x07f2('0x3a')](handleError(_0x5cbcd4,null));}; \ No newline at end of file +var _0x8965=['set','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareProject','includeAll','include','rows','catch','params','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count'];(function(_0x58564d,_0x4ede3c){var _0x45a08a=function(_0x1c8949){while(--_0x1c8949){_0x58564d['push'](_0x58564d['shift']());}};_0x45a08a(++_0x4ede3c);}(_0x8965,0x192));var _0x5896=function(_0x145401,_0xde47f9){_0x145401=_0x145401-0x0;var _0x3e0018=_0x8965[_0x145401];return _0x3e0018;};'use strict';var _=require(_0x5896('0x0'));var Redis=require(_0x5896('0x1'));var qs=require(_0x5896('0x2'));var logger=require(_0x5896('0x3'))(_0x5896('0x4'));var config=require(_0x5896('0x5'));var db=require(_0x5896('0x6'))['db'];config[_0x5896('0x7')]=_[_0x5896('0x8')](config[_0x5896('0x7')],{'host':_0x5896('0x9'),'port':0x18eb});var socket=require(_0x5896('0xa'))(new Redis(config[_0x5896('0x7')]));require('./squareProject.socket')[_0x5896('0xb')](socket);function respondWithResult(_0xabb6d4,_0x34f5c5){_0x34f5c5=_0x34f5c5||0xc8;return function(_0xe21e08){if(_0xe21e08){return _0xabb6d4[_0x5896('0xc')](_0x34f5c5)[_0x5896('0xd')](_0xe21e08);}};}function respondWithFilteredResult(_0x529d09,_0xac21ce){return function(_0x529b17){if(_0x529b17){var _0x236300=typeof _0xac21ce[_0x5896('0xe')]===_0x5896('0xf')&&typeof _0xac21ce[_0x5896('0x10')]===_0x5896('0xf');var _0x184561=_0x529b17[_0x5896('0x11')];var _0x39f950=_0x236300?0x0:_0xac21ce[_0x5896('0xe')];var _0x7dd88e=_0x236300?_0x529b17[_0x5896('0x11')]:_0xac21ce[_0x5896('0xe')]+_0xac21ce[_0x5896('0x10')];var _0x44bae0;if(_0x7dd88e>=_0x184561){_0x7dd88e=_0x184561;_0x44bae0=0xc8;}else{_0x44bae0=0xce;}_0x529d09[_0x5896('0xc')](_0x44bae0);return _0x529d09[_0x5896('0x12')]('Content-Range',_0x39f950+'-'+_0x7dd88e+'/'+_0x184561)[_0x5896('0xd')](_0x529b17);}return null;};}function saveUpdates(_0x2cd916){return function(_0x11a82b){if(_0x11a82b){return _0x11a82b[_0x5896('0x13')](_0x2cd916)[_0x5896('0x14')](function(_0x31292f){return _0x31292f;});}return null;};}function removeEntity(_0x4ee67e){return function(_0x228dbb){if(_0x228dbb){return _0x228dbb[_0x5896('0x15')]()['then'](function(){var _0xb349de=_0x228dbb[_0x5896('0x16')]({'plain':!![]});var _0x29f439=_0x5896('0x17');return db[_0x5896('0x18')][_0x5896('0x15')]({'where':{'type':_0x29f439,'resourceId':_0xb349de['id']}})[_0x5896('0x14')](function(){return _0x228dbb;});})[_0x5896('0x14')](function(){var _0x2d863f=new Redis(config[_0x5896('0x7')]);_0x2d863f[_0x5896('0x19')](_0x5896('0x1a'),JSON[_0x5896('0x1b')]({'id':_0x228dbb['id'],'deleted':!![]}));})[_0x5896('0x14')](function(){_0x4ee67e[_0x5896('0xc')](0xcc)[_0x5896('0x1c')]();});}};}function handleEntityNotFound(_0x5eda62){return function(_0x570e1f){if(!_0x570e1f){_0x5eda62['sendStatus'](0x194);}return _0x570e1f;};}function handleError(_0x339161,_0x3379c9){_0x3379c9=_0x3379c9||0x1f4;return function(_0x1b07a8){logger[_0x5896('0x1d')](_0x1b07a8['stack']);if(_0x1b07a8[_0x5896('0x1e')]){delete _0x1b07a8['name'];}_0x339161[_0x5896('0xc')](_0x3379c9)[_0x5896('0x1f')](_0x1b07a8);};}exports[_0x5896('0x20')]=function(_0x574ec4,_0xbe1e43){var _0x2a1357={},_0x4039da={},_0xb69d86={'count':0x0,'rows':[]};var _0x119273=_[_0x5896('0x21')](db['SquareProject'][_0x5896('0x22')],function(_0x11d716){return{'name':_0x11d716[_0x5896('0x23')],'type':_0x11d716[_0x5896('0x24')][_0x5896('0x25')]};});_0x4039da[_0x5896('0x26')]=_[_0x5896('0x21')](_0x119273,_0x5896('0x1e'));_0x4039da[_0x5896('0x27')]=_[_0x5896('0x28')](_0x574ec4[_0x5896('0x27')]);_0x4039da['filters']=_[_0x5896('0x29')](_0x4039da['model'],_0x4039da[_0x5896('0x27')]);_0x2a1357[_0x5896('0x2a')]=_['intersection'](_0x4039da['model'],qs[_0x5896('0x2b')](_0x574ec4[_0x5896('0x27')]['fields']));_0x2a1357[_0x5896('0x2a')]=_0x2a1357[_0x5896('0x2a')][_0x5896('0x2c')]?_0x2a1357[_0x5896('0x2a')]:_0x4039da['model'];if(!_0x574ec4[_0x5896('0x27')][_0x5896('0x2d')](_0x5896('0x2e'))){_0x2a1357[_0x5896('0x10')]=qs[_0x5896('0x10')](_0x574ec4[_0x5896('0x27')][_0x5896('0x10')]);_0x2a1357[_0x5896('0xe')]=qs['offset'](_0x574ec4[_0x5896('0x27')]['offset']);}_0x2a1357['order']=qs['sort'](_0x574ec4[_0x5896('0x27')][_0x5896('0x2f')]);_0x2a1357[_0x5896('0x30')]=qs[_0x5896('0x31')](_[_0x5896('0x32')](_0x574ec4[_0x5896('0x27')],_0x4039da['filters']),_0x119273);if(_0x574ec4[_0x5896('0x27')][_0x5896('0x33')]){_0x2a1357['where']=_[_0x5896('0x34')](_0x2a1357[_0x5896('0x30')],{'$or':_[_0x5896('0x21')](_0x119273,function(_0x306c54){if(_0x306c54[_0x5896('0x24')]!==_0x5896('0x35')){var _0x3d503d={};_0x3d503d[_0x306c54[_0x5896('0x1e')]]={'$like':'%'+_0x574ec4['query'][_0x5896('0x33')]+'%'};return _0x3d503d;}})});}_0x2a1357=_[_0x5896('0x34')]({},_0x2a1357,_0x574ec4[_0x5896('0x36')]);var _0x3f9c81={'where':_0x2a1357[_0x5896('0x30')]};return db[_0x5896('0x37')][_0x5896('0x11')](_0x3f9c81)[_0x5896('0x14')](function(_0x567145){_0xb69d86[_0x5896('0x11')]=_0x567145;if(_0x574ec4[_0x5896('0x27')][_0x5896('0x38')]){_0x2a1357[_0x5896('0x39')]=[{'all':!![]}];}return db[_0x5896('0x37')]['findAll'](_0x2a1357);})[_0x5896('0x14')](function(_0x1bb8cc){_0xb69d86[_0x5896('0x3a')]=_0x1bb8cc;return _0xb69d86;})[_0x5896('0x14')](respondWithFilteredResult(_0xbe1e43,_0x2a1357))[_0x5896('0x3b')](handleError(_0xbe1e43,null));};exports['show']=function(_0x1a7628,_0x245dd6){var _0x118009={'raw':![],'where':{'id':_0x1a7628[_0x5896('0x3c')]['id']}},_0x3cb5cb={};_0x3cb5cb[_0x5896('0x26')]=_[_0x5896('0x28')](db[_0x5896('0x37')][_0x5896('0x22')]);_0x3cb5cb[_0x5896('0x27')]=_[_0x5896('0x28')](_0x1a7628[_0x5896('0x27')]);_0x3cb5cb[_0x5896('0x31')]=_[_0x5896('0x29')](_0x3cb5cb[_0x5896('0x26')],_0x3cb5cb[_0x5896('0x27')]);_0x118009['attributes']=_[_0x5896('0x29')](_0x3cb5cb[_0x5896('0x26')],qs[_0x5896('0x2b')](_0x1a7628[_0x5896('0x27')][_0x5896('0x2b')]));_0x118009['attributes']=_0x118009[_0x5896('0x2a')]['length']?_0x118009[_0x5896('0x2a')]:_0x3cb5cb[_0x5896('0x26')];if(_0x1a7628[_0x5896('0x27')][_0x5896('0x38')]){_0x118009[_0x5896('0x39')]=[{'all':!![]}];}_0x118009=_['merge']({},_0x118009,_0x1a7628['options']);return db[_0x5896('0x37')]['find'](_0x118009)['then'](handleEntityNotFound(_0x245dd6,null))[_0x5896('0x14')](respondWithResult(_0x245dd6,null))[_0x5896('0x3b')](handleError(_0x245dd6,null));};exports[_0x5896('0x3d')]=function(_0x259de5,_0x12e77e){return db[_0x5896('0x37')][_0x5896('0x3d')](_0x259de5[_0x5896('0x3e')],{})[_0x5896('0x14')](function(_0x2eaff9){var _0x5669f3=_0x259de5[_0x5896('0x3f')][_0x5896('0x16')]({'plain':!![]});if(!_0x5669f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5669f3[_0x5896('0x40')]===_0x5896('0x3f')){var _0x41025c=_0x2eaff9[_0x5896('0x16')]({'plain':!![]});var _0x271005=_0x5896('0x17');return db['UserProfileSection'][_0x5896('0x41')]({'where':{'name':_0x271005,'userProfileId':_0x5669f3[_0x5896('0x42')]},'raw':!![]})[_0x5896('0x14')](function(_0x45d603){if(_0x45d603&&_0x45d603[_0x5896('0x43')]===0x0){return db[_0x5896('0x18')][_0x5896('0x3d')]({'name':_0x41025c[_0x5896('0x1e')],'resourceId':_0x41025c['id'],'type':_0x45d603[_0x5896('0x1e')],'sectionId':_0x45d603['id']},{})['then'](function(){return _0x2eaff9;});}else{return _0x2eaff9;}})[_0x5896('0x3b')](function(_0xe7a751){logger['error'](_0x5896('0x44'),_0xe7a751);throw _0xe7a751;});}return _0x2eaff9;})[_0x5896('0x14')](respondWithResult(_0x12e77e,0xc9))[_0x5896('0x3b')](handleError(_0x12e77e,null));};exports[_0x5896('0x13')]=function(_0x419b35,_0x683753){if(_0x419b35['body']['id']){delete _0x419b35[_0x5896('0x3e')]['id'];}return db[_0x5896('0x37')][_0x5896('0x41')]({'where':{'id':_0x419b35[_0x5896('0x3c')]['id']}})[_0x5896('0x14')](handleEntityNotFound(_0x683753,null))[_0x5896('0x14')](saveUpdates(_0x419b35[_0x5896('0x3e')],null))[_0x5896('0x14')](function(_0x4df901){if(!_0x4df901)return;var _0x1769f9=_0x4df901[_0x5896('0x16')]({'plain':!![]});return _0x1769f9;})['then'](function(_0x1357dd){var _0x27d152=new Redis(config['redis']);_0x27d152[_0x5896('0x19')](_0x5896('0x1a'),JSON['stringify'](_[_0x5896('0x32')](_0x1357dd,['id',_0x5896('0x1e'),_0x5896('0x45')])));return _0x1357dd;})[_0x5896('0x14')](respondWithResult(_0x683753,null))[_0x5896('0x3b')](handleError(_0x683753,null));};exports[_0x5896('0x15')]=function(_0x46f006,_0x53b87c){return db[_0x5896('0x37')][_0x5896('0x41')]({'where':{'id':_0x46f006['params']['id']}})[_0x5896('0x14')](handleEntityNotFound(_0x53b87c,null))[_0x5896('0x14')](removeEntity(_0x53b87c,null))[_0x5896('0x3b')](handleError(_0x53b87c,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 2436516..51c0456 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 _0x1cd0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x121886,_0x8cd8e5){var _0x20ca01=function(_0x15e144){while(--_0x15e144){_0x121886['push'](_0x121886['shift']());}};_0x20ca01(++_0x8cd8e5);}(_0x1cd0,0x1d8));var _0x01cd=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1cd0[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require(_0x01cd('0x0'));var SquareProject=require(_0x01cd('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x01cd('0x2'),'afterUpdate':_0x01cd('0x3'),'afterDestroy':_0x01cd('0x4')};function emitEvent(_0x30cb50){return function(_0x159ed7,_0x534a5d,_0x2fffd7){SquareProjectEvents[_0x01cd('0x5')](_0x30cb50+':'+_0x159ed7['id'],_0x159ed7);SquareProjectEvents[_0x01cd('0x5')](_0x30cb50,_0x159ed7);_0x2fffd7(null);};}for(var e in events){if(events[_0x01cd('0x6')](e)){var event=events[e];SquareProject[_0x01cd('0x7')](e,emitEvent(event));}}module[_0x01cd('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xc1a8=['events','../../mysqldb','save','update','emit','hook','exports'];(function(_0x3e65be,_0x382b80){var _0x1c20c3=function(_0x249c16){while(--_0x249c16){_0x3e65be['push'](_0x3e65be['shift']());}};_0x1c20c3(++_0x382b80);}(_0xc1a8,0x149));var _0x8c1a=function(_0x15ec35,_0x5b9972){_0x15ec35=_0x15ec35-0x0;var _0x937cce=_0xc1a8[_0x15ec35];return _0x937cce;};'use strict';var EventEmitter=require(_0x8c1a('0x0'));var SquareProject=require(_0x8c1a('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c1a('0x2'),'afterUpdate':_0x8c1a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4f16ef){return function(_0xf4d592,_0x52fe41,_0x361324){SquareProjectEvents[_0x8c1a('0x4')](_0x4f16ef+':'+_0xf4d592['id'],_0xf4d592);SquareProjectEvents[_0x8c1a('0x4')](_0x4f16ef,_0xf4d592);_0x361324(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x8c1a('0x5')](e,emitEvent(event));}}module[_0x8c1a('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 5f2a04c..784e073 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 _0xd281=['SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0xd281,0x67));var _0x1d28=function(_0x14f2f8,_0x3bc808){_0x14f2f8=_0x14f2f8-0x0;var _0x3015d7=_0xd281[_0x14f2f8];return _0x3015d7;};'use strict';var _=require(_0x1d28('0x0'));var util=require(_0x1d28('0x1'));var logger=require(_0x1d28('0x2'))(_0x1d28('0x3'));var moment=require('moment');var BPromise=require(_0x1d28('0x4'));var rp=require(_0x1d28('0x5'));var fs=require('fs');var path=require(_0x1d28('0x6'));var rimraf=require(_0x1d28('0x7'));var config=require(_0x1d28('0x8'));var attributes=require(_0x1d28('0x9'));module['exports']=function(_0x41cd01,_0x411801){return _0x41cd01[_0x1d28('0xa')](_0x1d28('0xb'),attributes,{'tableName':_0x1d28('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x475393,_0x19394a,_0x4527bd){if(_0x475393[_0x1d28('0xd')](_0x1d28('0xe'))){_0x475393['savedAt']=moment()[_0x1d28('0xf')](_0x1d28('0x10'));}if(_0x475393[_0x1d28('0xd')](_0x1d28('0x11'))){_0x475393[_0x1d28('0x12')]=moment()[_0x1d28('0xf')](_0x1d28('0x10'));}_0x4527bd(null,_0x475393);}}});}; \ No newline at end of file +var _0x8722=['YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','preproduction','savedAt','format'];(function(_0x5f3b9c,_0x416312){var _0x86064b=function(_0x5d2484){while(--_0x5d2484){_0x5f3b9c['push'](_0x5f3b9c['shift']());}};_0x86064b(++_0x416312);}(_0x8722,0x1e4));var _0x2872=function(_0x51834b,_0x5d814d){_0x51834b=_0x51834b-0x0;var _0x41beac=_0x8722[_0x51834b];return _0x41beac;};'use strict';var _=require(_0x2872('0x0'));var util=require(_0x2872('0x1'));var logger=require(_0x2872('0x2'))(_0x2872('0x3'));var moment=require('moment');var BPromise=require(_0x2872('0x4'));var rp=require(_0x2872('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2872('0x6'));var config=require(_0x2872('0x7'));var attributes=require('./squareProject.attributes');module[_0x2872('0x8')]=function(_0x4105c5,_0x40aa53){return _0x4105c5['define']('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x598933,_0x2f1016,_0x3b8c45){if(_0x598933['changed'](_0x2872('0x9'))){_0x598933[_0x2872('0xa')]=moment()[_0x2872('0xb')](_0x2872('0xc'));}if(_0x598933[_0x2872('0xd')](_0x2872('0xe'))){_0x598933[_0x2872('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3b8c45(null,_0x598933);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 03d09dd..c476526 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 _0xd694=['attributes','model','then','debug','stringify','catch','error','message','ShowSquareProject','info','lodash','ioredis','../../config/logger','redis','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','where','limit','include','map'];(function(_0x1d6d35,_0x4ccdbd){var _0x2723c8=function(_0x446582){while(--_0x446582){_0x1d6d35['push'](_0x1d6d35['shift']());}};_0x2723c8(++_0x4ccdbd);}(_0xd694,0x1c4));var _0x4d69=function(_0x4346aa,_0x1e597e){_0x4346aa=_0x4346aa-0x0;var _0x31a809=_0xd694[_0x4346aa];return _0x31a809;};'use strict';var _=require(_0x4d69('0x0'));var Redis=require(_0x4d69('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x4d69('0x2'))('rpc');var config=require('../../config/environment');config[_0x4d69('0x3')]=_['defaults'](config[_0x4d69('0x3')],{'host':_0x4d69('0x4'),'port':0x18eb});var socket=require(_0x4d69('0x5'))(new Redis(config['redis']));require('./squareProject.socket')[_0x4d69('0x6')](socket);exports[_0x4d69('0x7')]=function(_0x598de8){var _0x483308=this;return new Promise(function(_0x1f95fd,_0x3d835b){return db[_0x4d69('0x8')][_0x4d69('0x9')]({'raw':_0x598de8[_0x4d69('0xa')]?_0x598de8[_0x4d69('0xa')][_0x4d69('0xb')]===undefined?!![]:![]:!![],'where':_0x598de8[_0x4d69('0xa')]?_0x598de8[_0x4d69('0xa')][_0x4d69('0xc')]||null:null,'attributes':_0x598de8[_0x4d69('0xa')]?_0x598de8[_0x4d69('0xa')]['attributes']||null:null,'limit':_0x598de8['options']?_0x598de8[_0x4d69('0xa')][_0x4d69('0xd')]||null:null,'include':_0x598de8[_0x4d69('0xa')]?_0x598de8[_0x4d69('0xa')][_0x4d69('0xe')]?_[_0x4d69('0xf')](_0x598de8['options']['include'],function(_0x51c039){return{'model':db[_0x51c039['model']],'as':_0x51c039['as'],'attributes':_0x51c039[_0x4d69('0x10')],'include':_0x51c039[_0x4d69('0xe')]?_[_0x4d69('0xf')](_0x51c039['include'],function(_0x4bce47){return{'model':db[_0x4bce47[_0x4d69('0x11')]],'as':_0x4bce47['as'],'attributes':_0x4bce47[_0x4d69('0x10')],'include':_0x4bce47['include']?_[_0x4d69('0xf')](_0x4bce47[_0x4d69('0xe')],function(_0x1b60d3){return{'model':db[_0x1b60d3[_0x4d69('0x11')]],'as':_0x1b60d3['as'],'attributes':_0x1b60d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d69('0x12')](function(_0xe927e9){logger['info']('GetSquareProjects',_0x598de8);logger[_0x4d69('0x13')](_0x4d69('0x7'),_0x598de8,JSON[_0x4d69('0x14')](_0xe927e9));_0x1f95fd(_0xe927e9);})[_0x4d69('0x15')](function(_0x4bd96f){logger[_0x4d69('0x16')](_0x4d69('0x7'),_0x4bd96f[_0x4d69('0x17')],_0x598de8);_0x3d835b(_0x483308['error'](0x1f4,_0x4bd96f[_0x4d69('0x17')]));});});};exports[_0x4d69('0x18')]=function(_0x52f712){var _0x43a75c=this;return new Promise(function(_0x45c452,_0x4d1a68){return db['SquareProject']['find']({'raw':_0x52f712['options']?_0x52f712[_0x4d69('0xa')][_0x4d69('0xb')]===undefined?!![]:![]:!![],'where':_0x52f712[_0x4d69('0xa')]?_0x52f712[_0x4d69('0xa')][_0x4d69('0xc')]||null:null,'attributes':_0x52f712[_0x4d69('0xa')]?_0x52f712[_0x4d69('0xa')][_0x4d69('0x10')]||null:null,'include':_0x52f712[_0x4d69('0xa')]?_0x52f712[_0x4d69('0xa')][_0x4d69('0xe')]?_[_0x4d69('0xf')](_0x52f712['options'][_0x4d69('0xe')],function(_0x319573){return{'model':db[_0x319573[_0x4d69('0x11')]],'as':_0x319573['as'],'attributes':_0x319573[_0x4d69('0x10')],'include':_0x319573[_0x4d69('0xe')]?_[_0x4d69('0xf')](_0x319573[_0x4d69('0xe')],function(_0x1faa8b){return{'model':db[_0x1faa8b['model']],'as':_0x1faa8b['as'],'attributes':_0x1faa8b[_0x4d69('0x10')],'include':_0x1faa8b['include']?_[_0x4d69('0xf')](_0x1faa8b[_0x4d69('0xe')],function(_0x262f89){return{'model':db[_0x262f89['model']],'as':_0x262f89['as'],'attributes':_0x262f89[_0x4d69('0x10')]};}):[]};}):[]};}):[]:[]})[_0x4d69('0x12')](function(_0x367e55){logger[_0x4d69('0x19')](_0x4d69('0x18'),_0x52f712);logger[_0x4d69('0x13')](_0x4d69('0x18'),_0x52f712,JSON[_0x4d69('0x14')](_0x367e55));_0x45c452(_0x367e55);})[_0x4d69('0x15')](function(_0x223db0){logger[_0x4d69('0x16')](_0x4d69('0x18'),_0x223db0[_0x4d69('0x17')],_0x52f712);_0x4d1a68(_0x43a75c[_0x4d69('0x16')](0x1f4,_0x223db0[_0x4d69('0x17')]));});});}; \ No newline at end of file +var _0x26b0=['GetSquareProjects','catch','error','message','ShowSquareProject','find','raw','stringify','lodash','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','where','attributes','include','map','model','then','info','debug'];(function(_0x417aac,_0x1be30e){var _0x5ae174=function(_0x398288){while(--_0x398288){_0x417aac['push'](_0x417aac['shift']());}};_0x5ae174(++_0x1be30e);}(_0x26b0,0x19e));var _0x026b=function(_0x211b80,_0x5cb5fa){_0x211b80=_0x211b80-0x0;var _0x1c3037=_0x26b0[_0x211b80];return _0x1c3037;};'use strict';var _=require(_0x026b('0x0'));var Redis=require(_0x026b('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x026b('0x2'))(_0x026b('0x3'));var config=require(_0x026b('0x4'));config[_0x026b('0x5')]=_[_0x026b('0x6')](config[_0x026b('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x026b('0x7'))(new Redis(config[_0x026b('0x5')]));require(_0x026b('0x8'))[_0x026b('0x9')](socket);exports['GetSquareProjects']=function(_0x579185){var _0x673014=this;return new Promise(function(_0x22615e,_0x1f8569){return db[_0x026b('0xa')][_0x026b('0xb')]({'raw':_0x579185['options']?_0x579185[_0x026b('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x579185['options']?_0x579185[_0x026b('0xc')][_0x026b('0xd')]||null:null,'attributes':_0x579185[_0x026b('0xc')]?_0x579185['options'][_0x026b('0xe')]||null:null,'limit':_0x579185[_0x026b('0xc')]?_0x579185[_0x026b('0xc')]['limit']||null:null,'include':_0x579185[_0x026b('0xc')]?_0x579185[_0x026b('0xc')][_0x026b('0xf')]?_[_0x026b('0x10')](_0x579185[_0x026b('0xc')][_0x026b('0xf')],function(_0x405f1e){return{'model':db[_0x405f1e['model']],'as':_0x405f1e['as'],'attributes':_0x405f1e[_0x026b('0xe')],'include':_0x405f1e[_0x026b('0xf')]?_[_0x026b('0x10')](_0x405f1e[_0x026b('0xf')],function(_0x516c03){return{'model':db[_0x516c03[_0x026b('0x11')]],'as':_0x516c03['as'],'attributes':_0x516c03['attributes'],'include':_0x516c03[_0x026b('0xf')]?_['map'](_0x516c03[_0x026b('0xf')],function(_0x553b90){return{'model':db[_0x553b90[_0x026b('0x11')]],'as':_0x553b90['as'],'attributes':_0x553b90[_0x026b('0xe')]};}):[]};}):[]};}):[]:[]})[_0x026b('0x12')](function(_0x5dbe48){logger[_0x026b('0x13')]('GetSquareProjects',_0x579185);logger[_0x026b('0x14')](_0x026b('0x15'),_0x579185,JSON['stringify'](_0x5dbe48));_0x22615e(_0x5dbe48);})[_0x026b('0x16')](function(_0x202c4f){logger[_0x026b('0x17')](_0x026b('0x15'),_0x202c4f['message'],_0x579185);_0x1f8569(_0x673014[_0x026b('0x17')](0x1f4,_0x202c4f[_0x026b('0x18')]));});});};exports[_0x026b('0x19')]=function(_0x22f999){var _0x509796=this;return new Promise(function(_0x599866,_0x4b659f){return db[_0x026b('0xa')][_0x026b('0x1a')]({'raw':_0x22f999[_0x026b('0xc')]?_0x22f999[_0x026b('0xc')][_0x026b('0x1b')]===undefined?!![]:![]:!![],'where':_0x22f999[_0x026b('0xc')]?_0x22f999['options'][_0x026b('0xd')]||null:null,'attributes':_0x22f999[_0x026b('0xc')]?_0x22f999[_0x026b('0xc')][_0x026b('0xe')]||null:null,'include':_0x22f999['options']?_0x22f999[_0x026b('0xc')]['include']?_['map'](_0x22f999['options'][_0x026b('0xf')],function(_0x2a332f){return{'model':db[_0x2a332f['model']],'as':_0x2a332f['as'],'attributes':_0x2a332f[_0x026b('0xe')],'include':_0x2a332f[_0x026b('0xf')]?_[_0x026b('0x10')](_0x2a332f[_0x026b('0xf')],function(_0x1bd140){return{'model':db[_0x1bd140[_0x026b('0x11')]],'as':_0x1bd140['as'],'attributes':_0x1bd140[_0x026b('0xe')],'include':_0x1bd140[_0x026b('0xf')]?_[_0x026b('0x10')](_0x1bd140[_0x026b('0xf')],function(_0xef0e2f){return{'model':db[_0xef0e2f[_0x026b('0x11')]],'as':_0xef0e2f['as'],'attributes':_0xef0e2f[_0x026b('0xe')]};}):[]};}):[]};}):[]:[]})[_0x026b('0x12')](function(_0x5b2b6b){logger[_0x026b('0x13')](_0x026b('0x19'),_0x22f999);logger[_0x026b('0x14')](_0x026b('0x19'),_0x22f999,JSON[_0x026b('0x1c')](_0x5b2b6b));_0x599866(_0x5b2b6b);})[_0x026b('0x16')](function(_0x12e5aa){logger[_0x026b('0x17')]('ShowSquareProject',_0x12e5aa['message'],_0x22f999);_0x4b659f(_0x509796['error'](0x1f4,_0x12e5aa[_0x026b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index f0d683a..bc8ae4f 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 _0x5dc3=['save','remove','update','emit','register','length','squareProject:','./squareProject.events'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x5dc3,0x8f));var _0x35dc=function(_0x4dc4bd,_0x490bf0){_0x4dc4bd=_0x4dc4bd-0x0;var _0x22a362=_0x5dc3[_0x4dc4bd];return _0x22a362;};'use strict';var SquareProjectEvents=require(_0x35dc('0x0'));var events=[_0x35dc('0x1'),_0x35dc('0x2'),_0x35dc('0x3')];function createListener(_0x56365c,_0x541461){return function(_0x420357){_0x541461[_0x35dc('0x4')](_0x56365c,_0x420357);};}function removeListener(_0x349860,_0x4e85eb){return function(){SquareProjectEvents['removeListener'](_0x349860,_0x4e85eb);};}exports[_0x35dc('0x5')]=function(_0x154047){for(var _0x374381=0x0,_0x553628=events[_0x35dc('0x6')];_0x374381<_0x553628;_0x374381++){var _0x349295=events[_0x374381];var _0x52f631=createListener(_0x35dc('0x7')+_0x349295,_0x154047);SquareProjectEvents['on'](_0x349295,_0x52f631);}}; \ No newline at end of file +var _0x0dc3=['emit','register','squareProject:','save','update'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0x0dc3,0x107));var _0x30dc=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x0dc3[_0x142ec2];return _0x45ef4e;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x30dc('0x0'),'remove',_0x30dc('0x1')];function createListener(_0x86cdeb,_0x2ab460){return function(_0x52e91b){_0x2ab460[_0x30dc('0x2')](_0x86cdeb,_0x52e91b);};}function removeListener(_0x1ff58f,_0x2263c2){return function(){SquareProjectEvents['removeListener'](_0x1ff58f,_0x2263c2);};}exports[_0x30dc('0x3')]=function(_0x201ced){for(var _0x1726ba=0x0,_0x41fe02=events['length'];_0x1726ba<_0x41fe02;_0x1726ba++){var _0x58d562=events[_0x1726ba];var _0x5a1802=createListener(_0x30dc('0x4')+_0x58d562,_0x201ced);SquareProjectEvents['on'](_0x58d562,_0x5a1802);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 40dfcc5..9004a06 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x47bb73,_0x304c64){var _0x47f99f=function(_0x2554ed){while(--_0x2554ed){_0x47bb73['push'](_0x47bb73['shift']());}};_0x47f99f(++_0x304c64);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x7fbe[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x1738a3,_0xd7836f){var _0x218e1f=function(_0x455c2b){while(--_0x455c2b){_0x1738a3['push'](_0x1738a3['shift']());}};_0x218e1f(++_0xd7836f);}(_0x814b,0x1a2));var _0xb814=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0x814b[_0xc5a279];return _0xc755d3;};'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('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index bd68e34..74885c0 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 _0xac9d=['VIRTUAL','savePath','lastIndexOf','sequelize','exports','STRING'];(function(_0x107354,_0x57b94f){var _0xf955fd=function(_0x1a1711){while(--_0x1a1711){_0x107354['push'](_0x107354['shift']());}};_0xf955fd(++_0x57b94f);}(_0xac9d,0x14d));var _0xdac9=function(_0x5d8792,_0x4f5438){_0x5d8792=_0x5d8792-0x0;var _0x986d0e=_0xac9d[_0x5d8792];return _0x986d0e;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'uniqueid':{'type':Sequelize[_0xdac9('0x2')]},'callerid':{'type':Sequelize[_0xdac9('0x2')]},'calleridname':{'type':Sequelize[_0xdac9('0x2')]},'context':{'type':Sequelize[_0xdac9('0x2')]},'extension':{'type':Sequelize[_0xdac9('0x2')]},'priority':{'type':Sequelize[_0xdac9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xdac9('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xdac9('0x2')]},'filename':{'type':Sequelize[_0xdac9('0x2')]},'savePath':{'type':Sequelize[_0xdac9('0x2')]},'format':{'type':Sequelize[_0xdac9('0x3')],'get':function(){var _0x1c78c5='';var _0x39f560=this['getDataValue'](_0xdac9('0x4'));if(_0x39f560){_0x1c78c5=_0x39f560['substring'](_0x39f560[_0xdac9('0x5')]('.'));}return _0x1c78c5;}}}; \ No newline at end of file +var _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xf494,0x1c6));var _0x4f49=function(_0x321c54,_0x2ea3fe){_0x321c54=_0x321c54-0x0;var _0x519540=_0xf494[_0x321c54];return _0x519540;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 97c4363..78bfd79 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 _0xba4e=['end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','includeAll','include','catch','show','params','length','options','find','body','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xba4e,0x1c3));var _0xeba4=function(_0x43e885,_0x5700f1){_0x43e885=_0x43e885-0x0;var _0x18df65=_0xba4e[_0x43e885];return _0x18df65;};'use strict';var emlformat=require(_0xeba4('0x0'));var rimraf=require(_0xeba4('0x1'));var zipdir=require(_0xeba4('0x2'));var jsonpatch=require(_0xeba4('0x3'));var rp=require('request-promise');var moment=require(_0xeba4('0x4'));var BPromise=require(_0xeba4('0x5'));var Mustache=require('mustache');var util=require(_0xeba4('0x6'));var path=require(_0xeba4('0x7'));var sox=require(_0xeba4('0x8'));var csv=require(_0xeba4('0x9'));var ejs=require(_0xeba4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeba4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeba4('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeba4('0xd'));var as=require(_0xeba4('0xe'));var hardwareService=require(_0xeba4('0xf'));var logger=require(_0xeba4('0x10'))(_0xeba4('0x11'));var utils=require(_0xeba4('0x12'));var config=require(_0xeba4('0x13'));var licenseUtil=require(_0xeba4('0x14'));var db=require(_0xeba4('0x15'))['db'];function respondWithStatusCode(_0x1fbc95,_0x4891cc){_0x4891cc=_0x4891cc||0xcc;return function(_0x255df3){if(_0x255df3){return _0x1fbc95[_0xeba4('0x16')](_0x4891cc);}return _0x1fbc95[_0xeba4('0x17')](_0x4891cc)[_0xeba4('0x18')]();};}function respondWithResult(_0x33a17c,_0x5a4d62){_0x5a4d62=_0x5a4d62||0xc8;return function(_0xf01b47){if(_0xf01b47){return _0x33a17c[_0xeba4('0x17')](_0x5a4d62)['json'](_0xf01b47);}};}function respondWithFilteredResult(_0x630c4a,_0x4c5277){return function(_0x5b7e2a){if(_0x5b7e2a){var _0x2b8c17=typeof _0x4c5277[_0xeba4('0x19')]===_0xeba4('0x1a')&&typeof _0x4c5277['limit']===_0xeba4('0x1a');var _0x1258f6=_0x5b7e2a[_0xeba4('0x1b')];var _0x2855af=_0x2b8c17?0x0:_0x4c5277[_0xeba4('0x19')];var _0x527848=_0x2b8c17?_0x5b7e2a['count']:_0x4c5277[_0xeba4('0x19')]+_0x4c5277[_0xeba4('0x1c')];var _0x13b0ac;if(_0x527848>=_0x1258f6){_0x527848=_0x1258f6;_0x13b0ac=0xc8;}else{_0x13b0ac=0xce;}_0x630c4a[_0xeba4('0x17')](_0x13b0ac);return _0x630c4a[_0xeba4('0x1d')](_0xeba4('0x1e'),_0x2855af+'-'+_0x527848+'/'+_0x1258f6)[_0xeba4('0x1f')](_0x5b7e2a);}return null;};}function patchUpdates(_0x20ac78){return function(_0x183847){try{jsonpatch[_0xeba4('0x20')](_0x183847,_0x20ac78,!![]);}catch(_0x48d840){return BPromise[_0xeba4('0x21')](_0x48d840);}return _0x183847[_0xeba4('0x22')]();};}function saveUpdates(_0x139461,_0x52fcaa){return function(_0x50341f){if(_0x50341f){return _0x50341f[_0xeba4('0x23')](_0x139461)[_0xeba4('0x24')](function(_0x3fbf88){return _0x3fbf88;});}return null;};}function removeEntity(_0x4fa831,_0x2e259d){return function(_0x245f19){if(_0x245f19){return _0x245f19[_0xeba4('0x25')]()[_0xeba4('0x24')](function(){_0x4fa831[_0xeba4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c193,_0x40b14a){return function(_0x9b0cdf){if(!_0x9b0cdf){_0x36c193['sendStatus'](0x194);}return _0x9b0cdf;};}function handleError(_0xb0b3ee,_0xfea8d6){_0xfea8d6=_0xfea8d6||0x1f4;return function(_0x331516){logger[_0xeba4('0x26')](_0x331516[_0xeba4('0x27')]);if(_0x331516[_0xeba4('0x28')]){delete _0x331516['name'];}_0xb0b3ee[_0xeba4('0x17')](_0xfea8d6)[_0xeba4('0x29')](_0x331516);};}exports[_0xeba4('0x2a')]=function(_0x3ceb0b,_0x45e341){var _0x15b5d6={},_0x521579={},_0x20b7f5={'count':0x0,'rows':[]};var _0x583168=_['map'](db[_0xeba4('0x2b')][_0xeba4('0x2c')],function(_0x51e1cc){return{'name':_0x51e1cc[_0xeba4('0x2d')],'type':_0x51e1cc[_0xeba4('0x2e')][_0xeba4('0x2f')]};});_0x521579[_0xeba4('0x30')]=_['map'](_0x583168,_0xeba4('0x28'));_0x521579[_0xeba4('0x31')]=_[_0xeba4('0x32')](_0x3ceb0b['query']);_0x521579['filters']=_[_0xeba4('0x33')](_0x521579[_0xeba4('0x30')],_0x521579[_0xeba4('0x31')]);_0x15b5d6[_0xeba4('0x34')]=_[_0xeba4('0x33')](_0x521579['model'],qs[_0xeba4('0x35')](_0x3ceb0b[_0xeba4('0x31')][_0xeba4('0x35')]));_0x15b5d6['attributes']=_0x15b5d6[_0xeba4('0x34')]['length']?_0x15b5d6['attributes']:_0x521579[_0xeba4('0x30')];if(!_0x3ceb0b[_0xeba4('0x31')]['hasOwnProperty'](_0xeba4('0x36'))){_0x15b5d6[_0xeba4('0x1c')]=qs[_0xeba4('0x1c')](_0x3ceb0b[_0xeba4('0x31')][_0xeba4('0x1c')]);_0x15b5d6['offset']=qs[_0xeba4('0x19')](_0x3ceb0b[_0xeba4('0x31')]['offset']);}_0x15b5d6[_0xeba4('0x37')]=qs[_0xeba4('0x38')](_0x3ceb0b[_0xeba4('0x31')][_0xeba4('0x38')]);_0x15b5d6[_0xeba4('0x39')]=qs[_0xeba4('0x3a')](_[_0xeba4('0x3b')](_0x3ceb0b[_0xeba4('0x31')],_0x521579[_0xeba4('0x3a')]),_0x583168);if(_0x3ceb0b[_0xeba4('0x31')][_0xeba4('0x3c')]){_0x15b5d6[_0xeba4('0x39')]=_[_0xeba4('0x3d')](_0x15b5d6[_0xeba4('0x39')],{'$or':_[_0xeba4('0x3e')](_0x583168,function(_0x2260a0){if(_0x2260a0['type']!==_0xeba4('0x3f')){var _0x2afe9f={};_0x2afe9f[_0x2260a0['name']]={'$like':'%'+_0x3ceb0b[_0xeba4('0x31')][_0xeba4('0x3c')]+'%'};return _0x2afe9f;}})});}_0x15b5d6=_[_0xeba4('0x3d')]({},_0x15b5d6,_0x3ceb0b['options']);var _0x377e2c={'where':_0x15b5d6[_0xeba4('0x39')]};return db[_0xeba4('0x2b')][_0xeba4('0x1b')](_0x377e2c)[_0xeba4('0x24')](function(_0x4ec6d9){_0x20b7f5[_0xeba4('0x1b')]=_0x4ec6d9;if(_0x3ceb0b[_0xeba4('0x31')][_0xeba4('0x40')]){_0x15b5d6[_0xeba4('0x41')]=[{'all':!![]}];}return db[_0xeba4('0x2b')]['findAll'](_0x15b5d6);})[_0xeba4('0x24')](function(_0x52e070){_0x20b7f5['rows']=_0x52e070;return _0x20b7f5;})[_0xeba4('0x24')](respondWithFilteredResult(_0x45e341,_0x15b5d6))[_0xeba4('0x42')](handleError(_0x45e341,null));};exports[_0xeba4('0x43')]=function(_0x177de9,_0x175c94){var _0x325635={'raw':!![],'where':{'id':_0x177de9[_0xeba4('0x44')]['id']}},_0x2fac70={};_0x2fac70[_0xeba4('0x30')]=_[_0xeba4('0x32')](db['SquareRecording'][_0xeba4('0x2c')]);_0x2fac70[_0xeba4('0x31')]=_[_0xeba4('0x32')](_0x177de9[_0xeba4('0x31')]);_0x2fac70[_0xeba4('0x3a')]=_[_0xeba4('0x33')](_0x2fac70[_0xeba4('0x30')],_0x2fac70[_0xeba4('0x31')]);_0x325635[_0xeba4('0x34')]=_[_0xeba4('0x33')](_0x2fac70['model'],qs[_0xeba4('0x35')](_0x177de9[_0xeba4('0x31')][_0xeba4('0x35')]));_0x325635[_0xeba4('0x34')]=_0x325635[_0xeba4('0x34')][_0xeba4('0x45')]?_0x325635[_0xeba4('0x34')]:_0x2fac70[_0xeba4('0x30')];if(_0x177de9[_0xeba4('0x31')]['includeAll']){_0x325635[_0xeba4('0x41')]=[{'all':!![]}];}_0x325635=_[_0xeba4('0x3d')]({},_0x325635,_0x177de9[_0xeba4('0x46')]);return db['SquareRecording'][_0xeba4('0x47')](_0x325635)[_0xeba4('0x24')](handleEntityNotFound(_0x175c94,null))[_0xeba4('0x24')](respondWithResult(_0x175c94,null))[_0xeba4('0x42')](handleError(_0x175c94,null));};exports['create']=function(_0x3487bb,_0x52973a){return db[_0xeba4('0x2b')]['create'](_0x3487bb['body'],{})[_0xeba4('0x24')](respondWithResult(_0x52973a,0xc9))[_0xeba4('0x42')](handleError(_0x52973a,null));};exports['update']=function(_0xc1cea6,_0x43b2cc){if(_0xc1cea6[_0xeba4('0x48')]['id']){delete _0xc1cea6[_0xeba4('0x48')]['id'];}return db[_0xeba4('0x2b')][_0xeba4('0x47')]({'where':{'id':_0xc1cea6[_0xeba4('0x44')]['id']}})['then'](handleEntityNotFound(_0x43b2cc,null))[_0xeba4('0x24')](saveUpdates(_0xc1cea6[_0xeba4('0x48')],null))[_0xeba4('0x24')](respondWithResult(_0x43b2cc,null))['catch'](handleError(_0x43b2cc,null));};exports['download']=function(_0x5f5994,_0x1230eb,_0x1ea916){var _0x43f0ad=require('../../components/encryptor');var _0x47369b=![];var _0x1e881b={};if(_0x5f5994[_0xeba4('0x31')]['type']&&_0x5f5994[_0xeba4('0x31')][_0xeba4('0x2e')]==='uniqueid'){_0x1e881b[_0xeba4('0x49')]=_0x5f5994[_0xeba4('0x44')]['id'];}else{_0x1e881b['id']=_0x5f5994[_0xeba4('0x44')]['id'];}return db[_0xeba4('0x2b')][_0xeba4('0x47')]({'where':_0x1e881b,'attributes':['id',_0xeba4('0x4a'),_0xeba4('0x4b')],'raw':!![]})[_0xeba4('0x24')](handleEntityNotFound(_0x1230eb,null))[_0xeba4('0x24')](function(_0x127399){if(_0x127399){var _0x451ccb=_0x127399[_0xeba4('0x4a')];var _0x2ba141=util[_0xeba4('0x4c')](_0xeba4('0x4d'),_0x451ccb);if(fs[_0xeba4('0x4e')](_0x2ba141)){_0x47369b=!![];return _0x43f0ad[_0xeba4('0x4f')](_0x2ba141,_0x451ccb,config[_0xeba4('0x50')][_0xeba4('0x51')])[_0xeba4('0x24')](function(){return _0x127399;});}return _0x127399;}})['then'](function(_0x499f33){if(_0x499f33){var _0x418aad=_0x499f33[_0xeba4('0x4a')];if(!fs[_0xeba4('0x4e')](_0x418aad)){throw new db['Sequelize']['ValidationError'](_0xeba4('0x52'));}if(_0x499f33['filename']){return _0x1230eb[_0xeba4('0x53')](_0x418aad,_0x499f33['filename']+path[_0xeba4('0x54')](_0x418aad),function(){if(_0x47369b){fs[_0xeba4('0x55')](_0x418aad);}});}else{return _0x1230eb[_0xeba4('0x53')](_0x418aad,function(_0x3821fc){if(_0x47369b){fs['unlink'](_0x418aad);}});}}})[_0xeba4('0x42')](function(_0x4b9e1f){if(_0x4b9e1f[_0xeba4('0x56')]===_0xeba4('0x52')){_0x1230eb[_0xeba4('0x17')](0x194)[_0xeba4('0x29')](_0xeba4('0x57'));}else{return handleError(_0x1230eb,null);}});};exports['destroy']=function(_0x2edf89,_0x17cc68){return db[_0xeba4('0x2b')]['find']({'where':{'id':_0x2edf89[_0xeba4('0x44')]['id']}})[_0xeba4('0x24')](function(_0x330ac3){if(_[_0xeba4('0x58')](_0x330ac3)){throw new ReferenceError(_0xeba4('0x59'));}return _0x330ac3;})['then'](function(_0xfed7e8){var _0x58a8ca=_0xfed7e8[_0xeba4('0x4a')];logger[_0xeba4('0x5a')](_0xeba4('0x5b'),_0x58a8ca);if(!_[_0xeba4('0x58')](_0xfed7e8[_0xeba4('0x4a')])&&fs['existsSync'](_0x58a8ca)){logger[_0xeba4('0x5a')](_0xeba4('0x5c')+_0x58a8ca+_0xeba4('0x5d'));fs[_0xeba4('0x5e')](_0x58a8ca);}_0x58a8ca=_0x58a8ca+'.cypher';if(!_[_0xeba4('0x58')](_0xfed7e8[_0xeba4('0x4a')])&&fs['existsSync'](_0x58a8ca)){logger[_0xeba4('0x5a')](_0xeba4('0x5c')+_0x58a8ca+_0xeba4('0x5d'));fs[_0xeba4('0x5e')](_0x58a8ca);}return _0xfed7e8;})['then'](function(_0x431f67){if(!_0x431f67)throw new InternalError();return _0x431f67[_0xeba4('0x25')]();})['then'](function(){_0x17cc68[_0xeba4('0x17')](0xcc)[_0xeba4('0x18')]();})['catch'](handleError(_0x17cc68,null));}; \ No newline at end of file +var _0xa1b3=['extname','unlink','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','rows','catch','show','length','options','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found'];(function(_0x351ae1,_0x5d7aca){var _0x5e13b2=function(_0x191f2a){while(--_0x191f2a){_0x351ae1['push'](_0x351ae1['shift']());}};_0x5e13b2(++_0x5d7aca);}(_0xa1b3,0x195));var _0x3a1b=function(_0x400f28,_0x42d572){_0x400f28=_0x400f28-0x0;var _0x14f387=_0xa1b3[_0x400f28];return _0x14f387;};'use strict';var emlformat=require(_0x3a1b('0x0'));var rimraf=require(_0x3a1b('0x1'));var zipdir=require(_0x3a1b('0x2'));var jsonpatch=require(_0x3a1b('0x3'));var rp=require(_0x3a1b('0x4'));var moment=require(_0x3a1b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3a1b('0x6'));var util=require(_0x3a1b('0x7'));var path=require(_0x3a1b('0x8'));var sox=require(_0x3a1b('0x9'));var csv=require(_0x3a1b('0xa'));var ejs=require(_0x3a1b('0xb'));var fs=require('fs');var fs_extra=require(_0x3a1b('0xc'));var _=require(_0x3a1b('0xd'));var squel=require(_0x3a1b('0xe'));var crypto=require('crypto');var jsforce=require(_0x3a1b('0xf'));var deskjs=require(_0x3a1b('0x10'));var toCsv=require(_0x3a1b('0xa'));var querystring=require(_0x3a1b('0x11'));var Papa=require(_0x3a1b('0x12'));var Redis=require(_0x3a1b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a1b('0x14'));var hardwareService=require(_0x3a1b('0x15'));var logger=require(_0x3a1b('0x16'))(_0x3a1b('0x17'));var utils=require(_0x3a1b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3a1b('0x19'))['db'];function respondWithStatusCode(_0x9bac15,_0x4cf084){_0x4cf084=_0x4cf084||0xcc;return function(_0x29e062){if(_0x29e062){return _0x9bac15['sendStatus'](_0x4cf084);}return _0x9bac15[_0x3a1b('0x1a')](_0x4cf084)[_0x3a1b('0x1b')]();};}function respondWithResult(_0x27269d,_0x42a22b){_0x42a22b=_0x42a22b||0xc8;return function(_0x363f38){if(_0x363f38){return _0x27269d['status'](_0x42a22b)[_0x3a1b('0x1c')](_0x363f38);}};}function respondWithFilteredResult(_0x23527a,_0x4f55b7){return function(_0x537880){if(_0x537880){var _0x4931f6=typeof _0x4f55b7[_0x3a1b('0x1d')]==='undefined'&&typeof _0x4f55b7[_0x3a1b('0x1e')]==='undefined';var _0x5e3abb=_0x537880[_0x3a1b('0x1f')];var _0x1f5148=_0x4931f6?0x0:_0x4f55b7[_0x3a1b('0x1d')];var _0x31f076=_0x4931f6?_0x537880['count']:_0x4f55b7['offset']+_0x4f55b7[_0x3a1b('0x1e')];var _0x569d0e;if(_0x31f076>=_0x5e3abb){_0x31f076=_0x5e3abb;_0x569d0e=0xc8;}else{_0x569d0e=0xce;}_0x23527a[_0x3a1b('0x1a')](_0x569d0e);return _0x23527a[_0x3a1b('0x20')](_0x3a1b('0x21'),_0x1f5148+'-'+_0x31f076+'/'+_0x5e3abb)[_0x3a1b('0x1c')](_0x537880);}return null;};}function patchUpdates(_0x5cd77e){return function(_0x591827){try{jsonpatch['apply'](_0x591827,_0x5cd77e,!![]);}catch(_0x17137f){return BPromise[_0x3a1b('0x22')](_0x17137f);}return _0x591827[_0x3a1b('0x23')]();};}function saveUpdates(_0x33da19,_0x418166){return function(_0x14906d){if(_0x14906d){return _0x14906d[_0x3a1b('0x24')](_0x33da19)['then'](function(_0x1af43b){return _0x1af43b;});}return null;};}function removeEntity(_0x3b12d0,_0x5c1214){return function(_0x1db97d){if(_0x1db97d){return _0x1db97d[_0x3a1b('0x25')]()['then'](function(){_0x3b12d0[_0x3a1b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2cf9,_0x5408d9){return function(_0x319138){if(!_0x319138){_0x3d2cf9[_0x3a1b('0x26')](0x194);}return _0x319138;};}function handleError(_0x5a5edc,_0x2e61ca){_0x2e61ca=_0x2e61ca||0x1f4;return function(_0x5b8368){logger[_0x3a1b('0x27')](_0x5b8368[_0x3a1b('0x28')]);if(_0x5b8368[_0x3a1b('0x29')]){delete _0x5b8368[_0x3a1b('0x29')];}_0x5a5edc[_0x3a1b('0x1a')](_0x2e61ca)[_0x3a1b('0x2a')](_0x5b8368);};}exports[_0x3a1b('0x2b')]=function(_0x4243cd,_0x5c9ffb){var _0x442ed5={},_0x5dc59f={},_0x51ff68={'count':0x0,'rows':[]};var _0x13b955=_[_0x3a1b('0x2c')](db[_0x3a1b('0x2d')][_0x3a1b('0x2e')],function(_0x3596e5){return{'name':_0x3596e5[_0x3a1b('0x2f')],'type':_0x3596e5[_0x3a1b('0x30')][_0x3a1b('0x31')]};});_0x5dc59f['model']=_['map'](_0x13b955,_0x3a1b('0x29'));_0x5dc59f[_0x3a1b('0x32')]=_[_0x3a1b('0x33')](_0x4243cd['query']);_0x5dc59f[_0x3a1b('0x34')]=_[_0x3a1b('0x35')](_0x5dc59f[_0x3a1b('0x36')],_0x5dc59f[_0x3a1b('0x32')]);_0x442ed5[_0x3a1b('0x37')]=_[_0x3a1b('0x35')](_0x5dc59f[_0x3a1b('0x36')],qs[_0x3a1b('0x38')](_0x4243cd['query']['fields']));_0x442ed5['attributes']=_0x442ed5[_0x3a1b('0x37')]['length']?_0x442ed5[_0x3a1b('0x37')]:_0x5dc59f[_0x3a1b('0x36')];if(!_0x4243cd['query'][_0x3a1b('0x39')](_0x3a1b('0x3a'))){_0x442ed5[_0x3a1b('0x1e')]=qs[_0x3a1b('0x1e')](_0x4243cd[_0x3a1b('0x32')]['limit']);_0x442ed5[_0x3a1b('0x1d')]=qs[_0x3a1b('0x1d')](_0x4243cd[_0x3a1b('0x32')][_0x3a1b('0x1d')]);}_0x442ed5['order']=qs[_0x3a1b('0x3b')](_0x4243cd[_0x3a1b('0x32')][_0x3a1b('0x3b')]);_0x442ed5[_0x3a1b('0x3c')]=qs['filters'](_[_0x3a1b('0x3d')](_0x4243cd[_0x3a1b('0x32')],_0x5dc59f[_0x3a1b('0x34')]),_0x13b955);if(_0x4243cd[_0x3a1b('0x32')][_0x3a1b('0x3e')]){_0x442ed5[_0x3a1b('0x3c')]=_[_0x3a1b('0x3f')](_0x442ed5[_0x3a1b('0x3c')],{'$or':_[_0x3a1b('0x2c')](_0x13b955,function(_0x4ca692){if(_0x4ca692[_0x3a1b('0x30')]!==_0x3a1b('0x40')){var _0x17f8bc={};_0x17f8bc[_0x4ca692['name']]={'$like':'%'+_0x4243cd[_0x3a1b('0x32')]['filter']+'%'};return _0x17f8bc;}})});}_0x442ed5=_['merge']({},_0x442ed5,_0x4243cd['options']);var _0x4af36f={'where':_0x442ed5[_0x3a1b('0x3c')]};return db[_0x3a1b('0x2d')][_0x3a1b('0x1f')](_0x4af36f)[_0x3a1b('0x41')](function(_0xda26e1){_0x51ff68[_0x3a1b('0x1f')]=_0xda26e1;if(_0x4243cd[_0x3a1b('0x32')][_0x3a1b('0x42')]){_0x442ed5[_0x3a1b('0x43')]=[{'all':!![]}];}return db[_0x3a1b('0x2d')]['findAll'](_0x442ed5);})['then'](function(_0x54dbcc){_0x51ff68[_0x3a1b('0x44')]=_0x54dbcc;return _0x51ff68;})[_0x3a1b('0x41')](respondWithFilteredResult(_0x5c9ffb,_0x442ed5))[_0x3a1b('0x45')](handleError(_0x5c9ffb,null));};exports[_0x3a1b('0x46')]=function(_0x4d27be,_0x2b6e6b){var _0x2c05e9={'raw':!![],'where':{'id':_0x4d27be['params']['id']}},_0x1d07af={};_0x1d07af['model']=_[_0x3a1b('0x33')](db[_0x3a1b('0x2d')]['rawAttributes']);_0x1d07af[_0x3a1b('0x32')]=_['keys'](_0x4d27be['query']);_0x1d07af['filters']=_[_0x3a1b('0x35')](_0x1d07af[_0x3a1b('0x36')],_0x1d07af[_0x3a1b('0x32')]);_0x2c05e9['attributes']=_[_0x3a1b('0x35')](_0x1d07af[_0x3a1b('0x36')],qs[_0x3a1b('0x38')](_0x4d27be[_0x3a1b('0x32')][_0x3a1b('0x38')]));_0x2c05e9[_0x3a1b('0x37')]=_0x2c05e9['attributes'][_0x3a1b('0x47')]?_0x2c05e9['attributes']:_0x1d07af[_0x3a1b('0x36')];if(_0x4d27be[_0x3a1b('0x32')][_0x3a1b('0x42')]){_0x2c05e9[_0x3a1b('0x43')]=[{'all':!![]}];}_0x2c05e9=_[_0x3a1b('0x3f')]({},_0x2c05e9,_0x4d27be[_0x3a1b('0x48')]);return db['SquareRecording'][_0x3a1b('0x49')](_0x2c05e9)['then'](handleEntityNotFound(_0x2b6e6b,null))[_0x3a1b('0x41')](respondWithResult(_0x2b6e6b,null))[_0x3a1b('0x45')](handleError(_0x2b6e6b,null));};exports[_0x3a1b('0x4a')]=function(_0x553b82,_0x2d73a8){return db['SquareRecording'][_0x3a1b('0x4a')](_0x553b82['body'],{})[_0x3a1b('0x41')](respondWithResult(_0x2d73a8,0xc9))[_0x3a1b('0x45')](handleError(_0x2d73a8,null));};exports['update']=function(_0x106fc8,_0x12ba72){if(_0x106fc8[_0x3a1b('0x4b')]['id']){delete _0x106fc8[_0x3a1b('0x4b')]['id'];}return db[_0x3a1b('0x2d')][_0x3a1b('0x49')]({'where':{'id':_0x106fc8[_0x3a1b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x12ba72,null))[_0x3a1b('0x41')](saveUpdates(_0x106fc8[_0x3a1b('0x4b')],null))[_0x3a1b('0x41')](respondWithResult(_0x12ba72,null))[_0x3a1b('0x45')](handleError(_0x12ba72,null));};exports[_0x3a1b('0x4d')]=function(_0x12beb7,_0x4f0b48,_0x190c85){var _0x543c39=require(_0x3a1b('0x4e'));var _0x5222cd=![];var _0x2c3228={};if(_0x12beb7['query'][_0x3a1b('0x30')]&&_0x12beb7[_0x3a1b('0x32')][_0x3a1b('0x30')]===_0x3a1b('0x4f')){_0x2c3228['uniqueid']=_0x12beb7[_0x3a1b('0x4c')]['id'];}else{_0x2c3228['id']=_0x12beb7[_0x3a1b('0x4c')]['id'];}return db['SquareRecording'][_0x3a1b('0x49')]({'where':_0x2c3228,'attributes':['id',_0x3a1b('0x50'),_0x3a1b('0x51')],'raw':!![]})[_0x3a1b('0x41')](handleEntityNotFound(_0x4f0b48,null))['then'](function(_0x4e64d7){if(_0x4e64d7){var _0x3ca74c=_0x4e64d7[_0x3a1b('0x50')];var _0x3c71d1=util[_0x3a1b('0x52')]('%s.cypher',_0x3ca74c);if(fs[_0x3a1b('0x53')](_0x3c71d1)){_0x5222cd=!![];return _0x543c39[_0x3a1b('0x54')](_0x3c71d1,_0x3ca74c,config[_0x3a1b('0x55')][_0x3a1b('0x56')])[_0x3a1b('0x41')](function(){return _0x4e64d7;});}return _0x4e64d7;}})['then'](function(_0x19030c){if(_0x19030c){var _0x229601=_0x19030c[_0x3a1b('0x50')];if(!fs[_0x3a1b('0x53')](_0x229601)){throw new db[(_0x3a1b('0x57'))][(_0x3a1b('0x58'))](_0x3a1b('0x59'));}if(_0x19030c['filename']){return _0x4f0b48[_0x3a1b('0x4d')](_0x229601,_0x19030c[_0x3a1b('0x51')]+path[_0x3a1b('0x5a')](_0x229601),function(){if(_0x5222cd){fs[_0x3a1b('0x5b')](_0x229601);}});}else{return _0x4f0b48[_0x3a1b('0x4d')](_0x229601,function(_0x4ada4c){if(_0x5222cd){fs[_0x3a1b('0x5b')](_0x229601);}});}}})[_0x3a1b('0x45')](function(_0x1de4ad){if(_0x1de4ad['message']===_0x3a1b('0x59')){_0x4f0b48['status'](0x194)[_0x3a1b('0x2a')]('Not\x20found');}else{return handleError(_0x4f0b48,null);}});};exports['destroy']=function(_0x581f79,_0x32fa26){return db['SquareRecording'][_0x3a1b('0x49')]({'where':{'id':_0x581f79['params']['id']}})['then'](function(_0x21f1e5){if(_[_0x3a1b('0x5c')](_0x21f1e5)){throw new ReferenceError(_0x3a1b('0x5d'));}return _0x21f1e5;})['then'](function(_0x4993ef){var _0x28dc71=_0x4993ef['savePath'];logger['info'](_0x3a1b('0x5e'),_0x28dc71);if(!_[_0x3a1b('0x5c')](_0x4993ef[_0x3a1b('0x50')])&&fs[_0x3a1b('0x53')](_0x28dc71)){logger[_0x3a1b('0x5f')]('File:\x20\x22'+_0x28dc71+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x28dc71);}_0x28dc71=_0x28dc71+'.cypher';if(!_[_0x3a1b('0x5c')](_0x4993ef[_0x3a1b('0x50')])&&fs[_0x3a1b('0x53')](_0x28dc71)){logger['info'](_0x3a1b('0x60')+_0x28dc71+_0x3a1b('0x61'));fs[_0x3a1b('0x62')](_0x28dc71);}return _0x4993ef;})[_0x3a1b('0x41')](function(_0x4767c8){if(!_0x4767c8)throw new InternalError();return _0x4767c8[_0x3a1b('0x25')]();})[_0x3a1b('0x41')](function(){_0x32fa26[_0x3a1b('0x1a')](0xcc)[_0x3a1b('0x1b')]();})['catch'](handleError(_0x32fa26,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 808f193..e800f70 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 _0x6f44=['bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','lodash','util','api','moment'];(function(_0x27c929,_0x2415c1){var _0x2ce266=function(_0x5bac63){while(--_0x5bac63){_0x27c929['push'](_0x27c929['shift']());}};_0x2ce266(++_0x2415c1);}(_0x6f44,0x1ea));var _0x46f4=function(_0x462aeb,_0x5046b5){_0x462aeb=_0x462aeb-0x0;var _0x3b9c83=_0x6f44[_0x462aeb];return _0x3b9c83;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var logger=require('../../config/logger')(_0x46f4('0x2'));var moment=require(_0x46f4('0x3'));var BPromise=require(_0x46f4('0x4'));var rp=require(_0x46f4('0x5'));var fs=require('fs');var path=require(_0x46f4('0x6'));var rimraf=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var attributes=require(_0x46f4('0x9'));module[_0x46f4('0xa')]=function(_0x57f1a9,_0x169a5a){return _0x57f1a9[_0x46f4('0xb')](_0x46f4('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62cf=['bluebird','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','moment'];(function(_0x588e1c,_0x20a98c){var _0x3c8ca2=function(_0x5580aa){while(--_0x5580aa){_0x588e1c['push'](_0x588e1c['shift']());}};_0x3c8ca2(++_0x20a98c);}(_0x62cf,0x81));var _0xf62c=function(_0x1c0d60,_0x986b23){_0x1c0d60=_0x1c0d60-0x0;var _0x1a2b13=_0x62cf[_0x1c0d60];return _0x1a2b13;};'use strict';var _=require(_0xf62c('0x0'));var util=require('util');var logger=require(_0xf62c('0x1'))('api');var moment=require(_0xf62c('0x2'));var BPromise=require(_0xf62c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf62c('0x4'));var config=require(_0xf62c('0x5'));var attributes=require(_0xf62c('0x6'));module[_0xf62c('0x7')]=function(_0x3604f0,_0x40487e){return _0x3604f0[_0xf62c('0x8')](_0xf62c('0x9'),attributes,{'tableName':_0xf62c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index abe06da..ad86681 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 _0x223d=['stringify','error','code','SquareRecording,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','options','raw','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0xe64353,_0x4e0a68){var _0x5df256=function(_0x280f33){while(--_0x280f33){_0xe64353['push'](_0xe64353['shift']());}};_0x5df256(++_0x4e0a68);}(_0x223d,0x1c7));var _0xd223=function(_0x5e7baf,_0x11000c){_0x5e7baf=_0x5e7baf-0x0;var _0x9b1443=_0x223d[_0x5e7baf];return _0x9b1443;};'use strict';var _=require('lodash');var util=require(_0xd223('0x0'));var moment=require(_0xd223('0x1'));var BPromise=require(_0xd223('0x2'));var rs=require(_0xd223('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd223('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd223('0x5'))(_0xd223('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd223('0x7')][_0xd223('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d56d0,_0x5bee02,_0x4e7b9f){return new BPromise(function(_0x413da4,_0x41d994){return client[_0xd223('0x9')](_0x4d56d0,_0x4e7b9f)['then'](function(_0x4e0cb2){logger[_0xd223('0xa')]('SquareRecording,\x20%s,\x20%s',_0x5bee02,'request\x20sent');logger[_0xd223('0xb')](_0xd223('0xc'),_0x5bee02,'request\x20sent',JSON[_0xd223('0xd')](_0x4e0cb2));if(_0x4e0cb2[_0xd223('0xe')]){if(_0x4e0cb2['error'][_0xd223('0xf')]===0x1f4){logger[_0xd223('0xe')](_0xd223('0x10'),_0x5bee02,_0x4e0cb2[_0xd223('0xe')][_0xd223('0x11')]);return _0x41d994(_0x4e0cb2['error']['message']);}logger[_0xd223('0xe')]('SquareRecording,\x20%s,\x20%s',_0x5bee02,_0x4e0cb2[_0xd223('0xe')][_0xd223('0x11')]);return _0x413da4(_0x4e0cb2[_0xd223('0xe')][_0xd223('0x11')]);}else{logger[_0xd223('0xa')](_0xd223('0x10'),_0x5bee02,_0xd223('0x12'));_0x413da4(_0x4e0cb2[_0xd223('0x13')][_0xd223('0x11')]);}})[_0xd223('0x14')](function(_0x3fcf6b){logger['error'](_0xd223('0x10'),_0x5bee02,_0x3fcf6b);_0x41d994(_0x3fcf6b);});});}exports[_0xd223('0x15')]=function(_0x57d96f){var _0x8edbc0=this;return new Promise(function(_0x4d3ad4,_0x5c2615){return db[_0xd223('0x16')]['create'](_0x57d96f['body'],{'raw':_0x57d96f['options']?_0x57d96f[_0xd223('0x17')][_0xd223('0x18')]===undefined?!![]:![]:!![]})[_0xd223('0x19')](function(_0x336343){logger[_0xd223('0xa')](_0xd223('0x15'),_0x57d96f);logger[_0xd223('0xb')]('CreateSquareRecording',_0x57d96f,JSON['stringify'](_0x336343));_0x4d3ad4(_0x336343);})[_0xd223('0x14')](function(_0x344f0c){logger[_0xd223('0xe')](_0xd223('0x15'),_0x344f0c[_0xd223('0x11')],_0x57d96f);_0x5c2615(_0x8edbc0[_0xd223('0xe')](0x1f4,_0x344f0c[_0xd223('0x11')]));});});}; \ No newline at end of file +var _0xb922=['jayson/promise','client','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','create','body','raw','then','info','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x14a4af,_0x125b3){var _0x4085bc=function(_0x1ea6d2){while(--_0x1ea6d2){_0x14a4af['push'](_0x14a4af['shift']());}};_0x4085bc(++_0x125b3);}(_0xb922,0x1c7));var _0x2b92=function(_0x4490f4,_0x150e06){_0x4490f4=_0x4490f4-0x0;var _0x3e2a76=_0xb922[_0x4490f4];return _0x3e2a76;};'use strict';var _=require(_0x2b92('0x0'));var util=require(_0x2b92('0x1'));var moment=require(_0x2b92('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b92('0x3'));var db=require(_0x2b92('0x4'))['db'];var utils=require(_0x2b92('0x5'));var logger=require(_0x2b92('0x6'))(_0x2b92('0x7'));var config=require(_0x2b92('0x8'));var jayson=require(_0x2b92('0x9'));var client=jayson[_0x2b92('0xa')][_0x2b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1334c6,_0xec936f,_0x3777c8){return new BPromise(function(_0x4602de,_0x101f81){return client[_0x2b92('0xc')](_0x1334c6,_0x3777c8)['then'](function(_0x3b67ef){logger['info'](_0x2b92('0xd'),_0xec936f,_0x2b92('0xe'));logger[_0x2b92('0xf')](_0x2b92('0x10'),_0xec936f,_0x2b92('0xe'),JSON[_0x2b92('0x11')](_0x3b67ef));if(_0x3b67ef[_0x2b92('0x12')]){if(_0x3b67ef['error']['code']===0x1f4){logger[_0x2b92('0x12')](_0x2b92('0xd'),_0xec936f,_0x3b67ef['error'][_0x2b92('0x13')]);return _0x101f81(_0x3b67ef[_0x2b92('0x12')][_0x2b92('0x13')]);}logger[_0x2b92('0x12')](_0x2b92('0xd'),_0xec936f,_0x3b67ef[_0x2b92('0x12')][_0x2b92('0x13')]);return _0x4602de(_0x3b67ef[_0x2b92('0x12')]['message']);}else{logger['info'](_0x2b92('0xd'),_0xec936f,_0x2b92('0xe'));_0x4602de(_0x3b67ef[_0x2b92('0x14')][_0x2b92('0x13')]);}})[_0x2b92('0x15')](function(_0x40458d){logger['error'](_0x2b92('0xd'),_0xec936f,_0x40458d);_0x101f81(_0x40458d);});});}exports[_0x2b92('0x16')]=function(_0x2ef408){var _0x213d51=this;return new Promise(function(_0xad5daa,_0x5dd37c){return db[_0x2b92('0x17')][_0x2b92('0x18')](_0x2ef408[_0x2b92('0x19')],{'raw':_0x2ef408['options']?_0x2ef408['options'][_0x2b92('0x1a')]===undefined?!![]:![]:!![]})[_0x2b92('0x1b')](function(_0x4fb94b){logger[_0x2b92('0x1c')](_0x2b92('0x16'),_0x2ef408);logger[_0x2b92('0xf')](_0x2b92('0x16'),_0x2ef408,JSON['stringify'](_0x4fb94b));_0xad5daa(_0x4fb94b);})['catch'](function(_0x1ab33b){logger[_0x2b92('0x12')](_0x2b92('0x16'),_0x1ab33b[_0x2b92('0x13')],_0x2ef408);_0x5dd37c(_0x213d51[_0x2b92('0x12')](0x1f4,_0x1ab33b[_0x2b92('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 17c714e..02f7c63 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x37441c,_0x483b9c){var _0x11661b=function(_0x5822c2){while(--_0x5822c2){_0x37441c['push'](_0x37441c['shift']());}};_0x11661b(++_0x483b9c);}(_0xb10b,0x12a));var _0xbb10=function(_0x425ea3,_0x26b830){_0x425ea3=_0x425ea3-0x0;var _0x54f159=_0xb10b[_0x425ea3];return _0x54f159;};'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 83f860f..a73621e 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 _0x036b=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x46b1d0,_0x39fff6){var _0x1b0552=function(_0xf09634){while(--_0xf09634){_0x46b1d0['push'](_0x46b1d0['shift']());}};_0x1b0552(++_0x39fff6);}(_0x036b,0x129));var _0xb036=function(_0x13d0ab,_0x44ad81){_0x13d0ab=_0x13d0ab-0x0;var _0x1b0c54=_0x036b[_0x13d0ab];return _0x1b0c54;};'use strict';var Sequelize=require(_0xb036('0x0'));module[_0xb036('0x1')]={'network':{'type':Sequelize[_0xb036('0x2')]},'network_script':{'type':Sequelize[_0xb036('0x2')]},'request':{'type':Sequelize[_0xb036('0x2')]},'channel':{'type':Sequelize[_0xb036('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb036('0x2')]},'uniqueid':{'type':Sequelize[_0xb036('0x2')]},'version':{'type':Sequelize[_0xb036('0x2')]},'callerid':{'type':Sequelize[_0xb036('0x2')]},'calleridname':{'type':Sequelize[_0xb036('0x2')]},'callingpres':{'type':Sequelize[_0xb036('0x2')]},'callingani2':{'type':Sequelize[_0xb036('0x2')]},'callington':{'type':Sequelize[_0xb036('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xb036('0x2')]},'rdnis':{'type':Sequelize[_0xb036('0x2')]},'context':{'type':Sequelize[_0xb036('0x2')]},'extension':{'type':Sequelize[_0xb036('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb036('0x2')]},'threadid':{'type':Sequelize[_0xb036('0x2')]},'project_name':{'type':Sequelize[_0xb036('0x2')]},'joinAt':{'type':Sequelize[_0xb036('0x3')]},'leaveAt':{'type':Sequelize[_0xb036('0x3')]},'bot':{'type':Sequelize[_0xb036('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xddec=['STRING','DATE','exports'];(function(_0x39c46e,_0x156daf){var _0x583479=function(_0x27ecfd){while(--_0x27ecfd){_0x39c46e['push'](_0x39c46e['shift']());}};_0x583479(++_0x156daf);}(_0xddec,0xe0));var _0xcdde=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xddec[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xcdde('0x0')]={'network':{'type':Sequelize[_0xcdde('0x1')]},'network_script':{'type':Sequelize[_0xcdde('0x1')]},'request':{'type':Sequelize[_0xcdde('0x1')]},'channel':{'type':Sequelize[_0xcdde('0x1')]},'language':{'type':Sequelize[_0xcdde('0x1')]},'type':{'type':Sequelize[_0xcdde('0x1')]},'uniqueid':{'type':Sequelize[_0xcdde('0x1')]},'version':{'type':Sequelize[_0xcdde('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xcdde('0x1')]},'callington':{'type':Sequelize[_0xcdde('0x1')]},'callingtns':{'type':Sequelize[_0xcdde('0x1')]},'dnid':{'type':Sequelize[_0xcdde('0x1')]},'rdnis':{'type':Sequelize[_0xcdde('0x1')]},'context':{'type':Sequelize[_0xcdde('0x1')]},'extension':{'type':Sequelize[_0xcdde('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xcdde('0x1')]},'accountcode':{'type':Sequelize[_0xcdde('0x1')]},'threadid':{'type':Sequelize[_0xcdde('0x1')]},'project_name':{'type':Sequelize[_0xcdde('0x1')]},'joinAt':{'type':Sequelize[_0xcdde('0x2')]},'leaveAt':{'type':Sequelize[_0xcdde('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index c4e8bbf..7769c6d 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 _0x49a3=['save','update','then','error','name','send','index','map','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x49a3,0x1b5));var _0x349a=function(_0x5d31b9,_0x2867f9){_0x5d31b9=_0x5d31b9-0x0;var _0x272793=_0x49a3[_0x5d31b9];return _0x272793;};'use strict';var emlformat=require(_0x349a('0x0'));var rimraf=require(_0x349a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x349a('0x2'));var rp=require(_0x349a('0x3'));var moment=require(_0x349a('0x4'));var BPromise=require(_0x349a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x349a('0x6'));var sox=require(_0x349a('0x7'));var csv=require(_0x349a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x349a('0x9'));var _=require(_0x349a('0xa'));var squel=require(_0x349a('0xb'));var crypto=require(_0x349a('0xc'));var jsforce=require(_0x349a('0xd'));var deskjs=require(_0x349a('0xe'));var toCsv=require(_0x349a('0x8'));var querystring=require(_0x349a('0xf'));var Papa=require(_0x349a('0x10'));var Redis=require(_0x349a('0x11'));var authService=require(_0x349a('0x12'));var qs=require(_0x349a('0x13'));var as=require(_0x349a('0x14'));var hardwareService=require(_0x349a('0x15'));var logger=require(_0x349a('0x16'))(_0x349a('0x17'));var utils=require(_0x349a('0x18'));var config=require(_0x349a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x349a('0x1a'))['db'];function respondWithStatusCode(_0x209279,_0x2fd25f){_0x2fd25f=_0x2fd25f||0xcc;return function(_0x46d434){if(_0x46d434){return _0x209279[_0x349a('0x1b')](_0x2fd25f);}return _0x209279[_0x349a('0x1c')](_0x2fd25f)['end']();};}function respondWithResult(_0x4383b4,_0x1a2966){_0x1a2966=_0x1a2966||0xc8;return function(_0x107bab){if(_0x107bab){return _0x4383b4['status'](_0x1a2966)[_0x349a('0x1d')](_0x107bab);}};}function respondWithFilteredResult(_0x22d249,_0x568fd3){return function(_0x479887){if(_0x479887){var _0x47c349=typeof _0x568fd3[_0x349a('0x1e')]===_0x349a('0x1f')&&typeof _0x568fd3[_0x349a('0x20')]===_0x349a('0x1f');var _0x25e2e7=_0x479887[_0x349a('0x21')];var _0x411170=_0x47c349?0x0:_0x568fd3[_0x349a('0x1e')];var _0xb4310b=_0x47c349?_0x479887['count']:_0x568fd3[_0x349a('0x1e')]+_0x568fd3[_0x349a('0x20')];var _0x4eea7b;if(_0xb4310b>=_0x25e2e7){_0xb4310b=_0x25e2e7;_0x4eea7b=0xc8;}else{_0x4eea7b=0xce;}_0x22d249['status'](_0x4eea7b);return _0x22d249[_0x349a('0x22')]('Content-Range',_0x411170+'-'+_0xb4310b+'/'+_0x25e2e7)[_0x349a('0x1d')](_0x479887);}return null;};}function patchUpdates(_0x339ed2){return function(_0x51e4ef){try{jsonpatch[_0x349a('0x23')](_0x51e4ef,_0x339ed2,!![]);}catch(_0x269259){return BPromise[_0x349a('0x24')](_0x269259);}return _0x51e4ef[_0x349a('0x25')]();};}function saveUpdates(_0x3addfb,_0x3784c5){return function(_0x3d23cf){if(_0x3d23cf){return _0x3d23cf[_0x349a('0x26')](_0x3addfb)[_0x349a('0x27')](function(_0x6f2341){return _0x6f2341;});}return null;};}function removeEntity(_0x26b8ee,_0x2b5600){return function(_0x51abad){if(_0x51abad){return _0x51abad['destroy']()[_0x349a('0x27')](function(){_0x26b8ee[_0x349a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29e86a,_0x527a70){return function(_0x1c0d69){if(!_0x1c0d69){_0x29e86a['sendStatus'](0x194);}return _0x1c0d69;};}function handleError(_0x51312e,_0x1862c2){_0x1862c2=_0x1862c2||0x1f4;return function(_0x2d0220){logger[_0x349a('0x28')](_0x2d0220['stack']);if(_0x2d0220[_0x349a('0x29')]){delete _0x2d0220[_0x349a('0x29')];}_0x51312e[_0x349a('0x1c')](_0x1862c2)[_0x349a('0x2a')](_0x2d0220);};}exports[_0x349a('0x2b')]=function(_0x279fc5,_0x34c220){var _0x544ada={},_0x5b99df={},_0x3a1592={'count':0x0,'rows':[]};var _0x5c96d8=_[_0x349a('0x2c')](db['SquareReport'][_0x349a('0x2d')],function(_0x5444ef){return{'name':_0x5444ef['fieldName'],'type':_0x5444ef[_0x349a('0x2e')][_0x349a('0x2f')]};});_0x5b99df[_0x349a('0x30')]=_['map'](_0x5c96d8,_0x349a('0x29'));_0x5b99df['query']=_[_0x349a('0x31')](_0x279fc5['query']);_0x5b99df[_0x349a('0x32')]=_[_0x349a('0x33')](_0x5b99df[_0x349a('0x30')],_0x5b99df[_0x349a('0x34')]);_0x544ada[_0x349a('0x35')]=_[_0x349a('0x33')](_0x5b99df[_0x349a('0x30')],qs[_0x349a('0x36')](_0x279fc5['query'][_0x349a('0x36')]));_0x544ada[_0x349a('0x35')]=_0x544ada[_0x349a('0x35')][_0x349a('0x37')]?_0x544ada[_0x349a('0x35')]:_0x5b99df[_0x349a('0x30')];if(!_0x279fc5[_0x349a('0x34')][_0x349a('0x38')](_0x349a('0x39'))){_0x544ada[_0x349a('0x20')]=qs[_0x349a('0x20')](_0x279fc5[_0x349a('0x34')][_0x349a('0x20')]);_0x544ada[_0x349a('0x1e')]=qs[_0x349a('0x1e')](_0x279fc5[_0x349a('0x34')]['offset']);}_0x544ada[_0x349a('0x3a')]=qs[_0x349a('0x3b')](_0x279fc5[_0x349a('0x34')]['sort']);_0x544ada[_0x349a('0x3c')]=qs[_0x349a('0x32')](_[_0x349a('0x3d')](_0x279fc5['query'],_0x5b99df['filters']),_0x5c96d8);if(_0x279fc5['query'][_0x349a('0x3e')]){_0x544ada[_0x349a('0x3c')]=_[_0x349a('0x3f')](_0x544ada[_0x349a('0x3c')],{'$or':_[_0x349a('0x2c')](_0x5c96d8,function(_0x5f2a49){if(_0x5f2a49['type']!==_0x349a('0x40')){var _0x20469b={};_0x20469b[_0x5f2a49['name']]={'$like':'%'+_0x279fc5[_0x349a('0x34')]['filter']+'%'};return _0x20469b;}})});}_0x544ada=_[_0x349a('0x3f')]({},_0x544ada,_0x279fc5[_0x349a('0x41')]);var _0x5df5fd={'where':_0x544ada['where']};return db[_0x349a('0x42')][_0x349a('0x21')](_0x5df5fd)[_0x349a('0x27')](function(_0x433384){_0x3a1592[_0x349a('0x21')]=_0x433384;if(_0x279fc5[_0x349a('0x34')][_0x349a('0x43')]){_0x544ada[_0x349a('0x44')]=[{'all':!![]}];}return db['SquareReport'][_0x349a('0x45')](_0x544ada);})[_0x349a('0x27')](function(_0x365eb3){_0x3a1592[_0x349a('0x46')]=_0x365eb3;return _0x3a1592;})[_0x349a('0x27')](respondWithFilteredResult(_0x34c220,_0x544ada))[_0x349a('0x47')](handleError(_0x34c220,null));};exports[_0x349a('0x48')]=function(_0xaae171,_0x1f6b40){var _0x6aee9e={'raw':!![],'where':{'id':_0xaae171[_0x349a('0x49')]['id']}},_0x3fcfb4={};_0x3fcfb4[_0x349a('0x30')]=_[_0x349a('0x31')](db['SquareReport'][_0x349a('0x2d')]);_0x3fcfb4[_0x349a('0x34')]=_[_0x349a('0x31')](_0xaae171[_0x349a('0x34')]);_0x3fcfb4[_0x349a('0x32')]=_[_0x349a('0x33')](_0x3fcfb4[_0x349a('0x30')],_0x3fcfb4[_0x349a('0x34')]);_0x6aee9e[_0x349a('0x35')]=_[_0x349a('0x33')](_0x3fcfb4[_0x349a('0x30')],qs[_0x349a('0x36')](_0xaae171['query'][_0x349a('0x36')]));_0x6aee9e[_0x349a('0x35')]=_0x6aee9e['attributes'][_0x349a('0x37')]?_0x6aee9e[_0x349a('0x35')]:_0x3fcfb4[_0x349a('0x30')];if(_0xaae171[_0x349a('0x34')][_0x349a('0x43')]){_0x6aee9e[_0x349a('0x44')]=[{'all':!![]}];}_0x6aee9e=_[_0x349a('0x3f')]({},_0x6aee9e,_0xaae171['options']);return db['SquareReport'][_0x349a('0x4a')](_0x6aee9e)[_0x349a('0x27')](handleEntityNotFound(_0x1f6b40,null))[_0x349a('0x27')](respondWithResult(_0x1f6b40,null))['catch'](handleError(_0x1f6b40,null));};exports[_0x349a('0x4b')]=function(_0x128386,_0x359c09){return db[_0x349a('0x42')][_0x349a('0x4b')](_0x128386[_0x349a('0x4c')],{})[_0x349a('0x27')](respondWithResult(_0x359c09,0xc9))[_0x349a('0x47')](handleError(_0x359c09,null));};exports[_0x349a('0x26')]=function(_0x2d66f9,_0x3614a5){if(_0x2d66f9['body']['id']){delete _0x2d66f9[_0x349a('0x4c')]['id'];}return db[_0x349a('0x42')]['find']({'where':{'id':_0x2d66f9[_0x349a('0x49')]['id']}})[_0x349a('0x27')](handleEntityNotFound(_0x3614a5,null))[_0x349a('0x27')](saveUpdates(_0x2d66f9['body'],null))['then'](respondWithResult(_0x3614a5,null))[_0x349a('0x47')](handleError(_0x3614a5,null));};exports[_0x349a('0x4d')]=function(_0x4a920a,_0xbc9d4){return db[_0x349a('0x42')][_0x349a('0x4a')]({'where':{'id':_0x4a920a[_0x349a('0x49')]['id']}})[_0x349a('0x27')](handleEntityNotFound(_0xbc9d4,null))[_0x349a('0x27')](removeEntity(_0xbc9d4,null))[_0x349a('0x47')](handleError(_0xbc9d4,null));};exports[_0x349a('0x4e')]=function(_0x48903c,_0x3e3f71){return db[_0x349a('0x42')]['describe']()['then'](respondWithResult(_0x3e3f71,null))[_0x349a('0x47')](handleError(_0x3e3f71,null));}; \ No newline at end of file +var _0x85c3=['update','then','end','error','stack','name','index','map','SquareReport','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','merge','filter','options','where','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','describe','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x11f564,_0x4b5f80){var _0x2ff521=function(_0x5ee85e){while(--_0x5ee85e){_0x11f564['push'](_0x11f564['shift']());}};_0x2ff521(++_0x4b5f80);}(_0x85c3,0x1d1));var _0x385c=function(_0x185962,_0x186273){_0x185962=_0x185962-0x0;var _0xe3b920=_0x85c3[_0x185962];return _0xe3b920;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x385c('0x0'));var rp=require('request-promise');var moment=require(_0x385c('0x1'));var BPromise=require(_0x385c('0x2'));var Mustache=require('mustache');var util=require(_0x385c('0x3'));var path=require('path');var sox=require(_0x385c('0x4'));var csv=require('to-csv');var ejs=require(_0x385c('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x385c('0x6'));var squel=require(_0x385c('0x7'));var crypto=require(_0x385c('0x8'));var jsforce=require(_0x385c('0x9'));var deskjs=require(_0x385c('0xa'));var toCsv=require(_0x385c('0xb'));var querystring=require(_0x385c('0xc'));var Papa=require(_0x385c('0xd'));var Redis=require(_0x385c('0xe'));var authService=require(_0x385c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x385c('0x10'));var hardwareService=require(_0x385c('0x11'));var logger=require(_0x385c('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x385c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbebfe1,_0x10daa4){_0x10daa4=_0x10daa4||0xcc;return function(_0x5438b0){if(_0x5438b0){return _0xbebfe1[_0x385c('0x14')](_0x10daa4);}return _0xbebfe1['status'](_0x10daa4)['end']();};}function respondWithResult(_0x3ae717,_0x1e1934){_0x1e1934=_0x1e1934||0xc8;return function(_0x5e687c){if(_0x5e687c){return _0x3ae717[_0x385c('0x15')](_0x1e1934)[_0x385c('0x16')](_0x5e687c);}};}function respondWithFilteredResult(_0x462ec3,_0x4447a4){return function(_0x219055){if(_0x219055){var _0x5d8878=typeof _0x4447a4[_0x385c('0x17')]===_0x385c('0x18')&&typeof _0x4447a4[_0x385c('0x19')]===_0x385c('0x18');var _0x2e1545=_0x219055['count'];var _0x33c1b5=_0x5d8878?0x0:_0x4447a4[_0x385c('0x17')];var _0x1fd2b7=_0x5d8878?_0x219055[_0x385c('0x1a')]:_0x4447a4[_0x385c('0x17')]+_0x4447a4[_0x385c('0x19')];var _0x3538a7;if(_0x1fd2b7>=_0x2e1545){_0x1fd2b7=_0x2e1545;_0x3538a7=0xc8;}else{_0x3538a7=0xce;}_0x462ec3[_0x385c('0x15')](_0x3538a7);return _0x462ec3[_0x385c('0x1b')](_0x385c('0x1c'),_0x33c1b5+'-'+_0x1fd2b7+'/'+_0x2e1545)[_0x385c('0x16')](_0x219055);}return null;};}function patchUpdates(_0x5a55bd){return function(_0xcc6aa9){try{jsonpatch[_0x385c('0x1d')](_0xcc6aa9,_0x5a55bd,!![]);}catch(_0x3face3){return BPromise[_0x385c('0x1e')](_0x3face3);}return _0xcc6aa9[_0x385c('0x1f')]();};}function saveUpdates(_0x9f1e89,_0x1141c9){return function(_0x2ff56f){if(_0x2ff56f){return _0x2ff56f[_0x385c('0x20')](_0x9f1e89)[_0x385c('0x21')](function(_0x5c51cc){return _0x5c51cc;});}return null;};}function removeEntity(_0x5dcd6e,_0x4abca8){return function(_0x419ef4){if(_0x419ef4){return _0x419ef4['destroy']()['then'](function(){_0x5dcd6e['status'](0xcc)[_0x385c('0x22')]();});}};}function handleEntityNotFound(_0x315891,_0x15ca63){return function(_0x491fb3){if(!_0x491fb3){_0x315891[_0x385c('0x14')](0x194);}return _0x491fb3;};}function handleError(_0x45d04a,_0x36af60){_0x36af60=_0x36af60||0x1f4;return function(_0x4a65e6){logger[_0x385c('0x23')](_0x4a65e6[_0x385c('0x24')]);if(_0x4a65e6[_0x385c('0x25')]){delete _0x4a65e6['name'];}_0x45d04a[_0x385c('0x15')](_0x36af60)['send'](_0x4a65e6);};}exports[_0x385c('0x26')]=function(_0x180c22,_0x18e2a6){var _0x99d27c={},_0x2b6749={},_0x4d7a9d={'count':0x0,'rows':[]};var _0xc4c49a=_[_0x385c('0x27')](db[_0x385c('0x28')][_0x385c('0x29')],function(_0x465e0e){return{'name':_0x465e0e['fieldName'],'type':_0x465e0e[_0x385c('0x2a')][_0x385c('0x2b')]};});_0x2b6749[_0x385c('0x2c')]=_['map'](_0xc4c49a,'name');_0x2b6749[_0x385c('0x2d')]=_[_0x385c('0x2e')](_0x180c22[_0x385c('0x2d')]);_0x2b6749['filters']=_['intersection'](_0x2b6749['model'],_0x2b6749[_0x385c('0x2d')]);_0x99d27c[_0x385c('0x2f')]=_[_0x385c('0x30')](_0x2b6749['model'],qs['fields'](_0x180c22[_0x385c('0x2d')][_0x385c('0x31')]));_0x99d27c[_0x385c('0x2f')]=_0x99d27c[_0x385c('0x2f')]['length']?_0x99d27c[_0x385c('0x2f')]:_0x2b6749[_0x385c('0x2c')];if(!_0x180c22[_0x385c('0x2d')]['hasOwnProperty'](_0x385c('0x32'))){_0x99d27c['limit']=qs[_0x385c('0x19')](_0x180c22[_0x385c('0x2d')][_0x385c('0x19')]);_0x99d27c[_0x385c('0x17')]=qs[_0x385c('0x17')](_0x180c22[_0x385c('0x2d')]['offset']);}_0x99d27c[_0x385c('0x33')]=qs['sort'](_0x180c22[_0x385c('0x2d')][_0x385c('0x34')]);_0x99d27c['where']=qs[_0x385c('0x35')](_[_0x385c('0x36')](_0x180c22[_0x385c('0x2d')],_0x2b6749['filters']),_0xc4c49a);if(_0x180c22[_0x385c('0x2d')]['filter']){_0x99d27c['where']=_[_0x385c('0x37')](_0x99d27c['where'],{'$or':_[_0x385c('0x27')](_0xc4c49a,function(_0x381dd2){if(_0x381dd2[_0x385c('0x2a')]!=='VIRTUAL'){var _0x560aa2={};_0x560aa2[_0x381dd2['name']]={'$like':'%'+_0x180c22[_0x385c('0x2d')][_0x385c('0x38')]+'%'};return _0x560aa2;}})});}_0x99d27c=_[_0x385c('0x37')]({},_0x99d27c,_0x180c22[_0x385c('0x39')]);var _0x5698e8={'where':_0x99d27c[_0x385c('0x3a')]};return db[_0x385c('0x28')][_0x385c('0x1a')](_0x5698e8)[_0x385c('0x21')](function(_0x5831e5){_0x4d7a9d['count']=_0x5831e5;if(_0x180c22[_0x385c('0x2d')][_0x385c('0x3b')]){_0x99d27c[_0x385c('0x3c')]=[{'all':!![]}];}return db[_0x385c('0x28')]['findAll'](_0x99d27c);})[_0x385c('0x21')](function(_0x401eea){_0x4d7a9d[_0x385c('0x3d')]=_0x401eea;return _0x4d7a9d;})['then'](respondWithFilteredResult(_0x18e2a6,_0x99d27c))[_0x385c('0x3e')](handleError(_0x18e2a6,null));};exports[_0x385c('0x3f')]=function(_0x11ba34,_0xede520){var _0x350ed6={'raw':!![],'where':{'id':_0x11ba34[_0x385c('0x40')]['id']}},_0x2ef03b={};_0x2ef03b['model']=_[_0x385c('0x2e')](db[_0x385c('0x28')]['rawAttributes']);_0x2ef03b[_0x385c('0x2d')]=_['keys'](_0x11ba34[_0x385c('0x2d')]);_0x2ef03b[_0x385c('0x35')]=_[_0x385c('0x30')](_0x2ef03b['model'],_0x2ef03b[_0x385c('0x2d')]);_0x350ed6['attributes']=_['intersection'](_0x2ef03b[_0x385c('0x2c')],qs['fields'](_0x11ba34['query'][_0x385c('0x31')]));_0x350ed6[_0x385c('0x2f')]=_0x350ed6[_0x385c('0x2f')][_0x385c('0x41')]?_0x350ed6['attributes']:_0x2ef03b[_0x385c('0x2c')];if(_0x11ba34[_0x385c('0x2d')][_0x385c('0x3b')]){_0x350ed6[_0x385c('0x3c')]=[{'all':!![]}];}_0x350ed6=_['merge']({},_0x350ed6,_0x11ba34['options']);return db[_0x385c('0x28')][_0x385c('0x42')](_0x350ed6)[_0x385c('0x21')](handleEntityNotFound(_0xede520,null))[_0x385c('0x21')](respondWithResult(_0xede520,null))[_0x385c('0x3e')](handleError(_0xede520,null));};exports[_0x385c('0x43')]=function(_0x3d483e,_0x16ce38){return db[_0x385c('0x28')][_0x385c('0x43')](_0x3d483e[_0x385c('0x44')],{})[_0x385c('0x21')](respondWithResult(_0x16ce38,0xc9))[_0x385c('0x3e')](handleError(_0x16ce38,null));};exports[_0x385c('0x20')]=function(_0x5ea8be,_0x1c6532){if(_0x5ea8be[_0x385c('0x44')]['id']){delete _0x5ea8be[_0x385c('0x44')]['id'];}return db[_0x385c('0x28')][_0x385c('0x42')]({'where':{'id':_0x5ea8be[_0x385c('0x40')]['id']}})[_0x385c('0x21')](handleEntityNotFound(_0x1c6532,null))['then'](saveUpdates(_0x5ea8be[_0x385c('0x44')],null))[_0x385c('0x21')](respondWithResult(_0x1c6532,null))['catch'](handleError(_0x1c6532,null));};exports[_0x385c('0x45')]=function(_0x251392,_0xc2da4){return db[_0x385c('0x28')][_0x385c('0x42')]({'where':{'id':_0x251392[_0x385c('0x40')]['id']}})[_0x385c('0x21')](handleEntityNotFound(_0xc2da4,null))[_0x385c('0x21')](removeEntity(_0xc2da4,null))[_0x385c('0x3e')](handleError(_0xc2da4,null));};exports[_0x385c('0x46')]=function(_0x10e275,_0xd650e){return db[_0x385c('0x28')][_0x385c('0x46')]()[_0x385c('0x21')](respondWithResult(_0xd650e,null))[_0x385c('0x3e')](handleError(_0xd650e,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 841563b..d98e244 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 _0x05a7=['SquareReport','report_square','uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports'];(function(_0x3997d4,_0x1b5e4c){var _0x1df222=function(_0x49f56c){while(--_0x49f56c){_0x3997d4['push'](_0x3997d4['shift']());}};_0x1df222(++_0x1b5e4c);}(_0x05a7,0x130));var _0x705a=function(_0x18e875,_0x54fff7){_0x18e875=_0x18e875-0x0;var _0x1643c6=_0x05a7[_0x18e875];return _0x1643c6;};'use strict';var _=require(_0x705a('0x0'));var util=require(_0x705a('0x1'));var logger=require(_0x705a('0x2'))(_0x705a('0x3'));var moment=require(_0x705a('0x4'));var BPromise=require('bluebird');var rp=require(_0x705a('0x5'));var fs=require('fs');var path=require(_0x705a('0x6'));var rimraf=require(_0x705a('0x7'));var config=require(_0x705a('0x8'));var attributes=require(_0x705a('0x9'));module[_0x705a('0xa')]=function(_0x496456,_0x2ebb66){return _0x496456['define'](_0x705a('0xb'),attributes,{'tableName':_0x705a('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x705a('0xd'),'project_name']},{'name':_0x705a('0xe'),'fields':[_0x705a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5db=['define','SquareReport','report_square','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x4e4253,_0x411609){var _0x52767f=function(_0x13750d){while(--_0x13750d){_0x4e4253['push'](_0x4e4253['shift']());}};_0x52767f(++_0x411609);}(_0xd5db,0x197));var _0xbd5d=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xd5db[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xbd5d('0x0'));var util=require('util');var logger=require(_0xbd5d('0x1'))(_0xbd5d('0x2'));var moment=require(_0xbd5d('0x3'));var BPromise=require(_0xbd5d('0x4'));var rp=require(_0xbd5d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd5d('0x6'));var config=require(_0xbd5d('0x7'));var attributes=require('./squareReport.attributes');module[_0xbd5d('0x8')]=function(_0x1fc157,_0x5c1874){return _0x1fc157[_0xbd5d('0x9')](_0xbd5d('0xa'),attributes,{'tableName':_0xbd5d('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xbd5d('0xc'),'project_name']},{'name':'leaveAt','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 ccecd9c..524489c 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 _0xb790=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update'];(function(_0x2e2292,_0x1891b8){var _0x4f77ab=function(_0x3e5cb6){while(--_0x3e5cb6){_0x2e2292['push'](_0x2e2292['shift']());}};_0x4f77ab(++_0x1891b8);}(_0xb790,0xb2));var _0x0b79=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0xb790[_0x367336];return _0x3423a7;};'use strict';var _=require(_0x0b79('0x0'));var util=require(_0x0b79('0x1'));var moment=require(_0x0b79('0x2'));var BPromise=require(_0x0b79('0x3'));var rs=require(_0x0b79('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b79('0x5'))['db'];var utils=require(_0x0b79('0x6'));var logger=require(_0x0b79('0x7'))(_0x0b79('0x8'));var config=require(_0x0b79('0x9'));var jayson=require(_0x0b79('0xa'));var client=jayson[_0x0b79('0xb')][_0x0b79('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x300ff2,_0x33c7cc,_0x2fe37a){return new BPromise(function(_0x3fc516,_0x50be4d){return client['request'](_0x300ff2,_0x2fe37a)[_0x0b79('0xd')](function(_0x5e57ff){logger[_0x0b79('0xe')](_0x0b79('0xf'),_0x33c7cc,'request\x20sent');logger[_0x0b79('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x33c7cc,'request\x20sent',JSON[_0x0b79('0x11')](_0x5e57ff));if(_0x5e57ff[_0x0b79('0x12')]){if(_0x5e57ff[_0x0b79('0x12')][_0x0b79('0x13')]===0x1f4){logger[_0x0b79('0x12')](_0x0b79('0xf'),_0x33c7cc,_0x5e57ff[_0x0b79('0x12')][_0x0b79('0x14')]);return _0x50be4d(_0x5e57ff[_0x0b79('0x12')][_0x0b79('0x14')]);}logger[_0x0b79('0x12')]('SquareReport,\x20%s,\x20%s',_0x33c7cc,_0x5e57ff[_0x0b79('0x12')][_0x0b79('0x14')]);return _0x3fc516(_0x5e57ff[_0x0b79('0x12')][_0x0b79('0x14')]);}else{logger[_0x0b79('0xe')](_0x0b79('0xf'),_0x33c7cc,_0x0b79('0x15'));_0x3fc516(_0x5e57ff[_0x0b79('0x16')][_0x0b79('0x14')]);}})[_0x0b79('0x17')](function(_0x4a4084){logger[_0x0b79('0x12')](_0x0b79('0xf'),_0x33c7cc,_0x4a4084);_0x50be4d(_0x4a4084);});});}exports[_0x0b79('0x18')]=function(_0xd81a5b){var _0x250355=this;return new Promise(function(_0x48f374,_0x5cf4f7){return db['SquareReport'][_0x0b79('0x19')](_0xd81a5b[_0x0b79('0x1a')],{'raw':_0xd81a5b[_0x0b79('0x1b')]?_0xd81a5b[_0x0b79('0x1b')][_0x0b79('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x46392f){logger['info']('CreateSquareReport',_0xd81a5b);logger[_0x0b79('0x10')](_0x0b79('0x18'),_0xd81a5b,JSON[_0x0b79('0x11')](_0x46392f));_0x48f374(_0x46392f);})[_0x0b79('0x17')](function(_0xd86c3c){logger['error'](_0x0b79('0x18'),_0xd86c3c[_0x0b79('0x14')],_0xd81a5b);_0x5cf4f7(_0x250355['error'](0x1f4,_0xd86c3c[_0x0b79('0x14')]));});});};exports[_0x0b79('0x1d')]=function(_0x3e0ebf){var _0x1c6a96=this;return new Promise(function(_0x408cc2,_0x5d58b5){return db[_0x0b79('0x1e')][_0x0b79('0x1f')](_0x3e0ebf[_0x0b79('0x1a')],{'raw':_0x3e0ebf['options']?_0x3e0ebf['options'][_0x0b79('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0ebf[_0x0b79('0x1b')]?_0x3e0ebf[_0x0b79('0x1b')][_0x0b79('0x20')]||null:null,'attributes':_0x3e0ebf[_0x0b79('0x1b')]?_0x3e0ebf[_0x0b79('0x1b')][_0x0b79('0x21')]||null:null,'limit':_0x3e0ebf[_0x0b79('0x1b')]?_0x3e0ebf[_0x0b79('0x1b')][_0x0b79('0x22')]||null:null})[_0x0b79('0xd')](function(_0x703cff){logger[_0x0b79('0xe')](_0x0b79('0x1d'),_0x3e0ebf);logger[_0x0b79('0x10')](_0x0b79('0x1d'),_0x3e0ebf,JSON[_0x0b79('0x11')](_0x703cff));_0x408cc2(_0x703cff);})[_0x0b79('0x17')](function(_0x22cbd7){logger[_0x0b79('0x12')](_0x0b79('0x1d'),_0x22cbd7[_0x0b79('0x14')],_0x3e0ebf);_0x5d58b5(_0x1c6a96[_0x0b79('0x12')](0x1f4,_0x22cbd7[_0x0b79('0x14')]));});});}; \ No newline at end of file +var _0xb1e4=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SquareReport','create','body','options','raw','CreateSquareReport','debug','where','attributes','limit','UpdateSquareReport','lodash','util'];(function(_0x2fdaca,_0x1333a7){var _0x3028a6=function(_0x4952dc){while(--_0x4952dc){_0x2fdaca['push'](_0x2fdaca['shift']());}};_0x3028a6(++_0x1333a7);}(_0xb1e4,0x1da));var _0x4b1e=function(_0x1f9cca,_0x30cebc){_0x1f9cca=_0x1f9cca-0x0;var _0x5c03c3=_0xb1e4[_0x1f9cca];return _0x5c03c3;};'use strict';var _=require(_0x4b1e('0x0'));var util=require(_0x4b1e('0x1'));var moment=require(_0x4b1e('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b1e('0x3'));var fs=require('fs');var Redis=require(_0x4b1e('0x4'));var db=require(_0x4b1e('0x5'))['db'];var utils=require(_0x4b1e('0x6'));var logger=require(_0x4b1e('0x7'))(_0x4b1e('0x8'));var config=require(_0x4b1e('0x9'));var jayson=require(_0x4b1e('0xa'));var client=jayson[_0x4b1e('0xb')][_0x4b1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5df5d2,_0x272bd1,_0x42be1a){return new BPromise(function(_0x378a51,_0x53a13c){return client[_0x4b1e('0xd')](_0x5df5d2,_0x42be1a)[_0x4b1e('0xe')](function(_0x29e90e){logger[_0x4b1e('0xf')](_0x4b1e('0x10'),_0x272bd1,_0x4b1e('0x11'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x272bd1,_0x4b1e('0x11'),JSON[_0x4b1e('0x12')](_0x29e90e));if(_0x29e90e[_0x4b1e('0x13')]){if(_0x29e90e[_0x4b1e('0x13')]['code']===0x1f4){logger[_0x4b1e('0x13')](_0x4b1e('0x10'),_0x272bd1,_0x29e90e[_0x4b1e('0x13')]['message']);return _0x53a13c(_0x29e90e[_0x4b1e('0x13')][_0x4b1e('0x14')]);}logger[_0x4b1e('0x13')](_0x4b1e('0x10'),_0x272bd1,_0x29e90e['error'][_0x4b1e('0x14')]);return _0x378a51(_0x29e90e['error']['message']);}else{logger[_0x4b1e('0xf')](_0x4b1e('0x10'),_0x272bd1,_0x4b1e('0x11'));_0x378a51(_0x29e90e[_0x4b1e('0x15')][_0x4b1e('0x14')]);}})[_0x4b1e('0x16')](function(_0x382027){logger[_0x4b1e('0x13')](_0x4b1e('0x10'),_0x272bd1,_0x382027);_0x53a13c(_0x382027);});});}exports['CreateSquareReport']=function(_0x2b4d6f){var _0x384b64=this;return new Promise(function(_0x5974f1,_0x2329fb){return db[_0x4b1e('0x17')][_0x4b1e('0x18')](_0x2b4d6f[_0x4b1e('0x19')],{'raw':_0x2b4d6f[_0x4b1e('0x1a')]?_0x2b4d6f['options'][_0x4b1e('0x1b')]===undefined?!![]:![]:!![]})[_0x4b1e('0xe')](function(_0x1998db){logger[_0x4b1e('0xf')](_0x4b1e('0x1c'),_0x2b4d6f);logger[_0x4b1e('0x1d')](_0x4b1e('0x1c'),_0x2b4d6f,JSON['stringify'](_0x1998db));_0x5974f1(_0x1998db);})[_0x4b1e('0x16')](function(_0x18fb6d){logger[_0x4b1e('0x13')](_0x4b1e('0x1c'),_0x18fb6d[_0x4b1e('0x14')],_0x2b4d6f);_0x2329fb(_0x384b64[_0x4b1e('0x13')](0x1f4,_0x18fb6d[_0x4b1e('0x14')]));});});};exports['UpdateSquareReport']=function(_0x446bd3){var _0x44b2b5=this;return new Promise(function(_0x1de853,_0x31adce){return db[_0x4b1e('0x17')]['update'](_0x446bd3['body'],{'raw':_0x446bd3['options']?_0x446bd3[_0x4b1e('0x1a')][_0x4b1e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x446bd3[_0x4b1e('0x1a')]?_0x446bd3[_0x4b1e('0x1a')][_0x4b1e('0x1e')]||null:null,'attributes':_0x446bd3[_0x4b1e('0x1a')]?_0x446bd3['options'][_0x4b1e('0x1f')]||null:null,'limit':_0x446bd3[_0x4b1e('0x1a')]?_0x446bd3[_0x4b1e('0x1a')][_0x4b1e('0x20')]||null:null})['then'](function(_0x521abf){logger[_0x4b1e('0xf')](_0x4b1e('0x21'),_0x446bd3);logger[_0x4b1e('0x1d')](_0x4b1e('0x21'),_0x446bd3,JSON[_0x4b1e('0x12')](_0x521abf));_0x1de853(_0x521abf);})[_0x4b1e('0x16')](function(_0x455679){logger[_0x4b1e('0x13')](_0x4b1e('0x21'),_0x455679[_0x4b1e('0x14')],_0x446bd3);_0x31adce(_0x44b2b5[_0x4b1e('0x13')](0x1f4,_0x455679['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index f740ae9..5f70b0b 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 _0x5cef=['Router','fs-extra','../../components/auth/service','./squareReportDetail.controller','get','/describe','show','post','isAuthenticated','put','/:id','delete','destroy','exports','util','path','express'];(function(_0x447fdd,_0x21f753){var _0x3075e0=function(_0x337fb6){while(--_0x337fb6){_0x447fdd['push'](_0x447fdd['shift']());}};_0x3075e0(++_0x21f753);}(_0x5cef,0x195));var _0xf5ce=function(_0x50b7c7,_0x2df76b){_0x50b7c7=_0x50b7c7-0x0;var _0x2005c5=_0x5cef[_0x50b7c7];return _0x2005c5;};'use strict';var multer=require('multer');var util=require(_0xf5ce('0x0'));var path=require(_0xf5ce('0x1'));var timeout=require('connect-timeout');var express=require(_0xf5ce('0x2'));var router=express[_0xf5ce('0x3')]();var fs_extra=require(_0xf5ce('0x4'));var auth=require(_0xf5ce('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5ce('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf5ce('0x7')](_0xf5ce('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xf5ce('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xf5ce('0x9')]);router[_0xf5ce('0xa')]('/',auth[_0xf5ce('0xb')](),controller['create']);router[_0xf5ce('0xc')](_0xf5ce('0xd'),auth[_0xf5ce('0xb')](),controller['update']);router[_0xf5ce('0xe')](_0xf5ce('0xd'),auth['isAuthenticated'](),controller[_0xf5ce('0xf')]);module[_0xf5ce('0x10')]=router; \ No newline at end of file +var _0x72b9=['update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x366777,_0x5449ad){var _0x35f267=function(_0x402d54){while(--_0x402d54){_0x366777['push'](_0x366777['shift']());}};_0x35f267(++_0x5449ad);}(_0x72b9,0xd6));var _0x972b=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0x72b9[_0x208505];return _0x1a985f;};'use strict';var multer=require(_0x972b('0x0'));var util=require(_0x972b('0x1'));var path=require('path');var timeout=require(_0x972b('0x2'));var express=require('express');var router=express[_0x972b('0x3')]();var fs_extra=require(_0x972b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x972b('0x5'));var config=require(_0x972b('0x6'));var controller=require(_0x972b('0x7'));router[_0x972b('0x8')]('/',auth[_0x972b('0x9')](),controller[_0x972b('0xa')]);router[_0x972b('0x8')](_0x972b('0xb'),auth[_0x972b('0x9')](),controller[_0x972b('0xc')]);router[_0x972b('0x8')](_0x972b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x972b('0xe')]('/',auth[_0x972b('0x9')](),controller[_0x972b('0xf')]);router[_0x972b('0x10')](_0x972b('0xd'),auth[_0x972b('0x9')](),controller[_0x972b('0x11')]);router[_0x972b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x972b('0x13')]);module[_0x972b('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 265d041..26f3aa9 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 _0xd4ac=['TEXT','sequelize','exports','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd4ac,0xa5));var _0xcd4a=function(_0x55b48f,_0x1bbf8a){_0x55b48f=_0x55b48f-0x0;var _0x2450b0=_0xd4ac[_0x55b48f];return _0x2450b0;};'use strict';var Sequelize=require(_0xcd4a('0x0'));module[_0xcd4a('0x1')]={'uniqueid':{'type':Sequelize[_0xcd4a('0x2')]},'node':{'type':Sequelize[_0xcd4a('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xcd4a('0x3')]},'project_name':{'type':Sequelize[_0xcd4a('0x2')]},'callerid':{'type':Sequelize[_0xcd4a('0x2')]}}; \ No newline at end of file +var _0x180d=['exports','STRING','TEXT','sequelize'];(function(_0x114067,_0x41a5dd){var _0x184132=function(_0x9b373b){while(--_0x9b373b){_0x114067['push'](_0x114067['shift']());}};_0x184132(++_0x41a5dd);}(_0x180d,0xd3));var _0xd180=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x180d[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xd180('0x0'));module[_0xd180('0x1')]={'uniqueid':{'type':Sequelize[_0xd180('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xd180('0x2')]},'data':{'type':Sequelize[_0xd180('0x3')]},'project_name':{'type':Sequelize[_0xd180('0x2')]},'callerid':{'type':Sequelize[_0xd180('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index eb2bdaa..a4cdd19 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 _0x4df3=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SquareDetailsReport','includeAll','findAll','rows','params','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x4cae38,_0x1f7372){var _0x4fc0d6=function(_0x105335){while(--_0x105335){_0x4cae38['push'](_0x4cae38['shift']());}};_0x4fc0d6(++_0x1f7372);}(_0x4df3,0x95));var _0x34df=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x4df3[_0x5be7aa];return _0x215408;};'use strict';var emlformat=require(_0x34df('0x0'));var rimraf=require(_0x34df('0x1'));var zipdir=require(_0x34df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34df('0x3'));var moment=require(_0x34df('0x4'));var BPromise=require(_0x34df('0x5'));var Mustache=require(_0x34df('0x6'));var util=require(_0x34df('0x7'));var path=require(_0x34df('0x8'));var sox=require('sox');var csv=require(_0x34df('0x9'));var ejs=require(_0x34df('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34df('0xb'));var squel=require(_0x34df('0xc'));var crypto=require(_0x34df('0xd'));var jsforce=require(_0x34df('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x34df('0x9'));var querystring=require(_0x34df('0xf'));var Papa=require(_0x34df('0x10'));var Redis=require(_0x34df('0x11'));var authService=require(_0x34df('0x12'));var qs=require(_0x34df('0x13'));var as=require(_0x34df('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x34df('0x15'));var utils=require(_0x34df('0x16'));var config=require(_0x34df('0x17'));var licenseUtil=require(_0x34df('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa5f92,_0x6835a2){_0x6835a2=_0x6835a2||0xcc;return function(_0x57647d){if(_0x57647d){return _0xa5f92[_0x34df('0x19')](_0x6835a2);}return _0xa5f92[_0x34df('0x1a')](_0x6835a2)[_0x34df('0x1b')]();};}function respondWithResult(_0x3218b8,_0x49ee17){_0x49ee17=_0x49ee17||0xc8;return function(_0xf733e3){if(_0xf733e3){return _0x3218b8[_0x34df('0x1a')](_0x49ee17)[_0x34df('0x1c')](_0xf733e3);}};}function respondWithFilteredResult(_0x333223,_0x111998){return function(_0x4cbfcf){if(_0x4cbfcf){var _0x2008bb=typeof _0x111998[_0x34df('0x1d')]==='undefined'&&typeof _0x111998['limit']===_0x34df('0x1e');var _0x5239bc=_0x4cbfcf[_0x34df('0x1f')];var _0x420ffe=_0x2008bb?0x0:_0x111998[_0x34df('0x1d')];var _0x2f265d=_0x2008bb?_0x4cbfcf[_0x34df('0x1f')]:_0x111998[_0x34df('0x1d')]+_0x111998[_0x34df('0x20')];var _0x305239;if(_0x2f265d>=_0x5239bc){_0x2f265d=_0x5239bc;_0x305239=0xc8;}else{_0x305239=0xce;}_0x333223[_0x34df('0x1a')](_0x305239);return _0x333223[_0x34df('0x21')](_0x34df('0x22'),_0x420ffe+'-'+_0x2f265d+'/'+_0x5239bc)[_0x34df('0x1c')](_0x4cbfcf);}return null;};}function patchUpdates(_0x34b40a){return function(_0x338739){try{jsonpatch['apply'](_0x338739,_0x34b40a,!![]);}catch(_0x5be8b1){return BPromise[_0x34df('0x23')](_0x5be8b1);}return _0x338739[_0x34df('0x24')]();};}function saveUpdates(_0x469fda,_0xab70c4){return function(_0x5d38fc){if(_0x5d38fc){return _0x5d38fc[_0x34df('0x25')](_0x469fda)[_0x34df('0x26')](function(_0x1cff33){return _0x1cff33;});}return null;};}function removeEntity(_0x3a80a5,_0x1c8ffb){return function(_0x398e3a){if(_0x398e3a){return _0x398e3a['destroy']()[_0x34df('0x26')](function(){_0x3a80a5['status'](0xcc)[_0x34df('0x1b')]();});}};}function handleEntityNotFound(_0x2e4bfa,_0x46913f){return function(_0x595aea){if(!_0x595aea){_0x2e4bfa[_0x34df('0x19')](0x194);}return _0x595aea;};}function handleError(_0x5d50f9,_0x53184c){_0x53184c=_0x53184c||0x1f4;return function(_0x1835b8){logger[_0x34df('0x27')](_0x1835b8['stack']);if(_0x1835b8[_0x34df('0x28')]){delete _0x1835b8[_0x34df('0x28')];}_0x5d50f9[_0x34df('0x1a')](_0x53184c)[_0x34df('0x29')](_0x1835b8);};}exports[_0x34df('0x2a')]=function(_0x49cbca,_0xcd3c84){var _0x36aed5={},_0x46d255={},_0x2fbcc6={'count':0x0,'rows':[]};var _0x4dbce8=_[_0x34df('0x2b')](db['SquareDetailsReport'][_0x34df('0x2c')],function(_0x5f4e12){return{'name':_0x5f4e12[_0x34df('0x2d')],'type':_0x5f4e12[_0x34df('0x2e')][_0x34df('0x2f')]};});_0x46d255['model']=_[_0x34df('0x2b')](_0x4dbce8,_0x34df('0x28'));_0x46d255[_0x34df('0x30')]=_[_0x34df('0x31')](_0x49cbca[_0x34df('0x30')]);_0x46d255[_0x34df('0x32')]=_[_0x34df('0x33')](_0x46d255[_0x34df('0x34')],_0x46d255['query']);_0x36aed5[_0x34df('0x35')]=_['intersection'](_0x46d255['model'],qs[_0x34df('0x36')](_0x49cbca[_0x34df('0x30')][_0x34df('0x36')]));_0x36aed5[_0x34df('0x35')]=_0x36aed5['attributes'][_0x34df('0x37')]?_0x36aed5[_0x34df('0x35')]:_0x46d255[_0x34df('0x34')];if(!_0x49cbca[_0x34df('0x30')]['hasOwnProperty'](_0x34df('0x38'))){_0x36aed5[_0x34df('0x20')]=qs[_0x34df('0x20')](_0x49cbca[_0x34df('0x30')][_0x34df('0x20')]);_0x36aed5[_0x34df('0x1d')]=qs['offset'](_0x49cbca['query'][_0x34df('0x1d')]);}_0x36aed5[_0x34df('0x39')]=qs[_0x34df('0x3a')](_0x49cbca[_0x34df('0x30')][_0x34df('0x3a')]);_0x36aed5['where']=qs[_0x34df('0x32')](_[_0x34df('0x3b')](_0x49cbca['query'],_0x46d255[_0x34df('0x32')]),_0x4dbce8);if(_0x49cbca[_0x34df('0x30')][_0x34df('0x3c')]){_0x36aed5[_0x34df('0x3d')]=_[_0x34df('0x3e')](_0x36aed5[_0x34df('0x3d')],{'$or':_[_0x34df('0x2b')](_0x4dbce8,function(_0x25b053){if(_0x25b053[_0x34df('0x2e')]!==_0x34df('0x3f')){var _0x116188={};_0x116188[_0x25b053[_0x34df('0x28')]]={'$like':'%'+_0x49cbca[_0x34df('0x30')][_0x34df('0x3c')]+'%'};return _0x116188;}})});}_0x36aed5=_['merge']({},_0x36aed5,_0x49cbca['options']);var _0x53a80c={'where':_0x36aed5[_0x34df('0x3d')]};return db[_0x34df('0x40')][_0x34df('0x1f')](_0x53a80c)[_0x34df('0x26')](function(_0x2c6c87){_0x2fbcc6[_0x34df('0x1f')]=_0x2c6c87;if(_0x49cbca[_0x34df('0x30')][_0x34df('0x41')]){_0x36aed5['include']=[{'all':!![]}];}return db[_0x34df('0x40')][_0x34df('0x42')](_0x36aed5);})['then'](function(_0x79b54f){_0x2fbcc6[_0x34df('0x43')]=_0x79b54f;return _0x2fbcc6;})[_0x34df('0x26')](respondWithFilteredResult(_0xcd3c84,_0x36aed5))['catch'](handleError(_0xcd3c84,null));};exports['show']=function(_0x148c3f,_0xc5e574){var _0x5820cd={'raw':!![],'where':{'id':_0x148c3f[_0x34df('0x44')]['id']}},_0xceaef4={};_0xceaef4['model']=_[_0x34df('0x31')](db[_0x34df('0x40')]['rawAttributes']);_0xceaef4['query']=_[_0x34df('0x31')](_0x148c3f[_0x34df('0x30')]);_0xceaef4[_0x34df('0x32')]=_[_0x34df('0x33')](_0xceaef4[_0x34df('0x34')],_0xceaef4[_0x34df('0x30')]);_0x5820cd['attributes']=_[_0x34df('0x33')](_0xceaef4[_0x34df('0x34')],qs[_0x34df('0x36')](_0x148c3f[_0x34df('0x30')][_0x34df('0x36')]));_0x5820cd['attributes']=_0x5820cd[_0x34df('0x35')][_0x34df('0x37')]?_0x5820cd[_0x34df('0x35')]:_0xceaef4[_0x34df('0x34')];if(_0x148c3f[_0x34df('0x30')][_0x34df('0x41')]){_0x5820cd[_0x34df('0x45')]=[{'all':!![]}];}_0x5820cd=_[_0x34df('0x3e')]({},_0x5820cd,_0x148c3f['options']);return db['SquareDetailsReport'][_0x34df('0x46')](_0x5820cd)[_0x34df('0x26')](handleEntityNotFound(_0xc5e574,null))[_0x34df('0x26')](respondWithResult(_0xc5e574,null))[_0x34df('0x47')](handleError(_0xc5e574,null));};exports[_0x34df('0x48')]=function(_0xa67110,_0x275ab9){return db[_0x34df('0x40')][_0x34df('0x48')](_0xa67110[_0x34df('0x49')],{})[_0x34df('0x26')](respondWithResult(_0x275ab9,0xc9))[_0x34df('0x47')](handleError(_0x275ab9,null));};exports[_0x34df('0x25')]=function(_0x1c8a61,_0x2ca64a){if(_0x1c8a61[_0x34df('0x49')]['id']){delete _0x1c8a61[_0x34df('0x49')]['id'];}return db[_0x34df('0x40')][_0x34df('0x46')]({'where':{'id':_0x1c8a61[_0x34df('0x44')]['id']}})[_0x34df('0x26')](handleEntityNotFound(_0x2ca64a,null))[_0x34df('0x26')](saveUpdates(_0x1c8a61['body'],null))[_0x34df('0x26')](respondWithResult(_0x2ca64a,null))[_0x34df('0x47')](handleError(_0x2ca64a,null));};exports[_0x34df('0x4a')]=function(_0x132db5,_0x5ce8b0){return db['SquareDetailsReport']['find']({'where':{'id':_0x132db5[_0x34df('0x44')]['id']}})[_0x34df('0x26')](handleEntityNotFound(_0x5ce8b0,null))[_0x34df('0x26')](removeEntity(_0x5ce8b0,null))[_0x34df('0x47')](handleError(_0x5ce8b0,null));};exports[_0x34df('0x4b')]=function(_0x44a5ec,_0x4f3c1c){return db['SquareDetailsReport']['describe']()[_0x34df('0x26')](respondWithResult(_0x4f3c1c,null))['catch'](handleError(_0x4f3c1c,null));}; \ No newline at end of file +var _0x465c=['lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','error','stack','name','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','fields','include','SquareDetailsReport','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x10355a,_0x5ab3b9){var _0x3481ba=function(_0x271719){while(--_0x271719){_0x10355a['push'](_0x10355a['shift']());}};_0x3481ba(++_0x5ab3b9);}(_0x465c,0x8e));var _0xc465=function(_0x40a7cb,_0xc3e718){_0x40a7cb=_0x40a7cb-0x0;var _0x257b91=_0x465c[_0x40a7cb];return _0x257b91;};'use strict';var emlformat=require(_0xc465('0x0'));var rimraf=require(_0xc465('0x1'));var zipdir=require(_0xc465('0x2'));var jsonpatch=require(_0xc465('0x3'));var rp=require('request-promise');var moment=require(_0xc465('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc465('0x5'));var util=require(_0xc465('0x6'));var path=require(_0xc465('0x7'));var sox=require(_0xc465('0x8'));var csv=require(_0xc465('0x9'));var ejs=require(_0xc465('0xa'));var fs=require('fs');var fs_extra=require(_0xc465('0xb'));var _=require(_0xc465('0xc'));var squel=require(_0xc465('0xd'));var crypto=require('crypto');var jsforce=require(_0xc465('0xe'));var deskjs=require(_0xc465('0xf'));var toCsv=require(_0xc465('0x9'));var querystring=require(_0xc465('0x10'));var Papa=require(_0xc465('0x11'));var Redis=require('ioredis');var authService=require(_0xc465('0x12'));var qs=require(_0xc465('0x13'));var as=require(_0xc465('0x14'));var hardwareService=require(_0xc465('0x15'));var logger=require(_0xc465('0x16'))('api');var utils=require(_0xc465('0x17'));var config=require(_0xc465('0x18'));var licenseUtil=require(_0xc465('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a9d73,_0x6dcf37){_0x6dcf37=_0x6dcf37||0xcc;return function(_0x1a43b6){if(_0x1a43b6){return _0x1a9d73[_0xc465('0x1a')](_0x6dcf37);}return _0x1a9d73[_0xc465('0x1b')](_0x6dcf37)[_0xc465('0x1c')]();};}function respondWithResult(_0x511481,_0x40e283){_0x40e283=_0x40e283||0xc8;return function(_0x46048c){if(_0x46048c){return _0x511481[_0xc465('0x1b')](_0x40e283)['json'](_0x46048c);}};}function respondWithFilteredResult(_0xcdb4fe,_0x3ef765){return function(_0x5769f2){if(_0x5769f2){var _0x4297dd=typeof _0x3ef765[_0xc465('0x1d')]==='undefined'&&typeof _0x3ef765[_0xc465('0x1e')]===_0xc465('0x1f');var _0x11b083=_0x5769f2[_0xc465('0x20')];var _0x1dabc2=_0x4297dd?0x0:_0x3ef765['offset'];var _0x5857c4=_0x4297dd?_0x5769f2[_0xc465('0x20')]:_0x3ef765[_0xc465('0x1d')]+_0x3ef765[_0xc465('0x1e')];var _0x1cded1;if(_0x5857c4>=_0x11b083){_0x5857c4=_0x11b083;_0x1cded1=0xc8;}else{_0x1cded1=0xce;}_0xcdb4fe['status'](_0x1cded1);return _0xcdb4fe[_0xc465('0x21')](_0xc465('0x22'),_0x1dabc2+'-'+_0x5857c4+'/'+_0x11b083)[_0xc465('0x23')](_0x5769f2);}return null;};}function patchUpdates(_0x5c87cb){return function(_0xa81486){try{jsonpatch[_0xc465('0x24')](_0xa81486,_0x5c87cb,!![]);}catch(_0x296939){return BPromise['reject'](_0x296939);}return _0xa81486[_0xc465('0x25')]();};}function saveUpdates(_0x402549,_0x2af50d){return function(_0x2d9cf7){if(_0x2d9cf7){return _0x2d9cf7[_0xc465('0x26')](_0x402549)[_0xc465('0x27')](function(_0x599f69){return _0x599f69;});}return null;};}function removeEntity(_0x4b0872,_0x26f8ae){return function(_0x2bef4f){if(_0x2bef4f){return _0x2bef4f['destroy']()[_0xc465('0x27')](function(){_0x4b0872[_0xc465('0x1b')](0xcc)[_0xc465('0x1c')]();});}};}function handleEntityNotFound(_0x30579e,_0x1d255d){return function(_0xdbf1fb){if(!_0xdbf1fb){_0x30579e['sendStatus'](0x194);}return _0xdbf1fb;};}function handleError(_0x39fc3b,_0x23b934){_0x23b934=_0x23b934||0x1f4;return function(_0x786c0){logger[_0xc465('0x28')](_0x786c0[_0xc465('0x29')]);if(_0x786c0[_0xc465('0x2a')]){delete _0x786c0[_0xc465('0x2a')];}_0x39fc3b[_0xc465('0x1b')](_0x23b934)['send'](_0x786c0);};}exports['index']=function(_0x5ac1b4,_0x5cba9c){var _0x5a6a92={},_0x47a1ef={},_0x9fd310={'count':0x0,'rows':[]};var _0x4b4c61=_['map'](db['SquareDetailsReport'][_0xc465('0x2b')],function(_0xd13e84){return{'name':_0xd13e84[_0xc465('0x2c')],'type':_0xd13e84[_0xc465('0x2d')][_0xc465('0x2e')]};});_0x47a1ef[_0xc465('0x2f')]=_[_0xc465('0x30')](_0x4b4c61,_0xc465('0x2a'));_0x47a1ef[_0xc465('0x31')]=_['keys'](_0x5ac1b4['query']);_0x47a1ef['filters']=_['intersection'](_0x47a1ef[_0xc465('0x2f')],_0x47a1ef['query']);_0x5a6a92[_0xc465('0x32')]=_[_0xc465('0x33')](_0x47a1ef[_0xc465('0x2f')],qs['fields'](_0x5ac1b4['query']['fields']));_0x5a6a92[_0xc465('0x32')]=_0x5a6a92[_0xc465('0x32')][_0xc465('0x34')]?_0x5a6a92['attributes']:_0x47a1ef[_0xc465('0x2f')];if(!_0x5ac1b4['query'][_0xc465('0x35')](_0xc465('0x36'))){_0x5a6a92[_0xc465('0x1e')]=qs[_0xc465('0x1e')](_0x5ac1b4['query']['limit']);_0x5a6a92[_0xc465('0x1d')]=qs[_0xc465('0x1d')](_0x5ac1b4[_0xc465('0x31')][_0xc465('0x1d')]);}_0x5a6a92[_0xc465('0x37')]=qs[_0xc465('0x38')](_0x5ac1b4[_0xc465('0x31')]['sort']);_0x5a6a92[_0xc465('0x39')]=qs[_0xc465('0x3a')](_['pick'](_0x5ac1b4['query'],_0x47a1ef[_0xc465('0x3a')]),_0x4b4c61);if(_0x5ac1b4[_0xc465('0x31')][_0xc465('0x3b')]){_0x5a6a92[_0xc465('0x39')]=_[_0xc465('0x3c')](_0x5a6a92[_0xc465('0x39')],{'$or':_['map'](_0x4b4c61,function(_0x5a5ea7){if(_0x5a5ea7[_0xc465('0x2d')]!==_0xc465('0x3d')){var _0x13fd39={};_0x13fd39[_0x5a5ea7[_0xc465('0x2a')]]={'$like':'%'+_0x5ac1b4['query'][_0xc465('0x3b')]+'%'};return _0x13fd39;}})});}_0x5a6a92=_[_0xc465('0x3c')]({},_0x5a6a92,_0x5ac1b4[_0xc465('0x3e')]);var _0x4b24f1={'where':_0x5a6a92[_0xc465('0x39')]};return db['SquareDetailsReport'][_0xc465('0x20')](_0x4b24f1)[_0xc465('0x27')](function(_0x1f6d66){_0x9fd310[_0xc465('0x20')]=_0x1f6d66;if(_0x5ac1b4[_0xc465('0x31')][_0xc465('0x3f')]){_0x5a6a92['include']=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x5a6a92);})[_0xc465('0x27')](function(_0x4be83b){_0x9fd310[_0xc465('0x40')]=_0x4be83b;return _0x9fd310;})[_0xc465('0x27')](respondWithFilteredResult(_0x5cba9c,_0x5a6a92))[_0xc465('0x41')](handleError(_0x5cba9c,null));};exports[_0xc465('0x42')]=function(_0x565d0f,_0x2d5796){var _0x4c20fb={'raw':!![],'where':{'id':_0x565d0f[_0xc465('0x43')]['id']}},_0x350229={};_0x350229[_0xc465('0x2f')]=_[_0xc465('0x44')](db['SquareDetailsReport']['rawAttributes']);_0x350229[_0xc465('0x31')]=_[_0xc465('0x44')](_0x565d0f['query']);_0x350229[_0xc465('0x3a')]=_['intersection'](_0x350229[_0xc465('0x2f')],_0x350229[_0xc465('0x31')]);_0x4c20fb[_0xc465('0x32')]=_[_0xc465('0x33')](_0x350229[_0xc465('0x2f')],qs[_0xc465('0x45')](_0x565d0f[_0xc465('0x31')][_0xc465('0x45')]));_0x4c20fb[_0xc465('0x32')]=_0x4c20fb[_0xc465('0x32')][_0xc465('0x34')]?_0x4c20fb[_0xc465('0x32')]:_0x350229[_0xc465('0x2f')];if(_0x565d0f[_0xc465('0x31')][_0xc465('0x3f')]){_0x4c20fb[_0xc465('0x46')]=[{'all':!![]}];}_0x4c20fb=_[_0xc465('0x3c')]({},_0x4c20fb,_0x565d0f[_0xc465('0x3e')]);return db[_0xc465('0x47')][_0xc465('0x48')](_0x4c20fb)[_0xc465('0x27')](handleEntityNotFound(_0x2d5796,null))[_0xc465('0x27')](respondWithResult(_0x2d5796,null))[_0xc465('0x41')](handleError(_0x2d5796,null));};exports['create']=function(_0x447bc7,_0x208631){return db[_0xc465('0x47')][_0xc465('0x49')](_0x447bc7[_0xc465('0x4a')],{})[_0xc465('0x27')](respondWithResult(_0x208631,0xc9))[_0xc465('0x41')](handleError(_0x208631,null));};exports[_0xc465('0x26')]=function(_0xf642e7,_0x29d67d){if(_0xf642e7[_0xc465('0x4a')]['id']){delete _0xf642e7[_0xc465('0x4a')]['id'];}return db[_0xc465('0x47')][_0xc465('0x48')]({'where':{'id':_0xf642e7[_0xc465('0x43')]['id']}})[_0xc465('0x27')](handleEntityNotFound(_0x29d67d,null))['then'](saveUpdates(_0xf642e7[_0xc465('0x4a')],null))['then'](respondWithResult(_0x29d67d,null))[_0xc465('0x41')](handleError(_0x29d67d,null));};exports[_0xc465('0x4b')]=function(_0x20e642,_0x5b7a2c){return db[_0xc465('0x47')][_0xc465('0x48')]({'where':{'id':_0x20e642[_0xc465('0x43')]['id']}})[_0xc465('0x27')](handleEntityNotFound(_0x5b7a2c,null))['then'](removeEntity(_0x5b7a2c,null))['catch'](handleError(_0x5b7a2c,null));};exports['describe']=function(_0x55f2dc,_0x5a8a89){return db[_0xc465('0x47')][_0xc465('0x4c')]()['then'](respondWithResult(_0x5a8a89,null))[_0xc465('0x41')](handleError(_0x5a8a89,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 42e665d..548b2f9 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 _0x3d61=['report_square_details','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x3d61,0x1b9));var _0x13d6=function(_0x9e829e,_0x3b2997){_0x9e829e=_0x9e829e-0x0;var _0x622570=_0x3d61[_0x9e829e];return _0x622570;};'use strict';var _=require(_0x13d6('0x0'));var util=require('util');var logger=require(_0x13d6('0x1'))('api');var moment=require(_0x13d6('0x2'));var BPromise=require('bluebird');var rp=require(_0x13d6('0x3'));var fs=require('fs');var path=require(_0x13d6('0x4'));var rimraf=require(_0x13d6('0x5'));var config=require(_0x13d6('0x6'));var attributes=require(_0x13d6('0x7'));module[_0x13d6('0x8')]=function(_0x4467b5,_0x378a18){return _0x4467b5['define'](_0x13d6('0x9'),attributes,{'tableName':_0x13d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffbc=['../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x25ef0f,_0x7b3906){var _0x45d262=function(_0x4ccd51){while(--_0x4ccd51){_0x25ef0f['push'](_0x25ef0f['shift']());}};_0x45d262(++_0x7b3906);}(_0xffbc,0xd5));var _0xcffb=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xffbc[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0xcffb('0x0'));var util=require('util');var logger=require(_0xcffb('0x1'))(_0xcffb('0x2'));var moment=require(_0xcffb('0x3'));var BPromise=require(_0xcffb('0x4'));var rp=require(_0xcffb('0x5'));var fs=require('fs');var path=require(_0xcffb('0x6'));var rimraf=require(_0xcffb('0x7'));var config=require(_0xcffb('0x8'));var attributes=require(_0xcffb('0x9'));module[_0xcffb('0xa')]=function(_0x57d0ce,_0x35d54f){return _0x57d0ce[_0xcffb('0xb')]('SquareDetailsReport',attributes,{'tableName':_0xcffb('0xc'),'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 4fc15c7..20f0cd3 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 _0x5b12=['../../config/utils','rpc','client','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x43bd64,_0x54fe4a){var _0xe65a4e=function(_0x538088){while(--_0x538088){_0x43bd64['push'](_0x43bd64['shift']());}};_0xe65a4e(++_0x54fe4a);}(_0x5b12,0xa3));var _0x25b1=function(_0x464452,_0x1e03e6){_0x464452=_0x464452-0x0;var _0x10f956=_0x5b12[_0x464452];return _0x10f956;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb95b,_0x1f715d,_0x28c980){return new BPromise(function(_0x451c66,_0x2a46e0){return client[_0x25b1('0x8')](_0x5bb95b,_0x28c980)[_0x25b1('0x9')](function(_0x3346ed){logger[_0x25b1('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x1f715d,_0x25b1('0xb'));logger[_0x25b1('0xc')](_0x25b1('0xd'),_0x1f715d,_0x25b1('0xb'),JSON[_0x25b1('0xe')](_0x3346ed));if(_0x3346ed[_0x25b1('0xf')]){if(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x10')]===0x1f4){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);return _0x2a46e0(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);}logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed['error'][_0x25b1('0x12')]);return _0x451c66(_0x3346ed[_0x25b1('0xf')]['message']);}else{logger[_0x25b1('0xa')](_0x25b1('0x11'),_0x1f715d,_0x25b1('0xb'));_0x451c66(_0x3346ed['result']['message']);}})[_0x25b1('0x13')](function(_0x573ec2){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x573ec2);_0x2a46e0(_0x573ec2);});});}exports[_0x25b1('0x14')]=function(_0x27ccc9){var _0x1f78c2=this;return new Promise(function(_0x2a7d14,_0x17024a){return db[_0x25b1('0x15')]['create'](_0x27ccc9['body'],{'raw':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3bfd7d){logger['info'](_0x25b1('0x14'),_0x27ccc9);logger['debug'](_0x25b1('0x14'),_0x27ccc9,JSON['stringify'](_0x3bfd7d));_0x2a7d14(_0x3bfd7d);})['catch'](function(_0x565cfd){logger[_0x25b1('0xf')](_0x25b1('0x14'),_0x565cfd['message'],_0x27ccc9);_0x17024a(_0x1f78c2[_0x25b1('0xf')](0x1f4,_0x565cfd[_0x25b1('0x12')]));});});}; \ No newline at end of file +var _0xf65d=['randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','stringify','lodash','moment','bluebird'];(function(_0x2dabf5,_0x328221){var _0x3579d8=function(_0x526915){while(--_0x526915){_0x2dabf5['push'](_0x2dabf5['shift']());}};_0x3579d8(++_0x328221);}(_0xf65d,0x9f));var _0xdf65=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0xf65d[_0x1f7996];return _0x584609;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var moment=require(_0xdf65('0x1'));var BPromise=require(_0xdf65('0x2'));var rs=require(_0xdf65('0x3'));var fs=require('fs');var Redis=require(_0xdf65('0x4'));var db=require(_0xdf65('0x5'))['db'];var utils=require(_0xdf65('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdf65('0x7'));var client=jayson['client'][_0xdf65('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33efa2,_0x4c4054,_0x40cc08){return new BPromise(function(_0x3f5cae,_0x97292b){return client[_0xdf65('0x9')](_0x33efa2,_0x40cc08)[_0xdf65('0xa')](function(_0x46a70d){logger['info'](_0xdf65('0xb'),_0x4c4054,'request\x20sent');logger[_0xdf65('0xc')](_0xdf65('0xd'),_0x4c4054,_0xdf65('0xe'),JSON['stringify'](_0x46a70d));if(_0x46a70d['error']){if(_0x46a70d[_0xdf65('0xf')][_0xdf65('0x10')]===0x1f4){logger[_0xdf65('0xf')](_0xdf65('0xb'),_0x4c4054,_0x46a70d[_0xdf65('0xf')][_0xdf65('0x11')]);return _0x97292b(_0x46a70d['error'][_0xdf65('0x11')]);}logger[_0xdf65('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x4c4054,_0x46a70d['error']['message']);return _0x3f5cae(_0x46a70d[_0xdf65('0xf')][_0xdf65('0x11')]);}else{logger[_0xdf65('0x12')](_0xdf65('0xb'),_0x4c4054,_0xdf65('0xe'));_0x3f5cae(_0x46a70d[_0xdf65('0x13')][_0xdf65('0x11')]);}})[_0xdf65('0x14')](function(_0x208b93){logger[_0xdf65('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x4c4054,_0x208b93);_0x97292b(_0x208b93);});});}exports[_0xdf65('0x15')]=function(_0x532215){var _0x28fcd1=this;return new Promise(function(_0x3a175b,_0x2337da){return db[_0xdf65('0x16')][_0xdf65('0x17')](_0x532215[_0xdf65('0x18')],{'raw':_0x532215['options']?_0x532215[_0xdf65('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xdf65('0xa')](function(_0x299ed3){logger[_0xdf65('0x12')](_0xdf65('0x15'),_0x532215);logger[_0xdf65('0xc')]('CreateSquareDetailsReport',_0x532215,JSON[_0xdf65('0x1a')](_0x299ed3));_0x3a175b(_0x299ed3);})[_0xdf65('0x14')](function(_0x5ee78d){logger[_0xdf65('0xf')](_0xdf65('0x15'),_0x5ee78d[_0xdf65('0x11')],_0x532215);_0x2337da(_0x28fcd1[_0xdf65('0xf')](0x1f4,_0x5ee78d['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e577447..99c3c61 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 _0x6304=['express','Router','../../components/auth/service','./system.controller','get','/process/:pid/kill','killProcess','exports'];(function(_0xc1b33f,_0x2c9f08){var _0x459205=function(_0x4dad5b){while(--_0x4dad5b){_0xc1b33f['push'](_0xc1b33f['shift']());}};_0x459205(++_0x2c9f08);}(_0x6304,0x190));var _0x4630=function(_0x358b25,_0x2d6ea5){_0x358b25=_0x358b25-0x0;var _0x10c26c=_0x6304[_0x358b25];return _0x10c26c;};'use strict';var express=require(_0x4630('0x0'));var router=express[_0x4630('0x1')]();var auth=require(_0x4630('0x2'));var controller=require(_0x4630('0x3'));router[_0x4630('0x4')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4630('0x5'),auth['isAuthenticated'](),controller[_0x4630('0x6')]);module[_0x4630('0x7')]=router; \ No newline at end of file +var _0xcda3=['../../components/auth/service','./system.controller','get','index','exports'];(function(_0xa4a324,_0x5443c0){var _0x31ed87=function(_0xead820){while(--_0xead820){_0xa4a324['push'](_0xa4a324['shift']());}};_0x31ed87(++_0x5443c0);}(_0xcda3,0x1c2));var _0x3cda=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0xcda3[_0x1269c6];return _0x4868c7;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x3cda('0x0'));var controller=require(_0x3cda('0x1'));router[_0x3cda('0x2')]('/',auth['isAuthenticated'](),controller[_0x3cda('0x3')]);router[_0x3cda('0x2')]('/process/:pid/kill',auth['isAuthenticated'](),controller['killProcess']);module[_0x3cda('0x4')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index edebd80..d85feda 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 _0xc663=['kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x3b109c,_0x1399e4){var _0x99667f=function(_0x591a5c){while(--_0x591a5c){_0x3b109c['push'](_0x3b109c['shift']());}};_0x99667f(++_0x1399e4);}(_0xc663,0x1d3));var _0x3c66=function(_0x2140ae,_0x276645){_0x2140ae=_0x2140ae-0x0;var _0x33ccc7=_0xc663[_0x2140ae];return _0x33ccc7;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x3c66('0x0')];var logger=require(_0x3c66('0x1'))(_0x3c66('0x2'));var util=require(_0x3c66('0x3'));var BPromise=require('bluebird');var _=require(_0x3c66('0x4'));function handleError(_0x92c539,_0x1f7439,_0xe006e4){_0x1f7439=_0x1f7439||0x1f4;return function(_0x20fe61){logger[_0x3c66('0x5')](_0x3c66('0x6'),_0xe006e4,_0x1f7439,util[_0x3c66('0x7')](_0x20fe61,{'showHidden':![],'depth':null}));delete _0x20fe61[_0x3c66('0x8')];_0x92c539[_0x3c66('0x9')](_0x1f7439)[_0x3c66('0xa')](_0x20fe61);};}exports[_0x3c66('0xb')]=function(_0x4fbecb,_0x13088d){return info[_0x3c66('0xc')]()[_0x3c66('0xd')](function(_0x2910ea){return _0x13088d[_0x3c66('0x9')](0xc8)[_0x3c66('0xe')](_0x2910ea);})[_0x3c66('0xf')](function(_0x49ff06){return _0x13088d[_0x3c66('0x9')](0x1f4)['json'](_0x49ff06);});};exports[_0x3c66('0x10')]=function(_0x1d62c1,_0x3ff09e){var _0xe3726b=[_0x3c66('0x11')];return new BPromise(function(_0xac5bbe,_0x1aa082){return exec(util[_0x3c66('0x12')](_0x3c66('0x13'),_0x1d62c1[_0x3c66('0x14')][_0x3c66('0x15')]),function(_0x570db9,_0x3f6fcf,_0x5826a8){if(_0x570db9){return _0x1aa082(_0x570db9);}return _0xac5bbe(_0x3f6fcf);});})[_0x3c66('0xd')](function(_0x4f095a){var _0x1b024b=![];var _0x5a19b9=_0x4f095a[_0x3c66('0x16')](/\n/);for(var _0x25fc76=0x0,_0x14d67d=_0xe3726b[_0x3c66('0x17')];_0x25fc76<_0x14d67d,_0x1b024b===![];_0x25fc76+=0x1){if(_0x4f095a[_0x3c66('0x18')](_0xe3726b[_0x25fc76])>=0x0){_0x1b024b=!![];}}if(!_0x1b024b){throw new Error(util[_0x3c66('0x12')](_0x3c66('0x19'),_0x1d62c1[_0x3c66('0x14')][_0x3c66('0x15')]));}process[_0x3c66('0x1a')](_0x1d62c1['params'][_0x3c66('0x15')],_0x3c66('0x1b'));return _0x3ff09e[_0x3c66('0x9')](0xc8)[_0x3c66('0xe')]({'message':util[_0x3c66('0x12')](_0x3c66('0x1c'),_0x1d62c1[_0x3c66('0x14')][_0x3c66('0x15')])});})[_0x3c66('0xf')](handleError(_0x3ff09e,null,_0x3c66('0x10')));}; \ No newline at end of file +var _0x13ef=['index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send'];(function(_0x25aaec,_0x159e5b){var _0x293c2f=function(_0x3cd42a){while(--_0x3cd42a){_0x25aaec['push'](_0x25aaec['shift']());}};_0x293c2f(++_0x159e5b);}(_0x13ef,0xdc));var _0xf13e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x13ef[_0x46698a];return _0x356db0;};'use strict';var info=require('systeminformation');var exec=require(_0xf13e('0x0'))[_0xf13e('0x1')];var logger=require(_0xf13e('0x2'))(_0xf13e('0x3'));var util=require(_0xf13e('0x4'));var BPromise=require(_0xf13e('0x5'));var _=require('lodash');function handleError(_0x16fda2,_0x380b21,_0x589c0e){_0x380b21=_0x380b21||0x1f4;return function(_0x1ad62d){logger[_0xf13e('0x6')](_0xf13e('0x7'),_0x589c0e,_0x380b21,util[_0xf13e('0x8')](_0x1ad62d,{'showHidden':![],'depth':null}));delete _0x1ad62d[_0xf13e('0x9')];_0x16fda2[_0xf13e('0xa')](_0x380b21)[_0xf13e('0xb')](_0x1ad62d);};}exports[_0xf13e('0xc')]=function(_0x528801,_0xbc0fb9){return info[_0xf13e('0xd')]()[_0xf13e('0xe')](function(_0x588b32){return _0xbc0fb9[_0xf13e('0xa')](0xc8)[_0xf13e('0xf')](_0x588b32);})[_0xf13e('0x10')](function(_0x19f2ae){return _0xbc0fb9[_0xf13e('0xa')](0x1f4)[_0xf13e('0xf')](_0x19f2ae);});};exports[_0xf13e('0x11')]=function(_0x290b65,_0x1a43e0){var _0x3f53da=[_0xf13e('0x12')];return new BPromise(function(_0x36edcf,_0x4ee3c7){return exec(util[_0xf13e('0x13')](_0xf13e('0x14'),_0x290b65[_0xf13e('0x15')]['pid']),function(_0x48b7a1,_0x421cb1,_0x1abbde){if(_0x48b7a1){return _0x4ee3c7(_0x48b7a1);}return _0x36edcf(_0x421cb1);});})[_0xf13e('0xe')](function(_0x44b005){var _0x57614f=![];var _0xc6e719=_0x44b005[_0xf13e('0x16')](/\n/);for(var _0x413edf=0x0,_0x2b0558=_0x3f53da[_0xf13e('0x17')];_0x413edf<_0x2b0558,_0x57614f===![];_0x413edf+=0x1){if(_0x44b005[_0xf13e('0x18')](_0x3f53da[_0x413edf])>=0x0){_0x57614f=!![];}}if(!_0x57614f){throw new Error(util[_0xf13e('0x13')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x290b65[_0xf13e('0x15')][_0xf13e('0x19')]));}process[_0xf13e('0x1a')](_0x290b65[_0xf13e('0x15')][_0xf13e('0x19')],_0xf13e('0x1b'));return _0x1a43e0[_0xf13e('0xa')](0xc8)[_0xf13e('0xf')]({'message':util['format'](_0xf13e('0x1c'),_0x290b65[_0xf13e('0x15')][_0xf13e('0x19')])});})[_0xf13e('0x10')](handleError(_0x1a43e0,null,_0xf13e('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index de9b9d4..0c36b5a 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 _0x7366=['post','isAuthenticated','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','index','get','/:id','show'];(function(_0x17eec6,_0x54a955){var _0x1e4d32=function(_0x3d2e36){while(--_0x3d2e36){_0x17eec6['push'](_0x17eec6['shift']());}};_0x1e4d32(++_0x54a955);}(_0x7366,0x9d));var _0x6736=function(_0x38176e,_0x536a40){_0x38176e=_0x38176e-0x0;var _0x37f34d=_0x7366[_0x38176e];return _0x37f34d;};'use strict';var multer=require(_0x6736('0x0'));var util=require(_0x6736('0x1'));var path=require(_0x6736('0x2'));var timeout=require(_0x6736('0x3'));var express=require(_0x6736('0x4'));var router=express[_0x6736('0x5')]();var fs_extra=require(_0x6736('0x6'));var auth=require(_0x6736('0x7'));var interaction=require(_0x6736('0x8'));var config=require('../../config/environment');var controller=require(_0x6736('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6736('0xa')]);router[_0x6736('0xb')](_0x6736('0xc'),auth['isAuthenticated'](),controller[_0x6736('0xd')]);router[_0x6736('0xe')]('/',auth[_0x6736('0xf')](),controller['create']);router[_0x6736('0x10')](_0x6736('0xc'),auth[_0x6736('0xf')](),controller['update']);router[_0x6736('0x11')]('/:id',auth[_0x6736('0xf')](),controller[_0x6736('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf534=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','show','post','put','delete','destroy','multer'];(function(_0x2dcf70,_0x4dc514){var _0xa077cf=function(_0x304679){while(--_0x304679){_0x2dcf70['push'](_0x2dcf70['shift']());}};_0xa077cf(++_0x4dc514);}(_0xf534,0x9f));var _0x4f53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf534[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x4f53('0x0'));var util=require(_0x4f53('0x1'));var path=require(_0x4f53('0x2'));var timeout=require(_0x4f53('0x3'));var express=require(_0x4f53('0x4'));var router=express['Router']();var fs_extra=require(_0x4f53('0x5'));var auth=require(_0x4f53('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f53('0x7'));var controller=require(_0x4f53('0x8'));router[_0x4f53('0x9')]('/',auth[_0x4f53('0xa')](),controller['index']);router[_0x4f53('0x9')]('/:id',auth[_0x4f53('0xa')](),controller[_0x4f53('0xb')]);router[_0x4f53('0xc')]('/',auth[_0x4f53('0xa')](),controller['create']);router[_0x4f53('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4f53('0xe')]('/:id',auth[_0x4f53('0xa')](),controller[_0x4f53('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 1fd104a..0dc3618 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 _0x7a40=['exports','STRING','#0091EA','sequelize'];(function(_0x34bd34,_0x1444f7){var _0x4e36d6=function(_0x20ed8e){while(--_0x20ed8e){_0x34bd34['push'](_0x34bd34['shift']());}};_0x4e36d6(++_0x1444f7);}(_0x7a40,0x197));var _0x07a4=function(_0xbf66fb,_0x56bef8){_0xbf66fb=_0xbf66fb-0x0;var _0x5a5253=_0x7a40[_0xbf66fb];return _0x5a5253;};'use strict';var Sequelize=require(_0x07a4('0x0'));module[_0x07a4('0x1')]={'name':{'type':Sequelize[_0x07a4('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x07a4('0x2')],'defaultValue':_0x07a4('0x3')},'description':{'type':Sequelize[_0x07a4('0x2')]}}; \ No newline at end of file +var _0x2ca5=['exports','STRING','name','#0091EA'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x2ca5,0x108));var _0x52ca=function(_0x3b4455,_0x3e4395){_0x3b4455=_0x3b4455-0x0;var _0x34dd09=_0x2ca5[_0x3b4455];return _0x34dd09;};'use strict';var Sequelize=require('sequelize');module[_0x52ca('0x0')]={'name':{'type':Sequelize[_0x52ca('0x1')],'unique':_0x52ca('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x52ca('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index bb4e3cf..7f7874b 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 _0x04b8=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','Tags','error','stack','name','send','index','map','Tag','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get'];(function(_0x2b7708,_0x41d094){var _0x5cc90c=function(_0x1bc35f){while(--_0x1bc35f){_0x2b7708['push'](_0x2b7708['shift']());}};_0x5cc90c(++_0x41d094);}(_0x04b8,0x159));var _0x804b=function(_0x2a0052,_0x4197c1){_0x2a0052=_0x2a0052-0x0;var _0xe789e6=_0x04b8[_0x2a0052];return _0xe789e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15a4eb,_0x5303cc){_0x5303cc=_0x5303cc||0xcc;return function(_0x23ee57){if(_0x23ee57){return _0x15a4eb[_0x804b('0x18')](_0x5303cc);}return _0x15a4eb[_0x804b('0x19')](_0x5303cc)[_0x804b('0x1a')]();};}function respondWithResult(_0x581fbf,_0x215825){_0x215825=_0x215825||0xc8;return function(_0x1b01a7){if(_0x1b01a7){return _0x581fbf[_0x804b('0x19')](_0x215825)[_0x804b('0x1b')](_0x1b01a7);}};}function respondWithFilteredResult(_0x4ff1be,_0x2fd593){return function(_0x8ccbe0){if(_0x8ccbe0){var _0x5e1cfe=typeof _0x2fd593[_0x804b('0x1c')]==='undefined'&&typeof _0x2fd593[_0x804b('0x1d')]===_0x804b('0x1e');var _0x13662e=_0x8ccbe0[_0x804b('0x1f')];var _0x3a05c0=_0x5e1cfe?0x0:_0x2fd593['offset'];var _0x871d6c=_0x5e1cfe?_0x8ccbe0['count']:_0x2fd593[_0x804b('0x1c')]+_0x2fd593[_0x804b('0x1d')];var _0x42cceb;if(_0x871d6c>=_0x13662e){_0x871d6c=_0x13662e;_0x42cceb=0xc8;}else{_0x42cceb=0xce;}_0x4ff1be[_0x804b('0x19')](_0x42cceb);return _0x4ff1be['set'](_0x804b('0x20'),_0x3a05c0+'-'+_0x871d6c+'/'+_0x13662e)[_0x804b('0x1b')](_0x8ccbe0);}return null;};}function patchUpdates(_0x427166){return function(_0x11eaf6){try{jsonpatch[_0x804b('0x21')](_0x11eaf6,_0x427166,!![]);}catch(_0x267878){return BPromise[_0x804b('0x22')](_0x267878);}return _0x11eaf6[_0x804b('0x23')]();};}function saveUpdates(_0xaa9521,_0x2b7271){return function(_0x1acc48){if(_0x1acc48){return _0x1acc48['update'](_0xaa9521)[_0x804b('0x24')](function(_0x5a77e0){return _0x5a77e0;});}return null;};}function removeEntity(_0x5585f8,_0x44a921){return function(_0x367024){if(_0x367024){return _0x367024[_0x804b('0x25')]()[_0x804b('0x24')](function(){var _0x9080c2=_0x367024['get']({'plain':!![]});var _0x2de812=_0x804b('0x26');return db['UserProfileResource'][_0x804b('0x25')]({'where':{'type':_0x2de812,'resourceId':_0x9080c2['id']}})[_0x804b('0x24')](function(){return _0x367024;});})[_0x804b('0x24')](function(){_0x5585f8[_0x804b('0x19')](0xcc)[_0x804b('0x1a')]();});}};}function handleEntityNotFound(_0x5cc1dd,_0x456580){return function(_0x22f822){if(!_0x22f822){_0x5cc1dd[_0x804b('0x18')](0x194);}return _0x22f822;};}function handleError(_0xe145e,_0x3d1ecc){_0x3d1ecc=_0x3d1ecc||0x1f4;return function(_0x4a6079){logger[_0x804b('0x27')](_0x4a6079[_0x804b('0x28')]);if(_0x4a6079[_0x804b('0x29')]){delete _0x4a6079['name'];}_0xe145e[_0x804b('0x19')](_0x3d1ecc)[_0x804b('0x2a')](_0x4a6079);};}exports[_0x804b('0x2b')]=function(_0x57b8da,_0x408857){var _0x471c04={},_0x5e8f85={},_0x391376={'count':0x0,'rows':[]};var _0x37dd3e=_[_0x804b('0x2c')](db[_0x804b('0x2d')][_0x804b('0x2e')],function(_0x241c96){return{'name':_0x241c96['fieldName'],'type':_0x241c96[_0x804b('0x2f')][_0x804b('0x30')]};});_0x5e8f85[_0x804b('0x31')]=_[_0x804b('0x2c')](_0x37dd3e,_0x804b('0x29'));_0x5e8f85[_0x804b('0x32')]=_[_0x804b('0x33')](_0x57b8da[_0x804b('0x32')]);_0x5e8f85[_0x804b('0x34')]=_[_0x804b('0x35')](_0x5e8f85[_0x804b('0x31')],_0x5e8f85[_0x804b('0x32')]);_0x471c04[_0x804b('0x36')]=_[_0x804b('0x35')](_0x5e8f85[_0x804b('0x31')],qs[_0x804b('0x37')](_0x57b8da[_0x804b('0x32')][_0x804b('0x37')]));_0x471c04[_0x804b('0x36')]=_0x471c04[_0x804b('0x36')][_0x804b('0x38')]?_0x471c04[_0x804b('0x36')]:_0x5e8f85[_0x804b('0x31')];if(!_0x57b8da[_0x804b('0x32')][_0x804b('0x39')]('nolimit')){_0x471c04['limit']=qs['limit'](_0x57b8da[_0x804b('0x32')][_0x804b('0x1d')]);_0x471c04[_0x804b('0x1c')]=qs['offset'](_0x57b8da['query']['offset']);}_0x471c04[_0x804b('0x3a')]=qs[_0x804b('0x3b')](_0x57b8da[_0x804b('0x32')][_0x804b('0x3b')]);_0x471c04[_0x804b('0x3c')]=qs[_0x804b('0x34')](_[_0x804b('0x3d')](_0x57b8da[_0x804b('0x32')],_0x5e8f85[_0x804b('0x34')]),_0x37dd3e);if(_0x57b8da[_0x804b('0x32')][_0x804b('0x3e')]){_0x471c04[_0x804b('0x3c')]=_[_0x804b('0x3f')](_0x471c04['where'],{'$or':_[_0x804b('0x2c')](_0x37dd3e,function(_0x4654f4){if(_0x4654f4[_0x804b('0x2f')]!==_0x804b('0x40')){var _0x62cfee={};_0x62cfee[_0x4654f4['name']]={'$like':'%'+_0x57b8da['query'][_0x804b('0x3e')]+'%'};return _0x62cfee;}})});}_0x471c04=_[_0x804b('0x3f')]({},_0x471c04,_0x57b8da[_0x804b('0x41')]);var _0x5206f9={'where':_0x471c04[_0x804b('0x3c')]};return db['Tag'][_0x804b('0x1f')](_0x5206f9)[_0x804b('0x24')](function(_0x20ccc7){_0x391376[_0x804b('0x1f')]=_0x20ccc7;if(_0x57b8da[_0x804b('0x32')][_0x804b('0x42')]){_0x471c04[_0x804b('0x43')]=[{'all':!![]}];}return db['Tag'][_0x804b('0x44')](_0x471c04);})[_0x804b('0x24')](function(_0x1dcec8){_0x391376[_0x804b('0x45')]=_0x1dcec8;return _0x391376;})['then'](respondWithFilteredResult(_0x408857,_0x471c04))[_0x804b('0x46')](handleError(_0x408857,null));};exports[_0x804b('0x47')]=function(_0x1df519,_0x1c3d93){var _0x320aeb={'raw':!![],'where':{'id':_0x1df519[_0x804b('0x48')]['id']}},_0xbca498={};_0xbca498[_0x804b('0x31')]=_['keys'](db[_0x804b('0x2d')]['rawAttributes']);_0xbca498['query']=_['keys'](_0x1df519[_0x804b('0x32')]);_0xbca498['filters']=_[_0x804b('0x35')](_0xbca498[_0x804b('0x31')],_0xbca498[_0x804b('0x32')]);_0x320aeb[_0x804b('0x36')]=_['intersection'](_0xbca498[_0x804b('0x31')],qs[_0x804b('0x37')](_0x1df519[_0x804b('0x32')]['fields']));_0x320aeb[_0x804b('0x36')]=_0x320aeb[_0x804b('0x36')][_0x804b('0x38')]?_0x320aeb['attributes']:_0xbca498[_0x804b('0x31')];if(_0x1df519[_0x804b('0x32')][_0x804b('0x42')]){_0x320aeb[_0x804b('0x43')]=[{'all':!![]}];}_0x320aeb=_[_0x804b('0x3f')]({},_0x320aeb,_0x1df519[_0x804b('0x41')]);return db[_0x804b('0x2d')][_0x804b('0x49')](_0x320aeb)[_0x804b('0x24')](handleEntityNotFound(_0x1c3d93,null))[_0x804b('0x24')](respondWithResult(_0x1c3d93,null))[_0x804b('0x46')](handleError(_0x1c3d93,null));};exports[_0x804b('0x4a')]=function(_0x20862f,_0x2c1796){return db['Tag']['create'](_0x20862f[_0x804b('0x4b')],{})[_0x804b('0x24')](function(_0x82fc71){var _0x53124f=_0x20862f[_0x804b('0x4c')]['get']({'plain':!![]});if(!_0x53124f)throw new Error(_0x804b('0x4d'));if(_0x53124f[_0x804b('0x4e')]===_0x804b('0x4c')){var _0x3ca9ff=_0x82fc71[_0x804b('0x4f')]({'plain':!![]});var _0x111e3f='Tags';return db['UserProfileSection'][_0x804b('0x49')]({'where':{'name':_0x111e3f,'userProfileId':_0x53124f[_0x804b('0x50')]},'raw':!![]})['then'](function(_0x5103b7){if(_0x5103b7&&_0x5103b7[_0x804b('0x51')]===0x0){return db[_0x804b('0x52')][_0x804b('0x4a')]({'name':_0x3ca9ff['name'],'resourceId':_0x3ca9ff['id'],'type':_0x5103b7[_0x804b('0x29')],'sectionId':_0x5103b7['id']},{})[_0x804b('0x24')](function(){return _0x82fc71;});}else{return _0x82fc71;}})['catch'](function(_0x2756de){logger['error'](_0x804b('0x53'),_0x2756de);throw _0x2756de;});}return _0x82fc71;})['then'](respondWithResult(_0x2c1796,0xc9))[_0x804b('0x46')](handleError(_0x2c1796,null));};exports[_0x804b('0x54')]=function(_0x47c835,_0x2f9360){if(_0x47c835['body']['id']){delete _0x47c835[_0x804b('0x4b')]['id'];}return db[_0x804b('0x2d')][_0x804b('0x49')]({'where':{'id':_0x47c835[_0x804b('0x48')]['id']}})[_0x804b('0x24')](handleEntityNotFound(_0x2f9360,null))[_0x804b('0x24')](saveUpdates(_0x47c835[_0x804b('0x4b')],null))[_0x804b('0x24')](respondWithResult(_0x2f9360,null))[_0x804b('0x46')](handleError(_0x2f9360,null));};exports[_0x804b('0x25')]=function(_0x5d53f9,_0x53b91d){return db[_0x804b('0x2d')]['find']({'where':{'id':_0x5d53f9['params']['id']}})[_0x804b('0x24')](handleEntityNotFound(_0x53b91d,null))[_0x804b('0x24')](removeEntity(_0x53b91d,null))[_0x804b('0x46')](handleError(_0x53b91d,null));}; \ No newline at end of file +var _0x99e9=['show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch'];(function(_0xd7d3fa,_0x452c8e){var _0x4e3d24=function(_0x1dcb58){while(--_0x1dcb58){_0xd7d3fa['push'](_0xd7d3fa['shift']());}};_0x4e3d24(++_0x452c8e);}(_0x99e9,0xb4));var _0x999e=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x99e9[_0x286bfb];return _0x52b683;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x999e('0x0'));var zipdir=require(_0x999e('0x1'));var jsonpatch=require(_0x999e('0x2'));var rp=require(_0x999e('0x3'));var moment=require('moment');var BPromise=require(_0x999e('0x4'));var Mustache=require(_0x999e('0x5'));var util=require(_0x999e('0x6'));var path=require('path');var sox=require(_0x999e('0x7'));var csv=require('to-csv');var ejs=require(_0x999e('0x8'));var fs=require('fs');var fs_extra=require(_0x999e('0x9'));var _=require(_0x999e('0xa'));var squel=require(_0x999e('0xb'));var crypto=require('crypto');var jsforce=require(_0x999e('0xc'));var deskjs=require(_0x999e('0xd'));var toCsv=require(_0x999e('0xe'));var querystring=require(_0x999e('0xf'));var Papa=require(_0x999e('0x10'));var Redis=require(_0x999e('0x11'));var authService=require(_0x999e('0x12'));var qs=require(_0x999e('0x13'));var as=require(_0x999e('0x14'));var hardwareService=require(_0x999e('0x15'));var logger=require(_0x999e('0x16'))(_0x999e('0x17'));var utils=require(_0x999e('0x18'));var config=require(_0x999e('0x19'));var licenseUtil=require(_0x999e('0x1a'));var db=require(_0x999e('0x1b'))['db'];function respondWithStatusCode(_0x26b55a,_0x47a3c1){_0x47a3c1=_0x47a3c1||0xcc;return function(_0x15f771){if(_0x15f771){return _0x26b55a['sendStatus'](_0x47a3c1);}return _0x26b55a[_0x999e('0x1c')](_0x47a3c1)[_0x999e('0x1d')]();};}function respondWithResult(_0x2fbc3e,_0x538a92){_0x538a92=_0x538a92||0xc8;return function(_0x28bdd1){if(_0x28bdd1){return _0x2fbc3e['status'](_0x538a92)[_0x999e('0x1e')](_0x28bdd1);}};}function respondWithFilteredResult(_0x539598,_0x549ad4){return function(_0x1eee64){if(_0x1eee64){var _0x22feac=typeof _0x549ad4[_0x999e('0x1f')]===_0x999e('0x20')&&typeof _0x549ad4[_0x999e('0x21')]===_0x999e('0x20');var _0x4aac66=_0x1eee64['count'];var _0x4fcdfb=_0x22feac?0x0:_0x549ad4[_0x999e('0x1f')];var _0x43b09e=_0x22feac?_0x1eee64[_0x999e('0x22')]:_0x549ad4[_0x999e('0x1f')]+_0x549ad4[_0x999e('0x21')];var _0x3ece5e;if(_0x43b09e>=_0x4aac66){_0x43b09e=_0x4aac66;_0x3ece5e=0xc8;}else{_0x3ece5e=0xce;}_0x539598['status'](_0x3ece5e);return _0x539598['set'](_0x999e('0x23'),_0x4fcdfb+'-'+_0x43b09e+'/'+_0x4aac66)[_0x999e('0x1e')](_0x1eee64);}return null;};}function patchUpdates(_0x3b3642){return function(_0x510fa2){try{jsonpatch[_0x999e('0x24')](_0x510fa2,_0x3b3642,!![]);}catch(_0x42e167){return BPromise[_0x999e('0x25')](_0x42e167);}return _0x510fa2[_0x999e('0x26')]();};}function saveUpdates(_0x373b80,_0x3750a0){return function(_0x427bcf){if(_0x427bcf){return _0x427bcf['update'](_0x373b80)['then'](function(_0x11a6bf){return _0x11a6bf;});}return null;};}function removeEntity(_0x4f0091,_0x4c5491){return function(_0x452acd){if(_0x452acd){return _0x452acd[_0x999e('0x27')]()[_0x999e('0x28')](function(){var _0x13027c=_0x452acd[_0x999e('0x29')]({'plain':!![]});var _0x320634='Tags';return db[_0x999e('0x2a')][_0x999e('0x27')]({'where':{'type':_0x320634,'resourceId':_0x13027c['id']}})[_0x999e('0x28')](function(){return _0x452acd;});})[_0x999e('0x28')](function(){_0x4f0091[_0x999e('0x1c')](0xcc)[_0x999e('0x1d')]();});}};}function handleEntityNotFound(_0x44b790,_0x5798f3){return function(_0x28f803){if(!_0x28f803){_0x44b790['sendStatus'](0x194);}return _0x28f803;};}function handleError(_0x4fed13,_0x3dff6b){_0x3dff6b=_0x3dff6b||0x1f4;return function(_0x1059bd){logger[_0x999e('0x2b')](_0x1059bd['stack']);if(_0x1059bd[_0x999e('0x2c')]){delete _0x1059bd[_0x999e('0x2c')];}_0x4fed13[_0x999e('0x1c')](_0x3dff6b)[_0x999e('0x2d')](_0x1059bd);};}exports[_0x999e('0x2e')]=function(_0x327079,_0x82e067){var _0x2e9b0e={},_0x27102b={},_0x3ddacb={'count':0x0,'rows':[]};var _0x53ece1=_[_0x999e('0x2f')](db[_0x999e('0x30')][_0x999e('0x31')],function(_0x4c2ce8){return{'name':_0x4c2ce8[_0x999e('0x32')],'type':_0x4c2ce8['type']['key']};});_0x27102b[_0x999e('0x33')]=_[_0x999e('0x2f')](_0x53ece1,'name');_0x27102b['query']=_[_0x999e('0x34')](_0x327079[_0x999e('0x35')]);_0x27102b[_0x999e('0x36')]=_[_0x999e('0x37')](_0x27102b['model'],_0x27102b[_0x999e('0x35')]);_0x2e9b0e[_0x999e('0x38')]=_[_0x999e('0x37')](_0x27102b[_0x999e('0x33')],qs['fields'](_0x327079['query'][_0x999e('0x39')]));_0x2e9b0e['attributes']=_0x2e9b0e[_0x999e('0x38')][_0x999e('0x3a')]?_0x2e9b0e[_0x999e('0x38')]:_0x27102b[_0x999e('0x33')];if(!_0x327079['query'][_0x999e('0x3b')](_0x999e('0x3c'))){_0x2e9b0e['limit']=qs['limit'](_0x327079[_0x999e('0x35')]['limit']);_0x2e9b0e[_0x999e('0x1f')]=qs['offset'](_0x327079['query']['offset']);}_0x2e9b0e['order']=qs[_0x999e('0x3d')](_0x327079['query'][_0x999e('0x3d')]);_0x2e9b0e['where']=qs['filters'](_['pick'](_0x327079[_0x999e('0x35')],_0x27102b[_0x999e('0x36')]),_0x53ece1);if(_0x327079[_0x999e('0x35')][_0x999e('0x3e')]){_0x2e9b0e[_0x999e('0x3f')]=_[_0x999e('0x40')](_0x2e9b0e[_0x999e('0x3f')],{'$or':_[_0x999e('0x2f')](_0x53ece1,function(_0x54866a){if(_0x54866a[_0x999e('0x41')]!==_0x999e('0x42')){var _0x1e1229={};_0x1e1229[_0x54866a[_0x999e('0x2c')]]={'$like':'%'+_0x327079['query'][_0x999e('0x3e')]+'%'};return _0x1e1229;}})});}_0x2e9b0e=_['merge']({},_0x2e9b0e,_0x327079[_0x999e('0x43')]);var _0x35b318={'where':_0x2e9b0e[_0x999e('0x3f')]};return db[_0x999e('0x30')]['count'](_0x35b318)[_0x999e('0x28')](function(_0x108c96){_0x3ddacb[_0x999e('0x22')]=_0x108c96;if(_0x327079['query']['includeAll']){_0x2e9b0e[_0x999e('0x44')]=[{'all':!![]}];}return db[_0x999e('0x30')][_0x999e('0x45')](_0x2e9b0e);})[_0x999e('0x28')](function(_0x1009a0){_0x3ddacb[_0x999e('0x46')]=_0x1009a0;return _0x3ddacb;})[_0x999e('0x28')](respondWithFilteredResult(_0x82e067,_0x2e9b0e))[_0x999e('0x47')](handleError(_0x82e067,null));};exports[_0x999e('0x48')]=function(_0xf4fa,_0x55da0b){var _0x4c8b36={'raw':!![],'where':{'id':_0xf4fa[_0x999e('0x49')]['id']}},_0xa5742d={};_0xa5742d[_0x999e('0x33')]=_[_0x999e('0x34')](db[_0x999e('0x30')][_0x999e('0x31')]);_0xa5742d['query']=_[_0x999e('0x34')](_0xf4fa['query']);_0xa5742d['filters']=_[_0x999e('0x37')](_0xa5742d['model'],_0xa5742d['query']);_0x4c8b36['attributes']=_['intersection'](_0xa5742d[_0x999e('0x33')],qs[_0x999e('0x39')](_0xf4fa['query'][_0x999e('0x39')]));_0x4c8b36[_0x999e('0x38')]=_0x4c8b36[_0x999e('0x38')]['length']?_0x4c8b36['attributes']:_0xa5742d[_0x999e('0x33')];if(_0xf4fa[_0x999e('0x35')][_0x999e('0x4a')]){_0x4c8b36['include']=[{'all':!![]}];}_0x4c8b36=_['merge']({},_0x4c8b36,_0xf4fa['options']);return db['Tag'][_0x999e('0x4b')](_0x4c8b36)['then'](handleEntityNotFound(_0x55da0b,null))['then'](respondWithResult(_0x55da0b,null))[_0x999e('0x47')](handleError(_0x55da0b,null));};exports[_0x999e('0x4c')]=function(_0x5843f1,_0xa50dc6){return db[_0x999e('0x30')]['create'](_0x5843f1[_0x999e('0x4d')],{})['then'](function(_0x9322ca){var _0x42dfea=_0x5843f1['user'][_0x999e('0x29')]({'plain':!![]});if(!_0x42dfea)throw new Error(_0x999e('0x4e'));if(_0x42dfea['role']==='user'){var _0x254292=_0x9322ca['get']({'plain':!![]});var _0x5ebc95='Tags';return db[_0x999e('0x4f')][_0x999e('0x4b')]({'where':{'name':_0x5ebc95,'userProfileId':_0x42dfea[_0x999e('0x50')]},'raw':!![]})[_0x999e('0x28')](function(_0x37c3ff){if(_0x37c3ff&&_0x37c3ff[_0x999e('0x51')]===0x0){return db['UserProfileResource'][_0x999e('0x4c')]({'name':_0x254292[_0x999e('0x2c')],'resourceId':_0x254292['id'],'type':_0x37c3ff['name'],'sectionId':_0x37c3ff['id']},{})[_0x999e('0x28')](function(){return _0x9322ca;});}else{return _0x9322ca;}})[_0x999e('0x47')](function(_0x4169eb){logger[_0x999e('0x2b')](_0x999e('0x52'),_0x4169eb);throw _0x4169eb;});}return _0x9322ca;})[_0x999e('0x28')](respondWithResult(_0xa50dc6,0xc9))[_0x999e('0x47')](handleError(_0xa50dc6,null));};exports[_0x999e('0x53')]=function(_0x290c7a,_0x53932a){if(_0x290c7a[_0x999e('0x4d')]['id']){delete _0x290c7a[_0x999e('0x4d')]['id'];}return db[_0x999e('0x30')][_0x999e('0x4b')]({'where':{'id':_0x290c7a['params']['id']}})[_0x999e('0x28')](handleEntityNotFound(_0x53932a,null))[_0x999e('0x28')](saveUpdates(_0x290c7a[_0x999e('0x4d')],null))[_0x999e('0x28')](respondWithResult(_0x53932a,null))[_0x999e('0x47')](handleError(_0x53932a,null));};exports[_0x999e('0x27')]=function(_0x3f5790,_0x1a6925){return db['Tag']['find']({'where':{'id':_0x3f5790[_0x999e('0x49')]['id']}})[_0x999e('0x28')](handleEntityNotFound(_0x1a6925,null))[_0x999e('0x28')](removeEntity(_0x1a6925,null))[_0x999e('0x47')](handleError(_0x1a6925,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9709edc..7e49a11 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 _0x19df=['./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x19df,0x10f));var _0xf19d=function(_0x25ad66,_0x46e4dc){_0x25ad66=_0x25ad66-0x0;var _0x141bc4=_0x19df[_0x25ad66];return _0x141bc4;};'use strict';var _=require(_0xf19d('0x0'));var util=require(_0xf19d('0x1'));var logger=require(_0xf19d('0x2'))(_0xf19d('0x3'));var moment=require(_0xf19d('0x4'));var BPromise=require(_0xf19d('0x5'));var rp=require(_0xf19d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf19d('0x7'));var config=require(_0xf19d('0x8'));var attributes=require(_0xf19d('0x9'));module[_0xf19d('0xa')]=function(_0x203915,_0x19d1ff){return _0x203915[_0xf19d('0xb')](_0xf19d('0xc'),attributes,{'tableName':_0xf19d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa12=['define','tools_tags','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x34ee59,_0x46f5d6){var _0xf772bd=function(_0x40e8b0){while(--_0x40e8b0){_0x34ee59['push'](_0x34ee59['shift']());}};_0xf772bd(++_0x46f5d6);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x1c9eb1,_0x2245a1){_0x1c9eb1=_0x1c9eb1-0x0;var _0x6acb80=_0xfa12[_0x1c9eb1];return _0x6acb80;};'use strict';var _=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var logger=require('../../config/logger')(_0x2fa1('0x2'));var moment=require(_0x2fa1('0x3'));var BPromise=require(_0x2fa1('0x4'));var rp=require(_0x2fa1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fa1('0x6'));var config=require(_0x2fa1('0x7'));var attributes=require(_0x2fa1('0x8'));module[_0x2fa1('0x9')]=function(_0x4d61b0,_0x166949){return _0x4d61b0[_0x2fa1('0xa')]('Tag',attributes,{'tableName':_0x2fa1('0xb'),'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 092d86b..9d9b198 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 _0x79a8=['message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x79a8,0x1d0));var _0x879a=function(_0x4e1926,_0x2415d6){_0x4e1926=_0x4e1926-0x0;var _0x85fa41=_0x79a8[_0x4e1926];return _0x85fa41;};'use strict';var _=require(_0x879a('0x0'));var util=require('util');var moment=require(_0x879a('0x1'));var BPromise=require(_0x879a('0x2'));var rs=require(_0x879a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x879a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x879a('0x5'))(_0x879a('0x6'));var config=require(_0x879a('0x7'));var jayson=require(_0x879a('0x8'));var client=jayson[_0x879a('0x9')][_0x879a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d353e,_0x2427bf,_0x4bf3ab){return new BPromise(function(_0xe27fe6,_0x5cb5c9){return client[_0x879a('0xb')](_0x1d353e,_0x4bf3ab)[_0x879a('0xc')](function(_0x5eba04){logger[_0x879a('0xd')](_0x879a('0xe'),_0x2427bf,_0x879a('0xf'));logger['debug'](_0x879a('0x10'),_0x2427bf,_0x879a('0xf'),JSON['stringify'](_0x5eba04));if(_0x5eba04['error']){if(_0x5eba04[_0x879a('0x11')][_0x879a('0x12')]===0x1f4){logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x5eba04['error'][_0x879a('0x13')]);return _0x5cb5c9(_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);}logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);return _0xe27fe6(_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);}else{logger[_0x879a('0xd')]('Tag,\x20%s,\x20%s',_0x2427bf,'request\x20sent');_0xe27fe6(_0x5eba04[_0x879a('0x14')][_0x879a('0x13')]);}})['catch'](function(_0x119260){logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x119260);_0x5cb5c9(_0x119260);});});} \ No newline at end of file +var _0x9a19=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x9a19,0x114));var _0x99a1=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x9a19[_0x79b649];return _0x1af9b1;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('Tag,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 05b2e1f..245f6fc 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 51eadac..93a5276 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(_0x2eef80,_0x241f70){var _0x4bdd07=function(_0xf6c6db){while(--_0xf6c6db){_0x2eef80['push'](_0x2eef80['shift']());}};_0x4bdd07(++_0x241f70);}(_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 _0x0713=['STRING','name'];(function(_0x129dc1,_0x785084){var _0x5d9862=function(_0x5f1495){while(--_0x5f1495){_0x129dc1['push'](_0x129dc1['shift']());}};_0x5d9862(++_0x785084);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 4887a2b..b4218ba 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 _0x0171=['status','json','offset','undefined','limit','count','set','then','error','name','send','index','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','rows','catch','show','params','intersection','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','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','MailQueueId','UserMailQueue','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','end','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','add','removeQueues','isValidChannel','remove','ids','addAgents','isArray','Voice','Sms','Fax','penalty','QueueId','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','upsert','spread','removeAgents','Openchannel','Whatsapp','Queue:remove','VoicePrefixId','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus'];(function(_0x32e9b,_0x247979){var _0x1ba091=function(_0x2da97f){while(--_0x2da97f){_0x32e9b['push'](_0x32e9b['shift']());}};_0x1ba091(++_0x247979);}(_0x0171,0x1a1));var _0x1017=function(_0x90193f,_0x2689f2){_0x90193f=_0x90193f-0x0;var _0x4cba91=_0x0171[_0x90193f];return _0x4cba91;};'use strict';var emlformat=require(_0x1017('0x0'));var rimraf=require(_0x1017('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1017('0x2'));var rp=require('request-promise');var moment=require(_0x1017('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1017('0x4'));var util=require(_0x1017('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1017('0x6'));var ejs=require(_0x1017('0x7'));var fs=require('fs');var fs_extra=require(_0x1017('0x8'));var _=require(_0x1017('0x9'));var squel=require(_0x1017('0xa'));var crypto=require(_0x1017('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1017('0xc'));var toCsv=require(_0x1017('0x6'));var querystring=require(_0x1017('0xd'));var Papa=require(_0x1017('0xe'));var Redis=require(_0x1017('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1017('0x10'));var as=require(_0x1017('0x11'));var hardwareService=require(_0x1017('0x12'));var logger=require(_0x1017('0x13'))('api');var utils=require(_0x1017('0x14'));var config=require(_0x1017('0x15'));var licenseUtil=require(_0x1017('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1017('0x17')](config[_0x1017('0x18')],{'host':_0x1017('0x19'),'port':0x18eb});var socket=require(_0x1017('0x1a'))(new Redis(config[_0x1017('0x18')]));require(_0x1017('0x1b'))[_0x1017('0x1c')](socket);function respondWithStatusCode(_0x3200a0,_0x180b4c){_0x180b4c=_0x180b4c||0xcc;return function(_0x4cedc9){if(_0x4cedc9){return _0x3200a0[_0x1017('0x1d')](_0x180b4c);}return _0x3200a0['status'](_0x180b4c)['end']();};}function respondWithResult(_0x1e47e9,_0x356afd){_0x356afd=_0x356afd||0xc8;return function(_0x5c138d){if(_0x5c138d){return _0x1e47e9[_0x1017('0x1e')](_0x356afd)[_0x1017('0x1f')](_0x5c138d);}};}function respondWithFilteredResult(_0x1c2dd2,_0x17bf3f){return function(_0x58e052){if(_0x58e052){var _0x4ceb63=typeof _0x17bf3f[_0x1017('0x20')]===_0x1017('0x21')&&typeof _0x17bf3f[_0x1017('0x22')]==='undefined';var _0x2c0070=_0x58e052['count'];var _0x439610=_0x4ceb63?0x0:_0x17bf3f[_0x1017('0x20')];var _0x172951=_0x4ceb63?_0x58e052[_0x1017('0x23')]:_0x17bf3f[_0x1017('0x20')]+_0x17bf3f[_0x1017('0x22')];var _0x481502;if(_0x172951>=_0x2c0070){_0x172951=_0x2c0070;_0x481502=0xc8;}else{_0x481502=0xce;}_0x1c2dd2[_0x1017('0x1e')](_0x481502);return _0x1c2dd2[_0x1017('0x24')]('Content-Range',_0x439610+'-'+_0x172951+'/'+_0x2c0070)['json'](_0x58e052);}return null;};}function patchUpdates(_0x1be7c7){return function(_0x525760){try{jsonpatch['apply'](_0x525760,_0x1be7c7,!![]);}catch(_0x1d1347){return BPromise['reject'](_0x1d1347);}return _0x525760['save']();};}function saveUpdates(_0x3a70d5,_0x26b77c){return function(_0x19dda1){if(_0x19dda1){return _0x19dda1['update'](_0x3a70d5)[_0x1017('0x25')](function(_0x535c5f){return _0x535c5f;});}return null;};}function handleEntityNotFound(_0x5abd96,_0x384d8c){return function(_0x5dc81f){if(!_0x5dc81f){_0x5abd96['sendStatus'](0x194);}return _0x5dc81f;};}function handleError(_0x5c6a96,_0x3fdc3f){_0x3fdc3f=_0x3fdc3f||0x1f4;return function(_0xe0afe1){logger[_0x1017('0x26')](_0xe0afe1['stack']);if(_0xe0afe1[_0x1017('0x27')]){delete _0xe0afe1[_0x1017('0x27')];}_0x5c6a96[_0x1017('0x1e')](_0x3fdc3f)[_0x1017('0x28')](_0xe0afe1);};}exports[_0x1017('0x29')]=function(_0x10142c,_0x101143){var _0xb963db={},_0xdf6d85={},_0x3c98bb={'count':0x0,'rows':[]};var _0x4970a9=_[_0x1017('0x2a')](db[_0x1017('0x2b')][_0x1017('0x2c')],function(_0x35fce8){return{'name':_0x35fce8[_0x1017('0x2d')],'type':_0x35fce8['type'][_0x1017('0x2e')]};});_0xdf6d85[_0x1017('0x2f')]=_[_0x1017('0x2a')](_0x4970a9,_0x1017('0x27'));_0xdf6d85[_0x1017('0x30')]=_[_0x1017('0x31')](_0x10142c[_0x1017('0x30')]);_0xdf6d85[_0x1017('0x32')]=_['intersection'](_0xdf6d85[_0x1017('0x2f')],_0xdf6d85[_0x1017('0x30')]);_0xb963db[_0x1017('0x33')]=_['intersection'](_0xdf6d85[_0x1017('0x2f')],qs[_0x1017('0x34')](_0x10142c[_0x1017('0x30')][_0x1017('0x34')]));_0xb963db[_0x1017('0x33')]=_0xb963db[_0x1017('0x33')]['length']?_0xb963db[_0x1017('0x33')]:_0xdf6d85[_0x1017('0x2f')];if(!_0x10142c['query'][_0x1017('0x35')](_0x1017('0x36'))){_0xb963db[_0x1017('0x22')]=qs['limit'](_0x10142c[_0x1017('0x30')][_0x1017('0x22')]);_0xb963db[_0x1017('0x20')]=qs[_0x1017('0x20')](_0x10142c[_0x1017('0x30')][_0x1017('0x20')]);}_0xb963db[_0x1017('0x37')]=qs[_0x1017('0x38')](_0x10142c[_0x1017('0x30')][_0x1017('0x38')]);_0xb963db[_0x1017('0x39')]=qs['filters'](_[_0x1017('0x3a')](_0x10142c[_0x1017('0x30')],_0xdf6d85[_0x1017('0x32')]),_0x4970a9);if(_0x10142c['query']['filter']){_0xb963db[_0x1017('0x39')]=_[_0x1017('0x3b')](_0xb963db[_0x1017('0x39')],{'$or':_[_0x1017('0x2a')](_0x4970a9,function(_0x5d7157){if(_0x5d7157[_0x1017('0x3c')]!=='VIRTUAL'){var _0x113ead={};_0x113ead[_0x5d7157[_0x1017('0x27')]]={'$like':'%'+_0x10142c[_0x1017('0x30')][_0x1017('0x3d')]+'%'};return _0x113ead;}})});}_0xb963db=_[_0x1017('0x3b')]({},_0xb963db,_0x10142c[_0x1017('0x3e')]);var _0x3b9160={'where':_0xb963db['where']};return db[_0x1017('0x2b')][_0x1017('0x23')](_0x3b9160)[_0x1017('0x25')](function(_0xb523e5){_0x3c98bb[_0x1017('0x23')]=_0xb523e5;if(_0x10142c[_0x1017('0x30')][_0x1017('0x3f')]){_0xb963db[_0x1017('0x40')]=[{'all':!![]}];}return db[_0x1017('0x2b')]['findAll'](_0xb963db);})[_0x1017('0x25')](function(_0x1f395c){_0x3c98bb[_0x1017('0x41')]=_0x1f395c;return _0x3c98bb;})[_0x1017('0x25')](respondWithFilteredResult(_0x101143,_0xb963db))[_0x1017('0x42')](handleError(_0x101143,null));};exports[_0x1017('0x43')]=function(_0x3cf98e,_0x42c131){var _0x31d9a1={'raw':![],'where':{'id':_0x3cf98e[_0x1017('0x44')]['id']}},_0x5ccef6={};_0x5ccef6['model']=_[_0x1017('0x31')](db[_0x1017('0x2b')][_0x1017('0x2c')]);_0x5ccef6[_0x1017('0x30')]=_[_0x1017('0x31')](_0x3cf98e[_0x1017('0x30')]);_0x5ccef6[_0x1017('0x32')]=_[_0x1017('0x45')](_0x5ccef6[_0x1017('0x2f')],_0x5ccef6[_0x1017('0x30')]);_0x31d9a1[_0x1017('0x33')]=_['intersection'](_0x5ccef6[_0x1017('0x2f')],qs[_0x1017('0x34')](_0x3cf98e[_0x1017('0x30')][_0x1017('0x34')]));_0x31d9a1[_0x1017('0x33')]=_0x31d9a1[_0x1017('0x33')][_0x1017('0x46')]?_0x31d9a1[_0x1017('0x33')]:_0x5ccef6[_0x1017('0x2f')];if(_0x3cf98e[_0x1017('0x30')]['includeAll']){_0x31d9a1[_0x1017('0x40')]=[{'all':!![]}];}_0x31d9a1=_[_0x1017('0x3b')]({},_0x31d9a1,_0x3cf98e['options']);return db[_0x1017('0x2b')]['find'](_0x31d9a1)['then'](handleEntityNotFound(_0x42c131,null))['then'](respondWithResult(_0x42c131,null))['catch'](handleError(_0x42c131,null));};exports[_0x1017('0x47')]=function(_0x305305,_0x389b9d){return db[_0x1017('0x2b')][_0x1017('0x47')](_0x305305[_0x1017('0x48')],{})['then'](function(_0x159699){var _0x20e09c=_0x305305[_0x1017('0x49')][_0x1017('0x4a')]({'plain':!![]});if(!_0x20e09c)throw new Error(_0x1017('0x4b'));if(_0x20e09c['role']==='user'){var _0x2d05fb=_0x159699[_0x1017('0x4a')]({'plain':!![]});var _0x4a1e0d=_0x1017('0x4c');return db[_0x1017('0x4d')][_0x1017('0x4e')]({'where':{'name':_0x4a1e0d,'userProfileId':_0x20e09c[_0x1017('0x4f')]},'raw':!![]})['then'](function(_0xb8caa3){if(_0xb8caa3&&_0xb8caa3[_0x1017('0x50')]===0x0){return db[_0x1017('0x51')][_0x1017('0x47')]({'name':_0x2d05fb[_0x1017('0x27')],'resourceId':_0x2d05fb['id'],'type':_0xb8caa3['name'],'sectionId':_0xb8caa3['id']},{})[_0x1017('0x25')](function(){return _0x159699;});}else{return _0x159699;}})[_0x1017('0x42')](function(_0x35ae24){logger[_0x1017('0x26')](_0x1017('0x52'),_0x35ae24);throw _0x35ae24;});}return _0x159699;})[_0x1017('0x25')](respondWithResult(_0x389b9d,0xc9))['catch'](handleError(_0x389b9d,null));};exports[_0x1017('0x53')]=function(_0x318610,_0x2ebce0){if(_0x318610[_0x1017('0x48')]['id']){delete _0x318610['body']['id'];}return db[_0x1017('0x2b')]['find']({'where':{'id':_0x318610[_0x1017('0x44')]['id']}})[_0x1017('0x25')](handleEntityNotFound(_0x2ebce0,null))[_0x1017('0x25')](saveUpdates(_0x318610[_0x1017('0x48')],null))[_0x1017('0x25')](respondWithResult(_0x2ebce0,null))[_0x1017('0x42')](handleError(_0x2ebce0,null));};exports[_0x1017('0x54')]=function(_0x101e6b,_0x55246a){var _0x27a6ee=_0x101e6b[_0x1017('0x44')]['id'];var _0x2eaec6=[];return db[_0x1017('0x55')][_0x1017('0x56')](function(_0x56ae63){var _0xedd168=_0x1017('0x57')+_0x27a6ee;return db['sequelize'][_0x1017('0x30')](_0xedd168,{'type':db[_0x1017('0x58')][_0x1017('0x59')][_0x1017('0x5a')],'raw':!![],'transaction':_0x56ae63})[_0x1017('0x25')](function(_0x502014){_0x2eaec6=_[_0x1017('0x2a')](_0x502014,function(_0x25616a){return Number(_0x25616a[_0x1017('0x5b')]);});})[_0x1017('0x25')](function(){var _0x5cbd3e=_0x1017('0x5c')+_0x27a6ee;return db[_0x1017('0x55')][_0x1017('0x30')](_0x5cbd3e,{'type':db[_0x1017('0x58')]['QueryTypes'][_0x1017('0x5a')],'raw':!![],'transaction':_0x56ae63});})[_0x1017('0x25')](function(_0xa42bd0){var _0x2ab8f0=_[_0x1017('0x2a')](_0xa42bd0,function(_0x456dd0){return Number(_0x456dd0[_0x1017('0x5d')]);});return db[_0x1017('0x5e')][_0x1017('0x54')]({'where':{'UserId':{'$in':_0x2eaec6},'VoiceQueueId':{'$in':_0x2ab8f0}},'transaction':_0x56ae63});})[_0x1017('0x25')](function(){var _0x5d238b=_0x1017('0x5f')+_0x27a6ee;return db['sequelize'][_0x1017('0x30')](_0x5d238b,{'type':db['Sequelize'][_0x1017('0x59')][_0x1017('0x5a')],'raw':!![],'transaction':_0x56ae63});})[_0x1017('0x25')](function(_0x879fc7){var _0x529e73=_[_0x1017('0x2a')](_0x879fc7,function(_0x1fcf54){return Number(_0x1fcf54[_0x1017('0x60')]);});return db[_0x1017('0x61')][_0x1017('0x54')]({'where':{'UserId':{'$in':_0x2eaec6},'MailQueueId':{'$in':_0x529e73}},'transaction':_0x56ae63});})['then'](function(){var _0x2cc2ac='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x27a6ee;return db['sequelize']['query'](_0x2cc2ac,{'type':db[_0x1017('0x58')][_0x1017('0x59')][_0x1017('0x5a')],'raw':!![],'transaction':_0x56ae63});})[_0x1017('0x25')](function(_0x52d965){var _0x39a6ce=_[_0x1017('0x2a')](_0x52d965,function(_0x1514df){return Number(_0x1514df['SmsQueueId']);});return db[_0x1017('0x62')]['destroy']({'where':{'UserId':{'$in':_0x2eaec6},'SmsQueueId':{'$in':_0x39a6ce}},'transaction':_0x56ae63});})[_0x1017('0x25')](function(){var _0x4f1e13=_0x1017('0x63')+_0x27a6ee;return db[_0x1017('0x55')]['query'](_0x4f1e13,{'type':db[_0x1017('0x58')][_0x1017('0x59')][_0x1017('0x5a')],'raw':!![],'transaction':_0x56ae63});})[_0x1017('0x25')](function(_0x95e01d){var _0x102740=_['map'](_0x95e01d,function(_0x4604d1){return Number(_0x4604d1[_0x1017('0x64')]);});return db['UserChatQueue'][_0x1017('0x54')]({'where':{'UserId':{'$in':_0x2eaec6},'ChatQueueId':{'$in':_0x102740}},'transaction':_0x56ae63});})['then'](function(){var _0x58317b=_0x1017('0x65')+_0x27a6ee;return db[_0x1017('0x55')][_0x1017('0x30')](_0x58317b,{'type':db[_0x1017('0x58')][_0x1017('0x59')][_0x1017('0x5a')],'raw':!![],'transaction':_0x56ae63});})[_0x1017('0x25')](function(_0x1a358c){var _0x5d4f34=_[_0x1017('0x2a')](_0x1a358c,function(_0x146684){return Number(_0x146684[_0x1017('0x66')]);});return db['UserFaxQueue'][_0x1017('0x54')]({'where':{'UserId':{'$in':_0x2eaec6},'FaxQueueId':{'$in':_0x5d4f34}},'transaction':_0x56ae63});})['then'](function(){var _0x3bc669=_0x1017('0x67')+_0x27a6ee;return db['sequelize'][_0x1017('0x30')](_0x3bc669,{'type':db['Sequelize'][_0x1017('0x59')][_0x1017('0x5a')],'raw':!![],'transaction':_0x56ae63});})[_0x1017('0x25')](function(_0x231507){var _0xe29523=_[_0x1017('0x2a')](_0x231507,function(_0x78f80a){return Number(_0x78f80a[_0x1017('0x68')]);});return db['UserOpenchannelQueue'][_0x1017('0x54')]({'where':{'UserId':{'$in':_0x2eaec6},'OpenchannelQueueId':{'$in':_0xe29523}},'transaction':_0x56ae63});})[_0x1017('0x25')](function(){var _0x2b1d89='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x27a6ee;return db[_0x1017('0x55')][_0x1017('0x30')](_0x2b1d89,{'type':db['Sequelize'][_0x1017('0x59')][_0x1017('0x5a')],'raw':!![],'transaction':_0x56ae63});})[_0x1017('0x25')](function(_0x13e092){var _0x1aced0=_[_0x1017('0x2a')](_0x13e092,function(_0x581be2){return Number(_0x581be2[_0x1017('0x69')]);});return db[_0x1017('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x2eaec6},'WhatsappQueueId':{'$in':_0x1aced0}},'transaction':_0x56ae63});})[_0x1017('0x25')](function(){return db['TeamVoicePrefix'][_0x1017('0x4e')]({'where':{'TeamId':_0x27a6ee}});})[_0x1017('0x25')](function(_0x38693b){if(_0x38693b===null){return;}return db['UserVoicePrefix'][_0x1017('0x54')]({'where':{'UserId':{'$in':_0x2eaec6},'VoicePrefixId':_0x38693b['VoicePrefixId']},'transaction':_0x56ae63});})[_0x1017('0x25')](function(){return db[_0x1017('0x2b')]['destroy']({'where':{'id':_0x27a6ee},'cascade':!![],'transaction':_0x56ae63});})[_0x1017('0x25')](function(_0x4620f4){if(_0x4620f4===0x0){_0x55246a[_0x1017('0x1d')](0x194);}else{return db[_0x1017('0x51')][_0x1017('0x54')]({'where':{'type':_0x1017('0x4c'),'resourceId':_0x27a6ee},'cascade':!![],'transaction':_0x56ae63})['then'](function(){_0x55246a[_0x1017('0x1e')](0xcc)[_0x1017('0x6b')]();});}})[_0x1017('0x42')](function(_0x5d8a94){_0x55246a['status'](0x1f4)[_0x1017('0x28')](_0x5d8a94);});});};exports['getQueues']=function(_0x47c9bf,_0x2d35dc,_0x15a33f){return db['Team'][_0x1017('0x6c')]({'where':{'id':_0x47c9bf[_0x1017('0x44')]['id']}})[_0x1017('0x25')](handleEntityNotFound(_0x2d35dc,null))[_0x1017('0x25')](function(_0x3f5838){if(!_0x47c9bf[_0x1017('0x30')][_0x1017('0x6d')]||!utils['isValidChannel'](_0x47c9bf[_0x1017('0x30')][_0x1017('0x6d')])){throw new db['Sequelize'][(_0x1017('0x6e'))](_0x1017('0x6f'));}var _0x50f6ce={};var _0x540f7f={};_0x540f7f[_0x1017('0x2f')]=_[_0x1017('0x31')](db[_[_0x1017('0x70')](_0x47c9bf[_0x1017('0x30')][_0x1017('0x6d')][_0x1017('0x71')]())+_0x1017('0x72')]['rawAttributes']);_0x540f7f[_0x1017('0x30')]=_[_0x1017('0x31')](_0x47c9bf[_0x1017('0x30')]);_0x540f7f[_0x1017('0x32')]=_[_0x1017('0x45')](_0x540f7f[_0x1017('0x2f')],_0x540f7f[_0x1017('0x30')]);_0x50f6ce[_0x1017('0x33')]=_[_0x1017('0x45')](_0x540f7f['model'],qs[_0x1017('0x34')](_0x47c9bf[_0x1017('0x30')][_0x1017('0x34')]));_0x50f6ce['attributes']=_0x50f6ce['attributes'][_0x1017('0x46')]?_0x50f6ce[_0x1017('0x33')]:_0x540f7f[_0x1017('0x2f')];_0x50f6ce['limit']=qs['limit'](_0x47c9bf[_0x1017('0x30')][_0x1017('0x22')]);_0x50f6ce['offset']=qs[_0x1017('0x20')](_0x47c9bf['query'][_0x1017('0x20')]);_0x50f6ce[_0x1017('0x37')]=qs[_0x1017('0x38')](_0x47c9bf[_0x1017('0x30')][_0x1017('0x38')]);_0x50f6ce['where']=qs[_0x1017('0x32')](_['pick'](_0x47c9bf[_0x1017('0x30')],_0x540f7f[_0x1017('0x32')]));_0x50f6ce=_[_0x1017('0x3b')]({},_0x50f6ce,_0x47c9bf[_0x1017('0x3e')]);return _0x3f5838[_0x1017('0x4a')+_[_0x1017('0x70')](_0x47c9bf[_0x1017('0x30')][_0x1017('0x6d')]['toLowerCase']())+_0x1017('0x73')](_0x50f6ce);})[_0x1017('0x25')](respondWithResult(_0x2d35dc,null))['catch'](handleError(_0x2d35dc,null));};exports['addQueues']=function(_0x4166e0,_0x5ad1af,_0x2d9133){return db[_0x1017('0x2b')]['findOne']({'where':{'id':_0x4166e0[_0x1017('0x44')]['id']}})[_0x1017('0x25')](function(_0x5defba){if(_0x5defba){if(!_0x4166e0[_0x1017('0x48')][_0x1017('0x6d')]||!utils['isValidChannel'](_0x4166e0[_0x1017('0x48')][_0x1017('0x6d')])){throw new db[(_0x1017('0x58'))]['ValidationError'](_0x1017('0x6f'));}return _0x5defba[_0x1017('0x74')+_[_0x1017('0x70')](_0x4166e0[_0x1017('0x48')][_0x1017('0x6d')][_0x1017('0x71')]())+'Queues'](_0x4166e0[_0x1017('0x48')]['ids']);}return null;})['then'](handleEntityNotFound(_0x5ad1af,null))[_0x1017('0x25')](respondWithStatusCode(_0x5ad1af,null))[_0x1017('0x42')](handleError(_0x5ad1af,null));};exports[_0x1017('0x75')]=function(_0x204874,_0x3f4231,_0x39d3ea){return db[_0x1017('0x2b')][_0x1017('0x6c')]({'where':{'id':_0x204874['params']['id']}})[_0x1017('0x25')](function(_0x14df07){if(_0x14df07){if(!_0x204874[_0x1017('0x30')][_0x1017('0x6d')]||!utils[_0x1017('0x76')](_0x204874[_0x1017('0x30')][_0x1017('0x6d')])){throw new db['Sequelize'][(_0x1017('0x6e'))](_0x1017('0x6f'));}return _0x14df07[_0x1017('0x77')+_[_0x1017('0x70')](_0x204874[_0x1017('0x30')][_0x1017('0x6d')][_0x1017('0x71')]())+_0x1017('0x73')](_0x204874[_0x1017('0x30')][_0x1017('0x78')]);}return null;})[_0x1017('0x25')](handleEntityNotFound(_0x3f4231,null))[_0x1017('0x25')](respondWithStatusCode(_0x3f4231,null))['catch'](handleError(_0x3f4231,null));};exports[_0x1017('0x79')]=function(_0x1353bf,_0x16db18){var _0x23a43f=_[_0x1017('0x7a')](_0x1353bf[_0x1017('0x48')][_0x1017('0x78')])?_0x1353bf[_0x1017('0x48')][_0x1017('0x78')]:[_0x1353bf[_0x1017('0x48')]['ids']];var _0x48b05d=_0x1353bf[_0x1017('0x44')]['id'];return db['Team']['find']({'where':{'id':_0x48b05d}})['then'](handleEntityNotFound(_0x16db18,null))['then'](function(_0x2aed68){if(_0x2aed68){var _0x61f62=[_0x1017('0x7b'),'Chat','Mail',_0x1017('0x7c'),_0x1017('0x7d'),'Openchannel','Whatsapp'];return db[_0x1017('0x55')][_0x1017('0x56')](function(_0x1f1c30){var _0x328f61=_[_0x1017('0x2a')](_0x61f62,function(_0x2764c6){var _0x2c9503={'attributes':['id',_0x1017('0x27')]};if(_0x2764c6===_0x1017('0x7b')){_0x2c9503['through']={'attributes':[_0x1017('0x7e')]};}return _0x2aed68[_0x1017('0x4a')+_0x2764c6+'Queues'](_0x2c9503)[_0x1017('0x25')](function(_0x5da8e5){var _0x13c6b1=_[_0x1017('0x2a')](_0x5da8e5,function(_0x13fe50){var _0x5d0ccf=_[_0x1017('0x2a')](_0x23a43f,function(_0x8f1d01){var _0x5d6dfc={'where':{'UserId':_0x8f1d01,[_0x2764c6+_0x1017('0x7f')]:_0x13fe50['id']},'transaction':_0x1f1c30};if(_0x2764c6===_0x1017('0x7b')){_0x5d6dfc[_0x1017('0x17')]={'penalty':_0x13fe50['TeamVoiceQueue'][_0x1017('0x7e')]};}return db[_0x1017('0x80')+_0x2764c6+'Queue'][_0x1017('0x81')](_0x5d6dfc)[_0x1017('0x25')](function(){socket[_0x1017('0x82')](_0x1017('0x49')+_0x2764c6+_0x1017('0x83'),{'UserId':_0x8f1d01,[_0x2764c6+_0x1017('0x7f')]:_0x13fe50['id']});if(_0x2764c6!==_0x1017('0x7b')){return;}return db[_0x1017('0x80')]['findAll']({'where':{'id':_0x23a43f,'online':0x1},'attributes':['id','name',_0x1017('0x84'),_0x1017('0x85'),_0x1017('0x86')],'raw':!![]})[_0x1017('0x25')](function(_0x525561){var _0x29f66d=_['map'](_0x525561,function(_0x5a12d0){return db[_0x1017('0x87')]['upsert']({'membername':_0x5a12d0[_0x1017('0x27')],'UserId':_0x5a12d0['id'],'queue_name':_0x13fe50[_0x1017('0x27')],'VoiceQueueId':_0x13fe50['id'],'interface':_['isNil'](_0x5a12d0[_0x1017('0x86')])?util[_0x1017('0x88')](_0x1017('0x89'),_0x5a12d0[_0x1017('0x27')]):_0x5a12d0[_0x1017('0x86')],'paused':_0x5a12d0[_0x1017('0x85')]||![],'penalty':_0x13fe50[_0x1017('0x8a')][_0x1017('0x7e')]},{'transaction':_0x1f1c30});});return Promise[_0x1017('0x8b')](_0x29f66d);});});});return Promise['all'](_0x5d0ccf);});return Promise[_0x1017('0x8b')](_0x13c6b1);})[_0x1017('0x25')](function(){return db[_0x1017('0x8c')][_0x1017('0x6c')]({'where':{'teamId':_0x48b05d}})['then'](function(_0x4931ca){if(_0x4931ca){var _0x20530f=_[_0x1017('0x2a')](_0x23a43f,function(_0x356611){db['UserVoicePrefix'][_0x1017('0x8d')]({'UserId':_0x356611,'VoicePrefixId':_0x4931ca['VoicePrefixId']});});return Promise[_0x1017('0x8b')](_0x20530f);}});});});return Promise[_0x1017('0x8b')](_0x328f61)[_0x1017('0x25')](function(){return _0x2aed68[_0x1017('0x79')](_0x23a43f,{'transaction':_0x1f1c30})[_0x1017('0x8e')](function(_0x4851ba){return _0x4851ba;});});});}})['then'](respondWithResult(_0x16db18,null))['catch'](handleError(_0x16db18,null));};exports[_0x1017('0x8f')]=function(_0x3c8fde,_0x8df1a8){var _0x4241f6=_[_0x1017('0x7a')](_0x3c8fde[_0x1017('0x30')][_0x1017('0x78')])?_0x3c8fde['query'][_0x1017('0x78')]:[_0x3c8fde[_0x1017('0x30')][_0x1017('0x78')]];var _0x7923a3=_0x3c8fde[_0x1017('0x44')]['id'];return db[_0x1017('0x2b')][_0x1017('0x4e')]({'where':{'id':_0x7923a3}})[_0x1017('0x25')](handleEntityNotFound(_0x8df1a8,null))[_0x1017('0x25')](function(_0x4d9215){if(_0x4d9215){var _0xcf89e0=['Voice','Chat','Mail',_0x1017('0x7c'),'Fax',_0x1017('0x90'),_0x1017('0x91')];return db[_0x1017('0x55')][_0x1017('0x56')](function(_0x459f13){var _0x92d1f=_[_0x1017('0x2a')](_0xcf89e0,function(_0x545757){var _0x2253ea={'attributes':['id','name']};return _0x4d9215['get'+_0x545757+_0x1017('0x73')](_0x2253ea)['then'](function(_0x4e18df){var _0x272254=_[_0x1017('0x2a')](_0x4e18df,function(_0x16cc83){return _0x16cc83[_0x1017('0x8f')](_0x4241f6,{'transaction':_0x459f13})[_0x1017('0x25')](function(){var _0x161b39=_[_0x1017('0x2a')](_0x4241f6,function(_0x4ec9e0){socket[_0x1017('0x82')](_0x1017('0x49')+_0x545757+_0x1017('0x92'),{'UserId':Number(_0x4ec9e0),[_0x545757+_0x1017('0x7f')]:_0x16cc83['id']});if(_0x545757!==_0x1017('0x7b')){return;}return db['UserVoiceQueueRt'][_0x1017('0x54')]({'where':{'VoiceQueueId':_0x16cc83['id'],'UserId':_0x4ec9e0},'transaction':_0x459f13});});return Promise[_0x1017('0x8b')](_0x161b39);});});return Promise[_0x1017('0x8b')](_0x272254);});});return Promise['all'](_0x92d1f)[_0x1017('0x25')](function(){return _0x4d9215[_0x1017('0x8f')](_0x4241f6,{'transaction':_0x459f13});})[_0x1017('0x25')](function(){return db['TeamVoicePrefix'][_0x1017('0x6c')]({'where':{'teamId':_0x7923a3}})[_0x1017('0x25')](function(_0x17b055){if(_0x17b055){var _0x13e9ee=_[_0x1017('0x2a')](_0x4241f6,function(_0x145a28){db['UserVoicePrefix'][_0x1017('0x54')]({'where':{'UserId':_0x145a28,'VoicePrefixId':_0x17b055[_0x1017('0x93')]}});});return Promise[_0x1017('0x8b')](_0x13e9ee);}});});});}})[_0x1017('0x25')](respondWithStatusCode(_0x8df1a8,null))[_0x1017('0x42')](handleError(_0x8df1a8,null));};exports[_0x1017('0x94')]=function(_0x3bf512,_0x27bb98,_0xd5dcae){var _0x31a248={};var _0x3b8af5={};var _0x598243;var _0x54bac1;return db[_0x1017('0x2b')][_0x1017('0x6c')]({'where':{'id':_0x3bf512['params']['id']}})[_0x1017('0x25')](handleEntityNotFound(_0x27bb98,null))[_0x1017('0x25')](function(_0x1828fd){if(_0x1828fd){_0x598243=_0x1828fd;_0x3b8af5['model']=_[_0x1017('0x31')](db[_0x1017('0x80')][_0x1017('0x2c')]);_0x3b8af5[_0x1017('0x30')]=_['keys'](_0x3bf512['query']);_0x3b8af5['filters']=_[_0x1017('0x45')](_0x3b8af5[_0x1017('0x2f')],_0x3b8af5['query']);_0x31a248['attributes']=_[_0x1017('0x45')](_0x3b8af5[_0x1017('0x2f')],qs[_0x1017('0x34')](_0x3bf512[_0x1017('0x30')]['fields']));_0x31a248['attributes']=_0x31a248[_0x1017('0x33')][_0x1017('0x46')]?_0x31a248[_0x1017('0x33')]:_0x3b8af5['model'];_0x31a248[_0x1017('0x37')]=qs[_0x1017('0x38')](_0x3bf512[_0x1017('0x30')][_0x1017('0x38')]);_0x31a248[_0x1017('0x39')]=qs[_0x1017('0x32')](_['pick'](_0x3bf512['query'],_0x3b8af5[_0x1017('0x32')]));if(_0x3bf512[_0x1017('0x30')][_0x1017('0x3d')]){_0x31a248[_0x1017('0x39')]=_['merge'](_0x31a248['where'],{'$or':_[_0x1017('0x2a')](_0x31a248[_0x1017('0x33')],function(_0x138d65){var _0x537331={};_0x537331[_0x138d65]={'$like':'%'+_0x3bf512['query'][_0x1017('0x3d')]+'%'};return _0x537331;})});}_0x31a248=_[_0x1017('0x3b')]({},_0x31a248,_0x3bf512[_0x1017('0x3e')]);return _0x598243[_0x1017('0x94')](_0x31a248);}})[_0x1017('0x25')](function(_0x5a80cb){if(_0x5a80cb){_0x54bac1=_0x5a80cb['length'];if(!_0x3bf512['query'][_0x1017('0x35')](_0x1017('0x36'))){_0x31a248[_0x1017('0x22')]=qs[_0x1017('0x22')](_0x3bf512[_0x1017('0x30')][_0x1017('0x22')]);_0x31a248[_0x1017('0x20')]=qs[_0x1017('0x20')](_0x3bf512[_0x1017('0x30')][_0x1017('0x20')]);}return _0x598243[_0x1017('0x94')](_0x31a248);}})[_0x1017('0x25')](function(_0xcdae6b){if(_0xcdae6b){return _0xcdae6b?{'count':_0x54bac1,'rows':_0xcdae6b}:null;}})[_0x1017('0x25')](respondWithResult(_0x27bb98,null))[_0x1017('0x42')](handleError(_0x27bb98,null));}; \ No newline at end of file +var _0xe0a9=['toLowerCase','Queues','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Fax','Openchannel','through','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','spread','removeAgents','Mail','Sms','Whatsapp','Queue:remove','nolimit','getAgents','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./team.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','name','map','Team','type','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','intersection','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','autoAssociation','UserProfileResource','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','Sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','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','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0xe0a9,0xba));var _0x9e0a=function(_0x3a27db,_0x4dead6){_0x3a27db=_0x3a27db-0x0;var _0x283475=_0xe0a9[_0x3a27db];return _0x283475;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9e0a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e0a('0x1'));var moment=require(_0x9e0a('0x2'));var BPromise=require(_0x9e0a('0x3'));var Mustache=require(_0x9e0a('0x4'));var util=require(_0x9e0a('0x5'));var path=require('path');var sox=require(_0x9e0a('0x6'));var csv=require(_0x9e0a('0x7'));var ejs=require(_0x9e0a('0x8'));var fs=require('fs');var fs_extra=require(_0x9e0a('0x9'));var _=require(_0x9e0a('0xa'));var squel=require(_0x9e0a('0xb'));var crypto=require(_0x9e0a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9e0a('0xd'));var toCsv=require(_0x9e0a('0x7'));var querystring=require(_0x9e0a('0xe'));var Papa=require(_0x9e0a('0xf'));var Redis=require(_0x9e0a('0x10'));var authService=require(_0x9e0a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e0a('0x12'))('api');var utils=require(_0x9e0a('0x13'));var config=require(_0x9e0a('0x14'));var licenseUtil=require(_0x9e0a('0x15'));var db=require(_0x9e0a('0x16'))['db'];config[_0x9e0a('0x17')]=_['defaults'](config[_0x9e0a('0x17')],{'host':_0x9e0a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e0a('0x17')]));require(_0x9e0a('0x19'))['register'](socket);function respondWithStatusCode(_0x426ff8,_0x2363ba){_0x2363ba=_0x2363ba||0xcc;return function(_0x4c877b){if(_0x4c877b){return _0x426ff8['sendStatus'](_0x2363ba);}return _0x426ff8[_0x9e0a('0x1a')](_0x2363ba)[_0x9e0a('0x1b')]();};}function respondWithResult(_0xde76e3,_0x198913){_0x198913=_0x198913||0xc8;return function(_0x4cc455){if(_0x4cc455){return _0xde76e3[_0x9e0a('0x1a')](_0x198913)[_0x9e0a('0x1c')](_0x4cc455);}};}function respondWithFilteredResult(_0x48345d,_0x2eaf79){return function(_0x1769f8){if(_0x1769f8){var _0x4ef562=typeof _0x2eaf79[_0x9e0a('0x1d')]===_0x9e0a('0x1e')&&typeof _0x2eaf79[_0x9e0a('0x1f')]===_0x9e0a('0x1e');var _0x20a746=_0x1769f8[_0x9e0a('0x20')];var _0x4e73df=_0x4ef562?0x0:_0x2eaf79[_0x9e0a('0x1d')];var _0x389e70=_0x4ef562?_0x1769f8[_0x9e0a('0x20')]:_0x2eaf79[_0x9e0a('0x1d')]+_0x2eaf79['limit'];var _0x35c860;if(_0x389e70>=_0x20a746){_0x389e70=_0x20a746;_0x35c860=0xc8;}else{_0x35c860=0xce;}_0x48345d[_0x9e0a('0x1a')](_0x35c860);return _0x48345d[_0x9e0a('0x21')](_0x9e0a('0x22'),_0x4e73df+'-'+_0x389e70+'/'+_0x20a746)[_0x9e0a('0x1c')](_0x1769f8);}return null;};}function patchUpdates(_0xcc794d){return function(_0x24dace){try{jsonpatch['apply'](_0x24dace,_0xcc794d,!![]);}catch(_0x37d886){return BPromise[_0x9e0a('0x23')](_0x37d886);}return _0x24dace['save']();};}function saveUpdates(_0x53bfd6,_0x8c2d1){return function(_0x564109){if(_0x564109){return _0x564109[_0x9e0a('0x24')](_0x53bfd6)[_0x9e0a('0x25')](function(_0x2a4b2c){return _0x2a4b2c;});}return null;};}function handleEntityNotFound(_0x47e607,_0x24d886){return function(_0x4280bc){if(!_0x4280bc){_0x47e607['sendStatus'](0x194);}return _0x4280bc;};}function handleError(_0x6ef128,_0x19cfde){_0x19cfde=_0x19cfde||0x1f4;return function(_0x24feea){logger[_0x9e0a('0x26')](_0x24feea['stack']);if(_0x24feea[_0x9e0a('0x27')]){delete _0x24feea[_0x9e0a('0x27')];}_0x6ef128[_0x9e0a('0x1a')](_0x19cfde)['send'](_0x24feea);};}exports['index']=function(_0x53f6db,_0x519e9b){var _0x3cd4d6={},_0x1b2a24={},_0x54b651={'count':0x0,'rows':[]};var _0x3f20aa=_[_0x9e0a('0x28')](db[_0x9e0a('0x29')]['rawAttributes'],function(_0x1d86d){return{'name':_0x1d86d['fieldName'],'type':_0x1d86d[_0x9e0a('0x2a')]['key']};});_0x1b2a24[_0x9e0a('0x2b')]=_[_0x9e0a('0x28')](_0x3f20aa,'name');_0x1b2a24[_0x9e0a('0x2c')]=_['keys'](_0x53f6db[_0x9e0a('0x2c')]);_0x1b2a24[_0x9e0a('0x2d')]=_['intersection'](_0x1b2a24[_0x9e0a('0x2b')],_0x1b2a24['query']);_0x3cd4d6[_0x9e0a('0x2e')]=_['intersection'](_0x1b2a24[_0x9e0a('0x2b')],qs[_0x9e0a('0x2f')](_0x53f6db[_0x9e0a('0x2c')][_0x9e0a('0x2f')]));_0x3cd4d6[_0x9e0a('0x2e')]=_0x3cd4d6[_0x9e0a('0x2e')][_0x9e0a('0x30')]?_0x3cd4d6[_0x9e0a('0x2e')]:_0x1b2a24[_0x9e0a('0x2b')];if(!_0x53f6db['query'][_0x9e0a('0x31')]('nolimit')){_0x3cd4d6['limit']=qs[_0x9e0a('0x1f')](_0x53f6db[_0x9e0a('0x2c')][_0x9e0a('0x1f')]);_0x3cd4d6[_0x9e0a('0x1d')]=qs[_0x9e0a('0x1d')](_0x53f6db[_0x9e0a('0x2c')][_0x9e0a('0x1d')]);}_0x3cd4d6[_0x9e0a('0x32')]=qs[_0x9e0a('0x33')](_0x53f6db['query'][_0x9e0a('0x33')]);_0x3cd4d6[_0x9e0a('0x34')]=qs[_0x9e0a('0x2d')](_[_0x9e0a('0x35')](_0x53f6db[_0x9e0a('0x2c')],_0x1b2a24['filters']),_0x3f20aa);if(_0x53f6db['query'][_0x9e0a('0x36')]){_0x3cd4d6[_0x9e0a('0x34')]=_[_0x9e0a('0x37')](_0x3cd4d6[_0x9e0a('0x34')],{'$or':_['map'](_0x3f20aa,function(_0x55ce0f){if(_0x55ce0f['type']!==_0x9e0a('0x38')){var _0x86879={};_0x86879[_0x55ce0f[_0x9e0a('0x27')]]={'$like':'%'+_0x53f6db['query'][_0x9e0a('0x36')]+'%'};return _0x86879;}})});}_0x3cd4d6=_[_0x9e0a('0x37')]({},_0x3cd4d6,_0x53f6db[_0x9e0a('0x39')]);var _0x2d7b52={'where':_0x3cd4d6[_0x9e0a('0x34')]};return db[_0x9e0a('0x29')][_0x9e0a('0x20')](_0x2d7b52)['then'](function(_0x280265){_0x54b651[_0x9e0a('0x20')]=_0x280265;if(_0x53f6db['query'][_0x9e0a('0x3a')]){_0x3cd4d6[_0x9e0a('0x3b')]=[{'all':!![]}];}return db[_0x9e0a('0x29')][_0x9e0a('0x3c')](_0x3cd4d6);})[_0x9e0a('0x25')](function(_0x5dafcb){_0x54b651[_0x9e0a('0x3d')]=_0x5dafcb;return _0x54b651;})['then'](respondWithFilteredResult(_0x519e9b,_0x3cd4d6))[_0x9e0a('0x3e')](handleError(_0x519e9b,null));};exports[_0x9e0a('0x3f')]=function(_0x33e07c,_0x4974ea){var _0x306cbd={'raw':![],'where':{'id':_0x33e07c[_0x9e0a('0x40')]['id']}},_0x3716d1={};_0x3716d1[_0x9e0a('0x2b')]=_['keys'](db['Team'][_0x9e0a('0x41')]);_0x3716d1[_0x9e0a('0x2c')]=_[_0x9e0a('0x42')](_0x33e07c[_0x9e0a('0x2c')]);_0x3716d1[_0x9e0a('0x2d')]=_[_0x9e0a('0x43')](_0x3716d1[_0x9e0a('0x2b')],_0x3716d1[_0x9e0a('0x2c')]);_0x306cbd['attributes']=_[_0x9e0a('0x43')](_0x3716d1[_0x9e0a('0x2b')],qs[_0x9e0a('0x2f')](_0x33e07c['query'][_0x9e0a('0x2f')]));_0x306cbd[_0x9e0a('0x2e')]=_0x306cbd[_0x9e0a('0x2e')][_0x9e0a('0x30')]?_0x306cbd[_0x9e0a('0x2e')]:_0x3716d1[_0x9e0a('0x2b')];if(_0x33e07c[_0x9e0a('0x2c')]['includeAll']){_0x306cbd[_0x9e0a('0x3b')]=[{'all':!![]}];}_0x306cbd=_[_0x9e0a('0x37')]({},_0x306cbd,_0x33e07c['options']);return db[_0x9e0a('0x29')][_0x9e0a('0x44')](_0x306cbd)['then'](handleEntityNotFound(_0x4974ea,null))[_0x9e0a('0x25')](respondWithResult(_0x4974ea,null))[_0x9e0a('0x3e')](handleError(_0x4974ea,null));};exports[_0x9e0a('0x45')]=function(_0x311a3a,_0x3bebdc){return db['Team'][_0x9e0a('0x45')](_0x311a3a[_0x9e0a('0x46')],{})[_0x9e0a('0x25')](function(_0x5807ad){var _0x574935=_0x311a3a['user'][_0x9e0a('0x47')]({'plain':!![]});if(!_0x574935)throw new Error(_0x9e0a('0x48'));if(_0x574935[_0x9e0a('0x49')]===_0x9e0a('0x4a')){var _0x3bf38d=_0x5807ad[_0x9e0a('0x47')]({'plain':!![]});var _0x37dfe0=_0x9e0a('0x4b');return db[_0x9e0a('0x4c')][_0x9e0a('0x44')]({'where':{'name':_0x37dfe0,'userProfileId':_0x574935['userProfileId']},'raw':!![]})[_0x9e0a('0x25')](function(_0xf0bab0){if(_0xf0bab0&&_0xf0bab0[_0x9e0a('0x4d')]===0x0){return db[_0x9e0a('0x4e')][_0x9e0a('0x45')]({'name':_0x3bf38d['name'],'resourceId':_0x3bf38d['id'],'type':_0xf0bab0[_0x9e0a('0x27')],'sectionId':_0xf0bab0['id']},{})[_0x9e0a('0x25')](function(){return _0x5807ad;});}else{return _0x5807ad;}})['catch'](function(_0x2f0aab){logger[_0x9e0a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f0aab);throw _0x2f0aab;});}return _0x5807ad;})[_0x9e0a('0x25')](respondWithResult(_0x3bebdc,0xc9))[_0x9e0a('0x3e')](handleError(_0x3bebdc,null));};exports[_0x9e0a('0x24')]=function(_0x3d91c7,_0x4efc95){if(_0x3d91c7[_0x9e0a('0x46')]['id']){delete _0x3d91c7[_0x9e0a('0x46')]['id'];}return db['Team'][_0x9e0a('0x44')]({'where':{'id':_0x3d91c7[_0x9e0a('0x40')]['id']}})['then'](handleEntityNotFound(_0x4efc95,null))['then'](saveUpdates(_0x3d91c7[_0x9e0a('0x46')],null))[_0x9e0a('0x25')](respondWithResult(_0x4efc95,null))[_0x9e0a('0x3e')](handleError(_0x4efc95,null));};exports[_0x9e0a('0x4f')]=function(_0x8add5b,_0xa3992c){var _0x66c089=_0x8add5b[_0x9e0a('0x40')]['id'];var _0x5630cf=[];return db[_0x9e0a('0x50')][_0x9e0a('0x51')](function(_0x1cde8c){var _0x520634=_0x9e0a('0x52')+_0x66c089;return db[_0x9e0a('0x50')][_0x9e0a('0x2c')](_0x520634,{'type':db['Sequelize']['QueryTypes'][_0x9e0a('0x53')],'raw':!![],'transaction':_0x1cde8c})[_0x9e0a('0x25')](function(_0x2b849e){_0x5630cf=_['map'](_0x2b849e,function(_0x40a81b){return Number(_0x40a81b['UserId']);});})[_0x9e0a('0x25')](function(){var _0x469c0c='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x66c089;return db['sequelize'][_0x9e0a('0x2c')](_0x469c0c,{'type':db[_0x9e0a('0x54')][_0x9e0a('0x55')][_0x9e0a('0x53')],'raw':!![],'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(_0x161f4d){var _0x33b653=_[_0x9e0a('0x28')](_0x161f4d,function(_0x2362ee){return Number(_0x2362ee[_0x9e0a('0x56')]);});return db[_0x9e0a('0x57')][_0x9e0a('0x4f')]({'where':{'UserId':{'$in':_0x5630cf},'VoiceQueueId':{'$in':_0x33b653}},'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(){var _0x19897d=_0x9e0a('0x58')+_0x66c089;return db[_0x9e0a('0x50')]['query'](_0x19897d,{'type':db[_0x9e0a('0x54')][_0x9e0a('0x55')]['SELECT'],'raw':!![],'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(_0x210565){var _0x3b490c=_[_0x9e0a('0x28')](_0x210565,function(_0x1bf3f4){return Number(_0x1bf3f4[_0x9e0a('0x59')]);});return db['UserMailQueue'][_0x9e0a('0x4f')]({'where':{'UserId':{'$in':_0x5630cf},'MailQueueId':{'$in':_0x3b490c}},'transaction':_0x1cde8c});})['then'](function(){var _0x113267=_0x9e0a('0x5a')+_0x66c089;return db['sequelize'][_0x9e0a('0x2c')](_0x113267,{'type':db[_0x9e0a('0x54')][_0x9e0a('0x55')]['SELECT'],'raw':!![],'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(_0xe394bc){var _0x767d02=_[_0x9e0a('0x28')](_0xe394bc,function(_0x354834){return Number(_0x354834[_0x9e0a('0x5b')]);});return db[_0x9e0a('0x5c')][_0x9e0a('0x4f')]({'where':{'UserId':{'$in':_0x5630cf},'SmsQueueId':{'$in':_0x767d02}},'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(){var _0x4ca4c6=_0x9e0a('0x5d')+_0x66c089;return db['sequelize'][_0x9e0a('0x2c')](_0x4ca4c6,{'type':db[_0x9e0a('0x54')][_0x9e0a('0x55')][_0x9e0a('0x53')],'raw':!![],'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(_0x3936e9){var _0x56eb13=_[_0x9e0a('0x28')](_0x3936e9,function(_0x3763c5){return Number(_0x3763c5[_0x9e0a('0x5e')]);});return db[_0x9e0a('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x5630cf},'ChatQueueId':{'$in':_0x56eb13}},'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(){var _0x453239='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x66c089;return db[_0x9e0a('0x50')][_0x9e0a('0x2c')](_0x453239,{'type':db[_0x9e0a('0x54')]['QueryTypes'][_0x9e0a('0x53')],'raw':!![],'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(_0x425679){var _0x19c620=_[_0x9e0a('0x28')](_0x425679,function(_0x14eb16){return Number(_0x14eb16[_0x9e0a('0x60')]);});return db[_0x9e0a('0x61')][_0x9e0a('0x4f')]({'where':{'UserId':{'$in':_0x5630cf},'FaxQueueId':{'$in':_0x19c620}},'transaction':_0x1cde8c});})['then'](function(){var _0x9059d7=_0x9e0a('0x62')+_0x66c089;return db[_0x9e0a('0x50')][_0x9e0a('0x2c')](_0x9059d7,{'type':db[_0x9e0a('0x54')][_0x9e0a('0x55')]['SELECT'],'raw':!![],'transaction':_0x1cde8c});})['then'](function(_0x50f9c2){var _0x237d17=_[_0x9e0a('0x28')](_0x50f9c2,function(_0x880131){return Number(_0x880131[_0x9e0a('0x63')]);});return db[_0x9e0a('0x64')][_0x9e0a('0x4f')]({'where':{'UserId':{'$in':_0x5630cf},'OpenchannelQueueId':{'$in':_0x237d17}},'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(){var _0x1182fc=_0x9e0a('0x65')+_0x66c089;return db['sequelize'][_0x9e0a('0x2c')](_0x1182fc,{'type':db[_0x9e0a('0x54')][_0x9e0a('0x55')][_0x9e0a('0x53')],'raw':!![],'transaction':_0x1cde8c});})['then'](function(_0x4ab90f){var _0x1e702e=_[_0x9e0a('0x28')](_0x4ab90f,function(_0x554235){return Number(_0x554235['WhatsappQueueId']);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x5630cf},'WhatsappQueueId':{'$in':_0x1e702e}},'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(){return db[_0x9e0a('0x66')]['find']({'where':{'TeamId':_0x66c089}});})[_0x9e0a('0x25')](function(_0xad85ab){if(_0xad85ab===null){return;}return db[_0x9e0a('0x67')][_0x9e0a('0x4f')]({'where':{'UserId':{'$in':_0x5630cf},'VoicePrefixId':_0xad85ab[_0x9e0a('0x68')]},'transaction':_0x1cde8c});})[_0x9e0a('0x25')](function(){return db['Team']['destroy']({'where':{'id':_0x66c089},'cascade':!![],'transaction':_0x1cde8c});})['then'](function(_0x4c18e7){if(_0x4c18e7===0x0){_0xa3992c['sendStatus'](0x194);}else{return db[_0x9e0a('0x4e')][_0x9e0a('0x4f')]({'where':{'type':_0x9e0a('0x4b'),'resourceId':_0x66c089},'cascade':!![],'transaction':_0x1cde8c})[_0x9e0a('0x25')](function(){_0xa3992c[_0x9e0a('0x1a')](0xcc)[_0x9e0a('0x1b')]();});}})[_0x9e0a('0x3e')](function(_0x3f84c6){_0xa3992c[_0x9e0a('0x1a')](0x1f4)[_0x9e0a('0x69')](_0x3f84c6);});});};exports['getQueues']=function(_0x411b3a,_0x1765e9,_0x24a633){return db[_0x9e0a('0x29')][_0x9e0a('0x6a')]({'where':{'id':_0x411b3a[_0x9e0a('0x40')]['id']}})[_0x9e0a('0x25')](handleEntityNotFound(_0x1765e9,null))[_0x9e0a('0x25')](function(_0x2a8d13){if(!_0x411b3a['query'][_0x9e0a('0x6b')]||!utils[_0x9e0a('0x6c')](_0x411b3a[_0x9e0a('0x2c')][_0x9e0a('0x6b')])){throw new db['Sequelize'][(_0x9e0a('0x6d'))](_0x9e0a('0x6e'));}var _0x31ae7d={};var _0x270219={};_0x270219[_0x9e0a('0x2b')]=_['keys'](db[_[_0x9e0a('0x6f')](_0x411b3a[_0x9e0a('0x2c')][_0x9e0a('0x6b')][_0x9e0a('0x70')]())+'Queue'][_0x9e0a('0x41')]);_0x270219[_0x9e0a('0x2c')]=_[_0x9e0a('0x42')](_0x411b3a[_0x9e0a('0x2c')]);_0x270219[_0x9e0a('0x2d')]=_[_0x9e0a('0x43')](_0x270219[_0x9e0a('0x2b')],_0x270219[_0x9e0a('0x2c')]);_0x31ae7d['attributes']=_[_0x9e0a('0x43')](_0x270219[_0x9e0a('0x2b')],qs['fields'](_0x411b3a[_0x9e0a('0x2c')][_0x9e0a('0x2f')]));_0x31ae7d[_0x9e0a('0x2e')]=_0x31ae7d['attributes'][_0x9e0a('0x30')]?_0x31ae7d[_0x9e0a('0x2e')]:_0x270219[_0x9e0a('0x2b')];_0x31ae7d[_0x9e0a('0x1f')]=qs[_0x9e0a('0x1f')](_0x411b3a[_0x9e0a('0x2c')]['limit']);_0x31ae7d['offset']=qs[_0x9e0a('0x1d')](_0x411b3a[_0x9e0a('0x2c')][_0x9e0a('0x1d')]);_0x31ae7d[_0x9e0a('0x32')]=qs[_0x9e0a('0x33')](_0x411b3a[_0x9e0a('0x2c')][_0x9e0a('0x33')]);_0x31ae7d[_0x9e0a('0x34')]=qs[_0x9e0a('0x2d')](_['pick'](_0x411b3a['query'],_0x270219[_0x9e0a('0x2d')]));_0x31ae7d=_['merge']({},_0x31ae7d,_0x411b3a['options']);return _0x2a8d13[_0x9e0a('0x47')+_['capitalize'](_0x411b3a['query']['channel'][_0x9e0a('0x70')]())+_0x9e0a('0x71')](_0x31ae7d);})[_0x9e0a('0x25')](respondWithResult(_0x1765e9,null))[_0x9e0a('0x3e')](handleError(_0x1765e9,null));};exports['addQueues']=function(_0x12336f,_0x553be4,_0x26aed0){return db[_0x9e0a('0x29')]['findOne']({'where':{'id':_0x12336f[_0x9e0a('0x40')]['id']}})[_0x9e0a('0x25')](function(_0x10b567){if(_0x10b567){if(!_0x12336f[_0x9e0a('0x46')]['channel']||!utils[_0x9e0a('0x6c')](_0x12336f[_0x9e0a('0x46')][_0x9e0a('0x6b')])){throw new db[(_0x9e0a('0x54'))]['ValidationError'](_0x9e0a('0x6e'));}return _0x10b567[_0x9e0a('0x72')+_[_0x9e0a('0x6f')](_0x12336f[_0x9e0a('0x46')]['channel'][_0x9e0a('0x70')]())+_0x9e0a('0x71')](_0x12336f['body'][_0x9e0a('0x73')]);}return null;})[_0x9e0a('0x25')](handleEntityNotFound(_0x553be4,null))['then'](respondWithStatusCode(_0x553be4,null))['catch'](handleError(_0x553be4,null));};exports[_0x9e0a('0x74')]=function(_0x238a36,_0x3efb16,_0x18bc10){return db['Team'][_0x9e0a('0x6a')]({'where':{'id':_0x238a36[_0x9e0a('0x40')]['id']}})[_0x9e0a('0x25')](function(_0x3124e2){if(_0x3124e2){if(!_0x238a36['query'][_0x9e0a('0x6b')]||!utils[_0x9e0a('0x6c')](_0x238a36[_0x9e0a('0x2c')][_0x9e0a('0x6b')])){throw new db[(_0x9e0a('0x54'))][(_0x9e0a('0x6d'))](_0x9e0a('0x6e'));}return _0x3124e2['remove'+_['capitalize'](_0x238a36[_0x9e0a('0x2c')][_0x9e0a('0x6b')][_0x9e0a('0x70')]())+_0x9e0a('0x71')](_0x238a36[_0x9e0a('0x2c')][_0x9e0a('0x73')]);}return null;})[_0x9e0a('0x25')](handleEntityNotFound(_0x3efb16,null))[_0x9e0a('0x25')](respondWithStatusCode(_0x3efb16,null))[_0x9e0a('0x3e')](handleError(_0x3efb16,null));};exports[_0x9e0a('0x75')]=function(_0x273ab9,_0x31a2e1){var _0x447fc2=_[_0x9e0a('0x76')](_0x273ab9[_0x9e0a('0x46')]['ids'])?_0x273ab9[_0x9e0a('0x46')][_0x9e0a('0x73')]:[_0x273ab9[_0x9e0a('0x46')]['ids']];var _0x3dcdfb=_0x273ab9[_0x9e0a('0x40')]['id'];return db[_0x9e0a('0x29')]['find']({'where':{'id':_0x3dcdfb}})[_0x9e0a('0x25')](handleEntityNotFound(_0x31a2e1,null))['then'](function(_0x406a64){if(_0x406a64){var _0x3e837f=[_0x9e0a('0x77'),_0x9e0a('0x78'),'Mail','Sms',_0x9e0a('0x79'),_0x9e0a('0x7a'),'Whatsapp'];return db[_0x9e0a('0x50')][_0x9e0a('0x51')](function(_0x4e6b2f){var _0x2d4d34=_[_0x9e0a('0x28')](_0x3e837f,function(_0x421e6c){var _0x2d00b3={'attributes':['id',_0x9e0a('0x27')]};if(_0x421e6c===_0x9e0a('0x77')){_0x2d00b3[_0x9e0a('0x7b')]={'attributes':[_0x9e0a('0x7c')]};}return _0x406a64[_0x9e0a('0x47')+_0x421e6c+_0x9e0a('0x71')](_0x2d00b3)[_0x9e0a('0x25')](function(_0x47e32a){var _0x7ea662=_[_0x9e0a('0x28')](_0x47e32a,function(_0x21a135){var _0x45ab2d=_[_0x9e0a('0x28')](_0x447fc2,function(_0x1c890f){var _0x5aee6a={'where':{'UserId':_0x1c890f,[_0x421e6c+_0x9e0a('0x7d')]:_0x21a135['id']},'transaction':_0x4e6b2f};if(_0x421e6c===_0x9e0a('0x77')){_0x5aee6a['defaults']={'penalty':_0x21a135[_0x9e0a('0x7e')][_0x9e0a('0x7c')]};}return db[_0x9e0a('0x7f')+_0x421e6c+_0x9e0a('0x80')][_0x9e0a('0x81')](_0x5aee6a)['then'](function(){socket[_0x9e0a('0x82')](_0x9e0a('0x4a')+_0x421e6c+_0x9e0a('0x83'),{'UserId':_0x1c890f,[_0x421e6c+'QueueId']:_0x21a135['id']});if(_0x421e6c!==_0x9e0a('0x77')){return;}return db['User']['findAll']({'where':{'id':_0x447fc2,'online':0x1},'attributes':['id',_0x9e0a('0x27'),_0x9e0a('0x84'),_0x9e0a('0x85'),'interface'],'raw':!![]})['then'](function(_0x4f4f19){var _0x3a27c8=_['map'](_0x4f4f19,function(_0x5b85e6){return db[_0x9e0a('0x86')][_0x9e0a('0x87')]({'membername':_0x5b85e6[_0x9e0a('0x27')],'UserId':_0x5b85e6['id'],'queue_name':_0x21a135[_0x9e0a('0x27')],'VoiceQueueId':_0x21a135['id'],'interface':_[_0x9e0a('0x88')](_0x5b85e6[_0x9e0a('0x89')])?util[_0x9e0a('0x8a')](_0x9e0a('0x8b'),_0x5b85e6[_0x9e0a('0x27')]):_0x5b85e6[_0x9e0a('0x89')],'paused':_0x5b85e6[_0x9e0a('0x85')]||![],'penalty':_0x21a135[_0x9e0a('0x7e')][_0x9e0a('0x7c')]},{'transaction':_0x4e6b2f});});return Promise['all'](_0x3a27c8);});});});return Promise[_0x9e0a('0x8c')](_0x45ab2d);});return Promise['all'](_0x7ea662);})[_0x9e0a('0x25')](function(){return db[_0x9e0a('0x66')]['findOne']({'where':{'teamId':_0x3dcdfb}})['then'](function(_0x4d2631){if(_0x4d2631){var _0x515082=_[_0x9e0a('0x28')](_0x447fc2,function(_0x484ff2){db[_0x9e0a('0x67')]['upsert']({'UserId':_0x484ff2,'VoicePrefixId':_0x4d2631[_0x9e0a('0x68')]});});return Promise['all'](_0x515082);}});});});return Promise[_0x9e0a('0x8c')](_0x2d4d34)['then'](function(){return _0x406a64[_0x9e0a('0x75')](_0x447fc2,{'transaction':_0x4e6b2f})[_0x9e0a('0x8d')](function(_0x4d6d8c){return _0x4d6d8c;});});});}})[_0x9e0a('0x25')](respondWithResult(_0x31a2e1,null))[_0x9e0a('0x3e')](handleError(_0x31a2e1,null));};exports[_0x9e0a('0x8e')]=function(_0x19d223,_0x5bd98a){var _0x166d49=_[_0x9e0a('0x76')](_0x19d223['query'][_0x9e0a('0x73')])?_0x19d223['query'][_0x9e0a('0x73')]:[_0x19d223[_0x9e0a('0x2c')][_0x9e0a('0x73')]];var _0x52d663=_0x19d223['params']['id'];return db[_0x9e0a('0x29')][_0x9e0a('0x44')]({'where':{'id':_0x52d663}})[_0x9e0a('0x25')](handleEntityNotFound(_0x5bd98a,null))[_0x9e0a('0x25')](function(_0x531d2c){if(_0x531d2c){var _0x51cf34=[_0x9e0a('0x77'),_0x9e0a('0x78'),_0x9e0a('0x8f'),_0x9e0a('0x90'),_0x9e0a('0x79'),_0x9e0a('0x7a'),_0x9e0a('0x91')];return db[_0x9e0a('0x50')][_0x9e0a('0x51')](function(_0x4c7511){var _0x18f154=_['map'](_0x51cf34,function(_0x52921e){var _0xe79a96={'attributes':['id',_0x9e0a('0x27')]};return _0x531d2c['get'+_0x52921e+_0x9e0a('0x71')](_0xe79a96)[_0x9e0a('0x25')](function(_0x21b96d){var _0xe3393f=_[_0x9e0a('0x28')](_0x21b96d,function(_0x2f35ae){return _0x2f35ae['removeAgents'](_0x166d49,{'transaction':_0x4c7511})[_0x9e0a('0x25')](function(){var _0x4c5f09=_[_0x9e0a('0x28')](_0x166d49,function(_0x49f021){socket[_0x9e0a('0x82')](_0x9e0a('0x4a')+_0x52921e+_0x9e0a('0x92'),{'UserId':Number(_0x49f021),[_0x52921e+_0x9e0a('0x7d')]:_0x2f35ae['id']});if(_0x52921e!==_0x9e0a('0x77')){return;}return db['UserVoiceQueueRt'][_0x9e0a('0x4f')]({'where':{'VoiceQueueId':_0x2f35ae['id'],'UserId':_0x49f021},'transaction':_0x4c7511});});return Promise[_0x9e0a('0x8c')](_0x4c5f09);});});return Promise[_0x9e0a('0x8c')](_0xe3393f);});});return Promise[_0x9e0a('0x8c')](_0x18f154)[_0x9e0a('0x25')](function(){return _0x531d2c[_0x9e0a('0x8e')](_0x166d49,{'transaction':_0x4c7511});})[_0x9e0a('0x25')](function(){return db[_0x9e0a('0x66')][_0x9e0a('0x6a')]({'where':{'teamId':_0x52d663}})[_0x9e0a('0x25')](function(_0x12b5c3){if(_0x12b5c3){var _0x141488=_[_0x9e0a('0x28')](_0x166d49,function(_0x2c6cac){db[_0x9e0a('0x67')][_0x9e0a('0x4f')]({'where':{'UserId':_0x2c6cac,'VoicePrefixId':_0x12b5c3[_0x9e0a('0x68')]}});});return Promise[_0x9e0a('0x8c')](_0x141488);}});});});}})['then'](respondWithStatusCode(_0x5bd98a,null))[_0x9e0a('0x3e')](handleError(_0x5bd98a,null));};exports['getAgents']=function(_0x2b194b,_0x201734,_0x29ef47){var _0x3c3b21={};var _0x392eb6={};var _0x18f4d7;var _0x150eb5;return db[_0x9e0a('0x29')][_0x9e0a('0x6a')]({'where':{'id':_0x2b194b[_0x9e0a('0x40')]['id']}})[_0x9e0a('0x25')](handleEntityNotFound(_0x201734,null))['then'](function(_0x38a963){if(_0x38a963){_0x18f4d7=_0x38a963;_0x392eb6[_0x9e0a('0x2b')]=_[_0x9e0a('0x42')](db[_0x9e0a('0x7f')][_0x9e0a('0x41')]);_0x392eb6[_0x9e0a('0x2c')]=_[_0x9e0a('0x42')](_0x2b194b[_0x9e0a('0x2c')]);_0x392eb6[_0x9e0a('0x2d')]=_[_0x9e0a('0x43')](_0x392eb6[_0x9e0a('0x2b')],_0x392eb6[_0x9e0a('0x2c')]);_0x3c3b21[_0x9e0a('0x2e')]=_[_0x9e0a('0x43')](_0x392eb6[_0x9e0a('0x2b')],qs[_0x9e0a('0x2f')](_0x2b194b[_0x9e0a('0x2c')][_0x9e0a('0x2f')]));_0x3c3b21[_0x9e0a('0x2e')]=_0x3c3b21[_0x9e0a('0x2e')][_0x9e0a('0x30')]?_0x3c3b21['attributes']:_0x392eb6[_0x9e0a('0x2b')];_0x3c3b21[_0x9e0a('0x32')]=qs[_0x9e0a('0x33')](_0x2b194b[_0x9e0a('0x2c')][_0x9e0a('0x33')]);_0x3c3b21['where']=qs[_0x9e0a('0x2d')](_[_0x9e0a('0x35')](_0x2b194b[_0x9e0a('0x2c')],_0x392eb6['filters']));if(_0x2b194b[_0x9e0a('0x2c')][_0x9e0a('0x36')]){_0x3c3b21['where']=_[_0x9e0a('0x37')](_0x3c3b21[_0x9e0a('0x34')],{'$or':_[_0x9e0a('0x28')](_0x3c3b21[_0x9e0a('0x2e')],function(_0x108323){var _0x47619d={};_0x47619d[_0x108323]={'$like':'%'+_0x2b194b[_0x9e0a('0x2c')][_0x9e0a('0x36')]+'%'};return _0x47619d;})});}_0x3c3b21=_[_0x9e0a('0x37')]({},_0x3c3b21,_0x2b194b[_0x9e0a('0x39')]);return _0x18f4d7['getAgents'](_0x3c3b21);}})['then'](function(_0x383a51){if(_0x383a51){_0x150eb5=_0x383a51[_0x9e0a('0x30')];if(!_0x2b194b[_0x9e0a('0x2c')][_0x9e0a('0x31')](_0x9e0a('0x93'))){_0x3c3b21[_0x9e0a('0x1f')]=qs[_0x9e0a('0x1f')](_0x2b194b['query'][_0x9e0a('0x1f')]);_0x3c3b21[_0x9e0a('0x1d')]=qs[_0x9e0a('0x1d')](_0x2b194b[_0x9e0a('0x2c')]['offset']);}return _0x18f4d7[_0x9e0a('0x94')](_0x3c3b21);}})[_0x9e0a('0x25')](function(_0x21123e){if(_0x21123e){return _0x21123e?{'count':_0x150eb5,'rows':_0x21123e}:null;}})['then'](respondWithResult(_0x201734,null))[_0x9e0a('0x3e')](handleError(_0x201734,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 66ca0cd..c806901 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 _0xa280=['Team','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1cc108,_0x414f2b){var _0x3ed4e0=function(_0x285627){while(--_0x285627){_0x1cc108['push'](_0x1cc108['shift']());}};_0x3ed4e0(++_0x414f2b);}(_0xa280,0x1e5));var _0x0a28=function(_0x3a7618,_0x58a9b9){_0x3a7618=_0x3a7618-0x0;var _0x9fc98=_0xa280[_0x3a7618];return _0x9fc98;};'use strict';var EventEmitter=require(_0x0a28('0x0'));var Team=require('../../mysqldb')['db'][_0x0a28('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x0a28('0x2')](0x0);var events={'afterCreate':_0x0a28('0x3'),'afterUpdate':'update','afterDestroy':_0x0a28('0x4')};function emitEvent(_0x50dcbe){return function(_0x265c75,_0x15b6e6,_0x257f7c){TeamEvents[_0x0a28('0x5')](_0x50dcbe+':'+_0x265c75['id'],_0x265c75);TeamEvents[_0x0a28('0x5')](_0x50dcbe,_0x265c75);_0x257f7c(null);};}for(var e in events){if(events[_0x0a28('0x6')](e)){var event=events[e];Team[_0x0a28('0x7')](e,emitEvent(event));}}module[_0x0a28('0x8')]=TeamEvents; \ No newline at end of file +var _0x7bf2=['exports','events','Team','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xf6647a,_0x4a05a0){var _0xdd3a42=function(_0x58fc02){while(--_0x58fc02){_0xf6647a['push'](_0xf6647a['shift']());}};_0xdd3a42(++_0x4a05a0);}(_0x7bf2,0x133));var _0x27bf=function(_0x5a6d98,_0x316745){_0x5a6d98=_0x5a6d98-0x0;var _0x126ed0=_0x7bf2[_0x5a6d98];return _0x126ed0;};'use strict';var EventEmitter=require(_0x27bf('0x0'));var Team=require('../../mysqldb')['db'][_0x27bf('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x27bf('0x2'),'afterUpdate':_0x27bf('0x3'),'afterDestroy':_0x27bf('0x4')};function emitEvent(_0x5472a1){return function(_0x3547bd,_0x328985,_0x3c5ca3){TeamEvents[_0x27bf('0x5')](_0x5472a1+':'+_0x3547bd['id'],_0x3547bd);TeamEvents[_0x27bf('0x5')](_0x5472a1,_0x3547bd);_0x3c5ca3(null);};}for(var e in events){if(events[_0x27bf('0x6')](e)){var event=events[e];Team[_0x27bf('0x7')](e,emitEvent(event));}}module[_0x27bf('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index aeec9eb..0ca7722 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 _0xa0d6=['Fax','Mail','Openchannel','Voice','Whatsapp','resolve','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','exports','define','Team','teams','Chat'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa0d6,0x1be));var _0x6a0d=function(_0x54ac4c,_0xf27fc6){_0x54ac4c=_0x54ac4c-0x0;var _0xf0376d=_0xa0d6[_0x54ac4c];return _0xf0376d;};'use strict';var _=require(_0x6a0d('0x0'));var attributes=require(_0x6a0d('0x1'));function getQueuesByChannel(_0x408b99,_0x54dea9){var _0x223f6e=_0x6a0d('0x2')+_0x54dea9+_0x6a0d('0x3');return _0x408b99[_0x223f6e]()[_0x6a0d('0x4')](function(_0x5aab80){return _[_0x6a0d('0x5')](_0x5aab80,function(_0xed7ef7){_0xed7ef7[_0x6a0d('0x6')](_0x6a0d('0x7'),_0x54dea9);return _0xed7ef7;});})[_0x6a0d('0x8')](function(_0x3fc120){throw _0x3fc120;});}module[_0x6a0d('0x9')]=function(_0x3fabd6){return _0x3fabd6[_0x6a0d('0xa')](_0x6a0d('0xb'),attributes,{'tableName':_0x6a0d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x23f935=this;var _0x3cf5f1=[_0x6a0d('0xd'),_0x6a0d('0xe'),_0x6a0d('0xf'),_0x6a0d('0x10'),'Sms',_0x6a0d('0x11'),_0x6a0d('0x12')];return Promise[_0x6a0d('0x13')]()['then'](function(){var _0x596831=_['map'](_0x3cf5f1,function(_0x555c9e){return getQueuesByChannel(_0x23f935,_0x555c9e);});return Promise['all'](_0x596831);})[_0x6a0d('0x8')](function(_0xb66f20){throw _0xb66f20;});}}});}; \ No newline at end of file +var _0xe923=['Sms','Voice','Whatsapp','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','catch','exports','define','Fax','Mail','Openchannel'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0xe923,0x136));var _0x3e92=function(_0xcf69e4,_0x22359f){_0xcf69e4=_0xcf69e4-0x0;var _0x3ae183=_0xe923[_0xcf69e4];return _0x3ae183;};'use strict';var _=require(_0x3e92('0x0'));var attributes=require(_0x3e92('0x1'));function getQueuesByChannel(_0x4ca446,_0x562ecf){var _0x199224=_0x3e92('0x2')+_0x562ecf+_0x3e92('0x3');return _0x4ca446[_0x199224]()[_0x3e92('0x4')](function(_0x83eff4){return _[_0x3e92('0x5')](_0x83eff4,function(_0x3c7e75){_0x3c7e75[_0x3e92('0x6')]('channel',_0x562ecf);return _0x3c7e75;});})[_0x3e92('0x7')](function(_0xcac0ad){throw _0xcac0ad;});}module[_0x3e92('0x8')]=function(_0x2b344f){return _0x2b344f[_0x3e92('0x9')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x236ec3=this;var _0xb944ad=['Chat',_0x3e92('0xa'),_0x3e92('0xb'),_0x3e92('0xc'),_0x3e92('0xd'),_0x3e92('0xe'),_0x3e92('0xf')];return Promise['resolve']()['then'](function(){var _0x3bc021=_[_0x3e92('0x5')](_0xb944ad,function(_0x4b4633){return getQueuesByChannel(_0x236ec3,_0x4b4633);});return Promise[_0x3e92('0x10')](_0x3bc021);})['catch'](function(_0x3c4573){throw _0x3c4573;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index b41e4be..6eb379a 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 _0x2ab2=['request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x2ab2,0x7d));var _0x22ab=function(_0x501935,_0x30e020){_0x501935=_0x501935-0x0;var _0x402a12=_0x2ab2[_0x501935];return _0x402a12;};'use strict';var _=require(_0x22ab('0x0'));var util=require('util');var moment=require(_0x22ab('0x1'));var BPromise=require(_0x22ab('0x2'));var rs=require(_0x22ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22ab('0x4'))['db'];var utils=require(_0x22ab('0x5'));var logger=require(_0x22ab('0x6'))(_0x22ab('0x7'));var config=require(_0x22ab('0x8'));var jayson=require(_0x22ab('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x22ab('0xa')]=_[_0x22ab('0xb')](config[_0x22ab('0xa')],{'host':_0x22ab('0xc'),'port':0x18eb});var socket=require(_0x22ab('0xd'))(new Redis(config[_0x22ab('0xa')]));require(_0x22ab('0xe'))[_0x22ab('0xf')](socket);function respondWithRpcPromise(_0x2bb3ba,_0x24194b,_0x36c61e){return new BPromise(function(_0x2a1804,_0x3dcc98){return client[_0x22ab('0x10')](_0x2bb3ba,_0x36c61e)[_0x22ab('0x11')](function(_0x56339a){logger[_0x22ab('0x12')](_0x22ab('0x13'),_0x24194b,_0x22ab('0x14'));logger[_0x22ab('0x15')](_0x22ab('0x16'),_0x24194b,_0x22ab('0x14'),JSON[_0x22ab('0x17')](_0x56339a));if(_0x56339a[_0x22ab('0x18')]){if(_0x56339a[_0x22ab('0x18')][_0x22ab('0x19')]===0x1f4){logger['error'](_0x22ab('0x13'),_0x24194b,_0x56339a[_0x22ab('0x18')][_0x22ab('0x1a')]);return _0x3dcc98(_0x56339a[_0x22ab('0x18')]['message']);}logger[_0x22ab('0x18')](_0x22ab('0x13'),_0x24194b,_0x56339a[_0x22ab('0x18')][_0x22ab('0x1a')]);return _0x2a1804(_0x56339a[_0x22ab('0x18')]['message']);}else{logger['info']('Team,\x20%s,\x20%s',_0x24194b,_0x22ab('0x14'));_0x2a1804(_0x56339a[_0x22ab('0x1b')][_0x22ab('0x1a')]);}})[_0x22ab('0x1c')](function(_0x24d6f4){logger[_0x22ab('0x18')](_0x22ab('0x13'),_0x24194b,_0x24d6f4);_0x3dcc98(_0x24d6f4);});});} \ No newline at end of file +var _0xca5e=['stringify','error','code','message','Team,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0xca5e,0x1ec));var _0xeca5=function(_0x221c2e,_0x7f3fad){_0x221c2e=_0x221c2e-0x0;var _0x50d0c8=_0xca5e[_0x221c2e];return _0x50d0c8;};'use strict';var _=require(_0xeca5('0x0'));var util=require(_0xeca5('0x1'));var moment=require(_0xeca5('0x2'));var BPromise=require(_0xeca5('0x3'));var rs=require(_0xeca5('0x4'));var fs=require('fs');var Redis=require(_0xeca5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeca5('0x6'));var logger=require(_0xeca5('0x7'))(_0xeca5('0x8'));var config=require(_0xeca5('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xeca5('0xa')]=_[_0xeca5('0xb')](config[_0xeca5('0xa')],{'host':_0xeca5('0xc'),'port':0x18eb});var socket=require(_0xeca5('0xd'))(new Redis(config[_0xeca5('0xa')]));require(_0xeca5('0xe'))[_0xeca5('0xf')](socket);function respondWithRpcPromise(_0x540de5,_0x544b7d,_0x56d525){return new BPromise(function(_0x4027fe,_0x1cc4d1){return client[_0xeca5('0x10')](_0x540de5,_0x56d525)[_0xeca5('0x11')](function(_0x402c0c){logger[_0xeca5('0x12')]('Team,\x20%s,\x20%s',_0x544b7d,_0xeca5('0x13'));logger[_0xeca5('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x544b7d,_0xeca5('0x13'),JSON[_0xeca5('0x15')](_0x402c0c));if(_0x402c0c[_0xeca5('0x16')]){if(_0x402c0c[_0xeca5('0x16')][_0xeca5('0x17')]===0x1f4){logger[_0xeca5('0x16')]('Team,\x20%s,\x20%s',_0x544b7d,_0x402c0c[_0xeca5('0x16')][_0xeca5('0x18')]);return _0x1cc4d1(_0x402c0c[_0xeca5('0x16')]['message']);}logger[_0xeca5('0x16')](_0xeca5('0x19'),_0x544b7d,_0x402c0c[_0xeca5('0x16')][_0xeca5('0x18')]);return _0x4027fe(_0x402c0c[_0xeca5('0x16')][_0xeca5('0x18')]);}else{logger['info'](_0xeca5('0x19'),_0x544b7d,_0xeca5('0x13'));_0x4027fe(_0x402c0c[_0xeca5('0x1a')][_0xeca5('0x18')]);}})['catch'](function(_0x337efb){logger[_0xeca5('0x16')](_0xeca5('0x19'),_0x544b7d,_0x337efb);_0x1cc4d1(_0x337efb);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 242ee81..608d566 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 _0x115a=['team:','./team.events','save','remove','update','removeListener','register','length'];(function(_0x5bb2db,_0xc1c42f){var _0x81cd95=function(_0xd78fb4){while(--_0xd78fb4){_0x5bb2db['push'](_0x5bb2db['shift']());}};_0x81cd95(++_0xc1c42f);}(_0x115a,0x91));var _0xa115=function(_0xb5d2c6,_0x7f4f9c){_0xb5d2c6=_0xb5d2c6-0x0;var _0x198614=_0x115a[_0xb5d2c6];return _0x198614;};'use strict';var TeamEvents=require(_0xa115('0x0'));var events=[_0xa115('0x1'),_0xa115('0x2'),_0xa115('0x3')];function createListener(_0x184e99,_0x4939eb){return function(_0xf12d56){_0x4939eb['emit'](_0x184e99,_0xf12d56);};}function removeListener(_0x1e23d3,_0x217a8e){return function(){TeamEvents[_0xa115('0x4')](_0x1e23d3,_0x217a8e);};}exports[_0xa115('0x5')]=function(_0x1ab6f9){for(var _0x234bed=0x0,_0x567cb3=events[_0xa115('0x6')];_0x234bed<_0x567cb3;_0x234bed++){var _0x149d01=events[_0x234bed];var _0x291bec=createListener(_0xa115('0x7')+_0x149d01,_0x1ab6f9);TeamEvents['on'](_0x149d01,_0x291bec);}}; \ No newline at end of file +var _0x605f=['length','team:','save','remove','emit','removeListener','register'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x605f,0x1a6));var _0xf605=function(_0x560f89,_0x4e14fc){_0x560f89=_0x560f89-0x0;var _0x4b0894=_0x605f[_0x560f89];return _0x4b0894;};'use strict';var TeamEvents=require('./team.events');var events=[_0xf605('0x0'),_0xf605('0x1'),'update'];function createListener(_0x40d4df,_0x173e83){return function(_0x5acb7f){_0x173e83[_0xf605('0x2')](_0x40d4df,_0x5acb7f);};}function removeListener(_0x12242b,_0x5bcbc6){return function(){TeamEvents[_0xf605('0x3')](_0x12242b,_0x5bcbc6);};}exports[_0xf605('0x4')]=function(_0x1846c3){for(var _0x5e7304=0x0,_0x1bdca3=events[_0xf605('0x5')];_0x5e7304<_0x1bdca3;_0x5e7304++){var _0x3b5bbe=events[_0x5e7304];var _0x2fe81e=createListener(_0xf605('0x6')+_0x3b5bbe,_0x1846c3);TeamEvents['on'](_0x3b5bbe,_0x2fe81e);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index c8b4f71..d32e318 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 _0x867f=['exports','INTEGER','sequelize'];(function(_0x151288,_0x3fe836){var _0x219dd5=function(_0x239d59){while(--_0x239d59){_0x151288['push'](_0x151288['shift']());}};_0x219dd5(++_0x3fe836);}(_0x867f,0xe6));var _0xf867=function(_0x5a5675,_0x1ffcdb){_0x5a5675=_0x5a5675-0x0;var _0x5c2444=_0x867f[_0x5a5675];return _0x5c2444;};'use strict';var Sequelize=require(_0xf867('0x0'));module[_0xf867('0x1')]={'TeamId':{'type':Sequelize[_0xf867('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xf867('0x2')]}}; \ No newline at end of file +var _0x860a=['sequelize','exports','INTEGER'];(function(_0x42235f,_0x5dabfd){var _0x3f5fab=function(_0x358fd7){while(--_0x358fd7){_0x42235f['push'](_0x42235f['shift']());}};_0x3f5fab(++_0x5dabfd);}(_0x860a,0x14a));var _0xa860=function(_0x147464,_0x537ee3){_0x147464=_0x147464-0x0;var _0x1e7dbb=_0x860a[_0x147464];return _0x1e7dbb;};'use strict';var Sequelize=require(_0xa860('0x0'));module[_0xa860('0x1')]={'TeamId':{'type':Sequelize[_0xa860('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xa860('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 629035b..f2490fc 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 _0x7cd6=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./teamVoicePrefix.attributes','define','TeamVoicePrefix'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cd6,0x1f4));var _0x67cd=function(_0x39da48,_0x532005){_0x39da48=_0x39da48-0x0;var _0x540d92=_0x7cd6[_0x39da48];return _0x540d92;};'use strict';var _=require(_0x67cd('0x0'));var util=require(_0x67cd('0x1'));var logger=require(_0x67cd('0x2'))(_0x67cd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x67cd('0x4'));var fs=require('fs');var path=require(_0x67cd('0x5'));var rimraf=require(_0x67cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x67cd('0x7'));module['exports']=function(_0x218c1c,_0x2cec15){return _0x218c1c[_0x67cd('0x8')](_0x67cd('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfff0=['./teamVoicePrefix.attributes','define','team_has_voice_prefixes','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xfff0,0x139));var _0x0fff=function(_0x6d8de3,_0x2eb1c3){_0x6d8de3=_0x6d8de3-0x0;var _0x283275=_0xfff0[_0x6d8de3];return _0x283275;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var logger=require(_0x0fff('0x1'))(_0x0fff('0x2'));var moment=require('moment');var BPromise=require(_0x0fff('0x3'));var rp=require(_0x0fff('0x4'));var fs=require('fs');var path=require(_0x0fff('0x5'));var rimraf=require('rimraf');var config=require(_0x0fff('0x6'));var attributes=require(_0x0fff('0x7'));module['exports']=function(_0x33c813,_0x4c2221){return _0x33c813[_0x0fff('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x0fff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 5d63437..b0ca817 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(_0xb867a8,_0x926a63){var _0x1e5dcd=function(_0x1f3c72){while(--_0x1f3c72){_0xb867a8['push'](_0xb867a8['shift']());}};_0x1e5dcd(++_0x926a63);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4f0456,_0x795c81){var _0x52caea=function(_0x23930b){while(--_0x23930b){_0x4f0456['push'](_0x4f0456['shift']());}};_0x52caea(++_0x795c81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index da6f8f3..6263dea 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 _0x99cf=['exports','INTEGER','sequelize'];(function(_0x4c691b,_0x5f4427){var _0x497075=function(_0x3c7824){while(--_0x3c7824){_0x4c691b['push'](_0x4c691b['shift']());}};_0x497075(++_0x5f4427);}(_0x99cf,0x8c));var _0xf99c=function(_0x165a1b,_0x139566){_0x165a1b=_0x165a1b-0x0;var _0x1be281=_0x99cf[_0x165a1b];return _0x1be281;};'use strict';var Sequelize=require(_0xf99c('0x0'));module[_0xf99c('0x1')]={'penalty':{'type':Sequelize[_0xf99c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe914=['exports','sequelize'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xe914,0x7f));var _0x4e91=function(_0x54ed8f,_0x53cdec){_0x54ed8f=_0x54ed8f-0x0;var _0x2557f0=_0xe914[_0x54ed8f];return _0x2557f0;};'use strict';var Sequelize=require(_0x4e91('0x0'));module[_0x4e91('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 1f0c37b..d678a7f 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 _0x524a=['exports','define','team_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','./teamVoiceQueue.attributes'];(function(_0x175fed,_0x23f1e8){var _0x2557d7=function(_0xffbf99){while(--_0xffbf99){_0x175fed['push'](_0x175fed['shift']());}};_0x2557d7(++_0x23f1e8);}(_0x524a,0xf5));var _0xa524=function(_0x536881,_0x1e6d74){_0x536881=_0x536881-0x0;var _0x10c60f=_0x524a[_0x536881];return _0x10c60f;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var logger=require(_0xa524('0x2'))(_0xa524('0x3'));var moment=require('moment');var BPromise=require(_0xa524('0x4'));var rp=require(_0xa524('0x5'));var fs=require('fs');var path=require(_0xa524('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa524('0x7'));module[_0xa524('0x8')]=function(_0x16227b,_0x5f472f){return _0x16227b[_0xa524('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0xa524('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0b5=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api','bluebird','request-promise'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x8fa54b,_0x31dc83){_0x8fa54b=_0x8fa54b-0x0;var _0x2c4bbe=_0xd0b5[_0x8fa54b];return _0x2c4bbe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d0b('0x0'))(_0x5d0b('0x1'));var moment=require('moment');var BPromise=require(_0x5d0b('0x2'));var rp=require(_0x5d0b('0x3'));var fs=require('fs');var path=require(_0x5d0b('0x4'));var rimraf=require(_0x5d0b('0x5'));var config=require(_0x5d0b('0x6'));var attributes=require(_0x5d0b('0x7'));module[_0x5d0b('0x8')]=function(_0x41b7c1,_0xd514d0){return _0x41b7c1[_0x5d0b('0x9')](_0x5d0b('0xa'),attributes,{'tableName':_0x5d0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index b6e3b64..dcb9b82 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 _0xab6a=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','stringify','code','error','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x8ebb49,_0x4c1190){var _0x34498e=function(_0x41b1ac){while(--_0x41b1ac){_0x8ebb49['push'](_0x8ebb49['shift']());}};_0x34498e(++_0x4c1190);}(_0xab6a,0x177));var _0xaab6=function(_0x21999e,_0x49d08f){_0x21999e=_0x21999e-0x0;var _0xf9f87=_0xab6a[_0x21999e];return _0xf9f87;};'use strict';var _=require(_0xaab6('0x0'));var util=require(_0xaab6('0x1'));var moment=require(_0xaab6('0x2'));var BPromise=require(_0xaab6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaab6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaab6('0x5'));var logger=require(_0xaab6('0x6'))(_0xaab6('0x7'));var config=require(_0xaab6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaab6('0x9')][_0xaab6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18294a,_0x534ca7,_0x58a14f){return new BPromise(function(_0x35b050,_0x3c9e3d){return client['request'](_0x18294a,_0x58a14f)['then'](function(_0x524832){logger[_0xaab6('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x534ca7,_0xaab6('0xc'));logger[_0xaab6('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x534ca7,'request\x20sent',JSON[_0xaab6('0xe')](_0x524832));if(_0x524832['error']){if(_0x524832['error'][_0xaab6('0xf')]===0x1f4){logger[_0xaab6('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x534ca7,_0x524832[_0xaab6('0x10')][_0xaab6('0x11')]);return _0x3c9e3d(_0x524832[_0xaab6('0x10')][_0xaab6('0x11')]);}logger[_0xaab6('0x10')](_0xaab6('0x12'),_0x534ca7,_0x524832[_0xaab6('0x10')][_0xaab6('0x11')]);return _0x35b050(_0x524832[_0xaab6('0x10')][_0xaab6('0x11')]);}else{logger[_0xaab6('0xb')](_0xaab6('0x12'),_0x534ca7,_0xaab6('0xc'));_0x35b050(_0x524832[_0xaab6('0x13')][_0xaab6('0x11')]);}})[_0xaab6('0x14')](function(_0x295131){logger[_0xaab6('0x10')](_0xaab6('0x12'),_0x534ca7,_0x295131);_0x3c9e3d(_0x295131);});});} \ No newline at end of file +var _0x43e4=['jayson/promise','client','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0x43e4,0x15a));var _0x443e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x43e4[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x443e('0x0'));var util=require(_0x443e('0x1'));var moment=require(_0x443e('0x2'));var BPromise=require(_0x443e('0x3'));var rs=require(_0x443e('0x4'));var fs=require('fs');var Redis=require(_0x443e('0x5'));var db=require(_0x443e('0x6'))['db'];var utils=require(_0x443e('0x7'));var logger=require(_0x443e('0x8'))(_0x443e('0x9'));var config=require(_0x443e('0xa'));var jayson=require(_0x443e('0xb'));var client=jayson[_0x443e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d942e,_0x6a99bf,_0x23780a){return new BPromise(function(_0x50fa75,_0x1d4ef6){return client['request'](_0x1d942e,_0x23780a)[_0x443e('0xd')](function(_0x5560be){logger['info'](_0x443e('0xe'),_0x6a99bf,_0x443e('0xf'));logger[_0x443e('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x6a99bf,'request\x20sent',JSON[_0x443e('0x11')](_0x5560be));if(_0x5560be[_0x443e('0x12')]){if(_0x5560be[_0x443e('0x12')]['code']===0x1f4){logger['error'](_0x443e('0xe'),_0x6a99bf,_0x5560be['error'][_0x443e('0x13')]);return _0x1d4ef6(_0x5560be['error']['message']);}logger[_0x443e('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x6a99bf,_0x5560be[_0x443e('0x12')][_0x443e('0x13')]);return _0x50fa75(_0x5560be[_0x443e('0x12')]['message']);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x6a99bf,_0x443e('0xf'));_0x50fa75(_0x5560be['result'][_0x443e('0x13')]);}})[_0x443e('0x14')](function(_0x16137b){logger[_0x443e('0x12')](_0x443e('0xe'),_0x6a99bf,_0x16137b);_0x1d4ef6(_0x16137b);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d288b59..791a9d7 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 _0x1241=['../../config/environment','./template.controller','isAuthenticated','index','get','/:id','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x30a88c,_0x5ddd2e){var _0x3a3bf7=function(_0x376df4){while(--_0x376df4){_0x30a88c['push'](_0x30a88c['shift']());}};_0x3a3bf7(++_0x5ddd2e);}(_0x1241,0xb4));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1124('0x0'));var util=require('util');var path=require(_0x1124('0x1'));var timeout=require(_0x1124('0x2'));var express=require(_0x1124('0x3'));var router=express[_0x1124('0x4')]();var fs_extra=require(_0x1124('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1124('0x6'));var config=require(_0x1124('0x7'));var controller=require(_0x1124('0x8'));router['get']('/',auth[_0x1124('0x9')](),controller[_0x1124('0xa')]);router[_0x1124('0xb')](_0x1124('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x1124('0x9')](),controller['create']);router[_0x1124('0xd')](_0x1124('0xc'),auth[_0x1124('0x9')](),controller[_0x1124('0xe')]);router[_0x1124('0xf')](_0x1124('0xc'),auth['isAuthenticated'](),controller[_0x1124('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9261=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2d20d6,_0x9c3dab){var _0x3b005c=function(_0x4f8f3e){while(--_0x4f8f3e){_0x2d20d6['push'](_0x2d20d6['shift']());}};_0x3b005c(++_0x9c3dab);}(_0x9261,0x1de));var _0x1926=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x9261[_0x367e5b];return _0x4b909e;};'use strict';var multer=require(_0x1926('0x0'));var util=require(_0x1926('0x1'));var path=require('path');var timeout=require(_0x1926('0x2'));var express=require(_0x1926('0x3'));var router=express[_0x1926('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1926('0x5'));var interaction=require(_0x1926('0x6'));var config=require(_0x1926('0x7'));var controller=require(_0x1926('0x8'));router[_0x1926('0x9')]('/',auth['isAuthenticated'](),controller[_0x1926('0xa')]);router['get'](_0x1926('0xb'),auth[_0x1926('0xc')](),controller['show']);router[_0x1926('0xd')]('/',auth[_0x1926('0xc')](),controller[_0x1926('0xe')]);router[_0x1926('0xf')](_0x1926('0xb'),auth[_0x1926('0xc')](),controller[_0x1926('0x10')]);router[_0x1926('0x11')](_0x1926('0xb'),auth[_0x1926('0xc')](),controller[_0x1926('0x12')]);module[_0x1926('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f9a0e2e..a195641 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 _0xd540=['exports','STRING','TEXT'];(function(_0x4dbbcd,_0x36c63a){var _0x22b569=function(_0x5c78bb){while(--_0x5c78bb){_0x4dbbcd['push'](_0x4dbbcd['shift']());}};_0x22b569(++_0x36c63a);}(_0xd540,0x153));var _0x0d54=function(_0x7d248c,_0x7bffaf){_0x7d248c=_0x7d248c-0x0;var _0x536715=_0xd540[_0x7d248c];return _0x536715;};'use strict';var Sequelize=require('sequelize');module[_0x0d54('0x0')]={'name':{'type':Sequelize[_0x0d54('0x1')]},'description':{'type':Sequelize[_0x0d54('0x1')]},'html':{'type':Sequelize[_0x0d54('0x2')]}}; \ No newline at end of file +var _0x0d39=['TEXT','sequelize','exports','STRING'];(function(_0x3d4bae,_0x2f1f2c){var _0xfab349=function(_0x2ca7e5){while(--_0x2ca7e5){_0x3d4bae['push'](_0x3d4bae['shift']());}};_0xfab349(++_0x2f1f2c);}(_0x0d39,0x189));var _0x90d3=function(_0x5e3d06,_0x555ec9){_0x5e3d06=_0x5e3d06-0x0;var _0x32890d=_0x0d39[_0x5e3d06];return _0x32890d;};'use strict';var Sequelize=require(_0x90d3('0x0'));module[_0x90d3('0x1')]={'name':{'type':Sequelize[_0x90d3('0x2')]},'description':{'type':Sequelize[_0x90d3('0x2')]},'html':{'type':Sequelize[_0x90d3('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 862e9b5..5a3e882 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 _0x48a4=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','Template','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','apply','save','update','destroy','then','get','Templates','UserProfileResource','end','stack','name','send','index','map','type','key'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x48a4,0x166));var _0x448a=function(_0x3f5625,_0x1ea39f){_0x3f5625=_0x3f5625-0x0;var _0x54c9c2=_0x48a4[_0x3f5625];return _0x54c9c2;};'use strict';var emlformat=require(_0x448a('0x0'));var rimraf=require(_0x448a('0x1'));var zipdir=require(_0x448a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x448a('0x3'));var moment=require(_0x448a('0x4'));var BPromise=require(_0x448a('0x5'));var Mustache=require(_0x448a('0x6'));var util=require(_0x448a('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x448a('0x8'));var fs=require('fs');var fs_extra=require(_0x448a('0x9'));var _=require(_0x448a('0xa'));var squel=require(_0x448a('0xb'));var crypto=require(_0x448a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x448a('0xd'));var toCsv=require(_0x448a('0xe'));var querystring=require(_0x448a('0xf'));var Papa=require(_0x448a('0x10'));var Redis=require('ioredis');var authService=require(_0x448a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x448a('0x12'));var hardwareService=require(_0x448a('0x13'));var logger=require(_0x448a('0x14'))(_0x448a('0x15'));var utils=require(_0x448a('0x16'));var config=require(_0x448a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x448a('0x18'))['db'];function respondWithStatusCode(_0x5e24f4,_0x4f2387){_0x4f2387=_0x4f2387||0xcc;return function(_0x356150){if(_0x356150){return _0x5e24f4[_0x448a('0x19')](_0x4f2387);}return _0x5e24f4['status'](_0x4f2387)['end']();};}function respondWithResult(_0x58d051,_0x31a519){_0x31a519=_0x31a519||0xc8;return function(_0x3c2509){if(_0x3c2509){return _0x58d051[_0x448a('0x1a')](_0x31a519)[_0x448a('0x1b')](_0x3c2509);}};}function respondWithFilteredResult(_0x17ffbc,_0x278744){return function(_0x2f3cf1){if(_0x2f3cf1){var _0x198007=typeof _0x278744['offset']===_0x448a('0x1c')&&typeof _0x278744[_0x448a('0x1d')]===_0x448a('0x1c');var _0x7b4cc0=_0x2f3cf1[_0x448a('0x1e')];var _0x195732=_0x198007?0x0:_0x278744['offset'];var _0x419d07=_0x198007?_0x2f3cf1[_0x448a('0x1e')]:_0x278744['offset']+_0x278744[_0x448a('0x1d')];var _0x2179b9;if(_0x419d07>=_0x7b4cc0){_0x419d07=_0x7b4cc0;_0x2179b9=0xc8;}else{_0x2179b9=0xce;}_0x17ffbc['status'](_0x2179b9);return _0x17ffbc['set']('Content-Range',_0x195732+'-'+_0x419d07+'/'+_0x7b4cc0)[_0x448a('0x1b')](_0x2f3cf1);}return null;};}function patchUpdates(_0x282c95){return function(_0xe20918){try{jsonpatch[_0x448a('0x1f')](_0xe20918,_0x282c95,!![]);}catch(_0x161d8f){return BPromise['reject'](_0x161d8f);}return _0xe20918[_0x448a('0x20')]();};}function saveUpdates(_0x15efdf,_0x403bce){return function(_0x1f683c){if(_0x1f683c){return _0x1f683c[_0x448a('0x21')](_0x15efdf)['then'](function(_0xa16dcf){return _0xa16dcf;});}return null;};}function removeEntity(_0x508ac0,_0x1a74ba){return function(_0x2cf1a8){if(_0x2cf1a8){return _0x2cf1a8[_0x448a('0x22')]()[_0x448a('0x23')](function(){var _0x54e0cd=_0x2cf1a8[_0x448a('0x24')]({'plain':!![]});var _0x16feb5=_0x448a('0x25');return db[_0x448a('0x26')][_0x448a('0x22')]({'where':{'type':_0x16feb5,'resourceId':_0x54e0cd['id']}})['then'](function(){return _0x2cf1a8;});})[_0x448a('0x23')](function(){_0x508ac0['status'](0xcc)[_0x448a('0x27')]();});}};}function handleEntityNotFound(_0x2e1645,_0x39d0ed){return function(_0x67f7cf){if(!_0x67f7cf){_0x2e1645[_0x448a('0x19')](0x194);}return _0x67f7cf;};}function handleError(_0x470bb9,_0x1dd428){_0x1dd428=_0x1dd428||0x1f4;return function(_0x35affb){logger['error'](_0x35affb[_0x448a('0x28')]);if(_0x35affb['name']){delete _0x35affb[_0x448a('0x29')];}_0x470bb9[_0x448a('0x1a')](_0x1dd428)[_0x448a('0x2a')](_0x35affb);};}exports[_0x448a('0x2b')]=function(_0x1f6d5c,_0x25b3c9){var _0x12f153={},_0x56ce46={},_0x55d2ff={'count':0x0,'rows':[]};var _0x24a6cc=_[_0x448a('0x2c')](db['Template']['rawAttributes'],function(_0x4ba3dc){return{'name':_0x4ba3dc['fieldName'],'type':_0x4ba3dc[_0x448a('0x2d')][_0x448a('0x2e')]};});_0x56ce46[_0x448a('0x2f')]=_[_0x448a('0x2c')](_0x24a6cc,_0x448a('0x29'));_0x56ce46[_0x448a('0x30')]=_[_0x448a('0x31')](_0x1f6d5c[_0x448a('0x30')]);_0x56ce46[_0x448a('0x32')]=_[_0x448a('0x33')](_0x56ce46['model'],_0x56ce46[_0x448a('0x30')]);_0x12f153[_0x448a('0x34')]=_[_0x448a('0x33')](_0x56ce46[_0x448a('0x2f')],qs[_0x448a('0x35')](_0x1f6d5c[_0x448a('0x30')][_0x448a('0x35')]));_0x12f153[_0x448a('0x34')]=_0x12f153[_0x448a('0x34')][_0x448a('0x36')]?_0x12f153['attributes']:_0x56ce46[_0x448a('0x2f')];if(!_0x1f6d5c[_0x448a('0x30')][_0x448a('0x37')](_0x448a('0x38'))){_0x12f153[_0x448a('0x1d')]=qs[_0x448a('0x1d')](_0x1f6d5c[_0x448a('0x30')][_0x448a('0x1d')]);_0x12f153[_0x448a('0x39')]=qs[_0x448a('0x39')](_0x1f6d5c[_0x448a('0x30')][_0x448a('0x39')]);}_0x12f153[_0x448a('0x3a')]=qs['sort'](_0x1f6d5c['query'][_0x448a('0x3b')]);_0x12f153[_0x448a('0x3c')]=qs[_0x448a('0x32')](_[_0x448a('0x3d')](_0x1f6d5c['query'],_0x56ce46[_0x448a('0x32')]),_0x24a6cc);if(_0x1f6d5c['query']['filter']){_0x12f153['where']=_[_0x448a('0x3e')](_0x12f153['where'],{'$or':_[_0x448a('0x2c')](_0x24a6cc,function(_0x538897){if(_0x538897[_0x448a('0x2d')]!==_0x448a('0x3f')){var _0x4b30c5={};_0x4b30c5[_0x538897['name']]={'$like':'%'+_0x1f6d5c['query'][_0x448a('0x40')]+'%'};return _0x4b30c5;}})});}_0x12f153=_['merge']({},_0x12f153,_0x1f6d5c['options']);var _0x41b3cd={'where':_0x12f153[_0x448a('0x3c')]};return db['Template'][_0x448a('0x1e')](_0x41b3cd)['then'](function(_0x7f0efa){_0x55d2ff[_0x448a('0x1e')]=_0x7f0efa;if(_0x1f6d5c['query'][_0x448a('0x41')]){_0x12f153[_0x448a('0x42')]=[{'all':!![]}];}return db[_0x448a('0x43')]['findAll'](_0x12f153);})['then'](function(_0x5cdd32){_0x55d2ff['rows']=_0x5cdd32;return _0x55d2ff;})[_0x448a('0x23')](respondWithFilteredResult(_0x25b3c9,_0x12f153))[_0x448a('0x44')](handleError(_0x25b3c9,null));};exports[_0x448a('0x45')]=function(_0x5513d7,_0x4d2621){var _0x37b238={'raw':!![],'where':{'id':_0x5513d7[_0x448a('0x46')]['id']}},_0x309d08={};_0x309d08[_0x448a('0x2f')]=_[_0x448a('0x31')](db[_0x448a('0x43')][_0x448a('0x47')]);_0x309d08[_0x448a('0x30')]=_[_0x448a('0x31')](_0x5513d7[_0x448a('0x30')]);_0x309d08['filters']=_[_0x448a('0x33')](_0x309d08[_0x448a('0x2f')],_0x309d08[_0x448a('0x30')]);_0x37b238[_0x448a('0x34')]=_[_0x448a('0x33')](_0x309d08['model'],qs['fields'](_0x5513d7[_0x448a('0x30')][_0x448a('0x35')]));_0x37b238[_0x448a('0x34')]=_0x37b238[_0x448a('0x34')][_0x448a('0x36')]?_0x37b238[_0x448a('0x34')]:_0x309d08[_0x448a('0x2f')];if(_0x5513d7[_0x448a('0x30')][_0x448a('0x41')]){_0x37b238[_0x448a('0x42')]=[{'all':!![]}];}_0x37b238=_['merge']({},_0x37b238,_0x5513d7['options']);return db[_0x448a('0x43')][_0x448a('0x48')](_0x37b238)[_0x448a('0x23')](handleEntityNotFound(_0x4d2621,null))[_0x448a('0x23')](respondWithResult(_0x4d2621,null))[_0x448a('0x44')](handleError(_0x4d2621,null));};exports[_0x448a('0x49')]=function(_0x18ef75,_0x144508){return db['Template'][_0x448a('0x49')](_0x18ef75['body'],{})[_0x448a('0x23')](function(_0xc4702e){var _0x5f3c0d=_0x18ef75[_0x448a('0x4a')][_0x448a('0x24')]({'plain':!![]});if(!_0x5f3c0d)throw new Error(_0x448a('0x4b'));if(_0x5f3c0d[_0x448a('0x4c')]==='user'){var _0x49ce4d=_0xc4702e[_0x448a('0x24')]({'plain':!![]});var _0x935f1d=_0x448a('0x25');return db[_0x448a('0x4d')][_0x448a('0x48')]({'where':{'name':_0x935f1d,'userProfileId':_0x5f3c0d['userProfileId']},'raw':!![]})[_0x448a('0x23')](function(_0x59070a){if(_0x59070a&&_0x59070a[_0x448a('0x4e')]===0x0){return db['UserProfileResource'][_0x448a('0x49')]({'name':_0x49ce4d[_0x448a('0x29')],'resourceId':_0x49ce4d['id'],'type':_0x59070a['name'],'sectionId':_0x59070a['id']},{})[_0x448a('0x23')](function(){return _0xc4702e;});}else{return _0xc4702e;}})[_0x448a('0x44')](function(_0x44164d){logger[_0x448a('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44164d);throw _0x44164d;});}return _0xc4702e;})['then'](respondWithResult(_0x144508,0xc9))[_0x448a('0x44')](handleError(_0x144508,null));};exports['update']=function(_0x1a0cff,_0x5e8496){if(_0x1a0cff[_0x448a('0x50')]['id']){delete _0x1a0cff[_0x448a('0x50')]['id'];}return db[_0x448a('0x43')]['find']({'where':{'id':_0x1a0cff['params']['id']}})['then'](handleEntityNotFound(_0x5e8496,null))['then'](saveUpdates(_0x1a0cff[_0x448a('0x50')],null))[_0x448a('0x23')](respondWithResult(_0x5e8496,null))[_0x448a('0x44')](handleError(_0x5e8496,null));};exports[_0x448a('0x22')]=function(_0x4603f0,_0x381f90){return db[_0x448a('0x43')][_0x448a('0x48')]({'where':{'id':_0x4603f0[_0x448a('0x46')]['id']}})[_0x448a('0x23')](handleEntityNotFound(_0x381f90,null))[_0x448a('0x23')](removeEntity(_0x381f90,null))['catch'](handleError(_0x381f90,null));}; \ No newline at end of file +var _0x9aab=['intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Template','includeAll','include','rows','catch','show','find','create','body','user','role','userProfileId','autoAssociation','destroy','params','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Templates','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters'];(function(_0x37d139,_0x5c17cf){var _0x379db9=function(_0x5ba61a){while(--_0x5ba61a){_0x37d139['push'](_0x37d139['shift']());}};_0x379db9(++_0x5c17cf);}(_0x9aab,0x1c7));var _0xb9aa=function(_0x142a22,_0x496ed7){_0x142a22=_0x142a22-0x0;var _0x780679=_0x9aab[_0x142a22];return _0x780679;};'use strict';var emlformat=require(_0xb9aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9aa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9aa('0x2'));var moment=require(_0xb9aa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb9aa('0x4'));var util=require(_0xb9aa('0x5'));var path=require('path');var sox=require(_0xb9aa('0x6'));var csv=require(_0xb9aa('0x7'));var ejs=require(_0xb9aa('0x8'));var fs=require('fs');var fs_extra=require(_0xb9aa('0x9'));var _=require(_0xb9aa('0xa'));var squel=require(_0xb9aa('0xb'));var crypto=require(_0xb9aa('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb9aa('0x7'));var querystring=require(_0xb9aa('0xd'));var Papa=require(_0xb9aa('0xe'));var Redis=require(_0xb9aa('0xf'));var authService=require(_0xb9aa('0x10'));var qs=require(_0xb9aa('0x11'));var as=require(_0xb9aa('0x12'));var hardwareService=require(_0xb9aa('0x13'));var logger=require(_0xb9aa('0x14'))(_0xb9aa('0x15'));var utils=require(_0xb9aa('0x16'));var config=require(_0xb9aa('0x17'));var licenseUtil=require(_0xb9aa('0x18'));var db=require(_0xb9aa('0x19'))['db'];function respondWithStatusCode(_0x319b55,_0x5f21c1){_0x5f21c1=_0x5f21c1||0xcc;return function(_0x2195e6){if(_0x2195e6){return _0x319b55['sendStatus'](_0x5f21c1);}return _0x319b55[_0xb9aa('0x1a')](_0x5f21c1)[_0xb9aa('0x1b')]();};}function respondWithResult(_0x442fe3,_0x59c8c9){_0x59c8c9=_0x59c8c9||0xc8;return function(_0x1c074a){if(_0x1c074a){return _0x442fe3[_0xb9aa('0x1a')](_0x59c8c9)[_0xb9aa('0x1c')](_0x1c074a);}};}function respondWithFilteredResult(_0x14cbf1,_0x5980a1){return function(_0x47fa19){if(_0x47fa19){var _0x22c6d2=typeof _0x5980a1[_0xb9aa('0x1d')]===_0xb9aa('0x1e')&&typeof _0x5980a1[_0xb9aa('0x1f')]==='undefined';var _0x9b8296=_0x47fa19[_0xb9aa('0x20')];var _0x3ea158=_0x22c6d2?0x0:_0x5980a1[_0xb9aa('0x1d')];var _0x5ec6bf=_0x22c6d2?_0x47fa19[_0xb9aa('0x20')]:_0x5980a1[_0xb9aa('0x1d')]+_0x5980a1['limit'];var _0x53c570;if(_0x5ec6bf>=_0x9b8296){_0x5ec6bf=_0x9b8296;_0x53c570=0xc8;}else{_0x53c570=0xce;}_0x14cbf1[_0xb9aa('0x1a')](_0x53c570);return _0x14cbf1[_0xb9aa('0x21')](_0xb9aa('0x22'),_0x3ea158+'-'+_0x5ec6bf+'/'+_0x9b8296)['json'](_0x47fa19);}return null;};}function patchUpdates(_0x5f601a){return function(_0x5f2858){try{jsonpatch['apply'](_0x5f2858,_0x5f601a,!![]);}catch(_0xc1f4df){return BPromise[_0xb9aa('0x23')](_0xc1f4df);}return _0x5f2858[_0xb9aa('0x24')]();};}function saveUpdates(_0x46e53a,_0x266b68){return function(_0x2795a2){if(_0x2795a2){return _0x2795a2[_0xb9aa('0x25')](_0x46e53a)['then'](function(_0xbe2b96){return _0xbe2b96;});}return null;};}function removeEntity(_0x494713,_0x568ef0){return function(_0x4d0de6){if(_0x4d0de6){return _0x4d0de6['destroy']()['then'](function(){var _0x351b5b=_0x4d0de6[_0xb9aa('0x26')]({'plain':!![]});var _0x7a90dc=_0xb9aa('0x27');return db[_0xb9aa('0x28')]['destroy']({'where':{'type':_0x7a90dc,'resourceId':_0x351b5b['id']}})[_0xb9aa('0x29')](function(){return _0x4d0de6;});})[_0xb9aa('0x29')](function(){_0x494713['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41bc0a,_0x53cb67){return function(_0x2ebea9){if(!_0x2ebea9){_0x41bc0a['sendStatus'](0x194);}return _0x2ebea9;};}function handleError(_0xa1b27f,_0x3420d1){_0x3420d1=_0x3420d1||0x1f4;return function(_0x2ae9b8){logger[_0xb9aa('0x2a')](_0x2ae9b8[_0xb9aa('0x2b')]);if(_0x2ae9b8[_0xb9aa('0x2c')]){delete _0x2ae9b8['name'];}_0xa1b27f[_0xb9aa('0x1a')](_0x3420d1)[_0xb9aa('0x2d')](_0x2ae9b8);};}exports[_0xb9aa('0x2e')]=function(_0x4a3330,_0x37717d){var _0x5eedf8={},_0x323708={},_0x138077={'count':0x0,'rows':[]};var _0x33273e=_[_0xb9aa('0x2f')](db['Template'][_0xb9aa('0x30')],function(_0x3d9f98){return{'name':_0x3d9f98[_0xb9aa('0x31')],'type':_0x3d9f98[_0xb9aa('0x32')][_0xb9aa('0x33')]};});_0x323708[_0xb9aa('0x34')]=_[_0xb9aa('0x2f')](_0x33273e,_0xb9aa('0x2c'));_0x323708['query']=_[_0xb9aa('0x35')](_0x4a3330['query']);_0x323708[_0xb9aa('0x36')]=_[_0xb9aa('0x37')](_0x323708[_0xb9aa('0x34')],_0x323708[_0xb9aa('0x38')]);_0x5eedf8[_0xb9aa('0x39')]=_[_0xb9aa('0x37')](_0x323708[_0xb9aa('0x34')],qs[_0xb9aa('0x3a')](_0x4a3330['query'][_0xb9aa('0x3a')]));_0x5eedf8['attributes']=_0x5eedf8[_0xb9aa('0x39')][_0xb9aa('0x3b')]?_0x5eedf8[_0xb9aa('0x39')]:_0x323708['model'];if(!_0x4a3330[_0xb9aa('0x38')][_0xb9aa('0x3c')](_0xb9aa('0x3d'))){_0x5eedf8[_0xb9aa('0x1f')]=qs['limit'](_0x4a3330['query'][_0xb9aa('0x1f')]);_0x5eedf8[_0xb9aa('0x1d')]=qs[_0xb9aa('0x1d')](_0x4a3330['query'][_0xb9aa('0x1d')]);}_0x5eedf8[_0xb9aa('0x3e')]=qs[_0xb9aa('0x3f')](_0x4a3330[_0xb9aa('0x38')][_0xb9aa('0x3f')]);_0x5eedf8[_0xb9aa('0x40')]=qs['filters'](_[_0xb9aa('0x41')](_0x4a3330['query'],_0x323708['filters']),_0x33273e);if(_0x4a3330[_0xb9aa('0x38')][_0xb9aa('0x42')]){_0x5eedf8['where']=_[_0xb9aa('0x43')](_0x5eedf8[_0xb9aa('0x40')],{'$or':_[_0xb9aa('0x2f')](_0x33273e,function(_0xcafbcc){if(_0xcafbcc[_0xb9aa('0x32')]!==_0xb9aa('0x44')){var _0x176d2c={};_0x176d2c[_0xcafbcc[_0xb9aa('0x2c')]]={'$like':'%'+_0x4a3330[_0xb9aa('0x38')][_0xb9aa('0x42')]+'%'};return _0x176d2c;}})});}_0x5eedf8=_[_0xb9aa('0x43')]({},_0x5eedf8,_0x4a3330[_0xb9aa('0x45')]);var _0x15cdc5={'where':_0x5eedf8[_0xb9aa('0x40')]};return db[_0xb9aa('0x46')]['count'](_0x15cdc5)[_0xb9aa('0x29')](function(_0x42f8d2){_0x138077[_0xb9aa('0x20')]=_0x42f8d2;if(_0x4a3330[_0xb9aa('0x38')][_0xb9aa('0x47')]){_0x5eedf8[_0xb9aa('0x48')]=[{'all':!![]}];}return db['Template']['findAll'](_0x5eedf8);})[_0xb9aa('0x29')](function(_0x41accc){_0x138077[_0xb9aa('0x49')]=_0x41accc;return _0x138077;})['then'](respondWithFilteredResult(_0x37717d,_0x5eedf8))[_0xb9aa('0x4a')](handleError(_0x37717d,null));};exports[_0xb9aa('0x4b')]=function(_0x478e4c,_0x49576e){var _0x4a4d4d={'raw':!![],'where':{'id':_0x478e4c['params']['id']}},_0x425e8f={};_0x425e8f[_0xb9aa('0x34')]=_[_0xb9aa('0x35')](db[_0xb9aa('0x46')][_0xb9aa('0x30')]);_0x425e8f['query']=_[_0xb9aa('0x35')](_0x478e4c['query']);_0x425e8f[_0xb9aa('0x36')]=_[_0xb9aa('0x37')](_0x425e8f[_0xb9aa('0x34')],_0x425e8f['query']);_0x4a4d4d[_0xb9aa('0x39')]=_[_0xb9aa('0x37')](_0x425e8f[_0xb9aa('0x34')],qs[_0xb9aa('0x3a')](_0x478e4c[_0xb9aa('0x38')][_0xb9aa('0x3a')]));_0x4a4d4d[_0xb9aa('0x39')]=_0x4a4d4d[_0xb9aa('0x39')]['length']?_0x4a4d4d['attributes']:_0x425e8f[_0xb9aa('0x34')];if(_0x478e4c[_0xb9aa('0x38')][_0xb9aa('0x47')]){_0x4a4d4d['include']=[{'all':!![]}];}_0x4a4d4d=_['merge']({},_0x4a4d4d,_0x478e4c[_0xb9aa('0x45')]);return db[_0xb9aa('0x46')][_0xb9aa('0x4c')](_0x4a4d4d)['then'](handleEntityNotFound(_0x49576e,null))[_0xb9aa('0x29')](respondWithResult(_0x49576e,null))[_0xb9aa('0x4a')](handleError(_0x49576e,null));};exports[_0xb9aa('0x4d')]=function(_0xc9764,_0x16b783){return db[_0xb9aa('0x46')][_0xb9aa('0x4d')](_0xc9764[_0xb9aa('0x4e')],{})['then'](function(_0xf3e738){var _0x514f75=_0xc9764[_0xb9aa('0x4f')]['get']({'plain':!![]});if(!_0x514f75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x514f75[_0xb9aa('0x50')]===_0xb9aa('0x4f')){var _0x14b496=_0xf3e738[_0xb9aa('0x26')]({'plain':!![]});var _0x42d0f7=_0xb9aa('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x42d0f7,'userProfileId':_0x514f75[_0xb9aa('0x51')]},'raw':!![]})[_0xb9aa('0x29')](function(_0x5cc7d6){if(_0x5cc7d6&&_0x5cc7d6[_0xb9aa('0x52')]===0x0){return db[_0xb9aa('0x28')][_0xb9aa('0x4d')]({'name':_0x14b496[_0xb9aa('0x2c')],'resourceId':_0x14b496['id'],'type':_0x5cc7d6['name'],'sectionId':_0x5cc7d6['id']},{})[_0xb9aa('0x29')](function(){return _0xf3e738;});}else{return _0xf3e738;}})['catch'](function(_0x2ad8f3){logger[_0xb9aa('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ad8f3);throw _0x2ad8f3;});}return _0xf3e738;})[_0xb9aa('0x29')](respondWithResult(_0x16b783,0xc9))['catch'](handleError(_0x16b783,null));};exports['update']=function(_0x53b648,_0x2a5afb){if(_0x53b648[_0xb9aa('0x4e')]['id']){delete _0x53b648[_0xb9aa('0x4e')]['id'];}return db[_0xb9aa('0x46')]['find']({'where':{'id':_0x53b648['params']['id']}})[_0xb9aa('0x29')](handleEntityNotFound(_0x2a5afb,null))[_0xb9aa('0x29')](saveUpdates(_0x53b648[_0xb9aa('0x4e')],null))[_0xb9aa('0x29')](respondWithResult(_0x2a5afb,null))[_0xb9aa('0x4a')](handleError(_0x2a5afb,null));};exports[_0xb9aa('0x53')]=function(_0x3bbf6e,_0x5ce855){return db['Template'][_0xb9aa('0x4c')]({'where':{'id':_0x3bbf6e[_0xb9aa('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ce855,null))[_0xb9aa('0x29')](removeEntity(_0x5ce855,null))[_0xb9aa('0x4a')](handleError(_0x5ce855,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a00caca..1458ca6 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 _0xadbb=['tools_templates','lodash','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','Template'];(function(_0x1ff9ff,_0x10e3a1){var _0x56cef5=function(_0x4dfbea){while(--_0x4dfbea){_0x1ff9ff['push'](_0x1ff9ff['shift']());}};_0x56cef5(++_0x10e3a1);}(_0xadbb,0x123));var _0xbadb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xadbb[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbadb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbadb('0x1'));var BPromise=require('bluebird');var rp=require(_0xbadb('0x2'));var fs=require('fs');var path=require(_0xbadb('0x3'));var rimraf=require(_0xbadb('0x4'));var config=require(_0xbadb('0x5'));var attributes=require(_0xbadb('0x6'));module[_0xbadb('0x7')]=function(_0x5079de,_0x1a9ad6){return _0x5079de['define'](_0xbadb('0x8'),attributes,{'tableName':_0xbadb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ff=['request-promise','path','rimraf','../../config/environment','exports','Template','tools_templates','lodash','api','moment'];(function(_0x1b9866,_0x4e5e55){var _0x483123=function(_0x2fb748){while(--_0x2fb748){_0x1b9866['push'](_0x1b9866['shift']());}};_0x483123(++_0x4e5e55);}(_0xa4ff,0xb1));var _0xfa4f=function(_0x35228c,_0x1e6824){_0x35228c=_0x35228c-0x0;var _0x56b5c0=_0xa4ff[_0x35228c];return _0x56b5c0;};'use strict';var _=require(_0xfa4f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfa4f('0x1'));var moment=require(_0xfa4f('0x2'));var BPromise=require('bluebird');var rp=require(_0xfa4f('0x3'));var fs=require('fs');var path=require(_0xfa4f('0x4'));var rimraf=require(_0xfa4f('0x5'));var config=require(_0xfa4f('0x6'));var attributes=require('./template.attributes');module[_0xfa4f('0x7')]=function(_0x18992b,_0x2134b9){return _0x18992b['define'](_0xfa4f('0x8'),attributes,{'tableName':_0xfa4f('0x9'),'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 f8e7547..727e45b 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 _0x40e8=['rpc','../../config/environment','client','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetTemplate','findAll','options','where','limit','include','map','attributes','model','then','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x200827,_0x4af951){var _0x120047=function(_0x4431de){while(--_0x4431de){_0x200827['push'](_0x200827['shift']());}};_0x120047(++_0x4af951);}(_0x40e8,0x8f));var _0x840e=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0x40e8[_0x413aac];return _0x569b11;};'use strict';var _=require(_0x840e('0x0'));var util=require(_0x840e('0x1'));var moment=require(_0x840e('0x2'));var BPromise=require(_0x840e('0x3'));var rs=require(_0x840e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x840e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x840e('0x6'))(_0x840e('0x7'));var config=require(_0x840e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x840e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25a15c,_0x2558b8,_0x4b3e16){return new BPromise(function(_0x252644,_0x2e3e58){return client[_0x840e('0xa')](_0x25a15c,_0x4b3e16)['then'](function(_0xc74e07){logger[_0x840e('0xb')](_0x840e('0xc'),_0x2558b8,_0x840e('0xd'));logger[_0x840e('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x2558b8,_0x840e('0xd'),JSON['stringify'](_0xc74e07));if(_0xc74e07[_0x840e('0xf')]){if(_0xc74e07['error'][_0x840e('0x10')]===0x1f4){logger[_0x840e('0xf')](_0x840e('0xc'),_0x2558b8,_0xc74e07[_0x840e('0xf')][_0x840e('0x11')]);return _0x2e3e58(_0xc74e07[_0x840e('0xf')][_0x840e('0x11')]);}logger['error'](_0x840e('0xc'),_0x2558b8,_0xc74e07[_0x840e('0xf')][_0x840e('0x11')]);return _0x252644(_0xc74e07[_0x840e('0xf')][_0x840e('0x11')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x2558b8,'request\x20sent');_0x252644(_0xc74e07['result'][_0x840e('0x11')]);}})[_0x840e('0x12')](function(_0x2391d1){logger[_0x840e('0xf')]('Template,\x20%s,\x20%s',_0x2558b8,_0x2391d1);_0x2e3e58(_0x2391d1);});});}exports[_0x840e('0x13')]=function(_0x27ce1a){var _0x295328=this;return new Promise(function(_0x104dea,_0x5e2950){return db['Template'][_0x840e('0x14')]({'raw':_0x27ce1a['options']?_0x27ce1a['options']['raw']===undefined?!![]:![]:!![],'where':_0x27ce1a[_0x840e('0x15')]?_0x27ce1a[_0x840e('0x15')][_0x840e('0x16')]||null:null,'attributes':_0x27ce1a[_0x840e('0x15')]?_0x27ce1a[_0x840e('0x15')]['attributes']||null:null,'limit':_0x27ce1a[_0x840e('0x15')]?_0x27ce1a[_0x840e('0x15')][_0x840e('0x17')]||null:null,'include':_0x27ce1a[_0x840e('0x15')]?_0x27ce1a[_0x840e('0x15')][_0x840e('0x18')]?_[_0x840e('0x19')](_0x27ce1a[_0x840e('0x15')][_0x840e('0x18')],function(_0xff6bfa){return{'model':db[_0xff6bfa['model']],'as':_0xff6bfa['as'],'attributes':_0xff6bfa[_0x840e('0x1a')],'include':_0xff6bfa[_0x840e('0x18')]?_[_0x840e('0x19')](_0xff6bfa['include'],function(_0xc1b36a){return{'model':db[_0xc1b36a[_0x840e('0x1b')]],'as':_0xc1b36a['as'],'attributes':_0xc1b36a[_0x840e('0x1a')],'include':_0xc1b36a[_0x840e('0x18')]?_[_0x840e('0x19')](_0xc1b36a[_0x840e('0x18')],function(_0x51e8c6){return{'model':db[_0x51e8c6[_0x840e('0x1b')]],'as':_0x51e8c6['as'],'attributes':_0x51e8c6[_0x840e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x840e('0x1c')](function(_0x39ea93){logger[_0x840e('0xb')](_0x840e('0x13'),_0x27ce1a);logger[_0x840e('0xe')]('GetTemplate',_0x27ce1a,JSON[_0x840e('0x1d')](_0x39ea93));_0x104dea(_0x39ea93);})[_0x840e('0x12')](function(_0x3cf891){logger[_0x840e('0xf')](_0x840e('0x13'),_0x3cf891[_0x840e('0x11')],_0x27ce1a);_0x5e2950(_0x295328[_0x840e('0xf')](0x1f4,_0x3cf891[_0x840e('0x11')]));});});}; \ No newline at end of file +var _0x8404=['Template,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetTemplate','findAll','options','raw','where','limit','include','map','attributes','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Template,\x20%s,\x20%s','debug'];(function(_0xa134a7,_0x5ca288){var _0x512ca2=function(_0x13ec3c){while(--_0x13ec3c){_0xa134a7['push'](_0xa134a7['shift']());}};_0x512ca2(++_0x5ca288);}(_0x8404,0x17b));var _0x4840=function(_0x172367,_0x342ac2){_0x172367=_0x172367-0x0;var _0x462ff5=_0x8404[_0x172367];return _0x462ff5;};'use strict';var _=require(_0x4840('0x0'));var util=require(_0x4840('0x1'));var moment=require(_0x4840('0x2'));var BPromise=require(_0x4840('0x3'));var rs=require(_0x4840('0x4'));var fs=require('fs');var Redis=require(_0x4840('0x5'));var db=require(_0x4840('0x6'))['db'];var utils=require(_0x4840('0x7'));var logger=require(_0x4840('0x8'))(_0x4840('0x9'));var config=require(_0x4840('0xa'));var jayson=require(_0x4840('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35e0f2,_0x30208c,_0x438c96){return new BPromise(function(_0x38b628,_0x24b50b){return client[_0x4840('0xc')](_0x35e0f2,_0x438c96)[_0x4840('0xd')](function(_0x3ac36d){logger[_0x4840('0xe')](_0x4840('0xf'),_0x30208c,'request\x20sent');logger[_0x4840('0x10')](_0x4840('0x11'),_0x30208c,'request\x20sent',JSON['stringify'](_0x3ac36d));if(_0x3ac36d['error']){if(_0x3ac36d['error'][_0x4840('0x12')]===0x1f4){logger[_0x4840('0x13')]('Template,\x20%s,\x20%s',_0x30208c,_0x3ac36d[_0x4840('0x13')]['message']);return _0x24b50b(_0x3ac36d[_0x4840('0x13')][_0x4840('0x14')]);}logger[_0x4840('0x13')](_0x4840('0xf'),_0x30208c,_0x3ac36d[_0x4840('0x13')][_0x4840('0x14')]);return _0x38b628(_0x3ac36d[_0x4840('0x13')][_0x4840('0x14')]);}else{logger[_0x4840('0xe')](_0x4840('0xf'),_0x30208c,'request\x20sent');_0x38b628(_0x3ac36d[_0x4840('0x15')][_0x4840('0x14')]);}})[_0x4840('0x16')](function(_0x4b1388){logger[_0x4840('0x13')](_0x4840('0xf'),_0x30208c,_0x4b1388);_0x24b50b(_0x4b1388);});});}exports[_0x4840('0x17')]=function(_0x5e5460){var _0x30b240=this;return new Promise(function(_0x411a32,_0x431cd1){return db['Template'][_0x4840('0x18')]({'raw':_0x5e5460[_0x4840('0x19')]?_0x5e5460[_0x4840('0x19')][_0x4840('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e5460[_0x4840('0x19')]?_0x5e5460['options'][_0x4840('0x1b')]||null:null,'attributes':_0x5e5460[_0x4840('0x19')]?_0x5e5460['options']['attributes']||null:null,'limit':_0x5e5460[_0x4840('0x19')]?_0x5e5460['options'][_0x4840('0x1c')]||null:null,'include':_0x5e5460['options']?_0x5e5460[_0x4840('0x19')][_0x4840('0x1d')]?_[_0x4840('0x1e')](_0x5e5460[_0x4840('0x19')][_0x4840('0x1d')],function(_0xaf602a){return{'model':db[_0xaf602a['model']],'as':_0xaf602a['as'],'attributes':_0xaf602a[_0x4840('0x1f')],'include':_0xaf602a['include']?_[_0x4840('0x1e')](_0xaf602a[_0x4840('0x1d')],function(_0x454fe0){return{'model':db[_0x454fe0[_0x4840('0x20')]],'as':_0x454fe0['as'],'attributes':_0x454fe0[_0x4840('0x1f')],'include':_0x454fe0['include']?_['map'](_0x454fe0[_0x4840('0x1d')],function(_0x5d16db){return{'model':db[_0x5d16db[_0x4840('0x20')]],'as':_0x5d16db['as'],'attributes':_0x5d16db[_0x4840('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4840('0xd')](function(_0x5a09b8){logger[_0x4840('0xe')](_0x4840('0x17'),_0x5e5460);logger['debug'](_0x4840('0x17'),_0x5e5460,JSON['stringify'](_0x5a09b8));_0x411a32(_0x5a09b8);})[_0x4840('0x16')](function(_0x59b3a5){logger[_0x4840('0x13')](_0x4840('0x17'),_0x59b3a5[_0x4840('0x14')],_0x5e5460);_0x431cd1(_0x30b240['error'](0x1f4,_0x59b3a5[_0x4840('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 570617a..540a627 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 _0x1780=['fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','index','get','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x5a4a1e,_0x5f014c){var _0x13b91d=function(_0x1b8403){while(--_0x1b8403){_0x5a4a1e['push'](_0x5a4a1e['shift']());}};_0x13b91d(++_0x5f014c);}(_0x1780,0xbf));var _0x0178=function(_0x210818,_0x56a728){_0x210818=_0x210818-0x0;var _0x2a7cb3=_0x1780[_0x210818];return _0x2a7cb3;};'use strict';var multer=require(_0x0178('0x0'));var util=require('util');var path=require(_0x0178('0x1'));var timeout=require(_0x0178('0x2'));var express=require(_0x0178('0x3'));var router=express[_0x0178('0x4')]();var fs_extra=require(_0x0178('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0178('0x6'));var config=require(_0x0178('0x7'));var controller=require(_0x0178('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0178('0x9')]);router[_0x0178('0xa')](_0x0178('0xb'),auth[_0x0178('0xc')](),controller['show']);router[_0x0178('0xa')](_0x0178('0xd'),auth[_0x0178('0xc')](),controller[_0x0178('0xe')]);router[_0x0178('0xa')]('/:id/any_conditions',auth[_0x0178('0xc')](),controller[_0x0178('0xf')]);router[_0x0178('0xa')](_0x0178('0x10'),auth[_0x0178('0xc')](),controller['getActions']);router[_0x0178('0x11')]('/',auth[_0x0178('0xc')](),controller[_0x0178('0x12')]);router['post'](_0x0178('0xd'),auth[_0x0178('0xc')](),controller[_0x0178('0x13')]);router[_0x0178('0x11')](_0x0178('0x14'),auth[_0x0178('0xc')](),controller[_0x0178('0x15')]);router[_0x0178('0x11')](_0x0178('0x10'),auth[_0x0178('0xc')](),controller[_0x0178('0x16')]);router[_0x0178('0x17')](_0x0178('0xb'),auth[_0x0178('0xc')](),controller[_0x0178('0x18')]);router[_0x0178('0x19')](_0x0178('0xb'),auth['isAuthenticated'](),controller[_0x0178('0x1a')]);module[_0x0178('0x1b')]=router; \ No newline at end of file +var _0x5c13=['post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','getAllConditions','getAnyConditions','getActions'];(function(_0x5bab4f,_0x5828c9){var _0x296d5c=function(_0x2e6d96){while(--_0x2e6d96){_0x5bab4f['push'](_0x5bab4f['shift']());}};_0x296d5c(++_0x5828c9);}(_0x5c13,0x103));var _0x35c1=function(_0x5e9d35,_0x382c91){_0x5e9d35=_0x5e9d35-0x0;var _0x3beb2e=_0x5c13[_0x5e9d35];return _0x3beb2e;};'use strict';var multer=require(_0x35c1('0x0'));var util=require(_0x35c1('0x1'));var path=require(_0x35c1('0x2'));var timeout=require(_0x35c1('0x3'));var express=require(_0x35c1('0x4'));var router=express[_0x35c1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x35c1('0x6'));var interaction=require(_0x35c1('0x7'));var config=require('../../config/environment');var controller=require(_0x35c1('0x8'));router[_0x35c1('0x9')]('/',auth[_0x35c1('0xa')](),controller['index']);router[_0x35c1('0x9')](_0x35c1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x35c1('0x9')](_0x35c1('0xc'),auth[_0x35c1('0xa')](),controller[_0x35c1('0xd')]);router[_0x35c1('0x9')]('/:id/any_conditions',auth[_0x35c1('0xa')](),controller[_0x35c1('0xe')]);router[_0x35c1('0x9')]('/:id/actions',auth['isAuthenticated'](),controller[_0x35c1('0xf')]);router[_0x35c1('0x10')]('/',auth[_0x35c1('0xa')](),controller[_0x35c1('0x11')]);router[_0x35c1('0x10')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x35c1('0x12')]);router[_0x35c1('0x10')](_0x35c1('0x13'),auth[_0x35c1('0xa')](),controller[_0x35c1('0x14')]);router[_0x35c1('0x10')]('/:id/actions',auth['isAuthenticated'](),controller[_0x35c1('0x15')]);router['put']('/:id',auth[_0x35c1('0xa')](),controller[_0x35c1('0x16')]);router[_0x35c1('0x17')](_0x35c1('0xb'),auth[_0x35c1('0xa')](),controller['destroy']);module[_0x35c1('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index fa6e84c..f8cdeef 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 _0x853e=['BOOLEAN','STRING'];(function(_0x305c73,_0x3cf300){var _0x593c74=function(_0x4746a0){while(--_0x4746a0){_0x305c73['push'](_0x305c73['shift']());}};_0x593c74(++_0x3cf300);}(_0x853e,0x93));var _0xe853=function(_0x331848,_0x310e73){_0x331848=_0x331848-0x0;var _0x546229=_0x853e[_0x331848];return _0x546229;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe853('0x0')]},'channel':{'type':Sequelize[_0xe853('0x0')]},'description':{'type':Sequelize[_0xe853('0x0')]},'status':{'type':Sequelize[_0xe853('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x27ea=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x27ea,0x11d));var _0xa27e=function(_0x1ba449,_0x4ee710){_0x1ba449=_0x1ba449-0x0;var _0x1a5e77=_0x27ea[_0x1ba449];return _0x1a5e77;};'use strict';var Sequelize=require(_0xa27e('0x0'));module[_0xa27e('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa27e('0x2')]},'description':{'type':Sequelize[_0xa27e('0x2')]},'status':{'type':Sequelize[_0xa27e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 649b6e9..f59bd84 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 _0x4999=['pick','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','json','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','show','params','catch','create','user','role','UserProfileSection','autoAssociation','body','find','addAllCondition','Condition','TriggerAnyId','getAllConditions','findOne'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0x4999,0x11b));var _0x9499=function(_0xf2ee1d,_0x21796d){_0xf2ee1d=_0xf2ee1d-0x0;var _0x250b14=_0x4999[_0xf2ee1d];return _0x250b14;};'use strict';var emlformat=require(_0x9499('0x0'));var rimraf=require(_0x9499('0x1'));var zipdir=require(_0x9499('0x2'));var jsonpatch=require(_0x9499('0x3'));var rp=require('request-promise');var moment=require(_0x9499('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9499('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9499('0x6'));var csv=require(_0x9499('0x7'));var ejs=require(_0x9499('0x8'));var fs=require('fs');var fs_extra=require(_0x9499('0x9'));var _=require(_0x9499('0xa'));var squel=require(_0x9499('0xb'));var crypto=require(_0x9499('0xc'));var jsforce=require(_0x9499('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9499('0xe'));var Papa=require('papaparse');var Redis=require(_0x9499('0xf'));var authService=require(_0x9499('0x10'));var qs=require(_0x9499('0x11'));var as=require(_0x9499('0x12'));var hardwareService=require(_0x9499('0x13'));var logger=require('../../config/logger')(_0x9499('0x14'));var utils=require(_0x9499('0x15'));var config=require(_0x9499('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9499('0x17'))['db'];function respondWithStatusCode(_0x32ec50,_0x1ab55a){_0x1ab55a=_0x1ab55a||0xcc;return function(_0x4b5316){if(_0x4b5316){return _0x32ec50[_0x9499('0x18')](_0x1ab55a);}return _0x32ec50[_0x9499('0x19')](_0x1ab55a)[_0x9499('0x1a')]();};}function respondWithResult(_0x1c404c,_0x48eb3b){_0x48eb3b=_0x48eb3b||0xc8;return function(_0xfdccf6){if(_0xfdccf6){return _0x1c404c[_0x9499('0x19')](_0x48eb3b)['json'](_0xfdccf6);}};}function respondWithFilteredResult(_0x17cdab,_0x2fe031){return function(_0x54567b){if(_0x54567b){var _0x567f2a=typeof _0x2fe031['offset']===_0x9499('0x1b')&&typeof _0x2fe031[_0x9499('0x1c')]===_0x9499('0x1b');var _0x5f9f4d=_0x54567b['count'];var _0xca9976=_0x567f2a?0x0:_0x2fe031[_0x9499('0x1d')];var _0x4479f0=_0x567f2a?_0x54567b[_0x9499('0x1e')]:_0x2fe031[_0x9499('0x1d')]+_0x2fe031['limit'];var _0x52e8b2;if(_0x4479f0>=_0x5f9f4d){_0x4479f0=_0x5f9f4d;_0x52e8b2=0xc8;}else{_0x52e8b2=0xce;}_0x17cdab[_0x9499('0x19')](_0x52e8b2);return _0x17cdab[_0x9499('0x1f')]('Content-Range',_0xca9976+'-'+_0x4479f0+'/'+_0x5f9f4d)[_0x9499('0x20')](_0x54567b);}return null;};}function patchUpdates(_0x4ab8c6){return function(_0x112b1c){try{jsonpatch[_0x9499('0x21')](_0x112b1c,_0x4ab8c6,!![]);}catch(_0x33481c){return BPromise[_0x9499('0x22')](_0x33481c);}return _0x112b1c[_0x9499('0x23')]();};}function saveUpdates(_0x338fd6,_0x157bdb){return function(_0x397fe7){if(_0x397fe7){return _0x397fe7[_0x9499('0x24')](_0x338fd6)[_0x9499('0x25')](function(_0x22dec4){return _0x22dec4;});}return null;};}function removeEntity(_0x5f114b,_0xd8b2b0){return function(_0x25e60b){if(_0x25e60b){return _0x25e60b[_0x9499('0x26')]()[_0x9499('0x25')](function(){var _0x49c3b2=_0x25e60b[_0x9499('0x27')]({'plain':!![]});var _0x1703e9=_0x9499('0x28');return db[_0x9499('0x29')][_0x9499('0x26')]({'where':{'type':_0x1703e9,'resourceId':_0x49c3b2['id']}})[_0x9499('0x25')](function(){return _0x25e60b;});})[_0x9499('0x25')](function(){_0x5f114b['status'](0xcc)[_0x9499('0x1a')]();});}};}function handleEntityNotFound(_0x1387ba,_0x3042bf){return function(_0xef13a){if(!_0xef13a){_0x1387ba[_0x9499('0x18')](0x194);}return _0xef13a;};}function handleError(_0x187740,_0x44ee9a){_0x44ee9a=_0x44ee9a||0x1f4;return function(_0x2603a9){logger[_0x9499('0x2a')](_0x2603a9[_0x9499('0x2b')]);if(_0x2603a9[_0x9499('0x2c')]){delete _0x2603a9[_0x9499('0x2c')];}_0x187740[_0x9499('0x19')](_0x44ee9a)[_0x9499('0x2d')](_0x2603a9);};}exports[_0x9499('0x2e')]=function(_0x2c22c7,_0x27a866){var _0x275176={},_0x936589={},_0x5eb32a={'count':0x0,'rows':[]};var _0x34b045=_[_0x9499('0x2f')](db[_0x9499('0x30')][_0x9499('0x31')],function(_0x30c77d){return{'name':_0x30c77d['fieldName'],'type':_0x30c77d[_0x9499('0x32')][_0x9499('0x33')]};});_0x936589[_0x9499('0x34')]=_[_0x9499('0x2f')](_0x34b045,_0x9499('0x2c'));_0x936589[_0x9499('0x35')]=_[_0x9499('0x36')](_0x2c22c7[_0x9499('0x35')]);_0x936589[_0x9499('0x37')]=_[_0x9499('0x38')](_0x936589[_0x9499('0x34')],_0x936589[_0x9499('0x35')]);_0x275176[_0x9499('0x39')]=_[_0x9499('0x38')](_0x936589['model'],qs[_0x9499('0x3a')](_0x2c22c7['query'][_0x9499('0x3a')]));_0x275176[_0x9499('0x39')]=_0x275176[_0x9499('0x39')][_0x9499('0x3b')]?_0x275176['attributes']:_0x936589[_0x9499('0x34')];if(!_0x2c22c7['query']['hasOwnProperty'](_0x9499('0x3c'))){_0x275176['limit']=qs[_0x9499('0x1c')](_0x2c22c7['query'][_0x9499('0x1c')]);_0x275176[_0x9499('0x1d')]=qs['offset'](_0x2c22c7['query'][_0x9499('0x1d')]);}_0x275176[_0x9499('0x3d')]=qs[_0x9499('0x3e')](_0x2c22c7[_0x9499('0x35')][_0x9499('0x3e')]);_0x275176['where']=qs[_0x9499('0x37')](_['pick'](_0x2c22c7[_0x9499('0x35')],_0x936589[_0x9499('0x37')]),_0x34b045);if(_0x2c22c7[_0x9499('0x35')][_0x9499('0x3f')]){_0x275176[_0x9499('0x40')]=_[_0x9499('0x41')](_0x275176[_0x9499('0x40')],{'$or':_[_0x9499('0x2f')](_0x34b045,function(_0x184e8e){if(_0x184e8e[_0x9499('0x32')]!=='VIRTUAL'){var _0x6f28f6={};_0x6f28f6[_0x184e8e[_0x9499('0x2c')]]={'$like':'%'+_0x2c22c7[_0x9499('0x35')][_0x9499('0x3f')]+'%'};return _0x6f28f6;}})});}_0x275176=_[_0x9499('0x41')]({},_0x275176,_0x2c22c7[_0x9499('0x42')]);var _0x85071c={'where':_0x275176['where']};return db['Trigger'][_0x9499('0x1e')](_0x85071c)['then'](function(_0x5b42fc){_0x5eb32a[_0x9499('0x1e')]=_0x5b42fc;if(_0x2c22c7[_0x9499('0x35')][_0x9499('0x43')]){_0x275176[_0x9499('0x44')]=[{'all':!![]}];}return db['Trigger'][_0x9499('0x45')](_0x275176);})[_0x9499('0x25')](function(_0x3011f3){_0x5eb32a['rows']=_0x3011f3;return _0x5eb32a;})[_0x9499('0x25')](respondWithFilteredResult(_0x27a866,_0x275176))['catch'](handleError(_0x27a866,null));};exports[_0x9499('0x46')]=function(_0x144910,_0x4819af){var _0x36f33f={'raw':![],'where':{'id':_0x144910[_0x9499('0x47')]['id']}},_0x31164a={};_0x31164a['model']=_[_0x9499('0x36')](db['Trigger']['rawAttributes']);_0x31164a[_0x9499('0x35')]=_[_0x9499('0x36')](_0x144910[_0x9499('0x35')]);_0x31164a[_0x9499('0x37')]=_[_0x9499('0x38')](_0x31164a[_0x9499('0x34')],_0x31164a[_0x9499('0x35')]);_0x36f33f[_0x9499('0x39')]=_['intersection'](_0x31164a['model'],qs['fields'](_0x144910[_0x9499('0x35')][_0x9499('0x3a')]));_0x36f33f[_0x9499('0x39')]=_0x36f33f[_0x9499('0x39')][_0x9499('0x3b')]?_0x36f33f[_0x9499('0x39')]:_0x31164a[_0x9499('0x34')];if(_0x144910[_0x9499('0x35')][_0x9499('0x43')]){_0x36f33f['include']=[{'all':!![]}];}_0x36f33f=_[_0x9499('0x41')]({},_0x36f33f,_0x144910['options']);return db[_0x9499('0x30')]['find'](_0x36f33f)['then'](handleEntityNotFound(_0x4819af,null))[_0x9499('0x25')](respondWithResult(_0x4819af,null))[_0x9499('0x48')](handleError(_0x4819af,null));};exports[_0x9499('0x49')]=function(_0x408606,_0x108cdd){return db[_0x9499('0x30')][_0x9499('0x49')](_0x408606['body'],{})[_0x9499('0x25')](function(_0x44a875){var _0x588be1=_0x408606[_0x9499('0x4a')]['get']({'plain':!![]});if(!_0x588be1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x588be1[_0x9499('0x4b')]===_0x9499('0x4a')){var _0x5d03dc=_0x44a875[_0x9499('0x27')]({'plain':!![]});var _0x50b40a='Triggers';return db[_0x9499('0x4c')]['find']({'where':{'name':_0x50b40a,'userProfileId':_0x588be1['userProfileId']},'raw':!![]})[_0x9499('0x25')](function(_0x5b539e){if(_0x5b539e&&_0x5b539e[_0x9499('0x4d')]===0x0){return db[_0x9499('0x29')]['create']({'name':_0x5d03dc['name'],'resourceId':_0x5d03dc['id'],'type':_0x5b539e[_0x9499('0x2c')],'sectionId':_0x5b539e['id']},{})[_0x9499('0x25')](function(){return _0x44a875;});}else{return _0x44a875;}})[_0x9499('0x48')](function(_0x5c1aca){logger[_0x9499('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c1aca);throw _0x5c1aca;});}return _0x44a875;})[_0x9499('0x25')](respondWithResult(_0x108cdd,0xc9))[_0x9499('0x48')](handleError(_0x108cdd,null));};exports['update']=function(_0x2ea585,_0x257a49){if(_0x2ea585['body']['id']){delete _0x2ea585[_0x9499('0x4e')]['id'];}return db[_0x9499('0x30')][_0x9499('0x4f')]({'where':{'id':_0x2ea585[_0x9499('0x47')]['id']}})[_0x9499('0x25')](handleEntityNotFound(_0x257a49,null))[_0x9499('0x25')](saveUpdates(_0x2ea585[_0x9499('0x4e')],null))['then'](respondWithResult(_0x257a49,null))[_0x9499('0x48')](handleError(_0x257a49,null));};exports[_0x9499('0x26')]=function(_0x21e18b,_0x11b3d3){return db[_0x9499('0x30')][_0x9499('0x4f')]({'where':{'id':_0x21e18b[_0x9499('0x47')]['id']}})[_0x9499('0x25')](handleEntityNotFound(_0x11b3d3,null))[_0x9499('0x25')](removeEntity(_0x11b3d3,null))[_0x9499('0x48')](handleError(_0x11b3d3,null));};exports[_0x9499('0x50')]=function(_0x1e5a40,_0x27e21e,_0x30985d){if(_0x1e5a40[_0x9499('0x4e')]['id']){delete _0x1e5a40[_0x9499('0x4e')]['id'];}return db[_0x9499('0x30')][_0x9499('0x4f')]({'where':{'id':_0x1e5a40['params']['id']}})[_0x9499('0x25')](handleEntityNotFound(_0x27e21e,null))['then'](function(_0xc00e95){if(_0xc00e95){_0x1e5a40[_0x9499('0x4e')]['TriggerAllId']=_0xc00e95['id'];return db[_0x9499('0x51')][_0x9499('0x49')](_0x1e5a40[_0x9499('0x4e')]);}})['then'](respondWithResult(_0x27e21e,null))['catch'](handleError(_0x27e21e,null));};exports['addAnyCondition']=function(_0x38f266,_0x5dc418,_0x1da457){if(_0x38f266['body']['id']){delete _0x38f266[_0x9499('0x4e')]['id'];}return db[_0x9499('0x30')][_0x9499('0x4f')]({'where':{'id':_0x38f266[_0x9499('0x47')]['id']}})[_0x9499('0x25')](handleEntityNotFound(_0x5dc418,null))[_0x9499('0x25')](function(_0x2feb11){if(_0x2feb11){_0x38f266[_0x9499('0x4e')][_0x9499('0x52')]=_0x2feb11['id'];return db['Condition'][_0x9499('0x49')](_0x38f266[_0x9499('0x4e')]);}})[_0x9499('0x25')](respondWithResult(_0x5dc418,null))[_0x9499('0x48')](handleError(_0x5dc418,null));};exports[_0x9499('0x53')]=function(_0x458548,_0x224d66,_0x233f48){var _0x3508ad={};var _0x5cfe1f={};var _0x1e8bdc;var _0x5e67cf;return db['Trigger'][_0x9499('0x54')]({'where':{'id':_0x458548[_0x9499('0x47')]['id']}})[_0x9499('0x25')](handleEntityNotFound(_0x224d66,null))[_0x9499('0x25')](function(_0xdc5b6f){if(_0xdc5b6f){_0x1e8bdc=_0xdc5b6f;_0x5cfe1f[_0x9499('0x34')]=_['keys'](db[_0x9499('0x51')][_0x9499('0x31')]);_0x5cfe1f['query']=_[_0x9499('0x36')](_0x458548[_0x9499('0x35')]);_0x5cfe1f[_0x9499('0x37')]=_[_0x9499('0x38')](_0x5cfe1f['model'],_0x5cfe1f[_0x9499('0x35')]);_0x3508ad[_0x9499('0x39')]=_[_0x9499('0x38')](_0x5cfe1f[_0x9499('0x34')],qs[_0x9499('0x3a')](_0x458548[_0x9499('0x35')][_0x9499('0x3a')]));_0x3508ad[_0x9499('0x39')]=_0x3508ad[_0x9499('0x39')][_0x9499('0x3b')]?_0x3508ad['attributes']:_0x5cfe1f[_0x9499('0x34')];_0x3508ad[_0x9499('0x3d')]=qs[_0x9499('0x3e')](_0x458548[_0x9499('0x35')]['sort']);_0x3508ad['where']=qs[_0x9499('0x37')](_[_0x9499('0x55')](_0x458548['query'],_0x5cfe1f[_0x9499('0x37')]));if(_0x458548[_0x9499('0x35')]['filter']){_0x3508ad[_0x9499('0x40')]=_[_0x9499('0x41')](_0x3508ad[_0x9499('0x40')],{'$or':_[_0x9499('0x2f')](_0x3508ad[_0x9499('0x39')],function(_0x449df0){var _0x2bf579={};_0x2bf579[_0x449df0]={'$like':'%'+_0x458548[_0x9499('0x35')][_0x9499('0x3f')]+'%'};return _0x2bf579;})});}_0x3508ad=_[_0x9499('0x41')]({},_0x3508ad,_0x458548[_0x9499('0x42')]);return _0x1e8bdc['getAllConditions'](_0x3508ad);}})[_0x9499('0x25')](function(_0x27eff1){if(_0x27eff1){_0x5e67cf=_0x27eff1[_0x9499('0x3b')];if(!_0x458548[_0x9499('0x35')][_0x9499('0x56')](_0x9499('0x3c'))){_0x3508ad[_0x9499('0x1c')]=qs[_0x9499('0x1c')](_0x458548['query'][_0x9499('0x1c')]);_0x3508ad[_0x9499('0x1d')]=qs['offset'](_0x458548[_0x9499('0x35')][_0x9499('0x1d')]);}return _0x1e8bdc[_0x9499('0x53')](_0x3508ad);}})[_0x9499('0x25')](function(_0x19741d){if(_0x19741d){return _0x19741d?{'count':_0x5e67cf,'rows':_0x19741d}:null;}})[_0x9499('0x25')](respondWithResult(_0x224d66,null))[_0x9499('0x48')](handleError(_0x224d66,null));};exports['getAnyConditions']=function(_0x166b72,_0x146625,_0x713b21){var _0x11fb04={};var _0x2753c4={};var _0x4a2140;var _0x5a74b7;return db[_0x9499('0x30')][_0x9499('0x54')]({'where':{'id':_0x166b72[_0x9499('0x47')]['id']}})[_0x9499('0x25')](handleEntityNotFound(_0x146625,null))[_0x9499('0x25')](function(_0x14ab07){if(_0x14ab07){_0x4a2140=_0x14ab07;_0x2753c4[_0x9499('0x34')]=_[_0x9499('0x36')](db[_0x9499('0x51')]['rawAttributes']);_0x2753c4['query']=_['keys'](_0x166b72['query']);_0x2753c4[_0x9499('0x37')]=_['intersection'](_0x2753c4[_0x9499('0x34')],_0x2753c4[_0x9499('0x35')]);_0x11fb04[_0x9499('0x39')]=_[_0x9499('0x38')](_0x2753c4[_0x9499('0x34')],qs['fields'](_0x166b72[_0x9499('0x35')][_0x9499('0x3a')]));_0x11fb04[_0x9499('0x39')]=_0x11fb04[_0x9499('0x39')][_0x9499('0x3b')]?_0x11fb04[_0x9499('0x39')]:_0x2753c4[_0x9499('0x34')];_0x11fb04[_0x9499('0x3d')]=qs[_0x9499('0x3e')](_0x166b72[_0x9499('0x35')][_0x9499('0x3e')]);_0x11fb04[_0x9499('0x40')]=qs['filters'](_[_0x9499('0x55')](_0x166b72['query'],_0x2753c4[_0x9499('0x37')]));if(_0x166b72[_0x9499('0x35')][_0x9499('0x3f')]){_0x11fb04[_0x9499('0x40')]=_[_0x9499('0x41')](_0x11fb04[_0x9499('0x40')],{'$or':_[_0x9499('0x2f')](_0x11fb04['attributes'],function(_0x1fdd7f){var _0x532179={};_0x532179[_0x1fdd7f]={'$like':'%'+_0x166b72[_0x9499('0x35')][_0x9499('0x3f')]+'%'};return _0x532179;})});}_0x11fb04=_[_0x9499('0x41')]({},_0x11fb04,_0x166b72[_0x9499('0x42')]);return _0x4a2140[_0x9499('0x57')](_0x11fb04);}})[_0x9499('0x25')](function(_0x3935da){if(_0x3935da){_0x5a74b7=_0x3935da[_0x9499('0x3b')];if(!_0x166b72['query'][_0x9499('0x56')]('nolimit')){_0x11fb04[_0x9499('0x1c')]=qs['limit'](_0x166b72[_0x9499('0x35')][_0x9499('0x1c')]);_0x11fb04['offset']=qs[_0x9499('0x1d')](_0x166b72[_0x9499('0x35')][_0x9499('0x1d')]);}return _0x4a2140[_0x9499('0x57')](_0x11fb04);}})[_0x9499('0x25')](function(_0x3d518b){if(_0x3d518b){return _0x3d518b?{'count':_0x5a74b7,'rows':_0x3d518b}:null;}})['then'](respondWithResult(_0x146625,null))[_0x9499('0x48')](handleError(_0x146625,null));};exports[_0x9499('0x58')]=function(_0x4f7c08,_0x45d265,_0x2496ed){if(_0x4f7c08[_0x9499('0x4e')]['id']){delete _0x4f7c08[_0x9499('0x4e')]['id'];}return db[_0x9499('0x30')][_0x9499('0x4f')]({'where':{'id':_0x4f7c08[_0x9499('0x47')]['id']}})['then'](handleEntityNotFound(_0x45d265,null))['then'](function(_0x15ba11){if(_0x15ba11){_0x4f7c08[_0x9499('0x4e')][_0x9499('0x59')]=_0x15ba11['id'];return db[_0x9499('0x5a')][_0x9499('0x49')](_0x4f7c08[_0x9499('0x4e')]);}})[_0x9499('0x25')](respondWithResult(_0x45d265,null))['catch'](handleError(_0x45d265,null));};exports['getActions']=function(_0xa19352,_0x17b910,_0xbeb6c2){var _0x518042={};var _0x23bc22={};var _0x29116e;var _0x4278f7;return db[_0x9499('0x30')][_0x9499('0x54')]({'where':{'id':_0xa19352[_0x9499('0x47')]['id']}})['then'](handleEntityNotFound(_0x17b910,null))[_0x9499('0x25')](function(_0x2c67ae){if(_0x2c67ae){_0x29116e=_0x2c67ae;_0x23bc22[_0x9499('0x34')]=_[_0x9499('0x36')](db['Action'][_0x9499('0x31')]);_0x23bc22[_0x9499('0x35')]=_['keys'](_0xa19352['query']);_0x23bc22[_0x9499('0x37')]=_['intersection'](_0x23bc22[_0x9499('0x34')],_0x23bc22[_0x9499('0x35')]);_0x518042['attributes']=_[_0x9499('0x38')](_0x23bc22[_0x9499('0x34')],qs[_0x9499('0x3a')](_0xa19352[_0x9499('0x35')]['fields']));_0x518042['attributes']=_0x518042[_0x9499('0x39')][_0x9499('0x3b')]?_0x518042['attributes']:_0x23bc22[_0x9499('0x34')];_0x518042[_0x9499('0x3d')]=qs['sort'](_0xa19352['query'][_0x9499('0x3e')]);_0x518042[_0x9499('0x40')]=qs['filters'](_[_0x9499('0x55')](_0xa19352[_0x9499('0x35')],_0x23bc22[_0x9499('0x37')]));if(_0xa19352[_0x9499('0x35')][_0x9499('0x3f')]){_0x518042[_0x9499('0x40')]=_[_0x9499('0x41')](_0x518042[_0x9499('0x40')],{'$or':_[_0x9499('0x2f')](_0x518042[_0x9499('0x39')],function(_0x453821){var _0x167eb6={};_0x167eb6[_0x453821]={'$like':'%'+_0xa19352['query']['filter']+'%'};return _0x167eb6;})});}_0x518042=_[_0x9499('0x41')]({},_0x518042,_0xa19352[_0x9499('0x42')]);return _0x29116e[_0x9499('0x5b')](_0x518042);}})[_0x9499('0x25')](function(_0x3ae446){if(_0x3ae446){_0x4278f7=_0x3ae446['length'];if(!_0xa19352[_0x9499('0x35')][_0x9499('0x56')](_0x9499('0x3c'))){_0x518042[_0x9499('0x1c')]=qs[_0x9499('0x1c')](_0xa19352[_0x9499('0x35')][_0x9499('0x1c')]);_0x518042['offset']=qs[_0x9499('0x1d')](_0xa19352[_0x9499('0x35')]['offset']);}return _0x29116e[_0x9499('0x5b')](_0x518042);}})[_0x9499('0x25')](function(_0x2e6685){if(_0x2e6685){return _0x2e6685?{'count':_0x4278f7,'rows':_0x2e6685}:null;}})[_0x9499('0x25')](respondWithResult(_0x17b910,null))[_0x9499('0x48')](handleError(_0x17b910,null));}; \ No newline at end of file +var _0xff01=['rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','get','Triggers','sendStatus','error','stack','name','send','map','Trigger','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','filter','pick','getAnyConditions','TriggerId','Action','getActions','findOne'];(function(_0x3a3964,_0x438f17){var _0x2bd0e9=function(_0x376afa){while(--_0x376afa){_0x3a3964['push'](_0x3a3964['shift']());}};_0x2bd0e9(++_0x438f17);}(_0xff01,0x1e5));var _0x1ff0=function(_0x256d38,_0x4a9eb2){_0x256d38=_0x256d38-0x0;var _0x1603eb=_0xff01[_0x256d38];return _0x1603eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ff0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ff0('0x1'));var rp=require('request-promise');var moment=require(_0x1ff0('0x2'));var BPromise=require(_0x1ff0('0x3'));var Mustache=require('mustache');var util=require(_0x1ff0('0x4'));var path=require(_0x1ff0('0x5'));var sox=require(_0x1ff0('0x6'));var csv=require(_0x1ff0('0x7'));var ejs=require(_0x1ff0('0x8'));var fs=require('fs');var fs_extra=require(_0x1ff0('0x9'));var _=require(_0x1ff0('0xa'));var squel=require(_0x1ff0('0xb'));var crypto=require(_0x1ff0('0xc'));var jsforce=require(_0x1ff0('0xd'));var deskjs=require(_0x1ff0('0xe'));var toCsv=require(_0x1ff0('0x7'));var querystring=require(_0x1ff0('0xf'));var Papa=require(_0x1ff0('0x10'));var Redis=require(_0x1ff0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1ff0('0x12'));var as=require(_0x1ff0('0x13'));var hardwareService=require(_0x1ff0('0x14'));var logger=require('../../config/logger')(_0x1ff0('0x15'));var utils=require(_0x1ff0('0x16'));var config=require(_0x1ff0('0x17'));var licenseUtil=require(_0x1ff0('0x18'));var db=require(_0x1ff0('0x19'))['db'];function respondWithStatusCode(_0x2f60a8,_0x3f5ccf){_0x3f5ccf=_0x3f5ccf||0xcc;return function(_0x2653f8){if(_0x2653f8){return _0x2f60a8['sendStatus'](_0x3f5ccf);}return _0x2f60a8[_0x1ff0('0x1a')](_0x3f5ccf)[_0x1ff0('0x1b')]();};}function respondWithResult(_0x252e0b,_0x34f067){_0x34f067=_0x34f067||0xc8;return function(_0x5ad3a8){if(_0x5ad3a8){return _0x252e0b[_0x1ff0('0x1a')](_0x34f067)['json'](_0x5ad3a8);}};}function respondWithFilteredResult(_0x5479d6,_0x46eea2){return function(_0xb4388c){if(_0xb4388c){var _0x16ed78=typeof _0x46eea2[_0x1ff0('0x1c')]===_0x1ff0('0x1d')&&typeof _0x46eea2['limit']==='undefined';var _0x17bd42=_0xb4388c[_0x1ff0('0x1e')];var _0x4facb1=_0x16ed78?0x0:_0x46eea2['offset'];var _0x38cbd8=_0x16ed78?_0xb4388c[_0x1ff0('0x1e')]:_0x46eea2['offset']+_0x46eea2[_0x1ff0('0x1f')];var _0x53ef9b;if(_0x38cbd8>=_0x17bd42){_0x38cbd8=_0x17bd42;_0x53ef9b=0xc8;}else{_0x53ef9b=0xce;}_0x5479d6[_0x1ff0('0x1a')](_0x53ef9b);return _0x5479d6[_0x1ff0('0x20')](_0x1ff0('0x21'),_0x4facb1+'-'+_0x38cbd8+'/'+_0x17bd42)[_0x1ff0('0x22')](_0xb4388c);}return null;};}function patchUpdates(_0x55ced9){return function(_0x14c1d4){try{jsonpatch[_0x1ff0('0x23')](_0x14c1d4,_0x55ced9,!![]);}catch(_0x563ddc){return BPromise[_0x1ff0('0x24')](_0x563ddc);}return _0x14c1d4[_0x1ff0('0x25')]();};}function saveUpdates(_0x56748d,_0x412c1a){return function(_0x152e3f){if(_0x152e3f){return _0x152e3f['update'](_0x56748d)['then'](function(_0x3ce77d){return _0x3ce77d;});}return null;};}function removeEntity(_0xc34542,_0x514502){return function(_0x558705){if(_0x558705){return _0x558705[_0x1ff0('0x26')]()[_0x1ff0('0x27')](function(){var _0x40600c=_0x558705[_0x1ff0('0x28')]({'plain':!![]});var _0x3c4b78=_0x1ff0('0x29');return db['UserProfileResource'][_0x1ff0('0x26')]({'where':{'type':_0x3c4b78,'resourceId':_0x40600c['id']}})['then'](function(){return _0x558705;});})[_0x1ff0('0x27')](function(){_0xc34542[_0x1ff0('0x1a')](0xcc)[_0x1ff0('0x1b')]();});}};}function handleEntityNotFound(_0x46f1b8,_0x1978e8){return function(_0x3dcdf3){if(!_0x3dcdf3){_0x46f1b8[_0x1ff0('0x2a')](0x194);}return _0x3dcdf3;};}function handleError(_0x34406d,_0x58878a){_0x58878a=_0x58878a||0x1f4;return function(_0x36156a){logger[_0x1ff0('0x2b')](_0x36156a[_0x1ff0('0x2c')]);if(_0x36156a['name']){delete _0x36156a[_0x1ff0('0x2d')];}_0x34406d['status'](_0x58878a)[_0x1ff0('0x2e')](_0x36156a);};}exports['index']=function(_0x155f2f,_0x24c63b){var _0x36d618={},_0x534604={},_0x268240={'count':0x0,'rows':[]};var _0x1bd560=_[_0x1ff0('0x2f')](db[_0x1ff0('0x30')]['rawAttributes'],function(_0x25880d){return{'name':_0x25880d[_0x1ff0('0x31')],'type':_0x25880d[_0x1ff0('0x32')][_0x1ff0('0x33')]};});_0x534604[_0x1ff0('0x34')]=_['map'](_0x1bd560,_0x1ff0('0x2d'));_0x534604[_0x1ff0('0x35')]=_[_0x1ff0('0x36')](_0x155f2f['query']);_0x534604[_0x1ff0('0x37')]=_['intersection'](_0x534604[_0x1ff0('0x34')],_0x534604['query']);_0x36d618['attributes']=_[_0x1ff0('0x38')](_0x534604['model'],qs[_0x1ff0('0x39')](_0x155f2f[_0x1ff0('0x35')][_0x1ff0('0x39')]));_0x36d618[_0x1ff0('0x3a')]=_0x36d618['attributes'][_0x1ff0('0x3b')]?_0x36d618[_0x1ff0('0x3a')]:_0x534604['model'];if(!_0x155f2f[_0x1ff0('0x35')][_0x1ff0('0x3c')](_0x1ff0('0x3d'))){_0x36d618['limit']=qs[_0x1ff0('0x1f')](_0x155f2f[_0x1ff0('0x35')][_0x1ff0('0x1f')]);_0x36d618[_0x1ff0('0x1c')]=qs[_0x1ff0('0x1c')](_0x155f2f[_0x1ff0('0x35')]['offset']);}_0x36d618[_0x1ff0('0x3e')]=qs[_0x1ff0('0x3f')](_0x155f2f[_0x1ff0('0x35')][_0x1ff0('0x3f')]);_0x36d618[_0x1ff0('0x40')]=qs[_0x1ff0('0x37')](_['pick'](_0x155f2f[_0x1ff0('0x35')],_0x534604[_0x1ff0('0x37')]),_0x1bd560);if(_0x155f2f[_0x1ff0('0x35')]['filter']){_0x36d618[_0x1ff0('0x40')]=_[_0x1ff0('0x41')](_0x36d618['where'],{'$or':_['map'](_0x1bd560,function(_0x2ddb8d){if(_0x2ddb8d['type']!==_0x1ff0('0x42')){var _0x29d834={};_0x29d834[_0x2ddb8d[_0x1ff0('0x2d')]]={'$like':'%'+_0x155f2f[_0x1ff0('0x35')]['filter']+'%'};return _0x29d834;}})});}_0x36d618=_[_0x1ff0('0x41')]({},_0x36d618,_0x155f2f[_0x1ff0('0x43')]);var _0x44cae4={'where':_0x36d618[_0x1ff0('0x40')]};return db['Trigger']['count'](_0x44cae4)['then'](function(_0x5912ae){_0x268240['count']=_0x5912ae;if(_0x155f2f[_0x1ff0('0x35')][_0x1ff0('0x44')]){_0x36d618[_0x1ff0('0x45')]=[{'all':!![]}];}return db['Trigger'][_0x1ff0('0x46')](_0x36d618);})[_0x1ff0('0x27')](function(_0x1200f0){_0x268240[_0x1ff0('0x47')]=_0x1200f0;return _0x268240;})[_0x1ff0('0x27')](respondWithFilteredResult(_0x24c63b,_0x36d618))[_0x1ff0('0x48')](handleError(_0x24c63b,null));};exports[_0x1ff0('0x49')]=function(_0x4f3ac2,_0x5e5df0){var _0x400e91={'raw':![],'where':{'id':_0x4f3ac2[_0x1ff0('0x4a')]['id']}},_0xc7c4b8={};_0xc7c4b8[_0x1ff0('0x34')]=_['keys'](db['Trigger'][_0x1ff0('0x4b')]);_0xc7c4b8[_0x1ff0('0x35')]=_[_0x1ff0('0x36')](_0x4f3ac2['query']);_0xc7c4b8[_0x1ff0('0x37')]=_[_0x1ff0('0x38')](_0xc7c4b8[_0x1ff0('0x34')],_0xc7c4b8[_0x1ff0('0x35')]);_0x400e91[_0x1ff0('0x3a')]=_[_0x1ff0('0x38')](_0xc7c4b8[_0x1ff0('0x34')],qs['fields'](_0x4f3ac2[_0x1ff0('0x35')]['fields']));_0x400e91[_0x1ff0('0x3a')]=_0x400e91['attributes'][_0x1ff0('0x3b')]?_0x400e91['attributes']:_0xc7c4b8[_0x1ff0('0x34')];if(_0x4f3ac2[_0x1ff0('0x35')][_0x1ff0('0x44')]){_0x400e91[_0x1ff0('0x45')]=[{'all':!![]}];}_0x400e91=_[_0x1ff0('0x41')]({},_0x400e91,_0x4f3ac2[_0x1ff0('0x43')]);return db[_0x1ff0('0x30')][_0x1ff0('0x4c')](_0x400e91)[_0x1ff0('0x27')](handleEntityNotFound(_0x5e5df0,null))[_0x1ff0('0x27')](respondWithResult(_0x5e5df0,null))[_0x1ff0('0x48')](handleError(_0x5e5df0,null));};exports[_0x1ff0('0x4d')]=function(_0x4d88e5,_0x5cc718){return db[_0x1ff0('0x30')][_0x1ff0('0x4d')](_0x4d88e5[_0x1ff0('0x4e')],{})[_0x1ff0('0x27')](function(_0x332f3b){var _0x161fa2=_0x4d88e5[_0x1ff0('0x4f')][_0x1ff0('0x28')]({'plain':!![]});if(!_0x161fa2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x161fa2['role']===_0x1ff0('0x4f')){var _0x11bf7b=_0x332f3b['get']({'plain':!![]});var _0x12d40b=_0x1ff0('0x29');return db[_0x1ff0('0x50')]['find']({'where':{'name':_0x12d40b,'userProfileId':_0x161fa2[_0x1ff0('0x51')]},'raw':!![]})['then'](function(_0x9206a8){if(_0x9206a8&&_0x9206a8[_0x1ff0('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x11bf7b[_0x1ff0('0x2d')],'resourceId':_0x11bf7b['id'],'type':_0x9206a8[_0x1ff0('0x2d')],'sectionId':_0x9206a8['id']},{})[_0x1ff0('0x27')](function(){return _0x332f3b;});}else{return _0x332f3b;}})[_0x1ff0('0x48')](function(_0x4a3386){logger[_0x1ff0('0x2b')](_0x1ff0('0x53'),_0x4a3386);throw _0x4a3386;});}return _0x332f3b;})[_0x1ff0('0x27')](respondWithResult(_0x5cc718,0xc9))[_0x1ff0('0x48')](handleError(_0x5cc718,null));};exports[_0x1ff0('0x54')]=function(_0x5546c4,_0x251794){if(_0x5546c4[_0x1ff0('0x4e')]['id']){delete _0x5546c4[_0x1ff0('0x4e')]['id'];}return db[_0x1ff0('0x30')][_0x1ff0('0x4c')]({'where':{'id':_0x5546c4[_0x1ff0('0x4a')]['id']}})[_0x1ff0('0x27')](handleEntityNotFound(_0x251794,null))[_0x1ff0('0x27')](saveUpdates(_0x5546c4[_0x1ff0('0x4e')],null))['then'](respondWithResult(_0x251794,null))[_0x1ff0('0x48')](handleError(_0x251794,null));};exports[_0x1ff0('0x26')]=function(_0x27a319,_0x333fd6){return db[_0x1ff0('0x30')][_0x1ff0('0x4c')]({'where':{'id':_0x27a319[_0x1ff0('0x4a')]['id']}})[_0x1ff0('0x27')](handleEntityNotFound(_0x333fd6,null))[_0x1ff0('0x27')](removeEntity(_0x333fd6,null))['catch'](handleError(_0x333fd6,null));};exports[_0x1ff0('0x55')]=function(_0x6e97ff,_0x2a9eba,_0x363fb9){if(_0x6e97ff[_0x1ff0('0x4e')]['id']){delete _0x6e97ff[_0x1ff0('0x4e')]['id'];}return db[_0x1ff0('0x30')][_0x1ff0('0x4c')]({'where':{'id':_0x6e97ff[_0x1ff0('0x4a')]['id']}})[_0x1ff0('0x27')](handleEntityNotFound(_0x2a9eba,null))[_0x1ff0('0x27')](function(_0xc3d2da){if(_0xc3d2da){_0x6e97ff['body'][_0x1ff0('0x56')]=_0xc3d2da['id'];return db[_0x1ff0('0x57')][_0x1ff0('0x4d')](_0x6e97ff[_0x1ff0('0x4e')]);}})[_0x1ff0('0x27')](respondWithResult(_0x2a9eba,null))['catch'](handleError(_0x2a9eba,null));};exports[_0x1ff0('0x58')]=function(_0x44da07,_0x2e84b1,_0x596933){if(_0x44da07[_0x1ff0('0x4e')]['id']){delete _0x44da07['body']['id'];}return db[_0x1ff0('0x30')][_0x1ff0('0x4c')]({'where':{'id':_0x44da07[_0x1ff0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e84b1,null))['then'](function(_0x472319){if(_0x472319){_0x44da07['body']['TriggerAnyId']=_0x472319['id'];return db[_0x1ff0('0x57')][_0x1ff0('0x4d')](_0x44da07[_0x1ff0('0x4e')]);}})['then'](respondWithResult(_0x2e84b1,null))[_0x1ff0('0x48')](handleError(_0x2e84b1,null));};exports[_0x1ff0('0x59')]=function(_0x198a9e,_0x3860d2,_0x275971){var _0x1109f6={};var _0x26a577={};var _0x2eee0b;var _0x4997cf;return db[_0x1ff0('0x30')]['findOne']({'where':{'id':_0x198a9e[_0x1ff0('0x4a')]['id']}})[_0x1ff0('0x27')](handleEntityNotFound(_0x3860d2,null))[_0x1ff0('0x27')](function(_0x381fa4){if(_0x381fa4){_0x2eee0b=_0x381fa4;_0x26a577[_0x1ff0('0x34')]=_[_0x1ff0('0x36')](db[_0x1ff0('0x57')][_0x1ff0('0x4b')]);_0x26a577[_0x1ff0('0x35')]=_['keys'](_0x198a9e[_0x1ff0('0x35')]);_0x26a577[_0x1ff0('0x37')]=_[_0x1ff0('0x38')](_0x26a577[_0x1ff0('0x34')],_0x26a577['query']);_0x1109f6[_0x1ff0('0x3a')]=_[_0x1ff0('0x38')](_0x26a577[_0x1ff0('0x34')],qs[_0x1ff0('0x39')](_0x198a9e[_0x1ff0('0x35')][_0x1ff0('0x39')]));_0x1109f6[_0x1ff0('0x3a')]=_0x1109f6[_0x1ff0('0x3a')][_0x1ff0('0x3b')]?_0x1109f6[_0x1ff0('0x3a')]:_0x26a577[_0x1ff0('0x34')];_0x1109f6[_0x1ff0('0x3e')]=qs[_0x1ff0('0x3f')](_0x198a9e[_0x1ff0('0x35')][_0x1ff0('0x3f')]);_0x1109f6[_0x1ff0('0x40')]=qs['filters'](_['pick'](_0x198a9e['query'],_0x26a577['filters']));if(_0x198a9e[_0x1ff0('0x35')][_0x1ff0('0x5a')]){_0x1109f6[_0x1ff0('0x40')]=_['merge'](_0x1109f6[_0x1ff0('0x40')],{'$or':_['map'](_0x1109f6['attributes'],function(_0x3bd819){var _0x7f7997={};_0x7f7997[_0x3bd819]={'$like':'%'+_0x198a9e[_0x1ff0('0x35')][_0x1ff0('0x5a')]+'%'};return _0x7f7997;})});}_0x1109f6=_[_0x1ff0('0x41')]({},_0x1109f6,_0x198a9e['options']);return _0x2eee0b[_0x1ff0('0x59')](_0x1109f6);}})[_0x1ff0('0x27')](function(_0x2edceb){if(_0x2edceb){_0x4997cf=_0x2edceb[_0x1ff0('0x3b')];if(!_0x198a9e['query'][_0x1ff0('0x3c')]('nolimit')){_0x1109f6[_0x1ff0('0x1f')]=qs['limit'](_0x198a9e[_0x1ff0('0x35')][_0x1ff0('0x1f')]);_0x1109f6[_0x1ff0('0x1c')]=qs[_0x1ff0('0x1c')](_0x198a9e[_0x1ff0('0x35')][_0x1ff0('0x1c')]);}return _0x2eee0b[_0x1ff0('0x59')](_0x1109f6);}})[_0x1ff0('0x27')](function(_0x196d8d){if(_0x196d8d){return _0x196d8d?{'count':_0x4997cf,'rows':_0x196d8d}:null;}})[_0x1ff0('0x27')](respondWithResult(_0x3860d2,null))['catch'](handleError(_0x3860d2,null));};exports['getAnyConditions']=function(_0x5dae47,_0x3f9915,_0x723b0){var _0x7ba586={};var _0xcb18ee={};var _0x2db221;var _0x522195;return db[_0x1ff0('0x30')]['findOne']({'where':{'id':_0x5dae47[_0x1ff0('0x4a')]['id']}})[_0x1ff0('0x27')](handleEntityNotFound(_0x3f9915,null))[_0x1ff0('0x27')](function(_0x5200bf){if(_0x5200bf){_0x2db221=_0x5200bf;_0xcb18ee[_0x1ff0('0x34')]=_[_0x1ff0('0x36')](db['Condition'][_0x1ff0('0x4b')]);_0xcb18ee['query']=_[_0x1ff0('0x36')](_0x5dae47[_0x1ff0('0x35')]);_0xcb18ee[_0x1ff0('0x37')]=_[_0x1ff0('0x38')](_0xcb18ee['model'],_0xcb18ee[_0x1ff0('0x35')]);_0x7ba586[_0x1ff0('0x3a')]=_[_0x1ff0('0x38')](_0xcb18ee[_0x1ff0('0x34')],qs[_0x1ff0('0x39')](_0x5dae47[_0x1ff0('0x35')][_0x1ff0('0x39')]));_0x7ba586[_0x1ff0('0x3a')]=_0x7ba586['attributes'][_0x1ff0('0x3b')]?_0x7ba586['attributes']:_0xcb18ee[_0x1ff0('0x34')];_0x7ba586[_0x1ff0('0x3e')]=qs[_0x1ff0('0x3f')](_0x5dae47[_0x1ff0('0x35')][_0x1ff0('0x3f')]);_0x7ba586[_0x1ff0('0x40')]=qs[_0x1ff0('0x37')](_[_0x1ff0('0x5b')](_0x5dae47[_0x1ff0('0x35')],_0xcb18ee[_0x1ff0('0x37')]));if(_0x5dae47[_0x1ff0('0x35')][_0x1ff0('0x5a')]){_0x7ba586[_0x1ff0('0x40')]=_['merge'](_0x7ba586[_0x1ff0('0x40')],{'$or':_['map'](_0x7ba586[_0x1ff0('0x3a')],function(_0x5675e0){var _0x14dd42={};_0x14dd42[_0x5675e0]={'$like':'%'+_0x5dae47[_0x1ff0('0x35')][_0x1ff0('0x5a')]+'%'};return _0x14dd42;})});}_0x7ba586=_[_0x1ff0('0x41')]({},_0x7ba586,_0x5dae47[_0x1ff0('0x43')]);return _0x2db221[_0x1ff0('0x5c')](_0x7ba586);}})[_0x1ff0('0x27')](function(_0x5c6357){if(_0x5c6357){_0x522195=_0x5c6357[_0x1ff0('0x3b')];if(!_0x5dae47['query'][_0x1ff0('0x3c')](_0x1ff0('0x3d'))){_0x7ba586[_0x1ff0('0x1f')]=qs[_0x1ff0('0x1f')](_0x5dae47[_0x1ff0('0x35')]['limit']);_0x7ba586[_0x1ff0('0x1c')]=qs[_0x1ff0('0x1c')](_0x5dae47[_0x1ff0('0x35')][_0x1ff0('0x1c')]);}return _0x2db221[_0x1ff0('0x5c')](_0x7ba586);}})[_0x1ff0('0x27')](function(_0xe48f07){if(_0xe48f07){return _0xe48f07?{'count':_0x522195,'rows':_0xe48f07}:null;}})[_0x1ff0('0x27')](respondWithResult(_0x3f9915,null))[_0x1ff0('0x48')](handleError(_0x3f9915,null));};exports['addAction']=function(_0x38deb4,_0x12ed84,_0x119460){if(_0x38deb4[_0x1ff0('0x4e')]['id']){delete _0x38deb4['body']['id'];}return db[_0x1ff0('0x30')][_0x1ff0('0x4c')]({'where':{'id':_0x38deb4[_0x1ff0('0x4a')]['id']}})[_0x1ff0('0x27')](handleEntityNotFound(_0x12ed84,null))[_0x1ff0('0x27')](function(_0x217835){if(_0x217835){_0x38deb4['body'][_0x1ff0('0x5d')]=_0x217835['id'];return db[_0x1ff0('0x5e')][_0x1ff0('0x4d')](_0x38deb4['body']);}})[_0x1ff0('0x27')](respondWithResult(_0x12ed84,null))[_0x1ff0('0x48')](handleError(_0x12ed84,null));};exports[_0x1ff0('0x5f')]=function(_0x191068,_0x16fff9,_0x58be10){var _0x35c5df={};var _0x1d6f06={};var _0x8e320c;var _0x16ab85;return db[_0x1ff0('0x30')][_0x1ff0('0x60')]({'where':{'id':_0x191068[_0x1ff0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x16fff9,null))[_0x1ff0('0x27')](function(_0x4a83f4){if(_0x4a83f4){_0x8e320c=_0x4a83f4;_0x1d6f06['model']=_[_0x1ff0('0x36')](db[_0x1ff0('0x5e')][_0x1ff0('0x4b')]);_0x1d6f06[_0x1ff0('0x35')]=_['keys'](_0x191068[_0x1ff0('0x35')]);_0x1d6f06[_0x1ff0('0x37')]=_[_0x1ff0('0x38')](_0x1d6f06[_0x1ff0('0x34')],_0x1d6f06[_0x1ff0('0x35')]);_0x35c5df[_0x1ff0('0x3a')]=_[_0x1ff0('0x38')](_0x1d6f06[_0x1ff0('0x34')],qs[_0x1ff0('0x39')](_0x191068[_0x1ff0('0x35')][_0x1ff0('0x39')]));_0x35c5df['attributes']=_0x35c5df['attributes'][_0x1ff0('0x3b')]?_0x35c5df['attributes']:_0x1d6f06[_0x1ff0('0x34')];_0x35c5df[_0x1ff0('0x3e')]=qs[_0x1ff0('0x3f')](_0x191068[_0x1ff0('0x35')][_0x1ff0('0x3f')]);_0x35c5df[_0x1ff0('0x40')]=qs['filters'](_[_0x1ff0('0x5b')](_0x191068[_0x1ff0('0x35')],_0x1d6f06[_0x1ff0('0x37')]));if(_0x191068[_0x1ff0('0x35')][_0x1ff0('0x5a')]){_0x35c5df[_0x1ff0('0x40')]=_[_0x1ff0('0x41')](_0x35c5df['where'],{'$or':_[_0x1ff0('0x2f')](_0x35c5df[_0x1ff0('0x3a')],function(_0x5e4dd1){var _0x5eb2ff={};_0x5eb2ff[_0x5e4dd1]={'$like':'%'+_0x191068['query'][_0x1ff0('0x5a')]+'%'};return _0x5eb2ff;})});}_0x35c5df=_[_0x1ff0('0x41')]({},_0x35c5df,_0x191068[_0x1ff0('0x43')]);return _0x8e320c[_0x1ff0('0x5f')](_0x35c5df);}})[_0x1ff0('0x27')](function(_0x4251c5){if(_0x4251c5){_0x16ab85=_0x4251c5[_0x1ff0('0x3b')];if(!_0x191068['query'][_0x1ff0('0x3c')]('nolimit')){_0x35c5df[_0x1ff0('0x1f')]=qs[_0x1ff0('0x1f')](_0x191068['query'][_0x1ff0('0x1f')]);_0x35c5df[_0x1ff0('0x1c')]=qs[_0x1ff0('0x1c')](_0x191068[_0x1ff0('0x35')][_0x1ff0('0x1c')]);}return _0x8e320c['getActions'](_0x35c5df);}})[_0x1ff0('0x27')](function(_0x4f8d1b){if(_0x4f8d1b){return _0x4f8d1b?{'count':_0x16ab85,'rows':_0x4f8d1b}:null;}})[_0x1ff0('0x27')](respondWithResult(_0x16fff9,null))['catch'](handleError(_0x16fff9,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 14d374e..e613eb9 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 _0xf3cc=['../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x349213,_0x34f1fe){var _0xb89435=function(_0x25c44a){while(--_0x25c44a){_0x349213['push'](_0x349213['shift']());}};_0xb89435(++_0x34f1fe);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x21d3c4,_0x48d915){_0x21d3c4=_0x21d3c4-0x0;var _0x341584=_0xf3cc[_0x21d3c4];return _0x341584;};'use strict';var _=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var logger=require(_0xcf3c('0x2'))(_0xcf3c('0x3'));var moment=require('moment');var BPromise=require(_0xcf3c('0x4'));var rp=require(_0xcf3c('0x5'));var fs=require('fs');var path=require(_0xcf3c('0x6'));var rimraf=require('rimraf');var config=require(_0xcf3c('0x7'));var attributes=require(_0xcf3c('0x8'));module['exports']=function(_0x41f804,_0x2b5cae){return _0x41f804[_0xcf3c('0x9')](_0xcf3c('0xa'),attributes,{'tableName':_0xcf3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba6c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Trigger','tools_triggers','lodash'];(function(_0x581450,_0x2966bf){var _0x3a69b9=function(_0x391cf4){while(--_0x391cf4){_0x581450['push'](_0x581450['shift']());}};_0x3a69b9(++_0x2966bf);}(_0xba6c,0x113));var _0xcba6=function(_0x532d78,_0x25b6a8){_0x532d78=_0x532d78-0x0;var _0x5990c4=_0xba6c[_0x532d78];return _0x5990c4;};'use strict';var _=require(_0xcba6('0x0'));var util=require('util');var logger=require(_0xcba6('0x1'))(_0xcba6('0x2'));var moment=require(_0xcba6('0x3'));var BPromise=require(_0xcba6('0x4'));var rp=require(_0xcba6('0x5'));var fs=require('fs');var path=require(_0xcba6('0x6'));var rimraf=require(_0xcba6('0x7'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xcba6('0x8')]=function(_0x1fd901,_0x34d35d){return _0x1fd901[_0xcba6('0x9')](_0xcba6('0xa'),attributes,{'tableName':_0xcba6('0xb'),'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 1791676..4090965 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 _0x49b2=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrigger','then','debug'];(function(_0x3e5a74,_0x496bbe){var _0x3a2195=function(_0x35edd0){while(--_0x35edd0){_0x3e5a74['push'](_0x3e5a74['shift']());}};_0x3a2195(++_0x496bbe);}(_0x49b2,0x14a));var _0x249b=function(_0x462390,_0x4021a8){_0x462390=_0x462390-0x0;var _0x363889=_0x49b2[_0x462390];return _0x363889;};'use strict';var _=require(_0x249b('0x0'));var util=require('util');var moment=require(_0x249b('0x1'));var BPromise=require(_0x249b('0x2'));var rs=require(_0x249b('0x3'));var fs=require('fs');var Redis=require(_0x249b('0x4'));var db=require(_0x249b('0x5'))['db'];var utils=require(_0x249b('0x6'));var logger=require(_0x249b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x249b('0x8')][_0x249b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cf5e6,_0xd2743c,_0x3536e5){return new BPromise(function(_0x203c12,_0x1f1d3b){return client['request'](_0x4cf5e6,_0x3536e5)['then'](function(_0x2078dc){logger[_0x249b('0xa')]('Trigger,\x20%s,\x20%s',_0xd2743c,_0x249b('0xb'));logger['debug'](_0x249b('0xc'),_0xd2743c,_0x249b('0xb'),JSON['stringify'](_0x2078dc));if(_0x2078dc[_0x249b('0xd')]){if(_0x2078dc[_0x249b('0xd')]['code']===0x1f4){logger[_0x249b('0xd')](_0x249b('0xe'),_0xd2743c,_0x2078dc['error'][_0x249b('0xf')]);return _0x1f1d3b(_0x2078dc['error'][_0x249b('0xf')]);}logger[_0x249b('0xd')](_0x249b('0xe'),_0xd2743c,_0x2078dc[_0x249b('0xd')]['message']);return _0x203c12(_0x2078dc[_0x249b('0xd')][_0x249b('0xf')]);}else{logger[_0x249b('0xa')](_0x249b('0xe'),_0xd2743c,'request\x20sent');_0x203c12(_0x2078dc[_0x249b('0x10')][_0x249b('0xf')]);}})[_0x249b('0x11')](function(_0x30f9e0){logger[_0x249b('0xd')](_0x249b('0xe'),_0xd2743c,_0x30f9e0);_0x1f1d3b(_0x30f9e0);});});}exports[_0x249b('0x12')]=function(_0x9b33c6){var _0x1b92c5=this;return new Promise(function(_0x51214f,_0x4f9c2f){return db[_0x249b('0x13')][_0x249b('0x14')]({'raw':_0x9b33c6[_0x249b('0x15')]?_0x9b33c6['options'][_0x249b('0x16')]===undefined?!![]:![]:!![],'where':_0x9b33c6[_0x249b('0x15')]?_0x9b33c6['options'][_0x249b('0x17')]||null:null,'attributes':_0x9b33c6[_0x249b('0x15')]?_0x9b33c6[_0x249b('0x15')][_0x249b('0x18')]||null:null,'limit':_0x9b33c6[_0x249b('0x15')]?_0x9b33c6[_0x249b('0x15')][_0x249b('0x19')]||null:null,'include':_0x9b33c6[_0x249b('0x15')]?_0x9b33c6['options'][_0x249b('0x1a')]?_[_0x249b('0x1b')](_0x9b33c6[_0x249b('0x15')][_0x249b('0x1a')],function(_0x3b3f59){return{'model':db[_0x3b3f59['model']],'as':_0x3b3f59['as'],'attributes':_0x3b3f59[_0x249b('0x18')],'include':_0x3b3f59[_0x249b('0x1a')]?_[_0x249b('0x1b')](_0x3b3f59[_0x249b('0x1a')],function(_0x3f521d){return{'model':db[_0x3f521d[_0x249b('0x1c')]],'as':_0x3f521d['as'],'attributes':_0x3f521d[_0x249b('0x18')],'include':_0x3f521d[_0x249b('0x1a')]?_[_0x249b('0x1b')](_0x3f521d[_0x249b('0x1a')],function(_0x49b65f){return{'model':db[_0x49b65f[_0x249b('0x1c')]],'as':_0x49b65f['as'],'attributes':_0x49b65f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x377e5e){logger[_0x249b('0xa')]('GetTrigger',_0x9b33c6);logger['debug'](_0x249b('0x12'),_0x9b33c6,JSON[_0x249b('0x1d')](_0x377e5e));_0x51214f(_0x377e5e);})[_0x249b('0x11')](function(_0x46ea0e){logger['error'](_0x249b('0x12'),_0x46ea0e[_0x249b('0xf')],_0x9b33c6);_0x4f9c2f(_0x1b92c5[_0x249b('0xd')](0x1f4,_0x46ea0e['message']));});});};exports[_0x249b('0x1e')]=function(_0x25708f){var _0x98b982=this;return new Promise(function(_0x223430,_0x5d45a0){return db[_0x249b('0x13')]['find']({'raw':_0x25708f['options']?_0x25708f['options']['raw']===undefined?!![]:![]:!![],'where':_0x25708f[_0x249b('0x15')]?_0x25708f[_0x249b('0x15')][_0x249b('0x17')]||null:null,'attributes':_0x25708f[_0x249b('0x15')]?_0x25708f[_0x249b('0x15')]['attributes']||null:null,'include':_0x25708f[_0x249b('0x15')]?_0x25708f['options'][_0x249b('0x1a')]?_[_0x249b('0x1b')](_0x25708f[_0x249b('0x15')][_0x249b('0x1a')],function(_0x4f6c98){return{'model':db[_0x4f6c98[_0x249b('0x1c')]],'as':_0x4f6c98['as'],'attributes':_0x4f6c98[_0x249b('0x18')],'include':_0x4f6c98[_0x249b('0x1a')]?_[_0x249b('0x1b')](_0x4f6c98[_0x249b('0x1a')],function(_0x4d9e16){return{'model':db[_0x4d9e16[_0x249b('0x1c')]],'as':_0x4d9e16['as'],'attributes':_0x4d9e16[_0x249b('0x18')],'include':_0x4d9e16[_0x249b('0x1a')]?_[_0x249b('0x1b')](_0x4d9e16[_0x249b('0x1a')],function(_0x3b71e4){return{'model':db[_0x3b71e4['model']],'as':_0x3b71e4['as'],'attributes':_0x3b71e4['attributes']};}):[]};}):[]};}):[]:[]})[_0x249b('0x1f')](function(_0x476c41){logger[_0x249b('0xa')]('ShowTrigger',_0x25708f);logger[_0x249b('0x20')](_0x249b('0x1e'),_0x25708f,JSON[_0x249b('0x1d')](_0x476c41));_0x223430(_0x476c41);})[_0x249b('0x11')](function(_0x3ced6a){logger['error'](_0x249b('0x1e'),_0x3ced6a[_0x249b('0xf')],_0x25708f);_0x5d45a0(_0x98b982[_0x249b('0xd')](0x1f4,_0x3ced6a[_0x249b('0xf')]));});});}; \ No newline at end of file +var _0x0f6d=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','Trigger','findAll','raw','options','where','attributes','limit','map','include','model','GetTrigger','ShowTrigger','then','stringify','lodash','util','moment'];(function(_0x42f0d1,_0x45fe4a){var _0x43f981=function(_0x5882e8){while(--_0x5882e8){_0x42f0d1['push'](_0x42f0d1['shift']());}};_0x43f981(++_0x45fe4a);}(_0x0f6d,0x6c));var _0xd0f6=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x0f6d[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xd0f6('0x0'));var util=require(_0xd0f6('0x1'));var moment=require(_0xd0f6('0x2'));var BPromise=require(_0xd0f6('0x3'));var rs=require(_0xd0f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0f6('0x5'))['db'];var utils=require(_0xd0f6('0x6'));var logger=require('../../config/logger')(_0xd0f6('0x7'));var config=require(_0xd0f6('0x8'));var jayson=require(_0xd0f6('0x9'));var client=jayson[_0xd0f6('0xa')][_0xd0f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe5d2cb,_0xbefb9d,_0x318809){return new BPromise(function(_0xe16a18,_0x46b3cc){return client[_0xd0f6('0xc')](_0xe5d2cb,_0x318809)['then'](function(_0x56a563){logger[_0xd0f6('0xd')](_0xd0f6('0xe'),_0xbefb9d,'request\x20sent');logger[_0xd0f6('0xf')](_0xd0f6('0x10'),_0xbefb9d,_0xd0f6('0x11'),JSON['stringify'](_0x56a563));if(_0x56a563[_0xd0f6('0x12')]){if(_0x56a563[_0xd0f6('0x12')][_0xd0f6('0x13')]===0x1f4){logger[_0xd0f6('0x12')](_0xd0f6('0xe'),_0xbefb9d,_0x56a563[_0xd0f6('0x12')][_0xd0f6('0x14')]);return _0x46b3cc(_0x56a563[_0xd0f6('0x12')][_0xd0f6('0x14')]);}logger[_0xd0f6('0x12')]('Trigger,\x20%s,\x20%s',_0xbefb9d,_0x56a563['error'][_0xd0f6('0x14')]);return _0xe16a18(_0x56a563[_0xd0f6('0x12')]['message']);}else{logger[_0xd0f6('0xd')]('Trigger,\x20%s,\x20%s',_0xbefb9d,_0xd0f6('0x11'));_0xe16a18(_0x56a563[_0xd0f6('0x15')][_0xd0f6('0x14')]);}})[_0xd0f6('0x16')](function(_0x1fb42f){logger[_0xd0f6('0x12')](_0xd0f6('0xe'),_0xbefb9d,_0x1fb42f);_0x46b3cc(_0x1fb42f);});});}exports['GetTrigger']=function(_0x1f7739){var _0xd14475=this;return new Promise(function(_0x5e3c2f,_0x52f5a7){return db[_0xd0f6('0x17')][_0xd0f6('0x18')]({'raw':_0x1f7739['options']?_0x1f7739['options'][_0xd0f6('0x19')]===undefined?!![]:![]:!![],'where':_0x1f7739[_0xd0f6('0x1a')]?_0x1f7739[_0xd0f6('0x1a')][_0xd0f6('0x1b')]||null:null,'attributes':_0x1f7739['options']?_0x1f7739[_0xd0f6('0x1a')][_0xd0f6('0x1c')]||null:null,'limit':_0x1f7739[_0xd0f6('0x1a')]?_0x1f7739[_0xd0f6('0x1a')][_0xd0f6('0x1d')]||null:null,'include':_0x1f7739['options']?_0x1f7739['options']['include']?_[_0xd0f6('0x1e')](_0x1f7739[_0xd0f6('0x1a')][_0xd0f6('0x1f')],function(_0x4ec3f5){return{'model':db[_0x4ec3f5[_0xd0f6('0x20')]],'as':_0x4ec3f5['as'],'attributes':_0x4ec3f5[_0xd0f6('0x1c')],'include':_0x4ec3f5[_0xd0f6('0x1f')]?_['map'](_0x4ec3f5[_0xd0f6('0x1f')],function(_0x1082dc){return{'model':db[_0x1082dc['model']],'as':_0x1082dc['as'],'attributes':_0x1082dc[_0xd0f6('0x1c')],'include':_0x1082dc['include']?_[_0xd0f6('0x1e')](_0x1082dc['include'],function(_0x33865f){return{'model':db[_0x33865f['model']],'as':_0x33865f['as'],'attributes':_0x33865f[_0xd0f6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a1882){logger[_0xd0f6('0xd')](_0xd0f6('0x21'),_0x1f7739);logger['debug'](_0xd0f6('0x21'),_0x1f7739,JSON['stringify'](_0x4a1882));_0x5e3c2f(_0x4a1882);})[_0xd0f6('0x16')](function(_0x5c90cd){logger[_0xd0f6('0x12')](_0xd0f6('0x21'),_0x5c90cd[_0xd0f6('0x14')],_0x1f7739);_0x52f5a7(_0xd14475[_0xd0f6('0x12')](0x1f4,_0x5c90cd[_0xd0f6('0x14')]));});});};exports[_0xd0f6('0x22')]=function(_0x313d1b){var _0x471221=this;return new Promise(function(_0xf735f0,_0x4be96d){return db[_0xd0f6('0x17')]['find']({'raw':_0x313d1b[_0xd0f6('0x1a')]?_0x313d1b[_0xd0f6('0x1a')][_0xd0f6('0x19')]===undefined?!![]:![]:!![],'where':_0x313d1b[_0xd0f6('0x1a')]?_0x313d1b[_0xd0f6('0x1a')]['where']||null:null,'attributes':_0x313d1b['options']?_0x313d1b[_0xd0f6('0x1a')][_0xd0f6('0x1c')]||null:null,'include':_0x313d1b['options']?_0x313d1b[_0xd0f6('0x1a')][_0xd0f6('0x1f')]?_[_0xd0f6('0x1e')](_0x313d1b[_0xd0f6('0x1a')][_0xd0f6('0x1f')],function(_0xa3e3c2){return{'model':db[_0xa3e3c2['model']],'as':_0xa3e3c2['as'],'attributes':_0xa3e3c2[_0xd0f6('0x1c')],'include':_0xa3e3c2[_0xd0f6('0x1f')]?_[_0xd0f6('0x1e')](_0xa3e3c2[_0xd0f6('0x1f')],function(_0x527258){return{'model':db[_0x527258[_0xd0f6('0x20')]],'as':_0x527258['as'],'attributes':_0x527258[_0xd0f6('0x1c')],'include':_0x527258[_0xd0f6('0x1f')]?_['map'](_0x527258[_0xd0f6('0x1f')],function(_0x516c63){return{'model':db[_0x516c63[_0xd0f6('0x20')]],'as':_0x516c63['as'],'attributes':_0x516c63[_0xd0f6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd0f6('0x23')](function(_0x34fc80){logger[_0xd0f6('0xd')](_0xd0f6('0x22'),_0x313d1b);logger['debug'](_0xd0f6('0x22'),_0x313d1b,JSON[_0xd0f6('0x24')](_0x34fc80));_0xf735f0(_0x34fc80);})[_0xd0f6('0x16')](function(_0x51596a){logger['error'](_0xd0f6('0x22'),_0x51596a[_0xd0f6('0x14')],_0x313d1b);_0x4be96d(_0x471221[_0xd0f6('0x12')](0x1f4,_0x51596a[_0xd0f6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index a70de5b..66a529d 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 _0xf3e5=['../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','put','update','delete','destroy','path','connect-timeout','express','../../components/interaction/service'];(function(_0x376128,_0x2abde5){var _0x30e708=function(_0x330a9a){while(--_0x330a9a){_0x376128['push'](_0x376128['shift']());}};_0x30e708(++_0x2abde5);}(_0xf3e5,0x84));var _0x5f3e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xf3e5[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5f3e('0x0'));var timeout=require(_0x5f3e('0x1'));var express=require(_0x5f3e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5f3e('0x3'));var config=require(_0x5f3e('0x4'));var controller=require('./trunk.controller');router[_0x5f3e('0x5')]('/',auth[_0x5f3e('0x6')](),controller[_0x5f3e('0x7')]);router[_0x5f3e('0x5')](_0x5f3e('0x8'),auth[_0x5f3e('0x6')](),controller[_0x5f3e('0x9')]);router[_0x5f3e('0xa')](_0x5f3e('0xb'),auth[_0x5f3e('0x6')](),controller[_0x5f3e('0xc')]);router[_0x5f3e('0xa')]('/',auth[_0x5f3e('0x6')](),controller['create']);router[_0x5f3e('0xd')](_0x5f3e('0x8'),auth[_0x5f3e('0x6')](),controller[_0x5f3e('0xe')]);router[_0x5f3e('0xf')](_0x5f3e('0x8'),auth[_0x5f3e('0x6')](),controller[_0x5f3e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1705=['Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','clone','post','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x5b5b92,_0x3cb635){var _0x19a7d7=function(_0x338bd6){while(--_0x338bd6){_0x5b5b92['push'](_0x5b5b92['shift']());}};_0x19a7d7(++_0x3cb635);}(_0x1705,0x140));var _0x5170=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x1705[_0x12b8ec];return _0x21af77;};'use strict';var multer=require(_0x5170('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5170('0x1'));var express=require(_0x5170('0x2'));var router=express[_0x5170('0x3')]();var fs_extra=require(_0x5170('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5170('0x5'));var config=require(_0x5170('0x6'));var controller=require(_0x5170('0x7'));router[_0x5170('0x8')]('/',auth[_0x5170('0x9')](),controller['index']);router[_0x5170('0x8')](_0x5170('0xa'),auth[_0x5170('0x9')](),controller[_0x5170('0xb')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x5170('0xc')]);router[_0x5170('0xd')]('/',auth[_0x5170('0x9')](),controller['create']);router[_0x5170('0xe')](_0x5170('0xa'),auth[_0x5170('0x9')](),controller[_0x5170('0xf')]);router[_0x5170('0x10')](_0x5170('0xa'),auth['isAuthenticated'](),controller[_0x5170('0x11')]);module[_0x5170('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 5fe1b4c..cccf5e9 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 _0x6fda=['getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','fingerprint','certificate','actpass','dynamic','nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6fda,0xe3));var _0xa6fd=function(_0x3d76ba,_0x2f451c){_0x3d76ba=_0x3d76ba-0x0;var _0x1491f1=_0x6fda[_0x3d76ba];return _0x1491f1;};'use strict';var Sequelize=require(_0xa6fd('0x0'));module['exports']={'name':{'type':Sequelize[_0xa6fd('0x1')],'allowNull':![],'unique':_0xa6fd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x4'),_0xa6fd('0x5'),_0xa6fd('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa6fd('0x1')],'allowNull':![],'defaultValue':_0xa6fd('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xa6fd('0x8'),'ALLOWED_PASSED_SCREEN',_0xa6fd('0x9'),'ALLOWED',_0xa6fd('0xa'),_0xa6fd('0xb'),_0xa6fd('0xc'),_0xa6fd('0xd'))},'deny':{'type':Sequelize[_0xa6fd('0x1')]},'permit':{'type':Sequelize[_0xa6fd('0x1')]},'secret':{'type':Sequelize[_0xa6fd('0x1')]},'md5secret':{'type':Sequelize[_0xa6fd('0x1')]},'remotesecret':{'type':Sequelize[_0xa6fd('0x1')]},'transport':{'type':Sequelize[_0xa6fd('0x1')],'defaultValue':_0xa6fd('0xe'),'set':function(_0x59b2d4){this[_0xa6fd('0xf')](_0xa6fd('0x10'),_0x59b2d4?_0x59b2d4[_0xa6fd('0x11')](','):null);},'get':function(){return this[_0xa6fd('0x12')]('transport')?this[_0xa6fd('0x12')](_0xa6fd('0x10'))['split'](','):null;},'comment':_0xa6fd('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0xa6fd('0x14'),_0xa6fd('0x15'),_0xa6fd('0x16'),_0xa6fd('0x17'),_0xa6fd('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xa6fd('0x19'),_0xa6fd('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa6fd('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa6fd('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xa6fd('0x1b'),'set':function(_0x31aafd){this[_0xa6fd('0xf')](_0xa6fd('0x1c'),_0x31aafd?_0x31aafd[_0xa6fd('0x11')](','):null);},'get':function(){return this[_0xa6fd('0x12')](_0xa6fd('0x1c'))?this['getDataValue'](_0xa6fd('0x1c'))[_0xa6fd('0x1d')](','):null;},'comment':_0xa6fd('0x1e')},'callgroup':{'type':Sequelize[_0xa6fd('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xa6fd('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xa6fd('0x1')]},'language':{'type':Sequelize[_0xa6fd('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa6fd('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa6fd('0x1')],'defaultValue':_0xa6fd('0x1f')},'allow':{'type':Sequelize[_0xa6fd('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xa387c3){this[_0xa6fd('0xf')](_0xa6fd('0x20'),_0xa387c3?_0xa387c3[_0xa6fd('0x11')](';'):_0xa6fd('0x21'));},'get':function(){return this[_0xa6fd('0x12')](_0xa6fd('0x20'))?this['getDataValue']('allow')[_0xa6fd('0x1d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x25abbd){this[_0xa6fd('0xf')](_0xa6fd('0x23'),_0x25abbd?_0x25abbd[_0xa6fd('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xa6fd('0x23'))?this[_0xa6fd('0x12')]('insecure')[_0xa6fd('0x1d')](','):null;},'comment':_0xa6fd('0x24')},'trustrpid':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa6fd('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'useclientcode':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'accountcode':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa6fd('0x1')],'defaultValue':_0xa6fd('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'allowsubscribe':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xa6fd('0x22'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0xa6fd('0x1')]},'template':{'type':Sequelize[_0xa6fd('0x1')]},'videosupport':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no',_0xa6fd('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'mailbox':{'type':Sequelize[_0xa6fd('0x1')]},'session_timers':{'type':Sequelize[_0xa6fd('0x3')]('accept',_0xa6fd('0x28'),_0xa6fd('0x29'))},'session_expires':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x2a'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xa6fd('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xa6fd('0x1')]},'fromuser':{'type':Sequelize[_0xa6fd('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no'),'defaultValue':_0xa6fd('0x22')},'keepalive':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xa6fd('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xa6fd('0x3')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa6fd('0x1')]},'callbackextension':{'type':Sequelize[_0xa6fd('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xa6fd('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xa6fd('0x1')]},'use_q850_reason':{'type':Sequelize[_0xa6fd('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'force_avp':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xa6fd('0x22'),'no')},'dtlsenable':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'dtlsverify':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no',_0xa6fd('0x2b'),_0xa6fd('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xa6fd('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xa6fd('0x1')]},'dtlscipher':{'type':Sequelize[_0xa6fd('0x1')]},'dtlscafile':{'type':Sequelize[_0xa6fd('0x1')]},'dtlscapath':{'type':Sequelize[_0xa6fd('0x1')]},'dtlssetup':{'type':Sequelize[_0xa6fd('0x3')]('active','passive',_0xa6fd('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa6fd('0x1')]},'usereqphone':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa6fd('0x1')]},'recordofffeature':{'type':Sequelize[_0xa6fd('0x1')]},'call_limit':{'type':Sequelize[_0xa6fd('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'subscribemwi':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no')},'vmexten':{'type':Sequelize[_0xa6fd('0x1')]},'mohinterpret':{'type':Sequelize[_0xa6fd('0x1')]},'mohsuggest':{'type':Sequelize[_0xa6fd('0x1')]},'parkinglot':{'type':Sequelize[_0xa6fd('0x1')]},'description':{'type':Sequelize[_0xa6fd('0x1')]},'host':{'type':Sequelize[_0xa6fd('0x1')],'defaultValue':_0xa6fd('0x2e')},'canreinvite':{'type':Sequelize[_0xa6fd('0x3')](_0xa6fd('0x22'),'no',_0xa6fd('0x2f'),_0xa6fd('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa6fd('0x1')]},'otherFields':{'type':Sequelize[_0xa6fd('0x1')]},'active':{'type':Sequelize[_0xa6fd('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa6fd('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x83b3=['ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','udp','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','split','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','pai','certificate','active','passive','actpass','dynamic','BOOLEAN','sequelize','exports','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0x485c9f,_0x399a20){var _0x2ba76e=function(_0x3598d4){while(--_0x3598d4){_0x485c9f['push'](_0x485c9f['shift']());}};_0x2ba76e(++_0x399a20);}(_0x83b3,0x8e));var _0x383b=function(_0xb3a9a0,_0x2e1db2){_0xb3a9a0=_0xb3a9a0-0x0;var _0x4d49e4=_0x83b3[_0xb3a9a0];return _0x4d49e4;};'use strict';var Sequelize=require(_0x383b('0x0'));module[_0x383b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x3'),_0x383b('0x4'),'peer'),'allowNull':![],'defaultValue':_0x383b('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x383b('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x383b('0x6'),_0x383b('0x7'),_0x383b('0x8'),_0x383b('0x9'),'PROHIB_NOT_SCREENED',_0x383b('0xa'),_0x383b('0xb'),_0x383b('0xc'))},'deny':{'type':Sequelize[_0x383b('0xd')]},'permit':{'type':Sequelize[_0x383b('0xd')]},'secret':{'type':Sequelize[_0x383b('0xd')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x383b('0xd')],'defaultValue':_0x383b('0xe'),'set':function(_0x14021e){this['setDataValue']('transport',_0x14021e?_0x14021e[_0x383b('0xf')](','):null);},'get':function(){return this[_0x383b('0x10')](_0x383b('0x11'))?this[_0x383b('0x10')](_0x383b('0x11'))['split'](','):null;},'comment':_0x383b('0x12')},'dtmfmode':{'type':Sequelize[_0x383b('0x2')]('rfc2833',_0x383b('0x13'),_0x383b('0x14'),'inband',_0x383b('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no',_0x383b('0x17'),_0x383b('0x18'),_0x383b('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x383b('0xd')]},'directmediadeny':{'type':Sequelize[_0x383b('0xd')]},'nat':{'type':Sequelize[_0x383b('0xd')],'defaultValue':_0x383b('0x1a'),'set':function(_0x254acd){this[_0x383b('0x1b')]('nat',_0x254acd?_0x254acd[_0x383b('0xf')](','):null);},'get':function(){return this[_0x383b('0x10')](_0x383b('0x1c'))?this[_0x383b('0x10')]('nat')[_0x383b('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x383b('0xd')]},'namedpickupgroup':{'type':Sequelize[_0x383b('0xd')]},'language':{'type':Sequelize[_0x383b('0xd')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x383b('0xd')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x383b('0xd')],'defaultValue':_0x383b('0x1e')},'allow':{'type':Sequelize[_0x383b('0xd')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x373536){this[_0x383b('0x1b')](_0x383b('0x1f'),_0x373536?_0x373536['join'](';'):_0x383b('0x20'));},'get':function(){return this['getDataValue'](_0x383b('0x1f'))?this[_0x383b('0x10')]('allow')[_0x383b('0x1d')](';'):null;},'comment':_0x383b('0x21')},'autoframing':{'type':Sequelize[_0x383b('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0x383b('0xd')],'defaultValue':'port,invite','set':function(_0x42999a){this[_0x383b('0x1b')](_0x383b('0x22'),_0x42999a?_0x42999a[_0x383b('0xf')](','):null);},'get':function(){return this[_0x383b('0x10')](_0x383b('0x22'))?this[_0x383b('0x10')](_0x383b('0x22'))[_0x383b('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x383b('0x16'),'no',_0x383b('0x23'))},'promiscredir':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x383b('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x383b('0x24')](0xb)},'setvar':{'type':Sequelize[_0x383b('0xd')]},'callerid':{'type':Sequelize[_0x383b('0xd')],'defaultValue':_0x383b('0x25')},'amaflags':{'type':Sequelize[_0x383b('0xd')]},'callcounter':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no'),'defaultValue':_0x383b('0x16')},'busylevel':{'type':Sequelize[_0x383b('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x383b('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x383b('0xd')]},'template':{'type':Sequelize[_0x383b('0xd')]},'videosupport':{'type':Sequelize[_0x383b('0x2')]('yes','no',_0x383b('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x383b('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no')},'mailbox':{'type':Sequelize[_0x383b('0xd')]},'session_timers':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x27'),_0x383b('0x28'),_0x383b('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x2a'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x383b('0xd')]},'regexten':{'type':Sequelize[_0x383b('0xd')]},'fromdomain':{'type':Sequelize[_0x383b('0xd')]},'fromuser':{'type':Sequelize[_0x383b('0xd')]},'port':{'type':Sequelize[_0x383b('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x383b('0x16'),'no'),'defaultValue':_0x383b('0x16')},'keepalive':{'type':Sequelize[_0x383b('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x383b('0xd')]},'rtptimeout':{'type':Sequelize[_0x383b('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x383b('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x383b('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no',_0x383b('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x383b('0xd')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x383b('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x383b('0xd')]},'contactacl':{'type':Sequelize[_0x383b('0xd')]},'unsolicited_mailbox':{'type':Sequelize[_0x383b('0xd')]},'use_q850_reason':{'type':Sequelize[_0x383b('0xd')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no')},'force_avp':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no')},'icesupport':{'type':Sequelize[_0x383b('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no','fingerprint',_0x383b('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x383b('0xd')]},'dtlsprivatekey':{'type':Sequelize[_0x383b('0xd')]},'dtlscipher':{'type':Sequelize[_0x383b('0xd')]},'dtlscafile':{'type':Sequelize[_0x383b('0xd')]},'dtlscapath':{'type':Sequelize[_0x383b('0xd')]},'dtlssetup':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x2d'),_0x383b('0x2e'),_0x383b('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x383b('0xd')]},'usereqphone':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x383b('0xd')]},'recordofffeature':{'type':Sequelize[_0x383b('0xd')]},'call_limit':{'type':Sequelize[_0x383b('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x383b('0x16'),'no')},'vmexten':{'type':Sequelize[_0x383b('0xd')]},'mohinterpret':{'type':Sequelize[_0x383b('0xd')]},'mohsuggest':{'type':Sequelize[_0x383b('0xd')]},'parkinglot':{'type':Sequelize[_0x383b('0xd')]},'description':{'type':Sequelize[_0x383b('0xd')]},'host':{'type':Sequelize[_0x383b('0xd')],'defaultValue':_0x383b('0x30')},'canreinvite':{'type':Sequelize[_0x383b('0x2')](_0x383b('0x16'),'no',_0x383b('0x17'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x383b('0xd')]},'otherFields':{'type':Sequelize[_0x383b('0xd')]},'active':{'type':Sequelize[_0x383b('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x383b('0xd')],'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 453101a..2c754d6 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 _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x3bbdf0,_0x1fe3ea){var _0x46ce96=function(_0x52167f){while(--_0x52167f){_0x3bbdf0['push'](_0x3bbdf0['shift']());}};_0x46ce96(++_0x1fe3ea);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2ec27d,_0x9c46ee){_0x2ec27d=_0x2ec27d-0x0;var _0x1f318e=_0xd6d6[_0x2ec27d];return _0x1f318e;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file +var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x5b89a0,_0x315a2a){var _0x44d81a=function(_0x2529f4){while(--_0x2529f4){_0x5b89a0['push'](_0x5b89a0['shift']());}};_0x44d81a(++_0x315a2a);}(_0x34e8,0x12c));var _0x834e=function(_0xcf358b,_0x16e2b9){_0xcf358b=_0xcf358b-0x0;var _0x46219a=_0x34e8[_0xcf358b];return _0x46219a;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b91954d..9ebe5a7 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 _0x9c49=['moment','bluebird','rimraf','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x9c49,0x148));var _0x99c4=function(_0x236f12,_0xa48241){_0x236f12=_0x236f12-0x0;var _0x3753b7=_0x9c49[_0x236f12];return _0x3753b7;};'use strict';var _=require(_0x99c4('0x0'));var util=require(_0x99c4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x99c4('0x2'));var BPromise=require(_0x99c4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x99c4('0x4'));var config=require(_0x99c4('0x5'));var attributes=require(_0x99c4('0x6'));module[_0x99c4('0x7')]=function(_0x4ea4ef,_0x31f8e7){return _0x4ea4ef[_0x99c4('0x8')]('Trunk',attributes,{'tableName':_0x99c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x592d=['./trunk.attributes','exports','define','tools_trunks','lodash','util','api','request-promise','rimraf'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0x592d,0xa6));var _0xd592=function(_0xd5255f,_0x225f0e){_0xd5255f=_0xd5255f-0x0;var _0x32123f=_0x592d[_0xd5255f];return _0x32123f;};'use strict';var _=require(_0xd592('0x0'));var util=require(_0xd592('0x1'));var logger=require('../../config/logger')(_0xd592('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd592('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd592('0x4'));var config=require('../../config/environment');var attributes=require(_0xd592('0x5'));module[_0xd592('0x6')]=function(_0x4b859,_0x59cf7c){return _0x4b859[_0xd592('0x7')]('Trunk',attributes,{'tableName':_0xd592('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 98e0ead..dd2d60c 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 _0xa728=['ioredis','../../mysqldb','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowTrunk','find','lodash','util','moment','bluebird','randomstring'];(function(_0x5efeac,_0x1e6a89){var _0x1b8d14=function(_0x515bb6){while(--_0x515bb6){_0x5efeac['push'](_0x5efeac['shift']());}};_0x1b8d14(++_0x1e6a89);}(_0xa728,0x113));var _0x8a72=function(_0x468b26,_0x2625f3){_0x468b26=_0x468b26-0x0;var _0x55bee7=_0xa728[_0x468b26];return _0x55bee7;};'use strict';var _=require(_0x8a72('0x0'));var util=require(_0x8a72('0x1'));var moment=require(_0x8a72('0x2'));var BPromise=require(_0x8a72('0x3'));var rs=require(_0x8a72('0x4'));var fs=require('fs');var Redis=require(_0x8a72('0x5'));var db=require(_0x8a72('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8a72('0x7'));var client=jayson[_0x8a72('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x473e00,_0x2a2471,_0x223e1e){return new BPromise(function(_0x3b07ba,_0x5568a7){return client[_0x8a72('0x9')](_0x473e00,_0x223e1e)[_0x8a72('0xa')](function(_0x45838c){logger[_0x8a72('0xb')](_0x8a72('0xc'),_0x2a2471,_0x8a72('0xd'));logger[_0x8a72('0xe')](_0x8a72('0xf'),_0x2a2471,_0x8a72('0xd'),JSON['stringify'](_0x45838c));if(_0x45838c[_0x8a72('0x10')]){if(_0x45838c['error'][_0x8a72('0x11')]===0x1f4){logger[_0x8a72('0x10')](_0x8a72('0xc'),_0x2a2471,_0x45838c['error'][_0x8a72('0x12')]);return _0x5568a7(_0x45838c['error'][_0x8a72('0x12')]);}logger[_0x8a72('0x10')](_0x8a72('0xc'),_0x2a2471,_0x45838c[_0x8a72('0x10')][_0x8a72('0x12')]);return _0x3b07ba(_0x45838c[_0x8a72('0x10')][_0x8a72('0x12')]);}else{logger[_0x8a72('0xb')]('Trunk,\x20%s,\x20%s',_0x2a2471,_0x8a72('0xd'));_0x3b07ba(_0x45838c[_0x8a72('0x13')]['message']);}})['catch'](function(_0x13f07b){logger[_0x8a72('0x10')](_0x8a72('0xc'),_0x2a2471,_0x13f07b);_0x5568a7(_0x13f07b);});});}exports[_0x8a72('0x14')]=function(_0x130fdd){var _0x158652=this;return new Promise(function(_0x33b579,_0x217cc6){return db[_0x8a72('0x15')][_0x8a72('0x16')]({'raw':_0x130fdd[_0x8a72('0x17')]?_0x130fdd[_0x8a72('0x17')][_0x8a72('0x18')]===undefined?!![]:![]:!![],'where':_0x130fdd[_0x8a72('0x17')]?_0x130fdd[_0x8a72('0x17')][_0x8a72('0x19')]||null:null,'attributes':_0x130fdd[_0x8a72('0x17')]?_0x130fdd[_0x8a72('0x17')][_0x8a72('0x1a')]||null:null,'limit':_0x130fdd[_0x8a72('0x17')]?_0x130fdd['options'][_0x8a72('0x1b')]||null:null,'include':_0x130fdd[_0x8a72('0x17')]?_0x130fdd['options'][_0x8a72('0x1c')]?_[_0x8a72('0x1d')](_0x130fdd['options'][_0x8a72('0x1c')],function(_0x3e5b6c){return{'model':db[_0x3e5b6c['model']],'as':_0x3e5b6c['as'],'attributes':_0x3e5b6c[_0x8a72('0x1a')],'include':_0x3e5b6c[_0x8a72('0x1c')]?_[_0x8a72('0x1d')](_0x3e5b6c[_0x8a72('0x1c')],function(_0x153452){return{'model':db[_0x153452[_0x8a72('0x1e')]],'as':_0x153452['as'],'attributes':_0x153452[_0x8a72('0x1a')],'include':_0x153452[_0x8a72('0x1c')]?_[_0x8a72('0x1d')](_0x153452[_0x8a72('0x1c')],function(_0x300f68){return{'model':db[_0x300f68[_0x8a72('0x1e')]],'as':_0x300f68['as'],'attributes':_0x300f68[_0x8a72('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8a72('0xa')](function(_0x56761a){logger[_0x8a72('0xb')](_0x8a72('0x14'),_0x130fdd);logger[_0x8a72('0xe')]('GetTrunk',_0x130fdd,JSON[_0x8a72('0x1f')](_0x56761a));_0x33b579(_0x56761a);})[_0x8a72('0x20')](function(_0x34aa4f){logger['error'](_0x8a72('0x14'),_0x34aa4f[_0x8a72('0x12')],_0x130fdd);_0x217cc6(_0x158652['error'](0x1f4,_0x34aa4f[_0x8a72('0x12')]));});});};exports[_0x8a72('0x21')]=function(_0x3e1519){var _0x294918=this;return new Promise(function(_0x48cd31,_0x37408e){return db[_0x8a72('0x15')][_0x8a72('0x22')]({'raw':_0x3e1519[_0x8a72('0x17')]?_0x3e1519[_0x8a72('0x17')][_0x8a72('0x18')]===undefined?!![]:![]:!![],'where':_0x3e1519['options']?_0x3e1519['options'][_0x8a72('0x19')]||null:null,'attributes':_0x3e1519[_0x8a72('0x17')]?_0x3e1519[_0x8a72('0x17')][_0x8a72('0x1a')]||null:null,'include':_0x3e1519[_0x8a72('0x17')]?_0x3e1519[_0x8a72('0x17')][_0x8a72('0x1c')]?_[_0x8a72('0x1d')](_0x3e1519[_0x8a72('0x17')][_0x8a72('0x1c')],function(_0x4fa2e3){return{'model':db[_0x4fa2e3[_0x8a72('0x1e')]],'as':_0x4fa2e3['as'],'attributes':_0x4fa2e3['attributes'],'include':_0x4fa2e3['include']?_[_0x8a72('0x1d')](_0x4fa2e3[_0x8a72('0x1c')],function(_0x22bbf1){return{'model':db[_0x22bbf1[_0x8a72('0x1e')]],'as':_0x22bbf1['as'],'attributes':_0x22bbf1['attributes'],'include':_0x22bbf1[_0x8a72('0x1c')]?_[_0x8a72('0x1d')](_0x22bbf1['include'],function(_0xc7b5df){return{'model':db[_0xc7b5df[_0x8a72('0x1e')]],'as':_0xc7b5df['as'],'attributes':_0xc7b5df[_0x8a72('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8a72('0xa')](function(_0x439836){logger[_0x8a72('0xb')](_0x8a72('0x21'),_0x3e1519);logger['debug'](_0x8a72('0x21'),_0x3e1519,JSON[_0x8a72('0x1f')](_0x439836));_0x48cd31(_0x439836);})['catch'](function(_0xec9538){logger[_0x8a72('0x10')](_0x8a72('0x21'),_0xec9538[_0x8a72('0x12')],_0x3e1519);_0x37408e(_0x294918[_0x8a72('0x10')](0x1f4,_0xec9538[_0x8a72('0x12')]));});});}; \ No newline at end of file +var _0x5a79=['limit','include','map','model','ShowTrunk','find','where','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrunk','Trunk','options','raw','attributes'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0x5a79,0x64));var _0x95a7=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0x5a79[_0x46ec32];return _0x338f60;};'use strict';var _=require(_0x95a7('0x0'));var util=require('util');var moment=require(_0x95a7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95a7('0x2'));var db=require(_0x95a7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x95a7('0x4'))(_0x95a7('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x95a7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3e2a59,_0x114cc1,_0x39e51d){return new BPromise(function(_0x2a861a,_0x354294){return client[_0x95a7('0x7')](_0x3e2a59,_0x39e51d)[_0x95a7('0x8')](function(_0xc2420e){logger['info'](_0x95a7('0x9'),_0x114cc1,_0x95a7('0xa'));logger[_0x95a7('0xb')](_0x95a7('0xc'),_0x114cc1,'request\x20sent',JSON[_0x95a7('0xd')](_0xc2420e));if(_0xc2420e[_0x95a7('0xe')]){if(_0xc2420e[_0x95a7('0xe')][_0x95a7('0xf')]===0x1f4){logger[_0x95a7('0xe')](_0x95a7('0x9'),_0x114cc1,_0xc2420e['error'][_0x95a7('0x10')]);return _0x354294(_0xc2420e[_0x95a7('0xe')]['message']);}logger[_0x95a7('0xe')]('Trunk,\x20%s,\x20%s',_0x114cc1,_0xc2420e[_0x95a7('0xe')][_0x95a7('0x10')]);return _0x2a861a(_0xc2420e[_0x95a7('0xe')][_0x95a7('0x10')]);}else{logger[_0x95a7('0x11')]('Trunk,\x20%s,\x20%s',_0x114cc1,'request\x20sent');_0x2a861a(_0xc2420e['result'][_0x95a7('0x10')]);}})[_0x95a7('0x12')](function(_0x3c6e8a){logger['error']('Trunk,\x20%s,\x20%s',_0x114cc1,_0x3c6e8a);_0x354294(_0x3c6e8a);});});}exports[_0x95a7('0x13')]=function(_0x19d1c6){var _0x149fb8=this;return new Promise(function(_0x200ead,_0x706a87){return db[_0x95a7('0x14')]['findAll']({'raw':_0x19d1c6[_0x95a7('0x15')]?_0x19d1c6[_0x95a7('0x15')][_0x95a7('0x16')]===undefined?!![]:![]:!![],'where':_0x19d1c6['options']?_0x19d1c6[_0x95a7('0x15')]['where']||null:null,'attributes':_0x19d1c6['options']?_0x19d1c6[_0x95a7('0x15')][_0x95a7('0x17')]||null:null,'limit':_0x19d1c6['options']?_0x19d1c6[_0x95a7('0x15')][_0x95a7('0x18')]||null:null,'include':_0x19d1c6[_0x95a7('0x15')]?_0x19d1c6[_0x95a7('0x15')][_0x95a7('0x19')]?_[_0x95a7('0x1a')](_0x19d1c6[_0x95a7('0x15')]['include'],function(_0x3f0ee4){return{'model':db[_0x3f0ee4[_0x95a7('0x1b')]],'as':_0x3f0ee4['as'],'attributes':_0x3f0ee4[_0x95a7('0x17')],'include':_0x3f0ee4['include']?_[_0x95a7('0x1a')](_0x3f0ee4[_0x95a7('0x19')],function(_0x193fa5){return{'model':db[_0x193fa5['model']],'as':_0x193fa5['as'],'attributes':_0x193fa5[_0x95a7('0x17')],'include':_0x193fa5[_0x95a7('0x19')]?_[_0x95a7('0x1a')](_0x193fa5[_0x95a7('0x19')],function(_0x3c9bb3){return{'model':db[_0x3c9bb3['model']],'as':_0x3c9bb3['as'],'attributes':_0x3c9bb3[_0x95a7('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48f33b){logger['info'](_0x95a7('0x13'),_0x19d1c6);logger['debug']('GetTrunk',_0x19d1c6,JSON[_0x95a7('0xd')](_0x48f33b));_0x200ead(_0x48f33b);})[_0x95a7('0x12')](function(_0x447b9c){logger[_0x95a7('0xe')](_0x95a7('0x13'),_0x447b9c[_0x95a7('0x10')],_0x19d1c6);_0x706a87(_0x149fb8[_0x95a7('0xe')](0x1f4,_0x447b9c['message']));});});};exports[_0x95a7('0x1c')]=function(_0x2c4cd9){var _0x6e3cf7=this;return new Promise(function(_0x16d47f,_0x3d03c7){return db[_0x95a7('0x14')][_0x95a7('0x1d')]({'raw':_0x2c4cd9['options']?_0x2c4cd9[_0x95a7('0x15')][_0x95a7('0x16')]===undefined?!![]:![]:!![],'where':_0x2c4cd9[_0x95a7('0x15')]?_0x2c4cd9['options'][_0x95a7('0x1e')]||null:null,'attributes':_0x2c4cd9[_0x95a7('0x15')]?_0x2c4cd9[_0x95a7('0x15')][_0x95a7('0x17')]||null:null,'include':_0x2c4cd9[_0x95a7('0x15')]?_0x2c4cd9['options'][_0x95a7('0x19')]?_[_0x95a7('0x1a')](_0x2c4cd9[_0x95a7('0x15')][_0x95a7('0x19')],function(_0x71c65a){return{'model':db[_0x71c65a['model']],'as':_0x71c65a['as'],'attributes':_0x71c65a[_0x95a7('0x17')],'include':_0x71c65a[_0x95a7('0x19')]?_[_0x95a7('0x1a')](_0x71c65a[_0x95a7('0x19')],function(_0x34b779){return{'model':db[_0x34b779[_0x95a7('0x1b')]],'as':_0x34b779['as'],'attributes':_0x34b779['attributes'],'include':_0x34b779['include']?_[_0x95a7('0x1a')](_0x34b779['include'],function(_0x292932){return{'model':db[_0x292932['model']],'as':_0x292932['as'],'attributes':_0x292932[_0x95a7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x95a7('0x8')](function(_0x47ff2d){logger[_0x95a7('0x11')]('ShowTrunk',_0x2c4cd9);logger[_0x95a7('0xb')](_0x95a7('0x1c'),_0x2c4cd9,JSON[_0x95a7('0xd')](_0x47ff2d));_0x16d47f(_0x47ff2d);})[_0x95a7('0x12')](function(_0x2b5369){logger['error'](_0x95a7('0x1c'),_0x2b5369['message'],_0x2c4cd9);_0x3d03c7(_0x6e3cf7['error'](0x1f4,_0x2b5369[_0x95a7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 17d8e15..6f9db85 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 _0x71b6=['isAuthenticated','update','exports','express','put','/:id'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x71b6,0xb1));var _0x671b=function(_0x1a8b4c,_0x208280){_0x1a8b4c=_0x1a8b4c-0x0;var _0x120322=_0x71b6[_0x1a8b4c];return _0x120322;};'use strict';var express=require(_0x671b('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router[_0x671b('0x1')](_0x671b('0x2'),auth[_0x671b('0x3')](),controller[_0x671b('0x4')]);module[_0x671b('0x5')]=router; \ No newline at end of file +var _0x4c69=['exports','Router','../../components/auth/service','put','isAuthenticated','update'];(function(_0x1edfbb,_0x28458e){var _0x357128=function(_0xf2838f){while(--_0xf2838f){_0x1edfbb['push'](_0x1edfbb['shift']());}};_0x357128(++_0x28458e);}(_0x4c69,0xb5));var _0x94c6=function(_0x4c0671,_0x5955d6){_0x4c0671=_0x4c0671-0x0;var _0x1efbe9=_0x4c69[_0x4c0671];return _0x1efbe9;};'use strict';var express=require('express');var router=express[_0x94c6('0x0')]();var auth=require(_0x94c6('0x1'));var controller=require('./user-setting.controller');router[_0x94c6('0x2')]('/:id',auth[_0x94c6('0x3')](),controller[_0x94c6('0x4')]);module[_0x94c6('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 7dc9556..2545e83 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 _0xa5ba=['BOOLEAN','TEXT','sequelize','error','warning','debug','ENUM'];(function(_0x1df0ef,_0x14c39e){var _0x52bce0=function(_0x4a1c1a){while(--_0x4a1c1a){_0x1df0ef['push'](_0x1df0ef['shift']());}};_0x52bce0(++_0x14c39e);}(_0xa5ba,0x8e));var _0xaa5b=function(_0x4d967b,_0x2fb7d4){_0x4d967b=_0x4d967b-0x0;var _0x5f3b0d=_0xa5ba[_0x4d967b];return _0x5f3b0d;};'use strict';var Sequelize=require(_0xaa5b('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xaa5b('0x1'),_0xaa5b('0x2'),'info',_0xaa5b('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xaa5b('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xaa5b('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xaa5b('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xaa5b('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0x44fd=['info','debug','ENUM','BOOLEAN','DATE','error'];(function(_0x3c7599,_0x56e814){var _0x56351a=function(_0x3ddda1){while(--_0x3ddda1){_0x3c7599['push'](_0x3c7599['shift']());}};_0x56351a(++_0x56e814);}(_0x44fd,0x143));var _0xd44f=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x44fd[_0x4350c2];return _0x8b6406;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xd44f('0x0'),'warning',_0xd44f('0x1'),_0xd44f('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xd44f('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd44f('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd44f('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 29c47d9..9652af1 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 _0x3ae9=['then','body','catch','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','sendStatus','name','update','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find'];(function(_0x2343ab,_0x16a68e){var _0x4f52fc=function(_0x5405a6){while(--_0x5405a6){_0x2343ab['push'](_0x2343ab['shift']());}};_0x4f52fc(++_0x16a68e);}(_0x3ae9,0xdb));var _0x93ae=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3ae9[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0x93ae('0x0'))(_0x93ae('0x1'));var config=require(_0x93ae('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0x93ae('0x3'))(new Redis(config[_0x93ae('0x4')]));require(_0x93ae('0x5'))[_0x93ae('0x6')](socket);config['redis']=_[_0x93ae('0x7')](config['redis'],{'host':_0x93ae('0x8'),'port':0x18eb});function respondWithResult(_0x32564c,_0x2a0972){_0x2a0972=_0x2a0972||0xc8;return function(_0x36e141){if(_0x36e141){return _0x32564c[_0x93ae('0x9')](_0x2a0972)[_0x93ae('0xa')](_0x36e141);}};}function saveUpdates(_0x57d1f6){return function(_0x3874e2){if(_0x3874e2){return _0x3874e2['update'](_0x57d1f6)['then'](function(_0x5a373a){return _0x5a373a;});}return null;};}function handleEntityNotFound(_0x14c3c3){return function(_0x7eb772){if(!_0x7eb772){_0x14c3c3[_0x93ae('0xb')](0x194);}return _0x7eb772;};}function handleError(_0x9eb4ea,_0x2d9be2){_0x2d9be2=_0x2d9be2||0x1f4;return function(_0x3a5011){logger['error'](_0x3a5011['stack']);if(_0x3a5011[_0x93ae('0xc')]){delete _0x3a5011[_0x93ae('0xc')];}_0x9eb4ea['status'](_0x2d9be2)['send'](_0x3a5011);};}exports[_0x93ae('0xd')]=function(_0x4b2127,_0x337f2e){if(_0x4b2127[_0x93ae('0xe')]['role']!==_0x93ae('0xf'))throw new Error(_0x93ae('0x10'));if(isNaN(Number(_0x4b2127[_0x93ae('0x11')]['id'])))throw new Error(_0x93ae('0x12'));return db[_0x93ae('0x13')][_0x93ae('0x14')]({'where':{'id':_0x4b2127['params']['id']}})[_0x93ae('0x15')](handleEntityNotFound(_0x337f2e,null))[_0x93ae('0x15')](saveUpdates(_0x4b2127[_0x93ae('0x16')],null))['then'](respondWithResult(_0x337f2e,null))[_0x93ae('0x17')](handleError(_0x337f2e,null));}; \ No newline at end of file +var _0xa7b4=['update','then','sendStatus','error','stack','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','ioredis','../../config/logger','../../config/environment','../../mysqldb','register','redis','localhost','status','json'];(function(_0x1194ad,_0x3ff1b2){var _0x1a0e04=function(_0x22e803){while(--_0x22e803){_0x1194ad['push'](_0x1194ad['shift']());}};_0x1a0e04(++_0x3ff1b2);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x119b4b,_0x322a87){_0x119b4b=_0x119b4b-0x0;var _0x2ca4d5=_0xa7b4[_0x119b4b];return _0x2ca4d5;};'use strict';var _=require('lodash');var Redis=require(_0x4a7b('0x0'));var logger=require(_0x4a7b('0x1'))('api');var config=require(_0x4a7b('0x2'));var db=require(_0x4a7b('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user-setting.socket')[_0x4a7b('0x4')](socket);config[_0x4a7b('0x5')]=_['defaults'](config[_0x4a7b('0x5')],{'host':_0x4a7b('0x6'),'port':0x18eb});function respondWithResult(_0x14e777,_0x683a48){_0x683a48=_0x683a48||0xc8;return function(_0x2f9fe5){if(_0x2f9fe5){return _0x14e777[_0x4a7b('0x7')](_0x683a48)[_0x4a7b('0x8')](_0x2f9fe5);}};}function saveUpdates(_0x39b77d){return function(_0x2ea2ef){if(_0x2ea2ef){return _0x2ea2ef[_0x4a7b('0x9')](_0x39b77d)[_0x4a7b('0xa')](function(_0x3eb79b){return _0x3eb79b;});}return null;};}function handleEntityNotFound(_0x18dd5c){return function(_0x5a02f0){if(!_0x5a02f0){_0x18dd5c[_0x4a7b('0xb')](0x194);}return _0x5a02f0;};}function handleError(_0x4c3dc3,_0x1eaaf9){_0x1eaaf9=_0x1eaaf9||0x1f4;return function(_0x6b53b3){logger[_0x4a7b('0xc')](_0x6b53b3[_0x4a7b('0xd')]);if(_0x6b53b3['name']){delete _0x6b53b3['name'];}_0x4c3dc3[_0x4a7b('0x7')](_0x1eaaf9)[_0x4a7b('0xe')](_0x6b53b3);};}exports['update']=function(_0x5010e4,_0xb8f2ec){if(_0x5010e4[_0x4a7b('0xf')][_0x4a7b('0x10')]!==_0x4a7b('0x11'))throw new Error(_0x4a7b('0x12'));if(isNaN(Number(_0x5010e4[_0x4a7b('0x13')]['id'])))throw new Error(_0x4a7b('0x14'));return db[_0x4a7b('0x15')][_0x4a7b('0x16')]({'where':{'id':_0x5010e4[_0x4a7b('0x13')]['id']}})['then'](handleEntityNotFound(_0xb8f2ec,null))[_0x4a7b('0xa')](saveUpdates(_0x5010e4[_0x4a7b('0x17')],null))[_0x4a7b('0xa')](respondWithResult(_0xb8f2ec,null))[_0x4a7b('0x18')](handleError(_0xb8f2ec,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 f8e9bc3..87b101b 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 _0x714b=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x283a68,_0x252b4b){var _0xc6fe69=function(_0x38762a){while(--_0x38762a){_0x283a68['push'](_0x283a68['shift']());}};_0xc6fe69(++_0x252b4b);}(_0x714b,0x1d9));var _0xb714=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x714b[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0xb714('0x0'));var UserSetting=require(_0xb714('0x1'))['db'][_0xb714('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xb714('0x3')](0x0);var events={'afterCreate':_0xb714('0x4'),'afterUpdate':_0xb714('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2691a7){return function(_0x1b018b,_0x10b347,_0x226c9b){UserSettingEvents[_0xb714('0x6')](_0x2691a7+':'+_0x1b018b['id'],_0x1b018b);UserSettingEvents['emit'](_0x2691a7,_0x1b018b);_0x226c9b(null);};}for(var e in events){if(events[_0xb714('0x7')](e)){var event=events[e];UserSetting[_0xb714('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x7dbd=['hook','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit'];(function(_0x32354c,_0x4d7772){var _0x4cbb80=function(_0x3cdf9c){while(--_0x3cdf9c){_0x32354c['push'](_0x32354c['shift']());}};_0x4cbb80(++_0x4d7772);}(_0x7dbd,0x91));var _0xd7db=function(_0x30c92b,_0x154324){_0x30c92b=_0x30c92b-0x0;var _0x33837b=_0x7dbd[_0x30c92b];return _0x33837b;};'use strict';var EventEmitter=require(_0xd7db('0x0'));var UserSetting=require(_0xd7db('0x1'))['db'][_0xd7db('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xd7db('0x3')](0x0);var events={'afterCreate':_0xd7db('0x4'),'afterUpdate':_0xd7db('0x5'),'afterDestroy':_0xd7db('0x6')};function emitEvent(_0x121fa4){return function(_0x5d70f2,_0xa72f48,_0x4206f0){UserSettingEvents[_0xd7db('0x7')](_0x121fa4+':'+_0x5d70f2['id'],_0x5d70f2);UserSettingEvents['emit'](_0x121fa4,_0x5d70f2);_0x4206f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xd7db('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index a3f7d0c..1356751 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 _0x9532=['./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x4a761d,_0x34e23e){var _0x3776a4=function(_0x4e855e){while(--_0x4e855e){_0x4a761d['push'](_0x4a761d['shift']());}};_0x3776a4(++_0x34e23e);}(_0x9532,0x8c));var _0x2953=function(_0x585d39,_0x27705f){_0x585d39=_0x585d39-0x0;var _0x575bd7=_0x9532[_0x585d39];return _0x575bd7;};'use strict';var attributes=require(_0x2953('0x0'));module[_0x2953('0x1')]=function(_0x74bdd6){return _0x74bdd6[_0x2953('0x2')](_0x2953('0x3'),attributes,{'tableName':_0x2953('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51aa45){if(!_0x51aa45[_0x2953('0x5')])_0x51aa45[_0x2953('0x6')]=null;else if(_0x51aa45['clientSideLoggingEnabledSince']===null)_0x51aa45[_0x2953('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x4483=['exports','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x34c85e,_0x498ab8){var _0x5283ec=function(_0x33564e){while(--_0x33564e){_0x34c85e['push'](_0x34c85e['shift']());}};_0x5283ec(++_0x498ab8);}(_0x4483,0x1a3));var _0x3448=function(_0x3f28b0,_0x43777e){_0x3f28b0=_0x3f28b0-0x0;var _0x572267=_0x4483[_0x3f28b0];return _0x572267;};'use strict';var attributes=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c){return _0x229c0c['define'](_0x3448('0x2'),attributes,{'tableName':_0x3448('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27ef60){if(!_0x27ef60[_0x3448('0x4')])_0x27ef60[_0x3448('0x5')]=null;else if(_0x27ef60['clientSideLoggingEnabledSince']===null)_0x27ef60[_0x3448('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 a3805bb..8588649 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 _0x2c57=['user-setting:update:user-','UserId','register','length','./user-setting.events','save','remove','update','emit'];(function(_0x144410,_0x1e3ddc){var _0x1acb17=function(_0xee7470){while(--_0xee7470){_0x144410['push'](_0x144410['shift']());}};_0x1acb17(++_0x1e3ddc);}(_0x2c57,0x12d));var _0x72c5=function(_0x17a438,_0x4e3594){_0x17a438=_0x17a438-0x0;var _0x4bd13a=_0x2c57[_0x17a438];return _0x4bd13a;};'use strict';var UserSettingEvents=require(_0x72c5('0x0'));var events=[_0x72c5('0x1'),_0x72c5('0x2'),_0x72c5('0x3')];function createListener(_0x171978,_0x3e854b){return function(_0x2646df){_0x3e854b[_0x72c5('0x4')](_0x171978,_0x2646df);if(_0x171978==='user-setting:update'){_0x3e854b['emit'](_0x72c5('0x5')+_0x2646df[_0x72c5('0x6')],_0x2646df);}};}exports[_0x72c5('0x7')]=function(_0x586469){for(var _0x129800=0x0,_0x495197=events[_0x72c5('0x8')];_0x129800<_0x495197;_0x129800++){var _0x37445d=events[_0x129800];var _0x3166c2=createListener('user-setting:'+_0x37445d,_0x586469);UserSettingEvents['on'](_0x37445d,_0x3166c2);}}; \ No newline at end of file +var _0x093c=['emit','user-setting:update','user-setting:update:user-','register','user-setting:','update'];(function(_0x1db903,_0x3008bd){var _0x11df59=function(_0x4f2ba6){while(--_0x4f2ba6){_0x1db903['push'](_0x1db903['shift']());}};_0x11df59(++_0x3008bd);}(_0x093c,0x1a9));var _0xc093=function(_0x4b9fdb,_0x58463e){_0x4b9fdb=_0x4b9fdb-0x0;var _0x45a3aa=_0x093c[_0x4b9fdb];return _0x45a3aa;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save','remove',_0xc093('0x0')];function createListener(_0x34cc8a,_0x250b92){return function(_0x3f283f){_0x250b92[_0xc093('0x1')](_0x34cc8a,_0x3f283f);if(_0x34cc8a===_0xc093('0x2')){_0x250b92[_0xc093('0x1')](_0xc093('0x3')+_0x3f283f['UserId'],_0x3f283f);}};}exports[_0xc093('0x4')]=function(_0x16d17b){for(var _0x38f832=0x0,_0x479edd=events['length'];_0x38f832<_0x479edd;_0x38f832++){var _0xf8dfbb=events[_0x38f832];var _0x428331=createListener(_0xc093('0x5')+_0xf8dfbb,_0x16d17b);UserSettingEvents['on'](_0xf8dfbb,_0x428331);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index cb889a8..84deb71 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 _0x377e=['addContacts','post','create','/create_many','bulkCreate','addQueues','join','root','server/files/images/','format','%s-%s','now','file','addAvatar','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/whoami','isAuthenticated','whoami','/presence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getScheduledCalls','/:id/api_key','getApiKey'];(function(_0x2c34ba,_0x492148){var _0x272063=function(_0x35577a){while(--_0x35577a){_0x2c34ba['push'](_0x2c34ba['shift']());}};_0x272063(++_0x492148);}(_0x377e,0x1e2));var _0xe377=function(_0x1f12ad,_0x1d0e2a){_0x1f12ad=_0x1f12ad-0x0;var _0x533d97=_0x377e[_0x1f12ad];return _0x533d97;};'use strict';var multer=require(_0xe377('0x0'));var util=require(_0xe377('0x1'));var path=require('path');var timeout=require(_0xe377('0x2'));var express=require('express');var router=express[_0xe377('0x3')]();var fs_extra=require(_0xe377('0x4'));var auth=require(_0xe377('0x5'));var interaction=require(_0xe377('0x6'));var config=require(_0xe377('0x7'));var controller=require('./user.controller');router[_0xe377('0x8')]('/',auth['isAuthenticated'](),controller[_0xe377('0x9')]);router[_0xe377('0x8')](_0xe377('0xa'),auth['isAuthenticated'](),controller[_0xe377('0xb')]);router['get'](_0xe377('0xc'),auth[_0xe377('0xd')](),controller[_0xe377('0xe')]);router[_0xe377('0x8')](_0xe377('0xf'),auth[_0xe377('0xd')](),controller['getPresence']);router[_0xe377('0x8')](_0xe377('0x10'),auth[_0xe377('0xd')](),controller[_0xe377('0x11')]);router['get'](_0xe377('0x12'),controller['getAvatar']);router[_0xe377('0x8')](_0xe377('0x13'),auth[_0xe377('0xd')](),controller[_0xe377('0x14')]);router['get'](_0xe377('0x15'),auth[_0xe377('0xd')](),controller[_0xe377('0x16')]);router[_0xe377('0x8')](_0xe377('0x17'),auth[_0xe377('0xd')](),controller[_0xe377('0x18')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0xe377('0x19')]);router[_0xe377('0x8')](_0xe377('0x1a'),auth[_0xe377('0xd')](),controller[_0xe377('0x1b')]);router['get']('/:id/recordings',auth[_0xe377('0xd')](),controller['getRecordings']);router[_0xe377('0x8')]('/:id/screen_recordings',auth[_0xe377('0xd')](),controller[_0xe377('0x1c')]);router[_0xe377('0x8')](_0xe377('0x1d'),auth[_0xe377('0xd')](),controller[_0xe377('0x1e')]);router[_0xe377('0x8')]('/:id/openchannel/interactions',auth[_0xe377('0xd')](),controller[_0xe377('0x1f')]);router[_0xe377('0x8')](_0xe377('0x20'),auth[_0xe377('0xd')](),controller[_0xe377('0x21')]);router[_0xe377('0x8')]('/:id/sms/interactions',auth[_0xe377('0xd')](),controller[_0xe377('0x22')]);router['get'](_0xe377('0x23'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xe377('0x8')]('/:id/whatsapp/interactions',auth[_0xe377('0xd')](),controller[_0xe377('0x24')]);router[_0xe377('0x8')](_0xe377('0x25'),auth[_0xe377('0xd')](),controller['getTeams']);router['get']('/:id/lists',auth[_0xe377('0xd')](),controller[_0xe377('0x26')]);router['get']('/:id/agents',auth[_0xe377('0xd')](),controller['getAgents']);router[_0xe377('0x8')](_0xe377('0x27'),auth['isAuthenticated'](),controller[_0xe377('0x28')]);router[_0xe377('0x8')](_0xe377('0x29'),auth[_0xe377('0xd')](),controller['getFaxAccounts']);router['get'](_0xe377('0x2a'),auth[_0xe377('0xd')](),controller[_0xe377('0x2b')]);router[_0xe377('0x8')](_0xe377('0x2c'),auth['isAuthenticated'](),controller[_0xe377('0x2d')]);router['get'](_0xe377('0x2e'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0xe377('0x8')](_0xe377('0x2f'),auth[_0xe377('0xd')](),controller[_0xe377('0x30')]);router[_0xe377('0x8')](_0xe377('0x31'),auth[_0xe377('0xd')](),controller['getWhatsappAccounts']);router['get']('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0xe377('0x32')]);router[_0xe377('0x8')](_0xe377('0x33'),auth[_0xe377('0xd')](),controller[_0xe377('0x34')]);router['post']('/:id/contacts',auth[_0xe377('0xd')](),controller[_0xe377('0x35')]);router[_0xe377('0x36')]('/',auth[_0xe377('0xd')](),controller[_0xe377('0x37')]);router['post'](_0xe377('0x38'),auth['isAuthenticated'](),controller[_0xe377('0x39')]);router[_0xe377('0x36')](_0xe377('0x17'),auth[_0xe377('0xd')](),controller[_0xe377('0x3a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2d8737,_0x371787,_0xe156df){_0xe156df(null,path[_0xe377('0x3b')](config[_0xe377('0x3c')],_0xe377('0x3d')));},'filename':function(_0xfabe3e,_0x54d784,_0x65631e){_0x65631e(null,util[_0xe377('0x3e')](_0xe377('0x3f'),Date[_0xe377('0x40')](),_0x54d784['originalname']));}})});router[_0xe377('0x36')](_0xe377('0x12'),upload['single'](_0xe377('0x41')),controller[_0xe377('0x42')]);router[_0xe377('0x36')]('/:id/login',auth['isAuthenticated'](),controller['login']);router[_0xe377('0x36')](_0xe377('0x43'),auth['isAuthenticated'](),controller[_0xe377('0x44')]);router[_0xe377('0x36')](_0xe377('0x45'),auth[_0xe377('0xd')](),controller[_0xe377('0x46')]);router[_0xe377('0x36')](_0xe377('0x47'),auth[_0xe377('0xd')](),controller['unpause']);router[_0xe377('0x36')](_0xe377('0x25'),auth[_0xe377('0xd')](),controller[_0xe377('0x48')]);router[_0xe377('0x36')](_0xe377('0x49'),auth['isAuthenticated'](),controller[_0xe377('0x4a')]);router[_0xe377('0x36')](_0xe377('0x4b'),auth[_0xe377('0xd')](),controller[_0xe377('0x4c')]);router[_0xe377('0x36')]('/:id/fax_interactions',auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0xe377('0x36')](_0xe377('0x4d'),auth[_0xe377('0xd')](),controller['addSmsInteractions']);router['post'](_0xe377('0x4e'),auth['isAuthenticated'](),controller[_0xe377('0x4f')]);router[_0xe377('0x36')](_0xe377('0x50'),auth['isAuthenticated'](),controller[_0xe377('0x51')]);router[_0xe377('0x36')](_0xe377('0x29'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0xe377('0x36')](_0xe377('0x2a'),auth[_0xe377('0xd')](),controller[_0xe377('0x52')]);router['post'](_0xe377('0x2c'),auth[_0xe377('0xd')](),controller[_0xe377('0x53')]);router['post'](_0xe377('0x2e'),auth['isAuthenticated'](),controller[_0xe377('0x54')]);router[_0xe377('0x36')](_0xe377('0x2f'),auth[_0xe377('0xd')](),controller[_0xe377('0x55')]);router['post'](_0xe377('0x31'),auth[_0xe377('0xd')](),controller[_0xe377('0x56')]);router[_0xe377('0x36')](_0xe377('0x33'),auth[_0xe377('0xd')](),controller[_0xe377('0x57')]);router[_0xe377('0x58')](_0xe377('0x10'),auth[_0xe377('0xd')](),controller['update']);router[_0xe377('0x58')](_0xe377('0x59'),auth[_0xe377('0xd')](),controller[_0xe377('0x5a')]);router[_0xe377('0x5b')]('/:id/queues',auth[_0xe377('0xd')](),controller[_0xe377('0x5c')]);router['delete'](_0xe377('0x25'),auth[_0xe377('0xd')](),controller[_0xe377('0x5d')]);router[_0xe377('0x5b')](_0xe377('0x10'),auth[_0xe377('0xd')](),controller[_0xe377('0x5e')]);router['delete'](_0xe377('0x49'),auth[_0xe377('0xd')](),controller[_0xe377('0x5f')]);router[_0xe377('0x5b')](_0xe377('0x4b'),auth[_0xe377('0xd')](),controller[_0xe377('0x60')]);router[_0xe377('0x5b')](_0xe377('0x61'),auth[_0xe377('0xd')](),controller[_0xe377('0x62')]);router[_0xe377('0x5b')](_0xe377('0x4d'),auth['isAuthenticated'](),controller[_0xe377('0x63')]);router['delete'](_0xe377('0x4e'),auth['isAuthenticated'](),controller[_0xe377('0x64')]);router[_0xe377('0x5b')](_0xe377('0x50'),auth[_0xe377('0xd')](),controller[_0xe377('0x65')]);router[_0xe377('0x5b')](_0xe377('0x29'),auth[_0xe377('0xd')](),controller['removeFaxAccounts']);router[_0xe377('0x5b')](_0xe377('0x2a'),auth[_0xe377('0xd')](),controller[_0xe377('0x66')]);router[_0xe377('0x5b')](_0xe377('0x2c'),auth[_0xe377('0xd')](),controller[_0xe377('0x67')]);router[_0xe377('0x5b')](_0xe377('0x2e'),auth[_0xe377('0xd')](),controller[_0xe377('0x68')]);router[_0xe377('0x5b')](_0xe377('0x2f'),auth[_0xe377('0xd')](),controller[_0xe377('0x69')]);router[_0xe377('0x5b')]('/:id/whatsapp_accounts',auth[_0xe377('0xd')](),controller['removeWhatsappAccounts']);router[_0xe377('0x5b')](_0xe377('0x33'),auth[_0xe377('0xd')](),controller[_0xe377('0x6a')]);module['exports']=router; \ No newline at end of file +var _0xaf1d=['/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','getScheduledCalls','getApiKey','addContacts','create','post','/create_many','bulkCreate','addQueues','root','format','%s-%s','now','originalname','single','addAvatar'];(function(_0xec86fc,_0x1c5651){var _0x1d241f=function(_0x46ceba){while(--_0x46ceba){_0xec86fc['push'](_0xec86fc['shift']());}};_0x1d241f(++_0x1c5651);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x3260be,_0x11bcc9){_0x3260be=_0x3260be-0x0;var _0x47afc3=_0xaf1d[_0x3260be];return _0x47afc3;};'use strict';var multer=require(_0xdaf1('0x0'));var util=require(_0xdaf1('0x1'));var path=require(_0xdaf1('0x2'));var timeout=require(_0xdaf1('0x3'));var express=require('express');var router=express[_0xdaf1('0x4')]();var fs_extra=require(_0xdaf1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdaf1('0x6'));var config=require(_0xdaf1('0x7'));var controller=require(_0xdaf1('0x8'));router[_0xdaf1('0x9')]('/',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdaf1('0xc')]);router['get']('/whoami',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0xd')]);router[_0xdaf1('0x9')](_0xdaf1('0xe'),auth['isAuthenticated'](),controller[_0xdaf1('0xf')]);router[_0xdaf1('0x9')](_0xdaf1('0x10'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x11')]);router['get'](_0xdaf1('0x12'),controller[_0xdaf1('0x13')]);router[_0xdaf1('0x9')](_0xdaf1('0x14'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x15')]);router[_0xdaf1('0x9')](_0xdaf1('0x16'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x17')]);router[_0xdaf1('0x9')](_0xdaf1('0x18'),auth[_0xdaf1('0xa')](),controller['getQueues']);router[_0xdaf1('0x9')](_0xdaf1('0x19'),auth['isAuthenticated'](),controller[_0xdaf1('0x1a')]);router['get'](_0xdaf1('0x1b'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x1c')]);router['get'](_0xdaf1('0x1d'),auth['isAuthenticated'](),controller['getRecordings']);router[_0xdaf1('0x9')](_0xdaf1('0x1e'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x1f')]);router['get']('/:id/chat/interactions',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x20')]);router[_0xdaf1('0x9')]('/:id/openchannel/interactions',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x21')]);router[_0xdaf1('0x9')](_0xdaf1('0x22'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x23')]);router[_0xdaf1('0x9')](_0xdaf1('0x24'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x25')]);router['get'](_0xdaf1('0x26'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x27')]);router['get']('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0xdaf1('0x9')](_0xdaf1('0x28'),auth['isAuthenticated'](),controller[_0xdaf1('0x29')]);router[_0xdaf1('0x9')](_0xdaf1('0x2a'),auth['isAuthenticated'](),controller[_0xdaf1('0x2b')]);router[_0xdaf1('0x9')]('/:id/agents',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x2c')]);router[_0xdaf1('0x9')](_0xdaf1('0x2d'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x2e')]);router['get'](_0xdaf1('0x2f'),auth[_0xdaf1('0xa')](),controller['getFaxAccounts']);router['get'](_0xdaf1('0x30'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x31')]);router['get'](_0xdaf1('0x32'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x33')]);router[_0xdaf1('0x9')](_0xdaf1('0x34'),auth['isAuthenticated'](),controller[_0xdaf1('0x35')]);router[_0xdaf1('0x9')](_0xdaf1('0x36'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xdaf1('0x9')]('/:id/whatsapp_accounts',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x37')]);router[_0xdaf1('0x9')]('/:id/scheduled_calls',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x38')]);router['get']('/:id/api_key',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x39')]);router['post'](_0xdaf1('0x16'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x3a')]);router['post']('/',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x3b')]);router[_0xdaf1('0x3c')](_0xdaf1('0x3d'),auth['isAuthenticated'](),controller[_0xdaf1('0x3e')]);router[_0xdaf1('0x3c')](_0xdaf1('0x18'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x3f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x219551,_0x20dee8,_0x2ad787){_0x2ad787(null,path['join'](config[_0xdaf1('0x40')],'server/files/images/'));},'filename':function(_0x38f534,_0x25c67f,_0x5c558f){_0x5c558f(null,util[_0xdaf1('0x41')](_0xdaf1('0x42'),Date[_0xdaf1('0x43')](),_0x25c67f[_0xdaf1('0x44')]));}})});router[_0xdaf1('0x3c')]('/:id/avatar',upload[_0xdaf1('0x45')]('file'),controller[_0xdaf1('0x46')]);router['post'](_0xdaf1('0x47'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x48')]);router['post'](_0xdaf1('0x49'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x4a')]);router[_0xdaf1('0x3c')](_0xdaf1('0x4b'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x4c')]);router[_0xdaf1('0x3c')](_0xdaf1('0x4d'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x4e')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xdaf1('0x4f')]);router['post']('/:id/chat_interactions',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x50')]);router[_0xdaf1('0x3c')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xdaf1('0x51')]);router[_0xdaf1('0x3c')](_0xdaf1('0x52'),auth['isAuthenticated'](),controller[_0xdaf1('0x53')]);router['post'](_0xdaf1('0x54'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x55')]);router[_0xdaf1('0x3c')](_0xdaf1('0x56'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x57')]);router[_0xdaf1('0x3c')](_0xdaf1('0x58'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x59')]);router[_0xdaf1('0x3c')](_0xdaf1('0x2f'),auth['isAuthenticated'](),controller[_0xdaf1('0x5a')]);router[_0xdaf1('0x3c')](_0xdaf1('0x30'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x5b')]);router[_0xdaf1('0x3c')](_0xdaf1('0x32'),auth['isAuthenticated'](),controller[_0xdaf1('0x5c')]);router[_0xdaf1('0x3c')](_0xdaf1('0x34'),auth['isAuthenticated'](),controller[_0xdaf1('0x5d')]);router[_0xdaf1('0x3c')]('/:id/chat_websites',auth[_0xdaf1('0xa')](),controller['addChatWebsites']);router[_0xdaf1('0x3c')]('/:id/whatsapp_accounts',auth[_0xdaf1('0xa')](),controller['addWhatsappAccounts']);router[_0xdaf1('0x3c')](_0xdaf1('0x5e'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x5f')]);router[_0xdaf1('0x60')](_0xdaf1('0x10'),auth['isAuthenticated'](),controller[_0xdaf1('0x61')]);router[_0xdaf1('0x60')](_0xdaf1('0x62'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x63')]);router[_0xdaf1('0x64')](_0xdaf1('0x18'),auth['isAuthenticated'](),controller[_0xdaf1('0x65')]);router['delete']('/:id/teams',auth[_0xdaf1('0xa')](),controller['removeTeams']);router['delete'](_0xdaf1('0x10'),auth['isAuthenticated'](),controller[_0xdaf1('0x66')]);router[_0xdaf1('0x64')](_0xdaf1('0x67'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x68')]);router[_0xdaf1('0x64')]('/:id/mail_interactions',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x69')]);router['delete'](_0xdaf1('0x52'),auth[_0xdaf1('0xa')](),controller['removeFaxInteractions']);router[_0xdaf1('0x64')]('/:id/sms_interactions',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x6a')]);router[_0xdaf1('0x64')]('/:id/openchannel_interactions',auth[_0xdaf1('0xa')](),controller['removeOpenchannelInteractions']);router[_0xdaf1('0x64')](_0xdaf1('0x58'),auth[_0xdaf1('0xa')](),controller['removeWhatsappInteractions']);router[_0xdaf1('0x64')]('/:id/fax_accounts',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x6b')]);router['delete'](_0xdaf1('0x30'),auth['isAuthenticated'](),controller[_0xdaf1('0x6c')]);router[_0xdaf1('0x64')]('/:id/openchannel_accounts',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x6d')]);router[_0xdaf1('0x64')]('/:id/sms_accounts',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x6e')]);router['delete'](_0xdaf1('0x36'),auth['isAuthenticated'](),controller[_0xdaf1('0x6f')]);router[_0xdaf1('0x64')](_0xdaf1('0x70'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x71')]);router[_0xdaf1('0x64')](_0xdaf1('0x5e'),auth['isAuthenticated'](),controller['removeApiKey']);module[_0xdaf1('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c09c168..fdda8fa 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x1e4fcb,_0x50478d){var _0x2b3a24=function(_0x1a3894){while(--_0x1a3894){_0x1e4fcb['push'](_0x1e4fcb['shift']());}};_0x2b3a24(++_0x50478d);}(_0x70e0,0x17b));var _0x070e=function(_0x2fd4e4,_0x3da918){_0x2fd4e4=_0x2fd4e4-0x0;var _0x64b7b0=_0x70e0[_0x2fd4e4];return _0x64b7b0;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'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 19dcee6..8c447e4 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 _0x540b=['api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','redis','register','http','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','role','agent','emit','userNotification:recalc:','destroy','admin','Users','telephone','filter','ignore','map','value','includes','name','end','send','index','rawAttributes','fieldName','type','key','password','salt','query','includeAll','userSetting','include','attributes','push','User','true','rows','length','chat','dataValues','fax','mail','openchannel','all','catch','show','params','model','keys','filters','intersection','fields','UserSetting','merge','find','openTabs','sms','whatsapp','body','describe','addContacts','ids','internal','Setting','findById','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','104','105','108','109','100','111','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','UserProfileSection','Agents','Telephones','userProfileId','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','findAll','isEmpty','UserProfileResource','oldPassword','ValidationError','authenticate','Sequelize','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','online','voicePause','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','penalty','capitalize','Queue:save','VoiceQueue','get','voice','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','QueueId','Queue:remove','addAvatar','file','join','root','userpic','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WHATSAPP','concat','User\x20with\x20id\x20%s\x20not\x20found','getOptions','hasOwnProperty','CmList','List','Tag','Tags','tag','getQueues','order','sort','where','pick','options','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','FaxInteraction','getWhatsappInteractions','login','mobile','interface','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','loginInPause','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','resolve','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getDataValue','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','spread','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','CmHopper','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','$contained','firstName','lastName','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','teams','queues','inbound','lower','col','flatten','toString','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unavailable','ringing','voiceStatus','busy','charAt','toUpperCase','slice','InteractionId','field','ui.createdAt','OpenTabs','moment','util','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger'];(function(_0xbf3b03,_0x76e67){var _0x154d9d=function(_0x36fb42){while(--_0x36fb42){_0xbf3b03['push'](_0xbf3b03['shift']());}};_0x154d9d(++_0x76e67);}(_0x540b,0x180));var _0xb540=function(_0x3be2c2,_0x58563f){_0x3be2c2=_0x3be2c2-0x0;var _0x4ca32c=_0x540b[_0x3be2c2];return _0x4ca32c;};'use strict';var moment=require(_0xb540('0x0'));var util=require(_0xb540('0x1'));var path=require('path');var fs=require('fs');var _=require(_0xb540('0x2'));var squel=require('squel');var jayson=require(_0xb540('0x3'));var Redis=require(_0xb540('0x4'));var authService=require(_0xb540('0x5'));var contacts=require(_0xb540('0x6'));var qs=require(_0xb540('0x7'));var logger=require(_0xb540('0x8'))(_0xb540('0x9'));var utils=require(_0xb540('0xa'));var config=require(_0xb540('0xb'));var licenseUtil=require(_0xb540('0xc'));var APIBadRequestError=require(_0xb540('0xd'))[_0xb540('0xe')];var APINotFoundError=require('../../errors/api')[_0xb540('0xf')];var APIHandleError=require(_0xb540('0xd'))[_0xb540('0x10')];var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xb540('0x11')]));require('./user.socket')[_0xb540('0x12')](socket);config[_0xb540('0x11')]=_['defaults'](config[_0xb540('0x11')],{'host':'localhost','port':0x18eb});var amiClient=jayson['client'][_0xb540('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0xf0725d,_0x3a894e,_0x31867c,_0x419b90){return new Promise(function(_0x15af10,_0x4d0567){var _0x467634=_0x419b90||amiClient;return _0x467634[_0xb540('0x14')](_0xf0725d,_0x31867c)[_0xb540('0x15')](function(_0x49d79e){logger['info'](_0xb540('0x16'),_0x3a894e,_0xb540('0x17'));logger[_0xb540('0x18')](_0xb540('0x19'),_0x3a894e,_0xb540('0x17'),JSON['stringify'](_0x49d79e));if(_0x49d79e['error']){if(_0x49d79e[_0xb540('0x1a')][_0xb540('0x1b')]===0x1f4){logger[_0xb540('0x1a')](_0xb540('0x16'),_0x3a894e,_0x49d79e[_0xb540('0x1a')][_0xb540('0x1c')]);return _0x4d0567(_0x49d79e[_0xb540('0x1a')][_0xb540('0x1c')]);}logger['error'](_0xb540('0x16'),_0x3a894e,_0x49d79e[_0xb540('0x1a')]['message']);return _0x15af10(_0x49d79e[_0xb540('0x1a')][_0xb540('0x1c')]);}else{logger[_0xb540('0x1d')](_0xb540('0x16'),_0x3a894e,_0xb540('0x17'));_0x15af10(_0x49d79e[_0xb540('0x1e')][_0xb540('0x1c')]);}})['catch'](function(_0x4b03e1){logger['error'](_0xb540('0x16'),_0x3a894e,_0x4b03e1);_0x4d0567(_0x4b03e1);});});}function respondWithStatusCode(_0x41099c,_0x1af24b){_0x1af24b=_0x1af24b||0xcc;return function(_0x9e5e47){if(_0x9e5e47){return _0x41099c[_0xb540('0x1f')](_0x1af24b);}return _0x41099c[_0xb540('0x20')](_0x1af24b)['end']();};}function respondWithResult(_0x11ca0e,_0x4446b5){_0x4446b5=_0x4446b5||0xc8;return function(_0x450f46){if(_0x450f46){return _0x11ca0e['status'](_0x4446b5)[_0xb540('0x21')](_0x450f46);}};}function respondWithFilteredResult(_0x14aa94,_0x5a51f4){return function(_0x31a573){if(_0x31a573){var _0x4c48a6=typeof _0x5a51f4[_0xb540('0x22')]===_0xb540('0x23')&&typeof _0x5a51f4[_0xb540('0x24')]===_0xb540('0x23');var _0x53bc53=_0x31a573[_0xb540('0x25')];var _0x285876=_0x4c48a6?0x0:_0x5a51f4[_0xb540('0x22')];var _0x4aa769=_0x4c48a6?_0x31a573[_0xb540('0x25')]:_0x5a51f4[_0xb540('0x22')]+_0x5a51f4['limit'];var _0x2e8652;if(_0x4aa769>=_0x53bc53){_0x4aa769=_0x53bc53;_0x2e8652=0xc8;}else{_0x2e8652=0xce;}_0x14aa94[_0xb540('0x20')](_0x2e8652);return _0x14aa94['set'](_0xb540('0x26'),_0x285876+'-'+_0x4aa769+'/'+_0x53bc53)[_0xb540('0x21')](_0x31a573);}return null;};}function saveUpdates(_0x3cc89e){return function(_0x5d95d1){if(_0x5d95d1){return _0x5d95d1[_0xb540('0x27')](_0x3cc89e)['then'](function(_0x287e88){if(_0x287e88[_0xb540('0x28')]===_0xb540('0x29')){socket[_0xb540('0x2a')](_0xb540('0x2b')+_0x287e88['id'],_0x287e88);}return _0x287e88;});}return null;};}function removeEntity(_0x1f1a31){return function(_0x40a395){if(_0x40a395){return _0x40a395[_0xb540('0x2c')]()[_0xb540('0x15')](function(){var _0x26d4d1=_0x40a395['get']({'plain':!![]});if(_0x26d4d1[_0xb540('0x28')]===_0xb540('0x2d'))return;var _0x1bc866=[{'name':_0xb540('0x2e'),'value':'user','ignore':!![]},{'name':'Agents','value':_0xb540('0x29'),'ignore':![]},{'name':'Telephones','value':_0xb540('0x2f'),'ignore':![]}];var _0xb699a7=_(_0x1bc866)[_0xb540('0x30')](_0xb540('0x31'))[_0xb540('0x32')](_0xb540('0x33'))['value']();if(_[_0xb540('0x34')](_0xb699a7,_0x26d4d1[_0xb540('0x28')])){return;}var _0x469a87=_['find'](_0x1bc866,[_0xb540('0x33'),_0x26d4d1[_0xb540('0x28')]])[_0xb540('0x35')];return db['UserProfileResource']['destroy']({'where':{'type':_0x469a87,'resourceId':_0x26d4d1['id']}})[_0xb540('0x15')](function(){return _0x40a395;});})[_0xb540('0x15')](function(){_0x1f1a31['status'](0xcc)[_0xb540('0x36')]();});}};}function handleEntityNotFound(_0x5e737a){return function(_0x3ed573){if(!_0x3ed573){_0x5e737a[_0xb540('0x1f')](0x194);}return _0x3ed573;};}function handleError(_0x563739,_0x43df69){_0x43df69=_0x43df69||0x1f4;return function(_0x320448){logger[_0xb540('0x1a')](_0x320448['stack']);if(_0x320448[_0xb540('0x35')]){delete _0x320448['name'];}_0x563739['status'](_0x43df69)[_0xb540('0x37')](_0x320448);};}exports[_0xb540('0x38')]=function(_0x39f3c9,_0x5678c5){var _0x1a165f={},_0x156790={'count':0x0,'rows':[]};var _0x54e56a=_(db['User'][_0xb540('0x39')])[_0xb540('0x32')](function(_0x2d1c76){return{'name':_0x2d1c76[_0xb540('0x3a')],'type':_0x2d1c76[_0xb540('0x3b')][_0xb540('0x3c')]};})[_0xb540('0x30')](function(_0x3b0275){return!_[_0xb540('0x34')]([_0xb540('0x3d'),_0xb540('0x3e')],_0x3b0275[_0xb540('0x35')]);})[_0xb540('0x33')]();_0x1a165f=qs['getOptions'](_0x54e56a,_0x39f3c9);var _0x179d5c={'where':_0x1a165f['where']};return db['User'][_0xb540('0x25')](_0x179d5c)[_0xb540('0x15')](function(_0x565dde){_0x156790[_0xb540('0x25')]=_0x565dde;if(_0x39f3c9[_0xb540('0x3f')][_0xb540('0x40')]){_0x1a165f['include']=[{'all':!![]}];}if(_0x39f3c9[_0xb540('0x3f')][_0xb540('0x41')]==='true'){_0x1a165f[_0xb540('0x42')]=[{'model':db['UserSetting'],'as':_0xb540('0x41')}];}if(!_['includes'](_0x1a165f[_0xb540('0x43')],'id')){_0x1a165f['attributes'][_0xb540('0x44')]('id');}return db[_0xb540('0x45')]['findAll'](_0x1a165f);})['then'](function(_0x5ad577){_0x156790['rows']=_0x5ad577;if(_0x39f3c9['query']['openTabs']===_0xb540('0x46')){var _0x24fbc9=[];for(var _0x3f8de1=0x0;_0x3f8de1<_0x156790[_0xb540('0x47')][_0xb540('0x48')];_0x3f8de1++){_0x24fbc9[_0xb540('0x44')](get_open_tabs(_0xb540('0x49'),_0x156790['rows'][_0x3f8de1][_0xb540('0x4a')]));_0x24fbc9[_0xb540('0x44')](get_open_tabs('sms',_0x156790[_0xb540('0x47')][_0x3f8de1][_0xb540('0x4a')]));_0x24fbc9[_0xb540('0x44')](get_open_tabs(_0xb540('0x4b'),_0x156790[_0xb540('0x47')][_0x3f8de1]['dataValues']));_0x24fbc9['push'](get_open_tabs(_0xb540('0x4c'),_0x156790[_0xb540('0x47')][_0x3f8de1]['dataValues']));_0x24fbc9['push'](get_open_tabs(_0xb540('0x4d'),_0x156790[_0xb540('0x47')][_0x3f8de1][_0xb540('0x4a')]));_0x24fbc9[_0xb540('0x44')](get_open_tabs('whatsapp',_0x156790['rows'][_0x3f8de1][_0xb540('0x4a')]));}return Promise[_0xb540('0x4e')](_0x24fbc9)['then'](function(){return _0x156790;});}else{return _0x156790;}})[_0xb540('0x15')](respondWithFilteredResult(_0x5678c5,_0x1a165f))[_0xb540('0x4f')](handleError(_0x5678c5,null));};exports[_0xb540('0x50')]=function(_0x393947,_0x512c4c){var _0x3d91a9={'raw':![],'where':{'id':_0x393947[_0xb540('0x51')]['id']}},_0x15718c={};_0x15718c[_0xb540('0x52')]=_['differenceBy'](_[_0xb540('0x53')](db[_0xb540('0x45')][_0xb540('0x39')]),['password',_0xb540('0x3e')]);_0x15718c['query']=_[_0xb540('0x53')](_0x393947[_0xb540('0x3f')]);_0x15718c[_0xb540('0x54')]=_[_0xb540('0x55')](_0x15718c[_0xb540('0x52')],_0x15718c[_0xb540('0x3f')]);_0x3d91a9[_0xb540('0x43')]=_[_0xb540('0x55')](_0x15718c[_0xb540('0x52')],qs[_0xb540('0x56')](_0x393947[_0xb540('0x3f')]['fields']));_0x3d91a9[_0xb540('0x43')]=_0x3d91a9['attributes'][_0xb540('0x48')]?_0x3d91a9['attributes']:_0x15718c[_0xb540('0x52')];if(_0x393947[_0xb540('0x3f')]['includeAll']){_0x3d91a9[_0xb540('0x42')]=[{'all':!![]}];}if(_0x393947[_0xb540('0x3f')][_0xb540('0x41')]===_0xb540('0x46')){_0x3d91a9['include']=[{'model':db[_0xb540('0x57')],'as':'userSetting'}];}_0x3d91a9=_[_0xb540('0x58')]({},_0x3d91a9,_0x393947['options']);if(!_[_0xb540('0x34')](_0x3d91a9['attributes'],'id')){_0x3d91a9['attributes']['push']('id');}return db[_0xb540('0x45')][_0xb540('0x59')](_0x3d91a9)[_0xb540('0x15')](handleEntityNotFound(_0x512c4c,null))[_0xb540('0x15')](function(_0xab7f87){var _0x5c1dcf=[];values=_0xab7f87;if(_0x393947[_0xb540('0x3f')][_0xb540('0x5a')]===_0xb540('0x46')){_0x5c1dcf[_0xb540('0x44')](get_open_tabs(_0xb540('0x49'),_0xab7f87['dataValues']));_0x5c1dcf['push'](get_open_tabs(_0xb540('0x5b'),_0xab7f87[_0xb540('0x4a')]));_0x5c1dcf[_0xb540('0x44')](get_open_tabs('openchannel',_0xab7f87[_0xb540('0x4a')]));_0x5c1dcf['push'](get_open_tabs(_0xb540('0x5c'),_0xab7f87['dataValues']));_0x5c1dcf[_0xb540('0x44')](get_open_tabs(_0xb540('0x4b'),_0xab7f87['dataValues']));_0x5c1dcf[_0xb540('0x44')](get_open_tabs('mail',_0xab7f87['dataValues']));return Promise['all'](_0x5c1dcf);}else{return values;}})[_0xb540('0x15')](function(){return values;})[_0xb540('0x15')](respondWithResult(_0x512c4c,null))[_0xb540('0x4f')](handleError(_0x512c4c,null));};exports[_0xb540('0x27')]=function(_0x2d8af5,_0x2ff7fd){if(_0x2d8af5[_0xb540('0x5d')]['id']){delete _0x2d8af5['body']['id'];}delete _0x2d8af5[_0xb540('0x5d')][_0xb540('0x28')];return db['User'][_0xb540('0x59')]({'where':{'id':_0x2d8af5[_0xb540('0x51')]['id']}})[_0xb540('0x15')](handleEntityNotFound(_0x2ff7fd,null))['then'](saveUpdates(_0x2d8af5[_0xb540('0x5d')],null))[_0xb540('0x15')](respondWithResult(_0x2ff7fd,null))[_0xb540('0x4f')](handleError(_0x2ff7fd,null));};exports[_0xb540('0x5e')]=function(_0x3ba2b9,_0x5c078b){return db[_0xb540('0x45')]['describe']()[_0xb540('0x15')](respondWithResult(_0x5c078b,null))[_0xb540('0x4f')](handleError(_0x5c078b,null));};exports[_0xb540('0x5f')]=function(_0x108be8,_0x48a274){return db[_0xb540('0x45')][_0xb540('0x59')]({'where':{'id':_0x108be8[_0xb540('0x51')]['id']}})['then'](handleEntityNotFound(_0x48a274,null))['then'](function(_0x4a703c){if(_0x4a703c){return _0x4a703c[_0xb540('0x5f')](_0x108be8[_0xb540('0x5d')][_0xb540('0x60')],_['omit'](_0x108be8[_0xb540('0x5d')],[_0xb540('0x60'),'id'])||{});}})[_0xb540('0x15')](respondWithResult(_0x48a274,null))[_0xb540('0x4f')](handleError(_0x48a274,null));};function validateUser(_0x278fc9){return new Promise(function(_0x440be8,_0x43b503){if(_0x278fc9[_0xb540('0x61')])return _0x440be8(_0x278fc9);return db[_0xb540('0x62')][_0xb540('0x63')](0x1)[_0xb540('0x15')](function(_0x113611){if(_0x113611['securePassword'])authService[_0xb540('0x64')](_0x278fc9[_0xb540('0x3d')]);db[_0xb540('0x45')][_0xb540('0x65')]('internal')[_0xb540('0x15')](function(_0x12dca1){if(_[_0xb540('0x66')](_0x12dca1)){_0x278fc9[_0xb540('0x61')]=_0x113611[_0xb540('0x67')]||0x1;return;}if(_[_0xb540('0x66')](_0x113611[_0xb540('0x67')])||_0x113611[_0xb540('0x67')]===_0x12dca1){_0x278fc9[_0xb540('0x61')]=_0x12dca1+0x1;return;}if(_0x113611['min_internal']>_0x12dca1){_0x278fc9[_0xb540('0x61')]=_0x113611[_0xb540('0x67')];return;}return db[_0xb540('0x68')][_0xb540('0x3f')](_0xb540('0x69'),{'type':db[_0xb540('0x68')][_0xb540('0x6a')][_0xb540('0x6b')]})[_0xb540('0x15')](function(_0x35d5ab){if(_0x35d5ab&&_0x35d5ab[_0xb540('0x48')]){for(var _0x2f0df7=0x0,_0x30d1c9=_0x35d5ab['length'];_0x2f0df7<_0x30d1c9&&_[_0xb540('0x66')](_0x278fc9[_0xb540('0x61')]);_0x2f0df7++){if(_0x113611[_0xb540('0x67')]<=_0x35d5ab[_0x2f0df7][_0xb540('0x6c')]){_0x278fc9[_0xb540('0x61')]=_0x35d5ab[_0x2f0df7][_0xb540('0x6c')];}else if(_0x113611['min_internal']>_0x35d5ab[_0x2f0df7]['from']&&_0x113611[_0xb540('0x67')]<=_0x35d5ab[_0x2f0df7]['to']){_0x278fc9[_0xb540('0x61')]=_0x113611[_0xb540('0x67')];}}}if(_[_0xb540('0x66')](_0x278fc9[_0xb540('0x61')])){_0x278fc9[_0xb540('0x61')]=_0x12dca1+0x1;}return _0x440be8(_0x278fc9);});});})[_0xb540('0x4f')](function(_0x5acfcc){_0x43b503(_0x5acfcc);});});}function updateUser(_0x3e73f1){return new Promise(function(_0x351b54,_0x21dcf3){try{if(_0x3e73f1[_0xb540('0x6d')]){_0x3e73f1[_0xb540('0x6e')]=_0x3e73f1[_0xb540('0x61')];_0x3e73f1[_0xb540('0x6f')]={'mailbox':_0x3e73f1[_0xb540('0x61')],'password':_0x3e73f1['password'],'fullname':_0x3e73f1[_0xb540('0x70')],'email':_0x3e73f1[_0xb540('0x71')]};}if(_0x3e73f1[_0xb540('0x28')]===_0xb540('0x29')){if(!_0x3e73f1[_0xb540('0x72')])_0x3e73f1[_0xb540('0x72')]=[_0xb540('0x73'),_0xb540('0x74'),_0xb540('0x75'),'113','110',_0xb540('0x76'),_0xb540('0x77'),'106','107',_0xb540('0x78'),_0xb540('0x79'),_0xb540('0x7a'),_0xb540('0x7b'),'114','115'];}_0x351b54(_0x3e73f1);}catch(_0x34f2b5){_0x21dcf3(_0x34f2b5);}});}exports[_0xb540('0x7c')]=function(_0x151e9d,_0x524458){if(_0x151e9d[_0xb540('0x7d')][_0xb540('0x28')]===_0xb540('0x29'))throw new Error(_0xb540('0x7e'));if(_0x151e9d[_0xb540('0x5d')][_0xb540('0x28')]===_0xb540('0x7d')&&_0x151e9d[_0xb540('0x7d')][_0xb540('0x28')]!==_0xb540('0x2d')){throw new Error(_0xb540('0x7f'));}if(_0x151e9d[_0xb540('0x5d')][_0xb540('0x28')]==='admin'&&_0x151e9d[_0xb540('0x7d')][_0xb540('0x28')]!=='admin'){throw new Error(_0xb540('0x80'));}return licenseUtil[_0xb540('0x81')]([_0x151e9d[_0xb540('0x5d')]])[_0xb540('0x15')](function(){return validateUser(_0x151e9d[_0xb540('0x5d')]);})[_0xb540('0x15')](function(_0x24cf50){return updateUser(_0x24cf50)[_0xb540('0x15')](function(_0x1bad25){if(_0x1bad25[_0xb540('0x28')]===_0xb540('0x2d')){_0x1bad25[_0xb540('0x82')]=_0x151e9d[_0xb540('0x7d')]['settingsEnabled'];delete _0x1bad25['userProfileId'];}return _0x1bad25;});})['then'](function(_0x241b7d){return db[_0xb540('0x45')][_0xb540('0x7c')](_0x241b7d,{'include':[{'model':db[_0xb540('0x6f')],'as':_0xb540('0x6f')}]});})['then'](function(_0x59f462){if(_0x151e9d[_0xb540('0x5d')][_0xb540('0x28')]===_0xb540('0x7d'))return _0x59f462;if(_0x151e9d[_0xb540('0x7d')][_0xb540('0x28')]!==_0xb540('0x7d'))return _0x59f462;return db[_0xb540('0x83')][_0xb540('0x59')]({'where':{'name':_0x59f462[_0xb540('0x28')]===_0xb540('0x29')?_0xb540('0x84'):_0xb540('0x85'),'userProfileId':_0x151e9d[_0xb540('0x7d')][_0xb540('0x86')]},'raw':!![]})['then'](function(_0x5f1dea){if(!_0x5f1dea||_0x5f1dea[_0xb540('0x87')]!=0x0)return _0x59f462;return db['UserProfileResource'][_0xb540('0x7c')]({'name':_0x59f462[_0xb540('0x35')],'resourceId':_0x59f462['id'],'type':_0x5f1dea[_0xb540('0x35')],'sectionId':_0x5f1dea['id']},{})[_0xb540('0x15')](function(){return _0x59f462;});})[_0xb540('0x4f')](function(_0x289452){logger[_0xb540('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x289452);throw _0x289452;});})[_0xb540('0x15')](respondWithResult(_0x524458,0xc9))[_0xb540('0x4f')](handleError(_0x524458,null));};exports[_0xb540('0x88')]=function(_0x4af7de,_0x35b1f5){var _0x34e0ef=_0x4af7de[_0xb540('0x5d')];var _0x334357=[];if(_0x4af7de[_0xb540('0x7d')][_0xb540('0x28')]===_0xb540('0x29'))throw new Error(_0xb540('0x7e'));if(_[_0xb540('0x89')](_0x34e0ef,[_0xb540('0x28'),_0xb540('0x7d')])&&_0x4af7de[_0xb540('0x7d')][_0xb540('0x28')]!==_0xb540('0x2d')){throw new Error(_0xb540('0x7f'));}if(_[_0xb540('0x89')](_0x34e0ef,[_0xb540('0x28'),_0xb540('0x2d')])&&_0x4af7de[_0xb540('0x7d')][_0xb540('0x28')]!==_0xb540('0x2d')){throw new Error(_0xb540('0x8a'));}return licenseUtil[_0xb540('0x81')](_0x34e0ef)['then'](function(){return validateUser(_0x34e0ef[0x0]);})[_0xb540('0x15')](function(){for(var _0x3e15f4=0x1;_0x3e15f4<_0x34e0ef[_0xb540('0x48')];_0x3e15f4++){var _0x1995bb=_0x34e0ef[_0x3e15f4-0x1][_0xb540('0x61')];if(!_0x34e0ef[_0x3e15f4]['internal'])_0x34e0ef[_0x3e15f4][_0xb540('0x61')]=_0x1995bb+0x1;_0x334357[_0xb540('0x44')](validateUser(_0x34e0ef[_0x3e15f4]));}return Promise[_0xb540('0x4e')](_0x334357);})['then'](function(){_0x334357=[];for(var _0xad25b7=0x0;_0xad25b7<_0x34e0ef[_0xb540('0x48')];_0xad25b7++){_0x334357[_0xb540('0x44')](updateUser(_0x34e0ef[_0xad25b7]));}return Promise[_0xb540('0x4e')](_0x334357);})['then'](function(){_0x334357=_0x34e0ef[_0xb540('0x32')](function(_0x3b735a){return db[_0xb540('0x45')][_0xb540('0x7c')](_0x3b735a,{'include':[{'model':db[_0xb540('0x6f')],'as':'VoiceMail'}]})['then'](function(_0x2d08cc){_0x3b735a['id']=_0x2d08cc['id'];return _0x3b735a;});});return Promise['all'](_0x334357);})[_0xb540('0x15')](function(_0x352869){if(_0x4af7de[_0xb540('0x5d')][_0xb540('0x28')]===_0xb540('0x7d'))return _0x352869;if(_0x4af7de[_0xb540('0x7d')][_0xb540('0x28')]!==_0xb540('0x7d'))return _0x352869;var _0x42e4e7=_[_0xb540('0x89')](_0x352869,function(_0x412d0f){return _0x412d0f[_0xb540('0x28')]===_0xb540('0x29')||_0x412d0f[_0xb540('0x28')]==='telephone';});if(!_0x42e4e7)return _0x352869;return db[_0xb540('0x83')][_0xb540('0x8b')]({'where':{'name':{'$or':[_0xb540('0x84'),_0xb540('0x85')]},'userProfileId':_0x4af7de[_0xb540('0x7d')]['userProfileId']},'raw':!![]})[_0xb540('0x15')](function(_0x7124cb){if(_[_0xb540('0x8c')](_0x7124cb)||!_[_0xb540('0x89')](_0x7124cb,[_0xb540('0x87'),0x0]))return _0x352869;_0x334357=[];var _0x2e1aef=_(_0x7124cb)['map'](function(_0x3fe025){if(_0x3fe025[_0xb540('0x87')]===0x1)return;return _0x3fe025[_0xb540('0x35')]===_0xb540('0x84')?_0xb540('0x29'):'telephone';})['compact']()['value']();for(var _0x5008f1=0x0;_0x5008f1<_0x352869['length'];_0x5008f1++){if(!_[_0xb540('0x34')](_0x2e1aef,_0x352869[_0x5008f1][_0xb540('0x28')]))return;var _0x4a39dd=_0x352869[_0x5008f1][_0xb540('0x28')]===_0xb540('0x29')?_0xb540('0x84'):_0xb540('0x85');_0x334357[_0xb540('0x44')](db[_0xb540('0x8d')][_0xb540('0x7c')]({'name':_0x352869[_0x5008f1][_0xb540('0x35')],'resourceId':_0x352869[_0x5008f1]['id'],'type':_0x4a39dd,'sectionId':_[_0xb540('0x59')](_0x7124cb,[_0xb540('0x35'),_0x4a39dd])['id']},{}));}return Promise[_0xb540('0x4e')](_0x334357);});})[_0xb540('0x15')](respondWithResult(_0x35b1f5,0xc9))[_0xb540('0x4f')](handleError(_0x35b1f5,null));};exports['changePassword']=function(_0x5154c6,_0x4029a8){if(_0x5154c6[_0xb540('0x5d')]['id']){delete _0x5154c6[_0xb540('0x5d')]['id'];}return db[_0xb540('0x45')][_0xb540('0x59')]({'where':{'id':_0x5154c6[_0xb540('0x51')]['id']}})[_0xb540('0x15')](function(_0x2f1aba){if(!_0x2f1aba)return null;if(_0x2f1aba['id']===_0x5154c6[_0xb540('0x7d')]['id']){if(!_0x5154c6[_0xb540('0x5d')][_0xb540('0x8e')]||!_0x5154c6['body']['newPassword']){throw new db['Sequelize'][(_0xb540('0x8f'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2f1aba[_0xb540('0x90')](_0x5154c6[_0xb540('0x5d')][_0xb540('0x8e')])){throw new db[(_0xb540('0x91'))]['ValidationError'](_0xb540('0x92'));}if(_0x5154c6[_0xb540('0x5d')][_0xb540('0x8e')]===_0x5154c6['body'][_0xb540('0x93')]){throw new db['Sequelize'][(_0xb540('0x8f'))](_0xb540('0x94'));}}else if(_0x5154c6[_0xb540('0x7d')]['role']==='admin'){if(!_0x5154c6[_0xb540('0x5d')]['newPassword']){throw new db[(_0xb540('0x91'))]['ValidationError'](_0xb540('0x95'));}}else if(_0x5154c6[_0xb540('0x7d')]['role']===_0xb540('0x7d')){if(!_0x5154c6['body'][_0xb540('0x93')]){throw new db[(_0xb540('0x91'))][(_0xb540('0x8f'))](_0xb540('0x95'));}if(_0x2f1aba[_0xb540('0x28')]!==_0xb540('0x29')){throw new db['Sequelize'][(_0xb540('0x8f'))](_0xb540('0x7e'));}}else{throw new db[(_0xb540('0x91'))][(_0xb540('0x8f'))](_0xb540('0x7e'));}return _0x2f1aba;})[_0xb540('0x15')](handleEntityNotFound(_0x4029a8,null))[_0xb540('0x15')](function(_0x3652ca){return db['Setting'][_0xb540('0x96')]({'attributes':['id',_0xb540('0x97'),'enforcePasswordHistory',_0xb540('0x98')]})[_0xb540('0x15')](function(_0x4408c7){if(_0x4408c7[_0xb540('0x97')])authService[_0xb540('0x64')](_0x5154c6[_0xb540('0x5d')][_0xb540('0x93')]);if(!_0x4408c7['enforcePasswordHistory']||!_0x3652ca[_0xb540('0x99')])return _0x3652ca;authService['validatePasswordHistory'](_0x5154c6[_0xb540('0x5d')]['newPassword'],_0x3652ca[_0xb540('0x99')],_0x4408c7[_0xb540('0x98')]);return _0x3652ca;})[_0xb540('0x15')](saveUpdates({'password':_0x5154c6[_0xb540('0x5d')]['newPassword'],'passwordResetAt':_0x5154c6[_0xb540('0x7d')]['id']==_0x5154c6['params']['id']?moment():null,'previousPasswords':authService[_0xb540('0x9a')](_0x5154c6[_0xb540('0x5d')][_0xb540('0x93')],_0x3652ca[_0xb540('0x99')])},null));})['then'](respondWithResult(_0x4029a8,null))[_0xb540('0x4f')](handleError(_0x4029a8,null));};exports[_0xb540('0x9b')]=function(_0x25f1fd,_0x4bf483){var _0x4c6cb7=_0x25f1fd[_0xb540('0x5d')][_0xb540('0x9c')];return db['User'][_0xb540('0x59')]({'where':{'id':_0x25f1fd[_0xb540('0x51')]['id']},'attributes':['id',_0xb540('0x35'),_0xb540('0x28'),_0xb540('0x9d'),'loginInPause',_0xb540('0x9e'),'interface']})[_0xb540('0x15')](handleEntityNotFound(_0x4bf483,null))['then'](function(_0x5375d0){if(_0x5375d0){if(!utils[_0xb540('0x9f')](_0x4c6cb7)){throw new db['Sequelize'][(_0xb540('0x8f'))](_0xb540('0xa0'));}return _0x5375d0[_0xb540('0xa1')+_['capitalize'](_0x4c6cb7[_0xb540('0xa2')]())+_0xb540('0xa3')](_0x25f1fd[_0xb540('0x5d')][_0xb540('0x60')],{'penalty':_0x25f1fd[_0xb540('0x5d')][_0xb540('0xa4')]||0x0})['spread'](function(_0x5e881f){for(var _0x297937=0x0;_0x297937<_0x25f1fd[_0xb540('0x5d')][_0xb540('0x60')][_0xb540('0x48')];_0x297937+=0x1){var _0x5a1cb0={'UserId':Number(_0x25f1fd[_0xb540('0x51')]['id'])};_0x5a1cb0[_[_0xb540('0xa5')](_0x4c6cb7[_0xb540('0xa2')]())+'QueueId']=Number(_0x25f1fd['body'][_0xb540('0x60')][_0x297937]);socket[_0xb540('0x2a')](_0xb540('0x7d')+_[_0xb540('0xa5')](_0x4c6cb7[_0xb540('0xa2')]())+_0xb540('0xa6'),_0x5a1cb0);}return _0x5e881f;})['then'](function(){if(_0x4c6cb7==='voice'){return db[_0xb540('0xa7')][_0xb540('0x8b')]({'where':{'id':_0x25f1fd[_0xb540('0x5d')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x31a4da){var _0x3b6811=_0x5375d0[_0xb540('0xa8')]({'plain':!![]});var _0x411f59=[];if(_0x4c6cb7===_0xb540('0xa9')&&_0x3b6811[_0xb540('0x28')]==='agent'&&_0x3b6811[_0xb540('0x9d')]){for(let _0x396f98=0x0;_0x396f98<_0x31a4da[_0xb540('0x48')];_0x396f98+=0x1){_0x411f59[_0xb540('0x44')]({'membername':_0x3b6811['name'],'UserId':_0x3b6811['id'],'queue_name':_0x31a4da[_0x396f98][_0xb540('0x35')],'VoiceQueueId':_0x31a4da[_0x396f98]['id'],'interface':_['isNil'](_0x3b6811['interface'])?util['format'](_0xb540('0xaa'),_0x3b6811[_0xb540('0x35')]):_0x3b6811['interface'],'paused':_0x3b6811[_0xb540('0x9e')]||![],'penalty':_0x25f1fd[_0xb540('0x5d')][_0xb540('0xa4')]||0x0});}return Promise['all'](_0x411f59[_0xb540('0x32')](function(_0x1a70e1){return db[_0xb540('0xab')][_0xb540('0xac')](_0x1a70e1);}));}return _0x5375d0;});}})[_0xb540('0x15')](respondWithStatusCode(_0x4bf483,null))[_0xb540('0x4f')](handleError(_0x4bf483,null));};exports[_0xb540('0xad')]=function(_0x1bdd42,_0x36334c){var _0x3b592c,_0x37c434;return db[_0xb540('0x45')][_0xb540('0x59')]({'where':{'id':_0x1bdd42[_0xb540('0x51')]['id']},'attributes':['id',_0xb540('0x35'),_0xb540('0x28')]})[_0xb540('0x15')](handleEntityNotFound(_0x36334c,null))['then'](function(_0x35569d){if(_0x35569d){_0x3b592c=_0x35569d;if(!_0x1bdd42[_0xb540('0x3f')][_0xb540('0x9c')]||!utils[_0xb540('0x9f')](_0x1bdd42[_0xb540('0x3f')]['channel'])){throw new db['Sequelize'][(_0xb540('0x8f'))](_0xb540('0xa0'));}return _0x35569d[_0xb540('0xae')+_[_0xb540('0xa5')](_0x1bdd42[_0xb540('0x3f')][_0xb540('0x9c')][_0xb540('0xa2')]())+_0xb540('0xa3')](_0x1bdd42[_0xb540('0x3f')][_0xb540('0x60')]);}})['then'](function(_0x106a82){if(_[_0xb540('0xaf')](_0x1bdd42[_0xb540('0x3f')][_0xb540('0x60')])){for(var _0x45b8cd=0x0;_0x45b8cd<_0x1bdd42['query'][_0xb540('0x60')][_0xb540('0x48')];_0x45b8cd+=0x1){_0x37c434={'UserId':Number(_0x1bdd42[_0xb540('0x51')]['id'])};_0x37c434[_[_0xb540('0xa5')](_0x1bdd42[_0xb540('0x3f')][_0xb540('0x9c')][_0xb540('0xa2')]())+_0xb540('0xb0')]=Number(_0x1bdd42[_0xb540('0x3f')][_0xb540('0x60')][_0x45b8cd]);socket[_0xb540('0x2a')](_0xb540('0x7d')+_[_0xb540('0xa5')](_0x1bdd42[_0xb540('0x3f')][_0xb540('0x9c')][_0xb540('0xa2')]())+'Queue:remove',_0x37c434);}}else{_0x37c434={'UserId':Number(_0x1bdd42[_0xb540('0x51')]['id'])};_0x37c434[_[_0xb540('0xa5')](_0x1bdd42[_0xb540('0x3f')]['channel'][_0xb540('0xa2')]())+_0xb540('0xb0')]=Number(_0x1bdd42[_0xb540('0x3f')][_0xb540('0x60')]);socket['emit'](_0xb540('0x7d')+_['capitalize'](_0x1bdd42['query'][_0xb540('0x9c')][_0xb540('0xa2')]())+_0xb540('0xb1'),_0x37c434);}return _0x106a82;})[_0xb540('0x15')](function(){if(_0x1bdd42[_0xb540('0x3f')][_0xb540('0x9c')]==='voice'){return db['UserVoiceQueueRt'][_0xb540('0x2c')]({'where':{'UserId':_0x1bdd42[_0xb540('0x51')]['id'],'VoiceQueueId':_0x1bdd42[_0xb540('0x3f')]['ids']},'individualHooks':!![]})['then'](function(){return _0x3b592c;});}return _0x3b592c;})[_0xb540('0x15')](respondWithStatusCode(_0x36334c,null))[_0xb540('0x4f')](handleError(_0x36334c,null));};exports[_0xb540('0xb2')]=function(_0x13c77f,_0x26b6e5){_0x13c77f['body']['userpic']=_0x13c77f[_0xb540('0xb3')]['filename'];return db[_0xb540('0x45')][_0xb540('0x59')]({'where':{'id':_0x13c77f[_0xb540('0x51')]['id']}})[_0xb540('0x15')](handleEntityNotFound(_0x26b6e5,null))[_0xb540('0x15')](saveUpdates(_0x13c77f['body'],null))[_0xb540('0x15')](respondWithResult(_0x26b6e5,null))[_0xb540('0x4f')](handleError(_0x26b6e5,null));};exports['getAvatar']=function(_0x57cd52,_0xebe4b6){var _0x4c3953=path[_0xb540('0xb4')](config[_0xb540('0xb5')],'server/files/images/logos/default_profile.png');return db[_0xb540('0x45')][_0xb540('0x59')]({'where':{'id':_0x57cd52[_0xb540('0x51')]['id']},'attributes':['id',_0xb540('0xb6')],'raw':!![]})['then'](handleEntityNotFound(_0xebe4b6,null))[_0xb540('0x15')](function(_0x6d09af){if(_0x6d09af){if(_[_0xb540('0x66')](_0x6d09af[_0xb540('0xb6')])){return _0xebe4b6[_0xb540('0xb7')](_0x4c3953);}else{if(!fs[_0xb540('0xb8')](path[_0xb540('0xb4')](config[_0xb540('0xb5')],_0xb540('0xb9'),_0x6d09af[_0xb540('0xb6')]))){return _0xebe4b6['download'](_0x4c3953);}return _0xebe4b6['download'](path[_0xb540('0xb4')](config[_0xb540('0xb5')],_0xb540('0xb9'),_0x6d09af['userpic']));}}})['catch'](handleError(_0xebe4b6,null));};exports[_0xb540('0xba')]=function(_0x58f8e4,_0x1669be){return db['User'][_0xb540('0x59')]({'where':{'id':_0x58f8e4[_0xb540('0x51')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1669be,null))[_0xb540('0x15')](function(_0x372b3f){var _0x339469=[];values=_0x372b3f[_0xb540('0x4a')];_0x339469['push'](get_open_tabs(_0xb540('0x49'),_0x372b3f[_0xb540('0x4a')]));_0x339469[_0xb540('0x44')](get_open_tabs(_0xb540('0x5b'),_0x372b3f[_0xb540('0x4a')]));_0x339469['push'](get_open_tabs(_0xb540('0x4d'),_0x372b3f['dataValues']));_0x339469[_0xb540('0x44')](get_open_tabs(_0xb540('0x5c'),_0x372b3f['dataValues']));_0x339469[_0xb540('0x44')](get_open_tabs('fax',_0x372b3f[_0xb540('0x4a')]));_0x339469[_0xb540('0x44')](get_open_tabs(_0xb540('0x4c'),_0x372b3f[_0xb540('0x4a')]));return Promise[_0xb540('0x4e')](_0x339469);})[_0xb540('0x15')](function(_0x3fe2f1){if(_0x3fe2f1){var _0x1dbf1e=_['map'](values[_0xb540('0xbb')],function(_0x24a56e){return{'channel':'CHAT','id':_0x24a56e['id'],'createdAt':_0x24a56e['createdAt']};});var _0x320865=_['map'](values[_0xb540('0xbc')],function(_0x10b894){return{'channel':_0xb540('0xbd'),'id':_0x10b894['id'],'createdAt':_0x10b894[_0xb540('0xbe')]};});var _0x1afc3a=_[_0xb540('0x32')](values[_0xb540('0xbf')],function(_0x2d5516){return{'channel':_0xb540('0xc0'),'id':_0x2d5516['id'],'createdAt':_0x2d5516[_0xb540('0xbe')]};});var _0x26b97d=_[_0xb540('0x32')](values[_0xb540('0xc1')],function(_0x45203c){return{'channel':_0xb540('0xc2'),'id':_0x45203c['id'],'createdAt':_0x45203c[_0xb540('0xbe')]};});var _0x26a774=_[_0xb540('0x32')](values[_0xb540('0xc3')],function(_0x30e207){return{'channel':_0xb540('0xc4'),'id':_0x30e207['id'],'createdAt':_0x30e207[_0xb540('0xbe')]};});var _0x37bdb3=_[_0xb540('0x32')](values['WhatsappOpenTabs'],function(_0x40b413){return{'channel':_0xb540('0xc5'),'id':_0x40b413['id'],'createdAt':_0x40b413[_0xb540('0xbe')]};});var _0xd2125a=_[_0xb540('0xc6')](_0x1dbf1e,_0x320865,_0x1afc3a,_0x26b97d,_0x26a774,_0x37bdb3);var _0x5ebc3e={'count':_0xd2125a['length'],'rows':_0xd2125a};return _0x5ebc3e;}else return null;})[_0xb540('0x15')](respondWithResult(_0x1669be,null))[_0xb540('0x4f')](handleError(_0x1669be,null));};exports['getContacts']=function(_0x267668,_0x55981c){var _0x1fcc46={};return db[_0xb540('0x45')]['findOne']({'where':{'id':_0x267668[_0xb540('0x51')]['id']}})[_0xb540('0x15')](function(_0x1e8cc7){if(!_0x1e8cc7){throw new APINotFoundError(util['format'](_0xb540('0xc7'),_0x267668[_0xb540('0x51')]['id']));}return contacts['describe']();})[_0xb540('0x15')](function(_0x7a91f3){_0x267668['query']['User']=_0x267668['params']['id'];_0x1fcc46=qs[_0xb540('0xc8')](_0x7a91f3,_0x267668);if(_0x267668['query'][_0xb540('0xc9')](_0xb540('0x40'))){_0x1fcc46[_0xb540('0x42')]=[{'model':db[_0xb540('0xca')],'as':_0xb540('0xcb'),'required':![]},{'model':db[_0xb540('0xcc')],'as':_0xb540('0xcd'),'attributes':['id','name','color'],'where':_0x267668[_0xb540('0x3f')][_0xb540('0xce')]?{'id':_0x267668['query'][_0xb540('0xce')]}:undefined,'required':_0x267668['query'][_0xb540('0xce')]?!![]:![]}];}return contacts[_0xb540('0x8b')](_0x267668[_0xb540('0x3f')],_0x267668[_0xb540('0x7d')],_0x1fcc46,_0x7a91f3);})[_0xb540('0x15')](respondWithFilteredResult(_0x55981c,_0x1fcc46))[_0xb540('0x4f')](APIHandleError(_0x55981c));};exports[_0xb540('0xcf')]=function(_0x26cce6,_0x5e2118){var _0x3e990a;var _0x4ed883={};var _0x5dcf7f;return db['User']['findOne']({'where':{'id':_0x26cce6[_0xb540('0x51')]['id']},'attributes':['id',_0xb540('0x35'),_0xb540('0x28')]})[_0xb540('0x15')](handleEntityNotFound(_0x5e2118,null))[_0xb540('0x15')](function(_0x54ff7a){if(!utils[_0xb540('0x9f')](_0x26cce6[_0xb540('0x3f')][_0xb540('0x9c')])){throw new db[(_0xb540('0x91'))][(_0xb540('0x8f'))]('Unknown\x20channel');}_0x3e990a=_0x54ff7a;var _0x59e87a={};_0x59e87a[_0xb540('0x52')]=_[_0xb540('0x53')](db[_['capitalize'](_0x26cce6[_0xb540('0x3f')]['channel'])+'Queue']['rawAttributes']);_0x59e87a[_0xb540('0x3f')]=_[_0xb540('0x53')](_0x26cce6['query']);_0x59e87a[_0xb540('0x54')]=_[_0xb540('0x55')](_0x59e87a[_0xb540('0x52')],_0x59e87a[_0xb540('0x3f')]);_0x4ed883[_0xb540('0x43')]=_[_0xb540('0x55')](_0x59e87a['model'],qs['fields'](_0x26cce6['query'][_0xb540('0x56')]));_0x4ed883['attributes']=_0x4ed883[_0xb540('0x43')][_0xb540('0x48')]?_0x4ed883[_0xb540('0x43')]:_0x59e87a[_0xb540('0x52')];_0x4ed883[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0x26cce6[_0xb540('0x3f')][_0xb540('0xd1')]);_0x4ed883[_0xb540('0xd2')]=qs[_0xb540('0x54')](_[_0xb540('0xd3')](_0x26cce6[_0xb540('0x3f')],_0x59e87a[_0xb540('0x54')]));if(_0x26cce6[_0xb540('0x3f')]['filter']){_0x4ed883[_0xb540('0xd2')]=_[_0xb540('0x58')](_0x4ed883[_0xb540('0xd2')],{'$or':_['map'](_0x4ed883[_0xb540('0x43')],function(_0x44e4fb){var _0x1a321e={};_0x1a321e[_0x44e4fb]={'$like':'%'+_0x26cce6['query'][_0xb540('0x30')]+'%'};return _0x1a321e;})});}_0x4ed883=_[_0xb540('0x58')]({},_0x4ed883,_0x26cce6[_0xb540('0xd4')]);switch(_0x3e990a['role']){case _0xb540('0x2d'):return db[_[_0xb540('0xa5')](_0x26cce6[_0xb540('0x3f')][_0xb540('0x9c')])+_0xb540('0xd5')]['findAll'](_0x4ed883);case _0xb540('0x7d'):case _0xb540('0x29'):return _0x3e990a[_0xb540('0xa8')+_[_0xb540('0xa5')](_0x26cce6[_0xb540('0x3f')]['channel'])+_0xb540('0xa3')](_0x4ed883);default:throw new db[(_0xb540('0x91'))]['ValidationError'](_0xb540('0xd6'));}})['then'](function(_0x52af07){_0x5dcf7f=_0x52af07['length'];if(!_0x26cce6[_0xb540('0x3f')][_0xb540('0xc9')](_0xb540('0xd7'))){_0x4ed883[_0xb540('0x24')]=qs['limit'](_0x26cce6[_0xb540('0x3f')][_0xb540('0x24')]);_0x4ed883[_0xb540('0x22')]=qs[_0xb540('0x22')](_0x26cce6[_0xb540('0x3f')][_0xb540('0x22')]);}switch(_0x3e990a['role']){case _0xb540('0x2d'):return db[_[_0xb540('0xa5')](_0x26cce6[_0xb540('0x3f')][_0xb540('0x9c')])+_0xb540('0xd5')]['findAll'](_0x4ed883);case _0xb540('0x7d'):case _0xb540('0x29'):return _0x3e990a[_0xb540('0xa8')+_[_0xb540('0xa5')](_0x26cce6[_0xb540('0x3f')][_0xb540('0x9c')])+_0xb540('0xa3')](_0x4ed883);}})[_0xb540('0x15')](function(_0xebdfeb){return{'count':_0x5dcf7f,'rows':_0xebdfeb};})[_0xb540('0x15')](respondWithResult(_0x5e2118,null))[_0xb540('0x4f')](handleError(_0x5e2118,null));};exports[_0xb540('0xd8')]=function(_0xd66d57,_0x468571){var _0x11e673={};var _0x2b8e2e={};var _0x5bfcf4;var _0x2710e3;return db[_0xb540('0x45')][_0xb540('0x96')]({'where':{'id':_0xd66d57['params']['id']}})['then'](handleEntityNotFound(_0x468571,null))[_0xb540('0x15')](function(_0x1558c0){if(_0x1558c0){_0x5bfcf4=_0x1558c0;_0x2b8e2e['model']=_[_0xb540('0x53')](db[_0xb540('0xab')][_0xb540('0x39')]);_0x2b8e2e['query']=_['keys'](_0xd66d57['query']);_0x2b8e2e[_0xb540('0x54')]=_['intersection'](_0x2b8e2e[_0xb540('0x52')],_0x2b8e2e[_0xb540('0x3f')]);_0x11e673[_0xb540('0x43')]=_[_0xb540('0x55')](_0x2b8e2e['model'],qs['fields'](_0xd66d57['query'][_0xb540('0x56')]));_0x11e673[_0xb540('0x43')]=_0x11e673[_0xb540('0x43')]['length']?_0x11e673['attributes']:_0x2b8e2e[_0xb540('0x52')];_0x11e673[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0xd66d57['query']['sort']);_0x11e673[_0xb540('0xd2')]=qs['filters'](_[_0xb540('0xd3')](_0xd66d57['query'],_0x2b8e2e[_0xb540('0x54')]));if(_0xd66d57[_0xb540('0x3f')][_0xb540('0x30')]){_0x11e673[_0xb540('0xd2')]=_[_0xb540('0x58')](_0x11e673[_0xb540('0xd2')],{'$or':_[_0xb540('0x32')](_0x11e673[_0xb540('0x43')],function(_0x2df8f7){var _0x816bac={};_0x816bac[_0x2df8f7]={'$like':'%'+_0xd66d57['query'][_0xb540('0x30')]+'%'};return _0x816bac;})});}_0x11e673=_['merge']({},_0x11e673,_0xd66d57[_0xb540('0xd4')]);return _0x5bfcf4[_0xb540('0xd8')](_0x11e673);}})['then'](function(_0x342268){if(_0x342268){_0x2710e3=_0x342268[_0xb540('0x48')];if(!_0xd66d57[_0xb540('0x3f')]['hasOwnProperty']('nolimit')){_0x11e673[_0xb540('0x24')]=qs[_0xb540('0x24')](_0xd66d57[_0xb540('0x3f')][_0xb540('0x24')]);_0x11e673[_0xb540('0x22')]=qs[_0xb540('0x22')](_0xd66d57[_0xb540('0x3f')]['offset']);}return _0x5bfcf4['getVoiceQueuesRt'](_0x11e673);}})[_0xb540('0x15')](function(_0x492e32){if(_0x492e32){return _0x492e32?{'count':_0x2710e3,'rows':_0x492e32}:null;}})[_0xb540('0x15')](respondWithResult(_0x468571,null))[_0xb540('0x4f')](handleError(_0x468571,null));};exports[_0xb540('0xd9')]=function(_0x114906,_0x2823aa){var _0x1f99ff={};var _0xfbedaf={};var _0x158be8;var _0x5b62d4;return db[_0xb540('0x45')][_0xb540('0x96')]({'where':{'id':_0x114906[_0xb540('0x51')]['id']}})[_0xb540('0x15')](handleEntityNotFound(_0x2823aa,null))['then'](function(_0xf24f7){if(_0xf24f7){_0x158be8=_0xf24f7;_0xfbedaf['model']=_[_0xb540('0x53')](db['ChatGroup']['rawAttributes']);_0xfbedaf[_0xb540('0x3f')]=_[_0xb540('0x53')](_0x114906['query']);_0xfbedaf[_0xb540('0x54')]=_[_0xb540('0x55')](_0xfbedaf['model'],_0xfbedaf[_0xb540('0x3f')]);_0x1f99ff['attributes']=_['intersection'](_0xfbedaf[_0xb540('0x52')],qs['fields'](_0x114906['query'][_0xb540('0x56')]));_0x1f99ff[_0xb540('0x43')]=_0x1f99ff[_0xb540('0x43')][_0xb540('0x48')]?_0x1f99ff[_0xb540('0x43')]:_0xfbedaf['model'];_0x1f99ff[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0x114906[_0xb540('0x3f')][_0xb540('0xd1')]);_0x1f99ff[_0xb540('0xd2')]=qs[_0xb540('0x54')](_['pick'](_0x114906[_0xb540('0x3f')],_0xfbedaf[_0xb540('0x54')]));if(_0x114906[_0xb540('0x3f')]['filter']){_0x1f99ff[_0xb540('0xd2')]=_[_0xb540('0x58')](_0x1f99ff[_0xb540('0xd2')],{'$or':_[_0xb540('0x32')](_0x1f99ff[_0xb540('0x43')],function(_0x3e0eb8){var _0x1bccd4={};_0x1bccd4[_0x3e0eb8]={'$like':'%'+_0x114906['query']['filter']+'%'};return _0x1bccd4;})});}_0x1f99ff=_[_0xb540('0x58')]({},_0x1f99ff,_0x114906[_0xb540('0xd4')]);return _0x158be8[_0xb540('0xd9')](_0x1f99ff);}})['then'](function(_0xb25d79){if(_0xb25d79){_0x5b62d4=_0xb25d79['length'];if(!_0x114906['query'][_0xb540('0xc9')](_0xb540('0xd7'))){_0x1f99ff[_0xb540('0x24')]=qs[_0xb540('0x24')](_0x114906[_0xb540('0x3f')][_0xb540('0x24')]);_0x1f99ff[_0xb540('0x22')]=qs[_0xb540('0x22')](_0x114906[_0xb540('0x3f')][_0xb540('0x22')]);}return _0x158be8[_0xb540('0xd9')](_0x1f99ff);}})[_0xb540('0x15')](function(_0x386bf3){if(_0x386bf3){return _0x386bf3?{'count':_0x5b62d4,'rows':_0x386bf3}:null;}})[_0xb540('0x15')](respondWithResult(_0x2823aa,null))[_0xb540('0x4f')](handleError(_0x2823aa,null));};exports[_0xb540('0xda')]=function(_0x51c831,_0x5ca92a){var _0x28b15e={'raw':!![],'where':{}};var _0x574ec1={};var _0x1eb5ab={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x51c831[_0xb540('0x51')]['id']}})['then'](handleEntityNotFound(_0x5ca92a,null))[_0xb540('0x15')](function(_0x6cd68){if(_0x6cd68){_0x574ec1[_0xb540('0x52')]=_[_0xb540('0x53')](db[_0xb540('0xdb')][_0xb540('0x39')]);_0x574ec1['query']=_[_0xb540('0x53')](_0x51c831['query']);_0x574ec1[_0xb540('0x54')]=_[_0xb540('0x55')](_0x574ec1[_0xb540('0x52')],_0x574ec1['query']);_0x28b15e['attributes']=_['intersection'](_0x574ec1[_0xb540('0x52')],qs[_0xb540('0x56')](_0x51c831['query'][_0xb540('0x56')]));_0x28b15e[_0xb540('0x43')]=_0x28b15e[_0xb540('0x43')][_0xb540('0x48')]?_0x28b15e['attributes']:_0x574ec1[_0xb540('0x52')];if(!_0x51c831[_0xb540('0x3f')][_0xb540('0xc9')]('nolimit')){_0x28b15e[_0xb540('0x24')]=qs[_0xb540('0x24')](_0x51c831['query'][_0xb540('0x24')]);_0x28b15e[_0xb540('0x22')]=qs[_0xb540('0x22')](_0x51c831[_0xb540('0x3f')][_0xb540('0x22')]);}_0x28b15e[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0x51c831[_0xb540('0x3f')][_0xb540('0xd1')]);_0x28b15e[_0xb540('0xd2')]=qs[_0xb540('0x54')](_[_0xb540('0xd3')](_0x51c831[_0xb540('0x3f')],_0x574ec1['filters']));_0x28b15e[_0xb540('0xd2')][_0xb540('0xdc')]=_0x6cd68['id'];if(_0x51c831[_0xb540('0x3f')]['filter']){_0x28b15e[_0xb540('0xd2')]=_[_0xb540('0x58')](_0x28b15e[_0xb540('0xd2')],{'$or':_[_0xb540('0x32')](_0x28b15e[_0xb540('0x43')],function(_0x265dcc){var _0x151565={};_0x151565[_0x265dcc]={'$like':'%'+_0x51c831[_0xb540('0x3f')][_0xb540('0x30')]+'%'};return _0x151565;})});}_0x28b15e=_[_0xb540('0x58')]({},_0x28b15e,_0x51c831[_0xb540('0xd4')]);return db[_0xb540('0xdb')][_0xb540('0x25')]({'where':_0x28b15e[_0xb540('0xd2')]})['then'](function(_0x5b2710){_0x1eb5ab[_0xb540('0x25')]=_0x5b2710;if(_0x51c831[_0xb540('0x3f')][_0xb540('0x40')]){_0x28b15e[_0xb540('0x42')]=[{'all':!![]}];}return db[_0xb540('0xdb')][_0xb540('0x8b')](_0x28b15e);})['then'](function(_0x367902){_0x1eb5ab[_0xb540('0x47')]=_0x367902;return _0x1eb5ab;});}})['then'](respondWithFilteredResult(_0x5ca92a,_0x28b15e))['catch'](handleError(_0x5ca92a,null));};exports[_0xb540('0xdd')]=function(_0x3dd033,_0x31fa82){var _0x283991={'raw':!![],'where':{}};var _0x51cc6a={};var _0x468cf7={'count':0x0,'rows':[]};return db[_0xb540('0x45')]['findOne']({'where':{'id':_0x3dd033[_0xb540('0x51')]['id']}})[_0xb540('0x15')](handleEntityNotFound(_0x31fa82,null))[_0xb540('0x15')](function(_0x3914cd){if(_0x3914cd){_0x51cc6a[_0xb540('0x52')]=_['keys'](db[_0xb540('0xde')]['rawAttributes']);_0x51cc6a[_0xb540('0x3f')]=_[_0xb540('0x53')](_0x3dd033['query']);_0x51cc6a['filters']=_[_0xb540('0x55')](_0x51cc6a[_0xb540('0x52')],_0x51cc6a[_0xb540('0x3f')]);_0x283991['attributes']=_['intersection'](_0x51cc6a[_0xb540('0x52')],qs[_0xb540('0x56')](_0x3dd033[_0xb540('0x3f')]['fields']));_0x283991[_0xb540('0x43')]=_0x283991['attributes'][_0xb540('0x48')]?_0x283991[_0xb540('0x43')]:_0x51cc6a[_0xb540('0x52')];if(!_0x3dd033[_0xb540('0x3f')][_0xb540('0xc9')](_0xb540('0xd7'))){_0x283991[_0xb540('0x24')]=qs['limit'](_0x3dd033[_0xb540('0x3f')][_0xb540('0x24')]);_0x283991[_0xb540('0x22')]=qs[_0xb540('0x22')](_0x3dd033[_0xb540('0x3f')][_0xb540('0x22')]);}_0x283991[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0x3dd033['query'][_0xb540('0xd1')]);_0x283991['where']=qs[_0xb540('0x54')](_[_0xb540('0xd3')](_0x3dd033['query'],_0x51cc6a['filters']));_0x283991[_0xb540('0xd2')]['UserId']=_0x3914cd['id'];if(_0x3dd033['query'][_0xb540('0x30')]){_0x283991[_0xb540('0xd2')]=_[_0xb540('0x58')](_0x283991[_0xb540('0xd2')],{'$or':_[_0xb540('0x32')](_0x283991[_0xb540('0x43')],function(_0x41af94){var _0x22eb29={};_0x22eb29[_0x41af94]={'$like':'%'+_0x3dd033[_0xb540('0x3f')][_0xb540('0x30')]+'%'};return _0x22eb29;})});}_0x283991=_[_0xb540('0x58')]({},_0x283991,_0x3dd033['options']);return db[_0xb540('0xde')][_0xb540('0x25')]({'where':_0x283991[_0xb540('0xd2')]})['then'](function(_0x4a1d86){_0x468cf7['count']=_0x4a1d86;if(_0x3dd033['query']['includeAll']){_0x283991['include']=[{'all':!![]}];}return db[_0xb540('0xde')][_0xb540('0x8b')](_0x283991);})['then'](function(_0x49bb7e){_0x468cf7[_0xb540('0x47')]=_0x49bb7e;return _0x468cf7;});}})[_0xb540('0x15')](respondWithFilteredResult(_0x31fa82,_0x283991))[_0xb540('0x4f')](handleError(_0x31fa82,null));};exports[_0xb540('0xdf')]=function(_0x2a2056,_0x10a3d6){var _0x23b0b4={};var _0x41e19c={};var _0x1011b5;var _0x4bab3d;return db[_0xb540('0x45')]['findOne']({'where':{'id':_0x2a2056[_0xb540('0x51')]['id']}})[_0xb540('0x15')](handleEntityNotFound(_0x10a3d6,null))['then'](function(_0x53b07b){if(_0x53b07b){_0x1011b5=_0x53b07b;_0x41e19c['model']=_[_0xb540('0x53')](db[_0xb540('0xe0')][_0xb540('0x39')]);_0x41e19c[_0xb540('0x3f')]=_['keys'](_0x2a2056[_0xb540('0x3f')]);_0x41e19c['filters']=_[_0xb540('0x55')](_0x41e19c[_0xb540('0x52')],_0x41e19c['query']);_0x23b0b4[_0xb540('0x43')]=_[_0xb540('0x55')](_0x41e19c[_0xb540('0x52')],qs[_0xb540('0x56')](_0x2a2056[_0xb540('0x3f')]['fields']));_0x23b0b4[_0xb540('0x43')]=_0x23b0b4['attributes'][_0xb540('0x48')]?_0x23b0b4[_0xb540('0x43')]:_0x41e19c[_0xb540('0x52')];_0x23b0b4[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0x2a2056[_0xb540('0x3f')][_0xb540('0xd1')]);_0x23b0b4['where']=qs[_0xb540('0x54')](_['pick'](_0x2a2056['query'],_0x41e19c[_0xb540('0x54')]));if(_0x2a2056[_0xb540('0x3f')][_0xb540('0x30')]){_0x23b0b4[_0xb540('0xd2')]=_['merge'](_0x23b0b4[_0xb540('0xd2')],{'$or':_['map'](_0x23b0b4[_0xb540('0x43')],function(_0x3eec87){var _0x23dd24={};_0x23dd24[_0x3eec87]={'$like':'%'+_0x2a2056[_0xb540('0x3f')][_0xb540('0x30')]+'%'};return _0x23dd24;})});}_0x23b0b4=_['merge']({},_0x23b0b4,_0x2a2056[_0xb540('0xd4')]);return _0x1011b5['getChatInteractions'](_0x23b0b4);}})[_0xb540('0x15')](function(_0x237994){if(_0x237994){_0x4bab3d=_0x237994[_0xb540('0x48')];if(!_0x2a2056[_0xb540('0x3f')][_0xb540('0xc9')](_0xb540('0xd7'))){_0x23b0b4[_0xb540('0x24')]=qs['limit'](_0x2a2056[_0xb540('0x3f')][_0xb540('0x24')]);_0x23b0b4[_0xb540('0x22')]=qs[_0xb540('0x22')](_0x2a2056['query'][_0xb540('0x22')]);}return _0x1011b5['getChatInteractions'](_0x23b0b4);}})[_0xb540('0x15')](function(_0x547440){if(_0x547440){return _0x547440?{'count':_0x4bab3d,'rows':_0x547440}:null;}})[_0xb540('0x15')](respondWithResult(_0x10a3d6,null))[_0xb540('0x4f')](handleError(_0x10a3d6,null));};exports[_0xb540('0xe1')]=function(_0x2221bb,_0x592681){var _0x399544={};var _0x2fe41b={};var _0x4fad7b;var _0x4e8900;return db[_0xb540('0x45')][_0xb540('0x96')]({'where':{'id':_0x2221bb['params']['id']}})['then'](handleEntityNotFound(_0x592681,null))['then'](function(_0xcc1a2c){if(_0xcc1a2c){_0x4fad7b=_0xcc1a2c;_0x2fe41b[_0xb540('0x52')]=_[_0xb540('0x53')](db[_0xb540('0xe2')][_0xb540('0x39')]);_0x2fe41b[_0xb540('0x3f')]=_[_0xb540('0x53')](_0x2221bb[_0xb540('0x3f')]);_0x2fe41b[_0xb540('0x54')]=_[_0xb540('0x55')](_0x2fe41b[_0xb540('0x52')],_0x2fe41b[_0xb540('0x3f')]);_0x399544[_0xb540('0x43')]=_[_0xb540('0x55')](_0x2fe41b['model'],qs[_0xb540('0x56')](_0x2221bb[_0xb540('0x3f')][_0xb540('0x56')]));_0x399544[_0xb540('0x43')]=_0x399544[_0xb540('0x43')][_0xb540('0x48')]?_0x399544[_0xb540('0x43')]:_0x2fe41b[_0xb540('0x52')];_0x399544[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0x2221bb[_0xb540('0x3f')]['sort']);_0x399544[_0xb540('0xd2')]=qs['filters'](_[_0xb540('0xd3')](_0x2221bb[_0xb540('0x3f')],_0x2fe41b[_0xb540('0x54')]));if(_0x2221bb['query']['filter']){_0x399544[_0xb540('0xd2')]=_[_0xb540('0x58')](_0x399544[_0xb540('0xd2')],{'$or':_[_0xb540('0x32')](_0x399544['attributes'],function(_0x208c92){var _0x9e882c={};_0x9e882c[_0x208c92]={'$like':'%'+_0x2221bb['query']['filter']+'%'};return _0x9e882c;})});}_0x399544=_['merge']({},_0x399544,_0x2221bb['options']);return _0x4fad7b[_0xb540('0xe1')](_0x399544);}})[_0xb540('0x15')](function(_0x2589ad){if(_0x2589ad){_0x4e8900=_0x2589ad[_0xb540('0x48')];if(!_0x2221bb[_0xb540('0x3f')][_0xb540('0xc9')](_0xb540('0xd7'))){_0x399544[_0xb540('0x24')]=qs[_0xb540('0x24')](_0x2221bb[_0xb540('0x3f')][_0xb540('0x24')]);_0x399544['offset']=qs[_0xb540('0x22')](_0x2221bb[_0xb540('0x3f')]['offset']);}return _0x4fad7b[_0xb540('0xe1')](_0x399544);}})[_0xb540('0x15')](function(_0x356256){if(_0x356256){return _0x356256?{'count':_0x4e8900,'rows':_0x356256}:null;}})[_0xb540('0x15')](respondWithResult(_0x592681,null))[_0xb540('0x4f')](handleError(_0x592681,null));};exports[_0xb540('0xe3')]=function(_0x1eaea5,_0x48de3e){var _0x272908={'raw':!![],'where':{}};var _0x31e05e={};var _0x4feae9={'count':0x0,'rows':[]};return db[_0xb540('0x45')][_0xb540('0x96')]({'where':{'id':_0x1eaea5['params']['id']}})[_0xb540('0x15')](handleEntityNotFound(_0x48de3e,null))[_0xb540('0x15')](function(_0x132c8c){if(_0x132c8c){_0x31e05e[_0xb540('0x52')]=_[_0xb540('0x53')](db[_0xb540('0xe4')][_0xb540('0x39')]);_0x31e05e[_0xb540('0x3f')]=_['keys'](_0x1eaea5[_0xb540('0x3f')]);_0x31e05e[_0xb540('0x54')]=_['intersection'](_0x31e05e[_0xb540('0x52')],_0x31e05e[_0xb540('0x3f')]);_0x272908[_0xb540('0x43')]=_[_0xb540('0x55')](_0x31e05e[_0xb540('0x52')],qs[_0xb540('0x56')](_0x1eaea5[_0xb540('0x3f')][_0xb540('0x56')]));_0x272908['attributes']=_0x272908[_0xb540('0x43')][_0xb540('0x48')]?_0x272908[_0xb540('0x43')]:_0x31e05e[_0xb540('0x52')];if(!_0x1eaea5[_0xb540('0x3f')][_0xb540('0xc9')](_0xb540('0xd7'))){_0x272908['limit']=qs[_0xb540('0x24')](_0x1eaea5['query'][_0xb540('0x24')]);_0x272908[_0xb540('0x22')]=qs[_0xb540('0x22')](_0x1eaea5[_0xb540('0x3f')][_0xb540('0x22')]);}_0x272908['order']=qs[_0xb540('0xd1')](_0x1eaea5[_0xb540('0x3f')][_0xb540('0xd1')]);_0x272908[_0xb540('0xd2')]=qs[_0xb540('0x54')](_[_0xb540('0xd3')](_0x1eaea5[_0xb540('0x3f')],_0x31e05e[_0xb540('0x54')]));_0x272908[_0xb540('0xd2')][_0xb540('0xdc')]=_0x132c8c['id'];if(_0x1eaea5[_0xb540('0x3f')]['filter']){_0x272908[_0xb540('0xd2')]=_[_0xb540('0x58')](_0x272908[_0xb540('0xd2')],{'$or':_[_0xb540('0x32')](_0x272908[_0xb540('0x43')],function(_0x355666){var _0x1f896b={};_0x1f896b[_0x355666]={'$like':'%'+_0x1eaea5[_0xb540('0x3f')]['filter']+'%'};return _0x1f896b;})});}_0x272908=_[_0xb540('0x58')]({},_0x272908,_0x1eaea5[_0xb540('0xd4')]);return db[_0xb540('0xe4')][_0xb540('0x25')]({'where':_0x272908[_0xb540('0xd2')]})[_0xb540('0x15')](function(_0x532901){_0x4feae9[_0xb540('0x25')]=_0x532901;if(_0x1eaea5['query'][_0xb540('0x40')]){_0x272908[_0xb540('0x42')]=[{'all':!![]}];}return db[_0xb540('0xe4')][_0xb540('0x8b')](_0x272908);})[_0xb540('0x15')](function(_0x241e15){_0x4feae9[_0xb540('0x47')]=_0x241e15;return _0x4feae9;});}})[_0xb540('0x15')](respondWithFilteredResult(_0x48de3e,_0x272908))[_0xb540('0x4f')](handleError(_0x48de3e,null));};exports[_0xb540('0xe5')]=function(_0x1c8eaa,_0xd08e62){var _0x23af8e={};var _0x3537c7={};var _0x1dc78a;var _0x57cd80;return db[_0xb540('0x45')][_0xb540('0x96')]({'where':{'id':_0x1c8eaa[_0xb540('0x51')]['id']}})[_0xb540('0x15')](handleEntityNotFound(_0xd08e62,null))[_0xb540('0x15')](function(_0x190ced){if(_0x190ced){_0x1dc78a=_0x190ced;_0x3537c7[_0xb540('0x52')]=_[_0xb540('0x53')](db['SmsInteraction'][_0xb540('0x39')]);_0x3537c7['query']=_[_0xb540('0x53')](_0x1c8eaa['query']);_0x3537c7[_0xb540('0x54')]=_['intersection'](_0x3537c7[_0xb540('0x52')],_0x3537c7['query']);_0x23af8e[_0xb540('0x43')]=_[_0xb540('0x55')](_0x3537c7[_0xb540('0x52')],qs[_0xb540('0x56')](_0x1c8eaa['query'][_0xb540('0x56')]));_0x23af8e[_0xb540('0x43')]=_0x23af8e[_0xb540('0x43')][_0xb540('0x48')]?_0x23af8e[_0xb540('0x43')]:_0x3537c7[_0xb540('0x52')];_0x23af8e[_0xb540('0xd0')]=qs['sort'](_0x1c8eaa[_0xb540('0x3f')][_0xb540('0xd1')]);_0x23af8e[_0xb540('0xd2')]=qs['filters'](_[_0xb540('0xd3')](_0x1c8eaa[_0xb540('0x3f')],_0x3537c7[_0xb540('0x54')]));if(_0x1c8eaa[_0xb540('0x3f')][_0xb540('0x30')]){_0x23af8e[_0xb540('0xd2')]=_[_0xb540('0x58')](_0x23af8e[_0xb540('0xd2')],{'$or':_[_0xb540('0x32')](_0x23af8e[_0xb540('0x43')],function(_0x402ca7){var _0x15114b={};_0x15114b[_0x402ca7]={'$like':'%'+_0x1c8eaa['query'][_0xb540('0x30')]+'%'};return _0x15114b;})});}_0x23af8e=_[_0xb540('0x58')]({},_0x23af8e,_0x1c8eaa[_0xb540('0xd4')]);return _0x1dc78a['getSmsInteractions'](_0x23af8e);}})['then'](function(_0x407537){if(_0x407537){_0x57cd80=_0x407537[_0xb540('0x48')];if(!_0x1c8eaa['query'][_0xb540('0xc9')](_0xb540('0xd7'))){_0x23af8e[_0xb540('0x24')]=qs[_0xb540('0x24')](_0x1c8eaa['query'][_0xb540('0x24')]);_0x23af8e[_0xb540('0x22')]=qs[_0xb540('0x22')](_0x1c8eaa[_0xb540('0x3f')][_0xb540('0x22')]);}return _0x1dc78a['getSmsInteractions'](_0x23af8e);}})[_0xb540('0x15')](function(_0xa3c4a1){if(_0xa3c4a1){return _0xa3c4a1?{'count':_0x57cd80,'rows':_0xa3c4a1}:null;}})['then'](respondWithResult(_0xd08e62,null))[_0xb540('0x4f')](handleError(_0xd08e62,null));};exports['getFaxInteractions']=function(_0xe04400,_0x261b61){var _0x5171ad={};var _0x2d99e7={};var _0x6a8ce7;var _0x1aed2f;return db['User'][_0xb540('0x96')]({'where':{'id':_0xe04400[_0xb540('0x51')]['id']}})[_0xb540('0x15')](handleEntityNotFound(_0x261b61,null))['then'](function(_0x40172e){if(_0x40172e){_0x6a8ce7=_0x40172e;_0x2d99e7[_0xb540('0x52')]=_[_0xb540('0x53')](db[_0xb540('0xe6')][_0xb540('0x39')]);_0x2d99e7[_0xb540('0x3f')]=_[_0xb540('0x53')](_0xe04400[_0xb540('0x3f')]);_0x2d99e7[_0xb540('0x54')]=_[_0xb540('0x55')](_0x2d99e7[_0xb540('0x52')],_0x2d99e7[_0xb540('0x3f')]);_0x5171ad[_0xb540('0x43')]=_[_0xb540('0x55')](_0x2d99e7['model'],qs[_0xb540('0x56')](_0xe04400[_0xb540('0x3f')]['fields']));_0x5171ad[_0xb540('0x43')]=_0x5171ad[_0xb540('0x43')][_0xb540('0x48')]?_0x5171ad['attributes']:_0x2d99e7['model'];_0x5171ad[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0xe04400[_0xb540('0x3f')][_0xb540('0xd1')]);_0x5171ad[_0xb540('0xd2')]=qs[_0xb540('0x54')](_[_0xb540('0xd3')](_0xe04400[_0xb540('0x3f')],_0x2d99e7[_0xb540('0x54')]));if(_0xe04400[_0xb540('0x3f')][_0xb540('0x30')]){_0x5171ad['where']=_[_0xb540('0x58')](_0x5171ad['where'],{'$or':_[_0xb540('0x32')](_0x5171ad['attributes'],function(_0x32f096){var _0x3cc42d={};_0x3cc42d[_0x32f096]={'$like':'%'+_0xe04400[_0xb540('0x3f')][_0xb540('0x30')]+'%'};return _0x3cc42d;})});}_0x5171ad=_[_0xb540('0x58')]({},_0x5171ad,_0xe04400[_0xb540('0xd4')]);return _0x6a8ce7['getFaxInteractions'](_0x5171ad);}})[_0xb540('0x15')](function(_0x4280a4){if(_0x4280a4){_0x1aed2f=_0x4280a4['length'];if(!_0xe04400[_0xb540('0x3f')][_0xb540('0xc9')](_0xb540('0xd7'))){_0x5171ad[_0xb540('0x24')]=qs[_0xb540('0x24')](_0xe04400[_0xb540('0x3f')][_0xb540('0x24')]);_0x5171ad[_0xb540('0x22')]=qs[_0xb540('0x22')](_0xe04400[_0xb540('0x3f')][_0xb540('0x22')]);}return _0x6a8ce7['getFaxInteractions'](_0x5171ad);}})[_0xb540('0x15')](function(_0x453dde){if(_0x453dde){return _0x453dde?{'count':_0x1aed2f,'rows':_0x453dde}:null;}})[_0xb540('0x15')](respondWithResult(_0x261b61,null))[_0xb540('0x4f')](handleError(_0x261b61,null));};exports[_0xb540('0xe7')]=function(_0x5a7b7b,_0x26c243){var _0x74e58f={};var _0x45089d={};var _0x16b597;var _0x1e1ee0;return db['User'][_0xb540('0x96')]({'where':{'id':_0x5a7b7b['params']['id']}})[_0xb540('0x15')](handleEntityNotFound(_0x26c243,null))[_0xb540('0x15')](function(_0x2ff872){if(_0x2ff872){_0x16b597=_0x2ff872;_0x45089d['model']=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x45089d[_0xb540('0x3f')]=_['keys'](_0x5a7b7b['query']);_0x45089d[_0xb540('0x54')]=_[_0xb540('0x55')](_0x45089d[_0xb540('0x52')],_0x45089d[_0xb540('0x3f')]);_0x74e58f['attributes']=_[_0xb540('0x55')](_0x45089d['model'],qs[_0xb540('0x56')](_0x5a7b7b[_0xb540('0x3f')][_0xb540('0x56')]));_0x74e58f['attributes']=_0x74e58f['attributes'][_0xb540('0x48')]?_0x74e58f['attributes']:_0x45089d[_0xb540('0x52')];_0x74e58f['order']=qs[_0xb540('0xd1')](_0x5a7b7b[_0xb540('0x3f')][_0xb540('0xd1')]);_0x74e58f[_0xb540('0xd2')]=qs[_0xb540('0x54')](_[_0xb540('0xd3')](_0x5a7b7b[_0xb540('0x3f')],_0x45089d[_0xb540('0x54')]));if(_0x5a7b7b['query']['filter']){_0x74e58f[_0xb540('0xd2')]=_['merge'](_0x74e58f['where'],{'$or':_[_0xb540('0x32')](_0x74e58f['attributes'],function(_0x324bf3){var _0x320c71={};_0x320c71[_0x324bf3]={'$like':'%'+_0x5a7b7b[_0xb540('0x3f')][_0xb540('0x30')]+'%'};return _0x320c71;})});}_0x74e58f=_[_0xb540('0x58')]({},_0x74e58f,_0x5a7b7b[_0xb540('0xd4')]);return _0x16b597['getWhatsappInteractions'](_0x74e58f);}})[_0xb540('0x15')](function(_0x89c843){if(_0x89c843){_0x1e1ee0=_0x89c843[_0xb540('0x48')];if(!_0x5a7b7b[_0xb540('0x3f')][_0xb540('0xc9')](_0xb540('0xd7'))){_0x74e58f[_0xb540('0x24')]=qs[_0xb540('0x24')](_0x5a7b7b[_0xb540('0x3f')][_0xb540('0x24')]);_0x74e58f[_0xb540('0x22')]=qs[_0xb540('0x22')](_0x5a7b7b[_0xb540('0x3f')][_0xb540('0x22')]);}return _0x16b597[_0xb540('0xe7')](_0x74e58f);}})[_0xb540('0x15')](function(_0x5cdf21){if(_0x5cdf21){return _0x5cdf21?{'count':_0x1e1ee0,'rows':_0x5cdf21}:null;}})[_0xb540('0x15')](respondWithResult(_0x26c243,null))[_0xb540('0x4f')](handleError(_0x26c243,null));};exports[_0xb540('0xe8')]=function(_0x4bb7b8,_0x5ade5e,_0x4fc326){var _0x311146;var _0xe63180;var _0x33e9c1;var _0x4210c6=!_[_0xb540('0x66')](_0x4bb7b8[_0xb540('0x51')]['id'])?_0x4bb7b8[_0xb540('0x51')]['id']:!_[_0xb540('0x66')](_0x4bb7b8[_0xb540('0x7d')]['id'])?_0x4bb7b8[_0xb540('0x7d')]['id']:null;return db[_0xb540('0x45')][_0xb540('0x59')]({'where':{'id':_0x4210c6,'role':{'$or':[_0xb540('0x2d'),'user',_0xb540('0x29')]}},'attributes':['id',_0xb540('0x35'),'phone',_0xb540('0xe9'),_0xb540('0x28'),_0xb540('0x61'),'loginInPause']})['then'](function(_0x2ba9b4){if(_0x2ba9b4){if(_0x2ba9b4[_0xb540('0x28')]===_0xb540('0x29')){_0x311146=_0x2ba9b4;if(_0x4bb7b8[_0xb540('0x5d')][_0xb540('0xea')]){_0x33e9c1=util[_0xb540('0xeb')](_0xb540('0xec'),_0x311146[_0x4bb7b8[_0xb540('0x5d')][_0xb540('0xea')]]);}else if(_0x4bb7b8[_0xb540('0x5d')][_0xb540('0xed')]){_0x33e9c1=util[_0xb540('0xeb')](_0xb540('0xaa'),_0x4bb7b8[_0xb540('0x5d')][_0xb540('0xed')]);}else{_0x33e9c1=util['format']('SIP/%s',_0x311146[_0xb540('0x35')]);}socket['to'](util['format'](_0xb540('0xee'),_0x311146[_0xb540('0x35')]))['emit'](_0xb540('0xef'),{'user':{'id':_0x311146['id'],'name':_0x311146[_0xb540('0x35')]},'ip':_0x4bb7b8[_0xb540('0xf0')][_0xb540('0xf1')]||_0x4bb7b8[_0xb540('0xf2')][_0xb540('0xf3')]||_0x4bb7b8[_0xb540('0xf4')][_0xb540('0xf3')]||_0x4bb7b8[_0xb540('0xf2')][_0xb540('0xf4')][_0xb540('0xf3')]});return db[_0xb540('0xab')][_0xb540('0x2c')]({'where':{'membername':_0x311146['name']},'individualHooks':!![]});}}else{throw new db[(_0xb540('0x91'))][(_0xb540('0x8f'))](_0xb540('0xf5'));}})[_0xb540('0x15')](function(){if(_0x311146){return _0x311146[_0xb540('0xf6')]({'raw':!![]});}})[_0xb540('0x15')](function(_0x33a56b){if(_0x311146){if(_0x33a56b){_0xe63180=_0x33a56b;if(_0xe63180[_0xb540('0x48')]){var _0xa04b08=_0xe63180[_0xb540('0x32')](function(_0x35aa50){var _0x41048b={'membername':_0x311146[_0xb540('0x35')],'UserId':_0x311146['id'],'queue_name':_0x35aa50[_0xb540('0x35')],'VoiceQueueId':_0x35aa50['id'],'interface':_0x33e9c1,'paused':_0x311146[_0xb540('0xf7')]||![],'penalty':_0x35aa50['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt']['upsert'](_0x41048b);});return Promise[_0xb540('0x4e')](_0xa04b08);}}}})['then'](function(){if(_0x311146){return db[_0xb540('0xf8')][_0xb540('0x8b')]({'where':{'membername':_0x311146[_0xb540('0x35')],'exitAt':null}});}})['then'](function(_0x2dfb15){if(_0x311146){var _0x5aef90=[];_0x2dfb15[_0xb540('0xf9')](function(_0x34661e){_0x5aef90['push'](_0x34661e[_0xb540('0x27')]({'exitAt':moment()[_0xb540('0xeb')](_0xb540('0xfa'))}));});return Promise[_0xb540('0x4e')](_0x5aef90);}})[_0xb540('0x15')](function(){if(_0x311146){var _0x48b5cc=[];var _0x58b1cf=[];var _0x49a314=utils[_0xb540('0xfb')]();var _0x5da15c={'membername':_0x311146[_0xb540('0x35')],'interface':_0x33e9c1,'enterAt':moment()[_0xb540('0xeb')](_0xb540('0xfa')),'role':_0x311146[_0xb540('0x28')],'internal':_0x311146[_0xb540('0x61')]};_0x49a314[_0xb540('0xf9')](function(_0x1dc087){_0x48b5cc[_0xb540('0x44')](_[_0xb540('0x58')]({'channel':_0x1dc087,'type':_0xb540('0xfc'),'data1':_0x4bb7b8[_0xb540('0x5d')]['device'],'data2':_0x33e9c1},_0x5da15c));if(_0x311146[_0xb540('0xf7')]){_0x58b1cf['push'](_[_0xb540('0x58')]({'channel':_0x1dc087,'type':_0xb540('0xfd'),'data1':'LOGININPAUSE'},_0x5da15c));}});return db[_0xb540('0xf8')]['bulkCreate'](_0x48b5cc[_0xb540('0xc6')](_0x58b1cf),{'individualHooks':!![]});}})[_0xb540('0x15')](function(){if(_0x311146){return _0x311146[_0xb540('0x27')]({'online':!![],'lastLoginAt':moment()[_0xb540('0xeb')](_0xb540('0xfa')),'voicePause':_0x311146['loginInPause']||![],'mailPause':_0x311146[_0xb540('0xf7')]||![],'chatPause':_0x311146[_0xb540('0xf7')]||![],'faxPause':_0x311146[_0xb540('0xf7')]||![],'smsPause':_0x311146[_0xb540('0xf7')]||![],'openchannelPause':_0x311146['loginInPause']||![],'whatsappPause':_0x311146[_0xb540('0xf7')]||![],'pauseType':_0x311146['loginInPause']?_0xb540('0xfe'):null,'interface':_0x33e9c1,'lastPauseAt':moment()[_0xb540('0xeb')](_0xb540('0xfa'))});}})[_0xb540('0x15')](function(_0x37fdb0){if(_0x4bb7b8[_0xb540('0xff')]){return _0x4fc326();}else{return Promise[_0xb540('0x100')](_0x37fdb0)[_0xb540('0x15')](respondWithResult(_0x5ade5e,null));}})[_0xb540('0x4f')](handleError(_0x5ade5e,null));};exports['logout']=function(_0x233263,_0x1fe2b5){var _0x1915d3;return db[_0xb540('0x45')]['find']({'where':{'id':_0x233263[_0xb540('0x51')]['id'],'role':_0xb540('0x29')},'attributes':['id','name',_0xb540('0x28')]})[_0xb540('0x15')](handleEntityNotFound(_0x1fe2b5,null))['then'](function(_0x3df4c8){if(_0x3df4c8){_0x1915d3=_0x3df4c8;return db[_0xb540('0xab')][_0xb540('0x2c')]({'where':{'membername':_0x1915d3[_0xb540('0x35')]},'individualHooks':!![]});}})[_0xb540('0x15')](function(){return db[_0xb540('0xf8')]['findAll']({'where':{'membername':_0x1915d3[_0xb540('0x35')],'exitAt':null}});})[_0xb540('0x15')](function(_0x179546){var _0x11acf0=[];_0x179546['forEach'](function(_0x45234c){_0x11acf0[_0xb540('0x44')](_0x45234c[_0xb540('0x27')]({'exitAt':moment()[_0xb540('0xeb')](_0xb540('0xfa'))}));});return Promise[_0xb540('0x4e')](_0x11acf0);})[_0xb540('0x15')](function(){return _0x1915d3[_0xb540('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb540('0x15')](respondWithResult(_0x1fe2b5,null))[_0xb540('0x4f')](handleError(_0x1fe2b5,null));};exports[_0xb540('0x101')]=function(_0xc972ba,_0x1281b0){var _0x14b111;return db[_0xb540('0xab')][_0xb540('0x27')]({'paused':0x1},{'where':{'UserId':_0xc972ba['params']['id']},'individualHooks':!![]})[_0xb540('0x15')](function(){return db[_0xb540('0x45')][_0xb540('0x59')]({'where':{'id':_0xc972ba[_0xb540('0x51')]['id'],'role':_0xb540('0x29')},'attributes':['id',_0xb540('0x35'),'role',_0xb540('0x61'),_0xb540('0xea'),_0xb540('0x9d')]});})[_0xb540('0x15')](handleEntityNotFound(_0x1281b0,null))['then'](function(_0x5d6fc2){if(_0x5d6fc2){_0x14b111=_0x5d6fc2;return respondWithRpcPromise('QueuePause',_0xb540('0x101'),{'id':_0x14b111['id'],'name':_0x14b111[_0xb540('0x35')],'pause':!![]});}})[_0xb540('0x15')](function(){if(_0x14b111){return db[_0xb540('0xf8')][_0xb540('0x8b')]({'where':{'membername':_0x14b111[_0xb540('0x35')],'type':_0xb540('0xfd'),'exitAt':null}});}})[_0xb540('0x15')](function(_0x2c5326){if(_0x2c5326[_0xb540('0x48')]){var _0x3f9494=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x725065=0x0,_0xb6a844=_0x2c5326[_0xb540('0x48')];_0x725065<_0xb6a844;_0x725065++){_0x2c5326[_0x725065][_0xb540('0x102')]({'exitAt':_0x3f9494});}}})[_0xb540('0x15')](function(){var _0x212d02=[];var _0x2f06b5=utils['getChannels']();_0x2f06b5['forEach'](function(_0x365c8b){_0x212d02['push']({'channel':_0x365c8b,'membername':_0x14b111['name'],'interface':_[_0xb540('0x66')](_0x14b111[_0xb540('0xea')])?util[_0xb540('0xeb')](_0xb540('0xaa'),_0x14b111[_0xb540('0x35')]):_0x14b111[_0xb540('0xea')],'type':'PAUSE','enterAt':moment()[_0xb540('0xeb')](_0xb540('0xfa')),'data1':_0xc972ba[_0xb540('0x5d')][_0xb540('0x3b')]||_0xb540('0x103'),'role':_0x14b111[_0xb540('0x28')],'internal':_0x14b111[_0xb540('0x61')]});});return db[_0xb540('0xf8')][_0xb540('0x88')](_0x212d02,{'individualHooks':!![]});})[_0xb540('0x15')](function(){return _0x14b111[_0xb540('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xc972ba['body'][_0xb540('0x3b')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xb540('0xfa'))});})[_0xb540('0x15')](respondWithResult(_0x1281b0,null))[_0xb540('0x4f')](handleError(_0x1281b0,null));};exports[_0xb540('0x104')]=function(_0x39fb2b,_0x56fa5c){if(_0x39fb2b[_0xb540('0x5d')][_0xb540('0x9c')]&&!utils[_0xb540('0x9f')](_0x39fb2b[_0xb540('0x5d')]['channel'])){throw new APIBadRequestError(util[_0xb540('0xeb')](_0xb540('0x105'),_0x39fb2b[_0xb540('0x5d')]['channel']));}return db['User']['find']({'where':{'id':_0x39fb2b[_0xb540('0x51')]['id']},'attributes':['id',_0xb540('0x35'),_0xb540('0x28'),_0xb540('0x61'),_0xb540('0xea'),_0xb540('0x9d'),_0xb540('0x9e'),_0xb540('0x106'),_0xb540('0x107'),_0xb540('0x108'),_0xb540('0x109'),_0xb540('0x10a'),_0xb540('0x10b'),_0xb540('0x10c'),_0xb540('0x10d')]})[_0xb540('0x15')](function(_0x3e526b){if(!_0x3e526b){throw new APINotFoundError(util['format'](_0xb540('0xc7'),_0x39fb2b[_0xb540('0x51')]['id']));}return _0x3e526b['unpause'](_0x39fb2b[_0xb540('0x5d')][_0xb540('0x9c')]);})[_0xb540('0x15')](respondWithResult(_0x56fa5c,null))[_0xb540('0x4f')](APIHandleError(_0x56fa5c));};exports[_0xb540('0x10e')]=function(_0xad128d,_0x17d8b8){var _0x3dbed0={};var _0x37da83={};var _0x4126a8;var _0x2194ed;return db[_0xb540('0x45')][_0xb540('0x96')]({'where':{'id':_0xad128d[_0xb540('0x51')]['id']}})['then'](handleEntityNotFound(_0x17d8b8,null))['then'](function(_0x134945){if(_0x134945){_0x4126a8=_0x134945;_0x37da83['model']=_[_0xb540('0x53')](db[_0xb540('0x10f')][_0xb540('0x39')]);_0x37da83['query']=_[_0xb540('0x53')](_0xad128d[_0xb540('0x3f')]);_0x37da83[_0xb540('0x54')]=_['intersection'](_0x37da83[_0xb540('0x52')],_0x37da83[_0xb540('0x3f')]);_0x3dbed0[_0xb540('0x43')]=_[_0xb540('0x55')](_0x37da83[_0xb540('0x52')],qs[_0xb540('0x56')](_0xad128d[_0xb540('0x3f')][_0xb540('0x56')]));_0x3dbed0[_0xb540('0x43')]=_0x3dbed0['attributes'][_0xb540('0x48')]?_0x3dbed0[_0xb540('0x43')]:_0x37da83['model'];_0x3dbed0[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0xad128d[_0xb540('0x3f')]['sort']);_0x3dbed0[_0xb540('0xd2')]=qs['filters'](_[_0xb540('0xd3')](_0xad128d[_0xb540('0x3f')],_0x37da83['filters']));if(_0xad128d[_0xb540('0x3f')][_0xb540('0x30')]){_0x3dbed0[_0xb540('0xd2')]=_[_0xb540('0x58')](_0x3dbed0[_0xb540('0xd2')],{'$or':_[_0xb540('0x32')](_0x3dbed0[_0xb540('0x43')],function(_0x28ab74){var _0x388cd6={};_0x388cd6[_0x28ab74]={'$like':'%'+_0xad128d[_0xb540('0x3f')][_0xb540('0x30')]+'%'};return _0x388cd6;})});}_0x3dbed0=_['merge']({},_0x3dbed0,_0xad128d[_0xb540('0xd4')]);return _0x4126a8[_0xb540('0x10e')](_0x3dbed0);}})[_0xb540('0x15')](function(_0xf93ada){if(_0xf93ada){_0x2194ed=_0xf93ada[_0xb540('0x48')];if(!_0xad128d[_0xb540('0x3f')][_0xb540('0xc9')](_0xb540('0xd7'))){_0x3dbed0['limit']=qs[_0xb540('0x24')](_0xad128d[_0xb540('0x3f')][_0xb540('0x24')]);_0x3dbed0['offset']=qs[_0xb540('0x22')](_0xad128d['query']['offset']);}return _0x4126a8[_0xb540('0x10e')](_0x3dbed0);}})['then'](function(_0x5c7654){if(_0x5c7654){return _0x5c7654?{'count':_0x2194ed,'rows':_0x5c7654}:null;}})[_0xb540('0x15')](respondWithResult(_0x17d8b8,null))[_0xb540('0x4f')](handleError(_0x17d8b8,null));};exports['addTeams']=function(_0x2fa1f0,_0x5b43b4){var _0x3c3369=_0x2fa1f0[_0xb540('0x51')]['id'];var _0x3d37cc=_0x2fa1f0[_0xb540('0x5d')]?_0x2fa1f0[_0xb540('0x5d')][_0xb540('0x60')]:null;var _0x4adbda=[];return Promise[_0xb540('0x100')]()[_0xb540('0x15')](function(){if(!_0x3d37cc)throw new APIBadRequestError(_0xb540('0x110'));})['then'](function(){return db['User']['findOne']({'where':{'id':_0x3c3369}});})['then'](function(_0x1ad514){if(!_0x1ad514)throw new APINotFoundError(util[_0xb540('0xeb')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2fa1f0[_0xb540('0x51')]['id']));return db[_0xb540('0x68')][_0xb540('0x111')](function(_0x5bb28c){return _0x1ad514['addTeams'](_0x3d37cc,{'transaction':_0x5bb28c})[_0xb540('0x15')](function(){return db[_0xb540('0x10f')]['findAll']({'where':{'id':{'$in':_0x3d37cc}}});})[_0xb540('0x15')](function(_0x5ec115){var _0x276d5d=_[_0xb540('0x32')](_0x5ec115,function(_0x4af84c){return _0x4af84c['getAssociatedQueues']();});return Promise['all'](_0x276d5d);})[_0xb540('0x15')](function(_0x590c98){_0x4adbda=_[_0xb540('0x112')](_0x590c98);var _0x11f9a5=_[_0xb540('0x32')](_0x4adbda,function(_0x379375){return _0x379375[_0xb540('0x113')](_0x1ad514['id'],{'transaction':_0x5bb28c});});return Promise[_0xb540('0x4e')](_0x11f9a5);})[_0xb540('0x15')](function(){if(!_0x1ad514[_0xb540('0x9d')])return;var _0x101e1a=_[_0xb540('0x30')](_0x4adbda,function(_0x1187fc){return _0x1187fc['getDataValue'](_0xb540('0x9c'))===_0xb540('0x114');});var _0x5ef581=_[_0xb540('0x32')](_0x101e1a,function(_0x95921){return db[_0xb540('0xab')][_0xb540('0xac')]({'membername':_0x1ad514[_0xb540('0x35')],'UserId':_0x1ad514['id'],'queue_name':_0x95921[_0xb540('0x35')],'VoiceQueueId':_0x95921['id'],'interface':_[_0xb540('0x66')](_0x1ad514['interface'])?util[_0xb540('0xeb')](_0xb540('0xaa'),_0x1ad514[_0xb540('0x35')]):_0x1ad514[_0xb540('0xea')],'paused':_0x1ad514['voicePause']||![],'penalty':_0x1ad514[_0xb540('0xa4')]},{'transaction':_0x5bb28c});});return Promise[_0xb540('0x4e')](_0x5ef581);})[_0xb540('0x15')](function(){return db[_0xb540('0x115')][_0xb540('0x8b')]({'where':{'teamId':{'$in':_0x3d37cc}}});})[_0xb540('0x15')](function(_0x5e8222){var _0x55da38=_[_0xb540('0x32')](_0x5e8222,function(_0x16e2f3){return db[_0xb540('0x116')][_0xb540('0x7c')]({'UserId':_0x1ad514['id'],'VoicePrefixId':_0x16e2f3[_0xb540('0x117')]},{'transaction':_0x5bb28c});});return Promise['all'](_0x55da38);});});})[_0xb540('0x15')](function(){for(var _0x19fba0=0x0;_0x19fba0<_0x4adbda[_0xb540('0x48')];_0x19fba0++){var _0x138447=_0x4adbda[_0x19fba0][_0xb540('0x118')](_0xb540('0x9c'));var _0x28d8d6=_0x138447+_0xb540('0xb0');socket[_0xb540('0x2a')]('user'+_0x138447+_0xb540('0xa6'),{'UserId':_0x3c3369,['queueField']:_0x4adbda[_0x19fba0]['id']});}})[_0xb540('0x15')](respondWithStatusCode(_0x5b43b4,null))[_0xb540('0x4f')](APIHandleError(_0x5b43b4));};exports[_0xb540('0x119')]=function(_0x8f2021,_0x3b0928){var _0x54e4f3=_0x8f2021[_0xb540('0x51')]['id'];var _0x472c36=null;if(_0x8f2021[_0xb540('0x3f')][_0xb540('0x60')]){_0x472c36=_['isArray'](_0x8f2021[_0xb540('0x3f')][_0xb540('0x60')])?_0x8f2021[_0xb540('0x3f')][_0xb540('0x60')]:[_0x8f2021['query']['ids']];}var _0x49647c=[];return Promise[_0xb540('0x100')]()[_0xb540('0x15')](function(){if(!_0x472c36)throw new APIBadRequestError(_0xb540('0x11a'));})[_0xb540('0x15')](function(){return db[_0xb540('0x45')][_0xb540('0x96')]({'where':{'id':_0x54e4f3}});})[_0xb540('0x15')](function(_0x3e4127){if(!_0x3e4127)throw new APINotFoundError(util['format'](_0xb540('0xc7'),_0x8f2021['params']['id']));return db[_0xb540('0x68')][_0xb540('0x111')](function(_0x426d56){return _0x3e4127['removeTeams'](_0x472c36,{'transaction':_0x426d56})[_0xb540('0x15')](function(){return db['Team'][_0xb540('0x8b')]({'where':{'id':{'$in':_0x472c36}}});})[_0xb540('0x15')](function(_0x4756e7){var _0x44e52e=_[_0xb540('0x32')](_0x4756e7,function(_0x2f0e08){return _0x2f0e08[_0xb540('0x11b')]();});return Promise[_0xb540('0x4e')](_0x44e52e);})[_0xb540('0x15')](function(_0x5a256d){_0x49647c=_[_0xb540('0x112')](_0x5a256d);var _0x4fa8ab=_[_0xb540('0x32')](_0x49647c,function(_0xedc4fc){return _0xedc4fc['removeAgent'](_0x3e4127['id'],{'transaction':_0x426d56});});return Promise[_0xb540('0x4e')](_0x4fa8ab);})['then'](function(){if(!_0x3e4127[_0xb540('0x9d')])return;var _0x1f99d4=_[_0xb540('0x30')](_0x49647c,function(_0x2503f5){return _0x2503f5['getDataValue'](_0xb540('0x9c'))===_0xb540('0x114');});var _0x372676=_[_0xb540('0x32')](_0x1f99d4,function(_0x3ac4f8){return db['UserVoiceQueueRt'][_0xb540('0x2c')]({'where':{'VoiceQueueId':_0x3ac4f8['id'],'UserId':_0x3e4127['id']},'transaction':_0x426d56});});return Promise[_0xb540('0x4e')](_0x372676);})[_0xb540('0x15')](function(){return db[_0xb540('0x115')][_0xb540('0x8b')]({'where':{'teamId':{'$in':_0x472c36}}});})['then'](function(_0x75d08a){var _0x1c90e9=_[_0xb540('0x32')](_0x75d08a,function(_0x353a99){return db[_0xb540('0x116')][_0xb540('0x2c')]({'where':{'UserId':_0x3e4127['id'],'VoicePrefixId':_0x353a99[_0xb540('0x117')]}},{'transaction':_0x426d56});});return Promise['all'](_0x1c90e9);});});})[_0xb540('0x15')](function(){for(var _0x334a1d=0x0;_0x334a1d<_0x49647c[_0xb540('0x48')];_0x334a1d++){var _0x3f4646=_0x49647c[_0x334a1d][_0xb540('0x118')]('channel');var _0x28cb2f=_0x3f4646+'QueueId';socket[_0xb540('0x2a')](_0xb540('0x7d')+_0x3f4646+'Queue:remove',{'UserId':_0x54e4f3,['queueField']:_0x49647c[_0x334a1d]['id']});}})['then'](respondWithStatusCode(_0x3b0928,null))[_0xb540('0x4f')](APIHandleError(_0x3b0928));};exports[_0xb540('0x11c')]=function(_0x4e7a01,_0x5ed2a3){var _0x2a0e19={};var _0x5786fc={};var _0x10d354;var _0x5dc8e1;return db[_0xb540('0x45')][_0xb540('0x96')]({'where':{'id':_0x4e7a01[_0xb540('0x51')]['id']}})[_0xb540('0x15')](handleEntityNotFound(_0x5ed2a3,null))[_0xb540('0x15')](function(_0x58f5fa){if(_0x58f5fa){_0x10d354=_0x58f5fa;_0x5786fc[_0xb540('0x52')]=_[_0xb540('0x53')](db['CmList']['rawAttributes']);_0x5786fc[_0xb540('0x3f')]=_[_0xb540('0x53')](_0x4e7a01['query']);_0x5786fc[_0xb540('0x54')]=_[_0xb540('0x55')](_0x5786fc['model'],_0x5786fc[_0xb540('0x3f')]);_0x2a0e19['attributes']=_[_0xb540('0x55')](_0x5786fc[_0xb540('0x52')],qs['fields'](_0x4e7a01[_0xb540('0x3f')][_0xb540('0x56')]));_0x2a0e19[_0xb540('0x43')]=_0x2a0e19[_0xb540('0x43')][_0xb540('0x48')]?_0x2a0e19[_0xb540('0x43')]:_0x5786fc['model'];_0x2a0e19[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0x4e7a01['query'][_0xb540('0xd1')]);_0x2a0e19[_0xb540('0xd2')]=qs[_0xb540('0x54')](_[_0xb540('0xd3')](_0x4e7a01['query'],_0x5786fc[_0xb540('0x54')]));if(_0x4e7a01[_0xb540('0x3f')][_0xb540('0x30')]){_0x2a0e19[_0xb540('0xd2')]=_[_0xb540('0x58')](_0x2a0e19[_0xb540('0xd2')],{'$or':_[_0xb540('0x32')](_0x2a0e19[_0xb540('0x43')],function(_0x50c6f5){var _0x3fe5ca={};_0x3fe5ca[_0x50c6f5]={'$like':'%'+_0x4e7a01[_0xb540('0x3f')][_0xb540('0x30')]+'%'};return _0x3fe5ca;})});}_0x2a0e19=_[_0xb540('0x58')]({},_0x2a0e19,_0x4e7a01['options']);return _0x10d354[_0xb540('0x11c')](_0x2a0e19);}})[_0xb540('0x15')](function(_0x179b09){if(_0x179b09){_0x5dc8e1=_0x179b09[_0xb540('0x48')];if(!_0x4e7a01['query'][_0xb540('0xc9')](_0xb540('0xd7'))){_0x2a0e19[_0xb540('0x24')]=qs[_0xb540('0x24')](_0x4e7a01['query'][_0xb540('0x24')]);_0x2a0e19[_0xb540('0x22')]=qs[_0xb540('0x22')](_0x4e7a01['query'][_0xb540('0x22')]);}return _0x10d354['getLists'](_0x2a0e19);}})[_0xb540('0x15')](function(_0x778d6){if(_0x778d6){return _0x778d6?{'count':_0x5dc8e1,'rows':_0x778d6}:null;}})['then'](respondWithResult(_0x5ed2a3,null))[_0xb540('0x4f')](handleError(_0x5ed2a3,null));};exports[_0xb540('0x11d')]=function(_0x16afaa,_0x36b1c0){var _0xe02137={};var _0x6bcaf0={};var _0x31eb15;return db[_0xb540('0x45')][_0xb540('0x96')]({'where':{'id':_0x16afaa['params']['id']}})[_0xb540('0x15')](handleEntityNotFound(_0x36b1c0,null))[_0xb540('0x15')](function(_0x5bcba8){if(_0x5bcba8){_0x31eb15=_0x5bcba8;_0x6bcaf0[_0xb540('0x52')]=_[_0xb540('0x53')](db[_0xb540('0x45')][_0xb540('0x39')]);_0x6bcaf0['query']=_[_0xb540('0x53')](_0x16afaa['query']);_0x6bcaf0['filters']=_['intersection'](_0x6bcaf0[_0xb540('0x52')],_0x6bcaf0[_0xb540('0x3f')]);_0xe02137[_0xb540('0x43')]=_[_0xb540('0x55')](_0x6bcaf0['model'],qs[_0xb540('0x56')](_0x16afaa[_0xb540('0x3f')][_0xb540('0x56')]));_0xe02137[_0xb540('0x43')]=_0xe02137[_0xb540('0x43')]['length']?_0xe02137[_0xb540('0x43')]:_0x6bcaf0['model'];_0xe02137[_0xb540('0xd0')]=qs[_0xb540('0xd1')](_0x16afaa[_0xb540('0x3f')][_0xb540('0xd1')]);_0xe02137[_0xb540('0xd2')]=qs['filters'](_['pick'](_0x16afaa[_0xb540('0x3f')],_0x6bcaf0[_0xb540('0x54')]));if(_0x16afaa[_0xb540('0x3f')][_0xb540('0x30')]){_0xe02137[_0xb540('0xd2')]=_[_0xb540('0x58')](_0xe02137['where'],{'$or':_['map'](_0xe02137[_0xb540('0x43')],function(_0x359e3a){var _0x55dab7={};_0x55dab7[_0x359e3a]={'$like':'%'+_0x16afaa[_0xb540('0x3f')]['filter']+'%'};return _0x55dab7;})});}_0xe02137[_0xb540('0x52')]=db['User'];_0xe02137['as']=_0xb540('0x84');_0xe02137=_[_0xb540('0x58')]({},_0xe02137,_0x16afaa[_0xb540('0xd4')]);return _0x31eb15['getVoiceQueues']({'include':[_0xe02137]});}})['then'](function(_0x378b22){if(_0x378b22){var _0x125f23={},_0x50b2a1=[];for(var _0x27c73a=0x0;_0x27c73a<_0x378b22[_0xb540('0x48')];_0x27c73a+=0x1){for(var _0x5acabc=0x0,_0x20a19c;_0x5acabc<_0x378b22[_0x27c73a][_0xb540('0x84')]['length'];_0x5acabc+=0x1){_0x20a19c=_0x378b22[_0x27c73a]['Agents'][_0x5acabc][_0xb540('0xa8')]({'plain':!![]});_0x125f23[_0x20a19c['id']]=_0x20a19c;}}_0x125f23=_['values'](_0x125f23);for(var _0x22887f=qs[_0xb540('0x22')](_0x16afaa[_0xb540('0x3f')][_0xb540('0x22')]);_0x22887f<_0x125f23['length']&&_0x50b2a1[_0xb540('0x48')]=_0x320b7c){_0x2666ce=_0x320b7c;_0x3d33fa=0xc8;}else{_0x3d33fa=0xce;}_0x204147[_0xbc00('0x23')](_0x3d33fa);return _0x204147['set'](_0xbc00('0x28'),_0x15f90d+'-'+_0x2666ce+'/'+_0x320b7c)[_0xbc00('0x29')](_0x10e533);}return null;};}function saveUpdates(_0x494485){return function(_0x4f09da){if(_0x4f09da){return _0x4f09da[_0xbc00('0x2a')](_0x494485)[_0xbc00('0x18')](function(_0x58b7ee){if(_0x58b7ee[_0xbc00('0x2b')]==='agent'){socket['emit'](_0xbc00('0x2c')+_0x58b7ee['id'],_0x58b7ee);}return _0x58b7ee;});}return null;};}function removeEntity(_0x2ecd71){return function(_0x12fbe7){if(_0x12fbe7){return _0x12fbe7[_0xbc00('0x2d')]()['then'](function(){var _0x3c69f4=_0x12fbe7['get']({'plain':!![]});if(_0x3c69f4[_0xbc00('0x2b')]===_0xbc00('0x2e'))return;var _0x1e4f9d=[{'name':_0xbc00('0x2f'),'value':_0xbc00('0x30'),'ignore':!![]},{'name':'Agents','value':_0xbc00('0x31'),'ignore':![]},{'name':_0xbc00('0x32'),'value':'telephone','ignore':![]}];var _0x2601a2=_(_0x1e4f9d)['filter'](_0xbc00('0x33'))[_0xbc00('0x34')]('value')[_0xbc00('0x35')]();if(_[_0xbc00('0x36')](_0x2601a2,_0x3c69f4[_0xbc00('0x2b')])){return;}var _0x3dd1ac=_[_0xbc00('0x37')](_0x1e4f9d,[_0xbc00('0x35'),_0x3c69f4['role']])[_0xbc00('0x38')];return db[_0xbc00('0x39')][_0xbc00('0x2d')]({'where':{'type':_0x3dd1ac,'resourceId':_0x3c69f4['id']}})[_0xbc00('0x18')](function(){return _0x12fbe7;});})[_0xbc00('0x18')](function(){_0x2ecd71[_0xbc00('0x23')](0xcc)[_0xbc00('0x3a')]();});}};}function handleEntityNotFound(_0x155910){return function(_0x169759){if(!_0x169759){_0x155910[_0xbc00('0x22')](0x194);}return _0x169759;};}function handleError(_0x31e706,_0xb2618b){_0xb2618b=_0xb2618b||0x1f4;return function(_0x84b053){logger['error'](_0x84b053[_0xbc00('0x3b')]);if(_0x84b053[_0xbc00('0x38')]){delete _0x84b053[_0xbc00('0x38')];}_0x31e706[_0xbc00('0x23')](_0xb2618b)[_0xbc00('0x3c')](_0x84b053);};}exports[_0xbc00('0x3d')]=function(_0x2733bf,_0x355006){var _0xb6f5ae={},_0x593b76={'count':0x0,'rows':[]};var _0x470a51=_(db[_0xbc00('0x3e')][_0xbc00('0x3f')])['map'](function(_0x2501f6){return{'name':_0x2501f6[_0xbc00('0x40')],'type':_0x2501f6['type'][_0xbc00('0x41')]};})[_0xbc00('0x42')](function(_0x149351){return!_['includes']([_0xbc00('0x43'),_0xbc00('0x44')],_0x149351[_0xbc00('0x38')]);})[_0xbc00('0x35')]();_0xb6f5ae=qs[_0xbc00('0x45')](_0x470a51,_0x2733bf);var _0x3b77f0={'where':_0xb6f5ae[_0xbc00('0x46')]};return db[_0xbc00('0x3e')][_0xbc00('0x27')](_0x3b77f0)[_0xbc00('0x18')](function(_0x336a67){_0x593b76[_0xbc00('0x27')]=_0x336a67;if(_0x2733bf[_0xbc00('0x47')]['includeAll']){_0xb6f5ae[_0xbc00('0x48')]=[{'all':!![]}];}if(_0x2733bf[_0xbc00('0x47')][_0xbc00('0x49')]==='true'){_0xb6f5ae['include']=[{'model':db[_0xbc00('0x4a')],'as':_0xbc00('0x49')}];}if(!_[_0xbc00('0x36')](_0xb6f5ae[_0xbc00('0x4b')],'id')){_0xb6f5ae[_0xbc00('0x4b')][_0xbc00('0x4c')]('id');}return db[_0xbc00('0x3e')][_0xbc00('0x4d')](_0xb6f5ae);})[_0xbc00('0x18')](function(_0x1a8462){_0x593b76[_0xbc00('0x4e')]=_0x1a8462;if(_0x2733bf[_0xbc00('0x47')][_0xbc00('0x4f')]===_0xbc00('0x50')){var _0x504247=[];for(var _0x58ee0f=0x0;_0x58ee0f<_0x593b76['rows'][_0xbc00('0x51')];_0x58ee0f++){_0x504247['push'](get_open_tabs(_0xbc00('0x52'),_0x593b76[_0xbc00('0x4e')][_0x58ee0f]['dataValues']));_0x504247[_0xbc00('0x4c')](get_open_tabs('sms',_0x593b76['rows'][_0x58ee0f][_0xbc00('0x53')]));_0x504247[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x54'),_0x593b76['rows'][_0x58ee0f][_0xbc00('0x53')]));_0x504247[_0xbc00('0x4c')](get_open_tabs('mail',_0x593b76[_0xbc00('0x4e')][_0x58ee0f][_0xbc00('0x53')]));_0x504247[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x55'),_0x593b76[_0xbc00('0x4e')][_0x58ee0f][_0xbc00('0x53')]));_0x504247[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x56'),_0x593b76['rows'][_0x58ee0f]['dataValues']));}return Promise[_0xbc00('0x57')](_0x504247)[_0xbc00('0x18')](function(){return _0x593b76;});}else{return _0x593b76;}})[_0xbc00('0x18')](respondWithFilteredResult(_0x355006,_0xb6f5ae))[_0xbc00('0x58')](handleError(_0x355006,null));};exports['show']=function(_0x3860af,_0x43955e){var _0x27a876={'raw':![],'where':{'id':_0x3860af[_0xbc00('0x59')]['id']}},_0x6e7c6c={};_0x6e7c6c[_0xbc00('0x5a')]=_[_0xbc00('0x5b')](_[_0xbc00('0x5c')](db[_0xbc00('0x3e')][_0xbc00('0x3f')]),[_0xbc00('0x43'),'salt']);_0x6e7c6c['query']=_[_0xbc00('0x5c')](_0x3860af['query']);_0x6e7c6c['filters']=_[_0xbc00('0x5d')](_0x6e7c6c[_0xbc00('0x5a')],_0x6e7c6c['query']);_0x27a876[_0xbc00('0x4b')]=_[_0xbc00('0x5d')](_0x6e7c6c[_0xbc00('0x5a')],qs[_0xbc00('0x5e')](_0x3860af[_0xbc00('0x47')][_0xbc00('0x5e')]));_0x27a876['attributes']=_0x27a876[_0xbc00('0x4b')][_0xbc00('0x51')]?_0x27a876[_0xbc00('0x4b')]:_0x6e7c6c[_0xbc00('0x5a')];if(_0x3860af[_0xbc00('0x47')]['includeAll']){_0x27a876[_0xbc00('0x48')]=[{'all':!![]}];}if(_0x3860af['query'][_0xbc00('0x49')]===_0xbc00('0x50')){_0x27a876['include']=[{'model':db['UserSetting'],'as':_0xbc00('0x49')}];}_0x27a876=_[_0xbc00('0x5f')]({},_0x27a876,_0x3860af[_0xbc00('0x60')]);if(!_[_0xbc00('0x36')](_0x27a876[_0xbc00('0x4b')],'id')){_0x27a876[_0xbc00('0x4b')]['push']('id');}return db['User'][_0xbc00('0x37')](_0x27a876)[_0xbc00('0x18')](handleEntityNotFound(_0x43955e,null))[_0xbc00('0x18')](function(_0x42f503){var _0x66deda=[];values=_0x42f503;if(_0x3860af[_0xbc00('0x47')][_0xbc00('0x4f')]===_0xbc00('0x50')){_0x66deda[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x52'),_0x42f503[_0xbc00('0x53')]));_0x66deda[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x61'),_0x42f503[_0xbc00('0x53')]));_0x66deda[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x55'),_0x42f503[_0xbc00('0x53')]));_0x66deda[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x56'),_0x42f503[_0xbc00('0x53')]));_0x66deda[_0xbc00('0x4c')](get_open_tabs('fax',_0x42f503[_0xbc00('0x53')]));_0x66deda[_0xbc00('0x4c')](get_open_tabs('mail',_0x42f503[_0xbc00('0x53')]));return Promise['all'](_0x66deda);}else{return values;}})['then'](function(){return values;})[_0xbc00('0x18')](respondWithResult(_0x43955e,null))[_0xbc00('0x58')](handleError(_0x43955e,null));};exports['update']=function(_0x525d0c,_0x99c570){if(_0x525d0c[_0xbc00('0x62')]['id']){delete _0x525d0c[_0xbc00('0x62')]['id'];}delete _0x525d0c[_0xbc00('0x62')][_0xbc00('0x2b')];return db['User']['find']({'where':{'id':_0x525d0c[_0xbc00('0x59')]['id']}})[_0xbc00('0x18')](handleEntityNotFound(_0x99c570,null))[_0xbc00('0x18')](saveUpdates(_0x525d0c[_0xbc00('0x62')],null))[_0xbc00('0x18')](respondWithResult(_0x99c570,null))[_0xbc00('0x58')](handleError(_0x99c570,null));};exports[_0xbc00('0x63')]=function(_0x5bc43f,_0x2a3cbd){return db[_0xbc00('0x3e')][_0xbc00('0x63')]()['then'](respondWithResult(_0x2a3cbd,null))['catch'](handleError(_0x2a3cbd,null));};exports[_0xbc00('0x64')]=function(_0x1538aa,_0x1de5bd){return db[_0xbc00('0x3e')][_0xbc00('0x37')]({'where':{'id':_0x1538aa['params']['id']}})['then'](handleEntityNotFound(_0x1de5bd,null))[_0xbc00('0x18')](function(_0x52be69){if(_0x52be69){return _0x52be69[_0xbc00('0x64')](_0x1538aa['body']['ids'],_[_0xbc00('0x65')](_0x1538aa[_0xbc00('0x62')],[_0xbc00('0x66'),'id'])||{});}})[_0xbc00('0x18')](respondWithResult(_0x1de5bd,null))[_0xbc00('0x58')](handleError(_0x1de5bd,null));};function validateUser(_0x4a70ba){return new Promise(function(_0x1440ca,_0x35a38b){if(_0x4a70ba[_0xbc00('0x67')])return _0x1440ca(_0x4a70ba);return db[_0xbc00('0x68')][_0xbc00('0x69')](0x1)['then'](function(_0x545c11){if(_0x545c11[_0xbc00('0x6a')])authService[_0xbc00('0x6b')](_0x4a70ba[_0xbc00('0x43')]);db['User']['max']('internal')[_0xbc00('0x18')](function(_0x4582e9){if(_[_0xbc00('0x6c')](_0x4582e9)){_0x4a70ba[_0xbc00('0x67')]=_0x545c11[_0xbc00('0x6d')]||0x1;return;}if(_[_0xbc00('0x6c')](_0x545c11[_0xbc00('0x6d')])||_0x545c11[_0xbc00('0x6d')]===_0x4582e9){_0x4a70ba[_0xbc00('0x67')]=_0x4582e9+0x1;return;}if(_0x545c11[_0xbc00('0x6d')]>_0x4582e9){_0x4a70ba[_0xbc00('0x67')]=_0x545c11[_0xbc00('0x6d')];return;}return db[_0xbc00('0x6e')][_0xbc00('0x47')](_0xbc00('0x6f'),{'type':db[_0xbc00('0x6e')][_0xbc00('0x70')][_0xbc00('0x71')]})[_0xbc00('0x18')](function(_0x11f2c9){if(_0x11f2c9&&_0x11f2c9[_0xbc00('0x51')]){for(var _0x205bb5=0x0,_0x3f8848=_0x11f2c9[_0xbc00('0x51')];_0x205bb5<_0x3f8848&&_[_0xbc00('0x6c')](_0x4a70ba[_0xbc00('0x67')]);_0x205bb5++){if(_0x545c11['min_internal']<=_0x11f2c9[_0x205bb5][_0xbc00('0x72')]){_0x4a70ba[_0xbc00('0x67')]=_0x11f2c9[_0x205bb5][_0xbc00('0x72')];}else if(_0x545c11['min_internal']>_0x11f2c9[_0x205bb5][_0xbc00('0x72')]&&_0x545c11[_0xbc00('0x6d')]<=_0x11f2c9[_0x205bb5]['to']){_0x4a70ba[_0xbc00('0x67')]=_0x545c11[_0xbc00('0x6d')];}}}if(_[_0xbc00('0x6c')](_0x4a70ba[_0xbc00('0x67')])){_0x4a70ba[_0xbc00('0x67')]=_0x4582e9+0x1;}return _0x1440ca(_0x4a70ba);});});})[_0xbc00('0x58')](function(_0x3fca1c){_0x35a38b(_0x3fca1c);});});}function updateUser(_0x35a926){return new Promise(function(_0xada52f,_0x56b356){try{if(_0x35a926[_0xbc00('0x73')]){_0x35a926[_0xbc00('0x74')]=_0x35a926[_0xbc00('0x67')];_0x35a926[_0xbc00('0x75')]={'mailbox':_0x35a926['internal'],'password':_0x35a926[_0xbc00('0x43')],'fullname':_0x35a926[_0xbc00('0x76')],'email':_0x35a926[_0xbc00('0x77')]};}if(_0x35a926[_0xbc00('0x2b')]===_0xbc00('0x31')){if(!_0x35a926[_0xbc00('0x78')])_0x35a926[_0xbc00('0x78')]=['101',_0xbc00('0x79'),_0xbc00('0x7a'),_0xbc00('0x7b'),'110',_0xbc00('0x7c'),_0xbc00('0x7d'),_0xbc00('0x7e'),_0xbc00('0x7f'),_0xbc00('0x80'),'109',_0xbc00('0x81'),'111',_0xbc00('0x82'),_0xbc00('0x83')];}_0xada52f(_0x35a926);}catch(_0x8333dd){_0x56b356(_0x8333dd);}});}exports['create']=function(_0xb4839e,_0x4648d2){if(_0xb4839e[_0xbc00('0x30')][_0xbc00('0x2b')]===_0xbc00('0x31'))throw new Error(_0xbc00('0x84'));if(_0xb4839e[_0xbc00('0x62')][_0xbc00('0x2b')]===_0xbc00('0x30')&&_0xb4839e[_0xbc00('0x30')][_0xbc00('0x2b')]!==_0xbc00('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0xb4839e[_0xbc00('0x62')][_0xbc00('0x2b')]===_0xbc00('0x2e')&&_0xb4839e[_0xbc00('0x30')][_0xbc00('0x2b')]!==_0xbc00('0x2e')){throw new Error(_0xbc00('0x85'));}return licenseUtil['checkUserLimits']([_0xb4839e[_0xbc00('0x62')]])[_0xbc00('0x18')](function(){return validateUser(_0xb4839e[_0xbc00('0x62')]);})[_0xbc00('0x18')](function(_0x3b1674){return updateUser(_0x3b1674)['then'](function(_0x5a349c){if(_0x5a349c['role']==='admin'){_0x5a349c[_0xbc00('0x86')]=_0xb4839e[_0xbc00('0x30')][_0xbc00('0x86')];delete _0x5a349c['userProfileId'];}return _0x5a349c;});})[_0xbc00('0x18')](function(_0x14537d){return db[_0xbc00('0x3e')][_0xbc00('0x87')](_0x14537d,{'include':[{'model':db[_0xbc00('0x75')],'as':'VoiceMail'}]});})[_0xbc00('0x18')](function(_0x3fb319){if(_0xb4839e[_0xbc00('0x62')][_0xbc00('0x2b')]==='user')return _0x3fb319;if(_0xb4839e[_0xbc00('0x30')]['role']!==_0xbc00('0x30'))return _0x3fb319;return db[_0xbc00('0x88')][_0xbc00('0x37')]({'where':{'name':_0x3fb319[_0xbc00('0x2b')]===_0xbc00('0x31')?_0xbc00('0x89'):_0xbc00('0x32'),'userProfileId':_0xb4839e[_0xbc00('0x30')][_0xbc00('0x8a')]},'raw':!![]})['then'](function(_0x2bc2a5){if(!_0x2bc2a5||_0x2bc2a5['autoAssociation']!=0x0)return _0x3fb319;return db['UserProfileResource']['create']({'name':_0x3fb319[_0xbc00('0x38')],'resourceId':_0x3fb319['id'],'type':_0x2bc2a5[_0xbc00('0x38')],'sectionId':_0x2bc2a5['id']},{})[_0xbc00('0x18')](function(){return _0x3fb319;});})['catch'](function(_0x349f5f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x349f5f);throw _0x349f5f;});})[_0xbc00('0x18')](respondWithResult(_0x4648d2,0xc9))['catch'](handleError(_0x4648d2,null));};exports[_0xbc00('0x8b')]=function(_0x11e585,_0xa5e23d){var _0x262ed3=_0x11e585[_0xbc00('0x62')];var _0x308633=[];if(_0x11e585[_0xbc00('0x30')][_0xbc00('0x2b')]===_0xbc00('0x31'))throw new Error('Unauthorized');if(_[_0xbc00('0x8c')](_0x262ed3,[_0xbc00('0x2b'),_0xbc00('0x30')])&&_0x11e585['user'][_0xbc00('0x2b')]!=='admin'){throw new Error(_0xbc00('0x8d'));}if(_[_0xbc00('0x8c')](_0x262ed3,['role','admin'])&&_0x11e585[_0xbc00('0x30')][_0xbc00('0x2b')]!==_0xbc00('0x2e')){throw new Error(_0xbc00('0x8e'));}return licenseUtil['checkUserLimits'](_0x262ed3)['then'](function(){return validateUser(_0x262ed3[0x0]);})[_0xbc00('0x18')](function(){for(var _0x5ac063=0x1;_0x5ac063<_0x262ed3['length'];_0x5ac063++){var _0x20fdd5=_0x262ed3[_0x5ac063-0x1][_0xbc00('0x67')];if(!_0x262ed3[_0x5ac063]['internal'])_0x262ed3[_0x5ac063][_0xbc00('0x67')]=_0x20fdd5+0x1;_0x308633['push'](validateUser(_0x262ed3[_0x5ac063]));}return Promise[_0xbc00('0x57')](_0x308633);})[_0xbc00('0x18')](function(){_0x308633=[];for(var _0x3283eb=0x0;_0x3283eb<_0x262ed3[_0xbc00('0x51')];_0x3283eb++){_0x308633['push'](updateUser(_0x262ed3[_0x3283eb]));}return Promise[_0xbc00('0x57')](_0x308633);})[_0xbc00('0x18')](function(){_0x308633=_0x262ed3[_0xbc00('0x34')](function(_0x85703d){return db[_0xbc00('0x3e')][_0xbc00('0x87')](_0x85703d,{'include':[{'model':db[_0xbc00('0x75')],'as':'VoiceMail'}]})[_0xbc00('0x18')](function(_0x50969a){_0x85703d['id']=_0x50969a['id'];return _0x85703d;});});return Promise[_0xbc00('0x57')](_0x308633);})[_0xbc00('0x18')](function(_0x2d194e){if(_0x11e585[_0xbc00('0x62')][_0xbc00('0x2b')]==='user')return _0x2d194e;if(_0x11e585[_0xbc00('0x30')]['role']!==_0xbc00('0x30'))return _0x2d194e;var _0x691f0b=_['some'](_0x2d194e,function(_0x7d73b7){return _0x7d73b7[_0xbc00('0x2b')]===_0xbc00('0x31')||_0x7d73b7[_0xbc00('0x2b')]==='telephone';});if(!_0x691f0b)return _0x2d194e;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0xbc00('0x89'),_0xbc00('0x32')]},'userProfileId':_0x11e585[_0xbc00('0x30')][_0xbc00('0x8a')]},'raw':!![]})[_0xbc00('0x18')](function(_0x593729){if(_['isEmpty'](_0x593729)||!_['some'](_0x593729,['autoAssociation',0x0]))return _0x2d194e;_0x308633=[];var _0xed3ef7=_(_0x593729)['map'](function(_0xfae7dd){if(_0xfae7dd[_0xbc00('0x8f')]===0x1)return;return _0xfae7dd[_0xbc00('0x38')]==='Agents'?_0xbc00('0x31'):_0xbc00('0x90');})[_0xbc00('0x91')]()[_0xbc00('0x35')]();for(var _0x1d4efa=0x0;_0x1d4efa<_0x2d194e['length'];_0x1d4efa++){if(!_['includes'](_0xed3ef7,_0x2d194e[_0x1d4efa]['role']))return;var _0xaeea98=_0x2d194e[_0x1d4efa][_0xbc00('0x2b')]===_0xbc00('0x31')?'Agents':_0xbc00('0x32');_0x308633['push'](db[_0xbc00('0x39')]['create']({'name':_0x2d194e[_0x1d4efa][_0xbc00('0x38')],'resourceId':_0x2d194e[_0x1d4efa]['id'],'type':_0xaeea98,'sectionId':_[_0xbc00('0x37')](_0x593729,[_0xbc00('0x38'),_0xaeea98])['id']},{}));}return Promise[_0xbc00('0x57')](_0x308633);});})[_0xbc00('0x18')](respondWithResult(_0xa5e23d,0xc9))[_0xbc00('0x58')](handleError(_0xa5e23d,null));};exports['changePassword']=function(_0xd45b3b,_0x3a694b){if(_0xd45b3b['body']['id']){delete _0xd45b3b[_0xbc00('0x62')]['id'];}return db[_0xbc00('0x3e')][_0xbc00('0x37')]({'where':{'id':_0xd45b3b[_0xbc00('0x59')]['id']}})[_0xbc00('0x18')](function(_0x4a87f7){if(!_0x4a87f7)return null;if(_0x4a87f7['id']===_0xd45b3b[_0xbc00('0x30')]['id']){if(!_0xd45b3b[_0xbc00('0x62')][_0xbc00('0x92')]||!_0xd45b3b['body']['newPassword']){throw new db[(_0xbc00('0x93'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4a87f7[_0xbc00('0x94')](_0xd45b3b[_0xbc00('0x62')][_0xbc00('0x92')])){throw new db[(_0xbc00('0x93'))]['ValidationError'](_0xbc00('0x95'));}if(_0xd45b3b[_0xbc00('0x62')][_0xbc00('0x92')]===_0xd45b3b['body'][_0xbc00('0x96')]){throw new db[(_0xbc00('0x93'))][(_0xbc00('0x97'))](_0xbc00('0x98'));}}else if(_0xd45b3b[_0xbc00('0x30')]['role']===_0xbc00('0x2e')){if(!_0xd45b3b['body']['newPassword']){throw new db[(_0xbc00('0x93'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0xd45b3b[_0xbc00('0x30')][_0xbc00('0x2b')]===_0xbc00('0x30')){if(!_0xd45b3b['body'][_0xbc00('0x96')]){throw new db['Sequelize'][(_0xbc00('0x97'))](_0xbc00('0x99'));}if(_0x4a87f7[_0xbc00('0x2b')]!==_0xbc00('0x31')){throw new db[(_0xbc00('0x93'))][(_0xbc00('0x97'))]('Unauthorized');}}else{throw new db[(_0xbc00('0x93'))][(_0xbc00('0x97'))](_0xbc00('0x84'));}return _0x4a87f7;})[_0xbc00('0x18')](handleEntityNotFound(_0x3a694b,null))[_0xbc00('0x18')](function(_0x275f32){return db['Setting'][_0xbc00('0x9a')]({'attributes':['id',_0xbc00('0x6a'),'enforcePasswordHistory',_0xbc00('0x9b')]})[_0xbc00('0x18')](function(_0x5b8831){if(_0x5b8831[_0xbc00('0x6a')])authService['validatePasswordPattern'](_0xd45b3b[_0xbc00('0x62')][_0xbc00('0x96')]);if(!_0x5b8831['enforcePasswordHistory']||!_0x275f32[_0xbc00('0x9c')])return _0x275f32;authService[_0xbc00('0x9d')](_0xd45b3b[_0xbc00('0x62')][_0xbc00('0x96')],_0x275f32[_0xbc00('0x9c')],_0x5b8831[_0xbc00('0x9b')]);return _0x275f32;})[_0xbc00('0x18')](saveUpdates({'password':_0xd45b3b[_0xbc00('0x62')][_0xbc00('0x96')],'passwordResetAt':_0xd45b3b[_0xbc00('0x30')]['id']==_0xd45b3b[_0xbc00('0x59')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xd45b3b[_0xbc00('0x62')]['newPassword'],_0x275f32['previousPasswords'])},null));})[_0xbc00('0x18')](respondWithResult(_0x3a694b,null))['catch'](handleError(_0x3a694b,null));};exports[_0xbc00('0x9e')]=function(_0x38ec05,_0x253cb5){var _0x523478=_0x38ec05[_0xbc00('0x62')][_0xbc00('0x9f')];return db[_0xbc00('0x3e')][_0xbc00('0x37')]({'where':{'id':_0x38ec05[_0xbc00('0x59')]['id']},'attributes':['id',_0xbc00('0x38'),'role',_0xbc00('0xa0'),_0xbc00('0xa1'),_0xbc00('0xa2'),_0xbc00('0xa3')]})[_0xbc00('0x18')](handleEntityNotFound(_0x253cb5,null))[_0xbc00('0x18')](function(_0x450343){if(_0x450343){if(!utils[_0xbc00('0xa4')](_0x523478)){throw new db[(_0xbc00('0x93'))][(_0xbc00('0x97'))](_0xbc00('0xa5'));}return _0x450343['add'+_['capitalize'](_0x523478['toLowerCase']())+'Queues'](_0x38ec05[_0xbc00('0x62')]['ids'],{'penalty':_0x38ec05[_0xbc00('0x62')][_0xbc00('0xa6')]||0x0})[_0xbc00('0xa7')](function(_0x353d8d){for(var _0x3a37ef=0x0;_0x3a37ef<_0x38ec05['body']['ids'][_0xbc00('0x51')];_0x3a37ef+=0x1){var _0x4d5f42={'UserId':Number(_0x38ec05[_0xbc00('0x59')]['id'])};_0x4d5f42[_[_0xbc00('0xa8')](_0x523478['toLowerCase']())+_0xbc00('0xa9')]=Number(_0x38ec05[_0xbc00('0x62')][_0xbc00('0x66')][_0x3a37ef]);socket[_0xbc00('0xaa')](_0xbc00('0x30')+_[_0xbc00('0xa8')](_0x523478[_0xbc00('0xab')]())+_0xbc00('0xac'),_0x4d5f42);}return _0x353d8d;})[_0xbc00('0x18')](function(){if(_0x523478===_0xbc00('0xad')){return db[_0xbc00('0xae')][_0xbc00('0x4d')]({'where':{'id':_0x38ec05[_0xbc00('0x62')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x318597){var _0x5cfe79=_0x450343[_0xbc00('0xaf')]({'plain':!![]});var _0x4416ef=[];if(_0x523478===_0xbc00('0xad')&&_0x5cfe79[_0xbc00('0x2b')]===_0xbc00('0x31')&&_0x5cfe79['online']){for(let _0x3cfcb8=0x0;_0x3cfcb8<_0x318597[_0xbc00('0x51')];_0x3cfcb8+=0x1){_0x4416ef[_0xbc00('0x4c')]({'membername':_0x5cfe79[_0xbc00('0x38')],'UserId':_0x5cfe79['id'],'queue_name':_0x318597[_0x3cfcb8][_0xbc00('0x38')],'VoiceQueueId':_0x318597[_0x3cfcb8]['id'],'interface':_[_0xbc00('0x6c')](_0x5cfe79['interface'])?util[_0xbc00('0xb0')](_0xbc00('0xb1'),_0x5cfe79[_0xbc00('0x38')]):_0x5cfe79[_0xbc00('0xa3')],'paused':_0x5cfe79[_0xbc00('0xa2')]||![],'penalty':_0x38ec05[_0xbc00('0x62')][_0xbc00('0xa6')]||0x0});}return Promise['all'](_0x4416ef['map'](function(_0x322a89){return db[_0xbc00('0xb2')][_0xbc00('0xb3')](_0x322a89);}));}return _0x450343;});}})[_0xbc00('0x18')](respondWithStatusCode(_0x253cb5,null))[_0xbc00('0x58')](handleError(_0x253cb5,null));};exports[_0xbc00('0xb4')]=function(_0x2abcd9,_0x53f256){var _0x1fd171,_0x3a0d26;return db[_0xbc00('0x3e')][_0xbc00('0x37')]({'where':{'id':_0x2abcd9['params']['id']},'attributes':['id',_0xbc00('0x38'),'role']})['then'](handleEntityNotFound(_0x53f256,null))[_0xbc00('0x18')](function(_0x185a45){if(_0x185a45){_0x1fd171=_0x185a45;if(!_0x2abcd9[_0xbc00('0x47')][_0xbc00('0x9f')]||!utils[_0xbc00('0xa4')](_0x2abcd9[_0xbc00('0x47')][_0xbc00('0x9f')])){throw new db[(_0xbc00('0x93'))][(_0xbc00('0x97'))](_0xbc00('0xa5'));}return _0x185a45[_0xbc00('0xb5')+_[_0xbc00('0xa8')](_0x2abcd9[_0xbc00('0x47')]['channel'][_0xbc00('0xab')]())+_0xbc00('0xb6')](_0x2abcd9[_0xbc00('0x47')][_0xbc00('0x66')]);}})[_0xbc00('0x18')](function(_0x163878){if(_[_0xbc00('0xb7')](_0x2abcd9[_0xbc00('0x47')][_0xbc00('0x66')])){for(var _0x49fd05=0x0;_0x49fd05<_0x2abcd9[_0xbc00('0x47')]['ids'][_0xbc00('0x51')];_0x49fd05+=0x1){_0x3a0d26={'UserId':Number(_0x2abcd9[_0xbc00('0x59')]['id'])};_0x3a0d26[_[_0xbc00('0xa8')](_0x2abcd9[_0xbc00('0x47')][_0xbc00('0x9f')][_0xbc00('0xab')]())+_0xbc00('0xa9')]=Number(_0x2abcd9[_0xbc00('0x47')]['ids'][_0x49fd05]);socket['emit'](_0xbc00('0x30')+_[_0xbc00('0xa8')](_0x2abcd9[_0xbc00('0x47')]['channel'][_0xbc00('0xab')]())+'Queue:remove',_0x3a0d26);}}else{_0x3a0d26={'UserId':Number(_0x2abcd9['params']['id'])};_0x3a0d26[_['capitalize'](_0x2abcd9[_0xbc00('0x47')][_0xbc00('0x9f')]['toLowerCase']())+'QueueId']=Number(_0x2abcd9['query']['ids']);socket[_0xbc00('0xaa')]('user'+_[_0xbc00('0xa8')](_0x2abcd9[_0xbc00('0x47')][_0xbc00('0x9f')][_0xbc00('0xab')]())+_0xbc00('0xb8'),_0x3a0d26);}return _0x163878;})['then'](function(){if(_0x2abcd9[_0xbc00('0x47')][_0xbc00('0x9f')]==='voice'){return db[_0xbc00('0xb2')][_0xbc00('0x2d')]({'where':{'UserId':_0x2abcd9[_0xbc00('0x59')]['id'],'VoiceQueueId':_0x2abcd9[_0xbc00('0x47')][_0xbc00('0x66')]},'individualHooks':!![]})[_0xbc00('0x18')](function(){return _0x1fd171;});}return _0x1fd171;})[_0xbc00('0x18')](respondWithStatusCode(_0x53f256,null))[_0xbc00('0x58')](handleError(_0x53f256,null));};exports[_0xbc00('0xb9')]=function(_0x52be3a,_0x1fb59e){_0x52be3a[_0xbc00('0x62')]['userpic']=_0x52be3a[_0xbc00('0xba')][_0xbc00('0xbb')];return db[_0xbc00('0x3e')][_0xbc00('0x37')]({'where':{'id':_0x52be3a[_0xbc00('0x59')]['id']}})[_0xbc00('0x18')](handleEntityNotFound(_0x1fb59e,null))['then'](saveUpdates(_0x52be3a[_0xbc00('0x62')],null))[_0xbc00('0x18')](respondWithResult(_0x1fb59e,null))[_0xbc00('0x58')](handleError(_0x1fb59e,null));};exports[_0xbc00('0xbc')]=function(_0x2c852e,_0x5dc602){var _0x4018bd=path[_0xbc00('0xbd')](config[_0xbc00('0xbe')],_0xbc00('0xbf'));return db[_0xbc00('0x3e')][_0xbc00('0x37')]({'where':{'id':_0x2c852e['params']['id']},'attributes':['id',_0xbc00('0xc0')],'raw':!![]})['then'](handleEntityNotFound(_0x5dc602,null))[_0xbc00('0x18')](function(_0x150675){if(_0x150675){if(_[_0xbc00('0x6c')](_0x150675[_0xbc00('0xc0')])){return _0x5dc602['download'](_0x4018bd);}else{if(!fs[_0xbc00('0xc1')](path[_0xbc00('0xbd')](config['root'],_0xbc00('0xc2'),_0x150675[_0xbc00('0xc0')]))){return _0x5dc602[_0xbc00('0xc3')](_0x4018bd);}return _0x5dc602[_0xbc00('0xc3')](path[_0xbc00('0xbd')](config[_0xbc00('0xbe')],'server/files/images/',_0x150675[_0xbc00('0xc0')]));}}})[_0xbc00('0x58')](handleError(_0x5dc602,null));};exports[_0xbc00('0xc4')]=function(_0x2ce376,_0xbfff8e){return db[_0xbc00('0x3e')][_0xbc00('0x37')]({'where':{'id':_0x2ce376[_0xbc00('0x59')]['id']},'attributes':['id']})[_0xbc00('0x18')](handleEntityNotFound(_0xbfff8e,null))[_0xbc00('0x18')](function(_0x8f35ad){var _0x11ae83=[];values=_0x8f35ad[_0xbc00('0x53')];_0x11ae83[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x52'),_0x8f35ad[_0xbc00('0x53')]));_0x11ae83[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x61'),_0x8f35ad[_0xbc00('0x53')]));_0x11ae83[_0xbc00('0x4c')](get_open_tabs('openchannel',_0x8f35ad[_0xbc00('0x53')]));_0x11ae83[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x56'),_0x8f35ad[_0xbc00('0x53')]));_0x11ae83[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0x54'),_0x8f35ad['dataValues']));_0x11ae83[_0xbc00('0x4c')](get_open_tabs(_0xbc00('0xc5'),_0x8f35ad[_0xbc00('0x53')]));return Promise[_0xbc00('0x57')](_0x11ae83);})['then'](function(_0x56f688){if(_0x56f688){var _0x4486bd=_[_0xbc00('0x34')](values[_0xbc00('0xc6')],function(_0x4813a7){return{'channel':_0xbc00('0xc7'),'id':_0x4813a7['id'],'createdAt':_0x4813a7[_0xbc00('0xc8')]};});var _0x274481=_[_0xbc00('0x34')](values[_0xbc00('0xc9')],function(_0x5381e9){return{'channel':_0xbc00('0xca'),'id':_0x5381e9['id'],'createdAt':_0x5381e9[_0xbc00('0xc8')]};});var _0x44fcef=_[_0xbc00('0x34')](values[_0xbc00('0xcb')],function(_0x4ce182){return{'channel':_0xbc00('0xcc'),'id':_0x4ce182['id'],'createdAt':_0x4ce182['createdAt']};});var _0x4ed261=_[_0xbc00('0x34')](values['MailOpenTabs'],function(_0x4f8cee){return{'channel':_0xbc00('0xcd'),'id':_0x4f8cee['id'],'createdAt':_0x4f8cee[_0xbc00('0xc8')]};});var _0xfcbdde=_['map'](values['SmsOpenTabs'],function(_0x590c77){return{'channel':_0xbc00('0xce'),'id':_0x590c77['id'],'createdAt':_0x590c77['createdAt']};});var _0x5bc2de=_[_0xbc00('0x34')](values[_0xbc00('0xcf')],function(_0x34e6dc){return{'channel':_0xbc00('0xd0'),'id':_0x34e6dc['id'],'createdAt':_0x34e6dc[_0xbc00('0xc8')]};});var _0x504bc8=_['concat'](_0x4486bd,_0x274481,_0x44fcef,_0x4ed261,_0xfcbdde,_0x5bc2de);var _0x14ff2f={'count':_0x504bc8[_0xbc00('0x51')],'rows':_0x504bc8};return _0x14ff2f;}else return null;})[_0xbc00('0x18')](respondWithResult(_0xbfff8e,null))['catch'](handleError(_0xbfff8e,null));};exports[_0xbc00('0xd1')]=function(_0x278332,_0x3d540b){var _0xdffdd7={};return db[_0xbc00('0x3e')]['findOne']({'where':{'id':_0x278332[_0xbc00('0x59')]['id']}})[_0xbc00('0x18')](function(_0x5c1297){if(!_0x5c1297){throw new APINotFoundError(util[_0xbc00('0xb0')](_0xbc00('0xd2'),_0x278332[_0xbc00('0x59')]['id']));}return contacts['describe']();})[_0xbc00('0x18')](function(_0x4f198f){_0x278332['query'][_0xbc00('0x3e')]=_0x278332[_0xbc00('0x59')]['id'];_0xdffdd7=qs[_0xbc00('0x45')](_0x4f198f,_0x278332);if(_0x278332[_0xbc00('0x47')][_0xbc00('0xd3')](_0xbc00('0xd4'))){_0xdffdd7[_0xbc00('0x48')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db['Tag'],'as':_0xbc00('0xd5'),'attributes':['id',_0xbc00('0x38'),'color'],'where':_0x278332[_0xbc00('0x47')]['tag']?{'id':_0x278332[_0xbc00('0x47')][_0xbc00('0xd6')]}:undefined,'required':_0x278332[_0xbc00('0x47')][_0xbc00('0xd6')]?!![]:![]}];}return contacts[_0xbc00('0x4d')](_0x278332[_0xbc00('0x47')],_0x278332['user'],_0xdffdd7,_0x4f198f);})[_0xbc00('0x18')](respondWithFilteredResult(_0x3d540b,_0xdffdd7))[_0xbc00('0x58')](APIHandleError(_0x3d540b));};exports[_0xbc00('0xd7')]=function(_0x5b1c8a,_0x47606a){var _0x1b9056;var _0x230e39={};var _0x58608c;return db['User']['findOne']({'where':{'id':_0x5b1c8a[_0xbc00('0x59')]['id']},'attributes':['id',_0xbc00('0x38'),_0xbc00('0x2b')]})['then'](handleEntityNotFound(_0x47606a,null))[_0xbc00('0x18')](function(_0x4ebdcd){if(!utils[_0xbc00('0xa4')](_0x5b1c8a[_0xbc00('0x47')]['channel'])){throw new db[(_0xbc00('0x93'))][(_0xbc00('0x97'))](_0xbc00('0xa5'));}_0x1b9056=_0x4ebdcd;var _0x5d1582={};_0x5d1582['model']=_[_0xbc00('0x5c')](db[_[_0xbc00('0xa8')](_0x5b1c8a[_0xbc00('0x47')][_0xbc00('0x9f')])+_0xbc00('0xd8')][_0xbc00('0x3f')]);_0x5d1582[_0xbc00('0x47')]=_['keys'](_0x5b1c8a[_0xbc00('0x47')]);_0x5d1582['filters']=_['intersection'](_0x5d1582[_0xbc00('0x5a')],_0x5d1582['query']);_0x230e39[_0xbc00('0x4b')]=_[_0xbc00('0x5d')](_0x5d1582[_0xbc00('0x5a')],qs[_0xbc00('0x5e')](_0x5b1c8a[_0xbc00('0x47')][_0xbc00('0x5e')]));_0x230e39[_0xbc00('0x4b')]=_0x230e39['attributes'][_0xbc00('0x51')]?_0x230e39[_0xbc00('0x4b')]:_0x5d1582[_0xbc00('0x5a')];_0x230e39[_0xbc00('0xd9')]=qs[_0xbc00('0xda')](_0x5b1c8a['query'][_0xbc00('0xda')]);_0x230e39[_0xbc00('0x46')]=qs[_0xbc00('0xdb')](_[_0xbc00('0xdc')](_0x5b1c8a[_0xbc00('0x47')],_0x5d1582['filters']));if(_0x5b1c8a[_0xbc00('0x47')][_0xbc00('0x42')]){_0x230e39[_0xbc00('0x46')]=_['merge'](_0x230e39['where'],{'$or':_[_0xbc00('0x34')](_0x230e39[_0xbc00('0x4b')],function(_0x5d87ca){var _0x44c6e8={};_0x44c6e8[_0x5d87ca]={'$like':'%'+_0x5b1c8a[_0xbc00('0x47')]['filter']+'%'};return _0x44c6e8;})});}_0x230e39=_[_0xbc00('0x5f')]({},_0x230e39,_0x5b1c8a[_0xbc00('0x60')]);switch(_0x1b9056[_0xbc00('0x2b')]){case _0xbc00('0x2e'):return db[_[_0xbc00('0xa8')](_0x5b1c8a[_0xbc00('0x47')]['channel'])+_0xbc00('0xd8')][_0xbc00('0x4d')](_0x230e39);case _0xbc00('0x30'):case _0xbc00('0x31'):return _0x1b9056[_0xbc00('0xaf')+_[_0xbc00('0xa8')](_0x5b1c8a[_0xbc00('0x47')][_0xbc00('0x9f')])+'Queues'](_0x230e39);default:throw new db[(_0xbc00('0x93'))][(_0xbc00('0x97'))](_0xbc00('0xdd'));}})[_0xbc00('0x18')](function(_0x4c75fb){_0x58608c=_0x4c75fb['length'];if(!_0x5b1c8a[_0xbc00('0x47')]['hasOwnProperty'](_0xbc00('0xde'))){_0x230e39[_0xbc00('0x26')]=qs[_0xbc00('0x26')](_0x5b1c8a['query'][_0xbc00('0x26')]);_0x230e39['offset']=qs[_0xbc00('0x24')](_0x5b1c8a[_0xbc00('0x47')][_0xbc00('0x24')]);}switch(_0x1b9056['role']){case _0xbc00('0x2e'):return db[_[_0xbc00('0xa8')](_0x5b1c8a['query'][_0xbc00('0x9f')])+_0xbc00('0xd8')][_0xbc00('0x4d')](_0x230e39);case _0xbc00('0x30'):case _0xbc00('0x31'):return _0x1b9056['get'+_[_0xbc00('0xa8')](_0x5b1c8a[_0xbc00('0x47')]['channel'])+'Queues'](_0x230e39);}})[_0xbc00('0x18')](function(_0x47fffd){return{'count':_0x58608c,'rows':_0x47fffd};})[_0xbc00('0x18')](respondWithResult(_0x47606a,null))[_0xbc00('0x58')](handleError(_0x47606a,null));};exports[_0xbc00('0xdf')]=function(_0x2c5090,_0x2df41c){var _0x109b1c={};var _0x8a2f80={};var _0x247d20;var _0x37e6c6;return db[_0xbc00('0x3e')][_0xbc00('0x9a')]({'where':{'id':_0x2c5090[_0xbc00('0x59')]['id']}})['then'](handleEntityNotFound(_0x2df41c,null))[_0xbc00('0x18')](function(_0x4d8f46){if(_0x4d8f46){_0x247d20=_0x4d8f46;_0x8a2f80[_0xbc00('0x5a')]=_[_0xbc00('0x5c')](db['UserVoiceQueueRt']['rawAttributes']);_0x8a2f80[_0xbc00('0x47')]=_[_0xbc00('0x5c')](_0x2c5090[_0xbc00('0x47')]);_0x8a2f80[_0xbc00('0xdb')]=_[_0xbc00('0x5d')](_0x8a2f80[_0xbc00('0x5a')],_0x8a2f80[_0xbc00('0x47')]);_0x109b1c['attributes']=_[_0xbc00('0x5d')](_0x8a2f80[_0xbc00('0x5a')],qs[_0xbc00('0x5e')](_0x2c5090[_0xbc00('0x47')]['fields']));_0x109b1c[_0xbc00('0x4b')]=_0x109b1c[_0xbc00('0x4b')][_0xbc00('0x51')]?_0x109b1c[_0xbc00('0x4b')]:_0x8a2f80[_0xbc00('0x5a')];_0x109b1c['order']=qs['sort'](_0x2c5090[_0xbc00('0x47')][_0xbc00('0xda')]);_0x109b1c[_0xbc00('0x46')]=qs['filters'](_['pick'](_0x2c5090[_0xbc00('0x47')],_0x8a2f80['filters']));if(_0x2c5090[_0xbc00('0x47')][_0xbc00('0x42')]){_0x109b1c[_0xbc00('0x46')]=_['merge'](_0x109b1c['where'],{'$or':_[_0xbc00('0x34')](_0x109b1c[_0xbc00('0x4b')],function(_0x573957){var _0x5c6cc6={};_0x5c6cc6[_0x573957]={'$like':'%'+_0x2c5090['query'][_0xbc00('0x42')]+'%'};return _0x5c6cc6;})});}_0x109b1c=_[_0xbc00('0x5f')]({},_0x109b1c,_0x2c5090[_0xbc00('0x60')]);return _0x247d20[_0xbc00('0xdf')](_0x109b1c);}})['then'](function(_0x1c75b5){if(_0x1c75b5){_0x37e6c6=_0x1c75b5[_0xbc00('0x51')];if(!_0x2c5090['query'][_0xbc00('0xd3')](_0xbc00('0xde'))){_0x109b1c[_0xbc00('0x26')]=qs[_0xbc00('0x26')](_0x2c5090[_0xbc00('0x47')][_0xbc00('0x26')]);_0x109b1c[_0xbc00('0x24')]=qs[_0xbc00('0x24')](_0x2c5090[_0xbc00('0x47')][_0xbc00('0x24')]);}return _0x247d20[_0xbc00('0xdf')](_0x109b1c);}})[_0xbc00('0x18')](function(_0x118e13){if(_0x118e13){return _0x118e13?{'count':_0x37e6c6,'rows':_0x118e13}:null;}})[_0xbc00('0x18')](respondWithResult(_0x2df41c,null))[_0xbc00('0x58')](handleError(_0x2df41c,null));};exports[_0xbc00('0xe0')]=function(_0x23368f,_0x34b67b){var _0x118cce={};var _0x29457b={};var _0x6a2d4c;var _0x12cc18;return db[_0xbc00('0x3e')][_0xbc00('0x9a')]({'where':{'id':_0x23368f['params']['id']}})[_0xbc00('0x18')](handleEntityNotFound(_0x34b67b,null))[_0xbc00('0x18')](function(_0x3986bb){if(_0x3986bb){_0x6a2d4c=_0x3986bb;_0x29457b[_0xbc00('0x5a')]=_['keys'](db[_0xbc00('0xe1')][_0xbc00('0x3f')]);_0x29457b[_0xbc00('0x47')]=_['keys'](_0x23368f[_0xbc00('0x47')]);_0x29457b[_0xbc00('0xdb')]=_['intersection'](_0x29457b[_0xbc00('0x5a')],_0x29457b[_0xbc00('0x47')]);_0x118cce[_0xbc00('0x4b')]=_[_0xbc00('0x5d')](_0x29457b['model'],qs[_0xbc00('0x5e')](_0x23368f[_0xbc00('0x47')][_0xbc00('0x5e')]));_0x118cce[_0xbc00('0x4b')]=_0x118cce['attributes'][_0xbc00('0x51')]?_0x118cce['attributes']:_0x29457b['model'];_0x118cce[_0xbc00('0xd9')]=qs[_0xbc00('0xda')](_0x23368f[_0xbc00('0x47')]['sort']);_0x118cce[_0xbc00('0x46')]=qs[_0xbc00('0xdb')](_[_0xbc00('0xdc')](_0x23368f[_0xbc00('0x47')],_0x29457b['filters']));if(_0x23368f[_0xbc00('0x47')][_0xbc00('0x42')]){_0x118cce[_0xbc00('0x46')]=_[_0xbc00('0x5f')](_0x118cce[_0xbc00('0x46')],{'$or':_[_0xbc00('0x34')](_0x118cce[_0xbc00('0x4b')],function(_0x511767){var _0x2acbee={};_0x2acbee[_0x511767]={'$like':'%'+_0x23368f[_0xbc00('0x47')][_0xbc00('0x42')]+'%'};return _0x2acbee;})});}_0x118cce=_[_0xbc00('0x5f')]({},_0x118cce,_0x23368f[_0xbc00('0x60')]);return _0x6a2d4c['getGroups'](_0x118cce);}})[_0xbc00('0x18')](function(_0x301fcc){if(_0x301fcc){_0x12cc18=_0x301fcc['length'];if(!_0x23368f[_0xbc00('0x47')][_0xbc00('0xd3')]('nolimit')){_0x118cce['limit']=qs[_0xbc00('0x26')](_0x23368f['query'][_0xbc00('0x26')]);_0x118cce[_0xbc00('0x24')]=qs[_0xbc00('0x24')](_0x23368f[_0xbc00('0x47')][_0xbc00('0x24')]);}return _0x6a2d4c[_0xbc00('0xe0')](_0x118cce);}})[_0xbc00('0x18')](function(_0x44490b){if(_0x44490b){return _0x44490b?{'count':_0x12cc18,'rows':_0x44490b}:null;}})[_0xbc00('0x18')](respondWithResult(_0x34b67b,null))[_0xbc00('0x58')](handleError(_0x34b67b,null));};exports[_0xbc00('0xe2')]=function(_0x298451,_0x23e034){var _0x5dd949={'raw':!![],'where':{}};var _0x44be11={};var _0x3c0919={'count':0x0,'rows':[]};return db[_0xbc00('0x3e')][_0xbc00('0x9a')]({'where':{'id':_0x298451[_0xbc00('0x59')]['id']}})['then'](handleEntityNotFound(_0x23e034,null))[_0xbc00('0x18')](function(_0x4e2b1c){if(_0x4e2b1c){_0x44be11[_0xbc00('0x5a')]=_['keys'](db[_0xbc00('0xe3')]['rawAttributes']);_0x44be11[_0xbc00('0x47')]=_[_0xbc00('0x5c')](_0x298451['query']);_0x44be11[_0xbc00('0xdb')]=_['intersection'](_0x44be11['model'],_0x44be11[_0xbc00('0x47')]);_0x5dd949[_0xbc00('0x4b')]=_['intersection'](_0x44be11[_0xbc00('0x5a')],qs[_0xbc00('0x5e')](_0x298451[_0xbc00('0x47')][_0xbc00('0x5e')]));_0x5dd949[_0xbc00('0x4b')]=_0x5dd949[_0xbc00('0x4b')]['length']?_0x5dd949[_0xbc00('0x4b')]:_0x44be11[_0xbc00('0x5a')];if(!_0x298451[_0xbc00('0x47')][_0xbc00('0xd3')](_0xbc00('0xde'))){_0x5dd949[_0xbc00('0x26')]=qs['limit'](_0x298451[_0xbc00('0x47')]['limit']);_0x5dd949['offset']=qs['offset'](_0x298451[_0xbc00('0x47')][_0xbc00('0x24')]);}_0x5dd949['order']=qs['sort'](_0x298451[_0xbc00('0x47')][_0xbc00('0xda')]);_0x5dd949[_0xbc00('0x46')]=qs['filters'](_[_0xbc00('0xdc')](_0x298451[_0xbc00('0x47')],_0x44be11[_0xbc00('0xdb')]));_0x5dd949[_0xbc00('0x46')][_0xbc00('0xe4')]=_0x4e2b1c['id'];if(_0x298451[_0xbc00('0x47')][_0xbc00('0x42')]){_0x5dd949[_0xbc00('0x46')]=_[_0xbc00('0x5f')](_0x5dd949[_0xbc00('0x46')],{'$or':_[_0xbc00('0x34')](_0x5dd949[_0xbc00('0x4b')],function(_0x425fda){var _0x40f1fb={};_0x40f1fb[_0x425fda]={'$like':'%'+_0x298451[_0xbc00('0x47')][_0xbc00('0x42')]+'%'};return _0x40f1fb;})});}_0x5dd949=_['merge']({},_0x5dd949,_0x298451[_0xbc00('0x60')]);return db[_0xbc00('0xe3')][_0xbc00('0x27')]({'where':_0x5dd949[_0xbc00('0x46')]})[_0xbc00('0x18')](function(_0xb24c9e){_0x3c0919[_0xbc00('0x27')]=_0xb24c9e;if(_0x298451[_0xbc00('0x47')][_0xbc00('0xd4')]){_0x5dd949[_0xbc00('0x48')]=[{'all':!![]}];}return db[_0xbc00('0xe3')][_0xbc00('0x4d')](_0x5dd949);})['then'](function(_0x3c7625){_0x3c0919[_0xbc00('0x4e')]=_0x3c7625;return _0x3c0919;});}})[_0xbc00('0x18')](respondWithFilteredResult(_0x23e034,_0x5dd949))[_0xbc00('0x58')](handleError(_0x23e034,null));};exports[_0xbc00('0xe5')]=function(_0x2446be,_0x3c3e03){var _0x237f2c={'raw':!![],'where':{}};var _0x5cfca5={};var _0x43dad5={'count':0x0,'rows':[]};return db[_0xbc00('0x3e')][_0xbc00('0x9a')]({'where':{'id':_0x2446be[_0xbc00('0x59')]['id']}})[_0xbc00('0x18')](handleEntityNotFound(_0x3c3e03,null))[_0xbc00('0x18')](function(_0x293511){if(_0x293511){_0x5cfca5['model']=_[_0xbc00('0x5c')](db['ScreenRecording'][_0xbc00('0x3f')]);_0x5cfca5['query']=_[_0xbc00('0x5c')](_0x2446be[_0xbc00('0x47')]);_0x5cfca5[_0xbc00('0xdb')]=_[_0xbc00('0x5d')](_0x5cfca5['model'],_0x5cfca5[_0xbc00('0x47')]);_0x237f2c[_0xbc00('0x4b')]=_[_0xbc00('0x5d')](_0x5cfca5[_0xbc00('0x5a')],qs[_0xbc00('0x5e')](_0x2446be[_0xbc00('0x47')]['fields']));_0x237f2c[_0xbc00('0x4b')]=_0x237f2c[_0xbc00('0x4b')][_0xbc00('0x51')]?_0x237f2c[_0xbc00('0x4b')]:_0x5cfca5[_0xbc00('0x5a')];if(!_0x2446be[_0xbc00('0x47')]['hasOwnProperty'](_0xbc00('0xde'))){_0x237f2c[_0xbc00('0x26')]=qs[_0xbc00('0x26')](_0x2446be['query'][_0xbc00('0x26')]);_0x237f2c[_0xbc00('0x24')]=qs['offset'](_0x2446be[_0xbc00('0x47')][_0xbc00('0x24')]);}_0x237f2c['order']=qs['sort'](_0x2446be[_0xbc00('0x47')][_0xbc00('0xda')]);_0x237f2c[_0xbc00('0x46')]=qs[_0xbc00('0xdb')](_[_0xbc00('0xdc')](_0x2446be[_0xbc00('0x47')],_0x5cfca5[_0xbc00('0xdb')]));_0x237f2c[_0xbc00('0x46')][_0xbc00('0xe4')]=_0x293511['id'];if(_0x2446be[_0xbc00('0x47')][_0xbc00('0x42')]){_0x237f2c[_0xbc00('0x46')]=_['merge'](_0x237f2c['where'],{'$or':_[_0xbc00('0x34')](_0x237f2c[_0xbc00('0x4b')],function(_0x2967aa){var _0x313e7d={};_0x313e7d[_0x2967aa]={'$like':'%'+_0x2446be['query'][_0xbc00('0x42')]+'%'};return _0x313e7d;})});}_0x237f2c=_['merge']({},_0x237f2c,_0x2446be['options']);return db['ScreenRecording'][_0xbc00('0x27')]({'where':_0x237f2c[_0xbc00('0x46')]})[_0xbc00('0x18')](function(_0x7ff952){_0x43dad5[_0xbc00('0x27')]=_0x7ff952;if(_0x2446be[_0xbc00('0x47')]['includeAll']){_0x237f2c[_0xbc00('0x48')]=[{'all':!![]}];}return db[_0xbc00('0xe6')][_0xbc00('0x4d')](_0x237f2c);})['then'](function(_0x11c8c4){_0x43dad5[_0xbc00('0x4e')]=_0x11c8c4;return _0x43dad5;});}})[_0xbc00('0x18')](respondWithFilteredResult(_0x3c3e03,_0x237f2c))[_0xbc00('0x58')](handleError(_0x3c3e03,null));};exports[_0xbc00('0xe7')]=function(_0x56bef0,_0x3cdf5f){var _0x4d115b={};var _0x32918d={};var _0x415e43;var _0x2f7dbf;return db['User'][_0xbc00('0x9a')]({'where':{'id':_0x56bef0['params']['id']}})[_0xbc00('0x18')](handleEntityNotFound(_0x3cdf5f,null))[_0xbc00('0x18')](function(_0x4c2740){if(_0x4c2740){_0x415e43=_0x4c2740;_0x32918d['model']=_[_0xbc00('0x5c')](db[_0xbc00('0xe8')][_0xbc00('0x3f')]);_0x32918d[_0xbc00('0x47')]=_[_0xbc00('0x5c')](_0x56bef0[_0xbc00('0x47')]);_0x32918d[_0xbc00('0xdb')]=_[_0xbc00('0x5d')](_0x32918d[_0xbc00('0x5a')],_0x32918d['query']);_0x4d115b[_0xbc00('0x4b')]=_['intersection'](_0x32918d[_0xbc00('0x5a')],qs[_0xbc00('0x5e')](_0x56bef0[_0xbc00('0x47')][_0xbc00('0x5e')]));_0x4d115b[_0xbc00('0x4b')]=_0x4d115b[_0xbc00('0x4b')]['length']?_0x4d115b['attributes']:_0x32918d[_0xbc00('0x5a')];_0x4d115b[_0xbc00('0xd9')]=qs[_0xbc00('0xda')](_0x56bef0[_0xbc00('0x47')][_0xbc00('0xda')]);_0x4d115b[_0xbc00('0x46')]=qs[_0xbc00('0xdb')](_[_0xbc00('0xdc')](_0x56bef0[_0xbc00('0x47')],_0x32918d[_0xbc00('0xdb')]));if(_0x56bef0[_0xbc00('0x47')][_0xbc00('0x42')]){_0x4d115b[_0xbc00('0x46')]=_[_0xbc00('0x5f')](_0x4d115b[_0xbc00('0x46')],{'$or':_[_0xbc00('0x34')](_0x4d115b[_0xbc00('0x4b')],function(_0x10bf62){var _0x359a1b={};_0x359a1b[_0x10bf62]={'$like':'%'+_0x56bef0[_0xbc00('0x47')]['filter']+'%'};return _0x359a1b;})});}_0x4d115b=_['merge']({},_0x4d115b,_0x56bef0[_0xbc00('0x60')]);return _0x415e43['getChatInteractions'](_0x4d115b);}})[_0xbc00('0x18')](function(_0x18f9a8){if(_0x18f9a8){_0x2f7dbf=_0x18f9a8['length'];if(!_0x56bef0['query'][_0xbc00('0xd3')](_0xbc00('0xde'))){_0x4d115b['limit']=qs[_0xbc00('0x26')](_0x56bef0[_0xbc00('0x47')][_0xbc00('0x26')]);_0x4d115b[_0xbc00('0x24')]=qs['offset'](_0x56bef0[_0xbc00('0x47')][_0xbc00('0x24')]);}return _0x415e43['getChatInteractions'](_0x4d115b);}})[_0xbc00('0x18')](function(_0x2beb12){if(_0x2beb12){return _0x2beb12?{'count':_0x2f7dbf,'rows':_0x2beb12}:null;}})[_0xbc00('0x18')](respondWithResult(_0x3cdf5f,null))[_0xbc00('0x58')](handleError(_0x3cdf5f,null));};exports[_0xbc00('0xe9')]=function(_0x31c74b,_0x233c52){var _0x5e1917={};var _0x3cda3d={};var _0x59877b;var _0x4b7452;return db['User'][_0xbc00('0x9a')]({'where':{'id':_0x31c74b[_0xbc00('0x59')]['id']}})[_0xbc00('0x18')](handleEntityNotFound(_0x233c52,null))[_0xbc00('0x18')](function(_0x3c753b){if(_0x3c753b){_0x59877b=_0x3c753b;_0x3cda3d[_0xbc00('0x5a')]=_[_0xbc00('0x5c')](db[_0xbc00('0xea')]['rawAttributes']);_0x3cda3d['query']=_[_0xbc00('0x5c')](_0x31c74b[_0xbc00('0x47')]);_0x3cda3d[_0xbc00('0xdb')]=_['intersection'](_0x3cda3d[_0xbc00('0x5a')],_0x3cda3d['query']);_0x5e1917['attributes']=_[_0xbc00('0x5d')](_0x3cda3d[_0xbc00('0x5a')],qs['fields'](_0x31c74b['query'][_0xbc00('0x5e')]));_0x5e1917[_0xbc00('0x4b')]=_0x5e1917[_0xbc00('0x4b')][_0xbc00('0x51')]?_0x5e1917['attributes']:_0x3cda3d[_0xbc00('0x5a')];_0x5e1917['order']=qs['sort'](_0x31c74b[_0xbc00('0x47')]['sort']);_0x5e1917['where']=qs['filters'](_[_0xbc00('0xdc')](_0x31c74b[_0xbc00('0x47')],_0x3cda3d[_0xbc00('0xdb')]));if(_0x31c74b[_0xbc00('0x47')]['filter']){_0x5e1917[_0xbc00('0x46')]=_[_0xbc00('0x5f')](_0x5e1917[_0xbc00('0x46')],{'$or':_[_0xbc00('0x34')](_0x5e1917[_0xbc00('0x4b')],function(_0x181fd0){var _0x11761b={};_0x11761b[_0x181fd0]={'$like':'%'+_0x31c74b['query'][_0xbc00('0x42')]+'%'};return _0x11761b;})});}_0x5e1917=_['merge']({},_0x5e1917,_0x31c74b[_0xbc00('0x60')]);return _0x59877b[_0xbc00('0xe9')](_0x5e1917);}})[_0xbc00('0x18')](function(_0x1d36e4){if(_0x1d36e4){_0x4b7452=_0x1d36e4[_0xbc00('0x51')];if(!_0x31c74b[_0xbc00('0x47')][_0xbc00('0xd3')](_0xbc00('0xde'))){_0x5e1917[_0xbc00('0x26')]=qs[_0xbc00('0x26')](_0x31c74b[_0xbc00('0x47')]['limit']);_0x5e1917[_0xbc00('0x24')]=qs[_0xbc00('0x24')](_0x31c74b[_0xbc00('0x47')]['offset']);}return _0x59877b[_0xbc00('0xe9')](_0x5e1917);}})[_0xbc00('0x18')](function(_0x1ad75c){if(_0x1ad75c){return _0x1ad75c?{'count':_0x4b7452,'rows':_0x1ad75c}:null;}})[_0xbc00('0x18')](respondWithResult(_0x233c52,null))[_0xbc00('0x58')](handleError(_0x233c52,null));};exports['getMailInteractions']=function(_0x5d414a,_0x52a14c){var _0x2f15dd={'raw':!![],'where':{}};var _0x1284a7={};var _0x7cc21f={'count':0x0,'rows':[]};return db[_0xbc00('0x3e')]['findOne']({'where':{'id':_0x5d414a[_0xbc00('0x59')]['id']}})[_0xbc00('0x18')](handleEntityNotFound(_0x52a14c,null))[_0xbc00('0x18')](function(_0x3ef0c2){if(_0x3ef0c2){_0x1284a7['model']=_['keys'](db['MailInteraction']['rawAttributes']);_0x1284a7[_0xbc00('0x47')]=_['keys'](_0x5d414a[_0xbc00('0x47')]);_0x1284a7[_0xbc00('0xdb')]=_[_0xbc00('0x5d')](_0x1284a7['model'],_0x1284a7['query']);_0x2f15dd[_0xbc00('0x4b')]=_[_0xbc00('0x5d')](_0x1284a7['model'],qs[_0xbc00('0x5e')](_0x5d414a[_0xbc00('0x47')]['fields']));_0x2f15dd[_0xbc00('0x4b')]=_0x2f15dd[_0xbc00('0x4b')]['length']?_0x2f15dd[_0xbc00('0x4b')]:_0x1284a7[_0xbc00('0x5a')];if(!_0x5d414a[_0xbc00('0x47')][_0xbc00('0xd3')]('nolimit')){_0x2f15dd[_0xbc00('0x26')]=qs[_0xbc00('0x26')](_0x5d414a['query'][_0xbc00('0x26')]);_0x2f15dd['offset']=qs[_0xbc00('0x24')](_0x5d414a['query'][_0xbc00('0x24')]);}_0x2f15dd['order']=qs['sort'](_0x5d414a[_0xbc00('0x47')][_0xbc00('0xda')]);_0x2f15dd[_0xbc00('0x46')]=qs[_0xbc00('0xdb')](_[_0xbc00('0xdc')](_0x5d414a[_0xbc00('0x47')],_0x1284a7['filters']));_0x2f15dd['where']['UserId']=_0x3ef0c2['id'];if(_0x5d414a[_0xbc00('0x47')][_0xbc00('0x42')]){_0x2f15dd['where']=_[_0xbc00('0x5f')](_0x2f15dd['where'],{'$or':_[_0xbc00('0x34')](_0x2f15dd[_0xbc00('0x4b')],function(_0x5f594b){var _0x3df9ed={};_0x3df9ed[_0x5f594b]={'$like':'%'+_0x5d414a[_0xbc00('0x47')]['filter']+'%'};return _0x3df9ed;})});}_0x2f15dd=_[_0xbc00('0x5f')]({},_0x2f15dd,_0x5d414a[_0xbc00('0x60')]);return db[_0xbc00('0xeb')][_0xbc00('0x27')]({'where':_0x2f15dd[_0xbc00('0x46')]})[_0xbc00('0x18')](function(_0x26362a){_0x7cc21f[_0xbc00('0x27')]=_0x26362a;if(_0x5d414a[_0xbc00('0x47')]['includeAll']){_0x2f15dd[_0xbc00('0x48')]=[{'all':!![]}];}return db[_0xbc00('0xeb')][_0xbc00('0x4d')](_0x2f15dd);})[_0xbc00('0x18')](function(_0x57ed14){_0x7cc21f[_0xbc00('0x4e')]=_0x57ed14;return _0x7cc21f;});}})['then'](respondWithFilteredResult(_0x52a14c,_0x2f15dd))[_0xbc00('0x58')](handleError(_0x52a14c,null));};exports[_0xbc00('0xec')]=function(_0x5c126b,_0x5ec464){var _0x1eca68={};var _0xb95d08={};var _0x11072e;var _0x19fc15;return db[_0xbc00('0x3e')][_0xbc00('0x9a')]({'where':{'id':_0x5c126b[_0xbc00('0x59')]['id']}})['then'](handleEntityNotFound(_0x5ec464,null))[_0xbc00('0x18')](function(_0x5df34f){if(_0x5df34f){_0x11072e=_0x5df34f;_0xb95d08[_0xbc00('0x5a')]=_[_0xbc00('0x5c')](db[_0xbc00('0xed')][_0xbc00('0x3f')]);_0xb95d08['query']=_['keys'](_0x5c126b[_0xbc00('0x47')]);_0xb95d08['filters']=_[_0xbc00('0x5d')](_0xb95d08[_0xbc00('0x5a')],_0xb95d08[_0xbc00('0x47')]);_0x1eca68[_0xbc00('0x4b')]=_[_0xbc00('0x5d')](_0xb95d08['model'],qs[_0xbc00('0x5e')](_0x5c126b[_0xbc00('0x47')][_0xbc00('0x5e')]));_0x1eca68['attributes']=_0x1eca68[_0xbc00('0x4b')][_0xbc00('0x51')]?_0x1eca68['attributes']:_0xb95d08[_0xbc00('0x5a')];_0x1eca68[_0xbc00('0xd9')]=qs['sort'](_0x5c126b[_0xbc00('0x47')][_0xbc00('0xda')]);_0x1eca68[_0xbc00('0x46')]=qs[_0xbc00('0xdb')](_[_0xbc00('0xdc')](_0x5c126b[_0xbc00('0x47')],_0xb95d08[_0xbc00('0xdb')]));if(_0x5c126b[_0xbc00('0x47')][_0xbc00('0x42')]){_0x1eca68[_0xbc00('0x46')]=_[_0xbc00('0x5f')](_0x1eca68['where'],{'$or':_[_0xbc00('0x34')](_0x1eca68['attributes'],function(_0x4956b4){var _0x3b8033={};_0x3b8033[_0x4956b4]={'$like':'%'+_0x5c126b[_0xbc00('0x47')]['filter']+'%'};return _0x3b8033;})});}_0x1eca68=_[_0xbc00('0x5f')]({},_0x1eca68,_0x5c126b[_0xbc00('0x60')]);return _0x11072e[_0xbc00('0xec')](_0x1eca68);}})['then'](function(_0x41e60f){if(_0x41e60f){_0x19fc15=_0x41e60f[_0xbc00('0x51')];if(!_0x5c126b['query'][_0xbc00('0xd3')](_0xbc00('0xde'))){_0x1eca68['limit']=qs[_0xbc00('0x26')](_0x5c126b[_0xbc00('0x47')][_0xbc00('0x26')]);_0x1eca68[_0xbc00('0x24')]=qs[_0xbc00('0x24')](_0x5c126b[_0xbc00('0x47')][_0xbc00('0x24')]);}return _0x11072e[_0xbc00('0xec')](_0x1eca68);}})[_0xbc00('0x18')](function(_0x42d6c7){if(_0x42d6c7){return _0x42d6c7?{'count':_0x19fc15,'rows':_0x42d6c7}:null;}})['then'](respondWithResult(_0x5ec464,null))[_0xbc00('0x58')](handleError(_0x5ec464,null));};exports[_0xbc00('0xee')]=function(_0x907308,_0x5fb36a){var _0x17d341={};var _0x46ea0c={};var _0x12f6ee;var _0x4e195d;return db[_0xbc00('0x3e')][_0xbc00('0x9a')]({'where':{'id':_0x907308[_0xbc00('0x59')]['id']}})[_0xbc00('0x18')](handleEntityNotFound(_0x5fb36a,null))[_0xbc00('0x18')](function(_0x6b2969){if(_0x6b2969){_0x12f6ee=_0x6b2969;_0x46ea0c['model']=_[_0xbc00('0x5c')](db[_0xbc00('0xef')]['rawAttributes']);_0x46ea0c[_0xbc00('0x47')]=_['keys'](_0x907308[_0xbc00('0x47')]);_0x46ea0c[_0xbc00('0xdb')]=_[_0xbc00('0x5d')](_0x46ea0c['model'],_0x46ea0c['query']);_0x17d341[_0xbc00('0x4b')]=_[_0xbc00('0x5d')](_0x46ea0c[_0xbc00('0x5a')],qs[_0xbc00('0x5e')](_0x907308[_0xbc00('0x47')]['fields']));_0x17d341[_0xbc00('0x4b')]=_0x17d341['attributes'][_0xbc00('0x51')]?_0x17d341['attributes']:_0x46ea0c[_0xbc00('0x5a')];_0x17d341[_0xbc00('0xd9')]=qs[_0xbc00('0xda')](_0x907308['query']['sort']);_0x17d341[_0xbc00('0x46')]=qs['filters'](_[_0xbc00('0xdc')](_0x907308[_0xbc00('0x47')],_0x46ea0c[_0xbc00('0xdb')]));if(_0x907308[_0xbc00('0x47')][_0xbc00('0x42')]){_0x17d341[_0xbc00('0x46')]=_[_0xbc00('0x5f')](_0x17d341[_0xbc00('0x46')],{'$or':_['map'](_0x17d341['attributes'],function(_0x3d5ace){var _0x3e13d9={};_0x3e13d9[_0x3d5ace]={'$like':'%'+_0x907308[_0xbc00('0x47')][_0xbc00('0x42')]+'%'};return _0x3e13d9;})});}_0x17d341=_[_0xbc00('0x5f')]({},_0x17d341,_0x907308[_0xbc00('0x60')]);return _0x12f6ee['getFaxInteractions'](_0x17d341);}})[_0xbc00('0x18')](function(_0x3a0789){if(_0x3a0789){_0x4e195d=_0x3a0789[_0xbc00('0x51')];if(!_0x907308[_0xbc00('0x47')]['hasOwnProperty'](_0xbc00('0xde'))){_0x17d341[_0xbc00('0x26')]=qs[_0xbc00('0x26')](_0x907308[_0xbc00('0x47')]['limit']);_0x17d341['offset']=qs[_0xbc00('0x24')](_0x907308['query'][_0xbc00('0x24')]);}return _0x12f6ee['getFaxInteractions'](_0x17d341);}})['then'](function(_0x1d7062){if(_0x1d7062){return _0x1d7062?{'count':_0x4e195d,'rows':_0x1d7062}:null;}})[_0xbc00('0x18')](respondWithResult(_0x5fb36a,null))[_0xbc00('0x58')](handleError(_0x5fb36a,null));};exports[_0xbc00('0xf0')]=function(_0x1774ba,_0x166efb){var _0x2857b5={};var _0x252181={};var _0x10a552;var _0x4788fb;return db['User'][_0xbc00('0x9a')]({'where':{'id':_0x1774ba[_0xbc00('0x59')]['id']}})[_0xbc00('0x18')](handleEntityNotFound(_0x166efb,null))[_0xbc00('0x18')](function(_0x1534ce){if(_0x1534ce){_0x10a552=_0x1534ce;_0x252181[_0xbc00('0x5a')]=_[_0xbc00('0x5c')](db[_0xbc00('0xf1')][_0xbc00('0x3f')]);_0x252181[_0xbc00('0x47')]=_['keys'](_0x1774ba['query']);_0x252181[_0xbc00('0xdb')]=_['intersection'](_0x252181[_0xbc00('0x5a')],_0x252181[_0xbc00('0x47')]);_0x2857b5[_0xbc00('0x4b')]=_[_0xbc00('0x5d')](_0x252181[_0xbc00('0x5a')],qs[_0xbc00('0x5e')](_0x1774ba[_0xbc00('0x47')][_0xbc00('0x5e')]));_0x2857b5[_0xbc00('0x4b')]=_0x2857b5['attributes'][_0xbc00('0x51')]?_0x2857b5[_0xbc00('0x4b')]:_0x252181[_0xbc00('0x5a')];_0x2857b5[_0xbc00('0xd9')]=qs[_0xbc00('0xda')](_0x1774ba[_0xbc00('0x47')][_0xbc00('0xda')]);_0x2857b5[_0xbc00('0x46')]=qs[_0xbc00('0xdb')](_[_0xbc00('0xdc')](_0x1774ba[_0xbc00('0x47')],_0x252181['filters']));if(_0x1774ba[_0xbc00('0x47')][_0xbc00('0x42')]){_0x2857b5['where']=_['merge'](_0x2857b5[_0xbc00('0x46')],{'$or':_[_0xbc00('0x34')](_0x2857b5[_0xbc00('0x4b')],function(_0x19c26b){var _0x43ed82={};_0x43ed82[_0x19c26b]={'$like':'%'+_0x1774ba[_0xbc00('0x47')]['filter']+'%'};return _0x43ed82;})});}_0x2857b5=_[_0xbc00('0x5f')]({},_0x2857b5,_0x1774ba[_0xbc00('0x60')]);return _0x10a552['getWhatsappInteractions'](_0x2857b5);}})[_0xbc00('0x18')](function(_0x513cf3){if(_0x513cf3){_0x4788fb=_0x513cf3[_0xbc00('0x51')];if(!_0x1774ba[_0xbc00('0x47')]['hasOwnProperty'](_0xbc00('0xde'))){_0x2857b5['limit']=qs[_0xbc00('0x26')](_0x1774ba[_0xbc00('0x47')][_0xbc00('0x26')]);_0x2857b5[_0xbc00('0x24')]=qs[_0xbc00('0x24')](_0x1774ba[_0xbc00('0x47')][_0xbc00('0x24')]);}return _0x10a552[_0xbc00('0xf0')](_0x2857b5);}})[_0xbc00('0x18')](function(_0x3dba9c){if(_0x3dba9c){return _0x3dba9c?{'count':_0x4788fb,'rows':_0x3dba9c}:null;}})[_0xbc00('0x18')](respondWithResult(_0x166efb,null))['catch'](handleError(_0x166efb,null));};exports[_0xbc00('0xf2')]=function(_0xa6b179,_0x4eb0ca,_0x46bfec){var _0x5832f4;var _0x4bef2b;var _0x4e1c72;var _0x1198e5=!_[_0xbc00('0x6c')](_0xa6b179['params']['id'])?_0xa6b179['params']['id']:!_[_0xbc00('0x6c')](_0xa6b179['user']['id'])?_0xa6b179[_0xbc00('0x30')]['id']:null;return db[_0xbc00('0x3e')][_0xbc00('0x37')]({'where':{'id':_0x1198e5,'role':{'$or':[_0xbc00('0x2e'),'user',_0xbc00('0x31')]}},'attributes':['id',_0xbc00('0x38'),_0xbc00('0xf3'),_0xbc00('0xf4'),'role',_0xbc00('0x67'),_0xbc00('0xa1')]})[_0xbc00('0x18')](function(_0x3bed6e){if(_0x3bed6e){if(_0x3bed6e['role']===_0xbc00('0x31')){_0x5832f4=_0x3bed6e;if(_0xa6b179[_0xbc00('0x62')][_0xbc00('0xa3')]){_0x4e1c72=util[_0xbc00('0xb0')](_0xbc00('0xf5'),_0x5832f4[_0xa6b179[_0xbc00('0x62')][_0xbc00('0xa3')]]);}else if(_0xa6b179[_0xbc00('0x62')][_0xbc00('0xf6')]){_0x4e1c72=util[_0xbc00('0xb0')](_0xbc00('0xb1'),_0xa6b179[_0xbc00('0x62')]['intrf']);}else{_0x4e1c72=util['format'](_0xbc00('0xb1'),_0x5832f4[_0xbc00('0x38')]);}socket['to'](util['format'](_0xbc00('0xf7'),_0x5832f4[_0xbc00('0x38')]))['emit']('user:forcelogout',{'user':{'id':_0x5832f4['id'],'name':_0x5832f4[_0xbc00('0x38')]},'ip':_0xa6b179['headers']['x-forwarded-for']||_0xa6b179[_0xbc00('0xf8')][_0xbc00('0xf9')]||_0xa6b179[_0xbc00('0xfa')][_0xbc00('0xf9')]||_0xa6b179[_0xbc00('0xf8')][_0xbc00('0xfa')][_0xbc00('0xf9')]});return db['UserVoiceQueueRt'][_0xbc00('0x2d')]({'where':{'membername':_0x5832f4['name']},'individualHooks':!![]});}}else{throw new db[(_0xbc00('0x93'))][(_0xbc00('0x97'))](_0xbc00('0xfb'));}})[_0xbc00('0x18')](function(){if(_0x5832f4){return _0x5832f4[_0xbc00('0xfc')]({'raw':!![]});}})[_0xbc00('0x18')](function(_0x3c017e){if(_0x5832f4){if(_0x3c017e){_0x4bef2b=_0x3c017e;if(_0x4bef2b[_0xbc00('0x51')]){var _0x13ec30=_0x4bef2b['map'](function(_0xd936c0){var _0x10defc={'membername':_0x5832f4['name'],'UserId':_0x5832f4['id'],'queue_name':_0xd936c0[_0xbc00('0x38')],'VoiceQueueId':_0xd936c0['id'],'interface':_0x4e1c72,'paused':_0x5832f4[_0xbc00('0xa1')]||![],'penalty':_0xd936c0[_0xbc00('0xfd')]||0x0};return db[_0xbc00('0xb2')][_0xbc00('0xb3')](_0x10defc);});return Promise['all'](_0x13ec30);}}}})[_0xbc00('0x18')](function(){if(_0x5832f4){return db['MemberReport'][_0xbc00('0x4d')]({'where':{'membername':_0x5832f4[_0xbc00('0x38')],'exitAt':null}});}})['then'](function(_0xf3486){if(_0x5832f4){var _0x56bdfa=[];_0xf3486['forEach'](function(_0x32994d){_0x56bdfa[_0xbc00('0x4c')](_0x32994d['update']({'exitAt':moment()[_0xbc00('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xbc00('0x57')](_0x56bdfa);}})['then'](function(){if(_0x5832f4){var _0x269fb2=[];var _0x703865=[];var _0x5d272f=utils['getChannels']();var _0x1786ac={'membername':_0x5832f4[_0xbc00('0x38')],'interface':_0x4e1c72,'enterAt':moment()[_0xbc00('0xb0')](_0xbc00('0xfe')),'role':_0x5832f4[_0xbc00('0x2b')],'internal':_0x5832f4['internal']};_0x5d272f[_0xbc00('0xff')](function(_0x4a0175){_0x269fb2['push'](_[_0xbc00('0x5f')]({'channel':_0x4a0175,'type':'LOGIN','data1':_0xa6b179[_0xbc00('0x62')][_0xbc00('0x100')],'data2':_0x4e1c72},_0x1786ac));if(_0x5832f4[_0xbc00('0xa1')]){_0x703865['push'](_[_0xbc00('0x5f')]({'channel':_0x4a0175,'type':'PAUSE','data1':'LOGININPAUSE'},_0x1786ac));}});return db[_0xbc00('0x101')][_0xbc00('0x8b')](_0x269fb2[_0xbc00('0x102')](_0x703865),{'individualHooks':!![]});}})['then'](function(){if(_0x5832f4){return _0x5832f4[_0xbc00('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xbc00('0xb0')](_0xbc00('0xfe')),'voicePause':_0x5832f4[_0xbc00('0xa1')]||![],'mailPause':_0x5832f4[_0xbc00('0xa1')]||![],'chatPause':_0x5832f4[_0xbc00('0xa1')]||![],'faxPause':_0x5832f4[_0xbc00('0xa1')]||![],'smsPause':_0x5832f4[_0xbc00('0xa1')]||![],'openchannelPause':_0x5832f4[_0xbc00('0xa1')]||![],'whatsappPause':_0x5832f4[_0xbc00('0xa1')]||![],'pauseType':_0x5832f4[_0xbc00('0xa1')]?_0xbc00('0x103'):null,'interface':_0x4e1c72,'lastPauseAt':moment()['format'](_0xbc00('0xfe'))});}})[_0xbc00('0x18')](function(_0x26a567){if(_0xa6b179[_0xbc00('0x104')]){return _0x46bfec();}else{return Promise[_0xbc00('0x105')](_0x26a567)['then'](respondWithResult(_0x4eb0ca,null));}})[_0xbc00('0x58')](handleError(_0x4eb0ca,null));};exports[_0xbc00('0x106')]=function(_0x437c9d,_0x2a6ff9){var _0x1f23f4;return db[_0xbc00('0x3e')][_0xbc00('0x37')]({'where':{'id':_0x437c9d['params']['id'],'role':_0xbc00('0x31')},'attributes':['id',_0xbc00('0x38'),_0xbc00('0x2b')]})[_0xbc00('0x18')](handleEntityNotFound(_0x2a6ff9,null))[_0xbc00('0x18')](function(_0x13fc9b){if(_0x13fc9b){_0x1f23f4=_0x13fc9b;return db[_0xbc00('0xb2')][_0xbc00('0x2d')]({'where':{'membername':_0x1f23f4[_0xbc00('0x38')]},'individualHooks':!![]});}})[_0xbc00('0x18')](function(){return db[_0xbc00('0x101')][_0xbc00('0x4d')]({'where':{'membername':_0x1f23f4['name'],'exitAt':null}});})[_0xbc00('0x18')](function(_0x2bac63){var _0x1179db=[];_0x2bac63[_0xbc00('0xff')](function(_0x204898){_0x1179db[_0xbc00('0x4c')](_0x204898[_0xbc00('0x2a')]({'exitAt':moment()[_0xbc00('0xb0')](_0xbc00('0xfe'))}));});return Promise['all'](_0x1179db);})[_0xbc00('0x18')](function(){return _0x1f23f4[_0xbc00('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xbc00('0x18')](respondWithResult(_0x2a6ff9,null))[_0xbc00('0x58')](handleError(_0x2a6ff9,null));};exports['pause']=function(_0xcd2408,_0x531358){var _0x4289d3;return db[_0xbc00('0xb2')][_0xbc00('0x2a')]({'paused':0x1},{'where':{'UserId':_0xcd2408[_0xbc00('0x59')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xbc00('0x3e')]['find']({'where':{'id':_0xcd2408[_0xbc00('0x59')]['id'],'role':_0xbc00('0x31')},'attributes':['id',_0xbc00('0x38'),_0xbc00('0x2b'),_0xbc00('0x67'),_0xbc00('0xa3'),_0xbc00('0xa0')]});})[_0xbc00('0x18')](handleEntityNotFound(_0x531358,null))[_0xbc00('0x18')](function(_0x483754){if(_0x483754){_0x4289d3=_0x483754;return respondWithRpcPromise(_0xbc00('0x107'),'pause',{'id':_0x4289d3['id'],'name':_0x4289d3[_0xbc00('0x38')],'pause':!![]});}})[_0xbc00('0x18')](function(){if(_0x4289d3){return db['MemberReport'][_0xbc00('0x4d')]({'where':{'membername':_0x4289d3[_0xbc00('0x38')],'type':_0xbc00('0x108'),'exitAt':null}});}})[_0xbc00('0x18')](function(_0x4b9bfd){if(_0x4b9bfd['length']){var _0x5d9b6d=moment()[_0xbc00('0xb0')](_0xbc00('0xfe'));for(var _0x1cd20d=0x0,_0x4c7004=_0x4b9bfd[_0xbc00('0x51')];_0x1cd20d<_0x4c7004;_0x1cd20d++){_0x4b9bfd[_0x1cd20d][_0xbc00('0x109')]({'exitAt':_0x5d9b6d});}}})['then'](function(){var _0x552733=[];var _0x2c08c3=utils[_0xbc00('0x10a')]();_0x2c08c3['forEach'](function(_0x21c7ef){_0x552733[_0xbc00('0x4c')]({'channel':_0x21c7ef,'membername':_0x4289d3[_0xbc00('0x38')],'interface':_[_0xbc00('0x6c')](_0x4289d3['interface'])?util[_0xbc00('0xb0')](_0xbc00('0xb1'),_0x4289d3[_0xbc00('0x38')]):_0x4289d3[_0xbc00('0xa3')],'type':_0xbc00('0x108'),'enterAt':moment()[_0xbc00('0xb0')](_0xbc00('0xfe')),'data1':_0xcd2408[_0xbc00('0x62')][_0xbc00('0x10b')]||_0xbc00('0x10c'),'role':_0x4289d3[_0xbc00('0x2b')],'internal':_0x4289d3[_0xbc00('0x67')]});});return db[_0xbc00('0x101')][_0xbc00('0x8b')](_0x552733,{'individualHooks':!![]});})[_0xbc00('0x18')](function(){return _0x4289d3[_0xbc00('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xcd2408[_0xbc00('0x62')]['type']||_0xbc00('0x10c'),'lastPauseAt':moment()[_0xbc00('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xbc00('0x18')](respondWithResult(_0x531358,null))[_0xbc00('0x58')](handleError(_0x531358,null));};exports['unpause']=function(_0x2a6ba2,_0x3262f3){if(_0x2a6ba2[_0xbc00('0x62')][_0xbc00('0x9f')]&&!utils[_0xbc00('0xa4')](_0x2a6ba2[_0xbc00('0x62')]['channel'])){throw new APIBadRequestError(util[_0xbc00('0xb0')](_0xbc00('0x10d'),_0x2a6ba2[_0xbc00('0x62')]['channel']));}return db[_0xbc00('0x3e')][_0xbc00('0x37')]({'where':{'id':_0x2a6ba2[_0xbc00('0x59')]['id']},'attributes':['id','name',_0xbc00('0x2b'),_0xbc00('0x67'),_0xbc00('0xa3'),_0xbc00('0xa0'),_0xbc00('0xa2'),_0xbc00('0x10e'),'chatPause',_0xbc00('0x10f'),'openchannelPause','smsPause',_0xbc00('0x110'),'pauseType',_0xbc00('0x111')]})[_0xbc00('0x18')](function(_0x149141){if(!_0x149141){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x2a6ba2[_0xbc00('0x59')]['id']));}return _0x149141['unpause'](_0x2a6ba2[_0xbc00('0x62')][_0xbc00('0x9f')]);})[_0xbc00('0x18')](respondWithResult(_0x3262f3,null))[_0xbc00('0x58')](APIHandleError(_0x3262f3));};exports[_0xbc00('0x112')]=function(_0x1b4a88,_0x2fb785){var _0x22f232={};var _0xf72e9f={};var _0xc5f65e;var _0x1ed44a;return db[_0xbc00('0x3e')]['findOne']({'where':{'id':_0x1b4a88[_0xbc00('0x59')]['id']}})['then'](handleEntityNotFound(_0x2fb785,null))['then'](function(_0x1ee897){if(_0x1ee897){_0xc5f65e=_0x1ee897;_0xf72e9f[_0xbc00('0x5a')]=_[_0xbc00('0x5c')](db[_0xbc00('0x113')][_0xbc00('0x3f')]);_0xf72e9f[_0xbc00('0x47')]=_[_0xbc00('0x5c')](_0x1b4a88[_0xbc00('0x47')]);_0xf72e9f[_0xbc00('0xdb')]=_[_0xbc00('0x5d')](_0xf72e9f[_0xbc00('0x5a')],_0xf72e9f[_0xbc00('0x47')]);_0x22f232['attributes']=_[_0xbc00('0x5d')](_0xf72e9f['model'],qs[_0xbc00('0x5e')](_0x1b4a88['query'][_0xbc00('0x5e')]));_0x22f232[_0xbc00('0x4b')]=_0x22f232[_0xbc00('0x4b')][_0xbc00('0x51')]?_0x22f232[_0xbc00('0x4b')]:_0xf72e9f['model'];_0x22f232[_0xbc00('0xd9')]=qs[_0xbc00('0xda')](_0x1b4a88[_0xbc00('0x47')][_0xbc00('0xda')]);_0x22f232[_0xbc00('0x46')]=qs[_0xbc00('0xdb')](_[_0xbc00('0xdc')](_0x1b4a88[_0xbc00('0x47')],_0xf72e9f[_0xbc00('0xdb')]));if(_0x1b4a88[_0xbc00('0x47')]['filter']){_0x22f232[_0xbc00('0x46')]=_[_0xbc00('0x5f')](_0x22f232[_0xbc00('0x46')],{'$or':_[_0xbc00('0x34')](_0x22f232[_0xbc00('0x4b')],function(_0x4c4b39){var _0x29aadf={};_0x29aadf[_0x4c4b39]={'$like':'%'+_0x1b4a88[_0xbc00('0x47')][_0xbc00('0x42')]+'%'};return _0x29aadf;})});}_0x22f232=_[_0xbc00('0x5f')]({},_0x22f232,_0x1b4a88['options']);return _0xc5f65e['getTeams'](_0x22f232);}})[_0xbc00('0x18')](function(_0x5eb5f8){if(_0x5eb5f8){_0x1ed44a=_0x5eb5f8[_0xbc00('0x51')];if(!_0x1b4a88['query']['hasOwnProperty'](_0xbc00('0xde'))){_0x22f232[_0xbc00('0x26')]=qs['limit'](_0x1b4a88['query'][_0xbc00('0x26')]);_0x22f232[_0xbc00('0x24')]=qs['offset'](_0x1b4a88[_0xbc00('0x47')]['offset']);}return _0xc5f65e[_0xbc00('0x112')](_0x22f232);}})['then'](function(_0x386bbf){if(_0x386bbf){return _0x386bbf?{'count':_0x1ed44a,'rows':_0x386bbf}:null;}})[_0xbc00('0x18')](respondWithResult(_0x2fb785,null))['catch'](handleError(_0x2fb785,null));};exports[_0xbc00('0x114')]=function(_0x1efc21,_0x42cb39){var _0x33ff36=_0x1efc21['params']['id'];var _0x2b7ea1=_0x1efc21[_0xbc00('0x62')]?_0x1efc21[_0xbc00('0x62')]['ids']:null;var _0x5aefa9=[];return Promise[_0xbc00('0x105')]()[_0xbc00('0x18')](function(){if(!_0x2b7ea1)throw new APIBadRequestError(_0xbc00('0x115'));})[_0xbc00('0x18')](function(){return db[_0xbc00('0x3e')][_0xbc00('0x9a')]({'where':{'id':_0x33ff36}});})[_0xbc00('0x18')](function(_0x43a388){if(!_0x43a388)throw new APINotFoundError(util[_0xbc00('0xb0')](_0xbc00('0xd2'),_0x1efc21['params']['id']));return db[_0xbc00('0x6e')][_0xbc00('0x116')](function(_0x1b4274){return _0x43a388[_0xbc00('0x114')](_0x2b7ea1,{'transaction':_0x1b4274})[_0xbc00('0x18')](function(){return db['Team'][_0xbc00('0x4d')]({'where':{'id':{'$in':_0x2b7ea1}}});})[_0xbc00('0x18')](function(_0xe548b6){var _0x1fd212=_[_0xbc00('0x34')](_0xe548b6,function(_0x120372){return _0x120372[_0xbc00('0x117')]();});return Promise[_0xbc00('0x57')](_0x1fd212);})[_0xbc00('0x18')](function(_0x2bbdeb){_0x5aefa9=_[_0xbc00('0x118')](_0x2bbdeb);var _0x32ba02=_[_0xbc00('0x34')](_0x5aefa9,function(_0x3ceb2d){return _0x3ceb2d[_0xbc00('0x119')](_0x43a388['id'],{'transaction':_0x1b4274});});return Promise[_0xbc00('0x57')](_0x32ba02);})[_0xbc00('0x18')](function(){if(!_0x43a388['online'])return;var _0x380083=_[_0xbc00('0x42')](_0x5aefa9,function(_0x50f23e){return _0x50f23e[_0xbc00('0x11a')](_0xbc00('0x9f'))===_0xbc00('0x11b');});var _0x5d61ad=_['map'](_0x380083,function(_0x488f01){return db[_0xbc00('0xb2')]['upsert']({'membername':_0x43a388[_0xbc00('0x38')],'UserId':_0x43a388['id'],'queue_name':_0x488f01[_0xbc00('0x38')],'VoiceQueueId':_0x488f01['id'],'interface':_[_0xbc00('0x6c')](_0x43a388['interface'])?util['format'](_0xbc00('0xb1'),_0x43a388['name']):_0x43a388[_0xbc00('0xa3')],'paused':_0x43a388[_0xbc00('0xa2')]||![],'penalty':_0x43a388[_0xbc00('0xa6')]},{'transaction':_0x1b4274});});return Promise[_0xbc00('0x57')](_0x5d61ad);})[_0xbc00('0x18')](function(){return db[_0xbc00('0x11c')][_0xbc00('0x4d')]({'where':{'teamId':{'$in':_0x2b7ea1}}});})['then'](function(_0x4b881e){var _0xa4f9e5=_['map'](_0x4b881e,function(_0x5dc513){return db[_0xbc00('0x11d')]['create']({'UserId':_0x43a388['id'],'VoicePrefixId':_0x5dc513['VoicePrefixId']},{'transaction':_0x1b4274});});return Promise[_0xbc00('0x57')](_0xa4f9e5);});});})[_0xbc00('0x18')](function(){for(var _0x3f46de=0x0;_0x3f46de<_0x5aefa9[_0xbc00('0x51')];_0x3f46de++){var _0x1b5ede=_0x5aefa9[_0x3f46de]['getDataValue'](_0xbc00('0x9f'));var _0x2cb7d1=_0x1b5ede+_0xbc00('0xa9');socket['emit']('user'+_0x1b5ede+_0xbc00('0xac'),{'UserId':_0x33ff36,['queueField']:_0x5aefa9[_0x3f46de]['id']});}})[_0xbc00('0x18')](respondWithStatusCode(_0x42cb39,null))[_0xbc00('0x58')](APIHandleError(_0x42cb39));};exports[_0xbc00('0x11e')]=function(_0x431861,_0x6a25a3){var _0x5534d1=_0x431861[_0xbc00('0x59')]['id'];var _0x43c59c=null;if(_0x431861[_0xbc00('0x47')][_0xbc00('0x66')]){_0x43c59c=_[_0xbc00('0xb7')](_0x431861['query'][_0xbc00('0x66')])?_0x431861[_0xbc00('0x47')]['ids']:[_0x431861[_0xbc00('0x47')]['ids']];}var _0x542118=[];return Promise[_0xbc00('0x105')]()[_0xbc00('0x18')](function(){if(!_0x43c59c)throw new APIBadRequestError(_0xbc00('0x11f'));})['then'](function(){return db[_0xbc00('0x3e')][_0xbc00('0x9a')]({'where':{'id':_0x5534d1}});})['then'](function(_0x53b39c){if(!_0x53b39c)throw new APINotFoundError(util[_0xbc00('0xb0')](_0xbc00('0xd2'),_0x431861[_0xbc00('0x59')]['id']));return db[_0xbc00('0x6e')]['transaction'](function(_0x4640e4){return _0x53b39c['removeTeams'](_0x43c59c,{'transaction':_0x4640e4})[_0xbc00('0x18')](function(){return db[_0xbc00('0x113')][_0xbc00('0x4d')]({'where':{'id':{'$in':_0x43c59c}}});})[_0xbc00('0x18')](function(_0x54a93c){var _0x168a09=_['map'](_0x54a93c,function(_0x2a5776){return _0x2a5776[_0xbc00('0x117')]();});return Promise[_0xbc00('0x57')](_0x168a09);})[_0xbc00('0x18')](function(_0x4d2e16){_0x542118=_[_0xbc00('0x118')](_0x4d2e16);var _0x10526f=_['map'](_0x542118,function(_0x3b887d){return _0x3b887d[_0xbc00('0x120')](_0x53b39c['id'],{'transaction':_0x4640e4});});return Promise[_0xbc00('0x57')](_0x10526f);})[_0xbc00('0x18')](function(){if(!_0x53b39c['online'])return;var _0x1b32eb=_[_0xbc00('0x42')](_0x542118,function(_0x33b260){return _0x33b260[_0xbc00('0x11a')](_0xbc00('0x9f'))===_0xbc00('0x11b');});var _0x42b651=_['map'](_0x1b32eb,function(_0x5150ea){return db[_0xbc00('0xb2')][_0xbc00('0x2d')]({'where':{'VoiceQueueId':_0x5150ea['id'],'UserId':_0x53b39c['id']},'transaction':_0x4640e4});});return Promise[_0xbc00('0x57')](_0x42b651);})['then'](function(){return db[_0xbc00('0x11c')]['findAll']({'where':{'teamId':{'$in':_0x43c59c}}});})[_0xbc00('0x18')](function(_0x4242b4){var _0x32536f=_[_0xbc00('0x34')](_0x4242b4,function(_0x4c6de4){return db[_0xbc00('0x11d')][_0xbc00('0x2d')]({'where':{'UserId':_0x53b39c['id'],'VoicePrefixId':_0x4c6de4[_0xbc00('0x121')]}},{'transaction':_0x4640e4});});return Promise[_0xbc00('0x57')](_0x32536f);});});})[_0xbc00('0x18')](function(){for(var _0x1db114=0x0;_0x1db114<_0x542118[_0xbc00('0x51')];_0x1db114++){var _0x13e6e5=_0x542118[_0x1db114][_0xbc00('0x11a')]('channel');var _0x23984c=_0x13e6e5+_0xbc00('0xa9');socket[_0xbc00('0xaa')](_0xbc00('0x30')+_0x13e6e5+'Queue:remove',{'UserId':_0x5534d1,['queueField']:_0x542118[_0x1db114]['id']});}})[_0xbc00('0x18')](respondWithStatusCode(_0x6a25a3,null))[_0xbc00('0x58')](APIHandleError(_0x6a25a3));};exports[_0xbc00('0x122')]=function(_0x3bfd7a,_0x24ea54){var _0x3a2b84={};var _0x130479={};var _0x271537;var _0x4291b5;return db[_0xbc00('0x3e')][_0xbc00('0x9a')]({'where':{'id':_0x3bfd7a[_0xbc00('0x59')]['id']}})[_0xbc00('0x18')](handleEntityNotFound(_0x24ea54,null))[_0xbc00('0x18')](function(_0x240c24){if(_0x240c24){_0x271537=_0x240c24;_0x130479[_0xbc00('0x5a')]=_[_0xbc00('0x5c')](db[_0xbc00('0x123')][_0xbc00('0x3f')]);_0x130479[_0xbc00('0x47')]=_[_0xbc00('0x5c')](_0x3bfd7a['query']);_0x130479['filters']=_[_0xbc00('0x5d')](_0x130479['model'],_0x130479[_0xbc00('0x47')]);_0x3a2b84[_0xbc00('0x4b')]=_['intersection'](_0x130479[_0xbc00('0x5a')],qs[_0xbc00('0x5e')](_0x3bfd7a['query'][_0xbc00('0x5e')]));_0x3a2b84[_0xbc00('0x4b')]=_0x3a2b84[_0xbc00('0x4b')]['length']?_0x3a2b84[_0xbc00('0x4b')]:_0x130479[_0xbc00('0x5a')];_0x3a2b84[_0xbc00('0xd9')]=qs[_0xbc00('0xda')](_0x3bfd7a['query'][_0xbc00('0xda')]);_0x3a2b84[_0xbc00('0x46')]=qs[_0xbc00('0xdb')](_[_0xbc00('0xdc')](_0x3bfd7a[_0xbc00('0x47')],_0x130479[_0xbc00('0xdb')]));if(_0x3bfd7a[_0xbc00('0x47')]['filter']){_0x3a2b84['where']=_[_0xbc00('0x5f')](_0x3a2b84[_0xbc00('0x46')],{'$or':_[_0xbc00('0x34')](_0x3a2b84['attributes'],function(_0x913dd1){var _0x451516={};_0x451516[_0x913dd1]={'$like':'%'+_0x3bfd7a[_0xbc00('0x47')][_0xbc00('0x42')]+'%'};return _0x451516;})});}_0x3a2b84=_[_0xbc00('0x5f')]({},_0x3a2b84,_0x3bfd7a[_0xbc00('0x60')]);return _0x271537['getLists'](_0x3a2b84);}})[_0xbc00('0x18')](function(_0x636023){if(_0x636023){_0x4291b5=_0x636023[_0xbc00('0x51')];if(!_0x3bfd7a['query'][_0xbc00('0xd3')](_0xbc00('0xde'))){_0x3a2b84[_0xbc00('0x26')]=qs[_0xbc00('0x26')](_0x3bfd7a[_0xbc00('0x47')][_0xbc00('0x26')]);_0x3a2b84[_0xbc00('0x24')]=qs[_0xbc00('0x24')](_0x3bfd7a[_0xbc00('0x47')][_0xbc00('0x24')]);}return _0x271537['getLists'](_0x3a2b84);}})['then'](function(_0x17d007){if(_0x17d007){return _0x17d007?{'count':_0x4291b5,'rows':_0x17d007}:null;}})[_0xbc00('0x18')](respondWithResult(_0x24ea54,null))[_0xbc00('0x58')](handleError(_0x24ea54,null));};exports[_0xbc00('0x124')]=function(_0x5e0c47,_0x50d4fa){var _0x463e11={};var _0x66dc0f={};var _0x32e9b5;return db['User'][_0xbc00('0x9a')]({'where':{'id':_0x5e0c47[_0xbc00('0x59')]['id']}})['then'](handleEntityNotFound(_0x50d4fa,null))[_0xbc00('0x18')](function(_0x4a5d58){if(_0x4a5d58){_0x32e9b5=_0x4a5d58;_0x66dc0f[_0xbc00('0x5a')]=_[_0xbc00('0x5c')](db[_0xbc00('0x3e')][_0xbc00('0x3f')]);_0x66dc0f[_0xbc00('0x47')]=_[_0xbc00('0x5c')](_0x5e0c47[_0xbc00('0x47')]);_0x66dc0f[_0xbc00('0xdb')]=_[_0xbc00('0x5d')](_0x66dc0f['model'],_0x66dc0f[_0xbc00('0x47')]);_0x463e11['attributes']=_['intersection'](_0x66dc0f[_0xbc00('0x5a')],qs[_0xbc00('0x5e')](_0x5e0c47[_0xbc00('0x47')][_0xbc00('0x5e')]));_0x463e11[_0xbc00('0x4b')]=_0x463e11['attributes'][_0xbc00('0x51')]?_0x463e11[_0xbc00('0x4b')]:_0x66dc0f[_0xbc00('0x5a')];_0x463e11[_0xbc00('0xd9')]=qs[_0xbc00('0xda')](_0x5e0c47[_0xbc00('0x47')][_0xbc00('0xda')]);_0x463e11[_0xbc00('0x46')]=qs[_0xbc00('0xdb')](_[_0xbc00('0xdc')](_0x5e0c47[_0xbc00('0x47')],_0x66dc0f[_0xbc00('0xdb')]));if(_0x5e0c47[_0xbc00('0x47')]['filter']){_0x463e11[_0xbc00('0x46')]=_[_0xbc00('0x5f')](_0x463e11[_0xbc00('0x46')],{'$or':_['map'](_0x463e11[_0xbc00('0x4b')],function(_0x3d3661){var _0x4c1d89={};_0x4c1d89[_0x3d3661]={'$like':'%'+_0x5e0c47['query']['filter']+'%'};return _0x4c1d89;})});}_0x463e11[_0xbc00('0x5a')]=db['User'];_0x463e11['as']='Agents';_0x463e11=_['merge']({},_0x463e11,_0x5e0c47[_0xbc00('0x60')]);return _0x32e9b5[_0xbc00('0xfc')]({'include':[_0x463e11]});}})[_0xbc00('0x18')](function(_0x29d893){if(_0x29d893){var _0xa1c44={},_0x2a2e73=[];for(var _0x4efec0=0x0;_0x4efec0<_0x29d893['length'];_0x4efec0+=0x1){for(var _0x3316b5=0x0,_0x5a3a2b;_0x3316b5<_0x29d893[_0x4efec0][_0xbc00('0x89')][_0xbc00('0x51')];_0x3316b5+=0x1){_0x5a3a2b=_0x29d893[_0x4efec0][_0xbc00('0x89')][_0x3316b5]['get']({'plain':!![]});_0xa1c44[_0x5a3a2b['id']]=_0x5a3a2b;}}_0xa1c44=_['values'](_0xa1c44);for(var _0x10fa05=qs['offset'](_0x5e0c47['query'][_0xbc00('0x24')]);_0x10fa05<_0xa1c44[_0xbc00('0x51')]&&_0x2a2e73[_0xbc00('0x51')]=_0x4ff345[_0x7461('0x4f')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x7461('0x18')](function(){if(_0x1e31dd){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x1e31dd['name']},'individualHooks':!![]});}})[_0x7461('0x18')](function(){if(_0x1e31dd){return _0x1e31dd['getVoiceQueues']({'raw':!![]});}})[_0x7461('0x18')](function(_0x514855){if(_0x1e31dd){if(_0x514855){var _0x5708a4=[];_0x5cb3d8=_0x514855;if(_0x5cb3d8['length']){for(var _0x14cb75=0x0;_0x14cb75<_0x5cb3d8['length'];_0x14cb75++){_0x5708a4[_0x7461('0x32')](db[_0x7461('0x2a')][_0x7461('0x50')]({'membername':_0x1e31dd[_0x7461('0x23')],'UserId':_0x1e31dd['id'],'queue_name':_0x5cb3d8[_0x14cb75]['name'],'VoiceQueueId':_0x5cb3d8[_0x14cb75]['id'],'interface':_0x2f6291,'paused':_0x1e31dd[_0x7461('0x4b')]||![],'penalty':_0x5cb3d8[_0x14cb75][_0x7461('0x51')]||0x0}));}return BPromise[_0x7461('0x47')](_0x5708a4);}}}})[_0x7461('0x18')](function(){if(_0x1e31dd){return db[_0x7461('0x46')][_0x7461('0xf')]({'where':{'membername':_0x1e31dd[_0x7461('0x23')],'exitAt':null}});}})['then'](function(_0x512a66){if(_0x1e31dd){if(_0x512a66&&_0x512a66['length']){var _0x3652f0=[];_0x512a66[_0x7461('0x31')](function(_0x2ac989){_0x3652f0[_0x7461('0x32')](_0x2ac989[_0x7461('0x2b')]({'exitAt':moment()[_0x7461('0x27')](_0x7461('0x2e'))}));});return BPromise[_0x7461('0x47')](_0x3652f0);}}})[_0x7461('0x18')](function(){if(_0x1e31dd){var _0x1fd580=[];var _0x395b40=[];var _0x2edfe6=utils[_0x7461('0x30')]();var _0x15b6ef={'membername':_0x1e31dd[_0x7461('0x23')],'interface':_0x2f6291,'enterAt':moment()[_0x7461('0x27')](_0x7461('0x2e')),'role':_0x1e31dd[_0x7461('0x24')],'internal':_0x1e31dd[_0x7461('0x25')]};_0x2edfe6[_0x7461('0x31')](function(_0x403a9e){_0x1fd580['push'](_['merge']({'channel':_0x403a9e,'type':_0x7461('0x52'),'data1':'callysquare','data2':_0x2f6291},_0x15b6ef));if(_0x1e31dd[_0x7461('0x4b')]){_0x395b40[_0x7461('0x32')](_['merge']({'channel':_0x403a9e,'type':'PAUSE','data1':_0x7461('0x53')},_0x15b6ef));}});return db[_0x7461('0x46')]['bulkCreate'](_0x1fd580[_0x7461('0x54')](_0x395b40),{'individualHooks':!![]});}})[_0x7461('0x18')](function(){if(_0x1e31dd){return _0x1e31dd[_0x7461('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x7461('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1e31dd[_0x7461('0x4b')]||![],'mailPause':_0x1e31dd[_0x7461('0x4b')]||![],'chatPause':_0x1e31dd[_0x7461('0x4b')]||![],'faxPause':_0x1e31dd[_0x7461('0x4b')]||![],'smsPause':_0x1e31dd[_0x7461('0x4b')]||![],'openchannelPause':_0x1e31dd[_0x7461('0x4b')]||![],'pauseType':_0x1e31dd[_0x7461('0x4b')]?_0x7461('0x53'):null,'lastPauseAt':moment()[_0x7461('0x27')](_0x7461('0x2e')),'interface':_0x2f6291});}})['then'](function(_0x19e271){_0x2fa0dd(_0x19e271);})['catch'](function(_0x42b910){_0x4fe671(_0xb29665[_0x7461('0x1a')](0x1f4,_0x42b910[_0x7461('0x1b')]));});});}; \ No newline at end of file +var _0xe882=['lastPauseAt','unpause','system','LogoutUser','forEach','all','LoginUser','User','mobile','phone','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','getChannels','LOGIN','callysquare','LOGININPAUSE','concat','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','./user.socket','register','GetUser','findAll','options','raw','attributes','limit','include','model','map','then','debug','error','message','ShowUser','find','where','info','stringify','catch','name','role','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','push','SIP/%s','PAUSE','body','type','internal','uniqueid','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause'];(function(_0xcd4d13,_0x44acd7){var _0x411fe8=function(_0x341835){while(--_0x341835){_0xcd4d13['push'](_0xcd4d13['shift']());}};_0x411fe8(++_0x44acd7);}(_0xe882,0x1cb));var _0x2e88=function(_0x542b78,_0x458e70){_0x542b78=_0x542b78-0x0;var _0x5b14f2=_0xe882[_0x542b78];return _0x5b14f2;};'use strict';var _=require('lodash');var util=require(_0x2e88('0x0'));var moment=require(_0x2e88('0x1'));var BPromise=require('bluebird');var Redis=require(_0x2e88('0x2'));var db=require(_0x2e88('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e88('0x4'))(_0x2e88('0x5'));var config=require(_0x2e88('0x6'));config['redis']=_['defaults'](config[_0x2e88('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x2e88('0x8'))(new Redis(config[_0x2e88('0x7')]));require(_0x2e88('0x9'))[_0x2e88('0xa')](socket);exports[_0x2e88('0xb')]=function(_0x164226){var _0x55c7a3=this;return new Promise(function(_0x406ae7,_0x69fa82){return db['User'][_0x2e88('0xc')]({'raw':_0x164226[_0x2e88('0xd')]?_0x164226[_0x2e88('0xd')][_0x2e88('0xe')]===undefined?!![]:![]:!![],'where':_0x164226[_0x2e88('0xd')]?_0x164226['options']['where']||null:null,'attributes':_0x164226[_0x2e88('0xd')]?_0x164226[_0x2e88('0xd')][_0x2e88('0xf')]||null:null,'limit':_0x164226[_0x2e88('0xd')]?_0x164226[_0x2e88('0xd')][_0x2e88('0x10')]||null:null,'include':_0x164226['options']?_0x164226[_0x2e88('0xd')][_0x2e88('0x11')]?_['map'](_0x164226[_0x2e88('0xd')][_0x2e88('0x11')],function(_0x5af376){return{'model':db[_0x5af376[_0x2e88('0x12')]],'as':_0x5af376['as'],'attributes':_0x5af376[_0x2e88('0xf')],'include':_0x5af376[_0x2e88('0x11')]?_[_0x2e88('0x13')](_0x5af376[_0x2e88('0x11')],function(_0x23996d){return{'model':db[_0x23996d['model']],'as':_0x23996d['as'],'attributes':_0x23996d[_0x2e88('0xf')],'include':_0x23996d[_0x2e88('0x11')]?_[_0x2e88('0x13')](_0x23996d[_0x2e88('0x11')],function(_0xaf4448){return{'model':db[_0xaf4448[_0x2e88('0x12')]],'as':_0xaf4448['as'],'attributes':_0xaf4448[_0x2e88('0xf')]};}):[]};}):[]};}):[]:[]})[_0x2e88('0x14')](function(_0x26233b){logger['info']('GetUser',_0x164226);logger[_0x2e88('0x15')]('GetUser',_0x164226,JSON['stringify'](_0x26233b));_0x406ae7(_0x26233b);})['catch'](function(_0x26b1cb){logger['error'](_0x2e88('0xb'),_0x26b1cb['message'],_0x164226);_0x69fa82(_0x55c7a3[_0x2e88('0x16')](0x1f4,_0x26b1cb[_0x2e88('0x17')]));});});};exports[_0x2e88('0x18')]=function(_0x2c8791){var _0x14cb68=this;return new Promise(function(_0x36a3b1,_0x1f98b8){return db['User'][_0x2e88('0x19')]({'raw':_0x2c8791[_0x2e88('0xd')]?_0x2c8791[_0x2e88('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x2c8791['options']?_0x2c8791[_0x2e88('0xd')][_0x2e88('0x1a')]||null:null,'attributes':_0x2c8791[_0x2e88('0xd')]?_0x2c8791['options']['attributes']||null:null,'include':_0x2c8791[_0x2e88('0xd')]?_0x2c8791[_0x2e88('0xd')][_0x2e88('0x11')]?_['map'](_0x2c8791[_0x2e88('0xd')][_0x2e88('0x11')],function(_0x3ab2e1){return{'model':db[_0x3ab2e1[_0x2e88('0x12')]],'as':_0x3ab2e1['as'],'attributes':_0x3ab2e1['attributes'],'include':_0x3ab2e1[_0x2e88('0x11')]?_[_0x2e88('0x13')](_0x3ab2e1[_0x2e88('0x11')],function(_0x55b644){return{'model':db[_0x55b644['model']],'as':_0x55b644['as'],'attributes':_0x55b644[_0x2e88('0xf')],'include':_0x55b644[_0x2e88('0x11')]?_[_0x2e88('0x13')](_0x55b644[_0x2e88('0x11')],function(_0x4e0572){return{'model':db[_0x4e0572['model']],'as':_0x4e0572['as'],'attributes':_0x4e0572[_0x2e88('0xf')]};}):[]};}):[]};}):[]:[]})[_0x2e88('0x14')](function(_0x4d1396){logger[_0x2e88('0x1b')](_0x2e88('0x18'),_0x2c8791);logger[_0x2e88('0x15')](_0x2e88('0x18'),_0x2c8791,JSON[_0x2e88('0x1c')](_0x4d1396));_0x36a3b1(_0x4d1396);})[_0x2e88('0x1d')](function(_0x3a690d){logger[_0x2e88('0x16')](_0x2e88('0x18'),_0x3a690d[_0x2e88('0x17')],_0x2c8791);_0x1f98b8(_0x14cb68[_0x2e88('0x16')](0x1f4,_0x3a690d[_0x2e88('0x17')]));});});};exports['PauseUser']=function(_0x33833a){var _0x485e8b;return db['User'][_0x2e88('0x19')]({'where':_0x33833a[_0x2e88('0xd')]['where']||{},'attributes':['id',_0x2e88('0x1e'),_0x2e88('0x1f'),'internal',_0x2e88('0x20')]})[_0x2e88('0x14')](function(_0x53f3a1){if(!_0x53f3a1){throw new Error(util[_0x2e88('0x21')](_0x2e88('0x22'),_0x33833a[_0x2e88('0x23')]['id']));}_0x485e8b=_0x53f3a1;return db[_0x2e88('0x24')][_0x2e88('0x25')]({'paused':0x1},{'where':{'UserId':_0x485e8b['id']},'individualHooks':!![]});})[_0x2e88('0x14')](function(){return db[_0x2e88('0x26')][_0x2e88('0xc')]({'where':{'membername':_0x485e8b[_0x2e88('0x1e')],'type':'PAUSE','exitAt':null}});})[_0x2e88('0x14')](function(_0x6f8ce2){if(_0x6f8ce2&&_0x6f8ce2[_0x2e88('0x27')]){var _0x58dd39=moment()[_0x2e88('0x21')](_0x2e88('0x28'));for(var _0x158d97=0x0,_0x4c6892=_0x6f8ce2['length'];_0x158d97<_0x4c6892;_0x158d97++){_0x6f8ce2[_0x158d97][_0x2e88('0x29')]({'exitAt':_0x58dd39});}}})['then'](function(){var _0x4ffef9=[];var _0x1bc4c2=utils['getChannels']();_0x1bc4c2['forEach'](function(_0x18287b){_0x4ffef9[_0x2e88('0x2a')]({'channel':_0x18287b,'membername':_0x485e8b['name'],'interface':_['isNil'](_0x485e8b[_0x2e88('0x20')])?util[_0x2e88('0x21')](_0x2e88('0x2b'),_0x485e8b[_0x2e88('0x1e')]):_0x485e8b[_0x2e88('0x20')],'type':_0x2e88('0x2c'),'enterAt':moment()['format'](_0x2e88('0x28')),'data1':_0x33833a[_0x2e88('0x2d')][_0x2e88('0x2e')]||'DEFAULT\x20PAUSE','role':_0x485e8b[_0x2e88('0x1f')],'internal':_0x485e8b[_0x2e88('0x2f')],'uniqueid':_0x33833a['body'][_0x2e88('0x30')]||null});});return db[_0x2e88('0x26')][_0x2e88('0x31')](_0x4ffef9,{'individualHooks':!![]});})['then'](function(){return _0x485e8b[_0x2e88('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x33833a[_0x2e88('0x2d')]['type']||_0x2e88('0x32'),'lastPauseAt':moment()[_0x2e88('0x21')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2e88('0x1d')](function(_0x2c7839){throw _0x2c7839;});};exports[_0x2e88('0x33')]=function(_0x17f787){return Promise[_0x2e88('0x34')]()['then'](function(){if(_0x17f787[_0x2e88('0x2d')][_0x2e88('0x35')]&&!utils[_0x2e88('0x36')](_0x17f787['body'][_0x2e88('0x35')])){throw new Error(util[_0x2e88('0x21')](_0x2e88('0x37'),_0x17f787[_0x2e88('0x2d')][_0x2e88('0x35')]));}return db['User'][_0x2e88('0x38')]({'where':_0x17f787[_0x2e88('0xd')]['where']||{},'attributes':['id','name',_0x2e88('0x1f'),_0x2e88('0x2f'),_0x2e88('0x20'),'online','voicePause',_0x2e88('0x39'),_0x2e88('0x3a'),_0x2e88('0x3b'),_0x2e88('0x3c'),_0x2e88('0x3d'),_0x2e88('0x3e'),'pauseType',_0x2e88('0x3f')]});})[_0x2e88('0x14')](function(_0x435264){if(!_0x435264){throw new Error(util[_0x2e88('0x21')](_0x2e88('0x22'),_0x17f787[_0x2e88('0x23')]['id']));}return _0x435264[_0x2e88('0x40')](_0x17f787[_0x2e88('0x2d')]['channel'],_0x2e88('0x41'));})[_0x2e88('0x1d')](function(_0x250433){throw _0x250433;});};exports[_0x2e88('0x42')]=function(_0x12aaf2){var _0x15d392=this;return new Promise(function(_0x3be4a0,_0x605d84){var _0x43358e;return db['User']['findOne']({'where':_0x12aaf2[_0x2e88('0xd')][_0x2e88('0x1a')]||{},'attributes':['id',_0x2e88('0x1e')]})[_0x2e88('0x14')](function(_0x5d1295){if(_0x5d1295){_0x43358e=_0x5d1295;return db[_0x2e88('0x24')]['destroy']({'where':{'membername':_0x43358e[_0x2e88('0x1e')]},'individualHooks':!![]});}})[_0x2e88('0x14')](function(){if(_0x43358e){return db['MemberReport'][_0x2e88('0xc')]({'where':{'membername':_0x43358e[_0x2e88('0x1e')],'exitAt':null}});}})[_0x2e88('0x14')](function(_0x1bd578){if(_0x43358e){if(_0x1bd578&&_0x1bd578[_0x2e88('0x27')]){var _0x36b656=[];_0x1bd578[_0x2e88('0x43')](function(_0x17a7f5){_0x36b656[_0x2e88('0x2a')](_0x17a7f5[_0x2e88('0x25')]({'exitAt':moment()['format'](_0x2e88('0x28'))}));});return BPromise[_0x2e88('0x44')](_0x36b656);}}})[_0x2e88('0x14')](function(){if(_0x43358e){return _0x43358e[_0x2e88('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x2e88('0x14')](function(_0x41aa6e){_0x3be4a0(_0x41aa6e);})[_0x2e88('0x1d')](function(_0x5d5802){_0x605d84(_0x15d392[_0x2e88('0x16')](0x1f4,_0x5d5802['message']));});});};exports[_0x2e88('0x45')]=function(_0x361ffb){var _0x707d96=this;return new Promise(function(_0x5cea62,_0xbd5f4d){var _0x380bf5;var _0x48131f;var _0x50b9a3;var _0x4c98f2;return db[_0x2e88('0x46')][_0x2e88('0x38')]({'where':_0x361ffb[_0x2e88('0xd')][_0x2e88('0x1a')]||{},'attributes':['id',_0x2e88('0x1e'),_0x2e88('0x1f'),_0x2e88('0x47'),_0x2e88('0x48'),'internal',_0x2e88('0x49'),'interface']})[_0x2e88('0x14')](function(_0x55cf64){if(_0x55cf64){_0x380bf5=_0x55cf64;_0x4c98f2=_0x361ffb[_0x2e88('0x2d')][_0x2e88('0x20')]?_0x361ffb[_0x2e88('0x2d')][_0x2e88('0x20')]:util[_0x2e88('0x21')](_0x2e88('0x2b'),_0x380bf5['name']);return db[_0x2e88('0x46')]['count']({'where':{'role':_0x2e88('0x4a'),'online':!![],'id':{'$ne':_0x380bf5['id']}}});}})[_0x2e88('0x14')](function(_0x40df75){if(_0x40df75){_0x50b9a3=_0x40df75;return require(_0x2e88('0x4b'))[_0x2e88('0x4c')]();}})[_0x2e88('0x14')](function(_0x3c93b2){if(_0x3c93b2&&_0x3c93b2[_0x2e88('0x4d')]&&_0x50b9a3>=_0x3c93b2[_0x2e88('0x4d')]){throw new Error(_0x2e88('0x4e'));}})['then'](function(){if(_0x380bf5){return db[_0x2e88('0x24')][_0x2e88('0x4f')]({'where':{'membername':_0x380bf5[_0x2e88('0x1e')]},'individualHooks':!![]});}})['then'](function(){if(_0x380bf5){return _0x380bf5[_0x2e88('0x50')]({'raw':!![]});}})['then'](function(_0x226a52){if(_0x380bf5){if(_0x226a52){var _0x5bd507=[];_0x48131f=_0x226a52;if(_0x48131f[_0x2e88('0x27')]){for(var _0x58e215=0x0;_0x58e215<_0x48131f[_0x2e88('0x27')];_0x58e215++){_0x5bd507[_0x2e88('0x2a')](db['UserVoiceQueueRt'][_0x2e88('0x51')]({'membername':_0x380bf5['name'],'UserId':_0x380bf5['id'],'queue_name':_0x48131f[_0x58e215][_0x2e88('0x1e')],'VoiceQueueId':_0x48131f[_0x58e215]['id'],'interface':_0x4c98f2,'paused':_0x380bf5[_0x2e88('0x49')]||![],'penalty':_0x48131f[_0x58e215]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x5bd507);}}}})[_0x2e88('0x14')](function(){if(_0x380bf5){return db[_0x2e88('0x26')]['findAll']({'where':{'membername':_0x380bf5[_0x2e88('0x1e')],'exitAt':null}});}})['then'](function(_0x4eda85){if(_0x380bf5){if(_0x4eda85&&_0x4eda85[_0x2e88('0x27')]){var _0x5087b5=[];_0x4eda85['forEach'](function(_0x1fe6b3){_0x5087b5['push'](_0x1fe6b3[_0x2e88('0x25')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2e88('0x44')](_0x5087b5);}}})[_0x2e88('0x14')](function(){if(_0x380bf5){var _0x273557=[];var _0xe5e1f0=[];var _0x8425f8=utils[_0x2e88('0x52')]();var _0x40644e={'membername':_0x380bf5[_0x2e88('0x1e')],'interface':_0x4c98f2,'enterAt':moment()[_0x2e88('0x21')](_0x2e88('0x28')),'role':_0x380bf5['role'],'internal':_0x380bf5[_0x2e88('0x2f')]};_0x8425f8[_0x2e88('0x43')](function(_0x714fb1){_0x273557[_0x2e88('0x2a')](_['merge']({'channel':_0x714fb1,'type':_0x2e88('0x53'),'data1':_0x2e88('0x54'),'data2':_0x4c98f2},_0x40644e));if(_0x380bf5['loginInPause']){_0xe5e1f0['push'](_['merge']({'channel':_0x714fb1,'type':_0x2e88('0x2c'),'data1':_0x2e88('0x55')},_0x40644e));}});return db[_0x2e88('0x26')][_0x2e88('0x31')](_0x273557[_0x2e88('0x56')](_0xe5e1f0),{'individualHooks':!![]});}})[_0x2e88('0x14')](function(){if(_0x380bf5){return _0x380bf5[_0x2e88('0x25')]({'online':!![],'lastLoginAt':moment()[_0x2e88('0x21')](_0x2e88('0x28')),'voicePause':_0x380bf5['loginInPause']||![],'mailPause':_0x380bf5[_0x2e88('0x49')]||![],'chatPause':_0x380bf5[_0x2e88('0x49')]||![],'faxPause':_0x380bf5['loginInPause']||![],'smsPause':_0x380bf5[_0x2e88('0x49')]||![],'openchannelPause':_0x380bf5[_0x2e88('0x49')]||![],'pauseType':_0x380bf5['loginInPause']?_0x2e88('0x55'):null,'lastPauseAt':moment()[_0x2e88('0x21')](_0x2e88('0x28')),'interface':_0x4c98f2});}})[_0x2e88('0x14')](function(_0x29c64d){_0x5cea62(_0x29c64d);})['catch'](function(_0x1d2c23){_0xbd5f4d(_0x707d96['error'](0x1f4,_0x1d2c23[_0x2e88('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 3620abe..99a4da9 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 _0xd99e=['register','length','user:','./user.events','save','remove','emit','removeListener'];(function(_0x1de583,_0x594bc2){var _0x287f06=function(_0x55155d){while(--_0x55155d){_0x1de583['push'](_0x1de583['shift']());}};_0x287f06(++_0x594bc2);}(_0xd99e,0xa3));var _0xed99=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0xd99e[_0x60df74];return _0x5ee872;};'use strict';var UserEvents=require(_0xed99('0x0'));var events=[_0xed99('0x1'),_0xed99('0x2'),'update'];function createListener(_0x591fcb,_0x1e3714){return function(_0x3e0b4c){_0x1e3714[_0xed99('0x3')](_0x591fcb,_0x3e0b4c);};}function removeListener(_0x145175,_0xdb4cab){return function(){UserEvents[_0xed99('0x4')](_0x145175,_0xdb4cab);};}exports[_0xed99('0x5')]=function(_0x502758){for(var _0x2d7d1f=0x0,_0x54ae0b=events[_0xed99('0x6')];_0x2d7d1f<_0x54ae0b;_0x2d7d1f++){var _0x2df8dc=events[_0x2d7d1f];var _0x21c995=createListener(_0xed99('0x7')+_0x2df8dc,_0x502758);UserEvents['on'](_0x2df8dc,_0x21c995);}}; \ No newline at end of file +var _0x67d7=['emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x5e8b4d,_0x4e5ba1){var _0x5d0091=function(_0x53d632){while(--_0x53d632){_0x5e8b4d['push'](_0x5e8b4d['shift']());}};_0x5d0091(++_0x4e5ba1);}(_0x67d7,0x1a5));var _0x767d=function(_0x265d8d,_0x2ef29f){_0x265d8d=_0x265d8d-0x0;var _0x210a0a=_0x67d7[_0x265d8d];return _0x210a0a;};'use strict';var UserEvents=require(_0x767d('0x0'));var events=[_0x767d('0x1'),_0x767d('0x2'),'update'];function createListener(_0xaa7ebe,_0x297573){return function(_0x532166){_0x297573[_0x767d('0x3')](_0xaa7ebe,_0x532166);};}function removeListener(_0x419466,_0x243d0a){return function(){UserEvents[_0x767d('0x4')](_0x419466,_0x243d0a);};}exports[_0x767d('0x5')]=function(_0x3508e4){for(var _0x126591=0x0,_0x4250cf=events[_0x767d('0x6')];_0x126591<_0x4250cf;_0x126591++){var _0x1a1889=events[_0x126591];var _0x5bd21d=createListener(_0x767d('0x7')+_0x1a1889,_0x3508e4);UserEvents['on'](_0x1a1889,_0x5bd21d);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 5d29998..bd08f9e 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x48ebe8,_0x300832){var _0x5c65fb=function(_0x55a95b){while(--_0x55a95b){_0x48ebe8['push'](_0x48ebe8['shift']());}};_0x5c65fb(++_0x300832);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x595305,_0x1349a9){var _0x4c40c6=function(_0x3d1db8){while(--_0x3d1db8){_0x595305['push'](_0x595305['shift']());}};_0x4c40c6(++_0x1349a9);}(_0x70e0,0x17b));var _0x070e=function(_0x382e04,_0x40ae8c){_0x382e04=_0x382e04-0x0;var _0x17450e=_0x70e0[_0x382e04];return _0x17450e;};'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 22e4750..52e7d61 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 _0x3b2a=['exports'];(function(_0x310da1,_0x390f65){var _0x333d17=function(_0x27d0f8){while(--_0x27d0f8){_0x310da1['push'](_0x310da1['shift']());}};_0x333d17(++_0x390f65);}(_0x3b2a,0x90));var _0xa3b2=function(_0xd2a62e,_0x211635){_0xd2a62e=_0xd2a62e-0x0;var _0x2d58a7=_0x3b2a[_0xd2a62e];return _0x2d58a7;};'use strict';var Sequelize=require('sequelize');module[_0xa3b2('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2f7a=['exports','sequelize'];(function(_0x389a30,_0xdcf849){var _0x503ddb=function(_0x4e448a){while(--_0x4e448a){_0x389a30['push'](_0x389a30['shift']());}};_0x503ddb(++_0xdcf849);}(_0x2f7a,0x151));var _0xa2f7=function(_0x28ef52,_0x74a3a1){_0x28ef52=_0x28ef52-0x0;var _0x515269=_0x2f7a[_0x28ef52];return _0x515269;};'use strict';var Sequelize=require(_0xa2f7('0x0'));module[_0xa2f7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 5a11e86..ca84a29 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 _0x4f88=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x5ddc87,_0x249a80){var _0x318be1=function(_0x5bc2bc){while(--_0x5bc2bc){_0x5ddc87['push'](_0x5ddc87['shift']());}};_0x318be1(++_0x249a80);}(_0x4f88,0x180));var _0x84f8=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x4f88[_0x1ac6ec];return _0x48a489;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var logger=require(_0x84f8('0x2'))(_0x84f8('0x3'));var moment=require('moment');var BPromise=require(_0x84f8('0x4'));var rp=require(_0x84f8('0x5'));var fs=require('fs');var path=require(_0x84f8('0x6'));var rimraf=require(_0x84f8('0x7'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x84f8('0x8')]=function(_0x125029,_0x1366b8){return _0x125029[_0x84f8('0x9')](_0x84f8('0xa'),attributes,{'tableName':_0x84f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab6e=['./userChatQueue.attributes','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c7189,_0x5bc9f3){var _0x27c1fa=function(_0x4e6ba8){while(--_0x4e6ba8){_0x2c7189['push'](_0x2c7189['shift']());}};_0x27c1fa(++_0x5bc9f3);}(_0xab6e,0x148));var _0xeab6=function(_0x735a49,_0x3da3fd){_0x735a49=_0x735a49-0x0;var _0xee7e9=_0xab6e[_0x735a49];return _0xee7e9;};'use strict';var _=require(_0xeab6('0x0'));var util=require(_0xeab6('0x1'));var logger=require(_0xeab6('0x2'))(_0xeab6('0x3'));var moment=require(_0xeab6('0x4'));var BPromise=require(_0xeab6('0x5'));var rp=require(_0xeab6('0x6'));var fs=require('fs');var path=require(_0xeab6('0x7'));var rimraf=require(_0xeab6('0x8'));var config=require(_0xeab6('0x9'));var attributes=require(_0xeab6('0xa'));module['exports']=function(_0x14c7c6,_0x5cab7b){return _0x14c7c6[_0xeab6('0xb')]('UserChatQueue',attributes,{'tableName':_0xeab6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 8c0e7c1..63c162f 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 _0x09ce=['bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x425b60,_0x1bd5e5){var _0x7739bb=function(_0x32124e){while(--_0x32124e){_0x425b60['push'](_0x425b60['shift']());}};_0x7739bb(++_0x1bd5e5);}(_0x09ce,0x1e1));var _0xe09c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x09ce[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe09c('0x0'));var util=require(_0xe09c('0x1'));var moment=require('moment');var BPromise=require(_0xe09c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe09c('0x3'));var db=require(_0xe09c('0x4'))['db'];var utils=require(_0xe09c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe09c('0x6'));var client=jayson[_0xe09c('0x7')][_0xe09c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2746b8,_0x800aa0,_0x36560f){return new BPromise(function(_0x2393b2,_0x5578c2){return client[_0xe09c('0x9')](_0x2746b8,_0x36560f)[_0xe09c('0xa')](function(_0x480c78){logger[_0xe09c('0xb')](_0xe09c('0xc'),_0x800aa0,_0xe09c('0xd'));logger[_0xe09c('0xe')](_0xe09c('0xf'),_0x800aa0,_0xe09c('0xd'),JSON[_0xe09c('0x10')](_0x480c78));if(_0x480c78[_0xe09c('0x11')]){if(_0x480c78[_0xe09c('0x11')][_0xe09c('0x12')]===0x1f4){logger[_0xe09c('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x800aa0,_0x480c78[_0xe09c('0x11')][_0xe09c('0x13')]);return _0x5578c2(_0x480c78[_0xe09c('0x11')][_0xe09c('0x13')]);}logger[_0xe09c('0x11')](_0xe09c('0xc'),_0x800aa0,_0x480c78[_0xe09c('0x11')]['message']);return _0x2393b2(_0x480c78['error'][_0xe09c('0x13')]);}else{logger[_0xe09c('0xb')](_0xe09c('0xc'),_0x800aa0,'request\x20sent');_0x2393b2(_0x480c78[_0xe09c('0x14')][_0xe09c('0x13')]);}})['catch'](function(_0x41bfda){logger[_0xe09c('0x11')](_0xe09c('0xc'),_0x800aa0,_0x41bfda);_0x5578c2(_0x41bfda);});});} \ No newline at end of file +var _0x2599=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x2599,0xb8));var _0x9259=function(_0x4fa383,_0x53118f){_0x4fa383=_0x4fa383-0x0;var _0x2b4153=_0x2599[_0x4fa383];return _0x2b4153;};'use strict';var _=require(_0x9259('0x0'));var util=require(_0x9259('0x1'));var moment=require(_0x9259('0x2'));var BPromise=require(_0x9259('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9259('0x4'));var db=require(_0x9259('0x5'))['db'];var utils=require(_0x9259('0x6'));var logger=require(_0x9259('0x7'))(_0x9259('0x8'));var config=require(_0x9259('0x9'));var jayson=require(_0x9259('0xa'));var client=jayson[_0x9259('0xb')][_0x9259('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46c11c,_0x51f246,_0x32ed3b){return new BPromise(function(_0x363db9,_0x2ca01f){return client[_0x9259('0xd')](_0x46c11c,_0x32ed3b)[_0x9259('0xe')](function(_0x1188cd){logger[_0x9259('0xf')](_0x9259('0x10'),_0x51f246,_0x9259('0x11'));logger[_0x9259('0x12')](_0x9259('0x13'),_0x51f246,_0x9259('0x11'),JSON[_0x9259('0x14')](_0x1188cd));if(_0x1188cd[_0x9259('0x15')]){if(_0x1188cd[_0x9259('0x15')][_0x9259('0x16')]===0x1f4){logger['error'](_0x9259('0x10'),_0x51f246,_0x1188cd[_0x9259('0x15')][_0x9259('0x17')]);return _0x2ca01f(_0x1188cd[_0x9259('0x15')][_0x9259('0x17')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x51f246,_0x1188cd['error']['message']);return _0x363db9(_0x1188cd['error'][_0x9259('0x17')]);}else{logger[_0x9259('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x51f246,_0x9259('0x11'));_0x363db9(_0x1188cd['result'][_0x9259('0x17')]);}})['catch'](function(_0x54bce9){logger[_0x9259('0x15')](_0x9259('0x10'),_0x51f246,_0x54bce9);_0x2ca01f(_0x54bce9);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 9df2fb2..ae7e474 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x15c63c,_0x4ed2c1){var _0x538b38=function(_0x294f30){while(--_0x294f30){_0x15c63c['push'](_0x15c63c['shift']());}};_0x538b38(++_0x4ed2c1);}(_0xe706,0xa3));var _0x6e70=function(_0xd8a959,_0x169203){_0xd8a959=_0xd8a959-0x0;var _0x536e01=_0xe706[_0xd8a959];return _0x536e01;};'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(_0x48a517,_0x15e1d6){var _0x55ae93=function(_0x332cb4){while(--_0x332cb4){_0x48a517['push'](_0x48a517['shift']());}};_0x55ae93(++_0x15e1d6);}(_0x70e0,0x17b));var _0x070e=function(_0x1008fa,_0x4334b6){_0x1008fa=_0x1008fa-0x0;var _0x43aac3=_0x70e0[_0x1008fa];return _0x43aac3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 15fe57f..75ee978 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 _0x6e84=['exports','INTEGER','STRING','sequelize'];(function(_0xf71666,_0x52e6f0){var _0x838fef=function(_0x8dfcd7){while(--_0x8dfcd7){_0xf71666['push'](_0xf71666['shift']());}};_0x838fef(++_0x52e6f0);}(_0x6e84,0x6b));var _0x46e8=function(_0x8023ec,_0x18243b){_0x8023ec=_0x8023ec-0x0;var _0x2d55f7=_0x6e84[_0x8023ec];return _0x2d55f7;};'use strict';var Sequelize=require(_0x46e8('0x0'));module[_0x46e8('0x1')]={'penalty':{'type':Sequelize[_0x46e8('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x46e8('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x46e8('0x3')]}}; \ No newline at end of file +var _0xd73b=['STRING','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd73b,0x1b1));var _0xbd73=function(_0x5aa29b,_0x2a4afa){_0x5aa29b=_0x5aa29b-0x0;var _0x14cda3=_0xd73b[_0x5aa29b];return _0x14cda3;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xbd73('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbd73('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 7ed154e..298e2c5 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 _0x7f6d=['bluebird','request-promise','path','rimraf','../../config/environment','exports','user_has_fax_queues','util','moment'];(function(_0x3dc4ab,_0x546b41){var _0xea96a9=function(_0x33aa8f){while(--_0x33aa8f){_0x3dc4ab['push'](_0x3dc4ab['shift']());}};_0xea96a9(++_0x546b41);}(_0x7f6d,0xb2));var _0xd7f6=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7f6d[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require(_0xd7f6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd7f6('0x1'));var BPromise=require(_0xd7f6('0x2'));var rp=require(_0xd7f6('0x3'));var fs=require('fs');var path=require(_0xd7f6('0x4'));var rimraf=require(_0xd7f6('0x5'));var config=require(_0xd7f6('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xd7f6('0x7')]=function(_0x38a53c,_0x486539){return _0x38a53c['define']('UserFaxQueue',attributes,{'tableName':_0xd7f6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4043=['api','moment','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x1eaa87,_0x2ab34f){var _0x5a3ccc=function(_0x58896e){while(--_0x58896e){_0x1eaa87['push'](_0x1eaa87['shift']());}};_0x5a3ccc(++_0x2ab34f);}(_0x4043,0x17f));var _0x3404=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4043[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x3404('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3404('0x1'));var moment=require(_0x3404('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3404('0x3'));var config=require('../../config/environment');var attributes=require(_0x3404('0x4'));module['exports']=function(_0x13f1c1,_0x5d73c3){return _0x13f1c1[_0x3404('0x5')](_0x3404('0x6'),attributes,{'tableName':_0x3404('0x7'),'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 5c95a32..af98484 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 _0x5908=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x11f7fc,_0x1545da){var _0x445244=function(_0x4ef0a5){while(--_0x4ef0a5){_0x11f7fc['push'](_0x11f7fc['shift']());}};_0x445244(++_0x1545da);}(_0x5908,0x117));var _0x8590=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5908[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x8590('0x0'));var util=require(_0x8590('0x1'));var moment=require('moment');var BPromise=require(_0x8590('0x2'));var rs=require(_0x8590('0x3'));var fs=require('fs');var Redis=require(_0x8590('0x4'));var db=require(_0x8590('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8590('0x6'));var jayson=require(_0x8590('0x7'));var client=jayson[_0x8590('0x8')][_0x8590('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44e715,_0x5ab846,_0x1cba4e){return new BPromise(function(_0x1f6653,_0x165e84){return client['request'](_0x44e715,_0x1cba4e)[_0x8590('0xa')](function(_0x4ffd84){logger[_0x8590('0xb')](_0x8590('0xc'),_0x5ab846,_0x8590('0xd'));logger['debug'](_0x8590('0xe'),_0x5ab846,_0x8590('0xd'),JSON[_0x8590('0xf')](_0x4ffd84));if(_0x4ffd84[_0x8590('0x10')]){if(_0x4ffd84[_0x8590('0x10')][_0x8590('0x11')]===0x1f4){logger[_0x8590('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x5ab846,_0x4ffd84[_0x8590('0x10')]['message']);return _0x165e84(_0x4ffd84[_0x8590('0x10')][_0x8590('0x12')]);}logger['error'](_0x8590('0xc'),_0x5ab846,_0x4ffd84['error'][_0x8590('0x12')]);return _0x1f6653(_0x4ffd84['error'][_0x8590('0x12')]);}else{logger[_0x8590('0xb')](_0x8590('0xc'),_0x5ab846,_0x8590('0xd'));_0x1f6653(_0x4ffd84[_0x8590('0x13')][_0x8590('0x12')]);}})['catch'](function(_0x31c310){logger[_0x8590('0x10')](_0x8590('0xc'),_0x5ab846,_0x31c310);_0x165e84(_0x31c310);});});} \ No newline at end of file +var _0xe6b9=['../../config/environment','jayson/promise','client','request','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4f6289,_0x51b3c0){var _0x433d64=function(_0x3e9087){while(--_0x3e9087){_0x4f6289['push'](_0x4f6289['shift']());}};_0x433d64(++_0x51b3c0);}(_0xe6b9,0xa8));var _0x9e6b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe6b9[_0x24237f];return _0x48298e;};'use strict';var _=require('lodash');var util=require(_0x9e6b('0x0'));var moment=require(_0x9e6b('0x1'));var BPromise=require(_0x9e6b('0x2'));var rs=require(_0x9e6b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e6b('0x4'))['db'];var utils=require(_0x9e6b('0x5'));var logger=require(_0x9e6b('0x6'))(_0x9e6b('0x7'));var config=require(_0x9e6b('0x8'));var jayson=require(_0x9e6b('0x9'));var client=jayson[_0x9e6b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c93b9,_0xdd6616,_0x49d3ab){return new BPromise(function(_0x3a2a52,_0x15e874){return client[_0x9e6b('0xb')](_0x1c93b9,_0x49d3ab)['then'](function(_0x3a89d3){logger['info'](_0x9e6b('0xc'),_0xdd6616,_0x9e6b('0xd'));logger[_0x9e6b('0xe')](_0x9e6b('0xf'),_0xdd6616,_0x9e6b('0xd'),JSON[_0x9e6b('0x10')](_0x3a89d3));if(_0x3a89d3[_0x9e6b('0x11')]){if(_0x3a89d3['error'][_0x9e6b('0x12')]===0x1f4){logger[_0x9e6b('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0xdd6616,_0x3a89d3[_0x9e6b('0x11')][_0x9e6b('0x13')]);return _0x15e874(_0x3a89d3[_0x9e6b('0x11')][_0x9e6b('0x13')]);}logger['error'](_0x9e6b('0xc'),_0xdd6616,_0x3a89d3[_0x9e6b('0x11')][_0x9e6b('0x13')]);return _0x3a2a52(_0x3a89d3[_0x9e6b('0x11')][_0x9e6b('0x13')]);}else{logger['info'](_0x9e6b('0xc'),_0xdd6616,_0x9e6b('0xd'));_0x3a2a52(_0x3a89d3[_0x9e6b('0x14')][_0x9e6b('0x13')]);}})[_0x9e6b('0x15')](function(_0x2b2212){logger['error'](_0x9e6b('0xc'),_0xdd6616,_0x2b2212);_0x15e874(_0x2b2212);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 2e8caad..7c3fc23 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3af7b7,_0x208014){var _0x8408b5=function(_0x22161d){while(--_0x22161d){_0x3af7b7['push'](_0x3af7b7['shift']());}};_0x8408b5(++_0x208014);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x42322d,_0x5567b8){var _0x409906=function(_0x591bb6){while(--_0x591bb6){_0x42322d['push'](_0x42322d['shift']());}};_0x409906(++_0x5567b8);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 97e41a8..75410fa 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 _0xb635=['exports'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0xb635,0x130));var _0x5b63=function(_0x5c0668,_0x3bb4df){_0x5c0668=_0x5c0668-0x0;var _0x55df9b=_0xb635[_0x5c0668];return _0x55df9b;};'use strict';var Sequelize=require('sequelize');module[_0x5b63('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb768=['INTEGER','sequelize'];(function(_0x4c8fd7,_0x5ac749){var _0xd77a98=function(_0x3a5f2a){while(--_0x3a5f2a){_0x4c8fd7['push'](_0x4c8fd7['shift']());}};_0xd77a98(++_0x5ac749);}(_0xb768,0x7d));var _0x8b76=function(_0x4448cd,_0x5bc3d8){_0x4448cd=_0x4448cd-0x0;var _0xdd3af1=_0xb768[_0x4448cd];return _0xdd3af1;};'use strict';var Sequelize=require(_0x8b76('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8b76('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index ebbe59a..432434e 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 _0x739d=['lodash','../../config/logger','api','bluebird','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x1085db,_0x41e087){var _0x392a60=function(_0xc7f75d){while(--_0xc7f75d){_0x1085db['push'](_0x1085db['shift']());}};_0x392a60(++_0x41e087);}(_0x739d,0x18c));var _0xd739=function(_0x3a8f41,_0x1c6d83){_0x3a8f41=_0x3a8f41-0x0;var _0x628177=_0x739d[_0x3a8f41];return _0x628177;};'use strict';var _=require(_0xd739('0x0'));var util=require('util');var logger=require(_0xd739('0x1'))(_0xd739('0x2'));var moment=require('moment');var BPromise=require(_0xd739('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd739('0x4'));var config=require('../../config/environment');var attributes=require(_0xd739('0x5'));module[_0xd739('0x6')]=function(_0x4c7e4b,_0x2ffba9){return _0x4c7e4b[_0xd739('0x7')](_0xd739('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf4f=['./userMailQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4516ff,_0x30f19e){var _0x4d8b77=function(_0x39f382){while(--_0x39f382){_0x4516ff['push'](_0x4516ff['shift']());}};_0x4d8b77(++_0x30f19e);}(_0xdf4f,0xbd));var _0xfdf4=function(_0xab3511,_0x95206c){_0xab3511=_0xab3511-0x0;var _0x21dd6d=_0xdf4f[_0xab3511];return _0x21dd6d;};'use strict';var _=require(_0xfdf4('0x0'));var util=require(_0xfdf4('0x1'));var logger=require(_0xfdf4('0x2'))(_0xfdf4('0x3'));var moment=require(_0xfdf4('0x4'));var BPromise=require(_0xfdf4('0x5'));var rp=require(_0xfdf4('0x6'));var fs=require('fs');var path=require(_0xfdf4('0x7'));var rimraf=require(_0xfdf4('0x8'));var config=require('../../config/environment');var attributes=require(_0xfdf4('0x9'));module['exports']=function(_0x24093d,_0xe40d5){return _0x24093d[_0xfdf4('0xa')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index ff89414..223494b 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x47717c,_0x192de7){var _0x458bb0=function(_0x4ddd12){while(--_0x4ddd12){_0x47717c['push'](_0x47717c['shift']());}};_0x458bb0(++_0x192de7);}(_0x6aa7,0x178));var _0x76aa=function(_0x1dacdc,_0x59bf7b){_0x1dacdc=_0x1dacdc-0x0;var _0x5b76b7=_0x6aa7[_0x1dacdc];return _0x5b76b7;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x008c,0x188));var _0xc008=function(_0xa96b73,_0x5d4c0c){_0xa96b73=_0xa96b73-0x0;var _0x4aacc7=_0x008c[_0xa96b73];return _0x4aacc7;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index e9c4eb9..d81ac2c 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 _0x2d86=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2d86,0x177));var _0x62d8=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0x2d86[_0x1acc2d];return _0xabfa6d;};'use strict';var multer=require(_0x62d8('0x0'));var util=require(_0x62d8('0x1'));var path=require(_0x62d8('0x2'));var timeout=require(_0x62d8('0x3'));var express=require('express');var router=express[_0x62d8('0x4')]();var fs_extra=require(_0x62d8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x62d8('0x6'));var config=require(_0x62d8('0x7'));var controller=require(_0x62d8('0x8'));router['post']('/',auth[_0x62d8('0x9')](),controller['sendUserNotification']);module[_0x62d8('0xa')]=router; \ No newline at end of file +var _0x8c46=['../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x8c46,0xf6));var _0x68c4=function(_0x4a1e75,_0x28ba73){_0x4a1e75=_0x4a1e75-0x0;var _0x3cf0f5=_0x8c46[_0x4a1e75];return _0x3cf0f5;};'use strict';var multer=require(_0x68c4('0x0'));var util=require(_0x68c4('0x1'));var path=require('path');var timeout=require(_0x68c4('0x2'));var express=require('express');var router=express[_0x68c4('0x3')]();var fs_extra=require(_0x68c4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x68c4('0x5'));var config=require(_0x68c4('0x6'));var controller=require(_0x68c4('0x7'));router[_0x68c4('0x8')]('/',auth[_0x68c4('0x9')](),controller[_0x68c4('0xa')]);module[_0x68c4('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index b4525ac..b7819cc 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 _0x4a05=['STRING','sequelize','exports','TEXT'];(function(_0x2c0280,_0x2ea5c1){var _0x4c0707=function(_0x36380a){while(--_0x36380a){_0x2c0280['push'](_0x2c0280['shift']());}};_0x4c0707(++_0x2ea5c1);}(_0x4a05,0xa1));var _0x54a0=function(_0x7a68b,_0x964789){_0x7a68b=_0x7a68b-0x0;var _0x110d37=_0x4a05[_0x7a68b];return _0x110d37;};'use strict';var Sequelize=require(_0x54a0('0x0'));module[_0x54a0('0x1')]={'body':{'type':Sequelize[_0x54a0('0x2')]},'senderName':{'type':Sequelize[_0x54a0('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x54a0('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x2c8e=['STRING','exports','TEXT'];(function(_0x1b09f3,_0x346ea4){var _0x56f25c=function(_0x4fe1c4){while(--_0x4fe1c4){_0x1b09f3['push'](_0x1b09f3['shift']());}};_0x56f25c(++_0x346ea4);}(_0x2c8e,0xa9));var _0xe2c8=function(_0x295163,_0x3bc57a){_0x295163=_0x295163-0x0;var _0x4d5c6e=_0x2c8e[_0x295163];return _0x4d5c6e;};'use strict';var Sequelize=require('sequelize');module[_0xe2c8('0x0')]={'body':{'type':Sequelize[_0xe2c8('0x1')]},'senderName':{'type':Sequelize[_0xe2c8('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xe2c8('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 700b583..87d697b 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 _0x88f2=['sortBy','join','sequelize','transaction','create','forEach','recipient','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','union','ids','replace','push','all','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId'];(function(_0x487f45,_0x351377){var _0x80033e=function(_0x8b4537){while(--_0x8b4537){_0x487f45['push'](_0x487f45['shift']());}};_0x80033e(++_0x351377);}(_0x88f2,0x13d));var _0x288f=function(_0x5ca30a,_0x361f27){_0x5ca30a=_0x5ca30a-0x0;var _0x1af438=_0x88f2[_0x5ca30a];return _0x1af438;};'use strict';var emlformat=require(_0x288f('0x0'));var rimraf=require(_0x288f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x288f('0x2'));var rp=require(_0x288f('0x3'));var moment=require(_0x288f('0x4'));var BPromise=require(_0x288f('0x5'));var Mustache=require(_0x288f('0x6'));var util=require(_0x288f('0x7'));var path=require(_0x288f('0x8'));var sox=require(_0x288f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x288f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x288f('0xb'));var jsforce=require(_0x288f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x288f('0xd'));var querystring=require('querystring');var Papa=require(_0x288f('0xe'));var Redis=require(_0x288f('0xf'));var authService=require(_0x288f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x288f('0x11'));var hardwareService=require(_0x288f('0x12'));var logger=require(_0x288f('0x13'))(_0x288f('0x14'));var utils=require(_0x288f('0x15'));var config=require(_0x288f('0x16'));var licenseUtil=require(_0x288f('0x17'));var db=require(_0x288f('0x18'))['db'];config[_0x288f('0x19')]=_[_0x288f('0x1a')](config[_0x288f('0x19')],{'host':_0x288f('0x1b'),'port':0x18eb});var socket=require(_0x288f('0x1c'))(new Redis(config[_0x288f('0x19')]));require('./userNotification.socket')[_0x288f('0x1d')](socket);function respondWithStatusCode(_0x1a433b,_0x16fb4f){_0x16fb4f=_0x16fb4f||0xcc;return function(_0xb64cdf){if(_0xb64cdf){return _0x1a433b[_0x288f('0x1e')](_0x16fb4f);}return _0x1a433b['status'](_0x16fb4f)[_0x288f('0x1f')]();};}function respondWithResult(_0x41009d,_0x4ef948){_0x4ef948=_0x4ef948||0xc8;return function(_0x4ebafd){if(_0x4ebafd){return _0x41009d[_0x288f('0x20')](_0x4ef948)['json'](_0x4ebafd);}};}function respondWithFilteredResult(_0x32796c,_0x51071b){return function(_0x20e900){if(_0x20e900){var _0x4c56cb=typeof _0x51071b[_0x288f('0x21')]===_0x288f('0x22')&&typeof _0x51071b[_0x288f('0x23')]===_0x288f('0x22');var _0x248ef7=_0x20e900[_0x288f('0x24')];var _0x2ff1c3=_0x4c56cb?0x0:_0x51071b['offset'];var _0x1075cd=_0x4c56cb?_0x20e900[_0x288f('0x24')]:_0x51071b['offset']+_0x51071b[_0x288f('0x23')];var _0x4d6a48;if(_0x1075cd>=_0x248ef7){_0x1075cd=_0x248ef7;_0x4d6a48=0xc8;}else{_0x4d6a48=0xce;}_0x32796c[_0x288f('0x20')](_0x4d6a48);return _0x32796c[_0x288f('0x25')](_0x288f('0x26'),_0x2ff1c3+'-'+_0x1075cd+'/'+_0x248ef7)[_0x288f('0x27')](_0x20e900);}return null;};}function patchUpdates(_0x3fc3b2){return function(_0x1e568a){try{jsonpatch[_0x288f('0x28')](_0x1e568a,_0x3fc3b2,!![]);}catch(_0x1bf1b1){return BPromise[_0x288f('0x29')](_0x1bf1b1);}return _0x1e568a['save']();};}function saveUpdates(_0x9c1b32,_0x32f1a4){return function(_0x221e53){if(_0x221e53){return _0x221e53[_0x288f('0x2a')](_0x9c1b32)[_0x288f('0x2b')](function(_0x3ab02b){return _0x3ab02b;});}return null;};}function removeEntity(_0xf2d89b,_0x3d92b3){return function(_0x332eb8){if(_0x332eb8){return _0x332eb8[_0x288f('0x2c')]()['then'](function(){_0xf2d89b[_0x288f('0x20')](0xcc)[_0x288f('0x1f')]();});}};}function handleEntityNotFound(_0x214c93,_0x41de24){return function(_0x4f88f1){if(!_0x4f88f1){_0x214c93[_0x288f('0x1e')](0x194);}return _0x4f88f1;};}function handleError(_0x1edd41,_0x4f7f90){_0x4f7f90=_0x4f7f90||0x1f4;return function(_0x34b838){logger[_0x288f('0x2d')](_0x34b838[_0x288f('0x2e')]);if(_0x34b838[_0x288f('0x2f')]){delete _0x34b838[_0x288f('0x2f')];}_0x1edd41[_0x288f('0x20')](_0x4f7f90)['send'](_0x34b838);};}exports[_0x288f('0x30')]=function(_0x2a18a8,_0x28372e,_0x5a351e){if(!_0x2a18a8['body'][_0x288f('0x31')](_0x288f('0x32'))&&!_0x2a18a8[_0x288f('0x33')][_0x288f('0x31')](_0x288f('0x34'))){throw new db[(_0x288f('0x35'))][(_0x288f('0x36'))](_0x288f('0x37'));}else{if(_0x2a18a8[_0x288f('0x33')][_0x288f('0x31')](_0x288f('0x34'))&&!_0x2a18a8[_0x288f('0x33')][_0x288f('0x31')](_0x288f('0x38'))){throw new db[(_0x288f('0x35'))]['ValidationError'](_0x288f('0x39'));}if(!_0x2a18a8[_0x288f('0x33')][_0x288f('0x31')](_0x288f('0x3a'))){throw new db[(_0x288f('0x35'))][(_0x288f('0x36'))](_0x288f('0x3b'));}else{try{var _0xb215f4=JSON['parse'](_0x2a18a8[_0x288f('0x33')][_0x288f('0x3a')]);}catch(_0x2a875d){logger[_0x288f('0x2d')](_0x2a875d);throw new db[(_0x288f('0x35'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x485c3f=['chatqueue',_0x288f('0x3c'),_0x288f('0x3d'),_0x288f('0x3e'),_0x288f('0x3f'),_0x288f('0x40'),_0x288f('0x41'),_0x288f('0x42'),_0x288f('0x43')];if(_[_0x288f('0x44')](_0xb215f4,function(_0x5dbec8){return!_[_0x288f('0x45')](_0x485c3f,_0x5dbec8[_0x288f('0x46')][_0x288f('0x47')]());})){throw new db[(_0x288f('0x35'))][(_0x288f('0x36'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2931a5={};_0x2931a5[_0x288f('0x48')]=_0x2a18a8[_0x288f('0x33')][_0x288f('0x31')](_0x288f('0x48'))?_0x2a18a8[_0x288f('0x33')][_0x288f('0x48')]:_0x2a18a8[_0x288f('0x43')][_0x288f('0x49')];_0x2931a5['recipientsDescription']=_[_0x288f('0x4a')](_0x2a18a8[_0x288f('0x33')][_0x288f('0x4b')])?null:_0x2a18a8['body'][_0x288f('0x4b')];_0x2931a5[_0x288f('0x4c')]=_0x2a18a8['body'][_0x288f('0x4c')]||![];_0x2931a5[_0x288f('0x4d')]=_0x2a18a8[_0x288f('0x43')]['id'];return getContent(_0x2a18a8[_0x288f('0x33')])[_0x288f('0x2b')](function(_0x1acd7d){_0x2931a5[_0x288f('0x33')]=_0x1acd7d;return getRecipients(_0xb215f4);})[_0x288f('0x2b')](function(_0x250847){_0x2931a5[_0x288f('0x4e')]=_[_0x288f('0x4f')](_0x250847)[_0x288f('0x50')](',');return db[_0x288f('0x51')][_0x288f('0x52')](function(_0x1b4345){return db['UserNotification'][_0x288f('0x53')](_0x2931a5,{'raw':!![],'transaction':_0x1b4345})[_0x288f('0x2b')](function(_0x405066){var _0x1f54f6={'sender':_0x2931a5[_0x288f('0x48')],'description':_0x2931a5[_0x288f('0x4b')],'content':_0x2931a5['body'],'beep':_0x2931a5[_0x288f('0x4c')]};_0x250847[_0x288f('0x54')](function(_0x22c87f){_0x1f54f6[_0x288f('0x55')]=_0x22c87f;socket['emit']('userNotification:send',_0x1f54f6);});return _0x405066;});});})[_0x288f('0x2b')](respondWithResult(_0x28372e,0xc9))[_0x288f('0x56')](handleError(_0x28372e,null));};function getContent(_0x342d50){return new BPromise(function(_0x201cbd,_0x445788){if(_0x342d50[_0x288f('0x32')]){_0x201cbd(_0x342d50[_0x288f('0x32')]);return;}return db[_0x288f('0x57')][_0x288f('0x58')]({'attributes':[_0x288f('0x59')],'where':{'id':_0x342d50[_0x288f('0x34')]},'raw':!![]})['then'](function(_0x1d7328){if(!_0x1d7328)throw new db['Sequelize'][(_0x288f('0x36'))](_0x288f('0x5a'));var _0x4addef=Mustache['render'](_0x1d7328[_0x288f('0x59')],_0x342d50[_0x288f('0x38')]);_0x201cbd(_0x4addef);})[_0x288f('0x56')](function(_0x1df1b8){_0x445788(_0x1df1b8);});});}function getRecipients(_0x198577){return new BPromise(function(_0x1e7c0d,_0x228cb3){var _0x205f2a=[];var _0x2dcd05=[];_0x198577['forEach'](function(_0x3a822b){var _0x496fd0=_['startCase'](_0x3a822b[_0x288f('0x46')]['toLowerCase']());if(_0x496fd0==='User'){_0x205f2a=_[_0x288f('0x5b')](_0x205f2a,_0x3a822b[_0x288f('0x5c')]);}else{if(_[_0x288f('0x45')](_0x496fd0,'queue'))_0x496fd0=_0x496fd0[_0x288f('0x5d')]('queue','Queue');_0x3a822b[_0x288f('0x5c')][_0x288f('0x54')](function(_0x390c6d){_0x2dcd05[_0x288f('0x5e')](getAgents(_0x496fd0,_0x390c6d));});}});return BPromise[_0x288f('0x5f')](_0x2dcd05)[_0x288f('0x2b')](function(_0x5aa73b){_0x205f2a=_[_0x288f('0x5b')](_0x205f2a,_[_0x288f('0x60')](_0x5aa73b));_0x1e7c0d(_0x205f2a);})[_0x288f('0x56')](function(_0x414058){_0x228cb3(_0x414058);});});}function getAgents(_0x5d816d,_0x127d35){return new BPromise(function(_0x44f962,_0x304fc7){return db[_0x5d816d][_0x288f('0x58')]({'where':{'id':_0x127d35}})['then'](function(_0x3e5039){return _0x3e5039[_0x288f('0x61')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40ac6f){var _0x55babf=_[_0x288f('0x62')](_0x40ac6f,'id');_0x44f962(_0x55babf);});})[_0x288f('0x56')](function(_0x28c8a9){_0x304fc7(_0x28c8a9);});});} \ No newline at end of file +var _0xafbc=['jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./userNotification.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','end','sendStatus','error','name','sendUserNotification','body','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','smsqueue','voicequeue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','ids','replace','queue','Queue','all','flatten','catch','getAgents','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xafbc,0x171));var _0xcafb=function(_0x3c0a80,_0x4e292c){_0x3c0a80=_0x3c0a80-0x0;var _0x5f3ec4=_0xafbc[_0x3c0a80];return _0x5f3ec4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcafb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcafb('0x1'));var rp=require(_0xcafb('0x2'));var moment=require(_0xcafb('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcafb('0x4'));var path=require(_0xcafb('0x5'));var sox=require(_0xcafb('0x6'));var csv=require(_0xcafb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcafb('0x8'));var squel=require(_0xcafb('0x9'));var crypto=require(_0xcafb('0xa'));var jsforce=require(_0xcafb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcafb('0x7'));var querystring=require(_0xcafb('0xc'));var Papa=require('papaparse');var Redis=require(_0xcafb('0xd'));var authService=require(_0xcafb('0xe'));var qs=require(_0xcafb('0xf'));var as=require(_0xcafb('0x10'));var hardwareService=require(_0xcafb('0x11'));var logger=require(_0xcafb('0x12'))(_0xcafb('0x13'));var utils=require(_0xcafb('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcafb('0x15'))['db'];config[_0xcafb('0x16')]=_['defaults'](config[_0xcafb('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xcafb('0x17'))(new Redis(config[_0xcafb('0x16')]));require(_0xcafb('0x18'))[_0xcafb('0x19')](socket);function respondWithStatusCode(_0x276539,_0x35f913){_0x35f913=_0x35f913||0xcc;return function(_0x2b2fe6){if(_0x2b2fe6){return _0x276539['sendStatus'](_0x35f913);}return _0x276539['status'](_0x35f913)['end']();};}function respondWithResult(_0x209f1e,_0x12ac50){_0x12ac50=_0x12ac50||0xc8;return function(_0x7fff3a){if(_0x7fff3a){return _0x209f1e[_0xcafb('0x1a')](_0x12ac50)[_0xcafb('0x1b')](_0x7fff3a);}};}function respondWithFilteredResult(_0x3c98e9,_0x313547){return function(_0x32ac24){if(_0x32ac24){var _0x3ac6fb=typeof _0x313547[_0xcafb('0x1c')]==='undefined'&&typeof _0x313547[_0xcafb('0x1d')]===_0xcafb('0x1e');var _0xfce9fa=_0x32ac24[_0xcafb('0x1f')];var _0x58f5a0=_0x3ac6fb?0x0:_0x313547['offset'];var _0x5aba59=_0x3ac6fb?_0x32ac24[_0xcafb('0x1f')]:_0x313547[_0xcafb('0x1c')]+_0x313547['limit'];var _0xa54302;if(_0x5aba59>=_0xfce9fa){_0x5aba59=_0xfce9fa;_0xa54302=0xc8;}else{_0xa54302=0xce;}_0x3c98e9['status'](_0xa54302);return _0x3c98e9[_0xcafb('0x20')](_0xcafb('0x21'),_0x58f5a0+'-'+_0x5aba59+'/'+_0xfce9fa)[_0xcafb('0x1b')](_0x32ac24);}return null;};}function patchUpdates(_0x551b72){return function(_0x274166){try{jsonpatch['apply'](_0x274166,_0x551b72,!![]);}catch(_0x5c5c58){return BPromise[_0xcafb('0x22')](_0x5c5c58);}return _0x274166['save']();};}function saveUpdates(_0x3d36a6,_0x56546f){return function(_0x355c51){if(_0x355c51){return _0x355c51[_0xcafb('0x23')](_0x3d36a6)['then'](function(_0x4810c3){return _0x4810c3;});}return null;};}function removeEntity(_0x1353e0,_0x5cf505){return function(_0x40f93d){if(_0x40f93d){return _0x40f93d[_0xcafb('0x24')]()[_0xcafb('0x25')](function(){_0x1353e0['status'](0xcc)[_0xcafb('0x26')]();});}};}function handleEntityNotFound(_0x58df61,_0x40a582){return function(_0x4e6c52){if(!_0x4e6c52){_0x58df61[_0xcafb('0x27')](0x194);}return _0x4e6c52;};}function handleError(_0x2ec7dd,_0xd6e35e){_0xd6e35e=_0xd6e35e||0x1f4;return function(_0x2822db){logger[_0xcafb('0x28')](_0x2822db['stack']);if(_0x2822db[_0xcafb('0x29')]){delete _0x2822db[_0xcafb('0x29')];}_0x2ec7dd[_0xcafb('0x1a')](_0xd6e35e)['send'](_0x2822db);};}exports[_0xcafb('0x2a')]=function(_0x59a25e,_0x1f03f9,_0x3cd5a5){if(!_0x59a25e[_0xcafb('0x2b')][_0xcafb('0x2c')]('text')&&!_0x59a25e[_0xcafb('0x2b')][_0xcafb('0x2c')](_0xcafb('0x2d'))){throw new db['Sequelize'][(_0xcafb('0x2e'))](_0xcafb('0x2f'));}else{if(_0x59a25e[_0xcafb('0x2b')][_0xcafb('0x2c')](_0xcafb('0x2d'))&&!_0x59a25e['body'][_0xcafb('0x2c')](_0xcafb('0x30'))){throw new db[(_0xcafb('0x31'))][(_0xcafb('0x2e'))](_0xcafb('0x32'));}if(!_0x59a25e[_0xcafb('0x2b')][_0xcafb('0x2c')]('recipients')){throw new db['Sequelize'][(_0xcafb('0x2e'))](_0xcafb('0x33'));}else{try{var _0x19254c=JSON['parse'](_0x59a25e[_0xcafb('0x2b')][_0xcafb('0x34')]);}catch(_0xccd806){logger['error'](_0xccd806);throw new db[(_0xcafb('0x31'))][(_0xcafb('0x2e'))](_0xcafb('0x35'));}var _0x4c28bd=[_0xcafb('0x36'),_0xcafb('0x37'),'mailqueue','openchannelqueue',_0xcafb('0x38'),_0xcafb('0x39'),'whatsappqueue',_0xcafb('0x3a'),'user'];if(_[_0xcafb('0x3b')](_0x19254c,function(_0x312225){return!_[_0xcafb('0x3c')](_0x4c28bd,_0x312225[_0xcafb('0x3d')][_0xcafb('0x3e')]());})){throw new db['Sequelize'][(_0xcafb('0x2e'))](_0xcafb('0x3f'));}}}var _0x390cbf={};_0x390cbf[_0xcafb('0x40')]=_0x59a25e['body'][_0xcafb('0x2c')](_0xcafb('0x40'))?_0x59a25e[_0xcafb('0x2b')][_0xcafb('0x40')]:_0x59a25e[_0xcafb('0x41')][_0xcafb('0x42')];_0x390cbf[_0xcafb('0x43')]=_['isEmpty'](_0x59a25e[_0xcafb('0x2b')]['recipientsDescription'])?null:_0x59a25e[_0xcafb('0x2b')]['recipientsDescription'];_0x390cbf[_0xcafb('0x44')]=_0x59a25e[_0xcafb('0x2b')][_0xcafb('0x44')]||![];_0x390cbf[_0xcafb('0x45')]=_0x59a25e[_0xcafb('0x41')]['id'];return getContent(_0x59a25e['body'])[_0xcafb('0x25')](function(_0x31b02b){_0x390cbf['body']=_0x31b02b;return getRecipients(_0x19254c);})[_0xcafb('0x25')](function(_0x1bee70){_0x390cbf[_0xcafb('0x46')]=_[_0xcafb('0x47')](_0x1bee70)[_0xcafb('0x48')](',');return db['sequelize'][_0xcafb('0x49')](function(_0x389852){return db[_0xcafb('0x4a')][_0xcafb('0x4b')](_0x390cbf,{'raw':!![],'transaction':_0x389852})[_0xcafb('0x25')](function(_0x5ba164){var _0x4d7d3a={'sender':_0x390cbf[_0xcafb('0x40')],'description':_0x390cbf[_0xcafb('0x43')],'content':_0x390cbf['body'],'beep':_0x390cbf[_0xcafb('0x44')]};_0x1bee70[_0xcafb('0x4c')](function(_0x1fda8c){_0x4d7d3a[_0xcafb('0x4d')]=_0x1fda8c;socket[_0xcafb('0x4e')](_0xcafb('0x4f'),_0x4d7d3a);});return _0x5ba164;});});})[_0xcafb('0x25')](respondWithResult(_0x1f03f9,0xc9))['catch'](handleError(_0x1f03f9,null));};function getContent(_0x29521e){return new BPromise(function(_0xd735ff,_0x19f55d){if(_0x29521e[_0xcafb('0x50')]){_0xd735ff(_0x29521e['text']);return;}return db[_0xcafb('0x51')][_0xcafb('0x52')]({'attributes':[_0xcafb('0x53')],'where':{'id':_0x29521e[_0xcafb('0x2d')]},'raw':!![]})[_0xcafb('0x25')](function(_0x27b7b1){if(!_0x27b7b1)throw new db[(_0xcafb('0x31'))][(_0xcafb('0x2e'))](_0xcafb('0x54'));var _0x480a8b=Mustache[_0xcafb('0x55')](_0x27b7b1[_0xcafb('0x53')],_0x29521e['view']);_0xd735ff(_0x480a8b);})['catch'](function(_0x4c5dbc){_0x19f55d(_0x4c5dbc);});});}function getRecipients(_0x30f559){return new BPromise(function(_0x5312cd,_0x3c3c66){var _0x367fd2=[];var _0x521601=[];_0x30f559[_0xcafb('0x4c')](function(_0x4410db){var _0x571527=_[_0xcafb('0x56')](_0x4410db[_0xcafb('0x3d')][_0xcafb('0x3e')]());if(_0x571527==='User'){_0x367fd2=_['union'](_0x367fd2,_0x4410db[_0xcafb('0x57')]);}else{if(_[_0xcafb('0x3c')](_0x571527,'queue'))_0x571527=_0x571527[_0xcafb('0x58')](_0xcafb('0x59'),_0xcafb('0x5a'));_0x4410db[_0xcafb('0x57')]['forEach'](function(_0x2ad1dd){_0x521601['push'](getAgents(_0x571527,_0x2ad1dd));});}});return BPromise[_0xcafb('0x5b')](_0x521601)[_0xcafb('0x25')](function(_0x17196d){_0x367fd2=_['union'](_0x367fd2,_[_0xcafb('0x5c')](_0x17196d));_0x5312cd(_0x367fd2);})[_0xcafb('0x5d')](function(_0x37de92){_0x3c3c66(_0x37de92);});});}function getAgents(_0x101b54,_0x56f80d){return new BPromise(function(_0x321425,_0x5652c1){return db[_0x101b54][_0xcafb('0x52')]({'where':{'id':_0x56f80d}})['then'](function(_0x271070){return _0x271070[_0xcafb('0x5e')]({'attributes':['id'],'raw':!![]})[_0xcafb('0x25')](function(_0x56ce6b){var _0x12bf0b=_['map'](_0x56ce6b,'id');_0x321425(_0x12bf0b);});})[_0xcafb('0x5d')](function(_0x424e13){_0x5652c1(_0x424e13);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 017450d..f0e7cbd 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 _0x565d=['../../mysqldb','UserNotification','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4e1592,_0x48a9b7){var _0x26d3f2=function(_0x308f8e){while(--_0x308f8e){_0x4e1592['push'](_0x4e1592['shift']());}};_0x26d3f2(++_0x48a9b7);}(_0x565d,0x10d));var _0xd565=function(_0x3591c9,_0x419b51){_0x3591c9=_0x3591c9-0x0;var _0x5f3d06=_0x565d[_0x3591c9];return _0x5f3d06;};'use strict';var EventEmitter=require(_0xd565('0x0'));var UserNotification=require(_0xd565('0x1'))['db'][_0xd565('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd565('0x3'),'afterDestroy':_0xd565('0x4')};function emitEvent(_0x463249){return function(_0x5a4ec2,_0x2d93ad,_0x5ae3de){UserNotificationEvents[_0xd565('0x5')](_0x463249+':'+_0x5a4ec2['id'],_0x5a4ec2);UserNotificationEvents[_0xd565('0x5')](_0x463249,_0x5a4ec2);_0x5ae3de(null);};}for(var e in events){if(events[_0xd565('0x6')](e)){var event=events[e];UserNotification[_0xd565('0x7')](e,emitEvent(event));}}module[_0xd565('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x8c25=['setMaxListeners','update','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x8c25,0x10c));var _0x58c2=function(_0xcfd3e0,_0x331ddc){_0xcfd3e0=_0xcfd3e0-0x0;var _0x268bfb=_0x8c25[_0xcfd3e0];return _0x268bfb;};'use strict';var EventEmitter=require(_0x58c2('0x0'));var UserNotification=require(_0x58c2('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x58c2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x58c2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x328204){return function(_0x1129ce,_0xe8721b,_0x33f10c){UserNotificationEvents[_0x58c2('0x4')](_0x328204+':'+_0x1129ce['id'],_0x1129ce);UserNotificationEvents[_0x58c2('0x4')](_0x328204,_0x1129ce);_0x33f10c(null);};}for(var e in events){if(events[_0x58c2('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index a462d37..ca24180 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 _0x2569=['../../config/environment','./userNotification.attributes','define','userNotifications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2569,0x6d));var _0x9256=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0x2569[_0x12ca5f];return _0xfc3ae9;};'use strict';var _=require(_0x9256('0x0'));var util=require('util');var logger=require(_0x9256('0x1'))(_0x9256('0x2'));var moment=require(_0x9256('0x3'));var BPromise=require(_0x9256('0x4'));var rp=require(_0x9256('0x5'));var fs=require('fs');var path=require(_0x9256('0x6'));var rimraf=require(_0x9256('0x7'));var config=require(_0x9256('0x8'));var attributes=require(_0x9256('0x9'));module['exports']=function(_0x42ca15,_0xb6dabe){return _0x42ca15[_0x9256('0xa')]('UserNotification',attributes,{'tableName':_0x9256('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9256('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8439=['exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x168cf7,_0x5e950e){var _0x52ebcc=function(_0x10b5e5){while(--_0x10b5e5){_0x168cf7['push'](_0x168cf7['shift']());}};_0x52ebcc(++_0x5e950e);}(_0x8439,0x18b));var _0x9843=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8439[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x9843('0x0'));var util=require(_0x9843('0x1'));var logger=require(_0x9843('0x2'))(_0x9843('0x3'));var moment=require('moment');var BPromise=require(_0x9843('0x4'));var rp=require(_0x9843('0x5'));var fs=require('fs');var path=require(_0x9843('0x6'));var rimraf=require('rimraf');var config=require(_0x9843('0x7'));var attributes=require('./userNotification.attributes');module[_0x9843('0x8')]=function(_0xf700d7,_0x432e0b){return _0xf700d7[_0x9843('0x9')](_0x9843('0xa'),attributes,{'tableName':_0x9843('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9843('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index c7e1ca9..cf38cf0 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 _0xc409=['client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x524b27,_0x45dbdf){var _0x24e32c=function(_0x13856a){while(--_0x13856a){_0x524b27['push'](_0x524b27['shift']());}};_0x24e32c(++_0x45dbdf);}(_0xc409,0xc1));var _0x9c40=function(_0x5c927d,_0x12357e){_0x5c927d=_0x5c927d-0x0;var _0x32fe9b=_0xc409[_0x5c927d];return _0x32fe9b;};'use strict';var _=require(_0x9c40('0x0'));var util=require(_0x9c40('0x1'));var moment=require(_0x9c40('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9c40('0x3'))(_0x9c40('0x4'));var config=require(_0x9c40('0x5'));var jayson=require(_0x9c40('0x6'));var client=jayson[_0x9c40('0x7')][_0x9c40('0x8')]({'port':0x232a});config[_0x9c40('0x9')]=_[_0x9c40('0xa')](config[_0x9c40('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9c40('0xb'))(new Redis(config['redis']));require(_0x9c40('0xc'))[_0x9c40('0xd')](socket);function respondWithRpcPromise(_0xb05563,_0x213973,_0x5eb931){return new BPromise(function(_0x335dea,_0x37c4ad){return client[_0x9c40('0xe')](_0xb05563,_0x5eb931)['then'](function(_0x572327){logger['info'](_0x9c40('0xf'),_0x213973,_0x9c40('0x10'));logger['debug'](_0x9c40('0x11'),_0x213973,'request\x20sent',JSON[_0x9c40('0x12')](_0x572327));if(_0x572327[_0x9c40('0x13')]){if(_0x572327[_0x9c40('0x13')][_0x9c40('0x14')]===0x1f4){logger[_0x9c40('0x13')]('UserNotification,\x20%s,\x20%s',_0x213973,_0x572327[_0x9c40('0x13')][_0x9c40('0x15')]);return _0x37c4ad(_0x572327[_0x9c40('0x13')][_0x9c40('0x15')]);}logger[_0x9c40('0x13')]('UserNotification,\x20%s,\x20%s',_0x213973,_0x572327[_0x9c40('0x13')]['message']);return _0x335dea(_0x572327[_0x9c40('0x13')][_0x9c40('0x15')]);}else{logger[_0x9c40('0x16')](_0x9c40('0xf'),_0x213973,_0x9c40('0x10'));_0x335dea(_0x572327[_0x9c40('0x17')]['message']);}})[_0x9c40('0x18')](function(_0x54f4a9){logger['error'](_0x9c40('0xf'),_0x213973,_0x54f4a9);_0x37c4ad(_0x54f4a9);});});} \ No newline at end of file +var _0x2714=['register','then','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','UserNotification,\x20%s,\x20%s','info','request\x20sent','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x787d44,_0x36fea9){var _0x1c1430=function(_0x18bcd6){while(--_0x18bcd6){_0x787d44['push'](_0x787d44['shift']());}};_0x1c1430(++_0x36fea9);}(_0x2714,0x12b));var _0x4271=function(_0x260c72,_0x199c24){_0x260c72=_0x260c72-0x0;var _0x552a11=_0x2714[_0x260c72];return _0x552a11;};'use strict';var _=require('lodash');var util=require(_0x4271('0x0'));var moment=require(_0x4271('0x1'));var BPromise=require(_0x4271('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4271('0x3'))['db'];var utils=require(_0x4271('0x4'));var logger=require(_0x4271('0x5'))('rpc');var config=require(_0x4271('0x6'));var jayson=require(_0x4271('0x7'));var client=jayson[_0x4271('0x8')][_0x4271('0x9')]({'port':0x232a});config[_0x4271('0xa')]=_['defaults'](config['redis'],{'host':_0x4271('0xb'),'port':0x18eb});var socket=require(_0x4271('0xc'))(new Redis(config['redis']));require('./userNotification.socket')[_0x4271('0xd')](socket);function respondWithRpcPromise(_0xff026,_0x142bf4,_0x41f033){return new BPromise(function(_0x23010b,_0x16a82c){return client['request'](_0xff026,_0x41f033)[_0x4271('0xe')](function(_0x5e0e45){logger['info']('UserNotification,\x20%s,\x20%s',_0x142bf4,'request\x20sent');logger[_0x4271('0xf')](_0x4271('0x10'),_0x142bf4,'request\x20sent',JSON[_0x4271('0x11')](_0x5e0e45));if(_0x5e0e45['error']){if(_0x5e0e45[_0x4271('0x12')]['code']===0x1f4){logger[_0x4271('0x12')]('UserNotification,\x20%s,\x20%s',_0x142bf4,_0x5e0e45[_0x4271('0x12')][_0x4271('0x13')]);return _0x16a82c(_0x5e0e45[_0x4271('0x12')][_0x4271('0x13')]);}logger[_0x4271('0x12')](_0x4271('0x14'),_0x142bf4,_0x5e0e45[_0x4271('0x12')][_0x4271('0x13')]);return _0x23010b(_0x5e0e45[_0x4271('0x12')][_0x4271('0x13')]);}else{logger[_0x4271('0x15')](_0x4271('0x14'),_0x142bf4,_0x4271('0x16'));_0x23010b(_0x5e0e45['result'][_0x4271('0x13')]);}})[_0x4271('0x17')](function(_0x8fa148){logger[_0x4271('0x12')]('UserNotification,\x20%s,\x20%s',_0x142bf4,_0x8fa148);_0x16a82c(_0x8fa148);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index c6474a6..89f2552 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 _0xfcb7=['length','./userNotification.events','save','remove','emit','removeListener','register'];(function(_0x4f475c,_0x48d78c){var _0x31402e=function(_0x4c72f8){while(--_0x4c72f8){_0x4f475c['push'](_0x4f475c['shift']());}};_0x31402e(++_0x48d78c);}(_0xfcb7,0xa9));var _0x7fcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcb7[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0x7fcb('0x0'));var events=[_0x7fcb('0x1'),_0x7fcb('0x2'),'update'];function createListener(_0x3c9b8b,_0x29938c){return function(_0x5ea2d5){_0x29938c[_0x7fcb('0x3')](_0x3c9b8b,_0x5ea2d5);};}function removeListener(_0x3dd82f,_0x5df628){return function(){UserNotificationEvents[_0x7fcb('0x4')](_0x3dd82f,_0x5df628);};}exports[_0x7fcb('0x5')]=function(_0xa692a4){for(var _0x40b25b=0x0,_0x43b1d7=events[_0x7fcb('0x6')];_0x40b25b<_0x43b1d7;_0x40b25b++){var _0x3866a4=events[_0x40b25b];var _0x4ce49d=createListener('userNotification:'+_0x3866a4,_0xa692a4);UserNotificationEvents['on'](_0x3866a4,_0x4ce49d);}}; \ No newline at end of file +var _0x2a43=['register','length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener'];(function(_0x3024ca,_0x3ba56c){var _0x2c9e32=function(_0x3d15dc){while(--_0x3d15dc){_0x3024ca['push'](_0x3024ca['shift']());}};_0x2c9e32(++_0x3ba56c);}(_0x2a43,0x1b3));var _0x32a4=function(_0x2859ff,_0x1e3250){_0x2859ff=_0x2859ff-0x0;var _0x2ba5d6=_0x2a43[_0x2859ff];return _0x2ba5d6;};'use strict';var UserNotificationEvents=require(_0x32a4('0x0'));var events=[_0x32a4('0x1'),_0x32a4('0x2'),_0x32a4('0x3')];function createListener(_0x2bca0b,_0x410c4d){return function(_0x24ec00){_0x410c4d[_0x32a4('0x4')](_0x2bca0b,_0x24ec00);};}function removeListener(_0x320390,_0x9b108a){return function(){UserNotificationEvents[_0x32a4('0x5')](_0x320390,_0x9b108a);};}exports[_0x32a4('0x6')]=function(_0x53f4d2){for(var _0x88d121=0x0,_0x38079d=events[_0x32a4('0x7')];_0x88d121<_0x38079d;_0x88d121++){var _0xea4bff=events[_0x88d121];var _0x14bbbf=createListener(_0x32a4('0x8')+_0xea4bff,_0x53f4d2);UserNotificationEvents['on'](_0xea4bff,_0x14bbbf);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 7fcd13c..edee75c 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4e8f3f,_0x39a27f){var _0x5ccf34=function(_0x201eb7){while(--_0x201eb7){_0x4e8f3f['push'](_0x4e8f3f['shift']());}};_0x5ccf34(++_0x39a27f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0xcb91[_0x295a3d];return _0x23a732;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x155506,_0x202f81){var _0x14b973=function(_0x560bd2){while(--_0x560bd2){_0x155506['push'](_0x155506['shift']());}};_0x14b973(++_0x202f81);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 56482c7..670b2e4 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 _0x93b9=['INTEGER','sequelize'];(function(_0x3ec2e8,_0xfa9b5d){var _0x3d3788=function(_0x52bcdd){while(--_0x52bcdd){_0x3ec2e8['push'](_0x3ec2e8['shift']());}};_0x3d3788(++_0xfa9b5d);}(_0x93b9,0x1d1));var _0x993b=function(_0x4e0359,_0x205155){_0x4e0359=_0x4e0359-0x0;var _0x450f0a=_0x93b9[_0x4e0359];return _0x450f0a;};'use strict';var Sequelize=require(_0x993b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x993b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x73e1=['exports','sequelize'];(function(_0x56d7a8,_0x2937bf){var _0x16e1a3=function(_0x214641){while(--_0x214641){_0x56d7a8['push'](_0x56d7a8['shift']());}};_0x16e1a3(++_0x2937bf);}(_0x73e1,0x133));var _0x173e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x73e1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x173e('0x0'));module[_0x173e('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 78e82aa..0ecbd01 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 _0x5a01=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x526f05,_0x268877){var _0x1120e3=function(_0x38ee4e){while(--_0x38ee4e){_0x526f05['push'](_0x526f05['shift']());}};_0x1120e3(++_0x268877);}(_0x5a01,0xa7));var _0x15a0=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0x5a01[_0x91384];return _0x44daa0;};'use strict';var _=require(_0x15a0('0x0'));var util=require(_0x15a0('0x1'));var logger=require(_0x15a0('0x2'))(_0x15a0('0x3'));var moment=require(_0x15a0('0x4'));var BPromise=require(_0x15a0('0x5'));var rp=require(_0x15a0('0x6'));var fs=require('fs');var path=require(_0x15a0('0x7'));var rimraf=require(_0x15a0('0x8'));var config=require('../../config/environment');var attributes=require(_0x15a0('0x9'));module[_0x15a0('0xa')]=function(_0x192ad1,_0x4e38e9){return _0x192ad1[_0x15a0('0xb')](_0x15a0('0xc'),attributes,{'tableName':_0x15a0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb4e=['request-promise','path','rimraf','exports','UserOpenchannelQueue','lodash','util','../../config/logger','api'];(function(_0x539df7,_0x1c028d){var _0x180d2a=function(_0x49e457){while(--_0x49e457){_0x539df7['push'](_0x539df7['shift']());}};_0x180d2a(++_0x1c028d);}(_0xfb4e,0x1be));var _0xefb4=function(_0x3e9ec6,_0x694640){_0x3e9ec6=_0x3e9ec6-0x0;var _0x29e452=_0xfb4e[_0x3e9ec6];return _0x29e452;};'use strict';var _=require(_0xefb4('0x0'));var util=require(_0xefb4('0x1'));var logger=require(_0xefb4('0x2'))(_0xefb4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xefb4('0x4'));var fs=require('fs');var path=require(_0xefb4('0x5'));var rimraf=require(_0xefb4('0x6'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0xefb4('0x7')]=function(_0x1b94cf,_0x2b61ae){return _0x1b94cf['define'](_0xefb4('0x8'),attributes,{'tableName':'user_has_openchannel_queues','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 fd8f051..e09ca42 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 _0xbfb4=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0xdbd609,_0x1ebb30){var _0x5e45e5=function(_0x14dbad){while(--_0x14dbad){_0xdbd609['push'](_0xdbd609['shift']());}};_0x5e45e5(++_0x1ebb30);}(_0xbfb4,0x8d));var _0x4bfb=function(_0x3f52cd,_0xa2ba27){_0x3f52cd=_0x3f52cd-0x0;var _0x5baf39=_0xbfb4[_0x3f52cd];return _0x5baf39;};'use strict';var _=require(_0x4bfb('0x0'));var util=require(_0x4bfb('0x1'));var moment=require('moment');var BPromise=require(_0x4bfb('0x2'));var rs=require(_0x4bfb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bfb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bfb('0x5'))(_0x4bfb('0x6'));var config=require(_0x4bfb('0x7'));var jayson=require(_0x4bfb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4cfc36,_0x539e3f,_0x568998){return new BPromise(function(_0x474d50,_0x1fdd8b){return client[_0x4bfb('0x9')](_0x4cfc36,_0x568998)[_0x4bfb('0xa')](function(_0xaf8575){logger[_0x4bfb('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x539e3f,'request\x20sent');logger[_0x4bfb('0xc')](_0x4bfb('0xd'),_0x539e3f,'request\x20sent',JSON[_0x4bfb('0xe')](_0xaf8575));if(_0xaf8575[_0x4bfb('0xf')]){if(_0xaf8575[_0x4bfb('0xf')][_0x4bfb('0x10')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x539e3f,_0xaf8575[_0x4bfb('0xf')][_0x4bfb('0x11')]);return _0x1fdd8b(_0xaf8575[_0x4bfb('0xf')]['message']);}logger[_0x4bfb('0xf')](_0x4bfb('0x12'),_0x539e3f,_0xaf8575[_0x4bfb('0xf')][_0x4bfb('0x11')]);return _0x474d50(_0xaf8575[_0x4bfb('0xf')][_0x4bfb('0x11')]);}else{logger[_0x4bfb('0xb')](_0x4bfb('0x12'),_0x539e3f,'request\x20sent');_0x474d50(_0xaf8575['result'][_0x4bfb('0x11')]);}})[_0x4bfb('0x13')](function(_0x2814cd){logger[_0x4bfb('0xf')](_0x4bfb('0x12'),_0x539e3f,_0x2814cd);_0x1fdd8b(_0x2814cd);});});} \ No newline at end of file +var _0x3743=['UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info'];(function(_0x39aedf,_0x2f5df8){var _0x39356c=function(_0x1411c9){while(--_0x1411c9){_0x39aedf['push'](_0x39aedf['shift']());}};_0x39356c(++_0x2f5df8);}(_0x3743,0xd0));var _0x3374=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x3743[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x3374('0x0'));var util=require('util');var moment=require(_0x3374('0x1'));var BPromise=require(_0x3374('0x2'));var rs=require(_0x3374('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3374('0x4'))['db'];var utils=require(_0x3374('0x5'));var logger=require(_0x3374('0x6'))(_0x3374('0x7'));var config=require('../../config/environment');var jayson=require(_0x3374('0x8'));var client=jayson[_0x3374('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bce66,_0xc96d53,_0x6c26c0){return new BPromise(function(_0x38c415,_0x2025a5){return client['request'](_0x5bce66,_0x6c26c0)[_0x3374('0xa')](function(_0x7b5ae3){logger[_0x3374('0xb')](_0x3374('0xc'),_0xc96d53,'request\x20sent');logger[_0x3374('0xd')](_0x3374('0xe'),_0xc96d53,_0x3374('0xf'),JSON['stringify'](_0x7b5ae3));if(_0x7b5ae3[_0x3374('0x10')]){if(_0x7b5ae3['error']['code']===0x1f4){logger[_0x3374('0x10')](_0x3374('0xc'),_0xc96d53,_0x7b5ae3[_0x3374('0x10')][_0x3374('0x11')]);return _0x2025a5(_0x7b5ae3[_0x3374('0x10')]['message']);}logger[_0x3374('0x10')](_0x3374('0xc'),_0xc96d53,_0x7b5ae3[_0x3374('0x10')][_0x3374('0x11')]);return _0x38c415(_0x7b5ae3['error'][_0x3374('0x11')]);}else{logger[_0x3374('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xc96d53,'request\x20sent');_0x38c415(_0x7b5ae3[_0x3374('0x12')][_0x3374('0x11')]);}})[_0x3374('0x13')](function(_0xa302d8){logger[_0x3374('0x10')](_0x3374('0xc'),_0xc96d53,_0xa302d8);_0x2025a5(_0xa302d8);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 58710df..89ac5b0 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 _0xd46f=['/:id','/:id/sections','getSections','/:id/resources','getResources','post','addResources','put','update','delete','removeSections','removeResources','exports','util','path','connect-timeout','Router','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2577ed,_0x4c09a2){var _0x116c1a=function(_0x1346af){while(--_0x1346af){_0x2577ed['push'](_0x2577ed['shift']());}};_0x116c1a(++_0x4c09a2);}(_0xd46f,0x1d5));var _0xfd46=function(_0x43d542,_0x4fb39b){_0x43d542=_0x43d542-0x0;var _0x19f182=_0xd46f[_0x43d542];return _0x19f182;};'use strict';var multer=require('multer');var util=require(_0xfd46('0x0'));var path=require(_0xfd46('0x1'));var timeout=require(_0xfd46('0x2'));var express=require('express');var router=express[_0xfd46('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfd46('0x4'));var config=require('../../config/environment');var controller=require(_0xfd46('0x5'));router[_0xfd46('0x6')]('/',auth[_0xfd46('0x7')](),controller[_0xfd46('0x8')]);router[_0xfd46('0x6')](_0xfd46('0x9'),auth[_0xfd46('0x7')](),controller[_0xfd46('0xa')]);router[_0xfd46('0x6')](_0xfd46('0xb'),auth[_0xfd46('0x7')](),controller['show']);router['get'](_0xfd46('0xc'),auth['isAuthenticated'](),controller[_0xfd46('0xd')]);router[_0xfd46('0x6')](_0xfd46('0xe'),auth[_0xfd46('0x7')](),controller[_0xfd46('0xf')]);router['post']('/',auth[_0xfd46('0x7')](),controller['create']);router['post']('/:id/clone',auth[_0xfd46('0x7')](),controller['clone']);router[_0xfd46('0x10')]('/:id/sections',auth[_0xfd46('0x7')](),controller['addSections']);router[_0xfd46('0x10')]('/:id/resources',auth[_0xfd46('0x7')](),controller[_0xfd46('0x11')]);router[_0xfd46('0x12')]('/:id',auth[_0xfd46('0x7')](),controller[_0xfd46('0x13')]);router[_0xfd46('0x14')](_0xfd46('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xfd46('0x14')](_0xfd46('0xc'),auth['isAuthenticated'](),controller[_0xfd46('0x15')]);router[_0xfd46('0x14')]('/:id/resources',auth[_0xfd46('0x7')](),controller[_0xfd46('0x16')]);module[_0xfd46('0x17')]=router; \ No newline at end of file +var _0x5cd5=['../../config/environment','./userProfile.controller','get','isAuthenticated','/:id','/:id/sections','getSections','/:id/resources','post','/:id/clone','clone','addResources','put','update','delete','removeSections','removeResources','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5e9e3d,_0x567718){var _0x579c2c=function(_0xc24425){while(--_0xc24425){_0x5e9e3d['push'](_0x5e9e3d['shift']());}};_0x579c2c(++_0x567718);}(_0x5cd5,0x10b));var _0x55cd=function(_0x45b9cd,_0x5caca1){_0x45b9cd=_0x45b9cd-0x0;var _0x468d3c=_0x5cd5[_0x45b9cd];return _0x468d3c;};'use strict';var multer=require(_0x55cd('0x0'));var util=require(_0x55cd('0x1'));var path=require(_0x55cd('0x2'));var timeout=require(_0x55cd('0x3'));var express=require(_0x55cd('0x4'));var router=express[_0x55cd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x55cd('0x6'));var interaction=require(_0x55cd('0x7'));var config=require(_0x55cd('0x8'));var controller=require(_0x55cd('0x9'));router[_0x55cd('0xa')]('/',auth[_0x55cd('0xb')](),controller['index']);router[_0x55cd('0xa')]('/describe',auth[_0x55cd('0xb')](),controller['describe']);router[_0x55cd('0xa')](_0x55cd('0xc'),auth[_0x55cd('0xb')](),controller['show']);router['get'](_0x55cd('0xd'),auth[_0x55cd('0xb')](),controller[_0x55cd('0xe')]);router[_0x55cd('0xa')](_0x55cd('0xf'),auth[_0x55cd('0xb')](),controller['getResources']);router['post']('/',auth[_0x55cd('0xb')](),controller['create']);router[_0x55cd('0x10')](_0x55cd('0x11'),auth['isAuthenticated'](),controller[_0x55cd('0x12')]);router['post']('/:id/sections',auth[_0x55cd('0xb')](),controller['addSections']);router[_0x55cd('0x10')](_0x55cd('0xf'),auth[_0x55cd('0xb')](),controller[_0x55cd('0x13')]);router[_0x55cd('0x14')](_0x55cd('0xc'),auth['isAuthenticated'](),controller[_0x55cd('0x15')]);router[_0x55cd('0x16')](_0x55cd('0xc'),auth[_0x55cd('0xb')](),controller['destroy']);router[_0x55cd('0x16')](_0x55cd('0xd'),auth['isAuthenticated'](),controller[_0x55cd('0x17')]);router[_0x55cd('0x16')](_0x55cd('0xf'),auth[_0x55cd('0xb')](),controller[_0x55cd('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 82c7efd..f028c37 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 _0x2b36=['getDataValue','crudPermissions','split','BOOLEAN','exports','STRING','name','join'];(function(_0xd9eef7,_0x39fcab){var _0x584cff=function(_0x555e21){while(--_0x555e21){_0xd9eef7['push'](_0xd9eef7['shift']());}};_0x584cff(++_0x39fcab);}(_0x2b36,0x10c));var _0x62b3=function(_0x3b438c,_0x255a1f){_0x3b438c=_0x3b438c-0x0;var _0x4474e4=_0x2b36[_0x3b438c];return _0x4474e4;};'use strict';var Sequelize=require('sequelize');module[_0x62b3('0x0')]={'name':{'type':Sequelize[_0x62b3('0x1')],'allowNull':![],'unique':_0x62b3('0x2')},'crudPermissions':{'type':Sequelize[_0x62b3('0x1')],'set':function(_0x53a2af){this['setDataValue']('crudPermissions',_0x53a2af?_0x53a2af[_0x62b3('0x3')](''):[]);},'get':function(){return this[_0x62b3('0x4')]('crudPermissions')?this[_0x62b3('0x4')](_0x62b3('0x5'))[_0x62b3('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x62b3('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x62b3('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x62b3('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x62b3('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x62b3('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x62b3('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x62b3('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x51fb=['STRING','setDataValue','crudPermissions','getDataValue','split','BOOLEAN','sequelize','name'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x51fb,0x96));var _0xb51f=function(_0x1cd6af,_0xab7193){_0x1cd6af=_0x1cd6af-0x0;var _0x4a2b1a=_0x51fb[_0x1cd6af];return _0x4a2b1a;};'use strict';var Sequelize=require(_0xb51f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb51f('0x1')},'crudPermissions':{'type':Sequelize[_0xb51f('0x2')],'set':function(_0xf2899c){this[_0xb51f('0x3')](_0xb51f('0x4'),_0xf2899c?_0xf2899c['join'](''):[]);},'get':function(){return this[_0xb51f('0x5')]('crudPermissions')?this[_0xb51f('0x5')](_0xb51f('0x4'))[_0xb51f('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb51f('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb51f('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb51f('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb51f('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb51f('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'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 e9493a1..c517632 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 _0x9321=['fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','then','error','stack','name','map','UserProfile','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','body','clone','get','omit','createdAt','updatedAt','sequelize','transaction','create','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','destroy','describe','addSections','push','enabled','includes','subsections','concat','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf'];(function(_0x35f969,_0x2c03bd){var _0x373c46=function(_0x480568){while(--_0x480568){_0x35f969['push'](_0x35f969['shift']());}};_0x373c46(++_0x2c03bd);}(_0x9321,0x69));var _0x1932=function(_0x2988d6,_0xc91bab){_0x2988d6=_0x2988d6-0x0;var _0x17db09=_0x9321[_0x2988d6];return _0x17db09;};'use strict';var emlformat=require(_0x1932('0x0'));var rimraf=require(_0x1932('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1932('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1932('0x3'));var Mustache=require(_0x1932('0x4'));var util=require(_0x1932('0x5'));var path=require(_0x1932('0x6'));var sox=require(_0x1932('0x7'));var csv=require(_0x1932('0x8'));var ejs=require(_0x1932('0x9'));var fs=require('fs');var fs_extra=require(_0x1932('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1932('0xb'));var jsforce=require(_0x1932('0xc'));var deskjs=require(_0x1932('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1932('0xe'));var Papa=require(_0x1932('0xf'));var Redis=require('ioredis');var authService=require(_0x1932('0x10'));var qs=require(_0x1932('0x11'));var as=require(_0x1932('0x12'));var hardwareService=require(_0x1932('0x13'));var logger=require(_0x1932('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1932('0x15'));var licenseUtil=require(_0x1932('0x16'));var db=require(_0x1932('0x17'))['db'];config[_0x1932('0x18')]=_['defaults'](config[_0x1932('0x18')],{'host':_0x1932('0x19'),'port':0x18eb});var socket=require(_0x1932('0x1a'))(new Redis(config[_0x1932('0x18')]));require('./userProfile.socket')[_0x1932('0x1b')](socket);function respondWithStatusCode(_0x139f13,_0x508c7b){_0x508c7b=_0x508c7b||0xcc;return function(_0x13ff1d){if(_0x13ff1d){return _0x139f13['sendStatus'](_0x508c7b);}return _0x139f13[_0x1932('0x1c')](_0x508c7b)[_0x1932('0x1d')]();};}function respondWithResult(_0x55a15a,_0x573a44){_0x573a44=_0x573a44||0xc8;return function(_0x32f449){if(_0x32f449){return _0x55a15a[_0x1932('0x1c')](_0x573a44)[_0x1932('0x1e')](_0x32f449);}};}function respondWithFilteredResult(_0x337272,_0x35315a){return function(_0x3bdcf2){if(_0x3bdcf2){var _0x228553=typeof _0x35315a['offset']===_0x1932('0x1f')&&typeof _0x35315a['limit']===_0x1932('0x1f');var _0x55d00c=_0x3bdcf2['count'];var _0x47a224=_0x228553?0x0:_0x35315a[_0x1932('0x20')];var _0x4b8632=_0x228553?_0x3bdcf2[_0x1932('0x21')]:_0x35315a['offset']+_0x35315a[_0x1932('0x22')];var _0x5ec8a1;if(_0x4b8632>=_0x55d00c){_0x4b8632=_0x55d00c;_0x5ec8a1=0xc8;}else{_0x5ec8a1=0xce;}_0x337272[_0x1932('0x1c')](_0x5ec8a1);return _0x337272[_0x1932('0x23')](_0x1932('0x24'),_0x47a224+'-'+_0x4b8632+'/'+_0x55d00c)[_0x1932('0x1e')](_0x3bdcf2);}return null;};}function patchUpdates(_0x46878c){return function(_0xefc049){try{jsonpatch[_0x1932('0x25')](_0xefc049,_0x46878c,!![]);}catch(_0x1e9dfc){return BPromise[_0x1932('0x26')](_0x1e9dfc);}return _0xefc049['save']();};}function saveUpdates(_0x4ef5c6,_0x1e52c2){return function(_0x3c582f){if(_0x3c582f){return _0x3c582f['update'](_0x4ef5c6)[_0x1932('0x27')](function(_0x499675){return _0x499675;});}return null;};}function removeEntity(_0x519bec,_0x4bf7d1){return function(_0x4e0ea1){if(_0x4e0ea1){return _0x4e0ea1['destroy']()[_0x1932('0x27')](function(){_0x519bec['status'](0xcc)[_0x1932('0x1d')]();});}};}function handleEntityNotFound(_0x1ace00,_0xe5bb67){return function(_0x440914){if(!_0x440914){_0x1ace00['sendStatus'](0x194);}return _0x440914;};}function handleError(_0x427e92,_0x46227d){_0x46227d=_0x46227d||0x1f4;return function(_0x262449){logger[_0x1932('0x28')](_0x262449[_0x1932('0x29')]);if(_0x262449['name']){delete _0x262449[_0x1932('0x2a')];}_0x427e92[_0x1932('0x1c')](_0x46227d)['send'](_0x262449);};}exports['index']=function(_0xcbfea2,_0x11313b){var _0x11d7bd={},_0x510680={},_0x125fa6={'count':0x0,'rows':[]};var _0x3fa0f6=_[_0x1932('0x2b')](db[_0x1932('0x2c')]['rawAttributes'],function(_0x3e2ce2){return{'name':_0x3e2ce2[_0x1932('0x2d')],'type':_0x3e2ce2[_0x1932('0x2e')][_0x1932('0x2f')]};});_0x510680['model']=_['map'](_0x3fa0f6,'name');_0x510680['query']=_[_0x1932('0x30')](_0xcbfea2[_0x1932('0x31')]);_0x510680['filters']=_[_0x1932('0x32')](_0x510680[_0x1932('0x33')],_0x510680['query']);_0x11d7bd[_0x1932('0x34')]=_[_0x1932('0x32')](_0x510680[_0x1932('0x33')],qs[_0x1932('0x35')](_0xcbfea2[_0x1932('0x31')]['fields']));_0x11d7bd['attributes']=_0x11d7bd[_0x1932('0x34')][_0x1932('0x36')]?_0x11d7bd['attributes']:_0x510680[_0x1932('0x33')];if(!_0xcbfea2[_0x1932('0x31')]['hasOwnProperty'](_0x1932('0x37'))){_0x11d7bd[_0x1932('0x22')]=qs[_0x1932('0x22')](_0xcbfea2[_0x1932('0x31')]['limit']);_0x11d7bd[_0x1932('0x20')]=qs[_0x1932('0x20')](_0xcbfea2[_0x1932('0x31')][_0x1932('0x20')]);}_0x11d7bd['order']=qs[_0x1932('0x38')](_0xcbfea2[_0x1932('0x31')][_0x1932('0x38')]);_0x11d7bd[_0x1932('0x39')]=qs[_0x1932('0x3a')](_['pick'](_0xcbfea2['query'],_0x510680[_0x1932('0x3a')]),_0x3fa0f6);if(_0xcbfea2[_0x1932('0x31')][_0x1932('0x3b')]){_0x11d7bd[_0x1932('0x39')]=_[_0x1932('0x3c')](_0x11d7bd['where'],{'$or':_[_0x1932('0x2b')](_0x3fa0f6,function(_0x116442){if(_0x116442['type']!==_0x1932('0x3d')){var _0x1c2419={};_0x1c2419[_0x116442['name']]={'$like':'%'+_0xcbfea2[_0x1932('0x31')][_0x1932('0x3b')]+'%'};return _0x1c2419;}})});}_0x11d7bd=_['merge']({},_0x11d7bd,_0xcbfea2[_0x1932('0x3e')]);var _0x150b69={'where':_0x11d7bd[_0x1932('0x39')]};return db[_0x1932('0x2c')][_0x1932('0x21')](_0x150b69)[_0x1932('0x27')](function(_0x4740f8){_0x125fa6[_0x1932('0x21')]=_0x4740f8;if(_0xcbfea2[_0x1932('0x31')][_0x1932('0x3f')]){_0x11d7bd[_0x1932('0x40')]=[{'all':!![]}];}return db[_0x1932('0x2c')][_0x1932('0x41')](_0x11d7bd);})['then'](function(_0x483319){_0x125fa6[_0x1932('0x42')]=_0x483319;return _0x125fa6;})[_0x1932('0x27')](respondWithFilteredResult(_0x11313b,_0x11d7bd))[_0x1932('0x43')](handleError(_0x11313b,null));};exports['show']=function(_0x50aa72,_0x544925){var _0x2c4107={'raw':![],'where':{'id':_0x50aa72[_0x1932('0x44')]['id']}},_0x257166={};_0x257166[_0x1932('0x33')]=_['keys'](db['UserProfile'][_0x1932('0x45')]);_0x257166[_0x1932('0x31')]=_[_0x1932('0x30')](_0x50aa72[_0x1932('0x31')]);_0x257166[_0x1932('0x3a')]=_['intersection'](_0x257166[_0x1932('0x33')],_0x257166[_0x1932('0x31')]);_0x2c4107[_0x1932('0x34')]=_[_0x1932('0x32')](_0x257166[_0x1932('0x33')],qs[_0x1932('0x35')](_0x50aa72['query']['fields']));_0x2c4107[_0x1932('0x34')]=_0x2c4107[_0x1932('0x34')]['length']?_0x2c4107[_0x1932('0x34')]:_0x257166[_0x1932('0x33')];if(_0x50aa72[_0x1932('0x31')][_0x1932('0x3f')]){_0x2c4107['include']=[{'all':!![]}];}_0x2c4107=_[_0x1932('0x3c')]({},_0x2c4107,_0x50aa72[_0x1932('0x3e')]);return db[_0x1932('0x2c')][_0x1932('0x46')](_0x2c4107)[_0x1932('0x27')](handleEntityNotFound(_0x544925,null))[_0x1932('0x27')](respondWithResult(_0x544925,null))[_0x1932('0x43')](handleError(_0x544925,null));};exports['create']=function(_0x4c6f89,_0x1333ee){return db[_0x1932('0x2c')]['create'](_0x4c6f89[_0x1932('0x47')],{})[_0x1932('0x27')](respondWithResult(_0x1333ee,0xc9))[_0x1932('0x43')](handleError(_0x1333ee,null));};exports[_0x1932('0x48')]=function(_0x59337b,_0x23becd){var _0x1911a3={'where':{'id':_0x59337b[_0x1932('0x44')]['id']}},_0x73ef04={};_0x73ef04['model']=_[_0x1932('0x30')](db[_0x1932('0x2c')][_0x1932('0x45')]);_0x1911a3['attributes']=_['intersection'](_0x73ef04['model'],qs[_0x1932('0x35')](_0x59337b['query'][_0x1932('0x35')]));_0x1911a3['attributes']=_0x1911a3[_0x1932('0x34')][_0x1932('0x36')]?_0x1911a3['attributes']:_0x73ef04['model'];if(_0x59337b[_0x1932('0x31')][_0x1932('0x3f')]){_0x1911a3['include']=[{'all':!![]}];}_0x1911a3=_['merge']({},_0x1911a3,_0x59337b[_0x1932('0x3e')]);return db[_0x1932('0x2c')][_0x1932('0x46')](_0x1911a3)[_0x1932('0x27')](handleEntityNotFound(_0x23becd,null))[_0x1932('0x27')](function(_0x3c2a8f){if(_0x3c2a8f){var _0x2ee1ec=_0x3c2a8f[_0x1932('0x49')]({'plain':!![]});_0x2ee1ec=qs[_0x1932('0x4a')](_0x2ee1ec,['id',_0x1932('0x4b'),_0x1932('0x4c'),'crudPermissions']);_0x59337b[_0x1932('0x47')]=_['omit'](_0x59337b[_0x1932('0x47')],['id',_0x1932('0x4b'),'updatedAt']);return db[_0x1932('0x4d')][_0x1932('0x4e')](function(_0x589560){return db[_0x1932('0x2c')][_0x1932('0x4f')](_[_0x1932('0x3c')](_0x2ee1ec,_0x59337b[_0x1932('0x47')]),{'include':_0x59337b['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x589560})[_0x1932('0x27')](function(_0x1f6a8b){var _0x3b1557=_0x1f6a8b[_0x1932('0x49')]({'plain':!![]});return db[_0x1932('0x50')]['findAll']({'where':{'userProfileId':_0x59337b[_0x1932('0x44')]['id']},'raw':!![]})[_0x1932('0x27')](function(_0x9f1be7){if(_0x9f1be7){return BPromise[_0x1932('0x51')](_0x9f1be7,function(_0x1ac7e7){return new BPromise(function(_0x361e12,_0x14e890){if(_0x1ac7e7[_0x1932('0x52')]===null||_0x1ac7e7['autoAssociation']===0x1)_0x361e12(null);return db[_0x1932('0x53')][_0x1932('0x41')]({'where':{'sectionId':_0x1ac7e7['id']},'raw':!![]})[_0x1932('0x27')](function(_0x25a1ac){var _0x337235=_['map'](_0x25a1ac,function(_0x1ea6c2){return qs[_0x1932('0x4a')](_0x1ea6c2,['id',_0x1932('0x4b'),_0x1932('0x4c'),_0x1932('0x54')]);});_0x361e12(_0x337235);})[_0x1932('0x43')](function(_0x546380){_0x14e890(_0x546380);});})['then'](function(_0x34721d){var _0xee1f05=qs[_0x1932('0x4a')](_0x1ac7e7,['id',_0x1932('0x4b'),_0x1932('0x4c')]);_0xee1f05[_0x1932('0x55')]=_0x3b1557['id'];if(_0x34721d)_0xee1f05['Resources']=_0x34721d;return _0xee1f05;})[_0x1932('0x27')](function(_0x43b070){return db[_0x1932('0x50')][_0x1932('0x4f')](_0x43b070,{'include':[{'model':db['UserProfileResource'],'as':_0x1932('0x56')}],'raw':!![],'transaction':_0x589560});});})[_0x1932('0x27')](function(){return _0x3b1557;});}});});});}})[_0x1932('0x27')](respondWithResult(_0x23becd,0xc9))[_0x1932('0x43')](handleError(_0x23becd,null));};exports[_0x1932('0x57')]=function(_0x1485dd,_0x49fbd8){if(_0x1485dd[_0x1932('0x47')]['id']){delete _0x1485dd[_0x1932('0x47')]['id'];}return db['UserProfile'][_0x1932('0x46')]({'where':{'id':_0x1485dd['params']['id']}})[_0x1932('0x27')](handleEntityNotFound(_0x49fbd8,null))[_0x1932('0x27')](saveUpdates(_0x1485dd[_0x1932('0x47')],null))[_0x1932('0x27')](respondWithResult(_0x49fbd8,null))[_0x1932('0x43')](handleError(_0x49fbd8,null));};exports[_0x1932('0x58')]=function(_0x519d1d,_0x2f1699){return db[_0x1932('0x2c')][_0x1932('0x46')]({'where':{'id':_0x519d1d['params']['id']}})['then'](handleEntityNotFound(_0x2f1699,null))[_0x1932('0x27')](removeEntity(_0x2f1699,null))['catch'](handleError(_0x2f1699,null));};exports[_0x1932('0x59')]=function(_0x5c6334,_0x3cd48d){return db['UserProfile']['describe']()[_0x1932('0x27')](respondWithResult(_0x3cd48d,null))[_0x1932('0x43')](handleError(_0x3cd48d,null));};exports[_0x1932('0x5a')]=function(_0x5f2019,_0x11770f){var _0xca7092=_0x5f2019[_0x1932('0x47')];return db['UserProfile'][_0x1932('0x46')]({'where':{'id':_0x5f2019[_0x1932('0x44')]['id']}})['then'](handleEntityNotFound(_0x11770f,null))[_0x1932('0x27')](function(_0x4667c7){if(_0x4667c7){return db['sequelize']['transaction'](function(_0x576305){return db[_0x1932('0x50')][_0x1932('0x58')]({'where':{'userProfileId':_0x5f2019[_0x1932('0x44')]['id'],'sectionId':_[_0x1932('0x2b')](_0xca7092,function(_0x976bd7){return _0x976bd7[_0x1932('0x54')];})},'transaction':_0x576305})[_0x1932('0x27')](function(){var _0x8f732=_[_0x1932('0x2b')](_0xca7092,function(_0x3d8df1){_0x3d8df1[_0x1932('0x55')]=_0x5f2019[_0x1932('0x44')]['id'];return _0x3d8df1;});var _0x5bb235=[];return BPromise[_0x1932('0x51')](_0x8f732,function(_0x407173){return db[_0x1932('0x50')]['create'](_0x407173,{'include':[{'model':db[_0x1932('0x53')],'as':_0x1932('0x56')}],'raw':!![],'transaction':_0x576305})['then'](function(_0x203682){_0x5bb235[_0x1932('0x5b')](_0x203682[_0x1932('0x49')]({'plain':!![]}));});})[_0x1932('0x27')](function(){return _0x5bb235;});});});}})[_0x1932('0x27')](function(_0x585673){return _0x585673;})[_0x1932('0x27')](respondWithResult(_0x11770f,null))[_0x1932('0x43')](handleError(_0x11770f,null));};exports['removeSections']=function(_0x33ac39,_0x51f697){var _0x418226;return db['UserProfile']['find']({'where':{'id':_0x33ac39[_0x1932('0x44')]['id']},'attributes':['id',_0x1932('0x2a')]})[_0x1932('0x27')](handleEntityNotFound(_0x51f697,null))['then'](function(_0x4fc700){if(_0x4fc700){_0x418226=_0x4fc700;return db['UserProfileSection'][_0x1932('0x58')]({'where':{'userProfileId':_0x33ac39[_0x1932('0x44')]['id'],'sectionId':_0x33ac39[_0x1932('0x31')]['ids']}});}})['then'](function(){return _0x418226;})[_0x1932('0x27')](respondWithStatusCode(_0x51f697,null))[_0x1932('0x43')](handleError(_0x51f697,null));};exports['getSections']=function(_0x41690e,_0x5dedc5){var _0xebdcbf=[];var _0x2abde9=[];return db[_0x1932('0x50')][_0x1932('0x41')]({'where':{'userProfileId':_0x41690e['params']['id']},'raw':!![]})['then'](function(_0x164179){_0xebdcbf=_[_0x1932('0x3b')](_0x164179,function(_0xc03ba5){return _0xc03ba5[_0x1932('0x5c')]===0x1||_[_0x1932('0x5d')]([0x3eb,0x709],_0xc03ba5['sectionId']);});if(!_['isEmpty'](_0xebdcbf)){return _[_0x1932('0x2b')](_0xebdcbf,function(_0x48cf87){return _0x48cf87[_0x1932('0x54')];});}else{return;}})[_0x1932('0x27')](function(_0x528f87){if(_0x528f87)_0x2abde9=_0x528f87;if(_[_0x1932('0x5d')](_0x2abde9,0x64)){var _0x18e763=_[_0x1932('0x46')](_0xebdcbf,{'sectionId':0x64});return hasDefaultDashboard(_0x18e763)[_0x1932('0x27')](function(_0x5c91de){return _[_0x1932('0x2b')](_0xebdcbf,function(_0x53298b){if(_0x53298b['sectionId']===0x64){_0x53298b[_0x1932('0x5e')]=_0x5c91de;}return _0x53298b;});});}else{return;}})[_0x1932('0x27')](function(_0x2ae945){if(_0x2ae945)_0xebdcbf=_0x2ae945;if(_[_0x1932('0x5d')](_0x2abde9,0x3eb)){var _0x458191=_[_0x1932('0x46')](_0xebdcbf,{'sectionId':0x3eb});return getCustomDashboards(_0x458191)[_0x1932('0x27')](function(_0x1ada3f){return _[_0x1932('0x2b')](_0xebdcbf,function(_0x1241e6){if(_0x458191[_0x1932('0x5c')]){if(_0x1241e6[_0x1932('0x54')]===0x3eb){_0x1241e6[_0x1932('0x5e')]=_0x1ada3f;}}else{if(_0x1241e6['sectionId']===0x64){if(!_0x1241e6[_0x1932('0x5e')]){_0x1241e6['subsections']=[];}_0x1241e6[_0x1932('0x5e')]=_0x1241e6[_0x1932('0x5e')][_0x1932('0x5f')](_0x1ada3f);}}return _0x1241e6;});});}else{return;}})[_0x1932('0x27')](function(_0xd3f803){if(_0xd3f803)_0xebdcbf=_0xd3f803;if(_['includes'](_0x2abde9,0x709)){var _0x47e50c=_[_0x1932('0x46')](_0xebdcbf,{'sectionId':0x709});return getPlugins(_0x47e50c)[_0x1932('0x27')](function(_0x5d3fd5){if(_0x47e50c['enabled']){return _[_0x1932('0x2b')](_0xebdcbf,function(_0x1dfe9b){if(_0x1dfe9b['sectionId']===0x709){_0x1dfe9b[_0x1932('0x5e')]=_0x5d3fd5;}return _0x1dfe9b;});}else{var _0x55aac5={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5d3fd5};var _0x2b11b5=_[_0x1932('0x2b')](_0xebdcbf);_0x2b11b5['push'](_0x55aac5);return _0x2b11b5;}});}else{return;}})[_0x1932('0x27')](function(_0x6be419){if(_0x6be419)_0xebdcbf=_0x6be419;return _['filter'](_0xebdcbf,[_0x1932('0x5c'),0x1]);})[_0x1932('0x27')](respondWithResult(_0x5dedc5,null))[_0x1932('0x43')](handleError(_0x5dedc5,null));};function hasDefaultDashboard(_0x96dca9){var _0x49621d=[0x65];return new BPromise(function(_0x546db6,_0x3da89e){try{if(_0x96dca9[_0x1932('0x52')]){_0x546db6(_0x49621d);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x96dca9['id']},'raw':!![]})[_0x1932('0x27')](function(_0x1622f4){_0x1622f4?_0x546db6(_0x49621d):_0x546db6();});}}catch(_0x3fa6bf){_0x3da89e(_0x3fa6bf);}});}function getCustomDashboards(_0x58e73f){var _0x50f264=[];return new BPromise(function(_0x1f316e,_0x22fe18){try{if(_0x58e73f['autoAssociation']){return db['Dashboard'][_0x1932('0x41')]({'raw':!![]})[_0x1932('0x27')](function(_0xa34d0d){_0xa34d0d[_0x1932('0x60')](function(_0x2f77e8){_0x50f264['push'](_0x2f77e8['id']+0x1869f);});_0x1f316e(_0x50f264);});}else{return db[_0x1932('0x53')][_0x1932('0x41')]({'where':{'sectionId':_0x58e73f['id']},'raw':!![]})['then'](function(_0x410e8){_0x410e8[_0x1932('0x60')](function(_0x3a834c){_0x50f264[_0x1932('0x5b')](_0x3a834c[_0x1932('0x61')]+0x1869f);});_0x1f316e(_0x50f264);});}}catch(_0x5bee47){_0x22fe18(_0x5bee47);}});}function getPlugins(_0x5a92b5){var _0x4e4adb=[];return new BPromise(function(_0x8a6d28,_0x262015){try{if(_0x5a92b5['autoAssociation']){return db[_0x1932('0x62')][_0x1932('0x41')]({'raw':!![]})[_0x1932('0x27')](function(_0x4190bb){_0x4190bb['forEach'](function(_0x2531e5){_0x4e4adb[_0x1932('0x5b')](_0x2531e5['id']+0x15b38);});_0x8a6d28(_0x4e4adb);});}else{return db[_0x1932('0x53')]['findAll']({'where':{'sectionId':_0x5a92b5['id']},'raw':!![]})[_0x1932('0x27')](function(_0x366b8c){_0x366b8c[_0x1932('0x60')](function(_0xbf205f){_0x4e4adb[_0x1932('0x5b')](_0xbf205f[_0x1932('0x61')]+0x15b38);});_0x8a6d28(_0x4e4adb);});}}catch(_0x517df8){_0x262015(_0x517df8);}});}exports[_0x1932('0x63')]=function(_0x5f3a0c,_0x4ad0a4){return db[_0x1932('0x2c')][_0x1932('0x46')]({'where':{'id':_0x5f3a0c['params']['id']}})['then'](handleEntityNotFound(_0x4ad0a4,null))[_0x1932('0x27')](function(_0x1513dd){if(_0x1513dd){return db['sequelize'][_0x1932('0x4e')](function(_0x5145d8){return db[_0x1932('0x50')]['findAll']({'where':{'userProfileId':_0x5f3a0c['params']['id']},'attributes':['id'],'raw':!![]})[_0x1932('0x27')](function(_0x552d26){if(_0x552d26){return db[_0x1932('0x50')][_0x1932('0x58')]({'where':{'userProfileId':_0x5f3a0c[_0x1932('0x44')]['id'],'id':_[_0x1932('0x2b')](_0x552d26,function(_0x4a99bd){return _0x4a99bd['id'];})},'transaction':_0x5145d8});}})['then'](function(_0x3c90ea){var _0x43ccae=_[_0x1932('0x2b')](_0x5f3a0c['body'],function(_0xda0ea2){_0xda0ea2['userProfileId']=_0x5f3a0c[_0x1932('0x44')]['id'];return _0xda0ea2;});return db['UserProfileSection'][_0x1932('0x64')](_0x43ccae,{'raw':!![],'transaction':_0x5145d8});})[_0x1932('0x27')](function(_0xf865a2){var _0x38904c=_['filter'](_[_0x1932('0x2b')](_0xf865a2,function(_0x211a33){return _0x211a33[_0x1932('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x38904c){return db['UserProfileSection'][_0x1932('0x41')]({'where':{'userProfileId':_0x5f3a0c[_0x1932('0x44')]['id'],'sectionId':_['map'](_0x38904c,function(_0x507714){return _0x507714[_0x1932('0x54')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x1932('0x27')](function(_0x367d33){var _0x20abe6=_[_0x1932('0x2b')](_0x5f3a0c[_0x1932('0x47')],function(_0x26d8b3){_0x26d8b3[_0x1932('0x55')]=_0x5f3a0c[_0x1932('0x44')]['id'];return _0x26d8b3;});return db['UserProfileResource'][_0x1932('0x64')](_0x20abe6,{'raw':!![],'transaction':_0x5145d8});});}})[_0x1932('0x43')](handleError(_0x4ad0a4,null));});}})[_0x1932('0x27')](function(_0x2122ab){var _0x5c8784=_[_0x1932('0x2b')](_0x2122ab,function(_0x4a9e3b){return _0x4a9e3b['get']({'plain':!![]});});})[_0x1932('0x27')](respondWithResult(_0x4ad0a4,null))[_0x1932('0x43')](handleError(_0x4ad0a4,null));};exports[_0x1932('0x65')]=function(_0x951044,_0x1fce21,_0x4d02c3){return db[_0x1932('0x2c')][_0x1932('0x46')]({'where':{'id':_0x951044[_0x1932('0x44')]['id']}})[_0x1932('0x27')](handleEntityNotFound(_0x1fce21,null))[_0x1932('0x27')](function(_0x511d5d){if(_0x511d5d){return _0x511d5d['removeResources'](_0x951044[_0x1932('0x31')][_0x1932('0x66')]);}})[_0x1932('0x27')](respondWithStatusCode(_0x1fce21,null))['catch'](handleError(_0x1fce21,null));};exports['getResources']=function(_0xae03dc,_0x7951a5){var _0x57e8c8={};if(!_0xae03dc[_0x1932('0x31')]['section'])throw new Error(_0x1932('0x67'));if(!_0xae03dc[_0x1932('0x31')][_0x1932('0x68')](_0x1932('0x37'))){_0x57e8c8[_0x1932('0x22')]=qs['limit'](_0xae03dc[_0x1932('0x31')][_0x1932('0x22')]);_0x57e8c8[_0x1932('0x20')]=qs[_0x1932('0x20')](_0xae03dc['query']['offset']);}return db[_0x1932('0x2c')][_0x1932('0x46')]({'where':{'id':_0xae03dc[_0x1932('0x44')]['id']}})[_0x1932('0x27')](function(_0x23faba){if(!_0x23faba)throw new Error(_0x1932('0x69')+_0xae03dc[_0x1932('0x44')]['id']);return db[_0x1932('0x2c')][_0x1932('0x6a')](_0xae03dc);})[_0x1932('0x27')](respondWithFilteredResult(_0x7951a5,_0x57e8c8))['catch'](handleError(_0x7951a5,null));}; \ No newline at end of file +var _0x4f2f=['name','send','index','map','UserProfile','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','catch','show','params','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','findAll','userProfileId','Resources','destroy','addSections','sectionId','push','getSections','enabled','includes','isEmpty','subsections','concat','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','getResources','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','localhost','redis','./userProfile.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack'];(function(_0xfdd1b0,_0x3c29ea){var _0x394105=function(_0x13b93f){while(--_0x13b93f){_0xfdd1b0['push'](_0xfdd1b0['shift']());}};_0x394105(++_0x3c29ea);}(_0x4f2f,0x120));var _0xf4f2=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x4f2f[_0x1fc122];return _0xa2cb13;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf4f2('0x0'));var rp=require(_0xf4f2('0x1'));var moment=require(_0xf4f2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf4f2('0x3'));var util=require(_0xf4f2('0x4'));var path=require(_0xf4f2('0x5'));var sox=require(_0xf4f2('0x6'));var csv=require(_0xf4f2('0x7'));var ejs=require(_0xf4f2('0x8'));var fs=require('fs');var fs_extra=require(_0xf4f2('0x9'));var _=require(_0xf4f2('0xa'));var squel=require(_0xf4f2('0xb'));var crypto=require(_0xf4f2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf4f2('0xd'));var toCsv=require(_0xf4f2('0x7'));var querystring=require(_0xf4f2('0xe'));var Papa=require('papaparse');var Redis=require(_0xf4f2('0xf'));var authService=require(_0xf4f2('0x10'));var qs=require(_0xf4f2('0x11'));var as=require(_0xf4f2('0x12'));var hardwareService=require(_0xf4f2('0x13'));var logger=require(_0xf4f2('0x14'))(_0xf4f2('0x15'));var utils=require(_0xf4f2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf4f2('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf4f2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4f2('0x19')]));require(_0xf4f2('0x1a'))['register'](socket);function respondWithStatusCode(_0x469adf,_0x1cf93e){_0x1cf93e=_0x1cf93e||0xcc;return function(_0x5e75f7){if(_0x5e75f7){return _0x469adf['sendStatus'](_0x1cf93e);}return _0x469adf[_0xf4f2('0x1b')](_0x1cf93e)[_0xf4f2('0x1c')]();};}function respondWithResult(_0x172cae,_0x389693){_0x389693=_0x389693||0xc8;return function(_0x53804b){if(_0x53804b){return _0x172cae['status'](_0x389693)[_0xf4f2('0x1d')](_0x53804b);}};}function respondWithFilteredResult(_0x287ab1,_0x71fc3a){return function(_0xc4f266){if(_0xc4f266){var _0x2cb4d9=typeof _0x71fc3a[_0xf4f2('0x1e')]===_0xf4f2('0x1f')&&typeof _0x71fc3a[_0xf4f2('0x20')]===_0xf4f2('0x1f');var _0xe3cbc7=_0xc4f266[_0xf4f2('0x21')];var _0x1e8eb3=_0x2cb4d9?0x0:_0x71fc3a[_0xf4f2('0x1e')];var _0x4ba893=_0x2cb4d9?_0xc4f266[_0xf4f2('0x21')]:_0x71fc3a['offset']+_0x71fc3a[_0xf4f2('0x20')];var _0x3ec89a;if(_0x4ba893>=_0xe3cbc7){_0x4ba893=_0xe3cbc7;_0x3ec89a=0xc8;}else{_0x3ec89a=0xce;}_0x287ab1[_0xf4f2('0x1b')](_0x3ec89a);return _0x287ab1[_0xf4f2('0x22')](_0xf4f2('0x23'),_0x1e8eb3+'-'+_0x4ba893+'/'+_0xe3cbc7)[_0xf4f2('0x1d')](_0xc4f266);}return null;};}function patchUpdates(_0x8da0f7){return function(_0x358d37){try{jsonpatch[_0xf4f2('0x24')](_0x358d37,_0x8da0f7,!![]);}catch(_0x3ed090){return BPromise[_0xf4f2('0x25')](_0x3ed090);}return _0x358d37[_0xf4f2('0x26')]();};}function saveUpdates(_0x75dfee,_0x3abfe4){return function(_0x4b0eab){if(_0x4b0eab){return _0x4b0eab[_0xf4f2('0x27')](_0x75dfee)[_0xf4f2('0x28')](function(_0xe31fca){return _0xe31fca;});}return null;};}function removeEntity(_0x53d089,_0x3df1df){return function(_0x243217){if(_0x243217){return _0x243217['destroy']()[_0xf4f2('0x28')](function(){_0x53d089[_0xf4f2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x572ce6,_0x4c21cc){return function(_0x140f88){if(!_0x140f88){_0x572ce6['sendStatus'](0x194);}return _0x140f88;};}function handleError(_0x2257a4,_0x1d44d9){_0x1d44d9=_0x1d44d9||0x1f4;return function(_0xdb126){logger['error'](_0xdb126[_0xf4f2('0x29')]);if(_0xdb126[_0xf4f2('0x2a')]){delete _0xdb126[_0xf4f2('0x2a')];}_0x2257a4[_0xf4f2('0x1b')](_0x1d44d9)[_0xf4f2('0x2b')](_0xdb126);};}exports[_0xf4f2('0x2c')]=function(_0x5ce479,_0x2ff6bc){var _0x54c030={},_0x53515e={},_0x2cdf60={'count':0x0,'rows':[]};var _0x373ca8=_[_0xf4f2('0x2d')](db[_0xf4f2('0x2e')][_0xf4f2('0x2f')],function(_0x295ec5){return{'name':_0x295ec5[_0xf4f2('0x30')],'type':_0x295ec5[_0xf4f2('0x31')]['key']};});_0x53515e['model']=_[_0xf4f2('0x2d')](_0x373ca8,_0xf4f2('0x2a'));_0x53515e[_0xf4f2('0x32')]=_[_0xf4f2('0x33')](_0x5ce479[_0xf4f2('0x32')]);_0x53515e[_0xf4f2('0x34')]=_[_0xf4f2('0x35')](_0x53515e[_0xf4f2('0x36')],_0x53515e[_0xf4f2('0x32')]);_0x54c030['attributes']=_['intersection'](_0x53515e[_0xf4f2('0x36')],qs[_0xf4f2('0x37')](_0x5ce479[_0xf4f2('0x32')]['fields']));_0x54c030[_0xf4f2('0x38')]=_0x54c030[_0xf4f2('0x38')][_0xf4f2('0x39')]?_0x54c030[_0xf4f2('0x38')]:_0x53515e[_0xf4f2('0x36')];if(!_0x5ce479[_0xf4f2('0x32')][_0xf4f2('0x3a')](_0xf4f2('0x3b'))){_0x54c030[_0xf4f2('0x20')]=qs[_0xf4f2('0x20')](_0x5ce479[_0xf4f2('0x32')][_0xf4f2('0x20')]);_0x54c030[_0xf4f2('0x1e')]=qs[_0xf4f2('0x1e')](_0x5ce479[_0xf4f2('0x32')][_0xf4f2('0x1e')]);}_0x54c030[_0xf4f2('0x3c')]=qs[_0xf4f2('0x3d')](_0x5ce479[_0xf4f2('0x32')][_0xf4f2('0x3d')]);_0x54c030[_0xf4f2('0x3e')]=qs[_0xf4f2('0x34')](_[_0xf4f2('0x3f')](_0x5ce479['query'],_0x53515e[_0xf4f2('0x34')]),_0x373ca8);if(_0x5ce479[_0xf4f2('0x32')][_0xf4f2('0x40')]){_0x54c030[_0xf4f2('0x3e')]=_['merge'](_0x54c030[_0xf4f2('0x3e')],{'$or':_[_0xf4f2('0x2d')](_0x373ca8,function(_0x3de3a2){if(_0x3de3a2[_0xf4f2('0x31')]!=='VIRTUAL'){var _0x2f4fbb={};_0x2f4fbb[_0x3de3a2[_0xf4f2('0x2a')]]={'$like':'%'+_0x5ce479[_0xf4f2('0x32')][_0xf4f2('0x40')]+'%'};return _0x2f4fbb;}})});}_0x54c030=_[_0xf4f2('0x41')]({},_0x54c030,_0x5ce479[_0xf4f2('0x42')]);var _0x427770={'where':_0x54c030[_0xf4f2('0x3e')]};return db[_0xf4f2('0x2e')][_0xf4f2('0x21')](_0x427770)[_0xf4f2('0x28')](function(_0xfb42e8){_0x2cdf60[_0xf4f2('0x21')]=_0xfb42e8;if(_0x5ce479['query'][_0xf4f2('0x43')]){_0x54c030['include']=[{'all':!![]}];}return db[_0xf4f2('0x2e')]['findAll'](_0x54c030);})[_0xf4f2('0x28')](function(_0x45ed5f){_0x2cdf60['rows']=_0x45ed5f;return _0x2cdf60;})[_0xf4f2('0x28')](respondWithFilteredResult(_0x2ff6bc,_0x54c030))[_0xf4f2('0x44')](handleError(_0x2ff6bc,null));};exports[_0xf4f2('0x45')]=function(_0x5a4cf2,_0x14d80c){var _0x3b1501={'raw':![],'where':{'id':_0x5a4cf2[_0xf4f2('0x46')]['id']}},_0x2e3efe={};_0x2e3efe[_0xf4f2('0x36')]=_['keys'](db[_0xf4f2('0x2e')][_0xf4f2('0x2f')]);_0x2e3efe[_0xf4f2('0x32')]=_[_0xf4f2('0x33')](_0x5a4cf2['query']);_0x2e3efe[_0xf4f2('0x34')]=_[_0xf4f2('0x35')](_0x2e3efe['model'],_0x2e3efe['query']);_0x3b1501[_0xf4f2('0x38')]=_[_0xf4f2('0x35')](_0x2e3efe[_0xf4f2('0x36')],qs[_0xf4f2('0x37')](_0x5a4cf2[_0xf4f2('0x32')][_0xf4f2('0x37')]));_0x3b1501['attributes']=_0x3b1501['attributes'][_0xf4f2('0x39')]?_0x3b1501[_0xf4f2('0x38')]:_0x2e3efe['model'];if(_0x5a4cf2[_0xf4f2('0x32')][_0xf4f2('0x43')]){_0x3b1501['include']=[{'all':!![]}];}_0x3b1501=_['merge']({},_0x3b1501,_0x5a4cf2[_0xf4f2('0x42')]);return db[_0xf4f2('0x2e')][_0xf4f2('0x47')](_0x3b1501)[_0xf4f2('0x28')](handleEntityNotFound(_0x14d80c,null))['then'](respondWithResult(_0x14d80c,null))[_0xf4f2('0x44')](handleError(_0x14d80c,null));};exports[_0xf4f2('0x48')]=function(_0x63a67,_0x319ad0){return db[_0xf4f2('0x2e')][_0xf4f2('0x48')](_0x63a67[_0xf4f2('0x49')],{})[_0xf4f2('0x28')](respondWithResult(_0x319ad0,0xc9))[_0xf4f2('0x44')](handleError(_0x319ad0,null));};exports[_0xf4f2('0x4a')]=function(_0x1fd15a,_0x306ee4){var _0x4c7024={'where':{'id':_0x1fd15a[_0xf4f2('0x46')]['id']}},_0x4305fa={};_0x4305fa['model']=_['keys'](db['UserProfile'][_0xf4f2('0x2f')]);_0x4c7024['attributes']=_[_0xf4f2('0x35')](_0x4305fa[_0xf4f2('0x36')],qs['fields'](_0x1fd15a[_0xf4f2('0x32')][_0xf4f2('0x37')]));_0x4c7024['attributes']=_0x4c7024[_0xf4f2('0x38')]['length']?_0x4c7024[_0xf4f2('0x38')]:_0x4305fa[_0xf4f2('0x36')];if(_0x1fd15a['query'][_0xf4f2('0x43')]){_0x4c7024['include']=[{'all':!![]}];}_0x4c7024=_[_0xf4f2('0x41')]({},_0x4c7024,_0x1fd15a[_0xf4f2('0x42')]);return db[_0xf4f2('0x2e')][_0xf4f2('0x47')](_0x4c7024)[_0xf4f2('0x28')](handleEntityNotFound(_0x306ee4,null))[_0xf4f2('0x28')](function(_0x3283d){if(_0x3283d){var _0x303595=_0x3283d[_0xf4f2('0x4b')]({'plain':!![]});_0x303595=qs[_0xf4f2('0x4c')](_0x303595,['id',_0xf4f2('0x4d'),_0xf4f2('0x4e'),_0xf4f2('0x4f')]);_0x1fd15a[_0xf4f2('0x49')]=_['omit'](_0x1fd15a[_0xf4f2('0x49')],['id',_0xf4f2('0x4d'),_0xf4f2('0x4e')]);return db[_0xf4f2('0x50')][_0xf4f2('0x51')](function(_0x3a5ab2){return db['UserProfile'][_0xf4f2('0x48')](_[_0xf4f2('0x41')](_0x303595,_0x1fd15a[_0xf4f2('0x49')]),{'include':_0x1fd15a[_0xf4f2('0x32')][_0xf4f2('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x3a5ab2})[_0xf4f2('0x28')](function(_0x259ddb){var _0x3423b4=_0x259ddb[_0xf4f2('0x4b')]({'plain':!![]});return db[_0xf4f2('0x52')]['findAll']({'where':{'userProfileId':_0x1fd15a['params']['id']},'raw':!![]})[_0xf4f2('0x28')](function(_0x2171cd){if(_0x2171cd){return BPromise[_0xf4f2('0x53')](_0x2171cd,function(_0x47d0ad){return new BPromise(function(_0xfd7a44,_0x1887b1){if(_0x47d0ad[_0xf4f2('0x54')]===null||_0x47d0ad[_0xf4f2('0x54')]===0x1)_0xfd7a44(null);return db[_0xf4f2('0x55')][_0xf4f2('0x56')]({'where':{'sectionId':_0x47d0ad['id']},'raw':!![]})[_0xf4f2('0x28')](function(_0x16b41a){var _0x52674c=_['map'](_0x16b41a,function(_0x492dc5){return qs[_0xf4f2('0x4c')](_0x492dc5,['id','createdAt',_0xf4f2('0x4e'),'sectionId']);});_0xfd7a44(_0x52674c);})[_0xf4f2('0x44')](function(_0x872042){_0x1887b1(_0x872042);});})[_0xf4f2('0x28')](function(_0x3fe75a){var _0x17248a=qs[_0xf4f2('0x4c')](_0x47d0ad,['id',_0xf4f2('0x4d'),_0xf4f2('0x4e')]);_0x17248a[_0xf4f2('0x57')]=_0x3423b4['id'];if(_0x3fe75a)_0x17248a[_0xf4f2('0x58')]=_0x3fe75a;return _0x17248a;})[_0xf4f2('0x28')](function(_0x5a3f0c){return db[_0xf4f2('0x52')][_0xf4f2('0x48')](_0x5a3f0c,{'include':[{'model':db[_0xf4f2('0x55')],'as':_0xf4f2('0x58')}],'raw':!![],'transaction':_0x3a5ab2});});})[_0xf4f2('0x28')](function(){return _0x3423b4;});}});});});}})[_0xf4f2('0x28')](respondWithResult(_0x306ee4,0xc9))[_0xf4f2('0x44')](handleError(_0x306ee4,null));};exports[_0xf4f2('0x27')]=function(_0x2e5051,_0x22d90f){if(_0x2e5051[_0xf4f2('0x49')]['id']){delete _0x2e5051['body']['id'];}return db[_0xf4f2('0x2e')][_0xf4f2('0x47')]({'where':{'id':_0x2e5051[_0xf4f2('0x46')]['id']}})['then'](handleEntityNotFound(_0x22d90f,null))[_0xf4f2('0x28')](saveUpdates(_0x2e5051[_0xf4f2('0x49')],null))['then'](respondWithResult(_0x22d90f,null))[_0xf4f2('0x44')](handleError(_0x22d90f,null));};exports[_0xf4f2('0x59')]=function(_0x2697f9,_0x52d8c3){return db[_0xf4f2('0x2e')][_0xf4f2('0x47')]({'where':{'id':_0x2697f9['params']['id']}})[_0xf4f2('0x28')](handleEntityNotFound(_0x52d8c3,null))[_0xf4f2('0x28')](removeEntity(_0x52d8c3,null))['catch'](handleError(_0x52d8c3,null));};exports['describe']=function(_0x2e4feb,_0x29ad5a){return db[_0xf4f2('0x2e')]['describe']()[_0xf4f2('0x28')](respondWithResult(_0x29ad5a,null))['catch'](handleError(_0x29ad5a,null));};exports[_0xf4f2('0x5a')]=function(_0x304b4a,_0x1c733c){var _0x2386d0=_0x304b4a[_0xf4f2('0x49')];return db[_0xf4f2('0x2e')]['find']({'where':{'id':_0x304b4a[_0xf4f2('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c733c,null))[_0xf4f2('0x28')](function(_0xbe3d47){if(_0xbe3d47){return db[_0xf4f2('0x50')]['transaction'](function(_0x35654a){return db[_0xf4f2('0x52')][_0xf4f2('0x59')]({'where':{'userProfileId':_0x304b4a[_0xf4f2('0x46')]['id'],'sectionId':_[_0xf4f2('0x2d')](_0x2386d0,function(_0x1ca6f1){return _0x1ca6f1[_0xf4f2('0x5b')];})},'transaction':_0x35654a})[_0xf4f2('0x28')](function(){var _0x23d76e=_[_0xf4f2('0x2d')](_0x2386d0,function(_0x13a7a1){_0x13a7a1[_0xf4f2('0x57')]=_0x304b4a[_0xf4f2('0x46')]['id'];return _0x13a7a1;});var _0x45f57f=[];return BPromise['each'](_0x23d76e,function(_0x34e8e6){return db['UserProfileSection'][_0xf4f2('0x48')](_0x34e8e6,{'include':[{'model':db[_0xf4f2('0x55')],'as':_0xf4f2('0x58')}],'raw':!![],'transaction':_0x35654a})[_0xf4f2('0x28')](function(_0x56b680){_0x45f57f[_0xf4f2('0x5c')](_0x56b680[_0xf4f2('0x4b')]({'plain':!![]}));});})[_0xf4f2('0x28')](function(){return _0x45f57f;});});});}})[_0xf4f2('0x28')](function(_0x5421b3){return _0x5421b3;})[_0xf4f2('0x28')](respondWithResult(_0x1c733c,null))['catch'](handleError(_0x1c733c,null));};exports['removeSections']=function(_0x1986ae,_0x4b3add){var _0x9c575d;return db[_0xf4f2('0x2e')][_0xf4f2('0x47')]({'where':{'id':_0x1986ae[_0xf4f2('0x46')]['id']},'attributes':['id',_0xf4f2('0x2a')]})[_0xf4f2('0x28')](handleEntityNotFound(_0x4b3add,null))[_0xf4f2('0x28')](function(_0x2b08e9){if(_0x2b08e9){_0x9c575d=_0x2b08e9;return db[_0xf4f2('0x52')]['destroy']({'where':{'userProfileId':_0x1986ae[_0xf4f2('0x46')]['id'],'sectionId':_0x1986ae[_0xf4f2('0x32')]['ids']}});}})[_0xf4f2('0x28')](function(){return _0x9c575d;})[_0xf4f2('0x28')](respondWithStatusCode(_0x4b3add,null))['catch'](handleError(_0x4b3add,null));};exports[_0xf4f2('0x5d')]=function(_0x4af69a,_0x44dcfe){var _0x217a89=[];var _0x31c7ea=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4af69a[_0xf4f2('0x46')]['id']},'raw':!![]})[_0xf4f2('0x28')](function(_0x298f3f){_0x217a89=_[_0xf4f2('0x40')](_0x298f3f,function(_0x5e30b5){return _0x5e30b5[_0xf4f2('0x5e')]===0x1||_[_0xf4f2('0x5f')]([0x3eb,0x709],_0x5e30b5[_0xf4f2('0x5b')]);});if(!_[_0xf4f2('0x60')](_0x217a89)){return _[_0xf4f2('0x2d')](_0x217a89,function(_0x5468f0){return _0x5468f0[_0xf4f2('0x5b')];});}else{return;}})[_0xf4f2('0x28')](function(_0x39e413){if(_0x39e413)_0x31c7ea=_0x39e413;if(_[_0xf4f2('0x5f')](_0x31c7ea,0x64)){var _0x2d21eb=_[_0xf4f2('0x47')](_0x217a89,{'sectionId':0x64});return hasDefaultDashboard(_0x2d21eb)[_0xf4f2('0x28')](function(_0x581247){return _['map'](_0x217a89,function(_0x2db482){if(_0x2db482[_0xf4f2('0x5b')]===0x64){_0x2db482[_0xf4f2('0x61')]=_0x581247;}return _0x2db482;});});}else{return;}})[_0xf4f2('0x28')](function(_0x9580b0){if(_0x9580b0)_0x217a89=_0x9580b0;if(_[_0xf4f2('0x5f')](_0x31c7ea,0x3eb)){var _0x210396=_[_0xf4f2('0x47')](_0x217a89,{'sectionId':0x3eb});return getCustomDashboards(_0x210396)[_0xf4f2('0x28')](function(_0x14173f){return _[_0xf4f2('0x2d')](_0x217a89,function(_0x2462c3){if(_0x210396[_0xf4f2('0x5e')]){if(_0x2462c3['sectionId']===0x3eb){_0x2462c3[_0xf4f2('0x61')]=_0x14173f;}}else{if(_0x2462c3[_0xf4f2('0x5b')]===0x64){if(!_0x2462c3[_0xf4f2('0x61')]){_0x2462c3[_0xf4f2('0x61')]=[];}_0x2462c3[_0xf4f2('0x61')]=_0x2462c3[_0xf4f2('0x61')][_0xf4f2('0x62')](_0x14173f);}}return _0x2462c3;});});}else{return;}})[_0xf4f2('0x28')](function(_0x19e667){if(_0x19e667)_0x217a89=_0x19e667;if(_[_0xf4f2('0x5f')](_0x31c7ea,0x709)){var _0x375945=_[_0xf4f2('0x47')](_0x217a89,{'sectionId':0x709});return getPlugins(_0x375945)[_0xf4f2('0x28')](function(_0x238306){if(_0x375945[_0xf4f2('0x5e')]){return _[_0xf4f2('0x2d')](_0x217a89,function(_0x4ee11e){if(_0x4ee11e[_0xf4f2('0x5b')]===0x709){_0x4ee11e[_0xf4f2('0x61')]=_0x238306;}return _0x4ee11e;});}else{var _0x391a60={'sectionId':0x76c,'enabled':0x1,'subsections':_0x238306};var _0x161c40=_['map'](_0x217a89);_0x161c40[_0xf4f2('0x5c')](_0x391a60);return _0x161c40;}});}else{return;}})['then'](function(_0x3b1922){if(_0x3b1922)_0x217a89=_0x3b1922;return _[_0xf4f2('0x40')](_0x217a89,[_0xf4f2('0x5e'),0x1]);})[_0xf4f2('0x28')](respondWithResult(_0x44dcfe,null))[_0xf4f2('0x44')](handleError(_0x44dcfe,null));};function hasDefaultDashboard(_0x5d2d8f){var _0x1ec530=[0x65];return new BPromise(function(_0x42caff,_0x44c599){try{if(_0x5d2d8f[_0xf4f2('0x54')]){_0x42caff(_0x1ec530);}else{return db[_0xf4f2('0x55')][_0xf4f2('0x63')]({'where':{'sectionId':_0x5d2d8f['id']},'raw':!![]})['then'](function(_0x491eb0){_0x491eb0?_0x42caff(_0x1ec530):_0x42caff();});}}catch(_0x302282){_0x44c599(_0x302282);}});}function getCustomDashboards(_0x4ffc5b){var _0x5998d7=[];return new BPromise(function(_0x36ed47,_0x4655d6){try{if(_0x4ffc5b[_0xf4f2('0x54')]){return db['Dashboard'][_0xf4f2('0x56')]({'raw':!![]})['then'](function(_0x15458f){_0x15458f[_0xf4f2('0x64')](function(_0x5a0a52){_0x5998d7['push'](_0x5a0a52['id']+0x1869f);});_0x36ed47(_0x5998d7);});}else{return db[_0xf4f2('0x55')][_0xf4f2('0x56')]({'where':{'sectionId':_0x4ffc5b['id']},'raw':!![]})[_0xf4f2('0x28')](function(_0x504795){_0x504795[_0xf4f2('0x64')](function(_0x3f6db7){_0x5998d7[_0xf4f2('0x5c')](_0x3f6db7[_0xf4f2('0x65')]+0x1869f);});_0x36ed47(_0x5998d7);});}}catch(_0x3d2594){_0x4655d6(_0x3d2594);}});}function getPlugins(_0x4cc675){var _0x5512af=[];return new BPromise(function(_0x13201b,_0x23c7f4){try{if(_0x4cc675['autoAssociation']){return db[_0xf4f2('0x66')][_0xf4f2('0x56')]({'raw':!![]})['then'](function(_0x20a2b7){_0x20a2b7[_0xf4f2('0x64')](function(_0x27a28f){_0x5512af[_0xf4f2('0x5c')](_0x27a28f['id']+0x15b38);});_0x13201b(_0x5512af);});}else{return db[_0xf4f2('0x55')][_0xf4f2('0x56')]({'where':{'sectionId':_0x4cc675['id']},'raw':!![]})['then'](function(_0x530b22){_0x530b22[_0xf4f2('0x64')](function(_0x3cefc9){_0x5512af[_0xf4f2('0x5c')](_0x3cefc9[_0xf4f2('0x65')]+0x15b38);});_0x13201b(_0x5512af);});}}catch(_0x2aa502){_0x23c7f4(_0x2aa502);}});}exports[_0xf4f2('0x67')]=function(_0x3b97d8,_0x2e6d0b){return db[_0xf4f2('0x2e')][_0xf4f2('0x47')]({'where':{'id':_0x3b97d8[_0xf4f2('0x46')]['id']}})[_0xf4f2('0x28')](handleEntityNotFound(_0x2e6d0b,null))['then'](function(_0xa1f7b6){if(_0xa1f7b6){return db[_0xf4f2('0x50')][_0xf4f2('0x51')](function(_0x10d4d7){return db[_0xf4f2('0x52')]['findAll']({'where':{'userProfileId':_0x3b97d8[_0xf4f2('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xf4f2('0x28')](function(_0x512868){if(_0x512868){return db[_0xf4f2('0x52')][_0xf4f2('0x59')]({'where':{'userProfileId':_0x3b97d8[_0xf4f2('0x46')]['id'],'id':_[_0xf4f2('0x2d')](_0x512868,function(_0x41a9d2){return _0x41a9d2['id'];})},'transaction':_0x10d4d7});}})[_0xf4f2('0x28')](function(_0x48e114){var _0x356aa5=_[_0xf4f2('0x2d')](_0x3b97d8[_0xf4f2('0x49')],function(_0x38cbff){_0x38cbff[_0xf4f2('0x57')]=_0x3b97d8[_0xf4f2('0x46')]['id'];return _0x38cbff;});return db[_0xf4f2('0x52')][_0xf4f2('0x68')](_0x356aa5,{'raw':!![],'transaction':_0x10d4d7});})['then'](function(_0xfe67d4){var _0xad8bd6=_['filter'](_[_0xf4f2('0x2d')](_0xfe67d4,function(_0x3d3cfc){return _0x3d3cfc[_0xf4f2('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0xad8bd6){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3b97d8[_0xf4f2('0x46')]['id'],'sectionId':_[_0xf4f2('0x2d')](_0xad8bd6,function(_0xff1a56){return _0xff1a56[_0xf4f2('0x5b')];})},'attributes':['id',_0xf4f2('0x5b')],'raw':!![]})[_0xf4f2('0x28')](function(_0x20765f){var _0x762c9a=_[_0xf4f2('0x2d')](_0x3b97d8[_0xf4f2('0x49')],function(_0x4e4dd6){_0x4e4dd6['userProfileId']=_0x3b97d8[_0xf4f2('0x46')]['id'];return _0x4e4dd6;});return db[_0xf4f2('0x55')][_0xf4f2('0x68')](_0x762c9a,{'raw':!![],'transaction':_0x10d4d7});});}})[_0xf4f2('0x44')](handleError(_0x2e6d0b,null));});}})[_0xf4f2('0x28')](function(_0x4d40ec){var _0x31cdec=_[_0xf4f2('0x2d')](_0x4d40ec,function(_0x50f133){return _0x50f133[_0xf4f2('0x4b')]({'plain':!![]});});})[_0xf4f2('0x28')](respondWithResult(_0x2e6d0b,null))[_0xf4f2('0x44')](handleError(_0x2e6d0b,null));};exports['removeResources']=function(_0x358bea,_0x219999,_0x5d0b0c){return db[_0xf4f2('0x2e')][_0xf4f2('0x47')]({'where':{'id':_0x358bea[_0xf4f2('0x46')]['id']}})['then'](handleEntityNotFound(_0x219999,null))[_0xf4f2('0x28')](function(_0x140736){if(_0x140736){return _0x140736[_0xf4f2('0x69')](_0x358bea[_0xf4f2('0x32')][_0xf4f2('0x6a')]);}})[_0xf4f2('0x28')](respondWithStatusCode(_0x219999,null))[_0xf4f2('0x44')](handleError(_0x219999,null));};exports['getResources']=function(_0x4596c1,_0x248938){var _0x3abaec={};if(!_0x4596c1['query'][_0xf4f2('0x6b')])throw new Error(_0xf4f2('0x6c'));if(!_0x4596c1[_0xf4f2('0x32')][_0xf4f2('0x3a')]('nolimit')){_0x3abaec['limit']=qs[_0xf4f2('0x20')](_0x4596c1[_0xf4f2('0x32')][_0xf4f2('0x20')]);_0x3abaec[_0xf4f2('0x1e')]=qs['offset'](_0x4596c1['query']['offset']);}return db['UserProfile'][_0xf4f2('0x47')]({'where':{'id':_0x4596c1[_0xf4f2('0x46')]['id']}})['then'](function(_0x15f014){if(!_0x15f014)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x4596c1[_0xf4f2('0x46')]['id']);return db['UserProfile'][_0xf4f2('0x6d')](_0x4596c1);})['then'](respondWithFilteredResult(_0x248938,_0x3abaec))['catch'](handleError(_0x248938,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 908322e..80cf4fa 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 _0x66c7=['UserProfile','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1c324d,_0x2daa7c){var _0x33347f=function(_0x438dc6){while(--_0x438dc6){_0x1c324d['push'](_0x1c324d['shift']());}};_0x33347f(++_0x2daa7c);}(_0x66c7,0x15c));var _0x766c=function(_0x38e59a,_0x59f346){_0x38e59a=_0x38e59a-0x0;var _0x4410eb=_0x66c7[_0x38e59a];return _0x4410eb;};'use strict';var EventEmitter=require(_0x766c('0x0'));var UserProfile=require(_0x766c('0x1'))['db'][_0x766c('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x766c('0x3'),'afterUpdate':_0x766c('0x4'),'afterDestroy':_0x766c('0x5')};function emitEvent(_0x1cf5c1){return function(_0x1b2a8e,_0x2b4c75,_0x4fa5e4){UserProfileEvents[_0x766c('0x6')](_0x1cf5c1+':'+_0x1b2a8e['id'],_0x1b2a8e);UserProfileEvents[_0x766c('0x6')](_0x1cf5c1,_0x1b2a8e);_0x4fa5e4(null);};}for(var e in events){if(events[_0x766c('0x7')](e)){var event=events[e];UserProfile[_0x766c('0x8')](e,emitEvent(event));}}module[_0x766c('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x4910=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserProfile','save'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x4910,0x1d9));var _0x0491=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4910[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x0491('0x0'));var UserProfile=require(_0x0491('0x1'))['db'][_0x0491('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0491('0x3'),'afterUpdate':_0x0491('0x4'),'afterDestroy':_0x0491('0x5')};function emitEvent(_0x2fc9e8){return function(_0x408677,_0x51f40d,_0x1ecb19){UserProfileEvents[_0x0491('0x6')](_0x2fc9e8+':'+_0x408677['id'],_0x408677);UserProfileEvents[_0x0491('0x6')](_0x2fc9e8,_0x408677);_0x1ecb19(null);};}for(var e in events){if(events[_0x0491('0x7')](e)){var event=events[e];UserProfile[_0x0491('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index cd93d5e..04e4e26 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 _0x6adb=['map','catch','model','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','Lists','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','voicemails','Agents','membername','role','agent','Telephones','telephone','VoiceQueues','queue','QueueCampaigns','VoiceQueue','type','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','users','User','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','pauses','Pause','scheduler','Schedule','sounds','Sound','templates','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','AnalyticMetric','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filters','merge','key','foreignKey','forEach','options','includeAll','include','default','reportId','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','Tag','Tags','tag','ThroughTags','true','chat','dataValues','sms','fax','openchannel','whatsapp','all','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','field','value','findAll','then','associatedResources'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6adb,0x16b));var _0xb6ad=function(_0x507453,_0x7949e9){_0x507453=_0x507453-0x0;var _0x5ea69f=_0x6adb[_0x507453];return _0x5ea69f;};'use strict';var _=require(_0xb6ad('0x0'));var attributes=require(_0xb6ad('0x1'));var qs=require(_0xb6ad('0x2'));var squel=require(_0xb6ad('0x3'));module['exports']=function(_0x4bd511){var _0x3762d0=_0x4bd511[_0xb6ad('0x4')];function _0x4d40b8(_0x400dd9,_0x59d89d){return new Promise(function(_0x3ca29d,_0xe32ee){if(!_0x59d89d)return _0x3ca29d(null);var _0x33e38b=_0x59d89d[_0xb6ad('0x5')]?{[_0x59d89d[_0xb6ad('0x5')][_0xb6ad('0x6')]]:_0x59d89d[_0xb6ad('0x5')][_0xb6ad('0x7')]}:undefined;return _0x3762d0[_0x400dd9][_0xb6ad('0x8')]({'where':_0x33e38b,'raw':!![]})[_0xb6ad('0x9')](function(_0x4f6657){_0x59d89d[_0xb6ad('0xa')]=_[_0xb6ad('0xb')](_0x4f6657,'id');_0x3ca29d(_0x59d89d);})[_0xb6ad('0xc')](function(_0x38cc24){_0xe32ee(_0x38cc24);});});}function _0x531ad5(_0x2049ff,_0x230448){return new Promise(function(_0x4b8b5f,_0x314b7f){var _0xfc31df=_0x2049ff[_0xb6ad('0x5')]?{[_0x2049ff[_0xb6ad('0x5')][_0xb6ad('0x6')]]:_0x2049ff[_0xb6ad('0x5')][_0xb6ad('0x7')]}:undefined;return _0x3762d0[_0x2049ff[_0xb6ad('0xd')]][_0xb6ad('0x8')]({'where':_0xfc31df,'raw':!![]})['then'](function(_0x2549ec){_0x230448[_0xb6ad('0xa')]=_[_0xb6ad('0xb')](_0x2549ec,function(_0x4c5a49){return _0x4c5a49['name'];});_0x4b8b5f(_0x230448);})[_0xb6ad('0xc')](function(_0x32f97e){_0x314b7f(_0x32f97e);});});}function _0x4b650b(_0x49d85f,_0x5b9d99,_0x916201){if(!_0x5b9d99)return Promise['resolve'](null);return new Promise(function(_0x1c22e2,_0x29d87f){return _0x3762d0[_0xb6ad('0xe')]['findAll']({'where':{'sectionId':_0x5b9d99['id']},'raw':!![]})[_0xb6ad('0x9')](function(_0x3542c0){if(_0x49d85f[_0xb6ad('0x6')]&&_0x49d85f[_0xb6ad('0x6')]!=='id'){_0x5b9d99[_0xb6ad('0xa')]=_['map'](_0x3542c0,function(_0x2ab634){return _0x2ab634[_0x49d85f['field']];});}else{if(_0x916201===_0xb6ad('0xf')){_0x5b9d99[_0xb6ad('0xa')]=_[_0xb6ad('0xb')](_0x3542c0,function(_0x2c88ed){return{'id':_0x2c88ed[_0xb6ad('0x10')],'type':_0x2c88ed['type']};});}else{_0x5b9d99[_0xb6ad('0xa')]=_[_0xb6ad('0xb')](_0x3542c0,function(_0x3b1b94){return _0x3b1b94[_0xb6ad('0x10')];});}}_0x1c22e2(_0x5b9d99);})['catch'](function(_0x211d4f){_0x29d87f(_0x211d4f);});});}function _0x1ca3be(_0x211bfa,_0x270292){var _0x4357ae={'parentSections':[]};switch(_0x211bfa[_0xb6ad('0x11')]()){case _0xb6ad('0x12'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x14');break;case _0xb6ad('0x15'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x16');break;case _0xb6ad('0x17'):_0x4357ae['childModel']=_0xb6ad('0x18');_0x4357ae[_0xb6ad('0x19')]=[{'name':_0xb6ad('0x1a'),'field':_0xb6ad('0x1b'),'foreignKey':_0xb6ad('0x1c')}];break;case _0xb6ad('0x1d'):_0x4357ae['childModel']=_0xb6ad('0x1e');break;case _0xb6ad('0x1f'):_0x4357ae['childModel']='CmContact';_0x4357ae[_0xb6ad('0x19')]=[{'name':_0xb6ad('0x20'),'field':'id','foreignKey':'ListId'}];break;case _0xb6ad('0x21'):_0x4357ae[_0xb6ad('0x13')]='CmList';break;case _0xb6ad('0x22'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x23');break;case _0xb6ad('0x24'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x25');break;case _0xb6ad('0x26'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x27');break;case _0xb6ad('0x28'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x29');break;case _0xb6ad('0x2a'):_0x4357ae[_0xb6ad('0x13')]='FaxQueue';break;case'faxaccounts':_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x2b');break;case _0xb6ad('0x2c'):case _0xb6ad('0x2d'):case _0xb6ad('0x2e'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x2f');break;case'contexts':_0x4357ae[_0xb6ad('0x13')]='VoiceContext';break;case _0xb6ad('0x30'):_0x4357ae[_0xb6ad('0x13')]='VoiceMail';break;case'voicerecordings':_0x4357ae[_0xb6ad('0x13')]='VoiceRecording';_0x4357ae[_0xb6ad('0x19')]=[{'name':_0xb6ad('0x31'),'field':_0xb6ad('0x1b'),'foreignKey':_0xb6ad('0x32'),'model':'User','filter':{'field':_0xb6ad('0x33'),'value':[_0xb6ad('0x34')]}},{'name':_0xb6ad('0x35'),'field':_0xb6ad('0x1b'),'foreignKey':'membername','model':'User','filter':{'field':_0xb6ad('0x33'),'value':[_0xb6ad('0x36')]}},{'name':_0xb6ad('0x37'),'field':'name','foreignKey':_0xb6ad('0x38'),'model':'VoiceQueue','filter':{'field':'type','value':['inbound']}},{'name':_0xb6ad('0x39'),'field':_0xb6ad('0x1b'),'foreignKey':_0xb6ad('0x38'),'model':_0xb6ad('0x3a'),'filter':{'field':_0xb6ad('0x3b'),'value':['outbound']}}];break;case'musiconholds':_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x3c');break;case _0xb6ad('0x3d'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x3e');break;case _0xb6ad('0x3f'):_0x4357ae[_0xb6ad('0x13')]='VoicePrefix';break;case _0xb6ad('0x40'):_0x4357ae[_0xb6ad('0x13')]='Campaign';break;case _0xb6ad('0x41'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x42');break;case _0xb6ad('0x43'):_0x4357ae['childModel']=_0xb6ad('0x44');break;case'mailsubstatuses':_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x45');break;case _0xb6ad('0x46'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x47');break;case'openchannelaccounts':_0x4357ae[_0xb6ad('0x13')]='OpenchannelAccount';break;case _0xb6ad('0x48'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x49');break;case _0xb6ad('0x4a'):_0x4357ae[_0xb6ad('0x13')]='SmsAccount';break;case _0xb6ad('0x4b'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x4c');break;case _0xb6ad('0x4d'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x4e');break;case'teams':_0x4357ae['childModel']='Team';break;case _0xb6ad('0x4f'):case _0xb6ad('0x50'):_0x4357ae['childModel']=_0xb6ad('0x3a');if(_0x270292){_0x4357ae[_0xb6ad('0x19')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0xb6ad('0x51'):case'agents':case'telephones':_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x52');if(_0x270292){_0x4357ae['parentSections']=[{'name':'Users','filter':{'field':'role','value':[_0xb6ad('0x53'),_0xb6ad('0x54')]},'ignore':!![]},{'name':'Agents'},{'name':_0xb6ad('0x35')}];}break;case _0xb6ad('0x55'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x56');break;case _0xb6ad('0x57'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x58');break;case'freshdeskaccounts':_0x4357ae['childModel']=_0xb6ad('0x59');break;case'sugarcrmaccounts':_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x5a');break;case _0xb6ad('0x5b'):_0x4357ae['childModel']=_0xb6ad('0x5c');break;case'zohoaccounts':_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x5d');break;case'vtigeraccounts':_0x4357ae['childModel']=_0xb6ad('0x52');break;case'cannedanswers':_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x5e');break;case _0xb6ad('0x5f'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x60');break;case _0xb6ad('0x61'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x62');break;case'intervals':_0x4357ae[_0xb6ad('0x13')]='Interval';break;case _0xb6ad('0x63'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x64');break;case _0xb6ad('0x65'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x66');break;case _0xb6ad('0x67'):_0x4357ae['childModel']=_0xb6ad('0x68');break;case'tags':_0x4357ae['childModel']='Tag';break;case _0xb6ad('0x69'):_0x4357ae[_0xb6ad('0x13')]='Template';break;case'triggers':_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x6a');break;case _0xb6ad('0x6b'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x6c');break;case _0xb6ad('0x6d'):_0x4357ae[_0xb6ad('0x13')]='Variable';break;case _0xb6ad('0x6e'):_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x6f');break;case _0xb6ad('0x70'):_0x4357ae[_0xb6ad('0x13')]='AnalyticExtractedReport';_0x4357ae[_0xb6ad('0x19')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case'metrics':_0x4357ae[_0xb6ad('0x13')]=_0xb6ad('0x71');break;}return _0x4357ae;}function _0x33ff0f(_0x49ef71,_0x1cf36f){var _0x2d7ef6=_0x49ef71['charAt'](0x0)['toUpperCase']()+_0x49ef71[_0xb6ad('0x72')](0x1);var _0xecc421={'type':_0x3762d0[_0xb6ad('0x73')][_0xb6ad('0x74')][_0xb6ad('0x75')],'raw':!![]};return new Promise(function(_0x1f69ca,_0x42c016){var _0x331897=squel[_0xb6ad('0x76')]()['field'](_0xb6ad('0x77')+_0x2d7ef6+'InteractionId','id')[_0xb6ad('0x6')](_0xb6ad('0x78'))[_0xb6ad('0x79')](_0xb6ad('0x7a')+_0x49ef71+_0xb6ad('0x7b'),'ui')['where'](_0xb6ad('0x7c'),_0x1cf36f['id']);return _0x3762d0[_0xb6ad('0x7d')][_0xb6ad('0x7e')](_0x331897[_0xb6ad('0x7f')](),_0xecc421)[_0xb6ad('0x9')](function(_0x44cc56){_0x1cf36f[_0x2d7ef6+_0xb6ad('0x80')]=_0x44cc56;_0x1f69ca(_0x44cc56);})[_0xb6ad('0xc')](function(_0x121cff){_0x42c016(_0x121cff);});});}return _0x4bd511[_0xb6ad('0x81')](_0xb6ad('0x82'),attributes,{'tableName':_0xb6ad('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x454013){var _0x403036={'raw':_0x454013[_0xb6ad('0x7e')]['raw'],'where':{}};var _0x4995d2={};var _0x47473f={'count':0x0,'rows':[]};var _0x23a1cd=_0x454013['query'][_0xb6ad('0x84')];var _0x12ab67=_0x454013[_0xb6ad('0x7e')][_0xb6ad('0x85')]||![];var _0x91c223=_0x1ca3be(_0x23a1cd,_0x12ab67);if(!_0x91c223['childModel'])throw new Error(_0xb6ad('0x86')+_0x23a1cd+'\x27');var _0x271182=[{'name':_0x23a1cd}];if(!_[_0xb6ad('0x87')](_0x91c223[_0xb6ad('0x19')]))_0x271182=_0x91c223['parentSections'];var _0x4b3898=[];for(var _0x1ae664=0x0;_0x1ae664<_0x271182[_0xb6ad('0x88')];_0x1ae664++){_0x4b3898[_0xb6ad('0x89')](_0x3762d0[_0xb6ad('0x8a')][_0xb6ad('0x8b')]({'where':{'userProfileId':_0x454013[_0xb6ad('0x8c')]['id'],'name':_0x271182[_0x1ae664][_0xb6ad('0x1b')]},'raw':!![]}));}return Promise['all'](_0x4b3898)[_0xb6ad('0x9')](function(_0x3f8036){var _0x9bb55f=_[_0xb6ad('0x5')](_0x3f8036,function(_0x4d48e4){return _0x4d48e4?_0x4d48e4:undefined;});var _0x32497b=_[_0xb6ad('0x5')](_0x271182,[_0xb6ad('0x8d'),!![]]);var _0x10990f=_[_0xb6ad('0x87')](_0x9bb55f)&&_[_0xb6ad('0x87')](_0x32497b)?null:_[_0xb6ad('0x8e')](_0x32497b,_0x9bb55f);if(!_0x10990f)return null;var _0x1c3165=[];for(var _0x32883f=0x0;_0x32883f<_0x10990f[_0xb6ad('0x88')];_0x32883f++){var _0xa85b0e=_[_0xb6ad('0x8b')](_0x271182,function(_0x28ee42){return _0x10990f[_0x32883f]?_0x28ee42[_0xb6ad('0x1b')]===_0x10990f[_0x32883f][_0xb6ad('0x1b')]:null;});if(_0xa85b0e){if(_0x10990f[_0x32883f]['ignore']){_0x1c3165[_0xb6ad('0x89')](_0x4d40b8(_0x91c223['childModel'],_0x10990f[_0x32883f]));}else{if(!_0x10990f[_0x32883f][_0xb6ad('0x8f')]){_0x1c3165[_0xb6ad('0x89')](_0x4b650b(_0xa85b0e,_0x10990f[_0x32883f],_0x91c223[_0xb6ad('0x13')]));}else{if(_0xa85b0e[_0xb6ad('0xd')]){_0x1c3165[_0xb6ad('0x89')](_0x531ad5(_0xa85b0e,_0x10990f[_0x32883f]));}}}}}return Promise['all'](_0x1c3165);})['then'](function(_0x14e8d7){var _0xd6ac9a=_0x14e8d7;var _0xc423fa=null;if(_0xd6ac9a){_0xc423fa=_0xd6ac9a[_0xb6ad('0x88')]===0x1?_0xd6ac9a[0x0]:null;}if(!_0xc423fa&&!_0xd6ac9a)return _0x47473f;var _0x41b2ca=_0x3762d0[_0x91c223[_0xb6ad('0x13')]][_0xb6ad('0x90')];_0x4995d2[_0xb6ad('0xd')]=_[_0xb6ad('0x91')](_0x41b2ca);_0x4995d2['query']=_[_0xb6ad('0x91')](_0x454013['query']);_0x4995d2['filters']=_[_0xb6ad('0x92')](_0x4995d2[_0xb6ad('0xd')],_0x4995d2[_0xb6ad('0x7e')]);_0x403036[_0xb6ad('0x93')]=_[_0xb6ad('0x92')](_0x4995d2[_0xb6ad('0xd')],qs[_0xb6ad('0x94')](_0x454013[_0xb6ad('0x7e')][_0xb6ad('0x94')]));_0x403036['attributes']=_0x403036[_0xb6ad('0x93')]['length']?_0x403036[_0xb6ad('0x93')]:_0x4995d2[_0xb6ad('0xd')];if(!_0x454013[_0xb6ad('0x7e')][_0xb6ad('0x95')](_0xb6ad('0x96'))){_0x403036[_0xb6ad('0x97')]=qs[_0xb6ad('0x97')](_0x454013[_0xb6ad('0x7e')]['limit']);_0x403036[_0xb6ad('0x98')]=qs[_0xb6ad('0x98')](_0x454013[_0xb6ad('0x7e')][_0xb6ad('0x98')]);}_0x403036['order']=qs[_0xb6ad('0x99')](_0x454013['query']['sort']);_0x403036[_0xb6ad('0x9a')]=qs['filters'](_[_0xb6ad('0x9b')](_0x454013[_0xb6ad('0x7e')],_0x4995d2[_0xb6ad('0x9c')]));if(_0x454013[_0xb6ad('0x7e')][_0xb6ad('0x5')]){_0x403036['where']=_[_0xb6ad('0x9d')](_0x403036[_0xb6ad('0x9a')],{'$or':_['map'](_0x41b2ca,function(_0x377e3b){if(_0x377e3b[_0xb6ad('0x3b')][_0xb6ad('0x9e')]!=='VIRTUAL'){var _0x3dcd20={};_0x3dcd20[_0x377e3b[_0xb6ad('0x6')]]={'$like':'%'+_0x454013[_0xb6ad('0x7e')]['filter']+'%'};return _0x3dcd20;}})});}var _0x29bbd0=[];var _0x2b322e=null;var _0x2cfcb7={};if(_0xc423fa){_0x2b322e=_['find'](_0x271182,[_0xb6ad('0x1b'),_0xc423fa[_0xb6ad('0x1b')]]);if(_0x2b322e['field']){_0x2cfcb7={};if(_0x91c223['childModel']===_0xb6ad('0xf')){_0x2cfcb7[_0x2b322e[_0xb6ad('0x9f')]]=_[_0xb6ad('0xb')](_0xc423fa[_0xb6ad('0xa')],'id');}else{_0x2cfcb7[_0x2b322e[_0xb6ad('0x9f')]]=_0xc423fa[_0xb6ad('0xa')];}_0x29bbd0['push'](_0x2cfcb7);}else{_0x403036[_0xb6ad('0x9a')]['id']=_0xc423fa['associatedResources'];}}else{for(var _0x20898d=0x0;_0x20898d<_0xd6ac9a[_0xb6ad('0x88')];_0x20898d++){_0x2b322e=_[_0xb6ad('0x8b')](_0x271182,[_0xb6ad('0x1b'),_0xd6ac9a[_0x20898d]['name']]);if(_0x2b322e['field']){_0x2cfcb7={};_0x2cfcb7[_0x2b322e[_0xb6ad('0x9f')]]=_0xd6ac9a[_0x20898d][_0xb6ad('0xa')];_0x29bbd0[_0xb6ad('0x89')](_0x2cfcb7);}else{if(!_0x403036[_0xb6ad('0x9a')]['id'])_0x403036[_0xb6ad('0x9a')]['id']=[];_0xd6ac9a[_0x20898d][_0xb6ad('0xa')][_0xb6ad('0xa0')](function(_0x29d3a1){_0x403036[_0xb6ad('0x9a')]['id'][_0xb6ad('0x89')](_0x29d3a1);});}}}if(!_[_0xb6ad('0x87')](_0x29bbd0)){_0x403036['where']=_['merge'](_0x403036['where'],{'$and':{'$or':_0x29bbd0}});}_0x403036=_[_0xb6ad('0x9d')]({},_0x403036,_0x454013[_0xb6ad('0xa1')]);if(_0xc423fa&&!_0xc423fa[_0xb6ad('0x8f')]&&_0x91c223['childModel']===_0xb6ad('0xf')){if(_0x454013[_0xb6ad('0x7e')][_0xb6ad('0xa2')]){_0x403036[_0xb6ad('0xa3')]=[{'all':!![]}];}return _0x3762d0[_0x91c223['childModel']][_0xb6ad('0x8')](_0x403036)['then'](function(_0x462247){var _0x273894=[];_0x462247[_0xb6ad('0xa0')](function(_0x4f0b5a){var _0x1add93;switch(_0x4f0b5a['reportType']){case _0xb6ad('0xa4'):_0x1add93=_[_0xb6ad('0x8b')](_0xc423fa['associatedResources'],function(_0x59382f){return _0x59382f['id']===_0x4f0b5a[_0xb6ad('0xa5')]&&_0x59382f['type']===_0xb6ad('0xa6');});break;case _0xb6ad('0xa7'):_0x1add93=_['find'](_0xc423fa[_0xb6ad('0xa')],function(_0x62e392){return _0x62e392['id']===_0x4f0b5a[_0xb6ad('0xa5')]&&_0x62e392['type']===_0xb6ad('0xa8');});break;}if(_0x1add93)_0x273894[_0xb6ad('0x89')](_0x4f0b5a);});_0x47473f[_0xb6ad('0xa9')]=_0x273894['length'];_0x47473f[_0xb6ad('0xaa')]=_0x273894;return _0x47473f;});}else{if(!_[_0xb6ad('0x87')](_0x454013[_0xb6ad('0x7e')][_0xb6ad('0xab')])){_0x403036[_0xb6ad('0x9a')]['id']=_0x403036['where']['id']?_[_0xb6ad('0x92')](_0x403036[_0xb6ad('0x9a')]['id'],_0x454013[_0xb6ad('0x7e')][_0xb6ad('0xab')]):_0x454013[_0xb6ad('0x7e')][_0xb6ad('0xab')];if(_0x454013[_0xb6ad('0x7e')][_0xb6ad('0xac')]){_0x403036[_0xb6ad('0xad')]=_0x454013[_0xb6ad('0x7e')][_0xb6ad('0xac')];}}if(_0x454013['query'][_0xb6ad('0xae')]){_0x403036[_0xb6ad('0x9a')]=_[_0xb6ad('0x9d')](_0x403036[_0xb6ad('0x9a')],{'$and':_0x454013[_0xb6ad('0x7e')][_0xb6ad('0xae')]});}return _0x3762d0[_0x91c223['childModel']][_0xb6ad('0xa9')]({'where':_0x403036[_0xb6ad('0x9a')]})['then'](function(_0x31a4b3){_0x47473f[_0xb6ad('0xa9')]=_0x31a4b3;if(_0x454013[_0xb6ad('0x7e')][_0xb6ad('0xa2')]){if(_0x91c223['childModel']==='CmContact'){_0x403036[_0xb6ad('0xa3')]=[{'model':_0x3762d0[_0xb6ad('0xaf')],'as':_0xb6ad('0xb0'),'attributes':['id',_0xb6ad('0x1b'),'color'],'required':_0x454013[_0xb6ad('0x7e')][_0xb6ad('0xb1')]?!![]:![]},{'model':_0x3762d0[_0xb6ad('0xaf')],'as':_0xb6ad('0xb2'),'attributes':['id',_0xb6ad('0x1b'),'color'],'through':_0x454013[_0xb6ad('0x7e')]['tag']?{'attributes':[],'where':{'TagId':_0x454013[_0xb6ad('0x7e')][_0xb6ad('0xb1')]||undefined}}:{},'required':_0x454013['query'][_0xb6ad('0xb1')]?!![]:![]}];}else{_0x403036['include']=[{'all':!![]}];}}return _0x3762d0[_0x91c223['childModel']]['findAll'](_0x403036);})['then'](function(_0x4b3fe0){_0x47473f[_0xb6ad('0xaa')]=_0x4b3fe0;if(_0x23a1cd==='Agents'&&_0x454013['query']['openTabs']===_0xb6ad('0xb3')){var _0x5ce586=[];for(var _0x46eaa5=0x0;_0x46eaa5<_0x47473f[_0xb6ad('0xaa')][_0xb6ad('0x88')];_0x46eaa5++){_0x5ce586['push'](_0x33ff0f(_0xb6ad('0xb4'),_0x47473f[_0xb6ad('0xaa')][_0x46eaa5][_0xb6ad('0xb5')]));_0x5ce586[_0xb6ad('0x89')](_0x33ff0f(_0xb6ad('0xb6'),_0x47473f['rows'][_0x46eaa5][_0xb6ad('0xb5')]));_0x5ce586[_0xb6ad('0x89')](_0x33ff0f(_0xb6ad('0xb7'),_0x47473f[_0xb6ad('0xaa')][_0x46eaa5]['dataValues']));_0x5ce586[_0xb6ad('0x89')](_0x33ff0f('mail',_0x47473f['rows'][_0x46eaa5][_0xb6ad('0xb5')]));_0x5ce586[_0xb6ad('0x89')](_0x33ff0f(_0xb6ad('0xb8'),_0x47473f[_0xb6ad('0xaa')][_0x46eaa5]['dataValues']));_0x5ce586[_0xb6ad('0x89')](_0x33ff0f(_0xb6ad('0xb9'),_0x47473f['rows'][_0x46eaa5][_0xb6ad('0xb5')]));}return Promise[_0xb6ad('0xba')](_0x5ce586)['then'](function(){return _0x47473f;});}return _0x47473f;});}});}}});}; \ No newline at end of file +var _0x540a=['toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','params','all','isEmpty','union','ignore','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','key','VIRTUAL','find','foreignKey','forEach','options','include','reportType','default','DefaultReports','custom','reportId','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','CmContact','Tags','color','ThroughTags','tag','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','then','associatedResources','map','value','model','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','inboundroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','agent','Telephones','name','User','role','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','type','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','users','agents','telephones','Users','admin','Agents','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Tag','templates','triggers','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','charAt'];(function(_0x2e45db,_0xac82b2){var _0x22310e=function(_0x584881){while(--_0x584881){_0x2e45db['push'](_0x2e45db['shift']());}};_0x22310e(++_0xac82b2);}(_0x540a,0x1dd));var _0xa540=function(_0x3f801e,_0x2b543b){_0x3f801e=_0x3f801e-0x0;var _0x30a9b7=_0x540a[_0x3f801e];return _0x30a9b7;};'use strict';var _=require('lodash');var attributes=require(_0xa540('0x0'));var qs=require(_0xa540('0x1'));var squel=require(_0xa540('0x2'));module[_0xa540('0x3')]=function(_0x550586){var _0x2e22dd=_0x550586[_0xa540('0x4')];function _0x4cf7e8(_0x36215f,_0x151b9a){return new Promise(function(_0x326339,_0x1c9706){if(!_0x151b9a)return _0x326339(null);var _0x1c010b=_0x151b9a[_0xa540('0x5')]?{[_0x151b9a['filter'][_0xa540('0x6')]]:_0x151b9a[_0xa540('0x5')]['value']}:undefined;return _0x2e22dd[_0x36215f][_0xa540('0x7')]({'where':_0x1c010b,'raw':!![]})[_0xa540('0x8')](function(_0x57b460){_0x151b9a[_0xa540('0x9')]=_[_0xa540('0xa')](_0x57b460,'id');_0x326339(_0x151b9a);})['catch'](function(_0x2933e9){_0x1c9706(_0x2933e9);});});}function _0x15399e(_0x46d3d4,_0xaf2a0){return new Promise(function(_0x5e7b89,_0x582963){var _0x5351fe=_0x46d3d4[_0xa540('0x5')]?{[_0x46d3d4[_0xa540('0x5')][_0xa540('0x6')]]:_0x46d3d4[_0xa540('0x5')][_0xa540('0xb')]}:undefined;return _0x2e22dd[_0x46d3d4[_0xa540('0xc')]][_0xa540('0x7')]({'where':_0x5351fe,'raw':!![]})['then'](function(_0x2926ca){_0xaf2a0[_0xa540('0x9')]=_[_0xa540('0xa')](_0x2926ca,function(_0x481e0f){return _0x481e0f['name'];});_0x5e7b89(_0xaf2a0);})[_0xa540('0xd')](function(_0xa2b516){_0x582963(_0xa2b516);});});}function _0x4fa8ba(_0x2b6413,_0x331eb6,_0x5c9c60){if(!_0x331eb6)return Promise[_0xa540('0xe')](null);return new Promise(function(_0x33f5e9,_0x5caeef){return _0x2e22dd[_0xa540('0xf')][_0xa540('0x7')]({'where':{'sectionId':_0x331eb6['id']},'raw':!![]})[_0xa540('0x8')](function(_0x24c2e2){if(_0x2b6413[_0xa540('0x6')]&&_0x2b6413['field']!=='id'){_0x331eb6[_0xa540('0x9')]=_[_0xa540('0xa')](_0x24c2e2,function(_0x558ab8){return _0x558ab8[_0x2b6413[_0xa540('0x6')]];});}else{if(_0x5c9c60===_0xa540('0x10')){_0x331eb6[_0xa540('0x9')]=_[_0xa540('0xa')](_0x24c2e2,function(_0x40c327){return{'id':_0x40c327[_0xa540('0x11')],'type':_0x40c327['type']};});}else{_0x331eb6[_0xa540('0x9')]=_[_0xa540('0xa')](_0x24c2e2,function(_0xa5bb8d){return _0xa5bb8d['resourceId'];});}}_0x33f5e9(_0x331eb6);})['catch'](function(_0x2187ee){_0x5caeef(_0x2187ee);});});}function _0x2fc61e(_0x555020,_0x53fbc8){var _0xd9e1d4={'parentSections':[]};switch(_0x555020[_0xa540('0x12')]()){case _0xa540('0x13'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x15');break;case _0xa540('0x16'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x17');break;case'squarerecordings':_0xd9e1d4['childModel']=_0xa540('0x18');_0xd9e1d4[_0xa540('0x19')]=[{'name':_0xa540('0x1a'),'field':'name','foreignKey':_0xa540('0x1b')}];break;case'projects':_0xd9e1d4[_0xa540('0x14')]='JscriptyProject';break;case'contacts':_0xd9e1d4[_0xa540('0x14')]='CmContact';_0xd9e1d4['parentSections']=[{'name':_0xa540('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0xa540('0x1d'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x1e');break;case _0xa540('0x1f'):_0xd9e1d4['childModel']=_0xa540('0x20');break;case _0xa540('0x21'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x22');break;case _0xa540('0x23'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x24');break;case'chatwebsites':_0xd9e1d4[_0xa540('0x14')]='ChatWebsite';break;case _0xa540('0x25'):_0xd9e1d4['childModel']=_0xa540('0x26');break;case'faxaccounts':_0xd9e1d4['childModel']='FaxAccount';break;case _0xa540('0x27'):case'internalroutes':case _0xa540('0x28'):_0xd9e1d4['childModel']=_0xa540('0x29');break;case'contexts':_0xd9e1d4['childModel']=_0xa540('0x2a');break;case _0xa540('0x2b'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x2c');break;case _0xa540('0x2d'):_0xd9e1d4['childModel']=_0xa540('0x2e');_0xd9e1d4[_0xa540('0x19')]=[{'name':'Agents','field':'name','foreignKey':_0xa540('0x2f'),'model':'User','filter':{'field':'role','value':[_0xa540('0x30')]}},{'name':_0xa540('0x31'),'field':_0xa540('0x32'),'foreignKey':_0xa540('0x2f'),'model':_0xa540('0x33'),'filter':{'field':_0xa540('0x34'),'value':['telephone']}},{'name':_0xa540('0x35'),'field':_0xa540('0x32'),'foreignKey':_0xa540('0x36'),'model':_0xa540('0x37'),'filter':{'field':'type','value':[_0xa540('0x38')]}},{'name':_0xa540('0x39'),'field':_0xa540('0x32'),'foreignKey':_0xa540('0x36'),'model':'VoiceQueue','filter':{'field':_0xa540('0x3a'),'value':['outbound']}}];break;case _0xa540('0x3b'):_0xd9e1d4['childModel']=_0xa540('0x3c');break;case _0xa540('0x3d'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x3e');break;case'voiceprefixes':_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x3f');break;case _0xa540('0x40'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x41');break;case _0xa540('0x42'):_0xd9e1d4[_0xa540('0x14')]='MailQueue';break;case _0xa540('0x43'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x44');break;case _0xa540('0x45'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x46');break;case _0xa540('0x47'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x48');break;case _0xa540('0x49'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x4a');break;case _0xa540('0x4b'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x4c');break;case _0xa540('0x4d'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x4e');break;case _0xa540('0x4f'):_0xd9e1d4['childModel']=_0xa540('0x50');break;case'whatsappaccounts':_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x51');break;case _0xa540('0x52'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x53');break;case'voicequeues':case'queuecampaigns':_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x37');if(_0x53fbc8){_0xd9e1d4[_0xa540('0x19')]=[{'name':_0xa540('0x35')},{'name':_0xa540('0x39')}];}break;case _0xa540('0x54'):case _0xa540('0x55'):case _0xa540('0x56'):_0xd9e1d4[_0xa540('0x14')]='User';if(_0x53fbc8){_0xd9e1d4[_0xa540('0x19')]=[{'name':_0xa540('0x57'),'filter':{'field':_0xa540('0x34'),'value':[_0xa540('0x58'),'user']},'ignore':!![]},{'name':_0xa540('0x59')},{'name':_0xa540('0x31')}];}break;case _0xa540('0x5a'):_0xd9e1d4[_0xa540('0x14')]='ZendeskAccount';break;case _0xa540('0x5b'):_0xd9e1d4['childModel']=_0xa540('0x5c');break;case'freshdeskaccounts':_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x5d');break;case _0xa540('0x5e'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x5f');break;case _0xa540('0x60'):_0xd9e1d4['childModel']=_0xa540('0x61');break;case _0xa540('0x62'):_0xd9e1d4[_0xa540('0x14')]='ZohoAccount';break;case _0xa540('0x63'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x33');break;case'cannedanswers':_0xd9e1d4['childModel']=_0xa540('0x64');break;case _0xa540('0x65'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x66');break;case _0xa540('0x67'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x68');break;case'intervals':_0xd9e1d4['childModel']=_0xa540('0x69');break;case _0xa540('0x6a'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x6b');break;case _0xa540('0x6c'):_0xd9e1d4['childModel']=_0xa540('0x6d');break;case _0xa540('0x6e'):_0xd9e1d4[_0xa540('0x14')]='Sound';break;case'tags':_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x6f');break;case _0xa540('0x70'):_0xd9e1d4[_0xa540('0x14')]='Template';break;case _0xa540('0x71'):_0xd9e1d4[_0xa540('0x14')]='Trigger';break;case'trunks':_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x72');break;case _0xa540('0x73'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x74');break;case _0xa540('0x75'):_0xd9e1d4[_0xa540('0x14')]='Plugin';break;case _0xa540('0x76'):_0xd9e1d4[_0xa540('0x14')]='AnalyticExtractedReport';_0xd9e1d4['parentSections']=[{'name':_0xa540('0x77'),'field':'id','foreignKey':'reportId'}];break;case _0xa540('0x78'):_0xd9e1d4[_0xa540('0x14')]=_0xa540('0x79');break;}return _0xd9e1d4;}function _0x5540e9(_0x300890,_0x2d25ac){var _0x18cb8d=_0x300890[_0xa540('0x7a')](0x0)[_0xa540('0x7b')]()+_0x300890[_0xa540('0x7c')](0x1);var _0x331c29={'type':_0x2e22dd[_0xa540('0x7d')][_0xa540('0x7e')][_0xa540('0x7f')],'raw':!![]};return new Promise(function(_0x359bdf,_0x5c0ad2){var _0x141e80=squel[_0xa540('0x80')]()[_0xa540('0x6')]('ui.'+_0x18cb8d+_0xa540('0x81'),'id')['field'](_0xa540('0x82'))[_0xa540('0x83')](_0xa540('0x84')+_0x300890+_0xa540('0x85'),'ui')['where'](_0xa540('0x86'),_0x2d25ac['id']);return _0x2e22dd[_0xa540('0x87')][_0xa540('0x88')](_0x141e80['toString'](),_0x331c29)['then'](function(_0x17d4c9){_0x2d25ac[_0x18cb8d+_0xa540('0x89')]=_0x17d4c9;_0x359bdf(_0x17d4c9);})[_0xa540('0xd')](function(_0x42dbad){_0x5c0ad2(_0x42dbad);});});}return _0x550586[_0xa540('0x8a')]('UserProfile',attributes,{'tableName':_0xa540('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x534691){var _0x46dafd={'raw':_0x534691[_0xa540('0x88')][_0xa540('0x8c')],'where':{}};var _0x580199={};var _0x18c8b4={'count':0x0,'rows':[]};var _0x2d5965=_0x534691['query'][_0xa540('0x8d')];var _0x4dbafd=_0x534691[_0xa540('0x88')][_0xa540('0x8e')]||![];var _0x187766=_0x2fc61e(_0x2d5965,_0x4dbafd);if(!_0x187766[_0xa540('0x14')])throw new Error(_0xa540('0x8f')+_0x2d5965+'\x27');var _0x10add0=[{'name':_0x2d5965}];if(!_['isEmpty'](_0x187766[_0xa540('0x19')]))_0x10add0=_0x187766[_0xa540('0x19')];var _0x21a598=[];for(var _0x280432=0x0;_0x280432<_0x10add0[_0xa540('0x90')];_0x280432++){_0x21a598[_0xa540('0x91')](_0x2e22dd[_0xa540('0x92')]['find']({'where':{'userProfileId':_0x534691[_0xa540('0x93')]['id'],'name':_0x10add0[_0x280432]['name']},'raw':!![]}));}return Promise[_0xa540('0x94')](_0x21a598)['then'](function(_0x4d5096){var _0x3829c9=_['filter'](_0x4d5096,function(_0x3250d8){return _0x3250d8?_0x3250d8:undefined;});var _0x3e7803=_['filter'](_0x10add0,['ignore',!![]]);var _0xd7eef2=_[_0xa540('0x95')](_0x3829c9)&&_[_0xa540('0x95')](_0x3e7803)?null:_[_0xa540('0x96')](_0x3e7803,_0x3829c9);if(!_0xd7eef2)return null;var _0xbe17cb=[];for(var _0x3c6206=0x0;_0x3c6206<_0xd7eef2['length'];_0x3c6206++){var _0x2a824f=_['find'](_0x10add0,function(_0x1c6518){return _0xd7eef2[_0x3c6206]?_0x1c6518[_0xa540('0x32')]===_0xd7eef2[_0x3c6206][_0xa540('0x32')]:null;});if(_0x2a824f){if(_0xd7eef2[_0x3c6206][_0xa540('0x97')]){_0xbe17cb['push'](_0x4cf7e8(_0x187766[_0xa540('0x14')],_0xd7eef2[_0x3c6206]));}else{if(!_0xd7eef2[_0x3c6206][_0xa540('0x98')]){_0xbe17cb[_0xa540('0x91')](_0x4fa8ba(_0x2a824f,_0xd7eef2[_0x3c6206],_0x187766[_0xa540('0x14')]));}else{if(_0x2a824f[_0xa540('0xc')]){_0xbe17cb[_0xa540('0x91')](_0x15399e(_0x2a824f,_0xd7eef2[_0x3c6206]));}}}}}return Promise[_0xa540('0x94')](_0xbe17cb);})['then'](function(_0x1ad404){var _0x139c2a=_0x1ad404;var _0x528fce=null;if(_0x139c2a){_0x528fce=_0x139c2a['length']===0x1?_0x139c2a[0x0]:null;}if(!_0x528fce&&!_0x139c2a)return _0x18c8b4;var _0x21fa59=_0x2e22dd[_0x187766['childModel']][_0xa540('0x99')];_0x580199['model']=_[_0xa540('0x9a')](_0x21fa59);_0x580199['query']=_[_0xa540('0x9a')](_0x534691['query']);_0x580199[_0xa540('0x9b')]=_[_0xa540('0x9c')](_0x580199[_0xa540('0xc')],_0x580199[_0xa540('0x88')]);_0x46dafd[_0xa540('0x9d')]=_[_0xa540('0x9c')](_0x580199[_0xa540('0xc')],qs['fields'](_0x534691[_0xa540('0x88')][_0xa540('0x9e')]));_0x46dafd[_0xa540('0x9d')]=_0x46dafd[_0xa540('0x9d')][_0xa540('0x90')]?_0x46dafd[_0xa540('0x9d')]:_0x580199['model'];if(!_0x534691[_0xa540('0x88')][_0xa540('0x9f')](_0xa540('0xa0'))){_0x46dafd[_0xa540('0xa1')]=qs['limit'](_0x534691[_0xa540('0x88')][_0xa540('0xa1')]);_0x46dafd[_0xa540('0xa2')]=qs[_0xa540('0xa2')](_0x534691['query'][_0xa540('0xa2')]);}_0x46dafd[_0xa540('0xa3')]=qs[_0xa540('0xa4')](_0x534691[_0xa540('0x88')][_0xa540('0xa4')]);_0x46dafd[_0xa540('0xa5')]=qs[_0xa540('0x9b')](_[_0xa540('0xa6')](_0x534691['query'],_0x580199[_0xa540('0x9b')]));if(_0x534691[_0xa540('0x88')]['filter']){_0x46dafd['where']=_[_0xa540('0xa7')](_0x46dafd[_0xa540('0xa5')],{'$or':_[_0xa540('0xa')](_0x21fa59,function(_0x591e37){if(_0x591e37[_0xa540('0x3a')][_0xa540('0xa8')]!==_0xa540('0xa9')){var _0x433285={};_0x433285[_0x591e37[_0xa540('0x6')]]={'$like':'%'+_0x534691[_0xa540('0x88')]['filter']+'%'};return _0x433285;}})});}var _0x12c024=[];var _0x14ffab=null;var _0x4843f1={};if(_0x528fce){_0x14ffab=_[_0xa540('0xaa')](_0x10add0,[_0xa540('0x32'),_0x528fce[_0xa540('0x32')]]);if(_0x14ffab['field']){_0x4843f1={};if(_0x187766[_0xa540('0x14')]===_0xa540('0x10')){_0x4843f1[_0x14ffab[_0xa540('0xab')]]=_['map'](_0x528fce[_0xa540('0x9')],'id');}else{_0x4843f1[_0x14ffab['foreignKey']]=_0x528fce['associatedResources'];}_0x12c024[_0xa540('0x91')](_0x4843f1);}else{_0x46dafd[_0xa540('0xa5')]['id']=_0x528fce[_0xa540('0x9')];}}else{for(var _0x17d7ac=0x0;_0x17d7ac<_0x139c2a[_0xa540('0x90')];_0x17d7ac++){_0x14ffab=_[_0xa540('0xaa')](_0x10add0,[_0xa540('0x32'),_0x139c2a[_0x17d7ac][_0xa540('0x32')]]);if(_0x14ffab['field']){_0x4843f1={};_0x4843f1[_0x14ffab[_0xa540('0xab')]]=_0x139c2a[_0x17d7ac][_0xa540('0x9')];_0x12c024[_0xa540('0x91')](_0x4843f1);}else{if(!_0x46dafd['where']['id'])_0x46dafd[_0xa540('0xa5')]['id']=[];_0x139c2a[_0x17d7ac][_0xa540('0x9')][_0xa540('0xac')](function(_0x4e2509){_0x46dafd[_0xa540('0xa5')]['id'][_0xa540('0x91')](_0x4e2509);});}}}if(!_[_0xa540('0x95')](_0x12c024)){_0x46dafd[_0xa540('0xa5')]=_[_0xa540('0xa7')](_0x46dafd['where'],{'$and':{'$or':_0x12c024}});}_0x46dafd=_[_0xa540('0xa7')]({},_0x46dafd,_0x534691[_0xa540('0xad')]);if(_0x528fce&&!_0x528fce[_0xa540('0x98')]&&_0x187766[_0xa540('0x14')]===_0xa540('0x10')){if(_0x534691[_0xa540('0x88')]['includeAll']){_0x46dafd[_0xa540('0xae')]=[{'all':!![]}];}return _0x2e22dd[_0x187766['childModel']][_0xa540('0x7')](_0x46dafd)[_0xa540('0x8')](function(_0x42e8ee){var _0x1c08dd=[];_0x42e8ee[_0xa540('0xac')](function(_0x2637ce){var _0x128482;switch(_0x2637ce[_0xa540('0xaf')]){case _0xa540('0xb0'):_0x128482=_[_0xa540('0xaa')](_0x528fce[_0xa540('0x9')],function(_0x3f8e91){return _0x3f8e91['id']===_0x2637ce['reportId']&&_0x3f8e91[_0xa540('0x3a')]===_0xa540('0xb1');});break;case _0xa540('0xb2'):_0x128482=_[_0xa540('0xaa')](_0x528fce[_0xa540('0x9')],function(_0xad6a1a){return _0xad6a1a['id']===_0x2637ce[_0xa540('0xb3')]&&_0xad6a1a[_0xa540('0x3a')]===_0xa540('0xb4');});break;}if(_0x128482)_0x1c08dd[_0xa540('0x91')](_0x2637ce);});_0x18c8b4[_0xa540('0xb5')]=_0x1c08dd[_0xa540('0x90')];_0x18c8b4[_0xa540('0xb6')]=_0x1c08dd;return _0x18c8b4;});}else{if(!_[_0xa540('0x95')](_0x534691['query'][_0xa540('0xb7')])){_0x46dafd[_0xa540('0xa5')]['id']=_0x46dafd['where']['id']?_[_0xa540('0x9c')](_0x46dafd['where']['id'],_0x534691[_0xa540('0x88')][_0xa540('0xb7')]):_0x534691[_0xa540('0x88')][_0xa540('0xb7')];if(_0x534691[_0xa540('0x88')][_0xa540('0xb8')]){_0x46dafd[_0xa540('0xa3')]=_0x534691[_0xa540('0x88')][_0xa540('0xb8')];}}if(_0x534691[_0xa540('0x88')][_0xa540('0xb9')]){_0x46dafd['where']=_[_0xa540('0xa7')](_0x46dafd[_0xa540('0xa5')],{'$and':_0x534691[_0xa540('0x88')][_0xa540('0xb9')]});}return _0x2e22dd[_0x187766['childModel']][_0xa540('0xb5')]({'where':_0x46dafd[_0xa540('0xa5')]})[_0xa540('0x8')](function(_0xc6ce85){_0x18c8b4['count']=_0xc6ce85;if(_0x534691[_0xa540('0x88')][_0xa540('0xba')]){if(_0x187766['childModel']===_0xa540('0xbb')){_0x46dafd[_0xa540('0xae')]=[{'model':_0x2e22dd[_0xa540('0x6f')],'as':_0xa540('0xbc'),'attributes':['id','name',_0xa540('0xbd')],'required':_0x534691['query']['tag']?!![]:![]},{'model':_0x2e22dd['Tag'],'as':_0xa540('0xbe'),'attributes':['id','name',_0xa540('0xbd')],'through':_0x534691[_0xa540('0x88')][_0xa540('0xbf')]?{'attributes':[],'where':{'TagId':_0x534691[_0xa540('0x88')]['tag']||undefined}}:{},'required':_0x534691[_0xa540('0x88')][_0xa540('0xbf')]?!![]:![]}];}else{_0x46dafd[_0xa540('0xae')]=[{'all':!![]}];}}return _0x2e22dd[_0x187766[_0xa540('0x14')]][_0xa540('0x7')](_0x46dafd);})['then'](function(_0x24fd5c){_0x18c8b4[_0xa540('0xb6')]=_0x24fd5c;if(_0x2d5965===_0xa540('0x59')&&_0x534691[_0xa540('0x88')]['openTabs']===_0xa540('0xc0')){var _0x136095=[];for(var _0x22d75b=0x0;_0x22d75b<_0x18c8b4['rows']['length'];_0x22d75b++){_0x136095[_0xa540('0x91')](_0x5540e9(_0xa540('0xc1'),_0x18c8b4[_0xa540('0xb6')][_0x22d75b][_0xa540('0xc2')]));_0x136095['push'](_0x5540e9(_0xa540('0xc3'),_0x18c8b4[_0xa540('0xb6')][_0x22d75b][_0xa540('0xc2')]));_0x136095[_0xa540('0x91')](_0x5540e9(_0xa540('0xc4'),_0x18c8b4[_0xa540('0xb6')][_0x22d75b][_0xa540('0xc2')]));_0x136095['push'](_0x5540e9(_0xa540('0xc5'),_0x18c8b4[_0xa540('0xb6')][_0x22d75b][_0xa540('0xc2')]));_0x136095[_0xa540('0x91')](_0x5540e9(_0xa540('0xc6'),_0x18c8b4['rows'][_0x22d75b][_0xa540('0xc2')]));_0x136095[_0xa540('0x91')](_0x5540e9(_0xa540('0xc7'),_0x18c8b4['rows'][_0x22d75b][_0xa540('0xc2')]));}return Promise[_0xa540('0x94')](_0x136095)[_0xa540('0x8')](function(){return _0x18c8b4;});}return _0x18c8b4;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 037c112..7317061 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 _0x9e69=['register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket'];(function(_0x4d03f0,_0x1050af){var _0x5b05a2=function(_0x49bff9){while(--_0x49bff9){_0x4d03f0['push'](_0x4d03f0['shift']());}};_0x5b05a2(++_0x1050af);}(_0x9e69,0x150));var _0x99e6=function(_0x50dd39,_0xaa7bcb){_0x50dd39=_0x50dd39-0x0;var _0x5aaa30=_0x9e69[_0x50dd39];return _0x5aaa30;};'use strict';var _=require('lodash');var util=require(_0x99e6('0x0'));var moment=require(_0x99e6('0x1'));var BPromise=require(_0x99e6('0x2'));var rs=require(_0x99e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99e6('0x4'))['db'];var utils=require(_0x99e6('0x5'));var logger=require('../../config/logger')(_0x99e6('0x6'));var config=require(_0x99e6('0x7'));var jayson=require(_0x99e6('0x8'));var client=jayson['client'][_0x99e6('0x9')]({'port':0x232a});config[_0x99e6('0xa')]=_[_0x99e6('0xb')](config['redis'],{'host':_0x99e6('0xc'),'port':0x18eb});var socket=require(_0x99e6('0xd'))(new Redis(config['redis']));require(_0x99e6('0xe'))[_0x99e6('0xf')](socket);function respondWithRpcPromise(_0x5d2a2b,_0x26bcdd,_0x74906a){return new BPromise(function(_0x490a04,_0x4d2d8c){return client[_0x99e6('0x10')](_0x5d2a2b,_0x74906a)[_0x99e6('0x11')](function(_0x45d416){logger[_0x99e6('0x12')](_0x99e6('0x13'),_0x26bcdd,_0x99e6('0x14'));logger['debug'](_0x99e6('0x15'),_0x26bcdd,_0x99e6('0x14'),JSON[_0x99e6('0x16')](_0x45d416));if(_0x45d416['error']){if(_0x45d416[_0x99e6('0x17')][_0x99e6('0x18')]===0x1f4){logger[_0x99e6('0x17')]('UserProfile,\x20%s,\x20%s',_0x26bcdd,_0x45d416['error']['message']);return _0x4d2d8c(_0x45d416[_0x99e6('0x17')][_0x99e6('0x19')]);}logger[_0x99e6('0x17')]('UserProfile,\x20%s,\x20%s',_0x26bcdd,_0x45d416[_0x99e6('0x17')][_0x99e6('0x19')]);return _0x490a04(_0x45d416[_0x99e6('0x17')][_0x99e6('0x19')]);}else{logger[_0x99e6('0x12')]('UserProfile,\x20%s,\x20%s',_0x26bcdd,_0x99e6('0x14'));_0x490a04(_0x45d416['result'][_0x99e6('0x19')]);}})[_0x99e6('0x1a')](function(_0x538651){logger[_0x99e6('0x17')](_0x99e6('0x13'),_0x26bcdd,_0x538651);_0x4d2d8c(_0x538651);});});} \ No newline at end of file +var _0x6c14=['socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6c14,0xd1));var _0x46c1=function(_0x7c38f7,_0x57e345){_0x7c38f7=_0x7c38f7-0x0;var _0x1568ce=_0x6c14[_0x7c38f7];return _0x1568ce;};'use strict';var _=require(_0x46c1('0x0'));var util=require(_0x46c1('0x1'));var moment=require(_0x46c1('0x2'));var BPromise=require(_0x46c1('0x3'));var rs=require(_0x46c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46c1('0x5'))['db'];var utils=require(_0x46c1('0x6'));var logger=require(_0x46c1('0x7'))('rpc');var config=require(_0x46c1('0x8'));var jayson=require(_0x46c1('0x9'));var client=jayson[_0x46c1('0xa')][_0x46c1('0xb')]({'port':0x232a});config[_0x46c1('0xc')]=_[_0x46c1('0xd')](config[_0x46c1('0xc')],{'host':_0x46c1('0xe'),'port':0x18eb});var socket=require(_0x46c1('0xf'))(new Redis(config['redis']));require(_0x46c1('0x10'))[_0x46c1('0x11')](socket);function respondWithRpcPromise(_0x28fae2,_0x5e999d,_0x42af02){return new BPromise(function(_0x3676e3,_0x2c718c){return client['request'](_0x28fae2,_0x42af02)[_0x46c1('0x12')](function(_0x2e9325){logger[_0x46c1('0x13')](_0x46c1('0x14'),_0x5e999d,'request\x20sent');logger[_0x46c1('0x15')](_0x46c1('0x16'),_0x5e999d,'request\x20sent',JSON['stringify'](_0x2e9325));if(_0x2e9325[_0x46c1('0x17')]){if(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x18')]===0x1f4){logger[_0x46c1('0x17')](_0x46c1('0x14'),_0x5e999d,_0x2e9325['error'][_0x46c1('0x19')]);return _0x2c718c(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x19')]);}logger[_0x46c1('0x17')](_0x46c1('0x14'),_0x5e999d,_0x2e9325['error']['message']);return _0x3676e3(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x19')]);}else{logger[_0x46c1('0x13')](_0x46c1('0x14'),_0x5e999d,_0x46c1('0x1a'));_0x3676e3(_0x2e9325[_0x46c1('0x1b')][_0x46c1('0x19')]);}})['catch'](function(_0x247a8b){logger[_0x46c1('0x17')]('UserProfile,\x20%s,\x20%s',_0x5e999d,_0x247a8b);_0x2c718c(_0x247a8b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 4691f8b..568ce01 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 _0x84da=['register','length','userProfile:','./userProfile.events','remove','update','emit','removeListener'];(function(_0x1f71d8,_0x278518){var _0x10b045=function(_0x57aea4){while(--_0x57aea4){_0x1f71d8['push'](_0x1f71d8['shift']());}};_0x10b045(++_0x278518);}(_0x84da,0x16b));var _0xa84d=function(_0xdbf73b,_0x5e5173){_0xdbf73b=_0xdbf73b-0x0;var _0x198847=_0x84da[_0xdbf73b];return _0x198847;};'use strict';var UserProfileEvents=require(_0xa84d('0x0'));var events=['save',_0xa84d('0x1'),_0xa84d('0x2')];function createListener(_0x53ca5d,_0x1eecbe){return function(_0x4817b8){_0x1eecbe[_0xa84d('0x3')](_0x53ca5d,_0x4817b8);};}function removeListener(_0x1fa878,_0x3b9c6f){return function(){UserProfileEvents[_0xa84d('0x4')](_0x1fa878,_0x3b9c6f);};}exports[_0xa84d('0x5')]=function(_0x40602f){for(var _0x4f741b=0x0,_0x57e278=events[_0xa84d('0x6')];_0x4f741b<_0x57e278;_0x4f741b++){var _0x4f2b2b=events[_0x4f741b];var _0x1609a0=createListener(_0xa84d('0x7')+_0x4f2b2b,_0x40602f);UserProfileEvents['on'](_0x4f2b2b,_0x1609a0);}}; \ No newline at end of file +var _0x419f=['emit','removeListener','userProfile:','save','remove','update'];(function(_0xa8494,_0x47dd23){var _0x4bc87c=function(_0xb7accf){while(--_0xb7accf){_0xa8494['push'](_0xa8494['shift']());}};_0x4bc87c(++_0x47dd23);}(_0x419f,0x117));var _0xf419=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x419f[_0x397e5f];return _0x5302b8;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xf419('0x0'),_0xf419('0x1'),_0xf419('0x2')];function createListener(_0x3d6d0b,_0x438db4){return function(_0xda596d){_0x438db4[_0xf419('0x3')](_0x3d6d0b,_0xda596d);};}function removeListener(_0x4859c9,_0x5eb455){return function(){UserProfileEvents[_0xf419('0x4')](_0x4859c9,_0x5eb455);};}exports['register']=function(_0x34c818){for(var _0x347ce1=0x0,_0x51673f=events['length'];_0x347ce1<_0x51673f;_0x347ce1++){var _0x4b4819=events[_0x347ce1];var _0x5c6c23=createListener(_0xf419('0x5')+_0x4b4819,_0x34c818);UserProfileEvents['on'](_0x4b4819,_0x5c6c23);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 6a54732..1c9c8eb 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 _0x730f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','exports','multer','util','path','express'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x730f,0x19e));var _0xf730=function(_0x561ea6,_0xce7611){_0x561ea6=_0x561ea6-0x0;var _0x11080b=_0x730f[_0x561ea6];return _0x11080b;};'use strict';var multer=require(_0xf730('0x0'));var util=require(_0xf730('0x1'));var path=require(_0xf730('0x2'));var timeout=require('connect-timeout');var express=require(_0xf730('0x3'));var router=express[_0xf730('0x4')]();var fs_extra=require(_0xf730('0x5'));var auth=require(_0xf730('0x6'));var interaction=require(_0xf730('0x7'));var config=require('../../config/environment');var controller=require(_0xf730('0x8'));router[_0xf730('0x9')]('/',auth[_0xf730('0xa')](),controller[_0xf730('0xb')]);router['get'](_0xf730('0xc'),auth[_0xf730('0xa')](),controller['describe']);router[_0xf730('0x9')](_0xf730('0xd'),auth[_0xf730('0xa')](),controller[_0xf730('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf730('0xf')]);router[_0xf730('0x10')](_0xf730('0xd'),auth[_0xf730('0xa')](),controller[_0xf730('0x11')]);router['delete'](_0xf730('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xf730('0x12')]=router; \ No newline at end of file +var _0xa7ca=['Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','exports','util','path','express'];(function(_0x4ca3fb,_0x3eba0e){var _0x39b2e9=function(_0x82dfd1){while(--_0x82dfd1){_0x4ca3fb['push'](_0x4ca3fb['shift']());}};_0x39b2e9(++_0x3eba0e);}(_0xa7ca,0x1a1));var _0xaa7c=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0xa7ca[_0x57b432];return _0x2edf2a;};'use strict';var multer=require('multer');var util=require(_0xaa7c('0x0'));var path=require(_0xaa7c('0x1'));var timeout=require('connect-timeout');var express=require(_0xaa7c('0x2'));var router=express[_0xaa7c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaa7c('0x4'));var config=require(_0xaa7c('0x5'));var controller=require(_0xaa7c('0x6'));router[_0xaa7c('0x7')]('/',auth['isAuthenticated'](),controller[_0xaa7c('0x8')]);router['get'](_0xaa7c('0x9'),auth[_0xaa7c('0xa')](),controller[_0xaa7c('0xb')]);router[_0xaa7c('0x7')]('/:id',auth[_0xaa7c('0xa')](),controller[_0xaa7c('0xc')]);router[_0xaa7c('0xd')]('/',auth['isAuthenticated'](),controller[_0xaa7c('0xe')]);router[_0xaa7c('0xf')](_0xaa7c('0x10'),auth['isAuthenticated'](),controller[_0xaa7c('0x11')]);router[_0xaa7c('0x12')](_0xaa7c('0x10'),auth[_0xaa7c('0xa')](),controller['destroy']);module[_0xaa7c('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index b6c717a..0b2af09 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 _0x1402=['INTEGER','sequelize','exports','STRING'];(function(_0x63c794,_0x14f52c){var _0x16f319=function(_0x149940){while(--_0x149940){_0x63c794['push'](_0x63c794['shift']());}};_0x16f319(++_0x14f52c);}(_0x1402,0x129));var _0x2140=function(_0xdb47d8,_0x933e5b){_0xdb47d8=_0xdb47d8-0x0;var _0x5cdfd9=_0x1402[_0xdb47d8];return _0x5cdfd9;};'use strict';var Sequelize=require(_0x2140('0x0'));module[_0x2140('0x1')]={'name':{'type':Sequelize[_0x2140('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2140('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2140('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3241=['INTEGER','sequelize','exports','STRING'];(function(_0x2f8dc2,_0x4f28fc){var _0x5993fb=function(_0xf7ecc2){while(--_0xf7ecc2){_0x2f8dc2['push'](_0x2f8dc2['shift']());}};_0x5993fb(++_0x4f28fc);}(_0x3241,0xe5));var _0x1324=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3241[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1324('0x0'));module[_0x1324('0x1')]={'name':{'type':Sequelize[_0x1324('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1324('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1324('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index d08c148..eec5b03 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 _0x9582=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0xd245ad,_0x18cfda){var _0x4ed50e=function(_0x1be42d){while(--_0x1be42d){_0xd245ad['push'](_0xd245ad['shift']());}};_0x4ed50e(++_0x18cfda);}(_0x9582,0x95));var _0x2958=function(_0x5bc0c0,_0x525c47){_0x5bc0c0=_0x5bc0c0-0x0;var _0x4aaf54=_0x9582[_0x5bc0c0];return _0x4aaf54;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['UserProfileResource'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,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(_0x2d91b5,_0x20738f){var _0x432cc5=function(_0x564ff7){while(--_0x564ff7){_0x2d91b5['push'](_0x2d91b5['shift']());}};_0x432cc5(++_0x20738f);}(_0xd943,0x15d));var _0x3d94=function(_0x2fea76,_0x32647e){_0x2fea76=_0x2fea76-0x0;var _0x652727=_0xd943[_0x2fea76];return _0x652727;};'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 9293d31..d623e5e 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 _0x9a9b=['sectionId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','resourceId'];(function(_0x5ebb40,_0x482051){var _0x3f0d97=function(_0x2a6148){while(--_0x2a6148){_0x5ebb40['push'](_0x5ebb40['shift']());}};_0x3f0d97(++_0x482051);}(_0x9a9b,0x15f));var _0xb9a9=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x9a9b[_0x5466ab];return _0x40751a;};'use strict';var _=require(_0xb9a9('0x0'));var util=require(_0xb9a9('0x1'));var logger=require(_0xb9a9('0x2'))('api');var moment=require(_0xb9a9('0x3'));var BPromise=require(_0xb9a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9a9('0x5'));var rimraf=require(_0xb9a9('0x6'));var config=require(_0xb9a9('0x7'));var attributes=require('./userProfileResource.attributes');module[_0xb9a9('0x8')]=function(_0x9d7e01,_0x51f6c7){return _0x9d7e01[_0xb9a9('0x9')](_0xb9a9('0xa'),attributes,{'tableName':_0xb9a9('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xb9a9('0xc'),_0xb9a9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55c6=['path','rimraf','../../config/environment','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','api','moment','bluebird'];(function(_0x5d474a,_0x22d540){var _0x7b068d=function(_0x5c1a9c){while(--_0x5c1a9c){_0x5d474a['push'](_0x5d474a['shift']());}};_0x7b068d(++_0x22d540);}(_0x55c6,0x141));var _0x655c=function(_0x4cffad,_0x553282){_0x4cffad=_0x4cffad-0x0;var _0x1ec3a3=_0x55c6[_0x4cffad];return _0x1ec3a3;};'use strict';var _=require(_0x655c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x655c('0x1'));var moment=require(_0x655c('0x2'));var BPromise=require(_0x655c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x655c('0x4'));var rimraf=require(_0x655c('0x5'));var config=require(_0x655c('0x6'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x35fdec,_0x3f133b){return _0x35fdec[_0x655c('0x7')](_0x655c('0x8'),attributes,{'tableName':_0x655c('0x9'),'paranoid':![],'indexes':[{'name':_0x655c('0xa'),'fields':[_0x655c('0xb'),_0x655c('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 e601b66..ecc4647 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 _0xd8ea=['UserProfileResource,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','error'];(function(_0x2c14a6,_0x1f9a92){var _0x35bb6a=function(_0x163f5e){while(--_0x163f5e){_0x2c14a6['push'](_0x2c14a6['shift']());}};_0x35bb6a(++_0x1f9a92);}(_0xd8ea,0x12f));var _0xad8e=function(_0x3907a3,_0x21b55e){_0x3907a3=_0x3907a3-0x0;var _0x53ea7f=_0xd8ea[_0x3907a3];return _0x53ea7f;};'use strict';var _=require(_0xad8e('0x0'));var util=require(_0xad8e('0x1'));var moment=require(_0xad8e('0x2'));var BPromise=require(_0xad8e('0x3'));var rs=require(_0xad8e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad8e('0x5'))['db'];var utils=require(_0xad8e('0x6'));var logger=require('../../config/logger')(_0xad8e('0x7'));var config=require('../../config/environment');var jayson=require(_0xad8e('0x8'));var client=jayson[_0xad8e('0x9')][_0xad8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x392367,_0x37d993,_0x57731e){return new BPromise(function(_0x325fd6,_0x4e33d4){return client[_0xad8e('0xb')](_0x392367,_0x57731e)[_0xad8e('0xc')](function(_0x42d78d){logger[_0xad8e('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x37d993,_0xad8e('0xe'));logger[_0xad8e('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x37d993,_0xad8e('0xe'),JSON['stringify'](_0x42d78d));if(_0x42d78d[_0xad8e('0x10')]){if(_0x42d78d[_0xad8e('0x10')]['code']===0x1f4){logger[_0xad8e('0x10')](_0xad8e('0x11'),_0x37d993,_0x42d78d[_0xad8e('0x10')][_0xad8e('0x12')]);return _0x4e33d4(_0x42d78d[_0xad8e('0x10')]['message']);}logger[_0xad8e('0x10')](_0xad8e('0x11'),_0x37d993,_0x42d78d[_0xad8e('0x10')][_0xad8e('0x12')]);return _0x325fd6(_0x42d78d[_0xad8e('0x10')][_0xad8e('0x12')]);}else{logger[_0xad8e('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x37d993,_0xad8e('0xe'));_0x325fd6(_0x42d78d['result'][_0xad8e('0x12')]);}})[_0xad8e('0x13')](function(_0x45e956){logger[_0xad8e('0x10')](_0xad8e('0x11'),_0x37d993,_0x45e956);_0x4e33d4(_0x45e956);});});} \ No newline at end of file +var _0xd5ab=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserProfileResource,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd5ab,0x89));var _0xbd5a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd5ab[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbd5a('0x0'));var util=require(_0xbd5a('0x1'));var moment=require(_0xbd5a('0x2'));var BPromise=require(_0xbd5a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd5a('0x4'));var db=require(_0xbd5a('0x5'))['db'];var utils=require(_0xbd5a('0x6'));var logger=require(_0xbd5a('0x7'))('rpc');var config=require(_0xbd5a('0x8'));var jayson=require(_0xbd5a('0x9'));var client=jayson[_0xbd5a('0xa')][_0xbd5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfe2261,_0x2b8565,_0x52a713){return new BPromise(function(_0x7ea501,_0x7a176d){return client[_0xbd5a('0xc')](_0xfe2261,_0x52a713)[_0xbd5a('0xd')](function(_0x7d06c7){logger[_0xbd5a('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x2b8565,'request\x20sent');logger[_0xbd5a('0xf')](_0xbd5a('0x10'),_0x2b8565,_0xbd5a('0x11'),JSON[_0xbd5a('0x12')](_0x7d06c7));if(_0x7d06c7[_0xbd5a('0x13')]){if(_0x7d06c7[_0xbd5a('0x13')]['code']===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x2b8565,_0x7d06c7[_0xbd5a('0x13')][_0xbd5a('0x14')]);return _0x7a176d(_0x7d06c7[_0xbd5a('0x13')][_0xbd5a('0x14')]);}logger['error'](_0xbd5a('0x15'),_0x2b8565,_0x7d06c7[_0xbd5a('0x13')]['message']);return _0x7ea501(_0x7d06c7['error'][_0xbd5a('0x14')]);}else{logger[_0xbd5a('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x2b8565,'request\x20sent');_0x7ea501(_0x7d06c7[_0xbd5a('0x16')][_0xbd5a('0x14')]);}})[_0xbd5a('0x17')](function(_0x17ea0f){logger[_0xbd5a('0x13')](_0xbd5a('0x15'),_0x2b8565,_0x17ea0f);_0x7a176d(_0x17ea0f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 435ec5d..48cb7be 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 _0x3dca=['delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x105e1a,_0x2a147c){var _0x2bdb68=function(_0x3c6729){while(--_0x3c6729){_0x105e1a['push'](_0x105e1a['shift']());}};_0x2bdb68(++_0x2a147c);}(_0x3dca,0x120));var _0xa3dc=function(_0x1e7b28,_0x18edcd){_0x1e7b28=_0x1e7b28-0x0;var _0x2e58d1=_0x3dca[_0x1e7b28];return _0x2e58d1;};'use strict';var multer=require('multer');var util=require(_0xa3dc('0x0'));var path=require(_0xa3dc('0x1'));var timeout=require('connect-timeout');var express=require(_0xa3dc('0x2'));var router=express[_0xa3dc('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa3dc('0x4'));var config=require(_0xa3dc('0x5'));var controller=require('./userProfileSection.controller');router[_0xa3dc('0x6')]('/',auth[_0xa3dc('0x7')](),controller[_0xa3dc('0x8')]);router[_0xa3dc('0x6')](_0xa3dc('0x9'),auth[_0xa3dc('0x7')](),controller[_0xa3dc('0xa')]);router[_0xa3dc('0x6')](_0xa3dc('0xb'),auth[_0xa3dc('0x7')](),controller[_0xa3dc('0xc')]);router[_0xa3dc('0xd')]('/',auth[_0xa3dc('0x7')](),controller[_0xa3dc('0xe')]);router['put'](_0xa3dc('0xb'),auth['isAuthenticated'](),controller[_0xa3dc('0xf')]);router[_0xa3dc('0x10')](_0xa3dc('0xb'),auth[_0xa3dc('0x7')](),controller[_0xa3dc('0x11')]);module[_0xa3dc('0x12')]=router; \ No newline at end of file +var _0xa7e7=['fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x27d6b8,_0x18dc1e){var _0x21fa59=function(_0x503f2f){while(--_0x503f2f){_0x27d6b8['push'](_0x27d6b8['shift']());}};_0x21fa59(++_0x18dc1e);}(_0xa7e7,0x19c));var _0x7a7e=function(_0x49e2b6,_0x4e6609){_0x49e2b6=_0x49e2b6-0x0;var _0x37cf09=_0xa7e7[_0x49e2b6];return _0x37cf09;};'use strict';var multer=require(_0x7a7e('0x0'));var util=require(_0x7a7e('0x1'));var path=require(_0x7a7e('0x2'));var timeout=require(_0x7a7e('0x3'));var express=require(_0x7a7e('0x4'));var router=express[_0x7a7e('0x5')]();var fs_extra=require(_0x7a7e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7a7e('0x7'));var config=require(_0x7a7e('0x8'));var controller=require(_0x7a7e('0x9'));router[_0x7a7e('0xa')]('/',auth[_0x7a7e('0xb')](),controller['index']);router[_0x7a7e('0xa')](_0x7a7e('0xc'),auth[_0x7a7e('0xb')](),controller[_0x7a7e('0xd')]);router['get'](_0x7a7e('0xe'),auth['isAuthenticated'](),controller[_0x7a7e('0xf')]);router['post']('/',auth[_0x7a7e('0xb')](),controller[_0x7a7e('0x10')]);router[_0x7a7e('0x11')](_0x7a7e('0xe'),auth[_0x7a7e('0xb')](),controller[_0x7a7e('0x12')]);router[_0x7a7e('0x13')]('/:id',auth[_0x7a7e('0xb')](),controller[_0x7a7e('0x14')]);module[_0x7a7e('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index b5f188a..bc9b696 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 _0xb78e=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x29e2a2,_0x5d25a6){var _0x3a83b4=function(_0x1a7350){while(--_0x1a7350){_0x29e2a2['push'](_0x29e2a2['shift']());}};_0x3a83b4(++_0x5d25a6);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5bd7b3,_0x49a10c){_0x5bd7b3=_0x5bd7b3-0x0;var _0x168859=_0xb78e[_0x5bd7b3];return _0x168859;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb78('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb78('0x2')],'set':function(_0x308d12){this[_0xeb78('0x5')](_0xeb78('0x6'),_0x308d12?_0x308d12['join'](''):[]);},'get':function(){return this[_0xeb78('0x7')](_0xeb78('0x6'))?this[_0xeb78('0x7')](_0xeb78('0x6'))[_0xeb78('0x8')](''):[];}}}; \ No newline at end of file +var _0xf7b4=['getDataValue','split','sequelize','STRING','INTEGER','setDataValue','crudPermissions','join'];(function(_0x24457f,_0x25b497){var _0x111e04=function(_0x39fe40){while(--_0x39fe40){_0x24457f['push'](_0x24457f['shift']());}};_0x111e04(++_0x25b497);}(_0xf7b4,0x152));var _0x4f7b=function(_0xd2f861,_0x34fa03){_0xd2f861=_0xd2f861-0x0;var _0x492a57=_0xf7b4[_0xd2f861];return _0x492a57;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4f7b('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4f7b('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4f7b('0x1')],'set':function(_0x3e18fd){this[_0x4f7b('0x3')](_0x4f7b('0x4'),_0x3e18fd?_0x3e18fd[_0x4f7b('0x5')](''):[]);},'get':function(){return this[_0x4f7b('0x6')](_0x4f7b('0x4'))?this[_0x4f7b('0x6')](_0x4f7b('0x4'))[_0x4f7b('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a51c40a..0ae4cee 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 _0x5b81=['where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','reject','save','update','then','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filters','filter'];(function(_0x19556f,_0x487769){var _0x171756=function(_0x2350fe){while(--_0x2350fe){_0x19556f['push'](_0x19556f['shift']());}};_0x171756(++_0x487769);}(_0x5b81,0xa0));var _0x15b8=function(_0x5e186d,_0x4cbcb4){_0x5e186d=_0x5e186d-0x0;var _0x20e313=_0x5b81[_0x5e186d];return _0x20e313;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x15b8('0x0'));var jsonpatch=require(_0x15b8('0x1'));var rp=require(_0x15b8('0x2'));var moment=require(_0x15b8('0x3'));var BPromise=require(_0x15b8('0x4'));var Mustache=require(_0x15b8('0x5'));var util=require(_0x15b8('0x6'));var path=require(_0x15b8('0x7'));var sox=require(_0x15b8('0x8'));var csv=require(_0x15b8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15b8('0xa'));var _=require(_0x15b8('0xb'));var squel=require(_0x15b8('0xc'));var crypto=require(_0x15b8('0xd'));var jsforce=require(_0x15b8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x15b8('0x9'));var querystring=require('querystring');var Papa=require(_0x15b8('0xf'));var Redis=require(_0x15b8('0x10'));var authService=require(_0x15b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x15b8('0x12'));var hardwareService=require(_0x15b8('0x13'));var logger=require(_0x15b8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x15b8('0x15'));var licenseUtil=require(_0x15b8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e8dde,_0x2269fb){_0x2269fb=_0x2269fb||0xcc;return function(_0x556d75){if(_0x556d75){return _0x2e8dde[_0x15b8('0x17')](_0x2269fb);}return _0x2e8dde['status'](_0x2269fb)[_0x15b8('0x18')]();};}function respondWithResult(_0x540757,_0x4d5704){_0x4d5704=_0x4d5704||0xc8;return function(_0x11560d){if(_0x11560d){return _0x540757['status'](_0x4d5704)['json'](_0x11560d);}};}function respondWithFilteredResult(_0x498385,_0x1655b1){return function(_0x39f98d){if(_0x39f98d){var _0x2893f7=typeof _0x1655b1[_0x15b8('0x19')]===_0x15b8('0x1a')&&typeof _0x1655b1[_0x15b8('0x1b')]==='undefined';var _0x12cf1a=_0x39f98d[_0x15b8('0x1c')];var _0x71273a=_0x2893f7?0x0:_0x1655b1[_0x15b8('0x19')];var _0xbe7532=_0x2893f7?_0x39f98d[_0x15b8('0x1c')]:_0x1655b1[_0x15b8('0x19')]+_0x1655b1['limit'];var _0x3e8b1a;if(_0xbe7532>=_0x12cf1a){_0xbe7532=_0x12cf1a;_0x3e8b1a=0xc8;}else{_0x3e8b1a=0xce;}_0x498385[_0x15b8('0x1d')](_0x3e8b1a);return _0x498385[_0x15b8('0x1e')]('Content-Range',_0x71273a+'-'+_0xbe7532+'/'+_0x12cf1a)['json'](_0x39f98d);}return null;};}function patchUpdates(_0x2dc9c6){return function(_0x483142){try{jsonpatch['apply'](_0x483142,_0x2dc9c6,!![]);}catch(_0x352a9a){return BPromise[_0x15b8('0x1f')](_0x352a9a);}return _0x483142[_0x15b8('0x20')]();};}function saveUpdates(_0x1f0c57,_0x2d8eda){return function(_0x263aa7){if(_0x263aa7){return _0x263aa7[_0x15b8('0x21')](_0x1f0c57)[_0x15b8('0x22')](function(_0x427d02){return _0x427d02;});}return null;};}function removeEntity(_0x5c3e56,_0x5b2bdb){return function(_0xa96439){if(_0xa96439){return _0xa96439[_0x15b8('0x23')]()[_0x15b8('0x22')](function(){_0x5c3e56[_0x15b8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21ed1e,_0x5a856b){return function(_0x49e121){if(!_0x49e121){_0x21ed1e[_0x15b8('0x17')](0x194);}return _0x49e121;};}function handleError(_0x354a3b,_0x18470f){_0x18470f=_0x18470f||0x1f4;return function(_0x5ccb17){logger[_0x15b8('0x24')](_0x5ccb17[_0x15b8('0x25')]);if(_0x5ccb17[_0x15b8('0x26')]){delete _0x5ccb17['name'];}_0x354a3b['status'](_0x18470f)['send'](_0x5ccb17);};}exports[_0x15b8('0x27')]=function(_0x1e7876,_0x35bd13){var _0x5a6c2d={},_0x6e98a0={},_0xfba65={'count':0x0,'rows':[]};var _0x491761=_[_0x15b8('0x28')](db[_0x15b8('0x29')][_0x15b8('0x2a')],function(_0x461802){return{'name':_0x461802[_0x15b8('0x2b')],'type':_0x461802[_0x15b8('0x2c')][_0x15b8('0x2d')]};});_0x6e98a0[_0x15b8('0x2e')]=_[_0x15b8('0x28')](_0x491761,_0x15b8('0x26'));_0x6e98a0['query']=_[_0x15b8('0x2f')](_0x1e7876[_0x15b8('0x30')]);_0x6e98a0['filters']=_['intersection'](_0x6e98a0[_0x15b8('0x2e')],_0x6e98a0[_0x15b8('0x30')]);_0x5a6c2d[_0x15b8('0x31')]=_[_0x15b8('0x32')](_0x6e98a0['model'],qs[_0x15b8('0x33')](_0x1e7876[_0x15b8('0x30')]['fields']));_0x5a6c2d[_0x15b8('0x31')]=_0x5a6c2d['attributes'][_0x15b8('0x34')]?_0x5a6c2d['attributes']:_0x6e98a0[_0x15b8('0x2e')];if(!_0x1e7876['query'][_0x15b8('0x35')]('nolimit')){_0x5a6c2d['limit']=qs[_0x15b8('0x1b')](_0x1e7876[_0x15b8('0x30')][_0x15b8('0x1b')]);_0x5a6c2d[_0x15b8('0x19')]=qs['offset'](_0x1e7876['query'][_0x15b8('0x19')]);}_0x5a6c2d[_0x15b8('0x36')]=qs['sort'](_0x1e7876[_0x15b8('0x30')][_0x15b8('0x37')]);_0x5a6c2d['where']=qs['filters'](_[_0x15b8('0x38')](_0x1e7876[_0x15b8('0x30')],_0x6e98a0[_0x15b8('0x39')]),_0x491761);if(_0x1e7876[_0x15b8('0x30')][_0x15b8('0x3a')]){_0x5a6c2d[_0x15b8('0x3b')]=_['merge'](_0x5a6c2d['where'],{'$or':_[_0x15b8('0x28')](_0x491761,function(_0x404dda){if(_0x404dda[_0x15b8('0x2c')]!==_0x15b8('0x3c')){var _0x2f9023={};_0x2f9023[_0x404dda[_0x15b8('0x26')]]={'$like':'%'+_0x1e7876[_0x15b8('0x30')][_0x15b8('0x3a')]+'%'};return _0x2f9023;}})});}_0x5a6c2d=_[_0x15b8('0x3d')]({},_0x5a6c2d,_0x1e7876[_0x15b8('0x3e')]);var _0x174364={'where':_0x5a6c2d[_0x15b8('0x3b')]};return db['UserProfileSection']['count'](_0x174364)['then'](function(_0x52a0e3){_0xfba65['count']=_0x52a0e3;if(_0x1e7876[_0x15b8('0x30')][_0x15b8('0x3f')]){_0x5a6c2d[_0x15b8('0x40')]=[{'all':!![]}];}return db[_0x15b8('0x29')]['findAll'](_0x5a6c2d);})[_0x15b8('0x22')](function(_0x391ebb){_0xfba65[_0x15b8('0x41')]=_0x391ebb;return _0xfba65;})[_0x15b8('0x22')](respondWithFilteredResult(_0x35bd13,_0x5a6c2d))[_0x15b8('0x42')](handleError(_0x35bd13,null));};exports[_0x15b8('0x43')]=function(_0x13de14,_0x50b0de){var _0x2a4a8b={'raw':![],'where':{'id':_0x13de14[_0x15b8('0x44')]['id']}},_0x423e7f={};_0x423e7f[_0x15b8('0x2e')]=_[_0x15b8('0x2f')](db[_0x15b8('0x29')][_0x15b8('0x2a')]);_0x423e7f[_0x15b8('0x30')]=_['keys'](_0x13de14[_0x15b8('0x30')]);_0x423e7f[_0x15b8('0x39')]=_[_0x15b8('0x32')](_0x423e7f[_0x15b8('0x2e')],_0x423e7f[_0x15b8('0x30')]);_0x2a4a8b[_0x15b8('0x31')]=_[_0x15b8('0x32')](_0x423e7f['model'],qs['fields'](_0x13de14['query'][_0x15b8('0x33')]));_0x2a4a8b['attributes']=_0x2a4a8b[_0x15b8('0x31')][_0x15b8('0x34')]?_0x2a4a8b[_0x15b8('0x31')]:_0x423e7f[_0x15b8('0x2e')];if(_0x13de14[_0x15b8('0x30')]['includeAll']){_0x2a4a8b[_0x15b8('0x40')]=[{'all':!![]}];}_0x2a4a8b=_[_0x15b8('0x3d')]({},_0x2a4a8b,_0x13de14[_0x15b8('0x3e')]);return db[_0x15b8('0x29')][_0x15b8('0x45')](_0x2a4a8b)[_0x15b8('0x22')](handleEntityNotFound(_0x50b0de,null))[_0x15b8('0x22')](respondWithResult(_0x50b0de,null))['catch'](handleError(_0x50b0de,null));};exports['create']=function(_0x2fd747,_0x404cce){return db[_0x15b8('0x29')][_0x15b8('0x46')](_0x2fd747[_0x15b8('0x47')],{})['then'](respondWithResult(_0x404cce,0xc9))[_0x15b8('0x42')](handleError(_0x404cce,null));};exports['update']=function(_0x3168d3,_0x36a92c){if(_0x3168d3[_0x15b8('0x47')]['id']){delete _0x3168d3[_0x15b8('0x47')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x3168d3[_0x15b8('0x44')]['id']}})[_0x15b8('0x22')](handleEntityNotFound(_0x36a92c,null))['then'](saveUpdates(_0x3168d3[_0x15b8('0x47')],null))[_0x15b8('0x22')](respondWithResult(_0x36a92c,null))[_0x15b8('0x42')](handleError(_0x36a92c,null));};exports[_0x15b8('0x23')]=function(_0xb1eecb,_0x2dc222){return db[_0x15b8('0x29')][_0x15b8('0x45')]({'where':{'id':_0xb1eecb[_0x15b8('0x44')]['id']}})[_0x15b8('0x22')](handleEntityNotFound(_0x2dc222,null))['then'](removeEntity(_0x2dc222,null))['catch'](handleError(_0x2dc222,null));};exports[_0x15b8('0x48')]=function(_0x7574aa,_0x5c56f2){return db[_0x15b8('0x29')][_0x15b8('0x48')]()[_0x15b8('0x22')](respondWithResult(_0x5c56f2,null))[_0x15b8('0x42')](handleError(_0x5c56f2,null));}; \ No newline at end of file +var _0x2468=['body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','find','catch','create'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x2468,0xf2));var _0x8246=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0x2468[_0x43b08];return _0x5e05f4;};'use strict';var emlformat=require(_0x8246('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8246('0x1'));var jsonpatch=require(_0x8246('0x2'));var rp=require(_0x8246('0x3'));var moment=require('moment');var BPromise=require(_0x8246('0x4'));var Mustache=require(_0x8246('0x5'));var util=require(_0x8246('0x6'));var path=require('path');var sox=require(_0x8246('0x7'));var csv=require(_0x8246('0x8'));var ejs=require(_0x8246('0x9'));var fs=require('fs');var fs_extra=require(_0x8246('0xa'));var _=require(_0x8246('0xb'));var squel=require(_0x8246('0xc'));var crypto=require(_0x8246('0xd'));var jsforce=require(_0x8246('0xe'));var deskjs=require(_0x8246('0xf'));var toCsv=require(_0x8246('0x8'));var querystring=require('querystring');var Papa=require(_0x8246('0x10'));var Redis=require(_0x8246('0x11'));var authService=require(_0x8246('0x12'));var qs=require(_0x8246('0x13'));var as=require(_0x8246('0x14'));var hardwareService=require(_0x8246('0x15'));var logger=require(_0x8246('0x16'))(_0x8246('0x17'));var utils=require(_0x8246('0x18'));var config=require(_0x8246('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8246('0x1a'))['db'];function respondWithStatusCode(_0x1812af,_0x18e919){_0x18e919=_0x18e919||0xcc;return function(_0x99b133){if(_0x99b133){return _0x1812af['sendStatus'](_0x18e919);}return _0x1812af['status'](_0x18e919)[_0x8246('0x1b')]();};}function respondWithResult(_0x39e4ca,_0x39c42b){_0x39c42b=_0x39c42b||0xc8;return function(_0x43e4c4){if(_0x43e4c4){return _0x39e4ca[_0x8246('0x1c')](_0x39c42b)['json'](_0x43e4c4);}};}function respondWithFilteredResult(_0x3a3fe2,_0x656586){return function(_0x265e8d){if(_0x265e8d){var _0x6d181a=typeof _0x656586['offset']===_0x8246('0x1d')&&typeof _0x656586[_0x8246('0x1e')]===_0x8246('0x1d');var _0x4bd5c9=_0x265e8d[_0x8246('0x1f')];var _0x3ae3ef=_0x6d181a?0x0:_0x656586[_0x8246('0x20')];var _0x1df952=_0x6d181a?_0x265e8d[_0x8246('0x1f')]:_0x656586['offset']+_0x656586[_0x8246('0x1e')];var _0x2a91ba;if(_0x1df952>=_0x4bd5c9){_0x1df952=_0x4bd5c9;_0x2a91ba=0xc8;}else{_0x2a91ba=0xce;}_0x3a3fe2[_0x8246('0x1c')](_0x2a91ba);return _0x3a3fe2[_0x8246('0x21')](_0x8246('0x22'),_0x3ae3ef+'-'+_0x1df952+'/'+_0x4bd5c9)[_0x8246('0x23')](_0x265e8d);}return null;};}function patchUpdates(_0x5f5515){return function(_0x4d2600){try{jsonpatch[_0x8246('0x24')](_0x4d2600,_0x5f5515,!![]);}catch(_0x2055b2){return BPromise[_0x8246('0x25')](_0x2055b2);}return _0x4d2600[_0x8246('0x26')]();};}function saveUpdates(_0x4cb588,_0x582176){return function(_0x4635b3){if(_0x4635b3){return _0x4635b3['update'](_0x4cb588)[_0x8246('0x27')](function(_0x4dda03){return _0x4dda03;});}return null;};}function removeEntity(_0x2b69e2,_0x517014){return function(_0x45698d){if(_0x45698d){return _0x45698d[_0x8246('0x28')]()[_0x8246('0x27')](function(){_0x2b69e2[_0x8246('0x1c')](0xcc)[_0x8246('0x1b')]();});}};}function handleEntityNotFound(_0x136405,_0x255bc9){return function(_0x2deb6f){if(!_0x2deb6f){_0x136405[_0x8246('0x29')](0x194);}return _0x2deb6f;};}function handleError(_0x47be7c,_0xdc04b){_0xdc04b=_0xdc04b||0x1f4;return function(_0x74c86d){logger[_0x8246('0x2a')](_0x74c86d[_0x8246('0x2b')]);if(_0x74c86d[_0x8246('0x2c')]){delete _0x74c86d[_0x8246('0x2c')];}_0x47be7c[_0x8246('0x1c')](_0xdc04b)[_0x8246('0x2d')](_0x74c86d);};}exports[_0x8246('0x2e')]=function(_0x1f3716,_0x54a7bb){var _0x434f4d={},_0x19c66c={},_0x412099={'count':0x0,'rows':[]};var _0x3aa3a3=_[_0x8246('0x2f')](db[_0x8246('0x30')][_0x8246('0x31')],function(_0x238d53){return{'name':_0x238d53[_0x8246('0x32')],'type':_0x238d53['type'][_0x8246('0x33')]};});_0x19c66c['model']=_[_0x8246('0x2f')](_0x3aa3a3,_0x8246('0x2c'));_0x19c66c['query']=_[_0x8246('0x34')](_0x1f3716[_0x8246('0x35')]);_0x19c66c[_0x8246('0x36')]=_[_0x8246('0x37')](_0x19c66c[_0x8246('0x38')],_0x19c66c[_0x8246('0x35')]);_0x434f4d[_0x8246('0x39')]=_['intersection'](_0x19c66c[_0x8246('0x38')],qs[_0x8246('0x3a')](_0x1f3716['query'][_0x8246('0x3a')]));_0x434f4d[_0x8246('0x39')]=_0x434f4d[_0x8246('0x39')][_0x8246('0x3b')]?_0x434f4d[_0x8246('0x39')]:_0x19c66c[_0x8246('0x38')];if(!_0x1f3716[_0x8246('0x35')][_0x8246('0x3c')](_0x8246('0x3d'))){_0x434f4d[_0x8246('0x1e')]=qs[_0x8246('0x1e')](_0x1f3716[_0x8246('0x35')][_0x8246('0x1e')]);_0x434f4d[_0x8246('0x20')]=qs[_0x8246('0x20')](_0x1f3716[_0x8246('0x35')][_0x8246('0x20')]);}_0x434f4d[_0x8246('0x3e')]=qs['sort'](_0x1f3716[_0x8246('0x35')][_0x8246('0x3f')]);_0x434f4d['where']=qs[_0x8246('0x36')](_[_0x8246('0x40')](_0x1f3716['query'],_0x19c66c[_0x8246('0x36')]),_0x3aa3a3);if(_0x1f3716['query']['filter']){_0x434f4d['where']=_[_0x8246('0x41')](_0x434f4d['where'],{'$or':_[_0x8246('0x2f')](_0x3aa3a3,function(_0x43e28d){if(_0x43e28d[_0x8246('0x42')]!==_0x8246('0x43')){var _0x4745c0={};_0x4745c0[_0x43e28d['name']]={'$like':'%'+_0x1f3716[_0x8246('0x35')][_0x8246('0x44')]+'%'};return _0x4745c0;}})});}_0x434f4d=_[_0x8246('0x41')]({},_0x434f4d,_0x1f3716[_0x8246('0x45')]);var _0x2c67df={'where':_0x434f4d['where']};return db[_0x8246('0x30')][_0x8246('0x1f')](_0x2c67df)[_0x8246('0x27')](function(_0x1e64fc){_0x412099[_0x8246('0x1f')]=_0x1e64fc;if(_0x1f3716['query']['includeAll']){_0x434f4d[_0x8246('0x46')]=[{'all':!![]}];}return db[_0x8246('0x30')][_0x8246('0x47')](_0x434f4d);})['then'](function(_0x3b4aae){_0x412099[_0x8246('0x48')]=_0x3b4aae;return _0x412099;})[_0x8246('0x27')](respondWithFilteredResult(_0x54a7bb,_0x434f4d))['catch'](handleError(_0x54a7bb,null));};exports[_0x8246('0x49')]=function(_0x1e50e6,_0x5e0421){var _0x4f1921={'raw':![],'where':{'id':_0x1e50e6[_0x8246('0x4a')]['id']}},_0x137ba6={};_0x137ba6[_0x8246('0x38')]=_[_0x8246('0x34')](db[_0x8246('0x30')][_0x8246('0x31')]);_0x137ba6[_0x8246('0x35')]=_['keys'](_0x1e50e6[_0x8246('0x35')]);_0x137ba6[_0x8246('0x36')]=_[_0x8246('0x37')](_0x137ba6[_0x8246('0x38')],_0x137ba6[_0x8246('0x35')]);_0x4f1921['attributes']=_[_0x8246('0x37')](_0x137ba6[_0x8246('0x38')],qs[_0x8246('0x3a')](_0x1e50e6[_0x8246('0x35')][_0x8246('0x3a')]));_0x4f1921['attributes']=_0x4f1921[_0x8246('0x39')][_0x8246('0x3b')]?_0x4f1921[_0x8246('0x39')]:_0x137ba6[_0x8246('0x38')];if(_0x1e50e6[_0x8246('0x35')]['includeAll']){_0x4f1921[_0x8246('0x46')]=[{'all':!![]}];}_0x4f1921=_['merge']({},_0x4f1921,_0x1e50e6[_0x8246('0x45')]);return db['UserProfileSection'][_0x8246('0x4b')](_0x4f1921)[_0x8246('0x27')](handleEntityNotFound(_0x5e0421,null))[_0x8246('0x27')](respondWithResult(_0x5e0421,null))[_0x8246('0x4c')](handleError(_0x5e0421,null));};exports[_0x8246('0x4d')]=function(_0x472cb9,_0x5bc502){return db[_0x8246('0x30')][_0x8246('0x4d')](_0x472cb9[_0x8246('0x4e')],{})['then'](respondWithResult(_0x5bc502,0xc9))[_0x8246('0x4c')](handleError(_0x5bc502,null));};exports['update']=function(_0x552380,_0x5369f2){if(_0x552380[_0x8246('0x4e')]['id']){delete _0x552380[_0x8246('0x4e')]['id'];}return db[_0x8246('0x30')][_0x8246('0x4b')]({'where':{'id':_0x552380[_0x8246('0x4a')]['id']}})[_0x8246('0x27')](handleEntityNotFound(_0x5369f2,null))[_0x8246('0x27')](saveUpdates(_0x552380[_0x8246('0x4e')],null))[_0x8246('0x27')](respondWithResult(_0x5369f2,null))['catch'](handleError(_0x5369f2,null));};exports['destroy']=function(_0x483454,_0x29bdb1){return db[_0x8246('0x30')][_0x8246('0x4b')]({'where':{'id':_0x483454['params']['id']}})[_0x8246('0x27')](handleEntityNotFound(_0x29bdb1,null))[_0x8246('0x27')](removeEntity(_0x29bdb1,null))[_0x8246('0x4c')](handleError(_0x29bdb1,null));};exports[_0x8246('0x4f')]=function(_0x202da2,_0xdd0fb9){return db['UserProfileSection'][_0x8246('0x4f')]()['then'](respondWithResult(_0xdd0fb9,null))[_0x8246('0x4c')](handleError(_0xdd0fb9,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 83be90a..2065fb0 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 _0x9e5f=['rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4e4df1,_0x42cec8){var _0xa32096=function(_0x1712d7){while(--_0x1712d7){_0x4e4df1['push'](_0x4e4df1['shift']());}};_0xa32096(++_0x42cec8);}(_0x9e5f,0x116));var _0xf9e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf9e5('0x0'));var util=require(_0xf9e5('0x1'));var logger=require('../../config/logger')(_0xf9e5('0x2'));var moment=require(_0xf9e5('0x3'));var BPromise=require(_0xf9e5('0x4'));var rp=require(_0xf9e5('0x5'));var fs=require('fs');var path=require(_0xf9e5('0x6'));var rimraf=require(_0xf9e5('0x7'));var config=require(_0xf9e5('0x8'));var attributes=require(_0xf9e5('0x9'));module[_0xf9e5('0xa')]=function(_0x46b1ef,_0xab7c57){return _0x46b1ef[_0xf9e5('0xb')](_0xf9e5('0xc'),attributes,{'tableName':_0xf9e5('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xf9e5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf1a=['path','rimraf','./userProfileSection.attributes','define','UserProfileSection','sectionId','userProfileId','lodash','util','../../config/logger','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf1a,0xd8));var _0xaaf1=function(_0x50fa6b,_0x5170fa){_0x50fa6b=_0x50fa6b-0x0;var _0x4545df=_0xaf1a[_0x50fa6b];return _0x4545df;};'use strict';var _=require(_0xaaf1('0x0'));var util=require(_0xaaf1('0x1'));var logger=require(_0xaaf1('0x2'))('api');var moment=require(_0xaaf1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaaf1('0x4'));var rimraf=require(_0xaaf1('0x5'));var config=require('../../config/environment');var attributes=require(_0xaaf1('0x6'));module['exports']=function(_0xe6ead6,_0x12f40a){return _0xe6ead6[_0xaaf1('0x7')](_0xaaf1('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xaaf1('0x9'),_0xaaf1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 62468e2..8b983c0 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 _0xd5b8=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xd5b8,0x150));var _0x8d5b=function(_0x43d244,_0xbf6cab){_0x43d244=_0x43d244-0x0;var _0x1cf8be=_0xd5b8[_0x43d244];return _0x1cf8be;};'use strict';var _=require(_0x8d5b('0x0'));var util=require(_0x8d5b('0x1'));var moment=require(_0x8d5b('0x2'));var BPromise=require('bluebird');var rs=require(_0x8d5b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d5b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d5b('0x5'))(_0x8d5b('0x6'));var config=require(_0x8d5b('0x7'));var jayson=require(_0x8d5b('0x8'));var client=jayson[_0x8d5b('0x9')][_0x8d5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x140866,_0x285f5e,_0x38a751){return new BPromise(function(_0x252ea6,_0x38179a){return client[_0x8d5b('0xb')](_0x140866,_0x38a751)[_0x8d5b('0xc')](function(_0x293b2f){logger[_0x8d5b('0xd')](_0x8d5b('0xe'),_0x285f5e,'request\x20sent');logger[_0x8d5b('0xf')](_0x8d5b('0x10'),_0x285f5e,_0x8d5b('0x11'),JSON[_0x8d5b('0x12')](_0x293b2f));if(_0x293b2f[_0x8d5b('0x13')]){if(_0x293b2f[_0x8d5b('0x13')][_0x8d5b('0x14')]===0x1f4){logger['error'](_0x8d5b('0xe'),_0x285f5e,_0x293b2f[_0x8d5b('0x13')][_0x8d5b('0x15')]);return _0x38179a(_0x293b2f['error'][_0x8d5b('0x15')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x285f5e,_0x293b2f[_0x8d5b('0x13')][_0x8d5b('0x15')]);return _0x252ea6(_0x293b2f[_0x8d5b('0x13')][_0x8d5b('0x15')]);}else{logger[_0x8d5b('0xd')](_0x8d5b('0xe'),_0x285f5e,_0x8d5b('0x11'));_0x252ea6(_0x293b2f[_0x8d5b('0x16')][_0x8d5b('0x15')]);}})[_0x8d5b('0x17')](function(_0x4dcaf0){logger[_0x8d5b('0x13')](_0x8d5b('0xe'),_0x285f5e,_0x4dcaf0);_0x38179a(_0x4dcaf0);});});} \ No newline at end of file +var _0x72d7=['message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x75eccc,_0x4c2958){var _0x3ac04b=function(_0x271b34){while(--_0x271b34){_0x75eccc['push'](_0x75eccc['shift']());}};_0x3ac04b(++_0x4c2958);}(_0x72d7,0x129));var _0x772d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x72d7[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x772d('0x0'));var BPromise=require(_0x772d('0x1'));var rs=require(_0x772d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x772d('0x3'))['db'];var utils=require(_0x772d('0x4'));var logger=require(_0x772d('0x5'))(_0x772d('0x6'));var config=require(_0x772d('0x7'));var jayson=require(_0x772d('0x8'));var client=jayson[_0x772d('0x9')][_0x772d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x115a88,_0x371ee0,_0x379157){return new BPromise(function(_0x492da9,_0x5f4f47){return client['request'](_0x115a88,_0x379157)[_0x772d('0xb')](function(_0x397f2b){logger[_0x772d('0xc')](_0x772d('0xd'),_0x371ee0,_0x772d('0xe'));logger[_0x772d('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x371ee0,_0x772d('0xe'),JSON['stringify'](_0x397f2b));if(_0x397f2b[_0x772d('0x10')]){if(_0x397f2b['error'][_0x772d('0x11')]===0x1f4){logger[_0x772d('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x371ee0,_0x397f2b['error'][_0x772d('0x12')]);return _0x5f4f47(_0x397f2b['error'][_0x772d('0x12')]);}logger['error'](_0x772d('0xd'),_0x371ee0,_0x397f2b['error'][_0x772d('0x12')]);return _0x492da9(_0x397f2b['error'][_0x772d('0x12')]);}else{logger['info'](_0x772d('0xd'),_0x371ee0,'request\x20sent');_0x492da9(_0x397f2b[_0x772d('0x13')][_0x772d('0x12')]);}})[_0x772d('0x14')](function(_0x1b1102){logger[_0x772d('0x10')](_0x772d('0xd'),_0x371ee0,_0x1b1102);_0x5f4f47(_0x1b1102);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2dc6295..1234400 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x488f63,_0x2501d6){var _0x41b42c=function(_0x4df3f4){while(--_0x4df3f4){_0x488f63['push'](_0x488f63['shift']());}};_0x41b42c(++_0x2501d6);}(_0xedd9,0xfc));var _0x9edd=function(_0x461930,_0x329a2a){_0x461930=_0x461930-0x0;var _0x382394=_0xedd9[_0x461930];return _0x382394;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1dff39,_0x1cf83c){var _0x18bc86=function(_0x4971cb){while(--_0x4971cb){_0x1dff39['push'](_0x1dff39['shift']());}};_0x18bc86(++_0x1cf83c);}(_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 diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 9aca7e1..4cb9e72 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 _0x8f20=['sequelize'];(function(_0x1a943c,_0x332a13){var _0x5c76a0=function(_0x587273){while(--_0x587273){_0x1a943c['push'](_0x1a943c['shift']());}};_0x5c76a0(++_0x332a13);}(_0x8f20,0x175));var _0x08f2=function(_0x67b075,_0x43557d){_0x67b075=_0x67b075-0x0;var _0x39d030=_0x8f20[_0x67b075];return _0x39d030;};'use strict';var Sequelize=require(_0x08f2('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb6a8=['exports','INTEGER','sequelize'];(function(_0x25bc3d,_0x19ad33){var _0x3c5aa9=function(_0x3c89f3){while(--_0x3c89f3){_0x25bc3d['push'](_0x25bc3d['shift']());}};_0x3c5aa9(++_0x19ad33);}(_0xb6a8,0xc8));var _0x8b6a=function(_0x57bdd4,_0x1127dc){_0x57bdd4=_0x57bdd4-0x0;var _0x57d31f=_0xb6a8[_0x57bdd4];return _0x57d31f;};'use strict';var Sequelize=require(_0x8b6a('0x0'));module[_0x8b6a('0x1')]={'penalty':{'type':Sequelize[_0x8b6a('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 0f7176c..c5b3917 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 _0x6b1b=['path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2822b3,_0x49842b){var _0x4b9178=function(_0x265ccd){while(--_0x265ccd){_0x2822b3['push'](_0x2822b3['shift']());}};_0x4b9178(++_0x49842b);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x6b1b[_0x1cfa0d];return _0xe33279;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var logger=require(_0xb6b1('0x1'))(_0xb6b1('0x2'));var moment=require('moment');var BPromise=require(_0xb6b1('0x3'));var rp=require(_0xb6b1('0x4'));var fs=require('fs');var path=require(_0xb6b1('0x5'));var rimraf=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var attributes=require(_0xb6b1('0x8'));module[_0xb6b1('0x9')]=function(_0x113a39,_0x1ff716){return _0x113a39[_0xb6b1('0xa')](_0xb6b1('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf072=['path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','request-promise'];(function(_0x4d9d8f,_0x29041c){var _0x2e14b4=function(_0x205ed7){while(--_0x205ed7){_0x4d9d8f['push'](_0x4d9d8f['shift']());}};_0x2e14b4(++_0x29041c);}(_0xf072,0x1cf));var _0x2f07=function(_0x8bbacf,_0x561127){_0x8bbacf=_0x8bbacf-0x0;var _0x505736=_0xf072[_0x8bbacf];return _0x505736;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var logger=require(_0x2f07('0x2'))('api');var moment=require(_0x2f07('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f07('0x4'));var fs=require('fs');var path=require(_0x2f07('0x5'));var rimraf=require(_0x2f07('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f07('0x7'));module[_0x2f07('0x8')]=function(_0x3643bb,_0x2e6422){return _0x3643bb[_0x2f07('0x9')](_0x2f07('0xa'),attributes,{'tableName':_0x2f07('0xb'),'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 142aca2..5035829 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 _0x74b4=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x52da21,_0x242123){var _0x12cb79=function(_0xb7f988){while(--_0xb7f988){_0x52da21['push'](_0x52da21['shift']());}};_0x12cb79(++_0x242123);}(_0x74b4,0x1a2));var _0x474b=function(_0x231420,_0x19ebdd){_0x231420=_0x231420-0x0;var _0x31678c=_0x74b4[_0x231420];return _0x31678c;};'use strict';var _=require(_0x474b('0x0'));var util=require(_0x474b('0x1'));var moment=require('moment');var BPromise=require(_0x474b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x474b('0x3'));var db=require(_0x474b('0x4'))['db'];var utils=require(_0x474b('0x5'));var logger=require(_0x474b('0x6'))(_0x474b('0x7'));var config=require(_0x474b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x474b('0x9')][_0x474b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b7b7f,_0x31ceae,_0x28b006){return new BPromise(function(_0x5e43f3,_0x2c7a8e){return client[_0x474b('0xb')](_0x3b7b7f,_0x28b006)['then'](function(_0x55360b){logger[_0x474b('0xc')](_0x474b('0xd'),_0x31ceae,_0x474b('0xe'));logger[_0x474b('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x31ceae,_0x474b('0xe'),JSON[_0x474b('0x10')](_0x55360b));if(_0x55360b[_0x474b('0x11')]){if(_0x55360b[_0x474b('0x11')][_0x474b('0x12')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x31ceae,_0x55360b[_0x474b('0x11')]['message']);return _0x2c7a8e(_0x55360b['error'][_0x474b('0x13')]);}logger[_0x474b('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x31ceae,_0x55360b[_0x474b('0x11')][_0x474b('0x13')]);return _0x5e43f3(_0x55360b[_0x474b('0x11')][_0x474b('0x13')]);}else{logger[_0x474b('0xc')](_0x474b('0xd'),_0x31ceae,_0x474b('0xe'));_0x5e43f3(_0x55360b[_0x474b('0x14')][_0x474b('0x13')]);}})[_0x474b('0x15')](function(_0x38f02d){logger[_0x474b('0x11')](_0x474b('0xd'),_0x31ceae,_0x38f02d);_0x2c7a8e(_0x38f02d);});});} \ No newline at end of file +var _0x8f87=['catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../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','code','message','result'];(function(_0x202836,_0x507ef8){var _0x478dd4=function(_0x288b61){while(--_0x288b61){_0x202836['push'](_0x202836['shift']());}};_0x478dd4(++_0x507ef8);}(_0x8f87,0xfe));var _0x78f8=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0x8f87[_0x2dbce7];return _0x3a3ed0;};'use strict';var _=require(_0x78f8('0x0'));var util=require(_0x78f8('0x1'));var moment=require(_0x78f8('0x2'));var BPromise=require(_0x78f8('0x3'));var rs=require(_0x78f8('0x4'));var fs=require('fs');var Redis=require(_0x78f8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x78f8('0x6'));var config=require(_0x78f8('0x7'));var jayson=require(_0x78f8('0x8'));var client=jayson['client'][_0x78f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c7fb5,_0xcd247a,_0x442c6c){return new BPromise(function(_0x4e17d9,_0x3440ea){return client[_0x78f8('0xa')](_0x3c7fb5,_0x442c6c)[_0x78f8('0xb')](function(_0x188933){logger[_0x78f8('0xc')](_0x78f8('0xd'),_0xcd247a,_0x78f8('0xe'));logger[_0x78f8('0xf')](_0x78f8('0x10'),_0xcd247a,'request\x20sent',JSON[_0x78f8('0x11')](_0x188933));if(_0x188933[_0x78f8('0x12')]){if(_0x188933[_0x78f8('0x12')][_0x78f8('0x13')]===0x1f4){logger[_0x78f8('0x12')](_0x78f8('0xd'),_0xcd247a,_0x188933[_0x78f8('0x12')]['message']);return _0x3440ea(_0x188933[_0x78f8('0x12')][_0x78f8('0x14')]);}logger[_0x78f8('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0xcd247a,_0x188933['error'][_0x78f8('0x14')]);return _0x4e17d9(_0x188933[_0x78f8('0x12')]['message']);}else{logger[_0x78f8('0xc')](_0x78f8('0xd'),_0xcd247a,_0x78f8('0xe'));_0x4e17d9(_0x188933[_0x78f8('0x15')]['message']);}})[_0x78f8('0x16')](function(_0x1c5468){logger[_0x78f8('0x12')](_0x78f8('0xd'),_0xcd247a,_0x1c5468);_0x3440ea(_0x1c5468);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 8172a77..95fbe74 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 _0xc52d=['INTEGER','sequelize'];(function(_0x2d69e1,_0x43f881){var _0x9b5140=function(_0x374b86){while(--_0x374b86){_0x2d69e1['push'](_0x2d69e1['shift']());}};_0x9b5140(++_0x43f881);}(_0xc52d,0x1ed));var _0xdc52=function(_0x547637,_0xfe4b95){_0x547637=_0x547637-0x0;var _0x346984=_0xc52d[_0x547637];return _0x346984;};'use strict';var Sequelize=require(_0xdc52('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xdc52('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xdc52('0x1')]}}; \ No newline at end of file +var _0x5e9f=['exports','INTEGER'];(function(_0x1fe528,_0x236458){var _0x4d2958=function(_0x29f2d4){while(--_0x29f2d4){_0x1fe528['push'](_0x1fe528['shift']());}};_0x4d2958(++_0x236458);}(_0x5e9f,0xac));var _0xf5e9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5e9f[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0xf5e9('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xf5e9('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index dbd4fc5..e55dfed 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(_0x2cea85,_0x4c03be){var _0x30f32b=function(_0x5ca766){while(--_0x5ca766){_0x2cea85['push'](_0x2cea85['shift']());}};_0x30f32b(++_0x4c03be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3cc29e,_0x31243b){var _0x19b128=function(_0x2424bc){while(--_0x2424bc){_0x3cc29e['push'](_0x3cc29e['shift']());}};_0x19b128(++_0x31243b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 5dcd281..956b708 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x9ed7da,_0x2a00cf){var _0x405471=function(_0x563f0c){while(--_0x563f0c){_0x9ed7da['push'](_0x9ed7da['shift']());}};_0x405471(++_0x2a00cf);}(_0xedd9,0xfc));var _0x9edd=function(_0x149bd7,_0x2d152d){_0x149bd7=_0x149bd7-0x0;var _0x1c4c63=_0xedd9[_0x149bd7];return _0x1c4c63;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1df9f9,_0x5e70b4){var _0x2fe038=function(_0xe1763a){while(--_0xe1763a){_0x1df9f9['push'](_0x1df9f9['shift']());}};_0x2fe038(++_0x5e70b4);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 9cf9c8e..dbf51f3 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 _0x074c=['exports','sequelize'];(function(_0x161baa,_0x410794){var _0x5920d9=function(_0x198e06){while(--_0x198e06){_0x161baa['push'](_0x161baa['shift']());}};_0x5920d9(++_0x410794);}(_0x074c,0x9b));var _0xc074=function(_0x4654d5,_0x55fdf3){_0x4654d5=_0x4654d5-0x0;var _0x2da3f9=_0x074c[_0x4654d5];return _0x2da3f9;};'use strict';var Sequelize=require(_0xc074('0x0'));module[_0xc074('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcbe2=['sequelize','exports','INTEGER'];(function(_0x36ed6c,_0x5744f1){var _0x46b013=function(_0x112df8){while(--_0x112df8){_0x36ed6c['push'](_0x36ed6c['shift']());}};_0x46b013(++_0x5744f1);}(_0xcbe2,0xc6));var _0x2cbe=function(_0x4ae426,_0x88ac72){_0x4ae426=_0x4ae426-0x0;var _0x39297b=_0xcbe2[_0x4ae426];return _0x39297b;};'use strict';var Sequelize=require(_0x2cbe('0x0'));module[_0x2cbe('0x1')]={'penalty':{'type':Sequelize[_0x2cbe('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index a777a0c..55acef2 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 _0xa251=['bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','api','moment'];(function(_0x1762da,_0x153674){var _0xcf6d82=function(_0x198fc6){while(--_0x198fc6){_0x1762da['push'](_0x1762da['shift']());}};_0xcf6d82(++_0x153674);}(_0xa251,0x99));var _0x1a25=function(_0x137972,_0x36f5ba){_0x137972=_0x137972-0x0;var _0x12447d=_0xa251[_0x137972];return _0x12447d;};'use strict';var _=require('lodash');var util=require(_0x1a25('0x0'));var logger=require('../../config/logger')(_0x1a25('0x1'));var moment=require(_0x1a25('0x2'));var BPromise=require(_0x1a25('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a25('0x4'));var rimraf=require(_0x1a25('0x5'));var config=require(_0x1a25('0x6'));var attributes=require(_0x1a25('0x7'));module[_0x1a25('0x8')]=function(_0x242f38,_0x21f43c){return _0x242f38[_0x1a25('0x9')](_0x1a25('0xa'),attributes,{'tableName':_0x1a25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6416=['../../config/environment','exports','define','user_has_voice_queues','lodash','api','moment','rimraf'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x6416,0x94));var _0x6641=function(_0x5c86e4,_0x2869e3){_0x5c86e4=_0x5c86e4-0x0;var _0x16bcdf=_0x6416[_0x5c86e4];return _0x16bcdf;};'use strict';var _=require(_0x6641('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6641('0x1'));var moment=require(_0x6641('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6641('0x3'));var config=require(_0x6641('0x4'));var attributes=require('./userVoiceQueue.attributes');module[_0x6641('0x5')]=function(_0x12bec2,_0xdfc5de){return _0x12bec2[_0x6641('0x6')]('UserVoiceQueue',attributes,{'tableName':_0x6641('0x7'),'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 2297fe4..3c22a7b 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 _0xb81e=['../../config/logger','rpc','../../config/environment','client','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb81e,0x94));var _0xeb81=function(_0x42931b,_0x527b9e){_0x42931b=_0x42931b-0x0;var _0x3c0ad7=_0xb81e[_0x42931b];return _0x3c0ad7;};'use strict';var _=require(_0xeb81('0x0'));var util=require(_0xeb81('0x1'));var moment=require(_0xeb81('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb81('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb81('0x4'))(_0xeb81('0x5'));var config=require(_0xeb81('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xeb81('0x7')][_0xeb81('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9eb48c,_0x487368,_0x4df85c){return new BPromise(function(_0x23e61d,_0x448d4c){return client['request'](_0x9eb48c,_0x4df85c)['then'](function(_0x5b569f){logger[_0xeb81('0x9')](_0xeb81('0xa'),_0x487368,_0xeb81('0xb'));logger[_0xeb81('0xc')](_0xeb81('0xd'),_0x487368,_0xeb81('0xb'),JSON['stringify'](_0x5b569f));if(_0x5b569f[_0xeb81('0xe')]){if(_0x5b569f[_0xeb81('0xe')][_0xeb81('0xf')]===0x1f4){logger[_0xeb81('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x487368,_0x5b569f[_0xeb81('0xe')][_0xeb81('0x10')]);return _0x448d4c(_0x5b569f[_0xeb81('0xe')][_0xeb81('0x10')]);}logger[_0xeb81('0xe')](_0xeb81('0xa'),_0x487368,_0x5b569f['error'][_0xeb81('0x10')]);return _0x23e61d(_0x5b569f[_0xeb81('0xe')][_0xeb81('0x10')]);}else{logger[_0xeb81('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x487368,_0xeb81('0xb'));_0x23e61d(_0x5b569f[_0xeb81('0x11')]['message']);}})[_0xeb81('0x12')](function(_0xa95ac4){logger[_0xeb81('0xe')](_0xeb81('0xa'),_0x487368,_0xa95ac4);_0x448d4c(_0xa95ac4);});});} \ No newline at end of file +var _0x9cd1=['stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1b01c6,_0x16cce2){var _0x30221b=function(_0x438a18){while(--_0x438a18){_0x1b01c6['push'](_0x1b01c6['shift']());}};_0x30221b(++_0x16cce2);}(_0x9cd1,0x132));var _0x19cd=function(_0x3a8ba0,_0x24ebe4){_0x3a8ba0=_0x3a8ba0-0x0;var _0x334f86=_0x9cd1[_0x3a8ba0];return _0x334f86;};'use strict';var _=require('lodash');var util=require(_0x19cd('0x0'));var moment=require('moment');var BPromise=require(_0x19cd('0x1'));var rs=require(_0x19cd('0x2'));var fs=require('fs');var Redis=require(_0x19cd('0x3'));var db=require(_0x19cd('0x4'))['db'];var utils=require(_0x19cd('0x5'));var logger=require(_0x19cd('0x6'))(_0x19cd('0x7'));var config=require(_0x19cd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x19cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31c17b,_0x2d4393,_0x25bde5){return new BPromise(function(_0x556189,_0x12736b){return client['request'](_0x31c17b,_0x25bde5)['then'](function(_0x382c1a){logger[_0x19cd('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x2d4393,'request\x20sent');logger[_0x19cd('0xb')](_0x19cd('0xc'),_0x2d4393,_0x19cd('0xd'),JSON[_0x19cd('0xe')](_0x382c1a));if(_0x382c1a[_0x19cd('0xf')]){if(_0x382c1a[_0x19cd('0xf')][_0x19cd('0x10')]===0x1f4){logger[_0x19cd('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x2d4393,_0x382c1a[_0x19cd('0xf')]['message']);return _0x12736b(_0x382c1a['error'][_0x19cd('0x11')]);}logger[_0x19cd('0xf')](_0x19cd('0x12'),_0x2d4393,_0x382c1a[_0x19cd('0xf')][_0x19cd('0x11')]);return _0x556189(_0x382c1a[_0x19cd('0xf')][_0x19cd('0x11')]);}else{logger[_0x19cd('0xa')](_0x19cd('0x12'),_0x2d4393,_0x19cd('0xd'));_0x556189(_0x382c1a['result'][_0x19cd('0x11')]);}})[_0x19cd('0x13')](function(_0x4464cb){logger['error'](_0x19cd('0x12'),_0x2d4393,_0x4464cb);_0x12736b(_0x4464cb);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 950e70f..b6dd4cc 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x26ac6b,_0x3e0e21){var _0x1972ec=function(_0x1703da){while(--_0x1703da){_0x26ac6b['push'](_0x26ac6b['shift']());}};_0x1972ec(++_0x3e0e21);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x49a766,_0x1eb3ee){var _0x5dd565=function(_0x4e7087){while(--_0x4e7087){_0x49a766['push'](_0x49a766['shift']());}};_0x5dd565(++_0x1eb3ee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0xcb91[_0xa79977];return _0x109f10;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 184b5af..1a3ebae 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 _0x6f01=['sequelize','INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface'];(function(_0x14f494,_0x16aaa8){var _0x4d58dc=function(_0x291f13){while(--_0x291f13){_0x14f494['push'](_0x14f494['shift']());}};_0x4d58dc(++_0x16aaa8);}(_0x6f01,0x122));var _0x16f0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6f01[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x16f0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x16f0('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x16f0('0x2')],'allowNull':![],'comment':_0x16f0('0x3')},'UserId':{'type':Sequelize[_0x16f0('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x16f0('0x3')},'VoiceQueueId':{'type':Sequelize[_0x16f0('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x16f0('0x4'),'comment':_0x16f0('0x3')},'penalty':{'type':Sequelize[_0x16f0('0x1')](0xb),'defaultValue':0x0,'comment':_0x16f0('0x3')},'paused':{'type':Sequelize[_0x16f0('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x553f=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x553f,0x1c2));var _0xf553=function(_0x405667,_0x24afc4){_0x405667=_0x405667-0x0;var _0x437b8c=_0x553f[_0x405667];return _0x437b8c;};'use strict';var Sequelize=require(_0xf553('0x0'));module[_0xf553('0x1')]={'uniqueid':{'type':Sequelize[_0xf553('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf553('0x3')},'membername':{'type':Sequelize[_0xf553('0x4')],'allowNull':![],'comment':_0xf553('0x3')},'UserId':{'type':Sequelize[_0xf553('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf553('0x4')],'allowNull':![],'unique':_0xf553('0x5'),'comment':_0xf553('0x3')},'VoiceQueueId':{'type':Sequelize[_0xf553('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xf553('0x4')],'allowNull':![],'unique':_0xf553('0x5'),'comment':_0xf553('0x3')},'penalty':{'type':Sequelize[_0xf553('0x2')](0xb),'defaultValue':0x0,'comment':_0xf553('0x3')},'paused':{'type':Sequelize[_0xf553('0x2')](0xb),'defaultValue':0x0,'comment':_0xf553('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index c2a882c..4ee8481 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 _0xfd07=['save','update','remove','emit','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x44a5c7,_0x20cfef){var _0x183951=function(_0x1c5e31){while(--_0x1c5e31){_0x44a5c7['push'](_0x44a5c7['shift']());}};_0x183951(++_0x20cfef);}(_0xfd07,0x16d));var _0x7fd0=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0xfd07[_0x55c3d9];return _0x19fd97;};'use strict';var EventEmitter=require(_0x7fd0('0x0'));var UserVoiceQueueRt=require(_0x7fd0('0x1'))['db'][_0x7fd0('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7fd0('0x3')](0x0);var events={'afterCreate':_0x7fd0('0x4'),'afterUpdate':_0x7fd0('0x5'),'afterDestroy':_0x7fd0('0x6')};function emitEvent(_0x4dca03){return function(_0x5ec751,_0x17097b,_0xb472f0){UserVoiceQueueRtEvents[_0x7fd0('0x7')](_0x4dca03+':'+_0x5ec751['id'],_0x5ec751);UserVoiceQueueRtEvents[_0x7fd0('0x7')](_0x4dca03,_0x5ec751);_0xb472f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x7fd0('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x82db=['remove','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x287ed0,_0x1bc2f5){var _0x58061a=function(_0x3dd875){while(--_0x3dd875){_0x287ed0['push'](_0x287ed0['shift']());}};_0x58061a(++_0x1bc2f5);}(_0x82db,0x1bb));var _0xb82d=function(_0x331062,_0x2e37c7){_0x331062=_0x331062-0x0;var _0x587038=_0x82db[_0x331062];return _0x587038;};'use strict';var EventEmitter=require(_0xb82d('0x0'));var UserVoiceQueueRt=require(_0xb82d('0x1'))['db'][_0xb82d('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb82d('0x3')](0x0);var events={'afterCreate':_0xb82d('0x4'),'afterUpdate':'update','afterDestroy':_0xb82d('0x5')};function emitEvent(_0x2af5ce){return function(_0x551041,_0x3d0cf5,_0x505e8a){UserVoiceQueueRtEvents['emit'](_0x2af5ce+':'+_0x551041['id'],_0x551041);UserVoiceQueueRtEvents['emit'](_0x2af5ce,_0x551041);_0x505e8a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xb82d('0x6')](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 a343895..a3c7f01 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 _0xfa4c=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes'];(function(_0x24ad21,_0x2abaab){var _0x232631=function(_0x5606ef){while(--_0x5606ef){_0x24ad21['push'](_0x24ad21['shift']());}};_0x232631(++_0x2abaab);}(_0xfa4c,0xc4));var _0xcfa4=function(_0x312d9c,_0x4b5785){_0x312d9c=_0x312d9c-0x0;var _0x33e51e=_0xfa4c[_0x312d9c];return _0x33e51e;};'use strict';var _=require(_0xcfa4('0x0'));var util=require(_0xcfa4('0x1'));var logger=require('../../config/logger')(_0xcfa4('0x2'));var moment=require('moment');var BPromise=require(_0xcfa4('0x3'));var rp=require(_0xcfa4('0x4'));var fs=require('fs');var path=require(_0xcfa4('0x5'));var rimraf=require(_0xcfa4('0x6'));var config=require('../../config/environment');var attributes=require(_0xcfa4('0x7'));module[_0xcfa4('0x8')]=function(_0x296b3d,_0x4f09b1){return _0x296b3d[_0xcfa4('0x9')](_0xcfa4('0xa'),attributes,{'tableName':_0xcfa4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4eaa=['bluebird','request-promise','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','api','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4eaa,0x93));var _0xa4ea=function(_0x252284,_0x24b471){_0x252284=_0x252284-0x0;var _0x4dea61=_0x4eaa[_0x252284];return _0x4dea61;};'use strict';var _=require(_0xa4ea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa4ea('0x1'));var moment=require(_0xa4ea('0x2'));var BPromise=require(_0xa4ea('0x3'));var rp=require(_0xa4ea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa4ea('0x5'));module[_0xa4ea('0x6')]=function(_0x51ca68,_0x1bb8a5){return _0x51ca68[_0xa4ea('0x7')](_0xa4ea('0x8'),attributes,{'tableName':_0xa4ea('0x9'),'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 a0fab37..4934744 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 _0x3642=['stringify','error','code','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','COUNT','sequelize','literal','outboundQueuePauses','catch','lodash','util','moment','bluebird','../../config/utils','rpc','redis','defaults','localhost','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3642,0x193));var _0x2364=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x3642[_0x525b28];return _0x180178;};'use strict';var _=require(_0x2364('0x0'));var util=require(_0x2364('0x1'));var moment=require(_0x2364('0x2'));var BPromise=require(_0x2364('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2364('0x4'));var logger=require('../../config/logger')(_0x2364('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2364('0x6')]=_[_0x2364('0x7')](config[_0x2364('0x6')],{'host':_0x2364('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2364('0x6')]));require('./userVoiceQueueRt.socket')[_0x2364('0x9')](socket);function respondWithRpcPromise(_0x102466,_0x5927a0,_0x2fcfbf){return new BPromise(function(_0x2acd50,_0x5d0e4c){return client[_0x2364('0xa')](_0x102466,_0x2fcfbf)[_0x2364('0xb')](function(_0xa0f326){logger[_0x2364('0xc')](_0x2364('0xd'),_0x5927a0,_0x2364('0xe'));logger[_0x2364('0xf')](_0x2364('0x10'),_0x5927a0,_0x2364('0xe'),JSON[_0x2364('0x11')](_0xa0f326));if(_0xa0f326[_0x2364('0x12')]){if(_0xa0f326['error'][_0x2364('0x13')]===0x1f4){logger['error'](_0x2364('0xd'),_0x5927a0,_0xa0f326[_0x2364('0x12')][_0x2364('0x14')]);return _0x5d0e4c(_0xa0f326[_0x2364('0x12')][_0x2364('0x14')]);}logger[_0x2364('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5927a0,_0xa0f326[_0x2364('0x12')]['message']);return _0x2acd50(_0xa0f326['error'][_0x2364('0x14')]);}else{logger[_0x2364('0xc')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5927a0,_0x2364('0xe'));_0x2acd50(_0xa0f326['result'][_0x2364('0x14')]);}})['catch'](function(_0x2a10ea){logger[_0x2364('0x12')](_0x2364('0xd'),_0x5927a0,_0x2a10ea);_0x5d0e4c(_0x2a10ea);});});}exports[_0x2364('0x15')]=function(_0x2145e9){var _0x12f230=this;return new Promise(function(_0x1c6c5f,_0x5d918d){return db[_0x2364('0x16')][_0x2364('0x17')]({'raw':_0x2145e9[_0x2364('0x18')]?_0x2145e9[_0x2364('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2145e9['options']?_0x2145e9[_0x2364('0x18')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x2364('0x19'),db[_0x2364('0x1a')]['fn']('IF',db['sequelize'][_0x2364('0x1b')]('`paused`\x20=\x201,\x201,\x20null'))),_0x2364('0x1c')]]})[_0x2364('0xb')](function(_0x27cf0d){logger[_0x2364('0xc')]('GetVoiceQueueRtPauses',_0x2145e9);logger[_0x2364('0xf')](_0x2364('0x15'),_0x2145e9,JSON[_0x2364('0x11')](_0x27cf0d));_0x1c6c5f(_0x27cf0d);})[_0x2364('0x1d')](function(_0x38bba1){logger[_0x2364('0x12')](_0x2364('0x15'),_0x38bba1[_0x2364('0x14')],_0x2145e9);_0x5d918d(_0x12f230[_0x2364('0x12')](0x1f4,_0x38bba1[_0x2364('0x14')]));});});}; \ No newline at end of file +var _0x4adc=['code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','debug','lodash','bluebird','../../config/logger','rpc','jayson/promise','client','redis','localhost','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x430f44,_0x4ae21b){var _0x1f6b0f=function(_0x35968f){while(--_0x35968f){_0x430f44['push'](_0x430f44['shift']());}};_0x1f6b0f(++_0x4ae21b);}(_0x4adc,0x150));var _0xc4ad=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x4adc[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xc4ad('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc4ad('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc4ad('0x2'))(_0xc4ad('0x3'));var config=require('../../config/environment');var jayson=require(_0xc4ad('0x4'));var client=jayson[_0xc4ad('0x5')]['http']({'port':0x232a});config[_0xc4ad('0x6')]=_['defaults'](config[_0xc4ad('0x6')],{'host':_0xc4ad('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4ad('0x6')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x243db9,_0x15664d,_0x67f301){return new BPromise(function(_0x39b59f,_0x3720aa){return client[_0xc4ad('0x8')](_0x243db9,_0x67f301)[_0xc4ad('0x9')](function(_0x1b9e33){logger[_0xc4ad('0xa')](_0xc4ad('0xb'),_0x15664d,'request\x20sent');logger['debug'](_0xc4ad('0xc'),_0x15664d,_0xc4ad('0xd'),JSON[_0xc4ad('0xe')](_0x1b9e33));if(_0x1b9e33[_0xc4ad('0xf')]){if(_0x1b9e33['error'][_0xc4ad('0x10')]===0x1f4){logger[_0xc4ad('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x15664d,_0x1b9e33[_0xc4ad('0xf')][_0xc4ad('0x11')]);return _0x3720aa(_0x1b9e33[_0xc4ad('0xf')][_0xc4ad('0x11')]);}logger[_0xc4ad('0xf')](_0xc4ad('0xb'),_0x15664d,_0x1b9e33['error']['message']);return _0x39b59f(_0x1b9e33[_0xc4ad('0xf')][_0xc4ad('0x11')]);}else{logger['info'](_0xc4ad('0xb'),_0x15664d,'request\x20sent');_0x39b59f(_0x1b9e33[_0xc4ad('0x12')]['message']);}})[_0xc4ad('0x13')](function(_0x4fc14c){logger[_0xc4ad('0xf')](_0xc4ad('0xb'),_0x15664d,_0x4fc14c);_0x3720aa(_0x4fc14c);});});}exports['GetVoiceQueueRtPauses']=function(_0x4a848c){var _0x40f010=this;return new Promise(function(_0x16b6c8,_0x5335bf){return db[_0xc4ad('0x14')][_0xc4ad('0x15')]({'raw':_0x4a848c[_0xc4ad('0x16')]?_0x4a848c[_0xc4ad('0x16')][_0xc4ad('0x17')]===undefined?!![]:![]:!![],'where':_0x4a848c[_0xc4ad('0x16')]?_0x4a848c[_0xc4ad('0x16')][_0xc4ad('0x18')]||null:null,'attributes':[[db[_0xc4ad('0x19')]['fn'](_0xc4ad('0x1a'),db[_0xc4ad('0x19')]['fn']('IF',db[_0xc4ad('0x19')][_0xc4ad('0x1b')](_0xc4ad('0x1c')))),_0xc4ad('0x1d')]]})['then'](function(_0x38bdc1){logger[_0xc4ad('0xa')](_0xc4ad('0x1e'),_0x4a848c);logger[_0xc4ad('0x1f')](_0xc4ad('0x1e'),_0x4a848c,JSON['stringify'](_0x38bdc1));_0x16b6c8(_0x38bdc1);})[_0xc4ad('0x13')](function(_0x2ed0d8){logger[_0xc4ad('0xf')](_0xc4ad('0x1e'),_0x2ed0d8['message'],_0x4a848c);_0x5335bf(_0x40f010[_0xc4ad('0xf')](0x1f4,_0x2ed0d8[_0xc4ad('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 039fc5d..a049326 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 _0x9485=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x5538a4,_0xe0b8b0){var _0x530a52=function(_0x1ebe09){while(--_0x1ebe09){_0x5538a4['push'](_0x5538a4['shift']());}};_0x530a52(++_0xe0b8b0);}(_0x9485,0x8b));var _0x5948=function(_0x243921,_0x3eb2fd){_0x243921=_0x243921-0x0;var _0x1021be=_0x9485[_0x243921];return _0x1021be;};'use strict';var UserVoiceQueueRtEvents=require(_0x5948('0x0'));var events=[_0x5948('0x1'),_0x5948('0x2'),_0x5948('0x3')];function createListener(_0x5ca17a,_0x42393d){return function(_0xc057c8){_0x42393d[_0x5948('0x4')](_0x5ca17a,_0xc057c8);};}function removeListener(_0x47b3f3,_0xcfd4b6){return function(){UserVoiceQueueRtEvents[_0x5948('0x5')](_0x47b3f3,_0xcfd4b6);};}exports[_0x5948('0x6')]=function(_0x4312a8){for(var _0x19ccdd=0x0,_0x283a13=events['length'];_0x19ccdd<_0x283a13;_0x19ccdd++){var _0x2cf314=events[_0x19ccdd];var _0x4e7f15=createListener(_0x5948('0x7')+_0x2cf314,_0x4312a8);UserVoiceQueueRtEvents['on'](_0x2cf314,_0x4e7f15);}}; \ No newline at end of file +var _0x038b=['removeListener','register','length','save','remove','update','emit'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x038b,0x114));var _0xb038=function(_0x4204bf,_0x10ab69){_0x4204bf=_0x4204bf-0x0;var _0x350077=_0x038b[_0x4204bf];return _0x350077;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb038('0x0'),_0xb038('0x1'),_0xb038('0x2')];function createListener(_0x5623c3,_0x3d7dfe){return function(_0x5ed31a){_0x3d7dfe[_0xb038('0x3')](_0x5623c3,_0x5ed31a);};}function removeListener(_0x3d090b,_0x4a8a30){return function(){UserVoiceQueueRtEvents[_0xb038('0x4')](_0x3d090b,_0x4a8a30);};}exports[_0xb038('0x5')]=function(_0x4fe092){for(var _0x54e1e7=0x0,_0x2e3e64=events[_0xb038('0x6')];_0x54e1e7<_0x2e3e64;_0x54e1e7++){var _0x1534a9=events[_0x54e1e7];var _0x4b4085=createListener('userVoiceQueueRt:'+_0x1534a9,_0x4fe092);UserVoiceQueueRtEvents['on'](_0x1534a9,_0x4b4085);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 4766f64..db1949e 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x40ce07,_0x2d9283){var _0x2493a0=function(_0x3351cd){while(--_0x3351cd){_0x40ce07['push'](_0x40ce07['shift']());}};_0x2493a0(++_0x2d9283);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5eca9f,_0x1d15d3){var _0x53a05c=function(_0x10bacd){while(--_0x10bacd){_0x5eca9f['push'](_0x5eca9f['shift']());}};_0x53a05c(++_0x1d15d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index d1d9db6..b00c93b 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 _0xb7ed=['INTEGER','sequelize'];(function(_0x46f136,_0xd5d93e){var _0x3867aa=function(_0x593a32){while(--_0x593a32){_0x46f136['push'](_0x46f136['shift']());}};_0x3867aa(++_0xd5d93e);}(_0xb7ed,0x1e7));var _0xdb7e=function(_0x462582,_0x279982){_0x462582=_0x462582-0x0;var _0x176aac=_0xb7ed[_0x462582];return _0x176aac;};'use strict';var Sequelize=require(_0xdb7e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xdb7e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x50a5=['exports','INTEGER','sequelize'];(function(_0x19a67e,_0x25b25e){var _0x221ee7=function(_0x36da39){while(--_0x36da39){_0x19a67e['push'](_0x19a67e['shift']());}};_0x221ee7(++_0x25b25e);}(_0x50a5,0x1e8));var _0x550a=function(_0x4685fa,_0x54abce){_0x4685fa=_0x4685fa-0x0;var _0x431e25=_0x50a5[_0x4685fa];return _0x431e25;};'use strict';var Sequelize=require(_0x550a('0x0'));module[_0x550a('0x1')]={'penalty':{'type':Sequelize[_0x550a('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 d27a809..449dfe7 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 _0xa6ed=['../../config/logger','api','moment','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util'];(function(_0x449002,_0x261478){var _0x48a924=function(_0x5c9552){while(--_0x5c9552){_0x449002['push'](_0x449002['shift']());}};_0x48a924(++_0x261478);}(_0xa6ed,0xee));var _0xda6e=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xa6ed[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xda6e('0x0'));var util=require(_0xda6e('0x1'));var logger=require(_0xda6e('0x2'))(_0xda6e('0x3'));var moment=require(_0xda6e('0x4'));var BPromise=require('bluebird');var rp=require(_0xda6e('0x5'));var fs=require('fs');var path=require(_0xda6e('0x6'));var rimraf=require(_0xda6e('0x7'));var config=require('../../config/environment');var attributes=require(_0xda6e('0x8'));module[_0xda6e('0x9')]=function(_0x5ec015,_0x3ac048){return _0x5ec015[_0xda6e('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0xda6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2db=['rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','bluebird'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xc2db,0x9c));var _0xbc2d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xc2db[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xbc2d('0x0'));var util=require(_0xbc2d('0x1'));var logger=require('../../config/logger')(_0xbc2d('0x2'));var moment=require('moment');var BPromise=require(_0xbc2d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc2d('0x4'));var config=require(_0xbc2d('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0xbc2d('0x6')]=function(_0x128a57,_0x5db098){return _0x128a57[_0xbc2d('0x7')](_0xbc2d('0x8'),attributes,{'tableName':_0xbc2d('0x9'),'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 9661268..d07d213 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 _0xbb22=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug'];(function(_0x2d0047,_0x409031){var _0x45d698=function(_0x721038){while(--_0x721038){_0x2d0047['push'](_0x2d0047['shift']());}};_0x45d698(++_0x409031);}(_0xbb22,0x1d3));var _0x2bb2=function(_0x308fd7,_0x5cf599){_0x308fd7=_0x308fd7-0x0;var _0x5d5509=_0xbb22[_0x308fd7];return _0x5d5509;};'use strict';var _=require(_0x2bb2('0x0'));var util=require('util');var moment=require(_0x2bb2('0x1'));var BPromise=require('bluebird');var rs=require(_0x2bb2('0x2'));var fs=require('fs');var Redis=require(_0x2bb2('0x3'));var db=require(_0x2bb2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2bb2('0x5'))(_0x2bb2('0x6'));var config=require(_0x2bb2('0x7'));var jayson=require(_0x2bb2('0x8'));var client=jayson[_0x2bb2('0x9')][_0x2bb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9bebf1,_0x290902,_0x577067){return new BPromise(function(_0x2a8829,_0xaa5746){return client[_0x2bb2('0xb')](_0x9bebf1,_0x577067)[_0x2bb2('0xc')](function(_0x441173){logger[_0x2bb2('0xd')](_0x2bb2('0xe'),_0x290902,'request\x20sent');logger[_0x2bb2('0xf')](_0x2bb2('0x10'),_0x290902,_0x2bb2('0x11'),JSON[_0x2bb2('0x12')](_0x441173));if(_0x441173['error']){if(_0x441173[_0x2bb2('0x13')]['code']===0x1f4){logger[_0x2bb2('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x290902,_0x441173['error'][_0x2bb2('0x14')]);return _0xaa5746(_0x441173['error'][_0x2bb2('0x14')]);}logger[_0x2bb2('0x13')](_0x2bb2('0xe'),_0x290902,_0x441173[_0x2bb2('0x13')][_0x2bb2('0x14')]);return _0x2a8829(_0x441173['error'][_0x2bb2('0x14')]);}else{logger['info'](_0x2bb2('0xe'),_0x290902,'request\x20sent');_0x2a8829(_0x441173[_0x2bb2('0x15')][_0x2bb2('0x14')]);}})[_0x2bb2('0x16')](function(_0x564f04){logger[_0x2bb2('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x290902,_0x564f04);_0xaa5746(_0x564f04);});});} \ No newline at end of file +var _0x77a0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3fe47a,_0x5610b9){var _0x39d23b=function(_0x3c9200){while(--_0x3c9200){_0x3fe47a['push'](_0x3fe47a['shift']());}};_0x39d23b(++_0x5610b9);}(_0x77a0,0x1f0));var _0x077a=function(_0x104662,_0x53a7a7){_0x104662=_0x104662-0x0;var _0x19cba7=_0x77a0[_0x104662];return _0x19cba7;};'use strict';var _=require(_0x077a('0x0'));var util=require(_0x077a('0x1'));var moment=require(_0x077a('0x2'));var BPromise=require(_0x077a('0x3'));var rs=require(_0x077a('0x4'));var fs=require('fs');var Redis=require(_0x077a('0x5'));var db=require(_0x077a('0x6'))['db'];var utils=require(_0x077a('0x7'));var logger=require(_0x077a('0x8'))('rpc');var config=require(_0x077a('0x9'));var jayson=require(_0x077a('0xa'));var client=jayson[_0x077a('0xb')][_0x077a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f9888,_0x5f2451,_0x269a1f){return new BPromise(function(_0x939ba3,_0x4795d1){return client[_0x077a('0xd')](_0x1f9888,_0x269a1f)[_0x077a('0xe')](function(_0x37ab12){logger[_0x077a('0xf')](_0x077a('0x10'),_0x5f2451,_0x077a('0x11'));logger[_0x077a('0x12')](_0x077a('0x13'),_0x5f2451,'request\x20sent',JSON['stringify'](_0x37ab12));if(_0x37ab12[_0x077a('0x14')]){if(_0x37ab12[_0x077a('0x14')][_0x077a('0x15')]===0x1f4){logger[_0x077a('0x14')](_0x077a('0x10'),_0x5f2451,_0x37ab12[_0x077a('0x14')]['message']);return _0x4795d1(_0x37ab12[_0x077a('0x14')][_0x077a('0x16')]);}logger['error'](_0x077a('0x10'),_0x5f2451,_0x37ab12['error'][_0x077a('0x16')]);return _0x939ba3(_0x37ab12['error'][_0x077a('0x16')]);}else{logger[_0x077a('0xf')](_0x077a('0x10'),_0x5f2451,_0x077a('0x11'));_0x939ba3(_0x37ab12[_0x077a('0x17')]['message']);}})[_0x077a('0x18')](function(_0x5028ef){logger['error'](_0x077a('0x10'),_0x5f2451,_0x5028ef);_0x4795d1(_0x5028ef);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 5f689e2..63bfe1a 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 _0xe41f=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','index','/:id','isAuthenticated','show','post','create','delete','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe41f,0x13e));var _0xfe41=function(_0x4a0a20,_0x18ee8f){_0x4a0a20=_0x4a0a20-0x0;var _0x15b15d=_0xe41f[_0x4a0a20];return _0x15b15d;};'use strict';var multer=require(_0xfe41('0x0'));var util=require(_0xfe41('0x1'));var path=require(_0xfe41('0x2'));var timeout=require(_0xfe41('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfe41('0x4'));var interaction=require(_0xfe41('0x5'));var config=require(_0xfe41('0x6'));var controller=require(_0xfe41('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfe41('0x8')]);router['get'](_0xfe41('0x9'),auth[_0xfe41('0xa')](),controller[_0xfe41('0xb')]);router[_0xfe41('0xc')]('/',auth[_0xfe41('0xa')](),controller[_0xfe41('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfe41('0xe')](_0xfe41('0x9'),auth[_0xfe41('0xa')](),controller['destroy']);module[_0xfe41('0xf')]=router; \ No newline at end of file +var _0x22fb=['./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x677920,_0x1e3e6a){var _0x1c593b=function(_0x22e305){while(--_0x22e305){_0x677920['push'](_0x677920['shift']());}};_0x1c593b(++_0x1e3e6a);}(_0x22fb,0x192));var _0xb22f=function(_0x15aa87,_0x2c1a14){_0x15aa87=_0x15aa87-0x0;var _0x54c49f=_0x22fb[_0x15aa87];return _0x54c49f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0xc')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')](_0xb22f('0xa'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xa'),auth[_0xb22f('0x8')](),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 9aef772..f9303fc 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 _0x00ca=['name','sequelize','exports'];(function(_0x5dbaa7,_0x1f6d4a){var _0x481319=function(_0x116e27){while(--_0x116e27){_0x5dbaa7['push'](_0x5dbaa7['shift']());}};_0x481319(++_0x1f6d4a);}(_0x00ca,0x1bd));var _0xa00c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00ca[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa00c('0x0'));module[_0xa00c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa00c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdd04=['exports','STRING','name'];(function(_0x168c70,_0x27868a){var _0x44d8a7=function(_0x408b46){while(--_0x408b46){_0x168c70['push'](_0x168c70['shift']());}};_0x44d8a7(++_0x27868a);}(_0xdd04,0xde));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x4dd0('0x0')]={'name':{'type':Sequelize[_0x4dd0('0x1')],'unique':_0x4dd0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4dd0('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 8ec11ff..2e6225c 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 _0xc5b5=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','get','Variables','then','end','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','key'];(function(_0x1a2743,_0x39a78d){var _0x5a6ebb=function(_0x15f10b){while(--_0x15f10b){_0x1a2743['push'](_0x1a2743['shift']());}};_0x5a6ebb(++_0x39a78d);}(_0xc5b5,0x76));var _0x5c5b=function(_0x452fde,_0x339a5f){_0x452fde=_0x452fde-0x0;var _0x36ecee=_0xc5b5[_0x452fde];return _0x36ecee;};'use strict';var emlformat=require(_0x5c5b('0x0'));var rimraf=require(_0x5c5b('0x1'));var zipdir=require(_0x5c5b('0x2'));var jsonpatch=require(_0x5c5b('0x3'));var rp=require(_0x5c5b('0x4'));var moment=require(_0x5c5b('0x5'));var BPromise=require(_0x5c5b('0x6'));var Mustache=require('mustache');var util=require(_0x5c5b('0x7'));var path=require('path');var sox=require(_0x5c5b('0x8'));var csv=require(_0x5c5b('0x9'));var ejs=require(_0x5c5b('0xa'));var fs=require('fs');var fs_extra=require(_0x5c5b('0xb'));var _=require(_0x5c5b('0xc'));var squel=require(_0x5c5b('0xd'));var crypto=require(_0x5c5b('0xe'));var jsforce=require(_0x5c5b('0xf'));var deskjs=require(_0x5c5b('0x10'));var toCsv=require(_0x5c5b('0x9'));var querystring=require('querystring');var Papa=require(_0x5c5b('0x11'));var Redis=require(_0x5c5b('0x12'));var authService=require(_0x5c5b('0x13'));var qs=require(_0x5c5b('0x14'));var as=require(_0x5c5b('0x15'));var hardwareService=require(_0x5c5b('0x16'));var logger=require('../../config/logger')(_0x5c5b('0x17'));var utils=require(_0x5c5b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5c5b('0x19'));var db=require(_0x5c5b('0x1a'))['db'];function respondWithStatusCode(_0x34f283,_0x3d473d){_0x3d473d=_0x3d473d||0xcc;return function(_0x2bac0b){if(_0x2bac0b){return _0x34f283[_0x5c5b('0x1b')](_0x3d473d);}return _0x34f283[_0x5c5b('0x1c')](_0x3d473d)['end']();};}function respondWithResult(_0x586b62,_0x345b3b){_0x345b3b=_0x345b3b||0xc8;return function(_0xbe9db7){if(_0xbe9db7){return _0x586b62['status'](_0x345b3b)[_0x5c5b('0x1d')](_0xbe9db7);}};}function respondWithFilteredResult(_0x2324ae,_0x430cd0){return function(_0x3d1b62){if(_0x3d1b62){var _0x152865=typeof _0x430cd0[_0x5c5b('0x1e')]==='undefined'&&typeof _0x430cd0[_0x5c5b('0x1f')]===_0x5c5b('0x20');var _0x115f18=_0x3d1b62[_0x5c5b('0x21')];var _0x512554=_0x152865?0x0:_0x430cd0['offset'];var _0x3cf3b0=_0x152865?_0x3d1b62[_0x5c5b('0x21')]:_0x430cd0['offset']+_0x430cd0[_0x5c5b('0x1f')];var _0x1e00b8;if(_0x3cf3b0>=_0x115f18){_0x3cf3b0=_0x115f18;_0x1e00b8=0xc8;}else{_0x1e00b8=0xce;}_0x2324ae[_0x5c5b('0x1c')](_0x1e00b8);return _0x2324ae[_0x5c5b('0x22')]('Content-Range',_0x512554+'-'+_0x3cf3b0+'/'+_0x115f18)['json'](_0x3d1b62);}return null;};}function patchUpdates(_0x54a0bb){return function(_0x5eb813){try{jsonpatch[_0x5c5b('0x23')](_0x5eb813,_0x54a0bb,!![]);}catch(_0x4b5813){return BPromise[_0x5c5b('0x24')](_0x4b5813);}return _0x5eb813[_0x5c5b('0x25')]();};}function saveUpdates(_0x1d16f0,_0x568bad){return function(_0x31d8d9){if(_0x31d8d9){return _0x31d8d9[_0x5c5b('0x26')](_0x1d16f0)['then'](function(_0x3b776e){return _0x3b776e;});}return null;};}function removeEntity(_0x264840,_0x3ed5c7){return function(_0x3ebdad){if(_0x3ebdad){return _0x3ebdad[_0x5c5b('0x27')]()['then'](function(){var _0x39dce9=_0x3ebdad[_0x5c5b('0x28')]({'plain':!![]});var _0x9f047e=_0x5c5b('0x29');return db['UserProfileResource'][_0x5c5b('0x27')]({'where':{'type':_0x9f047e,'resourceId':_0x39dce9['id']}})[_0x5c5b('0x2a')](function(){return _0x3ebdad;});})[_0x5c5b('0x2a')](function(){_0x264840[_0x5c5b('0x1c')](0xcc)[_0x5c5b('0x2b')]();});}};}function handleEntityNotFound(_0x30c6a7,_0x36dd45){return function(_0x557ce9){if(!_0x557ce9){_0x30c6a7[_0x5c5b('0x1b')](0x194);}return _0x557ce9;};}function handleError(_0x3c3a1e,_0x9f620b){_0x9f620b=_0x9f620b||0x1f4;return function(_0x1db10b){logger[_0x5c5b('0x2c')](_0x1db10b[_0x5c5b('0x2d')]);if(_0x1db10b[_0x5c5b('0x2e')]){delete _0x1db10b[_0x5c5b('0x2e')];}_0x3c3a1e[_0x5c5b('0x1c')](_0x9f620b)[_0x5c5b('0x2f')](_0x1db10b);};}exports[_0x5c5b('0x30')]=function(_0x251f13,_0x5ae198){var _0x24a1ef={},_0x1d641f={},_0x435631={'count':0x0,'rows':[]};var _0x4326db=_[_0x5c5b('0x31')](db[_0x5c5b('0x32')][_0x5c5b('0x33')],function(_0x33d8c3){return{'name':_0x33d8c3[_0x5c5b('0x34')],'type':_0x33d8c3['type'][_0x5c5b('0x35')]};});_0x1d641f[_0x5c5b('0x36')]=_[_0x5c5b('0x31')](_0x4326db,_0x5c5b('0x2e'));_0x1d641f[_0x5c5b('0x37')]=_[_0x5c5b('0x38')](_0x251f13[_0x5c5b('0x37')]);_0x1d641f[_0x5c5b('0x39')]=_[_0x5c5b('0x3a')](_0x1d641f[_0x5c5b('0x36')],_0x1d641f['query']);_0x24a1ef[_0x5c5b('0x3b')]=_['intersection'](_0x1d641f[_0x5c5b('0x36')],qs[_0x5c5b('0x3c')](_0x251f13['query'][_0x5c5b('0x3c')]));_0x24a1ef['attributes']=_0x24a1ef[_0x5c5b('0x3b')][_0x5c5b('0x3d')]?_0x24a1ef[_0x5c5b('0x3b')]:_0x1d641f[_0x5c5b('0x36')];if(!_0x251f13[_0x5c5b('0x37')][_0x5c5b('0x3e')]('nolimit')){_0x24a1ef[_0x5c5b('0x1f')]=qs[_0x5c5b('0x1f')](_0x251f13[_0x5c5b('0x37')]['limit']);_0x24a1ef['offset']=qs[_0x5c5b('0x1e')](_0x251f13[_0x5c5b('0x37')][_0x5c5b('0x1e')]);}_0x24a1ef[_0x5c5b('0x3f')]=qs['sort'](_0x251f13[_0x5c5b('0x37')][_0x5c5b('0x40')]);_0x24a1ef[_0x5c5b('0x41')]=qs[_0x5c5b('0x39')](_[_0x5c5b('0x42')](_0x251f13[_0x5c5b('0x37')],_0x1d641f[_0x5c5b('0x39')]),_0x4326db);if(_0x251f13[_0x5c5b('0x37')][_0x5c5b('0x43')]){_0x24a1ef[_0x5c5b('0x41')]=_[_0x5c5b('0x44')](_0x24a1ef[_0x5c5b('0x41')],{'$or':_[_0x5c5b('0x31')](_0x4326db,function(_0x6e94c0){if(_0x6e94c0[_0x5c5b('0x45')]!==_0x5c5b('0x46')){var _0x217810={};_0x217810[_0x6e94c0[_0x5c5b('0x2e')]]={'$like':'%'+_0x251f13[_0x5c5b('0x37')][_0x5c5b('0x43')]+'%'};return _0x217810;}})});}_0x24a1ef=_[_0x5c5b('0x44')]({},_0x24a1ef,_0x251f13[_0x5c5b('0x47')]);var _0x583441={'where':_0x24a1ef['where']};return db['Variable']['count'](_0x583441)['then'](function(_0x199b6f){_0x435631['count']=_0x199b6f;if(_0x251f13['query'][_0x5c5b('0x48')]){_0x24a1ef[_0x5c5b('0x49')]=[{'all':!![]}];}return db['Variable'][_0x5c5b('0x4a')](_0x24a1ef);})[_0x5c5b('0x2a')](function(_0x255336){_0x435631['rows']=_0x255336;return _0x435631;})[_0x5c5b('0x2a')](respondWithFilteredResult(_0x5ae198,_0x24a1ef))['catch'](handleError(_0x5ae198,null));};exports[_0x5c5b('0x4b')]=function(_0x32187a,_0x562d63){var _0x21b1bc={'raw':!![],'where':{'id':_0x32187a[_0x5c5b('0x4c')]['id']}},_0x5f5700={};_0x5f5700[_0x5c5b('0x36')]=_[_0x5c5b('0x38')](db['Variable'][_0x5c5b('0x33')]);_0x5f5700['query']=_['keys'](_0x32187a['query']);_0x5f5700[_0x5c5b('0x39')]=_[_0x5c5b('0x3a')](_0x5f5700['model'],_0x5f5700['query']);_0x21b1bc[_0x5c5b('0x3b')]=_[_0x5c5b('0x3a')](_0x5f5700['model'],qs['fields'](_0x32187a[_0x5c5b('0x37')][_0x5c5b('0x3c')]));_0x21b1bc[_0x5c5b('0x3b')]=_0x21b1bc[_0x5c5b('0x3b')][_0x5c5b('0x3d')]?_0x21b1bc[_0x5c5b('0x3b')]:_0x5f5700[_0x5c5b('0x36')];if(_0x32187a[_0x5c5b('0x37')][_0x5c5b('0x48')]){_0x21b1bc['include']=[{'all':!![]}];}_0x21b1bc=_[_0x5c5b('0x44')]({},_0x21b1bc,_0x32187a[_0x5c5b('0x47')]);return db[_0x5c5b('0x32')][_0x5c5b('0x4d')](_0x21b1bc)[_0x5c5b('0x2a')](handleEntityNotFound(_0x562d63,null))[_0x5c5b('0x2a')](respondWithResult(_0x562d63,null))[_0x5c5b('0x4e')](handleError(_0x562d63,null));};exports['create']=function(_0x3b7b9c,_0x519d40){return db['Variable'][_0x5c5b('0x4f')](_0x3b7b9c[_0x5c5b('0x50')],{})[_0x5c5b('0x2a')](function(_0x452de0){var _0x30e875=_0x3b7b9c[_0x5c5b('0x51')][_0x5c5b('0x28')]({'plain':!![]});if(!_0x30e875)throw new Error(_0x5c5b('0x52'));if(_0x30e875['role']===_0x5c5b('0x51')){var _0x4b668a=_0x452de0[_0x5c5b('0x28')]({'plain':!![]});var _0x432a92='Variables';return db['UserProfileSection'][_0x5c5b('0x4d')]({'where':{'name':_0x432a92,'userProfileId':_0x30e875['userProfileId']},'raw':!![]})[_0x5c5b('0x2a')](function(_0x3e2bd5){if(_0x3e2bd5&&_0x3e2bd5[_0x5c5b('0x53')]===0x0){return db[_0x5c5b('0x54')][_0x5c5b('0x4f')]({'name':_0x4b668a[_0x5c5b('0x2e')],'resourceId':_0x4b668a['id'],'type':_0x3e2bd5[_0x5c5b('0x2e')],'sectionId':_0x3e2bd5['id']},{})[_0x5c5b('0x2a')](function(){return _0x452de0;});}else{return _0x452de0;}})[_0x5c5b('0x4e')](function(_0x1756d8){logger[_0x5c5b('0x2c')](_0x5c5b('0x55'),_0x1756d8);throw _0x1756d8;});}return _0x452de0;})[_0x5c5b('0x2a')](respondWithResult(_0x519d40,0xc9))['catch'](handleError(_0x519d40,null));};exports[_0x5c5b('0x26')]=function(_0x4c391c,_0x1191ee){if(_0x4c391c[_0x5c5b('0x50')]['id']){delete _0x4c391c[_0x5c5b('0x50')]['id'];}return db[_0x5c5b('0x32')][_0x5c5b('0x4d')]({'where':{'id':_0x4c391c[_0x5c5b('0x4c')]['id']}})[_0x5c5b('0x2a')](handleEntityNotFound(_0x1191ee,null))[_0x5c5b('0x2a')](saveUpdates(_0x4c391c[_0x5c5b('0x50')],null))[_0x5c5b('0x2a')](respondWithResult(_0x1191ee,null))['catch'](handleError(_0x1191ee,null));};exports[_0x5c5b('0x27')]=function(_0x4a7300,_0x1e3e06){return db['Variable'][_0x5c5b('0x4d')]({'where':{'id':_0x4a7300[_0x5c5b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1e3e06,null))[_0x5c5b('0x2a')](removeEntity(_0x1e3e06,null))[_0x5c5b('0x4e')](handleError(_0x1e3e06,null));}; \ No newline at end of file +var _0xb86d=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','get','Variables','destroy','error','stack','name','send','index','map','Variable','fieldName','type','query','keys','filters','intersection','model','attributes','fields'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xb86d,0x74));var _0xdb86=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb86d[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xdb86('0x0'));var rimraf=require(_0xdb86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb86('0x2'));var rp=require(_0xdb86('0x3'));var moment=require('moment');var BPromise=require(_0xdb86('0x4'));var Mustache=require(_0xdb86('0x5'));var util=require(_0xdb86('0x6'));var path=require('path');var sox=require(_0xdb86('0x7'));var csv=require(_0xdb86('0x8'));var ejs=require(_0xdb86('0x9'));var fs=require('fs');var fs_extra=require(_0xdb86('0xa'));var _=require(_0xdb86('0xb'));var squel=require(_0xdb86('0xc'));var crypto=require('crypto');var jsforce=require(_0xdb86('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdb86('0xe'));var Papa=require(_0xdb86('0xf'));var Redis=require(_0xdb86('0x10'));var authService=require(_0xdb86('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdb86('0x12'));var hardwareService=require(_0xdb86('0x13'));var logger=require(_0xdb86('0x14'))(_0xdb86('0x15'));var utils=require(_0xdb86('0x16'));var config=require(_0xdb86('0x17'));var licenseUtil=require(_0xdb86('0x18'));var db=require(_0xdb86('0x19'))['db'];function respondWithStatusCode(_0x27dafb,_0x18be88){_0x18be88=_0x18be88||0xcc;return function(_0x53e19e){if(_0x53e19e){return _0x27dafb[_0xdb86('0x1a')](_0x18be88);}return _0x27dafb[_0xdb86('0x1b')](_0x18be88)[_0xdb86('0x1c')]();};}function respondWithResult(_0x470cb9,_0x2159b1){_0x2159b1=_0x2159b1||0xc8;return function(_0x37123b){if(_0x37123b){return _0x470cb9[_0xdb86('0x1b')](_0x2159b1)['json'](_0x37123b);}};}function respondWithFilteredResult(_0x55c90d,_0x132b4f){return function(_0x364792){if(_0x364792){var _0x21ee25=typeof _0x132b4f[_0xdb86('0x1d')]===_0xdb86('0x1e')&&typeof _0x132b4f[_0xdb86('0x1f')]===_0xdb86('0x1e');var _0x330e7b=_0x364792['count'];var _0x2c07f1=_0x21ee25?0x0:_0x132b4f[_0xdb86('0x1d')];var _0x4a6fd4=_0x21ee25?_0x364792[_0xdb86('0x20')]:_0x132b4f[_0xdb86('0x1d')]+_0x132b4f[_0xdb86('0x1f')];var _0x288a17;if(_0x4a6fd4>=_0x330e7b){_0x4a6fd4=_0x330e7b;_0x288a17=0xc8;}else{_0x288a17=0xce;}_0x55c90d[_0xdb86('0x1b')](_0x288a17);return _0x55c90d[_0xdb86('0x21')](_0xdb86('0x22'),_0x2c07f1+'-'+_0x4a6fd4+'/'+_0x330e7b)[_0xdb86('0x23')](_0x364792);}return null;};}function patchUpdates(_0x7bfdd2){return function(_0x29ee54){try{jsonpatch[_0xdb86('0x24')](_0x29ee54,_0x7bfdd2,!![]);}catch(_0x51f244){return BPromise[_0xdb86('0x25')](_0x51f244);}return _0x29ee54['save']();};}function saveUpdates(_0x47ceda,_0x1a7875){return function(_0x282fc5){if(_0x282fc5){return _0x282fc5['update'](_0x47ceda)[_0xdb86('0x26')](function(_0x52e4bd){return _0x52e4bd;});}return null;};}function removeEntity(_0x17eeeb,_0x38144d){return function(_0x30a532){if(_0x30a532){return _0x30a532['destroy']()[_0xdb86('0x26')](function(){var _0x3092ee=_0x30a532[_0xdb86('0x27')]({'plain':!![]});var _0x894736=_0xdb86('0x28');return db['UserProfileResource'][_0xdb86('0x29')]({'where':{'type':_0x894736,'resourceId':_0x3092ee['id']}})[_0xdb86('0x26')](function(){return _0x30a532;});})['then'](function(){_0x17eeeb[_0xdb86('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a05b7,_0x2b237e){return function(_0x32e910){if(!_0x32e910){_0x3a05b7[_0xdb86('0x1a')](0x194);}return _0x32e910;};}function handleError(_0x16c749,_0xfa4999){_0xfa4999=_0xfa4999||0x1f4;return function(_0x5f59c1){logger[_0xdb86('0x2a')](_0x5f59c1[_0xdb86('0x2b')]);if(_0x5f59c1[_0xdb86('0x2c')]){delete _0x5f59c1[_0xdb86('0x2c')];}_0x16c749[_0xdb86('0x1b')](_0xfa4999)[_0xdb86('0x2d')](_0x5f59c1);};}exports[_0xdb86('0x2e')]=function(_0x3b99b2,_0x3db36a){var _0x32f4de={},_0x27cfba={},_0x447c23={'count':0x0,'rows':[]};var _0x42158d=_[_0xdb86('0x2f')](db[_0xdb86('0x30')]['rawAttributes'],function(_0x591a74){return{'name':_0x591a74[_0xdb86('0x31')],'type':_0x591a74[_0xdb86('0x32')]['key']};});_0x27cfba['model']=_[_0xdb86('0x2f')](_0x42158d,_0xdb86('0x2c'));_0x27cfba[_0xdb86('0x33')]=_[_0xdb86('0x34')](_0x3b99b2[_0xdb86('0x33')]);_0x27cfba[_0xdb86('0x35')]=_[_0xdb86('0x36')](_0x27cfba[_0xdb86('0x37')],_0x27cfba['query']);_0x32f4de[_0xdb86('0x38')]=_['intersection'](_0x27cfba['model'],qs[_0xdb86('0x39')](_0x3b99b2[_0xdb86('0x33')][_0xdb86('0x39')]));_0x32f4de[_0xdb86('0x38')]=_0x32f4de[_0xdb86('0x38')][_0xdb86('0x3a')]?_0x32f4de[_0xdb86('0x38')]:_0x27cfba[_0xdb86('0x37')];if(!_0x3b99b2[_0xdb86('0x33')][_0xdb86('0x3b')](_0xdb86('0x3c'))){_0x32f4de[_0xdb86('0x1f')]=qs[_0xdb86('0x1f')](_0x3b99b2[_0xdb86('0x33')][_0xdb86('0x1f')]);_0x32f4de[_0xdb86('0x1d')]=qs[_0xdb86('0x1d')](_0x3b99b2[_0xdb86('0x33')][_0xdb86('0x1d')]);}_0x32f4de[_0xdb86('0x3d')]=qs[_0xdb86('0x3e')](_0x3b99b2[_0xdb86('0x33')][_0xdb86('0x3e')]);_0x32f4de[_0xdb86('0x3f')]=qs['filters'](_[_0xdb86('0x40')](_0x3b99b2['query'],_0x27cfba[_0xdb86('0x35')]),_0x42158d);if(_0x3b99b2[_0xdb86('0x33')][_0xdb86('0x41')]){_0x32f4de[_0xdb86('0x3f')]=_[_0xdb86('0x42')](_0x32f4de['where'],{'$or':_['map'](_0x42158d,function(_0x647c){if(_0x647c[_0xdb86('0x32')]!==_0xdb86('0x43')){var _0x18d46b={};_0x18d46b[_0x647c[_0xdb86('0x2c')]]={'$like':'%'+_0x3b99b2[_0xdb86('0x33')][_0xdb86('0x41')]+'%'};return _0x18d46b;}})});}_0x32f4de=_[_0xdb86('0x42')]({},_0x32f4de,_0x3b99b2['options']);var _0x1e0914={'where':_0x32f4de['where']};return db[_0xdb86('0x30')][_0xdb86('0x20')](_0x1e0914)[_0xdb86('0x26')](function(_0x265ad4){_0x447c23[_0xdb86('0x20')]=_0x265ad4;if(_0x3b99b2[_0xdb86('0x33')][_0xdb86('0x44')]){_0x32f4de[_0xdb86('0x45')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x32f4de);})[_0xdb86('0x26')](function(_0x551f3c){_0x447c23[_0xdb86('0x46')]=_0x551f3c;return _0x447c23;})[_0xdb86('0x26')](respondWithFilteredResult(_0x3db36a,_0x32f4de))[_0xdb86('0x47')](handleError(_0x3db36a,null));};exports[_0xdb86('0x48')]=function(_0x1a6f2d,_0x18f394){var _0x28c972={'raw':!![],'where':{'id':_0x1a6f2d[_0xdb86('0x49')]['id']}},_0x11b26b={};_0x11b26b[_0xdb86('0x37')]=_['keys'](db[_0xdb86('0x30')][_0xdb86('0x4a')]);_0x11b26b[_0xdb86('0x33')]=_['keys'](_0x1a6f2d[_0xdb86('0x33')]);_0x11b26b[_0xdb86('0x35')]=_[_0xdb86('0x36')](_0x11b26b[_0xdb86('0x37')],_0x11b26b[_0xdb86('0x33')]);_0x28c972['attributes']=_[_0xdb86('0x36')](_0x11b26b['model'],qs[_0xdb86('0x39')](_0x1a6f2d[_0xdb86('0x33')][_0xdb86('0x39')]));_0x28c972[_0xdb86('0x38')]=_0x28c972['attributes'][_0xdb86('0x3a')]?_0x28c972['attributes']:_0x11b26b[_0xdb86('0x37')];if(_0x1a6f2d[_0xdb86('0x33')][_0xdb86('0x44')]){_0x28c972[_0xdb86('0x45')]=[{'all':!![]}];}_0x28c972=_[_0xdb86('0x42')]({},_0x28c972,_0x1a6f2d[_0xdb86('0x4b')]);return db[_0xdb86('0x30')][_0xdb86('0x4c')](_0x28c972)[_0xdb86('0x26')](handleEntityNotFound(_0x18f394,null))[_0xdb86('0x26')](respondWithResult(_0x18f394,null))[_0xdb86('0x47')](handleError(_0x18f394,null));};exports[_0xdb86('0x4d')]=function(_0x557824,_0xf846ca){return db[_0xdb86('0x30')][_0xdb86('0x4d')](_0x557824[_0xdb86('0x4e')],{})[_0xdb86('0x26')](function(_0x58e0c1){var _0x5133f0=_0x557824[_0xdb86('0x4f')][_0xdb86('0x27')]({'plain':!![]});if(!_0x5133f0)throw new Error(_0xdb86('0x50'));if(_0x5133f0[_0xdb86('0x51')]===_0xdb86('0x4f')){var _0x184c0a=_0x58e0c1[_0xdb86('0x27')]({'plain':!![]});var _0x21f646=_0xdb86('0x28');return db[_0xdb86('0x52')][_0xdb86('0x4c')]({'where':{'name':_0x21f646,'userProfileId':_0x5133f0[_0xdb86('0x53')]},'raw':!![]})[_0xdb86('0x26')](function(_0x4c8f2b){if(_0x4c8f2b&&_0x4c8f2b[_0xdb86('0x54')]===0x0){return db[_0xdb86('0x55')]['create']({'name':_0x184c0a[_0xdb86('0x2c')],'resourceId':_0x184c0a['id'],'type':_0x4c8f2b[_0xdb86('0x2c')],'sectionId':_0x4c8f2b['id']},{})['then'](function(){return _0x58e0c1;});}else{return _0x58e0c1;}})['catch'](function(_0x19a6cc){logger[_0xdb86('0x2a')](_0xdb86('0x56'),_0x19a6cc);throw _0x19a6cc;});}return _0x58e0c1;})[_0xdb86('0x26')](respondWithResult(_0xf846ca,0xc9))[_0xdb86('0x47')](handleError(_0xf846ca,null));};exports['update']=function(_0x8929c6,_0x58313e){if(_0x8929c6[_0xdb86('0x4e')]['id']){delete _0x8929c6[_0xdb86('0x4e')]['id'];}return db[_0xdb86('0x30')]['find']({'where':{'id':_0x8929c6['params']['id']}})[_0xdb86('0x26')](handleEntityNotFound(_0x58313e,null))[_0xdb86('0x26')](saveUpdates(_0x8929c6[_0xdb86('0x4e')],null))[_0xdb86('0x26')](respondWithResult(_0x58313e,null))['catch'](handleError(_0x58313e,null));};exports[_0xdb86('0x29')]=function(_0x382f1a,_0x3de47c){return db[_0xdb86('0x30')]['find']({'where':{'id':_0x382f1a[_0xdb86('0x49')]['id']}})[_0xdb86('0x26')](handleEntityNotFound(_0x3de47c,null))[_0xdb86('0x26')](removeEntity(_0x3de47c,null))[_0xdb86('0x47')](handleError(_0x3de47c,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e382fac..162a718 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 _0x25d5=['../../config/environment','./variable.attributes','define','tools_variables','lodash','util','../../config/logger','path','rimraf'];(function(_0x14a91c,_0x39921e){var _0xba243c=function(_0x2850e2){while(--_0x2850e2){_0x14a91c['push'](_0x14a91c['shift']());}};_0xba243c(++_0x39921e);}(_0x25d5,0x1bd));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x525d('0x0'));var util=require(_0x525d('0x1'));var logger=require(_0x525d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x525d('0x3'));var rimraf=require(_0x525d('0x4'));var config=require(_0x525d('0x5'));var attributes=require(_0x525d('0x6'));module['exports']=function(_0x211bdd,_0x2fdea2){return _0x211bdd[_0x525d('0x7')]('Variable',attributes,{'tableName':_0x525d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23d5=['path','rimraf','./variable.attributes','define','Variable','tools_variables','util','../../config/logger','api','bluebird','request-promise'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x23d5,0xc1));var _0x523d=function(_0x489243,_0x3dae24){_0x489243=_0x489243-0x0;var _0x360d07=_0x23d5[_0x489243];return _0x360d07;};'use strict';var _=require('lodash');var util=require(_0x523d('0x0'));var logger=require(_0x523d('0x1'))(_0x523d('0x2'));var moment=require('moment');var BPromise=require(_0x523d('0x3'));var rp=require(_0x523d('0x4'));var fs=require('fs');var path=require(_0x523d('0x5'));var rimraf=require(_0x523d('0x6'));var config=require('../../config/environment');var attributes=require(_0x523d('0x7'));module['exports']=function(_0x2f842a,_0xdb8c57){return _0x2f842a[_0x523d('0x8')](_0x523d('0x9'),attributes,{'tableName':_0x523d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index b5454e1..36bea31 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x123e6f,_0x3a0ccb){var _0x2e0627=function(_0x835952){while(--_0x835952){_0x123e6f['push'](_0x123e6f['shift']());}};_0x2e0627(++_0x3a0ccb);}(_0xe14b,0x93));var _0xbe14=function(_0x186fce,_0x1d1755){_0x186fce=_0x186fce-0x0;var _0x53792a=_0xe14b[_0x186fce];return _0x53792a;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +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(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x326f,0xd1));var _0xf326=function(_0x39700c,_0x5b35dc){_0x39700c=_0x39700c-0x0;var _0x775dde=_0x326f[_0x39700c];return _0x775dde;};'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 7b256c5..a55c7ba 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 _0x18b0=['/migrations','migrations','express','Router','./version.controller','get','index','isAuthenticated','canUpdate','reset','/pull','pull','/restart'];(function(_0x3297a1,_0x117206){var _0x12077e=function(_0x44c79e){while(--_0x44c79e){_0x3297a1['push'](_0x3297a1['shift']());}};_0x12077e(++_0x117206);}(_0x18b0,0xec));var _0x018b=function(_0x28e4ef,_0x508d01){_0x28e4ef=_0x28e4ef-0x0;var _0x3ccaea=_0x18b0[_0x28e4ef];return _0x3ccaea;};'use strict';var express=require(_0x018b('0x0'));var router=express[_0x018b('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x018b('0x2'));router[_0x018b('0x3')]('/',controller[_0x018b('0x4')]);router[_0x018b('0x3')]('/fetch',auth[_0x018b('0x5')](),auth[_0x018b('0x6')](),controller['fetch']);router[_0x018b('0x3')]('/reset',auth[_0x018b('0x5')](),auth[_0x018b('0x6')](),controller[_0x018b('0x7')]);router[_0x018b('0x3')](_0x018b('0x8'),auth[_0x018b('0x5')](),auth['canUpdate'](),controller[_0x018b('0x9')]);router[_0x018b('0x3')](_0x018b('0xa'),auth[_0x018b('0x5')](),controller['restart']);router[_0x018b('0x3')](_0x018b('0xb'),controller[_0x018b('0xc')]);module['exports']=router; \ No newline at end of file +var _0x5118=['/pull','pull','/restart','restart','/migrations','migrations','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5118,0x96));var _0x8511=function(_0x418fa3,_0x464468){_0x418fa3=_0x418fa3-0x0;var _0x845083=_0x5118[_0x418fa3];return _0x845083;};'use strict';var express=require(_0x8511('0x0'));var router=express['Router']();var auth=require(_0x8511('0x1'));var controller=require(_0x8511('0x2'));router[_0x8511('0x3')]('/',controller[_0x8511('0x4')]);router[_0x8511('0x3')](_0x8511('0x5'),auth[_0x8511('0x6')](),auth[_0x8511('0x7')](),controller[_0x8511('0x8')]);router['get'](_0x8511('0x9'),auth['isAuthenticated'](),auth[_0x8511('0x7')](),controller['reset']);router[_0x8511('0x3')](_0x8511('0xa'),auth[_0x8511('0x6')](),auth['canUpdate'](),controller[_0x8511('0xb')]);router['get'](_0x8511('0xc'),auth[_0x8511('0x6')](),controller[_0x8511('0xd')]);router[_0x8511('0x3')](_0x8511('0xe'),controller[_0x8511('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 5bee077..ed0681b 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 _0x7f5f=['json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','join','root','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','2.0.0','status'];(function(_0x5a25f6,_0x3db5cb){var _0x5a524d=function(_0x11f0fd){while(--_0x11f0fd){_0x5a25f6['push'](_0x5a25f6['shift']());}};_0x5a524d(++_0x3db5cb);}(_0x7f5f,0x1b5));var _0xf7f5=function(_0x470d17,_0x32e508){_0x470d17=_0x470d17-0x0;var _0xd6558d=_0x7f5f[_0x470d17];return _0xd6558d;};'use strict';var Umzug=require(_0xf7f5('0x0'));var path=require(_0xf7f5('0x1'));var fs=require('fs');var _=require(_0xf7f5('0x2'));var pkginfo=require('pkginfo')(module,_0xf7f5('0x3'));var compareVersions=require(_0xf7f5('0x4'));var exec=require('child_process')[_0xf7f5('0x5')];var db=require(_0xf7f5('0x6'))['db'];var config=require(_0xf7f5('0x7'));var pm2=require(_0xf7f5('0x8'));var logger=require(_0xf7f5('0x9'))(_0xf7f5('0xa'));var git=require(_0xf7f5('0xb'))(config['root']);exports[_0xf7f5('0xc')]=function(_0x318fa2,_0x1708c0){var _0xc164={'current':module[_0xf7f5('0xd')][_0xf7f5('0x3')],'phonebar':0x2};if(_0x318fa2[_0xf7f5('0xe')]&&_0x318fa2[_0xf7f5('0xe')][_0xf7f5('0xf')]){return git[_0xf7f5('0x10')]()['tags'](function(_0x872153,_0x42d84c){_0xc164[_0xf7f5('0xf')]=(_0x872153?module['exports'][_0xf7f5('0x3')]:_0x42d84c['latest'])||_0xf7f5('0x11');return _0x1708c0[_0xf7f5('0x12')](0xc8)[_0xf7f5('0x13')](_0xc164);});}else{return _0x1708c0[_0xf7f5('0x12')](0xc8)[_0xf7f5('0x13')](_0xc164);}};exports['fetch']=function(_0x1ba5a1,_0x2f17de){return git[_0xf7f5('0x10')](['origin',_0xf7f5('0x14')],function(_0x1a3ea9){if(_0x1a3ea9){logger[_0xf7f5('0x15')](_0x1a3ea9);return _0x2f17de['status'](0x1f4)[_0xf7f5('0x13')](_0x1a3ea9);}logger[_0xf7f5('0x16')](_0xf7f5('0x17'));return _0x2f17de[_0xf7f5('0x12')](0xc8)[_0xf7f5('0x13')]({'output':_0xf7f5('0x18')});});};exports[_0xf7f5('0x19')]=function(_0x346296,_0x2ba6fe){return git[_0xf7f5('0x19')]([_0xf7f5('0x1a'),_0xf7f5('0x1b')],function(_0x12deed){if(_0x12deed){logger['error'](_0x12deed);return _0x2ba6fe[_0xf7f5('0x12')](0x1f4)[_0xf7f5('0x13')](_0x12deed);}logger[_0xf7f5('0x16')](_0xf7f5('0x1c'));return _0x2ba6fe['status'](0xc8)['json']({'output':_0xf7f5('0x1d')});});};exports[_0xf7f5('0x1e')]=function(_0x293d7b,_0x14b033){exec(_0xf7f5('0x1f'),function(_0xe49dc3,_0x1b26bb,_0xe04e9d){logger[_0xf7f5('0x16')](_0x1b26bb);logger['info'](_0xe04e9d);if(_0xe49dc3){logger[_0xf7f5('0x15')](_0xe49dc3);return _0x14b033['status'](0x1f4)[_0xf7f5('0x13')](_0xe49dc3);}return _0x14b033[_0xf7f5('0x12')](0xc8)[_0xf7f5('0x13')]({'output':_0x1b26bb});});};exports[_0xf7f5('0x20')]=function(_0x36f9fd,_0x3b2560){return pm2[_0xf7f5('0x20')](_0xf7f5('0x21'))[_0xf7f5('0x22')](function(_0x5db63e){logger['info']('pm2\x20restart\x20motion\x20%s',_0x5db63e);return _0x3b2560[_0xf7f5('0x12')](0xc8)[_0xf7f5('0x13')]({'output':_0xf7f5('0x23')});})[_0xf7f5('0x24')](function(_0x492c31){logger['error'](_0x492c31);return _0x3b2560[_0xf7f5('0x12')](0x1f4)['json'](_0x492c31);});};exports[_0xf7f5('0x25')]=function(_0xfc9715,_0xfd5c2a){var _0x2c6b77=fs[_0xf7f5('0x26')](path['join'](config['root'],'server',_0xf7f5('0x25')));var _0x39e73d=[];for(var _0x5e7993=0x0;_0x5e7993<_0x2c6b77[_0xf7f5('0x27')];_0x5e7993++){var _0x132916=_0x2c6b77[_0x5e7993][_0xf7f5('0x28')](_0xf7f5('0x29'),'');if(compareVersions(module[_0xf7f5('0xd')]['version'],_0x132916)===-0x1){_0x39e73d[_0xf7f5('0x2a')](_0x132916);}}if(_0x39e73d[_0xf7f5('0x27')]){var _0x4218c4=_0x39e73d[_0xf7f5('0x2b')](compareVersions);var _0x523546=new Umzug({'storage':_0xf7f5('0x2c'),'storageOptions':{'model':db[_0xf7f5('0x2d')],'modelName':'Migration','columnName':_0xf7f5('0x3')},'migrations':{'params':[db[_0xf7f5('0x2c')][_0xf7f5('0x2e')](),db['sequelize'][_0xf7f5('0x2f')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xf7f5('0x30')](config[_0xf7f5('0x31')],_0xf7f5('0x32'),_0xf7f5('0x25')),'pattern':/\.js$/}});_0x523546['up']({'migrations':_[_0xf7f5('0x33')](_0x4218c4,function(_0x146350){return _0x146350+'.js';})})[_0xf7f5('0x22')](function(){return _0xfd5c2a[_0xf7f5('0x12')](0xc8)['json']({'output':_0xf7f5('0x34')+module[_0xf7f5('0xd')]['version']+_0xf7f5('0x35')+_[_0xf7f5('0x36')](_0x4218c4),'migrations':_[_0xf7f5('0x30')](_0x4218c4)});})['catch'](function(_0x41597e){if(_0x41597e instanceof db[_0xf7f5('0x2c')][_0xf7f5('0x37')]){return _0xfd5c2a[_0xf7f5('0x12')](0xc8)['json']({'output':_0xf7f5('0x38')});}else{return _0xfd5c2a[_0xf7f5('0x12')](0x1f4)['json'](_0x41597e);}});}else{return _0xfd5c2a[_0xf7f5('0x12')](0xc8)['json']({'output':_0xf7f5('0x38')});}}; \ No newline at end of file +var _0x7386=['pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','replace','.js','push','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash'];(function(_0xc9f49d,_0x4b5ebc){var _0x303031=function(_0xbb9f77){while(--_0xbb9f77){_0xc9f49d['push'](_0xc9f49d['shift']());}};_0x303031(++_0x4b5ebc);}(_0x7386,0xa0));var _0x6738=function(_0x7136a7,_0x32ff85){_0x7136a7=_0x7136a7-0x0;var _0x50cc83=_0x7386[_0x7136a7];return _0x50cc83;};'use strict';var Umzug=require(_0x6738('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x6738('0x1'));var pkginfo=require(_0x6738('0x2'))(module,_0x6738('0x3'));var compareVersions=require(_0x6738('0x4'));var exec=require(_0x6738('0x5'))[_0x6738('0x6')];var db=require(_0x6738('0x7'))['db'];var config=require(_0x6738('0x8'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x6738('0x9'));var git=require(_0x6738('0xa'))(config['root']);exports[_0x6738('0xb')]=function(_0x466448,_0x4acece){var _0x5e581e={'current':module[_0x6738('0xc')]['version'],'phonebar':0x2};if(_0x466448['query']&&_0x466448[_0x6738('0xd')][_0x6738('0xe')]){return git[_0x6738('0xf')]()[_0x6738('0x10')](function(_0x14e20f,_0x2b1f78){_0x5e581e[_0x6738('0xe')]=(_0x14e20f?module[_0x6738('0xc')]['version']:_0x2b1f78[_0x6738('0xe')])||_0x6738('0x11');return _0x4acece[_0x6738('0x12')](0xc8)[_0x6738('0x13')](_0x5e581e);});}else{return _0x4acece[_0x6738('0x12')](0xc8)[_0x6738('0x13')](_0x5e581e);}};exports[_0x6738('0xf')]=function(_0x5e9f1d,_0x23ab04){return git[_0x6738('0xf')](['origin',_0x6738('0x14')],function(_0x1c4b63){if(_0x1c4b63){logger[_0x6738('0x15')](_0x1c4b63);return _0x23ab04['status'](0x1f4)[_0x6738('0x13')](_0x1c4b63);}logger['info'](_0x6738('0x16'));return _0x23ab04[_0x6738('0x12')](0xc8)[_0x6738('0x13')]({'output':_0x6738('0x17')});});};exports['reset']=function(_0x3818a6,_0x1384e5){return git[_0x6738('0x18')](['--hard','FETCH_HEAD'],function(_0x117636){if(_0x117636){logger[_0x6738('0x15')](_0x117636);return _0x1384e5['status'](0x1f4)[_0x6738('0x13')](_0x117636);}logger[_0x6738('0x19')](_0x6738('0x1a'));return _0x1384e5[_0x6738('0x12')](0xc8)[_0x6738('0x13')]({'output':_0x6738('0x1b')});});};exports[_0x6738('0x1c')]=function(_0x1f1c26,_0x1e7d5d){exec(_0x6738('0x1d'),function(_0x3a257d,_0x4dbb64,_0x5e54fb){logger[_0x6738('0x19')](_0x4dbb64);logger[_0x6738('0x19')](_0x5e54fb);if(_0x3a257d){logger['error'](_0x3a257d);return _0x1e7d5d['status'](0x1f4)[_0x6738('0x13')](_0x3a257d);}return _0x1e7d5d[_0x6738('0x12')](0xc8)[_0x6738('0x13')]({'output':_0x4dbb64});});};exports[_0x6738('0x1e')]=function(_0x44e397,_0x5ce396){return pm2[_0x6738('0x1e')](_0x6738('0x1f'))[_0x6738('0x20')](function(_0x4856cb){logger['info'](_0x6738('0x21'),_0x4856cb);return _0x5ce396[_0x6738('0x12')](0xc8)['json']({'output':_0x6738('0x22')});})[_0x6738('0x23')](function(_0x29a0a0){logger[_0x6738('0x15')](_0x29a0a0);return _0x5ce396[_0x6738('0x12')](0x1f4)[_0x6738('0x13')](_0x29a0a0);});};exports[_0x6738('0x24')]=function(_0x315c42,_0x3b0603){var _0x510488=fs[_0x6738('0x25')](path[_0x6738('0x26')](config[_0x6738('0x27')],'server','migrations'));var _0x511c9e=[];for(var _0x5286e6=0x0;_0x5286e6<_0x510488['length'];_0x5286e6++){var _0x3ada95=_0x510488[_0x5286e6][_0x6738('0x28')](_0x6738('0x29'),'');if(compareVersions(module['exports']['version'],_0x3ada95)===-0x1){_0x511c9e[_0x6738('0x2a')](_0x3ada95);}}if(_0x511c9e['length']){var _0x32536c=_0x511c9e['sort'](compareVersions);var _0x54e3af=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x6738('0x2b')],'modelName':_0x6738('0x2b'),'columnName':_0x6738('0x3')},'migrations':{'params':[db[_0x6738('0x2c')][_0x6738('0x2d')](),db['sequelize'][_0x6738('0x2e')],function(){throw new Error(_0x6738('0x2f'));}],'path':path['join'](config[_0x6738('0x27')],_0x6738('0x30'),'migrations'),'pattern':/\.js$/}});_0x54e3af['up']({'migrations':_[_0x6738('0x31')](_0x32536c,function(_0x275dc2){return _0x275dc2+'.js';})})[_0x6738('0x20')](function(){return _0x3b0603[_0x6738('0x12')](0xc8)[_0x6738('0x13')]({'output':_0x6738('0x32')+module[_0x6738('0xc')][_0x6738('0x3')]+'\x20to\x20'+_[_0x6738('0x33')](_0x32536c),'migrations':_[_0x6738('0x26')](_0x32536c)});})[_0x6738('0x23')](function(_0x1761f7){if(_0x1761f7 instanceof db[_0x6738('0x2c')][_0x6738('0x34')]){return _0x3b0603['status'](0xc8)[_0x6738('0x13')]({'output':_0x6738('0x35')});}else{return _0x3b0603[_0x6738('0x12')](0x1f4)[_0x6738('0x13')](_0x1761f7);}});}else{return _0x3b0603[_0x6738('0x12')](0xc8)[_0x6738('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3b40332..f2d4548 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 _0x112b=['create','/:id','destroy','util','path','Router','../../components/auth/service','index','get','/describe','isAuthenticated','describe','show','post'];(function(_0x58af0b,_0x52fbf5){var _0x210c68=function(_0x136bdc){while(--_0x136bdc){_0x58af0b['push'](_0x58af0b['shift']());}};_0x210c68(++_0x52fbf5);}(_0x112b,0x1d1));var _0xb112=function(_0x5bd626,_0xdbf46d){_0x5bd626=_0x5bd626-0x0;var _0x2661ca=_0x112b[_0x5bd626];return _0x2661ca;};'use strict';var multer=require('multer');var util=require(_0xb112('0x0'));var path=require(_0xb112('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb112('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb112('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb112('0x4')]);router[_0xb112('0x5')](_0xb112('0x6'),auth[_0xb112('0x7')](),controller[_0xb112('0x8')]);router[_0xb112('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xb112('0x9')]);router[_0xb112('0xa')]('/',auth['isAuthenticated'](),controller[_0xb112('0xb')]);router['put']('/:id',auth[_0xb112('0x7')](),controller['update']);router['delete'](_0xb112('0xc'),auth[_0xb112('0x7')](),controller[_0xb112('0xd')]);module['exports']=router; \ No newline at end of file +var _0xfaf9=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','update','destroy','exports','multer','util'];(function(_0x3659e0,_0x364f9a){var _0x21d0ab=function(_0x2efd4f){while(--_0x2efd4f){_0x3659e0['push'](_0x3659e0['shift']());}};_0x21d0ab(++_0x364f9a);}(_0xfaf9,0x166));var _0x9faf=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xfaf9[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x9faf('0x0'));var util=require(_0x9faf('0x1'));var path=require(_0x9faf('0x2'));var timeout=require(_0x9faf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9faf('0x4'));var auth=require(_0x9faf('0x5'));var interaction=require(_0x9faf('0x6'));var config=require(_0x9faf('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x9faf('0x8')]('/',auth[_0x9faf('0x9')](),controller[_0x9faf('0xa')]);router[_0x9faf('0x8')](_0x9faf('0xb'),auth[_0x9faf('0x9')](),controller[_0x9faf('0xc')]);router[_0x9faf('0x8')](_0x9faf('0xd'),auth[_0x9faf('0x9')](),controller['show']);router[_0x9faf('0xe')]('/',auth[_0x9faf('0x9')](),controller['create']);router['put'](_0x9faf('0xd'),auth[_0x9faf('0x9')](),controller[_0x9faf('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9faf('0x10')]);module[_0x9faf('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 0322dee..1831627 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 _0xa8b1=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x24fbc2,_0x307ebe){var _0x448c79=function(_0x132242){while(--_0x132242){_0x24fbc2['push'](_0x24fbc2['shift']());}};_0x448c79(++_0x307ebe);}(_0xa8b1,0x182));var _0x1a8b=function(_0x5f3312,_0x4b1e0c){_0x5f3312=_0x5f3312-0x0;var _0x3d404c=_0xa8b1[_0x5f3312];return _0x3d404c;};'use strict';var Sequelize=require(_0x1a8b('0x0'));module[_0x1a8b('0x1')]={'type':{'type':Sequelize[_0x1a8b('0x2')]},'uniqueid':{'type':Sequelize[_0x1a8b('0x2')]},'calleridnum':{'type':Sequelize[_0x1a8b('0x2')]},'calleridname':{'type':Sequelize[_0x1a8b('0x2')]},'queue':{'type':Sequelize[_0x1a8b('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x1a8b('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1a8b('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x1a8b('0x3')]},'agentdumpAt':{'type':Sequelize[_0x1a8b('0x3')]},'holdtime':{'type':Sequelize[_0x1a8b('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x1a8b('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x1a8b('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x1a8b('0x4')]},'agentacw':{'type':Sequelize[_0x1a8b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1a8b('0x4')]},'reason':{'type':Sequelize[_0x1a8b('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1a8b('0x2')]},'channelstate':{'type':Sequelize[_0x1a8b('0x4')]},'channelstatedesc':{'type':Sequelize[_0x1a8b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1a8b('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1a8b('0x2')]},'accountcode':{'type':Sequelize[_0x1a8b('0x2')]},'context':{'type':Sequelize[_0x1a8b('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x1a8b('0x2')]},'destchannelstate':{'type':Sequelize[_0x1a8b('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x1a8b('0x2')]},'destcalleridname':{'type':Sequelize[_0x1a8b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1a8b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1a8b('0x2')]},'destlanguage':{'type':Sequelize[_0x1a8b('0x2')]},'destaccountcode':{'type':Sequelize[_0x1a8b('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x1a8b('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x1a8b('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x1a8b('0x2')]},'transfer':{'type':Sequelize[_0x1a8b('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1a8b('0x2')],'comment':_0x1a8b('0x6')},'transferexten':{'type':Sequelize[_0x1a8b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x1a8b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7462=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x5bf400,_0x2472c0){var _0xff575e=function(_0x174897){while(--_0x174897){_0x5bf400['push'](_0x5bf400['shift']());}};_0xff575e(++_0x2472c0);}(_0x7462,0x165));var _0x2746=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0x7462[_0x2d4065];return _0xef6016;};'use strict';var Sequelize=require(_0x2746('0x0'));module[_0x2746('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2746('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2746('0x2')]},'membername':{'type':Sequelize[_0x2746('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x2746('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x2746('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2746('0x3')]},'agentdumpAt':{'type':Sequelize[_0x2746('0x3')]},'holdtime':{'type':Sequelize[_0x2746('0x4')]},'agentcomplete':{'type':Sequelize[_0x2746('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2746('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2746('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2746('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2746('0x4')]},'reason':{'type':Sequelize[_0x2746('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2746('0x2')]},'channelstate':{'type':Sequelize[_0x2746('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2746('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2746('0x2')]},'language':{'type':Sequelize[_0x2746('0x2')]},'accountcode':{'type':Sequelize[_0x2746('0x2')]},'context':{'type':Sequelize[_0x2746('0x2')]},'exten':{'type':Sequelize[_0x2746('0x2')]},'priority':{'type':Sequelize[_0x2746('0x2')]},'destchannel':{'type':Sequelize[_0x2746('0x2')]},'destchannelstate':{'type':Sequelize[_0x2746('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2746('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2746('0x2')]},'destcalleridname':{'type':Sequelize[_0x2746('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2746('0x2')]},'destaccountcode':{'type':Sequelize[_0x2746('0x2')]},'destcontext':{'type':Sequelize[_0x2746('0x2')]},'destexten':{'type':Sequelize[_0x2746('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x2746('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2746('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2746('0x2')],'comment':_0x2746('0x6')},'transferexten':{'type':Sequelize[_0x2746('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2746('0x2')]},'agententerreason':{'type':Sequelize[_0x2746('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 3ae2e42..3b67322 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(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 237b297..0ebb021 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 _0x3eea=['exports','VoiceAgentReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5dc4be,_0x582d55){_0x5dc4be=_0x5dc4be-0x0;var _0x1aae64=_0x3eea[_0x5dc4be];return _0x1aae64;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));module[_0xa3ee('0xa')]=function(_0xb93cdb,_0x5776bb){return _0xb93cdb['define'](_0xa3ee('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xa3ee('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7cf=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xb7cf,0xca));var _0xfb7c=function(_0x2f0496,_0x1b9148){_0x2f0496=_0x2f0496-0x0;var _0x4969df=_0xb7cf[_0x2f0496];return _0x4969df;};'use strict';var _=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var logger=require(_0xfb7c('0x2'))(_0xfb7c('0x3'));var moment=require(_0xfb7c('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb7c('0x5'));var fs=require('fs');var path=require(_0xfb7c('0x6'));var rimraf=require(_0xfb7c('0x7'));var config=require(_0xfb7c('0x8'));var attributes=require(_0xfb7c('0x9'));module[_0xfb7c('0xa')]=function(_0x2e245c,_0x135394){return _0x2e245c[_0xfb7c('0xb')](_0xfb7c('0xc'),attributes,{'tableName':_0xfb7c('0xd'),'paranoid':![],'indexes':[{'fields':[_0xfb7c('0xe'),_0xfb7c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e6688a6..23b6c0c 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 _0x2ec6=['client','http','request','info','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x27c27b,_0x574213){var _0x38f586=function(_0x440738){while(--_0x440738){_0x27c27b['push'](_0x27c27b['shift']());}};_0x38f586(++_0x574213);}(_0x2ec6,0xd0));var _0x62ec=function(_0x4594fe,_0x5e995f){_0x4594fe=_0x4594fe-0x0;var _0x47dca1=_0x2ec6[_0x4594fe];return _0x47dca1;};'use strict';var _=require(_0x62ec('0x0'));var util=require(_0x62ec('0x1'));var moment=require(_0x62ec('0x2'));var BPromise=require(_0x62ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x62ec('0x5'));var logger=require(_0x62ec('0x6'))(_0x62ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x62ec('0x8'));var client=jayson[_0x62ec('0x9')][_0x62ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56e983,_0x563508,_0x1f71b5){return new BPromise(function(_0x2791e2,_0x308103){return client[_0x62ec('0xb')](_0x56e983,_0x1f71b5)['then'](function(_0x5e9784){logger[_0x62ec('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x563508,_0x62ec('0xd'));logger['debug'](_0x62ec('0xe'),_0x563508,'request\x20sent',JSON[_0x62ec('0xf')](_0x5e9784));if(_0x5e9784[_0x62ec('0x10')]){if(_0x5e9784[_0x62ec('0x10')][_0x62ec('0x11')]===0x1f4){logger[_0x62ec('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x563508,_0x5e9784[_0x62ec('0x10')][_0x62ec('0x12')]);return _0x308103(_0x5e9784['error'][_0x62ec('0x12')]);}logger[_0x62ec('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x563508,_0x5e9784[_0x62ec('0x10')][_0x62ec('0x12')]);return _0x2791e2(_0x5e9784['error']['message']);}else{logger[_0x62ec('0xc')](_0x62ec('0x13'),_0x563508,_0x62ec('0xd'));_0x2791e2(_0x5e9784['result'][_0x62ec('0x12')]);}})[_0x62ec('0x14')](function(_0x5100cd){logger[_0x62ec('0x10')](_0x62ec('0x13'),_0x563508,_0x5100cd);_0x308103(_0x5100cd);});});}exports['CreateVoiceAgentReport']=function(_0x33103f){var _0x3f641f=this;return new Promise(function(_0x24bee2,_0x3473fa){return db[_0x62ec('0x15')][_0x62ec('0x16')](_0x33103f[_0x62ec('0x17')],{'raw':_0x33103f[_0x62ec('0x18')]?_0x33103f[_0x62ec('0x18')][_0x62ec('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x33ad22){logger[_0x62ec('0xc')](_0x62ec('0x1a'),_0x33103f);logger['debug'](_0x62ec('0x1a'),_0x33103f,JSON[_0x62ec('0xf')](_0x33ad22));_0x24bee2(_0x33ad22);})[_0x62ec('0x14')](function(_0x906858){logger[_0x62ec('0x10')](_0x62ec('0x1a'),_0x906858['message'],_0x33103f);_0x3473fa(_0x3f641f[_0x62ec('0x10')](0x1f4,_0x906858['message']));});});};exports[_0x62ec('0x1b')]=function(_0x1cb7a7){var _0x500ea2=this;return new Promise(function(_0x220988,_0xd41570){return db[_0x62ec('0x15')][_0x62ec('0x1c')](_0x1cb7a7['body'],{'raw':_0x1cb7a7['options']?_0x1cb7a7[_0x62ec('0x18')][_0x62ec('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cb7a7['options']?_0x1cb7a7[_0x62ec('0x18')]['where']||null:null,'attributes':_0x1cb7a7['options']?_0x1cb7a7['options'][_0x62ec('0x1d')]||null:null,'limit':_0x1cb7a7[_0x62ec('0x18')]?_0x1cb7a7[_0x62ec('0x18')][_0x62ec('0x1e')]||null:null})['then'](function(_0x25d67f){logger[_0x62ec('0xc')](_0x62ec('0x1b'),_0x1cb7a7);logger['debug'](_0x62ec('0x1b'),_0x1cb7a7,JSON[_0x62ec('0xf')](_0x25d67f));_0x220988(_0x25d67f);})[_0x62ec('0x14')](function(_0x40a319){logger[_0x62ec('0x10')]('UpdateVoiceAgentReport',_0x40a319[_0x62ec('0x12')],_0x1cb7a7);_0xd41570(_0x500ea2[_0x62ec('0x10')](0x1f4,_0x40a319['message']));});});}; \ No newline at end of file +var _0xb41f=['options','raw','update','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create'];(function(_0x142827,_0x256ff7){var _0x27de3f=function(_0xf82c65){while(--_0xf82c65){_0x142827['push'](_0x142827['shift']());}};_0x27de3f(++_0x256ff7);}(_0xb41f,0xcc));var _0xfb41=function(_0xaed159,_0x3f96ac){_0xaed159=_0xaed159-0x0;var _0x4fdae1=_0xb41f[_0xaed159];return _0x4fdae1;};'use strict';var _=require(_0xfb41('0x0'));var util=require(_0xfb41('0x1'));var moment=require(_0xfb41('0x2'));var BPromise=require(_0xfb41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb41('0x4'))['db'];var utils=require(_0xfb41('0x5'));var logger=require(_0xfb41('0x6'))(_0xfb41('0x7'));var config=require(_0xfb41('0x8'));var jayson=require(_0xfb41('0x9'));var client=jayson[_0xfb41('0xa')][_0xfb41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x231245,_0x23e2da,_0x4db462){return new BPromise(function(_0x5a8774,_0x281086){return client[_0xfb41('0xc')](_0x231245,_0x4db462)[_0xfb41('0xd')](function(_0x3a8a8b){logger[_0xfb41('0xe')](_0xfb41('0xf'),_0x23e2da,'request\x20sent');logger[_0xfb41('0x10')](_0xfb41('0x11'),_0x23e2da,_0xfb41('0x12'),JSON[_0xfb41('0x13')](_0x3a8a8b));if(_0x3a8a8b[_0xfb41('0x14')]){if(_0x3a8a8b['error'][_0xfb41('0x15')]===0x1f4){logger[_0xfb41('0x14')](_0xfb41('0xf'),_0x23e2da,_0x3a8a8b[_0xfb41('0x14')][_0xfb41('0x16')]);return _0x281086(_0x3a8a8b['error'][_0xfb41('0x16')]);}logger[_0xfb41('0x14')](_0xfb41('0xf'),_0x23e2da,_0x3a8a8b['error'][_0xfb41('0x16')]);return _0x5a8774(_0x3a8a8b['error'][_0xfb41('0x16')]);}else{logger[_0xfb41('0xe')](_0xfb41('0xf'),_0x23e2da,_0xfb41('0x12'));_0x5a8774(_0x3a8a8b['result'][_0xfb41('0x16')]);}})[_0xfb41('0x17')](function(_0x5781c6){logger[_0xfb41('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x23e2da,_0x5781c6);_0x281086(_0x5781c6);});});}exports[_0xfb41('0x18')]=function(_0x23be52){var _0x38e0d5=this;return new Promise(function(_0x173fb8,_0x4150a9){return db[_0xfb41('0x19')][_0xfb41('0x1a')](_0x23be52['body'],{'raw':_0x23be52[_0xfb41('0x1b')]?_0x23be52[_0xfb41('0x1b')][_0xfb41('0x1c')]===undefined?!![]:![]:!![]})[_0xfb41('0xd')](function(_0x3663a2){logger[_0xfb41('0xe')](_0xfb41('0x18'),_0x23be52);logger[_0xfb41('0x10')](_0xfb41('0x18'),_0x23be52,JSON['stringify'](_0x3663a2));_0x173fb8(_0x3663a2);})['catch'](function(_0x28b974){logger[_0xfb41('0x14')](_0xfb41('0x18'),_0x28b974[_0xfb41('0x16')],_0x23be52);_0x4150a9(_0x38e0d5[_0xfb41('0x14')](0x1f4,_0x28b974[_0xfb41('0x16')]));});});};exports['UpdateVoiceAgentReport']=function(_0x159808){var _0x2125c9=this;return new Promise(function(_0x3ee8ee,_0x37f827){return db[_0xfb41('0x19')][_0xfb41('0x1d')](_0x159808['body'],{'raw':_0x159808[_0xfb41('0x1b')]?_0x159808['options'][_0xfb41('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x159808[_0xfb41('0x1b')]?_0x159808[_0xfb41('0x1b')]['where']||null:null,'attributes':_0x159808[_0xfb41('0x1b')]?_0x159808[_0xfb41('0x1b')][_0xfb41('0x1e')]||null:null,'limit':_0x159808[_0xfb41('0x1b')]?_0x159808[_0xfb41('0x1b')][_0xfb41('0x1f')]||null:null})[_0xfb41('0xd')](function(_0x1ba322){logger['info']('UpdateVoiceAgentReport',_0x159808);logger[_0xfb41('0x10')](_0xfb41('0x20'),_0x159808,JSON[_0xfb41('0x13')](_0x1ba322));_0x3ee8ee(_0x1ba322);})[_0xfb41('0x17')](function(_0x59e9af){logger[_0xfb41('0x14')](_0xfb41('0x20'),_0x59e9af[_0xfb41('0x16')],_0x159808);_0x37f827(_0x2125c9['error'](0x1f4,_0x59e9af['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a59437c..2fee3bf 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 _0xaba6=['destroy','exports','multer','util','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0x185a27,_0xc95ff0){var _0x463bdb=function(_0x5b89da){while(--_0x5b89da){_0x185a27['push'](_0x185a27['shift']());}};_0x463bdb(++_0xc95ff0);}(_0xaba6,0xe2));var _0x6aba=function(_0x1c4c1e,_0x37ae2c){_0x1c4c1e=_0x1c4c1e-0x0;var _0x308b62=_0xaba6[_0x1c4c1e];return _0x308b62;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/describe',auth[_0x6aba('0x7')](),controller[_0x6aba('0x8')]);router['get'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller['show']);router[_0x6aba('0xa')]('/',auth[_0x6aba('0x7')](),controller[_0x6aba('0xb')]);router[_0x6aba('0xc')](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xd')]);router['delete'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xe')]);module[_0x6aba('0xf')]=router; \ No newline at end of file +var _0x57d4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x57d4,0x78));var _0x457d=function(_0x2b74fa,_0x58d1d1){_0x2b74fa=_0x2b74fa-0x0;var _0x3c9fd4=_0x57d4[_0x2b74fa];return _0x3c9fd4;};'use strict';var multer=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var path=require('path');var timeout=require(_0x457d('0x2'));var express=require(_0x457d('0x3'));var router=express[_0x457d('0x4')]();var fs_extra=require(_0x457d('0x5'));var auth=require(_0x457d('0x6'));var interaction=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var controller=require(_0x457d('0x9'));router[_0x457d('0xa')]('/',auth[_0x457d('0xb')](),controller[_0x457d('0xc')]);router['get'](_0x457d('0xd'),auth[_0x457d('0xb')](),controller['describe']);router['get'](_0x457d('0xe'),auth[_0x457d('0xb')](),controller[_0x457d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x457d('0x10')](_0x457d('0xe'),auth[_0x457d('0xb')](),controller[_0x457d('0x11')]);router[_0x457d('0x12')](_0x457d('0xe'),auth[_0x457d('0xb')](),controller[_0x457d('0x13')]);module[_0x457d('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c016365..f55a5df 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 _0xb0ca=['DATE','INTEGER','exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT'];(function(_0x274864,_0x145f4c){var _0x503594=function(_0x2d978f){while(--_0x2d978f){_0x274864['push'](_0x274864['shift']());}};_0x503594(++_0x145f4c);}(_0xb0ca,0x1b2));var _0xab0c=function(_0x3bfe60,_0x35abf6){_0x3bfe60=_0x3bfe60-0x0;var _0x369bac=_0xb0ca[_0x3bfe60];return _0x369bac;};'use strict';var Sequelize=require('sequelize');module[_0xab0c('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xab0c('0x1')](_0xab0c('0x2'),_0xab0c('0x3'),_0xab0c('0x4'),_0xab0c('0x5'),_0xab0c('0x6'),_0xab0c('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xab0c('0x8')]},'source':{'type':Sequelize[_0xab0c('0x8')]},'destination':{'type':Sequelize[_0xab0c('0x8')]},'destinationcontext':{'type':Sequelize[_0xab0c('0x8')]},'callerid':{'type':Sequelize[_0xab0c('0x8')]},'channel':{'type':Sequelize[_0xab0c('0x8')]},'destinationchannel':{'type':Sequelize[_0xab0c('0x8')]},'lastapplication':{'type':Sequelize[_0xab0c('0x8')]},'lastdata':{'type':Sequelize[_0xab0c('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xab0c('0xa')]},'answertime':{'type':Sequelize[_0xab0c('0xa')]},'endtime':{'type':Sequelize[_0xab0c('0xa')]},'duration':{'type':Sequelize[_0xab0c('0xb')]},'billableseconds':{'type':Sequelize[_0xab0c('0xb')]},'mohtime':{'type':Sequelize[_0xab0c('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xab0c('0x8')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xab0c('0x8')]},'userSecondDisposition':{'type':Sequelize[_0xab0c('0x8')]},'userThirdDisposition':{'type':Sequelize[_0xab0c('0x8')]},'note':{'type':Sequelize[_0xab0c('0x8')]},'prefix':{'type':Sequelize[_0xab0c('0x8')]},'routeid':{'type':Sequelize[_0xab0c('0xb')]},'sipcallid':{'type':Sequelize[_0xab0c('0x8')]}}; \ No newline at end of file +var _0xc50c=['exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x29402d,_0x10b9f5){var _0x231067=function(_0x119f48){while(--_0x119f48){_0x29402d['push'](_0x29402d['shift']());}};_0x231067(++_0x10b9f5);}(_0xc50c,0x11d));var _0xcc50=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xc50c[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require(_0xcc50('0x0'));module[_0xcc50('0x1')]={'uniqueid':{'type':Sequelize[_0xcc50('0x2')]},'type':{'type':Sequelize[_0xcc50('0x3')](_0xcc50('0x4'),_0xcc50('0x5'),_0xcc50('0x6'),_0xcc50('0x7'),_0xcc50('0x8'),_0xcc50('0x9'))},'tag':{'type':Sequelize[_0xcc50('0x2')]},'accountcode':{'type':Sequelize[_0xcc50('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xcc50('0x2')]},'destinationcontext':{'type':Sequelize[_0xcc50('0x2')]},'callerid':{'type':Sequelize[_0xcc50('0x2')]},'channel':{'type':Sequelize[_0xcc50('0x2')]},'destinationchannel':{'type':Sequelize[_0xcc50('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xcc50('0xa')]},'starttime':{'type':Sequelize[_0xcc50('0xb')]},'systemanswertime':{'type':Sequelize[_0xcc50('0xb')]},'answertime':{'type':Sequelize[_0xcc50('0xb')]},'endtime':{'type':Sequelize[_0xcc50('0xb')]},'duration':{'type':Sequelize[_0xcc50('0xc')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xcc50('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcc50('0x2')]},'amaflags':{'type':Sequelize[_0xcc50('0x2')]},'userfield':{'type':Sequelize[_0xcc50('0x2')]},'userDisposition':{'type':Sequelize[_0xcc50('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xcc50('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xcc50('0x2')]},'note':{'type':Sequelize[_0xcc50('0x2')]},'prefix':{'type':Sequelize[_0xcc50('0x2')]},'routeid':{'type':Sequelize[_0xcc50('0xc')]},'sipcallid':{'type':Sequelize[_0xcc50('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 460461c..b5441e1 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x3614f2,_0x1bb103){var _0x5dc391=function(_0x5b82a6){while(--_0x5b82a6){_0x3614f2['push'](_0x3614f2['shift']());}};_0x5dc391(++_0x1bb103);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3778d8,_0x5ce417){_0x3778d8=_0x3778d8-0x0;var _0x45a1b3=_0x0b0e[_0x3778d8];return _0x45a1b3;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x2534fa,_0x116f41){_0x2534fa=_0x2534fa-0x0;var _0x46f7da=_0x2032[_0x2534fa];return _0x46f7da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 130984a..bb92397 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 _0x1801=['define','VoiceCallReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x2302f0,_0x1afef2){var _0x23db84=function(_0x6ad1be){while(--_0x6ad1be){_0x2302f0['push'](_0x2302f0['shift']());}};_0x23db84(++_0x1afef2);}(_0x1801,0xc6));var _0x1180=function(_0x2f8f57,_0x4f37f8){_0x2f8f57=_0x2f8f57-0x0;var _0x162c5d=_0x1801[_0x2f8f57];return _0x162c5d;};'use strict';var _=require(_0x1180('0x0'));var util=require(_0x1180('0x1'));var logger=require(_0x1180('0x2'))(_0x1180('0x3'));var moment=require(_0x1180('0x4'));var BPromise=require(_0x1180('0x5'));var rp=require(_0x1180('0x6'));var fs=require('fs');var path=require(_0x1180('0x7'));var rimraf=require(_0x1180('0x8'));var config=require(_0x1180('0x9'));var attributes=require(_0x1180('0xa'));module[_0x1180('0xb')]=function(_0x300206,_0x5645fb){return _0x300206[_0x1180('0xc')](_0x1180('0xd'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb857=['bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util','../../config/logger'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xb857,0xd5));var _0x7b85=function(_0x4361fc,_0x1cc2c6){_0x4361fc=_0x4361fc-0x0;var _0x21fbca=_0xb857[_0x4361fc];return _0x21fbca;};'use strict';var _=require(_0x7b85('0x0'));var util=require(_0x7b85('0x1'));var logger=require(_0x7b85('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7b85('0x3'));var rp=require(_0x7b85('0x4'));var fs=require('fs');var path=require(_0x7b85('0x5'));var rimraf=require(_0x7b85('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b85('0x7'));module[_0x7b85('0x8')]=function(_0x1040ab,_0x1191c0){return _0x1040ab[_0x7b85('0x9')](_0x7b85('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x7b85('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 7f02b52..d330438 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 _0x369d=['map','include','model','attributes','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','lodash','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x369d,0x76));var _0xd369=function(_0x1edce9,_0x30ae25){_0x1edce9=_0x1edce9-0x0;var _0x4fa15e=_0x369d[_0x1edce9];return _0x4fa15e;};'use strict';var _=require(_0xd369('0x0'));var util=require('util');var moment=require(_0xd369('0x1'));var BPromise=require(_0xd369('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd369('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd369('0x4'))('rpc');var config=require(_0xd369('0x5'));var jayson=require(_0xd369('0x6'));var client=jayson['client'][_0xd369('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xdae0d7,_0x16ae9,_0x1cb48d){return new BPromise(function(_0x48af58,_0x4448fb){return client[_0xd369('0x8')](_0xdae0d7,_0x1cb48d)[_0xd369('0x9')](function(_0x2be67e){logger[_0xd369('0xa')](_0xd369('0xb'),_0x16ae9,_0xd369('0xc'));logger[_0xd369('0xd')](_0xd369('0xe'),_0x16ae9,_0xd369('0xc'),JSON[_0xd369('0xf')](_0x2be67e));if(_0x2be67e['error']){if(_0x2be67e['error']['code']===0x1f4){logger['error'](_0xd369('0xb'),_0x16ae9,_0x2be67e[_0xd369('0x10')][_0xd369('0x11')]);return _0x4448fb(_0x2be67e[_0xd369('0x10')][_0xd369('0x11')]);}logger['error'](_0xd369('0xb'),_0x16ae9,_0x2be67e[_0xd369('0x10')][_0xd369('0x11')]);return _0x48af58(_0x2be67e[_0xd369('0x10')][_0xd369('0x11')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x16ae9,_0xd369('0xc'));_0x48af58(_0x2be67e[_0xd369('0x12')][_0xd369('0x11')]);}})[_0xd369('0x13')](function(_0x26b868){logger[_0xd369('0x10')](_0xd369('0xb'),_0x16ae9,_0x26b868);_0x4448fb(_0x26b868);});});}exports[_0xd369('0x14')]=function(_0xe264a6){var _0x4dbb92=this;return new Promise(function(_0x1d0443,_0x30c60b){return db[_0xd369('0x15')][_0xd369('0x16')]({'raw':_0xe264a6[_0xd369('0x17')]?_0xe264a6[_0xd369('0x17')][_0xd369('0x18')]===undefined?!![]:![]:!![],'where':_0xe264a6['options']?_0xe264a6[_0xd369('0x17')][_0xd369('0x19')]||null:null,'attributes':_0xe264a6[_0xd369('0x17')]?_0xe264a6[_0xd369('0x17')]['attributes']||null:null,'limit':_0xe264a6['options']?_0xe264a6['options']['limit']||null:null,'include':_0xe264a6['options']?_0xe264a6[_0xd369('0x17')]['include']?_[_0xd369('0x1a')](_0xe264a6[_0xd369('0x17')][_0xd369('0x1b')],function(_0x4e1468){return{'model':db[_0x4e1468[_0xd369('0x1c')]],'as':_0x4e1468['as'],'attributes':_0x4e1468[_0xd369('0x1d')],'include':_0x4e1468['include']?_[_0xd369('0x1a')](_0x4e1468['include'],function(_0x321708){return{'model':db[_0x321708[_0xd369('0x1c')]],'as':_0x321708['as'],'attributes':_0x321708['attributes'],'include':_0x321708[_0xd369('0x1b')]?_[_0xd369('0x1a')](_0x321708[_0xd369('0x1b')],function(_0x2e1597){return{'model':db[_0x2e1597['model']],'as':_0x2e1597['as'],'attributes':_0x2e1597[_0xd369('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4046ff){logger['info'](_0xd369('0x14'),_0xe264a6);logger['debug'](_0xd369('0x14'),_0xe264a6,JSON[_0xd369('0xf')](_0x4046ff));_0x1d0443(_0x4046ff);})[_0xd369('0x13')](function(_0x1022cc){logger[_0xd369('0x10')]('GetVoiceCallReport',_0x1022cc['message'],_0xe264a6);_0x30c60b(_0x4dbb92[_0xd369('0x10')](0x1f4,_0x1022cc['message']));});});};exports[_0xd369('0x1e')]=function(_0x1ef020){var _0x3b2ef9=this;return new Promise(function(_0x51b0eb,_0x1c818d){return db[_0xd369('0x15')][_0xd369('0x1f')](_0x1ef020[_0xd369('0x20')],{'raw':_0x1ef020['options']?_0x1ef020['options'][_0xd369('0x18')]===undefined?!![]:![]:!![]})[_0xd369('0x9')](function(_0x218d92){logger[_0xd369('0xa')](_0xd369('0x1e'),_0x1ef020);logger[_0xd369('0xd')](_0xd369('0x1e'),_0x1ef020,JSON[_0xd369('0xf')](_0x218d92));_0x51b0eb(_0x218d92);})['catch'](function(_0x4b578a){logger[_0xd369('0x10')](_0xd369('0x1e'),_0x4b578a['message'],_0x1ef020);_0x1c818d(_0x3b2ef9[_0xd369('0x10')](0x1f4,_0x4b578a[_0xd369('0x11')]));});});};exports[_0xd369('0x21')]=function(_0x29257c){var _0x1b4192=this;return new Promise(function(_0x3b021f,_0x4db428){return db[_0xd369('0x15')][_0xd369('0x22')](_0x29257c['body'],{'raw':_0x29257c[_0xd369('0x17')]?_0x29257c[_0xd369('0x17')][_0xd369('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29257c[_0xd369('0x17')]?_0x29257c[_0xd369('0x17')][_0xd369('0x19')]||null:null,'attributes':_0x29257c[_0xd369('0x17')]?_0x29257c[_0xd369('0x17')][_0xd369('0x1d')]||null:null,'limit':_0x29257c[_0xd369('0x17')]?_0x29257c[_0xd369('0x17')][_0xd369('0x23')]||null:null})[_0xd369('0x9')](function(_0x217291){logger[_0xd369('0xa')](_0xd369('0x21'),_0x29257c);logger[_0xd369('0xd')](_0xd369('0x21'),_0x29257c,JSON[_0xd369('0xf')](_0x217291));_0x3b021f(_0x217291);})[_0xd369('0x13')](function(_0x195930){logger[_0xd369('0x10')](_0xd369('0x21'),_0x195930[_0xd369('0x11')],_0x29257c);_0x4db428(_0x1b4192[_0xd369('0x10')](0x1f4,_0x195930['message']));});});}; \ No newline at end of file +var _0x8ef0=['options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x537e1a,_0xb1efea){var _0x1be6d2=function(_0x296c73){while(--_0x296c73){_0x537e1a['push'](_0x537e1a['shift']());}};_0x1be6d2(++_0xb1efea);}(_0x8ef0,0xa5));var _0x08ef=function(_0x3407be,_0x3ad78b){_0x3407be=_0x3407be-0x0;var _0x1743e2=_0x8ef0[_0x3407be];return _0x1743e2;};'use strict';var _=require(_0x08ef('0x0'));var util=require(_0x08ef('0x1'));var moment=require(_0x08ef('0x2'));var BPromise=require(_0x08ef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08ef('0x4'))['db'];var utils=require(_0x08ef('0x5'));var logger=require(_0x08ef('0x6'))(_0x08ef('0x7'));var config=require(_0x08ef('0x8'));var jayson=require(_0x08ef('0x9'));var client=jayson[_0x08ef('0xa')][_0x08ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x175027,_0x28a807,_0x42aca9){return new BPromise(function(_0x47df3a,_0x3a53ca){return client[_0x08ef('0xc')](_0x175027,_0x42aca9)[_0x08ef('0xd')](function(_0x189982){logger[_0x08ef('0xe')](_0x08ef('0xf'),_0x28a807,_0x08ef('0x10'));logger[_0x08ef('0x11')](_0x08ef('0x12'),_0x28a807,_0x08ef('0x10'),JSON[_0x08ef('0x13')](_0x189982));if(_0x189982['error']){if(_0x189982['error'][_0x08ef('0x14')]===0x1f4){logger[_0x08ef('0x15')](_0x08ef('0xf'),_0x28a807,_0x189982['error'][_0x08ef('0x16')]);return _0x3a53ca(_0x189982['error'][_0x08ef('0x16')]);}logger['error'](_0x08ef('0xf'),_0x28a807,_0x189982[_0x08ef('0x15')][_0x08ef('0x16')]);return _0x47df3a(_0x189982[_0x08ef('0x15')][_0x08ef('0x16')]);}else{logger[_0x08ef('0xe')](_0x08ef('0xf'),_0x28a807,_0x08ef('0x10'));_0x47df3a(_0x189982[_0x08ef('0x17')][_0x08ef('0x16')]);}})[_0x08ef('0x18')](function(_0x4f5100){logger[_0x08ef('0x15')](_0x08ef('0xf'),_0x28a807,_0x4f5100);_0x3a53ca(_0x4f5100);});});}exports['GetVoiceCallReport']=function(_0x23a502){var _0x49b9c4=this;return new Promise(function(_0x150d31,_0x43108e){return db['VoiceCallReport']['findAll']({'raw':_0x23a502[_0x08ef('0x19')]?_0x23a502[_0x08ef('0x19')][_0x08ef('0x1a')]===undefined?!![]:![]:!![],'where':_0x23a502[_0x08ef('0x19')]?_0x23a502['options'][_0x08ef('0x1b')]||null:null,'attributes':_0x23a502[_0x08ef('0x19')]?_0x23a502[_0x08ef('0x19')][_0x08ef('0x1c')]||null:null,'limit':_0x23a502[_0x08ef('0x19')]?_0x23a502['options'][_0x08ef('0x1d')]||null:null,'include':_0x23a502[_0x08ef('0x19')]?_0x23a502['options'][_0x08ef('0x1e')]?_[_0x08ef('0x1f')](_0x23a502['options'][_0x08ef('0x1e')],function(_0x1f1c71){return{'model':db[_0x1f1c71[_0x08ef('0x20')]],'as':_0x1f1c71['as'],'attributes':_0x1f1c71[_0x08ef('0x1c')],'include':_0x1f1c71[_0x08ef('0x1e')]?_[_0x08ef('0x1f')](_0x1f1c71[_0x08ef('0x1e')],function(_0x231cfc){return{'model':db[_0x231cfc[_0x08ef('0x20')]],'as':_0x231cfc['as'],'attributes':_0x231cfc[_0x08ef('0x1c')],'include':_0x231cfc[_0x08ef('0x1e')]?_[_0x08ef('0x1f')](_0x231cfc['include'],function(_0x245015){return{'model':db[_0x245015[_0x08ef('0x20')]],'as':_0x245015['as'],'attributes':_0x245015[_0x08ef('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x08ef('0xd')](function(_0x296a2a){logger['info']('GetVoiceCallReport',_0x23a502);logger[_0x08ef('0x11')](_0x08ef('0x21'),_0x23a502,JSON[_0x08ef('0x13')](_0x296a2a));_0x150d31(_0x296a2a);})[_0x08ef('0x18')](function(_0x4e772b){logger[_0x08ef('0x15')](_0x08ef('0x21'),_0x4e772b[_0x08ef('0x16')],_0x23a502);_0x43108e(_0x49b9c4[_0x08ef('0x15')](0x1f4,_0x4e772b['message']));});});};exports[_0x08ef('0x22')]=function(_0x5587e1){var _0x5a57c0=this;return new Promise(function(_0x306e49,_0x403d7a){return db['VoiceCallReport'][_0x08ef('0x23')](_0x5587e1['body'],{'raw':_0x5587e1[_0x08ef('0x19')]?_0x5587e1[_0x08ef('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x08ef('0xd')](function(_0x5b8997){logger[_0x08ef('0xe')]('CreateVoiceCallReport',_0x5587e1);logger['debug'](_0x08ef('0x22'),_0x5587e1,JSON['stringify'](_0x5b8997));_0x306e49(_0x5b8997);})[_0x08ef('0x18')](function(_0x580b64){logger[_0x08ef('0x15')](_0x08ef('0x22'),_0x580b64['message'],_0x5587e1);_0x403d7a(_0x5a57c0['error'](0x1f4,_0x580b64[_0x08ef('0x16')]));});});};exports['UpdateVoiceCallReport']=function(_0x1c6c69){var _0x362080=this;return new Promise(function(_0x498a01,_0x459686){return db['VoiceCallReport']['update'](_0x1c6c69[_0x08ef('0x24')],{'raw':_0x1c6c69[_0x08ef('0x19')]?_0x1c6c69[_0x08ef('0x19')][_0x08ef('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c6c69[_0x08ef('0x19')]?_0x1c6c69['options']['where']||null:null,'attributes':_0x1c6c69[_0x08ef('0x19')]?_0x1c6c69['options'][_0x08ef('0x1c')]||null:null,'limit':_0x1c6c69[_0x08ef('0x19')]?_0x1c6c69['options'][_0x08ef('0x1d')]||null:null})['then'](function(_0xa03991){logger[_0x08ef('0xe')](_0x08ef('0x25'),_0x1c6c69);logger['debug'](_0x08ef('0x25'),_0x1c6c69,JSON[_0x08ef('0x13')](_0xa03991));_0x498a01(_0xa03991);})[_0x08ef('0x18')](function(_0xbc9d38){logger[_0x08ef('0x15')]('UpdateVoiceCallReport',_0xbc9d38[_0x08ef('0x16')],_0x1c6c69);_0x459686(_0x362080['error'](0x1f4,_0xbc9d38[_0x08ef('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index f3fdb92..ae2dbb4 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 _0x5e3a=['post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0x5e3a,0xea));var _0xa5e3=function(_0x19767f,_0x1e038f){_0x19767f=_0x19767f-0x0;var _0x50c202=_0x5e3a[_0x19767f];return _0x50c202;};'use strict';var multer=require('multer');var util=require(_0xa5e3('0x0'));var path=require('path');var timeout=require(_0xa5e3('0x1'));var express=require(_0xa5e3('0x2'));var router=express[_0xa5e3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa5e3('0x4'));var interaction=require(_0xa5e3('0x5'));var config=require(_0xa5e3('0x6'));var controller=require(_0xa5e3('0x7'));router[_0xa5e3('0x8')]('/',auth[_0xa5e3('0x9')](),controller[_0xa5e3('0xa')]);router['get'](_0xa5e3('0xb'),auth[_0xa5e3('0x9')](),controller[_0xa5e3('0xc')]);router[_0xa5e3('0xd')]('/',auth[_0xa5e3('0x9')](),controller['create']);router[_0xa5e3('0xe')](_0xa5e3('0xb'),auth[_0xa5e3('0x9')](),controller[_0xa5e3('0xf')]);router[_0xa5e3('0x10')](_0xa5e3('0xb'),auth[_0xa5e3('0x9')](),controller[_0xa5e3('0x11')]);module[_0xa5e3('0x12')]=router; \ No newline at end of file +var _0xff8a=['index','get','/:id','isAuthenticated','show','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x3d231f,_0x53e2e3){var _0x523e67=function(_0x233540){while(--_0x233540){_0x3d231f['push'](_0x3d231f['shift']());}};_0x523e67(++_0x53e2e3);}(_0xff8a,0x98));var _0xaff8=function(_0x51123f,_0x4ec586){_0x51123f=_0x51123f-0x0;var _0x2d26c3=_0xff8a[_0x51123f];return _0x2d26c3;};'use strict';var multer=require(_0xaff8('0x0'));var util=require(_0xaff8('0x1'));var path=require(_0xaff8('0x2'));var timeout=require(_0xaff8('0x3'));var express=require(_0xaff8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaff8('0x5'));var config=require(_0xaff8('0x6'));var controller=require(_0xaff8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xaff8('0x8')]);router[_0xaff8('0x9')](_0xaff8('0xa'),auth[_0xaff8('0xb')](),controller[_0xaff8('0xc')]);router['post']('/',auth[_0xaff8('0xb')](),controller['create']);router['put'](_0xaff8('0xa'),auth[_0xaff8('0xb')](),controller[_0xaff8('0xd')]);router[_0xaff8('0xe')](_0xaff8('0xa'),auth[_0xaff8('0xb')](),controller[_0xaff8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 44d03e1..c655b52 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 _0x0193=['options','join','getDataValue','BOOLEAN','sequelize','STRING','name','setDataValue'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x0193,0x14c));var _0x3019=function(_0x15d32d,_0x315459){_0x15d32d=_0x15d32d-0x0;var _0x2695cb=_0x0193[_0x15d32d];return _0x2695cb;};'use strict';var Sequelize=require(_0x3019('0x0'));module['exports']={'name':{'type':Sequelize[_0x3019('0x1')]},'prefix':{'type':Sequelize[_0x3019('0x1')],'unique':_0x3019('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x3019('0x1')],'set':function(_0x248737){this[_0x3019('0x3')](_0x3019('0x4'),_0x248737?_0x248737[_0x3019('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x3019('0x4'))?this[_0x3019('0x6')](_0x3019('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x3019('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x3019('0x1')]},'record':{'type':Sequelize[_0x3019('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5c36=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','options','join'];(function(_0x99cc3,_0x5abfb6){var _0x1e1b9c=function(_0x4be959){while(--_0x4be959){_0x99cc3['push'](_0x99cc3['shift']());}};_0x1e1b9c(++_0x5abfb6);}(_0x5c36,0x1d7));var _0x65c3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5c36[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x65c3('0x0'));module[_0x65c3('0x1')]={'name':{'type':Sequelize[_0x65c3('0x2')]},'prefix':{'type':Sequelize[_0x65c3('0x2')],'unique':_0x65c3('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0xf582a1){this['setDataValue'](_0x65c3('0x4'),_0xf582a1?_0xf582a1[_0x65c3('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x65c3('0x4'))?this[_0x65c3('0x6')](_0x65c3('0x4'))[_0x65c3('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x65c3('0x2')]},'record':{'type':Sequelize[_0x65c3('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x65c3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2ad732e..9872d4b 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 _0xf46a=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0xf46a,0xa4));var _0xaf46=function(_0x339bcf,_0x2d5b55){_0x339bcf=_0x339bcf-0x0;var _0x3db866=_0xf46a[_0x339bcf];return _0x3db866;};'use strict';var emlformat=require(_0xaf46('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf46('0x1'));var jsonpatch=require(_0xaf46('0x2'));var rp=require('request-promise');var moment=require(_0xaf46('0x3'));var BPromise=require(_0xaf46('0x4'));var Mustache=require(_0xaf46('0x5'));var util=require(_0xaf46('0x6'));var path=require(_0xaf46('0x7'));var sox=require(_0xaf46('0x8'));var csv=require(_0xaf46('0x9'));var ejs=require(_0xaf46('0xa'));var fs=require('fs');var fs_extra=require(_0xaf46('0xb'));var _=require(_0xaf46('0xc'));var squel=require(_0xaf46('0xd'));var crypto=require(_0xaf46('0xe'));var jsforce=require(_0xaf46('0xf'));var deskjs=require(_0xaf46('0x10'));var toCsv=require('to-csv');var querystring=require(_0xaf46('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaf46('0x12'));var as=require(_0xaf46('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf46('0x14'))(_0xaf46('0x15'));var utils=require(_0xaf46('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xaf46('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x356c69,_0x54fd90){_0x54fd90=_0x54fd90||0xcc;return function(_0x18e367){if(_0x18e367){return _0x356c69['sendStatus'](_0x54fd90);}return _0x356c69[_0xaf46('0x18')](_0x54fd90)[_0xaf46('0x19')]();};}function respondWithResult(_0xf43dde,_0x38f7da){_0x38f7da=_0x38f7da||0xc8;return function(_0x453a9a){if(_0x453a9a){return _0xf43dde[_0xaf46('0x18')](_0x38f7da)[_0xaf46('0x1a')](_0x453a9a);}};}function respondWithFilteredResult(_0x1b961d,_0x548bfd){return function(_0x4e2279){if(_0x4e2279){var _0x5819e3=typeof _0x548bfd[_0xaf46('0x1b')]==='undefined'&&typeof _0x548bfd['limit']===_0xaf46('0x1c');var _0x34b107=_0x4e2279['count'];var _0x128ad8=_0x5819e3?0x0:_0x548bfd[_0xaf46('0x1b')];var _0x224413=_0x5819e3?_0x4e2279[_0xaf46('0x1d')]:_0x548bfd[_0xaf46('0x1b')]+_0x548bfd[_0xaf46('0x1e')];var _0x52e5c8;if(_0x224413>=_0x34b107){_0x224413=_0x34b107;_0x52e5c8=0xc8;}else{_0x52e5c8=0xce;}_0x1b961d[_0xaf46('0x18')](_0x52e5c8);return _0x1b961d[_0xaf46('0x1f')]('Content-Range',_0x128ad8+'-'+_0x224413+'/'+_0x34b107)[_0xaf46('0x1a')](_0x4e2279);}return null;};}function patchUpdates(_0x4459d5){return function(_0x5edf46){try{jsonpatch['apply'](_0x5edf46,_0x4459d5,!![]);}catch(_0x535ef1){return BPromise[_0xaf46('0x20')](_0x535ef1);}return _0x5edf46[_0xaf46('0x21')]();};}function saveUpdates(_0x4d1c36,_0x183cb6){return function(_0x539489){if(_0x539489){return _0x539489[_0xaf46('0x22')](_0x4d1c36)[_0xaf46('0x23')](function(_0x4759bb){return _0x4759bb;});}return null;};}function removeEntity(_0x9ec76,_0x442797){return function(_0x39946c){if(_0x39946c){return _0x39946c[_0xaf46('0x24')]()[_0xaf46('0x23')](function(){var _0xabed9f=_0x39946c[_0xaf46('0x25')]({'plain':!![]});var _0x4fa802='ChanSpies';return db[_0xaf46('0x26')][_0xaf46('0x24')]({'where':{'type':_0x4fa802,'resourceId':_0xabed9f['id']}})[_0xaf46('0x23')](function(){return _0x39946c;});})[_0xaf46('0x23')](function(){_0x9ec76[_0xaf46('0x18')](0xcc)[_0xaf46('0x19')]();});}};}function handleEntityNotFound(_0x2b4c69,_0x2363c4){return function(_0x5aa8af){if(!_0x5aa8af){_0x2b4c69[_0xaf46('0x27')](0x194);}return _0x5aa8af;};}function handleError(_0x15c047,_0x4d49c1){_0x4d49c1=_0x4d49c1||0x1f4;return function(_0x1cee17){logger[_0xaf46('0x28')](_0x1cee17[_0xaf46('0x29')]);if(_0x1cee17[_0xaf46('0x2a')]){delete _0x1cee17[_0xaf46('0x2a')];}_0x15c047[_0xaf46('0x18')](_0x4d49c1)['send'](_0x1cee17);};}exports[_0xaf46('0x2b')]=function(_0x15cba5,_0x5eb4e1){var _0x7bd7f3={},_0x3d9c3d={},_0x242278={'count':0x0,'rows':[]};var _0x2de249=_[_0xaf46('0x2c')](db[_0xaf46('0x2d')][_0xaf46('0x2e')],function(_0x27b76f){return{'name':_0x27b76f[_0xaf46('0x2f')],'type':_0x27b76f[_0xaf46('0x30')][_0xaf46('0x31')]};});_0x3d9c3d['model']=_[_0xaf46('0x2c')](_0x2de249,'name');_0x3d9c3d[_0xaf46('0x32')]=_[_0xaf46('0x33')](_0x15cba5[_0xaf46('0x32')]);_0x3d9c3d[_0xaf46('0x34')]=_['intersection'](_0x3d9c3d[_0xaf46('0x35')],_0x3d9c3d[_0xaf46('0x32')]);_0x7bd7f3[_0xaf46('0x36')]=_[_0xaf46('0x37')](_0x3d9c3d['model'],qs['fields'](_0x15cba5[_0xaf46('0x32')][_0xaf46('0x38')]));_0x7bd7f3[_0xaf46('0x36')]=_0x7bd7f3[_0xaf46('0x36')]['length']?_0x7bd7f3[_0xaf46('0x36')]:_0x3d9c3d[_0xaf46('0x35')];if(!_0x15cba5[_0xaf46('0x32')][_0xaf46('0x39')](_0xaf46('0x3a'))){_0x7bd7f3[_0xaf46('0x1e')]=qs['limit'](_0x15cba5[_0xaf46('0x32')]['limit']);_0x7bd7f3[_0xaf46('0x1b')]=qs[_0xaf46('0x1b')](_0x15cba5['query'][_0xaf46('0x1b')]);}_0x7bd7f3[_0xaf46('0x3b')]=qs[_0xaf46('0x3c')](_0x15cba5[_0xaf46('0x32')][_0xaf46('0x3c')]);_0x7bd7f3['where']=qs[_0xaf46('0x34')](_[_0xaf46('0x3d')](_0x15cba5[_0xaf46('0x32')],_0x3d9c3d['filters']),_0x2de249);if(_0x15cba5[_0xaf46('0x32')]['filter']){_0x7bd7f3[_0xaf46('0x3e')]=_[_0xaf46('0x3f')](_0x7bd7f3['where'],{'$or':_[_0xaf46('0x2c')](_0x2de249,function(_0x4743dc){if(_0x4743dc[_0xaf46('0x30')]!==_0xaf46('0x40')){var _0x1d9a56={};_0x1d9a56[_0x4743dc[_0xaf46('0x2a')]]={'$like':'%'+_0x15cba5[_0xaf46('0x32')][_0xaf46('0x41')]+'%'};return _0x1d9a56;}})});}_0x7bd7f3=_[_0xaf46('0x3f')]({},_0x7bd7f3,_0x15cba5[_0xaf46('0x42')]);var _0x470583={'where':_0x7bd7f3[_0xaf46('0x3e')]};return db[_0xaf46('0x2d')][_0xaf46('0x1d')](_0x470583)[_0xaf46('0x23')](function(_0x408499){_0x242278[_0xaf46('0x1d')]=_0x408499;if(_0x15cba5[_0xaf46('0x32')][_0xaf46('0x43')]){_0x7bd7f3[_0xaf46('0x44')]=[{'all':!![]}];}return db[_0xaf46('0x2d')][_0xaf46('0x45')](_0x7bd7f3);})['then'](function(_0x3e601e){_0x242278['rows']=_0x3e601e;return _0x242278;})[_0xaf46('0x23')](respondWithFilteredResult(_0x5eb4e1,_0x7bd7f3))[_0xaf46('0x46')](handleError(_0x5eb4e1,null));};exports[_0xaf46('0x47')]=function(_0x11ff9d,_0xf8fc88){var _0x3030e5={'raw':![],'where':{'id':_0x11ff9d[_0xaf46('0x48')]['id']}},_0x463ad7={};_0x463ad7[_0xaf46('0x35')]=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x463ad7[_0xaf46('0x32')]=_[_0xaf46('0x33')](_0x11ff9d['query']);_0x463ad7[_0xaf46('0x34')]=_[_0xaf46('0x37')](_0x463ad7[_0xaf46('0x35')],_0x463ad7['query']);_0x3030e5[_0xaf46('0x36')]=_[_0xaf46('0x37')](_0x463ad7[_0xaf46('0x35')],qs[_0xaf46('0x38')](_0x11ff9d[_0xaf46('0x32')]['fields']));_0x3030e5[_0xaf46('0x36')]=_0x3030e5[_0xaf46('0x36')][_0xaf46('0x49')]?_0x3030e5[_0xaf46('0x36')]:_0x463ad7['model'];if(_0x11ff9d[_0xaf46('0x32')][_0xaf46('0x43')]){_0x3030e5['include']=[{'all':!![]}];}_0x3030e5=_[_0xaf46('0x3f')]({},_0x3030e5,_0x11ff9d[_0xaf46('0x42')]);return db[_0xaf46('0x2d')]['find'](_0x3030e5)[_0xaf46('0x23')](handleEntityNotFound(_0xf8fc88,null))[_0xaf46('0x23')](respondWithResult(_0xf8fc88,null))[_0xaf46('0x46')](handleError(_0xf8fc88,null));};exports[_0xaf46('0x4a')]=function(_0x409f9f,_0x512a35){return db[_0xaf46('0x2d')][_0xaf46('0x4a')](_0x409f9f['body'],{})[_0xaf46('0x23')](function(_0x1dd3ea){var _0x2f3402=_0x409f9f[_0xaf46('0x4b')][_0xaf46('0x25')]({'plain':!![]});if(!_0x2f3402)throw new Error(_0xaf46('0x4c'));if(_0x2f3402[_0xaf46('0x4d')]===_0xaf46('0x4b')){var _0x115ffd=_0x1dd3ea[_0xaf46('0x25')]({'plain':!![]});var _0x30d1d2=_0xaf46('0x4e');return db[_0xaf46('0x4f')][_0xaf46('0x50')]({'where':{'name':_0x30d1d2,'userProfileId':_0x2f3402[_0xaf46('0x51')]},'raw':!![]})[_0xaf46('0x23')](function(_0x58b631){if(_0x58b631&&_0x58b631[_0xaf46('0x52')]===0x0){return db[_0xaf46('0x26')]['create']({'name':_0x115ffd['name'],'resourceId':_0x115ffd['id'],'type':_0x58b631[_0xaf46('0x2a')],'sectionId':_0x58b631['id']},{})[_0xaf46('0x23')](function(){return _0x1dd3ea;});}else{return _0x1dd3ea;}})[_0xaf46('0x46')](function(_0x5a819e){logger[_0xaf46('0x28')](_0xaf46('0x53'),_0x5a819e);throw _0x5a819e;});}return _0x1dd3ea;})[_0xaf46('0x23')](respondWithResult(_0x512a35,0xc9))['catch'](handleError(_0x512a35,null));};exports[_0xaf46('0x22')]=function(_0x33b3bb,_0x32d900){if(_0x33b3bb[_0xaf46('0x54')]['id']){delete _0x33b3bb['body']['id'];}return db[_0xaf46('0x2d')][_0xaf46('0x50')]({'where':{'id':_0x33b3bb[_0xaf46('0x48')]['id']}})[_0xaf46('0x23')](handleEntityNotFound(_0x32d900,null))[_0xaf46('0x23')](saveUpdates(_0x33b3bb[_0xaf46('0x54')],null))['then'](respondWithResult(_0x32d900,null))[_0xaf46('0x46')](handleError(_0x32d900,null));};exports[_0xaf46('0x24')]=function(_0x8f83b6,_0x42385b){return db[_0xaf46('0x2d')]['find']({'where':{'id':_0x8f83b6[_0xaf46('0x48')]['id']}})[_0xaf46('0x23')](handleEntityNotFound(_0x42385b,null))[_0xaf46('0x23')](removeEntity(_0x42385b,null))[_0xaf46('0x46')](handleError(_0x42385b,null));}; \ No newline at end of file +var _0xf996=['fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','mustache','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/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','index','map','VoiceChanSpy','rawAttributes'];(function(_0x35fd4a,_0x46ec2c){var _0x48ea56=function(_0x53b91a){while(--_0x53b91a){_0x35fd4a['push'](_0x35fd4a['shift']());}};_0x48ea56(++_0x46ec2c);}(_0xf996,0x74));var _0x6f99=function(_0x37fa39,_0x3656d1){_0x37fa39=_0x37fa39-0x0;var _0x344b41=_0xf996[_0x37fa39];return _0x344b41;};'use strict';var emlformat=require(_0x6f99('0x0'));var rimraf=require(_0x6f99('0x1'));var zipdir=require(_0x6f99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6f99('0x4'));var util=require(_0x6f99('0x5'));var path=require(_0x6f99('0x6'));var sox=require(_0x6f99('0x7'));var csv=require(_0x6f99('0x8'));var ejs=require(_0x6f99('0x9'));var fs=require('fs');var fs_extra=require(_0x6f99('0xa'));var _=require(_0x6f99('0xb'));var squel=require(_0x6f99('0xc'));var crypto=require(_0x6f99('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6f99('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f99('0xf'));var Papa=require(_0x6f99('0x10'));var Redis=require(_0x6f99('0x11'));var authService=require(_0x6f99('0x12'));var qs=require(_0x6f99('0x13'));var as=require(_0x6f99('0x14'));var hardwareService=require(_0x6f99('0x15'));var logger=require(_0x6f99('0x16'))(_0x6f99('0x17'));var utils=require('../../config/utils');var config=require(_0x6f99('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55e7f0,_0x12081d){_0x12081d=_0x12081d||0xcc;return function(_0xa1af95){if(_0xa1af95){return _0x55e7f0[_0x6f99('0x19')](_0x12081d);}return _0x55e7f0[_0x6f99('0x1a')](_0x12081d)[_0x6f99('0x1b')]();};}function respondWithResult(_0x7aea00,_0xf5d4df){_0xf5d4df=_0xf5d4df||0xc8;return function(_0xb9874a){if(_0xb9874a){return _0x7aea00[_0x6f99('0x1a')](_0xf5d4df)[_0x6f99('0x1c')](_0xb9874a);}};}function respondWithFilteredResult(_0x1534e9,_0x1c7733){return function(_0x537f3d){if(_0x537f3d){var _0x293937=typeof _0x1c7733[_0x6f99('0x1d')]==='undefined'&&typeof _0x1c7733['limit']===_0x6f99('0x1e');var _0x5b3638=_0x537f3d[_0x6f99('0x1f')];var _0x210360=_0x293937?0x0:_0x1c7733[_0x6f99('0x1d')];var _0x25d50b=_0x293937?_0x537f3d[_0x6f99('0x1f')]:_0x1c7733['offset']+_0x1c7733[_0x6f99('0x20')];var _0x5377cb;if(_0x25d50b>=_0x5b3638){_0x25d50b=_0x5b3638;_0x5377cb=0xc8;}else{_0x5377cb=0xce;}_0x1534e9[_0x6f99('0x1a')](_0x5377cb);return _0x1534e9[_0x6f99('0x21')](_0x6f99('0x22'),_0x210360+'-'+_0x25d50b+'/'+_0x5b3638)[_0x6f99('0x1c')](_0x537f3d);}return null;};}function patchUpdates(_0x1dc9e5){return function(_0xf66bde){try{jsonpatch['apply'](_0xf66bde,_0x1dc9e5,!![]);}catch(_0x4c4d00){return BPromise[_0x6f99('0x23')](_0x4c4d00);}return _0xf66bde[_0x6f99('0x24')]();};}function saveUpdates(_0x4974ff,_0x497fd7){return function(_0x1d4dc3){if(_0x1d4dc3){return _0x1d4dc3[_0x6f99('0x25')](_0x4974ff)[_0x6f99('0x26')](function(_0xe3e6ab){return _0xe3e6ab;});}return null;};}function removeEntity(_0x290c88,_0x1174a2){return function(_0x2e7b94){if(_0x2e7b94){return _0x2e7b94[_0x6f99('0x27')]()[_0x6f99('0x26')](function(){var _0x41a60b=_0x2e7b94[_0x6f99('0x28')]({'plain':!![]});var _0x1f8078=_0x6f99('0x29');return db[_0x6f99('0x2a')]['destroy']({'where':{'type':_0x1f8078,'resourceId':_0x41a60b['id']}})[_0x6f99('0x26')](function(){return _0x2e7b94;});})[_0x6f99('0x26')](function(){_0x290c88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7eef41,_0x306ece){return function(_0x53f045){if(!_0x53f045){_0x7eef41[_0x6f99('0x19')](0x194);}return _0x53f045;};}function handleError(_0x3e56f5,_0x53ab0e){_0x53ab0e=_0x53ab0e||0x1f4;return function(_0x45fe22){logger[_0x6f99('0x2b')](_0x45fe22['stack']);if(_0x45fe22[_0x6f99('0x2c')]){delete _0x45fe22[_0x6f99('0x2c')];}_0x3e56f5[_0x6f99('0x1a')](_0x53ab0e)[_0x6f99('0x2d')](_0x45fe22);};}exports[_0x6f99('0x2e')]=function(_0x106292,_0x4aa40c){var _0xeb62a8={},_0x1972f0={},_0x5e8286={'count':0x0,'rows':[]};var _0x59abff=_[_0x6f99('0x2f')](db[_0x6f99('0x30')][_0x6f99('0x31')],function(_0x2d99cf){return{'name':_0x2d99cf[_0x6f99('0x32')],'type':_0x2d99cf[_0x6f99('0x33')]['key']};});_0x1972f0['model']=_[_0x6f99('0x2f')](_0x59abff,_0x6f99('0x2c'));_0x1972f0[_0x6f99('0x34')]=_[_0x6f99('0x35')](_0x106292[_0x6f99('0x34')]);_0x1972f0[_0x6f99('0x36')]=_[_0x6f99('0x37')](_0x1972f0[_0x6f99('0x38')],_0x1972f0[_0x6f99('0x34')]);_0xeb62a8[_0x6f99('0x39')]=_[_0x6f99('0x37')](_0x1972f0['model'],qs[_0x6f99('0x3a')](_0x106292[_0x6f99('0x34')][_0x6f99('0x3a')]));_0xeb62a8[_0x6f99('0x39')]=_0xeb62a8[_0x6f99('0x39')]['length']?_0xeb62a8[_0x6f99('0x39')]:_0x1972f0[_0x6f99('0x38')];if(!_0x106292['query'][_0x6f99('0x3b')](_0x6f99('0x3c'))){_0xeb62a8[_0x6f99('0x20')]=qs[_0x6f99('0x20')](_0x106292[_0x6f99('0x34')][_0x6f99('0x20')]);_0xeb62a8[_0x6f99('0x1d')]=qs[_0x6f99('0x1d')](_0x106292['query'][_0x6f99('0x1d')]);}_0xeb62a8['order']=qs[_0x6f99('0x3d')](_0x106292[_0x6f99('0x34')][_0x6f99('0x3d')]);_0xeb62a8[_0x6f99('0x3e')]=qs['filters'](_[_0x6f99('0x3f')](_0x106292['query'],_0x1972f0[_0x6f99('0x36')]),_0x59abff);if(_0x106292[_0x6f99('0x34')][_0x6f99('0x40')]){_0xeb62a8[_0x6f99('0x3e')]=_[_0x6f99('0x41')](_0xeb62a8[_0x6f99('0x3e')],{'$or':_[_0x6f99('0x2f')](_0x59abff,function(_0x5c1fa1){if(_0x5c1fa1[_0x6f99('0x33')]!==_0x6f99('0x42')){var _0x2f489a={};_0x2f489a[_0x5c1fa1['name']]={'$like':'%'+_0x106292[_0x6f99('0x34')][_0x6f99('0x40')]+'%'};return _0x2f489a;}})});}_0xeb62a8=_[_0x6f99('0x41')]({},_0xeb62a8,_0x106292[_0x6f99('0x43')]);var _0x184ad5={'where':_0xeb62a8[_0x6f99('0x3e')]};return db[_0x6f99('0x30')][_0x6f99('0x1f')](_0x184ad5)['then'](function(_0x206bc8){_0x5e8286['count']=_0x206bc8;if(_0x106292[_0x6f99('0x34')][_0x6f99('0x44')]){_0xeb62a8['include']=[{'all':!![]}];}return db[_0x6f99('0x30')][_0x6f99('0x45')](_0xeb62a8);})[_0x6f99('0x26')](function(_0x1fd388){_0x5e8286['rows']=_0x1fd388;return _0x5e8286;})[_0x6f99('0x26')](respondWithFilteredResult(_0x4aa40c,_0xeb62a8))[_0x6f99('0x46')](handleError(_0x4aa40c,null));};exports[_0x6f99('0x47')]=function(_0x4d1c06,_0xd3ba18){var _0x173d11={'raw':![],'where':{'id':_0x4d1c06[_0x6f99('0x48')]['id']}},_0x10f883={};_0x10f883[_0x6f99('0x38')]=_[_0x6f99('0x35')](db[_0x6f99('0x30')][_0x6f99('0x31')]);_0x10f883['query']=_[_0x6f99('0x35')](_0x4d1c06['query']);_0x10f883[_0x6f99('0x36')]=_['intersection'](_0x10f883[_0x6f99('0x38')],_0x10f883[_0x6f99('0x34')]);_0x173d11[_0x6f99('0x39')]=_[_0x6f99('0x37')](_0x10f883[_0x6f99('0x38')],qs[_0x6f99('0x3a')](_0x4d1c06[_0x6f99('0x34')]['fields']));_0x173d11[_0x6f99('0x39')]=_0x173d11[_0x6f99('0x39')]['length']?_0x173d11[_0x6f99('0x39')]:_0x10f883[_0x6f99('0x38')];if(_0x4d1c06[_0x6f99('0x34')][_0x6f99('0x44')]){_0x173d11[_0x6f99('0x49')]=[{'all':!![]}];}_0x173d11=_['merge']({},_0x173d11,_0x4d1c06[_0x6f99('0x43')]);return db[_0x6f99('0x30')][_0x6f99('0x4a')](_0x173d11)[_0x6f99('0x26')](handleEntityNotFound(_0xd3ba18,null))[_0x6f99('0x26')](respondWithResult(_0xd3ba18,null))[_0x6f99('0x46')](handleError(_0xd3ba18,null));};exports[_0x6f99('0x4b')]=function(_0x20c80d,_0x2c6cd8){return db[_0x6f99('0x30')][_0x6f99('0x4b')](_0x20c80d[_0x6f99('0x4c')],{})['then'](function(_0x3c0609){var _0x1aa396=_0x20c80d[_0x6f99('0x4d')][_0x6f99('0x28')]({'plain':!![]});if(!_0x1aa396)throw new Error(_0x6f99('0x4e'));if(_0x1aa396[_0x6f99('0x4f')]==='user'){var _0x321944=_0x3c0609[_0x6f99('0x28')]({'plain':!![]});var _0x5b5486=_0x6f99('0x29');return db[_0x6f99('0x50')][_0x6f99('0x4a')]({'where':{'name':_0x5b5486,'userProfileId':_0x1aa396[_0x6f99('0x51')]},'raw':!![]})[_0x6f99('0x26')](function(_0x5502fa){if(_0x5502fa&&_0x5502fa['autoAssociation']===0x0){return db[_0x6f99('0x2a')]['create']({'name':_0x321944[_0x6f99('0x2c')],'resourceId':_0x321944['id'],'type':_0x5502fa[_0x6f99('0x2c')],'sectionId':_0x5502fa['id']},{})[_0x6f99('0x26')](function(){return _0x3c0609;});}else{return _0x3c0609;}})[_0x6f99('0x46')](function(_0xbd1caf){logger['error'](_0x6f99('0x52'),_0xbd1caf);throw _0xbd1caf;});}return _0x3c0609;})[_0x6f99('0x26')](respondWithResult(_0x2c6cd8,0xc9))[_0x6f99('0x46')](handleError(_0x2c6cd8,null));};exports[_0x6f99('0x25')]=function(_0x52ee44,_0x1743c6){if(_0x52ee44[_0x6f99('0x4c')]['id']){delete _0x52ee44[_0x6f99('0x4c')]['id'];}return db[_0x6f99('0x30')][_0x6f99('0x4a')]({'where':{'id':_0x52ee44[_0x6f99('0x48')]['id']}})[_0x6f99('0x26')](handleEntityNotFound(_0x1743c6,null))[_0x6f99('0x26')](saveUpdates(_0x52ee44['body'],null))[_0x6f99('0x26')](respondWithResult(_0x1743c6,null))[_0x6f99('0x46')](handleError(_0x1743c6,null));};exports[_0x6f99('0x27')]=function(_0x4ac3b3,_0x5e269b){return db[_0x6f99('0x30')]['find']({'where':{'id':_0x4ac3b3[_0x6f99('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e269b,null))[_0x6f99('0x26')](removeEntity(_0x5e269b,null))[_0x6f99('0x46')](handleError(_0x5e269b,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d29f78c..fe25619 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 _0xb7ca=['concat','internal','User','findAll','catch','exports','models','then','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','length'];(function(_0x5eab15,_0x1027f9){var _0x570ec8=function(_0x3be77a){while(--_0x3be77a){_0x5eab15['push'](_0x5eab15['shift']());}};_0x570ec8(++_0x1027f9);}(_0xb7ca,0x14e));var _0xab7c=function(_0x2d29a9,_0x2a792d){_0x2d29a9=_0x2d29a9-0x0;var _0x96cf34=_0xb7ca[_0x2d29a9];return _0x96cf34;};'use strict';var _=require(_0xab7c('0x0'));var util=require(_0xab7c('0x1'));var BPromise=require(_0xab7c('0x2'));var attributes=require(_0xab7c('0x3'));var getUserApplications=function(_0x348fb2,_0x314a37,_0x521c85){var _0x73bd81=0x1;var _0x29ac0c=[];var _0x20d1ca={'context':_0x314a37[_0xab7c('0x4')]||_0xab7c('0x5'),'exten':util[_0xab7c('0x6')](_0xab7c('0x7'),_0x348fb2[_0xab7c('0x8')],_0x521c85),'type':_0xab7c('0x9'),'isApp':![],'ChanSpyId':_0x348fb2['id'],'UserId':_0x314a37['id']};_0x29ac0c[_0xab7c('0xa')](_['merge']({'app':_0xab7c('0xb'),'appdata':util[_0xab7c('0x6')](_0xab7c('0xc'),_0xab7c('0xd')),'priority':_0x73bd81++},_0x20d1ca));if(_0x348fb2[_0xab7c('0xe')]){_0x29ac0c[_0xab7c('0xa')](_[_0xab7c('0xf')]({'app':_0xab7c('0x10'),'appdata':util[_0xab7c('0x6')](_0xab7c('0x11'),_0x348fb2['recordingFormat']),'priority':_0x73bd81++},_0x20d1ca));}if(_0x348fb2['auth']){_0x29ac0c[_0xab7c('0xa')](_[_0xab7c('0xf')]({'app':_0xab7c('0x12'),'appdata':_0x348fb2[_0xab7c('0x13')],'priority':_0x73bd81++},_0x20d1ca));}_0x29ac0c[_0xab7c('0xa')](_['merge']({'app':_0xab7c('0x14'),'appdata':util[_0xab7c('0x6')]('SIP/%s,%s',_0x314a37[_0xab7c('0x15')],_0x348fb2['options']?_0x348fb2[_0xab7c('0x16')][_0xab7c('0x17')](''):''),'priority':_0x73bd81++},_0x20d1ca));if(_0x348fb2[_0xab7c('0xe')]){_0x29ac0c[_0xab7c('0xa')](_[_0xab7c('0xf')]({'app':_0xab7c('0x18'),'priority':_0x73bd81++},_0x20d1ca));}return _0x29ac0c;};var getChanSpyApplications=function(_0x4a53c7,_0x377d7a){var _0x12b05a=[];for(var _0x517ae7=0x0,_0x386db8=0x1;_0x517ae7<_0x377d7a[_0xab7c('0x19')];_0x517ae7++,_0x386db8=0x1){_0x12b05a=_0x12b05a[_0xab7c('0x1a')](getUserApplications(_0x4a53c7,_0x377d7a[_0x517ae7],_0x377d7a[_0x517ae7]['internal']));if(_0x377d7a[_0x517ae7][_0xab7c('0x1b')]!=_0x377d7a[_0x517ae7][_0xab7c('0x15')]){_0x12b05a=_0x12b05a[_0xab7c('0x1a')](getUserApplications(_0x4a53c7,_0x377d7a[_0x517ae7],_0x377d7a[_0x517ae7][_0xab7c('0x15')]));}}return _0x12b05a;};var getChanSpyPromise=function(_0x53dc56,_0x5489d1){return new BPromise(function(_0x2a083f,_0x2259b0){return _0x53dc56[_0xab7c('0x1c')][_0xab7c('0x1d')]({'attributes':['id',_0xab7c('0x15'),_0xab7c('0x1b')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x514508){if(_0x514508){return _0x2a083f(getChanSpyApplications(_0x5489d1,_0x514508));}return _0x2a083f([]);})[_0xab7c('0x1e')](function(_0x351d45){_0x2259b0(_0x351d45);});});};module[_0xab7c('0x1f')]=function(_0x4c88e6,_0x51090b){var _0x52a761=_0x4c88e6[_0xab7c('0x20')];return _0x4c88e6['define']('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a23aa,_0x4d4eec,_0x41090b){return getChanSpyPromise(_0x52a761,_0x3a23aa)[_0xab7c('0x21')](function(_0x454e30){if(_0x454e30&&_0x454e30[_0xab7c('0x19')]){return _0x52a761[_0xab7c('0x22')][_0xab7c('0x23')](_0x454e30);}})[_0xab7c('0x21')](function(){_0x41090b();})[_0xab7c('0x1e')](function(_0x6721d7){_0x41090b(_0x6721d7);});},'afterUpdate':function(_0x32cbfa,_0x4474e7,_0x49e384){return _0x52a761[_0xab7c('0x22')]['destroy']({'where':{'ChanSpyId':_0x32cbfa['id']}})['then'](function(){return getChanSpyPromise(_0x52a761,_0x32cbfa);})[_0xab7c('0x21')](function(_0x1543ee){if(_0x1543ee&&_0x1543ee[_0xab7c('0x19')]){return _0x52a761[_0xab7c('0x22')]['bulkCreate'](_0x1543ee);}})[_0xab7c('0x21')](function(){_0x49e384();})[_0xab7c('0x1e')](function(_0x314523){_0x49e384(_0x314523);});},'afterDestroy':function(_0x3281a6,_0x32301d,_0x4afa3d){return _0x52a761[_0xab7c('0x22')]['destroy']({'where':{'ChanSpyId':_0x3281a6['id']}})[_0xab7c('0x21')](function(){_0x4afa3d();})[_0xab7c('0x1e')](function(_0x48fb1f){_0x4afa3d(_0x48fb1f);});}}});}; \ No newline at end of file +var _0xf98b=['User','findAll','agent','then','catch','exports','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','context','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','SIP/%s,%s','name','options','join','length','concat','internal'];(function(_0x40ed0c,_0x4e9155){var _0x3946e9=function(_0x4eb3bb){while(--_0x4eb3bb){_0x40ed0c['push'](_0x40ed0c['shift']());}};_0x3946e9(++_0x4e9155);}(_0xf98b,0x1a1));var _0xbf98=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xf98b[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xbf98('0x0'));var util=require(_0xbf98('0x1'));var BPromise=require(_0xbf98('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x38c224,_0x44a2f3,_0x24bed4){var _0x5cb5e4=0x1;var _0x211ad0=[];var _0x1ba1a8={'context':_0x44a2f3[_0xbf98('0x3')]||_0xbf98('0x4'),'exten':util['format'](_0xbf98('0x5'),_0x38c224[_0xbf98('0x6')],_0x24bed4),'type':_0xbf98('0x7'),'isApp':![],'ChanSpyId':_0x38c224['id'],'UserId':_0x44a2f3['id']};_0x211ad0[_0xbf98('0x8')](_[_0xbf98('0x9')]({'app':_0xbf98('0xa'),'appdata':util[_0xbf98('0xb')](_0xbf98('0xc'),_0xbf98('0xd')),'priority':_0x5cb5e4++},_0x1ba1a8));if(_0x38c224[_0xbf98('0xe')]){_0x211ad0[_0xbf98('0x8')](_['merge']({'app':_0xbf98('0xf'),'appdata':util[_0xbf98('0xb')](_0xbf98('0x10'),_0x38c224[_0xbf98('0x11')]),'priority':_0x5cb5e4++},_0x1ba1a8));}if(_0x38c224['auth']){_0x211ad0['push'](_[_0xbf98('0x9')]({'app':_0xbf98('0x12'),'appdata':_0x38c224[_0xbf98('0x13')],'priority':_0x5cb5e4++},_0x1ba1a8));}_0x211ad0['push'](_[_0xbf98('0x9')]({'app':'ChanSpy','appdata':util[_0xbf98('0xb')](_0xbf98('0x14'),_0x44a2f3[_0xbf98('0x15')],_0x38c224[_0xbf98('0x16')]?_0x38c224[_0xbf98('0x16')][_0xbf98('0x17')](''):''),'priority':_0x5cb5e4++},_0x1ba1a8));if(_0x38c224['record']){_0x211ad0[_0xbf98('0x8')](_[_0xbf98('0x9')]({'app':'StopMixMonitor','priority':_0x5cb5e4++},_0x1ba1a8));}return _0x211ad0;};var getChanSpyApplications=function(_0x320cb2,_0x319d8f){var _0x35f94b=[];for(var _0x2797c4=0x0,_0x309f9c=0x1;_0x2797c4<_0x319d8f[_0xbf98('0x18')];_0x2797c4++,_0x309f9c=0x1){_0x35f94b=_0x35f94b[_0xbf98('0x19')](getUserApplications(_0x320cb2,_0x319d8f[_0x2797c4],_0x319d8f[_0x2797c4][_0xbf98('0x1a')]));if(_0x319d8f[_0x2797c4]['internal']!=_0x319d8f[_0x2797c4][_0xbf98('0x15')]){_0x35f94b=_0x35f94b[_0xbf98('0x19')](getUserApplications(_0x320cb2,_0x319d8f[_0x2797c4],_0x319d8f[_0x2797c4][_0xbf98('0x15')]));}}return _0x35f94b;};var getChanSpyPromise=function(_0x181b73,_0x5438ed){return new BPromise(function(_0xf83f56,_0x5a0373){return _0x181b73[_0xbf98('0x1b')][_0xbf98('0x1c')]({'attributes':['id',_0xbf98('0x15'),'internal'],'where':{'role':_0xbf98('0x1d'),'chanspy':!![]},'raw':!![]})[_0xbf98('0x1e')](function(_0x35124f){if(_0x35124f){return _0xf83f56(getChanSpyApplications(_0x5438ed,_0x35124f));}return _0xf83f56([]);})[_0xbf98('0x1f')](function(_0x3b06ef){_0x5a0373(_0x3b06ef);});});};module[_0xbf98('0x20')]=function(_0x5e2a06,_0x1b8df0){var _0x12a41f=_0x5e2a06['models'];return _0x5e2a06['define']('VoiceChanSpy',attributes,{'tableName':_0xbf98('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fc3b7,_0xb3766c,_0x5629b4){return getChanSpyPromise(_0x12a41f,_0x4fc3b7)['then'](function(_0x2a728b){if(_0x2a728b&&_0x2a728b[_0xbf98('0x18')]){return _0x12a41f[_0xbf98('0x22')][_0xbf98('0x23')](_0x2a728b);}})['then'](function(){_0x5629b4();})[_0xbf98('0x1f')](function(_0x4bfbbb){_0x5629b4(_0x4bfbbb);});},'afterUpdate':function(_0x26ea69,_0x51acd5,_0x1fb083){return _0x12a41f['VoiceExtension'][_0xbf98('0x24')]({'where':{'ChanSpyId':_0x26ea69['id']}})[_0xbf98('0x1e')](function(){return getChanSpyPromise(_0x12a41f,_0x26ea69);})[_0xbf98('0x1e')](function(_0x1a3877){if(_0x1a3877&&_0x1a3877['length']){return _0x12a41f['VoiceExtension'][_0xbf98('0x23')](_0x1a3877);}})[_0xbf98('0x1e')](function(){_0x1fb083();})['catch'](function(_0x241926){_0x1fb083(_0x241926);});},'afterDestroy':function(_0x3855d5,_0x2a75bc,_0x3cf07e){return _0x12a41f[_0xbf98('0x22')][_0xbf98('0x24')]({'where':{'ChanSpyId':_0x3855d5['id']}})[_0xbf98('0x1e')](function(){_0x3cf07e();})[_0xbf98('0x1f')](function(_0x1600e8){_0x3cf07e(_0x1600e8);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 67b6446..febdc26 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 _0x9348=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3e1a10,_0x6aeaf2){var _0x2fb8ee=function(_0x473aa3){while(--_0x473aa3){_0x3e1a10['push'](_0x3e1a10['shift']());}};_0x2fb8ee(++_0x6aeaf2);}(_0x9348,0x10d));var _0x8934=function(_0x2305af,_0x5aa8a3){_0x2305af=_0x2305af-0x0;var _0x522830=_0x9348[_0x2305af];return _0x522830;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee9b9,_0x512f30,_0x284a62){return new BPromise(function(_0x3734c5,_0x1c7f03){return client['request'](_0x3ee9b9,_0x284a62)['then'](function(_0x5ec16d){logger['info'](_0x8934('0xc'),_0x512f30,'request\x20sent');logger[_0x8934('0xd')](_0x8934('0xe'),_0x512f30,_0x8934('0xf'),JSON[_0x8934('0x10')](_0x5ec16d));if(_0x5ec16d[_0x8934('0x11')]){if(_0x5ec16d[_0x8934('0x11')][_0x8934('0x12')]===0x1f4){logger[_0x8934('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x512f30,_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);return _0x1c7f03(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0x5ec16d['error'][_0x8934('0x13')]);return _0x3734c5(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}else{logger[_0x8934('0x14')](_0x8934('0xc'),_0x512f30,_0x8934('0xf'));_0x3734c5(_0x5ec16d[_0x8934('0x15')][_0x8934('0x13')]);}})['catch'](function(_0xb86bc9){logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0xb86bc9);_0x1c7f03(_0xb86bc9);});});} \ No newline at end of file +var _0x9354=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error'];(function(_0x160416,_0x4ea632){var _0x42e62c=function(_0x1ebfea){while(--_0x1ebfea){_0x160416['push'](_0x160416['shift']());}};_0x42e62c(++_0x4ea632);}(_0x9354,0x96));var _0x4935=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0x9354[_0x53a7a8];return _0x555f71;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require(_0x4935('0x2'));var fs=require('fs');var Redis=require(_0x4935('0x3'));var db=require(_0x4935('0x4'))['db'];var utils=require(_0x4935('0x5'));var logger=require('../../config/logger')(_0x4935('0x6'));var config=require(_0x4935('0x7'));var jayson=require(_0x4935('0x8'));var client=jayson[_0x4935('0x9')][_0x4935('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e47bd,_0x118d36,_0x2d735e){return new BPromise(function(_0x10793e,_0x4c9902){return client[_0x4935('0xb')](_0x2e47bd,_0x2d735e)['then'](function(_0x2aac9a){logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));logger[_0x4935('0xf')](_0x4935('0x10'),_0x118d36,'request\x20sent',JSON['stringify'](_0x2aac9a));if(_0x2aac9a[_0x4935('0x11')]){if(_0x2aac9a['error']['code']===0x1f4){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x4c9902(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x10793e(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}else{logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));_0x10793e(_0x2aac9a[_0x4935('0x13')]['message']);}})[_0x4935('0x14')](function(_0x46526a){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x46526a);_0x4c9902(_0x46526a);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8a14e2f..d161fa9 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 _0x13ce=['isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get'];(function(_0x51f810,_0x1c7b49){var _0x8b65e3=function(_0x5930c0){while(--_0x5930c0){_0x51f810['push'](_0x51f810['shift']());}};_0x8b65e3(++_0x1c7b49);}(_0x13ce,0xb3));var _0xe13c=function(_0x4c50b1,_0x1d541c){_0x4c50b1=_0x4c50b1-0x0;var _0x2d67ef=_0x13ce[_0x4c50b1];return _0x2d67ef;};'use strict';var multer=require(_0xe13c('0x0'));var util=require(_0xe13c('0x1'));var path=require(_0xe13c('0x2'));var timeout=require(_0xe13c('0x3'));var express=require(_0xe13c('0x4'));var router=express[_0xe13c('0x5')]();var fs_extra=require(_0xe13c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe13c('0x7'));var config=require(_0xe13c('0x8'));var controller=require(_0xe13c('0x9'));router[_0xe13c('0xa')]('/',auth[_0xe13c('0xb')](),controller['index']);router[_0xe13c('0xa')](_0xe13c('0xc'),auth[_0xe13c('0xb')](),controller[_0xe13c('0xd')]);router[_0xe13c('0xe')]('/',auth[_0xe13c('0xb')](),controller['create']);router[_0xe13c('0xf')](_0xe13c('0xc'),auth[_0xe13c('0xb')](),controller['update']);router[_0xe13c('0x10')](_0xe13c('0xc'),auth[_0xe13c('0xb')](),controller[_0xe13c('0x11')]);module[_0xe13c('0x12')]=router; \ No newline at end of file +var _0x7faf=['post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7faf,0xc0));var _0xf7fa=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7faf[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xf7fa('0x0'));var util=require('util');var path=require(_0xf7fa('0x1'));var timeout=require(_0xf7fa('0x2'));var express=require(_0xf7fa('0x3'));var router=express[_0xf7fa('0x4')]();var fs_extra=require(_0xf7fa('0x5'));var auth=require(_0xf7fa('0x6'));var interaction=require(_0xf7fa('0x7'));var config=require(_0xf7fa('0x8'));var controller=require('./voiceContext.controller');router[_0xf7fa('0x9')]('/',auth[_0xf7fa('0xa')](),controller['index']);router[_0xf7fa('0x9')](_0xf7fa('0xb'),auth[_0xf7fa('0xa')](),controller['show']);router[_0xf7fa('0xc')]('/',auth[_0xf7fa('0xa')](),controller['create']);router[_0xf7fa('0xd')](_0xf7fa('0xb'),auth[_0xf7fa('0xa')](),controller['update']);router[_0xf7fa('0xe')](_0xf7fa('0xb'),auth[_0xf7fa('0xa')](),controller[_0xf7fa('0xf')]);module[_0xf7fa('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 729f4a7..837d827 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 _0x9f7c=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x10f348,_0x3ae338){var _0x301f8e=function(_0x52277b){while(--_0x52277b){_0x10f348['push'](_0x10f348['shift']());}};_0x301f8e(++_0x3ae338);}(_0x9f7c,0x14d));var _0xc9f7=function(_0x42dc13,_0x574323){_0x42dc13=_0x42dc13-0x0;var _0xcb4b9=_0x9f7c[_0x42dc13];return _0xcb4b9;};'use strict';var Sequelize=require(_0xc9f7('0x0'));module[_0xc9f7('0x1')]={'name':{'type':Sequelize[_0xc9f7('0x2')],'unique':_0xc9f7('0x3')},'description':{'type':Sequelize[_0xc9f7('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc9f7('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc59b=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x29b43f,_0x5044f7){var _0x3345d6=function(_0x255521){while(--_0x255521){_0x29b43f['push'](_0x29b43f['shift']());}};_0x3345d6(++_0x5044f7);}(_0xc59b,0xa5));var _0xbc59=function(_0x25baba,_0x883cd0){_0x25baba=_0x25baba-0x0;var _0x5b8208=_0xc59b[_0x25baba];return _0x5b8208;};'use strict';var Sequelize=require(_0xbc59('0x0'));module[_0xbc59('0x1')]={'name':{'type':Sequelize[_0xbc59('0x2')],'unique':_0xbc59('0x3')},'description':{'type':Sequelize[_0xbc59('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbc59('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 a1edebd..3f70421 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 _0xdcbb=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','reject','Contexts','UserProfileResource','end','stack','name','index','map','VoiceContext','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','show','rawAttributes','include','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','params','writeFileSync','chan_sip.so','destroy','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdcbb,0x18f));var _0xbdcb=function(_0x5c771e,_0x2f1eef){_0x5c771e=_0x5c771e-0x0;var _0x4c3480=_0xdcbb[_0x5c771e];return _0x4c3480;};'use strict';var emlformat=require(_0xbdcb('0x0'));var rimraf=require(_0xbdcb('0x1'));var zipdir=require(_0xbdcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdcb('0x3'));var moment=require(_0xbdcb('0x4'));var BPromise=require(_0xbdcb('0x5'));var Mustache=require(_0xbdcb('0x6'));var util=require('util');var path=require(_0xbdcb('0x7'));var sox=require(_0xbdcb('0x8'));var csv=require('to-csv');var ejs=require(_0xbdcb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbdcb('0xa'));var squel=require(_0xbdcb('0xb'));var crypto=require(_0xbdcb('0xc'));var jsforce=require(_0xbdcb('0xd'));var deskjs=require(_0xbdcb('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbdcb('0xf'));var Redis=require(_0xbdcb('0x10'));var authService=require(_0xbdcb('0x11'));var qs=require(_0xbdcb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdcb('0x13'));var logger=require(_0xbdcb('0x14'))('api');var utils=require(_0xbdcb('0x15'));var config=require(_0xbdcb('0x16'));var licenseUtil=require(_0xbdcb('0x17'));var db=require(_0xbdcb('0x18'))['db'];var jayson=require(_0xbdcb('0x19'));var client=jayson[_0xbdcb('0x1a')][_0xbdcb('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5e005e,_0x2d9e88,_0x3583f6,_0x27fa9b){return new BPromise(function(_0x3f6e2a,_0x5626b6){var _0x33de0c=_0x27fa9b||client;return _0x33de0c[_0xbdcb('0x1c')](_0x5e005e,_0x3583f6)[_0xbdcb('0x1d')](function(_0x1a8904){logger[_0xbdcb('0x1e')](_0xbdcb('0x1f'),_0x2d9e88,'request\x20sent');logger[_0xbdcb('0x20')](_0xbdcb('0x21'),_0x2d9e88,_0xbdcb('0x22'),JSON[_0xbdcb('0x23')](_0x1a8904));if(_0x1a8904['error']){if(_0x1a8904[_0xbdcb('0x24')]['code']===0x1f4){logger['error'](_0xbdcb('0x1f'),_0x2d9e88,_0x1a8904[_0xbdcb('0x24')]['message']);return _0x5626b6(_0x1a8904[_0xbdcb('0x24')][_0xbdcb('0x25')]);}logger[_0xbdcb('0x24')](_0xbdcb('0x1f'),_0x2d9e88,_0x1a8904[_0xbdcb('0x24')]['message']);return _0x3f6e2a(_0x1a8904[_0xbdcb('0x24')][_0xbdcb('0x25')]);}else{logger['info'](_0xbdcb('0x1f'),_0x2d9e88,_0xbdcb('0x22'));_0x3f6e2a(_0x1a8904[_0xbdcb('0x26')][_0xbdcb('0x25')]);}})[_0xbdcb('0x27')](function(_0x2642fc){logger['error'](_0xbdcb('0x1f'),_0x2d9e88,_0x2642fc);_0x5626b6(_0x2642fc);});});}function respondWithStatusCode(_0x2f14c4,_0x11049f){_0x11049f=_0x11049f||0xcc;return function(_0x1c9302){if(_0x1c9302){return _0x2f14c4['sendStatus'](_0x11049f);}return _0x2f14c4[_0xbdcb('0x28')](_0x11049f)['end']();};}function respondWithResult(_0x3846dd,_0x1e3aa0){_0x1e3aa0=_0x1e3aa0||0xc8;return function(_0x4a35cf){if(_0x4a35cf){return _0x3846dd[_0xbdcb('0x28')](_0x1e3aa0)[_0xbdcb('0x29')](_0x4a35cf);}};}function respondWithFilteredResult(_0x3ea96d,_0x4384a6){return function(_0x31e294){if(_0x31e294){var _0x369b1c=typeof _0x4384a6[_0xbdcb('0x2a')]===_0xbdcb('0x2b')&&typeof _0x4384a6[_0xbdcb('0x2c')]===_0xbdcb('0x2b');var _0x1e7b93=_0x31e294[_0xbdcb('0x2d')];var _0x16b9d2=_0x369b1c?0x0:_0x4384a6['offset'];var _0x4927a9=_0x369b1c?_0x31e294[_0xbdcb('0x2d')]:_0x4384a6['offset']+_0x4384a6[_0xbdcb('0x2c')];var _0x4a2a4c;if(_0x4927a9>=_0x1e7b93){_0x4927a9=_0x1e7b93;_0x4a2a4c=0xc8;}else{_0x4a2a4c=0xce;}_0x3ea96d['status'](_0x4a2a4c);return _0x3ea96d[_0xbdcb('0x2e')](_0xbdcb('0x2f'),_0x16b9d2+'-'+_0x4927a9+'/'+_0x1e7b93)[_0xbdcb('0x29')](_0x31e294);}return null;};}function patchUpdates(_0x4c29fa){return function(_0xc86d49){try{jsonpatch['apply'](_0xc86d49,_0x4c29fa,!![]);}catch(_0x592fd5){return BPromise[_0xbdcb('0x30')](_0x592fd5);}return _0xc86d49['save']();};}function saveUpdates(_0x4d035a,_0x43b48c){return function(_0x4660a4){if(_0x4660a4){return _0x4660a4['update'](_0x4d035a)[_0xbdcb('0x1d')](function(_0x1dc9c9){return _0x1dc9c9;});}return null;};}function removeEntity(_0xfd392a,_0x4ad867){return function(_0x515e55){if(_0x515e55){return _0x515e55['destroy']()['then'](function(){var _0x30c31c=_0x515e55['get']({'plain':!![]});var _0x4d3394=_0xbdcb('0x31');return db[_0xbdcb('0x32')]['destroy']({'where':{'type':_0x4d3394,'resourceId':_0x30c31c['id']}})[_0xbdcb('0x1d')](function(){return _0x515e55;});})[_0xbdcb('0x1d')](function(){_0xfd392a['status'](0xcc)[_0xbdcb('0x33')]();});}};}function handleEntityNotFound(_0x38ed75,_0x40212d){return function(_0x3a822d){if(!_0x3a822d){_0x38ed75['sendStatus'](0x194);}return _0x3a822d;};}function handleError(_0x5a59aa,_0x599219){_0x599219=_0x599219||0x1f4;return function(_0xc85f9c){logger[_0xbdcb('0x24')](_0xc85f9c[_0xbdcb('0x34')]);if(_0xc85f9c[_0xbdcb('0x35')]){delete _0xc85f9c[_0xbdcb('0x35')];}_0x5a59aa['status'](_0x599219)['send'](_0xc85f9c);};}exports[_0xbdcb('0x36')]=function(_0x16a5ae,_0x59003a){var _0x2abc66={},_0x23cc12={},_0x84285c={'count':0x0,'rows':[]};var _0x1161f3=_[_0xbdcb('0x37')](db[_0xbdcb('0x38')]['rawAttributes'],function(_0x3c44e0){return{'name':_0x3c44e0[_0xbdcb('0x39')],'type':_0x3c44e0[_0xbdcb('0x3a')][_0xbdcb('0x3b')]};});_0x23cc12['model']=_[_0xbdcb('0x37')](_0x1161f3,_0xbdcb('0x35'));_0x23cc12[_0xbdcb('0x3c')]=_[_0xbdcb('0x3d')](_0x16a5ae[_0xbdcb('0x3c')]);_0x23cc12[_0xbdcb('0x3e')]=_[_0xbdcb('0x3f')](_0x23cc12[_0xbdcb('0x40')],_0x23cc12[_0xbdcb('0x3c')]);_0x2abc66[_0xbdcb('0x41')]=_[_0xbdcb('0x3f')](_0x23cc12[_0xbdcb('0x40')],qs['fields'](_0x16a5ae['query'][_0xbdcb('0x42')]));_0x2abc66['attributes']=_0x2abc66[_0xbdcb('0x41')][_0xbdcb('0x43')]?_0x2abc66['attributes']:_0x23cc12['model'];if(!_0x16a5ae['query'][_0xbdcb('0x44')](_0xbdcb('0x45'))){_0x2abc66[_0xbdcb('0x2c')]=qs[_0xbdcb('0x2c')](_0x16a5ae[_0xbdcb('0x3c')][_0xbdcb('0x2c')]);_0x2abc66['offset']=qs[_0xbdcb('0x2a')](_0x16a5ae[_0xbdcb('0x3c')][_0xbdcb('0x2a')]);}_0x2abc66[_0xbdcb('0x46')]=qs[_0xbdcb('0x47')](_0x16a5ae[_0xbdcb('0x3c')][_0xbdcb('0x47')]);_0x2abc66[_0xbdcb('0x48')]=qs[_0xbdcb('0x3e')](_['pick'](_0x16a5ae[_0xbdcb('0x3c')],_0x23cc12[_0xbdcb('0x3e')]),_0x1161f3);if(_0x16a5ae[_0xbdcb('0x3c')][_0xbdcb('0x49')]){_0x2abc66[_0xbdcb('0x48')]=_[_0xbdcb('0x4a')](_0x2abc66[_0xbdcb('0x48')],{'$or':_['map'](_0x1161f3,function(_0x19af20){if(_0x19af20[_0xbdcb('0x3a')]!=='VIRTUAL'){var _0x687315={};_0x687315[_0x19af20[_0xbdcb('0x35')]]={'$like':'%'+_0x16a5ae['query'][_0xbdcb('0x49')]+'%'};return _0x687315;}})});}_0x2abc66=_['merge']({},_0x2abc66,_0x16a5ae[_0xbdcb('0x4b')]);var _0x31f56c={'where':_0x2abc66[_0xbdcb('0x48')]};return db[_0xbdcb('0x38')]['count'](_0x31f56c)[_0xbdcb('0x1d')](function(_0x403dc4){_0x84285c[_0xbdcb('0x2d')]=_0x403dc4;if(_0x16a5ae[_0xbdcb('0x3c')][_0xbdcb('0x4c')]){_0x2abc66['include']=[{'all':!![]}];}return db[_0xbdcb('0x38')][_0xbdcb('0x4d')](_0x2abc66);})[_0xbdcb('0x1d')](function(_0x13541b){_0x84285c[_0xbdcb('0x4e')]=_0x13541b;return _0x84285c;})[_0xbdcb('0x1d')](respondWithFilteredResult(_0x59003a,_0x2abc66))[_0xbdcb('0x27')](handleError(_0x59003a,null));};exports[_0xbdcb('0x4f')]=function(_0x5c5b42,_0x2259f6){var _0x2c6aae={'raw':![],'where':{'id':_0x5c5b42['params']['id']}},_0x46318a={};_0x46318a[_0xbdcb('0x40')]=_[_0xbdcb('0x3d')](db[_0xbdcb('0x38')][_0xbdcb('0x50')]);_0x46318a[_0xbdcb('0x3c')]=_['keys'](_0x5c5b42[_0xbdcb('0x3c')]);_0x46318a[_0xbdcb('0x3e')]=_[_0xbdcb('0x3f')](_0x46318a[_0xbdcb('0x40')],_0x46318a[_0xbdcb('0x3c')]);_0x2c6aae[_0xbdcb('0x41')]=_[_0xbdcb('0x3f')](_0x46318a['model'],qs[_0xbdcb('0x42')](_0x5c5b42[_0xbdcb('0x3c')][_0xbdcb('0x42')]));_0x2c6aae['attributes']=_0x2c6aae[_0xbdcb('0x41')][_0xbdcb('0x43')]?_0x2c6aae[_0xbdcb('0x41')]:_0x46318a[_0xbdcb('0x40')];if(_0x5c5b42[_0xbdcb('0x3c')][_0xbdcb('0x4c')]){_0x2c6aae[_0xbdcb('0x51')]=[{'all':!![]}];}_0x2c6aae=_[_0xbdcb('0x4a')]({},_0x2c6aae,_0x5c5b42[_0xbdcb('0x4b')]);return db['VoiceContext']['find'](_0x2c6aae)[_0xbdcb('0x1d')](handleEntityNotFound(_0x2259f6,null))[_0xbdcb('0x1d')](respondWithResult(_0x2259f6,null))['catch'](handleError(_0x2259f6,null));};exports[_0xbdcb('0x52')]=function(_0x33ea72,_0x1b00b5,_0x177e32){var _0x1bf418;return db[_0xbdcb('0x38')][_0xbdcb('0x52')](_0x33ea72[_0xbdcb('0x53')],{'raw':!![]})[_0xbdcb('0x1d')](function(_0x12bfc1){_0x1bf418=_0x12bfc1;return db[_0xbdcb('0x38')][_0xbdcb('0x4d')]({'raw':!![]});})['then'](function(_0x2ef47d){var _0x2b7770=fs[_0xbdcb('0x54')](path[_0xbdcb('0x55')](config[_0xbdcb('0x56')],_0xbdcb('0x57')),_0xbdcb('0x58'));var _0x409d16=ejs[_0xbdcb('0x59')](_0x2b7770,{'contexts':_0x2ef47d||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x409d16);})[_0xbdcb('0x1d')](function(){return respondWithRpcPromise(_0xbdcb('0x5a'),_0xbdcb('0x52'),{'module':'chan_sip.so'});})[_0xbdcb('0x1d')](function(){var _0x15f67c=_0x33ea72[_0xbdcb('0x5b')][_0xbdcb('0x5c')]({'plain':!![]});if(!_0x15f67c)throw new Error(_0xbdcb('0x5d'));if(_0x15f67c[_0xbdcb('0x5e')]===_0xbdcb('0x5b')){var _0x5e05ef=_0x1bf418[_0xbdcb('0x5c')]({'plain':!![]});return db[_0xbdcb('0x5f')][_0xbdcb('0x60')]({'where':{'name':_0xbdcb('0x31'),'userProfileId':_0x15f67c[_0xbdcb('0x61')]},'raw':!![]})['then'](function(_0x2771bb){if(_0x2771bb&&_0x2771bb['autoAssociation']===0x0){return db[_0xbdcb('0x32')][_0xbdcb('0x52')]({'name':_0x5e05ef['name'],'resourceId':_0x5e05ef['id'],'type':_0x2771bb[_0xbdcb('0x35')],'sectionId':_0x2771bb['id']},{})[_0xbdcb('0x1d')](function(){return _0x1bf418;});}else{return _0x1bf418;}})[_0xbdcb('0x27')](function(_0x2f4b43){logger[_0xbdcb('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f4b43);throw _0x2f4b43;});}return _0x1bf418;})[_0xbdcb('0x1d')](respondWithResult(_0x1b00b5,0xc9))['catch'](handleError(_0x1b00b5,null));};exports[_0xbdcb('0x62')]=function(_0x788a58,_0x421b91,_0x57facd){var _0x2e6729;return db['VoiceContext'][_0xbdcb('0x60')]({'where':{'id':_0x788a58[_0xbdcb('0x63')]['id']}})[_0xbdcb('0x1d')](handleEntityNotFound(_0x421b91,null))['then'](saveUpdates(_0x788a58[_0xbdcb('0x53')],null))[_0xbdcb('0x1d')](function(_0x28079c){if(_0x28079c){_0x2e6729=_0x28079c;return db[_0xbdcb('0x38')]['findAll']({'raw':!![]});}})[_0xbdcb('0x1d')](function(_0x54977d){var _0x142f36=fs[_0xbdcb('0x54')](path[_0xbdcb('0x55')](config[_0xbdcb('0x56')],_0xbdcb('0x57')),_0xbdcb('0x58'));var _0x58e0c9=ejs['render'](_0x142f36,{'contexts':_0x54977d||[]});fs[_0xbdcb('0x64')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x58e0c9);})[_0xbdcb('0x1d')](function(){return respondWithRpcPromise(_0xbdcb('0x5a'),_0xbdcb('0x62'),{'module':_0xbdcb('0x65')});})[_0xbdcb('0x1d')](function(){return _0x2e6729;})[_0xbdcb('0x1d')](respondWithResult(_0x421b91,null))['catch'](handleError(_0x421b91,null));};exports[_0xbdcb('0x66')]=function(_0x425015,_0x331782,_0x1e62bd){var _0x494478;return db[_0xbdcb('0x38')][_0xbdcb('0x60')]({'where':{'id':_0x425015[_0xbdcb('0x63')]['id']}})['then'](handleEntityNotFound(_0x331782,null))['then'](removeEntity(_0x331782,null))[_0xbdcb('0x1d')](function(){return db[_0xbdcb('0x38')][_0xbdcb('0x4d')]({'raw':!![]});})[_0xbdcb('0x1d')](function(_0xaefb3a){var _0xdb01dc=fs[_0xbdcb('0x54')](path[_0xbdcb('0x55')](config[_0xbdcb('0x56')],_0xbdcb('0x57')),_0xbdcb('0x58'));var _0x19205b=ejs[_0xbdcb('0x59')](_0xdb01dc,{'contexts':_0xaefb3a});fs[_0xbdcb('0x64')](_0xbdcb('0x67'),_0x19205b);return respondWithRpcPromise(_0xbdcb('0x5a'),_0xbdcb('0x66'),{'module':_0xbdcb('0x65')});})[_0xbdcb('0x27')](handleError(_0x331782,null));}; \ No newline at end of file +var _0x37b6=['readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','/etc/asterisk/extensions_xcally_contexts.conf','utf8','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','status','end','json','offset','undefined','limit','count','Content-Range','reject','destroy','get','Contexts','stack','name','send','index','map','VoiceContext','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','includeAll','findAll','rows','catch','show','rawAttributes','options','find','create','body'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x37b6,0x147));var _0x637b=function(_0x8b3c87,_0x5d0611){_0x8b3c87=_0x8b3c87-0x0;var _0x191e01=_0x37b6[_0x8b3c87];return _0x191e01;};'use strict';var emlformat=require(_0x637b('0x0'));var rimraf=require(_0x637b('0x1'));var zipdir=require(_0x637b('0x2'));var jsonpatch=require(_0x637b('0x3'));var rp=require(_0x637b('0x4'));var moment=require(_0x637b('0x5'));var BPromise=require(_0x637b('0x6'));var Mustache=require(_0x637b('0x7'));var util=require(_0x637b('0x8'));var path=require(_0x637b('0x9'));var sox=require(_0x637b('0xa'));var csv=require(_0x637b('0xb'));var ejs=require(_0x637b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x637b('0xd'));var crypto=require(_0x637b('0xe'));var jsforce=require(_0x637b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x637b('0xb'));var querystring=require(_0x637b('0x10'));var Papa=require(_0x637b('0x11'));var Redis=require(_0x637b('0x12'));var authService=require(_0x637b('0x13'));var qs=require(_0x637b('0x14'));var as=require(_0x637b('0x15'));var hardwareService=require(_0x637b('0x16'));var logger=require(_0x637b('0x17'))(_0x637b('0x18'));var utils=require(_0x637b('0x19'));var config=require(_0x637b('0x1a'));var licenseUtil=require(_0x637b('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x637b('0x1c'));var client=jayson[_0x637b('0x1d')][_0x637b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x35361f,_0x40611c,_0x39207e,_0x4486f3){return new BPromise(function(_0x3dae90,_0x391e5){var _0x4a4df0=_0x4486f3||client;return _0x4a4df0['request'](_0x35361f,_0x39207e)[_0x637b('0x1f')](function(_0x6728ec){logger[_0x637b('0x20')]('VoiceContext,\x20%s,\x20%s',_0x40611c,_0x637b('0x21'));logger['debug'](_0x637b('0x22'),_0x40611c,'request\x20sent',JSON[_0x637b('0x23')](_0x6728ec));if(_0x6728ec[_0x637b('0x24')]){if(_0x6728ec[_0x637b('0x24')][_0x637b('0x25')]===0x1f4){logger[_0x637b('0x24')](_0x637b('0x26'),_0x40611c,_0x6728ec['error']['message']);return _0x391e5(_0x6728ec[_0x637b('0x24')][_0x637b('0x27')]);}logger[_0x637b('0x24')](_0x637b('0x26'),_0x40611c,_0x6728ec[_0x637b('0x24')]['message']);return _0x3dae90(_0x6728ec[_0x637b('0x24')][_0x637b('0x27')]);}else{logger[_0x637b('0x20')](_0x637b('0x26'),_0x40611c,_0x637b('0x21'));_0x3dae90(_0x6728ec['result'][_0x637b('0x27')]);}})['catch'](function(_0x1e6085){logger[_0x637b('0x24')](_0x637b('0x26'),_0x40611c,_0x1e6085);_0x391e5(_0x1e6085);});});}function respondWithStatusCode(_0x4939b9,_0x4e093c){_0x4e093c=_0x4e093c||0xcc;return function(_0x4a7c18){if(_0x4a7c18){return _0x4939b9['sendStatus'](_0x4e093c);}return _0x4939b9[_0x637b('0x28')](_0x4e093c)[_0x637b('0x29')]();};}function respondWithResult(_0xf90a35,_0x425ec6){_0x425ec6=_0x425ec6||0xc8;return function(_0x3e99a7){if(_0x3e99a7){return _0xf90a35[_0x637b('0x28')](_0x425ec6)[_0x637b('0x2a')](_0x3e99a7);}};}function respondWithFilteredResult(_0x19af0f,_0x234458){return function(_0xde9076){if(_0xde9076){var _0x4be4c9=typeof _0x234458[_0x637b('0x2b')]===_0x637b('0x2c')&&typeof _0x234458[_0x637b('0x2d')]===_0x637b('0x2c');var _0xd56331=_0xde9076['count'];var _0x57afb4=_0x4be4c9?0x0:_0x234458[_0x637b('0x2b')];var _0x5089be=_0x4be4c9?_0xde9076[_0x637b('0x2e')]:_0x234458[_0x637b('0x2b')]+_0x234458[_0x637b('0x2d')];var _0x554def;if(_0x5089be>=_0xd56331){_0x5089be=_0xd56331;_0x554def=0xc8;}else{_0x554def=0xce;}_0x19af0f['status'](_0x554def);return _0x19af0f['set'](_0x637b('0x2f'),_0x57afb4+'-'+_0x5089be+'/'+_0xd56331)['json'](_0xde9076);}return null;};}function patchUpdates(_0x41a312){return function(_0x4d2840){try{jsonpatch['apply'](_0x4d2840,_0x41a312,!![]);}catch(_0x553bec){return BPromise[_0x637b('0x30')](_0x553bec);}return _0x4d2840['save']();};}function saveUpdates(_0x2cfec0,_0x3c23c8){return function(_0xfa698e){if(_0xfa698e){return _0xfa698e['update'](_0x2cfec0)[_0x637b('0x1f')](function(_0x38c20a){return _0x38c20a;});}return null;};}function removeEntity(_0x24d479,_0x28f4d2){return function(_0x8d1e06){if(_0x8d1e06){return _0x8d1e06[_0x637b('0x31')]()['then'](function(){var _0x42e117=_0x8d1e06[_0x637b('0x32')]({'plain':!![]});var _0x536bd7=_0x637b('0x33');return db['UserProfileResource']['destroy']({'where':{'type':_0x536bd7,'resourceId':_0x42e117['id']}})[_0x637b('0x1f')](function(){return _0x8d1e06;});})[_0x637b('0x1f')](function(){_0x24d479['status'](0xcc)[_0x637b('0x29')]();});}};}function handleEntityNotFound(_0x2b751d,_0x4e25e9){return function(_0x481f98){if(!_0x481f98){_0x2b751d['sendStatus'](0x194);}return _0x481f98;};}function handleError(_0x6ee272,_0x276e86){_0x276e86=_0x276e86||0x1f4;return function(_0x794a38){logger[_0x637b('0x24')](_0x794a38[_0x637b('0x34')]);if(_0x794a38[_0x637b('0x35')]){delete _0x794a38[_0x637b('0x35')];}_0x6ee272['status'](_0x276e86)[_0x637b('0x36')](_0x794a38);};}exports[_0x637b('0x37')]=function(_0x3d2cb5,_0x5f3027){var _0x4c6855={},_0x3d49a0={},_0x3f2139={'count':0x0,'rows':[]};var _0x5ba0e2=_[_0x637b('0x38')](db[_0x637b('0x39')]['rawAttributes'],function(_0x72f162){return{'name':_0x72f162[_0x637b('0x3a')],'type':_0x72f162['type'][_0x637b('0x3b')]};});_0x3d49a0[_0x637b('0x3c')]=_[_0x637b('0x38')](_0x5ba0e2,'name');_0x3d49a0['query']=_[_0x637b('0x3d')](_0x3d2cb5[_0x637b('0x3e')]);_0x3d49a0[_0x637b('0x3f')]=_['intersection'](_0x3d49a0[_0x637b('0x3c')],_0x3d49a0['query']);_0x4c6855[_0x637b('0x40')]=_[_0x637b('0x41')](_0x3d49a0[_0x637b('0x3c')],qs[_0x637b('0x42')](_0x3d2cb5['query'][_0x637b('0x42')]));_0x4c6855[_0x637b('0x40')]=_0x4c6855['attributes'][_0x637b('0x43')]?_0x4c6855[_0x637b('0x40')]:_0x3d49a0[_0x637b('0x3c')];if(!_0x3d2cb5[_0x637b('0x3e')][_0x637b('0x44')]('nolimit')){_0x4c6855[_0x637b('0x2d')]=qs[_0x637b('0x2d')](_0x3d2cb5[_0x637b('0x3e')][_0x637b('0x2d')]);_0x4c6855[_0x637b('0x2b')]=qs[_0x637b('0x2b')](_0x3d2cb5['query'][_0x637b('0x2b')]);}_0x4c6855[_0x637b('0x45')]=qs['sort'](_0x3d2cb5[_0x637b('0x3e')]['sort']);_0x4c6855[_0x637b('0x46')]=qs[_0x637b('0x3f')](_[_0x637b('0x47')](_0x3d2cb5[_0x637b('0x3e')],_0x3d49a0[_0x637b('0x3f')]),_0x5ba0e2);if(_0x3d2cb5['query'][_0x637b('0x48')]){_0x4c6855[_0x637b('0x46')]=_[_0x637b('0x49')](_0x4c6855[_0x637b('0x46')],{'$or':_[_0x637b('0x38')](_0x5ba0e2,function(_0x5eef5f){if(_0x5eef5f[_0x637b('0x4a')]!=='VIRTUAL'){var _0x2d9305={};_0x2d9305[_0x5eef5f[_0x637b('0x35')]]={'$like':'%'+_0x3d2cb5[_0x637b('0x3e')][_0x637b('0x48')]+'%'};return _0x2d9305;}})});}_0x4c6855=_[_0x637b('0x49')]({},_0x4c6855,_0x3d2cb5['options']);var _0x3c874a={'where':_0x4c6855['where']};return db[_0x637b('0x39')][_0x637b('0x2e')](_0x3c874a)[_0x637b('0x1f')](function(_0x2029bc){_0x3f2139[_0x637b('0x2e')]=_0x2029bc;if(_0x3d2cb5[_0x637b('0x3e')][_0x637b('0x4b')]){_0x4c6855['include']=[{'all':!![]}];}return db['VoiceContext'][_0x637b('0x4c')](_0x4c6855);})[_0x637b('0x1f')](function(_0x4ddafe){_0x3f2139[_0x637b('0x4d')]=_0x4ddafe;return _0x3f2139;})[_0x637b('0x1f')](respondWithFilteredResult(_0x5f3027,_0x4c6855))[_0x637b('0x4e')](handleError(_0x5f3027,null));};exports[_0x637b('0x4f')]=function(_0x26911f,_0xd8a6e3){var _0x5dfa8e={'raw':![],'where':{'id':_0x26911f['params']['id']}},_0x2aaf70={};_0x2aaf70['model']=_[_0x637b('0x3d')](db[_0x637b('0x39')][_0x637b('0x50')]);_0x2aaf70['query']=_[_0x637b('0x3d')](_0x26911f[_0x637b('0x3e')]);_0x2aaf70[_0x637b('0x3f')]=_[_0x637b('0x41')](_0x2aaf70[_0x637b('0x3c')],_0x2aaf70[_0x637b('0x3e')]);_0x5dfa8e[_0x637b('0x40')]=_['intersection'](_0x2aaf70[_0x637b('0x3c')],qs[_0x637b('0x42')](_0x26911f[_0x637b('0x3e')][_0x637b('0x42')]));_0x5dfa8e['attributes']=_0x5dfa8e[_0x637b('0x40')][_0x637b('0x43')]?_0x5dfa8e[_0x637b('0x40')]:_0x2aaf70['model'];if(_0x26911f[_0x637b('0x3e')]['includeAll']){_0x5dfa8e['include']=[{'all':!![]}];}_0x5dfa8e=_[_0x637b('0x49')]({},_0x5dfa8e,_0x26911f[_0x637b('0x51')]);return db['VoiceContext'][_0x637b('0x52')](_0x5dfa8e)['then'](handleEntityNotFound(_0xd8a6e3,null))[_0x637b('0x1f')](respondWithResult(_0xd8a6e3,null))[_0x637b('0x4e')](handleError(_0xd8a6e3,null));};exports['create']=function(_0xd68a5b,_0x378bae,_0x3d3e91){var _0x4132e3;return db[_0x637b('0x39')][_0x637b('0x53')](_0xd68a5b[_0x637b('0x54')],{'raw':!![]})[_0x637b('0x1f')](function(_0x54d78d){_0x4132e3=_0x54d78d;return db[_0x637b('0x39')][_0x637b('0x4c')]({'raw':!![]});})[_0x637b('0x1f')](function(_0x4ed226){var _0x37e282=fs[_0x637b('0x55')](path[_0x637b('0x56')](config[_0x637b('0x57')],_0x637b('0x58')),'utf8');var _0x435acf=ejs[_0x637b('0x59')](_0x37e282,{'contexts':_0x4ed226||[]});fs[_0x637b('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x435acf);})[_0x637b('0x1f')](function(){return respondWithRpcPromise(_0x637b('0x5b'),'create',{'module':_0x637b('0x5c')});})['then'](function(){var _0x1fe26e=_0xd68a5b[_0x637b('0x5d')][_0x637b('0x32')]({'plain':!![]});if(!_0x1fe26e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fe26e[_0x637b('0x5e')]===_0x637b('0x5d')){var _0x41353c=_0x4132e3['get']({'plain':!![]});return db[_0x637b('0x5f')][_0x637b('0x52')]({'where':{'name':'Contexts','userProfileId':_0x1fe26e[_0x637b('0x60')]},'raw':!![]})['then'](function(_0x4ac6c2){if(_0x4ac6c2&&_0x4ac6c2[_0x637b('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x41353c['name'],'resourceId':_0x41353c['id'],'type':_0x4ac6c2[_0x637b('0x35')],'sectionId':_0x4ac6c2['id']},{})[_0x637b('0x1f')](function(){return _0x4132e3;});}else{return _0x4132e3;}})[_0x637b('0x4e')](function(_0x536b6b){logger[_0x637b('0x24')](_0x637b('0x62'),_0x536b6b);throw _0x536b6b;});}return _0x4132e3;})[_0x637b('0x1f')](respondWithResult(_0x378bae,0xc9))['catch'](handleError(_0x378bae,null));};exports[_0x637b('0x63')]=function(_0x5665c5,_0x17724f,_0x193e57){var _0xcc8195;return db['VoiceContext'][_0x637b('0x52')]({'where':{'id':_0x5665c5[_0x637b('0x64')]['id']}})[_0x637b('0x1f')](handleEntityNotFound(_0x17724f,null))[_0x637b('0x1f')](saveUpdates(_0x5665c5[_0x637b('0x54')],null))[_0x637b('0x1f')](function(_0x242d56){if(_0x242d56){_0xcc8195=_0x242d56;return db[_0x637b('0x39')][_0x637b('0x4c')]({'raw':!![]});}})[_0x637b('0x1f')](function(_0xdfa5db){var _0x540a12=fs[_0x637b('0x55')](path[_0x637b('0x56')](config[_0x637b('0x57')],'server/files/templates/context.ejs'),'utf8');var _0x4edc3a=ejs[_0x637b('0x59')](_0x540a12,{'contexts':_0xdfa5db||[]});fs['writeFileSync'](_0x637b('0x65'),_0x4edc3a);})[_0x637b('0x1f')](function(){return respondWithRpcPromise(_0x637b('0x5b'),_0x637b('0x63'),{'module':'chan_sip.so'});})[_0x637b('0x1f')](function(){return _0xcc8195;})['then'](respondWithResult(_0x17724f,null))[_0x637b('0x4e')](handleError(_0x17724f,null));};exports[_0x637b('0x31')]=function(_0x20407f,_0x18928d,_0x2ba882){var _0x181242;return db[_0x637b('0x39')]['find']({'where':{'id':_0x20407f[_0x637b('0x64')]['id']}})[_0x637b('0x1f')](handleEntityNotFound(_0x18928d,null))['then'](removeEntity(_0x18928d,null))[_0x637b('0x1f')](function(){return db[_0x637b('0x39')][_0x637b('0x4c')]({'raw':!![]});})[_0x637b('0x1f')](function(_0x3cd9e3){var _0xa5b9b7=fs[_0x637b('0x55')](path[_0x637b('0x56')](config['root'],_0x637b('0x58')),_0x637b('0x66'));var _0x78da3=ejs[_0x637b('0x59')](_0xa5b9b7,{'contexts':_0x3cd9e3});fs['writeFileSync'](_0x637b('0x65'),_0x78da3);return respondWithRpcPromise('Reload','destroy',{'module':_0x637b('0x5c')});})[_0x637b('0x4e')](handleError(_0x18928d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index ead9c49..b885e58 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 _0x78ab=['api','moment','bluebird','request-promise','path','./voiceContext.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x3318a3,_0x1b40e4){var _0x51d152=function(_0x5d8f68){while(--_0x5d8f68){_0x3318a3['push'](_0x3318a3['shift']());}};_0x51d152(++_0x1b40e4);}(_0x78ab,0x81));var _0xb78a=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x78ab[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xb78a('0x0'));var util=require(_0xb78a('0x1'));var logger=require(_0xb78a('0x2'))(_0xb78a('0x3'));var moment=require(_0xb78a('0x4'));var BPromise=require(_0xb78a('0x5'));var rp=require(_0xb78a('0x6'));var fs=require('fs');var path=require(_0xb78a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb78a('0x8'));module[_0xb78a('0x9')]=function(_0x20e907,_0x2166fa){return _0x20e907[_0xb78a('0xa')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3b9=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts','lodash'];(function(_0x4a6443,_0x493fa5){var _0x25a648=function(_0x40a641){while(--_0x40a641){_0x4a6443['push'](_0x4a6443['shift']());}};_0x25a648(++_0x493fa5);}(_0xa3b9,0x6b));var _0x9a3b=function(_0x473369,_0x4cf6ed){_0x473369=_0x473369-0x0;var _0x19cd0e=_0xa3b9[_0x473369];return _0x19cd0e;};'use strict';var _=require(_0x9a3b('0x0'));var util=require(_0x9a3b('0x1'));var logger=require(_0x9a3b('0x2'))(_0x9a3b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9a3b('0x4'));var fs=require('fs');var path=require(_0x9a3b('0x5'));var rimraf=require(_0x9a3b('0x6'));var config=require(_0x9a3b('0x7'));var attributes=require('./voiceContext.attributes');module[_0x9a3b('0x8')]=function(_0x5649a1,_0x439762){return _0x5649a1[_0x9a3b('0x9')](_0x9a3b('0xa'),attributes,{'tableName':_0x9a3b('0xb'),'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 c5d8c32..711615f 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 _0xcf61=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x5811f0,_0x13ba47){var _0x3f7013=function(_0x5b9d11){while(--_0x5b9d11){_0x5811f0['push'](_0x5811f0['shift']());}};_0x3f7013(++_0x13ba47);}(_0xcf61,0xda));var _0x1cf6=function(_0x124609,_0x2f0025){_0x124609=_0x124609-0x0;var _0x6d1fd6=_0xcf61[_0x124609];return _0x6d1fd6;};'use strict';var _=require('lodash');var util=require(_0x1cf6('0x0'));var moment=require(_0x1cf6('0x1'));var BPromise=require('bluebird');var rs=require(_0x1cf6('0x2'));var fs=require('fs');var Redis=require(_0x1cf6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1cf6('0x4'))(_0x1cf6('0x5'));var config=require('../../config/environment');var jayson=require(_0x1cf6('0x6'));var client=jayson[_0x1cf6('0x7')][_0x1cf6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c6a0c,_0x2ddef2,_0x503b17){return new BPromise(function(_0x326181,_0x1234d5){return client[_0x1cf6('0x9')](_0x4c6a0c,_0x503b17)[_0x1cf6('0xa')](function(_0xdbd65d){logger[_0x1cf6('0xb')](_0x1cf6('0xc'),_0x2ddef2,_0x1cf6('0xd'));logger[_0x1cf6('0xe')](_0x1cf6('0xf'),_0x2ddef2,_0x1cf6('0xd'),JSON[_0x1cf6('0x10')](_0xdbd65d));if(_0xdbd65d[_0x1cf6('0x11')]){if(_0xdbd65d[_0x1cf6('0x11')][_0x1cf6('0x12')]===0x1f4){logger[_0x1cf6('0x11')]('VoiceContext,\x20%s,\x20%s',_0x2ddef2,_0xdbd65d[_0x1cf6('0x11')][_0x1cf6('0x13')]);return _0x1234d5(_0xdbd65d[_0x1cf6('0x11')][_0x1cf6('0x13')]);}logger[_0x1cf6('0x11')]('VoiceContext,\x20%s,\x20%s',_0x2ddef2,_0xdbd65d[_0x1cf6('0x11')][_0x1cf6('0x13')]);return _0x326181(_0xdbd65d[_0x1cf6('0x11')]['message']);}else{logger[_0x1cf6('0xb')]('VoiceContext,\x20%s,\x20%s',_0x2ddef2,_0x1cf6('0xd'));_0x326181(_0xdbd65d[_0x1cf6('0x14')][_0x1cf6('0x13')]);}})[_0x1cf6('0x15')](function(_0x6fb890){logger[_0x1cf6('0x11')](_0x1cf6('0xc'),_0x2ddef2,_0x6fb890);_0x1234d5(_0x6fb890);});});} \ No newline at end of file +var _0xd05a=['info','result','catch','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd05a,0x143));var _0xad05=function(_0x4dfc76,_0x349670){_0x4dfc76=_0x4dfc76-0x0;var _0x5d5b97=_0xd05a[_0x4dfc76];return _0x5d5b97;};'use strict';var _=require('lodash');var util=require(_0xad05('0x0'));var moment=require(_0xad05('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad05('0x2'));var logger=require(_0xad05('0x3'))(_0xad05('0x4'));var config=require(_0xad05('0x5'));var jayson=require(_0xad05('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39ddaf,_0x45303c,_0xd12d76){return new BPromise(function(_0x565f85,_0x17ec26){return client[_0xad05('0x7')](_0x39ddaf,_0xd12d76)[_0xad05('0x8')](function(_0x573acb){logger['info'](_0xad05('0x9'),_0x45303c,'request\x20sent');logger[_0xad05('0xa')](_0xad05('0xb'),_0x45303c,_0xad05('0xc'),JSON[_0xad05('0xd')](_0x573acb));if(_0x573acb[_0xad05('0xe')]){if(_0x573acb[_0xad05('0xe')][_0xad05('0xf')]===0x1f4){logger[_0xad05('0xe')](_0xad05('0x9'),_0x45303c,_0x573acb[_0xad05('0xe')]['message']);return _0x17ec26(_0x573acb[_0xad05('0xe')]['message']);}logger[_0xad05('0xe')]('VoiceContext,\x20%s,\x20%s',_0x45303c,_0x573acb[_0xad05('0xe')][_0xad05('0x10')]);return _0x565f85(_0x573acb[_0xad05('0xe')]['message']);}else{logger[_0xad05('0x11')]('VoiceContext,\x20%s,\x20%s',_0x45303c,_0xad05('0xc'));_0x565f85(_0x573acb[_0xad05('0x12')][_0xad05('0x10')]);}})[_0xad05('0x13')](function(_0x43ab03){logger[_0xad05('0xe')]('VoiceContext,\x20%s,\x20%s',_0x45303c,_0x43ab03);_0x17ec26(_0x43ab03);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a707fd7..a30e0ed 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 _0x884b=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x364265,_0x56e556){var _0x30536d=function(_0x7044df){while(--_0x7044df){_0x364265['push'](_0x364265['shift']());}};_0x30536d(++_0x56e556);}(_0x884b,0x99));var _0xb884=function(_0x2eec1f,_0x1b9987){_0x2eec1f=_0x2eec1f-0x0;var _0x543075=_0x884b[_0x2eec1f];return _0x543075;};'use strict';var multer=require(_0xb884('0x0'));var util=require(_0xb884('0x1'));var path=require(_0xb884('0x2'));var timeout=require(_0xb884('0x3'));var express=require(_0xb884('0x4'));var router=express[_0xb884('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb884('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb884('0x7'));var controller=require(_0xb884('0x8'));router[_0xb884('0x9')]('/',auth[_0xb884('0xa')](),controller[_0xb884('0xb')]);router['get'](_0xb884('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb884('0xd'),auth[_0xb884('0xa')](),controller[_0xb884('0xe')]);router[_0xb884('0xf')]('/',auth['isAuthenticated'](),controller[_0xb884('0x10')]);router[_0xb884('0x11')](_0xb884('0xd'),auth['isAuthenticated'](),controller[_0xb884('0x12')]);router[_0xb884('0x13')](_0xb884('0xd'),auth[_0xb884('0xa')](),controller['destroy']);module[_0xb884('0x14')]=router; \ No newline at end of file +var _0x554d=['post','create','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','./voiceDialReport.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x48b598,_0x2a5afb){var _0x580c58=function(_0x157d4c){while(--_0x157d4c){_0x48b598['push'](_0x48b598['shift']());}};_0x580c58(++_0x2a5afb);}(_0x554d,0x1c8));var _0xd554=function(_0x399194,_0x57df7b){_0x399194=_0x399194-0x0;var _0x8384ee=_0x554d[_0x399194];return _0x8384ee;};'use strict';var multer=require(_0xd554('0x0'));var util=require('util');var path=require(_0xd554('0x1'));var timeout=require(_0xd554('0x2'));var express=require('express');var router=express[_0xd554('0x3')]();var fs_extra=require(_0xd554('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd554('0x5'));router['get']('/',auth[_0xd554('0x6')](),controller['index']);router[_0xd554('0x7')](_0xd554('0x8'),auth[_0xd554('0x6')](),controller[_0xd554('0x9')]);router[_0xd554('0x7')](_0xd554('0xa'),auth[_0xd554('0x6')](),controller[_0xd554('0xb')]);router[_0xd554('0xc')]('/',auth[_0xd554('0x6')](),controller[_0xd554('0xd')]);router[_0xd554('0xe')]('/:id',auth[_0xd554('0x6')](),controller[_0xd554('0xf')]);router[_0xd554('0x10')](_0xd554('0xa'),auth[_0xd554('0x6')](),controller[_0xd554('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index cb8d4fe..64f5f70 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 _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x54ef,0x112));var _0xf54e=function(_0x4dfe38,_0x2d4b68){_0x4dfe38=_0x4dfe38-0x0;var _0x3623d2=_0x54ef[_0x4dfe38];return _0x3623d2;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file +var _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x16acb7,_0x23f034){var _0x39bf39=function(_0x21281e){while(--_0x21281e){_0x16acb7['push'](_0x16acb7['shift']());}};_0x39bf39(++_0x23f034);}(_0x84ab,0x12f));var _0xb84a=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x84ab[_0x5d8018];return _0x151ac4;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index aeaacc8..9b1ef2f 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 _0x03aa=['save','update','then','destroy','end','error','stack','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','filter','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','count','status','set','Content-Range','reject'];(function(_0x59ae8f,_0x148344){var _0x3900b5=function(_0x63af51){while(--_0x63af51){_0x59ae8f['push'](_0x59ae8f['shift']());}};_0x3900b5(++_0x148344);}(_0x03aa,0x146));var _0xa03a=function(_0x593f7d,_0x5c3a0e){_0x593f7d=_0x593f7d-0x0;var _0x109ee1=_0x03aa[_0x593f7d];return _0x109ee1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa03a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa03a('0x1'));var rp=require(_0xa03a('0x2'));var moment=require('moment');var BPromise=require(_0xa03a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa03a('0x4'));var csv=require(_0xa03a('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa03a('0x6'));var _=require(_0xa03a('0x7'));var squel=require(_0xa03a('0x8'));var crypto=require(_0xa03a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa03a('0xa'));var toCsv=require(_0xa03a('0x5'));var querystring=require('querystring');var Papa=require(_0xa03a('0xb'));var Redis=require(_0xa03a('0xc'));var authService=require(_0xa03a('0xd'));var qs=require(_0xa03a('0xe'));var as=require(_0xa03a('0xf'));var hardwareService=require(_0xa03a('0x10'));var logger=require(_0xa03a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xa03a('0x12'));var licenseUtil=require(_0xa03a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b062b,_0x22b470){_0x22b470=_0x22b470||0xcc;return function(_0xfaa8db){if(_0xfaa8db){return _0x4b062b[_0xa03a('0x14')](_0x22b470);}return _0x4b062b['status'](_0x22b470)['end']();};}function respondWithResult(_0x529cea,_0x312f99){_0x312f99=_0x312f99||0xc8;return function(_0x501e76){if(_0x501e76){return _0x529cea['status'](_0x312f99)[_0xa03a('0x15')](_0x501e76);}};}function respondWithFilteredResult(_0x1758a4,_0x21d192){return function(_0x220c6e){if(_0x220c6e){var _0x19baec=typeof _0x21d192[_0xa03a('0x16')]===_0xa03a('0x17')&&typeof _0x21d192['limit']===_0xa03a('0x17');var _0x3144b4=_0x220c6e[_0xa03a('0x18')];var _0x13b8ce=_0x19baec?0x0:_0x21d192['offset'];var _0x5e6745=_0x19baec?_0x220c6e['count']:_0x21d192[_0xa03a('0x16')]+_0x21d192['limit'];var _0x588f51;if(_0x5e6745>=_0x3144b4){_0x5e6745=_0x3144b4;_0x588f51=0xc8;}else{_0x588f51=0xce;}_0x1758a4[_0xa03a('0x19')](_0x588f51);return _0x1758a4[_0xa03a('0x1a')](_0xa03a('0x1b'),_0x13b8ce+'-'+_0x5e6745+'/'+_0x3144b4)[_0xa03a('0x15')](_0x220c6e);}return null;};}function patchUpdates(_0x1ee19f){return function(_0x5cba07){try{jsonpatch['apply'](_0x5cba07,_0x1ee19f,!![]);}catch(_0x5e52d7){return BPromise[_0xa03a('0x1c')](_0x5e52d7);}return _0x5cba07[_0xa03a('0x1d')]();};}function saveUpdates(_0x51442e,_0x341348){return function(_0x3b2474){if(_0x3b2474){return _0x3b2474[_0xa03a('0x1e')](_0x51442e)[_0xa03a('0x1f')](function(_0x5f5412){return _0x5f5412;});}return null;};}function removeEntity(_0x188bb4,_0x479788){return function(_0x2ba3ab){if(_0x2ba3ab){return _0x2ba3ab[_0xa03a('0x20')]()[_0xa03a('0x1f')](function(){_0x188bb4[_0xa03a('0x19')](0xcc)[_0xa03a('0x21')]();});}};}function handleEntityNotFound(_0x3fa71f,_0x4f1a78){return function(_0x5e8c77){if(!_0x5e8c77){_0x3fa71f[_0xa03a('0x14')](0x194);}return _0x5e8c77;};}function handleError(_0xf34b89,_0x5a7481){_0x5a7481=_0x5a7481||0x1f4;return function(_0x1f692a){logger[_0xa03a('0x22')](_0x1f692a[_0xa03a('0x23')]);if(_0x1f692a['name']){delete _0x1f692a['name'];}_0xf34b89[_0xa03a('0x19')](_0x5a7481)[_0xa03a('0x24')](_0x1f692a);};}exports[_0xa03a('0x25')]=function(_0x465e47,_0x224684){var _0x3922f3={},_0x2bd597={},_0x3abb2c={'count':0x0,'rows':[]};var _0x447d3d=_[_0xa03a('0x26')](db[_0xa03a('0x27')][_0xa03a('0x28')],function(_0x350fc6){return{'name':_0x350fc6[_0xa03a('0x29')],'type':_0x350fc6[_0xa03a('0x2a')][_0xa03a('0x2b')]};});_0x2bd597['model']=_[_0xa03a('0x26')](_0x447d3d,'name');_0x2bd597['query']=_[_0xa03a('0x2c')](_0x465e47['query']);_0x2bd597[_0xa03a('0x2d')]=_[_0xa03a('0x2e')](_0x2bd597[_0xa03a('0x2f')],_0x2bd597[_0xa03a('0x30')]);_0x3922f3[_0xa03a('0x31')]=_[_0xa03a('0x2e')](_0x2bd597[_0xa03a('0x2f')],qs[_0xa03a('0x32')](_0x465e47['query']['fields']));_0x3922f3['attributes']=_0x3922f3[_0xa03a('0x31')][_0xa03a('0x33')]?_0x3922f3[_0xa03a('0x31')]:_0x2bd597[_0xa03a('0x2f')];if(!_0x465e47[_0xa03a('0x30')][_0xa03a('0x34')](_0xa03a('0x35'))){_0x3922f3[_0xa03a('0x36')]=qs['limit'](_0x465e47[_0xa03a('0x30')]['limit']);_0x3922f3[_0xa03a('0x16')]=qs[_0xa03a('0x16')](_0x465e47['query'][_0xa03a('0x16')]);}_0x3922f3['order']=qs[_0xa03a('0x37')](_0x465e47['query'][_0xa03a('0x37')]);_0x3922f3[_0xa03a('0x38')]=qs[_0xa03a('0x2d')](_['pick'](_0x465e47[_0xa03a('0x30')],_0x2bd597['filters']),_0x447d3d);if(_0x465e47[_0xa03a('0x30')]['filter']){_0x3922f3['where']=_[_0xa03a('0x39')](_0x3922f3[_0xa03a('0x38')],{'$or':_['map'](_0x447d3d,function(_0x409c48){if(_0x409c48[_0xa03a('0x2a')]!=='VIRTUAL'){var _0x4599fb={};_0x4599fb[_0x409c48['name']]={'$like':'%'+_0x465e47[_0xa03a('0x30')][_0xa03a('0x3a')]+'%'};return _0x4599fb;}})});}_0x3922f3=_['merge']({},_0x3922f3,_0x465e47['options']);var _0x310a02={'where':_0x3922f3['where']};return db[_0xa03a('0x27')]['count'](_0x310a02)['then'](function(_0x969bf5){_0x3abb2c[_0xa03a('0x18')]=_0x969bf5;if(_0x465e47[_0xa03a('0x30')][_0xa03a('0x3b')]){_0x3922f3['include']=[{'all':!![]}];}return db[_0xa03a('0x27')][_0xa03a('0x3c')](_0x3922f3);})[_0xa03a('0x1f')](function(_0x391027){_0x3abb2c[_0xa03a('0x3d')]=_0x391027;return _0x3abb2c;})['then'](respondWithFilteredResult(_0x224684,_0x3922f3))[_0xa03a('0x3e')](handleError(_0x224684,null));};exports[_0xa03a('0x3f')]=function(_0x48f03a,_0x396b32){var _0x2c9942={'raw':!![],'where':{'id':_0x48f03a[_0xa03a('0x40')]['id']}},_0x3b27f6={};_0x3b27f6['model']=_[_0xa03a('0x2c')](db['VoiceDialReport'][_0xa03a('0x28')]);_0x3b27f6[_0xa03a('0x30')]=_['keys'](_0x48f03a['query']);_0x3b27f6[_0xa03a('0x2d')]=_[_0xa03a('0x2e')](_0x3b27f6[_0xa03a('0x2f')],_0x3b27f6['query']);_0x2c9942[_0xa03a('0x31')]=_[_0xa03a('0x2e')](_0x3b27f6[_0xa03a('0x2f')],qs[_0xa03a('0x32')](_0x48f03a[_0xa03a('0x30')][_0xa03a('0x32')]));_0x2c9942[_0xa03a('0x31')]=_0x2c9942[_0xa03a('0x31')][_0xa03a('0x33')]?_0x2c9942[_0xa03a('0x31')]:_0x3b27f6['model'];if(_0x48f03a[_0xa03a('0x30')]['includeAll']){_0x2c9942[_0xa03a('0x41')]=[{'all':!![]}];}_0x2c9942=_['merge']({},_0x2c9942,_0x48f03a[_0xa03a('0x42')]);return db[_0xa03a('0x27')][_0xa03a('0x43')](_0x2c9942)[_0xa03a('0x1f')](handleEntityNotFound(_0x396b32,null))[_0xa03a('0x1f')](respondWithResult(_0x396b32,null))['catch'](handleError(_0x396b32,null));};exports[_0xa03a('0x44')]=function(_0xab55ed,_0x492254){return db[_0xa03a('0x27')][_0xa03a('0x44')](_0xab55ed[_0xa03a('0x45')],{})[_0xa03a('0x1f')](respondWithResult(_0x492254,0xc9))[_0xa03a('0x3e')](handleError(_0x492254,null));};exports[_0xa03a('0x1e')]=function(_0x2fef2c,_0x1a87a4){if(_0x2fef2c[_0xa03a('0x45')]['id']){delete _0x2fef2c[_0xa03a('0x45')]['id'];}return db[_0xa03a('0x27')][_0xa03a('0x43')]({'where':{'id':_0x2fef2c[_0xa03a('0x40')]['id']}})[_0xa03a('0x1f')](handleEntityNotFound(_0x1a87a4,null))[_0xa03a('0x1f')](saveUpdates(_0x2fef2c[_0xa03a('0x45')],null))[_0xa03a('0x1f')](respondWithResult(_0x1a87a4,null))[_0xa03a('0x3e')](handleError(_0x1a87a4,null));};exports[_0xa03a('0x20')]=function(_0x217819,_0x3d6716){return db['VoiceDialReport'][_0xa03a('0x43')]({'where':{'id':_0x217819[_0xa03a('0x40')]['id']}})[_0xa03a('0x1f')](handleEntityNotFound(_0x3d6716,null))[_0xa03a('0x1f')](removeEntity(_0x3d6716,null))[_0xa03a('0x3e')](handleError(_0x3d6716,null));};exports['describe']=function(_0x3703ee,_0x29dbd6){return db[_0xa03a('0x27')][_0xa03a('0x46')]()[_0xa03a('0x1f')](respondWithResult(_0x29dbd6,null))['catch'](handleError(_0x29dbd6,null));}; \ No newline at end of file +var _0x7887=['moment','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','VoiceDialReport','includeAll','include','findAll','catch','show','length','options','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0xe12cab,_0x577f92){var _0x4db000=function(_0x445e81){while(--_0x445e81){_0xe12cab['push'](_0xe12cab['shift']());}};_0x4db000(++_0x577f92);}(_0x7887,0x16a));var _0x7788=function(_0x46e05c,_0x4df59d){_0x46e05c=_0x46e05c-0x0;var _0x33a4e5=_0x7887[_0x46e05c];return _0x33a4e5;};'use strict';var emlformat=require(_0x7788('0x0'));var rimraf=require(_0x7788('0x1'));var zipdir=require(_0x7788('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7788('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7788('0x4'));var sox=require(_0x7788('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7788('0x6'));var _=require('lodash');var squel=require(_0x7788('0x7'));var crypto=require(_0x7788('0x8'));var jsforce=require(_0x7788('0x9'));var deskjs=require(_0x7788('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7788('0xb'));var Papa=require('papaparse');var Redis=require(_0x7788('0xc'));var authService=require(_0x7788('0xd'));var qs=require(_0x7788('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7788('0xf'));var logger=require(_0x7788('0x10'))(_0x7788('0x11'));var utils=require(_0x7788('0x12'));var config=require(_0x7788('0x13'));var licenseUtil=require(_0x7788('0x14'));var db=require(_0x7788('0x15'))['db'];function respondWithStatusCode(_0x3c9525,_0x5d22ef){_0x5d22ef=_0x5d22ef||0xcc;return function(_0x1cb20a){if(_0x1cb20a){return _0x3c9525[_0x7788('0x16')](_0x5d22ef);}return _0x3c9525[_0x7788('0x17')](_0x5d22ef)[_0x7788('0x18')]();};}function respondWithResult(_0x35cea4,_0x132232){_0x132232=_0x132232||0xc8;return function(_0x20303c){if(_0x20303c){return _0x35cea4[_0x7788('0x17')](_0x132232)[_0x7788('0x19')](_0x20303c);}};}function respondWithFilteredResult(_0x5f1ee0,_0x316f88){return function(_0x30019f){if(_0x30019f){var _0x1970b6=typeof _0x316f88[_0x7788('0x1a')]==='undefined'&&typeof _0x316f88[_0x7788('0x1b')]===_0x7788('0x1c');var _0xa19350=_0x30019f[_0x7788('0x1d')];var _0x36ccca=_0x1970b6?0x0:_0x316f88[_0x7788('0x1a')];var _0x34aa52=_0x1970b6?_0x30019f[_0x7788('0x1d')]:_0x316f88['offset']+_0x316f88['limit'];var _0x2e5de9;if(_0x34aa52>=_0xa19350){_0x34aa52=_0xa19350;_0x2e5de9=0xc8;}else{_0x2e5de9=0xce;}_0x5f1ee0[_0x7788('0x17')](_0x2e5de9);return _0x5f1ee0[_0x7788('0x1e')](_0x7788('0x1f'),_0x36ccca+'-'+_0x34aa52+'/'+_0xa19350)[_0x7788('0x19')](_0x30019f);}return null;};}function patchUpdates(_0x2ac06e){return function(_0x246c23){try{jsonpatch['apply'](_0x246c23,_0x2ac06e,!![]);}catch(_0x1f7b4c){return BPromise[_0x7788('0x20')](_0x1f7b4c);}return _0x246c23['save']();};}function saveUpdates(_0x28f2d4,_0x3ff875){return function(_0x3f824d){if(_0x3f824d){return _0x3f824d[_0x7788('0x21')](_0x28f2d4)[_0x7788('0x22')](function(_0x1087f0){return _0x1087f0;});}return null;};}function removeEntity(_0x1f1c7b,_0x252b48){return function(_0x3cee9a){if(_0x3cee9a){return _0x3cee9a['destroy']()[_0x7788('0x22')](function(){_0x1f1c7b['status'](0xcc)[_0x7788('0x18')]();});}};}function handleEntityNotFound(_0x205311,_0x55bf08){return function(_0x2daada){if(!_0x2daada){_0x205311[_0x7788('0x16')](0x194);}return _0x2daada;};}function handleError(_0x3122de,_0x27882){_0x27882=_0x27882||0x1f4;return function(_0x899deb){logger[_0x7788('0x23')](_0x899deb[_0x7788('0x24')]);if(_0x899deb[_0x7788('0x25')]){delete _0x899deb['name'];}_0x3122de[_0x7788('0x17')](_0x27882)[_0x7788('0x26')](_0x899deb);};}exports[_0x7788('0x27')]=function(_0x1453f5,_0x330d15){var _0x321b92={},_0x3e2812={},_0x12b05e={'count':0x0,'rows':[]};var _0x4dc6b3=_[_0x7788('0x28')](db['VoiceDialReport'][_0x7788('0x29')],function(_0x27a7f5){return{'name':_0x27a7f5[_0x7788('0x2a')],'type':_0x27a7f5['type'][_0x7788('0x2b')]};});_0x3e2812[_0x7788('0x2c')]=_[_0x7788('0x28')](_0x4dc6b3,_0x7788('0x25'));_0x3e2812[_0x7788('0x2d')]=_[_0x7788('0x2e')](_0x1453f5[_0x7788('0x2d')]);_0x3e2812['filters']=_[_0x7788('0x2f')](_0x3e2812[_0x7788('0x2c')],_0x3e2812[_0x7788('0x2d')]);_0x321b92[_0x7788('0x30')]=_[_0x7788('0x2f')](_0x3e2812[_0x7788('0x2c')],qs[_0x7788('0x31')](_0x1453f5['query'][_0x7788('0x31')]));_0x321b92[_0x7788('0x30')]=_0x321b92[_0x7788('0x30')]['length']?_0x321b92['attributes']:_0x3e2812[_0x7788('0x2c')];if(!_0x1453f5[_0x7788('0x2d')][_0x7788('0x32')](_0x7788('0x33'))){_0x321b92[_0x7788('0x1b')]=qs[_0x7788('0x1b')](_0x1453f5[_0x7788('0x2d')]['limit']);_0x321b92['offset']=qs[_0x7788('0x1a')](_0x1453f5[_0x7788('0x2d')][_0x7788('0x1a')]);}_0x321b92['order']=qs[_0x7788('0x34')](_0x1453f5[_0x7788('0x2d')][_0x7788('0x34')]);_0x321b92['where']=qs[_0x7788('0x35')](_[_0x7788('0x36')](_0x1453f5[_0x7788('0x2d')],_0x3e2812['filters']),_0x4dc6b3);if(_0x1453f5['query'][_0x7788('0x37')]){_0x321b92[_0x7788('0x38')]=_[_0x7788('0x39')](_0x321b92['where'],{'$or':_[_0x7788('0x28')](_0x4dc6b3,function(_0x4855f6){if(_0x4855f6[_0x7788('0x3a')]!=='VIRTUAL'){var _0xe280b3={};_0xe280b3[_0x4855f6[_0x7788('0x25')]]={'$like':'%'+_0x1453f5[_0x7788('0x2d')][_0x7788('0x37')]+'%'};return _0xe280b3;}})});}_0x321b92=_[_0x7788('0x39')]({},_0x321b92,_0x1453f5['options']);var _0x219254={'where':_0x321b92[_0x7788('0x38')]};return db[_0x7788('0x3b')][_0x7788('0x1d')](_0x219254)['then'](function(_0xcee025){_0x12b05e[_0x7788('0x1d')]=_0xcee025;if(_0x1453f5[_0x7788('0x2d')][_0x7788('0x3c')]){_0x321b92[_0x7788('0x3d')]=[{'all':!![]}];}return db[_0x7788('0x3b')][_0x7788('0x3e')](_0x321b92);})[_0x7788('0x22')](function(_0x2df12a){_0x12b05e['rows']=_0x2df12a;return _0x12b05e;})[_0x7788('0x22')](respondWithFilteredResult(_0x330d15,_0x321b92))[_0x7788('0x3f')](handleError(_0x330d15,null));};exports[_0x7788('0x40')]=function(_0x138305,_0x4a119d){var _0x20d5aa={'raw':!![],'where':{'id':_0x138305['params']['id']}},_0x1e289f={};_0x1e289f[_0x7788('0x2c')]=_[_0x7788('0x2e')](db[_0x7788('0x3b')][_0x7788('0x29')]);_0x1e289f['query']=_[_0x7788('0x2e')](_0x138305[_0x7788('0x2d')]);_0x1e289f[_0x7788('0x35')]=_[_0x7788('0x2f')](_0x1e289f['model'],_0x1e289f['query']);_0x20d5aa[_0x7788('0x30')]=_[_0x7788('0x2f')](_0x1e289f[_0x7788('0x2c')],qs['fields'](_0x138305[_0x7788('0x2d')][_0x7788('0x31')]));_0x20d5aa[_0x7788('0x30')]=_0x20d5aa[_0x7788('0x30')][_0x7788('0x41')]?_0x20d5aa[_0x7788('0x30')]:_0x1e289f[_0x7788('0x2c')];if(_0x138305[_0x7788('0x2d')][_0x7788('0x3c')]){_0x20d5aa[_0x7788('0x3d')]=[{'all':!![]}];}_0x20d5aa=_['merge']({},_0x20d5aa,_0x138305[_0x7788('0x42')]);return db[_0x7788('0x3b')][_0x7788('0x43')](_0x20d5aa)[_0x7788('0x22')](handleEntityNotFound(_0x4a119d,null))[_0x7788('0x22')](respondWithResult(_0x4a119d,null))[_0x7788('0x3f')](handleError(_0x4a119d,null));};exports[_0x7788('0x44')]=function(_0x114ecc,_0x1e7a9c){return db['VoiceDialReport'][_0x7788('0x44')](_0x114ecc[_0x7788('0x45')],{})[_0x7788('0x22')](respondWithResult(_0x1e7a9c,0xc9))[_0x7788('0x3f')](handleError(_0x1e7a9c,null));};exports[_0x7788('0x21')]=function(_0x2d3f48,_0x10e406){if(_0x2d3f48['body']['id']){delete _0x2d3f48[_0x7788('0x45')]['id'];}return db[_0x7788('0x3b')][_0x7788('0x43')]({'where':{'id':_0x2d3f48[_0x7788('0x46')]['id']}})[_0x7788('0x22')](handleEntityNotFound(_0x10e406,null))[_0x7788('0x22')](saveUpdates(_0x2d3f48[_0x7788('0x45')],null))[_0x7788('0x22')](respondWithResult(_0x10e406,null))['catch'](handleError(_0x10e406,null));};exports[_0x7788('0x47')]=function(_0x501f45,_0x1d4066){return db[_0x7788('0x3b')]['find']({'where':{'id':_0x501f45[_0x7788('0x46')]['id']}})[_0x7788('0x22')](handleEntityNotFound(_0x1d4066,null))[_0x7788('0x22')](removeEntity(_0x1d4066,null))[_0x7788('0x3f')](handleError(_0x1d4066,null));};exports[_0x7788('0x48')]=function(_0x5e8835,_0xc1524f){return db['VoiceDialReport']['describe']()[_0x7788('0x22')](respondWithResult(_0xc1524f,null))[_0x7788('0x3f')](handleError(_0xc1524f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f7bdbac..75b53d0 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 _0x5249=['define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x12c9fd,_0x29b605){var _0x47d46b=function(_0x1a3616){while(--_0x1a3616){_0x12c9fd['push'](_0x12c9fd['shift']());}};_0x47d46b(++_0x29b605);}(_0x5249,0x8f));var _0x9524=function(_0x8b1c9c,_0x3cdca9){_0x8b1c9c=_0x8b1c9c-0x0;var _0x4b82d3=_0x5249[_0x8b1c9c];return _0x4b82d3;};'use strict';var _=require(_0x9524('0x0'));var util=require(_0x9524('0x1'));var logger=require(_0x9524('0x2'))(_0x9524('0x3'));var moment=require('moment');var BPromise=require(_0x9524('0x4'));var rp=require(_0x9524('0x5'));var fs=require('fs');var path=require(_0x9524('0x6'));var rimraf=require(_0x9524('0x7'));var config=require(_0x9524('0x8'));var attributes=require(_0x9524('0x9'));module[_0x9524('0xa')]=function(_0xe8e81b,_0x5d3710){return _0xe8e81b[_0x9524('0xb')](_0x9524('0xc'),attributes,{'tableName':_0x9524('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ae2=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','define','VoiceDialReport','report_dial'];(function(_0x4b7cf0,_0x824680){var _0x100c29=function(_0x209d74){while(--_0x209d74){_0x4b7cf0['push'](_0x4b7cf0['shift']());}};_0x100c29(++_0x824680);}(_0x8ae2,0x140));var _0x28ae=function(_0x54e1b7,_0x33705){_0x54e1b7=_0x54e1b7-0x0;var _0x3fc1b6=_0x8ae2[_0x54e1b7];return _0x3fc1b6;};'use strict';var _=require(_0x28ae('0x0'));var util=require(_0x28ae('0x1'));var logger=require(_0x28ae('0x2'))(_0x28ae('0x3'));var moment=require('moment');var BPromise=require(_0x28ae('0x4'));var rp=require(_0x28ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28ae('0x6'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x3ea80d,_0x2ea573){return _0x3ea80d[_0x28ae('0x7')](_0x28ae('0x8'),attributes,{'tableName':_0x28ae('0x9'),'paranoid':![],'indexes':[{'fields':[_0x28ae('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 96a8b14..cce7d2e 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 _0xf284=['jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','update','body','where','limit','UpdateVoiceDialReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xf284,0xc2));var _0x4f28=function(_0x4296f7,_0x4b1b9c){_0x4296f7=_0x4296f7-0x0;var _0x236e32=_0xf284[_0x4296f7];return _0x236e32;};'use strict';var _=require(_0x4f28('0x0'));var util=require(_0x4f28('0x1'));var moment=require(_0x4f28('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f28('0x3'));var fs=require('fs');var Redis=require(_0x4f28('0x4'));var db=require(_0x4f28('0x5'))['db'];var utils=require(_0x4f28('0x6'));var logger=require(_0x4f28('0x7'))(_0x4f28('0x8'));var config=require(_0x4f28('0x9'));var jayson=require(_0x4f28('0xa'));var client=jayson[_0x4f28('0xb')][_0x4f28('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39aa44,_0x42f9cd,_0x3462ea){return new BPromise(function(_0x19af9f,_0x52ffab){return client[_0x4f28('0xd')](_0x39aa44,_0x3462ea)[_0x4f28('0xe')](function(_0x1d737c){logger[_0x4f28('0xf')](_0x4f28('0x10'),_0x42f9cd,_0x4f28('0x11'));logger[_0x4f28('0x12')](_0x4f28('0x13'),_0x42f9cd,'request\x20sent',JSON[_0x4f28('0x14')](_0x1d737c));if(_0x1d737c[_0x4f28('0x15')]){if(_0x1d737c[_0x4f28('0x15')][_0x4f28('0x16')]===0x1f4){logger['error'](_0x4f28('0x10'),_0x42f9cd,_0x1d737c['error'][_0x4f28('0x17')]);return _0x52ffab(_0x1d737c['error'][_0x4f28('0x17')]);}logger['error'](_0x4f28('0x10'),_0x42f9cd,_0x1d737c[_0x4f28('0x15')][_0x4f28('0x17')]);return _0x19af9f(_0x1d737c[_0x4f28('0x15')][_0x4f28('0x17')]);}else{logger[_0x4f28('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x42f9cd,_0x4f28('0x11'));_0x19af9f(_0x1d737c['result'][_0x4f28('0x17')]);}})[_0x4f28('0x18')](function(_0x150248){logger[_0x4f28('0x15')](_0x4f28('0x10'),_0x42f9cd,_0x150248);_0x52ffab(_0x150248);});});}exports[_0x4f28('0x19')]=function(_0x346f27){var _0x2b4ce6=this;return new Promise(function(_0x27596b,_0x25c395){return db[_0x4f28('0x1a')]['create'](_0x346f27['body'],{'raw':_0x346f27['options']?_0x346f27[_0x4f28('0x1b')][_0x4f28('0x1c')]===undefined?!![]:![]:!![]})[_0x4f28('0xe')](function(_0x4f2243){logger['info'](_0x4f28('0x19'),_0x346f27);logger[_0x4f28('0x12')](_0x4f28('0x19'),_0x346f27,JSON['stringify'](_0x4f2243));_0x27596b(_0x4f2243);})[_0x4f28('0x18')](function(_0x476be0){logger['error'](_0x4f28('0x19'),_0x476be0[_0x4f28('0x17')],_0x346f27);_0x25c395(_0x2b4ce6[_0x4f28('0x15')](0x1f4,_0x476be0[_0x4f28('0x17')]));});});};exports['UpdateVoiceDialReport']=function(_0x2a5cc2){var _0x4be282=this;return new Promise(function(_0x5ac0c5,_0x5e056b){return db[_0x4f28('0x1a')][_0x4f28('0x1d')](_0x2a5cc2[_0x4f28('0x1e')],{'raw':_0x2a5cc2['options']?_0x2a5cc2[_0x4f28('0x1b')][_0x4f28('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a5cc2[_0x4f28('0x1b')]?_0x2a5cc2[_0x4f28('0x1b')][_0x4f28('0x1f')]||null:null,'attributes':_0x2a5cc2[_0x4f28('0x1b')]?_0x2a5cc2[_0x4f28('0x1b')]['attributes']||null:null,'limit':_0x2a5cc2[_0x4f28('0x1b')]?_0x2a5cc2[_0x4f28('0x1b')][_0x4f28('0x20')]||null:null})[_0x4f28('0xe')](function(_0x1e42db){logger[_0x4f28('0xf')](_0x4f28('0x21'),_0x2a5cc2);logger[_0x4f28('0x12')](_0x4f28('0x21'),_0x2a5cc2,JSON['stringify'](_0x1e42db));_0x5ac0c5(_0x1e42db);})[_0x4f28('0x18')](function(_0x1ddb7c){logger[_0x4f28('0x15')](_0x4f28('0x21'),_0x1ddb7c['message'],_0x2a5cc2);_0x5e056b(_0x4be282['error'](0x1f4,_0x1ddb7c[_0x4f28('0x17')]));});});}; \ No newline at end of file +var _0xf101=['raw','then','info','UpdateVoiceDialReport','update','limit','lodash','util','randomstring','../../config/utils','rpc','../../config/environment','client','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options'];(function(_0xedaf59,_0x563492){var _0x3efbc7=function(_0x23ffc3){while(--_0x23ffc3){_0xedaf59['push'](_0xedaf59['shift']());}};_0x3efbc7(++_0x563492);}(_0xf101,0xc3));var _0x1f10=function(_0x343e70,_0xe5f373){_0x343e70=_0x343e70-0x0;var _0x2742fd=_0xf101[_0x343e70];return _0x2742fd;};'use strict';var _=require(_0x1f10('0x0'));var util=require(_0x1f10('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1f10('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f10('0x3'));var logger=require('../../config/logger')(_0x1f10('0x4'));var config=require(_0x1f10('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1f10('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24f1a9,_0x1d4e2c,_0x5d12e4){return new BPromise(function(_0x142b0f,_0x22c57d){return client[_0x1f10('0x7')](_0x24f1a9,_0x5d12e4)['then'](function(_0x3edca5){logger['info'](_0x1f10('0x8'),_0x1d4e2c,_0x1f10('0x9'));logger[_0x1f10('0xa')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1d4e2c,_0x1f10('0x9'),JSON[_0x1f10('0xb')](_0x3edca5));if(_0x3edca5['error']){if(_0x3edca5[_0x1f10('0xc')][_0x1f10('0xd')]===0x1f4){logger[_0x1f10('0xc')](_0x1f10('0x8'),_0x1d4e2c,_0x3edca5['error'][_0x1f10('0xe')]);return _0x22c57d(_0x3edca5[_0x1f10('0xc')][_0x1f10('0xe')]);}logger[_0x1f10('0xc')](_0x1f10('0x8'),_0x1d4e2c,_0x3edca5[_0x1f10('0xc')][_0x1f10('0xe')]);return _0x142b0f(_0x3edca5[_0x1f10('0xc')][_0x1f10('0xe')]);}else{logger['info'](_0x1f10('0x8'),_0x1d4e2c,_0x1f10('0x9'));_0x142b0f(_0x3edca5[_0x1f10('0xf')][_0x1f10('0xe')]);}})[_0x1f10('0x10')](function(_0x388654){logger[_0x1f10('0xc')](_0x1f10('0x8'),_0x1d4e2c,_0x388654);_0x22c57d(_0x388654);});});}exports[_0x1f10('0x11')]=function(_0x157444){var _0x167d77=this;return new Promise(function(_0x37d0c7,_0x2bff6a){return db[_0x1f10('0x12')][_0x1f10('0x13')](_0x157444['body'],{'raw':_0x157444['options']?_0x157444[_0x1f10('0x14')][_0x1f10('0x15')]===undefined?!![]:![]:!![]})[_0x1f10('0x16')](function(_0x138827){logger[_0x1f10('0x17')](_0x1f10('0x11'),_0x157444);logger[_0x1f10('0xa')]('CreateVoiceDialReport',_0x157444,JSON[_0x1f10('0xb')](_0x138827));_0x37d0c7(_0x138827);})[_0x1f10('0x10')](function(_0x256d96){logger[_0x1f10('0xc')](_0x1f10('0x11'),_0x256d96[_0x1f10('0xe')],_0x157444);_0x2bff6a(_0x167d77[_0x1f10('0xc')](0x1f4,_0x256d96[_0x1f10('0xe')]));});});};exports[_0x1f10('0x18')]=function(_0x154ec0){var _0x141f53=this;return new Promise(function(_0x1a68b7,_0x14dd94){return db[_0x1f10('0x12')][_0x1f10('0x19')](_0x154ec0['body'],{'raw':_0x154ec0[_0x1f10('0x14')]?_0x154ec0[_0x1f10('0x14')][_0x1f10('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x154ec0['options']?_0x154ec0[_0x1f10('0x14')]['where']||null:null,'attributes':_0x154ec0[_0x1f10('0x14')]?_0x154ec0[_0x1f10('0x14')]['attributes']||null:null,'limit':_0x154ec0[_0x1f10('0x14')]?_0x154ec0['options'][_0x1f10('0x1a')]||null:null})[_0x1f10('0x16')](function(_0x3c4df6){logger[_0x1f10('0x17')](_0x1f10('0x18'),_0x154ec0);logger[_0x1f10('0xa')](_0x1f10('0x18'),_0x154ec0,JSON[_0x1f10('0xb')](_0x3c4df6));_0x1a68b7(_0x3c4df6);})[_0x1f10('0x10')](function(_0x11cdb2){logger[_0x1f10('0xc')](_0x1f10('0x18'),_0x11cdb2['message'],_0x154ec0);_0x14dd94(_0x141f53[_0x1f10('0xc')](0x1f4,_0x11cdb2[_0x1f10('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index b1b9d5a..e9cce2a 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 _0x13ce=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','/:id/applications','addApplications','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5c877c,_0x24e5ab){var _0x308ca7=function(_0xb706d8){while(--_0xb706d8){_0x5c877c['push'](_0x5c877c['shift']());}};_0x308ca7(++_0x24e5ab);}(_0x13ce,0x70));var _0xe13c=function(_0x5e280b,_0x4cbc23){_0x5e280b=_0x5e280b-0x0;var _0x1d800e=_0x13ce[_0x5e280b];return _0x1d800e;};'use strict';var multer=require('multer');var util=require(_0xe13c('0x0'));var path=require('path');var timeout=require(_0xe13c('0x1'));var express=require('express');var router=express[_0xe13c('0x2')]();var fs_extra=require(_0xe13c('0x3'));var auth=require(_0xe13c('0x4'));var interaction=require(_0xe13c('0x5'));var config=require(_0xe13c('0x6'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0xe13c('0x7')](),controller[_0xe13c('0x8')]);router[_0xe13c('0x9')](_0xe13c('0xa'),auth[_0xe13c('0x7')](),controller[_0xe13c('0xb')]);router[_0xe13c('0xc')]('/',auth[_0xe13c('0x7')](),controller['create']);router[_0xe13c('0xc')](_0xe13c('0xd'),auth[_0xe13c('0x7')](),controller[_0xe13c('0xe')]);router['put'](_0xe13c('0xa'),auth['isAuthenticated'](),controller[_0xe13c('0xf')]);router[_0xe13c('0x10')](_0xe13c('0xa'),auth[_0xe13c('0x7')](),controller[_0xe13c('0x11')]);module[_0xe13c('0x12')]=router; \ No newline at end of file +var _0x652f=['index','/:id','show','post','create','/:id/applications','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated'];(function(_0x218655,_0x459551){var _0x4f2909=function(_0x534494){while(--_0x534494){_0x218655['push'](_0x218655['shift']());}};_0x4f2909(++_0x459551);}(_0x652f,0x11e));var _0xf652=function(_0x18347a,_0x52a459){_0x18347a=_0x18347a-0x0;var _0x1c2057=_0x652f[_0x18347a];return _0x1c2057;};'use strict';var multer=require(_0xf652('0x0'));var util=require(_0xf652('0x1'));var path=require(_0xf652('0x2'));var timeout=require(_0xf652('0x3'));var express=require(_0xf652('0x4'));var router=express[_0xf652('0x5')]();var fs_extra=require(_0xf652('0x6'));var auth=require(_0xf652('0x7'));var interaction=require(_0xf652('0x8'));var config=require(_0xf652('0x9'));var controller=require(_0xf652('0xa'));router[_0xf652('0xb')]('/',auth[_0xf652('0xc')](),controller[_0xf652('0xd')]);router['get'](_0xf652('0xe'),auth[_0xf652('0xc')](),controller[_0xf652('0xf')]);router[_0xf652('0x10')]('/',auth[_0xf652('0xc')](),controller[_0xf652('0x11')]);router[_0xf652('0x10')](_0xf652('0x12'),auth[_0xf652('0xc')](),controller['addApplications']);router[_0xf652('0x13')](_0xf652('0xe'),auth[_0xf652('0xc')](),controller[_0xf652('0x14')]);router['delete'](_0xf652('0xe'),auth[_0xf652('0xc')](),controller[_0xf652('0x15')]);module[_0xf652('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index b42c094..7764201 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 _0x112a=['internal','inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x26fafd,_0x4bf302){var _0x4b1f9b=function(_0x3f5a58){while(--_0x3f5a58){_0x26fafd['push'](_0x26fafd['shift']());}};_0x4b1f9b(++_0x4bf302);}(_0x112a,0xd7));var _0xa112=function(_0x5e8c20,_0x255ef1){_0x5e8c20=_0x5e8c20-0x0;var _0x328ddd=_0x112a[_0x5e8c20];return _0x328ddd;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xa112('0x0')],'allowNull':![],'unique':_0xa112('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xa112('0x0')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xa112('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xa112('0x0')],'allowNull':![],'defaultValue':_0xa112('0x2')},'appdata':{'type':Sequelize[_0xa112('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xa112('0x3')](_0xa112('0x4'),_0xa112('0x5'),_0xa112('0x6'),_0xa112('0x7'),_0xa112('0x8'),_0xa112('0x9'),_0xa112('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xa112('0x0')]},'interval':{'type':Sequelize[_0xa112('0x0')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xa112('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xa112('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xa112('0xb')]},'recordingFormat':{'type':Sequelize[_0xa112('0x0')],'defaultValue':_0xa112('0xd')},'answer':{'type':Sequelize[_0xa112('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xa112('0xe')],'get':function(_0x1332d6){return this[_0xa112('0xf')](_0xa112('0x10'));}},'alias':{'type':Sequelize[_0xa112('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x422b=['NoOp','ENUM','inbound','outbound','internal','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING'];(function(_0x3147de,_0x31a150){var _0x3cbd4d=function(_0x4ab80b){while(--_0x4ab80b){_0x3147de['push'](_0x3147de['shift']());}};_0x3cbd4d(++_0x31a150);}(_0x422b,0x164));var _0xb422=function(_0x37c12b,_0x27a9fa){_0x37c12b=_0x37c12b-0x0;var _0x319304=_0x422b[_0x37c12b];return _0x319304;};'use strict';var Sequelize=require(_0xb422('0x0'));module[_0xb422('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb422('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xb422('0x3')],'allowNull':![],'unique':_0xb422('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xb422('0x2')},'tag':{'type':Sequelize[_0xb422('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb422('0x3')],'allowNull':![],'defaultValue':_0xb422('0x4')},'appdata':{'type':Sequelize[_0xb422('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xb422('0x5')](_0xb422('0x6'),_0xb422('0x7'),_0xb422('0x8'),'inbound-fax',_0xb422('0x9'),'system',_0xb422('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xb422('0x3')]},'interval':{'type':Sequelize[_0xb422('0x3')],'allowNull':![],'defaultValue':_0xb422('0xb')},'IntervalId':{'type':Sequelize[_0xb422('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xb422('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xb422('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0xb422('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb422('0xc')]},'recordingFormat':{'type':Sequelize[_0xb422('0x3')],'defaultValue':_0xb422('0xe')},'answer':{'type':Sequelize[_0xb422('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb422('0xf')],'get':function(_0x12f8c9){return this[_0xb422('0x10')](_0xb422('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index ea3a8a9..9be6fb8 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 _0xa208=['findAll','rows','catch','show','params','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','type','find','name','UserProfileResource','error','index','map','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x1181f5,_0x3e8551){var _0x2c806e=function(_0x325dca){while(--_0x325dca){_0x1181f5['push'](_0x1181f5['shift']());}};_0x2c806e(++_0x3e8551);}(_0xa208,0x13b));var _0x8a20=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa208[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x8a20('0x0'));var Redis=require(_0x8a20('0x1'));var qs=require(_0x8a20('0x2'));var logger=require(_0x8a20('0x3'))(_0x8a20('0x4'));var config=require(_0x8a20('0x5'));var db=require(_0x8a20('0x6'))['db'];config[_0x8a20('0x7')]=_[_0x8a20('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8a20('0x9'))(new Redis(config['redis']));require(_0x8a20('0xa'))[_0x8a20('0xb')](socket);function respondWithStatusCode(_0x481ce8,_0x532cb7){_0x532cb7=_0x532cb7||0xcc;return function(_0xd67b4c){if(_0xd67b4c){return _0x481ce8[_0x8a20('0xc')](_0x532cb7);}return _0x481ce8[_0x8a20('0xd')](_0x532cb7)[_0x8a20('0xe')]();};}function respondWithResult(_0x4993d5,_0x30e56b){_0x30e56b=_0x30e56b||0xc8;return function(_0x15c8e6){if(_0x15c8e6){return _0x4993d5['status'](_0x30e56b)['json'](_0x15c8e6);}};}function respondWithFilteredResult(_0x3d7550,_0x199d65){return function(_0xfa7c1){if(_0xfa7c1){var _0x3e4fe9=typeof _0x199d65[_0x8a20('0xf')]===_0x8a20('0x10')&&typeof _0x199d65[_0x8a20('0x11')]===_0x8a20('0x10');var _0xa45e8c=_0xfa7c1['count'];var _0x3ac7c8=_0x3e4fe9?0x0:_0x199d65['offset'];var _0x4db18c=_0x3e4fe9?_0xfa7c1[_0x8a20('0x12')]:_0x199d65['offset']+_0x199d65[_0x8a20('0x11')];var _0x34e5b5;if(_0x4db18c>=_0xa45e8c){_0x4db18c=_0xa45e8c;_0x34e5b5=0xc8;}else{_0x34e5b5=0xce;}_0x3d7550[_0x8a20('0xd')](_0x34e5b5);return _0x3d7550['set'](_0x8a20('0x13'),_0x3ac7c8+'-'+_0x4db18c+'/'+_0xa45e8c)[_0x8a20('0x14')](_0xfa7c1);}return null;};}function removeEntity(_0x4254ec){return function(_0x161040){if(_0x161040){return _0x161040[_0x8a20('0x15')]()[_0x8a20('0x16')](function(){var _0x5efa16=_0x161040[_0x8a20('0x17')]({'plain':!![]});var _0x5be9da=[{'name':'InboundRoutes','value':_0x8a20('0x18'),'ignore':![]},{'name':_0x8a20('0x19'),'value':_0x8a20('0x1a'),'ignore':![]},{'name':_0x8a20('0x1b'),'value':_0x8a20('0x1c'),'ignore':![]}];var _0x18a17a=_(_0x5be9da)[_0x8a20('0x1d')](_0x8a20('0x1e'))['map'](_0x8a20('0x1f'))[_0x8a20('0x1f')]();if(_['includes'](_0x18a17a,_0x5efa16[_0x8a20('0x20')])){return;}var _0x1f8ca8=_[_0x8a20('0x21')](_0x5be9da,[_0x8a20('0x1f'),_0x5efa16['type']])[_0x8a20('0x22')];return db[_0x8a20('0x23')][_0x8a20('0x15')]({'where':{'type':_0x1f8ca8,'resourceId':_0x5efa16['id']}})[_0x8a20('0x16')](function(){return _0x161040;});})['then'](function(){_0x4254ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x516086){return function(_0x267e8e){if(!_0x267e8e){_0x516086['sendStatus'](0x194);}return _0x267e8e;};}function handleError(_0x522a9c,_0x85ec00){_0x85ec00=_0x85ec00||0x1f4;return function(_0x1959f8){logger[_0x8a20('0x24')](_0x1959f8['stack']);if(_0x1959f8[_0x8a20('0x22')]){delete _0x1959f8[_0x8a20('0x22')];}_0x522a9c['status'](_0x85ec00)['send'](_0x1959f8);};}exports[_0x8a20('0x25')]=function(_0x5431f1,_0x4c077e){var _0x7d9834={},_0xce8158={},_0x4a6b0c={'count':0x0,'rows':[]};var _0x29b3ca=_[_0x8a20('0x26')](db[_0x8a20('0x27')][_0x8a20('0x28')],function(_0x46a38c){return{'name':_0x46a38c[_0x8a20('0x29')],'type':_0x46a38c[_0x8a20('0x20')][_0x8a20('0x2a')]};});_0xce8158['model']=_[_0x8a20('0x26')](_0x29b3ca,_0x8a20('0x22'));_0xce8158[_0x8a20('0x2b')]=_[_0x8a20('0x2c')](_0x5431f1[_0x8a20('0x2b')]);_0xce8158[_0x8a20('0x2d')]=_[_0x8a20('0x2e')](_0xce8158[_0x8a20('0x2f')],_0xce8158[_0x8a20('0x2b')]);_0x7d9834[_0x8a20('0x30')]=_[_0x8a20('0x2e')](_0xce8158[_0x8a20('0x2f')],qs[_0x8a20('0x31')](_0x5431f1[_0x8a20('0x2b')][_0x8a20('0x31')]));_0x7d9834[_0x8a20('0x30')]=_0x7d9834[_0x8a20('0x30')][_0x8a20('0x32')]?_0x7d9834[_0x8a20('0x30')]:_0xce8158['model'];if(!_0x5431f1[_0x8a20('0x2b')][_0x8a20('0x33')]('nolimit')){_0x7d9834['limit']=qs[_0x8a20('0x11')](_0x5431f1[_0x8a20('0x2b')][_0x8a20('0x11')]);_0x7d9834[_0x8a20('0xf')]=qs[_0x8a20('0xf')](_0x5431f1[_0x8a20('0x2b')]['offset']);}_0x7d9834[_0x8a20('0x34')]=qs['sort'](_0x5431f1[_0x8a20('0x2b')][_0x8a20('0x35')]);_0x7d9834['where']=qs[_0x8a20('0x2d')](_[_0x8a20('0x36')](_0x5431f1[_0x8a20('0x2b')],_0xce8158['filters']),_0x29b3ca);if(_0x5431f1[_0x8a20('0x2b')][_0x8a20('0x1d')]){_0x7d9834[_0x8a20('0x37')]=_[_0x8a20('0x38')](_0x7d9834[_0x8a20('0x37')],{'$or':_[_0x8a20('0x26')](_0x29b3ca,function(_0x324f4f){if(_0x324f4f[_0x8a20('0x20')]!==_0x8a20('0x39')){var _0x5cdc37={};_0x5cdc37[_0x324f4f[_0x8a20('0x22')]]={'$like':'%'+_0x5431f1[_0x8a20('0x2b')][_0x8a20('0x1d')]+'%'};return _0x5cdc37;}})});}_0x7d9834=_[_0x8a20('0x38')]({},_0x7d9834,_0x5431f1[_0x8a20('0x3a')]);var _0x85c248={'where':_0x7d9834[_0x8a20('0x37')]};return db['VoiceExtension'][_0x8a20('0x12')](_0x85c248)[_0x8a20('0x16')](function(_0x5e12b){_0x4a6b0c[_0x8a20('0x12')]=_0x5e12b;if(_0x5431f1[_0x8a20('0x2b')][_0x8a20('0x3b')]){_0x7d9834[_0x8a20('0x3c')]=[{'all':!![]}];}return db[_0x8a20('0x27')][_0x8a20('0x3d')](_0x7d9834);})['then'](function(_0x364d14){_0x4a6b0c[_0x8a20('0x3e')]=_0x364d14;return _0x4a6b0c;})[_0x8a20('0x16')](respondWithFilteredResult(_0x4c077e,_0x7d9834))[_0x8a20('0x3f')](handleError(_0x4c077e,null));};exports[_0x8a20('0x40')]=function(_0x2fbf47,_0x11ecbc){var _0x24d660={'raw':![],'where':{'id':_0x2fbf47['params']['id']}},_0x14624e={};_0x14624e[_0x8a20('0x2f')]=_[_0x8a20('0x2c')](db['VoiceExtension']['rawAttributes']);_0x14624e[_0x8a20('0x2b')]=_['keys'](_0x2fbf47[_0x8a20('0x2b')]);_0x14624e[_0x8a20('0x2d')]=_[_0x8a20('0x2e')](_0x14624e[_0x8a20('0x2f')],_0x14624e[_0x8a20('0x2b')]);_0x24d660[_0x8a20('0x30')]=_[_0x8a20('0x2e')](_0x14624e[_0x8a20('0x2f')],qs['fields'](_0x2fbf47['query'][_0x8a20('0x31')]));_0x24d660[_0x8a20('0x30')]=_0x24d660['attributes']['length']?_0x24d660[_0x8a20('0x30')]:_0x14624e[_0x8a20('0x2f')];if(_0x2fbf47[_0x8a20('0x2b')]['includeAll']){_0x24d660[_0x8a20('0x3c')]=[{'all':!![]}];}_0x24d660=_[_0x8a20('0x38')]({},_0x24d660,_0x2fbf47[_0x8a20('0x3a')]);return db[_0x8a20('0x27')][_0x8a20('0x21')](_0x24d660)[_0x8a20('0x16')](handleEntityNotFound(_0x11ecbc,null))[_0x8a20('0x16')](respondWithResult(_0x11ecbc,null))['catch'](handleError(_0x11ecbc,null));};exports[_0x8a20('0x15')]=function(_0x4a7050,_0x16ffb2){return db['VoiceExtension'][_0x8a20('0x21')]({'where':{'id':_0x4a7050[_0x8a20('0x41')]['id']}})[_0x8a20('0x16')](handleEntityNotFound(_0x16ffb2,null))[_0x8a20('0x16')](removeEntity(_0x16ffb2,null))[_0x8a20('0x3f')](handleError(_0x16ffb2,null));};exports[_0x8a20('0x42')]=function(_0x41bbda,_0x2d8471){if(_0x41bbda['body'][_0x8a20('0x20')]===_0x8a20('0x1a')&&!_['startsWith'](_0x41bbda[_0x8a20('0x43')][_0x8a20('0x44')],'_')){_0x41bbda[_0x8a20('0x43')]['exten']='_'[_0x8a20('0x45')](_0x41bbda[_0x8a20('0x43')][_0x8a20('0x44')]);}return db[_0x8a20('0x27')][_0x8a20('0x42')](_0x41bbda[_0x8a20('0x43')],{'raw':![]})[_0x8a20('0x16')](function(_0x27cbef){var _0x5807e2=_0x41bbda[_0x8a20('0x46')][_0x8a20('0x17')]({'plain':!![]});if(!_0x5807e2)throw new Error(_0x8a20('0x47'));if(_0x5807e2[_0x8a20('0x48')]===_0x8a20('0x46')){var _0x57acd5=_0x27cbef[_0x8a20('0x17')]({'plain':!![]});var _0x4818c8=[{'name':_0x8a20('0x49'),'value':_0x8a20('0x18')},{'name':_0x8a20('0x19'),'value':_0x8a20('0x1a')},{'name':'InternalRoutes','value':_0x8a20('0x1c')}];var _0x106707=_[_0x8a20('0x21')](_0x4818c8,['value',_0x57acd5[_0x8a20('0x20')]])['name'];return db['UserProfileSection'][_0x8a20('0x21')]({'where':{'name':_0x106707,'userProfileId':_0x5807e2['userProfileId']},'raw':!![]})['then'](function(_0x661a7c){if(_0x661a7c&&_0x661a7c[_0x8a20('0x4a')]===0x0){return db[_0x8a20('0x23')][_0x8a20('0x42')]({'name':_0x57acd5[_0x8a20('0x22')],'resourceId':_0x57acd5['id'],'type':_0x661a7c[_0x8a20('0x22')],'sectionId':_0x661a7c['id']},{})[_0x8a20('0x16')](function(){return _0x27cbef;});}else{return _0x27cbef;}})[_0x8a20('0x3f')](function(_0x2f7140){logger[_0x8a20('0x24')](_0x8a20('0x4b'),_0x2f7140);throw _0x2f7140;});}return _0x27cbef;})[_0x8a20('0x16')](respondWithResult(_0x2d8471,0xc9))[_0x8a20('0x3f')](handleError(_0x2d8471,null));};exports[_0x8a20('0x4c')]=function(_0x21f9a8,_0x274d1e){if(_0x21f9a8[_0x8a20('0x43')]['id']){delete _0x21f9a8[_0x8a20('0x43')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x21f9a8[_0x8a20('0x41')]['id']}})['then'](handleEntityNotFound(_0x274d1e,null))[_0x8a20('0x16')](function(_0x298585){if(_0x298585){return db[_0x8a20('0x27')]['update'](_[_0x8a20('0x36')](_0x21f9a8[_0x8a20('0x43')],['exten',_0x8a20('0x4d'),_0x8a20('0x4e'),'recordingFormat',_0x8a20('0x4f'),_0x8a20('0x50'),'alias']),{'where':{'context':_0x298585[_0x8a20('0x4d')],'exten':_0x298585[_0x8a20('0x44')]},'individualHooks':!![]})[_0x8a20('0x16')](function(_0x343794){return _0x343794;});}return null;})['then'](respondWithStatusCode(_0x274d1e,null))[_0x8a20('0x3f')](handleError(_0x274d1e,null));};exports[_0x8a20('0x51')]=function(_0x4ba13e,_0x142400){var _0xabc413=_0x4ba13e[_0x8a20('0x41')]['id'];var _0x566ab6=_0x4ba13e[_0x8a20('0x43')];var _0x548d2c=0xc8;var _0x14fc59=null;return db[_0x8a20('0x52')][_0x8a20('0x53')]({'isolationLevel':db[_0x8a20('0x52')]['Transaction'][_0x8a20('0x54')][_0x8a20('0x55')]},function(_0x2ad981){return db[_0x8a20('0x27')][_0x8a20('0x56')]({'where':{'id':_0xabc413},'transaction':_0x2ad981})['then'](function(_0x528ce9){if(_0x528ce9){return db[_0x8a20('0x27')][_0x8a20('0x15')]({'where':{'VoiceExtensionId':_0xabc413},'transaction':_0x2ad981})[_0x8a20('0x16')](function(){var _0x20f6fa=_[_0x8a20('0x26')](_0x566ab6,function(_0x3b565e){_0x3b565e[_0x8a20('0x57')]=_0xabc413;_0x3b565e['isApp']=!![];return _0x3b565e;});return _0x528ce9[_0x8a20('0x58')](_0x20f6fa);})['then'](function(_0xd2a76b){return db[_0x8a20('0x27')]['bulkCreate'](_0xd2a76b,{'transaction':_0x2ad981});});}else{_0x548d2c=0x194;_0x14fc59=[];}});})['then'](function(){if(_0x548d2c!==0x194){return db[_0x8a20('0x27')][_0x8a20('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0xabc413},'order':_0x8a20('0x5a')})[_0x8a20('0x16')](function(_0x143eb2){_0x14fc59=_0x143eb2;});}})[_0x8a20('0x3f')](function(_0x3aab55){_0x548d2c=0x1f4;logger[_0x8a20('0x24')](_0x3aab55[_0x8a20('0x5b')]);if(_0x3aab55[_0x8a20('0x22')]){delete _0x3aab55[_0x8a20('0x22')];}_0x14fc59=_0x3aab55;})[_0x8a20('0x5c')](function(){if(_0x14fc59===null){_0x142400[_0x8a20('0xc')](_0x548d2c);}else{if(_0x548d2c===0x1f4){_0x142400[_0x8a20('0xd')](_0x548d2c)[_0x8a20('0x5d')](_0x14fc59);}else{_0x142400['status'](_0x548d2c)[_0x8a20('0x14')](_0x14fc59);}}});}; \ No newline at end of file +var _0x75ba=['update','params','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','keys','body','outbound','startsWith','exten','concat','create','user','role','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x1773ec,_0x443b1b){var _0x1686e3=function(_0x32324b){while(--_0x32324b){_0x1773ec['push'](_0x1773ec['shift']());}};_0x1686e3(++_0x443b1b);}(_0x75ba,0x6e));var _0xa75b=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x75ba[_0xb0de07];return _0x4633d8;};'use strict';var _=require(_0xa75b('0x0'));var Redis=require('ioredis');var qs=require(_0xa75b('0x1'));var logger=require(_0xa75b('0x2'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa75b('0x3')]=_[_0xa75b('0x4')](config[_0xa75b('0x3')],{'host':_0xa75b('0x5'),'port':0x18eb});var socket=require(_0xa75b('0x6'))(new Redis(config[_0xa75b('0x3')]));require(_0xa75b('0x7'))[_0xa75b('0x8')](socket);function respondWithStatusCode(_0x15a44f,_0x41a567){_0x41a567=_0x41a567||0xcc;return function(_0x52a821){if(_0x52a821){return _0x15a44f[_0xa75b('0x9')](_0x41a567);}return _0x15a44f[_0xa75b('0xa')](_0x41a567)[_0xa75b('0xb')]();};}function respondWithResult(_0x29bde3,_0x540624){_0x540624=_0x540624||0xc8;return function(_0x5b61dc){if(_0x5b61dc){return _0x29bde3[_0xa75b('0xa')](_0x540624)[_0xa75b('0xc')](_0x5b61dc);}};}function respondWithFilteredResult(_0x4ff1d5,_0x5d194a){return function(_0x4eecb2){if(_0x4eecb2){var _0x19f97d=typeof _0x5d194a['offset']===_0xa75b('0xd')&&typeof _0x5d194a[_0xa75b('0xe')]===_0xa75b('0xd');var _0x5effe2=_0x4eecb2['count'];var _0x56d579=_0x19f97d?0x0:_0x5d194a[_0xa75b('0xf')];var _0x8f23ad=_0x19f97d?_0x4eecb2[_0xa75b('0x10')]:_0x5d194a[_0xa75b('0xf')]+_0x5d194a[_0xa75b('0xe')];var _0x36d46f;if(_0x8f23ad>=_0x5effe2){_0x8f23ad=_0x5effe2;_0x36d46f=0xc8;}else{_0x36d46f=0xce;}_0x4ff1d5[_0xa75b('0xa')](_0x36d46f);return _0x4ff1d5[_0xa75b('0x11')]('Content-Range',_0x56d579+'-'+_0x8f23ad+'/'+_0x5effe2)[_0xa75b('0xc')](_0x4eecb2);}return null;};}function removeEntity(_0x17413e){return function(_0x22ed7e){if(_0x22ed7e){return _0x22ed7e[_0xa75b('0x12')]()[_0xa75b('0x13')](function(){var _0x1911f0=_0x22ed7e[_0xa75b('0x14')]({'plain':!![]});var _0x50dde6=[{'name':_0xa75b('0x15'),'value':_0xa75b('0x16'),'ignore':![]},{'name':_0xa75b('0x17'),'value':'outbound','ignore':![]},{'name':_0xa75b('0x18'),'value':'internal','ignore':![]}];var _0x4c99a5=_(_0x50dde6)['filter'](_0xa75b('0x19'))[_0xa75b('0x1a')](_0xa75b('0x1b'))['value']();if(_[_0xa75b('0x1c')](_0x4c99a5,_0x1911f0[_0xa75b('0x1d')])){return;}var _0x4d9d16=_[_0xa75b('0x1e')](_0x50dde6,[_0xa75b('0x1b'),_0x1911f0['type']])[_0xa75b('0x1f')];return db[_0xa75b('0x20')]['destroy']({'where':{'type':_0x4d9d16,'resourceId':_0x1911f0['id']}})[_0xa75b('0x13')](function(){return _0x22ed7e;});})['then'](function(){_0x17413e[_0xa75b('0xa')](0xcc)[_0xa75b('0xb')]();});}};}function handleEntityNotFound(_0x507fb6){return function(_0x241d88){if(!_0x241d88){_0x507fb6['sendStatus'](0x194);}return _0x241d88;};}function handleError(_0x317736,_0x551e10){_0x551e10=_0x551e10||0x1f4;return function(_0x1a337e){logger[_0xa75b('0x21')](_0x1a337e[_0xa75b('0x22')]);if(_0x1a337e[_0xa75b('0x1f')]){delete _0x1a337e['name'];}_0x317736['status'](_0x551e10)[_0xa75b('0x23')](_0x1a337e);};}exports[_0xa75b('0x24')]=function(_0x170e78,_0x5ea8a8){var _0x1c2e93={},_0x44f8d5={},_0x46f3d8={'count':0x0,'rows':[]};var _0x1889b7=_[_0xa75b('0x1a')](db[_0xa75b('0x25')][_0xa75b('0x26')],function(_0x259b34){return{'name':_0x259b34[_0xa75b('0x27')],'type':_0x259b34[_0xa75b('0x1d')][_0xa75b('0x28')]};});_0x44f8d5[_0xa75b('0x29')]=_[_0xa75b('0x1a')](_0x1889b7,_0xa75b('0x1f'));_0x44f8d5[_0xa75b('0x2a')]=_['keys'](_0x170e78[_0xa75b('0x2a')]);_0x44f8d5[_0xa75b('0x2b')]=_[_0xa75b('0x2c')](_0x44f8d5[_0xa75b('0x29')],_0x44f8d5[_0xa75b('0x2a')]);_0x1c2e93['attributes']=_[_0xa75b('0x2c')](_0x44f8d5[_0xa75b('0x29')],qs['fields'](_0x170e78[_0xa75b('0x2a')][_0xa75b('0x2d')]));_0x1c2e93['attributes']=_0x1c2e93[_0xa75b('0x2e')][_0xa75b('0x2f')]?_0x1c2e93[_0xa75b('0x2e')]:_0x44f8d5['model'];if(!_0x170e78[_0xa75b('0x2a')][_0xa75b('0x30')](_0xa75b('0x31'))){_0x1c2e93[_0xa75b('0xe')]=qs[_0xa75b('0xe')](_0x170e78['query'][_0xa75b('0xe')]);_0x1c2e93[_0xa75b('0xf')]=qs[_0xa75b('0xf')](_0x170e78[_0xa75b('0x2a')][_0xa75b('0xf')]);}_0x1c2e93['order']=qs[_0xa75b('0x32')](_0x170e78[_0xa75b('0x2a')][_0xa75b('0x32')]);_0x1c2e93[_0xa75b('0x33')]=qs[_0xa75b('0x2b')](_['pick'](_0x170e78[_0xa75b('0x2a')],_0x44f8d5[_0xa75b('0x2b')]),_0x1889b7);if(_0x170e78['query'][_0xa75b('0x34')]){_0x1c2e93[_0xa75b('0x33')]=_[_0xa75b('0x35')](_0x1c2e93['where'],{'$or':_['map'](_0x1889b7,function(_0x3131e1){if(_0x3131e1[_0xa75b('0x1d')]!==_0xa75b('0x36')){var _0x1f317c={};_0x1f317c[_0x3131e1[_0xa75b('0x1f')]]={'$like':'%'+_0x170e78[_0xa75b('0x2a')][_0xa75b('0x34')]+'%'};return _0x1f317c;}})});}_0x1c2e93=_['merge']({},_0x1c2e93,_0x170e78[_0xa75b('0x37')]);var _0x50f0e3={'where':_0x1c2e93[_0xa75b('0x33')]};return db[_0xa75b('0x25')]['count'](_0x50f0e3)[_0xa75b('0x13')](function(_0x311ac7){_0x46f3d8['count']=_0x311ac7;if(_0x170e78[_0xa75b('0x2a')][_0xa75b('0x38')]){_0x1c2e93[_0xa75b('0x39')]=[{'all':!![]}];}return db[_0xa75b('0x25')]['findAll'](_0x1c2e93);})[_0xa75b('0x13')](function(_0x32f532){_0x46f3d8[_0xa75b('0x3a')]=_0x32f532;return _0x46f3d8;})[_0xa75b('0x13')](respondWithFilteredResult(_0x5ea8a8,_0x1c2e93))[_0xa75b('0x3b')](handleError(_0x5ea8a8,null));};exports['show']=function(_0x2f9623,_0x3488e4){var _0x3a185f={'raw':![],'where':{'id':_0x2f9623['params']['id']}},_0x3e364f={};_0x3e364f[_0xa75b('0x29')]=_[_0xa75b('0x3c')](db[_0xa75b('0x25')][_0xa75b('0x26')]);_0x3e364f[_0xa75b('0x2a')]=_['keys'](_0x2f9623[_0xa75b('0x2a')]);_0x3e364f['filters']=_[_0xa75b('0x2c')](_0x3e364f[_0xa75b('0x29')],_0x3e364f['query']);_0x3a185f[_0xa75b('0x2e')]=_[_0xa75b('0x2c')](_0x3e364f[_0xa75b('0x29')],qs['fields'](_0x2f9623[_0xa75b('0x2a')]['fields']));_0x3a185f[_0xa75b('0x2e')]=_0x3a185f[_0xa75b('0x2e')][_0xa75b('0x2f')]?_0x3a185f[_0xa75b('0x2e')]:_0x3e364f['model'];if(_0x2f9623[_0xa75b('0x2a')][_0xa75b('0x38')]){_0x3a185f['include']=[{'all':!![]}];}_0x3a185f=_[_0xa75b('0x35')]({},_0x3a185f,_0x2f9623[_0xa75b('0x37')]);return db['VoiceExtension'][_0xa75b('0x1e')](_0x3a185f)[_0xa75b('0x13')](handleEntityNotFound(_0x3488e4,null))['then'](respondWithResult(_0x3488e4,null))[_0xa75b('0x3b')](handleError(_0x3488e4,null));};exports[_0xa75b('0x12')]=function(_0x321921,_0x40c333){return db[_0xa75b('0x25')][_0xa75b('0x1e')]({'where':{'id':_0x321921['params']['id']}})[_0xa75b('0x13')](handleEntityNotFound(_0x40c333,null))[_0xa75b('0x13')](removeEntity(_0x40c333,null))['catch'](handleError(_0x40c333,null));};exports['create']=function(_0x4df1d1,_0x43d086){if(_0x4df1d1[_0xa75b('0x3d')]['type']===_0xa75b('0x3e')&&!_[_0xa75b('0x3f')](_0x4df1d1['body'][_0xa75b('0x40')],'_')){_0x4df1d1['body'][_0xa75b('0x40')]='_'[_0xa75b('0x41')](_0x4df1d1[_0xa75b('0x3d')][_0xa75b('0x40')]);}return db[_0xa75b('0x25')][_0xa75b('0x42')](_0x4df1d1['body'],{'raw':![]})['then'](function(_0x2a7b83){var _0x3a203f=_0x4df1d1[_0xa75b('0x43')]['get']({'plain':!![]});if(!_0x3a203f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a203f[_0xa75b('0x44')]==='user'){var _0x56ebc9=_0x2a7b83['get']({'plain':!![]});var _0x46d25f=[{'name':_0xa75b('0x15'),'value':_0xa75b('0x16')},{'name':_0xa75b('0x17'),'value':_0xa75b('0x3e')},{'name':_0xa75b('0x18'),'value':_0xa75b('0x45')}];var _0x359de0=_['find'](_0x46d25f,[_0xa75b('0x1b'),_0x56ebc9[_0xa75b('0x1d')]])['name'];return db[_0xa75b('0x46')][_0xa75b('0x1e')]({'where':{'name':_0x359de0,'userProfileId':_0x3a203f[_0xa75b('0x47')]},'raw':!![]})[_0xa75b('0x13')](function(_0x3c055d){if(_0x3c055d&&_0x3c055d[_0xa75b('0x48')]===0x0){return db['UserProfileResource'][_0xa75b('0x42')]({'name':_0x56ebc9[_0xa75b('0x1f')],'resourceId':_0x56ebc9['id'],'type':_0x3c055d[_0xa75b('0x1f')],'sectionId':_0x3c055d['id']},{})['then'](function(){return _0x2a7b83;});}else{return _0x2a7b83;}})['catch'](function(_0x45f9a8){logger[_0xa75b('0x21')](_0xa75b('0x49'),_0x45f9a8);throw _0x45f9a8;});}return _0x2a7b83;})[_0xa75b('0x13')](respondWithResult(_0x43d086,0xc9))[_0xa75b('0x3b')](handleError(_0x43d086,null));};exports[_0xa75b('0x4a')]=function(_0x43255c,_0x3b4ce5){if(_0x43255c[_0xa75b('0x3d')]['id']){delete _0x43255c[_0xa75b('0x3d')]['id'];}return db[_0xa75b('0x25')][_0xa75b('0x1e')]({'where':{'id':_0x43255c[_0xa75b('0x4b')]['id']}})[_0xa75b('0x13')](handleEntityNotFound(_0x3b4ce5,null))[_0xa75b('0x13')](function(_0x532550){if(_0x532550){return db[_0xa75b('0x25')]['update'](_['pick'](_0x43255c[_0xa75b('0x3d')],[_0xa75b('0x40'),_0xa75b('0x4c'),_0xa75b('0x4d'),'recordingFormat',_0xa75b('0x4e'),_0xa75b('0x4f'),_0xa75b('0x50')]),{'where':{'context':_0x532550[_0xa75b('0x4c')],'exten':_0x532550[_0xa75b('0x40')]},'individualHooks':!![]})[_0xa75b('0x13')](function(_0x54b34c){return _0x54b34c;});}return null;})[_0xa75b('0x13')](respondWithStatusCode(_0x3b4ce5,null))[_0xa75b('0x3b')](handleError(_0x3b4ce5,null));};exports[_0xa75b('0x51')]=function(_0x51491f,_0x1acd6b){var _0x2f2173=_0x51491f[_0xa75b('0x4b')]['id'];var _0x4f9d45=_0x51491f[_0xa75b('0x3d')];var _0x237368=0xc8;var _0xd92e17=null;return db[_0xa75b('0x52')]['transaction']({'isolationLevel':db['sequelize'][_0xa75b('0x53')][_0xa75b('0x54')][_0xa75b('0x55')]},function(_0x7ec18){return db[_0xa75b('0x25')][_0xa75b('0x56')]({'where':{'id':_0x2f2173},'transaction':_0x7ec18})[_0xa75b('0x13')](function(_0x5c5132){if(_0x5c5132){return db[_0xa75b('0x25')]['destroy']({'where':{'VoiceExtensionId':_0x2f2173},'transaction':_0x7ec18})['then'](function(){var _0x5c58bc=_[_0xa75b('0x1a')](_0x4f9d45,function(_0x41bc16){_0x41bc16['VoiceExtensionId']=_0x2f2173;_0x41bc16['isApp']=!![];return _0x41bc16;});return _0x5c5132[_0xa75b('0x57')](_0x5c58bc);})['then'](function(_0x57664f){return db['VoiceExtension'][_0xa75b('0x58')](_0x57664f,{'transaction':_0x7ec18});});}else{_0x237368=0x194;_0xd92e17=[];}});})[_0xa75b('0x13')](function(){if(_0x237368!==0x194){return db[_0xa75b('0x25')][_0xa75b('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2f2173},'order':_0xa75b('0x5a')})[_0xa75b('0x13')](function(_0x799c32){_0xd92e17=_0x799c32;});}})['catch'](function(_0x3d8e01){_0x237368=0x1f4;logger[_0xa75b('0x21')](_0x3d8e01['stack']);if(_0x3d8e01[_0xa75b('0x1f')]){delete _0x3d8e01['name'];}_0xd92e17=_0x3d8e01;})[_0xa75b('0x5b')](function(){if(_0xd92e17===null){_0x1acd6b[_0xa75b('0x9')](_0x237368);}else{if(_0x237368===0x1f4){_0x1acd6b[_0xa75b('0xa')](_0x237368)['send'](_0xd92e17);}else{_0x1acd6b['status'](_0x237368)[_0xa75b('0xc')](_0xd92e17);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 70d476f..fe1b849 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 _0x2b61=['remove','emit','hasOwnProperty','hook','exports','VoiceExtension','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b61,0xa7));var _0x12b6=function(_0x18959e,_0x24e830){_0x18959e=_0x18959e-0x0;var _0x308aba=_0x2b61[_0x18959e];return _0x308aba;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x12b6('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x12b6('0x1')](0x0);var events={'afterCreate':_0x12b6('0x2'),'afterUpdate':_0x12b6('0x3'),'afterDestroy':_0x12b6('0x4')};function emitEvent(_0x550568){return function(_0x15808b,_0x1ca47a,_0x4d6c8d){VoiceExtensionEvents[_0x12b6('0x5')](_0x550568+':'+_0x15808b['id'],_0x15808b);VoiceExtensionEvents['emit'](_0x550568,_0x15808b);_0x4d6c8d(null);};}for(var e in events){if(events[_0x12b6('0x6')](e)){var event=events[e];VoiceExtension[_0x12b6('0x7')](e,emitEvent(event));}}module[_0x12b6('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x10fd=['events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x537309,_0x53e925){var _0x1e8563=function(_0x1efc5c){while(--_0x1efc5c){_0x537309['push'](_0x537309['shift']());}};_0x1e8563(++_0x53e925);}(_0x10fd,0xcf));var _0xd10f=function(_0x1f98e4,_0x48bb7d){_0x1f98e4=_0x1f98e4-0x0;var _0x2838e1=_0x10fd[_0x1f98e4];return _0x2838e1;};'use strict';var EventEmitter=require(_0xd10f('0x0'));var VoiceExtension=require(_0xd10f('0x1'))['db'][_0xd10f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xd10f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd10f('0x4'),'afterDestroy':_0xd10f('0x5')};function emitEvent(_0x19088c){return function(_0x275ceb,_0x358447,_0x1ca4ac){VoiceExtensionEvents[_0xd10f('0x6')](_0x19088c+':'+_0x275ceb['id'],_0x275ceb);VoiceExtensionEvents['emit'](_0x19088c,_0x275ceb);_0x1ca4ac(null);};}for(var e in events){if(events[_0xd10f('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xd10f('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a76dbff..8bf4e1e 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 _0x7b27=['XCALLY-MOTION-PROGRESS=0','outbound','CDR(destination)=','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','hasOwnProperty','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','timeout','url','name','trunk','param','split','phone','prefix','join','options','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','then','length','interval','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','define','VoiceExtension','voice_extensions','get','lodash','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','CDR(routeid)='];(function(_0x45747a,_0x3b7da2){var _0x4e7002=function(_0x46c850){while(--_0x46c850){_0x45747a['push'](_0x45747a['shift']());}};_0x4e7002(++_0x3b7da2);}(_0x7b27,0x186));var _0x77b2=function(_0x1ee982,_0x3f2021){_0x1ee982=_0x1ee982-0x0;var _0x3d447e=_0x7b27[_0x1ee982];return _0x3d447e;};'use strict';var _=require(_0x77b2('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x77b2('0x1')]=function(_0x424f18){var _0x4000dd=_0x424f18[_0x77b2('0x2')];function _0x511dfe(_0x295c4e){var _0x47075b=0x2;var _0x5e5289=[{'type':_0x295c4e[_0x77b2('0x3')],'app':_0x77b2('0x4'),'appdata':_0x77b2('0x5')+_0x295c4e['type'],'context':_0x295c4e[_0x77b2('0x6')],'exten':_0x295c4e[_0x77b2('0x7')],'priority':_0x47075b++,'VoiceExtensionId':_0x295c4e['id']},{'type':_0x295c4e[_0x77b2('0x3')],'app':_0x295c4e[_0x77b2('0x8')]?'Set':_0x77b2('0x9'),'appdata':_0x295c4e[_0x77b2('0x8')]?_0x77b2('0xa')+_0x295c4e[_0x77b2('0x8')]:_0x77b2('0xb'),'context':_0x295c4e[_0x77b2('0x6')],'exten':_0x295c4e[_0x77b2('0x7')],'priority':_0x47075b++,'VoiceExtensionId':_0x295c4e['id']}];if(_0x295c4e[_0x77b2('0x3')]==='inbound'){_0x5e5289[_0x77b2('0xc')]({'type':_0x77b2('0xd'),'app':'Set','appdata':_0x77b2('0xe')+_0x295c4e['id'],'context':_0x295c4e['context'],'exten':_0x295c4e[_0x77b2('0x7')],'priority':_0x47075b++,'VoiceExtensionId':_0x295c4e['id']});}_0x5e5289[_0x77b2('0xc')]({'type':_0x295c4e['type'],'app':_0x77b2('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x295c4e[_0x77b2('0x6')],'exten':_0x295c4e[_0x77b2('0x7')],'priority':_0x47075b++,'VoiceExtensionId':_0x295c4e['id']},{'type':_0x295c4e[_0x77b2('0x3')],'app':_0x77b2('0x4'),'appdata':_0x77b2('0xf'),'context':_0x295c4e[_0x77b2('0x6')],'exten':_0x295c4e[_0x77b2('0x7')],'priority':_0x47075b++,'VoiceExtensionId':_0x295c4e['id']},{'type':_0x295c4e[_0x77b2('0x3')],'app':_0x77b2('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x295c4e['context'],'exten':_0x295c4e[_0x77b2('0x7')],'priority':_0x47075b++,'VoiceExtensionId':_0x295c4e['id']});return _0x5e5289;}function _0x2a85a3(_0x21d169){var _0x68c16e=0x2;var _0x65e134=[{'type':_0x77b2('0x10'),'app':_0x77b2('0x4'),'appdata':'CDR(type)=outbound','context':_0x21d169[_0x77b2('0x6')],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']},{'type':_0x77b2('0x10'),'app':_0x21d169[_0x77b2('0x8')]?_0x77b2('0x4'):'NoOp','appdata':_0x21d169[_0x77b2('0x8')]?'CDR(routeAlias)='+_0x21d169[_0x77b2('0x8')]:_0x77b2('0xb'),'context':_0x21d169[_0x77b2('0x6')],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']},{'type':_0x77b2('0x10'),'app':_0x77b2('0x4'),'appdata':_0x77b2('0x11')+(_0x21d169['cutdigits']?'${EXTEN:'+_0x21d169['cutdigits']+'}':_0x77b2('0x12')),'context':_0x21d169[_0x77b2('0x6')],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']},{'type':_0x77b2('0x10'),'app':_0x77b2('0x4'),'appdata':_0x77b2('0xe')+_0x21d169['id'],'context':_0x21d169[_0x77b2('0x6')],'exten':_0x21d169['exten'],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']},{'type':_0x77b2('0x10'),'app':_0x77b2('0x13'),'appdata':_0x77b2('0x14')+(_0x68c16e+0x2)+_0x77b2('0x15')+(_0x68c16e+0x1)+')','context':_0x21d169[_0x77b2('0x6')],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']},{'type':_0x77b2('0x10'),'app':_0x77b2('0x4'),'appdata':_0x21d169[_0x77b2('0x16')]?_0x77b2('0x17')+_0x21d169['cutdigits']+'}':_0x77b2('0x18'),'context':_0x21d169[_0x77b2('0x6')],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']},{'type':_0x77b2('0x10'),'app':_0x77b2('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x21d169[_0x77b2('0x6')],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']},{'type':_0x77b2('0x10'),'app':_0x77b2('0x4'),'appdata':_0x77b2('0xf'),'context':_0x21d169[_0x77b2('0x6')],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']},{'type':_0x77b2('0x10'),'app':_0x77b2('0x4'),'appdata':_0x77b2('0x19'),'context':_0x21d169[_0x77b2('0x6')],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']},{'type':'outbound','app':'Set','appdata':'outboundrouteid='+_0x21d169['id'],'context':_0x21d169['context'],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']}];if(_0x21d169[_0x77b2('0x1a')]('recordingFormat')&&_0x21d169['recordingFormat']!=='none'){_0x65e134[_0x77b2('0xc')]({'type':_0x77b2('0x10'),'app':_0x77b2('0x4'),'appdata':_0x77b2('0x1b'),'context':_0x21d169['context'],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']},{'type':'outbound','app':_0x77b2('0x4'),'appdata':_0x77b2('0x1c')+_0x21d169[_0x77b2('0x1d')]||_0x77b2('0x1e'),'context':_0x21d169[_0x77b2('0x6')],'exten':_0x21d169[_0x77b2('0x7')],'priority':_0x68c16e++,'VoiceExtensionId':_0x21d169['id']});}return _0x65e134;}function _0x539abd(_0x1e8cf0,_0x405c14){var _0x36fc53=[{'name':'trunk','param':0x0},{'name':_0x77b2('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x77b2('0x20'),'param':0x3}];var _0x5a144f={};var _0x98df47=_0x405c14['split'](',');var _0x49dd03=[];for(var _0x4c4cc6=0x0;_0x4c4cc6<_0x36fc53['length'];_0x4c4cc6++){switch(_0x36fc53[_0x4c4cc6][_0x77b2('0x21')]){case'trunk':_0x5a144f[_0x77b2('0x22')]=_0x98df47[_0x36fc53[_0x4c4cc6][_0x77b2('0x23')]][_0x77b2('0x24')]('/')[0x1];_0x5a144f[_0x77b2('0x25')]=_0x98df47[_0x36fc53[_0x4c4cc6][_0x77b2('0x23')]][_0x77b2('0x24')]('/')[0x2];_0x5a144f[_0x77b2('0x26')]=_0x5a144f['phone']?_0x5a144f['phone'][_0x77b2('0x24')]('$')[0x0]:undefined;_0x5a144f[_0x77b2('0x25')]=_0x1e8cf0[_0x77b2('0x16')]?(_0x5a144f[_0x77b2('0x26')]||'')+'${EXTEN:'+_0x1e8cf0[_0x77b2('0x16')]+'}':(_0x5a144f[_0x77b2('0x26')]||'')+_0x77b2('0x12');_0x49dd03[_0x36fc53[_0x4c4cc6]['param']]=['SIP',_0x5a144f[_0x77b2('0x22')],_0x5a144f[_0x77b2('0x25')]][_0x77b2('0x27')]('/');break;case _0x77b2('0x28'):_0x5a144f['options']=_0x98df47[_0x36fc53[_0x4c4cc6][_0x77b2('0x23')]];if(_0x1e8cf0[_0x77b2('0x1d')]!==_0x77b2('0x29')){if(_0x5a144f[_0x77b2('0x28')][_0x77b2('0x2a')]('U(xcally-mixmonitor-context)')<0x0){_0x5a144f['options']+=_0x77b2('0x2b');}}else{_0x5a144f[_0x77b2('0x28')]=_0x5a144f[_0x77b2('0x28')][_0x77b2('0x2c')](_0x77b2('0x2b'),'');}_0x49dd03[_0x36fc53[_0x4c4cc6][_0x77b2('0x23')]]=_0x5a144f[_0x77b2('0x28')];break;default:_0x49dd03[_0x36fc53[_0x4c4cc6]['param']]=_0x98df47[_0x36fc53[_0x4c4cc6]['param']];}}return _0x49dd03[_0x77b2('0x27')](',');}function _0x1f9f86(_0x2c6943,_0x3446cf,_0x5c69d5){return new Promise(function(_0x4edec6,_0x1a7a20){var _0x5859c9=[];if(_[_0x77b2('0x2d')](_0x3446cf))return _0x4edec6(_0x5859c9);_0x4000dd[_0x77b2('0x2e')][_0x77b2('0x2f')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0x77b2('0x30')](function(_0x58dae5){for(var _0x466ede=0x0,_0x3c089a=0x0;_0x466ede<_0x3446cf[_0x77b2('0x31')];_0x466ede++,_0x3c089a=0x0){var _0x4afbed=_0x3446cf[_0x466ede];var _0x9ca094=[];var _0x3aa617=[];delete _0x4afbed['id'];if(_0x4afbed[_0x77b2('0x32')]!==_0x77b2('0x33')){_0x4afbed[_0x77b2('0x34')]=[_0x4afbed[_0x77b2('0x32')]];}else{_0x4afbed[_0x77b2('0x34')]=_0x4afbed[_0x77b2('0x35')]?_[_0x77b2('0x36')](_[_0x77b2('0x37')](_0x58dae5,{'IntervalId':_0x4afbed[_0x77b2('0x35')]}),_0x77b2('0x32')):[];}_0x4afbed[_0x77b2('0x6')]=_0x2c6943[_0x77b2('0x6')];_0x4afbed[_0x77b2('0x7')]=_0x2c6943[_0x77b2('0x7')];if(_0x4afbed[_0x77b2('0x3')])_0x4afbed[_0x77b2('0x3')]=_0x4afbed[_0x77b2('0x3')][_0x77b2('0x38')]();if(_0x2c6943['type']===_0x77b2('0x10')){if(_0x4afbed[_0x77b2('0x1a')](_0x77b2('0x39'))&&_0x4afbed[_0x77b2('0x39')]&&_0x4afbed[_0x77b2('0x39')]!=='--'){_0x9ca094[_0x77b2('0xc')]({'type':_0x4afbed[_0x77b2('0x3')][_0x77b2('0x38')](),'app':_0x77b2('0x4'),'appdata':_0x77b2('0x3a')+_0x4afbed[_0x77b2('0x39')],'context':_0x2c6943[_0x77b2('0x6')],'exten':_0x2c6943[_0x77b2('0x7')],'priority':_0x4afbed['intervals'][_0x77b2('0x31')]+_0x5c69d5+_0x3c089a++,'VoiceExtensionId':_0x2c6943['id']});}_0x9ca094[_0x77b2('0xc')]({'type':_0x4afbed[_0x77b2('0x3')][_0x77b2('0x38')](),'app':'ExecIf','appdata':_0x77b2('0x3b')+(_0x4afbed[_0x77b2('0x3c')]?'Set(CALLERID(all)='+_0x4afbed[_0x77b2('0x3c')]+')':_0x77b2('0x3d')),'context':_0x2c6943[_0x77b2('0x6')],'exten':_0x2c6943[_0x77b2('0x7')],'priority':_0x4afbed['intervals'][_0x77b2('0x31')]+_0x5c69d5+_0x3c089a++,'VoiceExtensionId':_0x2c6943['id']});}else{if(_0x4afbed['hasOwnProperty'](_0x77b2('0x3e'))){if([_0x77b2('0x3f'),_0x77b2('0x40')]['includes'](_0x4afbed[_0x77b2('0x41')][_0x77b2('0x38')]())&&_0x4afbed[_0x77b2('0x42')]!==_0x77b2('0x43')){if(_0x4afbed['answer']){_0x9ca094['push']({'type':_0x4afbed[_0x77b2('0x3')]['toLowerCase'](),'app':_0x77b2('0x13'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2c6943['context'],'exten':_0x2c6943[_0x77b2('0x7')],'priority':_0x4afbed['intervals']['length']+_0x5c69d5+_0x3c089a++,'VoiceExtensionId':_0x2c6943['id']});_0x9ca094[_0x77b2('0xc')]({'type':_0x4afbed[_0x77b2('0x3')][_0x77b2('0x38')](),'app':_0x77b2('0x4'),'appdata':_0x77b2('0x44'),'context':_0x2c6943[_0x77b2('0x6')],'exten':_0x2c6943[_0x77b2('0x7')],'priority':_0x4afbed[_0x77b2('0x34')]['length']+_0x5c69d5+_0x3c089a++,'VoiceExtensionId':_0x2c6943['id']});}else{_0x9ca094['push']({'type':_0x4afbed[_0x77b2('0x3')][_0x77b2('0x38')](),'app':_0x77b2('0x13'),'appdata':_0x77b2('0x45'),'context':_0x2c6943[_0x77b2('0x6')],'exten':_0x2c6943[_0x77b2('0x7')],'priority':_0x4afbed[_0x77b2('0x34')][_0x77b2('0x31')]+_0x5c69d5+_0x3c089a++,'VoiceExtensionId':_0x2c6943['id']});_0x9ca094[_0x77b2('0xc')]({'type':_0x4afbed['type'][_0x77b2('0x38')](),'app':_0x77b2('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2c6943[_0x77b2('0x6')],'exten':_0x2c6943[_0x77b2('0x7')],'priority':_0x4afbed['intervals'][_0x77b2('0x31')]+_0x5c69d5+_0x3c089a++,'VoiceExtensionId':_0x2c6943['id']});}}}}for(var _0x409133=0x0;_0x409133<_0x4afbed[_0x77b2('0x34')][_0x77b2('0x31')];_0x409133++){var _0x4296f8=_0x5c69d5+_0x4afbed[_0x77b2('0x34')]['length'];var _0x1ecd39=_0x409133===_0x4afbed[_0x77b2('0x34')][_0x77b2('0x31')]-0x1?_0x5c69d5+_0x9ca094[_0x77b2('0x31')]+_0x3aa617[_0x77b2('0x31')]+0x2:_0x5c69d5+_0x409133+0x1;_0x9ca094[_0x77b2('0x46')](_0x409133,0x0,{'type':_0x2c6943[_0x77b2('0x3')],'app':_0x77b2('0x47'),'appdata':_0x4afbed[_0x77b2('0x34')][_0x409133]+'?'+_0x2c6943[_0x77b2('0x6')]+',${EXTEN},'+_0x4296f8+':'+_0x2c6943['context']+_0x77b2('0x48')+_0x1ecd39,'exten':_0x2c6943[_0x77b2('0x7')],'context':_0x2c6943[_0x77b2('0x6')],'priority':_0x5c69d5+_0x409133,'VoiceExtensionId':_0x2c6943['id']});}if(_0x4afbed['appType']==='outboundDial')_0x4afbed['appdata']=_0x539abd(_0x2c6943,_0x4afbed[_0x77b2('0x49')]);_0x4afbed[_0x77b2('0x4a')]=_0x9ca094['length']?_[_0x77b2('0x4b')](_0x9ca094)[_0x77b2('0x4a')]+0x1:_0x5c69d5;_0x5859c9=_[_0x77b2('0x4c')](_0x5859c9,_0x9ca094,[_0x4afbed],_0x3aa617);_0x5c69d5=_[_0x77b2('0x4b')](_0x5859c9)[_0x77b2('0x4a')]+0x1;}return _0x4edec6(_0x5859c9);})['catch'](function(_0x7f1432){_0x1a7a20(_0x7f1432);});});}return _0x424f18[_0x77b2('0x4d')](_0x77b2('0x4e'),attributes,{'tableName':_0x77b2('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x432c8d){var _0x423baf=this[_0x77b2('0x50')]({'plain':!![]});var _0x726948=_0x423baf[_0x77b2('0x3')]===_0x77b2('0x10')?_0x2a85a3(_0x423baf):_0x511dfe(_0x423baf);return _0x1f9f86(_0x423baf,_0x432c8d,_[_0x77b2('0x4b')](_0x726948)[_0x77b2('0x4a')]+0x1)[_0x77b2('0x30')](function(_0x413c3d){var _0x469a64=_['concat'](_0x726948,_0x413c3d);_0x469a64[_0x77b2('0xc')]({'type':_0x423baf[_0x77b2('0x3')],'app':'Hangup','exten':_0x423baf[_0x77b2('0x7')],'context':_0x423baf[_0x77b2('0x6')],'priority':_['last'](_0x469a64)[_0x77b2('0x4a')]+0x1,'VoiceExtensionId':_0x423baf['id']});return _0x469a64;});}}});}; \ No newline at end of file +var _0xd9ef=['alias','NoOp','CDR(routeAlias)=','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','options','url','length','name','trunk','param','prefix','phone','split','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','then','interval','IntervalId','filter','toLowerCase','tag','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','last','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','type','Set','CDR(type)=','context','exten'];(function(_0x4a114a,_0x60443){var _0x3d5bcd=function(_0x6f868a){while(--_0x6f868a){_0x4a114a['push'](_0x4a114a['shift']());}};_0x3d5bcd(++_0x60443);}(_0xd9ef,0x95));var _0xfd9e=function(_0x345349,_0x874cd2){_0x345349=_0x345349-0x0;var _0x1de32f=_0xd9ef[_0x345349];return _0x1de32f;};'use strict';var _=require(_0xfd9e('0x0'));var attributes=require(_0xfd9e('0x1'));module['exports']=function(_0x1e4dfc){var _0x55d1e2=_0x1e4dfc['models'];function _0x505f7f(_0xdce9ae){var _0x28cfac=0x2;var _0xe6990b=[{'type':_0xdce9ae[_0xfd9e('0x2')],'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0x4')+_0xdce9ae[_0xfd9e('0x2')],'context':_0xdce9ae[_0xfd9e('0x5')],'exten':_0xdce9ae[_0xfd9e('0x6')],'priority':_0x28cfac++,'VoiceExtensionId':_0xdce9ae['id']},{'type':_0xdce9ae[_0xfd9e('0x2')],'app':_0xdce9ae[_0xfd9e('0x7')]?_0xfd9e('0x3'):_0xfd9e('0x8'),'appdata':_0xdce9ae['alias']?_0xfd9e('0x9')+_0xdce9ae[_0xfd9e('0x7')]:'No\x20alias\x20set','context':_0xdce9ae[_0xfd9e('0x5')],'exten':_0xdce9ae[_0xfd9e('0x6')],'priority':_0x28cfac++,'VoiceExtensionId':_0xdce9ae['id']}];if(_0xdce9ae[_0xfd9e('0x2')]==='inbound'){_0xe6990b[_0xfd9e('0xa')]({'type':_0xfd9e('0xb'),'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0xc')+_0xdce9ae['id'],'context':_0xdce9ae[_0xfd9e('0x5')],'exten':_0xdce9ae['exten'],'priority':_0x28cfac++,'VoiceExtensionId':_0xdce9ae['id']});}_0xe6990b[_0xfd9e('0xa')]({'type':_0xdce9ae[_0xfd9e('0x2')],'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0xd'),'context':_0xdce9ae[_0xfd9e('0x5')],'exten':_0xdce9ae[_0xfd9e('0x6')],'priority':_0x28cfac++,'VoiceExtensionId':_0xdce9ae['id']},{'type':_0xdce9ae[_0xfd9e('0x2')],'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0xe'),'context':_0xdce9ae[_0xfd9e('0x5')],'exten':_0xdce9ae['exten'],'priority':_0x28cfac++,'VoiceExtensionId':_0xdce9ae['id']},{'type':_0xdce9ae[_0xfd9e('0x2')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xdce9ae[_0xfd9e('0x5')],'exten':_0xdce9ae[_0xfd9e('0x6')],'priority':_0x28cfac++,'VoiceExtensionId':_0xdce9ae['id']});return _0xe6990b;}function _0x144372(_0x4d605a){var _0x3c329e=0x2;var _0xee091f=[{'type':_0xfd9e('0xf'),'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0x10'),'context':_0x4d605a[_0xfd9e('0x5')],'exten':_0x4d605a[_0xfd9e('0x6')],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']},{'type':'outbound','app':_0x4d605a[_0xfd9e('0x7')]?_0xfd9e('0x3'):_0xfd9e('0x8'),'appdata':_0x4d605a[_0xfd9e('0x7')]?_0xfd9e('0x9')+_0x4d605a[_0xfd9e('0x7')]:_0xfd9e('0x11'),'context':_0x4d605a[_0xfd9e('0x5')],'exten':_0x4d605a[_0xfd9e('0x6')],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']},{'type':_0xfd9e('0xf'),'app':'Set','appdata':_0xfd9e('0x12')+(_0x4d605a[_0xfd9e('0x13')]?_0xfd9e('0x14')+_0x4d605a[_0xfd9e('0x13')]+'}':_0xfd9e('0x15')),'context':_0x4d605a['context'],'exten':_0x4d605a[_0xfd9e('0x6')],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']},{'type':_0xfd9e('0xf'),'app':'Set','appdata':'CDR(routeid)='+_0x4d605a['id'],'context':_0x4d605a[_0xfd9e('0x5')],'exten':_0x4d605a[_0xfd9e('0x6')],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']},{'type':_0xfd9e('0xf'),'app':_0xfd9e('0x16'),'appdata':_0xfd9e('0x17')+(_0x3c329e+0x2)+'):Goto('+(_0x3c329e+0x1)+')','context':_0x4d605a[_0xfd9e('0x5')],'exten':_0x4d605a[_0xfd9e('0x6')],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']},{'type':_0xfd9e('0xf'),'app':_0xfd9e('0x3'),'appdata':_0x4d605a[_0xfd9e('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x4d605a['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x4d605a[_0xfd9e('0x5')],'exten':_0x4d605a['exten'],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']},{'type':'outbound','app':_0xfd9e('0x3'),'appdata':_0xfd9e('0xd'),'context':_0x4d605a['context'],'exten':_0x4d605a[_0xfd9e('0x6')],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']},{'type':_0xfd9e('0xf'),'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0xe'),'context':_0x4d605a['context'],'exten':_0x4d605a['exten'],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']},{'type':_0xfd9e('0xf'),'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0x18'),'context':_0x4d605a[_0xfd9e('0x5')],'exten':_0x4d605a['exten'],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']},{'type':_0xfd9e('0xf'),'app':_0xfd9e('0x3'),'appdata':'outboundrouteid='+_0x4d605a['id'],'context':_0x4d605a['context'],'exten':_0x4d605a[_0xfd9e('0x6')],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']}];if(_0x4d605a[_0xfd9e('0x19')](_0xfd9e('0x1a'))&&_0x4d605a[_0xfd9e('0x1a')]!==_0xfd9e('0x1b')){_0xee091f[_0xfd9e('0xa')]({'type':_0xfd9e('0xf'),'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0x1c'),'context':_0x4d605a['context'],'exten':_0x4d605a[_0xfd9e('0x6')],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']},{'type':_0xfd9e('0xf'),'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0x1d')+_0x4d605a[_0xfd9e('0x1a')]||_0xfd9e('0x1e'),'context':_0x4d605a[_0xfd9e('0x5')],'exten':_0x4d605a[_0xfd9e('0x6')],'priority':_0x3c329e++,'VoiceExtensionId':_0x4d605a['id']});}return _0xee091f;}function _0xfdac9f(_0x124282,_0xa21478){var _0x4ab28c=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0xfd9e('0x1f'),'param':0x2},{'name':_0xfd9e('0x20'),'param':0x3}];var _0x56422f={};var _0x4b0b5b=_0xa21478['split'](',');var _0x12a42f=[];for(var _0x1fdd36=0x0;_0x1fdd36<_0x4ab28c[_0xfd9e('0x21')];_0x1fdd36++){switch(_0x4ab28c[_0x1fdd36][_0xfd9e('0x22')]){case _0xfd9e('0x23'):_0x56422f[_0xfd9e('0x23')]=_0x4b0b5b[_0x4ab28c[_0x1fdd36][_0xfd9e('0x24')]]['split']('/')[0x1];_0x56422f['phone']=_0x4b0b5b[_0x4ab28c[_0x1fdd36][_0xfd9e('0x24')]]['split']('/')[0x2];_0x56422f[_0xfd9e('0x25')]=_0x56422f[_0xfd9e('0x26')]?_0x56422f[_0xfd9e('0x26')][_0xfd9e('0x27')]('$')[0x0]:undefined;_0x56422f[_0xfd9e('0x26')]=_0x124282[_0xfd9e('0x13')]?(_0x56422f['prefix']||'')+'${EXTEN:'+_0x124282[_0xfd9e('0x13')]+'}':(_0x56422f['prefix']||'')+_0xfd9e('0x15');_0x12a42f[_0x4ab28c[_0x1fdd36][_0xfd9e('0x24')]]=[_0xfd9e('0x28'),_0x56422f[_0xfd9e('0x23')],_0x56422f[_0xfd9e('0x26')]][_0xfd9e('0x29')]('/');break;case _0xfd9e('0x1f'):_0x56422f[_0xfd9e('0x1f')]=_0x4b0b5b[_0x4ab28c[_0x1fdd36][_0xfd9e('0x24')]];if(_0x124282[_0xfd9e('0x1a')]!==_0xfd9e('0x1b')){if(_0x56422f['options'][_0xfd9e('0x2a')](_0xfd9e('0x2b'))<0x0){_0x56422f[_0xfd9e('0x1f')]+=_0xfd9e('0x2b');}}else{_0x56422f[_0xfd9e('0x1f')]=_0x56422f[_0xfd9e('0x1f')][_0xfd9e('0x2c')](_0xfd9e('0x2b'),'');}_0x12a42f[_0x4ab28c[_0x1fdd36][_0xfd9e('0x24')]]=_0x56422f[_0xfd9e('0x1f')];break;default:_0x12a42f[_0x4ab28c[_0x1fdd36][_0xfd9e('0x24')]]=_0x4b0b5b[_0x4ab28c[_0x1fdd36][_0xfd9e('0x24')]];}}return _0x12a42f[_0xfd9e('0x29')](',');}function _0x4324ff(_0x176e45,_0x243abf,_0x212205){return new Promise(function(_0x2ad5d7,_0x176be7){var _0x44fb81=[];if(_[_0xfd9e('0x2d')](_0x243abf))return _0x2ad5d7(_0x44fb81);_0x55d1e2[_0xfd9e('0x2e')]['findAll']({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xfd9e('0x2f')](function(_0x2ec245){for(var _0x442621=0x0,_0x4220d4=0x0;_0x442621<_0x243abf['length'];_0x442621++,_0x4220d4=0x0){var _0x5965fb=_0x243abf[_0x442621];var _0x225036=[];var _0x104d06=[];delete _0x5965fb['id'];if(_0x5965fb['interval']!=='*,*,*,*'){_0x5965fb['intervals']=[_0x5965fb[_0xfd9e('0x30')]];}else{_0x5965fb['intervals']=_0x5965fb[_0xfd9e('0x31')]?_['map'](_[_0xfd9e('0x32')](_0x2ec245,{'IntervalId':_0x5965fb[_0xfd9e('0x31')]}),_0xfd9e('0x30')):[];}_0x5965fb[_0xfd9e('0x5')]=_0x176e45['context'];_0x5965fb[_0xfd9e('0x6')]=_0x176e45[_0xfd9e('0x6')];if(_0x5965fb[_0xfd9e('0x2')])_0x5965fb['type']=_0x5965fb[_0xfd9e('0x2')][_0xfd9e('0x33')]();if(_0x176e45[_0xfd9e('0x2')]===_0xfd9e('0xf')){if(_0x5965fb[_0xfd9e('0x19')](_0xfd9e('0x34'))&&_0x5965fb[_0xfd9e('0x34')]&&_0x5965fb[_0xfd9e('0x34')]!=='--'){_0x225036[_0xfd9e('0xa')]({'type':_0x5965fb[_0xfd9e('0x2')][_0xfd9e('0x33')](),'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0x35')+_0x5965fb[_0xfd9e('0x34')],'context':_0x176e45[_0xfd9e('0x5')],'exten':_0x176e45[_0xfd9e('0x6')],'priority':_0x5965fb[_0xfd9e('0x36')][_0xfd9e('0x21')]+_0x212205+_0x4220d4++,'VoiceExtensionId':_0x176e45['id']});}_0x225036[_0xfd9e('0xa')]({'type':_0x5965fb[_0xfd9e('0x2')]['toLowerCase'](),'app':_0xfd9e('0x16'),'appdata':_0xfd9e('0x37')+(_0x5965fb['callerID']?_0xfd9e('0x38')+_0x5965fb['callerID']+')':_0xfd9e('0x39')),'context':_0x176e45[_0xfd9e('0x5')],'exten':_0x176e45[_0xfd9e('0x6')],'priority':_0x5965fb[_0xfd9e('0x36')][_0xfd9e('0x21')]+_0x212205+_0x4220d4++,'VoiceExtensionId':_0x176e45['id']});}else{if(_0x5965fb['hasOwnProperty'](_0xfd9e('0x3a'))){if([_0xfd9e('0x3b'),'playback']['includes'](_0x5965fb[_0xfd9e('0x3c')][_0xfd9e('0x33')]())&&_0x5965fb[_0xfd9e('0x3d')]!==_0xfd9e('0x3e')){if(_0x5965fb['answer']){_0x225036[_0xfd9e('0xa')]({'type':_0x5965fb[_0xfd9e('0x2')][_0xfd9e('0x33')](),'app':_0xfd9e('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x176e45[_0xfd9e('0x5')],'exten':_0x176e45[_0xfd9e('0x6')],'priority':_0x5965fb[_0xfd9e('0x36')]['length']+_0x212205+_0x4220d4++,'VoiceExtensionId':_0x176e45['id']});_0x225036[_0xfd9e('0xa')]({'type':_0x5965fb[_0xfd9e('0x2')]['toLowerCase'](),'app':_0xfd9e('0x3'),'appdata':_0xfd9e('0x3f'),'context':_0x176e45[_0xfd9e('0x5')],'exten':_0x176e45[_0xfd9e('0x6')],'priority':_0x5965fb[_0xfd9e('0x36')][_0xfd9e('0x21')]+_0x212205+_0x4220d4++,'VoiceExtensionId':_0x176e45['id']});}else{_0x225036[_0xfd9e('0xa')]({'type':_0x5965fb[_0xfd9e('0x2')][_0xfd9e('0x33')](),'app':_0xfd9e('0x16'),'appdata':_0xfd9e('0x40'),'context':_0x176e45[_0xfd9e('0x5')],'exten':_0x176e45['exten'],'priority':_0x5965fb['intervals'][_0xfd9e('0x21')]+_0x212205+_0x4220d4++,'VoiceExtensionId':_0x176e45['id']});_0x225036[_0xfd9e('0xa')]({'type':_0x5965fb[_0xfd9e('0x2')][_0xfd9e('0x33')](),'app':_0xfd9e('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x176e45['context'],'exten':_0x176e45['exten'],'priority':_0x5965fb['intervals'][_0xfd9e('0x21')]+_0x212205+_0x4220d4++,'VoiceExtensionId':_0x176e45['id']});}}}}for(var _0x3ab92c=0x0;_0x3ab92c<_0x5965fb[_0xfd9e('0x36')][_0xfd9e('0x21')];_0x3ab92c++){var _0x2fb211=_0x212205+_0x5965fb['intervals'][_0xfd9e('0x21')];var _0x51b8a4=_0x3ab92c===_0x5965fb[_0xfd9e('0x36')][_0xfd9e('0x21')]-0x1?_0x212205+_0x225036[_0xfd9e('0x21')]+_0x104d06[_0xfd9e('0x21')]+0x2:_0x212205+_0x3ab92c+0x1;_0x225036[_0xfd9e('0x41')](_0x3ab92c,0x0,{'type':_0x176e45[_0xfd9e('0x2')],'app':_0xfd9e('0x42'),'appdata':_0x5965fb['intervals'][_0x3ab92c]+'?'+_0x176e45[_0xfd9e('0x5')]+',${EXTEN},'+_0x2fb211+':'+_0x176e45['context']+_0xfd9e('0x43')+_0x51b8a4,'exten':_0x176e45[_0xfd9e('0x6')],'context':_0x176e45[_0xfd9e('0x5')],'priority':_0x212205+_0x3ab92c,'VoiceExtensionId':_0x176e45['id']});}if(_0x5965fb[_0xfd9e('0x3d')]===_0xfd9e('0x44'))_0x5965fb[_0xfd9e('0x45')]=_0xfdac9f(_0x176e45,_0x5965fb[_0xfd9e('0x45')]);_0x5965fb[_0xfd9e('0x46')]=_0x225036[_0xfd9e('0x21')]?_['last'](_0x225036)[_0xfd9e('0x46')]+0x1:_0x212205;_0x44fb81=_[_0xfd9e('0x47')](_0x44fb81,_0x225036,[_0x5965fb],_0x104d06);_0x212205=_[_0xfd9e('0x48')](_0x44fb81)[_0xfd9e('0x46')]+0x1;}return _0x2ad5d7(_0x44fb81);})['catch'](function(_0x255ec8){_0x176be7(_0x255ec8);});});}return _0x1e4dfc[_0xfd9e('0x49')](_0xfd9e('0x4a'),attributes,{'tableName':_0xfd9e('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1901c1){var _0x211e73=this[_0xfd9e('0x4c')]({'plain':!![]});var _0x3b5ece=_0x211e73[_0xfd9e('0x2')]===_0xfd9e('0xf')?_0x144372(_0x211e73):_0x505f7f(_0x211e73);return _0x4324ff(_0x211e73,_0x1901c1,_[_0xfd9e('0x48')](_0x3b5ece)[_0xfd9e('0x46')]+0x1)['then'](function(_0x4d6445){var _0x31d3fc=_[_0xfd9e('0x47')](_0x3b5ece,_0x4d6445);_0x31d3fc[_0xfd9e('0xa')]({'type':_0x211e73[_0xfd9e('0x2')],'app':_0xfd9e('0x4d'),'exten':_0x211e73['exten'],'context':_0x211e73[_0xfd9e('0x5')],'priority':_['last'](_0x31d3fc)[_0xfd9e('0x46')]+0x1,'VoiceExtensionId':_0x211e73['id']});return _0x31d3fc;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 9516d20..a4f6a6d 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 _0x0cfe=['include','model','GetVoiceExtension','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../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','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceExtension','options','raw','where','attributes','limit','map'];(function(_0x1af5b0,_0x3ad167){var _0x13e5dd=function(_0x42fa6d){while(--_0x42fa6d){_0x1af5b0['push'](_0x1af5b0['shift']());}};_0x13e5dd(++_0x3ad167);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x3a7263,_0x2f9385){_0x3a7263=_0x3a7263-0x0;var _0x234178=_0x0cfe[_0x3a7263];return _0x234178;};'use strict';var _=require(_0xe0cf('0x0'));var util=require('util');var moment=require(_0xe0cf('0x1'));var BPromise=require(_0xe0cf('0x2'));var rs=require(_0xe0cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0cf('0x5'))(_0xe0cf('0x6'));var config=require(_0xe0cf('0x7'));var jayson=require(_0xe0cf('0x8'));var client=jayson['client'][_0xe0cf('0x9')]({'port':0x232a});config[_0xe0cf('0xa')]=_[_0xe0cf('0xb')](config['redis'],{'host':_0xe0cf('0xc'),'port':0x18eb});var socket=require(_0xe0cf('0xd'))(new Redis(config['redis']));require(_0xe0cf('0xe'))[_0xe0cf('0xf')](socket);function respondWithRpcPromise(_0x1d304a,_0x2aaa10,_0x2e689c){return new BPromise(function(_0x10752a,_0x531fde){return client[_0xe0cf('0x10')](_0x1d304a,_0x2e689c)[_0xe0cf('0x11')](function(_0x264b18){logger[_0xe0cf('0x12')](_0xe0cf('0x13'),_0x2aaa10,_0xe0cf('0x14'));logger[_0xe0cf('0x15')](_0xe0cf('0x16'),_0x2aaa10,_0xe0cf('0x14'),JSON[_0xe0cf('0x17')](_0x264b18));if(_0x264b18[_0xe0cf('0x18')]){if(_0x264b18[_0xe0cf('0x18')]['code']===0x1f4){logger[_0xe0cf('0x18')](_0xe0cf('0x13'),_0x2aaa10,_0x264b18[_0xe0cf('0x18')][_0xe0cf('0x19')]);return _0x531fde(_0x264b18[_0xe0cf('0x18')]['message']);}logger['error'](_0xe0cf('0x13'),_0x2aaa10,_0x264b18['error']['message']);return _0x10752a(_0x264b18[_0xe0cf('0x18')][_0xe0cf('0x19')]);}else{logger[_0xe0cf('0x12')](_0xe0cf('0x13'),_0x2aaa10,_0xe0cf('0x14'));_0x10752a(_0x264b18[_0xe0cf('0x1a')][_0xe0cf('0x19')]);}})['catch'](function(_0x5c2bcc){logger[_0xe0cf('0x18')](_0xe0cf('0x13'),_0x2aaa10,_0x5c2bcc);_0x531fde(_0x5c2bcc);});});}exports['GetVoiceExtension']=function(_0x112ea6){var _0x3dba33=this;return new Promise(function(_0x2c44e6,_0x2b4a16){return db[_0xe0cf('0x1b')]['findAll']({'raw':_0x112ea6[_0xe0cf('0x1c')]?_0x112ea6['options'][_0xe0cf('0x1d')]===undefined?!![]:![]:!![],'where':_0x112ea6[_0xe0cf('0x1c')]?_0x112ea6['options'][_0xe0cf('0x1e')]||null:null,'attributes':_0x112ea6[_0xe0cf('0x1c')]?_0x112ea6[_0xe0cf('0x1c')][_0xe0cf('0x1f')]||null:null,'limit':_0x112ea6['options']?_0x112ea6[_0xe0cf('0x1c')][_0xe0cf('0x20')]||null:null,'include':_0x112ea6[_0xe0cf('0x1c')]?_0x112ea6[_0xe0cf('0x1c')]['include']?_[_0xe0cf('0x21')](_0x112ea6['options'][_0xe0cf('0x22')],function(_0x1da556){return{'model':db[_0x1da556[_0xe0cf('0x23')]],'as':_0x1da556['as'],'attributes':_0x1da556[_0xe0cf('0x1f')],'include':_0x1da556[_0xe0cf('0x22')]?_[_0xe0cf('0x21')](_0x1da556['include'],function(_0x5ae995){return{'model':db[_0x5ae995[_0xe0cf('0x23')]],'as':_0x5ae995['as'],'attributes':_0x5ae995[_0xe0cf('0x1f')],'include':_0x5ae995[_0xe0cf('0x22')]?_[_0xe0cf('0x21')](_0x5ae995['include'],function(_0x5845b7){return{'model':db[_0x5845b7['model']],'as':_0x5845b7['as'],'attributes':_0x5845b7[_0xe0cf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe0cf('0x11')](function(_0x58d037){logger['info'](_0xe0cf('0x24'),_0x112ea6);logger[_0xe0cf('0x15')](_0xe0cf('0x24'),_0x112ea6,JSON[_0xe0cf('0x17')](_0x58d037));_0x2c44e6(_0x58d037);})[_0xe0cf('0x25')](function(_0x2e1392){logger[_0xe0cf('0x18')](_0xe0cf('0x24'),_0x2e1392['message'],_0x112ea6);_0x2b4a16(_0x3dba33['error'](0x1f4,_0x2e1392[_0xe0cf('0x19')]));});});}; \ No newline at end of file +var _0x41fe=['message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2212d3,_0x324f32){var _0x51c05d=function(_0x376102){while(--_0x376102){_0x2212d3['push'](_0x2212d3['shift']());}};_0x51c05d(++_0x324f32);}(_0x41fe,0xd1));var _0xe41f=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x41fe[_0x29db36];return _0x234e87;};'use strict';var _=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var moment=require(_0xe41f('0x2'));var BPromise=require(_0xe41f('0x3'));var rs=require(_0xe41f('0x4'));var fs=require('fs');var Redis=require(_0xe41f('0x5'));var db=require(_0xe41f('0x6'))['db'];var utils=require(_0xe41f('0x7'));var logger=require(_0xe41f('0x8'))(_0xe41f('0x9'));var config=require(_0xe41f('0xa'));var jayson=require(_0xe41f('0xb'));var client=jayson[_0xe41f('0xc')][_0xe41f('0xd')]({'port':0x232a});config[_0xe41f('0xe')]=_[_0xe41f('0xf')](config[_0xe41f('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xe41f('0x10'))(new Redis(config[_0xe41f('0xe')]));require('./voiceExtension.socket')[_0xe41f('0x11')](socket);function respondWithRpcPromise(_0x5710cf,_0x57b620,_0x500a97){return new BPromise(function(_0x1b014d,_0x4c733f){return client['request'](_0x5710cf,_0x500a97)['then'](function(_0xde0ab5){logger[_0xe41f('0x12')](_0xe41f('0x13'),_0x57b620,_0xe41f('0x14'));logger[_0xe41f('0x15')](_0xe41f('0x16'),_0x57b620,_0xe41f('0x14'),JSON[_0xe41f('0x17')](_0xde0ab5));if(_0xde0ab5[_0xe41f('0x18')]){if(_0xde0ab5[_0xe41f('0x18')]['code']===0x1f4){logger[_0xe41f('0x18')](_0xe41f('0x13'),_0x57b620,_0xde0ab5['error'][_0xe41f('0x19')]);return _0x4c733f(_0xde0ab5[_0xe41f('0x18')][_0xe41f('0x19')]);}logger[_0xe41f('0x18')](_0xe41f('0x13'),_0x57b620,_0xde0ab5[_0xe41f('0x18')][_0xe41f('0x19')]);return _0x1b014d(_0xde0ab5['error']['message']);}else{logger[_0xe41f('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x57b620,'request\x20sent');_0x1b014d(_0xde0ab5[_0xe41f('0x1a')][_0xe41f('0x19')]);}})[_0xe41f('0x1b')](function(_0x33cfd6){logger[_0xe41f('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x57b620,_0x33cfd6);_0x4c733f(_0x33cfd6);});});}exports[_0xe41f('0x1c')]=function(_0x5339dd){var _0x28501a=this;return new Promise(function(_0x2c264c,_0x4dcb21){return db[_0xe41f('0x1d')][_0xe41f('0x1e')]({'raw':_0x5339dd[_0xe41f('0x1f')]?_0x5339dd['options'][_0xe41f('0x20')]===undefined?!![]:![]:!![],'where':_0x5339dd[_0xe41f('0x1f')]?_0x5339dd[_0xe41f('0x1f')][_0xe41f('0x21')]||null:null,'attributes':_0x5339dd[_0xe41f('0x1f')]?_0x5339dd[_0xe41f('0x1f')][_0xe41f('0x22')]||null:null,'limit':_0x5339dd['options']?_0x5339dd[_0xe41f('0x1f')]['limit']||null:null,'include':_0x5339dd['options']?_0x5339dd[_0xe41f('0x1f')][_0xe41f('0x23')]?_[_0xe41f('0x24')](_0x5339dd['options'][_0xe41f('0x23')],function(_0x573b3){return{'model':db[_0x573b3[_0xe41f('0x25')]],'as':_0x573b3['as'],'attributes':_0x573b3['attributes'],'include':_0x573b3[_0xe41f('0x23')]?_['map'](_0x573b3[_0xe41f('0x23')],function(_0x44fb04){return{'model':db[_0x44fb04['model']],'as':_0x44fb04['as'],'attributes':_0x44fb04[_0xe41f('0x22')],'include':_0x44fb04[_0xe41f('0x23')]?_[_0xe41f('0x24')](_0x44fb04[_0xe41f('0x23')],function(_0x348531){return{'model':db[_0x348531[_0xe41f('0x25')]],'as':_0x348531['as'],'attributes':_0x348531[_0xe41f('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe41f('0x26')](function(_0x6ec664){logger[_0xe41f('0x12')](_0xe41f('0x1c'),_0x5339dd);logger[_0xe41f('0x15')](_0xe41f('0x1c'),_0x5339dd,JSON[_0xe41f('0x17')](_0x6ec664));_0x2c264c(_0x6ec664);})[_0xe41f('0x1b')](function(_0x4ef341){logger[_0xe41f('0x18')](_0xe41f('0x1c'),_0x4ef341[_0xe41f('0x19')],_0x5339dd);_0x4dcb21(_0x28501a[_0xe41f('0x18')](0x1f4,_0x4ef341[_0xe41f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 150ef94..82577d7 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x325dee,_0xb67e1f){var _0xc05924=function(_0x41ef66){while(--_0x41ef66){_0x325dee['push'](_0x325dee['shift']());}};_0xc05924(++_0xb67e1f);}(_0xe14b,0x93));var _0xbe14=function(_0x444e51,_0x5ba30d){_0x444e51=_0x444e51-0x0;var _0x117c44=_0xe14b[_0x444e51];return _0x117c44;};'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 +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x5d182c,_0x475b2c){var _0x1130fb=function(_0x1062a9){while(--_0x1062a9){_0x5d182c['push'](_0x5d182c['shift']());}};_0x1130fb(++_0x475b2c);}(_0x1261,0x144));var _0x1126=function(_0x4ca160,_0x14886c){_0x4ca160=_0x4ca160-0x0;var _0x303ae9=_0x1261[_0x4ca160];return _0x303ae9;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5bcf626..91f4ad5 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 _0x3f8a=['show','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x453bec,_0x413a01){var _0x38b180=function(_0x2a5a0d){while(--_0x2a5a0d){_0x453bec['push'](_0x453bec['shift']());}};_0x38b180(++_0x413a01);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1433bc,_0x198516){_0x1433bc=_0x1433bc-0x0;var _0x520740=_0x3f8a[_0x1433bc];return _0x520740;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xa')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router['post']('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xd'),auth['isAuthenticated'](),controller[_0xa3f8('0x13')]);router[_0xa3f8('0x14')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x15')]);module[_0xa3f8('0x16')]=router; \ No newline at end of file +var _0x27a0=['exports','util','path','connect-timeout','express','Router','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put','update','delete','destroy'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0x27a0,0xbf));var _0x027a=function(_0x3d55eb,_0x2b3f1c){_0x3d55eb=_0x3d55eb-0x0;var _0x255b6b=_0x27a0[_0x3d55eb];return _0x255b6b;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x027a('0x5'));router[_0x027a('0x6')]('/',auth[_0x027a('0x7')](),controller[_0x027a('0x8')]);router[_0x027a('0x6')](_0x027a('0x9'),auth['isAuthenticated'](),controller[_0x027a('0xa')]);router[_0x027a('0x6')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xc')]);router[_0x027a('0xd')]('/',auth[_0x027a('0x7')](),controller['create']);router[_0x027a('0xe')](_0x027a('0x9'),auth[_0x027a('0x7')](),controller[_0x027a('0xf')]);router[_0x027a('0x10')](_0x027a('0x9'),auth[_0x027a('0x7')](),controller[_0x027a('0x11')]);module[_0x027a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index a166387..2527f96 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 _0x48b9=['contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','STRING','from-voicemail'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x48b9,0xc9));var _0x948b=function(_0x2ce6ab,_0x4ef47d){_0x2ce6ab=_0x2ce6ab-0x0;var _0x197a53=_0x48b9[_0x2ce6ab];return _0x197a53;};'use strict';var Sequelize=require(_0x948b('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x948b('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x948b('0x2'),'unique':_0x948b('0x3')},'mailbox':{'type':Sequelize[_0x948b('0x1')],'defaultValue':'','allowNull':![],'unique':_0x948b('0x3')},'password':{'type':Sequelize[_0x948b('0x1')]},'fullname':{'type':Sequelize[_0x948b('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x46f19b){this[_0x948b('0x4')](_0x948b('0x5'),typeof _0x46f19b===_0x948b('0x6')&&_0x46f19b[_0x948b('0x7')]()?_0x46f19b['trim']():null);}},'pager':{'type':Sequelize[_0x948b('0x1')]},'tz':{'type':Sequelize[_0x948b('0x1')],'defaultValue':_0x948b('0x8')},'attach':{'type':Sequelize[_0x948b('0x9')](_0x948b('0xa'),'no'),'defaultValue':_0x948b('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x948b('0xa'),'no'),'defaultValue':_0x948b('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x948b('0x1')]},'callback':{'type':Sequelize[_0x948b('0x1')]},'review':{'type':Sequelize[_0x948b('0x9')](_0x948b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x948b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x948b('0x9')](_0x948b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x948b('0x9')](_0x948b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x948b('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x948b('0x9')](_0x948b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x948b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x948b('0x9')]('yes','no'),'defaultValue':_0x948b('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x948b('0x9')](_0x948b('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x948b('0xc')},'emailsubject':{'type':Sequelize[_0x948b('0x1')]},'emailbody':{'type':Sequelize[_0x948b('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x948b('0xd')],'get':function(){return this[_0x948b('0xe')](_0x948b('0xf'))+_0x948b('0x10')+this[_0x948b('0xe')]('mailbox');}}}; \ No newline at end of file +var _0x4399=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','getDataValue'];(function(_0x5a6e4e,_0x416c25){var _0x5d99f2=function(_0x117ce5){while(--_0x117ce5){_0x5a6e4e['push'](_0x5a6e4e['shift']());}};_0x5d99f2(++_0x416c25);}(_0x4399,0x190));var _0x9439=function(_0x5831e4,_0x4818b3){_0x5831e4=_0x5831e4-0x0;var _0x578987=_0x4399[_0x5831e4];return _0x578987;};'use strict';var Sequelize=require(_0x9439('0x0'));module[_0x9439('0x1')]={'customer_id':{'type':Sequelize[_0x9439('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x9439('0x3'),'unique':_0x9439('0x4')},'mailbox':{'type':Sequelize[_0x9439('0x2')],'defaultValue':'','allowNull':![],'unique':_0x9439('0x4')},'password':{'type':Sequelize[_0x9439('0x2')]},'fullname':{'type':Sequelize[_0x9439('0x2')]},'email':{'type':Sequelize[_0x9439('0x2')],'validate':{'isEmail':!![]},'set':function(_0xe07979){this[_0x9439('0x5')](_0x9439('0x6'),typeof _0xe07979===_0x9439('0x7')&&_0xe07979[_0x9439('0x8')]()?_0xe07979[_0x9439('0x8')]():null);}},'pager':{'type':Sequelize[_0x9439('0x2')]},'tz':{'type':Sequelize[_0x9439('0x2')],'defaultValue':_0x9439('0x9')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x9439('0xa')](_0x9439('0xb'),'no'),'defaultValue':_0x9439('0xb'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x9439('0x2')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9439('0xa')](_0x9439('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9439('0xa')](_0x9439('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9439('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9439('0xa')](_0x9439('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x9439('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9439('0xa')](_0x9439('0xb'),'no'),'defaultValue':_0x9439('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9439('0xa')](_0x9439('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x9439('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9439('0xa')](_0x9439('0xb'),'no'),'defaultValue':_0x9439('0xb'),'allowNull':![]},'stamp':{'type':_0x9439('0xd')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x9439('0x2')]},'maxsecs':{'type':Sequelize[_0x9439('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9439('0xf')],'get':function(){return this['getDataValue']('fullname')+_0x9439('0x10')+this[_0x9439('0x11')](_0x9439('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 560d777..db93a80 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 _0xb62e=['fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','create','body','user','get','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','getMessages','VoiceMailMessage','nolimit','order','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','UserProfileResource','then','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','keys','filters','intersection','query','attributes','model'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0xb62e,0x1de));var _0xeb62=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb62e[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422daf,_0xcc11c4){_0xcc11c4=_0xcc11c4||0xcc;return function(_0x27671e){if(_0x27671e){return _0x422daf[_0xeb62('0x1b')](_0xcc11c4);}return _0x422daf['status'](_0xcc11c4)[_0xeb62('0x1c')]();};}function respondWithResult(_0x2fbad2,_0x23fb15){_0x23fb15=_0x23fb15||0xc8;return function(_0x4da178){if(_0x4da178){return _0x2fbad2[_0xeb62('0x1d')](_0x23fb15)[_0xeb62('0x1e')](_0x4da178);}};}function respondWithFilteredResult(_0x2fd4c7,_0x4ce9fa){return function(_0x1f6a1f){if(_0x1f6a1f){var _0x15b3e8=typeof _0x4ce9fa[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x4ce9fa[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1fb460=_0x1f6a1f[_0xeb62('0x22')];var _0x39b138=_0x15b3e8?0x0:_0x4ce9fa[_0xeb62('0x1f')];var _0x27efc8=_0x15b3e8?_0x1f6a1f[_0xeb62('0x22')]:_0x4ce9fa[_0xeb62('0x1f')]+_0x4ce9fa['limit'];var _0x38c5e4;if(_0x27efc8>=_0x1fb460){_0x27efc8=_0x1fb460;_0x38c5e4=0xc8;}else{_0x38c5e4=0xce;}_0x2fd4c7[_0xeb62('0x1d')](_0x38c5e4);return _0x2fd4c7[_0xeb62('0x23')](_0xeb62('0x24'),_0x39b138+'-'+_0x27efc8+'/'+_0x1fb460)[_0xeb62('0x1e')](_0x1f6a1f);}return null;};}function patchUpdates(_0x24cbf3){return function(_0x2ed96d){try{jsonpatch['apply'](_0x2ed96d,_0x24cbf3,!![]);}catch(_0x599d0b){return BPromise[_0xeb62('0x25')](_0x599d0b);}return _0x2ed96d[_0xeb62('0x26')]();};}function saveUpdates(_0x11ed9c,_0x13243f){return function(_0x122b15){if(_0x122b15){return _0x122b15['update'](_0x11ed9c)['then'](function(_0x4664ce){return _0x4664ce;});}return null;};}function removeEntity(_0x132861,_0x182781){return function(_0x395b70){if(_0x395b70){return _0x395b70['destroy']()['then'](function(){var _0x3ef988=_0x395b70['get']({'plain':!![]});var _0x448327='Voicemails';return db[_0xeb62('0x27')]['destroy']({'where':{'type':_0x448327,'resourceId':_0x3ef988['id']}})[_0xeb62('0x28')](function(){return _0x395b70;});})[_0xeb62('0x28')](function(){_0x132861[_0xeb62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef784,_0x3ae031){return function(_0x5222f4){if(!_0x5222f4){_0x3ef784[_0xeb62('0x1b')](0x194);}return _0x5222f4;};}function handleError(_0x42f486,_0x360efd){_0x360efd=_0x360efd||0x1f4;return function(_0x511202){logger[_0xeb62('0x29')](_0x511202[_0xeb62('0x2a')]);if(_0x511202['name']){delete _0x511202[_0xeb62('0x2b')];}_0x42f486[_0xeb62('0x1d')](_0x360efd)[_0xeb62('0x2c')](_0x511202);};}exports[_0xeb62('0x2d')]=function(_0x235448,_0x5195bf){var _0x4b58af={},_0x1248bb={},_0x357cf4={'count':0x0,'rows':[]};var _0x1607ef=_[_0xeb62('0x2e')](db[_0xeb62('0x2f')][_0xeb62('0x30')],function(_0x1ae51e){return{'name':_0x1ae51e['fieldName'],'type':_0x1ae51e[_0xeb62('0x31')]['key']};});_0x1248bb['model']=_[_0xeb62('0x2e')](_0x1607ef,_0xeb62('0x2b'));_0x1248bb['query']=_[_0xeb62('0x32')](_0x235448['query']);_0x1248bb[_0xeb62('0x33')]=_[_0xeb62('0x34')](_0x1248bb['model'],_0x1248bb[_0xeb62('0x35')]);_0x4b58af[_0xeb62('0x36')]=_['intersection'](_0x1248bb[_0xeb62('0x37')],qs[_0xeb62('0x38')](_0x235448[_0xeb62('0x35')][_0xeb62('0x38')]));_0x4b58af['attributes']=_0x4b58af[_0xeb62('0x36')][_0xeb62('0x39')]?_0x4b58af['attributes']:_0x1248bb['model'];if(!_0x235448[_0xeb62('0x35')][_0xeb62('0x3a')]('nolimit')){_0x4b58af[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x235448[_0xeb62('0x35')][_0xeb62('0x21')]);_0x4b58af[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x235448[_0xeb62('0x35')]['offset']);}_0x4b58af['order']=qs[_0xeb62('0x3b')](_0x235448[_0xeb62('0x35')][_0xeb62('0x3b')]);_0x4b58af[_0xeb62('0x3c')]=qs['filters'](_[_0xeb62('0x3d')](_0x235448['query'],_0x1248bb[_0xeb62('0x33')]),_0x1607ef);if(_0x235448[_0xeb62('0x35')][_0xeb62('0x3e')]){_0x4b58af[_0xeb62('0x3c')]=_[_0xeb62('0x3f')](_0x4b58af[_0xeb62('0x3c')],{'$or':_[_0xeb62('0x2e')](_0x1607ef,function(_0x40e3a0){if(_0x40e3a0['type']!==_0xeb62('0x40')){var _0x3f1cd9={};_0x3f1cd9[_0x40e3a0[_0xeb62('0x2b')]]={'$like':'%'+_0x235448[_0xeb62('0x35')]['filter']+'%'};return _0x3f1cd9;}})});}_0x4b58af=_['merge']({},_0x4b58af,_0x235448[_0xeb62('0x41')]);var _0x41fb7d={'where':_0x4b58af['where']};return db[_0xeb62('0x2f')][_0xeb62('0x22')](_0x41fb7d)['then'](function(_0x25e9f0){_0x357cf4['count']=_0x25e9f0;if(_0x235448[_0xeb62('0x35')]['includeAll']){_0x4b58af[_0xeb62('0x42')]=[{'all':!![]}];}return db['VoiceMail'][_0xeb62('0x43')](_0x4b58af);})[_0xeb62('0x28')](function(_0x317f50){_0x357cf4['rows']=_0x317f50;return _0x357cf4;})['then'](respondWithFilteredResult(_0x5195bf,_0x4b58af))[_0xeb62('0x44')](handleError(_0x5195bf,null));};exports[_0xeb62('0x45')]=function(_0xb1c958,_0x1b408c){var _0x31d4d6={'raw':!![],'where':{'id':_0xb1c958[_0xeb62('0x46')]['id']}},_0x4afd5e={};_0x4afd5e['model']=_[_0xeb62('0x32')](db['VoiceMail'][_0xeb62('0x30')]);_0x4afd5e['query']=_[_0xeb62('0x32')](_0xb1c958['query']);_0x4afd5e[_0xeb62('0x33')]=_[_0xeb62('0x34')](_0x4afd5e[_0xeb62('0x37')],_0x4afd5e[_0xeb62('0x35')]);_0x31d4d6[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x4afd5e['model'],qs[_0xeb62('0x38')](_0xb1c958[_0xeb62('0x35')]['fields']));_0x31d4d6['attributes']=_0x31d4d6['attributes']['length']?_0x31d4d6[_0xeb62('0x36')]:_0x4afd5e[_0xeb62('0x37')];if(_0xb1c958['query'][_0xeb62('0x47')]){_0x31d4d6[_0xeb62('0x42')]=[{'all':!![]}];}_0x31d4d6=_[_0xeb62('0x3f')]({},_0x31d4d6,_0xb1c958[_0xeb62('0x41')]);return db[_0xeb62('0x2f')]['find'](_0x31d4d6)[_0xeb62('0x28')](handleEntityNotFound(_0x1b408c,null))['then'](respondWithResult(_0x1b408c,null))[_0xeb62('0x44')](handleError(_0x1b408c,null));};exports[_0xeb62('0x48')]=function(_0x7fb53f,_0x18c40d){return db[_0xeb62('0x2f')][_0xeb62('0x48')](_0x7fb53f[_0xeb62('0x49')],{})[_0xeb62('0x28')](function(_0x19c6fb){var _0x3a29ac=_0x7fb53f[_0xeb62('0x4a')][_0xeb62('0x4b')]({'plain':!![]});if(!_0x3a29ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a29ac[_0xeb62('0x4c')]==='user'){var _0x4edd8c=_0x19c6fb[_0xeb62('0x4b')]({'plain':!![]});var _0x31fd4a='Voicemails';return db[_0xeb62('0x4d')][_0xeb62('0x4e')]({'where':{'name':_0x31fd4a,'userProfileId':_0x3a29ac['userProfileId']},'raw':!![]})[_0xeb62('0x28')](function(_0x137030){if(_0x137030&&_0x137030[_0xeb62('0x4f')]===0x0){return db[_0xeb62('0x27')][_0xeb62('0x48')]({'name':_0x4edd8c[_0xeb62('0x2b')],'resourceId':_0x4edd8c['id'],'type':_0x137030[_0xeb62('0x2b')],'sectionId':_0x137030['id']},{})[_0xeb62('0x28')](function(){return _0x19c6fb;});}else{return _0x19c6fb;}})['catch'](function(_0x3e2be9){logger['error'](_0xeb62('0x50'),_0x3e2be9);throw _0x3e2be9;});}return _0x19c6fb;})[_0xeb62('0x28')](respondWithResult(_0x18c40d,0xc9))[_0xeb62('0x44')](handleError(_0x18c40d,null));};exports[_0xeb62('0x51')]=function(_0x35d92d,_0x13ea55){if(_0x35d92d[_0xeb62('0x49')]['id']){delete _0x35d92d[_0xeb62('0x49')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x35d92d['params']['id']}})['then'](handleEntityNotFound(_0x13ea55,null))[_0xeb62('0x28')](saveUpdates(_0x35d92d['body'],null))[_0xeb62('0x28')](respondWithResult(_0x13ea55,null))['catch'](handleError(_0x13ea55,null));};exports[_0xeb62('0x52')]=function(_0x342768,_0xff18cd){return db['VoiceMail'][_0xeb62('0x4e')]({'where':{'id':_0x342768[_0xeb62('0x46')]['id']}})['then'](handleEntityNotFound(_0xff18cd,null))[_0xeb62('0x28')](removeEntity(_0xff18cd,null))[_0xeb62('0x44')](handleError(_0xff18cd,null));};exports[_0xeb62('0x53')]=function(_0x366312,_0x55370c,_0x3be3e1){return db[_0xeb62('0x2f')]['findOne']({'where':{'id':_0x366312[_0xeb62('0x46')]['id']}})[_0xeb62('0x28')](handleEntityNotFound(_0x55370c,null))[_0xeb62('0x28')](function(_0x466c3c){var _0x3a450b;var _0x46da69={},_0x3e55bf={};_0x3e55bf[_0xeb62('0x37')]=_[_0xeb62('0x32')](db[_0xeb62('0x54')][_0xeb62('0x30')]);_0x3e55bf[_0xeb62('0x35')]=_[_0xeb62('0x32')](_0x366312[_0xeb62('0x35')]);_0x3e55bf[_0xeb62('0x33')]=_[_0xeb62('0x34')](_0x3e55bf['model'],_0x3e55bf['query']);_0x46da69['attributes']=_['intersection'](_0x3e55bf[_0xeb62('0x37')],qs['fields'](_0x366312[_0xeb62('0x35')][_0xeb62('0x38')]));_0x46da69[_0xeb62('0x36')]=_0x46da69[_0xeb62('0x36')][_0xeb62('0x39')]?_0x46da69[_0xeb62('0x36')]:_0x3e55bf[_0xeb62('0x37')];if(!_0x366312[_0xeb62('0x35')][_0xeb62('0x3a')](_0xeb62('0x55'))){_0x46da69['limit']=qs[_0xeb62('0x21')](_0x366312[_0xeb62('0x35')][_0xeb62('0x21')]);_0x46da69[_0xeb62('0x1f')]=qs['offset'](_0x366312[_0xeb62('0x35')][_0xeb62('0x1f')]);}_0x46da69[_0xeb62('0x56')]=qs[_0xeb62('0x3b')](_0x366312[_0xeb62('0x35')][_0xeb62('0x3b')]);_0x46da69[_0xeb62('0x3c')]=qs[_0xeb62('0x33')](_[_0xeb62('0x3d')](_0x366312[_0xeb62('0x35')],_0x3e55bf[_0xeb62('0x33')]));if(_0x366312['query'][_0xeb62('0x3e')]){_0x46da69[_0xeb62('0x3c')]=_[_0xeb62('0x3f')](_0x46da69[_0xeb62('0x3c')],{'$or':_[_0xeb62('0x2e')](_0x46da69[_0xeb62('0x36')],function(_0x388b31){var _0x1dcc91={};_0x1dcc91[_0x388b31]={'$like':'%'+_0x366312[_0xeb62('0x35')][_0xeb62('0x3e')]+'%'};return _0x1dcc91;})});}_0x46da69['where']=_[_0xeb62('0x3f')](_0x46da69[_0xeb62('0x3c')],{'mailboxuser':_0x466c3c[_0xeb62('0x57')]});_0x46da69=_[_0xeb62('0x3f')]({},_0x46da69,_0x366312['options']);return db[_0xeb62('0x54')][_0xeb62('0x58')](_0x46da69)[_0xeb62('0x28')](respondWithFilteredResult(_0x55370c,_0x46da69));})[_0xeb62('0x44')](handleError(_0x55370c,null));}; \ No newline at end of file +var _0x36ee=['set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','stack','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../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','limit','count'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){var _0xb32195=_0x4749a8[_0xe36e('0x28')]({'plain':!![]});var _0x1507f9=_0xe36e('0x29');return db['UserProfileResource'][_0xe36e('0x27')]({'where':{'type':_0x1507f9,'resourceId':_0xb32195['id']}})[_0xe36e('0x26')](function(){return _0x4749a8;});})[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d757c,_0x5a3133){return function(_0xf7b02e){if(!_0xf7b02e){_0x2d757c['sendStatus'](0x194);}return _0xf7b02e;};}function handleError(_0x19f001,_0x5884cb){_0x5884cb=_0x5884cb||0x1f4;return function(_0x410504){logger['error'](_0x410504[_0xe36e('0x2a')]);if(_0x410504['name']){delete _0x410504['name'];}_0x19f001['status'](_0x5884cb)['send'](_0x410504);};}exports[_0xe36e('0x2b')]=function(_0x1fc639,_0x4cf185){var _0x4ac819={},_0x1fa1ec={},_0xb8d44e={'count':0x0,'rows':[]};var _0x259e19=_[_0xe36e('0x2c')](db[_0xe36e('0x2d')][_0xe36e('0x2e')],function(_0x57bb9b){return{'name':_0x57bb9b[_0xe36e('0x2f')],'type':_0x57bb9b[_0xe36e('0x30')]['key']};});_0x1fa1ec[_0xe36e('0x31')]=_[_0xe36e('0x2c')](_0x259e19,_0xe36e('0x32'));_0x1fa1ec[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x1fc639[_0xe36e('0x33')]);_0x1fa1ec[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x1fa1ec[_0xe36e('0x31')],_0x1fa1ec[_0xe36e('0x33')]);_0x4ac819[_0xe36e('0x37')]=_['intersection'](_0x1fa1ec[_0xe36e('0x31')],qs['fields'](_0x1fc639['query'][_0xe36e('0x38')]));_0x4ac819['attributes']=_0x4ac819[_0xe36e('0x37')][_0xe36e('0x39')]?_0x4ac819[_0xe36e('0x37')]:_0x1fa1ec[_0xe36e('0x31')];if(!_0x1fc639['query']['hasOwnProperty'](_0xe36e('0x3a'))){_0x4ac819[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x1fc639[_0xe36e('0x33')]['limit']);_0x4ac819[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x1fc639[_0xe36e('0x33')]['offset']);}_0x4ac819[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x1fc639['query'][_0xe36e('0x3c')]);_0x4ac819[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x1fc639[_0xe36e('0x33')],_0x1fa1ec[_0xe36e('0x35')]),_0x259e19);if(_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x4ac819[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x4ac819[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x259e19,function(_0x3c4703){if(_0x3c4703['type']!==_0xe36e('0x41')){var _0x134fb2={};_0x134fb2[_0x3c4703[_0xe36e('0x32')]]={'$like':'%'+_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x134fb2;}})});}_0x4ac819=_['merge']({},_0x4ac819,_0x1fc639['options']);var _0x4094c6={'where':_0x4ac819[_0xe36e('0x3d')]};return db[_0xe36e('0x2d')][_0xe36e('0x1f')](_0x4094c6)[_0xe36e('0x26')](function(_0x34a1ba){_0xb8d44e[_0xe36e('0x1f')]=_0x34a1ba;if(_0x1fc639[_0xe36e('0x33')]['includeAll']){_0x4ac819[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2d')]['findAll'](_0x4ac819);})[_0xe36e('0x26')](function(_0x5ef3e4){_0xb8d44e[_0xe36e('0x43')]=_0x5ef3e4;return _0xb8d44e;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4cf185,_0x4ac819))[_0xe36e('0x44')](handleError(_0x4cf185,null));};exports[_0xe36e('0x45')]=function(_0x3b1269,_0x4c5e10){var _0x2ffc34={'raw':!![],'where':{'id':_0x3b1269[_0xe36e('0x46')]['id']}},_0x2961c9={};_0x2961c9[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x2d')]['rawAttributes']);_0x2961c9[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1269[_0xe36e('0x33')]);_0x2961c9[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2961c9['model'],_0x2961c9[_0xe36e('0x33')]);_0x2ffc34[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x2961c9[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3b1269[_0xe36e('0x33')][_0xe36e('0x38')]));_0x2ffc34[_0xe36e('0x37')]=_0x2ffc34[_0xe36e('0x37')]['length']?_0x2ffc34['attributes']:_0x2961c9[_0xe36e('0x31')];if(_0x3b1269['query'][_0xe36e('0x47')]){_0x2ffc34[_0xe36e('0x42')]=[{'all':!![]}];}_0x2ffc34=_[_0xe36e('0x40')]({},_0x2ffc34,_0x3b1269[_0xe36e('0x48')]);return db['VoiceMail'][_0xe36e('0x49')](_0x2ffc34)[_0xe36e('0x26')](handleEntityNotFound(_0x4c5e10,null))['then'](respondWithResult(_0x4c5e10,null))[_0xe36e('0x44')](handleError(_0x4c5e10,null));};exports[_0xe36e('0x4a')]=function(_0x2c26e6,_0x42eae5){return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_0x2c26e6[_0xe36e('0x4b')],{})[_0xe36e('0x26')](function(_0x17555e){var _0x3a99aa=_0x2c26e6[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x3a99aa)throw new Error(_0xe36e('0x4d'));if(_0x3a99aa[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x5678d3=_0x17555e[_0xe36e('0x28')]({'plain':!![]});var _0x55aadf='Voicemails';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x55aadf,'userProfileId':_0x3a99aa['userProfileId']},'raw':!![]})[_0xe36e('0x26')](function(_0x3814eb){if(_0x3814eb&&_0x3814eb[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x5678d3[_0xe36e('0x32')],'resourceId':_0x5678d3['id'],'type':_0x3814eb[_0xe36e('0x32')],'sectionId':_0x3814eb['id']},{})[_0xe36e('0x26')](function(){return _0x17555e;});}else{return _0x17555e;}})[_0xe36e('0x44')](function(_0x55d190){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x55d190);throw _0x55d190;});}return _0x17555e;})['then'](respondWithResult(_0x42eae5,0xc9))[_0xe36e('0x44')](handleError(_0x42eae5,null));};exports[_0xe36e('0x25')]=function(_0x3e1040,_0x206f75){if(_0x3e1040[_0xe36e('0x4b')]['id']){delete _0x3e1040['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0x3e1040['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x206f75,null))[_0xe36e('0x26')](saveUpdates(_0x3e1040[_0xe36e('0x4b')],null))[_0xe36e('0x26')](respondWithResult(_0x206f75,null))[_0xe36e('0x44')](handleError(_0x206f75,null));};exports[_0xe36e('0x27')]=function(_0x7c3766,_0x17965c){return db[_0xe36e('0x2d')]['find']({'where':{'id':_0x7c3766[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x17965c,null))['then'](removeEntity(_0x17965c,null))[_0xe36e('0x44')](handleError(_0x17965c,null));};exports[_0xe36e('0x54')]=function(_0x169369,_0x443154,_0x700b63){return db[_0xe36e('0x2d')][_0xe36e('0x55')]({'where':{'id':_0x169369[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x443154,null))[_0xe36e('0x26')](function(_0x56718a){var _0x2cf7fc;var _0x389e91={},_0x6f979f={};_0x6f979f[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x56')][_0xe36e('0x2e')]);_0x6f979f[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x169369[_0xe36e('0x33')]);_0x6f979f[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x6f979f[_0xe36e('0x31')],_0x6f979f[_0xe36e('0x33')]);_0x389e91['attributes']=_[_0xe36e('0x36')](_0x6f979f[_0xe36e('0x31')],qs['fields'](_0x169369[_0xe36e('0x33')][_0xe36e('0x38')]));_0x389e91[_0xe36e('0x37')]=_0x389e91[_0xe36e('0x37')][_0xe36e('0x39')]?_0x389e91[_0xe36e('0x37')]:_0x6f979f['model'];if(!_0x169369[_0xe36e('0x33')]['hasOwnProperty'](_0xe36e('0x3a'))){_0x389e91[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x169369[_0xe36e('0x33')][_0xe36e('0x1e')]);_0x389e91[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x169369[_0xe36e('0x33')]['offset']);}_0x389e91[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x169369['query'][_0xe36e('0x3c')]);_0x389e91[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x169369[_0xe36e('0x33')],_0x6f979f[_0xe36e('0x35')]));if(_0x169369[_0xe36e('0x33')]['filter']){_0x389e91[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x389e91[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x389e91[_0xe36e('0x37')],function(_0x43d8c2){var _0xc1daf8={};_0xc1daf8[_0x43d8c2]={'$like':'%'+_0x169369[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0xc1daf8;})});}_0x389e91[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x389e91['where'],{'mailboxuser':_0x56718a[_0xe36e('0x57')]});_0x389e91=_[_0xe36e('0x40')]({},_0x389e91,_0x169369[_0xe36e('0x48')]);return db[_0xe36e('0x56')]['findAndCountAll'](_0x389e91)['then'](respondWithFilteredResult(_0x443154,_0x389e91));})[_0xe36e('0x44')](handleError(_0x443154,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 28b4d01..fd9b3f8 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 _0xb1de=['api','bluebird','request-promise','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','util','../../config/logger'];(function(_0x18b2f3,_0x29b07e){var _0x4e896b=function(_0x130790){while(--_0x130790){_0x18b2f3['push'](_0x18b2f3['shift']());}};_0x4e896b(++_0x29b07e);}(_0xb1de,0x196));var _0xeb1d=function(_0x58eb3c,_0x6227ba){_0x58eb3c=_0x58eb3c-0x0;var _0x59be0c=_0xb1de[_0x58eb3c];return _0x59be0c;};'use strict';var _=require('lodash');var util=require(_0xeb1d('0x0'));var logger=require(_0xeb1d('0x1'))(_0xeb1d('0x2'));var moment=require('moment');var BPromise=require(_0xeb1d('0x3'));var rp=require(_0xeb1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb1d('0x5'));var config=require('../../config/environment');var attributes=require(_0xeb1d('0x6'));module[_0xeb1d('0x7')]=function(_0x559c56,_0x59ded5){return _0x559c56[_0xeb1d('0x8')](_0xeb1d('0x9'),attributes,{'tableName':_0xeb1d('0xa'),'paranoid':![],'indexes':[{'name':_0xeb1d('0xb'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf43=['api','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','context','lodash','util'];(function(_0x2d1a6e,_0x26f215){var _0x4b1674=function(_0x170ed3){while(--_0x170ed3){_0x2d1a6e['push'](_0x2d1a6e['shift']());}};_0x4b1674(++_0x26f215);}(_0xaf43,0x196));var _0x3af4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xaf43[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3af4('0x0'));var util=require(_0x3af4('0x1'));var logger=require('../../config/logger')(_0x3af4('0x2'));var moment=require('moment');var BPromise=require(_0x3af4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3af4('0x4'));var rimraf=require(_0x3af4('0x5'));var config=require(_0x3af4('0x6'));var attributes=require(_0x3af4('0x7'));module[_0x3af4('0x8')]=function(_0x40302b,_0x4dc53e){return _0x40302b[_0x3af4('0x9')]('VoiceMail',attributes,{'tableName':_0x3af4('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x3af4('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 272b371..73724cc 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 _0xa71a=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xa71a,0x1b8));var _0xaa71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa71a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaa71('0x0'));var util=require(_0xaa71('0x1'));var moment=require(_0xaa71('0x2'));var BPromise=require(_0xaa71('0x3'));var rs=require(_0xaa71('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa71('0x5'))['db'];var utils=require(_0xaa71('0x6'));var logger=require(_0xaa71('0x7'))('rpc');var config=require(_0xaa71('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaa71('0x9')][_0xaa71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8e8a,_0x47f5b7,_0x504b29){return new BPromise(function(_0x3c6f55,_0xdd6cf2){return client[_0xaa71('0xb')](_0x1c8e8a,_0x504b29)[_0xaa71('0xc')](function(_0x1e6350){logger[_0xaa71('0xd')](_0xaa71('0xe'),_0x47f5b7,_0xaa71('0xf'));logger[_0xaa71('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x47f5b7,'request\x20sent',JSON[_0xaa71('0x11')](_0x1e6350));if(_0x1e6350[_0xaa71('0x12')]){if(_0x1e6350[_0xaa71('0x12')]['code']===0x1f4){logger[_0xaa71('0x12')]('VoiceMail,\x20%s,\x20%s',_0x47f5b7,_0x1e6350[_0xaa71('0x12')][_0xaa71('0x13')]);return _0xdd6cf2(_0x1e6350[_0xaa71('0x12')][_0xaa71('0x13')]);}logger[_0xaa71('0x12')]('VoiceMail,\x20%s,\x20%s',_0x47f5b7,_0x1e6350[_0xaa71('0x12')][_0xaa71('0x13')]);return _0x3c6f55(_0x1e6350['error'][_0xaa71('0x13')]);}else{logger[_0xaa71('0xd')]('VoiceMail,\x20%s,\x20%s',_0x47f5b7,_0xaa71('0xf'));_0x3c6f55(_0x1e6350[_0xaa71('0x14')][_0xaa71('0x13')]);}})[_0xaa71('0x15')](function(_0x1e1e52){logger[_0xaa71('0x12')](_0xaa71('0xe'),_0x47f5b7,_0x1e1e52);_0xdd6cf2(_0x1e1e52);});});} \ No newline at end of file +var _0x24cc=['rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3ae69c,_0x31267a){var _0x46ca50=function(_0x47a96e){while(--_0x47a96e){_0x3ae69c['push'](_0x3ae69c['shift']());}};_0x46ca50(++_0x31267a);}(_0x24cc,0x180));var _0xc24c=function(_0x537563,_0x49b366){_0x537563=_0x537563-0x0;var _0x27675f=_0x24cc[_0x537563];return _0x27675f;};'use strict';var _=require(_0xc24c('0x0'));var util=require(_0xc24c('0x1'));var moment=require(_0xc24c('0x2'));var BPromise=require('bluebird');var rs=require(_0xc24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc24c('0x4'))['db'];var utils=require(_0xc24c('0x5'));var logger=require(_0xc24c('0x6'))(_0xc24c('0x7'));var config=require(_0xc24c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc24c('0x9')][_0xc24c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4021a1,_0x227508,_0xc820a4){return new BPromise(function(_0x5c01ee,_0x45b868){return client[_0xc24c('0xb')](_0x4021a1,_0xc820a4)[_0xc24c('0xc')](function(_0x4effe3){logger[_0xc24c('0xd')](_0xc24c('0xe'),_0x227508,'request\x20sent');logger[_0xc24c('0xf')](_0xc24c('0x10'),_0x227508,_0xc24c('0x11'),JSON[_0xc24c('0x12')](_0x4effe3));if(_0x4effe3['error']){if(_0x4effe3['error'][_0xc24c('0x13')]===0x1f4){logger[_0xc24c('0x14')]('VoiceMail,\x20%s,\x20%s',_0x227508,_0x4effe3[_0xc24c('0x14')][_0xc24c('0x15')]);return _0x45b868(_0x4effe3['error']['message']);}logger[_0xc24c('0x14')](_0xc24c('0xe'),_0x227508,_0x4effe3[_0xc24c('0x14')]['message']);return _0x5c01ee(_0x4effe3['error']['message']);}else{logger[_0xc24c('0xd')](_0xc24c('0xe'),_0x227508,_0xc24c('0x11'));_0x5c01ee(_0x4effe3[_0xc24c('0x16')]['message']);}})['catch'](function(_0x509be6){logger[_0xc24c('0x14')](_0xc24c('0xe'),_0x227508,_0x509be6);_0x45b868(_0x509be6);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 78ef32e..7a770e0 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 _0x5ccc=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','/:id','get','/:id/download','download'];(function(_0x2a8cb7,_0x314d29){var _0x183a1f=function(_0x7f65bc){while(--_0x7f65bc){_0x2a8cb7['push'](_0x2a8cb7['shift']());}};_0x183a1f(++_0x314d29);}(_0x5ccc,0x7f));var _0xc5cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ccc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc5cc('0x0'));var util=require(_0xc5cc('0x1'));var path=require(_0xc5cc('0x2'));var timeout=require(_0xc5cc('0x3'));var express=require(_0xc5cc('0x4'));var router=express[_0xc5cc('0x5')]();var fs_extra=require(_0xc5cc('0x6'));var auth=require(_0xc5cc('0x7'));var interaction=require(_0xc5cc('0x8'));var config=require(_0xc5cc('0x9'));var controller=require(_0xc5cc('0xa'));router['get']('/',auth[_0xc5cc('0xb')](),controller[_0xc5cc('0xc')]);router['get'](_0xc5cc('0xd'),auth[_0xc5cc('0xb')](),controller['show']);router[_0xc5cc('0xe')](_0xc5cc('0xf'),auth[_0xc5cc('0xb')](),controller[_0xc5cc('0x10')]);router[_0xc5cc('0x11')]('/',auth[_0xc5cc('0xb')](),controller[_0xc5cc('0x12')]);router[_0xc5cc('0x13')](_0xc5cc('0xd'),auth[_0xc5cc('0xb')](),controller[_0xc5cc('0x14')]);router[_0xc5cc('0x15')]('/:id',auth[_0xc5cc('0xb')](),controller[_0xc5cc('0x16')]);module[_0xc5cc('0x17')]=router; \ No newline at end of file +var _0x26b9=['delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update'];(function(_0x5eea1e,_0x22c683){var _0xdb1734=function(_0x251002){while(--_0x251002){_0x5eea1e['push'](_0x5eea1e['shift']());}};_0xdb1734(++_0x22c683);}(_0x26b9,0x157));var _0x926b=function(_0x2b3bb9,_0x1556ce){_0x2b3bb9=_0x2b3bb9-0x0;var _0x5d3da5=_0x26b9[_0x2b3bb9];return _0x5d3da5;};'use strict';var multer=require('multer');var util=require(_0x926b('0x0'));var path=require(_0x926b('0x1'));var timeout=require(_0x926b('0x2'));var express=require('express');var router=express[_0x926b('0x3')]();var fs_extra=require(_0x926b('0x4'));var auth=require(_0x926b('0x5'));var interaction=require(_0x926b('0x6'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x926b('0x7')]('/',auth[_0x926b('0x8')](),controller[_0x926b('0x9')]);router[_0x926b('0x7')](_0x926b('0xa'),auth['isAuthenticated'](),controller[_0x926b('0xb')]);router[_0x926b('0x7')](_0x926b('0xc'),auth[_0x926b('0x8')](),controller[_0x926b('0xd')]);router[_0x926b('0xe')]('/',auth[_0x926b('0x8')](),controller['create']);router[_0x926b('0xf')](_0x926b('0xa'),auth[_0x926b('0x8')](),controller[_0x926b('0x10')]);router[_0x926b('0x11')]('/:id',auth[_0x926b('0x8')](),controller[_0x926b('0x12')]);module[_0x926b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 0053159..51bfc0b 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 _0xb98c=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x5474b4,_0x5027aa){var _0x33a0b5=function(_0x41fd6b){while(--_0x41fd6b){_0x5474b4['push'](_0x5474b4['shift']());}};_0x33a0b5(++_0x5027aa);}(_0xb98c,0x89));var _0xcb98=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xb98c[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require('sequelize');module[_0xcb98('0x0')]={'name':{'type':Sequelize[_0xcb98('0x1')],'get':function(_0x5e2c2c){return this[_0xcb98('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xcb98('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xcb98('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xcb98('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xcb98('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xcb98('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xcb98('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xcb98('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xcb98('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xcb98('0x5')](_0xcb98('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xcb98('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xcb98('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0xcb98('0x7'))}}; \ No newline at end of file +var _0x7468=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7468,0xaa));var _0x8746=function(_0x55d2a1,_0x2c64dc){_0x55d2a1=_0x55d2a1-0x0;var _0x1663f7=_0x7468[_0x55d2a1];return _0x1663f7;};'use strict';var Sequelize=require(_0x8746('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x51d735){return this[_0x8746('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x8746('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8746('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x8746('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8746('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8746('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x8746('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x8746('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8746('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8746('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x8746('0x4')](_0x8746('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x8746('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8746('0x3')],'defaultValue':''},'stamp':{'type':_0x8746('0x6'),'defaultValue':Sequelize[_0x8746('0x7')](_0x8746('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 1d21d4a..f28a890 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 _0x2711=['rows','show','params','keys','find','catch','create','body','destroy','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','include','findAll'];(function(_0x48110d,_0x916caa){var _0x3d57ad=function(_0x14796b){while(--_0x14796b){_0x48110d['push'](_0x48110d['shift']());}};_0x3d57ad(++_0x916caa);}(_0x2711,0x152));var _0x1271=function(_0x76a753,_0x279840){_0x76a753=_0x76a753-0x0;var _0x4bc694=_0x2711[_0x76a753];return _0x4bc694;};'use strict';var emlformat=require(_0x1271('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1271('0x1'));var jsonpatch=require(_0x1271('0x2'));var rp=require(_0x1271('0x3'));var moment=require('moment');var BPromise=require(_0x1271('0x4'));var Mustache=require(_0x1271('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1271('0x6'));var ejs=require(_0x1271('0x7'));var fs=require('fs');var fs_extra=require(_0x1271('0x8'));var _=require('lodash');var squel=require(_0x1271('0x9'));var crypto=require('crypto');var jsforce=require(_0x1271('0xa'));var deskjs=require(_0x1271('0xb'));var toCsv=require(_0x1271('0x6'));var querystring=require('querystring');var Papa=require(_0x1271('0xc'));var Redis=require(_0x1271('0xd'));var authService=require(_0x1271('0xe'));var qs=require(_0x1271('0xf'));var as=require(_0x1271('0x10'));var hardwareService=require(_0x1271('0x11'));var logger=require('../../config/logger')(_0x1271('0x12'));var utils=require('../../config/utils');var config=require(_0x1271('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1271('0x14'))['db'];function respondWithStatusCode(_0x54fb2c,_0x1a85d4){_0x1a85d4=_0x1a85d4||0xcc;return function(_0x556bc5){if(_0x556bc5){return _0x54fb2c[_0x1271('0x15')](_0x1a85d4);}return _0x54fb2c[_0x1271('0x16')](_0x1a85d4)[_0x1271('0x17')]();};}function respondWithResult(_0x20a11d,_0x334127){_0x334127=_0x334127||0xc8;return function(_0x3639e7){if(_0x3639e7){return _0x20a11d[_0x1271('0x16')](_0x334127)[_0x1271('0x18')](_0x3639e7);}};}function respondWithFilteredResult(_0x33eac6,_0x4261ed){return function(_0x2fb132){if(_0x2fb132){var _0x397cdf=typeof _0x4261ed[_0x1271('0x19')]==='undefined'&&typeof _0x4261ed[_0x1271('0x1a')]==='undefined';var _0x40602f=_0x2fb132[_0x1271('0x1b')];var _0xf6a857=_0x397cdf?0x0:_0x4261ed['offset'];var _0x2ba60e=_0x397cdf?_0x2fb132[_0x1271('0x1b')]:_0x4261ed[_0x1271('0x19')]+_0x4261ed[_0x1271('0x1a')];var _0x1a9915;if(_0x2ba60e>=_0x40602f){_0x2ba60e=_0x40602f;_0x1a9915=0xc8;}else{_0x1a9915=0xce;}_0x33eac6[_0x1271('0x16')](_0x1a9915);return _0x33eac6[_0x1271('0x1c')](_0x1271('0x1d'),_0xf6a857+'-'+_0x2ba60e+'/'+_0x40602f)[_0x1271('0x18')](_0x2fb132);}return null;};}function patchUpdates(_0x3780b2){return function(_0x229cc5){try{jsonpatch[_0x1271('0x1e')](_0x229cc5,_0x3780b2,!![]);}catch(_0x49cf22){return BPromise[_0x1271('0x1f')](_0x49cf22);}return _0x229cc5['save']();};}function saveUpdates(_0x3d9a7c,_0x475b0a){return function(_0x4fb173){if(_0x4fb173){return _0x4fb173[_0x1271('0x20')](_0x3d9a7c)[_0x1271('0x21')](function(_0x14d739){return _0x14d739;});}return null;};}function removeEntity(_0x1c84d9,_0x581d2c){return function(_0x1a5857){if(_0x1a5857){return _0x1a5857['destroy']()[_0x1271('0x21')](function(){_0x1c84d9[_0x1271('0x16')](0xcc)[_0x1271('0x17')]();});}};}function handleEntityNotFound(_0x1e3d23,_0x3bf408){return function(_0x6e3c28){if(!_0x6e3c28){_0x1e3d23[_0x1271('0x15')](0x194);}return _0x6e3c28;};}function handleError(_0x144c91,_0x48ecb4){_0x48ecb4=_0x48ecb4||0x1f4;return function(_0x38a333){logger[_0x1271('0x22')](_0x38a333['stack']);if(_0x38a333[_0x1271('0x23')]){delete _0x38a333[_0x1271('0x23')];}_0x144c91['status'](_0x48ecb4)[_0x1271('0x24')](_0x38a333);};}exports[_0x1271('0x25')]=function(_0x5aef96,_0x37d638){var _0x244f17={},_0x32a2fd={},_0x1e6249={'count':0x0,'rows':[]};var _0x9c9f6f=_[_0x1271('0x26')](db['VoiceMailMessage'][_0x1271('0x27')],function(_0x5d8c66){return{'name':_0x5d8c66[_0x1271('0x28')],'type':_0x5d8c66[_0x1271('0x29')][_0x1271('0x2a')]};});_0x32a2fd[_0x1271('0x2b')]=_['differenceBy'](_[_0x1271('0x26')](_0x9c9f6f,'name'),[_0x1271('0x23')]);_0x32a2fd[_0x1271('0x2c')]=_['keys'](_0x5aef96[_0x1271('0x2c')]);_0x32a2fd[_0x1271('0x2d')]=_[_0x1271('0x2e')](_0x32a2fd['model'],_0x32a2fd[_0x1271('0x2c')]);_0x244f17[_0x1271('0x2f')]=_[_0x1271('0x2e')](_0x32a2fd[_0x1271('0x2b')],qs['fields'](_0x5aef96['query'][_0x1271('0x30')]));_0x244f17['attributes']=_0x244f17[_0x1271('0x2f')][_0x1271('0x31')]?_0x244f17[_0x1271('0x2f')]:_0x32a2fd[_0x1271('0x2b')];if(!_0x5aef96[_0x1271('0x2c')][_0x1271('0x32')](_0x1271('0x33'))){_0x244f17[_0x1271('0x1a')]=qs[_0x1271('0x1a')](_0x5aef96[_0x1271('0x2c')]['limit']);_0x244f17[_0x1271('0x19')]=qs[_0x1271('0x19')](_0x5aef96['query'][_0x1271('0x19')]);}_0x244f17['order']=qs[_0x1271('0x34')](_0x5aef96[_0x1271('0x2c')]['sort']);_0x244f17[_0x1271('0x35')]=qs[_0x1271('0x2d')](_[_0x1271('0x36')](_0x5aef96['query'],_0x32a2fd['filters']),_0x9c9f6f);if(_0x5aef96['query'][_0x1271('0x37')]){_0x244f17[_0x1271('0x35')]=_[_0x1271('0x38')](_0x244f17[_0x1271('0x35')],{'$or':_[_0x1271('0x26')](_0x9c9f6f,function(_0x1fdf5b){if(_0x1fdf5b[_0x1271('0x29')]!==_0x1271('0x39')){var _0x465f1d={};_0x465f1d[_0x1fdf5b[_0x1271('0x23')]]={'$like':'%'+_0x5aef96[_0x1271('0x2c')][_0x1271('0x37')]+'%'};return _0x465f1d;}})});}_0x244f17=_['merge']({},_0x244f17,_0x5aef96[_0x1271('0x3a')]);var _0x2f5a3d={'where':_0x244f17[_0x1271('0x35')]};return db[_0x1271('0x3b')]['count'](_0x2f5a3d)[_0x1271('0x21')](function(_0xc67f3c){_0x1e6249[_0x1271('0x1b')]=_0xc67f3c;if(_0x5aef96[_0x1271('0x2c')]['includeAll']){_0x244f17[_0x1271('0x3c')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x1271('0x3d')](_0x244f17);})['then'](function(_0x24faa8){_0x1e6249[_0x1271('0x3e')]=_0x24faa8;return _0x1e6249;})['then'](respondWithFilteredResult(_0x37d638,_0x244f17))['catch'](handleError(_0x37d638,null));};exports[_0x1271('0x3f')]=function(_0x2d3640,_0x4fd59a){var _0xc35b2f={'raw':!![],'where':{'id':_0x2d3640[_0x1271('0x40')]['id']}},_0xa9a0b5={};_0xa9a0b5[_0x1271('0x2b')]=_[_0x1271('0x41')](db[_0x1271('0x3b')][_0x1271('0x27')]);_0xa9a0b5['query']=_[_0x1271('0x41')](_0x2d3640['query']);_0xa9a0b5[_0x1271('0x2d')]=_[_0x1271('0x2e')](_0xa9a0b5[_0x1271('0x2b')],_0xa9a0b5['query']);_0xc35b2f['attributes']=_[_0x1271('0x2e')](_0xa9a0b5[_0x1271('0x2b')],qs[_0x1271('0x30')](_0x2d3640[_0x1271('0x2c')][_0x1271('0x30')]));_0xc35b2f[_0x1271('0x2f')]=_0xc35b2f[_0x1271('0x2f')][_0x1271('0x31')]?_0xc35b2f['attributes']:_0xa9a0b5[_0x1271('0x2b')];if(_0x2d3640[_0x1271('0x2c')]['includeAll']){_0xc35b2f[_0x1271('0x3c')]=[{'all':!![]}];}_0xc35b2f=_[_0x1271('0x38')]({},_0xc35b2f,_0x2d3640[_0x1271('0x3a')]);return db[_0x1271('0x3b')][_0x1271('0x42')](_0xc35b2f)['then'](handleEntityNotFound(_0x4fd59a,null))[_0x1271('0x21')](respondWithResult(_0x4fd59a,null))[_0x1271('0x43')](handleError(_0x4fd59a,null));};exports[_0x1271('0x44')]=function(_0x4dc4c3,_0x32c380){return db[_0x1271('0x3b')][_0x1271('0x44')](_0x4dc4c3[_0x1271('0x45')],{})['then'](respondWithResult(_0x32c380,0xc9))['catch'](handleError(_0x32c380,null));};exports[_0x1271('0x20')]=function(_0x257563,_0x2ae958){if(_0x257563[_0x1271('0x45')]['id']){delete _0x257563[_0x1271('0x45')]['id'];}return db[_0x1271('0x3b')][_0x1271('0x42')]({'where':{'id':_0x257563[_0x1271('0x40')]['id']}})[_0x1271('0x21')](handleEntityNotFound(_0x2ae958,null))['then'](saveUpdates(_0x257563[_0x1271('0x45')],null))['then'](respondWithResult(_0x2ae958,null))['catch'](handleError(_0x2ae958,null));};exports[_0x1271('0x46')]=function(_0x8cf4f3,_0x103641){return db[_0x1271('0x3b')][_0x1271('0x42')]({'where':{'id':_0x8cf4f3[_0x1271('0x40')]['id']}})[_0x1271('0x21')](handleEntityNotFound(_0x103641,null))[_0x1271('0x21')](removeEntity(_0x103641,null))[_0x1271('0x43')](handleError(_0x103641,null));};exports[_0x1271('0x47')]=function(_0x542b30,_0x4c9464,_0x3248c3){return db['VoiceMailMessage'][_0x1271('0x42')]({'where':{'id':_0x542b30[_0x1271('0x40')]['id']},'attributes':['id',_0x1271('0x48'),_0x1271('0x49')]})[_0x1271('0x21')](handleEntityNotFound(_0x4c9464,null))[_0x1271('0x21')](function(_0x3c3255){if(_0x3c3255){if(!_0x3c3255[_0x1271('0x48')]){throw new db[(_0x1271('0x4a'))]['ValidationError'](_0x1271('0x4b'));}var _0x135c36={'Content-Type':_0x1271('0x4c'),'Content-Disposition':'attachment'};if(_0x3c3255['msg_id']){_0x135c36[_0x1271('0x4d')]=_0x1271('0x4e')+_0x3c3255[_0x1271('0x49')]+_0x1271('0x4f');}_0x4c9464[_0x1271('0x1c')](_0x135c36);return _0x4c9464[_0x1271('0x24')](new Buffer(_0x3c3255[_0x1271('0x48')]));}})['catch'](handleError(_0x4c9464,null));}; \ No newline at end of file +var _0xa4ba=['count','status','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','model','differenceBy','query','filters','intersection','fields','attributes','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMailMessage','includeAll','findAll','rows','show','params','keys','length','include','catch','create','body','download','find','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined'];(function(_0x5912be,_0x1bd806){var _0x41be72=function(_0x1566fc){while(--_0x1566fc){_0x5912be['push'](_0x5912be['shift']());}};_0x41be72(++_0x1bd806);}(_0xa4ba,0x8f));var _0xaa4b=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xa4ba[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0xaa4b('0x0'));var rimraf=require(_0xaa4b('0x1'));var zipdir=require(_0xaa4b('0x2'));var jsonpatch=require(_0xaa4b('0x3'));var rp=require(_0xaa4b('0x4'));var moment=require(_0xaa4b('0x5'));var BPromise=require(_0xaa4b('0x6'));var Mustache=require(_0xaa4b('0x7'));var util=require(_0xaa4b('0x8'));var path=require(_0xaa4b('0x9'));var sox=require(_0xaa4b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa4b('0xb'));var _=require('lodash');var squel=require(_0xaa4b('0xc'));var crypto=require('crypto');var jsforce=require(_0xaa4b('0xd'));var deskjs=require(_0xaa4b('0xe'));var toCsv=require(_0xaa4b('0xf'));var querystring=require(_0xaa4b('0x10'));var Papa=require(_0xaa4b('0x11'));var Redis=require(_0xaa4b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xaa4b('0x13'));var as=require(_0xaa4b('0x14'));var hardwareService=require(_0xaa4b('0x15'));var logger=require('../../config/logger')(_0xaa4b('0x16'));var utils=require(_0xaa4b('0x17'));var config=require(_0xaa4b('0x18'));var licenseUtil=require(_0xaa4b('0x19'));var db=require(_0xaa4b('0x1a'))['db'];function respondWithStatusCode(_0x2b4052,_0x180906){_0x180906=_0x180906||0xcc;return function(_0x2f8248){if(_0x2f8248){return _0x2b4052[_0xaa4b('0x1b')](_0x180906);}return _0x2b4052['status'](_0x180906)[_0xaa4b('0x1c')]();};}function respondWithResult(_0x40dd89,_0x4cf123){_0x4cf123=_0x4cf123||0xc8;return function(_0x20c80f){if(_0x20c80f){return _0x40dd89['status'](_0x4cf123)[_0xaa4b('0x1d')](_0x20c80f);}};}function respondWithFilteredResult(_0xfc24d4,_0x3a8a13){return function(_0x314035){if(_0x314035){var _0x35ae5d=typeof _0x3a8a13[_0xaa4b('0x1e')]==='undefined'&&typeof _0x3a8a13[_0xaa4b('0x1f')]===_0xaa4b('0x20');var _0x1cecfe=_0x314035[_0xaa4b('0x21')];var _0x416f12=_0x35ae5d?0x0:_0x3a8a13['offset'];var _0x346dcc=_0x35ae5d?_0x314035['count']:_0x3a8a13[_0xaa4b('0x1e')]+_0x3a8a13['limit'];var _0x28bc63;if(_0x346dcc>=_0x1cecfe){_0x346dcc=_0x1cecfe;_0x28bc63=0xc8;}else{_0x28bc63=0xce;}_0xfc24d4[_0xaa4b('0x22')](_0x28bc63);return _0xfc24d4[_0xaa4b('0x23')](_0xaa4b('0x24'),_0x416f12+'-'+_0x346dcc+'/'+_0x1cecfe)[_0xaa4b('0x1d')](_0x314035);}return null;};}function patchUpdates(_0x3d6ad6){return function(_0x242aaa){try{jsonpatch[_0xaa4b('0x25')](_0x242aaa,_0x3d6ad6,!![]);}catch(_0x4beadd){return BPromise['reject'](_0x4beadd);}return _0x242aaa[_0xaa4b('0x26')]();};}function saveUpdates(_0x3daf26,_0x39666){return function(_0x4b08f6){if(_0x4b08f6){return _0x4b08f6[_0xaa4b('0x27')](_0x3daf26)[_0xaa4b('0x28')](function(_0x10a768){return _0x10a768;});}return null;};}function removeEntity(_0x186863,_0x20905f){return function(_0x1ec669){if(_0x1ec669){return _0x1ec669[_0xaa4b('0x29')]()[_0xaa4b('0x28')](function(){_0x186863['status'](0xcc)[_0xaa4b('0x1c')]();});}};}function handleEntityNotFound(_0x882460,_0x3ffc21){return function(_0x3f8eb8){if(!_0x3f8eb8){_0x882460[_0xaa4b('0x1b')](0x194);}return _0x3f8eb8;};}function handleError(_0x189573,_0x51f2f9){_0x51f2f9=_0x51f2f9||0x1f4;return function(_0x530397){logger['error'](_0x530397[_0xaa4b('0x2a')]);if(_0x530397[_0xaa4b('0x2b')]){delete _0x530397[_0xaa4b('0x2b')];}_0x189573['status'](_0x51f2f9)[_0xaa4b('0x2c')](_0x530397);};}exports[_0xaa4b('0x2d')]=function(_0x10fe2d,_0x1dca3e){var _0x3a7558={},_0x35c602={},_0x2145e6={'count':0x0,'rows':[]};var _0x2d887b=_[_0xaa4b('0x2e')](db['VoiceMailMessage'][_0xaa4b('0x2f')],function(_0x3a3060){return{'name':_0x3a3060['fieldName'],'type':_0x3a3060[_0xaa4b('0x30')]['key']};});_0x35c602[_0xaa4b('0x31')]=_[_0xaa4b('0x32')](_['map'](_0x2d887b,_0xaa4b('0x2b')),[_0xaa4b('0x2b')]);_0x35c602['query']=_['keys'](_0x10fe2d[_0xaa4b('0x33')]);_0x35c602[_0xaa4b('0x34')]=_['intersection'](_0x35c602[_0xaa4b('0x31')],_0x35c602[_0xaa4b('0x33')]);_0x3a7558['attributes']=_[_0xaa4b('0x35')](_0x35c602[_0xaa4b('0x31')],qs['fields'](_0x10fe2d[_0xaa4b('0x33')][_0xaa4b('0x36')]));_0x3a7558[_0xaa4b('0x37')]=_0x3a7558[_0xaa4b('0x37')]['length']?_0x3a7558['attributes']:_0x35c602[_0xaa4b('0x31')];if(!_0x10fe2d['query']['hasOwnProperty']('nolimit')){_0x3a7558[_0xaa4b('0x1f')]=qs[_0xaa4b('0x1f')](_0x10fe2d['query']['limit']);_0x3a7558[_0xaa4b('0x1e')]=qs[_0xaa4b('0x1e')](_0x10fe2d[_0xaa4b('0x33')][_0xaa4b('0x1e')]);}_0x3a7558[_0xaa4b('0x38')]=qs['sort'](_0x10fe2d[_0xaa4b('0x33')][_0xaa4b('0x39')]);_0x3a7558[_0xaa4b('0x3a')]=qs[_0xaa4b('0x34')](_[_0xaa4b('0x3b')](_0x10fe2d[_0xaa4b('0x33')],_0x35c602[_0xaa4b('0x34')]),_0x2d887b);if(_0x10fe2d[_0xaa4b('0x33')]['filter']){_0x3a7558[_0xaa4b('0x3a')]=_[_0xaa4b('0x3c')](_0x3a7558[_0xaa4b('0x3a')],{'$or':_[_0xaa4b('0x2e')](_0x2d887b,function(_0x310982){if(_0x310982[_0xaa4b('0x30')]!==_0xaa4b('0x3d')){var _0x423ddd={};_0x423ddd[_0x310982['name']]={'$like':'%'+_0x10fe2d[_0xaa4b('0x33')][_0xaa4b('0x3e')]+'%'};return _0x423ddd;}})});}_0x3a7558=_[_0xaa4b('0x3c')]({},_0x3a7558,_0x10fe2d[_0xaa4b('0x3f')]);var _0x890e1={'where':_0x3a7558[_0xaa4b('0x3a')]};return db[_0xaa4b('0x40')]['count'](_0x890e1)[_0xaa4b('0x28')](function(_0x16766a){_0x2145e6[_0xaa4b('0x21')]=_0x16766a;if(_0x10fe2d[_0xaa4b('0x33')][_0xaa4b('0x41')]){_0x3a7558['include']=[{'all':!![]}];}return db[_0xaa4b('0x40')][_0xaa4b('0x42')](_0x3a7558);})['then'](function(_0x2a8933){_0x2145e6[_0xaa4b('0x43')]=_0x2a8933;return _0x2145e6;})[_0xaa4b('0x28')](respondWithFilteredResult(_0x1dca3e,_0x3a7558))['catch'](handleError(_0x1dca3e,null));};exports[_0xaa4b('0x44')]=function(_0x1edfe1,_0x6bf815){var _0x1cd1c={'raw':!![],'where':{'id':_0x1edfe1[_0xaa4b('0x45')]['id']}},_0x417ce6={};_0x417ce6[_0xaa4b('0x31')]=_[_0xaa4b('0x46')](db[_0xaa4b('0x40')][_0xaa4b('0x2f')]);_0x417ce6[_0xaa4b('0x33')]=_[_0xaa4b('0x46')](_0x1edfe1[_0xaa4b('0x33')]);_0x417ce6[_0xaa4b('0x34')]=_[_0xaa4b('0x35')](_0x417ce6['model'],_0x417ce6['query']);_0x1cd1c[_0xaa4b('0x37')]=_[_0xaa4b('0x35')](_0x417ce6[_0xaa4b('0x31')],qs[_0xaa4b('0x36')](_0x1edfe1[_0xaa4b('0x33')][_0xaa4b('0x36')]));_0x1cd1c[_0xaa4b('0x37')]=_0x1cd1c[_0xaa4b('0x37')][_0xaa4b('0x47')]?_0x1cd1c[_0xaa4b('0x37')]:_0x417ce6[_0xaa4b('0x31')];if(_0x1edfe1[_0xaa4b('0x33')][_0xaa4b('0x41')]){_0x1cd1c[_0xaa4b('0x48')]=[{'all':!![]}];}_0x1cd1c=_[_0xaa4b('0x3c')]({},_0x1cd1c,_0x1edfe1[_0xaa4b('0x3f')]);return db['VoiceMailMessage']['find'](_0x1cd1c)[_0xaa4b('0x28')](handleEntityNotFound(_0x6bf815,null))[_0xaa4b('0x28')](respondWithResult(_0x6bf815,null))[_0xaa4b('0x49')](handleError(_0x6bf815,null));};exports[_0xaa4b('0x4a')]=function(_0x2004fa,_0x5ac6fd){return db[_0xaa4b('0x40')][_0xaa4b('0x4a')](_0x2004fa[_0xaa4b('0x4b')],{})['then'](respondWithResult(_0x5ac6fd,0xc9))['catch'](handleError(_0x5ac6fd,null));};exports['update']=function(_0x1b5c86,_0x2cb78a){if(_0x1b5c86[_0xaa4b('0x4b')]['id']){delete _0x1b5c86[_0xaa4b('0x4b')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x1b5c86['params']['id']}})[_0xaa4b('0x28')](handleEntityNotFound(_0x2cb78a,null))[_0xaa4b('0x28')](saveUpdates(_0x1b5c86['body'],null))[_0xaa4b('0x28')](respondWithResult(_0x2cb78a,null))[_0xaa4b('0x49')](handleError(_0x2cb78a,null));};exports[_0xaa4b('0x29')]=function(_0x341b55,_0x391f2e){return db[_0xaa4b('0x40')]['find']({'where':{'id':_0x341b55[_0xaa4b('0x45')]['id']}})[_0xaa4b('0x28')](handleEntityNotFound(_0x391f2e,null))[_0xaa4b('0x28')](removeEntity(_0x391f2e,null))['catch'](handleError(_0x391f2e,null));};exports[_0xaa4b('0x4c')]=function(_0x5dbba4,_0x1cef29,_0x21f10f){return db['VoiceMailMessage'][_0xaa4b('0x4d')]({'where':{'id':_0x5dbba4['params']['id']},'attributes':['id',_0xaa4b('0x4e'),_0xaa4b('0x4f')]})[_0xaa4b('0x28')](handleEntityNotFound(_0x1cef29,null))[_0xaa4b('0x28')](function(_0x5d3d9f){if(_0x5d3d9f){if(!_0x5d3d9f['recording']){throw new db[(_0xaa4b('0x50'))][(_0xaa4b('0x51'))](_0xaa4b('0x52'));}var _0x1a215b={'Content-Type':_0xaa4b('0x53'),'Content-Disposition':_0xaa4b('0x54')};if(_0x5d3d9f[_0xaa4b('0x4f')]){_0x1a215b[_0xaa4b('0x55')]=_0xaa4b('0x56')+_0x5d3d9f[_0xaa4b('0x4f')]+_0xaa4b('0x57');}_0x1cef29[_0xaa4b('0x23')](_0x1a215b);return _0x1cef29['send'](new Buffer(_0x5d3d9f[_0xaa4b('0x4e')]));}})[_0xaa4b('0x49')](handleError(_0x1cef29,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 189931d..2fbef89 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 _0xc0bd=['util','../../config/logger','bluebird','request-promise','rimraf','./voiceMailMessage.attributes','exports','VoiceMailMessage','dir','lodash'];(function(_0xcdc1d7,_0x52a613){var _0x1dea58=function(_0x1e78f4){while(--_0x1e78f4){_0xcdc1d7['push'](_0xcdc1d7['shift']());}};_0x1dea58(++_0x52a613);}(_0xc0bd,0x15d));var _0xdc0b=function(_0x677685,_0x445c95){_0x677685=_0x677685-0x0;var _0x34c52c=_0xc0bd[_0x677685];return _0x34c52c;};'use strict';var _=require(_0xdc0b('0x0'));var util=require(_0xdc0b('0x1'));var logger=require(_0xdc0b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdc0b('0x3'));var rp=require(_0xdc0b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc0b('0x5'));var config=require('../../config/environment');var attributes=require(_0xdc0b('0x6'));module[_0xdc0b('0x7')]=function(_0x199468,_0x1b6182){return _0x199468['define'](_0xdc0b('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xdc0b('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9dcc=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util'];(function(_0x2b9235,_0x34f14e){var _0x17ed9d=function(_0x13c4fa){while(--_0x13c4fa){_0x2b9235['push'](_0x2b9235['shift']());}};_0x17ed9d(++_0x34f14e);}(_0x9dcc,0xfa));var _0xc9dc=function(_0x5a1a5b,_0x1c8fb9){_0x5a1a5b=_0x5a1a5b-0x0;var _0x36eccd=_0x9dcc[_0x5a1a5b];return _0x36eccd;};'use strict';var _=require(_0xc9dc('0x0'));var util=require(_0xc9dc('0x1'));var logger=require(_0xc9dc('0x2'))(_0xc9dc('0x3'));var moment=require(_0xc9dc('0x4'));var BPromise=require(_0xc9dc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9dc('0x6'));var rimraf=require(_0xc9dc('0x7'));var config=require(_0xc9dc('0x8'));var attributes=require(_0xc9dc('0x9'));module[_0xc9dc('0xa')]=function(_0x58a14d,_0xd32739){return _0x58a14d[_0xc9dc('0xb')](_0xc9dc('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xc9dc('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c4527a7..f3aa49d 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 _0x52c8=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util'];(function(_0xfe9f9d,_0x399d13){var _0x4bb558=function(_0x58196b){while(--_0x58196b){_0xfe9f9d['push'](_0xfe9f9d['shift']());}};_0x4bb558(++_0x399d13);}(_0x52c8,0x164));var _0x852c=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x52c8[_0x37ffea];return _0x2e2615;};'use strict';var _=require('lodash');var util=require(_0x852c('0x0'));var moment=require('moment');var BPromise=require(_0x852c('0x1'));var rs=require(_0x852c('0x2'));var fs=require('fs');var Redis=require(_0x852c('0x3'));var db=require(_0x852c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x852c('0x5'));var config=require(_0x852c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x852c('0x7')][_0x852c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13298b,_0xc6aec,_0x92705c){return new BPromise(function(_0x4f4854,_0x2e1ea1){return client[_0x852c('0x9')](_0x13298b,_0x92705c)['then'](function(_0xc32a30){logger[_0x852c('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0xc6aec,_0x852c('0xb'));logger[_0x852c('0xc')](_0x852c('0xd'),_0xc6aec,_0x852c('0xb'),JSON[_0x852c('0xe')](_0xc32a30));if(_0xc32a30[_0x852c('0xf')]){if(_0xc32a30[_0x852c('0xf')][_0x852c('0x10')]===0x1f4){logger['error'](_0x852c('0x11'),_0xc6aec,_0xc32a30[_0x852c('0xf')][_0x852c('0x12')]);return _0x2e1ea1(_0xc32a30[_0x852c('0xf')]['message']);}logger[_0x852c('0xf')](_0x852c('0x11'),_0xc6aec,_0xc32a30[_0x852c('0xf')][_0x852c('0x12')]);return _0x4f4854(_0xc32a30[_0x852c('0xf')]['message']);}else{logger[_0x852c('0xa')](_0x852c('0x11'),_0xc6aec,_0x852c('0xb'));_0x4f4854(_0xc32a30[_0x852c('0x13')][_0x852c('0x12')]);}})[_0x852c('0x14')](function(_0x434a9c){logger[_0x852c('0xf')](_0x852c('0x11'),_0xc6aec,_0x434a9c);_0x2e1ea1(_0x434a9c);});});} \ No newline at end of file +var _0x0308=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0308,0x74));var _0x8030=function(_0x543460,_0x2c3426){_0x543460=_0x543460-0x0;var _0x1a8fc9=_0x0308[_0x543460];return _0x1a8fc9;};'use strict';var _=require(_0x8030('0x0'));var util=require('util');var moment=require(_0x8030('0x1'));var BPromise=require(_0x8030('0x2'));var rs=require(_0x8030('0x3'));var fs=require('fs');var Redis=require(_0x8030('0x4'));var db=require(_0x8030('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8030('0x6'));var config=require(_0x8030('0x7'));var jayson=require(_0x8030('0x8'));var client=jayson[_0x8030('0x9')][_0x8030('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50d168,_0x3e4d20,_0x2bf714){return new BPromise(function(_0x47d0e1,_0x578d84){return client[_0x8030('0xb')](_0x50d168,_0x2bf714)[_0x8030('0xc')](function(_0x4b7ed0){logger['info'](_0x8030('0xd'),_0x3e4d20,_0x8030('0xe'));logger[_0x8030('0xf')](_0x8030('0x10'),_0x3e4d20,'request\x20sent',JSON[_0x8030('0x11')](_0x4b7ed0));if(_0x4b7ed0[_0x8030('0x12')]){if(_0x4b7ed0[_0x8030('0x12')][_0x8030('0x13')]===0x1f4){logger[_0x8030('0x12')](_0x8030('0xd'),_0x3e4d20,_0x4b7ed0['error'][_0x8030('0x14')]);return _0x578d84(_0x4b7ed0[_0x8030('0x12')][_0x8030('0x14')]);}logger[_0x8030('0x12')](_0x8030('0xd'),_0x3e4d20,_0x4b7ed0[_0x8030('0x12')][_0x8030('0x14')]);return _0x47d0e1(_0x4b7ed0[_0x8030('0x12')]['message']);}else{logger[_0x8030('0x15')](_0x8030('0xd'),_0x3e4d20,_0x8030('0xe'));_0x47d0e1(_0x4b7ed0['result']['message']);}})['catch'](function(_0x2c473d){logger[_0x8030('0x12')](_0x8030('0xd'),_0x3e4d20,_0x2c473d);_0x578d84(_0x2c473d);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 69168c8..4227ffc 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 _0x8bed=['Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id/sounds','post','create','/:id','destroy','delete','removeSound','multer','util','path','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bed,0xea));var _0xd8be=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x8bed[_0x5c72ee];return _0x231876;};'use strict';var multer=require(_0xd8be('0x0'));var util=require(_0xd8be('0x1'));var path=require(_0xd8be('0x2'));var timeout=require('connect-timeout');var express=require(_0xd8be('0x3'));var router=express[_0xd8be('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd8be('0x5'));var config=require(_0xd8be('0x6'));var controller=require(_0xd8be('0x7'));router['get']('/',auth[_0xd8be('0x8')](),controller['index']);router[_0xd8be('0x9')]('/:id',auth[_0xd8be('0x8')](),controller['show']);router['get'](_0xd8be('0xa'),auth[_0xd8be('0x8')](),controller['getSounds']);router[_0xd8be('0xb')]('/',auth[_0xd8be('0x8')](),controller[_0xd8be('0xc')]);router[_0xd8be('0xb')]('/:id/sounds',auth[_0xd8be('0x8')](),controller['addSound']);router['put'](_0xd8be('0xd'),auth[_0xd8be('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd8be('0xe')]);router[_0xd8be('0xf')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xd8be('0x10')]);module['exports']=router; \ No newline at end of file +var _0x02c3=['update','delete','/:id','destroy','/:id/sounds/:id2','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sounds','getSounds','post','addSound','put'];(function(_0x3b08f6,_0x287d40){var _0x24dcfc=function(_0x25e57f){while(--_0x25e57f){_0x3b08f6['push'](_0x3b08f6['shift']());}};_0x24dcfc(++_0x287d40);}(_0x02c3,0x8a));var _0x302c=function(_0x2f7bbc,_0x24cedb){_0x2f7bbc=_0x2f7bbc-0x0;var _0x4bd860=_0x02c3[_0x2f7bbc];return _0x4bd860;};'use strict';var multer=require(_0x302c('0x0'));var util=require('util');var path=require(_0x302c('0x1'));var timeout=require(_0x302c('0x2'));var express=require(_0x302c('0x3'));var router=express[_0x302c('0x4')]();var fs_extra=require(_0x302c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x302c('0x6'));var config=require(_0x302c('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x302c('0x8')]('/',auth[_0x302c('0x9')](),controller[_0x302c('0xa')]);router[_0x302c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x302c('0x8')](_0x302c('0xb'),auth[_0x302c('0x9')](),controller[_0x302c('0xc')]);router[_0x302c('0xd')]('/',auth[_0x302c('0x9')](),controller['create']);router[_0x302c('0xd')](_0x302c('0xb'),auth['isAuthenticated'](),controller[_0x302c('0xe')]);router[_0x302c('0xf')]('/:id',auth[_0x302c('0x9')](),controller[_0x302c('0x10')]);router[_0x302c('0x11')](_0x302c('0x12'),auth[_0x302c('0x9')](),controller[_0x302c('0x13')]);router[_0x302c('0x11')](_0x302c('0x14'),auth[_0x302c('0x9')](),controller['removeSound']);module[_0x302c('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index cb7f5ea..f40d067 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 _0x9ae7=['TIMESTAMP','exports','STRING','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','alpha'];(function(_0x10c27f,_0x153e29){var _0x2b9cf2=function(_0x21e081){while(--_0x21e081){_0x10c27f['push'](_0x10c27f['shift']());}};_0x2b9cf2(++_0x153e29);}(_0x9ae7,0x10f));var _0x79ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ae7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x79ae('0x0')]={'name':{'type':Sequelize[_0x79ae('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x79ae('0x2')](_0x79ae('0x3'),_0x79ae('0x4'),_0x79ae('0x5'),_0x79ae('0x6'),_0x79ae('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x79ae('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x79ae('0x1')],'allowNull':!![],'defaultValue':_0x79ae('0x8')},'format':{'type':Sequelize[_0x79ae('0x1')],'allowNull':!![]},'stamp':{'type':_0x79ae('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3da0=['sequelize','STRING','name','custom','quietmp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN'];(function(_0x92462d,_0x3952ad){var _0xbc1e06=function(_0x14dfa4){while(--_0x14dfa4){_0x92462d['push'](_0x92462d['shift']());}};_0xbc1e06(++_0x3952ad);}(_0x3da0,0xb4));var _0x03da=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0x3da0[_0x5a26db];return _0x4619dd;};'use strict';var Sequelize=require(_0x03da('0x0'));module['exports']={'name':{'type':Sequelize[_0x03da('0x1')],'allowNull':![],'unique':_0x03da('0x2')},'mode':{'type':Sequelize['ENUM'](_0x03da('0x3'),'files','mp3nb',_0x03da('0x4'),_0x03da('0x5'),_0x03da('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x03da('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x03da('0x7')},'defaultEntry':{'type':Sequelize[_0x03da('0x8')],'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 f29dc72..1933f82 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 _0x1962=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','type','key','model','map','query','filters','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','intersection','include','options','find','body','create','sequelize','transaction','mode','files','directory','join','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','MusicOnHolds','autoAssociation','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','basename','extname','format','symlinkSync','removeSound','id2','message','getSounds','order','hasOwnProperty'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0x1962,0xda));var _0x2196=function(_0xbf4ddf,_0x66b3cb){_0xbf4ddf=_0xbf4ddf-0x0;var _0x3cb273=_0x1962[_0xbf4ddf];return _0x3cb273;};'use strict';var emlformat=require(_0x2196('0x0'));var rimraf=require(_0x2196('0x1'));var zipdir=require(_0x2196('0x2'));var jsonpatch=require(_0x2196('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2196('0x4'));var Mustache=require(_0x2196('0x5'));var util=require(_0x2196('0x6'));var path=require('path');var sox=require(_0x2196('0x7'));var csv=require(_0x2196('0x8'));var ejs=require(_0x2196('0x9'));var fs=require('fs');var fs_extra=require(_0x2196('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2196('0xb'));var deskjs=require(_0x2196('0xc'));var toCsv=require(_0x2196('0x8'));var querystring=require(_0x2196('0xd'));var Papa=require('papaparse');var Redis=require(_0x2196('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2196('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2196('0x10'));var utils=require(_0x2196('0x11'));var config=require(_0x2196('0x12'));var licenseUtil=require(_0x2196('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb91e1e,_0x35c54d){_0x35c54d=_0x35c54d||0xcc;return function(_0x2beba7){if(_0x2beba7){return _0xb91e1e[_0x2196('0x14')](_0x35c54d);}return _0xb91e1e[_0x2196('0x15')](_0x35c54d)[_0x2196('0x16')]();};}function respondWithResult(_0x2e29bb,_0x20980b){_0x20980b=_0x20980b||0xc8;return function(_0xd63d9a){if(_0xd63d9a){return _0x2e29bb[_0x2196('0x15')](_0x20980b)[_0x2196('0x17')](_0xd63d9a);}};}function respondWithFilteredResult(_0x4dc1f4,_0x276f16){return function(_0x52ca7f){if(_0x52ca7f){var _0x1c10e5=typeof _0x276f16['offset']===_0x2196('0x18')&&typeof _0x276f16['limit']==='undefined';var _0x5c2243=_0x52ca7f[_0x2196('0x19')];var _0x55c2bc=_0x1c10e5?0x0:_0x276f16[_0x2196('0x1a')];var _0x1c29d7=_0x1c10e5?_0x52ca7f[_0x2196('0x19')]:_0x276f16[_0x2196('0x1a')]+_0x276f16[_0x2196('0x1b')];var _0x338621;if(_0x1c29d7>=_0x5c2243){_0x1c29d7=_0x5c2243;_0x338621=0xc8;}else{_0x338621=0xce;}_0x4dc1f4[_0x2196('0x15')](_0x338621);return _0x4dc1f4[_0x2196('0x1c')]('Content-Range',_0x55c2bc+'-'+_0x1c29d7+'/'+_0x5c2243)[_0x2196('0x17')](_0x52ca7f);}return null;};}function patchUpdates(_0x4088e6){return function(_0x573a0f){try{jsonpatch['apply'](_0x573a0f,_0x4088e6,!![]);}catch(_0x10776f){return BPromise[_0x2196('0x1d')](_0x10776f);}return _0x573a0f[_0x2196('0x1e')]();};}function saveUpdates(_0x15e3e4,_0x436008){return function(_0xe022b4){if(_0xe022b4){return _0xe022b4[_0x2196('0x1f')](_0x15e3e4)[_0x2196('0x20')](function(_0x1a1195){return _0x1a1195;});}return null;};}function removeEntity(_0x19c63d,_0x3ff18f){return function(_0x30e8ef){if(_0x30e8ef){return _0x30e8ef[_0x2196('0x21')]()[_0x2196('0x20')](function(){var _0xd60a37=_0x30e8ef[_0x2196('0x22')]({'plain':!![]});var _0x885b2d='MusicOnHolds';return db[_0x2196('0x23')][_0x2196('0x21')]({'where':{'type':_0x885b2d,'resourceId':_0xd60a37['id']}})[_0x2196('0x20')](function(){return _0x30e8ef;});})[_0x2196('0x20')](function(){_0x19c63d[_0x2196('0x15')](0xcc)[_0x2196('0x16')]();});}};}function handleEntityNotFound(_0x125db7,_0x3adf82){return function(_0x2cc398){if(!_0x2cc398){_0x125db7[_0x2196('0x14')](0x194);}return _0x2cc398;};}function handleError(_0x3747c4,_0xa92ae){_0xa92ae=_0xa92ae||0x1f4;return function(_0x12def3){logger[_0x2196('0x24')](_0x12def3[_0x2196('0x25')]);if(_0x12def3[_0x2196('0x26')]){delete _0x12def3['name'];}_0x3747c4['status'](_0xa92ae)[_0x2196('0x27')](_0x12def3);};}exports[_0x2196('0x28')]=function(_0x2dd074,_0x1f49eb){var _0x1c4bbf={},_0x912e79={},_0x385773={'count':0x0,'rows':[]};var _0x2852c1=_['map'](db[_0x2196('0x29')][_0x2196('0x2a')],function(_0x53b542){return{'name':_0x53b542['fieldName'],'type':_0x53b542[_0x2196('0x2b')][_0x2196('0x2c')]};});_0x912e79[_0x2196('0x2d')]=_[_0x2196('0x2e')](_0x2852c1,_0x2196('0x26'));_0x912e79[_0x2196('0x2f')]=_['keys'](_0x2dd074[_0x2196('0x2f')]);_0x912e79[_0x2196('0x30')]=_['intersection'](_0x912e79[_0x2196('0x2d')],_0x912e79[_0x2196('0x2f')]);_0x1c4bbf[_0x2196('0x31')]=_['intersection'](_0x912e79[_0x2196('0x2d')],qs['fields'](_0x2dd074[_0x2196('0x2f')][_0x2196('0x32')]));_0x1c4bbf[_0x2196('0x31')]=_0x1c4bbf[_0x2196('0x31')][_0x2196('0x33')]?_0x1c4bbf[_0x2196('0x31')]:_0x912e79[_0x2196('0x2d')];if(!_0x2dd074[_0x2196('0x2f')]['hasOwnProperty'](_0x2196('0x34'))){_0x1c4bbf[_0x2196('0x1b')]=qs[_0x2196('0x1b')](_0x2dd074[_0x2196('0x2f')][_0x2196('0x1b')]);_0x1c4bbf[_0x2196('0x1a')]=qs[_0x2196('0x1a')](_0x2dd074[_0x2196('0x2f')][_0x2196('0x1a')]);}_0x1c4bbf['order']=qs[_0x2196('0x35')](_0x2dd074[_0x2196('0x2f')][_0x2196('0x35')]);delete _0x2dd074[_0x2196('0x2f')][_0x2196('0x35')];_0x1c4bbf['where']=qs[_0x2196('0x30')](_[_0x2196('0x36')](_0x2dd074[_0x2196('0x2f')],_0x912e79[_0x2196('0x30')]),_0x2852c1);if(_0x2dd074[_0x2196('0x2f')][_0x2196('0x37')]){_0x1c4bbf[_0x2196('0x38')]=_[_0x2196('0x39')](_0x1c4bbf[_0x2196('0x38')],{'$or':_['map'](_0x2852c1,function(_0x1cf9cf){if(_0x1cf9cf[_0x2196('0x2b')]!==_0x2196('0x3a')){var _0xbdf003={};_0xbdf003[_0x1cf9cf[_0x2196('0x26')]]={'$like':'%'+_0x2dd074['query'][_0x2196('0x37')]+'%'};return _0xbdf003;}})});}_0x1c4bbf=_[_0x2196('0x39')]({},_0x1c4bbf,_0x2dd074['options']);var _0x55379a={'where':_0x1c4bbf[_0x2196('0x38')]};return db[_0x2196('0x29')][_0x2196('0x19')](_0x55379a)[_0x2196('0x20')](function(_0x423de7){_0x385773[_0x2196('0x19')]=_0x423de7;if(_0x2dd074['query'][_0x2196('0x3b')]){_0x1c4bbf['include']=[{'all':!![]}];}return db[_0x2196('0x29')][_0x2196('0x3c')](_0x1c4bbf);})[_0x2196('0x20')](function(_0x5c1d26){_0x385773[_0x2196('0x3d')]=_0x5c1d26;return _0x385773;})['then'](respondWithFilteredResult(_0x1f49eb,_0x1c4bbf))[_0x2196('0x3e')](handleError(_0x1f49eb,null));};exports[_0x2196('0x3f')]=function(_0x3cdbc2,_0x5732e7){var _0x5889da={'raw':![],'where':{'id':_0x3cdbc2[_0x2196('0x40')]['id']}},_0x4a5ec9={};_0x4a5ec9[_0x2196('0x2d')]=_['keys'](db[_0x2196('0x29')]['rawAttributes']);_0x4a5ec9[_0x2196('0x2f')]=_[_0x2196('0x41')](_0x3cdbc2['query']);_0x4a5ec9[_0x2196('0x30')]=_[_0x2196('0x42')](_0x4a5ec9[_0x2196('0x2d')],_0x4a5ec9['query']);_0x5889da[_0x2196('0x31')]=_[_0x2196('0x42')](_0x4a5ec9['model'],qs[_0x2196('0x32')](_0x3cdbc2['query'][_0x2196('0x32')]));_0x5889da[_0x2196('0x31')]=_0x5889da[_0x2196('0x31')][_0x2196('0x33')]?_0x5889da[_0x2196('0x31')]:_0x4a5ec9[_0x2196('0x2d')];if(_0x3cdbc2['query'][_0x2196('0x3b')]){_0x5889da[_0x2196('0x43')]=[{'all':!![]}];}_0x5889da=_[_0x2196('0x39')]({},_0x5889da,_0x3cdbc2[_0x2196('0x44')]);return db[_0x2196('0x29')][_0x2196('0x45')](_0x5889da)[_0x2196('0x20')](handleEntityNotFound(_0x5732e7,null))['then'](respondWithResult(_0x5732e7,null))[_0x2196('0x3e')](handleError(_0x5732e7,null));};exports['update']=function(_0xa5cdd5,_0x39733d){if(_0xa5cdd5[_0x2196('0x46')]['id']){delete _0xa5cdd5[_0x2196('0x46')]['id'];}return db[_0x2196('0x29')][_0x2196('0x45')]({'where':{'id':_0xa5cdd5['params']['id']}})[_0x2196('0x20')](handleEntityNotFound(_0x39733d,null))[_0x2196('0x20')](saveUpdates(_0xa5cdd5[_0x2196('0x46')],null))['then'](respondWithResult(_0x39733d,null))[_0x2196('0x3e')](handleError(_0x39733d,null));};exports[_0x2196('0x47')]=function(_0x3d8b73,_0x5a0655,_0x25163e){return db[_0x2196('0x48')][_0x2196('0x49')](function(_0xff3650){if(_0x3d8b73[_0x2196('0x46')][_0x2196('0x4a')]===_0x2196('0x4b')){_0x3d8b73[_0x2196('0x46')][_0x2196('0x4c')]=path[_0x2196('0x4d')](config['root'],_0x2196('0x4e'),_0x3d8b73[_0x2196('0x46')][_0x2196('0x26')]);}return db['VoiceMusicOnHold'][_0x2196('0x47')](_0x3d8b73[_0x2196('0x46')],{'transaction':_0xff3650})['then'](function(_0xfaf935){if(_0x3d8b73[_0x2196('0x46')][_0x2196('0x4a')]===_0x2196('0x4b')){fs[_0x2196('0x4f')](_0xfaf935['directory'],parseInt(_0x2196('0x50'),0x8));}var _0x2ddd56=_0x3d8b73[_0x2196('0x51')][_0x2196('0x22')]({'plain':!![]});if(!_0x2ddd56)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ddd56[_0x2196('0x52')]===_0x2196('0x51')){var _0x2839f7=_0xfaf935[_0x2196('0x22')]({'plain':!![]});return db[_0x2196('0x53')][_0x2196('0x45')]({'where':{'name':_0x2196('0x54'),'userProfileId':_0x2ddd56['userProfileId']},'raw':!![]})[_0x2196('0x20')](function(_0x143864){if(_0x143864&&_0x143864[_0x2196('0x55')]===0x0){return db[_0x2196('0x23')]['create']({'name':_0x2839f7[_0x2196('0x26')],'resourceId':_0x2839f7['id'],'type':_0x143864[_0x2196('0x26')],'sectionId':_0x143864['id']},{})['then'](function(){return _0xfaf935;});}else{return _0xfaf935;}})[_0x2196('0x3e')](function(_0x23b6ea){logger[_0x2196('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23b6ea);});}return _0xfaf935;});})[_0x2196('0x20')](respondWithResult(_0x5a0655,0xc9))[_0x2196('0x3e')](handleError(_0x5a0655,null));};exports['destroy']=function(_0x70fb8d,_0x3a9c71,_0x8df9a9){var _0x3e3f67;return db[_0x2196('0x29')][_0x2196('0x45')]({'where':{'id':_0x70fb8d['params']['id']}})[_0x2196('0x20')](function(_0x1dc134){if(_0x1dc134){return db[_0x2196('0x48')]['transaction'](function(_0x20b6df){return _0x1dc134['destroy']({'transaction':_0x20b6df,'raw':!![]})[_0x2196('0x20')](function(_0x7ffffa){if(_0x7ffffa[_0x2196('0x4c')]){fs['readdirSync'](_0x7ffffa[_0x2196('0x4c')])[_0x2196('0x56')](function(_0x147fbf){fs[_0x2196('0x57')](path[_0x2196('0x4d')](_0x7ffffa[_0x2196('0x4c')],_0x147fbf));});fs[_0x2196('0x58')](_0x7ffffa[_0x2196('0x4c')]);}return _0x7ffffa;});})[_0x2196('0x3e')](function(_0x25bfe6){throw new db[(_0x2196('0x59'))][(_0x2196('0x5a'))](_0x25bfe6['message']);});}})[_0x2196('0x20')](handleEntityNotFound(_0x3a9c71,null))['then'](removeEntity(_0x3a9c71,null))[_0x2196('0x3e')](handleError(_0x3a9c71,null));};exports['addSound']=function(_0x4b46f8,_0x460822,_0x56ae35){return db[_0x2196('0x48')][_0x2196('0x49')](function(_0x4c1b38){var _0x669fdf;return db['VoiceMusicOnHold'][_0x2196('0x45')]({'where':{'id':_0x4b46f8['params']['id']}})[_0x2196('0x20')](function(_0x86851d){if(_0x86851d){_0x669fdf=_0x86851d;return _0x86851d[_0x2196('0x5b')](_0x4b46f8['body']['id'],{'transaction':_0x4c1b38});}})[_0x2196('0x20')](function(_0x493b48){if(_0x493b48){return db[_0x2196('0x5c')][_0x2196('0x5d')]({'where':{'id':_0x4b46f8[_0x2196('0x46')]['id']},'attributes':['id','name',_0x2196('0x5e'),_0x2196('0x5f'),_0x2196('0x60')],'raw':!![]});}})[_0x2196('0x20')](function(_0x137ba8){if(_0x137ba8){var _0x9b7e2e=path[_0x2196('0x4d')](config[_0x2196('0x61')],_0x2196('0x62'),util['format']('%s.%s',path[_0x2196('0x63')](_0x137ba8[_0x2196('0x5e')],path[_0x2196('0x64')](_0x137ba8[_0x2196('0x5e')])),_0x137ba8['converted_format']));var _0x566bf4=path['join'](config[_0x2196('0x61')],_0x2196('0x4e'),_0x669fdf[_0x2196('0x26')],util[_0x2196('0x65')]('%s.%s',_0x137ba8['name'],_0x137ba8['converted_format']));fs[_0x2196('0x66')](_0x9b7e2e,_0x566bf4);return _0x137ba8;}})['catch'](function(_0x8fdb17){throw new db['Sequelize'][(_0x2196('0x5a'))](_0x8fdb17['message']);});})[_0x2196('0x20')](handleEntityNotFound(_0x460822,null))[_0x2196('0x20')](respondWithResult(_0x460822,0xc9))['catch'](handleError(_0x460822,null));};exports[_0x2196('0x67')]=function(_0x253eaa,_0x542a60,_0x5f3b37){return db[_0x2196('0x48')]['transaction'](function(_0x24bdc8){var _0x3696c7;return db[_0x2196('0x29')]['findOne']({'where':{'id':_0x253eaa[_0x2196('0x40')]['id']}})[_0x2196('0x20')](handleEntityNotFound(_0x542a60,null))[_0x2196('0x20')](function(_0x1df6b4){if(_0x1df6b4){_0x3696c7=_0x1df6b4;return _0x1df6b4['removeSound'](_0x253eaa['params'][_0x2196('0x68')]);}})[_0x2196('0x20')](function(_0x404744){if(_0x404744){return db[_0x2196('0x5c')][_0x2196('0x5d')]({'where':{'id':_0x253eaa['params'][_0x2196('0x68')]},'attributes':['id',_0x2196('0x26'),_0x2196('0x5e'),'converted_format',_0x2196('0x60')],'raw':!![]});}})['then'](function(_0x3a97a4){if(_0x3a97a4){fs['unlinkSync'](path[_0x2196('0x4d')](_0x3696c7[_0x2196('0x4c')],util[_0x2196('0x65')]('%s.%s',_0x3a97a4[_0x2196('0x26')],_0x3a97a4[_0x2196('0x5f')])));return _0x3a97a4;}})['catch'](function(_0x156f67){throw new db[(_0x2196('0x59'))]['ValidationError'](_0x156f67[_0x2196('0x69')]);});})[_0x2196('0x20')](handleEntityNotFound(_0x542a60,null))[_0x2196('0x20')](respondWithStatusCode(_0x542a60,0xcc))['catch'](handleError(_0x542a60,null));};exports[_0x2196('0x6a')]=function(_0x11ef88,_0x57baea,_0x13866c){var _0x3b1e26={};var _0x55b17d={};var _0x5551c8;var _0x457b8f;return db[_0x2196('0x29')][_0x2196('0x5d')]({'where':{'id':_0x11ef88[_0x2196('0x40')]['id']}})[_0x2196('0x20')](handleEntityNotFound(_0x57baea,null))[_0x2196('0x20')](function(_0xe481c8){if(_0xe481c8){_0x5551c8=_0xe481c8;_0x55b17d['model']=_[_0x2196('0x41')](db['Sound'][_0x2196('0x2a')]);_0x55b17d[_0x2196('0x2f')]=_[_0x2196('0x41')](_0x11ef88['query']);_0x55b17d[_0x2196('0x30')]=_[_0x2196('0x42')](_0x55b17d[_0x2196('0x2d')],_0x55b17d[_0x2196('0x2f')]);_0x3b1e26['attributes']=_[_0x2196('0x42')](_0x55b17d[_0x2196('0x2d')],qs[_0x2196('0x32')](_0x11ef88[_0x2196('0x2f')][_0x2196('0x32')]));_0x3b1e26[_0x2196('0x31')]=_0x3b1e26['attributes'][_0x2196('0x33')]?_0x3b1e26[_0x2196('0x31')]:_0x55b17d[_0x2196('0x2d')];_0x3b1e26[_0x2196('0x6b')]=qs[_0x2196('0x35')](_0x11ef88[_0x2196('0x2f')]['sort']);_0x3b1e26[_0x2196('0x38')]=qs[_0x2196('0x30')](_[_0x2196('0x36')](_0x11ef88[_0x2196('0x2f')],_0x55b17d[_0x2196('0x30')]));if(_0x11ef88['query'][_0x2196('0x37')]){_0x3b1e26['where']=_[_0x2196('0x39')](_0x3b1e26[_0x2196('0x38')],{'$or':_[_0x2196('0x2e')](_0x3b1e26[_0x2196('0x31')],function(_0x4adb5b){var _0x331a2d={};_0x331a2d[_0x4adb5b]={'$like':'%'+_0x11ef88['query']['filter']+'%'};return _0x331a2d;})});}_0x3b1e26=_[_0x2196('0x39')]({},_0x3b1e26,_0x11ef88[_0x2196('0x44')]);return _0x5551c8[_0x2196('0x6a')](_0x3b1e26);}})[_0x2196('0x20')](function(_0x11b2f9){if(_0x11b2f9){_0x457b8f=_0x11b2f9['length'];if(!_0x11ef88['query'][_0x2196('0x6c')](_0x2196('0x34'))){_0x3b1e26['limit']=qs[_0x2196('0x1b')](_0x11ef88[_0x2196('0x2f')][_0x2196('0x1b')]);_0x3b1e26['offset']=qs['offset'](_0x11ef88[_0x2196('0x2f')][_0x2196('0x1a')]);}return _0x5551c8[_0x2196('0x6a')](_0x3b1e26);}})[_0x2196('0x20')](function(_0xd8db4b){if(_0xd8db4b){return _0xd8db4b?{'count':_0x457b8f,'rows':_0xd8db4b}:null;}})[_0x2196('0x20')](respondWithResult(_0x57baea,null))['catch'](handleError(_0x57baea,null));}; \ No newline at end of file +var _0x439a=['../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','MusicOnHolds','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMusicOnHold','count','include','findAll','rows','show','model','includeAll','find','catch','body','create','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','sequelize','transaction','addSound','Sound','findOne','save_name','converted_format','createdAt','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x22ff18,_0x366f17){var _0x7fc5=function(_0x248aa0){while(--_0x248aa0){_0x22ff18['push'](_0x22ff18['shift']());}};_0x7fc5(++_0x366f17);}(_0x439a,0x144));var _0xa439=function(_0x3a2147,_0x536e69){_0x3a2147=_0x3a2147-0x0;var _0x158499=_0x439a[_0x3a2147];return _0x158499;};'use strict';var emlformat=require(_0xa439('0x0'));var rimraf=require(_0xa439('0x1'));var zipdir=require(_0xa439('0x2'));var jsonpatch=require(_0xa439('0x3'));var rp=require(_0xa439('0x4'));var moment=require(_0xa439('0x5'));var BPromise=require(_0xa439('0x6'));var Mustache=require(_0xa439('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa439('0x8'));var csv=require(_0xa439('0x9'));var ejs=require(_0xa439('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa439('0xb'));var squel=require(_0xa439('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa439('0xd'));var toCsv=require(_0xa439('0x9'));var querystring=require(_0xa439('0xe'));var Papa=require(_0xa439('0xf'));var Redis=require(_0xa439('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa439('0x11'));var logger=require(_0xa439('0x12'))('api');var utils=require(_0xa439('0x13'));var config=require(_0xa439('0x14'));var licenseUtil=require(_0xa439('0x15'));var db=require(_0xa439('0x16'))['db'];function respondWithStatusCode(_0x328c7c,_0x1d0adb){_0x1d0adb=_0x1d0adb||0xcc;return function(_0x50f69f){if(_0x50f69f){return _0x328c7c[_0xa439('0x17')](_0x1d0adb);}return _0x328c7c[_0xa439('0x18')](_0x1d0adb)['end']();};}function respondWithResult(_0xab1dc8,_0x504848){_0x504848=_0x504848||0xc8;return function(_0x4f62e0){if(_0x4f62e0){return _0xab1dc8[_0xa439('0x18')](_0x504848)['json'](_0x4f62e0);}};}function respondWithFilteredResult(_0x155971,_0x4fc534){return function(_0x7c0677){if(_0x7c0677){var _0x560e6e=typeof _0x4fc534['offset']===_0xa439('0x19')&&typeof _0x4fc534[_0xa439('0x1a')]===_0xa439('0x19');var _0x587a50=_0x7c0677['count'];var _0x58aa07=_0x560e6e?0x0:_0x4fc534[_0xa439('0x1b')];var _0x2da9c9=_0x560e6e?_0x7c0677['count']:_0x4fc534[_0xa439('0x1b')]+_0x4fc534[_0xa439('0x1a')];var _0xcbee84;if(_0x2da9c9>=_0x587a50){_0x2da9c9=_0x587a50;_0xcbee84=0xc8;}else{_0xcbee84=0xce;}_0x155971[_0xa439('0x18')](_0xcbee84);return _0x155971[_0xa439('0x1c')](_0xa439('0x1d'),_0x58aa07+'-'+_0x2da9c9+'/'+_0x587a50)[_0xa439('0x1e')](_0x7c0677);}return null;};}function patchUpdates(_0x2e82ad){return function(_0x1b41ca){try{jsonpatch[_0xa439('0x1f')](_0x1b41ca,_0x2e82ad,!![]);}catch(_0x4694e8){return BPromise[_0xa439('0x20')](_0x4694e8);}return _0x1b41ca[_0xa439('0x21')]();};}function saveUpdates(_0x15485a,_0x4064ae){return function(_0x2ea105){if(_0x2ea105){return _0x2ea105[_0xa439('0x22')](_0x15485a)[_0xa439('0x23')](function(_0x2d3de1){return _0x2d3de1;});}return null;};}function removeEntity(_0x112c84,_0x43c3c8){return function(_0x3c86a5){if(_0x3c86a5){return _0x3c86a5[_0xa439('0x24')]()[_0xa439('0x23')](function(){var _0x2f65ab=_0x3c86a5['get']({'plain':!![]});var _0x5493bf=_0xa439('0x25');return db['UserProfileResource'][_0xa439('0x24')]({'where':{'type':_0x5493bf,'resourceId':_0x2f65ab['id']}})[_0xa439('0x23')](function(){return _0x3c86a5;});})[_0xa439('0x23')](function(){_0x112c84['status'](0xcc)[_0xa439('0x26')]();});}};}function handleEntityNotFound(_0x22eee8,_0x26d975){return function(_0x10f2af){if(!_0x10f2af){_0x22eee8[_0xa439('0x17')](0x194);}return _0x10f2af;};}function handleError(_0x1c5ea6,_0xf99650){_0xf99650=_0xf99650||0x1f4;return function(_0x44fc78){logger[_0xa439('0x27')](_0x44fc78[_0xa439('0x28')]);if(_0x44fc78[_0xa439('0x29')]){delete _0x44fc78[_0xa439('0x29')];}_0x1c5ea6[_0xa439('0x18')](_0xf99650)['send'](_0x44fc78);};}exports[_0xa439('0x2a')]=function(_0x4484a9,_0x3f6fc2){var _0x21e120={},_0x1a2988={},_0xb3fff6={'count':0x0,'rows':[]};var _0x428bf7=_[_0xa439('0x2b')](db['VoiceMusicOnHold'][_0xa439('0x2c')],function(_0x8f1e42){return{'name':_0x8f1e42[_0xa439('0x2d')],'type':_0x8f1e42[_0xa439('0x2e')][_0xa439('0x2f')]};});_0x1a2988['model']=_['map'](_0x428bf7,'name');_0x1a2988[_0xa439('0x30')]=_[_0xa439('0x31')](_0x4484a9['query']);_0x1a2988[_0xa439('0x32')]=_[_0xa439('0x33')](_0x1a2988['model'],_0x1a2988[_0xa439('0x30')]);_0x21e120[_0xa439('0x34')]=_[_0xa439('0x33')](_0x1a2988['model'],qs['fields'](_0x4484a9[_0xa439('0x30')][_0xa439('0x35')]));_0x21e120[_0xa439('0x34')]=_0x21e120[_0xa439('0x34')][_0xa439('0x36')]?_0x21e120[_0xa439('0x34')]:_0x1a2988['model'];if(!_0x4484a9[_0xa439('0x30')][_0xa439('0x37')](_0xa439('0x38'))){_0x21e120['limit']=qs[_0xa439('0x1a')](_0x4484a9[_0xa439('0x30')]['limit']);_0x21e120['offset']=qs['offset'](_0x4484a9['query']['offset']);}_0x21e120[_0xa439('0x39')]=qs['sort'](_0x4484a9[_0xa439('0x30')]['sort']);delete _0x4484a9[_0xa439('0x30')][_0xa439('0x3a')];_0x21e120[_0xa439('0x3b')]=qs[_0xa439('0x32')](_[_0xa439('0x3c')](_0x4484a9[_0xa439('0x30')],_0x1a2988[_0xa439('0x32')]),_0x428bf7);if(_0x4484a9[_0xa439('0x30')]['filter']){_0x21e120[_0xa439('0x3b')]=_[_0xa439('0x3d')](_0x21e120[_0xa439('0x3b')],{'$or':_[_0xa439('0x2b')](_0x428bf7,function(_0x5978f5){if(_0x5978f5[_0xa439('0x2e')]!==_0xa439('0x3e')){var _0x3b6156={};_0x3b6156[_0x5978f5[_0xa439('0x29')]]={'$like':'%'+_0x4484a9['query'][_0xa439('0x3f')]+'%'};return _0x3b6156;}})});}_0x21e120=_['merge']({},_0x21e120,_0x4484a9[_0xa439('0x40')]);var _0x1c3df3={'where':_0x21e120['where']};return db[_0xa439('0x41')][_0xa439('0x42')](_0x1c3df3)[_0xa439('0x23')](function(_0x36b5ca){_0xb3fff6['count']=_0x36b5ca;if(_0x4484a9[_0xa439('0x30')]['includeAll']){_0x21e120[_0xa439('0x43')]=[{'all':!![]}];}return db[_0xa439('0x41')][_0xa439('0x44')](_0x21e120);})['then'](function(_0x3b6a44){_0xb3fff6[_0xa439('0x45')]=_0x3b6a44;return _0xb3fff6;})[_0xa439('0x23')](respondWithFilteredResult(_0x3f6fc2,_0x21e120))['catch'](handleError(_0x3f6fc2,null));};exports[_0xa439('0x46')]=function(_0x1ece24,_0x4bf8b6){var _0x3f4ef5={'raw':![],'where':{'id':_0x1ece24['params']['id']}},_0x40f26f={};_0x40f26f[_0xa439('0x47')]=_[_0xa439('0x31')](db[_0xa439('0x41')][_0xa439('0x2c')]);_0x40f26f[_0xa439('0x30')]=_[_0xa439('0x31')](_0x1ece24[_0xa439('0x30')]);_0x40f26f['filters']=_[_0xa439('0x33')](_0x40f26f[_0xa439('0x47')],_0x40f26f[_0xa439('0x30')]);_0x3f4ef5[_0xa439('0x34')]=_['intersection'](_0x40f26f['model'],qs[_0xa439('0x35')](_0x1ece24[_0xa439('0x30')][_0xa439('0x35')]));_0x3f4ef5[_0xa439('0x34')]=_0x3f4ef5[_0xa439('0x34')]['length']?_0x3f4ef5['attributes']:_0x40f26f[_0xa439('0x47')];if(_0x1ece24[_0xa439('0x30')][_0xa439('0x48')]){_0x3f4ef5[_0xa439('0x43')]=[{'all':!![]}];}_0x3f4ef5=_[_0xa439('0x3d')]({},_0x3f4ef5,_0x1ece24[_0xa439('0x40')]);return db[_0xa439('0x41')][_0xa439('0x49')](_0x3f4ef5)['then'](handleEntityNotFound(_0x4bf8b6,null))[_0xa439('0x23')](respondWithResult(_0x4bf8b6,null))[_0xa439('0x4a')](handleError(_0x4bf8b6,null));};exports[_0xa439('0x22')]=function(_0x474479,_0x3ed2a2){if(_0x474479[_0xa439('0x4b')]['id']){delete _0x474479[_0xa439('0x4b')]['id'];}return db[_0xa439('0x41')][_0xa439('0x49')]({'where':{'id':_0x474479['params']['id']}})[_0xa439('0x23')](handleEntityNotFound(_0x3ed2a2,null))[_0xa439('0x23')](saveUpdates(_0x474479['body'],null))[_0xa439('0x23')](respondWithResult(_0x3ed2a2,null))['catch'](handleError(_0x3ed2a2,null));};exports[_0xa439('0x4c')]=function(_0x4b5bc1,_0x1c38be,_0xd79c61){return db['sequelize']['transaction'](function(_0x5a108a){if(_0x4b5bc1[_0xa439('0x4b')][_0xa439('0x4d')]===_0xa439('0x4e')){_0x4b5bc1[_0xa439('0x4b')][_0xa439('0x4f')]=path[_0xa439('0x50')](config[_0xa439('0x51')],_0xa439('0x52'),_0x4b5bc1[_0xa439('0x4b')][_0xa439('0x29')]);}return db[_0xa439('0x41')][_0xa439('0x4c')](_0x4b5bc1[_0xa439('0x4b')],{'transaction':_0x5a108a})[_0xa439('0x23')](function(_0x2024e0){if(_0x4b5bc1[_0xa439('0x4b')]['mode']==='files'){fs[_0xa439('0x53')](_0x2024e0[_0xa439('0x4f')],parseInt(_0xa439('0x54'),0x8));}var _0x277e0d=_0x4b5bc1['user'][_0xa439('0x55')]({'plain':!![]});if(!_0x277e0d)throw new Error(_0xa439('0x56'));if(_0x277e0d['role']===_0xa439('0x57')){var _0x150a66=_0x2024e0[_0xa439('0x55')]({'plain':!![]});return db[_0xa439('0x58')][_0xa439('0x49')]({'where':{'name':_0xa439('0x25'),'userProfileId':_0x277e0d[_0xa439('0x59')]},'raw':!![]})[_0xa439('0x23')](function(_0x33340b){if(_0x33340b&&_0x33340b[_0xa439('0x5a')]===0x0){return db[_0xa439('0x5b')]['create']({'name':_0x150a66['name'],'resourceId':_0x150a66['id'],'type':_0x33340b[_0xa439('0x29')],'sectionId':_0x33340b['id']},{})[_0xa439('0x23')](function(){return _0x2024e0;});}else{return _0x2024e0;}})[_0xa439('0x4a')](function(_0x5564c4){logger['error'](_0xa439('0x5c'),_0x5564c4);});}return _0x2024e0;});})['then'](respondWithResult(_0x1c38be,0xc9))[_0xa439('0x4a')](handleError(_0x1c38be,null));};exports[_0xa439('0x24')]=function(_0x53ee0b,_0x17dd41,_0x35cf0f){var _0x49d8e3;return db[_0xa439('0x41')]['find']({'where':{'id':_0x53ee0b[_0xa439('0x5d')]['id']}})['then'](function(_0x1f730d){if(_0x1f730d){return db['sequelize']['transaction'](function(_0x1c97b0){return _0x1f730d['destroy']({'transaction':_0x1c97b0,'raw':!![]})[_0xa439('0x23')](function(_0x129437){if(_0x129437[_0xa439('0x4f')]){fs['readdirSync'](_0x129437[_0xa439('0x4f')])[_0xa439('0x5e')](function(_0x4db95a){fs[_0xa439('0x5f')](path[_0xa439('0x50')](_0x129437['directory'],_0x4db95a));});fs[_0xa439('0x60')](_0x129437[_0xa439('0x4f')]);}return _0x129437;});})[_0xa439('0x4a')](function(_0x3de850){throw new db[(_0xa439('0x61'))][(_0xa439('0x62'))](_0x3de850[_0xa439('0x63')]);});}})[_0xa439('0x23')](handleEntityNotFound(_0x17dd41,null))['then'](removeEntity(_0x17dd41,null))[_0xa439('0x4a')](handleError(_0x17dd41,null));};exports['addSound']=function(_0x45c322,_0x499e51,_0xc8f28b){return db[_0xa439('0x64')][_0xa439('0x65')](function(_0x204fce){var _0x2417a9;return db[_0xa439('0x41')]['find']({'where':{'id':_0x45c322[_0xa439('0x5d')]['id']}})['then'](function(_0x104752){if(_0x104752){_0x2417a9=_0x104752;return _0x104752[_0xa439('0x66')](_0x45c322[_0xa439('0x4b')]['id'],{'transaction':_0x204fce});}})['then'](function(_0x239466){if(_0x239466){return db[_0xa439('0x67')][_0xa439('0x68')]({'where':{'id':_0x45c322['body']['id']},'attributes':['id',_0xa439('0x29'),_0xa439('0x69'),_0xa439('0x6a'),_0xa439('0x6b')],'raw':!![]});}})[_0xa439('0x23')](function(_0x149bb1){if(_0x149bb1){var _0x2b748b=path[_0xa439('0x50')](config[_0xa439('0x51')],'server/files/sounds/converted',util['format'](_0xa439('0x6c'),path[_0xa439('0x6d')](_0x149bb1['save_name'],path[_0xa439('0x6e')](_0x149bb1[_0xa439('0x69')])),_0x149bb1['converted_format']));var _0x3fb425=path[_0xa439('0x50')](config[_0xa439('0x51')],_0xa439('0x52'),_0x2417a9['name'],util['format'](_0xa439('0x6c'),_0x149bb1[_0xa439('0x29')],_0x149bb1[_0xa439('0x6a')]));fs[_0xa439('0x6f')](_0x2b748b,_0x3fb425);return _0x149bb1;}})[_0xa439('0x4a')](function(_0x4a2575){throw new db['Sequelize'][(_0xa439('0x62'))](_0x4a2575[_0xa439('0x63')]);});})[_0xa439('0x23')](handleEntityNotFound(_0x499e51,null))[_0xa439('0x23')](respondWithResult(_0x499e51,0xc9))['catch'](handleError(_0x499e51,null));};exports['removeSound']=function(_0x3f3439,_0x373bd5,_0x1c3bcc){return db[_0xa439('0x64')]['transaction'](function(_0x1877cb){var _0x25cef3;return db[_0xa439('0x41')][_0xa439('0x68')]({'where':{'id':_0x3f3439[_0xa439('0x5d')]['id']}})[_0xa439('0x23')](handleEntityNotFound(_0x373bd5,null))[_0xa439('0x23')](function(_0x55a921){if(_0x55a921){_0x25cef3=_0x55a921;return _0x55a921[_0xa439('0x70')](_0x3f3439[_0xa439('0x5d')][_0xa439('0x71')]);}})['then'](function(_0x368200){if(_0x368200){return db[_0xa439('0x67')][_0xa439('0x68')]({'where':{'id':_0x3f3439['params'][_0xa439('0x71')]},'attributes':['id',_0xa439('0x29'),_0xa439('0x69'),_0xa439('0x6a'),'createdAt'],'raw':!![]});}})['then'](function(_0x250b9d){if(_0x250b9d){fs[_0xa439('0x5f')](path['join'](_0x25cef3[_0xa439('0x4f')],util['format'](_0xa439('0x6c'),_0x250b9d['name'],_0x250b9d['converted_format'])));return _0x250b9d;}})['catch'](function(_0x8627c9){throw new db[(_0xa439('0x61'))][(_0xa439('0x62'))](_0x8627c9[_0xa439('0x63')]);});})['then'](handleEntityNotFound(_0x373bd5,null))[_0xa439('0x23')](respondWithStatusCode(_0x373bd5,0xcc))[_0xa439('0x4a')](handleError(_0x373bd5,null));};exports[_0xa439('0x72')]=function(_0x4bc28d,_0x145117,_0x50503f){var _0x4ff572={};var _0x4c9994={};var _0x36cb87;var _0x5b85f7;return db[_0xa439('0x41')][_0xa439('0x68')]({'where':{'id':_0x4bc28d[_0xa439('0x5d')]['id']}})['then'](handleEntityNotFound(_0x145117,null))[_0xa439('0x23')](function(_0x5a795d){if(_0x5a795d){_0x36cb87=_0x5a795d;_0x4c9994[_0xa439('0x47')]=_[_0xa439('0x31')](db[_0xa439('0x67')][_0xa439('0x2c')]);_0x4c9994[_0xa439('0x30')]=_[_0xa439('0x31')](_0x4bc28d['query']);_0x4c9994[_0xa439('0x32')]=_['intersection'](_0x4c9994[_0xa439('0x47')],_0x4c9994[_0xa439('0x30')]);_0x4ff572[_0xa439('0x34')]=_['intersection'](_0x4c9994[_0xa439('0x47')],qs[_0xa439('0x35')](_0x4bc28d[_0xa439('0x30')][_0xa439('0x35')]));_0x4ff572[_0xa439('0x34')]=_0x4ff572[_0xa439('0x34')][_0xa439('0x36')]?_0x4ff572[_0xa439('0x34')]:_0x4c9994['model'];_0x4ff572[_0xa439('0x39')]=qs[_0xa439('0x3a')](_0x4bc28d[_0xa439('0x30')][_0xa439('0x3a')]);_0x4ff572['where']=qs[_0xa439('0x32')](_[_0xa439('0x3c')](_0x4bc28d[_0xa439('0x30')],_0x4c9994[_0xa439('0x32')]));if(_0x4bc28d[_0xa439('0x30')][_0xa439('0x3f')]){_0x4ff572[_0xa439('0x3b')]=_[_0xa439('0x3d')](_0x4ff572[_0xa439('0x3b')],{'$or':_[_0xa439('0x2b')](_0x4ff572[_0xa439('0x34')],function(_0x2dbdee){var _0x348601={};_0x348601[_0x2dbdee]={'$like':'%'+_0x4bc28d[_0xa439('0x30')][_0xa439('0x3f')]+'%'};return _0x348601;})});}_0x4ff572=_[_0xa439('0x3d')]({},_0x4ff572,_0x4bc28d[_0xa439('0x40')]);return _0x36cb87['getSounds'](_0x4ff572);}})[_0xa439('0x23')](function(_0x2b32f2){if(_0x2b32f2){_0x5b85f7=_0x2b32f2[_0xa439('0x36')];if(!_0x4bc28d[_0xa439('0x30')]['hasOwnProperty'](_0xa439('0x38'))){_0x4ff572[_0xa439('0x1a')]=qs[_0xa439('0x1a')](_0x4bc28d[_0xa439('0x30')][_0xa439('0x1a')]);_0x4ff572[_0xa439('0x1b')]=qs[_0xa439('0x1b')](_0x4bc28d[_0xa439('0x30')][_0xa439('0x1b')]);}return _0x36cb87[_0xa439('0x72')](_0x4ff572);}})[_0xa439('0x23')](function(_0x476191){if(_0x476191){return _0x476191?{'count':_0x5b85f7,'rows':_0x476191}:null;}})[_0xa439('0x23')](respondWithResult(_0x145117,null))[_0xa439('0x4a')](handleError(_0x145117,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d9fc0e7..e47366e 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 _0xb941=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','api','moment','bluebird','path'];(function(_0x4c9024,_0x32d1c4){var _0x378664=function(_0x56dfa9){while(--_0x56dfa9){_0x4c9024['push'](_0x4c9024['shift']());}};_0x378664(++_0x32d1c4);}(_0xb941,0x176));var _0x1b94=function(_0x5a94e3,_0x40cca5){_0x5a94e3=_0x5a94e3-0x0;var _0x4c798a=_0xb941[_0x5a94e3];return _0x4c798a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1b94('0x0'));var moment=require(_0x1b94('0x1'));var BPromise=require(_0x1b94('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b94('0x3'));var rimraf=require('rimraf');var config=require(_0x1b94('0x4'));var attributes=require(_0x1b94('0x5'));module[_0x1b94('0x6')]=function(_0x12baa2,_0x4440d5){return _0x12baa2[_0x1b94('0x7')]('VoiceMusicOnHold',attributes,{'tableName':_0x1b94('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x483b=['voice_musiconhold','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0x483b,0x140));var _0xb483=function(_0x45618b,_0x4197c2){_0x45618b=_0x45618b-0x0;var _0x1f0a89=_0x483b[_0x45618b];return _0x1f0a89;};'use strict';var _=require('lodash');var util=require(_0xb483('0x0'));var logger=require(_0xb483('0x1'))(_0xb483('0x2'));var moment=require(_0xb483('0x3'));var BPromise=require('bluebird');var rp=require(_0xb483('0x4'));var fs=require('fs');var path=require(_0xb483('0x5'));var rimraf=require(_0xb483('0x6'));var config=require(_0xb483('0x7'));var attributes=require(_0xb483('0x8'));module['exports']=function(_0x139314,_0x268c2f){return _0x139314[_0xb483('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0xb483('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 7b72071..a1d0745 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3c5bda,_0x1800ff){var _0x1e56e9=function(_0x46784){while(--_0x46784){_0x3c5bda['push'](_0x3c5bda['shift']());}};_0x1e56e9(++_0x1800ff);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0xb38baa,_0x571c29){var _0x5e7717=function(_0x478f7c){while(--_0x478f7c){_0xb38baa['push'](_0xb38baa['shift']());}};_0x5e7717(++_0x571c29);}(_0xedd9,0xfc));var _0x9edd=function(_0x43171f,_0x43b445){_0x43171f=_0x43171f-0x0;var _0x1dcd07=_0xedd9[_0x43171f];return _0x1dcd07;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index fd9208e..beec4fc 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 _0xbb05=['/:id','show','/:id/users','getAgents','/:id/teams','post','addAgents','addTeams','put','update','delete','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./voicePrefix.controller','index','get','/describe','isAuthenticated'];(function(_0x135ced,_0x28d6f9){var _0x58edea=function(_0x35c956){while(--_0x35c956){_0x135ced['push'](_0x135ced['shift']());}};_0x58edea(++_0x28d6f9);}(_0xbb05,0x1b6));var _0x5bb0=function(_0x3360b0,_0x37fceb){_0x3360b0=_0x3360b0-0x0;var _0x207b55=_0xbb05[_0x3360b0];return _0x207b55;};'use strict';var multer=require(_0x5bb0('0x0'));var util=require(_0x5bb0('0x1'));var path=require(_0x5bb0('0x2'));var timeout=require('connect-timeout');var express=require(_0x5bb0('0x3'));var router=express[_0x5bb0('0x4')]();var fs_extra=require(_0x5bb0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5bb0('0x6'));var controller=require(_0x5bb0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5bb0('0x8')]);router[_0x5bb0('0x9')](_0x5bb0('0xa'),auth[_0x5bb0('0xb')](),controller['describe']);router['get'](_0x5bb0('0xc'),auth[_0x5bb0('0xb')](),controller[_0x5bb0('0xd')]);router[_0x5bb0('0x9')](_0x5bb0('0xe'),auth['isAuthenticated'](),controller[_0x5bb0('0xf')]);router['get'](_0x5bb0('0x10'),auth[_0x5bb0('0xb')](),controller['getTeams']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5bb0('0x11')](_0x5bb0('0xe'),auth[_0x5bb0('0xb')](),controller[_0x5bb0('0x12')]);router[_0x5bb0('0x11')](_0x5bb0('0x10'),auth[_0x5bb0('0xb')](),controller[_0x5bb0('0x13')]);router[_0x5bb0('0x14')](_0x5bb0('0xc'),auth[_0x5bb0('0xb')](),controller[_0x5bb0('0x15')]);router[_0x5bb0('0x16')](_0x5bb0('0xc'),auth[_0x5bb0('0xb')](),controller['destroy']);router[_0x5bb0('0x16')](_0x5bb0('0xe'),auth[_0x5bb0('0xb')](),controller[_0x5bb0('0x17')]);router[_0x5bb0('0x16')]('/:id/teams',auth[_0x5bb0('0xb')](),controller['removeTeams']);module[_0x5bb0('0x18')]=router; \ No newline at end of file +var _0x72a2=['update','delete','removeTeams','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','show','/:id/users','getAgents','getTeams','post','create','addAgents','/:id/teams','addTeams','put'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x72a2,0x161));var _0x272a=function(_0x35bb68,_0x511028){_0x35bb68=_0x35bb68-0x0;var _0x20fc42=_0x72a2[_0x35bb68];return _0x20fc42;};'use strict';var multer=require('multer');var util=require(_0x272a('0x0'));var path=require(_0x272a('0x1'));var timeout=require(_0x272a('0x2'));var express=require(_0x272a('0x3'));var router=express[_0x272a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x272a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x272a('0x6'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x272a('0x7')]);router[_0x272a('0x8')](_0x272a('0x9'),auth[_0x272a('0xa')](),controller['describe']);router['get'](_0x272a('0xb'),auth['isAuthenticated'](),controller[_0x272a('0xc')]);router['get'](_0x272a('0xd'),auth[_0x272a('0xa')](),controller[_0x272a('0xe')]);router[_0x272a('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x272a('0xf')]);router[_0x272a('0x10')]('/',auth['isAuthenticated'](),controller[_0x272a('0x11')]);router[_0x272a('0x10')](_0x272a('0xd'),auth[_0x272a('0xa')](),controller[_0x272a('0x12')]);router['post'](_0x272a('0x13'),auth[_0x272a('0xa')](),controller[_0x272a('0x14')]);router[_0x272a('0x15')]('/:id',auth[_0x272a('0xa')](),controller[_0x272a('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/users',auth[_0x272a('0xa')](),controller['removeAgents']);router[_0x272a('0x17')](_0x272a('0x13'),auth[_0x272a('0xa')](),controller[_0x272a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 9183dd5..127dd53 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 _0x1129=['sequelize','exports','STRING','name','VIRTUAL','system-','INTEGER'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x1129,0x188));var _0x9112=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1129[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x9112('0x0'));module[_0x9112('0x1')]={'name':{'type':Sequelize[_0x9112('0x2')],'allowNull':![],'unique':_0x9112('0x3')},'prefix':{'type':Sequelize[_0x9112('0x4')],'get':function(_0x4d76d6){return _0x9112('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x9112('0x2')]},'callerIdAll':{'type':Sequelize[_0x9112('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x9112('0x6')]}}; \ No newline at end of file +var _0xd5ad=['INTEGER','sequelize','STRING','system-','getDataValue','name'];(function(_0x29e6e1,_0x5dce92){var _0xf15909=function(_0x1a824d){while(--_0x1a824d){_0x29e6e1['push'](_0x29e6e1['shift']());}};_0xf15909(++_0x5dce92);}(_0xd5ad,0x1e1));var _0xdd5a=function(_0x3cc19e,_0x4c3a2e){_0x3cc19e=_0x3cc19e-0x0;var _0x2c772a=_0xd5ad[_0x3cc19e];return _0x2c772a;};'use strict';var Sequelize=require(_0xdd5a('0x0'));module['exports']={'name':{'type':Sequelize[_0xdd5a('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2d6ea9){return _0xdd5a('0x2')+this[_0xdd5a('0x3')](_0xdd5a('0x4'))+'-';}},'description':{'type':Sequelize[_0xdd5a('0x1')]},'callerIdAll':{'type':Sequelize[_0xdd5a('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xdd5a('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 58bbb81..dc5ab81 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 _0x373d=['team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voicePrefix.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','describe','create','sequelize','transaction','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','omit','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','userVoicePrefix:save','field','tq.TeamId','from'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x373d,0x1e2));var _0xd373=function(_0x6acde0,_0x497054){_0x6acde0=_0x6acde0-0x0;var _0x112c59=_0x373d[_0x6acde0];return _0x112c59;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xd373('0x15')],{'host':_0xd373('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd373('0x15')]));require(_0xd373('0x17'))[_0xd373('0x18')](socket);function respondWithStatusCode(_0x23ed86,_0x28b2bf){_0x28b2bf=_0x28b2bf||0xcc;return function(_0x1a9df9){if(_0x1a9df9){return _0x23ed86[_0xd373('0x19')](_0x28b2bf);}return _0x23ed86[_0xd373('0x1a')](_0x28b2bf)[_0xd373('0x1b')]();};}function respondWithResult(_0x2c5854,_0x3a5316){_0x3a5316=_0x3a5316||0xc8;return function(_0x263ae3){if(_0x263ae3){return _0x2c5854[_0xd373('0x1a')](_0x3a5316)['json'](_0x263ae3);}};}function respondWithFilteredResult(_0x1e26cf,_0x5eab00){return function(_0x460259){if(_0x460259){var _0x36d47a=typeof _0x5eab00['offset']===_0xd373('0x1c')&&typeof _0x5eab00['limit']==='undefined';var _0x23fada=_0x460259[_0xd373('0x1d')];var _0x167597=_0x36d47a?0x0:_0x5eab00[_0xd373('0x1e')];var _0x16b147=_0x36d47a?_0x460259[_0xd373('0x1d')]:_0x5eab00['offset']+_0x5eab00[_0xd373('0x1f')];var _0xd808f8;if(_0x16b147>=_0x23fada){_0x16b147=_0x23fada;_0xd808f8=0xc8;}else{_0xd808f8=0xce;}_0x1e26cf[_0xd373('0x1a')](_0xd808f8);return _0x1e26cf[_0xd373('0x20')](_0xd373('0x21'),_0x167597+'-'+_0x16b147+'/'+_0x23fada)[_0xd373('0x22')](_0x460259);}return null;};}function patchUpdates(_0x4f64bd){return function(_0x355fca){try{jsonpatch[_0xd373('0x23')](_0x355fca,_0x4f64bd,!![]);}catch(_0x157f81){return BPromise[_0xd373('0x24')](_0x157f81);}return _0x355fca[_0xd373('0x25')]();};}function saveUpdates(_0x238ffd,_0x466a03){return function(_0x109e4c){if(_0x109e4c){return _0x109e4c[_0xd373('0x26')](_0x238ffd)[_0xd373('0x27')](function(_0x437110){return _0x437110;});}return null;};}function removeEntity(_0x34f05a,_0x388182){return function(_0x420a30){if(_0x420a30){return _0x420a30[_0xd373('0x28')]()[_0xd373('0x27')](function(){var _0x50b987=_0x420a30[_0xd373('0x29')]({'plain':!![]});var _0x3e657b=_0xd373('0x2a');return db[_0xd373('0x2b')][_0xd373('0x28')]({'where':{'type':_0x3e657b,'resourceId':_0x50b987['id']}})[_0xd373('0x27')](function(){return _0x420a30;});})[_0xd373('0x27')](function(){_0x34f05a[_0xd373('0x1a')](0xcc)[_0xd373('0x1b')]();});}};}function handleEntityNotFound(_0x158825,_0xbc420b){return function(_0x2ee37c){if(!_0x2ee37c){_0x158825[_0xd373('0x19')](0x194);}return _0x2ee37c;};}function handleError(_0x5287e7,_0x7ca56e){_0x7ca56e=_0x7ca56e||0x1f4;return function(_0x490842){logger['error'](_0x490842[_0xd373('0x2c')]);if(_0x490842[_0xd373('0x2d')]){delete _0x490842[_0xd373('0x2d')];}_0x5287e7[_0xd373('0x1a')](_0x7ca56e)[_0xd373('0x2e')](_0x490842);};}exports['index']=function(_0x6659f6,_0x104156){var _0x4e17c9={},_0x102c3a={},_0x8e4884={'count':0x0,'rows':[]};var _0x146e24=_[_0xd373('0x2f')](db[_0xd373('0x30')][_0xd373('0x31')],function(_0x364c01){return{'name':_0x364c01[_0xd373('0x32')],'type':_0x364c01[_0xd373('0x33')]['key']};});_0x102c3a[_0xd373('0x34')]=_[_0xd373('0x2f')](_0x146e24,_0xd373('0x2d'));_0x102c3a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x6659f6[_0xd373('0x35')]);_0x102c3a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],_0x102c3a[_0xd373('0x35')]);_0x4e17c9[_0xd373('0x39')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x6659f6[_0xd373('0x35')]['fields']));_0x4e17c9[_0xd373('0x39')]=_0x4e17c9[_0xd373('0x39')][_0xd373('0x3b')]?_0x4e17c9[_0xd373('0x39')]:_0x102c3a['model'];if(!_0x6659f6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x4e17c9[_0xd373('0x1f')]=qs[_0xd373('0x1f')](_0x6659f6[_0xd373('0x35')]['limit']);_0x4e17c9['offset']=qs[_0xd373('0x1e')](_0x6659f6['query'][_0xd373('0x1e')]);}_0x4e17c9[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x6659f6['query'][_0xd373('0x3f')]);_0x4e17c9[_0xd373('0x40')]=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0x6659f6['query'],_0x102c3a['filters']),_0x146e24);if(_0x6659f6['query'][_0xd373('0x42')]){_0x4e17c9['where']=_[_0xd373('0x43')](_0x4e17c9[_0xd373('0x40')],{'$or':_['map'](_0x146e24,function(_0x4e8734){if(_0x4e8734['type']!==_0xd373('0x44')){var _0x43a4b8={};_0x43a4b8[_0x4e8734[_0xd373('0x2d')]]={'$like':'%'+_0x6659f6['query']['filter']+'%'};return _0x43a4b8;}})});}_0x4e17c9=_[_0xd373('0x43')]({},_0x4e17c9,_0x6659f6[_0xd373('0x45')]);var _0x51efee={'where':_0x4e17c9[_0xd373('0x40')]};return db[_0xd373('0x30')][_0xd373('0x1d')](_0x51efee)[_0xd373('0x27')](function(_0x2d8c7d){_0x8e4884['count']=_0x2d8c7d;if(_0x6659f6['query'][_0xd373('0x46')]){_0x4e17c9[_0xd373('0x47')]=[{'all':!![]}];}return db[_0xd373('0x30')][_0xd373('0x48')](_0x4e17c9);})['then'](function(_0x29725c){_0x8e4884['rows']=_0x29725c;return _0x8e4884;})[_0xd373('0x27')](respondWithFilteredResult(_0x104156,_0x4e17c9))[_0xd373('0x49')](handleError(_0x104156,null));};exports[_0xd373('0x4a')]=function(_0xfb2922,_0x15cd1f){var _0x54afd4={'raw':![],'where':{'id':_0xfb2922[_0xd373('0x4b')]['id']}},_0x42744d={};_0x42744d['model']=_[_0xd373('0x36')](db[_0xd373('0x30')][_0xd373('0x31')]);_0x42744d[_0xd373('0x35')]=_[_0xd373('0x36')](_0xfb2922[_0xd373('0x35')]);_0x42744d[_0xd373('0x37')]=_[_0xd373('0x38')](_0x42744d[_0xd373('0x34')],_0x42744d[_0xd373('0x35')]);_0x54afd4['attributes']=_['intersection'](_0x42744d[_0xd373('0x34')],qs['fields'](_0xfb2922[_0xd373('0x35')]['fields']));_0x54afd4['attributes']=_0x54afd4['attributes'][_0xd373('0x3b')]?_0x54afd4[_0xd373('0x39')]:_0x42744d[_0xd373('0x34')];if(_0xfb2922[_0xd373('0x35')][_0xd373('0x46')]){_0x54afd4[_0xd373('0x47')]=[{'all':!![]}];}_0x54afd4=_[_0xd373('0x43')]({},_0x54afd4,_0xfb2922['options']);return db[_0xd373('0x30')]['find'](_0x54afd4)[_0xd373('0x27')](handleEntityNotFound(_0x15cd1f,null))[_0xd373('0x27')](respondWithResult(_0x15cd1f,null))['catch'](handleError(_0x15cd1f,null));};exports[_0xd373('0x28')]=function(_0x5ca39c,_0x46a582){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x5ca39c[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x46a582,null))['then'](removeEntity(_0x46a582,null))['catch'](handleError(_0x46a582,null));};exports['describe']=function(_0x3a2192,_0x384e23){return db['VoicePrefix'][_0xd373('0x4d')]()[_0xd373('0x27')](respondWithResult(_0x384e23,null))['catch'](handleError(_0x384e23,null));};exports[_0xd373('0x4e')]=function(_0xb6b583,_0x102101){var _0x473af2;return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0xc255ec){return db[_0xd373('0x30')][_0xd373('0x4e')](_0xb6b583[_0xd373('0x51')],{'transaction':_0xc255ec})[_0xd373('0x27')](function(_0x5b88ea){_0x473af2=_0x5b88ea['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x473af2['VoiceExtensionId']},'raw':!![]})['then'](function(_0x409246){return createVoicePrefixExtensions(_0x473af2,_0x409246,_0xc255ec);});});})[_0xd373('0x27')](function(){var _0x5b2ae9=_0xb6b583['user']['get']({'plain':!![]});if(!_0x5b2ae9)throw new Error(_0xd373('0x52'));if(_0x5b2ae9[_0xd373('0x53')]==='user'){var _0x52fa5b=_0x473af2;return db[_0xd373('0x54')][_0xd373('0x4c')]({'where':{'name':_0xd373('0x2a'),'userProfileId':_0x5b2ae9[_0xd373('0x55')]},'raw':!![]})[_0xd373('0x27')](function(_0x59da03){if(_0x59da03&&_0x59da03[_0xd373('0x56')]===0x0){return db[_0xd373('0x2b')][_0xd373('0x4e')]({'name':_0x52fa5b[_0xd373('0x2d')],'resourceId':_0x52fa5b['id'],'type':_0x59da03[_0xd373('0x2d')],'sectionId':_0x59da03['id']},{})[_0xd373('0x27')](function(){return _0x473af2;});}else{return _0x473af2;}})[_0xd373('0x49')](function(_0x2e4298){logger[_0xd373('0x57')](_0xd373('0x58'),_0x2e4298);throw _0x2e4298;});}return _0x473af2;})[_0xd373('0x27')](respondWithResult(_0x102101,null))[_0xd373('0x49')](handleError(_0x102101,null));};function Extension(_0x213b3c,_0x42e45d,_0x13f139,_0x4cb143){this[_0xd373('0x59')]=_0xd373('0x5a');this[_0xd373('0x5b')]=_0x213b3c;this['app']=_0x13f139;this[_0xd373('0x33')]='system';this[_0xd373('0x5c')]='Voice\x20Prefix\x20Extension';this[_0xd373('0x5d')]=_0x42e45d;this[_0xd373('0x5e')]=_0x4cb143;}function createVoicePrefixExtensions(_0x427f68,_0x19924a,_0x41c327){return new BPromise(function(_0x1ac620,_0xa47b76){var _0xaaf7fa=new Extension(formatPrefixName(_0x427f68[_0xd373('0x5f')]),0x1,_0xd373('0x60'),_0xd373('0x61'));_0xaaf7fa[_0xd373('0x62')]=_0x427f68['id'];return db[_0xd373('0x63')][_0xd373('0x4e')](_0xaaf7fa,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x2e7edb){var _0x1379e5=_0x2e7edb[_0xd373('0x29')]({'plain':!![]});var _0x209e76=_[_0xd373('0x2f')](addVoicePrefixExtensions(_0x427f68,_0x19924a),function(_0x295e09){_0x295e09[_0xd373('0x64')]=_0x1379e5['id'];_0x295e09[_0xd373('0x62')]=_0x427f68['id'];return _0x295e09;});return db[_0xd373('0x63')][_0xd373('0x65')](_0x209e76,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x547a8a){if(!_0x547a8a){return _0xa47b76(_0xd373('0x66'));}else{return _0x1ac620(_0x547a8a);}})[_0xd373('0x49')](function(_0x5fdc16){return _0xa47b76(_0x5fdc16);});});;});};function addVoicePrefixExtensions(_0x4a7d01,_0x38068a){var _0x2d9019=[];var _0x33320c=formatPrefixName(_0x4a7d01[_0xd373('0x5f')]);_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x2,_0xd373('0x68'),_0xd373('0x69')+_0x4a7d01['name']));if(_0x4a7d01[_0xd373('0x6a')]){_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x68'),_0xd373('0x6b')+_0x4a7d01[_0xd373('0x6a')]));}else{_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x60'),_0xd373('0x6c')));}_0x2d9019['push'](new Extension(_0x33320c,0x4,_0xd373('0x6d'),_0x38068a['context']+','+_0xd373('0x6e')+(0x8+_0x4a7d01[_0xd373('0x2d')][_0xd373('0x3b')])+'}'+','+0x1));return _0x2d9019;}function formatPrefixName(_0x2a9582){var _0x36e7cc='_';for(var _0x32c044=0x0;_0x32c044<_0x2a9582[_0xd373('0x3b')];_0x32c044++){if(_0x2a9582[_0xd373('0x6f')](_0x32c044)=='-'){_0x36e7cc+=_0x2a9582['charAt'](_0x32c044);}else{_0x36e7cc+='['+_0x2a9582[_0xd373('0x6f')](_0x32c044)+']';}}_0x36e7cc+='.';return _0x36e7cc;}exports['update']=function(_0x40f5ad,_0x27fcbe,_0x310a65){var _0x3ce679=_0x40f5ad[_0xd373('0x51')];_0x3ce679[_0xd373('0x5f')]=_0xd373('0x70')+_0x3ce679['name']+'-';return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x3d375d){return db['VoicePrefix'][_0xd373('0x26')](_0x3ce679,{'where':{'id':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x28')]({'where':{'VoicePrefixId':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x4c')]({'where':{'id':_0x3ce679[_0xd373('0x64')]},'raw':!![]})[_0xd373('0x27')](function(_0x727541){return createVoicePrefixExtensions(_0x3ce679,_0x727541,_0x3d375d);});});});})[_0xd373('0x27')](function(){return db[_0xd373('0x30')]['findById'](_0x3ce679['id']);})[_0xd373('0x27')](respondWithResult(_0x27fcbe,null))[_0xd373('0x49')](handleError(_0x27fcbe,null));};exports[_0xd373('0x71')]=function(_0x506f49,_0x377147,_0x365028){return db[_0xd373('0x30')]['find']({'where':{'id':_0x506f49[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x377147,null))[_0xd373('0x27')](function(_0x26821a){if(_0x26821a){return _0x26821a[_0xd373('0x71')](_0x506f49[_0xd373('0x51')]['ids'],_[_0xd373('0x72')](_0x506f49['body'],[_0xd373('0x73'),'id'])||{})[_0xd373('0x74')](function(_0x140ec4){for(var _0xb658db=0x0;_0xb658db<_0x506f49[_0xd373('0x51')][_0xd373('0x73')]['length'];_0xb658db+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:save',{'UserId':Number(_0x506f49[_0xd373('0x51')]['ids'][_0xb658db]),'VoicePrefixId':Number(_0x506f49['params']['id'])});}return _0x140ec4;});}})[_0xd373('0x27')](respondWithResult(_0x377147,null))[_0xd373('0x49')](handleError(_0x377147,null));};exports[_0xd373('0x76')]=function(_0x32b739,_0x5a5651,_0x546a07){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x32b739[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5a5651,null))[_0xd373('0x27')](function(_0x1a30eb){if(_0x1a30eb){return _0x1a30eb[_0xd373('0x76')](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])[_0xd373('0x27')](function(){if(_['isArray'](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])){for(var _0x1576e5=0x0;_0x1576e5<_0x32b739[_0xd373('0x35')][_0xd373('0x73')][_0xd373('0x3b')];_0x1576e5+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x32b739[_0xd373('0x35')]['ids'][_0x1576e5]),'VoicePrefixId':Number(_0x32b739['params']['id'])});}}else{socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':Number(_0x32b739[_0xd373('0x35')][_0xd373('0x73')]),'VoicePrefixId':Number(_0x32b739[_0xd373('0x4b')]['id'])});}});}})[_0xd373('0x27')](respondWithStatusCode(_0x5a5651,null))['catch'](handleError(_0x5a5651,null));};exports[_0xd373('0x78')]=function(_0x19eb94,_0x6114a5,_0x52ab87){var _0x467ac8={};var _0x2c543a={};var _0x1a5666;var _0x47ae4c;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0x19eb94[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6114a5,null))[_0xd373('0x27')](function(_0x288295){if(_0x288295){_0x1a5666=_0x288295;_0x2c543a[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7a')][_0xd373('0x31')]);_0x2c543a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x19eb94[_0xd373('0x35')]);_0x2c543a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],_0x2c543a[_0xd373('0x35')]);_0x467ac8['attributes']=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x19eb94['query'][_0xd373('0x3a')]));_0x467ac8[_0xd373('0x39')]=_0x467ac8['attributes'][_0xd373('0x3b')]?_0x467ac8['attributes']:_0x2c543a[_0xd373('0x34')];_0x467ac8[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x19eb94[_0xd373('0x35')][_0xd373('0x3f')]);_0x467ac8[_0xd373('0x40')]=qs['filters'](_[_0xd373('0x41')](_0x19eb94['query'],_0x2c543a[_0xd373('0x37')]));if(_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]){_0x467ac8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x467ac8['where'],{'$or':_[_0xd373('0x2f')](_0x467ac8[_0xd373('0x39')],function(_0x232b78){var _0x12ffc0={};_0x12ffc0[_0x232b78]={'$like':'%'+_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]+'%'};return _0x12ffc0;})});}_0x467ac8=_['merge']({},_0x467ac8,_0x19eb94[_0xd373('0x45')]);return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})[_0xd373('0x27')](function(_0x4b32b6){if(_0x4b32b6){_0x47ae4c=_0x4b32b6[_0xd373('0x3b')];if(!_0x19eb94[_0xd373('0x35')]['hasOwnProperty'](_0xd373('0x3d'))){_0x467ac8['limit']=qs[_0xd373('0x1f')](_0x19eb94['query']['limit']);_0x467ac8[_0xd373('0x1e')]=qs[_0xd373('0x1e')](_0x19eb94[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})['then'](function(_0x3ae4c8){if(_0x3ae4c8){return _0x3ae4c8?{'count':_0x47ae4c,'rows':_0x3ae4c8}:null;}})['then'](respondWithResult(_0x6114a5,null))[_0xd373('0x49')](handleError(_0x6114a5,null));};exports[_0xd373('0x7b')]=function(_0xc8f4e6,_0x5c951e,_0x113671){var _0x5621d8={};var _0x30549e={};var _0x633ba0;var _0xa854a2;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0xc8f4e6['params']['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5c951e,null))[_0xd373('0x27')](function(_0x39327f){if(_0x39327f){_0x633ba0=_0x39327f;_0x30549e[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7c')][_0xd373('0x31')]);_0x30549e['query']=_[_0xd373('0x36')](_0xc8f4e6[_0xd373('0x35')]);_0x30549e[_0xd373('0x37')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],_0x30549e[_0xd373('0x35')]);_0x5621d8[_0xd373('0x39')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],qs[_0xd373('0x3a')](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3a')]));_0x5621d8[_0xd373('0x39')]=_0x5621d8[_0xd373('0x39')][_0xd373('0x3b')]?_0x5621d8[_0xd373('0x39')]:_0x30549e[_0xd373('0x34')];_0x5621d8['order']=qs[_0xd373('0x3f')](_0xc8f4e6[_0xd373('0x35')]['sort']);_0x5621d8['where']=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0xc8f4e6['query'],_0x30549e[_0xd373('0x37')]));if(_0xc8f4e6[_0xd373('0x35')][_0xd373('0x42')]){_0x5621d8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x5621d8[_0xd373('0x40')],{'$or':_[_0xd373('0x2f')](_0x5621d8[_0xd373('0x39')],function(_0x3cc904){var _0x6e6c7e={};_0x6e6c7e[_0x3cc904]={'$like':'%'+_0xc8f4e6[_0xd373('0x35')]['filter']+'%'};return _0x6e6c7e;})});}_0x5621d8=_['merge']({},_0x5621d8,_0xc8f4e6[_0xd373('0x45')]);return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x3785b7){if(_0x3785b7){_0xa854a2=_0x3785b7[_0xd373('0x3b')];if(!_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x5621d8[_0xd373('0x1f')]=qs['limit'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1f')]);_0x5621d8[_0xd373('0x1e')]=qs['offset'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x6463cd){if(_0x6463cd){return _0x6463cd?{'count':_0xa854a2,'rows':_0x6463cd}:null;}})[_0xd373('0x27')](respondWithResult(_0x5c951e,null))['catch'](handleError(_0x5c951e,null));};exports[_0xd373('0x7d')]=function(_0x2da0cd,_0x48624a,_0x316348){var _0x48ee3b=_0x2da0cd[_0xd373('0x51')][_0xd373('0x73')];var _0x3b6ba5;return db['Team']['findAll']({'where':{'id':_0x48ee3b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd373('0x7e'),'attributes':['id','name',_0xd373('0x7f'),_0xd373('0x80'),'interface'],'raw':!![]}]})[_0xd373('0x27')](function(_0x5be460){if(_0x5be460){_0x3b6ba5=_0x5be460;var _0x449d06=_[_0xd373('0x81')](_0x5be460,function(_0x15eb3d){var _0x1031eb=_0x15eb3d[_0xd373('0x29')]({'plain':!![]});return _0x1031eb[_0xd373('0x7e')];});return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x2da0cd['params']['id']}})[_0xd373('0x27')](function(_0x41faec){return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x39606d){return _0x41faec[_0xd373('0x7d')](_0x48ee3b,{'transaction':_0x39606d})['then'](function(){return BPromise[_0xd373('0x82')](_0x3b6ba5,function(_0x424a53){return db[_0xd373('0x83')]['upsert']({'TeamId':_0x424a53['id'],'VoicePrefixId':_0x2da0cd[_0xd373('0x4b')]['id']},{'transaction':_0x39606d});});})[_0xd373('0x27')](function(){return BPromise[_0xd373('0x82')](_0x449d06,function(_0x2f1dc0){return db[_0xd373('0x84')][_0xd373('0x85')]({'where':{'UserId':_0x2f1dc0['id'],'VoicePrefixId':_0x2da0cd['params']['id']},'transaction':_0x39606d});});})[_0xd373('0x27')](function(){_0x449d06['forEach'](function(_0x447ea9){socket[_0xd373('0x75')](_0xd373('0x86'),{'UserId':_0x447ea9['id'],'VoicePrefixId':_0x41faec['id']});});});});});}})[_0xd373('0x27')](respondWithStatusCode(_0x48624a,null))['catch'](handleError(_0x48624a,null));};exports['removeTeams']=function(_0x22e0bd,_0x44fbef,_0x3c9e20){return db[_0xd373('0x7c')][_0xd373('0x48')]({'where':{'id':_0x22e0bd[_0xd373('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd373('0x7a')],'as':_0xd373('0x7e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x44fbef,null))[_0xd373('0x27')](function(_0x2225b2){var _0x2d5326=_['map'](_0x2225b2,'id');var _0x259610=[];var _0x747622=[];var _0x5233a2=squel['select']();_0x5233a2[_0xd373('0x87')](_0xd373('0x88'))[_0xd373('0x89')](_0xd373('0x8a'),'tq')[_0xd373('0x8b')](_0xd373('0x8c'),'ut',_0xd373('0x8d'))['where'](_0xd373('0x8e'),_0x22e0bd[_0xd373('0x4b')]['id']);for(var _0x11e4a9=0x0;_0x11e4a9<_0x2225b2[_0xd373('0x3b')];_0x11e4a9+=0x1){let _0x7b49b6=_0x2225b2[_0x11e4a9];for(var _0x4d9ab3=0x0;_0x4d9ab3<_0x7b49b6[_0xd373('0x7e')][_0xd373('0x3b')];_0x4d9ab3+=0x1){let _0x4c924d=_0x7b49b6[_0xd373('0x7e')][_0x4d9ab3];var _0x494de8=_0x5233a2[_0xd373('0x8f')]();_0x494de8[_0xd373('0x40')](_0xd373('0x90'),_0x4c924d['id']);_0x747622[_0xd373('0x67')](db[_0xd373('0x4f')][_0xd373('0x35')](_0x494de8[_0xd373('0x91')](),{'type':db[_0xd373('0x4f')]['QueryTypes'][_0xd373('0x92')]})[_0xd373('0x27')](function(_0x13b085){if(_0x13b085[_0xd373('0x3b')]===0x1){return _0x4c924d['id'];}else{var _0x392bd2=_[_0xd373('0x93')](_['map'](_0x13b085,_0xd373('0x94')),function(_0x10ac87){return _[_0xd373('0x95')](_0x2d5326,_0x10ac87);});if(_0x392bd2){return _0x4c924d['id'];}}}));}}return BPromise[_0xd373('0x96')](_0x747622)[_0xd373('0x27')](function(_0x20fa2e){_0x259610=_(_0x259610)[_0xd373('0x97')](_0x20fa2e)[_0xd373('0x98')]()[_0xd373('0x99')]();return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x22e0bd[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](function(_0x536c81){return db[_0xd373('0x4f')]['transaction'](function(_0x4ca4f9){return _0x536c81[_0xd373('0x9a')](_0x22e0bd['query'][_0xd373('0x73')],{'transaction':_0x4ca4f9})['then'](function(){if(!_['isEmpty'](_0x259610)){return _0x536c81['removeAgents'](_0x259610,{'transaction':_0x4ca4f9});}})['then'](function(){_0x259610['forEach'](function(_0x1de658){socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':_0x1de658,'VoicePrefixId':_0x536c81['id']});});});});});});})[_0xd373('0x27')](respondWithStatusCode(_0x44fbef,null))['catch'](handleError(_0x44fbef,null));}; \ No newline at end of file +var _0xefda=['value','isEmpty','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','apply','save','update','destroy','VoicePrefixes','then','error','stack','send','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','describe','create','transaction','body','VoiceExtensionId','user','get','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','Set','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','ids','spread','removeAgents','emit','userVoicePrefix:remove','getAgents','User','getTeams','findOne','Team','addTeams','interface','flatMap','Agents','upsert','each','UserVoicePrefix','forEach','userVoicePrefix:save','removeTeams','select','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','toString','QueryTypes','SELECT','every','TeamId','all','union','compact'];(function(_0xac721a,_0x51dbc7){var _0x50dbde=function(_0x2e78e6){while(--_0x2e78e6){_0xac721a['push'](_0xac721a['shift']());}};_0x50dbde(++_0x51dbc7);}(_0xefda,0x96));var _0xaefd=function(_0x11c780,_0x30248f){_0x11c780=_0x11c780-0x0;var _0x55e66d=_0xefda[_0x11c780];return _0x55e66d;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];config[_0xaefd('0x18')]=_[_0xaefd('0x19')](config['redis'],{'host':_0xaefd('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaefd('0x18')]));require(_0xaefd('0x1b'))[_0xaefd('0x1c')](socket);function respondWithStatusCode(_0x43b82a,_0x4ec92a){_0x4ec92a=_0x4ec92a||0xcc;return function(_0x16e4f4){if(_0x16e4f4){return _0x43b82a[_0xaefd('0x1d')](_0x4ec92a);}return _0x43b82a[_0xaefd('0x1e')](_0x4ec92a)[_0xaefd('0x1f')]();};}function respondWithResult(_0x10ee28,_0x32f75e){_0x32f75e=_0x32f75e||0xc8;return function(_0x277070){if(_0x277070){return _0x10ee28[_0xaefd('0x1e')](_0x32f75e)['json'](_0x277070);}};}function respondWithFilteredResult(_0x9d9c29,_0x109604){return function(_0x9748f4){if(_0x9748f4){var _0x1737a1=typeof _0x109604[_0xaefd('0x20')]===_0xaefd('0x21')&&typeof _0x109604['limit']===_0xaefd('0x21');var _0x182f9a=_0x9748f4[_0xaefd('0x22')];var _0x1260dd=_0x1737a1?0x0:_0x109604[_0xaefd('0x20')];var _0x1f302c=_0x1737a1?_0x9748f4['count']:_0x109604[_0xaefd('0x20')]+_0x109604[_0xaefd('0x23')];var _0x2dcdd8;if(_0x1f302c>=_0x182f9a){_0x1f302c=_0x182f9a;_0x2dcdd8=0xc8;}else{_0x2dcdd8=0xce;}_0x9d9c29[_0xaefd('0x1e')](_0x2dcdd8);return _0x9d9c29[_0xaefd('0x24')]('Content-Range',_0x1260dd+'-'+_0x1f302c+'/'+_0x182f9a)['json'](_0x9748f4);}return null;};}function patchUpdates(_0x5b9967){return function(_0x21680a){try{jsonpatch[_0xaefd('0x25')](_0x21680a,_0x5b9967,!![]);}catch(_0x313a6f){return BPromise['reject'](_0x313a6f);}return _0x21680a[_0xaefd('0x26')]();};}function saveUpdates(_0x4cd9b2,_0x3deec8){return function(_0x3caa99){if(_0x3caa99){return _0x3caa99[_0xaefd('0x27')](_0x4cd9b2)['then'](function(_0x435413){return _0x435413;});}return null;};}function removeEntity(_0x3ffc9c,_0x18e720){return function(_0x14cc9d){if(_0x14cc9d){return _0x14cc9d[_0xaefd('0x28')]()['then'](function(){var _0x2fe27e=_0x14cc9d['get']({'plain':!![]});var _0x810bf=_0xaefd('0x29');return db['UserProfileResource'][_0xaefd('0x28')]({'where':{'type':_0x810bf,'resourceId':_0x2fe27e['id']}})[_0xaefd('0x2a')](function(){return _0x14cc9d;});})['then'](function(){_0x3ffc9c[_0xaefd('0x1e')](0xcc)[_0xaefd('0x1f')]();});}};}function handleEntityNotFound(_0x36b6b7,_0x4c0898){return function(_0x45f0e8){if(!_0x45f0e8){_0x36b6b7['sendStatus'](0x194);}return _0x45f0e8;};}function handleError(_0x109e19,_0x5c5639){_0x5c5639=_0x5c5639||0x1f4;return function(_0x4a1acb){logger[_0xaefd('0x2b')](_0x4a1acb[_0xaefd('0x2c')]);if(_0x4a1acb['name']){delete _0x4a1acb['name'];}_0x109e19['status'](_0x5c5639)[_0xaefd('0x2d')](_0x4a1acb);};}exports[_0xaefd('0x2e')]=function(_0x4b6910,_0x5503d0){var _0x62ef86={},_0x465d99={},_0x3f4947={'count':0x0,'rows':[]};var _0x21d358=_['map'](db[_0xaefd('0x2f')][_0xaefd('0x30')],function(_0x3b11e4){return{'name':_0x3b11e4[_0xaefd('0x31')],'type':_0x3b11e4[_0xaefd('0x32')][_0xaefd('0x33')]};});_0x465d99[_0xaefd('0x34')]=_[_0xaefd('0x35')](_0x21d358,_0xaefd('0x36'));_0x465d99[_0xaefd('0x37')]=_[_0xaefd('0x38')](_0x4b6910[_0xaefd('0x37')]);_0x465d99[_0xaefd('0x39')]=_[_0xaefd('0x3a')](_0x465d99[_0xaefd('0x34')],_0x465d99[_0xaefd('0x37')]);_0x62ef86['attributes']=_[_0xaefd('0x3a')](_0x465d99[_0xaefd('0x34')],qs[_0xaefd('0x3b')](_0x4b6910['query'][_0xaefd('0x3b')]));_0x62ef86['attributes']=_0x62ef86[_0xaefd('0x3c')][_0xaefd('0x3d')]?_0x62ef86[_0xaefd('0x3c')]:_0x465d99[_0xaefd('0x34')];if(!_0x4b6910[_0xaefd('0x37')][_0xaefd('0x3e')](_0xaefd('0x3f'))){_0x62ef86[_0xaefd('0x23')]=qs[_0xaefd('0x23')](_0x4b6910[_0xaefd('0x37')][_0xaefd('0x23')]);_0x62ef86[_0xaefd('0x20')]=qs[_0xaefd('0x20')](_0x4b6910[_0xaefd('0x37')]['offset']);}_0x62ef86[_0xaefd('0x40')]=qs['sort'](_0x4b6910[_0xaefd('0x37')][_0xaefd('0x41')]);_0x62ef86[_0xaefd('0x42')]=qs[_0xaefd('0x39')](_[_0xaefd('0x43')](_0x4b6910[_0xaefd('0x37')],_0x465d99[_0xaefd('0x39')]),_0x21d358);if(_0x4b6910[_0xaefd('0x37')][_0xaefd('0x44')]){_0x62ef86[_0xaefd('0x42')]=_['merge'](_0x62ef86[_0xaefd('0x42')],{'$or':_[_0xaefd('0x35')](_0x21d358,function(_0x4dfea1){if(_0x4dfea1[_0xaefd('0x32')]!==_0xaefd('0x45')){var _0x27daa8={};_0x27daa8[_0x4dfea1['name']]={'$like':'%'+_0x4b6910['query'][_0xaefd('0x44')]+'%'};return _0x27daa8;}})});}_0x62ef86=_[_0xaefd('0x46')]({},_0x62ef86,_0x4b6910[_0xaefd('0x47')]);var _0x179648={'where':_0x62ef86[_0xaefd('0x42')]};return db[_0xaefd('0x2f')][_0xaefd('0x22')](_0x179648)[_0xaefd('0x2a')](function(_0x48a7af){_0x3f4947[_0xaefd('0x22')]=_0x48a7af;if(_0x4b6910[_0xaefd('0x37')][_0xaefd('0x48')]){_0x62ef86[_0xaefd('0x49')]=[{'all':!![]}];}return db[_0xaefd('0x2f')][_0xaefd('0x4a')](_0x62ef86);})[_0xaefd('0x2a')](function(_0x1f4a15){_0x3f4947['rows']=_0x1f4a15;return _0x3f4947;})['then'](respondWithFilteredResult(_0x5503d0,_0x62ef86))[_0xaefd('0x4b')](handleError(_0x5503d0,null));};exports[_0xaefd('0x4c')]=function(_0x532328,_0x599738){var _0x17d611={'raw':![],'where':{'id':_0x532328[_0xaefd('0x4d')]['id']}},_0xe37b2c={};_0xe37b2c[_0xaefd('0x34')]=_[_0xaefd('0x38')](db[_0xaefd('0x2f')][_0xaefd('0x30')]);_0xe37b2c[_0xaefd('0x37')]=_[_0xaefd('0x38')](_0x532328['query']);_0xe37b2c[_0xaefd('0x39')]=_[_0xaefd('0x3a')](_0xe37b2c[_0xaefd('0x34')],_0xe37b2c[_0xaefd('0x37')]);_0x17d611[_0xaefd('0x3c')]=_[_0xaefd('0x3a')](_0xe37b2c[_0xaefd('0x34')],qs['fields'](_0x532328[_0xaefd('0x37')]['fields']));_0x17d611[_0xaefd('0x3c')]=_0x17d611[_0xaefd('0x3c')][_0xaefd('0x3d')]?_0x17d611[_0xaefd('0x3c')]:_0xe37b2c['model'];if(_0x532328['query'][_0xaefd('0x48')]){_0x17d611[_0xaefd('0x49')]=[{'all':!![]}];}_0x17d611=_[_0xaefd('0x46')]({},_0x17d611,_0x532328['options']);return db[_0xaefd('0x2f')][_0xaefd('0x4e')](_0x17d611)['then'](handleEntityNotFound(_0x599738,null))[_0xaefd('0x2a')](respondWithResult(_0x599738,null))[_0xaefd('0x4b')](handleError(_0x599738,null));};exports[_0xaefd('0x28')]=function(_0x23d4a9,_0x398aee){return db[_0xaefd('0x2f')][_0xaefd('0x4e')]({'where':{'id':_0x23d4a9[_0xaefd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x398aee,null))['then'](removeEntity(_0x398aee,null))[_0xaefd('0x4b')](handleError(_0x398aee,null));};exports[_0xaefd('0x4f')]=function(_0x578e0c,_0x332743){return db['VoicePrefix'][_0xaefd('0x4f')]()[_0xaefd('0x2a')](respondWithResult(_0x332743,null))[_0xaefd('0x4b')](handleError(_0x332743,null));};exports[_0xaefd('0x50')]=function(_0x27fd3f,_0xf727cd){var _0x4b709a;return db['sequelize'][_0xaefd('0x51')](function(_0x338823){return db['VoicePrefix'][_0xaefd('0x50')](_0x27fd3f[_0xaefd('0x52')],{'transaction':_0x338823})[_0xaefd('0x2a')](function(_0x23fee9){_0x4b709a=_0x23fee9['get']({'plain':!![]});return db['VoiceExtension'][_0xaefd('0x4e')]({'where':{'id':_0x4b709a[_0xaefd('0x53')]},'raw':!![]})[_0xaefd('0x2a')](function(_0x1fe44a){return createVoicePrefixExtensions(_0x4b709a,_0x1fe44a,_0x338823);});});})[_0xaefd('0x2a')](function(){var _0x47cac9=_0x27fd3f[_0xaefd('0x54')][_0xaefd('0x55')]({'plain':!![]});if(!_0x47cac9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47cac9[_0xaefd('0x56')]===_0xaefd('0x54')){var _0x5f2925=_0x4b709a;return db[_0xaefd('0x57')][_0xaefd('0x4e')]({'where':{'name':_0xaefd('0x29'),'userProfileId':_0x47cac9['userProfileId']},'raw':!![]})[_0xaefd('0x2a')](function(_0x1a9842){if(_0x1a9842&&_0x1a9842['autoAssociation']===0x0){return db[_0xaefd('0x58')][_0xaefd('0x50')]({'name':_0x5f2925[_0xaefd('0x36')],'resourceId':_0x5f2925['id'],'type':_0x1a9842[_0xaefd('0x36')],'sectionId':_0x1a9842['id']},{})['then'](function(){return _0x4b709a;});}else{return _0x4b709a;}})['catch'](function(_0x232bf9){logger[_0xaefd('0x2b')](_0xaefd('0x59'),_0x232bf9);throw _0x232bf9;});}return _0x4b709a;})[_0xaefd('0x2a')](respondWithResult(_0xf727cd,null))[_0xaefd('0x4b')](handleError(_0xf727cd,null));};function Extension(_0x8ab9e7,_0x314660,_0x368fd3,_0x1e519e){this[_0xaefd('0x5a')]='from-sip';this['exten']=_0x8ab9e7;this[_0xaefd('0x5b')]=_0x368fd3;this[_0xaefd('0x32')]=_0xaefd('0x5c');this[_0xaefd('0x5d')]='Voice\x20Prefix\x20Extension';this[_0xaefd('0x5e')]=_0x314660;this[_0xaefd('0x5f')]=_0x1e519e;}function createVoicePrefixExtensions(_0x422b9e,_0x1ad04e,_0x16c227){return new BPromise(function(_0x37414d,_0x241e93){var _0x2c1004=new Extension(formatPrefixName(_0x422b9e['prefix']),0x1,_0xaefd('0x60'),_0xaefd('0x61'));_0x2c1004[_0xaefd('0x62')]=_0x422b9e['id'];return db[_0xaefd('0x63')]['create'](_0x2c1004,{'transaction':_0x16c227})[_0xaefd('0x2a')](function(_0x53888d){var _0xeb739=_0x53888d[_0xaefd('0x55')]({'plain':!![]});var _0x516913=_['map'](addVoicePrefixExtensions(_0x422b9e,_0x1ad04e),function(_0x45028e){_0x45028e['VoiceExtensionId']=_0xeb739['id'];_0x45028e['VoicePrefixId']=_0x422b9e['id'];return _0x45028e;});return db['VoiceExtension'][_0xaefd('0x64')](_0x516913,{'transaction':_0x16c227})[_0xaefd('0x2a')](function(_0x27fcb4){if(!_0x27fcb4){return _0x241e93(_0xaefd('0x65'));}else{return _0x37414d(_0x27fcb4);}})[_0xaefd('0x4b')](function(_0x384847){return _0x241e93(_0x384847);});});;});};function addVoicePrefixExtensions(_0x509a87,_0x5d308a){var _0x4f8e16=[];var _0x5c7220=formatPrefixName(_0x509a87[_0xaefd('0x66')]);_0x4f8e16['push'](new Extension(_0x5c7220,0x2,_0xaefd('0x67'),'CDR(prefix)='+_0x509a87[_0xaefd('0x36')]));if(_0x509a87[_0xaefd('0x68')]){_0x4f8e16[_0xaefd('0x69')](new Extension(_0x5c7220,0x3,_0xaefd('0x67'),_0xaefd('0x6a')+_0x509a87[_0xaefd('0x68')]));}else{_0x4f8e16[_0xaefd('0x69')](new Extension(_0x5c7220,0x3,'NoOp',_0xaefd('0x6b')));}_0x4f8e16[_0xaefd('0x69')](new Extension(_0x5c7220,0x4,_0xaefd('0x6c'),_0x5d308a[_0xaefd('0x5a')]+','+'${EXTEN:'+(0x8+_0x509a87[_0xaefd('0x36')]['length'])+'}'+','+0x1));return _0x4f8e16;}function formatPrefixName(_0x28db3a){var _0x40b493='_';for(var _0x110379=0x0;_0x110379<_0x28db3a[_0xaefd('0x3d')];_0x110379++){if(_0x28db3a[_0xaefd('0x6d')](_0x110379)=='-'){_0x40b493+=_0x28db3a[_0xaefd('0x6d')](_0x110379);}else{_0x40b493+='['+_0x28db3a['charAt'](_0x110379)+']';}}_0x40b493+='.';return _0x40b493;}exports[_0xaefd('0x27')]=function(_0x3b39db,_0x4a9fa5,_0x39ee5){var _0x279ad4=_0x3b39db['body'];_0x279ad4[_0xaefd('0x66')]=_0xaefd('0x6e')+_0x279ad4[_0xaefd('0x36')]+'-';return db[_0xaefd('0x6f')][_0xaefd('0x51')](function(_0x406c6d){return db[_0xaefd('0x2f')][_0xaefd('0x27')](_0x279ad4,{'where':{'id':_0x279ad4['id']},'transaction':_0x406c6d})[_0xaefd('0x2a')](function(){return db[_0xaefd('0x63')][_0xaefd('0x28')]({'where':{'VoicePrefixId':_0x279ad4['id']},'transaction':_0x406c6d})[_0xaefd('0x2a')](function(){return db[_0xaefd('0x63')][_0xaefd('0x4e')]({'where':{'id':_0x279ad4[_0xaefd('0x53')]},'raw':!![]})[_0xaefd('0x2a')](function(_0x3e0836){return createVoicePrefixExtensions(_0x279ad4,_0x3e0836,_0x406c6d);});});});})['then'](function(){return db[_0xaefd('0x2f')][_0xaefd('0x70')](_0x279ad4['id']);})[_0xaefd('0x2a')](respondWithResult(_0x4a9fa5,null))['catch'](handleError(_0x4a9fa5,null));};exports[_0xaefd('0x71')]=function(_0x12391f,_0x47270b,_0x594a75){return db['VoicePrefix'][_0xaefd('0x4e')]({'where':{'id':_0x12391f['params']['id']}})[_0xaefd('0x2a')](handleEntityNotFound(_0x47270b,null))['then'](function(_0x1e8616){if(_0x1e8616){return _0x1e8616[_0xaefd('0x71')](_0x12391f[_0xaefd('0x52')]['ids'],_['omit'](_0x12391f[_0xaefd('0x52')],[_0xaefd('0x72'),'id'])||{})[_0xaefd('0x73')](function(_0x99f17b){for(var _0x157a2a=0x0;_0x157a2a<_0x12391f[_0xaefd('0x52')]['ids']['length'];_0x157a2a+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x12391f['body'][_0xaefd('0x72')][_0x157a2a]),'VoicePrefixId':Number(_0x12391f[_0xaefd('0x4d')]['id'])});}return _0x99f17b;});}})[_0xaefd('0x2a')](respondWithResult(_0x47270b,null))[_0xaefd('0x4b')](handleError(_0x47270b,null));};exports['removeAgents']=function(_0x3ae6ba,_0x1c4508,_0x4a3586){return db[_0xaefd('0x2f')]['find']({'where':{'id':_0x3ae6ba[_0xaefd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c4508,null))[_0xaefd('0x2a')](function(_0x4b1ade){if(_0x4b1ade){return _0x4b1ade[_0xaefd('0x74')](_0x3ae6ba['query'][_0xaefd('0x72')])[_0xaefd('0x2a')](function(){if(_['isArray'](_0x3ae6ba[_0xaefd('0x37')][_0xaefd('0x72')])){for(var _0x47235e=0x0;_0x47235e<_0x3ae6ba['query'][_0xaefd('0x72')][_0xaefd('0x3d')];_0x47235e+=0x1){socket[_0xaefd('0x75')](_0xaefd('0x76'),{'UserId':Number(_0x3ae6ba[_0xaefd('0x37')]['ids'][_0x47235e]),'VoicePrefixId':Number(_0x3ae6ba[_0xaefd('0x4d')]['id'])});}}else{socket[_0xaefd('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x3ae6ba[_0xaefd('0x37')][_0xaefd('0x72')]),'VoicePrefixId':Number(_0x3ae6ba[_0xaefd('0x4d')]['id'])});}});}})[_0xaefd('0x2a')](respondWithStatusCode(_0x1c4508,null))['catch'](handleError(_0x1c4508,null));};exports[_0xaefd('0x77')]=function(_0x491978,_0xf2925d,_0x1bbeec){var _0x19b574={};var _0x5e2823={};var _0xa53ec;var _0x888d96;return db[_0xaefd('0x2f')]['findOne']({'where':{'id':_0x491978[_0xaefd('0x4d')]['id']}})[_0xaefd('0x2a')](handleEntityNotFound(_0xf2925d,null))[_0xaefd('0x2a')](function(_0x317b55){if(_0x317b55){_0xa53ec=_0x317b55;_0x5e2823['model']=_[_0xaefd('0x38')](db[_0xaefd('0x78')][_0xaefd('0x30')]);_0x5e2823[_0xaefd('0x37')]=_['keys'](_0x491978[_0xaefd('0x37')]);_0x5e2823[_0xaefd('0x39')]=_[_0xaefd('0x3a')](_0x5e2823[_0xaefd('0x34')],_0x5e2823['query']);_0x19b574[_0xaefd('0x3c')]=_['intersection'](_0x5e2823[_0xaefd('0x34')],qs['fields'](_0x491978[_0xaefd('0x37')][_0xaefd('0x3b')]));_0x19b574[_0xaefd('0x3c')]=_0x19b574[_0xaefd('0x3c')][_0xaefd('0x3d')]?_0x19b574['attributes']:_0x5e2823[_0xaefd('0x34')];_0x19b574['order']=qs[_0xaefd('0x41')](_0x491978['query'][_0xaefd('0x41')]);_0x19b574[_0xaefd('0x42')]=qs[_0xaefd('0x39')](_['pick'](_0x491978[_0xaefd('0x37')],_0x5e2823['filters']));if(_0x491978[_0xaefd('0x37')][_0xaefd('0x44')]){_0x19b574[_0xaefd('0x42')]=_[_0xaefd('0x46')](_0x19b574['where'],{'$or':_[_0xaefd('0x35')](_0x19b574[_0xaefd('0x3c')],function(_0x215986){var _0x407c6a={};_0x407c6a[_0x215986]={'$like':'%'+_0x491978[_0xaefd('0x37')][_0xaefd('0x44')]+'%'};return _0x407c6a;})});}_0x19b574=_[_0xaefd('0x46')]({},_0x19b574,_0x491978[_0xaefd('0x47')]);return _0xa53ec[_0xaefd('0x77')](_0x19b574);}})['then'](function(_0x250d61){if(_0x250d61){_0x888d96=_0x250d61[_0xaefd('0x3d')];if(!_0x491978[_0xaefd('0x37')][_0xaefd('0x3e')](_0xaefd('0x3f'))){_0x19b574[_0xaefd('0x23')]=qs[_0xaefd('0x23')](_0x491978[_0xaefd('0x37')][_0xaefd('0x23')]);_0x19b574[_0xaefd('0x20')]=qs[_0xaefd('0x20')](_0x491978[_0xaefd('0x37')][_0xaefd('0x20')]);}return _0xa53ec[_0xaefd('0x77')](_0x19b574);}})[_0xaefd('0x2a')](function(_0x4db4b0){if(_0x4db4b0){return _0x4db4b0?{'count':_0x888d96,'rows':_0x4db4b0}:null;}})['then'](respondWithResult(_0xf2925d,null))[_0xaefd('0x4b')](handleError(_0xf2925d,null));};exports[_0xaefd('0x79')]=function(_0x48e33f,_0x24c994,_0x3ea496){var _0x320cc6={};var _0x17ba3d={};var _0x321b4c;var _0x128a26;return db['VoicePrefix'][_0xaefd('0x7a')]({'where':{'id':_0x48e33f[_0xaefd('0x4d')]['id']}})[_0xaefd('0x2a')](handleEntityNotFound(_0x24c994,null))[_0xaefd('0x2a')](function(_0x4d0fc3){if(_0x4d0fc3){_0x321b4c=_0x4d0fc3;_0x17ba3d[_0xaefd('0x34')]=_[_0xaefd('0x38')](db[_0xaefd('0x7b')][_0xaefd('0x30')]);_0x17ba3d['query']=_[_0xaefd('0x38')](_0x48e33f[_0xaefd('0x37')]);_0x17ba3d['filters']=_[_0xaefd('0x3a')](_0x17ba3d[_0xaefd('0x34')],_0x17ba3d['query']);_0x320cc6[_0xaefd('0x3c')]=_[_0xaefd('0x3a')](_0x17ba3d[_0xaefd('0x34')],qs['fields'](_0x48e33f[_0xaefd('0x37')][_0xaefd('0x3b')]));_0x320cc6['attributes']=_0x320cc6[_0xaefd('0x3c')][_0xaefd('0x3d')]?_0x320cc6[_0xaefd('0x3c')]:_0x17ba3d[_0xaefd('0x34')];_0x320cc6[_0xaefd('0x40')]=qs[_0xaefd('0x41')](_0x48e33f[_0xaefd('0x37')]['sort']);_0x320cc6[_0xaefd('0x42')]=qs[_0xaefd('0x39')](_['pick'](_0x48e33f['query'],_0x17ba3d[_0xaefd('0x39')]));if(_0x48e33f[_0xaefd('0x37')][_0xaefd('0x44')]){_0x320cc6['where']=_[_0xaefd('0x46')](_0x320cc6['where'],{'$or':_['map'](_0x320cc6[_0xaefd('0x3c')],function(_0x32045b){var _0x3056d2={};_0x3056d2[_0x32045b]={'$like':'%'+_0x48e33f[_0xaefd('0x37')][_0xaefd('0x44')]+'%'};return _0x3056d2;})});}_0x320cc6=_[_0xaefd('0x46')]({},_0x320cc6,_0x48e33f[_0xaefd('0x47')]);return _0x321b4c[_0xaefd('0x79')](_0x320cc6);}})[_0xaefd('0x2a')](function(_0x4e8481){if(_0x4e8481){_0x128a26=_0x4e8481[_0xaefd('0x3d')];if(!_0x48e33f[_0xaefd('0x37')][_0xaefd('0x3e')](_0xaefd('0x3f'))){_0x320cc6[_0xaefd('0x23')]=qs['limit'](_0x48e33f[_0xaefd('0x37')][_0xaefd('0x23')]);_0x320cc6['offset']=qs[_0xaefd('0x20')](_0x48e33f['query'][_0xaefd('0x20')]);}return _0x321b4c['getTeams'](_0x320cc6);}})['then'](function(_0x2d88da){if(_0x2d88da){return _0x2d88da?{'count':_0x128a26,'rows':_0x2d88da}:null;}})[_0xaefd('0x2a')](respondWithResult(_0x24c994,null))['catch'](handleError(_0x24c994,null));};exports[_0xaefd('0x7c')]=function(_0x1aa4f7,_0x67e396,_0x261efa){var _0x4e8867=_0x1aa4f7[_0xaefd('0x52')][_0xaefd('0x72')];var _0x5dad4e;return db[_0xaefd('0x7b')]['findAll']({'where':{'id':_0x4e8867},'attributes':['id'],'include':[{'model':db[_0xaefd('0x78')],'as':'Agents','attributes':['id','name','online','voicePause',_0xaefd('0x7d')],'raw':!![]}]})[_0xaefd('0x2a')](function(_0x3e7f61){if(_0x3e7f61){_0x5dad4e=_0x3e7f61;var _0x13fd50=_[_0xaefd('0x7e')](_0x3e7f61,function(_0x3a705b){var _0x46d502=_0x3a705b[_0xaefd('0x55')]({'plain':!![]});return _0x46d502[_0xaefd('0x7f')];});return db[_0xaefd('0x2f')]['find']({'where':{'id':_0x1aa4f7[_0xaefd('0x4d')]['id']}})['then'](function(_0x3dafc3){return db[_0xaefd('0x6f')][_0xaefd('0x51')](function(_0x336594){return _0x3dafc3[_0xaefd('0x7c')](_0x4e8867,{'transaction':_0x336594})['then'](function(){return BPromise['each'](_0x5dad4e,function(_0x27790f){return db['TeamVoicePrefix'][_0xaefd('0x80')]({'TeamId':_0x27790f['id'],'VoicePrefixId':_0x1aa4f7[_0xaefd('0x4d')]['id']},{'transaction':_0x336594});});})['then'](function(){return BPromise[_0xaefd('0x81')](_0x13fd50,function(_0x4887f7){return db[_0xaefd('0x82')]['findOrCreate']({'where':{'UserId':_0x4887f7['id'],'VoicePrefixId':_0x1aa4f7[_0xaefd('0x4d')]['id']},'transaction':_0x336594});});})['then'](function(){_0x13fd50[_0xaefd('0x83')](function(_0x47a053){socket['emit'](_0xaefd('0x84'),{'UserId':_0x47a053['id'],'VoicePrefixId':_0x3dafc3['id']});});});});});}})[_0xaefd('0x2a')](respondWithStatusCode(_0x67e396,null))[_0xaefd('0x4b')](handleError(_0x67e396,null));};exports[_0xaefd('0x85')]=function(_0x2f3049,_0x7fd0d8,_0x2efdca){return db[_0xaefd('0x7b')][_0xaefd('0x4a')]({'where':{'id':_0x2f3049[_0xaefd('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xaefd('0x78')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xaefd('0x2a')](handleEntityNotFound(_0x7fd0d8,null))[_0xaefd('0x2a')](function(_0x4c3cb0){var _0x7380d5=_['map'](_0x4c3cb0,'id');var _0x3723e6=[];var _0x58e4c5=[];var _0x42e09b=squel[_0xaefd('0x86')]();_0x42e09b['field'](_0xaefd('0x87'))['from']('team_has_voice_prefixes','tq')['join'](_0xaefd('0x88'),'ut',_0xaefd('0x89'))['where']('VoicePrefixId\x20=\x20?',_0x2f3049[_0xaefd('0x4d')]['id']);for(var _0x35b685=0x0;_0x35b685<_0x4c3cb0['length'];_0x35b685+=0x1){let _0x1af15a=_0x4c3cb0[_0x35b685];for(var _0x42c685=0x0;_0x42c685<_0x1af15a[_0xaefd('0x7f')][_0xaefd('0x3d')];_0x42c685+=0x1){let _0x2fe05a=_0x1af15a[_0xaefd('0x7f')][_0x42c685];var _0x4df2de=_0x42e09b['clone']();_0x4df2de[_0xaefd('0x42')]('ut.UserId\x20=\x20?',_0x2fe05a['id']);_0x58e4c5['push'](db[_0xaefd('0x6f')][_0xaefd('0x37')](_0x4df2de[_0xaefd('0x8a')](),{'type':db[_0xaefd('0x6f')][_0xaefd('0x8b')][_0xaefd('0x8c')]})['then'](function(_0x129a22){if(_0x129a22[_0xaefd('0x3d')]===0x1){return _0x2fe05a['id'];}else{var _0x1911a2=_[_0xaefd('0x8d')](_[_0xaefd('0x35')](_0x129a22,_0xaefd('0x8e')),function(_0x1ce217){return _['includes'](_0x7380d5,_0x1ce217);});if(_0x1911a2){return _0x2fe05a['id'];}}}));}}return BPromise[_0xaefd('0x8f')](_0x58e4c5)['then'](function(_0x1f0cc0){_0x3723e6=_(_0x3723e6)[_0xaefd('0x90')](_0x1f0cc0)[_0xaefd('0x91')]()[_0xaefd('0x92')]();return db[_0xaefd('0x2f')][_0xaefd('0x4e')]({'where':{'id':_0x2f3049[_0xaefd('0x4d')]['id']}})[_0xaefd('0x2a')](function(_0x34cc20){return db[_0xaefd('0x6f')][_0xaefd('0x51')](function(_0x5ee5cd){return _0x34cc20['removeTeams'](_0x2f3049[_0xaefd('0x37')][_0xaefd('0x72')],{'transaction':_0x5ee5cd})['then'](function(){if(!_[_0xaefd('0x93')](_0x3723e6)){return _0x34cc20[_0xaefd('0x74')](_0x3723e6,{'transaction':_0x5ee5cd});}})[_0xaefd('0x2a')](function(){_0x3723e6[_0xaefd('0x83')](function(_0x7a283b){socket[_0xaefd('0x75')]('userVoicePrefix:remove',{'UserId':_0x7a283b,'VoicePrefixId':_0x34cc20['id']});});});});});});})['then'](respondWithStatusCode(_0x7fd0d8,null))[_0xaefd('0x4b')](handleError(_0x7fd0d8,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7bea21b..1735a7b 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 _0x01bc=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x173e65,_0x24a8bf){var _0x37d496=function(_0x34b441){while(--_0x34b441){_0x173e65['push'](_0x173e65['shift']());}};_0x37d496(++_0x24a8bf);}(_0x01bc,0x178));var _0xc01b=function(_0x57c85c,_0xf2370c){_0x57c85c=_0x57c85c-0x0;var _0x4a5451=_0x01bc[_0x57c85c];return _0x4a5451;};'use strict';var EventEmitter=require(_0xc01b('0x0'));var VoicePrefix=require(_0xc01b('0x1'))['db'][_0xc01b('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc01b('0x3')](0x0);var events={'afterCreate':_0xc01b('0x4'),'afterUpdate':_0xc01b('0x5'),'afterDestroy':_0xc01b('0x6')};function emitEvent(_0x2b33c6){return function(_0x56a408,_0x3fba6d,_0x4e0d8b){VoicePrefixEvents[_0xc01b('0x7')](_0x2b33c6+':'+_0x56a408['id'],_0x56a408);VoicePrefixEvents[_0xc01b('0x7')](_0x2b33c6,_0x56a408);_0x4e0d8b(null);};}for(var e in events){if(events[_0xc01b('0x8')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xc01b('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0xb768=['remove','emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix','setMaxListeners','update'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xb768,0x1cc));var _0x8b76=function(_0x49b722,_0x2eb6c0){_0x49b722=_0x49b722-0x0;var _0xa8507f=_0xb768[_0x49b722];return _0xa8507f;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x8b76('0x0'))['db'][_0x8b76('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x8b76('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b76('0x3'),'afterDestroy':_0x8b76('0x4')};function emitEvent(_0x37b04d){return function(_0x53fd6c,_0xafdc85,_0x1086c4){VoicePrefixEvents[_0x8b76('0x5')](_0x37b04d+':'+_0x53fd6c['id'],_0x53fd6c);VoicePrefixEvents[_0x8b76('0x5')](_0x37b04d,_0x53fd6c);_0x1086c4(null);};}for(var e in events){if(events[_0x8b76('0x6')](e)){var event=events[e];VoicePrefix[_0x8b76('0x7')](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 c7b209e..474842e 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 _0x844a=['rimraf','../../config/environment','./voicePrefix.attributes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x844a,0xa8));var _0xa844=function(_0x97d796,_0x59428d){_0x97d796=_0x97d796-0x0;var _0x479de5=_0x844a[_0x97d796];return _0x479de5;};'use strict';var _=require(_0xa844('0x0'));var util=require(_0xa844('0x1'));var logger=require(_0xa844('0x2'))(_0xa844('0x3'));var moment=require(_0xa844('0x4'));var BPromise=require(_0xa844('0x5'));var rp=require(_0xa844('0x6'));var fs=require('fs');var path=require(_0xa844('0x7'));var rimraf=require(_0xa844('0x8'));var config=require(_0xa844('0x9'));var attributes=require(_0xa844('0xa'));module['exports']=function(_0x547b14,_0x3cb691){return _0x547b14['define']('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7ab=['bluebird','request-promise','path','rimraf','../../config/environment','define','VoicePrefix','lodash','util','../../config/logger','api'];(function(_0x4b110f,_0x43029b){var _0x4def47=function(_0x10eeef){while(--_0x10eeef){_0x4b110f['push'](_0x4b110f['shift']());}};_0x4def47(++_0x43029b);}(_0xb7ab,0x6a));var _0xbb7a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb7ab[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xbb7a('0x0'));var util=require(_0xbb7a('0x1'));var logger=require(_0xbb7a('0x2'))(_0xbb7a('0x3'));var moment=require('moment');var BPromise=require(_0xbb7a('0x4'));var rp=require(_0xbb7a('0x5'));var fs=require('fs');var path=require(_0xbb7a('0x6'));var rimraf=require(_0xbb7a('0x7'));var config=require(_0xbb7a('0x8'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x1af535,_0x2d27ee){return _0x1af535[_0xbb7a('0x9')](_0xbb7a('0xa'),attributes,{'tableName':'voice_prefixes','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 be38c98..1430aca 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 _0xd916=['../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2c7626,_0x6c430e){var _0x3a2add=function(_0x1f96a9){while(--_0x1f96a9){_0x2c7626['push'](_0x2c7626['shift']());}};_0x3a2add(++_0x6c430e);}(_0xd916,0x18a));var _0x6d91=function(_0x528385,_0x46c45c){_0x528385=_0x528385-0x0;var _0x44893c=_0xd916[_0x528385];return _0x44893c;};'use strict';var _=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var moment=require(_0x6d91('0x2'));var BPromise=require(_0x6d91('0x3'));var rs=require(_0x6d91('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d91('0x5'))['db'];var utils=require(_0x6d91('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6d91('0x7'));var jayson=require(_0x6d91('0x8'));var client=jayson['client'][_0x6d91('0x9')]({'port':0x232a});config[_0x6d91('0xa')]=_[_0x6d91('0xb')](config[_0x6d91('0xa')],{'host':_0x6d91('0xc'),'port':0x18eb});var socket=require(_0x6d91('0xd'))(new Redis(config[_0x6d91('0xa')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x598756,_0x5ae90d,_0xab3051){return new BPromise(function(_0xae0aa1,_0x2e2cdd){return client[_0x6d91('0xe')](_0x598756,_0xab3051)[_0x6d91('0xf')](function(_0x540ddd){logger[_0x6d91('0x10')](_0x6d91('0x11'),_0x5ae90d,_0x6d91('0x12'));logger[_0x6d91('0x13')](_0x6d91('0x14'),_0x5ae90d,_0x6d91('0x12'),JSON[_0x6d91('0x15')](_0x540ddd));if(_0x540ddd[_0x6d91('0x16')]){if(_0x540ddd[_0x6d91('0x16')][_0x6d91('0x17')]===0x1f4){logger[_0x6d91('0x16')](_0x6d91('0x11'),_0x5ae90d,_0x540ddd[_0x6d91('0x16')][_0x6d91('0x18')]);return _0x2e2cdd(_0x540ddd[_0x6d91('0x16')]['message']);}logger[_0x6d91('0x16')](_0x6d91('0x11'),_0x5ae90d,_0x540ddd[_0x6d91('0x16')][_0x6d91('0x18')]);return _0xae0aa1(_0x540ddd[_0x6d91('0x16')][_0x6d91('0x18')]);}else{logger['info'](_0x6d91('0x11'),_0x5ae90d,'request\x20sent');_0xae0aa1(_0x540ddd['result'][_0x6d91('0x18')]);}})['catch'](function(_0xa8cc9){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x5ae90d,_0xa8cc9);_0x2e2cdd(_0xa8cc9);});});} \ No newline at end of file +var _0x7bd0=['register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket'];(function(_0x2bbc9f,_0x5d0c94){var _0x5945be=function(_0x2b930d){while(--_0x2b930d){_0x2bbc9f['push'](_0x2bbc9f['shift']());}};_0x5945be(++_0x5d0c94);}(_0x7bd0,0x111));var _0x07bd=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0x7bd0[_0x403fc7];return _0x5d0827;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});config[_0x07bd('0xd')]=_[_0x07bd('0xe')](config['redis'],{'host':_0x07bd('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07bd('0xd')]));require(_0x07bd('0x10'))[_0x07bd('0x11')](socket);function respondWithRpcPromise(_0x5984fa,_0x2bace8,_0x141e8b){return new BPromise(function(_0x324a46,_0x169b07){return client['request'](_0x5984fa,_0x141e8b)[_0x07bd('0x12')](function(_0x313ca5){logger[_0x07bd('0x13')](_0x07bd('0x14'),_0x2bace8,_0x07bd('0x15'));logger[_0x07bd('0x16')](_0x07bd('0x17'),_0x2bace8,_0x07bd('0x15'),JSON['stringify'](_0x313ca5));if(_0x313ca5['error']){if(_0x313ca5[_0x07bd('0x18')][_0x07bd('0x19')]===0x1f4){logger[_0x07bd('0x18')](_0x07bd('0x14'),_0x2bace8,_0x313ca5[_0x07bd('0x18')][_0x07bd('0x1a')]);return _0x169b07(_0x313ca5[_0x07bd('0x18')]['message']);}logger[_0x07bd('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x2bace8,_0x313ca5[_0x07bd('0x18')][_0x07bd('0x1a')]);return _0x324a46(_0x313ca5[_0x07bd('0x18')][_0x07bd('0x1a')]);}else{logger[_0x07bd('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x2bace8,_0x07bd('0x15'));_0x324a46(_0x313ca5[_0x07bd('0x1b')]['message']);}})[_0x07bd('0x1c')](function(_0x72f775){logger[_0x07bd('0x18')](_0x07bd('0x14'),_0x2bace8,_0x72f775);_0x169b07(_0x72f775);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1c0e6c8..cf10958 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 _0x5106=['removeListener','register','./voicePrefix.events','remove'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5106,0x116));var _0x6510=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5106[_0x321bb2];return _0x9c12ed;};'use strict';var VoicePrefixEvents=require(_0x6510('0x0'));var events=['save',_0x6510('0x1'),'update'];function createListener(_0x183717,_0x4b0419){return function(_0x579fe8){_0x4b0419['emit'](_0x183717,_0x579fe8);};}function removeListener(_0x25620c,_0x4465c2){return function(){VoicePrefixEvents[_0x6510('0x2')](_0x25620c,_0x4465c2);};}exports[_0x6510('0x3')]=function(_0x28cb6e){for(var _0x2f5cb3=0x0,_0x485cfa=events['length'];_0x2f5cb3<_0x485cfa;_0x2f5cb3++){var _0x57164e=events[_0x2f5cb3];var _0x226e1a=createListener('voicePrefix:'+_0x57164e,_0x28cb6e);VoicePrefixEvents['on'](_0x57164e,_0x226e1a);}}; \ No newline at end of file +var _0x073e=['./voicePrefix.events','save','remove','update','emit','length','voicePrefix:'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0x073e,0x181));var _0xe073=function(_0x388d76,_0x692c8a){_0x388d76=_0x388d76-0x0;var _0x4aacc5=_0x073e[_0x388d76];return _0x4aacc5;};'use strict';var VoicePrefixEvents=require(_0xe073('0x0'));var events=[_0xe073('0x1'),_0xe073('0x2'),_0xe073('0x3')];function createListener(_0x4a6f42,_0x488838){return function(_0x4e8df8){_0x488838[_0xe073('0x4')](_0x4a6f42,_0x4e8df8);};}function removeListener(_0x4534b6,_0x29444b){return function(){VoicePrefixEvents['removeListener'](_0x4534b6,_0x29444b);};}exports['register']=function(_0x4bc6b3){for(var _0x45995e=0x0,_0x44092d=events[_0xe073('0x5')];_0x45995e<_0x44092d;_0x45995e++){var _0x3b4fc7=events[_0x45995e];var _0x373bf6=createListener(_0xe073('0x6')+_0x3b4fc7,_0x4bc6b3);VoicePrefixEvents['on'](_0x3b4fc7,_0x373bf6);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 2997931..f2799ea 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(_0x37bab4,_0x4fa85e){var _0x336d20=function(_0xdd4ab8){while(--_0xdd4ab8){_0x37bab4['push'](_0x37bab4['shift']());}};_0x336d20(++_0x4fa85e);}(_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/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5eff86,_0x2cdd22){_0x5eff86=_0x5eff86-0x0;var _0x4b3010=_0xb10b[_0x5eff86];return _0x4b3010;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index a008278..08dbab6 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 _0xd9a9=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\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','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','outbound','inbound','default','ENUM','ringall','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','type','dialMethod','strategy','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','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','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x26b0d4,_0x5b4ab5){var _0x4d1ece=function(_0x357f88){while(--_0x357f88){_0x26b0d4['push'](_0x26b0d4['shift']());}};_0x4d1ece(++_0x5b4ab5);}(_0xd9a9,0x108));var _0x9d9a=function(_0x4e473a,_0xb0239c){_0x4e473a=_0x4e473a-0x0;var _0x5acc04=_0xd9a9[_0x4e473a];return _0x5acc04;};'use strict';var Sequelize=require(_0x9d9a('0x0'));module['exports']={'name':{'type':Sequelize[_0x9d9a('0x1')],'allowNull':![],'unique':_0x9d9a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x9d9a('0x3')),'allowNull':![],'defaultValue':_0x9d9a('0x4')},'musiconhold':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':_0x9d9a('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x9d9a('0x6')]('rr',_0x9d9a('0x7'),'leastrecent','fewestcalls','random',_0x9d9a('0x8'),_0x9d9a('0x9'),_0x9d9a('0xa'),_0x9d9a('0xb')),'allowNull':![],'defaultValue':_0x9d9a('0x7'),'set':function(_0x50f4cd){this[_0x9d9a('0xc')]('strategy',_0x50f4cd?_0x50f4cd:_0x9d9a('0x8'));},'get':function(){var _0x29374a=this[_0x9d9a('0xd')](_0x9d9a('0xe'));var _0x731426=this[_0x9d9a('0xd')](_0x9d9a('0xf'));var _0x2cff9a=this[_0x9d9a('0xd')](_0x9d9a('0x10'));if(_0x29374a===_0x9d9a('0x3')){if(_0x731426===_0x9d9a('0x11')){return null;}if(_0x731426===_0x9d9a('0x12')&&![_0x9d9a('0x8'),_0x9d9a('0x13')][_0x9d9a('0x14')](_0x2cff9a)){this['setDataValue'](_0x9d9a('0x10'),_0x9d9a('0x8'));}}return _0x2cff9a;}},'servicelevel':{'type':Sequelize[_0x9d9a('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9d9a('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9d9a('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9d9a('0x1')]},'weight':{'type':Sequelize[_0x9d9a('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9d9a('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9d9a('0x6')](_0x9d9a('0x16'),'no'),'defaultValue':_0x9d9a('0x16')},'autopause':{'type':Sequelize[_0x9d9a('0x6')](_0x9d9a('0x16'),'no',_0x9d9a('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9d9a('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x9d9a('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9d9a('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9d9a('0x6')](_0x9d9a('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x9d9a('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x9d9a('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9d9a('0x6')](_0x9d9a('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9d9a('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9d9a('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9d9a('0x15')](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[_0x9d9a('0x6')](_0x9d9a('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9d9a('0x6')]('yes','no'),'defaultValue':_0x9d9a('0x16')},'announce_holdtime':{'type':Sequelize[_0x9d9a('0x6')](_0x9d9a('0x16'),'no',_0x9d9a('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9d9a('0x6')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x9d9a('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9d9a('0x1')]},'queue_youarenext':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9d9a('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9d9a('0x1')]},'queue_quantity1':{'type':Sequelize[_0x9d9a('0x1')]},'queue_quantity2':{'type':Sequelize[_0x9d9a('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x9d9a('0x19')],'set':function(_0x1becfd){this[_0x9d9a('0xc')]('periodic_announce',_0x1becfd?_0x1becfd[_0x9d9a('0x1a')](','):[]);},'get':function(){return this[_0x9d9a('0xd')]('periodic_announce')?this['getDataValue']('periodic_announce')[_0x9d9a('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x9d9a('0x16'),'set':function(_0x597e8a){this[_0x9d9a('0xc')](_0x9d9a('0x1c'),_0x597e8a?_0x597e8a[_0x9d9a('0x1a')](','):undefined);},'get':function(){return this[_0x9d9a('0xd')](_0x9d9a('0x1c'))?this['getDataValue'](_0x9d9a('0x1c'))[_0x9d9a('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':'no','set':function(_0x21725d){this[_0x9d9a('0xc')](_0x9d9a('0x1d'),_0x21725d?_0x21725d[_0x9d9a('0x1a')](','):undefined);},'get':function(){return this[_0x9d9a('0xd')](_0x9d9a('0x1d'))?this[_0x9d9a('0xd')](_0x9d9a('0x1d'))[_0x9d9a('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9d9a('0x6')](_0x9d9a('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9d9a('0x6')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9d9a('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9d9a('0x6')](_0x9d9a('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9d9a('0x1')]},'description':{'type':Sequelize[_0x9d9a('0x1')]},'acw':{'type':Sequelize[_0x9d9a('0x1e')],'defaultValue':0x0,'set':function(_0x11398e){this[_0x9d9a('0xc')](_0x9d9a('0x1f'),_0x11398e);if(_0x11398e){if(this[_0x9d9a('0xd')](_0x9d9a('0x20'))<0x2){this[_0x9d9a('0xc')](_0x9d9a('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9d9a('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9d9a('0x1e')],'defaultValue':0x0,'comment':_0x9d9a('0x21')},'dialMethod':{'type':Sequelize[_0x9d9a('0x6')]('preview',_0x9d9a('0x22'),_0x9d9a('0x23'),_0x9d9a('0x24'),_0x9d9a('0x12')),'defaultValue':_0x9d9a('0x22'),'comment':_0x9d9a('0x25')},'dialLimitChannel':{'type':Sequelize[_0x9d9a('0x15')](0x4)[_0x9d9a('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9d9a('0x27')},'dialLimitQueue':{'type':Sequelize[_0x9d9a('0x15')](0x4)[_0x9d9a('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x9d9a('0x28')](0x2)[_0x9d9a('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x9d9a('0x29'),_0x9d9a('0x2a')),'defaultValue':'dropRate','comment':_0x9d9a('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x9d9a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9d9a('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x9d9a('0x15')](0x3)[_0x9d9a('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9d9a('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9d9a('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9d9a('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x9d9a('0x15')](0x3)[_0x9d9a('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9d9a('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':'tTxX','comment':_0x9d9a('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x9d9a('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x9d9a('0x1')],'comment':_0x9d9a('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9d9a('0x15')](0x3)[_0x9d9a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9d9a('0x15')](0x5)[_0x9d9a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x9d9a('0x15')](0x3)[_0x9d9a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9d9a('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9d9a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9d9a('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9d9a('0x15')](0x3)[_0x9d9a('0x26')],'defaultValue':0x3,'comment':_0x9d9a('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9d9a('0x15')](0x5)[_0x9d9a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9d9a('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9d9a('0x35')},'dialTimezone':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':_0x9d9a('0x36')},'dialPrefix':{'type':Sequelize[_0x9d9a('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9d9a('0x6')](_0x9d9a('0x37'),_0x9d9a('0x38'),_0x9d9a('0x39')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x9d9a('0x1e')],'defaultValue':0x0,'comment':_0x9d9a('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x9d9a('0x15')](0x9)[_0x9d9a('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9d9a('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x9d9a('0x15')](0x9)[_0x9d9a('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9d9a('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9d9a('0x15')](0x9)[_0x9d9a('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9d9a('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9d9a('0x15')](0x9)[_0x9d9a('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9d9a('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0x9d9a('0x15')](0x9)[_0x9d9a('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9d9a('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9d9a('0x15')](0x9)[_0x9d9a('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9d9a('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9d9a('0x15')](0x9)[_0x9d9a('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9d9a('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9d9a('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9d9a('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9d9a('0x42')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x9d9a('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x9d9a('0x1e')],'defaultValue':0x0,'comment':_0x9d9a('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9d9a('0x6')]('DESC',_0x9d9a('0x44')),'defaultValue':_0x9d9a('0x45')},'dialQueueProject2':{'type':Sequelize[_0x9d9a('0x1')],'comment':_0x9d9a('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9d9a('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9d9a('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x9d9a('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9d9a('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x9d9a('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9d9a('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9d9a('0x15')](0x3)[_0x9d9a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9d9a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9d9a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9d9a('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9d9a('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9d9a('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9d9a('0x15')](0x5)[_0x9d9a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9d9a('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x9d9a('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9d9a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9d9a('0x15')](0x3)[_0x9d9a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9d9a('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9d9a('0x15')](0x5)[_0x9d9a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9d9a('0x1e')],'defaultValue':![],'comment':_0x9d9a('0x4c'),'set':function(_0x345f0f){if(!_0x345f0f)this[_0x9d9a('0xc')](_0x9d9a('0x4d'),null);this[_0x9d9a('0xc')](_0x9d9a('0x4e'),_0x345f0f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x9d9a('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9d9a('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9d9a('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9d9a('0x15')](0x3)[_0x9d9a('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x9d9a('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x202c=['Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','STRING','name','ENUM','inbound','outbound','leastrecent','fewestcalls','linear','rrordered','ringall','strategy','getDataValue','type','preview','roundrobin','setDataValue','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','booked','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC'];(function(_0x254744,_0x219e6b){var _0x2a6a96=function(_0x26aceb){while(--_0x26aceb){_0x254744['push'](_0x254744['shift']());}};_0x2a6a96(++_0x219e6b);}(_0x202c,0x122));var _0xc202=function(_0x1ea78c,_0x5227e6){_0x1ea78c=_0x1ea78c-0x0;var _0xcda3d4=_0x202c[_0x1ea78c];return _0xcda3d4;};'use strict';var Sequelize=require(_0xc202('0x0'));module[_0xc202('0x1')]={'name':{'type':Sequelize[_0xc202('0x2')],'allowNull':![],'unique':_0xc202('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc202('0x4')](_0xc202('0x5'),_0xc202('0x6')),'allowNull':![],'defaultValue':_0xc202('0x5')},'musiconhold':{'type':Sequelize[_0xc202('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0xc202('0x7'),_0xc202('0x8'),'random','rrmemory',_0xc202('0x9'),'wrandom',_0xc202('0xa')),'allowNull':![],'defaultValue':_0xc202('0xb'),'set':function(_0x2891ab){this['setDataValue'](_0xc202('0xc'),_0x2891ab?_0x2891ab:'rrmemory');},'get':function(){var _0x14ebd8=this[_0xc202('0xd')](_0xc202('0xe'));var _0x57ae36=this[_0xc202('0xd')]('dialMethod');var _0x585cd1=this['getDataValue'](_0xc202('0xc'));if(_0x14ebd8==='outbound'){if(_0x57ae36===_0xc202('0xf')){return null;}if(_0x57ae36==='booked'&&!['rrmemory',_0xc202('0x10')]['includes'](_0x585cd1)){this[_0xc202('0x11')](_0xc202('0xc'),'rrmemory');}}return _0x585cd1;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc202('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc202('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc202('0x2')]},'weight':{'type':Sequelize[_0xc202('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xc202('0x13'),'no'),'defaultValue':_0xc202('0x13')},'autopause':{'type':Sequelize[_0xc202('0x4')](_0xc202('0x13'),'no',_0xc202('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc202('0x12')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xc202('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc202('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc202('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc202('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc202('0x4')](_0xc202('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc202('0x4')](_0xc202('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc202('0x4')](_0xc202('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc202('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc202('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc202('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc202('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc202('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc202('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc202('0x4')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xc202('0x4')](_0xc202('0x13'),'no',_0xc202('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc202('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc202('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc202('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc202('0x2')]},'queue_youarenext':{'type':Sequelize[_0xc202('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc202('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc202('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc202('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc202('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc202('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc202('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc202('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xc202('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xc202('0x2')]},'queue_less_than':{'type':Sequelize[_0xc202('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xc28687){this[_0xc202('0x11')](_0xc202('0x16'),_0xc28687?_0xc28687[_0xc202('0x17')](','):[]);},'get':function(){return this[_0xc202('0xd')](_0xc202('0x16'))?this[_0xc202('0xd')]('periodic_announce')[_0xc202('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0xc202('0x2')],'defaultValue':_0xc202('0x13'),'set':function(_0x173ca7){this[_0xc202('0x11')](_0xc202('0x19'),_0x173ca7?_0x173ca7[_0xc202('0x17')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0xc202('0xd')](_0xc202('0x19'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc202('0x2')],'defaultValue':'no','set':function(_0x574885){this['setDataValue'](_0xc202('0x1a'),_0x574885?_0x574885[_0xc202('0x17')](','):undefined);},'get':function(){return this[_0xc202('0xd')]('leavewhenempty')?this[_0xc202('0xd')](_0xc202('0x1a'))[_0xc202('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc202('0x4')](_0xc202('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc202('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc202('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc202('0x2')]},'description':{'type':Sequelize[_0xc202('0x2')]},'acw':{'type':Sequelize[_0xc202('0x1b')],'defaultValue':0x0,'set':function(_0x59f9dc){this[_0xc202('0x11')](_0xc202('0x1c'),_0x59f9dc);if(_0x59f9dc){if(this[_0xc202('0xd')](_0xc202('0x1d'))<0x2){this['setDataValue'](_0xc202('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc202('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc202('0x1b')],'defaultValue':0x0,'comment':_0xc202('0x1e')},'dialMethod':{'type':Sequelize['ENUM'](_0xc202('0xf'),_0xc202('0x1f'),'power',_0xc202('0x20'),_0xc202('0x21')),'defaultValue':_0xc202('0x1f'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xc202('0x12')](0x4)[_0xc202('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc202('0x23')},'dialLimitQueue':{'type':Sequelize[_0xc202('0x12')](0x4)[_0xc202('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xc202('0x24')](0x2)[_0xc202('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xc202('0x4')]('agentBusyFactor',_0xc202('0x25')),'defaultValue':_0xc202('0x25'),'comment':_0xc202('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc202('0x24')](0x2)[_0xc202('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xc202('0x12')](0x3)[_0xc202('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc202('0x27')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc202('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc202('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc202('0x12')](0x3)[_0xc202('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc202('0x28')},'dialQueueOptions':{'type':Sequelize[_0xc202('0x2')],'defaultValue':_0xc202('0x29'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xc202('0x12')](0x3)[_0xc202('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc202('0x2a')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xc202('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc202('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc202('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc202('0x12')](0x5)[_0xc202('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc202('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xc202('0x12')](0x3)[_0xc202('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc202('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc202('0x12')](0x5)[_0xc202('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc202('0x22')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc202('0x12')](0x5)[_0xc202('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc202('0x12')](0x3)[_0xc202('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc202('0x2f')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc202('0x4')]('always',_0xc202('0x30'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xc202('0x1b')],'defaultValue':0x0,'comment':_0xc202('0x31')},'dialAMDInitialSilence':{'type':Sequelize[_0xc202('0x12')](0x9)[_0xc202('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc202('0x32')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc202('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc202('0x33')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc202('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc202('0x34')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc202('0x35')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc202('0x36')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc202('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc202('0x12')](0x9)[_0xc202('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc202('0x12')](0x5)[_0xc202('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc202('0x12')](0x9)[_0xc202('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc202('0x37')},'dialRecallMeTimeout':{'type':Sequelize[_0xc202('0x12')](0x5)[_0xc202('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc202('0x38')},'dialRecallInQueue':{'type':Sequelize[_0xc202('0x1b')],'defaultValue':0x0,'comment':_0xc202('0x39')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc202('0x4')](_0xc202('0x3a'),_0xc202('0x3b')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xc202('0x2')],'comment':_0xc202('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc202('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc202('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc202('0x12')](0x3)[_0xc202('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc202('0x3c')},'dialCutDigit':{'type':Sequelize[_0xc202('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc202('0x12')](0x3)[_0xc202('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc202('0x3d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc202('0x12')](0x5)[_0xc202('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc202('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc202('0x3e')},'dialDropRetryFrequency':{'type':Sequelize[_0xc202('0x12')](0x5)[_0xc202('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc202('0x3f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc202('0x12')](0x3)[_0xc202('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc202('0x40')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc202('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc202('0x41')},'dialMachineMaxRetry':{'type':Sequelize[_0xc202('0x12')](0x3)[_0xc202('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xc202('0x12')](0x5)[_0xc202('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc202('0x42')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc202('0x12')](0x3)[_0xc202('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc202('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc202('0x43')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xc202('0x44')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc202('0x45'),'set':function(_0x37822e){if(!_0x37822e)this[_0xc202('0x11')]('mandatoryDispositionPauseId',null);this[_0xc202('0x11')]('mandatoryDisposition',_0x37822e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc202('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc202('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc202('0x1b')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index db97eb1..ce27c3b 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 _0x41fe=['cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','destroy','error','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','includeAll','include','findAll','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','VoiceQueueId','CmHopper','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','pick','getTeams','Team','addTeams','teams','User','online','voicePause','flatMap','Agents','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','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?','push','toString','QueryTypes','SELECT','every','all','compact','transaction','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','interface','isArray','getAgents','getMembers','CmList','getLists','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','ListId\x20=\x20?','CmHopperId','OrderBy','h.id','ci.OrderBy+1'];(function(_0x300cdc,_0x9e6cde){var _0x4e62d2=function(_0x263063){while(--_0x263063){_0x300cdc['push'](_0x300cdc['shift']());}};_0x4e62d2(++_0x9e6cde);}(_0x41fe,0xd1));var _0xe41f=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x41fe[_0x48b810];return _0x23c17d;};'use strict';var emlformat=require(_0xe41f('0x0'));var rimraf=require(_0xe41f('0x1'));var zipdir=require(_0xe41f('0x2'));var jsonpatch=require(_0xe41f('0x3'));var rp=require(_0xe41f('0x4'));var moment=require(_0xe41f('0x5'));var BPromise=require(_0xe41f('0x6'));var Mustache=require(_0xe41f('0x7'));var util=require(_0xe41f('0x8'));var path=require(_0xe41f('0x9'));var sox=require(_0xe41f('0xa'));var csv=require(_0xe41f('0xb'));var ejs=require(_0xe41f('0xc'));var fs=require('fs');var fs_extra=require(_0xe41f('0xd'));var _=require(_0xe41f('0xe'));var squel=require(_0xe41f('0xf'));var crypto=require(_0xe41f('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xe41f('0x11'));var toCsv=require(_0xe41f('0xb'));var querystring=require('querystring');var Papa=require(_0xe41f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe41f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe41f('0x14'));var config=require(_0xe41f('0x15'));var licenseUtil=require(_0xe41f('0x16'));var db=require(_0xe41f('0x17'))['db'];config[_0xe41f('0x18')]=_[_0xe41f('0x19')](config[_0xe41f('0x18')],{'host':_0xe41f('0x1a'),'port':0x18eb});var socket=require(_0xe41f('0x1b'))(new Redis(config[_0xe41f('0x18')]));require('./voiceQueue.socket')[_0xe41f('0x1c')](socket);function respondWithStatusCode(_0x13a2dd,_0x544753){_0x544753=_0x544753||0xcc;return function(_0x16bc30){if(_0x16bc30){return _0x13a2dd[_0xe41f('0x1d')](_0x544753);}return _0x13a2dd[_0xe41f('0x1e')](_0x544753)[_0xe41f('0x1f')]();};}function respondWithResult(_0x194653,_0x3e4e83){_0x3e4e83=_0x3e4e83||0xc8;return function(_0xab3c7d){if(_0xab3c7d){return _0x194653['status'](_0x3e4e83)['json'](_0xab3c7d);}};}function respondWithFilteredResult(_0x2b5688,_0x5e59e2){return function(_0x5b5dd7){if(_0x5b5dd7){var _0x831479=typeof _0x5e59e2[_0xe41f('0x20')]===_0xe41f('0x21')&&typeof _0x5e59e2[_0xe41f('0x22')]===_0xe41f('0x21');var _0x5bd220=_0x5b5dd7[_0xe41f('0x23')];var _0x5339dd=_0x831479?0x0:_0x5e59e2[_0xe41f('0x20')];var _0x2c264c=_0x831479?_0x5b5dd7['count']:_0x5e59e2[_0xe41f('0x20')]+_0x5e59e2[_0xe41f('0x22')];var _0x171851;if(_0x2c264c>=_0x5bd220){_0x2c264c=_0x5bd220;_0x171851=0xc8;}else{_0x171851=0xce;}_0x2b5688['status'](_0x171851);return _0x2b5688[_0xe41f('0x24')](_0xe41f('0x25'),_0x5339dd+'-'+_0x2c264c+'/'+_0x5bd220)[_0xe41f('0x26')](_0x5b5dd7);}return null;};}function patchUpdates(_0x10ee63){return function(_0xa647ca){try{jsonpatch[_0xe41f('0x27')](_0xa647ca,_0x10ee63,!![]);}catch(_0x9c0c33){return BPromise['reject'](_0x9c0c33);}return _0xa647ca[_0xe41f('0x28')]();};}function saveUpdates(_0x5a443f,_0x4e8587){return function(_0x2f586e){if(_0x2f586e){return _0x2f586e[_0xe41f('0x29')](_0x5a443f)[_0xe41f('0x2a')](function(_0x4f7965){return _0x4f7965;});}return null;};}function removeEntity(_0x1ac25a,_0x573b3){return function(_0x115701){if(_0x115701){return _0x115701['destroy']()[_0xe41f('0x2a')](function(){var _0x5790ae=_0x115701[_0xe41f('0x2b')]({'plain':!![]});var _0x44fb04=[{'name':'VoiceQueues','value':_0xe41f('0x2c'),'ignore':![]},{'name':_0xe41f('0x2d'),'value':_0xe41f('0x2e'),'ignore':![]}];var _0x68f74c=_(_0x44fb04)[_0xe41f('0x2f')](_0xe41f('0x30'))[_0xe41f('0x31')](_0xe41f('0x32'))[_0xe41f('0x32')]();if(_[_0xe41f('0x33')](_0x68f74c,_0x5790ae[_0xe41f('0x34')])){return;}var _0x60008=_[_0xe41f('0x35')](_0x44fb04,[_0xe41f('0x32'),_0x5790ae[_0xe41f('0x34')]])['name'];return db[_0xe41f('0x36')][_0xe41f('0x37')]({'where':{'type':_0x60008,'resourceId':_0x5790ae['id']}})[_0xe41f('0x2a')](function(){return _0x115701;});})[_0xe41f('0x2a')](function(){_0x1ac25a[_0xe41f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b1e86,_0x157aa0){return function(_0x3a3dbe){if(!_0x3a3dbe){_0x3b1e86[_0xe41f('0x1d')](0x194);}return _0x3a3dbe;};}function handleError(_0x51a34a,_0x59794a){_0x59794a=_0x59794a||0x1f4;return function(_0x52e335){logger[_0xe41f('0x38')](_0x52e335[_0xe41f('0x39')]);if(_0x52e335[_0xe41f('0x3a')]){delete _0x52e335['name'];}_0x51a34a[_0xe41f('0x1e')](_0x59794a)[_0xe41f('0x3b')](_0x52e335);};}exports[_0xe41f('0x3c')]=function(_0x205f3a,_0x182e32){var _0x3d9090={},_0x44f99b={},_0x2bc67a={'count':0x0,'rows':[]};var _0x1c8ef2=_[_0xe41f('0x31')](db[_0xe41f('0x3d')][_0xe41f('0x3e')],function(_0x508d2a){return{'name':_0x508d2a[_0xe41f('0x3f')],'type':_0x508d2a['type'][_0xe41f('0x40')]};});_0x44f99b['model']=_[_0xe41f('0x31')](_0x1c8ef2,'name');_0x44f99b['query']=_[_0xe41f('0x41')](_0x205f3a[_0xe41f('0x42')]);_0x44f99b[_0xe41f('0x43')]=_[_0xe41f('0x44')](_0x44f99b[_0xe41f('0x45')],_0x44f99b['query']);_0x3d9090[_0xe41f('0x46')]=_[_0xe41f('0x44')](_0x44f99b[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0x205f3a[_0xe41f('0x42')][_0xe41f('0x47')]));_0x3d9090[_0xe41f('0x46')]=_0x3d9090['attributes'][_0xe41f('0x48')]?_0x3d9090[_0xe41f('0x46')]:_0x44f99b[_0xe41f('0x45')];if(!_0x205f3a[_0xe41f('0x42')][_0xe41f('0x49')](_0xe41f('0x4a'))){_0x3d9090[_0xe41f('0x22')]=qs[_0xe41f('0x22')](_0x205f3a[_0xe41f('0x42')]['limit']);_0x3d9090['offset']=qs[_0xe41f('0x20')](_0x205f3a['query'][_0xe41f('0x20')]);}_0x3d9090[_0xe41f('0x4b')]=qs[_0xe41f('0x4c')](_0x205f3a['query'][_0xe41f('0x4c')]);_0x3d9090[_0xe41f('0x4d')]=qs['filters'](_['pick'](_0x205f3a[_0xe41f('0x42')],_0x44f99b[_0xe41f('0x43')]),_0x1c8ef2);if(_0x205f3a[_0xe41f('0x42')][_0xe41f('0x2f')]){_0x3d9090[_0xe41f('0x4d')]=_[_0xe41f('0x4e')](_0x3d9090[_0xe41f('0x4d')],{'$or':_['map'](_0x1c8ef2,function(_0x255aa8){if(_0x255aa8[_0xe41f('0x34')]!=='VIRTUAL'){var _0x2bb953={};_0x2bb953[_0x255aa8['name']]={'$like':'%'+_0x205f3a[_0xe41f('0x42')][_0xe41f('0x2f')]+'%'};return _0x2bb953;}})});}_0x3d9090=_[_0xe41f('0x4e')]({},_0x3d9090,_0x205f3a['options']);var _0x3870a2={'where':_0x3d9090['where']};return db[_0xe41f('0x3d')][_0xe41f('0x23')](_0x3870a2)[_0xe41f('0x2a')](function(_0x16fd5c){_0x2bc67a[_0xe41f('0x23')]=_0x16fd5c;if(_0x205f3a[_0xe41f('0x42')][_0xe41f('0x4f')]){_0x3d9090[_0xe41f('0x50')]=[{'all':!![]}];}return db['VoiceQueue'][_0xe41f('0x51')](_0x3d9090);})['then'](function(_0x1688cb){_0x2bc67a['rows']=_0x1688cb;return _0x2bc67a;})[_0xe41f('0x2a')](respondWithFilteredResult(_0x182e32,_0x3d9090))[_0xe41f('0x52')](handleError(_0x182e32,null));};exports[_0xe41f('0x53')]=function(_0x35b7f5,_0x4be69e){var _0xf70388={'raw':![],'where':{'id':_0x35b7f5[_0xe41f('0x54')]['id']}},_0x49bcac={};_0x49bcac[_0xe41f('0x45')]=_[_0xe41f('0x41')](db[_0xe41f('0x3d')]['rawAttributes']);_0x49bcac[_0xe41f('0x42')]=_['keys'](_0x35b7f5['query']);_0x49bcac['filters']=_[_0xe41f('0x44')](_0x49bcac[_0xe41f('0x45')],_0x49bcac['query']);_0xf70388[_0xe41f('0x46')]=_[_0xe41f('0x44')](_0x49bcac[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0x35b7f5[_0xe41f('0x42')][_0xe41f('0x47')]));_0xf70388[_0xe41f('0x46')]=_0xf70388[_0xe41f('0x46')][_0xe41f('0x48')]?_0xf70388[_0xe41f('0x46')]:_0x49bcac['model'];if(_0x35b7f5[_0xe41f('0x42')][_0xe41f('0x4f')]){_0xf70388[_0xe41f('0x50')]=[{'all':!![]}];}_0xf70388=_['merge']({},_0xf70388,_0x35b7f5[_0xe41f('0x55')]);return db[_0xe41f('0x3d')][_0xe41f('0x35')](_0xf70388)[_0xe41f('0x2a')](handleEntityNotFound(_0x4be69e,null))[_0xe41f('0x2a')](respondWithResult(_0x4be69e,null))['catch'](handleError(_0x4be69e,null));};exports[_0xe41f('0x56')]=function(_0x33600c,_0x55594c){return db['VoiceQueue']['create'](_0x33600c[_0xe41f('0x57')],{})[_0xe41f('0x2a')](function(_0x2d8a6a){var _0x2136a5=_0x33600c[_0xe41f('0x58')][_0xe41f('0x2b')]({'plain':!![]});if(!_0x2136a5)throw new Error(_0xe41f('0x59'));if(_0x2136a5[_0xe41f('0x5a')]==='user'){var _0x1e70ba=_0x2d8a6a[_0xe41f('0x2b')]({'plain':!![]});var _0x5efe4e=[{'name':_0xe41f('0x5b'),'value':_0xe41f('0x2c')},{'name':'QueueCampaigns','value':_0xe41f('0x2e')}];var _0x107370=_['find'](_0x5efe4e,[_0xe41f('0x32'),_0x1e70ba[_0xe41f('0x34')]])[_0xe41f('0x3a')];return db[_0xe41f('0x5c')][_0xe41f('0x35')]({'where':{'name':_0x107370,'userProfileId':_0x2136a5[_0xe41f('0x5d')]},'raw':!![]})['then'](function(_0x1d5017){if(_0x1d5017&&_0x1d5017[_0xe41f('0x5e')]===0x0){return db['UserProfileResource'][_0xe41f('0x56')]({'name':_0x1e70ba[_0xe41f('0x3a')],'resourceId':_0x1e70ba['id'],'type':_0x1d5017[_0xe41f('0x3a')],'sectionId':_0x1d5017['id']},{})['then'](function(){return _0x2d8a6a;});}else{return _0x2d8a6a;}})[_0xe41f('0x52')](function(_0x2218dd){logger[_0xe41f('0x38')](_0xe41f('0x5f'),_0x2218dd);throw _0x2218dd;});}return _0x2d8a6a;})['then'](respondWithResult(_0x55594c,0xc9))[_0xe41f('0x52')](handleError(_0x55594c,null));};exports[_0xe41f('0x60')]=function(_0x51c5ae,_0x53781a){var _0x15ba6a={'where':{'id':_0x51c5ae['params']['id']}},_0x2e284e={};_0x2e284e[_0xe41f('0x45')]=_[_0xe41f('0x41')](db[_0xe41f('0x3d')]['rawAttributes']);_0x15ba6a[_0xe41f('0x46')]=_['intersection'](_0x2e284e[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0x51c5ae[_0xe41f('0x42')][_0xe41f('0x47')]));_0x15ba6a[_0xe41f('0x46')]=_0x15ba6a[_0xe41f('0x46')][_0xe41f('0x48')]?_0x15ba6a['attributes']:_0x2e284e[_0xe41f('0x45')];if(_0x51c5ae[_0xe41f('0x42')][_0xe41f('0x4f')]){_0x15ba6a['include']=[{'all':!![]}];}_0x15ba6a=_['merge']({},_0x15ba6a,_0x51c5ae['options']);return db[_0xe41f('0x3d')]['find'](_0x15ba6a)[_0xe41f('0x2a')](handleEntityNotFound(_0x53781a,null))['then'](function(_0x5c729d){if(_0x5c729d){var _0x4e01d4=_0x5c729d[_0xe41f('0x2b')]({'plain':!![]});_0x4e01d4=qs[_0xe41f('0x61')](_0x4e01d4,['id',_0xe41f('0x62'),_0xe41f('0x63')]);_0x51c5ae[_0xe41f('0x57')]=_['omit'](_0x51c5ae[_0xe41f('0x57')],['id',_0xe41f('0x62'),'updatedAt']);return db['VoiceQueue'][_0xe41f('0x56')](_['merge'](_0x4e01d4,_0x51c5ae[_0xe41f('0x57')]),{'include':_0x51c5ae[_0xe41f('0x42')][_0xe41f('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x524bc3){var _0x4fa7f0=_0x51c5ae['user']['get']({'plain':!![]});if(!_0x4fa7f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fa7f0[_0xe41f('0x5a')]===_0xe41f('0x58')){var _0x37471b=_0x524bc3[_0xe41f('0x2b')]({'plain':!![]});var _0x25a72e=[{'name':_0xe41f('0x5b'),'value':_0xe41f('0x2c')},{'name':_0xe41f('0x2d'),'value':_0xe41f('0x2e')}];var _0x585880=_['find'](_0x25a72e,[_0xe41f('0x32'),_0x37471b[_0xe41f('0x34')]])[_0xe41f('0x3a')];return db['UserProfileSection'][_0xe41f('0x35')]({'where':{'name':_0x585880,'userProfileId':_0x4fa7f0[_0xe41f('0x5d')]},'raw':!![]})[_0xe41f('0x2a')](function(_0x38b75c){if(_0x38b75c&&_0x38b75c[_0xe41f('0x5e')]===0x0){return db[_0xe41f('0x36')]['create']({'name':_0x37471b[_0xe41f('0x3a')],'resourceId':_0x37471b['id'],'type':_0x38b75c['name'],'sectionId':_0x38b75c['id']},{})[_0xe41f('0x2a')](function(){return _0x524bc3;});}else{return _0x524bc3;}})['catch'](function(_0x2cfa6c){logger[_0xe41f('0x38')](_0xe41f('0x5f'),_0x2cfa6c);throw _0x2cfa6c;});}return _0x524bc3;});}})[_0xe41f('0x2a')](respondWithResult(_0x53781a,0xc9))['catch'](handleError(_0x53781a,null));};exports['update']=function(_0x2e9ff9,_0x430dac){if(_0x2e9ff9[_0xe41f('0x57')]['id']){delete _0x2e9ff9[_0xe41f('0x57')]['id'];}return db[_0xe41f('0x3d')][_0xe41f('0x35')]({'where':{'id':_0x2e9ff9['params']['id']}})['then'](handleEntityNotFound(_0x430dac,null))['then'](saveUpdates(_0x2e9ff9['body'],null))[_0xe41f('0x2a')](respondWithResult(_0x430dac,null))[_0xe41f('0x52')](handleError(_0x430dac,null));};exports[_0xe41f('0x37')]=function(_0x45a51f,_0xb9c8d7){return db[_0xe41f('0x3d')][_0xe41f('0x35')]({'where':{'id':_0x45a51f['params']['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0xb9c8d7,null))[_0xe41f('0x2a')](removeEntity(_0xb9c8d7,null))[_0xe41f('0x52')](handleError(_0xb9c8d7,null));};exports[_0xe41f('0x64')]=function(_0x476cf6,_0x377930,_0xf6c719){var _0x300c5a={'raw':![],'where':{}};var _0x5ce1da={};var _0x326836={'count':0x0,'rows':[]};return db[_0xe41f('0x3d')][_0xe41f('0x65')]({'where':{'id':_0x476cf6[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x377930,null))['then'](function(_0x752620){if(_0x752620){_0x5ce1da[_0xe41f('0x45')]=_[_0xe41f('0x41')](db['CmHopper'][_0xe41f('0x3e')]);_0x5ce1da[_0xe41f('0x42')]=_[_0xe41f('0x41')](_0x476cf6[_0xe41f('0x42')]);_0x5ce1da[_0xe41f('0x43')]=_['intersection'](_0x5ce1da['model'],_0x5ce1da[_0xe41f('0x42')]);_0x300c5a[_0xe41f('0x46')]=_[_0xe41f('0x44')](_0x5ce1da[_0xe41f('0x45')],qs['fields'](_0x476cf6[_0xe41f('0x42')][_0xe41f('0x47')]));_0x300c5a['attributes']=_0x300c5a[_0xe41f('0x46')][_0xe41f('0x48')]?_0x300c5a[_0xe41f('0x46')]:_0x5ce1da[_0xe41f('0x45')];if(!_0x476cf6[_0xe41f('0x42')][_0xe41f('0x49')]('nolimit')){_0x300c5a[_0xe41f('0x22')]=qs[_0xe41f('0x22')](_0x476cf6[_0xe41f('0x42')][_0xe41f('0x22')]);_0x300c5a[_0xe41f('0x20')]=qs[_0xe41f('0x20')](_0x476cf6[_0xe41f('0x42')]['offset']);}_0x300c5a[_0xe41f('0x4b')]=qs['sort'](_0x476cf6[_0xe41f('0x42')][_0xe41f('0x4c')]);_0x300c5a[_0xe41f('0x4d')]=qs[_0xe41f('0x43')](_['pick'](_0x476cf6[_0xe41f('0x42')],_0x5ce1da['filters']));_0x300c5a[_0xe41f('0x4d')][_0xe41f('0x66')]=_0x752620['id'];if(_0x476cf6['query'][_0xe41f('0x2f')]){_0x300c5a[_0xe41f('0x4d')]=_['merge'](_0x300c5a['where'],{'$or':_[_0xe41f('0x31')](_0x300c5a[_0xe41f('0x46')],function(_0x422a0a){var _0x2a3bb6={};_0x2a3bb6[_0x422a0a]={'$like':'%'+_0x476cf6[_0xe41f('0x42')][_0xe41f('0x2f')]+'%'};return _0x2a3bb6;})});}_0x300c5a=_[_0xe41f('0x4e')]({},_0x300c5a,_0x476cf6[_0xe41f('0x55')]);return db[_0xe41f('0x67')][_0xe41f('0x23')]({'where':_0x300c5a['where']})[_0xe41f('0x2a')](function(_0x17bd89){_0x326836['count']=_0x17bd89;if(_0x476cf6[_0xe41f('0x42')][_0xe41f('0x4f')]){_0x300c5a[_0xe41f('0x50')]=[{'all':!![]}];}return db[_0xe41f('0x67')][_0xe41f('0x51')](_0x300c5a);})[_0xe41f('0x2a')](function(_0xb52da0){_0x326836[_0xe41f('0x68')]=_0xb52da0;return _0x326836;});}})[_0xe41f('0x2a')](respondWithFilteredResult(_0x377930,_0x300c5a))[_0xe41f('0x52')](handleError(_0x377930,null));};exports['getHopperHistories']=function(_0x489a94,_0x4cf71d,_0x2039b6){var _0x45fbb3={'raw':!![],'where':{}};var _0x22edc4={};var _0x4c5e53={'count':0x0,'rows':[]};return db[_0xe41f('0x3d')]['findOne']({'where':{'id':_0x489a94[_0xe41f('0x54')]['id']}})['then'](handleEntityNotFound(_0x4cf71d,null))[_0xe41f('0x2a')](function(_0x529033){if(_0x529033){_0x22edc4[_0xe41f('0x45')]=_[_0xe41f('0x41')](db[_0xe41f('0x69')][_0xe41f('0x3e')]);_0x22edc4['query']=_[_0xe41f('0x41')](_0x489a94[_0xe41f('0x42')]);_0x22edc4[_0xe41f('0x43')]=_[_0xe41f('0x44')](_0x22edc4[_0xe41f('0x45')],_0x22edc4[_0xe41f('0x42')]);_0x45fbb3[_0xe41f('0x46')]=_['intersection'](_0x22edc4[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0x489a94['query'][_0xe41f('0x47')]));_0x45fbb3[_0xe41f('0x46')]=_0x45fbb3['attributes']['length']?_0x45fbb3['attributes']:_0x22edc4[_0xe41f('0x45')];if(!_0x489a94[_0xe41f('0x42')]['hasOwnProperty'](_0xe41f('0x4a'))){_0x45fbb3[_0xe41f('0x22')]=qs[_0xe41f('0x22')](_0x489a94[_0xe41f('0x42')][_0xe41f('0x22')]);_0x45fbb3[_0xe41f('0x20')]=qs[_0xe41f('0x20')](_0x489a94[_0xe41f('0x42')][_0xe41f('0x20')]);}_0x45fbb3[_0xe41f('0x4b')]=qs[_0xe41f('0x4c')](_0x489a94[_0xe41f('0x42')][_0xe41f('0x4c')]);_0x45fbb3[_0xe41f('0x4d')]=qs[_0xe41f('0x43')](_['pick'](_0x489a94[_0xe41f('0x42')],_0x22edc4[_0xe41f('0x43')]));_0x45fbb3['where'][_0xe41f('0x66')]=_0x529033['id'];if(_0x489a94[_0xe41f('0x42')][_0xe41f('0x2f')]){_0x45fbb3[_0xe41f('0x4d')]=_[_0xe41f('0x4e')](_0x45fbb3[_0xe41f('0x4d')],{'$or':_[_0xe41f('0x31')](_0x45fbb3[_0xe41f('0x46')],function(_0x40b7cd){var _0x45f81f={};_0x45f81f[_0x40b7cd]={'$like':'%'+_0x489a94['query'][_0xe41f('0x2f')]+'%'};return _0x45f81f;})});}_0x45fbb3=_[_0xe41f('0x4e')]({},_0x45fbb3,_0x489a94[_0xe41f('0x55')]);return db[_0xe41f('0x69')]['count']({'where':_0x45fbb3['where']})[_0xe41f('0x2a')](function(_0xcddae3){_0x4c5e53[_0xe41f('0x23')]=_0xcddae3;if(_0x489a94['query'][_0xe41f('0x4f')]){_0x45fbb3[_0xe41f('0x50')]=[{'all':!![]}];}return db[_0xe41f('0x69')]['findAll'](_0x45fbb3);})['then'](function(_0x1a2194){_0x4c5e53['rows']=_0x1a2194;return _0x4c5e53;});}})[_0xe41f('0x2a')](respondWithFilteredResult(_0x4cf71d,_0x45fbb3))['catch'](handleError(_0x4cf71d,null));};exports[_0xe41f('0x6a')]=function(_0x2602ba,_0x2cd117,_0x56e207){var _0xb24bc={'raw':!![],'where':{}};var _0x3326c1={};var _0x5787b4={'count':0x0,'rows':[]};return db[_0xe41f('0x3d')][_0xe41f('0x65')]({'where':{'id':_0x2602ba[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x2cd117,null))[_0xe41f('0x2a')](function(_0x20e303){if(_0x20e303){_0x3326c1['model']=_[_0xe41f('0x41')](db[_0xe41f('0x6b')][_0xe41f('0x3e')]);_0x3326c1[_0xe41f('0x42')]=_['keys'](_0x2602ba[_0xe41f('0x42')]);_0x3326c1[_0xe41f('0x43')]=_[_0xe41f('0x44')](_0x3326c1[_0xe41f('0x45')],_0x3326c1[_0xe41f('0x42')]);_0xb24bc[_0xe41f('0x46')]=_[_0xe41f('0x44')](_0x3326c1[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0x2602ba[_0xe41f('0x42')]['fields']));_0xb24bc[_0xe41f('0x46')]=_0xb24bc[_0xe41f('0x46')][_0xe41f('0x48')]?_0xb24bc['attributes']:_0x3326c1[_0xe41f('0x45')];if(!_0x2602ba['query'][_0xe41f('0x49')](_0xe41f('0x4a'))){_0xb24bc[_0xe41f('0x22')]=qs[_0xe41f('0x22')](_0x2602ba[_0xe41f('0x42')][_0xe41f('0x22')]);_0xb24bc[_0xe41f('0x20')]=qs['offset'](_0x2602ba[_0xe41f('0x42')][_0xe41f('0x20')]);}_0xb24bc['order']=qs[_0xe41f('0x4c')](_0x2602ba[_0xe41f('0x42')]['sort']);_0xb24bc[_0xe41f('0x4d')]=qs[_0xe41f('0x43')](_['pick'](_0x2602ba['query'],_0x3326c1[_0xe41f('0x43')]));_0xb24bc['where'][_0xe41f('0x66')]=_0x20e303['id'];if(_0x2602ba[_0xe41f('0x42')][_0xe41f('0x2f')]){_0xb24bc[_0xe41f('0x4d')]=_[_0xe41f('0x4e')](_0xb24bc['where'],{'$or':_[_0xe41f('0x31')](_0xb24bc[_0xe41f('0x46')],function(_0x41810e){var _0x3cf75e={};_0x3cf75e[_0x41810e]={'$like':'%'+_0x2602ba[_0xe41f('0x42')][_0xe41f('0x2f')]+'%'};return _0x3cf75e;})});}_0xb24bc=_[_0xe41f('0x4e')]({},_0xb24bc,_0x2602ba[_0xe41f('0x55')]);return db[_0xe41f('0x6b')]['count']({'where':_0xb24bc[_0xe41f('0x4d')]})[_0xe41f('0x2a')](function(_0x1f5051){_0x5787b4['count']=_0x1f5051;if(_0x2602ba['query'][_0xe41f('0x4f')]){_0xb24bc['include']=[{'all':!![]}];}return db[_0xe41f('0x6b')][_0xe41f('0x51')](_0xb24bc);})[_0xe41f('0x2a')](function(_0x18ece8){_0x5787b4[_0xe41f('0x68')]=_0x18ece8;return _0x5787b4;});}})['then'](respondWithFilteredResult(_0x2cd117,_0xb24bc))[_0xe41f('0x52')](handleError(_0x2cd117,null));};exports[_0xe41f('0x6c')]=function(_0x1ba63c,_0x37a5ca,_0x48c4ca){var _0xef729b={'raw':!![],'where':{}};var _0x2e340a={};var _0x452a81={'count':0x0,'rows':[]};return db[_0xe41f('0x3d')][_0xe41f('0x65')]({'where':{'id':_0x1ba63c['params']['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x37a5ca,null))[_0xe41f('0x2a')](function(_0x3c9052){if(_0x3c9052){_0x2e340a['model']=_[_0xe41f('0x41')](db[_0xe41f('0x6d')][_0xe41f('0x3e')]);_0x2e340a[_0xe41f('0x42')]=_[_0xe41f('0x41')](_0x1ba63c['query']);_0x2e340a['filters']=_[_0xe41f('0x44')](_0x2e340a[_0xe41f('0x45')],_0x2e340a['query']);_0xef729b[_0xe41f('0x46')]=_[_0xe41f('0x44')](_0x2e340a[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0x1ba63c[_0xe41f('0x42')]['fields']));_0xef729b[_0xe41f('0x46')]=_0xef729b[_0xe41f('0x46')][_0xe41f('0x48')]?_0xef729b[_0xe41f('0x46')]:_0x2e340a['model'];if(!_0x1ba63c['query']['hasOwnProperty'](_0xe41f('0x4a'))){_0xef729b['limit']=qs['limit'](_0x1ba63c[_0xe41f('0x42')][_0xe41f('0x22')]);_0xef729b[_0xe41f('0x20')]=qs[_0xe41f('0x20')](_0x1ba63c['query'][_0xe41f('0x20')]);}_0xef729b[_0xe41f('0x4b')]=qs['sort'](_0x1ba63c[_0xe41f('0x42')][_0xe41f('0x4c')]);_0xef729b[_0xe41f('0x4d')]=qs[_0xe41f('0x43')](_[_0xe41f('0x6e')](_0x1ba63c[_0xe41f('0x42')],_0x2e340a[_0xe41f('0x43')]));_0xef729b[_0xe41f('0x4d')][_0xe41f('0x66')]=_0x3c9052['id'];if(_0x1ba63c[_0xe41f('0x42')][_0xe41f('0x2f')]){_0xef729b[_0xe41f('0x4d')]=_[_0xe41f('0x4e')](_0xef729b[_0xe41f('0x4d')],{'$or':_[_0xe41f('0x31')](_0xef729b[_0xe41f('0x46')],function(_0x1f9673){var _0x10d584={};_0x10d584[_0x1f9673]={'$like':'%'+_0x1ba63c[_0xe41f('0x42')][_0xe41f('0x2f')]+'%'};return _0x10d584;})});}_0xef729b=_[_0xe41f('0x4e')]({},_0xef729b,_0x1ba63c['options']);return db[_0xe41f('0x6d')]['count']({'where':_0xef729b[_0xe41f('0x4d')]})[_0xe41f('0x2a')](function(_0x5c89cb){_0x452a81[_0xe41f('0x23')]=_0x5c89cb;if(_0x1ba63c[_0xe41f('0x42')]['includeAll']){_0xef729b[_0xe41f('0x50')]=[{'all':!![]}];}return db[_0xe41f('0x6d')][_0xe41f('0x51')](_0xef729b);})[_0xe41f('0x2a')](function(_0x4cc611){_0x452a81['rows']=_0x4cc611;return _0x452a81;});}})[_0xe41f('0x2a')](respondWithFilteredResult(_0x37a5ca,_0xef729b))[_0xe41f('0x52')](handleError(_0x37a5ca,null));};exports[_0xe41f('0x6f')]=function(_0x181de3,_0x1aec9f,_0x23bf66){var _0x351563={};var _0x7f8b7f={};var _0x2ba720;var _0xbf2fcb;return db[_0xe41f('0x3d')][_0xe41f('0x65')]({'where':{'id':_0x181de3[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x1aec9f,null))[_0xe41f('0x2a')](function(_0x55322e){if(_0x55322e){_0x2ba720=_0x55322e;_0x7f8b7f[_0xe41f('0x45')]=_[_0xe41f('0x41')](db[_0xe41f('0x70')][_0xe41f('0x3e')]);_0x7f8b7f[_0xe41f('0x42')]=_[_0xe41f('0x41')](_0x181de3[_0xe41f('0x42')]);_0x7f8b7f[_0xe41f('0x43')]=_[_0xe41f('0x44')](_0x7f8b7f[_0xe41f('0x45')],_0x7f8b7f[_0xe41f('0x42')]);_0x351563['attributes']=_[_0xe41f('0x44')](_0x7f8b7f[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0x181de3['query'][_0xe41f('0x47')]));_0x351563[_0xe41f('0x46')]=_0x351563[_0xe41f('0x46')][_0xe41f('0x48')]?_0x351563['attributes']:_0x7f8b7f[_0xe41f('0x45')];_0x351563[_0xe41f('0x4b')]=qs['sort'](_0x181de3[_0xe41f('0x42')][_0xe41f('0x4c')]);_0x351563['where']=qs[_0xe41f('0x43')](_[_0xe41f('0x6e')](_0x181de3[_0xe41f('0x42')],_0x7f8b7f[_0xe41f('0x43')]));if(_0x181de3[_0xe41f('0x42')][_0xe41f('0x2f')]){_0x351563['where']=_[_0xe41f('0x4e')](_0x351563[_0xe41f('0x4d')],{'$or':_['map'](_0x351563[_0xe41f('0x46')],function(_0x622ec5){var _0x581769={};_0x581769[_0x622ec5]={'$like':'%'+_0x181de3[_0xe41f('0x42')]['filter']+'%'};return _0x581769;})});}_0x351563=_[_0xe41f('0x4e')]({},_0x351563,_0x181de3[_0xe41f('0x55')]);return _0x2ba720[_0xe41f('0x6f')](_0x351563);}})['then'](function(_0x597e95){if(_0x597e95){_0xbf2fcb=_0x597e95[_0xe41f('0x48')];if(!_0x181de3[_0xe41f('0x42')]['hasOwnProperty'](_0xe41f('0x4a'))){_0x351563[_0xe41f('0x22')]=qs[_0xe41f('0x22')](_0x181de3[_0xe41f('0x42')][_0xe41f('0x22')]);_0x351563[_0xe41f('0x20')]=qs['offset'](_0x181de3[_0xe41f('0x42')][_0xe41f('0x20')]);}return _0x2ba720[_0xe41f('0x6f')](_0x351563);}})[_0xe41f('0x2a')](function(_0x516507){if(_0x516507){return _0x516507?{'count':_0xbf2fcb,'rows':_0x516507}:null;}})[_0xe41f('0x2a')](respondWithResult(_0x1aec9f,null))[_0xe41f('0x52')](handleError(_0x1aec9f,null));};exports[_0xe41f('0x71')]=function(_0x5bd688,_0x1a7b27,_0x3c2f7d){var _0xe64ec=_0x5bd688[_0xe41f('0x57')][_0xe41f('0x72')];var _0x273370=_[_0xe41f('0x31')](_0xe64ec,'id');return db['Team'][_0xe41f('0x51')]({'where':{'id':_0x273370},'attributes':['id'],'include':[{'model':db[_0xe41f('0x73')],'as':'Agents','attributes':['id',_0xe41f('0x3a'),_0xe41f('0x74'),_0xe41f('0x75'),'interface'],'raw':!![]}]})[_0xe41f('0x2a')](function(_0x39fb4b){if(_0x39fb4b){var _0x10a093=_[_0xe41f('0x76')](_0x39fb4b,function(_0x18aa0f){var _0x1cc00c=_0x18aa0f[_0xe41f('0x2b')]({'plain':!![]});_0x1cc00c[_0xe41f('0x77')][_0xe41f('0x78')](function(_0x3fcb79){_0x3fcb79['penalty']=_[_0xe41f('0x35')](_0xe64ec,{'id':_0x1cc00c['id']})[_0xe41f('0x79')];});return _0x1cc00c[_0xe41f('0x77')];});return db[_0xe41f('0x3d')]['find']({'where':{'id':_0x5bd688[_0xe41f('0x54')]['id']}})['then'](function(_0x66b5b7){return db[_0xe41f('0x7a')]['transaction'](function(_0x3251b6){return _0x66b5b7['addTeams'](_0x273370,{'transaction':_0x3251b6})['then'](function(){return BPromise[_0xe41f('0x7b')](_0xe64ec,function(_0xdf55ce){return db[_0xe41f('0x7c')][_0xe41f('0x7d')]({'TeamId':_0xdf55ce['id'],'VoiceQueueId':_0x5bd688[_0xe41f('0x54')]['id'],'penalty':_0xdf55ce[_0xe41f('0x79')]},{'transaction':_0x3251b6});});})['then'](function(){return BPromise[_0xe41f('0x7b')](_0x10a093,function(_0x82c44e){return db[_0xe41f('0x7e')]['findOrCreate']({'where':{'UserId':_0x82c44e['id'],'VoiceQueueId':_0x5bd688[_0xe41f('0x54')]['id']},'defaults':{'penalty':_0x82c44e[_0xe41f('0x79')]},'transaction':_0x3251b6});});})['then'](function(){return BPromise[_0xe41f('0x7b')](_[_0xe41f('0x2f')](_0x10a093,{'online':!![]}),function(_0x338d90){return db[_0xe41f('0x7f')][_0xe41f('0x7d')]({'membername':_0x338d90[_0xe41f('0x3a')],'UserId':_0x338d90['id'],'queue_name':_0x66b5b7[_0xe41f('0x3a')],'VoiceQueueId':_0x66b5b7['id'],'interface':_[_0xe41f('0x80')](_0x338d90['interface'])?util[_0xe41f('0x81')]('SIP/%s',_0x338d90[_0xe41f('0x3a')]):_0x338d90['interface'],'paused':_0x338d90['voicePause']||![],'penalty':_0x338d90[_0xe41f('0x79')]},{'transaction':_0x3251b6});});})[_0xe41f('0x2a')](function(){_0x10a093[_0xe41f('0x78')](function(_0x5d655c){socket[_0xe41f('0x82')](_0xe41f('0x83'),{'UserId':_0x5d655c['id'],'VoiceQueueId':_0x66b5b7['id']});});});});});}})[_0xe41f('0x2a')](respondWithStatusCode(_0x1a7b27,null))[_0xe41f('0x52')](handleError(_0x1a7b27,null));};exports[_0xe41f('0x84')]=function(_0x440900,_0x275537,_0x589da8){return db['Team'][_0xe41f('0x51')]({'where':{'id':_0x440900['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe41f('0x73')],'as':_0xe41f('0x77'),'attributes':['id'],'raw':!![]}]})[_0xe41f('0x2a')](handleEntityNotFound(_0x275537,null))[_0xe41f('0x2a')](function(_0x5b8c7f){var _0x3ef844=_[_0xe41f('0x31')](_0x5b8c7f,'id');var _0x4dcf98=[];var _0x694b31=[];var _0x938753=squel[_0xe41f('0x85')]();_0x938753[_0xe41f('0x86')](_0xe41f('0x87'))[_0xe41f('0x88')](_0xe41f('0x89'),'tq')[_0xe41f('0x8a')](_0xe41f('0x8b'),'ut',_0xe41f('0x8c'))[_0xe41f('0x4d')](_0xe41f('0x8d'),_0x440900[_0xe41f('0x54')]['id']);for(var _0x5b1b2b=0x0;_0x5b1b2b<_0x5b8c7f['length'];_0x5b1b2b+=0x1){let _0x5cf61d=_0x5b8c7f[_0x5b1b2b];for(var _0x1959ae=0x0;_0x1959ae<_0x5cf61d[_0xe41f('0x77')][_0xe41f('0x48')];_0x1959ae+=0x1){let _0x4d3b75=_0x5cf61d[_0xe41f('0x77')][_0x1959ae];var _0x1d1a29=_0x938753[_0xe41f('0x60')]();_0x1d1a29[_0xe41f('0x4d')](_0xe41f('0x8e'),_0x4d3b75['id']);_0x694b31[_0xe41f('0x8f')](db['sequelize']['query'](_0x1d1a29[_0xe41f('0x90')](),{'type':db[_0xe41f('0x7a')][_0xe41f('0x91')][_0xe41f('0x92')]})[_0xe41f('0x2a')](function(_0x1b3d0e){if(_0x1b3d0e[_0xe41f('0x48')]===0x1){return _0x4d3b75['id'];}else{var _0x424237=_[_0xe41f('0x93')](_[_0xe41f('0x31')](_0x1b3d0e,'TeamId'),function(_0x3c4401){return _[_0xe41f('0x33')](_0x3ef844,_0x3c4401);});if(_0x424237){return _0x4d3b75['id'];}}}));}}return BPromise[_0xe41f('0x94')](_0x694b31)['then'](function(_0x5adb43){_0x4dcf98=_(_0x4dcf98)['union'](_0x5adb43)[_0xe41f('0x95')]()[_0xe41f('0x32')]();return db[_0xe41f('0x3d')][_0xe41f('0x35')]({'where':{'id':_0x440900[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](function(_0x1efb37){return db[_0xe41f('0x7a')][_0xe41f('0x96')](function(_0x3f2ed1){return _0x1efb37[_0xe41f('0x84')](_0x440900[_0xe41f('0x42')][_0xe41f('0x97')],{'transaction':_0x3f2ed1})[_0xe41f('0x2a')](function(){if(!_[_0xe41f('0x98')](_0x4dcf98)){return _0x1efb37[_0xe41f('0x99')](_0x4dcf98,{'transaction':_0x3f2ed1})['then'](function(){return db[_0xe41f('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x440900[_0xe41f('0x54')]['id'],'UserId':_0x4dcf98},'transaction':_0x3f2ed1});});}})['then'](function(){_0x4dcf98[_0xe41f('0x78')](function(_0x23daf4){socket[_0xe41f('0x82')](_0xe41f('0x9a'),{'UserId':_0x23daf4,'VoiceQueueId':_0x1efb37['id']});});});});});});})[_0xe41f('0x2a')](respondWithStatusCode(_0x275537,null))[_0xe41f('0x52')](handleError(_0x275537,null));};exports['addAgents']=function(_0x43d098,_0x1fdbab,_0x1a3a40){var _0x248862,_0xc14491;return db[_0xe41f('0x3d')][_0xe41f('0x35')]({'where':{'id':_0x43d098[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x1fdbab,null))[_0xe41f('0x2a')](function(_0x34fa74){if(_0x34fa74){_0xc14491=_0x34fa74;return _0x34fa74[_0xe41f('0x9b')](_0x43d098['body'][_0xe41f('0x97')],_[_0xe41f('0x61')](_0x43d098['body'],[_0xe41f('0x97'),'id'])||{})[_0xe41f('0x9c')](function(_0x1fb2bc){for(var _0x2c2b50=0x0;_0x2c2b50<_0x43d098[_0xe41f('0x57')]['ids'][_0xe41f('0x48')];_0x2c2b50+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x43d098[_0xe41f('0x57')][_0xe41f('0x97')][_0x2c2b50]),'VoiceQueueId':Number(_0x43d098[_0xe41f('0x54')]['id'])});}return _0x1fb2bc;});}})[_0xe41f('0x2a')](function(_0x42f566){_0x248862=_0x42f566||[];if(_0xc14491){return db[_0xe41f('0x73')]['findAll']({'where':{'id':_0x43d098['body']['ids']},'attributes':['id',_0xe41f('0x3a'),_0xe41f('0x74'),_0xe41f('0x75'),_0xe41f('0x9d')],'raw':!![]});}})[_0xe41f('0x2a')](function(_0x9f112a){if(!_[_0xe41f('0x98')](_0x9f112a)){var _0x2ed35f=[];for(var _0x4dab0a=0x0;_0x4dab0a<_0x9f112a[_0xe41f('0x48')];_0x4dab0a++){if(_0x9f112a[_0x4dab0a][_0xe41f('0x74')]){_0x2ed35f['push'](db[_0xe41f('0x7f')]['upsert']({'membername':_0x9f112a[_0x4dab0a][_0xe41f('0x3a')],'UserId':_0x9f112a[_0x4dab0a]['id'],'queue_name':_0xc14491['name'],'VoiceQueueId':_0xc14491['id'],'interface':_['isNil'](_0x9f112a[_0x4dab0a][_0xe41f('0x9d')])?util['format']('SIP/%s',_0x9f112a[_0x4dab0a]['name']):_0x9f112a[_0x4dab0a]['interface'],'paused':_0x9f112a[_0x4dab0a][_0xe41f('0x75')]||![],'penalty':_0x43d098[_0xe41f('0x57')][_0xe41f('0x79')]||0x0}));}}return BPromise[_0xe41f('0x94')](_0x2ed35f);}})[_0xe41f('0x2a')](function(){return _0x248862;})[_0xe41f('0x2a')](respondWithResult(_0x1fdbab,null))['catch'](handleError(_0x1fdbab,null));};exports['removeAgents']=function(_0x153b80,_0x349006,_0x12a52b){return db['VoiceQueue'][_0xe41f('0x35')]({'where':{'id':_0x153b80[_0xe41f('0x54')]['id']}})['then'](handleEntityNotFound(_0x349006,null))[_0xe41f('0x2a')](function(_0x3942fb){if(_0x3942fb){return _0x3942fb['removeAgents'](_0x153b80[_0xe41f('0x42')][_0xe41f('0x97')])['then'](function(){if(_[_0xe41f('0x9e')](_0x153b80[_0xe41f('0x42')][_0xe41f('0x97')])){for(var _0x3ac8e2=0x0;_0x3ac8e2<_0x153b80[_0xe41f('0x42')]['ids'][_0xe41f('0x48')];_0x3ac8e2+=0x1){socket[_0xe41f('0x82')](_0xe41f('0x9a'),{'UserId':Number(_0x153b80['query'][_0xe41f('0x97')][_0x3ac8e2]),'VoiceQueueId':Number(_0x153b80[_0xe41f('0x54')]['id'])});}}else{socket[_0xe41f('0x82')](_0xe41f('0x9a'),{'UserId':Number(_0x153b80[_0xe41f('0x42')]['ids']),'VoiceQueueId':Number(_0x153b80['params']['id'])});}});}})['then'](function(_0x1fb204){return db[_0xe41f('0x7f')][_0xe41f('0x37')]({'where':{'VoiceQueueId':_0x153b80[_0xe41f('0x54')]['id'],'UserId':_0x153b80[_0xe41f('0x42')][_0xe41f('0x97')]}})[_0xe41f('0x2a')](function(){return _0x1fb204;});})[_0xe41f('0x2a')](respondWithStatusCode(_0x349006,null))[_0xe41f('0x52')](handleError(_0x349006,null));};exports[_0xe41f('0x9f')]=function(_0x5701e4,_0x57ff12,_0x4c8582){var _0x442878={};var _0x4aea75={};var _0x48deac;var _0x3d9469;return db[_0xe41f('0x3d')][_0xe41f('0x65')]({'where':{'id':_0x5701e4[_0xe41f('0x54')]['id']}})['then'](handleEntityNotFound(_0x57ff12,null))['then'](function(_0x1a923a){if(_0x1a923a){_0x48deac=_0x1a923a;_0x4aea75[_0xe41f('0x45')]=_['keys'](db[_0xe41f('0x73')]['rawAttributes']);_0x4aea75[_0xe41f('0x42')]=_['keys'](_0x5701e4[_0xe41f('0x42')]);_0x4aea75[_0xe41f('0x43')]=_['intersection'](_0x4aea75['model'],_0x4aea75[_0xe41f('0x42')]);_0x442878[_0xe41f('0x46')]=_[_0xe41f('0x44')](_0x4aea75[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0x5701e4[_0xe41f('0x42')]['fields']));_0x442878[_0xe41f('0x46')]=_0x442878[_0xe41f('0x46')][_0xe41f('0x48')]?_0x442878['attributes']:_0x4aea75['model'];_0x442878[_0xe41f('0x4b')]=qs['sort'](_0x5701e4[_0xe41f('0x42')]['sort']);_0x442878['where']=qs[_0xe41f('0x43')](_['pick'](_0x5701e4[_0xe41f('0x42')],_0x4aea75[_0xe41f('0x43')]));if(_0x5701e4['query'][_0xe41f('0x2f')]){_0x442878[_0xe41f('0x4d')]=_['merge'](_0x442878[_0xe41f('0x4d')],{'$or':_[_0xe41f('0x31')](_0x442878[_0xe41f('0x46')],function(_0x466077){var _0x1dff28={};_0x1dff28[_0x466077]={'$like':'%'+_0x5701e4[_0xe41f('0x42')]['filter']+'%'};return _0x1dff28;})});}_0x442878=_[_0xe41f('0x4e')]({},_0x442878,_0x5701e4[_0xe41f('0x55')]);return _0x48deac[_0xe41f('0x9f')](_0x442878);}})[_0xe41f('0x2a')](function(_0x1eaeee){if(_0x1eaeee){_0x3d9469=_0x1eaeee['length'];if(!_0x5701e4['query']['hasOwnProperty'](_0xe41f('0x4a'))){_0x442878['limit']=qs[_0xe41f('0x22')](_0x5701e4['query']['limit']);_0x442878[_0xe41f('0x20')]=qs[_0xe41f('0x20')](_0x5701e4['query'][_0xe41f('0x20')]);}return _0x48deac[_0xe41f('0x9f')](_0x442878);}})[_0xe41f('0x2a')](function(_0x7c3b2d){if(_0x7c3b2d){return _0x7c3b2d?{'count':_0x3d9469,'rows':_0x7c3b2d}:null;}})['then'](respondWithResult(_0x57ff12,null))[_0xe41f('0x52')](handleError(_0x57ff12,null));};exports['getMembers']=function(_0x558089,_0x107fe,_0x3af5a8){var _0x573564={};var _0x29a104={};var _0x58ce5d;var _0x11adf2;return db['VoiceQueue'][_0xe41f('0x65')]({'where':{'id':_0x558089['params']['id']}})['then'](handleEntityNotFound(_0x107fe,null))[_0xe41f('0x2a')](function(_0x2c0573){if(_0x2c0573){_0x58ce5d=_0x2c0573;_0x29a104[_0xe41f('0x45')]=_[_0xe41f('0x41')](db['UserVoiceQueueRt']['rawAttributes']);_0x29a104[_0xe41f('0x42')]=_[_0xe41f('0x41')](_0x558089[_0xe41f('0x42')]);_0x29a104[_0xe41f('0x43')]=_[_0xe41f('0x44')](_0x29a104[_0xe41f('0x45')],_0x29a104[_0xe41f('0x42')]);_0x573564[_0xe41f('0x46')]=_[_0xe41f('0x44')](_0x29a104[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0x558089[_0xe41f('0x42')]['fields']));_0x573564['attributes']=_0x573564['attributes'][_0xe41f('0x48')]?_0x573564[_0xe41f('0x46')]:_0x29a104['model'];_0x573564[_0xe41f('0x4b')]=qs[_0xe41f('0x4c')](_0x558089['query']['sort']);_0x573564[_0xe41f('0x4d')]=qs[_0xe41f('0x43')](_[_0xe41f('0x6e')](_0x558089[_0xe41f('0x42')],_0x29a104[_0xe41f('0x43')]));if(_0x558089['query'][_0xe41f('0x2f')]){_0x573564[_0xe41f('0x4d')]=_[_0xe41f('0x4e')](_0x573564[_0xe41f('0x4d')],{'$or':_[_0xe41f('0x31')](_0x573564[_0xe41f('0x46')],function(_0x4ba713){var _0x32f7fd={};_0x32f7fd[_0x4ba713]={'$like':'%'+_0x558089['query']['filter']+'%'};return _0x32f7fd;})});}_0x573564=_['merge']({},_0x573564,_0x558089['options']);return _0x58ce5d[_0xe41f('0xa0')](_0x573564);}})['then'](function(_0x45885b){if(_0x45885b){_0x11adf2=_0x45885b[_0xe41f('0x48')];if(!_0x558089[_0xe41f('0x42')][_0xe41f('0x49')](_0xe41f('0x4a'))){_0x573564['limit']=qs[_0xe41f('0x22')](_0x558089[_0xe41f('0x42')][_0xe41f('0x22')]);_0x573564[_0xe41f('0x20')]=qs[_0xe41f('0x20')](_0x558089[_0xe41f('0x42')][_0xe41f('0x20')]);}return _0x58ce5d[_0xe41f('0xa0')](_0x573564);}})[_0xe41f('0x2a')](function(_0x5cf60b){return _0x5cf60b?{'count':_0x11adf2,'rows':_0x5cf60b}:null;})[_0xe41f('0x2a')](respondWithResult(_0x107fe,null))[_0xe41f('0x52')](handleError(_0x107fe,null));};exports['getLists']=function(_0xe7bc4d,_0x188fac,_0x4322a4){var _0x17166e={};var _0x4054a0={};var _0x1e7da7;var _0x26257d;return db['VoiceQueue'][_0xe41f('0x65')]({'where':{'id':_0xe7bc4d[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x188fac,null))['then'](function(_0x482b7d){if(_0x482b7d){_0x1e7da7=_0x482b7d;_0x4054a0[_0xe41f('0x45')]=_[_0xe41f('0x41')](db[_0xe41f('0xa1')]['rawAttributes']);_0x4054a0['query']=_[_0xe41f('0x41')](_0xe7bc4d[_0xe41f('0x42')]);_0x4054a0[_0xe41f('0x43')]=_['intersection'](_0x4054a0[_0xe41f('0x45')],_0x4054a0[_0xe41f('0x42')]);_0x17166e[_0xe41f('0x46')]=_[_0xe41f('0x44')](_0x4054a0[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0xe7bc4d[_0xe41f('0x42')][_0xe41f('0x47')]));_0x17166e[_0xe41f('0x46')]=_0x17166e[_0xe41f('0x46')][_0xe41f('0x48')]?_0x17166e[_0xe41f('0x46')]:_0x4054a0[_0xe41f('0x45')];_0x17166e[_0xe41f('0x4b')]=qs[_0xe41f('0x4c')](_0xe7bc4d['query']['sort']);_0x17166e[_0xe41f('0x4d')]=qs['filters'](_['pick'](_0xe7bc4d[_0xe41f('0x42')],_0x4054a0[_0xe41f('0x43')]));if(_0xe7bc4d[_0xe41f('0x42')]['filter']){_0x17166e[_0xe41f('0x4d')]=_[_0xe41f('0x4e')](_0x17166e[_0xe41f('0x4d')],{'$or':_[_0xe41f('0x31')](_0x17166e[_0xe41f('0x46')],function(_0x401376){var _0x25e06c={};_0x25e06c[_0x401376]={'$like':'%'+_0xe7bc4d[_0xe41f('0x42')]['filter']+'%'};return _0x25e06c;})});}_0x17166e=_['merge']({},_0x17166e,_0xe7bc4d[_0xe41f('0x55')]);return _0x1e7da7[_0xe41f('0xa2')](_0x17166e);}})[_0xe41f('0x2a')](function(_0x5e3a22){if(_0x5e3a22){_0x26257d=_0x5e3a22['length'];if(!_0xe7bc4d[_0xe41f('0x42')]['hasOwnProperty'](_0xe41f('0x4a'))){_0x17166e[_0xe41f('0x22')]=qs[_0xe41f('0x22')](_0xe7bc4d[_0xe41f('0x42')][_0xe41f('0x22')]);_0x17166e['offset']=qs[_0xe41f('0x20')](_0xe7bc4d[_0xe41f('0x42')][_0xe41f('0x20')]);}return _0x1e7da7[_0xe41f('0xa2')](_0x17166e);}})[_0xe41f('0x2a')](function(_0x598f89){if(_0x598f89){return _0x598f89?{'count':_0x26257d,'rows':_0x598f89}:null;}})[_0xe41f('0x2a')](respondWithResult(_0x188fac,null))['catch'](handleError(_0x188fac,null));};exports['addLists']=function(_0x5dfc9f,_0x46c3b2,_0x535909){var _0x45f61a=moment()[_0xe41f('0x81')](_0xe41f('0xa3'));var _0x3d9c82,_0x332518;return db[_0xe41f('0x3d')][_0xe41f('0x35')]({'where':{'id':_0x5dfc9f[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x46c3b2,null))[_0xe41f('0x2a')](function(_0x2864c3){if(_0x2864c3){_0x332518=_0x2864c3;return _0x2864c3[_0xe41f('0xa4')](_0x5dfc9f[_0xe41f('0x57')][_0xe41f('0x97')],_[_0xe41f('0x61')](_0x5dfc9f[_0xe41f('0x57')],[_0xe41f('0x97'),'id'])||{});}return null;})[_0xe41f('0x9c')](function(_0x4ff5a9){var _0x38d8ad;_0x3d9c82=_0x4ff5a9||[];var _0x4bb242=[];if(_0x4ff5a9){for(var _0x5ab070=0x0;_0x5ab070<_0x4ff5a9[_0xe41f('0x48')];_0x5ab070+=0x1){var _0x14e00b=_0x4ff5a9[_0x5ab070]['get']({'plain':!![]});_0x332518[_0xe41f('0xa5')]=_0x5dfc9f[_0xe41f('0x57')][_0xe41f('0xa5')]?_0x5dfc9f[_0xe41f('0x57')][_0xe41f('0xa5')]:_0x332518[_0xe41f('0xa5')];switch(_0x332518['dialCheckDuplicateType']){case _0xe41f('0xa6'):_0x38d8ad=squel[_0xe41f('0xa7')]()[_0xe41f('0xa8')](_0xe41f('0xa9'))['fromQuery']([_0xe41f('0xaa'),_0xe41f('0xab'),_0xe41f('0xac'),'ListId',_0xe41f('0x66'),_0xe41f('0x62'),_0xe41f('0x63')],squel[_0xe41f('0x85')]()[_0xe41f('0x86')](_0xe41f('0xaa'),'phone')[_0xe41f('0x86')]('\x27'+_0x45f61a+'\x27',_0xe41f('0xab'))['field']('id','ContactId')[_0xe41f('0x86')](_0x14e00b[_0xe41f('0xad')]['toString'](),_0xe41f('0xae'))[_0xe41f('0x86')](_0x5dfc9f['params']['id']['toString'](),'VoiceQueueId')[_0xe41f('0x86')]('\x27'+_0x45f61a+'\x27',_0xe41f('0x62'))['field']('\x27'+_0x45f61a+'\x27','updatedAt')[_0xe41f('0x88')](_0xe41f('0xaf'))['where'](_0xe41f('0xb0'))[_0xe41f('0x4d')]('ListId\x20=\x20?',_0x14e00b[_0xe41f('0xad')][_0xe41f('0x90')]())[_0xe41f('0x4d')](_0xe41f('0xb1'))[_0xe41f('0x4d')](_0xe41f('0xb2'),squel['select']()['field'](_0xe41f('0xb3'))[_0xe41f('0x88')](_0xe41f('0xb4'))[_0xe41f('0x4d')](_0xe41f('0x8d'),_0x5dfc9f[_0xe41f('0x54')]['id'][_0xe41f('0x90')]()))[_0xe41f('0x4d')](_0xe41f('0xb2'),squel[_0xe41f('0x85')]()[_0xe41f('0x86')](_0xe41f('0xb5'))[_0xe41f('0x88')](_0xe41f('0xa9'))[_0xe41f('0x4d')](_0xe41f('0x8d'),_0x5dfc9f['params']['id'][_0xe41f('0x90')]())))[_0xe41f('0x90')]();break;case _0xe41f('0xb6'):_0x38d8ad=squel[_0xe41f('0xa7')]()[_0xe41f('0xa8')](_0xe41f('0xa9'))[_0xe41f('0xb7')]([_0xe41f('0xaa'),_0xe41f('0xab'),'ContactId',_0xe41f('0xae'),_0xe41f('0x66'),_0xe41f('0x62'),'updatedAt'],squel[_0xe41f('0x85')]()[_0xe41f('0x86')](_0xe41f('0xaa'),_0xe41f('0xaa'))[_0xe41f('0x86')]('\x27'+_0x45f61a+'\x27',_0xe41f('0xab'))[_0xe41f('0x86')]('id',_0xe41f('0xac'))[_0xe41f('0x86')](_0x14e00b[_0xe41f('0xad')][_0xe41f('0x90')](),'ListId')[_0xe41f('0x86')](_0x5dfc9f['params']['id'][_0xe41f('0x90')](),_0xe41f('0x66'))[_0xe41f('0x86')]('\x27'+_0x45f61a+'\x27',_0xe41f('0x62'))['field']('\x27'+_0x45f61a+'\x27',_0xe41f('0x63'))['from'](_0xe41f('0xaf'))['where'](_0xe41f('0xb0'))['where']('ListId\x20=\x20?',_0x14e00b['CmListId']['toString']())['where'](_0xe41f('0xb1'))[_0xe41f('0x4d')](_0xe41f('0xb2'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xe41f('0x88')]('cm_hopper')[_0xe41f('0x4d')]('VoiceQueueId\x20=\x20?',_0x5dfc9f[_0xe41f('0x54')]['id']['toString']())))[_0xe41f('0x90')]();break;default:_0x38d8ad=squel[_0xe41f('0xa7')]()['into'](_0xe41f('0xa9'))[_0xe41f('0xb7')]([_0xe41f('0xaa'),_0xe41f('0xab'),_0xe41f('0xac'),_0xe41f('0xae'),_0xe41f('0x66'),_0xe41f('0x62'),'updatedAt'],squel[_0xe41f('0x85')]()[_0xe41f('0x86')](_0xe41f('0xaa'),_0xe41f('0xaa'))['field']('\x27'+_0x45f61a+'\x27','scheduledAt')[_0xe41f('0x86')]('id',_0xe41f('0xac'))['field'](_0x14e00b[_0xe41f('0xad')][_0xe41f('0x90')](),_0xe41f('0xae'))['field'](_0x5dfc9f[_0xe41f('0x54')]['id'][_0xe41f('0x90')](),_0xe41f('0x66'))['field']('\x27'+_0x45f61a+'\x27',_0xe41f('0x62'))[_0xe41f('0x86')]('\x27'+_0x45f61a+'\x27',_0xe41f('0x63'))[_0xe41f('0x88')](_0xe41f('0xaf'))[_0xe41f('0x4d')](_0xe41f('0xb0'))[_0xe41f('0x4d')](_0xe41f('0xb8'),_0x14e00b[_0xe41f('0xad')][_0xe41f('0x90')]())['where'](_0xe41f('0xb1')))[_0xe41f('0x90')]();}_0x4bb242[_0xe41f('0x8f')](db['sequelize'][_0xe41f('0x42')](_0x38d8ad));}return BPromise['all'](_0x4bb242);}})[_0xe41f('0x2a')](function(){var _0x21b49b=[];var _0x138421=squel[_0xe41f('0xa7')]()['into']('cm_hopper_additional_phones')[_0xe41f('0xb7')]([_0xe41f('0xb9'),_0xe41f('0xaa'),_0xe41f('0xba'),_0xe41f('0x62'),'updatedAt'],squel[_0xe41f('0x85')]()['field'](_0xe41f('0xbb'))[_0xe41f('0x86')]('ci.item')[_0xe41f('0x86')](_0xe41f('0xbc'))[_0xe41f('0x86')]('\x27'+_0x45f61a+'\x27',_0xe41f('0x62'))[_0xe41f('0x86')]('\x27'+_0x45f61a+'\x27',_0xe41f('0x63'))[_0xe41f('0x88')](_0xe41f('0xbd'),'ci')[_0xe41f('0x8a')](_0xe41f('0xa9'),'h',_0xe41f('0xbe'))[_0xe41f('0x4d')](_0xe41f('0xbf'),_0x45f61a)[_0xe41f('0x4d')](_0xe41f('0xc0'),'PHONE'))[_0xe41f('0x90')]();_0x21b49b[_0xe41f('0x8f')](db[_0xe41f('0x7a')][_0xe41f('0x42')](_0x138421));return BPromise['all'](_0x21b49b);})[_0xe41f('0x2a')](function(){return _0x3d9c82;})[_0xe41f('0x2a')](respondWithResult(_0x46c3b2,null))[_0xe41f('0x52')](handleError(_0x46c3b2,null));};exports[_0xe41f('0xc1')]=function(_0x69b1af,_0x361c2b,_0x11a1a4){return db['VoiceQueue'][_0xe41f('0x35')]({'where':{'id':_0x69b1af['params']['id']}})['then'](handleEntityNotFound(_0x361c2b,null))[_0xe41f('0x2a')](function(_0x28a226){if(_0x28a226){return _0x28a226[_0xe41f('0xc1')](_0x69b1af[_0xe41f('0x42')]['ids']);}})['then'](function(_0x1cb07a){if(_0x1cb07a){return db[_0xe41f('0x67')][_0xe41f('0x37')]({'where':{'ListId':_0x69b1af['query'][_0xe41f('0x97')],'VoiceQueueId':_0x69b1af[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](function(){return _0x1cb07a;});}})[_0xe41f('0x2a')](respondWithStatusCode(_0x361c2b,null))[_0xe41f('0x52')](handleError(_0x361c2b,null));};exports[_0xe41f('0xc2')]=function(_0x304f4c,_0x4b245c,_0x588857){var _0x30eea4={};var _0x4bef34={};var _0x4e8e6c;var _0x131c3f;return db[_0xe41f('0x3d')][_0xe41f('0x65')]({'where':{'id':_0x304f4c[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x4b245c,null))[_0xe41f('0x2a')](function(_0x4621c7){if(_0x4621c7){_0x4e8e6c=_0x4621c7;_0x4bef34[_0xe41f('0x45')]=_['keys'](db[_0xe41f('0xa1')][_0xe41f('0x3e')]);_0x4bef34['query']=_[_0xe41f('0x41')](_0x304f4c[_0xe41f('0x42')]);_0x4bef34['filters']=_[_0xe41f('0x44')](_0x4bef34[_0xe41f('0x45')],_0x4bef34[_0xe41f('0x42')]);_0x30eea4['attributes']=_[_0xe41f('0x44')](_0x4bef34[_0xe41f('0x45')],qs[_0xe41f('0x47')](_0x304f4c['query'][_0xe41f('0x47')]));_0x30eea4[_0xe41f('0x46')]=_0x30eea4[_0xe41f('0x46')]['length']?_0x30eea4['attributes']:_0x4bef34[_0xe41f('0x45')];_0x30eea4[_0xe41f('0x4b')]=qs[_0xe41f('0x4c')](_0x304f4c[_0xe41f('0x42')][_0xe41f('0x4c')]);_0x30eea4[_0xe41f('0x4d')]=qs[_0xe41f('0x43')](_[_0xe41f('0x6e')](_0x304f4c[_0xe41f('0x42')],_0x4bef34[_0xe41f('0x43')]));if(_0x304f4c[_0xe41f('0x42')][_0xe41f('0x2f')]){_0x30eea4['where']=_[_0xe41f('0x4e')](_0x30eea4[_0xe41f('0x4d')],{'$or':_[_0xe41f('0x31')](_0x30eea4[_0xe41f('0x46')],function(_0x736931){var _0x3490f0={};_0x3490f0[_0x736931]={'$like':'%'+_0x304f4c[_0xe41f('0x42')][_0xe41f('0x2f')]+'%'};return _0x3490f0;})});}_0x30eea4=_[_0xe41f('0x4e')]({},_0x30eea4,_0x304f4c['options']);return _0x4e8e6c[_0xe41f('0xc2')](_0x30eea4);}})['then'](function(_0x518a56){if(_0x518a56){_0x131c3f=_0x518a56[_0xe41f('0x48')];if(!_0x304f4c[_0xe41f('0x42')]['hasOwnProperty'](_0xe41f('0x4a'))){_0x30eea4['limit']=qs[_0xe41f('0x22')](_0x304f4c[_0xe41f('0x42')][_0xe41f('0x22')]);_0x30eea4[_0xe41f('0x20')]=qs[_0xe41f('0x20')](_0x304f4c['query'][_0xe41f('0x20')]);}return _0x4e8e6c[_0xe41f('0xc2')](_0x30eea4);}})[_0xe41f('0x2a')](function(_0x2363e9){if(_0x2363e9){return _0x2363e9?{'count':_0x131c3f,'rows':_0x2363e9}:null;}})[_0xe41f('0x2a')](respondWithResult(_0x4b245c,null))[_0xe41f('0x52')](handleError(_0x4b245c,null));};exports[_0xe41f('0xc3')]=function(_0x491127,_0x24cb4f,_0x53b5dd){var _0x50c1e6,_0x181eb1;return db[_0xe41f('0x3d')][_0xe41f('0x35')]({'where':{'id':_0x491127[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x24cb4f,null))[_0xe41f('0x2a')](function(_0x3020f9){if(_0x3020f9){_0x181eb1=_0x3020f9;return _0x3020f9[_0xe41f('0xc3')](_0x491127[_0xe41f('0x57')][_0xe41f('0x97')],_['omit'](_0x491127[_0xe41f('0x57')],[_0xe41f('0x97'),'id'])||{});}return null;})['spread'](function(_0x424d30){var _0x3a744c;_0x50c1e6=_0x424d30||[];var _0x2727a2=[];if(_0x424d30){for(var _0x4afb28=0x0;_0x4afb28<_0x424d30['length'];_0x4afb28+=0x1){var _0x5dff85=_0x424d30[_0x4afb28][_0xe41f('0x2b')]({'plain':!![]});_0x3a744c=squel['insert']()[_0xe41f('0xa8')](_0xe41f('0xc4'))['fromQuery'](['phone',_0xe41f('0xac'),_0xe41f('0xae'),'VoiceQueueId',_0xe41f('0x62'),_0xe41f('0x63')],squel[_0xe41f('0x85')]()[_0xe41f('0x86')]('phone','phone')[_0xe41f('0x86')]('id',_0xe41f('0xac'))['field'](_0x5dff85[_0xe41f('0xad')][_0xe41f('0x90')](),_0xe41f('0xae'))['field'](_0x491127[_0xe41f('0x54')]['id']['toString'](),_0xe41f('0x66'))[_0xe41f('0x86')](_0xe41f('0xc5'),_0xe41f('0x62'))[_0xe41f('0x86')](_0xe41f('0xc5'),'updatedAt')[_0xe41f('0x88')](_0xe41f('0xaf'))[_0xe41f('0x4d')](_0xe41f('0xb0'))[_0xe41f('0x4d')](_0xe41f('0xb8'),_0x5dff85[_0xe41f('0xad')]['toString']())[_0xe41f('0x4d')](_0xe41f('0xb1')))['toString']();_0x2727a2[_0xe41f('0x8f')](db[_0xe41f('0x7a')][_0xe41f('0x42')](_0x3a744c));}return BPromise['all'](_0x2727a2);}})[_0xe41f('0x2a')](function(){return _0x50c1e6;})[_0xe41f('0x2a')](respondWithResult(_0x24cb4f,null))['catch'](handleError(_0x24cb4f,null));};exports[_0xe41f('0xc6')]=function(_0x56fb3a,_0x3c81aa,_0x5d7880){return db['VoiceQueue'][_0xe41f('0x35')]({'where':{'id':_0x56fb3a[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x3c81aa,null))[_0xe41f('0x2a')](function(_0x4431ce){if(_0x4431ce){return _0x4431ce['removeBlackLists'](_0x56fb3a[_0xe41f('0x42')][_0xe41f('0x97')]);}})['then'](function(_0x26c2dd){if(_0x26c2dd){return db[_0xe41f('0x6d')]['destroy']({'where':{'ListId':_0x56fb3a[_0xe41f('0x42')][_0xe41f('0x97')],'VoiceQueueId':_0x56fb3a[_0xe41f('0x54')]['id']}})[_0xe41f('0x2a')](function(){return _0x26c2dd;});}})['then'](respondWithStatusCode(_0x3c81aa,null))[_0xe41f('0x52')](handleError(_0x3c81aa,null));}; \ No newline at end of file +var _0x4753=['order','sort','where','merge','options','include','findAll','rows','catch','params','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','outbound','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','pick','getHopperHistories','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','voicePause','interface','flatMap','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','onlyIfOpen','into','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','filter','ignore','map','value','type','find','end','error','stack','name','send','index','VoiceQueue','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1cbb0f,_0x3c6ae6){var _0x3b8532=function(_0x492b29){while(--_0x492b29){_0x1cbb0f['push'](_0x1cbb0f['shift']());}};_0x3b8532(++_0x3c6ae6);}(_0x4753,0x1f4));var _0x3475=function(_0x3028ab,_0x3d59a6){_0x3028ab=_0x3028ab-0x0;var _0x2a787b=_0x4753[_0x3028ab];return _0x2a787b;};'use strict';var emlformat=require(_0x3475('0x0'));var rimraf=require(_0x3475('0x1'));var zipdir=require(_0x3475('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3475('0x3'));var moment=require(_0x3475('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3475('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3475('0x6'));var fs=require('fs');var fs_extra=require(_0x3475('0x7'));var _=require('lodash');var squel=require(_0x3475('0x8'));var crypto=require(_0x3475('0x9'));var jsforce=require(_0x3475('0xa'));var deskjs=require(_0x3475('0xb'));var toCsv=require(_0x3475('0xc'));var querystring=require(_0x3475('0xd'));var Papa=require(_0x3475('0xe'));var Redis=require(_0x3475('0xf'));var authService=require(_0x3475('0x10'));var qs=require(_0x3475('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3475('0x12'));var logger=require(_0x3475('0x13'))(_0x3475('0x14'));var utils=require('../../config/utils');var config=require(_0x3475('0x15'));var licenseUtil=require(_0x3475('0x16'));var db=require('../../mysqldb')['db'];config[_0x3475('0x17')]=_['defaults'](config[_0x3475('0x17')],{'host':_0x3475('0x18'),'port':0x18eb});var socket=require(_0x3475('0x19'))(new Redis(config['redis']));require(_0x3475('0x1a'))[_0x3475('0x1b')](socket);function respondWithStatusCode(_0x306cd8,_0x219520){_0x219520=_0x219520||0xcc;return function(_0x4b5bc4){if(_0x4b5bc4){return _0x306cd8[_0x3475('0x1c')](_0x219520);}return _0x306cd8['status'](_0x219520)['end']();};}function respondWithResult(_0x3fd0d2,_0x1dd054){_0x1dd054=_0x1dd054||0xc8;return function(_0x325fe5){if(_0x325fe5){return _0x3fd0d2[_0x3475('0x1d')](_0x1dd054)[_0x3475('0x1e')](_0x325fe5);}};}function respondWithFilteredResult(_0x49ba96,_0x1e1cb0){return function(_0x547009){if(_0x547009){var _0x12a893=typeof _0x1e1cb0[_0x3475('0x1f')]===_0x3475('0x20')&&typeof _0x1e1cb0[_0x3475('0x21')]==='undefined';var _0x3711a1=_0x547009['count'];var _0x3ab7a8=_0x12a893?0x0:_0x1e1cb0[_0x3475('0x1f')];var _0x2e53a9=_0x12a893?_0x547009[_0x3475('0x22')]:_0x1e1cb0['offset']+_0x1e1cb0[_0x3475('0x21')];var _0xdac710;if(_0x2e53a9>=_0x3711a1){_0x2e53a9=_0x3711a1;_0xdac710=0xc8;}else{_0xdac710=0xce;}_0x49ba96[_0x3475('0x1d')](_0xdac710);return _0x49ba96['set'](_0x3475('0x23'),_0x3ab7a8+'-'+_0x2e53a9+'/'+_0x3711a1)[_0x3475('0x1e')](_0x547009);}return null;};}function patchUpdates(_0x438992){return function(_0x38ea14){try{jsonpatch[_0x3475('0x24')](_0x38ea14,_0x438992,!![]);}catch(_0x44b708){return BPromise[_0x3475('0x25')](_0x44b708);}return _0x38ea14[_0x3475('0x26')]();};}function saveUpdates(_0x10746b,_0x3ade34){return function(_0x1d0e95){if(_0x1d0e95){return _0x1d0e95[_0x3475('0x27')](_0x10746b)[_0x3475('0x28')](function(_0x4ff2a1){return _0x4ff2a1;});}return null;};}function removeEntity(_0x4d35f9,_0x52c825){return function(_0x552cc){if(_0x552cc){return _0x552cc[_0x3475('0x29')]()['then'](function(){var _0x1f3481=_0x552cc[_0x3475('0x2a')]({'plain':!![]});var _0x6a0197=[{'name':_0x3475('0x2b'),'value':_0x3475('0x2c'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x307467=_(_0x6a0197)[_0x3475('0x2d')](_0x3475('0x2e'))[_0x3475('0x2f')](_0x3475('0x30'))[_0x3475('0x30')]();if(_['includes'](_0x307467,_0x1f3481[_0x3475('0x31')])){return;}var _0x1b6ef3=_[_0x3475('0x32')](_0x6a0197,[_0x3475('0x30'),_0x1f3481[_0x3475('0x31')]])['name'];return db['UserProfileResource'][_0x3475('0x29')]({'where':{'type':_0x1b6ef3,'resourceId':_0x1f3481['id']}})[_0x3475('0x28')](function(){return _0x552cc;});})[_0x3475('0x28')](function(){_0x4d35f9['status'](0xcc)[_0x3475('0x33')]();});}};}function handleEntityNotFound(_0x40d37a,_0x2554b5){return function(_0x10ec45){if(!_0x10ec45){_0x40d37a[_0x3475('0x1c')](0x194);}return _0x10ec45;};}function handleError(_0x4362ad,_0xb4cc70){_0xb4cc70=_0xb4cc70||0x1f4;return function(_0x580942){logger[_0x3475('0x34')](_0x580942[_0x3475('0x35')]);if(_0x580942[_0x3475('0x36')]){delete _0x580942[_0x3475('0x36')];}_0x4362ad[_0x3475('0x1d')](_0xb4cc70)[_0x3475('0x37')](_0x580942);};}exports[_0x3475('0x38')]=function(_0x1dfd4c,_0x784ef8){var _0x651d4c={},_0x501775={},_0x49d11d={'count':0x0,'rows':[]};var _0x229124=_[_0x3475('0x2f')](db[_0x3475('0x39')][_0x3475('0x3a')],function(_0x3bc3fd){return{'name':_0x3bc3fd['fieldName'],'type':_0x3bc3fd['type'][_0x3475('0x3b')]};});_0x501775[_0x3475('0x3c')]=_[_0x3475('0x2f')](_0x229124,_0x3475('0x36'));_0x501775['query']=_[_0x3475('0x3d')](_0x1dfd4c[_0x3475('0x3e')]);_0x501775[_0x3475('0x3f')]=_[_0x3475('0x40')](_0x501775[_0x3475('0x3c')],_0x501775[_0x3475('0x3e')]);_0x651d4c[_0x3475('0x41')]=_[_0x3475('0x40')](_0x501775[_0x3475('0x3c')],qs[_0x3475('0x42')](_0x1dfd4c[_0x3475('0x3e')]['fields']));_0x651d4c['attributes']=_0x651d4c[_0x3475('0x41')][_0x3475('0x43')]?_0x651d4c[_0x3475('0x41')]:_0x501775[_0x3475('0x3c')];if(!_0x1dfd4c[_0x3475('0x3e')][_0x3475('0x44')](_0x3475('0x45'))){_0x651d4c[_0x3475('0x21')]=qs['limit'](_0x1dfd4c[_0x3475('0x3e')][_0x3475('0x21')]);_0x651d4c[_0x3475('0x1f')]=qs['offset'](_0x1dfd4c[_0x3475('0x3e')][_0x3475('0x1f')]);}_0x651d4c[_0x3475('0x46')]=qs[_0x3475('0x47')](_0x1dfd4c['query'][_0x3475('0x47')]);_0x651d4c[_0x3475('0x48')]=qs[_0x3475('0x3f')](_['pick'](_0x1dfd4c[_0x3475('0x3e')],_0x501775['filters']),_0x229124);if(_0x1dfd4c[_0x3475('0x3e')][_0x3475('0x2d')]){_0x651d4c[_0x3475('0x48')]=_[_0x3475('0x49')](_0x651d4c[_0x3475('0x48')],{'$or':_['map'](_0x229124,function(_0x264209){if(_0x264209['type']!=='VIRTUAL'){var _0x327288={};_0x327288[_0x264209[_0x3475('0x36')]]={'$like':'%'+_0x1dfd4c['query'][_0x3475('0x2d')]+'%'};return _0x327288;}})});}_0x651d4c=_[_0x3475('0x49')]({},_0x651d4c,_0x1dfd4c[_0x3475('0x4a')]);var _0x394d62={'where':_0x651d4c['where']};return db['VoiceQueue'][_0x3475('0x22')](_0x394d62)['then'](function(_0x492218){_0x49d11d['count']=_0x492218;if(_0x1dfd4c[_0x3475('0x3e')]['includeAll']){_0x651d4c[_0x3475('0x4b')]=[{'all':!![]}];}return db[_0x3475('0x39')][_0x3475('0x4c')](_0x651d4c);})[_0x3475('0x28')](function(_0x2042da){_0x49d11d[_0x3475('0x4d')]=_0x2042da;return _0x49d11d;})['then'](respondWithFilteredResult(_0x784ef8,_0x651d4c))[_0x3475('0x4e')](handleError(_0x784ef8,null));};exports['show']=function(_0x473747,_0x3793c4){var _0x5c5e3e={'raw':![],'where':{'id':_0x473747[_0x3475('0x4f')]['id']}},_0x34e589={};_0x34e589[_0x3475('0x3c')]=_['keys'](db[_0x3475('0x39')]['rawAttributes']);_0x34e589[_0x3475('0x3e')]=_['keys'](_0x473747['query']);_0x34e589[_0x3475('0x3f')]=_[_0x3475('0x40')](_0x34e589[_0x3475('0x3c')],_0x34e589['query']);_0x5c5e3e['attributes']=_[_0x3475('0x40')](_0x34e589['model'],qs[_0x3475('0x42')](_0x473747[_0x3475('0x3e')][_0x3475('0x42')]));_0x5c5e3e[_0x3475('0x41')]=_0x5c5e3e['attributes'][_0x3475('0x43')]?_0x5c5e3e['attributes']:_0x34e589['model'];if(_0x473747['query'][_0x3475('0x50')]){_0x5c5e3e[_0x3475('0x4b')]=[{'all':!![]}];}_0x5c5e3e=_[_0x3475('0x49')]({},_0x5c5e3e,_0x473747['options']);return db[_0x3475('0x39')][_0x3475('0x32')](_0x5c5e3e)['then'](handleEntityNotFound(_0x3793c4,null))[_0x3475('0x28')](respondWithResult(_0x3793c4,null))[_0x3475('0x4e')](handleError(_0x3793c4,null));};exports[_0x3475('0x51')]=function(_0x37e664,_0x36df85){return db['VoiceQueue'][_0x3475('0x51')](_0x37e664['body'],{})[_0x3475('0x28')](function(_0x1000db){var _0x318b98=_0x37e664[_0x3475('0x52')]['get']({'plain':!![]});if(!_0x318b98)throw new Error(_0x3475('0x53'));if(_0x318b98[_0x3475('0x54')]===_0x3475('0x52')){var _0x22c104=_0x1000db[_0x3475('0x2a')]({'plain':!![]});var _0x33aac5=[{'name':_0x3475('0x2b'),'value':'inbound'},{'name':_0x3475('0x55'),'value':_0x3475('0x56')}];var _0x4a77ac=_[_0x3475('0x32')](_0x33aac5,[_0x3475('0x30'),_0x22c104['type']])[_0x3475('0x36')];return db[_0x3475('0x57')]['find']({'where':{'name':_0x4a77ac,'userProfileId':_0x318b98[_0x3475('0x58')]},'raw':!![]})[_0x3475('0x28')](function(_0x4256f9){if(_0x4256f9&&_0x4256f9[_0x3475('0x59')]===0x0){return db[_0x3475('0x5a')][_0x3475('0x51')]({'name':_0x22c104[_0x3475('0x36')],'resourceId':_0x22c104['id'],'type':_0x4256f9[_0x3475('0x36')],'sectionId':_0x4256f9['id']},{})[_0x3475('0x28')](function(){return _0x1000db;});}else{return _0x1000db;}})[_0x3475('0x4e')](function(_0x4439ad){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4439ad);throw _0x4439ad;});}return _0x1000db;})[_0x3475('0x28')](respondWithResult(_0x36df85,0xc9))[_0x3475('0x4e')](handleError(_0x36df85,null));};exports[_0x3475('0x5b')]=function(_0x59e620,_0x281901){var _0x2671da={'where':{'id':_0x59e620[_0x3475('0x4f')]['id']}},_0x3cd513={};_0x3cd513[_0x3475('0x3c')]=_['keys'](db[_0x3475('0x39')][_0x3475('0x3a')]);_0x2671da[_0x3475('0x41')]=_[_0x3475('0x40')](_0x3cd513[_0x3475('0x3c')],qs[_0x3475('0x42')](_0x59e620[_0x3475('0x3e')][_0x3475('0x42')]));_0x2671da[_0x3475('0x41')]=_0x2671da['attributes'][_0x3475('0x43')]?_0x2671da[_0x3475('0x41')]:_0x3cd513[_0x3475('0x3c')];if(_0x59e620[_0x3475('0x3e')][_0x3475('0x50')]){_0x2671da['include']=[{'all':!![]}];}_0x2671da=_[_0x3475('0x49')]({},_0x2671da,_0x59e620['options']);return db[_0x3475('0x39')][_0x3475('0x32')](_0x2671da)[_0x3475('0x28')](handleEntityNotFound(_0x281901,null))['then'](function(_0x280e27){if(_0x280e27){var _0x3a5a7a=_0x280e27[_0x3475('0x2a')]({'plain':!![]});_0x3a5a7a=qs[_0x3475('0x5c')](_0x3a5a7a,['id',_0x3475('0x5d'),_0x3475('0x5e')]);_0x59e620[_0x3475('0x5f')]=_[_0x3475('0x5c')](_0x59e620['body'],['id','createdAt',_0x3475('0x5e')]);return db[_0x3475('0x39')]['create'](_[_0x3475('0x49')](_0x3a5a7a,_0x59e620['body']),{'include':_0x59e620[_0x3475('0x3e')][_0x3475('0x50')]?[{'all':!![]}]:undefined})['then'](function(_0x5ba83f){var _0x58824d=_0x59e620['user']['get']({'plain':!![]});if(!_0x58824d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58824d['role']==='user'){var _0x7f47a8=_0x5ba83f['get']({'plain':!![]});var _0x415d1d=[{'name':_0x3475('0x2b'),'value':_0x3475('0x2c')},{'name':_0x3475('0x55'),'value':'outbound'}];var _0x298a10=_[_0x3475('0x32')](_0x415d1d,['value',_0x7f47a8[_0x3475('0x31')]])['name'];return db[_0x3475('0x57')][_0x3475('0x32')]({'where':{'name':_0x298a10,'userProfileId':_0x58824d[_0x3475('0x58')]},'raw':!![]})['then'](function(_0x2773e6){if(_0x2773e6&&_0x2773e6[_0x3475('0x59')]===0x0){return db[_0x3475('0x5a')]['create']({'name':_0x7f47a8[_0x3475('0x36')],'resourceId':_0x7f47a8['id'],'type':_0x2773e6['name'],'sectionId':_0x2773e6['id']},{})[_0x3475('0x28')](function(){return _0x5ba83f;});}else{return _0x5ba83f;}})['catch'](function(_0xdb9407){logger[_0x3475('0x34')](_0x3475('0x60'),_0xdb9407);throw _0xdb9407;});}return _0x5ba83f;});}})[_0x3475('0x28')](respondWithResult(_0x281901,0xc9))[_0x3475('0x4e')](handleError(_0x281901,null));};exports['update']=function(_0x30df25,_0xd228c3){if(_0x30df25[_0x3475('0x5f')]['id']){delete _0x30df25[_0x3475('0x5f')]['id'];}return db['VoiceQueue'][_0x3475('0x32')]({'where':{'id':_0x30df25[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0xd228c3,null))[_0x3475('0x28')](saveUpdates(_0x30df25[_0x3475('0x5f')],null))['then'](respondWithResult(_0xd228c3,null))[_0x3475('0x4e')](handleError(_0xd228c3,null));};exports['destroy']=function(_0x2e78b8,_0x55a3ff){return db['VoiceQueue'][_0x3475('0x32')]({'where':{'id':_0x2e78b8[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x55a3ff,null))[_0x3475('0x28')](removeEntity(_0x55a3ff,null))[_0x3475('0x4e')](handleError(_0x55a3ff,null));};exports['getHoppers']=function(_0x4ef66c,_0x14131a,_0xcc0802){var _0x3f22f7={'raw':![],'where':{}};var _0x393be3={};var _0x5860b0={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3475('0x61')]({'where':{'id':_0x4ef66c[_0x3475('0x4f')]['id']}})['then'](handleEntityNotFound(_0x14131a,null))[_0x3475('0x28')](function(_0x1ed305){if(_0x1ed305){_0x393be3['model']=_['keys'](db[_0x3475('0x62')][_0x3475('0x3a')]);_0x393be3['query']=_['keys'](_0x4ef66c[_0x3475('0x3e')]);_0x393be3['filters']=_[_0x3475('0x40')](_0x393be3[_0x3475('0x3c')],_0x393be3['query']);_0x3f22f7[_0x3475('0x41')]=_[_0x3475('0x40')](_0x393be3[_0x3475('0x3c')],qs[_0x3475('0x42')](_0x4ef66c[_0x3475('0x3e')][_0x3475('0x42')]));_0x3f22f7[_0x3475('0x41')]=_0x3f22f7[_0x3475('0x41')][_0x3475('0x43')]?_0x3f22f7[_0x3475('0x41')]:_0x393be3['model'];if(!_0x4ef66c[_0x3475('0x3e')][_0x3475('0x44')]('nolimit')){_0x3f22f7[_0x3475('0x21')]=qs[_0x3475('0x21')](_0x4ef66c[_0x3475('0x3e')][_0x3475('0x21')]);_0x3f22f7[_0x3475('0x1f')]=qs[_0x3475('0x1f')](_0x4ef66c[_0x3475('0x3e')][_0x3475('0x1f')]);}_0x3f22f7[_0x3475('0x46')]=qs[_0x3475('0x47')](_0x4ef66c[_0x3475('0x3e')][_0x3475('0x47')]);_0x3f22f7[_0x3475('0x48')]=qs['filters'](_[_0x3475('0x63')](_0x4ef66c[_0x3475('0x3e')],_0x393be3[_0x3475('0x3f')]));_0x3f22f7[_0x3475('0x48')]['VoiceQueueId']=_0x1ed305['id'];if(_0x4ef66c['query']['filter']){_0x3f22f7[_0x3475('0x48')]=_[_0x3475('0x49')](_0x3f22f7[_0x3475('0x48')],{'$or':_[_0x3475('0x2f')](_0x3f22f7[_0x3475('0x41')],function(_0x4289c9){var _0x409099={};_0x409099[_0x4289c9]={'$like':'%'+_0x4ef66c[_0x3475('0x3e')][_0x3475('0x2d')]+'%'};return _0x409099;})});}_0x3f22f7=_[_0x3475('0x49')]({},_0x3f22f7,_0x4ef66c[_0x3475('0x4a')]);return db[_0x3475('0x62')][_0x3475('0x22')]({'where':_0x3f22f7[_0x3475('0x48')]})['then'](function(_0x28fa96){_0x5860b0[_0x3475('0x22')]=_0x28fa96;if(_0x4ef66c['query']['includeAll']){_0x3f22f7['include']=[{'all':!![]}];}return db[_0x3475('0x62')]['findAll'](_0x3f22f7);})[_0x3475('0x28')](function(_0x91abf3){_0x5860b0[_0x3475('0x4d')]=_0x91abf3;return _0x5860b0;});}})[_0x3475('0x28')](respondWithFilteredResult(_0x14131a,_0x3f22f7))[_0x3475('0x4e')](handleError(_0x14131a,null));};exports[_0x3475('0x64')]=function(_0x30e30b,_0x25d092,_0x384490){var _0x392da4={'raw':!![],'where':{}};var _0x2d6986={};var _0x5425c9={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3475('0x61')]({'where':{'id':_0x30e30b[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x25d092,null))[_0x3475('0x28')](function(_0x5efa7e){if(_0x5efa7e){_0x2d6986[_0x3475('0x3c')]=_[_0x3475('0x3d')](db['CmHopperHistory'][_0x3475('0x3a')]);_0x2d6986[_0x3475('0x3e')]=_['keys'](_0x30e30b[_0x3475('0x3e')]);_0x2d6986[_0x3475('0x3f')]=_[_0x3475('0x40')](_0x2d6986[_0x3475('0x3c')],_0x2d6986[_0x3475('0x3e')]);_0x392da4[_0x3475('0x41')]=_[_0x3475('0x40')](_0x2d6986[_0x3475('0x3c')],qs[_0x3475('0x42')](_0x30e30b[_0x3475('0x3e')]['fields']));_0x392da4[_0x3475('0x41')]=_0x392da4[_0x3475('0x41')][_0x3475('0x43')]?_0x392da4['attributes']:_0x2d6986[_0x3475('0x3c')];if(!_0x30e30b[_0x3475('0x3e')][_0x3475('0x44')](_0x3475('0x45'))){_0x392da4[_0x3475('0x21')]=qs[_0x3475('0x21')](_0x30e30b[_0x3475('0x3e')][_0x3475('0x21')]);_0x392da4['offset']=qs[_0x3475('0x1f')](_0x30e30b[_0x3475('0x3e')]['offset']);}_0x392da4['order']=qs[_0x3475('0x47')](_0x30e30b[_0x3475('0x3e')][_0x3475('0x47')]);_0x392da4[_0x3475('0x48')]=qs[_0x3475('0x3f')](_['pick'](_0x30e30b[_0x3475('0x3e')],_0x2d6986[_0x3475('0x3f')]));_0x392da4[_0x3475('0x48')][_0x3475('0x65')]=_0x5efa7e['id'];if(_0x30e30b['query'][_0x3475('0x2d')]){_0x392da4[_0x3475('0x48')]=_[_0x3475('0x49')](_0x392da4[_0x3475('0x48')],{'$or':_[_0x3475('0x2f')](_0x392da4[_0x3475('0x41')],function(_0x193b83){var _0x442db0={};_0x442db0[_0x193b83]={'$like':'%'+_0x30e30b[_0x3475('0x3e')][_0x3475('0x2d')]+'%'};return _0x442db0;})});}_0x392da4=_[_0x3475('0x49')]({},_0x392da4,_0x30e30b[_0x3475('0x4a')]);return db['CmHopperHistory'][_0x3475('0x22')]({'where':_0x392da4[_0x3475('0x48')]})[_0x3475('0x28')](function(_0x2802a0){_0x5425c9[_0x3475('0x22')]=_0x2802a0;if(_0x30e30b[_0x3475('0x3e')][_0x3475('0x50')]){_0x392da4['include']=[{'all':!![]}];}return db[_0x3475('0x66')][_0x3475('0x4c')](_0x392da4);})[_0x3475('0x28')](function(_0x24bf38){_0x5425c9[_0x3475('0x4d')]=_0x24bf38;return _0x5425c9;});}})[_0x3475('0x28')](respondWithFilteredResult(_0x25d092,_0x392da4))[_0x3475('0x4e')](handleError(_0x25d092,null));};exports[_0x3475('0x67')]=function(_0x1d8e82,_0x3ea7af,_0x4dd301){var _0x1abff8={'raw':!![],'where':{}};var _0x2889fa={};var _0x2a381f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1d8e82[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x3ea7af,null))['then'](function(_0x2872af){if(_0x2872af){_0x2889fa[_0x3475('0x3c')]=_['keys'](db[_0x3475('0x68')]['rawAttributes']);_0x2889fa['query']=_[_0x3475('0x3d')](_0x1d8e82[_0x3475('0x3e')]);_0x2889fa[_0x3475('0x3f')]=_[_0x3475('0x40')](_0x2889fa['model'],_0x2889fa[_0x3475('0x3e')]);_0x1abff8['attributes']=_[_0x3475('0x40')](_0x2889fa[_0x3475('0x3c')],qs[_0x3475('0x42')](_0x1d8e82['query'][_0x3475('0x42')]));_0x1abff8[_0x3475('0x41')]=_0x1abff8[_0x3475('0x41')][_0x3475('0x43')]?_0x1abff8[_0x3475('0x41')]:_0x2889fa[_0x3475('0x3c')];if(!_0x1d8e82[_0x3475('0x3e')]['hasOwnProperty'](_0x3475('0x45'))){_0x1abff8[_0x3475('0x21')]=qs[_0x3475('0x21')](_0x1d8e82[_0x3475('0x3e')][_0x3475('0x21')]);_0x1abff8[_0x3475('0x1f')]=qs[_0x3475('0x1f')](_0x1d8e82[_0x3475('0x3e')][_0x3475('0x1f')]);}_0x1abff8[_0x3475('0x46')]=qs[_0x3475('0x47')](_0x1d8e82[_0x3475('0x3e')]['sort']);_0x1abff8[_0x3475('0x48')]=qs[_0x3475('0x3f')](_[_0x3475('0x63')](_0x1d8e82['query'],_0x2889fa[_0x3475('0x3f')]));_0x1abff8[_0x3475('0x48')][_0x3475('0x65')]=_0x2872af['id'];if(_0x1d8e82[_0x3475('0x3e')][_0x3475('0x2d')]){_0x1abff8[_0x3475('0x48')]=_[_0x3475('0x49')](_0x1abff8[_0x3475('0x48')],{'$or':_[_0x3475('0x2f')](_0x1abff8[_0x3475('0x41')],function(_0x485aee){var _0x488251={};_0x488251[_0x485aee]={'$like':'%'+_0x1d8e82['query'][_0x3475('0x2d')]+'%'};return _0x488251;})});}_0x1abff8=_[_0x3475('0x49')]({},_0x1abff8,_0x1d8e82[_0x3475('0x4a')]);return db['CmHopperFinal'][_0x3475('0x22')]({'where':_0x1abff8[_0x3475('0x48')]})[_0x3475('0x28')](function(_0xaef48c){_0x2a381f['count']=_0xaef48c;if(_0x1d8e82['query'][_0x3475('0x50')]){_0x1abff8[_0x3475('0x4b')]=[{'all':!![]}];}return db[_0x3475('0x68')]['findAll'](_0x1abff8);})[_0x3475('0x28')](function(_0x5eb24a){_0x2a381f['rows']=_0x5eb24a;return _0x2a381f;});}})[_0x3475('0x28')](respondWithFilteredResult(_0x3ea7af,_0x1abff8))[_0x3475('0x4e')](handleError(_0x3ea7af,null));};exports[_0x3475('0x69')]=function(_0x2a1e4a,_0x5b2150,_0xf364d5){var _0x5b0e19={'raw':!![],'where':{}};var _0x40151c={};var _0x17ad75={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3475('0x61')]({'where':{'id':_0x2a1e4a[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x5b2150,null))[_0x3475('0x28')](function(_0x5d35d4){if(_0x5d35d4){_0x40151c[_0x3475('0x3c')]=_[_0x3475('0x3d')](db[_0x3475('0x6a')][_0x3475('0x3a')]);_0x40151c['query']=_[_0x3475('0x3d')](_0x2a1e4a[_0x3475('0x3e')]);_0x40151c[_0x3475('0x3f')]=_['intersection'](_0x40151c[_0x3475('0x3c')],_0x40151c['query']);_0x5b0e19[_0x3475('0x41')]=_['intersection'](_0x40151c['model'],qs[_0x3475('0x42')](_0x2a1e4a['query'][_0x3475('0x42')]));_0x5b0e19[_0x3475('0x41')]=_0x5b0e19[_0x3475('0x41')][_0x3475('0x43')]?_0x5b0e19[_0x3475('0x41')]:_0x40151c[_0x3475('0x3c')];if(!_0x2a1e4a[_0x3475('0x3e')]['hasOwnProperty'](_0x3475('0x45'))){_0x5b0e19[_0x3475('0x21')]=qs[_0x3475('0x21')](_0x2a1e4a[_0x3475('0x3e')][_0x3475('0x21')]);_0x5b0e19['offset']=qs['offset'](_0x2a1e4a[_0x3475('0x3e')]['offset']);}_0x5b0e19[_0x3475('0x46')]=qs[_0x3475('0x47')](_0x2a1e4a['query']['sort']);_0x5b0e19['where']=qs[_0x3475('0x3f')](_['pick'](_0x2a1e4a[_0x3475('0x3e')],_0x40151c[_0x3475('0x3f')]));_0x5b0e19[_0x3475('0x48')]['VoiceQueueId']=_0x5d35d4['id'];if(_0x2a1e4a[_0x3475('0x3e')][_0x3475('0x2d')]){_0x5b0e19[_0x3475('0x48')]=_['merge'](_0x5b0e19['where'],{'$or':_[_0x3475('0x2f')](_0x5b0e19[_0x3475('0x41')],function(_0x4eb43d){var _0x49a3a9={};_0x49a3a9[_0x4eb43d]={'$like':'%'+_0x2a1e4a['query'][_0x3475('0x2d')]+'%'};return _0x49a3a9;})});}_0x5b0e19=_[_0x3475('0x49')]({},_0x5b0e19,_0x2a1e4a['options']);return db[_0x3475('0x6a')]['count']({'where':_0x5b0e19['where']})['then'](function(_0x71563d){_0x17ad75['count']=_0x71563d;if(_0x2a1e4a[_0x3475('0x3e')][_0x3475('0x50')]){_0x5b0e19['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x3475('0x4c')](_0x5b0e19);})['then'](function(_0x1faf92){_0x17ad75[_0x3475('0x4d')]=_0x1faf92;return _0x17ad75;});}})[_0x3475('0x28')](respondWithFilteredResult(_0x5b2150,_0x5b0e19))[_0x3475('0x4e')](handleError(_0x5b2150,null));};exports['getTeams']=function(_0x1cc1d,_0x411570,_0x30822a){var _0x25970c={};var _0x28148d={};var _0x42f84f;var _0x109cf9;return db[_0x3475('0x39')][_0x3475('0x61')]({'where':{'id':_0x1cc1d[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x411570,null))[_0x3475('0x28')](function(_0x2b13fb){if(_0x2b13fb){_0x42f84f=_0x2b13fb;_0x28148d[_0x3475('0x3c')]=_[_0x3475('0x3d')](db[_0x3475('0x6b')][_0x3475('0x3a')]);_0x28148d[_0x3475('0x3e')]=_[_0x3475('0x3d')](_0x1cc1d[_0x3475('0x3e')]);_0x28148d['filters']=_['intersection'](_0x28148d[_0x3475('0x3c')],_0x28148d['query']);_0x25970c[_0x3475('0x41')]=_[_0x3475('0x40')](_0x28148d[_0x3475('0x3c')],qs[_0x3475('0x42')](_0x1cc1d[_0x3475('0x3e')][_0x3475('0x42')]));_0x25970c[_0x3475('0x41')]=_0x25970c['attributes']['length']?_0x25970c['attributes']:_0x28148d[_0x3475('0x3c')];_0x25970c['order']=qs[_0x3475('0x47')](_0x1cc1d[_0x3475('0x3e')][_0x3475('0x47')]);_0x25970c[_0x3475('0x48')]=qs['filters'](_[_0x3475('0x63')](_0x1cc1d[_0x3475('0x3e')],_0x28148d[_0x3475('0x3f')]));if(_0x1cc1d[_0x3475('0x3e')][_0x3475('0x2d')]){_0x25970c[_0x3475('0x48')]=_['merge'](_0x25970c[_0x3475('0x48')],{'$or':_[_0x3475('0x2f')](_0x25970c[_0x3475('0x41')],function(_0x4306b7){var _0x1df288={};_0x1df288[_0x4306b7]={'$like':'%'+_0x1cc1d['query'][_0x3475('0x2d')]+'%'};return _0x1df288;})});}_0x25970c=_[_0x3475('0x49')]({},_0x25970c,_0x1cc1d[_0x3475('0x4a')]);return _0x42f84f[_0x3475('0x6c')](_0x25970c);}})['then'](function(_0x57d255){if(_0x57d255){_0x109cf9=_0x57d255[_0x3475('0x43')];if(!_0x1cc1d['query'][_0x3475('0x44')]('nolimit')){_0x25970c[_0x3475('0x21')]=qs[_0x3475('0x21')](_0x1cc1d[_0x3475('0x3e')][_0x3475('0x21')]);_0x25970c[_0x3475('0x1f')]=qs['offset'](_0x1cc1d[_0x3475('0x3e')]['offset']);}return _0x42f84f['getTeams'](_0x25970c);}})[_0x3475('0x28')](function(_0x395f92){if(_0x395f92){return _0x395f92?{'count':_0x109cf9,'rows':_0x395f92}:null;}})['then'](respondWithResult(_0x411570,null))[_0x3475('0x4e')](handleError(_0x411570,null));};exports['addTeams']=function(_0x1f100b,_0x1b2415,_0x3f4a53){var _0x1bf064=_0x1f100b['body'][_0x3475('0x6d')];var _0x50f52a=_['map'](_0x1bf064,'id');return db[_0x3475('0x6b')][_0x3475('0x4c')]({'where':{'id':_0x50f52a},'attributes':['id'],'include':[{'model':db[_0x3475('0x6e')],'as':_0x3475('0x6f'),'attributes':['id','name','online',_0x3475('0x70'),_0x3475('0x71')],'raw':!![]}]})[_0x3475('0x28')](function(_0x18efb6){if(_0x18efb6){var _0x61a848=_[_0x3475('0x72')](_0x18efb6,function(_0x3da621){var _0x1b5af1=_0x3da621[_0x3475('0x2a')]({'plain':!![]});_0x1b5af1[_0x3475('0x6f')]['forEach'](function(_0x266f63){_0x266f63[_0x3475('0x73')]=_[_0x3475('0x32')](_0x1bf064,{'id':_0x1b5af1['id']})[_0x3475('0x73')];});return _0x1b5af1['Agents'];});return db[_0x3475('0x39')]['find']({'where':{'id':_0x1f100b['params']['id']}})[_0x3475('0x28')](function(_0x1f9004){return db[_0x3475('0x74')][_0x3475('0x75')](function(_0x355fa3){return _0x1f9004[_0x3475('0x76')](_0x50f52a,{'transaction':_0x355fa3})[_0x3475('0x28')](function(){return BPromise[_0x3475('0x77')](_0x1bf064,function(_0x2596de){return db[_0x3475('0x78')][_0x3475('0x79')]({'TeamId':_0x2596de['id'],'VoiceQueueId':_0x1f100b['params']['id'],'penalty':_0x2596de[_0x3475('0x73')]},{'transaction':_0x355fa3});});})[_0x3475('0x28')](function(){return BPromise[_0x3475('0x77')](_0x61a848,function(_0x109572){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x109572['id'],'VoiceQueueId':_0x1f100b[_0x3475('0x4f')]['id']},'defaults':{'penalty':_0x109572[_0x3475('0x73')]},'transaction':_0x355fa3});});})[_0x3475('0x28')](function(){return BPromise['each'](_['filter'](_0x61a848,{'online':!![]}),function(_0x505f5a){return db[_0x3475('0x7a')][_0x3475('0x79')]({'membername':_0x505f5a['name'],'UserId':_0x505f5a['id'],'queue_name':_0x1f9004[_0x3475('0x36')],'VoiceQueueId':_0x1f9004['id'],'interface':_[_0x3475('0x7b')](_0x505f5a['interface'])?util[_0x3475('0x7c')](_0x3475('0x7d'),_0x505f5a[_0x3475('0x36')]):_0x505f5a[_0x3475('0x71')],'paused':_0x505f5a[_0x3475('0x70')]||![],'penalty':_0x505f5a['penalty']},{'transaction':_0x355fa3});});})['then'](function(){_0x61a848[_0x3475('0x7e')](function(_0x5d22d1){socket[_0x3475('0x7f')](_0x3475('0x80'),{'UserId':_0x5d22d1['id'],'VoiceQueueId':_0x1f9004['id']});});});});});}})[_0x3475('0x28')](respondWithStatusCode(_0x1b2415,null))[_0x3475('0x4e')](handleError(_0x1b2415,null));};exports[_0x3475('0x81')]=function(_0x3d84a6,_0x2a40f9,_0x51ce2b){return db[_0x3475('0x6b')][_0x3475('0x4c')]({'where':{'id':_0x3d84a6[_0x3475('0x3e')][_0x3475('0x82')]},'attributes':['id'],'include':[{'model':db[_0x3475('0x6e')],'as':_0x3475('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x3475('0x28')](handleEntityNotFound(_0x2a40f9,null))[_0x3475('0x28')](function(_0x1ab6ee){var _0x475b3d=_[_0x3475('0x2f')](_0x1ab6ee,'id');var _0x35f527=[];var _0x3befac=[];var _0x116dde=squel[_0x3475('0x83')]();_0x116dde[_0x3475('0x84')](_0x3475('0x85'))[_0x3475('0x86')](_0x3475('0x87'),'tq')[_0x3475('0x88')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x3475('0x89'),_0x3d84a6['params']['id']);for(var _0x166df3=0x0;_0x166df3<_0x1ab6ee['length'];_0x166df3+=0x1){let _0x4c61fd=_0x1ab6ee[_0x166df3];for(var _0x533a2d=0x0;_0x533a2d<_0x4c61fd[_0x3475('0x6f')][_0x3475('0x43')];_0x533a2d+=0x1){let _0x3650c6=_0x4c61fd[_0x3475('0x6f')][_0x533a2d];var _0x31bd02=_0x116dde[_0x3475('0x5b')]();_0x31bd02['where'](_0x3475('0x8a'),_0x3650c6['id']);_0x3befac[_0x3475('0x8b')](db['sequelize'][_0x3475('0x3e')](_0x31bd02['toString'](),{'type':db[_0x3475('0x74')][_0x3475('0x8c')]['SELECT']})[_0x3475('0x28')](function(_0x4b5838){if(_0x4b5838['length']===0x1){return _0x3650c6['id'];}else{var _0x28272c=_['every'](_['map'](_0x4b5838,_0x3475('0x8d')),function(_0x5b79b7){return _[_0x3475('0x8e')](_0x475b3d,_0x5b79b7);});if(_0x28272c){return _0x3650c6['id'];}}}));}}return BPromise[_0x3475('0x8f')](_0x3befac)[_0x3475('0x28')](function(_0x1dbbe9){_0x35f527=_(_0x35f527)['union'](_0x1dbbe9)['compact']()[_0x3475('0x30')]();return db['VoiceQueue'][_0x3475('0x32')]({'where':{'id':_0x3d84a6[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](function(_0x118e11){return db[_0x3475('0x74')][_0x3475('0x75')](function(_0x3cf975){return _0x118e11[_0x3475('0x81')](_0x3d84a6['query'][_0x3475('0x82')],{'transaction':_0x3cf975})['then'](function(){if(!_[_0x3475('0x90')](_0x35f527)){return _0x118e11[_0x3475('0x91')](_0x35f527,{'transaction':_0x3cf975})[_0x3475('0x28')](function(){return db[_0x3475('0x7a')][_0x3475('0x29')]({'where':{'VoiceQueueId':_0x3d84a6[_0x3475('0x4f')]['id'],'UserId':_0x35f527},'transaction':_0x3cf975});});}})[_0x3475('0x28')](function(){_0x35f527[_0x3475('0x7e')](function(_0x81b80c){socket[_0x3475('0x7f')](_0x3475('0x92'),{'UserId':_0x81b80c,'VoiceQueueId':_0x118e11['id']});});});});});});})[_0x3475('0x28')](respondWithStatusCode(_0x2a40f9,null))['catch'](handleError(_0x2a40f9,null));};exports[_0x3475('0x93')]=function(_0x149324,_0x59c41f,_0x4e5bf9){var _0x54bfd0,_0xc7385f;return db[_0x3475('0x39')][_0x3475('0x32')]({'where':{'id':_0x149324[_0x3475('0x4f')]['id']}})['then'](handleEntityNotFound(_0x59c41f,null))[_0x3475('0x28')](function(_0x38ce99){if(_0x38ce99){_0xc7385f=_0x38ce99;return _0x38ce99['addAgents'](_0x149324[_0x3475('0x5f')][_0x3475('0x82')],_[_0x3475('0x5c')](_0x149324[_0x3475('0x5f')],[_0x3475('0x82'),'id'])||{})[_0x3475('0x94')](function(_0x5bfde2){for(var _0x3cb345=0x0;_0x3cb345<_0x149324[_0x3475('0x5f')][_0x3475('0x82')][_0x3475('0x43')];_0x3cb345+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x149324[_0x3475('0x5f')][_0x3475('0x82')][_0x3cb345]),'VoiceQueueId':Number(_0x149324['params']['id'])});}return _0x5bfde2;});}})[_0x3475('0x28')](function(_0x588a48){_0x54bfd0=_0x588a48||[];if(_0xc7385f){return db['User'][_0x3475('0x4c')]({'where':{'id':_0x149324[_0x3475('0x5f')]['ids']},'attributes':['id',_0x3475('0x36'),_0x3475('0x95'),'voicePause','interface'],'raw':!![]});}})['then'](function(_0x24c4f8){if(!_[_0x3475('0x90')](_0x24c4f8)){var _0x4eb337=[];for(var _0x372656=0x0;_0x372656<_0x24c4f8['length'];_0x372656++){if(_0x24c4f8[_0x372656][_0x3475('0x95')]){_0x4eb337['push'](db['UserVoiceQueueRt'][_0x3475('0x79')]({'membername':_0x24c4f8[_0x372656][_0x3475('0x36')],'UserId':_0x24c4f8[_0x372656]['id'],'queue_name':_0xc7385f[_0x3475('0x36')],'VoiceQueueId':_0xc7385f['id'],'interface':_[_0x3475('0x7b')](_0x24c4f8[_0x372656][_0x3475('0x71')])?util['format']('SIP/%s',_0x24c4f8[_0x372656][_0x3475('0x36')]):_0x24c4f8[_0x372656]['interface'],'paused':_0x24c4f8[_0x372656][_0x3475('0x70')]||![],'penalty':_0x149324[_0x3475('0x5f')][_0x3475('0x73')]||0x0}));}}return BPromise[_0x3475('0x8f')](_0x4eb337);}})[_0x3475('0x28')](function(){return _0x54bfd0;})[_0x3475('0x28')](respondWithResult(_0x59c41f,null))[_0x3475('0x4e')](handleError(_0x59c41f,null));};exports['removeAgents']=function(_0x2cdeed,_0x359c71,_0x3edb9f){return db[_0x3475('0x39')][_0x3475('0x32')]({'where':{'id':_0x2cdeed[_0x3475('0x4f')]['id']}})['then'](handleEntityNotFound(_0x359c71,null))['then'](function(_0x3f4685){if(_0x3f4685){return _0x3f4685[_0x3475('0x91')](_0x2cdeed[_0x3475('0x3e')][_0x3475('0x82')])[_0x3475('0x28')](function(){if(_[_0x3475('0x96')](_0x2cdeed[_0x3475('0x3e')][_0x3475('0x82')])){for(var _0x4f102c=0x0;_0x4f102c<_0x2cdeed[_0x3475('0x3e')][_0x3475('0x82')]['length'];_0x4f102c+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x2cdeed['query'][_0x3475('0x82')][_0x4f102c]),'VoiceQueueId':Number(_0x2cdeed[_0x3475('0x4f')]['id'])});}}else{socket[_0x3475('0x7f')]('userVoiceQueue:remove',{'UserId':Number(_0x2cdeed[_0x3475('0x3e')]['ids']),'VoiceQueueId':Number(_0x2cdeed['params']['id'])});}});}})[_0x3475('0x28')](function(_0x3d3b89){return db[_0x3475('0x7a')][_0x3475('0x29')]({'where':{'VoiceQueueId':_0x2cdeed[_0x3475('0x4f')]['id'],'UserId':_0x2cdeed[_0x3475('0x3e')][_0x3475('0x82')]}})[_0x3475('0x28')](function(){return _0x3d3b89;});})[_0x3475('0x28')](respondWithStatusCode(_0x359c71,null))[_0x3475('0x4e')](handleError(_0x359c71,null));};exports['getAgents']=function(_0x259d66,_0xd5f66,_0x389ecc){var _0x45fdf8={};var _0x5903de={};var _0x2ce45d;var _0x3f4097;return db[_0x3475('0x39')][_0x3475('0x61')]({'where':{'id':_0x259d66[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0xd5f66,null))['then'](function(_0x1771bf){if(_0x1771bf){_0x2ce45d=_0x1771bf;_0x5903de[_0x3475('0x3c')]=_[_0x3475('0x3d')](db[_0x3475('0x6e')]['rawAttributes']);_0x5903de[_0x3475('0x3e')]=_[_0x3475('0x3d')](_0x259d66['query']);_0x5903de['filters']=_[_0x3475('0x40')](_0x5903de[_0x3475('0x3c')],_0x5903de[_0x3475('0x3e')]);_0x45fdf8[_0x3475('0x41')]=_[_0x3475('0x40')](_0x5903de[_0x3475('0x3c')],qs[_0x3475('0x42')](_0x259d66['query'][_0x3475('0x42')]));_0x45fdf8[_0x3475('0x41')]=_0x45fdf8[_0x3475('0x41')][_0x3475('0x43')]?_0x45fdf8[_0x3475('0x41')]:_0x5903de['model'];_0x45fdf8['order']=qs[_0x3475('0x47')](_0x259d66[_0x3475('0x3e')]['sort']);_0x45fdf8[_0x3475('0x48')]=qs[_0x3475('0x3f')](_[_0x3475('0x63')](_0x259d66['query'],_0x5903de[_0x3475('0x3f')]));if(_0x259d66[_0x3475('0x3e')][_0x3475('0x2d')]){_0x45fdf8['where']=_[_0x3475('0x49')](_0x45fdf8[_0x3475('0x48')],{'$or':_[_0x3475('0x2f')](_0x45fdf8[_0x3475('0x41')],function(_0x223151){var _0xe9d5d0={};_0xe9d5d0[_0x223151]={'$like':'%'+_0x259d66[_0x3475('0x3e')][_0x3475('0x2d')]+'%'};return _0xe9d5d0;})});}_0x45fdf8=_[_0x3475('0x49')]({},_0x45fdf8,_0x259d66[_0x3475('0x4a')]);return _0x2ce45d[_0x3475('0x97')](_0x45fdf8);}})[_0x3475('0x28')](function(_0x50ad8b){if(_0x50ad8b){_0x3f4097=_0x50ad8b[_0x3475('0x43')];if(!_0x259d66[_0x3475('0x3e')][_0x3475('0x44')](_0x3475('0x45'))){_0x45fdf8[_0x3475('0x21')]=qs[_0x3475('0x21')](_0x259d66[_0x3475('0x3e')][_0x3475('0x21')]);_0x45fdf8[_0x3475('0x1f')]=qs[_0x3475('0x1f')](_0x259d66[_0x3475('0x3e')][_0x3475('0x1f')]);}return _0x2ce45d[_0x3475('0x97')](_0x45fdf8);}})[_0x3475('0x28')](function(_0x495297){if(_0x495297){return _0x495297?{'count':_0x3f4097,'rows':_0x495297}:null;}})[_0x3475('0x28')](respondWithResult(_0xd5f66,null))[_0x3475('0x4e')](handleError(_0xd5f66,null));};exports[_0x3475('0x98')]=function(_0x5b6569,_0x1b00b9,_0x50af02){var _0x43434d={};var _0x452529={};var _0x3dd126;var _0x48c055;return db[_0x3475('0x39')][_0x3475('0x61')]({'where':{'id':_0x5b6569[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x1b00b9,null))[_0x3475('0x28')](function(_0x2e7e62){if(_0x2e7e62){_0x3dd126=_0x2e7e62;_0x452529['model']=_[_0x3475('0x3d')](db[_0x3475('0x7a')][_0x3475('0x3a')]);_0x452529['query']=_['keys'](_0x5b6569['query']);_0x452529['filters']=_['intersection'](_0x452529[_0x3475('0x3c')],_0x452529['query']);_0x43434d[_0x3475('0x41')]=_['intersection'](_0x452529[_0x3475('0x3c')],qs[_0x3475('0x42')](_0x5b6569['query'][_0x3475('0x42')]));_0x43434d[_0x3475('0x41')]=_0x43434d[_0x3475('0x41')][_0x3475('0x43')]?_0x43434d[_0x3475('0x41')]:_0x452529[_0x3475('0x3c')];_0x43434d['order']=qs[_0x3475('0x47')](_0x5b6569[_0x3475('0x3e')][_0x3475('0x47')]);_0x43434d[_0x3475('0x48')]=qs[_0x3475('0x3f')](_[_0x3475('0x63')](_0x5b6569[_0x3475('0x3e')],_0x452529[_0x3475('0x3f')]));if(_0x5b6569['query'][_0x3475('0x2d')]){_0x43434d[_0x3475('0x48')]=_[_0x3475('0x49')](_0x43434d[_0x3475('0x48')],{'$or':_[_0x3475('0x2f')](_0x43434d['attributes'],function(_0x38444b){var _0x15553c={};_0x15553c[_0x38444b]={'$like':'%'+_0x5b6569['query'][_0x3475('0x2d')]+'%'};return _0x15553c;})});}_0x43434d=_['merge']({},_0x43434d,_0x5b6569[_0x3475('0x4a')]);return _0x3dd126['getMembers'](_0x43434d);}})['then'](function(_0x259c90){if(_0x259c90){_0x48c055=_0x259c90[_0x3475('0x43')];if(!_0x5b6569[_0x3475('0x3e')][_0x3475('0x44')](_0x3475('0x45'))){_0x43434d['limit']=qs[_0x3475('0x21')](_0x5b6569['query'][_0x3475('0x21')]);_0x43434d[_0x3475('0x1f')]=qs['offset'](_0x5b6569[_0x3475('0x3e')][_0x3475('0x1f')]);}return _0x3dd126[_0x3475('0x98')](_0x43434d);}})['then'](function(_0x481027){return _0x481027?{'count':_0x48c055,'rows':_0x481027}:null;})[_0x3475('0x28')](respondWithResult(_0x1b00b9,null))[_0x3475('0x4e')](handleError(_0x1b00b9,null));};exports[_0x3475('0x99')]=function(_0x1d333e,_0x1e9343,_0x654a6d){var _0x5d280f={};var _0x3a197f={};var _0x4322c7;var _0x62db6;return db['VoiceQueue'][_0x3475('0x61')]({'where':{'id':_0x1d333e[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x1e9343,null))[_0x3475('0x28')](function(_0x3c8b8a){if(_0x3c8b8a){_0x4322c7=_0x3c8b8a;_0x3a197f['model']=_[_0x3475('0x3d')](db['CmList'][_0x3475('0x3a')]);_0x3a197f[_0x3475('0x3e')]=_[_0x3475('0x3d')](_0x1d333e['query']);_0x3a197f[_0x3475('0x3f')]=_[_0x3475('0x40')](_0x3a197f[_0x3475('0x3c')],_0x3a197f[_0x3475('0x3e')]);_0x5d280f[_0x3475('0x41')]=_['intersection'](_0x3a197f['model'],qs[_0x3475('0x42')](_0x1d333e['query'][_0x3475('0x42')]));_0x5d280f[_0x3475('0x41')]=_0x5d280f[_0x3475('0x41')]['length']?_0x5d280f[_0x3475('0x41')]:_0x3a197f[_0x3475('0x3c')];_0x5d280f['order']=qs['sort'](_0x1d333e[_0x3475('0x3e')][_0x3475('0x47')]);_0x5d280f[_0x3475('0x48')]=qs[_0x3475('0x3f')](_[_0x3475('0x63')](_0x1d333e[_0x3475('0x3e')],_0x3a197f[_0x3475('0x3f')]));if(_0x1d333e[_0x3475('0x3e')][_0x3475('0x2d')]){_0x5d280f[_0x3475('0x48')]=_[_0x3475('0x49')](_0x5d280f[_0x3475('0x48')],{'$or':_[_0x3475('0x2f')](_0x5d280f['attributes'],function(_0x59aeed){var _0x15a627={};_0x15a627[_0x59aeed]={'$like':'%'+_0x1d333e['query'][_0x3475('0x2d')]+'%'};return _0x15a627;})});}_0x5d280f=_[_0x3475('0x49')]({},_0x5d280f,_0x1d333e[_0x3475('0x4a')]);return _0x4322c7[_0x3475('0x99')](_0x5d280f);}})[_0x3475('0x28')](function(_0x214938){if(_0x214938){_0x62db6=_0x214938['length'];if(!_0x1d333e[_0x3475('0x3e')][_0x3475('0x44')](_0x3475('0x45'))){_0x5d280f['limit']=qs[_0x3475('0x21')](_0x1d333e[_0x3475('0x3e')][_0x3475('0x21')]);_0x5d280f['offset']=qs[_0x3475('0x1f')](_0x1d333e[_0x3475('0x3e')][_0x3475('0x1f')]);}return _0x4322c7[_0x3475('0x99')](_0x5d280f);}})['then'](function(_0x20a000){if(_0x20a000){return _0x20a000?{'count':_0x62db6,'rows':_0x20a000}:null;}})['then'](respondWithResult(_0x1e9343,null))[_0x3475('0x4e')](handleError(_0x1e9343,null));};exports[_0x3475('0x9a')]=function(_0x29dab3,_0x2e6d40,_0x23d321){var _0x14b75c=moment()[_0x3475('0x7c')](_0x3475('0x9b'));var _0x30b61a,_0x30f102;return db[_0x3475('0x39')][_0x3475('0x32')]({'where':{'id':_0x29dab3[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x2e6d40,null))[_0x3475('0x28')](function(_0x465ee9){if(_0x465ee9){_0x30f102=_0x465ee9;return _0x465ee9[_0x3475('0x9a')](_0x29dab3[_0x3475('0x5f')]['ids'],_[_0x3475('0x5c')](_0x29dab3[_0x3475('0x5f')],[_0x3475('0x82'),'id'])||{});}return null;})[_0x3475('0x94')](function(_0x4134ad){var _0x4ee8ff;_0x30b61a=_0x4134ad||[];var _0xd3453=[];if(_0x4134ad){for(var _0x53144f=0x0;_0x53144f<_0x4134ad['length'];_0x53144f+=0x1){var _0x303fa3=_0x4134ad[_0x53144f]['get']({'plain':!![]});_0x30f102['dialCheckDuplicateType']=_0x29dab3[_0x3475('0x5f')]['dialCheckDuplicateType']?_0x29dab3[_0x3475('0x5f')][_0x3475('0x9c')]:_0x30f102['dialCheckDuplicateType'];switch(_0x30f102[_0x3475('0x9c')]){case'always':_0x4ee8ff=squel[_0x3475('0x9d')]()['into'](_0x3475('0x9e'))[_0x3475('0x9f')]([_0x3475('0xa0'),_0x3475('0xa1'),_0x3475('0xa2'),_0x3475('0xa3'),'VoiceQueueId',_0x3475('0x5d'),_0x3475('0x5e')],squel[_0x3475('0x83')]()[_0x3475('0x84')](_0x3475('0xa0'),_0x3475('0xa0'))[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27','scheduledAt')[_0x3475('0x84')]('id',_0x3475('0xa2'))['field'](_0x303fa3[_0x3475('0xa4')]['toString'](),_0x3475('0xa3'))[_0x3475('0x84')](_0x29dab3[_0x3475('0x4f')]['id'][_0x3475('0xa5')](),'VoiceQueueId')[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27','createdAt')[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27',_0x3475('0x5e'))['from'](_0x3475('0xa6'))[_0x3475('0x48')](_0x3475('0xa7'))[_0x3475('0x48')]('ListId\x20=\x20?',_0x303fa3[_0x3475('0xa4')][_0x3475('0xa5')]())[_0x3475('0x48')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x3475('0xa8'),squel[_0x3475('0x83')]()[_0x3475('0x84')]('COALESCE(calleridnum,\x27\x27)')[_0x3475('0x86')](_0x3475('0xa9'))[_0x3475('0x48')](_0x3475('0x89'),_0x29dab3[_0x3475('0x4f')]['id']['toString']()))[_0x3475('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3475('0x83')]()['field']('COALESCE(phone,\x27\x27)')[_0x3475('0x86')](_0x3475('0x9e'))[_0x3475('0x48')]('VoiceQueueId\x20=\x20?',_0x29dab3['params']['id'][_0x3475('0xa5')]())))['toString']();break;case _0x3475('0xaa'):_0x4ee8ff=squel[_0x3475('0x9d')]()[_0x3475('0xab')](_0x3475('0x9e'))['fromQuery']([_0x3475('0xa0'),_0x3475('0xa1'),_0x3475('0xa2'),'ListId',_0x3475('0x65'),_0x3475('0x5d'),_0x3475('0x5e')],squel[_0x3475('0x83')]()['field'](_0x3475('0xa0'),'phone')[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27',_0x3475('0xa1'))[_0x3475('0x84')]('id',_0x3475('0xa2'))[_0x3475('0x84')](_0x303fa3[_0x3475('0xa4')][_0x3475('0xa5')](),'ListId')[_0x3475('0x84')](_0x29dab3[_0x3475('0x4f')]['id'][_0x3475('0xa5')](),'VoiceQueueId')[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27',_0x3475('0x5d'))[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27',_0x3475('0x5e'))[_0x3475('0x86')]('cm_contacts')[_0x3475('0x48')](_0x3475('0xa7'))[_0x3475('0x48')](_0x3475('0xac'),_0x303fa3['CmListId']['toString']())[_0x3475('0x48')](_0x3475('0xad'))[_0x3475('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3475('0x84')](_0x3475('0xae'))[_0x3475('0x86')]('cm_hopper')[_0x3475('0x48')](_0x3475('0x89'),_0x29dab3[_0x3475('0x4f')]['id']['toString']())))['toString']();break;default:_0x4ee8ff=squel['insert']()[_0x3475('0xab')](_0x3475('0x9e'))[_0x3475('0x9f')]([_0x3475('0xa0'),_0x3475('0xa1'),_0x3475('0xa2'),'ListId',_0x3475('0x65'),_0x3475('0x5d'),_0x3475('0x5e')],squel[_0x3475('0x83')]()[_0x3475('0x84')](_0x3475('0xa0'),_0x3475('0xa0'))[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27',_0x3475('0xa1'))['field']('id',_0x3475('0xa2'))[_0x3475('0x84')](_0x303fa3['CmListId'][_0x3475('0xa5')](),'ListId')['field'](_0x29dab3[_0x3475('0x4f')]['id']['toString'](),'VoiceQueueId')[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27',_0x3475('0x5d'))[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27',_0x3475('0x5e'))[_0x3475('0x86')](_0x3475('0xa6'))[_0x3475('0x48')](_0x3475('0xa7'))['where'](_0x3475('0xac'),_0x303fa3[_0x3475('0xa4')][_0x3475('0xa5')]())[_0x3475('0x48')](_0x3475('0xad')))[_0x3475('0xa5')]();}_0xd3453[_0x3475('0x8b')](db[_0x3475('0x74')][_0x3475('0x3e')](_0x4ee8ff));}return BPromise['all'](_0xd3453);}})[_0x3475('0x28')](function(){var _0x59a19e=[];var _0x21b6bf=squel['insert']()['into'](_0x3475('0xaf'))[_0x3475('0x9f')]([_0x3475('0xb0'),_0x3475('0xa0'),_0x3475('0xb1'),'createdAt',_0x3475('0x5e')],squel[_0x3475('0x83')]()[_0x3475('0x84')](_0x3475('0xb2'))[_0x3475('0x84')]('ci.item')[_0x3475('0x84')](_0x3475('0xb3'))[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27','createdAt')[_0x3475('0x84')]('\x27'+_0x14b75c+'\x27',_0x3475('0x5e'))['from'](_0x3475('0xb4'),'ci')[_0x3475('0x88')](_0x3475('0x9e'),'h','h.ContactId=ci.CmContactId')['where'](_0x3475('0xb5'),_0x14b75c)[_0x3475('0x48')](_0x3475('0xb6'),_0x3475('0xb7')))[_0x3475('0xa5')]();_0x59a19e[_0x3475('0x8b')](db[_0x3475('0x74')][_0x3475('0x3e')](_0x21b6bf));return BPromise['all'](_0x59a19e);})[_0x3475('0x28')](function(){return _0x30b61a;})[_0x3475('0x28')](respondWithResult(_0x2e6d40,null))[_0x3475('0x4e')](handleError(_0x2e6d40,null));};exports['removeLists']=function(_0x2e541f,_0x2b2894,_0x5de29d){return db['VoiceQueue'][_0x3475('0x32')]({'where':{'id':_0x2e541f[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x2b2894,null))['then'](function(_0x522e4f){if(_0x522e4f){return _0x522e4f[_0x3475('0xb8')](_0x2e541f['query'][_0x3475('0x82')]);}})[_0x3475('0x28')](function(_0x5e5809){if(_0x5e5809){return db[_0x3475('0x62')][_0x3475('0x29')]({'where':{'ListId':_0x2e541f[_0x3475('0x3e')][_0x3475('0x82')],'VoiceQueueId':_0x2e541f[_0x3475('0x4f')]['id']}})[_0x3475('0x28')](function(){return _0x5e5809;});}})[_0x3475('0x28')](respondWithStatusCode(_0x2b2894,null))[_0x3475('0x4e')](handleError(_0x2b2894,null));};exports[_0x3475('0xb9')]=function(_0x4368fb,_0x11ea60,_0x4f64fa){var _0x4cd92b={};var _0x23782f={};var _0x2157a8;var _0x53d2ee;return db['VoiceQueue'][_0x3475('0x61')]({'where':{'id':_0x4368fb[_0x3475('0x4f')]['id']}})['then'](handleEntityNotFound(_0x11ea60,null))[_0x3475('0x28')](function(_0x1950ee){if(_0x1950ee){_0x2157a8=_0x1950ee;_0x23782f['model']=_[_0x3475('0x3d')](db[_0x3475('0xba')][_0x3475('0x3a')]);_0x23782f[_0x3475('0x3e')]=_[_0x3475('0x3d')](_0x4368fb[_0x3475('0x3e')]);_0x23782f[_0x3475('0x3f')]=_['intersection'](_0x23782f['model'],_0x23782f[_0x3475('0x3e')]);_0x4cd92b[_0x3475('0x41')]=_[_0x3475('0x40')](_0x23782f[_0x3475('0x3c')],qs['fields'](_0x4368fb[_0x3475('0x3e')][_0x3475('0x42')]));_0x4cd92b[_0x3475('0x41')]=_0x4cd92b[_0x3475('0x41')][_0x3475('0x43')]?_0x4cd92b[_0x3475('0x41')]:_0x23782f[_0x3475('0x3c')];_0x4cd92b['order']=qs[_0x3475('0x47')](_0x4368fb[_0x3475('0x3e')]['sort']);_0x4cd92b[_0x3475('0x48')]=qs[_0x3475('0x3f')](_[_0x3475('0x63')](_0x4368fb['query'],_0x23782f[_0x3475('0x3f')]));if(_0x4368fb[_0x3475('0x3e')][_0x3475('0x2d')]){_0x4cd92b[_0x3475('0x48')]=_[_0x3475('0x49')](_0x4cd92b[_0x3475('0x48')],{'$or':_[_0x3475('0x2f')](_0x4cd92b[_0x3475('0x41')],function(_0x191e4c){var _0x753426={};_0x753426[_0x191e4c]={'$like':'%'+_0x4368fb[_0x3475('0x3e')]['filter']+'%'};return _0x753426;})});}_0x4cd92b=_[_0x3475('0x49')]({},_0x4cd92b,_0x4368fb[_0x3475('0x4a')]);return _0x2157a8[_0x3475('0xb9')](_0x4cd92b);}})['then'](function(_0x53e4f5){if(_0x53e4f5){_0x53d2ee=_0x53e4f5[_0x3475('0x43')];if(!_0x4368fb[_0x3475('0x3e')]['hasOwnProperty'](_0x3475('0x45'))){_0x4cd92b[_0x3475('0x21')]=qs[_0x3475('0x21')](_0x4368fb['query'][_0x3475('0x21')]);_0x4cd92b['offset']=qs[_0x3475('0x1f')](_0x4368fb[_0x3475('0x3e')][_0x3475('0x1f')]);}return _0x2157a8[_0x3475('0xb9')](_0x4cd92b);}})[_0x3475('0x28')](function(_0x575e12){if(_0x575e12){return _0x575e12?{'count':_0x53d2ee,'rows':_0x575e12}:null;}})[_0x3475('0x28')](respondWithResult(_0x11ea60,null))[_0x3475('0x4e')](handleError(_0x11ea60,null));};exports[_0x3475('0xbb')]=function(_0x58fba1,_0x3ed37c,_0x48415e){var _0x570835,_0xf18e52;return db[_0x3475('0x39')]['find']({'where':{'id':_0x58fba1['params']['id']}})['then'](handleEntityNotFound(_0x3ed37c,null))['then'](function(_0x514aec){if(_0x514aec){_0xf18e52=_0x514aec;return _0x514aec[_0x3475('0xbb')](_0x58fba1[_0x3475('0x5f')][_0x3475('0x82')],_[_0x3475('0x5c')](_0x58fba1['body'],[_0x3475('0x82'),'id'])||{});}return null;})[_0x3475('0x94')](function(_0x3f04ec){var _0x258405;_0x570835=_0x3f04ec||[];var _0x1da7c5=[];if(_0x3f04ec){for(var _0x5885b1=0x0;_0x5885b1<_0x3f04ec[_0x3475('0x43')];_0x5885b1+=0x1){var _0x42de1d=_0x3f04ec[_0x5885b1][_0x3475('0x2a')]({'plain':!![]});_0x258405=squel[_0x3475('0x9d')]()[_0x3475('0xab')]('cm_hopper_black')[_0x3475('0x9f')]([_0x3475('0xa0'),'ContactId','ListId',_0x3475('0x65'),_0x3475('0x5d'),_0x3475('0x5e')],squel['select']()[_0x3475('0x84')](_0x3475('0xa0'),_0x3475('0xa0'))[_0x3475('0x84')]('id',_0x3475('0xa2'))[_0x3475('0x84')](_0x42de1d[_0x3475('0xa4')][_0x3475('0xa5')](),_0x3475('0xa3'))[_0x3475('0x84')](_0x58fba1[_0x3475('0x4f')]['id'][_0x3475('0xa5')](),_0x3475('0x65'))[_0x3475('0x84')](_0x3475('0xbc'),_0x3475('0x5d'))[_0x3475('0x84')]('NOW()',_0x3475('0x5e'))['from'](_0x3475('0xa6'))[_0x3475('0x48')](_0x3475('0xa7'))[_0x3475('0x48')](_0x3475('0xac'),_0x42de1d[_0x3475('0xa4')][_0x3475('0xa5')]())[_0x3475('0x48')](_0x3475('0xad')))['toString']();_0x1da7c5['push'](db[_0x3475('0x74')]['query'](_0x258405));}return BPromise['all'](_0x1da7c5);}})[_0x3475('0x28')](function(){return _0x570835;})[_0x3475('0x28')](respondWithResult(_0x3ed37c,null))['catch'](handleError(_0x3ed37c,null));};exports['removeBlackLists']=function(_0x365f19,_0x44dc85,_0x9f2598){return db[_0x3475('0x39')][_0x3475('0x32')]({'where':{'id':_0x365f19['params']['id']}})[_0x3475('0x28')](handleEntityNotFound(_0x44dc85,null))[_0x3475('0x28')](function(_0xdd99d2){if(_0xdd99d2){return _0xdd99d2[_0x3475('0xbd')](_0x365f19[_0x3475('0x3e')]['ids']);}})[_0x3475('0x28')](function(_0x17da57){if(_0x17da57){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x365f19['query']['ids'],'VoiceQueueId':_0x365f19['params']['id']}})[_0x3475('0x28')](function(){return _0x17da57;});}})['then'](respondWithStatusCode(_0x44dc85,null))[_0x3475('0x4e')](handleError(_0x44dc85,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index cad6690..8447edb 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 _0xf9cd=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x1ec3ba,_0x8686df){var _0x2029c7=function(_0x48c5e1){while(--_0x48c5e1){_0x1ec3ba['push'](_0x1ec3ba['shift']());}};_0x2029c7(++_0x8686df);}(_0xf9cd,0x106));var _0xdf9c=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xf9cd[_0x51020b];return _0x371e47;};'use strict';var EventEmitter=require(_0xdf9c('0x0'));var VoiceQueue=require(_0xdf9c('0x1'))['db'][_0xdf9c('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xdf9c('0x3')](0x0);var events={'afterCreate':_0xdf9c('0x4'),'afterUpdate':_0xdf9c('0x5'),'afterDestroy':_0xdf9c('0x6')};function emitEvent(_0x52e873){return function(_0x15b930,_0x207ba5,_0x1e716d){VoiceQueueEvents[_0xdf9c('0x7')](_0x52e873+':'+_0x15b930['id'],_0x15b930);VoiceQueueEvents[_0xdf9c('0x7')](_0x52e873,_0x15b930);_0x1e716d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xdf9c('0x8')](e,emitEvent(event));}}module[_0xdf9c('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x1439=['emit','hasOwnProperty','events','../../mysqldb','save','update','remove'];(function(_0x56737a,_0x29cb2e){var _0x47e109=function(_0x1e6d38){while(--_0x1e6d38){_0x56737a['push'](_0x56737a['shift']());}};_0x47e109(++_0x29cb2e);}(_0x1439,0x1e5));var _0x9143=function(_0x2e603b,_0x52345e){_0x2e603b=_0x2e603b-0x0;var _0x208f71=_0x1439[_0x2e603b];return _0x208f71;};'use strict';var EventEmitter=require(_0x9143('0x0'));var VoiceQueue=require(_0x9143('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9143('0x2'),'afterUpdate':_0x9143('0x3'),'afterDestroy':_0x9143('0x4')};function emitEvent(_0x375ae0){return function(_0x525940,_0x4ae96e,_0x4f395c){VoiceQueueEvents[_0x9143('0x5')](_0x375ae0+':'+_0x525940['id'],_0x525940);VoiceQueueEvents['emit'](_0x375ae0,_0x525940);_0x4f395c(null);};}for(var e in events){if(events[_0x9143('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 9751907..27fd190 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x4afcba,_0x480a36){var _0x2870e9=function(_0x57c6a3){while(--_0x57c6a3){_0x4afcba['push'](_0x4afcba['shift']());}};_0x2870e9(++_0x480a36);}(_0x34e8,0x12c));var _0x834e=function(_0x2e972b,_0x357145){_0x2e972b=_0x2e972b-0x0;var _0x33f9dd=_0x34e8[_0x2e972b];return _0x33f9dd;};'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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x44157d,_0x2b24ef){var _0xb8d331=function(_0x2d9812){while(--_0x2d9812){_0x44157d['push'](_0x44157d['shift']());}};_0xb8d331(++_0x2b24ef);}(_0x34e8,0x12c));var _0x834e=function(_0xa886e5,_0xa240f6){_0xa886e5=_0xa886e5-0x0;var _0x1aaf40=_0x34e8[_0xa886e5];return _0x1aaf40;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 3df0a73..27a09ac 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 _0xd620=['redis','defaults','localhost','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','catch','findAll','options','raw','where','limit','model','attributes','include','map','GetVoiceQueue','stringify','ShowVoiceQueue','VoiceQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xd620,0xda));var _0x0d62=function(_0x2dbfaa,_0x3402fb){_0x2dbfaa=_0x2dbfaa-0x0;var _0x2ed7bf=_0xd620[_0x2dbfaa];return _0x2ed7bf;};'use strict';var _=require(_0x0d62('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0d62('0x1'));var rs=require(_0x0d62('0x2'));var fs=require('fs');var Redis=require(_0x0d62('0x3'));var db=require(_0x0d62('0x4'))['db'];var utils=require(_0x0d62('0x5'));var logger=require('../../config/logger')(_0x0d62('0x6'));var config=require(_0x0d62('0x7'));var jayson=require(_0x0d62('0x8'));var client=jayson['client'][_0x0d62('0x9')]({'port':0x232a});config[_0x0d62('0xa')]=_[_0x0d62('0xb')](config[_0x0d62('0xa')],{'host':_0x0d62('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0d62('0xd'))[_0x0d62('0xe')](socket);function respondWithRpcPromise(_0x301bec,_0x3560e3,_0x591a62){return new BPromise(function(_0x299331,_0x29bce4){return client[_0x0d62('0xf')](_0x301bec,_0x591a62)['then'](function(_0x389a16){logger[_0x0d62('0x10')](_0x0d62('0x11'),_0x3560e3,_0x0d62('0x12'));logger[_0x0d62('0x13')](_0x0d62('0x14'),_0x3560e3,_0x0d62('0x12'),JSON['stringify'](_0x389a16));if(_0x389a16[_0x0d62('0x15')]){if(_0x389a16['error']['code']===0x1f4){logger[_0x0d62('0x15')](_0x0d62('0x11'),_0x3560e3,_0x389a16[_0x0d62('0x15')]['message']);return _0x29bce4(_0x389a16[_0x0d62('0x15')][_0x0d62('0x16')]);}logger[_0x0d62('0x15')](_0x0d62('0x11'),_0x3560e3,_0x389a16[_0x0d62('0x15')][_0x0d62('0x16')]);return _0x299331(_0x389a16[_0x0d62('0x15')]['message']);}else{logger[_0x0d62('0x10')](_0x0d62('0x11'),_0x3560e3,'request\x20sent');_0x299331(_0x389a16['result'][_0x0d62('0x16')]);}})[_0x0d62('0x17')](function(_0x4ffdb4){logger[_0x0d62('0x15')](_0x0d62('0x11'),_0x3560e3,_0x4ffdb4);_0x29bce4(_0x4ffdb4);});});}exports['GetVoiceQueue']=function(_0x894916){var _0x3db349=this;return new Promise(function(_0x16fe6e,_0x2d7fcf){return db['VoiceQueue'][_0x0d62('0x18')]({'raw':_0x894916[_0x0d62('0x19')]?_0x894916[_0x0d62('0x19')][_0x0d62('0x1a')]===undefined?!![]:![]:!![],'where':_0x894916[_0x0d62('0x19')]?_0x894916[_0x0d62('0x19')][_0x0d62('0x1b')]||null:null,'attributes':_0x894916[_0x0d62('0x19')]?_0x894916[_0x0d62('0x19')]['attributes']||null:null,'limit':_0x894916[_0x0d62('0x19')]?_0x894916[_0x0d62('0x19')][_0x0d62('0x1c')]||null:null,'include':_0x894916[_0x0d62('0x19')]?_0x894916[_0x0d62('0x19')]['include']?_['map'](_0x894916['options']['include'],function(_0x4722a6){return{'model':db[_0x4722a6[_0x0d62('0x1d')]],'as':_0x4722a6['as'],'attributes':_0x4722a6[_0x0d62('0x1e')],'include':_0x4722a6[_0x0d62('0x1f')]?_['map'](_0x4722a6[_0x0d62('0x1f')],function(_0x51c389){return{'model':db[_0x51c389[_0x0d62('0x1d')]],'as':_0x51c389['as'],'attributes':_0x51c389[_0x0d62('0x1e')],'include':_0x51c389['include']?_[_0x0d62('0x20')](_0x51c389[_0x0d62('0x1f')],function(_0x194b14){return{'model':db[_0x194b14[_0x0d62('0x1d')]],'as':_0x194b14['as'],'attributes':_0x194b14['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x34a30e){logger[_0x0d62('0x10')](_0x0d62('0x21'),_0x894916);logger[_0x0d62('0x13')](_0x0d62('0x21'),_0x894916,JSON[_0x0d62('0x22')](_0x34a30e));_0x16fe6e(_0x34a30e);})[_0x0d62('0x17')](function(_0xe416ae){logger[_0x0d62('0x15')](_0x0d62('0x21'),_0xe416ae['message'],_0x894916);_0x2d7fcf(_0x3db349[_0x0d62('0x15')](0x1f4,_0xe416ae[_0x0d62('0x16')]));});});};exports[_0x0d62('0x23')]=function(_0x3ecd61){var _0x2b4a03=this;return new Promise(function(_0x552889,_0x11e278){return db[_0x0d62('0x24')][_0x0d62('0x25')]({'raw':_0x3ecd61['options']?_0x3ecd61['options'][_0x0d62('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ecd61[_0x0d62('0x19')]?_0x3ecd61[_0x0d62('0x19')][_0x0d62('0x1b')]||null:null,'attributes':_0x3ecd61[_0x0d62('0x19')]?_0x3ecd61[_0x0d62('0x19')]['attributes']||null:null,'include':_0x3ecd61[_0x0d62('0x19')]?_0x3ecd61['options'][_0x0d62('0x1f')]?_['map'](_0x3ecd61[_0x0d62('0x19')][_0x0d62('0x1f')],function(_0x272be4){return{'model':db[_0x272be4[_0x0d62('0x1d')]],'as':_0x272be4['as'],'attributes':_0x272be4[_0x0d62('0x1e')],'include':_0x272be4[_0x0d62('0x1f')]?_['map'](_0x272be4[_0x0d62('0x1f')],function(_0x485b9c){return{'model':db[_0x485b9c[_0x0d62('0x1d')]],'as':_0x485b9c['as'],'attributes':_0x485b9c[_0x0d62('0x1e')],'include':_0x485b9c[_0x0d62('0x1f')]?_[_0x0d62('0x20')](_0x485b9c['include'],function(_0x5a25bb){return{'model':db[_0x5a25bb[_0x0d62('0x1d')]],'as':_0x5a25bb['as'],'attributes':_0x5a25bb[_0x0d62('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb5ee0c){logger[_0x0d62('0x10')](_0x0d62('0x23'),_0x3ecd61);logger['debug'](_0x0d62('0x23'),_0x3ecd61,JSON['stringify'](_0xb5ee0c));_0x552889(_0xb5ee0c);})[_0x0d62('0x17')](function(_0x2e0bfe){logger['error'](_0x0d62('0x23'),_0x2e0bfe[_0x0d62('0x16')],_0x3ecd61);_0x11e278(_0x2b4a03[_0x0d62('0x15')](0x1f4,_0x2e0bfe[_0x0d62('0x16')]));});});}; \ No newline at end of file +var _0xeee7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetVoiceQueue','ShowVoiceQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x29632e,_0x5ecba4){var _0x426e04=function(_0x4eb357){while(--_0x4eb357){_0x29632e['push'](_0x29632e['shift']());}};_0x426e04(++_0x5ecba4);}(_0xeee7,0x7d));var _0x7eee=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xeee7[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7eee('0x0'));var util=require('util');var moment=require(_0x7eee('0x1'));var BPromise=require(_0x7eee('0x2'));var rs=require(_0x7eee('0x3'));var fs=require('fs');var Redis=require(_0x7eee('0x4'));var db=require(_0x7eee('0x5'))['db'];var utils=require(_0x7eee('0x6'));var logger=require(_0x7eee('0x7'))(_0x7eee('0x8'));var config=require(_0x7eee('0x9'));var jayson=require(_0x7eee('0xa'));var client=jayson[_0x7eee('0xb')][_0x7eee('0xc')]({'port':0x232a});config[_0x7eee('0xd')]=_[_0x7eee('0xe')](config[_0x7eee('0xd')],{'host':_0x7eee('0xf'),'port':0x18eb});var socket=require(_0x7eee('0x10'))(new Redis(config[_0x7eee('0xd')]));require(_0x7eee('0x11'))[_0x7eee('0x12')](socket);function respondWithRpcPromise(_0x3b711d,_0x22db01,_0x58a6bf){return new BPromise(function(_0xc83fe8,_0x2f5f1a){return client[_0x7eee('0x13')](_0x3b711d,_0x58a6bf)[_0x7eee('0x14')](function(_0x431376){logger[_0x7eee('0x15')](_0x7eee('0x16'),_0x22db01,'request\x20sent');logger[_0x7eee('0x17')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x22db01,_0x7eee('0x18'),JSON[_0x7eee('0x19')](_0x431376));if(_0x431376[_0x7eee('0x1a')]){if(_0x431376[_0x7eee('0x1a')][_0x7eee('0x1b')]===0x1f4){logger[_0x7eee('0x1a')](_0x7eee('0x16'),_0x22db01,_0x431376[_0x7eee('0x1a')]['message']);return _0x2f5f1a(_0x431376[_0x7eee('0x1a')][_0x7eee('0x1c')]);}logger[_0x7eee('0x1a')](_0x7eee('0x16'),_0x22db01,_0x431376[_0x7eee('0x1a')][_0x7eee('0x1c')]);return _0xc83fe8(_0x431376[_0x7eee('0x1a')][_0x7eee('0x1c')]);}else{logger[_0x7eee('0x15')](_0x7eee('0x16'),_0x22db01,_0x7eee('0x18'));_0xc83fe8(_0x431376[_0x7eee('0x1d')][_0x7eee('0x1c')]);}})[_0x7eee('0x1e')](function(_0x4b05ce){logger[_0x7eee('0x1a')](_0x7eee('0x16'),_0x22db01,_0x4b05ce);_0x2f5f1a(_0x4b05ce);});});}exports['GetVoiceQueue']=function(_0x5f2ad9){var _0x593eb6=this;return new Promise(function(_0x1b6b22,_0x160ba2){return db[_0x7eee('0x1f')][_0x7eee('0x20')]({'raw':_0x5f2ad9[_0x7eee('0x21')]?_0x5f2ad9['options'][_0x7eee('0x22')]===undefined?!![]:![]:!![],'where':_0x5f2ad9[_0x7eee('0x21')]?_0x5f2ad9['options'][_0x7eee('0x23')]||null:null,'attributes':_0x5f2ad9[_0x7eee('0x21')]?_0x5f2ad9[_0x7eee('0x21')]['attributes']||null:null,'limit':_0x5f2ad9['options']?_0x5f2ad9['options'][_0x7eee('0x24')]||null:null,'include':_0x5f2ad9[_0x7eee('0x21')]?_0x5f2ad9[_0x7eee('0x21')][_0x7eee('0x25')]?_[_0x7eee('0x26')](_0x5f2ad9[_0x7eee('0x21')]['include'],function(_0x4eb8d8){return{'model':db[_0x4eb8d8[_0x7eee('0x27')]],'as':_0x4eb8d8['as'],'attributes':_0x4eb8d8[_0x7eee('0x28')],'include':_0x4eb8d8[_0x7eee('0x25')]?_[_0x7eee('0x26')](_0x4eb8d8[_0x7eee('0x25')],function(_0xc512a){return{'model':db[_0xc512a['model']],'as':_0xc512a['as'],'attributes':_0xc512a['attributes'],'include':_0xc512a['include']?_[_0x7eee('0x26')](_0xc512a[_0x7eee('0x25')],function(_0x256eef){return{'model':db[_0x256eef[_0x7eee('0x27')]],'as':_0x256eef['as'],'attributes':_0x256eef[_0x7eee('0x28')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x423028){logger[_0x7eee('0x15')](_0x7eee('0x29'),_0x5f2ad9);logger[_0x7eee('0x17')](_0x7eee('0x29'),_0x5f2ad9,JSON[_0x7eee('0x19')](_0x423028));_0x1b6b22(_0x423028);})[_0x7eee('0x1e')](function(_0x135431){logger[_0x7eee('0x1a')](_0x7eee('0x29'),_0x135431[_0x7eee('0x1c')],_0x5f2ad9);_0x160ba2(_0x593eb6[_0x7eee('0x1a')](0x1f4,_0x135431[_0x7eee('0x1c')]));});});};exports[_0x7eee('0x2a')]=function(_0x5a351b){var _0x2f74a8=this;return new Promise(function(_0x4b5595,_0x522cbf){return db[_0x7eee('0x1f')][_0x7eee('0x2b')]({'raw':_0x5a351b[_0x7eee('0x21')]?_0x5a351b[_0x7eee('0x21')][_0x7eee('0x22')]===undefined?!![]:![]:!![],'where':_0x5a351b[_0x7eee('0x21')]?_0x5a351b[_0x7eee('0x21')][_0x7eee('0x23')]||null:null,'attributes':_0x5a351b[_0x7eee('0x21')]?_0x5a351b[_0x7eee('0x21')]['attributes']||null:null,'include':_0x5a351b[_0x7eee('0x21')]?_0x5a351b['options'][_0x7eee('0x25')]?_[_0x7eee('0x26')](_0x5a351b[_0x7eee('0x21')][_0x7eee('0x25')],function(_0x3d84c2){return{'model':db[_0x3d84c2['model']],'as':_0x3d84c2['as'],'attributes':_0x3d84c2[_0x7eee('0x28')],'include':_0x3d84c2[_0x7eee('0x25')]?_[_0x7eee('0x26')](_0x3d84c2[_0x7eee('0x25')],function(_0x46c452){return{'model':db[_0x46c452[_0x7eee('0x27')]],'as':_0x46c452['as'],'attributes':_0x46c452['attributes'],'include':_0x46c452['include']?_[_0x7eee('0x26')](_0x46c452[_0x7eee('0x25')],function(_0x167afb){return{'model':db[_0x167afb[_0x7eee('0x27')]],'as':_0x167afb['as'],'attributes':_0x167afb[_0x7eee('0x28')]};}):[]};}):[]};}):[]:[]})[_0x7eee('0x14')](function(_0x13d6e2){logger[_0x7eee('0x15')]('ShowVoiceQueue',_0x5a351b);logger[_0x7eee('0x17')]('ShowVoiceQueue',_0x5a351b,JSON[_0x7eee('0x19')](_0x13d6e2));_0x4b5595(_0x13d6e2);})[_0x7eee('0x1e')](function(_0x1ee99a){logger[_0x7eee('0x1a')](_0x7eee('0x2a'),_0x1ee99a[_0x7eee('0x1c')],_0x5a351b);_0x522cbf(_0x2f74a8['error'](0x1f4,_0x1ee99a[_0x7eee('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 735f655..f7f3df2 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 _0xa872=['update','emit','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x1c969c,_0x2c0fbf){var _0x421d03=function(_0x2f4b4e){while(--_0x2f4b4e){_0x1c969c['push'](_0x1c969c['shift']());}};_0x421d03(++_0x2c0fbf);}(_0xa872,0x1b4));var _0x2a87=function(_0x336e7a,_0x211e1a){_0x336e7a=_0x336e7a-0x0;var _0x3764db=_0xa872[_0x336e7a];return _0x3764db;};'use strict';var VoiceQueueEvents=require(_0x2a87('0x0'));var events=[_0x2a87('0x1'),'remove',_0x2a87('0x2')];function createListener(_0x117a5a,_0x25ff4e){return function(_0x23385a){_0x25ff4e[_0x2a87('0x3')](_0x117a5a,_0x23385a);};}function removeListener(_0x5532a5,_0x57195b){return function(){VoiceQueueEvents['removeListener'](_0x5532a5,_0x57195b);};}exports['register']=function(_0xb3e6bc){for(var _0x23dd1a=0x0,_0x1fc688=events[_0x2a87('0x4')];_0x23dd1a<_0x1fc688;_0x23dd1a++){var _0x57471f=events[_0x23dd1a];var _0x2f45f0=createListener(_0x2a87('0x5')+_0x57471f,_0xb3e6bc);VoiceQueueEvents['on'](_0x57471f,_0x2f45f0);}}; \ No newline at end of file +var _0xa590=['voiceQueue:','remove','emit','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa590,0x129));var _0x0a59=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xa590[_0x58965a];return _0x254efc;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x0a59('0x0'),'update'];function createListener(_0x59da3d,_0xc8d18c){return function(_0x5a154b){_0xc8d18c[_0x0a59('0x1')](_0x59da3d,_0x5a154b);};}function removeListener(_0x59c03a,_0x22befe){return function(){VoiceQueueEvents['removeListener'](_0x59c03a,_0x22befe);};}exports[_0x0a59('0x2')]=function(_0x2963e7){for(var _0x2033a5=0x0,_0x1487ea=events['length'];_0x2033a5<_0x1487ea;_0x2033a5++){var _0x156a47=events[_0x2033a5];var _0x5d2a9a=createListener(_0x0a59('0x3')+_0x156a47,_0x2963e7);VoiceQueueEvents['on'](_0x156a47,_0x5d2a9a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index fbb802c..2e88448 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 _0xa257=['create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','getVoiceQueuesReport','/:id','show','post'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa257,0x147));var _0x7a25=function(_0x16882b,_0x5ba501){_0x16882b=_0x16882b-0x0;var _0xfdf30b=_0xa257[_0x16882b];return _0xfdf30b;};'use strict';var multer=require('multer');var util=require(_0x7a25('0x0'));var path=require('path');var timeout=require(_0x7a25('0x1'));var express=require(_0x7a25('0x2'));var router=express[_0x7a25('0x3')]();var fs_extra=require(_0x7a25('0x4'));var auth=require(_0x7a25('0x5'));var interaction=require(_0x7a25('0x6'));var config=require(_0x7a25('0x7'));var controller=require(_0x7a25('0x8'));router[_0x7a25('0x9')]('/',auth['isAuthenticated'](),controller[_0x7a25('0xa')]);router[_0x7a25('0x9')](_0x7a25('0xb'),auth[_0x7a25('0xc')](),controller[_0x7a25('0xd')]);router[_0x7a25('0x9')]('/index',auth[_0x7a25('0xc')](),controller[_0x7a25('0xe')]);router['get'](_0x7a25('0xf'),auth[_0x7a25('0xc')](),controller[_0x7a25('0x10')]);router[_0x7a25('0x11')]('/',auth[_0x7a25('0xc')](),controller[_0x7a25('0x12')]);router[_0x7a25('0x13')](_0x7a25('0xf'),auth['isAuthenticated'](),controller[_0x7a25('0x14')]);router[_0x7a25('0x15')](_0x7a25('0xf'),auth[_0x7a25('0xc')](),controller['destroy']);module[_0x7a25('0x16')]=router; \ No newline at end of file +var _0x3ed9=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index','show','create','/:id','update','delete','exports','multer'];(function(_0xa016f6,_0x3a8863){var _0x313949=function(_0x570eeb){while(--_0x570eeb){_0xa016f6['push'](_0xa016f6['shift']());}};_0x313949(++_0x3a8863);}(_0x3ed9,0x1f3));var _0x93ed=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0x3ed9[_0x1139d0];return _0xcc01a6;};'use strict';var multer=require(_0x93ed('0x0'));var util=require(_0x93ed('0x1'));var path=require('path');var timeout=require(_0x93ed('0x2'));var express=require(_0x93ed('0x3'));var router=express['Router']();var fs_extra=require(_0x93ed('0x4'));var auth=require(_0x93ed('0x5'));var interaction=require(_0x93ed('0x6'));var config=require('../../config/environment');var controller=require(_0x93ed('0x7'));router[_0x93ed('0x8')]('/',auth['isAuthenticated'](),controller[_0x93ed('0x9')]);router[_0x93ed('0x8')](_0x93ed('0xa'),auth[_0x93ed('0xb')](),controller[_0x93ed('0xc')]);router['get'](_0x93ed('0xd'),auth[_0x93ed('0xb')](),controller['getVoiceQueuesReport']);router[_0x93ed('0x8')]('/:id',auth[_0x93ed('0xb')](),controller[_0x93ed('0xe')]);router['post']('/',auth[_0x93ed('0xb')](),controller[_0x93ed('0xf')]);router['put'](_0x93ed('0x10'),auth[_0x93ed('0xb')](),controller[_0x93ed('0x11')]);router[_0x93ed('0x12')](_0x93ed('0x10'),auth[_0x93ed('0xb')](),controller['destroy']);module[_0x93ed('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 81e8bfd..f9e57cd 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 _0x0944=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x0944,0x189));var _0x4094=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x0944[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x4094('0x0'));var moment=require(_0x4094('0x1'));module[_0x4094('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4094('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4094('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x4094('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x4094('0x4')],'set':function(_0x3cbdf6){var _0x9ba1b5=moment(_0x3cbdf6);var _0x2f334c=moment(this[_0x4094('0x5')](_0x4094('0x6')))['format'](_0x4094('0x7'));var _0x17e977=_0x9ba1b5[_0x4094('0x8')](_0x2f334c,_0x4094('0x9'));this['setDataValue'](_0x4094('0xa'),_0x3cbdf6);this[_0x4094('0xb')](_0x4094('0xc'),_0x17e977||null);}},'position':{'type':Sequelize[_0x4094('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x4094('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4094('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x4094('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4094('0x4')]},'queuecallerexit':{'type':Sequelize[_0x4094('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4094('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x4094('0x3')],'comment':_0x4094('0xf')},'originalposition':{'type':Sequelize[_0x4094('0xd')]},'channel':{'type':Sequelize[_0x4094('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4094('0x3')]},'context':{'type':Sequelize[_0x4094('0x3')]},'exten':{'type':Sequelize[_0x4094('0x3')]},'priority':{'type':Sequelize[_0x4094('0x3')]},'holdtime':{'type':Sequelize[_0x4094('0xd')]},'mohtime':{'type':Sequelize[_0x4094('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4094('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4094('0x3')]},'transfer':{'type':Sequelize[_0x4094('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4094('0x3')],'comment':_0x4094('0x10')},'transferexten':{'type':Sequelize[_0x4094('0x3')]},'transferuniqueid':{'type':Sequelize[_0x4094('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4094('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4094('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x4094('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6886=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','setDataValue','queuecallerleaveAt','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER'];(function(_0x1cb01e,_0x41b1b7){var _0x1c56cf=function(_0x32ab64){while(--_0x32ab64){_0x1cb01e['push'](_0x1cb01e['shift']());}};_0x1c56cf(++_0x41b1b7);}(_0x6886,0x187));var _0x6688=function(_0x4aa9c4,_0x2f86b1){_0x4aa9c4=_0x4aa9c4-0x0;var _0x533e5b=_0x6886[_0x4aa9c4];return _0x533e5b;};'use strict';var Sequelize=require(_0x6688('0x0'));var moment=require(_0x6688('0x1'));module[_0x6688('0x2')]={'type':{'type':Sequelize[_0x6688('0x3')]},'uniqueid':{'type':Sequelize[_0x6688('0x3')]},'calleridnum':{'type':Sequelize[_0x6688('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6688('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6688('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6688('0x4')],'set':function(_0x28558f){var _0x43546f=moment(_0x28558f);var _0xb58cea=moment(this['getDataValue'](_0x6688('0x5')))['format'](_0x6688('0x6'));var _0x17decb=_0x43546f['diff'](_0xb58cea,'seconds');this[_0x6688('0x7')](_0x6688('0x8'),_0x28558f);this[_0x6688('0x7')]('holdtime',_0x17decb||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x6688('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6688('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6688('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6688('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6688('0x3')],'comment':_0x6688('0xa')},'originalposition':{'type':Sequelize[_0x6688('0xb')]},'channel':{'type':Sequelize[_0x6688('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6688('0x3')]},'connectedlinename':{'type':Sequelize[_0x6688('0x3')]},'accountcode':{'type':Sequelize[_0x6688('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6688('0x3')]},'priority':{'type':Sequelize[_0x6688('0x3')]},'holdtime':{'type':Sequelize[_0x6688('0xb')]},'mohtime':{'type':Sequelize[_0x6688('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6688('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6688('0x3')],'comment':_0x6688('0xc')},'transferexten':{'type':Sequelize[_0x6688('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6688('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6688('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x6688('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x6688('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 110153a..36d0072 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 _0xa79d=['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','defaults','redis','socket.io-emitter','register','sendStatus','status','end','limit','count','offset','set','apply','save','then','destroy','error','stack','name','index','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','VoiceQueueReport','findAll','params','length','find','create','body','catch','describe','getVoiceQueuesReport','filters','hasOwnProperty','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0xa79d,0x1e2));var _0xda79=function(_0x42f530,_0x385676){_0x42f530=_0x42f530-0x0;var _0x2263cd=_0xa79d[_0x42f530];return _0x2263cd;};'use strict';var emlformat=require(_0xda79('0x0'));var rimraf=require(_0xda79('0x1'));var zipdir=require(_0xda79('0x2'));var jsonpatch=require(_0xda79('0x3'));var rp=require('request-promise');var moment=require(_0xda79('0x4'));var BPromise=require(_0xda79('0x5'));var Mustache=require(_0xda79('0x6'));var util=require(_0xda79('0x7'));var path=require('path');var sox=require(_0xda79('0x8'));var csv=require('to-csv');var ejs=require(_0xda79('0x9'));var fs=require('fs');var fs_extra=require(_0xda79('0xa'));var _=require(_0xda79('0xb'));var squel=require(_0xda79('0xc'));var crypto=require(_0xda79('0xd'));var jsforce=require(_0xda79('0xe'));var deskjs=require(_0xda79('0xf'));var toCsv=require(_0xda79('0x10'));var querystring=require(_0xda79('0x11'));var Papa=require(_0xda79('0x12'));var Redis=require(_0xda79('0x13'));var authService=require(_0xda79('0x14'));var qs=require(_0xda79('0x15'));var as=require(_0xda79('0x16'));var hardwareService=require(_0xda79('0x17'));var logger=require(_0xda79('0x18'))(_0xda79('0x19'));var utils=require(_0xda79('0x1a'));var config=require(_0xda79('0x1b'));var licenseUtil=require(_0xda79('0x1c'));var db=require(_0xda79('0x1d'))['db'];config['redis']=_[_0xda79('0x1e')](config[_0xda79('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0xda79('0x20'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xda79('0x21')](socket);function respondWithStatusCode(_0x429e83,_0x11654e){_0x11654e=_0x11654e||0xcc;return function(_0x16d7d7){if(_0x16d7d7){return _0x429e83[_0xda79('0x22')](_0x11654e);}return _0x429e83[_0xda79('0x23')](_0x11654e)[_0xda79('0x24')]();};}function respondWithResult(_0x23440c,_0x2ca204){_0x2ca204=_0x2ca204||0xc8;return function(_0xcca3ec){if(_0xcca3ec){return _0x23440c[_0xda79('0x23')](_0x2ca204)['json'](_0xcca3ec);}};}function respondWithFilteredResult(_0x585ab3,_0xabac0e){return function(_0x245e97){if(_0x245e97){var _0x1bd088=typeof _0xabac0e['offset']==='undefined'&&typeof _0xabac0e[_0xda79('0x25')]==='undefined';var _0x52bf91=_0x245e97[_0xda79('0x26')];var _0x443423=_0x1bd088?0x0:_0xabac0e['offset'];var _0x3fe387=_0x1bd088?_0x245e97[_0xda79('0x26')]:_0xabac0e[_0xda79('0x27')]+_0xabac0e[_0xda79('0x25')];var _0x145a81;if(_0x3fe387>=_0x52bf91){_0x3fe387=_0x52bf91;_0x145a81=0xc8;}else{_0x145a81=0xce;}_0x585ab3[_0xda79('0x23')](_0x145a81);return _0x585ab3[_0xda79('0x28')]('Content-Range',_0x443423+'-'+_0x3fe387+'/'+_0x52bf91)['json'](_0x245e97);}return null;};}function patchUpdates(_0x9e7b40){return function(_0x2b7f79){try{jsonpatch[_0xda79('0x29')](_0x2b7f79,_0x9e7b40,!![]);}catch(_0x37916d){return BPromise['reject'](_0x37916d);}return _0x2b7f79[_0xda79('0x2a')]();};}function saveUpdates(_0x2db199,_0x3b9d21){return function(_0x5d3da2){if(_0x5d3da2){return _0x5d3da2['update'](_0x2db199)[_0xda79('0x2b')](function(_0x3b933f){return _0x3b933f;});}return null;};}function removeEntity(_0x355258,_0x599166){return function(_0x45ca94){if(_0x45ca94){return _0x45ca94[_0xda79('0x2c')]()[_0xda79('0x2b')](function(){_0x355258[_0xda79('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x135ac1,_0x2a1c05){return function(_0x28f8c5){if(!_0x28f8c5){_0x135ac1[_0xda79('0x22')](0x194);}return _0x28f8c5;};}function handleError(_0x5db7a8,_0x42d971){_0x42d971=_0x42d971||0x1f4;return function(_0x373d4d){logger[_0xda79('0x2d')](_0x373d4d[_0xda79('0x2e')]);if(_0x373d4d[_0xda79('0x2f')]){delete _0x373d4d[_0xda79('0x2f')];}_0x5db7a8[_0xda79('0x23')](_0x42d971)['send'](_0x373d4d);};}exports[_0xda79('0x30')]=function(_0x4b19fc,_0x4ea098){var _0x67e1a4={},_0x463d42={},_0x15f134={'count':0x0,'rows':[]};var _0x550767=_[_0xda79('0x31')](db['VoiceQueueReport'][_0xda79('0x32')],function(_0x1e324a){return{'name':_0x1e324a['fieldName'],'type':_0x1e324a[_0xda79('0x33')][_0xda79('0x34')]};});_0x463d42['model']=_[_0xda79('0x31')](_0x550767,'name');_0x463d42[_0xda79('0x35')]=_[_0xda79('0x36')](_0x4b19fc['query']);_0x463d42['filters']=_[_0xda79('0x37')](_0x463d42[_0xda79('0x38')],_0x463d42['query']);_0x67e1a4[_0xda79('0x39')]=_[_0xda79('0x37')](_0x463d42[_0xda79('0x38')],qs[_0xda79('0x3a')](_0x4b19fc[_0xda79('0x35')][_0xda79('0x3a')]));_0x67e1a4[_0xda79('0x39')]=_0x67e1a4['attributes']['length']?_0x67e1a4[_0xda79('0x39')]:_0x463d42[_0xda79('0x38')];if(!_0x4b19fc[_0xda79('0x35')]['hasOwnProperty'](_0xda79('0x3b'))){_0x67e1a4[_0xda79('0x25')]=qs['limit'](_0x4b19fc[_0xda79('0x35')]['limit']);_0x67e1a4[_0xda79('0x27')]=qs[_0xda79('0x27')](_0x4b19fc[_0xda79('0x35')]['offset']);}_0x67e1a4[_0xda79('0x3c')]=qs['sort'](_0x4b19fc[_0xda79('0x35')][_0xda79('0x3d')]);_0x67e1a4[_0xda79('0x3e')]=qs['filters'](_[_0xda79('0x3f')](_0x4b19fc[_0xda79('0x35')],_0x463d42['filters']),_0x550767);if(_0x4b19fc['query'][_0xda79('0x40')]){_0x67e1a4[_0xda79('0x3e')]=_['merge'](_0x67e1a4[_0xda79('0x3e')],{'$or':_[_0xda79('0x31')](_0x550767,function(_0x542b9c){if(_0x542b9c['type']!=='VIRTUAL'){var _0x45dc44={};_0x45dc44[_0x542b9c[_0xda79('0x2f')]]={'$like':'%'+_0x4b19fc[_0xda79('0x35')][_0xda79('0x40')]+'%'};return _0x45dc44;}})});}_0x67e1a4=_[_0xda79('0x41')]({},_0x67e1a4,_0x4b19fc[_0xda79('0x42')]);var _0xcc4d78={'where':_0x67e1a4[_0xda79('0x3e')]};return db['VoiceQueueReport']['count'](_0xcc4d78)[_0xda79('0x2b')](function(_0x2492cb){_0x15f134[_0xda79('0x26')]=_0x2492cb;if(_0x4b19fc['query'][_0xda79('0x43')]){_0x67e1a4[_0xda79('0x44')]=[{'all':!![]}];}return db[_0xda79('0x45')][_0xda79('0x46')](_0x67e1a4);})[_0xda79('0x2b')](function(_0x210cf2){_0x15f134['rows']=_0x210cf2;return _0x15f134;})[_0xda79('0x2b')](respondWithFilteredResult(_0x4ea098,_0x67e1a4))['catch'](handleError(_0x4ea098,null));};exports['show']=function(_0x1f5e02,_0x35adf7){var _0x5bfbab={'raw':![],'where':{'id':_0x1f5e02[_0xda79('0x47')]['id']}},_0x1d0c1c={};_0x1d0c1c[_0xda79('0x38')]=_['keys'](db[_0xda79('0x45')][_0xda79('0x32')]);_0x1d0c1c[_0xda79('0x35')]=_[_0xda79('0x36')](_0x1f5e02['query']);_0x1d0c1c['filters']=_[_0xda79('0x37')](_0x1d0c1c[_0xda79('0x38')],_0x1d0c1c[_0xda79('0x35')]);_0x5bfbab[_0xda79('0x39')]=_[_0xda79('0x37')](_0x1d0c1c['model'],qs[_0xda79('0x3a')](_0x1f5e02[_0xda79('0x35')]['fields']));_0x5bfbab[_0xda79('0x39')]=_0x5bfbab[_0xda79('0x39')][_0xda79('0x48')]?_0x5bfbab[_0xda79('0x39')]:_0x1d0c1c[_0xda79('0x38')];if(_0x1f5e02['query'][_0xda79('0x43')]){_0x5bfbab[_0xda79('0x44')]=[{'all':!![]}];}_0x5bfbab=_[_0xda79('0x41')]({},_0x5bfbab,_0x1f5e02['options']);return db[_0xda79('0x45')][_0xda79('0x49')](_0x5bfbab)['then'](handleEntityNotFound(_0x35adf7,null))['then'](respondWithResult(_0x35adf7,null))['catch'](handleError(_0x35adf7,null));};exports[_0xda79('0x4a')]=function(_0x5628c6,_0x19d651){return db[_0xda79('0x45')][_0xda79('0x4a')](_0x5628c6[_0xda79('0x4b')],{})['then'](respondWithResult(_0x19d651,0xc9))[_0xda79('0x4c')](handleError(_0x19d651,null));};exports['update']=function(_0x1947db,_0x543016){if(_0x1947db['body']['id']){delete _0x1947db[_0xda79('0x4b')]['id'];}return db[_0xda79('0x45')][_0xda79('0x49')]({'where':{'id':_0x1947db[_0xda79('0x47')]['id']}})[_0xda79('0x2b')](handleEntityNotFound(_0x543016,null))['then'](saveUpdates(_0x1947db[_0xda79('0x4b')],null))[_0xda79('0x2b')](respondWithResult(_0x543016,null))['catch'](handleError(_0x543016,null));};exports[_0xda79('0x2c')]=function(_0x235a85,_0x42a1bf){return db[_0xda79('0x45')]['find']({'where':{'id':_0x235a85['params']['id']}})[_0xda79('0x2b')](handleEntityNotFound(_0x42a1bf,null))[_0xda79('0x2b')](removeEntity(_0x42a1bf,null))[_0xda79('0x4c')](handleError(_0x42a1bf,null));};exports['describe']=function(_0x991334,_0x5b5e4b){return db[_0xda79('0x45')][_0xda79('0x4d')]()[_0xda79('0x2b')](respondWithResult(_0x5b5e4b,null))[_0xda79('0x4c')](handleError(_0x5b5e4b,null));};exports[_0xda79('0x4e')]=function(_0x2fbd0c,_0x4cd4d5){var _0x1f2ac6={},_0x14a354={},_0x12e981={'count':0x0,'rows':[]};_0x14a354[_0xda79('0x38')]=_[_0xda79('0x36')](db[_0xda79('0x45')][_0xda79('0x32')]);_0x14a354[_0xda79('0x35')]=_[_0xda79('0x36')](_0x2fbd0c[_0xda79('0x35')]);_0x14a354[_0xda79('0x4f')]=_[_0xda79('0x37')](_0x14a354[_0xda79('0x38')],_0x14a354['query']);_0x1f2ac6['attributes']=_['intersection'](_0x14a354[_0xda79('0x38')],qs[_0xda79('0x3a')](_0x2fbd0c['query'][_0xda79('0x3a')]));_0x1f2ac6[_0xda79('0x39')]=_0x1f2ac6[_0xda79('0x39')][_0xda79('0x48')]?_0x1f2ac6['attributes']:_0x14a354[_0xda79('0x38')];if(!_0x2fbd0c[_0xda79('0x35')][_0xda79('0x50')](_0xda79('0x3b'))){_0x1f2ac6[_0xda79('0x25')]=qs['limit'](_0x2fbd0c[_0xda79('0x35')][_0xda79('0x25')]);_0x1f2ac6['offset']=qs[_0xda79('0x27')](_0x2fbd0c[_0xda79('0x35')]['offset']);}_0x1f2ac6[_0xda79('0x3c')]=qs[_0xda79('0x3d')](_0x2fbd0c['query'][_0xda79('0x3d')]);_0x1f2ac6[_0xda79('0x3e')]=qs[_0xda79('0x4f')](_[_0xda79('0x3f')](_0x2fbd0c[_0xda79('0x35')],_0x14a354[_0xda79('0x4f')]));if(_0x2fbd0c[_0xda79('0x35')][_0xda79('0x40')]){_0x1f2ac6[_0xda79('0x3e')]=_[_0xda79('0x41')](_0x1f2ac6[_0xda79('0x3e')],{'$or':_[_0xda79('0x31')](_0x1f2ac6[_0xda79('0x39')],function(_0x2b9860){var _0x556e70={};_0x556e70[_0x2b9860]={'$like':'%'+_0x2fbd0c['query'][_0xda79('0x40')]+'%'};return _0x556e70;})});}_0x1f2ac6=_[_0xda79('0x41')]({},_0x1f2ac6,_0x2fbd0c['options']);var _0x3c866f={'where':_0x1f2ac6['where']};return db[_0xda79('0x45')][_0xda79('0x26')](_0x3c866f)['then'](function(_0x58eea8){_0x12e981['count']=_0x58eea8;if(_0x2fbd0c['query'][_0xda79('0x43')]){_0x1f2ac6[_0xda79('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x1f2ac6);})[_0xda79('0x2b')](function(_0x55d652){_0x12e981[_0xda79('0x51')]=_0x55d652;return _0x12e981;})[_0xda79('0x2b')](respondWithFilteredResult(_0x4cd4d5,_0x1f2ac6,_0xda79('0x4e')))['catch'](handleError(_0x4cd4d5,null,_0xda79('0x4e')));}; \ No newline at end of file +var _0x0b69=['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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','offset','undefined','limit','count','set','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','params','includeAll','catch','create','body','update','find','describe','getVoiceQueuesReport','rawAttributes'];(function(_0x109946,_0x3494b7){var _0x4ed20b=function(_0x578aa4){while(--_0x578aa4){_0x109946['push'](_0x109946['shift']());}};_0x4ed20b(++_0x3494b7);}(_0x0b69,0xa6));var _0x90b6=function(_0x113855,_0x2bd31b){_0x113855=_0x113855-0x0;var _0x229a37=_0x0b69[_0x113855];return _0x229a37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90b6('0x0'));var zipdir=require(_0x90b6('0x1'));var jsonpatch=require(_0x90b6('0x2'));var rp=require(_0x90b6('0x3'));var moment=require(_0x90b6('0x4'));var BPromise=require(_0x90b6('0x5'));var Mustache=require(_0x90b6('0x6'));var util=require(_0x90b6('0x7'));var path=require(_0x90b6('0x8'));var sox=require(_0x90b6('0x9'));var csv=require(_0x90b6('0xa'));var ejs=require(_0x90b6('0xb'));var fs=require('fs');var fs_extra=require(_0x90b6('0xc'));var _=require(_0x90b6('0xd'));var squel=require(_0x90b6('0xe'));var crypto=require(_0x90b6('0xf'));var jsforce=require(_0x90b6('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x90b6('0x11'));var Papa=require(_0x90b6('0x12'));var Redis=require(_0x90b6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x90b6('0x14'));var as=require(_0x90b6('0x15'));var hardwareService=require(_0x90b6('0x16'));var logger=require(_0x90b6('0x17'))('api');var utils=require(_0x90b6('0x18'));var config=require(_0x90b6('0x19'));var licenseUtil=require(_0x90b6('0x1a'));var db=require('../../mysqldb')['db'];config[_0x90b6('0x1b')]=_[_0x90b6('0x1c')](config['redis'],{'host':_0x90b6('0x1d'),'port':0x18eb});var socket=require(_0x90b6('0x1e'))(new Redis(config[_0x90b6('0x1b')]));require(_0x90b6('0x1f'))[_0x90b6('0x20')](socket);function respondWithStatusCode(_0x527fd2,_0x463c2e){_0x463c2e=_0x463c2e||0xcc;return function(_0x19f406){if(_0x19f406){return _0x527fd2['sendStatus'](_0x463c2e);}return _0x527fd2[_0x90b6('0x21')](_0x463c2e)['end']();};}function respondWithResult(_0x4c2cf9,_0x395456){_0x395456=_0x395456||0xc8;return function(_0x158734){if(_0x158734){return _0x4c2cf9[_0x90b6('0x21')](_0x395456)[_0x90b6('0x22')](_0x158734);}};}function respondWithFilteredResult(_0x4f7825,_0x961553){return function(_0x18304e){if(_0x18304e){var _0x3c474a=typeof _0x961553[_0x90b6('0x23')]===_0x90b6('0x24')&&typeof _0x961553[_0x90b6('0x25')]===_0x90b6('0x24');var _0x56b4a9=_0x18304e[_0x90b6('0x26')];var _0x289c82=_0x3c474a?0x0:_0x961553[_0x90b6('0x23')];var _0x40ba65=_0x3c474a?_0x18304e[_0x90b6('0x26')]:_0x961553[_0x90b6('0x23')]+_0x961553['limit'];var _0x989aa0;if(_0x40ba65>=_0x56b4a9){_0x40ba65=_0x56b4a9;_0x989aa0=0xc8;}else{_0x989aa0=0xce;}_0x4f7825[_0x90b6('0x21')](_0x989aa0);return _0x4f7825[_0x90b6('0x27')]('Content-Range',_0x289c82+'-'+_0x40ba65+'/'+_0x56b4a9)['json'](_0x18304e);}return null;};}function patchUpdates(_0x26e488){return function(_0x2bbfe2){try{jsonpatch['apply'](_0x2bbfe2,_0x26e488,!![]);}catch(_0x2138c7){return BPromise['reject'](_0x2138c7);}return _0x2bbfe2['save']();};}function saveUpdates(_0x3c424b,_0x8f237a){return function(_0x981ae8){if(_0x981ae8){return _0x981ae8['update'](_0x3c424b)[_0x90b6('0x28')](function(_0x2c49f9){return _0x2c49f9;});}return null;};}function removeEntity(_0x3abc6b,_0x1d058b){return function(_0x199bd8){if(_0x199bd8){return _0x199bd8[_0x90b6('0x29')]()[_0x90b6('0x28')](function(){_0x3abc6b['status'](0xcc)[_0x90b6('0x2a')]();});}};}function handleEntityNotFound(_0x45608f,_0x449be9){return function(_0x4aacaf){if(!_0x4aacaf){_0x45608f[_0x90b6('0x2b')](0x194);}return _0x4aacaf;};}function handleError(_0x485ab0,_0x38a3fd){_0x38a3fd=_0x38a3fd||0x1f4;return function(_0x504c8b){logger[_0x90b6('0x2c')](_0x504c8b[_0x90b6('0x2d')]);if(_0x504c8b[_0x90b6('0x2e')]){delete _0x504c8b[_0x90b6('0x2e')];}_0x485ab0[_0x90b6('0x21')](_0x38a3fd)[_0x90b6('0x2f')](_0x504c8b);};}exports[_0x90b6('0x30')]=function(_0x5ae853,_0x3bebc2){var _0x1fa64f={},_0x159f1f={},_0x2b1804={'count':0x0,'rows':[]};var _0x3ba654=_[_0x90b6('0x31')](db[_0x90b6('0x32')]['rawAttributes'],function(_0x3f4ad7){return{'name':_0x3f4ad7[_0x90b6('0x33')],'type':_0x3f4ad7[_0x90b6('0x34')]['key']};});_0x159f1f[_0x90b6('0x35')]=_[_0x90b6('0x31')](_0x3ba654,_0x90b6('0x2e'));_0x159f1f[_0x90b6('0x36')]=_[_0x90b6('0x37')](_0x5ae853[_0x90b6('0x36')]);_0x159f1f[_0x90b6('0x38')]=_[_0x90b6('0x39')](_0x159f1f[_0x90b6('0x35')],_0x159f1f[_0x90b6('0x36')]);_0x1fa64f[_0x90b6('0x3a')]=_[_0x90b6('0x39')](_0x159f1f[_0x90b6('0x35')],qs[_0x90b6('0x3b')](_0x5ae853[_0x90b6('0x36')][_0x90b6('0x3b')]));_0x1fa64f[_0x90b6('0x3a')]=_0x1fa64f['attributes'][_0x90b6('0x3c')]?_0x1fa64f[_0x90b6('0x3a')]:_0x159f1f[_0x90b6('0x35')];if(!_0x5ae853[_0x90b6('0x36')][_0x90b6('0x3d')](_0x90b6('0x3e'))){_0x1fa64f[_0x90b6('0x25')]=qs[_0x90b6('0x25')](_0x5ae853[_0x90b6('0x36')][_0x90b6('0x25')]);_0x1fa64f[_0x90b6('0x23')]=qs['offset'](_0x5ae853[_0x90b6('0x36')][_0x90b6('0x23')]);}_0x1fa64f[_0x90b6('0x3f')]=qs[_0x90b6('0x40')](_0x5ae853[_0x90b6('0x36')][_0x90b6('0x40')]);_0x1fa64f['where']=qs[_0x90b6('0x38')](_[_0x90b6('0x41')](_0x5ae853['query'],_0x159f1f[_0x90b6('0x38')]),_0x3ba654);if(_0x5ae853[_0x90b6('0x36')][_0x90b6('0x42')]){_0x1fa64f[_0x90b6('0x43')]=_['merge'](_0x1fa64f[_0x90b6('0x43')],{'$or':_[_0x90b6('0x31')](_0x3ba654,function(_0x79075b){if(_0x79075b[_0x90b6('0x34')]!==_0x90b6('0x44')){var _0x5e575b={};_0x5e575b[_0x79075b[_0x90b6('0x2e')]]={'$like':'%'+_0x5ae853[_0x90b6('0x36')][_0x90b6('0x42')]+'%'};return _0x5e575b;}})});}_0x1fa64f=_[_0x90b6('0x45')]({},_0x1fa64f,_0x5ae853[_0x90b6('0x46')]);var _0x2983ac={'where':_0x1fa64f[_0x90b6('0x43')]};return db[_0x90b6('0x32')][_0x90b6('0x26')](_0x2983ac)[_0x90b6('0x28')](function(_0x1e70b1){_0x2b1804[_0x90b6('0x26')]=_0x1e70b1;if(_0x5ae853[_0x90b6('0x36')]['includeAll']){_0x1fa64f[_0x90b6('0x47')]=[{'all':!![]}];}return db[_0x90b6('0x32')][_0x90b6('0x48')](_0x1fa64f);})[_0x90b6('0x28')](function(_0x1660db){_0x2b1804['rows']=_0x1660db;return _0x2b1804;})[_0x90b6('0x28')](respondWithFilteredResult(_0x3bebc2,_0x1fa64f))['catch'](handleError(_0x3bebc2,null));};exports['show']=function(_0x29ffde,_0x155e70){var _0x5e0b3b={'raw':![],'where':{'id':_0x29ffde[_0x90b6('0x49')]['id']}},_0x4228ca={};_0x4228ca[_0x90b6('0x35')]=_[_0x90b6('0x37')](db[_0x90b6('0x32')]['rawAttributes']);_0x4228ca['query']=_[_0x90b6('0x37')](_0x29ffde['query']);_0x4228ca[_0x90b6('0x38')]=_[_0x90b6('0x39')](_0x4228ca[_0x90b6('0x35')],_0x4228ca[_0x90b6('0x36')]);_0x5e0b3b['attributes']=_[_0x90b6('0x39')](_0x4228ca[_0x90b6('0x35')],qs[_0x90b6('0x3b')](_0x29ffde[_0x90b6('0x36')][_0x90b6('0x3b')]));_0x5e0b3b[_0x90b6('0x3a')]=_0x5e0b3b[_0x90b6('0x3a')][_0x90b6('0x3c')]?_0x5e0b3b[_0x90b6('0x3a')]:_0x4228ca[_0x90b6('0x35')];if(_0x29ffde['query'][_0x90b6('0x4a')]){_0x5e0b3b[_0x90b6('0x47')]=[{'all':!![]}];}_0x5e0b3b=_[_0x90b6('0x45')]({},_0x5e0b3b,_0x29ffde['options']);return db[_0x90b6('0x32')]['find'](_0x5e0b3b)[_0x90b6('0x28')](handleEntityNotFound(_0x155e70,null))[_0x90b6('0x28')](respondWithResult(_0x155e70,null))[_0x90b6('0x4b')](handleError(_0x155e70,null));};exports[_0x90b6('0x4c')]=function(_0x2c6f1a,_0x1ee9d9){return db[_0x90b6('0x32')]['create'](_0x2c6f1a[_0x90b6('0x4d')],{})[_0x90b6('0x28')](respondWithResult(_0x1ee9d9,0xc9))[_0x90b6('0x4b')](handleError(_0x1ee9d9,null));};exports[_0x90b6('0x4e')]=function(_0x36fc8d,_0x5da9bf){if(_0x36fc8d[_0x90b6('0x4d')]['id']){delete _0x36fc8d[_0x90b6('0x4d')]['id'];}return db[_0x90b6('0x32')][_0x90b6('0x4f')]({'where':{'id':_0x36fc8d['params']['id']}})[_0x90b6('0x28')](handleEntityNotFound(_0x5da9bf,null))['then'](saveUpdates(_0x36fc8d[_0x90b6('0x4d')],null))[_0x90b6('0x28')](respondWithResult(_0x5da9bf,null))[_0x90b6('0x4b')](handleError(_0x5da9bf,null));};exports[_0x90b6('0x29')]=function(_0x1dad8d,_0x1ad987){return db['VoiceQueueReport'][_0x90b6('0x4f')]({'where':{'id':_0x1dad8d[_0x90b6('0x49')]['id']}})[_0x90b6('0x28')](handleEntityNotFound(_0x1ad987,null))['then'](removeEntity(_0x1ad987,null))['catch'](handleError(_0x1ad987,null));};exports[_0x90b6('0x50')]=function(_0x3ab770,_0x4bc33c){return db[_0x90b6('0x32')][_0x90b6('0x50')]()[_0x90b6('0x28')](respondWithResult(_0x4bc33c,null))[_0x90b6('0x4b')](handleError(_0x4bc33c,null));};exports[_0x90b6('0x51')]=function(_0x45e194,_0x37a4bb){var _0x37bc51={},_0x214bb1={},_0x3d7daf={'count':0x0,'rows':[]};_0x214bb1['model']=_['keys'](db[_0x90b6('0x32')][_0x90b6('0x52')]);_0x214bb1['query']=_['keys'](_0x45e194[_0x90b6('0x36')]);_0x214bb1[_0x90b6('0x38')]=_[_0x90b6('0x39')](_0x214bb1[_0x90b6('0x35')],_0x214bb1[_0x90b6('0x36')]);_0x37bc51[_0x90b6('0x3a')]=_['intersection'](_0x214bb1[_0x90b6('0x35')],qs[_0x90b6('0x3b')](_0x45e194[_0x90b6('0x36')][_0x90b6('0x3b')]));_0x37bc51[_0x90b6('0x3a')]=_0x37bc51['attributes'][_0x90b6('0x3c')]?_0x37bc51[_0x90b6('0x3a')]:_0x214bb1['model'];if(!_0x45e194['query'][_0x90b6('0x3d')](_0x90b6('0x3e'))){_0x37bc51[_0x90b6('0x25')]=qs[_0x90b6('0x25')](_0x45e194[_0x90b6('0x36')][_0x90b6('0x25')]);_0x37bc51['offset']=qs[_0x90b6('0x23')](_0x45e194[_0x90b6('0x36')][_0x90b6('0x23')]);}_0x37bc51[_0x90b6('0x3f')]=qs[_0x90b6('0x40')](_0x45e194[_0x90b6('0x36')][_0x90b6('0x40')]);_0x37bc51[_0x90b6('0x43')]=qs['filters'](_[_0x90b6('0x41')](_0x45e194['query'],_0x214bb1[_0x90b6('0x38')]));if(_0x45e194[_0x90b6('0x36')]['filter']){_0x37bc51[_0x90b6('0x43')]=_[_0x90b6('0x45')](_0x37bc51[_0x90b6('0x43')],{'$or':_[_0x90b6('0x31')](_0x37bc51[_0x90b6('0x3a')],function(_0x118ad5){var _0x540672={};_0x540672[_0x118ad5]={'$like':'%'+_0x45e194[_0x90b6('0x36')][_0x90b6('0x42')]+'%'};return _0x540672;})});}_0x37bc51=_[_0x90b6('0x45')]({},_0x37bc51,_0x45e194[_0x90b6('0x46')]);var _0x1ffa2f={'where':_0x37bc51[_0x90b6('0x43')]};return db[_0x90b6('0x32')][_0x90b6('0x26')](_0x1ffa2f)['then'](function(_0x55c6eb){_0x3d7daf[_0x90b6('0x26')]=_0x55c6eb;if(_0x45e194[_0x90b6('0x36')][_0x90b6('0x4a')]){_0x37bc51[_0x90b6('0x47')]=[{'all':!![]}];}return db[_0x90b6('0x32')]['findAll'](_0x37bc51);})[_0x90b6('0x28')](function(_0x3d88af){_0x3d7daf['rows']=_0x3d88af;return _0x3d7daf;})[_0x90b6('0x28')](respondWithFilteredResult(_0x37a4bb,_0x37bc51,'getVoiceQueuesReport'))[_0x90b6('0x4b')](handleError(_0x37a4bb,null,_0x90b6('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e509487..03b08a6 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 _0xfab7=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x26d7da,_0x5338bf){var _0x4d8e7b=function(_0x226898){while(--_0x226898){_0x26d7da['push'](_0x26d7da['shift']());}};_0x4d8e7b(++_0x5338bf);}(_0xfab7,0xfa));var _0x7fab=function(_0x2d2b3f,_0x498c26){_0x2d2b3f=_0x2d2b3f-0x0;var _0x4fc433=_0xfab7[_0x2d2b3f];return _0x4fc433;};'use strict';var EventEmitter=require(_0x7fab('0x0'));var VoiceQueueReport=require(_0x7fab('0x1'))['db'][_0x7fab('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7fab('0x3')](0x0);var events={'afterCreate':_0x7fab('0x4'),'afterUpdate':_0x7fab('0x5'),'afterDestroy':_0x7fab('0x6')};function emitEvent(_0x4c9387){return function(_0x2ed313,_0x5c7f76,_0x362d42){VoiceQueueReportEvents[_0x7fab('0x7')](_0x4c9387+':'+_0x2ed313['id'],_0x2ed313);VoiceQueueReportEvents[_0x7fab('0x7')](_0x4c9387,_0x2ed313);_0x362d42(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x7fab('0x8')](e,emitEvent(event));}}module[_0x7fab('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9285=['hasOwnProperty','hook','exports','events','save','update','remove','emit'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9285,0x193));var _0x5928=function(_0x39622f,_0x33d268){_0x39622f=_0x39622f-0x0;var _0x3eb359=_0x9285[_0x39622f];return _0x3eb359;};'use strict';var EventEmitter=require(_0x5928('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5928('0x1'),'afterUpdate':_0x5928('0x2'),'afterDestroy':_0x5928('0x3')};function emitEvent(_0x103933){return function(_0x23d8a0,_0xef8c9b,_0x2da045){VoiceQueueReportEvents[_0x5928('0x4')](_0x103933+':'+_0x23d8a0['id'],_0x23d8a0);VoiceQueueReportEvents[_0x5928('0x4')](_0x103933,_0x23d8a0);_0x2da045(null);};}for(var e in events){if(events[_0x5928('0x5')](e)){var event=events[e];VoiceQueueReport[_0x5928('0x6')](e,emitEvent(event));}}module[_0x5928('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 92ac8f2..4a491e8 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 _0x1c74=['request-promise','path','rimraf','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','../../config/logger','api','moment','bluebird'];(function(_0x12954a,_0x304691){var _0x5ccde2=function(_0x5c3d68){while(--_0x5c3d68){_0x12954a['push'](_0x12954a['shift']());}};_0x5ccde2(++_0x304691);}(_0x1c74,0xb2));var _0x41c7=function(_0x224721,_0x45b988){_0x224721=_0x224721-0x0;var _0x145358=_0x1c74[_0x224721];return _0x145358;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x41c7('0x0'))(_0x41c7('0x1'));var moment=require(_0x41c7('0x2'));var BPromise=require(_0x41c7('0x3'));var rp=require(_0x41c7('0x4'));var fs=require('fs');var path=require(_0x41c7('0x5'));var rimraf=require(_0x41c7('0x6'));var config=require('../../config/environment');var attributes=require(_0x41c7('0x7'));module['exports']=function(_0x49f3fe,_0x245187){return _0x49f3fe[_0x41c7('0x8')](_0x41c7('0x9'),attributes,{'tableName':_0x41c7('0xa'),'paranoid':![],'indexes':[{'fields':[_0x41c7('0xb')]},{'fields':[_0x41c7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf32c=['moment','bluebird','path','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash','util','api'];(function(_0x31c70c,_0x585474){var _0x1a87e7=function(_0x2e53d4){while(--_0x2e53d4){_0x31c70c['push'](_0x31c70c['shift']());}};_0x1a87e7(++_0x585474);}(_0xf32c,0x14d));var _0xcf32=function(_0x13138c,_0x3bb68a){_0x13138c=_0x13138c-0x0;var _0x852112=_0xf32c[_0x13138c];return _0x852112;};'use strict';var _=require(_0xcf32('0x0'));var util=require(_0xcf32('0x1'));var logger=require('../../config/logger')(_0xcf32('0x2'));var moment=require(_0xcf32('0x3'));var BPromise=require(_0xcf32('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf32('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf32('0x6'));module[_0xcf32('0x7')]=function(_0x5adda7,_0x4314bc){return _0x5adda7[_0xcf32('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xcf32('0x9'),'paranoid':![],'indexes':[{'fields':[_0xcf32('0xa')]},{'fields':[_0xcf32('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 5693047..3eb6c83 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 _0x89a7=['UpdateVoiceQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','catch','CreateVoiceQueueReport','create'];(function(_0x238933,_0x480ab4){var _0x544360=function(_0x5c2ebf){while(--_0x5c2ebf){_0x238933['push'](_0x238933['shift']());}};_0x544360(++_0x480ab4);}(_0x89a7,0x1cf));var _0x789a=function(_0x4d92d1,_0x4ea61c){_0x4d92d1=_0x4d92d1-0x0;var _0x3d9830=_0x89a7[_0x4d92d1];return _0x3d9830;};'use strict';var _=require(_0x789a('0x0'));var util=require('util');var moment=require(_0x789a('0x1'));var BPromise=require('bluebird');var rs=require(_0x789a('0x2'));var fs=require('fs');var Redis=require(_0x789a('0x3'));var db=require(_0x789a('0x4'))['db'];var utils=require(_0x789a('0x5'));var logger=require(_0x789a('0x6'))(_0x789a('0x7'));var config=require(_0x789a('0x8'));var jayson=require(_0x789a('0x9'));var client=jayson[_0x789a('0xa')]['http']({'port':0x232a});config[_0x789a('0xb')]=_[_0x789a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x789a('0xd'))(new Redis(config[_0x789a('0xb')]));require(_0x789a('0xe'))['register'](socket);function respondWithRpcPromise(_0x44fb68,_0x5bc503,_0x48f755){return new BPromise(function(_0x1f292b,_0x13b7f2){return client[_0x789a('0xf')](_0x44fb68,_0x48f755)[_0x789a('0x10')](function(_0x310962){logger[_0x789a('0x11')](_0x789a('0x12'),_0x5bc503,_0x789a('0x13'));logger[_0x789a('0x14')](_0x789a('0x15'),_0x5bc503,'request\x20sent',JSON[_0x789a('0x16')](_0x310962));if(_0x310962[_0x789a('0x17')]){if(_0x310962[_0x789a('0x17')][_0x789a('0x18')]===0x1f4){logger['error'](_0x789a('0x12'),_0x5bc503,_0x310962[_0x789a('0x17')]['message']);return _0x13b7f2(_0x310962['error'][_0x789a('0x19')]);}logger[_0x789a('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x5bc503,_0x310962[_0x789a('0x17')][_0x789a('0x19')]);return _0x1f292b(_0x310962[_0x789a('0x17')][_0x789a('0x19')]);}else{logger[_0x789a('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x5bc503,_0x789a('0x13'));_0x1f292b(_0x310962[_0x789a('0x1a')][_0x789a('0x19')]);}})['catch'](function(_0x4745bf){logger[_0x789a('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x5bc503,_0x4745bf);_0x13b7f2(_0x4745bf);});});}exports[_0x789a('0x1b')]=function(_0x2b9482){var _0x686f33=this;return new Promise(function(_0x552a71,_0x37121c){return db[_0x789a('0x1c')][_0x789a('0x1d')]({'raw':_0x2b9482['options']?_0x2b9482[_0x789a('0x1e')][_0x789a('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b9482[_0x789a('0x1e')]?_0x2b9482[_0x789a('0x1e')][_0x789a('0x20')]||null:null,'attributes':_0x2b9482[_0x789a('0x1e')]?_0x2b9482[_0x789a('0x1e')][_0x789a('0x21')]||null:null,'limit':_0x2b9482[_0x789a('0x1e')]?_0x2b9482[_0x789a('0x1e')][_0x789a('0x22')]||null:null,'include':_0x2b9482[_0x789a('0x1e')]?_0x2b9482['options']['include']?_['map'](_0x2b9482[_0x789a('0x1e')][_0x789a('0x23')],function(_0x5f5660){return{'model':db[_0x5f5660[_0x789a('0x24')]],'as':_0x5f5660['as'],'attributes':_0x5f5660[_0x789a('0x21')],'include':_0x5f5660[_0x789a('0x23')]?_[_0x789a('0x25')](_0x5f5660[_0x789a('0x23')],function(_0x329053){return{'model':db[_0x329053['model']],'as':_0x329053['as'],'attributes':_0x329053['attributes'],'include':_0x329053[_0x789a('0x23')]?_[_0x789a('0x25')](_0x329053[_0x789a('0x23')],function(_0x3360d3){return{'model':db[_0x3360d3[_0x789a('0x24')]],'as':_0x3360d3['as'],'attributes':_0x3360d3[_0x789a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x789a('0x10')](function(_0x1084ae){logger[_0x789a('0x11')]('GetVoiceQueueReport',_0x2b9482);logger['debug']('GetVoiceQueueReport',_0x2b9482,JSON['stringify'](_0x1084ae));_0x552a71(_0x1084ae);})[_0x789a('0x26')](function(_0x1850e2){logger[_0x789a('0x17')](_0x789a('0x1b'),_0x1850e2['message'],_0x2b9482);_0x37121c(_0x686f33[_0x789a('0x17')](0x1f4,_0x1850e2['message']));});});};exports[_0x789a('0x27')]=function(_0x2925e5){var _0x52a2a7=this;return new Promise(function(_0x3e5375,_0x16b020){return db[_0x789a('0x1c')][_0x789a('0x28')](_0x2925e5['body'],{'raw':_0x2925e5[_0x789a('0x1e')]?_0x2925e5['options']['raw']===undefined?!![]:![]:!![]})[_0x789a('0x10')](function(_0x36f4a4){logger['info']('CreateVoiceQueueReport',_0x2925e5);logger[_0x789a('0x14')](_0x789a('0x27'),_0x2925e5,JSON[_0x789a('0x16')](_0x36f4a4));_0x3e5375(_0x36f4a4);})[_0x789a('0x26')](function(_0x1ed595){logger[_0x789a('0x17')]('CreateVoiceQueueReport',_0x1ed595[_0x789a('0x19')],_0x2925e5);_0x16b020(_0x52a2a7[_0x789a('0x17')](0x1f4,_0x1ed595[_0x789a('0x19')]));});});};exports[_0x789a('0x29')]=function(_0x3df7a0){var _0x29d506=this;return new Promise(function(_0x801517,_0x289e42){return db['VoiceQueueReport']['update'](_0x3df7a0['body'],{'raw':_0x3df7a0[_0x789a('0x1e')]?_0x3df7a0[_0x789a('0x1e')][_0x789a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3df7a0['options']?_0x3df7a0['options']['where']||null:null,'attributes':_0x3df7a0[_0x789a('0x1e')]?_0x3df7a0['options']['attributes']||null:null,'limit':_0x3df7a0[_0x789a('0x1e')]?_0x3df7a0[_0x789a('0x1e')][_0x789a('0x22')]||null:null})['then'](function(_0x43b9db){logger[_0x789a('0x11')](_0x789a('0x29'),_0x3df7a0);logger[_0x789a('0x14')](_0x789a('0x29'),_0x3df7a0,JSON['stringify'](_0x43b9db));_0x801517(_0x43b9db);})['catch'](function(_0x338337){logger[_0x789a('0x17')](_0x789a('0x29'),_0x338337[_0x789a('0x19')],_0x3df7a0);_0x289e42(_0x29d506[_0x789a('0x17')](0x1f4,_0x338337[_0x789a('0x19')]));});});}; \ No newline at end of file +var _0x7dec=['redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x7dec,0x124));var _0xc7de=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0x7dec[_0x146484];return _0x4c7aa3;};'use strict';var _=require(_0xc7de('0x0'));var util=require('util');var moment=require(_0xc7de('0x1'));var BPromise=require(_0xc7de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7de('0x3'));var db=require(_0xc7de('0x4'))['db'];var utils=require(_0xc7de('0x5'));var logger=require('../../config/logger')(_0xc7de('0x6'));var config=require('../../config/environment');var jayson=require(_0xc7de('0x7'));var client=jayson[_0xc7de('0x8')]['http']({'port':0x232a});config[_0xc7de('0x9')]=_[_0xc7de('0xa')](config['redis'],{'host':_0xc7de('0xb'),'port':0x18eb});var socket=require(_0xc7de('0xc'))(new Redis(config[_0xc7de('0x9')]));require(_0xc7de('0xd'))[_0xc7de('0xe')](socket);function respondWithRpcPromise(_0x2913a9,_0x5b14f2,_0x29b910){return new BPromise(function(_0x10745b,_0x1877ac){return client[_0xc7de('0xf')](_0x2913a9,_0x29b910)[_0xc7de('0x10')](function(_0x1a7351){logger[_0xc7de('0x11')](_0xc7de('0x12'),_0x5b14f2,'request\x20sent');logger[_0xc7de('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5b14f2,_0xc7de('0x14'),JSON[_0xc7de('0x15')](_0x1a7351));if(_0x1a7351[_0xc7de('0x16')]){if(_0x1a7351[_0xc7de('0x16')][_0xc7de('0x17')]===0x1f4){logger['error'](_0xc7de('0x12'),_0x5b14f2,_0x1a7351['error']['message']);return _0x1877ac(_0x1a7351[_0xc7de('0x16')][_0xc7de('0x18')]);}logger[_0xc7de('0x16')](_0xc7de('0x12'),_0x5b14f2,_0x1a7351[_0xc7de('0x16')][_0xc7de('0x18')]);return _0x10745b(_0x1a7351[_0xc7de('0x16')][_0xc7de('0x18')]);}else{logger[_0xc7de('0x11')](_0xc7de('0x12'),_0x5b14f2,_0xc7de('0x14'));_0x10745b(_0x1a7351[_0xc7de('0x19')][_0xc7de('0x18')]);}})[_0xc7de('0x1a')](function(_0x2cfe27){logger[_0xc7de('0x16')](_0xc7de('0x12'),_0x5b14f2,_0x2cfe27);_0x1877ac(_0x2cfe27);});});}exports[_0xc7de('0x1b')]=function(_0x1924f5){var _0x6a7404=this;return new Promise(function(_0x54d7ec,_0x148be9){return db[_0xc7de('0x1c')][_0xc7de('0x1d')]({'raw':_0x1924f5[_0xc7de('0x1e')]?_0x1924f5[_0xc7de('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1924f5[_0xc7de('0x1e')]?_0x1924f5[_0xc7de('0x1e')][_0xc7de('0x1f')]||null:null,'attributes':_0x1924f5['options']?_0x1924f5[_0xc7de('0x1e')][_0xc7de('0x20')]||null:null,'limit':_0x1924f5[_0xc7de('0x1e')]?_0x1924f5['options'][_0xc7de('0x21')]||null:null,'include':_0x1924f5[_0xc7de('0x1e')]?_0x1924f5[_0xc7de('0x1e')][_0xc7de('0x22')]?_[_0xc7de('0x23')](_0x1924f5[_0xc7de('0x1e')]['include'],function(_0x15e11f){return{'model':db[_0x15e11f['model']],'as':_0x15e11f['as'],'attributes':_0x15e11f[_0xc7de('0x20')],'include':_0x15e11f[_0xc7de('0x22')]?_['map'](_0x15e11f[_0xc7de('0x22')],function(_0x3c3297){return{'model':db[_0x3c3297['model']],'as':_0x3c3297['as'],'attributes':_0x3c3297[_0xc7de('0x20')],'include':_0x3c3297[_0xc7de('0x22')]?_['map'](_0x3c3297[_0xc7de('0x22')],function(_0x5c31d3){return{'model':db[_0x5c31d3[_0xc7de('0x24')]],'as':_0x5c31d3['as'],'attributes':_0x5c31d3['attributes']};}):[]};}):[]};}):[]:[]})[_0xc7de('0x10')](function(_0x2b56fc){logger['info'](_0xc7de('0x1b'),_0x1924f5);logger[_0xc7de('0x13')]('GetVoiceQueueReport',_0x1924f5,JSON[_0xc7de('0x15')](_0x2b56fc));_0x54d7ec(_0x2b56fc);})['catch'](function(_0x1a6a55){logger[_0xc7de('0x16')](_0xc7de('0x1b'),_0x1a6a55['message'],_0x1924f5);_0x148be9(_0x6a7404['error'](0x1f4,_0x1a6a55[_0xc7de('0x18')]));});});};exports[_0xc7de('0x25')]=function(_0x2dfa59){var _0x79f38d=this;return new Promise(function(_0x29df42,_0xb07b9b){return db[_0xc7de('0x1c')][_0xc7de('0x26')](_0x2dfa59[_0xc7de('0x27')],{'raw':_0x2dfa59[_0xc7de('0x1e')]?_0x2dfa59[_0xc7de('0x1e')][_0xc7de('0x28')]===undefined?!![]:![]:!![]})['then'](function(_0x48c97d){logger['info'](_0xc7de('0x25'),_0x2dfa59);logger[_0xc7de('0x13')]('CreateVoiceQueueReport',_0x2dfa59,JSON[_0xc7de('0x15')](_0x48c97d));_0x29df42(_0x48c97d);})[_0xc7de('0x1a')](function(_0x3fc196){logger[_0xc7de('0x16')](_0xc7de('0x25'),_0x3fc196[_0xc7de('0x18')],_0x2dfa59);_0xb07b9b(_0x79f38d[_0xc7de('0x16')](0x1f4,_0x3fc196[_0xc7de('0x18')]));});});};exports[_0xc7de('0x29')]=function(_0x4028ff){var _0x1715d3=this;return new Promise(function(_0x16bbe8,_0x464350){return db['VoiceQueueReport'][_0xc7de('0x2a')](_0x4028ff[_0xc7de('0x27')],{'raw':_0x4028ff[_0xc7de('0x1e')]?_0x4028ff[_0xc7de('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4028ff['options']?_0x4028ff[_0xc7de('0x1e')]['where']||null:null,'attributes':_0x4028ff[_0xc7de('0x1e')]?_0x4028ff[_0xc7de('0x1e')][_0xc7de('0x20')]||null:null,'limit':_0x4028ff[_0xc7de('0x1e')]?_0x4028ff['options']['limit']||null:null})[_0xc7de('0x10')](function(_0x284c28){logger[_0xc7de('0x11')](_0xc7de('0x29'),_0x4028ff);logger[_0xc7de('0x13')](_0xc7de('0x29'),_0x4028ff,JSON['stringify'](_0x284c28));_0x16bbe8(_0x284c28);})[_0xc7de('0x1a')](function(_0x52bcb7){logger['error'](_0xc7de('0x29'),_0x52bcb7['message'],_0x4028ff);_0x464350(_0x1715d3[_0xc7de('0x16')](0x1f4,_0x52bcb7['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 13a7481..56b2fa0 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 _0x3c7b=['remove','update','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x1fcfe3,_0xe00c7b){_0x1fcfe3=_0x1fcfe3-0x0;var _0x2f0a1b=_0x3c7b[_0x1fcfe3];return _0x2f0a1b;};'use strict';var VoiceQueueReportEvents=require(_0xb3c7('0x0'));var events=[_0xb3c7('0x1'),_0xb3c7('0x2'),_0xb3c7('0x3')];function createListener(_0x22a73c,_0x4e4405){return function(_0x4a83a4){_0x4e4405['emit'](_0x22a73c,_0x4a83a4);};}function removeListener(_0x5b34ef,_0x234fe5){return function(){VoiceQueueReportEvents[_0xb3c7('0x4')](_0x5b34ef,_0x234fe5);};}exports['register']=function(_0x396a46){for(var _0x5b810b=0x0,_0x255f3d=events[_0xb3c7('0x5')];_0x5b810b<_0x255f3d;_0x5b810b++){var _0x341a27=events[_0x5b810b];var _0x1851a5=createListener(_0xb3c7('0x6')+_0x341a27,_0x396a46);VoiceQueueReportEvents['on'](_0x341a27,_0x1851a5);}}; \ No newline at end of file +var _0xd694=['length','./voiceQueueReport.events','remove','update','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd694,0x11b));var _0x4d69=function(_0x300a26,_0x1ad864){_0x300a26=_0x300a26-0x0;var _0x43bccd=_0xd694[_0x300a26];return _0x43bccd;};'use strict';var VoiceQueueReportEvents=require(_0x4d69('0x0'));var events=['save',_0x4d69('0x1'),_0x4d69('0x2')];function createListener(_0x164800,_0x25a783){return function(_0x49042c){_0x25a783[_0x4d69('0x3')](_0x164800,_0x49042c);};}function removeListener(_0x49b1d8,_0x763dab){return function(){VoiceQueueReportEvents[_0x4d69('0x4')](_0x49b1d8,_0x763dab);};}exports['register']=function(_0x2b85a8){for(var _0x3e4906=0x0,_0x28bc00=events[_0x4d69('0x5')];_0x3e4906<_0x28bc00;_0x3e4906++){var _0x482ff3=events[_0x3e4906];var _0x16c8dd=createListener('voiceQueueReport:'+_0x482ff3,_0x2b85a8);VoiceQueueReportEvents['on'](_0x482ff3,_0x16c8dd);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 0d4b554..d5a1bed 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 _0x30c0=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated'];(function(_0x53aed9,_0x4ab995){var _0x7dba57=function(_0x5c925d){while(--_0x5c925d){_0x53aed9['push'](_0x53aed9['shift']());}};_0x7dba57(++_0x4ab995);}(_0x30c0,0x10a));var _0x030c=function(_0x431d67,_0x235666){_0x431d67=_0x431d67-0x0;var _0x177963=_0x30c0[_0x431d67];return _0x177963;};'use strict';var multer=require(_0x030c('0x0'));var util=require(_0x030c('0x1'));var path=require(_0x030c('0x2'));var timeout=require(_0x030c('0x3'));var express=require('express');var router=express[_0x030c('0x4')]();var fs_extra=require(_0x030c('0x5'));var auth=require(_0x030c('0x6'));var interaction=require(_0x030c('0x7'));var config=require(_0x030c('0x8'));var controller=require(_0x030c('0x9'));router[_0x030c('0xa')]('/',auth['isAuthenticated'](),controller[_0x030c('0xb')]);router[_0x030c('0xa')](_0x030c('0xc'),auth[_0x030c('0xd')](),controller['show']);router[_0x030c('0xe')]('/',auth[_0x030c('0xd')](),controller['create']);router[_0x030c('0xf')](_0x030c('0xc'),auth[_0x030c('0xd')](),controller[_0x030c('0x10')]);router[_0x030c('0x11')](_0x030c('0xc'),auth['isAuthenticated'](),controller[_0x030c('0x12')]);module[_0x030c('0x13')]=router; \ No newline at end of file +var _0xfd27=['connect-timeout','Router','fs-extra','get','/:id','post','isAuthenticated','put','delete','destroy','exports','multer','path'];(function(_0x28d664,_0x8e4d85){var _0x1ce626=function(_0x3911dd){while(--_0x3911dd){_0x28d664['push'](_0x28d664['shift']());}};_0x1ce626(++_0x8e4d85);}(_0xfd27,0xb4));var _0x7fd2=function(_0x14dfe6,_0x370f63){_0x14dfe6=_0x14dfe6-0x0;var _0x187e46=_0xfd27[_0x14dfe6];return _0x187e46;};'use strict';var multer=require(_0x7fd2('0x0'));var util=require('util');var path=require(_0x7fd2('0x1'));var timeout=require(_0x7fd2('0x2'));var express=require('express');var router=express[_0x7fd2('0x3')]();var fs_extra=require(_0x7fd2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x7fd2('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7fd2('0x6'),auth['isAuthenticated'](),controller['show']);router[_0x7fd2('0x7')]('/',auth[_0x7fd2('0x8')](),controller['create']);router[_0x7fd2('0x9')](_0x7fd2('0x6'),auth[_0x7fd2('0x8')](),controller['update']);router[_0x7fd2('0xa')](_0x7fd2('0x6'),auth[_0x7fd2('0x8')](),controller[_0x7fd2('0xb')]);module[_0x7fd2('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index b4ee61e..20a5b31 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 _0xc6b8=['sequelize','moment','exports','STRING','DATE','literal'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xc6b8,0x1e6));var _0x8c6b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc6b8[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8c6b('0x0'));var moment=require(_0x8c6b('0x1'));module[_0x8c6b('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x8c6b('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x8c6b('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x8c6b('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x8c6b('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x8c6b('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x8c6b('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x8c6b('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x8c6b('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x8c6b('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x22e3=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment'];(function(_0x2c5a11,_0x1f2a36){var _0x2742dc=function(_0x38b9a5){while(--_0x38b9a5){_0x2c5a11['push'](_0x2c5a11['shift']());}};_0x2742dc(++_0x1f2a36);}(_0x22e3,0x132));var _0x322e=function(_0x5072b8,_0x2c3792){_0x5072b8=_0x5072b8-0x0;var _0x473681=_0x22e3[_0x5072b8];return _0x473681;};'use strict';var Sequelize=require(_0x322e('0x0'));var moment=require(_0x322e('0x1'));module[_0x322e('0x2')]={'time':{'type':Sequelize[_0x322e('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x322e('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x322e('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x322e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x322e('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x322e('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x322e('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x322e('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x322e('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x322e('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x322e('0x5')](_0x322e('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 8d1ffae..3946b94 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 _0x8849=['rows','catch','show','params','VoiceQueuesLog','length','options','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include'];(function(_0x265720,_0x3a25ea){var _0x5b731c=function(_0x10d29e){while(--_0x10d29e){_0x265720['push'](_0x265720['shift']());}};_0x5b731c(++_0x3a25ea);}(_0x8849,0xe8));var _0x9884=function(_0x312320,_0x5160a6){_0x312320=_0x312320-0x0;var _0x245348=_0x8849[_0x312320];return _0x245348;};'use strict';var emlformat=require(_0x9884('0x0'));var rimraf=require(_0x9884('0x1'));var zipdir=require(_0x9884('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9884('0x3'));var BPromise=require(_0x9884('0x4'));var Mustache=require(_0x9884('0x5'));var util=require(_0x9884('0x6'));var path=require(_0x9884('0x7'));var sox=require('sox');var csv=require(_0x9884('0x8'));var ejs=require(_0x9884('0x9'));var fs=require('fs');var fs_extra=require(_0x9884('0xa'));var _=require(_0x9884('0xb'));var squel=require(_0x9884('0xc'));var crypto=require(_0x9884('0xd'));var jsforce=require(_0x9884('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9884('0xf'));var Papa=require(_0x9884('0x10'));var Redis=require('ioredis');var authService=require(_0x9884('0x11'));var qs=require(_0x9884('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9884('0x13'));var logger=require('../../config/logger')(_0x9884('0x14'));var utils=require(_0x9884('0x15'));var config=require(_0x9884('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9884('0x17'))['db'];function respondWithStatusCode(_0x51c45a,_0x2874d9){_0x2874d9=_0x2874d9||0xcc;return function(_0x35bb09){if(_0x35bb09){return _0x51c45a[_0x9884('0x18')](_0x2874d9);}return _0x51c45a[_0x9884('0x19')](_0x2874d9)[_0x9884('0x1a')]();};}function respondWithResult(_0x48b127,_0xc1ccb8){_0xc1ccb8=_0xc1ccb8||0xc8;return function(_0x10d04a){if(_0x10d04a){return _0x48b127[_0x9884('0x19')](_0xc1ccb8)[_0x9884('0x1b')](_0x10d04a);}};}function respondWithFilteredResult(_0x4f6101,_0x212651){return function(_0x4dd129){if(_0x4dd129){var _0xbc89d1=typeof _0x212651['offset']===_0x9884('0x1c')&&typeof _0x212651[_0x9884('0x1d')]===_0x9884('0x1c');var _0x366f43=_0x4dd129[_0x9884('0x1e')];var _0x3ade85=_0xbc89d1?0x0:_0x212651[_0x9884('0x1f')];var _0x27aeb6=_0xbc89d1?_0x4dd129[_0x9884('0x1e')]:_0x212651[_0x9884('0x1f')]+_0x212651[_0x9884('0x1d')];var _0xeb681a;if(_0x27aeb6>=_0x366f43){_0x27aeb6=_0x366f43;_0xeb681a=0xc8;}else{_0xeb681a=0xce;}_0x4f6101[_0x9884('0x19')](_0xeb681a);return _0x4f6101[_0x9884('0x20')](_0x9884('0x21'),_0x3ade85+'-'+_0x27aeb6+'/'+_0x366f43)['json'](_0x4dd129);}return null;};}function patchUpdates(_0x461c14){return function(_0x5237d4){try{jsonpatch['apply'](_0x5237d4,_0x461c14,!![]);}catch(_0x51cdab){return BPromise['reject'](_0x51cdab);}return _0x5237d4[_0x9884('0x22')]();};}function saveUpdates(_0x2e6a68,_0x555634){return function(_0xa9f6bd){if(_0xa9f6bd){return _0xa9f6bd[_0x9884('0x23')](_0x2e6a68)[_0x9884('0x24')](function(_0x253d16){return _0x253d16;});}return null;};}function removeEntity(_0x5691c1,_0x542c30){return function(_0x1e6ed4){if(_0x1e6ed4){return _0x1e6ed4[_0x9884('0x25')]()[_0x9884('0x24')](function(){_0x5691c1['status'](0xcc)[_0x9884('0x1a')]();});}};}function handleEntityNotFound(_0x3cbb5e,_0x415996){return function(_0x48b6f9){if(!_0x48b6f9){_0x3cbb5e['sendStatus'](0x194);}return _0x48b6f9;};}function handleError(_0x39dc17,_0xb9a14){_0xb9a14=_0xb9a14||0x1f4;return function(_0x33c459){logger[_0x9884('0x26')](_0x33c459[_0x9884('0x27')]);if(_0x33c459[_0x9884('0x28')]){delete _0x33c459[_0x9884('0x28')];}_0x39dc17[_0x9884('0x19')](_0xb9a14)['send'](_0x33c459);};}exports[_0x9884('0x29')]=function(_0x574b48,_0x578cbe){var _0x1a6029={},_0x28e082={},_0x464d21={'count':0x0,'rows':[]};var _0x1266d8=_[_0x9884('0x2a')](db['VoiceQueuesLog'][_0x9884('0x2b')],function(_0x1c7784){return{'name':_0x1c7784[_0x9884('0x2c')],'type':_0x1c7784[_0x9884('0x2d')][_0x9884('0x2e')]};});_0x28e082[_0x9884('0x2f')]=_[_0x9884('0x2a')](_0x1266d8,'name');_0x28e082[_0x9884('0x30')]=_[_0x9884('0x31')](_0x574b48[_0x9884('0x30')]);_0x28e082[_0x9884('0x32')]=_[_0x9884('0x33')](_0x28e082[_0x9884('0x2f')],_0x28e082['query']);_0x1a6029[_0x9884('0x34')]=_[_0x9884('0x33')](_0x28e082[_0x9884('0x2f')],qs[_0x9884('0x35')](_0x574b48[_0x9884('0x30')][_0x9884('0x35')]));_0x1a6029[_0x9884('0x34')]=_0x1a6029['attributes']['length']?_0x1a6029[_0x9884('0x34')]:_0x28e082[_0x9884('0x2f')];if(!_0x574b48[_0x9884('0x30')][_0x9884('0x36')](_0x9884('0x37'))){_0x1a6029[_0x9884('0x1d')]=qs[_0x9884('0x1d')](_0x574b48['query'][_0x9884('0x1d')]);_0x1a6029['offset']=qs[_0x9884('0x1f')](_0x574b48[_0x9884('0x30')]['offset']);}_0x1a6029[_0x9884('0x38')]=qs[_0x9884('0x39')](_0x574b48[_0x9884('0x30')][_0x9884('0x39')]);_0x1a6029[_0x9884('0x3a')]=qs[_0x9884('0x32')](_[_0x9884('0x3b')](_0x574b48[_0x9884('0x30')],_0x28e082[_0x9884('0x32')]),_0x1266d8);if(_0x574b48[_0x9884('0x30')][_0x9884('0x3c')]){_0x1a6029[_0x9884('0x3a')]=_[_0x9884('0x3d')](_0x1a6029[_0x9884('0x3a')],{'$or':_[_0x9884('0x2a')](_0x1266d8,function(_0x45a447){if(_0x45a447[_0x9884('0x2d')]!=='VIRTUAL'){var _0x10bfc9={};_0x10bfc9[_0x45a447['name']]={'$like':'%'+_0x574b48[_0x9884('0x30')][_0x9884('0x3c')]+'%'};return _0x10bfc9;}})});}_0x1a6029=_[_0x9884('0x3d')]({},_0x1a6029,_0x574b48['options']);var _0x159212={'where':_0x1a6029['where']};return db['VoiceQueuesLog'][_0x9884('0x1e')](_0x159212)[_0x9884('0x24')](function(_0x57c659){_0x464d21['count']=_0x57c659;if(_0x574b48[_0x9884('0x30')][_0x9884('0x3e')]){_0x1a6029[_0x9884('0x3f')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x1a6029);})['then'](function(_0x2e089d){_0x464d21[_0x9884('0x40')]=_0x2e089d;return _0x464d21;})[_0x9884('0x24')](respondWithFilteredResult(_0x578cbe,_0x1a6029))[_0x9884('0x41')](handleError(_0x578cbe,null));};exports[_0x9884('0x42')]=function(_0xa5a235,_0x34e787){var _0x37ffeb={'raw':!![],'where':{'id':_0xa5a235[_0x9884('0x43')]['id']}},_0x55ea89={};_0x55ea89[_0x9884('0x2f')]=_[_0x9884('0x31')](db[_0x9884('0x44')][_0x9884('0x2b')]);_0x55ea89[_0x9884('0x30')]=_[_0x9884('0x31')](_0xa5a235[_0x9884('0x30')]);_0x55ea89[_0x9884('0x32')]=_[_0x9884('0x33')](_0x55ea89[_0x9884('0x2f')],_0x55ea89[_0x9884('0x30')]);_0x37ffeb['attributes']=_[_0x9884('0x33')](_0x55ea89[_0x9884('0x2f')],qs['fields'](_0xa5a235[_0x9884('0x30')][_0x9884('0x35')]));_0x37ffeb[_0x9884('0x34')]=_0x37ffeb[_0x9884('0x34')][_0x9884('0x45')]?_0x37ffeb[_0x9884('0x34')]:_0x55ea89[_0x9884('0x2f')];if(_0xa5a235[_0x9884('0x30')][_0x9884('0x3e')]){_0x37ffeb[_0x9884('0x3f')]=[{'all':!![]}];}_0x37ffeb=_[_0x9884('0x3d')]({},_0x37ffeb,_0xa5a235[_0x9884('0x46')]);return db[_0x9884('0x44')][_0x9884('0x47')](_0x37ffeb)[_0x9884('0x24')](handleEntityNotFound(_0x34e787,null))[_0x9884('0x24')](respondWithResult(_0x34e787,null))[_0x9884('0x41')](handleError(_0x34e787,null));};exports[_0x9884('0x48')]=function(_0xb4eb61,_0x2d9ee8){return db[_0x9884('0x44')][_0x9884('0x48')](_0xb4eb61[_0x9884('0x49')],{})[_0x9884('0x24')](respondWithResult(_0x2d9ee8,0xc9))[_0x9884('0x41')](handleError(_0x2d9ee8,null));};exports[_0x9884('0x23')]=function(_0x237b9a,_0x3f76db){if(_0x237b9a[_0x9884('0x49')]['id']){delete _0x237b9a[_0x9884('0x49')]['id'];}return db[_0x9884('0x44')][_0x9884('0x47')]({'where':{'id':_0x237b9a[_0x9884('0x43')]['id']}})[_0x9884('0x24')](handleEntityNotFound(_0x3f76db,null))[_0x9884('0x24')](saveUpdates(_0x237b9a['body'],null))[_0x9884('0x24')](respondWithResult(_0x3f76db,null))[_0x9884('0x41')](handleError(_0x3f76db,null));};exports['destroy']=function(_0x327993,_0x5d594a){return db[_0x9884('0x44')]['find']({'where':{'id':_0x327993['params']['id']}})['then'](handleEntityNotFound(_0x5d594a,null))[_0x9884('0x24')](removeEntity(_0x5d594a,null))['catch'](handleError(_0x5d594a,null));}; \ No newline at end of file +var _0xd765=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','json','apply','reject','save','update','then','destroy','error','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x513452,_0x18b76c){var _0x366e0c=function(_0x1ada96){while(--_0x1ada96){_0x513452['push'](_0x513452['shift']());}};_0x366e0c(++_0x18b76c);}(_0xd765,0x87));var _0x5d76=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd765[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d76('0x0'));var zipdir=require(_0x5d76('0x1'));var jsonpatch=require(_0x5d76('0x2'));var rp=require(_0x5d76('0x3'));var moment=require(_0x5d76('0x4'));var BPromise=require(_0x5d76('0x5'));var Mustache=require(_0x5d76('0x6'));var util=require(_0x5d76('0x7'));var path=require(_0x5d76('0x8'));var sox=require(_0x5d76('0x9'));var csv=require(_0x5d76('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d76('0xb'));var _=require(_0x5d76('0xc'));var squel=require(_0x5d76('0xd'));var crypto=require(_0x5d76('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5d76('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5d76('0x10'));var Papa=require(_0x5d76('0x11'));var Redis=require(_0x5d76('0x12'));var authService=require(_0x5d76('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d76('0x14'));var hardwareService=require(_0x5d76('0x15'));var logger=require(_0x5d76('0x16'))(_0x5d76('0x17'));var utils=require(_0x5d76('0x18'));var config=require(_0x5d76('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d76('0x1a'))['db'];function respondWithStatusCode(_0x53db03,_0x5f352d){_0x5f352d=_0x5f352d||0xcc;return function(_0x4e759f){if(_0x4e759f){return _0x53db03[_0x5d76('0x1b')](_0x5f352d);}return _0x53db03[_0x5d76('0x1c')](_0x5f352d)[_0x5d76('0x1d')]();};}function respondWithResult(_0x4f948e,_0x138916){_0x138916=_0x138916||0xc8;return function(_0x1e4396){if(_0x1e4396){return _0x4f948e[_0x5d76('0x1c')](_0x138916)['json'](_0x1e4396);}};}function respondWithFilteredResult(_0x4f4811,_0x321d39){return function(_0xeec92f){if(_0xeec92f){var _0x3c9bd4=typeof _0x321d39[_0x5d76('0x1e')]==='undefined'&&typeof _0x321d39[_0x5d76('0x1f')]===_0x5d76('0x20');var _0x3bab78=_0xeec92f[_0x5d76('0x21')];var _0x3af26c=_0x3c9bd4?0x0:_0x321d39[_0x5d76('0x1e')];var _0x2a619d=_0x3c9bd4?_0xeec92f[_0x5d76('0x21')]:_0x321d39[_0x5d76('0x1e')]+_0x321d39[_0x5d76('0x1f')];var _0x42b548;if(_0x2a619d>=_0x3bab78){_0x2a619d=_0x3bab78;_0x42b548=0xc8;}else{_0x42b548=0xce;}_0x4f4811[_0x5d76('0x1c')](_0x42b548);return _0x4f4811['set']('Content-Range',_0x3af26c+'-'+_0x2a619d+'/'+_0x3bab78)[_0x5d76('0x22')](_0xeec92f);}return null;};}function patchUpdates(_0x2e5260){return function(_0x57c2b0){try{jsonpatch[_0x5d76('0x23')](_0x57c2b0,_0x2e5260,!![]);}catch(_0x373c0b){return BPromise[_0x5d76('0x24')](_0x373c0b);}return _0x57c2b0[_0x5d76('0x25')]();};}function saveUpdates(_0x175d8f,_0x58546e){return function(_0x4111c4){if(_0x4111c4){return _0x4111c4[_0x5d76('0x26')](_0x175d8f)[_0x5d76('0x27')](function(_0x5a823e){return _0x5a823e;});}return null;};}function removeEntity(_0x31a2ef,_0x284ac2){return function(_0x5673b1){if(_0x5673b1){return _0x5673b1[_0x5d76('0x28')]()[_0x5d76('0x27')](function(){_0x31a2ef[_0x5d76('0x1c')](0xcc)[_0x5d76('0x1d')]();});}};}function handleEntityNotFound(_0x17887a,_0x578546){return function(_0x12809b){if(!_0x12809b){_0x17887a['sendStatus'](0x194);}return _0x12809b;};}function handleError(_0x5de19b,_0x3ff9bc){_0x3ff9bc=_0x3ff9bc||0x1f4;return function(_0x40dd6e){logger[_0x5d76('0x29')](_0x40dd6e['stack']);if(_0x40dd6e[_0x5d76('0x2a')]){delete _0x40dd6e['name'];}_0x5de19b['status'](_0x3ff9bc)[_0x5d76('0x2b')](_0x40dd6e);};}exports[_0x5d76('0x2c')]=function(_0x2bdc45,_0x3fcb45){var _0x3edece={},_0x321fcc={},_0x1407a7={'count':0x0,'rows':[]};var _0x5be2c0=_['map'](db[_0x5d76('0x2d')][_0x5d76('0x2e')],function(_0x569611){return{'name':_0x569611[_0x5d76('0x2f')],'type':_0x569611['type'][_0x5d76('0x30')]};});_0x321fcc['model']=_[_0x5d76('0x31')](_0x5be2c0,_0x5d76('0x2a'));_0x321fcc[_0x5d76('0x32')]=_[_0x5d76('0x33')](_0x2bdc45[_0x5d76('0x32')]);_0x321fcc['filters']=_[_0x5d76('0x34')](_0x321fcc[_0x5d76('0x35')],_0x321fcc[_0x5d76('0x32')]);_0x3edece[_0x5d76('0x36')]=_[_0x5d76('0x34')](_0x321fcc[_0x5d76('0x35')],qs['fields'](_0x2bdc45[_0x5d76('0x32')][_0x5d76('0x37')]));_0x3edece[_0x5d76('0x36')]=_0x3edece['attributes'][_0x5d76('0x38')]?_0x3edece[_0x5d76('0x36')]:_0x321fcc[_0x5d76('0x35')];if(!_0x2bdc45[_0x5d76('0x32')][_0x5d76('0x39')](_0x5d76('0x3a'))){_0x3edece[_0x5d76('0x1f')]=qs[_0x5d76('0x1f')](_0x2bdc45['query'][_0x5d76('0x1f')]);_0x3edece[_0x5d76('0x1e')]=qs[_0x5d76('0x1e')](_0x2bdc45[_0x5d76('0x32')][_0x5d76('0x1e')]);}_0x3edece[_0x5d76('0x3b')]=qs[_0x5d76('0x3c')](_0x2bdc45[_0x5d76('0x32')][_0x5d76('0x3c')]);_0x3edece[_0x5d76('0x3d')]=qs[_0x5d76('0x3e')](_[_0x5d76('0x3f')](_0x2bdc45['query'],_0x321fcc[_0x5d76('0x3e')]),_0x5be2c0);if(_0x2bdc45[_0x5d76('0x32')][_0x5d76('0x40')]){_0x3edece[_0x5d76('0x3d')]=_[_0x5d76('0x41')](_0x3edece[_0x5d76('0x3d')],{'$or':_[_0x5d76('0x31')](_0x5be2c0,function(_0x58258e){if(_0x58258e['type']!=='VIRTUAL'){var _0x10af57={};_0x10af57[_0x58258e[_0x5d76('0x2a')]]={'$like':'%'+_0x2bdc45[_0x5d76('0x32')]['filter']+'%'};return _0x10af57;}})});}_0x3edece=_[_0x5d76('0x41')]({},_0x3edece,_0x2bdc45[_0x5d76('0x42')]);var _0x44a3c5={'where':_0x3edece['where']};return db[_0x5d76('0x2d')][_0x5d76('0x21')](_0x44a3c5)[_0x5d76('0x27')](function(_0x51c1e2){_0x1407a7[_0x5d76('0x21')]=_0x51c1e2;if(_0x2bdc45[_0x5d76('0x32')][_0x5d76('0x43')]){_0x3edece[_0x5d76('0x44')]=[{'all':!![]}];}return db[_0x5d76('0x2d')][_0x5d76('0x45')](_0x3edece);})[_0x5d76('0x27')](function(_0x45d298){_0x1407a7[_0x5d76('0x46')]=_0x45d298;return _0x1407a7;})['then'](respondWithFilteredResult(_0x3fcb45,_0x3edece))[_0x5d76('0x47')](handleError(_0x3fcb45,null));};exports[_0x5d76('0x48')]=function(_0x50949a,_0x53e97b){var _0x33f18b={'raw':!![],'where':{'id':_0x50949a[_0x5d76('0x49')]['id']}},_0x7a90b2={};_0x7a90b2[_0x5d76('0x35')]=_[_0x5d76('0x33')](db['VoiceQueuesLog'][_0x5d76('0x2e')]);_0x7a90b2[_0x5d76('0x32')]=_[_0x5d76('0x33')](_0x50949a['query']);_0x7a90b2['filters']=_[_0x5d76('0x34')](_0x7a90b2[_0x5d76('0x35')],_0x7a90b2[_0x5d76('0x32')]);_0x33f18b[_0x5d76('0x36')]=_[_0x5d76('0x34')](_0x7a90b2[_0x5d76('0x35')],qs[_0x5d76('0x37')](_0x50949a[_0x5d76('0x32')]['fields']));_0x33f18b['attributes']=_0x33f18b[_0x5d76('0x36')][_0x5d76('0x38')]?_0x33f18b['attributes']:_0x7a90b2[_0x5d76('0x35')];if(_0x50949a[_0x5d76('0x32')][_0x5d76('0x43')]){_0x33f18b[_0x5d76('0x44')]=[{'all':!![]}];}_0x33f18b=_[_0x5d76('0x41')]({},_0x33f18b,_0x50949a[_0x5d76('0x42')]);return db[_0x5d76('0x2d')]['find'](_0x33f18b)[_0x5d76('0x27')](handleEntityNotFound(_0x53e97b,null))[_0x5d76('0x27')](respondWithResult(_0x53e97b,null))[_0x5d76('0x47')](handleError(_0x53e97b,null));};exports['create']=function(_0x1cf468,_0x41db22){return db[_0x5d76('0x2d')][_0x5d76('0x4a')](_0x1cf468[_0x5d76('0x4b')],{})['then'](respondWithResult(_0x41db22,0xc9))[_0x5d76('0x47')](handleError(_0x41db22,null));};exports['update']=function(_0x479c90,_0x4b992c){if(_0x479c90[_0x5d76('0x4b')]['id']){delete _0x479c90[_0x5d76('0x4b')]['id'];}return db['VoiceQueuesLog'][_0x5d76('0x4c')]({'where':{'id':_0x479c90[_0x5d76('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b992c,null))[_0x5d76('0x27')](saveUpdates(_0x479c90[_0x5d76('0x4b')],null))['then'](respondWithResult(_0x4b992c,null))[_0x5d76('0x47')](handleError(_0x4b992c,null));};exports[_0x5d76('0x28')]=function(_0x35570c,_0x46623f){return db[_0x5d76('0x2d')][_0x5d76('0x4c')]({'where':{'id':_0x35570c['params']['id']}})[_0x5d76('0x27')](handleEntityNotFound(_0x46623f,null))['then'](removeEntity(_0x46623f,null))[_0x5d76('0x47')](handleError(_0x46623f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 7f2a234..80dad3c 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 _0xdfcc=['../../config/logger','moment','bluebird','request-promise','rimraf','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util'];(function(_0x4a7b9e,_0x1337fb){var _0xf970c5=function(_0x3d6315){while(--_0x3d6315){_0x4a7b9e['push'](_0x4a7b9e['shift']());}};_0xf970c5(++_0x1337fb);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0xdfcc[_0x57cbfb];return _0x4cb933;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var logger=require(_0xcdfc('0x2'))('api');var moment=require(_0xcdfc('0x3'));var BPromise=require(_0xcdfc('0x4'));var rp=require(_0xcdfc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdfc('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0xa928f6,_0x155d4c){return _0xa928f6['define'](_0xcdfc('0x7'),attributes,{'tableName':_0xcdfc('0x8'),'paranoid':![],'indexes':[{'name':_0xcdfc('0x9'),'fields':[_0xcdfc('0xa'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xb205=['../../config/logger','api','moment','path','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm','lodash','util'];(function(_0x1ea170,_0x28d157){var _0x32487e=function(_0x5bebe9){while(--_0x5bebe9){_0x1ea170['push'](_0x1ea170['shift']());}};_0x32487e(++_0x28d157);}(_0xb205,0xf0));var _0x5b20=function(_0x28260d,_0x555b8d){_0x28260d=_0x28260d-0x0;var _0x49e95b=_0xb205[_0x28260d];return _0x49e95b;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var logger=require(_0x5b20('0x2'))(_0x5b20('0x3'));var moment=require(_0x5b20('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b20('0x5'));var rimraf=require('rimraf');var config=require(_0x5b20('0x6'));var attributes=require(_0x5b20('0x7'));module['exports']=function(_0x3206cd,_0x29d926){return _0x3206cd[_0x5b20('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x5b20('0x9'),'paranoid':![],'indexes':[{'name':_0x5b20('0xa'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b6848e6..cebbce7 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 _0x9b87=['error','code','VoiceQueuesLog,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x1d3b92,_0x47ffc3){var _0x5e9bfa=function(_0x31d4c0){while(--_0x31d4c0){_0x1d3b92['push'](_0x1d3b92['shift']());}};_0x5e9bfa(++_0x47ffc3);}(_0x9b87,0x8e));var _0x79b8=function(_0x3045ba,_0x34a082){_0x3045ba=_0x3045ba-0x0;var _0x39db1e=_0x9b87[_0x3045ba];return _0x39db1e;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var moment=require(_0x79b8('0x2'));var BPromise=require(_0x79b8('0x3'));var rs=require(_0x79b8('0x4'));var fs=require('fs');var Redis=require(_0x79b8('0x5'));var db=require(_0x79b8('0x6'))['db'];var utils=require(_0x79b8('0x7'));var logger=require(_0x79b8('0x8'))(_0x79b8('0x9'));var config=require(_0x79b8('0xa'));var jayson=require(_0x79b8('0xb'));var client=jayson[_0x79b8('0xc')][_0x79b8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d2c9f,_0xf5e0f2,_0x5e10fe){return new BPromise(function(_0x4e0dd8,_0x5c15d4){return client['request'](_0x1d2c9f,_0x5e10fe)[_0x79b8('0xe')](function(_0x317e29){logger[_0x79b8('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0xf5e0f2,_0x79b8('0x10'));logger[_0x79b8('0x11')](_0x79b8('0x12'),_0xf5e0f2,'request\x20sent',JSON['stringify'](_0x317e29));if(_0x317e29[_0x79b8('0x13')]){if(_0x317e29[_0x79b8('0x13')][_0x79b8('0x14')]===0x1f4){logger[_0x79b8('0x13')](_0x79b8('0x15'),_0xf5e0f2,_0x317e29[_0x79b8('0x13')][_0x79b8('0x16')]);return _0x5c15d4(_0x317e29[_0x79b8('0x13')][_0x79b8('0x16')]);}logger[_0x79b8('0x13')](_0x79b8('0x15'),_0xf5e0f2,_0x317e29['error'][_0x79b8('0x16')]);return _0x4e0dd8(_0x317e29['error']['message']);}else{logger[_0x79b8('0xf')](_0x79b8('0x15'),_0xf5e0f2,_0x79b8('0x10'));_0x4e0dd8(_0x317e29['result'][_0x79b8('0x16')]);}})['catch'](function(_0x5ef869){logger[_0x79b8('0x13')](_0x79b8('0x15'),_0xf5e0f2,_0x5ef869);_0x5c15d4(_0x5ef869);});});} \ No newline at end of file +var _0x4e23=['../../config/logger','rpc','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x25f57f,_0x75013d){var _0x18f206=function(_0x4c934f){while(--_0x4c934f){_0x25f57f['push'](_0x25f57f['shift']());}};_0x18f206(++_0x75013d);}(_0x4e23,0x173));var _0x34e2=function(_0x2d0820,_0x5d2b64){_0x2d0820=_0x2d0820-0x0;var _0x55ed67=_0x4e23[_0x2d0820];return _0x55ed67;};'use strict';var _=require(_0x34e2('0x0'));var util=require('util');var moment=require(_0x34e2('0x1'));var BPromise=require(_0x34e2('0x2'));var rs=require(_0x34e2('0x3'));var fs=require('fs');var Redis=require(_0x34e2('0x4'));var db=require(_0x34e2('0x5'))['db'];var utils=require(_0x34e2('0x6'));var logger=require(_0x34e2('0x7'))(_0x34e2('0x8'));var config=require('../../config/environment');var jayson=require(_0x34e2('0x9'));var client=jayson[_0x34e2('0xa')][_0x34e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3862d5,_0x28ff76,_0x11faf1){return new BPromise(function(_0x24b9f6,_0x581889){return client[_0x34e2('0xc')](_0x3862d5,_0x11faf1)['then'](function(_0x33cf9c){logger['info'](_0x34e2('0xd'),_0x28ff76,_0x34e2('0xe'));logger['debug'](_0x34e2('0xf'),_0x28ff76,_0x34e2('0xe'),JSON[_0x34e2('0x10')](_0x33cf9c));if(_0x33cf9c[_0x34e2('0x11')]){if(_0x33cf9c[_0x34e2('0x11')]['code']===0x1f4){logger['error'](_0x34e2('0xd'),_0x28ff76,_0x33cf9c[_0x34e2('0x11')][_0x34e2('0x12')]);return _0x581889(_0x33cf9c[_0x34e2('0x11')]['message']);}logger[_0x34e2('0x11')](_0x34e2('0xd'),_0x28ff76,_0x33cf9c[_0x34e2('0x11')][_0x34e2('0x12')]);return _0x24b9f6(_0x33cf9c[_0x34e2('0x11')][_0x34e2('0x12')]);}else{logger[_0x34e2('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x28ff76,'request\x20sent');_0x24b9f6(_0x33cf9c['result'][_0x34e2('0x12')]);}})[_0x34e2('0x14')](function(_0x14671a){logger[_0x34e2('0x11')](_0x34e2('0xd'),_0x28ff76,_0x14671a);_0x581889(_0x14671a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 6c9c059..3a387ef 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 _0x4654=['get','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','runTranscribe','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index'];(function(_0x1f19b5,_0x31eecd){var _0x384643=function(_0x19cae7){while(--_0x19cae7){_0x1f19b5['push'](_0x1f19b5['shift']());}};_0x384643(++_0x31eecd);}(_0x4654,0xf9));var _0x4465=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4654[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x4465('0x0'));var path=require(_0x4465('0x1'));var timeout=require(_0x4465('0x2'));var express=require(_0x4465('0x3'));var router=express[_0x4465('0x4')]();var fs_extra=require(_0x4465('0x5'));var auth=require(_0x4465('0x6'));var interaction=require(_0x4465('0x7'));var config=require(_0x4465('0x8'));var controller=require(_0x4465('0x9'));router['get']('/',auth[_0x4465('0xa')](),controller[_0x4465('0xb')]);router[_0x4465('0xc')](_0x4465('0xd'),auth['isAuthenticated'](),controller[_0x4465('0xe')]);router[_0x4465('0xc')](_0x4465('0xf'),auth[_0x4465('0xa')](),controller[_0x4465('0x10')]);router['get'](_0x4465('0x11'),auth[_0x4465('0xa')](),controller[_0x4465('0x12')]);router[_0x4465('0xc')](_0x4465('0x13'),controller[_0x4465('0x14')]);router[_0x4465('0xc')](_0x4465('0x15'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0x4465('0x16')]('/',auth[_0x4465('0xa')](),controller['create']);router[_0x4465('0x16')](_0x4465('0x15'),auth['isAuthenticated'](),controller[_0x4465('0x17')]);router[_0x4465('0x18')](_0x4465('0xf'),auth[_0x4465('0xa')](),controller[_0x4465('0x19')]);router[_0x4465('0x1a')](_0x4465('0xf'),auth[_0x4465('0xa')](),controller[_0x4465('0x1b')]);module[_0x4465('0x1c')]=router; \ No newline at end of file +var _0x79a4=['Router','fs-extra','../../config/environment','get','/describe','isAuthenticated','/:id','show','/:id/download','/:id/transcribe','create','runTranscribe','delete','destroy','exports','util','connect-timeout'];(function(_0x363af0,_0x32d136){var _0x257614=function(_0x4a1ebd){while(--_0x4a1ebd){_0x363af0['push'](_0x363af0['shift']());}};_0x257614(++_0x32d136);}(_0x79a4,0x10e));var _0x479a=function(_0x49bd91,_0x1f70b4){_0x49bd91=_0x49bd91-0x0;var _0x488a88=_0x79a4[_0x49bd91];return _0x488a88;};'use strict';var multer=require('multer');var util=require(_0x479a('0x0'));var path=require('path');var timeout=require(_0x479a('0x1'));var express=require('express');var router=express[_0x479a('0x2')]();var fs_extra=require(_0x479a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x479a('0x4'));var controller=require('./voiceRecording.controller');router[_0x479a('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x479a('0x5')](_0x479a('0x6'),auth[_0x479a('0x7')](),controller['describe']);router[_0x479a('0x5')](_0x479a('0x8'),auth[_0x479a('0x7')](),controller[_0x479a('0x9')]);router[_0x479a('0x5')](_0x479a('0xa'),auth['isAuthenticated'](),controller['download']);router[_0x479a('0x5')]('/:id/downloads',controller['downloads']);router[_0x479a('0x5')](_0x479a('0xb'),auth['isAuthenticated'](),controller['downloadTranscribe']);router['post']('/',auth[_0x479a('0x7')](),controller[_0x479a('0xc')]);router['post'](_0x479a('0xb'),auth[_0x479a('0x7')](),controller[_0x479a('0xd')]);router['put'](_0x479a('0x8'),auth[_0x479a('0x7')](),controller['update']);router[_0x479a('0xe')](_0x479a('0x8'),auth[_0x479a('0x7')](),controller[_0x479a('0xf')]);module[_0x479a('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e526fd1..2ea3c8a 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(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 9890b8a..0b804a1 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 _0x23a6=['IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','request-promise','moment','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','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','offset','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','VoiceRecording','rawAttributes','key','differenceBy','format','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','filename','extname','unlink','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','ValidationError','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','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'];(function(_0x42312b,_0x47966e){var _0x2da5f1=function(_0x5e1349){while(--_0x5e1349){_0x42312b['push'](_0x42312b['shift']());}};_0x2da5f1(++_0x47966e);}(_0x23a6,0x12d));var _0x623a=function(_0x38dd99,_0x3f8708){_0x38dd99=_0x38dd99-0x0;var _0x8bb3c8=_0x23a6[_0x38dd99];return _0x8bb3c8;};'use strict';var emlformat=require(_0x623a('0x0'));var rimraf=require(_0x623a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x623a('0x2'));var moment=require(_0x623a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x623a('0x4'));var csv=require(_0x623a('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x623a('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x623a('0x7'));var jsforce=require(_0x623a('0x8'));var deskjs=require(_0x623a('0x9'));var toCsv=require(_0x623a('0x5'));var querystring=require(_0x623a('0xa'));var Papa=require('papaparse');var AWS=require(_0x623a('0xb'));var uuidv4=require(_0x623a('0xc'));var Redis=require(_0x623a('0xd'));var authService=require(_0x623a('0xe'));var qs=require(_0x623a('0xf'));var as=require(_0x623a('0x10'));var hardwareService=require(_0x623a('0x11'));var logger=require(_0x623a('0x12'))('api');var utils=require(_0x623a('0x13'));var config=require(_0x623a('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fce49,_0x614274){_0x614274=_0x614274||0xcc;return function(_0x4ffe08){if(_0x4ffe08){return _0x4fce49[_0x623a('0x15')](_0x614274);}return _0x4fce49[_0x623a('0x16')](_0x614274)[_0x623a('0x17')]();};}function respondWithResult(_0x5c886c,_0x416872){_0x416872=_0x416872||0xc8;return function(_0x53b88d){if(_0x53b88d){return _0x5c886c[_0x623a('0x16')](_0x416872)[_0x623a('0x18')](_0x53b88d);}};}function respondWithFilteredResult(_0x3e0f74,_0x3a396f){return function(_0x3cf540){if(_0x3cf540){var _0x4a6212=typeof _0x3a396f['offset']===_0x623a('0x19')&&typeof _0x3a396f[_0x623a('0x1a')]===_0x623a('0x19');var _0x41ee07=_0x3cf540['count'];var _0x365576=_0x4a6212?0x0:_0x3a396f['offset'];var _0x1be52b=_0x4a6212?_0x3cf540['count']:_0x3a396f[_0x623a('0x1b')]+_0x3a396f[_0x623a('0x1a')];var _0x38735b;if(_0x1be52b>=_0x41ee07){_0x1be52b=_0x41ee07;_0x38735b=0xc8;}else{_0x38735b=0xce;}_0x3e0f74['status'](_0x38735b);return _0x3e0f74[_0x623a('0x1c')](_0x623a('0x1d'),_0x365576+'-'+_0x1be52b+'/'+_0x41ee07)['json'](_0x3cf540);}return null;};}function patchUpdates(_0x8b7120){return function(_0x56f43e){try{jsonpatch['apply'](_0x56f43e,_0x8b7120,!![]);}catch(_0x1ca90c){return BPromise[_0x623a('0x1e')](_0x1ca90c);}return _0x56f43e[_0x623a('0x1f')]();};}function saveUpdates(_0x43be90,_0x5885a0){return function(_0x158931){if(_0x158931){return _0x158931[_0x623a('0x20')](_0x43be90)[_0x623a('0x21')](function(_0x2dd061){return _0x2dd061;});}return null;};}function removeEntity(_0xf9072b,_0x1452e6){return function(_0x689421){if(_0x689421){return _0x689421[_0x623a('0x22')]()[_0x623a('0x21')](function(){_0xf9072b[_0x623a('0x16')](0xcc)[_0x623a('0x17')]();});}};}function handleEntityNotFound(_0xd94985,_0xf86d8b){return function(_0x3191ea){if(!_0x3191ea){_0xd94985[_0x623a('0x15')](0x194);}return _0x3191ea;};}function handleError(_0x3b9eba,_0xcd4a95){_0xcd4a95=_0xcd4a95||0x1f4;return function(_0x2cdf6e){logger[_0x623a('0x23')](_0x2cdf6e['stack']);if(_0x2cdf6e[_0x623a('0x24')]){delete _0x2cdf6e[_0x623a('0x24')];}_0x3b9eba[_0x623a('0x16')](_0xcd4a95)['send'](_0x2cdf6e);};}exports[_0x623a('0x25')]=function(_0x29e28a,_0x430255){var _0x200a05={},_0x1e0325={},_0x3cc1ca={'count':0x0,'rows':[]};var _0x183f03=_[_0x623a('0x26')](db[_0x623a('0x27')][_0x623a('0x28')],function(_0x13d166){return{'name':_0x13d166['fieldName'],'type':_0x13d166['type'][_0x623a('0x29')]};});_0x1e0325['model']=_[_0x623a('0x2a')](_[_0x623a('0x26')](_0x183f03,_0x623a('0x24')),[_0x623a('0x2b')]);_0x1e0325[_0x623a('0x2c')]=_[_0x623a('0x2d')](_0x29e28a['query']);_0x1e0325[_0x623a('0x2e')]=_['intersection'](_0x1e0325[_0x623a('0x2f')],_0x1e0325['query']);_0x200a05[_0x623a('0x30')]=_[_0x623a('0x31')](_0x1e0325[_0x623a('0x2f')],qs[_0x623a('0x32')](_0x29e28a[_0x623a('0x2c')][_0x623a('0x32')]));_0x200a05[_0x623a('0x30')]=_0x200a05['attributes'][_0x623a('0x33')]?_0x200a05['attributes']:_0x1e0325[_0x623a('0x2f')];if(!_0x29e28a[_0x623a('0x2c')][_0x623a('0x34')]('nolimit')){_0x200a05['limit']=qs['limit'](_0x29e28a[_0x623a('0x2c')][_0x623a('0x1a')]);_0x200a05['offset']=qs[_0x623a('0x1b')](_0x29e28a[_0x623a('0x2c')][_0x623a('0x1b')]);}_0x200a05[_0x623a('0x35')]=qs[_0x623a('0x36')](_0x29e28a[_0x623a('0x2c')][_0x623a('0x36')]);_0x200a05['where']=qs[_0x623a('0x2e')](_['pick'](_0x29e28a[_0x623a('0x2c')],_0x1e0325['filters']),_0x183f03);if(_0x29e28a[_0x623a('0x2c')][_0x623a('0x37')]){_0x200a05[_0x623a('0x38')]=_[_0x623a('0x39')](_0x200a05['where'],{'$or':_[_0x623a('0x26')](_0x183f03,function(_0x875f2d){if(_0x875f2d[_0x623a('0x3a')]!==_0x623a('0x3b')){var _0x13a0ee={};_0x13a0ee[_0x875f2d[_0x623a('0x24')]]={'$like':'%'+_0x29e28a[_0x623a('0x2c')]['filter']+'%'};return _0x13a0ee;}})});}_0x200a05=_['merge']({},_0x200a05,_0x29e28a[_0x623a('0x3c')]);var _0x2ef8c8={'where':_0x200a05[_0x623a('0x38')]};return db[_0x623a('0x27')][_0x623a('0x3d')](_0x2ef8c8)[_0x623a('0x21')](function(_0x1e892f){_0x3cc1ca['count']=_0x1e892f;if(_0x29e28a[_0x623a('0x2c')]['includeAll']){_0x200a05[_0x623a('0x3e')]=[{'all':!![]}];}return db[_0x623a('0x27')][_0x623a('0x3f')](_0x200a05);})['then'](function(_0x441c5d){_0x3cc1ca[_0x623a('0x40')]=_0x441c5d;return _0x3cc1ca;})[_0x623a('0x21')](respondWithFilteredResult(_0x430255,_0x200a05))[_0x623a('0x41')](handleError(_0x430255,null));};exports[_0x623a('0x42')]=function(_0x4b8c90,_0x3d5d08){var _0x4e9090={'raw':![],'where':{'id':_0x4b8c90[_0x623a('0x43')]['id']}},_0x20082b={};_0x20082b['model']=_[_0x623a('0x2d')](db[_0x623a('0x27')][_0x623a('0x28')]);_0x20082b[_0x623a('0x2c')]=_['keys'](_0x4b8c90[_0x623a('0x2c')]);_0x20082b['filters']=_['intersection'](_0x20082b[_0x623a('0x2f')],_0x20082b[_0x623a('0x2c')]);_0x4e9090[_0x623a('0x30')]=_['intersection'](_0x20082b[_0x623a('0x2f')],qs[_0x623a('0x32')](_0x4b8c90[_0x623a('0x2c')][_0x623a('0x32')]));_0x4e9090[_0x623a('0x30')]=_0x4e9090['attributes']['length']?_0x4e9090['attributes']:_0x20082b[_0x623a('0x2f')];if(_0x4b8c90[_0x623a('0x2c')][_0x623a('0x44')]){_0x4e9090[_0x623a('0x3e')]=[{'all':!![]}];}_0x4e9090=_['merge']({},_0x4e9090,_0x4b8c90[_0x623a('0x3c')]);return db[_0x623a('0x27')][_0x623a('0x45')](_0x4e9090)[_0x623a('0x21')](handleEntityNotFound(_0x3d5d08,null))[_0x623a('0x21')](respondWithResult(_0x3d5d08,null))['catch'](handleError(_0x3d5d08,null));};exports[_0x623a('0x46')]=function(_0x5d29d8,_0x547134){return db[_0x623a('0x27')][_0x623a('0x46')](_0x5d29d8[_0x623a('0x47')],{})[_0x623a('0x21')](respondWithResult(_0x547134,0xc9))[_0x623a('0x41')](handleError(_0x547134,null));};exports[_0x623a('0x20')]=function(_0x327e3f,_0x54c57e){if(_0x327e3f['body']['id']){delete _0x327e3f[_0x623a('0x47')]['id'];}return db[_0x623a('0x27')][_0x623a('0x45')]({'where':{'id':_0x327e3f['params']['id']}})[_0x623a('0x21')](handleEntityNotFound(_0x54c57e,null))[_0x623a('0x21')](saveUpdates(_0x327e3f[_0x623a('0x47')],null))[_0x623a('0x21')](respondWithResult(_0x54c57e,null))[_0x623a('0x41')](handleError(_0x54c57e,null));};exports['describe']=function(_0x5a328b,_0x51138e){return db[_0x623a('0x27')][_0x623a('0x48')]()['then'](respondWithResult(_0x51138e,null))[_0x623a('0x41')](handleError(_0x51138e,null));};exports[_0x623a('0x49')]=function(_0xc8d187,_0x116471,_0x5564d6){var _0x26043b=require('../../components/encryptor');var _0x48c89c=![];var _0x38e3bc={};if(_0xc8d187[_0x623a('0x2c')][_0x623a('0x3a')]&&_0xc8d187['query']['type']===_0x623a('0x4a')){_0x38e3bc[_0x623a('0x4a')]=_0xc8d187[_0x623a('0x43')]['id'];}else{_0x38e3bc['id']=_0xc8d187[_0x623a('0x43')]['id'];}return db[_0x623a('0x27')]['find']({'where':_0x38e3bc,'attributes':['id',_0x623a('0x4b')],'raw':!![]})[_0x623a('0x21')](handleEntityNotFound(_0x116471,null))[_0x623a('0x21')](function(_0x58bd74){if(_0x58bd74){var _0x50a214=_0x58bd74['value'];var _0x2f8ff4=util[_0x623a('0x2b')](_0x623a('0x4c'),_0x50a214);if(fs[_0x623a('0x4d')](_0x2f8ff4)){_0x48c89c=!![];return _0x26043b[_0x623a('0x4e')](_0x2f8ff4,_0x50a214,config[_0x623a('0x4f')][_0x623a('0x50')])[_0x623a('0x21')](function(){return _0x58bd74;});}return _0x58bd74;}})['then'](function(_0x2b4caf){if(_0x2b4caf){var _0x82acc9=_0x2b4caf[_0x623a('0x4b')];if(!fs[_0x623a('0x4d')](_0x82acc9)){throw new db[(_0x623a('0x51'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x2b4caf[_0x623a('0x52')]){return _0x116471[_0x623a('0x49')](_0x82acc9,_0x2b4caf[_0x623a('0x52')]+path[_0x623a('0x53')](_0x82acc9),function(){if(_0x48c89c){fs[_0x623a('0x54')](_0x82acc9);}});}else{return _0x116471['download'](_0x82acc9,function(_0x3a888f){if(_0x48c89c){fs['unlink'](_0x82acc9);}});}}})[_0x623a('0x41')](function(_0x164700){if(_0x164700['message']===_0x623a('0x55')){_0x116471[_0x623a('0x16')](0x194)[_0x623a('0x56')](_0x623a('0x57'));}else{return handleError(_0x116471,null);}});};exports[_0x623a('0x58')]=function(_0x36e3b0,_0x12f2c7,_0x718e9){var _0xd925bf=require(_0x623a('0x59'));var _0x428790=![];var _0x2b5e87={'$and':[db[_0x623a('0x5a')][_0x623a('0x38')](db[_0x623a('0x5a')]['fn'](_0x623a('0x5b'),db[_0x623a('0x5a')][_0x623a('0x5c')]('uniqueid')),_0x36e3b0[_0x623a('0x2c')][_0x623a('0x5d')])]};if(_0x36e3b0[_0x623a('0x2c')][_0x623a('0x3a')]&&_0x36e3b0[_0x623a('0x2c')][_0x623a('0x3a')]===_0x623a('0x4a')){_0x2b5e87['$and']['push']({'uniqueid':_0x36e3b0[_0x623a('0x43')]['id']});}else{_0x2b5e87[_0x623a('0x5e')]['push']({'id':_0x36e3b0['params']['id']});}return db[_0x623a('0x27')][_0x623a('0x45')]({'where':_0x2b5e87,'attributes':['id',_0x623a('0x4b')],'raw':!![]})[_0x623a('0x21')](handleEntityNotFound(_0x12f2c7,null))['then'](function(_0x320f06){if(_0x320f06){var _0xa98874=util[_0x623a('0x2b')](_0x623a('0x4c'),_0x320f06[_0x623a('0x4b')]);if(fs[_0x623a('0x4d')](_0xa98874)){_0x428790=!![];return _0xd925bf[_0x623a('0x4e')](_0xa98874,_0x320f06['value'],config['secrets'][_0x623a('0x50')])[_0x623a('0x21')](function(){return _0x320f06;});}return _0x320f06;}})['then'](function(_0x326dbf){if(_0x326dbf){if(!fs['existsSync'](_0x326dbf[_0x623a('0x4b')])){throw new db['Sequelize'][(_0x623a('0x5f'))](_0x623a('0x55'));}if(_0x326dbf[_0x623a('0x52')]){return _0x12f2c7[_0x623a('0x49')](_0x326dbf['value'],_0x326dbf[_0x623a('0x52')]+path[_0x623a('0x53')](_0x326dbf[_0x623a('0x4b')]),function(){if(_0x428790){fs[_0x623a('0x54')](_0x326dbf[_0x623a('0x4b')]);}});}else{return _0x12f2c7[_0x623a('0x49')](_0x326dbf[_0x623a('0x4b')],function(_0x2d5662){if(_0x428790){fs[_0x623a('0x54')](_0x326dbf[_0x623a('0x4b')]);}});}}})[_0x623a('0x41')](handleError(_0x12f2c7,null));};exports[_0x623a('0x22')]=function(_0x500606,_0x42a0cc){return db[_0x623a('0x27')][_0x623a('0x45')]({'where':{'id':_0x500606[_0x623a('0x43')]['id']}})[_0x623a('0x21')](function(_0x1bfcde){if(_['isNil'](_0x1bfcde)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1bfcde;})[_0x623a('0x21')](function(_0xa78e57){var _0x4a9053=_0xa78e57['value'];logger[_0x623a('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x4a9053);if(!_['isNil'](_0xa78e57[_0x623a('0x4b')])&&fs[_0x623a('0x4d')](_0x4a9053)){logger[_0x623a('0x60')](_0x623a('0x61')+_0x4a9053+_0x623a('0x62'));fs['unlinkSync'](_0x4a9053);}_0x4a9053=_0x4a9053+_0x623a('0x63');if(!_[_0x623a('0x64')](_0xa78e57[_0x623a('0x4b')])&&fs[_0x623a('0x4d')](_0x4a9053)){logger['info'](_0x623a('0x61')+_0x4a9053+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x623a('0x65')](_0x4a9053);}return _0xa78e57;})['then'](function(_0x192eeb){if(!_0x192eeb)throw new InternalError();return _0x192eeb[_0x623a('0x22')]();})[_0x623a('0x21')](function(){_0x42a0cc[_0x623a('0x16')](0xcc)['end']();})[_0x623a('0x41')](handleError(_0x42a0cc,null));};function getBucketslist(_0x3163fa,_0x2c629d,_0x335292){return new Promise(function(_0x3401d8,_0x6d1711){var _0x4d7738=new AWS['S3']({'accessKeyId':_0x2c629d,'secretAccessKey':_0x3163fa,'region':_0x335292});_0x4d7738[_0x623a('0x66')]({},function(_0x599734,_0x2fe222){if(_0x599734){return _0x6d1711(_0x599734);}else{return _0x3401d8(_0x2fe222);}});});}function createBucket(_0x1cabb3,_0x2d7872,_0x22e878,_0x4522dc){return new Promise(function(_0x378480,_0x300979){var _0x231021=new AWS['S3']({'accessKeyId':_0x2d7872,'secretAccessKey':_0x1cabb3,'region':_0x22e878});_0x231021[_0x623a('0x67')]({'Bucket':_0x4522dc},function(_0x18e4c0,_0x1ee539){if(_0x18e4c0){return _0x300979(_0x18e4c0);}else{return _0x378480(_0x1ee539);}});});}function uploadFile(_0x4e29a2,_0x296895,_0x1a4c8a,_0x56d394,_0x11e370,_0x31b07e){return new Promise(function(_0x202f4e,_0x5b5059){var _0xf3ccef=new AWS['S3']({'accessKeyId':_0x296895,'secretAccessKey':_0x4e29a2,'region':_0x1a4c8a});_0xf3ccef[_0x623a('0x68')]({'Bucket':_0x56d394,'Key':_0x11e370,'Body':_0x31b07e},function(_0x188bd1,_0x19ca6a){if(_0x188bd1){return _0x5b5059(_0x188bd1);}else{return _0x202f4e(_0x19ca6a);}});});}function startTranscribe(_0x359a08,_0x2aea45,_0x50970a,_0x54e304,_0x1c475f,_0x4c3775){return new Promise(function(_0x599974,_0x42f653){var _0x3d80ef=new AWS[(_0x623a('0x69'))]({'accessKeyId':_0x2aea45,'secretAccessKey':_0x359a08,'region':_0x50970a});_0x3d80ef['startTranscriptionJob']({'TranscriptionJobName':_0x54e304,'LanguageCode':_0x1c475f,'Media':{'MediaFileUri':_0x4c3775}},function(_0x2e6acc,_0xe361e8){if(_0x2e6acc){return _0x42f653(_0x2e6acc);}else{return _0x599974(_0xe361e8);}});});}function transcribe(_0x4b50c5,_0x19bd11,_0x2b5bba,_0x24b1ed,_0x4258f1,_0x331e61,_0x3228e5){return new Promise(function(_0xc9a3f4,_0x1d54da){var _0x466139={};logger[_0x623a('0x60')](util[_0x623a('0x2b')](_0x623a('0x6a'),_0x4b50c5,_0x4258f1));return uploadFile(_0x19bd11,_0x2b5bba,_0x24b1ed,_0x4258f1,path[_0x623a('0x6b')](_0x331e61),fs[_0x623a('0x6c')](_0x331e61))['then'](function(_0x1b5a41){logger[_0x623a('0x60')](util[_0x623a('0x2b')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4b50c5,_0x4258f1,_0x1b5a41[_0x623a('0x6d')]));_0x466139[_0x623a('0x6e')]=_0x1b5a41[_0x623a('0x6f')];_0x466139[_0x623a('0x70')]=_0x1b5a41[_0x623a('0x6d')];logger[_0x623a('0x60')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x4b50c5));return startTranscribe(_0x19bd11,_0x2b5bba,_0x24b1ed,uuidv4(),_0x3228e5,_0x1b5a41[_0x623a('0x6d')]);})['then'](function(_0x260091){logger[_0x623a('0x60')](util[_0x623a('0x2b')](_0x623a('0x71'),_0x4b50c5,_0x260091[_0x623a('0x72')]['TranscriptionJobName']));_0x466139[_0x623a('0x73')]=_0x260091[_0x623a('0x72')][_0x623a('0x74')];_0x466139[_0x623a('0x75')]=_0x260091[_0x623a('0x72')][_0x623a('0x76')];return _0xc9a3f4(_0x466139);})[_0x623a('0x41')](function(_0x207f21){return _0x1d54da(_0x207f21);});});}exports[_0x623a('0x77')]=function(_0xae34da,_0x1c3a1f,_0x5b3c9c){var _0x53dde5;var _0xf541e7;var _0x56737f;var _0x2acc44=require(_0x623a('0x59'));return db[_0x623a('0x27')][_0x623a('0x78')]({'where':{'id':_0xae34da[_0x623a('0x43')]['id']}})['then'](function(_0x51dd14){if(_0x51dd14){var _0x1697f3=util[_0x623a('0x2b')](_0x623a('0x4c'),_0x51dd14[_0x623a('0x4b')]);if(fs[_0x623a('0x4d')](_0x1697f3)){cypher=!![];return _0x2acc44[_0x623a('0x4e')](_0x1697f3,_0x51dd14[_0x623a('0x4b')],config[_0x623a('0x4f')][_0x623a('0x50')])[_0x623a('0x21')](function(){return _0x51dd14;});}return _0x51dd14;}})[_0x623a('0x21')](function(_0x10e90e){if(!_0x10e90e){throw new db[(_0x623a('0x51'))][(_0x623a('0x5f'))](_0x623a('0x79'));}_0xf541e7=_0x10e90e;return db[_0x623a('0x7a')][_0x623a('0x78')]({'where':{'id':0x1}});})[_0x623a('0x21')](handleEntityNotFound(_0x1c3a1f,null))[_0x623a('0x21')](function(_0x5b2093){if(_0x5b2093){_0x53dde5=_0x5b2093;if(!_0x53dde5['transcribe']||!_0x53dde5['transcribeAccountId']||!_0x53dde5[_0x623a('0x7b')]||!_0x53dde5[_0x623a('0x7c')]||!_0x53dde5['bucket']){throw new db[(_0x623a('0x51'))]['ValidationError'](_0x623a('0x7d'));}if(_0xae34da[_0x623a('0x47')][_0x623a('0x7e')]&&(!_0x53dde5[_0x623a('0x7f')]||!_0x53dde5['sentimentAccountId']||!_0x53dde5['sentimentRegion']||!_0x53dde5['language']||!_0x53dde5[_0x623a('0x6e')])){throw new db[(_0x623a('0x51'))]['ValidationError'](_0x623a('0x80'));}return db[_0x623a('0x81')][_0x623a('0x78')]({'where':{'id':_0x53dde5['transcribeAccountId']}});}})[_0x623a('0x21')](function(_0x57bc6e){if(!_0x57bc6e){throw new db['Sequelize'][(_0x623a('0x5f'))](_0x623a('0x82'));}if(!_0x57bc6e[_0x623a('0x83')]||!_0x57bc6e[_0x623a('0x84')]){throw new db[(_0x623a('0x51'))]['ValidationError'](_0x623a('0x85'));}_0x56737f=_0x57bc6e;return getBucketslist(_0x56737f[_0x623a('0x83')],_0x56737f[_0x623a('0x84')],_0x53dde5[_0x623a('0x7b')]);})[_0x623a('0x21')](function(_0x55abe4){if(_0x55abe4&&_0x55abe4[_0x623a('0x86')]){var _0x40a128=_[_0x623a('0x45')](_0x55abe4[_0x623a('0x86')],function(_0x3222a6){return _0x3222a6[_0x623a('0x87')]===_0x53dde5[_0x623a('0x6e')];});if(!_0x40a128){logger[_0x623a('0x60')](util[_0x623a('0x2b')](_0x623a('0x88'),_0xae34da[_0x623a('0x43')]['id'],_0x53dde5[_0x623a('0x6e')]));return createBucket(_0x56737f['data1'],_0x56737f[_0x623a('0x84')],_0x53dde5[_0x623a('0x7b')],_0x53dde5[_0x623a('0x6e')]);}logger[_0x623a('0x60')](util[_0x623a('0x2b')](_0x623a('0x89'),_0xae34da['params']['id'],_0x53dde5['bucket']));return;}})['then'](function(_0x263e56){if(_0xf541e7['transcribeStatus']===_0x623a('0x8a')){return transcribe(_0xae34da[_0x623a('0x43')]['id'],_0x56737f[_0x623a('0x83')],_0x56737f['data2'],_0x53dde5['transcribeRegion'],_0x53dde5[_0x623a('0x6e')],_0xf541e7[_0x623a('0x4b')],_0x53dde5[_0x623a('0x7c')]);}else{logger[_0x623a('0x60')](util['format'](_0x623a('0x8b'),_0xae34da[_0x623a('0x43')]['id']));return{'transcribeStatus':_0x623a('0x8c')};}})[_0x623a('0x21')](function(_0x137a9a){if(_0x137a9a){_0x137a9a[_0x623a('0x8d')]=_0xae34da[_0x623a('0x47')][_0x623a('0x7e')];return _0xf541e7[_0x623a('0x8e')](_0x137a9a);}})[_0x623a('0x21')](respondWithResult(_0x1c3a1f,null))[_0x623a('0x41')](handleError(_0x1c3a1f,null));};function writeFile(_0x2c0d2b,_0x5414f8){return new Promise(function(_0x376dae,_0x284d9c){fs[_0x623a('0x8f')](_0x5414f8,_0x2c0d2b,function(_0x10f7ca,_0x387340){if(_0x10f7ca){return _0x284d9c(_0x10f7ca);}else{return _0x376dae(_0x387340);}});});}exports['downloadTranscribe']=function(_0x2ba6d5,_0x31f75d,_0x596600){return db[_0x623a('0x27')][_0x623a('0x78')]({'where':{'id':_0x2ba6d5[_0x623a('0x43')]['id']}})[_0x623a('0x21')](handleEntityNotFound(_0x31f75d))['then'](function(_0x6dd5b5){if(_0x6dd5b5&&_0x6dd5b5['fileText']){var _0x159f73=_0x6dd5b5[_0x623a('0x90')];var _0xdcd8fa=config['root']+_0x623a('0x91')+_0x6dd5b5['id']+_0x623a('0x92');if(fs[_0x623a('0x4d')](_0xdcd8fa)){return _0xdcd8fa;}return writeFile(_0x159f73,_0xdcd8fa)[_0x623a('0x21')](function(){return _0xdcd8fa;});}else{throw new db[(_0x623a('0x51'))][(_0x623a('0x5f'))]('Transcript\x20not\x20available');}})[_0x623a('0x21')](function(_0x83cdcb){return _0x31f75d['download'](_0x83cdcb);})[_0x623a('0x41')](handleError(_0x31f75d));}; \ No newline at end of file +var _0x3edb=['transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','secrets','Voice\x20Recording\x20not\x20found','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','VoiceRecording','rows','catch','show','keys','find','create','body','update','params','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','col','token','push','$and','decryptFile','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName'];(function(_0x1d10cb,_0x369746){var _0x3efe9a=function(_0x44878b){while(--_0x44878b){_0x1d10cb['push'](_0x1d10cb['shift']());}};_0x3efe9a(++_0x369746);}(_0x3edb,0xb7));var _0xb3ed=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x3edb[_0x376b45];return _0x2341b3;};'use strict';var emlformat=require(_0xb3ed('0x0'));var rimraf=require(_0xb3ed('0x1'));var zipdir=require(_0xb3ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3ed('0x3'));var moment=require(_0xb3ed('0x4'));var BPromise=require(_0xb3ed('0x5'));var Mustache=require('mustache');var util=require(_0xb3ed('0x6'));var path=require(_0xb3ed('0x7'));var sox=require(_0xb3ed('0x8'));var csv=require(_0xb3ed('0x9'));var ejs=require(_0xb3ed('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3ed('0xb'));var squel=require(_0xb3ed('0xc'));var crypto=require('crypto');var jsforce=require(_0xb3ed('0xd'));var deskjs=require(_0xb3ed('0xe'));var toCsv=require(_0xb3ed('0x9'));var querystring=require(_0xb3ed('0xf'));var Papa=require(_0xb3ed('0x10'));var AWS=require(_0xb3ed('0x11'));var uuidv4=require(_0xb3ed('0x12'));var Redis=require(_0xb3ed('0x13'));var authService=require(_0xb3ed('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb3ed('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3ed('0x16'))(_0xb3ed('0x17'));var utils=require(_0xb3ed('0x18'));var config=require(_0xb3ed('0x19'));var licenseUtil=require(_0xb3ed('0x1a'));var db=require(_0xb3ed('0x1b'))['db'];function respondWithStatusCode(_0x153e7d,_0x20adf4){_0x20adf4=_0x20adf4||0xcc;return function(_0x4e0e0f){if(_0x4e0e0f){return _0x153e7d[_0xb3ed('0x1c')](_0x20adf4);}return _0x153e7d[_0xb3ed('0x1d')](_0x20adf4)[_0xb3ed('0x1e')]();};}function respondWithResult(_0x3442ff,_0xeb74e){_0xeb74e=_0xeb74e||0xc8;return function(_0x1bd70f){if(_0x1bd70f){return _0x3442ff[_0xb3ed('0x1d')](_0xeb74e)['json'](_0x1bd70f);}};}function respondWithFilteredResult(_0x3ca6e5,_0x492e2a){return function(_0x2558ba){if(_0x2558ba){var _0x23b14d=typeof _0x492e2a['offset']===_0xb3ed('0x1f')&&typeof _0x492e2a[_0xb3ed('0x20')]===_0xb3ed('0x1f');var _0x1d1bc8=_0x2558ba[_0xb3ed('0x21')];var _0x1a5bd8=_0x23b14d?0x0:_0x492e2a[_0xb3ed('0x22')];var _0x475f7=_0x23b14d?_0x2558ba['count']:_0x492e2a[_0xb3ed('0x22')]+_0x492e2a['limit'];var _0x4f937b;if(_0x475f7>=_0x1d1bc8){_0x475f7=_0x1d1bc8;_0x4f937b=0xc8;}else{_0x4f937b=0xce;}_0x3ca6e5[_0xb3ed('0x1d')](_0x4f937b);return _0x3ca6e5[_0xb3ed('0x23')](_0xb3ed('0x24'),_0x1a5bd8+'-'+_0x475f7+'/'+_0x1d1bc8)['json'](_0x2558ba);}return null;};}function patchUpdates(_0x1563e0){return function(_0x2ae697){try{jsonpatch[_0xb3ed('0x25')](_0x2ae697,_0x1563e0,!![]);}catch(_0xd67cda){return BPromise[_0xb3ed('0x26')](_0xd67cda);}return _0x2ae697[_0xb3ed('0x27')]();};}function saveUpdates(_0xd70785,_0x4abdef){return function(_0x2df873){if(_0x2df873){return _0x2df873['update'](_0xd70785)['then'](function(_0x4f31c0){return _0x4f31c0;});}return null;};}function removeEntity(_0x2f8ab2,_0x787a69){return function(_0x1be488){if(_0x1be488){return _0x1be488[_0xb3ed('0x28')]()[_0xb3ed('0x29')](function(){_0x2f8ab2['status'](0xcc)[_0xb3ed('0x1e')]();});}};}function handleEntityNotFound(_0x5eaf74,_0x2f8c09){return function(_0x596209){if(!_0x596209){_0x5eaf74[_0xb3ed('0x1c')](0x194);}return _0x596209;};}function handleError(_0x18f7f8,_0x1db409){_0x1db409=_0x1db409||0x1f4;return function(_0x32ac81){logger[_0xb3ed('0x2a')](_0x32ac81[_0xb3ed('0x2b')]);if(_0x32ac81['name']){delete _0x32ac81[_0xb3ed('0x2c')];}_0x18f7f8['status'](_0x1db409)[_0xb3ed('0x2d')](_0x32ac81);};}exports[_0xb3ed('0x2e')]=function(_0x5335c1,_0x21a3e9){var _0x60ce33={},_0x1db0d1={},_0xd622b3={'count':0x0,'rows':[]};var _0x18f143=_[_0xb3ed('0x2f')](db['VoiceRecording'][_0xb3ed('0x30')],function(_0x61c5c){return{'name':_0x61c5c[_0xb3ed('0x31')],'type':_0x61c5c['type']['key']};});_0x1db0d1[_0xb3ed('0x32')]=_[_0xb3ed('0x33')](_['map'](_0x18f143,'name'),['format']);_0x1db0d1['query']=_['keys'](_0x5335c1[_0xb3ed('0x34')]);_0x1db0d1[_0xb3ed('0x35')]=_[_0xb3ed('0x36')](_0x1db0d1[_0xb3ed('0x32')],_0x1db0d1[_0xb3ed('0x34')]);_0x60ce33[_0xb3ed('0x37')]=_[_0xb3ed('0x36')](_0x1db0d1[_0xb3ed('0x32')],qs[_0xb3ed('0x38')](_0x5335c1[_0xb3ed('0x34')][_0xb3ed('0x38')]));_0x60ce33[_0xb3ed('0x37')]=_0x60ce33[_0xb3ed('0x37')][_0xb3ed('0x39')]?_0x60ce33[_0xb3ed('0x37')]:_0x1db0d1['model'];if(!_0x5335c1[_0xb3ed('0x34')][_0xb3ed('0x3a')](_0xb3ed('0x3b'))){_0x60ce33[_0xb3ed('0x20')]=qs[_0xb3ed('0x20')](_0x5335c1[_0xb3ed('0x34')][_0xb3ed('0x20')]);_0x60ce33[_0xb3ed('0x22')]=qs[_0xb3ed('0x22')](_0x5335c1['query']['offset']);}_0x60ce33['order']=qs[_0xb3ed('0x3c')](_0x5335c1[_0xb3ed('0x34')][_0xb3ed('0x3c')]);_0x60ce33['where']=qs['filters'](_['pick'](_0x5335c1[_0xb3ed('0x34')],_0x1db0d1[_0xb3ed('0x35')]),_0x18f143);if(_0x5335c1['query'][_0xb3ed('0x3d')]){_0x60ce33[_0xb3ed('0x3e')]=_[_0xb3ed('0x3f')](_0x60ce33[_0xb3ed('0x3e')],{'$or':_['map'](_0x18f143,function(_0x16176c){if(_0x16176c[_0xb3ed('0x40')]!==_0xb3ed('0x41')){var _0x575a73={};_0x575a73[_0x16176c[_0xb3ed('0x2c')]]={'$like':'%'+_0x5335c1[_0xb3ed('0x34')]['filter']+'%'};return _0x575a73;}})});}_0x60ce33=_[_0xb3ed('0x3f')]({},_0x60ce33,_0x5335c1[_0xb3ed('0x42')]);var _0x211f56={'where':_0x60ce33[_0xb3ed('0x3e')]};return db['VoiceRecording'][_0xb3ed('0x21')](_0x211f56)[_0xb3ed('0x29')](function(_0x4d47bf){_0xd622b3[_0xb3ed('0x21')]=_0x4d47bf;if(_0x5335c1['query'][_0xb3ed('0x43')]){_0x60ce33[_0xb3ed('0x44')]=[{'all':!![]}];}return db[_0xb3ed('0x45')]['findAll'](_0x60ce33);})['then'](function(_0x233493){_0xd622b3[_0xb3ed('0x46')]=_0x233493;return _0xd622b3;})[_0xb3ed('0x29')](respondWithFilteredResult(_0x21a3e9,_0x60ce33))[_0xb3ed('0x47')](handleError(_0x21a3e9,null));};exports[_0xb3ed('0x48')]=function(_0x583de6,_0x56dde0){var _0x307fdf={'raw':![],'where':{'id':_0x583de6['params']['id']}},_0xbc1e25={};_0xbc1e25['model']=_['keys'](db[_0xb3ed('0x45')]['rawAttributes']);_0xbc1e25[_0xb3ed('0x34')]=_[_0xb3ed('0x49')](_0x583de6[_0xb3ed('0x34')]);_0xbc1e25[_0xb3ed('0x35')]=_['intersection'](_0xbc1e25[_0xb3ed('0x32')],_0xbc1e25[_0xb3ed('0x34')]);_0x307fdf[_0xb3ed('0x37')]=_[_0xb3ed('0x36')](_0xbc1e25[_0xb3ed('0x32')],qs[_0xb3ed('0x38')](_0x583de6['query'][_0xb3ed('0x38')]));_0x307fdf['attributes']=_0x307fdf[_0xb3ed('0x37')]['length']?_0x307fdf[_0xb3ed('0x37')]:_0xbc1e25[_0xb3ed('0x32')];if(_0x583de6[_0xb3ed('0x34')]['includeAll']){_0x307fdf[_0xb3ed('0x44')]=[{'all':!![]}];}_0x307fdf=_[_0xb3ed('0x3f')]({},_0x307fdf,_0x583de6[_0xb3ed('0x42')]);return db[_0xb3ed('0x45')][_0xb3ed('0x4a')](_0x307fdf)[_0xb3ed('0x29')](handleEntityNotFound(_0x56dde0,null))[_0xb3ed('0x29')](respondWithResult(_0x56dde0,null))[_0xb3ed('0x47')](handleError(_0x56dde0,null));};exports['create']=function(_0x9d984f,_0xf41532){return db[_0xb3ed('0x45')][_0xb3ed('0x4b')](_0x9d984f[_0xb3ed('0x4c')],{})['then'](respondWithResult(_0xf41532,0xc9))[_0xb3ed('0x47')](handleError(_0xf41532,null));};exports[_0xb3ed('0x4d')]=function(_0x2ad530,_0x4fc9d0){if(_0x2ad530[_0xb3ed('0x4c')]['id']){delete _0x2ad530[_0xb3ed('0x4c')]['id'];}return db['VoiceRecording'][_0xb3ed('0x4a')]({'where':{'id':_0x2ad530[_0xb3ed('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4fc9d0,null))['then'](saveUpdates(_0x2ad530['body'],null))['then'](respondWithResult(_0x4fc9d0,null))[_0xb3ed('0x47')](handleError(_0x4fc9d0,null));};exports[_0xb3ed('0x4f')]=function(_0x346009,_0x43cbef){return db[_0xb3ed('0x45')]['describe']()[_0xb3ed('0x29')](respondWithResult(_0x43cbef,null))[_0xb3ed('0x47')](handleError(_0x43cbef,null));};exports[_0xb3ed('0x50')]=function(_0x1018c6,_0x1b7839,_0x36cefb){var _0x321f3c=require(_0xb3ed('0x51'));var _0x1af27f=![];var _0x13bdba={};if(_0x1018c6[_0xb3ed('0x34')][_0xb3ed('0x40')]&&_0x1018c6[_0xb3ed('0x34')][_0xb3ed('0x40')]==='uniqueid'){_0x13bdba[_0xb3ed('0x52')]=_0x1018c6[_0xb3ed('0x4e')]['id'];}else{_0x13bdba['id']=_0x1018c6[_0xb3ed('0x4e')]['id'];}return db[_0xb3ed('0x45')][_0xb3ed('0x4a')]({'where':_0x13bdba,'attributes':['id','value'],'raw':!![]})[_0xb3ed('0x29')](handleEntityNotFound(_0x1b7839,null))['then'](function(_0x171254){if(_0x171254){var _0x2370ce=_0x171254[_0xb3ed('0x53')];var _0x15e9b9=util[_0xb3ed('0x54')](_0xb3ed('0x55'),_0x2370ce);if(fs[_0xb3ed('0x56')](_0x15e9b9)){_0x1af27f=!![];return _0x321f3c['decryptFile'](_0x15e9b9,_0x2370ce,config['secrets'][_0xb3ed('0x57')])[_0xb3ed('0x29')](function(){return _0x171254;});}return _0x171254;}})[_0xb3ed('0x29')](function(_0x55d28d){if(_0x55d28d){var _0x1e0e90=_0x55d28d[_0xb3ed('0x53')];if(!fs[_0xb3ed('0x56')](_0x1e0e90)){throw new db[(_0xb3ed('0x58'))][(_0xb3ed('0x59'))](_0xb3ed('0x5a'));}if(_0x55d28d[_0xb3ed('0x5b')]){return _0x1b7839['download'](_0x1e0e90,_0x55d28d[_0xb3ed('0x5b')]+path['extname'](_0x1e0e90),function(){if(_0x1af27f){fs[_0xb3ed('0x5c')](_0x1e0e90);}});}else{return _0x1b7839[_0xb3ed('0x50')](_0x1e0e90,function(_0x4a99ef){if(_0x1af27f){fs[_0xb3ed('0x5c')](_0x1e0e90);}});}}})[_0xb3ed('0x47')](function(_0x14ce36){if(_0x14ce36[_0xb3ed('0x5d')]===_0xb3ed('0x5a')){_0x1b7839[_0xb3ed('0x1d')](0x194)[_0xb3ed('0x2d')](_0xb3ed('0x5e'));}else{return handleError(_0x1b7839,null);}});};exports[_0xb3ed('0x5f')]=function(_0x2981b3,_0x199639,_0x3b71fe){var _0x19ec08=require(_0xb3ed('0x51'));var _0x1f3b12=![];var _0x41a7a8={'$and':[db[_0xb3ed('0x60')]['where'](db[_0xb3ed('0x60')]['fn']('MD5',db[_0xb3ed('0x60')][_0xb3ed('0x61')](_0xb3ed('0x52'))),_0x2981b3[_0xb3ed('0x34')][_0xb3ed('0x62')])]};if(_0x2981b3[_0xb3ed('0x34')][_0xb3ed('0x40')]&&_0x2981b3['query'][_0xb3ed('0x40')]==='uniqueid'){_0x41a7a8['$and'][_0xb3ed('0x63')]({'uniqueid':_0x2981b3[_0xb3ed('0x4e')]['id']});}else{_0x41a7a8[_0xb3ed('0x64')][_0xb3ed('0x63')]({'id':_0x2981b3[_0xb3ed('0x4e')]['id']});}return db[_0xb3ed('0x45')][_0xb3ed('0x4a')]({'where':_0x41a7a8,'attributes':['id',_0xb3ed('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x199639,null))[_0xb3ed('0x29')](function(_0x5178d5){if(_0x5178d5){var _0x514405=util[_0xb3ed('0x54')]('%s.cypher',_0x5178d5[_0xb3ed('0x53')]);if(fs[_0xb3ed('0x56')](_0x514405)){_0x1f3b12=!![];return _0x19ec08[_0xb3ed('0x65')](_0x514405,_0x5178d5['value'],config['secrets'][_0xb3ed('0x57')])[_0xb3ed('0x29')](function(){return _0x5178d5;});}return _0x5178d5;}})[_0xb3ed('0x29')](function(_0x472b9c){if(_0x472b9c){if(!fs['existsSync'](_0x472b9c[_0xb3ed('0x53')])){throw new db[(_0xb3ed('0x58'))]['ValidationError'](_0xb3ed('0x5a'));}if(_0x472b9c[_0xb3ed('0x5b')]){return _0x199639['download'](_0x472b9c[_0xb3ed('0x53')],_0x472b9c[_0xb3ed('0x5b')]+path['extname'](_0x472b9c['value']),function(){if(_0x1f3b12){fs[_0xb3ed('0x5c')](_0x472b9c[_0xb3ed('0x53')]);}});}else{return _0x199639['download'](_0x472b9c[_0xb3ed('0x53')],function(_0x5c8c9f){if(_0x1f3b12){fs[_0xb3ed('0x5c')](_0x472b9c[_0xb3ed('0x53')]);}});}}})[_0xb3ed('0x47')](handleError(_0x199639,null));};exports[_0xb3ed('0x28')]=function(_0x57044d,_0x5e3999){return db[_0xb3ed('0x45')]['find']({'where':{'id':_0x57044d[_0xb3ed('0x4e')]['id']}})['then'](function(_0x55d311){if(_['isNil'](_0x55d311)){throw new ReferenceError(_0xb3ed('0x66'));}return _0x55d311;})[_0xb3ed('0x29')](function(_0x133fd7){var _0x37bc16=_0x133fd7[_0xb3ed('0x53')];logger[_0xb3ed('0x67')](_0xb3ed('0x68'),_0x37bc16);if(!_[_0xb3ed('0x69')](_0x133fd7[_0xb3ed('0x53')])&&fs[_0xb3ed('0x56')](_0x37bc16)){logger[_0xb3ed('0x67')]('File:\x20\x22'+_0x37bc16+_0xb3ed('0x6a'));fs[_0xb3ed('0x6b')](_0x37bc16);}_0x37bc16=_0x37bc16+_0xb3ed('0x6c');if(!_[_0xb3ed('0x69')](_0x133fd7[_0xb3ed('0x53')])&&fs[_0xb3ed('0x56')](_0x37bc16)){logger[_0xb3ed('0x67')]('File:\x20\x22'+_0x37bc16+_0xb3ed('0x6a'));fs[_0xb3ed('0x6b')](_0x37bc16);}return _0x133fd7;})['then'](function(_0x16e7e2){if(!_0x16e7e2)throw new InternalError();return _0x16e7e2[_0xb3ed('0x28')]();})['then'](function(){_0x5e3999[_0xb3ed('0x1d')](0xcc)[_0xb3ed('0x1e')]();})[_0xb3ed('0x47')](handleError(_0x5e3999,null));};function getBucketslist(_0xcc71da,_0x514f64,_0x3ac7c9){return new Promise(function(_0x15ade8,_0x2e89a4){var _0x461867=new AWS['S3']({'accessKeyId':_0x514f64,'secretAccessKey':_0xcc71da,'region':_0x3ac7c9});_0x461867[_0xb3ed('0x6d')]({},function(_0x50267e,_0x3d860e){if(_0x50267e){return _0x2e89a4(_0x50267e);}else{return _0x15ade8(_0x3d860e);}});});}function createBucket(_0x51ab55,_0x1c9c56,_0x579888,_0x9b67fc){return new Promise(function(_0x2d87c5,_0x2dc0a9){var _0x15a834=new AWS['S3']({'accessKeyId':_0x1c9c56,'secretAccessKey':_0x51ab55,'region':_0x579888});_0x15a834[_0xb3ed('0x6e')]({'Bucket':_0x9b67fc},function(_0x118352,_0x143eb6){if(_0x118352){return _0x2dc0a9(_0x118352);}else{return _0x2d87c5(_0x143eb6);}});});}function uploadFile(_0x5bf6b7,_0x5989e6,_0x4d6399,_0x142171,_0x443460,_0x24ae1d){return new Promise(function(_0x40d8ba,_0xebd0ad){var _0x58481f=new AWS['S3']({'accessKeyId':_0x5989e6,'secretAccessKey':_0x5bf6b7,'region':_0x4d6399});_0x58481f[_0xb3ed('0x6f')]({'Bucket':_0x142171,'Key':_0x443460,'Body':_0x24ae1d},function(_0x1d1e29,_0x44b5c9){if(_0x1d1e29){return _0xebd0ad(_0x1d1e29);}else{return _0x40d8ba(_0x44b5c9);}});});}function startTranscribe(_0x324b89,_0x3d08da,_0x3e980b,_0x50e4d6,_0x241097,_0x1d2dcd){return new Promise(function(_0x1daaa2,_0x4f7c13){var _0x575e28=new AWS[(_0xb3ed('0x70'))]({'accessKeyId':_0x3d08da,'secretAccessKey':_0x324b89,'region':_0x3e980b});_0x575e28[_0xb3ed('0x71')]({'TranscriptionJobName':_0x50e4d6,'LanguageCode':_0x241097,'Media':{'MediaFileUri':_0x1d2dcd}},function(_0x4237b7,_0x260b11){if(_0x4237b7){return _0x4f7c13(_0x4237b7);}else{return _0x1daaa2(_0x260b11);}});});}function transcribe(_0x21b8d3,_0x2f3444,_0x4dcd25,_0x6f92a8,_0x50f380,_0x513a55,_0x1b52c9){return new Promise(function(_0x3f7024,_0x2676c8){var _0x17c099={};logger[_0xb3ed('0x67')](util['format'](_0xb3ed('0x72'),_0x21b8d3,_0x50f380));return uploadFile(_0x2f3444,_0x4dcd25,_0x6f92a8,_0x50f380,path[_0xb3ed('0x73')](_0x513a55),fs[_0xb3ed('0x74')](_0x513a55))['then'](function(_0x29932f){logger[_0xb3ed('0x67')](util[_0xb3ed('0x54')](_0xb3ed('0x75'),_0x21b8d3,_0x50f380,_0x29932f['Location']));_0x17c099[_0xb3ed('0x76')]=_0x29932f[_0xb3ed('0x77')];_0x17c099['location']=_0x29932f[_0xb3ed('0x78')];logger[_0xb3ed('0x67')](util['format'](_0xb3ed('0x79'),_0x21b8d3));return startTranscribe(_0x2f3444,_0x4dcd25,_0x6f92a8,uuidv4(),_0x1b52c9,_0x29932f[_0xb3ed('0x78')]);})[_0xb3ed('0x29')](function(_0x403fe7){logger[_0xb3ed('0x67')](util[_0xb3ed('0x54')](_0xb3ed('0x7a'),_0x21b8d3,_0x403fe7[_0xb3ed('0x7b')][_0xb3ed('0x7c')]));_0x17c099[_0xb3ed('0x7d')]=_0x403fe7[_0xb3ed('0x7b')][_0xb3ed('0x7c')];_0x17c099[_0xb3ed('0x7e')]=_0x403fe7[_0xb3ed('0x7b')][_0xb3ed('0x7f')];return _0x3f7024(_0x17c099);})['catch'](function(_0x32f19a){return _0x2676c8(_0x32f19a);});});}exports['runTranscribe']=function(_0x4d00d0,_0x2bb6f2,_0x154ea3){var _0x59e115;var _0x315ebe;var _0x442b0a;var _0x5d158e=require(_0xb3ed('0x51'));return db[_0xb3ed('0x45')][_0xb3ed('0x80')]({'where':{'id':_0x4d00d0[_0xb3ed('0x4e')]['id']}})['then'](function(_0x4cffdf){if(_0x4cffdf){var _0x15e3b6=util[_0xb3ed('0x54')](_0xb3ed('0x55'),_0x4cffdf['value']);if(fs[_0xb3ed('0x56')](_0x15e3b6)){cypher=!![];return _0x5d158e[_0xb3ed('0x65')](_0x15e3b6,_0x4cffdf['value'],config[_0xb3ed('0x81')][_0xb3ed('0x57')])[_0xb3ed('0x29')](function(){return _0x4cffdf;});}return _0x4cffdf;}})['then'](function(_0x40ef94){if(!_0x40ef94){throw new db['Sequelize'][(_0xb3ed('0x59'))](_0xb3ed('0x82'));}_0x315ebe=_0x40ef94;return db['Setting'][_0xb3ed('0x80')]({'where':{'id':0x1}});})[_0xb3ed('0x29')](handleEntityNotFound(_0x2bb6f2,null))[_0xb3ed('0x29')](function(_0xb29ef1){if(_0xb29ef1){_0x59e115=_0xb29ef1;if(!_0x59e115['transcribe']||!_0x59e115[_0xb3ed('0x83')]||!_0x59e115['transcribeRegion']||!_0x59e115['language']||!_0x59e115[_0xb3ed('0x76')]){throw new db['Sequelize']['ValidationError'](_0xb3ed('0x84'));}if(_0x4d00d0[_0xb3ed('0x4c')][_0xb3ed('0x85')]&&(!_0x59e115['sentiment']||!_0x59e115[_0xb3ed('0x86')]||!_0x59e115[_0xb3ed('0x87')]||!_0x59e115[_0xb3ed('0x88')]||!_0x59e115[_0xb3ed('0x76')])){throw new db['Sequelize'][(_0xb3ed('0x59'))](_0xb3ed('0x89'));}return db[_0xb3ed('0x8a')][_0xb3ed('0x80')]({'where':{'id':_0x59e115[_0xb3ed('0x83')]}});}})[_0xb3ed('0x29')](function(_0x504928){if(!_0x504928){throw new db['Sequelize'][(_0xb3ed('0x59'))](_0xb3ed('0x8b'));}if(!_0x504928[_0xb3ed('0x8c')]||!_0x504928[_0xb3ed('0x8d')]){throw new db['Sequelize'][(_0xb3ed('0x59'))](_0xb3ed('0x8e'));}_0x442b0a=_0x504928;return getBucketslist(_0x442b0a[_0xb3ed('0x8c')],_0x442b0a[_0xb3ed('0x8d')],_0x59e115[_0xb3ed('0x8f')]);})[_0xb3ed('0x29')](function(_0x98ff71){if(_0x98ff71&&_0x98ff71['Buckets']){var _0x13d6c2=_[_0xb3ed('0x4a')](_0x98ff71['Buckets'],function(_0x222726){return _0x222726['Name']===_0x59e115[_0xb3ed('0x76')];});if(!_0x13d6c2){logger[_0xb3ed('0x67')](util[_0xb3ed('0x54')](_0xb3ed('0x90'),_0x4d00d0[_0xb3ed('0x4e')]['id'],_0x59e115[_0xb3ed('0x76')]));return createBucket(_0x442b0a[_0xb3ed('0x8c')],_0x442b0a[_0xb3ed('0x8d')],_0x59e115[_0xb3ed('0x8f')],_0x59e115[_0xb3ed('0x76')]);}logger['info'](util[_0xb3ed('0x54')](_0xb3ed('0x91'),_0x4d00d0[_0xb3ed('0x4e')]['id'],_0x59e115[_0xb3ed('0x76')]));return;}})[_0xb3ed('0x29')](function(_0x250418){if(_0x315ebe[_0xb3ed('0x7e')]==='NEW'){return transcribe(_0x4d00d0['params']['id'],_0x442b0a[_0xb3ed('0x8c')],_0x442b0a[_0xb3ed('0x8d')],_0x59e115['transcribeRegion'],_0x59e115[_0xb3ed('0x76')],_0x315ebe['value'],_0x59e115[_0xb3ed('0x88')]);}else{logger[_0xb3ed('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4d00d0[_0xb3ed('0x4e')]['id']));return{'transcribeStatus':_0xb3ed('0x92')};}})[_0xb3ed('0x29')](function(_0x9e7052){if(_0x9e7052){_0x9e7052[_0xb3ed('0x93')]=_0x4d00d0[_0xb3ed('0x4c')][_0xb3ed('0x85')];return _0x315ebe[_0xb3ed('0x94')](_0x9e7052);}})[_0xb3ed('0x29')](respondWithResult(_0x2bb6f2,null))[_0xb3ed('0x47')](handleError(_0x2bb6f2,null));};function writeFile(_0x27964e,_0x22dd90){return new Promise(function(_0x2d0000,_0x2dfb01){fs['writeFile'](_0x22dd90,_0x27964e,function(_0x11c58a,_0x17d9cd){if(_0x11c58a){return _0x2dfb01(_0x11c58a);}else{return _0x2d0000(_0x17d9cd);}});});}exports[_0xb3ed('0x95')]=function(_0x4ef9d6,_0x105145,_0x8593f){return db[_0xb3ed('0x45')][_0xb3ed('0x80')]({'where':{'id':_0x4ef9d6['params']['id']}})[_0xb3ed('0x29')](handleEntityNotFound(_0x105145))['then'](function(_0x481e6c){if(_0x481e6c&&_0x481e6c[_0xb3ed('0x96')]){var _0x2a6be7=_0x481e6c[_0xb3ed('0x96')];var _0x4414cc=config['root']+_0xb3ed('0x97')+_0x481e6c['id']+_0xb3ed('0x98');if(fs[_0xb3ed('0x56')](_0x4414cc)){return _0x4414cc;}return writeFile(_0x2a6be7,_0x4414cc)[_0xb3ed('0x29')](function(){return _0x4414cc;});}else{throw new db['Sequelize'][(_0xb3ed('0x59'))](_0xb3ed('0x99'));}})[_0xb3ed('0x29')](function(_0x229578){return _0x105145[_0xb3ed('0x50')](_0x229578);})[_0xb3ed('0x47')](handleError(_0x105145));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 9d7af0d..26f20e3 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 _0x44d4=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording'];(function(_0x55b627,_0x130b9f){var _0x5a78e2=function(_0x18ed10){while(--_0x18ed10){_0x55b627['push'](_0x55b627['shift']());}};_0x5a78e2(++_0x130b9f);}(_0x44d4,0x161));var _0x444d=function(_0x134999,_0x4de0c9){_0x134999=_0x134999-0x0;var _0x46e471=_0x44d4[_0x134999];return _0x46e471;};'use strict';var attributes=require(_0x444d('0x0'));module['exports']=function(_0x530741,_0x5c12f3){return _0x530741[_0x444d('0x1')](_0x444d('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']},{'name':_0x444d('0x3'),'fields':[_0x444d('0x3')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1666=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1666,0x75));var _0x6166=function(_0x38d923,_0x46b8ff){_0x38d923=_0x38d923-0x0;var _0x3e9d67=_0x1666[_0x38d923];return _0x3e9d67;};'use strict';var attributes=require(_0x6166('0x0'));module[_0x6166('0x1')]=function(_0x4f60ad,_0x18af67){return _0x4f60ad[_0x6166('0x2')](_0x6166('0x3'),attributes,{'tableName':_0x6166('0x4'),'paranoid':![],'indexes':[{'name':_0x6166('0x5'),'fields':[_0x6166('0x5')]},{'name':_0x6166('0x6'),'fields':[_0x6166('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 71c8b10..406f7e9 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 _0xe3da=['CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceRecording','update','body','options','where','attributes','limit','then','UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','unlink'];(function(_0x2158f9,_0x50e07d){var _0x1531c1=function(_0x5cb08a){while(--_0x5cb08a){_0x2158f9['push'](_0x2158f9['shift']());}};_0x1531c1(++_0x50e07d);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['UpdateVoiceRecording']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')](_0x3f8cf9[_0xae3d('0x1a')],{'raw':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9[_0xae3d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9['options'][_0xae3d('0x1c')]||null:null,'attributes':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9[_0xae3d('0x1b')][_0xae3d('0x1d')]||null:null,'limit':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9[_0xae3d('0x1b')][_0xae3d('0x1e')]||null:null})[_0xae3d('0x1f')](function(_0x3224ff){logger[_0xae3d('0xe')](_0xae3d('0x20'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x20'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x3224ff));_0x558e42(_0x3224ff);})[_0xae3d('0x21')](function(_0x1fe90f){logger[_0xae3d('0x14')](_0xae3d('0x20'),_0x1fe90f[_0xae3d('0x16')],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x1fe90f['message']));});});};exports[_0xae3d('0x22')]=function(_0x185e71){var _0xb5940=this;return new Promise(function(_0x52df0f,_0x256bd0){var _0x4391db=require(_0xae3d('0x23'));var _0x54c1e1;return db['Setting'][_0xae3d('0x24')]({'attributes':['id',_0xae3d('0x25')],'where':{'id':0x1},'raw':!![]})[_0xae3d('0x1f')](function(_0x3114f9){_0x54c1e1=_0x3114f9;return db[_0xae3d('0x18')]['create'](_0x185e71[_0xae3d('0x1a')]);})[_0xae3d('0x1f')](function(_0x5a39c5){if(_0x54c1e1[_0xae3d('0x25')]&&fs[_0xae3d('0x26')](_0x5a39c5[_0xae3d('0x27')])){var _0x46f484=util[_0xae3d('0x28')](_0xae3d('0x29'),_0x5a39c5['value']);return _0x4391db['encryptFile'](_0x5a39c5['value'],_0x46f484,config[_0xae3d('0x2a')][_0xae3d('0x2b')])[_0xae3d('0x1f')](function(){fs[_0xae3d('0x2c')](_0x5a39c5['value']);logger[_0xae3d('0xe')](_0xae3d('0x2d'));return _0x5a39c5;});}return _0x5a39c5;})[_0xae3d('0x1f')](function(_0x3748d2){logger[_0xae3d('0xe')](_0xae3d('0x22'),_0x185e71);logger[_0xae3d('0x11')]('CreateVoiceRecording',_0x185e71,JSON[_0xae3d('0x13')](_0x3748d2));_0x52df0f(_0x3748d2);})['catch'](function(_0x55aae4){logger[_0xae3d('0x14')]('CreateVoiceRecording',_0x55aae4[_0xae3d('0x16')],_0x185e71);_0x256bd0(_0xb5940['error'](0x1f4,_0x55aae4['message']));});});}; \ No newline at end of file +var _0x57ca=['update','body','options','where','limit','then','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption','create','value','format','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording'];(function(_0x3be714,_0x38e9f4){var _0xcf112e=function(_0x15d9c2){while(--_0x15d9c2){_0x3be714['push'](_0x3be714['shift']());}};_0xcf112e(++_0x38e9f4);}(_0x57ca,0x108));var _0xa57c=function(_0x10d76c,_0x4c8135){_0x10d76c=_0x10d76c-0x0;var _0x415d3d=_0x57ca[_0x10d76c];return _0x415d3d;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});}exports[_0xa57c('0x15')]=function(_0x3d781d){var _0x93462c=this;return new Promise(function(_0xe3d505,_0x1fd0d8){return db[_0xa57c('0x16')][_0xa57c('0x17')](_0x3d781d[_0xa57c('0x18')],{'raw':_0x3d781d['options']?_0x3d781d[_0xa57c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d781d['options']?_0x3d781d[_0xa57c('0x19')][_0xa57c('0x1a')]||null:null,'attributes':_0x3d781d[_0xa57c('0x19')]?_0x3d781d[_0xa57c('0x19')]['attributes']||null:null,'limit':_0x3d781d[_0xa57c('0x19')]?_0x3d781d[_0xa57c('0x19')][_0xa57c('0x1b')]||null:null})[_0xa57c('0x1c')](function(_0x3bb969){logger[_0xa57c('0xc')](_0xa57c('0x15'),_0x3d781d);logger[_0xa57c('0x1d')](_0xa57c('0x15'),_0x3d781d,JSON[_0xa57c('0x1e')](_0x3bb969));_0xe3d505(_0x3bb969);})[_0xa57c('0x14')](function(_0x1e7f7a){logger[_0xa57c('0xf')](_0xa57c('0x15'),_0x1e7f7a[_0xa57c('0x12')],_0x3d781d);_0x1fd0d8(_0x93462c['error'](0x1f4,_0x1e7f7a[_0xa57c('0x12')]));});});};exports[_0xa57c('0x1f')]=function(_0x27884d){var _0x5228b9=this;return new Promise(function(_0x315ad7,_0x1e8e45){var _0x8ee1c0=require(_0xa57c('0x20'));var _0x337f97;return db[_0xa57c('0x21')]['findOne']({'attributes':['id',_0xa57c('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x54a18b){_0x337f97=_0x54a18b;return db[_0xa57c('0x16')][_0xa57c('0x23')](_0x27884d['body']);})[_0xa57c('0x1c')](function(_0x1ef331){if(_0x337f97[_0xa57c('0x22')]&&fs['existsSync'](_0x1ef331[_0xa57c('0x24')])){var _0x58d46f=util[_0xa57c('0x25')]('%s.cypher',_0x1ef331[_0xa57c('0x24')]);return _0x8ee1c0['encryptFile'](_0x1ef331[_0xa57c('0x24')],_0x58d46f,config['secrets'][_0xa57c('0x26')])[_0xa57c('0x1c')](function(){fs[_0xa57c('0x27')](_0x1ef331[_0xa57c('0x24')]);logger[_0xa57c('0xc')](_0xa57c('0x28'));return _0x1ef331;});}return _0x1ef331;})[_0xa57c('0x1c')](function(_0x5aa91e){logger[_0xa57c('0xc')]('CreateVoiceRecording',_0x27884d);logger[_0xa57c('0x1d')](_0xa57c('0x1f'),_0x27884d,JSON[_0xa57c('0x1e')](_0x5aa91e));_0x315ad7(_0x5aa91e);})['catch'](function(_0x289174){logger['error'](_0xa57c('0x1f'),_0x289174['message'],_0x27884d);_0x1e8e45(_0x5228b9[_0xa57c('0xf')](0x1f4,_0x289174['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index fac2eee..decf589 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 _0x961a=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceTransferReport.controller','get','index','isAuthenticated','describe','show','post','put','/:id'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x961a,0x130));var _0xa961=function(_0x2dc5d4,_0x393edc){_0x2dc5d4=_0x2dc5d4-0x0;var _0x39ae40=_0x961a[_0x2dc5d4];return _0x39ae40;};'use strict';var multer=require(_0xa961('0x0'));var util=require(_0xa961('0x1'));var path=require(_0xa961('0x2'));var timeout=require(_0xa961('0x3'));var express=require(_0xa961('0x4'));var router=express[_0xa961('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa961('0x6'));var config=require('../../config/environment');var controller=require(_0xa961('0x7'));router[_0xa961('0x8')]('/',auth['isAuthenticated'](),controller[_0xa961('0x9')]);router[_0xa961('0x8')]('/describe',auth[_0xa961('0xa')](),controller[_0xa961('0xb')]);router[_0xa961('0x8')]('/:id',auth[_0xa961('0xa')](),controller[_0xa961('0xc')]);router[_0xa961('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa961('0xe')](_0xa961('0xf'),auth['isAuthenticated'](),controller[_0xa961('0x10')]);router[_0xa961('0x11')](_0xa961('0xf'),auth[_0xa961('0xa')](),controller[_0xa961('0x12')]);module[_0xa961('0x13')]=router; \ No newline at end of file +var _0x4cd2=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','put','update','delete'];(function(_0x37df93,_0x2a2efb){var _0x37be54=function(_0x573856){while(--_0x573856){_0x37df93['push'](_0x37df93['shift']());}};_0x37be54(++_0x2a2efb);}(_0x4cd2,0x91));var _0x24cd=function(_0x21848b,_0x59f2dd){_0x21848b=_0x21848b-0x0;var _0x3e67b8=_0x4cd2[_0x21848b];return _0x3e67b8;};'use strict';var multer=require(_0x24cd('0x0'));var util=require(_0x24cd('0x1'));var path=require('path');var timeout=require(_0x24cd('0x2'));var express=require(_0x24cd('0x3'));var router=express[_0x24cd('0x4')]();var fs_extra=require(_0x24cd('0x5'));var auth=require(_0x24cd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x24cd('0x7'));router[_0x24cd('0x8')]('/',auth[_0x24cd('0x9')](),controller[_0x24cd('0xa')]);router[_0x24cd('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x24cd('0xb')]);router[_0x24cd('0x8')](_0x24cd('0xc'),auth[_0x24cd('0x9')](),controller['show']);router[_0x24cd('0xd')]('/',auth[_0x24cd('0x9')](),controller['create']);router[_0x24cd('0xe')](_0x24cd('0xc'),auth[_0x24cd('0x9')](),controller[_0x24cd('0xf')]);router[_0x24cd('0x10')](_0x24cd('0xc'),auth[_0x24cd('0x9')](),controller['destroy']);module[_0x24cd('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 48d69af..7465122 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 _0x4e0e=['ENUM','blind','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x3b2587,_0x30c20b){var _0x24e5dd=function(_0x3d6587){while(--_0x3d6587){_0x3b2587['push'](_0x3b2587['shift']());}};_0x24e5dd(++_0x30c20b);}(_0x4e0e,0x85));var _0xe4e0=function(_0x13e1d2,_0x3abed9){_0x13e1d2=_0x13e1d2-0x0;var _0x7cfe9=_0x4e0e[_0x13e1d2];return _0x7cfe9;};'use strict';var Sequelize=require(_0xe4e0('0x0'));var moment=require(_0xe4e0('0x1'));module[_0xe4e0('0x2')]={'type':{'type':Sequelize[_0xe4e0('0x3')](_0xe4e0('0x4'),_0xe4e0('0x5'))},'result':{'type':Sequelize[_0xe4e0('0x6')]},'transfererchannel':{'type':Sequelize[_0xe4e0('0x6')]},'transferercalleridnum':{'type':Sequelize[_0xe4e0('0x6')]},'transferercalleridname':{'type':Sequelize[_0xe4e0('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe4e0('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xe4e0('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xe4e0('0x6')]},'transferercontext':{'type':Sequelize[_0xe4e0('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xe4e0('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xe4e0('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe4e0('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xe4e0('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xe4e0('0x6')]},'isexternal':{'type':Sequelize[_0xe4e0('0x3')](_0xe4e0('0x7'),'No')},'context':{'type':Sequelize[_0xe4e0('0x6')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x70be=['ENUM','blind','STRING','Yes','sequelize','moment','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x70be,0x154));var _0xe70b=function(_0x360090,_0x42ecc0){_0x360090=_0x360090-0x0;var _0x2a7eb7=_0x70be[_0x360090];return _0x2a7eb7;};'use strict';var Sequelize=require(_0xe70b('0x0'));var moment=require(_0xe70b('0x1'));module[_0xe70b('0x2')]={'type':{'type':Sequelize[_0xe70b('0x3')](_0xe70b('0x4'),'attended')},'result':{'type':Sequelize[_0xe70b('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xe70b('0x5')]},'transferercalleridname':{'type':Sequelize[_0xe70b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xe70b('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xe70b('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xe70b('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xe70b('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xe70b('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe70b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe70b('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xe70b('0x5')]},'transfereecontext':{'type':Sequelize[_0xe70b('0x5')]},'transfereeexten':{'type':Sequelize[_0xe70b('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0xe70b('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe70b('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ac351be..dcb945d 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 _0x548f=['key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','update','destroy','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type'];(function(_0x1d8a15,_0x4acbca){var _0x17b14b=function(_0x52c9e9){while(--_0x52c9e9){_0x1d8a15['push'](_0x1d8a15['shift']());}};_0x17b14b(++_0x4acbca);}(_0x548f,0xf6));var _0xf548=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x548f[_0x2235bf];return _0x4c3a64;};'use strict';var emlformat=require(_0xf548('0x0'));var rimraf=require(_0xf548('0x1'));var zipdir=require(_0xf548('0x2'));var jsonpatch=require(_0xf548('0x3'));var rp=require(_0xf548('0x4'));var moment=require(_0xf548('0x5'));var BPromise=require(_0xf548('0x6'));var Mustache=require(_0xf548('0x7'));var util=require(_0xf548('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf548('0x9'));var fs=require('fs');var fs_extra=require(_0xf548('0xa'));var _=require(_0xf548('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf548('0xc'));var toCsv=require(_0xf548('0xd'));var querystring=require(_0xf548('0xe'));var Papa=require(_0xf548('0xf'));var Redis=require(_0xf548('0x10'));var authService=require(_0xf548('0x11'));var qs=require(_0xf548('0x12'));var as=require(_0xf548('0x13'));var hardwareService=require(_0xf548('0x14'));var logger=require(_0xf548('0x15'))(_0xf548('0x16'));var utils=require(_0xf548('0x17'));var config=require(_0xf548('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cb6f6,_0x283c4e){_0x283c4e=_0x283c4e||0xcc;return function(_0x4f4962){if(_0x4f4962){return _0x5cb6f6[_0xf548('0x19')](_0x283c4e);}return _0x5cb6f6[_0xf548('0x1a')](_0x283c4e)[_0xf548('0x1b')]();};}function respondWithResult(_0x38abc9,_0x22d1e6){_0x22d1e6=_0x22d1e6||0xc8;return function(_0x67ccf6){if(_0x67ccf6){return _0x38abc9[_0xf548('0x1a')](_0x22d1e6)['json'](_0x67ccf6);}};}function respondWithFilteredResult(_0x1769ca,_0x48a162){return function(_0x3caf2c){if(_0x3caf2c){var _0xb42a03=typeof _0x48a162[_0xf548('0x1c')]==='undefined'&&typeof _0x48a162[_0xf548('0x1d')]===_0xf548('0x1e');var _0x55ef2e=_0x3caf2c[_0xf548('0x1f')];var _0xde09fe=_0xb42a03?0x0:_0x48a162[_0xf548('0x1c')];var _0x5d5049=_0xb42a03?_0x3caf2c[_0xf548('0x1f')]:_0x48a162[_0xf548('0x1c')]+_0x48a162['limit'];var _0x1e27b7;if(_0x5d5049>=_0x55ef2e){_0x5d5049=_0x55ef2e;_0x1e27b7=0xc8;}else{_0x1e27b7=0xce;}_0x1769ca[_0xf548('0x1a')](_0x1e27b7);return _0x1769ca['set'](_0xf548('0x20'),_0xde09fe+'-'+_0x5d5049+'/'+_0x55ef2e)['json'](_0x3caf2c);}return null;};}function patchUpdates(_0x5f3ea3){return function(_0x5eaa5a){try{jsonpatch[_0xf548('0x21')](_0x5eaa5a,_0x5f3ea3,!![]);}catch(_0xf26e56){return BPromise['reject'](_0xf26e56);}return _0x5eaa5a['save']();};}function saveUpdates(_0x42ce3f,_0x106c05){return function(_0x15a01c){if(_0x15a01c){return _0x15a01c[_0xf548('0x22')](_0x42ce3f)['then'](function(_0x22a74c){return _0x22a74c;});}return null;};}function removeEntity(_0x49eefd,_0x2dc664){return function(_0x30b88a){if(_0x30b88a){return _0x30b88a[_0xf548('0x23')]()[_0xf548('0x24')](function(){_0x49eefd['status'](0xcc)[_0xf548('0x1b')]();});}};}function handleEntityNotFound(_0x4e56d0,_0xbc09c8){return function(_0x2b1bf8){if(!_0x2b1bf8){_0x4e56d0['sendStatus'](0x194);}return _0x2b1bf8;};}function handleError(_0x38a868,_0x29e349){_0x29e349=_0x29e349||0x1f4;return function(_0x37819e){logger[_0xf548('0x25')](_0x37819e[_0xf548('0x26')]);if(_0x37819e['name']){delete _0x37819e[_0xf548('0x27')];}_0x38a868[_0xf548('0x1a')](_0x29e349)['send'](_0x37819e);};}exports[_0xf548('0x28')]=function(_0x2e77dd,_0x31e44a){var _0x219e30={},_0x565ac0={},_0x59569e={'count':0x0,'rows':[]};var _0x5cbf2b=_[_0xf548('0x29')](db[_0xf548('0x2a')][_0xf548('0x2b')],function(_0x312c96){return{'name':_0x312c96[_0xf548('0x2c')],'type':_0x312c96[_0xf548('0x2d')][_0xf548('0x2e')]};});_0x565ac0[_0xf548('0x2f')]=_[_0xf548('0x29')](_0x5cbf2b,_0xf548('0x27'));_0x565ac0['query']=_[_0xf548('0x30')](_0x2e77dd[_0xf548('0x31')]);_0x565ac0[_0xf548('0x32')]=_[_0xf548('0x33')](_0x565ac0[_0xf548('0x2f')],_0x565ac0[_0xf548('0x31')]);_0x219e30[_0xf548('0x34')]=_[_0xf548('0x33')](_0x565ac0[_0xf548('0x2f')],qs['fields'](_0x2e77dd[_0xf548('0x31')][_0xf548('0x35')]));_0x219e30['attributes']=_0x219e30[_0xf548('0x34')][_0xf548('0x36')]?_0x219e30[_0xf548('0x34')]:_0x565ac0[_0xf548('0x2f')];if(!_0x2e77dd['query']['hasOwnProperty'](_0xf548('0x37'))){_0x219e30[_0xf548('0x1d')]=qs[_0xf548('0x1d')](_0x2e77dd['query'][_0xf548('0x1d')]);_0x219e30['offset']=qs['offset'](_0x2e77dd[_0xf548('0x31')][_0xf548('0x1c')]);}_0x219e30[_0xf548('0x38')]=qs[_0xf548('0x39')](_0x2e77dd[_0xf548('0x31')][_0xf548('0x39')]);_0x219e30[_0xf548('0x3a')]=qs['filters'](_[_0xf548('0x3b')](_0x2e77dd['query'],_0x565ac0[_0xf548('0x32')]),_0x5cbf2b);if(_0x2e77dd[_0xf548('0x31')][_0xf548('0x3c')]){_0x219e30[_0xf548('0x3a')]=_['merge'](_0x219e30[_0xf548('0x3a')],{'$or':_['map'](_0x5cbf2b,function(_0x496db5){if(_0x496db5[_0xf548('0x2d')]!=='VIRTUAL'){var _0x4f7ea4={};_0x4f7ea4[_0x496db5[_0xf548('0x27')]]={'$like':'%'+_0x2e77dd['query']['filter']+'%'};return _0x4f7ea4;}})});}_0x219e30=_[_0xf548('0x3d')]({},_0x219e30,_0x2e77dd[_0xf548('0x3e')]);var _0x29c64d={'where':_0x219e30[_0xf548('0x3a')]};return db['VoiceTransferReport'][_0xf548('0x1f')](_0x29c64d)[_0xf548('0x24')](function(_0x127dfd){_0x59569e['count']=_0x127dfd;if(_0x2e77dd[_0xf548('0x31')][_0xf548('0x3f')]){_0x219e30[_0xf548('0x40')]=[{'all':!![]}];}return db[_0xf548('0x2a')][_0xf548('0x41')](_0x219e30);})[_0xf548('0x24')](function(_0x5ef790){_0x59569e[_0xf548('0x42')]=_0x5ef790;return _0x59569e;})[_0xf548('0x24')](respondWithFilteredResult(_0x31e44a,_0x219e30))['catch'](handleError(_0x31e44a,null));};exports['show']=function(_0x543739,_0x1dae68){var _0x4ca184={'raw':!![],'where':{'id':_0x543739['params']['id']}},_0x3d2884={};_0x3d2884[_0xf548('0x2f')]=_['keys'](db['VoiceTransferReport'][_0xf548('0x2b')]);_0x3d2884[_0xf548('0x31')]=_[_0xf548('0x30')](_0x543739['query']);_0x3d2884[_0xf548('0x32')]=_['intersection'](_0x3d2884[_0xf548('0x2f')],_0x3d2884['query']);_0x4ca184[_0xf548('0x34')]=_[_0xf548('0x33')](_0x3d2884[_0xf548('0x2f')],qs['fields'](_0x543739[_0xf548('0x31')][_0xf548('0x35')]));_0x4ca184[_0xf548('0x34')]=_0x4ca184['attributes'][_0xf548('0x36')]?_0x4ca184[_0xf548('0x34')]:_0x3d2884[_0xf548('0x2f')];if(_0x543739[_0xf548('0x31')][_0xf548('0x3f')]){_0x4ca184['include']=[{'all':!![]}];}_0x4ca184=_[_0xf548('0x3d')]({},_0x4ca184,_0x543739[_0xf548('0x3e')]);return db['VoiceTransferReport'][_0xf548('0x43')](_0x4ca184)[_0xf548('0x24')](handleEntityNotFound(_0x1dae68,null))['then'](respondWithResult(_0x1dae68,null))[_0xf548('0x44')](handleError(_0x1dae68,null));};exports[_0xf548('0x45')]=function(_0x36e080,_0x46b79d){return db[_0xf548('0x2a')][_0xf548('0x45')](_0x36e080[_0xf548('0x46')],{})[_0xf548('0x24')](respondWithResult(_0x46b79d,0xc9))[_0xf548('0x44')](handleError(_0x46b79d,null));};exports['update']=function(_0x26a77c,_0x4c4b4e){if(_0x26a77c[_0xf548('0x46')]['id']){delete _0x26a77c[_0xf548('0x46')]['id'];}return db[_0xf548('0x2a')][_0xf548('0x43')]({'where':{'id':_0x26a77c[_0xf548('0x47')]['id']}})[_0xf548('0x24')](handleEntityNotFound(_0x4c4b4e,null))[_0xf548('0x24')](saveUpdates(_0x26a77c[_0xf548('0x46')],null))[_0xf548('0x24')](respondWithResult(_0x4c4b4e,null))[_0xf548('0x44')](handleError(_0x4c4b4e,null));};exports[_0xf548('0x23')]=function(_0x8b0e50,_0x5043ed){return db[_0xf548('0x2a')][_0xf548('0x43')]({'where':{'id':_0x8b0e50[_0xf548('0x47')]['id']}})['then'](handleEntityNotFound(_0x5043ed,null))[_0xf548('0x24')](removeEntity(_0x5043ed,null))['catch'](handleError(_0x5043ed,null));};exports[_0xf548('0x48')]=function(_0x17fea7,_0x289522){return db[_0xf548('0x2a')]['describe']()[_0xf548('0x24')](respondWithResult(_0x289522,null))[_0xf548('0x44')](handleError(_0x289522,null));}; \ No newline at end of file +var _0x6c84=['model','map','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','VoiceTransferReport','then','include','findAll','rows','show','rawAttributes','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','error','stack','name','send','fieldName','type'];(function(_0x1abe50,_0x4e0b29){var _0x1ddd7f=function(_0x3dbcc8){while(--_0x3dbcc8){_0x1abe50['push'](_0x1abe50['shift']());}};_0x1ddd7f(++_0x4e0b29);}(_0x6c84,0xac));var _0x46c8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6c84[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0x46c8('0x0'));var rimraf=require(_0x46c8('0x1'));var zipdir=require(_0x46c8('0x2'));var jsonpatch=require(_0x46c8('0x3'));var rp=require(_0x46c8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x46c8('0x5'));var util=require('util');var path=require(_0x46c8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x46c8('0x7'));var fs=require('fs');var fs_extra=require(_0x46c8('0x8'));var _=require('lodash');var squel=require(_0x46c8('0x9'));var crypto=require('crypto');var jsforce=require(_0x46c8('0xa'));var deskjs=require(_0x46c8('0xb'));var toCsv=require(_0x46c8('0xc'));var querystring=require('querystring');var Papa=require(_0x46c8('0xd'));var Redis=require(_0x46c8('0xe'));var authService=require(_0x46c8('0xf'));var qs=require(_0x46c8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46c8('0x11'));var logger=require(_0x46c8('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x46c8('0x13'));var licenseUtil=require(_0x46c8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39f3b0,_0x564a8e){_0x564a8e=_0x564a8e||0xcc;return function(_0x451289){if(_0x451289){return _0x39f3b0[_0x46c8('0x15')](_0x564a8e);}return _0x39f3b0[_0x46c8('0x16')](_0x564a8e)[_0x46c8('0x17')]();};}function respondWithResult(_0x2a005f,_0x38915f){_0x38915f=_0x38915f||0xc8;return function(_0x1edbce){if(_0x1edbce){return _0x2a005f['status'](_0x38915f)[_0x46c8('0x18')](_0x1edbce);}};}function respondWithFilteredResult(_0x38cc4b,_0x1c150a){return function(_0x3e2b12){if(_0x3e2b12){var _0x2a9284=typeof _0x1c150a[_0x46c8('0x19')]==='undefined'&&typeof _0x1c150a[_0x46c8('0x1a')]===_0x46c8('0x1b');var _0x321113=_0x3e2b12[_0x46c8('0x1c')];var _0x35e728=_0x2a9284?0x0:_0x1c150a[_0x46c8('0x19')];var _0x3e6200=_0x2a9284?_0x3e2b12[_0x46c8('0x1c')]:_0x1c150a[_0x46c8('0x19')]+_0x1c150a['limit'];var _0xd83040;if(_0x3e6200>=_0x321113){_0x3e6200=_0x321113;_0xd83040=0xc8;}else{_0xd83040=0xce;}_0x38cc4b['status'](_0xd83040);return _0x38cc4b[_0x46c8('0x1d')](_0x46c8('0x1e'),_0x35e728+'-'+_0x3e6200+'/'+_0x321113)['json'](_0x3e2b12);}return null;};}function patchUpdates(_0x1ac617){return function(_0xcaed82){try{jsonpatch[_0x46c8('0x1f')](_0xcaed82,_0x1ac617,!![]);}catch(_0x1f50e8){return BPromise['reject'](_0x1f50e8);}return _0xcaed82[_0x46c8('0x20')]();};}function saveUpdates(_0x3de64e,_0x4485aa){return function(_0x44eaeb){if(_0x44eaeb){return _0x44eaeb[_0x46c8('0x21')](_0x3de64e)['then'](function(_0x1f58f3){return _0x1f58f3;});}return null;};}function removeEntity(_0x4fb1d2,_0x28c17b){return function(_0x1b2b13){if(_0x1b2b13){return _0x1b2b13[_0x46c8('0x22')]()['then'](function(){_0x4fb1d2[_0x46c8('0x16')](0xcc)[_0x46c8('0x17')]();});}};}function handleEntityNotFound(_0x5e3e36,_0x43a303){return function(_0x131b50){if(!_0x131b50){_0x5e3e36['sendStatus'](0x194);}return _0x131b50;};}function handleError(_0x5bd0ee,_0x565f4c){_0x565f4c=_0x565f4c||0x1f4;return function(_0x2ea7a7){logger[_0x46c8('0x23')](_0x2ea7a7[_0x46c8('0x24')]);if(_0x2ea7a7['name']){delete _0x2ea7a7[_0x46c8('0x25')];}_0x5bd0ee[_0x46c8('0x16')](_0x565f4c)[_0x46c8('0x26')](_0x2ea7a7);};}exports['index']=function(_0x156b89,_0x79c2bf){var _0x2b4e4f={},_0x4c84cd={},_0x523734={'count':0x0,'rows':[]};var _0x387108=_['map'](db['VoiceTransferReport']['rawAttributes'],function(_0x35095c){return{'name':_0x35095c[_0x46c8('0x27')],'type':_0x35095c[_0x46c8('0x28')]['key']};});_0x4c84cd[_0x46c8('0x29')]=_[_0x46c8('0x2a')](_0x387108,'name');_0x4c84cd[_0x46c8('0x2b')]=_[_0x46c8('0x2c')](_0x156b89['query']);_0x4c84cd['filters']=_[_0x46c8('0x2d')](_0x4c84cd['model'],_0x4c84cd[_0x46c8('0x2b')]);_0x2b4e4f[_0x46c8('0x2e')]=_['intersection'](_0x4c84cd['model'],qs[_0x46c8('0x2f')](_0x156b89[_0x46c8('0x2b')][_0x46c8('0x2f')]));_0x2b4e4f['attributes']=_0x2b4e4f[_0x46c8('0x2e')][_0x46c8('0x30')]?_0x2b4e4f[_0x46c8('0x2e')]:_0x4c84cd['model'];if(!_0x156b89[_0x46c8('0x2b')]['hasOwnProperty']('nolimit')){_0x2b4e4f[_0x46c8('0x1a')]=qs[_0x46c8('0x1a')](_0x156b89['query'][_0x46c8('0x1a')]);_0x2b4e4f[_0x46c8('0x19')]=qs['offset'](_0x156b89[_0x46c8('0x2b')]['offset']);}_0x2b4e4f[_0x46c8('0x31')]=qs[_0x46c8('0x32')](_0x156b89[_0x46c8('0x2b')][_0x46c8('0x32')]);_0x2b4e4f['where']=qs[_0x46c8('0x33')](_[_0x46c8('0x34')](_0x156b89['query'],_0x4c84cd[_0x46c8('0x33')]),_0x387108);if(_0x156b89[_0x46c8('0x2b')][_0x46c8('0x35')]){_0x2b4e4f[_0x46c8('0x36')]=_[_0x46c8('0x37')](_0x2b4e4f[_0x46c8('0x36')],{'$or':_[_0x46c8('0x2a')](_0x387108,function(_0xb0e7ac){if(_0xb0e7ac['type']!==_0x46c8('0x38')){var _0x3145b7={};_0x3145b7[_0xb0e7ac[_0x46c8('0x25')]]={'$like':'%'+_0x156b89['query'][_0x46c8('0x35')]+'%'};return _0x3145b7;}})});}_0x2b4e4f=_[_0x46c8('0x37')]({},_0x2b4e4f,_0x156b89[_0x46c8('0x39')]);var _0xe87fae={'where':_0x2b4e4f[_0x46c8('0x36')]};return db[_0x46c8('0x3a')][_0x46c8('0x1c')](_0xe87fae)[_0x46c8('0x3b')](function(_0x50ecfd){_0x523734[_0x46c8('0x1c')]=_0x50ecfd;if(_0x156b89[_0x46c8('0x2b')]['includeAll']){_0x2b4e4f[_0x46c8('0x3c')]=[{'all':!![]}];}return db[_0x46c8('0x3a')][_0x46c8('0x3d')](_0x2b4e4f);})['then'](function(_0x58d215){_0x523734[_0x46c8('0x3e')]=_0x58d215;return _0x523734;})['then'](respondWithFilteredResult(_0x79c2bf,_0x2b4e4f))['catch'](handleError(_0x79c2bf,null));};exports[_0x46c8('0x3f')]=function(_0x46481d,_0xacfaa6){var _0x19cff0={'raw':!![],'where':{'id':_0x46481d['params']['id']}},_0x23f04c={};_0x23f04c[_0x46c8('0x29')]=_[_0x46c8('0x2c')](db['VoiceTransferReport'][_0x46c8('0x40')]);_0x23f04c[_0x46c8('0x2b')]=_[_0x46c8('0x2c')](_0x46481d[_0x46c8('0x2b')]);_0x23f04c[_0x46c8('0x33')]=_[_0x46c8('0x2d')](_0x23f04c[_0x46c8('0x29')],_0x23f04c['query']);_0x19cff0['attributes']=_[_0x46c8('0x2d')](_0x23f04c[_0x46c8('0x29')],qs['fields'](_0x46481d[_0x46c8('0x2b')]['fields']));_0x19cff0[_0x46c8('0x2e')]=_0x19cff0[_0x46c8('0x2e')]['length']?_0x19cff0[_0x46c8('0x2e')]:_0x23f04c['model'];if(_0x46481d[_0x46c8('0x2b')]['includeAll']){_0x19cff0[_0x46c8('0x3c')]=[{'all':!![]}];}_0x19cff0=_[_0x46c8('0x37')]({},_0x19cff0,_0x46481d[_0x46c8('0x39')]);return db[_0x46c8('0x3a')]['find'](_0x19cff0)[_0x46c8('0x3b')](handleEntityNotFound(_0xacfaa6,null))[_0x46c8('0x3b')](respondWithResult(_0xacfaa6,null))[_0x46c8('0x41')](handleError(_0xacfaa6,null));};exports[_0x46c8('0x42')]=function(_0x385256,_0x4ef67d){return db[_0x46c8('0x3a')][_0x46c8('0x42')](_0x385256[_0x46c8('0x43')],{})['then'](respondWithResult(_0x4ef67d,0xc9))[_0x46c8('0x41')](handleError(_0x4ef67d,null));};exports[_0x46c8('0x21')]=function(_0x207ec3,_0x958a49){if(_0x207ec3[_0x46c8('0x43')]['id']){delete _0x207ec3[_0x46c8('0x43')]['id'];}return db['VoiceTransferReport'][_0x46c8('0x44')]({'where':{'id':_0x207ec3[_0x46c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x958a49,null))[_0x46c8('0x3b')](saveUpdates(_0x207ec3[_0x46c8('0x43')],null))[_0x46c8('0x3b')](respondWithResult(_0x958a49,null))['catch'](handleError(_0x958a49,null));};exports['destroy']=function(_0x4d5598,_0x1630be){return db['VoiceTransferReport'][_0x46c8('0x44')]({'where':{'id':_0x4d5598['params']['id']}})[_0x46c8('0x3b')](handleEntityNotFound(_0x1630be,null))[_0x46c8('0x3b')](removeEntity(_0x1630be,null))['catch'](handleError(_0x1630be,null));};exports['describe']=function(_0x81ec2,_0x2b9bc2){return db[_0x46c8('0x3a')][_0x46c8('0x46')]()[_0x46c8('0x3b')](respondWithResult(_0x2b9bc2,null))[_0x46c8('0x41')](handleError(_0x2b9bc2,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f006174..3de6d44 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 _0x3493=['rimraf','../../config/environment','define','lodash','api','moment','request-promise','path'];(function(_0x87ddb4,_0x2f08b6){var _0x3bed3a=function(_0x2293d5){while(--_0x2293d5){_0x87ddb4['push'](_0x87ddb4['shift']());}};_0x3bed3a(++_0x2f08b6);}(_0x3493,0x1f3));var _0x3349=function(_0x24749d,_0x2616fa){_0x24749d=_0x24749d-0x0;var _0x48adb1=_0x3493[_0x24749d];return _0x48adb1;};'use strict';var _=require(_0x3349('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3349('0x1'));var moment=require(_0x3349('0x2'));var BPromise=require('bluebird');var rp=require(_0x3349('0x3'));var fs=require('fs');var path=require(_0x3349('0x4'));var rimraf=require(_0x3349('0x5'));var config=require(_0x3349('0x6'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x3e680f,_0x190bce){return _0x3e680f[_0x3349('0x7')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaec4=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer'];(function(_0x113450,_0x1b9b5c){var _0x1a78b1=function(_0x202cc4){while(--_0x202cc4){_0x113450['push'](_0x113450['shift']());}};_0x1a78b1(++_0x1b9b5c);}(_0xaec4,0xea));var _0x4aec=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaec4[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4aec('0x0'));var util=require('util');var logger=require(_0x4aec('0x1'))(_0x4aec('0x2'));var moment=require(_0x4aec('0x3'));var BPromise=require(_0x4aec('0x4'));var rp=require(_0x4aec('0x5'));var fs=require('fs');var path=require(_0x4aec('0x6'));var rimraf=require(_0x4aec('0x7'));var config=require(_0x4aec('0x8'));var attributes=require(_0x4aec('0x9'));module[_0x4aec('0xa')]=function(_0x5cd27b,_0x3bfa06){return _0x5cd27b[_0x4aec('0xb')]('VoiceTransferReport',attributes,{'tableName':_0x4aec('0xc'),'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 da77922..03e8d59 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 _0xc3e7=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x58bbcf,_0x24d172){var _0x542c27=function(_0x4923ab){while(--_0x4923ab){_0x58bbcf['push'](_0x58bbcf['shift']());}};_0x542c27(++_0x24d172);}(_0xc3e7,0x1b6));var _0x7c3e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xc3e7[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7c3e('0x0'));var rs=require(_0x7c3e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c3e('0x2'))['db'];var utils=require(_0x7c3e('0x3'));var logger=require(_0x7c3e('0x4'))(_0x7c3e('0x5'));var config=require(_0x7c3e('0x6'));var jayson=require(_0x7c3e('0x7'));var client=jayson[_0x7c3e('0x8')][_0x7c3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5699a0,_0x1be868,_0x24e908){return new BPromise(function(_0x1ac88b,_0x35ad18){return client[_0x7c3e('0xa')](_0x5699a0,_0x24e908)[_0x7c3e('0xb')](function(_0x2b5af3){logger[_0x7c3e('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x1be868,_0x7c3e('0xd'));logger[_0x7c3e('0xe')](_0x7c3e('0xf'),_0x1be868,_0x7c3e('0xd'),JSON[_0x7c3e('0x10')](_0x2b5af3));if(_0x2b5af3[_0x7c3e('0x11')]){if(_0x2b5af3[_0x7c3e('0x11')][_0x7c3e('0x12')]===0x1f4){logger[_0x7c3e('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x1be868,_0x2b5af3[_0x7c3e('0x11')][_0x7c3e('0x13')]);return _0x35ad18(_0x2b5af3['error']['message']);}logger[_0x7c3e('0x11')](_0x7c3e('0x14'),_0x1be868,_0x2b5af3['error'][_0x7c3e('0x13')]);return _0x1ac88b(_0x2b5af3[_0x7c3e('0x11')]['message']);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x1be868,_0x7c3e('0xd'));_0x1ac88b(_0x2b5af3[_0x7c3e('0x15')][_0x7c3e('0x13')]);}})[_0x7c3e('0x16')](function(_0x4e7ec3){logger['error'](_0x7c3e('0x14'),_0x1be868,_0x4e7ec3);_0x35ad18(_0x4e7ec3);});});}exports[_0x7c3e('0x17')]=function(_0x24c678){var _0x9cb979=this;return new Promise(function(_0x47d295,_0x4cce87){return db[_0x7c3e('0x18')]['create'](_0x24c678['body'],{'raw':_0x24c678['options']?_0x24c678[_0x7c3e('0x19')][_0x7c3e('0x1a')]===undefined?!![]:![]:!![]})[_0x7c3e('0xb')](function(_0x1e82a1){logger[_0x7c3e('0xc')](_0x7c3e('0x17'),_0x24c678);logger['debug'](_0x7c3e('0x17'),_0x24c678,JSON[_0x7c3e('0x10')](_0x1e82a1));_0x47d295(_0x1e82a1);})[_0x7c3e('0x16')](function(_0x2a6953){logger[_0x7c3e('0x11')](_0x7c3e('0x17'),_0x2a6953['message'],_0x24c678);_0x4cce87(_0x9cb979['error'](0x1f4,_0x2a6953[_0x7c3e('0x13')]));});});}; \ No newline at end of file +var _0xf14a=['../../config/utils','../../config/logger','jayson/promise','then','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceTransferReport','create','body','options','raw','info','debug','CreateVoiceTransferReport','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x15d4ff,_0x584e44){var _0x3d0f1f=function(_0x1d5daf){while(--_0x1d5daf){_0x15d4ff['push'](_0x15d4ff['shift']());}};_0x3d0f1f(++_0x584e44);}(_0xf14a,0x18b));var _0xaf14=function(_0x19d604,_0x385b6a){_0x19d604=_0x19d604-0x0;var _0x54d472=_0xf14a[_0x19d604];return _0x54d472;};'use strict';var _=require(_0xaf14('0x0'));var util=require('util');var moment=require(_0xaf14('0x1'));var BPromise=require(_0xaf14('0x2'));var rs=require(_0xaf14('0x3'));var fs=require('fs');var Redis=require(_0xaf14('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaf14('0x5'));var logger=require(_0xaf14('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaf14('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1472e6,_0x52817f,_0x892733){return new BPromise(function(_0x1686f9,_0x380c53){return client['request'](_0x1472e6,_0x892733)[_0xaf14('0x8')](function(_0x3ccf40){logger['info'](_0xaf14('0x9'),_0x52817f,'request\x20sent');logger['debug'](_0xaf14('0xa'),_0x52817f,_0xaf14('0xb'),JSON[_0xaf14('0xc')](_0x3ccf40));if(_0x3ccf40[_0xaf14('0xd')]){if(_0x3ccf40['error'][_0xaf14('0xe')]===0x1f4){logger[_0xaf14('0xd')](_0xaf14('0x9'),_0x52817f,_0x3ccf40[_0xaf14('0xd')][_0xaf14('0xf')]);return _0x380c53(_0x3ccf40[_0xaf14('0xd')][_0xaf14('0xf')]);}logger[_0xaf14('0xd')](_0xaf14('0x9'),_0x52817f,_0x3ccf40[_0xaf14('0xd')][_0xaf14('0xf')]);return _0x1686f9(_0x3ccf40['error'][_0xaf14('0xf')]);}else{logger['info'](_0xaf14('0x9'),_0x52817f,_0xaf14('0xb'));_0x1686f9(_0x3ccf40['result'][_0xaf14('0xf')]);}})[_0xaf14('0x10')](function(_0x5c1a03){logger[_0xaf14('0xd')](_0xaf14('0x9'),_0x52817f,_0x5c1a03);_0x380c53(_0x5c1a03);});});}exports['CreateVoiceTransferReport']=function(_0x53fe20){var _0x2b208b=this;return new Promise(function(_0x177ce5,_0x2fdca2){return db[_0xaf14('0x11')][_0xaf14('0x12')](_0x53fe20[_0xaf14('0x13')],{'raw':_0x53fe20[_0xaf14('0x14')]?_0x53fe20[_0xaf14('0x14')][_0xaf14('0x15')]===undefined?!![]:![]:!![]})[_0xaf14('0x8')](function(_0x451e66){logger[_0xaf14('0x16')]('CreateVoiceTransferReport',_0x53fe20);logger[_0xaf14('0x17')](_0xaf14('0x18'),_0x53fe20,JSON['stringify'](_0x451e66));_0x177ce5(_0x451e66);})['catch'](function(_0x5a3d44){logger[_0xaf14('0xd')](_0xaf14('0x18'),_0x5a3d44['message'],_0x53fe20);_0x2fdca2(_0x2b208b[_0xaf14('0xd')](0x1f4,_0x5a3d44[_0xaf14('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 89f30ea..e020fed 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 _0xe706=['/transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','/calls','calls'];(function(_0x407956,_0x1bf0d6){var _0x12410a=function(_0x3646d3){while(--_0x3646d3){_0x407956['push'](_0x407956['shift']());}};_0x12410a(++_0x1bf0d6);}(_0xe706,0xa3));var _0x6e70=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0xe706[_0x3da832];return _0xe602f2;};'use strict';var express=require(_0x6e70('0x0'));var router=express[_0x6e70('0x1')]();var auth=require(_0x6e70('0x2'));var controller=require('./webbar.controller');router[_0x6e70('0x3')](_0x6e70('0x4'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x7')]);router[_0x6e70('0x3')](_0x6e70('0x8'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x9')]);router[_0x6e70('0x3')](_0x6e70('0xa'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x3')](_0x6e70('0xc'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x3')](_0x6e70('0xe'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['unhold']);router['post'](_0x6e70('0xf'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x3')](_0x6e70('0x11'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0xe14d,0x1ee));var _0xde14=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xe14d[_0x1b349a];return _0x5d1f7c;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 831e653..9bab1e7 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 _0xf403=['answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','redis','defaults','localhost','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','stringify','emit','log','error','stack','name','status','send','NotFound','request','then','code','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','validate','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup'];(function(_0x3bbe72,_0x8d69f7){var _0x15d332=function(_0x2b850b){while(--_0x2b850b){_0x3bbe72['push'](_0x3bbe72['shift']());}};_0x15d332(++_0x8d69f7);}(_0xf403,0x1d3));var _0x3f40=function(_0x25bec2,_0x2a046c){_0x25bec2=_0x25bec2-0x0;var _0x116315=_0xf403[_0x25bec2];return _0x116315;};'use strict';var path=require(_0x3f40('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x3f40('0x1'))['db'];var config=require(_0x3f40('0x2'));var util=require(_0x3f40('0x3'));var BPromise=require(_0x3f40('0x4'));var jayson=require(_0x3f40('0x5'));var amiClient=jayson[_0x3f40('0x6')][_0x3f40('0x7')]({'port':0x232a});var logger=require(_0x3f40('0x8'))('webbarapi');var Redis=require('ioredis');config[_0x3f40('0x9')]=_[_0x3f40('0xa')](config[_0x3f40('0x9')],{'host':_0x3f40('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f40('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3f40('0xc')]},'callNumber':{'type':_0x3f40('0xd'),'required':[!![],_0x3f40('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x3f40('0xf'),'required':[!![],_0x3f40('0xc')]},'sessionId':{'type':_0x3f40('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3f40('0xc')]},'sessionId':{'type':_0x3f40('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3f40('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3f40('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x3f40('0xd'),'required':[!![],_0x3f40('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x3f40('0xf'),'required':[!![],_0x3f40('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3f40('0xf'),'required':[!![],_0x3f40('0xc')]},'sessionId':{'type':_0x3f40('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3f40('0xf'),'required':[!![],_0x3f40('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3f40('0xc')]}});function emit(_0x3d11c9,_0x535f85,_0x4ef80e){logger['info'](_0x3d11c9,_0x535f85,JSON[_0x3f40('0x11')](_0x4ef80e));io['to'](_0x3d11c9)[_0x3f40('0x12')](_0x535f85,_0x4ef80e);}function handleError(_0x59718c){return function(_0x131e55){console[_0x3f40('0x13')]('handleError:',_0x131e55,_0x131e55 instanceof RangeError);logger[_0x3f40('0x14')](_0x131e55[_0x3f40('0x15')]);if(_0x131e55 instanceof RangeError){if(_0x131e55[_0x3f40('0x16')]){delete _0x131e55[_0x3f40('0x16')];}_0x59718c[_0x3f40('0x17')](0x194)['send'](_0x131e55);}else{if(_0x131e55[_0x3f40('0x16')]){delete _0x131e55['name'];}_0x59718c[_0x3f40('0x17')](0x1f4)[_0x3f40('0x18')](_0x131e55);}};}function checkError(){return function(_0x3f4a93){if(!_0x3f4a93){throw new RangeError(_0x3f40('0x19'));}return _0x3f4a93;};}function respondWithRpcPromise(_0x628816,_0x4aa559){return new BPromise(function(_0x27f5a5,_0x379b4e){var _0x117823=amiClient;return _0x117823[_0x3f40('0x1a')](_0x628816,_0x4aa559)[_0x3f40('0x1b')](function(_0xa1f39d){if(_0xa1f39d['error']){if(_0xa1f39d[_0x3f40('0x14')][_0x3f40('0x1c')]===0x1f4){return _0x379b4e(_0xa1f39d[_0x3f40('0x14')]['message']);}return _0x27f5a5(_0xa1f39d[_0x3f40('0x14')]['message']);}else{_0x27f5a5(_0xa1f39d[_0x3f40('0x1d')]);}})['catch'](function(_0x4b206b){_0x379b4e(_0x4b206b);});});}function getAgent(_0x4b0ade){return db[_0x3f40('0x1e')][_0x3f40('0x1f')]({'where':{'id':_0x4b0ade,'role':_0x3f40('0x20')}})[_0x3f40('0x1b')](checkError());}function getAgentCheckSession(_0x5b1079,_0x300665){return new BPromise(function(_0x47ec1c,_0x319997){var _0xbaf5d4=respondWithRpcPromise(_0x3f40('0x21'));var _0x5e0f25=getAgent(_0x5b1079);Promise[_0x3f40('0x22')]([_0xbaf5d4,_0x5e0f25])['then'](function(_0x1cab5c){var _0x5b9079=_0x1cab5c[0x0];var _0x49057b=_0x1cab5c[0x1];var _0xb6ab4d=_[_0x3f40('0x23')](_0x5b9079[_0x3f40('0x24')],function(_0xb23186){return _0xb23186[_0x3f40('0x25')]==_0x49057b['id']&&_0xb23186[_0x3f40('0x26')]==_0x300665;});if(_0xb6ab4d[_0x3f40('0x27')]==0x1){_0x47ec1c(_0x49057b);}else{_0x319997(new RangeError(_0x3f40('0x28')+_0x300665+'\x20not\x20found!'));}});});}exports[_0x3f40('0x29')]=function(_0x2d2624,_0x18dbb3){logger[_0x3f40('0x2a')](_0x3f40('0x2b'),_0x2d2624['body']);var _0x42b6b4=originateValidation[_0x3f40('0x2c')](_0x2d2624[_0x3f40('0x2d')]);if(_0x42b6b4['length']>0x0){return _0x18dbb3[_0x3f40('0x17')](0x190)[_0x3f40('0x2e')](_0x42b6b4);}var _0x239fd5=_0x2d2624[_0x3f40('0x2d')][_0x3f40('0x2f')];var _0x323908=_0x2d2624[_0x3f40('0x2d')][_0x3f40('0x30')];var _0x10356d=_0x2d2624[_0x3f40('0x2d')][_0x3f40('0x31')];var _0x25399a=_0x2d2624[_0x3f40('0x2d')][_0x3f40('0x32')];return getAgent(_0x239fd5)[_0x3f40('0x1b')](function(_0xf26a2f){logger[_0x3f40('0x2a')](_0x3f40('0x33'),_0xf26a2f[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')](_0x3f40('0x35'),_0xf26a2f[_0x3f40('0x16')]),_0x3f40('0x36'),{'callNumber':_0x323908,'callerId':_0x10356d,'callbackUrl':_0x25399a});return _0x18dbb3[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x37')});})[_0x3f40('0x38')](handleError(_0x18dbb3));};exports[_0x3f40('0x39')]=function(_0x411c98,_0x2df15b){logger['info']('hangup\x20fired:',_0x411c98[_0x3f40('0x2d')]);var _0x1b005e=hangupValidation[_0x3f40('0x2c')](_0x411c98[_0x3f40('0x2d')]);if(_0x1b005e[_0x3f40('0x27')]>0x0){return _0x2df15b[_0x3f40('0x17')](0x190)[_0x3f40('0x2e')](_0x1b005e);}var _0x4de3e7=_0x411c98[_0x3f40('0x2d')]['userId'];var _0x229bff=_0x411c98[_0x3f40('0x2d')][_0x3f40('0x26')];return getAgent(_0x4de3e7)['then'](function(_0x37a83d){logger[_0x3f40('0x2a')]('entityFound:',_0x37a83d[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')]('user:%s',_0x37a83d[_0x3f40('0x16')]),'webbar:hangup',{'sessionId':_0x229bff});return _0x2df15b[_0x3f40('0x17')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x3f40('0x38')](handleError(_0x2df15b));};exports['answer']=function(_0x2210bc,_0xe04271){logger[_0x3f40('0x2a')](_0x3f40('0x3a'),_0x2210bc['body']);var _0x237c91=answerValidation['validate'](_0x2210bc[_0x3f40('0x2d')]);if(_0x237c91[_0x3f40('0x27')]>0x0){return _0xe04271[_0x3f40('0x17')](0x190)['json'](_0x237c91);}var _0x4a198d=_0x2210bc[_0x3f40('0x2d')][_0x3f40('0x2f')];var _0x41bd93=_0x2210bc[_0x3f40('0x2d')][_0x3f40('0x26')];return getAgent(_0x4a198d)[_0x3f40('0x1b')](function(_0x38c5d6){logger[_0x3f40('0x2a')]('entityFound:',_0x38c5d6[_0x3f40('0x16')]);emit(util['format']('user:%s',_0x38c5d6[_0x3f40('0x16')]),_0x3f40('0x3b'),{'sessionId':_0x41bd93});return _0xe04271[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x3c')});})[_0x3f40('0x38')](handleError(_0xe04271));};exports[_0x3f40('0x3d')]=function(_0x3d6cf8,_0x1cc958){logger[_0x3f40('0x2a')](_0x3f40('0x3e'),_0x3d6cf8[_0x3f40('0x2d')]);var _0x2068ab=holdValidation[_0x3f40('0x2c')](_0x3d6cf8['body']);if(_0x2068ab[_0x3f40('0x27')]>0x0){return _0x1cc958['status'](0x190)[_0x3f40('0x2e')](_0x2068ab);}var _0x2f16d6=_0x3d6cf8['body'][_0x3f40('0x2f')];var _0x1f66fa=_0x3d6cf8[_0x3f40('0x2d')][_0x3f40('0x26')];return getAgent(_0x2f16d6)[_0x3f40('0x1b')](function(_0x268ae4){logger[_0x3f40('0x2a')](_0x3f40('0x33'),_0x268ae4[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')](_0x3f40('0x35'),_0x268ae4[_0x3f40('0x16')]),_0x3f40('0x3f'),{'sessionId':_0x1f66fa});return _0x1cc958[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x40')});})[_0x3f40('0x38')](handleError(_0x1cc958));};exports[_0x3f40('0x41')]=function(_0x32bd05,_0x2d7e66){logger[_0x3f40('0x2a')]('unhold\x20fired:',_0x32bd05[_0x3f40('0x2d')]);var _0x50db96=unholdValidation[_0x3f40('0x2c')](_0x32bd05[_0x3f40('0x2d')]);if(_0x50db96[_0x3f40('0x27')]>0x0){return _0x2d7e66['status'](0x190)['json'](_0x50db96);}var _0x54b7cd=_0x32bd05[_0x3f40('0x2d')][_0x3f40('0x2f')];var _0x5f4f1a=_0x32bd05[_0x3f40('0x2d')][_0x3f40('0x26')];return getAgent(_0x54b7cd)['then'](function(_0x1cd70d){logger['info'](_0x3f40('0x33'),_0x1cd70d[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')](_0x3f40('0x35'),_0x1cd70d[_0x3f40('0x16')]),_0x3f40('0x42'),{'sessionId':_0x5f4f1a});return _0x2d7e66[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x43')});})[_0x3f40('0x38')](handleError(_0x2d7e66));};exports[_0x3f40('0x44')]=function(_0x13f191,_0x109752){logger['info'](_0x3f40('0x45'),_0x109752[_0x3f40('0x2d')]);var _0x1c94a1=callsValidation[_0x3f40('0x2c')](_0x13f191[_0x3f40('0x2d')]);if(_0x1c94a1['length']>0x0){return _0x109752[_0x3f40('0x17')](0x190)[_0x3f40('0x2e')](_0x1c94a1);}var _0x1c4b44=_0x13f191[_0x3f40('0x2d')][_0x3f40('0x2f')];var _0x5c030a=respondWithRpcPromise('VoiceChannels');var _0x6c81fe=getAgent(_0x1c4b44);return Promise[_0x3f40('0x22')]([_0x5c030a,_0x6c81fe])['then'](function(_0x701ed0){var _0x5a3456=_0x701ed0[0x0];var _0x204cff=_0x701ed0[0x1];var _0x557c0c=_[_0x3f40('0x23')](_0x5a3456['rows'],function(_0xab34b){return _0xab34b[_0x3f40('0x25')]==_0x204cff['id'];});return _0x109752[_0x3f40('0x17')](0xc8)['json']({'count':_0x557c0c['length'],'rows':_0x557c0c});})['catch'](handleError(_0x109752));};exports['conference']=function(_0x273739,_0x4e1c35){logger['info'](_0x3f40('0x46'),_0x273739[_0x3f40('0x2d')]);var _0x37f636=conferenceValidation[_0x3f40('0x2c')](_0x273739['body']);if(_0x37f636[_0x3f40('0x27')]>0x0){return _0x4e1c35['status'](0x190)['json'](_0x37f636);}var _0x48b0ed=_0x273739[_0x3f40('0x2d')]['userId'];return getAgent(_0x48b0ed)['then'](function(_0x45d7e5){logger[_0x3f40('0x2a')](_0x3f40('0x33'),_0x45d7e5[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')]('user:%s',_0x45d7e5[_0x3f40('0x16')]),'webbar:conference');return _0x4e1c35[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x47')});})['catch'](handleError(_0x4e1c35));};exports[_0x3f40('0x48')]=function(_0x2408f4,_0x46821c){logger[_0x3f40('0x2a')](_0x3f40('0x49'),_0x2408f4['body']);var _0x2f76a1=transferValidation[_0x3f40('0x2c')](_0x2408f4[_0x3f40('0x2d')]);if(_0x2f76a1[_0x3f40('0x27')]>0x0){return _0x46821c[_0x3f40('0x17')](0x190)[_0x3f40('0x2e')](_0x2f76a1);}var _0x29fdfc=_0x2408f4[_0x3f40('0x2d')][_0x3f40('0x2f')];var _0x37add1=_0x2408f4[_0x3f40('0x2d')][_0x3f40('0x26')];var _0x52c075=_0x2408f4['body']['transferNumber'];return getAgent(_0x29fdfc)[_0x3f40('0x1b')](function(_0x137cd8){logger[_0x3f40('0x2a')](_0x3f40('0x33'),_0x137cd8[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')]('user:%s',_0x137cd8[_0x3f40('0x16')]),'webbar:transfer',{'sessionId':_0x37add1,'transferNumber':_0x52c075});return _0x46821c[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x4a')});})[_0x3f40('0x38')](handleError(_0x46821c));}; \ No newline at end of file +var _0x0ba7=['client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','send','NotFound','request','code','message','result','findOne','agent','then','VoiceChannels','filter','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','userId','sessionId','hangup\x20executed!','catch','answer','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','unhold','calls','calls\x20fired:','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','../../mysqldb','../../config/environment','util','bluebird'];(function(_0x1840c1,_0x217972){var _0x4587b0=function(_0x799208){while(--_0x799208){_0x1840c1['push'](_0x1840c1['shift']());}};_0x4587b0(++_0x217972);}(_0x0ba7,0x16d));var _0x70ba=function(_0x15615a,_0x77e2f4){_0x15615a=_0x15615a-0x0;var _0x141e50=_0x0ba7[_0x15615a];return _0x141e50;};'use strict';var path=require(_0x70ba('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x70ba('0x1'))['db'];var config=require(_0x70ba('0x2'));var util=require(_0x70ba('0x3'));var BPromise=require(_0x70ba('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x70ba('0x5')][_0x70ba('0x6')]({'port':0x232a});var logger=require(_0x70ba('0x7'))(_0x70ba('0x8'));var Redis=require(_0x70ba('0x9'));config[_0x70ba('0xa')]=_[_0x70ba('0xb')](config[_0x70ba('0xa')],{'host':_0x70ba('0xc'),'port':0x18eb});var io=require(_0x70ba('0xd'))(new Redis(config[_0x70ba('0xa')]));var Schema=require(_0x70ba('0xe'));var originateValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],_0x70ba('0x10')]},'callNumber':{'type':_0x70ba('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x70ba('0x11')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],_0x70ba('0x10')]},'sessionId':{'type':_0x70ba('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x70ba('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x70ba('0x11'),'required':[!![],_0x70ba('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x70ba('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],_0x70ba('0x10')]},'sessionId':{'type':_0x70ba('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],_0x70ba('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],_0x70ba('0x10')]}});function emit(_0x164521,_0x18334a,_0x3e27e8){logger[_0x70ba('0x13')](_0x164521,_0x18334a,JSON[_0x70ba('0x14')](_0x3e27e8));io['to'](_0x164521)[_0x70ba('0x15')](_0x18334a,_0x3e27e8);}function handleError(_0xb6d69a){return function(_0x5ed907){console['log']('handleError:',_0x5ed907,_0x5ed907 instanceof RangeError);logger[_0x70ba('0x16')](_0x5ed907[_0x70ba('0x17')]);if(_0x5ed907 instanceof RangeError){if(_0x5ed907[_0x70ba('0x18')]){delete _0x5ed907[_0x70ba('0x18')];}_0xb6d69a[_0x70ba('0x19')](0x194)[_0x70ba('0x1a')](_0x5ed907);}else{if(_0x5ed907[_0x70ba('0x18')]){delete _0x5ed907[_0x70ba('0x18')];}_0xb6d69a[_0x70ba('0x19')](0x1f4)[_0x70ba('0x1a')](_0x5ed907);}};}function checkError(){return function(_0x26c039){if(!_0x26c039){throw new RangeError(_0x70ba('0x1b'));}return _0x26c039;};}function respondWithRpcPromise(_0x2a1328,_0x4570b0){return new BPromise(function(_0x273ce4,_0x5ebe9d){var _0x3b31ef=amiClient;return _0x3b31ef[_0x70ba('0x1c')](_0x2a1328,_0x4570b0)['then'](function(_0x123b0c){if(_0x123b0c['error']){if(_0x123b0c['error'][_0x70ba('0x1d')]===0x1f4){return _0x5ebe9d(_0x123b0c['error'][_0x70ba('0x1e')]);}return _0x273ce4(_0x123b0c[_0x70ba('0x16')]['message']);}else{_0x273ce4(_0x123b0c[_0x70ba('0x1f')]);}})['catch'](function(_0x5ad828){_0x5ebe9d(_0x5ad828);});});}function getAgent(_0x39482c){return db['User'][_0x70ba('0x20')]({'where':{'id':_0x39482c,'role':_0x70ba('0x21')}})[_0x70ba('0x22')](checkError());}function getAgentCheckSession(_0x33e218,_0x2c6d18){return new BPromise(function(_0x265423,_0x5a8558){var _0x2d840e=respondWithRpcPromise(_0x70ba('0x23'));var _0x797467=getAgent(_0x33e218);Promise['all']([_0x2d840e,_0x797467])[_0x70ba('0x22')](function(_0x51b5cb){var _0x5955dc=_0x51b5cb[0x0];var _0x505f98=_0x51b5cb[0x1];var _0x77e564=_[_0x70ba('0x24')](_0x5955dc['rows'],function(_0x51b3e3){return _0x51b3e3[_0x70ba('0x25')]==_0x505f98['id']&&_0x51b3e3['sessionId']==_0x2c6d18;});if(_0x77e564[_0x70ba('0x26')]==0x1){_0x265423(_0x505f98);}else{_0x5a8558(new RangeError(_0x70ba('0x27')+_0x2c6d18+_0x70ba('0x28')));}});});}exports[_0x70ba('0x29')]=function(_0x1db0c4,_0x269943){logger[_0x70ba('0x13')](_0x70ba('0x2a'),_0x1db0c4[_0x70ba('0x2b')]);var _0x6055d3=originateValidation[_0x70ba('0xe')](_0x1db0c4['body']);if(_0x6055d3['length']>0x0){return _0x269943[_0x70ba('0x19')](0x190)[_0x70ba('0x2c')](_0x6055d3);}var _0x943e49=_0x1db0c4['body']['userId'];var _0x507f00=_0x1db0c4[_0x70ba('0x2b')][_0x70ba('0x2d')];var _0x2200d3=_0x1db0c4['body'][_0x70ba('0x2e')];var _0x5bc56f=_0x1db0c4['body'][_0x70ba('0x2f')];return getAgent(_0x943e49)['then'](function(_0x15774e){logger[_0x70ba('0x13')]('entityFound:',_0x15774e[_0x70ba('0x18')]);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x15774e['name']),_0x70ba('0x32'),{'callNumber':_0x507f00,'callerId':_0x2200d3,'callbackUrl':_0x5bc56f});return _0x269943[_0x70ba('0x19')](0xc8)[_0x70ba('0x2c')]({'error':![],'message':_0x70ba('0x33')});})['catch'](handleError(_0x269943));};exports[_0x70ba('0x34')]=function(_0x569ae3,_0x17707a){logger[_0x70ba('0x13')](_0x70ba('0x35'),_0x569ae3[_0x70ba('0x2b')]);var _0x16ce39=hangupValidation[_0x70ba('0xe')](_0x569ae3[_0x70ba('0x2b')]);if(_0x16ce39['length']>0x0){return _0x17707a[_0x70ba('0x19')](0x190)[_0x70ba('0x2c')](_0x16ce39);}var _0x31e713=_0x569ae3[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x473489=_0x569ae3['body'][_0x70ba('0x37')];return getAgent(_0x31e713)[_0x70ba('0x22')](function(_0x1861ed){logger['info']('entityFound:',_0x1861ed['name']);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x1861ed[_0x70ba('0x18')]),'webbar:hangup',{'sessionId':_0x473489});return _0x17707a[_0x70ba('0x19')](0xc8)[_0x70ba('0x2c')]({'error':![],'message':_0x70ba('0x38')});})[_0x70ba('0x39')](handleError(_0x17707a));};exports[_0x70ba('0x3a')]=function(_0x54e732,_0x5ee74c){logger[_0x70ba('0x13')](_0x70ba('0x3b'),_0x54e732[_0x70ba('0x2b')]);var _0x5a1edb=answerValidation['validate'](_0x54e732[_0x70ba('0x2b')]);if(_0x5a1edb['length']>0x0){return _0x5ee74c[_0x70ba('0x19')](0x190)[_0x70ba('0x2c')](_0x5a1edb);}var _0x705ca4=_0x54e732[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x51f4df=_0x54e732[_0x70ba('0x2b')][_0x70ba('0x37')];return getAgent(_0x705ca4)[_0x70ba('0x22')](function(_0x3dc2f7){logger[_0x70ba('0x13')](_0x70ba('0x3c'),_0x3dc2f7[_0x70ba('0x18')]);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x3dc2f7[_0x70ba('0x18')]),_0x70ba('0x3d'),{'sessionId':_0x51f4df});return _0x5ee74c[_0x70ba('0x19')](0xc8)[_0x70ba('0x2c')]({'error':![],'message':_0x70ba('0x3e')});})[_0x70ba('0x39')](handleError(_0x5ee74c));};exports['hold']=function(_0xd7638f,_0x3121f6){logger['info'](_0x70ba('0x3f'),_0xd7638f[_0x70ba('0x2b')]);var _0x3de825=holdValidation[_0x70ba('0xe')](_0xd7638f[_0x70ba('0x2b')]);if(_0x3de825[_0x70ba('0x26')]>0x0){return _0x3121f6[_0x70ba('0x19')](0x190)['json'](_0x3de825);}var _0x2e2613=_0xd7638f[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x3d1f89=_0xd7638f[_0x70ba('0x2b')][_0x70ba('0x37')];return getAgent(_0x2e2613)[_0x70ba('0x22')](function(_0x400c37){logger[_0x70ba('0x13')](_0x70ba('0x3c'),_0x400c37[_0x70ba('0x18')]);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x400c37[_0x70ba('0x18')]),_0x70ba('0x40'),{'sessionId':_0x3d1f89});return _0x3121f6[_0x70ba('0x19')](0xc8)[_0x70ba('0x2c')]({'error':![],'message':'hold\x20executed!'});})[_0x70ba('0x39')](handleError(_0x3121f6));};exports[_0x70ba('0x41')]=function(_0x2dc3c5,_0x19c99c){logger['info']('unhold\x20fired:',_0x2dc3c5['body']);var _0x471d19=unholdValidation[_0x70ba('0xe')](_0x2dc3c5['body']);if(_0x471d19['length']>0x0){return _0x19c99c[_0x70ba('0x19')](0x190)[_0x70ba('0x2c')](_0x471d19);}var _0x3e3779=_0x2dc3c5[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x4e2397=_0x2dc3c5[_0x70ba('0x2b')]['sessionId'];return getAgent(_0x3e3779)['then'](function(_0x361699){logger[_0x70ba('0x13')](_0x70ba('0x3c'),_0x361699[_0x70ba('0x18')]);emit(util['format'](_0x70ba('0x31'),_0x361699[_0x70ba('0x18')]),'webbar:unhold',{'sessionId':_0x4e2397});return _0x19c99c['status'](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x70ba('0x39')](handleError(_0x19c99c));};exports[_0x70ba('0x42')]=function(_0x1cb9c7,_0x4cc5b1){logger[_0x70ba('0x13')](_0x70ba('0x43'),_0x4cc5b1[_0x70ba('0x2b')]);var _0x5214eb=callsValidation[_0x70ba('0xe')](_0x1cb9c7[_0x70ba('0x2b')]);if(_0x5214eb['length']>0x0){return _0x4cc5b1['status'](0x190)[_0x70ba('0x2c')](_0x5214eb);}var _0x15b3ab=_0x1cb9c7[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x10e824=respondWithRpcPromise(_0x70ba('0x23'));var _0x44cb31=getAgent(_0x15b3ab);return Promise['all']([_0x10e824,_0x44cb31])[_0x70ba('0x22')](function(_0x27d101){var _0x4de412=_0x27d101[0x0];var _0x508da6=_0x27d101[0x1];var _0x137b7d=_[_0x70ba('0x24')](_0x4de412['rows'],function(_0x4ea26b){return _0x4ea26b[_0x70ba('0x25')]==_0x508da6['id'];});return _0x4cc5b1['status'](0xc8)['json']({'count':_0x137b7d[_0x70ba('0x26')],'rows':_0x137b7d});})[_0x70ba('0x39')](handleError(_0x4cc5b1));};exports[_0x70ba('0x44')]=function(_0xb03649,_0x10bb90){logger[_0x70ba('0x13')](_0x70ba('0x45'),_0xb03649['body']);var _0x46a8a6=conferenceValidation[_0x70ba('0xe')](_0xb03649[_0x70ba('0x2b')]);if(_0x46a8a6[_0x70ba('0x26')]>0x0){return _0x10bb90[_0x70ba('0x19')](0x190)[_0x70ba('0x2c')](_0x46a8a6);}var _0x5d58a1=_0xb03649[_0x70ba('0x2b')]['userId'];return getAgent(_0x5d58a1)[_0x70ba('0x22')](function(_0x4b385b){logger[_0x70ba('0x13')](_0x70ba('0x3c'),_0x4b385b[_0x70ba('0x18')]);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x4b385b[_0x70ba('0x18')]),'webbar:conference');return _0x10bb90[_0x70ba('0x19')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x70ba('0x39')](handleError(_0x10bb90));};exports[_0x70ba('0x46')]=function(_0x5b1824,_0x208333){logger['info'](_0x70ba('0x47'),_0x5b1824[_0x70ba('0x2b')]);var _0x378893=transferValidation['validate'](_0x5b1824[_0x70ba('0x2b')]);if(_0x378893['length']>0x0){return _0x208333[_0x70ba('0x19')](0x190)['json'](_0x378893);}var _0x2ee3d0=_0x5b1824[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x4ebc09=_0x5b1824['body'][_0x70ba('0x37')];var _0x530324=_0x5b1824[_0x70ba('0x2b')][_0x70ba('0x48')];return getAgent(_0x2ee3d0)[_0x70ba('0x22')](function(_0x32a246){logger['info'](_0x70ba('0x3c'),_0x32a246[_0x70ba('0x18')]);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x32a246[_0x70ba('0x18')]),_0x70ba('0x49'),{'sessionId':_0x4ebc09,'transferNumber':_0x530324});return _0x208333[_0x70ba('0x19')](0xc8)[_0x70ba('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0x70ba('0x39')](handleError(_0x208333));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index be83859..086bc5a 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 _0x2542=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x58f1d3,_0x5dab06){var _0x10bc50=function(_0x4dc7f3){while(--_0x4dc7f3){_0x58f1d3['push'](_0x58f1d3['shift']());}};_0x10bc50(++_0x5dab06);}(_0x2542,0x169));var _0x2254=function(_0x5d1030,_0x483bc5){_0x5d1030=_0x5d1030-0x0;var _0x6f8000=_0x2542[_0x5d1030];return _0x6f8000;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x9')](_0x2254('0x10'),auth['isAuthenticated'](),controller[_0x2254('0x11')]);router[_0x2254('0x9')](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['getAnswers']);router['get'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x14')]);router[_0x2254('0x9')](_0x2254('0x15'),auth[_0x2254('0xc')](),controller['getApplications']);router[_0x2254('0x16')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x16')](_0x2254('0x10'),auth[_0x2254('0xc')](),controller[_0x2254('0x17')]);router[_0x2254('0x16')](_0x2254('0x12'),auth['isAuthenticated'](),controller[_0x2254('0x18')]);router['post'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x19')]);router[_0x2254('0x16')](_0x2254('0x15'),auth[_0x2254('0xc')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x2254('0x1a')]);router[_0x2254('0x16')](_0x2254('0x1b'),auth[_0x2254('0xc')](),controller[_0x2254('0x1c')]);router[_0x2254('0x1d')]('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x1e')]);router[_0x2254('0x1f')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x2254('0x1f')](_0x2254('0x10'),auth[_0x2254('0xc')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x20')]);module[_0x2254('0x21')]=router; \ No newline at end of file +var _0x47c5=['/:id/notify','notify','send','update','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x47c5,0x165));var _0x547c=function(_0x56d896,_0x3b4c9c){_0x56d896=_0x56d896-0x0;var _0x293639=_0x47c5[_0x56d896];return _0x293639;};'use strict';var multer=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var timeout=require(_0x547c('0x3'));var express=require(_0x547c('0x4'));var router=express[_0x547c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x547c('0x6'));var interaction=require(_0x547c('0x7'));var config=require('../../config/environment');var controller=require(_0x547c('0x8'));router[_0x547c('0x9')]('/',auth['isAuthenticated'](),controller[_0x547c('0xa')]);router[_0x547c('0x9')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0xd')]);router[_0x547c('0x9')](_0x547c('0xe'),auth[_0x547c('0xc')](),controller[_0x547c('0xf')]);router[_0x547c('0x9')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x11')]);router[_0x547c('0x9')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x13')]);router['get'](_0x547c('0x14'),auth[_0x547c('0xc')](),controller['getAgents']);router[_0x547c('0x9')](_0x547c('0x15'),auth[_0x547c('0xc')](),controller[_0x547c('0x16')]);router[_0x547c('0x17')]('/',auth[_0x547c('0xc')](),controller[_0x547c('0x18')]);router[_0x547c('0x17')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x19')]);router[_0x547c('0x17')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x1a')]);router[_0x547c('0x17')](_0x547c('0x14'),auth[_0x547c('0xc')](),controller['addAgents']);router['post'](_0x547c('0x15'),auth[_0x547c('0xc')](),controller[_0x547c('0x1b')]);router['post'](_0x547c('0x1c'),controller[_0x547c('0x1d')]);router[_0x547c('0x17')]('/:id/send',auth[_0x547c('0xc')](),controller[_0x547c('0x1e')]);router['put']('/:id',auth[_0x547c('0xc')](),controller[_0x547c('0x1f')]);router['delete'](_0x547c('0xe'),auth[_0x547c('0xc')](),controller['destroy']);router[_0x547c('0x20')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller['removeDispositions']);router[_0x547c('0x20')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x21')]);router[_0x547c('0x20')](_0x547c('0x14'),auth[_0x547c('0xc')](),controller[_0x547c('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a10d386..f886a6f 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 _0xa0aa=['ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','name','generate'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xa0aa,0x158));var _0xaa0a=function(_0x5883c4,_0x35b73f){_0x5883c4=_0x5883c4-0x0;var _0x1d5f2f=_0xa0aa[_0x5883c4];return _0x1d5f2f;};'use strict';var Sequelize=require(_0xaa0a('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xaa0a('0x1')],'unique':_0xaa0a('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xaa0a('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xaa0a('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xaa0a('0x3')]();}},'phone':{'type':Sequelize[_0xaa0a('0x1')]},'type':{'type':Sequelize[_0xaa0a('0x4')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0xaa0a('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xaa0a('0x5')],'defaultValue':function(){return _0xaa0a('0x6');}},'notificationSound':{'type':Sequelize[_0xaa0a('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xaa0a('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaa0a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaa0a('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaa0a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaa0a('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaa0a('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xaa0a('0x9'),'set':function(_0x4348b7){if(!_0x4348b7){this[_0xaa0a('0xa')]('mandatoryDispositionPauseId',null);}this[_0xaa0a('0xa')](_0xaa0a('0xb'),_0x4348b7);}},'description':{'type':Sequelize[_0xaa0a('0x1')]}}; \ No newline at end of file +var _0xe7db=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0xeae311,_0x3bd316){var _0x185cb7=function(_0x38ad53){while(--_0x38ad53){_0xeae311['push'](_0xeae311['shift']());}};_0x185cb7(++_0x3bd316);}(_0xe7db,0x158));var _0xbe7d=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xe7db[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0xbe7d('0x0'));var rs=require(_0xbe7d('0x1'));module[_0xbe7d('0x2')]={'name':{'type':Sequelize[_0xbe7d('0x3')],'unique':_0xbe7d('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xbe7d('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xbe7d('0x3')],'defaultValue':function(){return rs[_0xbe7d('0x5')]();}},'phone':{'type':Sequelize[_0xbe7d('0x3')]},'type':{'type':Sequelize[_0xbe7d('0x6')](_0xbe7d('0x7'),_0xbe7d('0x8'))},'accountSid':{'type':Sequelize[_0xbe7d('0x3')]},'baseUrl':{'type':Sequelize[_0xbe7d('0x3')]},'authToken':{'type':Sequelize[_0xbe7d('0x3')]},'notificationTemplate':{'type':Sequelize[_0xbe7d('0x9')],'defaultValue':function(){return _0xbe7d('0xa');}},'notificationSound':{'type':Sequelize[_0xbe7d('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xbe7d('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbe7d('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbe7d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbe7d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe7d('0xc')],'comment':_0xbe7d('0xd')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbe7d('0xe'),'set':function(_0x1c329a){if(!_0x1c329a){this[_0xbe7d('0xf')](_0xbe7d('0x10'),null);}this[_0xbe7d('0xf')]('mandatoryDisposition',_0x1c329a);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 238b30e..8a91445 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 _0x81f2=['status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','keys','query','filters','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','intersection','hasOwnProperty','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','account','statuses','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','Body','sinch','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','omit','Contacts','defaults','contact','WhatsappInteraction','spread','interaction','autoclose','push','close','*,*,*,*','created','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','to\x20is\x20mandatory','List','DESC','out','user','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./whatsappAccount.socket','register','http','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus'];(function(_0x1075b8,_0xd606e2){var _0x5d047f=function(_0x5e6652){while(--_0x5e6652){_0x1075b8['push'](_0x1075b8['shift']());}};_0x5d047f(++_0xd606e2);}(_0x81f2,0x9f));var _0x281f=function(_0x35f677,_0x4cc714){_0x35f677=_0x35f677-0x0;var _0x321dec=_0x81f2[_0x35f677];return _0x321dec;};'use strict';var emlformat=require(_0x281f('0x0'));var rimraf=require(_0x281f('0x1'));var zipdir=require(_0x281f('0x2'));var jsonpatch=require(_0x281f('0x3'));var rp=require(_0x281f('0x4'));var moment=require(_0x281f('0x5'));var BPromise=require(_0x281f('0x6'));var Mustache=require(_0x281f('0x7'));var util=require(_0x281f('0x8'));var path=require('path');var sox=require(_0x281f('0x9'));var csv=require(_0x281f('0xa'));var ejs=require(_0x281f('0xb'));var fs=require('fs');var fs_extra=require(_0x281f('0xc'));var _=require('lodash');var squel=require(_0x281f('0xd'));var crypto=require(_0x281f('0xe'));var jsforce=require(_0x281f('0xf'));var deskjs=require(_0x281f('0x10'));var toCsv=require(_0x281f('0xa'));var querystring=require(_0x281f('0x11'));var Papa=require('papaparse');var Redis=require(_0x281f('0x12'));var authService=require(_0x281f('0x13'));var qs=require(_0x281f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x281f('0x15'))('api');var utils=require(_0x281f('0x16'));var config=require(_0x281f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x281f('0x18'))['db'];config['redis']=_['defaults'](config[_0x281f('0x19')],{'host':_0x281f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x281f('0x19')]));require(_0x281f('0x1b'))[_0x281f('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x281f('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x57a898,_0x27fe6b,_0x540595,_0x7cfacc){return new BPromise(function(_0x293abe,_0x318348){var _0x2d5761=_0x7cfacc||client;return _0x2d5761['request'](_0x57a898,_0x540595)[_0x281f('0x1e')](function(_0x1ef1a0){logger[_0x281f('0x1f')](_0x281f('0x20'),_0x27fe6b,'request\x20sent');logger[_0x281f('0x21')](_0x281f('0x22'),_0x27fe6b,'request\x20sent',JSON[_0x281f('0x23')](_0x1ef1a0));if(_0x1ef1a0[_0x281f('0x24')]){if(_0x1ef1a0[_0x281f('0x24')]['code']===0x1f4){logger['error'](_0x281f('0x20'),_0x27fe6b,_0x1ef1a0['error']['message']);return _0x318348(_0x1ef1a0[_0x281f('0x24')][_0x281f('0x25')]);}logger[_0x281f('0x24')](_0x281f('0x20'),_0x27fe6b,_0x1ef1a0[_0x281f('0x24')]['message']);return _0x293abe(_0x1ef1a0[_0x281f('0x24')]['message']);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x27fe6b,_0x281f('0x26'));_0x293abe(_0x1ef1a0[_0x281f('0x27')][_0x281f('0x25')]);}})[_0x281f('0x28')](function(_0x564abf){logger[_0x281f('0x24')](_0x281f('0x20'),_0x27fe6b,_0x564abf);_0x318348(_0x564abf);});});}function respondWithStatusCode(_0x4c5b59,_0x47b01d){_0x47b01d=_0x47b01d||0xcc;return function(_0x478ff6){if(_0x478ff6){return _0x4c5b59[_0x281f('0x29')](_0x47b01d);}return _0x4c5b59[_0x281f('0x2a')](_0x47b01d)[_0x281f('0x2b')]();};}function respondWithResult(_0xe18ec4,_0x5e2adc){_0x5e2adc=_0x5e2adc||0xc8;return function(_0x3ed4cd){if(_0x3ed4cd){return _0xe18ec4[_0x281f('0x2a')](_0x5e2adc)[_0x281f('0x2c')](_0x3ed4cd);}};}function respondWithFilteredResult(_0x490174,_0x4a81bf){return function(_0x3bcdcc){if(_0x3bcdcc){var _0x2993b3=typeof _0x4a81bf['offset']===_0x281f('0x2d')&&typeof _0x4a81bf[_0x281f('0x2e')]===_0x281f('0x2d');var _0x1b5876=_0x3bcdcc[_0x281f('0x2f')];var _0x1d0b7c=_0x2993b3?0x0:_0x4a81bf[_0x281f('0x30')];var _0x3f23da=_0x2993b3?_0x3bcdcc['count']:_0x4a81bf[_0x281f('0x30')]+_0x4a81bf[_0x281f('0x2e')];var _0x2eafb7;if(_0x3f23da>=_0x1b5876){_0x3f23da=_0x1b5876;_0x2eafb7=0xc8;}else{_0x2eafb7=0xce;}_0x490174['status'](_0x2eafb7);return _0x490174['set'](_0x281f('0x31'),_0x1d0b7c+'-'+_0x3f23da+'/'+_0x1b5876)[_0x281f('0x2c')](_0x3bcdcc);}return null;};}function patchUpdates(_0x4f713e){return function(_0x239e00){try{jsonpatch[_0x281f('0x32')](_0x239e00,_0x4f713e,!![]);}catch(_0x5946ec){return BPromise[_0x281f('0x33')](_0x5946ec);}return _0x239e00[_0x281f('0x34')]();};}function saveUpdates(_0x51775c,_0x1e6f91){return function(_0x5ed581){if(_0x5ed581){return _0x5ed581[_0x281f('0x35')](_0x51775c)['then'](function(_0x46a24e){return _0x46a24e;});}return null;};}function removeEntity(_0x3bcf04,_0xf01d0){return function(_0x2718a3){if(_0x2718a3){return _0x2718a3[_0x281f('0x36')]()[_0x281f('0x1e')](function(){var _0x8dcba2=_0x2718a3[_0x281f('0x37')]({'plain':!![]});var _0x52adf4=_0x281f('0x38');return db[_0x281f('0x39')]['destroy']({'where':{'type':_0x52adf4,'resourceId':_0x8dcba2['id']}})[_0x281f('0x1e')](function(){return _0x2718a3;});})[_0x281f('0x1e')](function(){_0x3bcf04[_0x281f('0x2a')](0xcc)[_0x281f('0x2b')]();});}};}function handleEntityNotFound(_0x57823f,_0x38a0e9){return function(_0x3588a5){if(!_0x3588a5){_0x57823f[_0x281f('0x29')](0x194);}return _0x3588a5;};}function handleError(_0x4bedaa,_0x12f504){_0x12f504=_0x12f504||0x1f4;return function(_0x241e32){logger[_0x281f('0x24')](_0x241e32[_0x281f('0x3a')]);if(_0x241e32[_0x281f('0x3b')]){delete _0x241e32[_0x281f('0x3b')];}_0x4bedaa['status'](_0x12f504)[_0x281f('0x3c')](_0x241e32);};}exports['index']=function(_0x4b8c1f,_0x2c9a75){var _0x270ac0={'include':[{'model':db[_0x281f('0x3d')],'as':_0x281f('0x3e')}]},_0x218d43={},_0x41d9a8={'count':0x0,'rows':[]};var _0x419362=_[_0x281f('0x3f')](db[_0x281f('0x40')]['rawAttributes'],function(_0x3d17b9){return{'name':_0x3d17b9[_0x281f('0x41')],'type':_0x3d17b9[_0x281f('0x42')][_0x281f('0x43')]};});_0x218d43[_0x281f('0x44')]=_[_0x281f('0x3f')](_0x419362,_0x281f('0x3b'));_0x218d43['query']=_[_0x281f('0x45')](_0x4b8c1f[_0x281f('0x46')]);_0x218d43[_0x281f('0x47')]=_['intersection'](_0x218d43['model'],_0x218d43[_0x281f('0x46')]);_0x270ac0[_0x281f('0x48')]=_['intersection'](_0x218d43[_0x281f('0x44')],qs[_0x281f('0x49')](_0x4b8c1f[_0x281f('0x46')][_0x281f('0x49')]));_0x270ac0['attributes']=_0x270ac0[_0x281f('0x48')][_0x281f('0x4a')]?_0x270ac0[_0x281f('0x48')]:_0x218d43[_0x281f('0x44')];if(!_0x4b8c1f[_0x281f('0x46')]['hasOwnProperty'](_0x281f('0x4b'))){_0x270ac0[_0x281f('0x2e')]=qs[_0x281f('0x2e')](_0x4b8c1f['query'][_0x281f('0x2e')]);_0x270ac0[_0x281f('0x30')]=qs[_0x281f('0x30')](_0x4b8c1f['query'][_0x281f('0x30')]);}_0x270ac0['order']=qs[_0x281f('0x4c')](_0x4b8c1f[_0x281f('0x46')]['sort']);_0x270ac0[_0x281f('0x4d')]=qs[_0x281f('0x47')](_['pick'](_0x4b8c1f[_0x281f('0x46')],_0x218d43[_0x281f('0x47')]),_0x419362);if(_0x4b8c1f['query'][_0x281f('0x4e')]){_0x270ac0['where']=_[_0x281f('0x4f')](_0x270ac0[_0x281f('0x4d')],{'$or':_[_0x281f('0x3f')](_0x419362,function(_0x1a1e03){if(_0x1a1e03[_0x281f('0x42')]!==_0x281f('0x50')){var _0x247d42={};_0x247d42[_0x1a1e03[_0x281f('0x3b')]]={'$like':'%'+_0x4b8c1f[_0x281f('0x46')]['filter']+'%'};return _0x247d42;}})});}_0x270ac0=_[_0x281f('0x4f')]({},_0x270ac0,_0x4b8c1f[_0x281f('0x51')]);var _0x1f19d5={'where':_0x270ac0[_0x281f('0x4d')]};return db[_0x281f('0x40')][_0x281f('0x2f')](_0x1f19d5)['then'](function(_0x4782a5){_0x41d9a8['count']=_0x4782a5;if(_0x4b8c1f['query']['includeAll']){_0x270ac0[_0x281f('0x52')]=[{'all':!![]}];}return db[_0x281f('0x40')][_0x281f('0x53')](_0x270ac0);})[_0x281f('0x1e')](function(_0x46e60d){_0x41d9a8[_0x281f('0x54')]=_0x46e60d;return _0x41d9a8;})[_0x281f('0x1e')](respondWithFilteredResult(_0x2c9a75,_0x270ac0))[_0x281f('0x28')](handleError(_0x2c9a75,null));};exports[_0x281f('0x55')]=function(_0x566d15,_0x4e9542){var _0x4b80b7={'raw':![],'where':{'id':_0x566d15[_0x281f('0x56')]['id']},'include':[{'model':db[_0x281f('0x3d')],'as':'mandatoryDispositionPause'}]},_0x453b52={};_0x453b52[_0x281f('0x44')]=_[_0x281f('0x45')](db['WhatsappAccount'][_0x281f('0x57')]);_0x453b52[_0x281f('0x46')]=_[_0x281f('0x45')](_0x566d15[_0x281f('0x46')]);_0x453b52[_0x281f('0x47')]=_['intersection'](_0x453b52[_0x281f('0x44')],_0x453b52[_0x281f('0x46')]);_0x4b80b7[_0x281f('0x48')]=_['intersection'](_0x453b52[_0x281f('0x44')],qs[_0x281f('0x49')](_0x566d15[_0x281f('0x46')][_0x281f('0x49')]));_0x4b80b7['attributes']=_0x4b80b7[_0x281f('0x48')][_0x281f('0x4a')]?_0x4b80b7[_0x281f('0x48')]:_0x453b52[_0x281f('0x44')];if(_0x566d15['query'][_0x281f('0x58')]){_0x4b80b7[_0x281f('0x52')]=[{'all':!![]}];}_0x4b80b7=_['merge']({},_0x4b80b7,_0x566d15['options']);return db[_0x281f('0x40')][_0x281f('0x59')](_0x4b80b7)[_0x281f('0x1e')](handleEntityNotFound(_0x4e9542,null))[_0x281f('0x1e')](respondWithResult(_0x4e9542,null))[_0x281f('0x28')](handleError(_0x4e9542,null));};exports[_0x281f('0x5a')]=function(_0x169c87,_0x187417){return db['WhatsappAccount'][_0x281f('0x5a')](_0x169c87[_0x281f('0x5b')],{})[_0x281f('0x1e')](function(_0x42e196){var _0x482080=_0x169c87['user'][_0x281f('0x37')]({'plain':!![]});if(!_0x482080)throw new Error(_0x281f('0x5c'));if(_0x482080[_0x281f('0x5d')]==='user'){var _0x4b8557=_0x42e196[_0x281f('0x37')]({'plain':!![]});var _0x2e82ab=_0x281f('0x38');return db[_0x281f('0x5e')][_0x281f('0x59')]({'where':{'name':_0x2e82ab,'userProfileId':_0x482080['userProfileId']},'raw':!![]})[_0x281f('0x1e')](function(_0x22aac7){if(_0x22aac7&&_0x22aac7[_0x281f('0x5f')]===0x0){return db[_0x281f('0x39')][_0x281f('0x5a')]({'name':_0x4b8557[_0x281f('0x3b')],'resourceId':_0x4b8557['id'],'type':_0x22aac7[_0x281f('0x3b')],'sectionId':_0x22aac7['id']},{})['then'](function(){return _0x42e196;});}else{return _0x42e196;}})['catch'](function(_0x1e4c8a){logger['error'](_0x281f('0x60'),_0x1e4c8a);throw _0x1e4c8a;});}return _0x42e196;})['then'](respondWithResult(_0x187417,0xc9))[_0x281f('0x28')](handleError(_0x187417,null));};exports[_0x281f('0x35')]=function(_0x158e99,_0x1b5c99){if(_0x158e99[_0x281f('0x5b')]['id']){delete _0x158e99[_0x281f('0x5b')]['id'];}return db[_0x281f('0x40')][_0x281f('0x59')]({'where':{'id':_0x158e99[_0x281f('0x56')]['id']},'include':[{'model':db[_0x281f('0x3d')],'as':_0x281f('0x3e')}]})[_0x281f('0x1e')](handleEntityNotFound(_0x1b5c99,null))[_0x281f('0x1e')](saveUpdates(_0x158e99[_0x281f('0x5b')],null))[_0x281f('0x1e')](respondWithResult(_0x1b5c99,null))[_0x281f('0x28')](handleError(_0x1b5c99,null));};exports[_0x281f('0x36')]=function(_0x1a6971,_0x29238f){return db[_0x281f('0x40')]['find']({'where':{'id':_0x1a6971[_0x281f('0x56')]['id']}})[_0x281f('0x1e')](handleEntityNotFound(_0x29238f,null))[_0x281f('0x1e')](removeEntity(_0x29238f,null))[_0x281f('0x28')](handleError(_0x29238f,null));};exports[_0x281f('0x61')]=function(_0x42aa25,_0x3d42f9){return db[_0x281f('0x40')]['describe']()[_0x281f('0x1e')](respondWithResult(_0x3d42f9,null))[_0x281f('0x28')](handleError(_0x3d42f9,null));};exports[_0x281f('0x62')]=function(_0x2fdaeb,_0x3e3a5c,_0x8b788a){if(_0x2fdaeb[_0x281f('0x5b')]['id']){delete _0x2fdaeb['body']['id'];}return db[_0x281f('0x40')][_0x281f('0x59')]({'where':{'id':_0x2fdaeb[_0x281f('0x56')]['id']}})[_0x281f('0x1e')](handleEntityNotFound(_0x3e3a5c,null))[_0x281f('0x1e')](function(_0x4674c0){if(_0x4674c0){_0x2fdaeb[_0x281f('0x5b')][_0x281f('0x63')]=_0x4674c0['id'];return db['Disposition'][_0x281f('0x5a')](_0x2fdaeb[_0x281f('0x5b')]);}})['then'](respondWithResult(_0x3e3a5c,null))['catch'](handleError(_0x3e3a5c,null));};exports[_0x281f('0x64')]=function(_0x794628,_0x3978e4,_0x4d92cf){var _0x47121a={'raw':![],'where':{}};var _0x278441={};var _0x2cda36={'count':0x0,'rows':[]};return db[_0x281f('0x40')][_0x281f('0x65')]({'where':{'id':_0x794628[_0x281f('0x56')]['id']}})[_0x281f('0x1e')](handleEntityNotFound(_0x3978e4,null))['then'](function(_0x1227b6){if(_0x1227b6){_0x278441[_0x281f('0x44')]=_['keys'](db[_0x281f('0x66')][_0x281f('0x57')]);_0x278441[_0x281f('0x46')]=_[_0x281f('0x45')](_0x794628[_0x281f('0x46')]);_0x278441[_0x281f('0x47')]=_['intersection'](_0x278441['model'],_0x278441['query']);_0x47121a[_0x281f('0x48')]=_[_0x281f('0x67')](_0x278441[_0x281f('0x44')],qs[_0x281f('0x49')](_0x794628['query'][_0x281f('0x49')]));_0x47121a[_0x281f('0x48')]=_0x47121a[_0x281f('0x48')][_0x281f('0x4a')]?_0x47121a['attributes']:_0x278441['model'];if(!_0x794628['query'][_0x281f('0x68')]('nolimit')){_0x47121a[_0x281f('0x2e')]=qs[_0x281f('0x2e')](_0x794628['query'][_0x281f('0x2e')]);_0x47121a['offset']=qs['offset'](_0x794628[_0x281f('0x46')][_0x281f('0x30')]);}_0x47121a[_0x281f('0x69')]=qs[_0x281f('0x4c')](_0x794628['query']['sort']);_0x47121a[_0x281f('0x4d')]=qs[_0x281f('0x47')](_[_0x281f('0x6a')](_0x794628[_0x281f('0x46')],_0x278441[_0x281f('0x47')]));_0x47121a['where'][_0x281f('0x63')]=_0x1227b6['id'];if(_0x794628['query']['filter']){_0x47121a['where']=_[_0x281f('0x4f')](_0x47121a[_0x281f('0x4d')],{'$or':_[_0x281f('0x3f')](_0x47121a['attributes'],function(_0x49039f){var _0x494703={};_0x494703[_0x49039f]={'$like':'%'+_0x794628['query'][_0x281f('0x4e')]+'%'};return _0x494703;})});}_0x47121a=_['merge']({},_0x47121a,_0x794628[_0x281f('0x51')]);return db[_0x281f('0x66')]['count']({'where':_0x47121a['where']})[_0x281f('0x1e')](function(_0x4cc326){_0x2cda36[_0x281f('0x2f')]=_0x4cc326;if(_0x794628[_0x281f('0x46')][_0x281f('0x58')]){_0x47121a[_0x281f('0x52')]=[{'all':!![]}];}return db[_0x281f('0x66')][_0x281f('0x53')](_0x47121a);})[_0x281f('0x1e')](function(_0x30a80d){_0x2cda36[_0x281f('0x54')]=_0x30a80d;return _0x2cda36;});}})['then'](respondWithFilteredResult(_0x3978e4,_0x47121a))['catch'](handleError(_0x3978e4,null));};exports[_0x281f('0x6b')]=function(_0x1a05c5,_0x4ba523,_0x405495){return db[_0x281f('0x40')][_0x281f('0x59')]({'where':{'id':_0x1a05c5[_0x281f('0x56')]['id']}})[_0x281f('0x1e')](handleEntityNotFound(_0x4ba523,null))['then'](function(_0x4c7803){if(_0x4c7803){return _0x4c7803[_0x281f('0x6b')](_0x1a05c5[_0x281f('0x46')][_0x281f('0x6c')]);}})[_0x281f('0x1e')](respondWithStatusCode(_0x4ba523,null))[_0x281f('0x28')](handleError(_0x4ba523,null));};exports[_0x281f('0x6d')]=function(_0x192261,_0x10ee79,_0x5dc620){if(_0x192261[_0x281f('0x5b')]['id']){delete _0x192261['body']['id'];}return db[_0x281f('0x40')][_0x281f('0x59')]({'where':{'id':_0x192261['params']['id']}})[_0x281f('0x1e')](handleEntityNotFound(_0x10ee79,null))['then'](function(_0x373fa7){if(_0x373fa7){_0x192261[_0x281f('0x5b')][_0x281f('0x63')]=_0x373fa7['id'];return db[_0x281f('0x6e')][_0x281f('0x5a')](_0x192261[_0x281f('0x5b')]);}})[_0x281f('0x1e')](respondWithResult(_0x10ee79,null))[_0x281f('0x28')](handleError(_0x10ee79,null));};exports[_0x281f('0x6f')]=function(_0x7a85ed,_0x324e0a,_0xd709bd){var _0x3eee8a={'raw':![],'where':{}};var _0x4ca85f={};var _0x2827f1={'count':0x0,'rows':[]};return db[_0x281f('0x40')][_0x281f('0x65')]({'where':{'id':_0x7a85ed['params']['id']}})[_0x281f('0x1e')](handleEntityNotFound(_0x324e0a,null))[_0x281f('0x1e')](function(_0x51cb4f){if(_0x51cb4f){_0x4ca85f['model']=_[_0x281f('0x45')](db['CannedAnswer'][_0x281f('0x57')]);_0x4ca85f[_0x281f('0x46')]=_['keys'](_0x7a85ed['query']);_0x4ca85f[_0x281f('0x47')]=_[_0x281f('0x67')](_0x4ca85f['model'],_0x4ca85f['query']);_0x3eee8a[_0x281f('0x48')]=_[_0x281f('0x67')](_0x4ca85f['model'],qs['fields'](_0x7a85ed[_0x281f('0x46')][_0x281f('0x49')]));_0x3eee8a['attributes']=_0x3eee8a['attributes'][_0x281f('0x4a')]?_0x3eee8a[_0x281f('0x48')]:_0x4ca85f[_0x281f('0x44')];if(!_0x7a85ed[_0x281f('0x46')][_0x281f('0x68')](_0x281f('0x4b'))){_0x3eee8a[_0x281f('0x2e')]=qs['limit'](_0x7a85ed[_0x281f('0x46')]['limit']);_0x3eee8a[_0x281f('0x30')]=qs[_0x281f('0x30')](_0x7a85ed[_0x281f('0x46')][_0x281f('0x30')]);}_0x3eee8a[_0x281f('0x69')]=qs[_0x281f('0x4c')](_0x7a85ed['query'][_0x281f('0x4c')]);_0x3eee8a[_0x281f('0x4d')]=qs[_0x281f('0x47')](_[_0x281f('0x6a')](_0x7a85ed[_0x281f('0x46')],_0x4ca85f[_0x281f('0x47')]));_0x3eee8a[_0x281f('0x4d')]['WhatsappAccountId']=_0x51cb4f['id'];if(_0x7a85ed['query'][_0x281f('0x4e')]){_0x3eee8a[_0x281f('0x4d')]=_[_0x281f('0x4f')](_0x3eee8a['where'],{'$or':_[_0x281f('0x3f')](_0x3eee8a[_0x281f('0x48')],function(_0x4a804b){var _0x205e7e={};_0x205e7e[_0x4a804b]={'$like':'%'+_0x7a85ed[_0x281f('0x46')][_0x281f('0x4e')]+'%'};return _0x205e7e;})});}_0x3eee8a=_[_0x281f('0x4f')]({},_0x3eee8a,_0x7a85ed[_0x281f('0x51')]);return db[_0x281f('0x6e')][_0x281f('0x2f')]({'where':_0x3eee8a[_0x281f('0x4d')]})[_0x281f('0x1e')](function(_0xfa551f){_0x2827f1[_0x281f('0x2f')]=_0xfa551f;if(_0x7a85ed[_0x281f('0x46')]['includeAll']){_0x3eee8a[_0x281f('0x52')]=[{'all':!![]}];}return db[_0x281f('0x6e')]['findAll'](_0x3eee8a);})[_0x281f('0x1e')](function(_0x256b5c){_0x2827f1[_0x281f('0x54')]=_0x256b5c;return _0x2827f1;});}})[_0x281f('0x1e')](respondWithFilteredResult(_0x324e0a,_0x3eee8a))[_0x281f('0x28')](handleError(_0x324e0a,null));};exports[_0x281f('0x70')]=function(_0x2d7b41,_0x192237,_0x325abe){return db[_0x281f('0x40')]['find']({'where':{'id':_0x2d7b41[_0x281f('0x56')]['id']}})[_0x281f('0x1e')](handleEntityNotFound(_0x192237,null))[_0x281f('0x1e')](function(_0x140537){if(_0x140537){return _0x140537['removeAnswers'](_0x2d7b41[_0x281f('0x46')][_0x281f('0x6c')]);}})[_0x281f('0x1e')](respondWithStatusCode(_0x192237,null))[_0x281f('0x28')](handleError(_0x192237,null));};exports[_0x281f('0x71')]=function(_0x5a2ec1,_0x3c1701,_0x4c95d5){return db[_0x281f('0x40')][_0x281f('0x59')]({'where':{'id':_0x5a2ec1['params']['id']}})[_0x281f('0x1e')](handleEntityNotFound(_0x3c1701,null))[_0x281f('0x1e')](function(_0x3adf01){if(_0x3adf01){return _0x3adf01['addAgents'](_0x5a2ec1[_0x281f('0x5b')][_0x281f('0x6c')],_['omit'](_0x5a2ec1[_0x281f('0x5b')],[_0x281f('0x6c'),'id'])||{})['spread'](function(_0x3bd525){for(var _0x363118=0x0;_0x363118<_0x5a2ec1[_0x281f('0x5b')][_0x281f('0x6c')]['length'];_0x363118+=0x1){socket[_0x281f('0x72')](_0x281f('0x73'),{'UserId':Number(_0x5a2ec1['body'][_0x281f('0x6c')][_0x363118]),'WhatsappAccountId':Number(_0x5a2ec1[_0x281f('0x56')]['id'])});}return _0x3bd525;});}})[_0x281f('0x1e')](respondWithResult(_0x3c1701,null))['catch'](handleError(_0x3c1701,null));};exports[_0x281f('0x74')]=function(_0x177e9c,_0x186439,_0x92fd6f){return db[_0x281f('0x40')][_0x281f('0x59')]({'where':{'id':_0x177e9c[_0x281f('0x56')]['id']}})['then'](handleEntityNotFound(_0x186439,null))[_0x281f('0x1e')](function(_0x2832f3){if(_0x2832f3){return _0x2832f3[_0x281f('0x74')](_0x177e9c['query'][_0x281f('0x6c')])[_0x281f('0x1e')](function(){if(_[_0x281f('0x75')](_0x177e9c[_0x281f('0x46')][_0x281f('0x6c')])){for(var _0x224697=0x0;_0x224697<_0x177e9c[_0x281f('0x46')][_0x281f('0x6c')][_0x281f('0x4a')];_0x224697+=0x1){socket[_0x281f('0x72')](_0x281f('0x76'),{'UserId':Number(_0x177e9c[_0x281f('0x46')][_0x281f('0x6c')][_0x224697]),'WhatsappAccountId':Number(_0x177e9c[_0x281f('0x56')]['id'])});}}else{socket['emit'](_0x281f('0x76'),{'UserId':Number(_0x177e9c[_0x281f('0x46')][_0x281f('0x6c')]),'WhatsappAccountId':Number(_0x177e9c[_0x281f('0x56')]['id'])});}});}})[_0x281f('0x1e')](respondWithStatusCode(_0x186439,null))[_0x281f('0x28')](handleError(_0x186439,null));};exports[_0x281f('0x77')]=function(_0x19f28a,_0x28bdbb,_0x440f5c){var _0x5db7f1={};var _0x301199={};var _0x63d868;var _0x4bfaf6;return db[_0x281f('0x40')][_0x281f('0x65')]({'where':{'id':_0x19f28a[_0x281f('0x56')]['id']}})['then'](handleEntityNotFound(_0x28bdbb,null))[_0x281f('0x1e')](function(_0x1bb0cc){if(_0x1bb0cc){_0x63d868=_0x1bb0cc;_0x301199['model']=_[_0x281f('0x45')](db[_0x281f('0x78')]['rawAttributes']);_0x301199[_0x281f('0x46')]=_['keys'](_0x19f28a[_0x281f('0x46')]);_0x301199['filters']=_[_0x281f('0x67')](_0x301199[_0x281f('0x44')],_0x301199['query']);_0x5db7f1[_0x281f('0x48')]=_[_0x281f('0x67')](_0x301199[_0x281f('0x44')],qs[_0x281f('0x49')](_0x19f28a['query'][_0x281f('0x49')]));_0x5db7f1[_0x281f('0x48')]=_0x5db7f1[_0x281f('0x48')][_0x281f('0x4a')]?_0x5db7f1['attributes']:_0x301199[_0x281f('0x44')];_0x5db7f1[_0x281f('0x69')]=qs['sort'](_0x19f28a[_0x281f('0x46')][_0x281f('0x4c')]);_0x5db7f1[_0x281f('0x4d')]=qs[_0x281f('0x47')](_[_0x281f('0x6a')](_0x19f28a['query'],_0x301199[_0x281f('0x47')]));if(_0x19f28a[_0x281f('0x46')][_0x281f('0x4e')]){_0x5db7f1[_0x281f('0x4d')]=_[_0x281f('0x4f')](_0x5db7f1[_0x281f('0x4d')],{'$or':_[_0x281f('0x3f')](_0x5db7f1[_0x281f('0x48')],function(_0x5474f9){var _0x5e2e1a={};_0x5e2e1a[_0x5474f9]={'$like':'%'+_0x19f28a[_0x281f('0x46')][_0x281f('0x4e')]+'%'};return _0x5e2e1a;})});}_0x5db7f1=_[_0x281f('0x4f')]({},_0x5db7f1,_0x19f28a[_0x281f('0x51')]);return _0x63d868[_0x281f('0x77')](_0x5db7f1);}})[_0x281f('0x1e')](function(_0x5a7abb){if(_0x5a7abb){_0x4bfaf6=_0x5a7abb[_0x281f('0x4a')];if(!_0x19f28a[_0x281f('0x46')][_0x281f('0x68')]('nolimit')){_0x5db7f1[_0x281f('0x2e')]=qs[_0x281f('0x2e')](_0x19f28a[_0x281f('0x46')]['limit']);_0x5db7f1[_0x281f('0x30')]=qs[_0x281f('0x30')](_0x19f28a['query'][_0x281f('0x30')]);}return _0x63d868[_0x281f('0x77')](_0x5db7f1);}})['then'](function(_0x225af2){if(_0x225af2){return _0x225af2?{'count':_0x4bfaf6,'rows':_0x225af2}:null;}})[_0x281f('0x1e')](respondWithResult(_0x28bdbb,null))['catch'](handleError(_0x28bdbb,null));};exports[_0x281f('0x79')]=function(_0x3dbad5,_0x331d3b){var _0x5033f6=_0x3dbad5['params']['id'];var _0x492595=_0x3dbad5[_0x281f('0x5b')];var _0x49477e=0xc8;var _0x5d957e=null;return db['sequelize'][_0x281f('0x7a')]({'isolationLevel':db[_0x281f('0x7b')][_0x281f('0x7c')][_0x281f('0x7d')][_0x281f('0x7e')]},function(_0x4ff58a){return db['WhatsappAccount'][_0x281f('0x65')]({'where':{'id':_0x5033f6},'transaction':_0x4ff58a})[_0x281f('0x1e')](function(_0x208a5a){if(_0x208a5a){return db['WhatsappApplication'][_0x281f('0x36')]({'where':{'WhatsappAccountId':_0x5033f6},'transaction':_0x4ff58a})[_0x281f('0x1e')](function(){var _0x8a795c=_[_0x281f('0x3f')](_0x492595,function(_0x1be586){_0x1be586[_0x281f('0x63')]=_0x5033f6;return _0x1be586;});return db[_0x281f('0x7f')][_0x281f('0x80')](_0x8a795c,{'transaction':_0x4ff58a});});}else{_0x49477e=0x194;_0x5d957e=[];}});})[_0x281f('0x1e')](function(){if(_0x49477e!==0x194){return db[_0x281f('0x7f')][_0x281f('0x81')]({'where':{'WhatsappAccountId':_0x5033f6},'order':'priority'})['then'](function(_0xb5a6b1){_0x5d957e=_0xb5a6b1;});}})[_0x281f('0x28')](function(_0x7e6466){_0x49477e=0x1f4;logger[_0x281f('0x24')](_0x7e6466[_0x281f('0x3a')]);if(_0x7e6466['name']){delete _0x7e6466['name'];}_0x5d957e=_0x7e6466;})[_0x281f('0x82')](function(){if(_0x5d957e===null){_0x331d3b[_0x281f('0x29')](_0x49477e);}else{if(_0x49477e===0x1f4){_0x331d3b['status'](_0x49477e)[_0x281f('0x3c')](_0x5d957e);}else{_0x331d3b[_0x281f('0x2a')](_0x49477e)[_0x281f('0x2c')](_0x5d957e);}}});};exports[_0x281f('0x83')]=function(_0x2d275e,_0x57cc65,_0x59bba6){var _0x41a938={};var _0x199752={};var _0x5e672e;var _0xd98485;return db['WhatsappAccount'][_0x281f('0x65')]({'where':{'id':_0x2d275e[_0x281f('0x56')]['id']}})['then'](handleEntityNotFound(_0x57cc65,null))['then'](function(_0x3cd2bc){if(_0x3cd2bc){_0x5e672e=_0x3cd2bc;_0x199752[_0x281f('0x44')]=_[_0x281f('0x45')](db[_0x281f('0x7f')][_0x281f('0x57')]);_0x199752[_0x281f('0x46')]=_[_0x281f('0x45')](_0x2d275e[_0x281f('0x46')]);_0x199752[_0x281f('0x47')]=_[_0x281f('0x67')](_0x199752[_0x281f('0x44')],_0x199752[_0x281f('0x46')]);_0x41a938[_0x281f('0x48')]=_[_0x281f('0x67')](_0x199752[_0x281f('0x44')],qs[_0x281f('0x49')](_0x2d275e[_0x281f('0x46')][_0x281f('0x49')]));_0x41a938[_0x281f('0x48')]=_0x41a938[_0x281f('0x48')][_0x281f('0x4a')]?_0x41a938[_0x281f('0x48')]:_0x199752['model'];_0x41a938[_0x281f('0x69')]=qs[_0x281f('0x4c')](_0x2d275e['query'][_0x281f('0x4c')]);_0x41a938[_0x281f('0x4d')]=qs['filters'](_[_0x281f('0x6a')](_0x2d275e[_0x281f('0x46')],_0x199752[_0x281f('0x47')]));if(_0x2d275e[_0x281f('0x46')]['filter']){_0x41a938[_0x281f('0x4d')]=_['merge'](_0x41a938['where'],{'$or':_[_0x281f('0x3f')](_0x41a938[_0x281f('0x48')],function(_0x19cd06){var _0xa4871f={};_0xa4871f[_0x19cd06]={'$like':'%'+_0x2d275e[_0x281f('0x46')]['filter']+'%'};return _0xa4871f;})});}_0x41a938=_[_0x281f('0x4f')]({},_0x41a938,_0x2d275e[_0x281f('0x51')]);return _0x5e672e[_0x281f('0x83')](_0x41a938);}})['then'](function(_0x53cc3a){if(_0x53cc3a){_0xd98485=_0x53cc3a['length'];if(!_0x2d275e['query'][_0x281f('0x68')](_0x281f('0x4b'))){_0x41a938[_0x281f('0x2e')]=qs[_0x281f('0x2e')](_0x2d275e[_0x281f('0x46')]['limit']);_0x41a938[_0x281f('0x30')]=qs[_0x281f('0x30')](_0x2d275e[_0x281f('0x46')][_0x281f('0x30')]);}return _0x5e672e[_0x281f('0x83')](_0x41a938);}})[_0x281f('0x1e')](function(_0x17e53b){if(_0x17e53b){return _0x17e53b?{'count':_0xd98485,'rows':_0x17e53b}:null;}})[_0x281f('0x1e')](respondWithResult(_0x57cc65,null))['catch'](handleError(_0x57cc65,null));};exports[_0x281f('0x84')]=function(_0x29c055,_0x13de1d,_0x3650f5){var _0x408ab5={'channel':_0x281f('0x85')};var _0x52d583=[];var _0x42df40=[];var _0x1576a8={};return db[_0x281f('0x40')][_0x281f('0x59')]({'where':{'id':_0x29c055[_0x281f('0x56')]['id']},'include':[{'model':db[_0x281f('0x7f')],'as':'Applications'}]})[_0x281f('0x1e')](handleEntityNotFound(_0x13de1d,null))[_0x281f('0x1e')](function(_0xea5cc8){_0x408ab5[_0x281f('0x86')]=_0xea5cc8;if(_0x408ab5[_0x281f('0x86')]&&_0x408ab5['account']['type']==='sinch'&&_0x29c055[_0x281f('0x5b')][_0x281f('0x87')]){if(_0x29c055[_0x281f('0x5b')][_0x281f('0x87')][_0x281f('0x4a')]===0x0)return;if(_0x29c055[_0x281f('0x5b')]['statuses'][0x0]['state']!==_0x281f('0x88'))return;return db[_0x281f('0x89')][_0x281f('0x35')]({'read':!![],'readAt':_0x29c055[_0x281f('0x5b')][_0x281f('0x87')][0x0][_0x281f('0x8a')]},{'where':{'messageId':_0x29c055[_0x281f('0x5b')]['statuses'][0x0][_0x281f('0x8b')]},'individualHooks':!![]})[_0x281f('0x1e')](function(_0x6077af){return _0x13de1d[_0x281f('0x2a')](0xc8)[_0x281f('0x2c')](_0x6077af);});}_0x408ab5[_0x281f('0x8c')]=_[_0x281f('0x8d')](_0xea5cc8[_0x281f('0x8e')],[_0x281f('0x8f')],[_0x281f('0x90')]);if(_0x408ab5[_0x281f('0x86')][_0x281f('0x8e')]){delete _0x408ab5[_0x281f('0x86')][_0x281f('0x8e')];}return db[_0x281f('0x91')][_0x281f('0x61')]()[_0x281f('0x1e')](function(_0x4bf2a3){if(!_0x4bf2a3){throw new db[(_0x281f('0x92'))][(_0x281f('0x93'))]('no\x20available\x20attributes');}_0x52d583=_[_0x281f('0x94')](_['keys'](_0x4bf2a3),[_0x281f('0x95'),_0x281f('0x96')]);_0x42df40=_[_0x281f('0x94')](_[_0x281f('0x45')](_0x4bf2a3),['createdAt',_0x281f('0x96'),'CompanyId',_0x281f('0x97')]);_0x408ab5['body']={'mapKey':_0x281f('0x98')};if(_0x408ab5[_0x281f('0x86')]&&_0x408ab5[_0x281f('0x86')][_0x281f('0x42')]===_0x281f('0x99')){_0x408ab5[_0x281f('0x5b')][_0x281f('0x9a')]=_0x29c055[_0x281f('0x5b')][_0x281f('0x9b')][_0x281f('0x9c')]('whatsapp:','');_0x408ab5[_0x281f('0x5b')][_0x281f('0x5b')]=_0x29c055['body'][_0x281f('0x9d')];_0x408ab5[_0x281f('0x5b')]['messageId']=_0x29c055['body']['MessageSid'];}if(_0x408ab5[_0x281f('0x86')]&&_0x408ab5[_0x281f('0x86')][_0x281f('0x42')]===_0x281f('0x9e')){_0x408ab5[_0x281f('0x5b')][_0x281f('0x9a')]=_0x29c055['body'][_0x281f('0x9f')][0x0][_0x281f('0x9a')];_0x408ab5['body'][_0x281f('0x5b')]=_0x29c055[_0x281f('0x5b')][_0x281f('0x9f')][0x0][_0x281f('0x25')]['body'];_0x408ab5[_0x281f('0x5b')][_0x281f('0xa0')]=_0x29c055[_0x281f('0x5b')][_0x281f('0x9f')][0x0][_0x281f('0x8b')];}if(_0x408ab5[_0x281f('0x5b')]['id']){delete _0x408ab5[_0x281f('0x5b')]['id'];}if(_[_0x281f('0xa1')](_0x408ab5['body'][_0x281f('0x9a')])){throw new db['Sequelize'][(_0x281f('0x93'))](_0x281f('0xa2'));}if(_[_0x281f('0xa1')](_0x408ab5[_0x281f('0x5b')][_0x281f('0x5b')])||_0x408ab5[_0x281f('0x5b')][_0x281f('0x5b')]===''){throw new db[(_0x281f('0x92'))][(_0x281f('0x93'))](_0x281f('0xa3'));}if(_[_0x281f('0xa1')](_0x408ab5[_0x281f('0x5b')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x42df40);}if(!_['includes'](_0x42df40,_0x408ab5[_0x281f('0x5b')][_0x281f('0xa4')])){throw new db[(_0x281f('0x92'))][(_0x281f('0x93'))](_0x281f('0xa5')+_0x42df40);}_0x1576a8[_0x408ab5[_0x281f('0x5b')]['mapKey']]=_0x408ab5[_0x281f('0x5b')]['from'];return db[_0x281f('0xa6')]['find']({'where':{'id':_0x408ab5[_0x281f('0x86')][_0x281f('0x97')]},'include':[{'model':db[_0x281f('0x91')],'as':'Contacts','where':_0x1576a8,'limit':0x1,'order':[[_0x281f('0x96'),'DESC']]}]});})[_0x281f('0x1e')](handleEntityNotFound(_0x13de1d,null))[_0x281f('0x1e')](function(_0x539235){if(_0x539235){_0x408ab5[_0x281f('0xa7')]=_[_0x281f('0xa8')](_0x539235,['Contacts']);if(_0x539235[_0x281f('0xa9')][_0x281f('0x4a')]){return _0x539235[_0x281f('0xa9')][0x0];}var _0x32ed44=_[_0x281f('0xaa')](_0x408ab5[_0x281f('0x5b')],{'firstName':_0x408ab5[_0x281f('0x5b')]['from'],'ListId':_0x539235['id']});_0x32ed44[_0x408ab5['body'][_0x281f('0xa4')]]=_0x408ab5[_0x281f('0x5b')][_0x281f('0x9a')];return db['CmContact']['create'](_0x32ed44,{'fields':_0x52d583,'raw':!![]});}})[_0x281f('0x1e')](handleEntityNotFound(_0x13de1d,null))['then'](function(_0x1aa543){if(_0x1aa543){_0x408ab5[_0x281f('0xab')]=_0x1aa543;var _0x420e5a={'ContactId':_0x1aa543['id'],'phone':_0x408ab5[_0x281f('0x5b')][_0x281f('0x9a')],'WhatsappAccountId':_0x29c055[_0x281f('0x56')]['id']};var _0x5ee939={'ContactId':_0x1aa543['id'],'WhatsappAccountId':_0x29c055['params']['id'],'closed':![]};return db[_0x281f('0xac')][_0x281f('0x59')]({'where':_0x5ee939})[_0x281f('0x1e')](function(_0x20c8e9){if(_0x20c8e9){return[_0x20c8e9,![]];}return db[_0x281f('0xac')][_0x281f('0x5a')](_0x420e5a)[_0x281f('0x1e')](function(_0x157d0f){return[_0x157d0f,!![]];});});}})[_0x281f('0xad')](function(_0xc7254d,_0x2964d9){_0x408ab5[_0x281f('0xae')]=_0xc7254d[_0x281f('0x37')]({'plain':!![]});_0x408ab5['interaction']['created']=![];if(_0x2964d9){if(_0x408ab5[_0x281f('0x86')][_0x281f('0xaf')]){_0x408ab5['applications'][_0x281f('0xb0')]({'id':0x0,'priority':_0x408ab5[_0x281f('0x8c')]['length']+0x1,'app':_0x281f('0xb1'),'appdata':'unmanaged','interval':_0x281f('0xb2')});}_0x408ab5[_0x281f('0xae')][_0x281f('0xb3')]=!![];}return db[_0x281f('0x89')][_0x281f('0x5a')]({'phone':_0x408ab5[_0x281f('0x5b')]['from'],'messageId':_0x408ab5['body'][_0x281f('0xa0')],'body':_0x408ab5['body'][_0x281f('0x5b')],'WhatsappAccountId':_0x29c055[_0x281f('0x56')]['id'],'WhatsappInteractionId':_0xc7254d['id'],'direction':'in','ContactId':_0xc7254d[_0x281f('0xb4')],'AttachmentId':_0x408ab5[_0x281f('0x5b')][_0x281f('0xb5')]});})['then'](function(_0xddafc9){_0x408ab5[_0x281f('0x25')]=_0xddafc9;if(_0x408ab5[_0x281f('0xae')][_0x281f('0xb6')]){return db[_0x281f('0x78')][_0x281f('0x59')]({'attributes':['id',_0x281f('0x3b')],'where':{'id':_0x408ab5[_0x281f('0xae')][_0x281f('0xb6')]}})[_0x281f('0x1e')](function(_0x327a5a){if(_0x327a5a){_0x408ab5[_0x281f('0x8c')][_0x281f('0xb7')]({'id':0x0,'priority':0x0,'app':_0x281f('0xb8'),'appdata':_0x327a5a['name']+','+(_0x408ab5[_0x281f('0x86')][_0x281f('0xb9')]||0xa),'interval':_0x281f('0xb2')});}return respondWithRpcPromise(_0x281f('0xba'),_0x281f('0xbb'),_0x408ab5);});}return respondWithRpcPromise(_0x281f('0xba'),'startRouting',_0x408ab5);})['then'](function(_0x5182cf){if(_0x5182cf){var _0x47bb6f=0xc8;var _0x561f6f=_0x281f('0xbc');logger['info'](_0x281f('0x22'),_0x561f6f,_0x47bb6f,_0x281f('0xbd'));logger[_0x281f('0x21')](_0x281f('0xbe'),_0x561f6f,_0x47bb6f,'entity\x20found',JSON[_0x281f('0x23')](_0x5182cf));if(_0x408ab5[_0x281f('0x86')][_0x281f('0x42')]===_0x281f('0x99')){return _0x13de1d['status'](_0x47bb6f)[_0x281f('0xbf')](_0x281f('0xc0'),_0x281f('0xc1'))[_0x281f('0x3c')]('\x0a');}else{return _0x13de1d[_0x281f('0x2a')](_0x47bb6f)[_0x281f('0x2c')](_0x5182cf);}}});})[_0x281f('0x28')](handleError(_0x13de1d,null));};exports['send']=function(_0x1e504f,_0x20d3b4,_0x20327d){var _0x51e192,_0x67f892,_0x3c2978;if(_[_0x281f('0xa1')](_0x1e504f['body'][_0x281f('0x5b')])||_0x1e504f['body']['body']===''){throw new db[(_0x281f('0x92'))][(_0x281f('0x93'))](_0x281f('0xa3'));}if(_[_0x281f('0xa1')](_0x1e504f[_0x281f('0x5b')]['to'])){throw new db[(_0x281f('0x92'))][(_0x281f('0x93'))](_0x281f('0xc2'));}_0x51e192=_0x1e504f['body']['to'];return db[_0x281f('0x40')][_0x281f('0x59')]({'where':{'id':_0x1e504f[_0x281f('0x56')]['id']},'include':[{'model':db[_0x281f('0xa6')],'as':_0x281f('0xc3'),'include':[{'model':db[_0x281f('0x91')],'as':_0x281f('0xa9'),'where':{'mobile':_0x51e192},'limit':0x1,'order':[[_0x281f('0x96'),_0x281f('0xc4')]]}]}]})[_0x281f('0x1e')](handleEntityNotFound(_0x20d3b4,null))[_0x281f('0x1e')](function(_0x539b7b){if(_0x539b7b&&_0x539b7b[_0x281f('0xc3')]){_0x67f892=_0x539b7b[_0x281f('0x37')]({'plain':!![]});if(_0x67f892[_0x281f('0xc3')]&&_0x67f892[_0x281f('0xc3')][_0x281f('0xa9')][_0x281f('0x4a')]){return _0x67f892['List'][_0x281f('0xa9')][0x0];}return db[_0x281f('0x91')][_0x281f('0x5a')](_[_0x281f('0xaa')](_0x1e504f['body'],{'firstName':_0x51e192,'mobile':_0x51e192,'phone':_0x51e192,'ListId':_0x67f892[_0x281f('0x97')]}));}})['then'](handleEntityNotFound(_0x20d3b4,null))['then'](function(_0x278343){if(_0x278343){_0x3c2978=_0x278343;return db[_0x281f('0xac')]['find']({'where':{'ContactId':_0x3c2978['id'],'closed':![],'WhatsappAccountId':_0x67f892['id']}})[_0x281f('0x1e')](function(_0x2099f4){if(_0x2099f4){return[_0x2099f4,![]];}return db[_0x281f('0xac')][_0x281f('0x5a')]({'UserId':_0x1e504f['user']['id'],'ContactId':_0x3c2978['id'],'WhatsappAccountId':_0x67f892['id'],'phone':_0x51e192,'firstMsgDirection':_0x281f('0xc5'),'Messages':[_[_0x281f('0x4f')](_0x1e504f[_0x281f('0x5b')],{'read':![],'body':_0x1e504f[_0x281f('0x5b')]['body'],'phone':_0x51e192,'WhatsappAccountId':_0x67f892['id'],'UserId':_0x1e504f[_0x281f('0xc6')]['id'],'ContactId':_0x3c2978['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x281f('0xc7')}]})['then'](function(_0xe810cf){return[_0xe810cf,!![]];});});}})[_0x281f('0xad')](function(_0x58bdd9,_0x1aad5b){if(_0x1aad5b){return _0x58bdd9;}return db[_0x281f('0x89')][_0x281f('0x5a')](_['merge'](_0x1e504f[_0x281f('0x5b')],{'read':![],'body':_0x1e504f['body'][_0x281f('0x5b')],'phone':_0x51e192,'WhatsappAccountId':_0x67f892['id'],'WhatsappInteractionId':_0x58bdd9['id'],'UserId':_0x1e504f[_0x281f('0xc6')]['id'],'ContactId':_0x3c2978['id']}))[_0x281f('0x1e')](function(_0x1da0f5){_0x58bdd9[_0x281f('0xc8')][_0x281f('0xc7')]=[];_0x58bdd9['dataValues'][_0x281f('0xc7')][_0x281f('0xb0')](_0x1da0f5[_0x281f('0xc8')]);return _0x58bdd9;});})['then'](respondWithResult(_0x20d3b4,null))[_0x281f('0x28')](handleError(_0x20d3b4,null));}; \ No newline at end of file +var _0x60c1=['asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','list','CmContact','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','unmanaged','WhatsappMessage','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','stack','finally','getApplications','whatsapp','account','sinch','statuses','state','timestamp','applications','orderBy','Applications'];(function(_0x284096,_0x5af6ef){var _0x2fefdb=function(_0x11e911){while(--_0x11e911){_0x284096['push'](_0x284096['shift']());}};_0x2fefdb(++_0x5af6ef);}(_0x60c1,0x103));var _0x160c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x60c1[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x160c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x160c('0x1'));var jsonpatch=require(_0x160c('0x2'));var rp=require(_0x160c('0x3'));var moment=require(_0x160c('0x4'));var BPromise=require(_0x160c('0x5'));var Mustache=require(_0x160c('0x6'));var util=require(_0x160c('0x7'));var path=require(_0x160c('0x8'));var sox=require(_0x160c('0x9'));var csv=require(_0x160c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x160c('0xb'));var _=require(_0x160c('0xc'));var squel=require(_0x160c('0xd'));var crypto=require(_0x160c('0xe'));var jsforce=require(_0x160c('0xf'));var deskjs=require(_0x160c('0x10'));var toCsv=require(_0x160c('0xa'));var querystring=require(_0x160c('0x11'));var Papa=require(_0x160c('0x12'));var Redis=require('ioredis');var authService=require(_0x160c('0x13'));var qs=require(_0x160c('0x14'));var as=require(_0x160c('0x15'));var hardwareService=require(_0x160c('0x16'));var logger=require(_0x160c('0x17'))(_0x160c('0x18'));var utils=require(_0x160c('0x19'));var config=require(_0x160c('0x1a'));var licenseUtil=require(_0x160c('0x1b'));var db=require(_0x160c('0x1c'))['db'];config[_0x160c('0x1d')]=_[_0x160c('0x1e')](config[_0x160c('0x1d')],{'host':_0x160c('0x1f'),'port':0x18eb});var socket=require(_0x160c('0x20'))(new Redis(config[_0x160c('0x1d')]));require(_0x160c('0x21'))[_0x160c('0x22')](socket);var jayson=require('jayson/promise');var client=jayson[_0x160c('0x23')][_0x160c('0x24')]({'port':0x232c});function respondWithRpcPromise(_0x2db328,_0x13f9fe,_0x12104e,_0x48b823){return new BPromise(function(_0x2ec462,_0xa2d316){var _0x1220b6=_0x48b823||client;return _0x1220b6[_0x160c('0x25')](_0x2db328,_0x12104e)[_0x160c('0x26')](function(_0x20cf3c){logger['info'](_0x160c('0x27'),_0x13f9fe,'request\x20sent');logger[_0x160c('0x28')](_0x160c('0x29'),_0x13f9fe,_0x160c('0x2a'),JSON[_0x160c('0x2b')](_0x20cf3c));if(_0x20cf3c['error']){if(_0x20cf3c[_0x160c('0x2c')][_0x160c('0x2d')]===0x1f4){logger['error'](_0x160c('0x27'),_0x13f9fe,_0x20cf3c[_0x160c('0x2c')]['message']);return _0xa2d316(_0x20cf3c[_0x160c('0x2c')][_0x160c('0x2e')]);}logger[_0x160c('0x2c')](_0x160c('0x27'),_0x13f9fe,_0x20cf3c[_0x160c('0x2c')][_0x160c('0x2e')]);return _0x2ec462(_0x20cf3c[_0x160c('0x2c')]['message']);}else{logger[_0x160c('0x2f')](_0x160c('0x27'),_0x13f9fe,_0x160c('0x2a'));_0x2ec462(_0x20cf3c[_0x160c('0x30')]['message']);}})['catch'](function(_0x50a638){logger[_0x160c('0x2c')](_0x160c('0x27'),_0x13f9fe,_0x50a638);_0xa2d316(_0x50a638);});});}function respondWithStatusCode(_0x3780b2,_0x2f3263){_0x2f3263=_0x2f3263||0xcc;return function(_0x19bd4a){if(_0x19bd4a){return _0x3780b2[_0x160c('0x31')](_0x2f3263);}return _0x3780b2[_0x160c('0x32')](_0x2f3263)[_0x160c('0x33')]();};}function respondWithResult(_0x2aaaed,_0x42df86){_0x42df86=_0x42df86||0xc8;return function(_0x4eb0b2){if(_0x4eb0b2){return _0x2aaaed[_0x160c('0x32')](_0x42df86)[_0x160c('0x34')](_0x4eb0b2);}};}function respondWithFilteredResult(_0x3c9914,_0x17b9c8){return function(_0x2429ac){if(_0x2429ac){var _0xacd6b9=typeof _0x17b9c8[_0x160c('0x35')]==='undefined'&&typeof _0x17b9c8['limit']===_0x160c('0x36');var _0x33a726=_0x2429ac[_0x160c('0x37')];var _0x4b1393=_0xacd6b9?0x0:_0x17b9c8[_0x160c('0x35')];var _0x16673=_0xacd6b9?_0x2429ac[_0x160c('0x37')]:_0x17b9c8[_0x160c('0x35')]+_0x17b9c8[_0x160c('0x38')];var _0x452da5;if(_0x16673>=_0x33a726){_0x16673=_0x33a726;_0x452da5=0xc8;}else{_0x452da5=0xce;}_0x3c9914['status'](_0x452da5);return _0x3c9914[_0x160c('0x39')](_0x160c('0x3a'),_0x4b1393+'-'+_0x16673+'/'+_0x33a726)[_0x160c('0x34')](_0x2429ac);}return null;};}function patchUpdates(_0x5be660){return function(_0x18c3b7){try{jsonpatch[_0x160c('0x3b')](_0x18c3b7,_0x5be660,!![]);}catch(_0x3fce43){return BPromise[_0x160c('0x3c')](_0x3fce43);}return _0x18c3b7['save']();};}function saveUpdates(_0x58cbb1,_0x34b334){return function(_0x143926){if(_0x143926){return _0x143926[_0x160c('0x3d')](_0x58cbb1)[_0x160c('0x26')](function(_0x26872f){return _0x26872f;});}return null;};}function removeEntity(_0xcd224,_0x5e7cab){return function(_0x577e0b){if(_0x577e0b){return _0x577e0b[_0x160c('0x3e')]()[_0x160c('0x26')](function(){var _0x5bed52=_0x577e0b[_0x160c('0x3f')]({'plain':!![]});var _0x51345c=_0x160c('0x40');return db[_0x160c('0x41')]['destroy']({'where':{'type':_0x51345c,'resourceId':_0x5bed52['id']}})[_0x160c('0x26')](function(){return _0x577e0b;});})['then'](function(){_0xcd224[_0x160c('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x217461,_0x5d1192){return function(_0xa05750){if(!_0xa05750){_0x217461['sendStatus'](0x194);}return _0xa05750;};}function handleError(_0x3e5f7f,_0x5e8405){_0x5e8405=_0x5e8405||0x1f4;return function(_0x2353e4){logger[_0x160c('0x2c')](_0x2353e4['stack']);if(_0x2353e4[_0x160c('0x42')]){delete _0x2353e4[_0x160c('0x42')];}_0x3e5f7f['status'](_0x5e8405)[_0x160c('0x43')](_0x2353e4);};}exports[_0x160c('0x44')]=function(_0x1daf7c,_0x5ad259){var _0x58c1c1={'include':[{'model':db[_0x160c('0x45')],'as':_0x160c('0x46')}]},_0x650207={},_0x234687={'count':0x0,'rows':[]};var _0x470a2c=_[_0x160c('0x47')](db[_0x160c('0x48')]['rawAttributes'],function(_0x328ed9){return{'name':_0x328ed9[_0x160c('0x49')],'type':_0x328ed9['type'][_0x160c('0x4a')]};});_0x650207[_0x160c('0x4b')]=_[_0x160c('0x47')](_0x470a2c,_0x160c('0x42'));_0x650207[_0x160c('0x4c')]=_['keys'](_0x1daf7c[_0x160c('0x4c')]);_0x650207[_0x160c('0x4d')]=_[_0x160c('0x4e')](_0x650207[_0x160c('0x4b')],_0x650207[_0x160c('0x4c')]);_0x58c1c1[_0x160c('0x4f')]=_[_0x160c('0x4e')](_0x650207[_0x160c('0x4b')],qs[_0x160c('0x50')](_0x1daf7c[_0x160c('0x4c')][_0x160c('0x50')]));_0x58c1c1[_0x160c('0x4f')]=_0x58c1c1[_0x160c('0x4f')][_0x160c('0x51')]?_0x58c1c1[_0x160c('0x4f')]:_0x650207[_0x160c('0x4b')];if(!_0x1daf7c['query']['hasOwnProperty'](_0x160c('0x52'))){_0x58c1c1[_0x160c('0x38')]=qs[_0x160c('0x38')](_0x1daf7c[_0x160c('0x4c')][_0x160c('0x38')]);_0x58c1c1['offset']=qs[_0x160c('0x35')](_0x1daf7c[_0x160c('0x4c')][_0x160c('0x35')]);}_0x58c1c1[_0x160c('0x53')]=qs[_0x160c('0x54')](_0x1daf7c[_0x160c('0x4c')][_0x160c('0x54')]);_0x58c1c1['where']=qs[_0x160c('0x4d')](_[_0x160c('0x55')](_0x1daf7c['query'],_0x650207['filters']),_0x470a2c);if(_0x1daf7c['query'][_0x160c('0x56')]){_0x58c1c1[_0x160c('0x57')]=_[_0x160c('0x58')](_0x58c1c1[_0x160c('0x57')],{'$or':_[_0x160c('0x47')](_0x470a2c,function(_0x1f40cf){if(_0x1f40cf[_0x160c('0x59')]!==_0x160c('0x5a')){var _0x100890={};_0x100890[_0x1f40cf[_0x160c('0x42')]]={'$like':'%'+_0x1daf7c[_0x160c('0x4c')][_0x160c('0x56')]+'%'};return _0x100890;}})});}_0x58c1c1=_['merge']({},_0x58c1c1,_0x1daf7c[_0x160c('0x5b')]);var _0x547c0a={'where':_0x58c1c1[_0x160c('0x57')]};return db['WhatsappAccount'][_0x160c('0x37')](_0x547c0a)[_0x160c('0x26')](function(_0x34cb45){_0x234687[_0x160c('0x37')]=_0x34cb45;if(_0x1daf7c[_0x160c('0x4c')][_0x160c('0x5c')]){_0x58c1c1[_0x160c('0x5d')]=[{'all':!![]}];}return db[_0x160c('0x48')][_0x160c('0x5e')](_0x58c1c1);})['then'](function(_0x5377ef){_0x234687[_0x160c('0x5f')]=_0x5377ef;return _0x234687;})[_0x160c('0x26')](respondWithFilteredResult(_0x5ad259,_0x58c1c1))[_0x160c('0x60')](handleError(_0x5ad259,null));};exports[_0x160c('0x61')]=function(_0xb59475,_0x57fc10){var _0x412446={'raw':![],'where':{'id':_0xb59475[_0x160c('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0x160c('0x46')}]},_0x2e62a6={};_0x2e62a6['model']=_[_0x160c('0x63')](db[_0x160c('0x48')][_0x160c('0x64')]);_0x2e62a6[_0x160c('0x4c')]=_[_0x160c('0x63')](_0xb59475[_0x160c('0x4c')]);_0x2e62a6['filters']=_[_0x160c('0x4e')](_0x2e62a6['model'],_0x2e62a6['query']);_0x412446[_0x160c('0x4f')]=_[_0x160c('0x4e')](_0x2e62a6['model'],qs[_0x160c('0x50')](_0xb59475[_0x160c('0x4c')][_0x160c('0x50')]));_0x412446[_0x160c('0x4f')]=_0x412446[_0x160c('0x4f')][_0x160c('0x51')]?_0x412446[_0x160c('0x4f')]:_0x2e62a6[_0x160c('0x4b')];if(_0xb59475[_0x160c('0x4c')][_0x160c('0x5c')]){_0x412446[_0x160c('0x5d')]=[{'all':!![]}];}_0x412446=_[_0x160c('0x58')]({},_0x412446,_0xb59475['options']);return db[_0x160c('0x48')]['find'](_0x412446)[_0x160c('0x26')](handleEntityNotFound(_0x57fc10,null))[_0x160c('0x26')](respondWithResult(_0x57fc10,null))[_0x160c('0x60')](handleError(_0x57fc10,null));};exports[_0x160c('0x65')]=function(_0x395b04,_0x8d9c25){return db[_0x160c('0x48')]['create'](_0x395b04['body'],{})['then'](function(_0xc58a83){var _0x374456=_0x395b04['user'][_0x160c('0x3f')]({'plain':!![]});if(!_0x374456)throw new Error(_0x160c('0x66'));if(_0x374456[_0x160c('0x67')]===_0x160c('0x68')){var _0x1092ca=_0xc58a83[_0x160c('0x3f')]({'plain':!![]});var _0x293032='WhatsappAccounts';return db[_0x160c('0x69')][_0x160c('0x6a')]({'where':{'name':_0x293032,'userProfileId':_0x374456[_0x160c('0x6b')]},'raw':!![]})[_0x160c('0x26')](function(_0x38b0b3){if(_0x38b0b3&&_0x38b0b3['autoAssociation']===0x0){return db[_0x160c('0x41')]['create']({'name':_0x1092ca[_0x160c('0x42')],'resourceId':_0x1092ca['id'],'type':_0x38b0b3['name'],'sectionId':_0x38b0b3['id']},{})[_0x160c('0x26')](function(){return _0xc58a83;});}else{return _0xc58a83;}})[_0x160c('0x60')](function(_0x5f12ea){logger['error'](_0x160c('0x6c'),_0x5f12ea);throw _0x5f12ea;});}return _0xc58a83;})[_0x160c('0x26')](respondWithResult(_0x8d9c25,0xc9))['catch'](handleError(_0x8d9c25,null));};exports['update']=function(_0x2eb010,_0x160a45){if(_0x2eb010[_0x160c('0x6d')]['id']){delete _0x2eb010['body']['id'];}return db[_0x160c('0x48')]['find']({'where':{'id':_0x2eb010['params']['id']},'include':[{'model':db[_0x160c('0x45')],'as':_0x160c('0x46')}]})[_0x160c('0x26')](handleEntityNotFound(_0x160a45,null))['then'](saveUpdates(_0x2eb010[_0x160c('0x6d')],null))['then'](respondWithResult(_0x160a45,null))[_0x160c('0x60')](handleError(_0x160a45,null));};exports[_0x160c('0x3e')]=function(_0x5f34e6,_0x28ffee){return db[_0x160c('0x48')]['find']({'where':{'id':_0x5f34e6[_0x160c('0x62')]['id']}})[_0x160c('0x26')](handleEntityNotFound(_0x28ffee,null))[_0x160c('0x26')](removeEntity(_0x28ffee,null))['catch'](handleError(_0x28ffee,null));};exports['describe']=function(_0x6314c9,_0xd9daef){return db[_0x160c('0x48')][_0x160c('0x6e')]()[_0x160c('0x26')](respondWithResult(_0xd9daef,null))[_0x160c('0x60')](handleError(_0xd9daef,null));};exports['addDisposition']=function(_0x56772f,_0x2fb173,_0x97aefa){if(_0x56772f[_0x160c('0x6d')]['id']){delete _0x56772f['body']['id'];}return db[_0x160c('0x48')][_0x160c('0x6a')]({'where':{'id':_0x56772f[_0x160c('0x62')]['id']}})[_0x160c('0x26')](handleEntityNotFound(_0x2fb173,null))[_0x160c('0x26')](function(_0x265f53){if(_0x265f53){_0x56772f[_0x160c('0x6d')][_0x160c('0x6f')]=_0x265f53['id'];return db[_0x160c('0x70')][_0x160c('0x65')](_0x56772f[_0x160c('0x6d')]);}})[_0x160c('0x26')](respondWithResult(_0x2fb173,null))[_0x160c('0x60')](handleError(_0x2fb173,null));};exports[_0x160c('0x71')]=function(_0x42aa97,_0x552bb4,_0x1b60e4){var _0x1d36e3={'raw':![],'where':{}};var _0x236492={};var _0x1d0e13={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x42aa97[_0x160c('0x62')]['id']}})['then'](handleEntityNotFound(_0x552bb4,null))[_0x160c('0x26')](function(_0x2135b8){if(_0x2135b8){_0x236492['model']=_[_0x160c('0x63')](db[_0x160c('0x70')][_0x160c('0x64')]);_0x236492[_0x160c('0x4c')]=_[_0x160c('0x63')](_0x42aa97[_0x160c('0x4c')]);_0x236492[_0x160c('0x4d')]=_[_0x160c('0x4e')](_0x236492[_0x160c('0x4b')],_0x236492['query']);_0x1d36e3['attributes']=_[_0x160c('0x4e')](_0x236492['model'],qs['fields'](_0x42aa97[_0x160c('0x4c')][_0x160c('0x50')]));_0x1d36e3['attributes']=_0x1d36e3[_0x160c('0x4f')][_0x160c('0x51')]?_0x1d36e3[_0x160c('0x4f')]:_0x236492[_0x160c('0x4b')];if(!_0x42aa97[_0x160c('0x4c')][_0x160c('0x72')](_0x160c('0x52'))){_0x1d36e3[_0x160c('0x38')]=qs[_0x160c('0x38')](_0x42aa97[_0x160c('0x4c')][_0x160c('0x38')]);_0x1d36e3['offset']=qs['offset'](_0x42aa97[_0x160c('0x4c')][_0x160c('0x35')]);}_0x1d36e3[_0x160c('0x53')]=qs[_0x160c('0x54')](_0x42aa97[_0x160c('0x4c')][_0x160c('0x54')]);_0x1d36e3[_0x160c('0x57')]=qs[_0x160c('0x4d')](_[_0x160c('0x55')](_0x42aa97[_0x160c('0x4c')],_0x236492[_0x160c('0x4d')]));_0x1d36e3[_0x160c('0x57')][_0x160c('0x6f')]=_0x2135b8['id'];if(_0x42aa97[_0x160c('0x4c')][_0x160c('0x56')]){_0x1d36e3[_0x160c('0x57')]=_[_0x160c('0x58')](_0x1d36e3['where'],{'$or':_[_0x160c('0x47')](_0x1d36e3['attributes'],function(_0xc86201){var _0x11a30e={};_0x11a30e[_0xc86201]={'$like':'%'+_0x42aa97[_0x160c('0x4c')][_0x160c('0x56')]+'%'};return _0x11a30e;})});}_0x1d36e3=_['merge']({},_0x1d36e3,_0x42aa97[_0x160c('0x5b')]);return db['Disposition'][_0x160c('0x37')]({'where':_0x1d36e3[_0x160c('0x57')]})[_0x160c('0x26')](function(_0xbf4694){_0x1d0e13[_0x160c('0x37')]=_0xbf4694;if(_0x42aa97[_0x160c('0x4c')][_0x160c('0x5c')]){_0x1d36e3[_0x160c('0x5d')]=[{'all':!![]}];}return db[_0x160c('0x70')]['findAll'](_0x1d36e3);})['then'](function(_0x302f7a){_0x1d0e13[_0x160c('0x5f')]=_0x302f7a;return _0x1d0e13;});}})[_0x160c('0x26')](respondWithFilteredResult(_0x552bb4,_0x1d36e3))[_0x160c('0x60')](handleError(_0x552bb4,null));};exports[_0x160c('0x73')]=function(_0x1c86c1,_0x3d4c90,_0x22cd01){return db[_0x160c('0x48')][_0x160c('0x6a')]({'where':{'id':_0x1c86c1[_0x160c('0x62')]['id']}})[_0x160c('0x26')](handleEntityNotFound(_0x3d4c90,null))['then'](function(_0xe34648){if(_0xe34648){return _0xe34648[_0x160c('0x73')](_0x1c86c1[_0x160c('0x4c')][_0x160c('0x74')]);}})[_0x160c('0x26')](respondWithStatusCode(_0x3d4c90,null))[_0x160c('0x60')](handleError(_0x3d4c90,null));};exports[_0x160c('0x75')]=function(_0x4e9eba,_0x5ac12c,_0x15756e){if(_0x4e9eba['body']['id']){delete _0x4e9eba[_0x160c('0x6d')]['id'];}return db[_0x160c('0x48')]['find']({'where':{'id':_0x4e9eba[_0x160c('0x62')]['id']}})[_0x160c('0x26')](handleEntityNotFound(_0x5ac12c,null))['then'](function(_0x32d6f0){if(_0x32d6f0){_0x4e9eba[_0x160c('0x6d')][_0x160c('0x6f')]=_0x32d6f0['id'];return db[_0x160c('0x76')]['create'](_0x4e9eba['body']);}})['then'](respondWithResult(_0x5ac12c,null))[_0x160c('0x60')](handleError(_0x5ac12c,null));};exports[_0x160c('0x77')]=function(_0x3e0879,_0x30e9d3,_0x367d81){var _0x2ab54d={'raw':![],'where':{}};var _0x47fb63={};var _0x478ce0={'count':0x0,'rows':[]};return db[_0x160c('0x48')][_0x160c('0x78')]({'where':{'id':_0x3e0879[_0x160c('0x62')]['id']}})['then'](handleEntityNotFound(_0x30e9d3,null))['then'](function(_0x4023a7){if(_0x4023a7){_0x47fb63[_0x160c('0x4b')]=_[_0x160c('0x63')](db[_0x160c('0x76')][_0x160c('0x64')]);_0x47fb63[_0x160c('0x4c')]=_[_0x160c('0x63')](_0x3e0879[_0x160c('0x4c')]);_0x47fb63[_0x160c('0x4d')]=_[_0x160c('0x4e')](_0x47fb63[_0x160c('0x4b')],_0x47fb63[_0x160c('0x4c')]);_0x2ab54d[_0x160c('0x4f')]=_['intersection'](_0x47fb63[_0x160c('0x4b')],qs['fields'](_0x3e0879[_0x160c('0x4c')][_0x160c('0x50')]));_0x2ab54d[_0x160c('0x4f')]=_0x2ab54d[_0x160c('0x4f')][_0x160c('0x51')]?_0x2ab54d[_0x160c('0x4f')]:_0x47fb63[_0x160c('0x4b')];if(!_0x3e0879[_0x160c('0x4c')][_0x160c('0x72')]('nolimit')){_0x2ab54d[_0x160c('0x38')]=qs[_0x160c('0x38')](_0x3e0879[_0x160c('0x4c')][_0x160c('0x38')]);_0x2ab54d[_0x160c('0x35')]=qs['offset'](_0x3e0879[_0x160c('0x4c')][_0x160c('0x35')]);}_0x2ab54d[_0x160c('0x53')]=qs[_0x160c('0x54')](_0x3e0879[_0x160c('0x4c')][_0x160c('0x54')]);_0x2ab54d[_0x160c('0x57')]=qs['filters'](_[_0x160c('0x55')](_0x3e0879[_0x160c('0x4c')],_0x47fb63[_0x160c('0x4d')]));_0x2ab54d['where'][_0x160c('0x6f')]=_0x4023a7['id'];if(_0x3e0879[_0x160c('0x4c')]['filter']){_0x2ab54d['where']=_[_0x160c('0x58')](_0x2ab54d['where'],{'$or':_['map'](_0x2ab54d[_0x160c('0x4f')],function(_0x3d160b){var _0x301aa5={};_0x301aa5[_0x3d160b]={'$like':'%'+_0x3e0879[_0x160c('0x4c')][_0x160c('0x56')]+'%'};return _0x301aa5;})});}_0x2ab54d=_[_0x160c('0x58')]({},_0x2ab54d,_0x3e0879[_0x160c('0x5b')]);return db[_0x160c('0x76')]['count']({'where':_0x2ab54d[_0x160c('0x57')]})[_0x160c('0x26')](function(_0x4082ac){_0x478ce0[_0x160c('0x37')]=_0x4082ac;if(_0x3e0879[_0x160c('0x4c')]['includeAll']){_0x2ab54d['include']=[{'all':!![]}];}return db[_0x160c('0x76')]['findAll'](_0x2ab54d);})[_0x160c('0x26')](function(_0x43f863){_0x478ce0[_0x160c('0x5f')]=_0x43f863;return _0x478ce0;});}})[_0x160c('0x26')](respondWithFilteredResult(_0x30e9d3,_0x2ab54d))[_0x160c('0x60')](handleError(_0x30e9d3,null));};exports[_0x160c('0x79')]=function(_0x5c0ca2,_0xfe1b48,_0x33ce5e){return db['WhatsappAccount'][_0x160c('0x6a')]({'where':{'id':_0x5c0ca2[_0x160c('0x62')]['id']}})[_0x160c('0x26')](handleEntityNotFound(_0xfe1b48,null))[_0x160c('0x26')](function(_0x49da8c){if(_0x49da8c){return _0x49da8c[_0x160c('0x79')](_0x5c0ca2['query']['ids']);}})[_0x160c('0x26')](respondWithStatusCode(_0xfe1b48,null))[_0x160c('0x60')](handleError(_0xfe1b48,null));};exports['addAgents']=function(_0x454241,_0xbda10,_0xc45adc){return db[_0x160c('0x48')][_0x160c('0x6a')]({'where':{'id':_0x454241[_0x160c('0x62')]['id']}})[_0x160c('0x26')](handleEntityNotFound(_0xbda10,null))['then'](function(_0x2732d1){if(_0x2732d1){return _0x2732d1[_0x160c('0x7a')](_0x454241['body'][_0x160c('0x74')],_[_0x160c('0x7b')](_0x454241[_0x160c('0x6d')],[_0x160c('0x74'),'id'])||{})['spread'](function(_0x5bea0a){for(var _0x327e21=0x0;_0x327e21<_0x454241[_0x160c('0x6d')][_0x160c('0x74')][_0x160c('0x51')];_0x327e21+=0x1){socket[_0x160c('0x7c')](_0x160c('0x7d'),{'UserId':Number(_0x454241[_0x160c('0x6d')][_0x160c('0x74')][_0x327e21]),'WhatsappAccountId':Number(_0x454241[_0x160c('0x62')]['id'])});}return _0x5bea0a;});}})[_0x160c('0x26')](respondWithResult(_0xbda10,null))[_0x160c('0x60')](handleError(_0xbda10,null));};exports[_0x160c('0x7e')]=function(_0x3d4acf,_0x2da6d1,_0x4679e4){return db[_0x160c('0x48')]['find']({'where':{'id':_0x3d4acf['params']['id']}})[_0x160c('0x26')](handleEntityNotFound(_0x2da6d1,null))['then'](function(_0x487299){if(_0x487299){return _0x487299['removeAgents'](_0x3d4acf[_0x160c('0x4c')][_0x160c('0x74')])[_0x160c('0x26')](function(){if(_['isArray'](_0x3d4acf[_0x160c('0x4c')][_0x160c('0x74')])){for(var _0x3316a1=0x0;_0x3316a1<_0x3d4acf[_0x160c('0x4c')][_0x160c('0x74')][_0x160c('0x51')];_0x3316a1+=0x1){socket[_0x160c('0x7c')]('userWhatsappAccount:remove',{'UserId':Number(_0x3d4acf[_0x160c('0x4c')][_0x160c('0x74')][_0x3316a1]),'WhatsappAccountId':Number(_0x3d4acf[_0x160c('0x62')]['id'])});}}else{socket[_0x160c('0x7c')](_0x160c('0x7f'),{'UserId':Number(_0x3d4acf[_0x160c('0x4c')][_0x160c('0x74')]),'WhatsappAccountId':Number(_0x3d4acf[_0x160c('0x62')]['id'])});}});}})[_0x160c('0x26')](respondWithStatusCode(_0x2da6d1,null))[_0x160c('0x60')](handleError(_0x2da6d1,null));};exports[_0x160c('0x80')]=function(_0x5bbdbc,_0x42ab88,_0xe6999a){var _0x348dd2={};var _0x3b70d0={};var _0x3ed09a;var _0x516967;return db[_0x160c('0x48')][_0x160c('0x78')]({'where':{'id':_0x5bbdbc['params']['id']}})[_0x160c('0x26')](handleEntityNotFound(_0x42ab88,null))[_0x160c('0x26')](function(_0x58169f){if(_0x58169f){_0x3ed09a=_0x58169f;_0x3b70d0[_0x160c('0x4b')]=_[_0x160c('0x63')](db[_0x160c('0x81')][_0x160c('0x64')]);_0x3b70d0[_0x160c('0x4c')]=_[_0x160c('0x63')](_0x5bbdbc[_0x160c('0x4c')]);_0x3b70d0[_0x160c('0x4d')]=_[_0x160c('0x4e')](_0x3b70d0['model'],_0x3b70d0[_0x160c('0x4c')]);_0x348dd2[_0x160c('0x4f')]=_[_0x160c('0x4e')](_0x3b70d0[_0x160c('0x4b')],qs[_0x160c('0x50')](_0x5bbdbc[_0x160c('0x4c')][_0x160c('0x50')]));_0x348dd2['attributes']=_0x348dd2[_0x160c('0x4f')][_0x160c('0x51')]?_0x348dd2[_0x160c('0x4f')]:_0x3b70d0['model'];_0x348dd2[_0x160c('0x53')]=qs[_0x160c('0x54')](_0x5bbdbc[_0x160c('0x4c')][_0x160c('0x54')]);_0x348dd2[_0x160c('0x57')]=qs[_0x160c('0x4d')](_[_0x160c('0x55')](_0x5bbdbc[_0x160c('0x4c')],_0x3b70d0['filters']));if(_0x5bbdbc[_0x160c('0x4c')][_0x160c('0x56')]){_0x348dd2['where']=_[_0x160c('0x58')](_0x348dd2[_0x160c('0x57')],{'$or':_[_0x160c('0x47')](_0x348dd2[_0x160c('0x4f')],function(_0x52c803){var _0x4b1260={};_0x4b1260[_0x52c803]={'$like':'%'+_0x5bbdbc[_0x160c('0x4c')][_0x160c('0x56')]+'%'};return _0x4b1260;})});}_0x348dd2=_[_0x160c('0x58')]({},_0x348dd2,_0x5bbdbc[_0x160c('0x5b')]);return _0x3ed09a['getAgents'](_0x348dd2);}})[_0x160c('0x26')](function(_0x5758ad){if(_0x5758ad){_0x516967=_0x5758ad[_0x160c('0x51')];if(!_0x5bbdbc[_0x160c('0x4c')][_0x160c('0x72')](_0x160c('0x52'))){_0x348dd2['limit']=qs['limit'](_0x5bbdbc[_0x160c('0x4c')][_0x160c('0x38')]);_0x348dd2['offset']=qs[_0x160c('0x35')](_0x5bbdbc[_0x160c('0x4c')][_0x160c('0x35')]);}return _0x3ed09a[_0x160c('0x80')](_0x348dd2);}})[_0x160c('0x26')](function(_0x19be77){if(_0x19be77){return _0x19be77?{'count':_0x516967,'rows':_0x19be77}:null;}})[_0x160c('0x26')](respondWithResult(_0x42ab88,null))[_0x160c('0x60')](handleError(_0x42ab88,null));};exports[_0x160c('0x82')]=function(_0xa73104,_0x40004f){var _0x4ad880=_0xa73104['params']['id'];var _0x306982=_0xa73104[_0x160c('0x6d')];var _0xb2d65f=0xc8;var _0x559a01=null;return db[_0x160c('0x83')][_0x160c('0x84')]({'isolationLevel':db[_0x160c('0x83')]['Transaction']['ISOLATION_LEVELS'][_0x160c('0x85')]},function(_0x43381d){return db[_0x160c('0x48')][_0x160c('0x78')]({'where':{'id':_0x4ad880},'transaction':_0x43381d})[_0x160c('0x26')](function(_0x4e95dd){if(_0x4e95dd){return db[_0x160c('0x86')]['destroy']({'where':{'WhatsappAccountId':_0x4ad880},'transaction':_0x43381d})['then'](function(){var _0x3e85c3=_[_0x160c('0x47')](_0x306982,function(_0x563210){_0x563210[_0x160c('0x6f')]=_0x4ad880;return _0x563210;});return db[_0x160c('0x86')]['bulkCreate'](_0x3e85c3,{'transaction':_0x43381d});});}else{_0xb2d65f=0x194;_0x559a01=[];}});})[_0x160c('0x26')](function(){if(_0xb2d65f!==0x194){return db[_0x160c('0x86')][_0x160c('0x87')]({'where':{'WhatsappAccountId':_0x4ad880},'order':_0x160c('0x88')})[_0x160c('0x26')](function(_0x2a5903){_0x559a01=_0x2a5903;});}})[_0x160c('0x60')](function(_0x407820){_0xb2d65f=0x1f4;logger[_0x160c('0x2c')](_0x407820[_0x160c('0x89')]);if(_0x407820[_0x160c('0x42')]){delete _0x407820[_0x160c('0x42')];}_0x559a01=_0x407820;})[_0x160c('0x8a')](function(){if(_0x559a01===null){_0x40004f[_0x160c('0x31')](_0xb2d65f);}else{if(_0xb2d65f===0x1f4){_0x40004f['status'](_0xb2d65f)[_0x160c('0x43')](_0x559a01);}else{_0x40004f[_0x160c('0x32')](_0xb2d65f)[_0x160c('0x34')](_0x559a01);}}});};exports[_0x160c('0x8b')]=function(_0x1b7002,_0xe1c39f,_0x5b2826){var _0x1d99a4={};var _0x578e07={};var _0x574eea;var _0x52b98e;return db[_0x160c('0x48')]['findOne']({'where':{'id':_0x1b7002[_0x160c('0x62')]['id']}})[_0x160c('0x26')](handleEntityNotFound(_0xe1c39f,null))[_0x160c('0x26')](function(_0x483ef8){if(_0x483ef8){_0x574eea=_0x483ef8;_0x578e07[_0x160c('0x4b')]=_[_0x160c('0x63')](db[_0x160c('0x86')][_0x160c('0x64')]);_0x578e07[_0x160c('0x4c')]=_[_0x160c('0x63')](_0x1b7002[_0x160c('0x4c')]);_0x578e07[_0x160c('0x4d')]=_[_0x160c('0x4e')](_0x578e07[_0x160c('0x4b')],_0x578e07[_0x160c('0x4c')]);_0x1d99a4[_0x160c('0x4f')]=_[_0x160c('0x4e')](_0x578e07[_0x160c('0x4b')],qs[_0x160c('0x50')](_0x1b7002[_0x160c('0x4c')][_0x160c('0x50')]));_0x1d99a4[_0x160c('0x4f')]=_0x1d99a4['attributes']['length']?_0x1d99a4['attributes']:_0x578e07[_0x160c('0x4b')];_0x1d99a4[_0x160c('0x53')]=qs[_0x160c('0x54')](_0x1b7002['query'][_0x160c('0x54')]);_0x1d99a4[_0x160c('0x57')]=qs[_0x160c('0x4d')](_['pick'](_0x1b7002['query'],_0x578e07['filters']));if(_0x1b7002['query'][_0x160c('0x56')]){_0x1d99a4[_0x160c('0x57')]=_['merge'](_0x1d99a4[_0x160c('0x57')],{'$or':_['map'](_0x1d99a4[_0x160c('0x4f')],function(_0x27e517){var _0x337ee3={};_0x337ee3[_0x27e517]={'$like':'%'+_0x1b7002[_0x160c('0x4c')][_0x160c('0x56')]+'%'};return _0x337ee3;})});}_0x1d99a4=_['merge']({},_0x1d99a4,_0x1b7002[_0x160c('0x5b')]);return _0x574eea[_0x160c('0x8b')](_0x1d99a4);}})['then'](function(_0x4a589c){if(_0x4a589c){_0x52b98e=_0x4a589c[_0x160c('0x51')];if(!_0x1b7002[_0x160c('0x4c')][_0x160c('0x72')]('nolimit')){_0x1d99a4['limit']=qs['limit'](_0x1b7002[_0x160c('0x4c')][_0x160c('0x38')]);_0x1d99a4[_0x160c('0x35')]=qs[_0x160c('0x35')](_0x1b7002[_0x160c('0x4c')][_0x160c('0x35')]);}return _0x574eea[_0x160c('0x8b')](_0x1d99a4);}})[_0x160c('0x26')](function(_0x2ef680){if(_0x2ef680){return _0x2ef680?{'count':_0x52b98e,'rows':_0x2ef680}:null;}})['then'](respondWithResult(_0xe1c39f,null))[_0x160c('0x60')](handleError(_0xe1c39f,null));};exports['notify']=function(_0xb8a078,_0x18a29d,_0x5d815b){var _0x4e8f54={'channel':_0x160c('0x8c')};var _0x154130=[];var _0x45f825=[];var _0x5475b1={};return db[_0x160c('0x48')]['find']({'where':{'id':_0xb8a078[_0x160c('0x62')]['id']},'include':[{'model':db[_0x160c('0x86')],'as':'Applications'}]})[_0x160c('0x26')](handleEntityNotFound(_0x18a29d,null))[_0x160c('0x26')](function(_0x29b924){_0x4e8f54[_0x160c('0x8d')]=_0x29b924;if(_0x4e8f54['account']&&_0x4e8f54[_0x160c('0x8d')]['type']===_0x160c('0x8e')&&_0xb8a078[_0x160c('0x6d')][_0x160c('0x8f')]){if(_0xb8a078[_0x160c('0x6d')][_0x160c('0x8f')]['length']===0x0)return;if(_0xb8a078[_0x160c('0x6d')][_0x160c('0x8f')][0x0][_0x160c('0x90')]!=='read')return;return db['WhatsappMessage'][_0x160c('0x3d')]({'read':!![],'readAt':_0xb8a078[_0x160c('0x6d')][_0x160c('0x8f')][0x0][_0x160c('0x91')]},{'where':{'messageId':_0xb8a078['body']['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x160c('0x26')](function(_0x2f6888){return _0x18a29d[_0x160c('0x32')](0xc8)[_0x160c('0x34')](_0x2f6888);});}_0x4e8f54[_0x160c('0x92')]=_[_0x160c('0x93')](_0x29b924[_0x160c('0x94')],['priority'],[_0x160c('0x95')]);if(_0x4e8f54[_0x160c('0x8d')][_0x160c('0x94')]){delete _0x4e8f54[_0x160c('0x8d')][_0x160c('0x94')];}return db['CmContact'][_0x160c('0x6e')]()[_0x160c('0x26')](function(_0x25687a){if(!_0x25687a){throw new db[(_0x160c('0x96'))]['ValidationError'](_0x160c('0x97'));}_0x154130=_[_0x160c('0x98')](_[_0x160c('0x63')](_0x25687a),[_0x160c('0x99'),_0x160c('0x9a')]);_0x45f825=_['difference'](_[_0x160c('0x63')](_0x25687a),[_0x160c('0x99'),_0x160c('0x9a'),_0x160c('0x9b'),'ListId']);_0x4e8f54[_0x160c('0x6d')]={'mapKey':_0x160c('0x9c')};if(_0x4e8f54[_0x160c('0x8d')]&&_0x4e8f54[_0x160c('0x8d')][_0x160c('0x59')]==='twilio'){_0x4e8f54[_0x160c('0x6d')][_0x160c('0x9d')]=_0xb8a078['body'][_0x160c('0x9e')][_0x160c('0x9f')](_0x160c('0xa0'),'');_0x4e8f54[_0x160c('0x6d')][_0x160c('0x6d')]=_0xb8a078[_0x160c('0x6d')][_0x160c('0xa1')];_0x4e8f54[_0x160c('0x6d')][_0x160c('0xa2')]=_0xb8a078[_0x160c('0x6d')][_0x160c('0xa3')];}if(_0x4e8f54[_0x160c('0x8d')]&&_0x4e8f54['account'][_0x160c('0x59')]===_0x160c('0x8e')){_0x4e8f54[_0x160c('0x6d')]['from']=_0xb8a078[_0x160c('0x6d')][_0x160c('0xa4')][0x0][_0x160c('0x9d')];_0x4e8f54['body'][_0x160c('0x6d')]=_0xb8a078[_0x160c('0x6d')][_0x160c('0xa4')][0x0][_0x160c('0x2e')]['body'];_0x4e8f54[_0x160c('0x6d')]['messageId']=_0xb8a078[_0x160c('0x6d')][_0x160c('0xa4')][0x0]['message_id'];}if(_0x4e8f54[_0x160c('0x6d')]['id']){delete _0x4e8f54[_0x160c('0x6d')]['id'];}if(_[_0x160c('0xa5')](_0x4e8f54[_0x160c('0x6d')][_0x160c('0x9d')])){throw new db['Sequelize'][(_0x160c('0xa6'))](_0x160c('0xa7'));}if(_[_0x160c('0xa5')](_0x4e8f54[_0x160c('0x6d')][_0x160c('0x6d')])||_0x4e8f54['body']['body']===''){throw new db['Sequelize'][(_0x160c('0xa6'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x160c('0xa5')](_0x4e8f54[_0x160c('0x6d')][_0x160c('0xa8')])){throw new db[(_0x160c('0x96'))]['ValidationError'](_0x160c('0xa9')+_0x45f825);}if(!_[_0x160c('0xaa')](_0x45f825,_0x4e8f54['body'][_0x160c('0xa8')])){throw new db[(_0x160c('0x96'))][(_0x160c('0xa6'))](_0x160c('0xab')+_0x45f825);}_0x5475b1[_0x4e8f54[_0x160c('0x6d')][_0x160c('0xa8')]]=_0x4e8f54[_0x160c('0x6d')][_0x160c('0x9d')];return db['CmList'][_0x160c('0x6a')]({'where':{'id':_0x4e8f54[_0x160c('0x8d')][_0x160c('0xac')]},'include':[{'model':db['CmContact'],'as':_0x160c('0xad'),'where':_0x5475b1,'limit':0x1,'order':[[_0x160c('0x9a'),_0x160c('0xae')]]}]});})[_0x160c('0x26')](handleEntityNotFound(_0x18a29d,null))['then'](function(_0xb267af){if(_0xb267af){_0x4e8f54[_0x160c('0xaf')]=_[_0x160c('0x7b')](_0xb267af,[_0x160c('0xad')]);if(_0xb267af[_0x160c('0xad')][_0x160c('0x51')]){return _0xb267af[_0x160c('0xad')][0x0];}var _0x45e969=_[_0x160c('0x1e')](_0x4e8f54[_0x160c('0x6d')],{'firstName':_0x4e8f54[_0x160c('0x6d')][_0x160c('0x9d')],'ListId':_0xb267af['id']});_0x45e969[_0x4e8f54[_0x160c('0x6d')][_0x160c('0xa8')]]=_0x4e8f54['body'][_0x160c('0x9d')];return db[_0x160c('0xb0')][_0x160c('0x65')](_0x45e969,{'fields':_0x154130,'raw':!![]});}})[_0x160c('0x26')](handleEntityNotFound(_0x18a29d,null))[_0x160c('0x26')](function(_0x2c1798){if(_0x2c1798){_0x4e8f54[_0x160c('0xb1')]=_0x2c1798;var _0x1f3fcd={'ContactId':_0x2c1798['id'],'phone':_0x4e8f54[_0x160c('0x6d')][_0x160c('0x9d')],'WhatsappAccountId':_0xb8a078['params']['id']};var _0x59041e={'ContactId':_0x2c1798['id'],'WhatsappAccountId':_0xb8a078[_0x160c('0x62')]['id'],'closed':![]};return db[_0x160c('0xb2')][_0x160c('0x6a')]({'where':_0x59041e})['then'](function(_0x380b3c){if(_0x380b3c){return[_0x380b3c,![]];}return db['WhatsappInteraction'][_0x160c('0x65')](_0x1f3fcd)[_0x160c('0x26')](function(_0x13fa34){return[_0x13fa34,!![]];});});}})[_0x160c('0xb3')](function(_0x4d9146,_0x2163c5){_0x4e8f54[_0x160c('0xb4')]=_0x4d9146[_0x160c('0x3f')]({'plain':!![]});_0x4e8f54[_0x160c('0xb4')][_0x160c('0xb5')]=![];if(_0x2163c5){if(_0x4e8f54['account'][_0x160c('0xb6')]){_0x4e8f54['applications'][_0x160c('0xb7')]({'id':0x0,'priority':_0x4e8f54['applications'][_0x160c('0x51')]+0x1,'app':'close','appdata':_0x160c('0xb8'),'interval':'*,*,*,*'});}_0x4e8f54[_0x160c('0xb4')][_0x160c('0xb5')]=!![];}return db[_0x160c('0xb9')][_0x160c('0x65')]({'phone':_0x4e8f54['body'][_0x160c('0x9d')],'messageId':_0x4e8f54[_0x160c('0x6d')][_0x160c('0xa2')],'body':_0x4e8f54['body']['body'],'WhatsappAccountId':_0xb8a078['params']['id'],'WhatsappInteractionId':_0x4d9146['id'],'direction':'in','ContactId':_0x4d9146['ContactId'],'AttachmentId':_0x4e8f54[_0x160c('0x6d')]['AttachmentId']});})[_0x160c('0x26')](function(_0x353191){_0x4e8f54[_0x160c('0x2e')]=_0x353191;if(_0x4e8f54[_0x160c('0xb4')][_0x160c('0xba')]){return db[_0x160c('0x81')][_0x160c('0x6a')]({'attributes':['id',_0x160c('0x42')],'where':{'id':_0x4e8f54[_0x160c('0xb4')]['UserId']}})[_0x160c('0x26')](function(_0x293093){if(_0x293093){_0x4e8f54['applications'][_0x160c('0xbb')]({'id':0x0,'priority':0x0,'app':_0x160c('0xbc'),'appdata':_0x293093[_0x160c('0x42')]+','+(_0x4e8f54['account'][_0x160c('0xbd')]||0xa),'interval':_0x160c('0xbe')});}return respondWithRpcPromise(_0x160c('0xbf'),_0x160c('0xc0'),_0x4e8f54);});}return respondWithRpcPromise('Start',_0x160c('0xc0'),_0x4e8f54);})[_0x160c('0x26')](function(_0xa76882){if(_0xa76882){var _0x3dc4ce=0xc8;var _0x4aadad=_0x160c('0xc1');logger[_0x160c('0x2f')](_0x160c('0x29'),_0x4aadad,_0x3dc4ce,_0x160c('0xc2'));logger[_0x160c('0x28')](_0x160c('0xc3'),_0x4aadad,_0x3dc4ce,_0x160c('0xc2'),JSON[_0x160c('0x2b')](_0xa76882));if(_0x4e8f54[_0x160c('0x8d')][_0x160c('0x59')]===_0x160c('0xc4')){return _0x18a29d[_0x160c('0x32')](_0x3dc4ce)[_0x160c('0x39')](_0x160c('0xc5'),_0x160c('0xc6'))[_0x160c('0x43')](_0x160c('0xc7'));}else{return _0x18a29d['status'](_0x3dc4ce)[_0x160c('0x34')](_0xa76882);}}});})[_0x160c('0x60')](handleError(_0x18a29d,null));};exports[_0x160c('0x43')]=function(_0x43d87f,_0x217927,_0x237841){var _0x27fac6,_0x481d85,_0x5f57d4;if(_['isNil'](_0x43d87f[_0x160c('0x6d')][_0x160c('0x6d')])||_0x43d87f[_0x160c('0x6d')][_0x160c('0x6d')]===''){throw new db[(_0x160c('0x96'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x43d87f[_0x160c('0x6d')]['to'])){throw new db[(_0x160c('0x96'))][(_0x160c('0xa6'))](_0x160c('0xc8'));}_0x27fac6=_0x43d87f[_0x160c('0x6d')]['to'];return db['WhatsappAccount'][_0x160c('0x6a')]({'where':{'id':_0x43d87f[_0x160c('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x160c('0xc9'),'include':[{'model':db[_0x160c('0xb0')],'as':_0x160c('0xad'),'where':{'mobile':_0x27fac6},'limit':0x1,'order':[[_0x160c('0x9a'),_0x160c('0xae')]]}]}]})[_0x160c('0x26')](handleEntityNotFound(_0x217927,null))[_0x160c('0x26')](function(_0x3eed59){if(_0x3eed59&&_0x3eed59['List']){_0x481d85=_0x3eed59[_0x160c('0x3f')]({'plain':!![]});if(_0x481d85['List']&&_0x481d85['List'][_0x160c('0xad')]['length']){return _0x481d85[_0x160c('0xc9')][_0x160c('0xad')][0x0];}return db[_0x160c('0xb0')][_0x160c('0x65')](_[_0x160c('0x1e')](_0x43d87f[_0x160c('0x6d')],{'firstName':_0x27fac6,'mobile':_0x27fac6,'phone':_0x27fac6,'ListId':_0x481d85[_0x160c('0xac')]}));}})[_0x160c('0x26')](handleEntityNotFound(_0x217927,null))['then'](function(_0x2fba13){if(_0x2fba13){_0x5f57d4=_0x2fba13;return db[_0x160c('0xb2')][_0x160c('0x6a')]({'where':{'ContactId':_0x5f57d4['id'],'closed':![],'WhatsappAccountId':_0x481d85['id']}})[_0x160c('0x26')](function(_0x352e0a){if(_0x352e0a){return[_0x352e0a,![]];}return db[_0x160c('0xb2')][_0x160c('0x65')]({'UserId':_0x43d87f[_0x160c('0x68')]['id'],'ContactId':_0x5f57d4['id'],'WhatsappAccountId':_0x481d85['id'],'phone':_0x27fac6,'firstMsgDirection':'out','Messages':[_[_0x160c('0x58')](_0x43d87f[_0x160c('0x6d')],{'read':![],'body':_0x43d87f[_0x160c('0x6d')][_0x160c('0x6d')],'phone':_0x27fac6,'WhatsappAccountId':_0x481d85['id'],'UserId':_0x43d87f[_0x160c('0x68')]['id'],'ContactId':_0x5f57d4['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x160c('0xca')}]})[_0x160c('0x26')](function(_0x28d621){return[_0x28d621,!![]];});});}})[_0x160c('0xb3')](function(_0x149984,_0x5e22c8){if(_0x5e22c8){return _0x149984;}return db['WhatsappMessage'][_0x160c('0x65')](_['merge'](_0x43d87f[_0x160c('0x6d')],{'read':![],'body':_0x43d87f[_0x160c('0x6d')]['body'],'phone':_0x27fac6,'WhatsappAccountId':_0x481d85['id'],'WhatsappInteractionId':_0x149984['id'],'UserId':_0x43d87f['user']['id'],'ContactId':_0x5f57d4['id']}))['then'](function(_0x30db09){_0x149984[_0x160c('0xcb')][_0x160c('0xca')]=[];_0x149984[_0x160c('0xcb')][_0x160c('0xca')][_0x160c('0xb7')](_0x30db09[_0x160c('0xcb')]);return _0x149984;});})[_0x160c('0x26')](respondWithResult(_0x217927,null))[_0x160c('0x60')](handleError(_0x217927,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index c7d453b..03b1978 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 _0x1835=['save','update','emit','exports','events','../../mysqldb','setMaxListeners'];(function(_0x419ad4,_0x44ef95){var _0x581808=function(_0x2336fd){while(--_0x2336fd){_0x419ad4['push'](_0x419ad4['shift']());}};_0x581808(++_0x44ef95);}(_0x1835,0x13f));var _0x5183=function(_0x52af78,_0x423038){_0x52af78=_0x52af78-0x0;var _0x5738e9=_0x1835[_0x52af78];return _0x5738e9;};'use strict';var EventEmitter=require(_0x5183('0x0'));var WhatsappAccount=require(_0x5183('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5183('0x2')](0x0);var events={'afterCreate':_0x5183('0x3'),'afterUpdate':_0x5183('0x4'),'afterDestroy':'remove'};function emitEvent(_0x280462){return function(_0x5bbc20,_0x5d99d5,_0x4d26c3){WhatsappAccountEvents[_0x5183('0x5')](_0x280462+':'+_0x5bbc20['id'],_0x5bbc20);WhatsappAccountEvents[_0x5183('0x5')](_0x280462,_0x5bbc20);_0x4d26c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x5183('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x48e2=['update','remove','emit','exports','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x5b9709,_0x5ce3e9){var _0x33f2f6=function(_0x2a10fe){while(--_0x2a10fe){_0x5b9709['push'](_0x5b9709['shift']());}};_0x33f2f6(++_0x5ce3e9);}(_0x48e2,0x1d9));var _0x248e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x48e2[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x248e('0x0'))['db'][_0x248e('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x248e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x248e('0x3'),'afterDestroy':_0x248e('0x4')};function emitEvent(_0x42e964){return function(_0xf0ee9a,_0x3ca46d,_0x1b9998){WhatsappAccountEvents['emit'](_0x42e964+':'+_0xf0ee9a['id'],_0xf0ee9a);WhatsappAccountEvents[_0x248e('0x5')](_0x42e964,_0xf0ee9a);_0x1b9998(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x248e('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 47529ea..3d1c40c 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 _0x5938=['path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','whatsapp_accounts','util','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5938,0x11e));var _0x8593=function(_0x4d6c9b,_0x1fdd0e){_0x4d6c9b=_0x4d6c9b-0x0;var _0x52b327=_0x5938[_0x4d6c9b];return _0x52b327;};'use strict';var _=require('lodash');var util=require(_0x8593('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8593('0x1'));var BPromise=require(_0x8593('0x2'));var rp=require(_0x8593('0x3'));var fs=require('fs');var path=require(_0x8593('0x4'));var rimraf=require(_0x8593('0x5'));var config=require(_0x8593('0x6'));var attributes=require(_0x8593('0x7'));module[_0x8593('0x8')]=function(_0x260ecd,_0x1160de){return _0x260ecd['define']('WhatsappAccount',attributes,{'tableName':_0x8593('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3691=['define','whatsapp_accounts','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x4e7c3d,_0x31e8e2){var _0x5c71f8=function(_0x110e16){while(--_0x110e16){_0x4e7c3d['push'](_0x4e7c3d['shift']());}};_0x5c71f8(++_0x31e8e2);}(_0x3691,0xd3));var _0x1369=function(_0x243a5c,_0xbd26d8){_0x243a5c=_0x243a5c-0x0;var _0x280ad8=_0x3691[_0x243a5c];return _0x280ad8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1369('0x0'))(_0x1369('0x1'));var moment=require(_0x1369('0x2'));var BPromise=require(_0x1369('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1369('0x4'));var rimraf=require(_0x1369('0x5'));var config=require(_0x1369('0x6'));var attributes=require(_0x1369('0x7'));module[_0x1369('0x8')]=function(_0xdffeda,_0x38be5c){return _0xdffeda[_0x1369('0x9')]('WhatsappAccount',attributes,{'tableName':_0x1369('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 2f2861d..c3c3ee9 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 _0xd94e=['WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','map','include','model','stringify','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3a92d6,_0x5d4ada){var _0x1e7060=function(_0x49908b){while(--_0x49908b){_0x3a92d6['push'](_0x3a92d6['shift']());}};_0x1e7060(++_0x5d4ada);}(_0xd94e,0x16e));var _0xed94=function(_0x18ec3f,_0x7c819e){_0x18ec3f=_0x18ec3f-0x0;var _0x2dbfec=_0xd94e[_0x18ec3f];return _0x2dbfec;};'use strict';var _=require('lodash');var util=require(_0xed94('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xed94('0x1'));var fs=require('fs');var Redis=require(_0xed94('0x2'));var db=require(_0xed94('0x3'))['db'];var utils=require(_0xed94('0x4'));var logger=require(_0xed94('0x5'))(_0xed94('0x6'));var config=require(_0xed94('0x7'));var jayson=require(_0xed94('0x8'));var client=jayson[_0xed94('0x9')][_0xed94('0xa')]({'port':0x232a});config[_0xed94('0xb')]=_[_0xed94('0xc')](config[_0xed94('0xb')],{'host':_0xed94('0xd'),'port':0x18eb});var socket=require(_0xed94('0xe'))(new Redis(config[_0xed94('0xb')]));require(_0xed94('0xf'))[_0xed94('0x10')](socket);function respondWithRpcPromise(_0x58b41a,_0x2359b1,_0xf9246f){return new BPromise(function(_0x2846a0,_0x1c38dd){return client[_0xed94('0x11')](_0x58b41a,_0xf9246f)[_0xed94('0x12')](function(_0x37974b){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x2359b1,_0xed94('0x13'));logger[_0xed94('0x14')](_0xed94('0x15'),_0x2359b1,_0xed94('0x13'),JSON['stringify'](_0x37974b));if(_0x37974b[_0xed94('0x16')]){if(_0x37974b[_0xed94('0x16')][_0xed94('0x17')]===0x1f4){logger[_0xed94('0x16')](_0xed94('0x18'),_0x2359b1,_0x37974b[_0xed94('0x16')][_0xed94('0x19')]);return _0x1c38dd(_0x37974b['error'][_0xed94('0x19')]);}logger['error'](_0xed94('0x18'),_0x2359b1,_0x37974b[_0xed94('0x16')][_0xed94('0x19')]);return _0x2846a0(_0x37974b[_0xed94('0x16')][_0xed94('0x19')]);}else{logger[_0xed94('0x1a')](_0xed94('0x18'),_0x2359b1,'request\x20sent');_0x2846a0(_0x37974b[_0xed94('0x1b')][_0xed94('0x19')]);}})[_0xed94('0x1c')](function(_0x52343f){logger[_0xed94('0x16')](_0xed94('0x18'),_0x2359b1,_0x52343f);_0x1c38dd(_0x52343f);});});}exports[_0xed94('0x1d')]=function(_0x2da334){var _0x311c8c=this;return new Promise(function(_0x5b9ec4,_0x152f2a){return db['WhatsappAccount'][_0xed94('0x1e')]({'raw':_0x2da334[_0xed94('0x1f')]?_0x2da334[_0xed94('0x1f')][_0xed94('0x20')]===undefined?!![]:![]:!![],'where':_0x2da334[_0xed94('0x1f')]?_0x2da334[_0xed94('0x1f')][_0xed94('0x21')]||null:null,'attributes':_0x2da334[_0xed94('0x1f')]?_0x2da334[_0xed94('0x1f')][_0xed94('0x22')]||null:null,'include':_0x2da334['options']?_0x2da334[_0xed94('0x1f')]['include']?_[_0xed94('0x23')](_0x2da334[_0xed94('0x1f')][_0xed94('0x24')],function(_0x596921){return{'model':db[_0x596921[_0xed94('0x25')]],'as':_0x596921['as'],'attributes':_0x596921[_0xed94('0x22')],'include':_0x596921[_0xed94('0x24')]?_[_0xed94('0x23')](_0x596921[_0xed94('0x24')],function(_0x360a23){return{'model':db[_0x360a23['model']],'as':_0x360a23['as'],'attributes':_0x360a23[_0xed94('0x22')],'include':_0x360a23[_0xed94('0x24')]?_[_0xed94('0x23')](_0x360a23[_0xed94('0x24')],function(_0x21f03c){return{'model':db[_0x21f03c[_0xed94('0x25')]],'as':_0x21f03c['as'],'attributes':_0x21f03c[_0xed94('0x22')]};}):[]};}):[]};}):[]:[]})[_0xed94('0x12')](function(_0x2cacc3){logger[_0xed94('0x1a')](_0xed94('0x1d'),_0x2da334);logger[_0xed94('0x14')](_0xed94('0x1d'),_0x2da334,JSON[_0xed94('0x26')](_0x2cacc3));_0x5b9ec4(_0x2cacc3);})[_0xed94('0x1c')](function(_0x11f560){logger[_0xed94('0x16')](_0xed94('0x1d'),_0x11f560[_0xed94('0x19')],_0x2da334);_0x152f2a(_0x311c8c[_0xed94('0x16')](0x1f4,_0x11f560[_0xed94('0x19')]));});});}; \ No newline at end of file +var _0xd903=['model','ShowWhatsappAccount','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','./whatsappAccount.socket','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','options','where','attributes','include','map'];(function(_0x386d66,_0x4d823d){var _0x391aa8=function(_0x67f73c){while(--_0x67f73c){_0x386d66['push'](_0x386d66['shift']());}};_0x391aa8(++_0x4d823d);}(_0xd903,0x198));var _0x3d90=function(_0x4cd5db,_0x77188c){_0x4cd5db=_0x4cd5db-0x0;var _0x2e9975=_0xd903[_0x4cd5db];return _0x2e9975;};'use strict';var _=require('lodash');var util=require(_0x3d90('0x0'));var moment=require(_0x3d90('0x1'));var BPromise=require(_0x3d90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d90('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d90('0x4'));var logger=require('../../config/logger')(_0x3d90('0x5'));var config=require(_0x3d90('0x6'));var jayson=require(_0x3d90('0x7'));var client=jayson['client'][_0x3d90('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d90('0x9'))['register'](socket);function respondWithRpcPromise(_0x489e39,_0x41f4a7,_0x3ad461){return new BPromise(function(_0x387b26,_0x2a78e8){return client[_0x3d90('0xa')](_0x489e39,_0x3ad461)[_0x3d90('0xb')](function(_0x5058c2){logger['info'](_0x3d90('0xc'),_0x41f4a7,_0x3d90('0xd'));logger[_0x3d90('0xe')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x41f4a7,_0x3d90('0xd'),JSON[_0x3d90('0xf')](_0x5058c2));if(_0x5058c2[_0x3d90('0x10')]){if(_0x5058c2['error'][_0x3d90('0x11')]===0x1f4){logger[_0x3d90('0x10')](_0x3d90('0xc'),_0x41f4a7,_0x5058c2['error'][_0x3d90('0x12')]);return _0x2a78e8(_0x5058c2[_0x3d90('0x10')][_0x3d90('0x12')]);}logger[_0x3d90('0x10')](_0x3d90('0xc'),_0x41f4a7,_0x5058c2[_0x3d90('0x10')][_0x3d90('0x12')]);return _0x387b26(_0x5058c2[_0x3d90('0x10')][_0x3d90('0x12')]);}else{logger[_0x3d90('0x13')](_0x3d90('0xc'),_0x41f4a7,'request\x20sent');_0x387b26(_0x5058c2[_0x3d90('0x14')][_0x3d90('0x12')]);}})[_0x3d90('0x15')](function(_0x5b4d75){logger[_0x3d90('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x41f4a7,_0x5b4d75);_0x2a78e8(_0x5b4d75);});});}exports['ShowWhatsappAccount']=function(_0x15af1d){var _0x4b90c7=this;return new Promise(function(_0x57788f,_0x5a1c07){return db['WhatsappAccount']['find']({'raw':_0x15af1d[_0x3d90('0x16')]?_0x15af1d['options']['raw']===undefined?!![]:![]:!![],'where':_0x15af1d[_0x3d90('0x16')]?_0x15af1d[_0x3d90('0x16')][_0x3d90('0x17')]||null:null,'attributes':_0x15af1d[_0x3d90('0x16')]?_0x15af1d[_0x3d90('0x16')][_0x3d90('0x18')]||null:null,'include':_0x15af1d[_0x3d90('0x16')]?_0x15af1d[_0x3d90('0x16')][_0x3d90('0x19')]?_[_0x3d90('0x1a')](_0x15af1d[_0x3d90('0x16')]['include'],function(_0x474b9b){return{'model':db[_0x474b9b[_0x3d90('0x1b')]],'as':_0x474b9b['as'],'attributes':_0x474b9b[_0x3d90('0x18')],'include':_0x474b9b[_0x3d90('0x19')]?_['map'](_0x474b9b[_0x3d90('0x19')],function(_0x3eae72){return{'model':db[_0x3eae72[_0x3d90('0x1b')]],'as':_0x3eae72['as'],'attributes':_0x3eae72['attributes'],'include':_0x3eae72['include']?_[_0x3d90('0x1a')](_0x3eae72[_0x3d90('0x19')],function(_0x1046da){return{'model':db[_0x1046da[_0x3d90('0x1b')]],'as':_0x1046da['as'],'attributes':_0x1046da[_0x3d90('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3d90('0xb')](function(_0x2208c0){logger[_0x3d90('0x13')](_0x3d90('0x1c'),_0x15af1d);logger[_0x3d90('0xe')](_0x3d90('0x1c'),_0x15af1d,JSON[_0x3d90('0xf')](_0x2208c0));_0x57788f(_0x2208c0);})['catch'](function(_0xd2c2f){logger[_0x3d90('0x10')](_0x3d90('0x1c'),_0xd2c2f[_0x3d90('0x12')],_0x15af1d);_0x5a1c07(_0x4b90c7[_0x3d90('0x10')](0x1f4,_0xd2c2f[_0x3d90('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4b9c837..3ba7aa2 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 _0x80b2=['update','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x56e2a8,_0x2cf877){var _0x232412=function(_0x468b7c){while(--_0x468b7c){_0x56e2a8['push'](_0x56e2a8['shift']());}};_0x232412(++_0x2cf877);}(_0x80b2,0xf5));var _0x280b=function(_0x297d2b,_0x3689a6){_0x297d2b=_0x297d2b-0x0;var _0x40eff9=_0x80b2[_0x297d2b];return _0x40eff9;};'use strict';var WhatsappAccountEvents=require(_0x280b('0x0'));var events=[_0x280b('0x1'),_0x280b('0x2'),_0x280b('0x3')];function createListener(_0x55e677,_0x5a7970){return function(_0x5721c4){_0x5a7970['emit'](_0x55e677,_0x5721c4);};}function removeListener(_0x51fcd0,_0x696d54){return function(){WhatsappAccountEvents[_0x280b('0x4')](_0x51fcd0,_0x696d54);};}exports[_0x280b('0x5')]=function(_0x2b5698){for(var _0x26aa7e=0x0,_0x299f90=events[_0x280b('0x6')];_0x26aa7e<_0x299f90;_0x26aa7e++){var _0x35e533=events[_0x26aa7e];var _0x10582b=createListener(_0x280b('0x7')+_0x35e533,_0x2b5698);WhatsappAccountEvents['on'](_0x35e533,_0x10582b);}}; \ No newline at end of file +var _0x5bfe=['emit','removeListener','./whatsappAccount.events','save','remove','update'];(function(_0x594670,_0x4b9fdd){var _0x36a5b7=function(_0x45471e){while(--_0x45471e){_0x594670['push'](_0x594670['shift']());}};_0x36a5b7(++_0x4b9fdd);}(_0x5bfe,0x13a));var _0xe5bf=function(_0x4a1820,_0x42bdcb){_0x4a1820=_0x4a1820-0x0;var _0x2b2729=_0x5bfe[_0x4a1820];return _0x2b2729;};'use strict';var WhatsappAccountEvents=require(_0xe5bf('0x0'));var events=[_0xe5bf('0x1'),_0xe5bf('0x2'),_0xe5bf('0x3')];function createListener(_0x254f48,_0xabfe44){return function(_0x5e445a){_0xabfe44[_0xe5bf('0x4')](_0x254f48,_0x5e445a);};}function removeListener(_0x4f71e0,_0x53e567){return function(){WhatsappAccountEvents[_0xe5bf('0x5')](_0x4f71e0,_0x53e567);};}exports['register']=function(_0x479f97){for(var _0x344299=0x0,_0x51936d=events['length'];_0x344299<_0x51936d;_0x344299++){var _0x4dd33f=events[_0x344299];var _0x55d4cf=createListener('whatsappAccount:'+_0x4dd33f,_0x479f97);WhatsappAccountEvents['on'](_0x4dd33f,_0x55d4cf);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 73e964c..36bf5af 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 _0x1cc1=['util','path','connect-timeout','express','Router','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports'];(function(_0x42c778,_0xbef382){var _0x5571e1=function(_0xc50da2){while(--_0xc50da2){_0x42c778['push'](_0x42c778['shift']());}};_0x5571e1(++_0xbef382);}(_0x1cc1,0x180));var _0x11cc=function(_0x2de136,_0x52333f){_0x2de136=_0x2de136-0x0;var _0x52714e=_0x1cc1[_0x2de136];return _0x52714e;};'use strict';var multer=require('multer');var util=require(_0x11cc('0x0'));var path=require(_0x11cc('0x1'));var timeout=require(_0x11cc('0x2'));var express=require(_0x11cc('0x3'));var router=express[_0x11cc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x11cc('0x5'));router[_0x11cc('0x6')]('/',auth[_0x11cc('0x7')](),controller[_0x11cc('0x8')]);router[_0x11cc('0x6')](_0x11cc('0x9'),auth[_0x11cc('0x7')](),controller['show']);router[_0x11cc('0xa')]('/',auth[_0x11cc('0x7')](),controller['create']);router[_0x11cc('0xb')](_0x11cc('0x9'),auth[_0x11cc('0x7')](),controller[_0x11cc('0xc')]);router[_0x11cc('0xd')](_0x11cc('0x9'),auth[_0x11cc('0x7')](),controller[_0x11cc('0xe')]);module[_0x11cc('0xf')]=router; \ No newline at end of file +var _0xa1ce=['Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','post','put','/:id','update','delete','exports','util','path','express'];(function(_0x30bb7c,_0x27a364){var _0x3b32be=function(_0x4b031d){while(--_0x4b031d){_0x30bb7c['push'](_0x30bb7c['shift']());}};_0x3b32be(++_0x27a364);}(_0xa1ce,0x140));var _0xea1c=function(_0x2fb307,_0x3f90d6){_0x2fb307=_0x2fb307-0x0;var _0x3623e5=_0xa1ce[_0x2fb307];return _0x3623e5;};'use strict';var multer=require('multer');var util=require(_0xea1c('0x0'));var path=require(_0xea1c('0x1'));var timeout=require('connect-timeout');var express=require(_0xea1c('0x2'));var router=express[_0xea1c('0x3')]();var fs_extra=require(_0xea1c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xea1c('0x5'));var config=require(_0xea1c('0x6'));var controller=require(_0xea1c('0x7'));router[_0xea1c('0x8')]('/',auth[_0xea1c('0x9')](),controller[_0xea1c('0xa')]);router[_0xea1c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xea1c('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xea1c('0xc')](_0xea1c('0xd'),auth['isAuthenticated'](),controller[_0xea1c('0xe')]);router[_0xea1c('0xf')](_0xea1c('0xd'),auth[_0xea1c('0x9')](),controller['destroy']);module[_0xea1c('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 7e5993c..ccb8398 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 _0x26d1=['sequelize','exports','STRING','noop','TEXT'];(function(_0x4cd98b,_0x1e83bc){var _0xa9b33b=function(_0x3a2c1a){while(--_0x3a2c1a){_0x4cd98b['push'](_0x4cd98b['shift']());}};_0xa9b33b(++_0x1e83bc);}(_0x26d1,0x1ea));var _0x126d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x26d1[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x126d('0x0'));module[_0x126d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x126d('0x2')],'allowNull':![],'defaultValue':_0x126d('0x3')},'appdata':{'type':Sequelize[_0x126d('0x4')]()},'description':{'type':Sequelize[_0x126d('0x2')]},'interval':{'type':Sequelize[_0x126d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x310a=['TEXT','exports','STRING','noop'];(function(_0x4b33c0,_0x17fb55){var _0x43c889=function(_0x410c0d){while(--_0x410c0d){_0x4b33c0['push'](_0x4b33c0['shift']());}};_0x43c889(++_0x17fb55);}(_0x310a,0x175));var _0xa310=function(_0x4953df,_0x4897d7){_0x4953df=_0x4953df-0x0;var _0xf120ed=_0x310a[_0x4953df];return _0xf120ed;};'use strict';var Sequelize=require('sequelize');module[_0xa310('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa310('0x1')],'allowNull':![],'defaultValue':_0xa310('0x2')},'appdata':{'type':Sequelize[_0xa310('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa310('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 0e82b12..1f9a1f0 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 _0x471a=['Content-Range','apply','reject','save','then','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set'];(function(_0x4fc702,_0x590060){var _0x1357d3=function(_0x45a119){while(--_0x45a119){_0x4fc702['push'](_0x4fc702['shift']());}};_0x1357d3(++_0x590060);}(_0x471a,0x18d));var _0xa471=function(_0x524a85,_0x5e1060){_0x524a85=_0x524a85-0x0;var _0x596ef4=_0x471a[_0x524a85];return _0x596ef4;};'use strict';var emlformat=require(_0xa471('0x0'));var rimraf=require(_0xa471('0x1'));var zipdir=require(_0xa471('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa471('0x3'));var moment=require(_0xa471('0x4'));var BPromise=require(_0xa471('0x5'));var Mustache=require(_0xa471('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa471('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa471('0x8'));var crypto=require(_0xa471('0x9'));var jsforce=require(_0xa471('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa471('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa471('0xb'));var authService=require(_0xa471('0xc'));var qs=require(_0xa471('0xd'));var as=require(_0xa471('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa471('0xf'))(_0xa471('0x10'));var utils=require(_0xa471('0x11'));var config=require(_0xa471('0x12'));var licenseUtil=require(_0xa471('0x13'));var db=require(_0xa471('0x14'))['db'];function respondWithStatusCode(_0x5703c9,_0x2ae2a2){_0x2ae2a2=_0x2ae2a2||0xcc;return function(_0x4f1a44){if(_0x4f1a44){return _0x5703c9[_0xa471('0x15')](_0x2ae2a2);}return _0x5703c9['status'](_0x2ae2a2)[_0xa471('0x16')]();};}function respondWithResult(_0x115541,_0x501375){_0x501375=_0x501375||0xc8;return function(_0x39c025){if(_0x39c025){return _0x115541[_0xa471('0x17')](_0x501375)[_0xa471('0x18')](_0x39c025);}};}function respondWithFilteredResult(_0x531451,_0x31bcb7){return function(_0x1ed20c){if(_0x1ed20c){var _0x16e5bf=typeof _0x31bcb7[_0xa471('0x19')]===_0xa471('0x1a')&&typeof _0x31bcb7['limit']===_0xa471('0x1a');var _0x35f2f3=_0x1ed20c[_0xa471('0x1b')];var _0x5e5225=_0x16e5bf?0x0:_0x31bcb7['offset'];var _0x23fb08=_0x16e5bf?_0x1ed20c['count']:_0x31bcb7[_0xa471('0x19')]+_0x31bcb7['limit'];var _0x5e56dc;if(_0x23fb08>=_0x35f2f3){_0x23fb08=_0x35f2f3;_0x5e56dc=0xc8;}else{_0x5e56dc=0xce;}_0x531451[_0xa471('0x17')](_0x5e56dc);return _0x531451[_0xa471('0x1c')](_0xa471('0x1d'),_0x5e5225+'-'+_0x23fb08+'/'+_0x35f2f3)[_0xa471('0x18')](_0x1ed20c);}return null;};}function patchUpdates(_0x45ff30){return function(_0x6b230){try{jsonpatch[_0xa471('0x1e')](_0x6b230,_0x45ff30,!![]);}catch(_0x554610){return BPromise[_0xa471('0x1f')](_0x554610);}return _0x6b230[_0xa471('0x20')]();};}function saveUpdates(_0x398f23,_0x49ea0b){return function(_0x3e0972){if(_0x3e0972){return _0x3e0972['update'](_0x398f23)[_0xa471('0x21')](function(_0x2b7755){return _0x2b7755;});}return null;};}function removeEntity(_0x56a34e,_0x21b9e5){return function(_0x41a855){if(_0x41a855){return _0x41a855['destroy']()[_0xa471('0x21')](function(){_0x56a34e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x188d6a,_0x2b1d3c){return function(_0x56682a){if(!_0x56682a){_0x188d6a['sendStatus'](0x194);}return _0x56682a;};}function handleError(_0x165504,_0x2d2a91){_0x2d2a91=_0x2d2a91||0x1f4;return function(_0x5009cf){logger[_0xa471('0x22')](_0x5009cf[_0xa471('0x23')]);if(_0x5009cf[_0xa471('0x24')]){delete _0x5009cf[_0xa471('0x24')];}_0x165504['status'](_0x2d2a91)[_0xa471('0x25')](_0x5009cf);};}exports[_0xa471('0x26')]=function(_0x5a3f99,_0x3851d9){var _0x3bb318={},_0x469b08={},_0x3961b5={'count':0x0,'rows':[]};var _0x5d4441=_[_0xa471('0x27')](db[_0xa471('0x28')]['rawAttributes'],function(_0x4eb527){return{'name':_0x4eb527[_0xa471('0x29')],'type':_0x4eb527[_0xa471('0x2a')][_0xa471('0x2b')]};});_0x469b08[_0xa471('0x2c')]=_[_0xa471('0x27')](_0x5d4441,'name');_0x469b08[_0xa471('0x2d')]=_[_0xa471('0x2e')](_0x5a3f99[_0xa471('0x2d')]);_0x469b08[_0xa471('0x2f')]=_[_0xa471('0x30')](_0x469b08[_0xa471('0x2c')],_0x469b08[_0xa471('0x2d')]);_0x3bb318[_0xa471('0x31')]=_[_0xa471('0x30')](_0x469b08['model'],qs[_0xa471('0x32')](_0x5a3f99[_0xa471('0x2d')][_0xa471('0x32')]));_0x3bb318[_0xa471('0x31')]=_0x3bb318[_0xa471('0x31')]['length']?_0x3bb318[_0xa471('0x31')]:_0x469b08[_0xa471('0x2c')];if(!_0x5a3f99[_0xa471('0x2d')][_0xa471('0x33')](_0xa471('0x34'))){_0x3bb318[_0xa471('0x35')]=qs['limit'](_0x5a3f99[_0xa471('0x2d')][_0xa471('0x35')]);_0x3bb318[_0xa471('0x19')]=qs[_0xa471('0x19')](_0x5a3f99[_0xa471('0x2d')][_0xa471('0x19')]);}_0x3bb318['order']=qs[_0xa471('0x36')](_0x5a3f99['query']['sort']);_0x3bb318[_0xa471('0x37')]=qs[_0xa471('0x2f')](_[_0xa471('0x38')](_0x5a3f99[_0xa471('0x2d')],_0x469b08[_0xa471('0x2f')]),_0x5d4441);if(_0x5a3f99['query'][_0xa471('0x39')]){_0x3bb318[_0xa471('0x37')]=_[_0xa471('0x3a')](_0x3bb318[_0xa471('0x37')],{'$or':_[_0xa471('0x27')](_0x5d4441,function(_0xcf1361){if(_0xcf1361[_0xa471('0x2a')]!=='VIRTUAL'){var _0x2aefbf={};_0x2aefbf[_0xcf1361[_0xa471('0x24')]]={'$like':'%'+_0x5a3f99['query']['filter']+'%'};return _0x2aefbf;}})});}_0x3bb318=_[_0xa471('0x3a')]({},_0x3bb318,_0x5a3f99[_0xa471('0x3b')]);var _0x2d98f0={'where':_0x3bb318[_0xa471('0x37')]};return db[_0xa471('0x28')][_0xa471('0x1b')](_0x2d98f0)[_0xa471('0x21')](function(_0xcc3f85){_0x3961b5[_0xa471('0x1b')]=_0xcc3f85;if(_0x5a3f99['query'][_0xa471('0x3c')]){_0x3bb318['include']=[{'all':!![]}];}return db[_0xa471('0x28')][_0xa471('0x3d')](_0x3bb318);})[_0xa471('0x21')](function(_0x19eb6e){_0x3961b5[_0xa471('0x3e')]=_0x19eb6e;return _0x3961b5;})[_0xa471('0x21')](respondWithFilteredResult(_0x3851d9,_0x3bb318))[_0xa471('0x3f')](handleError(_0x3851d9,null));};exports['show']=function(_0xc932ae,_0x2d848a){var _0x50668b={'raw':!![],'where':{'id':_0xc932ae[_0xa471('0x40')]['id']}},_0x38ec90={};_0x38ec90['model']=_['keys'](db[_0xa471('0x28')][_0xa471('0x41')]);_0x38ec90[_0xa471('0x2d')]=_[_0xa471('0x2e')](_0xc932ae[_0xa471('0x2d')]);_0x38ec90[_0xa471('0x2f')]=_[_0xa471('0x30')](_0x38ec90[_0xa471('0x2c')],_0x38ec90[_0xa471('0x2d')]);_0x50668b[_0xa471('0x31')]=_[_0xa471('0x30')](_0x38ec90[_0xa471('0x2c')],qs['fields'](_0xc932ae[_0xa471('0x2d')][_0xa471('0x32')]));_0x50668b[_0xa471('0x31')]=_0x50668b[_0xa471('0x31')][_0xa471('0x42')]?_0x50668b['attributes']:_0x38ec90[_0xa471('0x2c')];if(_0xc932ae['query'][_0xa471('0x3c')]){_0x50668b['include']=[{'all':!![]}];}_0x50668b=_[_0xa471('0x3a')]({},_0x50668b,_0xc932ae[_0xa471('0x3b')]);return db[_0xa471('0x28')][_0xa471('0x43')](_0x50668b)[_0xa471('0x21')](handleEntityNotFound(_0x2d848a,null))['then'](respondWithResult(_0x2d848a,null))[_0xa471('0x3f')](handleError(_0x2d848a,null));};exports['create']=function(_0x2fb716,_0x39e2d8){return db[_0xa471('0x28')][_0xa471('0x44')](_0x2fb716[_0xa471('0x45')],{})['then'](respondWithResult(_0x39e2d8,0xc9))[_0xa471('0x3f')](handleError(_0x39e2d8,null));};exports['update']=function(_0x5c0efe,_0x2cf4a9){if(_0x5c0efe['body']['id']){delete _0x5c0efe['body']['id'];}return db[_0xa471('0x28')]['find']({'where':{'id':_0x5c0efe[_0xa471('0x40')]['id']}})[_0xa471('0x21')](handleEntityNotFound(_0x2cf4a9,null))['then'](saveUpdates(_0x5c0efe[_0xa471('0x45')],null))[_0xa471('0x21')](respondWithResult(_0x2cf4a9,null))[_0xa471('0x3f')](handleError(_0x2cf4a9,null));};exports[_0xa471('0x46')]=function(_0x3e486f,_0x21323b){return db[_0xa471('0x28')]['find']({'where':{'id':_0x3e486f[_0xa471('0x40')]['id']}})[_0xa471('0x21')](handleEntityNotFound(_0x21323b,null))[_0xa471('0x21')](removeEntity(_0x21323b,null))['catch'](handleError(_0x21323b,null));}; \ No newline at end of file +var _0x6ab9=['WhatsappApplication','rawAttributes','fieldName','key','model','intersection','query','attributes','fields','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map'];(function(_0x12f52e,_0x26fd99){var _0x12763c=function(_0x303e9b){while(--_0x303e9b){_0x12f52e['push'](_0x12f52e['shift']());}};_0x12763c(++_0x26fd99);}(_0x6ab9,0x19a));var _0x96ab=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x6ab9[_0x2b9b7f];return _0x4ed19a;};'use strict';var emlformat=require(_0x96ab('0x0'));var rimraf=require(_0x96ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96ab('0x2'));var rp=require(_0x96ab('0x3'));var moment=require(_0x96ab('0x4'));var BPromise=require(_0x96ab('0x5'));var Mustache=require(_0x96ab('0x6'));var util=require('util');var path=require('path');var sox=require(_0x96ab('0x7'));var csv=require(_0x96ab('0x8'));var ejs=require(_0x96ab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96ab('0xa'));var squel=require(_0x96ab('0xb'));var crypto=require('crypto');var jsforce=require(_0x96ab('0xc'));var deskjs=require(_0x96ab('0xd'));var toCsv=require(_0x96ab('0x8'));var querystring=require(_0x96ab('0xe'));var Papa=require(_0x96ab('0xf'));var Redis=require(_0x96ab('0x10'));var authService=require(_0x96ab('0x11'));var qs=require(_0x96ab('0x12'));var as=require(_0x96ab('0x13'));var hardwareService=require(_0x96ab('0x14'));var logger=require(_0x96ab('0x15'))(_0x96ab('0x16'));var utils=require(_0x96ab('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x96ab('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9204,_0x1131b5){_0x1131b5=_0x1131b5||0xcc;return function(_0x2d3ec3){if(_0x2d3ec3){return _0x2c9204[_0x96ab('0x19')](_0x1131b5);}return _0x2c9204[_0x96ab('0x1a')](_0x1131b5)[_0x96ab('0x1b')]();};}function respondWithResult(_0x3ff9a9,_0x24e2c4){_0x24e2c4=_0x24e2c4||0xc8;return function(_0x126761){if(_0x126761){return _0x3ff9a9[_0x96ab('0x1a')](_0x24e2c4)[_0x96ab('0x1c')](_0x126761);}};}function respondWithFilteredResult(_0x4df67b,_0x4ec844){return function(_0x3b54cc){if(_0x3b54cc){var _0x8d5c87=typeof _0x4ec844[_0x96ab('0x1d')]==='undefined'&&typeof _0x4ec844[_0x96ab('0x1e')]===_0x96ab('0x1f');var _0x56f92b=_0x3b54cc[_0x96ab('0x20')];var _0x4eca78=_0x8d5c87?0x0:_0x4ec844[_0x96ab('0x1d')];var _0x1a502a=_0x8d5c87?_0x3b54cc[_0x96ab('0x20')]:_0x4ec844[_0x96ab('0x1d')]+_0x4ec844[_0x96ab('0x1e')];var _0x1577bb;if(_0x1a502a>=_0x56f92b){_0x1a502a=_0x56f92b;_0x1577bb=0xc8;}else{_0x1577bb=0xce;}_0x4df67b[_0x96ab('0x1a')](_0x1577bb);return _0x4df67b[_0x96ab('0x21')](_0x96ab('0x22'),_0x4eca78+'-'+_0x1a502a+'/'+_0x56f92b)[_0x96ab('0x1c')](_0x3b54cc);}return null;};}function patchUpdates(_0x2aa3c4){return function(_0x4f3bb4){try{jsonpatch['apply'](_0x4f3bb4,_0x2aa3c4,!![]);}catch(_0x347b91){return BPromise[_0x96ab('0x23')](_0x347b91);}return _0x4f3bb4[_0x96ab('0x24')]();};}function saveUpdates(_0x583be2,_0x41936c){return function(_0x5ccaaa){if(_0x5ccaaa){return _0x5ccaaa[_0x96ab('0x25')](_0x583be2)['then'](function(_0x33c140){return _0x33c140;});}return null;};}function removeEntity(_0x90fa22,_0x5a02d0){return function(_0x1deef7){if(_0x1deef7){return _0x1deef7[_0x96ab('0x26')]()[_0x96ab('0x27')](function(){_0x90fa22[_0x96ab('0x1a')](0xcc)[_0x96ab('0x1b')]();});}};}function handleEntityNotFound(_0x27d6d5,_0x9cb9b6){return function(_0x2837a7){if(!_0x2837a7){_0x27d6d5[_0x96ab('0x19')](0x194);}return _0x2837a7;};}function handleError(_0x53869e,_0x215f09){_0x215f09=_0x215f09||0x1f4;return function(_0x524e1c){logger[_0x96ab('0x28')](_0x524e1c[_0x96ab('0x29')]);if(_0x524e1c[_0x96ab('0x2a')]){delete _0x524e1c[_0x96ab('0x2a')];}_0x53869e[_0x96ab('0x1a')](_0x215f09)[_0x96ab('0x2b')](_0x524e1c);};}exports[_0x96ab('0x2c')]=function(_0x435613,_0x4f954c){var _0xefb070={},_0x269c51={},_0xa5c503={'count':0x0,'rows':[]};var _0x5a998e=_[_0x96ab('0x2d')](db[_0x96ab('0x2e')][_0x96ab('0x2f')],function(_0x575664){return{'name':_0x575664[_0x96ab('0x30')],'type':_0x575664['type'][_0x96ab('0x31')]};});_0x269c51[_0x96ab('0x32')]=_['map'](_0x5a998e,_0x96ab('0x2a'));_0x269c51['query']=_['keys'](_0x435613['query']);_0x269c51['filters']=_[_0x96ab('0x33')](_0x269c51['model'],_0x269c51[_0x96ab('0x34')]);_0xefb070[_0x96ab('0x35')]=_[_0x96ab('0x33')](_0x269c51[_0x96ab('0x32')],qs[_0x96ab('0x36')](_0x435613['query']['fields']));_0xefb070[_0x96ab('0x35')]=_0xefb070[_0x96ab('0x35')]['length']?_0xefb070[_0x96ab('0x35')]:_0x269c51[_0x96ab('0x32')];if(!_0x435613['query']['hasOwnProperty'](_0x96ab('0x37'))){_0xefb070[_0x96ab('0x1e')]=qs[_0x96ab('0x1e')](_0x435613[_0x96ab('0x34')]['limit']);_0xefb070[_0x96ab('0x1d')]=qs['offset'](_0x435613['query'][_0x96ab('0x1d')]);}_0xefb070['order']=qs[_0x96ab('0x38')](_0x435613[_0x96ab('0x34')][_0x96ab('0x38')]);_0xefb070[_0x96ab('0x39')]=qs['filters'](_[_0x96ab('0x3a')](_0x435613[_0x96ab('0x34')],_0x269c51[_0x96ab('0x3b')]),_0x5a998e);if(_0x435613[_0x96ab('0x34')][_0x96ab('0x3c')]){_0xefb070['where']=_[_0x96ab('0x3d')](_0xefb070['where'],{'$or':_[_0x96ab('0x2d')](_0x5a998e,function(_0x4dae51){if(_0x4dae51[_0x96ab('0x3e')]!==_0x96ab('0x3f')){var _0x3f2305={};_0x3f2305[_0x4dae51[_0x96ab('0x2a')]]={'$like':'%'+_0x435613['query'][_0x96ab('0x3c')]+'%'};return _0x3f2305;}})});}_0xefb070=_[_0x96ab('0x3d')]({},_0xefb070,_0x435613[_0x96ab('0x40')]);var _0x3c7e5d={'where':_0xefb070[_0x96ab('0x39')]};return db[_0x96ab('0x2e')][_0x96ab('0x20')](_0x3c7e5d)[_0x96ab('0x27')](function(_0x14bcbf){_0xa5c503[_0x96ab('0x20')]=_0x14bcbf;if(_0x435613[_0x96ab('0x34')][_0x96ab('0x41')]){_0xefb070['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x96ab('0x42')](_0xefb070);})[_0x96ab('0x27')](function(_0xb541d8){_0xa5c503[_0x96ab('0x43')]=_0xb541d8;return _0xa5c503;})[_0x96ab('0x27')](respondWithFilteredResult(_0x4f954c,_0xefb070))[_0x96ab('0x44')](handleError(_0x4f954c,null));};exports[_0x96ab('0x45')]=function(_0x4b73d7,_0x347957){var _0x53f848={'raw':!![],'where':{'id':_0x4b73d7[_0x96ab('0x46')]['id']}},_0x5e8109={};_0x5e8109[_0x96ab('0x32')]=_['keys'](db[_0x96ab('0x2e')][_0x96ab('0x2f')]);_0x5e8109[_0x96ab('0x34')]=_[_0x96ab('0x47')](_0x4b73d7[_0x96ab('0x34')]);_0x5e8109['filters']=_[_0x96ab('0x33')](_0x5e8109['model'],_0x5e8109['query']);_0x53f848[_0x96ab('0x35')]=_['intersection'](_0x5e8109[_0x96ab('0x32')],qs[_0x96ab('0x36')](_0x4b73d7[_0x96ab('0x34')]['fields']));_0x53f848[_0x96ab('0x35')]=_0x53f848[_0x96ab('0x35')][_0x96ab('0x48')]?_0x53f848[_0x96ab('0x35')]:_0x5e8109[_0x96ab('0x32')];if(_0x4b73d7['query'][_0x96ab('0x41')]){_0x53f848['include']=[{'all':!![]}];}_0x53f848=_[_0x96ab('0x3d')]({},_0x53f848,_0x4b73d7['options']);return db[_0x96ab('0x2e')]['find'](_0x53f848)[_0x96ab('0x27')](handleEntityNotFound(_0x347957,null))[_0x96ab('0x27')](respondWithResult(_0x347957,null))[_0x96ab('0x44')](handleError(_0x347957,null));};exports[_0x96ab('0x49')]=function(_0x25d387,_0x42dbd7){return db['WhatsappApplication'][_0x96ab('0x49')](_0x25d387[_0x96ab('0x4a')],{})['then'](respondWithResult(_0x42dbd7,0xc9))[_0x96ab('0x44')](handleError(_0x42dbd7,null));};exports['update']=function(_0x14b467,_0x170992){if(_0x14b467[_0x96ab('0x4a')]['id']){delete _0x14b467['body']['id'];}return db[_0x96ab('0x2e')][_0x96ab('0x4b')]({'where':{'id':_0x14b467['params']['id']}})[_0x96ab('0x27')](handleEntityNotFound(_0x170992,null))[_0x96ab('0x27')](saveUpdates(_0x14b467[_0x96ab('0x4a')],null))[_0x96ab('0x27')](respondWithResult(_0x170992,null))[_0x96ab('0x44')](handleError(_0x170992,null));};exports[_0x96ab('0x26')]=function(_0x13b865,_0x5f2521){return db[_0x96ab('0x2e')][_0x96ab('0x4b')]({'where':{'id':_0x13b865['params']['id']}})[_0x96ab('0x27')](handleEntityNotFound(_0x5f2521,null))[_0x96ab('0x27')](removeEntity(_0x5f2521,null))['catch'](handleError(_0x5f2521,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 64ecd8d..dcfefac 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 _0xe198=['util','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xea5ff3,_0x11d601){var _0x57b1e3=function(_0x2c615e){while(--_0x2c615e){_0xea5ff3['push'](_0xea5ff3['shift']());}};_0x57b1e3(++_0x11d601);}(_0xe198,0x6f));var _0x8e19=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe198[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e19('0x2'));var BPromise=require(_0x8e19('0x3'));var rp=require(_0x8e19('0x4'));var fs=require('fs');var path=require(_0x8e19('0x5'));var rimraf=require(_0x8e19('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e19('0x7'));module[_0x8e19('0x8')]=function(_0x2fb138,_0x188ce0){return _0x2fb138[_0x8e19('0x9')](_0x8e19('0xa'),attributes,{'tableName':_0x8e19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8e19('0xc'),'collate':_0x8e19('0xd')});}; \ No newline at end of file +var _0x1cc7=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x3f78d4,_0x203dac){var _0x47dac1=function(_0x50a9d9){while(--_0x50a9d9){_0x3f78d4['push'](_0x3f78d4['shift']());}};_0x47dac1(++_0x203dac);}(_0x1cc7,0x15a));var _0x71cc=function(_0x2604d2,_0x568083){_0x2604d2=_0x2604d2-0x0;var _0x8ecc69=_0x1cc7[_0x2604d2];return _0x8ecc69;};'use strict';var _=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var logger=require(_0x71cc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x71cc('0x3'));var fs=require('fs');var path=require(_0x71cc('0x4'));var rimraf=require(_0x71cc('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x27a175,_0x4ecf81){return _0x27a175[_0x71cc('0x6')](_0x71cc('0x7'),attributes,{'tableName':_0x71cc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x71cc('0x9'),'collate':_0x71cc('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index fbadb69..d0f339e 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 _0x5636=['code','WhatsappApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5636,0x102));var _0x6563=function(_0x3da888,_0x4b6e12){_0x3da888=_0x3da888-0x0;var _0x1885e7=_0x5636[_0x3da888];return _0x1885e7;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193942,_0x9884a9,_0x2d57d5){return new BPromise(function(_0x2d0d5b,_0x98fcd4){return client[_0x6563('0xa')](_0x193942,_0x2d57d5)[_0x6563('0xb')](function(_0x3ccb4e){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));logger[_0x6563('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x9884a9,'request\x20sent',JSON['stringify'](_0x3ccb4e));if(_0x3ccb4e[_0x6563('0xe')]){if(_0x3ccb4e[_0x6563('0xe')][_0x6563('0xf')]===0x1f4){logger[_0x6563('0xe')](_0x6563('0x10'),_0x9884a9,_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);return _0x98fcd4(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}logger['error'](_0x6563('0x10'),_0x9884a9,_0x3ccb4e['error'][_0x6563('0x11')]);return _0x2d0d5b(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}else{logger[_0x6563('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));_0x2d0d5b(_0x3ccb4e[_0x6563('0x13')][_0x6563('0x11')]);}})[_0x6563('0x14')](function(_0x4e7282){logger[_0x6563('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x9884a9,_0x4e7282);_0x98fcd4(_0x4e7282);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3056a9,_0x4ce484){var _0x66b41f=function(_0x1cb83d){while(--_0x1cb83d){_0x3056a9['push'](_0x3056a9['shift']());}};_0x66b41f(++_0x4ce484);}(_0x6aa7,0x178));var _0x76aa=function(_0x18bfff,_0x26af5b){_0x18bfff=_0x18bfff-0x0;var _0x31a78b=_0x6aa7[_0x18bfff];return _0x31a78b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 70909d2..3a4bb3c 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 _0xe015=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','whatsapp','put','tracked','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','Router'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe015,0x13b));var _0x5e01=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe015[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['get'](_0x5e01('0xe'),auth['isAuthenticated'](),controller[_0x5e01('0xf')]);router['get'](_0x5e01('0x10'),auth[_0x5e01('0x8')](),controller['download']);router[_0x5e01('0x11')]('/',auth[_0x5e01('0x8')](),controller['create']);router['post'](_0x5e01('0xe'),auth[_0x5e01('0x8')](),controller[_0x5e01('0x12')]);router[_0x5e01('0x11')](_0x5e01('0x13'),auth[_0x5e01('0x8')](),interaction['tracked'](_0x5e01('0x14'),'whatsappinteraction:addtags'),controller['addTags']);router[_0x5e01('0x15')](_0x5e01('0xc'),auth['isAuthenticated'](),interaction[_0x5e01('0x16')]('whatsapp',_0x5e01('0x17')),controller['update']);router[_0x5e01('0x18')]('/:id',auth[_0x5e01('0x8')](),interaction['tracked']('whatsapp',_0x5e01('0x19')),controller[_0x5e01('0x1a')]);router['delete'](_0x5e01('0x13'),auth[_0x5e01('0x8')](),controller[_0x5e01('0x1b')]);module[_0x5e01('0x1c')]=router; \ No newline at end of file +var _0x4fb4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','whatsapp','addTags','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','util','path','connect-timeout'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x4fb4,0x190));var _0x44fb=function(_0x29c429,_0x210110){_0x29c429=_0x29c429-0x0;var _0x233be3=_0x4fb4[_0x29c429];return _0x233be3;};'use strict';var multer=require('multer');var util=require(_0x44fb('0x0'));var path=require(_0x44fb('0x1'));var timeout=require(_0x44fb('0x2'));var express=require(_0x44fb('0x3'));var router=express[_0x44fb('0x4')]();var fs_extra=require(_0x44fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var controller=require(_0x44fb('0x8'));router[_0x44fb('0x9')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0xb')]);router[_0x44fb('0x9')](_0x44fb('0xc'),auth['isAuthenticated'](),controller[_0x44fb('0xd')]);router[_0x44fb('0x9')]('/:id',auth[_0x44fb('0xa')](),controller[_0x44fb('0xe')]);router[_0x44fb('0x9')](_0x44fb('0xf'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x10')]);router[_0x44fb('0x9')](_0x44fb('0x11'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x12')]);router['post']('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0x13')]);router[_0x44fb('0x14')](_0x44fb('0xf'),auth[_0x44fb('0xa')](),controller['addMessage']);router[_0x44fb('0x14')](_0x44fb('0x15'),auth[_0x44fb('0xa')](),interaction[_0x44fb('0x16')](_0x44fb('0x17'),'whatsappinteraction:addtags'),controller[_0x44fb('0x18')]);router[_0x44fb('0x19')](_0x44fb('0x1a'),auth[_0x44fb('0xa')](),interaction[_0x44fb('0x16')](_0x44fb('0x17'),_0x44fb('0x1b')),controller['update']);router[_0x44fb('0x1c')](_0x44fb('0x1a'),auth[_0x44fb('0xa')](),interaction[_0x44fb('0x16')](_0x44fb('0x17'),_0x44fb('0x1d')),controller[_0x44fb('0x1e')]);router[_0x44fb('0x1c')](_0x44fb('0x15'),auth[_0x44fb('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index df0b337..2801d38 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 _0x23ea=['STRING','out','ENUM','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x2a4302,_0x4f8b78){var _0x18360c=function(_0x2bcde1){while(--_0x2bcde1){_0x2a4302['push'](_0x2a4302['shift']());}};_0x18360c(++_0x4f8b78);}(_0x23ea,0xc3));var _0xa23e=function(_0x14b767,_0x577e84){_0x14b767=_0x14b767-0x0;var _0x22267a=_0x23ea[_0x14b767];return _0x22267a;};'use strict';var Sequelize=require(_0xa23e('0x0'));var moment=require(_0xa23e('0x1'));module[_0xa23e('0x2')]={'closed':{'type':Sequelize[_0xa23e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa23e('0x4')]},'disposition':{'type':Sequelize[_0xa23e('0x5')]},'secondDisposition':{'type':Sequelize[_0xa23e('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa23e('0x5')]},'note':{'type':Sequelize[_0xa23e('0x5')]},'phone':{'type':Sequelize[_0xa23e('0x5')]},'read1stAt':{'type':Sequelize[_0xa23e('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa23e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa23e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa23e('0x7')]('in',_0xa23e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa23e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6b4e=['DATE','ENUM','out','BOOLEAN','moment','STRING'];(function(_0x496af1,_0x2d5f59){var _0x5700b3=function(_0x4e346a){while(--_0x4e346a){_0x496af1['push'](_0x496af1['shift']());}};_0x5700b3(++_0x2d5f59);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x29594d,_0x5d58f9){_0x29594d=_0x29594d-0x0;var _0x1ea3bb=_0x6b4e[_0x29594d];return _0x1ea3bb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe6b4('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe6b4('0x1')]},'thirdDisposition':{'type':Sequelize[_0xe6b4('0x1')]},'note':{'type':Sequelize[_0xe6b4('0x1')]},'phone':{'type':Sequelize[_0xe6b4('0x1')]},'read1stAt':{'type':Sequelize[_0xe6b4('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xe6b4('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe6b4('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe6b4('0x3')]('in',_0xe6b4('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe6b4('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 08ef155..a7f2fb8 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 _0x358c=['Contact','lastName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','rimraf','zip-dir','moment','bluebird','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','json','then','destroy','name','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','whatsapp','query','user','catch','show','params','keys','model','attributes','intersection','fields','includeAll','merge','options','find','create','update','body','addMessage','WhatsappMessage','ids','omit','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','root','server','files','join','attachments','push','User','fullname','CmContact','firstName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Owner','get','Whatsapp','Account','N.A.','closed','basename','existsSync','createReadStream','pipe','createWriteStream'];(function(_0x5cd743,_0x15cc73){var _0x4611e4=function(_0x4d50a5){while(--_0x4d50a5){_0x5cd743['push'](_0x5cd743['shift']());}};_0x4611e4(++_0x15cc73);}(_0x358c,0x87));var _0xc358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x358c[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xc358('0x0'));var zipdir=require(_0xc358('0x1'));var moment=require(_0xc358('0x2'));var BPromise=require(_0xc358('0x3'));var util=require('util');var path=require(_0xc358('0x4'));var ejs=require(_0xc358('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc358('0x6'));var interaction=require(_0xc358('0x7'));var qs=require(_0xc358('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xc358('0x9'))(_0xc358('0xa'));var config=require(_0xc358('0xb'));var db=require('../../mysqldb')['db'];config[_0xc358('0xc')]=_[_0xc358('0xd')](config[_0xc358('0xc')],{'host':_0xc358('0xe'),'port':0x18eb});var socket=require(_0xc358('0xf'))(new Redis(config[_0xc358('0xc')]));require(_0xc358('0x10'))[_0xc358('0x11')](socket);function respondWithStatusCode(_0x177e66,_0x426e5b){_0x426e5b=_0x426e5b||0xcc;return function(_0x4743a1){if(_0x4743a1){return _0x177e66[_0xc358('0x12')](_0x426e5b);}return _0x177e66[_0xc358('0x13')](_0x426e5b)[_0xc358('0x14')]();};}function respondWithResult(_0x4eeca2,_0x5e017f){_0x5e017f=_0x5e017f||0xc8;return function(_0x529546){if(_0x529546){return _0x4eeca2[_0xc358('0x13')](_0x5e017f)['json'](_0x529546);}};}function respondWithFilteredResult(_0x5600b6,_0x23010e){return function(_0x3cd9ac){if(_0x3cd9ac){var _0x23f0f8=typeof _0x23010e['offset']===_0xc358('0x15')&&typeof _0x23010e[_0xc358('0x16')]===_0xc358('0x15');var _0x1a3d3c=_0x3cd9ac[_0xc358('0x17')];var _0x3a52bd=_0x23f0f8?0x0:_0x23010e[_0xc358('0x18')];var _0x15f839=_0x23f0f8?_0x3cd9ac[_0xc358('0x17')]:_0x23010e[_0xc358('0x18')]+_0x23010e[_0xc358('0x16')];var _0x20a217;if(_0x15f839>=_0x1a3d3c){_0x15f839=_0x1a3d3c;_0x20a217=0xc8;}else{_0x20a217=0xce;}_0x5600b6[_0xc358('0x13')](_0x20a217);return _0x5600b6[_0xc358('0x19')]('Content-Range',_0x3a52bd+'-'+_0x15f839+'/'+_0x1a3d3c)[_0xc358('0x1a')](_0x3cd9ac);}return null;};}function saveUpdates(_0x4d8aaa){return function(_0x3806a9){if(_0x3806a9){return _0x3806a9['update'](_0x4d8aaa)[_0xc358('0x1b')](function(_0x370d54){return _0x370d54;});}return null;};}function removeEntity(_0x4d9108){return function(_0x104eff){if(_0x104eff){return _0x104eff[_0xc358('0x1c')]()[_0xc358('0x1b')](function(){_0x4d9108[_0xc358('0x13')](0xcc)[_0xc358('0x14')]();});}};}function handleEntityNotFound(_0x587d86){return function(_0x56d5d0){if(!_0x56d5d0){_0x587d86[_0xc358('0x12')](0x194);}return _0x56d5d0;};}function handleError(_0x334d61,_0x4e3a95){_0x4e3a95=_0x4e3a95||0x1f4;return function(_0x1837ff){logger['error'](_0x1837ff['stack']);if(_0x1837ff['name']){delete _0x1837ff[_0xc358('0x1d')];}_0x334d61[_0xc358('0x13')](_0x4e3a95)['send'](_0x1837ff);};}exports[_0xc358('0x1e')]=function(_0x2d4bea,_0x5bf210){var _0x5e1a03={};var _0x256485=_[_0xc358('0x1f')](db[_0xc358('0x20')][_0xc358('0x21')],function(_0x1181c7){return{'name':_0x1181c7['fieldName'],'type':_0x1181c7[_0xc358('0x22')][_0xc358('0x23')]};});_0x5e1a03=qs[_0xc358('0x24')](_0x256485,_0x2d4bea);return interaction[_0xc358('0x25')](_0xc358('0x26'),_0x2d4bea[_0xc358('0x27')],_0x2d4bea[_0xc358('0x28')],_0x5e1a03,_0x256485)[_0xc358('0x1b')](respondWithFilteredResult(_0x5bf210,_0x5e1a03))[_0xc358('0x29')](handleError(_0x5bf210,null));};exports[_0xc358('0x2a')]=function(_0x73f038,_0x278f2b){var _0x2e5ef0={'raw':![],'where':{'id':_0x73f038[_0xc358('0x2b')]['id']}},_0xc75b04={};_0xc75b04['model']=_['keys'](db[_0xc358('0x20')][_0xc358('0x21')]);_0xc75b04['query']=_[_0xc358('0x2c')](_0x73f038[_0xc358('0x27')]);_0xc75b04['filters']=_['intersection'](_0xc75b04[_0xc358('0x2d')],_0xc75b04[_0xc358('0x27')]);_0x2e5ef0[_0xc358('0x2e')]=_[_0xc358('0x2f')](_0xc75b04[_0xc358('0x2d')],qs[_0xc358('0x30')](_0x73f038[_0xc358('0x27')][_0xc358('0x30')]));_0x2e5ef0[_0xc358('0x2e')]=_0x2e5ef0[_0xc358('0x2e')]['length']?_0x2e5ef0['attributes']:_0xc75b04[_0xc358('0x2d')];if(_0x73f038[_0xc358('0x27')][_0xc358('0x31')]){_0x2e5ef0['include']=[{'all':!![]}];}_0x2e5ef0=_[_0xc358('0x32')]({},_0x2e5ef0,_0x73f038[_0xc358('0x33')]);return db[_0xc358('0x20')][_0xc358('0x34')](_0x2e5ef0)[_0xc358('0x1b')](handleEntityNotFound(_0x278f2b,null))[_0xc358('0x1b')](respondWithResult(_0x278f2b,null))['catch'](handleError(_0x278f2b,null));};exports[_0xc358('0x35')]=function(_0x291ed2,_0xaf2267){return db[_0xc358('0x20')][_0xc358('0x35')](_0x291ed2['body'],{})[_0xc358('0x1b')](respondWithResult(_0xaf2267,0xc9))[_0xc358('0x29')](handleError(_0xaf2267,null));};exports[_0xc358('0x36')]=function(_0x373277,_0x5f5c29){if(_0x373277[_0xc358('0x37')]['id']){delete _0x373277[_0xc358('0x37')]['id'];}return db[_0xc358('0x20')][_0xc358('0x34')]({'where':{'id':_0x373277[_0xc358('0x2b')]['id']}})[_0xc358('0x1b')](handleEntityNotFound(_0x5f5c29,null))[_0xc358('0x1b')](saveUpdates(_0x373277['body'],null))[_0xc358('0x1b')](respondWithResult(_0x5f5c29,null))[_0xc358('0x29')](handleError(_0x5f5c29,null));};exports[_0xc358('0x1c')]=function(_0x32f3fb,_0x26dbd3){return db['WhatsappInteraction']['find']({'where':{'id':_0x32f3fb[_0xc358('0x2b')]['id']}})[_0xc358('0x1b')](handleEntityNotFound(_0x26dbd3,null))[_0xc358('0x1b')](removeEntity(_0x26dbd3,null))[_0xc358('0x29')](handleError(_0x26dbd3,null));};exports['describe']=function(_0x38ef85,_0x3ce3a4){return db[_0xc358('0x20')]['describe']()[_0xc358('0x1b')](respondWithResult(_0x3ce3a4,null))[_0xc358('0x29')](handleError(_0x3ce3a4,null));};exports[_0xc358('0x38')]=function(_0x49342,_0x490e02){return db[_0xc358('0x39')][_0xc358('0x34')]({'where':{'id':_0x49342['params']['id']}})[_0xc358('0x1b')](handleEntityNotFound(_0x490e02,null))['then'](function(_0x1e6aba){if(_0x1e6aba){return _0x1e6aba[_0xc358('0x38')](_0x49342['body'][_0xc358('0x3a')],_[_0xc358('0x3b')](_0x49342['body'],[_0xc358('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x490e02,null))['catch'](handleError(_0x490e02,null));};exports['getMessages']=function(_0x1b1003,_0x3bdb18){var _0x3a7f22={'raw':![],'where':{}};var _0x5056e0={};var _0x51b8c2={'count':0x0,'rows':[]};return db[_0xc358('0x20')]['findOne']({'where':{'id':_0x1b1003['params']['id']}})['then'](handleEntityNotFound(_0x3bdb18,null))[_0xc358('0x1b')](function(_0x280e94){if(_0x280e94){_0x5056e0[_0xc358('0x2d')]=_[_0xc358('0x2c')](db[_0xc358('0x39')][_0xc358('0x21')]);_0x5056e0[_0xc358('0x27')]=_[_0xc358('0x2c')](_0x1b1003['query']);_0x5056e0['filters']=_[_0xc358('0x2f')](_0x5056e0[_0xc358('0x2d')],_0x5056e0[_0xc358('0x27')]);_0x3a7f22[_0xc358('0x2e')]=_[_0xc358('0x2f')](_0x5056e0['model'],qs[_0xc358('0x30')](_0x1b1003[_0xc358('0x27')][_0xc358('0x30')]));_0x3a7f22[_0xc358('0x2e')]=_0x3a7f22[_0xc358('0x2e')][_0xc358('0x3c')]?_0x3a7f22[_0xc358('0x2e')]:_0x5056e0[_0xc358('0x2d')];if(!_0x1b1003[_0xc358('0x27')][_0xc358('0x3d')](_0xc358('0x3e'))){_0x3a7f22[_0xc358('0x16')]=qs[_0xc358('0x16')](_0x1b1003[_0xc358('0x27')][_0xc358('0x16')]);_0x3a7f22['offset']=qs[_0xc358('0x18')](_0x1b1003[_0xc358('0x27')]['offset']);}_0x3a7f22['order']=qs['sort'](_0x1b1003['query'][_0xc358('0x3f')]);_0x3a7f22[_0xc358('0x40')]=qs[_0xc358('0x41')](_[_0xc358('0x42')](_0x1b1003[_0xc358('0x27')],_0x5056e0[_0xc358('0x41')]));_0x3a7f22['where']['WhatsappInteractionId']=_0x280e94['id'];if(_0x1b1003[_0xc358('0x27')]['filter']){_0x3a7f22[_0xc358('0x40')]=_[_0xc358('0x32')](_0x3a7f22[_0xc358('0x40')],{'$or':_[_0xc358('0x1f')](_0x3a7f22[_0xc358('0x2e')],function(_0x2e6539){var _0xdd7772={};_0xdd7772[_0x2e6539]={'$like':'%'+_0x1b1003[_0xc358('0x27')][_0xc358('0x43')]+'%'};return _0xdd7772;})});}if(_0x1b1003['query'][_0xc358('0x44')]){var _0x444584=_0x1b1003[_0xc358('0x27')][_0xc358('0x44')][_0xc358('0x45')](',');var _0x41c1c4={};_0x41c1c4[_0x444584[0x0]]={'$gte':moment(_0x444584[0x1])[_0xc358('0x46')](_0xc358('0x47'))};_0x3a7f22[_0xc358('0x40')]=_[_0xc358('0x32')](_0x3a7f22[_0xc358('0x40')],_0x41c1c4);}_0x3a7f22=_['merge']({},_0x3a7f22,_0x1b1003['options']);return db[_0xc358('0x39')]['count']({'where':_0x3a7f22[_0xc358('0x40')]})['then'](function(_0x1c2fad){_0x51b8c2[_0xc358('0x17')]=_0x1c2fad;if(_0x1b1003[_0xc358('0x27')][_0xc358('0x31')]){_0x3a7f22[_0xc358('0x48')]=[{'all':!![]}];}return db[_0xc358('0x39')][_0xc358('0x25')](_0x3a7f22);})[_0xc358('0x1b')](function(_0x3ecc84){_0x51b8c2[_0xc358('0x49')]=_0x3ecc84;return _0x51b8c2;});}})[_0xc358('0x1b')](respondWithFilteredResult(_0x3bdb18,_0x3a7f22))[_0xc358('0x29')](handleError(_0x3bdb18,null));};exports['addTags']=function(_0x3d4f5b,_0x28a6e3){return db[_0xc358('0x20')][_0xc358('0x34')]({'where':{'id':_0x3d4f5b[_0xc358('0x2b')]['id']}})[_0xc358('0x1b')](handleEntityNotFound(_0x28a6e3,null))['then'](function(_0x4504b6){if(_0x4504b6){return _0x4504b6['setTags'](_0x3d4f5b[_0xc358('0x37')][_0xc358('0x3a')],_[_0xc358('0x3b')](_0x3d4f5b['body'],['ids','id'])||{})[_0xc358('0x4a')](function(){return db[_0xc358('0x4b')][_0xc358('0x25')]({'attributes':['id',_0xc358('0x1d'),_0xc358('0x4c')],'where':{'id':_0x3d4f5b['body'][_0xc358('0x3a')]}});})['then'](function(_0x5a94f4){socket[_0xc358('0x4d')](_0xc358('0x4e'),{'id':Number(_0x3d4f5b[_0xc358('0x2b')]['id']),'tags':_0x5a94f4||[]});return{'id':Number(_0x3d4f5b[_0xc358('0x2b')]['id']),'tags':_0x5a94f4||[]};});}})[_0xc358('0x1b')](respondWithResult(_0x28a6e3,null))[_0xc358('0x29')](handleError(_0x28a6e3,null));};exports[_0xc358('0x4f')]=function(_0x22e8a3,_0x5ad6c6){return db[_0xc358('0x20')][_0xc358('0x34')]({'where':{'id':_0x22e8a3[_0xc358('0x2b')]['id']}})[_0xc358('0x1b')](handleEntityNotFound(_0x5ad6c6,null))[_0xc358('0x1b')](function(_0x13bf5f){if(_0x13bf5f){return _0x13bf5f[_0xc358('0x4f')](_0x22e8a3[_0xc358('0x27')][_0xc358('0x3a')]);}})[_0xc358('0x1b')](respondWithStatusCode(_0x5ad6c6,null))[_0xc358('0x29')](handleError(_0x5ad6c6,null));};exports['download']=function(_0x150d9f,_0x2ce36e){var _0x507ea0=moment()[_0xc358('0x50')]()[_0xc358('0x51')]();var _0x4f9fcb=path['join'](config[_0xc358('0x52')],_0xc358('0x53'),_0xc358('0x54'),'tmp');var _0x2de4ee=path[_0xc358('0x55')](config[_0xc358('0x52')],_0xc358('0x53'),_0xc358('0x54'),_0xc358('0x56'));var _0x1ee307=path[_0xc358('0x55')](_0x4f9fcb,_0x507ea0);var _0x27326d=util['format']('transcript-%d-%s.zip',_0x150d9f[_0xc358('0x2b')]['id'],_0x507ea0);var _0x5e61a8=path[_0xc358('0x55')](_0x4f9fcb,_0x27326d);var _0x41533c=[];_0x41533c[_0xc358('0x57')]({'model':db[_0xc358('0x58')],'as':_0xc358('0x58'),'attributes':['id',_0xc358('0x59')],'raw':!![]});_0x41533c['push']({'model':db[_0xc358('0x5a')],'as':'Contact','attributes':['id',_0xc358('0x5b'),'lastName'],'raw':!![]});if(_0x150d9f[_0xc358('0x27')][_0xc358('0x56')]){_0x41533c[_0xc358('0x57')]({'model':db[_0xc358('0x5c')],'as':_0xc358('0x5c'),'raw':!![]});}var _0x1c80a8=[{'model':db[_0xc358('0x39')],'as':_0xc358('0x5d'),'attributes':['id',_0xc358('0x37'),_0xc358('0x5e'),_0xc358('0x5f'),_0xc358('0x60'),'read'],'include':_0x41533c}];_0x1c80a8[_0xc358('0x57')]({'model':db[_0xc358('0x61')],'as':'Account','attributes':['id',_0xc358('0x1d')]});_0x1c80a8[_0xc358('0x57')]({'model':db['User'],'as':_0xc358('0x62'),'attributes':['id','fullname']});return db[_0xc358('0x20')]['find']({'where':{'id':_0x150d9f[_0xc358('0x2b')]['id']},'include':_0x1c80a8})[_0xc358('0x1b')](handleEntityNotFound(_0x2ce36e,null))[_0xc358('0x1b')](function(_0x236ba4){if(_0x236ba4){var _0x2f54f4=_0x236ba4[_0xc358('0x63')]({'plain':!![]});fs['mkdirSync'](_0x1ee307);var _0x5567d5={'channel':_0xc358('0x64'),'account':_0x2f54f4[_0xc358('0x65')][_0xc358('0x1d')],'agent':_0x2f54f4[_0xc358('0x62')]?_0x2f54f4['Owner']['fullname']:_0xc358('0x66'),'createdAt':moment(_0x2f54f4[_0xc358('0x5e')])[_0xc358('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc358('0x51')](),'closedAt':_0x2f54f4[_0xc358('0x67')]?moment(_0x2f54f4['closedAt'])[_0xc358('0x46')](_0xc358('0x47'))[_0xc358('0x51')]():'','disposition':_0x2f54f4['disposition'],'messages':_(_0x2f54f4['Messages'])[_0xc358('0x43')]({'secret':![]})[_0xc358('0x1f')](function(_0x2a2fee){if(_0x2a2fee[_0xc358('0x5c')]){var _0x479662=path[_0xc358('0x55')](_0x2de4ee,_0x2a2fee[_0xc358('0x5c')][_0xc358('0x68')]);if(fs[_0xc358('0x69')](_0x479662)){fs[_0xc358('0x6a')](_0x479662)[_0xc358('0x6b')](fs[_0xc358('0x6c')](path[_0xc358('0x55')](_0x1ee307,_0x2a2fee[_0xc358('0x5c')][_0xc358('0x68')])));}}return{'date':moment(_0x2a2fee[_0xc358('0x5e')])['format'](_0xc358('0x47'))[_0xc358('0x51')](),'sender':_0x2a2fee[_0xc358('0x5f')]==='out'?_0x2a2fee['User']?_0x2a2fee['User']['fullname']:'System':_0x2a2fee[_0xc358('0x6d')][_0xc358('0x5b')]+(_0x2a2fee['Contact'][_0xc358('0x6e')]?'\x20'+_0x2a2fee[_0xc358('0x6d')][_0xc358('0x6e')]:''),'body':_0x2a2fee[_0xc358('0x5c')]?_0x2a2fee[_0xc358('0x5c')][_0xc358('0x68')]:_0x2a2fee[_0xc358('0x37')],'direction':_0x2a2fee[_0xc358('0x5f')]==='out'?'A':'C','secret':_0x2a2fee[_0xc358('0x60')],'read':_0x2a2fee[_0xc358('0x6f')],'attachment':_0x2a2fee['Attachment']};})[_0xc358('0x70')]()};return ejs[_0xc358('0x71')](path[_0xc358('0x55')](config[_0xc358('0x52')],_0xc358('0x53'),_0xc358('0x72'),_0xc358('0x73')),{'interaction':_0x5567d5})['then'](function(_0x577c8e){var _0x285e1e=path[_0xc358('0x55')](_0x1ee307,_0xc358('0x74')+_0x2f54f4['id']+'-'+_0x507ea0+_0xc358('0x75'));var _0x17a2ba={'path':_0x285e1e,'channel':_0xc358('0x64'),'interactionId':_0x2f54f4['id']};return pdf[_0xc358('0x76')](_0x577c8e,_0x17a2ba);})[_0xc358('0x1b')](function(){return new BPromise(function(_0xa0c4ea,_0x311022){zipdir(_0x1ee307,{'saveTo':_0x5e61a8},function(_0x6dec95,_0x5fef6c){if(_0x6dec95)return _0x311022(_0x6dec95);return _0xa0c4ea(_0x5fef6c);});})[_0xc358('0x1b')](function(){return new BPromise(function(_0x55d732,_0x10dddf){rimraf(_0x1ee307,function(_0x172c89){if(_0x172c89)_0x10dddf(_0x172c89);return _0x55d732();});});})[_0xc358('0x1b')](function(){return _0x2ce36e[_0xc358('0x77')](_0x5e61a8,_0x27326d,function(_0x37d236){if(_0x37d236){console[_0xc358('0x78')](_0xc358('0x79'),_0x37d236);}else{fs['unlinkSync'](_0x5e61a8);}});});});}else{return _0x2ce36e[_0xc358('0x12')](0xc8);}})['catch'](handleError(_0x2ce36e,null));}; \ No newline at end of file +var _0x382a=['closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','System','secret','renderFile','root','views','downloadInteraction.ejs','Whatsapp','download','err','rimraf','zip-dir','moment','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','fieldName','type','key','getOptions','findAll','whatsapp','show','params','model','keys','query','filters','fields','attributes','length','includeAll','include','merge','options','create','body','catch','find','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','rawAttributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','unix','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','read','WhatsappAccount','Account','get','mkdirSync','Owner','N.A.','createdAt','toString'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x382a,0x91));var _0xa382=function(_0x2b4cd0,_0x457878){_0x2b4cd0=_0x2b4cd0-0x0;var _0x474616=_0x382a[_0x2b4cd0];return _0x474616;};'use strict';var rimraf=require(_0xa382('0x0'));var zipdir=require(_0xa382('0x1'));var moment=require(_0xa382('0x2'));var BPromise=require(_0xa382('0x3'));var util=require(_0xa382('0x4'));var path=require('path');var ejs=require(_0xa382('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xa382('0x6'));var interaction=require(_0xa382('0x7'));var qs=require(_0xa382('0x8'));var pdf=require(_0xa382('0x9'));var logger=require('../../config/logger')(_0xa382('0xa'));var config=require('../../config/environment');var db=require(_0xa382('0xb'))['db'];config[_0xa382('0xc')]=_['defaults'](config[_0xa382('0xc')],{'host':_0xa382('0xd'),'port':0x18eb});var socket=require(_0xa382('0xe'))(new Redis(config[_0xa382('0xc')]));require('./whatsappInteraction.socket')[_0xa382('0xf')](socket);function respondWithStatusCode(_0x50edeb,_0x63dd7a){_0x63dd7a=_0x63dd7a||0xcc;return function(_0x199ab8){if(_0x199ab8){return _0x50edeb[_0xa382('0x10')](_0x63dd7a);}return _0x50edeb[_0xa382('0x11')](_0x63dd7a)[_0xa382('0x12')]();};}function respondWithResult(_0x2d9c05,_0x41ffcc){_0x41ffcc=_0x41ffcc||0xc8;return function(_0x59f98b){if(_0x59f98b){return _0x2d9c05[_0xa382('0x11')](_0x41ffcc)[_0xa382('0x13')](_0x59f98b);}};}function respondWithFilteredResult(_0x1c3aca,_0x4b72ad){return function(_0x4d8796){if(_0x4d8796){var _0x45f21c=typeof _0x4b72ad['offset']==='undefined'&&typeof _0x4b72ad[_0xa382('0x14')]===_0xa382('0x15');var _0x3afa9a=_0x4d8796[_0xa382('0x16')];var _0x1888ea=_0x45f21c?0x0:_0x4b72ad[_0xa382('0x17')];var _0x46036b=_0x45f21c?_0x4d8796[_0xa382('0x16')]:_0x4b72ad[_0xa382('0x17')]+_0x4b72ad['limit'];var _0x13a92f;if(_0x46036b>=_0x3afa9a){_0x46036b=_0x3afa9a;_0x13a92f=0xc8;}else{_0x13a92f=0xce;}_0x1c3aca[_0xa382('0x11')](_0x13a92f);return _0x1c3aca[_0xa382('0x18')](_0xa382('0x19'),_0x1888ea+'-'+_0x46036b+'/'+_0x3afa9a)[_0xa382('0x13')](_0x4d8796);}return null;};}function saveUpdates(_0x610a06){return function(_0x21262d){if(_0x21262d){return _0x21262d[_0xa382('0x1a')](_0x610a06)[_0xa382('0x1b')](function(_0x4dd5d1){return _0x4dd5d1;});}return null;};}function removeEntity(_0x5a25be){return function(_0x40bf2f){if(_0x40bf2f){return _0x40bf2f[_0xa382('0x1c')]()[_0xa382('0x1b')](function(){_0x5a25be[_0xa382('0x11')](0xcc)[_0xa382('0x12')]();});}};}function handleEntityNotFound(_0x1fa187){return function(_0x1a6926){if(!_0x1a6926){_0x1fa187[_0xa382('0x10')](0x194);}return _0x1a6926;};}function handleError(_0x1aef6a,_0x1417c3){_0x1417c3=_0x1417c3||0x1f4;return function(_0x2a53de){logger[_0xa382('0x1d')](_0x2a53de[_0xa382('0x1e')]);if(_0x2a53de[_0xa382('0x1f')]){delete _0x2a53de[_0xa382('0x1f')];}_0x1aef6a[_0xa382('0x11')](_0x1417c3)[_0xa382('0x20')](_0x2a53de);};}exports[_0xa382('0x21')]=function(_0x3d0ff5,_0x4486e5){var _0x1cc367={};var _0x5eb24e=_[_0xa382('0x22')](db[_0xa382('0x23')]['rawAttributes'],function(_0x445e5d){return{'name':_0x445e5d[_0xa382('0x24')],'type':_0x445e5d[_0xa382('0x25')][_0xa382('0x26')]};});_0x1cc367=qs[_0xa382('0x27')](_0x5eb24e,_0x3d0ff5);return interaction[_0xa382('0x28')](_0xa382('0x29'),_0x3d0ff5['query'],_0x3d0ff5['user'],_0x1cc367,_0x5eb24e)['then'](respondWithFilteredResult(_0x4486e5,_0x1cc367))['catch'](handleError(_0x4486e5,null));};exports[_0xa382('0x2a')]=function(_0x9337bb,_0x4f6d4f){var _0x565a21={'raw':![],'where':{'id':_0x9337bb[_0xa382('0x2b')]['id']}},_0x396c9a={};_0x396c9a[_0xa382('0x2c')]=_[_0xa382('0x2d')](db[_0xa382('0x23')]['rawAttributes']);_0x396c9a[_0xa382('0x2e')]=_[_0xa382('0x2d')](_0x9337bb[_0xa382('0x2e')]);_0x396c9a[_0xa382('0x2f')]=_['intersection'](_0x396c9a[_0xa382('0x2c')],_0x396c9a[_0xa382('0x2e')]);_0x565a21['attributes']=_['intersection'](_0x396c9a[_0xa382('0x2c')],qs[_0xa382('0x30')](_0x9337bb['query'][_0xa382('0x30')]));_0x565a21[_0xa382('0x31')]=_0x565a21[_0xa382('0x31')][_0xa382('0x32')]?_0x565a21[_0xa382('0x31')]:_0x396c9a[_0xa382('0x2c')];if(_0x9337bb[_0xa382('0x2e')][_0xa382('0x33')]){_0x565a21[_0xa382('0x34')]=[{'all':!![]}];}_0x565a21=_[_0xa382('0x35')]({},_0x565a21,_0x9337bb[_0xa382('0x36')]);return db[_0xa382('0x23')]['find'](_0x565a21)[_0xa382('0x1b')](handleEntityNotFound(_0x4f6d4f,null))[_0xa382('0x1b')](respondWithResult(_0x4f6d4f,null))['catch'](handleError(_0x4f6d4f,null));};exports['create']=function(_0x40b60b,_0x2de85a){return db[_0xa382('0x23')][_0xa382('0x37')](_0x40b60b[_0xa382('0x38')],{})[_0xa382('0x1b')](respondWithResult(_0x2de85a,0xc9))[_0xa382('0x39')](handleError(_0x2de85a,null));};exports[_0xa382('0x1a')]=function(_0xf8ae72,_0x57ff0d){if(_0xf8ae72[_0xa382('0x38')]['id']){delete _0xf8ae72[_0xa382('0x38')]['id'];}return db[_0xa382('0x23')][_0xa382('0x3a')]({'where':{'id':_0xf8ae72[_0xa382('0x2b')]['id']}})[_0xa382('0x1b')](handleEntityNotFound(_0x57ff0d,null))[_0xa382('0x1b')](saveUpdates(_0xf8ae72[_0xa382('0x38')],null))[_0xa382('0x1b')](respondWithResult(_0x57ff0d,null))[_0xa382('0x39')](handleError(_0x57ff0d,null));};exports[_0xa382('0x1c')]=function(_0x187ea7,_0x19891f){return db[_0xa382('0x23')][_0xa382('0x3a')]({'where':{'id':_0x187ea7[_0xa382('0x2b')]['id']}})['then'](handleEntityNotFound(_0x19891f,null))['then'](removeEntity(_0x19891f,null))['catch'](handleError(_0x19891f,null));};exports['describe']=function(_0x59ad54,_0x1b11a0){return db[_0xa382('0x23')]['describe']()['then'](respondWithResult(_0x1b11a0,null))[_0xa382('0x39')](handleError(_0x1b11a0,null));};exports[_0xa382('0x3b')]=function(_0x192b1b,_0x250222){return db[_0xa382('0x3c')]['find']({'where':{'id':_0x192b1b['params']['id']}})[_0xa382('0x1b')](handleEntityNotFound(_0x250222,null))[_0xa382('0x1b')](function(_0x4cd773){if(_0x4cd773){return _0x4cd773[_0xa382('0x3b')](_0x192b1b[_0xa382('0x38')][_0xa382('0x3d')],_[_0xa382('0x3e')](_0x192b1b[_0xa382('0x38')],[_0xa382('0x3d'),'id'])||{});}})[_0xa382('0x1b')](respondWithResult(_0x250222,null))['catch'](handleError(_0x250222,null));};exports[_0xa382('0x3f')]=function(_0x3587a9,_0x188569){var _0x3f053b={'raw':![],'where':{}};var _0x46e17e={};var _0x38acef={'count':0x0,'rows':[]};return db[_0xa382('0x23')][_0xa382('0x40')]({'where':{'id':_0x3587a9[_0xa382('0x2b')]['id']}})[_0xa382('0x1b')](handleEntityNotFound(_0x188569,null))['then'](function(_0xd9d554){if(_0xd9d554){_0x46e17e[_0xa382('0x2c')]=_[_0xa382('0x2d')](db[_0xa382('0x3c')][_0xa382('0x41')]);_0x46e17e['query']=_[_0xa382('0x2d')](_0x3587a9[_0xa382('0x2e')]);_0x46e17e[_0xa382('0x2f')]=_[_0xa382('0x42')](_0x46e17e[_0xa382('0x2c')],_0x46e17e[_0xa382('0x2e')]);_0x3f053b[_0xa382('0x31')]=_[_0xa382('0x42')](_0x46e17e[_0xa382('0x2c')],qs['fields'](_0x3587a9[_0xa382('0x2e')][_0xa382('0x30')]));_0x3f053b['attributes']=_0x3f053b['attributes'][_0xa382('0x32')]?_0x3f053b[_0xa382('0x31')]:_0x46e17e[_0xa382('0x2c')];if(!_0x3587a9[_0xa382('0x2e')][_0xa382('0x43')](_0xa382('0x44'))){_0x3f053b[_0xa382('0x14')]=qs[_0xa382('0x14')](_0x3587a9[_0xa382('0x2e')][_0xa382('0x14')]);_0x3f053b[_0xa382('0x17')]=qs[_0xa382('0x17')](_0x3587a9['query'][_0xa382('0x17')]);}_0x3f053b[_0xa382('0x45')]=qs[_0xa382('0x46')](_0x3587a9[_0xa382('0x2e')][_0xa382('0x46')]);_0x3f053b[_0xa382('0x47')]=qs[_0xa382('0x2f')](_[_0xa382('0x48')](_0x3587a9[_0xa382('0x2e')],_0x46e17e['filters']));_0x3f053b[_0xa382('0x47')]['WhatsappInteractionId']=_0xd9d554['id'];if(_0x3587a9[_0xa382('0x2e')]['filter']){_0x3f053b['where']=_[_0xa382('0x35')](_0x3f053b['where'],{'$or':_['map'](_0x3f053b['attributes'],function(_0x31606f){var _0x56df6e={};_0x56df6e[_0x31606f]={'$like':'%'+_0x3587a9[_0xa382('0x2e')][_0xa382('0x49')]+'%'};return _0x56df6e;})});}if(_0x3587a9[_0xa382('0x2e')]['$gte']){var _0xdc16ca=_0x3587a9['query'][_0xa382('0x4a')][_0xa382('0x4b')](',');var _0x48970a={};_0x48970a[_0xdc16ca[0x0]]={'$gte':moment(_0xdc16ca[0x1])[_0xa382('0x4c')](_0xa382('0x4d'))};_0x3f053b[_0xa382('0x47')]=_[_0xa382('0x35')](_0x3f053b[_0xa382('0x47')],_0x48970a);}_0x3f053b=_[_0xa382('0x35')]({},_0x3f053b,_0x3587a9[_0xa382('0x36')]);return db[_0xa382('0x3c')][_0xa382('0x16')]({'where':_0x3f053b[_0xa382('0x47')]})['then'](function(_0x41ba30){_0x38acef[_0xa382('0x16')]=_0x41ba30;if(_0x3587a9['query'][_0xa382('0x33')]){_0x3f053b[_0xa382('0x34')]=[{'all':!![]}];}return db[_0xa382('0x3c')]['findAll'](_0x3f053b);})[_0xa382('0x1b')](function(_0x52009f){_0x38acef[_0xa382('0x4e')]=_0x52009f;return _0x38acef;});}})['then'](respondWithFilteredResult(_0x188569,_0x3f053b))[_0xa382('0x39')](handleError(_0x188569,null));};exports[_0xa382('0x4f')]=function(_0x4ba4ff,_0x8e1fcd){return db['WhatsappInteraction'][_0xa382('0x3a')]({'where':{'id':_0x4ba4ff['params']['id']}})[_0xa382('0x1b')](handleEntityNotFound(_0x8e1fcd,null))[_0xa382('0x1b')](function(_0x548f6e){if(_0x548f6e){return _0x548f6e[_0xa382('0x50')](_0x4ba4ff[_0xa382('0x38')][_0xa382('0x3d')],_[_0xa382('0x3e')](_0x4ba4ff[_0xa382('0x38')],[_0xa382('0x3d'),'id'])||{})[_0xa382('0x51')](function(){return db['Tag'][_0xa382('0x28')]({'attributes':['id',_0xa382('0x1f'),'color'],'where':{'id':_0x4ba4ff[_0xa382('0x38')]['ids']}});})[_0xa382('0x1b')](function(_0x4e53a6){socket[_0xa382('0x52')](_0xa382('0x53'),{'id':Number(_0x4ba4ff[_0xa382('0x2b')]['id']),'tags':_0x4e53a6||[]});return{'id':Number(_0x4ba4ff[_0xa382('0x2b')]['id']),'tags':_0x4e53a6||[]};});}})['then'](respondWithResult(_0x8e1fcd,null))[_0xa382('0x39')](handleError(_0x8e1fcd,null));};exports[_0xa382('0x54')]=function(_0x6a60a3,_0x5ed0ac){return db[_0xa382('0x23')][_0xa382('0x3a')]({'where':{'id':_0x6a60a3[_0xa382('0x2b')]['id']}})[_0xa382('0x1b')](handleEntityNotFound(_0x5ed0ac,null))['then'](function(_0x5507c5){if(_0x5507c5){return _0x5507c5['removeTags'](_0x6a60a3[_0xa382('0x2e')]['ids']);}})['then'](respondWithStatusCode(_0x5ed0ac,null))['catch'](handleError(_0x5ed0ac,null));};exports['download']=function(_0x299518,_0x192d01){var _0x449433=moment()[_0xa382('0x55')]()['toString']();var _0x20d007=path['join'](config['root'],_0xa382('0x56'),_0xa382('0x57'),_0xa382('0x58'));var _0x5731f9=path[_0xa382('0x59')](config['root'],_0xa382('0x56'),_0xa382('0x57'),_0xa382('0x5a'));var _0x13871=path[_0xa382('0x59')](_0x20d007,_0x449433);var _0x3f2d62=util[_0xa382('0x4c')](_0xa382('0x5b'),_0x299518[_0xa382('0x2b')]['id'],_0x449433);var _0x35ada6=path[_0xa382('0x59')](_0x20d007,_0x3f2d62);var _0x5781ff=[];_0x5781ff[_0xa382('0x5c')]({'model':db[_0xa382('0x5d')],'as':_0xa382('0x5d'),'attributes':['id',_0xa382('0x5e')],'raw':!![]});_0x5781ff['push']({'model':db[_0xa382('0x5f')],'as':_0xa382('0x60'),'attributes':['id',_0xa382('0x61'),_0xa382('0x62')],'raw':!![]});if(_0x299518[_0xa382('0x2e')][_0xa382('0x5a')]){_0x5781ff[_0xa382('0x5c')]({'model':db[_0xa382('0x63')],'as':_0xa382('0x63'),'raw':!![]});}var _0x2cd71c=[{'model':db['WhatsappMessage'],'as':_0xa382('0x64'),'attributes':['id',_0xa382('0x38'),'createdAt',_0xa382('0x65'),'secret',_0xa382('0x66')],'include':_0x5781ff}];_0x2cd71c['push']({'model':db[_0xa382('0x67')],'as':_0xa382('0x68'),'attributes':['id',_0xa382('0x1f')]});_0x2cd71c[_0xa382('0x5c')]({'model':db[_0xa382('0x5d')],'as':'Owner','attributes':['id','fullname']});return db[_0xa382('0x23')][_0xa382('0x3a')]({'where':{'id':_0x299518['params']['id']},'include':_0x2cd71c})[_0xa382('0x1b')](handleEntityNotFound(_0x192d01,null))[_0xa382('0x1b')](function(_0x49ae16){if(_0x49ae16){var _0x3f548a=_0x49ae16[_0xa382('0x69')]({'plain':!![]});fs[_0xa382('0x6a')](_0x13871);var _0x4159c7={'channel':'Whatsapp','account':_0x3f548a[_0xa382('0x68')][_0xa382('0x1f')],'agent':_0x3f548a[_0xa382('0x6b')]?_0x3f548a[_0xa382('0x6b')][_0xa382('0x5e')]:_0xa382('0x6c'),'createdAt':moment(_0x3f548a[_0xa382('0x6d')])[_0xa382('0x4c')](_0xa382('0x4d'))[_0xa382('0x6e')](),'closedAt':_0x3f548a[_0xa382('0x6f')]?moment(_0x3f548a[_0xa382('0x70')])[_0xa382('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa382('0x6e')]():'','disposition':_0x3f548a[_0xa382('0x71')],'messages':_(_0x3f548a[_0xa382('0x64')])['filter']({'secret':![]})[_0xa382('0x22')](function(_0x33fbfd){if(_0x33fbfd[_0xa382('0x63')]){var _0x3b7867=path[_0xa382('0x59')](_0x5731f9,_0x33fbfd[_0xa382('0x63')][_0xa382('0x72')]);if(fs[_0xa382('0x73')](_0x3b7867)){fs[_0xa382('0x74')](_0x3b7867)[_0xa382('0x75')](fs[_0xa382('0x76')](path['join'](_0x13871,_0x33fbfd['Attachment'][_0xa382('0x72')])));}}return{'date':moment(_0x33fbfd['createdAt'])[_0xa382('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa382('0x6e')](),'sender':_0x33fbfd['direction']==='out'?_0x33fbfd['User']?_0x33fbfd[_0xa382('0x5d')][_0xa382('0x5e')]:_0xa382('0x77'):_0x33fbfd[_0xa382('0x60')][_0xa382('0x61')]+(_0x33fbfd[_0xa382('0x60')][_0xa382('0x62')]?'\x20'+_0x33fbfd[_0xa382('0x60')][_0xa382('0x62')]:''),'body':_0x33fbfd[_0xa382('0x63')]?_0x33fbfd[_0xa382('0x63')][_0xa382('0x72')]:_0x33fbfd[_0xa382('0x38')],'direction':_0x33fbfd[_0xa382('0x65')]==='out'?'A':'C','secret':_0x33fbfd[_0xa382('0x78')],'read':_0x33fbfd[_0xa382('0x66')],'attachment':_0x33fbfd['Attachment']};})['value']()};return ejs[_0xa382('0x79')](path[_0xa382('0x59')](config[_0xa382('0x7a')],_0xa382('0x56'),_0xa382('0x7b'),_0xa382('0x7c')),{'interaction':_0x4159c7})['then'](function(_0x4f14c5){var _0x196ab5=path[_0xa382('0x59')](_0x13871,'transcript-'+_0x3f548a['id']+'-'+_0x449433+'.pdf');var _0x5e72a7={'path':_0x196ab5,'channel':_0xa382('0x7d'),'interactionId':_0x3f548a['id']};return pdf['createPdfFromHTML'](_0x4f14c5,_0x5e72a7);})[_0xa382('0x1b')](function(){return new BPromise(function(_0x4e2d4e,_0x4badb0){zipdir(_0x13871,{'saveTo':_0x35ada6},function(_0x37480b,_0x10b7ca){if(_0x37480b)return _0x4badb0(_0x37480b);return _0x4e2d4e(_0x10b7ca);});})['then'](function(){return new BPromise(function(_0x20f166,_0x4033c3){rimraf(_0x13871,function(_0x1731a4){if(_0x1731a4)_0x4033c3(_0x1731a4);return _0x20f166();});});})[_0xa382('0x1b')](function(){return _0x192d01[_0xa382('0x7e')](_0x35ada6,_0x3f2d62,function(_0x5a7ab0){if(_0x5a7ab0){console['log'](_0xa382('0x7f'),_0x5a7ab0);}else{fs['unlinkSync'](_0x35ada6);}});});});}else{return _0x192d01[_0xa382('0x10')](0xc8);}})[_0xa382('0x39')](handleError(_0x192d01,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 8742768..d7c2aff 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 _0x765e=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','events'];(function(_0x433463,_0x54fc41){var _0x521d6c=function(_0x5b9f80){while(--_0x5b9f80){_0x433463['push'](_0x433463['shift']());}};_0x521d6c(++_0x54fc41);}(_0x765e,0x131));var _0xe765=function(_0x4c9396,_0x505bfd){_0x4c9396=_0x4c9396-0x0;var _0x584ab8=_0x765e[_0x4c9396];return _0x584ab8;};'use strict';var EventEmitter=require(_0xe765('0x0'));var WhatsappInteraction=require(_0xe765('0x1'))['db'][_0xe765('0x2')];var WhatsappMessage=require(_0xe765('0x1'))['db'][_0xe765('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe765('0x4')](0x0);var events={'afterCreate':_0xe765('0x5'),'afterUpdate':_0xe765('0x6'),'afterDestroy':_0xe765('0x7')};function emitEvent(_0xd2e232){return function(_0x9559d4,_0x109713,_0x40ac5e){_0x9559d4[_0xe765('0x8')]({'attributes':['id'],'raw':!![]})[_0xe765('0x9')](function(_0x504542){_0x9559d4[_0xe765('0xa')](_0xe765('0xb'),_0x504542[_0xe765('0xc')](function(_0x2c1232){return{'id':_0x2c1232['id']};}));return WhatsappMessage[_0xe765('0xd')]({'where':{'WhatsappInteractionId':_0x9559d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe765('0x9')](function(_0x89a285){_0x9559d4['setDataValue'](_0xe765('0xe'),_0x89a285[_0xe765('0xf')]);WhatsappInteractionEvents[_0xe765('0x10')](_0xd2e232+':'+_0x9559d4['id'],_0x9559d4);WhatsappInteractionEvents['emit'](_0xd2e232,_0x9559d4);_0x40ac5e(null);})[_0xe765('0x11')](_0x40ac5e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x0b40=['length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0x0b40,0xba));var _0x00b4=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x0b40[_0x4c6d6f];return _0x2d4478;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x00b4('0x0'))['db'][_0x00b4('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x00b4('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x00b4('0x3')](0x0);var events={'afterCreate':_0x00b4('0x4'),'afterUpdate':_0x00b4('0x5'),'afterDestroy':_0x00b4('0x6')};function emitEvent(_0x40d4f4){return function(_0x4ff8ad,_0x1b5f2f,_0xbcf545){_0x4ff8ad[_0x00b4('0x7')]({'attributes':['id'],'raw':!![]})[_0x00b4('0x8')](function(_0x5684ec){_0x4ff8ad[_0x00b4('0x9')](_0x00b4('0xa'),_0x5684ec[_0x00b4('0xb')](function(_0x57f82a){return{'id':_0x57f82a['id']};}));return WhatsappMessage[_0x00b4('0xc')]({'where':{'WhatsappInteractionId':_0x4ff8ad['id'],'direction':'in','read':![]},'raw':!![]});})[_0x00b4('0x8')](function(_0x4eec0b){_0x4ff8ad['setDataValue'](_0x00b4('0xd'),_0x4eec0b[_0x00b4('0xe')]);WhatsappInteractionEvents[_0x00b4('0xf')](_0x40d4f4+':'+_0x4ff8ad['id'],_0x4ff8ad);WhatsappInteractionEvents[_0x00b4('0xf')](_0x40d4f4,_0x4ff8ad);_0xbcf545(null);})[_0x00b4('0x10')](_0xbcf545(null));};}for(var e in events){if(events[_0x00b4('0x11')](e)){var event=events[e];WhatsappInteraction[_0x00b4('0x12')](e,emitEvent(event));}}module[_0x00b4('0x13')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 7aa2a87..a7dcb97 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 _0x98e5=['lodash','util','bluebird','request-promise','path','rimraf','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5cb63c,_0x5d5b1b){var _0x3f352a=function(_0x5e7ff5){while(--_0x5e7ff5){_0x5cb63c['push'](_0x5cb63c['shift']());}};_0x3f352a(++_0x5d5b1b);}(_0x98e5,0x1d4));var _0x598e=function(_0x15d9ab,_0x10f6f0){_0x15d9ab=_0x15d9ab-0x0;var _0x51d0b1=_0x98e5[_0x15d9ab];return _0x51d0b1;};'use strict';var _=require(_0x598e('0x0'));var util=require(_0x598e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x598e('0x2'));var rp=require(_0x598e('0x3'));var fs=require('fs');var path=require(_0x598e('0x4'));var rimraf=require(_0x598e('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x1eca74,_0x510923){return _0x1eca74[_0x598e('0x6')](_0x598e('0x7'),attributes,{'tableName':_0x598e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c8e5f,_0x23925a,_0x36186f){if(_0x4c8e5f['changed'](_0x598e('0x9'))){_0x4c8e5f[_0x598e('0xa')]=moment()[_0x598e('0xb')](_0x598e('0xc'));}_0x36186f(null,_0x4c8e5f);}}});}; \ No newline at end of file +var _0x14ec=['request-promise','path','../../config/environment','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird'];(function(_0x27ac32,_0x42771f){var _0x20c811=function(_0x12d837){while(--_0x12d837){_0x27ac32['push'](_0x27ac32['shift']());}};_0x20c811(++_0x42771f);}(_0x14ec,0x127));var _0xc14e=function(_0x370707,_0x69a6c3){_0x370707=_0x370707-0x0;var _0x1d52da=_0x14ec[_0x370707];return _0x1d52da;};'use strict';var _=require(_0xc14e('0x0'));var util=require('util');var logger=require(_0xc14e('0x1'))(_0xc14e('0x2'));var moment=require(_0xc14e('0x3'));var BPromise=require(_0xc14e('0x4'));var rp=require(_0xc14e('0x5'));var fs=require('fs');var path=require(_0xc14e('0x6'));var rimraf=require('rimraf');var config=require(_0xc14e('0x7'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x128caf,_0x23f61f){return _0x128caf[_0xc14e('0x8')](_0xc14e('0x9'),attributes,{'tableName':_0xc14e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x351e15,_0x4f2c31,_0x3c1f3a){if(_0x351e15['changed'](_0xc14e('0xb'))){_0x351e15[_0xc14e('0xc')]=moment()[_0xc14e('0xd')](_0xc14e('0xe'));}_0x3c1f3a(null,_0x351e15);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index a3e3277..2da81f9 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 _0xf9c4=['redis','defaults','localhost','./whatsappInteraction.socket','register','request','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','limit','then','info','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x9077a4,_0x41748c){var _0x204bdc=function(_0x1c611e){while(--_0x1c611e){_0x9077a4['push'](_0x9077a4['shift']());}};_0x204bdc(++_0x41748c);}(_0xf9c4,0xc7));var _0x4f9c=function(_0x30bbfc,_0x326f7a){_0x30bbfc=_0x30bbfc-0x0;var _0x29f897=_0xf9c4[_0x30bbfc];return _0x29f897;};'use strict';var _=require(_0x4f9c('0x0'));var util=require(_0x4f9c('0x1'));var moment=require(_0x4f9c('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f9c('0x3'));var fs=require('fs');var Redis=require(_0x4f9c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4f9c('0x5'))(_0x4f9c('0x6'));var config=require(_0x4f9c('0x7'));var jayson=require(_0x4f9c('0x8'));var client=jayson[_0x4f9c('0x9')][_0x4f9c('0xa')]({'port':0x232a});config[_0x4f9c('0xb')]=_[_0x4f9c('0xc')](config['redis'],{'host':_0x4f9c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f9c('0xb')]));require(_0x4f9c('0xe'))[_0x4f9c('0xf')](socket);function respondWithRpcPromise(_0x313adf,_0x1b0f73,_0x2adfad){return new BPromise(function(_0x1395a7,_0x469ec5){return client[_0x4f9c('0x10')](_0x313adf,_0x2adfad)['then'](function(_0x25bd85){logger['info'](_0x4f9c('0x11'),_0x1b0f73,_0x4f9c('0x12'));logger[_0x4f9c('0x13')](_0x4f9c('0x14'),_0x1b0f73,_0x4f9c('0x12'),JSON[_0x4f9c('0x15')](_0x25bd85));if(_0x25bd85[_0x4f9c('0x16')]){if(_0x25bd85[_0x4f9c('0x16')][_0x4f9c('0x17')]===0x1f4){logger[_0x4f9c('0x16')](_0x4f9c('0x11'),_0x1b0f73,_0x25bd85['error']['message']);return _0x469ec5(_0x25bd85[_0x4f9c('0x16')][_0x4f9c('0x18')]);}logger[_0x4f9c('0x16')](_0x4f9c('0x11'),_0x1b0f73,_0x25bd85[_0x4f9c('0x16')][_0x4f9c('0x18')]);return _0x1395a7(_0x25bd85[_0x4f9c('0x16')][_0x4f9c('0x18')]);}else{logger['info'](_0x4f9c('0x11'),_0x1b0f73,_0x4f9c('0x12'));_0x1395a7(_0x25bd85[_0x4f9c('0x19')][_0x4f9c('0x18')]);}})[_0x4f9c('0x1a')](function(_0x1dfca3){logger[_0x4f9c('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x1b0f73,_0x1dfca3);_0x469ec5(_0x1dfca3);});});}exports[_0x4f9c('0x1b')]=function(_0x5f3c51){var _0x29fdc1=this;return new Promise(function(_0x493a92,_0x1ae6c6){return db['WhatsappInteraction'][_0x4f9c('0x1c')](_0x5f3c51[_0x4f9c('0x1d')],{'raw':_0x5f3c51[_0x4f9c('0x1e')]?_0x5f3c51[_0x4f9c('0x1e')][_0x4f9c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f3c51['options']?_0x5f3c51['options'][_0x4f9c('0x20')]||null:null,'attributes':_0x5f3c51['options']?_0x5f3c51[_0x4f9c('0x1e')]['attributes']||null:null,'limit':_0x5f3c51['options']?_0x5f3c51[_0x4f9c('0x1e')][_0x4f9c('0x21')]||null:null})[_0x4f9c('0x22')](function(_0x5883d5){logger[_0x4f9c('0x23')](_0x4f9c('0x1b'),_0x5f3c51);logger['debug']('UpdateWhatsappInteraction',_0x5f3c51,JSON[_0x4f9c('0x15')](_0x5883d5));_0x493a92(_0x5883d5);})['catch'](function(_0x3178c1){logger[_0x4f9c('0x16')]('UpdateWhatsappInteraction',_0x3178c1['message'],_0x5f3c51);_0x1ae6c6(_0x29fdc1['error'](0x1f4,_0x3178c1[_0x4f9c('0x18')]));});});};exports[_0x4f9c('0x24')]=function(_0x3c8420){return new Promise(function(_0x307cd2,_0x2c0939){return db[_0x4f9c('0x25')][_0x4f9c('0x26')]({'where':_0x3c8420[_0x4f9c('0x1e')]?_0x3c8420[_0x4f9c('0x1e')]['where']||null:null})[_0x4f9c('0x22')](function(_0xf11f71){if(_0xf11f71){return _0xf11f71[_0x4f9c('0x27')](_0x3c8420[_0x4f9c('0x1d')]['ids'],_['omit'](_0x3c8420['body'],[_0x4f9c('0x28'),'id'])||{});}})['spread'](function(_0x437436){logger[_0x4f9c('0x23')](_0x4f9c('0x29'),_0x3c8420);logger[_0x4f9c('0x13')](_0x4f9c('0x29'),_0x3c8420,JSON[_0x4f9c('0x15')](_0x437436));_0x307cd2(_0x437436);})[_0x4f9c('0x1a')](function(_0x1383de){logger['error'](_0x4f9c('0x29'),_0x1383de['message'],_0x3c8420);_0x2c0939(_this['error'](0x1f4,_0x1383de[_0x4f9c('0x18')]));});});}; \ No newline at end of file +var _0x3313=['register','request','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','limit','debug','AddTagsToWhatsappInteraction','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./whatsappInteraction.socket'];(function(_0x343c4a,_0x316f6c){var _0x56dd64=function(_0x141b5a){while(--_0x141b5a){_0x343c4a['push'](_0x343c4a['shift']());}};_0x56dd64(++_0x316f6c);}(_0x3313,0x181));var _0x3331=function(_0x15a143,_0x1d7c56){_0x15a143=_0x15a143-0x0;var _0xae979=_0x3313[_0x15a143];return _0xae979;};'use strict';var _=require(_0x3331('0x0'));var util=require(_0x3331('0x1'));var moment=require(_0x3331('0x2'));var BPromise=require('bluebird');var rs=require(_0x3331('0x3'));var fs=require('fs');var Redis=require(_0x3331('0x4'));var db=require(_0x3331('0x5'))['db'];var utils=require(_0x3331('0x6'));var logger=require(_0x3331('0x7'))(_0x3331('0x8'));var config=require(_0x3331('0x9'));var jayson=require(_0x3331('0xa'));var client=jayson['client'][_0x3331('0xb')]({'port':0x232a});config[_0x3331('0xc')]=_['defaults'](config[_0x3331('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3331('0xd'))(new Redis(config['redis']));require(_0x3331('0xe'))[_0x3331('0xf')](socket);function respondWithRpcPromise(_0x3fd7e2,_0x25d8c1,_0x219d49){return new BPromise(function(_0x46bb02,_0x177d1f){return client[_0x3331('0x10')](_0x3fd7e2,_0x219d49)[_0x3331('0x11')](function(_0x436eaf){logger[_0x3331('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x25d8c1,_0x3331('0x13'));logger['debug'](_0x3331('0x14'),_0x25d8c1,_0x3331('0x13'),JSON[_0x3331('0x15')](_0x436eaf));if(_0x436eaf[_0x3331('0x16')]){if(_0x436eaf[_0x3331('0x16')]['code']===0x1f4){logger[_0x3331('0x16')](_0x3331('0x17'),_0x25d8c1,_0x436eaf['error'][_0x3331('0x18')]);return _0x177d1f(_0x436eaf[_0x3331('0x16')][_0x3331('0x18')]);}logger[_0x3331('0x16')](_0x3331('0x17'),_0x25d8c1,_0x436eaf[_0x3331('0x16')]['message']);return _0x46bb02(_0x436eaf[_0x3331('0x16')][_0x3331('0x18')]);}else{logger['info'](_0x3331('0x17'),_0x25d8c1,_0x3331('0x13'));_0x46bb02(_0x436eaf[_0x3331('0x19')][_0x3331('0x18')]);}})[_0x3331('0x1a')](function(_0x460994){logger[_0x3331('0x16')](_0x3331('0x17'),_0x25d8c1,_0x460994);_0x177d1f(_0x460994);});});}exports[_0x3331('0x1b')]=function(_0x3e5f49){var _0x96449=this;return new Promise(function(_0x382f78,_0x170fde){return db[_0x3331('0x1c')]['update'](_0x3e5f49[_0x3331('0x1d')],{'raw':_0x3e5f49[_0x3331('0x1e')]?_0x3e5f49['options'][_0x3331('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e5f49['options']?_0x3e5f49[_0x3331('0x1e')][_0x3331('0x20')]||null:null,'attributes':_0x3e5f49['options']?_0x3e5f49[_0x3331('0x1e')]['attributes']||null:null,'limit':_0x3e5f49[_0x3331('0x1e')]?_0x3e5f49[_0x3331('0x1e')][_0x3331('0x21')]||null:null})[_0x3331('0x11')](function(_0x54fe1c){logger[_0x3331('0x12')](_0x3331('0x1b'),_0x3e5f49);logger[_0x3331('0x22')]('UpdateWhatsappInteraction',_0x3e5f49,JSON[_0x3331('0x15')](_0x54fe1c));_0x382f78(_0x54fe1c);})['catch'](function(_0x4405b3){logger[_0x3331('0x16')]('UpdateWhatsappInteraction',_0x4405b3[_0x3331('0x18')],_0x3e5f49);_0x170fde(_0x96449[_0x3331('0x16')](0x1f4,_0x4405b3[_0x3331('0x18')]));});});};exports[_0x3331('0x23')]=function(_0x57cfb6){return new Promise(function(_0x299680,_0x283082){return db['WhatsappInteraction']['find']({'where':_0x57cfb6['options']?_0x57cfb6[_0x3331('0x1e')][_0x3331('0x20')]||null:null})['then'](function(_0x85995b){if(_0x85995b){return _0x85995b['addTags'](_0x57cfb6[_0x3331('0x1d')][_0x3331('0x24')],_[_0x3331('0x25')](_0x57cfb6[_0x3331('0x1d')],[_0x3331('0x24'),'id'])||{});}})[_0x3331('0x26')](function(_0x466b2){logger['info']('AddTags',_0x57cfb6);logger[_0x3331('0x22')]('AddTags',_0x57cfb6,JSON[_0x3331('0x15')](_0x466b2));_0x299680(_0x466b2);})[_0x3331('0x1a')](function(_0x4873be){logger[_0x3331('0x16')](_0x3331('0x27'),_0x4873be['message'],_0x57cfb6);_0x283082(_this['error'](0x1f4,_0x4873be[_0x3331('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 38bd352..e08bcb9 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 _0xc359=['removeListener','register','save','remove','update'];(function(_0x172d5c,_0x10ebbe){var _0x337f7e=function(_0x7d45d2){while(--_0x7d45d2){_0x172d5c['push'](_0x172d5c['shift']());}};_0x337f7e(++_0x10ebbe);}(_0xc359,0xcf));var _0x9c35=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xc359[_0x279d37];return _0x530173;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x9c35('0x0'),_0x9c35('0x1'),_0x9c35('0x2')];function createListener(_0x27043e,_0x1941ec){return function(_0x885bbb){_0x1941ec['emit'](_0x27043e,_0x885bbb);};}function removeListener(_0xb2270b,_0x5f5ba3){return function(){WhatsappInteractionEvents[_0x9c35('0x3')](_0xb2270b,_0x5f5ba3);};}exports[_0x9c35('0x4')]=function(_0x373ed9){for(var _0x27f1ed=0x0,_0x20a788=events['length'];_0x27f1ed<_0x20a788;_0x27f1ed++){var _0x3518d0=events[_0x27f1ed];var _0x1f0b51=createListener('whatsappInteraction:'+_0x3518d0,_0x373ed9);WhatsappInteractionEvents['on'](_0x3518d0,_0x1f0b51);}}; \ No newline at end of file +var _0x8b02=['emit','register','length','whatsappInteraction:','update'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x8b02,0x9a));var _0x28b0=function(_0x1f4f7a,_0xf788dc){_0x1f4f7a=_0x1f4f7a-0x0;var _0x392956=_0x8b02[_0x1f4f7a];return _0x392956;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save','remove',_0x28b0('0x0')];function createListener(_0x5bf76e,_0x2de149){return function(_0x4268a6){_0x2de149[_0x28b0('0x1')](_0x5bf76e,_0x4268a6);};}function removeListener(_0x4844a6,_0x57e6fc){return function(){WhatsappInteractionEvents['removeListener'](_0x4844a6,_0x57e6fc);};}exports[_0x28b0('0x2')]=function(_0x2c57ad){for(var _0x1c877c=0x0,_0x29c3ba=events[_0x28b0('0x3')];_0x1c877c<_0x29c3ba;_0x1c877c++){var _0x3b8407=events[_0x1c877c];var _0x438c08=createListener(_0x28b0('0x4')+_0x3b8407,_0x2c57ad);WhatsappInteractionEvents['on'](_0x3b8407,_0x438c08);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5b34adc..8468104 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 _0x2229=['./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x385fd3,_0x3680b6){var _0x27c543=function(_0x3610cc){while(--_0x3610cc){_0x385fd3['push'](_0x385fd3['shift']());}};_0x27c543(++_0x3680b6);}(_0x2229,0xb8));var _0x9222=function(_0x3f560e,_0x289aa8){_0x3f560e=_0x3f560e-0x0;var _0x5bf213=_0x2229[_0x3f560e];return _0x5bf213;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9222('0x0'));var express=require(_0x9222('0x1'));var router=express[_0x9222('0x2')]();var fs_extra=require(_0x9222('0x3'));var auth=require(_0x9222('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9222('0x5'));router[_0x9222('0x6')]('/',auth[_0x9222('0x7')](),controller[_0x9222('0x8')]);router['get'](_0x9222('0x9'),auth['isAuthenticated'](),controller[_0x9222('0xa')]);router[_0x9222('0x6')](_0x9222('0xb'),auth['isAuthenticated'](),controller[_0x9222('0xc')]);router[_0x9222('0xd')]('/',auth[_0x9222('0x7')](),interaction[_0x9222('0xe')](_0x9222('0xf'),_0x9222('0x10')),controller['create']);router['post'](_0x9222('0x11'),controller[_0x9222('0x12')]);router[_0x9222('0x13')](_0x9222('0xb'),auth['isAuthenticated'](),controller[_0x9222('0x14')]);router[_0x9222('0x13')](_0x9222('0x15'),auth[_0x9222('0x7')](),controller[_0x9222('0x16')]);router[_0x9222('0x13')](_0x9222('0x17'),auth['isAuthenticated'](),controller[_0x9222('0x18')]);router['delete']('/:id',auth[_0x9222('0x7')](),controller[_0x9222('0x19')]);module[_0x9222('0x1a')]=router; \ No newline at end of file +var _0x660e=['status','put','update','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','describe','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status'];(function(_0x12a0a3,_0x2652d1){var _0x1c47c4=function(_0x22261b){while(--_0x22261b){_0x12a0a3['push'](_0x12a0a3['shift']());}};_0x1c47c4(++_0x2652d1);}(_0x660e,0x83));var _0xe660=function(_0x13f1c8,_0x49a872){_0x13f1c8=_0x13f1c8-0x0;var _0x1e716a=_0x660e[_0x13f1c8];return _0x1e716a;};'use strict';var multer=require(_0xe660('0x0'));var util=require(_0xe660('0x1'));var path=require(_0xe660('0x2'));var timeout=require('connect-timeout');var express=require(_0xe660('0x3'));var router=express[_0xe660('0x4')]();var fs_extra=require(_0xe660('0x5'));var auth=require(_0xe660('0x6'));var interaction=require(_0xe660('0x7'));var config=require(_0xe660('0x8'));var controller=require(_0xe660('0x9'));router[_0xe660('0xa')]('/',auth[_0xe660('0xb')](),controller['index']);router[_0xe660('0xa')]('/describe',auth[_0xe660('0xb')](),controller[_0xe660('0xc')]);router[_0xe660('0xa')]('/:id',auth[_0xe660('0xb')](),controller['show']);router['post']('/',auth[_0xe660('0xb')](),interaction[_0xe660('0xd')](_0xe660('0xe'),_0xe660('0xf')),controller[_0xe660('0x10')]);router[_0xe660('0x11')](_0xe660('0x12'),controller[_0xe660('0x13')]);router[_0xe660('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe660('0x15')]);router[_0xe660('0x14')](_0xe660('0x16'),auth[_0xe660('0xb')](),controller[_0xe660('0x17')]);router[_0xe660('0x14')](_0xe660('0x18'),auth[_0xe660('0xb')](),controller[_0xe660('0x19')]);router[_0xe660('0x1a')](_0xe660('0x1b'),auth[_0xe660('0xb')](),controller[_0xe660('0x1c')]);module[_0xe660('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7684755..20a0a08 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 _0xc529=['STRING','DATE','BOOLEAN','sequelize','TEXT','medium','out'];(function(_0x3dcdee,_0x113f84){var _0x51a482=function(_0x2c475e){while(--_0x2c475e){_0x3dcdee['push'](_0x3dcdee['shift']());}};_0x51a482(++_0x113f84);}(_0xc529,0x168));var _0x9c52=function(_0x2c0697,_0x15c276){_0x2c0697=_0x2c0697-0x0;var _0x4068d5=_0xc529[_0x2c0697];return _0x4068d5;};'use strict';var Sequelize=require(_0x9c52('0x0'));module['exports']={'body':{'type':Sequelize[_0x9c52('0x1')](_0x9c52('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9c52('0x3')),'defaultValue':_0x9c52('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x9c52('0x4')]},'readAt':{'type':Sequelize[_0x9c52('0x5')]},'secret':{'type':Sequelize[_0x9c52('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9c52('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa24b=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x368e49,_0x1c1e88){var _0x997dfb=function(_0xe5b542){while(--_0xe5b542){_0x368e49['push'](_0x368e49['shift']());}};_0x997dfb(++_0x1c1e88);}(_0xa24b,0x1cb));var _0xba24=function(_0x55b2fc,_0x450a27){_0x55b2fc=_0x55b2fc-0x0;var _0x2512d8=_0xa24b[_0x55b2fc];return _0x2512d8;};'use strict';var Sequelize=require(_0xba24('0x0'));module[_0xba24('0x1')]={'body':{'type':Sequelize[_0xba24('0x2')](_0xba24('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xba24('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xba24('0x5')]('in',_0xba24('0x6')),'defaultValue':_0xba24('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xba24('0x7')]},'readAt':{'type':Sequelize[_0xba24('0x8')]},'secret':{'type':Sequelize[_0xba24('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5169413..8aace22 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 _0x099e=['keys','include','create','body','find','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','WhatsappInteraction','RejectMessage','rejectMessage','Sequelize','User','motionChannel','event','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','show','params'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x099e,0x161));var _0xe099=function(_0x3db56e,_0x3d3641){_0x3db56e=_0x3db56e-0x0;var _0x99f3f9=_0x099e[_0x3db56e];return _0x99f3f9;};'use strict';var emlformat=require(_0xe099('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe099('0x1'));var jsonpatch=require(_0xe099('0x2'));var rp=require(_0xe099('0x3'));var moment=require(_0xe099('0x4'));var BPromise=require(_0xe099('0x5'));var Mustache=require(_0xe099('0x6'));var util=require(_0xe099('0x7'));var path=require(_0xe099('0x8'));var sox=require('sox');var csv=require(_0xe099('0x9'));var ejs=require(_0xe099('0xa'));var fs=require('fs');var fs_extra=require(_0xe099('0xb'));var _=require(_0xe099('0xc'));var squel=require(_0xe099('0xd'));var crypto=require(_0xe099('0xe'));var jsforce=require(_0xe099('0xf'));var deskjs=require(_0xe099('0x10'));var toCsv=require(_0xe099('0x9'));var querystring=require(_0xe099('0x11'));var Papa=require(_0xe099('0x12'));var Redis=require(_0xe099('0x13'));var authService=require(_0xe099('0x14'));var qs=require(_0xe099('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe099('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe099('0x17'));var config=require(_0xe099('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe099('0x19'))['db'];config['redis']=_[_0xe099('0x1a')](config['redis'],{'host':_0xe099('0x1b'),'port':0x18eb});var socket=require(_0xe099('0x1c'))(new Redis(config[_0xe099('0x1d')]));require('./whatsappMessage.socket')[_0xe099('0x1e')](socket);var jayson=require(_0xe099('0x1f'));var client=jayson[_0xe099('0x20')][_0xe099('0x21')]({'port':0x232c});var client9002=jayson[_0xe099('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f42a8,_0x199ba3,_0x36c4a0,_0x173490){return new BPromise(function(_0x736abf,_0x1488db){var _0xa65326=_0x173490||client;return _0xa65326[_0xe099('0x22')](_0x1f42a8,_0x36c4a0)[_0xe099('0x23')](function(_0x589ce8){logger[_0xe099('0x24')](_0xe099('0x25'),_0x199ba3,_0xe099('0x26'));logger['debug'](_0xe099('0x27'),_0x199ba3,_0xe099('0x26'),JSON[_0xe099('0x28')](_0x589ce8));if(_0x589ce8['error']){if(_0x589ce8[_0xe099('0x29')][_0xe099('0x2a')]===0x1f4){logger['error'](_0xe099('0x25'),_0x199ba3,_0x589ce8[_0xe099('0x29')][_0xe099('0x2b')]);return _0x1488db(_0x589ce8[_0xe099('0x29')][_0xe099('0x2b')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x199ba3,_0x589ce8[_0xe099('0x29')]['message']);return _0x736abf(_0x589ce8[_0xe099('0x29')][_0xe099('0x2b')]);}else{logger[_0xe099('0x24')](_0xe099('0x25'),_0x199ba3,_0xe099('0x26'));_0x736abf(_0x589ce8[_0xe099('0x2c')][_0xe099('0x2b')]);}})[_0xe099('0x2d')](function(_0x404cbb){logger[_0xe099('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x199ba3,_0x404cbb);_0x1488db(_0x404cbb);});});}function respondWithStatusCode(_0x54631b,_0x32b9d4){_0x32b9d4=_0x32b9d4||0xcc;return function(_0x2b5d13){if(_0x2b5d13){return _0x54631b[_0xe099('0x2e')](_0x32b9d4);}return _0x54631b[_0xe099('0x2f')](_0x32b9d4)[_0xe099('0x30')]();};}function respondWithResult(_0x57ec46,_0x2951de){_0x2951de=_0x2951de||0xc8;return function(_0x52a3bd){if(_0x52a3bd){return _0x57ec46['status'](_0x2951de)['json'](_0x52a3bd);}};}function respondWithFilteredResult(_0x3aa4fc,_0x248510){return function(_0xa9dd39){if(_0xa9dd39){var _0x115e98=typeof _0x248510[_0xe099('0x31')]==='undefined'&&typeof _0x248510[_0xe099('0x32')]===_0xe099('0x33');var _0x526e0a=_0xa9dd39[_0xe099('0x34')];var _0x3d62f3=_0x115e98?0x0:_0x248510[_0xe099('0x31')];var _0x3d5c78=_0x115e98?_0xa9dd39[_0xe099('0x34')]:_0x248510[_0xe099('0x31')]+_0x248510[_0xe099('0x32')];var _0x1219ce;if(_0x3d5c78>=_0x526e0a){_0x3d5c78=_0x526e0a;_0x1219ce=0xc8;}else{_0x1219ce=0xce;}_0x3aa4fc['status'](_0x1219ce);return _0x3aa4fc['set'](_0xe099('0x35'),_0x3d62f3+'-'+_0x3d5c78+'/'+_0x526e0a)[_0xe099('0x36')](_0xa9dd39);}return null;};}function patchUpdates(_0x578d33){return function(_0x29545d){try{jsonpatch[_0xe099('0x37')](_0x29545d,_0x578d33,!![]);}catch(_0x5a1fb9){return BPromise[_0xe099('0x38')](_0x5a1fb9);}return _0x29545d[_0xe099('0x39')]();};}function saveUpdates(_0x25a119,_0xb6010){return function(_0x180cd6){if(_0x180cd6){return _0x180cd6[_0xe099('0x3a')](_0x25a119)['then'](function(_0x2c2b64){return _0x2c2b64;});}return null;};}function removeEntity(_0x1631d8,_0x1e7c13){return function(_0x505866){if(_0x505866){return _0x505866[_0xe099('0x3b')]()['then'](function(){_0x1631d8[_0xe099('0x2f')](0xcc)[_0xe099('0x30')]();});}};}function handleEntityNotFound(_0x1c5862,_0x15754b){return function(_0x427f2b){if(!_0x427f2b){_0x1c5862['sendStatus'](0x194);}return _0x427f2b;};}function handleError(_0x1277cd,_0x500867){_0x500867=_0x500867||0x1f4;return function(_0x29146b){logger[_0xe099('0x29')](_0x29146b[_0xe099('0x3c')]);if(_0x29146b[_0xe099('0x3d')]){delete _0x29146b['name'];}_0x1277cd['status'](_0x500867)['send'](_0x29146b);};}exports[_0xe099('0x3e')]=function(_0x1ab324,_0x47f22e){var _0x33c3f0={},_0x1900b1={},_0x48b190={'count':0x0,'rows':[]};var _0x2b3b41=_[_0xe099('0x3f')](db[_0xe099('0x40')][_0xe099('0x41')],function(_0x27dd5b){return{'name':_0x27dd5b[_0xe099('0x42')],'type':_0x27dd5b[_0xe099('0x43')][_0xe099('0x44')]};});_0x1900b1[_0xe099('0x45')]=_[_0xe099('0x3f')](_0x2b3b41,_0xe099('0x3d'));_0x1900b1[_0xe099('0x46')]=_['keys'](_0x1ab324[_0xe099('0x46')]);_0x1900b1[_0xe099('0x47')]=_[_0xe099('0x48')](_0x1900b1['model'],_0x1900b1['query']);_0x33c3f0[_0xe099('0x49')]=_[_0xe099('0x48')](_0x1900b1['model'],qs['fields'](_0x1ab324[_0xe099('0x46')][_0xe099('0x4a')]));_0x33c3f0[_0xe099('0x49')]=_0x33c3f0[_0xe099('0x49')][_0xe099('0x4b')]?_0x33c3f0[_0xe099('0x49')]:_0x1900b1['model'];if(!_0x1ab324[_0xe099('0x46')][_0xe099('0x4c')]('nolimit')){_0x33c3f0[_0xe099('0x32')]=qs[_0xe099('0x32')](_0x1ab324[_0xe099('0x46')][_0xe099('0x32')]);_0x33c3f0[_0xe099('0x31')]=qs[_0xe099('0x31')](_0x1ab324['query']['offset']);}_0x33c3f0[_0xe099('0x4d')]=qs[_0xe099('0x4e')](_0x1ab324[_0xe099('0x46')]['sort']);_0x33c3f0['where']=qs[_0xe099('0x47')](_[_0xe099('0x4f')](_0x1ab324[_0xe099('0x46')],_0x1900b1[_0xe099('0x47')]),_0x2b3b41);if(_0x1ab324[_0xe099('0x46')][_0xe099('0x50')]){_0x33c3f0[_0xe099('0x51')]=_[_0xe099('0x52')](_0x33c3f0[_0xe099('0x51')],{'$or':_['map'](_0x2b3b41,function(_0x2e6ea5){if(_0x2e6ea5[_0xe099('0x43')]!==_0xe099('0x53')){var _0x2a559b={};_0x2a559b[_0x2e6ea5[_0xe099('0x3d')]]={'$like':'%'+_0x1ab324[_0xe099('0x46')][_0xe099('0x50')]+'%'};return _0x2a559b;}})});}_0x33c3f0=_[_0xe099('0x52')]({},_0x33c3f0,_0x1ab324['options']);var _0x25fb58={'where':_0x33c3f0[_0xe099('0x51')]};return db[_0xe099('0x40')][_0xe099('0x34')](_0x25fb58)['then'](function(_0x47bfbb){_0x48b190[_0xe099('0x34')]=_0x47bfbb;if(_0x1ab324[_0xe099('0x46')][_0xe099('0x54')]){_0x33c3f0['include']=[{'all':!![]}];}return db[_0xe099('0x40')][_0xe099('0x55')](_0x33c3f0);})[_0xe099('0x23')](function(_0x616d49){_0x48b190['rows']=_0x616d49;return _0x48b190;})[_0xe099('0x23')](respondWithFilteredResult(_0x47f22e,_0x33c3f0))['catch'](handleError(_0x47f22e,null));};exports[_0xe099('0x56')]=function(_0xa0f3b5,_0x42968b){var _0xcebf9c={'raw':!![],'where':{'id':_0xa0f3b5[_0xe099('0x57')]['id']}},_0x276190={};_0x276190[_0xe099('0x45')]=_['keys'](db[_0xe099('0x40')][_0xe099('0x41')]);_0x276190['query']=_[_0xe099('0x58')](_0xa0f3b5[_0xe099('0x46')]);_0x276190[_0xe099('0x47')]=_[_0xe099('0x48')](_0x276190[_0xe099('0x45')],_0x276190[_0xe099('0x46')]);_0xcebf9c[_0xe099('0x49')]=_['intersection'](_0x276190[_0xe099('0x45')],qs[_0xe099('0x4a')](_0xa0f3b5[_0xe099('0x46')][_0xe099('0x4a')]));_0xcebf9c['attributes']=_0xcebf9c[_0xe099('0x49')]['length']?_0xcebf9c[_0xe099('0x49')]:_0x276190[_0xe099('0x45')];if(_0xa0f3b5['query'][_0xe099('0x54')]){_0xcebf9c[_0xe099('0x59')]=[{'all':!![]}];}_0xcebf9c=_['merge']({},_0xcebf9c,_0xa0f3b5['options']);return db['WhatsappMessage']['find'](_0xcebf9c)['then'](handleEntityNotFound(_0x42968b,null))[_0xe099('0x23')](respondWithResult(_0x42968b,null))[_0xe099('0x2d')](handleError(_0x42968b,null));};exports[_0xe099('0x5a')]=function(_0x24aacd,_0x3294eb){return db[_0xe099('0x40')]['create'](_0x24aacd['body'],{})[_0xe099('0x23')](respondWithResult(_0x3294eb,0xc9))['catch'](handleError(_0x3294eb,null));};exports['update']=function(_0x58dd1c,_0x3a41c8){if(_0x58dd1c[_0xe099('0x5b')]['id']){delete _0x58dd1c[_0xe099('0x5b')]['id'];}return db[_0xe099('0x40')][_0xe099('0x5c')]({'where':{'id':_0x58dd1c[_0xe099('0x57')]['id']}})[_0xe099('0x23')](handleEntityNotFound(_0x3a41c8,null))['then'](saveUpdates(_0x58dd1c['body'],null))[_0xe099('0x23')](respondWithResult(_0x3a41c8,null))[_0xe099('0x2d')](handleError(_0x3a41c8,null));};exports[_0xe099('0x3b')]=function(_0x18aea9,_0xcecd18){return db[_0xe099('0x40')][_0xe099('0x5c')]({'where':{'id':_0x18aea9['params']['id']}})[_0xe099('0x23')](handleEntityNotFound(_0xcecd18,null))['then'](removeEntity(_0xcecd18,null))[_0xe099('0x2d')](handleError(_0xcecd18,null));};exports[_0xe099('0x5d')]=function(_0xc2a807,_0x45b103){return db[_0xe099('0x40')][_0xe099('0x5d')]()[_0xe099('0x23')](respondWithResult(_0x45b103,null))['catch'](handleError(_0x45b103,null));};var interaction_log=require(_0xe099('0x5e'))(_0xe099('0x5f'));exports[_0xe099('0x60')]=function(_0x1e3840,_0x1b5b0a,_0x4a6b08){var _0x41296a={'agent':{},'channel':_0xe099('0x61')};if(_0x1e3840[_0xe099('0x5b')]['id']){delete _0x1e3840['body']['id'];}_0x1e3840[_0xe099('0x5b')][_0xe099('0x62')]=!![];_0x1e3840[_0xe099('0x5b')][_0xe099('0x63')]=moment()[_0xe099('0x64')](_0xe099('0x65'));_0x1e3840['body']['UserId']=_0x1e3840[_0xe099('0x5b')]['UserId']||_0x1e3840[_0xe099('0x66')]['id'];_0x41296a[_0xe099('0x67')]['id']=_0x1e3840[_0xe099('0x5b')][_0xe099('0x68')];return db['WhatsappMessage'][_0xe099('0x5c')]({'where':{'id':_0x1e3840[_0xe099('0x57')]['id'],'UserId':null}})[_0xe099('0x23')](handleEntityNotFound(_0x1b5b0a,null))[_0xe099('0x23')](saveUpdates(_0x1e3840[_0xe099('0x5b')],null))[_0xe099('0x23')](function(_0x2f8c00){if(_0x2f8c00){_0x41296a['message']=_0x2f8c00['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x2f8c00[_0xe099('0x69')]}});}return null;})[_0xe099('0x23')](handleEntityNotFound(_0x1b5b0a,null))[_0xe099('0x23')](function(_0x48c8d0){if(_0x48c8d0){return _0x48c8d0[_0xe099('0x3a')]({'UserId':_0x1e3840[_0xe099('0x5b')][_0xe099('0x68')],'read1stAt':_[_0xe099('0x6a')](_0x48c8d0[_0xe099('0x6b')])?moment()[_0xe099('0x64')](_0xe099('0x65')):undefined});}return null;})[_0xe099('0x23')](function(_0x39a442){if(_0x39a442){_0x41296a[_0xe099('0x6c')]=_0x39a442[_0xe099('0x6d')]({'plain':!![]});interaction_log[_0xe099('0x24')](_0xe099('0x6e'),_0x1e3840['user']['id'],_0x1e3840[_0xe099('0x66')]['name'],_0x1e3840[_0xe099('0x66')][_0xe099('0x6f')],_0x41296a[_0xe099('0x6c')]['id'],_0x1e3840[_0xe099('0x5b')]?JSON[_0xe099('0x28')](_0x1e3840[_0xe099('0x5b')]):_0xe099('0x70'));return respondWithRpcPromise(_0xe099('0x71'),_0xe099('0x72'),_0x41296a);}return null;})['then'](function(_0x400dee){var _0x4ebe20=_0xe099('0x73')+_0x400dee[_0xe099('0x2b')][_0xe099('0x74')];return db[_0xe099('0x75')][_0xe099('0x46')](_0x4ebe20,{'type':db['Sequelize'][_0xe099('0x76')][_0xe099('0x77')],'raw':!![]})[_0xe099('0x23')](function(_0x3ad456){return _0x3ad456;});})[_0xe099('0x23')](function(_0x36a06b){if(_0x36a06b){_0x41296a[_0xe099('0x2b')][_0xe099('0x78')]=_0x36a06b[0x0];if(!_0x1e3840['body']['UserId'])return;return db['User'][_0xe099('0x5c')]({'where':{'id':_0x1e3840['body'][_0xe099('0x68')],'role':_0xe099('0x67')},'attributes':['id',_0xe099('0x3d'),_0xe099('0x79'),_0xe099('0x7a'),_0xe099('0x7b')],'raw':!![]});}return null;})[_0xe099('0x23')](function(_0x32f6eb){if(!_0x32f6eb)return null;_0x41296a[_0xe099('0x2b')][_0xe099('0x67')]=_0x32f6eb;return _0x41296a;})['then'](function(_0x5321b9){if(_0x5321b9){if(_0x1e3840['body'][_0xe099('0x7c')]){_0x41296a[_0xe099('0x2b')][_0xe099('0x7d')]=util[_0xe099('0x64')](_0xe099('0x7e'),_0x1e3840[_0xe099('0x66')][_0xe099('0x3d')]);_0x41296a[_0xe099('0x2b')][_0xe099('0x7f')]=_0x41296a[_0xe099('0x7f')];_0x41296a[_0xe099('0x2b')]['motionChannel']=_0x41296a['channel'];_0x41296a['message']['event']=_0xe099('0x60');return respondWithRpcPromise(_0xe099('0x80'),_0xe099('0x80'),{'event':'acceptmessage','message':_0x41296a['message']},client9002)[_0xe099('0x23')](function(){return _0x41296a;});}return _0x41296a;}return null;})[_0xe099('0x23')](respondWithResult(_0x1b5b0a,null))[_0xe099('0x2d')](handleError(_0x1b5b0a,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xe099('0x38')]=function(_0x4c0a87,_0x1944d9,_0x4fbc8d){var _0x3b9b48={'agent':{},'channel':_0xe099('0x61')};if(_0x4c0a87[_0xe099('0x5b')]['id']){delete _0x4c0a87[_0xe099('0x5b')]['id'];}_0x4c0a87['body'][_0xe099('0x68')]=_0x4c0a87['body']['UserId']||_0x4c0a87[_0xe099('0x66')]['id'];_0x3b9b48[_0xe099('0x67')]['id']=_0x4c0a87[_0xe099('0x5b')]['UserId'];return db[_0xe099('0x40')]['find']({'where':{'id':_0x4c0a87[_0xe099('0x57')]['id'],'UserId':null}})[_0xe099('0x23')](handleEntityNotFound(_0x1944d9,null))['then'](function(_0x306b6b){if(_0x306b6b){_0x3b9b48[_0xe099('0x2b')]=_0x306b6b['get']({'plain':!![]});return db[_0xe099('0x81')][_0xe099('0x5c')]({'where':{'id':_0x306b6b['WhatsappInteractionId']}});}return null;})[_0xe099('0x23')](handleEntityNotFound(_0x1944d9,null))['then'](function(_0x230cdf){if(_0x230cdf){_0x3b9b48[_0xe099('0x6c')]=_0x230cdf[_0xe099('0x6d')]({'plain':!![]});interaction_log[_0xe099('0x24')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c0a87[_0xe099('0x66')]['id'],_0x4c0a87[_0xe099('0x66')]['name'],_0x4c0a87[_0xe099('0x66')]['role'],_0x3b9b48[_0xe099('0x6c')]['id'],_0x4c0a87[_0xe099('0x5b')]?JSON[_0xe099('0x28')](_0x4c0a87['body']):_0xe099('0x70'));return respondWithRpcPromise(_0xe099('0x82'),_0xe099('0x83'),_0x3b9b48);}return null;})[_0xe099('0x23')](function(_0x16904b){var _0x16cde=_0xe099('0x73')+_0x16904b[_0xe099('0x2b')][_0xe099('0x74')];return db[_0xe099('0x75')][_0xe099('0x46')](_0x16cde,{'type':db[_0xe099('0x84')][_0xe099('0x76')]['SELECT'],'raw':!![]})[_0xe099('0x23')](function(_0x5434ec){return _0x5434ec;});})['then'](function(_0x5e7a02){if(_0x5e7a02){_0x3b9b48[_0xe099('0x2b')][_0xe099('0x78')]=_0x5e7a02[0x0];if(!_0x4c0a87[_0xe099('0x5b')][_0xe099('0x68')])return;return db[_0xe099('0x85')][_0xe099('0x5c')]({'where':{'id':_0x4c0a87['body']['UserId'],'role':_0xe099('0x67')},'attributes':['id',_0xe099('0x3d'),'fullname','email',_0xe099('0x7b')],'raw':!![]});}return null;})['then'](function(_0x3d6c54){if(!_0x3d6c54)return null;_0x3b9b48[_0xe099('0x2b')]['agent']=_0x3d6c54;return _0x3b9b48;})[_0xe099('0x23')](function(_0x14eb9d){if(_0x14eb9d){_0x14eb9d[_0xe099('0x2b')][_0xe099('0x7d')]=util[_0xe099('0x64')](_0xe099('0x7e'),_0x4c0a87[_0xe099('0x66')][_0xe099('0x3d')]);_0x14eb9d['message'][_0xe099('0x7f')]=_0x3b9b48[_0xe099('0x7f')];_0x14eb9d[_0xe099('0x2b')][_0xe099('0x86')]=_0x3b9b48[_0xe099('0x7f')];_0x14eb9d[_0xe099('0x2b')][_0xe099('0x87')]='reject';respondWithRpcPromise(_0xe099('0x80'),_0xe099('0x80'),{'event':_0xe099('0x88'),'message':_0x14eb9d[_0xe099('0x2b')]},client9002);return _0x3b9b48;}return null;})[_0xe099('0x23')](respondWithResult(_0x1944d9,null))[_0xe099('0x2d')](handleError(_0x1944d9,null));};exports[_0xe099('0x2f')]=function(_0x4d971c,_0x3d2ab3,_0x3b0c4a){if(_0x4d971c['body']['id']){delete _0x4d971c[_0xe099('0x5b')]['id'];}var _0x3d2246;return db[_0xe099('0x40')][_0xe099('0x5c')]({'where':{'id':_0x4d971c[_0xe099('0x57')]['id']}})[_0xe099('0x23')](handleEntityNotFound(_0x3d2ab3,null))[_0xe099('0x23')](function(_0x47a7de){if(_0x47a7de){_0x3d2246=_0x47a7de;return db[_0xe099('0x89')][_0xe099('0x5c')]({'where':{'id':_0x47a7de[_0xe099('0x8a')]}});}})[_0xe099('0x23')](handleEntityNotFound(_0x3d2ab3,null))['then'](function(_0x30baa2){if(_0x30baa2){logger[_0xe099('0x8b')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xe099('0x2f'),_0xe099('0x8c'),_0x30baa2['type'],util[_0xe099('0x8d')](_0x4d971c[_0xe099('0x5b')],{'showHidden':![],'depth':null}));switch(_0x30baa2[_0xe099('0x43')]){case _0xe099('0x8e'):if(_0x4d971c[_0xe099('0x5b')][_0xe099('0x8f')]&&_0x4d971c['body'][_0xe099('0x8f')]===_0x3d2246[_0xe099('0x90')]&&_0x4d971c[_0xe099('0x5b')][_0xe099('0x91')]&&_0x4d971c[_0xe099('0x5b')]['MessageStatus']==='read'){return _0x3d2246['update']({'read':!![]});}else{logger[_0xe099('0x29')](_0xe099('0x92'),_0xe099('0x2f'),_0xe099('0x8e'),util['inspect'](_0x4d971c[_0xe099('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x3d2246;}})[_0xe099('0x23')](respondWithResult(_0x3d2ab3,null))[_0xe099('0x2d')](handleError(_0x3d2ab3,null));}; \ No newline at end of file +var _0x02b3=['WhatsappMessage','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','whatsapp-interactions','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','role','RejectMessage','rejectMessage','SELECT','User','internal','interface','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','type','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','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','./whatsappMessage.socket','register','jayson/promise','http','client','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x3c6daa,_0x205e9c){var _0x47e94d=function(_0x179819){while(--_0x179819){_0x3c6daa['push'](_0x3c6daa['shift']());}};_0x47e94d(++_0x205e9c);}(_0x02b3,0x1ee));var _0x302b=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x02b3[_0x2261ce];return _0x524640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x302b('0x0'));var zipdir=require(_0x302b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x302b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x302b('0x3'));var util=require(_0x302b('0x4'));var path=require(_0x302b('0x5'));var sox=require(_0x302b('0x6'));var csv=require(_0x302b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x302b('0x8'));var _=require('lodash');var squel=require(_0x302b('0x9'));var crypto=require(_0x302b('0xa'));var jsforce=require(_0x302b('0xb'));var deskjs=require(_0x302b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x302b('0xd'));var Papa=require(_0x302b('0xe'));var Redis=require(_0x302b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x302b('0x10'));var hardwareService=require(_0x302b('0x11'));var logger=require(_0x302b('0x12'))(_0x302b('0x13'));var utils=require(_0x302b('0x14'));var config=require(_0x302b('0x15'));var licenseUtil=require(_0x302b('0x16'));var db=require(_0x302b('0x17'))['db'];config[_0x302b('0x18')]=_[_0x302b('0x19')](config[_0x302b('0x18')],{'host':_0x302b('0x1a'),'port':0x18eb});var socket=require(_0x302b('0x1b'))(new Redis(config['redis']));require(_0x302b('0x1c'))[_0x302b('0x1d')](socket);var jayson=require(_0x302b('0x1e'));var client=jayson['client'][_0x302b('0x1f')]({'port':0x232c});var client9002=jayson[_0x302b('0x20')][_0x302b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xd21d7c,_0x50d904,_0xcc6774,_0x2fb801){return new BPromise(function(_0x2c1cf4,_0x46c2ab){var _0x538b72=_0x2fb801||client;return _0x538b72[_0x302b('0x21')](_0xd21d7c,_0xcc6774)['then'](function(_0x2ff7a0){logger['info'](_0x302b('0x22'),_0x50d904,_0x302b('0x23'));logger[_0x302b('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x50d904,_0x302b('0x23'),JSON[_0x302b('0x25')](_0x2ff7a0));if(_0x2ff7a0[_0x302b('0x26')]){if(_0x2ff7a0[_0x302b('0x26')][_0x302b('0x27')]===0x1f4){logger[_0x302b('0x26')](_0x302b('0x22'),_0x50d904,_0x2ff7a0[_0x302b('0x26')][_0x302b('0x28')]);return _0x46c2ab(_0x2ff7a0[_0x302b('0x26')][_0x302b('0x28')]);}logger[_0x302b('0x26')](_0x302b('0x22'),_0x50d904,_0x2ff7a0[_0x302b('0x26')][_0x302b('0x28')]);return _0x2c1cf4(_0x2ff7a0[_0x302b('0x26')][_0x302b('0x28')]);}else{logger[_0x302b('0x29')](_0x302b('0x22'),_0x50d904,_0x302b('0x23'));_0x2c1cf4(_0x2ff7a0[_0x302b('0x2a')][_0x302b('0x28')]);}})['catch'](function(_0x6b9a1){logger[_0x302b('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x50d904,_0x6b9a1);_0x46c2ab(_0x6b9a1);});});}function respondWithStatusCode(_0x4aecff,_0x58ed8a){_0x58ed8a=_0x58ed8a||0xcc;return function(_0x12244){if(_0x12244){return _0x4aecff[_0x302b('0x2b')](_0x58ed8a);}return _0x4aecff[_0x302b('0x2c')](_0x58ed8a)['end']();};}function respondWithResult(_0x31ce83,_0x26eba0){_0x26eba0=_0x26eba0||0xc8;return function(_0x472dc1){if(_0x472dc1){return _0x31ce83['status'](_0x26eba0)[_0x302b('0x2d')](_0x472dc1);}};}function respondWithFilteredResult(_0x393d23,_0x1f334f){return function(_0x34cb29){if(_0x34cb29){var _0x33d3fe=typeof _0x1f334f[_0x302b('0x2e')]===_0x302b('0x2f')&&typeof _0x1f334f[_0x302b('0x30')]===_0x302b('0x2f');var _0x4bd3a8=_0x34cb29[_0x302b('0x31')];var _0x3a9124=_0x33d3fe?0x0:_0x1f334f['offset'];var _0x194aca=_0x33d3fe?_0x34cb29[_0x302b('0x31')]:_0x1f334f[_0x302b('0x2e')]+_0x1f334f[_0x302b('0x30')];var _0x4aac86;if(_0x194aca>=_0x4bd3a8){_0x194aca=_0x4bd3a8;_0x4aac86=0xc8;}else{_0x4aac86=0xce;}_0x393d23[_0x302b('0x2c')](_0x4aac86);return _0x393d23['set'](_0x302b('0x32'),_0x3a9124+'-'+_0x194aca+'/'+_0x4bd3a8)[_0x302b('0x2d')](_0x34cb29);}return null;};}function patchUpdates(_0x15f81a){return function(_0x35fdf8){try{jsonpatch['apply'](_0x35fdf8,_0x15f81a,!![]);}catch(_0x213817){return BPromise[_0x302b('0x33')](_0x213817);}return _0x35fdf8['save']();};}function saveUpdates(_0x15494e,_0x6edcca){return function(_0x273213){if(_0x273213){return _0x273213['update'](_0x15494e)[_0x302b('0x34')](function(_0x43122a){return _0x43122a;});}return null;};}function removeEntity(_0x1d5665,_0x103709){return function(_0x288db3){if(_0x288db3){return _0x288db3['destroy']()['then'](function(){_0x1d5665[_0x302b('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44ccc0,_0xc35bc0){return function(_0x367efe){if(!_0x367efe){_0x44ccc0[_0x302b('0x2b')](0x194);}return _0x367efe;};}function handleError(_0x19c4ac,_0x2c6dc8){_0x2c6dc8=_0x2c6dc8||0x1f4;return function(_0x380e62){logger[_0x302b('0x26')](_0x380e62[_0x302b('0x35')]);if(_0x380e62[_0x302b('0x36')]){delete _0x380e62[_0x302b('0x36')];}_0x19c4ac[_0x302b('0x2c')](_0x2c6dc8)[_0x302b('0x37')](_0x380e62);};}exports[_0x302b('0x38')]=function(_0x409a80,_0x1fcdd0){var _0x51ae74={},_0x909915={},_0x4958e0={'count':0x0,'rows':[]};var _0xfc03=_[_0x302b('0x39')](db['WhatsappMessage'][_0x302b('0x3a')],function(_0x225934){return{'name':_0x225934[_0x302b('0x3b')],'type':_0x225934['type'][_0x302b('0x3c')]};});_0x909915[_0x302b('0x3d')]=_['map'](_0xfc03,_0x302b('0x36'));_0x909915[_0x302b('0x3e')]=_[_0x302b('0x3f')](_0x409a80[_0x302b('0x3e')]);_0x909915['filters']=_[_0x302b('0x40')](_0x909915[_0x302b('0x3d')],_0x909915[_0x302b('0x3e')]);_0x51ae74[_0x302b('0x41')]=_[_0x302b('0x40')](_0x909915['model'],qs[_0x302b('0x42')](_0x409a80['query'][_0x302b('0x42')]));_0x51ae74['attributes']=_0x51ae74[_0x302b('0x41')][_0x302b('0x43')]?_0x51ae74[_0x302b('0x41')]:_0x909915['model'];if(!_0x409a80[_0x302b('0x3e')][_0x302b('0x44')](_0x302b('0x45'))){_0x51ae74[_0x302b('0x30')]=qs[_0x302b('0x30')](_0x409a80[_0x302b('0x3e')]['limit']);_0x51ae74['offset']=qs[_0x302b('0x2e')](_0x409a80['query']['offset']);}_0x51ae74[_0x302b('0x46')]=qs[_0x302b('0x47')](_0x409a80[_0x302b('0x3e')]['sort']);_0x51ae74[_0x302b('0x48')]=qs[_0x302b('0x49')](_[_0x302b('0x4a')](_0x409a80[_0x302b('0x3e')],_0x909915['filters']),_0xfc03);if(_0x409a80['query'][_0x302b('0x4b')]){_0x51ae74[_0x302b('0x48')]=_[_0x302b('0x4c')](_0x51ae74[_0x302b('0x48')],{'$or':_['map'](_0xfc03,function(_0x10fc04){if(_0x10fc04['type']!==_0x302b('0x4d')){var _0x5454a5={};_0x5454a5[_0x10fc04[_0x302b('0x36')]]={'$like':'%'+_0x409a80[_0x302b('0x3e')][_0x302b('0x4b')]+'%'};return _0x5454a5;}})});}_0x51ae74=_[_0x302b('0x4c')]({},_0x51ae74,_0x409a80['options']);var _0x41855b={'where':_0x51ae74['where']};return db[_0x302b('0x4e')][_0x302b('0x31')](_0x41855b)[_0x302b('0x34')](function(_0x3959cd){_0x4958e0[_0x302b('0x31')]=_0x3959cd;if(_0x409a80[_0x302b('0x3e')][_0x302b('0x4f')]){_0x51ae74[_0x302b('0x50')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x302b('0x51')](_0x51ae74);})['then'](function(_0x4d6452){_0x4958e0[_0x302b('0x52')]=_0x4d6452;return _0x4958e0;})[_0x302b('0x34')](respondWithFilteredResult(_0x1fcdd0,_0x51ae74))[_0x302b('0x53')](handleError(_0x1fcdd0,null));};exports[_0x302b('0x54')]=function(_0x238235,_0x504185){var _0x1db4d5={'raw':!![],'where':{'id':_0x238235[_0x302b('0x55')]['id']}},_0x540a9e={};_0x540a9e[_0x302b('0x3d')]=_['keys'](db[_0x302b('0x4e')][_0x302b('0x3a')]);_0x540a9e[_0x302b('0x3e')]=_[_0x302b('0x3f')](_0x238235[_0x302b('0x3e')]);_0x540a9e[_0x302b('0x49')]=_[_0x302b('0x40')](_0x540a9e[_0x302b('0x3d')],_0x540a9e[_0x302b('0x3e')]);_0x1db4d5[_0x302b('0x41')]=_[_0x302b('0x40')](_0x540a9e[_0x302b('0x3d')],qs[_0x302b('0x42')](_0x238235[_0x302b('0x3e')][_0x302b('0x42')]));_0x1db4d5[_0x302b('0x41')]=_0x1db4d5[_0x302b('0x41')][_0x302b('0x43')]?_0x1db4d5[_0x302b('0x41')]:_0x540a9e[_0x302b('0x3d')];if(_0x238235[_0x302b('0x3e')]['includeAll']){_0x1db4d5[_0x302b('0x50')]=[{'all':!![]}];}_0x1db4d5=_[_0x302b('0x4c')]({},_0x1db4d5,_0x238235[_0x302b('0x56')]);return db[_0x302b('0x4e')][_0x302b('0x57')](_0x1db4d5)[_0x302b('0x34')](handleEntityNotFound(_0x504185,null))[_0x302b('0x34')](respondWithResult(_0x504185,null))[_0x302b('0x53')](handleError(_0x504185,null));};exports[_0x302b('0x58')]=function(_0x146841,_0x5401be){return db[_0x302b('0x4e')][_0x302b('0x58')](_0x146841[_0x302b('0x59')],{})[_0x302b('0x34')](respondWithResult(_0x5401be,0xc9))[_0x302b('0x53')](handleError(_0x5401be,null));};exports[_0x302b('0x5a')]=function(_0x286008,_0x1fe07a){if(_0x286008[_0x302b('0x59')]['id']){delete _0x286008[_0x302b('0x59')]['id'];}return db['WhatsappMessage'][_0x302b('0x57')]({'where':{'id':_0x286008[_0x302b('0x55')]['id']}})[_0x302b('0x34')](handleEntityNotFound(_0x1fe07a,null))[_0x302b('0x34')](saveUpdates(_0x286008[_0x302b('0x59')],null))['then'](respondWithResult(_0x1fe07a,null))[_0x302b('0x53')](handleError(_0x1fe07a,null));};exports['destroy']=function(_0x321506,_0x573941){return db['WhatsappMessage']['find']({'where':{'id':_0x321506[_0x302b('0x55')]['id']}})[_0x302b('0x34')](handleEntityNotFound(_0x573941,null))[_0x302b('0x34')](removeEntity(_0x573941,null))[_0x302b('0x53')](handleError(_0x573941,null));};exports['describe']=function(_0x20580f,_0x466824){return db['WhatsappMessage'][_0x302b('0x5b')]()[_0x302b('0x34')](respondWithResult(_0x466824,null))[_0x302b('0x53')](handleError(_0x466824,null));};var interaction_log=require('../../config/logger')(_0x302b('0x5c'));exports['accept']=function(_0x3aa58b,_0x5bb4fd,_0x309efe){var _0x44aae0={'agent':{},'channel':_0x302b('0x5d')};if(_0x3aa58b[_0x302b('0x59')]['id']){delete _0x3aa58b['body']['id'];}_0x3aa58b[_0x302b('0x59')][_0x302b('0x5e')]=!![];_0x3aa58b['body']['readAt']=moment()[_0x302b('0x5f')](_0x302b('0x60'));_0x3aa58b['body'][_0x302b('0x61')]=_0x3aa58b[_0x302b('0x59')]['UserId']||_0x3aa58b['user']['id'];_0x44aae0[_0x302b('0x62')]['id']=_0x3aa58b['body'][_0x302b('0x61')];return db[_0x302b('0x4e')][_0x302b('0x57')]({'where':{'id':_0x3aa58b[_0x302b('0x55')]['id'],'UserId':null}})[_0x302b('0x34')](handleEntityNotFound(_0x5bb4fd,null))[_0x302b('0x34')](saveUpdates(_0x3aa58b[_0x302b('0x59')],null))[_0x302b('0x34')](function(_0xb3bd75){if(_0xb3bd75){_0x44aae0[_0x302b('0x28')]=_0xb3bd75[_0x302b('0x63')]({'plain':!![]});return db[_0x302b('0x64')][_0x302b('0x57')]({'where':{'id':_0xb3bd75[_0x302b('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x5bb4fd,null))[_0x302b('0x34')](function(_0x52cb60){if(_0x52cb60){return _0x52cb60['update']({'UserId':_0x3aa58b[_0x302b('0x59')][_0x302b('0x61')],'read1stAt':_[_0x302b('0x66')](_0x52cb60[_0x302b('0x67')])?moment()[_0x302b('0x5f')](_0x302b('0x60')):undefined});}return null;})[_0x302b('0x34')](function(_0x303065){if(_0x303065){_0x44aae0[_0x302b('0x68')]=_0x303065['get']({'plain':!![]});interaction_log[_0x302b('0x29')](_0x302b('0x69'),_0x3aa58b[_0x302b('0x6a')]['id'],_0x3aa58b[_0x302b('0x6a')][_0x302b('0x36')],_0x3aa58b[_0x302b('0x6a')]['role'],_0x44aae0[_0x302b('0x68')]['id'],_0x3aa58b[_0x302b('0x59')]?JSON[_0x302b('0x25')](_0x3aa58b[_0x302b('0x59')]):_0x302b('0x6b'));return respondWithRpcPromise(_0x302b('0x6c'),_0x302b('0x6d'),_0x44aae0);}return null;})['then'](function(_0x2aa7a0){var _0x5baf2a=_0x302b('0x6e')+_0x2aa7a0['message'][_0x302b('0x6f')];return db[_0x302b('0x70')][_0x302b('0x3e')](_0x5baf2a,{'type':db[_0x302b('0x71')][_0x302b('0x72')]['SELECT'],'raw':!![]})[_0x302b('0x34')](function(_0x234f04){return _0x234f04;});})[_0x302b('0x34')](function(_0x3c3cd4){if(_0x3c3cd4){_0x44aae0['message'][_0x302b('0x73')]=_0x3c3cd4[0x0];if(!_0x3aa58b[_0x302b('0x59')][_0x302b('0x61')])return;return db['User'][_0x302b('0x57')]({'where':{'id':_0x3aa58b[_0x302b('0x59')]['UserId'],'role':_0x302b('0x62')},'attributes':['id','name',_0x302b('0x74'),'email','internal'],'raw':!![]});}return null;})[_0x302b('0x34')](function(_0x5bf06c){if(!_0x5bf06c)return null;_0x44aae0[_0x302b('0x28')][_0x302b('0x62')]=_0x5bf06c;return _0x44aae0;})[_0x302b('0x34')](function(_0x343c3f){if(_0x343c3f){if(_0x3aa58b['body'][_0x302b('0x75')]){_0x44aae0[_0x302b('0x28')]['interface']=util['format'](_0x302b('0x76'),_0x3aa58b[_0x302b('0x6a')][_0x302b('0x36')]);_0x44aae0[_0x302b('0x28')][_0x302b('0x77')]=_0x44aae0['channel'];_0x44aae0[_0x302b('0x28')]['motionChannel']=_0x44aae0[_0x302b('0x77')];_0x44aae0['message'][_0x302b('0x78')]=_0x302b('0x79');return respondWithRpcPromise('EventManager',_0x302b('0x7a'),{'event':_0x302b('0x7b'),'message':_0x44aae0[_0x302b('0x28')]},client9002)[_0x302b('0x34')](function(){return _0x44aae0;});}return _0x44aae0;}return null;})[_0x302b('0x34')](respondWithResult(_0x5bb4fd,null))[_0x302b('0x53')](handleError(_0x5bb4fd,null));};var interaction_log=require('../../config/logger')(_0x302b('0x5c'));exports[_0x302b('0x33')]=function(_0x16b3f4,_0xf7a426,_0x3521c6){var _0xe1bf75={'agent':{},'channel':_0x302b('0x5d')};if(_0x16b3f4['body']['id']){delete _0x16b3f4[_0x302b('0x59')]['id'];}_0x16b3f4[_0x302b('0x59')][_0x302b('0x61')]=_0x16b3f4['body'][_0x302b('0x61')]||_0x16b3f4[_0x302b('0x6a')]['id'];_0xe1bf75['agent']['id']=_0x16b3f4[_0x302b('0x59')]['UserId'];return db[_0x302b('0x4e')][_0x302b('0x57')]({'where':{'id':_0x16b3f4[_0x302b('0x55')]['id'],'UserId':null}})[_0x302b('0x34')](handleEntityNotFound(_0xf7a426,null))['then'](function(_0x393341){if(_0x393341){_0xe1bf75[_0x302b('0x28')]=_0x393341[_0x302b('0x63')]({'plain':!![]});return db[_0x302b('0x64')][_0x302b('0x57')]({'where':{'id':_0x393341[_0x302b('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xf7a426,null))['then'](function(_0x215de5){if(_0x215de5){_0xe1bf75['interaction']=_0x215de5[_0x302b('0x63')]({'plain':!![]});interaction_log[_0x302b('0x29')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x16b3f4[_0x302b('0x6a')]['id'],_0x16b3f4[_0x302b('0x6a')][_0x302b('0x36')],_0x16b3f4[_0x302b('0x6a')][_0x302b('0x7c')],_0xe1bf75[_0x302b('0x68')]['id'],_0x16b3f4['body']?JSON[_0x302b('0x25')](_0x16b3f4[_0x302b('0x59')]):_0x302b('0x6b'));return respondWithRpcPromise(_0x302b('0x7d'),_0x302b('0x7e'),_0xe1bf75);}return null;})[_0x302b('0x34')](function(_0x227abd){var _0x4ada8a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x227abd[_0x302b('0x28')][_0x302b('0x6f')];return db[_0x302b('0x70')][_0x302b('0x3e')](_0x4ada8a,{'type':db[_0x302b('0x71')][_0x302b('0x72')][_0x302b('0x7f')],'raw':!![]})[_0x302b('0x34')](function(_0x572cff){return _0x572cff;});})[_0x302b('0x34')](function(_0x27db0f){if(_0x27db0f){_0xe1bf75[_0x302b('0x28')][_0x302b('0x73')]=_0x27db0f[0x0];if(!_0x16b3f4['body'][_0x302b('0x61')])return;return db[_0x302b('0x80')]['find']({'where':{'id':_0x16b3f4[_0x302b('0x59')][_0x302b('0x61')],'role':'agent'},'attributes':['id',_0x302b('0x36'),'fullname','email',_0x302b('0x81')],'raw':!![]});}return null;})[_0x302b('0x34')](function(_0x258ad3){if(!_0x258ad3)return null;_0xe1bf75[_0x302b('0x28')][_0x302b('0x62')]=_0x258ad3;return _0xe1bf75;})[_0x302b('0x34')](function(_0xaeb8c){if(_0xaeb8c){_0xaeb8c[_0x302b('0x28')][_0x302b('0x82')]=util[_0x302b('0x5f')](_0x302b('0x76'),_0x16b3f4[_0x302b('0x6a')][_0x302b('0x36')]);_0xaeb8c['message'][_0x302b('0x77')]=_0xe1bf75['channel'];_0xaeb8c[_0x302b('0x28')][_0x302b('0x83')]=_0xe1bf75[_0x302b('0x77')];_0xaeb8c['message'][_0x302b('0x78')]=_0x302b('0x33');respondWithRpcPromise(_0x302b('0x7a'),_0x302b('0x7a'),{'event':_0x302b('0x84'),'message':_0xaeb8c['message']},client9002);return _0xe1bf75;}return null;})[_0x302b('0x34')](respondWithResult(_0xf7a426,null))[_0x302b('0x53')](handleError(_0xf7a426,null));};exports[_0x302b('0x2c')]=function(_0x4785cc,_0x114153,_0x1c63d7){if(_0x4785cc['body']['id']){delete _0x4785cc[_0x302b('0x59')]['id'];}var _0x4ec501;return db[_0x302b('0x4e')][_0x302b('0x57')]({'where':{'id':_0x4785cc['params']['id']}})[_0x302b('0x34')](handleEntityNotFound(_0x114153,null))['then'](function(_0x34a174){if(_0x34a174){_0x4ec501=_0x34a174;return db[_0x302b('0x85')]['find']({'where':{'id':_0x34a174[_0x302b('0x86')]}});}})[_0x302b('0x34')](handleEntityNotFound(_0x114153,null))['then'](function(_0xd15c58){if(_0xd15c58){logger[_0x302b('0x24')](_0x302b('0x87'),_0x302b('0x2c'),'received\x20delivery\x20report\x20from',_0xd15c58[_0x302b('0x88')],util[_0x302b('0x89')](_0x4785cc[_0x302b('0x59')],{'showHidden':![],'depth':null}));switch(_0xd15c58[_0x302b('0x88')]){case _0x302b('0x8a'):if(_0x4785cc[_0x302b('0x59')][_0x302b('0x8b')]&&_0x4785cc[_0x302b('0x59')]['MessageSid']===_0x4ec501[_0x302b('0x8c')]&&_0x4785cc[_0x302b('0x59')][_0x302b('0x8d')]&&_0x4785cc[_0x302b('0x59')]['MessageStatus']===_0x302b('0x5e')){return _0x4ec501[_0x302b('0x5a')]({'read':!![]});}else{logger[_0x302b('0x26')](_0x302b('0x8e'),'status',_0x302b('0x8a'),util[_0x302b('0x89')](_0x4785cc['body'],{'showHidden':![],'depth':null}));}break;}return _0x4ec501;}})[_0x302b('0x34')](respondWithResult(_0x114153,null))['catch'](handleError(_0x114153,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index de7deec..caee8f6 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 _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1d5d3f,_0x3a9d08){var _0x6f9221=function(_0x1e9b5d){while(--_0x1e9b5d){_0x1d5d3f['push'](_0x1d5d3f['shift']());}};_0x6f9221(++_0x3a9d08);}(_0x750a,0x140));var _0xa750=function(_0x2acd19,_0x168295){_0x2acd19=_0x2acd19-0x0;var _0x2b37c2=_0x750a[_0x2acd19];return _0x2b37c2;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xa750('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){WhatsappMessageEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);WhatsappMessageEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];WhatsappMessage[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x6cb4=['update','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x36a87e,_0x2b4407){var _0x24749f=function(_0x532f26){while(--_0x532f26){_0x36a87e['push'](_0x36a87e['shift']());}};_0x24749f(++_0x2b4407);}(_0x6cb4,0xff));var _0x46cb=function(_0x195709,_0x3db14b){_0x195709=_0x195709-0x0;var _0x5008f8=_0x6cb4[_0x195709];return _0x5008f8;};'use strict';var EventEmitter=require(_0x46cb('0x0'));var WhatsappMessage=require(_0x46cb('0x1'))['db'][_0x46cb('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x46cb('0x3')](0x0);var events={'afterCreate':_0x46cb('0x4'),'afterUpdate':_0x46cb('0x5'),'afterDestroy':_0x46cb('0x6')};function emitEvent(_0x786ab7){return function(_0x2efd19,_0x5032a4,_0x1a3fe4){WhatsappMessageEvents['emit'](_0x786ab7+':'+_0x2efd19['id'],_0x2efd19);WhatsappMessageEvents[_0x46cb('0x7')](_0x786ab7,_0x2efd19);_0x1a3fe4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x46cb('0x8')](e,emitEvent(event));}}module[_0x46cb('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 7f51516..a23b5f1 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 _0xafab=['remote','/api/whatsapp/messages/','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','moment','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','update','catch','out','find','WhatsappAccountId','then','type','twilio','accountSid','phone','authToken','create','whatsapp:'];(function(_0x1283ad,_0x33c0e0){var _0x12afe0=function(_0x231e75){while(--_0x231e75){_0x1283ad['push'](_0x1283ad['shift']());}};_0x12afe0(++_0x33c0e0);}(_0xafab,0x122));var _0xbafa=function(_0x39119a,_0x16fb90){_0x39119a=_0x39119a-0x0;var _0x3e7f4a=_0xafab[_0x39119a];return _0x3e7f4a;};'use strict';var _=require(_0xbafa('0x0'));var util=require(_0xbafa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbafa('0x2'));var BPromise=require('bluebird');var rp=require(_0xbafa('0x3'));var fetch=require(_0xbafa('0x4'));var fs=require('fs');var path=require(_0xbafa('0x5'));var rimraf=require(_0xbafa('0x6'));var config=require('../../config/environment');var attributes=require(_0xbafa('0x7'));module[_0xbafa('0x8')]=function(_0x3d22dc,_0x2d888f){return _0x3d22dc[_0xbafa('0x9')](_0xbafa('0xa'),attributes,{'tableName':_0xbafa('0xb'),'paranoid':![],'indexes':[{'name':_0xbafa('0xc'),'fields':[_0xbafa('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0xbafa('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1606e7,_0x450805,_0x536715){var _0x432b9b=_0x3d22dc['models'];var _0x41e401=_0x1606e7[_0xbafa('0xe')]({'plain':!![]});if(_0x41e401[_0xbafa('0xf')][_0xbafa('0x10')]()==='in'||_0x41e401[_0xbafa('0xf')][_0xbafa('0x10')]()==='out'&&!_0x41e401[_0xbafa('0x11')]&&!_[_0xbafa('0x12')](_0x41e401[_0xbafa('0x13')])){_0x432b9b[_0xbafa('0x14')]['findOne']({'where':{'id':_0x41e401['WhatsappInteractionId']}})['then'](function(_0x2fd041){if(_0x2fd041){_0x2fd041[_0xbafa('0x15')]({'lastMsgAt':_0x41e401['createdAt'],'lastMsgDirection':_0x41e401[_0xbafa('0xf')][_0xbafa('0x10')]()});}})[_0xbafa('0x16')](function(_0x2bab58){console['error'](_0x2bab58);});}if(_0x41e401[_0xbafa('0xf')]===_0xbafa('0x17')&&!_0x41e401[_0xbafa('0x11')]){var _0x95ef48;_0x432b9b['WhatsappAccount'][_0xbafa('0x18')]({'where':{'id':_0x41e401[_0xbafa('0x19')]},'raw':!![]})[_0xbafa('0x1a')](function(_0x22807d){_0x95ef48=_0x22807d;if(_0x95ef48&&_0x95ef48[_0xbafa('0x1b')]){switch(_0x95ef48[_0xbafa('0x1b')]){case _0xbafa('0x1c'):var _0xa15b23=require(_0xbafa('0x1c'));if(_0x95ef48[_0xbafa('0x1d')]&&_0x95ef48['authToken']&&_0x95ef48[_0xbafa('0x1e')]){var _0x10012f=new _0xa15b23(_0x95ef48[_0xbafa('0x1d')],_0x95ef48[_0xbafa('0x1f')]);_0x10012f['messages'][_0xbafa('0x20')]({'body':_0x41e401[_0xbafa('0xd')],'to':_0xbafa('0x21')+_0x41e401[_0xbafa('0x1e')],'from':'whatsapp:'+_0x95ef48[_0xbafa('0x1e')],'statusCallback':_0x95ef48[_0xbafa('0x22')]+_0xbafa('0x23')+_0x41e401['id']+'/status?token='+_0x95ef48[_0xbafa('0x24')]})[_0xbafa('0x1a')](function(_0x48ca78){if(_0x48ca78[_0xbafa('0x25')]){return _0x1606e7[_0xbafa('0x15')]({'messageId':_0x48ca78['sid']});}})['catch'](function(_0x530682){logger[_0xbafa('0x26')](_0xbafa('0x27'),_0xbafa('0x28'),'twilio',util[_0xbafa('0x29')](_0x530682,{'showHidden':![],'depth':null}));});}else{logger[_0xbafa('0x26')](_0xbafa('0x27'),_0xbafa('0x28'),_0xbafa('0x1c'),_0xbafa('0x2a'));}break;case'sinch':var _0x4d45a8=_0x95ef48[_0xbafa('0x1d')];var _0x1cc5ff=_0x95ef48['authToken'];var _0x4b3e24=_0x95ef48['baseUrl']+_0xbafa('0x2b')+_0x4d45a8+_0xbafa('0x2c');var _0x45e62e={'to':[_0x41e401[_0xbafa('0x1e')]],'message':{'type':_0xbafa('0x2d'),'text':_0x41e401[_0xbafa('0xd')]}};var _0x2b60a5={'method':_0xbafa('0x2e'),'uri':_0x4b3e24,'headers':{'Authorization':_0xbafa('0x2f')+_0x1cc5ff,'Content-Type':_0xbafa('0x30')},'body':_0x45e62e,'json':!![]};rp(_0x2b60a5)[_0xbafa('0x1a')](function(_0xabf2ca){if(_0xabf2ca['statuses'][0x0][_0xbafa('0x31')]){return _0x1606e7['update']({'messageId':_0xabf2ca['statuses'][0x0][_0xbafa('0x31')]});}})[_0xbafa('0x16')](function(_0x2d887c){logger[_0xbafa('0x32')](_0xbafa('0x33'),_0x2d887c);});break;}}})[_0xbafa('0x34')](function(){_0x536715();});}else{_0x536715();}}},'charset':_0xbafa('0x35'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf462=['message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','../../config/logger','api','bluebird','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','body','POST','statuses'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf462,0xb9));var _0x2f46=function(_0x2ffc46,_0x35ce3c){_0x2ffc46=_0x2ffc46-0x0;var _0x1eda8f=_0xf462[_0x2ffc46];return _0x1eda8f;};'use strict';var _=require(_0x2f46('0x0'));var util=require('util');var logger=require(_0x2f46('0x1'))(_0x2f46('0x2'));var moment=require('moment');var BPromise=require(_0x2f46('0x3'));var rp=require('request-promise');var fetch=require(_0x2f46('0x4'));var fs=require('fs');var path=require(_0x2f46('0x5'));var rimraf=require(_0x2f46('0x6'));var config=require(_0x2f46('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x2f46('0x8')]=function(_0x11a386,_0x425fe5){return _0x11a386[_0x2f46('0x9')](_0x2f46('0xa'),attributes,{'tableName':_0x2f46('0xb'),'paranoid':![],'indexes':[{'name':_0x2f46('0xc'),'fields':[_0x2f46('0xc')]},{'name':_0x2f46('0xd'),'fields':['body'],'type':_0x2f46('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18369a,_0x3d4bcf,_0x450be0){var _0x4663be=_0x11a386['models'];var _0x418d64=_0x18369a[_0x2f46('0xf')]({'plain':!![]});if(_0x418d64[_0x2f46('0x10')][_0x2f46('0x11')]()==='in'||_0x418d64['direction'][_0x2f46('0x11')]()===_0x2f46('0x12')&&!_0x418d64['secret']&&!_[_0x2f46('0x13')](_0x418d64[_0x2f46('0x14')])){_0x4663be[_0x2f46('0x15')][_0x2f46('0x16')]({'where':{'id':_0x418d64[_0x2f46('0x17')]}})[_0x2f46('0x18')](function(_0x5f8899){if(_0x5f8899){_0x5f8899[_0x2f46('0x19')]({'lastMsgAt':_0x418d64[_0x2f46('0x1a')],'lastMsgDirection':_0x418d64[_0x2f46('0x10')][_0x2f46('0x11')]()});}})[_0x2f46('0x1b')](function(_0x4974f6){console[_0x2f46('0x1c')](_0x4974f6);});}if(_0x418d64[_0x2f46('0x10')]===_0x2f46('0x12')&&!_0x418d64[_0x2f46('0x1d')]){var _0x1bd70a;_0x4663be[_0x2f46('0x1e')][_0x2f46('0x1f')]({'where':{'id':_0x418d64[_0x2f46('0x20')]},'raw':!![]})[_0x2f46('0x18')](function(_0xff1448){_0x1bd70a=_0xff1448;if(_0x1bd70a&&_0x1bd70a[_0x2f46('0x21')]){switch(_0x1bd70a[_0x2f46('0x21')]){case'twilio':var _0x28beec=require(_0x2f46('0x22'));if(_0x1bd70a[_0x2f46('0x23')]&&_0x1bd70a[_0x2f46('0x24')]&&_0x1bd70a['phone']){var _0x50c666=new _0x28beec(_0x1bd70a[_0x2f46('0x23')],_0x1bd70a[_0x2f46('0x24')]);_0x50c666['messages'][_0x2f46('0x25')]({'body':_0x418d64['body'],'to':_0x2f46('0x26')+_0x418d64[_0x2f46('0x27')],'from':_0x2f46('0x26')+_0x1bd70a['phone'],'statusCallback':_0x1bd70a[_0x2f46('0x28')]+_0x2f46('0x29')+_0x418d64['id']+_0x2f46('0x2a')+_0x1bd70a[_0x2f46('0x2b')]})[_0x2f46('0x18')](function(_0x22fbb6){if(_0x22fbb6['sid']){return _0x18369a[_0x2f46('0x19')]({'messageId':_0x22fbb6['sid']});}})[_0x2f46('0x1b')](function(_0x4009a9){logger['error'](_0x2f46('0x2c'),_0x2f46('0x2d'),_0x2f46('0x22'),util[_0x2f46('0x2e')](_0x4009a9,{'showHidden':![],'depth':null}));});}else{logger[_0x2f46('0x1c')](_0x2f46('0x2c'),'afterCreate',_0x2f46('0x22'),_0x2f46('0x2f'));}break;case _0x2f46('0x30'):var _0x53fa54=_0x1bd70a['accountSid'];var _0xbdf362=_0x1bd70a[_0x2f46('0x24')];var _0x2f4003=_0x1bd70a[_0x2f46('0x31')]+_0x2f46('0x32')+_0x53fa54+_0x2f46('0x33');var _0x27ea04={'to':[_0x418d64[_0x2f46('0x27')]],'message':{'type':'text','text':_0x418d64[_0x2f46('0x34')]}};var _0x28cd8f={'method':_0x2f46('0x35'),'uri':_0x2f4003,'headers':{'Authorization':'Bearer\x20'+_0xbdf362,'Content-Type':'application/json'},'body':_0x27ea04,'json':!![]};rp(_0x28cd8f)[_0x2f46('0x18')](function(_0x572c72){if(_0x572c72[_0x2f46('0x36')][0x0]['message_id']){return _0x18369a[_0x2f46('0x19')]({'messageId':_0x572c72[_0x2f46('0x36')][0x0][_0x2f46('0x37')]});}})[_0x2f46('0x1b')](function(_0x3c09c8){logger[_0x2f46('0x38')](_0x2f46('0x39'),_0x3c09c8);});break;}}})[_0x2f46('0x3a')](function(){_0x450be0();});}else{_0x450be0();}}},'charset':_0x2f46('0x3b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 7c7b142..f8685cd 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 _0xcc47=['code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','options','raw','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1178df,_0x574475){var _0x16a36b=function(_0x41de11){while(--_0x41de11){_0x1178df['push'](_0x1178df['shift']());}};_0x16a36b(++_0x574475);}(_0xcc47,0x9e));var _0x7cc4=function(_0x4c8313,_0x402830){_0x4c8313=_0x4c8313-0x0;var _0x4900c6=_0xcc47[_0x4c8313];return _0x4900c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7cc4('0x0'));var BPromise=require('bluebird');var rs=require(_0x7cc4('0x1'));var fs=require('fs');var Redis=require(_0x7cc4('0x2'));var db=require(_0x7cc4('0x3'))['db'];var utils=require(_0x7cc4('0x4'));var logger=require('../../config/logger')(_0x7cc4('0x5'));var config=require(_0x7cc4('0x6'));var jayson=require(_0x7cc4('0x7'));var client=jayson[_0x7cc4('0x8')][_0x7cc4('0x9')]({'port':0x232a});config['redis']=_[_0x7cc4('0xa')](config[_0x7cc4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cc4('0xc'))(new Redis(config[_0x7cc4('0xb')]));require(_0x7cc4('0xd'))['register'](socket);function respondWithRpcPromise(_0x3af1d5,_0x34d8ca,_0x1b18ae){return new BPromise(function(_0x118ffa,_0x3c8053){return client[_0x7cc4('0xe')](_0x3af1d5,_0x1b18ae)['then'](function(_0x53fef3){logger[_0x7cc4('0xf')](_0x7cc4('0x10'),_0x34d8ca,_0x7cc4('0x11'));logger[_0x7cc4('0x12')](_0x7cc4('0x13'),_0x34d8ca,_0x7cc4('0x11'),JSON[_0x7cc4('0x14')](_0x53fef3));if(_0x53fef3[_0x7cc4('0x15')]){if(_0x53fef3['error'][_0x7cc4('0x16')]===0x1f4){logger[_0x7cc4('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x34d8ca,_0x53fef3['error'][_0x7cc4('0x17')]);return _0x3c8053(_0x53fef3[_0x7cc4('0x15')][_0x7cc4('0x17')]);}logger[_0x7cc4('0x15')](_0x7cc4('0x10'),_0x34d8ca,_0x53fef3[_0x7cc4('0x15')]['message']);return _0x118ffa(_0x53fef3[_0x7cc4('0x15')][_0x7cc4('0x17')]);}else{logger[_0x7cc4('0xf')](_0x7cc4('0x10'),_0x34d8ca,'request\x20sent');_0x118ffa(_0x53fef3[_0x7cc4('0x18')][_0x7cc4('0x17')]);}})[_0x7cc4('0x19')](function(_0xd3a536){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x34d8ca,_0xd3a536);_0x3c8053(_0xd3a536);});});}exports[_0x7cc4('0x1a')]=function(_0x4b9b34){var _0x20318a=this;return new Promise(function(_0x142daf,_0x4b5749){return db[_0x7cc4('0x1b')]['create'](_0x4b9b34['body'],{'raw':_0x4b9b34[_0x7cc4('0x1c')]?_0x4b9b34[_0x7cc4('0x1c')][_0x7cc4('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x26fc30){logger[_0x7cc4('0xf')](_0x7cc4('0x1a'),_0x4b9b34);logger[_0x7cc4('0x12')](_0x7cc4('0x1a'),_0x4b9b34,JSON[_0x7cc4('0x14')](_0x26fc30));_0x142daf(_0x26fc30);})[_0x7cc4('0x19')](function(_0x41bd51){logger[_0x7cc4('0x15')](_0x7cc4('0x1a'),_0x41bd51[_0x7cc4('0x17')],_0x4b9b34);_0x4b5749(_0x20318a[_0x7cc4('0x15')](0x1f4,_0x41bd51[_0x7cc4('0x17')]));});});}; \ No newline at end of file +var _0xdf59=['register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket'];(function(_0x5624b4,_0x331827){var _0x5be5dc=function(_0x3d4315){while(--_0x3d4315){_0x5624b4['push'](_0x5624b4['shift']());}};_0x5be5dc(++_0x331827);}(_0xdf59,0x9f));var _0x9df5=function(_0x418474,_0x153d88){_0x418474=_0x418474-0x0;var _0xdb4685=_0xdf59[_0x418474];return _0xdb4685;};'use strict';var _=require(_0x9df5('0x0'));var util=require(_0x9df5('0x1'));var moment=require(_0x9df5('0x2'));var BPromise=require('bluebird');var rs=require(_0x9df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9df5('0x4'))['db'];var utils=require(_0x9df5('0x5'));var logger=require('../../config/logger')(_0x9df5('0x6'));var config=require(_0x9df5('0x7'));var jayson=require(_0x9df5('0x8'));var client=jayson[_0x9df5('0x9')][_0x9df5('0xa')]({'port':0x232a});config[_0x9df5('0xb')]=_[_0x9df5('0xc')](config[_0x9df5('0xb')],{'host':_0x9df5('0xd'),'port':0x18eb});var socket=require(_0x9df5('0xe'))(new Redis(config[_0x9df5('0xb')]));require(_0x9df5('0xf'))[_0x9df5('0x10')](socket);function respondWithRpcPromise(_0x148d30,_0x121f0d,_0x3cb16b){return new BPromise(function(_0x46d1a0,_0x3f218f){return client[_0x9df5('0x11')](_0x148d30,_0x3cb16b)[_0x9df5('0x12')](function(_0x3fc407){logger[_0x9df5('0x13')](_0x9df5('0x14'),_0x121f0d,_0x9df5('0x15'));logger[_0x9df5('0x16')](_0x9df5('0x17'),_0x121f0d,_0x9df5('0x15'),JSON['stringify'](_0x3fc407));if(_0x3fc407[_0x9df5('0x18')]){if(_0x3fc407[_0x9df5('0x18')]['code']===0x1f4){logger[_0x9df5('0x18')](_0x9df5('0x14'),_0x121f0d,_0x3fc407[_0x9df5('0x18')][_0x9df5('0x19')]);return _0x3f218f(_0x3fc407['error']['message']);}logger[_0x9df5('0x18')](_0x9df5('0x14'),_0x121f0d,_0x3fc407['error'][_0x9df5('0x19')]);return _0x46d1a0(_0x3fc407['error'][_0x9df5('0x19')]);}else{logger[_0x9df5('0x13')](_0x9df5('0x14'),_0x121f0d,'request\x20sent');_0x46d1a0(_0x3fc407[_0x9df5('0x1a')][_0x9df5('0x19')]);}})[_0x9df5('0x1b')](function(_0x46b5ef){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x121f0d,_0x46b5ef);_0x3f218f(_0x46b5ef);});});}exports[_0x9df5('0x1c')]=function(_0x3eafed){var _0x104308=this;return new Promise(function(_0x14ab2a,_0x57fb5b){return db[_0x9df5('0x1d')][_0x9df5('0x1e')](_0x3eafed[_0x9df5('0x1f')],{'raw':_0x3eafed[_0x9df5('0x20')]?_0x3eafed[_0x9df5('0x20')][_0x9df5('0x21')]===undefined?!![]:![]:!![]})[_0x9df5('0x12')](function(_0x2f1770){logger['info']('CreateWhatsappMessage',_0x3eafed);logger[_0x9df5('0x16')]('CreateWhatsappMessage',_0x3eafed,JSON[_0x9df5('0x22')](_0x2f1770));_0x14ab2a(_0x2f1770);})[_0x9df5('0x1b')](function(_0x47b2e4){logger[_0x9df5('0x18')](_0x9df5('0x1c'),_0x47b2e4[_0x9df5('0x19')],_0x3eafed);_0x57fb5b(_0x104308[_0x9df5('0x18')](0x1f4,_0x47b2e4[_0x9df5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e24d676..2efab68 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 _0xc3a2=['length','remove','emit','register'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0xc3a2,0xb1));var _0x2c3a=function(_0x3a72c0,_0x2ccf6a){_0x3a72c0=_0x3a72c0-0x0;var _0x451671=_0xc3a2[_0x3a72c0];return _0x451671;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x2c3a('0x0'),'update'];function createListener(_0x30dd52,_0x2128fd){return function(_0x4e47d6){_0x2128fd[_0x2c3a('0x1')](_0x30dd52,_0x4e47d6);};}function removeListener(_0x55bc95,_0x5b7fa0){return function(){WhatsappMessageEvents['removeListener'](_0x55bc95,_0x5b7fa0);};}exports[_0x2c3a('0x2')]=function(_0x5ea622){for(var _0x49c028=0x0,_0x1a64b2=events[_0x2c3a('0x3')];_0x49c028<_0x1a64b2;_0x49c028++){var _0x47121f=events[_0x49c028];var _0x29f305=createListener('whatsappMessage:'+_0x47121f,_0x5ea622);WhatsappMessageEvents['on'](_0x47121f,_0x29f305);}}; \ No newline at end of file +var _0xc96f=['removeListener','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x1037a6,_0x3667ce){var _0x589c1c=function(_0x35811e){while(--_0x35811e){_0x1037a6['push'](_0x1037a6['shift']());}};_0x589c1c(++_0x3667ce);}(_0xc96f,0x17e));var _0xfc96=function(_0x7105e,_0x2e0ade){_0x7105e=_0x7105e-0x0;var _0x167962=_0xc96f[_0x7105e];return _0x167962;};'use strict';var WhatsappMessageEvents=require(_0xfc96('0x0'));var events=[_0xfc96('0x1'),_0xfc96('0x2'),'update'];function createListener(_0x5808ef,_0x10a7a0){return function(_0x489bf8){_0x10a7a0['emit'](_0x5808ef,_0x489bf8);};}function removeListener(_0xfaa62a,_0x3fe383){return function(){WhatsappMessageEvents[_0xfc96('0x3')](_0xfaa62a,_0x3fe383);};}exports['register']=function(_0x488e1c){for(var _0x1e7eaa=0x0,_0x206089=events['length'];_0x1e7eaa<_0x206089;_0x1e7eaa++){var _0x3dfecc=events[_0x1e7eaa];var _0xdf98bd=createListener(_0xfc96('0x4')+_0x3dfecc,_0x488e1c);WhatsappMessageEvents['on'](_0x3dfecc,_0xdf98bd);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 049a269..0d9ab71 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 _0xa2d2=['removeTeams','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/users','getAgents','post','create','/:id/teams','addAgents','update','delete'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xa2d2,0x16e));var _0x2a2d=function(_0x1ee6fd,_0x2a8151){_0x1ee6fd=_0x1ee6fd-0x0;var _0x4c27ee=_0xa2d2[_0x1ee6fd];return _0x4c27ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2a2d('0x0'));var timeout=require(_0x2a2d('0x1'));var express=require(_0x2a2d('0x2'));var router=express[_0x2a2d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2a2d('0x4'));var interaction=require(_0x2a2d('0x5'));var config=require(_0x2a2d('0x6'));var controller=require(_0x2a2d('0x7'));router[_0x2a2d('0x8')]('/',auth[_0x2a2d('0x9')](),controller[_0x2a2d('0xa')]);router[_0x2a2d('0x8')](_0x2a2d('0xb'),auth['isAuthenticated'](),controller[_0x2a2d('0xc')]);router[_0x2a2d('0x8')](_0x2a2d('0xd'),auth[_0x2a2d('0x9')](),controller['show']);router[_0x2a2d('0x8')](_0x2a2d('0xe'),auth[_0x2a2d('0x9')](),controller[_0x2a2d('0xf')]);router[_0x2a2d('0x8')]('/:id/teams',auth[_0x2a2d('0x9')](),controller['getTeams']);router[_0x2a2d('0x8')](_0x2a2d('0x10'),auth['isAuthenticated'](),controller[_0x2a2d('0x11')]);router[_0x2a2d('0x12')]('/',auth['isAuthenticated'](),controller[_0x2a2d('0x13')]);router[_0x2a2d('0x12')](_0x2a2d('0x14'),auth['isAuthenticated'](),controller['addTeams']);router[_0x2a2d('0x12')]('/:id/users',auth[_0x2a2d('0x9')](),controller[_0x2a2d('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2a2d('0x16')]);router[_0x2a2d('0x17')](_0x2a2d('0xd'),auth[_0x2a2d('0x9')](),controller['destroy']);router[_0x2a2d('0x17')](_0x2a2d('0x14'),auth[_0x2a2d('0x9')](),controller[_0x2a2d('0x18')]);router[_0x2a2d('0x17')](_0x2a2d('0x10'),auth[_0x2a2d('0x9')](),controller[_0x2a2d('0x19')]);module['exports']=router; \ No newline at end of file +var _0x3d9a=['getTeams','/:id/users','getAgents','post','create','addAgents','put','/:id','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/members','/:id/teams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d9a,0x11a));var _0xa3d9=function(_0x1d59d,_0x53eba5){_0x1d59d=_0x1d59d-0x0;var _0x5b5036=_0x3d9a[_0x1d59d];return _0x5b5036;};'use strict';var multer=require(_0xa3d9('0x0'));var util=require(_0xa3d9('0x1'));var path=require('path');var timeout=require(_0xa3d9('0x2'));var express=require(_0xa3d9('0x3'));var router=express[_0xa3d9('0x4')]();var fs_extra=require(_0xa3d9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa3d9('0x6'));var config=require(_0xa3d9('0x7'));var controller=require('./whatsappQueue.controller');router[_0xa3d9('0x8')]('/',auth[_0xa3d9('0x9')](),controller[_0xa3d9('0xa')]);router[_0xa3d9('0x8')]('/describe',auth[_0xa3d9('0x9')](),controller[_0xa3d9('0xb')]);router['get']('/:id',auth[_0xa3d9('0x9')](),controller[_0xa3d9('0xc')]);router[_0xa3d9('0x8')](_0xa3d9('0xd'),auth[_0xa3d9('0x9')](),controller['getMembers']);router[_0xa3d9('0x8')](_0xa3d9('0xe'),auth[_0xa3d9('0x9')](),controller[_0xa3d9('0xf')]);router[_0xa3d9('0x8')](_0xa3d9('0x10'),auth[_0xa3d9('0x9')](),controller[_0xa3d9('0x11')]);router[_0xa3d9('0x12')]('/',auth[_0xa3d9('0x9')](),controller[_0xa3d9('0x13')]);router[_0xa3d9('0x12')]('/:id/teams',auth[_0xa3d9('0x9')](),controller['addTeams']);router[_0xa3d9('0x12')]('/:id/users',auth[_0xa3d9('0x9')](),controller[_0xa3d9('0x14')]);router[_0xa3d9('0x15')](_0xa3d9('0x16'),auth[_0xa3d9('0x9')](),controller['update']);router[_0xa3d9('0x17')]('/:id',auth[_0xa3d9('0x9')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xa3d9('0x9')](),controller[_0xa3d9('0x18')]);router['delete'](_0xa3d9('0x10'),auth[_0xa3d9('0x9')](),controller[_0xa3d9('0x19')]);module[_0xa3d9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d07a7cd..7ea5c40 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 _0x9585=['INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING','exports','name'];(function(_0x4661bc,_0x56eda){var _0x4b2027=function(_0x4f9dc0){while(--_0x4f9dc0){_0x4661bc['push'](_0x4661bc['shift']());}};_0x4b2027(++_0x56eda);}(_0x9585,0x15e));var _0x5958=function(_0x1c79a3,_0x3a8748){_0x1c79a3=_0x1c79a3-0x0;var _0x2768bf=_0x9585[_0x1c79a3];return _0x2768bf;};'use strict';var Sequelize=require('sequelize');module[_0x5958('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5958('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5958('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5958('0x3')](_0x5958('0x4'),_0x5958('0x5'),_0x5958('0x6'))},'description':{'type':Sequelize[_0x5958('0x7')]}}; \ No newline at end of file +var _0x9879=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0xd3e43a,_0x1f1bd8){var _0x20f3e9=function(_0x392c6d){while(--_0x392c6d){_0xd3e43a['push'](_0xd3e43a['shift']());}};_0x20f3e9(++_0x1f1bd8);}(_0x9879,0x98));var _0x9987=function(_0x40bd2f,_0x4bf10d){_0x40bd2f=_0x40bd2f-0x0;var _0x2f4be4=_0x9879[_0x40bd2f];return _0x2f4be4;};'use strict';var Sequelize=require('sequelize');module[_0x9987('0x0')]={'name':{'type':Sequelize[_0x9987('0x1')],'unique':_0x9987('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9987('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9987('0x4')](_0x9987('0x5'),_0x9987('0x6'),_0x9987('0x7'))},'description':{'type':Sequelize[_0x9987('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 54e8cae..d1b0ee9 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 _0x9be7=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','destroy','then','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappQueue','includeAll','include','findAll','rows','params','keys','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','WhatsappQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','WhatsappQueueId','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','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','QueryTypes','every','all','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis'];(function(_0x3e7dcf,_0x818fa1){var _0x299f64=function(_0x404a34){while(--_0x404a34){_0x3e7dcf['push'](_0x3e7dcf['shift']());}};_0x299f64(++_0x818fa1);}(_0x9be7,0x7b));var _0x79be=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x9be7[_0x378720];return _0x47920a;};'use strict';var emlformat=require(_0x79be('0x0'));var rimraf=require(_0x79be('0x1'));var zipdir=require(_0x79be('0x2'));var jsonpatch=require(_0x79be('0x3'));var rp=require('request-promise');var moment=require(_0x79be('0x4'));var BPromise=require(_0x79be('0x5'));var Mustache=require(_0x79be('0x6'));var util=require(_0x79be('0x7'));var path=require(_0x79be('0x8'));var sox=require('sox');var csv=require(_0x79be('0x9'));var ejs=require(_0x79be('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x79be('0xb'));var squel=require('squel');var crypto=require(_0x79be('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x79be('0x9'));var querystring=require(_0x79be('0xd'));var Papa=require(_0x79be('0xe'));var Redis=require(_0x79be('0xf'));var authService=require(_0x79be('0x10'));var qs=require(_0x79be('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79be('0x12'));var logger=require(_0x79be('0x13'))(_0x79be('0x14'));var utils=require(_0x79be('0x15'));var config=require(_0x79be('0x16'));var licenseUtil=require(_0x79be('0x17'));var db=require(_0x79be('0x18'))['db'];config[_0x79be('0x19')]=_[_0x79be('0x1a')](config[_0x79be('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x79be('0x1b'))(new Redis(config[_0x79be('0x19')]));require('./whatsappQueue.socket')[_0x79be('0x1c')](socket);function respondWithStatusCode(_0x2905ff,_0x1c4f54){_0x1c4f54=_0x1c4f54||0xcc;return function(_0x5af80a){if(_0x5af80a){return _0x2905ff[_0x79be('0x1d')](_0x1c4f54);}return _0x2905ff[_0x79be('0x1e')](_0x1c4f54)[_0x79be('0x1f')]();};}function respondWithResult(_0x5abb7a,_0x270989){_0x270989=_0x270989||0xc8;return function(_0x5ba99b){if(_0x5ba99b){return _0x5abb7a['status'](_0x270989)[_0x79be('0x20')](_0x5ba99b);}};}function respondWithFilteredResult(_0x599d46,_0x5207e7){return function(_0x420d41){if(_0x420d41){var _0x31c7bb=typeof _0x5207e7['offset']===_0x79be('0x21')&&typeof _0x5207e7[_0x79be('0x22')]===_0x79be('0x21');var _0x417e48=_0x420d41[_0x79be('0x23')];var _0x19e863=_0x31c7bb?0x0:_0x5207e7[_0x79be('0x24')];var _0x2fdf71=_0x31c7bb?_0x420d41[_0x79be('0x23')]:_0x5207e7[_0x79be('0x24')]+_0x5207e7[_0x79be('0x22')];var _0x7496a2;if(_0x2fdf71>=_0x417e48){_0x2fdf71=_0x417e48;_0x7496a2=0xc8;}else{_0x7496a2=0xce;}_0x599d46[_0x79be('0x1e')](_0x7496a2);return _0x599d46[_0x79be('0x25')](_0x79be('0x26'),_0x19e863+'-'+_0x2fdf71+'/'+_0x417e48)[_0x79be('0x20')](_0x420d41);}return null;};}function patchUpdates(_0x18c13e){return function(_0x3f09ec){try{jsonpatch[_0x79be('0x27')](_0x3f09ec,_0x18c13e,!![]);}catch(_0x4b18b4){return BPromise['reject'](_0x4b18b4);}return _0x3f09ec['save']();};}function saveUpdates(_0x5df70e,_0x2608ca){return function(_0x3489ff){if(_0x3489ff){return _0x3489ff['update'](_0x5df70e)['then'](function(_0x2541e0){return _0x2541e0;});}return null;};}function removeEntity(_0x594cea,_0x42edd1){return function(_0x54ca37){if(_0x54ca37){return _0x54ca37[_0x79be('0x28')]()[_0x79be('0x29')](function(){var _0x3b0c45=_0x54ca37['get']({'plain':!![]});var _0x2fe7c0='WhatsappQueues';return db[_0x79be('0x2a')]['destroy']({'where':{'type':_0x2fe7c0,'resourceId':_0x3b0c45['id']}})[_0x79be('0x29')](function(){return _0x54ca37;});})[_0x79be('0x29')](function(){_0x594cea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8000,_0x4bc1f4){return function(_0x31b099){if(!_0x31b099){_0x4b8000[_0x79be('0x1d')](0x194);}return _0x31b099;};}function handleError(_0x44ce9a,_0xb9cc9){_0xb9cc9=_0xb9cc9||0x1f4;return function(_0x5ab46b){logger[_0x79be('0x2b')](_0x5ab46b[_0x79be('0x2c')]);if(_0x5ab46b[_0x79be('0x2d')]){delete _0x5ab46b[_0x79be('0x2d')];}_0x44ce9a[_0x79be('0x1e')](_0xb9cc9)['send'](_0x5ab46b);};}exports['index']=function(_0x31f483,_0x459039){var _0x44d34b={},_0x32db38={},_0x202b2f={'count':0x0,'rows':[]};var _0x57119c=_[_0x79be('0x2e')](db['WhatsappQueue'][_0x79be('0x2f')],function(_0x6b33bc){return{'name':_0x6b33bc[_0x79be('0x30')],'type':_0x6b33bc['type']['key']};});_0x32db38[_0x79be('0x31')]=_[_0x79be('0x2e')](_0x57119c,'name');_0x32db38[_0x79be('0x32')]=_['keys'](_0x31f483[_0x79be('0x32')]);_0x32db38[_0x79be('0x33')]=_['intersection'](_0x32db38['model'],_0x32db38[_0x79be('0x32')]);_0x44d34b[_0x79be('0x34')]=_[_0x79be('0x35')](_0x32db38[_0x79be('0x31')],qs[_0x79be('0x36')](_0x31f483[_0x79be('0x32')][_0x79be('0x36')]));_0x44d34b['attributes']=_0x44d34b[_0x79be('0x34')][_0x79be('0x37')]?_0x44d34b[_0x79be('0x34')]:_0x32db38[_0x79be('0x31')];if(!_0x31f483[_0x79be('0x32')]['hasOwnProperty']('nolimit')){_0x44d34b[_0x79be('0x22')]=qs[_0x79be('0x22')](_0x31f483[_0x79be('0x32')]['limit']);_0x44d34b[_0x79be('0x24')]=qs['offset'](_0x31f483[_0x79be('0x32')][_0x79be('0x24')]);}_0x44d34b[_0x79be('0x38')]=qs[_0x79be('0x39')](_0x31f483['query'][_0x79be('0x39')]);_0x44d34b[_0x79be('0x3a')]=qs[_0x79be('0x33')](_[_0x79be('0x3b')](_0x31f483['query'],_0x32db38[_0x79be('0x33')]),_0x57119c);if(_0x31f483[_0x79be('0x32')][_0x79be('0x3c')]){_0x44d34b[_0x79be('0x3a')]=_[_0x79be('0x3d')](_0x44d34b[_0x79be('0x3a')],{'$or':_[_0x79be('0x2e')](_0x57119c,function(_0x34d1f6){if(_0x34d1f6[_0x79be('0x3e')]!==_0x79be('0x3f')){var _0x47d865={};_0x47d865[_0x34d1f6[_0x79be('0x2d')]]={'$like':'%'+_0x31f483[_0x79be('0x32')][_0x79be('0x3c')]+'%'};return _0x47d865;}})});}_0x44d34b=_['merge']({},_0x44d34b,_0x31f483['options']);var _0x25771a={'where':_0x44d34b[_0x79be('0x3a')]};return db[_0x79be('0x40')][_0x79be('0x23')](_0x25771a)[_0x79be('0x29')](function(_0x44e3e7){_0x202b2f[_0x79be('0x23')]=_0x44e3e7;if(_0x31f483['query'][_0x79be('0x41')]){_0x44d34b[_0x79be('0x42')]=[{'all':!![]}];}return db[_0x79be('0x40')][_0x79be('0x43')](_0x44d34b);})[_0x79be('0x29')](function(_0x52cc36){_0x202b2f[_0x79be('0x44')]=_0x52cc36;return _0x202b2f;})[_0x79be('0x29')](respondWithFilteredResult(_0x459039,_0x44d34b))['catch'](handleError(_0x459039,null));};exports['show']=function(_0x4aab59,_0x3e6f69){var _0xaf4677={'raw':!![],'where':{'id':_0x4aab59[_0x79be('0x45')]['id']}},_0x30e287={};_0x30e287[_0x79be('0x31')]=_[_0x79be('0x46')](db[_0x79be('0x40')][_0x79be('0x2f')]);_0x30e287[_0x79be('0x32')]=_[_0x79be('0x46')](_0x4aab59[_0x79be('0x32')]);_0x30e287[_0x79be('0x33')]=_[_0x79be('0x35')](_0x30e287[_0x79be('0x31')],_0x30e287['query']);_0xaf4677[_0x79be('0x34')]=_[_0x79be('0x35')](_0x30e287[_0x79be('0x31')],qs['fields'](_0x4aab59[_0x79be('0x32')]['fields']));_0xaf4677['attributes']=_0xaf4677[_0x79be('0x34')][_0x79be('0x37')]?_0xaf4677[_0x79be('0x34')]:_0x30e287[_0x79be('0x31')];if(_0x4aab59[_0x79be('0x32')]['includeAll']){_0xaf4677[_0x79be('0x42')]=[{'all':!![]}];}_0xaf4677=_[_0x79be('0x3d')]({},_0xaf4677,_0x4aab59[_0x79be('0x47')]);return db['WhatsappQueue'][_0x79be('0x48')](_0xaf4677)[_0x79be('0x29')](handleEntityNotFound(_0x3e6f69,null))[_0x79be('0x29')](respondWithResult(_0x3e6f69,null))[_0x79be('0x49')](handleError(_0x3e6f69,null));};exports[_0x79be('0x4a')]=function(_0x5a681c,_0x13d3e3){return db[_0x79be('0x40')]['create'](_0x5a681c[_0x79be('0x4b')],{})[_0x79be('0x29')](function(_0x1cc574){var _0x5248f6=_0x5a681c['user']['get']({'plain':!![]});if(!_0x5248f6)throw new Error(_0x79be('0x4c'));if(_0x5248f6[_0x79be('0x4d')]===_0x79be('0x4e')){var _0x3d91d6=_0x1cc574[_0x79be('0x4f')]({'plain':!![]});var _0x3f0947=_0x79be('0x50');return db[_0x79be('0x51')][_0x79be('0x48')]({'where':{'name':_0x3f0947,'userProfileId':_0x5248f6[_0x79be('0x52')]},'raw':!![]})[_0x79be('0x29')](function(_0x3fa6e7){if(_0x3fa6e7&&_0x3fa6e7['autoAssociation']===0x0){return db['UserProfileResource'][_0x79be('0x4a')]({'name':_0x3d91d6[_0x79be('0x2d')],'resourceId':_0x3d91d6['id'],'type':_0x3fa6e7[_0x79be('0x2d')],'sectionId':_0x3fa6e7['id']},{})[_0x79be('0x29')](function(){return _0x1cc574;});}else{return _0x1cc574;}})[_0x79be('0x49')](function(_0x2964dd){logger['error'](_0x79be('0x53'),_0x2964dd);throw _0x2964dd;});}return _0x1cc574;})['then'](respondWithResult(_0x13d3e3,0xc9))[_0x79be('0x49')](handleError(_0x13d3e3,null));};exports[_0x79be('0x54')]=function(_0x2e7aaf,_0x1de6f5){if(_0x2e7aaf[_0x79be('0x4b')]['id']){delete _0x2e7aaf[_0x79be('0x4b')]['id'];}return db[_0x79be('0x40')][_0x79be('0x48')]({'where':{'id':_0x2e7aaf[_0x79be('0x45')]['id']}})[_0x79be('0x29')](handleEntityNotFound(_0x1de6f5,null))[_0x79be('0x29')](saveUpdates(_0x2e7aaf[_0x79be('0x4b')],null))[_0x79be('0x29')](respondWithResult(_0x1de6f5,null))[_0x79be('0x49')](handleError(_0x1de6f5,null));};exports['destroy']=function(_0x4cca79,_0x42728b){return db[_0x79be('0x40')][_0x79be('0x48')]({'where':{'id':_0x4cca79[_0x79be('0x45')]['id']}})[_0x79be('0x29')](handleEntityNotFound(_0x42728b,null))['then'](removeEntity(_0x42728b,null))[_0x79be('0x49')](handleError(_0x42728b,null));};exports['describe']=function(_0x34f0f7,_0x50c80f){return db[_0x79be('0x40')][_0x79be('0x55')]()[_0x79be('0x29')](respondWithResult(_0x50c80f,null))[_0x79be('0x49')](handleError(_0x50c80f,null));};exports['getMembers']=function(_0x2df891,_0x241257,_0x32d6ed){var _0x356756={'raw':!![],'where':{}},_0x31c58f={},_0x4210fd;return db[_0x79be('0x40')][_0x79be('0x56')]({'where':{'id':_0x2df891[_0x79be('0x45')]['id']}})[_0x79be('0x29')](handleEntityNotFound(_0x241257,null))['then'](function(_0x50ec1e){if(_0x50ec1e){_0x4210fd=_0x50ec1e[_0x79be('0x4f')]({'plain':!![]});_0x31c58f['model']=_[_0x79be('0x46')](db[_0x79be('0x57')]['rawAttributes']);_0x31c58f[_0x79be('0x32')]=_[_0x79be('0x46')](_0x2df891[_0x79be('0x32')]);_0x31c58f[_0x79be('0x33')]=_[_0x79be('0x35')](_0x31c58f['model'],_0x31c58f[_0x79be('0x32')]);_0x356756['attributes']=_[_0x79be('0x35')](_0x31c58f[_0x79be('0x31')],qs[_0x79be('0x36')](_0x2df891[_0x79be('0x32')]['fields']));_0x356756['attributes']=_0x356756['attributes']['length']?_0x356756[_0x79be('0x34')]:_0x31c58f[_0x79be('0x31')];if(!_0x2df891[_0x79be('0x32')][_0x79be('0x58')](_0x79be('0x59'))){_0x356756['limit']=qs[_0x79be('0x22')](_0x2df891[_0x79be('0x32')][_0x79be('0x22')]);_0x356756[_0x79be('0x24')]=qs[_0x79be('0x24')](_0x2df891['query'][_0x79be('0x24')]);}_0x356756[_0x79be('0x38')]=qs['sort'](_0x2df891[_0x79be('0x32')][_0x79be('0x39')]);_0x356756[_0x79be('0x3a')]=qs['filters'](_[_0x79be('0x3b')](_0x2df891[_0x79be('0x32')],_0x31c58f[_0x79be('0x33')]));_0x356756[_0x79be('0x3a')][_0x79be('0x5a')]=_0x50ec1e['id'];if(_0x2df891['query'][_0x79be('0x3c')]){_0x356756[_0x79be('0x3a')]=_['merge'](_0x356756[_0x79be('0x3a')],{'$or':_[_0x79be('0x2e')](_0x356756[_0x79be('0x34')],function(_0xa38de5){var _0x5cd8b6={};_0x5cd8b6[_0xa38de5]={'$like':'%'+_0x2df891['query'][_0x79be('0x3c')]+'%'};return _0x5cd8b6;})});}_0x356756=_[_0x79be('0x3d')]({},_0x356756,_0x2df891['options']);return db['UserWhatsappQueue'][_0x79be('0x43')](_0x356756);}})[_0x79be('0x29')](function(_0x1a04b5){if(_0x1a04b5){return db[_0x79be('0x5b')]['findAndCountAll']({'where':{'id':_[_0x79be('0x2e')](_0x1a04b5,_0x79be('0x5c')),'role':_0x79be('0x5d')},'attributes':['id',_0x79be('0x2d'),_0x79be('0x5e'),_0x79be('0x5f'),_0x79be('0x60')]});}})[_0x79be('0x29')](function(_0x1170eb){if(_0x1170eb){return{'count':_0x1170eb[_0x79be('0x23')],'rows':_[_0x79be('0x2e')](_0x1170eb[_0x79be('0x44')],function(_0x565697){return{'membername':_0x565697['name'],'UserId':_0x565697['id'],'queue_name':_0x4210fd['name'],'WhatsappQueueId':_0x4210fd['id'],'interface':util[_0x79be('0x61')](_0x79be('0x62'),_0x79be('0x63'),_0x565697[_0x79be('0x2d')]),'penalty':0x0,'paused':_0x565697['whatsappPause'],'createdAt':_0x565697[_0x79be('0x60')],'updatedAt':_0x565697[_0x79be('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x79be('0x29')](respondWithFilteredResult(_0x241257,_0x356756))[_0x79be('0x49')](handleError(_0x241257,null));};exports[_0x79be('0x64')]=function(_0x2d3cf2,_0x5ada8d,_0x45b326){var _0x31865c={};var _0x168e52={};var _0x4f4c1d;var _0x1d1e98;return db['WhatsappQueue']['findOne']({'where':{'id':_0x2d3cf2['params']['id']}})[_0x79be('0x29')](handleEntityNotFound(_0x5ada8d,null))['then'](function(_0x30ec10){if(_0x30ec10){_0x4f4c1d=_0x30ec10;_0x168e52[_0x79be('0x31')]=_[_0x79be('0x46')](db['Team']['rawAttributes']);_0x168e52[_0x79be('0x32')]=_[_0x79be('0x46')](_0x2d3cf2['query']);_0x168e52[_0x79be('0x33')]=_[_0x79be('0x35')](_0x168e52[_0x79be('0x31')],_0x168e52[_0x79be('0x32')]);_0x31865c[_0x79be('0x34')]=_[_0x79be('0x35')](_0x168e52[_0x79be('0x31')],qs[_0x79be('0x36')](_0x2d3cf2[_0x79be('0x32')][_0x79be('0x36')]));_0x31865c[_0x79be('0x34')]=_0x31865c[_0x79be('0x34')][_0x79be('0x37')]?_0x31865c[_0x79be('0x34')]:_0x168e52[_0x79be('0x31')];_0x31865c[_0x79be('0x38')]=qs[_0x79be('0x39')](_0x2d3cf2[_0x79be('0x32')][_0x79be('0x39')]);_0x31865c[_0x79be('0x3a')]=qs[_0x79be('0x33')](_[_0x79be('0x3b')](_0x2d3cf2[_0x79be('0x32')],_0x168e52[_0x79be('0x33')]));if(_0x2d3cf2[_0x79be('0x32')][_0x79be('0x3c')]){_0x31865c[_0x79be('0x3a')]=_[_0x79be('0x3d')](_0x31865c[_0x79be('0x3a')],{'$or':_[_0x79be('0x2e')](_0x31865c['attributes'],function(_0xf5c836){var _0xecc10e={};_0xecc10e[_0xf5c836]={'$like':'%'+_0x2d3cf2[_0x79be('0x32')][_0x79be('0x3c')]+'%'};return _0xecc10e;})});}_0x31865c=_[_0x79be('0x3d')]({},_0x31865c,_0x2d3cf2[_0x79be('0x47')]);return _0x4f4c1d[_0x79be('0x64')](_0x31865c);}})[_0x79be('0x29')](function(_0x5d012d){if(_0x5d012d){_0x1d1e98=_0x5d012d['length'];if(!_0x2d3cf2[_0x79be('0x32')][_0x79be('0x58')](_0x79be('0x59'))){_0x31865c[_0x79be('0x22')]=qs[_0x79be('0x22')](_0x2d3cf2['query'][_0x79be('0x22')]);_0x31865c['offset']=qs[_0x79be('0x24')](_0x2d3cf2['query'][_0x79be('0x24')]);}return _0x4f4c1d[_0x79be('0x64')](_0x31865c);}})['then'](function(_0xadccc6){if(_0xadccc6){return _0xadccc6?{'count':_0x1d1e98,'rows':_0xadccc6}:null;}})['then'](respondWithResult(_0x5ada8d,null))['catch'](handleError(_0x5ada8d,null));};exports[_0x79be('0x65')]=function(_0x2f3bd5,_0xf83256,_0x103320){var _0x177746=_0x2f3bd5[_0x79be('0x4b')][_0x79be('0x66')];return db[_0x79be('0x67')]['findAll']({'where':{'id':_0x177746},'attributes':['id'],'include':[{'model':db['User'],'as':_0x79be('0x68'),'attributes':['id','name',_0x79be('0x69'),_0x79be('0x6a'),_0x79be('0x6b')],'raw':!![]}]})['then'](function(_0xee0878){if(_0xee0878){var _0x2c72ed=_[_0x79be('0x6c')](_0xee0878,function(_0x12017a){var _0x2436dd=_0x12017a[_0x79be('0x4f')]({'plain':!![]});return _0x2436dd[_0x79be('0x68')];});return db[_0x79be('0x40')][_0x79be('0x48')]({'where':{'id':_0x2f3bd5[_0x79be('0x45')]['id']}})[_0x79be('0x29')](function(_0x5cd380){return db[_0x79be('0x6d')]['transaction'](function(_0x94aff2){return _0x5cd380[_0x79be('0x65')](_0x177746,{'transaction':_0x94aff2})[_0x79be('0x29')](function(){return BPromise['each'](_0x2c72ed,function(_0x5292e1){return db['UserWhatsappQueue'][_0x79be('0x6e')]({'where':{'UserId':_0x5292e1['id'],'WhatsappQueueId':_0x2f3bd5['params']['id']},'transaction':_0x94aff2});});})[_0x79be('0x29')](function(){_0x2c72ed[_0x79be('0x6f')](function(_0x34b781){socket[_0x79be('0x70')](_0x79be('0x71'),{'UserId':_0x34b781['id'],'WhatsappQueueId':_0x5cd380['id']});});});});});}})['then'](respondWithStatusCode(_0xf83256,null))[_0x79be('0x49')](handleError(_0xf83256,null));};exports[_0x79be('0x72')]=function(_0x3d5070,_0x4228ab,_0x262070){return db[_0x79be('0x67')][_0x79be('0x43')]({'where':{'id':_0x3d5070[_0x79be('0x32')][_0x79be('0x66')]},'attributes':['id'],'include':[{'model':db[_0x79be('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4228ab,null))[_0x79be('0x29')](function(_0x5f57f7){var _0x2e1bef=_[_0x79be('0x2e')](_0x5f57f7,'id');var _0x7c064d=[];var _0x1a4fda=[];var _0x5cf159=squel['select']();_0x5cf159[_0x79be('0x73')](_0x79be('0x74'))['from'](_0x79be('0x75'),'tq')[_0x79be('0x76')](_0x79be('0x77'),'ut',_0x79be('0x78'))[_0x79be('0x3a')](_0x79be('0x79'),_0x3d5070[_0x79be('0x45')]['id']);for(var _0x271e15=0x0;_0x271e15<_0x5f57f7[_0x79be('0x37')];_0x271e15+=0x1){let _0x1605f5=_0x5f57f7[_0x271e15];for(var _0x34cb09=0x0;_0x34cb09<_0x1605f5[_0x79be('0x68')][_0x79be('0x37')];_0x34cb09+=0x1){let _0x500029=_0x1605f5[_0x79be('0x68')][_0x34cb09];var _0x39620d=_0x5cf159[_0x79be('0x7a')]();_0x39620d[_0x79be('0x3a')](_0x79be('0x7b'),_0x500029['id']);_0x1a4fda[_0x79be('0x7c')](db[_0x79be('0x6d')][_0x79be('0x32')](_0x39620d[_0x79be('0x7d')](),{'type':db[_0x79be('0x6d')][_0x79be('0x7e')]['SELECT']})[_0x79be('0x29')](function(_0x37d275){if(_0x37d275[_0x79be('0x37')]===0x1){return _0x500029['id'];}else{var _0x123c7a=_[_0x79be('0x7f')](_[_0x79be('0x2e')](_0x37d275,'TeamId'),function(_0x405763){return _['includes'](_0x2e1bef,_0x405763);});if(_0x123c7a){return _0x500029['id'];}}}));}}return BPromise[_0x79be('0x80')](_0x1a4fda)[_0x79be('0x29')](function(_0x29889d){_0x7c064d=_(_0x7c064d)['union'](_0x29889d)[_0x79be('0x81')]()[_0x79be('0x82')]();return db[_0x79be('0x40')][_0x79be('0x48')]({'where':{'id':_0x3d5070[_0x79be('0x45')]['id']}})[_0x79be('0x29')](function(_0x4df19){return db[_0x79be('0x6d')][_0x79be('0x83')](function(_0x317d7f){return _0x4df19[_0x79be('0x72')](_0x3d5070[_0x79be('0x32')][_0x79be('0x66')],{'transaction':_0x317d7f})[_0x79be('0x29')](function(){if(!_[_0x79be('0x84')](_0x7c064d)){return _0x4df19[_0x79be('0x85')](_0x7c064d,{'transaction':_0x317d7f});}})[_0x79be('0x29')](function(){_0x7c064d[_0x79be('0x6f')](function(_0x2f8970){socket[_0x79be('0x70')]('userWhatsappQueue:remove',{'UserId':_0x2f8970,'WhatsappQueueId':_0x4df19['id']});});});});});});})['then'](respondWithStatusCode(_0x4228ab,null))['catch'](handleError(_0x4228ab,null));};exports[_0x79be('0x86')]=function(_0x2990fe,_0x1aa3c5,_0x39686e){return db[_0x79be('0x40')][_0x79be('0x48')]({'where':{'id':_0x2990fe[_0x79be('0x45')]['id']}})[_0x79be('0x29')](handleEntityNotFound(_0x1aa3c5,null))[_0x79be('0x29')](function(_0x3b46c0){if(_0x3b46c0){return _0x3b46c0[_0x79be('0x86')](_0x2990fe['body'][_0x79be('0x66')],_[_0x79be('0x87')](_0x2990fe[_0x79be('0x4b')],[_0x79be('0x66'),'id'])||{})['spread'](function(_0x192106){for(var _0x2253c5=0x0;_0x2253c5<_0x2990fe['body'][_0x79be('0x66')][_0x79be('0x37')];_0x2253c5+=0x1){socket['emit'](_0x79be('0x71'),{'UserId':Number(_0x2990fe[_0x79be('0x4b')][_0x79be('0x66')][_0x2253c5]),'WhatsappQueueId':Number(_0x2990fe['params']['id'])});}return _0x192106;});}})[_0x79be('0x29')](respondWithResult(_0x1aa3c5,null))[_0x79be('0x49')](handleError(_0x1aa3c5,null));};exports[_0x79be('0x85')]=function(_0x167747,_0x16087c,_0x47277f){return db['WhatsappQueue'][_0x79be('0x48')]({'where':{'id':_0x167747['params']['id']}})[_0x79be('0x29')](handleEntityNotFound(_0x16087c,null))[_0x79be('0x29')](function(_0x493a07){if(_0x493a07){return _0x493a07[_0x79be('0x85')](_0x167747[_0x79be('0x32')][_0x79be('0x66')])[_0x79be('0x29')](function(){if(_[_0x79be('0x88')](_0x167747[_0x79be('0x32')]['ids'])){for(var _0x53b89f=0x0;_0x53b89f<_0x167747[_0x79be('0x32')][_0x79be('0x66')]['length'];_0x53b89f+=0x1){socket[_0x79be('0x70')](_0x79be('0x89'),{'UserId':Number(_0x167747[_0x79be('0x32')]['ids'][_0x53b89f]),'WhatsappQueueId':Number(_0x167747[_0x79be('0x45')]['id'])});}}else{socket[_0x79be('0x70')](_0x79be('0x89'),{'UserId':Number(_0x167747[_0x79be('0x32')][_0x79be('0x66')]),'WhatsappQueueId':Number(_0x167747[_0x79be('0x45')]['id'])});}});}})[_0x79be('0x29')](respondWithStatusCode(_0x16087c,null))['catch'](handleError(_0x16087c,null));};exports[_0x79be('0x8a')]=function(_0x5976e3,_0x11feac,_0x5b85f8){var _0x4d3f95={};var _0x414c47={};var _0x524490;var _0x3500f1;return db[_0x79be('0x40')][_0x79be('0x56')]({'where':{'id':_0x5976e3[_0x79be('0x45')]['id']}})[_0x79be('0x29')](handleEntityNotFound(_0x11feac,null))['then'](function(_0x338e5b){if(_0x338e5b){_0x524490=_0x338e5b;_0x414c47[_0x79be('0x31')]=_[_0x79be('0x46')](db['User'][_0x79be('0x2f')]);_0x414c47['query']=_['keys'](_0x5976e3[_0x79be('0x32')]);_0x414c47['filters']=_[_0x79be('0x35')](_0x414c47['model'],_0x414c47[_0x79be('0x32')]);_0x4d3f95[_0x79be('0x34')]=_[_0x79be('0x35')](_0x414c47[_0x79be('0x31')],qs[_0x79be('0x36')](_0x5976e3['query'][_0x79be('0x36')]));_0x4d3f95[_0x79be('0x34')]=_0x4d3f95[_0x79be('0x34')][_0x79be('0x37')]?_0x4d3f95[_0x79be('0x34')]:_0x414c47[_0x79be('0x31')];_0x4d3f95['order']=qs['sort'](_0x5976e3[_0x79be('0x32')][_0x79be('0x39')]);_0x4d3f95[_0x79be('0x3a')]=qs[_0x79be('0x33')](_[_0x79be('0x3b')](_0x5976e3[_0x79be('0x32')],_0x414c47[_0x79be('0x33')]));if(_0x5976e3[_0x79be('0x32')][_0x79be('0x3c')]){_0x4d3f95[_0x79be('0x3a')]=_[_0x79be('0x3d')](_0x4d3f95[_0x79be('0x3a')],{'$or':_[_0x79be('0x2e')](_0x4d3f95[_0x79be('0x34')],function(_0x4fa2e6){var _0x2427eb={};_0x2427eb[_0x4fa2e6]={'$like':'%'+_0x5976e3['query'][_0x79be('0x3c')]+'%'};return _0x2427eb;})});}_0x4d3f95=_[_0x79be('0x3d')]({},_0x4d3f95,_0x5976e3['options']);return _0x524490[_0x79be('0x8a')](_0x4d3f95);}})[_0x79be('0x29')](function(_0x20afd9){if(_0x20afd9){_0x3500f1=_0x20afd9['length'];if(!_0x5976e3[_0x79be('0x32')][_0x79be('0x58')](_0x79be('0x59'))){_0x4d3f95['limit']=qs['limit'](_0x5976e3[_0x79be('0x32')][_0x79be('0x22')]);_0x4d3f95[_0x79be('0x24')]=qs['offset'](_0x5976e3[_0x79be('0x32')][_0x79be('0x24')]);}return _0x524490[_0x79be('0x8a')](_0x4d3f95);}})['then'](function(_0x3ba57c){if(_0x3ba57c){return _0x3ba57c?{'count':_0x3500f1,'rows':_0x3ba57c}:null;}})[_0x79be('0x29')](respondWithResult(_0x11feac,null))['catch'](handleError(_0x11feac,null));}; \ No newline at end of file +var _0x4ba1=['ejs','fs-extra','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','localhost','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','WhatsappQueues','UserProfileResource','destroy','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','nolimit','WhatsappQueueId','User','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','getTeams','addTeams','Agents','online','interface','flatMap','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','select','field','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv'];(function(_0x13ce01,_0x576bb1){var _0x306c53=function(_0x533eb0){while(--_0x533eb0){_0x13ce01['push'](_0x13ce01['shift']());}};_0x306c53(++_0x576bb1);}(_0x4ba1,0x19e));var _0x14ba=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4ba1[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14ba('0x0'));var zipdir=require(_0x14ba('0x1'));var jsonpatch=require(_0x14ba('0x2'));var rp=require(_0x14ba('0x3'));var moment=require(_0x14ba('0x4'));var BPromise=require(_0x14ba('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x14ba('0x6'));var sox=require(_0x14ba('0x7'));var csv=require(_0x14ba('0x8'));var ejs=require(_0x14ba('0x9'));var fs=require('fs');var fs_extra=require(_0x14ba('0xa'));var _=require('lodash');var squel=require(_0x14ba('0xb'));var crypto=require('crypto');var jsforce=require(_0x14ba('0xc'));var deskjs=require(_0x14ba('0xd'));var toCsv=require(_0x14ba('0x8'));var querystring=require(_0x14ba('0xe'));var Papa=require(_0x14ba('0xf'));var Redis=require(_0x14ba('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14ba('0x11'));var as=require(_0x14ba('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x14ba('0x13'))(_0x14ba('0x14'));var utils=require(_0x14ba('0x15'));var config=require(_0x14ba('0x16'));var licenseUtil=require(_0x14ba('0x17'));var db=require(_0x14ba('0x18'))['db'];config[_0x14ba('0x19')]=_[_0x14ba('0x1a')](config[_0x14ba('0x19')],{'host':_0x14ba('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x14ba('0x1c'))['register'](socket);function respondWithStatusCode(_0x26eaae,_0x387da1){_0x387da1=_0x387da1||0xcc;return function(_0x311e57){if(_0x311e57){return _0x26eaae[_0x14ba('0x1d')](_0x387da1);}return _0x26eaae[_0x14ba('0x1e')](_0x387da1)[_0x14ba('0x1f')]();};}function respondWithResult(_0x222075,_0x4b2a82){_0x4b2a82=_0x4b2a82||0xc8;return function(_0x1f1970){if(_0x1f1970){return _0x222075[_0x14ba('0x1e')](_0x4b2a82)[_0x14ba('0x20')](_0x1f1970);}};}function respondWithFilteredResult(_0x19f2ed,_0x259884){return function(_0x502a02){if(_0x502a02){var _0x2c858d=typeof _0x259884[_0x14ba('0x21')]===_0x14ba('0x22')&&typeof _0x259884[_0x14ba('0x23')]===_0x14ba('0x22');var _0x168d59=_0x502a02[_0x14ba('0x24')];var _0x300f48=_0x2c858d?0x0:_0x259884['offset'];var _0x33dcb8=_0x2c858d?_0x502a02[_0x14ba('0x24')]:_0x259884[_0x14ba('0x21')]+_0x259884['limit'];var _0x431620;if(_0x33dcb8>=_0x168d59){_0x33dcb8=_0x168d59;_0x431620=0xc8;}else{_0x431620=0xce;}_0x19f2ed[_0x14ba('0x1e')](_0x431620);return _0x19f2ed[_0x14ba('0x25')](_0x14ba('0x26'),_0x300f48+'-'+_0x33dcb8+'/'+_0x168d59)[_0x14ba('0x20')](_0x502a02);}return null;};}function patchUpdates(_0x422af2){return function(_0x2c2ed1){try{jsonpatch['apply'](_0x2c2ed1,_0x422af2,!![]);}catch(_0x190e29){return BPromise[_0x14ba('0x27')](_0x190e29);}return _0x2c2ed1[_0x14ba('0x28')]();};}function saveUpdates(_0x4f6e6b,_0x20e165){return function(_0x5d4e84){if(_0x5d4e84){return _0x5d4e84[_0x14ba('0x29')](_0x4f6e6b)[_0x14ba('0x2a')](function(_0x3830b8){return _0x3830b8;});}return null;};}function removeEntity(_0x17be86,_0x304840){return function(_0x5a8b5f){if(_0x5a8b5f){return _0x5a8b5f['destroy']()['then'](function(){var _0x4277d5=_0x5a8b5f[_0x14ba('0x2b')]({'plain':!![]});var _0x34d409=_0x14ba('0x2c');return db[_0x14ba('0x2d')][_0x14ba('0x2e')]({'where':{'type':_0x34d409,'resourceId':_0x4277d5['id']}})[_0x14ba('0x2a')](function(){return _0x5a8b5f;});})[_0x14ba('0x2a')](function(){_0x17be86[_0x14ba('0x1e')](0xcc)[_0x14ba('0x1f')]();});}};}function handleEntityNotFound(_0x3765ba,_0x42b30c){return function(_0x567a1b){if(!_0x567a1b){_0x3765ba['sendStatus'](0x194);}return _0x567a1b;};}function handleError(_0x24ec85,_0x4e70ca){_0x4e70ca=_0x4e70ca||0x1f4;return function(_0x34ab6a){logger['error'](_0x34ab6a[_0x14ba('0x2f')]);if(_0x34ab6a[_0x14ba('0x30')]){delete _0x34ab6a[_0x14ba('0x30')];}_0x24ec85[_0x14ba('0x1e')](_0x4e70ca)[_0x14ba('0x31')](_0x34ab6a);};}exports[_0x14ba('0x32')]=function(_0x212c73,_0x44db11){var _0x1d28fd={},_0x2f71ae={},_0x4dd916={'count':0x0,'rows':[]};var _0x569dd9=_['map'](db[_0x14ba('0x33')][_0x14ba('0x34')],function(_0x48e210){return{'name':_0x48e210[_0x14ba('0x35')],'type':_0x48e210[_0x14ba('0x36')][_0x14ba('0x37')]};});_0x2f71ae['model']=_['map'](_0x569dd9,_0x14ba('0x30'));_0x2f71ae[_0x14ba('0x38')]=_[_0x14ba('0x39')](_0x212c73[_0x14ba('0x38')]);_0x2f71ae[_0x14ba('0x3a')]=_[_0x14ba('0x3b')](_0x2f71ae[_0x14ba('0x3c')],_0x2f71ae[_0x14ba('0x38')]);_0x1d28fd[_0x14ba('0x3d')]=_[_0x14ba('0x3b')](_0x2f71ae[_0x14ba('0x3c')],qs[_0x14ba('0x3e')](_0x212c73[_0x14ba('0x38')][_0x14ba('0x3e')]));_0x1d28fd['attributes']=_0x1d28fd['attributes'][_0x14ba('0x3f')]?_0x1d28fd[_0x14ba('0x3d')]:_0x2f71ae[_0x14ba('0x3c')];if(!_0x212c73[_0x14ba('0x38')][_0x14ba('0x40')]('nolimit')){_0x1d28fd[_0x14ba('0x23')]=qs[_0x14ba('0x23')](_0x212c73['query'][_0x14ba('0x23')]);_0x1d28fd[_0x14ba('0x21')]=qs['offset'](_0x212c73[_0x14ba('0x38')]['offset']);}_0x1d28fd[_0x14ba('0x41')]=qs[_0x14ba('0x42')](_0x212c73[_0x14ba('0x38')][_0x14ba('0x42')]);_0x1d28fd[_0x14ba('0x43')]=qs[_0x14ba('0x3a')](_[_0x14ba('0x44')](_0x212c73['query'],_0x2f71ae[_0x14ba('0x3a')]),_0x569dd9);if(_0x212c73[_0x14ba('0x38')][_0x14ba('0x45')]){_0x1d28fd['where']=_[_0x14ba('0x46')](_0x1d28fd[_0x14ba('0x43')],{'$or':_[_0x14ba('0x47')](_0x569dd9,function(_0x5b2f16){if(_0x5b2f16[_0x14ba('0x36')]!==_0x14ba('0x48')){var _0x4b79f7={};_0x4b79f7[_0x5b2f16['name']]={'$like':'%'+_0x212c73['query']['filter']+'%'};return _0x4b79f7;}})});}_0x1d28fd=_[_0x14ba('0x46')]({},_0x1d28fd,_0x212c73['options']);var _0x913ff1={'where':_0x1d28fd['where']};return db[_0x14ba('0x33')][_0x14ba('0x24')](_0x913ff1)[_0x14ba('0x2a')](function(_0x2b8c47){_0x4dd916[_0x14ba('0x24')]=_0x2b8c47;if(_0x212c73[_0x14ba('0x38')]['includeAll']){_0x1d28fd[_0x14ba('0x49')]=[{'all':!![]}];}return db[_0x14ba('0x33')][_0x14ba('0x4a')](_0x1d28fd);})[_0x14ba('0x2a')](function(_0xa0e813){_0x4dd916[_0x14ba('0x4b')]=_0xa0e813;return _0x4dd916;})[_0x14ba('0x2a')](respondWithFilteredResult(_0x44db11,_0x1d28fd))['catch'](handleError(_0x44db11,null));};exports[_0x14ba('0x4c')]=function(_0xd95729,_0x1a88fa){var _0x31b20b={'raw':!![],'where':{'id':_0xd95729[_0x14ba('0x4d')]['id']}},_0x160a6d={};_0x160a6d[_0x14ba('0x3c')]=_[_0x14ba('0x39')](db[_0x14ba('0x33')]['rawAttributes']);_0x160a6d[_0x14ba('0x38')]=_[_0x14ba('0x39')](_0xd95729['query']);_0x160a6d['filters']=_[_0x14ba('0x3b')](_0x160a6d[_0x14ba('0x3c')],_0x160a6d[_0x14ba('0x38')]);_0x31b20b[_0x14ba('0x3d')]=_[_0x14ba('0x3b')](_0x160a6d[_0x14ba('0x3c')],qs[_0x14ba('0x3e')](_0xd95729[_0x14ba('0x38')]['fields']));_0x31b20b[_0x14ba('0x3d')]=_0x31b20b[_0x14ba('0x3d')][_0x14ba('0x3f')]?_0x31b20b[_0x14ba('0x3d')]:_0x160a6d[_0x14ba('0x3c')];if(_0xd95729[_0x14ba('0x38')][_0x14ba('0x4e')]){_0x31b20b[_0x14ba('0x49')]=[{'all':!![]}];}_0x31b20b=_['merge']({},_0x31b20b,_0xd95729[_0x14ba('0x4f')]);return db['WhatsappQueue'][_0x14ba('0x50')](_0x31b20b)['then'](handleEntityNotFound(_0x1a88fa,null))[_0x14ba('0x2a')](respondWithResult(_0x1a88fa,null))[_0x14ba('0x51')](handleError(_0x1a88fa,null));};exports[_0x14ba('0x52')]=function(_0x5b1a45,_0x2d3eaa){return db['WhatsappQueue']['create'](_0x5b1a45[_0x14ba('0x53')],{})[_0x14ba('0x2a')](function(_0x35d943){var _0x30cf6e=_0x5b1a45['user']['get']({'plain':!![]});if(!_0x30cf6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30cf6e['role']===_0x14ba('0x54')){var _0x156e3b=_0x35d943[_0x14ba('0x2b')]({'plain':!![]});var _0x48490a=_0x14ba('0x2c');return db['UserProfileSection'][_0x14ba('0x50')]({'where':{'name':_0x48490a,'userProfileId':_0x30cf6e[_0x14ba('0x55')]},'raw':!![]})[_0x14ba('0x2a')](function(_0x34a175){if(_0x34a175&&_0x34a175['autoAssociation']===0x0){return db[_0x14ba('0x2d')]['create']({'name':_0x156e3b[_0x14ba('0x30')],'resourceId':_0x156e3b['id'],'type':_0x34a175[_0x14ba('0x30')],'sectionId':_0x34a175['id']},{})[_0x14ba('0x2a')](function(){return _0x35d943;});}else{return _0x35d943;}})[_0x14ba('0x51')](function(_0x4225c7){logger[_0x14ba('0x56')](_0x14ba('0x57'),_0x4225c7);throw _0x4225c7;});}return _0x35d943;})[_0x14ba('0x2a')](respondWithResult(_0x2d3eaa,0xc9))[_0x14ba('0x51')](handleError(_0x2d3eaa,null));};exports[_0x14ba('0x29')]=function(_0x722544,_0x41cde9){if(_0x722544[_0x14ba('0x53')]['id']){delete _0x722544['body']['id'];}return db[_0x14ba('0x33')][_0x14ba('0x50')]({'where':{'id':_0x722544[_0x14ba('0x4d')]['id']}})[_0x14ba('0x2a')](handleEntityNotFound(_0x41cde9,null))[_0x14ba('0x2a')](saveUpdates(_0x722544[_0x14ba('0x53')],null))[_0x14ba('0x2a')](respondWithResult(_0x41cde9,null))['catch'](handleError(_0x41cde9,null));};exports[_0x14ba('0x2e')]=function(_0x2a7916,_0x39c27f){return db[_0x14ba('0x33')]['find']({'where':{'id':_0x2a7916['params']['id']}})[_0x14ba('0x2a')](handleEntityNotFound(_0x39c27f,null))[_0x14ba('0x2a')](removeEntity(_0x39c27f,null))[_0x14ba('0x51')](handleError(_0x39c27f,null));};exports[_0x14ba('0x58')]=function(_0x5e95c6,_0x2ed532){return db[_0x14ba('0x33')][_0x14ba('0x58')]()[_0x14ba('0x2a')](respondWithResult(_0x2ed532,null))['catch'](handleError(_0x2ed532,null));};exports[_0x14ba('0x59')]=function(_0x46607f,_0x2283a4,_0x9e61c7){var _0x29789a={'raw':!![],'where':{}},_0x4d157a={},_0x233aff;return db[_0x14ba('0x33')]['findOne']({'where':{'id':_0x46607f['params']['id']}})[_0x14ba('0x2a')](handleEntityNotFound(_0x2283a4,null))[_0x14ba('0x2a')](function(_0x209459){if(_0x209459){_0x233aff=_0x209459[_0x14ba('0x2b')]({'plain':!![]});_0x4d157a[_0x14ba('0x3c')]=_[_0x14ba('0x39')](db[_0x14ba('0x5a')][_0x14ba('0x34')]);_0x4d157a[_0x14ba('0x38')]=_[_0x14ba('0x39')](_0x46607f['query']);_0x4d157a[_0x14ba('0x3a')]=_[_0x14ba('0x3b')](_0x4d157a[_0x14ba('0x3c')],_0x4d157a['query']);_0x29789a[_0x14ba('0x3d')]=_[_0x14ba('0x3b')](_0x4d157a['model'],qs['fields'](_0x46607f[_0x14ba('0x38')]['fields']));_0x29789a[_0x14ba('0x3d')]=_0x29789a[_0x14ba('0x3d')]['length']?_0x29789a[_0x14ba('0x3d')]:_0x4d157a[_0x14ba('0x3c')];if(!_0x46607f[_0x14ba('0x38')][_0x14ba('0x40')](_0x14ba('0x5b'))){_0x29789a['limit']=qs[_0x14ba('0x23')](_0x46607f['query'][_0x14ba('0x23')]);_0x29789a['offset']=qs[_0x14ba('0x21')](_0x46607f['query']['offset']);}_0x29789a['order']=qs[_0x14ba('0x42')](_0x46607f[_0x14ba('0x38')][_0x14ba('0x42')]);_0x29789a[_0x14ba('0x43')]=qs[_0x14ba('0x3a')](_['pick'](_0x46607f[_0x14ba('0x38')],_0x4d157a['filters']));_0x29789a[_0x14ba('0x43')][_0x14ba('0x5c')]=_0x209459['id'];if(_0x46607f[_0x14ba('0x38')]['filter']){_0x29789a['where']=_[_0x14ba('0x46')](_0x29789a['where'],{'$or':_[_0x14ba('0x47')](_0x29789a[_0x14ba('0x3d')],function(_0x21f1e2){var _0x127971={};_0x127971[_0x21f1e2]={'$like':'%'+_0x46607f[_0x14ba('0x38')]['filter']+'%'};return _0x127971;})});}_0x29789a=_[_0x14ba('0x46')]({},_0x29789a,_0x46607f['options']);return db[_0x14ba('0x5a')]['findAll'](_0x29789a);}})[_0x14ba('0x2a')](function(_0x1da495){if(_0x1da495){return db[_0x14ba('0x5d')]['findAndCountAll']({'where':{'id':_[_0x14ba('0x47')](_0x1da495,'UserId'),'role':_0x14ba('0x5e')},'attributes':['id',_0x14ba('0x30'),_0x14ba('0x5f'),_0x14ba('0x60'),_0x14ba('0x61')]});}})[_0x14ba('0x2a')](function(_0x19ea15){if(_0x19ea15){return{'count':_0x19ea15[_0x14ba('0x24')],'rows':_[_0x14ba('0x47')](_0x19ea15[_0x14ba('0x4b')],function(_0x617c57){return{'membername':_0x617c57[_0x14ba('0x30')],'UserId':_0x617c57['id'],'queue_name':_0x233aff[_0x14ba('0x30')],'WhatsappQueueId':_0x233aff['id'],'interface':util[_0x14ba('0x62')](_0x14ba('0x63'),_0x14ba('0x64'),_0x617c57['name']),'penalty':0x0,'paused':_0x617c57['whatsappPause'],'createdAt':_0x617c57[_0x14ba('0x61')],'updatedAt':_0x617c57[_0x14ba('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2283a4,_0x29789a))['catch'](handleError(_0x2283a4,null));};exports['getTeams']=function(_0x16ad3a,_0x23bdc4,_0x164af8){var _0x158490={};var _0xb1fb8={};var _0x20b77b;var _0x1789ed;return db[_0x14ba('0x33')][_0x14ba('0x65')]({'where':{'id':_0x16ad3a[_0x14ba('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23bdc4,null))[_0x14ba('0x2a')](function(_0xf8a8de){if(_0xf8a8de){_0x20b77b=_0xf8a8de;_0xb1fb8[_0x14ba('0x3c')]=_[_0x14ba('0x39')](db[_0x14ba('0x66')][_0x14ba('0x34')]);_0xb1fb8['query']=_[_0x14ba('0x39')](_0x16ad3a[_0x14ba('0x38')]);_0xb1fb8[_0x14ba('0x3a')]=_[_0x14ba('0x3b')](_0xb1fb8[_0x14ba('0x3c')],_0xb1fb8[_0x14ba('0x38')]);_0x158490[_0x14ba('0x3d')]=_['intersection'](_0xb1fb8[_0x14ba('0x3c')],qs['fields'](_0x16ad3a[_0x14ba('0x38')][_0x14ba('0x3e')]));_0x158490[_0x14ba('0x3d')]=_0x158490[_0x14ba('0x3d')]['length']?_0x158490[_0x14ba('0x3d')]:_0xb1fb8[_0x14ba('0x3c')];_0x158490[_0x14ba('0x41')]=qs[_0x14ba('0x42')](_0x16ad3a['query'][_0x14ba('0x42')]);_0x158490[_0x14ba('0x43')]=qs[_0x14ba('0x3a')](_['pick'](_0x16ad3a[_0x14ba('0x38')],_0xb1fb8[_0x14ba('0x3a')]));if(_0x16ad3a[_0x14ba('0x38')][_0x14ba('0x45')]){_0x158490[_0x14ba('0x43')]=_['merge'](_0x158490['where'],{'$or':_[_0x14ba('0x47')](_0x158490[_0x14ba('0x3d')],function(_0x404d0e){var _0x4d7e41={};_0x4d7e41[_0x404d0e]={'$like':'%'+_0x16ad3a[_0x14ba('0x38')][_0x14ba('0x45')]+'%'};return _0x4d7e41;})});}_0x158490=_[_0x14ba('0x46')]({},_0x158490,_0x16ad3a[_0x14ba('0x4f')]);return _0x20b77b['getTeams'](_0x158490);}})[_0x14ba('0x2a')](function(_0x134b66){if(_0x134b66){_0x1789ed=_0x134b66[_0x14ba('0x3f')];if(!_0x16ad3a[_0x14ba('0x38')][_0x14ba('0x40')]('nolimit')){_0x158490['limit']=qs[_0x14ba('0x23')](_0x16ad3a[_0x14ba('0x38')][_0x14ba('0x23')]);_0x158490[_0x14ba('0x21')]=qs['offset'](_0x16ad3a[_0x14ba('0x38')]['offset']);}return _0x20b77b[_0x14ba('0x67')](_0x158490);}})['then'](function(_0x475587){if(_0x475587){return _0x475587?{'count':_0x1789ed,'rows':_0x475587}:null;}})[_0x14ba('0x2a')](respondWithResult(_0x23bdc4,null))[_0x14ba('0x51')](handleError(_0x23bdc4,null));};exports[_0x14ba('0x68')]=function(_0x4bcf23,_0x9c46c5,_0x2cbb8b){var _0x15493a=_0x4bcf23[_0x14ba('0x53')]['ids'];return db[_0x14ba('0x66')]['findAll']({'where':{'id':_0x15493a},'attributes':['id'],'include':[{'model':db[_0x14ba('0x5d')],'as':_0x14ba('0x69'),'attributes':['id','name',_0x14ba('0x6a'),'voicePause',_0x14ba('0x6b')],'raw':!![]}]})[_0x14ba('0x2a')](function(_0x2296ea){if(_0x2296ea){var _0x16e0b6=_[_0x14ba('0x6c')](_0x2296ea,function(_0x2d1883){var _0x55c630=_0x2d1883['get']({'plain':!![]});return _0x55c630[_0x14ba('0x69')];});return db[_0x14ba('0x33')][_0x14ba('0x50')]({'where':{'id':_0x4bcf23[_0x14ba('0x4d')]['id']}})['then'](function(_0x1caea7){return db['sequelize'][_0x14ba('0x6d')](function(_0x5008f){return _0x1caea7[_0x14ba('0x68')](_0x15493a,{'transaction':_0x5008f})[_0x14ba('0x2a')](function(){return BPromise['each'](_0x16e0b6,function(_0x1e0dd9){return db[_0x14ba('0x5a')][_0x14ba('0x6e')]({'where':{'UserId':_0x1e0dd9['id'],'WhatsappQueueId':_0x4bcf23[_0x14ba('0x4d')]['id']},'transaction':_0x5008f});});})[_0x14ba('0x2a')](function(){_0x16e0b6[_0x14ba('0x6f')](function(_0x200f16){socket[_0x14ba('0x70')](_0x14ba('0x71'),{'UserId':_0x200f16['id'],'WhatsappQueueId':_0x1caea7['id']});});});});});}})[_0x14ba('0x2a')](respondWithStatusCode(_0x9c46c5,null))[_0x14ba('0x51')](handleError(_0x9c46c5,null));};exports['removeTeams']=function(_0x550fc9,_0xea2377,_0x34e54c){return db[_0x14ba('0x66')][_0x14ba('0x4a')]({'where':{'id':_0x550fc9[_0x14ba('0x38')][_0x14ba('0x72')]},'attributes':['id'],'include':[{'model':db[_0x14ba('0x5d')],'as':_0x14ba('0x69'),'attributes':['id'],'raw':!![]}]})[_0x14ba('0x2a')](handleEntityNotFound(_0xea2377,null))[_0x14ba('0x2a')](function(_0x562096){var _0x263002=_[_0x14ba('0x47')](_0x562096,'id');var _0x3fc07a=[];var _0x1e0be7=[];var _0x888085=squel[_0x14ba('0x73')]();_0x888085[_0x14ba('0x74')]('tq.TeamId')[_0x14ba('0x75')](_0x14ba('0x76'),'tq')[_0x14ba('0x77')]('user_has_teams','ut',_0x14ba('0x78'))['where'](_0x14ba('0x79'),_0x550fc9[_0x14ba('0x4d')]['id']);for(var _0x1ef3ce=0x0;_0x1ef3ce<_0x562096[_0x14ba('0x3f')];_0x1ef3ce+=0x1){let _0x511db6=_0x562096[_0x1ef3ce];for(var _0x278971=0x0;_0x278971<_0x511db6['Agents'][_0x14ba('0x3f')];_0x278971+=0x1){let _0x45af94=_0x511db6[_0x14ba('0x69')][_0x278971];var _0x506be1=_0x888085[_0x14ba('0x7a')]();_0x506be1[_0x14ba('0x43')](_0x14ba('0x7b'),_0x45af94['id']);_0x1e0be7[_0x14ba('0x7c')](db[_0x14ba('0x7d')][_0x14ba('0x38')](_0x506be1[_0x14ba('0x7e')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x14ba('0x2a')](function(_0x17d1d2){if(_0x17d1d2[_0x14ba('0x3f')]===0x1){return _0x45af94['id'];}else{var _0x316832=_['every'](_['map'](_0x17d1d2,_0x14ba('0x7f')),function(_0x38ed8a){return _[_0x14ba('0x80')](_0x263002,_0x38ed8a);});if(_0x316832){return _0x45af94['id'];}}}));}}return BPromise[_0x14ba('0x81')](_0x1e0be7)['then'](function(_0x46ded2){_0x3fc07a=_(_0x3fc07a)[_0x14ba('0x82')](_0x46ded2)[_0x14ba('0x83')]()['value']();return db[_0x14ba('0x33')][_0x14ba('0x50')]({'where':{'id':_0x550fc9['params']['id']}})[_0x14ba('0x2a')](function(_0xb91fc7){return db[_0x14ba('0x7d')][_0x14ba('0x6d')](function(_0x567d59){return _0xb91fc7[_0x14ba('0x84')](_0x550fc9[_0x14ba('0x38')]['ids'],{'transaction':_0x567d59})['then'](function(){if(!_[_0x14ba('0x85')](_0x3fc07a)){return _0xb91fc7[_0x14ba('0x86')](_0x3fc07a,{'transaction':_0x567d59});}})[_0x14ba('0x2a')](function(){_0x3fc07a[_0x14ba('0x6f')](function(_0x44e7cb){socket[_0x14ba('0x70')](_0x14ba('0x87'),{'UserId':_0x44e7cb,'WhatsappQueueId':_0xb91fc7['id']});});});});});});})[_0x14ba('0x2a')](respondWithStatusCode(_0xea2377,null))['catch'](handleError(_0xea2377,null));};exports[_0x14ba('0x88')]=function(_0x1e0136,_0x4090a8,_0x1553bd){return db[_0x14ba('0x33')][_0x14ba('0x50')]({'where':{'id':_0x1e0136[_0x14ba('0x4d')]['id']}})[_0x14ba('0x2a')](handleEntityNotFound(_0x4090a8,null))[_0x14ba('0x2a')](function(_0x48fe76){if(_0x48fe76){return _0x48fe76['addAgents'](_0x1e0136[_0x14ba('0x53')][_0x14ba('0x72')],_[_0x14ba('0x89')](_0x1e0136[_0x14ba('0x53')],[_0x14ba('0x72'),'id'])||{})[_0x14ba('0x8a')](function(_0x40f8cc){for(var _0x1c457c=0x0;_0x1c457c<_0x1e0136[_0x14ba('0x53')][_0x14ba('0x72')][_0x14ba('0x3f')];_0x1c457c+=0x1){socket[_0x14ba('0x70')](_0x14ba('0x71'),{'UserId':Number(_0x1e0136[_0x14ba('0x53')]['ids'][_0x1c457c]),'WhatsappQueueId':Number(_0x1e0136[_0x14ba('0x4d')]['id'])});}return _0x40f8cc;});}})[_0x14ba('0x2a')](respondWithResult(_0x4090a8,null))[_0x14ba('0x51')](handleError(_0x4090a8,null));};exports[_0x14ba('0x86')]=function(_0x1e4059,_0x444957,_0xb43b0b){return db[_0x14ba('0x33')][_0x14ba('0x50')]({'where':{'id':_0x1e4059[_0x14ba('0x4d')]['id']}})[_0x14ba('0x2a')](handleEntityNotFound(_0x444957,null))[_0x14ba('0x2a')](function(_0x30d085){if(_0x30d085){return _0x30d085[_0x14ba('0x86')](_0x1e4059[_0x14ba('0x38')]['ids'])['then'](function(){if(_[_0x14ba('0x8b')](_0x1e4059[_0x14ba('0x38')][_0x14ba('0x72')])){for(var _0x14aa92=0x0;_0x14aa92<_0x1e4059[_0x14ba('0x38')][_0x14ba('0x72')]['length'];_0x14aa92+=0x1){socket[_0x14ba('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x1e4059[_0x14ba('0x38')][_0x14ba('0x72')][_0x14aa92]),'WhatsappQueueId':Number(_0x1e4059[_0x14ba('0x4d')]['id'])});}}else{socket[_0x14ba('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x1e4059[_0x14ba('0x38')][_0x14ba('0x72')]),'WhatsappQueueId':Number(_0x1e4059[_0x14ba('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x444957,null))[_0x14ba('0x51')](handleError(_0x444957,null));};exports[_0x14ba('0x8c')]=function(_0x2ffd82,_0x1d56c3,_0x142467){var _0x28e65e={};var _0x2b9d9e={};var _0x40071b;var _0xba54e3;return db[_0x14ba('0x33')][_0x14ba('0x65')]({'where':{'id':_0x2ffd82['params']['id']}})[_0x14ba('0x2a')](handleEntityNotFound(_0x1d56c3,null))[_0x14ba('0x2a')](function(_0xdd84fb){if(_0xdd84fb){_0x40071b=_0xdd84fb;_0x2b9d9e['model']=_[_0x14ba('0x39')](db[_0x14ba('0x5d')]['rawAttributes']);_0x2b9d9e[_0x14ba('0x38')]=_[_0x14ba('0x39')](_0x2ffd82[_0x14ba('0x38')]);_0x2b9d9e[_0x14ba('0x3a')]=_[_0x14ba('0x3b')](_0x2b9d9e[_0x14ba('0x3c')],_0x2b9d9e[_0x14ba('0x38')]);_0x28e65e[_0x14ba('0x3d')]=_[_0x14ba('0x3b')](_0x2b9d9e[_0x14ba('0x3c')],qs[_0x14ba('0x3e')](_0x2ffd82[_0x14ba('0x38')][_0x14ba('0x3e')]));_0x28e65e[_0x14ba('0x3d')]=_0x28e65e['attributes'][_0x14ba('0x3f')]?_0x28e65e[_0x14ba('0x3d')]:_0x2b9d9e[_0x14ba('0x3c')];_0x28e65e[_0x14ba('0x41')]=qs['sort'](_0x2ffd82[_0x14ba('0x38')][_0x14ba('0x42')]);_0x28e65e['where']=qs[_0x14ba('0x3a')](_[_0x14ba('0x44')](_0x2ffd82[_0x14ba('0x38')],_0x2b9d9e[_0x14ba('0x3a')]));if(_0x2ffd82[_0x14ba('0x38')]['filter']){_0x28e65e[_0x14ba('0x43')]=_[_0x14ba('0x46')](_0x28e65e['where'],{'$or':_[_0x14ba('0x47')](_0x28e65e[_0x14ba('0x3d')],function(_0x4fbd3c){var _0x3850dc={};_0x3850dc[_0x4fbd3c]={'$like':'%'+_0x2ffd82[_0x14ba('0x38')]['filter']+'%'};return _0x3850dc;})});}_0x28e65e=_[_0x14ba('0x46')]({},_0x28e65e,_0x2ffd82[_0x14ba('0x4f')]);return _0x40071b[_0x14ba('0x8c')](_0x28e65e);}})[_0x14ba('0x2a')](function(_0x418ba5){if(_0x418ba5){_0xba54e3=_0x418ba5[_0x14ba('0x3f')];if(!_0x2ffd82[_0x14ba('0x38')][_0x14ba('0x40')](_0x14ba('0x5b'))){_0x28e65e[_0x14ba('0x23')]=qs['limit'](_0x2ffd82['query']['limit']);_0x28e65e[_0x14ba('0x21')]=qs['offset'](_0x2ffd82[_0x14ba('0x38')]['offset']);}return _0x40071b[_0x14ba('0x8c')](_0x28e65e);}})[_0x14ba('0x2a')](function(_0xf55982){if(_0xf55982){return _0xf55982?{'count':_0xba54e3,'rows':_0xf55982}:null;}})[_0x14ba('0x2a')](respondWithResult(_0x1d56c3,null))['catch'](handleError(_0x1d56c3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4b13cef..6aae84e 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 _0x7f4a=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x7f4a,0x18e));var _0xa7f4=function(_0x41273c,_0x4c0c04){_0x41273c=_0x41273c-0x0;var _0x453ce4=_0x7f4a[_0x41273c];return _0x453ce4;};'use strict';var EventEmitter=require(_0xa7f4('0x0'));var WhatsappQueue=require(_0xa7f4('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa7f4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa7f4('0x3'),'afterDestroy':_0xa7f4('0x4')};function emitEvent(_0x4278da){return function(_0x8521ba,_0x5a5d18,_0x2e3201){WhatsappQueueEvents[_0xa7f4('0x5')](_0x4278da+':'+_0x8521ba['id'],_0x8521ba);WhatsappQueueEvents[_0xa7f4('0x5')](_0x4278da,_0x8521ba);_0x2e3201(null);};}for(var e in events){if(events[_0xa7f4('0x6')](e)){var event=events[e];WhatsappQueue[_0xa7f4('0x7')](e,emitEvent(event));}}module[_0xa7f4('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xaaf1=['emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','save','update','remove'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xaaf1,0x109));var _0x1aaf=function(_0x24d474,_0xdf655e){_0x24d474=_0x24d474-0x0;var _0x5a3b8e=_0xaaf1[_0x24d474];return _0x5a3b8e;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x1aaf('0x0'))['db'][_0x1aaf('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1aaf('0x2'),'afterUpdate':_0x1aaf('0x3'),'afterDestroy':_0x1aaf('0x4')};function emitEvent(_0x49f0fe){return function(_0x1d3ae6,_0x539699,_0x514d7c){WhatsappQueueEvents[_0x1aaf('0x5')](_0x49f0fe+':'+_0x1d3ae6['id'],_0x1d3ae6);WhatsappQueueEvents['emit'](_0x49f0fe,_0x1d3ae6);_0x514d7c(null);};}for(var e in events){if(events[_0x1aaf('0x6')](e)){var event=events[e];WhatsappQueue[_0x1aaf('0x7')](e,emitEvent(event));}}module[_0x1aaf('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index dabab39..1cf7e4a 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 _0x1f5a=['define','WhatsappQueue','whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x1f5a,0x121));var _0xa1f5=function(_0x23b5ea,_0x24d921){_0x23b5ea=_0x23b5ea-0x0;var _0x170db5=_0x1f5a[_0x23b5ea];return _0x170db5;};'use strict';var _=require(_0xa1f5('0x0'));var util=require(_0xa1f5('0x1'));var logger=require('../../config/logger')(_0xa1f5('0x2'));var moment=require(_0xa1f5('0x3'));var BPromise=require(_0xa1f5('0x4'));var rp=require(_0xa1f5('0x5'));var fs=require('fs');var path=require(_0xa1f5('0x6'));var rimraf=require(_0xa1f5('0x7'));var config=require(_0xa1f5('0x8'));var attributes=require(_0xa1f5('0x9'));module['exports']=function(_0x16fc9b,_0x21d7db){return _0x16fc9b[_0xa1f5('0xa')](_0xa1f5('0xb'),attributes,{'tableName':_0xa1f5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58c6=['../../config/environment','./whatsappQueue.attributes','lodash','util','api','moment','bluebird','path'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0x58c6,0x122));var _0x658c=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x58c6[_0x95411e];return _0x2c8718;};'use strict';var _=require(_0x658c('0x0'));var util=require(_0x658c('0x1'));var logger=require('../../config/logger')(_0x658c('0x2'));var moment=require(_0x658c('0x3'));var BPromise=require(_0x658c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x658c('0x5'));var rimraf=require('rimraf');var config=require(_0x658c('0x6'));var attributes=require(_0x658c('0x7'));module['exports']=function(_0xe3f20a,_0x270c0e){return _0xe3f20a['define']('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index a0e8947..2373ff5 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 _0xf419=['redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','find','ShowWhatsappQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5e13f3,_0x3109a6){var _0x31f163=function(_0x4b8d79){while(--_0x4b8d79){_0x5e13f3['push'](_0x5e13f3['shift']());}};_0x31f163(++_0x3109a6);}(_0xf419,0x113));var _0x9f41=function(_0x2e2a9d,_0x4ab1ac){_0x2e2a9d=_0x2e2a9d-0x0;var _0x291dec=_0xf419[_0x2e2a9d];return _0x291dec;};'use strict';var _=require(_0x9f41('0x0'));var util=require(_0x9f41('0x1'));var moment=require(_0x9f41('0x2'));var BPromise=require(_0x9f41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f41('0x4'));var db=require(_0x9f41('0x5'))['db'];var utils=require(_0x9f41('0x6'));var logger=require(_0x9f41('0x7'))(_0x9f41('0x8'));var config=require(_0x9f41('0x9'));var jayson=require(_0x9f41('0xa'));var client=jayson[_0x9f41('0xb')]['http']({'port':0x232a});config[_0x9f41('0xc')]=_[_0x9f41('0xd')](config['redis'],{'host':_0x9f41('0xe'),'port':0x18eb});var socket=require(_0x9f41('0xf'))(new Redis(config[_0x9f41('0xc')]));require(_0x9f41('0x10'))['register'](socket);function respondWithRpcPromise(_0x3b22f0,_0x12e4b6,_0x2e2f2b){return new BPromise(function(_0x117795,_0xc82d33){return client['request'](_0x3b22f0,_0x2e2f2b)[_0x9f41('0x11')](function(_0x3c0d15){logger[_0x9f41('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x12e4b6,_0x9f41('0x13'));logger[_0x9f41('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x12e4b6,_0x9f41('0x13'),JSON[_0x9f41('0x15')](_0x3c0d15));if(_0x3c0d15[_0x9f41('0x16')]){if(_0x3c0d15[_0x9f41('0x16')][_0x9f41('0x17')]===0x1f4){logger['error'](_0x9f41('0x18'),_0x12e4b6,_0x3c0d15[_0x9f41('0x16')][_0x9f41('0x19')]);return _0xc82d33(_0x3c0d15[_0x9f41('0x16')][_0x9f41('0x19')]);}logger[_0x9f41('0x16')](_0x9f41('0x18'),_0x12e4b6,_0x3c0d15['error'][_0x9f41('0x19')]);return _0x117795(_0x3c0d15[_0x9f41('0x16')]['message']);}else{logger[_0x9f41('0x12')](_0x9f41('0x18'),_0x12e4b6,'request\x20sent');_0x117795(_0x3c0d15[_0x9f41('0x1a')][_0x9f41('0x19')]);}})[_0x9f41('0x1b')](function(_0x220715){logger[_0x9f41('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x12e4b6,_0x220715);_0xc82d33(_0x220715);});});}exports['GetWhatsappQueue']=function(_0x318a48){var _0x5704dc=this;return new Promise(function(_0x24f986,_0x138b0f){return db[_0x9f41('0x1c')][_0x9f41('0x1d')]({'raw':_0x318a48[_0x9f41('0x1e')]?_0x318a48[_0x9f41('0x1e')][_0x9f41('0x1f')]===undefined?!![]:![]:!![],'where':_0x318a48['options']?_0x318a48[_0x9f41('0x1e')][_0x9f41('0x20')]||null:null,'attributes':_0x318a48['options']?_0x318a48[_0x9f41('0x1e')][_0x9f41('0x21')]||null:null,'limit':_0x318a48[_0x9f41('0x1e')]?_0x318a48[_0x9f41('0x1e')][_0x9f41('0x22')]||null:null,'include':_0x318a48['options']?_0x318a48[_0x9f41('0x1e')][_0x9f41('0x23')]?_[_0x9f41('0x24')](_0x318a48['options'][_0x9f41('0x23')],function(_0x2132e3){return{'model':db[_0x2132e3[_0x9f41('0x25')]],'as':_0x2132e3['as'],'attributes':_0x2132e3['attributes'],'include':_0x2132e3[_0x9f41('0x23')]?_[_0x9f41('0x24')](_0x2132e3[_0x9f41('0x23')],function(_0x313ce1){return{'model':db[_0x313ce1[_0x9f41('0x25')]],'as':_0x313ce1['as'],'attributes':_0x313ce1[_0x9f41('0x21')],'include':_0x313ce1[_0x9f41('0x23')]?_[_0x9f41('0x24')](_0x313ce1[_0x9f41('0x23')],function(_0x53d2bb){return{'model':db[_0x53d2bb[_0x9f41('0x25')]],'as':_0x53d2bb['as'],'attributes':_0x53d2bb['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f41('0x11')](function(_0x43118c){logger[_0x9f41('0x12')](_0x9f41('0x26'),_0x318a48);logger['debug']('GetWhatsappQueue',_0x318a48,JSON['stringify'](_0x43118c));_0x24f986(_0x43118c);})[_0x9f41('0x1b')](function(_0x46a286){logger['error'](_0x9f41('0x26'),_0x46a286['message'],_0x318a48);_0x138b0f(_0x5704dc[_0x9f41('0x16')](0x1f4,_0x46a286[_0x9f41('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0xf081a2){var _0x434a05=this;return new Promise(function(_0x4cae3c,_0x5edfd0){return db[_0x9f41('0x1c')][_0x9f41('0x27')]({'raw':_0xf081a2[_0x9f41('0x1e')]?_0xf081a2[_0x9f41('0x1e')][_0x9f41('0x1f')]===undefined?!![]:![]:!![],'where':_0xf081a2[_0x9f41('0x1e')]?_0xf081a2[_0x9f41('0x1e')][_0x9f41('0x20')]||null:null,'attributes':_0xf081a2[_0x9f41('0x1e')]?_0xf081a2[_0x9f41('0x1e')][_0x9f41('0x21')]||null:null,'include':_0xf081a2['options']?_0xf081a2[_0x9f41('0x1e')][_0x9f41('0x23')]?_[_0x9f41('0x24')](_0xf081a2[_0x9f41('0x1e')]['include'],function(_0xe63bb1){return{'model':db[_0xe63bb1[_0x9f41('0x25')]],'as':_0xe63bb1['as'],'attributes':_0xe63bb1[_0x9f41('0x21')],'include':_0xe63bb1['include']?_[_0x9f41('0x24')](_0xe63bb1[_0x9f41('0x23')],function(_0x1f3b3c){return{'model':db[_0x1f3b3c[_0x9f41('0x25')]],'as':_0x1f3b3c['as'],'attributes':_0x1f3b3c[_0x9f41('0x21')],'include':_0x1f3b3c[_0x9f41('0x23')]?_[_0x9f41('0x24')](_0x1f3b3c[_0x9f41('0x23')],function(_0x16a338){return{'model':db[_0x16a338[_0x9f41('0x25')]],'as':_0x16a338['as'],'attributes':_0x16a338['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1259c9){logger['info'](_0x9f41('0x28'),_0xf081a2);logger[_0x9f41('0x14')]('ShowWhatsappQueue',_0xf081a2,JSON[_0x9f41('0x15')](_0x1259c9));_0x4cae3c(_0x1259c9);})['catch'](function(_0x59f0d9){logger[_0x9f41('0x16')](_0x9f41('0x28'),_0x59f0d9[_0x9f41('0x19')],_0xf081a2);_0x5edfd0(_0x434a05[_0x9f41('0x16')](0x1f4,_0x59f0d9[_0x9f41('0x19')]));});});}; \ No newline at end of file +var _0x1e94=['error','code','message','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','include','model','attributes','map','then','ShowWhatsappQueue','find','debug','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2ef548,_0x3f534f){var _0x3b1cb9=function(_0x319457){while(--_0x319457){_0x2ef548['push'](_0x2ef548['shift']());}};_0x3b1cb9(++_0x3f534f);}(_0x1e94,0x8d));var _0x41e9=function(_0x312944,_0x594eba){_0x312944=_0x312944-0x0;var _0x996a46=_0x1e94[_0x312944];return _0x996a46;};'use strict';var _=require(_0x41e9('0x0'));var util=require(_0x41e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41e9('0x2'));var db=require(_0x41e9('0x3'))['db'];var utils=require(_0x41e9('0x4'));var logger=require(_0x41e9('0x5'))(_0x41e9('0x6'));var config=require(_0x41e9('0x7'));var jayson=require(_0x41e9('0x8'));var client=jayson[_0x41e9('0x9')][_0x41e9('0xa')]({'port':0x232a});config[_0x41e9('0xb')]=_[_0x41e9('0xc')](config[_0x41e9('0xb')],{'host':_0x41e9('0xd'),'port':0x18eb});var socket=require(_0x41e9('0xe'))(new Redis(config['redis']));require(_0x41e9('0xf'))[_0x41e9('0x10')](socket);function respondWithRpcPromise(_0x1876cb,_0x599f02,_0xd25bcb){return new BPromise(function(_0x432657,_0x2ac80e){return client[_0x41e9('0x11')](_0x1876cb,_0xd25bcb)['then'](function(_0x650d1c){logger[_0x41e9('0x12')](_0x41e9('0x13'),_0x599f02,'request\x20sent');logger['debug'](_0x41e9('0x14'),_0x599f02,_0x41e9('0x15'),JSON[_0x41e9('0x16')](_0x650d1c));if(_0x650d1c[_0x41e9('0x17')]){if(_0x650d1c[_0x41e9('0x17')][_0x41e9('0x18')]===0x1f4){logger[_0x41e9('0x17')](_0x41e9('0x13'),_0x599f02,_0x650d1c[_0x41e9('0x17')][_0x41e9('0x19')]);return _0x2ac80e(_0x650d1c['error']['message']);}logger[_0x41e9('0x17')](_0x41e9('0x13'),_0x599f02,_0x650d1c[_0x41e9('0x17')][_0x41e9('0x19')]);return _0x432657(_0x650d1c[_0x41e9('0x17')]['message']);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x599f02,_0x41e9('0x15'));_0x432657(_0x650d1c['result'][_0x41e9('0x19')]);}})[_0x41e9('0x1a')](function(_0x4f064b){logger[_0x41e9('0x17')](_0x41e9('0x13'),_0x599f02,_0x4f064b);_0x2ac80e(_0x4f064b);});});}exports[_0x41e9('0x1b')]=function(_0x1ce457){var _0x3d98bb=this;return new Promise(function(_0x72480e,_0x12f4d0){return db[_0x41e9('0x1c')]['findAll']({'raw':_0x1ce457[_0x41e9('0x1d')]?_0x1ce457['options'][_0x41e9('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ce457[_0x41e9('0x1d')]?_0x1ce457[_0x41e9('0x1d')][_0x41e9('0x1f')]||null:null,'attributes':_0x1ce457[_0x41e9('0x1d')]?_0x1ce457['options']['attributes']||null:null,'limit':_0x1ce457[_0x41e9('0x1d')]?_0x1ce457[_0x41e9('0x1d')][_0x41e9('0x20')]||null:null,'include':_0x1ce457[_0x41e9('0x1d')]?_0x1ce457[_0x41e9('0x1d')][_0x41e9('0x21')]?_['map'](_0x1ce457[_0x41e9('0x1d')][_0x41e9('0x21')],function(_0x240fbd){return{'model':db[_0x240fbd[_0x41e9('0x22')]],'as':_0x240fbd['as'],'attributes':_0x240fbd[_0x41e9('0x23')],'include':_0x240fbd[_0x41e9('0x21')]?_[_0x41e9('0x24')](_0x240fbd[_0x41e9('0x21')],function(_0x541d0a){return{'model':db[_0x541d0a[_0x41e9('0x22')]],'as':_0x541d0a['as'],'attributes':_0x541d0a[_0x41e9('0x23')],'include':_0x541d0a[_0x41e9('0x21')]?_[_0x41e9('0x24')](_0x541d0a[_0x41e9('0x21')],function(_0x11a54a){return{'model':db[_0x11a54a[_0x41e9('0x22')]],'as':_0x11a54a['as'],'attributes':_0x11a54a[_0x41e9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x41e9('0x25')](function(_0x78cb91){logger[_0x41e9('0x12')](_0x41e9('0x1b'),_0x1ce457);logger['debug'](_0x41e9('0x1b'),_0x1ce457,JSON[_0x41e9('0x16')](_0x78cb91));_0x72480e(_0x78cb91);})[_0x41e9('0x1a')](function(_0x5c31a7){logger[_0x41e9('0x17')](_0x41e9('0x1b'),_0x5c31a7[_0x41e9('0x19')],_0x1ce457);_0x12f4d0(_0x3d98bb[_0x41e9('0x17')](0x1f4,_0x5c31a7[_0x41e9('0x19')]));});});};exports[_0x41e9('0x26')]=function(_0x3917d6){var _0x41bc28=this;return new Promise(function(_0x13bcdd,_0x15a7e3){return db['WhatsappQueue'][_0x41e9('0x27')]({'raw':_0x3917d6[_0x41e9('0x1d')]?_0x3917d6[_0x41e9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3917d6[_0x41e9('0x1d')]?_0x3917d6['options'][_0x41e9('0x1f')]||null:null,'attributes':_0x3917d6[_0x41e9('0x1d')]?_0x3917d6[_0x41e9('0x1d')]['attributes']||null:null,'include':_0x3917d6[_0x41e9('0x1d')]?_0x3917d6['options'][_0x41e9('0x21')]?_[_0x41e9('0x24')](_0x3917d6[_0x41e9('0x1d')][_0x41e9('0x21')],function(_0xf9a3b1){return{'model':db[_0xf9a3b1[_0x41e9('0x22')]],'as':_0xf9a3b1['as'],'attributes':_0xf9a3b1[_0x41e9('0x23')],'include':_0xf9a3b1[_0x41e9('0x21')]?_[_0x41e9('0x24')](_0xf9a3b1['include'],function(_0x19c202){return{'model':db[_0x19c202[_0x41e9('0x22')]],'as':_0x19c202['as'],'attributes':_0x19c202[_0x41e9('0x23')],'include':_0x19c202[_0x41e9('0x21')]?_['map'](_0x19c202[_0x41e9('0x21')],function(_0x1e4527){return{'model':db[_0x1e4527[_0x41e9('0x22')]],'as':_0x1e4527['as'],'attributes':_0x1e4527[_0x41e9('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40aec0){logger[_0x41e9('0x12')]('ShowWhatsappQueue',_0x3917d6);logger[_0x41e9('0x28')]('ShowWhatsappQueue',_0x3917d6,JSON['stringify'](_0x40aec0));_0x13bcdd(_0x40aec0);})[_0x41e9('0x1a')](function(_0x4db8c5){logger[_0x41e9('0x17')]('ShowWhatsappQueue',_0x4db8c5[_0x41e9('0x19')],_0x3917d6);_0x15a7e3(_0x41bc28[_0x41e9('0x17')](0x1f4,_0x4db8c5[_0x41e9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 2a9eeb9..1d9f121 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 _0xe7d9=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','update'];(function(_0x59af8f,_0xb91cb2){var _0x21e78e=function(_0xc0923e){while(--_0xc0923e){_0x59af8f['push'](_0x59af8f['shift']());}};_0x21e78e(++_0xb91cb2);}(_0xe7d9,0x1cc));var _0x9e7d=function(_0x4001e8,_0x5b6a29){_0x4001e8=_0x4001e8-0x0;var _0x521350=_0xe7d9[_0x4001e8];return _0x521350;};'use strict';var WhatsappQueueEvents=require(_0x9e7d('0x0'));var events=['save','remove',_0x9e7d('0x1')];function createListener(_0x3a7ac7,_0x5944f6){return function(_0x34d006){_0x5944f6[_0x9e7d('0x2')](_0x3a7ac7,_0x34d006);};}function removeListener(_0x349b25,_0x2a580f){return function(){WhatsappQueueEvents[_0x9e7d('0x3')](_0x349b25,_0x2a580f);};}exports[_0x9e7d('0x4')]=function(_0x40ab80){for(var _0x442489=0x0,_0x3f26c2=events[_0x9e7d('0x5')];_0x442489<_0x3f26c2;_0x442489++){var _0x22b493=events[_0x442489];var _0x1d4ceb=createListener(_0x9e7d('0x6')+_0x22b493,_0x40ab80);WhatsappQueueEvents['on'](_0x22b493,_0x1d4ceb);}}; \ No newline at end of file +var _0x2ef7=['length','./whatsappQueue.events','emit','register'];(function(_0x1d230d,_0x312764){var _0x284ee9=function(_0x4ffde8){while(--_0x4ffde8){_0x1d230d['push'](_0x1d230d['shift']());}};_0x284ee9(++_0x312764);}(_0x2ef7,0x1f1));var _0x72ef=function(_0x58b47a,_0x444c72){_0x58b47a=_0x58b47a-0x0;var _0x5e9eba=_0x2ef7[_0x58b47a];return _0x5e9eba;};'use strict';var WhatsappQueueEvents=require(_0x72ef('0x0'));var events=['save','remove','update'];function createListener(_0x11e308,_0x1208b5){return function(_0x4857ad){_0x1208b5[_0x72ef('0x1')](_0x11e308,_0x4857ad);};}function removeListener(_0x3a18fe,_0x5b17d3){return function(){WhatsappQueueEvents['removeListener'](_0x3a18fe,_0x5b17d3);};}exports[_0x72ef('0x2')]=function(_0x1d728f){for(var _0x50a93b=0x0,_0x908ec7=events[_0x72ef('0x3')];_0x50a93b<_0x908ec7;_0x50a93b++){var _0x41f830=events[_0x50a93b];var _0x1b298e=createListener('whatsappQueue:'+_0x41f830,_0x1d728f);WhatsappQueueEvents['on'](_0x41f830,_0x1b298e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bb705e9..1f8cb94 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 _0xdf30=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x190c35,_0x3814db){var _0x2852b0=function(_0x3f589c){while(--_0x3f589c){_0x190c35['push'](_0x190c35['shift']());}};_0x2852b0(++_0x3814db);}(_0xdf30,0x1d3));var _0x0df3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf30[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0df3('0x0'));var util=require(_0x0df3('0x1'));var path=require('path');var timeout=require(_0x0df3('0x2'));var express=require(_0x0df3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0df3('0x4'));var interaction=require(_0x0df3('0x5'));var config=require(_0x0df3('0x6'));var controller=require(_0x0df3('0x7'));router[_0x0df3('0x8')]('/',auth[_0x0df3('0x9')](),controller[_0x0df3('0xa')]);router[_0x0df3('0x8')](_0x0df3('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x0df3('0x8')](_0x0df3('0xc'),auth[_0x0df3('0x9')](),controller[_0x0df3('0xd')]);router[_0x0df3('0xe')]('/',auth[_0x0df3('0x9')](),controller[_0x0df3('0xf')]);router[_0x0df3('0x10')](_0x0df3('0xc'),auth[_0x0df3('0x9')](),controller['update']);router[_0x0df3('0x11')](_0x0df3('0xc'),auth['isAuthenticated'](),controller[_0x0df3('0x12')]);module[_0x0df3('0x13')]=router; \ No newline at end of file +var _0x2c50=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','create'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x2c50,0x180));var _0x02c5=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x2c50[_0x13ff53];return _0x290228;};'use strict';var multer=require(_0x02c5('0x0'));var util=require(_0x02c5('0x1'));var path=require(_0x02c5('0x2'));var timeout=require(_0x02c5('0x3'));var express=require(_0x02c5('0x4'));var router=express[_0x02c5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x02c5('0x6'));var config=require('../../config/environment');var controller=require(_0x02c5('0x7'));router['get']('/',auth[_0x02c5('0x8')](),controller[_0x02c5('0x9')]);router[_0x02c5('0xa')](_0x02c5('0xb'),auth[_0x02c5('0x8')](),controller[_0x02c5('0xc')]);router['get']('/:id',auth[_0x02c5('0x8')](),controller[_0x02c5('0xd')]);router['post']('/',auth[_0x02c5('0x8')](),controller[_0x02c5('0xe')]);router[_0x02c5('0xf')]('/:id',auth[_0x02c5('0x8')](),controller[_0x02c5('0x10')]);router[_0x02c5('0x11')]('/:id',auth[_0x02c5('0x8')](),controller['destroy']);module[_0x02c5('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 564b9f0..e87f8a4 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(_0x43a467,_0x20d922){var _0x13edcc=function(_0x18f6e0){while(--_0x18f6e0){_0x43a467['push'](_0x43a467['shift']());}};_0x13edcc(++_0x20d922);}(_0x7a54,0x106));var _0x47a5=function(_0x5da333,_0x40d4e9){_0x5da333=_0x5da333-0x0;var _0x9c0760=_0x7a54[_0x5da333];return _0x9c0760;};'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(_0x3d2690,_0x4aaddc){var _0xb8ad18=function(_0x5da1ea){while(--_0x5da1ea){_0x3d2690['push'](_0x3d2690['shift']());}};_0xb8ad18(++_0x4aaddc);}(_0x7a54,0x106));var _0x47a5=function(_0x4ed5b0,_0x5f00e1){_0x4ed5b0=_0x4ed5b0-0x0;var _0x43ba95=_0x7a54[_0x4ed5b0];return _0x43ba95;};'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 92f4f1a..c4f49aa 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 _0x065e=['limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','describe','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x065e,0x1a7));var _0xe065=function(_0x3546a5,_0xddb437){_0x3546a5=_0x3546a5-0x0;var _0x13d218=_0x065e[_0x3546a5];return _0x13d218;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];function respondWithStatusCode(_0x13b697,_0xf5ab44){_0xf5ab44=_0xf5ab44||0xcc;return function(_0x5bd30f){if(_0x5bd30f){return _0x13b697[_0xe065('0x16')](_0xf5ab44);}return _0x13b697[_0xe065('0x17')](_0xf5ab44)[_0xe065('0x18')]();};}function respondWithResult(_0x2e9480,_0x29297b){_0x29297b=_0x29297b||0xc8;return function(_0x541985){if(_0x541985){return _0x2e9480[_0xe065('0x17')](_0x29297b)[_0xe065('0x19')](_0x541985);}};}function respondWithFilteredResult(_0x15d365,_0xc5ef4f){return function(_0x434e07){if(_0x434e07){var _0x352206=typeof _0xc5ef4f[_0xe065('0x1a')]==='undefined'&&typeof _0xc5ef4f[_0xe065('0x1b')]===_0xe065('0x1c');var _0x54d260=_0x434e07[_0xe065('0x1d')];var _0x1d2f7a=_0x352206?0x0:_0xc5ef4f[_0xe065('0x1a')];var _0x14c97c=_0x352206?_0x434e07[_0xe065('0x1d')]:_0xc5ef4f[_0xe065('0x1a')]+_0xc5ef4f[_0xe065('0x1b')];var _0x5000e1;if(_0x14c97c>=_0x54d260){_0x14c97c=_0x54d260;_0x5000e1=0xc8;}else{_0x5000e1=0xce;}_0x15d365[_0xe065('0x17')](_0x5000e1);return _0x15d365['set'](_0xe065('0x1e'),_0x1d2f7a+'-'+_0x14c97c+'/'+_0x54d260)[_0xe065('0x19')](_0x434e07);}return null;};}function patchUpdates(_0x55f55c){return function(_0x1c6567){try{jsonpatch['apply'](_0x1c6567,_0x55f55c,!![]);}catch(_0xe26e9b){return BPromise[_0xe065('0x1f')](_0xe26e9b);}return _0x1c6567[_0xe065('0x20')]();};}function saveUpdates(_0x110556,_0x3ecd13){return function(_0x105cb2){if(_0x105cb2){return _0x105cb2[_0xe065('0x21')](_0x110556)[_0xe065('0x22')](function(_0x1c5dd9){return _0x1c5dd9;});}return null;};}function removeEntity(_0x5081a3,_0x7208af){return function(_0x43b712){if(_0x43b712){return _0x43b712[_0xe065('0x23')]()[_0xe065('0x22')](function(){_0x5081a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x164965,_0x530dc0){return function(_0x14e6b6){if(!_0x14e6b6){_0x164965[_0xe065('0x16')](0x194);}return _0x14e6b6;};}function handleError(_0x430ab9,_0x15b598){_0x15b598=_0x15b598||0x1f4;return function(_0x418731){logger[_0xe065('0x24')](_0x418731[_0xe065('0x25')]);if(_0x418731[_0xe065('0x26')]){delete _0x418731['name'];}_0x430ab9['status'](_0x15b598)[_0xe065('0x27')](_0x418731);};}exports[_0xe065('0x28')]=function(_0x23aee9,_0x441e96){var _0x5b1220={},_0x23f573={},_0x55ecaa={'count':0x0,'rows':[]};var _0x522420=_[_0xe065('0x29')](db[_0xe065('0x2a')][_0xe065('0x2b')],function(_0x5b8523){return{'name':_0x5b8523[_0xe065('0x2c')],'type':_0x5b8523['type'][_0xe065('0x2d')]};});_0x23f573[_0xe065('0x2e')]=_[_0xe065('0x29')](_0x522420,_0xe065('0x26'));_0x23f573['query']=_[_0xe065('0x2f')](_0x23aee9['query']);_0x23f573[_0xe065('0x30')]=_[_0xe065('0x31')](_0x23f573['model'],_0x23f573[_0xe065('0x32')]);_0x5b1220['attributes']=_[_0xe065('0x31')](_0x23f573['model'],qs[_0xe065('0x33')](_0x23aee9[_0xe065('0x32')][_0xe065('0x33')]));_0x5b1220[_0xe065('0x34')]=_0x5b1220['attributes'][_0xe065('0x35')]?_0x5b1220[_0xe065('0x34')]:_0x23f573[_0xe065('0x2e')];if(!_0x23aee9[_0xe065('0x32')][_0xe065('0x36')](_0xe065('0x37'))){_0x5b1220['limit']=qs[_0xe065('0x1b')](_0x23aee9[_0xe065('0x32')]['limit']);_0x5b1220[_0xe065('0x1a')]=qs[_0xe065('0x1a')](_0x23aee9[_0xe065('0x32')][_0xe065('0x1a')]);}_0x5b1220[_0xe065('0x38')]=qs[_0xe065('0x39')](_0x23aee9[_0xe065('0x32')]['sort']);_0x5b1220[_0xe065('0x3a')]=qs['filters'](_[_0xe065('0x3b')](_0x23aee9[_0xe065('0x32')],_0x23f573[_0xe065('0x30')]),_0x522420);if(_0x23aee9[_0xe065('0x32')][_0xe065('0x3c')]){_0x5b1220[_0xe065('0x3a')]=_['merge'](_0x5b1220[_0xe065('0x3a')],{'$or':_[_0xe065('0x29')](_0x522420,function(_0x351ac4){if(_0x351ac4['type']!==_0xe065('0x3d')){var _0x35e4d7={};_0x35e4d7[_0x351ac4[_0xe065('0x26')]]={'$like':'%'+_0x23aee9[_0xe065('0x32')][_0xe065('0x3c')]+'%'};return _0x35e4d7;}})});}_0x5b1220=_['merge']({},_0x5b1220,_0x23aee9[_0xe065('0x3e')]);var _0x23033c={'where':_0x5b1220['where']};return db[_0xe065('0x2a')]['count'](_0x23033c)[_0xe065('0x22')](function(_0x1493a9){_0x55ecaa['count']=_0x1493a9;if(_0x23aee9[_0xe065('0x32')][_0xe065('0x3f')]){_0x5b1220['include']=[{'all':!![]}];}return db[_0xe065('0x2a')][_0xe065('0x40')](_0x5b1220);})[_0xe065('0x22')](function(_0x44a3f6){_0x55ecaa[_0xe065('0x41')]=_0x44a3f6;return _0x55ecaa;})[_0xe065('0x22')](respondWithFilteredResult(_0x441e96,_0x5b1220))[_0xe065('0x42')](handleError(_0x441e96,null));};exports[_0xe065('0x43')]=function(_0x3068f0,_0x445738){var _0x326493={'raw':!![],'where':{'id':_0x3068f0[_0xe065('0x44')]['id']}},_0x4364c3={};_0x4364c3['model']=_['keys'](db[_0xe065('0x2a')][_0xe065('0x2b')]);_0x4364c3['query']=_[_0xe065('0x2f')](_0x3068f0[_0xe065('0x32')]);_0x4364c3[_0xe065('0x30')]=_[_0xe065('0x31')](_0x4364c3[_0xe065('0x2e')],_0x4364c3[_0xe065('0x32')]);_0x326493[_0xe065('0x34')]=_[_0xe065('0x31')](_0x4364c3[_0xe065('0x2e')],qs['fields'](_0x3068f0[_0xe065('0x32')][_0xe065('0x33')]));_0x326493[_0xe065('0x34')]=_0x326493['attributes'][_0xe065('0x35')]?_0x326493[_0xe065('0x34')]:_0x4364c3[_0xe065('0x2e')];if(_0x3068f0[_0xe065('0x32')]['includeAll']){_0x326493[_0xe065('0x45')]=[{'all':!![]}];}_0x326493=_[_0xe065('0x46')]({},_0x326493,_0x3068f0[_0xe065('0x3e')]);return db[_0xe065('0x2a')][_0xe065('0x47')](_0x326493)[_0xe065('0x22')](handleEntityNotFound(_0x445738,null))[_0xe065('0x22')](respondWithResult(_0x445738,null))['catch'](handleError(_0x445738,null));};exports[_0xe065('0x48')]=function(_0x810f30,_0x335744){return db[_0xe065('0x2a')][_0xe065('0x48')](_0x810f30[_0xe065('0x49')],{})[_0xe065('0x22')](respondWithResult(_0x335744,0xc9))['catch'](handleError(_0x335744,null));};exports[_0xe065('0x21')]=function(_0x5a2360,_0x45fe1f){if(_0x5a2360[_0xe065('0x49')]['id']){delete _0x5a2360[_0xe065('0x49')]['id'];}return db['WhatsappQueueReport'][_0xe065('0x47')]({'where':{'id':_0x5a2360[_0xe065('0x44')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x45fe1f,null))[_0xe065('0x22')](saveUpdates(_0x5a2360[_0xe065('0x49')],null))[_0xe065('0x22')](respondWithResult(_0x45fe1f,null))[_0xe065('0x42')](handleError(_0x45fe1f,null));};exports[_0xe065('0x23')]=function(_0x3095c8,_0x2ca55a){return db[_0xe065('0x2a')][_0xe065('0x47')]({'where':{'id':_0x3095c8[_0xe065('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ca55a,null))['then'](removeEntity(_0x2ca55a,null))['catch'](handleError(_0x2ca55a,null));};exports[_0xe065('0x4a')]=function(_0x48ed8e,_0x105bf7){return db[_0xe065('0x2a')][_0xe065('0x4a')]()['then'](respondWithResult(_0x105bf7,null))[_0xe065('0x42')](handleError(_0x105bf7,null));}; \ No newline at end of file +var _0xfef3=['offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappQueueReport','then','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','describe','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0xfef3,0x118));var _0x3fef=function(_0xf2f5de,_0x10038b){_0xf2f5de=_0xf2f5de-0x0;var _0x1be255=_0xfef3[_0xf2f5de];return _0x1be255;};'use strict';var emlformat=require(_0x3fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fef('0x2'));var moment=require(_0x3fef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x4'));var util=require(_0x3fef('0x5'));var path=require('path');var sox=require(_0x3fef('0x6'));var csv=require(_0x3fef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fef('0x8'));var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0x7'));var querystring=require(_0x3fef('0xe'));var Papa=require(_0x3fef('0xf'));var Redis=require(_0x3fef('0x10'));var authService=require(_0x3fef('0x11'));var qs=require(_0x3fef('0x12'));var as=require(_0x3fef('0x13'));var hardwareService=require(_0x3fef('0x14'));var logger=require('../../config/logger')(_0x3fef('0x15'));var utils=require(_0x3fef('0x16'));var config=require(_0x3fef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fef('0x18'))['db'];function respondWithStatusCode(_0x4c4a47,_0x2c99ff){_0x2c99ff=_0x2c99ff||0xcc;return function(_0x3d2c2d){if(_0x3d2c2d){return _0x4c4a47[_0x3fef('0x19')](_0x2c99ff);}return _0x4c4a47['status'](_0x2c99ff)[_0x3fef('0x1a')]();};}function respondWithResult(_0x4be62f,_0x15b757){_0x15b757=_0x15b757||0xc8;return function(_0x14c053){if(_0x14c053){return _0x4be62f['status'](_0x15b757)[_0x3fef('0x1b')](_0x14c053);}};}function respondWithFilteredResult(_0x177e28,_0x40b479){return function(_0x79b617){if(_0x79b617){var _0x395df0=typeof _0x40b479[_0x3fef('0x1c')]==='undefined'&&typeof _0x40b479[_0x3fef('0x1d')]===_0x3fef('0x1e');var _0x1ec282=_0x79b617[_0x3fef('0x1f')];var _0x1613ad=_0x395df0?0x0:_0x40b479[_0x3fef('0x1c')];var _0x53d993=_0x395df0?_0x79b617[_0x3fef('0x1f')]:_0x40b479[_0x3fef('0x1c')]+_0x40b479['limit'];var _0x2c7f36;if(_0x53d993>=_0x1ec282){_0x53d993=_0x1ec282;_0x2c7f36=0xc8;}else{_0x2c7f36=0xce;}_0x177e28[_0x3fef('0x20')](_0x2c7f36);return _0x177e28[_0x3fef('0x21')](_0x3fef('0x22'),_0x1613ad+'-'+_0x53d993+'/'+_0x1ec282)[_0x3fef('0x1b')](_0x79b617);}return null;};}function patchUpdates(_0x2b5226){return function(_0x451d11){try{jsonpatch[_0x3fef('0x23')](_0x451d11,_0x2b5226,!![]);}catch(_0x124e7c){return BPromise[_0x3fef('0x24')](_0x124e7c);}return _0x451d11[_0x3fef('0x25')]();};}function saveUpdates(_0x3bb110,_0x2eb578){return function(_0x39a8ea){if(_0x39a8ea){return _0x39a8ea[_0x3fef('0x26')](_0x3bb110)['then'](function(_0x5b56de){return _0x5b56de;});}return null;};}function removeEntity(_0x50025f,_0x378b03){return function(_0x3ba38d){if(_0x3ba38d){return _0x3ba38d[_0x3fef('0x27')]()['then'](function(){_0x50025f[_0x3fef('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45464b,_0x2c0848){return function(_0x64d3e6){if(!_0x64d3e6){_0x45464b[_0x3fef('0x19')](0x194);}return _0x64d3e6;};}function handleError(_0x30e17a,_0x492ea0){_0x492ea0=_0x492ea0||0x1f4;return function(_0x4b4dee){logger['error'](_0x4b4dee[_0x3fef('0x28')]);if(_0x4b4dee[_0x3fef('0x29')]){delete _0x4b4dee['name'];}_0x30e17a[_0x3fef('0x20')](_0x492ea0)[_0x3fef('0x2a')](_0x4b4dee);};}exports['index']=function(_0x30a954,_0x3bdf03){var _0xf892bb={},_0x2b73fb={},_0x3a1a0a={'count':0x0,'rows':[]};var _0x137849=_[_0x3fef('0x2b')](db['WhatsappQueueReport'][_0x3fef('0x2c')],function(_0xc20ce5){return{'name':_0xc20ce5[_0x3fef('0x2d')],'type':_0xc20ce5[_0x3fef('0x2e')]['key']};});_0x2b73fb[_0x3fef('0x2f')]=_['map'](_0x137849,_0x3fef('0x29'));_0x2b73fb[_0x3fef('0x30')]=_[_0x3fef('0x31')](_0x30a954[_0x3fef('0x30')]);_0x2b73fb[_0x3fef('0x32')]=_[_0x3fef('0x33')](_0x2b73fb[_0x3fef('0x2f')],_0x2b73fb[_0x3fef('0x30')]);_0xf892bb[_0x3fef('0x34')]=_[_0x3fef('0x33')](_0x2b73fb['model'],qs['fields'](_0x30a954[_0x3fef('0x30')]['fields']));_0xf892bb[_0x3fef('0x34')]=_0xf892bb[_0x3fef('0x34')][_0x3fef('0x35')]?_0xf892bb[_0x3fef('0x34')]:_0x2b73fb[_0x3fef('0x2f')];if(!_0x30a954[_0x3fef('0x30')][_0x3fef('0x36')](_0x3fef('0x37'))){_0xf892bb[_0x3fef('0x1d')]=qs[_0x3fef('0x1d')](_0x30a954[_0x3fef('0x30')][_0x3fef('0x1d')]);_0xf892bb[_0x3fef('0x1c')]=qs[_0x3fef('0x1c')](_0x30a954['query'][_0x3fef('0x1c')]);}_0xf892bb[_0x3fef('0x38')]=qs[_0x3fef('0x39')](_0x30a954[_0x3fef('0x30')][_0x3fef('0x39')]);_0xf892bb[_0x3fef('0x3a')]=qs['filters'](_['pick'](_0x30a954[_0x3fef('0x30')],_0x2b73fb[_0x3fef('0x32')]),_0x137849);if(_0x30a954[_0x3fef('0x30')][_0x3fef('0x3b')]){_0xf892bb[_0x3fef('0x3a')]=_[_0x3fef('0x3c')](_0xf892bb[_0x3fef('0x3a')],{'$or':_[_0x3fef('0x2b')](_0x137849,function(_0x1fa70f){if(_0x1fa70f[_0x3fef('0x2e')]!==_0x3fef('0x3d')){var _0x560aae={};_0x560aae[_0x1fa70f[_0x3fef('0x29')]]={'$like':'%'+_0x30a954[_0x3fef('0x30')]['filter']+'%'};return _0x560aae;}})});}_0xf892bb=_['merge']({},_0xf892bb,_0x30a954[_0x3fef('0x3e')]);var _0x3dda68={'where':_0xf892bb[_0x3fef('0x3a')]};return db[_0x3fef('0x3f')][_0x3fef('0x1f')](_0x3dda68)[_0x3fef('0x40')](function(_0x17aff8){_0x3a1a0a[_0x3fef('0x1f')]=_0x17aff8;if(_0x30a954['query'][_0x3fef('0x41')]){_0xf892bb[_0x3fef('0x42')]=[{'all':!![]}];}return db[_0x3fef('0x3f')][_0x3fef('0x43')](_0xf892bb);})[_0x3fef('0x40')](function(_0x2143ec){_0x3a1a0a[_0x3fef('0x44')]=_0x2143ec;return _0x3a1a0a;})[_0x3fef('0x40')](respondWithFilteredResult(_0x3bdf03,_0xf892bb))[_0x3fef('0x45')](handleError(_0x3bdf03,null));};exports[_0x3fef('0x46')]=function(_0x12867c,_0x254880){var _0x2e1d7f={'raw':!![],'where':{'id':_0x12867c[_0x3fef('0x47')]['id']}},_0x15d2c7={};_0x15d2c7['model']=_[_0x3fef('0x31')](db[_0x3fef('0x3f')][_0x3fef('0x2c')]);_0x15d2c7[_0x3fef('0x30')]=_[_0x3fef('0x31')](_0x12867c[_0x3fef('0x30')]);_0x15d2c7['filters']=_[_0x3fef('0x33')](_0x15d2c7['model'],_0x15d2c7[_0x3fef('0x30')]);_0x2e1d7f[_0x3fef('0x34')]=_['intersection'](_0x15d2c7[_0x3fef('0x2f')],qs['fields'](_0x12867c[_0x3fef('0x30')][_0x3fef('0x48')]));_0x2e1d7f[_0x3fef('0x34')]=_0x2e1d7f[_0x3fef('0x34')][_0x3fef('0x35')]?_0x2e1d7f[_0x3fef('0x34')]:_0x15d2c7[_0x3fef('0x2f')];if(_0x12867c[_0x3fef('0x30')][_0x3fef('0x41')]){_0x2e1d7f[_0x3fef('0x42')]=[{'all':!![]}];}_0x2e1d7f=_[_0x3fef('0x3c')]({},_0x2e1d7f,_0x12867c[_0x3fef('0x3e')]);return db[_0x3fef('0x3f')]['find'](_0x2e1d7f)[_0x3fef('0x40')](handleEntityNotFound(_0x254880,null))[_0x3fef('0x40')](respondWithResult(_0x254880,null))['catch'](handleError(_0x254880,null));};exports[_0x3fef('0x49')]=function(_0x4210d6,_0x2f00c0){return db['WhatsappQueueReport'][_0x3fef('0x49')](_0x4210d6[_0x3fef('0x4a')],{})['then'](respondWithResult(_0x2f00c0,0xc9))[_0x3fef('0x45')](handleError(_0x2f00c0,null));};exports['update']=function(_0x48322c,_0x15fb2c){if(_0x48322c['body']['id']){delete _0x48322c[_0x3fef('0x4a')]['id'];}return db[_0x3fef('0x3f')]['find']({'where':{'id':_0x48322c[_0x3fef('0x47')]['id']}})[_0x3fef('0x40')](handleEntityNotFound(_0x15fb2c,null))[_0x3fef('0x40')](saveUpdates(_0x48322c['body'],null))[_0x3fef('0x40')](respondWithResult(_0x15fb2c,null))[_0x3fef('0x45')](handleError(_0x15fb2c,null));};exports[_0x3fef('0x27')]=function(_0x5b1acb,_0x324f70){return db[_0x3fef('0x3f')][_0x3fef('0x4b')]({'where':{'id':_0x5b1acb[_0x3fef('0x47')]['id']}})[_0x3fef('0x40')](handleEntityNotFound(_0x324f70,null))['then'](removeEntity(_0x324f70,null))[_0x3fef('0x45')](handleError(_0x324f70,null));};exports[_0x3fef('0x4c')]=function(_0x39a4b1,_0x2b9275){return db[_0x3fef('0x3f')][_0x3fef('0x4c')]()[_0x3fef('0x40')](respondWithResult(_0x2b9275,null))[_0x3fef('0x45')](handleError(_0x2b9275,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index f26deb8..31c6697 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 _0x2d8c=['define','report_whatsapp_queue','uniqueid','util','moment','path','rimraf','../../config/environment'];(function(_0x4bfeda,_0x107bea){var _0x1b1b38=function(_0x129b3c){while(--_0x129b3c){_0x4bfeda['push'](_0x4bfeda['shift']());}};_0x1b1b38(++_0x107bea);}(_0x2d8c,0x18b));var _0xc2d8=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x2d8c[_0x3cf4d3];return _0x4e547b;};'use strict';var _=require('lodash');var util=require(_0xc2d8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc2d8('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2d8('0x2'));var rimraf=require(_0xc2d8('0x3'));var config=require(_0xc2d8('0x4'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x21f893,_0x3b598a){return _0x21f893[_0xc2d8('0x5')]('WhatsappQueueReport',attributes,{'tableName':_0xc2d8('0x6'),'paranoid':![],'indexes':[{'name':_0xc2d8('0x7'),'fields':[_0xc2d8('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e36=['define','WhatsappQueueReport','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0xdd642,_0x5949fd){var _0x409035=function(_0x412f3d){while(--_0x412f3d){_0xdd642['push'](_0xdd642['shift']());}};_0x409035(++_0x5949fd);}(_0x5e36,0x1d7));var _0x65e3=function(_0x166677,_0x436edb){_0x166677=_0x166677-0x0;var _0x2b57ba=_0x5e36[_0x166677];return _0x2b57ba;};'use strict';var _=require(_0x65e3('0x0'));var util=require(_0x65e3('0x1'));var logger=require('../../config/logger')(_0x65e3('0x2'));var moment=require(_0x65e3('0x3'));var BPromise=require(_0x65e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x65e3('0x5'));var rimraf=require(_0x65e3('0x6'));var config=require(_0x65e3('0x7'));var attributes=require(_0x65e3('0x8'));module[_0x65e3('0x9')]=function(_0x53259b,_0x3f17a4){return _0x53259b[_0x65e3('0xa')](_0x65e3('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x65e3('0xc'),'fields':[_0x65e3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 86b56d0..bcc4e3a 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 _0x451c=['code','message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3103c0,_0x29b196){var _0xc5d357=function(_0x45938a){while(--_0x45938a){_0x3103c0['push'](_0x3103c0['shift']());}};_0xc5d357(++_0x29b196);}(_0x451c,0x138));var _0xc451=function(_0x881c21,_0x22f1ce){_0x881c21=_0x881c21-0x0;var _0xcf0b84=_0x451c[_0x881c21];return _0xcf0b84;};'use strict';var _=require('lodash');var util=require(_0xc451('0x0'));var moment=require(_0xc451('0x1'));var BPromise=require('bluebird');var rs=require(_0xc451('0x2'));var fs=require('fs');var Redis=require(_0xc451('0x3'));var db=require(_0xc451('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc451('0x5'))(_0xc451('0x6'));var config=require(_0xc451('0x7'));var jayson=require(_0xc451('0x8'));var client=jayson[_0xc451('0x9')][_0xc451('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f5361,_0x57cc3d,_0x4c780e){return new BPromise(function(_0x294a02,_0x37c971){return client['request'](_0x4f5361,_0x4c780e)[_0xc451('0xb')](function(_0x3c10e9){logger[_0xc451('0xc')](_0xc451('0xd'),_0x57cc3d,_0xc451('0xe'));logger[_0xc451('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x57cc3d,'request\x20sent',JSON[_0xc451('0x10')](_0x3c10e9));if(_0x3c10e9[_0xc451('0x11')]){if(_0x3c10e9[_0xc451('0x11')][_0xc451('0x12')]===0x1f4){logger[_0xc451('0x11')](_0xc451('0xd'),_0x57cc3d,_0x3c10e9['error'][_0xc451('0x13')]);return _0x37c971(_0x3c10e9[_0xc451('0x11')][_0xc451('0x13')]);}logger['error'](_0xc451('0xd'),_0x57cc3d,_0x3c10e9['error'][_0xc451('0x13')]);return _0x294a02(_0x3c10e9[_0xc451('0x11')][_0xc451('0x13')]);}else{logger[_0xc451('0xc')](_0xc451('0xd'),_0x57cc3d,_0xc451('0xe'));_0x294a02(_0x3c10e9[_0xc451('0x14')][_0xc451('0x13')]);}})[_0xc451('0x15')](function(_0xa22136){logger[_0xc451('0x11')](_0xc451('0xd'),_0x57cc3d,_0xa22136);_0x37c971(_0xa22136);});});}exports['CreateWhatsappQueueReport']=function(_0x471868){var _0x1584fc=this;return new Promise(function(_0x4fc6c6,_0x3b2e51){return db[_0xc451('0x16')][_0xc451('0x17')](_0x471868[_0xc451('0x18')],{'raw':_0x471868['options']?_0x471868[_0xc451('0x19')][_0xc451('0x1a')]===undefined?!![]:![]:!![]})[_0xc451('0xb')](function(_0x2d2555){logger['info']('CreateWhatsappQueueReport',_0x471868);logger[_0xc451('0xf')](_0xc451('0x1b'),_0x471868,JSON[_0xc451('0x10')](_0x2d2555));_0x4fc6c6(_0x2d2555);})[_0xc451('0x15')](function(_0x1f1134){logger[_0xc451('0x11')](_0xc451('0x1b'),_0x1f1134['message'],_0x471868);_0x3b2e51(_0x1584fc['error'](0x1f4,_0x1f1134[_0xc451('0x13')]));});});};exports[_0xc451('0x1c')]=function(_0x2029e3){var _0x520d34=this;return new Promise(function(_0x1cbda1,_0x158f17){return db['WhatsappQueueReport'][_0xc451('0x1d')](_0x2029e3[_0xc451('0x18')],{'raw':_0x2029e3[_0xc451('0x19')]?_0x2029e3[_0xc451('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2029e3[_0xc451('0x19')]?_0x2029e3[_0xc451('0x19')][_0xc451('0x1e')]||null:null,'attributes':_0x2029e3[_0xc451('0x19')]?_0x2029e3[_0xc451('0x19')][_0xc451('0x1f')]||null:null,'limit':_0x2029e3[_0xc451('0x19')]?_0x2029e3['options'][_0xc451('0x20')]||null:null})[_0xc451('0xb')](function(_0x7d0a53){logger[_0xc451('0xc')](_0xc451('0x1c'),_0x2029e3);logger[_0xc451('0xf')]('UpdateWhatsappQueueReport',_0x2029e3,JSON[_0xc451('0x10')](_0x7d0a53));_0x1cbda1(_0x7d0a53);})[_0xc451('0x15')](function(_0x55384e){logger[_0xc451('0x11')](_0xc451('0x1c'),_0x55384e[_0xc451('0x13')],_0x2029e3);_0x158f17(_0x520d34[_0xc451('0x11')](0x1f4,_0x55384e[_0xc451('0x13')]));});});}; \ No newline at end of file +var _0xc2af=['where','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','create','body','options','debug','UpdateWhatsappQueueReport','WhatsappQueueReport','update','raw'];(function(_0x7277f,_0x86fcf9){var _0xf31450=function(_0x1d571d){while(--_0x1d571d){_0x7277f['push'](_0x7277f['shift']());}};_0xf31450(++_0x86fcf9);}(_0xc2af,0x1bc));var _0xfc2a=function(_0xe94b0b,_0x3e28d5){_0xe94b0b=_0xe94b0b-0x0;var _0x2be2c7=_0xc2af[_0xe94b0b];return _0x2be2c7;};'use strict';var _=require(_0xfc2a('0x0'));var util=require('util');var moment=require(_0xfc2a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfc2a('0x2'));var fs=require('fs');var Redis=require(_0xfc2a('0x3'));var db=require(_0xfc2a('0x4'))['db'];var utils=require(_0xfc2a('0x5'));var logger=require(_0xfc2a('0x6'))(_0xfc2a('0x7'));var config=require(_0xfc2a('0x8'));var jayson=require(_0xfc2a('0x9'));var client=jayson['client'][_0xfc2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c193b,_0x4330c3,_0x5cc7fc){return new BPromise(function(_0x1b96b1,_0x1427a6){return client[_0xfc2a('0xb')](_0x4c193b,_0x5cc7fc)[_0xfc2a('0xc')](function(_0x4c826a){logger[_0xfc2a('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4330c3,_0xfc2a('0xe'));logger['debug'](_0xfc2a('0xf'),_0x4330c3,_0xfc2a('0xe'),JSON[_0xfc2a('0x10')](_0x4c826a));if(_0x4c826a['error']){if(_0x4c826a['error'][_0xfc2a('0x11')]===0x1f4){logger[_0xfc2a('0x12')](_0xfc2a('0x13'),_0x4330c3,_0x4c826a[_0xfc2a('0x12')][_0xfc2a('0x14')]);return _0x1427a6(_0x4c826a[_0xfc2a('0x12')][_0xfc2a('0x14')]);}logger[_0xfc2a('0x12')](_0xfc2a('0x13'),_0x4330c3,_0x4c826a['error']['message']);return _0x1b96b1(_0x4c826a[_0xfc2a('0x12')][_0xfc2a('0x14')]);}else{logger['info'](_0xfc2a('0x13'),_0x4330c3,_0xfc2a('0xe'));_0x1b96b1(_0x4c826a[_0xfc2a('0x15')][_0xfc2a('0x14')]);}})[_0xfc2a('0x16')](function(_0xa93aa7){logger[_0xfc2a('0x12')](_0xfc2a('0x13'),_0x4330c3,_0xa93aa7);_0x1427a6(_0xa93aa7);});});}exports[_0xfc2a('0x17')]=function(_0x1e1524){var _0x43edb3=this;return new Promise(function(_0x39bcb2,_0x27fb82){return db['WhatsappQueueReport'][_0xfc2a('0x18')](_0x1e1524[_0xfc2a('0x19')],{'raw':_0x1e1524['options']?_0x1e1524[_0xfc2a('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3e88fe){logger[_0xfc2a('0xd')](_0xfc2a('0x17'),_0x1e1524);logger[_0xfc2a('0x1b')](_0xfc2a('0x17'),_0x1e1524,JSON['stringify'](_0x3e88fe));_0x39bcb2(_0x3e88fe);})[_0xfc2a('0x16')](function(_0x4908d7){logger['error']('CreateWhatsappQueueReport',_0x4908d7[_0xfc2a('0x14')],_0x1e1524);_0x27fb82(_0x43edb3['error'](0x1f4,_0x4908d7['message']));});});};exports[_0xfc2a('0x1c')]=function(_0x10396d){var _0x2c732c=this;return new Promise(function(_0x7c9bb5,_0x55ed0a){return db[_0xfc2a('0x1d')][_0xfc2a('0x1e')](_0x10396d[_0xfc2a('0x19')],{'raw':_0x10396d['options']?_0x10396d[_0xfc2a('0x1a')][_0xfc2a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10396d['options']?_0x10396d['options'][_0xfc2a('0x20')]||null:null,'attributes':_0x10396d['options']?_0x10396d[_0xfc2a('0x1a')][_0xfc2a('0x21')]||null:null,'limit':_0x10396d[_0xfc2a('0x1a')]?_0x10396d[_0xfc2a('0x1a')]['limit']||null:null})['then'](function(_0x5f4165){logger[_0xfc2a('0xd')](_0xfc2a('0x1c'),_0x10396d);logger['debug'](_0xfc2a('0x1c'),_0x10396d,JSON[_0xfc2a('0x10')](_0x5f4165));_0x7c9bb5(_0x5f4165);})[_0xfc2a('0x16')](function(_0xec7c14){logger[_0xfc2a('0x12')](_0xfc2a('0x1c'),_0xec7c14[_0xfc2a('0x14')],_0x10396d);_0x55ed0a(_0x2c732c[_0xfc2a('0x12')](0x1f4,_0xec7c14[_0xfc2a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 31ec0ef..0e8f6ef 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 _0x9725=['multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x4124b8,_0x39a5fb){var _0xdd927=function(_0x2fb8ab){while(--_0x2fb8ab){_0x4124b8['push'](_0x4124b8['shift']());}};_0xdd927(++_0x39a5fb);}(_0x9725,0xdc));var _0x5972=function(_0x232cc4,_0xa59e24){_0x232cc4=_0x232cc4-0x0;var _0x55bd33=_0x9725[_0x232cc4];return _0x55bd33;};'use strict';var multer=require(_0x5972('0x0'));var util=require('util');var path=require(_0x5972('0x1'));var timeout=require('connect-timeout');var express=require(_0x5972('0x2'));var router=express[_0x5972('0x3')]();var fs_extra=require(_0x5972('0x4'));var auth=require(_0x5972('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5972('0x6'));var controller=require(_0x5972('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5972('0x8')](_0x5972('0x9'),auth[_0x5972('0xa')](),controller[_0x5972('0xb')]);router[_0x5972('0x8')](_0x5972('0xc'),auth['isAuthenticated'](),controller[_0x5972('0xd')]);router[_0x5972('0xe')]('/',auth['isAuthenticated'](),controller[_0x5972('0xf')]);router[_0x5972('0x10')](_0x5972('0xc'),auth[_0x5972('0xa')](),controller[_0x5972('0x11')]);router[_0x5972('0x12')](_0x5972('0xc'),auth[_0x5972('0xa')](),controller['destroy']);module[_0x5972('0x13')]=router; \ No newline at end of file +var _0xd5cd=['exports','multer','express','Router','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','update','delete','destroy'];(function(_0x285218,_0x23421b){var _0x40afaf=function(_0x41379c){while(--_0x41379c){_0x285218['push'](_0x285218['shift']());}};_0x40afaf(++_0x23421b);}(_0xd5cd,0x1dd));var _0xdd5c=function(_0x3a95cd,_0x11a89b){_0x3a95cd=_0x3a95cd-0x0;var _0x29bcfb=_0xd5cd[_0x3a95cd];return _0x29bcfb;};'use strict';var multer=require(_0xdd5c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdd5c('0x1'));var router=express[_0xdd5c('0x2')]();var fs_extra=require(_0xdd5c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdd5c('0x4'));var config=require('../../config/environment');var controller=require(_0xdd5c('0x5'));router['get']('/',auth[_0xdd5c('0x6')](),controller['index']);router[_0xdd5c('0x7')](_0xdd5c('0x8'),auth['isAuthenticated'](),controller[_0xdd5c('0x9')]);router[_0xdd5c('0x7')](_0xdd5c('0xa'),auth[_0xdd5c('0x6')](),controller[_0xdd5c('0xb')]);router[_0xdd5c('0xc')]('/',auth[_0xdd5c('0x6')](),controller['create']);router['put'](_0xdd5c('0xa'),auth[_0xdd5c('0x6')](),controller[_0xdd5c('0xd')]);router[_0xdd5c('0xe')](_0xdd5c('0xa'),auth[_0xdd5c('0x6')](),controller[_0xdd5c('0xf')]);module[_0xdd5c('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5e02846..cfaaa08 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 _0x20df=['STRING','ENUM','agent','queue','DATE','sequelize','exports'];(function(_0x9a0b66,_0x3e2037){var _0x4fcc09=function(_0x34c33d){while(--_0x34c33d){_0x9a0b66['push'](_0x9a0b66['shift']());}};_0x4fcc09(++_0x3e2037);}(_0x20df,0x7c));var _0xf20d=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x20df[_0x50aa2e];return _0x5e07f0;};'use strict';var Sequelize=require(_0xf20d('0x0'));module[_0xf20d('0x1')]={'uniqueid':{'type':Sequelize[_0xf20d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf20d('0x3')]('account',_0xf20d('0x4'),_0xf20d('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf20d('0x6')]}}; \ No newline at end of file +var _0x5a13=['agent','queue','exports','STRING','ENUM','account'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a13,0x92));var _0x35a1=function(_0x494692,_0x37bd69){_0x494692=_0x494692-0x0;var _0x3cfd51=_0x5a13[_0x494692];return _0x3cfd51;};'use strict';var Sequelize=require('sequelize');module[_0x35a1('0x0')]={'uniqueid':{'type':Sequelize[_0x35a1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x35a1('0x2')](_0x35a1('0x3'),_0x35a1('0x4'),_0x35a1('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a21865f..f15eac3 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 _0xed3d=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappTransferReport','include','rows','params','keys','length','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x4df1d2,_0x46f156){var _0x23abac=function(_0x9b0eb2){while(--_0x9b0eb2){_0x4df1d2['push'](_0x4df1d2['shift']());}};_0x23abac(++_0x46f156);}(_0xed3d,0xe6));var _0xded3=function(_0x4f8ab6,_0x1d5e00){_0x4f8ab6=_0x4f8ab6-0x0;var _0x1db351=_0xed3d[_0x4f8ab6];return _0x1db351;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xded3('0x0'));var zipdir=require(_0xded3('0x1'));var jsonpatch=require(_0xded3('0x2'));var rp=require('request-promise');var moment=require(_0xded3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xded3('0x4'));var util=require(_0xded3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xded3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xded3('0x7'));var _=require(_0xded3('0x8'));var squel=require('squel');var crypto=require(_0xded3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xded3('0xa'));var toCsv=require(_0xded3('0x6'));var querystring=require(_0xded3('0xb'));var Papa=require(_0xded3('0xc'));var Redis=require('ioredis');var authService=require(_0xded3('0xd'));var qs=require(_0xded3('0xe'));var as=require(_0xded3('0xf'));var hardwareService=require(_0xded3('0x10'));var logger=require(_0xded3('0x11'))(_0xded3('0x12'));var utils=require('../../config/utils');var config=require(_0xded3('0x13'));var licenseUtil=require(_0xded3('0x14'));var db=require(_0xded3('0x15'))['db'];function respondWithStatusCode(_0x9d84c,_0x5c8fbd){_0x5c8fbd=_0x5c8fbd||0xcc;return function(_0x1c0414){if(_0x1c0414){return _0x9d84c[_0xded3('0x16')](_0x5c8fbd);}return _0x9d84c[_0xded3('0x17')](_0x5c8fbd)[_0xded3('0x18')]();};}function respondWithResult(_0x43716c,_0x24e44e){_0x24e44e=_0x24e44e||0xc8;return function(_0x268336){if(_0x268336){return _0x43716c[_0xded3('0x17')](_0x24e44e)['json'](_0x268336);}};}function respondWithFilteredResult(_0x1881aa,_0x2b6e36){return function(_0x258338){if(_0x258338){var _0x19e400=typeof _0x2b6e36[_0xded3('0x19')]==='undefined'&&typeof _0x2b6e36[_0xded3('0x1a')]===_0xded3('0x1b');var _0xc7becb=_0x258338['count'];var _0x8b134e=_0x19e400?0x0:_0x2b6e36['offset'];var _0x2a0727=_0x19e400?_0x258338[_0xded3('0x1c')]:_0x2b6e36[_0xded3('0x19')]+_0x2b6e36[_0xded3('0x1a')];var _0x4debac;if(_0x2a0727>=_0xc7becb){_0x2a0727=_0xc7becb;_0x4debac=0xc8;}else{_0x4debac=0xce;}_0x1881aa['status'](_0x4debac);return _0x1881aa[_0xded3('0x1d')](_0xded3('0x1e'),_0x8b134e+'-'+_0x2a0727+'/'+_0xc7becb)[_0xded3('0x1f')](_0x258338);}return null;};}function patchUpdates(_0xa25e10){return function(_0x2b2868){try{jsonpatch[_0xded3('0x20')](_0x2b2868,_0xa25e10,!![]);}catch(_0x112d57){return BPromise[_0xded3('0x21')](_0x112d57);}return _0x2b2868[_0xded3('0x22')]();};}function saveUpdates(_0x20ada5,_0x5595f9){return function(_0x45330b){if(_0x45330b){return _0x45330b[_0xded3('0x23')](_0x20ada5)[_0xded3('0x24')](function(_0x218c3f){return _0x218c3f;});}return null;};}function removeEntity(_0xb44978,_0x5611b4){return function(_0x82740c){if(_0x82740c){return _0x82740c['destroy']()[_0xded3('0x24')](function(){_0xb44978[_0xded3('0x17')](0xcc)[_0xded3('0x18')]();});}};}function handleEntityNotFound(_0x4b7775,_0x2550d6){return function(_0x2bb0bd){if(!_0x2bb0bd){_0x4b7775['sendStatus'](0x194);}return _0x2bb0bd;};}function handleError(_0x33804f,_0x1688af){_0x1688af=_0x1688af||0x1f4;return function(_0x21acc3){logger[_0xded3('0x25')](_0x21acc3['stack']);if(_0x21acc3[_0xded3('0x26')]){delete _0x21acc3[_0xded3('0x26')];}_0x33804f[_0xded3('0x17')](_0x1688af)['send'](_0x21acc3);};}exports['index']=function(_0x15a069,_0x2e5c95){var _0x4a5080={},_0x1b35da={},_0x10876c={'count':0x0,'rows':[]};var _0x1b4a8d=_[_0xded3('0x27')](db['WhatsappTransferReport'][_0xded3('0x28')],function(_0x210bb6){return{'name':_0x210bb6[_0xded3('0x29')],'type':_0x210bb6[_0xded3('0x2a')][_0xded3('0x2b')]};});_0x1b35da[_0xded3('0x2c')]=_[_0xded3('0x27')](_0x1b4a8d,'name');_0x1b35da[_0xded3('0x2d')]=_['keys'](_0x15a069[_0xded3('0x2d')]);_0x1b35da[_0xded3('0x2e')]=_[_0xded3('0x2f')](_0x1b35da[_0xded3('0x2c')],_0x1b35da['query']);_0x4a5080[_0xded3('0x30')]=_[_0xded3('0x2f')](_0x1b35da[_0xded3('0x2c')],qs[_0xded3('0x31')](_0x15a069['query']['fields']));_0x4a5080[_0xded3('0x30')]=_0x4a5080[_0xded3('0x30')]['length']?_0x4a5080['attributes']:_0x1b35da[_0xded3('0x2c')];if(!_0x15a069[_0xded3('0x2d')]['hasOwnProperty'](_0xded3('0x32'))){_0x4a5080[_0xded3('0x1a')]=qs[_0xded3('0x1a')](_0x15a069[_0xded3('0x2d')][_0xded3('0x1a')]);_0x4a5080[_0xded3('0x19')]=qs['offset'](_0x15a069[_0xded3('0x2d')][_0xded3('0x19')]);}_0x4a5080['order']=qs[_0xded3('0x33')](_0x15a069[_0xded3('0x2d')]['sort']);_0x4a5080[_0xded3('0x34')]=qs[_0xded3('0x2e')](_[_0xded3('0x35')](_0x15a069[_0xded3('0x2d')],_0x1b35da[_0xded3('0x2e')]),_0x1b4a8d);if(_0x15a069[_0xded3('0x2d')][_0xded3('0x36')]){_0x4a5080[_0xded3('0x34')]=_[_0xded3('0x37')](_0x4a5080[_0xded3('0x34')],{'$or':_[_0xded3('0x27')](_0x1b4a8d,function(_0x5da689){if(_0x5da689[_0xded3('0x2a')]!==_0xded3('0x38')){var _0x1775ec={};_0x1775ec[_0x5da689[_0xded3('0x26')]]={'$like':'%'+_0x15a069['query'][_0xded3('0x36')]+'%'};return _0x1775ec;}})});}_0x4a5080=_['merge']({},_0x4a5080,_0x15a069[_0xded3('0x39')]);var _0x292558={'where':_0x4a5080['where']};return db[_0xded3('0x3a')]['count'](_0x292558)['then'](function(_0x2825c3){_0x10876c[_0xded3('0x1c')]=_0x2825c3;if(_0x15a069[_0xded3('0x2d')]['includeAll']){_0x4a5080[_0xded3('0x3b')]=[{'all':!![]}];}return db[_0xded3('0x3a')]['findAll'](_0x4a5080);})[_0xded3('0x24')](function(_0x2c912c){_0x10876c[_0xded3('0x3c')]=_0x2c912c;return _0x10876c;})[_0xded3('0x24')](respondWithFilteredResult(_0x2e5c95,_0x4a5080))['catch'](handleError(_0x2e5c95,null));};exports['show']=function(_0x3f411d,_0x19693a){var _0x3f928e={'raw':!![],'where':{'id':_0x3f411d[_0xded3('0x3d')]['id']}},_0x5b9df6={};_0x5b9df6[_0xded3('0x2c')]=_[_0xded3('0x3e')](db['WhatsappTransferReport'][_0xded3('0x28')]);_0x5b9df6[_0xded3('0x2d')]=_['keys'](_0x3f411d['query']);_0x5b9df6[_0xded3('0x2e')]=_[_0xded3('0x2f')](_0x5b9df6[_0xded3('0x2c')],_0x5b9df6['query']);_0x3f928e['attributes']=_[_0xded3('0x2f')](_0x5b9df6[_0xded3('0x2c')],qs[_0xded3('0x31')](_0x3f411d[_0xded3('0x2d')][_0xded3('0x31')]));_0x3f928e[_0xded3('0x30')]=_0x3f928e[_0xded3('0x30')][_0xded3('0x3f')]?_0x3f928e[_0xded3('0x30')]:_0x5b9df6['model'];if(_0x3f411d['query']['includeAll']){_0x3f928e[_0xded3('0x3b')]=[{'all':!![]}];}_0x3f928e=_['merge']({},_0x3f928e,_0x3f411d['options']);return db[_0xded3('0x3a')][_0xded3('0x40')](_0x3f928e)[_0xded3('0x24')](handleEntityNotFound(_0x19693a,null))['then'](respondWithResult(_0x19693a,null))[_0xded3('0x41')](handleError(_0x19693a,null));};exports[_0xded3('0x42')]=function(_0x5cc320,_0x3b7348){return db['WhatsappTransferReport']['create'](_0x5cc320[_0xded3('0x43')],{})[_0xded3('0x24')](respondWithResult(_0x3b7348,0xc9))['catch'](handleError(_0x3b7348,null));};exports[_0xded3('0x23')]=function(_0x3b35fc,_0x173c27){if(_0x3b35fc[_0xded3('0x43')]['id']){delete _0x3b35fc[_0xded3('0x43')]['id'];}return db[_0xded3('0x3a')][_0xded3('0x40')]({'where':{'id':_0x3b35fc[_0xded3('0x3d')]['id']}})[_0xded3('0x24')](handleEntityNotFound(_0x173c27,null))[_0xded3('0x24')](saveUpdates(_0x3b35fc['body'],null))[_0xded3('0x24')](respondWithResult(_0x173c27,null))[_0xded3('0x41')](handleError(_0x173c27,null));};exports[_0xded3('0x44')]=function(_0x444e7d,_0x38a3f1){return db['WhatsappTransferReport'][_0xded3('0x40')]({'where':{'id':_0x444e7d[_0xded3('0x3d')]['id']}})[_0xded3('0x24')](handleEntityNotFound(_0x38a3f1,null))['then'](removeEntity(_0x38a3f1,null))[_0xded3('0x41')](handleError(_0x38a3f1,null));};exports['describe']=function(_0x3750cb,_0xf59ea1){return db[_0xded3('0x3a')][_0xded3('0x45')]()['then'](respondWithResult(_0xf59ea1,null))['catch'](handleError(_0xf59ea1,null));}; \ No newline at end of file +var _0x260d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','error','stack','name','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','body','destroy','describe','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x15b1b8,_0x2d2c17){var _0x34029d=function(_0x216ea5){while(--_0x216ea5){_0x15b1b8['push'](_0x15b1b8['shift']());}};_0x34029d(++_0x2d2c17);}(_0x260d,0xc4));var _0xd260=function(_0x4124a4,_0x5f17a0){_0x4124a4=_0x4124a4-0x0;var _0x5cc2e7=_0x260d[_0x4124a4];return _0x5cc2e7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd260('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd260('0x1'));var Mustache=require(_0xd260('0x2'));var util=require('util');var path=require(_0xd260('0x3'));var sox=require(_0xd260('0x4'));var csv=require(_0xd260('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd260('0x6'));var _=require(_0xd260('0x7'));var squel=require(_0xd260('0x8'));var crypto=require(_0xd260('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd260('0xa'));var Papa=require(_0xd260('0xb'));var Redis=require(_0xd260('0xc'));var authService=require(_0xd260('0xd'));var qs=require(_0xd260('0xe'));var as=require(_0xd260('0xf'));var hardwareService=require(_0xd260('0x10'));var logger=require(_0xd260('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd260('0x12'));var licenseUtil=require(_0xd260('0x13'));var db=require(_0xd260('0x14'))['db'];function respondWithStatusCode(_0x417c97,_0xb8682f){_0xb8682f=_0xb8682f||0xcc;return function(_0x3e573c){if(_0x3e573c){return _0x417c97[_0xd260('0x15')](_0xb8682f);}return _0x417c97[_0xd260('0x16')](_0xb8682f)[_0xd260('0x17')]();};}function respondWithResult(_0x13027e,_0x2cc44c){_0x2cc44c=_0x2cc44c||0xc8;return function(_0x5cb8fb){if(_0x5cb8fb){return _0x13027e[_0xd260('0x16')](_0x2cc44c)[_0xd260('0x18')](_0x5cb8fb);}};}function respondWithFilteredResult(_0x144494,_0x47340f){return function(_0x2ccc2e){if(_0x2ccc2e){var _0x39641f=typeof _0x47340f[_0xd260('0x19')]===_0xd260('0x1a')&&typeof _0x47340f[_0xd260('0x1b')]===_0xd260('0x1a');var _0x3de5b3=_0x2ccc2e[_0xd260('0x1c')];var _0x54f370=_0x39641f?0x0:_0x47340f[_0xd260('0x19')];var _0x131a53=_0x39641f?_0x2ccc2e[_0xd260('0x1c')]:_0x47340f[_0xd260('0x19')]+_0x47340f[_0xd260('0x1b')];var _0x165114;if(_0x131a53>=_0x3de5b3){_0x131a53=_0x3de5b3;_0x165114=0xc8;}else{_0x165114=0xce;}_0x144494[_0xd260('0x16')](_0x165114);return _0x144494[_0xd260('0x1d')]('Content-Range',_0x54f370+'-'+_0x131a53+'/'+_0x3de5b3)[_0xd260('0x18')](_0x2ccc2e);}return null;};}function patchUpdates(_0x388e13){return function(_0x2da5ec){try{jsonpatch[_0xd260('0x1e')](_0x2da5ec,_0x388e13,!![]);}catch(_0x401052){return BPromise['reject'](_0x401052);}return _0x2da5ec[_0xd260('0x1f')]();};}function saveUpdates(_0x1366a8,_0x304cce){return function(_0x3f35a9){if(_0x3f35a9){return _0x3f35a9['update'](_0x1366a8)[_0xd260('0x20')](function(_0x2c9a03){return _0x2c9a03;});}return null;};}function removeEntity(_0x4267b1,_0xacd283){return function(_0x6e1b58){if(_0x6e1b58){return _0x6e1b58['destroy']()[_0xd260('0x20')](function(){_0x4267b1[_0xd260('0x16')](0xcc)[_0xd260('0x17')]();});}};}function handleEntityNotFound(_0x1801a7,_0x4f91aa){return function(_0x1a6fc1){if(!_0x1a6fc1){_0x1801a7[_0xd260('0x15')](0x194);}return _0x1a6fc1;};}function handleError(_0xb6c5e6,_0x489c2d){_0x489c2d=_0x489c2d||0x1f4;return function(_0xc64d2c){logger[_0xd260('0x21')](_0xc64d2c[_0xd260('0x22')]);if(_0xc64d2c[_0xd260('0x23')]){delete _0xc64d2c[_0xd260('0x23')];}_0xb6c5e6[_0xd260('0x16')](_0x489c2d)['send'](_0xc64d2c);};}exports['index']=function(_0x404a54,_0x22ec23){var _0x439817={},_0x3a80be={},_0xda6d76={'count':0x0,'rows':[]};var _0x78921d=_['map'](db[_0xd260('0x24')][_0xd260('0x25')],function(_0x4b3cca){return{'name':_0x4b3cca[_0xd260('0x26')],'type':_0x4b3cca[_0xd260('0x27')][_0xd260('0x28')]};});_0x3a80be[_0xd260('0x29')]=_[_0xd260('0x2a')](_0x78921d,_0xd260('0x23'));_0x3a80be[_0xd260('0x2b')]=_[_0xd260('0x2c')](_0x404a54[_0xd260('0x2b')]);_0x3a80be['filters']=_['intersection'](_0x3a80be['model'],_0x3a80be['query']);_0x439817['attributes']=_[_0xd260('0x2d')](_0x3a80be[_0xd260('0x29')],qs[_0xd260('0x2e')](_0x404a54['query'][_0xd260('0x2e')]));_0x439817[_0xd260('0x2f')]=_0x439817[_0xd260('0x2f')][_0xd260('0x30')]?_0x439817[_0xd260('0x2f')]:_0x3a80be['model'];if(!_0x404a54[_0xd260('0x2b')][_0xd260('0x31')](_0xd260('0x32'))){_0x439817[_0xd260('0x1b')]=qs['limit'](_0x404a54[_0xd260('0x2b')][_0xd260('0x1b')]);_0x439817['offset']=qs[_0xd260('0x19')](_0x404a54[_0xd260('0x2b')][_0xd260('0x19')]);}_0x439817[_0xd260('0x33')]=qs['sort'](_0x404a54[_0xd260('0x2b')][_0xd260('0x34')]);_0x439817[_0xd260('0x35')]=qs[_0xd260('0x36')](_[_0xd260('0x37')](_0x404a54[_0xd260('0x2b')],_0x3a80be[_0xd260('0x36')]),_0x78921d);if(_0x404a54['query'][_0xd260('0x38')]){_0x439817[_0xd260('0x35')]=_[_0xd260('0x39')](_0x439817[_0xd260('0x35')],{'$or':_['map'](_0x78921d,function(_0x4d7025){if(_0x4d7025[_0xd260('0x27')]!==_0xd260('0x3a')){var _0x48d076={};_0x48d076[_0x4d7025[_0xd260('0x23')]]={'$like':'%'+_0x404a54['query'][_0xd260('0x38')]+'%'};return _0x48d076;}})});}_0x439817=_[_0xd260('0x39')]({},_0x439817,_0x404a54['options']);var _0x2748ae={'where':_0x439817['where']};return db[_0xd260('0x24')]['count'](_0x2748ae)['then'](function(_0xc1b4de){_0xda6d76[_0xd260('0x1c')]=_0xc1b4de;if(_0x404a54[_0xd260('0x2b')][_0xd260('0x3b')]){_0x439817[_0xd260('0x3c')]=[{'all':!![]}];}return db[_0xd260('0x24')][_0xd260('0x3d')](_0x439817);})['then'](function(_0xbb3bda){_0xda6d76[_0xd260('0x3e')]=_0xbb3bda;return _0xda6d76;})[_0xd260('0x20')](respondWithFilteredResult(_0x22ec23,_0x439817))['catch'](handleError(_0x22ec23,null));};exports['show']=function(_0x579e2b,_0x469b6f){var _0x108899={'raw':!![],'where':{'id':_0x579e2b[_0xd260('0x3f')]['id']}},_0x55e308={};_0x55e308[_0xd260('0x29')]=_['keys'](db[_0xd260('0x24')][_0xd260('0x25')]);_0x55e308[_0xd260('0x2b')]=_[_0xd260('0x2c')](_0x579e2b[_0xd260('0x2b')]);_0x55e308[_0xd260('0x36')]=_[_0xd260('0x2d')](_0x55e308[_0xd260('0x29')],_0x55e308[_0xd260('0x2b')]);_0x108899[_0xd260('0x2f')]=_[_0xd260('0x2d')](_0x55e308[_0xd260('0x29')],qs[_0xd260('0x2e')](_0x579e2b[_0xd260('0x2b')][_0xd260('0x2e')]));_0x108899['attributes']=_0x108899[_0xd260('0x2f')][_0xd260('0x30')]?_0x108899[_0xd260('0x2f')]:_0x55e308['model'];if(_0x579e2b['query'][_0xd260('0x3b')]){_0x108899[_0xd260('0x3c')]=[{'all':!![]}];}_0x108899=_[_0xd260('0x39')]({},_0x108899,_0x579e2b[_0xd260('0x40')]);return db['WhatsappTransferReport'][_0xd260('0x41')](_0x108899)[_0xd260('0x20')](handleEntityNotFound(_0x469b6f,null))[_0xd260('0x20')](respondWithResult(_0x469b6f,null))[_0xd260('0x42')](handleError(_0x469b6f,null));};exports['create']=function(_0x2deaba,_0x32edb0){return db[_0xd260('0x24')]['create'](_0x2deaba['body'],{})[_0xd260('0x20')](respondWithResult(_0x32edb0,0xc9))[_0xd260('0x42')](handleError(_0x32edb0,null));};exports['update']=function(_0x30f38d,_0x1d3549){if(_0x30f38d[_0xd260('0x43')]['id']){delete _0x30f38d[_0xd260('0x43')]['id'];}return db[_0xd260('0x24')][_0xd260('0x41')]({'where':{'id':_0x30f38d[_0xd260('0x3f')]['id']}})[_0xd260('0x20')](handleEntityNotFound(_0x1d3549,null))[_0xd260('0x20')](saveUpdates(_0x30f38d[_0xd260('0x43')],null))['then'](respondWithResult(_0x1d3549,null))[_0xd260('0x42')](handleError(_0x1d3549,null));};exports[_0xd260('0x44')]=function(_0x508964,_0x1baf2f){return db[_0xd260('0x24')][_0xd260('0x41')]({'where':{'id':_0x508964[_0xd260('0x3f')]['id']}})[_0xd260('0x20')](handleEntityNotFound(_0x1baf2f,null))[_0xd260('0x20')](removeEntity(_0x1baf2f,null))[_0xd260('0x42')](handleError(_0x1baf2f,null));};exports['describe']=function(_0x1c0f32,_0x3240aa){return db[_0xd260('0x24')][_0xd260('0x45')]()[_0xd260('0x20')](respondWithResult(_0x3240aa,null))['catch'](handleError(_0x3240aa,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 403f796..78bfc80 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 _0x1ed4=['uniqueid','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x99db7d,_0x42bfb4){var _0x467824=function(_0x517e50){while(--_0x517e50){_0x99db7d['push'](_0x99db7d['shift']());}};_0x467824(++_0x42bfb4);}(_0x1ed4,0xdd));var _0x41ed=function(_0x430ba3,_0x2972b2){_0x430ba3=_0x430ba3-0x0;var _0xd3353d=_0x1ed4[_0x430ba3];return _0xd3353d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x41ed('0x0'))(_0x41ed('0x1'));var moment=require(_0x41ed('0x2'));var BPromise=require(_0x41ed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x41ed('0x4'));var config=require(_0x41ed('0x5'));var attributes=require('./whatsappTransferReport.attributes');module[_0x41ed('0x6')]=function(_0x2c8666,_0x304f48){return _0x2c8666[_0x41ed('0x7')](_0x41ed('0x8'),attributes,{'tableName':_0x41ed('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x41ed('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a29=['api','moment','bluebird','request-promise','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger'];(function(_0x3995dd,_0x24f96f){var _0x410f8a=function(_0xe2c273){while(--_0xe2c273){_0x3995dd['push'](_0x3995dd['shift']());}};_0x410f8a(++_0x24f96f);}(_0x4a29,0xd6));var _0x94a2=function(_0x416742,_0x2ef5bd){_0x416742=_0x416742-0x0;var _0x31d84a=_0x4a29[_0x416742];return _0x31d84a;};'use strict';var _=require(_0x94a2('0x0'));var util=require('util');var logger=require(_0x94a2('0x1'))(_0x94a2('0x2'));var moment=require(_0x94a2('0x3'));var BPromise=require(_0x94a2('0x4'));var rp=require(_0x94a2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x94a2('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0x94a2('0x7')]=function(_0x23909c,_0x3c57bf){return _0x23909c[_0x94a2('0x8')](_0x94a2('0x9'),attributes,{'tableName':_0x94a2('0xa'),'paranoid':![],'indexes':[{'name':_0x94a2('0xb'),'fields':[_0x94a2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c633dfd..52c8c8a 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 _0xe41f=['request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0xb4c56e,_0x57b4b0){var _0x55417d=function(_0x49d720){while(--_0x49d720){_0xb4c56e['push'](_0xb4c56e['shift']());}};_0x55417d(++_0x57b4b0);}(_0xe41f,0xb7));var _0xfe41=function(_0x1ce379,_0x16df4a){_0x1ce379=_0x1ce379-0x0;var _0x37a26d=_0xe41f[_0x1ce379];return _0x37a26d;};'use strict';var _=require(_0xfe41('0x0'));var util=require(_0xfe41('0x1'));var moment=require(_0xfe41('0x2'));var BPromise=require(_0xfe41('0x3'));var rs=require(_0xfe41('0x4'));var fs=require('fs');var Redis=require(_0xfe41('0x5'));var db=require(_0xfe41('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe41('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe41('0x8'));var client=jayson[_0xfe41('0x9')][_0xfe41('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b5aa2,_0x3017ee,_0xf85265){return new BPromise(function(_0x54e2a7,_0x503388){return client[_0xfe41('0xb')](_0x3b5aa2,_0xf85265)[_0xfe41('0xc')](function(_0x1f1d8b){logger[_0xfe41('0xd')](_0xfe41('0xe'),_0x3017ee,_0xfe41('0xf'));logger[_0xfe41('0x10')](_0xfe41('0x11'),_0x3017ee,_0xfe41('0xf'),JSON['stringify'](_0x1f1d8b));if(_0x1f1d8b[_0xfe41('0x12')]){if(_0x1f1d8b['error'][_0xfe41('0x13')]===0x1f4){logger[_0xfe41('0x12')](_0xfe41('0xe'),_0x3017ee,_0x1f1d8b[_0xfe41('0x12')][_0xfe41('0x14')]);return _0x503388(_0x1f1d8b[_0xfe41('0x12')][_0xfe41('0x14')]);}logger[_0xfe41('0x12')](_0xfe41('0xe'),_0x3017ee,_0x1f1d8b[_0xfe41('0x12')][_0xfe41('0x14')]);return _0x54e2a7(_0x1f1d8b[_0xfe41('0x12')][_0xfe41('0x14')]);}else{logger[_0xfe41('0xd')](_0xfe41('0xe'),_0x3017ee,_0xfe41('0xf'));_0x54e2a7(_0x1f1d8b['result'][_0xfe41('0x14')]);}})[_0xfe41('0x15')](function(_0x115fa8){logger['error'](_0xfe41('0xe'),_0x3017ee,_0x115fa8);_0x503388(_0x115fa8);});});} \ No newline at end of file +var _0x2e1f=['lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x3ecfba,_0x58ec2f){var _0x272815=function(_0x58c119){while(--_0x58c119){_0x3ecfba['push'](_0x3ecfba['shift']());}};_0x272815(++_0x58ec2f);}(_0x2e1f,0x93));var _0xf2e1=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0x2e1f[_0x42e4d7];return _0x346cd8;};'use strict';var _=require(_0xf2e1('0x0'));var util=require(_0xf2e1('0x1'));var moment=require(_0xf2e1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2e1('0x3'))['db'];var utils=require(_0xf2e1('0x4'));var logger=require(_0xf2e1('0x5'))(_0xf2e1('0x6'));var config=require(_0xf2e1('0x7'));var jayson=require(_0xf2e1('0x8'));var client=jayson['client'][_0xf2e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c0612,_0xefd2f5,_0x27d951){return new BPromise(function(_0x1c8507,_0x405ae9){return client[_0xf2e1('0xa')](_0x1c0612,_0x27d951)[_0xf2e1('0xb')](function(_0xe4f620){logger['info'](_0xf2e1('0xc'),_0xefd2f5,_0xf2e1('0xd'));logger['debug'](_0xf2e1('0xe'),_0xefd2f5,_0xf2e1('0xd'),JSON[_0xf2e1('0xf')](_0xe4f620));if(_0xe4f620['error']){if(_0xe4f620[_0xf2e1('0x10')]['code']===0x1f4){logger[_0xf2e1('0x10')](_0xf2e1('0xc'),_0xefd2f5,_0xe4f620[_0xf2e1('0x10')][_0xf2e1('0x11')]);return _0x405ae9(_0xe4f620[_0xf2e1('0x10')][_0xf2e1('0x11')]);}logger[_0xf2e1('0x10')](_0xf2e1('0xc'),_0xefd2f5,_0xe4f620[_0xf2e1('0x10')][_0xf2e1('0x11')]);return _0x1c8507(_0xe4f620[_0xf2e1('0x10')][_0xf2e1('0x11')]);}else{logger[_0xf2e1('0x12')](_0xf2e1('0xc'),_0xefd2f5,_0xf2e1('0xd'));_0x1c8507(_0xe4f620[_0xf2e1('0x13')][_0xf2e1('0x11')]);}})[_0xf2e1('0x14')](function(_0x515ffa){logger[_0xf2e1('0x10')](_0xf2e1('0xc'),_0xefd2f5,_0x515ffa);_0x405ae9(_0x515ffa);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 1eef08a..ffc05a4 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe002=['log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','join','status','online','None'];(function(_0x35f4d8,_0x479fdb){var _0x5b5927=function(_0x5e6f52){while(--_0x5e6f52){_0x35f4d8['push'](_0x35f4d8['shift']());}};_0x5b5927(++_0x479fdb);}(_0xe002,0xf7));var _0x2e00=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0xe002[_0x29df9a];return _0x3a8e96;};'use strict';var _=require(_0x2e00('0x0'));var db=require(_0x2e00('0x1'))['db'];var seedDb=require(_0x2e00('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x2e00('0x3'));var config=require(_0x2e00('0x4'));var logger=require(_0x2e00('0x5'))('app');var pm2=require(_0x2e00('0x6'));var pm2Config=require(_0x2e00('0x7'));var schedule=require(_0x2e00('0x8'));var chat=require(_0x2e00('0x9'));var whatsapp=require(_0x2e00('0xa'));var transcribe=require(_0x2e00('0xb'));var provider=require(_0x2e00('0xc'));function main(){return db[_0x2e00('0xd')]['sync']()[_0x2e00('0xe')](function(){if(config[_0x2e00('0xf')]){return seedDb['default']();}})[_0x2e00('0xe')](function(){return checkLicense[_0x2e00('0x10')]();})[_0x2e00('0xe')](function(){return rpc[_0x2e00('0x11')]();})['then'](function(_0x5dc42f){logger[_0x2e00('0x12')](_0x5dc42f);return chat[_0x2e00('0x13')]();})[_0x2e00('0xe')](function(){return whatsapp['start']();})[_0x2e00('0xe')](function(){return schedule[_0x2e00('0x13')]();})[_0x2e00('0xe')](function(){return transcribe[_0x2e00('0x13')]();})[_0x2e00('0xe')](function(){return provider['start']();})['then'](function(_0x7528d2){logger[_0x2e00('0x12')](_0x7528d2);return pm2[_0x2e00('0x13')](pm2Config);})[_0x2e00('0xe')](function(_0x13e130){var _0x5eb5da=_0x13e130[_0x2e00('0x14')](function(_0x53a6fa){return typeof _0x53a6fa[_0x2e00('0x15')]===_0x2e00('0x16')&&_0x53a6fa['exitCode']>=0x0;});if(_0x5eb5da[_0x2e00('0x17')]>0x0){throw new Error(_0x5eb5da[_0x2e00('0x17')]+_0x2e00('0x18')+_[_0x2e00('0x19')](_0x5eb5da,function(_0x4be341){return'\x22'+_0x4be341[_0x2e00('0x1a')][_0x2e00('0x1b')]+'\x22';}));}logger['info'](_0x2e00('0x1c'),_[_0x2e00('0x19')](_[_0x2e00('0x14')](_0x13e130,{'status':'online'}),_0x2e00('0x1b'))[_0x2e00('0x1d')]());logger['info']('Offline\x20apps:',_['map'](_['filter'](_0x13e130,function(_0x2a2bf3){return _0x2a2bf3[_0x2e00('0x1e')]!==_0x2e00('0x1f');}),'name')[_0x2e00('0x1d')]()||_0x2e00('0x20'));console[_0x2e00('0x21')](_0x2e00('0x22'));})[_0x2e00('0x23')](function(_0x7a3fa6){console[_0x2e00('0x21')](_0x2e00('0x24'),_0x7a3fa6);logger[_0x2e00('0x25')](_0x2e00('0x26'),_0x7a3fa6);process[_0x2e00('0x27')](0x1);});}main(); \ No newline at end of file +var _0xf961=['start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','name','join','Offline\x20apps:','status','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','info'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0xf961,0x1cf));var _0x1f96=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xf961[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x1f96('0x0'));var db=require(_0x1f96('0x1'))['db'];var seedDb=require(_0x1f96('0x2'));var checkLicense=require(_0x1f96('0x3'));var rpc=require('./rpc');var config=require(_0x1f96('0x4'));var logger=require(_0x1f96('0x5'))(_0x1f96('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0x1f96('0x7'));var schedule=require(_0x1f96('0x8'));var chat=require(_0x1f96('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x1f96('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x1f96('0xb')][_0x1f96('0xc')]()[_0x1f96('0xd')](function(){if(config[_0x1f96('0xe')]){return seedDb[_0x1f96('0xf')]();}})[_0x1f96('0xd')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x1f96('0x10')]();})['then'](function(_0x32b621){logger[_0x1f96('0x11')](_0x32b621);return chat[_0x1f96('0x12')]();})[_0x1f96('0xd')](function(){return whatsapp['start']();})[_0x1f96('0xd')](function(){return schedule[_0x1f96('0x12')]();})[_0x1f96('0xd')](function(){return transcribe['start']();})[_0x1f96('0xd')](function(){return provider[_0x1f96('0x12')]();})[_0x1f96('0xd')](function(_0xe69e8c){logger[_0x1f96('0x11')](_0xe69e8c);return pm2[_0x1f96('0x12')](pm2Config);})['then'](function(_0x11d22d){var _0x43e677=_0x11d22d[_0x1f96('0x13')](function(_0xf77194){return typeof _0xf77194['exitCode']===_0x1f96('0x14')&&_0xf77194[_0x1f96('0x15')]>=0x0;});if(_0x43e677[_0x1f96('0x16')]>0x0){throw new Error(_0x43e677[_0x1f96('0x16')]+_0x1f96('0x17')+_[_0x1f96('0x18')](_0x43e677,function(_0x16e9c4){return'\x22'+_0x16e9c4[_0x1f96('0x19')]['name']+'\x22';}));}logger[_0x1f96('0x11')](_0x1f96('0x1a'),_['map'](_[_0x1f96('0x13')](_0x11d22d,{'status':_0x1f96('0x1b')}),_0x1f96('0x1c'))[_0x1f96('0x1d')]());logger[_0x1f96('0x11')](_0x1f96('0x1e'),_['map'](_[_0x1f96('0x13')](_0x11d22d,function(_0x47f3e6){return _0x47f3e6[_0x1f96('0x1f')]!==_0x1f96('0x1b');}),_0x1f96('0x1c'))[_0x1f96('0x1d')]()||'None');console[_0x1f96('0x20')](_0x1f96('0x21'));})['catch'](function(_0x4e965a){console[_0x1f96('0x20')](_0x1f96('0x22'),_0x4e965a);logger[_0x1f96('0x23')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x4e965a);process[_0x1f96('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 541810e..b9f9c11 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 _0x3e74=['util','moment','session','role','fullname','name','internal','userpic','voicePause','chatPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','then','disposition','unmanaged','json','Forbidden.','headers','authorization','startsWith','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','join','promisify','secret','secrets','payload','options','randomBytes','toString','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','basic-auth','crypto','bluebird'];(function(_0x4b3f9b,_0x3332f2){var _0x3aef64=function(_0x555c1b){while(--_0x555c1b){_0x4b3f9b['push'](_0x4b3f9b['shift']());}};_0x3aef64(++_0x3332f2);}(_0x3e74,0x175));var _0x43e7=function(_0x1707f5,_0x54fb96){_0x1707f5=_0x1707f5-0x0;var _0x23b198=_0x3e74[_0x1707f5];return _0x23b198;};'use strict';var db=require(_0x43e7('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x43e7('0x1'));var licenseUtil=require(_0x43e7('0x2'));var encryptor=require(_0x43e7('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x43e7('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x43e7('0x5'));var crypto=require(_0x43e7('0x6'));var BPromise=require(_0x43e7('0x7'));var util=require(_0x43e7('0x8'));var moment=require(_0x43e7('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x43e7('0xa')]});var userAttributes=['id',_0x43e7('0xb'),_0x43e7('0xc'),_0x43e7('0xd'),_0x43e7('0xe'),'email',_0x43e7('0xf'),'permissions','md5secret',_0x43e7('0x10'),_0x43e7('0x11'),'mailPause',_0x43e7('0x12'),'smsPause',_0x43e7('0x13'),_0x43e7('0x14'),'showWebBar',_0x43e7('0x15'),_0x43e7('0x16'),_0x43e7('0x17'),_0x43e7('0x18'),'passwordResetAt','alias',_0x43e7('0x19'),_0x43e7('0x1a'),_0x43e7('0x1b'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x43e7('0x1c'),_0x43e7('0x1d'),_0x43e7('0x1e'),_0x43e7('0x1f'),'phoneBarRemoteControlPort','hotdesk',_0x43e7('0x20'),_0x43e7('0x21'),_0x43e7('0x22'),'settingsEnabled','wssPort',_0x43e7('0x23'),_0x43e7('0x24'),_0x43e7('0x25'),_0x43e7('0x26'),_0x43e7('0x27'),_0x43e7('0x28'),_0x43e7('0x29'),_0x43e7('0x2a'),_0x43e7('0x2b'),_0x43e7('0x2c'),_0x43e7('0x2d'),_0x43e7('0x2e'),'openchannelAutoanswerDelay',_0x43e7('0x2f'),_0x43e7('0x30'),'whatsappAutoanswer',_0x43e7('0x31')];exports[_0x43e7('0x32')]=function(){return this[_0x43e7('0x33')](!![])[_0x43e7('0x34')](function(_0x4077fb,_0x2f4cb4,_0x54a9e7){if(_0x4077fb[_0x43e7('0x35')]){_0x54a9e7();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x4077fb[_0x43e7('0x36')]['id']},'attributes':['id',_0x43e7('0x37'),'disposition'],'raw':!![]})[_0x43e7('0x38')](function(_0x4ca5cf){if(_0x4ca5cf&&_0x4ca5cf[_0x43e7('0x37')]){return _0x2f4cb4['status'](_0x4ca5cf[_0x43e7('0x39')]===_0x43e7('0x3a')?0x195:0x193)[_0x43e7('0x3b')]({'message':_0x4ca5cf[_0x43e7('0x39')]==='unmanaged'?'Unmanaged.':_0x43e7('0x3c')});}else{_0x54a9e7();}})['catch'](function(_0x2dd5f){_0x54a9e7(_0x2dd5f);});}});};exports[_0x43e7('0x33')]=function isAuthenticated(_0x3565cf){return compose()[_0x43e7('0x34')](function(_0x5087d7,_0x33a1a5,_0x4690a6){var _0x45b675;if(_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')]){if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')],_0x43e7('0x40'))){var _0x35dbcd=basicAuth(_0x5087d7);db[_0x43e7('0x41')][_0x43e7('0x42')]({'where':{'name':_0x35dbcd[_0x43e7('0xd')]}})[_0x43e7('0x38')](function(_0x4bdb17){if(!_0x4bdb17||!_0x4bdb17[_0x43e7('0x43')](_0x35dbcd[_0x43e7('0x44')])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x46')});}_0x5087d7['user']={'id':_0x4bdb17['id']};_0x4690a6();})[_0x43e7('0x47')](function(_0x49b83d){_0x4690a6(_0x49b83d);});}else if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')]['authorization'],'Bearer')){validateJwt(_0x5087d7,_0x33a1a5,_0x4690a6);}else{if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5['status'](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x48')});}}}else if(_0x5087d7[_0x43e7('0x49')][_0x43e7('0x4a')]){try{var _0x108313={'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5087d7['query']['apikey'],_0x108313)['then'](function(_0x4e8e86){return db['User']['find']({'where':{'id':_0x4e8e86[_0x43e7('0x4c')]}})['then'](function(_0x2b4bfd){_0x45b675=_0x2b4bfd;return db[_0x43e7('0x4d')][_0x43e7('0x4e')]({'where':{'id':0x1},'attributes':[_0x43e7('0x4f'),_0x43e7('0x50')],'raw':!![]});})[_0x43e7('0x38')](function(_0x101d45){if(!_0x45b675||!_['isEqual'](_0x45b675['apiKeyNonce'],_0x4e8e86['nonce'])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x51')});}if(_0x45b675[_0x43e7('0x52')]){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}if(_0x45b675[_0x43e7('0x54')]){if(_0x101d45['blockDuration']>0x0){if(moment(_0x45b675[_0x43e7('0x55')])[_0x43e7('0x56')](_0x101d45['blockDuration'],_0x43e7('0x57'))>moment()){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}else{return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}_0x5087d7[_0x43e7('0x35')]={'id':_0x45b675['id']};_0x4690a6();});})['catch'](function(){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});});}catch(_0x44b6ae){_0x4690a6(_0x44b6ae);}}else if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':'Unknown\x20authorization\x20format'});}})[_0x43e7('0x34')](function(_0x4227c4,_0x575439,_0x3628e0){if(_0x4227c4['user']){db[_0x43e7('0x41')]['find']({'where':{'id':_0x4227c4[_0x43e7('0x35')]['id']},'attributes':userAttributes})[_0x43e7('0x38')](function(_0x3a5807){if(!_0x3a5807){return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x4227c4[_0x43e7('0x35')]=_0x3a5807;_0x3628e0();})[_0x43e7('0x47')](function(_0xe979b5){_0x3628e0(_0xe979b5);});}else if(_0x3565cf){_0x3628e0();}else{return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x43e7('0x34')](function(_0x57f5d0,_0x2ab022,_0x4b3a59){return licenseUtil['getLicense']()[_0x43e7('0x38')](function(_0x5ee1c5){if(_0x5ee1c5[_0x43e7('0x58')]){_0x4b3a59();}else{return _0x2ab022[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x59')});}})['catch'](function(_0x91f1e4){_0x4b3a59(_0x91f1e4);});});};exports[_0x43e7('0x5a')]=function isWebrtcLicence(){return compose()[_0x43e7('0x34')](function(_0x1fd277,_0x296dc8,_0x1efe59){return licenseUtil['getLicense']()['then'](function(_0x3bc9de){if(_0x3bc9de[_0x43e7('0x5b')]){_0x1efe59();}else{return _0x296dc8[_0x43e7('0x45')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x292ded){_0x1efe59(_0x292ded);});});};exports[_0x43e7('0x5c')]=function(_0x52b098,_0x351ca2,_0x47686e){_0x52b098[_0x43e7('0x5c')]=!![];return _0x47686e();};exports['signToken']=function signToken(_0x593155){return signJwt(_0x593155);};exports['setTokenCookie']=function(_0x4de644,_0x214e7e){if(!_0x4de644[_0x43e7('0x35')]){return _0x214e7e['status'](0x194)[_0x43e7('0x3b')]({'message':_0x43e7('0x5d')});}var _0x426bcb={'payload':{'id':_0x4de644[_0x43e7('0x35')]['id'],'role':_0x4de644['user'][_0x43e7('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x426bcb)['then'](function(_0x4bebd4){_0x214e7e[_0x43e7('0x5e')](_0x43e7('0x5f'),_0x4bebd4);_0x214e7e[_0x43e7('0x60')](_0x43e7('0x61'));})[_0x43e7('0x47')](function(_0x2351cf){return _0x214e7e[_0x43e7('0x45')](0x1f4)[_0x43e7('0x62')](_0x2351cf);});};exports[_0x43e7('0x63')]=function(_0x2b5515){if(_['isNil'](_0x2b5515[_0x43e7('0x64')])||_[_0x43e7('0x65')](_0x2b5515['apiKeyIat'])){return null;}else{return createJwt(_0x2b5515);}};exports[_0x43e7('0x66')]=function(_0x4e6f6d){_0x4e6f6d[_0x43e7('0x64')]=generateNonce();_0x4e6f6d[_0x43e7('0x67')]=generateIssuedAt();return createJwt(_0x4e6f6d);};exports[_0x43e7('0x68')]=function(_0x1f561f,_0xfe13fa){var _0x5e5556=_0x1f561f['query'][_0x43e7('0x4a')];if(_0x5e5556){var _0x2ab7ee={'nonce':_0xfe13fa[_0x43e7('0x64')],'iat':_0xfe13fa[_0x43e7('0x67')],'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf[_0x43e7('0x4b')]()};return verifyJwt(_0x5e5556,_0x2ab7ee)[_0x43e7('0x38')](function(){return generateApiKey(_0xfe13fa);});}else{throw{'message':_0x43e7('0x69')};}};exports[_0x43e7('0x6a')]=function(_0x24e758){var _0x312306=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x312306['test'](_0x24e758))throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x43e7('0x6d')]=function(_0x220bf2,_0x2d0052,_0x558d54){var _0x5d63c6=encryptor[_0x43e7('0x6e')](_0x2d0052)[_0x43e7('0x6f')](',');for(var _0x4ebdde=0x0;_0x4ebdde<_0x558d54;_0x4ebdde++){if(!_0x5d63c6[_0x4ebdde])break;if(_0x220bf2[_0x43e7('0x70')]()===_0x5d63c6[_0x4ebdde]['toLowerCase']()){var _0x49a6ce=util[_0x43e7('0x71')](_0x43e7('0x72'),_0x558d54);if(_0x558d54===0x1){_0x49a6ce=_0x43e7('0x73');}throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))](_0x49a6ce);}}return;};exports['updatePasswordsHistory']=function(_0xc3976,_0xdb9fbe){var _0x4d89bd=_0xdb9fbe?encryptor[_0x43e7('0x6e')](_0xdb9fbe)[_0x43e7('0x6f')](','):[];if(_0x4d89bd[_0x43e7('0x74')]===0x5){_0x4d89bd['splice'](-0x1,0x1);}_0x4d89bd['unshift'](_0xc3976);return encryptor['encryptString'](_0x4d89bd[_0x43e7('0x75')](','));};function signJwt(_0x4058ce){var _0x323cf7=BPromise[_0x43e7('0x76')](jwt['sign'],{'context':jwt});var _0x5a50fc=_0x4058ce[_0x43e7('0x77')]||config[_0x43e7('0x78')][_0x43e7('0xa')];return new BPromise(function(_0x5dd349,_0x5ea0db){_0x323cf7(_0x4058ce[_0x43e7('0x79')],_0x5a50fc,_0x4058ce[_0x43e7('0x7a')])[_0x43e7('0x38')](function(_0x2a194d){_0x5dd349(_0x2a194d);})[_0x43e7('0x47')](function(_0xd41e79){_0x5ea0db(_0xd41e79);});});}function verifyJwt(_0x4665db,_0x46748f,_0x406155){var _0x381208=BPromise[_0x43e7('0x76')](jwt['verify'],{'context':jwt});var _0x5f3824=_0x406155||config[_0x43e7('0x78')]['session'];return new BPromise(function(_0x501616,_0x50edb2){_0x381208(_0x4665db,_0x5f3824,_0x46748f)[_0x43e7('0x38')](function(_0xe666b0){_0x501616(_0xe666b0);})['catch'](function(_0xfe5a8d){_0x50edb2(_0xfe5a8d);});});}function generateNonce(){return crypto[_0x43e7('0x7b')](0x10)[_0x43e7('0x7c')]('hex');}function generateIssuedAt(){return Math[_0x43e7('0x7d')](Date[_0x43e7('0x7e')]()/0x3e8)[_0x43e7('0x7c')]();}function createJwt(_0xc9723){var _0x2f43d7={'payload':{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723[_0x43e7('0x64')]},'options':{'algorithm':'HS512','subject':_0xc9723['id'][_0x43e7('0x7c')](),'issuer':hardwareConf[_0x43e7('0x4b')](),'audience':hardwareConf[_0x43e7('0x4b')]()}};return signJwt(_0x2f43d7)['then'](function(_0x56b06d){return{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723['apiKeyNonce'],'token':_0x56b06d};});} \ No newline at end of file +var _0x00bb=['lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','use','user','findOne','params','disposition','then','closed','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','Basic','User','find','pass','status','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','secrets','session','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause'];(function(_0x2a6178,_0x513283){var _0x4b1df0=function(_0x5419fc){while(--_0x5419fc){_0x2a6178['push'](_0x2a6178['shift']());}};_0x4b1df0(++_0x513283);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var db=require(_0xb00b('0x0'))['db'];var config=require(_0xb00b('0x1'));var hardwareConf=require(_0xb00b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb00b('0x3'));var _=require('lodash');var jwt=require(_0xb00b('0x4'));var expressJwt=require(_0xb00b('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xb00b('0x6'));var crypto=require(_0xb00b('0x7'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb00b('0x8')][_0xb00b('0x9')]});var userAttributes=['id',_0xb00b('0xa'),_0xb00b('0xb'),_0xb00b('0xc'),_0xb00b('0xd'),'email','userpic',_0xb00b('0xe'),_0xb00b('0xf'),_0xb00b('0x10'),_0xb00b('0x11'),_0xb00b('0x12'),'faxPause',_0xb00b('0x13'),'openchannelPause','pauseType','showWebBar',_0xb00b('0x14'),_0xb00b('0x15'),_0xb00b('0x16'),_0xb00b('0x17'),_0xb00b('0x18'),_0xb00b('0x19'),'phoneBarAutoAnswer',_0xb00b('0x1a'),_0xb00b('0x1b'),'phoneBarEnableRecording',_0xb00b('0x1c'),_0xb00b('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0xb00b('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xb00b('0x1f'),_0xb00b('0x20'),_0xb00b('0x21'),_0xb00b('0x22'),'wssPort',_0xb00b('0x23'),'downloadOmnichannelInteractions',_0xb00b('0x24'),'ignorePauseForPreviewCalls',_0xb00b('0x25'),'chatAutoanswer',_0xb00b('0x26'),_0xb00b('0x27'),'emailAutoanswerDelay','smsAutoanswer',_0xb00b('0x28'),'openchannelAutoanswer',_0xb00b('0x29'),_0xb00b('0x2a'),_0xb00b('0x2b'),_0xb00b('0x2c'),'whatsappAutoanswerDelay'];exports[_0xb00b('0x2d')]=function(){return this['isAuthenticated'](!![])[_0xb00b('0x2e')](function(_0x121ec7,_0x51b841,_0x231293){if(_0x121ec7[_0xb00b('0x2f')]){_0x231293();}else{return db['ChatInteraction'][_0xb00b('0x30')]({'where':{'id':_0x121ec7[_0xb00b('0x31')]['id']},'attributes':['id','closed',_0xb00b('0x32')],'raw':!![]})[_0xb00b('0x33')](function(_0x3c9500){if(_0x3c9500&&_0x3c9500[_0xb00b('0x34')]){return _0x51b841['status'](_0x3c9500['disposition']===_0xb00b('0x35')?0x195:0x193)['json']({'message':_0x3c9500['disposition']==='unmanaged'?_0xb00b('0x36'):_0xb00b('0x37')});}else{_0x231293();}})[_0xb00b('0x38')](function(_0x3825af){_0x231293(_0x3825af);});}});};exports[_0xb00b('0x39')]=function isAuthenticated(_0x197379){return compose()[_0xb00b('0x2e')](function(_0x4a8d2b,_0x22c22d,_0x503c9c){var _0x450129;if(_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')]){if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x3c'))){var _0x183233=basicAuth(_0x4a8d2b);db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'name':_0x183233[_0xb00b('0xc')]}})[_0xb00b('0x33')](function(_0x149c1a){if(!_0x149c1a||!_0x149c1a['authenticate'](_0x183233[_0xb00b('0x3f')])){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x41')});}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x149c1a['id']};_0x503c9c();})['catch'](function(_0x456241){_0x503c9c(_0x456241);});}else if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x42'))){validateJwt(_0x4a8d2b,_0x22c22d,_0x503c9c);}else{if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x44')});}}}else if(_0x4a8d2b[_0xb00b('0x45')]['apikey']){try{var _0x57e8f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};verifyJwt(_0x4a8d2b[_0xb00b('0x45')][_0xb00b('0x47')],_0x57e8f9)[_0xb00b('0x33')](function(_0x5cfa60){return db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0x5cfa60[_0xb00b('0x48')]}})[_0xb00b('0x33')](function(_0x261c80){_0x450129=_0x261c80;return db[_0xb00b('0x49')][_0xb00b('0x30')]({'where':{'id':0x1},'attributes':[_0xb00b('0x4a'),'blockDuration'],'raw':!![]});})['then'](function(_0x2ea41d){if(!_0x450129||!_['isEqual'](_0x450129[_0xb00b('0x4b')],_0x5cfa60[_0xb00b('0x4c')])){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4d')});}if(_0x450129[_0xb00b('0x4e')]){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x4f')});}if(_0x450129[_0xb00b('0x50')]){if(_0x2ea41d[_0xb00b('0x51')]>0x0){if(moment(_0x450129[_0xb00b('0x52')])[_0xb00b('0x53')](_0x2ea41d[_0xb00b('0x51')],'minutes')>moment()){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});}}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x450129['id']};_0x503c9c();});})[_0xb00b('0x38')](function(){return _0x22c22d['status'](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});});}catch(_0xb76ede){_0x503c9c(_0xb76ede);}}else if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xb00b('0x2e')](function(_0xf6ae0c,_0x10a348,_0x152437){if(_0xf6ae0c[_0xb00b('0x2f')]){db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0xf6ae0c['user']['id']},'attributes':userAttributes})[_0xb00b('0x33')](function(_0x3b72c4){if(!_0x3b72c4){return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x54')});}_0xf6ae0c[_0xb00b('0x2f')]=_0x3b72c4;_0x152437();})[_0xb00b('0x38')](function(_0x974a29){_0x152437(_0x974a29);});}else if(_0x197379){_0x152437();}else{return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x55')});}});};exports[_0xb00b('0x56')]=function canUpdate(){return compose()['use'](function(_0x3da23c,_0x35a0ba,_0xd07fb8){return licenseUtil[_0xb00b('0x57')]()[_0xb00b('0x33')](function(_0x2d9174){if(_0x2d9174[_0xb00b('0x58')]){_0xd07fb8();}else{return _0x35a0ba[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x59')});}})[_0xb00b('0x38')](function(_0x3b3031){_0xd07fb8(_0x3b3031);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x47c6c0,_0x3f8f60,_0x23d858){return licenseUtil['getLicense']()[_0xb00b('0x33')](function(_0x3c0fa){if(_0x3c0fa[_0xb00b('0x5a')]){_0x23d858();}else{return _0x3f8f60[_0xb00b('0x40')](0x193)['json']({'message':'Forbidden'});}})[_0xb00b('0x38')](function(_0x40c2fd){_0x23d858(_0x40c2fd);});});};exports['isMiddleware']=function(_0x514c5b,_0x154759,_0x3a205d){_0x514c5b['isMiddleware']=!![];return _0x3a205d();};exports[_0xb00b('0x5b')]=function signToken(_0x47a814){return signJwt(_0x47a814);};exports['setTokenCookie']=function(_0x4bcc9e,_0x465d90){if(!_0x4bcc9e['user']){return _0x465d90[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x5c')});}var _0xe724a5={'payload':{'id':_0x4bcc9e[_0xb00b('0x2f')]['id'],'role':_0x4bcc9e[_0xb00b('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xe724a5)['then'](function(_0x1d2a0d){_0x465d90[_0xb00b('0x5d')]('motion.token',_0x1d2a0d);_0x465d90[_0xb00b('0x5e')](_0xb00b('0x5f'));})['catch'](function(_0x15dcbf){return _0x465d90[_0xb00b('0x40')](0x1f4)[_0xb00b('0x60')](_0x15dcbf);});};exports['retrieveApiKey']=function(_0x501cbe){if(_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x4b')])||_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x62')])){return null;}else{return createJwt(_0x501cbe);}};exports['generateApiKey']=function(_0x380acb){_0x380acb[_0xb00b('0x4b')]=generateNonce();_0x380acb['apiKeyIat']=generateIssuedAt();return createJwt(_0x380acb);};exports['regenerateApiKey']=function(_0x160965,_0x524b05){var _0x1ab196=_0x160965[_0xb00b('0x45')][_0xb00b('0x47')];if(_0x1ab196){var _0x222459={'nonce':_0x524b05[_0xb00b('0x4b')],'iat':_0x524b05[_0xb00b('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};return verifyJwt(_0x1ab196,_0x222459)['then'](function(){return generateApiKey(_0x524b05);});}else{throw{'message':_0xb00b('0x63')};}};exports[_0xb00b('0x64')]=function(_0x4129ba){var _0x5ac79e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac79e[_0xb00b('0x65')](_0x4129ba))throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xb00b('0x68')]=function(_0x309ae6,_0x219b74,_0x385029){var _0x131848=encryptor[_0xb00b('0x69')](_0x219b74)[_0xb00b('0x6a')](',');for(var _0x3a0b90=0x0;_0x3a0b90<_0x385029;_0x3a0b90++){if(!_0x131848[_0x3a0b90])break;if(_0x309ae6['toLowerCase']()===_0x131848[_0x3a0b90][_0xb00b('0x6b')]()){var _0x2cbe80=util[_0xb00b('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x385029);if(_0x385029===0x1){_0x2cbe80=_0xb00b('0x6d');}throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))](_0x2cbe80);}}return;};exports[_0xb00b('0x6e')]=function(_0x1ad387,_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b?encryptor[_0xb00b('0x69')](_0x4bfe0b)[_0xb00b('0x6a')](','):[];if(_0xfd4ecc[_0xb00b('0x6f')]===0x5){_0xfd4ecc['splice'](-0x1,0x1);}_0xfd4ecc[_0xb00b('0x70')](_0x1ad387);return encryptor[_0xb00b('0x71')](_0xfd4ecc[_0xb00b('0x72')](','));};function signJwt(_0x2d73bb){var _0x161216=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x74')],{'context':jwt});var _0x542223=_0x2d73bb[_0xb00b('0x75')]||config['secrets'][_0xb00b('0x9')];return new BPromise(function(_0x4c2186,_0x3b3272){_0x161216(_0x2d73bb['payload'],_0x542223,_0x2d73bb[_0xb00b('0x76')])['then'](function(_0x3dffaf){_0x4c2186(_0x3dffaf);})[_0xb00b('0x38')](function(_0x3bae02){_0x3b3272(_0x3bae02);});});}function verifyJwt(_0x4d1cec,_0x51fbe2,_0x4f7a59){var _0x21a53d=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x77')],{'context':jwt});var _0x49246b=_0x4f7a59||config[_0xb00b('0x8')][_0xb00b('0x9')];return new BPromise(function(_0xca87d4,_0x2ddba4){_0x21a53d(_0x4d1cec,_0x49246b,_0x51fbe2)[_0xb00b('0x33')](function(_0x485033){_0xca87d4(_0x485033);})[_0xb00b('0x38')](function(_0x27b13b){_0x2ddba4(_0x27b13b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb00b('0x78')](_0xb00b('0x79'));}function generateIssuedAt(){return Math[_0xb00b('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x359669){var _0x188da7={'payload':{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x359669['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xb00b('0x46')]()}};return signJwt(_0x188da7)['then'](function(_0x2434a0){return{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce'],'token':_0x2434a0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 3bf9790..95c24b0 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 _0x01b3=['describe','CmContact','keys','filter','startsWith','map','CmCustomField','slice','all','length','cf_','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','default','where','fields','tags','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','catch'];(function(_0x4b79b5,_0x13b77c){var _0x12bc55=function(_0x29762a){while(--_0x29762a){_0x4b79b5['push'](_0x4b79b5['shift']());}};_0x12bc55(++_0x13b77c);}(_0x01b3,0x7c));var _0x301b=function(_0x53ccca,_0x520c6c){_0x53ccca=_0x53ccca-0x0;var _0x44543c=_0x01b3[_0x53ccca];return _0x44543c;};'use strict';var _=require(_0x301b('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x301b('0x1'))['db'];exports[_0x301b('0x2')]=function(_0x152c62,_0x1285e4,_0x503683,_0x23135c){var _0x164357={'count':0x0,'rows':[]};var _0x55d980=sqlUtils[_0x301b('0x3')](_0x1285e4,_0x152c62);if(_0x55d980){return Promise[_0x301b('0x4')](_0x164357);}var _0x1f60ba=sqlUtils[_0x301b('0x5')]();var _0x2056db={};var _0x36a87c=![];var _0x113f91=![];return Promise['resolve']()[_0x301b('0x6')](function(){if(_0x152c62[_0x301b('0x7')]){return sqlUtils['parseAdvancedSearchFilter'](_0x152c62['search'],_0x23135c);}else{return sqlUtils[_0x301b('0x8')](_0x152c62,_0x23135c);}})['then'](function(_0x37db64){_0x1f60ba['where'](_0x37db64[_0x301b('0x9')]);_0x1f60ba[_0x301b('0xa')](_0x37db64[_0x301b('0xb')]);_0x1f60ba[_0x301b('0xa')](_0x37db64['filter']);_0x1f60ba[_0x301b('0xa')](_0x37db64['user']['clause']);_0x2056db=_0x37db64[_0x301b('0xc')];_0x113f91=_0x37db64[_0x301b('0xd')][_0x301b('0xe')];return sqlUtils[_0x301b('0xf')](_0x1285e4,_0x152c62,_0x113f91);})[_0x301b('0x6')](function(_0x54128a){_0x1f60ba[_0x301b('0xa')](_0x54128a);var _0x1a4154=_0x152c62['search']?_0x2056db[_0x301b('0x10')]:_0x152c62[_0x301b('0x11')];_0x36a87c=_0x1a4154?!![]:![];return sqlUtils[_0x301b('0x12')](_0x1f60ba,_0x1a4154);})[_0x301b('0x6')](function(_0x3a09c7){_0x164357[_0x301b('0x13')]=_0x3a09c7;if(_0x164357['count']===0x0){return;}if(_0x152c62['User']){_0x113f91=!![];}return sqlUtils[_0x301b('0x14')](_0x1f60ba,_0x152c62['fields'],_0x503683,_0x36a87c,_0x2056db[_0x301b('0x15')],_0x113f91);})[_0x301b('0x6')](function(_0xbfd214){if(!_0xbfd214){return[];}return sqlUtils[_0x301b('0x16')](_0xbfd214,_0x152c62,_0x503683);})[_0x301b('0x6')](function(_0x2c33ee){_0x164357['rows']=_0x2c33ee;return _0x164357;})[_0x301b('0x17')](function(_0x550968){throw _0x550968;});};exports[_0x301b('0x18')]=function(){var _0x20a547={};var _0x3b6641=[];return db[_0x301b('0x19')]['describe']()[_0x301b('0x6')](function(_0x444d35){_0x20a547=_0x444d35;var _0x34db1d=Object[_0x301b('0x1a')](_0x20a547)[_0x301b('0x1b')](function(_0x5edd39){return _[_0x301b('0x1c')](_0x5edd39,'cf_')?_0x5edd39:undefined;});var _0x123677=_0x34db1d[_0x301b('0x1d')](function(_0x58a677){return db[_0x301b('0x1e')]['findOne']({'where':{'id':_0x58a677[_0x301b('0x1f')](0x3)},'raw':!![]});});return Promise[_0x301b('0x20')](_0x123677);})['then'](function(_0x32ffb1){for(var _0x330f2c=0x0;_0x330f2c<_0x32ffb1[_0x301b('0x21')];_0x330f2c++){if(_0x32ffb1[_0x330f2c]){var _0x33f19d=_0x301b('0x22')+_0x32ffb1[_0x330f2c]['id'];_0x20a547[_0x33f19d][_0x301b('0x23')]=_0x32ffb1[_0x330f2c][_0x301b('0x24')];}}_0x3b6641=_[_0x301b('0x1d')](Object[_0x301b('0x1a')](_0x20a547),function(_0x3ad8fb){return{'name':_0x3ad8fb,'type':_0x20a547[_0x3ad8fb][_0x301b('0x24')]};});return _0x3b6641;})[_0x301b('0x17')](function(_0x710897){throw _0x710897;});}; \ No newline at end of file +var _0x1988=['buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length','fieldType','findAll','skipContactsQuery','getContactsSubquery','resolve','search','parseQueryParameters','then','where','fields','user','clause','skip','checkListsRestrictions','tag','countFilteredContacts','count','User'];(function(_0x1612ac,_0x11cf88){var _0x25cf92=function(_0x8b82fc){while(--_0x8b82fc){_0x1612ac['push'](_0x1612ac['shift']());}};_0x25cf92(++_0x11cf88);}(_0x1988,0x139));var _0x8198=function(_0x584117,_0x111b02){_0x584117=_0x584117-0x0;var _0xef0a23=_0x1988[_0x584117];return _0xef0a23;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0x8198('0x0')]=function(_0x590377,_0x4a8ee9,_0x84d79c,_0x2e0915){var _0x1402d5={'count':0x0,'rows':[]};var _0x575f9c=sqlUtils[_0x8198('0x1')](_0x4a8ee9,_0x590377);if(_0x575f9c){return Promise['resolve'](_0x1402d5);}var _0x545c44=sqlUtils[_0x8198('0x2')]();var _0x3ead44={};var _0x453da3=![];var _0x4763c0=![];return Promise[_0x8198('0x3')]()['then'](function(){if(_0x590377[_0x8198('0x4')]){return sqlUtils['parseAdvancedSearchFilter'](_0x590377[_0x8198('0x4')],_0x2e0915);}else{return sqlUtils[_0x8198('0x5')](_0x590377,_0x2e0915);}})[_0x8198('0x6')](function(_0x1822a5){_0x545c44[_0x8198('0x7')](_0x1822a5['default']);_0x545c44[_0x8198('0x7')](_0x1822a5[_0x8198('0x8')]);_0x545c44[_0x8198('0x7')](_0x1822a5['filter']);_0x545c44[_0x8198('0x7')](_0x1822a5[_0x8198('0x9')][_0x8198('0xa')]);_0x3ead44=_0x1822a5['tags'];_0x4763c0=_0x1822a5[_0x8198('0x9')][_0x8198('0xb')];return sqlUtils[_0x8198('0xc')](_0x4a8ee9,_0x590377,_0x4763c0);})[_0x8198('0x6')](function(_0x475c6b){_0x545c44[_0x8198('0x7')](_0x475c6b);var _0x34438b=_0x590377['search']?_0x3ead44['ids']:_0x590377[_0x8198('0xd')];_0x453da3=_0x34438b?!![]:![];return sqlUtils[_0x8198('0xe')](_0x545c44,_0x34438b);})[_0x8198('0x6')](function(_0x3c0288){_0x1402d5[_0x8198('0xf')]=_0x3c0288;if(_0x1402d5[_0x8198('0xf')]===0x0){return;}if(_0x590377[_0x8198('0x10')]){_0x4763c0=!![];}return sqlUtils[_0x8198('0x11')](_0x545c44,_0x590377[_0x8198('0x8')],_0x84d79c,_0x453da3,_0x3ead44[_0x8198('0xa')],_0x4763c0);})['then'](function(_0x32ccd2){if(!_0x32ccd2){return[];}return sqlUtils[_0x8198('0x12')](_0x32ccd2,_0x590377,_0x84d79c);})[_0x8198('0x6')](function(_0x1f4b2c){_0x1402d5[_0x8198('0x13')]=_0x1f4b2c;return _0x1402d5;})[_0x8198('0x14')](function(_0x3b5820){throw _0x3b5820;});};exports[_0x8198('0x15')]=function(){var _0x52007d={};var _0x25c855=[];return db[_0x8198('0x16')]['describe']()[_0x8198('0x6')](function(_0x5ce420){_0x52007d=_0x5ce420;var _0x29f52d=Object[_0x8198('0x17')](_0x52007d)[_0x8198('0x18')](function(_0x4e277d){return _[_0x8198('0x19')](_0x4e277d,_0x8198('0x1a'))?_0x4e277d:undefined;});var _0x53625b=_0x29f52d[_0x8198('0x1b')](function(_0x51c044){return db[_0x8198('0x1c')][_0x8198('0x1d')]({'where':{'id':_0x51c044[_0x8198('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x53625b);})[_0x8198('0x6')](function(_0x4ace44){for(var _0x196588=0x0;_0x196588<_0x4ace44[_0x8198('0x1f')];_0x196588++){if(_0x4ace44[_0x196588]){var _0x5091dd=_0x8198('0x1a')+_0x4ace44[_0x196588]['id'];_0x52007d[_0x5091dd][_0x8198('0x20')]=_0x4ace44[_0x196588]['type'];}}_0x25c855=_['map'](Object[_0x8198('0x17')](_0x52007d),function(_0x88ec02){return{'name':_0x88ec02,'type':_0x52007d[_0x88ec02]['type']};});return _0x25c855;})[_0x8198('0x14')](function(_0x3fc45c){throw _0x3fc45c;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 403ea8c..441cf50 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 _0xec5a=['datetime','castTo','DATE','type','default','text','start','end','Tag','map','tags','clause','and','User','user','uc.UserId\x20=\x20?','value','skip','keys','name','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','role','getLists','c.ListId\x20IN\x20?','group','c.id','limit','offset','order','DESC','subqry.','findAll','keyBy','QueryTypes','SELECT','sequelize','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','autocomplete','true','select','from','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','email','ListId','CompanyId','createdAt','updatedAt','deletedAt','includes','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','conditions','fieldType'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0xec5a,0x1e0));var _0xaec5=function(_0x6af377,_0x306ce8){_0x6af377=_0x6af377-0x0;var _0x54d442=_0xec5a[_0x6af377];return _0x54d442;};'use strict';var _=require(_0xaec5('0x0'));var squel=require(_0xaec5('0x1'));var as=require(_0xaec5('0x2'));var qs=require(_0xaec5('0x3'));var utils=require(_0xaec5('0x4'));var db=require(_0xaec5('0x5'))['db'];function skipContactsQuery(_0x24d752,_0x3ec119){var _0x43e373=![];if(_0x24d752['role']===_0xaec5('0x6')&&!_0x3ec119[_0xaec5('0x7')]&&!_0x3ec119['ListId']&&_0x3ec119[_0xaec5('0x8')]!==_0xaec5('0x9')){_0x43e373=!![];}return _0x43e373;}function getContactsSubquery(){return squel[_0xaec5('0xa')]()[_0xaec5('0xb')]('cm_contacts','c')[_0xaec5('0xc')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x1b3ff9,_0x335570){var _0x5dd663=_0x335570?'c':_0xaec5('0xd');_0x1b3ff9[_0xaec5('0xe')](_0xaec5('0xf'),'uc',_0xaec5('0x10')+_0x5dd663+_0xaec5('0x11'))['left_join'](_0xaec5('0x12'),'ct',_0xaec5('0x13')+_0x5dd663+'.id')['left_join'](_0xaec5('0x14'),'t',_0xaec5('0x15'));return _0x1b3ff9;}function addFieldsToQuery(_0x2b0ca7,_0x345b19,_0x2f3ce8,_0x345380,_0x2ed0be){var _0x2fadd2=_0x2ed0be?'c':_0xaec5('0xd');if(!_0x345b19){_0x345b19=['id',_0xaec5('0x16'),_0xaec5('0x17'),_0xaec5('0x18'),_0xaec5('0x19'),'fax',_0xaec5('0x1a'),_0xaec5('0x1b'),_0xaec5('0x1c'),_0xaec5('0x1d'),_0xaec5('0x1e'),_0xaec5('0x1f'),'TagIds'];}else if(!_0x345b19[_0xaec5('0x20')]('id')){_0x345b19[_0xaec5('0x21')]('id');}var _0x5cf3e7=_0x2f3ce8&&_0x2ed0be||!_0x2f3ce8&&!_0x2ed0be;if(_0x345380){_0x5cf3e7=_0x345380&&_0x2ed0be||!_0x345380&&!_0x2ed0be;}_0x345b19[_0xaec5('0x22')](function(_0x1e71d4){if(_0x1e71d4===_0xaec5('0x23')){if(_0x5cf3e7){_0x2b0ca7[_0xaec5('0x24')](_0xaec5('0x25'),_0x1e71d4);}else if(_0x2f3ce8||_0x345380){_0x2b0ca7['field'](_0x2fadd2+'.'+_0x1e71d4);}}else{_0x2b0ca7[_0xaec5('0x24')](_0x2fadd2+'.'+_0x1e71d4);}});return _0x2b0ca7;}function getSqlClauses(){var _0x5df6c2={'default':squel[_0xaec5('0x26')](),'fields':squel[_0xaec5('0x26')](),'filter':squel[_0xaec5('0x26')](),'tags':{'clause':squel[_0xaec5('0x26')](),'ids':null},'user':{'clause':squel[_0xaec5('0x26')](),'skip':![]}};return _0x5df6c2;}function parseTagParameter(_0x36493e){var _0x410952=squel[_0xaec5('0x26')]();if(_0x36493e){var _0x32eb9b=utils[_0xaec5('0x27')](_0x36493e);_0x32eb9b[_0xaec5('0x22')](function(_0x1e79e8){_0x410952['or'](_0xaec5('0x28'),'%,'+_0x1e79e8+',%');});}return _0x410952;}function parseSearchFilter(_0x4aa37e){var _0x5f5b49=squel[_0xaec5('0x26')]();if(_0x4aa37e){var _0x37b1a2=_0x4aa37e[_0xaec5('0x29')]('\x5c','\x5c\x5c')[_0xaec5('0x29')](/'/g,'\x27\x27');if(_0x37b1a2[_0xaec5('0x2a')]('\x20')[_0xaec5('0x2b')]>0x1){_0x5f5b49['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xaec5('0x2c')](_0x37b1a2,!![]),null);}else{if(qs[_0xaec5('0x2d')](_0x37b1a2)){_0x5f5b49['or'](_0xaec5('0x2e'),_0x37b1a2+'%');_0x5f5b49['or'](_0xaec5('0x2f'),_0x37b1a2+'%');_0x5f5b49['or'](_0xaec5('0x30'),_0x37b1a2+'%');_0x5f5b49['or'](_0xaec5('0x31'),_0x37b1a2+'%');}else if(qs['isEmail'](_0x37b1a2)){_0x5f5b49['or'](_0xaec5('0x32'),_0x37b1a2+'%');}else{_0x5f5b49['or'](_0xaec5('0x33'),'%'+_0x37b1a2+'%');_0x5f5b49['or'](_0xaec5('0x34'),'%'+_0x37b1a2+'%');_0x5f5b49['or'](_0xaec5('0x32'),'%'+_0x37b1a2+'%');}}}return _0x5f5b49;}function parseAdvancedSearchFilter(_0x2181e0,_0x5c88f7){var _0x30b524=getSqlClauses();var _0x1cdd82=as['parseSearch'](_0x2181e0);var _0x11be5a=_0x1cdd82['sqlOperator'];for(var _0x69170e=0x0;_0x69170e<_0x1cdd82[_0xaec5('0x35')][_0xaec5('0x2b')];_0x69170e++){var _0x5217f0=_0x1cdd82['conditions'][_0x69170e];var _0x5054a9='c';var _0x2c1a81=_['find'](_0x5c88f7,['name',_0x5217f0[_0xaec5('0x24')]]);if(_0x2c1a81){if(_0x5217f0[_0xaec5('0x24')]==='dateOfBirth'||_0x2c1a81[_0xaec5('0x36')]===_0xaec5('0x37')){_0x5217f0[_0xaec5('0x38')]=_0xaec5('0x39');}var _0x31512f=as['buildExpression'](_0x5054a9,_0x2c1a81[_0xaec5('0x3a')],_0x5217f0);_0x30b524[_0xaec5('0x3b')][_0x11be5a](_0x31512f[_0xaec5('0x3c')],_0x31512f['value'][_0xaec5('0x3d')],_0x31512f['value'][_0xaec5('0x3e')]);}else{if(_0x5217f0['field']===_0xaec5('0x3f')){var _0x5cf3f0=_0x5217f0['value']['split'](',')[_0xaec5('0x40')](function(_0x179233){return Number(_0x179233);});var _0x1b5176=parseTagParameter(_0x5cf3f0);_0x30b524[_0xaec5('0x41')][_0xaec5('0x42')][_0xaec5('0x43')](_0x1b5176);_0x30b524[_0xaec5('0x41')]['ids']=_0x5cf3f0;}else if(_0x5217f0[_0xaec5('0x24')]===_0xaec5('0x44')){_0x30b524[_0xaec5('0x45')][_0xaec5('0x42')][_0xaec5('0x43')](_0xaec5('0x46'),_0x5217f0[_0xaec5('0x47')]);_0x30b524[_0xaec5('0x45')][_0xaec5('0x48')]=!![];}}}return _0x30b524;}function parseModelFields(_0x3d218e,_0x4d24e4){var _0x5a43a3=squel['expr']();var _0x4d7d92=_(_0x3d218e)[_0xaec5('0x49')]()[_0xaec5('0x40')](function(_0x5dc7a5){return _['some'](_0x4d24e4,[_0xaec5('0x4a'),_0x5dc7a5])?_0x5dc7a5:undefined;})[_0xaec5('0x4b')]()[_0xaec5('0x47')]();if(_0x3d218e[_0xaec5('0x4c')]){_0x4d7d92[_0xaec5('0x21')](_0xaec5('0x4c'));}if(_0x3d218e[_0xaec5('0x44')]){_0x4d7d92[_0xaec5('0x21')](_0xaec5('0x44'));}if(_0x4d7d92[_0xaec5('0x2b')]>0x0){_0x4d7d92['forEach'](function(_0x57d405){if(_0x57d405===_0xaec5('0x1b')){_0x5a43a3[_0xaec5('0x43')]('c.ListId\x20IN\x20?',[][_0xaec5('0x4d')](_0x3d218e[_0x57d405]));}else if(_0x57d405===_0xaec5('0x4c')){var _0x42f47a='%'+_0x3d218e[_0x57d405]+'%';_0x5a43a3[_0xaec5('0x43')](_0xaec5('0x4e'),_0x42f47a);}else if(_0x57d405==='User'){_0x5a43a3[_0xaec5('0x43')](_0xaec5('0x46'),_0x3d218e[_0x57d405]);}else{_0x5a43a3[_0xaec5('0x43')]('c.'+_0x57d405+_0xaec5('0x4f'),_0x3d218e[_0x57d405]);}});}return _0x5a43a3;}function parseQueryParameters(_0x3f7ebe,_0x1b9dca){var _0xa8c52c=getSqlClauses();return Promise[_0xaec5('0x50')]()[_0xaec5('0x51')](function(){return parseModelFields(_0x3f7ebe,_0x1b9dca);})[_0xaec5('0x51')](function(_0x33b846){_0xa8c52c[_0xaec5('0x52')][_0xaec5('0x43')](_0x33b846);return parseTagParameter(_0x3f7ebe[_0xaec5('0x53')]);})['then'](function(_0x5d6656){_0xa8c52c[_0xaec5('0x41')][_0xaec5('0x42')]['and'](_0x5d6656);return parseSearchFilter(_0x3f7ebe['filter']);})[_0xaec5('0x51')](function(_0x3debc5){_0xa8c52c['filter']=_0x3debc5;return _0xa8c52c;});}function checkListsRestrictions(_0x3381b7,_0x1340c1,_0x5cd403){var _0x2af7c3=squel[_0xaec5('0x26')]();return Promise[_0xaec5('0x50')]()['then'](function(){if(_0x1340c1[_0xaec5('0x7')]&&_0x3381b7[_0xaec5('0x54')]===_0xaec5('0x6')&&!_0x5cd403){return _0x3381b7[_0xaec5('0x55')]({'attributes':['id'],'raw':!![]});}})[_0xaec5('0x51')](function(_0x5da18e){if(_0x5da18e){if(_0x5da18e[_0xaec5('0x2b')]===0x0){_0x2af7c3[_0xaec5('0x43')]('c.ListId\x20IS\x20NULL');}else{_0x2af7c3['and'](_0xaec5('0x56'),_[_0xaec5('0x40')](_0x5da18e,'id'));}}})[_0xaec5('0x51')](function(){return _0x2af7c3;});}function buildContactsQuery(_0x14d520,_0x1a8d73,_0x3cf85b,_0x592117,_0x57eb85,_0x50139b){if(_0x1a8d73){_0x1a8d73=_0x3cf85b['attributes'];}_0x14d520=addFieldsToQuery(_0x14d520,_0x1a8d73,_0x592117,_0x50139b,!![]);var _0x4a6a65=squel[_0xaec5('0xa')]();_0x4a6a65=addFieldsToQuery(_0x4a6a65,_0x1a8d73,_0x592117,_0x50139b,![]);if(_0x592117||_0x50139b){_0x14d520=applyJoinClauses(_0x14d520,!![]);_0x14d520[_0xaec5('0x57')](_0xaec5('0x58'));if(_0x3cf85b['limit']){_0x4a6a65['limit'](_0x3cf85b[_0xaec5('0x59')]);}if(_0x3cf85b[_0xaec5('0x5a')]){_0x4a6a65[_0xaec5('0x5a')](_0x3cf85b[_0xaec5('0x5a')]);}}else{_0x4a6a65=applyJoinClauses(_0x4a6a65,![]);_0x4a6a65['group']('subqry.id');if(_0x3cf85b[_0xaec5('0x59')]){_0x14d520[_0xaec5('0x59')](_0x3cf85b[_0xaec5('0x59')]);}if(_0x3cf85b['offset']){_0x14d520[_0xaec5('0x5a')](_0x3cf85b[_0xaec5('0x5a')]);}}_0x4a6a65['having'](_0x57eb85);if(_0x3cf85b[_0xaec5('0x5b')]){_0x3cf85b[_0xaec5('0x5b')][_0xaec5('0x22')](function(_0x37e5f5){_0x14d520[_0xaec5('0x5b')]('c.'+_0x37e5f5[0x0],_0x37e5f5[0x1]===_0xaec5('0x5c')?![]:!![]);_0x4a6a65['order'](_0xaec5('0x5d')+_0x37e5f5[0x0],_0x37e5f5[0x1]===_0xaec5('0x5c')?![]:!![]);});}_0x4a6a65[_0xaec5('0xb')](_0x14d520,_0xaec5('0xd'));return _0x4a6a65;}function getFilteredContacts(_0x35346b){var _0x119460=[];return db['Tag'][_0xaec5('0x5e')]({'attributes':['id',_0xaec5('0x4a'),'color'],'raw':!![]})[_0xaec5('0x51')](function(_0x53c1dd){_0x119460=_[_0xaec5('0x5f')](_0x53c1dd,'id');var _0x30a5e5={'type':db['Sequelize'][_0xaec5('0x60')][_0xaec5('0x61')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xaec5('0x62')][_0xaec5('0x63')](_0x35346b[_0xaec5('0x64')](),_0x30a5e5);})[_0xaec5('0x51')](function(_0x5efc64){_0x5efc64[_0xaec5('0x22')](function(_0x174cc7){if(_0x174cc7[_0xaec5('0x23')]){_0x174cc7['Tags']=[];_0x174cc7[_0xaec5('0x23')][_0xaec5('0x2a')](',')[_0xaec5('0x22')](function(_0x16a91c){_0x174cc7[_0xaec5('0x65')][_0xaec5('0x21')](_0x119460[_0x16a91c]);});}delete _0x174cc7['TagIds'];});return _0x5efc64;});}function countFilteredContacts(_0x2eddc7,_0x346569){var _0x182de9=_0x2eddc7['clone']();_0x182de9['field'](_0xaec5('0x66'));_0x182de9=applyJoinClauses(_0x182de9,!![]);_0x2eddc7[_0xaec5('0x57')](_0xaec5('0x58'));var _0x1a2dec=utils[_0xaec5('0x27')](_0x346569);if(!_[_0xaec5('0x67')](_0x1a2dec)){_0x182de9[_0xaec5('0xc')](_0xaec5('0x68'),_0x1a2dec);}var _0x570b81={'type':db[_0xaec5('0x69')]['QueryTypes'][_0xaec5('0x61')],'raw':!![]};return db[_0xaec5('0x62')][_0xaec5('0x63')](_0x182de9[_0xaec5('0x64')](),_0x570b81)[_0xaec5('0x51')](function(_0x4086ee){return _0x4086ee[0x0][_0xaec5('0x66')];});}module[_0xaec5('0x6a')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xa07a=['includes','push','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','DATE','type','default','text','start','end','Tag','value','split','clause','tags','ids','User','user','and','skip','map','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','fields','tag','role','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','firstName','lastName','phone','mobile','fax','CompanyId','createdAt','updatedAt'];(function(_0x5a5f05,_0x234d2a){var _0x52a1d4=function(_0x4d9e7c){while(--_0x4d9e7c){_0x5a5f05['push'](_0x5a5f05['shift']());}};_0x52a1d4(++_0x234d2a);}(_0xa07a,0xbe));var _0xaa07=function(_0x4b0637,_0x18d2c8){_0x4b0637=_0x4b0637-0x0;var _0x2239c4=_0xa07a[_0x4b0637];return _0x2239c4;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0xaa07('0x0'));var qs=require(_0xaa07('0x1'));var utils=require(_0xaa07('0x2'));var db=require(_0xaa07('0x3'))['db'];function skipContactsQuery(_0x54a8cc,_0x3e13eb){var _0x14f0c3=![];if(_0x54a8cc['role']===_0xaa07('0x4')&&!_0x3e13eb[_0xaa07('0x5')]&&!_0x3e13eb[_0xaa07('0x6')]&&_0x3e13eb[_0xaa07('0x7')]!==_0xaa07('0x8')){_0x14f0c3=!![];}return _0x14f0c3;}function getContactsSubquery(){return squel[_0xaa07('0x9')]()[_0xaa07('0xa')]('cm_contacts','c')[_0xaa07('0xb')](_0xaa07('0xc'));}function applyJoinClauses(_0x2a4e78,_0x30855b){var _0x5ea234=_0x30855b?'c':_0xaa07('0xd');_0x2a4e78[_0xaa07('0xe')](_0xaa07('0xf'),'uc',_0xaa07('0x10')+_0x5ea234+_0xaa07('0x11'))[_0xaa07('0xe')](_0xaa07('0x12'),'ct',_0xaa07('0x13')+_0x5ea234+_0xaa07('0x11'))['left_join']('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x2a4e78;}function addFieldsToQuery(_0x56de0d,_0x530eab,_0x51fdd3,_0x10e457,_0x1fe152){var _0x381fdb=_0x1fe152?'c':'subqry';if(!_0x530eab){_0x530eab=['id',_0xaa07('0x14'),_0xaa07('0x15'),_0xaa07('0x16'),_0xaa07('0x17'),_0xaa07('0x18'),'email',_0xaa07('0x6'),_0xaa07('0x19'),_0xaa07('0x1a'),_0xaa07('0x1b'),'deletedAt','TagIds'];}else if(!_0x530eab[_0xaa07('0x1c')]('id')){_0x530eab[_0xaa07('0x1d')]('id');}var _0x5cb913=_0x51fdd3&&_0x1fe152||!_0x51fdd3&&!_0x1fe152;if(_0x10e457){_0x5cb913=_0x10e457&&_0x1fe152||!_0x10e457&&!_0x1fe152;}_0x530eab['forEach'](function(_0x2cfc5e){if(_0x2cfc5e===_0xaa07('0x1e')){if(_0x5cb913){_0x56de0d[_0xaa07('0x1f')](_0xaa07('0x20'),_0x2cfc5e);}else if(_0x51fdd3||_0x10e457){_0x56de0d[_0xaa07('0x1f')](_0x381fdb+'.'+_0x2cfc5e);}}else{_0x56de0d['field'](_0x381fdb+'.'+_0x2cfc5e);}});return _0x56de0d;}function getSqlClauses(){var _0x39b033={'default':squel['expr'](),'fields':squel[_0xaa07('0x21')](),'filter':squel[_0xaa07('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xaa07('0x21')](),'skip':![]}};return _0x39b033;}function parseTagParameter(_0x952eb1){var _0x2d40fe=squel[_0xaa07('0x21')]();if(_0x952eb1){var _0x46a9a8=utils[_0xaa07('0x22')](_0x952eb1);_0x46a9a8[_0xaa07('0x23')](function(_0x1bbabf){_0x2d40fe['or'](_0xaa07('0x24'),'%,'+_0x1bbabf+',%');});}return _0x2d40fe;}function parseSearchFilter(_0xd124b3){var _0x27fe81=squel[_0xaa07('0x21')]();if(_0xd124b3){var _0x15ec63=_0xd124b3[_0xaa07('0x25')]('\x5c','\x5c\x5c')[_0xaa07('0x25')](/'/g,'\x27\x27');if(_0x15ec63['split']('\x20')[_0xaa07('0x26')]>0x1){_0x27fe81['or'](_0xaa07('0x27'),qs['getFullTextValue'](_0x15ec63,!![]),null);}else{if(qs[_0xaa07('0x28')](_0x15ec63)){_0x27fe81['or']('c.id\x20LIKE\x20?',_0x15ec63+'%');_0x27fe81['or'](_0xaa07('0x29'),_0x15ec63+'%');_0x27fe81['or'](_0xaa07('0x2a'),_0x15ec63+'%');_0x27fe81['or'](_0xaa07('0x2b'),_0x15ec63+'%');}else if(qs[_0xaa07('0x2c')](_0x15ec63)){_0x27fe81['or']('c.email\x20LIKE\x20?',_0x15ec63+'%');}else{_0x27fe81['or'](_0xaa07('0x2d'),'%'+_0x15ec63+'%');_0x27fe81['or']('c.lastName\x20LIKE\x20?','%'+_0x15ec63+'%');_0x27fe81['or'](_0xaa07('0x2e'),'%'+_0x15ec63+'%');}}}return _0x27fe81;}function parseAdvancedSearchFilter(_0x53b894,_0x393ec4){var _0x5b3d97=getSqlClauses();var _0x130f62=as[_0xaa07('0x2f')](_0x53b894);var _0x458742=_0x130f62['sqlOperator'];for(var _0x4561b4=0x0;_0x4561b4<_0x130f62[_0xaa07('0x30')][_0xaa07('0x26')];_0x4561b4++){var _0x3181c6=_0x130f62[_0xaa07('0x30')][_0x4561b4];var _0x3da2be='c';var _0x5dd761=_[_0xaa07('0x31')](_0x393ec4,[_0xaa07('0x32'),_0x3181c6[_0xaa07('0x1f')]]);if(_0x5dd761){if(_0x3181c6['field']===_0xaa07('0x33')||_0x5dd761['fieldType']==='datetime'){_0x3181c6['castTo']=_0xaa07('0x34');}var _0x40f5b4=as['buildExpression'](_0x3da2be,_0x5dd761[_0xaa07('0x35')],_0x3181c6);_0x5b3d97[_0xaa07('0x36')][_0x458742](_0x40f5b4[_0xaa07('0x37')],_0x40f5b4['value'][_0xaa07('0x38')],_0x40f5b4['value'][_0xaa07('0x39')]);}else{if(_0x3181c6['field']===_0xaa07('0x3a')){var _0x45783a=_0x3181c6[_0xaa07('0x3b')][_0xaa07('0x3c')](',')['map'](function(_0xb52a3d){return Number(_0xb52a3d);});var _0x2dafcd=parseTagParameter(_0x45783a);_0x5b3d97['tags'][_0xaa07('0x3d')]['and'](_0x2dafcd);_0x5b3d97[_0xaa07('0x3e')][_0xaa07('0x3f')]=_0x45783a;}else if(_0x3181c6[_0xaa07('0x1f')]===_0xaa07('0x40')){_0x5b3d97[_0xaa07('0x41')]['clause'][_0xaa07('0x42')]('uc.UserId\x20=\x20?',_0x3181c6[_0xaa07('0x3b')]);_0x5b3d97[_0xaa07('0x41')][_0xaa07('0x43')]=!![];}}}return _0x5b3d97;}function parseModelFields(_0x563eb8,_0x4413de){var _0x425ce1=squel[_0xaa07('0x21')]();var _0x2904eb=_(_0x563eb8)['keys']()[_0xaa07('0x44')](function(_0x1db2f6){return _[_0xaa07('0x45')](_0x4413de,[_0xaa07('0x32'),_0x1db2f6])?_0x1db2f6:undefined;})[_0xaa07('0x46')]()['value']();if(_0x563eb8['Contact']){_0x2904eb[_0xaa07('0x1d')](_0xaa07('0x47'));}if(_0x563eb8['User']){_0x2904eb[_0xaa07('0x1d')](_0xaa07('0x40'));}if(_0x2904eb[_0xaa07('0x26')]>0x0){_0x2904eb[_0xaa07('0x23')](function(_0x1f7da3){if(_0x1f7da3==='ListId'){_0x425ce1[_0xaa07('0x42')](_0xaa07('0x48'),[][_0xaa07('0x49')](_0x563eb8[_0x1f7da3]));}else if(_0x1f7da3===_0xaa07('0x47')){var _0x382ff3='%'+_0x563eb8[_0x1f7da3]+'%';_0x425ce1[_0xaa07('0x42')](_0xaa07('0x4a'),_0x382ff3);}else if(_0x1f7da3===_0xaa07('0x40')){_0x425ce1[_0xaa07('0x42')](_0xaa07('0x4b'),_0x563eb8[_0x1f7da3]);}else{_0x425ce1[_0xaa07('0x42')]('c.'+_0x1f7da3+_0xaa07('0x4c'),_0x563eb8[_0x1f7da3]);}});}return _0x425ce1;}function parseQueryParameters(_0x1a011c,_0x589ba2){var _0xf2767e=getSqlClauses();return Promise[_0xaa07('0x4d')]()[_0xaa07('0x4e')](function(){return parseModelFields(_0x1a011c,_0x589ba2);})[_0xaa07('0x4e')](function(_0xa231f6){_0xf2767e[_0xaa07('0x4f')][_0xaa07('0x42')](_0xa231f6);return parseTagParameter(_0x1a011c[_0xaa07('0x50')]);})[_0xaa07('0x4e')](function(_0x4d727c){_0xf2767e[_0xaa07('0x3e')]['clause'][_0xaa07('0x42')](_0x4d727c);return parseSearchFilter(_0x1a011c['filter']);})[_0xaa07('0x4e')](function(_0x427eae){_0xf2767e['filter']=_0x427eae;return _0xf2767e;});}function checkListsRestrictions(_0x2c904b,_0x509976,_0x16848b){var _0x2dea00=squel[_0xaa07('0x21')]();return Promise['resolve']()[_0xaa07('0x4e')](function(){if(_0x509976['search']&&_0x2c904b[_0xaa07('0x51')]===_0xaa07('0x4')&&!_0x16848b){return _0x2c904b[_0xaa07('0x52')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x588bff){if(_0x588bff){if(_0x588bff[_0xaa07('0x26')]===0x0){_0x2dea00['and'](_0xaa07('0x53'));}else{_0x2dea00[_0xaa07('0x42')](_0xaa07('0x48'),_[_0xaa07('0x44')](_0x588bff,'id'));}}})[_0xaa07('0x4e')](function(){return _0x2dea00;});}function buildContactsQuery(_0x52e8eb,_0x3ff0a9,_0x138690,_0x576803,_0xf0604b,_0x290af4){if(_0x3ff0a9){_0x3ff0a9=_0x138690[_0xaa07('0x54')];}_0x52e8eb=addFieldsToQuery(_0x52e8eb,_0x3ff0a9,_0x576803,_0x290af4,!![]);var _0x23e165=squel[_0xaa07('0x9')]();_0x23e165=addFieldsToQuery(_0x23e165,_0x3ff0a9,_0x576803,_0x290af4,![]);if(_0x576803||_0x290af4){_0x52e8eb=applyJoinClauses(_0x52e8eb,!![]);_0x52e8eb[_0xaa07('0x55')](_0xaa07('0x56'));if(_0x138690[_0xaa07('0x57')]){_0x23e165[_0xaa07('0x57')](_0x138690[_0xaa07('0x57')]);}if(_0x138690[_0xaa07('0x58')]){_0x23e165[_0xaa07('0x58')](_0x138690[_0xaa07('0x58')]);}}else{_0x23e165=applyJoinClauses(_0x23e165,![]);_0x23e165['group'](_0xaa07('0x59'));if(_0x138690[_0xaa07('0x57')]){_0x52e8eb['limit'](_0x138690[_0xaa07('0x57')]);}if(_0x138690[_0xaa07('0x58')]){_0x52e8eb[_0xaa07('0x58')](_0x138690[_0xaa07('0x58')]);}}_0x23e165[_0xaa07('0x5a')](_0xf0604b);if(_0x138690[_0xaa07('0x5b')]){_0x138690['order'][_0xaa07('0x23')](function(_0x43b66d){_0x52e8eb['order']('c.'+_0x43b66d[0x0],_0x43b66d[0x1]===_0xaa07('0x5c')?![]:!![]);_0x23e165[_0xaa07('0x5b')](_0xaa07('0x5d')+_0x43b66d[0x0],_0x43b66d[0x1]==='DESC'?![]:!![]);});}_0x23e165[_0xaa07('0xa')](_0x52e8eb,_0xaa07('0xd'));return _0x23e165;}function getFilteredContacts(_0x1709c5){var _0x1dc8de=[];return db[_0xaa07('0x3a')][_0xaa07('0x5e')]({'attributes':['id','name',_0xaa07('0x5f')],'raw':!![]})[_0xaa07('0x4e')](function(_0x4910c9){_0x1dc8de=_[_0xaa07('0x60')](_0x4910c9,'id');var _0x5924ed={'type':db[_0xaa07('0x61')][_0xaa07('0x62')][_0xaa07('0x63')],'model':db[_0xaa07('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xaa07('0x65')][_0xaa07('0x66')](_0x1709c5[_0xaa07('0x67')](),_0x5924ed);})[_0xaa07('0x4e')](function(_0x518f66){_0x518f66['forEach'](function(_0x33f2b5){if(_0x33f2b5[_0xaa07('0x1e')]){_0x33f2b5[_0xaa07('0x68')]=[];_0x33f2b5[_0xaa07('0x1e')][_0xaa07('0x3c')](',')['forEach'](function(_0x2c8e9b){_0x33f2b5[_0xaa07('0x68')][_0xaa07('0x1d')](_0x1dc8de[_0x2c8e9b]);});}delete _0x33f2b5['TagIds'];});return _0x518f66;});}function countFilteredContacts(_0x7c5e5c,_0x55524c){var _0x59153c=_0x7c5e5c['clone']();_0x59153c[_0xaa07('0x1f')](_0xaa07('0x69'));_0x59153c=applyJoinClauses(_0x59153c,!![]);_0x7c5e5c['group'](_0xaa07('0x56'));var _0x4b7b5a=utils[_0xaa07('0x22')](_0x55524c);if(!_[_0xaa07('0x6a')](_0x4b7b5a)){_0x59153c[_0xaa07('0xb')](_0xaa07('0x6b'),_0x4b7b5a);}var _0xcef175={'type':db[_0xaa07('0x61')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0xaa07('0x65')]['query'](_0x59153c[_0xaa07('0x67')](),_0xcef175)[_0xaa07('0x4e')](function(_0x1cde24){return _0x1cde24[0x0][_0xaa07('0x69')];});}module[_0xaa07('0x6c')]={'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 d84a628..319abaf 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 _0xc819=['../../config/logger','app','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','unlink','createDecipher','update','final','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment'];(function(_0xff48c5,_0x39f856){var _0x1a262f=function(_0xde03a6){while(--_0xde03a6){_0xff48c5['push'](_0xff48c5['shift']());}};_0x1a262f(++_0x39f856);}(_0xc819,0x1be));var _0x9c81=function(_0xa54d5f,_0x17fa6d){_0xa54d5f=_0xa54d5f-0x0;var _0x455964=_0xc819[_0xa54d5f];return _0x455964;};'use strict';var crypto=require(_0x9c81('0x0'));var fs=require('fs');var BPromise=require(_0x9c81('0x1'));var _=require(_0x9c81('0x2'));var config=require(_0x9c81('0x3'));var logger=require(_0x9c81('0x4'))(_0x9c81('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x9c81('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x9c81('0x7')]&&config[_0x9c81('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x9c81('0x7')][_0x9c81('0x8')]);if(isSupported){fileOptions[_0x9c81('0x8')]=config['encrypt'][_0x9c81('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x9c81('0x9')](config[_0x9c81('0x7')][_0x9c81('0x8')],_0x9c81('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x1203cb){return AES_SUPPORTED_RX['test'](_0x1203cb);}function getSupportedCiphers(){return crypto[_0x9c81('0xb')]()[_0x9c81('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x1b0f70){return getSupportedCiphers()[_0x9c81('0xd')](_0x1b0f70)>-0x1;}function combineOptions(_0xe73848){var _0x340794={};for(var _0x47bf13 in fileOptions){if(fileOptions['hasOwnProperty'](_0x47bf13)){_0x340794[_0x47bf13]=fileOptions[_0x47bf13];}}if(_0xe73848){for(var _0x25576b in _0xe73848){if(_0xe73848['hasOwnProperty'](_0x25576b)){_0x340794[_0x25576b]=_0xe73848[_0x25576b];}}}return _0x340794;}exports[_0x9c81('0xe')]=function(_0x519760,_0x4b6bc0,_0x47123c,_0x3d5b86){return new BPromise(function(_0x331849,_0x5f4979){_0x3d5b86=combineOptions(_0x3d5b86);var _0x50ecd7=new Buffer(_0x47123c);var _0x817b51=fs[_0x9c81('0xf')](_0x519760);var _0xbcfbc4=fs[_0x9c81('0x10')](_0x4b6bc0);var _0x22ecf3=crypto[_0x9c81('0x11')](_0x3d5b86[_0x9c81('0x8')],_0x50ecd7);_0x817b51['on'](_0x9c81('0x12'),function(_0x3ce9eb){var _0x6d91c2=new Buffer(_0x22ecf3['update'](_0x3ce9eb),_0x9c81('0x13'));_0xbcfbc4[_0x9c81('0x14')](_0x6d91c2);});_0x817b51['on'](_0x9c81('0x15'),function(){try{var _0xdf3b49=new Buffer(_0x22ecf3['final'](_0x9c81('0x13')),'binary');_0xbcfbc4[_0x9c81('0x14')](_0xdf3b49);_0xbcfbc4[_0x9c81('0x15')]();_0xbcfbc4['on']('close',function(){return _0x331849(_0x4b6bc0);});}catch(_0x2fb3dd){fs[_0x9c81('0x16')](_0x4b6bc0);return _0x5f4979(_0x2fb3dd);}});});};exports['decryptFile']=function(_0x380881,_0x1797b7,_0x1a2044,_0x3919b1){return new BPromise(function(_0x1a39e3,_0x3edb7c){_0x3919b1=combineOptions(_0x3919b1);var _0xe80e44=new Buffer(_0x1a2044);var _0x2a4bd0=fs['createReadStream'](_0x380881);var _0x1783d5=fs[_0x9c81('0x10')](_0x1797b7);var _0x337017=crypto[_0x9c81('0x17')](_0x3919b1['algorithm'],_0xe80e44);_0x2a4bd0['on'](_0x9c81('0x12'),function(_0x8b4239){var _0x2a635b=new Buffer(_0x337017[_0x9c81('0x18')](_0x8b4239),_0x9c81('0x13'));_0x1783d5['write'](_0x2a635b);});_0x2a4bd0['on'](_0x9c81('0x15'),function(){try{var _0x340d31=new Buffer(_0x337017[_0x9c81('0x19')](_0x9c81('0x13')),_0x9c81('0x13'));_0x1783d5[_0x9c81('0x14')](_0x340d31);_0x1783d5['end']();_0x1783d5['on']('close',function(){return _0x1a39e3(_0x1797b7);});}catch(_0x1e9229){fs['unlink'](_0x1797b7);return _0x3edb7c(_0x1e9229);}});});};exports['encryptString']=function(_0x313da2,_0x21faf5,_0x3cf986){var _0x1e965b=_0x3cf986||stringOptions['algorithm'];var _0x452d7d=_0x21faf5||stringOptions[_0x9c81('0x1a')];var _0x2e600b=crypto[_0x9c81('0x11')](_0x1e965b,_0x452d7d);var _0x464016=_0x2e600b[_0x9c81('0x18')](_0x313da2,_0x9c81('0x1b'),'base64');_0x464016+=_0x2e600b['final'](_0x9c81('0x1c'));return _0x464016;};exports[_0x9c81('0x1d')]=function(_0x40adc6,_0x294fac,_0x58d6f3){var _0x337710=_0x58d6f3||stringOptions['algorithm'];var _0x2ebaa6=_0x294fac||stringOptions[_0x9c81('0x1a')];var _0xd4259d=crypto[_0x9c81('0x17')](_0x337710,_0x2ebaa6);var _0x21652c=_0xd4259d[_0x9c81('0x18')](_0x40adc6,_0x9c81('0x1c'),_0x9c81('0x1b'));_0x21652c+=_0xd4259d[_0x9c81('0x19')](_0x9c81('0x1b'));return _0x21652c;}; \ No newline at end of file +var _0x0cb0=['decryptFile','createDecipher','encryptString','secret','update','utf8','base64','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','write','end','final','binary','close','unlink'];(function(_0x18f713,_0x379588){var _0x4d524a=function(_0x405ef4){while(--_0x405ef4){_0x18f713['push'](_0x18f713['shift']());}};_0x4d524a(++_0x379588);}(_0x0cb0,0x15b));var _0x00cb=function(_0x52faef,_0x3dee75){_0x52faef=_0x52faef-0x0;var _0x5114ee=_0x0cb0[_0x52faef];return _0x5114ee;};'use strict';var crypto=require(_0x00cb('0x0'));var fs=require('fs');var BPromise=require(_0x00cb('0x1'));var _=require(_0x00cb('0x2'));var config=require('../../config/environment');var logger=require(_0x00cb('0x3'))(_0x00cb('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x00cb('0x5')][_0x00cb('0x6')],'algorithm':_0x00cb('0x7')};const fileOptions={'algorithm':_0x00cb('0x8')};if(config[_0x00cb('0x9')]&&config[_0x00cb('0x9')][_0x00cb('0xa')]){var isSupported=isAlgorithmSupported(config[_0x00cb('0x9')][_0x00cb('0xa')]);if(isSupported){fileOptions[_0x00cb('0xa')]=config[_0x00cb('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x00cb('0xb')](',\x20');logger[_0x00cb('0xc')](config[_0x00cb('0x9')][_0x00cb('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x175137){return AES_SUPPORTED_RX[_0x00cb('0xd')](_0x175137);}function getSupportedCiphers(){return crypto[_0x00cb('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xfb607e){return getSupportedCiphers()[_0x00cb('0xf')](_0xfb607e)>-0x1;}function combineOptions(_0x31cf68){var _0x5ee050={};for(var _0x85b8bd in fileOptions){if(fileOptions[_0x00cb('0x10')](_0x85b8bd)){_0x5ee050[_0x85b8bd]=fileOptions[_0x85b8bd];}}if(_0x31cf68){for(var _0x201880 in _0x31cf68){if(_0x31cf68[_0x00cb('0x10')](_0x201880)){_0x5ee050[_0x201880]=_0x31cf68[_0x201880];}}}return _0x5ee050;}exports[_0x00cb('0x11')]=function(_0xc623c4,_0x3bc01d,_0x31c4f5,_0x5e017e){return new BPromise(function(_0x2a2dd6,_0x142269){_0x5e017e=combineOptions(_0x5e017e);var _0x5ea5e8=new Buffer(_0x31c4f5);var _0x469d16=fs[_0x00cb('0x12')](_0xc623c4);var _0x4da74f=fs[_0x00cb('0x13')](_0x3bc01d);var _0x322d4f=crypto[_0x00cb('0x14')](_0x5e017e['algorithm'],_0x5ea5e8);_0x469d16['on']('data',function(_0x54c7c3){var _0x1af560=new Buffer(_0x322d4f['update'](_0x54c7c3),'binary');_0x4da74f[_0x00cb('0x15')](_0x1af560);});_0x469d16['on'](_0x00cb('0x16'),function(){try{var _0x20fef3=new Buffer(_0x322d4f[_0x00cb('0x17')](_0x00cb('0x18')),'binary');_0x4da74f[_0x00cb('0x15')](_0x20fef3);_0x4da74f[_0x00cb('0x16')]();_0x4da74f['on'](_0x00cb('0x19'),function(){return _0x2a2dd6(_0x3bc01d);});}catch(_0x389639){fs[_0x00cb('0x1a')](_0x3bc01d);return _0x142269(_0x389639);}});});};exports[_0x00cb('0x1b')]=function(_0x54b35a,_0x278ed9,_0x425999,_0xf3dfd0){return new BPromise(function(_0x2f9031,_0x49f572){_0xf3dfd0=combineOptions(_0xf3dfd0);var _0x1c52ca=new Buffer(_0x425999);var _0x11f606=fs[_0x00cb('0x12')](_0x54b35a);var _0x5eb20e=fs[_0x00cb('0x13')](_0x278ed9);var _0x1ffe24=crypto[_0x00cb('0x1c')](_0xf3dfd0['algorithm'],_0x1c52ca);_0x11f606['on']('data',function(_0x2cd3c6){var _0x1021c8=new Buffer(_0x1ffe24['update'](_0x2cd3c6),_0x00cb('0x18'));_0x5eb20e[_0x00cb('0x15')](_0x1021c8);});_0x11f606['on'](_0x00cb('0x16'),function(){try{var _0x542ff0=new Buffer(_0x1ffe24['final'](_0x00cb('0x18')),_0x00cb('0x18'));_0x5eb20e[_0x00cb('0x15')](_0x542ff0);_0x5eb20e[_0x00cb('0x16')]();_0x5eb20e['on'](_0x00cb('0x19'),function(){return _0x2f9031(_0x278ed9);});}catch(_0x19bd82){fs['unlink'](_0x278ed9);return _0x49f572(_0x19bd82);}});});};exports[_0x00cb('0x1d')]=function(_0x5dffce,_0x5c8b14,_0x5a6277){var _0x43f2f0=_0x5a6277||stringOptions['algorithm'];var _0x3a8144=_0x5c8b14||stringOptions[_0x00cb('0x1e')];var _0x198aec=crypto['createCipher'](_0x43f2f0,_0x3a8144);var _0x19c398=_0x198aec[_0x00cb('0x1f')](_0x5dffce,_0x00cb('0x20'),_0x00cb('0x21'));_0x19c398+=_0x198aec[_0x00cb('0x17')](_0x00cb('0x21'));return _0x19c398;};exports['decryptString']=function(_0x2f38a4,_0x15edf9,_0x2533ab){var _0x405270=_0x2533ab||stringOptions[_0x00cb('0xa')];var _0x278972=_0x15edf9||stringOptions[_0x00cb('0x1e')];var _0x32a467=crypto['createDecipher'](_0x405270,_0x278972);var _0x3889e9=_0x32a467[_0x00cb('0x1f')](_0x2f38a4,_0x00cb('0x21'),'utf8');_0x3889e9+=_0x32a467[_0x00cb('0x17')](_0x00cb('0x20'));return _0x3889e9;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 031f1b2..9d191fb 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 _0xc069=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','existsSync','each','then','join','%s%d.%s','csv','%s.%s','zip','zip\x20finished','CSV'];(function(_0x473668,_0x36f38f){var _0x3ecbc3=function(_0x5df177){while(--_0x5df177){_0x473668['push'](_0x473668['shift']());}};_0x3ecbc3(++_0x36f38f);}(_0xc069,0x10c));var _0x9c06=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc069[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x9c06('0x0'));var path=require(_0x9c06('0x1'));var _=require(_0x9c06('0x2'));var csv=require(_0x9c06('0x3'));var fs=require('fs');var BPromise=require(_0x9c06('0x4'));var zipdir=require(_0x9c06('0x5'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x9c06('0x6'))['dbH'];var logger=require(_0x9c06('0x7'))(_0x9c06('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x9c06('0x9')][0x2]);var QUERY=process[_0x9c06('0x9')][0x3];var PATH=process[_0x9c06('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4584fb,_0x5ca3e5){var _0x59ba11={'status':_0x4584fb};var _0x522887={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ca3e5){_0x59ba11[_0x9c06('0xa')]=_0x5ca3e5;}return db[_0x9c06('0xb')]['update'](_0x59ba11,_0x522887);}function main(){var _0xf397c0=0x1388;var _0x100e93;logger[_0x9c06('0xc')](util[_0x9c06('0xd')](_0x9c06('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x9c06('0xf')][_0x9c06('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9c06('0x11'),_0x9c06('0x12')]})['then'](function(_0x94c56b){if(_0x94c56b){_0x100e93=_0x94c56b;_0xf397c0=_0x100e93['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x9c06('0x13')][_0x9c06('0x14')](util[_0x9c06('0xd')](_0x9c06('0x15'),QUERY),{'type':dbH[_0x9c06('0x13')][_0x9c06('0x16')]['SELECT']});})['then'](function(_0x46d6ef){if(!_0x46d6ef[0x0][_0x9c06('0x17')]){return analyticExtractedReport('Empty');}var _0xe956d3=[];var _0x3b468f=0x0;if(_0x100e93['split']){if(_0x46d6ef&&_0x46d6ef[_0x9c06('0x18')]){var _0x52d0f5=_[_0x9c06('0x19')](_0x46d6ef[0x0][_0x9c06('0x17')]/_0xf397c0);var _0xba51a4=Number[_0x9c06('0x1a')](_0x46d6ef[0x0][_0x9c06('0x17')]/_0xf397c0)?_0x46d6ef[0x0][_0x9c06('0x17')]%_0xf397c0:0x0;_0x52d0f5['forEach'](function(_0x33ad3f){if(_0x33ad3f>0x0){_0x3b468f+=_0xf397c0;}_0xe956d3[_0x9c06('0x1b')](dbH[_0x9c06('0x13')][_0x9c06('0x14')](util[_0x9c06('0xd')](_0x9c06('0x1c'),QUERY,_0xf397c0,_0x3b468f),{'type':dbH[_0x9c06('0x13')][_0x9c06('0x16')][_0x9c06('0x1d')]}));});if(_0xba51a4>0x0){_0x3b468f+=_0xf397c0;_0xe956d3[_0x9c06('0x1b')](dbH[_0x9c06('0x13')]['query'](util[_0x9c06('0xd')](_0x9c06('0x1c'),QUERY,_0xba51a4,_0x3b468f),{'type':dbH[_0x9c06('0x13')][_0x9c06('0x16')]['SELECT']}));}}}else{_0xe956d3[_0x9c06('0x1b')](dbH['sequelize'][_0x9c06('0x14')](QUERY,{'type':dbH[_0x9c06('0x13')][_0x9c06('0x16')][_0x9c06('0x1d')]}));}var _0x2fa810=path['dirname'](PATH);var _0x2bcb0b=path['basename'](PATH,'.csv');var _0x4f3cd1=_0x100e93['split']&&_0xe956d3['length']>0x1;var _0x328f4b=[];if(!fs[_0x9c06('0x1e')](path['join'](_0x2fa810,_0x2bcb0b))&&_0x4f3cd1){fs['mkdirSync'](path['join'](_0x2fa810,_0x2bcb0b));}return BPromise[_0x9c06('0x1f')](_0xe956d3,function(_0x26a662){_0x328f4b[_0x9c06('0x1b')](_0x26a662);})[_0x9c06('0x20')](function(){for(var _0x442d2c=0x0;_0x442d2c<_0x328f4b[_0x9c06('0x18')];_0x442d2c+=0x1){var _0xf045c7;var _0x4de560=_0x328f4b[_0x442d2c];if(_0x4f3cd1){_0xf045c7=path[_0x9c06('0x21')](_0x2fa810,_0x2bcb0b,util[_0x9c06('0xd')](_0x9c06('0x22'),_0x2bcb0b,_0x442d2c,_0x9c06('0x23')));}else{_0xf045c7=path[_0x9c06('0x21')](_0x2fa810,util['format'](_0x9c06('0x24'),_0x2bcb0b,'csv'));}fs['writeFileSync'](_0xf045c7,csv(_0x4de560));}})[_0x9c06('0x20')](function(){if(_0x4f3cd1){return new Promise(function(_0x572f13){zipdir(path[_0x9c06('0x21')](_0x2fa810,_0x2bcb0b),{'saveTo':path[_0x9c06('0x21')](_0x2fa810,util[_0x9c06('0xd')](_0x9c06('0x24'),_0x2bcb0b,_0x9c06('0x25')))},function(_0x2612c,_0x350e46){rimraf(path[_0x9c06('0x21')](_0x2fa810,_0x2bcb0b),function(){});_0x572f13(_0x9c06('0x26'));});});}})[_0x9c06('0x20')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9c06('0x27')));return analyticExtractedReport(_0x9c06('0x28'),_0x4f3cd1?util[_0x9c06('0xd')](_0x9c06('0x24'),_0x2bcb0b,_0x4f3cd1?_0x9c06('0x25'):_0x9c06('0x23')):null);});})[_0x9c06('0x29')](function(_0x14810f){logger['info'](util['format'](_0x9c06('0x2a'),EXTRACTED_REPORT_ID,_0x9c06('0x27')),util['inspect'](_0x14810f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x9c06('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x87d0=['to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.csv','existsSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x87d0,0x1b7));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var path=require(_0x087d('0x0'));var _=require(_0x087d('0x1'));var csv=require(_0x087d('0x2'));var fs=require('fs');var BPromise=require(_0x087d('0x3'));var zipdir=require(_0x087d('0x4'));var rimraf=require(_0x087d('0x5'));var db=require(_0x087d('0x6'))['db'];var dbH=require('../../mysqldb')[_0x087d('0x7')];var logger=require(_0x087d('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x087d('0x9')][0x2]);var QUERY=process[_0x087d('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xba4e61,_0x179741){var _0x14f982={'status':_0xba4e61};var _0x5e8fc9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x179741){_0x14f982[_0x087d('0xa')]=_0x179741;}return db[_0x087d('0xb')][_0x087d('0xc')](_0x14f982,_0x5e8fc9);}function main(){var _0x188adc=0x1388;var _0x17fd52;logger[_0x087d('0xd')](util[_0x087d('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x087d('0xf')][_0x087d('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x087d('0x11'),_0x087d('0x12')]})[_0x087d('0x13')](function(_0x499fa6){if(_0x499fa6){_0x17fd52=_0x499fa6;_0x188adc=_0x17fd52['splitSizeCsv']||0x1388;}})[_0x087d('0x13')](function(){return dbH[_0x087d('0x14')][_0x087d('0x15')](util[_0x087d('0xe')](_0x087d('0x16'),QUERY),{'type':dbH[_0x087d('0x14')][_0x087d('0x17')][_0x087d('0x18')]});})[_0x087d('0x13')](function(_0x6c1b32){if(!_0x6c1b32[0x0]['num']){return analyticExtractedReport(_0x087d('0x19'));}var _0x650acb=[];var _0x3970f8=0x0;if(_0x17fd52['split']){if(_0x6c1b32&&_0x6c1b32[_0x087d('0x1a')]){var _0x5b0274=_['range'](_0x6c1b32[0x0][_0x087d('0x1b')]/_0x188adc);var _0x4f19ef=Number['isInteger'](_0x6c1b32[0x0][_0x087d('0x1b')]/_0x188adc)?_0x6c1b32[0x0][_0x087d('0x1b')]%_0x188adc:0x0;_0x5b0274[_0x087d('0x1c')](function(_0x4a45f0){if(_0x4a45f0>0x0){_0x3970f8+=_0x188adc;}_0x650acb['push'](dbH[_0x087d('0x14')][_0x087d('0x15')](util['format'](_0x087d('0x1d'),QUERY,_0x188adc,_0x3970f8),{'type':dbH[_0x087d('0x14')][_0x087d('0x17')][_0x087d('0x18')]}));});if(_0x4f19ef>0x0){_0x3970f8+=_0x188adc;_0x650acb[_0x087d('0x1e')](dbH[_0x087d('0x14')][_0x087d('0x15')](util[_0x087d('0xe')](_0x087d('0x1d'),QUERY,_0x4f19ef,_0x3970f8),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x650acb[_0x087d('0x1e')](dbH['sequelize'][_0x087d('0x15')](QUERY,{'type':dbH[_0x087d('0x14')][_0x087d('0x17')]['SELECT']}));}var _0x2e9ccf=path[_0x087d('0x1f')](PATH);var _0x2d7cd4=path['basename'](PATH,_0x087d('0x20'));var _0x3150be=_0x17fd52[_0x087d('0x11')]&&_0x650acb[_0x087d('0x1a')]>0x1;var _0x1d310=[];if(!fs[_0x087d('0x21')](path[_0x087d('0x22')](_0x2e9ccf,_0x2d7cd4))&&_0x3150be){fs['mkdirSync'](path[_0x087d('0x22')](_0x2e9ccf,_0x2d7cd4));}return BPromise['each'](_0x650acb,function(_0x14b130){_0x1d310[_0x087d('0x1e')](_0x14b130);})['then'](function(){for(var _0x25d8cb=0x0;_0x25d8cb<_0x1d310[_0x087d('0x1a')];_0x25d8cb+=0x1){var _0x2adf8c;var _0x4ef6c5=_0x1d310[_0x25d8cb];if(_0x3150be){_0x2adf8c=path[_0x087d('0x22')](_0x2e9ccf,_0x2d7cd4,util[_0x087d('0xe')](_0x087d('0x23'),_0x2d7cd4,_0x25d8cb,_0x087d('0x24')));}else{_0x2adf8c=path['join'](_0x2e9ccf,util[_0x087d('0xe')](_0x087d('0x25'),_0x2d7cd4,_0x087d('0x24')));}fs[_0x087d('0x26')](_0x2adf8c,csv(_0x4ef6c5));}})[_0x087d('0x13')](function(){if(_0x3150be){return new Promise(function(_0xa44c6b){zipdir(path[_0x087d('0x22')](_0x2e9ccf,_0x2d7cd4),{'saveTo':path['join'](_0x2e9ccf,util['format']('%s.%s',_0x2d7cd4,_0x087d('0x27')))},function(_0x2590bf,_0x55b92b){rimraf(path[_0x087d('0x22')](_0x2e9ccf,_0x2d7cd4),function(){});_0xa44c6b(_0x087d('0x28'));});});}})[_0x087d('0x13')](function(){logger[_0x087d('0xd')](util['format'](_0x087d('0x29'),EXTRACTED_REPORT_ID,_0x087d('0x2a')));return analyticExtractedReport(_0x087d('0x2b'),_0x3150be?util[_0x087d('0xe')]('%s.%s',_0x2d7cd4,_0x3150be?_0x087d('0x27'):_0x087d('0x24')):null);});})[_0x087d('0x2c')](function(_0x4b3764){logger[_0x087d('0xd')](util[_0x087d('0xe')](_0x087d('0x2d'),EXTRACTED_REPORT_ID,_0x087d('0x2a')),util[_0x087d('0x2e')](_0x4b3764,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x087d('0x2f'));})['finally'](function(){process[_0x087d('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 1a3a6b2..5d7c5d7 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 _0x974f=['update','map','toString','value','fill','length','auto','body','push','concat','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','margin','landscape','\x20/\x20','footer','Arial','right','Empty','Setting','find','split','splitSizePdf','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','join','each','then','flatten','pdf','%s.%s','all','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','info','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','createPdfFromHTML','createPdfKitDocument','path','catch','lodash','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename'];(function(_0xe7917f,_0x409cfb){var _0x24082e=function(_0x3af4f0){while(--_0x3af4f0){_0xe7917f['push'](_0xe7917f['shift']());}};_0x24082e(++_0x409cfb);}(_0x974f,0x14b));var _0xf974=function(_0x76cb9,_0x432501){_0x76cb9=_0x76cb9-0x0;var _0x12ff08=_0x974f[_0x76cb9];return _0x12ff08;};'use strict';var _=require(_0xf974('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0xf974('0x1'));var htmlToPdfmake=require(_0xf974('0x2'));var PdfPrinter=require(_0xf974('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xf974('0x4'));var JSDOM=require(_0xf974('0x5'))[_0xf974('0x6')];var window=new JSDOM('')[_0xf974('0x7')];var BPromise=require('bluebird');var db=require(_0xf974('0x8'))['db'];var dbH=require(_0xf974('0x8'))['dbH'];var logger=require(_0xf974('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xf974('0xa')][0x2]);var QUERY=process[_0xf974('0xa')][0x3];var PATH=process[_0xf974('0xa')][0x4];var NAME=process[_0xf974('0xa')][0x5];var FORMAT=_0xf974('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1dc51c,_0x2c9232){var _0x38c23c={'status':_0x1dc51c};var _0x59ad3f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c9232){_0x38c23c[_0xf974('0xc')]=_0x2c9232;}return db['AnalyticExtractedReport'][_0xf974('0xd')](_0x38c23c,_0x59ad3f);}function getHeaders(_0x526dbc){return _[_0xf974('0xe')](_0x526dbc,function(_0x372da4){return{'text':_0x372da4,'style':'tableHeader'};});}function getRows(_0x2d50da,_0x2740e9){return _[_0xf974('0xe')](_0x2740e9,function(_0x4bbd51){return _(_0x4bbd51)['pick'](_0x2d50da)[_0xf974('0xe')](function(_0x38b99d){return _0x38b99d?_[_0xf974('0xf')](_0x38b99d):'';})[_0xf974('0x10')]();});}function createTable(_0x4f7bca,_0x269bd3){var _0x571863={'widths':_[_0xf974('0x11')](Array(_0x4f7bca[_0xf974('0x12')]),0x91),'heights':function(_0x238d1a){return _0x238d1a===0x0?_0xf974('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x15db2b=getHeaders(_0x4f7bca);_0x571863[_0xf974('0x14')][_0xf974('0x15')](_0x15db2b);var _0x4846d0=getRows(_0x4f7bca,_0x269bd3);_0x571863[_0xf974('0x14')]=_0x571863[_0xf974('0x14')][_0xf974('0x16')](_0x4846d0);return _0x571863;}function createTables(_0xa992b5){var _0x15d2f7=[];var _0x5da5ad=_['chunk'](Object['keys'](_0xa992b5[0x0]),0x5);_0x5da5ad[_0xf974('0x17')](function(_0x5e954a){_0x15d2f7[_0xf974('0x15')](createTable(_0x5e954a,_0xa992b5));});return _0x15d2f7;}function getPDFDocDefinition(_0xe8efc5){var _0x2dee66=util[_0xf974('0x18')](_0xf974('0x19'),NAME,EXTRACTED_REPORT[_0xf974('0x1a')],moment(EXTRACTED_REPORT[_0xf974('0x1b')])[_0xf974('0x18')](FORMAT),moment(EXTRACTED_REPORT[_0xf974('0x1c')])[_0xf974('0x18')](FORMAT));var _0x2a17a6=[];for(var _0x2dc682=0x0;_0x2dc682<_0xe8efc5[_0xf974('0x12')];_0x2dc682++){var _0x5496c0=[];if(_0x2dc682===0x0){_0x5496c0[_0xf974('0x15')]({'text':_0x2dee66,'style':_0xf974('0x1d')});}var _0x36c7ce={'table':_0xe8efc5[_0x2dc682]};if(_0x2dc682>0x0){_0x36c7ce['pageBreak']='before';_0x36c7ce[_0xf974('0x1e')]=[0x0,0x46,0x0,0x0];}_0x5496c0[_0xf974('0x15')](_0x36c7ce);_0x2a17a6['push'](_0x5496c0);}return{'pageSize':'A4','pageOrientation':_0xf974('0x1f'),'content':_0x2a17a6,'footer':function(_0x34a497,_0x6a0507){return{'text':_0x34a497['toString']()+_0xf974('0x20')+_0x6a0507,'style':_0xf974('0x21')};},'defaultStyle':{'font':_0xf974('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xf974('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x22b525){var _0x5c6e9e=0x1388;var _0x12bc29;if(!_0x22b525[0x0]['num']){return analyticExtractedReport(_0xf974('0x24'));}return db[_0xf974('0x25')][_0xf974('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf974('0x27'),_0xf974('0x28')]})['then'](function(_0x36fd29){if(_0x36fd29){_0x12bc29=_0x36fd29;_0x5c6e9e=_0x12bc29[_0xf974('0x28')]||0x3e8;}})['then'](function(){var _0xc50f5d=[];var _0x45040e=0x0;if(_0x12bc29['split']){if(_0x22b525&&_0x22b525[_0xf974('0x12')]){var _0x328565=_[_0xf974('0x29')](_0x22b525[0x0]['num']/_0x5c6e9e);var _0x451eb3=Number[_0xf974('0x2a')](_0x22b525[0x0]['num']/_0x5c6e9e)?_0x22b525[0x0]['num']%_0x5c6e9e:0x0;_0x328565[_0xf974('0x17')](function(_0x227356){if(_0x227356>0x0){_0x45040e+=_0x5c6e9e;}_0xc50f5d[_0xf974('0x15')](dbH['sequelize'][_0xf974('0x2b')](util[_0xf974('0x18')](_0xf974('0x2c'),QUERY,_0x5c6e9e,_0x45040e),{'type':dbH[_0xf974('0x2d')][_0xf974('0x2e')][_0xf974('0x2f')]}));});if(_0x451eb3>0x0){_0x45040e+=_0x5c6e9e;_0xc50f5d[_0xf974('0x15')](dbH[_0xf974('0x2d')][_0xf974('0x2b')](util[_0xf974('0x18')](_0xf974('0x2c'),QUERY,_0x451eb3,_0x45040e),{'type':dbH[_0xf974('0x2d')][_0xf974('0x2e')][_0xf974('0x2f')]}));}}}else{_0xc50f5d['push'](dbH[_0xf974('0x2d')][_0xf974('0x2b')](QUERY,{'type':dbH[_0xf974('0x2d')]['QueryTypes'][_0xf974('0x2f')]}));}var _0x5818a3=path[_0xf974('0x30')](PATH);var _0x41969b=path[_0xf974('0x31')](PATH,_0xf974('0x32'));var _0x5ca229=_0x12bc29['split']&&_0xc50f5d[_0xf974('0x12')]>0x1;var _0x4f8102=[];if(!fs['existsSync'](path[_0xf974('0x33')](_0x5818a3,_0x41969b))&&_0x5ca229){fs['mkdirSync'](path['join'](_0x5818a3,_0x41969b));}return BPromise[_0xf974('0x34')](_0xc50f5d,function(_0x187143){_0x4f8102[_0xf974('0x15')](_0x187143);})[_0xf974('0x35')](function(){var _0x1b37b8=[];for(var _0x168898=0x0;_0x168898<_0x4f8102[_0xf974('0x12')];_0x168898+=0x1){var _0xbb2698=_0x4f8102[_0x168898];var _0x12b7dd=createTables(_[_0xf974('0x36')](_0xbb2698));var _0x2a7307;var _0x233755=getPDFDocDefinition(_0x12b7dd);var _0xbda458=getPDFPrinter();var _0xf94c6e=_0xbda458['createPdfKitDocument'](_0x233755);if(_0x5ca229){_0x2a7307=path[_0xf974('0x33')](_0x5818a3,_0x41969b,util[_0xf974('0x18')]('%s%d.%s',_0x41969b,_0x168898,_0xf974('0x37')));}else{_0x2a7307=path[_0xf974('0x33')](_0x5818a3,util[_0xf974('0x18')](_0xf974('0x38'),_0x41969b,'pdf'));}_0x1b37b8[_0xf974('0x15')](writePDFDocument(_0xf94c6e,_0x2a7307));}return Promise[_0xf974('0x39')](_0x1b37b8);})[_0xf974('0x35')](function(){if(_0x5ca229){return new Promise(function(_0x18263c){zipdir(path['join'](_0x5818a3,_0x41969b),{'saveTo':path['join'](_0x5818a3,util[_0xf974('0x18')]('%s.%s',_0x41969b,'zip'))},function(){rimraf(path[_0xf974('0x33')](_0x5818a3,_0x41969b),function(){});_0x18263c(_0xf974('0x3a'));});});}})[_0xf974('0x35')](function(){if(!_0x5ca229)return;rimraf(path['join'](_0x5818a3,_0x41969b),function(){});})[_0xf974('0x35')](function(){logger['info'](util[_0xf974('0x18')](_0xf974('0x3b'),EXTRACTED_REPORT_ID,_0xf974('0x3c')));return analyticExtractedReport(_0xf974('0x3d'),_0x5ca229?util[_0xf974('0x18')](_0xf974('0x38'),_0x41969b,_0x5ca229?_0xf974('0x3e'):_0xf974('0x37')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf974('0x3f')](util[_0xf974('0x18')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf974('0x3c')));return db['AnalyticExtractedReport'][_0xf974('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf974('0x35')](function(_0x4075d4){EXTRACTED_REPORT=_0x4075d4;return dbH[_0xf974('0x2d')][_0xf974('0x2b')](util[_0xf974('0x18')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf974('0x2d')][_0xf974('0x2e')][_0xf974('0x2f')]});})[_0xf974('0x35')](extractReport)['catch'](function(_0x30d503){logger[_0xf974('0x3f')](util[_0xf974('0x18')](_0xf974('0x41'),EXTRACTED_REPORT_ID,'PDF'),util[_0xf974('0x42')](_0x30d503,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf974('0x43')](function(){process[_0xf974('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1676c3=new PdfPrinter({'Arial':{'normal':__dirname+_0xf974('0x45'),'bold':__dirname+_0xf974('0x46'),'italics':__dirname+_0xf974('0x47'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x1676c3;}function getPDFDocDefinitionFromHTML(_0x1f5d8f,_0x1bdc58){var _0x282ced=util[_0xf974('0x18')](_0xf974('0x48'),_0x1bdc58[_0xf974('0x49')],_0x1bdc58[_0xf974('0x4a')]);var _0x3f6d69=moment()[_0xf974('0x18')](_0xf974('0x4b'))['toString']();var _0x53e0ba=htmlToPdfmake(_0x1f5d8f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x53e0ba],'defaultStyle':{'font':_0xf974('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf974('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xf974('0x4c')}},'header':function(){return[{'text':_0xf974('0x4d'),'style':'header'}];},'footer':function(_0x563d98,_0x360974){return[{'text':util[_0xf974('0x18')](_0xf974('0x4e'),_0x282ced,_0x563d98,_0x360974,_0x3f6d69),'style':'footer'}];}};}function writePDFDocument(_0x4d056f,_0x20954b){return new Promise(function(_0x2c30d2,_0x3082ff){var _0x5957b4=_0x4d056f['pipe'](fs['createWriteStream'](_0x20954b));_0x5957b4['on'](_0xf974('0x4f'),function(){_0x2c30d2(_0xf974('0x4f'));});_0x5957b4['on'](_0xf974('0x50'),function(_0x16e8b3){_0x3082ff(_0x16e8b3);});_0x4d056f[_0xf974('0x51')]();});}exports[_0xf974('0x52')]=function(_0x13ea13,_0x42b46d){var _0x2304a2=getPDFPrinter();var _0x903ef9=getPDFDocDefinitionFromHTML(_0x13ea13,_0x42b46d);var _0x24baa8=_0x2304a2[_0xf974('0x53')](_0x903ef9);return writePDFDocument(_0x24baa8,_0x42b46d[_0xf974('0x54')])[_0xf974('0x55')](function(_0x1cb55d){throw _0x1cb55d;});}; \ No newline at end of file +var _0x9f62=['interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','html-to-pdfmake','pdfmake/src/printer','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','toString','value','fill','length','auto','body','push','concat','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','header','before','margin','landscape','\x20/\x20','footer','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','sequelize','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','pdf','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','%s.%s','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d'];(function(_0x44038f,_0x28824c){var _0x5531bf=function(_0x319de3){while(--_0x319de3){_0x44038f['push'](_0x44038f['shift']());}};_0x5531bf(++_0x28824c);}(_0x9f62,0xc0));var _0x29f6=function(_0x1f06b5,_0x5e7ea4){_0x1f06b5=_0x1f06b5-0x0;var _0x555196=_0x9f62[_0x1f06b5];return _0x555196;};'use strict';var _=require(_0x29f6('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x29f6('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x29f6('0x2'));var PdfPrinter=require(_0x29f6('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x29f6('0x4')];var window=new JSDOM('')[_0x29f6('0x5')];var BPromise=require(_0x29f6('0x6'));var db=require(_0x29f6('0x7'))['db'];var dbH=require(_0x29f6('0x7'))[_0x29f6('0x8')];var logger=require(_0x29f6('0x9'))(_0x29f6('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x29f6('0xb')][0x4];var NAME=process[_0x29f6('0xb')][0x5];var FORMAT=_0x29f6('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1cbe86,_0x1c4e9b){var _0x2d2dd6={'status':_0x1cbe86};var _0x3e03aa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c4e9b){_0x2d2dd6[_0x29f6('0xd')]=_0x1c4e9b;}return db[_0x29f6('0xe')][_0x29f6('0xf')](_0x2d2dd6,_0x3e03aa);}function getHeaders(_0x1c3e52){return _['map'](_0x1c3e52,function(_0x339e77){return{'text':_0x339e77,'style':'tableHeader'};});}function getRows(_0x38ea5d,_0xd709c1){return _[_0x29f6('0x10')](_0xd709c1,function(_0x5a91c2){return _(_0x5a91c2)['pick'](_0x38ea5d)[_0x29f6('0x10')](function(_0x56d940){return _0x56d940?_[_0x29f6('0x11')](_0x56d940):'';})[_0x29f6('0x12')]();});}function createTable(_0x8a5f50,_0x14420a){var _0x4ad058={'widths':_[_0x29f6('0x13')](Array(_0x8a5f50[_0x29f6('0x14')]),0x91),'heights':function(_0x2d609c){return _0x2d609c===0x0?_0x29f6('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x56063f=getHeaders(_0x8a5f50);_0x4ad058[_0x29f6('0x16')][_0x29f6('0x17')](_0x56063f);var _0x580caa=getRows(_0x8a5f50,_0x14420a);_0x4ad058[_0x29f6('0x16')]=_0x4ad058[_0x29f6('0x16')][_0x29f6('0x18')](_0x580caa);return _0x4ad058;}function createTables(_0x1660e7){var _0x2f8d78=[];var _0x33ff07=_['chunk'](Object[_0x29f6('0x19')](_0x1660e7[0x0]),0x5);_0x33ff07['forEach'](function(_0x38e059){_0x2f8d78['push'](createTable(_0x38e059,_0x1660e7));});return _0x2f8d78;}function getPDFDocDefinition(_0x131199){var _0x4a33b6=util[_0x29f6('0x1a')](_0x29f6('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x29f6('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x29f6('0x1c')])[_0x29f6('0x1a')](FORMAT));var _0x264f66=[];for(var _0x50a3b8=0x0;_0x50a3b8<_0x131199[_0x29f6('0x14')];_0x50a3b8++){var _0x49255d=[];if(_0x50a3b8===0x0){_0x49255d[_0x29f6('0x17')]({'text':_0x4a33b6,'style':_0x29f6('0x1d')});}var _0x1184f3={'table':_0x131199[_0x50a3b8]};if(_0x50a3b8>0x0){_0x1184f3['pageBreak']=_0x29f6('0x1e');_0x1184f3[_0x29f6('0x1f')]=[0x0,0x46,0x0,0x0];}_0x49255d[_0x29f6('0x17')](_0x1184f3);_0x264f66[_0x29f6('0x17')](_0x49255d);}return{'pageSize':'A4','pageOrientation':_0x29f6('0x20'),'content':_0x264f66,'footer':function(_0x3ab6d6,_0x37f044){return{'text':_0x3ab6d6[_0x29f6('0x11')]()+_0x29f6('0x21')+_0x37f044,'style':_0x29f6('0x22')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x29f6('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4d74ee){var _0x853b7f=0x1388;var _0x3083c5;if(!_0x4d74ee[0x0][_0x29f6('0x24')]){return analyticExtractedReport(_0x29f6('0x25'));}return db[_0x29f6('0x26')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x29f6('0x27'),_0x29f6('0x28')]})[_0x29f6('0x29')](function(_0x2b004b){if(_0x2b004b){_0x3083c5=_0x2b004b;_0x853b7f=_0x3083c5[_0x29f6('0x28')]||0x3e8;}})[_0x29f6('0x29')](function(){var _0x3d1060=[];var _0x21f073=0x0;if(_0x3083c5['split']){if(_0x4d74ee&&_0x4d74ee[_0x29f6('0x14')]){var _0x131344=_[_0x29f6('0x2a')](_0x4d74ee[0x0][_0x29f6('0x24')]/_0x853b7f);var _0x14c986=Number[_0x29f6('0x2b')](_0x4d74ee[0x0]['num']/_0x853b7f)?_0x4d74ee[0x0][_0x29f6('0x24')]%_0x853b7f:0x0;_0x131344[_0x29f6('0x2c')](function(_0x1d7f18){if(_0x1d7f18>0x0){_0x21f073+=_0x853b7f;}_0x3d1060[_0x29f6('0x17')](dbH['sequelize'][_0x29f6('0x2d')](util[_0x29f6('0x1a')](_0x29f6('0x2e'),QUERY,_0x853b7f,_0x21f073),{'type':dbH['sequelize']['QueryTypes'][_0x29f6('0x2f')]}));});if(_0x14c986>0x0){_0x21f073+=_0x853b7f;_0x3d1060['push'](dbH[_0x29f6('0x30')][_0x29f6('0x2d')](util[_0x29f6('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14c986,_0x21f073),{'type':dbH[_0x29f6('0x30')][_0x29f6('0x31')][_0x29f6('0x2f')]}));}}}else{_0x3d1060[_0x29f6('0x17')](dbH[_0x29f6('0x30')]['query'](QUERY,{'type':dbH[_0x29f6('0x30')]['QueryTypes'][_0x29f6('0x2f')]}));}var _0x219336=path[_0x29f6('0x32')](PATH);var _0x4fb5f7=path[_0x29f6('0x33')](PATH,_0x29f6('0x34'));var _0x4a3c8c=_0x3083c5['split']&&_0x3d1060[_0x29f6('0x14')]>0x1;var _0x161859=[];if(!fs[_0x29f6('0x35')](path[_0x29f6('0x36')](_0x219336,_0x4fb5f7))&&_0x4a3c8c){fs[_0x29f6('0x37')](path[_0x29f6('0x36')](_0x219336,_0x4fb5f7));}return BPromise[_0x29f6('0x38')](_0x3d1060,function(_0x4f7c89){_0x161859[_0x29f6('0x17')](_0x4f7c89);})[_0x29f6('0x29')](function(){var _0x49d771=[];for(var _0xb3f908=0x0;_0xb3f908<_0x161859['length'];_0xb3f908+=0x1){var _0x4e5059=_0x161859[_0xb3f908];var _0x3eb4fa=createTables(_[_0x29f6('0x39')](_0x4e5059));var _0x3ab8ac;var _0xefecca=getPDFDocDefinition(_0x3eb4fa);var _0x5a3dd1=getPDFPrinter();var _0x5eba10=_0x5a3dd1['createPdfKitDocument'](_0xefecca);if(_0x4a3c8c){_0x3ab8ac=path[_0x29f6('0x36')](_0x219336,_0x4fb5f7,util[_0x29f6('0x1a')]('%s%d.%s',_0x4fb5f7,_0xb3f908,_0x29f6('0x3a')));}else{_0x3ab8ac=path[_0x29f6('0x36')](_0x219336,util['format']('%s.%s',_0x4fb5f7,_0x29f6('0x3a')));}_0x49d771[_0x29f6('0x17')](writePDFDocument(_0x5eba10,_0x3ab8ac));}return Promise[_0x29f6('0x3b')](_0x49d771);})[_0x29f6('0x29')](function(){if(_0x4a3c8c){return new Promise(function(_0x4616cb){zipdir(path[_0x29f6('0x36')](_0x219336,_0x4fb5f7),{'saveTo':path['join'](_0x219336,util[_0x29f6('0x1a')]('%s.%s',_0x4fb5f7,'zip'))},function(){rimraf(path[_0x29f6('0x36')](_0x219336,_0x4fb5f7),function(){});_0x4616cb(_0x29f6('0x3c'));});});}})[_0x29f6('0x29')](function(){if(!_0x4a3c8c)return;rimraf(path[_0x29f6('0x36')](_0x219336,_0x4fb5f7),function(){});})['then'](function(){logger[_0x29f6('0x3d')](util[_0x29f6('0x1a')](_0x29f6('0x3e'),EXTRACTED_REPORT_ID,_0x29f6('0x3f')));return analyticExtractedReport(_0x29f6('0x40'),_0x4a3c8c?util[_0x29f6('0x1a')](_0x29f6('0x41'),_0x4fb5f7,_0x4a3c8c?_0x29f6('0x42'):_0x29f6('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x29f6('0x3d')](util[_0x29f6('0x1a')](_0x29f6('0x43'),EXTRACTED_REPORT_ID,_0x29f6('0x3f')));return db[_0x29f6('0xe')][_0x29f6('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x29f6('0x29')](function(_0x513dff){EXTRACTED_REPORT=_0x513dff;return dbH[_0x29f6('0x30')][_0x29f6('0x2d')](util[_0x29f6('0x1a')](_0x29f6('0x45'),QUERY),{'type':dbH[_0x29f6('0x30')][_0x29f6('0x31')]['SELECT']});})[_0x29f6('0x29')](extractReport)['catch'](function(_0x4bbc66){logger[_0x29f6('0x3d')](util[_0x29f6('0x1a')](_0x29f6('0x46'),EXTRACTED_REPORT_ID,_0x29f6('0x3f')),util[_0x29f6('0x47')](_0x4bbc66,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x29f6('0x48'));})[_0x29f6('0x49')](function(){process[_0x29f6('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x49484f=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x29f6('0x4b'),'italics':__dirname+_0x29f6('0x4c'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x49484f;}function getPDFDocDefinitionFromHTML(_0x4f9a94,_0x12f409){var _0x5a36c1=util[_0x29f6('0x1a')](_0x29f6('0x4d'),_0x12f409['channel'],_0x12f409[_0x29f6('0x4e')]);var _0x57533a=moment()[_0x29f6('0x1a')](_0x29f6('0x4f'))[_0x29f6('0x11')]();var _0x196e5e=htmlToPdfmake(_0x4f9a94,{'window':window,'tableAutoSize':!![]});return{'content':[_0x196e5e],'defaultStyle':{'font':_0x29f6('0x50')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x29f6('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x29f6('0x52'),'style':_0x29f6('0x1d')}];},'footer':function(_0x14f153,_0x391cfc){return[{'text':util[_0x29f6('0x1a')](_0x29f6('0x53'),_0x5a36c1,_0x14f153,_0x391cfc,_0x57533a),'style':_0x29f6('0x22')}];}};}function writePDFDocument(_0x516ae9,_0x1b40da){return new Promise(function(_0x311728,_0x471525){var _0x51fad4=_0x516ae9[_0x29f6('0x54')](fs[_0x29f6('0x55')](_0x1b40da));_0x51fad4['on'](_0x29f6('0x56'),function(){_0x311728(_0x29f6('0x56'));});_0x51fad4['on'](_0x29f6('0x57'),function(_0x53078f){_0x471525(_0x53078f);});_0x516ae9[_0x29f6('0x58')]();});}exports[_0x29f6('0x59')]=function(_0x4eb1f8,_0x5b50b8){var _0x24a388=getPDFPrinter();var _0x3bba10=getPDFDocDefinitionFromHTML(_0x4eb1f8,_0x5b50b8);var _0x35a0b6=_0x24a388['createPdfKitDocument'](_0x3bba10);return writePDFDocument(_0x35a0b6,_0x5b50b8['path'])['catch'](function(_0x3289b4){throw _0x3289b4;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index a0eb4e8..73b3f11 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 _0xbae8=['split','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','mkdirSync','each','join','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','find'];(function(_0x468572,_0x3edd19){var _0x40bf5a=function(_0x3084f5){while(--_0x3084f5){_0x468572['push'](_0x468572['shift']());}};_0x40bf5a(++_0x3edd19);}(_0xbae8,0x195));var _0x8bae=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0xbae8[_0x650e11];return _0x1a9b47;};'use strict';var util=require(_0x8bae('0x0'));var path=require(_0x8bae('0x1'));var _=require(_0x8bae('0x2'));var fs=require('fs');var json2xls=require(_0x8bae('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x8bae('0x4'));var rimraf=require(_0x8bae('0x5'));var db=require(_0x8bae('0x6'))['db'];var dbH=require(_0x8bae('0x6'))[_0x8bae('0x7')];var logger=require(_0x8bae('0x8'))(_0x8bae('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x8bae('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x239142,_0x1770f5){var _0x5eac90={'status':_0x239142};var _0x51ceeb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1770f5){_0x5eac90[_0x8bae('0xb')]=_0x1770f5;}return db[_0x8bae('0xc')][_0x8bae('0xd')](_0x5eac90,_0x51ceeb);}function main(){var _0x466b75=0x1388;var _0x2c2291;logger[_0x8bae('0xe')](util[_0x8bae('0xf')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8bae('0x10')));return db[_0x8bae('0x11')][_0x8bae('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8bae('0x13'),_0x8bae('0x14')]})['then'](function(_0x2433d0){if(_0x2433d0){_0x2c2291=_0x2433d0;_0x466b75=_0x2c2291['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x8bae('0x15')][_0x8bae('0x16')](util[_0x8bae('0xf')](_0x8bae('0x17'),QUERY),{'type':dbH['sequelize'][_0x8bae('0x18')][_0x8bae('0x19')]});})[_0x8bae('0x1a')](function(_0x5113b9){if(!_0x5113b9[0x0][_0x8bae('0x1b')]){return analyticExtractedReport('Empty');}var _0x213a57=[];var _0x460656=0x0;if(_0x2c2291['split']){if(_0x5113b9&&_0x5113b9['length']){var _0x304a6f=_[_0x8bae('0x1c')](_0x5113b9[0x0][_0x8bae('0x1b')]/_0x466b75);var _0xd0b15d=Number[_0x8bae('0x1d')](_0x5113b9[0x0][_0x8bae('0x1b')]/_0x466b75)?_0x5113b9[0x0][_0x8bae('0x1b')]%_0x466b75:0x0;_0x304a6f[_0x8bae('0x1e')](function(_0x3c8a5f){if(_0x3c8a5f>0x0){_0x460656+=_0x466b75;}_0x213a57[_0x8bae('0x1f')](dbH[_0x8bae('0x15')][_0x8bae('0x16')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x466b75,_0x460656),{'type':dbH[_0x8bae('0x15')][_0x8bae('0x18')][_0x8bae('0x19')]}));});if(_0xd0b15d>0x0){_0x460656+=_0x466b75;_0x213a57[_0x8bae('0x1f')](dbH[_0x8bae('0x15')][_0x8bae('0x16')](util[_0x8bae('0xf')](_0x8bae('0x20'),QUERY,_0xd0b15d,_0x460656),{'type':dbH['sequelize']['QueryTypes'][_0x8bae('0x19')]}));}}}else{_0x213a57[_0x8bae('0x1f')](dbH[_0x8bae('0x15')][_0x8bae('0x16')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x8bae('0x19')]}));}var _0x5ca8da=path[_0x8bae('0x21')](PATH);var _0x4ae4bc=path[_0x8bae('0x22')](PATH,_0x8bae('0x23'));var _0x67f74a=_0x2c2291['split']&&_0x213a57[_0x8bae('0x24')]>0x1;var _0x3cde49=[];if(!fs[_0x8bae('0x25')](path['join'](_0x5ca8da,_0x4ae4bc))&&_0x67f74a){fs[_0x8bae('0x26')](path['join'](_0x5ca8da,_0x4ae4bc));}return BPromise[_0x8bae('0x27')](_0x213a57,function(_0x99e4e8){_0x3cde49[_0x8bae('0x1f')](_0x99e4e8);})['then'](function(){for(var _0x885482=0x0;_0x885482<_0x3cde49[_0x8bae('0x24')];_0x885482+=0x1){var _0x1ac7d7;var _0x591647=_0x3cde49[_0x885482];if(_0x67f74a){_0x1ac7d7=path[_0x8bae('0x28')](_0x5ca8da,_0x4ae4bc,util[_0x8bae('0xf')](_0x8bae('0x29'),_0x4ae4bc,_0x885482,_0x8bae('0x2a')));}else{_0x1ac7d7=path['join'](_0x5ca8da,util['format']('%s.%s',_0x4ae4bc,'xlsx'));}fs[_0x8bae('0x2b')](_0x1ac7d7,json2xls(_0x591647),_0x8bae('0x2c'));}})[_0x8bae('0x1a')](function(){if(_0x67f74a){return new Promise(function(_0x464680){zipdir(path[_0x8bae('0x28')](_0x5ca8da,_0x4ae4bc),{'saveTo':path[_0x8bae('0x28')](_0x5ca8da,util['format'](_0x8bae('0x2d'),_0x4ae4bc,_0x8bae('0x2e')))},function(_0x4c4e70,_0x4cc183){rimraf(path['join'](_0x5ca8da,_0x4ae4bc),function(){});_0x464680(_0x8bae('0x2f'));});});}})[_0x8bae('0x1a')](function(){logger[_0x8bae('0xe')](util[_0x8bae('0xf')](_0x8bae('0x30'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x67f74a?util[_0x8bae('0xf')](_0x8bae('0x2d'),_0x4ae4bc,_0x67f74a?_0x8bae('0x2e'):_0x8bae('0x2a')):null);});})[_0x8bae('0x31')](function(_0x51c55a){logger[_0x8bae('0xe')](util[_0x8bae('0xf')](_0x8bae('0x32'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x8bae('0x33')](_0x51c55a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x8bae('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe33c=['inspect','Failed','finally','exit','path','json2xls','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','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','XLSX'];(function(_0x431a2d,_0x53c582){var _0x5ac2ae=function(_0x290ba1){while(--_0x290ba1){_0x431a2d['push'](_0x431a2d['shift']());}};_0x5ac2ae(++_0x53c582);}(_0xe33c,0x1a4));var _0xce33=function(_0x2d440b,_0x4972fa){_0x2d440b=_0x2d440b-0x0;var _0x562a32=_0xe33c[_0x2d440b];return _0x562a32;};'use strict';var util=require('util');var path=require(_0xce33('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xce33('0x1'));var BPromise=require(_0xce33('0x2'));var zipdir=require(_0xce33('0x3'));var rimraf=require(_0xce33('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xce33('0x5'))[_0xce33('0x6')];var logger=require(_0xce33('0x7'))(_0xce33('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xce33('0x9')][0x2]);var QUERY=process[_0xce33('0x9')][0x3];var PATH=process[_0xce33('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x41f42f,_0x21cd17){var _0x18b060={'status':_0x41f42f};var _0x168733={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x21cd17){_0x18b060[_0xce33('0xa')]=_0x21cd17;}return db[_0xce33('0xb')][_0xce33('0xc')](_0x18b060,_0x168733);}function main(){var _0x53f9e2=0x1388;var _0x3fbc1c;logger[_0xce33('0xd')](util[_0xce33('0xe')](_0xce33('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xce33('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xce33('0x11'),_0xce33('0x12')]})[_0xce33('0x13')](function(_0x52db70){if(_0x52db70){_0x3fbc1c=_0x52db70;_0x53f9e2=_0x3fbc1c[_0xce33('0x12')]||0x1388;}})[_0xce33('0x13')](function(){return dbH[_0xce33('0x14')][_0xce33('0x15')](util[_0xce33('0xe')](_0xce33('0x16'),QUERY),{'type':dbH[_0xce33('0x14')][_0xce33('0x17')][_0xce33('0x18')]});})['then'](function(_0x18b206){if(!_0x18b206[0x0][_0xce33('0x19')]){return analyticExtractedReport('Empty');}var _0x15c180=[];var _0x35659b=0x0;if(_0x3fbc1c[_0xce33('0x11')]){if(_0x18b206&&_0x18b206[_0xce33('0x1a')]){var _0x3c7cde=_[_0xce33('0x1b')](_0x18b206[0x0][_0xce33('0x19')]/_0x53f9e2);var _0x50bfff=Number[_0xce33('0x1c')](_0x18b206[0x0][_0xce33('0x19')]/_0x53f9e2)?_0x18b206[0x0]['num']%_0x53f9e2:0x0;_0x3c7cde[_0xce33('0x1d')](function(_0x498991){if(_0x498991>0x0){_0x35659b+=_0x53f9e2;}_0x15c180['push'](dbH[_0xce33('0x14')][_0xce33('0x15')](util[_0xce33('0xe')](_0xce33('0x1e'),QUERY,_0x53f9e2,_0x35659b),{'type':dbH[_0xce33('0x14')][_0xce33('0x17')][_0xce33('0x18')]}));});if(_0x50bfff>0x0){_0x35659b+=_0x53f9e2;_0x15c180[_0xce33('0x1f')](dbH[_0xce33('0x14')]['query'](util[_0xce33('0xe')](_0xce33('0x1e'),QUERY,_0x50bfff,_0x35659b),{'type':dbH[_0xce33('0x14')][_0xce33('0x17')][_0xce33('0x18')]}));}}}else{_0x15c180['push'](dbH['sequelize'][_0xce33('0x15')](QUERY,{'type':dbH[_0xce33('0x14')][_0xce33('0x17')][_0xce33('0x18')]}));}var _0x7c7c2a=path[_0xce33('0x20')](PATH);var _0x2f914c=path[_0xce33('0x21')](PATH,'.xlsx');var _0x544c9c=_0x3fbc1c['split']&&_0x15c180[_0xce33('0x1a')]>0x1;var _0x3e2d83=[];if(!fs['existsSync'](path[_0xce33('0x22')](_0x7c7c2a,_0x2f914c))&&_0x544c9c){fs[_0xce33('0x23')](path['join'](_0x7c7c2a,_0x2f914c));}return BPromise[_0xce33('0x24')](_0x15c180,function(_0x50a87b){_0x3e2d83[_0xce33('0x1f')](_0x50a87b);})[_0xce33('0x13')](function(){for(var _0x4e2f9b=0x0;_0x4e2f9b<_0x3e2d83[_0xce33('0x1a')];_0x4e2f9b+=0x1){var _0x150de3;var _0x3b4b8d=_0x3e2d83[_0x4e2f9b];if(_0x544c9c){_0x150de3=path[_0xce33('0x22')](_0x7c7c2a,_0x2f914c,util[_0xce33('0xe')](_0xce33('0x25'),_0x2f914c,_0x4e2f9b,_0xce33('0x26')));}else{_0x150de3=path[_0xce33('0x22')](_0x7c7c2a,util['format'](_0xce33('0x27'),_0x2f914c,_0xce33('0x26')));}fs[_0xce33('0x28')](_0x150de3,json2xls(_0x3b4b8d),_0xce33('0x29'));}})[_0xce33('0x13')](function(){if(_0x544c9c){return new Promise(function(_0x1ffca8){zipdir(path['join'](_0x7c7c2a,_0x2f914c),{'saveTo':path['join'](_0x7c7c2a,util[_0xce33('0xe')]('%s.%s',_0x2f914c,_0xce33('0x2a')))},function(_0x3b8c0b,_0xeb56f1){rimraf(path[_0xce33('0x22')](_0x7c7c2a,_0x2f914c),function(){});_0x1ffca8(_0xce33('0x2b'));});});}})['then'](function(){logger['info'](util[_0xce33('0xe')](_0xce33('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xce33('0x2d'),_0x544c9c?util[_0xce33('0xe')](_0xce33('0x27'),_0x2f914c,_0x544c9c?_0xce33('0x2a'):_0xce33('0x26')):null);});})[_0xce33('0x2e')](function(_0x3c732d){logger[_0xce33('0xd')](util[_0xce33('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xce33('0x2f')),util[_0xce33('0x30')](_0x3c732d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xce33('0x31'));})[_0xce33('0x32')](function(){process[_0xce33('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 841c199..3ee2c42 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 _0xa70f=['*,*,*,*','interval','IntervalId','intervals','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','error','lodash','util','findAll','then','models','VoiceExtension','uniq','map','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','push','type','Set','format','context','inbound','outbound','extension','cutdigits','${EXTEN:','VoiceExtensionId','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','toLowerCase','createdAt','updatedAt'];(function(_0x199f25,_0x422ce5){var _0x4b3873=function(_0xfb8895){while(--_0xfb8895){_0x199f25['push'](_0x199f25['shift']());}};_0x4b3873(++_0x422ce5);}(_0xa70f,0x95));var _0xfa70=function(_0x336321,_0x89c296){_0x336321=_0x336321-0x0;var _0x1e7245=_0xa70f[_0x336321];return _0x1e7245;};'use strict';var _=require(_0xfa70('0x0'));var util=require(_0xfa70('0x1'));function rewrite(_0x1e6683,_0x255a6f){var _0x1ba9af=this;return _0x1e6683['models']['Interval'][_0xfa70('0x2')]({'raw':!![]})[_0xfa70('0x3')](function(_0x3b82eb){_0x1ba9af['intervals']=_0x3b82eb;return _0x1e6683[_0xfa70('0x4')]['VoiceExtension'][_0xfa70('0x2')]({'where':{'IntervalId':_0x255a6f['IntervalId']},'raw':!![]});})[_0xfa70('0x3')](function(_0x133afa){return _0x1e6683[_0xfa70('0x4')][_0xfa70('0x5')][_0xfa70('0x2')]({'where':{'exten':{'$in':_[_0xfa70('0x6')](_[_0xfa70('0x7')](_0x133afa,_0xfa70('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xfa70('0x3')](function(_0x3b8f40){var _0x971a27=_[_0xfa70('0x9')](_0x3b8f40,{'priority':'1'});var _0x513527=_['filter'](_0x3b8f40,{'isApp':0x1});var _0x3cb476=_[_0xfa70('0xa')](_0x513527,_0xfa70('0x8'));var _0x258275=[_0xfa70('0xb'),_0xfa70('0xc')];var _0x52b7d6=[];var _0x1563c0=[];for(var _0x3cefe4 in _0x3cb476){if(_0x3cb476[_0xfa70('0xd')](_0x3cefe4)){_0x1ba9af[_0xfa70('0xe')]=0x2;_0x1ba9af['extensions']=[];_0x1ba9af['extension']=_['find'](_0x971a27,{'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')]});_0x1ba9af[_0xfa70('0xf')][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')],'app':_0xfa70('0x12'),'appdata':util[_0xfa70('0x13')]('CDR(type)=%s',_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')]),'context':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x14')],'exten':_0x3cb476[_0x3cefe4][0x0]['exten'],'priority':_0x1ba9af[_0xfa70('0xe')]++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0]['VoiceExtensionId']});if(_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')]===_0xfa70('0x15')){_0x1ba9af['extensions'][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0]['type'],'app':_0xfa70('0x12'),'appdata':'CDR(routeid)='+_0x3cb476[_0x3cefe4][0x0]['VoiceExtensionId'],'context':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x14')],'exten':_0x3cb476[_0x3cefe4][0x0]['exten'],'priority':_0x1ba9af['priority']++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0]['VoiceExtensionId']});}else if(_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')]===_0xfa70('0x16')){if(_0x1ba9af['extension']){_0x1ba9af[_0xfa70('0xf')][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')],'app':'Set','appdata':'CDR(destination)='+(_0x1ba9af[_0xfa70('0x17')][_0xfa70('0x18')]?_0xfa70('0x19')+_0x1ba9af[_0xfa70('0x17')][_0xfa70('0x18')]+'}':'${EXTEN}'),'context':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x14')],'exten':_0x3cb476[_0x3cefe4][0x0]['exten'],'priority':_0x1ba9af[_0xfa70('0xe')]++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x1a')]});}_0x1ba9af[_0xfa70('0xf')][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')],'app':_0xfa70('0x12'),'appdata':_0xfa70('0x1b')+_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x1a')],'context':_0x3cb476[_0x3cefe4][0x0]['context'],'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')],'priority':_0x1ba9af[_0xfa70('0xe')]++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x1a')]});var _0x3ab228=_0x1ba9af[_0xfa70('0xe')]++;_0x1ba9af[_0xfa70('0xf')][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')],'app':_0xfa70('0x1c'),'appdata':_0xfa70('0x1d')+(_0x3ab228+0x2)+_0xfa70('0x1e')+(_0x3ab228+0x1)+')','context':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x14')],'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')],'priority':_0x3ab228,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0]['VoiceExtensionId']});if(_0x1ba9af[_0xfa70('0x17')]){_0x1ba9af[_0xfa70('0xf')][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')],'app':'Set','appdata':_0x1ba9af[_0xfa70('0x17')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x1ba9af['extension'][_0xfa70('0x18')]+'}':'CDR(prefix)=noprefix','context':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x14')],'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')],'priority':_0x1ba9af[_0xfa70('0xe')]++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0]['VoiceExtensionId']});}_0x1ba9af[_0xfa70('0xf')][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')],'app':'Set','appdata':_0xfa70('0x1f')+_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x1a')],'context':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x14')],'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')],'priority':_0x1ba9af[_0xfa70('0xe')]++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x1a')]});if(_0x1ba9af[_0xfa70('0x17')]&&_0x1ba9af['extension'][_0xfa70('0xd')](_0xfa70('0x20'))&&_0x1ba9af[_0xfa70('0x17')][_0xfa70('0x20')]!==_0xfa70('0x21')){_0x1ba9af[_0xfa70('0xf')][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')],'app':_0xfa70('0x12'),'appdata':_0xfa70('0x22'),'context':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x14')],'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')],'priority':_0x1ba9af['priority']++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x1a')]});_0x1ba9af[_0xfa70('0xf')][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')],'app':_0xfa70('0x12'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1ba9af[_0xfa70('0x17')][_0xfa70('0x20')]||_0xfa70('0x23'),'context':_0x3cb476[_0x3cefe4][0x0]['context'],'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')],'priority':_0x1ba9af[_0xfa70('0xe')]++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x1a')]});}}_0x1ba9af['extensions'][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')],'app':'Set','appdata':_0xfa70('0x24'),'context':_0x3cb476[_0x3cefe4][0x0]['context'],'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')],'priority':_0x1ba9af['priority']++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x1a')]});_0x1ba9af[_0xfa70('0xf')][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x14')],'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')],'priority':_0x1ba9af['priority']++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0]['VoiceExtensionId']});_0x1ba9af[_0xfa70('0xf')]['push']({'type':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x11')],'app':_0xfa70('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x14')],'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')],'priority':_0x1ba9af['priority']++,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x1a')]});for(var _0x42b9c9=0x0,_0x2f5720=0x0;_0x42b9c9<_0x3cb476[_0x3cefe4]['length'];_0x42b9c9+=0x1,_0x2f5720=0x0){var _0xe32a31=_0x3cb476[_0x3cefe4][_0x42b9c9];if(_0xe32a31[_0xfa70('0x11')]){_0xe32a31[_0xfa70('0x11')]=_0xe32a31['type'][_0xfa70('0x25')]();}var _0xf7fe56=[];var _0x49e5bc=[];delete _0xe32a31['id'];delete _0xe32a31[_0xfa70('0x26')];delete _0xe32a31[_0xfa70('0x27')];var _0x22ddc2=_0xe32a31['interval']!==_0xfa70('0x28')?[_0xe32a31[_0xfa70('0x29')]]:_0xe32a31[_0xfa70('0x2a')]?_[_0xfa70('0x7')](_['filter'](_0x1ba9af[_0xfa70('0x2b')],{'IntervalId':_0xe32a31[_0xfa70('0x2a')]}),_0xfa70('0x29')):[];if(_0xe32a31[_0xfa70('0xd')](_0xfa70('0x2c'))){if(_0xe32a31[_0xfa70('0x2c')]&&_0xe32a31[_0xfa70('0x2c')]!=='--'){_0xf7fe56[_0xfa70('0x10')]({'type':_0xe32a31[_0xfa70('0x11')],'app':_0xfa70('0x12'),'appdata':_0xfa70('0x2d')+_0xe32a31[_0xfa70('0x2c')],'context':_0xe32a31[_0xfa70('0x14')],'exten':_0xe32a31[_0xfa70('0x8')],'priority':_0x22ddc2[_0xfa70('0x2e')]+_0x1ba9af[_0xfa70('0xe')]+_0x2f5720++,'VoiceExtensionId':_0xe32a31[_0xfa70('0x1a')]});}}if(_0xe32a31['type']===_0xfa70('0x16')&&_0xe32a31[_0xfa70('0xd')](_0xfa70('0x2f'))){if(_0xe32a31[_0xfa70('0x2f')]){_0xf7fe56['push']({'type':_0xe32a31['type'],'app':_0xfa70('0x1c'),'appdata':_0xfa70('0x30')+_0xe32a31[_0xfa70('0x2f')]+')','context':_0xe32a31['context'],'exten':_0xe32a31[_0xfa70('0x8')],'priority':_0x22ddc2['length']+_0x1ba9af[_0xfa70('0xe')]+_0x2f5720++,'VoiceExtensionId':_0xe32a31[_0xfa70('0x1a')]});}else{_0xf7fe56[_0xfa70('0x10')]({'type':_0xe32a31['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xe32a31['context'],'exten':_0xe32a31[_0xfa70('0x8')],'priority':_0x22ddc2[_0xfa70('0x2e')]+_0x1ba9af[_0xfa70('0xe')]+_0x2f5720++,'VoiceExtensionId':_0xe32a31['VoiceExtensionId']});}}if(_0xe32a31[_0xfa70('0xd')](_0xfa70('0x31'))){if(_0x258275['indexOf'](_0xe32a31[_0xfa70('0x32')]['toLowerCase']())>=0x0&&_0xe32a31[_0xfa70('0x33')]!==_0xfa70('0x34')){if(_0xe32a31[_0xfa70('0x31')]){_0xf7fe56['push']({'type':_0xe32a31[_0xfa70('0x11')],'app':'ExecIf','appdata':_0xfa70('0x35'),'context':_0xe32a31[_0xfa70('0x14')],'exten':_0xe32a31['exten'],'priority':_0x22ddc2[_0xfa70('0x2e')]+_0x1ba9af['priority']+_0x2f5720++,'VoiceExtensionId':_0xe32a31[_0xfa70('0x1a')]});_0xf7fe56['push']({'type':_0xe32a31[_0xfa70('0x11')],'app':_0xfa70('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xe32a31[_0xfa70('0x14')],'exten':_0xe32a31['exten'],'priority':_0x22ddc2[_0xfa70('0x2e')]+_0x1ba9af[_0xfa70('0xe')]+_0x2f5720++,'VoiceExtensionId':_0xe32a31[_0xfa70('0x1a')]});}else{_0xf7fe56[_0xfa70('0x10')]({'type':_0xe32a31[_0xfa70('0x11')],'app':_0xfa70('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xe32a31[_0xfa70('0x14')],'exten':_0xe32a31[_0xfa70('0x8')],'priority':_0x22ddc2[_0xfa70('0x2e')]+_0x1ba9af[_0xfa70('0xe')]+_0x2f5720++,'VoiceExtensionId':_0xe32a31[_0xfa70('0x1a')]});_0xf7fe56['push']({'type':_0xe32a31[_0xfa70('0x11')],'app':_0xfa70('0x12'),'appdata':_0xfa70('0x36'),'context':_0xe32a31[_0xfa70('0x14')],'exten':_0xe32a31[_0xfa70('0x8')],'priority':_0x22ddc2[_0xfa70('0x2e')]+_0x1ba9af[_0xfa70('0xe')]+_0x2f5720++,'VoiceExtensionId':_0xe32a31[_0xfa70('0x1a')]});}}}for(var _0x5d9368=0x0;_0x5d9368<_0x22ddc2['length'];_0x5d9368+=0x1){var _0x58d5b4=_0x1ba9af[_0xfa70('0xe')]+_0x22ddc2[_0xfa70('0x2e')];var _0x229db3=_0x5d9368===_0x22ddc2['length']-0x1?_0x1ba9af['priority']+_0xf7fe56['length']+_0x49e5bc[_0xfa70('0x2e')]+0x2:_0x1ba9af[_0xfa70('0xe')]+_0x5d9368+0x1;_0xf7fe56[_0xfa70('0x37')](_0x5d9368,0x0,{'type':_0xe32a31[_0xfa70('0x11')],'app':'GotoIfTime','appdata':_0x22ddc2[_0x5d9368]+'?'+_0xe32a31[_0xfa70('0x14')]+_0xfa70('0x38')+_0x58d5b4+':'+_0xe32a31[_0xfa70('0x14')]+_0xfa70('0x38')+_0x229db3,'exten':_0xe32a31[_0xfa70('0x8')],'context':_0xe32a31[_0xfa70('0x14')],'priority':_0x1ba9af[_0xfa70('0xe')]+_0x5d9368,'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0]['VoiceExtensionId']});}_0xe32a31['priority']=_0xf7fe56[_0xfa70('0x2e')]?_['last'](_0xf7fe56)[_0xfa70('0xe')]+0x1:_0x1ba9af[_0xfa70('0xe')];_0x1ba9af['priority']=(_0x49e5bc[_0xfa70('0x2e')]?_[_0xfa70('0x39')](_0x49e5bc)[_0xfa70('0xe')]:_0xe32a31['priority'])+0x1;_0x1ba9af[_0xfa70('0xf')]=_[_0xfa70('0x3a')](_0x1ba9af[_0xfa70('0xf')],_0xf7fe56,[_0xe32a31],_0x49e5bc);}_0x1ba9af[_0xfa70('0xf')][_0xfa70('0x10')]({'type':_0x3cb476[_0x3cefe4][0x0]['type'],'app':_0xfa70('0x3b'),'exten':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x8')],'context':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x14')],'priority':_0x1ba9af[_0xfa70('0xe')],'VoiceExtensionId':_0x3cb476[_0x3cefe4][0x0][_0xfa70('0x1a')]});_0x52b7d6[_0xfa70('0x10')](_0x3cb476[_0x3cefe4][0x0]['VoiceExtensionId']);_0x1563c0=_[_0xfa70('0x3a')](_0x1563c0,_0x1ba9af[_0xfa70('0xf')]);}}return _0x1e6683['transaction'](function(_0x4514f8){return _0x1e6683[_0xfa70('0x4')][_0xfa70('0x5')][_0xfa70('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x52b7d6}},'transaction':_0x4514f8})['then'](function(_0x486ec4){return _0x1e6683[_0xfa70('0x4')][_0xfa70('0x5')][_0xfa70('0x3d')](_['sortBy'](_0x1563c0,_0xfa70('0xe')),{'transaction':_0x4514f8});});});})['catch'](function(_0x3b7532){console[_0xfa70('0x3e')](_0x3b7532);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xb0b9=['custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','outbound','CDR(destination)=','cutdigits','${EXTEN:','VoiceExtensionId','CDR(routeid)=','context','ExecIf','):Goto(','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xb0b9,0x1f0));var _0x9b0b=function(_0x44a601,_0xb65d5f){_0x44a601=_0x44a601-0x0;var _0xfe6e4b=_0xb0b9[_0x44a601];return _0xfe6e4b;};'use strict';var _=require(_0x9b0b('0x0'));var util=require(_0x9b0b('0x1'));function rewrite(_0x239e9d,_0x2ae912){var _0x590168=this;return _0x239e9d[_0x9b0b('0x2')][_0x9b0b('0x3')][_0x9b0b('0x4')]({'raw':!![]})[_0x9b0b('0x5')](function(_0x369241){_0x590168[_0x9b0b('0x6')]=_0x369241;return _0x239e9d[_0x9b0b('0x2')][_0x9b0b('0x7')][_0x9b0b('0x4')]({'where':{'IntervalId':_0x2ae912[_0x9b0b('0x8')]},'raw':!![]});})[_0x9b0b('0x5')](function(_0x2c18c4){return _0x239e9d['models']['VoiceExtension'][_0x9b0b('0x4')]({'where':{'exten':{'$in':_[_0x9b0b('0x9')](_[_0x9b0b('0xa')](_0x2c18c4,_0x9b0b('0xb')))}},'order':[{'raw':_0x9b0b('0xc')}],'raw':!![]});})[_0x9b0b('0x5')](function(_0x2f8e6e){var _0x360309=_[_0x9b0b('0xd')](_0x2f8e6e,{'priority':'1'});var _0x9d8ee1=_[_0x9b0b('0xd')](_0x2f8e6e,{'isApp':0x1});var _0x10232c=_[_0x9b0b('0xe')](_0x9d8ee1,_0x9b0b('0xb'));var _0xae6a0c=[_0x9b0b('0xf'),_0x9b0b('0x10')];var _0x176438=[];var _0x564dd6=[];for(var _0x4d6338 in _0x10232c){if(_0x10232c[_0x9b0b('0x11')](_0x4d6338)){_0x590168[_0x9b0b('0x12')]=0x2;_0x590168[_0x9b0b('0x13')]=[];_0x590168[_0x9b0b('0x14')]=_[_0x9b0b('0x15')](_0x360309,{'exten':_0x10232c[_0x4d6338][0x0]['exten']});_0x590168[_0x9b0b('0x13')][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')],'app':_0x9b0b('0x18'),'appdata':util[_0x9b0b('0x19')](_0x9b0b('0x1a'),_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')]),'context':_0x10232c[_0x4d6338][0x0]['context'],'exten':_0x10232c[_0x4d6338][0x0][_0x9b0b('0xb')],'priority':_0x590168[_0x9b0b('0x12')]++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0]['VoiceExtensionId']});if(_0x10232c[_0x4d6338][0x0]['type']==='inbound'){_0x590168[_0x9b0b('0x13')][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')],'app':_0x9b0b('0x18'),'appdata':'CDR(routeid)='+_0x10232c[_0x4d6338][0x0]['VoiceExtensionId'],'context':_0x10232c[_0x4d6338][0x0]['context'],'exten':_0x10232c[_0x4d6338][0x0][_0x9b0b('0xb')],'priority':_0x590168[_0x9b0b('0x12')]++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0]['VoiceExtensionId']});}else if(_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')]===_0x9b0b('0x1b')){if(_0x590168[_0x9b0b('0x14')]){_0x590168['extensions'][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0]['type'],'app':'Set','appdata':_0x9b0b('0x1c')+(_0x590168[_0x9b0b('0x14')][_0x9b0b('0x1d')]?_0x9b0b('0x1e')+_0x590168[_0x9b0b('0x14')][_0x9b0b('0x1d')]+'}':'${EXTEN}'),'context':_0x10232c[_0x4d6338][0x0]['context'],'exten':_0x10232c[_0x4d6338][0x0][_0x9b0b('0xb')],'priority':_0x590168['priority']++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')]});}_0x590168[_0x9b0b('0x13')]['push']({'type':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')],'app':'Set','appdata':_0x9b0b('0x20')+_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')],'context':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x21')],'exten':_0x10232c[_0x4d6338][0x0][_0x9b0b('0xb')],'priority':_0x590168[_0x9b0b('0x12')]++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')]});var _0x82dacd=_0x590168[_0x9b0b('0x12')]++;_0x590168[_0x9b0b('0x13')][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')],'app':_0x9b0b('0x22'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x82dacd+0x2)+_0x9b0b('0x23')+(_0x82dacd+0x1)+')','context':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x21')],'exten':_0x10232c[_0x4d6338][0x0][_0x9b0b('0xb')],'priority':_0x82dacd,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0]['VoiceExtensionId']});if(_0x590168[_0x9b0b('0x14')]){_0x590168[_0x9b0b('0x13')][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')],'app':_0x9b0b('0x18'),'appdata':_0x590168[_0x9b0b('0x14')][_0x9b0b('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x590168[_0x9b0b('0x14')][_0x9b0b('0x1d')]+'}':_0x9b0b('0x24'),'context':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x21')],'exten':_0x10232c[_0x4d6338][0x0][_0x9b0b('0xb')],'priority':_0x590168['priority']++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')]});}_0x590168[_0x9b0b('0x13')][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')],'app':_0x9b0b('0x18'),'appdata':'outboundrouteid='+_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')],'context':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x21')],'exten':_0x10232c[_0x4d6338][0x0]['exten'],'priority':_0x590168[_0x9b0b('0x12')]++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')]});if(_0x590168[_0x9b0b('0x14')]&&_0x590168[_0x9b0b('0x14')][_0x9b0b('0x11')]('recordingFormat')&&_0x590168[_0x9b0b('0x14')][_0x9b0b('0x25')]!==_0x9b0b('0x26')){_0x590168[_0x9b0b('0x13')]['push']({'type':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')],'app':_0x9b0b('0x18'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x21')],'exten':_0x10232c[_0x4d6338][0x0]['exten'],'priority':_0x590168[_0x9b0b('0x12')]++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')]});_0x590168[_0x9b0b('0x13')][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0]['type'],'app':_0x9b0b('0x18'),'appdata':_0x9b0b('0x27')+_0x590168['extension'][_0x9b0b('0x25')]||_0x9b0b('0x28'),'context':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x21')],'exten':_0x10232c[_0x4d6338][0x0]['exten'],'priority':_0x590168[_0x9b0b('0x12')]++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')]});}}_0x590168[_0x9b0b('0x13')][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0]['type'],'app':_0x9b0b('0x18'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x21')],'exten':_0x10232c[_0x4d6338][0x0][_0x9b0b('0xb')],'priority':_0x590168[_0x9b0b('0x12')]++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')]});_0x590168['extensions'][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')],'app':_0x9b0b('0x18'),'appdata':_0x9b0b('0x29'),'context':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x21')],'exten':_0x10232c[_0x4d6338][0x0][_0x9b0b('0xb')],'priority':_0x590168[_0x9b0b('0x12')]++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0]['VoiceExtensionId']});_0x590168[_0x9b0b('0x13')][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0]['type'],'app':_0x9b0b('0x18'),'appdata':_0x9b0b('0x2a'),'context':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x21')],'exten':_0x10232c[_0x4d6338][0x0][_0x9b0b('0xb')],'priority':_0x590168[_0x9b0b('0x12')]++,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')]});for(var _0x1479c9=0x0,_0x54a358=0x0;_0x1479c9<_0x10232c[_0x4d6338][_0x9b0b('0x2b')];_0x1479c9+=0x1,_0x54a358=0x0){var _0x301d25=_0x10232c[_0x4d6338][_0x1479c9];if(_0x301d25['type']){_0x301d25[_0x9b0b('0x17')]=_0x301d25['type'][_0x9b0b('0x2c')]();}var _0x2e4a5f=[];var _0x14ba8c=[];delete _0x301d25['id'];delete _0x301d25['createdAt'];delete _0x301d25[_0x9b0b('0x2d')];var _0x49255b=_0x301d25[_0x9b0b('0x2e')]!==_0x9b0b('0x2f')?[_0x301d25['interval']]:_0x301d25[_0x9b0b('0x8')]?_['map'](_[_0x9b0b('0xd')](_0x590168[_0x9b0b('0x6')],{'IntervalId':_0x301d25[_0x9b0b('0x8')]}),'interval'):[];if(_0x301d25['hasOwnProperty'](_0x9b0b('0x30'))){if(_0x301d25[_0x9b0b('0x30')]&&_0x301d25[_0x9b0b('0x30')]!=='--'){_0x2e4a5f[_0x9b0b('0x16')]({'type':_0x301d25['type'],'app':'Set','appdata':_0x9b0b('0x31')+_0x301d25[_0x9b0b('0x30')],'context':_0x301d25[_0x9b0b('0x21')],'exten':_0x301d25[_0x9b0b('0xb')],'priority':_0x49255b[_0x9b0b('0x2b')]+_0x590168[_0x9b0b('0x12')]+_0x54a358++,'VoiceExtensionId':_0x301d25['VoiceExtensionId']});}}if(_0x301d25['type']===_0x9b0b('0x1b')&&_0x301d25[_0x9b0b('0x11')](_0x9b0b('0x32'))){if(_0x301d25[_0x9b0b('0x32')]){_0x2e4a5f[_0x9b0b('0x16')]({'type':_0x301d25[_0x9b0b('0x17')],'app':'ExecIf','appdata':_0x9b0b('0x33')+_0x301d25[_0x9b0b('0x32')]+')','context':_0x301d25[_0x9b0b('0x21')],'exten':_0x301d25['exten'],'priority':_0x49255b[_0x9b0b('0x2b')]+_0x590168[_0x9b0b('0x12')]+_0x54a358++,'VoiceExtensionId':_0x301d25['VoiceExtensionId']});}else{_0x2e4a5f[_0x9b0b('0x16')]({'type':_0x301d25[_0x9b0b('0x17')],'app':_0x9b0b('0x22'),'appdata':_0x9b0b('0x34'),'context':_0x301d25[_0x9b0b('0x21')],'exten':_0x301d25[_0x9b0b('0xb')],'priority':_0x49255b[_0x9b0b('0x2b')]+_0x590168[_0x9b0b('0x12')]+_0x54a358++,'VoiceExtensionId':_0x301d25[_0x9b0b('0x1f')]});}}if(_0x301d25[_0x9b0b('0x11')]('answer')){if(_0xae6a0c[_0x9b0b('0x35')](_0x301d25[_0x9b0b('0x36')][_0x9b0b('0x2c')]())>=0x0&&_0x301d25[_0x9b0b('0x37')]!==_0x9b0b('0x38')){if(_0x301d25['answer']){_0x2e4a5f['push']({'type':_0x301d25[_0x9b0b('0x17')],'app':'ExecIf','appdata':_0x9b0b('0x39'),'context':_0x301d25[_0x9b0b('0x21')],'exten':_0x301d25[_0x9b0b('0xb')],'priority':_0x49255b['length']+_0x590168[_0x9b0b('0x12')]+_0x54a358++,'VoiceExtensionId':_0x301d25['VoiceExtensionId']});_0x2e4a5f['push']({'type':_0x301d25[_0x9b0b('0x17')],'app':'Set','appdata':_0x9b0b('0x3a'),'context':_0x301d25[_0x9b0b('0x21')],'exten':_0x301d25['exten'],'priority':_0x49255b[_0x9b0b('0x2b')]+_0x590168[_0x9b0b('0x12')]+_0x54a358++,'VoiceExtensionId':_0x301d25[_0x9b0b('0x1f')]});}else{_0x2e4a5f[_0x9b0b('0x16')]({'type':_0x301d25[_0x9b0b('0x17')],'app':_0x9b0b('0x22'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x301d25['context'],'exten':_0x301d25[_0x9b0b('0xb')],'priority':_0x49255b[_0x9b0b('0x2b')]+_0x590168[_0x9b0b('0x12')]+_0x54a358++,'VoiceExtensionId':_0x301d25[_0x9b0b('0x1f')]});_0x2e4a5f[_0x9b0b('0x16')]({'type':_0x301d25[_0x9b0b('0x17')],'app':_0x9b0b('0x18'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x301d25[_0x9b0b('0x21')],'exten':_0x301d25['exten'],'priority':_0x49255b[_0x9b0b('0x2b')]+_0x590168[_0x9b0b('0x12')]+_0x54a358++,'VoiceExtensionId':_0x301d25[_0x9b0b('0x1f')]});}}}for(var _0x2e98b7=0x0;_0x2e98b7<_0x49255b[_0x9b0b('0x2b')];_0x2e98b7+=0x1){var _0x3cc0bf=_0x590168[_0x9b0b('0x12')]+_0x49255b['length'];var _0x364b66=_0x2e98b7===_0x49255b[_0x9b0b('0x2b')]-0x1?_0x590168[_0x9b0b('0x12')]+_0x2e4a5f[_0x9b0b('0x2b')]+_0x14ba8c[_0x9b0b('0x2b')]+0x2:_0x590168[_0x9b0b('0x12')]+_0x2e98b7+0x1;_0x2e4a5f[_0x9b0b('0x3b')](_0x2e98b7,0x0,{'type':_0x301d25['type'],'app':_0x9b0b('0x3c'),'appdata':_0x49255b[_0x2e98b7]+'?'+_0x301d25[_0x9b0b('0x21')]+_0x9b0b('0x3d')+_0x3cc0bf+':'+_0x301d25[_0x9b0b('0x21')]+_0x9b0b('0x3d')+_0x364b66,'exten':_0x301d25[_0x9b0b('0xb')],'context':_0x301d25[_0x9b0b('0x21')],'priority':_0x590168[_0x9b0b('0x12')]+_0x2e98b7,'VoiceExtensionId':_0x10232c[_0x4d6338][0x0]['VoiceExtensionId']});}_0x301d25[_0x9b0b('0x12')]=_0x2e4a5f['length']?_[_0x9b0b('0x3e')](_0x2e4a5f)['priority']+0x1:_0x590168[_0x9b0b('0x12')];_0x590168['priority']=(_0x14ba8c['length']?_[_0x9b0b('0x3e')](_0x14ba8c)['priority']:_0x301d25['priority'])+0x1;_0x590168[_0x9b0b('0x13')]=_[_0x9b0b('0x3f')](_0x590168[_0x9b0b('0x13')],_0x2e4a5f,[_0x301d25],_0x14ba8c);}_0x590168[_0x9b0b('0x13')][_0x9b0b('0x16')]({'type':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x17')],'app':'Hangup','exten':_0x10232c[_0x4d6338][0x0]['exten'],'context':_0x10232c[_0x4d6338][0x0][_0x9b0b('0x21')],'priority':_0x590168[_0x9b0b('0x12')],'VoiceExtensionId':_0x10232c[_0x4d6338][0x0]['VoiceExtensionId']});_0x176438[_0x9b0b('0x16')](_0x10232c[_0x4d6338][0x0][_0x9b0b('0x1f')]);_0x564dd6=_[_0x9b0b('0x3f')](_0x564dd6,_0x590168['extensions']);}}return _0x239e9d['transaction'](function(_0x325dfa){return _0x239e9d[_0x9b0b('0x2')]['VoiceExtension'][_0x9b0b('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x176438}},'transaction':_0x325dfa})['then'](function(_0x2d6f5d){return _0x239e9d[_0x9b0b('0x2')][_0x9b0b('0x7')][_0x9b0b('0x41')](_[_0x9b0b('0x42')](_0x564dd6,_0x9b0b('0x12')),{'transaction':_0x325dfa});});});})[_0x9b0b('0x43')](function(_0x211c2b){console[_0x9b0b('0x44')](_0x211c2b);});}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 38628aa..914096a 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 _0xad03=['stringify','cmContact','checkHopper','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','then','onlyIfOpen','all','CmList','BlackLists','VoiceQueueId','Campaign','CampaignId','cmContact,\x20%s,\x20%s','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20parse\x20error','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','index','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','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','Duplicate\x20Contact','CmContact','create','push','pick','catch'];(function(_0x15a77b,_0x18e4d8){var _0x360ca6=function(_0x58ae6e){while(--_0x58ae6e){_0x15a77b['push'](_0x15a77b['shift']());}};_0x360ca6(++_0x18e4d8);}(_0xad03,0x9a));var _0x3ad0=function(_0x96036,_0x99be68){_0x96036=_0x96036-0x0;var _0x411e6a=_0xad03[_0x96036];return _0x411e6a;};'use strict';var BPromise=require('bluebird');var util=require(_0x3ad0('0x0'));var _=require(_0x3ad0('0x1'));var fs=require('fs');var squel=require(_0x3ad0('0x2'));var Papa=require(_0x3ad0('0x3'));var Redis=require('ioredis');var db=require(_0x3ad0('0x4'))['db'];var config=require(_0x3ad0('0x5'));var logger=require(_0x3ad0('0x6'))('api');config[_0x3ad0('0x7')]=_[_0x3ad0('0x8')](config[_0x3ad0('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x3ad0('0x9'))(new Redis(config[_0x3ad0('0x7')]));require(_0x3ad0('0xa'))[_0x3ad0('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x3ad0('0xc')][0x2]===_0x3ad0('0xd')||process[_0x3ad0('0xc')][0x2]===_0x3ad0('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x3ad0('0xc')][0x2];if(!process[_0x3ad0('0xc')][0x3]||process[_0x3ad0('0xc')][0x3]===_0x3ad0('0xd')||process['argv'][0x3]===_0x3ad0('0xe')||!process[_0x3ad0('0xc')][0x4]||process[_0x3ad0('0xc')][0x4]===_0x3ad0('0xd')||process[_0x3ad0('0xc')][0x4]==='null'){throw new Error(_0x3ad0('0xf'));}var FIELDS=_[_0x3ad0('0x10')](process[_0x3ad0('0xc')][0x3][_0x3ad0('0x11')](','),process['argv'][0x4][_0x3ad0('0x11')](','));if(!process[_0x3ad0('0xc')][0x5]||process[_0x3ad0('0xc')][0x5]==='undefined'||process[_0x3ad0('0xc')][0x5]===_0x3ad0('0xe')){throw new Error(_0x3ad0('0x12'));}var LISTID=process[_0x3ad0('0xc')][0x5];var COMPANYID=process[_0x3ad0('0xc')][0x6]&&process[_0x3ad0('0xc')][0x6]!==_0x3ad0('0xd')&&process['argv'][0x6]!=='null'?process[_0x3ad0('0xc')][0x6]:null;var DUPLICATES=process[_0x3ad0('0xc')][0x7]&&process[_0x3ad0('0xc')][0x7]!=='undefined'&&process[_0x3ad0('0xc')][0x7]!==_0x3ad0('0xe')?process[_0x3ad0('0xc')][0x7]:null;if(!process[_0x3ad0('0xc')][0x8]||process['argv'][0x8]===_0x3ad0('0xd')||process[_0x3ad0('0xc')][0x8]==='null'){throw new Error(_0x3ad0('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x350adc){logger['error'](_0x350adc);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(_0x2d101f,_0x2610dd,_0x447957,_0x38592c){var _0x508e24={'message':_0x2610dd};_0x508e24[_0x2d101f]=!![];if(_0x447957){_0x508e24['contact']=_0x447957;}if(_0x38592c){_0x508e24[_0x3ad0('0x14')]=_0x38592c;}return _0x508e24;}function isEmail(_0x5e5468){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'](_0x5e5468);}function checkRow(_0x50e005,_0x224aa3,_0xc79a26){return new BPromise(function(_0xca80c,_0x5eda7e){if(_[_0x3ad0('0x15')](_0x50e005)){return _0x5eda7e(handleCheckRowError(_0x3ad0('0x16'),_0x3ad0('0x17'),null,_0xc79a26));}if(_0x50e005[_0x3ad0('0x18')]&&_0x50e005['errors'][_0x3ad0('0x19')]){var _0x5e1761=_[_0x3ad0('0x1a')](_0x50e005[_0x3ad0('0x18')],_0x3ad0('0x1b'))[_0x3ad0('0x1c')](';');return _0x5eda7e(handleCheckRowError(_0x3ad0('0x16'),_0x5e1761,null,_0xc79a26));}var _0x3e06cb={};for(var _0x6b14d2 in FIELDS){if(FIELDS[_0x3ad0('0x1d')](_0x6b14d2)&&FIELDS[_0x6b14d2]){_0x3e06cb[_0x6b14d2]=_0x50e005[_0x3ad0('0x1e')][0x0][FIELDS[_0x6b14d2]]||_0x50e005[_0x3ad0('0x1e')][0x0]['\ufeff'+FIELDS[_0x6b14d2]];}}if(!_0x3e06cb[_0x3ad0('0x1f')]){return _0x5eda7e(handleCheckRowError('error',_0x3ad0('0x20'),null,_0xc79a26));}if(!_0x3e06cb[_0x3ad0('0x21')]){return _0x5eda7e(handleCheckRowError('error',_0x3ad0('0x22'),null,_0xc79a26));}if(_0x3e06cb[_0x3ad0('0x23')]){var _0x195870=moment(_0x3e06cb['birthDate'],_0x3ad0('0x24'));if(!_0x195870['isValid']()){return _0x5eda7e(handleCheckRowError(_0x3ad0('0x16'),_0x3ad0('0x25'),null,_0xc79a26));}}if(_0x3e06cb['email']){if(!isEmail(_0x3e06cb[_0x3ad0('0x26')])){return _0x5eda7e(handleCheckRowError(_0x3ad0('0x16'),_0x3ad0('0x27'),null,_0xc79a26));}}_0x3e06cb[_0x3ad0('0x28')]=LISTID;_0x3e06cb[_0x3ad0('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3ad0('0x19')]&&_0x224aa3){var _0x5497f5={};for(var _0x560314=0x0,_0x201b37=DUPLICATES[_0x3ad0('0x19')];_0x560314<_0x201b37;_0x560314+=0x1){_0x5497f5[DUPLICATES[_0x560314]]=_0x3e06cb[DUPLICATES[_0x560314]];}var _0x1b2075=_[_0x3ad0('0x2a')](_0x224aa3,_0x5497f5);if(_0x1b2075){return _0x5eda7e(handleCheckRowError(_0x3ad0('0x2b'),_0x3ad0('0x2c'),_0x1b2075,_0xc79a26));}}return db[_0x3ad0('0x2d')][_0x3ad0('0x2e')](_0x3e06cb,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3e06cb)})['then'](function(_0x4333ef){if(DUPLICATES&&DUPLICATES['length']&&_0x224aa3){_0x224aa3[_0x3ad0('0x2f')](_[_0x3ad0('0x30')](_0x3e06cb,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4333ef['id'];return _0xca80c();})[_0x3ad0('0x31')](function(_0x3f4ed0){return _0x5eda7e(handleCheckRowError(_0x3ad0('0x16'),'Error\x20while\x20creating\x20contact:\x20'+(_0x3f4ed0['message']||JSON[_0x3ad0('0x32')](_0x3f4ed0)),null,_0xc79a26));});});}function checkHopper(){function _0x3349db(){return function(_0xa87710){logger['error'](_0x3ad0('0x33'),_0x3ad0('0x34'),util['inspect'](_0xa87710,{'showHidden':![],'depth':null}));};}var _0x4f3005=function(_0x495d11,_0x303570){var _0x498370=squel[_0x3ad0('0x35')]()['into'](_0x3ad0('0x36'))[_0x3ad0('0x37')]([_0x3ad0('0x21'),_0x3ad0('0x38'),_0x3ad0('0x39'),'ListId',_0x303570,_0x3ad0('0x3a'),_0x3ad0('0x3b')],squel[_0x3ad0('0x3c')]()[_0x3ad0('0x3d')](_0x3ad0('0x21'),_0x3ad0('0x21'))[_0x3ad0('0x3d')](_0x3ad0('0x3e'),'scheduledAt')[_0x3ad0('0x3d')]('id',_0x3ad0('0x39'))[_0x3ad0('0x3d')](LISTID[_0x3ad0('0x3f')](),_0x3ad0('0x28'))['field'](_0x495d11['id'][_0x3ad0('0x3f')](),_0x303570)['field'](_0x3ad0('0x3e'),_0x3ad0('0x3a'))[_0x3ad0('0x3d')]('NOW()',_0x3ad0('0x3b'))[_0x3ad0('0x40')](_0x3ad0('0x41'))[_0x3ad0('0x42')](_0x3ad0('0x43'))['where'](_0x3ad0('0x44'),LISTID[_0x3ad0('0x3f')]())[_0x3ad0('0x42')](_0x3ad0('0x45'))[_0x3ad0('0x42')](_0x3ad0('0x46'),squel[_0x3ad0('0x3c')]()['field'](_0x3ad0('0x21'))[_0x3ad0('0x40')]('cm_hopper')[_0x3ad0('0x42')](_0x303570+_0x3ad0('0x47'),_0x495d11['id'][_0x3ad0('0x3f')]())))['toString']();return _0x498370;};var _0x51a0be=function(_0x52351f,_0x3fbf22){var _0xd5b306=squel['insert']()[_0x3ad0('0x48')]('cm_hopper')[_0x3ad0('0x37')]([_0x3ad0('0x21'),'scheduledAt',_0x3ad0('0x39'),_0x3ad0('0x28'),_0x3fbf22,_0x3ad0('0x3a'),_0x3ad0('0x3b')],squel[_0x3ad0('0x3c')]()[_0x3ad0('0x3d')](_0x3ad0('0x21'),_0x3ad0('0x21'))[_0x3ad0('0x3d')](_0x3ad0('0x3e'),_0x3ad0('0x38'))[_0x3ad0('0x3d')]('id',_0x3ad0('0x39'))[_0x3ad0('0x3d')](LISTID[_0x3ad0('0x3f')](),'ListId')['field'](_0x52351f['id'][_0x3ad0('0x3f')](),_0x3fbf22)[_0x3ad0('0x3d')]('NOW()','createdAt')['field'](_0x3ad0('0x3e'),_0x3ad0('0x3b'))[_0x3ad0('0x40')](_0x3ad0('0x41'))[_0x3ad0('0x42')](_0x3ad0('0x43'))[_0x3ad0('0x42')](_0x3ad0('0x44'),LISTID[_0x3ad0('0x3f')]())['where'](_0x3ad0('0x49'),squel[_0x3ad0('0x4a')](hopperContacts))[_0x3ad0('0x42')](_0x3ad0('0x45'))[_0x3ad0('0x42')](_0x3ad0('0x46'),squel['select']()[_0x3ad0('0x3d')](_0x3ad0('0x4b'))[_0x3ad0('0x40')](_0x3ad0('0x4c'))[_0x3ad0('0x42')](_0x3fbf22+_0x3ad0('0x47'),_0x52351f['id']['toString']()))['where'](_0x3ad0('0x46'),squel['select']()[_0x3ad0('0x3d')](_0x3ad0('0x21'))['from']('cm_hopper')['where'](_0x3fbf22+_0x3ad0('0x47'),_0x52351f['id'][_0x3ad0('0x3f')]())))[_0x3ad0('0x3f')]();return _0xd5b306;};function _0x5d4d9d(_0x2f8c11,_0x419903){var _0x5bde3e=squel['insert']()[_0x3ad0('0x48')](_0x3ad0('0x36'))[_0x3ad0('0x37')](['phone',_0x3ad0('0x38'),_0x3ad0('0x39'),_0x3ad0('0x28'),_0x419903,_0x3ad0('0x3a'),_0x3ad0('0x3b')],squel['select']()['field'](_0x3ad0('0x21'),_0x3ad0('0x21'))[_0x3ad0('0x3d')](_0x3ad0('0x3e'),_0x3ad0('0x38'))[_0x3ad0('0x3d')]('id',_0x3ad0('0x39'))[_0x3ad0('0x3d')](LISTID['toString'](),_0x3ad0('0x28'))[_0x3ad0('0x3d')](_0x2f8c11['id'][_0x3ad0('0x3f')](),_0x419903)[_0x3ad0('0x3d')]('NOW()','createdAt')[_0x3ad0('0x3d')](_0x3ad0('0x3e'),'updatedAt')[_0x3ad0('0x40')](_0x3ad0('0x41'))['where'](_0x3ad0('0x43'))[_0x3ad0('0x42')](_0x3ad0('0x44'),LISTID[_0x3ad0('0x3f')]())[_0x3ad0('0x42')](_0x3ad0('0x49'),squel[_0x3ad0('0x4a')](hopperContacts))[_0x3ad0('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x3ad0('0x3f')]();return _0x5bde3e;}function _0x2d42ee(_0x588a77,_0x2b0fa1){var _0x3c8480=squel['insert']()[_0x3ad0('0x48')](_0x3ad0('0x4d'))[_0x3ad0('0x37')]([_0x3ad0('0x21'),_0x3ad0('0x39'),_0x3ad0('0x28'),_0x2b0fa1,_0x3ad0('0x3a'),'updatedAt'],squel[_0x3ad0('0x3c')]()[_0x3ad0('0x3d')](_0x3ad0('0x21'),_0x3ad0('0x21'))[_0x3ad0('0x3d')]('id',_0x3ad0('0x39'))['field'](LISTID[_0x3ad0('0x3f')](),_0x3ad0('0x28'))['field'](_0x588a77['id'][_0x3ad0('0x3f')](),_0x2b0fa1)[_0x3ad0('0x3d')]('NOW()',_0x3ad0('0x3a'))[_0x3ad0('0x3d')](_0x3ad0('0x3e'),_0x3ad0('0x3b'))[_0x3ad0('0x40')](_0x3ad0('0x41'))[_0x3ad0('0x42')](_0x3ad0('0x43'))[_0x3ad0('0x42')](_0x3ad0('0x44'),LISTID[_0x3ad0('0x3f')]())[_0x3ad0('0x42')](_0x3ad0('0x49'),squel[_0x3ad0('0x4a')](hopperContacts))[_0x3ad0('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x3ad0('0x3f')]();return _0x3c8480;}return db[_0x3ad0('0x4e')][_0x3ad0('0x4f')]({'where':{'type':_0x3ad0('0x50')},'attributes':['id',_0x3ad0('0x51')],'include':[{'model':db['CmList'],'as':_0x3ad0('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x459dd8){var _0x2ac88a=[];if(_0x459dd8){var _0x57fe13;for(var _0x21eeea=0x0,_0x27be02;_0x21eeea<_0x459dd8[_0x3ad0('0x19')];_0x21eeea+=0x1){_0x27be02=_0x459dd8[_0x21eeea][_0x3ad0('0x53')]({'plain':!![]});switch(_0x27be02[_0x3ad0('0x51')]){case _0x3ad0('0x54'):_0x2ac88a[_0x3ad0('0x2f')](db[_0x3ad0('0x55')][_0x3ad0('0x56')](_0x51a0be(_0x27be02,'VoiceQueueId'))[_0x3ad0('0x57')](function(){})[_0x3ad0('0x31')](_0x3349db()));break;case _0x3ad0('0x58'):_0x2ac88a[_0x3ad0('0x2f')](db['sequelize'][_0x3ad0('0x56')](_0x4f3005(_0x27be02,'VoiceQueueId'))['then'](function(){})[_0x3ad0('0x31')](_0x3349db()));break;default:_0x2ac88a[_0x3ad0('0x2f')](db[_0x3ad0('0x55')][_0x3ad0('0x56')](_0x5d4d9d(_0x27be02,'VoiceQueueId'))[_0x3ad0('0x57')](function(){})['catch'](_0x3349db()));}}}return _0x2ac88a;})[_0x3ad0('0x59')]()[_0x3ad0('0x57')](function(){return db[_0x3ad0('0x4e')][_0x3ad0('0x4f')]({'where':{'type':_0x3ad0('0x50')},'attributes':['id'],'include':[{'model':db[_0x3ad0('0x5a')],'as':_0x3ad0('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x1d1ede){var _0x25b3ba=[];if(_0x1d1ede){var _0x4c75fc;for(var _0xffde4f=0x0,_0x14c470;_0xffde4f<_0x1d1ede['length'];_0xffde4f+=0x1){_0x14c470=_0x1d1ede[_0xffde4f]['get']({'plain':!![]});_0x25b3ba[_0x3ad0('0x2f')](db[_0x3ad0('0x55')][_0x3ad0('0x56')](_0x2d42ee(_0x14c470,_0x3ad0('0x5c')))[_0x3ad0('0x57')](function(){})[_0x3ad0('0x31')](_0x3349db()));}}return _0x25b3ba;})['all']();})[_0x3ad0('0x57')](function(){return db[_0x3ad0('0x5d')]['findAll']({'attributes':['id',_0x3ad0('0x51')],'include':[{'model':db[_0x3ad0('0x5a')],'as':'Lists','where':{'id':LISTID}}]})[_0x3ad0('0x57')](function(_0x3f44b2){var _0x19075f=[];if(_0x3f44b2){for(var _0x2d55d3=0x0,_0x2dbc55;_0x2d55d3<_0x3f44b2[_0x3ad0('0x19')];_0x2d55d3+=0x1){_0x2dbc55=_0x3f44b2[_0x2d55d3][_0x3ad0('0x53')]({'plain':!![]});switch(_0x2dbc55['dialCheckDuplicateType']){case _0x3ad0('0x54'):_0x19075f[_0x3ad0('0x2f')](db[_0x3ad0('0x55')]['query'](_0x51a0be(_0x2dbc55,'CampaignId'))[_0x3ad0('0x57')](function(){})[_0x3ad0('0x31')](_0x3349db()));break;case _0x3ad0('0x58'):_0x19075f['push'](db[_0x3ad0('0x55')][_0x3ad0('0x56')](_0x4f3005(_0x2dbc55,'CampaignId'))[_0x3ad0('0x57')](function(){})[_0x3ad0('0x31')](_0x3349db()));break;default:_0x19075f[_0x3ad0('0x2f')](db[_0x3ad0('0x55')]['query'](_0x5d4d9d(_0x2dbc55,_0x3ad0('0x5e')))[_0x3ad0('0x57')](function(){})['catch'](_0x3349db()));}}}return _0x19075f;})['all']();})['then'](function(){return db[_0x3ad0('0x5d')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3ad0('0x5a')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3ad0('0x57')](function(_0x27e5d9){var _0x5590fd=[];if(_0x27e5d9){for(var _0x379465=0x0,_0x69bec3;_0x379465<_0x27e5d9[_0x3ad0('0x19')];_0x379465+=0x1){_0x69bec3=_0x27e5d9[_0x379465][_0x3ad0('0x53')]({'plain':!![]});_0x5590fd[_0x3ad0('0x2f')](db['sequelize'][_0x3ad0('0x56')](_0x2d42ee(_0x69bec3,_0x3ad0('0x5e')))[_0x3ad0('0x57')](function(){})[_0x3ad0('0x31')](_0x3349db()));}}return _0x5590fd;})['all']();})['catch'](function(_0x2da8ce){logger[_0x3ad0('0x16')](_0x3ad0('0x5f'),'generalCheckHopper',_0x2da8ce[_0x3ad0('0x1b')]);});}var processPromises=function(_0x249a05){return BPromise[_0x3ad0('0x59')](promises)[_0x3ad0('0x57')](function(_0x3c787e){})['catch'](function(_0x59db62){logger[_0x3ad0('0x16')]('Error\x20processing\x20rows\x20block:',JSON[_0x3ad0('0x32')](_0x59db62));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x249a05){return _0x249a05['resume']();}});};var endCsv=function(){return BPromise[_0x3ad0('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x3ad0('0x57')](function(){socket['emit'](_0x3ad0('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3ad0('0x62')](FILEPATH);}catch(_0x341a67){logger['error'](_0x3ad0('0x63'),JSON[_0x3ad0('0x32')](_0x341a67));}finally{process['exit'](0x0);}});};process['on'](_0x3ad0('0x64'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x3ad0('0x60')]()[_0x3ad0('0x57')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3ad0('0x11')](',');return db['CmContact'][_0x3ad0('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3ad0('0x57')](function(_0x9a573a){var _0x55ac14=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x55ac14,{'header':!![],'skipEmptyLines':!![],'step':function(_0x6d6d1a,_0x16cd89){total+=0x1;var _0x18e238=total;promises[_0x3ad0('0x2f')](checkRow(_0x6d6d1a,_0x9a573a,_0x18e238)[_0x3ad0('0x57')](function(){success+=0x1;})[_0x3ad0('0x31')](function(_0x37db96){if(_0x37db96['error']){errors+=0x1;delete _0x37db96[_0x3ad0('0x16')];}else if(_0x37db96[_0x3ad0('0x2b')]){duplicates+=0x1;delete _0x37db96[_0x3ad0('0x2b')];}rows[_0x3ad0('0x2f')](_0x37db96);}));if(total%0xc8===0x0){_0x16cd89['pause']();return processPromises(_0x16cd89);}},'complete':function(){return processPromises()[_0x3ad0('0x57')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x135c83,_0x353cfd){logger['info'](_0x3ad0('0x65'),JSON[_0x3ad0('0x32')](_0x135c83));endCsv();}});})[_0x3ad0('0x31')](function(_0x3b483e){logger[_0x3ad0('0x16')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x3ad0('0x32')](_0x3b483e));});}main(); \ No newline at end of file +var _0x0810=['cm_hopper_black','VoiceQueue','findAll','outbound','get','dialCheckDuplicateType','sequelize','query','VoiceQueueId','onlyIfOpen','all','CmList','BlackLists','Campaign','Lists','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','../../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','map','errors','message','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','length','find','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','\x20=\x20?','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final'];(function(_0x3ad4f1,_0x4135b1){var _0xa4be3=function(_0x262629){while(--_0x262629){_0x3ad4f1['push'](_0x3ad4f1['shift']());}};_0xa4be3(++_0x4135b1);}(_0x0810,0xfa));var _0x0081=function(_0x1daacc,_0x4a7eb1){_0x1daacc=_0x1daacc-0x0;var _0x4c6dad=_0x0810[_0x1daacc];return _0x4c6dad;};'use strict';var BPromise=require(_0x0081('0x0'));var util=require(_0x0081('0x1'));var _=require(_0x0081('0x2'));var fs=require('fs');var squel=require(_0x0081('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0x0081('0x4'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('api');config[_0x0081('0x5')]=_[_0x0081('0x6')](config['redis'],{'host':_0x0081('0x7'),'port':0x18eb});var socket=require(_0x0081('0x8'))(new Redis(config[_0x0081('0x5')]));require('../../../api/cmContact/cmContact.socket')[_0x0081('0x9')](socket);try{if(!process[_0x0081('0xa')][0x2]||process['argv'][0x2]===_0x0081('0xb')||process[_0x0081('0xa')][0x2]==='null'){throw new Error(_0x0081('0xc'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0x0081('0xb')||process[_0x0081('0xa')][0x3]==='null'||!process[_0x0081('0xa')][0x4]||process[_0x0081('0xa')][0x4]===_0x0081('0xb')||process[_0x0081('0xa')][0x4]===_0x0081('0xd')){throw new Error(_0x0081('0xe'));}var FIELDS=_[_0x0081('0xf')](process[_0x0081('0xa')][0x3][_0x0081('0x10')](','),process[_0x0081('0xa')][0x4]['split'](','));if(!process[_0x0081('0xa')][0x5]||process[_0x0081('0xa')][0x5]===_0x0081('0xb')||process['argv'][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0081('0xa')][0x6]&&process['argv'][0x6]!==_0x0081('0xb')&&process[_0x0081('0xa')][0x6]!==_0x0081('0xd')?process[_0x0081('0xa')][0x6]:null;var DUPLICATES=process[_0x0081('0xa')][0x7]&&process[_0x0081('0xa')][0x7]!==_0x0081('0xb')&&process[_0x0081('0xa')][0x7]!=='null'?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x0081('0xa')][0x8]==='undefined'||process['argv'][0x8]===_0x0081('0xd')){throw new Error(_0x0081('0x11'));}var SOCKET_TIMESTAMP=process[_0x0081('0xa')][0x8];}catch(_0x3e517a){logger['error'](_0x3e517a);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(_0x4a9109,_0x245f25,_0x16a9c3,_0x42cb82){var _0x5cf0eb={'message':_0x245f25};_0x5cf0eb[_0x4a9109]=!![];if(_0x16a9c3){_0x5cf0eb['contact']=_0x16a9c3;}if(_0x42cb82){_0x5cf0eb[_0x0081('0x12')]=_0x42cb82;}return _0x5cf0eb;}function isEmail(_0x32577d){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))*$/[_0x0081('0x13')](_0x32577d);}function checkRow(_0x2dbada,_0x25f0c3,_0x48ed7d){return new BPromise(function(_0x187ab7,_0x31c39e){if(_[_0x0081('0x14')](_0x2dbada)){return _0x31c39e(handleCheckRowError(_0x0081('0x15'),_0x0081('0x16'),null,_0x48ed7d));}if(_0x2dbada['errors']&&_0x2dbada['errors']['length']){var _0xbeb84c=_[_0x0081('0x17')](_0x2dbada[_0x0081('0x18')],_0x0081('0x19'))[_0x0081('0x1a')](';');return _0x31c39e(handleCheckRowError(_0x0081('0x15'),_0xbeb84c,null,_0x48ed7d));}var _0x4e5531={};for(var _0x48a948 in FIELDS){if(FIELDS[_0x0081('0x1b')](_0x48a948)&&FIELDS[_0x48a948]){_0x4e5531[_0x48a948]=_0x2dbada[_0x0081('0x1c')][0x0][FIELDS[_0x48a948]]||_0x2dbada['data'][0x0]['\ufeff'+FIELDS[_0x48a948]];}}if(!_0x4e5531[_0x0081('0x1d')]){return _0x31c39e(handleCheckRowError(_0x0081('0x15'),'firstName\x20not\x20specified!',null,_0x48ed7d));}if(!_0x4e5531[_0x0081('0x1e')]){return _0x31c39e(handleCheckRowError(_0x0081('0x15'),_0x0081('0x1f'),null,_0x48ed7d));}if(_0x4e5531['birthDate']){var _0x460600=moment(_0x4e5531['birthDate'],_0x0081('0x20'));if(!_0x460600[_0x0081('0x21')]()){return _0x31c39e(handleCheckRowError(_0x0081('0x15'),_0x0081('0x22'),null,_0x48ed7d));}}if(_0x4e5531[_0x0081('0x23')]){if(!isEmail(_0x4e5531[_0x0081('0x23')])){return _0x31c39e(handleCheckRowError(_0x0081('0x15'),_0x0081('0x24'),null,_0x48ed7d));}}_0x4e5531[_0x0081('0x25')]=LISTID;_0x4e5531['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0081('0x26')]&&_0x25f0c3){var _0x898518={};for(var _0x16d221=0x0,_0x37be55=DUPLICATES[_0x0081('0x26')];_0x16d221<_0x37be55;_0x16d221+=0x1){_0x898518[DUPLICATES[_0x16d221]]=_0x4e5531[DUPLICATES[_0x16d221]];}var _0x30d2e1=_[_0x0081('0x27')](_0x25f0c3,_0x898518);if(_0x30d2e1){return _0x31c39e(handleCheckRowError(_0x0081('0x28'),_0x0081('0x29'),_0x30d2e1,_0x48ed7d));}}return db['CmContact'][_0x0081('0x2a')](_0x4e5531,{'raw':!![],'hooks':![],'fields':_[_0x0081('0x2b')](_0x4e5531)})[_0x0081('0x2c')](function(_0x37fbda){if(DUPLICATES&&DUPLICATES[_0x0081('0x26')]&&_0x25f0c3){_0x25f0c3[_0x0081('0x2d')](_[_0x0081('0x2e')](_0x4e5531,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x37fbda['id'];return _0x187ab7();})[_0x0081('0x2f')](function(_0x1bdb27){return _0x31c39e(handleCheckRowError(_0x0081('0x15'),_0x0081('0x30')+(_0x1bdb27[_0x0081('0x19')]||JSON[_0x0081('0x31')](_0x1bdb27)),null,_0x48ed7d));});});}function checkHopper(){function _0x4a22d9(){return function(_0x156cd8){logger[_0x0081('0x15')](_0x0081('0x32'),_0x0081('0x33'),util[_0x0081('0x34')](_0x156cd8,{'showHidden':![],'depth':null}));};}var _0x4d359c=function(_0x1942de,_0x1ace87){var _0x44b8be=squel[_0x0081('0x35')]()[_0x0081('0x36')]('cm_hopper')['fromQuery']([_0x0081('0x1e'),_0x0081('0x37'),_0x0081('0x38'),'ListId',_0x1ace87,_0x0081('0x39'),_0x0081('0x3a')],squel[_0x0081('0x3b')]()[_0x0081('0x3c')]('phone',_0x0081('0x1e'))[_0x0081('0x3c')](_0x0081('0x3d'),_0x0081('0x37'))[_0x0081('0x3c')]('id',_0x0081('0x38'))[_0x0081('0x3c')](LISTID['toString'](),_0x0081('0x25'))[_0x0081('0x3c')](_0x1942de['id'][_0x0081('0x3e')](),_0x1ace87)[_0x0081('0x3c')](_0x0081('0x3d'),'createdAt')[_0x0081('0x3c')]('NOW()','updatedAt')['from'](_0x0081('0x3f'))['where'](_0x0081('0x40'))[_0x0081('0x41')](_0x0081('0x42'),LISTID['toString']())[_0x0081('0x41')](_0x0081('0x43'))[_0x0081('0x41')](_0x0081('0x44'),squel[_0x0081('0x3b')]()[_0x0081('0x3c')](_0x0081('0x1e'))[_0x0081('0x45')](_0x0081('0x46'))['where'](_0x1ace87+_0x0081('0x47'),_0x1942de['id'][_0x0081('0x3e')]())))[_0x0081('0x3e')]();return _0x44b8be;};var _0x1565f1=function(_0x48eeff,_0x50befa){var _0x5a8203=squel[_0x0081('0x35')]()[_0x0081('0x36')](_0x0081('0x46'))[_0x0081('0x48')]([_0x0081('0x1e'),'scheduledAt',_0x0081('0x38'),_0x0081('0x25'),_0x50befa,_0x0081('0x39'),_0x0081('0x3a')],squel[_0x0081('0x3b')]()[_0x0081('0x3c')](_0x0081('0x1e'),_0x0081('0x1e'))['field'](_0x0081('0x3d'),_0x0081('0x37'))['field']('id',_0x0081('0x38'))['field'](LISTID[_0x0081('0x3e')](),'ListId')[_0x0081('0x3c')](_0x48eeff['id'][_0x0081('0x3e')](),_0x50befa)[_0x0081('0x3c')]('NOW()',_0x0081('0x39'))[_0x0081('0x3c')]('NOW()',_0x0081('0x3a'))[_0x0081('0x45')](_0x0081('0x3f'))[_0x0081('0x41')](_0x0081('0x40'))[_0x0081('0x41')](_0x0081('0x42'),LISTID[_0x0081('0x3e')]())[_0x0081('0x41')](_0x0081('0x49'),squel[_0x0081('0x4a')](hopperContacts))[_0x0081('0x41')](_0x0081('0x43'))[_0x0081('0x41')](_0x0081('0x44'),squel[_0x0081('0x3b')]()[_0x0081('0x3c')](_0x0081('0x4b'))['from'](_0x0081('0x4c'))[_0x0081('0x41')](_0x50befa+_0x0081('0x47'),_0x48eeff['id'][_0x0081('0x3e')]()))[_0x0081('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0081('0x3b')]()[_0x0081('0x3c')](_0x0081('0x1e'))[_0x0081('0x45')]('cm_hopper')[_0x0081('0x41')](_0x50befa+_0x0081('0x47'),_0x48eeff['id'][_0x0081('0x3e')]())))[_0x0081('0x3e')]();return _0x5a8203;};function _0x516ae0(_0x2323a7,_0x4b0be2){var _0x2b1765=squel['insert']()['into'](_0x0081('0x46'))[_0x0081('0x48')]([_0x0081('0x1e'),_0x0081('0x37'),_0x0081('0x38'),'ListId',_0x4b0be2,_0x0081('0x39'),_0x0081('0x3a')],squel['select']()[_0x0081('0x3c')](_0x0081('0x1e'),'phone')['field'](_0x0081('0x3d'),_0x0081('0x37'))['field']('id',_0x0081('0x38'))[_0x0081('0x3c')](LISTID[_0x0081('0x3e')](),'ListId')['field'](_0x2323a7['id'][_0x0081('0x3e')](),_0x4b0be2)[_0x0081('0x3c')]('NOW()','createdAt')[_0x0081('0x3c')](_0x0081('0x3d'),_0x0081('0x3a'))[_0x0081('0x45')](_0x0081('0x3f'))[_0x0081('0x41')](_0x0081('0x40'))[_0x0081('0x41')]('ListId\x20=\x20?',LISTID[_0x0081('0x3e')]())[_0x0081('0x41')](_0x0081('0x49'),squel[_0x0081('0x4a')](hopperContacts))[_0x0081('0x41')](_0x0081('0x43')))[_0x0081('0x3e')]();return _0x2b1765;}function _0x20e3e2(_0x5ca391,_0x29f0f0){var _0x10bdfc=squel[_0x0081('0x35')]()[_0x0081('0x36')](_0x0081('0x4d'))[_0x0081('0x48')]([_0x0081('0x1e'),_0x0081('0x38'),'ListId',_0x29f0f0,'createdAt','updatedAt'],squel['select']()[_0x0081('0x3c')](_0x0081('0x1e'),_0x0081('0x1e'))[_0x0081('0x3c')]('id',_0x0081('0x38'))[_0x0081('0x3c')](LISTID[_0x0081('0x3e')](),'ListId')['field'](_0x5ca391['id'][_0x0081('0x3e')](),_0x29f0f0)[_0x0081('0x3c')](_0x0081('0x3d'),_0x0081('0x39'))[_0x0081('0x3c')](_0x0081('0x3d'),'updatedAt')[_0x0081('0x45')](_0x0081('0x3f'))[_0x0081('0x41')](_0x0081('0x40'))[_0x0081('0x41')](_0x0081('0x42'),LISTID['toString']())[_0x0081('0x41')](_0x0081('0x49'),squel[_0x0081('0x4a')](hopperContacts))[_0x0081('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x0081('0x3e')]();return _0x10bdfc;}return db[_0x0081('0x4e')][_0x0081('0x4f')]({'where':{'type':_0x0081('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x0081('0x2c')](function(_0xd4652a){var _0x52e1f3=[];if(_0xd4652a){var _0x7a2e9;for(var _0x58b13b=0x0,_0x4d7133;_0x58b13b<_0xd4652a['length'];_0x58b13b+=0x1){_0x4d7133=_0xd4652a[_0x58b13b][_0x0081('0x51')]({'plain':!![]});switch(_0x4d7133[_0x0081('0x52')]){case'always':_0x52e1f3[_0x0081('0x2d')](db[_0x0081('0x53')][_0x0081('0x54')](_0x1565f1(_0x4d7133,_0x0081('0x55')))['then'](function(){})[_0x0081('0x2f')](_0x4a22d9()));break;case _0x0081('0x56'):_0x52e1f3['push'](db['sequelize'][_0x0081('0x54')](_0x4d359c(_0x4d7133,_0x0081('0x55')))[_0x0081('0x2c')](function(){})[_0x0081('0x2f')](_0x4a22d9()));break;default:_0x52e1f3[_0x0081('0x2d')](db[_0x0081('0x53')][_0x0081('0x54')](_0x516ae0(_0x4d7133,'VoiceQueueId'))[_0x0081('0x2c')](function(){})[_0x0081('0x2f')](_0x4a22d9()));}}}return _0x52e1f3;})[_0x0081('0x57')]()[_0x0081('0x2c')](function(){return db[_0x0081('0x4e')][_0x0081('0x4f')]({'where':{'type':_0x0081('0x50')},'attributes':['id'],'include':[{'model':db[_0x0081('0x58')],'as':_0x0081('0x59'),'where':{'id':LISTID}}]})[_0x0081('0x2c')](function(_0x10e35f){var _0x43da1d=[];if(_0x10e35f){var _0x40399b;for(var _0x2bc690=0x0,_0x2dd510;_0x2bc690<_0x10e35f[_0x0081('0x26')];_0x2bc690+=0x1){_0x2dd510=_0x10e35f[_0x2bc690][_0x0081('0x51')]({'plain':!![]});_0x43da1d[_0x0081('0x2d')](db[_0x0081('0x53')]['query'](_0x20e3e2(_0x2dd510,_0x0081('0x55')))[_0x0081('0x2c')](function(){})['catch'](_0x4a22d9()));}}return _0x43da1d;})['all']();})[_0x0081('0x2c')](function(){return db[_0x0081('0x5a')][_0x0081('0x4f')]({'attributes':['id',_0x0081('0x52')],'include':[{'model':db['CmList'],'as':_0x0081('0x5b'),'where':{'id':LISTID}}]})[_0x0081('0x2c')](function(_0x70e0ad){var _0x3e3fe1=[];if(_0x70e0ad){for(var _0x5c6d20=0x0,_0x31ff9b;_0x5c6d20<_0x70e0ad[_0x0081('0x26')];_0x5c6d20+=0x1){_0x31ff9b=_0x70e0ad[_0x5c6d20][_0x0081('0x51')]({'plain':!![]});switch(_0x31ff9b['dialCheckDuplicateType']){case _0x0081('0x5c'):_0x3e3fe1[_0x0081('0x2d')](db[_0x0081('0x53')][_0x0081('0x54')](_0x1565f1(_0x31ff9b,_0x0081('0x5d')))[_0x0081('0x2c')](function(){})[_0x0081('0x2f')](_0x4a22d9()));break;case _0x0081('0x56'):_0x3e3fe1[_0x0081('0x2d')](db['sequelize'][_0x0081('0x54')](_0x4d359c(_0x31ff9b,_0x0081('0x5d')))['then'](function(){})[_0x0081('0x2f')](_0x4a22d9()));break;default:_0x3e3fe1[_0x0081('0x2d')](db['sequelize'][_0x0081('0x54')](_0x516ae0(_0x31ff9b,_0x0081('0x5d')))[_0x0081('0x2c')](function(){})[_0x0081('0x2f')](_0x4a22d9()));}}}return _0x3e3fe1;})['all']();})['then'](function(){return db[_0x0081('0x5a')][_0x0081('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0081('0x58')],'as':_0x0081('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x5e0e51){var _0x1ec801=[];if(_0x5e0e51){for(var _0x1acd7e=0x0,_0x2403c7;_0x1acd7e<_0x5e0e51[_0x0081('0x26')];_0x1acd7e+=0x1){_0x2403c7=_0x5e0e51[_0x1acd7e][_0x0081('0x51')]({'plain':!![]});_0x1ec801[_0x0081('0x2d')](db[_0x0081('0x53')][_0x0081('0x54')](_0x20e3e2(_0x2403c7,_0x0081('0x5d')))[_0x0081('0x2c')](function(){})[_0x0081('0x2f')](_0x4a22d9()));}}return _0x1ec801;})['all']();})['catch'](function(_0x5518e0){logger['error'](_0x0081('0x5e'),_0x0081('0x5f'),_0x5518e0[_0x0081('0x19')]);});}var processPromises=function(_0x195e6b){return BPromise[_0x0081('0x57')](promises)[_0x0081('0x2c')](function(_0x51ed5){})[_0x0081('0x2f')](function(_0xff357e){logger[_0x0081('0x15')](_0x0081('0x60'),JSON[_0x0081('0x31')](_0xff357e));})[_0x0081('0x61')](function(){socket[_0x0081('0x62')](_0x0081('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x195e6b){return _0x195e6b['resume']();}});};var endCsv=function(){return BPromise[_0x0081('0x64')]()[_0x0081('0x2c')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x0081('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0081('0x65')](FILEPATH);}catch(_0x44e1b0){logger[_0x0081('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x44e1b0));}finally{process['exit'](0x0);}});};process['on'](_0x0081('0x66'),function(){logger[_0x0081('0x67')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0081('0x10')](',');return db['CmContact'][_0x0081('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0081('0x2c')](function(_0x17ea98){var _0x25d52a=fs[_0x0081('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0081('0x69')](_0x25d52a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x555f3d,_0x40b0a5){total+=0x1;var _0x12a6f3=total;promises[_0x0081('0x2d')](checkRow(_0x555f3d,_0x17ea98,_0x12a6f3)[_0x0081('0x2c')](function(){success+=0x1;})[_0x0081('0x2f')](function(_0x155448){if(_0x155448[_0x0081('0x15')]){errors+=0x1;delete _0x155448[_0x0081('0x15')];}else if(_0x155448[_0x0081('0x28')]){duplicates+=0x1;delete _0x155448[_0x0081('0x28')];}rows['push'](_0x155448);}));if(total%0xc8===0x0){_0x40b0a5[_0x0081('0x6a')]();return processPromises(_0x40b0a5);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0081('0x67')](_0x0081('0x6b'));endCsv();});},'error':function(_0x208a0a,_0x4bbba5){logger[_0x0081('0x67')](_0x0081('0x6c'),JSON[_0x0081('0x31')](_0x208a0a));endCsv();}});})[_0x0081('0x2f')](function(_0x34ed15){logger[_0x0081('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0081('0x31')](_0x34ed15));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 9e0a5f0..919048c 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 _0x41f6=['ListId','createdAt','updatedAt','recallme','fields','from','.CmListId','.CmListId\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','into','cm_hopper_black','ContactId','cm_contacts.createdAt\x20=\x20?','scheduledat','priority','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','query','spread','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','dialTimezone','utcOffset','set','offset','stringify','start','binding','clone','socket_timestamp','.csv','keys','ContactItemType','name','header','writeFileSync','parse','data','rows','find','_description','isNil','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','push','all','AdditionalPhones','split','filter','CmContactHasItem','findOne','update','updated','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery'];(function(_0x229e71,_0x1ea4db){var _0x390c25=function(_0x442e9a){while(--_0x442e9a){_0x229e71['push'](_0x229e71['shift']());}};_0x390c25(++_0x1ea4db);}(_0x41f6,0x1e9));var _0x641f=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x41f6[_0x3e0b8f];return _0x22f742;};'use strict';var fs=require('fs');var path=require(_0x641f('0x0'));var _=require(_0x641f('0x1'));var Papa=require('papaparse');var util=require(_0x641f('0x2'));var BPromise=require(_0x641f('0x3'));var moment=require(_0x641f('0x4'));var squel=require(_0x641f('0x5'));var Redis=require('ioredis');var db=require(_0x641f('0x6'))['db'];var config=require(_0x641f('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0x641f('0x8'))(_0x641f('0x9'));config['redis']=_[_0x641f('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x641f('0xb'))(new Redis(config[_0x641f('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x641f('0xd')](_0x641f('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x641f('0xd')](_0x641f('0xe'));function isEmail(_0x60ac61){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))*$/[_0x641f('0xf')](_0x60ac61);}function selectNotIn(_0x276eb6,_0x3ac43d,_0x5664c3,_0x28fca2,_0x50c282){return squel[_0x641f('0x10')]()[_0x641f('0x11')](_0x641f('0x12'))['from'](_0x28fca2)[_0x641f('0x13')](_0x3ac43d,null,_0x3ac43d+_0x641f('0x14')+_0x28fca2+'.'+_0x5664c3)[_0x641f('0x15')](_0x28fca2+'.'+_0x5664c3+_0x641f('0x16')+_0x276eb6+'.'+_0x5664c3)[_0x641f('0x15')](_0x3ac43d+_0x641f('0x17')+_0x50c282['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x18f9fa,_0x51686c){promisesAdditionalPhones=[];return db[_0x641f('0x18')][_0x641f('0x19')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x641f('0x1a')](function(_0x52ac21){if(_0x52ac21!==null){var _0x230ea5=[];for(var _0xb5fa52=0x0;_0xb5fa52<_0x52ac21[_0x641f('0x1b')];_0xb5fa52++){var _0x57c174=_0x52ac21[_0xb5fa52];_0x230ea5[_0x641f('0x1c')](insertAdditionalPhones(_0x57c174));}}Promise[_0x641f('0x1d')](_0x230ea5)[_0x641f('0x1a')](function(){_0x18f9fa({'val':0x1});});});});}function insertAdditionalPhones(_0x28220a){return new Promise(function(_0x808334,_0x1ae97c){var _0x5f3cb2=_0x28220a[_0x641f('0x1e')];var _0x244b58=_0x5f3cb2[_0x641f('0x1f')](';');var _0x322777=[];orderBy=0x0;for(var _0x19958d=0x0;_0x19958d<_0x244b58['length'];_0x19958d++){_0x322777[_0x641f('0x1c')](splitAdditionalPhone(_0x28220a['id'],_0x244b58[_0x19958d]));}Promise[_0x641f('0x1d')](_0x322777)[_0x641f('0x1a')](function(){_0x808334({'val':_0x244b58[_0x641f('0x1b')]});});});}function splitAdditionalPhone(_0xdaddb5,_0x537308){return new Promise(function(_0x45af5b,_0xc5df09){var _0x274337=_0x537308[_0x641f('0x1f')](':');var _0x5ad4df=_0x274337[0x0];var _0x37c91c=_0x274337[0x1];if(!_['isNil'](_0x37c91c)){var _0x2403e1=_0x37c91c[_0x641f('0x1f')]('|');var _0x4e778c=[];for(var _0x156dca=0x0;_0x156dca<_0x2403e1[_0x641f('0x1b')];_0x156dca++){if(_0x2403e1[_0x156dca]!==''){var _0x4f7f80=_[_0x641f('0x20')](promisesAdditionalPhones,{'contactId':_0xdaddb5,'phone':_0x2403e1[_0x156dca]});if(_0x4f7f80[_0x641f('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x641f('0x1c')]({'contactId':_0xdaddb5,'contactTypeId':_0x5ad4df,'phone':_0x2403e1[_0x156dca],'orderBy':orderBy});}}}_0x45af5b({'ok':0x1});}else _0x45af5b({'res':0x0});});}function createAdditionalPhone(_0x259686,_0x3579f1,_0x25279d,_0x48bc37){var _0x56e1c3='';var _0x2e5ffb='';var _0x3da248=_0x25279d[_0x641f('0x1f')]('§');_0x56e1c3=_0x3da248[0x0];if(_0x3da248['length']==0x2)_0x2e5ffb=_0x3da248[0x1];return new Promise(function(_0x3997fa,_0x45b6c8){return db[_0x641f('0x21')][_0x641f('0x22')]({'where':{'CmContactId':_0x259686,'item':_0x56e1c3}})['then'](function(_0x2207aa){if(_0x2207aa){return db[_0x641f('0x21')][_0x641f('0x23')]({'ItemTypeId':_0x3579f1,'description':_0x2e5ffb,'OrderBy':_0x48bc37},{'where':{'CmContactId':_0x259686,'item':_0x56e1c3}})[_0x641f('0x1a')](function(_0x4ada23){_0x3997fa({'res':_0x641f('0x24')});});}else{return db[_0x641f('0x21')]['create']({'CmContactId':_0x259686,'item':_0x56e1c3,'description':_0x2e5ffb,'ItemTypeId':_0x3579f1,'OrderBy':_0x48bc37,'ItemClass':'PHONE'})[_0x641f('0x1a')](function(_0x2e1140){_0x3997fa({'res':_0x641f('0x25')});});}});});}function insertCmHopper(_0x511a73,_0x439f00,_0x94b753,_0x4f59d,_0x4dde2d){var _0x482669=[_0x641f('0x26'),_0x641f('0x27'),_0x641f('0x28'),'cm_contacts.ListId',_0x439f00+'.'+_0x4f59d,_0x641f('0x29'),_0x641f('0x2a'),_0x641f('0x2b'),_0x641f('0x2c'),'\x22'+_0x4dde2d+'\x22'];return squel[_0x641f('0x2d')]()['into'](_0x641f('0x2e'))[_0x641f('0x2f')](['phone','scheduledat','ContactId',_0x641f('0x30'),_0x4f59d,_0x641f('0x31'),_0x641f('0x32'),'priority','UserId',_0x641f('0x33')],squel[_0x641f('0x10')]()[_0x641f('0x34')](_0x482669)[_0x641f('0x35')](_0x439f00)[_0x641f('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x439f00+_0x641f('0x36'))[_0x641f('0x13')](_0x94b753,null,_0x94b753+_0x641f('0x14')+_0x439f00+'.'+_0x4f59d)[_0x641f('0x15')](_0x439f00+_0x641f('0x37'),_0x511a73)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x439f00,_0x94b753,_0x4f59d,_0x641f('0x2e'),['\x22always\x22',_0x641f('0x38')]))[_0x641f('0x15')](_0x641f('0x39'),selectNotIn(_0x439f00,_0x94b753,_0x4f59d,_0x641f('0x2e'),[_0x641f('0x3a')])))[_0x641f('0x3b')]();}function insertCmHopperBlack(_0x351c5f,_0xe2c945,_0x453745,_0x4d9c7c){var _0x5a7689=[_0x641f('0x26'),_0x641f('0x28'),_0x641f('0x3c'),_0xe2c945+'.'+_0x4d9c7c,_0x641f('0x29'),_0x641f('0x2a')];return squel[_0x641f('0x2d')]()[_0x641f('0x3d')](_0x641f('0x3e'))[_0x641f('0x2f')]([_0x641f('0x12'),_0x641f('0x3f'),_0x641f('0x30'),_0x4d9c7c,'createdAt','updatedAt'],squel[_0x641f('0x10')]()['fields'](_0x5a7689)[_0x641f('0x35')](_0xe2c945)[_0x641f('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xe2c945+_0x641f('0x36'))[_0x641f('0x13')](_0x453745,null,_0x453745+_0x641f('0x14')+_0xe2c945+'.'+_0x4d9c7c)[_0x641f('0x15')](_0xe2c945+_0x641f('0x37'),_0x351c5f)['where'](_0x641f('0x40'),NOW)[_0x641f('0x15')](_0x641f('0x39'),squel[_0x641f('0x10')]()[_0x641f('0x11')]('phone')['from']('cm_hopper_black')[_0x641f('0x15')]('ListId\x20=\x20?',_0x351c5f)[_0x641f('0x15')](_0x4d9c7c+_0x641f('0x16')+_0xe2c945+'.'+_0x4d9c7c)))['toString']();}function insertTzCmHopper(_0x2f439a,_0x5a3f95,_0x3cc953,_0x53fdb0,_0x42dbc1,_0x54c04f){var _0x17632b=[_0x641f('0x26'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x54c04f+'.offset-cm_contacts.utcOffset\x20minute)',_0x641f('0x28'),'cm_contacts.ListId',_0x5a3f95+'.'+_0x53fdb0,_0x641f('0x29'),_0x641f('0x2a'),_0x641f('0x2b'),_0x641f('0x2c'),'\x22'+_0x42dbc1+'\x22'];var _0x5c0713=squel[_0x641f('0x2d')]()[_0x641f('0x3d')](_0x641f('0x2e'))[_0x641f('0x2f')]([_0x641f('0x12'),_0x641f('0x41'),_0x641f('0x3f'),'ListId',_0x53fdb0,_0x641f('0x31'),_0x641f('0x32'),_0x641f('0x42'),_0x641f('0x43'),_0x641f('0x33')],squel[_0x641f('0x10')]()[_0x641f('0x34')](_0x17632b)[_0x641f('0x35')](_0x5a3f95)[_0x641f('0x13')](_0x641f('0x44'),null,_0x641f('0x45')+_0x5a3f95+_0x641f('0x36'))[_0x641f('0x13')](_0x3cc953,null,_0x3cc953+_0x641f('0x14')+_0x5a3f95+'.'+_0x53fdb0)[_0x641f('0x13')](_0x54c04f,null,_0x54c04f+_0x641f('0x14')+_0x5a3f95+'.'+_0x53fdb0)[_0x641f('0x15')](_0x5a3f95+_0x641f('0x37'),_0x2f439a)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x641f('0x15')](_0x641f('0x39'),selectNotIn(_0x5a3f95,_0x3cc953,_0x53fdb0,_0x641f('0x2e'),[_0x641f('0x3a'),_0x641f('0x38')]))[_0x641f('0x15')](_0x641f('0x39'),selectNotIn(_0x5a3f95,_0x3cc953,_0x53fdb0,'cm_hopper',[_0x641f('0x3a')])))[_0x641f('0x3b')]();return _0x5c0713;}function insertTzCmHopperBlack(_0x50342d,_0x59e755,_0x2dbef0,_0x39c5bb){var _0x1c6da1=[_0x641f('0x26'),_0x641f('0x28'),_0x641f('0x3c'),_0x59e755+'.'+_0x39c5bb,_0x641f('0x29'),_0x641f('0x2a')];return squel[_0x641f('0x2d')]()[_0x641f('0x3d')]('cm_hopper_black')[_0x641f('0x2f')](['phone',_0x641f('0x3f'),_0x641f('0x30'),_0x39c5bb,_0x641f('0x31'),_0x641f('0x32')],squel[_0x641f('0x10')]()[_0x641f('0x34')](_0x1c6da1)['from'](_0x59e755)['join'](_0x641f('0x44'),null,'cm_contacts.ListId\x20=\x20'+_0x59e755+_0x641f('0x36'))[_0x641f('0x13')](_0x2dbef0,null,_0x2dbef0+_0x641f('0x14')+_0x59e755+'.'+_0x39c5bb)[_0x641f('0x15')](_0x59e755+_0x641f('0x37'),_0x50342d)[_0x641f('0x15')](_0x641f('0x40'),NOW)[_0x641f('0x15')](_0x641f('0x39'),squel['select']()['field'](_0x641f('0x12'))['from'](_0x641f('0x3e'))[_0x641f('0x15')](_0x641f('0x46'),_0x50342d)[_0x641f('0x15')](_0x39c5bb+_0x641f('0x16')+_0x59e755+'.'+_0x39c5bb)))[_0x641f('0x3b')]();}function insertCmHopperAdditionalPhones(_0x558155){var _0xa7dd66=[_0x641f('0x47'),'cm_contact_has_items.item',_0x641f('0x48'),'cm_contact_has_items.createdAt',_0x641f('0x49')];return squel['insert']()['into'](_0x641f('0x4a'))[_0x641f('0x2f')]([_0x641f('0x4b'),'phone','OrderBy','createdAt',_0x641f('0x32')],squel[_0x641f('0x10')]()['fields'](_0xa7dd66)[_0x641f('0x35')]('cm_hopper')[_0x641f('0x13')](_0x641f('0x44'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x641f('0x13')](_0x641f('0x4c'),null,_0x641f('0x4d'))[_0x641f('0x15')]('cm_hopper.ListId\x20=\x20?',_0x558155)['where'](_0x641f('0x40'),NOW))[_0x641f('0x3b')]();}function insertCmContact(_0x1fd6bc,_0x273ba5,_0x51caba,_0x436d8c){var _0x262fdf=_[_0x641f('0x4e')](_['keys'](_0x436d8c),[_0x641f('0x30'),_0x641f('0x4f'),_0x641f('0x31'),_0x641f('0x32')]);return squel[_0x641f('0x2d')]()[_0x641f('0x3d')](_0x641f('0x44'))[_0x641f('0x2f')](_0x262fdf,squel['select']()[_0x641f('0x34')](_0x262fdf)[_0x641f('0x35')](_0x273ba5)[_0x641f('0x15')]('('+_0x51caba['join'](',')+_0x641f('0x50'),squel[_0x641f('0x10')]()[_0x641f('0x34')](_0x51caba)[_0x641f('0x35')](_0x641f('0x44'))[_0x641f('0x15')](_0x641f('0x46'),_0x1fd6bc)[_0x641f('0x15')](_0x641f('0x51')))[_0x641f('0x15')](_0x641f('0x52'),squel[_0x641f('0x10')]()['field']('MIN(id)','min_id')[_0x641f('0x35')](_0x273ba5)[_0x641f('0x53')](_0x51caba[_0x641f('0x13')](','))))[_0x641f('0x3b')]();}function handleStop(){logger[_0x641f('0x54')](_0x641f('0x55'));stopped=!![];}function handleUncaughtException(_0x52c15a){logger[_0x641f('0x56')](_0x52c15a['message']);process[_0x641f('0x57')](0x1);}function handleError(_0x1e2d21,_0x5c9977){stats[_0x641f('0x58')][_0x641f('0x1c')]({'name':_0x5c9977[_0x641f('0x59')],'message':_0x5c9977[_0x641f('0x5a')],'row':_0x1e2d21});}function handleQuery(_0x484049){logger['info'](_0x484049);return db[_0x641f('0x5b')][_0x641f('0x5c')](_0x484049)[_0x641f('0x5d')](function(_0x35da9){results[_0x641f('0x1c')](_0x35da9);})['catch'](function(_0x44e448){logger[_0x641f('0x56')](_0x44e448['message']);});}function updateTzCampaigns(_0x5bd10a){return new Promise(function(_0x16b986,_0x147b5e){var _0x29c62b=squel[_0x641f('0x10')]()[_0x641f('0x34')]([_0x641f('0x5e'),'campaigns.dialTimezone'])['from'](_0x641f('0x5f'))[_0x641f('0x13')]('campaigns_has_cm_lists',null,_0x641f('0x60'))[_0x641f('0x15')]('campaigns_has_cm_lists.CmListId='+_0x5bd10a);db[_0x641f('0x5b')][_0x641f('0x5c')](_0x29c62b['toString']())[_0x641f('0x5d')](function(_0x3f3bca){var _0x3304af=[];for(var _0x3c0753=0x0;_0x3c0753<_0x3f3bca[_0x641f('0x1b')];_0x3c0753++){_0x3304af[_0x641f('0x1c')](getTimezoneData(_0x3f3bca[_0x3c0753],tmp_campaigns));}BPromise[_0x641f('0x1d')](_0x3304af)[_0x641f('0x1a')](function(){_0x16b986({'val':0x1});});})[_0x641f('0x61')](function(_0x43c703){logger['error'](_0x43c703[_0x641f('0x5a')]);_0x16b986({'val':0x0});});});}function updateTzVoiceQueues(_0x4bbed7){return new Promise(function(_0x9eebd7,_0x28c4c9){var _0xd446e3=squel[_0x641f('0x10')]()['fields']([_0x641f('0x62'),_0x641f('0x63')])[_0x641f('0x35')](_0x641f('0x64'))[_0x641f('0x13')](_0x641f('0x65'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x641f('0x15')]('voice_queues_has_cm_lists.CmListId='+_0x4bbed7);db[_0x641f('0x5b')][_0x641f('0x5c')](_0xd446e3['toString']())[_0x641f('0x5d')](function(_0x3fcd74){var _0x2198c6=[];for(var _0x2fd0d0=0x0;_0x2fd0d0<_0x3fcd74[_0x641f('0x1b')];_0x2fd0d0++){_0x2198c6[_0x641f('0x1c')](getTimezoneData(_0x3fcd74[_0x2fd0d0],tmp_voice_queues));}BPromise[_0x641f('0x1d')](_0x2198c6)[_0x641f('0x1a')](function(){_0x9eebd7({'val':0x1});});})[_0x641f('0x61')](function(_0x2260c6){logger[_0x641f('0x56')](_0x2260c6[_0x641f('0x5a')]);_0x9eebd7({'val':0x0});});});}function getTimezoneData(_0x428cb7,_0x2b1067){return new Promise(function(_0x5f5a4f,_0x22a99d){var _0x3801de=shared['timezones'];var _0x51aa80=_0x3801de[_0x428cb7[_0x641f('0x66')]];if(_['isNil'](_0x51aa80)){_0x5f5a4f({'ret':0x1});}else{var _0x4eac2b=_0x51aa80[_0x641f('0x67')];var _0x2b2db6=squel[_0x641f('0x2d')]()[_0x641f('0x3d')](_0x2b1067)[_0x641f('0x68')]('id',_0x428cb7['id'])[_0x641f('0x68')](_0x641f('0x69'),_0x4eac2b)[_0x641f('0x68')](_0x641f('0x66'),_0x428cb7[_0x641f('0x66')])[_0x641f('0x3b')]();return db[_0x641f('0x5b')][_0x641f('0x5c')](_0x2b2db6)[_0x641f('0x5d')](function(_0x2e3770){_0x5f5a4f({'ret':0x1});})[_0x641f('0x61')](function(_0x7dc04f){logger['error'](_0x7dc04f[_0x641f('0x5a')]);_0x22a99d({'ret':0x1});});}});}function handleTZQuery(_0x31d87c){logger[_0x641f('0x54')](_0x31d87c);return db[_0x641f('0x5b')]['query'](_0x31d87c)[_0x641f('0x5d')](function(_0x41d4f5){})[_0x641f('0x61')](function(_0x3cd0a9){logger[_0x641f('0x56')](_0x3cd0a9['message']);});}function main(_0x3fd836,_0x164f77,_0x4f937a,_0x1c4da3){logger[_0x641f('0x54')]('main',_0x3fd836,JSON[_0x641f('0x6a')](_0x164f77));process['send'](_0x641f('0x6b'));var _0xbd9059=_0x164f77[_0x641f('0x6c')];var _0x2917dd=_[_0x641f('0x6d')](_0xbd9059);var _0x338d9b=_0x164f77[_0x641f('0x6e')];var _0x364024=path[_0x641f('0x13')](config['root'],'server/files/tmp',_0x338d9b+_0x641f('0x6f'));hasTZ=_[_0x641f('0x70')](_0xbd9059)['includes']('dialTimezone');var _0x1f5f87=_[_0x641f('0x70')](_0xbd9059)['join']();logger['info']('header',_0x1f5f87);db[_0x641f('0x71')][_0x641f('0x19')]({'raw':!![],'attributes':['id','name']})[_0x641f('0x1a')](function(_0x5266c2){for(var _0x4f1dc1=0x0;_0x4f1dc1<_0x5266c2[_0x641f('0x1b')];_0x4f1dc1++){if(_0x5266c2[_0x4f1dc1][_0x641f('0x72')]in _0xbd9059){contactItemTypes[_0x641f('0x1c')](_0x5266c2[_0x4f1dc1]);delete _0x2917dd[_0x5266c2[_0x4f1dc1][_0x641f('0x72')]];hasAdditionalPhones=!![];}for(var _0x563837 in _0xbd9059){if(_0x5266c2[_0x4f1dc1][_0x641f('0x72')]+'_description'===_0x563837){phoneDescriptions[_0x641f('0x1c')]({'itemTypeId':_0x5266c2[_0x4f1dc1]['id'],'description':_0x563837});delete _0x2917dd[_0x563837];}}}if(hasAdditionalPhones)_0x2917dd['AdditionalPhones']='';var _0xe5320f=_['keys'](_0x2917dd)[_0x641f('0x13')]();logger[_0x641f('0x54')](_0x641f('0x73'),_0xe5320f);fs[_0x641f('0x74')](_0x364024,_0xe5320f+'\x0a');Papa[_0x641f('0x75')](fs['createReadStream'](_0x3fd836),{'header':!![],'skipEmptyLines':!![],'step':function(_0x165264,_0x6d0993){try{for(var _0x154899=0x0,_0x722e85=[];_0x154899<_0x165264[_0x641f('0x76')][_0x641f('0x1b')];_0x154899++){stats[_0x641f('0x77')]+=0x1;if(_0x165264[_0x641f('0x58')][_0x154899]){handleError(_0x165264[_0x641f('0x76')][_0x154899],_0x165264['errors'][_0x154899]);}else{var _0x4261a7=[];var _0x37013f=[];var _0x4d16fe={};for(var _0x40e120 in _0xbd9059){let _0x100bb0=contactItemTypes[_0x641f('0x78')](_0x3185f8=>_0x3185f8[_0x641f('0x72')]===_0x40e120);let _0x5eb865=contactItemTypes[_0x641f('0x78')](_0x49bf35=>_0x49bf35[_0x641f('0x72')]+_0x641f('0x79')===_0x40e120);if(_[_0x641f('0x7a')](_0x100bb0)&&_[_0x641f('0x7a')](_0x5eb865)){if(_0xbd9059[_0x641f('0x7b')](_0x40e120)){if(_0x165264['data'][_0x154899][_0xbd9059[_0x40e120]]){var _0x525c7c=_[_0x641f('0x7c')](_0x165264['data'][_0x154899][_0xbd9059[_0x40e120]][_0x641f('0x7d')](/"/g,'\x27'));switch(_0x40e120){case _0x641f('0x41'):var _0x4c7522=moment(_0x525c7c,_0x641f('0xe'),!![]);if(_0x4c7522[_0x641f('0x7e')]()){_0x722e85[_0x641f('0x1c')]('\x22'+_0x525c7c+'\x22');}else{_0x4261a7['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x134730=parseInt(_0x525c7c);_0x525c7c=_[_0x641f('0x7f')](_0x134730)||_0x134730<0x0||_0x134730>0x4?_0x1c4da3?0x3:0x2:_0x134730;_0x722e85[_0x641f('0x1c')]('\x22'+_0x525c7c+'\x22');break;case _0x641f('0x43'):var _0x122f44=parseInt(_0x525c7c);if(_[_0x641f('0x80')](_0x122f44)&&_[_0x641f('0x81')](_0x4f937a,_0x122f44)){_0x722e85['push']('\x22'+_0x122f44+'\x22');}else{_0x4261a7[_0x641f('0x1c')](_0x641f('0x82'));}break;case _0x641f('0x83'):if(isEmail(_0x525c7c)){_0x722e85[_0x641f('0x1c')]('\x22'+_0x525c7c+'\x22');}else{_0x4261a7[_0x641f('0x1c')](_0x641f('0x84'));}break;case _0x641f('0x85'):var _0x59a6cb=moment(_0x525c7c,'YYYY-MM-DD',!![]);if(_0x59a6cb[_0x641f('0x7e')]()){_0x722e85[_0x641f('0x1c')]('\x22'+_0x525c7c+'\x22');}else{_0x4261a7['push'](_0x641f('0x86'));}break;case'dialTimezone':var _0x36f565=shared[_0x641f('0x87')];var _0x57af7e=_0x36f565[_0x525c7c];if(!_[_0x641f('0x7a')](_0x57af7e)){var _0x37184d=_0x57af7e[_0x641f('0x67')];_0x722e85['push']('\x22'+_0x525c7c+'\x22');_0x722e85[_0x641f('0x1c')]('\x22'+_0x37184d+'\x22');}break;default:_0x722e85[_0x641f('0x1c')]('\x22'+_0x525c7c+'\x22');}}else{switch(_0x40e120){case _0x641f('0x88'):case _0x641f('0x12'):_0x4261a7['push'](_0x40e120+_0x641f('0x89'));break;default:_0x722e85['push']('\x22\x22');}}}}else{var _0x51766b='';if(!_[_0x641f('0x7a')](_0x100bb0)){if(!_0x4d16fe[_0x641f('0x7b')](_0x100bb0['id'])){if(!_[_0x641f('0x7a')](_0x165264[_0x641f('0x76')][_0x154899][_0xbd9059[_0x40e120]])){var _0x525c7c=_['trim'](_0x165264[_0x641f('0x76')][_0x154899][_0xbd9059[_0x40e120]][_0x641f('0x7d')](/"/g,'\x27'));var _0x3c863e=phoneDescriptions[_0x641f('0x78')](_0x37fc5c=>_0x37fc5c[_0x641f('0x8a')]===_0x100bb0['id']);if(!_[_0x641f('0x7a')](_0x3c863e)){var _0x25cda5=_['trim'](_0x165264['data'][_0x154899][_0xbd9059[_0x3c863e[_0x641f('0x8b')]]][_0x641f('0x7d')](/"/g,'\x27'));if(!_[_0x641f('0x7a')](_0x25cda5))_0x525c7c=_0x525c7c+'§'+_0x25cda5;}if(_0x51766b=='')_0x51766b=_0x525c7c;else _0x51766b+='|'+_0x525c7c;}_0x37013f['push'](_0x100bb0['id']+':'+_0x51766b);_0x4d16fe[_0x100bb0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x722e85['push']('\x22'+_0x37013f[_0x641f('0x13')](';')+'\x22');}if(_0x4261a7[_0x641f('0x1b')]){handleError(_0x165264[_0x641f('0x76')][_0x154899],{'code':_0x641f('0x8c'),'message':_0x4261a7[_0x641f('0x13')]()});}else{fs[_0x641f('0x8d')](_0x364024,_0x722e85[_0x641f('0x13')]()+'\x0a');}_0x722e85=[];}if(!(stats['rows']%0xc8)){socket[_0x641f('0x8e')](_0x641f('0x8f')+_0x338d9b,stats);stats[_0x641f('0x58')]=[];}}if(stopped){logger[_0x641f('0x54')]('Abort\x20parser');_0x6d0993[_0x641f('0x90')]();}}catch(_0x372e5b){handleError(_0x165264[_0x641f('0x76')][_0x154899],{'code':_0x641f('0x91'),'message':_0x372e5b[_0x641f('0x5a')]});logger[_0x641f('0x56')]('step',_0x372e5b[_0x641f('0x5a')]);}},'complete':function(){try{var _0x20974d=[];var _0x7189ea=[];var _0x14a5ff='cm_contacts';if(_0x164f77[_0x641f('0x92')]&&_0x164f77['duplicates'][_0x641f('0x1b')]){_0x14a5ff=_0x641f('0x93')+_0x338d9b;_0x20974d['push'](_0x641f('0x94')+_0x14a5ff+_0x641f('0x95'));}tmp_campaigns=_0x641f('0x96')+_0x338d9b;tmp_voice_queues=_0x641f('0x97')+_0x338d9b;_0x7189ea[_0x641f('0x1c')](_0x641f('0x94')+tmp_campaigns+_0x641f('0x98'));_0x7189ea[_0x641f('0x1c')](_0x641f('0x94')+tmp_voice_queues+_0x641f('0x98'));BPromise[_0x641f('0x99')](_0x7189ea,handleTZQuery)[_0x641f('0x1a')](function(_0x2fb879){updateTzCampaigns(_0x164f77[_0x641f('0x30')])[_0x641f('0x1a')](function(_0x450f07){updateTzVoiceQueues(_0x164f77[_0x641f('0x30')])[_0x641f('0x1a')](function(_0x36a417){if(hasTZ)_0xe5320f=_0xe5320f[_0x641f('0x7d')]('dialTimezone','dialTimezone,utcOffset');var _0x4a35ed=util[_0x641f('0xd')](_0x641f('0x9a'),_0x364024,_0x14a5ff,_0xe5320f,_0x164f77[_0x641f('0x30')],_0x164f77[_0x641f('0x4f')]||null,NOW,NOW);if(_[_0x641f('0x7a')](_0xbd9059[_0x641f('0x41')])){_0x4a35ed+=_0x641f('0x9b');}_0x20974d[_0x641f('0x1c')](_0x4a35ed);if(_0x164f77[_0x641f('0x92')]&&_0x164f77[_0x641f('0x92')][_0x641f('0x1b')]){_0x20974d[_0x641f('0x1c')](insertCmContact(_0x164f77[_0x641f('0x30')],_0x14a5ff,_0x164f77[_0x641f('0x92')],_0xbd9059));_0x20974d['push'](_0x641f('0x9c')+_0x14a5ff+';');}BPromise[_0x641f('0x99')](_0x20974d,handleQuery)[_0x641f('0x1a')](function(_0x15e2fc){BPromise[_0x641f('0x1d')]([handleAdditionalPhones()])[_0x641f('0x1a')](function(){_0x20974d=[];for(var _0x183e86=0x0;_0x183e86_0x1e02b7[_0x18ce('0x75')]===_0x2935fb);let _0x12a58d=contactItemTypes['find'](_0x30ef00=>_0x30ef00[_0x18ce('0x75')]+'_description'===_0x2935fb);if(_['isNil'](_0xff6707)&&_[_0x18ce('0x68')](_0x12a58d)){if(_0x4c24ad['hasOwnProperty'](_0x2935fb)){if(_0x560cf3[_0x18ce('0x7b')][_0xd4ed7a][_0x4c24ad[_0x2935fb]]){var _0x1a506d=_[_0x18ce('0x7c')](_0x560cf3[_0x18ce('0x7b')][_0xd4ed7a][_0x4c24ad[_0x2935fb]][_0x18ce('0x7d')](/"/g,'\x27'));switch(_0x2935fb){case _0x18ce('0x2f'):var _0x457f49=moment(_0x1a506d,_0x18ce('0x10'),!![]);if(_0x457f49[_0x18ce('0x7e')]()){_0x53bd8e[_0x18ce('0x1c')]('\x22'+_0x1a506d+'\x22');}else{_0x29995c[_0x18ce('0x1c')](_0x18ce('0x7f'));}break;case'priority':var _0xa4f810=parseInt(_0x1a506d);_0x1a506d=_[_0x18ce('0x80')](_0xa4f810)||_0xa4f810<0x0||_0xa4f810>0x4?_0x1ae9c7?0x3:0x2:_0xa4f810;_0x53bd8e['push']('\x22'+_0x1a506d+'\x22');break;case _0x18ce('0x33'):var _0x57a804=parseInt(_0x1a506d);if(_['isNumber'](_0x57a804)&&_[_0x18ce('0x72')](_0x43ced1,_0x57a804)){_0x53bd8e[_0x18ce('0x1c')]('\x22'+_0x57a804+'\x22');}else{_0x29995c[_0x18ce('0x1c')]('agent\x20not\x20exists');}break;case _0x18ce('0x81'):if(isEmail(_0x1a506d)){_0x53bd8e[_0x18ce('0x1c')]('\x22'+_0x1a506d+'\x22');}else{_0x29995c[_0x18ce('0x1c')](_0x18ce('0x82'));}break;case'dateOfBirth':var _0x15df65=moment(_0x1a506d,_0x18ce('0x83'),!![]);if(_0x15df65[_0x18ce('0x7e')]()){_0x53bd8e[_0x18ce('0x1c')]('\x22'+_0x1a506d+'\x22');}else{_0x29995c['push'](_0x18ce('0x84'));}break;case _0x18ce('0x6c'):var _0x18a437=shared[_0x18ce('0x67')];var _0x2d842d=_0x18a437[_0x1a506d];if(!_[_0x18ce('0x68')](_0x2d842d)){var _0x1b68c8=_0x2d842d['utcOffset'];_0x53bd8e[_0x18ce('0x1c')]('\x22'+_0x1a506d+'\x22');_0x53bd8e[_0x18ce('0x1c')]('\x22'+_0x1b68c8+'\x22');}break;default:_0x53bd8e['push']('\x22'+_0x1a506d+'\x22');}}else{switch(_0x2935fb){case'firstName':case _0x18ce('0x13'):_0x29995c[_0x18ce('0x1c')](_0x2935fb+_0x18ce('0x85'));break;default:_0x53bd8e[_0x18ce('0x1c')]('\x22\x22');}}}}else{var _0x502e88='';if(!_[_0x18ce('0x68')](_0xff6707)){if(!_0x559911[_0x18ce('0x86')](_0xff6707['id'])){if(!_[_0x18ce('0x68')](_0x560cf3[_0x18ce('0x7b')][_0xd4ed7a][_0x4c24ad[_0x2935fb]])){var _0x1a506d=_['trim'](_0x560cf3[_0x18ce('0x7b')][_0xd4ed7a][_0x4c24ad[_0x2935fb]][_0x18ce('0x7d')](/"/g,'\x27'));var _0x4919f2=phoneDescriptions['find'](_0x21fa1f=>_0x21fa1f[_0x18ce('0x87')]===_0xff6707['id']);if(!_[_0x18ce('0x68')](_0x4919f2)){var _0x186960=_[_0x18ce('0x7c')](_0x560cf3[_0x18ce('0x7b')][_0xd4ed7a][_0x4c24ad[_0x4919f2[_0x18ce('0x88')]]]['replace'](/"/g,'\x27'));if(!_[_0x18ce('0x68')](_0x186960))_0x1a506d=_0x1a506d+'§'+_0x186960;}if(_0x502e88=='')_0x502e88=_0x1a506d;else _0x502e88+='|'+_0x1a506d;}_0x298222[_0x18ce('0x1c')](_0xff6707['id']+':'+_0x502e88);_0x559911[_0xff6707['id']]=0x1;}}}}if(hasAdditionalPhones){_0x53bd8e['push']('\x22'+_0x298222[_0x18ce('0x15')](';')+'\x22');}if(_0x29995c[_0x18ce('0x1f')]){handleError(_0x560cf3[_0x18ce('0x7b')][_0xd4ed7a],{'code':'SystemRow','message':_0x29995c[_0x18ce('0x15')]()});}else{fs[_0x18ce('0x89')](_0x215c8a,_0x53bd8e[_0x18ce('0x15')]()+'\x0a');}_0x53bd8e=[];}if(!(stats[_0x18ce('0x8a')]%0xc8)){socket[_0x18ce('0x8b')](_0x18ce('0x8c')+_0x1e724c,stats);stats[_0x18ce('0x5a')]=[];}}if(stopped){logger[_0x18ce('0x55')]('Abort\x20parser');_0x5aee60[_0x18ce('0x8d')]();}}catch(_0x519642){handleError(_0x560cf3[_0x18ce('0x7b')][_0xd4ed7a],{'code':_0x18ce('0x8e'),'message':_0x519642['message']});logger['error']('step',_0x519642[_0x18ce('0x58')]);}},'complete':function(){try{var _0x26e580=[];var _0x2a11a2=[];var _0x3deb74=_0x18ce('0x35');if(_0x4254a8[_0x18ce('0x8f')]&&_0x4254a8[_0x18ce('0x8f')][_0x18ce('0x1f')]){_0x3deb74=_0x18ce('0x90')+_0x1e724c;_0x26e580[_0x18ce('0x1c')]('CREATE\x20TABLE\x20'+_0x3deb74+_0x18ce('0x91'));}tmp_campaigns=_0x18ce('0x92')+_0x1e724c;tmp_voice_queues=_0x18ce('0x93')+_0x1e724c;_0x2a11a2[_0x18ce('0x1c')](_0x18ce('0x94')+tmp_campaigns+_0x18ce('0x95'));_0x2a11a2[_0x18ce('0x1c')](_0x18ce('0x94')+tmp_voice_queues+_0x18ce('0x95'));BPromise[_0x18ce('0x96')](_0x2a11a2,handleTZQuery)[_0x18ce('0x1b')](function(_0x1c2780){updateTzCampaigns(_0x4254a8['ListId'])['then'](function(_0x5df6f0){updateTzVoiceQueues(_0x4254a8[_0x18ce('0x31')])[_0x18ce('0x1b')](function(_0x4e320d){if(hasTZ)_0x5b9c82=_0x5b9c82['replace'](_0x18ce('0x6c'),_0x18ce('0x97'));var _0x1949a8=util[_0x18ce('0xf')]('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',_0x215c8a,_0x3deb74,_0x5b9c82,_0x4254a8[_0x18ce('0x31')],_0x4254a8['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x4c24ad[_0x18ce('0x2f')])){_0x1949a8+=_0x18ce('0x98');}_0x26e580[_0x18ce('0x1c')](_0x1949a8);if(_0x4254a8[_0x18ce('0x8f')]&&_0x4254a8[_0x18ce('0x8f')][_0x18ce('0x1f')]){_0x26e580['push'](insertCmContact(_0x4254a8[_0x18ce('0x31')],_0x3deb74,_0x4254a8[_0x18ce('0x8f')],_0x4c24ad));_0x26e580[_0x18ce('0x1c')]('DROP\x20TABLE\x20'+_0x3deb74+';');}BPromise[_0x18ce('0x96')](_0x26e580,handleQuery)[_0x18ce('0x1b')](function(_0x459d5a){BPromise[_0x18ce('0x1d')]([handleAdditionalPhones()])[_0x18ce('0x1b')](function(){_0x26e580=[];for(var _0x2994b5=0x0;_0x2994b5\x20\x20');}var _0x410f99=path[_0x18ce('0x15')](config[_0x18ce('0xa6')],_0x18ce('0x70'),process[_0x18ce('0xa5')][0x2]);if(!fs['existsSync'](_0x410f99)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x9b8609={};try{_0x9b8609=JSON['parse'](process[_0x18ce('0xa5')][0x3]);if(!_0x9b8609[_0x18ce('0xa7')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x9b8609[_0x18ce('0xa7')][_0x18ce('0x13')]){throw new Error(_0x18ce('0xa8'));}if(!_0x9b8609[_0x18ce('0xa7')][_0x18ce('0xa9')]){throw new Error(_0x18ce('0xaa'));}var _0x106d2f=0x0;if(_0x9b8609[_0x18ce('0xa7')][_0x18ce('0x33')]){_0x106d2f=0x1;}if(!_0x9b8609[_0x18ce('0x31')]){throw new Error(_0x18ce('0xab'));}}catch(_0x30c834){throw new Error(_0x18ce('0xac'));}var _0x375870=[];try{_0x375870=_[_0x18ce('0xad')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x162624){logger['info'](_0x18ce('0xae'));}main(_0x410f99,_0x9b8609,_0x375870,_0x106d2f);}validate();process['on']('SIGINT',handleStop);process['on'](_0x18ce('0xaf'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index be6ce05..b3e85c6 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68a5=['cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.createdAt','cm_hopper_black','updatedAt','.CmListId\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','Received\x20SIGINT','exit','errors','code','info','main','stringify','send','start','binding','clone','socket_timestamp','root','body','name','header','writeFileSync','parse','data','find','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','itemTypeId','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','CIS\x20len','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','AdditionalPhones','push','all','catch','error','message','isNil','split','filter','CmContactHasItem','findOne','then','update','updated','create','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?'];(function(_0x560d6c,_0x5cda64){var _0x2672eb=function(_0x349fe4){while(--_0x349fe4){_0x560d6c['push'](_0x560d6c['shift']());}};_0x2672eb(++_0x5cda64);}(_0x68a5,0xfc));var _0x568a=function(_0x28ed97,_0x495a6d){_0x28ed97=_0x28ed97-0x0;var _0x2b247f=_0x68a5[_0x28ed97];return _0x2b247f;};'use strict';var fs=require('fs');var path=require(_0x568a('0x0'));var _=require('lodash');var Papa=require(_0x568a('0x1'));var util=require(_0x568a('0x2'));var BPromise=require('bluebird');var moment=require(_0x568a('0x3'));var squel=require(_0x568a('0x4'));var Redis=require(_0x568a('0x5'));var db=require(_0x568a('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x568a('0x7'))('import');config[_0x568a('0x8')]=_[_0x568a('0x9')](config[_0x568a('0x8')],{'host':_0x568a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x568a('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x568a('0xb'));var tempTableName=_0x568a('0xc')+moment()[_0x568a('0xd')](_0x568a('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x51f43e){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'](_0x51f43e);}function selectNotIn(_0x3cbe63,_0x3011b9,_0x50e6f0,_0x218026,_0x48590b){return squel[_0x568a('0xf')]()[_0x568a('0x10')](_0x568a('0x11'))[_0x568a('0x12')](_0x218026)[_0x568a('0x13')](_0x3011b9,null,_0x3011b9+_0x568a('0x14')+_0x218026+'.'+_0x50e6f0)[_0x568a('0x15')](_0x218026+'.'+_0x50e6f0+_0x568a('0x16')+_0x3cbe63+'.'+_0x50e6f0)[_0x568a('0x15')](_0x3011b9+_0x568a('0x17')+_0x48590b[_0x568a('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3be5fe,_0x148634){promisesAdditionalPhones=[];promisesContact=[];return db[_0x568a('0x18')][_0x568a('0x19')](_0x568a('0x1a')+tempTableName)[_0x568a('0x1b')](function(_0x4e6f9a){if(_0x4e6f9a!==null){var _0x323bf3=[];for(var _0x573b17=0x0;_0x573b17<_0x4e6f9a[_0x568a('0x1c')];_0x573b17++){var _0x28875e=_0x4e6f9a[_0x573b17];if(!_['isNil'](_0x28875e[_0x568a('0x11')])){if(!_['isNil'](_0x28875e[_0x568a('0x1d')]))_0x323bf3[_0x568a('0x1e')](insertAdditionalPhones(_0x28875e));promisesContact[_0x568a('0x1e')]({'contact':_0x28875e});}}}Promise[_0x568a('0x1f')](_0x323bf3)['then'](function(){_0x3be5fe({'val':0x1});});})[_0x568a('0x20')](function(_0x4fd8e8){logger[_0x568a('0x21')](_0x4fd8e8[_0x568a('0x22')]);});});}function insertAdditionalPhones(_0x15fb1b){return new Promise(function(_0x3b9968,_0x252bb8){var _0x237b74=_0x15fb1b[_0x568a('0x1d')];if(_[_0x568a('0x23')](_0x237b74))_0x252bb8({'val':0x0});else{var _0x4d1172=_0x237b74[_0x568a('0x24')](';');var _0x1f12b5=[];orderBy=0x0;for(var _0x5f5dd1=0x0;_0x5f5dd1<_0x4d1172[_0x568a('0x1c')];_0x5f5dd1++){_0x1f12b5[_0x568a('0x1e')](splitAdditionalPhone(_0x15fb1b['id'],_0x4d1172[_0x5f5dd1]));}Promise[_0x568a('0x1f')](_0x1f12b5)['then'](function(){_0x3b9968({'val':_0x4d1172[_0x568a('0x1c')]});});}});}function splitAdditionalPhone(_0x378f0e,_0x1d5329){return new Promise(function(_0x1df7ab,_0xdb83a1){var _0x401109=_0x1d5329[_0x568a('0x24')](':');var _0x38e03a=_0x401109[0x0];var _0x2df7d6=_0x401109[0x1];if(_0x2df7d6!==''){var _0x5721a5=_0x2df7d6[_0x568a('0x24')]('|');var _0x63decd=[];for(var _0x3e7b42=0x0;_0x3e7b42<_0x5721a5[_0x568a('0x1c')];_0x3e7b42++){if(_0x5721a5[_0x3e7b42]!==''){var _0x45f7e8=_[_0x568a('0x25')](promisesAdditionalPhones,{'contactId':_0x378f0e,'phone':_0x5721a5[_0x3e7b42]});if(_0x45f7e8['length']==0x0){orderBy++;promisesAdditionalPhones[_0x568a('0x1e')]({'contactId':_0x378f0e,'contactTypeId':_0x38e03a,'phone':_0x5721a5[_0x3e7b42],'orderBy':orderBy});}}}_0x1df7ab({'ok':0x1});}else _0x1df7ab({'res':0x0});});}function createAdditionalPhone(_0x3d14ab,_0x1575d6,_0x23d444,_0x20498b){var _0x5911f4='';var _0x460b31='';var _0x17a99d=_0x23d444[_0x568a('0x24')]('§');_0x5911f4=_0x17a99d[0x0];if(_0x17a99d[_0x568a('0x1c')]==0x2)_0x460b31=_0x17a99d[0x1];return new Promise(function(_0x117e0c,_0x153e1a){return db[_0x568a('0x26')][_0x568a('0x27')]({'where':{'CmContactId':_0x3d14ab,'item':_0x5911f4}})[_0x568a('0x28')](function(_0x464d34){if(_0x464d34){return db['CmContactHasItem'][_0x568a('0x29')]({'ItemTypeId':_0x1575d6,'description':_0x460b31,'OrderBy':_0x20498b},{'where':{'CmContactId':_0x3d14ab,'item':_0x5911f4}})[_0x568a('0x28')](function(_0x43842e){_0x117e0c({'res':_0x568a('0x2a')});});}else{return db[_0x568a('0x26')][_0x568a('0x2b')]({'CmContactId':_0x3d14ab,'item':_0x5911f4,'ItemTypeId':_0x1575d6,'description':_0x460b31,'OrderBy':_0x20498b,'ItemClass':'PHONE'})['then'](function(_0x4d028b){_0x117e0c({'res':_0x568a('0x2c')});});}});});}function updateContact(_0x153792){return new Promise(function(_0x143dcd,_0xd55530){var _0x2febce=_0x153792['id'];delete _0x153792['id'];return db['CmContact']['update'](_0x153792,{'where':{'id':_0x2febce}})[_0x568a('0x28')](function(_0x370dc5){updatedRows+=0x1;return db[_0x568a('0x2d')][_0x568a('0x29')]({'phone':_0x153792[_0x568a('0x11')]},{'where':{'ContactId':_0x2febce}})['then'](function(_0x26d043){_0x143dcd({'ret':'OK'});});});});}function insertCmHopper(_0x57c0e6,_0x37a59d,_0x40ed0,_0x4d16ee,_0xff4d14){var _0x4fe52f=[_0x568a('0x2e'),_0x568a('0x2f'),_0x568a('0x30'),'cm_contacts.ListId',_0x37a59d+'.'+_0x4d16ee,'cm_contacts.createdAt',_0x568a('0x31'),_0x568a('0x32'),_0x568a('0x33'),'\x22'+_0xff4d14+'\x22'];return squel[_0x568a('0x34')]()[_0x568a('0x35')](_0x568a('0x36'))[_0x568a('0x37')](['phone','scheduledat',_0x568a('0x38'),_0x568a('0x39'),_0x4d16ee,_0x568a('0x3a'),'updatedAt','priority',_0x568a('0x3b'),_0x568a('0x3c')],squel['select']()[_0x568a('0x3d')](_0x4fe52f)[_0x568a('0x12')](_0x37a59d)['join'](_0x568a('0x3e'),null,_0x568a('0x3f')+_0x37a59d+_0x568a('0x40'))[_0x568a('0x13')](_0x40ed0,null,_0x40ed0+_0x568a('0x14')+_0x37a59d+'.'+_0x4d16ee)[_0x568a('0x15')](_0x37a59d+'.CmListId\x20=\x20?',_0x57c0e6)['where'](_0x568a('0x41'),NOW)[_0x568a('0x15')](_0x568a('0x42'),selectNotIn(_0x37a59d,_0x40ed0,_0x4d16ee,_0x568a('0x36'),[_0x568a('0x43'),_0x568a('0x44')]))[_0x568a('0x15')](_0x568a('0x42'),selectNotIn(_0x37a59d,_0x40ed0,_0x4d16ee,'cm_hopper',[_0x568a('0x43')])))[_0x568a('0x45')]();}function insertCmHopperBlack(_0x3ed93a,_0x8e4926,_0x47767f,_0x5adee0){var _0x31cdc0=['cm_contacts.phone',_0x568a('0x30'),_0x568a('0x46'),_0x8e4926+'.'+_0x5adee0,_0x568a('0x47'),_0x568a('0x31')];return squel[_0x568a('0x34')]()[_0x568a('0x35')](_0x568a('0x48'))['fromQuery']([_0x568a('0x11'),_0x568a('0x38'),_0x568a('0x39'),_0x5adee0,'createdAt',_0x568a('0x49')],squel['select']()['fields'](_0x31cdc0)[_0x568a('0x12')](_0x8e4926)['join'](_0x568a('0x3e'),null,_0x568a('0x3f')+_0x8e4926+'.CmListId')[_0x568a('0x13')](_0x47767f,null,_0x47767f+_0x568a('0x14')+_0x8e4926+'.'+_0x5adee0)[_0x568a('0x15')](_0x8e4926+_0x568a('0x4a'),_0x3ed93a)[_0x568a('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x568a('0x15')](_0x568a('0x42'),squel['select']()[_0x568a('0x10')](_0x568a('0x11'))[_0x568a('0x12')](_0x568a('0x48'))[_0x568a('0x15')](_0x568a('0x4b'),_0x3ed93a)[_0x568a('0x15')](_0x5adee0+'\x20=\x20?',_0x8e4926+'.'+_0x5adee0)))[_0x568a('0x45')]();}function insertCmHopperAdditionalPhones(_0x6404ec){var _0x4ef7fe=[_0x568a('0x4c'),_0x568a('0x4d'),'cm_contact_has_items.OrderBy',_0x568a('0x4e'),'cm_contact_has_items.updatedAt'];return squel[_0x568a('0x34')]()[_0x568a('0x35')](_0x568a('0x4f'))[_0x568a('0x37')]([_0x568a('0x50'),'phone',_0x568a('0x51'),_0x568a('0x3a'),'updatedAt'],squel[_0x568a('0xf')]()[_0x568a('0x3d')](_0x4ef7fe)[_0x568a('0x12')](_0x568a('0x36'))['join'](_0x568a('0x3e'),null,_0x568a('0x52'))[_0x568a('0x13')](_0x568a('0x53'),null,_0x568a('0x54'))[_0x568a('0x15')](_0x568a('0x55'),_0x6404ec)[_0x568a('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x568a('0x45')]();}function insertCmContact(_0x1a153b,_0x8f12a5,_0x46496d,_0xc35d16){var _0x59f2da=_[_0x568a('0x56')](_[_0x568a('0x57')](_0xc35d16),[_0x568a('0x39'),_0x568a('0x58'),_0x568a('0x3a'),_0x568a('0x49')]);return squel['insert']()[_0x568a('0x35')](_0x568a('0x3e'))[_0x568a('0x37')](_0x59f2da,squel[_0x568a('0xf')]()[_0x568a('0x3d')](_0x59f2da)[_0x568a('0x12')](_0x8f12a5)[_0x568a('0x15')]('('+_0x46496d[_0x568a('0x13')](',')+_0x568a('0x59'),squel[_0x568a('0xf')]()[_0x568a('0x3d')](_0x46496d)[_0x568a('0x12')](_0x568a('0x3e'))[_0x568a('0x15')](_0x568a('0x4b'),_0x1a153b))[_0x568a('0x15')](_0x568a('0x5a'),squel['select']()[_0x568a('0x10')]('MIN(id)',_0x568a('0x5b'))['from'](_0x8f12a5)['group'](_0x46496d[_0x568a('0x13')](','))))['toString']();}function handleStop(){logger['info'](_0x568a('0x5c'));stopped=!![];}function handleUncaughtException(_0x4c0860){logger[_0x568a('0x21')](_0x4c0860[_0x568a('0x22')]);process[_0x568a('0x5d')](0x1);}function handleError(_0x4699d0,_0x5f30e8){stats[_0x568a('0x5e')][_0x568a('0x1e')]({'name':_0x5f30e8[_0x568a('0x5f')],'message':_0x5f30e8[_0x568a('0x22')],'row':_0x4699d0});}function handleQuery(_0x48a791){logger[_0x568a('0x60')](_0x48a791);return db[_0x568a('0x18')][_0x568a('0x19')](_0x48a791)['spread'](function(_0x5eee74){results[_0x568a('0x1e')](_0x5eee74);})[_0x568a('0x20')](function(_0x4459cd){logger['error'](_0x4459cd['message']);});}function main(_0x350e2d,_0x482e1f,_0x2a0bd1,_0x318bc0){logger['info'](_0x568a('0x61'),_0x350e2d,JSON[_0x568a('0x62')](_0x482e1f));process[_0x568a('0x63')](_0x568a('0x64'));var _0x3bf347=_0x482e1f[_0x568a('0x65')];var _0x8f26e8=_[_0x568a('0x66')](_0x3bf347);var _0x43a6ae=_0x482e1f[_0x568a('0x67')];var _0x292c6b=path['join'](config[_0x568a('0x68')],'server/files/tmp',_0x43a6ae+'.csv');logger[_0x568a('0x60')](_0x568a('0x69'),_0x482e1f);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x568a('0x6a')]})['then'](function(_0x5550d4){for(var _0x45531b=0x0;_0x45531b<_0x5550d4[_0x568a('0x1c')];_0x45531b++){if(_0x5550d4[_0x45531b][_0x568a('0x6a')]in _0x3bf347){contactItemTypes[_0x568a('0x1e')](_0x5550d4[_0x45531b]);delete _0x8f26e8[_0x5550d4[_0x45531b][_0x568a('0x6a')]];hasAdditionalPhones=!![];}for(var _0x4cd948 in _0x3bf347){if(_0x5550d4[_0x45531b][_0x568a('0x6a')]+'_description'===_0x4cd948){phoneDescriptions[_0x568a('0x1e')]({'itemTypeId':_0x5550d4[_0x45531b]['id'],'description':_0x4cd948});delete _0x8f26e8[_0x4cd948];}}}if(hasAdditionalPhones)_0x8f26e8['AdditionalPhones']='';var _0x46770a=_[_0x568a('0x57')](_0x8f26e8)['join']();logger[_0x568a('0x60')](_0x568a('0x6b'),_0x46770a);fs[_0x568a('0x6c')](_0x292c6b,_0x46770a+'\x0a');Papa[_0x568a('0x6d')](fs['createReadStream'](_0x350e2d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x17c09c,_0x205425){try{for(var _0x4340e4=0x0,_0x183597=[];_0x4340e4<_0x17c09c[_0x568a('0x6e')][_0x568a('0x1c')];_0x4340e4++){stats['rows']+=0x1;if(_0x17c09c['errors'][_0x4340e4]){handleError(_0x17c09c['data'][_0x4340e4],_0x17c09c[_0x568a('0x5e')][_0x4340e4]);}else{var _0x972ab1=[];var _0x331faa=[];var _0x36ca99={};for(var _0x3c4b2d in _0x3bf347){let _0x5f6674=contactItemTypes[_0x568a('0x6f')](_0x3539a1=>_0x3539a1[_0x568a('0x6a')]===_0x3c4b2d);let _0x2204f9=contactItemTypes[_0x568a('0x6f')](_0x326e43=>_0x326e43[_0x568a('0x6a')]+'_description'===_0x3c4b2d);if(_[_0x568a('0x23')](_0x5f6674)&&_[_0x568a('0x23')](_0x2204f9)){if(_0x3bf347['hasOwnProperty'](_0x3c4b2d)){if(_0x17c09c['data'][_0x4340e4][_0x3bf347[_0x3c4b2d]]){var _0x3f1801=_[_0x568a('0x70')](_0x17c09c['data'][_0x4340e4][_0x3bf347[_0x3c4b2d]][_0x568a('0x71')](/"/g,'\x27'));switch(_0x3c4b2d){case _0x568a('0x72'):var _0x557e0a=moment(_0x3f1801,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x557e0a[_0x568a('0x73')]()){_0x183597[_0x568a('0x1e')]('\x22'+_0x3f1801+'\x22');}else{_0x972ab1[_0x568a('0x1e')](_0x568a('0x74'));}break;case _0x568a('0x75'):var _0x8e4beb=parseInt(_0x3f1801);_0x3f1801=_[_0x568a('0x76')](_0x8e4beb)||_0x8e4beb<0x0||_0x8e4beb>0x4?_0x318bc0?0x3:0x2:_0x8e4beb;_0x183597[_0x568a('0x1e')]('\x22'+_0x3f1801+'\x22');break;case _0x568a('0x3b'):var _0x27b4a1=parseInt(_0x3f1801);if(_[_0x568a('0x77')](_0x27b4a1)&&_[_0x568a('0x78')](_0x2a0bd1,_0x27b4a1)){_0x183597[_0x568a('0x1e')]('\x22'+_0x27b4a1+'\x22');}else{_0x972ab1[_0x568a('0x1e')](_0x568a('0x79'));}break;case _0x568a('0x7a'):if(isEmail(_0x3f1801)){_0x183597[_0x568a('0x1e')]('\x22'+_0x3f1801+'\x22');}else{_0x972ab1[_0x568a('0x1e')](_0x568a('0x7b'));}break;case _0x568a('0x7c'):var _0x913351=moment(_0x3f1801,_0x568a('0x7d'),!![]);if(_0x913351[_0x568a('0x73')]()){_0x183597[_0x568a('0x1e')]('\x22'+_0x3f1801+'\x22');}else{_0x972ab1[_0x568a('0x1e')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x183597['push']('\x22'+_0x3f1801+'\x22');}}else{switch(_0x3c4b2d){case _0x568a('0x7e'):case'phone':_0x972ab1[_0x568a('0x1e')](_0x3c4b2d+_0x568a('0x7f'));break;default:_0x183597[_0x568a('0x1e')]('\x22\x22');}}}}else{var _0x4d2eae='';if(!_[_0x568a('0x23')](_0x5f6674)){if(!_0x36ca99['hasOwnProperty'](_0x5f6674['id'])){for(var _0x12ba68=0x0;_0x12ba68<_0x3bf347[_0x3c4b2d][_0x568a('0x1c')];_0x12ba68++){var _0x3f1801=_[_0x568a('0x70')](_0x17c09c[_0x568a('0x6e')][_0x4340e4][_0x3bf347[_0x3c4b2d][_0x12ba68]][_0x568a('0x71')](/"/g,'\x27'));var _0x59e3c9=phoneDescriptions[_0x568a('0x6f')](_0x414972=>_0x414972[_0x568a('0x80')]===_0x5f6674['id']);if(!_['isNil'](_0x59e3c9)){var _0x2a25b2=_[_0x568a('0x70')](_0x17c09c[_0x568a('0x6e')][_0x4340e4][_0x3bf347[_0x59e3c9['description']][0x0]][_0x568a('0x71')](/"/g,'\x27'));if(!_[_0x568a('0x23')](_0x2a25b2))_0x3f1801=_0x3f1801+'§'+_0x2a25b2;}if(_0x4d2eae=='')_0x4d2eae=_0x3f1801;else _0x4d2eae+='|'+_0x3f1801;}_0x331faa['push'](_0x5f6674['id']+':'+_0x4d2eae);_0x36ca99[_0x5f6674['id']]=0x1;}}}}if(hasAdditionalPhones){_0x183597[_0x568a('0x1e')]('\x22'+_0x331faa[_0x568a('0x13')](';')+'\x22');}if(_0x972ab1[_0x568a('0x1c')]){handleError(_0x17c09c[_0x568a('0x6e')][_0x4340e4],{'code':_0x568a('0x81'),'message':_0x972ab1[_0x568a('0x13')]()});}else{fs[_0x568a('0x82')](_0x292c6b,_0x183597[_0x568a('0x13')]()+'\x0a');}_0x183597=[];}if(!(stats[_0x568a('0x83')]%0xc8)){socket[_0x568a('0x84')](_0x568a('0x85')+_0x43a6ae,stats);stats[_0x568a('0x5e')]=[];}}if(stopped){logger[_0x568a('0x60')](_0x568a('0x86'));_0x205425[_0x568a('0x87')]();}}catch(_0x4ddc3e){handleError(_0x17c09c[_0x568a('0x6e')][_0x4340e4],{'code':_0x568a('0x88'),'message':_0x4ddc3e[_0x568a('0x22')]});logger[_0x568a('0x21')]('step',_0x4ddc3e[_0x568a('0x22')]);}},'complete':function(){try{var _0x143b73=[];var _0x4bffa5=tempTableName;_0x143b73[_0x568a('0x1e')](_0x568a('0x89')+_0x4bffa5+'\x20LIKE\x20cm_contacts;');logger['info'](_0x568a('0x8a'),contactItemTypes[_0x568a('0x1c')]);var _0x3feac9=util[_0x568a('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x292c6b,_0x4bffa5,_0x46770a,_0x482e1f[_0x568a('0x39')],_0x482e1f[_0x568a('0x58')]||null,NOW,NOW);if(_[_0x568a('0x23')](_0x3bf347[_0x568a('0x72')])){_0x3feac9+=',\x20scheduledAt\x20=\x20NOW()';}_0x143b73[_0x568a('0x1e')](_0x3feac9);BPromise[_0x568a('0x8b')](_0x143b73,handleQuery)[_0x568a('0x28')](function(_0x114982){BPromise['all']([handleAdditionalPhones()])[_0x568a('0x28')](function(){_0x143b73=[];for(var _0x49867a=0x0;_0x49867a\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','../../../config/environment','import','localhost','redis','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','push','all','then','catch','message','AdditionalPhones','split','filter','findOne','update','updated','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','cm_hopper','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts'];(function(_0xe53304,_0x327f45){var _0x41f044=function(_0x3a95cd){while(--_0x3a95cd){_0xe53304['push'](_0xe53304['shift']());}};_0x41f044(++_0x327f45);}(_0xcc6d,0x1a9));var _0xdcc6=function(_0x5addb4,_0x360c72){_0x5addb4=_0x5addb4-0x0;var _0x2138b3=_0xcc6d[_0x5addb4];return _0x2138b3;};'use strict';var fs=require('fs');var path=require(_0xdcc6('0x0'));var _=require(_0xdcc6('0x1'));var Papa=require(_0xdcc6('0x2'));var util=require(_0xdcc6('0x3'));var BPromise=require(_0xdcc6('0x4'));var moment=require('moment');var squel=require(_0xdcc6('0x5'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xdcc6('0x6'));var logger=require('../../../config/logger')(_0xdcc6('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0xdcc6('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdcc6('0x9')]));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()[_0xdcc6('0xa')](_0xdcc6('0xb'));var tempTableName=_0xdcc6('0xc')+moment()[_0xdcc6('0xa')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x318d4){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'](_0x318d4);}function selectNotIn(_0x5e1249,_0x4ec5b6,_0x4a3939,_0x268e37,_0x4e76dc){return squel['select']()[_0xdcc6('0xd')](_0xdcc6('0xe'))[_0xdcc6('0xf')](_0x268e37)[_0xdcc6('0x10')](_0x4ec5b6,null,_0x4ec5b6+_0xdcc6('0x11')+_0x268e37+'.'+_0x4a3939)[_0xdcc6('0x12')](_0x268e37+'.'+_0x4a3939+_0xdcc6('0x13')+_0x5e1249+'.'+_0x4a3939)[_0xdcc6('0x12')](_0x4ec5b6+_0xdcc6('0x14')+_0x4e76dc[_0xdcc6('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x499d96,_0x5eb4b7){promisesAdditionalPhones=[];promisesContact=[];return db[_0xdcc6('0x15')]['query'](_0xdcc6('0x16')+tempTableName)[_0xdcc6('0x17')](function(_0x18bf22){if(_0x18bf22!==null){var _0x403eef=[];for(var _0x57b2aa=0x0;_0x57b2aa<_0x18bf22[_0xdcc6('0x18')];_0x57b2aa++){var _0x5af6e7=_0x18bf22[_0x57b2aa];if(!_[_0xdcc6('0x19')](_0x5af6e7[_0xdcc6('0xe')])){if(!_[_0xdcc6('0x19')](_0x5af6e7['AdditionalPhones']))_0x403eef[_0xdcc6('0x1a')](insertAdditionalPhones(_0x5af6e7));promisesContact[_0xdcc6('0x1a')]({'contact':_0x5af6e7});}}}Promise[_0xdcc6('0x1b')](_0x403eef)[_0xdcc6('0x1c')](function(){_0x499d96({'val':0x1});});})[_0xdcc6('0x1d')](function(_0x52be46){logger['error'](_0x52be46[_0xdcc6('0x1e')]);});});}function insertAdditionalPhones(_0x108b81){return new Promise(function(_0x51fd6f,_0x5c3c6a){var _0x489f0a=_0x108b81[_0xdcc6('0x1f')];if(_[_0xdcc6('0x19')](_0x489f0a))_0x5c3c6a({'val':0x0});else{var _0x1d8a9a=_0x489f0a[_0xdcc6('0x20')](';');var _0x5ef71f=[];orderBy=0x0;for(var _0x4d6942=0x0;_0x4d6942<_0x1d8a9a[_0xdcc6('0x18')];_0x4d6942++){_0x5ef71f[_0xdcc6('0x1a')](splitAdditionalPhone(_0x108b81['id'],_0x1d8a9a[_0x4d6942]));}Promise[_0xdcc6('0x1b')](_0x5ef71f)['then'](function(){_0x51fd6f({'val':_0x1d8a9a['length']});});}});}function splitAdditionalPhone(_0x516122,_0xca305e){return new Promise(function(_0x1b8397,_0x5eb1de){var _0x32d6ea=_0xca305e[_0xdcc6('0x20')](':');var _0x5166f4=_0x32d6ea[0x0];var _0x5920e5=_0x32d6ea[0x1];if(_0x5920e5!==''){var _0x449a78=_0x5920e5[_0xdcc6('0x20')]('|');var _0x1b5e0e=[];for(var _0x13cf21=0x0;_0x13cf21<_0x449a78[_0xdcc6('0x18')];_0x13cf21++){if(_0x449a78[_0x13cf21]!==''){var _0x3b8a83=_[_0xdcc6('0x21')](promisesAdditionalPhones,{'contactId':_0x516122,'phone':_0x449a78[_0x13cf21]});if(_0x3b8a83[_0xdcc6('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0xdcc6('0x1a')]({'contactId':_0x516122,'contactTypeId':_0x5166f4,'phone':_0x449a78[_0x13cf21],'orderBy':orderBy});}}}_0x1b8397({'ok':0x1});}else _0x1b8397({'res':0x0});});}function createAdditionalPhone(_0x54ad04,_0x54b4bc,_0x3e9033,_0x22d77f){var _0x6aa6f9='';var _0xfd50e1='';var _0x372c95=_0x3e9033[_0xdcc6('0x20')]('§');_0x6aa6f9=_0x372c95[0x0];if(_0x372c95[_0xdcc6('0x18')]==0x2)_0xfd50e1=_0x372c95[0x1];return new Promise(function(_0x29019d,_0x32dec7){return db['CmContactHasItem'][_0xdcc6('0x22')]({'where':{'CmContactId':_0x54ad04,'item':_0x6aa6f9}})['then'](function(_0x22e343){if(_0x22e343){return db['CmContactHasItem'][_0xdcc6('0x23')]({'ItemTypeId':_0x54b4bc,'description':_0xfd50e1,'OrderBy':_0x22d77f},{'where':{'CmContactId':_0x54ad04,'item':_0x6aa6f9}})[_0xdcc6('0x1c')](function(_0x57adf2){_0x29019d({'res':_0xdcc6('0x24')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x54ad04,'item':_0x6aa6f9,'ItemTypeId':_0x54b4bc,'description':_0xfd50e1,'OrderBy':_0x22d77f,'ItemClass':_0xdcc6('0x25')})[_0xdcc6('0x1c')](function(_0x47e8ac){_0x29019d({'res':_0xdcc6('0x26')});});}});});}function updateContact(_0x1ae321){return new Promise(function(_0x3f97ff,_0x11764b){var _0x2817cf=_0x1ae321['id'];delete _0x1ae321['id'];return db[_0xdcc6('0x27')][_0xdcc6('0x23')](_0x1ae321,{'where':{'id':_0x2817cf}})[_0xdcc6('0x1c')](function(_0x115591){updatedRows+=0x1;return db['CmHopper'][_0xdcc6('0x23')]({'phone':_0x1ae321[_0xdcc6('0xe')]},{'where':{'ContactId':_0x2817cf}})[_0xdcc6('0x1c')](function(_0x5311e5){_0x3f97ff({'ret':'OK'});});});});}function insertCmHopper(_0x4855b2,_0x5d8013,_0x39fdf5,_0x3ffe5a,_0x442a01){var _0x536a95=[_0xdcc6('0x28'),_0xdcc6('0x29'),_0xdcc6('0x2a'),'cm_contacts.ListId',_0x5d8013+'.'+_0x3ffe5a,_0xdcc6('0x2b'),_0xdcc6('0x2c'),'cm_contacts.priority',_0xdcc6('0x2d'),'\x22'+_0x442a01+'\x22'];return squel['insert']()['into'](_0xdcc6('0x2e'))['fromQuery']([_0xdcc6('0xe'),'scheduledat',_0xdcc6('0x2f'),_0xdcc6('0x30'),_0x3ffe5a,_0xdcc6('0x31'),_0xdcc6('0x32'),_0xdcc6('0x33'),'UserId',_0xdcc6('0x34')],squel['select']()[_0xdcc6('0x35')](_0x536a95)[_0xdcc6('0xf')](_0x5d8013)['join'](_0xdcc6('0x36'),null,_0xdcc6('0x37')+_0x5d8013+_0xdcc6('0x38'))['join'](_0x39fdf5,null,_0x39fdf5+_0xdcc6('0x11')+_0x5d8013+'.'+_0x3ffe5a)[_0xdcc6('0x12')](_0x5d8013+_0xdcc6('0x39'),_0x4855b2)[_0xdcc6('0x12')](_0xdcc6('0x3a'),NOW)[_0xdcc6('0x12')](_0xdcc6('0x3b'),selectNotIn(_0x5d8013,_0x39fdf5,_0x3ffe5a,'cm_hopper',[_0xdcc6('0x3c'),'\x22onlyIfOpen\x22']))[_0xdcc6('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5d8013,_0x39fdf5,_0x3ffe5a,'cm_hopper',[_0xdcc6('0x3c')])))['toString']();}function insertCmHopperBlack(_0x598237,_0x4ecc49,_0xe464ac,_0x13e2ea){var _0x317193=[_0xdcc6('0x28'),'cm_contacts.id',_0xdcc6('0x3d'),_0x4ecc49+'.'+_0x13e2ea,_0xdcc6('0x2b'),_0xdcc6('0x2c')];return squel[_0xdcc6('0x3e')]()['into'](_0xdcc6('0x3f'))[_0xdcc6('0x40')]([_0xdcc6('0xe'),_0xdcc6('0x2f'),_0xdcc6('0x30'),_0x13e2ea,_0xdcc6('0x31'),_0xdcc6('0x32')],squel[_0xdcc6('0x41')]()['fields'](_0x317193)[_0xdcc6('0xf')](_0x4ecc49)[_0xdcc6('0x10')]('cm_contacts',null,_0xdcc6('0x37')+_0x4ecc49+_0xdcc6('0x38'))[_0xdcc6('0x10')](_0xe464ac,null,_0xe464ac+_0xdcc6('0x11')+_0x4ecc49+'.'+_0x13e2ea)[_0xdcc6('0x12')](_0x4ecc49+_0xdcc6('0x39'),_0x598237)[_0xdcc6('0x12')](_0xdcc6('0x3a'),NOW)[_0xdcc6('0x12')](_0xdcc6('0x3b'),squel[_0xdcc6('0x41')]()['field'](_0xdcc6('0xe'))[_0xdcc6('0xf')](_0xdcc6('0x3f'))[_0xdcc6('0x12')]('ListId\x20=\x20?',_0x598237)[_0xdcc6('0x12')](_0x13e2ea+_0xdcc6('0x42'),_0x4ecc49+'.'+_0x13e2ea)))[_0xdcc6('0x43')]();}function insertCmHopperAdditionalPhones(_0x5d49b0){var _0x2202e7=[_0xdcc6('0x44'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xdcc6('0x45'),_0xdcc6('0x46')];return squel[_0xdcc6('0x3e')]()[_0xdcc6('0x47')]('cm_hopper_additional_phones')[_0xdcc6('0x40')]([_0xdcc6('0x48'),_0xdcc6('0xe'),_0xdcc6('0x49'),_0xdcc6('0x31'),_0xdcc6('0x32')],squel['select']()[_0xdcc6('0x35')](_0x2202e7)['from'](_0xdcc6('0x2e'))[_0xdcc6('0x10')](_0xdcc6('0x36'),null,_0xdcc6('0x4a'))[_0xdcc6('0x10')]('cm_contact_has_items',null,_0xdcc6('0x4b'))[_0xdcc6('0x12')](_0xdcc6('0x4c'),_0x5d49b0)[_0xdcc6('0x12')](_0xdcc6('0x3a'),NOW))[_0xdcc6('0x43')]();}function insertCmContact(_0x300ca3,_0x5a9919,_0x101d5d,_0x23f2be){var _0x277b7=_['concat'](_[_0xdcc6('0x4d')](_0x23f2be),[_0xdcc6('0x30'),'CompanyId',_0xdcc6('0x31'),_0xdcc6('0x32')]);return squel[_0xdcc6('0x3e')]()[_0xdcc6('0x47')](_0xdcc6('0x36'))[_0xdcc6('0x40')](_0x277b7,squel[_0xdcc6('0x41')]()[_0xdcc6('0x35')](_0x277b7)['from'](_0x5a9919)[_0xdcc6('0x12')]('('+_0x101d5d[_0xdcc6('0x10')](',')+_0xdcc6('0x4e'),squel[_0xdcc6('0x41')]()['fields'](_0x101d5d)['from'](_0xdcc6('0x36'))[_0xdcc6('0x12')](_0xdcc6('0x4f'),_0x300ca3))[_0xdcc6('0x12')](_0xdcc6('0x50'),squel[_0xdcc6('0x41')]()['field'](_0xdcc6('0x51'),_0xdcc6('0x52'))['from'](_0x5a9919)[_0xdcc6('0x53')](_0x101d5d[_0xdcc6('0x10')](','))))[_0xdcc6('0x43')]();}function handleStop(){logger['info'](_0xdcc6('0x54'));stopped=!![];}function handleUncaughtException(_0x229b94){logger[_0xdcc6('0x55')](_0x229b94[_0xdcc6('0x1e')]);process[_0xdcc6('0x56')](0x1);}function handleError(_0x110957,_0x82513d){stats['errors']['push']({'name':_0x82513d[_0xdcc6('0x57')],'message':_0x82513d[_0xdcc6('0x1e')],'row':_0x110957});}function handleQuery(_0xf9e1f8){logger['info'](_0xf9e1f8);return db[_0xdcc6('0x15')][_0xdcc6('0x58')](_0xf9e1f8)['spread'](function(_0x1b6a8b){results[_0xdcc6('0x1a')](_0x1b6a8b);})[_0xdcc6('0x1d')](function(_0x3a4e4e){logger['error'](_0x3a4e4e[_0xdcc6('0x1e')]);});}function main(_0x2b5f65,_0x1b18d4,_0x4fb7a7,_0x3aebf4){logger[_0xdcc6('0x59')](_0xdcc6('0x5a'),_0x2b5f65,JSON[_0xdcc6('0x5b')](_0x1b18d4));process[_0xdcc6('0x5c')]('start');var _0x594e45=_0x1b18d4[_0xdcc6('0x5d')];var _0x7950db=_[_0xdcc6('0x5e')](_0x594e45);var _0x366c9f=_0x1b18d4['socket_timestamp'];var _0x23cee4=path[_0xdcc6('0x10')](config[_0xdcc6('0x5f')],_0xdcc6('0x60'),_0x366c9f+_0xdcc6('0x61'));logger['info'](_0xdcc6('0x62'),_0x1b18d4);db['ContactItemType'][_0xdcc6('0x63')]({'raw':!![],'attributes':['id',_0xdcc6('0x64')]})[_0xdcc6('0x1c')](function(_0x10ffea){for(var _0x57bb29=0x0;_0x57bb29<_0x10ffea[_0xdcc6('0x18')];_0x57bb29++){if(_0x10ffea[_0x57bb29][_0xdcc6('0x64')]in _0x594e45){contactItemTypes[_0xdcc6('0x1a')](_0x10ffea[_0x57bb29]);delete _0x7950db[_0x10ffea[_0x57bb29]['name']];hasAdditionalPhones=!![];}for(var _0x36a6c6 in _0x594e45){if(_0x10ffea[_0x57bb29][_0xdcc6('0x64')]+'_description'===_0x36a6c6){phoneDescriptions[_0xdcc6('0x1a')]({'itemTypeId':_0x10ffea[_0x57bb29]['id'],'description':_0x36a6c6});delete _0x7950db[_0x36a6c6];}}}if(hasAdditionalPhones)_0x7950db[_0xdcc6('0x1f')]='';var _0x58938e=_[_0xdcc6('0x4d')](_0x7950db)[_0xdcc6('0x10')]();logger['info'](_0xdcc6('0x65'),_0x58938e);fs[_0xdcc6('0x66')](_0x23cee4,_0x58938e+'\x0a');Papa['parse'](fs[_0xdcc6('0x67')](_0x2b5f65),{'header':!![],'skipEmptyLines':!![],'step':function(_0x52530a,_0x85129a){try{for(var _0x14d7cb=0x0,_0x4f6c38=[];_0x14d7cb<_0x52530a[_0xdcc6('0x68')][_0xdcc6('0x18')];_0x14d7cb++){stats[_0xdcc6('0x69')]+=0x1;if(_0x52530a[_0xdcc6('0x6a')][_0x14d7cb]){handleError(_0x52530a[_0xdcc6('0x68')][_0x14d7cb],_0x52530a[_0xdcc6('0x6a')][_0x14d7cb]);}else{var _0x17e6a7=[];var _0x5c874e=[];var _0x458203={};for(var _0xad2d9a in _0x594e45){let _0x11d03c=contactItemTypes[_0xdcc6('0x6b')](_0x41163e=>_0x41163e[_0xdcc6('0x64')]===_0xad2d9a);let _0x489ea6=contactItemTypes[_0xdcc6('0x6b')](_0x5a75f1=>_0x5a75f1['name']+_0xdcc6('0x6c')===_0xad2d9a);if(_[_0xdcc6('0x19')](_0x11d03c)&&_[_0xdcc6('0x19')](_0x489ea6)){if(_0x594e45[_0xdcc6('0x6d')](_0xad2d9a)){if(_0x52530a[_0xdcc6('0x68')][_0x14d7cb][_0x594e45[_0xad2d9a]]){var _0x7b5803=_[_0xdcc6('0x6e')](_0x52530a[_0xdcc6('0x68')][_0x14d7cb][_0x594e45[_0xad2d9a]]['replace'](/"/g,'\x27'));switch(_0xad2d9a){case _0xdcc6('0x6f'):var _0x416522=moment(_0x7b5803,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x416522[_0xdcc6('0x70')]()){_0x4f6c38['push']('\x22'+_0x7b5803+'\x22');}else{_0x17e6a7['push'](_0xdcc6('0x71'));}break;case _0xdcc6('0x33'):var _0x1e0efa=parseInt(_0x7b5803);_0x7b5803=_[_0xdcc6('0x72')](_0x1e0efa)||_0x1e0efa<0x0||_0x1e0efa>0x4?_0x3aebf4?0x3:0x2:_0x1e0efa;_0x4f6c38['push']('\x22'+_0x7b5803+'\x22');break;case'UserId':var _0x17dd36=parseInt(_0x7b5803);if(_['isNumber'](_0x17dd36)&&_[_0xdcc6('0x73')](_0x4fb7a7,_0x17dd36)){_0x4f6c38['push']('\x22'+_0x17dd36+'\x22');}else{_0x17e6a7[_0xdcc6('0x1a')](_0xdcc6('0x74'));}break;case _0xdcc6('0x75'):if(isEmail(_0x7b5803)){_0x4f6c38[_0xdcc6('0x1a')]('\x22'+_0x7b5803+'\x22');}else{_0x17e6a7[_0xdcc6('0x1a')]('email\x20wrong\x20format');}break;case _0xdcc6('0x76'):var _0xa04ea3=moment(_0x7b5803,_0xdcc6('0x77'),!![]);if(_0xa04ea3[_0xdcc6('0x70')]()){_0x4f6c38[_0xdcc6('0x1a')]('\x22'+_0x7b5803+'\x22');}else{_0x17e6a7[_0xdcc6('0x1a')](_0xdcc6('0x78'));}break;default:_0x4f6c38[_0xdcc6('0x1a')]('\x22'+_0x7b5803+'\x22');}}else{switch(_0xad2d9a){case _0xdcc6('0x79'):case _0xdcc6('0xe'):_0x17e6a7['push'](_0xad2d9a+_0xdcc6('0x7a'));break;default:_0x4f6c38['push']('\x22\x22');}}}}else{var _0x355925='';if(!_[_0xdcc6('0x19')](_0x11d03c)){if(!_0x458203[_0xdcc6('0x6d')](_0x11d03c['id'])){for(var _0x396187=0x0;_0x396187<_0x594e45[_0xad2d9a][_0xdcc6('0x18')];_0x396187++){var _0x7b5803=_[_0xdcc6('0x6e')](_0x52530a[_0xdcc6('0x68')][_0x14d7cb][_0x594e45[_0xad2d9a][_0x396187]][_0xdcc6('0x7b')](/"/g,'\x27'));var _0x4dd2e6=phoneDescriptions[_0xdcc6('0x6b')](_0x44a213=>_0x44a213[_0xdcc6('0x7c')]===_0x11d03c['id']);if(!_['isNil'](_0x4dd2e6)){var _0x104935=_['trim'](_0x52530a[_0xdcc6('0x68')][_0x14d7cb][_0x594e45[_0x4dd2e6[_0xdcc6('0x7d')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xdcc6('0x19')](_0x104935))_0x7b5803=_0x7b5803+'§'+_0x104935;}if(_0x355925=='')_0x355925=_0x7b5803;else _0x355925+='|'+_0x7b5803;}_0x5c874e[_0xdcc6('0x1a')](_0x11d03c['id']+':'+_0x355925);_0x458203[_0x11d03c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4f6c38[_0xdcc6('0x1a')]('\x22'+_0x5c874e[_0xdcc6('0x10')](';')+'\x22');}if(_0x17e6a7['length']){handleError(_0x52530a[_0xdcc6('0x68')][_0x14d7cb],{'code':_0xdcc6('0x7e'),'message':_0x17e6a7[_0xdcc6('0x10')]()});}else{fs[_0xdcc6('0x7f')](_0x23cee4,_0x4f6c38[_0xdcc6('0x10')]()+'\x0a');}_0x4f6c38=[];}if(!(stats['rows']%0xc8)){socket[_0xdcc6('0x80')](_0xdcc6('0x81')+_0x366c9f,stats);stats[_0xdcc6('0x6a')]=[];}}if(stopped){logger[_0xdcc6('0x59')](_0xdcc6('0x82'));_0x85129a[_0xdcc6('0x83')]();}}catch(_0x20b337){handleError(_0x52530a[_0xdcc6('0x68')][_0x14d7cb],{'code':_0xdcc6('0x84'),'message':_0x20b337['message']});logger['error'](_0xdcc6('0x85'),_0x20b337[_0xdcc6('0x1e')]);}},'complete':function(){try{var _0x16100c=[];var _0x21ae23=tempTableName;_0x16100c['push'](_0xdcc6('0x86')+_0x21ae23+_0xdcc6('0x87'));logger[_0xdcc6('0x59')](_0xdcc6('0x88'),contactItemTypes[_0xdcc6('0x18')]);var _0x162f34=util[_0xdcc6('0xa')](_0xdcc6('0x89'),_0x23cee4,_0x21ae23,_0x58938e,_0x1b18d4[_0xdcc6('0x30')],_0x1b18d4[_0xdcc6('0x8a')]||null,NOW,NOW);if(_[_0xdcc6('0x19')](_0x594e45[_0xdcc6('0x6f')])){_0x162f34+=_0xdcc6('0x8b');}_0x16100c[_0xdcc6('0x1a')](_0x162f34);BPromise[_0xdcc6('0x8c')](_0x16100c,handleQuery)[_0xdcc6('0x1c')](function(_0x4d2325){BPromise['all']([handleAdditionalPhones()])[_0xdcc6('0x1c')](function(){_0x16100c=[];for(var _0x99478e=0x0;_0x99478e\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','../../mysqldb','role','agent','search','field','name','color','from','tools_tags','getInteractionFK','_interactions','select','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','where','getInteractionsTables','interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','length','default','text','value','end','unreadMessages','Contact','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','Tag','map','tags','clause','and','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','type','start','body','plainBody','getAccountFK','keys','some','compact','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','then','fields','read'];(function(_0x497a26,_0x227998){var _0x7ffc8=function(_0x3a51ab){while(--_0x3a51ab){_0x497a26['push'](_0x497a26['shift']());}};_0x7ffc8(++_0x227998);}(_0x9d17,0x199));var _0x79d1=function(_0xdfc72a,_0x4f2eca){_0xdfc72a=_0xdfc72a-0x0;var _0x48f776=_0x9d17[_0xdfc72a];return _0x48f776;};'use strict';var _=require(_0x79d1('0x0'));var squel=require(_0x79d1('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x79d1('0x2'));var updateInteraction=require(_0x79d1('0x3'))[_0x79d1('0x4')];var utils=require('./utils');var db=require(_0x79d1('0x5'))['db'];function skipInteractionsQuery(_0x5ab7fa,_0x4f9abc,_0x27d925){var _0x1634e7=![];var _0x4f7ac8=utils['getAccountFK'](_0x5ab7fa);if(_0x4f9abc[_0x79d1('0x6')]===_0x79d1('0x7')&&!_0x27d925[_0x79d1('0x8')]&&!_0x27d925[_0x4f7ac8]){_0x1634e7=!![];}return _0x1634e7;}function getTagsQuery(){return squel['select']()[_0x79d1('0x9')]('id')[_0x79d1('0x9')](_0x79d1('0xa'))[_0x79d1('0x9')](_0x79d1('0xb'))[_0x79d1('0xc')](_0x79d1('0xd'));}function getUsersQuery(_0x138b57,_0x34d973){var _0x392730=utils[_0x79d1('0xe')](_0x138b57);var _0x2d7156='user_has_'+_0x138b57+_0x79d1('0xf');var _0x4c182e=squel[_0x79d1('0x10')]()[_0x79d1('0x9')](_0x79d1('0x11'))['field'](_0x79d1('0x12'))['field'](_0x79d1('0x13')+_0x392730)['from'](_0x2d7156,'ui')['left_join'](_0x79d1('0x14'),'u',_0x79d1('0x15'));if(_0x34d973['length']>0x0){_0x4c182e[_0x79d1('0x16')](_0x79d1('0x13')+_0x392730+'\x20IN\x20?',_['map'](_0x34d973,'id'));}return _0x4c182e;}function getInteractionsQuery(_0x5d18b5){var _0x33e817=utils[_0x79d1('0x17')](_0x5d18b5);var _0x53905d=utils['getAccountFK'](_0x5d18b5);var _0x234d39=utils['getInteractionFK'](_0x5d18b5);return squel[_0x79d1('0x10')]()[_0x79d1('0xc')](_0x33e817[_0x79d1('0x18')],'i')[_0x79d1('0x19')]('cm_contacts','c',_0x79d1('0x1a'))['left_join'](_0x79d1('0x14'),'o',_0x79d1('0x1b'))[_0x79d1('0x19')](_0x33e817[_0x79d1('0x1c')],'a','a.id\x20=\x20i.'+_0x53905d)[_0x79d1('0x19')](_0x33e817[_0x79d1('0x1d')],'me',_0x79d1('0x1e')+_0x234d39+_0x79d1('0x1f'))[_0x79d1('0x19')](_0x33e817[_0x79d1('0x20')],'it','it.'+_0x234d39+_0x79d1('0x1f'))[_0x79d1('0x19')](_0x79d1('0xd'),'t',_0x79d1('0x21'));}function getSqlClauses(){var _0x6af61={'body':squel[_0x79d1('0x22')](),'contact':squel[_0x79d1('0x22')](),'default':squel[_0x79d1('0x22')](),'fields':squel[_0x79d1('0x22')](),'filter':squel[_0x79d1('0x22')](),'read':squel[_0x79d1('0x22')](),'tags':{'clause':squel[_0x79d1('0x22')](),'ids':null},'user':squel[_0x79d1('0x22')]()};return _0x6af61;}function parseTagParameter(_0x182f69){var _0x36a1d9=squel['expr']();if(_0x182f69){var _0x13d07b=utils[_0x79d1('0x23')](_0x182f69);_0x13d07b[_0x79d1('0x24')](function(_0x52ac2e){_0x36a1d9['or'](_0x79d1('0x25'),'%,'+_0x52ac2e+',%');});}return _0x36a1d9;}function parseReadParameter(_0x7019f1){var _0x169934='';if(_0x7019f1){_0x169934=_0x79d1('0x26');if(_0x7019f1==='1'){_0x169934=_0x169934[_0x79d1('0x27')]('{OPERATOR}','=');}else{_0x169934=_0x169934[_0x79d1('0x27')](_0x79d1('0x28'),'>');}}return _0x169934;}function parseSearchFilter(_0x29e966,_0x1bea0c){var _0x4dc643=squel[_0x79d1('0x22')]();if(_0x1bea0c){var _0x4d5bbd=_0x1bea0c[_0x79d1('0x27')]('\x5c','\x5c\x5c')[_0x79d1('0x27')](/'/g,'\x27\x27');if(qs[_0x79d1('0x29')](_0x4d5bbd)){_0x4dc643['or']('i.id\x20LIKE\x20?',_0x4d5bbd+'%');if([_0x79d1('0x2a'),_0x79d1('0x2b')][_0x79d1('0x2c')](_0x29e966)){_0x4dc643['or'](_0x79d1('0x2d'),_0x4d5bbd+'%');}else if(_0x29e966===_0x79d1('0x2e')){_0x4dc643['or']('i.fax\x20LIKE\x20?',_0x4d5bbd+'%');}else if(_0x29e966===_0x79d1('0x2f')){_0x4dc643['or'](_0x79d1('0x30'),_0x4d5bbd+'%');}}else if(_0x29e966===_0x79d1('0x31')&&qs[_0x79d1('0x32')](_0x4d5bbd)){_0x4dc643['or']('c.email\x20LIKE\x20?',_0x4d5bbd+'%');}else{if(_0x29e966===_0x79d1('0x31')){_0x4dc643['or'](_0x79d1('0x33'),qs[_0x79d1('0x34')](_0x4d5bbd,!![]))['or'](_0x79d1('0x35'),qs['getFullTextValue'](_0x4d5bbd));}else if(_0x29e966!==_0x79d1('0x2e')){_0x4dc643['or'](_0x79d1('0x36'),qs[_0x79d1('0x34')](_0x4d5bbd));}_0x4dc643['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x79d1('0x34')](_0x4d5bbd,!![]),null);}}return _0x4dc643;}function parseAdvancedSearchFilter(_0x42d09b,_0x44a948){var _0x37fa75=getSqlClauses();var _0x4dcb9a=as[_0x79d1('0x37')](_0x42d09b);var _0x32b34d=_0x4dcb9a[_0x79d1('0x38')];for(var _0x3015eb=0x0;_0x3015eb<_0x4dcb9a['conditions'][_0x79d1('0x39')];_0x3015eb++){var _0x2f79b4=_0x4dcb9a['conditions'][_0x3015eb];var _0x5e15b='i';var _0x5798d2=_['find'](_0x44a948,[_0x79d1('0xa'),_0x2f79b4[_0x79d1('0x9')]]);if(_0x5798d2){var _0x2ff871=as['buildExpression'](_0x5e15b,_0x5798d2['type'],_0x2f79b4);_0x37fa75[_0x79d1('0x3a')][_0x32b34d](_0x2ff871[_0x79d1('0x3b')],_0x2ff871[_0x79d1('0x3c')]['start'],_0x2ff871[_0x79d1('0x3c')][_0x79d1('0x3d')]);}else{switch(_0x2f79b4[_0x79d1('0x9')]){case _0x79d1('0x3e'):var _0x6436f9=parseReadParameter(_0x2f79b4[_0x79d1('0x3c')]);_0x37fa75['read']['and'](_0x6436f9);break;case _0x79d1('0x3f'):if(_0x2f79b4[_0x79d1('0x40')]===_0x79d1('0x41')){if(_0x2f79b4['value'][_0x79d1('0x42')]('\x20')[_0x79d1('0x39')]>0x1){_0x37fa75[_0x79d1('0x43')][_0x32b34d](_0x79d1('0x44'),qs[_0x79d1('0x34')](_0x2f79b4[_0x79d1('0x3c')],!![]),null);}else{var _0x264792='%'+_0x2f79b4[_0x79d1('0x3c')]+'%';_0x37fa75[_0x79d1('0x43')][_0x32b34d](_0x79d1('0x45'),_0x264792,_0x264792,_0x264792);}}else{_0x5798d2=_[_0x79d1('0x46')](_0x44a948,['name',_0x79d1('0x47')]);_0x2f79b4[_0x79d1('0x9')]=_0x79d1('0x47');_0x2ff871=as['buildExpression'](_0x5e15b,_0x5798d2['type'],_0x2f79b4);_0x37fa75['contact'][_0x32b34d](_0x2ff871[_0x79d1('0x3b')],_0x2ff871['value']['start'],_0x2ff871[_0x79d1('0x3c')][_0x79d1('0x3d')]);}break;case _0x79d1('0x48'):var _0x5cccce=_0x2f79b4[_0x79d1('0x3c')][_0x79d1('0x42')](',')[_0x79d1('0x49')](function(_0x198f12){return Number(_0x198f12);});var _0x5ec285=parseTagParameter(_0x5cccce);_0x37fa75[_0x79d1('0x4a')][_0x79d1('0x4b')][_0x79d1('0x4c')](_0x5ec285);_0x37fa75[_0x79d1('0x4a')][_0x79d1('0x4d')]=_0x5cccce;break;case _0x79d1('0x4e'):if(_0x2f79b4[_0x79d1('0x40')]===_0x79d1('0x41')){_0x37fa75[_0x79d1('0x4f')][_0x32b34d](_0x79d1('0x50'),'%'+_0x2f79b4[_0x79d1('0x3c')]+'%',null);}else{_0x5798d2=_['find'](_0x44a948,[_0x79d1('0xa'),_0x79d1('0x51')]);_0x2f79b4['field']=_0x79d1('0x51');_0x2ff871=as[_0x79d1('0x52')](_0x5e15b,_0x5798d2[_0x79d1('0x53')],_0x2f79b4);_0x37fa75[_0x79d1('0x4f')][_0x32b34d](_0x2ff871[_0x79d1('0x3b')],_0x2ff871[_0x79d1('0x3c')][_0x79d1('0x54')],_0x2ff871['value'][_0x79d1('0x3d')]);}break;case _0x79d1('0x55'):case _0x79d1('0x56'):_0x2ff871=as[_0x79d1('0x52')]('me',null,_0x2f79b4);_0x37fa75['body'][_0x32b34d](_0x2ff871[_0x79d1('0x3b')],_0x2ff871[_0x79d1('0x3c')][_0x79d1('0x54')],_0x2ff871[_0x79d1('0x3c')]['end']);break;}}}return _0x37fa75;}function parseModelFields(_0x4d93f8,_0x3b9b62,_0x1b24d1){var _0x33c85e=utils[_0x79d1('0x57')](_0x4d93f8);var _0x2dd1ce=squel['expr']();var _0x332587=_(_0x3b9b62)[_0x79d1('0x58')]()[_0x79d1('0x49')](function(_0x45bf9c){return _[_0x79d1('0x59')](_0x1b24d1,[_0x79d1('0xa'),_0x45bf9c])?_0x45bf9c:undefined;})[_0x79d1('0x5a')]()[_0x79d1('0x3c')]();if(_0x332587[_0x79d1('0x39')]>0x0){_0x332587[_0x79d1('0x24')](function(_0x5c35b7){if(_0x5c35b7===_0x33c85e){_0x2dd1ce[_0x79d1('0x4c')]('i.'+_0x33c85e+'\x20IN\x20?',[]['concat'](_0x3b9b62[_0x5c35b7]));}else if(_0x5c35b7===_0x79d1('0x5b')){var _0x12ab10=JSON[_0x79d1('0x5c')](_0x3b9b62[_0x5c35b7])[_0x79d1('0x5d')];var _0x40452e=JSON[_0x79d1('0x5c')](_0x3b9b62[_0x5c35b7])['$lte'];_0x2dd1ce['and'](_0x79d1('0x5e'),_0x12ab10,_0x40452e);}else{if(_0x3b9b62[_0x5c35b7]===_0x79d1('0x5f')){_0x2dd1ce[_0x79d1('0x4c')]('i.'+_0x5c35b7+_0x79d1('0x60'));}else{_0x2dd1ce['and']('i.'+_0x5c35b7+_0x79d1('0x61'),_0x3b9b62[_0x5c35b7]);}}});}return _0x2dd1ce;}function parseQueryParameters(_0x3e17fa,_0x232129,_0x1fadc3){var _0x5387d7=getSqlClauses();return Promise['resolve']()[_0x79d1('0x62')](function(){return parseModelFields(_0x3e17fa,_0x232129,_0x1fadc3);})[_0x79d1('0x62')](function(_0x4c6cb1){_0x5387d7[_0x79d1('0x63')][_0x79d1('0x4c')](_0x4c6cb1);return parseReadParameter(_0x232129['read']);})[_0x79d1('0x62')](function(_0x6b0d89){_0x5387d7[_0x79d1('0x64')][_0x79d1('0x4c')](_0x6b0d89);return parseTagParameter(_0x232129[_0x79d1('0x65')]);})[_0x79d1('0x62')](function(_0x1663e0){_0x5387d7[_0x79d1('0x4a')][_0x79d1('0x4b')]['and'](_0x1663e0);return parseSearchFilter(_0x3e17fa,_0x232129[_0x79d1('0x66')]);})[_0x79d1('0x62')](function(_0x527988){_0x5387d7[_0x79d1('0x66')]=_0x527988;return _0x5387d7;});}function checkAccountsRestrictions(_0x57373a,_0x5e7117,_0x5ba733){var _0x4bd0fd=utils[_0x79d1('0x57')](_0x57373a);var _0x4ececf=_0x79d1('0x67')+_['capitalize'](_0x57373a)+(_0x57373a===_0x79d1('0x68')?_0x79d1('0x69'):'Accounts');var _0x229009=squel[_0x79d1('0x22')]();return Promise['resolve']()[_0x79d1('0x62')](function(){if(_0x5ba733[_0x79d1('0x8')]&&_0x5e7117[_0x79d1('0x6')]===_0x79d1('0x7')){return _0x5e7117[_0x4ececf]({'attributes':['id'],'raw':!![]});}})[_0x79d1('0x62')](function(_0x454072){if(_0x454072){if(_0x454072['length']===0x0){_0x229009['and']('i.'+_0x4bd0fd+_0x79d1('0x60'));}else{_0x229009[_0x79d1('0x4c')]('i.'+_0x4bd0fd+_0x79d1('0x6a'),_[_0x79d1('0x49')](_0x454072,'id'));}}else if(!_0x5ba733[_0x4bd0fd]){_0x229009[_0x79d1('0x4c')]('i.'+_0x4bd0fd+_0x79d1('0x6b'));}})[_0x79d1('0x62')](function(){return _0x229009;});}function getClosedOrderClause(_0x4c3f08,_0x3d7fe8){var _0x427ae2='';var _0x2faf8e=[_0x79d1('0x6c'),_0x79d1('0x6d'),_0x79d1('0x6e')];if(_0x4c3f08==='mail'){_0x2faf8e[_0x79d1('0x6f')](_0x79d1('0x70'));}if(_0x3d7fe8[_0x79d1('0x71')]==='0'&&_0x4c3f08===_0x79d1('0x31')){_0x427ae2='i.substatus';}else{if(_0x3d7fe8[_0x79d1('0x71')]==='1'){_0x2faf8e[_0x79d1('0x72')]();}_0x427ae2=_0x79d1('0x73')+_0x2faf8e[_0x79d1('0x74')](',\x20')+')';}return _0x427ae2;}function getFilteredInteractions(_0x717d41,_0xb2d6f2,_0x1f516,_0x24c4c9){var _0x12eccd=utils[_0x79d1('0xe')](_0x717d41);var _0x3e693a=_[_0x79d1('0x75')](_0x717d41)+'Interaction';var _0x7e0c35=[];var _0x43129b=getTagsQuery();var _0x10395c={'type':db[_0x79d1('0x76')][_0x79d1('0x77')][_0x79d1('0x78')],'raw':!![]};var _0x3d7032=[];var _0x421096=[];return db[_0x79d1('0x79')][_0x79d1('0x7a')](_0x43129b[_0x79d1('0x7b')](),_0x10395c)['then'](function(_0x5ddea8){_0x7e0c35=_['keyBy'](_0x5ddea8,'id');_0x10395c=_['merge'](_0x10395c,{'model':db[_0x3e693a],'mapToModel':!![],'nest':!![]});if(_0x1f516[_0x79d1('0x63')]){_0x24c4c9['attributes'][_0x79d1('0x24')](function(_0x4c68eb){_0xb2d6f2['field']('i.'+_0x4c68eb);});}else{_0xb2d6f2['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x79d1('0x3e'));_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x7c'),_0x79d1('0x7d'));_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x7e'),_0x79d1('0x7f'));if(_0x717d41==='mail'){_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x80'),_0x79d1('0x81'));_0xb2d6f2[_0x79d1('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x82'));_0xb2d6f2[_0x79d1('0x9')]('i.createdAt');_0xb2d6f2[_0x79d1('0x9')]('i.updatedAt');_0xb2d6f2[_0x79d1('0x9')]('i.closed');_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x83'));_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x84'));_0xb2d6f2['field'](_0x79d1('0x85'));_0xb2d6f2['field']('i.lastMsgDirection');_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x86'));_0xb2d6f2['field'](_0x79d1('0x6e'));_0xb2d6f2[_0x79d1('0x9')]('i.secondDisposition');_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x6c'));_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x70'));_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x87'));_0xb2d6f2[_0x79d1('0x9')]('i.ContactId');_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x88'));_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x89'));}else if(_0x717d41===_0x79d1('0x2f')){_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x8a'),'contactName');}else{_0xb2d6f2['field'](_0x79d1('0x8b'),_0x79d1('0x8c'));}if(_0x717d41!==_0x79d1('0x31')){_0xb2d6f2[_0x79d1('0x9')]('i.*');}_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x8d'),'Contact.firstName');_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x8e'),_0x79d1('0x8f'));_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x90'),_0x79d1('0x91'));_0xb2d6f2['field'](_0x79d1('0x92'),_0x79d1('0x93'));_0xb2d6f2['field'](_0x79d1('0x94'),_0x79d1('0x95'));_0xb2d6f2['field'](_0x79d1('0x96'),_0x79d1('0x97'));_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x98'),_0x79d1('0x99'));_0xb2d6f2['field'](_0x79d1('0x9a'),_0x79d1('0x9b'));_0xb2d6f2[_0x79d1('0x9')](_0x79d1('0x9c'),_0x79d1('0x9d'));}if(_0x24c4c9['limit']){_0xb2d6f2[_0x79d1('0x9e')](_0x24c4c9['limit']);}if(_0x24c4c9[_0x79d1('0x9f')]){_0xb2d6f2[_0x79d1('0x9f')](_0x24c4c9[_0x79d1('0x9f')]);}return db['sequelize'][_0x79d1('0x7a')](_0xb2d6f2[_0x79d1('0x7b')](),_0x10395c);})[_0x79d1('0x62')](function(_0x5b7aed){_0x3d7032=_0x5b7aed;var _0x57dd2a=getUsersQuery(_0x717d41,_0x3d7032);return db[_0x79d1('0x79')][_0x79d1('0x7a')](_0x57dd2a[_0x79d1('0x7b')](),_0x10395c);})[_0x79d1('0x62')](function(_0x1d4ae9){_0x421096=_[_0x79d1('0xa0')](_0x1d4ae9,_0x12eccd);if(_0x717d41===_0x79d1('0x31')){return db[_0x79d1('0xa1')][_0x79d1('0xa2')]({'attributes':[_0x79d1('0xa3')],'raw':!![]});}})[_0x79d1('0x62')](function(_0x5f4c57){var _0x5794ba=_0x5f4c57?_0x5f4c57[_0x79d1('0xa3')]:undefined;var _0x108c3f=_0x3d7032['map'](function(_0x125cd1){return updateInteraction(_0x125cd1,_0x7e0c35,_0x421096,_0x5794ba);});return Promise[_0x79d1('0xa4')](_0x108c3f);});}function countFilteredInteractions(_0x10b951,_0x2d3bf4){var _0x17fe31=_0x10b951['clone']();_0x17fe31[_0x79d1('0x9')](_0x79d1('0xa5'));_0x17fe31[_0x79d1('0x9')](_0x79d1('0xa6'),_0x79d1('0x3e'));var _0x19fa97=utils['getSelectedTags'](_0x2d3bf4);if(!_[_0x79d1('0xa7')](_0x19fa97)){_0x17fe31['where'](_0x79d1('0xa8'),_0x19fa97);}var _0x10c520={'type':db[_0x79d1('0x76')][_0x79d1('0x77')][_0x79d1('0x78')],'raw':!![]};return db[_0x79d1('0x79')]['query'](_0x17fe31[_0x79d1('0x7b')](),_0x10c520);}module[_0x79d1('0xa9')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x9bc9=['read','and','Contact','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','Tag','tags','ids','User','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','text','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','resolve','then','fields','tag','clause','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','QueryTypes','SELECT','sequelize','query','toString','attributes','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','i.id','i.createdAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.to','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','enableEmailPreview','all','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','getSelectedTags','isEmpty','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','name','color','from','getInteractionFK','user_has_','_interactions','u.id','field','left_join','users','u.id\x20=\x20ui.UserId','length','where','ui.','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','default','value','start','end','unreadMessages'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x9bc9,0x108));var _0x99bc=function(_0x129fb9,_0x31992e){_0x129fb9=_0x129fb9-0x0;var _0x4c47ac=_0x9bc9[_0x129fb9];return _0x4c47ac;};'use strict';var _=require(_0x99bc('0x0'));var squel=require(_0x99bc('0x1'));var as=require(_0x99bc('0x2'));var qs=require(_0x99bc('0x3'));var updateInteraction=require(_0x99bc('0x4'))[_0x99bc('0x5')];var utils=require(_0x99bc('0x6'));var db=require(_0x99bc('0x7'))['db'];function skipInteractionsQuery(_0x4a0e20,_0x71d793,_0x282c23){var _0x40729a=![];var _0x4cd445=utils[_0x99bc('0x8')](_0x4a0e20);if(_0x71d793[_0x99bc('0x9')]===_0x99bc('0xa')&&!_0x282c23[_0x99bc('0xb')]&&!_0x282c23[_0x4cd445]){_0x40729a=!![];}return _0x40729a;}function getTagsQuery(){return squel[_0x99bc('0xc')]()['field']('id')['field'](_0x99bc('0xd'))['field'](_0x99bc('0xe'))[_0x99bc('0xf')]('tools_tags');}function getUsersQuery(_0x175a76,_0x23e9cb){var _0x26602c=utils[_0x99bc('0x10')](_0x175a76);var _0x5f49be=_0x99bc('0x11')+_0x175a76+_0x99bc('0x12');var _0x5364b0=squel[_0x99bc('0xc')]()['field'](_0x99bc('0x13'))[_0x99bc('0x14')]('u.fullname')[_0x99bc('0x14')]('ui.'+_0x26602c)[_0x99bc('0xf')](_0x5f49be,'ui')[_0x99bc('0x15')](_0x99bc('0x16'),'u',_0x99bc('0x17'));if(_0x23e9cb[_0x99bc('0x18')]>0x0){_0x5364b0[_0x99bc('0x19')](_0x99bc('0x1a')+_0x26602c+_0x99bc('0x1b'),_[_0x99bc('0x1c')](_0x23e9cb,'id'));}return _0x5364b0;}function getInteractionsQuery(_0x31e4f3){var _0x3a4a5b=utils[_0x99bc('0x1d')](_0x31e4f3);var _0x5c6c04=utils['getAccountFK'](_0x31e4f3);var _0x21c8a8=utils[_0x99bc('0x10')](_0x31e4f3);return squel['select']()[_0x99bc('0xf')](_0x3a4a5b[_0x99bc('0x1e')],'i')['left_join'](_0x99bc('0x1f'),'c',_0x99bc('0x20'))[_0x99bc('0x15')](_0x99bc('0x16'),'o',_0x99bc('0x21'))[_0x99bc('0x15')](_0x3a4a5b['accounts'],'a',_0x99bc('0x22')+_0x5c6c04)[_0x99bc('0x15')](_0x3a4a5b[_0x99bc('0x23')],'me','me.'+_0x21c8a8+_0x99bc('0x24'))[_0x99bc('0x15')](_0x3a4a5b[_0x99bc('0x25')],'it','it.'+_0x21c8a8+_0x99bc('0x24'))['left_join']('tools_tags','t',_0x99bc('0x26'));}function getSqlClauses(){var _0x3498e1={'body':squel['expr'](),'contact':squel['expr'](),'default':squel[_0x99bc('0x27')](),'fields':squel[_0x99bc('0x27')](),'filter':squel['expr'](),'read':squel[_0x99bc('0x27')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x99bc('0x27')]()};return _0x3498e1;}function parseTagParameter(_0x13c39d){var _0xdbc6eb=squel[_0x99bc('0x27')]();if(_0x13c39d){var _0x4a3beb=utils['getSelectedTags'](_0x13c39d);_0x4a3beb[_0x99bc('0x28')](function(_0x30c436){_0xdbc6eb['or'](_0x99bc('0x29'),'%,'+_0x30c436+',%');});}return _0xdbc6eb;}function parseReadParameter(_0x5c53e4){var _0x5b1771='';if(_0x5c53e4){_0x5b1771='unreadMessages\x20{OPERATOR}\x200';if(_0x5c53e4==='1'){_0x5b1771=_0x5b1771['replace'](_0x99bc('0x2a'),'=');}else{_0x5b1771=_0x5b1771[_0x99bc('0x2b')](_0x99bc('0x2a'),'>');}}return _0x5b1771;}function parseSearchFilter(_0x5b0748,_0x499dc3){var _0x175eb4=squel[_0x99bc('0x27')]();if(_0x499dc3){var _0x35b997=_0x499dc3['replace']('\x5c','\x5c\x5c')[_0x99bc('0x2b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x35b997)){_0x175eb4['or'](_0x99bc('0x2c'),_0x35b997+'%');if([_0x99bc('0x2d'),_0x99bc('0x2e')][_0x99bc('0x2f')](_0x5b0748)){_0x175eb4['or']('i.phone\x20LIKE\x20?',_0x35b997+'%');}else if(_0x5b0748==='fax'){_0x175eb4['or'](_0x99bc('0x30'),_0x35b997+'%');}else if(_0x5b0748==='openchannel'){_0x175eb4['or'](_0x99bc('0x31'),_0x35b997+'%');}}else if(_0x5b0748==='mail'&&qs[_0x99bc('0x32')](_0x35b997)){_0x175eb4['or'](_0x99bc('0x33'),_0x35b997+'%');}else{if(_0x5b0748===_0x99bc('0x34')){_0x175eb4['or'](_0x99bc('0x35'),qs['getFullTextValue'](_0x35b997,!![]))['or'](_0x99bc('0x36'),qs[_0x99bc('0x37')](_0x35b997));}else if(_0x5b0748!=='fax'){_0x175eb4['or'](_0x99bc('0x38'),qs['getFullTextValue'](_0x35b997));}_0x175eb4['or'](_0x99bc('0x39'),qs[_0x99bc('0x37')](_0x35b997,!![]),null);}}return _0x175eb4;}function parseAdvancedSearchFilter(_0x6c30e5,_0x345caf){var _0x33268e=getSqlClauses();var _0x4c4cc8=as[_0x99bc('0x3a')](_0x6c30e5);var _0x58136b=_0x4c4cc8[_0x99bc('0x3b')];for(var _0x3ca2c7=0x0;_0x3ca2c7<_0x4c4cc8[_0x99bc('0x3c')][_0x99bc('0x18')];_0x3ca2c7++){var _0x39e997=_0x4c4cc8[_0x99bc('0x3c')][_0x3ca2c7];var _0x5c261b='i';var _0x40ba60=_[_0x99bc('0x3d')](_0x345caf,[_0x99bc('0xd'),_0x39e997[_0x99bc('0x14')]]);if(_0x40ba60){var _0x1e52a8=as[_0x99bc('0x3e')](_0x5c261b,_0x40ba60['type'],_0x39e997);_0x33268e[_0x99bc('0x3f')][_0x58136b](_0x1e52a8['text'],_0x1e52a8[_0x99bc('0x40')][_0x99bc('0x41')],_0x1e52a8[_0x99bc('0x40')][_0x99bc('0x42')]);}else{switch(_0x39e997[_0x99bc('0x14')]){case _0x99bc('0x43'):var _0x11a6ac=parseReadParameter(_0x39e997[_0x99bc('0x40')]);_0x33268e[_0x99bc('0x44')][_0x99bc('0x45')](_0x11a6ac);break;case _0x99bc('0x46'):if(_0x39e997['operator']===_0x99bc('0x47')){if(_0x39e997['value'][_0x99bc('0x48')]('\x20')[_0x99bc('0x18')]>0x1){_0x33268e[_0x99bc('0x49')][_0x58136b](_0x99bc('0x39'),qs['getFullTextValue'](_0x39e997['value'],!![]),null);}else{var _0x3c3504='%'+_0x39e997[_0x99bc('0x40')]+'%';_0x33268e['contact'][_0x58136b](_0x99bc('0x4a'),_0x3c3504,_0x3c3504,_0x3c3504);}}else{_0x40ba60=_['find'](_0x345caf,[_0x99bc('0xd'),'ContactId']);_0x39e997[_0x99bc('0x14')]=_0x99bc('0x4b');_0x1e52a8=as[_0x99bc('0x3e')](_0x5c261b,_0x40ba60[_0x99bc('0x4c')],_0x39e997);_0x33268e[_0x99bc('0x49')][_0x58136b](_0x1e52a8['text'],_0x1e52a8['value'][_0x99bc('0x41')],_0x1e52a8[_0x99bc('0x40')]['end']);}break;case _0x99bc('0x4d'):var _0x244fb6=_0x39e997['value']['split'](',')[_0x99bc('0x1c')](function(_0x565070){return Number(_0x565070);});var _0x24c518=parseTagParameter(_0x244fb6);_0x33268e[_0x99bc('0x4e')]['clause']['and'](_0x24c518);_0x33268e[_0x99bc('0x4e')][_0x99bc('0x4f')]=_0x244fb6;break;case _0x99bc('0x50'):if(_0x39e997[_0x99bc('0x51')]===_0x99bc('0x47')){_0x33268e[_0x99bc('0x52')][_0x58136b](_0x99bc('0x53'),'%'+_0x39e997['value']+'%',null);}else{_0x40ba60=_[_0x99bc('0x3d')](_0x345caf,[_0x99bc('0xd'),_0x99bc('0x54')]);_0x39e997[_0x99bc('0x14')]=_0x99bc('0x54');_0x1e52a8=as[_0x99bc('0x3e')](_0x5c261b,_0x40ba60['type'],_0x39e997);_0x33268e[_0x99bc('0x52')][_0x58136b](_0x1e52a8['text'],_0x1e52a8[_0x99bc('0x40')][_0x99bc('0x41')],_0x1e52a8[_0x99bc('0x40')][_0x99bc('0x42')]);}break;case'body':case'plainBody':_0x1e52a8=as[_0x99bc('0x3e')]('me',null,_0x39e997);_0x33268e[_0x99bc('0x55')][_0x58136b](_0x1e52a8[_0x99bc('0x56')],_0x1e52a8['value'][_0x99bc('0x41')],_0x1e52a8[_0x99bc('0x40')][_0x99bc('0x42')]);break;}}}return _0x33268e;}function parseModelFields(_0x37c170,_0x34ac6d,_0x2de0ec){var _0x47cd17=utils[_0x99bc('0x8')](_0x37c170);var _0x151955=squel[_0x99bc('0x27')]();var _0x476f31=_(_0x34ac6d)['keys']()[_0x99bc('0x1c')](function(_0x48f6d9){return _['some'](_0x2de0ec,[_0x99bc('0xd'),_0x48f6d9])?_0x48f6d9:undefined;})[_0x99bc('0x57')]()[_0x99bc('0x40')]();if(_0x476f31[_0x99bc('0x18')]>0x0){_0x476f31[_0x99bc('0x28')](function(_0x1388b5){if(_0x1388b5===_0x47cd17){_0x151955[_0x99bc('0x45')]('i.'+_0x47cd17+_0x99bc('0x1b'),[][_0x99bc('0x58')](_0x34ac6d[_0x1388b5]));}else if(_0x1388b5===_0x99bc('0x59')){var _0x2ff3ef=JSON[_0x99bc('0x5a')](_0x34ac6d[_0x1388b5])[_0x99bc('0x5b')];var _0x1f9cd9=JSON['parse'](_0x34ac6d[_0x1388b5])[_0x99bc('0x5c')];_0x151955[_0x99bc('0x45')](_0x99bc('0x5d'),_0x2ff3ef,_0x1f9cd9);}else{if(_0x34ac6d[_0x1388b5]===_0x99bc('0x5e')){_0x151955['and']('i.'+_0x1388b5+'\x20IS\x20NULL');}else{_0x151955[_0x99bc('0x45')]('i.'+_0x1388b5+'\x20=\x20?',_0x34ac6d[_0x1388b5]);}}});}return _0x151955;}function parseQueryParameters(_0xc65fca,_0x18b191,_0x55d807){var _0x535eab=getSqlClauses();return Promise[_0x99bc('0x5f')]()[_0x99bc('0x60')](function(){return parseModelFields(_0xc65fca,_0x18b191,_0x55d807);})['then'](function(_0x1a2e51){_0x535eab[_0x99bc('0x61')][_0x99bc('0x45')](_0x1a2e51);return parseReadParameter(_0x18b191['read']);})[_0x99bc('0x60')](function(_0x7946df){_0x535eab['read'][_0x99bc('0x45')](_0x7946df);return parseTagParameter(_0x18b191[_0x99bc('0x62')]);})[_0x99bc('0x60')](function(_0x2ea788){_0x535eab[_0x99bc('0x4e')][_0x99bc('0x63')][_0x99bc('0x45')](_0x2ea788);return parseSearchFilter(_0xc65fca,_0x18b191['filter']);})[_0x99bc('0x60')](function(_0x5190b8){_0x535eab[_0x99bc('0x64')]=_0x5190b8;return _0x535eab;});}function checkAccountsRestrictions(_0x4db44e,_0x4b9138,_0x38aec7){var _0x58f4c2=utils[_0x99bc('0x8')](_0x4db44e);var _0x4e9fa3=_0x99bc('0x65')+_[_0x99bc('0x66')](_0x4db44e)+(_0x4db44e===_0x99bc('0x67')?_0x99bc('0x68'):_0x99bc('0x69'));var _0x1a5871=squel[_0x99bc('0x27')]();return Promise[_0x99bc('0x5f')]()[_0x99bc('0x60')](function(){if(_0x38aec7[_0x99bc('0xb')]&&_0x4b9138[_0x99bc('0x9')]==='agent'){return _0x4b9138[_0x4e9fa3]({'attributes':['id'],'raw':!![]});}})[_0x99bc('0x60')](function(_0x289c6d){if(_0x289c6d){if(_0x289c6d[_0x99bc('0x18')]===0x0){_0x1a5871[_0x99bc('0x45')]('i.'+_0x58f4c2+_0x99bc('0x6a'));}else{_0x1a5871['and']('i.'+_0x58f4c2+_0x99bc('0x1b'),_['map'](_0x289c6d,'id'));}}else if(!_0x38aec7[_0x58f4c2]){_0x1a5871[_0x99bc('0x45')]('i.'+_0x58f4c2+_0x99bc('0x6b'));}})[_0x99bc('0x60')](function(){return _0x1a5871;});}function getClosedOrderClause(_0x4261d9,_0x42803f){var _0x261b4c='';var _0x1da36a=[_0x99bc('0x6c'),_0x99bc('0x6d'),'i.disposition'];if(_0x4261d9==='mail'){_0x1da36a[_0x99bc('0x6e')](_0x99bc('0x6f'));}if(_0x42803f[_0x99bc('0x70')]==='0'&&_0x4261d9==='mail'){_0x261b4c='i.substatus';}else{if(_0x42803f['closed']==='1'){_0x1da36a['shift']();}_0x261b4c=_0x99bc('0x71')+_0x1da36a[_0x99bc('0x72')](',\x20')+')';}return _0x261b4c;}function getFilteredInteractions(_0xed8dcd,_0x12d7a7,_0x580474,_0x5b0305){var _0x5da232=utils[_0x99bc('0x10')](_0xed8dcd);var _0x23e1b6=_[_0x99bc('0x66')](_0xed8dcd)+_0x99bc('0x73');var _0x30c736=[];var _0x5d588e=getTagsQuery();var _0x376d62={'type':db['Sequelize'][_0x99bc('0x74')][_0x99bc('0x75')],'raw':!![]};var _0x14e73c=[];var _0x2923dd=[];return db[_0x99bc('0x76')][_0x99bc('0x77')](_0x5d588e[_0x99bc('0x78')](),_0x376d62)['then'](function(_0x31b9dd){_0x30c736=_['keyBy'](_0x31b9dd,'id');_0x376d62=_['merge'](_0x376d62,{'model':db[_0x23e1b6],'mapToModel':!![],'nest':!![]});if(_0x580474[_0x99bc('0x61')]){_0x5b0305[_0x99bc('0x79')]['forEach'](function(_0x5d40ae){_0x12d7a7[_0x99bc('0x14')]('i.'+_0x5d40ae);});}else{_0x12d7a7['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x7a'),_0x99bc('0x7b'));_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x7c'),_0x99bc('0x7d'));if(_0xed8dcd===_0x99bc('0x34')){_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x7e'),_0x99bc('0x7f'));_0x12d7a7['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x80'));_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x81'));_0x12d7a7['field']('i.updatedAt');_0x12d7a7[_0x99bc('0x14')]('i.closed');_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x82'));_0x12d7a7[_0x99bc('0x14')]('i.attach');_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x83'));_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x84'));_0x12d7a7[_0x99bc('0x14')]('i.subject');_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x85'));_0x12d7a7['field'](_0x99bc('0x6d'));_0x12d7a7[_0x99bc('0x14')]('i.thirdDisposition');_0x12d7a7['field']('i.substatus');_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x86'));_0x12d7a7[_0x99bc('0x14')]('i.ContactId');_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x87'));_0x12d7a7['field']('i.UserId');}else if(_0xed8dcd==='openchannel'){_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x88'),_0x99bc('0x89'));}else{_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x8a'),_0x99bc('0x89'));}if(_0xed8dcd!==_0x99bc('0x34')){_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x8b'));}_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x8c'),_0x99bc('0x8d'));_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x8e'),_0x99bc('0x8f'));_0x12d7a7[_0x99bc('0x14')]('c.email',_0x99bc('0x90'));_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x91'),'Contact.phone');_0x12d7a7['field'](_0x99bc('0x92'),_0x99bc('0x93'));_0x12d7a7['field'](_0x99bc('0x94'),_0x99bc('0x95'));_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x96'),_0x99bc('0x97'));_0x12d7a7[_0x99bc('0x14')](_0x99bc('0x98'),_0x99bc('0x99'));_0x12d7a7['field'](_0x99bc('0x9a'),_0x99bc('0x9b'));}if(_0x5b0305[_0x99bc('0x9c')]){_0x12d7a7[_0x99bc('0x9c')](_0x5b0305[_0x99bc('0x9c')]);}if(_0x5b0305[_0x99bc('0x9d')]){_0x12d7a7[_0x99bc('0x9d')](_0x5b0305[_0x99bc('0x9d')]);}return db['sequelize']['query'](_0x12d7a7['toString'](),_0x376d62);})[_0x99bc('0x60')](function(_0x2eaf9f){_0x14e73c=_0x2eaf9f;var _0x358f04=getUsersQuery(_0xed8dcd,_0x14e73c);return db['sequelize'][_0x99bc('0x77')](_0x358f04['toString'](),_0x376d62);})[_0x99bc('0x60')](function(_0x54f8e0){_0x2923dd=_['groupBy'](_0x54f8e0,_0x5da232);if(_0xed8dcd==='mail'){return db['Setting']['findOne']({'attributes':[_0x99bc('0x9e')],'raw':!![]});}})['then'](function(_0x524947){var _0x4402aa=_0x524947?_0x524947[_0x99bc('0x9e')]:undefined;var _0x4bbcb5=_0x14e73c[_0x99bc('0x1c')](function(_0x1c0497){return updateInteraction(_0x1c0497,_0x30c736,_0x2923dd,_0x4402aa);});return Promise[_0x99bc('0x9f')](_0x4bbcb5);});}function countFilteredInteractions(_0xa469c0,_0x3855f1){var _0x26d066=_0xa469c0['clone']();_0x26d066[_0x99bc('0x14')](_0x99bc('0xa0'));_0x26d066[_0x99bc('0x14')](_0x99bc('0xa1'),_0x99bc('0x43'));var _0x283c9b=utils[_0x99bc('0xa2')](_0x3855f1);if(!_[_0x99bc('0xa3')](_0x283c9b)){_0x26d066['where']('t.id\x20IN\x20?',_0x283c9b);}var _0x61f4d1={'type':db[_0x99bc('0xa4')][_0x99bc('0x74')][_0x99bc('0x75')],'raw':!![]};return db['sequelize'][_0x99bc('0x77')](_0x26d066[_0x99bc('0x78')](),_0x61f4d1);}module[_0x99bc('0xa5')]={'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 da12ce2..d2689d1 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 _0xb417=['then','plainBody','lastMsgText','trimStart','catch','Tags','TagIds','../../mysqldb','map','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','UserId','disposition','findOne','out','-id'];(function(_0x45fdbf,_0x1ace60){var _0x35cba4=function(_0xcf87a4){while(--_0xcf87a4){_0x45fdbf['push'](_0x45fdbf['shift']());}};_0x35cba4(++_0x1ace60);}(_0xb417,0x1b7));var _0x7b41=function(_0x3dde60,_0x495bb6){_0x3dde60=_0x3dde60-0x0;var _0x24ba57=_0xb417[_0x3dde60];return _0x24ba57;};'use strict';var _=require('lodash');var db=require(_0x7b41('0x0'))['db'];function getInteractionUsers(_0x140fd4,_0x293a70){return new Promise(function(_0x4280cb,_0x5933a6){try{var _0x25581e=[];if(_0x293a70[_0x140fd4]){_0x25581e=_0x293a70[_0x140fd4][_0x7b41('0x1')](function(_0x629425){return{'id':_0x629425['id'],'fullname':_0x629425['fullname']};});}return _0x4280cb(_0x25581e);}catch(_0x15f4e3){_0x5933a6(_0x15f4e3);}});}function getInteractionTags(_0x170a10,_0x3b8513){var _0x4c247b=[];if(_0x170a10){_0x170a10[_0x7b41('0x2')](',')[_0x7b41('0x3')](function(_0x47fdcf){_0x4c247b[_0x7b41('0x4')](_0x3b8513[_0x47fdcf]);});}return _0x4c247b;}function updateWaitingCounter(_0x5a2c1a){if(_0x5a2c1a[_0x7b41('0x5')]){_0x5a2c1a[_0x7b41('0x5')]-=0x1;}}function updateInteractionCounters(_0x164814){_0x164814[_0x7b41('0x5')]=0x0;_0x164814[_0x7b41('0x6')]=0x0;_0x164814[_0x7b41('0x7')]=0x0;_0x164814[_0x7b41('0x8')]=0x0;_0x164814[_0x7b41('0x9')]=0x0;_0x164814[_0x7b41('0xa')]=0x0;if(_0x164814[_0x7b41('0xb')]){if(_0x164814['disposition']===_0x7b41('0x9')){_0x164814[_0x7b41('0x9')]+=0x1;updateWaitingCounter(_0x164814);}if(_0x164814[_0x7b41('0xc')]){_0x164814[_0x7b41('0x7')]+=0x1;if(_0x164814[_0x7b41('0x6')]){_0x164814[_0x7b41('0x6')]-=0x1;}}else{if(_0x164814[_0x7b41('0xd')]){_0x164814[_0x7b41('0x8')]+=0x1;updateWaitingCounter(_0x164814);}}}else{if(!_0x164814['UserId']){_0x164814[_0x7b41('0x5')]+=0x1;}if(_0x164814['UserId']){_0x164814[_0x7b41('0x6')]+=0x1;updateWaitingCounter(_0x164814);}}_0x164814[_0x7b41('0xa')]+=0x1;return _0x164814;}function getLastMessageText(_0x543510){return db['MailMessage'][_0x7b41('0xe')]({'where':{'$and':[{'MailInteractionId':_0x543510['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7b41('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x7b41('0x10'),'raw':!![]})[_0x7b41('0x11')](function(_0xb3866b){if(_0xb3866b&&_0xb3866b[_0x7b41('0x12')]){_0x543510[_0x7b41('0x13')]=_[_0x7b41('0x14')](_0xb3866b[_0x7b41('0x12')]);}return _0x543510;})[_0x7b41('0x15')](function(_0x5979ac){throw _0x5979ac;});}exports['updateInteraction']=function(_0xf1f7fa,_0x4eddb5,_0x441e31,_0x59366f){return new Promise(function(_0x45991b,_0x4b98ed){return getInteractionUsers(_0xf1f7fa['id'],_0x441e31)[_0x7b41('0x11')](function(_0x511411){_0xf1f7fa['Users']=_0x511411;return getInteractionTags(_0xf1f7fa['TagIds'],_0x4eddb5);})['then'](function(_0xfb04b8){_0xf1f7fa[_0x7b41('0x16')]=_0xfb04b8;delete _0xf1f7fa[_0x7b41('0x17')];return updateInteractionCounters(_0xf1f7fa);})[_0x7b41('0x11')](function(_0x5e0bb3){if(_0x59366f){return getLastMessageText(_0x5e0bb3);}else{return _0x5e0bb3;}})[_0x7b41('0x11')](function(_0x3cd386){_0x45991b(_0x3cd386);})['catch'](function(_0x2845ec){_0x4b98ed(_0x2845ec);});});}; \ No newline at end of file +var _0x4e0e=['split','forEach','push','waiting','talking','answered','unmanaged','abandoned','closed','UserId','disposition','MailMessage','findOne','out','plainBody','-id','catch','updateInteraction','then','Users','TagIds','../../mysqldb','fullname'];(function(_0x13235f,_0x2d6a35){var _0x5c8694=function(_0x3b25f4){while(--_0x3b25f4){_0x13235f['push'](_0x13235f['shift']());}};_0x5c8694(++_0x2d6a35);}(_0x4e0e,0x1ca));var _0xe4e0=function(_0x29a45f,_0x1a3548){_0x29a45f=_0x29a45f-0x0;var _0x1d0145=_0x4e0e[_0x29a45f];return _0x1d0145;};'use strict';var _=require('lodash');var db=require(_0xe4e0('0x0'))['db'];function getInteractionUsers(_0x13acd4,_0x29ba6e){return new Promise(function(_0x57945b,_0x4f5415){try{var _0x563423=[];if(_0x29ba6e[_0x13acd4]){_0x563423=_0x29ba6e[_0x13acd4]['map'](function(_0x2186f2){return{'id':_0x2186f2['id'],'fullname':_0x2186f2[_0xe4e0('0x1')]};});}return _0x57945b(_0x563423);}catch(_0x1d0efb){_0x4f5415(_0x1d0efb);}});}function getInteractionTags(_0x5605a2,_0x112dc6){var _0x2a6a60=[];if(_0x5605a2){_0x5605a2[_0xe4e0('0x2')](',')[_0xe4e0('0x3')](function(_0x37bb67){_0x2a6a60[_0xe4e0('0x4')](_0x112dc6[_0x37bb67]);});}return _0x2a6a60;}function updateWaitingCounter(_0x32b7a9){if(_0x32b7a9[_0xe4e0('0x5')]){_0x32b7a9[_0xe4e0('0x5')]-=0x1;}}function updateInteractionCounters(_0x2c2934){_0x2c2934[_0xe4e0('0x5')]=0x0;_0x2c2934[_0xe4e0('0x6')]=0x0;_0x2c2934[_0xe4e0('0x7')]=0x0;_0x2c2934[_0xe4e0('0x8')]=0x0;_0x2c2934[_0xe4e0('0x9')]=0x0;_0x2c2934['total']=0x0;if(_0x2c2934[_0xe4e0('0xa')]){if(_0x2c2934['disposition']==='abandoned'){_0x2c2934[_0xe4e0('0x9')]+=0x1;updateWaitingCounter(_0x2c2934);}if(_0x2c2934[_0xe4e0('0xb')]){_0x2c2934[_0xe4e0('0x7')]+=0x1;if(_0x2c2934[_0xe4e0('0x6')]){_0x2c2934[_0xe4e0('0x6')]-=0x1;}}else{if(_0x2c2934[_0xe4e0('0xc')]){_0x2c2934[_0xe4e0('0x8')]+=0x1;updateWaitingCounter(_0x2c2934);}}}else{if(!_0x2c2934[_0xe4e0('0xb')]){_0x2c2934[_0xe4e0('0x5')]+=0x1;}if(_0x2c2934['UserId']){_0x2c2934[_0xe4e0('0x6')]+=0x1;updateWaitingCounter(_0x2c2934);}}_0x2c2934['total']+=0x1;return _0x2c2934;}function getLastMessageText(_0x138e86){return db[_0xe4e0('0xd')][_0xe4e0('0xe')]({'where':{'$and':[{'MailInteractionId':_0x138e86['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe4e0('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xe4e0('0x10')],'order':_0xe4e0('0x11'),'raw':!![]})['then'](function(_0x23180f){if(_0x23180f&&_0x23180f[_0xe4e0('0x10')]){_0x138e86['lastMsgText']=_['trimStart'](_0x23180f[_0xe4e0('0x10')]);}return _0x138e86;})[_0xe4e0('0x12')](function(_0x39386a){throw _0x39386a;});}exports[_0xe4e0('0x13')]=function(_0xcbe363,_0x1e505b,_0x26b52e,_0x1eaae2){return new Promise(function(_0x42007d,_0x4b66cc){return getInteractionUsers(_0xcbe363['id'],_0x26b52e)[_0xe4e0('0x14')](function(_0x2dbdf8){_0xcbe363[_0xe4e0('0x15')]=_0x2dbdf8;return getInteractionTags(_0xcbe363['TagIds'],_0x1e505b);})[_0xe4e0('0x14')](function(_0x5a0ee2){_0xcbe363['Tags']=_0x5a0ee2;delete _0xcbe363[_0xe4e0('0x16')];return updateInteractionCounters(_0xcbe363);})[_0xe4e0('0x14')](function(_0x5aa39d){if(_0x1eaae2){return getLastMessageText(_0x5aa39d);}else{return _0x5aa39d;}})[_0xe4e0('0x14')](function(_0x12483d){_0x42007d(_0x12483d);})[_0xe4e0('0x12')](function(_0x2871e2){_0x4b66cc(_0x2871e2);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 4b0d64e..06ef93e 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 _0xc34a=['Website','Account','capitalize','InteractionId','upperFirst','unknown','accounts','_interactions','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','findOne','then','catch','error','lodash','../../config/logger','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','chat'];(function(_0x243949,_0x408fb9){var _0x360ee9=function(_0x57055a){while(--_0x57055a){_0x243949['push'](_0x243949['shift']());}};_0x360ee9(++_0x408fb9);}(_0xc34a,0x12d));var _0xac34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc34a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac34('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xac34('0x1'))(_0xac34('0x2')),'fax':require(_0xac34('0x1'))(_0xac34('0x3')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xac34('0x1'))(_0xac34('0x4')),'whatsapp':require('../../config/logger')(_0xac34('0x5'))};function getAccountFK(_0x392ea3){return _['capitalize'](_0x392ea3)+(_0x392ea3===_0xac34('0x6')?_0xac34('0x7'):_0xac34('0x8'))+'Id';}function getInteractionFK(_0x27e3fc){return _[_0xac34('0x9')](_0x27e3fc)+_0xac34('0xa');}function getInteractionId(_0x15765d,_0x441dfd,_0x1d2544){if(_0x15765d&&_0x15765d[_[_0xac34('0xb')](_0x1d2544)+'InteractionId']){return _0x15765d[_['upperFirst'](_0x1d2544)+_0xac34('0xa')];}else if(_0x15765d&&_0x15765d['id']){return _0x15765d['id'];}else if(_0x441dfd&&_0x441dfd['id']){return _0x441dfd['id'];}else{return _0xac34('0xc');}}function getInteractionsTables(_0x52791b){return{'accounts':_0x52791b+'_'+(_0x52791b===_0xac34('0x6')?'websites':_0xac34('0xd')),'interactions':_0x52791b+_0xac34('0xe'),'interactionsTags':_0x52791b+'_interaction_has_tags','messages':_0x52791b+_0xac34('0xf'),'userInteractions':_0xac34('0x10')+_0x52791b+_0xac34('0xe')};}function getSelectedTags(_0x5a41a8){var _0x3c00cc=[];if(_0x5a41a8){_0x3c00cc=Array[_0xac34('0x11')](_0x5a41a8)?_0x5a41a8:[_0x5a41a8];}return _0x3c00cc;}function log(_0x4dfa75,_0x40e82b,_0x41cf91,_0x48e65e,_0x52db03,_0xedaad4){loggers[_0x52db03[_0xac34('0x12')]()][_0x4dfa75](_0xac34('0x13'),_0xedaad4[_0xac34('0x14')](),_0x40e82b?_0x40e82b['id']:null,_0x40e82b?_0x40e82b[_0xac34('0x15')]:null,_0x40e82b?_0x40e82b['role']:null,getInteractionId(_0x41cf91,_0x48e65e,_0x52db03),_0x41cf91?JSON[_0xac34('0x16')](_0x41cf91):_0xac34('0x17'));}function updateUser(_0x5cbc7c,_0x414f7a,_0x2d8488,_0x5528ff,_0x5d8d99){db[_[_0xac34('0xb')](_0x5528ff)+'Interaction'][_0xac34('0x18')]({'where':{'id':getInteractionId(_0x414f7a,_0x2d8488,_0x5528ff)}})[_0xac34('0x19')](function(_0x18d75b){if(_0x18d75b){return _0x18d75b['update']({'UserId':_0x5cbc7c?_0x5cbc7c['id']:null});}})[_0xac34('0x19')](function(_0x1b9102){if(_0x1b9102){log('info',_0x5cbc7c,_0x414f7a,_0x2d8488,_0x5528ff,_0x5d8d99);}})[_0xac34('0x1a')](function(){log(_0xac34('0x1b'),_0x5cbc7c,_0x414f7a,_0x2d8488,_0x5528ff,_0x5d8d99);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xfa6f=['sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','findOne','then','update','info','error','exports','lodash','openchannel-interactions','mail-interactions','../../config/logger','fax-interactions'];(function(_0x4fb570,_0x4236b4){var _0x5d9448=function(_0xca452d){while(--_0xca452d){_0x4fb570['push'](_0x4fb570['shift']());}};_0x5d9448(++_0x4236b4);}(_0xfa6f,0x13b));var _0xffa6=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xfa6f[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0xffa6('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0xffa6('0x1')),'mail':require('../../config/logger')(_0xffa6('0x2')),'fax':require(_0xffa6('0x3'))(_0xffa6('0x4')),'sms':require('../../config/logger')(_0xffa6('0x5')),'chat':require(_0xffa6('0x3'))(_0xffa6('0x6')),'whatsapp':require(_0xffa6('0x3'))(_0xffa6('0x7'))};function getAccountFK(_0x3daa4c){return _[_0xffa6('0x8')](_0x3daa4c)+(_0x3daa4c===_0xffa6('0x9')?_0xffa6('0xa'):_0xffa6('0xb'))+'Id';}function getInteractionFK(_0x319f32){return _['capitalize'](_0x319f32)+_0xffa6('0xc');}function getInteractionId(_0x18cc3e,_0x29f980,_0x331b0d){if(_0x18cc3e&&_0x18cc3e[_[_0xffa6('0xd')](_0x331b0d)+_0xffa6('0xc')]){return _0x18cc3e[_[_0xffa6('0xd')](_0x331b0d)+'InteractionId'];}else if(_0x18cc3e&&_0x18cc3e['id']){return _0x18cc3e['id'];}else if(_0x29f980&&_0x29f980['id']){return _0x29f980['id'];}else{return _0xffa6('0xe');}}function getInteractionsTables(_0x14f2db){return{'accounts':_0x14f2db+'_'+(_0x14f2db===_0xffa6('0x9')?_0xffa6('0xf'):_0xffa6('0x10')),'interactions':_0x14f2db+_0xffa6('0x11'),'interactionsTags':_0x14f2db+'_interaction_has_tags','messages':_0x14f2db+_0xffa6('0x12'),'userInteractions':_0xffa6('0x13')+_0x14f2db+_0xffa6('0x11')};}function getSelectedTags(_0x49badb){var _0x7dff97=[];if(_0x49badb){_0x7dff97=Array[_0xffa6('0x14')](_0x49badb)?_0x49badb:[_0x49badb];}return _0x7dff97;}function log(_0x22ea2b,_0x34d99b,_0x29c451,_0x4d348e,_0x3bb60a,_0x3c0f24){loggers[_0x3bb60a[_0xffa6('0x15')]()][_0x22ea2b](_0xffa6('0x16'),_0x3c0f24[_0xffa6('0x17')](),_0x34d99b?_0x34d99b['id']:null,_0x34d99b?_0x34d99b[_0xffa6('0x18')]:null,_0x34d99b?_0x34d99b[_0xffa6('0x19')]:null,getInteractionId(_0x29c451,_0x4d348e,_0x3bb60a),_0x29c451?JSON['stringify'](_0x29c451):'null');}function updateUser(_0x4570d5,_0x4a4317,_0x4e33dd,_0x14537d,_0x4c02af){db[_['upperFirst'](_0x14537d)+'Interaction'][_0xffa6('0x1a')]({'where':{'id':getInteractionId(_0x4a4317,_0x4e33dd,_0x14537d)}})[_0xffa6('0x1b')](function(_0x492b7f){if(_0x492b7f){return _0x492b7f[_0xffa6('0x1c')]({'UserId':_0x4570d5?_0x4570d5['id']:null});}})['then'](function(_0x3ea2e8){if(_0x3ea2e8){log(_0xffa6('0x1d'),_0x4570d5,_0x4a4317,_0x4e33dd,_0x14537d,_0x4c02af);}})['catch'](function(){log(_0xffa6('0x1e'),_0x4570d5,_0x4a4317,_0x4e33dd,_0x14537d,_0x4c02af);});}module[_0xffa6('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index aa5b04a..2d9e3e9 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 _0xa03f=['then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','findOne'];(function(_0x13f526,_0xf0f6ad){var _0x5096e7=function(_0x2e56ec){while(--_0x2e56ec){_0x13f526['push'](_0x13f526['shift']());}};_0x5096e7(++_0xf0f6ad);}(_0xa03f,0x174));var _0xfa03=function(_0x217b47,_0x13c2ac){_0x217b47=_0x217b47-0x0;var _0x2f0a01=_0xa03f[_0x217b47];return _0x2f0a01;};'use strict';var crypto=require(_0xfa03('0x0'));var util=require(_0xfa03('0x1'));var compose=require(_0xfa03('0x2'));var db=require(_0xfa03('0x3'))['db'];var config=require(_0xfa03('0x4'));function getValueFromLicense(_0xf2e0e4,_0x226d46){if(_0xf2e0e4&&_0x226d46){if(_0x226d46['data1']&&_0x226d46[_0xfa03('0x5')]){var _0x297911=_0x226d46[_0xfa03('0x6')];var _0x4b809a=_0x226d46[_0xfa03('0x5')];var _0x24cd75=_0x297911[_0xfa03('0x7')]('-')[0x4];var _0x9b1c32=_0x297911[_0xfa03('0x7')]('-')[0x0];var _0x187419=crypto['createDecipher']('aes-256-ctr',util[_0xfa03('0x8')](_0xfa03('0x9'),_0x24cd75,_0x297911,_0x9b1c32));var _0x3be309=_0x187419[_0xfa03('0xa')](_0x4b809a,_0xfa03('0xb'),_0xfa03('0xc'));_0x3be309+=_0x187419[_0xfa03('0xd')](_0xfa03('0xc'));var _0x40c2ff=JSON[_0xfa03('0xe')](_0x3be309);return _0x40c2ff[_0xfa03('0xf')](_0xf2e0e4)?_0x40c2ff[_0xf2e0e4]:null;}}return null;}function isLimit(_0x4ebf54,_0x507550,_0x10c08b,_0x5f22f3){var _0x13d728=_0x507550;return compose()[_0xfa03('0x10')](function(_0x46ab73,_0xc74e3c,_0x4b29ac){return db['License'][_0xfa03('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xfa03('0x12')](function(_0x29e086){var _0x527254=getValueFromLicense(_0x4ebf54,_0x29e086);return _0x527254?_0x527254:_0x13d728;})[_0xfa03('0x12')](function(_0x4a2769){_0x13d728=_0x4a2769;return _0x10c08b[_0xfa03('0x13')](_0x5f22f3);})['then'](function(_0x5d3e43){if(_0x5d3e43>=_0x13d728){return _0xc74e3c['status'](0x193)[_0xfa03('0x14')]({'message':util['format'](_0xfa03('0x15'),_0x4ebf54)});}_0x4b29ac();})[_0xfa03('0x16')](function(_0xbca71f){_0x4b29ac(_0xbca71f);});});}function isUserLimit(){return isLimit(_0xfa03('0x17'),0x1,db['User'],{'where':{'$or':[{'role':_0xfa03('0x18')},{'role':'user'}]}});}exports[_0xfa03('0x19')]=isUserLimit; \ No newline at end of file +var _0xcbde=['../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','hasOwnProperty','use','License','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb'];(function(_0x406644,_0xf00f88){var _0x52d888=function(_0x4d33cc){while(--_0x4d33cc){_0x406644['push'](_0x406644['shift']());}};_0x52d888(++_0xf00f88);}(_0xcbde,0x141));var _0xecbd=function(_0x500d43,_0x36d396){_0x500d43=_0x500d43-0x0;var _0x1b1258=_0xcbde[_0x500d43];return _0x1b1258;};'use strict';var crypto=require(_0xecbd('0x0'));var util=require('util');var compose=require(_0xecbd('0x1'));var db=require(_0xecbd('0x2'))['db'];var config=require(_0xecbd('0x3'));function getValueFromLicense(_0x456f7f,_0x1a4c26){if(_0x456f7f&&_0x1a4c26){if(_0x1a4c26['data1']&&_0x1a4c26['license']){var _0x12470a=_0x1a4c26[_0xecbd('0x4')];var _0x566536=_0x1a4c26[_0xecbd('0x5')];var _0x27a04d=_0x12470a['split']('-')[0x4];var _0x5d1ba5=_0x12470a[_0xecbd('0x6')]('-')[0x0];var _0x3e9e7a=crypto[_0xecbd('0x7')](_0xecbd('0x8'),util[_0xecbd('0x9')](_0xecbd('0xa'),_0x27a04d,_0x12470a,_0x5d1ba5));var _0x493b24=_0x3e9e7a[_0xecbd('0xb')](_0x566536,'base64',_0xecbd('0xc'));_0x493b24+=_0x3e9e7a['final']('utf8');var _0x3ddb13=JSON['parse'](_0x493b24);return _0x3ddb13[_0xecbd('0xd')](_0x456f7f)?_0x3ddb13[_0x456f7f]:null;}}return null;}function isLimit(_0x24ec82,_0x4cd06f,_0x3c6429,_0x444a88){var _0x447856=_0x4cd06f;return compose()[_0xecbd('0xe')](function(_0x27c02a,_0x2ba71e,_0x1f4122){return db[_0xecbd('0xf')][_0xecbd('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0xc7bb2b){var _0x1607ec=getValueFromLicense(_0x24ec82,_0xc7bb2b);return _0x1607ec?_0x1607ec:_0x447856;})[_0xecbd('0x11')](function(_0x3805a){_0x447856=_0x3805a;return _0x3c6429[_0xecbd('0x12')](_0x444a88);})[_0xecbd('0x11')](function(_0x26d4c4){if(_0x26d4c4>=_0x447856){return _0x2ba71e[_0xecbd('0x13')](0x193)[_0xecbd('0x14')]({'message':util[_0xecbd('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x24ec82)});}_0x1f4122();})[_0xecbd('0x15')](function(_0x57c160){_0x1f4122(_0x57c160);});});}function isUserLimit(){return isLimit(_0xecbd('0x16'),0x1,db[_0xecbd('0x17')],{'where':{'$or':[{'role':_0xecbd('0x18')},{'role':_0xecbd('0x19')}]}});}exports[_0xecbd('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 57e8f9b..7b5b0fa 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 _0xc488=['[$or]','and','replace','[$and]','length','split','forEach','shift','match','filter','indexOf','map','push','buildExpression','DATE','$eq','operator','includes','$lte','value','add','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','$between','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc488,0x157));var _0x8c48=function(_0x17d375,_0x455c01){_0x17d375=_0x17d375-0x0;var _0x2dcfc3=_0xc488[_0x17d375];return _0x2dcfc3;};'use strict';var _=require(_0x8c48('0x0'));var moment=require(_0x8c48('0x1'));exports[_0x8c48('0x2')]=function(_0x1514b7){var _0x3e6ae9={'conditions':[]};_0x3e6ae9[_0x8c48('0x3')]=_[_0x8c48('0x4')](_0x1514b7,_0x8c48('0x5'))?'or':_0x8c48('0x6');var _0x54ddd3=_0x1514b7[_0x8c48('0x7')](_0x8c48('0x8'),'')[_0x8c48('0x7')](_0x8c48('0x5'),'')['split']('||');for(var _0x4a5ec7=0x0;_0x4a5ec7<_0x54ddd3[_0x8c48('0x9')];_0x4a5ec7++){var _0x515355=_0x54ddd3[_0x4a5ec7][_0x8c48('0xa')](':=');var _0x296f45=_0x515355[0x0];var _0x5a57d9=_0x515355['slice'](0x1);_0x5a57d9[_0x8c48('0xb')](function(_0xaa3633){var _0x283c57=_0xaa3633[_0x8c48('0xa')]('[')[_0x8c48('0xc')]();var _0x37dc2a=_0xaa3633[_0x8c48('0xd')](/\[(.*?)\]/g);_0x37dc2a[_0x8c48('0xb')](function(_0x3a0631){var _0x462f09=_0x3a0631[_0x8c48('0xa')]('[')[_0x8c48('0xe')](function(_0x1391a9){return _0x1391a9[_0x8c48('0xf')](']')>-0x1;})[_0x8c48('0x10')](function(_0x2fd712){return _0x2fd712[_0x8c48('0xa')](']')[0x0];})[0x0];_0x3e6ae9['conditions'][_0x8c48('0x11')]({'field':_0x296f45,'operator':_0x283c57,'value':_0x462f09});});});}return _0x3e6ae9;};exports[_0x8c48('0x12')]=function(_0x43f8fd,_0x78e6af,_0x100b47){var _0x5d24ff={};if(_0x78e6af===_0x8c48('0x13')){if(_0x100b47['operator']===_0x8c48('0x14')){_0x100b47[_0x8c48('0x15')]='$between';_0x100b47['value']+=','+_0x100b47['value'];}else if(_[_0x8c48('0x16')](['$gt',_0x8c48('0x17')],_0x100b47['operator'])){_0x100b47['value']=moment(_0x100b47[_0x8c48('0x18')])[_0x8c48('0x19')](0x1,'days')[_0x8c48('0x1a')](_0x8c48('0x1b'));}}if(_0x100b47[_0x8c48('0x1c')]){_0x78e6af=_0x100b47[_0x8c48('0x1c')];_0x5d24ff[_0x8c48('0x1d')]='CAST('+_0x43f8fd+'.'+_0x100b47[_0x8c48('0x1e')]+_0x8c48('0x1f')+_0x100b47[_0x8c48('0x1c')]+')\x20'+parseOperator(_0x100b47[_0x8c48('0x15')]);}else{_0x5d24ff[_0x8c48('0x1d')]=_0x43f8fd+'.'+_0x100b47['field']+'\x20'+parseOperator(_0x100b47['operator']);}if(_['includes']([_0x8c48('0x20'),'$notIn'],_0x100b47[_0x8c48('0x15')]))_0x5d24ff[_0x8c48('0x1d')]='('+_0x5d24ff['text']+_0x8c48('0x21')+_0x43f8fd+'.'+_0x100b47[_0x8c48('0x1e')]+_0x8c48('0x22');_0x5d24ff[_0x8c48('0x18')]=parseValue(_0x78e6af,_0x100b47['operator'],_0x100b47[_0x8c48('0x18')]);return _0x5d24ff;};function parseOperator(_0x14215d){var _0xe213;switch(_0x14215d){case'$in':_0xe213=_0x8c48('0x23');break;case _0x8c48('0x24'):_0xe213=_0x8c48('0x25');break;case _0x8c48('0x14'):_0xe213=_0x8c48('0x26');break;case _0x8c48('0x20'):_0xe213=_0x8c48('0x27');break;case _0x8c48('0x28'):case _0x8c48('0x29'):case _0x8c48('0x2a'):_0xe213=_0x8c48('0x2b');break;case _0x8c48('0x2c'):_0xe213=_0x8c48('0x2d');break;case _0x8c48('0x2e'):_0xe213=_0x8c48('0x2f');break;case _0x8c48('0x17'):_0xe213=_0x8c48('0x30');break;case _0x8c48('0x31'):_0xe213=_0x8c48('0x32');break;case _0x8c48('0x33'):_0xe213='BETWEEN\x20?\x20AND\x20?';break;}return _0xe213;}function parseValue(_0x189d34,_0x2dfa2e,_0x484dd9){var _0x7984bc={'start':undefined,'end':undefined};switch(_0x2dfa2e){case'$in':case _0x8c48('0x24'):_0x7984bc[_0x8c48('0x34')]=_0x484dd9[_0x8c48('0xa')](',');break;case _0x8c48('0x28'):_0x7984bc[_0x8c48('0x34')]='%'+_0x484dd9+'%';break;case'$startsWith':_0x7984bc[_0x8c48('0x34')]=_0x484dd9+'%';break;case _0x8c48('0x2a'):_0x7984bc[_0x8c48('0x34')]='%'+_0x484dd9;break;case _0x8c48('0x33'):var _0x52da59=_0x484dd9[_0x8c48('0xa')](',');var _0x484dd9=_0x52da59[_0x8c48('0xc')]();var _0x1a9dc8=_0x52da59[_0x8c48('0x35')]();if(_0x189d34===_0x8c48('0x13')){_0x484dd9=moment(_0x484dd9)[_0x8c48('0x36')](0x0,!![])[_0x8c48('0x1a')]();_0x1a9dc8=moment(_0x1a9dc8)[_0x8c48('0x36')](0x0,!![])[_0x8c48('0x19')](0x17,_0x8c48('0x37'))[_0x8c48('0x19')](0x3b,_0x8c48('0x38'))[_0x8c48('0x19')](0x3b,_0x8c48('0x39'))[_0x8c48('0x1a')]();}_0x7984bc={'start':_0x484dd9,'end':_0x1a9dc8};break;default:_0x7984bc[_0x8c48('0x34')]=_0x484dd9;break;}return _0x7984bc;} \ No newline at end of file +var _0x7c16=['$eq','$between','value','includes','$gt','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','start','pop','utcOffset','add','hours','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator'];(function(_0x177f5b,_0x5c095a){var _0x515bec=function(_0x41594e){while(--_0x41594e){_0x177f5b['push'](_0x177f5b['shift']());}};_0x515bec(++_0x5c095a);}(_0x7c16,0x136));var _0x67c1=function(_0x53ba30,_0x210d1e){_0x53ba30=_0x53ba30-0x0;var _0x46e47a=_0x7c16[_0x53ba30];return _0x46e47a;};'use strict';var _=require('lodash');var moment=require(_0x67c1('0x0'));exports[_0x67c1('0x1')]=function(_0x48e8f8){var _0x1f8909={'conditions':[]};_0x1f8909[_0x67c1('0x2')]=_[_0x67c1('0x3')](_0x48e8f8,_0x67c1('0x4'))?'or':'and';var _0x24a4b0=_0x48e8f8[_0x67c1('0x5')](_0x67c1('0x6'),'')[_0x67c1('0x5')]('[$or]','')[_0x67c1('0x7')]('||');for(var _0x15b51a=0x0;_0x15b51a<_0x24a4b0[_0x67c1('0x8')];_0x15b51a++){var _0x3579dd=_0x24a4b0[_0x15b51a]['split'](':=');var _0x9afee4=_0x3579dd[0x0];var _0x11efd7=_0x3579dd[_0x67c1('0x9')](0x1);_0x11efd7[_0x67c1('0xa')](function(_0xe8157a){var _0x1f72e5=_0xe8157a[_0x67c1('0x7')]('[')[_0x67c1('0xb')]();var _0x3a43e2=_0xe8157a[_0x67c1('0xc')](/\[(.*?)\]/g);_0x3a43e2[_0x67c1('0xa')](function(_0x51acf2){var _0x48a913=_0x51acf2['split']('[')[_0x67c1('0xd')](function(_0x5cd621){return _0x5cd621[_0x67c1('0xe')](']')>-0x1;})['map'](function(_0x3ffa72){return _0x3ffa72[_0x67c1('0x7')](']')[0x0];})[0x0];_0x1f8909[_0x67c1('0xf')][_0x67c1('0x10')]({'field':_0x9afee4,'operator':_0x1f72e5,'value':_0x48a913});});});}return _0x1f8909;};exports[_0x67c1('0x11')]=function(_0x3b44ad,_0x409370,_0x384a21){var _0x5e72ba={};if(_0x409370===_0x67c1('0x12')){if(_0x384a21[_0x67c1('0x13')]===_0x67c1('0x14')){_0x384a21[_0x67c1('0x13')]=_0x67c1('0x15');_0x384a21[_0x67c1('0x16')]+=','+_0x384a21[_0x67c1('0x16')];}else if(_[_0x67c1('0x17')]([_0x67c1('0x18'),'$lte'],_0x384a21[_0x67c1('0x13')])){_0x384a21[_0x67c1('0x16')]=moment(_0x384a21['value'])['add'](0x1,_0x67c1('0x19'))[_0x67c1('0x1a')](_0x67c1('0x1b'));}}if(_0x384a21[_0x67c1('0x1c')]){_0x409370=_0x384a21[_0x67c1('0x1c')];_0x5e72ba[_0x67c1('0x1d')]='CAST('+_0x3b44ad+'.'+_0x384a21[_0x67c1('0x1e')]+_0x67c1('0x1f')+_0x384a21['castTo']+')\x20'+parseOperator(_0x384a21[_0x67c1('0x13')]);}else{_0x5e72ba['text']=_0x3b44ad+'.'+_0x384a21['field']+'\x20'+parseOperator(_0x384a21[_0x67c1('0x13')]);}if(_[_0x67c1('0x17')](['$ne','$notIn'],_0x384a21[_0x67c1('0x13')]))_0x5e72ba[_0x67c1('0x1d')]='('+_0x5e72ba[_0x67c1('0x1d')]+'\x20OR\x20'+_0x3b44ad+'.'+_0x384a21[_0x67c1('0x1e')]+'\x20IS\x20NULL)';_0x5e72ba[_0x67c1('0x16')]=parseValue(_0x409370,_0x384a21['operator'],_0x384a21[_0x67c1('0x16')]);return _0x5e72ba;};function parseOperator(_0xc8d4bf){var _0x40bcb8;switch(_0xc8d4bf){case _0x67c1('0x20'):_0x40bcb8=_0x67c1('0x21');break;case _0x67c1('0x22'):_0x40bcb8=_0x67c1('0x23');break;case _0x67c1('0x14'):_0x40bcb8=_0x67c1('0x24');break;case _0x67c1('0x25'):_0x40bcb8=_0x67c1('0x26');break;case _0x67c1('0x27'):case _0x67c1('0x28'):case _0x67c1('0x29'):_0x40bcb8='LIKE\x20?';break;case'$lt':_0x40bcb8=_0x67c1('0x2a');break;case _0x67c1('0x18'):_0x40bcb8=_0x67c1('0x2b');break;case _0x67c1('0x2c'):_0x40bcb8=_0x67c1('0x2d');break;case _0x67c1('0x2e'):_0x40bcb8=_0x67c1('0x2f');break;case'$between':_0x40bcb8='BETWEEN\x20?\x20AND\x20?';break;}return _0x40bcb8;}function parseValue(_0x1dd683,_0xd99823,_0x1c45a8){var _0x506b05={'start':undefined,'end':undefined};switch(_0xd99823){case'$in':case'$notIn':_0x506b05[_0x67c1('0x30')]=_0x1c45a8['split'](',');break;case _0x67c1('0x27'):_0x506b05[_0x67c1('0x30')]='%'+_0x1c45a8+'%';break;case _0x67c1('0x28'):_0x506b05[_0x67c1('0x30')]=_0x1c45a8+'%';break;case'$endsWith':_0x506b05['start']='%'+_0x1c45a8;break;case _0x67c1('0x15'):var _0x1833d7=_0x1c45a8['split'](',');var _0x1c45a8=_0x1833d7[_0x67c1('0xb')]();var _0x1daca1=_0x1833d7[_0x67c1('0x31')]();if(_0x1dd683===_0x67c1('0x12')){_0x1c45a8=moment(_0x1c45a8)[_0x67c1('0x32')](0x0,!![])[_0x67c1('0x1a')]();_0x1daca1=moment(_0x1daca1)['utcOffset'](0x0,!![])[_0x67c1('0x33')](0x17,_0x67c1('0x34'))[_0x67c1('0x33')](0x3b,_0x67c1('0x35'))[_0x67c1('0x33')](0x3b,_0x67c1('0x36'))[_0x67c1('0x1a')]();}_0x506b05={'start':_0x1c45a8,'end':_0x1daca1};break;default:_0x506b05[_0x67c1('0x30')]=_0x1c45a8;break;}return _0x506b05;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 1961922..087e645 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 _0xf781=['length','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','name','attributes','nolimit','order','pick','filter','object','columns','value','where','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','DESC','unsigned','omit'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0xf781,0x125));var _0x1f78=function(_0x4bd8ce,_0x363ab3){_0x4bd8ce=_0x4bd8ce-0x0;var _0x2199a3=_0xf781[_0x4bd8ce];return _0x2199a3;};'use strict';var _=require(_0x1f78('0x0'));var sequelize=require(_0x1f78('0x1'));var moment=require(_0x1f78('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x398ed5){var _0x1c9c9c=['ne'];try{var _0x524e42=JSON[_0x1f78('0x3')](_0x398ed5);var _0x592885=Object[_0x1f78('0x4')](_0x524e42)[0x0];return _0x1c9c9c[_0x1f78('0x5')](_0x592885);}catch(_0x1486cf){return![];}}function getOperatorValue(_0x41a44b){var _0x487bbf=JSON['parse'](_0x41a44b);var _0xe2e20d=Object[_0x1f78('0x4')](_0x487bbf)[0x0];var _0x479741=_0x487bbf[_0xe2e20d];return{['$'+_0xe2e20d]:_0x479741};}exports[_0x1f78('0x6')]=function(_0x276196){var _0x30fc1d=null;if(_0x276196){_0x30fc1d=_0x276196[_0x1f78('0x7')](',');}return _0x30fc1d;};exports[_0x1f78('0x8')]=function(_0x118d25,_0x3abd0e){var _0x459d32={};if(!_[_0x1f78('0x9')](_0x118d25)){_['forOwn'](_0x118d25,function(_0xc6ab4c,_0x48261e){try{if(_0x3abd0e){var _0x563d8b=_['find'](_0x3abd0e,{'name':_0x48261e})||{};if(hasSequelizeOperator(_0xc6ab4c)){_0x459d32[_0x48261e]=getOperatorValue(_0xc6ab4c);}else if(_0x563d8b[_0x1f78('0xa')]===_0x1f78('0xb')&&_[_0x1f78('0xc')](_0xc6ab4c)){var _0x34998f=JSON[_0x1f78('0x3')](_0xc6ab4c);var _0x2fc53f={'$gte':moment(moment(_0x34998f[_0x1f78('0xd')])[_0x1f78('0xe')](_0x1f78('0xf')))['utc']()[_0x1f78('0xe')](),'$lte':moment(moment(_0x34998f[_0x1f78('0x10')])[_0x1f78('0xe')](_0x1f78('0xf')))[_0x1f78('0x11')]()[_0x1f78('0x12')](0x1,'s')['format']()};_0x459d32[_0x48261e]=_0x2fc53f;}else if(_0x563d8b['name']===_0x1f78('0x13')){_0x459d32[_0x48261e]=_0xc6ab4c;}else{_0x459d32[_0x48261e]=_[_0x1f78('0x14')](_0xc6ab4c)?_0xc6ab4c:JSON[_0x1f78('0x3')](_0xc6ab4c);}}else{_0x459d32[_0x48261e]=_[_0x1f78('0x14')](_0xc6ab4c)?_0xc6ab4c:JSON['parse'](_0xc6ab4c);}}catch(_0x289aac){_0x459d32[_0x48261e]=_0xc6ab4c[_0x1f78('0x7')](',');}});}return _0x459d32;};exports[_0x1f78('0x15')]=function(_0x37e31c){_0x37e31c=parseInt(_0x37e31c,0xa);if(!_0x37e31c||_0x37e31c<0x0){_0x37e31c=LIMIT_VALUE;}return _0x37e31c;};exports[_0x1f78('0x16')]=function(_0x3c1073){_0x3c1073=parseInt(_0x3c1073,0xa);if(!_0x3c1073||_0x3c1073<0x0){_0x3c1073=0x0;}return _0x3c1073;};exports[_0x1f78('0x17')]=function(_0x5aa57a){var _0x31760b,_0x4a5761=null;if(_0x5aa57a){_0x31760b=_0x5aa57a[_0x1f78('0x7')](',');_0x4a5761=_[_0x1f78('0x18')](_0x31760b,function(_0x5aab9d){if(_0x5aab9d[_0x1f78('0x19')]('-')===0x0){return[_0x5aab9d===_0x1f78('0x1a')?sequelize[_0x1f78('0x1b')](sequelize[_0x1f78('0x1c')]('priority'),'unsigned'):_0x5aab9d['substr'](0x1),_0x1f78('0x1d')];}else{return[_0x5aab9d===_0x1f78('0x1a')?sequelize['cast'](sequelize['col']('priority'),_0x1f78('0x1e')):_0x5aab9d,'ASC'];}});}return _0x4a5761;};exports[_0x1f78('0x1f')]=function(_0x51abe1,_0x508749){if(_['isEmpty'](_0x51abe1)){return _0x51abe1;}if(_[_0x1f78('0x14')](_0x51abe1)){for(var _0x133790=0x0;_0x133790<_0x51abe1[_0x1f78('0x20')];_0x133790+=0x1){_0x51abe1[_0x133790]=this[_0x1f78('0x1f')](_0x51abe1[_0x133790],_0x508749);}return _0x51abe1;}if(!_['isObject'](_0x51abe1)){return _0x51abe1;}if(_[_0x1f78('0x21')](_0x508749)){_0x508749=[_0x508749];}if(!_[_0x1f78('0x14')](_0x508749)){return _0x51abe1;}for(var _0x4f08d3=0x0;_0x4f08d3<_0x508749[_0x1f78('0x20')];_0x4f08d3+=0x1){_[_0x1f78('0x22')](_0x51abe1,_0x508749[_0x4f08d3]);}for(var _0x24edc7 in _0x51abe1){if(_0x51abe1[_0x1f78('0x23')](_0x24edc7)){_0x51abe1[_0x24edc7]=this[_0x1f78('0x1f')](_0x51abe1[_0x24edc7],_0x508749);}}return _0x51abe1;};exports[_0x1f78('0x24')]=function(_0x2349b8){return _0x2349b8[_0x1f78('0x25')](RegExp(_0x1f78('0x26')))?!![]:![];};exports[_0x1f78('0x27')]=function(_0x303d3d){return _0x303d3d['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x1f78('0x28')]=function(_0x38cccb,_0x3a5504){var _0x28eabc=[];var _0x526e2f=/[ `!@#$%^&*()_\-?~]/;var _0x3de753=_0x3a5504?_0x1f78('0x29'):_0x1f78('0x2a');_0x38cccb['split'](/[ ,]+/)[_0x1f78('0x2b')](function(_0x494f7d){_0x494f7d=_0x494f7d[_0x1f78('0x2c')](/([^:]")"+/g,'$1');_0x494f7d='+'+_0x494f7d+'*';var _0x30b7a4=_0x494f7d[_0x1f78('0x25')](_0x526e2f);if(_0x30b7a4){_0x494f7d='\x22'+_0x494f7d+'\x22';}_0x28eabc[_0x1f78('0x2d')](_0x494f7d);});_0x3de753=_0x3de753['replace'](_0x1f78('0x2a'),_0x28eabc[_0x1f78('0x2e')]('\x20'));return _0x3de753;};exports[_0x1f78('0x2f')]=function(_0x84d4f6,_0x232ef1,_0x56a85f){var _0x42fa6f={},_0x8dcdae={};if(_0x232ef1[_0x1f78('0x30')][_0x1f78('0x31')]){_0x232ef1[_0x1f78('0x30')]['id']=_0x232ef1[_0x1f78('0x30')][_0x1f78('0x31')];delete _0x232ef1['query'][_0x1f78('0x31')];}_0x42fa6f[_0x1f78('0x32')]=_[_0x1f78('0x18')](_0x84d4f6,_0x1f78('0x33'));_0x42fa6f['query']=_[_0x1f78('0x4')](_0x232ef1[_0x1f78('0x30')]);_0x42fa6f[_0x1f78('0x8')]=_['intersection'](_0x42fa6f[_0x1f78('0x32')],_0x42fa6f[_0x1f78('0x30')]);_0x8dcdae['attributes']=_['intersection'](_0x42fa6f[_0x1f78('0x32')],this[_0x1f78('0x6')](_0x232ef1[_0x1f78('0x30')]['fields']));_0x8dcdae[_0x1f78('0x34')]=_0x8dcdae[_0x1f78('0x34')]['length']?_0x8dcdae[_0x1f78('0x34')]:_0x42fa6f[_0x1f78('0x32')];if(!_0x232ef1[_0x1f78('0x30')][_0x1f78('0x23')](_0x1f78('0x35'))){_0x8dcdae['limit']=this['limit'](_0x232ef1[_0x1f78('0x30')]['limit']);_0x8dcdae[_0x1f78('0x16')]=this['offset'](_0x232ef1[_0x1f78('0x30')][_0x1f78('0x16')]);}_0x8dcdae[_0x1f78('0x36')]=this[_0x1f78('0x17')](_0x232ef1[_0x1f78('0x30')][_0x1f78('0x17')]);_0x8dcdae['where']=this[_0x1f78('0x8')](_[_0x1f78('0x37')](_0x232ef1[_0x1f78('0x30')],_0x42fa6f[_0x1f78('0x8')]),_0x84d4f6);if(_0x232ef1[_0x1f78('0x30')][_0x1f78('0x38')]){var _0x5dc865=_0x84d4f6;var _0x5e7fd6=_0x232ef1[_0x1f78('0x30')][_0x1f78('0x38')];if(typeof _0x5e7fd6===_0x1f78('0x39')){_0x5dc865=_[_0x1f78('0x38')](_0x84d4f6,function(_0x5d8a56){return _[_0x1f78('0x5')](_0x5e7fd6[_0x1f78('0x3a')],_0x5d8a56[_0x1f78('0x33')]);});_0x5e7fd6=_0x5e7fd6[_0x1f78('0x3b')];}_0x8dcdae[_0x1f78('0x3c')]=_[_0x1f78('0x3d')](_0x8dcdae['where'],{'$or':_[_0x1f78('0x18')](_0x5dc865,function(_0x5780fb){if(_0x5780fb[_0x1f78('0xa')]!==_0x1f78('0x3e')){if(_0x56a85f){return sequelize[_0x1f78('0x3c')](sequelize['fn'](_0x1f78('0x3f'),sequelize[_0x1f78('0x1c')](_0x5780fb[_0x1f78('0x33')])),{'$like':sequelize['fn']('lower','%'+_0x232ef1[_0x1f78('0x30')][_0x1f78('0x38')]+'%')});}else{var _0x2cd853={};_0x2cd853[_0x5780fb[_0x1f78('0x33')]]={'$like':'%'+_0x232ef1['query'][_0x1f78('0x38')]+'%'};return _0x2cd853;}}})});}_0x8dcdae=_[_0x1f78('0x3d')]({},_0x8dcdae,_0x232ef1[_0x1f78('0x40')]);return _0x8dcdae;}; \ No newline at end of file +var _0x8d13=['order','where','pick','filter','object','value','merge','VIRTUAL','lower','options','sequelize','moment','parse','keys','includes','fields','split','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','offset','sort','priority','cast','DESC','col','unsigned','ASC','omit','length','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','replace','push','join','getOptions','query','$id','model','map','filters','attributes','intersection','nolimit'];(function(_0x1d4eb5,_0xa3107b){var _0x395c26=function(_0x2791de){while(--_0x2791de){_0x1d4eb5['push'](_0x1d4eb5['shift']());}};_0x395c26(++_0xa3107b);}(_0x8d13,0x106));var _0x38d1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8d13[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var sequelize=require(_0x38d1('0x0'));var moment=require(_0x38d1('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xd35b5e){var _0x48938e=['ne'];try{var _0x2ee83b=JSON[_0x38d1('0x2')](_0xd35b5e);var _0x19903d=Object[_0x38d1('0x3')](_0x2ee83b)[0x0];return _0x48938e[_0x38d1('0x4')](_0x19903d);}catch(_0x1b88df){return![];}}function getOperatorValue(_0x514268){var _0x145ce4=JSON[_0x38d1('0x2')](_0x514268);var _0x3a6ef2=Object[_0x38d1('0x3')](_0x145ce4)[0x0];var _0x5d0837=_0x145ce4[_0x3a6ef2];return{['$'+_0x3a6ef2]:_0x5d0837};}exports[_0x38d1('0x5')]=function(_0xe05353){var _0x12e694=null;if(_0xe05353){_0x12e694=_0xe05353[_0x38d1('0x6')](',');}return _0x12e694;};exports['filters']=function(_0x24a34b,_0x428876){var _0xcf2b67={};if(!_[_0x38d1('0x7')](_0x24a34b)){_[_0x38d1('0x8')](_0x24a34b,function(_0x3e6dd9,_0x1be308){try{if(_0x428876){var _0x5abf44=_[_0x38d1('0x9')](_0x428876,{'name':_0x1be308})||{};if(hasSequelizeOperator(_0x3e6dd9)){_0xcf2b67[_0x1be308]=getOperatorValue(_0x3e6dd9);}else if(_0x5abf44[_0x38d1('0xa')]===_0x38d1('0xb')&&_[_0x38d1('0xc')](_0x3e6dd9)){var _0x34516e=JSON[_0x38d1('0x2')](_0x3e6dd9);var _0x3b9e2a={'$gte':moment(moment(_0x34516e[_0x38d1('0xd')])[_0x38d1('0xe')](_0x38d1('0xf')))[_0x38d1('0x10')]()['format'](),'$lte':moment(moment(_0x34516e['$lte'])[_0x38d1('0xe')](_0x38d1('0xf')))[_0x38d1('0x10')]()[_0x38d1('0x11')](0x1,'s')[_0x38d1('0xe')]()};_0xcf2b67[_0x1be308]=_0x3b9e2a;}else if(_0x5abf44[_0x38d1('0x12')]===_0x38d1('0x13')){_0xcf2b67[_0x1be308]=_0x3e6dd9;}else{_0xcf2b67[_0x1be308]=_['isArray'](_0x3e6dd9)?_0x3e6dd9:JSON[_0x38d1('0x2')](_0x3e6dd9);}}else{_0xcf2b67[_0x1be308]=_[_0x38d1('0x14')](_0x3e6dd9)?_0x3e6dd9:JSON[_0x38d1('0x2')](_0x3e6dd9);}}catch(_0x238a28){_0xcf2b67[_0x1be308]=_0x3e6dd9[_0x38d1('0x6')](',');}});}return _0xcf2b67;};exports[_0x38d1('0x15')]=function(_0x2aa9c3){_0x2aa9c3=parseInt(_0x2aa9c3,0xa);if(!_0x2aa9c3||_0x2aa9c3<0x0){_0x2aa9c3=LIMIT_VALUE;}return _0x2aa9c3;};exports[_0x38d1('0x16')]=function(_0x152917){_0x152917=parseInt(_0x152917,0xa);if(!_0x152917||_0x152917<0x0){_0x152917=0x0;}return _0x152917;};exports[_0x38d1('0x17')]=function(_0x2007f0){var _0x35ed0b,_0x101ce1=null;if(_0x2007f0){_0x35ed0b=_0x2007f0['split'](',');_0x101ce1=_['map'](_0x35ed0b,function(_0x1c868f){if(_0x1c868f['indexOf']('-')===0x0){return[_0x1c868f===_0x38d1('0x18')?sequelize[_0x38d1('0x19')](sequelize['col'](_0x38d1('0x18')),'unsigned'):_0x1c868f['substr'](0x1),_0x38d1('0x1a')];}else{return[_0x1c868f==='priority'?sequelize[_0x38d1('0x19')](sequelize[_0x38d1('0x1b')]('priority'),_0x38d1('0x1c')):_0x1c868f,_0x38d1('0x1d')];}});}return _0x101ce1;};exports[_0x38d1('0x1e')]=function(_0x54b055,_0x4e2636){if(_[_0x38d1('0x7')](_0x54b055)){return _0x54b055;}if(_[_0x38d1('0x14')](_0x54b055)){for(var _0x2ba4d1=0x0;_0x2ba4d1<_0x54b055[_0x38d1('0x1f')];_0x2ba4d1+=0x1){_0x54b055[_0x2ba4d1]=this[_0x38d1('0x1e')](_0x54b055[_0x2ba4d1],_0x4e2636);}return _0x54b055;}if(!_['isObject'](_0x54b055)){return _0x54b055;}if(_[_0x38d1('0x20')](_0x4e2636)){_0x4e2636=[_0x4e2636];}if(!_[_0x38d1('0x14')](_0x4e2636)){return _0x54b055;}for(var _0x20a598=0x0;_0x20a598<_0x4e2636[_0x38d1('0x1f')];_0x20a598+=0x1){_[_0x38d1('0x21')](_0x54b055,_0x4e2636[_0x20a598]);}for(var _0x1eb838 in _0x54b055){if(_0x54b055[_0x38d1('0x22')](_0x1eb838)){_0x54b055[_0x1eb838]=this[_0x38d1('0x1e')](_0x54b055[_0x1eb838],_0x4e2636);}}return _0x54b055;};exports[_0x38d1('0x23')]=function(_0x44542f){return _0x44542f[_0x38d1('0x24')](RegExp(_0x38d1('0x25')))?!![]:![];};exports[_0x38d1('0x26')]=function(_0x18cf8f){return _0x18cf8f[_0x38d1('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x38d1('0x27')]=function(_0x3b880c,_0x53f820){var _0x16c390=[];var _0x465fec=/[ `!@#$%^&*()_\-?~]/;var _0x310c01=_0x53f820?'\x22{EXPR}\x22':_0x38d1('0x28');_0x3b880c[_0x38d1('0x6')](/[ ,]+/)['forEach'](function(_0x29a272){_0x29a272=_0x29a272[_0x38d1('0x29')](/([^:]")"+/g,'$1');_0x29a272='+'+_0x29a272+'*';var _0x2d3a59=_0x29a272[_0x38d1('0x24')](_0x465fec);if(_0x2d3a59){_0x29a272='\x22'+_0x29a272+'\x22';}_0x16c390[_0x38d1('0x2a')](_0x29a272);});_0x310c01=_0x310c01[_0x38d1('0x29')](_0x38d1('0x28'),_0x16c390[_0x38d1('0x2b')]('\x20'));return _0x310c01;};exports[_0x38d1('0x2c')]=function(_0x504881,_0x24ad11,_0x593ec6){var _0x212356={},_0x58c507={};if(_0x24ad11[_0x38d1('0x2d')][_0x38d1('0x2e')]){_0x24ad11[_0x38d1('0x2d')]['id']=_0x24ad11[_0x38d1('0x2d')][_0x38d1('0x2e')];delete _0x24ad11[_0x38d1('0x2d')][_0x38d1('0x2e')];}_0x212356[_0x38d1('0x2f')]=_[_0x38d1('0x30')](_0x504881,_0x38d1('0x12'));_0x212356['query']=_['keys'](_0x24ad11['query']);_0x212356[_0x38d1('0x31')]=_['intersection'](_0x212356[_0x38d1('0x2f')],_0x212356['query']);_0x58c507[_0x38d1('0x32')]=_[_0x38d1('0x33')](_0x212356[_0x38d1('0x2f')],this['fields'](_0x24ad11['query']['fields']));_0x58c507['attributes']=_0x58c507[_0x38d1('0x32')]['length']?_0x58c507[_0x38d1('0x32')]:_0x212356[_0x38d1('0x2f')];if(!_0x24ad11[_0x38d1('0x2d')][_0x38d1('0x22')](_0x38d1('0x34'))){_0x58c507[_0x38d1('0x15')]=this[_0x38d1('0x15')](_0x24ad11['query'][_0x38d1('0x15')]);_0x58c507[_0x38d1('0x16')]=this[_0x38d1('0x16')](_0x24ad11[_0x38d1('0x2d')][_0x38d1('0x16')]);}_0x58c507[_0x38d1('0x35')]=this[_0x38d1('0x17')](_0x24ad11[_0x38d1('0x2d')][_0x38d1('0x17')]);_0x58c507[_0x38d1('0x36')]=this[_0x38d1('0x31')](_[_0x38d1('0x37')](_0x24ad11[_0x38d1('0x2d')],_0x212356[_0x38d1('0x31')]),_0x504881);if(_0x24ad11[_0x38d1('0x2d')]['filter']){var _0x54f885=_0x504881;var _0xb0e569=_0x24ad11[_0x38d1('0x2d')][_0x38d1('0x38')];if(typeof _0xb0e569===_0x38d1('0x39')){_0x54f885=_[_0x38d1('0x38')](_0x504881,function(_0x337283){return _[_0x38d1('0x4')](_0xb0e569['columns'],_0x337283['name']);});_0xb0e569=_0xb0e569[_0x38d1('0x3a')];}_0x58c507[_0x38d1('0x36')]=_[_0x38d1('0x3b')](_0x58c507[_0x38d1('0x36')],{'$or':_[_0x38d1('0x30')](_0x54f885,function(_0x6c70fe){if(_0x6c70fe[_0x38d1('0xa')]!==_0x38d1('0x3c')){if(_0x593ec6){return sequelize['where'](sequelize['fn'](_0x38d1('0x3d'),sequelize[_0x38d1('0x1b')](_0x6c70fe['name'])),{'$like':sequelize['fn'](_0x38d1('0x3d'),'%'+_0x24ad11['query'][_0x38d1('0x38')]+'%')});}else{var _0x3fe054={};_0x3fe054[_0x6c70fe[_0x38d1('0x12')]]={'$like':'%'+_0x24ad11['query'][_0x38d1('0x38')]+'%'};return _0x3fe054;}}})});}_0x58c507=_['merge']({},_0x58c507,_0x24ad11[_0x38d1('0x3e')]);return _0x58c507;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index ab02769..b94f4b0 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 _0xea7d=['openchannelPause','whatsappPause','pauseType','find','merge','getSortedAgentsIdsByStatus','split','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','includes','internal','substring','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','lodash','../../mysqldb','client','chatPause','faxPause','smsPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','voiceStatus','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','startCase','map','getAgents','all','flatten','value','getAgentIdsByQueues','getAgentIdsByStatus','User','findAll','name','fullname','mailPause'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0xea7d,0x88));var _0xdea7=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0xea7d[_0x553a87];return _0x12d1e6;};'use strict';var _=require(_0xdea7('0x0'));var jayson=require('jayson/promise');var db=require(_0xdea7('0x1'))['db'];var amiClient=jayson[_0xdea7('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0xdea7('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x44f735,_0x45ce06){var _0x17451c=[_0x44f735[_0xdea7('0x3')],_0x44f735[_0xdea7('0x4')],_0x44f735['mailPause'],_0x44f735['openchannelPause'],_0x44f735[_0xdea7('0x5')],_0x44f735[_0xdea7('0x6')],_0x44f735['whatsappPause']];if(!_0x45ce06)return _[_0xdea7('0x7')](_0x17451c);var _0x3734aa=_[_0xdea7('0x8')](_0x17451c);return _0x3734aa[_0xdea7('0x9')]>0x0&&_0x3734aa[_0xdea7('0x9')]<_0x17451c['length']?!![]:![];}function isIdle(_0xdd7a10){return _0xdd7a10===_0xdea7('0xa')||_0xdd7a10===_0xdea7('0xb')||_0xdd7a10===_0xdea7('0xc')||_0xdd7a10===_0xdea7('0xd')||_['isNil'](_0xdd7a10);}function isAgentIdle(_0x33800a){if(_0x33800a[_0xdea7('0xe')]!==_0xdea7('0xa')&&_0x33800a[_0xdea7('0x6')]){_0x33800a[_0xdea7('0xe')]='pause';return![];}return _['every']([_0x33800a[_0xdea7('0xf')],_0x33800a[_0xdea7('0x10')],_0x33800a[_0xdea7('0x11')],_0x33800a[_0xdea7('0x12')],_0x33800a[_0xdea7('0x13')],_0x33800a[_0xdea7('0xe')],_0x33800a[_0xdea7('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xdea7('0x15')](_0xdea7('0x16'),{})['then'](function(_0x55686c){if(_0x55686c[_0xdea7('0x17')]){throw new Error(_0xdea7('0x18'));}var _0x23ec8e=_0x55686c[_0xdea7('0x19')];return routingClient[_0xdea7('0x15')](_0xdea7('0x16'),{})[_0xdea7('0x1a')](function(_0x7e5d82){if(_0x7e5d82[_0xdea7('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4d666f=_0x7e5d82['result'];return _['merge']({},_0x23ec8e,_0x4d666f);});})[_0xdea7('0x1b')](function(_0x1d9686){throw _0x1d9686;});}exports[_0xdea7('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x12c280){var _0x4850b5=_0xdea7('0xb');if(isAgentPaused(_0x12c280))_0x4850b5=_0xdea7('0x1d');else if(isAgentPaused(_0x12c280,!![]))_0x4850b5=_0xdea7('0x1e');else if(isAgentIdle(_0x12c280))_0x4850b5=_0xdea7('0xa');else _0x4850b5=_0xdea7('0x1f');return _0x4850b5;}exports[_0xdea7('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x21877c,_0xa24f7d){var _0x24267c=_['isArray'](_0x21877c)?_0x21877c:[_0x21877c];var _0x543e6a=_[_0xdea7('0x21')](_0xa24f7d)+'Queue';var _0x3ccd7d=_[_0xdea7('0x22')](_0x24267c,function(_0x4692ad){return db[_0x543e6a]['findOne']({'where':{'id':_0x4692ad}})[_0xdea7('0x1a')](function(_0x4e1ccd){if(!_0x4e1ccd)return[];return _0x4e1ccd[_0xdea7('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xdea7('0x24')](_0x3ccd7d)[_0xdea7('0x1a')](function(_0x1be059){var _0x2f3da0=_(_0x1be059)[_0xdea7('0x25')]()['map']('id')['uniq']()[_0xdea7('0x26')]();return _0x2f3da0;});}exports[_0xdea7('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1a30d9,_0xead704,_0x4580f0){try{if(_0xead704[_0xdea7('0x9')]>0x0){_0x1a30d9=_0x1a30d9['filter'](function(_0x28a463){return _0xead704['includes'](_0x28a463['id']);});}var _0x24ccbd=_0x1a30d9['filter'](function(_0xec02e8){var _0x54ef01=_0xdea7('0x1f');if(isAgentIdle(_0xec02e8)){_0x54ef01=_0xdea7('0xa');}return _0x54ef01===_0x4580f0;});return _[_0xdea7('0x22')](_0x24ccbd,'id');}catch(_0x3c1846){throw _0x3c1846;}}exports[_0xdea7('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x26a4e1,_0x1a72a1,_0x14ae8b){return Promise['resolve']()['then'](function(){if(_0x1a72a1[_0xdea7('0x9')]>0x0){_0x26a4e1=_0x26a4e1[_0xdea7('0x8')](function(_0x5a18d9){return _0x1a72a1['includes'](_0x5a18d9['id']);});}return _0x26a4e1;})['then'](function(){return db[_0xdea7('0x29')][_0xdea7('0x2a')]({'attributes':['id',_0xdea7('0x2b'),_0xdea7('0x2c'),_0xdea7('0x3'),_0xdea7('0x4'),_0xdea7('0x2d'),_0xdea7('0x2e'),'smsPause','voicePause',_0xdea7('0x2f'),_0xdea7('0x30')],'where':{'id':{'$in':_['map'](_0x26a4e1,'id')}},'raw':!![]});})[_0xdea7('0x1a')](function(_0x5382cf){return _0x5382cf[_0xdea7('0x22')](function(_0x4a17be){var _0x4343f5=_[_0xdea7('0x31')](_0x26a4e1,['id',_0x4a17be['id']]);var _0x43fedc=filterAgentAttributes(_0x4343f5);_[_0xdea7('0x32')](_0x4a17be,_0x43fedc);_0x4a17be['globalStatus']=getAgentStatus(_0x4a17be);return _0x4a17be;});})[_0xdea7('0x1a')](function(_0x21ab81){var _0x5bb676=sortAgentsByStatus(_0x21ab81,_0x14ae8b);return _['map'](_0x5bb676,'id');})[_0xdea7('0x1b')](function(_0x5ca190){throw _0x5ca190;});}exports[_0xdea7('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4860bc){var _0xcbe3de={'fields':[],'order':null};var _0x42a831=_0x4860bc[_0xdea7('0x34')](',');_0xcbe3de['fields']=_[_0xdea7('0x8')](_0x42a831,function(_0x170baf){if(!_0x170baf['includes'](_0xdea7('0x35'))){return!![];}_0xcbe3de[_0xdea7('0x36')]=_[_0xdea7('0x37')](_0x170baf,'-')?_0xdea7('0x38'):_0xdea7('0x39');return![];});return _0xcbe3de;}exports[_0xdea7('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x21d26f){if(_0x21d26f[_0xdea7('0x3b')](_0xdea7('0x2c'))&&!_0x21d26f['includes'](_0xdea7('0x3c'))){var _0x9c99e2=_0x21d26f[_0xdea7('0x3d')](0x0,_0x21d26f['indexOf']('fullname'));_0x21d26f+=','+_0x9c99e2+_0xdea7('0x3c');}return _0x21d26f;}exports[_0xdea7('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x16cfcc,_0x40ab8f){var _0x496142=_0x16cfcc[_0xdea7('0x3f')](function(_0x3d4702,_0x326091){if(_0x3d4702[_0xdea7('0x35')]===_0x326091['globalStatus']){if(_0x3d4702[_0xdea7('0x35')]===_0xdea7('0x1d')){if(_0x40ab8f===_0xdea7('0x38')){return(_0x3d4702[_0xdea7('0x30')]||'')<(_0x326091['pauseType']||'')||_0x3d4702[_0xdea7('0x2c')][_0xdea7('0x40')]()>_0x326091['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x3d4702[_0xdea7('0x30')]||'')<(_0x326091['pauseType']||'')||_0x3d4702[_0xdea7('0x2c')][_0xdea7('0x40')]()>_0x326091['fullname'][_0xdea7('0x40')]()?-0x1:0x1;}}else{if(_0x40ab8f===_0xdea7('0x38')){return _0x3d4702['fullname'][_0xdea7('0x40')]()<_0x326091['fullname']['toLowerCase']()?0x1:-0x1;}else{return _0x3d4702[_0xdea7('0x2c')][_0xdea7('0x40')]()<_0x326091[_0xdea7('0x2c')][_0xdea7('0x40')]()?-0x1:0x1;}}}else{if(_0x40ab8f===_0xdea7('0x38')){return _0x3d4702['globalStatus']<_0x326091[_0xdea7('0x35')]?0x1:-0x1;}else{return _0x3d4702['globalStatus']<_0x326091[_0xdea7('0x35')]?-0x1:0x1;}}});return _0x496142;}exports[_0xdea7('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x58a66a){var _0x38b862=[_0xdea7('0x42'),_0xdea7('0x43'),_0xdea7('0x44'),_0xdea7('0x45'),_0xdea7('0x30'),_0xdea7('0x45'),'internal',_0xdea7('0x46'),_0xdea7('0x3'),_0xdea7('0x2e'),_0xdea7('0x2d'),_0xdea7('0x5'),'whatsappPause',_0xdea7('0x4'),'voicePause','chatCapacity',_0xdea7('0x47'),_0xdea7('0x48'),_0xdea7('0x49'),'whatsappCapacity',_0xdea7('0x4a'),_0xdea7('0x4b'),'openchannelCurrentCapacity',_0xdea7('0x4c'),_0xdea7('0x4d'),_0xdea7('0x4e'),'faxCurrentCapacity',_0xdea7('0xf'),_0xdea7('0x12'),'mailStatus',_0xdea7('0x13'),_0xdea7('0x14'),_0xdea7('0x10'),'voiceStatus',_0xdea7('0x4f'),'openchannelStatusTime',_0xdea7('0x50'),_0xdea7('0x51'),_0xdea7('0x52'),_0xdea7('0x53'),_0xdea7('0x54'),_0xdea7('0x55'),_0xdea7('0x56'),_0xdea7('0x57'),'phoneBarEnableScreenRecordingByAgent',_0xdea7('0x58'),'routealias'];var _0x30fde4=[_0xdea7('0x3'),_0xdea7('0x2e'),_0xdea7('0x2d'),_0xdea7('0x5'),_0xdea7('0x2f'),_0xdea7('0x4'),_0xdea7('0x6'),_0xdea7('0x43')];var _0x7c1209=_(_0x58a66a)[_0xdea7('0x59')](_0x30fde4)['pick'](_0x38b862)[_0xdea7('0x26')]();return _0x7c1209;}exports[_0xdea7('0x5a')]=filterAgentAttributes; \ No newline at end of file +var _0x78f4=['omit','pick','filterAgentAttributes','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','Agents','then','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','*pause','idle','getAgentStatus','isArray','startCase','Queue','getAgents','all','map','uniq','value','getAgentIdsByQueues','includes','busy','resolve','User','findAll','name','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','DESC','ASC','fullname','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','lastLoginAt','lastPauseAt','address','openchannelCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online'];(function(_0x5f49b1,_0x2e245c){var _0x59e7a4=function(_0x20fc99){while(--_0x20fc99){_0x5f49b1['push'](_0x5f49b1['shift']());}};_0x59e7a4(++_0x2e245c);}(_0x78f4,0x10b));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var jayson=require(_0x478f('0x0'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x478f('0x1')]['http']({'port':0x232a});var routingClient=jayson[_0x478f('0x1')][_0x478f('0x2')]({'port':0x232c});function isAgentPaused(_0xe2e5dd,_0x4fb936){var _0x36eb4f=[_0xe2e5dd[_0x478f('0x3')],_0xe2e5dd[_0x478f('0x4')],_0xe2e5dd[_0x478f('0x5')],_0xe2e5dd[_0x478f('0x6')],_0xe2e5dd[_0x478f('0x7')],_0xe2e5dd[_0x478f('0x8')],_0xe2e5dd[_0x478f('0x9')]];if(!_0x4fb936)return _[_0x478f('0xa')](_0x36eb4f);var _0x6c924e=_[_0x478f('0xb')](_0x36eb4f);return _0x6c924e[_0x478f('0xc')]>0x0&&_0x6c924e[_0x478f('0xc')]<_0x36eb4f[_0x478f('0xc')]?!![]:![];}function isIdle(_0x304d25){return _0x304d25==='idle'||_0x304d25===_0x478f('0xd')||_0x304d25===_0x478f('0xe')||_0x304d25===_0x478f('0xf')||_['isNil'](_0x304d25);}function isAgentIdle(_0x49b231){if(_0x49b231[_0x478f('0x10')]!=='idle'&&_0x49b231[_0x478f('0x8')]){_0x49b231[_0x478f('0x10')]=_0x478f('0x11');return![];}return _[_0x478f('0xa')]([_0x49b231[_0x478f('0x12')],_0x49b231[_0x478f('0x13')],_0x49b231[_0x478f('0x14')],_0x49b231[_0x478f('0x15')],_0x49b231[_0x478f('0x16')],_0x49b231[_0x478f('0x10')],_0x49b231[_0x478f('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x478f('0x18'),{})[_0x478f('0x19')](function(_0x1de011){if(_0x1de011['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0xb39e2=_0x1de011[_0x478f('0x1a')];return routingClient['request']('Agents',{})[_0x478f('0x19')](function(_0x385407){if(_0x385407[_0x478f('0x1b')]){throw new Error(_0x478f('0x1c'));}var _0x5808af=_0x385407['result'];return _['merge']({},_0xb39e2,_0x5808af);});})[_0x478f('0x1d')](function(_0x391693){throw _0x391693;});}exports[_0x478f('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x1607b0){var _0x9f3955=_0x478f('0xd');if(isAgentPaused(_0x1607b0))_0x9f3955=_0x478f('0x11');else if(isAgentPaused(_0x1607b0,!![]))_0x9f3955=_0x478f('0x1f');else if(isAgentIdle(_0x1607b0))_0x9f3955=_0x478f('0x20');else _0x9f3955='busy';return _0x9f3955;}exports[_0x478f('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x4bd053,_0x5dcfb4){var _0x48b144=_[_0x478f('0x22')](_0x4bd053)?_0x4bd053:[_0x4bd053];var _0x1c0b17=_[_0x478f('0x23')](_0x5dcfb4)+_0x478f('0x24');var _0x3fa3e3=_['map'](_0x48b144,function(_0x1e349d){return db[_0x1c0b17]['findOne']({'where':{'id':_0x1e349d}})[_0x478f('0x19')](function(_0x2b2fa6){if(!_0x2b2fa6)return[];return _0x2b2fa6[_0x478f('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x478f('0x26')](_0x3fa3e3)[_0x478f('0x19')](function(_0x1d658e){var _0x1a2f23=_(_0x1d658e)['flatten']()[_0x478f('0x27')]('id')[_0x478f('0x28')]()[_0x478f('0x29')]();return _0x1a2f23;});}exports[_0x478f('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0xbf862a,_0x12bce7,_0x5d67aa){try{if(_0x12bce7[_0x478f('0xc')]>0x0){_0xbf862a=_0xbf862a[_0x478f('0xb')](function(_0x29f9f1){return _0x12bce7[_0x478f('0x2b')](_0x29f9f1['id']);});}var _0x4759cb=_0xbf862a['filter'](function(_0xdcf6ce){var _0x80ca00=_0x478f('0x2c');if(isAgentIdle(_0xdcf6ce)){_0x80ca00=_0x478f('0x20');}return _0x80ca00===_0x5d67aa;});return _['map'](_0x4759cb,'id');}catch(_0x4fa6cf){throw _0x4fa6cf;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x430e5f,_0x2ca3c9,_0xd3ccbe){return Promise[_0x478f('0x2d')]()[_0x478f('0x19')](function(){if(_0x2ca3c9[_0x478f('0xc')]>0x0){_0x430e5f=_0x430e5f['filter'](function(_0xdba608){return _0x2ca3c9[_0x478f('0x2b')](_0xdba608['id']);});}return _0x430e5f;})[_0x478f('0x19')](function(){return db[_0x478f('0x2e')][_0x478f('0x2f')]({'attributes':['id',_0x478f('0x30'),'fullname',_0x478f('0x3'),_0x478f('0x4'),_0x478f('0x5'),_0x478f('0x6'),'smsPause','voicePause',_0x478f('0x9'),_0x478f('0x31')],'where':{'id':{'$in':_[_0x478f('0x27')](_0x430e5f,'id')}},'raw':!![]});})['then'](function(_0x140053){return _0x140053['map'](function(_0x5b77ed){var _0x5745dc=_[_0x478f('0x32')](_0x430e5f,['id',_0x5b77ed['id']]);var _0x4806f1=filterAgentAttributes(_0x5745dc);_['merge'](_0x5b77ed,_0x4806f1);_0x5b77ed[_0x478f('0x33')]=getAgentStatus(_0x5b77ed);return _0x5b77ed;});})['then'](function(_0x2c1c0d){var _0x1a815e=sortAgentsByStatus(_0x2c1c0d,_0xd3ccbe);return _[_0x478f('0x27')](_0x1a815e,'id');})['catch'](function(_0x11e040){throw _0x11e040;});}exports[_0x478f('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5948f8){var _0x121431={'fields':[],'order':null};var _0x3e7d64=_0x5948f8[_0x478f('0x35')](',');_0x121431[_0x478f('0x36')]=_['filter'](_0x3e7d64,function(_0x5ac85a){if(!_0x5ac85a['includes'](_0x478f('0x33'))){return!![];}_0x121431[_0x478f('0x37')]=_['startsWith'](_0x5ac85a,'-')?_0x478f('0x38'):_0x478f('0x39');return![];});return _0x121431;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x5bdd73){if(_0x5bdd73['includes'](_0x478f('0x3a'))&&!_0x5bdd73[_0x478f('0x2b')](_0x478f('0x3b'))){var _0xd07fa8=_0x5bdd73[_0x478f('0x3c')](0x0,_0x5bdd73[_0x478f('0x3d')](_0x478f('0x3a')));_0x5bdd73+=','+_0xd07fa8+_0x478f('0x3b');}return _0x5bdd73;}exports[_0x478f('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x17363b,_0xd28798){var _0x353dee=_0x17363b[_0x478f('0x3f')](function(_0x41aefb,_0x2ccdcd){if(_0x41aefb[_0x478f('0x33')]===_0x2ccdcd[_0x478f('0x33')]){if(_0x41aefb[_0x478f('0x33')]==='pause'){if(_0xd28798==='DESC'){return(_0x41aefb['pauseType']||'')<(_0x2ccdcd['pauseType']||'')||_0x41aefb[_0x478f('0x3a')]['toLowerCase']()>_0x2ccdcd[_0x478f('0x3a')][_0x478f('0x40')]()?0x1:-0x1;}else{return(_0x41aefb[_0x478f('0x31')]||'')<(_0x2ccdcd[_0x478f('0x31')]||'')||_0x41aefb['fullname']['toLowerCase']()>_0x2ccdcd[_0x478f('0x3a')]['toLowerCase']()?-0x1:0x1;}}else{if(_0xd28798==='DESC'){return _0x41aefb['fullname'][_0x478f('0x40')]()<_0x2ccdcd[_0x478f('0x3a')]['toLowerCase']()?0x1:-0x1;}else{return _0x41aefb[_0x478f('0x3a')][_0x478f('0x40')]()<_0x2ccdcd[_0x478f('0x3a')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0xd28798==='DESC'){return _0x41aefb[_0x478f('0x33')]<_0x2ccdcd[_0x478f('0x33')]?0x1:-0x1;}else{return _0x41aefb['globalStatus']<_0x2ccdcd[_0x478f('0x33')]?-0x1:0x1;}}});return _0x353dee;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3eb1af){var _0x55f7f0=['userpic','online',_0x478f('0x41'),'lastPauseAt',_0x478f('0x31'),_0x478f('0x42'),_0x478f('0x3b'),_0x478f('0x43'),_0x478f('0x3'),_0x478f('0x6'),_0x478f('0x5'),'smsPause',_0x478f('0x9'),'faxPause',_0x478f('0x8'),'chatCapacity',_0x478f('0x44'),'mailCapacity','smsCapacity',_0x478f('0x45'),_0x478f('0x46'),_0x478f('0x47'),_0x478f('0x48'),'mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity',_0x478f('0x49'),'chatStatus','openchannelStatus',_0x478f('0x14'),_0x478f('0x16'),_0x478f('0x17'),_0x478f('0x13'),_0x478f('0x10'),'chatStatusTime',_0x478f('0x4a'),_0x478f('0x4b'),_0x478f('0x4c'),_0x478f('0x4d'),_0x478f('0x4e'),_0x478f('0x4f'),_0x478f('0x50'),'destconnectedlinenum','screenrecording',_0x478f('0x51'),_0x478f('0x52'),_0x478f('0x53')];var _0x221b19=[_0x478f('0x3'),'openchannelPause',_0x478f('0x5'),'smsPause','whatsappPause','faxPause',_0x478f('0x8'),_0x478f('0x54')];var _0x5b5dce=_(_0x3eb1af)[_0x478f('0x55')](_0x221b19)[_0x478f('0x56')](_0x55f7f0)[_0x478f('0x29')]();return _0x5b5dce;}exports[_0x478f('0x57')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 94fef15..cd06a96 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 _0x0e0e=['unavailable','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','concat','outbound','map','get','loggedInDb','merge','pick','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking'];(function(_0x347851,_0x2e32a3){var _0x1eb7cc=function(_0xbcc989){while(--_0xbcc989){_0x347851['push'](_0x347851['shift']());}};_0x1eb7cc(++_0x2e32a3);}(_0x0e0e,0x8c));var _0xe0e0=function(_0x3f5f08,_0x1ccd7f){_0x3f5f08=_0x3f5f08-0x0;var _0x566dd9=_0x0e0e[_0x3f5f08];return _0x566dd9;};'use strict';var _=require('lodash');var jayson=require(_0xe0e0('0x0'));var util=require(_0xe0e0('0x1'));var amiClient=jayson[_0xe0e0('0x2')][_0xe0e0('0x3')]({'port':0x232a});var routingClient=jayson[_0xe0e0('0x2')][_0xe0e0('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xe0e0('0x4'),_0xe0e0('0x5'),_0xe0e0('0x6'),_0xe0e0('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xe0e0('0x8'),_0xe0e0('0x9'),_0xe0e0('0xa'),'loggedInDb',_0xe0e0('0xb'),_0xe0e0('0xc'),_0xe0e0('0xd'),_0xe0e0('0xe'),_0xe0e0('0xf'),_0xe0e0('0x10'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xe0e0('0x11'),_0xe0e0('0x12'),_0xe0e0('0x13'),_0xe0e0('0x14'),_0xe0e0('0x15'),_0xe0e0('0x16'),_0xe0e0('0x17'),_0xe0e0('0x18'),'startProgressive',_0xe0e0('0x19'),'erlangCallToSecond',_0xe0e0('0x1a'),_0xe0e0('0x1b'),'dialPredictiveInterval',_0xe0e0('0x1c'),_0xe0e0('0x1d'),_0xe0e0('0x1e'),_0xe0e0('0x1f'),_0xe0e0('0x20'),'predictiveIntervalDroppedCallsTimeout',_0xe0e0('0x21'),_0xe0e0('0x22'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3f3e48,_0x28fcfa){var _0x46e864=_0x28fcfa===_0xe0e0('0x23')?amiClient:routingClient;return _0x46e864[_0xe0e0('0x24')](_[_0xe0e0('0x25')](_0x28fcfa)+'Queues',_0x3f3e48)[_0xe0e0('0x26')](function(_0x313d5f){if(_0x313d5f[_0xe0e0('0x27')])throw new Error(util[_0xe0e0('0x28')](_0xe0e0('0x29'),_0x28fcfa));return _0x313d5f['result'];})[_0xe0e0('0x2a')](function(_0x4769ab){throw _0x4769ab;});}exports[_0xe0e0('0x2b')]=getRealtimeQueues;function initializeQueues(_0x32603d,_0x3cc118,_0xc03ac4,_0x2466f6){var _0x27f54c=DEFAULT_QUEUE_ATTRIBUTES;if(_0xc03ac4===_0xe0e0('0x23')){if(_0x2466f6==='inbound'){_0x27f54c=_0x27f54c[_0xe0e0('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2466f6===_0xe0e0('0x2d')){_0x27f54c=_0x27f54c[_0xe0e0('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x32603d[_0xe0e0('0x2e')](function(_0xbc3dde){var _0xf4a6d0=_0xbc3dde[_0xe0e0('0x2f')]({'plain':!![]});_0xf4a6d0[_0xe0e0('0x6')]=0x0;_0xf4a6d0[_0xe0e0('0x30')]=0x0;_0xf4a6d0['loggedIn']=0x0;_0xf4a6d0[_0xe0e0('0x4')]=0x0;_0xf4a6d0[_0xe0e0('0x7')]=0x0;if(_0xc03ac4==='voice'){_0xf4a6d0['talking']=0x0;_0xf4a6d0[_0xe0e0('0x8')]=0x0;if(_0x2466f6==='outbound'){_0xf4a6d0['pTalking']=0x0;_0xf4a6d0[_0xe0e0('0x12')]=0x0;}}var _0x5a7721=_['find'](_0x3cc118,['id',_0xf4a6d0['id']]);if(_0x5a7721){_[_0xe0e0('0x31')](_0xf4a6d0,_[_0xe0e0('0x32')](_0x5a7721,_0x27f54c));}return _0xf4a6d0;});}exports[_0xe0e0('0x33')]=initializeQueues; \ No newline at end of file +var _0xcc81=['then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','concat','outbound','map','get','originated','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','talking','unavailable','unknown','pTalking','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase'];(function(_0x16efae,_0x2d1d8b){var _0x49f0d9=function(_0x53a9dd){while(--_0x53a9dd){_0x16efae['push'](_0x16efae['shift']());}};_0x49f0d9(++_0x2d1d8b);}(_0xcc81,0x14d));var _0x1cc8=function(_0x4a18f0,_0x903c50){_0x4a18f0=_0x4a18f0-0x0;var _0x158316=_0xcc81[_0x4a18f0];return _0x158316;};'use strict';var _=require(_0x1cc8('0x0'));var jayson=require(_0x1cc8('0x1'));var util=require(_0x1cc8('0x2'));var amiClient=jayson[_0x1cc8('0x3')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x1cc8('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x1cc8('0x5'),_0x1cc8('0x6'),_0x1cc8('0x7'),_0x1cc8('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x1cc8('0x9'),_0x1cc8('0xa'),_0x1cc8('0xb'),_0x1cc8('0xc'),_0x1cc8('0xd'),_0x1cc8('0xe'),'ringing','ringInUse',_0x1cc8('0xf'),_0x1cc8('0x10'),_0x1cc8('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x1cc8('0x12'),'originated',_0x1cc8('0x13'),_0x1cc8('0x14'),_0x1cc8('0x15'),_0x1cc8('0x16'),'Trunk',_0x1cc8('0x17'),_0x1cc8('0x18'),_0x1cc8('0x19'),_0x1cc8('0x1a'),'erlangAbandonmentRate',_0x1cc8('0x1b'),_0x1cc8('0x1c'),'dialPredictiveIntervalMaxThreshold',_0x1cc8('0x1d'),_0x1cc8('0x1e'),_0x1cc8('0x1f'),_0x1cc8('0x20'),'predictiveIntervalDroppedCallsTimeout',_0x1cc8('0x21'),_0x1cc8('0x22'),_0x1cc8('0x23')];function getRealtimeQueues(_0x5529c4,_0x576d10){var _0x5d8113=_0x576d10===_0x1cc8('0x24')?amiClient:routingClient;return _0x5d8113['request'](_[_0x1cc8('0x25')](_0x576d10)+'Queues',_0x5529c4)[_0x1cc8('0x26')](function(_0x3680df){if(_0x3680df[_0x1cc8('0x27')])throw new Error(util[_0x1cc8('0x28')](_0x1cc8('0x29'),_0x576d10));return _0x3680df['result'];})[_0x1cc8('0x2a')](function(_0x21a14b){throw _0x21a14b;});}exports[_0x1cc8('0x2b')]=getRealtimeQueues;function initializeQueues(_0x590a87,_0x4c6a4b,_0x3f9309,_0x32bc60){var _0x591c9b=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3f9309===_0x1cc8('0x24')){if(_0x32bc60===_0x1cc8('0x2c')){_0x591c9b=_0x591c9b[_0x1cc8('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x32bc60===_0x1cc8('0x2e')){_0x591c9b=_0x591c9b[_0x1cc8('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x590a87[_0x1cc8('0x2f')](function(_0x3158a0){var _0x4821ae=_0x3158a0[_0x1cc8('0x30')]({'plain':!![]});_0x4821ae[_0x1cc8('0x7')]=0x0;_0x4821ae[_0x1cc8('0xc')]=0x0;_0x4821ae[_0x1cc8('0x6')]=0x0;_0x4821ae[_0x1cc8('0x5')]=0x0;_0x4821ae[_0x1cc8('0x8')]=0x0;if(_0x3f9309===_0x1cc8('0x24')){_0x4821ae[_0x1cc8('0xf')]=0x0;_0x4821ae[_0x1cc8('0x9')]=0x0;if(_0x32bc60==='outbound'){_0x4821ae[_0x1cc8('0x12')]=0x0;_0x4821ae[_0x1cc8('0x31')]=0x0;}}var _0x2fc18d=_['find'](_0x4c6a4b,['id',_0x4821ae['id']]);if(_0x2fc18d){_[_0x1cc8('0x32')](_0x4821ae,_[_0x1cc8('0x33')](_0x2fc18d,_0x591c9b));}return _0x4821ae;});}exports[_0x1cc8('0x34')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 23456a9..e35b804 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(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4c974e,_0x513d9e){var _0x31327b=function(_0x5db97c){while(--_0x5db97c){_0x4c974e['push'](_0x4c974e['shift']());}};_0x31327b(++_0x513d9e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f6d9f42..e1a349b 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 _0xc0e8=['hostname','substring','lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','filter','family','internal','concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x560623,_0x5c748a){var _0x2a9089=function(_0x565d41){while(--_0x565d41){_0x560623['push'](_0x560623['shift']());}};_0x2a9089(++_0x5c748a);}(_0xc0e8,0x1f1));var _0x8c0e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc0e8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c0e('0x0'));var os=require('os');var crypto=require(_0x8c0e('0x1'));var machine=require(_0x8c0e('0x2'));var exec=require(_0x8c0e('0x3'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x52947a=[];var _0x3b6205=os[_0x8c0e('0x4')]();var _0x22e47b=_[_0x8c0e('0x5')](_['keys'](_0x3b6205));for(var _0x234469=0x0;_0x234469<_0x22e47b['length'];_0x234469++){var _0x4b8cc9=_0x3b6205[_0x22e47b[_0x234469]][_0x8c0e('0x6')](function(_0x59fb3d){return _0x59fb3d[_0x8c0e('0x7')]==='IPv4'&&_0x59fb3d[_0x8c0e('0x8')]===![];});_0x52947a=_0x52947a[_0x8c0e('0x9')](_0x4b8cc9);}return _0x52947a;}function getFirstInterface(){var _0x3232c0=_[_0x8c0e('0xa')](getInterfaces());return{'macAddress':_0x3232c0&&_0x3232c0[_0x8c0e('0xb')]?_0x3232c0[_0x8c0e('0xb')]:_0x8c0e('0xc'),'ipAddress':_0x3232c0&&_0x3232c0['address']?_0x3232c0['address']:_0x8c0e('0xd')};}exports[_0x8c0e('0xe')]=getFirstInterface;function getCPUhash(){var _0x20c7ec=_[_0x8c0e('0x5')](os['cpus']()[_0x8c0e('0xf')](function(_0xe3a5f1){return _0xe3a5f1[_0x8c0e('0x10')];}))[_0x8c0e('0x11')](':');return crypto[_0x8c0e('0x12')](_0x8c0e('0x13'))[_0x8c0e('0x14')](_0x20c7ec)[_0x8c0e('0x15')](_0x8c0e('0x16'));}exports[_0x8c0e('0x17')]=function(){var _0x489e43=os[_0x8c0e('0x18')]();var _0x3513d=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3513d[_0x8c0e('0x19')](config[_0x8c0e('0x1a')])){return config[_0x8c0e('0x1a')];}else if(_0x489e43===_0x8c0e('0x1b')){return exec(_0x8c0e('0x1c'),{'encoding':_0x8c0e('0x1d')})[_0x8c0e('0x1e')]('\x0d\x0a','');}else{var _0x15b6a9=getFirstInterface();var _0x583890=getCPUhash();var _0x400b72=_0x583890+'|'+os[_0x8c0e('0x1f')]()+'|'+_0x15b6a9['macAddress']+'|'+_0x15b6a9['ipAddress'];var _0xcb650d=crypto[_0x8c0e('0x12')](_0x8c0e('0x13'))[_0x8c0e('0x14')](_0x400b72)['digest'](_0x8c0e('0x16'));return _0xcb650d['substring'](0x0,0x8)+'-'+_0xcb650d['substring'](0x8,0xc)+'-'+_0xcb650d[_0x8c0e('0x20')](0xc,0x10)+'-'+_0xcb650d[_0x8c0e('0x20')](0x10,0x14)+'-'+_0xcb650d[_0x8c0e('0x20')](0x14);}}; \ No newline at end of file +var _0xb908=['md5','update','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','ipAddress','digest','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','createHash'];(function(_0x511e82,_0x5c8e7b){var _0x32bc8e=function(_0xc02fd5){while(--_0xc02fd5){_0x511e82['push'](_0x511e82['shift']());}};_0x32bc8e(++_0x5c8e7b);}(_0xb908,0x11d));var _0x8b90=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0xb908[_0x511b76];return _0x5424ff;};'use strict';var _=require(_0x8b90('0x0'));var os=require('os');var crypto=require(_0x8b90('0x1'));var machine=require(_0x8b90('0x2'));var exec=require(_0x8b90('0x3'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x484e30=[];var _0x3dd574=os[_0x8b90('0x4')]();var _0x1e7fa0=_[_0x8b90('0x5')](_[_0x8b90('0x6')](_0x3dd574));for(var _0x5547db=0x0;_0x5547db<_0x1e7fa0[_0x8b90('0x7')];_0x5547db++){var _0x5476e2=_0x3dd574[_0x1e7fa0[_0x5547db]][_0x8b90('0x8')](function(_0x1657a6){return _0x1657a6[_0x8b90('0x9')]===_0x8b90('0xa')&&_0x1657a6[_0x8b90('0xb')]===![];});_0x484e30=_0x484e30[_0x8b90('0xc')](_0x5476e2);}return _0x484e30;}function getFirstInterface(){var _0xf63127=_['head'](getInterfaces());return{'macAddress':_0xf63127&&_0xf63127['mac']?_0xf63127[_0x8b90('0xd')]:_0x8b90('0xe'),'ipAddress':_0xf63127&&_0xf63127[_0x8b90('0xf')]?_0xf63127[_0x8b90('0xf')]:_0x8b90('0x10')};}exports[_0x8b90('0x11')]=getFirstInterface;function getCPUhash(){var _0xdcefb8=_['orderBy'](os[_0x8b90('0x12')]()[_0x8b90('0x13')](function(_0x138f70){return _0x138f70['model'];}))['join'](':');return crypto[_0x8b90('0x14')](_0x8b90('0x15'))[_0x8b90('0x16')](_0xdcefb8)['digest']('hex');}exports[_0x8b90('0x17')]=function(){var _0x648c4d=os['platform']();var _0x17909e=/[0-9a-f-]{36}/;if(config[_0x8b90('0x18')]&&_0x17909e[_0x8b90('0x19')](config[_0x8b90('0x18')])){return config['licenseToken'];}else if(_0x648c4d===_0x8b90('0x1a')){return exec(_0x8b90('0x1b'),{'encoding':_0x8b90('0x1c')})['replace']('\x0d\x0a','');}else{var _0x41ab4c=getFirstInterface();var _0xfe6770=getCPUhash();var _0x1118d8=_0xfe6770+'|'+os[_0x8b90('0x1d')]()+'|'+_0x41ab4c['macAddress']+'|'+_0x41ab4c[_0x8b90('0x1e')];var _0x30320c=crypto[_0x8b90('0x14')]('md5')[_0x8b90('0x16')](_0x1118d8)[_0x8b90('0x1f')](_0x8b90('0x20'));return _0x30320c['substring'](0x0,0x8)+'-'+_0x30320c[_0x8b90('0x21')](0x8,0xc)+'-'+_0x30320c['substring'](0xc,0x10)+'-'+_0x30320c[_0x8b90('0x21')](0x10,0x14)+'-'+_0x30320c[_0x8b90('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ac0e23c..1576c0e 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 _0x5f62=['DEMO\x20START\x20AT\x20%s','update','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','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','decryptString','days'];(function(_0x343d6d,_0x245380){var _0x30e576=function(_0x147fb4){while(--_0x147fb4){_0x343d6d['push'](_0x343d6d['shift']());}};_0x30e576(++_0x245380);}(_0x5f62,0xd2));var _0x25f6=function(_0x5a2a75,_0xe3a29e){_0x5a2a75=_0x5a2a75-0x0;var _0x4109c3=_0x5f62[_0x5a2a75];return _0x4109c3;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x25f6('0x0'));var BPromise=require('bluebird');var pkginfo=require(_0x25f6('0x1'))(module,_0x25f6('0x2'));var db=require(_0x25f6('0x3'))['db'];var encryptor=require(_0x25f6('0x4'));var hardware=require(_0x25f6('0x5'));var logger=require(_0x25f6('0x6'))(_0x25f6('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x24600e){return new BPromise(function(_0xd14401,_0x56c22b){var _0x2c5815=util[_0x25f6('0x8')](_0x25f6('0x9'),HOST,_0x24600e,module[_0x25f6('0xa')][_0x25f6('0x2')]);if(oldToken){_0x2c5815=util['format'](_0x25f6('0xb'),HOST,_0x24600e,module[_0x25f6('0xa')]['version'],oldToken);}var _0x2ac144={'uri':_0x2c5815,'method':_0x25f6('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x2ac144)['then'](function(_0x518086){_0xd14401(_0x518086);})[_0x25f6('0xd')](function(_0x376758){_0x56c22b(_0x376758);});});}function manageLicense(_0x29e585,_0x2de937){var _0x473d82=_0x2de937['get']({'plain':!![]});if(!isOldTokenSent&&_0x473d82[_0x25f6('0xe')]!==_0x29e585&&!_0x473d82[_0x25f6('0xf')]){oldToken=_0x473d82[_0x25f6('0xe')];}httpRequest(_0x29e585)[_0x25f6('0x10')](function(_0x50fd42){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x50fd42[_0x25f6('0x11')]){isOldTokenSent=![];if(!_0x473d82['license']&&_0x473d82['license']!=_0x50fd42[_0x25f6('0x7')]||_0x473d82[_0x25f6('0x7')]&&_0x473d82['data2']){logger[_0x25f6('0x12')](_0x25f6('0x13'));}if(_0x473d82[_0x25f6('0x7')]&&!_0x473d82[_0x25f6('0xf')]&&_0x473d82[_0x25f6('0x7')]!=_0x50fd42[_0x25f6('0x7')]){logger['info'](_0x25f6('0x14'));}if(_0x473d82[_0x25f6('0x7')]&&!_0x473d82[_0x25f6('0xf')]&&_0x473d82[_0x25f6('0x7')]==_0x50fd42[_0x25f6('0x7')]){return _0x2de937;}return _0x2de937['update']({'data1':_0x29e585,'data2':null,'license':_0x50fd42[_0x25f6('0x7')]});}else{if(_0x50fd42[_0x25f6('0x7')]||_0x473d82[_0x25f6('0x7')]){if(!_0x473d82[_0x25f6('0xf')]){if(_0x473d82[_0x25f6('0xe')]==_0x29e585){GRAY_PERIOD_REASON=_0x25f6('0x15');logger['info'](_0x25f6('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0x25f6('0x17'),_0x473d82['data1'],_0x29e585);}logger[_0x25f6('0x12')](_0x25f6('0x18'),GRAY_PERIOD_REASON[_0x25f6('0x19')](),moment()['format'](_0x25f6('0x1a')));return _0x2de937['update']({'data2':encryptor[_0x25f6('0x1b')](moment()['format'](_0x25f6('0x1a')))});}else{if(moment()['diff'](encryptor[_0x25f6('0x1c')](_0x473d82[_0x25f6('0xf')]),_0x25f6('0x1d'))>DAYS){logger[_0x25f6('0x12')](_0x25f6('0x1e'),moment()[_0x25f6('0x8')](_0x25f6('0x1a')));isOldTokenSent=![];return _0x2de937[_0x25f6('0x1f')]({'data1':_0x29e585,'data2':null,'license':null});}}}else{if(_0x473d82[_0x25f6('0xe')]!=_0x29e585){logger[_0x25f6('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x473d82['data1'],_0x29e585);return _0x2de937[_0x25f6('0x1f')]({'data1':_0x29e585,'data2':null,'license':null});}}}return _0x2de937;})[_0x25f6('0x10')](function(_0x3c516b){_0x2de937=_0x3c516b;})[_0x25f6('0xd')](function(_0xec9d27){logger['error'](_0xec9d27[_0x25f6('0x20')]);})[_0x25f6('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x25f6('0x22')](),_0x2de937);},TIME);});}function defaultLicense(){var _0x153a80=hardware['getUuid']();if(_0x153a80){return db[_0x25f6('0x23')][_0x25f6('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x153a80}})[_0x25f6('0x25')](function(_0x1f4cec,_0x5d36cb){logger[_0x25f6('0x12')](_0x25f6('0x26'),_0x153a80);manageLicense(_0x153a80,_0x1f4cec);})['catch'](function(_0x1db96f){logger['error'](_0x1db96f[_0x25f6('0x20')]);});}}exports[_0x25f6('0x27')]=defaultLicense; \ No newline at end of file +var _0x9dbd=['bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment'];(function(_0x47dd60,_0x177de1){var _0x137a84=function(_0xa92aa5){while(--_0xa92aa5){_0x47dd60['push'](_0x47dd60['shift']());}};_0x137a84(++_0x177de1);}(_0x9dbd,0x1cc));var _0xd9db=function(_0x5c5e10,_0x5c9696){_0x5c5e10=_0x5c5e10-0x0;var _0x41b3e0=_0x9dbd[_0x5c5e10];return _0x41b3e0;};'use strict';var util=require(_0xd9db('0x0'));var moment=require(_0xd9db('0x1'));var rp=require('request-promise');var BPromise=require(_0xd9db('0x2'));var pkginfo=require('pkginfo')(module,_0xd9db('0x3'));var db=require(_0xd9db('0x4'))['db'];var encryptor=require(_0xd9db('0x5'));var hardware=require(_0xd9db('0x6'));var logger=require(_0xd9db('0x7'))(_0xd9db('0x8'));var HOST=_0xd9db('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x585696){return new BPromise(function(_0x4680f9,_0x589fe8){var _0x313bbf=util[_0xd9db('0xa')](_0xd9db('0xb'),HOST,_0x585696,module[_0xd9db('0xc')]['version']);if(oldToken){_0x313bbf=util[_0xd9db('0xa')](_0xd9db('0xd'),HOST,_0x585696,module[_0xd9db('0xc')][_0xd9db('0x3')],oldToken);}var _0x1bd8b0={'uri':_0x313bbf,'method':_0xd9db('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x1bd8b0)[_0xd9db('0xf')](function(_0x543666){_0x4680f9(_0x543666);})[_0xd9db('0x10')](function(_0x2209d2){_0x589fe8(_0x2209d2);});});}function manageLicense(_0x177f79,_0x52228c){var _0x34c251=_0x52228c[_0xd9db('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x34c251['data1']!==_0x177f79&&!_0x34c251[_0xd9db('0x12')]){oldToken=_0x34c251[_0xd9db('0x13')];}httpRequest(_0x177f79)['then'](function(_0x15332e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x15332e[_0xd9db('0x14')]){isOldTokenSent=![];if(!_0x34c251[_0xd9db('0x8')]&&_0x34c251[_0xd9db('0x8')]!=_0x15332e['license']||_0x34c251[_0xd9db('0x8')]&&_0x34c251[_0xd9db('0x12')]){logger['info'](_0xd9db('0x15'));}if(_0x34c251['license']&&!_0x34c251['data2']&&_0x34c251['license']!=_0x15332e['license']){logger[_0xd9db('0x16')](_0xd9db('0x17'));}if(_0x34c251['license']&&!_0x34c251['data2']&&_0x34c251[_0xd9db('0x8')]==_0x15332e[_0xd9db('0x8')]){return _0x52228c;}return _0x52228c[_0xd9db('0x18')]({'data1':_0x177f79,'data2':null,'license':_0x15332e[_0xd9db('0x8')]});}else{if(_0x15332e[_0xd9db('0x8')]||_0x34c251[_0xd9db('0x8')]){if(!_0x34c251[_0xd9db('0x12')]){if(_0x34c251[_0xd9db('0x13')]==_0x177f79){GRAY_PERIOD_REASON=_0xd9db('0x19');logger['info'](_0xd9db('0x1a'));}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x34c251[_0xd9db('0x13')],_0x177f79);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xd9db('0x1b')](),moment()[_0xd9db('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x52228c[_0xd9db('0x18')]({'data2':encryptor[_0xd9db('0x1c')](moment()['format'](_0xd9db('0x1d')))});}else{if(moment()[_0xd9db('0x1e')](encryptor[_0xd9db('0x1f')](_0x34c251[_0xd9db('0x12')]),'days')>DAYS){logger['info'](_0xd9db('0x20'),moment()[_0xd9db('0xa')](_0xd9db('0x1d')));isOldTokenSent=![];return _0x52228c[_0xd9db('0x18')]({'data1':_0x177f79,'data2':null,'license':null});}}}else{if(_0x34c251['data1']!=_0x177f79){logger[_0xd9db('0x16')](_0xd9db('0x21'),_0x34c251[_0xd9db('0x13')],_0x177f79);return _0x52228c['update']({'data1':_0x177f79,'data2':null,'license':null});}}}return _0x52228c;})['then'](function(_0x5df83b){_0x52228c=_0x5df83b;})[_0xd9db('0x10')](function(_0x3702af){logger[_0xd9db('0x22')](_0x3702af[_0xd9db('0x23')]);})[_0xd9db('0x24')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x52228c);},TIME);});}function defaultLicense(){var _0x3354de=hardware[_0xd9db('0x25')]();if(_0x3354de){return db['License'][_0xd9db('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x3354de}})[_0xd9db('0x27')](function(_0x3bd366,_0x38a25a){logger[_0xd9db('0x16')](_0xd9db('0x28'),_0x3354de);manageLicense(_0x3354de,_0x3bd366);})[_0xd9db('0x10')](function(_0x3c666b){logger[_0xd9db('0x22')](_0x3c666b['message']);});}}exports[_0xd9db('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 77e725b..11cb5cb 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 _0xf84c=['isEmpty','License\x20key\x20value\x20not\x20found','split','%s:%s:%s','demo','machineUuid','decryptString','gray','add','days','format','grayReason','changed','disabled','message','User','role','sequelize','COUNT','admin','user','telephone','users','telephones','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license'];(function(_0x57dae8,_0x14f493){var _0x2da89a=function(_0x498a30){while(--_0x498a30){_0x57dae8['push'](_0x57dae8['shift']());}};_0x2da89a(++_0x14f493);}(_0xf84c,0xaf));var _0xcf84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf84c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xcf84('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xcf84('0x1'));var hardware=require(_0xcf84('0x2'));var encryptor=require(_0xcf84('0x3'));var db=require(_0xcf84('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcf84('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcf84('0x6'),'machineUuid':hardware[_0xcf84('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcf84('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xcf84('0x8'),'machineUuid':hardware[_0xcf84('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x12511a){return new BPromise(function(_0x110a57,_0x40bebe){return db[_0xcf84('0x9')][_0xcf84('0xa')](_[_0xcf84('0xb')](_0x12511a,{'raw':!![],'where':{'id':0x1}}))[_0xcf84('0xc')](function(_0x3c35d0){return checkLicense(_0x3c35d0,null);})[_0xcf84('0xc')](function(_0x27827b){_0x110a57(_0x27827b);return;})[_0xcf84('0xd')](function(_0x1fed2d){_0x40bebe(_0x1fed2d);});});}function checkLicense(_0x45dfcb,_0x409d9a){if(!_0x45dfcb){demoLicense[_0xcf84('0xe')]=_0x45dfcb[_0xcf84('0xf')];return demoLicense;}try{var _0x299bc4=_0x409d9a||_0x45dfcb[_0xcf84('0x10')];if(_[_0xcf84('0x11')](_0x299bc4)){throw new Error(_0xcf84('0x12'));}var _0xc6cdd5=_0x45dfcb[_0xcf84('0xf')];var _0x87bb13=_0x45dfcb['data2'];var _0x253607=_0xc6cdd5['split']('-')[0x4];var _0x3f0da2=_0xc6cdd5[_0xcf84('0x13')]('-')[0x0];var _0x2005a1=encryptor['decryptString'](_0x299bc4,util['format'](_0xcf84('0x14'),_0x253607,_0xc6cdd5,_0x3f0da2));var _0x2b5a51=JSON['parse'](_0x2005a1);_0x2b5a51[_0xcf84('0x15')]=![];_0x2b5a51['uuid']=_0xc6cdd5;_0x2b5a51[_0xcf84('0x16')]=hardware[_0xcf84('0x7')]();if(_0x87bb13){var _0x90aaa=encryptor[_0xcf84('0x17')](_0x87bb13);_0x2b5a51[_0xcf84('0x18')]=_0x90aaa;_0x2b5a51['deadline']=moment(_0x90aaa)[_0xcf84('0x19')](0x7,_0xcf84('0x1a'))[_0xcf84('0x1b')]();_0x2b5a51[_0xcf84('0x1c')]=_0x2b5a51[_0xcf84('0xe')]!=_0x2b5a51[_0xcf84('0x16')]?_0xcf84('0x1d'):_0xcf84('0x1e');}return _0x2b5a51;}catch(_0x4d8e8d){breakingLicense[_0xcf84('0xe')]=_0x45dfcb['data1'];breakingLicense[_0xcf84('0x1f')]=_0x4d8e8d['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x91ea1b,_0x38c14a){getLicense()['then'](function(_0x39f86a){return db[_0xcf84('0x20')]['findAll']({'attributes':[_0xcf84('0x21'),[db[_0xcf84('0x22')]['fn'](_0xcf84('0x23'),db[_0xcf84('0x22')]['col'](_0xcf84('0x21'))),'count']],'group':_0xcf84('0x21'),'where':{'role':{'$or':[_0xcf84('0x24'),_0xcf84('0x25'),_0xcf84('0x26')]}},'raw':!![]})[_0xcf84('0xc')](function(_0x564a06){var _0x3efc9d={'user':_0x39f86a[_0xcf84('0x27')]||0x0,'telephone':_0x39f86a[_0xcf84('0x28')]||0x0};_0x564a06[_0xcf84('0x29')](function(_0x150dfe){var _0x110b30=_0x150dfe[_0xcf84('0x21')]===_0xcf84('0x24')?_0xcf84('0x25'):_0x150dfe[_0xcf84('0x21')];_0x3efc9d[_0x110b30]-=_0x150dfe[_0xcf84('0x2a')];if(_0x3efc9d[_0x110b30]<0x0)_0x3efc9d[_0x110b30]=0x0;});_0x91ea1b(_0x3efc9d);return;});})[_0xcf84('0xd')](function(_0x2a1056){_0x38c14a(_0x2a1056);});});}function checkUserLimits(_0x5b103a){return new BPromise(function(_0x5beac8,_0x24b23c){getLimits()[_0xcf84('0xc')](function(_0x3f5f19){var _0x1eaeb6=_[_0xcf84('0x2b')](_[_0xcf84('0x2c')](_0x5b103a,_0xcf84('0x21')),[_0xcf84('0x24'),_0xcf84('0x25'),_0xcf84('0x26')]);var _0x86125d=(_0x1eaeb6[_0xcf84('0x24')]||0x0)+(_0x1eaeb6[_0xcf84('0x25')]||0x0);var _0x5e6538=_0x1eaeb6[_0xcf84('0x26')]||0x0;if(_0x86125d>_0x3f5f19[_0xcf84('0x25')])return _0x24b23c(_0xcf84('0x2d'));if(_0x5e6538>_0x3f5f19['telephone'])return _0x24b23c(_0xcf84('0x2e'));return _0x5beac8();})[_0xcf84('0xd')](function(_0x1ebefc){_0x24b23c(_0x1ebefc);});});}module[_0xcf84('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xefe6=['forEach','user','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','format','grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','col','role','count','admin','telephone'];(function(_0x4505da,_0x328eea){var _0x191417=function(_0x2bd9c6){while(--_0x2bd9c6){_0x4505da['push'](_0x4505da['shift']());}};_0x191417(++_0x328eea);}(_0xefe6,0xc8));var _0x6efe=function(_0x279e6f,_0x566574){_0x279e6f=_0x279e6f-0x0;var _0x489a5f=_0xefe6[_0x279e6f];return _0x489a5f;};'use strict';var util=require(_0x6efe('0x0'));var _=require(_0x6efe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x6efe('0x2'));var encryptor=require(_0x6efe('0x3'));var db=require(_0x6efe('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6efe('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x6efe('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6efe('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6efe('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2e712e){return new BPromise(function(_0x5b3a5f,_0x22d6a9){return db[_0x6efe('0x8')][_0x6efe('0x9')](_[_0x6efe('0xa')](_0x2e712e,{'raw':!![],'where':{'id':0x1}}))[_0x6efe('0xb')](function(_0x588ee7){return checkLicense(_0x588ee7,null);})[_0x6efe('0xb')](function(_0x16abdb){_0x5b3a5f(_0x16abdb);return;})['catch'](function(_0x40b997){_0x22d6a9(_0x40b997);});});}function checkLicense(_0x57c5e4,_0x5cda70){if(!_0x57c5e4){demoLicense[_0x6efe('0xc')]=_0x57c5e4[_0x6efe('0xd')];return demoLicense;}try{var _0x4a0bf2=_0x5cda70||_0x57c5e4['license'];if(_[_0x6efe('0xe')](_0x4a0bf2)){throw new Error(_0x6efe('0xf'));}var _0x6da620=_0x57c5e4[_0x6efe('0xd')];var _0x8a5415=_0x57c5e4[_0x6efe('0x10')];var _0x53ca56=_0x6da620[_0x6efe('0x11')]('-')[0x4];var _0x27fb11=_0x6da620[_0x6efe('0x11')]('-')[0x0];var _0xc1b46c=encryptor[_0x6efe('0x12')](_0x4a0bf2,util['format'](_0x6efe('0x13'),_0x53ca56,_0x6da620,_0x27fb11));var _0x2649c3=JSON[_0x6efe('0x14')](_0xc1b46c);_0x2649c3[_0x6efe('0x15')]=![];_0x2649c3[_0x6efe('0xc')]=_0x6da620;_0x2649c3[_0x6efe('0x16')]=hardware[_0x6efe('0x6')]();if(_0x8a5415){var _0x2b4b81=encryptor[_0x6efe('0x12')](_0x8a5415);_0x2649c3[_0x6efe('0x17')]=_0x2b4b81;_0x2649c3[_0x6efe('0x18')]=moment(_0x2b4b81)[_0x6efe('0x19')](0x7,'days')[_0x6efe('0x1a')]();_0x2649c3[_0x6efe('0x1b')]=_0x2649c3[_0x6efe('0xc')]!=_0x2649c3[_0x6efe('0x16')]?_0x6efe('0x1c'):_0x6efe('0x1d');}return _0x2649c3;}catch(_0x13b7e6){breakingLicense[_0x6efe('0xc')]=_0x57c5e4[_0x6efe('0xd')];breakingLicense[_0x6efe('0x1e')]=_0x13b7e6[_0x6efe('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1553e2,_0xad9cf4){getLicense()[_0x6efe('0xb')](function(_0x225bd9){return db[_0x6efe('0x1f')][_0x6efe('0x20')]({'attributes':['role',[db[_0x6efe('0x21')]['fn'](_0x6efe('0x22'),db[_0x6efe('0x21')][_0x6efe('0x23')](_0x6efe('0x24'))),_0x6efe('0x25')]],'group':_0x6efe('0x24'),'where':{'role':{'$or':[_0x6efe('0x26'),'user',_0x6efe('0x27')]}},'raw':!![]})[_0x6efe('0xb')](function(_0x20bef7){var _0x248347={'user':_0x225bd9['users']||0x0,'telephone':_0x225bd9['telephones']||0x0};_0x20bef7[_0x6efe('0x28')](function(_0x5a91de){var _0x5bad8e=_0x5a91de['role']===_0x6efe('0x26')?_0x6efe('0x29'):_0x5a91de[_0x6efe('0x24')];_0x248347[_0x5bad8e]-=_0x5a91de[_0x6efe('0x25')];if(_0x248347[_0x5bad8e]<0x0)_0x248347[_0x5bad8e]=0x0;});_0x1553e2(_0x248347);return;});})[_0x6efe('0x2a')](function(_0x56162d){_0xad9cf4(_0x56162d);});});}function checkUserLimits(_0xf7882a){return new BPromise(function(_0x1bea65,_0x5d46d1){getLimits()['then'](function(_0x550335){var _0x1d3cd0=_[_0x6efe('0x2b')](_[_0x6efe('0x2c')](_0xf7882a,'role'),[_0x6efe('0x26'),_0x6efe('0x29'),_0x6efe('0x27')]);var _0x511b17=(_0x1d3cd0[_0x6efe('0x26')]||0x0)+(_0x1d3cd0['user']||0x0);var _0x4be941=_0x1d3cd0[_0x6efe('0x27')]||0x0;if(_0x511b17>_0x550335[_0x6efe('0x29')])return _0x5d46d1(_0x6efe('0x2d'));if(_0x4be941>_0x550335[_0x6efe('0x27')])return _0x5d46d1(_0x6efe('0x2e'));return _0x1bea65();})[_0x6efe('0x2a')](function(_0x3b3867){_0x5d46d1(_0x3b3867);});});}module[_0x6efe('0x2f')]={'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 76ceded..c5d1df7 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 _0x63a5=['myappanuglar-secret','secret','exports','http://localhost:9000'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x63a5,0x18e));var _0x563a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x63a5[_0x46698a];return _0x356db0;};'use strict';module[_0x563a('0x0')]={'DOMAIN':_0x563a('0x1'),'SESSION_SECRET':_0x563a('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x563a('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x4888=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x106db6,_0xd6decc){var _0x4dc175=function(_0x14c433){while(--_0x14c433){_0x106db6['push'](_0x106db6['shift']());}};_0x4dc175(++_0xd6decc);}(_0x4888,0x198));var _0x8488=function(_0x5b474c,_0x53a6e5){_0x5b474c=_0x5b474c-0x0;var _0x6f3112=_0x4888[_0x5b474c];return _0x6f3112;};'use strict';module['exports']={'DOMAIN':_0x8488('0x0'),'SESSION_SECRET':_0x8488('0x1'),'GOOGLE_ID':_0x8488('0x2'),'GOOGLE_SECRET':_0x8488('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 1f1a906..d6c8edf 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0dac=['exports','../utils/loggers'];(function(_0x2ca308,_0x2b2da6){var _0x301c9f=function(_0x15ff69){while(--_0x15ff69){_0x2ca308['push'](_0x2ca308['shift']());}};_0x301c9f(++_0x2b2da6);}(_0x0dac,0x1a1));var _0xc0da=function(_0x2a43bd,_0x277664){_0x2a43bd=_0x2a43bd-0x0;var _0x1e2552=_0x0dac[_0x2a43bd];return _0x1e2552;};'use strict';var fileLogger=require(_0xc0da('0x0'))['fileLogger'];module[_0xc0da('0x1')]=fileLogger; \ No newline at end of file +var _0x594e=['exports','../utils/loggers','fileLogger'];(function(_0x3c8567,_0x583661){var _0x573c7d=function(_0x4c26f9){while(--_0x4c26f9){_0x3c8567['push'](_0x3c8567['shift']());}};_0x573c7d(++_0x583661);}(_0x594e,0x1b1));var _0xe594=function(_0x896dc4,_0x4007ec){_0x896dc4=_0x896dc4-0x0;var _0x1e36be=_0x594e[_0x896dc4];return _0x1e36be;};'use strict';var fileLogger=require(_0xe594('0x0'))[_0xe594('0x1')];module[_0xe594('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3ecf51c..54a3954 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 _0x930f=['ami','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','resolve','join','root','legacy-libs','express','../../services/express/index.js'];(function(_0x30f30f,_0x3d6fc2){var _0x4f17d1=function(_0x4b0b7b){while(--_0x4b0b7b){_0x30f30f['push'](_0x30f30f['shift']());}};_0x4f17d1(++_0x3d6fc2);}(_0x930f,0xda));var _0xf930=function(_0x4d1c1f,_0x118292){_0x4d1c1f=_0x4d1c1f-0x0;var _0x2b238a=_0x930f[_0x4d1c1f];return _0x2b238a;};'use strict';var path=require(_0xf930('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xf930('0x1')](path[_0xf930('0x2')](cfg[_0xf930('0x3')],_0xf930('0x4')))};var pm2config={'apps':[{'name':_0xf930('0x5'),'script':path[_0xf930('0x2')](__dirname,_0xf930('0x6')),'env':env},{'name':_0xf930('0x7'),'script':path['join'](__dirname,_0xf930('0x8')),'env':env},{'name':'agi','script':path[_0xf930('0x2')](__dirname,_0xf930('0x9')),'env':env},{'name':'email','script':path[_0xf930('0x2')](__dirname,_0xf930('0xa')),'env':env},{'name':_0xf930('0xb'),'script':path[_0xf930('0x2')](__dirname,_0xf930('0xc')),'env':env},{'name':_0xf930('0xd'),'script':path['join'](__dirname,_0xf930('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x3596=['exports','path','../../config/environment','resolve','root','express','../../services/express/index.js','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x3cc739,_0x2532de){var _0x5b89ff=function(_0x24844a){while(--_0x24844a){_0x3cc739['push'](_0x3cc739['shift']());}};_0x5b89ff(++_0x2532de);}(_0x3596,0x151));var _0x6359=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x3596[_0xd1d19a];return _0x52a79d;};'use strict';var path=require(_0x6359('0x0'));var cfg=require(_0x6359('0x1'));var env={'NODE_PATH':path[_0x6359('0x2')](path['join'](cfg[_0x6359('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x6359('0x4'),'script':path['join'](__dirname,_0x6359('0x5')),'env':env},{'name':'ami','script':path[_0x6359('0x6')](__dirname,_0x6359('0x7')),'env':env},{'name':_0x6359('0x8'),'script':path['join'](__dirname,_0x6359('0x9')),'env':env},{'name':_0x6359('0xa'),'script':path[_0x6359('0x6')](__dirname,_0x6359('0xb')),'env':env},{'name':_0x6359('0xc'),'script':path['join'](__dirname,_0x6359('0xd')),'env':env},{'name':_0x6359('0xe'),'script':path[_0x6359('0x6')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x6359('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index df08f36..8e5abfa 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 _0xb440=['start','then','stop','disconnect','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x3b2f28,_0xef1370){var _0x192dd4=function(_0x2641fb){while(--_0x2641fb){_0x3b2f28['push'](_0x3b2f28['shift']());}};_0x192dd4(++_0xef1370);}(_0xb440,0x1d7));var _0x0b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb440[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x0b44('0x0'));var BPromise=require(_0x0b44('0x1'));var config=require(_0x0b44('0x2'));function connect(){return new BPromise(function(_0x1d0fe0,_0x3b290e){return pm2[_0x0b44('0x3')](function(_0x524f1e){if(_0x524f1e){return _0x3b290e(_0x524f1e);}return _0x1d0fe0(_0x0b44('0x4'));});});};exports[_0x0b44('0x5')]=function(_0x5a8bfd){return connect()[_0x0b44('0x6')](function(){return new BPromise(function(_0x444dbe,_0x5824f9){return pm2[_0x0b44('0x5')](_0x5a8bfd,function(_0x2636bc,_0x24d6c5){if(_0x2636bc){return _0x5824f9(_0x2636bc);}pm2['disconnect']();return _0x444dbe(_0x24d6c5);});});});};exports[_0x0b44('0x7')]=function(_0x113f16){return connect()[_0x0b44('0x6')](function(){return new BPromise(function(_0x183938,_0x13137e){return pm2[_0x0b44('0x7')](_0x113f16,function(_0x47f9e8,_0x5967e1){if(_0x47f9e8){return _0x13137e(_0x47f9e8);}pm2[_0x0b44('0x8')]();return _0x183938(_0x5967e1);});});});};exports['restart']=function(_0xc53f36){return connect()[_0x0b44('0x6')](function(){return new BPromise(function(_0x2eed56,_0x379e9a){return pm2['restart'](_0xc53f36,function(_0x466716,_0x3e5486){if(_0x466716){return _0x379e9a(_0x466716);}pm2[_0x0b44('0x8')]();return _0x2eed56(_0x3e5486);});});});};exports[_0x0b44('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x531ce7,_0x5499b2){return pm2[_0x0b44('0x9')](function(_0x17c8ce,_0x12ba8b){if(_0x17c8ce){return _0x5499b2(_0x17c8ce);}pm2[_0x0b44('0x8')]();return _0x531ce7(_0x12ba8b);});});});};exports[_0x0b44('0xa')]=function(_0x179025){return connect()[_0x0b44('0x6')](function(){return new BPromise(function(_0x52471d,_0xe3fd35){return pm2[_0x0b44('0xa')](_0x179025,function(_0x48afad,_0x5f1a60){if(_0x48afad){return _0xe3fd35(_0x48afad);}pm2[_0x0b44('0x8')]();return _0x52471d(_0x5f1a60);});});});};exports[_0x0b44('0xb')]=function(_0xdac7ed){return connect()[_0x0b44('0x6')](function(){return new BPromise(function(_0x134d5e,_0x34c4a6){return pm2[_0x0b44('0xb')](_0xdac7ed,function(_0x1711ec,_0xcdbc42){if(_0x1711ec){return _0x34c4a6(_0x1711ec);}pm2[_0x0b44('0x8')]();return _0x134d5e(_0xcdbc42);});});});};exports[_0x0b44('0xc')]=function(){return connect()[_0x0b44('0x6')](function(){return new BPromise(function(_0x5a18bc,_0x41d284){return pm2[_0x0b44('0xc')](function(_0x186ea2){if(_0x186ea2){return _0x41d284(_0x186ea2);}return _0x5a18bc(_0x0b44('0xd'));});});});}; \ No newline at end of file +var _0xfd70=['delete','dump','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe'];(function(_0xc99b00,_0x16f60f){var _0x31369d=function(_0x46c31d){while(--_0x46c31d){_0xc99b00['push'](_0xc99b00['shift']());}};_0x31369d(++_0x16f60f);}(_0xfd70,0x154));var _0x0fd7=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0xfd70[_0x4ec520];return _0xed49d7;};'use strict';var pm2=require('pm2');var BPromise=require(_0x0fd7('0x0'));var config=require(_0x0fd7('0x1'));function connect(){return new BPromise(function(_0x43e686,_0x581da6){return pm2[_0x0fd7('0x2')](function(_0x2f5478){if(_0x2f5478){return _0x581da6(_0x2f5478);}return _0x43e686(_0x0fd7('0x3'));});});};exports[_0x0fd7('0x4')]=function(_0x317b14){return connect()[_0x0fd7('0x5')](function(){return new BPromise(function(_0x1d95bf,_0x4726c7){return pm2[_0x0fd7('0x4')](_0x317b14,function(_0x3934c6,_0x22747e){if(_0x3934c6){return _0x4726c7(_0x3934c6);}pm2[_0x0fd7('0x6')]();return _0x1d95bf(_0x22747e);});});});};exports[_0x0fd7('0x7')]=function(_0x4f71ac){return connect()[_0x0fd7('0x5')](function(){return new BPromise(function(_0x2cba3c,_0x468f3a){return pm2[_0x0fd7('0x7')](_0x4f71ac,function(_0x186612,_0x3792fd){if(_0x186612){return _0x468f3a(_0x186612);}pm2[_0x0fd7('0x6')]();return _0x2cba3c(_0x3792fd);});});});};exports[_0x0fd7('0x8')]=function(_0xe2a59f){return connect()[_0x0fd7('0x5')](function(){return new BPromise(function(_0x4afb9a,_0x257d3e){return pm2[_0x0fd7('0x8')](_0xe2a59f,function(_0x54156e,_0x4f919c){if(_0x54156e){return _0x257d3e(_0x54156e);}pm2[_0x0fd7('0x6')]();return _0x4afb9a(_0x4f919c);});});});};exports[_0x0fd7('0x9')]=function(){return connect()[_0x0fd7('0x5')](function(){return new BPromise(function(_0x5cc6a4,_0x5247a9){return pm2[_0x0fd7('0x9')](function(_0x31ba4f,_0x16b709){if(_0x31ba4f){return _0x5247a9(_0x31ba4f);}pm2[_0x0fd7('0x6')]();return _0x5cc6a4(_0x16b709);});});});};exports[_0x0fd7('0xa')]=function(_0xff44cd){return connect()[_0x0fd7('0x5')](function(){return new BPromise(function(_0x13b9f5,_0x314f8b){return pm2[_0x0fd7('0xa')](_0xff44cd,function(_0x35a79b,_0x23fa85){if(_0x35a79b){return _0x314f8b(_0x35a79b);}pm2[_0x0fd7('0x6')]();return _0x13b9f5(_0x23fa85);});});});};exports['delete']=function(_0xb9bd1e){return connect()[_0x0fd7('0x5')](function(){return new BPromise(function(_0x1b8704,_0x2cf2d3){return pm2[_0x0fd7('0xb')](_0xb9bd1e,function(_0x427c57,_0x1546e4){if(_0x427c57){return _0x2cf2d3(_0x427c57);}pm2[_0x0fd7('0x6')]();return _0x1b8704(_0x1546e4);});});});};exports[_0x0fd7('0xc')]=function(){return connect()[_0x0fd7('0x5')](function(){return new BPromise(function(_0xe327eb,_0x37341f){return pm2[_0x0fd7('0xc')](function(_0x597b12){if(_0x597b12){return _0x37341f(_0x597b12);}return _0xe327eb('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 85c9243..b03591e 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 _0x6dd9=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6dd9,0x8e));var _0x96dd=function(_0x54f84,_0x291b0d){_0x54f84=_0x54f84-0x0;var _0xdd844d=_0x6dd9[_0x54f84];return _0xdd844d;};'use strict';var _=require('lodash');var moment=require(_0x96dd('0x0'));var Redis=require(_0x96dd('0x1'));var util=require(_0x96dd('0x2'));var config=require(_0x96dd('0x3'));var db=require(_0x96dd('0x4'))['db'];var logger=require(_0x96dd('0x5'))(_0x96dd('0x6'));config[_0x96dd('0x7')]=_[_0x96dd('0x8')](config[_0x96dd('0x7')],{'host':_0x96dd('0x9'),'port':0x18eb});var io=require(_0x96dd('0xa'))(new Redis(config[_0x96dd('0x7')]));function closeInteractions(){var _0x2ad6fa=0x0;var _0x405773=[];return db['Setting'][_0x96dd('0xb')]({'raw':!![],'attributes':['id',_0x96dd('0xc')],'where':{'id':0x1}})[_0x96dd('0xd')](function(_0x6b5179){_0x2ad6fa=_0x6b5179[_0x96dd('0xc')];if(_0x2ad6fa){return db[_0x96dd('0xe')][_0x96dd('0xf')]({'raw':!![],'attributes':['id',_0x96dd('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x96dd('0x11')](_0x6b5179[_0x96dd('0xc')],_0x96dd('0x12'))}}});}else{return[];}})[_0x96dd('0xd')](function(_0xe08003){if(_0xe08003&&_0xe08003[_0x96dd('0x13')]){_0x405773=_['map'](_0xe08003||[],'id');logger[_0x96dd('0x14')](_0x96dd('0x15'),_0x405773['join']());return db['ChatInteraction'][_0x96dd('0x16')]({'closeReason':_0x96dd('0x17'),'disposition':_0x96dd('0x18'),'closed':!![],'closedAt':moment()[_0x96dd('0x19')](_0x96dd('0x1a'))},{'where':{'id':_0x405773}});}})[_0x96dd('0xd')](function(){if(_0x405773&&_0x405773[_0x96dd('0x13')]){logger[_0x96dd('0x14')](_0x96dd('0x1b'),_0x405773['join']());for(var _0x2430bf=0x0;_0x2430bf<_0x405773[_0x96dd('0x13')];_0x2430bf++){io['emit']('chatInteraction:update',{'id':_0x405773[_0x2430bf],'closed':!![]});}}})[_0x96dd('0x1c')](function(_0x29eaff){logger[_0x96dd('0x1d')](_0x96dd('0x1e'),_0x29eaff?util[_0x96dd('0x1f')](_0x29eaff,{'showHidden':![],'depth':null}):'');});}exports[_0x96dd('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd93e=['lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','map','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','error','start'];(function(_0x3ac4ca,_0x274864){var _0xba10d7=function(_0x436d5f){while(--_0x436d5f){_0x3ac4ca['push'](_0x3ac4ca['shift']());}};_0xba10d7(++_0x274864);}(_0xd93e,0x1f0));var _0xed93=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xd93e[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xed93('0x0'));var moment=require(_0xed93('0x1'));var Redis=require(_0xed93('0x2'));var util=require(_0xed93('0x3'));var config=require(_0xed93('0x4'));var db=require(_0xed93('0x5'))['db'];var logger=require(_0xed93('0x6'))('schedule');config['redis']=_[_0xed93('0x7')](config[_0xed93('0x8')],{'host':_0xed93('0x9'),'port':0x18eb});var io=require(_0xed93('0xa'))(new Redis(config[_0xed93('0x8')]));function closeInteractions(){var _0x573f1f=0x0;var _0xc0a8c=[];return db[_0xed93('0xb')][_0xed93('0xc')]({'raw':!![],'attributes':['id',_0xed93('0xd')],'where':{'id':0x1}})['then'](function(_0x1ae280){_0x573f1f=_0x1ae280[_0xed93('0xd')];if(_0x573f1f){return db[_0xed93('0xe')][_0xed93('0xf')]({'raw':!![],'attributes':['id',_0xed93('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xed93('0x11')](_0x1ae280[_0xed93('0xd')],_0xed93('0x12'))}}});}else{return[];}})[_0xed93('0x13')](function(_0x26dc3b){if(_0x26dc3b&&_0x26dc3b[_0xed93('0x14')]){_0xc0a8c=_[_0xed93('0x15')](_0x26dc3b||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0xc0a8c[_0xed93('0x16')]());return db[_0xed93('0xe')][_0xed93('0x17')]({'closeReason':'system','disposition':_0xed93('0x18'),'closed':!![],'closedAt':moment()[_0xed93('0x19')](_0xed93('0x1a'))},{'where':{'id':_0xc0a8c}});}})[_0xed93('0x13')](function(){if(_0xc0a8c&&_0xc0a8c[_0xed93('0x14')]){logger['info'](_0xed93('0x1b'),_0xc0a8c[_0xed93('0x16')]());for(var _0x5ed75b=0x0;_0x5ed75b<_0xc0a8c[_0xed93('0x14')];_0x5ed75b++){io['emit'](_0xed93('0x1c'),{'id':_0xc0a8c[_0x5ed75b],'closed':!![]});}}})['catch'](function(_0x577b5f){logger[_0xed93('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x577b5f?util['inspect'](_0x577b5f,{'showHidden':![],'depth':null}):'');});}exports[_0xed93('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index c439814..242b06e 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 _0xdcb2=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0xdcb2,0x1f0));var _0x2dcb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcb2[_0x1facfa];return _0x9ec701;};'use strict';function start(){var _0x562542=require(_0x2dcb('0x0'));return _0x562542[_0x2dcb('0x1')]();}module[_0x2dcb('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xb129=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x1ded25,_0x26be3d){var _0x8ec99f=function(_0x3017ac){while(--_0x3017ac){_0x1ded25['push'](_0x1ded25['shift']());}};_0x8ec99f(++_0x26be3d);}(_0xb129,0x7b));var _0x9b12=function(_0x5c7525,_0x39490f){_0x5c7525=_0x5c7525-0x0;var _0x2e2ec8=_0xb129[_0x5c7525];return _0x2e2ec8;};'use strict';function start(){var _0x845228=require(_0x9b12('0x0'));return _0x845228[_0x9b12('0x1')]();}module[_0x9b12('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 00f1881..27e8e7a 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 _0x4c2e=['keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','isBetween','add','start','add\x20cron','stop\x20cron','startAt','endAt','update','update\x20cron','run','path','lodash','moment','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','MailAccount','name','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x4c2e,0x184));var _0xe4c2=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x4c2e[_0x1e4360];return _0x31e6b4;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xe4c2('0x0'));var _=require(_0xe4c2('0x1'));var moment=require(_0xe4c2('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xe4c2('0x3'));var BPromise=require('bluebird');var logger=require(_0xe4c2('0x4'))(_0xe4c2('0x5'));var db=require(_0xe4c2('0x6'))['db'];var analyticCustomReportController=require(_0xe4c2('0x7'));var analyticDefaultReportController=require(_0xe4c2('0x8'));var client=jayson[_0xe4c2('0x9')][_0xe4c2('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4cef7b,_0x897dca){return function(){logger[_0xe4c2('0xb')](_0xe4c2('0xc'),_0x4cef7b[_0xe4c2('0xd')]);var _0x596df6=!![];var _0x532743=_0x4cef7b['MailAccount'][_0xe4c2('0xe')]();var _0x53a7bb={'account':_0x532743,'message':{'from':util[_0xe4c2('0xf')]('\x22%s\x22\x20<%s>',_0x4cef7b[_0xe4c2('0x10')][_0xe4c2('0x11')],_0x4cef7b['MailAccount'][_0xe4c2('0xd')]||_0x4cef7b[_0xe4c2('0x10')]['Smtp'][_0xe4c2('0x12')]),'to':_0x4cef7b[_0xe4c2('0xd')],'cc':_0x4cef7b['cc'],'bcc':_0x4cef7b['bcc'],'subject':util[_0xe4c2('0xf')](_0xe4c2('0x13'),_0x897dca[_0xe4c2('0x11')],_0x4cef7b[_0xe4c2('0x14')],_0x4cef7b[_0xe4c2('0x15')])}};var _0x3e0a66=path[_0xe4c2('0x16')](__dirname,_0xe4c2('0x17'));var _0x3c2d22=_0x897dca[_0xe4c2('0x18')];var _0x204958=util[_0xe4c2('0xf')](_0xe4c2('0x19'),path[_0xe4c2('0x1a')](_0x897dca[_0xe4c2('0x18')],path[_0xe4c2('0x1b')](_0x897dca[_0xe4c2('0x18')])),_0xe4c2('0x1c'));var _0x39f3f6=path['join'](_0x3e0a66,_0x3c2d22);var _0x5d29d4=path[_0xe4c2('0x16')](_0x3e0a66,_0x204958);if(fs[_0xe4c2('0x1d')](_0x39f3f6)){_0x897dca[_0xe4c2('0x1e')]=_0xe4c2('0x1f');_0x53a7bb[_0xe4c2('0x20')][_0xe4c2('0x21')]=[{'filename':_0x3c2d22,'path':_0x39f3f6}];_0x53a7bb[_0xe4c2('0x20')]['text']=util['format'](_0xe4c2('0x22'),JSON['stringify'](_0x897dca,null,0x2));}else if(fs[_0xe4c2('0x1d')](_0x5d29d4)){_0x897dca[_0xe4c2('0x1e')]='Sent';_0x53a7bb['message'][_0xe4c2('0x21')]=[{'filename':_0x204958,'path':_0x5d29d4}];}else{_0x53a7bb[_0xe4c2('0x20')][_0xe4c2('0x23')]=_0xe4c2('0x24');if(!_0x4cef7b[_0xe4c2('0x25')]){_0x596df6=![];logger[_0xe4c2('0xb')](_0xe4c2('0x26'));}}if(_0x596df6){return client['request'](_0xe4c2('0x27'),_0x53a7bb)[_0xe4c2('0x28')](function(_0x108912){if(_0x108912[_0xe4c2('0x29')]){return logger['error'](_0xe4c2('0x2a'),JSON[_0xe4c2('0x2b')](_0x108912));}return logger['info'](_0xe4c2('0x2c'));})[_0xe4c2('0x2d')](function(_0x1b2de1){return logger['error'](_0xe4c2('0x2a'),JSON[_0xe4c2('0x2b')](_0x1b2de1));});}};}function handleError(){return function(_0x49eef4){return logger[_0xe4c2('0x29')](JSON['stringify'](_0x49eef4));};}function handleResult(_0x1e8506){return function(_0x51d785){logger['info'](_0xe4c2('0x2e'),JSON[_0xe4c2('0x2b')](_0x51d785));if(_0x1e8506['MailAccount']&&_0x1e8506[_0xe4c2('0x10')][_0xe4c2('0x2f')]&&!_[_0xe4c2('0x30')](_0x1e8506[_0xe4c2('0xd')])){setTimeout(handleSendEmail(_0x1e8506,_0x51d785),0x3c*0x3e8);}};}function handleJob(_0x4f1597){return function(){try{if(_[_0xe4c2('0x30')](_0x4f1597['subtractNumber'])){return logger[_0xe4c2('0xb')](_0xe4c2('0x31'));}if(_[_0xe4c2('0x30')](_0x4f1597[_0xe4c2('0x15')])){return logger[_0xe4c2('0xb')](_0xe4c2('0x32'));}var _0x3f636e={'startDate':moment()['subtract'](_0x4f1597[_0xe4c2('0x14')],_0x4f1597[_0xe4c2('0x15')])[_0xe4c2('0xf')](_0xe4c2('0x33')),'endDate':moment()[_0xe4c2('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xe4c2('0x34'),'output':_0x4f1597['output'],'name':_0x4f1597[_0xe4c2('0x11')]};if(!_[_0xe4c2('0x30')](_0x4f1597[_0xe4c2('0x35')])){logger[_0xe4c2('0xb')](_0xe4c2('0x36'),_0x4f1597[_0xe4c2('0x35')]);return analyticDefaultReportController[_0xe4c2('0x37')]({'id':_0x4f1597['DefaultReportId']},_0x3f636e)[_0xe4c2('0x28')](handleResult(_0x4f1597))[_0xe4c2('0x2d')](handleError());}if(!_['isNil'](_0x4f1597[_0xe4c2('0x38')])){logger[_0xe4c2('0xb')](_0xe4c2('0x39'),_0x4f1597[_0xe4c2('0x38')]);return analyticCustomReportController[_0xe4c2('0x37')]({'id':_0x4f1597[_0xe4c2('0x38')]},_0x3f636e)['then'](handleResult(_0x4f1597))[_0xe4c2('0x2d')](handleError());}}catch(_0x1f8e69){logger[_0xe4c2('0x29')](JSON[_0xe4c2('0x2b')](_0x1f8e69));}return logger['info'](_0xe4c2('0x3a'));};}function getJobs(_0x52f846){var _0x3604ed={};if(_0x52f846){_0x3604ed['id']=_0x52f846;}return db[_0xe4c2('0x3b')][_0xe4c2('0x3c')]({'where':_0x3604ed,'include':[{'model':db[_0xe4c2('0x10')],'attributes':['id',_0xe4c2('0x11'),_0xe4c2('0xd')],'include':[{'model':db[_0xe4c2('0x3d')],'as':'Smtp','include':[{'model':db[_0xe4c2('0x3e')],'as':'CloudProvider'}]}]}]})[_0xe4c2('0x28')](function(_0x3f07aa){var _0xf826a6=_[_0xe4c2('0x3f')](manager[_0xe4c2('0x40')]);var _0x406a47=_[_0xe4c2('0x41')](_0x3f07aa,function(_0x21afc1){return _0x21afc1['id'][_0xe4c2('0x42')]();});var _0x5c0ed2=_[_0xe4c2('0x43')](_0x3f07aa,function(_0x56a199){return _0x56a199['id'][_0xe4c2('0x42')]();});var _0x5e496b=_0x52f846?_0x406a47:_[_0xe4c2('0x44')](_0x406a47,_0xf826a6);var _0x339870=_[_0xe4c2('0x45')](_0x406a47,_0xf826a6);var _0x520031=_[_0xe4c2('0x44')](_0xf826a6,_0x406a47);var _0x3c691e;var _0x32e8cf;for(_0x3c691e=0x0;_0x3c691e<_0x520031[_0xe4c2('0x46')]&&!_0x52f846;_0x3c691e+=0x1){_0x32e8cf=_0x520031[_0x3c691e][_0xe4c2('0x42')]();if(manager[_0xe4c2('0x47')](_0x32e8cf)){manager[_0xe4c2('0x48')](_0x32e8cf);manager[_0xe4c2('0x49')](_0x32e8cf);logger[_0xe4c2('0xb')](_0xe4c2('0x4a'),_0x32e8cf);}}logger['info'](_0xe4c2('0x4b'),JSON[_0xe4c2('0x2b')](_0x5e496b));for(_0x3c691e=0x0;_0x3c691e<_0x5e496b[_0xe4c2('0x46')];_0x3c691e+=0x1){_0x32e8cf=_0x5e496b[_0x3c691e][_0xe4c2('0x42')]();logger['info'](_0xe4c2('0x4c'),_0x32e8cf);if(_0x52f846){logger[_0xe4c2('0xb')](_0xe4c2('0x4d'),_0x52f846);logger[_0xe4c2('0xb')](JSON['stringify'](_0x5c0ed2[_0x32e8cf]));BPromise['resolve']()[_0xe4c2('0x28')](handleJob(_0x5c0ed2[_0x32e8cf]));logger[_0xe4c2('0xb')](_0xe4c2('0x4e'),_0x5c0ed2[_0x32e8cf]['name'],_0x5c0ed2[_0x32e8cf][_0xe4c2('0x4f')]);}else if(_0x5c0ed2[_0x32e8cf][_0xe4c2('0x4f')]&&_0x5c0ed2[_0x32e8cf][_0xe4c2('0x50')]&&moment()[_0xe4c2('0x51')](_0x5c0ed2[_0x32e8cf]['startAt'],_0x5c0ed2[_0x32e8cf]['endAt'])){manager[_0xe4c2('0x52')](_0x32e8cf,_0x5c0ed2[_0x32e8cf]['cron'],handleJob(_0x5c0ed2[_0x32e8cf]));manager[_0xe4c2('0x53')](_0x32e8cf);logger[_0xe4c2('0xb')](_0xe4c2('0x54'),_0x5c0ed2[_0x32e8cf]['name'],_0x5c0ed2[_0x32e8cf][_0xe4c2('0x4f')]);}else if(manager[_0xe4c2('0x47')](_0x32e8cf)){manager[_0xe4c2('0x48')](_0x32e8cf);manager[_0xe4c2('0x49')](_0x32e8cf);logger[_0xe4c2('0xb')](_0xe4c2('0x55'),_0x5c0ed2[_0x32e8cf][_0xe4c2('0x11')],_0x5c0ed2[_0x32e8cf][_0xe4c2('0x4f')]);}}for(_0x3c691e=0x0,_0x32e8cf;_0x3c691e<_0x339870['length']&&!_0x52f846;_0x3c691e+=0x1){_0x32e8cf=_0x339870[_0x3c691e][_0xe4c2('0x42')]();if(manager[_0xe4c2('0x47')](_0x32e8cf)){if(_0x5c0ed2[_0x32e8cf]['cron']&&_0x5c0ed2[_0x32e8cf][_0xe4c2('0x50')]&&moment()[_0xe4c2('0x51')](_0x5c0ed2[_0x32e8cf][_0xe4c2('0x56')],_0x5c0ed2[_0x32e8cf][_0xe4c2('0x57')])){manager[_0xe4c2('0x58')](_0x32e8cf,_0x5c0ed2[_0x32e8cf][_0xe4c2('0x4f')],handleJob(_0x5c0ed2[_0x32e8cf]));logger[_0xe4c2('0xb')](_0xe4c2('0x59'),_0x5c0ed2[_0x32e8cf]['name'],_0x5c0ed2[_0x32e8cf]['cron']);}else{manager[_0xe4c2('0x48')](_0x32e8cf);manager[_0xe4c2('0x49')](_0x32e8cf);logger[_0xe4c2('0xb')]('stop\x20cron',_0x5c0ed2[_0x32e8cf][_0xe4c2('0x11')],_0x5c0ed2[_0x32e8cf][_0xe4c2('0x4f')]);}}}})[_0xe4c2('0x2d')](function(_0x20cf9a){logger[_0xe4c2('0x29')](JSON[_0xe4c2('0x2b')](_0x20cf9a));});}exports[_0xe4c2('0x5a')]=function(_0xc8ea5b){return getJobs(_0xc8ea5b);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb477=['deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','run','util','path','lodash','moment','jayson/promise','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','%s.%s','basename','extname','join','existsSync','status','Sent','message','text','stringify','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','catch','Smtp','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop'];(function(_0x50dd7d,_0x12f7a5){var _0x7ff8ae=function(_0x4dbbdc){while(--_0x4dbbdc){_0x50dd7d['push'](_0x50dd7d['shift']());}};_0x7ff8ae(++_0x12f7a5);}(_0xb477,0xac));var _0x7b47=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb477[_0x4b055c];return _0x4b62bb;};'use strict';var fs=require('fs');var util=require(_0x7b47('0x0'));var path=require(_0x7b47('0x1'));var _=require(_0x7b47('0x2'));var moment=require(_0x7b47('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x7b47('0x4'));var BPromise=require('bluebird');var logger=require(_0x7b47('0x5'))('schedule');var db=require(_0x7b47('0x6'))['db'];var analyticCustomReportController=require(_0x7b47('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x7b47('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x369933,_0x1f3f89){return function(){logger[_0x7b47('0x9')](_0x7b47('0xa'),_0x369933[_0x7b47('0xb')]);var _0x1873b0=!![];var _0x392158=_0x369933[_0x7b47('0xc')][_0x7b47('0xd')]();var _0x7dafed={'account':_0x392158,'message':{'from':util[_0x7b47('0xe')](_0x7b47('0xf'),_0x369933['MailAccount'][_0x7b47('0x10')],_0x369933[_0x7b47('0xc')][_0x7b47('0xb')]||_0x369933[_0x7b47('0xc')]['Smtp'][_0x7b47('0x11')]),'to':_0x369933['email'],'cc':_0x369933['cc'],'bcc':_0x369933['bcc'],'subject':util[_0x7b47('0xe')](_0x7b47('0x12'),_0x1f3f89[_0x7b47('0x10')],_0x369933[_0x7b47('0x13')],_0x369933[_0x7b47('0x14')])}};var _0x4daa5d=path['join'](__dirname,_0x7b47('0x15'));var _0x36aade=_0x1f3f89['savename'];var _0x22f14b=util[_0x7b47('0xe')](_0x7b47('0x16'),path[_0x7b47('0x17')](_0x1f3f89['savename'],path[_0x7b47('0x18')](_0x1f3f89['savename'])),'zip');var _0x1b24f0=path[_0x7b47('0x19')](_0x4daa5d,_0x36aade);var _0x131087=path[_0x7b47('0x19')](_0x4daa5d,_0x22f14b);if(fs[_0x7b47('0x1a')](_0x1b24f0)){_0x1f3f89[_0x7b47('0x1b')]=_0x7b47('0x1c');_0x7dafed['message']['attachments']=[{'filename':_0x36aade,'path':_0x1b24f0}];_0x7dafed[_0x7b47('0x1d')][_0x7b47('0x1e')]=util[_0x7b47('0xe')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x7b47('0x1f')](_0x1f3f89,null,0x2));}else if(fs[_0x7b47('0x1a')](_0x131087)){_0x1f3f89['status']=_0x7b47('0x1c');_0x7dafed[_0x7b47('0x1d')]['attachments']=[{'filename':_0x22f14b,'path':_0x131087}];}else{_0x7dafed[_0x7b47('0x1d')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x369933[_0x7b47('0x20')]){_0x1873b0=![];logger[_0x7b47('0x9')](_0x7b47('0x21'));}}if(_0x1873b0){return client['request'](_0x7b47('0x22'),_0x7dafed)[_0x7b47('0x23')](function(_0x21b337){if(_0x21b337['error']){return logger[_0x7b47('0x24')](_0x7b47('0x25'),JSON[_0x7b47('0x1f')](_0x21b337));}return logger[_0x7b47('0x9')](_0x7b47('0x26'));})[_0x7b47('0x27')](function(_0x26d93){return logger['error'](_0x7b47('0x25'),JSON[_0x7b47('0x1f')](_0x26d93));});}};}function handleError(){return function(_0x20d7b1){return logger[_0x7b47('0x24')](JSON['stringify'](_0x20d7b1));};}function handleResult(_0xdfdbb1){return function(_0x2875e){logger[_0x7b47('0x9')]('data',JSON['stringify'](_0x2875e));if(_0xdfdbb1[_0x7b47('0xc')]&&_0xdfdbb1['MailAccount'][_0x7b47('0x28')]&&!_['isNil'](_0xdfdbb1[_0x7b47('0xb')])){setTimeout(handleSendEmail(_0xdfdbb1,_0x2875e),0x3c*0x3e8);}};}function handleJob(_0x4bbea2){return function(){try{if(_['isNil'](_0x4bbea2[_0x7b47('0x13')])){return logger[_0x7b47('0x9')](_0x7b47('0x29'));}if(_[_0x7b47('0x2a')](_0x4bbea2[_0x7b47('0x14')])){return logger[_0x7b47('0x9')](_0x7b47('0x2b'));}var _0x2525ba={'startDate':moment()[_0x7b47('0x2c')](_0x4bbea2['subtractNumber'],_0x4bbea2[_0x7b47('0x14')])[_0x7b47('0xe')](_0x7b47('0x2d')),'endDate':moment()[_0x7b47('0xe')](_0x7b47('0x2d')),'type':'scheduled','output':_0x4bbea2[_0x7b47('0x2e')],'name':_0x4bbea2[_0x7b47('0x10')]};if(!_[_0x7b47('0x2a')](_0x4bbea2[_0x7b47('0x2f')])){logger[_0x7b47('0x9')]('exec\x20defaul\x20report\x20id:%s',_0x4bbea2['DefaultReportId']);return analyticDefaultReportController[_0x7b47('0x30')]({'id':_0x4bbea2[_0x7b47('0x2f')]},_0x2525ba)[_0x7b47('0x23')](handleResult(_0x4bbea2))[_0x7b47('0x27')](handleError());}if(!_[_0x7b47('0x2a')](_0x4bbea2['CustomReportId'])){logger[_0x7b47('0x9')]('exec\x20custom\x20report\x20id:%s',_0x4bbea2['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x4bbea2[_0x7b47('0x31')]},_0x2525ba)[_0x7b47('0x23')](handleResult(_0x4bbea2))[_0x7b47('0x27')](handleError());}}catch(_0x1ec947){logger[_0x7b47('0x24')](JSON['stringify'](_0x1ec947));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x1100df){var _0xc30d72={};if(_0x1100df){_0xc30d72['id']=_0x1100df;}return db['Schedule'][_0x7b47('0x32')]({'where':_0xc30d72,'include':[{'model':db[_0x7b47('0xc')],'attributes':['id',_0x7b47('0x10'),_0x7b47('0xb')],'include':[{'model':db[_0x7b47('0x33')],'as':_0x7b47('0x28'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})['then'](function(_0x11c991){var _0x3857ff=_[_0x7b47('0x34')](manager[_0x7b47('0x35')]);var _0x466417=_[_0x7b47('0x36')](_0x11c991,function(_0x530e81){return _0x530e81['id'][_0x7b47('0x37')]();});var _0x581941=_[_0x7b47('0x38')](_0x11c991,function(_0x1618e4){return _0x1618e4['id'][_0x7b47('0x37')]();});var _0x1cc17d=_0x1100df?_0x466417:_[_0x7b47('0x39')](_0x466417,_0x3857ff);var _0x51305e=_[_0x7b47('0x3a')](_0x466417,_0x3857ff);var _0x16b32e=_[_0x7b47('0x39')](_0x3857ff,_0x466417);var _0x3a6484;var _0xa32a71;for(_0x3a6484=0x0;_0x3a6484<_0x16b32e[_0x7b47('0x3b')]&&!_0x1100df;_0x3a6484+=0x1){_0xa32a71=_0x16b32e[_0x3a6484][_0x7b47('0x37')]();if(manager[_0x7b47('0x3c')](_0xa32a71)){manager[_0x7b47('0x3d')](_0xa32a71);manager[_0x7b47('0x3e')](_0xa32a71);logger['info'](_0x7b47('0x3f'),_0xa32a71);}}logger[_0x7b47('0x9')](_0x7b47('0x40'),JSON[_0x7b47('0x1f')](_0x1cc17d));for(_0x3a6484=0x0;_0x3a6484<_0x1cc17d[_0x7b47('0x3b')];_0x3a6484+=0x1){_0xa32a71=_0x1cc17d[_0x3a6484][_0x7b47('0x37')]();logger[_0x7b47('0x9')](_0x7b47('0x41'),_0xa32a71);if(_0x1100df){logger[_0x7b47('0x9')]('my\x20id',_0x1100df);logger['info'](JSON['stringify'](_0x581941[_0xa32a71]));BPromise[_0x7b47('0x42')]()[_0x7b47('0x23')](handleJob(_0x581941[_0xa32a71]));logger['info'](_0x7b47('0x43'),_0x581941[_0xa32a71]['name'],_0x581941[_0xa32a71][_0x7b47('0x44')]);}else if(_0x581941[_0xa32a71][_0x7b47('0x44')]&&_0x581941[_0xa32a71][_0x7b47('0x45')]&&moment()[_0x7b47('0x46')](_0x581941[_0xa32a71][_0x7b47('0x47')],_0x581941[_0xa32a71][_0x7b47('0x48')])){manager[_0x7b47('0x49')](_0xa32a71,_0x581941[_0xa32a71][_0x7b47('0x44')],handleJob(_0x581941[_0xa32a71]));manager['start'](_0xa32a71);logger[_0x7b47('0x9')](_0x7b47('0x4a'),_0x581941[_0xa32a71][_0x7b47('0x10')],_0x581941[_0xa32a71][_0x7b47('0x44')]);}else if(manager['exists'](_0xa32a71)){manager[_0x7b47('0x3d')](_0xa32a71);manager['deleteJob'](_0xa32a71);logger[_0x7b47('0x9')](_0x7b47('0x4b'),_0x581941[_0xa32a71][_0x7b47('0x10')],_0x581941[_0xa32a71][_0x7b47('0x44')]);}}for(_0x3a6484=0x0,_0xa32a71;_0x3a6484<_0x51305e['length']&&!_0x1100df;_0x3a6484+=0x1){_0xa32a71=_0x51305e[_0x3a6484][_0x7b47('0x37')]();if(manager[_0x7b47('0x3c')](_0xa32a71)){if(_0x581941[_0xa32a71][_0x7b47('0x44')]&&_0x581941[_0xa32a71][_0x7b47('0x45')]&&moment()['isBetween'](_0x581941[_0xa32a71][_0x7b47('0x47')],_0x581941[_0xa32a71][_0x7b47('0x48')])){manager[_0x7b47('0x4c')](_0xa32a71,_0x581941[_0xa32a71]['cron'],handleJob(_0x581941[_0xa32a71]));logger[_0x7b47('0x9')]('update\x20cron',_0x581941[_0xa32a71]['name'],_0x581941[_0xa32a71][_0x7b47('0x44')]);}else{manager[_0x7b47('0x3d')](_0xa32a71);manager[_0x7b47('0x3e')](_0xa32a71);logger[_0x7b47('0x9')](_0x7b47('0x4b'),_0x581941[_0xa32a71]['name'],_0x581941[_0xa32a71][_0x7b47('0x44')]);}}}})['catch'](function(_0x5cf65e){logger[_0x7b47('0x24')](JSON[_0x7b47('0x1f')](_0x5cf65e));});}exports[_0x7b47('0x4d')]=function(_0x13099e){return getJobs(_0x13099e);};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 3bc563d..5572040 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 _0x3423=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','then','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','error','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update'];(function(_0xa0118a,_0xb7f595){var _0x247b2c=function(_0xabda9f){while(--_0xabda9f){_0xa0118a['push'](_0xa0118a['shift']());}};_0x247b2c(++_0xb7f595);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x3342('0x0'));var util=require(_0x3342('0x1'));var BPromise=require(_0x3342('0x2'));var db=require(_0x3342('0x3'))['db'];var logger=require(_0x3342('0x4'))(_0x3342('0x5'));function getTranscriptionJob(_0x2207ce,_0x3c5d8d,_0x3075f8,_0x19206f){return new Promise(function(_0x467453,_0x2ccbe0){var _0x29c40c=new AWS[(_0x3342('0x6'))]({'accessKeyId':_0x3c5d8d,'secretAccessKey':_0x2207ce,'region':_0x3075f8});_0x29c40c[_0x3342('0x7')]({'TranscriptionJobName':_0x19206f},function(_0xce08ab,_0x305d13){if(_0xce08ab){return _0x2ccbe0(_0xce08ab);}else{return _0x467453(_0x305d13);}});});}function sentiment(_0xd9d129,_0x9cc419,_0x4ae4f3,_0x582c37,_0x2d0cb0){return new Promise(function(_0x481a17,_0x5a1fba){var _0x51b276=new AWS['Comprehend']({'accessKeyId':_0x9cc419,'secretAccessKey':_0xd9d129,'region':_0x4ae4f3});_0x51b276[_0x3342('0x8')]({'Text':_0x582c37,'LanguageCode':_0x2d0cb0[_0x3342('0x9')](0x0,0x2)},function(_0x51496d,_0x2d14c4){if(_0x51496d){return _0x5a1fba(_0x51496d);}else{return _0x481a17(_0x2d14c4);}});});}function checkTranscribeJob(_0x5a3cb1,_0x716d80,_0x36e1f4){var _0x592ba8;return new BPromise(function(_0x3e418d,_0x334f0e){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0xc'),_0x5a3cb1['id'],_0x5a3cb1[_0x3342('0xd')]));return getTranscriptionJob(_0x36e1f4[_0x3342('0xe')],_0x36e1f4['data2'],_0x716d80[_0x3342('0xf')],_0x5a3cb1[_0x3342('0xd')])['then'](function(_0x40d609){logger[_0x3342('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5a3cb1['id'],_0x5a3cb1[_0x3342('0xd')],_0x40d609[_0x3342('0x10')][_0x3342('0x11')]));if(!_0x5a3cb1[_0x3342('0x12')]){switch(_0x40d609[_0x3342('0x10')][_0x3342('0x11')]){case _0x3342('0x13'):var _0x3ebf6b={'transcribeStatus':_0x40d609[_0x3342('0x10')]['TranscriptionJobStatus'],'fileUri':_0x40d609[_0x3342('0x10')][_0x3342('0x14')][_0x3342('0x15')]};logger['info'](util[_0x3342('0xb')](_0x3342('0x16'),_0x5a3cb1['id']));return rp({'uri':_0x40d609['TranscriptionJob'][_0x3342('0x14')][_0x3342('0x15')],'json':!![]})['then'](function(_0x4e1b19){logger['info'](util[_0x3342('0xb')](_0x3342('0x17'),_0x5a3cb1['id']));if(_0x4e1b19&&_0x4e1b19[_0x3342('0x18')]&&_0x4e1b19[_0x3342('0x18')][_0x3342('0x19')]&&_0x4e1b19[_0x3342('0x18')][_0x3342('0x19')][_0x3342('0x1a')]){_0x3ebf6b['fileText']='';for(var _0x30ffc9=0x0;_0x30ffc9<_0x4e1b19['results']['transcripts'][_0x3342('0x1a')];_0x30ffc9++){_0x3ebf6b['fileText']+=_0x4e1b19['results'][_0x3342('0x19')][_0x30ffc9]['transcript']+'';}}return _0x5a3cb1[_0x3342('0x1b')](_0x3ebf6b);})['then'](function(){logger['info'](util['format'](_0x3342('0x1c'),_0x5a3cb1['id']));if(!_0x5a3cb1[_0x3342('0x1d')]){throw new db[(_0x3342('0x1e'))]['ValidationError'](_0x3342('0x1f'));}if(!_0x716d80[_0x3342('0x20')]||!_0x716d80[_0x3342('0x21')]||!_0x716d80[_0x3342('0x22')]||!_0x716d80['language']||!_0x716d80[_0x3342('0x23')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x25'));}if(!_0x3ebf6b[_0x3342('0x12')]){throw new Error(_0x3342('0x26'));}if(_0x716d80[_0x3342('0x21')]===_0x36e1f4['id']){return _0x36e1f4;}else{return db['CloudProvider'][_0x3342('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3342('0x28')](function(_0x407f8c){if(!_0x407f8c){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x407f8c[_0x3342('0xe')]||!_0x407f8c[_0x3342('0x2a')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x2b'));}_0x592ba8=_0x407f8c;logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2c'),_0x5a3cb1['id']));return sentiment(_0x592ba8[_0x3342('0xe')],_0x592ba8[_0x3342('0x2a')],_0x716d80[_0x3342('0x22')],_0x3ebf6b[_0x3342('0x12')],_0x716d80[_0x3342('0x2d')]);})[_0x3342('0x28')](function(_0x30dcea){logger['info'](util['format'](_0x3342('0x2e'),_0x5a3cb1['id']));return _0x5a3cb1['update']({'sentiment':_0x30dcea[_0x3342('0x2f')],'sPositive':_0x30dcea[_0x3342('0x30')][_0x3342('0x31')],'sNegative':_0x30dcea[_0x3342('0x30')][_0x3342('0x32')],'sMixed':_0x30dcea[_0x3342('0x30')][_0x3342('0x33')],'sNeutral':_0x30dcea['SentimentScore'][_0x3342('0x34')]});})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});case'FAILED':return _0x5a3cb1[_0x3342('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x40d609[_0x3342('0x10')][_0x3342('0x35')]})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util['format'](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});default:logger['info'](util[_0x3342('0xb')](_0x3342('0x36'),_0x5a3cb1['id']));break;}}else{return BPromise[_0x3342('0x37')]()[_0x3342('0x28')](function(){if(!_0x5a3cb1[_0x3342('0x1d')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x716d80[_0x3342('0x20')]||!_0x716d80[_0x3342('0x21')]||!_0x716d80['sentimentRegion']||!_0x716d80[_0x3342('0x2d')]||!_0x716d80[_0x3342('0x23')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x25'));}if(!_0x5a3cb1['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x716d80['sentimentAccountId']===_0x36e1f4['id']){return _0x36e1f4;}else{return db[_0x3342('0x38')][_0x3342('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3342('0x28')](function(_0x2a1f7e){if(!_0x2a1f7e){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x2a1f7e[_0x3342('0xe')]||!_0x2a1f7e[_0x3342('0x2a')]){throw new db[(_0x3342('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x592ba8=_0x2a1f7e;logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2c'),_0x5a3cb1['id']));return sentiment(_0x592ba8[_0x3342('0xe')],_0x592ba8[_0x3342('0x2a')],_0x716d80[_0x3342('0x22')],_0x5a3cb1['fileText'],_0x716d80[_0x3342('0x2d')]);})[_0x3342('0x28')](function(_0x283ce9){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2e'),_0x5a3cb1['id']));return _0x5a3cb1['update']({'sentiment':_0x283ce9[_0x3342('0x2f')],'sPositive':_0x283ce9['SentimentScore'][_0x3342('0x31')],'sNegative':_0x283ce9[_0x3342('0x30')][_0x3342('0x32')],'sMixed':_0x283ce9[_0x3342('0x30')]['Mixed'],'sNeutral':_0x283ce9[_0x3342('0x30')][_0x3342('0x34')],'transcribeStatus':'COMPLETED'});})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});}})['catch'](function(_0x2e2ebc){if(_0x2e2ebc){if(!_0x2e2ebc[_0x3342('0x39')]||_0x2e2ebc['name']!==_0x3342('0x3a')){logger['error'](util['format'](_0x3342('0x3b'),_0x5a3cb1['id']),util[_0x3342('0x3c')](_0x2e2ebc,{'showHidden':![],'depth':null}));}}_0x3e418d();});});}function checkTranscribe(){var _0x346534;var _0x296cbb;var _0x23925e;return db[_0x3342('0x3d')][_0x3342('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3817fd){if(!_0x3817fd||!_0x3817fd['length']){throw new db[(_0x3342('0x1e'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x346534=_0x3817fd;return db['Setting'][_0x3342('0x27')]({'where':{'id':0x1}});})[_0x3342('0x28')](function(_0x29ccb6){if(!_0x29ccb6){throw new db[(_0x3342('0x1e'))]['ValidationError'](_0x3342('0x3f'));}_0x296cbb=_0x29ccb6;if(!_0x296cbb[_0x3342('0x5')]||!_0x296cbb['transcribeAccountId']||!_0x296cbb[_0x3342('0xf')]||!_0x296cbb[_0x3342('0x2d')]||!_0x296cbb[_0x3342('0x23')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x40'));}return db[_0x3342('0x38')][_0x3342('0x27')]({'where':{'id':_0x296cbb[_0x3342('0x41')]}});})['then'](function(_0x2699d2){if(!_0x2699d2){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x2699d2[_0x3342('0xe')]||!_0x2699d2[_0x3342('0x2a')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x2b'));}_0x23925e=_0x2699d2;var _0x542181=[];_0x346534[_0x3342('0x42')](function(_0x4eebaa){_0x542181[_0x3342('0x43')](checkTranscribeJob(_0x4eebaa,_0x296cbb,_0x23925e));});return BPromise['all'](_0x542181);})['catch'](function(_0x5bff74){if(_0x5bff74){if(!_0x5bff74['name']||_0x5bff74[_0x3342('0x39')]!==_0x3342('0x3a')){logger[_0x3342('0x44')](util[_0x3342('0x3c')](_0x5bff74,{'showHidden':![],'depth':null}));}}});}exports[_0x3342('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x5a1c=['Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','forEach','push','all','start','lodash','aws-sdk','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentiment','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20configured','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative'];(function(_0x761864,_0x2d960d){var _0x49247e=function(_0x493c5f){while(--_0x493c5f){_0x761864['push'](_0x761864['shift']());}};_0x49247e(++_0x2d960d);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x5c04d1,_0x4ca02e){_0x5c04d1=_0x5c04d1-0x0;var _0x48ca76=_0x5a1c[_0x5c04d1];return _0x48ca76;};var _=require(_0xc5a1('0x0'));var AWS=require(_0xc5a1('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0xc5a1('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xc5a1('0x3'))(_0xc5a1('0x4'));function getTranscriptionJob(_0x71fc1,_0x5c3f2d,_0x57b342,_0x429a68){return new Promise(function(_0x3d356e,_0x1ed54a){var _0x5782b9=new AWS[(_0xc5a1('0x5'))]({'accessKeyId':_0x5c3f2d,'secretAccessKey':_0x71fc1,'region':_0x57b342});_0x5782b9[_0xc5a1('0x6')]({'TranscriptionJobName':_0x429a68},function(_0x1ce1df,_0x111921){if(_0x1ce1df){return _0x1ed54a(_0x1ce1df);}else{return _0x3d356e(_0x111921);}});});}function sentiment(_0x42b181,_0x54a2de,_0x28234b,_0x45c8b8,_0x2fb166){return new Promise(function(_0x364ef4,_0x363a3e){var _0x501d85=new AWS[(_0xc5a1('0x7'))]({'accessKeyId':_0x54a2de,'secretAccessKey':_0x42b181,'region':_0x28234b});_0x501d85[_0xc5a1('0x8')]({'Text':_0x45c8b8,'LanguageCode':_0x2fb166['substring'](0x0,0x2)},function(_0x5bac8b,_0xb6fe3b){if(_0x5bac8b){return _0x363a3e(_0x5bac8b);}else{return _0x364ef4(_0xb6fe3b);}});});}function checkTranscribeJob(_0x514744,_0x17d063,_0x5f2534){var _0x37b863;return new BPromise(function(_0x3fafdc,_0x4f4b59){logger[_0xc5a1('0x9')](util['format'](_0xc5a1('0xa'),_0x514744['id'],_0x514744['transcribeName']));return getTranscriptionJob(_0x5f2534[_0xc5a1('0xb')],_0x5f2534[_0xc5a1('0xc')],_0x17d063[_0xc5a1('0xd')],_0x514744[_0xc5a1('0xe')])[_0xc5a1('0xf')](function(_0x5af680){logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')](_0xc5a1('0x11'),_0x514744['id'],_0x514744[_0xc5a1('0xe')],_0x5af680[_0xc5a1('0x12')][_0xc5a1('0x13')]));if(!_0x514744[_0xc5a1('0x14')]){switch(_0x5af680['TranscriptionJob'][_0xc5a1('0x13')]){case _0xc5a1('0x15'):var _0x3b7e90={'transcribeStatus':_0x5af680[_0xc5a1('0x12')]['TranscriptionJobStatus'],'fileUri':_0x5af680[_0xc5a1('0x12')][_0xc5a1('0x16')][_0xc5a1('0x17')]};logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')](_0xc5a1('0x18'),_0x514744['id']));return rp({'uri':_0x5af680[_0xc5a1('0x12')][_0xc5a1('0x16')]['TranscriptFileUri'],'json':!![]})[_0xc5a1('0xf')](function(_0x578788){logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x514744['id']));if(_0x578788&&_0x578788[_0xc5a1('0x19')]&&_0x578788[_0xc5a1('0x19')]['transcripts']&&_0x578788['results'][_0xc5a1('0x1a')][_0xc5a1('0x1b')]){_0x3b7e90['fileText']='';for(var _0x9168e2=0x0;_0x9168e2<_0x578788['results'][_0xc5a1('0x1a')][_0xc5a1('0x1b')];_0x9168e2++){_0x3b7e90[_0xc5a1('0x14')]+=_0x578788[_0xc5a1('0x19')][_0xc5a1('0x1a')][_0x9168e2][_0xc5a1('0x1c')]+'';}}return _0x514744[_0xc5a1('0x1d')](_0x3b7e90);})[_0xc5a1('0xf')](function(){logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')](_0xc5a1('0x1e'),_0x514744['id']));if(!_0x514744['tempSentiment']){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x17d063[_0xc5a1('0x21')]||!_0x17d063['sentimentAccountId']||!_0x17d063[_0xc5a1('0x22')]||!_0x17d063['language']||!_0x17d063[_0xc5a1('0x23')]){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))](_0xc5a1('0x24'));}if(!_0x3b7e90[_0xc5a1('0x14')]){throw new Error(_0xc5a1('0x25'));}if(_0x17d063['sentimentAccountId']===_0x5f2534['id']){return _0x5f2534;}else{return db[_0xc5a1('0x26')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc5a1('0xf')](function(_0x2ec457){if(!_0x2ec457){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2ec457[_0xc5a1('0xb')]||!_0x2ec457['data2']){throw new db[(_0xc5a1('0x1f'))]['ValidationError'](_0xc5a1('0x27'));}_0x37b863=_0x2ec457;logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x514744['id']));return sentiment(_0x37b863[_0xc5a1('0xb')],_0x37b863[_0xc5a1('0xc')],_0x17d063[_0xc5a1('0x22')],_0x3b7e90['fileText'],_0x17d063[_0xc5a1('0x28')]);})['then'](function(_0x2d4d56){logger['info'](util[_0xc5a1('0x10')](_0xc5a1('0x29'),_0x514744['id']));return _0x514744[_0xc5a1('0x1d')]({'sentiment':_0x2d4d56[_0xc5a1('0x2a')],'sPositive':_0x2d4d56[_0xc5a1('0x2b')][_0xc5a1('0x2c')],'sNegative':_0x2d4d56[_0xc5a1('0x2b')][_0xc5a1('0x2d')],'sMixed':_0x2d4d56['SentimentScore']['Mixed'],'sNeutral':_0x2d4d56[_0xc5a1('0x2b')][_0xc5a1('0x2e')]});})[_0xc5a1('0xf')](function(){logger[_0xc5a1('0x9')](util['format'](_0xc5a1('0x1e'),_0x514744['id']));_0x3fafdc();});case _0xc5a1('0x2f'):return _0x514744[_0xc5a1('0x1d')]({'transcribeStatus':_0xc5a1('0x2f'),'failureReason':_0x5af680['TranscriptionJob']['FailureReason']})[_0xc5a1('0xf')](function(){logger['info'](util['format'](_0xc5a1('0x1e'),_0x514744['id']));_0x3fafdc();});default:logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')](_0xc5a1('0x30'),_0x514744['id']));break;}}else{return BPromise[_0xc5a1('0x31')]()[_0xc5a1('0xf')](function(){if(!_0x514744['tempSentiment']){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))](_0xc5a1('0x32'));}if(!_0x17d063[_0xc5a1('0x21')]||!_0x17d063['sentimentAccountId']||!_0x17d063['sentimentRegion']||!_0x17d063[_0xc5a1('0x28')]||!_0x17d063[_0xc5a1('0x23')]){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x514744['fileText']){throw new Error(_0xc5a1('0x25'));}if(_0x17d063['sentimentAccountId']===_0x5f2534['id']){return _0x5f2534;}else{return db[_0xc5a1('0x26')][_0xc5a1('0x33')]({'where':{'id':_settings[_0xc5a1('0x34')]}});}})['then'](function(_0x5cd707){if(!_0x5cd707){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))](_0xc5a1('0x35'));}if(!_0x5cd707[_0xc5a1('0xb')]||!_0x5cd707[_0xc5a1('0xc')]){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))](_0xc5a1('0x27'));}_0x37b863=_0x5cd707;logger[_0xc5a1('0x9')](util[_0xc5a1('0x10')](_0xc5a1('0x36'),_0x514744['id']));return sentiment(_0x37b863[_0xc5a1('0xb')],_0x37b863['data2'],_0x17d063['sentimentRegion'],_0x514744[_0xc5a1('0x14')],_0x17d063[_0xc5a1('0x28')]);})['then'](function(_0xb0fa81){logger['info'](util['format'](_0xc5a1('0x29'),_0x514744['id']));return _0x514744[_0xc5a1('0x1d')]({'sentiment':_0xb0fa81[_0xc5a1('0x2a')],'sPositive':_0xb0fa81[_0xc5a1('0x2b')][_0xc5a1('0x2c')],'sNegative':_0xb0fa81['SentimentScore'][_0xc5a1('0x2d')],'sMixed':_0xb0fa81[_0xc5a1('0x2b')][_0xc5a1('0x37')],'sNeutral':_0xb0fa81[_0xc5a1('0x2b')][_0xc5a1('0x2e')],'transcribeStatus':_0xc5a1('0x15')});})[_0xc5a1('0xf')](function(){logger['info'](util[_0xc5a1('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x514744['id']));_0x3fafdc();});}})[_0xc5a1('0x38')](function(_0x207524){if(_0x207524){if(!_0x207524[_0xc5a1('0x39')]||_0x207524[_0xc5a1('0x39')]!==_0xc5a1('0x3a')){logger[_0xc5a1('0x3b')](util[_0xc5a1('0x10')](_0xc5a1('0x3c'),_0x514744['id']),util[_0xc5a1('0x3d')](_0x207524,{'showHidden':![],'depth':null}));}}_0x3fafdc();});});}function checkTranscribe(){var _0x12e97f;var _0xc98bde;var _0x57e111;return db['VoiceRecording'][_0xc5a1('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0xfe4a4f){if(!_0xfe4a4f||!_0xfe4a4f[_0xc5a1('0x1b')]){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))](_0xc5a1('0x3f'));}_0x12e97f=_0xfe4a4f;return db[_0xc5a1('0x40')][_0xc5a1('0x33')]({'where':{'id':0x1}});})[_0xc5a1('0xf')](function(_0x3e74af){if(!_0x3e74af){throw new db['Sequelize'][(_0xc5a1('0x20'))]('Settings\x20not\x20available');}_0xc98bde=_0x3e74af;if(!_0xc98bde[_0xc5a1('0x4')]||!_0xc98bde['transcribeAccountId']||!_0xc98bde['transcribeRegion']||!_0xc98bde[_0xc5a1('0x28')]||!_0xc98bde[_0xc5a1('0x23')]){throw new db[(_0xc5a1('0x1f'))][(_0xc5a1('0x20'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xc5a1('0x33')]({'where':{'id':_0xc98bde['transcribeAccountId']}});})[_0xc5a1('0xf')](function(_0x55f332){if(!_0x55f332){throw new db['Sequelize'][(_0xc5a1('0x20'))](_0xc5a1('0x35'));}if(!_0x55f332['data1']||!_0x55f332[_0xc5a1('0xc')]){throw new db[(_0xc5a1('0x1f'))]['ValidationError'](_0xc5a1('0x27'));}_0x57e111=_0x55f332;var _0x2e93e5=[];_0x12e97f[_0xc5a1('0x41')](function(_0x6ce549){_0x2e93e5[_0xc5a1('0x42')](checkTranscribeJob(_0x6ce549,_0xc98bde,_0x57e111));});return BPromise[_0xc5a1('0x43')](_0x2e93e5);})[_0xc5a1('0x38')](function(_0x10dc18){if(_0x10dc18){if(!_0x10dc18[_0xc5a1('0x39')]||_0x10dc18[_0xc5a1('0x39')]!==_0xc5a1('0x3a')){logger[_0xc5a1('0x3b')](util[_0xc5a1('0x3d')](_0x10dc18,{'showHidden':![],'depth':null}));}}});}exports[_0xc5a1('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 052040a..44bd891 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 _0x15e0=['join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x88229,_0x3f5953){var _0x5de150=function(_0x3b0713){while(--_0x3b0713){_0x88229['push'](_0x88229['shift']());}};_0x5de150(++_0x3f5953);}(_0x15e0,0x70));var _0x015e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x15e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x015e('0x0'));var moment=require(_0x015e('0x1'));var Redis=require(_0x015e('0x2'));var util=require(_0x015e('0x3'));var config=require(_0x015e('0x4'));var db=require(_0x015e('0x5'))['db'];var logger=require(_0x015e('0x6'))('schedule');config[_0x015e('0x7')]=_[_0x015e('0x8')](config[_0x015e('0x7')],{'host':_0x015e('0x9'),'port':0x18eb});var io=require(_0x015e('0xa'))(new Redis(config[_0x015e('0x7')]));function closeInteractions(){var _0x564a1a=[];return db[_0x015e('0xb')][_0x015e('0xc')]({'raw':!![],'attributes':['id',_0x015e('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x015e('0xe')](0x18,'hours')}}})[_0x015e('0xf')](function(_0x3c689a){if(_0x3c689a&&_0x3c689a[_0x015e('0x10')]){_0x564a1a=_[_0x015e('0x11')](_0x3c689a||[],'id');logger[_0x015e('0x12')](_0x015e('0x13'),_0x564a1a[_0x015e('0x14')]());return db[_0x015e('0xb')][_0x015e('0x15')]({'closeReason':_0x015e('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x015e('0x17')](_0x015e('0x18'))},{'where':{'id':_0x564a1a}});}})[_0x015e('0xf')](function(){if(_0x564a1a&&_0x564a1a[_0x015e('0x10')]){logger[_0x015e('0x12')](_0x015e('0x19'),_0x564a1a[_0x015e('0x14')]());for(var _0x2b20d8=0x0;_0x2b20d8<_0x564a1a[_0x015e('0x10')];_0x2b20d8++){io[_0x015e('0x1a')](_0x015e('0x1b'),{'id':_0x564a1a[_0x2b20d8],'closed':!![]});}}})[_0x015e('0x1c')](function(_0x42babd){logger[_0x015e('0x1d')](_0x015e('0x1e'),_0x42babd?util[_0x015e('0x1f')](_0x42babd,{'showHidden':![],'depth':null}):'');});}exports[_0x015e('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xedf0=['hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','subtract'];(function(_0x2794c6,_0x53cd52){var _0x56774f=function(_0x1f1719){while(--_0x1f1719){_0x2794c6['push'](_0x2794c6['shift']());}};_0x56774f(++_0x53cd52);}(_0xedf0,0xbf));var _0x0edf=function(_0x512550,_0x6a8b6f){_0x512550=_0x512550-0x0;var _0x19f661=_0xedf0[_0x512550];return _0x19f661;};'use strict';var _=require(_0x0edf('0x0'));var moment=require(_0x0edf('0x1'));var Redis=require('ioredis');var util=require(_0x0edf('0x2'));var config=require('../../config/environment');var db=require(_0x0edf('0x3'))['db'];var logger=require(_0x0edf('0x4'))(_0x0edf('0x5'));config['redis']=_[_0x0edf('0x6')](config[_0x0edf('0x7')],{'host':_0x0edf('0x8'),'port':0x18eb});var io=require(_0x0edf('0x9'))(new Redis(config[_0x0edf('0x7')]));function closeInteractions(){var _0x3917bb=[];return db[_0x0edf('0xa')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0edf('0xb')](0x18,_0x0edf('0xc'))}}})[_0x0edf('0xd')](function(_0x54b8ce){if(_0x54b8ce&&_0x54b8ce[_0x0edf('0xe')]){_0x3917bb=_['map'](_0x54b8ce||[],'id');logger['info'](_0x0edf('0xf'),_0x3917bb[_0x0edf('0x10')]());return db['WhatsappInteraction'][_0x0edf('0x11')]({'closeReason':_0x0edf('0x12'),'disposition':_0x0edf('0x13'),'closed':!![],'closedAt':moment()['format'](_0x0edf('0x14'))},{'where':{'id':_0x3917bb}});}})[_0x0edf('0xd')](function(){if(_0x3917bb&&_0x3917bb[_0x0edf('0xe')]){logger[_0x0edf('0x15')](_0x0edf('0x16'),_0x3917bb[_0x0edf('0x10')]());for(var _0x18d5a9=0x0;_0x18d5a9<_0x3917bb['length'];_0x18d5a9++){io[_0x0edf('0x17')]('whatsappInteraction:update',{'id':_0x3917bb[_0x18d5a9],'closed':!![]});}}})[_0x0edf('0x18')](function(_0x110059){logger[_0x0edf('0x19')](_0x0edf('0x1a'),_0x110059?util[_0x0edf('0x1b')](_0x110059,{'showHidden':![],'depth':null}):'');});}exports[_0x0edf('0x1c')]=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 341605c..e3553df 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x622e=['innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','../mysqldb','push','Biondo'];(function(_0x207030,_0x392c00){var _0x1bbf74=function(_0x1ad852){while(--_0x1ad852){_0x207030['push'](_0x207030['shift']());}};_0x1bbf74(++_0x392c00);}(_0x622e,0x140));var _0xe622=function(_0x26eb3d,_0x15d60c){_0x26eb3d=_0x26eb3d-0x0;var _0xb837e=_0x622e[_0x26eb3d];return _0xb837e;};'use strict';var util=require('util');var db=require(_0xe622('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe622('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xe622('0x2')+i,'phone':0xf879fb460+i,'email':_0xe622('0x3')+i+_0xe622('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe622('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe622('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe622('0x5')](),'updatedAt':Date[_0xe622('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe622('0x1')]({'id':i,'firstName':_0xe622('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe622('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe622('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe622('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe622('0x5')](),'updatedAt':Date[_0xe622('0x5')]()});}db[_0xe622('0x7')][_0xe622('0x8')]({'where':{}})['then'](function(){return db[_0xe622('0x7')][_0xe622('0x9')](contacts);})[_0xe622('0xa')](function(){console[_0xe622('0xb')](_0xe622('0xc'),_0xe622('0xd'));return db[_0xe622('0xe')]['destroy']({'where':{}});})['then'](function(){return db[_0xe622('0xe')]['bulkCreate'](hopper);})['then'](function(){console['log'](_0xe622('0xc'),_0xe622('0xf'));return db[_0xe622('0x7')]['bulkCreate'](contacts2);})[_0xe622('0xa')](function(){console['log'](_0xe622('0xc'),_0xe622('0x10'));return db[_0xe622('0xe')]['bulkCreate'](hopper2);})[_0xe622('0xa')](function(){console[_0xe622('0xb')](_0xe622('0xc'),_0xe622('0x11'));})[_0xe622('0x12')](function(_0x1a2c5b){console[_0xe622('0xb')](_0x1a2c5b);}); \ No newline at end of file +var _0x31d8=['CmHopper','log','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1'];(function(_0x3540f3,_0x2fb848){var _0x37fc59=function(_0x1b0751){while(--_0x1b0751){_0x3540f3['push'](_0x3540f3['shift']());}};_0x37fc59(++_0x2fb848);}(_0x31d8,0x70));var _0x831d=function(_0x56ab81,_0x48a2f2){_0x56ab81=_0x56ab81-0x0;var _0x58513b=_0x31d8[_0x56ab81];return _0x58513b;};'use strict';var util=require(_0x831d('0x0'));var db=require(_0x831d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x831d('0x2')]({'id':i,'firstName':_0x831d('0x3')+i,'lastName':_0x831d('0x4')+i,'phone':0xf879fb460+i,'email':_0x831d('0x5')+i+_0x831d('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x831d('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x831d('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x831d('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x831d('0x4')+i,'phone':0xf879fb460+i,'email':_0x831d('0x5')+i+_0x831d('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x831d('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x831d('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x831d('0x7')](),'updatedAt':Date[_0x831d('0x7')]()});}db[_0x831d('0x8')][_0x831d('0x9')]({'where':{}})[_0x831d('0xa')](function(){return db[_0x831d('0x8')][_0x831d('0xb')](contacts);})[_0x831d('0xa')](function(){console['log'](_0x831d('0xc'),_0x831d('0xd'));return db[_0x831d('0xe')][_0x831d('0x9')]({'where':{}});})[_0x831d('0xa')](function(){return db[_0x831d('0xe')][_0x831d('0xb')](hopper);})[_0x831d('0xa')](function(){console[_0x831d('0xf')](_0x831d('0xc'),'hopper1');return db[_0x831d('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0x831d('0xf')]('finished\x20populating',_0x831d('0x10'));return db[_0x831d('0xe')][_0x831d('0xb')](hopper2);})[_0x831d('0xa')](function(){console[_0x831d('0xf')](_0x831d('0xc'),_0x831d('0x11'));})['catch'](function(_0x20df44){console['log'](_0x20df44);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 51e046d..2f89696 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1929=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','add\x20user','catch','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','all','yes'];(function(_0x5c880e,_0x27610e){var _0x5985ee=function(_0x1c3f8d){while(--_0x1c3f8d){_0x5c880e['push'](_0x5c880e['shift']());}};_0x5985ee(++_0x27610e);}(_0x1929,0x198));var _0x9192=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x1929[_0x29632e];return _0x426e04;};'use strict';var util=require(_0x9192('0x0'));var db=require(_0x9192('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9192('0x2')]({'name':util[_0x9192('0x3')](_0x9192('0x4'),_0x9192('0x5'),i),'fullname':util['format'](_0x9192('0x4'),_0x9192('0x5'),i),'email':util[_0x9192('0x3')](_0x9192('0x6'),_0x9192('0x5'),i),'role':_0x9192('0x5'),'password':'password','internal':0xfa0+i,'type':_0x9192('0x7'),'transport':[_0x9192('0x8'),'ws',_0x9192('0x9')],'disallow':[_0x9192('0xa')],'allow':['ulaw'],'defaultuser':util[_0x9192('0x3')](_0x9192('0x4'),'agent',i),'encryption':_0x9192('0xb'),'avpf':_0x9192('0xb'),'force_avp':_0x9192('0xb'),'icesupport':_0x9192('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x9192('0xc'),'dtlsprivatekey':_0x9192('0xd'),'dtlssetup':_0x9192('0xe'),'callerid':util[_0x9192('0x3')](_0x9192('0xf'),util['format']('%s%s',_0x9192('0x5'),i),0xfa0+i)});}db[_0x9192('0x10')][_0x9192('0x11')](users)['then'](function(){console['log'](_0x9192('0x12'));})[_0x9192('0x13')](function(_0x2191b0){console[_0x9192('0x14')](_0x2191b0);}); \ No newline at end of file +var _0x6e59=['udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','bulkCreate','log','add\x20user','catch','util','../mysqldb','%s%s','format','agent','password','friend'];(function(_0x3b83e3,_0x25bdd3){var _0x1ec22c=function(_0x1ad8c5){while(--_0x1ad8c5){_0x3b83e3['push'](_0x3b83e3['shift']());}};_0x1ec22c(++_0x25bdd3);}(_0x6e59,0x77));var _0x96e5=function(_0x4ba6f2,_0x142966){_0x4ba6f2=_0x4ba6f2-0x0;var _0x36f265=_0x6e59[_0x4ba6f2];return _0x36f265;};'use strict';var util=require(_0x96e5('0x0'));var db=require(_0x96e5('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x96e5('0x2'),'agent',i),'fullname':util['format'](_0x96e5('0x2'),'agent',i),'email':util[_0x96e5('0x3')]('%s%s@xcally.com',_0x96e5('0x4'),i),'role':_0x96e5('0x4'),'password':_0x96e5('0x5'),'internal':0xfa0+i,'type':_0x96e5('0x6'),'transport':[_0x96e5('0x7'),'ws',_0x96e5('0x8')],'disallow':[_0x96e5('0x9')],'allow':[_0x96e5('0xa')],'defaultuser':util[_0x96e5('0x3')](_0x96e5('0x2'),'agent',i),'encryption':_0x96e5('0xb'),'avpf':'yes','force_avp':'yes','icesupport':_0x96e5('0xb'),'dtlsenable':_0x96e5('0xb'),'dtlsverify':'no','dtlscertfile':_0x96e5('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x96e5('0xd'),'callerid':util[_0x96e5('0x3')]('\x22%s\x22\x20<%s>',util['format']('%s%s','agent',i),0xfa0+i)});}db['User'][_0x96e5('0xe')](users)['then'](function(){console[_0x96e5('0xf')](_0x96e5('0x10'));})[_0x96e5('0x11')](function(_0x336ee6){console['log'](_0x336ee6);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 435e7d5..2d64894 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb012=['WhatsappQueue','Trunk','user','voice:outbound','ChatQueue','OpenchannelQueue','getVoiceQueues','getChatQueues','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','telephone','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','role','Campaign','%s:queue:%s','length','format','user:%s','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue'];(function(_0x583121,_0x7a91e6){var _0x4a9736=function(_0x43182c){while(--_0x43182c){_0x583121['push'](_0x583121['shift']());}};_0x4a9736(++_0x7a91e6);}(_0xb012,0x92));var _0x2b01=function(_0x5c0eaf,_0x183874){_0x5c0eaf=_0x5c0eaf-0x0;var _0x15e931=_0xb012[_0x5c0eaf];return _0x15e931;};'use strict';var _=require(_0x2b01('0x0'));var util=require(_0x2b01('0x1'));var BPromise=require(_0x2b01('0x2'));var db=require(_0x2b01('0x3'))['db'];var config=require(_0x2b01('0x4'));var queryQueues={'attributes':['id',_0x2b01('0x5')],'include':[{'as':_0x2b01('0x6'),'model':db[_0x2b01('0x7')],'attributes':['id',_0x2b01('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2b01('0x5')],'where':{'role':_0x2b01('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2b01('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x2b01('0x5')],'where':{'role':_0x2b01('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x2b01('0xa')],'where':{'type':_0x2b01('0xb')}};function getAssociatedResources(_0x13e0e8,_0x4682d2,_0x26bb89){return db[_0x2b01('0xc')][_0x2b01('0xd')]({'where':{'name':_0x13e0e8,'userProfileId':_0x4682d2},'raw':!![]})['then'](function(_0x5231fc){if(_0x5231fc){if(_0x5231fc[_0x2b01('0xe')]){switch(_0x13e0e8){case _0x2b01('0xf'):case _0x2b01('0x10'):case _0x2b01('0x11'):case _0x2b01('0x12'):case _0x2b01('0x13'):case _0x2b01('0x14'):case _0x2b01('0x15'):return db[_0x26bb89][_0x2b01('0x16')](queryQueues);case _0x2b01('0x17'):return db[_0x26bb89][_0x2b01('0x16')](queryTelephones);case _0x2b01('0x18'):return db[_0x26bb89][_0x2b01('0x16')](queryTrunks);case _0x2b01('0x19'):return db[_0x26bb89][_0x2b01('0x16')](queryCampaigns);}}else{return db[_0x2b01('0x1a')][_0x2b01('0x16')]({'attributes':[_0x2b01('0x1b')],'where':{'sectionId':_0x5231fc['id']},'raw':!![]})[_0x2b01('0x1c')](function(_0x3e28be){if(_0x3e28be){var _0x14eb60={'where':{'id':_[_0x2b01('0x1d')](_0x3e28be,_0x2b01('0x1b'))},'raw':!![]};switch(_0x26bb89){case _0x2b01('0x7'):_0x14eb60[_0x2b01('0x1e')][_0x2b01('0x1f')]=_0x2b01('0x8');break;case _0x2b01('0x20'):_0x14eb60[_0x2b01('0x1e')]['type']='ivr';break;}return db[_0x26bb89][_0x2b01('0x16')](_0x14eb60);}else{return[];}});}}else{return[];}})['then'](function(_0x46f165){return _0x46f165;});}function joinOrLeaveQueues(_0x3fd07b,_0xb2e86d,_0x22c5bb,_0x1a3f5c){_0x3fd07b[_0xb2e86d](util['format'](_0x2b01('0x21'),_0x22c5bb,_0x1a3f5c['name']));if(_0x1a3f5c[_0x2b01('0x6')]){for(var _0x3be87e=0x0;_0x3be87e<_0x1a3f5c[_0x2b01('0x6')][_0x2b01('0x22')];_0x3be87e+=0x1){_0x3fd07b[_0xb2e86d](util[_0x2b01('0x23')](_0x2b01('0x24'),_0x1a3f5c[_0x2b01('0x6')][_0x3be87e][_0x2b01('0x5')]));}}}function joinOrLeave(_0x335e78,_0x151e89,_0x263214){var _0x392f35;if(_0x335e78['handshake'][_0x2b01('0x25')]['id']){db[_0x2b01('0x7')][_0x2b01('0x26')]({'attributes':['id','name',_0x2b01('0x1f'),_0x2b01('0x27')],'where':{'id':_0x335e78['handshake']['query']['id']},'include':[{'model':db[_0x2b01('0x28')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2b01('0x29')],'as':_0x2b01('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x2b01('0x2b')],'as':_0x2b01('0x2c'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x2b01('0x2d'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x2b01('0x2e'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x2b01('0x2f'),'attributes':['id'],'raw':!![]}]})[_0x2b01('0x1c')](function(_0x9fb1f0){if(_0x9fb1f0){_0x392f35=_0x9fb1f0;_0x335e78[_0x151e89](util['format'](_0x2b01('0x24'),_0x9fb1f0['name']));var _0x233c52=[];switch(_0x9fb1f0[_0x2b01('0x1f')]){case _0x2b01('0x30'):_0x335e78[_0x151e89](_0x2b01('0x31'));_0x335e78[_0x151e89]('voice:outbound');if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x2b01('0x32')];}_0x233c52[_0x2b01('0x33')](db[_0x2b01('0x34')][_0x2b01('0x16')](queryQueues));_0x233c52['push'](db['ChatQueue'][_0x2b01('0x16')](queryQueues));_0x233c52[_0x2b01('0x33')](db[_0x2b01('0x35')]['findAll'](queryQueues));_0x233c52[_0x2b01('0x33')](db[_0x2b01('0x36')]['findAll'](queryQueues));_0x233c52[_0x2b01('0x33')](db[_0x2b01('0x37')]['findAll'](queryQueues));_0x233c52[_0x2b01('0x33')](db['OpenchannelQueue']['findAll'](queryQueues));_0x233c52[_0x2b01('0x33')](db[_0x2b01('0x38')][_0x2b01('0x16')](queryQueues));_0x233c52[_0x2b01('0x33')](db['User'][_0x2b01('0x16')](queryTelephones));_0x233c52[_0x2b01('0x33')](db[_0x2b01('0x39')][_0x2b01('0x16')](queryTrunks));_0x233c52[_0x2b01('0x33')](db[_0x2b01('0x20')]['findAll'](queryCampaigns));_0x233c52[_0x2b01('0x33')](db['User'][_0x2b01('0x16')](queryAgents));break;case _0x2b01('0x3a'):_0x335e78[_0x151e89](_0x2b01('0x31'));_0x335e78[_0x151e89](_0x2b01('0x3b'));_0x233c52[_0x2b01('0x33')](getAssociatedResources(_0x2b01('0xf'),_0x9fb1f0[_0x2b01('0x27')],_0x2b01('0x34')));_0x233c52[_0x2b01('0x33')](getAssociatedResources(_0x2b01('0x10'),_0x9fb1f0[_0x2b01('0x27')],_0x2b01('0x3c')));_0x233c52[_0x2b01('0x33')](getAssociatedResources(_0x2b01('0x11'),_0x9fb1f0[_0x2b01('0x27')],_0x2b01('0x35')));_0x233c52[_0x2b01('0x33')](getAssociatedResources(_0x2b01('0x12'),_0x9fb1f0[_0x2b01('0x27')],_0x2b01('0x36')));_0x233c52[_0x2b01('0x33')](getAssociatedResources(_0x2b01('0x13'),_0x9fb1f0[_0x2b01('0x27')],_0x2b01('0x37')));_0x233c52[_0x2b01('0x33')](getAssociatedResources(_0x2b01('0x14'),_0x9fb1f0['userProfileId'],_0x2b01('0x3d')));_0x233c52[_0x2b01('0x33')](getAssociatedResources('WhatsappQueues',_0x9fb1f0[_0x2b01('0x27')],_0x2b01('0x38')));_0x233c52[_0x2b01('0x33')](getAssociatedResources('Telephones',_0x9fb1f0[_0x2b01('0x27')],_0x2b01('0x7')));_0x233c52[_0x2b01('0x33')](getAssociatedResources(_0x2b01('0x18'),_0x9fb1f0['userProfileId'],_0x2b01('0x39')));_0x233c52[_0x2b01('0x33')](getAssociatedResources(_0x2b01('0x19'),_0x9fb1f0[_0x2b01('0x27')],_0x2b01('0x20')));_0x233c52['push'](db[_0x2b01('0x7')][_0x2b01('0x16')](queryAgents));break;case _0x2b01('0x9'):_0x335e78[_0x151e89](_0x2b01('0x31'));_0x335e78[_0x151e89]('voice:outbound');_0x233c52[_0x2b01('0x33')](_0x9fb1f0[_0x2b01('0x3e')]({'attributes':['id',_0x2b01('0x5')]}));_0x233c52[_0x2b01('0x33')](_0x9fb1f0[_0x2b01('0x3f')]({'attributes':['id','name']}));_0x233c52[_0x2b01('0x33')](_0x9fb1f0[_0x2b01('0x40')]({'attributes':['id',_0x2b01('0x5')]}));_0x233c52['push'](_0x9fb1f0['getSmsQueues']({'attributes':['id',_0x2b01('0x5')]}));_0x233c52['push'](_0x9fb1f0['getMailQueues']({'attributes':['id',_0x2b01('0x5')]}));_0x233c52['push'](_0x9fb1f0[_0x2b01('0x41')]({'attributes':['id',_0x2b01('0x5')]}));_0x233c52[_0x2b01('0x33')](_0x9fb1f0[_0x2b01('0x42')]({'attributes':['id',_0x2b01('0x5')]}));break;}return BPromise[_0x2b01('0x43')](_0x233c52);}})[_0x2b01('0x1c')](function(_0x22d39e){if(_0x22d39e&&_0x22d39e['length']){for(var _0x1eaaae=0x0;_0x1eaaae<_0x22d39e['length'];_0x1eaaae+=0x1){for(var _0x1814e9=0x0;_0x1814e9<_0x22d39e[_0x1eaaae][_0x2b01('0x22')];_0x1814e9+=0x1){switch(_0x1eaaae){case 0x0:joinOrLeaveQueues(_0x335e78,_0x151e89,_0x2b01('0x44'),_0x22d39e[_0x1eaaae][_0x1814e9]);break;case 0x1:joinOrLeaveQueues(_0x335e78,_0x151e89,'chat',_0x22d39e[_0x1eaaae][_0x1814e9]);break;case 0x2:joinOrLeaveQueues(_0x335e78,_0x151e89,_0x2b01('0x45'),_0x22d39e[_0x1eaaae][_0x1814e9]);break;case 0x3:joinOrLeaveQueues(_0x335e78,_0x151e89,_0x2b01('0x46'),_0x22d39e[_0x1eaaae][_0x1814e9]);break;case 0x4:joinOrLeaveQueues(_0x335e78,_0x151e89,_0x2b01('0x47'),_0x22d39e[_0x1eaaae][_0x1814e9]);break;case 0x5:joinOrLeaveQueues(_0x335e78,_0x151e89,_0x2b01('0x48'),_0x22d39e[_0x1eaaae][_0x1814e9]);break;case 0x6:joinOrLeaveQueues(_0x335e78,_0x151e89,'whatsapp',_0x22d39e[_0x1eaaae][_0x1814e9]);break;case 0x7:if(_0x392f35[_0x2b01('0x1f')]!=='agent')_0x335e78[_0x151e89](util['format'](_0x2b01('0x49'),_0x22d39e[_0x1eaaae][_0x1814e9][_0x2b01('0x5')]));break;case 0x8:if(_0x392f35[_0x2b01('0x1f')]!==_0x2b01('0x9'))_0x335e78[_0x151e89](util[_0x2b01('0x23')](_0x2b01('0x4a'),_0x22d39e[_0x1eaaae][_0x1814e9][_0x2b01('0x5')]));break;case 0x9:if(_0x392f35[_0x2b01('0x1f')]!==_0x2b01('0x9'))_0x335e78[_0x151e89](util['format'](_0x2b01('0x4b'),_0x22d39e[_0x1eaaae][_0x1814e9][_0x2b01('0xa')],_0x22d39e[_0x1eaaae][_0x1814e9][_0x2b01('0x5')]));break;case 0xa:_0x335e78[_0x151e89](util['format'](_0x2b01('0x24'),_0x22d39e[_0x1eaaae][_0x1814e9]['name']));break;}}}}})[_0x2b01('0x1c')](function(){if(_0x151e89===_0x2b01('0x4c')){var _0x364543=_[_0x2b01('0x1d')](_0x392f35[_0x2b01('0x4d')],'id');return _0x392f35[_0x2b01('0x4e')](_0x364543)[_0x2b01('0x1c')](function(){for(var _0x5a5c3f=0x0;_0x5a5c3f<_0x364543[_0x2b01('0x22')];_0x5a5c3f+=0x1){_0x263214[_0x2b01('0x4f')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x364543[_0x5a5c3f]),'UserId':Number(_0x392f35['id'])});}});}})[_0x2b01('0x1c')](function(){if(_0x151e89===_0x2b01('0x4c')){var _0x1b611c=_[_0x2b01('0x1d')](_0x392f35[_0x2b01('0x2a')],'id');return _0x392f35[_0x2b01('0x50')](_0x1b611c)[_0x2b01('0x1c')](function(){for(var _0x2c3225=0x0;_0x2c3225<_0x1b611c['length'];_0x2c3225+=0x1){_0x263214['emit'](_0x2b01('0x51'),{'MailInteractionId':Number(_0x1b611c[_0x2c3225]),'UserId':Number(_0x392f35['id'])});}});}})['then'](function(){if(_0x151e89===_0x2b01('0x4c')){var _0x589f44=_[_0x2b01('0x1d')](_0x392f35[_0x2b01('0x2c')],'id');return _0x392f35[_0x2b01('0x52')](_0x589f44)[_0x2b01('0x1c')](function(){for(var _0xdb053c=0x0;_0xdb053c<_0x589f44['length'];_0xdb053c+=0x1){_0x263214['emit'](_0x2b01('0x53'),{'FaxInteractionId':Number(_0x589f44[_0xdb053c]),'UserId':Number(_0x392f35['id'])});}});}})[_0x2b01('0x1c')](function(){if(_0x151e89===_0x2b01('0x4c')){var _0x3e8100=_[_0x2b01('0x1d')](_0x392f35[_0x2b01('0x2d')],'id');return _0x392f35[_0x2b01('0x54')](_0x3e8100)['then'](function(){for(var _0x2b8365=0x0;_0x2b8365<_0x3e8100[_0x2b01('0x22')];_0x2b8365+=0x1){_0x263214[_0x2b01('0x4f')](_0x2b01('0x55'),{'SmsInteractionId':Number(_0x3e8100[_0x2b8365]),'UserId':Number(_0x392f35['id'])});}});}})[_0x2b01('0x1c')](function(){if(_0x151e89===_0x2b01('0x4c')){var _0x5dccdb=_['map'](_0x392f35['OpenchannelInteractions'],'id');return _0x392f35[_0x2b01('0x56')](_0x5dccdb)['then'](function(){for(var _0x35d2b8=0x0;_0x35d2b8<_0x5dccdb[_0x2b01('0x22')];_0x35d2b8+=0x1){_0x263214[_0x2b01('0x4f')](_0x2b01('0x57'),{'OpenchannelInteractionId':Number(_0x5dccdb[_0x35d2b8]),'UserId':Number(_0x392f35['id'])});}});}})['then'](function(){if(_0x151e89===_0x2b01('0x4c')){var _0x21005d=_[_0x2b01('0x1d')](_0x392f35[_0x2b01('0x2f')],'id');return _0x392f35['removeWhatsappInteractions'](_0x21005d)['then'](function(){for(var _0xdf4aff=0x0;_0xdf4aff<_0x21005d[_0x2b01('0x22')];_0xdf4aff+=0x1){_0x263214[_0x2b01('0x4f')](_0x2b01('0x58'),{'WhatsappInteractionId':Number(_0x21005d[_0xdf4aff]),'UserId':Number(_0x392f35['id'])});}});}})[_0x2b01('0x59')](function(_0x428dfd){_0x335e78[_0x2b01('0x5a')](_0x428dfd);});}}function onDisconnect(_0x5d5801,_0x3811c1){joinOrLeave(_0x5d5801,'leave',_0x3811c1);}function onConnect(_0x7d4b65){joinOrLeave(_0x7d4b65,_0x2b01('0x5b'));}exports[_0x2b01('0x5c')]=function(_0x5c6cb0){_0x5c6cb0['on']('connection',function(_0x3192b6){_0x3192b6[_0x2b01('0x5d')](0x0);_0x3192b6[_0x2b01('0x5e')]=_0x3192b6[_0x2b01('0x5f')][_0x2b01('0x60')]['remoteAddress']+':'+_0x3192b6[_0x2b01('0x5f')][_0x2b01('0x60')]['remotePort'];_0x3192b6['connectedAt']=new Date();_0x3192b6['log']=function(_0x2cfce3){console[_0x2b01('0x5a')]('SocketIO\x20'+_0x3192b6[_0x2b01('0x61')][_0x2b01('0x5')]+'['+_0x3192b6[_0x2b01('0x5e')]+']',_0x2cfce3);};_0x3192b6['on'](_0x2b01('0x62'),function(){onDisconnect(_0x3192b6,_0x5c6cb0);_0x3192b6[_0x2b01('0x5a')](_0x2b01('0x63'));});onConnect(_0x3192b6);_0x3192b6[_0x2b01('0x5a')](_0x2b01('0x64'));});}; \ No newline at end of file +var _0xf628=['trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','User','name','role','agent','ivr','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','findAll','Telephones','Trunks','IvrCampaigns','then','map','resourceId','telephone','type','format','user:%s','Agents','handshake','query','userProfileId','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Campaign','ChatQueues','MailQueues','OpenchannelQueues','OpenchannelQueue','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','fax','sms','mail','openchannel','whatsapp','telephone:%s'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xf628,0x7f));var _0x8f62=function(_0x55ea56,_0x4a7b79){_0x55ea56=_0x55ea56-0x0;var _0x88315c=_0xf628[_0x55ea56];return _0x88315c;};'use strict';var _=require(_0x8f62('0x0'));var util=require(_0x8f62('0x1'));var BPromise=require(_0x8f62('0x2'));var db=require(_0x8f62('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x8f62('0x4')],'attributes':['id',_0x8f62('0x5'),_0x8f62('0x6')],'raw':!![],'where':{'role':_0x8f62('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8f62('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x8f62('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8f62('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8f62('0x5'),'type'],'where':{'type':_0x8f62('0x8')}};function getAssociatedResources(_0x230f8e,_0xf1c4b0,_0x4ef856){return db['UserProfileSection']['findOne']({'where':{'name':_0x230f8e,'userProfileId':_0xf1c4b0},'raw':!![]})['then'](function(_0x4b1e43){if(_0x4b1e43){if(_0x4b1e43[_0x8f62('0x9')]){switch(_0x230f8e){case _0x8f62('0xa'):case'ChatQueues':case _0x8f62('0xb'):case _0x8f62('0xc'):case'MailQueues':case'OpenchannelQueues':case'WhatsappQueues':return db[_0x4ef856][_0x8f62('0xd')](queryQueues);case _0x8f62('0xe'):return db[_0x4ef856][_0x8f62('0xd')](queryTelephones);case _0x8f62('0xf'):return db[_0x4ef856][_0x8f62('0xd')](queryTrunks);case _0x8f62('0x10'):return db[_0x4ef856][_0x8f62('0xd')](queryCampaigns);}}else{return db['UserProfileResource'][_0x8f62('0xd')]({'attributes':['resourceId'],'where':{'sectionId':_0x4b1e43['id']},'raw':!![]})[_0x8f62('0x11')](function(_0x58a7d7){if(_0x58a7d7){var _0xbe2da7={'where':{'id':_[_0x8f62('0x12')](_0x58a7d7,_0x8f62('0x13'))},'raw':!![]};switch(_0x4ef856){case _0x8f62('0x4'):_0xbe2da7['where'][_0x8f62('0x6')]=_0x8f62('0x14');break;case'Campaign':_0xbe2da7['where'][_0x8f62('0x15')]='ivr';break;}return db[_0x4ef856][_0x8f62('0xd')](_0xbe2da7);}else{return[];}});}}else{return[];}})['then'](function(_0x109d91){return _0x109d91;});}function joinOrLeaveQueues(_0xde5808,_0xb8d46a,_0x40b1e6,_0x4a854f){_0xde5808[_0xb8d46a](util[_0x8f62('0x16')]('%s:queue:%s',_0x40b1e6,_0x4a854f['name']));if(_0x4a854f['Agents']){for(var _0x398c08=0x0;_0x398c08<_0x4a854f['Agents']['length'];_0x398c08+=0x1){_0xde5808[_0xb8d46a](util['format'](_0x8f62('0x17'),_0x4a854f[_0x8f62('0x18')][_0x398c08][_0x8f62('0x5')]));}}}function joinOrLeave(_0x4aee91,_0x50f9cd,_0x329dae){var _0x4a0935;if(_0x4aee91[_0x8f62('0x19')][_0x8f62('0x1a')]['id']){db['User']['find']({'attributes':['id','name','role',_0x8f62('0x1b')],'where':{'id':_0x4aee91[_0x8f62('0x19')]['query']['id']},'include':[{'model':db[_0x8f62('0x1c')],'as':_0x8f62('0x1d'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8f62('0x1e')],'as':_0x8f62('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x8f62('0x20')],'as':_0x8f62('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x8f62('0x22')],'as':_0x8f62('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x8f62('0x24')],'as':_0x8f62('0x25'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x39d684){if(_0x39d684){_0x4a0935=_0x39d684;_0x4aee91[_0x50f9cd](util[_0x8f62('0x16')]('user:%s',_0x39d684[_0x8f62('0x5')]));var _0x5f2e12=[];switch(_0x39d684[_0x8f62('0x6')]){case _0x8f62('0x26'):_0x4aee91[_0x50f9cd](_0x8f62('0x27'));_0x4aee91[_0x50f9cd](_0x8f62('0x28'));if(queryQueues[_0x8f62('0x29')]('include')){delete queryQueues[_0x8f62('0x2a')];}_0x5f2e12[_0x8f62('0x2b')](db['VoiceQueue'][_0x8f62('0xd')](queryQueues));_0x5f2e12[_0x8f62('0x2b')](db[_0x8f62('0x2c')][_0x8f62('0xd')](queryQueues));_0x5f2e12[_0x8f62('0x2b')](db[_0x8f62('0x2d')][_0x8f62('0xd')](queryQueues));_0x5f2e12[_0x8f62('0x2b')](db[_0x8f62('0x2e')][_0x8f62('0xd')](queryQueues));_0x5f2e12[_0x8f62('0x2b')](db[_0x8f62('0x2f')][_0x8f62('0xd')](queryQueues));_0x5f2e12['push'](db['OpenchannelQueue'][_0x8f62('0xd')](queryQueues));_0x5f2e12[_0x8f62('0x2b')](db[_0x8f62('0x30')][_0x8f62('0xd')](queryQueues));_0x5f2e12['push'](db[_0x8f62('0x4')][_0x8f62('0xd')](queryTelephones));_0x5f2e12[_0x8f62('0x2b')](db['Trunk'][_0x8f62('0xd')](queryTrunks));_0x5f2e12[_0x8f62('0x2b')](db[_0x8f62('0x31')][_0x8f62('0xd')](queryCampaigns));_0x5f2e12[_0x8f62('0x2b')](db[_0x8f62('0x4')]['findAll'](queryAgents));break;case'user':_0x4aee91[_0x50f9cd](_0x8f62('0x27'));_0x4aee91[_0x50f9cd]('voice:outbound');_0x5f2e12[_0x8f62('0x2b')](getAssociatedResources(_0x8f62('0xa'),_0x39d684['userProfileId'],'VoiceQueue'));_0x5f2e12[_0x8f62('0x2b')](getAssociatedResources(_0x8f62('0x32'),_0x39d684['userProfileId'],_0x8f62('0x2c')));_0x5f2e12[_0x8f62('0x2b')](getAssociatedResources(_0x8f62('0xb'),_0x39d684[_0x8f62('0x1b')],_0x8f62('0x2d')));_0x5f2e12[_0x8f62('0x2b')](getAssociatedResources('SmsQueues',_0x39d684[_0x8f62('0x1b')],_0x8f62('0x2e')));_0x5f2e12[_0x8f62('0x2b')](getAssociatedResources(_0x8f62('0x33'),_0x39d684[_0x8f62('0x1b')],'MailQueue'));_0x5f2e12['push'](getAssociatedResources(_0x8f62('0x34'),_0x39d684[_0x8f62('0x1b')],_0x8f62('0x35')));_0x5f2e12['push'](getAssociatedResources('WhatsappQueues',_0x39d684[_0x8f62('0x1b')],_0x8f62('0x30')));_0x5f2e12[_0x8f62('0x2b')](getAssociatedResources(_0x8f62('0xe'),_0x39d684[_0x8f62('0x1b')],'User'));_0x5f2e12[_0x8f62('0x2b')](getAssociatedResources(_0x8f62('0xf'),_0x39d684[_0x8f62('0x1b')],'Trunk'));_0x5f2e12['push'](getAssociatedResources(_0x8f62('0x10'),_0x39d684['userProfileId'],_0x8f62('0x31')));_0x5f2e12['push'](db['User'][_0x8f62('0xd')](queryAgents));break;case'agent':_0x4aee91[_0x50f9cd](_0x8f62('0x27'));_0x4aee91[_0x50f9cd](_0x8f62('0x28'));_0x5f2e12[_0x8f62('0x2b')](_0x39d684[_0x8f62('0x36')]({'attributes':['id',_0x8f62('0x5')]}));_0x5f2e12[_0x8f62('0x2b')](_0x39d684[_0x8f62('0x37')]({'attributes':['id','name']}));_0x5f2e12[_0x8f62('0x2b')](_0x39d684['getFaxQueues']({'attributes':['id','name']}));_0x5f2e12[_0x8f62('0x2b')](_0x39d684[_0x8f62('0x38')]({'attributes':['id','name']}));_0x5f2e12[_0x8f62('0x2b')](_0x39d684['getMailQueues']({'attributes':['id',_0x8f62('0x5')]}));_0x5f2e12[_0x8f62('0x2b')](_0x39d684[_0x8f62('0x39')]({'attributes':['id',_0x8f62('0x5')]}));_0x5f2e12[_0x8f62('0x2b')](_0x39d684[_0x8f62('0x3a')]({'attributes':['id',_0x8f62('0x5')]}));break;}return BPromise[_0x8f62('0x3b')](_0x5f2e12);}})['then'](function(_0x5c9eba){if(_0x5c9eba&&_0x5c9eba[_0x8f62('0x3c')]){for(var _0x48ec6f=0x0;_0x48ec6f<_0x5c9eba[_0x8f62('0x3c')];_0x48ec6f+=0x1){for(var _0x31bac3=0x0;_0x31bac3<_0x5c9eba[_0x48ec6f][_0x8f62('0x3c')];_0x31bac3+=0x1){switch(_0x48ec6f){case 0x0:joinOrLeaveQueues(_0x4aee91,_0x50f9cd,'voice',_0x5c9eba[_0x48ec6f][_0x31bac3]);break;case 0x1:joinOrLeaveQueues(_0x4aee91,_0x50f9cd,'chat',_0x5c9eba[_0x48ec6f][_0x31bac3]);break;case 0x2:joinOrLeaveQueues(_0x4aee91,_0x50f9cd,_0x8f62('0x3d'),_0x5c9eba[_0x48ec6f][_0x31bac3]);break;case 0x3:joinOrLeaveQueues(_0x4aee91,_0x50f9cd,_0x8f62('0x3e'),_0x5c9eba[_0x48ec6f][_0x31bac3]);break;case 0x4:joinOrLeaveQueues(_0x4aee91,_0x50f9cd,_0x8f62('0x3f'),_0x5c9eba[_0x48ec6f][_0x31bac3]);break;case 0x5:joinOrLeaveQueues(_0x4aee91,_0x50f9cd,_0x8f62('0x40'),_0x5c9eba[_0x48ec6f][_0x31bac3]);break;case 0x6:joinOrLeaveQueues(_0x4aee91,_0x50f9cd,_0x8f62('0x41'),_0x5c9eba[_0x48ec6f][_0x31bac3]);break;case 0x7:if(_0x4a0935[_0x8f62('0x6')]!==_0x8f62('0x7'))_0x4aee91[_0x50f9cd](util[_0x8f62('0x16')](_0x8f62('0x42'),_0x5c9eba[_0x48ec6f][_0x31bac3][_0x8f62('0x5')]));break;case 0x8:if(_0x4a0935[_0x8f62('0x6')]!=='agent')_0x4aee91[_0x50f9cd](util[_0x8f62('0x16')](_0x8f62('0x43'),_0x5c9eba[_0x48ec6f][_0x31bac3][_0x8f62('0x5')]));break;case 0x9:if(_0x4a0935[_0x8f62('0x6')]!=='agent')_0x4aee91[_0x50f9cd](util[_0x8f62('0x16')](_0x8f62('0x44'),_0x5c9eba[_0x48ec6f][_0x31bac3][_0x8f62('0x15')],_0x5c9eba[_0x48ec6f][_0x31bac3][_0x8f62('0x5')]));break;case 0xa:_0x4aee91[_0x50f9cd](util[_0x8f62('0x16')](_0x8f62('0x17'),_0x5c9eba[_0x48ec6f][_0x31bac3][_0x8f62('0x5')]));break;}}}}})[_0x8f62('0x11')](function(){if(_0x50f9cd===_0x8f62('0x45')){var _0x265eeb=_[_0x8f62('0x12')](_0x4a0935[_0x8f62('0x1d')],'id');return _0x4a0935[_0x8f62('0x46')](_0x265eeb)['then'](function(){for(var _0x35fe57=0x0;_0x35fe57<_0x265eeb[_0x8f62('0x3c')];_0x35fe57+=0x1){_0x329dae[_0x8f62('0x47')](_0x8f62('0x48'),{'ChatInteractionId':Number(_0x265eeb[_0x35fe57]),'UserId':Number(_0x4a0935['id'])});}});}})[_0x8f62('0x11')](function(){if(_0x50f9cd===_0x8f62('0x45')){var _0x3e6190=_[_0x8f62('0x12')](_0x4a0935[_0x8f62('0x49')],'id');return _0x4a0935[_0x8f62('0x4a')](_0x3e6190)[_0x8f62('0x11')](function(){for(var _0x481ccb=0x0;_0x481ccb<_0x3e6190[_0x8f62('0x3c')];_0x481ccb+=0x1){_0x329dae['emit'](_0x8f62('0x4b'),{'MailInteractionId':Number(_0x3e6190[_0x481ccb]),'UserId':Number(_0x4a0935['id'])});}});}})[_0x8f62('0x11')](function(){if(_0x50f9cd==='leave'){var _0x25396e=_[_0x8f62('0x12')](_0x4a0935['FaxInteractions'],'id');return _0x4a0935[_0x8f62('0x4c')](_0x25396e)[_0x8f62('0x11')](function(){for(var _0x125495=0x0;_0x125495<_0x25396e[_0x8f62('0x3c')];_0x125495+=0x1){_0x329dae[_0x8f62('0x47')](_0x8f62('0x4d'),{'FaxInteractionId':Number(_0x25396e[_0x125495]),'UserId':Number(_0x4a0935['id'])});}});}})[_0x8f62('0x11')](function(){if(_0x50f9cd==='leave'){var _0x56ca96=_[_0x8f62('0x12')](_0x4a0935['SmsInteractions'],'id');return _0x4a0935[_0x8f62('0x4e')](_0x56ca96)[_0x8f62('0x11')](function(){for(var _0x22605c=0x0;_0x22605c<_0x56ca96[_0x8f62('0x3c')];_0x22605c+=0x1){_0x329dae['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x56ca96[_0x22605c]),'UserId':Number(_0x4a0935['id'])});}});}})[_0x8f62('0x11')](function(){if(_0x50f9cd===_0x8f62('0x45')){var _0x4af63e=_['map'](_0x4a0935['OpenchannelInteractions'],'id');return _0x4a0935[_0x8f62('0x4f')](_0x4af63e)[_0x8f62('0x11')](function(){for(var _0x1e9bf6=0x0;_0x1e9bf6<_0x4af63e[_0x8f62('0x3c')];_0x1e9bf6+=0x1){_0x329dae['emit'](_0x8f62('0x50'),{'OpenchannelInteractionId':Number(_0x4af63e[_0x1e9bf6]),'UserId':Number(_0x4a0935['id'])});}});}})[_0x8f62('0x11')](function(){if(_0x50f9cd===_0x8f62('0x45')){var _0x2d634f=_[_0x8f62('0x12')](_0x4a0935['WhatsappInteractions'],'id');return _0x4a0935[_0x8f62('0x51')](_0x2d634f)[_0x8f62('0x11')](function(){for(var _0x4684af=0x0;_0x4684af<_0x2d634f[_0x8f62('0x3c')];_0x4684af+=0x1){_0x329dae['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2d634f[_0x4684af]),'UserId':Number(_0x4a0935['id'])});}});}})[_0x8f62('0x52')](function(_0x339cd7){_0x4aee91[_0x8f62('0x53')](_0x339cd7);});}}function onDisconnect(_0x596fbb,_0x1ca596){joinOrLeave(_0x596fbb,_0x8f62('0x45'),_0x1ca596);}function onConnect(_0x3d0b6f){joinOrLeave(_0x3d0b6f,_0x8f62('0x54'));}exports[_0x8f62('0x55')]=function(_0x16241b){_0x16241b['on']('connection',function(_0x4b38b7){_0x4b38b7[_0x8f62('0x56')](0x0);_0x4b38b7[_0x8f62('0x57')]=_0x4b38b7[_0x8f62('0x58')][_0x8f62('0x59')][_0x8f62('0x5a')]+':'+_0x4b38b7[_0x8f62('0x58')][_0x8f62('0x59')][_0x8f62('0x5b')];_0x4b38b7[_0x8f62('0x5c')]=new Date();_0x4b38b7[_0x8f62('0x53')]=function(_0x3dfd94){console['log']('SocketIO\x20'+_0x4b38b7[_0x8f62('0x5d')][_0x8f62('0x5')]+'['+_0x4b38b7[_0x8f62('0x57')]+']',_0x3dfd94);};_0x4b38b7['on'](_0x8f62('0x5e'),function(){onDisconnect(_0x4b38b7,_0x16241b);_0x4b38b7[_0x8f62('0x53')](_0x8f62('0x5f'));});onConnect(_0x4b38b7);_0x4b38b7['log'](_0x8f62('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 1bf4e26..05714ae 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 _0xe650=['then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','event','offlineMessage','opened','AfterCreate','closed','changed','substatus','AfterUpdate','User','find','fullname','email','internal','length','model','hook','toLowerCase','util','../../mysqldb','jayson/promise','../logger','triggers','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager'];(function(_0x120dbf,_0x4a917e){var _0x4f35ea=function(_0x4bee06){while(--_0x4bee06){_0x120dbf['push'](_0x120dbf['shift']());}};_0x4f35ea(++_0x4a917e);}(_0xe650,0x19f));var _0x0e65=function(_0x547af,_0x17abff){_0x547af=_0x547af-0x0;var _0x22f7f4=_0xe650[_0x547af];return _0x22f7f4;};'use strict';var util=require(_0x0e65('0x0'));var db=require(_0x0e65('0x1'))['db'];var jayson=require(_0x0e65('0x2'));var logger=require(_0x0e65('0x3'))(_0x0e65('0x4'));var client=jayson['client'][_0x0e65('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x0e65('0x6'),'event':_0x0e65('0x7'),'condition':_0x0e65('0x8'),'callback':afterCreate},{'channel':_0x0e65('0x9'),'model':_0x0e65('0x6'),'event':_0x0e65('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0e65('0x9'),'model':'ChatMessage','event':_0x0e65('0x7'),'condition':_0x0e65('0xb'),'callback':afterCreateMessage},{'channel':_0x0e65('0x9'),'model':'ChatOfflineMessage','event':'afterCreate','condition':_0x0e65('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x0e65('0xc'),'model':_0x0e65('0xd'),'event':_0x0e65('0x7'),'condition':_0x0e65('0x8'),'callback':afterCreate},{'channel':_0x0e65('0xc'),'model':'SmsInteraction','event':_0x0e65('0xa'),'condition':_0x0e65('0xe'),'callback':afterUpdate},{'channel':_0x0e65('0xc'),'model':_0x0e65('0xf'),'event':_0x0e65('0x7'),'condition':_0x0e65('0xb'),'callback':afterCreateMessage},{'channel':_0x0e65('0x10'),'model':_0x0e65('0x11'),'event':'afterCreate','condition':_0x0e65('0x8'),'callback':afterCreate},{'channel':_0x0e65('0x10'),'model':_0x0e65('0x11'),'event':_0x0e65('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0e65('0x10'),'model':_0x0e65('0x12'),'event':'afterCreate','condition':_0x0e65('0xb'),'callback':afterCreateMessage},{'channel':_0x0e65('0x13'),'model':'FaxInteraction','event':'afterCreate','condition':_0x0e65('0x8'),'callback':afterCreate},{'channel':_0x0e65('0x13'),'model':_0x0e65('0x14'),'event':_0x0e65('0xa'),'condition':_0x0e65('0xe'),'callback':afterUpdate},{'channel':_0x0e65('0x13'),'model':_0x0e65('0x15'),'event':'afterCreate','condition':_0x0e65('0xb'),'callback':afterCreateMessage},{'channel':_0x0e65('0x16'),'model':_0x0e65('0x17'),'event':'afterCreate','condition':_0x0e65('0x8'),'callback':afterCreate},{'channel':'Mail','model':_0x0e65('0x17'),'event':_0x0e65('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0x0e65('0x18'),'event':_0x0e65('0x7'),'condition':_0x0e65('0xb'),'callback':afterCreateMessage},{'channel':_0x0e65('0x19'),'model':_0x0e65('0x1a'),'event':'afterCreate','condition':_0x0e65('0x8'),'callback':afterCreate},{'channel':_0x0e65('0x19'),'model':'OpenchannelInteraction','event':_0x0e65('0xa'),'condition':_0x0e65('0xe'),'callback':afterUpdate},{'channel':_0x0e65('0x19'),'model':'OpenchannelMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x17ee7f){return client[_0x0e65('0x1b')](_0x0e65('0x1c'),_0x17ee7f)[_0x0e65('0x1d')](function(_0x142711){logger[_0x0e65('0x1e')](_0x0e65('0x1f'),_0x0e65('0x1c'),_0x142711);if(_0x142711[_0x0e65('0x20')]){if(_0x142711[_0x0e65('0x20')][_0x0e65('0x21')]===0x1f4){logger[_0x0e65('0x20')](_0x0e65('0x1f'),'EventManager',_0x142711[_0x0e65('0x20')]);}}})[_0x0e65('0x22')](function(_0x4e5fa1){logger['error'](_0x0e65('0x1f'),'EventManager',_0x4e5fa1);});}function afterCreateMessage(_0x5d0ea9){return function(_0x197b24){_0x197b24=_0x197b24[_0x0e65('0x23')]({'plain':!![]});_0x197b24[_0x0e65('0x24')]=_0x5d0ea9;_0x197b24[_0x0e65('0x25')]=_0x5d0ea9;_0x197b24['event']=_0x197b24[_0x0e65('0x26')];Promise['resolve']()[_0x0e65('0x1d')](function(){if(typeof _0x197b24[_0x0e65('0x27')]===_0x0e65('0x28'))return null;var _0x349f9d=_0x0e65('0x29')+_0x197b24[_0x0e65('0x27')];return db[_0x0e65('0x2a')][_0x0e65('0x2b')](_0x349f9d,{'type':db[_0x0e65('0x2c')][_0x0e65('0x2d')][_0x0e65('0x2e')],'raw':!![]});})[_0x0e65('0x1d')](function(_0x8de89e){if(_0x8de89e){_0x197b24[_0x0e65('0x2f')]=_0x8de89e[0x0];}if(typeof _0x197b24[_0x0e65('0x30')]==='undefined')return;return getAgent(_0x197b24[_0x0e65('0x30')]);})[_0x0e65('0x1d')](function(_0x5e40ff){if(_0x5e40ff){_0x197b24[_0x0e65('0x31')]=util[_0x0e65('0x32')](_0x0e65('0x33'),_0x5e40ff[_0x0e65('0x34')]);_0x197b24[_0x0e65('0x35')]=_0x5e40ff;_0x197b24['channel']=_0x5d0ea9;return request({'event':_0x0e65('0x36'),'message':_0x197b24});}else{return request({'event':_0x0e65('0x37'),'message':_0x197b24});}})[_0x0e65('0x22')](function(_0x4d446f){logger[_0x0e65('0x20')](_0x0e65('0x1f'),_0x0e65('0x38'),_0x4d446f);});};}function afterCreateOfflineMessage(_0x5cd976){return function(_0x180cfc){_0x180cfc=_0x180cfc[_0x0e65('0x23')]({'plain':!![]});_0x180cfc[_0x0e65('0x24')]=_0x5cd976;_0x180cfc[_0x0e65('0x25')]=_0x5cd976;_0x180cfc[_0x0e65('0x39')]=_0x0e65('0x3a');return request({'event':_0x180cfc[_0x0e65('0x39')],'message':_0x180cfc});};}function afterCreate(_0x225e4f,_0x4742a4){return function(_0x259b98){_0x259b98=_0x259b98[_0x0e65('0x23')]({'plain':!![]});_0x259b98[_0x0e65('0x24')]=_0x225e4f;_0x259b98[_0x0e65('0x25')]=_0x225e4f;_0x259b98[_0x0e65('0x39')]=_0x0e65('0x3b');Promise['resolve']()['then'](function(){var _0x396c2c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x259b98['ContactId'];return db[_0x0e65('0x2a')][_0x0e65('0x2b')](_0x396c2c,{'type':db[_0x0e65('0x2c')][_0x0e65('0x2d')][_0x0e65('0x2e')],'raw':!![]});})[_0x0e65('0x1d')](function(_0x1d487e){if(_0x1d487e){_0x259b98[_0x0e65('0x2f')]=_0x1d487e[0x0];}if(typeof _0x259b98[_0x0e65('0x30')]===_0x0e65('0x28'))return;return getAgent(_0x259b98[_0x0e65('0x30')]);})['then'](function(_0x17ce72){if(_0x17ce72){_0x259b98['interface']=util[_0x0e65('0x32')]('SIP/%s',_0x17ce72[_0x0e65('0x34')]);_0x259b98['agent']=_0x17ce72;}return request({'event':_0x4742a4,'message':_0x259b98});})[_0x0e65('0x22')](function(_0x55c78a){logger[_0x0e65('0x20')]('Trigger,\x20%s',_0x0e65('0x3c'),_0x55c78a);});};}function afterUpdate(_0x2ee97e){return function(_0x190671){var _0x39f8dd=_0x190671['changed'](_0x0e65('0x3d'))&&_0x190671['closed'];var _0x33d3d4=_0x190671[_0x0e65('0x3e')]('substatus');if(_0x39f8dd||_0x33d3d4){var _0x2cee62=_0x39f8dd?'closedinteraction':'substatus';var _0x48ecb7=_0x190671['get']({'plain':!![]});_0x48ecb7[_0x0e65('0x24')]=_0x2ee97e;_0x48ecb7[_0x0e65('0x25')]=_0x2ee97e;_0x48ecb7['event']=_0x39f8dd?_0x0e65('0x3d'):_0x0e65('0x3f');var _0x34f629=_0x0e65('0x29')+_0x48ecb7[_0x0e65('0x27')];return db[_0x0e65('0x2a')][_0x0e65('0x2b')](_0x34f629,{'type':db[_0x0e65('0x2c')]['QueryTypes']['SELECT'],'raw':!![]})[_0x0e65('0x1d')](function(_0x583b31){if(_0x583b31){_0x48ecb7[_0x0e65('0x2f')]=_0x583b31[0x0];}if(typeof _0x48ecb7[_0x0e65('0x30')]===_0x0e65('0x28'))return;return getAgent(_0x48ecb7[_0x0e65('0x30')]);})[_0x0e65('0x1d')](function(_0x3e0f92){if(_0x3e0f92){_0x48ecb7[_0x0e65('0x31')]=util[_0x0e65('0x32')](_0x0e65('0x33'),_0x3e0f92['name']);_0x48ecb7['agent']=_0x3e0f92;}return request({'event':_0x2cee62,'message':_0x48ecb7});})[_0x0e65('0x22')](function(_0x2ff477){logger['error'](_0x0e65('0x1f'),_0x0e65('0x40'),_0x2ff477);});}};}function getAgent(_0x28a117){return db[_0x0e65('0x41')][_0x0e65('0x42')]({'where':{'id':_0x28a117},'attributes':['id',_0x0e65('0x34'),_0x0e65('0x43'),_0x0e65('0x44'),_0x0e65('0x45')],'raw':!![]})[_0x0e65('0x1d')](function(_0x13e044){return _0x13e044;});}exports['default']=function(){for(var _0x50ecb4=0x0;_0x50ecb4=_0x11b8dc[_0x89ee('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0xb9cbea(_0x14e85c);})[_0x89ee('0x16')](function(_0x4286b6){_0x3e837d(_0x4286b6);});});}; \ No newline at end of file +var _0x7809=['./license/util','voice','chat','fax','sms','openchannel','getChannels','toLowerCase','includes','isUndefined','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb'];(function(_0x2aacf6,_0x387e5f){var _0x25c14c=function(_0x2b6b6c){while(--_0x2b6b6c){_0x2aacf6['push'](_0x2aacf6['shift']());}};_0x25c14c(++_0x387e5f);}(_0x7809,0x15e));var _0x9780=function(_0x231df4,_0x4a78d5){_0x231df4=_0x231df4-0x0;var _0x4b4789=_0x7809[_0x231df4];return _0x4b4789;};'use strict';var _=require('lodash');var BPromise=require(_0x9780('0x0'));var db=require(_0x9780('0x1'))['db'];var util=require(_0x9780('0x2'));var channels=[_0x9780('0x3'),'mail',_0x9780('0x4'),_0x9780('0x5'),_0x9780('0x6'),'whatsapp',_0x9780('0x7')];exports[_0x9780('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x541171){_0x541171=_0x541171[_0x9780('0x9')]();return _[_0x9780('0xa')](channels,_0x541171);};exports['clearBlockUser']=function(_0x2deffa,_0x51ab89,_0x1b5e78,_0x41bdbb){var _0x5b7dd6={'loginAttempts':_0x51ab89,'blocked':_0x1b5e78};if(!_[_0x9780('0xb')](_0x41bdbb)){_0x5b7dd6['blockedAt']=_0x41bdbb;}return _0x2deffa[_0x9780('0xc')](_0x5b7dd6);};exports[_0x9780('0xd')]=function(_0x4b2936){return new BPromise(function(_0x3c3beb,_0x140c9a){var _0x583eae=0x0;if(_0x4b2936[_0x9780('0xe')]!==_0x9780('0xf')){_0x3c3beb(_0x4b2936);}db[_0x9780('0x10')][_0x9780('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4b2936['id']}}})[_0x9780('0x12')](function(_0x3cfbbc){_0x583eae=_0x3cfbbc;return util[_0x9780('0xd')]();})[_0x9780('0x12')](function(_0x36563c){if(_0x36563c&&_0x36563c[_0x9780('0x13')]&&_0x583eae>=_0x36563c[_0x9780('0x13')]){throw Error(_0x9780('0x14'));}_0x3c3beb(_0x4b2936);})[_0x9780('0x15')](function(_0x4b4e80){_0x140c9a(_0x4b4e80);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index f5a81cc..265959c 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a7=['name','inherits','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack','status','send','../config/logger','api','message'];(function(_0x4e7564,_0x18c4cb){var _0x5e4d05=function(_0x51358b){while(--_0x51358b){_0x4e7564['push'](_0x4e7564['shift']());}};_0x5e4d05(++_0x18c4cb);}(_0x91a7,0xe7));var _0x791a=function(_0x43a69d,_0x2b4e28){_0x43a69d=_0x43a69d-0x0;var _0x153904=_0x91a7[_0x43a69d];return _0x153904;};'use strict';var util=require('util');var logger=require(_0x791a('0x0'))(_0x791a('0x1'));var APIError=function(_0x268862,_0x5d2796){this[_0x791a('0x2')]=_0x268862||'Internal\x20Server\x20Error';this[_0x791a('0x3')]=_0x5d2796||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x32fe2b){this[_0x791a('0x2')]=_0x32fe2b||'Bad\x20Request';this[_0x791a('0x3')]='Bad\x20Request';util[_0x791a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x159e24){this['message']=_0x159e24||_0x791a('0x5');this[_0x791a('0x3')]=_0x791a('0x6');util[_0x791a('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x266e4b){switch(_0x266e4b){case'Bad\x20Request':return 0x190;case _0x791a('0x7'),_0x791a('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2bd26a){return function(_0x206eea){logger[_0x791a('0x9')](_0x206eea[_0x791a('0xa')]);var _0x2805c9=getStatusCode(_0x206eea[_0x791a('0x3')]);if(_0x206eea['name'])delete _0x206eea['name'];return _0x2bd26a[_0x791a('0xb')](_0x2805c9)[_0x791a('0xc')](_0x206eea);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xa9e0=['message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Forbidden','OutOfInterval','Not\x20Found','status','send','util','../config/logger','api'];(function(_0x2ef7ed,_0x45a9c3){var _0x1a83c7=function(_0x1ed2e5){while(--_0x1ed2e5){_0x2ef7ed['push'](_0x2ef7ed['shift']());}};_0x1a83c7(++_0x45a9c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var APIError=function(_0x5dd881,_0x550fbc){this[_0x0a9e('0x3')]=_0x5dd881||'Internal\x20Server\x20Error';this[_0x0a9e('0x4')]=_0x550fbc||_0x0a9e('0x5');util[_0x0a9e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x991246){this[_0x0a9e('0x3')]=_0x991246||'Bad\x20Request';this[_0x0a9e('0x4')]=_0x0a9e('0x7');util[_0x0a9e('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5f41ea){this['message']=_0x5f41ea||_0x0a9e('0x8');this['name']='Not\x20Found';util[_0x0a9e('0x6')](APINotFoundError,APIError);};function getStatusCode(_0xf81284){switch(_0xf81284){case _0x0a9e('0x7'):return 0x190;case _0x0a9e('0x9'),_0x0a9e('0xa'):return 0x193;case _0x0a9e('0xb'):return 0x194;default:return 0x1f4;}}function handleError(_0x4a4c56){return function(_0x50dfb2){logger['error'](_0x50dfb2['stack']);var _0x273d4d=getStatusCode(_0x50dfb2[_0x0a9e('0x4')]);if(_0x50dfb2[_0x0a9e('0x4')])delete _0x50dfb2[_0x0a9e('0x4')];return _0x4a4c56[_0x0a9e('0xc')](_0x273d4d)[_0x0a9e('0xd')](_0x50dfb2);};}module['exports']={'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 67d3dbd..32c1a49 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe59e=['render','json','send','exports','status'];(function(_0x161a77,_0x3d08d7){var _0x499552=function(_0x2f0191){while(--_0x2f0191){_0x161a77['push'](_0x161a77['shift']());}};_0x499552(++_0x3d08d7);}(_0xe59e,0x193));var _0xee59=function(_0x1ddc32,_0x2b6aeb){_0x1ddc32=_0x1ddc32-0x0;var _0x14e4ce=_0xe59e[_0x1ddc32];return _0x14e4ce;};'use strict';module[_0xee59('0x0')][0x194]=function pageNotFound(_0x2ec614,_0x380d1d){var _0x4d8ea6='404';var _0x3c35bf=0x194;var _0x1c5835={'status':_0x3c35bf};_0x380d1d[_0xee59('0x1')](_0x1c5835[_0xee59('0x1')]);_0x380d1d[_0xee59('0x2')](_0x4d8ea6,{},function(_0x7f0011,_0x3161f3){if(_0x7f0011){return _0x380d1d[_0xee59('0x1')](_0x1c5835['status'])[_0xee59('0x3')](_0x1c5835);}_0x380d1d[_0xee59('0x4')](_0x3161f3);});}; \ No newline at end of file +var _0x4060=['status','json','404'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0x4060,0x89));var _0x0406=function(_0x41c59c,_0x5f02b9){_0x41c59c=_0x41c59c-0x0;var _0x4dc97f=_0x4060[_0x41c59c];return _0x4dc97f;};'use strict';module['exports'][0x194]=function pageNotFound(_0x12e00d,_0x54b435){var _0xcbe62c=_0x0406('0x0');var _0x46a2ec=0x194;var _0x2f0e53={'status':_0x46a2ec};_0x54b435[_0x0406('0x1')](_0x2f0e53[_0x0406('0x1')]);_0x54b435['render'](_0xcbe62c,{},function(_0x42156d,_0x3279ca){if(_0x42156d){return _0x54b435['status'](_0x2f0e53[_0x0406('0x1')])[_0x0406('0x2')](_0x2f0e53);}_0x54b435['send'](_0x3279ca);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 1b328e5..d819518 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(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 221b0c3..32cf121 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x720c=['./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/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/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/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/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','snippet','3.1.0','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','appPath','/index.html','path','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports'];(function(_0x5615ce,_0x4d149b){var _0x1a7d01=function(_0x4a4b67){while(--_0x4a4b67){_0x5615ce['push'](_0x5615ce['shift']());}};_0x1a7d01(++_0x4d149b);}(_0x720c,0x101));var _0xc720=function(_0xcf016b,_0x4428ae){_0xcf016b=_0xcf016b-0x0;var _0xfc22fc=_0x720c[_0xcf016b];return _0xfc22fc;};'use strict';var path=require(_0xc720('0x0'));var express=require(_0xc720('0x1'));var errors=require('./errors');var config=require(_0xc720('0x2'));var setupLoggers=require(_0xc720('0x3'))[_0xc720('0x4')];var clientSideLogs=require(_0xc720('0x5'));exports[_0xc720('0x6')]=function(_0x412444){return setupLoggers(_0x412444)[_0xc720('0x7')](function(){_0x412444['use']('/api/users',require('./api/user'));_0x412444[_0xc720('0x8')]('/api/voice/chanspy',require(_0xc720('0x9')));_0x412444[_0xc720('0x8')](_0xc720('0xa'),require('./api/voiceContext'));_0x412444['use']('/api/voice/extensions',require(_0xc720('0xb')));_0x412444[_0xc720('0x8')](_0xc720('0xc'),require(_0xc720('0xd')));_0x412444['use'](_0xc720('0xe'),require(_0xc720('0xf')));_0x412444[_0xc720('0x8')](_0xc720('0x10'),require(_0xc720('0x11')));_0x412444[_0xc720('0x8')](_0xc720('0x12'),require(_0xc720('0x13')));_0x412444[_0xc720('0x8')]('/api/voice/mails',require(_0xc720('0x14')));_0x412444[_0xc720('0x8')](_0xc720('0x15'),require(_0xc720('0x16')));_0x412444[_0xc720('0x8')](_0xc720('0x17'),require(_0xc720('0x18')));_0x412444[_0xc720('0x8')](_0xc720('0x19'),require('./api/voiceDialReport'));_0x412444[_0xc720('0x8')](_0xc720('0x1a'),require('./api/voiceAgentReport'));_0x412444['use'](_0xc720('0x1b'),require(_0xc720('0x1c')));_0x412444[_0xc720('0x8')](_0xc720('0x1d'),require(_0xc720('0x1e')));_0x412444[_0xc720('0x8')](_0xc720('0x1f'),require(_0xc720('0x20')));_0x412444[_0xc720('0x8')](_0xc720('0x21'),require(_0xc720('0x22')));_0x412444[_0xc720('0x8')]('/api/mail/out_servers',require(_0xc720('0x23')));_0x412444[_0xc720('0x8')]('/api/mail/accounts',require(_0xc720('0x24')));_0x412444[_0xc720('0x8')](_0xc720('0x25'),require(_0xc720('0x26')));_0x412444[_0xc720('0x8')]('/api/mail/substatuses',require(_0xc720('0x27')));_0x412444[_0xc720('0x8')](_0xc720('0x28'),require(_0xc720('0x29')));_0x412444[_0xc720('0x8')](_0xc720('0x2a'),require('./api/mailMessage'));_0x412444['use'](_0xc720('0x2b'),require(_0xc720('0x2c')));_0x412444[_0xc720('0x8')](_0xc720('0x2d'),require(_0xc720('0x2e')));_0x412444[_0xc720('0x8')](_0xc720('0x2f'),require(_0xc720('0x30')));_0x412444[_0xc720('0x8')](_0xc720('0x31'),require('./api/dashboardItem'));_0x412444['use']('/api/fax/accounts',require(_0xc720('0x32')));_0x412444[_0xc720('0x8')](_0xc720('0x33'),require(_0xc720('0x34')));_0x412444[_0xc720('0x8')](_0xc720('0x35'),require(_0xc720('0x36')));_0x412444['use']('/api/fax/messages',require('./api/faxMessage'));_0x412444[_0xc720('0x8')](_0xc720('0x37'),require(_0xc720('0x38')));_0x412444['use'](_0xc720('0x39'),require('./api/faxQueueReport'));_0x412444[_0xc720('0x8')]('/api/sms/accounts',require(_0xc720('0x3a')));_0x412444[_0xc720('0x8')](_0xc720('0x3b'),require(_0xc720('0x3c')));_0x412444[_0xc720('0x8')](_0xc720('0x3d'),require(_0xc720('0x3e')));_0x412444[_0xc720('0x8')](_0xc720('0x3f'),require(_0xc720('0x40')));_0x412444[_0xc720('0x8')](_0xc720('0x41'),require(_0xc720('0x42')));_0x412444[_0xc720('0x8')](_0xc720('0x43'),require('./api/openchannelAccount'));_0x412444[_0xc720('0x8')](_0xc720('0x44'),require(_0xc720('0x45')));_0x412444[_0xc720('0x8')](_0xc720('0x46'),require(_0xc720('0x47')));_0x412444['use'](_0xc720('0x48'),require('./api/openchannelMessage'));_0x412444[_0xc720('0x8')](_0xc720('0x49'),require('./api/openchannelQueue'));_0x412444['use'](_0xc720('0x4a'),require(_0xc720('0x4b')));_0x412444['use']('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x412444[_0xc720('0x8')](_0xc720('0x4c'),require(_0xc720('0x4d')));_0x412444[_0xc720('0x8')](_0xc720('0x4e'),require('./api/chatInteraction'));_0x412444[_0xc720('0x8')](_0xc720('0x4f'),require(_0xc720('0x50')));_0x412444[_0xc720('0x8')](_0xc720('0x51'),require(_0xc720('0x52')));_0x412444[_0xc720('0x8')](_0xc720('0x53'),require(_0xc720('0x54')));_0x412444[_0xc720('0x8')](_0xc720('0x55'),require(_0xc720('0x56')));_0x412444[_0xc720('0x8')]('/api/chat/proactive_actions',require(_0xc720('0x57')));_0x412444['use'](_0xc720('0x58'),require(_0xc720('0x59')));_0x412444[_0xc720('0x8')](_0xc720('0x5a'),require(_0xc720('0x5b')));_0x412444[_0xc720('0x8')]('/api/cm/hopper',require(_0xc720('0x5c')));_0x412444['use']('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x412444[_0xc720('0x8')](_0xc720('0x5d'),require(_0xc720('0x5e')));_0x412444[_0xc720('0x8')]('/api/cm/hopper_history',require(_0xc720('0x5f')));_0x412444[_0xc720('0x8')](_0xc720('0x60'),require(_0xc720('0x61')));_0x412444[_0xc720('0x8')]('/api/actions',require(_0xc720('0x62')));_0x412444['use'](_0xc720('0x63'),require(_0xc720('0x64')));_0x412444['use']('/api/canned_answers',require(_0xc720('0x65')));_0x412444[_0xc720('0x8')](_0xc720('0x66'),require(_0xc720('0x67')));_0x412444[_0xc720('0x8')](_0xc720('0x68'),require(_0xc720('0x69')));_0x412444['use'](_0xc720('0x6a'),require(_0xc720('0x6b')));_0x412444['use'](_0xc720('0x6c'),require('./api/pause'));_0x412444[_0xc720('0x8')](_0xc720('0x6d'),require(_0xc720('0x6e')));_0x412444[_0xc720('0x8')](_0xc720('0x6f'),require('./api/voiceQueuesLog'));_0x412444[_0xc720('0x8')](_0xc720('0x70'),require(_0xc720('0x71')));_0x412444['use']('/api/sounds',require(_0xc720('0x72')));_0x412444['use'](_0xc720('0x73'),require('./api/tag'));_0x412444[_0xc720('0x8')](_0xc720('0x74'),require(_0xc720('0x75')));_0x412444[_0xc720('0x8')](_0xc720('0x76'),require(_0xc720('0x77')));_0x412444[_0xc720('0x8')]('/api/cm_hopper_additional_phones',require(_0xc720('0x78')));_0x412444[_0xc720('0x8')](_0xc720('0x79'),require(_0xc720('0x7a')));_0x412444['use'](_0xc720('0x7b'),require(_0xc720('0x7c')));_0x412444[_0xc720('0x8')]('/api/variables',require(_0xc720('0x7d')));_0x412444[_0xc720('0x8')](_0xc720('0x7e'),require(_0xc720('0x7f')));_0x412444[_0xc720('0x8')](_0xc720('0x80'),require(_0xc720('0x81')));_0x412444[_0xc720('0x8')](_0xc720('0x82'),require(_0xc720('0x83')));_0x412444[_0xc720('0x8')](_0xc720('0x84'),require('./api/analyticDefaultReport'));_0x412444[_0xc720('0x8')](_0xc720('0x85'),require(_0xc720('0x86')));_0x412444[_0xc720('0x8')](_0xc720('0x87'),require(_0xc720('0x88')));_0x412444[_0xc720('0x8')](_0xc720('0x89'),require('./api/analyticFieldReport'));_0x412444['use'](_0xc720('0x8a'),require(_0xc720('0x8b')));_0x412444[_0xc720('0x8')](_0xc720('0x8c'),require('./api/intSalesforceAccount'));_0x412444['use']('/api/integrations/salesforce/configurations',require(_0xc720('0x8d')));_0x412444[_0xc720('0x8')](_0xc720('0x8e'),require(_0xc720('0x8f')));_0x412444[_0xc720('0x8')](_0xc720('0x90'),require(_0xc720('0x91')));_0x412444[_0xc720('0x8')](_0xc720('0x92'),require(_0xc720('0x93')));_0x412444[_0xc720('0x8')](_0xc720('0x94'),require(_0xc720('0x95')));_0x412444[_0xc720('0x8')](_0xc720('0x96'),require(_0xc720('0x97')));_0x412444[_0xc720('0x8')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x412444['use'](_0xc720('0x98'),require(_0xc720('0x99')));_0x412444['use'](_0xc720('0x9a'),require(_0xc720('0x9b')));_0x412444[_0xc720('0x8')](_0xc720('0x9c'),require(_0xc720('0x9d')));_0x412444['use'](_0xc720('0x9e'),require(_0xc720('0x9f')));_0x412444[_0xc720('0x8')](_0xc720('0xa0'),require('./api/intZendeskAccount'));_0x412444['use']('/api/integrations/zendesk/configurations',require(_0xc720('0xa1')));_0x412444['use'](_0xc720('0xa2'),require(_0xc720('0xa3')));_0x412444[_0xc720('0x8')](_0xc720('0xa4'),require(_0xc720('0xa5')));_0x412444[_0xc720('0x8')](_0xc720('0xa6'),require(_0xc720('0xa7')));_0x412444[_0xc720('0x8')](_0xc720('0xa8'),require(_0xc720('0xa9')));_0x412444[_0xc720('0x8')]('/api/integrations/vtiger/accounts',require(_0xc720('0xaa')));_0x412444['use']('/api/integrations/vtiger/configurations',require(_0xc720('0xab')));_0x412444[_0xc720('0x8')](_0xc720('0xac'),require('./api/intVtigerField'));_0x412444['use'](_0xc720('0xad'),require(_0xc720('0xae')));_0x412444['use'](_0xc720('0xaf'),require('./api/intServicenowConfiguration'));_0x412444[_0xc720('0x8')](_0xc720('0xb0'),require('./api/intServicenowField'));_0x412444[_0xc720('0x8')](_0xc720('0xb1'),require(_0xc720('0xb2')));_0x412444[_0xc720('0x8')](_0xc720('0xb3'),require(_0xc720('0xb4')));_0x412444[_0xc720('0x8')](_0xc720('0xb5'),require(_0xc720('0xb6')));_0x412444[_0xc720('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x412444[_0xc720('0x8')](_0xc720('0xb7'),require(_0xc720('0xb8')));_0x412444[_0xc720('0x8')](_0xc720('0xb9'),require(_0xc720('0xba')));_0x412444[_0xc720('0x8')]('/api/networks',require(_0xc720('0xbb')));_0x412444[_0xc720('0x8')]('/api/chat/reports/queue',require(_0xc720('0xbc')));_0x412444['use'](_0xc720('0xbd'),require('./api/chatInternalMessage'));_0x412444[_0xc720('0x8')](_0xc720('0xbe'),require('./api/jscriptyAnswerReport'));_0x412444['use'](_0xc720('0xbf'),require(_0xc720('0xc0')));_0x412444[_0xc720('0x8')](_0xc720('0xc1'),require(_0xc720('0xc2')));_0x412444[_0xc720('0x8')](_0xc720('0xc3'),require(_0xc720('0xc4')));_0x412444[_0xc720('0x8')]('/api/square/reports',require(_0xc720('0xc5')));_0x412444[_0xc720('0x8')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x412444[_0xc720('0x8')](_0xc720('0xc6'),require(_0xc720('0xc7')));_0x412444[_0xc720('0x8')](_0xc720('0xc8'),require(_0xc720('0xc9')));_0x412444[_0xc720('0x8')]('/api/square/odbc',require(_0xc720('0xca')));_0x412444['use'](_0xc720('0xcb'),require(_0xc720('0xcc')));_0x412444[_0xc720('0x8')](_0xc720('0xcd'),require(_0xc720('0xce')));_0x412444[_0xc720('0x8')](_0xc720('0xcf'),require(_0xc720('0xd0')));_0x412444[_0xc720('0x8')](_0xc720('0xd1'),require('./api/team'));_0x412444[_0xc720('0x8')]('/api/license',require(_0xc720('0xd2')));_0x412444['use'](_0xc720('0xd3'),require('./api/campaign'));_0x412444[_0xc720('0x8')](_0xc720('0xd4'),require(_0xc720('0xd5')));_0x412444['use'](_0xc720('0xd6'),require('./api/attachment'));_0x412444[_0xc720('0x8')](_0xc720('0xd7'),require('./api/plugin'));_0x412444[_0xc720('0x8')](_0xc720('0xd8'),require('./api/mailTransferReport'));_0x412444[_0xc720('0x8')](_0xc720('0xd9'),require(_0xc720('0xda')));_0x412444[_0xc720('0x8')](_0xc720('0xdb'),require(_0xc720('0xdc')));_0x412444[_0xc720('0x8')](_0xc720('0xdd'),require(_0xc720('0xde')));_0x412444['use'](_0xc720('0xdf'),require(_0xc720('0xe0')));_0x412444['use'](_0xc720('0xe1'),require(_0xc720('0xe2')));_0x412444[_0xc720('0x8')](_0xc720('0xe3'),require('./api/voicePrefix'));_0x412444[_0xc720('0x8')](_0xc720('0xe4'),require(_0xc720('0xe5')));_0x412444[_0xc720('0x8')](_0xc720('0xe6'),require(_0xc720('0xe7')));_0x412444['use'](_0xc720('0xe8'),require(_0xc720('0xe9')));_0x412444[_0xc720('0x8')](_0xc720('0xea'),require(_0xc720('0xeb')));_0x412444[_0xc720('0x8')](_0xc720('0xec'),require('./api/whatsappAccount'));_0x412444[_0xc720('0x8')]('/api/whatsapp/applications',require(_0xc720('0xed')));_0x412444[_0xc720('0x8')](_0xc720('0xee'),require('./api/whatsappInteraction'));_0x412444[_0xc720('0x8')](_0xc720('0xef'),require(_0xc720('0xf0')));_0x412444[_0xc720('0x8')](_0xc720('0xf1'),require(_0xc720('0xf2')));_0x412444[_0xc720('0x8')](_0xc720('0xf3'),require('./api/whatsappTransferReport'));_0x412444['use'](_0xc720('0xf4'),require(_0xc720('0xf5')));_0x412444['use'](_0xc720('0xf6'),require('./api/cloudProvider'));_0x412444['use'](_0xc720('0xf7'),require(_0xc720('0xf8')));_0x412444[_0xc720('0x8')](_0xc720('0xf9'),require('./api/user-setting'));_0x412444[_0xc720('0x8')](_0xc720('0xfa'),require('./api/authLocal'));_0x412444['use'](_0xc720('0xfb'),require(_0xc720('0xfc')));_0x412444[_0xc720('0x8')](_0xc720('0xfd'),require('./api/authActiveDirectory'));_0x412444['use'](_0xc720('0xfe'),require(_0xc720('0xff')));_0x412444[_0xc720('0x8')](_0xc720('0x100'),require(_0xc720('0x101')));_0x412444[_0xc720('0x8')](_0xc720('0x102'),require(_0xc720('0x103')));_0x412444['use'](_0xc720('0x104'),require(_0xc720('0x105')));_0x412444[_0xc720('0x8')]('/api/pm2',require(_0xc720('0x106')));_0x412444['use']('/api/webbar',require(_0xc720('0x107')));_0x412444[_0xc720('0x8')](_0xc720('0x108'),clientSideLogs);_0x412444[_0xc720('0x8')](_0xc720('0x109'),express[_0xc720('0x10a')](path['join'](config[_0xc720('0x10b')],'/apidoc')));_0x412444[_0xc720('0x8')](_0xc720('0x10c'),express['static'](path[_0xc720('0x10d')](config['root'],_0xc720('0x10c'))));_0x412444[_0xc720('0x8')](_0xc720('0x10e'),express['static'](path[_0xc720('0x10d')](config[_0xc720('0x10b')],_0xc720('0x10e'))));_0x412444[_0xc720('0x8')](_0xc720('0x10f'),express['static'](path['join'](config[_0xc720('0x10b')],_0xc720('0x110'),_0xc720('0x111'))));_0x412444[_0xc720('0x8')](_0xc720('0x112'),express['static'](path[_0xc720('0x10d')](config[_0xc720('0x10b')],'/server/files/plugins')));_0x412444['route'](_0xc720('0x113'))[_0xc720('0x114')](errors[0x194]);_0x412444[_0xc720('0x115')]('/*')[_0xc720('0x114')](function(_0x3a8612,_0x10e066){_0x10e066[_0xc720('0x116')](path['resolve'](_0x412444[_0xc720('0x114')](_0xc720('0x117'))+_0xc720('0x118')));});return _0x412444;});}; \ No newline at end of file +var _0x71b9=['./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','root','/www','static','/demo','snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/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/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations'];(function(_0x301730,_0x270bd1){var _0x3cccee=function(_0x3dfba6){while(--_0x3dfba6){_0x301730['push'](_0x301730['shift']());}};_0x3cccee(++_0x270bd1);}(_0x71b9,0x71));var _0x971b=function(_0xb0c745,_0x104572){_0xb0c745=_0xb0c745-0x0;var _0x5168b1=_0x71b9[_0xb0c745];return _0x5168b1;};'use strict';var path=require(_0x971b('0x0'));var express=require(_0x971b('0x1'));var errors=require(_0x971b('0x2'));var config=require(_0x971b('0x3'));var setupLoggers=require(_0x971b('0x4'))[_0x971b('0x5')];var clientSideLogs=require('./api/client-side-logs');exports[_0x971b('0x6')]=function(_0x11367a){return setupLoggers(_0x11367a)[_0x971b('0x7')](function(){_0x11367a['use'](_0x971b('0x8'),require(_0x971b('0x9')));_0x11367a[_0x971b('0xa')](_0x971b('0xb'),require(_0x971b('0xc')));_0x11367a[_0x971b('0xa')](_0x971b('0xd'),require(_0x971b('0xe')));_0x11367a[_0x971b('0xa')](_0x971b('0xf'),require(_0x971b('0x10')));_0x11367a[_0x971b('0xa')](_0x971b('0x11'),require(_0x971b('0x12')));_0x11367a[_0x971b('0xa')](_0x971b('0x13'),require('./api/voiceQueue'));_0x11367a['use'](_0x971b('0x14'),require(_0x971b('0x15')));_0x11367a[_0x971b('0xa')](_0x971b('0x16'),require('./api/screenRecording'));_0x11367a[_0x971b('0xa')]('/api/voice/mails',require(_0x971b('0x17')));_0x11367a[_0x971b('0xa')]('/api/voice/mails/messages',require(_0x971b('0x18')));_0x11367a[_0x971b('0xa')](_0x971b('0x19'),require(_0x971b('0x1a')));_0x11367a[_0x971b('0xa')](_0x971b('0x1b'),require(_0x971b('0x1c')));_0x11367a[_0x971b('0xa')]('/api/voice/agents/reports',require(_0x971b('0x1d')));_0x11367a[_0x971b('0xa')](_0x971b('0x1e'),require(_0x971b('0x1f')));_0x11367a[_0x971b('0xa')](_0x971b('0x20'),require('./api/memberReport'));_0x11367a[_0x971b('0xa')](_0x971b('0x21'),require('./api/trunk'));_0x11367a['use'](_0x971b('0x22'),require(_0x971b('0x23')));_0x11367a[_0x971b('0xa')]('/api/mail/out_servers',require(_0x971b('0x24')));_0x11367a[_0x971b('0xa')](_0x971b('0x25'),require(_0x971b('0x26')));_0x11367a[_0x971b('0xa')](_0x971b('0x27'),require(_0x971b('0x28')));_0x11367a[_0x971b('0xa')]('/api/mail/substatuses',require(_0x971b('0x29')));_0x11367a[_0x971b('0xa')](_0x971b('0x2a'),require('./api/mailInteraction'));_0x11367a[_0x971b('0xa')](_0x971b('0x2b'),require(_0x971b('0x2c')));_0x11367a[_0x971b('0xa')](_0x971b('0x2d'),require('./api/mailApplication'));_0x11367a[_0x971b('0xa')](_0x971b('0x2e'),require('./api/mailQueueReport'));_0x11367a[_0x971b('0xa')]('/api/dashboards',require(_0x971b('0x2f')));_0x11367a[_0x971b('0xa')]('/api/dashboards/items',require(_0x971b('0x30')));_0x11367a['use'](_0x971b('0x31'),require(_0x971b('0x32')));_0x11367a[_0x971b('0xa')](_0x971b('0x33'),require(_0x971b('0x34')));_0x11367a['use']('/api/fax/interactions',require(_0x971b('0x35')));_0x11367a['use'](_0x971b('0x36'),require(_0x971b('0x37')));_0x11367a['use']('/api/fax/queues',require(_0x971b('0x38')));_0x11367a[_0x971b('0xa')](_0x971b('0x39'),require(_0x971b('0x3a')));_0x11367a['use'](_0x971b('0x3b'),require('./api/smsAccount'));_0x11367a[_0x971b('0xa')](_0x971b('0x3c'),require(_0x971b('0x3d')));_0x11367a['use']('/api/sms/interactions',require('./api/smsInteraction'));_0x11367a[_0x971b('0xa')]('/api/sms/messages',require(_0x971b('0x3e')));_0x11367a[_0x971b('0xa')](_0x971b('0x3f'),require(_0x971b('0x40')));_0x11367a[_0x971b('0xa')](_0x971b('0x41'),require(_0x971b('0x42')));_0x11367a[_0x971b('0xa')](_0x971b('0x43'),require(_0x971b('0x44')));_0x11367a[_0x971b('0xa')](_0x971b('0x45'),require(_0x971b('0x46')));_0x11367a['use'](_0x971b('0x47'),require(_0x971b('0x48')));_0x11367a[_0x971b('0xa')](_0x971b('0x49'),require(_0x971b('0x4a')));_0x11367a[_0x971b('0xa')](_0x971b('0x4b'),require(_0x971b('0x4c')));_0x11367a['use'](_0x971b('0x4d'),require(_0x971b('0x4e')));_0x11367a['use'](_0x971b('0x4f'),require(_0x971b('0x50')));_0x11367a[_0x971b('0xa')](_0x971b('0x51'),require(_0x971b('0x52')));_0x11367a[_0x971b('0xa')](_0x971b('0x53'),require(_0x971b('0x54')));_0x11367a['use'](_0x971b('0x55'),require(_0x971b('0x56')));_0x11367a[_0x971b('0xa')](_0x971b('0x57'),require(_0x971b('0x58')));_0x11367a[_0x971b('0xa')](_0x971b('0x59'),require('./api/chatGroup'));_0x11367a[_0x971b('0xa')]('/api/chat/proactive_actions',require(_0x971b('0x5a')));_0x11367a[_0x971b('0xa')]('/api/cm/companies',require(_0x971b('0x5b')));_0x11367a[_0x971b('0xa')](_0x971b('0x5c'),require(_0x971b('0x5d')));_0x11367a['use'](_0x971b('0x5e'),require(_0x971b('0x5f')));_0x11367a['use'](_0x971b('0x60'),require('./api/cmHopperBlack'));_0x11367a['use']('/api/cm/hopper_final',require(_0x971b('0x61')));_0x11367a['use'](_0x971b('0x62'),require(_0x971b('0x63')));_0x11367a[_0x971b('0xa')](_0x971b('0x64'),require('./api/cmCustomField'));_0x11367a[_0x971b('0xa')]('/api/actions',require(_0x971b('0x65')));_0x11367a[_0x971b('0xa')](_0x971b('0x66'),require('./api/automation'));_0x11367a[_0x971b('0xa')](_0x971b('0x67'),require(_0x971b('0x68')));_0x11367a['use'](_0x971b('0x69'),require(_0x971b('0x6a')));_0x11367a[_0x971b('0xa')](_0x971b('0x6b'),require(_0x971b('0x6c')));_0x11367a[_0x971b('0xa')](_0x971b('0x6d'),require(_0x971b('0x6e')));_0x11367a[_0x971b('0xa')](_0x971b('0x6f'),require(_0x971b('0x70')));_0x11367a[_0x971b('0xa')](_0x971b('0x71'),require('./api/cdr'));_0x11367a[_0x971b('0xa')](_0x971b('0x72'),require(_0x971b('0x73')));_0x11367a['use']('/api/schedules',require(_0x971b('0x74')));_0x11367a[_0x971b('0xa')](_0x971b('0x75'),require('./api/sound'));_0x11367a[_0x971b('0xa')](_0x971b('0x76'),require(_0x971b('0x77')));_0x11367a['use']('/api/contact_item_types',require('./api/contactItemType'));_0x11367a[_0x971b('0xa')](_0x971b('0x78'),require('./api/cmContactHasItem'));_0x11367a['use'](_0x971b('0x79'),require(_0x971b('0x7a')));_0x11367a[_0x971b('0xa')](_0x971b('0x7b'),require(_0x971b('0x7c')));_0x11367a[_0x971b('0xa')](_0x971b('0x7d'),require(_0x971b('0x7e')));_0x11367a[_0x971b('0xa')](_0x971b('0x7f'),require(_0x971b('0x80')));_0x11367a['use'](_0x971b('0x81'),require(_0x971b('0x82')));_0x11367a['use'](_0x971b('0x83'),require(_0x971b('0x84')));_0x11367a[_0x971b('0xa')](_0x971b('0x85'),require(_0x971b('0x86')));_0x11367a[_0x971b('0xa')](_0x971b('0x87'),require('./api/analyticDefaultReport'));_0x11367a['use']('/api/analytics/extracted_reports',require(_0x971b('0x88')));_0x11367a[_0x971b('0xa')](_0x971b('0x89'),require(_0x971b('0x8a')));_0x11367a[_0x971b('0xa')](_0x971b('0x8b'),require(_0x971b('0x8c')));_0x11367a['use'](_0x971b('0x8d'),require(_0x971b('0x8e')));_0x11367a[_0x971b('0xa')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x11367a[_0x971b('0xa')](_0x971b('0x8f'),require(_0x971b('0x90')));_0x11367a['use'](_0x971b('0x91'),require('./api/intSalesforceField'));_0x11367a[_0x971b('0xa')](_0x971b('0x92'),require(_0x971b('0x93')));_0x11367a[_0x971b('0xa')](_0x971b('0x94'),require(_0x971b('0x95')));_0x11367a[_0x971b('0xa')]('/api/integrations/sugarcrm/fields',require(_0x971b('0x96')));_0x11367a[_0x971b('0xa')](_0x971b('0x97'),require('./api/intDeskAccount'));_0x11367a[_0x971b('0xa')](_0x971b('0x98'),require(_0x971b('0x99')));_0x11367a[_0x971b('0xa')](_0x971b('0x9a'),require(_0x971b('0x9b')));_0x11367a['use'](_0x971b('0x9c'),require(_0x971b('0x9d')));_0x11367a[_0x971b('0xa')](_0x971b('0x9e'),require(_0x971b('0x9f')));_0x11367a[_0x971b('0xa')]('/api/integrations/zoho/fields',require(_0x971b('0xa0')));_0x11367a['use'](_0x971b('0xa1'),require(_0x971b('0xa2')));_0x11367a[_0x971b('0xa')](_0x971b('0xa3'),require(_0x971b('0xa4')));_0x11367a[_0x971b('0xa')](_0x971b('0xa5'),require('./api/intZendeskField'));_0x11367a[_0x971b('0xa')](_0x971b('0xa6'),require(_0x971b('0xa7')));_0x11367a[_0x971b('0xa')](_0x971b('0xa8'),require(_0x971b('0xa9')));_0x11367a[_0x971b('0xa')](_0x971b('0xaa'),require(_0x971b('0xab')));_0x11367a['use'](_0x971b('0xac'),require(_0x971b('0xad')));_0x11367a['use'](_0x971b('0xae'),require(_0x971b('0xaf')));_0x11367a['use']('/api/integrations/vtiger/fields',require(_0x971b('0xb0')));_0x11367a[_0x971b('0xa')]('/api/integrations/servicenow/accounts',require(_0x971b('0xb1')));_0x11367a[_0x971b('0xa')](_0x971b('0xb2'),require(_0x971b('0xb3')));_0x11367a[_0x971b('0xa')]('/api/integrations/servicenow/fields',require(_0x971b('0xb4')));_0x11367a[_0x971b('0xa')](_0x971b('0xb5'),require(_0x971b('0xb6')));_0x11367a[_0x971b('0xa')](_0x971b('0xb7'),require('./api/intDynamics365Configuration'));_0x11367a[_0x971b('0xa')](_0x971b('0xb8'),require(_0x971b('0xb9')));_0x11367a[_0x971b('0xa')]('/api/integrations/freshsales/accounts',require(_0x971b('0xba')));_0x11367a[_0x971b('0xa')](_0x971b('0xbb'),require(_0x971b('0xbc')));_0x11367a[_0x971b('0xa')](_0x971b('0xbd'),require(_0x971b('0xbe')));_0x11367a[_0x971b('0xa')]('/api/networks',require(_0x971b('0xbf')));_0x11367a[_0x971b('0xa')]('/api/chat/reports/queue',require(_0x971b('0xc0')));_0x11367a[_0x971b('0xa')](_0x971b('0xc1'),require(_0x971b('0xc2')));_0x11367a[_0x971b('0xa')](_0x971b('0xc3'),require('./api/jscriptyAnswerReport'));_0x11367a[_0x971b('0xa')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x11367a['use'](_0x971b('0xc4'),require(_0x971b('0xc5')));_0x11367a[_0x971b('0xa')](_0x971b('0xc6'),require(_0x971b('0xc7')));_0x11367a[_0x971b('0xa')]('/api/square/reports',require(_0x971b('0xc8')));_0x11367a[_0x971b('0xa')](_0x971b('0xc9'),require('./api/squareReportDetail'));_0x11367a[_0x971b('0xa')](_0x971b('0xca'),require(_0x971b('0xcb')));_0x11367a[_0x971b('0xa')](_0x971b('0xcc'),require(_0x971b('0xcd')));_0x11367a[_0x971b('0xa')](_0x971b('0xce'),require(_0x971b('0xcf')));_0x11367a[_0x971b('0xa')](_0x971b('0xd0'),require(_0x971b('0xd1')));_0x11367a['use'](_0x971b('0xd2'),require(_0x971b('0xd3')));_0x11367a[_0x971b('0xa')](_0x971b('0xd4'),require('./api/squareMessage'));_0x11367a[_0x971b('0xa')](_0x971b('0xd5'),require(_0x971b('0xd6')));_0x11367a[_0x971b('0xa')]('/api/license',require('./api/license'));_0x11367a[_0x971b('0xa')](_0x971b('0xd7'),require(_0x971b('0xd8')));_0x11367a[_0x971b('0xa')](_0x971b('0xd9'),require(_0x971b('0xda')));_0x11367a[_0x971b('0xa')](_0x971b('0xdb'),require(_0x971b('0xdc')));_0x11367a['use']('/api/plugins',require(_0x971b('0xdd')));_0x11367a['use'](_0x971b('0xde'),require('./api/mailTransferReport'));_0x11367a[_0x971b('0xa')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x11367a['use'](_0x971b('0xdf'),require(_0x971b('0xe0')));_0x11367a[_0x971b('0xa')](_0x971b('0xe1'),require(_0x971b('0xe2')));_0x11367a['use'](_0x971b('0xe3'),require(_0x971b('0xe4')));_0x11367a[_0x971b('0xa')](_0x971b('0xe5'),require(_0x971b('0xe6')));_0x11367a[_0x971b('0xa')](_0x971b('0xe7'),require(_0x971b('0xe8')));_0x11367a['use']('/api/userProfiles',require(_0x971b('0xe9')));_0x11367a['use'](_0x971b('0xea'),require(_0x971b('0xeb')));_0x11367a[_0x971b('0xa')]('/api/userProfile/resources',require(_0x971b('0xec')));_0x11367a[_0x971b('0xa')](_0x971b('0xed'),require('./api/userNotification'));_0x11367a[_0x971b('0xa')]('/api/whatsapp/accounts',require(_0x971b('0xee')));_0x11367a[_0x971b('0xa')](_0x971b('0xef'),require('./api/whatsappApplication'));_0x11367a[_0x971b('0xa')](_0x971b('0xf0'),require(_0x971b('0xf1')));_0x11367a[_0x971b('0xa')](_0x971b('0xf2'),require(_0x971b('0xf3')));_0x11367a[_0x971b('0xa')](_0x971b('0xf4'),require(_0x971b('0xf5')));_0x11367a[_0x971b('0xa')](_0x971b('0xf6'),require(_0x971b('0xf7')));_0x11367a[_0x971b('0xa')](_0x971b('0xf8'),require(_0x971b('0xf9')));_0x11367a['use'](_0x971b('0xfa'),require(_0x971b('0xfb')));_0x11367a[_0x971b('0xa')](_0x971b('0xfc'),require(_0x971b('0xfd')));_0x11367a['use']('/api/user-settings',require(_0x971b('0xfe')));_0x11367a[_0x971b('0xa')](_0x971b('0xff'),require(_0x971b('0x100')));_0x11367a[_0x971b('0xa')](_0x971b('0x101'),require('./api/authGoogle'));_0x11367a['use'](_0x971b('0x102'),require(_0x971b('0x103')));_0x11367a[_0x971b('0xa')](_0x971b('0x104'),require(_0x971b('0x105')));_0x11367a[_0x971b('0xa')](_0x971b('0x106'),require('./api/rpc'));_0x11367a['use'](_0x971b('0x107'),require(_0x971b('0x108')));_0x11367a['use']('/api/system',require(_0x971b('0x109')));_0x11367a[_0x971b('0xa')](_0x971b('0x10a'),require(_0x971b('0x10b')));_0x11367a[_0x971b('0xa')](_0x971b('0x10c'),require(_0x971b('0x10d')));_0x11367a[_0x971b('0xa')](_0x971b('0x10e'),clientSideLogs);_0x11367a['use'](_0x971b('0x10f'),express['static'](path[_0x971b('0x110')](config[_0x971b('0x111')],_0x971b('0x10f'))));_0x11367a[_0x971b('0xa')](_0x971b('0x112'),express[_0x971b('0x113')](path[_0x971b('0x110')](config[_0x971b('0x111')],_0x971b('0x112'))));_0x11367a['use'](_0x971b('0x114'),express['static'](path[_0x971b('0x110')](config[_0x971b('0x111')],_0x971b('0x114'))));_0x11367a[_0x971b('0xa')]('/snippet',express[_0x971b('0x113')](path[_0x971b('0x110')](config['root'],_0x971b('0x115'),_0x971b('0x116'))));_0x11367a[_0x971b('0xa')](_0x971b('0x117'),express[_0x971b('0x113')](path[_0x971b('0x110')](config[_0x971b('0x111')],_0x971b('0x118'))));_0x11367a[_0x971b('0x119')](_0x971b('0x11a'))[_0x971b('0x11b')](errors[0x194]);_0x11367a['route']('/*')[_0x971b('0x11b')](function(_0x28e8dc,_0x4ea5ad){_0x4ea5ad[_0x971b('0x11c')](path[_0x971b('0x11d')](_0x11367a[_0x971b('0x11b')](_0x971b('0x11e'))+_0x971b('0x11f')));});return _0x11367a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 9cce23a..38c8249 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1caf=['../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.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/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','../config/environment','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','merge','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc'];(function(_0x25f419,_0x153a5f){var _0x1f5a12=function(_0x4093e8){while(--_0x4093e8){_0x25f419['push'](_0x25f419['shift']());}};_0x1f5a12(++_0x153a5f);}(_0x1caf,0x1e1));var _0xf1ca=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x1caf[_0x4baae2];return _0x1a2285;};'use strict';var jayson=require(_0xf1ca('0x0'));var _=require('lodash');var config=require(_0xf1ca('0x1'));exports['listen']=function(){return new Promise(function(_0x498ad3,_0x5e8c31){var _0xb57236={};_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x2')));_0xb57236=_['merge'](_0xb57236,require('../api/voiceExtension/voiceExtension.rpc'));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x3')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x4')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x6')));_0xb57236=_['merge'](_0xb57236,require('../api/voiceDialReport/voiceDialReport.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x7')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x8')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x9')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0xa')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0xb')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0xc')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0xd')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0xe')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0xf')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x10')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x11')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x12')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x13')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x14')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x15')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x16')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x17')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x18')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x19')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x1a')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/smsQueue/smsQueue.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x1b')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x1c')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x1d')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x1e')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x1f')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x20')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/chatQueue/chatQueue.rpc'));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x21')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x22')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x23')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x24')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x25')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x26')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x27')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x28')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x29')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x2a')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x2b')));_0xb57236=_['merge'](_0xb57236,require('../api/variable/variable.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x2c')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x2d')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x2e')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x2f')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x30')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x31')));_0xb57236=_['merge'](_0xb57236,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x32')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x33')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x34')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/squareReport/squareReport.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x35')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x36')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x37')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x38')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x39')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x3a')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x3b')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require(_0xf1ca('0x3c')));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x3d')));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/whatsappAccount/whatsappAccount.rpc'));_0xb57236=_['merge'](_0xb57236,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/whatsappMessage/whatsappMessage.rpc'));_0xb57236=_[_0xf1ca('0x5')](_0xb57236,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xb57236=_['merge'](_0xb57236,require(_0xf1ca('0x3e')));var _0x4965f5=jayson[_0xf1ca('0x3f')](_0xb57236)[_0xf1ca('0x40')]();var _0x56edab=config[_0xf1ca('0x41')][_0xf1ca('0x42')]||config[_0xf1ca('0x42')]+0x1;var _0x50c166=config['rpc']['ip']||_0xf1ca('0x43');_0x4965f5['on']('error',function(_0x2e011a){return _0x5e8c31(_0x2e011a);});_0x4965f5[_0xf1ca('0x44')](_0x56edab,_0x50c166,function(){console[_0xf1ca('0x45')](_0xf1ca('0x46'),_0x50c166,_0x56edab);require(_0xf1ca('0x47'))[_0xf1ca('0x48')]();return _0x498ad3('RPC\x20listening\x20on\x20'+_0x50c166+':'+_0x56edab);});});}; \ No newline at end of file +var _0x6132=['../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.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/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x6132,0x13a));var _0x2613=function(_0x596abf,_0x4c02f1){_0x596abf=_0x596abf-0x0;var _0x210ac8=_0x6132[_0x596abf];return _0x210ac8;};'use strict';var jayson=require(_0x2613('0x0'));var _=require(_0x2613('0x1'));var config=require(_0x2613('0x2'));exports[_0x2613('0x3')]=function(){return new Promise(function(_0x4a191a,_0x2e19a7){var _0x1a9371={};_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x5')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x6')));_0x1a9371=_['merge'](_0x1a9371,require('../api/voiceQueue/voiceQueue.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x7')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x8')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x9')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0xa')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0xb')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0xc')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0xd')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0xe')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0xf')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x10')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/mailInteraction/mailInteraction.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x11')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x12')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x13')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x14')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/faxApplication/faxApplication.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x15')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x16')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x17')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x18')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x19')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/smsInteraction/smsInteraction.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x1a')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x1b')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x1c')));_0x1a9371=_['merge'](_0x1a9371,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x1d')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x1e')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/chatMessage/chatMessage.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x1f')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x20')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x21')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x22')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x23')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x24')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x25')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x26')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x27')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x28')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x29')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x2a')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x2b')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/variable/variable.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x2c')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x2d')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x2e')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x2f')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x30')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x31')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x32')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x33')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x34')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x35')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x36')));_0x1a9371=_['merge'](_0x1a9371,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x37')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x38')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x39')));_0x1a9371=_['merge'](_0x1a9371,require('../api/squareOdbc/squareOdbc.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/squareProject/squareProject.rpc'));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x3a')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/squareMessage/squareMessage.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require('../api/campaign/campaign.rpc'));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x3b')));_0x1a9371=_['merge'](_0x1a9371,require('../api/plugin/plugin.rpc'));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x3c')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x3d')));_0x1a9371=_['merge'](_0x1a9371,require(_0x2613('0x3e')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x3f')));_0x1a9371=_[_0x2613('0x4')](_0x1a9371,require(_0x2613('0x40')));var _0x5eccd6=jayson['server'](_0x1a9371)[_0x2613('0x41')]();var _0x3f49d3=config[_0x2613('0x42')]['port']||config['port']+0x1;var _0xf9ab5b=config[_0x2613('0x42')]['ip']||_0x2613('0x43');_0x5eccd6['on']('error',function(_0x584186){return _0x2e19a7(_0x584186);});_0x5eccd6['listen'](_0x3f49d3,_0xf9ab5b,function(){console[_0x2613('0x44')](_0x2613('0x45'),_0xf9ab5b,_0x3f49d3);require(_0x2613('0x46'))[_0x2613('0x47')]();return _0x4a191a(_0x2613('0x48')+_0xf9ab5b+':'+_0x3f49d3);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 08022c6..c2fb58a 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 _0x3408=['indexOf','substr','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sync','prototype','ANSWER','sendRequest','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','line','toLowerCase','hangup','emit','520-Invalid','function','substring','no\x20code','replace','result='];(function(_0x1989eb,_0x35a9eb){var _0x1bb657=function(_0x5978ac){while(--_0x5978ac){_0x1989eb['push'](_0x1989eb['shift']());}};_0x1bb657(++_0x35a9eb);}(_0x3408,0x177));var _0x8340=function(_0x1f641e,_0x411d52){_0x1f641e=_0x1f641e-0x0;var _0x13406e=_0x3408[_0x1f641e];return _0x13406e;};'use strict';var util=require(_0x8340('0x0'));var _=require(_0x8340('0x1'));var EventEmitter=require(_0x8340('0x2'))[_0x8340('0x3')];var AGIReply=require(_0x8340('0x4'));var AGIError=require(_0x8340('0x5'));function AGIChannel(_0x34cb8a){var _0x3c8360=this,_0x1ca22c=new AGIReply(),_0x33ee17=![],_0x67180={};EventEmitter[_0x8340('0x6')](_0x3c8360);_0x34cb8a[_0x8340('0x7')](_0x8340('0x8'));_0x34cb8a[_0x8340('0x9')](0x8*0x3c*0x3c*0x3e8);_0x1ca22c[_0x8340('0x7')](_0x8340('0x8'));_0x1ca22c['on']('headers',function(_0x1da6f3){for(var _0x5b1a7b in _0x1da6f3){_0x3c8360[_0x5b1a7b]=_0x1da6f3[_0x5b1a7b];}_0x3c8360['emit']('ready');});_0x1ca22c['on'](_0x8340('0xa'),function(_0x1fb81d){if(_0x1fb81d[_0x8340('0xb')]()==_0x8340('0xc')){_0x3c8360[_0x8340('0xd')](_0x8340('0xc'));return;}if(_0x1fb81d['substring'](0x0,0xb)==_0x8340('0xe')){_0x33ee17=!![];}if(_0x33ee17){_0x67180['rx']+=_0x1fb81d+'\x0a';if(_0x1fb81d['search']('520\x20End\x20of\x20proper')!=-0x1){_0x33ee17=![];}}else{_0x67180['rx']=_0x1fb81d;}if(_0x33ee17){return;}if(typeof _0x67180['cb']==_0x8340('0xf')){var _0x3d3e91=_0x67180['rx'][_0x8340('0x10')](0x0,0x3),_0x4e5e02=null,_0x30836e=null;_0x3d3e91=parseInt(_0x3d3e91);if(isNaN(_0x3d3e91)){_0x67180['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x8340('0x11')});return;}if(_0x3d3e91!=0xc8){_0x67180['cb'](null,{'code':_0x3d3e91,'result':-0x1,'extra':'KO'});return;}_0x4e5e02=_0x67180['rx'][_0x8340('0x10')](0x4)[_0x8340('0x12')](_0x8340('0x13'),'');if(_0x4e5e02[_0x8340('0x14')]('\x20')!=-0x1){_0x4e5e02=_0x4e5e02[_0x8340('0x15')](0x0,_0x4e5e02[_0x8340('0x14')]('\x20'));}if(_['startsWith'](_0x4e5e02,'-1')){_0x4e5e02=parseInt(_0x4e5e02);}_0x30836e=_0x67180['rx']['split']('\x20');if(_0x30836e[_0x8340('0x16')]==0x3){_0x30836e=_0x30836e[0x2]['substring'](0x1,_0x30836e[0x2][_0x8340('0x16')]-0x1);}else if(_0x30836e[_0x8340('0x16')]>0x3){var _0x7e80dc=/\((.+)\)/;var _0x4d6d65=_0x67180['rx'][_0x8340('0x17')](_0x7e80dc);if(_0x4d6d65){_0x30836e=_0x4d6d65[0x1];}else{_0x30836e=null;}}else{_0x30836e=null;}_0x67180['cb'](null,{'code':_0x3d3e91,'result':_0x4e5e02,'extra':_0x30836e});}});_0x34cb8a['on']('error',function(_0x30febd){_0x3c8360[_0x8340('0xd')](_0x8340('0x18'),new AGIError(_0x8340('0x19'),_0x30febd[_0x8340('0x1a')]));});_0x34cb8a['on']('close',function(){_0x3c8360[_0x8340('0xd')](_0x8340('0x1b'),new AGIError(_0x8340('0x1c')));});_0x34cb8a['on'](_0x8340('0x1d'),function(){_0x3c8360[_0x8340('0xd')](_0x8340('0x1d'),new AGIError(_0x8340('0x1e')));_0x34cb8a[_0x8340('0x1f')]();});_0x34cb8a[_0x8340('0x20')](_0x1ca22c);this[_0x8340('0x21')]=function(_0x33e2d6,_0x15c4e0){var _0x33e2d6=_0x33e2d6||'',_0x15c4e0=typeof _0x15c4e0=='function'?_0x15c4e0:new Function();_0x67180={'tx':_0x33e2d6,'rx':'','cb':_0x15c4e0};_0x34cb8a[_0x8340('0x22')](_0x33e2d6+'\x0a');},this[_0x8340('0x1b')]=function(){_0x34cb8a[_0x8340('0x1f')]();};}util[_0x8340('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0xbdc721){return this['command'][_0x8340('0x24')](this,_0xbdc721);};AGIChannel[_0x8340('0x25')]['answer']=function(){return this['sendRequest'](_0x8340('0x26'));};AGIChannel[_0x8340('0x25')]['getData']=function(_0xd51905,_0x4cbd0c,_0x3496e5){_0xd51905=_0xd51905===undefined?'beep':_0xd51905;_0x4cbd0c=_0x4cbd0c===undefined?'5':_0x4cbd0c;_0x3496e5=_0x3496e5===undefined?'1':_0x3496e5;return this[_0x8340('0x27')](util[_0x8340('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0xd51905,_0x4cbd0c*0x3e8,_0x3496e5));};AGIChannel[_0x8340('0x25')]['noop']=function(_0x2f57c7){_0x2f57c7=_0x2f57c7||_0x8340('0x29');return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x2a'),_0x2f57c7));};AGIChannel[_0x8340('0x25')][_0x8340('0x2b')]=function(_0x3e6e9d,_0x3d7ca4){if(_[_0x8340('0x2c')](_0x3d7ca4)){return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x2d'),_0x3e6e9d,_0x3d7ca4[_0x8340('0x2e')](',')));}return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x2d'),_0x3e6e9d,_0x3d7ca4));};AGIChannel[_0x8340('0x25')]['setContext']=function(_0x1ff5d3){return this['sendRequest'](util['format'](_0x8340('0x2f'),_0x1ff5d3));};AGIChannel[_0x8340('0x25')][_0x8340('0x30')]=function(_0x3faed2){return this['sendRequest'](util[_0x8340('0x28')](_0x8340('0x31'),_0x3faed2));};AGIChannel['prototype']['setPriority']=function(_0x5e008a){return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x32'),_0x5e008a));};AGIChannel[_0x8340('0x25')]['hangup']=function(){return this[_0x8340('0x27')](_0x8340('0x33'));};AGIChannel[_0x8340('0x25')][_0x8340('0x34')]=function(_0x4f5344,_0x328862){var _0x3149b4=_[_0x8340('0x35')](_0x328862)||_[_0x8340('0x36')](_0x328862)?_0x328862[_0x8340('0x37')]():_0x328862;return this[_0x8340('0x27')](util['format'](_0x8340('0x38'),_0x4f5344,_0x3149b4?_0x3149b4[_0x8340('0x37')]()[_0x8340('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x8340('0x25')][_0x8340('0x39')]=function(_0x2fefea,_0xa9a5ab){return this[_0x8340('0x27')](util['format'](_0x8340('0x3a'),_0x2fefea,_0xa9a5ab));};AGIChannel[_0x8340('0x25')][_0x8340('0x3b')]=function(_0x4c3018,_0x5893a2){return this[_0x8340('0x27')](util[_0x8340('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x4c3018,_0x5893a2));};AGIChannel[_0x8340('0x25')][_0x8340('0x3c')]=function(_0xbe63d7,_0x1c0b93){return this['sendRequest'](util[_0x8340('0x28')](_0x8340('0x3d'),_0xbe63d7,_0x1c0b93));};AGIChannel[_0x8340('0x25')][_0x8340('0x3e')]=function(_0x4ea6ca,_0x115b40,_0x1ef321){_0x115b40=_0x115b40||this[_0x8340('0x3f')];_0x1ef321=_0x1ef321||0x1;this['setContext'](_0x4ea6ca);this[_0x8340('0x30')](_0x115b40);this[_0x8340('0x40')](_0x1ef321);return this[_0x8340('0x41')](util[_0x8340('0x28')](_0x8340('0x42'),_0x4ea6ca,_0x115b40,_0x1ef321));};AGIChannel[_0x8340('0x25')]['getVariable']=function(_0x5ac6f9){return this[_0x8340('0x27')](util['format'](_0x8340('0x43'),_0x5ac6f9));};AGIChannel[_0x8340('0x25')][_0x8340('0x44')]=function(_0x3b4b20,_0x32b258,_0x50523b,_0x8e0b13,_0x4e89a0,_0x5cc854){_0x32b258=_0x32b258||_0x8340('0x45');_0x50523b=_0x50523b||'';_0x8e0b13=_0x8e0b13===undefined?-0x1:_0x8e0b13==='-1'?-0x1:_0x8e0b13*0x3e8;_0x4e89a0=_0x4e89a0===undefined?'':'s='+_0x4e89a0;_0x5cc854=_0x5cc854?_0x8340('0x46'):'';return this[_0x8340('0x27')](util['format'](_0x8340('0x47'),_0x3b4b20,_0x32b258,_0x50523b,_0x8e0b13,_0x5cc854,_0x4e89a0));};AGIChannel['prototype'][_0x8340('0x48')]=function(_0x1543e8,_0xa7d56c){_0xa7d56c=_0xa7d56c||'';return this['sendRequest'](util[_0x8340('0x28')](_0x8340('0x49'),_0x1543e8,_0xa7d56c));};AGIChannel[_0x8340('0x25')][_0x8340('0x4a')]=function(_0x110d09){return this[_0x8340('0x2b')](_0x8340('0x4b'),_0x110d09);};AGIChannel[_0x8340('0x25')]['wait']=function(_0x31d1ba){return this[_0x8340('0x2b')](_0x8340('0x4c'),_0x31d1ba);};AGIChannel[_0x8340('0x25')][_0x8340('0x18')]=function(_0x537018,_0x457f3a){this[_0x8340('0x41')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x537018['id'],_0x537018[_0x8340('0x4d')],_0x457f3a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x8340('0x4e')]=AGIChannel; \ No newline at end of file +var _0x3f32=['function','no\x20code','result=','indexOf','substr','startsWith','length','substring','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','prototype','sendRequest','sync','ANSWER','getData','format','noop','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','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','wait','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0x3f32,0x87));var _0x23f3=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0x3f32[_0x51ed62];return _0x34aee3;};'use strict';var util=require(_0x23f3('0x0'));var _=require(_0x23f3('0x1'));var EventEmitter=require('events')[_0x23f3('0x2')];var AGIReply=require(_0x23f3('0x3'));var AGIError=require(_0x23f3('0x4'));function AGIChannel(_0x542045){var _0x4b4c38=this,_0x58593b=new AGIReply(),_0x5a1e13=![],_0x44e693={};EventEmitter[_0x23f3('0x5')](_0x4b4c38);_0x542045[_0x23f3('0x6')](_0x23f3('0x7'));_0x542045[_0x23f3('0x8')](0x8*0x3c*0x3c*0x3e8);_0x58593b[_0x23f3('0x6')](_0x23f3('0x7'));_0x58593b['on']('headers',function(_0x128b65){for(var _0x8b4e4 in _0x128b65){_0x4b4c38[_0x8b4e4]=_0x128b65[_0x8b4e4];}_0x4b4c38[_0x23f3('0x9')](_0x23f3('0xa'));});_0x58593b['on'](_0x23f3('0xb'),function(_0x597b53){if(_0x597b53[_0x23f3('0xc')]()==_0x23f3('0xd')){_0x4b4c38[_0x23f3('0x9')](_0x23f3('0xd'));return;}if(_0x597b53['substring'](0x0,0xb)==_0x23f3('0xe')){_0x5a1e13=!![];}if(_0x5a1e13){_0x44e693['rx']+=_0x597b53+'\x0a';if(_0x597b53[_0x23f3('0xf')](_0x23f3('0x10'))!=-0x1){_0x5a1e13=![];}}else{_0x44e693['rx']=_0x597b53;}if(_0x5a1e13){return;}if(typeof _0x44e693['cb']==_0x23f3('0x11')){var _0x3d98db=_0x44e693['rx']['substring'](0x0,0x3),_0x4971d1=null,_0x5a5504=null;_0x3d98db=parseInt(_0x3d98db);if(isNaN(_0x3d98db)){_0x44e693['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x23f3('0x12')});return;}if(_0x3d98db!=0xc8){_0x44e693['cb'](null,{'code':_0x3d98db,'result':-0x1,'extra':'KO'});return;}_0x4971d1=_0x44e693['rx']['substring'](0x4)['replace'](_0x23f3('0x13'),'');if(_0x4971d1[_0x23f3('0x14')]('\x20')!=-0x1){_0x4971d1=_0x4971d1[_0x23f3('0x15')](0x0,_0x4971d1['indexOf']('\x20'));}if(_[_0x23f3('0x16')](_0x4971d1,'-1')){_0x4971d1=parseInt(_0x4971d1);}_0x5a5504=_0x44e693['rx']['split']('\x20');if(_0x5a5504[_0x23f3('0x17')]==0x3){_0x5a5504=_0x5a5504[0x2][_0x23f3('0x18')](0x1,_0x5a5504[0x2][_0x23f3('0x17')]-0x1);}else if(_0x5a5504[_0x23f3('0x17')]>0x3){var _0x418ff4=/\((.+)\)/;var _0x11ffbf=_0x44e693['rx'][_0x23f3('0x19')](_0x418ff4);if(_0x11ffbf){_0x5a5504=_0x11ffbf[0x1];}else{_0x5a5504=null;}}else{_0x5a5504=null;}_0x44e693['cb'](null,{'code':_0x3d98db,'result':_0x4971d1,'extra':_0x5a5504});}});_0x542045['on'](_0x23f3('0x1a'),function(_0x544f90){_0x4b4c38['emit'](_0x23f3('0x1a'),new AGIError(_0x23f3('0x1b'),_0x544f90[_0x23f3('0x1c')]));});_0x542045['on']('close',function(){_0x4b4c38[_0x23f3('0x9')](_0x23f3('0x1d'),new AGIError(_0x23f3('0x1e')));});_0x542045['on'](_0x23f3('0x1f'),function(){_0x4b4c38['emit']('timeout',new AGIError(_0x23f3('0x20')));_0x542045[_0x23f3('0x21')]();});_0x542045['pipe'](_0x58593b);this[_0x23f3('0x22')]=function(_0x1dbe90,_0x44139e){var _0x1dbe90=_0x1dbe90||'',_0x44139e=typeof _0x44139e==_0x23f3('0x11')?_0x44139e:new Function();_0x44e693={'tx':_0x1dbe90,'rx':'','cb':_0x44139e};_0x542045[_0x23f3('0x23')](_0x1dbe90+'\x0a');},this['close']=function(){_0x542045[_0x23f3('0x21')]();};}util[_0x23f3('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x23f3('0x25')][_0x23f3('0x26')]=function(_0x3d60e6){return this[_0x23f3('0x22')][_0x23f3('0x27')](this,_0x3d60e6);};AGIChannel[_0x23f3('0x25')]['answer']=function(){return this['sendRequest'](_0x23f3('0x28'));};AGIChannel['prototype'][_0x23f3('0x29')]=function(_0x3662b2,_0x2db944,_0x2bca1c){_0x3662b2=_0x3662b2===undefined?'beep':_0x3662b2;_0x2db944=_0x2db944===undefined?'5':_0x2db944;_0x2bca1c=_0x2bca1c===undefined?'1':_0x2bca1c;return this[_0x23f3('0x26')](util[_0x23f3('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3662b2,_0x2db944*0x3e8,_0x2bca1c));};AGIChannel[_0x23f3('0x25')][_0x23f3('0x2b')]=function(_0x345b76){_0x345b76=_0x345b76||'NO\x20MESSAGE';return this[_0x23f3('0x26')](util[_0x23f3('0x2a')](_0x23f3('0x2c'),_0x345b76));};AGIChannel[_0x23f3('0x25')]['exec']=function(_0x3d8a84,_0x27a6fb){if(_['isArray'](_0x27a6fb)){return this[_0x23f3('0x26')](util[_0x23f3('0x2a')](_0x23f3('0x2d'),_0x3d8a84,_0x27a6fb[_0x23f3('0x2e')](',')));}return this[_0x23f3('0x26')](util[_0x23f3('0x2a')]('EXEC\x20%s\x20%s',_0x3d8a84,_0x27a6fb));};AGIChannel[_0x23f3('0x25')][_0x23f3('0x2f')]=function(_0x44bd2d){return this[_0x23f3('0x26')](util['format']('SET\x20CONTEXT\x20%s',_0x44bd2d));};AGIChannel[_0x23f3('0x25')][_0x23f3('0x30')]=function(_0x58d20e){return this[_0x23f3('0x26')](util[_0x23f3('0x2a')](_0x23f3('0x31'),_0x58d20e));};AGIChannel['prototype']['setPriority']=function(_0x15a522){return this[_0x23f3('0x26')](util[_0x23f3('0x2a')](_0x23f3('0x32'),_0x15a522));};AGIChannel[_0x23f3('0x25')][_0x23f3('0xd')]=function(){return this[_0x23f3('0x26')](_0x23f3('0x33'));};AGIChannel[_0x23f3('0x25')][_0x23f3('0x34')]=function(_0x475652,_0x5393ad){var _0x31f0d6=_[_0x23f3('0x35')](_0x5393ad)||_['isNumber'](_0x5393ad)?_0x5393ad['toString']():_0x5393ad;return this['sendRequest'](util[_0x23f3('0x2a')](_0x23f3('0x36'),_0x475652,_0x31f0d6?_0x31f0d6[_0x23f3('0x37')]()[_0x23f3('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x23f3('0x39')]=function(_0x54b98a,_0x3c4333){return this[_0x23f3('0x26')](util[_0x23f3('0x2a')](_0x23f3('0x3a'),_0x54b98a,_0x3c4333));};AGIChannel[_0x23f3('0x25')][_0x23f3('0x3b')]=function(_0x538dc8,_0x4149e5){return this[_0x23f3('0x26')](util[_0x23f3('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x538dc8,_0x4149e5));};AGIChannel[_0x23f3('0x25')][_0x23f3('0x3c')]=function(_0x3e9d42,_0x31c21d){return this[_0x23f3('0x26')](util[_0x23f3('0x2a')](_0x23f3('0x3d'),_0x3e9d42,_0x31c21d));};AGIChannel[_0x23f3('0x25')][_0x23f3('0x3e')]=function(_0x3ff53d,_0x368cc7,_0x29ebb3){_0x368cc7=_0x368cc7||this['extension'];_0x29ebb3=_0x29ebb3||0x1;this[_0x23f3('0x2f')](_0x3ff53d);this['setExtension'](_0x368cc7);this[_0x23f3('0x3f')](_0x29ebb3);return this[_0x23f3('0x2b')](util['format'](_0x23f3('0x40'),_0x3ff53d,_0x368cc7,_0x29ebb3));};AGIChannel[_0x23f3('0x25')]['getVariable']=function(_0x3c683f){return this['sendRequest'](util[_0x23f3('0x2a')](_0x23f3('0x41'),_0x3c683f));};AGIChannel['prototype']['recordFile']=function(_0x226398,_0x395f54,_0x38251f,_0x5632b1,_0x10364a,_0x30d7e0){_0x395f54=_0x395f54||_0x23f3('0x42');_0x38251f=_0x38251f||'';_0x5632b1=_0x5632b1===undefined?-0x1:_0x5632b1==='-1'?-0x1:_0x5632b1*0x3e8;_0x10364a=_0x10364a===undefined?'':'s='+_0x10364a;_0x30d7e0=_0x30d7e0?_0x23f3('0x43'):'';return this[_0x23f3('0x26')](util[_0x23f3('0x2a')](_0x23f3('0x44'),_0x226398,_0x395f54,_0x38251f,_0x5632b1,_0x30d7e0,_0x10364a));};AGIChannel[_0x23f3('0x25')][_0x23f3('0x45')]=function(_0x1f36ef,_0x18607a){_0x18607a=_0x18607a||'';return this[_0x23f3('0x26')](util[_0x23f3('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x1f36ef,_0x18607a));};AGIChannel[_0x23f3('0x25')]['agi']=function(_0x2a1d94){return this['exec']('AGI',_0x2a1d94);};AGIChannel[_0x23f3('0x25')][_0x23f3('0x46')]=function(_0xf65de){return this[_0x23f3('0x47')](_0x23f3('0x48'),_0xf65de);};AGIChannel[_0x23f3('0x25')][_0x23f3('0x1a')]=function(_0x5e75de,_0x30ba60){this[_0x23f3('0x2b')](util[_0x23f3('0x2a')](_0x23f3('0x49'),_0x5e75de['id'],_0x5e75de[_0x23f3('0x4a')],_0x30ba60));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x23f3('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ba6c468..89960cf 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 _0xb0e7=['apply','message','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x53c04d,_0x2474f9){var _0x3adc2a=function(_0x397923){while(--_0x397923){_0x53c04d['push'](_0x53c04d['shift']());}};_0x3adc2a(++_0x2474f9);}(_0xb0e7,0xa3));var _0x7b0e=function(_0x72eb8d,_0x357eae){_0x72eb8d=_0x72eb8d-0x0;var _0x2c1e84=_0xb0e7[_0x72eb8d];return _0x2c1e84;};'use strict';var util=require(_0x7b0e('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x7b0e('0x1'),'E_AGI_SERVER_ERROR':_0x7b0e('0x2'),'E_AGI_SERVER_CLOSE':_0x7b0e('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x7b0e('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x7b0e('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x7b0e('0x6'),'E_AGI_COMMAND_EMPTY':_0x7b0e('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7b0e('0x8'),'E_AGI_IVR_ENTRY':_0x7b0e('0x9')};function AGIError(_0x51336a){var _0x51336a=_0x51336a||null,_0x1babaf=_0x1babaf||[],_0x43edc2=0x1,_0x23a3e9='';if(!error[_0x51336a]){_0x51336a=_0x7b0e('0xa');}_0x1babaf[_0x7b0e('0xb')](error[_0x51336a]);while(arguments[_0x43edc2]){_0x1babaf[_0x7b0e('0xb')](arguments[_0x43edc2]);_0x43edc2++;}_0x23a3e9=util[_0x7b0e('0xc')][_0x7b0e('0xd')](util,_0x1babaf);this[_0x7b0e('0xe')]=_0x23a3e9;this['name']=_0x51336a;}module[_0x7b0e('0xf')]=AGIError; \ No newline at end of file +var _0xc2fe=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','name','exports'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xc2fe,0xa2));var _0xec2f=function(_0x5c2bf2,_0x539cbf){_0x5c2bf2=_0x5c2bf2-0x0;var _0x3300dd=_0xc2fe[_0x5c2bf2];return _0x3300dd;};'use strict';var util=require(_0xec2f('0x0'));var error={'E_AGI_UNDEFINED':_0xec2f('0x1'),'E_AGI_ARGUMENT_PORT':_0xec2f('0x2'),'E_AGI_SERVER_ERROR':_0xec2f('0x3'),'E_AGI_SERVER_CLOSE':_0xec2f('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xec2f('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xec2f('0x6'),'E_AGI_SOCKET_ERROR':_0xec2f('0x7'),'E_AGI_SOCKET_CLOSE':_0xec2f('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xec2f('0x9'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xec2f('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x4593d4){var _0x4593d4=_0x4593d4||null,_0x1dcfbb=_0x1dcfbb||[],_0x2aecc1=0x1,_0x4b142f='';if(!error[_0x4593d4]){_0x4593d4=_0xec2f('0xb');}_0x1dcfbb[_0xec2f('0xc')](error[_0x4593d4]);while(arguments[_0x2aecc1]){_0x1dcfbb[_0xec2f('0xc')](arguments[_0x2aecc1]);_0x2aecc1++;}_0x4b142f=util[_0xec2f('0xd')][_0xec2f('0xe')](util,_0x1dcfbb);this[_0xec2f('0xf')]=_0x4b142f;this[_0xec2f('0x10')]=_0x4593d4;}module[_0xec2f('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index c8a774d..7c332d7 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 _0x8a2a=['ioredis','./error','../../config/environment','redis','defaults','localhost','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','events','EventEmitter'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8a2a,0x1ea));var _0xa8a2=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0x8a2a[_0x31a938];return _0x1bf341;};'use strict';var _=require(_0xa8a2('0x0'));var EventEmitter=require(_0xa8a2('0x1'))[_0xa8a2('0x2')];var Redis=require(_0xa8a2('0x3'));var AGIError=require(_0xa8a2('0x4'));var config=require(_0xa8a2('0x5'));config[_0xa8a2('0x6')]=_[_0xa8a2('0x7')](config[_0xa8a2('0x6')],{'host':_0xa8a2('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xa8a2('0x6')]);sub['subscribe'](_0xa8a2('0x9'),function(_0x4971fd){if(_0x4971fd)return eventEmitter[_0xa8a2('0xa')](_0xa8a2('0xb'),new AGIError(_0xa8a2('0xc'),_0x4971fd));});sub['on'](_0xa8a2('0xd'),function(_0x192815,_0x1c1be3){if(_0x192815!=='agi')return;try{var _0x1af045=JSON[_0xa8a2('0xe')](_0x1c1be3);eventEmitter[_0xa8a2('0xa')](_0xa8a2('0xf'),_0x1af045);}catch(_0x1897be){eventEmitter[_0xa8a2('0xa')](_0xa8a2('0xb'),new AGIError(_0xa8a2('0xc'),_0x1897be));}});module[_0xa8a2('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x3478=['projectUpdate','E_AGI_SERVER_ERROR','events','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','message','parse'];(function(_0xa8f7f7,_0x10f3f5){var _0x5e5be3=function(_0x5730ab){while(--_0x5730ab){_0xa8f7f7['push'](_0xa8f7f7['shift']());}};_0x5e5be3(++_0x10f3f5);}(_0x3478,0xe3));var _0x8347=function(_0x4d77b8,_0x208e64){_0x4d77b8=_0x4d77b8-0x0;var _0x82da62=_0x3478[_0x4d77b8];return _0x82da62;};'use strict';var _=require('lodash');var EventEmitter=require(_0x8347('0x0'))['EventEmitter'];var Redis=require(_0x8347('0x1'));var AGIError=require(_0x8347('0x2'));var config=require(_0x8347('0x3'));config[_0x8347('0x4')]=_[_0x8347('0x5')](config['redis'],{'host':_0x8347('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x8347('0x4')]);sub[_0x8347('0x7')](_0x8347('0x8'),function(_0x4e4be6){if(_0x4e4be6)return eventEmitter[_0x8347('0x9')](_0x8347('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x4e4be6));});sub['on'](_0x8347('0xb'),function(_0xfe8b6c,_0xf93eb9){if(_0xfe8b6c!==_0x8347('0x8'))return;try{var _0x3f9e73=JSON[_0x8347('0xc')](_0xf93eb9);eventEmitter['emit'](_0x8347('0xd'),_0x3f9e73);}catch(_0x359524){eventEmitter[_0x8347('0x9')]('error',new AGIError(_0x8347('0xe'),_0x359524));}});module['exports']={'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 7ba5709..63ec959 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 _0x6f14=['max\x20retry\x20reach','exports','../../../config/logger','menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','numberOfEdges','size','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes'];(function(_0x45fd39,_0x3496e6){var _0x553037=function(_0x28ab4a){while(--_0x28ab4a){_0x45fd39['push'](_0x45fd39['shift']());}};_0x553037(++_0x3496e6);}(_0x6f14,0x8e));var _0x46f1=function(_0x55336a,_0x240d59){_0x55336a=_0x55336a-0x0;var _0x28ceb3=_0x6f14[_0x55336a];return _0x28ceb3;};'use strict';var _=require('lodash');var logger=require(_0x46f1('0x0'))('agi');var verticesWithRetry=[_0x46f1('0x1'),_0x46f1('0x2'),_0x46f1('0x3')];var Graph=function(){this[_0x46f1('0x4')]={};this[_0x46f1('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x46f1('0x6')][_0x46f1('0x7')]=function(_0x2a926a){this[_0x46f1('0x4')][_0x2a926a['id']]=_0x2a926a;this[_0x46f1('0x5')][_0x2a926a['id']]=[];};Graph[_0x46f1('0x6')]['addEdge']=function(_0x3c0d5a,_0x4c56b0,_0x17111b){this[_0x46f1('0x5')][_0x3c0d5a]['push']({'target':_0x4c56b0,'condition':_0x17111b});this[_0x46f1('0x8')]+=0x1;};Graph[_0x46f1('0x6')]['size']=function(){return _[_0x46f1('0x9')](this[_0x46f1('0x4')]);};Graph[_0x46f1('0x6')][_0x46f1('0xa')]=function(){return this[_0x46f1('0x8')];};Graph[_0x46f1('0x6')][_0x46f1('0xb')]=function(_0x439be3){return this['vertices'][_0x439be3];};Graph[_0x46f1('0x6')]['traverseBFS']=function(_0x134875,_0x31fb1a){if(!this[_0x46f1('0x4')][_0x134875]){return logger[_0x46f1('0xc')](_0x46f1('0xd'));}var _0x323a2a=_0x31fb1a(this[_0x46f1('0x4')][_0x134875]);if(!_0x323a2a){return logger[_0x46f1('0xc')](_0x46f1('0xe'));}if(this[_0x46f1('0x5')][_0x134875]['length']===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0xfe787a=0x0,_0x4bfa36=[],_0x20a890=![];_0xfe787a\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','catch','hasOwnProperty','substring','debug','variables','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','lodash','util','../../config/logger','../../config/license/util','./rpc','./events','EventEmitter','agi','127.0.0.1','projectUpdate','error','deleted','splice','push','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[%s]\x20%s','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid'];(function(_0x54e703,_0x271fc3){var _0x6576bc=function(_0xabab37){while(--_0xabab37){_0x54e703['push'](_0x54e703['shift']());}};_0x6576bc(++_0x271fc3);}(_0x4087,0xf3));var _0x7408=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4087[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7408('0x0'));var syncho=require('syncho');var util=require(_0x7408('0x1'));var config=require('../../config/environment');var logger=require(_0x7408('0x2'))('agi');var utilLicense=require(_0x7408('0x3'));var rpc=require(_0x7408('0x4'));var Project=require('./project');var AGIEmitter=require(_0x7408('0x5'))[_0x7408('0x6')];var projects=[];config[_0x7408('0x7')]=_['defaults'](config[_0x7408('0x7')],{'ip':_0x7408('0x8'),'port':0x11dd});AGIEmitter['on'](_0x7408('0x9'),projectUpdateHandler);function connectionHandler(_0x34821d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x34821d);agiHandler(_0x34821d);}catch(_0x4f1167){logger[_0x7408('0xa')](_0x4f1167['stack']);}});});}function projectUpdateHandler(_0x4dcb03){try{var _0x16f4ca=_['findIndex'](projects,['id',_0x4dcb03['id']]);if(_0x16f4ca>-0x1){if(_0x4dcb03[_0x7408('0xb')]===!![]){projects[_0x7408('0xc')](_0x16f4ca,0x1);}else{projects[_0x16f4ca]=_0x4dcb03;}}else{projects[_0x7408('0xd')](_0x4dcb03);}}catch(_0x1874d1){logger[_0x7408('0xa')](_0x1874d1[_0x7408('0xe')]);}}function listeningHandler(){console['log'](_0x7408('0xf'),config[_0x7408('0x7')][_0x7408('0x10')]);logger[_0x7408('0x11')](util[_0x7408('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x7408('0x7')]['ip'],config[_0x7408('0x7')]['port']));}function errorHandler(_0x43dc91){if(_0x43dc91&&_0x43dc91['name']&&_0x43dc91['message']){logger[_0x7408('0xa')](util['format'](_0x7408('0x13'),_0x43dc91[_0x7408('0x14')],_0x43dc91['message']));}else{logger[_0x7408('0xa')](util[_0x7408('0x12')](_0x7408('0x15'),_0x43dc91[_0x7408('0xe')]));}}function closeHandler(){logger[_0x7408('0x11')](util[_0x7408('0x12')](_0x7408('0x16'),this['arg_1'],this[_0x7408('0x17')],this[_0x7408('0x18')],this[_0x7408('0x19')],this[_0x7408('0x1a')]));try{createSquareReport(this);}catch(_0x141ca5){logger[_0x7408('0xa')](_0x141ca5[_0x7408('0xe')]);}}function timeoutHandler(){logger['info'](util[_0x7408('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7408('0x1b')],this['calleridname'],this['callerid'],this[_0x7408('0x19')],this[_0x7408('0x1a')]));}function hangupHandler(){logger[_0x7408('0x11')](util[_0x7408('0x12')](_0x7408('0x1c'),this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x28c530,_0x457e5e){rpc[_0x7408('0x1d')](_0x28c530)[_0x7408('0x1e')](function(_0x200d12){if(_0x457e5e){_0x457e5e(null,_0x200d12);}})[_0x7408('0x1f')](function(_0x18889d){if(_0x457e5e){_0x457e5e(null,_0x18889d);}});}function setChannelVariables(_0x2fc480){for(var _0x545de9 in _0x2fc480){if(_0x2fc480[_0x7408('0x20')](_0x545de9)){if(_0x545de9['indexOf']('agi_')===0x0){_0x2fc480[_0x545de9[_0x7408('0x21')](0x4)]=_0x2fc480[_0x545de9];delete _0x2fc480[_0x545de9];}}}}function agiHandler(_0x29fa9b){logger[_0x7408('0x22')](_0x7408('0x23'),JSON['stringify'](_0x29fa9b,null,0x2));logger[_0x7408('0x11')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x29fa9b[_0x7408('0x1b')],_0x29fa9b[_0x7408('0x17')],_0x29fa9b[_0x7408('0x18')],_0x29fa9b[_0x7408('0x19')],_0x29fa9b[_0x7408('0x1a')]));_0x29fa9b['on'](_0x7408('0xa'),errorHandler);_0x29fa9b['on'](_0x7408('0x24'),closeHandler);_0x29fa9b['on'](_0x7408('0x25'),timeoutHandler);_0x29fa9b['evtHangup']=![];_0x29fa9b['on'](_0x7408('0x26'),hangupHandler);var _0x4aa5b5=_[_0x7408('0x27')](projects,[_0x7408('0x14'),_0x29fa9b[_0x7408('0x1b')]]);if(!_0x4aa5b5)return Project[_0x7408('0x28')](_0x29fa9b);if(!_0x4aa5b5[_0x7408('0x29')])return Project[_0x7408('0x2a')](_0x29fa9b);return Project[_0x7408('0x2b')](_0x4aa5b5,_0x29fa9b);}function main(){var _0x484875;return utilLicense[_0x7408('0x2c')]()[_0x7408('0x1e')](function(_0x5473c7){if(!_0x5473c7)return;if(_0x5473c7[_0x7408('0x2d')]){if(_0x5473c7[_0x7408('0x2e')]&&_0x5473c7[_0x7408('0x2e')]>0x0){logger['info'](util[_0x7408('0x12')](_0x7408('0x2f'),_0x5473c7[_0x7408('0x2e')]));_0x484875=_0x5473c7[_0x7408('0x2e')];}else{logger[_0x7408('0x11')](_0x7408('0x30'));}}else{logger[_0x7408('0x11')](_0x7408('0x31'));_0x484875=-0x1;}})[_0x7408('0x1e')](function(){return Project[_0x7408('0x32')]();})[_0x7408('0x1e')](function(_0x261f59){projects=_0x261f59;return;})[_0x7408('0x1f')](function(_0x8c0cea){logger['error'](_0x7408('0x33'),_0x8c0cea[_0x7408('0xe')]);})[_0x7408('0x34')](function(){var _0x573209=require('./server')(config[_0x7408('0x7')][_0x7408('0x10')],config[_0x7408('0x7')]['ip'],_0x484875);_0x573209['on']('error',errorHandler);_0x573209['on'](_0x7408('0x35'),listeningHandler);_0x573209['on']('connection',connectionHandler);_0x573209['on'](_0x7408('0x24'),closeHandler);});}main(); \ No newline at end of file +var _0x1e19=['../../config/environment','agi','../../config/license/util','./rpc','./project','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','stack','findIndex','splice','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','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','indexOf','agi_','substring','variables','stringify','close','timeout','hangup','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','port','listening','connection','lodash'];(function(_0x466e89,_0x237ae3){var _0x580986=function(_0x1ca46d){while(--_0x1ca46d){_0x466e89['push'](_0x466e89['shift']());}};_0x580986(++_0x237ae3);}(_0x1e19,0xa4));var _0x91e1=function(_0x169591,_0x94ab12){_0x169591=_0x169591-0x0;var _0x2cb673=_0x1e19[_0x169591];return _0x2cb673;};'use strict';var _=require(_0x91e1('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0x91e1('0x1'));var logger=require('../../config/logger')(_0x91e1('0x2'));var utilLicense=require(_0x91e1('0x3'));var rpc=require(_0x91e1('0x4'));var Project=require(_0x91e1('0x5'));var AGIEmitter=require('./events')[_0x91e1('0x6')];var projects=[];config[_0x91e1('0x2')]=_[_0x91e1('0x7')](config[_0x91e1('0x2')],{'ip':_0x91e1('0x8'),'port':0x11dd});AGIEmitter['on'](_0x91e1('0x9'),projectUpdateHandler);function connectionHandler(_0x4452a7){process[_0x91e1('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4452a7);agiHandler(_0x4452a7);}catch(_0x19e56b){logger['error'](_0x19e56b[_0x91e1('0xb')]);}});});}function projectUpdateHandler(_0xfb6ab5){try{var _0x5f7f05=_[_0x91e1('0xc')](projects,['id',_0xfb6ab5['id']]);if(_0x5f7f05>-0x1){if(_0xfb6ab5['deleted']===!![]){projects[_0x91e1('0xd')](_0x5f7f05,0x1);}else{projects[_0x5f7f05]=_0xfb6ab5;}}else{projects['push'](_0xfb6ab5);}}catch(_0x324e95){logger[_0x91e1('0xe')](_0x324e95[_0x91e1('0xb')]);}}function listeningHandler(){console[_0x91e1('0xf')](_0x91e1('0x10'),config[_0x91e1('0x2')]['port']);logger['info'](util[_0x91e1('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x91e1('0x2')]['ip'],config[_0x91e1('0x2')]['port']));}function errorHandler(_0x79029a){if(_0x79029a&&_0x79029a[_0x91e1('0x12')]&&_0x79029a[_0x91e1('0x13')]){logger[_0x91e1('0xe')](util[_0x91e1('0x11')]('[%s]\x20%s',_0x79029a[_0x91e1('0x12')],_0x79029a[_0x91e1('0x13')]));}else{logger['error'](util[_0x91e1('0x11')](_0x91e1('0x14'),_0x79029a[_0x91e1('0xb')]));}}function closeHandler(){logger['info'](util[_0x91e1('0x11')](_0x91e1('0x15'),this[_0x91e1('0x16')],this[_0x91e1('0x17')],this[_0x91e1('0x18')],this['dnid'],this[_0x91e1('0x19')]));try{createSquareReport(this);}catch(_0x572239){logger[_0x91e1('0xe')](_0x572239['stack']);}}function timeoutHandler(){logger[_0x91e1('0x1a')](util['format'](_0x91e1('0x1b'),this[_0x91e1('0x16')],this[_0x91e1('0x17')],this['callerid'],this[_0x91e1('0x1c')],this[_0x91e1('0x19')]));}function hangupHandler(){logger[_0x91e1('0x1a')](util[_0x91e1('0x11')](_0x91e1('0x1d'),this['arg_1'],this['calleridname'],this[_0x91e1('0x18')],this[_0x91e1('0x1c')],this[_0x91e1('0x19')]));this[_0x91e1('0x1e')]=!![];}function createSquareReport(_0x4cb0b1,_0x24a85a){rpc[_0x91e1('0x1f')](_0x4cb0b1)[_0x91e1('0x20')](function(_0x54eee3){if(_0x24a85a){_0x24a85a(null,_0x54eee3);}})[_0x91e1('0x21')](function(_0x86b008){if(_0x24a85a){_0x24a85a(null,_0x86b008);}});}function setChannelVariables(_0x53ded9){for(var _0x425ba4 in _0x53ded9){if(_0x53ded9[_0x91e1('0x22')](_0x425ba4)){if(_0x425ba4[_0x91e1('0x23')](_0x91e1('0x24'))===0x0){_0x53ded9[_0x425ba4[_0x91e1('0x25')](0x4)]=_0x53ded9[_0x425ba4];delete _0x53ded9[_0x425ba4];}}}}function agiHandler(_0x3204a8){logger['debug'](_0x91e1('0x26'),JSON[_0x91e1('0x27')](_0x3204a8,null,0x2));logger['info'](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3204a8['arg_1'],_0x3204a8[_0x91e1('0x17')],_0x3204a8[_0x91e1('0x18')],_0x3204a8[_0x91e1('0x1c')],_0x3204a8['uniqueid']));_0x3204a8['on'](_0x91e1('0xe'),errorHandler);_0x3204a8['on'](_0x91e1('0x28'),closeHandler);_0x3204a8['on'](_0x91e1('0x29'),timeoutHandler);_0x3204a8[_0x91e1('0x1e')]=![];_0x3204a8['on'](_0x91e1('0x2a'),hangupHandler);var _0xe51a1b=_['find'](projects,[_0x91e1('0x12'),_0x3204a8[_0x91e1('0x16')]]);if(!_0xe51a1b)return Project[_0x91e1('0x2b')](_0x3204a8);if(!_0xe51a1b[_0x91e1('0x2c')])return Project['handleUnpublished'](_0x3204a8);return Project[_0x91e1('0x2d')](_0xe51a1b,_0x3204a8);}function main(){var _0x850ecc;return utilLicense[_0x91e1('0x2e')]()[_0x91e1('0x20')](function(_0x3d195a){if(!_0x3d195a)return;if(_0x3d195a[_0x91e1('0x2f')]){if(_0x3d195a[_0x91e1('0x30')]&&_0x3d195a[_0x91e1('0x30')]>0x0){logger[_0x91e1('0x1a')](util['format'](_0x91e1('0x31'),_0x3d195a[_0x91e1('0x30')]));_0x850ecc=_0x3d195a[_0x91e1('0x30')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x91e1('0x1a')](_0x91e1('0x32'));_0x850ecc=-0x1;}})['then'](function(){return Project['getAll']();})[_0x91e1('0x20')](function(_0x33d167){projects=_0x33d167;return;})[_0x91e1('0x21')](function(_0x43559f){logger[_0x91e1('0xe')]('[LICENSE]',_0x43559f[_0x91e1('0xb')]);})['finally'](function(){var _0x28dda0=require(_0x91e1('0x33'))(config['agi'][_0x91e1('0x34')],config[_0x91e1('0x2')]['ip'],_0x850ecc);_0x28dda0['on'](_0x91e1('0xe'),errorHandler);_0x28dda0['on'](_0x91e1('0x35'),listeningHandler);_0x28dda0['on'](_0x91e1('0x36'),connectionHandler);_0x28dda0['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 13407e9..19d03ce 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 _0x7889=['bluebird','jayson/promise','client','http','request','then','error','sendMailMessage'];(function(_0x390a06,_0x33a232){var _0x57e0c6=function(_0x19c504){while(--_0x19c504){_0x390a06['push'](_0x390a06['shift']());}};_0x57e0c6(++_0x33a232);}(_0x7889,0x88));var _0x9788=function(_0x5dd692,_0x4ffa0a){_0x5dd692=_0x5dd692-0x0;var _0x2ebc69=_0x7889[_0x5dd692];return _0x2ebc69;};'use strict';var BPromise=require(_0x9788('0x0'));var jayson=require(_0x9788('0x1'));var client=jayson[_0x9788('0x2')][_0x9788('0x3')]({'port':0x232b});function request(_0x11e805,_0x93a8ed){return new BPromise(function(_0x48a9de,_0x3e516e){return client[_0x9788('0x4')](_0x11e805,_0x93a8ed)[_0x9788('0x5')](function(_0x1a6cbe){if(_0x1a6cbe[_0x9788('0x6')]){return _0x3e516e(_0x1a6cbe[_0x9788('0x6')]['message']);}else{return _0x48a9de(_0x1a6cbe['result']);}})['catch'](function(_0x21981b){return _0x3e516e(_0x21981b);});});}exports[_0x9788('0x7')]=function(_0x5661ad,_0x568ca5){return request('SendMail',{'account':_0x5661ad,'message':_0x568ca5});}; \ No newline at end of file +var _0x1e0f=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','request','error','message','result'];(function(_0x199575,_0x2a864c){var _0x450415=function(_0x2c40c6){while(--_0x2c40c6){_0x199575['push'](_0x199575['shift']());}};_0x450415(++_0x2a864c);}(_0x1e0f,0xf6));var _0xf1e0=function(_0x512b44,_0x5dab05){_0x512b44=_0x512b44-0x0;var _0x356161=_0x1e0f[_0x512b44];return _0x356161;};'use strict';var BPromise=require(_0xf1e0('0x0'));var jayson=require(_0xf1e0('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x482ae7,_0x105d7d){return new BPromise(function(_0x2ff887,_0x26c7ea){return client[_0xf1e0('0x2')](_0x482ae7,_0x105d7d)['then'](function(_0xf5079b){if(_0xf5079b[_0xf1e0('0x3')]){return _0x26c7ea(_0xf5079b[_0xf1e0('0x3')][_0xf1e0('0x4')]);}else{return _0x2ff887(_0xf5079b[_0xf1e0('0x5')]);}})[_0xf1e0('0x6')](function(_0x2a2987){return _0x26c7ea(_0x2a2987);});});}exports[_0xf1e0('0x7')]=function(_0xe02677,_0x3ba664){return request(_0xf1e0('0x8'),{'account':_0xe02677,'message':_0x3ba664});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index e247abe..ba581ab 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 _0x64ae=['calleridname','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','exports','lodash','moment','xml2json','util','../../config/logger','agi','./graph','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','maxRetry','retry','addVertex','mxCell','isArray','length','source','target','value','toJson','mxGraphModel','root','inspect','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','traverseBFS','start','clear','debug','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x4ec4c6,_0xee1082){var _0x25c91d=function(_0xdfd764){while(--_0xdfd764){_0x4ec4c6['push'](_0x4ec4c6['shift']());}};_0x25c91d(++_0xee1082);}(_0x64ae,0x87));var _0xe64a=function(_0x5a0826,_0x1d3677){_0x5a0826=_0x5a0826-0x0;var _0x2912d3=_0x64ae[_0x5a0826];return _0x2912d3;};'use strict';var _=require(_0xe64a('0x0'));var moment=require(_0xe64a('0x1'));var parser=require(_0xe64a('0x2'));var util=require(_0xe64a('0x3'));var logger=require(_0xe64a('0x4'))(_0xe64a('0x5'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xe64a('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe64a('0x7')]()['catch'](function(_0x1db2a3){logger[_0xe64a('0x8')](_0xe64a('0x9'),_0x1db2a3['stack']);return[];});}function addVertex(_0xa714e9,_0x2fc630,_0xf03f7){_0x2fc630[_0xe64a('0xa')]=_0xf03f7;if(_0x2fc630[_0xe64a('0xb')]('retry')){_0x2fc630[_0xe64a('0xc')]=parseInt(_0x2fc630[_0xe64a('0xd')],0xa);}_0xa714e9[_0xe64a('0xe')](_['omit'](_0x2fc630,_0xe64a('0xf')));}function initGraph(_0x54dc18,_0x4527a7){var _0x47060c=new Graph();for(var _0xcab766 in _0x54dc18){if(_0x54dc18[_0xe64a('0xb')](_0xcab766)){if(_[_0xe64a('0x10')](_0x54dc18[_0xcab766])){for(var _0x1b4086=0x0;_0x1b4086<_0x54dc18[_0xcab766][_0xe64a('0x11')];_0x1b4086+=0x1){addVertex(_0x47060c,_0x54dc18[_0xcab766][_0x1b4086],_0xcab766);}}else{addVertex(_0x47060c,_0x54dc18[_0xcab766],_0xcab766);}}}for(var _0x5b4810=0x0;_0x5b4810<_0x4527a7[_0xe64a('0x11')];_0x5b4810+=0x1){if(_0x4527a7[_0x5b4810][_0xe64a('0x12')]&&_0x4527a7[_0x5b4810]['target']){_0x47060c['addEdge'](_0x4527a7[_0x5b4810][_0xe64a('0x12')],_0x4527a7[_0x5b4810][_0xe64a('0x13')],_0x4527a7[_0x5b4810][_0xe64a('0x14')]);}}return _0x47060c;}function getRoot(_0x5aa52b){return parser[_0xe64a('0x15')](_0x5aa52b,{'object':!![]})[_0xe64a('0x16')][_0xe64a('0x17')];}function inspect(_0x4fba68){return util[_0xe64a('0x18')](_0x4fba68,{'showHidden':![],'depth':null});}function initialize(_0x58ea1f,_0x2d891b){var _0x2074b8=getRoot(_0x58ea1f['production']);if(!_0x2074b8||!_0x2074b8['start'])return;var _0x16976f,_0x50cc82,_0x584945;logger['debug'](_0xe64a('0x17'),JSON[_0xe64a('0x19')](_0x2074b8,null,0x2));_0x2d891b[_0xe64a('0x1a')]=moment()[_0xe64a('0x1b')](_0xe64a('0x1c'));_0x16976f=initGraph(_[_0xe64a('0x1d')](_0x2074b8,'mxCell'),_0x2074b8['mxCell']);_0x50cc82=new Vertices(_0x2d891b,rpc,mailRpc);logger[_0xe64a('0x1e')](util['format'](_0xe64a('0x1f'),_0x2d891b[_0xe64a('0x20')],_0x2d891b['calleridname'],_0x2d891b[_0xe64a('0x21')],_0x2d891b[_0xe64a('0x22')],_0x2d891b['uniqueid']));_0x16976f[_0xe64a('0x23')](_0x2074b8[_0xe64a('0x24')]['id'],function(_0x13c1c7){try{_0x13c1c7=_0x50cc82[_0xe64a('0x25')](_0x13c1c7);logger[_0xe64a('0x26')](_0xe64a('0x27'),JSON[_0xe64a('0x19')](_0x13c1c7,null,0x2));if(_0x13c1c7[_0xe64a('0xa')]==='gotoc'){logger[_0xe64a('0x1e')](_0xe64a('0x28'));_0x2d891b['context']=_0x13c1c7[_0xe64a('0x29')]||_0x2d891b[_0xe64a('0x29')];_0x2d891b[_0xe64a('0x2a')]=_0x13c1c7[_0xe64a('0x2a')];_0x2d891b[_0xe64a('0x2b')]=_0x13c1c7[_0xe64a('0x2b')]?_0x13c1c7[_0xe64a('0x2b')]-0x1:0x1;return null;}else if(_0x13c1c7&&_0x50cc82[_0x13c1c7['agicommand']]){_0x584945=_0x50cc82[_0x13c1c7[_0xe64a('0xa')]](_0x13c1c7);logger[_0xe64a('0x1e')]('response',JSON['stringify'](_0x584945,null,0x2));if(_0x584945&&_0x584945[_0xe64a('0x2c')]===AGI_CODE_SUCCESS&&_0x584945[_0xe64a('0x2d')]!==AGI_RESULT_ERROR&&!_0x2d891b[_0xe64a('0x2e')]){logger[_0xe64a('0x26')](_0xe64a('0x2f'),inspect(_0x584945));return _[_0xe64a('0x30')](_0x584945[_0xe64a('0x2d')])?null:_0x584945[_0xe64a('0x2d')][_0xe64a('0x31')]();}else{logger['error'](_0xe64a('0x2f'),inspect(_0x584945));return null;}}else{logger[_0xe64a('0x8')](_0xe64a('0x32'));return null;}}catch(_0x225f93){logger[_0xe64a('0x8')](_0x225f93[_0xe64a('0x33')]);return null;}});if(_0x2074b8[_0xe64a('0x34')]){logger[_0xe64a('0x1e')](util[_0xe64a('0x1b')](_0xe64a('0x35'),_0x2d891b['arg_1'],_0x2d891b[_0xe64a('0x36')],_0x2d891b[_0xe64a('0x21')],_0x2d891b['dnid'],_0x2d891b[_0xe64a('0x37')]));_0x16976f[_0xe64a('0x23')](_0x2074b8[_0xe64a('0x34')]['id'],function(_0x453b74){try{_0x453b74=_0x50cc82[_0xe64a('0x25')](_0x453b74);logger['debug'](_0xe64a('0x27'),JSON[_0xe64a('0x19')](_0x453b74,null,0x2));if(_0x453b74&&_0x50cc82[_0x453b74['agicommand']]){_0x584945=_0x50cc82[_0x453b74['agicommand']](_0x453b74);if(_0x584945){logger[_0xe64a('0x26')]('response',inspect(_0x584945));return _['isUndefined'](_0x584945[_0xe64a('0x2d')])?null:_0x584945[_0xe64a('0x2d')][_0xe64a('0x31')]();}else{logger['error'](_0xe64a('0x2f'),inspect(_0x584945));return null;}}else{logger[_0xe64a('0x8')](_0xe64a('0x32'));return null;}}catch(_0x559a6d){logger[_0xe64a('0x8')](_0x559a6d[_0xe64a('0x33')]);return null;}});}logger[_0xe64a('0x1e')](util[_0xe64a('0x1b')](_0xe64a('0x38'),_0x2d891b[_0xe64a('0x20')],_0x2d891b[_0xe64a('0x36')],_0x2d891b['callerid'],_0x2d891b[_0xe64a('0x22')],_0x2d891b[_0xe64a('0x37')]));logger[_0xe64a('0x1e')](util[_0xe64a('0x1b')](_0xe64a('0x39'),_0x2d891b[_0xe64a('0x29')],_0x2d891b['extension'],parseInt(_0x2d891b[_0xe64a('0x2b')],0xa)+0x1));_0x2d891b[_0xe64a('0x3a')](_0x2d891b[_0xe64a('0x29')],_0x2d891b[_0xe64a('0x2a')],parseInt(_0x2d891b[_0xe64a('0x2b')],0xa)+0x1);_0x2d891b[_0xe64a('0x3b')]();}function handleNotFound(_0x388c1c){logger[_0xe64a('0x8')](util[_0xe64a('0x1b')](_0xe64a('0x3c'),_0x388c1c[_0xe64a('0x20')]));_0x388c1c['continueAt'](_0x388c1c[_0xe64a('0x29')],_0x388c1c['extension'],parseInt(_0x388c1c[_0xe64a('0x2b')],0xa)+0x1);_0x388c1c['close']();}function handleUnpublished(_0x2a71e6){logger[_0xe64a('0x8')](util[_0xe64a('0x1b')](_0xe64a('0x3d'),_0x2a71e6[_0xe64a('0x20')]));_0x2a71e6[_0xe64a('0x3a')](_0x2a71e6[_0xe64a('0x29')],_0x2a71e6[_0xe64a('0x2a')],parseInt(_0x2a71e6[_0xe64a('0x2b')],0xa)+0x1);_0x2a71e6[_0xe64a('0x3b')]();}module[_0xe64a('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xa6a8=['clear','[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','extension','Project\x20%s\x20not\x20found','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','production','start','debug','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','arg_1','calleridname','callerid','uniqueid','traverseBFS','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','evtHangup','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0xa6a8,0x101));var _0x8a6a=function(_0xe77e80,_0x40bb60){_0xe77e80=_0xe77e80-0x0;var _0x56cf8b=_0xa6a8[_0xe77e80];return _0x56cf8b;};'use strict';var _=require(_0x8a6a('0x0'));var moment=require(_0x8a6a('0x1'));var parser=require('xml2json');var util=require(_0x8a6a('0x2'));var logger=require(_0x8a6a('0x3'))(_0x8a6a('0x4'));var rpc=require(_0x8a6a('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x8a6a('0x6'));var Vertices=require(_0x8a6a('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x8a6a('0x8')]()['catch'](function(_0x32c642){logger[_0x8a6a('0x9')](_0x8a6a('0xa'),_0x32c642[_0x8a6a('0xb')]);return[];});}function addVertex(_0xe68605,_0x2a9cc8,_0x47e4e2){_0x2a9cc8[_0x8a6a('0xc')]=_0x47e4e2;if(_0x2a9cc8[_0x8a6a('0xd')](_0x8a6a('0xe'))){_0x2a9cc8[_0x8a6a('0xf')]=parseInt(_0x2a9cc8[_0x8a6a('0xe')],0xa);}_0xe68605['addVertex'](_['omit'](_0x2a9cc8,'mxCell'));}function initGraph(_0x24fc54,_0x5f31fc){var _0x17f0d4=new Graph();for(var _0x3e3b3a in _0x24fc54){if(_0x24fc54[_0x8a6a('0xd')](_0x3e3b3a)){if(_[_0x8a6a('0x10')](_0x24fc54[_0x3e3b3a])){for(var _0x3d5275=0x0;_0x3d5275<_0x24fc54[_0x3e3b3a][_0x8a6a('0x11')];_0x3d5275+=0x1){addVertex(_0x17f0d4,_0x24fc54[_0x3e3b3a][_0x3d5275],_0x3e3b3a);}}else{addVertex(_0x17f0d4,_0x24fc54[_0x3e3b3a],_0x3e3b3a);}}}for(var _0x59d1db=0x0;_0x59d1db<_0x5f31fc[_0x8a6a('0x11')];_0x59d1db+=0x1){if(_0x5f31fc[_0x59d1db][_0x8a6a('0x12')]&&_0x5f31fc[_0x59d1db][_0x8a6a('0x13')]){_0x17f0d4[_0x8a6a('0x14')](_0x5f31fc[_0x59d1db]['source'],_0x5f31fc[_0x59d1db][_0x8a6a('0x13')],_0x5f31fc[_0x59d1db][_0x8a6a('0x15')]);}}return _0x17f0d4;}function getRoot(_0x225021){return parser[_0x8a6a('0x16')](_0x225021,{'object':!![]})[_0x8a6a('0x17')]['root'];}function inspect(_0x30e4c0){return util['inspect'](_0x30e4c0,{'showHidden':![],'depth':null});}function initialize(_0x2584c1,_0x289263){var _0x13e17c=getRoot(_0x2584c1[_0x8a6a('0x18')]);if(!_0x13e17c||!_0x13e17c[_0x8a6a('0x19')])return;var _0x3d2e98,_0x52ea32,_0x83069c;logger[_0x8a6a('0x1a')](_0x8a6a('0x1b'),JSON[_0x8a6a('0x1c')](_0x13e17c,null,0x2));_0x289263['joinAt']=moment()[_0x8a6a('0x1d')](_0x8a6a('0x1e'));_0x3d2e98=initGraph(_[_0x8a6a('0x1f')](_0x13e17c,_0x8a6a('0x20')),_0x13e17c[_0x8a6a('0x20')]);_0x52ea32=new Vertices(_0x289263,rpc,mailRpc);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x289263[_0x8a6a('0x21')],_0x289263[_0x8a6a('0x22')],_0x289263[_0x8a6a('0x23')],_0x289263['dnid'],_0x289263[_0x8a6a('0x24')]));_0x3d2e98[_0x8a6a('0x25')](_0x13e17c[_0x8a6a('0x19')]['id'],function(_0x1e1b9b){try{_0x1e1b9b=_0x52ea32['clear'](_0x1e1b9b);logger[_0x8a6a('0x1a')](_0x8a6a('0x26'),JSON[_0x8a6a('0x1c')](_0x1e1b9b,null,0x2));if(_0x1e1b9b[_0x8a6a('0xc')]===_0x8a6a('0x27')){logger[_0x8a6a('0x28')](_0x8a6a('0x29'));_0x289263['context']=_0x1e1b9b[_0x8a6a('0x2a')]||_0x289263[_0x8a6a('0x2a')];_0x289263['extension']=_0x1e1b9b['extension'];_0x289263[_0x8a6a('0x2b')]=_0x1e1b9b[_0x8a6a('0x2b')]?_0x1e1b9b[_0x8a6a('0x2b')]-0x1:0x1;return null;}else if(_0x1e1b9b&&_0x52ea32[_0x1e1b9b[_0x8a6a('0xc')]]){_0x83069c=_0x52ea32[_0x1e1b9b[_0x8a6a('0xc')]](_0x1e1b9b);logger[_0x8a6a('0x28')](_0x8a6a('0x2c'),JSON[_0x8a6a('0x1c')](_0x83069c,null,0x2));if(_0x83069c&&_0x83069c[_0x8a6a('0x2d')]===AGI_CODE_SUCCESS&&_0x83069c['result']!==AGI_RESULT_ERROR&&!_0x289263[_0x8a6a('0x2e')]){logger['debug'](_0x8a6a('0x2c'),inspect(_0x83069c));return _[_0x8a6a('0x2f')](_0x83069c['result'])?null:_0x83069c[_0x8a6a('0x30')][_0x8a6a('0x31')]();}else{logger[_0x8a6a('0x9')](_0x8a6a('0x2c'),inspect(_0x83069c));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x47243f){logger['error'](_0x47243f['stack']);return null;}});if(_0x13e17c[_0x8a6a('0x32')]){logger['info'](util[_0x8a6a('0x1d')](_0x8a6a('0x33'),_0x289263[_0x8a6a('0x21')],_0x289263['calleridname'],_0x289263[_0x8a6a('0x23')],_0x289263[_0x8a6a('0x34')],_0x289263['uniqueid']));_0x3d2e98['traverseBFS'](_0x13e17c[_0x8a6a('0x32')]['id'],function(_0x5b2502){try{_0x5b2502=_0x52ea32[_0x8a6a('0x35')](_0x5b2502);logger['debug'](_0x8a6a('0x26'),JSON[_0x8a6a('0x1c')](_0x5b2502,null,0x2));if(_0x5b2502&&_0x52ea32[_0x5b2502[_0x8a6a('0xc')]]){_0x83069c=_0x52ea32[_0x5b2502[_0x8a6a('0xc')]](_0x5b2502);if(_0x83069c){logger[_0x8a6a('0x1a')](_0x8a6a('0x2c'),inspect(_0x83069c));return _['isUndefined'](_0x83069c['result'])?null:_0x83069c['result']['toString']();}else{logger[_0x8a6a('0x9')]('response',inspect(_0x83069c));return null;}}else{logger[_0x8a6a('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x4b549c){logger['error'](_0x4b549c[_0x8a6a('0xb')]);return null;}});}logger['info'](util['format'](_0x8a6a('0x36'),_0x289263[_0x8a6a('0x21')],_0x289263[_0x8a6a('0x22')],_0x289263[_0x8a6a('0x23')],_0x289263[_0x8a6a('0x34')],_0x289263[_0x8a6a('0x24')]));logger[_0x8a6a('0x28')](util[_0x8a6a('0x1d')](_0x8a6a('0x37'),_0x289263[_0x8a6a('0x2a')],_0x289263[_0x8a6a('0x38')],parseInt(_0x289263[_0x8a6a('0x2b')],0xa)+0x1));_0x289263['continueAt'](_0x289263[_0x8a6a('0x2a')],_0x289263[_0x8a6a('0x38')],parseInt(_0x289263[_0x8a6a('0x2b')],0xa)+0x1);_0x289263['close']();}function handleNotFound(_0x46e1a5){logger['error'](util[_0x8a6a('0x1d')](_0x8a6a('0x39'),_0x46e1a5[_0x8a6a('0x21')]));_0x46e1a5[_0x8a6a('0x3a')](_0x46e1a5[_0x8a6a('0x2a')],_0x46e1a5[_0x8a6a('0x38')],parseInt(_0x46e1a5['priority'],0xa)+0x1);_0x46e1a5[_0x8a6a('0x3b')]();}function handleUnpublished(_0x4e8c09){logger[_0x8a6a('0x9')](util['format'](_0x8a6a('0x3c'),_0x4e8c09['arg_1']));_0x4e8c09[_0x8a6a('0x3a')](_0x4e8c09[_0x8a6a('0x2a')],_0x4e8c09[_0x8a6a('0x38')],parseInt(_0x4e8c09[_0x8a6a('0x2b')],0xa)+0x1);_0x4e8c09[_0x8a6a('0x3b')]();}module[_0x8a6a('0x3d')]={'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 4c763f5..d7f4150 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 _0xd840=['stream','Transform','call','_localBuffer','_inBody','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','trim','slice','emit','line','exports','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd840,0xd7));var _0x0d84=function(_0x1e3945,_0x4e5302){_0x1e3945=_0x1e3945-0x0;var _0x1abf06=_0xd840[_0x1e3945];return _0x1abf06;};'use strict';var util=require(_0x0d84('0x0'));var Transform=require(_0x0d84('0x1'))[_0x0d84('0x2')];function AGIReply(_0x58cd73){Transform[_0x0d84('0x3')](this,_0x58cd73);this[_0x0d84('0x4')]='';this[_0x0d84('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x0d84('0x6')]['_transform']=function(_0x55e3b9,_0x3f5f34,_0x5e83a2){var _0x3f4732='\x0a',_0x5df0e9=['\x0a\x0a',_0x0d84('0x7')],_0x4edba8=-0x1,_0x95403c=-0x1,_0x3147a1='',_0x4e633e=0x0,_0x286d73='',_0x365421='';this['_localBuffer']+=_0x55e3b9[_0x0d84('0x8')]();_0x286d73=this[_0x0d84('0x4')];if(!this[_0x0d84('0x5')]){_0x4e633e=0x0;while(_0x5df0e9[_0x4e633e]){while((_0x95403c=_0x286d73[_0x0d84('0x9')](_0x5df0e9[_0x4e633e]))!=-0x1){_0x3147a1=_0x5df0e9[_0x4e633e];_0x365421=_0x286d73['substring'](0x0,_0x95403c);_0x286d73=_0x286d73[_0x0d84('0xa')](_0x95403c+_0x3147a1[_0x0d84('0xb')]);var _0x489d97=_0x365421[_0x0d84('0xc')](_0x3f4732),_0x418c8d=0x0,_0x4bed18={},_0xb14a7a='',_0x466792='',_0x5a2b57=-0x1;while(_0x489d97[_0x418c8d]){_0x5a2b57=_0x489d97[_0x418c8d][_0x0d84('0x9')](':');if(_0x5a2b57!=-0x1){_0xb14a7a=_0x489d97[_0x418c8d]['slice'](0x0,_0x5a2b57)[_0x0d84('0xd')]();_0x466792=_0x489d97[_0x418c8d][_0x0d84('0xe')](_0x5a2b57+0x1)['trim']();if(_0xb14a7a[_0x0d84('0xb')]>0x0){_0x4bed18[_0xb14a7a]=_0x466792;}}else{}_0x418c8d++;}this[_0x0d84('0xf')]('headers',_0x4bed18);this[_0x0d84('0x5')]=!![];}_0x4e633e++;}this['_localBuffer']=_0x286d73;}else{while((_0x4edba8=_0x286d73[_0x0d84('0x9')](_0x3f4732))!=-0x1){_0x365421=_0x286d73[_0x0d84('0xa')](0x0,_0x4edba8);this[_0x0d84('0xf')](_0x0d84('0x10'),_0x365421);_0x286d73=_0x286d73[_0x0d84('0xa')](_0x4edba8+_0x3f4732['length']);}this[_0x0d84('0x4')]=_0x286d73;}_0x5e83a2();};module[_0x0d84('0x11')]=AGIReply; \ No newline at end of file +var _0xa106=['emit','headers','_inBody','line','exports','stream','Transform','call','_localBuffer','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','indexOf','slice','trim','length'];(function(_0x181ca7,_0x298b30){var _0x1019f9=function(_0x3e956b){while(--_0x3e956b){_0x181ca7['push'](_0x181ca7['shift']());}};_0x1019f9(++_0x298b30);}(_0xa106,0x17f));var _0x6a10=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0xa106[_0x39772f];return _0xc9edbf;};'use strict';var util=require('util');var Transform=require(_0x6a10('0x0'))[_0x6a10('0x1')];function AGIReply(_0x31b3bd){Transform[_0x6a10('0x2')](this,_0x31b3bd);this[_0x6a10('0x3')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x6a10('0x4')][_0x6a10('0x5')]=function(_0x236f7f,_0x3fb065,_0x21ad3){var _0x2a9468='\x0a',_0x4ee006=['\x0a\x0a',_0x6a10('0x6')],_0x1fa672=-0x1,_0x4988d8=-0x1,_0x3b605b='',_0x3404c4=0x0,_0x52cac8='',_0x5f1c5e='';this[_0x6a10('0x3')]+=_0x236f7f[_0x6a10('0x7')]();_0x52cac8=this[_0x6a10('0x3')];if(!this['_inBody']){_0x3404c4=0x0;while(_0x4ee006[_0x3404c4]){while((_0x4988d8=_0x52cac8['indexOf'](_0x4ee006[_0x3404c4]))!=-0x1){_0x3b605b=_0x4ee006[_0x3404c4];_0x5f1c5e=_0x52cac8[_0x6a10('0x8')](0x0,_0x4988d8);_0x52cac8=_0x52cac8[_0x6a10('0x8')](_0x4988d8+_0x3b605b['length']);var _0x142b09=_0x5f1c5e['split'](_0x2a9468),_0x255138=0x0,_0x5b8d14={},_0x525a8f='',_0x4986ee='',_0x5c3fd0=-0x1;while(_0x142b09[_0x255138]){_0x5c3fd0=_0x142b09[_0x255138][_0x6a10('0x9')](':');if(_0x5c3fd0!=-0x1){_0x525a8f=_0x142b09[_0x255138][_0x6a10('0xa')](0x0,_0x5c3fd0)[_0x6a10('0xb')]();_0x4986ee=_0x142b09[_0x255138][_0x6a10('0xa')](_0x5c3fd0+0x1)[_0x6a10('0xb')]();if(_0x525a8f[_0x6a10('0xc')]>0x0){_0x5b8d14[_0x525a8f]=_0x4986ee;}}else{}_0x255138++;}this[_0x6a10('0xd')](_0x6a10('0xe'),_0x5b8d14);this[_0x6a10('0xf')]=!![];}_0x3404c4++;}this[_0x6a10('0x3')]=_0x52cac8;}else{while((_0x1fa672=_0x52cac8['indexOf'](_0x2a9468))!=-0x1){_0x5f1c5e=_0x52cac8['substring'](0x0,_0x1fa672);this[_0x6a10('0xd')](_0x6a10('0x10'),_0x5f1c5e);_0x52cac8=_0x52cac8[_0x6a10('0x8')](_0x1fa672+_0x2a9468[_0x6a10('0xc')]);}this[_0x6a10('0x3')]=_0x52cac8;}_0x21ad3();};module[_0x6a10('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 8b71d60..620fdcd 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 _0x4f29=['getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','ListId','CreateCmContact','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','client','http','request','then','message','result','catch','getSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','ShowUser','GetContactByPhone','phone'];(function(_0x40ddb9,_0x1764b4){var _0x33b446=function(_0x5a3f71){while(--_0x5a3f71){_0x40ddb9['push'](_0x40ddb9['shift']());}};_0x33b446(++_0x1764b4);}(_0x4f29,0xfd));var _0x94f2=function(_0x378abc,_0x4a11b5){_0x378abc=_0x378abc-0x0;var _0x363796=_0x4f29[_0x378abc];return _0x363796;};'use strict';var _=require('lodash');var moment=require(_0x94f2('0x0'));var jayson=require(_0x94f2('0x1'));var client=jayson[_0x94f2('0x2')][_0x94f2('0x3')]({'port':0x2329});function request(_0xc16ee3,_0x36e06e){return new Promise(function(_0x338fe2,_0x2a6535){return client[_0x94f2('0x4')](_0xc16ee3,_0x36e06e)[_0x94f2('0x5')](function(_0x273314){if(_0x273314['error']){return _0x2a6535(_0x273314['error'][_0x94f2('0x6')]);}else{return _0x338fe2(_0x273314[_0x94f2('0x7')]);}})[_0x94f2('0x8')](function(_0x224a93){return _0x2a6535(_0x224a93);});});}exports[_0x94f2('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x94f2('0xa')]=function(_0x511952){return request(_0x94f2('0xb'),{'options':{'raw':![],'where':{'name':_0x511952},'attributes':[_0x94f2('0xc')]}});};exports[_0x94f2('0xd')]=function(_0x117396){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x117396},'include':[{'model':_0x94f2('0xe'),'as':_0x94f2('0xf'),'include':[{'model':_0x94f2('0x10'),'as':_0x94f2('0x10')}]}],'attributes':['id',_0x94f2('0x11'),_0x94f2('0x12')],'smtp':!![]}});};exports[_0x94f2('0x13')]=function(_0x490142){return request(_0x94f2('0xb'),{'options':{'where':{'id':_0x490142},'attributes':['name']}});};exports[_0x94f2('0x14')]=function(_0x7a3dc0){return request(_0x94f2('0x15'),{'options':{'where':{'id':_0x7a3dc0},'attributes':['name']}});};exports['getVariableById']=function(_0x292953){return request(_0x94f2('0x16'),{'options':{'where':{'id':_0x292953},'attributes':[_0x94f2('0x11')]}});};exports['getSquareOdbcById']=function(_0x8496f1){return request(_0x94f2('0x17'),{'options':{'where':{'id':_0x8496f1},'attributes':['dsn']}});};exports['getUserById']=function(_0x423aa8){return request(_0x94f2('0x18'),{'options':{'where':{'id':_0x423aa8},'attributes':[_0x94f2('0x11')]}});};exports['getContactByPhone']=function(_0x302c00){return request(_0x94f2('0x19'),{'options':{'where':{'phone':_0x302c00[_0x94f2('0x1a')]},'attributes':['id']}});};exports[_0x94f2('0x1b')]=function(_0x4ceba8){return request(_0x94f2('0x1c'),{'options':{'where':{'id':_0x4ceba8},'attributes':[_0x94f2('0x11')]}});};exports['getSoundById']=function(_0x397744){return request(_0x94f2('0x1d'),{'options':{'where':{'id':_0x397744},'attributes':[_0x94f2('0x1e')]}});};exports[_0x94f2('0x1f')]=function(_0x6858ba){return request(_0x94f2('0x20'),{'options':{'raw':![],'where':{'id':_0x6858ba},'include':[{'model':_0x94f2('0x21'),'as':_0x94f2('0x22')}]}});};exports[_0x94f2('0x23')]=function(_0xed0b88){return request(_0x94f2('0x24'),{'options':{'where':{'id':_0xed0b88},'attributes':['id',_0x94f2('0x11')]}});};exports[_0x94f2('0x25')]=function(_0x35b31d){return request('CreateSmsMessage',{'body':_0x35b31d});};exports[_0x94f2('0x26')]=function(_0xf4eeb0){return request('CreateSquareDetailsReport',{'body':_0xf4eeb0});};exports[_0x94f2('0x27')]=function(_0x3e2e0a){return request('CreateSquareReport',{'body':_['merge'](_0x3e2e0a,{'project_name':_0x3e2e0a['arg_1'],'prev_project_name':_0x3e2e0a['arg_2']||'','is_subproject':_0x3e2e0a['arg_2']?!![]:![],'leaveAt':moment()[_0x94f2('0x28')](_0x94f2('0x29'))})});};exports[_0x94f2('0x2a')]=function(_0x14ae14){return request(_0x94f2('0x2b'),{'body':_0x14ae14});};exports['createSquareMessage']=function(_0x1ccf31){return request('CreateSquareMessage',{'body':_0x1ccf31});};exports[_0x94f2('0x2c')]=function(_0xd5b804){return request(_0x94f2('0x2d'),{'options':{'raw':![],'where':{'phone':_0xd5b804[_0x94f2('0x1a')],'ListId':_0xd5b804[_0x94f2('0x2e')]}}})[_0x94f2('0x5')](function(_0x27d85f){if(_0x27d85f){return _0x27d85f;}return request(_0x94f2('0x2f'),{'body':_0xd5b804});});};exports['getPauseById']=function(_0x134a0f){return request(_0x94f2('0x30'),{'options':{'where':{'id':_0x134a0f},'attributes':[_0x94f2('0x11')]}});};exports[_0x94f2('0x31')]=function(_0x547a48,_0xd54694){return request('LoginUser',{'body':{'interface':_0xd54694},'options':{'where':_0x547a48}});};exports[_0x94f2('0x32')]=function(_0x1e8033,_0x3096bf,_0x4c8c14){return request(_0x94f2('0x33'),{'body':{'type':_0x3096bf,'uniqueid':_0x4c8c14},'options':{'where':_0x1e8033}});};exports[_0x94f2('0x34')]=function(_0x280ae4){return request(_0x94f2('0x35'),{'body':{},'options':{'where':_0x280ae4}});};exports[_0x94f2('0x36')]=function(_0x25c0b0){return request(_0x94f2('0x37'),{'body':{},'options':{'where':_0x25c0b0}});}; \ No newline at end of file +var _0x6658=['GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','getSoundById','Interval','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects'];(function(_0x1bc445,_0x2d6fe0){var _0x589e6b=function(_0xcdd664){while(--_0xcdd664){_0x1bc445['push'](_0x1bc445['shift']());}};_0x589e6b(++_0x2d6fe0);}(_0x6658,0x198));var _0x8665=function(_0xcfd63b,_0x112e2){_0xcfd63b=_0xcfd63b-0x0;var _0x75be98=_0x6658[_0xcfd63b];return _0x75be98;};'use strict';var _=require(_0x8665('0x0'));var moment=require(_0x8665('0x1'));var jayson=require(_0x8665('0x2'));var client=jayson[_0x8665('0x3')][_0x8665('0x4')]({'port':0x2329});function request(_0x454e7c,_0x252590){return new Promise(function(_0x49b4d3,_0x4f1343){return client[_0x8665('0x5')](_0x454e7c,_0x252590)[_0x8665('0x6')](function(_0x4cf7f4){if(_0x4cf7f4['error']){return _0x4f1343(_0x4cf7f4[_0x8665('0x7')][_0x8665('0x8')]);}else{return _0x49b4d3(_0x4cf7f4[_0x8665('0x9')]);}})[_0x8665('0xa')](function(_0xe73687){return _0x4f1343(_0xe73687);});});}exports[_0x8665('0xb')]=function(){return request(_0x8665('0xc'),{'options':{'raw':![],'attributes':['id',_0x8665('0xd'),'production']}});};exports[_0x8665('0xe')]=function(_0x20da7d){return request(_0x8665('0xf'),{'options':{'raw':![],'where':{'name':_0x20da7d},'attributes':[_0x8665('0x10')]}});};exports[_0x8665('0x11')]=function(_0x46eab7){return request(_0x8665('0x12'),{'options':{'raw':![],'where':{'id':_0x46eab7},'include':[{'model':_0x8665('0x13'),'as':_0x8665('0x14'),'include':[{'model':_0x8665('0x15'),'as':_0x8665('0x15')}]}],'attributes':['id',_0x8665('0xd'),_0x8665('0x16')],'smtp':!![]}});};exports[_0x8665('0x17')]=function(_0x569c8a){return request(_0x8665('0xf'),{'options':{'where':{'id':_0x569c8a},'attributes':['name']}});};exports[_0x8665('0x18')]=function(_0x16452c){return request(_0x8665('0x19'),{'options':{'where':{'id':_0x16452c},'attributes':[_0x8665('0xd')]}});};exports[_0x8665('0x1a')]=function(_0x2a0507){return request('ShowVariable',{'options':{'where':{'id':_0x2a0507},'attributes':[_0x8665('0xd')]}});};exports[_0x8665('0x1b')]=function(_0x53400c){return request(_0x8665('0x1c'),{'options':{'where':{'id':_0x53400c},'attributes':['dsn']}});};exports[_0x8665('0x1d')]=function(_0x383b79){return request(_0x8665('0x1e'),{'options':{'where':{'id':_0x383b79},'attributes':['name']}});};exports[_0x8665('0x1f')]=function(_0x235617){return request('GetContactByPhone',{'options':{'where':{'phone':_0x235617[_0x8665('0x20')]},'attributes':['id']}});};exports[_0x8665('0x21')]=function(_0x16f1f1){return request('ShowTrunk',{'options':{'where':{'id':_0x16f1f1},'attributes':[_0x8665('0xd')]}});};exports[_0x8665('0x22')]=function(_0xdacc16){return request('ShowSound',{'options':{'where':{'id':_0xdacc16},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x29154d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x29154d},'include':[{'model':_0x8665('0x23'),'as':'Intervals'}]}});};exports[_0x8665('0x24')]=function(_0x4dc4f7){return request('ShowSmsAccount',{'options':{'where':{'id':_0x4dc4f7},'attributes':['id',_0x8665('0xd')]}});};exports[_0x8665('0x25')]=function(_0x512d8e){return request(_0x8665('0x26'),{'body':_0x512d8e});};exports[_0x8665('0x27')]=function(_0x189df6){return request(_0x8665('0x28'),{'body':_0x189df6});};exports['createSquareReport']=function(_0x30cb34){return request(_0x8665('0x29'),{'body':_[_0x8665('0x2a')](_0x30cb34,{'project_name':_0x30cb34[_0x8665('0x2b')],'prev_project_name':_0x30cb34[_0x8665('0x2c')]||'','is_subproject':_0x30cb34[_0x8665('0x2c')]?!![]:![],'leaveAt':moment()[_0x8665('0x2d')](_0x8665('0x2e'))})});};exports['createSquareRecording']=function(_0x21a623){return request(_0x8665('0x2f'),{'body':_0x21a623});};exports[_0x8665('0x30')]=function(_0x5c2c1b){return request(_0x8665('0x31'),{'body':_0x5c2c1b});};exports[_0x8665('0x32')]=function(_0x149c8f){return request(_0x8665('0x33'),{'options':{'raw':![],'where':{'phone':_0x149c8f[_0x8665('0x20')],'ListId':_0x149c8f[_0x8665('0x34')]}}})[_0x8665('0x6')](function(_0x183b4c){if(_0x183b4c){return _0x183b4c;}return request('CreateCmContact',{'body':_0x149c8f});});};exports[_0x8665('0x35')]=function(_0x46c326){return request('ShowPause',{'options':{'where':{'id':_0x46c326},'attributes':[_0x8665('0xd')]}});};exports[_0x8665('0x36')]=function(_0x303376,_0x599ddb){return request(_0x8665('0x37'),{'body':{'interface':_0x599ddb},'options':{'where':_0x303376}});};exports['agentPause']=function(_0x50cebb,_0x1d341a,_0x432e36){return request(_0x8665('0x38'),{'body':{'type':_0x1d341a,'uniqueid':_0x432e36},'options':{'where':_0x50cebb}});};exports[_0x8665('0x39')]=function(_0x450c01){return request(_0x8665('0x3a'),{'body':{},'options':{'where':_0x450c01}});};exports[_0x8665('0x3b')]=function(_0x388c68){return request('LogoutUser',{'body':{},'options':{'where':_0x388c68}});}; \ 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 90e30be..b175037 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 _0x5e17=['./polly'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x5e17,0x17a));var _0x75e1=function(_0x7147c1,_0x49bc15){_0x7147c1=_0x7147c1-0x0;var _0x188f46=_0x5e17[_0x7147c1];return _0x188f46;};var polly=require(_0x75e1('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xda19=['exports','./lex'];(function(_0x40c8b0,_0x28a552){var _0x506318=function(_0x49372e){while(--_0x49372e){_0x40c8b0['push'](_0x40c8b0['shift']());}};_0x506318(++_0x28a552);}(_0xda19,0xd5));var _0x9da1=function(_0x3d7a8a,_0x43bed7){_0x3d7a8a=_0x3d7a8a-0x0;var _0x17f193=_0xda19[_0x3d7a8a];return _0x17f193;};var polly=require('./polly');var lex=require(_0x9da1('0x0'));module[_0x9da1('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 5cc3639..204dfa3 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 _0x96cc=['./lib/api'];(function(_0x329cf0,_0x4a71b6){var _0x12ac02=function(_0x248656){while(--_0x248656){_0x329cf0['push'](_0x329cf0['shift']());}};_0x12ac02(++_0x4a71b6);}(_0x96cc,0x16c));var _0xc96c=function(_0x2685d4,_0x39c077){_0x2685d4=_0x2685d4-0x0;var _0x3db6d9=_0x96cc[_0x2685d4];return _0x3db6d9;};'use strict';var lex=require(_0xc96c('0x0'));module['exports']=function(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701){return lex(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701);}; \ No newline at end of file +var _0xaa88=['exports','./lib/api'];(function(_0x468ae8,_0x55979f){var _0x56344f=function(_0x531140){while(--_0x531140){_0x468ae8['push'](_0x468ae8['shift']());}};_0x56344f(++_0x55979f);}(_0xaa88,0x137));var _0x8aa8=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0xaa88[_0x53f964];return _0x17be6c;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ 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 5b1cafe..13f6526 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(_0x54694c,_0x175dda){var _0x4863f4=function(_0x5ef8dc){while(--_0x5ef8dc){_0x54694c['push'](_0x54694c['shift']());}};_0x4863f4(++_0x175dda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x46ff18,_0x2e1faa){var _0x4e812f=function(_0x382809){while(--_0x382809){_0x46ff18['push'](_0x46ff18['shift']());}};_0x4e812f(++_0x2e1faa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 afca4dc..d0ef52a 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. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x1cbcc5,_0xb565d,_0x5864eb,_0x1c7436,_0x154cf2,_0x9268d8,_0x323aee){return polly(_0x1cbcc5,_0xb565d,_0x5864eb,_0x1c7436,_0x154cf2,_0x9268d8,_0x323aee);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x4b310b,_0x5c2bef,_0x19b8b9,_0x3f09af,_0x38f682,_0x34cbfa,_0x3e33b1){return polly(_0x4b310b,_0x5c2bef,_0x19b8b9,_0x3f09af,_0x38f682,_0x34cbfa,_0x3e33b1);}; \ 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 4254cc5..46f21f5 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 _0xcaf9=['bluebird','randomstring','AudioStream','writeFile','Polly','mp3','path'];(function(_0x37858a,_0x3b523f){var _0x1ff350=function(_0x13f59c){while(--_0x13f59c){_0x37858a['push'](_0x37858a['shift']());}};_0x1ff350(++_0x3b523f);}(_0xcaf9,0x13a));var _0x9caf=function(_0x467771,_0x59c2ae){_0x467771=_0x467771-0x0;var _0x45c8ec=_0xcaf9[_0x467771];return _0x45c8ec;};'use strict';var fs=require('fs');var path=require(_0x9caf('0x0'));var BPromise=require(_0x9caf('0x1'));var rs=require(_0x9caf('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x43314c,_0x459bcb,_0x16483d){return new BPromise(function(_0x1b0c1c,_0x302b5a){_0x43314c['synthesizeSpeech'](_0x459bcb,function(_0x4b8313,_0x2851d6){if(_0x4b8313){_0x302b5a(_0x4b8313);}else if(_0x2851d6){if(_0x2851d6[_0x9caf('0x3')]instanceof Buffer){fs[_0x9caf('0x4')](_0x16483d,_0x2851d6[_0x9caf('0x3')],function(_0x317c69){if(_0x317c69){_0x302b5a(_0x317c69);}else{_0x1b0c1c();}});}else{_0x302b5a(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x302b5a(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x10b00c,_0x59dc2b,_0x2c4e71,_0x388983,_0x34bd1e,_0x14c555,_0x197c71){var _0x4dae44=new AWS[(_0x9caf('0x5'))]({'accessKeyId':_0x10b00c,'secretAccessKey':_0x59dc2b,'region':_0x2c4e71});var _0x247ede={'Text':_0x34bd1e,'TextType':_0x14c555||'text','OutputFormat':_0x9caf('0x6'),'VoiceId':_0x388983};return pollyResult(_0x4dae44,_0x247ede,_0x197c71);}; \ No newline at end of file +var _0xcf40=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0xcf40,0x130));var _0x0cf4=function(_0xd734b9,_0x51e11b){_0xd734b9=_0xd734b9-0x0;var _0x59edd9=_0xcf40[_0xd734b9];return _0x59edd9;};'use strict';var fs=require('fs');var path=require(_0x0cf4('0x0'));var BPromise=require('bluebird');var rs=require(_0x0cf4('0x1'));var AWS=require(_0x0cf4('0x2'));function pollyResult(_0x548162,_0xcd86fc,_0x10b2ec){return new BPromise(function(_0x1bd852,_0x1bc84d){_0x548162[_0x0cf4('0x3')](_0xcd86fc,function(_0x2c84e1,_0x4d0552){if(_0x2c84e1){_0x1bc84d(_0x2c84e1);}else if(_0x4d0552){if(_0x4d0552[_0x0cf4('0x4')]instanceof Buffer){fs[_0x0cf4('0x5')](_0x10b2ec,_0x4d0552['AudioStream'],function(_0x3764c2){if(_0x3764c2){_0x1bc84d(_0x3764c2);}else{_0x1bd852();}});}else{_0x1bc84d(new Error(_0x0cf4('0x6')));}}else{_0x1bc84d(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x160e8b,_0x454246,_0x12caf6,_0x7cff3f,_0x44b6f3,_0x515f41,_0xb76020){var _0x2cf8dc=new AWS[(_0x0cf4('0x7'))]({'accessKeyId':_0x160e8b,'secretAccessKey':_0x454246,'region':_0x12caf6});var _0x18f99a={'Text':_0x44b6f3,'TextType':_0x515f41||_0x0cf4('0x8'),'OutputFormat':_0x0cf4('0x9'),'VoiceId':_0x7cff3f};return pollyResult(_0x2cf8dc,_0x18f99a,_0xb76020);}; \ 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 7d184c0..6ed6cd9 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 _0xca02=['./lib/api'];(function(_0x51d44f,_0x3356a1){var _0x2c27a3=function(_0x17c06d){while(--_0x17c06d){_0x51d44f['push'](_0x51d44f['shift']());}};_0x2c27a3(++_0x3356a1);}(_0xca02,0x1ec));var _0x2ca0=function(_0x33b86a,_0x336782){_0x33b86a=_0x33b86a-0x0;var _0x307252=_0xca02[_0x33b86a];return _0x307252;};'use strict';var asr=require(_0x2ca0('0x0'));module['exports']=function(_0x43557b,_0x3acf1b,_0x302b0c,_0x50ee00){return asr(_0x43557b,_0x3acf1b,_0x302b0c);}; \ No newline at end of file +var _0x764b=['exports','./lib/api'];(function(_0x41db2d,_0xc6e83e){var _0x373675=function(_0x522da8){while(--_0x522da8){_0x41db2d['push'](_0x41db2d['shift']());}};_0x373675(++_0xc6e83e);}(_0x764b,0xb5));var _0xb764=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x764b[_0x3070dc];return _0x431489;};'use strict';var asr=require(_0xb764('0x0'));module[_0xb764('0x1')]=function(_0x53a87c,_0x4b128c,_0x3bdf9e,_0x379ca5){return asr(_0x53a87c,_0x4b128c,_0x3bdf9e);}; \ 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 9b7ac3e..b06c724 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 _0x91a7=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x91a7,0xe7));var _0x791a=function(_0x1cd7cf,_0x49e869){_0x1cd7cf=_0x1cd7cf-0x0;var _0x3d6282=_0x91a7[_0x1cd7cf];return _0x3d6282;};'use strict';var url=require('url');var BPromise=require(_0x791a('0x0'));var fs=require('fs');var host=_0x791a('0x1');module[_0x791a('0x2')]=function(_0x5d2796,_0x415994,_0x5b6f78){return new BPromise(function(_0x2f6392,_0x535640){var _0x50ab29;if(typeof _0x5d2796!==_0x791a('0x3')||_0x5d2796[_0x791a('0x4')]===0x0){return _0x535640('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x415994!==_0x791a('0x3')||_0x415994['length']===0x0){return _0x535640(_0x791a('0x5'));}if(typeof _0x5b6f78!==_0x791a('0x6')&&(typeof _0x5b6f78!=='string'||_0x5b6f78[_0x791a('0x4')]===0x0)){return _0x535640(_0x791a('0x7'));}try{_0x50ab29=fs[_0x791a('0x8')](_0x5d2796)[_0x791a('0x9')](_0x791a('0xa'));}catch(_0x5249d5){return _0x535640(_0x5249d5);}return _0x2f6392({'method':_0x791a('0xb'),'uri':host+_0x791a('0xc')+_0x415994,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x791a('0xd'),'languageCode':_0x5b6f78},'audio':{'content':_0x50ab29}},'json':!![]});});}; \ No newline at end of file +var _0x579c=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x44af2c,_0x403843){var _0x3b5fc9=function(_0x11a4db){while(--_0x11a4db){_0x44af2c['push'](_0x44af2c['shift']());}};_0x3b5fc9(++_0x403843);}(_0x579c,0xda));var _0xc579=function(_0x152d1a,_0x193614){_0x152d1a=_0x152d1a-0x0;var _0x1ef5de=_0x579c[_0x152d1a];return _0x1ef5de;};'use strict';var url=require(_0xc579('0x0'));var BPromise=require(_0xc579('0x1'));var fs=require('fs');var host=_0xc579('0x2');module[_0xc579('0x3')]=function(_0x397136,_0x586948,_0x1e2808){return new BPromise(function(_0x5399d7,_0x21a0a2){var _0x3b913c;if(typeof _0x397136!==_0xc579('0x4')||_0x397136[_0xc579('0x5')]===0x0){return _0x21a0a2(_0xc579('0x6'));}if(typeof _0x586948!==_0xc579('0x4')||_0x586948[_0xc579('0x5')]===0x0){return _0x21a0a2('key\x20should\x20be\x20a\x20string');}if(typeof _0x1e2808!==_0xc579('0x7')&&(typeof _0x1e2808!==_0xc579('0x4')||_0x1e2808[_0xc579('0x5')]===0x0)){return _0x21a0a2(_0xc579('0x8'));}try{_0x3b913c=fs[_0xc579('0x9')](_0x397136)[_0xc579('0xa')](_0xc579('0xb'));}catch(_0xf9847f){return _0x21a0a2(_0xf9847f);}return _0x5399d7({'method':'POST','uri':host+_0xc579('0xc')+_0x586948,'body':{'config':{'encoding':_0xc579('0xd'),'sampleRateHertz':_0xc579('0xe'),'languageCode':_0x1e2808},'audio':{'content':_0x3b913c}},'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 583e1d7..b5f997a 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 _0x7a35=['./asr'];(function(_0xad91f9,_0x275b39){var _0x400c72=function(_0xa763a8){while(--_0xa763a8){_0xad91f9['push'](_0xad91f9['shift']());}};_0x400c72(++_0x275b39);}(_0x7a35,0x19c));var _0x57a3=function(_0x5ec777,_0xde237d){_0x5ec777=_0x5ec777-0x0;var _0x3846e3=_0x7a35[_0x5ec777];return _0x3846e3;};var asr=require(_0x57a3('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xb4de=['exports'];(function(_0x28f30b,_0x3b60c6){var _0x599fbb=function(_0x1dad13){while(--_0x1dad13){_0x28f30b['push'](_0x28f30b['shift']());}};_0x599fbb(++_0x3b60c6);}(_0xb4de,0x116));var _0xeb4d=function(_0x248f75,_0x152363){_0x248f75=_0x248f75-0x0;var _0x596eb2=_0xb4de[_0x248f75];return _0x596eb2;};var asr=require('./asr');module[_0xeb4d('0x0')]={'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 3e8adee..ce95fe7 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 _0x7f9a=['length','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','action','actionIncomplete','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','queryResult','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','tildeASR','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','https','querystring','randomstring','sox','google-tts-api','parse','./aws','./google','./tilde','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','777','readFileSync','toString','googleCloudTTS','?key=','input','audioConfig','text:synthesize','POST','.mp3','from','base64','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7f9a,0xc1));var _0xa7f9=function(_0x21ce01,_0x43d754){_0x21ce01=_0x21ce01-0x0;var _0x3d738b=_0x7f9a[_0x21ce01];return _0x3d738b;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xa7f9('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0xa7f9('0x1'));var md5=require('md5');var path=require('path');var querystring=require(_0xa7f9('0x2'));var rp=require('request-promise');var rs=require(_0xa7f9('0x3'));var sox=require(_0xa7f9('0x4'));var tts=require(_0xa7f9('0x5'));var urlParse=require('url')[_0xa7f9('0x6')];var util=require('util');var aws=require(_0xa7f9('0x7'));var google=require(_0xa7f9('0x8'));var sestek=require('./sestek');var tilde=require(_0xa7f9('0x9'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0xa7f9('0xa');function downloadFile(_0x586c97,_0x5dce4e){return new BPromise(function(_0x2a0588,_0x593fbd){var _0x2d5ad0=urlParse(_0x586c97);var _0x586a2c=_0x2d5ad0[_0xa7f9('0xb')]===_0xa7f9('0xc')?https:http;var _0x276116={'host':_0x2d5ad0[_0xa7f9('0xd')],'path':_0x2d5ad0[_0xa7f9('0xe')],'headers':{'user-agent':_0xa7f9('0xf')}};_0x586a2c[_0xa7f9('0x10')](_0x276116,function(_0x267b36){if(_0x267b36[_0xa7f9('0x11')]!==0xc8){logger[_0xa7f9('0x12')](_0xa7f9('0x13')+_0x586c97+_0xa7f9('0x14')+_0x267b36[_0xa7f9('0x11')]+'\x20('+_0x267b36[_0xa7f9('0x15')]+')');_0x593fbd(new Error('request\x20to\x20'+_0x586c97+_0xa7f9('0x14')+_0x267b36[_0xa7f9('0x11')]+'\x20('+_0x267b36['statusMessage']+')'));return;}var _0x1f6ecc=fs[_0xa7f9('0x16')](_0x5dce4e);_0x1f6ecc['on'](_0xa7f9('0x17'),function(){logger[_0xa7f9('0x18')](_0xa7f9('0x19'));_0x1f6ecc['close'](_0x2a0588);});_0x1f6ecc['on'](_0xa7f9('0x12'),function(_0x3cbcbf){fs[_0xa7f9('0x1a')](_0x5dce4e);logger[_0xa7f9('0x12')](_0xa7f9('0x1b'),_0x3cbcbf);_0x593fbd(_0x3cbcbf);});_0x267b36[_0xa7f9('0x1c')](_0x1f6ecc);})['on'](_0xa7f9('0x12'),function(_0x27944f){logger[_0xa7f9('0x12')](_0x27944f);_0x593fbd(_0x27944f);})[_0xa7f9('0x1d')]();});}function uploadFile(_0x4b1d49){return new BPromise(function(_0x136837,_0x17785b){var _0x2f72ef=urlParse(_0x4b1d49);var _0x127be0=_0x2f72ef[_0xa7f9('0xb')]===_0xa7f9('0xc')?https:http;var _0x2ddf2d={'host':_0x2f72ef[_0xa7f9('0xd')],'path':_0x2f72ef['path'],'headers':{'user-agent':_0xa7f9('0xf')}};_0x127be0[_0xa7f9('0x10')](_0x2ddf2d,function(_0x2c5e32){if(_0x2c5e32[_0xa7f9('0x11')]!==0xc8){_0x17785b(new Error(_0xa7f9('0x13')+_0x4b1d49+'\x20failed,\x20status\x20code\x20=\x20'+_0x2c5e32[_0xa7f9('0x11')]+'\x20('+_0x2c5e32[_0xa7f9('0x15')]+')'));return;}var _0x3b63fc='';_0x2c5e32['on'](_0xa7f9('0x1e'),function(_0x15df05){_0x3b63fc+=_0x15df05;});_0x2c5e32['on'](_0xa7f9('0x1d'),function(){_0x136837(_0x3b63fc);});})['on'](_0xa7f9('0x12'),function(_0x47a927){_0x17785b(_0x47a927);})['end']();});}function convertFile(_0x125a3a,_0x196355){return new BPromise(function(_0x42152e,_0x4459af){var _0x21c99d=sox[_0xa7f9('0x1f')](_0x125a3a,_0x196355,{'sampleRate':0x1f40,'format':_0xa7f9('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21c99d['on'](_0xa7f9('0x12'),function(_0x38bd11){logger['error'](_0xa7f9('0x21'),_0x38bd11);_0x4459af(_0x38bd11);});_0x21c99d['on'](_0xa7f9('0x1d'),function(){logger[_0xa7f9('0x18')](_0xa7f9('0x22'));_0x42152e();});_0x21c99d['start']();});}function base64Decode(_0x1260c5,_0x2c90e8){var _0x102654=path[_0xa7f9('0x23')](__dirname,_0xa7f9('0x24'),rs[_0xa7f9('0x25')](0x4)+_0xa7f9('0x26'));fs[_0xa7f9('0x27')](_0x102654,_0x1260c5,'base64');return convertFile(_0x102654,_0x2c90e8)[_0xa7f9('0x28')](function(){try{fs[_0xa7f9('0x1a')](_0x102654);fs[_0xa7f9('0x29')](_0x2c90e8,_0xa7f9('0x2a'));}catch(_0x2a1055){logger['error'](_0x2a1055);}return _0x2c90e8['split']('.')[0x0];});}function base64Encode(_0x181a1a){var _0x17f162=fs[_0xa7f9('0x2b')](_0x181a1a);return new Buffer(_0x17f162)[_0xa7f9('0x2c')]('base64');}exports[_0xa7f9('0x2d')]=function(_0x35d5cf,_0x3b6783,_0x2c58e1,_0x158216,_0x4b0b07,_0x271289){var _0x44da8c,_0x50a143;var _0x176431='https://texttospeech.googleapis.com/v1/';var _0x25768c=_0xa7f9('0x2e')+_0x35d5cf;var _0x5d55d7={};if(_0x3b6783==='ssml'){_0x5d55d7['input']={'ssml':_0x2c58e1};}else{_0x5d55d7[_0xa7f9('0x2f')]={'text':_0x2c58e1};};_0x5d55d7['voice']={'languageCode':_0x158216,'ssmlGender':_0x4b0b07};_0x5d55d7[_0xa7f9('0x30')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x425545={'url':_0x176431+_0xa7f9('0x31')+_0x25768c,'method':_0xa7f9('0x32'),'json':!![],'body':_0x5d55d7};return rp(_0x425545)[_0xa7f9('0x28')](function(_0x249f0b){return new BPromise(function(_0x2e6cd8,_0x53476d){_0x44da8c=path[_0xa7f9('0x23')](__dirname,_0xa7f9('0x24'),rs[_0xa7f9('0x25')](0x4)+_0xa7f9('0x33'));var _0x2bf9fa=Buffer[_0xa7f9('0x34')](_0x249f0b['audioContent'],_0xa7f9('0x35'));return fs[_0xa7f9('0x36')](_0x44da8c,_0x2bf9fa,function(_0x18026f){_0x53476d(_0x18026f);},function(_0x42c1bb){fs[_0xa7f9('0x29')](_0x44da8c,_0xa7f9('0x2a'));_0x2e6cd8(_0x42c1bb);});});})[_0xa7f9('0x28')](function(_0x7daab4){_0x50a143=path[_0xa7f9('0x23')](__dirname,'tmp',rs[_0xa7f9('0x25')](0x4)+_0xa7f9('0x26'));return convertFile(_0x44da8c,_0x50a143);})[_0xa7f9('0x28')](function(){try{fs['unlink'](_0x44da8c);fs[_0xa7f9('0x29')](_0x50a143,'777');}catch(_0x7d521){logger[_0xa7f9('0x12')](_0x7d521);}logger['info'](_0xa7f9('0x37'),_0x50a143[_0xa7f9('0x38')]('.')[0x0]);return _0x50a143[_0xa7f9('0x38')]('.')[0x0];});};exports[_0xa7f9('0x39')]=function(_0x1e8ad5,_0x354b39){var _0x3bf23a=_0xa7f9('0x3a');var _0x514607,_0x38c946;var _0x5dc663;var _0x42c7d0={'encoding':_0xa7f9('0x3b'),'method':_0xa7f9('0x32'),'timeout':0x2710,'url':_0x3bf23a,'headers':{'Content-Type':_0xa7f9('0x3c')},'body':_0xa7f9('0x3d')+encodeURIComponent(JSON[_0xa7f9('0x3e')]([[[_0xa7f9('0x3f'),JSON[_0xa7f9('0x3e')]([_0x1e8ad5,_0x354b39||'en',![],_0xa7f9('0x40')]),null,_0xa7f9('0x41')]]]))};return rp(_0x42c7d0)[_0xa7f9('0x28')](function(_0x25481c){try{_0x5dc663=eval(_0x25481c[_0xa7f9('0x42')](0x5))[0x0][0x2];}catch(_0x3fc259){throw new Error('parse\x20response\x20failed:\x0a'+_0x25481c[_0xa7f9('0x1e')]);}if(!_0x5dc663){if(_0x1e8ad5[_0xa7f9('0x43')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xa7f9('0x44')+_0x354b39+_0xa7f9('0x45'));}}try{_0x5dc663=eval(_0x5dc663)[0x0];}catch(_0x25fb42){throw new Error(_0xa7f9('0x46')+res[_0xa7f9('0x1e')]);}const _0x424633=_0x5dc663;_0x514607=path['resolve'](__dirname,_0xa7f9('0x24'),rs['generate'](0x4)+_0xa7f9('0x33'));fs[_0xa7f9('0x27')](_0x514607,_0x5dc663,{'encoding':_0xa7f9('0x35')});_0x38c946=path[_0xa7f9('0x23')](__dirname,'tmp',rs[_0xa7f9('0x25')](0x4)+'.wav');return convertFile(_0x514607,_0x38c946);})[_0xa7f9('0x28')](function(){try{fs[_0xa7f9('0x1a')](_0x514607);fs[_0xa7f9('0x29')](_0x38c946,_0xa7f9('0x2a'));}catch(_0x26200d){logger['error'](_0x26200d);}logger['info'](_0xa7f9('0x47'),_0x38c946['split']('.')[0x0]);return _0x38c946[_0xa7f9('0x38')]('.')[0x0];});};exports[_0xa7f9('0x48')]=function(_0x474057,_0x28d45f,_0x4a069b){return google[_0xa7f9('0x49')](_0x474057,_0x28d45f,_0x4a069b)[_0xa7f9('0x28')](function(_0x33afc6){logger[_0xa7f9('0x18')](_0x33afc6[_0xa7f9('0x4a')]);return rp(_0x33afc6);})[_0xa7f9('0x28')](function(_0x5edd78){var _0x204d78='';var _0x374d86=0x0;try{fs[_0xa7f9('0x1a')](_0x474057);}catch(_0x2fc414){logger[_0xa7f9('0x12')](_0x2fc414);}if(_0x5edd78&&_0x5edd78['results']){_0x204d78=_0x5edd78[_0xa7f9('0x4b')][_0xa7f9('0x4c')](function(_0x362f50){return _0x362f50&&_0x362f50['alternatives'][0x0]&&_0x362f50[_0xa7f9('0x4d')][0x0]['transcript']?_0x362f50[_0xa7f9('0x4d')][0x0][_0xa7f9('0x4e')]:'';})[_0xa7f9('0x4f')]('\x0a');_0x374d86=_0x5edd78['results']['map'](function(_0x1bcfc4){return _0x1bcfc4&&_0x1bcfc4[_0xa7f9('0x4d')][0x0]&&_0x1bcfc4[_0xa7f9('0x4d')][0x0][_0xa7f9('0x50')]?_0x1bcfc4[_0xa7f9('0x4d')][0x0][_0xa7f9('0x50')]:0x0;})['join']('\x0a');}logger[_0xa7f9('0x18')](_0xa7f9('0x51'),_0x204d78);logger[_0xa7f9('0x18')](_0xa7f9('0x52'),_0x374d86);return{'transcript':_0x204d78,'confidence':_0x374d86};})[_0xa7f9('0x53')](function(_0x57c554){logger[_0xa7f9('0x12')](_0xa7f9('0x54'),_0x57c554[_0xa7f9('0x11')],_0x57c554[_0xa7f9('0x55')],_0x57c554['message']);});};exports[_0xa7f9('0x56')]=function(_0x182875,_0x2292b7,_0x2bdc77,_0x36e106){var _0x15435d=apiai(_0x2292b7,{'language':_0x36e106||'en'});return _0x15435d[_0xa7f9('0x57')](_0x2bdc77,{'sessionId':md5(_0x182875)})[_0xa7f9('0x28')](function(_0x10ce70){logger[_0xa7f9('0x18')](JSON[_0xa7f9('0x3e')](_0x10ce70));return{'source':_0x10ce70[_0xa7f9('0x58')]['source'],'resolvedQuery':_0x10ce70[_0xa7f9('0x58')]['resolvedQuery'],'action':_0x10ce70[_0xa7f9('0x58')][_0xa7f9('0x59')],'actionIncomplete':_0x10ce70['result'][_0xa7f9('0x5a')],'speech':_0x10ce70[_0xa7f9('0x58')]['fulfillment'][_0xa7f9('0x5b')],'score':_0x10ce70[_0xa7f9('0x58')][_0xa7f9('0x5c')],'statusCode':_0x10ce70[_0xa7f9('0x5d')][_0xa7f9('0x5e')],'endConversation':_0x10ce70[_0xa7f9('0x58')][_0xa7f9('0x5f')][_0xa7f9('0x60')]||![],'isFallbackIntent':_0x10ce70['result'][_0xa7f9('0x5f')][_0xa7f9('0x61')]};});};exports[_0xa7f9('0x62')]=function(_0x1ee3e3,_0x2198a4,_0x5f5109,_0x2c9434,_0xd5f1cf,_0x54c7e6){var _0x4c58b7=_0x2c9434[_0xa7f9('0x63')](/\\n/g,'\x0a');var _0xc37b12={'credentials':{'private_key':_0x4c58b7,'client_email':_0x5f5109}};var _0x2abad8=new dialogflow[(_0xa7f9('0x64'))](_0xc37b12);var _0x4eaf98=_0x2abad8[_0xa7f9('0x65')](_0x2198a4,md5(_0x1ee3e3));var _0xf509e7={'session':_0x4eaf98,'queryInput':{'text':{'text':_0xd5f1cf,'languageCode':_0x54c7e6}}};return _0x2abad8['detectIntent'](_0xf509e7)[_0xa7f9('0x28')](function(_0x32afdb){if(_0x32afdb&&_0x32afdb[_0xa7f9('0x43')]){logger[_0xa7f9('0x18')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x32afdb));var _0x2801ee=_0x32afdb[0x0];if(_0x2801ee){var _0x2ba12f={'action':_0x2801ee[_0xa7f9('0x66')]['action'],'allRequiredParamsPresent':_0x2801ee[_0xa7f9('0x66')]['allRequiredParamsPresent'],'endConversation':_0x2801ee['queryResult']['diagnosticInfo']&&_0x2801ee[_0xa7f9('0x66')]['diagnosticInfo'][_0xa7f9('0x67')]?_0x2801ee[_0xa7f9('0x66')][_0xa7f9('0x68')]['fields'][_0xa7f9('0x69')][_0xa7f9('0x6a')]:![],'fulfillmentText':_0x2801ee[_0xa7f9('0x66')][_0xa7f9('0x6b')],'intentName':_0x2801ee[_0xa7f9('0x66')]['intent']['name'],'intentDisplayName':_0x2801ee[_0xa7f9('0x66')][_0xa7f9('0x6c')]['displayName'],'isFallbackIntent':_0x2801ee[_0xa7f9('0x66')][_0xa7f9('0x6c')][_0xa7f9('0x6d')],'languageCode':_0x2801ee['queryResult'][_0xa7f9('0x6e')],'queryText':_0x2801ee[_0xa7f9('0x66')]['queryText'],'responseId':_0x2801ee['responseId'],'score':_0x2801ee[_0xa7f9('0x66')]['intentDetectionConfidence'],'speech':_0x2801ee[_0xa7f9('0x66')][_0xa7f9('0x6b')],'providerResponse':JSON[_0xa7f9('0x3e')](_0x32afdb)};return _0x2ba12f;}}});};exports[_0xa7f9('0x6f')]=function(_0x53406a,_0x360c5c,_0x40d470,_0x2c7313){return tilde['asr'](_0x53406a,_0x360c5c,_0x40d470,_0x2c7313)[_0xa7f9('0x28')](function(_0x5d1bf9){try{fs[_0xa7f9('0x1a')](_0x53406a);}catch(_0x537aa8){logger['error'](_0x537aa8);}logger[_0xa7f9('0x18')]('Tilde\x20ASR\x20transcription',_0x5d1bf9[_0xa7f9('0x4e')]);logger['info']('Tilde\x20ASR\x20confidence',_0x5d1bf9['confidence']);return _0x5d1bf9;});};exports[_0xa7f9('0x70')]=function(_0x482022,_0x52f9c2,_0x4b3d92,_0x1da2da,_0x36d96f,_0x396e31){var _0x5a4f26=path[_0xa7f9('0x23')](__dirname,_0xa7f9('0x24'),rs[_0xa7f9('0x25')](0x4)+_0xa7f9('0x33'));var _0x3c68a8;return aws[_0xa7f9('0x71')](_0x482022,_0x52f9c2,_0x4b3d92,_0x1da2da,_0x36d96f,_0x396e31,_0x5a4f26)[_0xa7f9('0x28')](function(){_0x3c68a8=path[_0xa7f9('0x23')](__dirname,_0xa7f9('0x24'),rs[_0xa7f9('0x25')](0x4)+'.wav');return convertFile(_0x5a4f26,_0x3c68a8);})['then'](function(){try{fs[_0xa7f9('0x1a')](_0x5a4f26);fs[_0xa7f9('0x29')](_0x3c68a8,_0xa7f9('0x2a'));}catch(_0x208b95){logger['error'](_0x208b95);}return _0x3c68a8[_0xa7f9('0x38')]('.')[0x0];});};exports[_0xa7f9('0x72')]=function(_0x5cac67,_0x5892df,_0x5a0a67,_0x40a4ff,_0x4840db,_0x37f9ba){return aws['lex'](_0x5cac67,_0x5892df,_0x5a0a67,_0x40a4ff,_0x4840db,_0x37f9ba)[_0xa7f9('0x28')](function(_0x44e3f7){logger[_0xa7f9('0x18')](JSON[_0xa7f9('0x3e')](_0x44e3f7));return _0x44e3f7;});};exports[_0xa7f9('0x73')]=function(_0x37cfdd,_0x267e06,_0x49f290,_0xd5df63){var _0x2443d7=util[_0xa7f9('0x74')](_0xa7f9('0x75'),ISPEECH_API,_0x37cfdd,encodeURIComponent(_0x267e06),_0x49f290,_0xd5df63);var _0x57b1b9=path['resolve'](__dirname,'tmp',rs[_0xa7f9('0x25')](0x4)+_0xa7f9('0x33'));var _0x14dbbb;return downloadFile(_0x2443d7,_0x57b1b9)['then'](function(){_0x14dbbb=path[_0xa7f9('0x23')](__dirname,_0xa7f9('0x24'),rs[_0xa7f9('0x25')](0x4)+'.wav');return convertFile(_0x57b1b9,_0x14dbbb);})[_0xa7f9('0x28')](function(){try{fs[_0xa7f9('0x1a')](_0x57b1b9);fs[_0xa7f9('0x29')](_0x14dbbb,'777');}catch(_0x36f382){logger[_0xa7f9('0x12')](_0x36f382);}return _0x14dbbb[_0xa7f9('0x38')]('.')[0x0];});};exports[_0xa7f9('0x76')]=function(_0x1a6038,_0x1c5d43,_0x536e22,_0x13ed94){var _0x10f3eb=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1c5d43,_0x536e22,base64Encode(_0x1a6038),_0x13ed94?util[_0xa7f9('0x74')]('model=%s',encodeURIComponent(_0x13ed94)):_0xa7f9('0x77'));return uploadFile(_0x10f3eb)[_0xa7f9('0x28')](function(_0x84a4d1){return querystring[_0xa7f9('0x6')](_0x84a4d1);});};exports[_0xa7f9('0x78')]=function(_0x9a6b8,_0x20b03d){return sestek[_0xa7f9('0x79')](_0x9a6b8,_0x20b03d)['then'](function(_0x597805){logger[_0xa7f9('0x18')](JSON['stringify'](_0x597805));var _0x2a7bf7={'speech':_0x597805[_0xa7f9('0x7a')],'action':_0x597805[_0xa7f9('0x7b')]?_0x597805[_0xa7f9('0x7b')][_0xa7f9('0x7c')]:undefined,'actiondata':_0x597805[_0xa7f9('0x7b')]?_0x597805[_0xa7f9('0x7b')][_0xa7f9('0x7d')]:undefined};if(_0x597805[_0xa7f9('0x7b')]&&_0x597805[_0xa7f9('0x7b')][_0xa7f9('0x7e')]){return base64Decode(_0x597805[_0xa7f9('0x7b')][_0xa7f9('0x7e')][_0xa7f9('0x7f')],path[_0xa7f9('0x23')](__dirname,_0xa7f9('0x24'),rs['generate'](0x4)+_0xa7f9('0x26')))[_0xa7f9('0x28')](function(_0x32d38b){_0x2a7bf7[_0xa7f9('0x80')]=_0x32d38b;return _0x2a7bf7;});}return _0x2a7bf7;});};exports[_0xa7f9('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0x5616=['%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','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./aws','./sestek','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','pipe','end','get','data','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','base64','then','chmodSync','777','split','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','tmp','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','writeFileSync','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','source','result','actionIncomplete','fulfillment','speech','score','code','endConversation','metadata','isFallbackIntent','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5616,0x19e));var _0x6561=function(_0x2b58f8,_0x14f865){_0x2b58f8=_0x2b58f8-0x0;var _0x2af05b=_0x5616[_0x2b58f8];return _0x2af05b;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x6561('0x0'));var dialogflow=require(_0x6561('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x6561('0x2'));var md5=require(_0x6561('0x3'));var path=require(_0x6561('0x4'));var querystring=require(_0x6561('0x5'));var rp=require(_0x6561('0x6'));var rs=require(_0x6561('0x7'));var sox=require('sox');var tts=require(_0x6561('0x8'));var urlParse=require(_0x6561('0x9'))[_0x6561('0xa')];var util=require(_0x6561('0xb'));var aws=require(_0x6561('0xc'));var google=require('./google');var sestek=require(_0x6561('0xd'));var tilde=require('./tilde');var logger=require(_0x6561('0xe'))(_0x6561('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x477981,_0x586170){return new BPromise(function(_0x11a4db,_0x116a47){var _0x40f57f=urlParse(_0x477981);var _0x13a89c=_0x40f57f[_0x6561('0x10')]===_0x6561('0x11')?https:http;var _0x4296c9={'host':_0x40f57f[_0x6561('0x12')],'path':_0x40f57f[_0x6561('0x4')],'headers':{'user-agent':_0x6561('0x13')}};_0x13a89c['get'](_0x4296c9,function(_0xd78eee){if(_0xd78eee[_0x6561('0x14')]!==0xc8){logger[_0x6561('0x15')](_0x6561('0x16')+_0x477981+_0x6561('0x17')+_0xd78eee[_0x6561('0x14')]+'\x20('+_0xd78eee[_0x6561('0x18')]+')');_0x116a47(new Error(_0x6561('0x16')+_0x477981+_0x6561('0x17')+_0xd78eee[_0x6561('0x14')]+'\x20('+_0xd78eee['statusMessage']+')'));return;}var _0x454b69=fs['createWriteStream'](_0x586170);_0x454b69['on'](_0x6561('0x19'),function(){logger[_0x6561('0x1a')](_0x6561('0x1b'));_0x454b69[_0x6561('0x1c')](_0x11a4db);});_0x454b69['on'](_0x6561('0x15'),function(_0x29687e){fs[_0x6561('0x1d')](_0x586170);logger[_0x6561('0x15')]('download\x20error',_0x29687e);_0x116a47(_0x29687e);});_0xd78eee[_0x6561('0x1e')](_0x454b69);})['on'](_0x6561('0x15'),function(_0x14b12a){logger[_0x6561('0x15')](_0x14b12a);_0x116a47(_0x14b12a);})[_0x6561('0x1f')]();});}function uploadFile(_0x1e0428){return new BPromise(function(_0x6a757a,_0xfcef9d){var _0x243d82=urlParse(_0x1e0428);var _0x2135b0=_0x243d82[_0x6561('0x10')]===_0x6561('0x11')?https:http;var _0x8c4db9={'host':_0x243d82['host'],'path':_0x243d82['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x2135b0[_0x6561('0x20')](_0x8c4db9,function(_0x4dbbff){if(_0x4dbbff[_0x6561('0x14')]!==0xc8){_0xfcef9d(new Error('request\x20to\x20'+_0x1e0428+_0x6561('0x17')+_0x4dbbff[_0x6561('0x14')]+'\x20('+_0x4dbbff[_0x6561('0x18')]+')'));return;}var _0x885362='';_0x4dbbff['on'](_0x6561('0x21'),function(_0x3a41c0){_0x885362+=_0x3a41c0;});_0x4dbbff['on'](_0x6561('0x1f'),function(){_0x6a757a(_0x885362);});})['on'](_0x6561('0x15'),function(_0x321363){_0xfcef9d(_0x321363);})[_0x6561('0x1f')]();});}function convertFile(_0x2d6dc7,_0x975180){return new BPromise(function(_0x52e111,_0x58ea22){var _0x35636b=sox['transcode'](_0x2d6dc7,_0x975180,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x35636b['on'](_0x6561('0x15'),function(_0x4f6511){logger[_0x6561('0x15')](_0x6561('0x22'),_0x4f6511);_0x58ea22(_0x4f6511);});_0x35636b['on'](_0x6561('0x1f'),function(){logger[_0x6561('0x1a')](_0x6561('0x23'));_0x52e111();});_0x35636b[_0x6561('0x24')]();});}function base64Decode(_0x16cdb2,_0x422b02){var _0x11ab55=path[_0x6561('0x25')](__dirname,'tmp',rs[_0x6561('0x26')](0x4)+_0x6561('0x27'));fs['writeFileSync'](_0x11ab55,_0x16cdb2,_0x6561('0x28'));return convertFile(_0x11ab55,_0x422b02)[_0x6561('0x29')](function(){try{fs[_0x6561('0x1d')](_0x11ab55);fs[_0x6561('0x2a')](_0x422b02,_0x6561('0x2b'));}catch(_0x39edd6){logger[_0x6561('0x15')](_0x39edd6);}return _0x422b02[_0x6561('0x2c')]('.')[0x0];});}function base64Encode(_0x1c40b7){var _0x3dbd48=fs['readFileSync'](_0x1c40b7);return new Buffer(_0x3dbd48)['toString'](_0x6561('0x28'));}exports[_0x6561('0x2d')]=function(_0x40cdc8,_0x45814f,_0x55d9ff,_0xa4a45,_0x2eed76,_0x20f74a){var _0x7523b4,_0x1021cf;var _0x791e5c=_0x6561('0x2e');var _0x41f70e=_0x6561('0x2f')+_0x40cdc8;var _0x4dceb0={};if(_0x45814f===_0x6561('0x30')){_0x4dceb0[_0x6561('0x31')]={'ssml':_0x55d9ff};}else{_0x4dceb0[_0x6561('0x31')]={'text':_0x55d9ff};};_0x4dceb0[_0x6561('0x32')]={'languageCode':_0xa4a45,'ssmlGender':_0x2eed76};_0x4dceb0[_0x6561('0x33')]={'audioEncoding':_0x6561('0x34'),'sampleRateHertz':0x1f40};var _0x46b608={'url':_0x791e5c+'text:synthesize'+_0x41f70e,'method':_0x6561('0x35'),'json':!![],'body':_0x4dceb0};return rp(_0x46b608)[_0x6561('0x29')](function(_0x1404d3){return new BPromise(function(_0x4ebab9,_0x2d7776){_0x7523b4=path['resolve'](__dirname,_0x6561('0x36'),rs[_0x6561('0x26')](0x4)+'.mp3');var _0x747505=Buffer['from'](_0x1404d3['audioContent'],'base64');return fs[_0x6561('0x37')](_0x7523b4,_0x747505,function(_0x4f7020){_0x2d7776(_0x4f7020);},function(_0x4fb021){fs[_0x6561('0x2a')](_0x7523b4,_0x6561('0x2b'));_0x4ebab9(_0x4fb021);});});})[_0x6561('0x29')](function(_0x3a54ae){_0x1021cf=path[_0x6561('0x25')](__dirname,_0x6561('0x36'),rs[_0x6561('0x26')](0x4)+'.wav');return convertFile(_0x7523b4,_0x1021cf);})[_0x6561('0x29')](function(){try{fs[_0x6561('0x1d')](_0x7523b4);fs[_0x6561('0x2a')](_0x1021cf,_0x6561('0x2b'));}catch(_0x45cf02){logger[_0x6561('0x15')](_0x45cf02);}logger[_0x6561('0x1a')](_0x6561('0x38'),_0x1021cf['split']('.')[0x0]);return _0x1021cf[_0x6561('0x2c')]('.')[0x0];});};exports[_0x6561('0x39')]=function(_0x246c9c,_0x2d05ad){var _0x3bd31e=_0x6561('0x3a');var _0x56d37a,_0x580f16;var _0x1f445b;var _0x5a434c={'encoding':_0x6561('0x3b'),'method':_0x6561('0x35'),'timeout':0x2710,'url':_0x3bd31e,'headers':{'Content-Type':_0x6561('0x3c')},'body':'f.req='+encodeURIComponent(JSON[_0x6561('0x3d')]([[[_0x6561('0x3e'),JSON[_0x6561('0x3d')]([_0x246c9c,_0x2d05ad||'en',![],_0x6561('0x3f')]),null,_0x6561('0x40')]]]))};return rp(_0x5a434c)[_0x6561('0x29')](function(_0x5a47ac){try{_0x1f445b=eval(_0x5a47ac['slice'](0x5))[0x0][0x2];}catch(_0x5f4f80){throw new Error('parse\x20response\x20failed:\x0a'+_0x5a47ac[_0x6561('0x21')]);}if(!_0x1f445b){if(_0x246c9c['length']>0xc8){throw new Error(_0x6561('0x41'));}else{throw new Error('lang\x20\x22'+_0x2d05ad+_0x6561('0x42'));}}try{_0x1f445b=eval(_0x1f445b)[0x0];}catch(_0x496333){throw new Error(_0x6561('0x43')+res[_0x6561('0x21')]);}const _0x4a9e09=_0x1f445b;_0x56d37a=path['resolve'](__dirname,_0x6561('0x36'),rs['generate'](0x4)+_0x6561('0x44'));fs[_0x6561('0x45')](_0x56d37a,_0x1f445b,{'encoding':_0x6561('0x28')});_0x580f16=path[_0x6561('0x25')](__dirname,_0x6561('0x36'),rs['generate'](0x4)+_0x6561('0x27'));return convertFile(_0x56d37a,_0x580f16);})[_0x6561('0x29')](function(){try{fs[_0x6561('0x1d')](_0x56d37a);fs[_0x6561('0x2a')](_0x580f16,'777');}catch(_0x27fe4d){logger['error'](_0x27fe4d);}logger[_0x6561('0x1a')](_0x6561('0x46'),_0x580f16[_0x6561('0x2c')]('.')[0x0]);return _0x580f16[_0x6561('0x2c')]('.')[0x0];});};exports[_0x6561('0x47')]=function(_0x11e905,_0x5db027,_0x3ea8ef){return google['asr'](_0x11e905,_0x5db027,_0x3ea8ef)[_0x6561('0x29')](function(_0x11e47d){logger['info'](_0x11e47d[_0x6561('0x48')]);return rp(_0x11e47d);})['then'](function(_0x149b90){var _0x32e24b='';var _0x3a59d4=0x0;try{fs[_0x6561('0x1d')](_0x11e905);}catch(_0x388e21){logger[_0x6561('0x15')](_0x388e21);}if(_0x149b90&&_0x149b90[_0x6561('0x49')]){_0x32e24b=_0x149b90[_0x6561('0x49')][_0x6561('0x4a')](function(_0x43a4a4){return _0x43a4a4&&_0x43a4a4[_0x6561('0x4b')][0x0]&&_0x43a4a4[_0x6561('0x4b')][0x0][_0x6561('0x4c')]?_0x43a4a4[_0x6561('0x4b')][0x0][_0x6561('0x4c')]:'';})[_0x6561('0x4d')]('\x0a');_0x3a59d4=_0x149b90[_0x6561('0x49')][_0x6561('0x4a')](function(_0x215beb){return _0x215beb&&_0x215beb['alternatives'][0x0]&&_0x215beb[_0x6561('0x4b')][0x0][_0x6561('0x4e')]?_0x215beb[_0x6561('0x4b')][0x0][_0x6561('0x4e')]:0x0;})[_0x6561('0x4d')]('\x0a');}logger[_0x6561('0x1a')](_0x6561('0x4f'),_0x32e24b);logger[_0x6561('0x1a')](_0x6561('0x50'),_0x3a59d4);return{'transcript':_0x32e24b,'confidence':_0x3a59d4};})['catch'](function(_0x3684e1){logger['error'](_0x6561('0x51'),_0x3684e1[_0x6561('0x14')],_0x3684e1[_0x6561('0x52')],_0x3684e1[_0x6561('0x53')]);});};exports['googleDialogflow']=function(_0x31a4ec,_0x24476f,_0x275af3,_0x7893a6){var _0x217b73=apiai(_0x24476f,{'language':_0x7893a6||'en'});return _0x217b73[_0x6561('0x54')](_0x275af3,{'sessionId':md5(_0x31a4ec)})[_0x6561('0x29')](function(_0xed1b60){logger['info'](JSON['stringify'](_0xed1b60));return{'source':_0xed1b60['result'][_0x6561('0x55')],'resolvedQuery':_0xed1b60[_0x6561('0x56')]['resolvedQuery'],'action':_0xed1b60[_0x6561('0x56')]['action'],'actionIncomplete':_0xed1b60['result'][_0x6561('0x57')],'speech':_0xed1b60[_0x6561('0x56')][_0x6561('0x58')][_0x6561('0x59')],'score':_0xed1b60[_0x6561('0x56')][_0x6561('0x5a')],'statusCode':_0xed1b60['status'][_0x6561('0x5b')],'endConversation':_0xed1b60[_0x6561('0x56')]['metadata'][_0x6561('0x5c')]||![],'isFallbackIntent':_0xed1b60[_0x6561('0x56')][_0x6561('0x5d')][_0x6561('0x5e')]};});};exports['googleDialogflowV2']=function(_0x37648f,_0x676e44,_0x57c9a6,_0x2e161c,_0x504e36,_0x1eef8b){var _0x41c614=_0x2e161c['replace'](/\\n/g,'\x0a');var _0x36f93d={'credentials':{'private_key':_0x41c614,'client_email':_0x57c9a6}};var _0x296f7f=new dialogflow[(_0x6561('0x5f'))](_0x36f93d);var _0x5e5170=_0x296f7f['sessionPath'](_0x676e44,md5(_0x37648f));var _0x20a24b={'session':_0x5e5170,'queryInput':{'text':{'text':_0x504e36,'languageCode':_0x1eef8b}}};return _0x296f7f[_0x6561('0x60')](_0x20a24b)[_0x6561('0x29')](function(_0x11047e){if(_0x11047e&&_0x11047e[_0x6561('0x61')]){logger[_0x6561('0x1a')](_0x6561('0x62'),JSON[_0x6561('0x3d')](_0x11047e));var _0x487bb8=_0x11047e[0x0];if(_0x487bb8){var _0x44908e={'action':_0x487bb8[_0x6561('0x63')][_0x6561('0x64')],'allRequiredParamsPresent':_0x487bb8[_0x6561('0x63')][_0x6561('0x65')],'endConversation':_0x487bb8[_0x6561('0x63')][_0x6561('0x66')]&&_0x487bb8['queryResult'][_0x6561('0x66')][_0x6561('0x67')]?_0x487bb8[_0x6561('0x63')]['diagnosticInfo'][_0x6561('0x67')][_0x6561('0x68')][_0x6561('0x69')]:![],'fulfillmentText':_0x487bb8[_0x6561('0x63')][_0x6561('0x6a')],'intentName':_0x487bb8['queryResult'][_0x6561('0x6b')][_0x6561('0x52')],'intentDisplayName':_0x487bb8[_0x6561('0x63')]['intent'][_0x6561('0x6c')],'isFallbackIntent':_0x487bb8[_0x6561('0x63')][_0x6561('0x6b')][_0x6561('0x6d')],'languageCode':_0x487bb8[_0x6561('0x63')][_0x6561('0x6e')],'queryText':_0x487bb8['queryResult']['queryText'],'responseId':_0x487bb8[_0x6561('0x6f')],'score':_0x487bb8[_0x6561('0x63')][_0x6561('0x70')],'speech':_0x487bb8[_0x6561('0x63')][_0x6561('0x6a')],'providerResponse':JSON[_0x6561('0x3d')](_0x11047e)};return _0x44908e;}}});};exports[_0x6561('0x71')]=function(_0xfdf824,_0x30e2a1,_0x17de17,_0x417bbd){return tilde[_0x6561('0x72')](_0xfdf824,_0x30e2a1,_0x17de17,_0x417bbd)['then'](function(_0x5dc704){try{fs[_0x6561('0x1d')](_0xfdf824);}catch(_0x215799){logger['error'](_0x215799);}logger[_0x6561('0x1a')](_0x6561('0x73'),_0x5dc704[_0x6561('0x4c')]);logger[_0x6561('0x1a')](_0x6561('0x74'),_0x5dc704[_0x6561('0x4e')]);return _0x5dc704;});};exports[_0x6561('0x75')]=function(_0x1ec355,_0x22b23b,_0xa05949,_0x2c68fc,_0x323b60,_0x52bd9d){var _0x4c48a9=path[_0x6561('0x25')](__dirname,_0x6561('0x36'),rs[_0x6561('0x26')](0x4)+'.mp3');var _0x412b10;return aws['polly'](_0x1ec355,_0x22b23b,_0xa05949,_0x2c68fc,_0x323b60,_0x52bd9d,_0x4c48a9)[_0x6561('0x29')](function(){_0x412b10=path[_0x6561('0x25')](__dirname,_0x6561('0x36'),rs[_0x6561('0x26')](0x4)+'.wav');return convertFile(_0x4c48a9,_0x412b10);})['then'](function(){try{fs[_0x6561('0x1d')](_0x4c48a9);fs[_0x6561('0x2a')](_0x412b10,'777');}catch(_0x5c88e2){logger[_0x6561('0x15')](_0x5c88e2);}return _0x412b10[_0x6561('0x2c')]('.')[0x0];});};exports[_0x6561('0x76')]=function(_0x3202c6,_0x10e198,_0x1b5440,_0x51e203,_0x3ca2e1,_0x6057ca){return aws[_0x6561('0x77')](_0x3202c6,_0x10e198,_0x1b5440,_0x51e203,_0x3ca2e1,_0x6057ca)[_0x6561('0x29')](function(_0x2911e2){logger[_0x6561('0x1a')](JSON[_0x6561('0x3d')](_0x2911e2));return _0x2911e2;});};exports[_0x6561('0x78')]=function(_0x81f1a7,_0x16f27e,_0xc29b7b,_0x39c3b4){var _0x3fb707=util[_0x6561('0x79')](_0x6561('0x7a'),ISPEECH_API,_0x81f1a7,encodeURIComponent(_0x16f27e),_0xc29b7b,_0x39c3b4);var _0x93f9e6=path[_0x6561('0x25')](__dirname,_0x6561('0x36'),rs['generate'](0x4)+_0x6561('0x44'));var _0x2bd7b6;return downloadFile(_0x3fb707,_0x93f9e6)[_0x6561('0x29')](function(){_0x2bd7b6=path['resolve'](__dirname,_0x6561('0x36'),rs[_0x6561('0x26')](0x4)+_0x6561('0x27'));return convertFile(_0x93f9e6,_0x2bd7b6);})[_0x6561('0x29')](function(){try{fs['unlink'](_0x93f9e6);fs[_0x6561('0x2a')](_0x2bd7b6,'777');}catch(_0x29be7a){logger[_0x6561('0x15')](_0x29be7a);}return _0x2bd7b6[_0x6561('0x2c')]('.')[0x0];});};exports[_0x6561('0x7b')]=function(_0x5ad0d1,_0x5bc4ea,_0x20476f,_0xf8448b){var _0x1981c1=util[_0x6561('0x79')](_0x6561('0x7c'),ISPEECH_API,_0x5bc4ea,_0x20476f,base64Encode(_0x5ad0d1),_0xf8448b?util[_0x6561('0x79')](_0x6561('0x7d'),encodeURIComponent(_0xf8448b)):'freeform=3');return uploadFile(_0x1981c1)[_0x6561('0x29')](function(_0x37dfc0){return querystring['parse'](_0x37dfc0);});};exports['sestekNDA']=function(_0x324b6b,_0x146d4f){return sestek[_0x6561('0x7e')](_0x324b6b,_0x146d4f)['then'](function(_0x37962e){logger[_0x6561('0x1a')](JSON[_0x6561('0x3d')](_0x37962e));var _0x3c27a5={'speech':_0x37962e[_0x6561('0x7f')],'action':_0x37962e['channelData']?_0x37962e[_0x6561('0x80')][_0x6561('0x81')]:undefined,'actiondata':_0x37962e['channelData']?_0x37962e[_0x6561('0x80')][_0x6561('0x82')]:undefined};if(_0x37962e['channelData']&&_0x37962e[_0x6561('0x80')][_0x6561('0x83')]){return base64Decode(_0x37962e[_0x6561('0x80')][_0x6561('0x83')][_0x6561('0x84')],path[_0x6561('0x25')](__dirname,_0x6561('0x36'),rs[_0x6561('0x26')](0x4)+'.wav'))['then'](function(_0x512879){_0x3c27a5[_0x6561('0x85')]=_0x512879;return _0x3c27a5;});}return _0x3c27a5;});};exports['dirName']=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 eaa06d1..bffc237 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 _0x2d0c=['exports','./nda'];(function(_0x22656e,_0x1163dc){var _0x3e4255=function(_0x200a38){while(--_0x200a38){_0x22656e['push'](_0x22656e['shift']());}};_0x3e4255(++_0x1163dc);}(_0x2d0c,0x1c9));var _0xc2d0=function(_0x36d8d9,_0x17b58a){_0x36d8d9=_0x36d8d9-0x0;var _0x1ac3a2=_0x2d0c[_0x36d8d9];return _0x1ac3a2;};var nda=require(_0xc2d0('0x0'));module[_0xc2d0('0x1')]={'nda':nda}; \ No newline at end of file +var _0xc433=['exports','./nda'];(function(_0x1c7878,_0x2132d7){var _0x5395a5=function(_0x28f62e){while(--_0x28f62e){_0x1c7878['push'](_0x1c7878['shift']());}};_0x5395a5(++_0x2132d7);}(_0xc433,0x1a9));var _0x3c43=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xc433[_0x521929];return _0x632436;};var nda=require(_0x3c43('0x0'));module[_0x3c43('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 3a9e266..d7f18eb 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 _0xc577=['username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','request-promise','agi','exports','POST','resolve','/token','password'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc577,0x172));var _0x7c57=function(_0x1cbc47,_0x58b1e4){_0x1cbc47=_0x1cbc47-0x0;var _0x2759ff=_0xc577[_0x1cbc47];return _0x2759ff;};'use strict';var rp=require(_0x7c57('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x7c57('0x1'));module[_0x7c57('0x2')]=function(_0xe9a500,_0x2a2415){var _0x3abdb2={'method':_0x7c57('0x3'),'uri':url[_0x7c57('0x4')](_0x2a2415['ndauth_url'],_0x7c57('0x5')),'form':{'grant_type':_0x7c57('0x6'),'username':_0x2a2415[_0x7c57('0x7')],'password':_0x2a2415[_0x7c57('0x6')]},'json':!![]};return rp(_0x3abdb2)[_0x7c57('0x8')](function(_0x4bb81b){var _0x4e5cb2={'method':'POST','uri':url[_0x7c57('0x4')](_0x2a2415['ndassistant_url'],_0x7c57('0x9')),'body':{'type':_0x2a2415[_0x7c57('0xa')]||_0x7c57('0xb'),'channelId':_0x7c57('0xc'),'conversation':{'id':_0xe9a500['uniqueid']},'from':{'id':_0xe9a500[_0x7c57('0xd')],'name':_0xe9a500[_0x7c57('0xe')]},'recipient':{'id':_0xe9a500['dnid'],'name':_0xe9a500[_0x7c57('0xf')]},'text':_0x2a2415[_0x7c57('0x10')],'channelData':{}},'headers':{'Authorization':_0x7c57('0x11')+_0x4bb81b[_0x7c57('0x12')]},'json':!![]};if(_0x2a2415[_0x7c57('0x13')]){_0x4e5cb2[_0x7c57('0x14')][_0x7c57('0x15')]['ProjectName']=_0x2a2415['project'];}if(_0x2a2415['ndagenerate_audio']=='1'){_0x4e5cb2[_0x7c57('0x14')][_0x7c57('0x15')][_0x7c57('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7c57('0x17')};}if(_0x2a2415[_0x7c57('0x18')]){_0x4e5cb2[_0x7c57('0x14')][_0x7c57('0x15')][_0x7c57('0x19')]=_0x2a2415['custom_action'];if(_0x2a2415['custom_action_data']){_0x4e5cb2[_0x7c57('0x14')][_0x7c57('0x15')][_0x7c57('0x1a')]=_0x2a2415[_0x7c57('0x1b')];}}logger[_0x7c57('0x1c')](JSON['stringify'](_0x4e5cb2));return rp(_0x4e5cb2);});}; \ No newline at end of file +var _0x7035=['project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','../../../../../config/logger','agi','POST','resolve','/token','password','then','ndaactivity_type','Nda','calleridname','dnid','extension','Bearer\x20'];(function(_0x88435d,_0x1de21c){var _0x30ddcc=function(_0x373259){while(--_0x373259){_0x88435d['push'](_0x88435d['shift']());}};_0x30ddcc(++_0x1de21c);}(_0x7035,0x15e));var _0x5703=function(_0xd4371b,_0x3b2b6e){_0xd4371b=_0xd4371b-0x0;var _0x5e4fa3=_0x7035[_0xd4371b];return _0x5e4fa3;};'use strict';var rp=require(_0x5703('0x0'));var url=require('url');var logger=require(_0x5703('0x1'))(_0x5703('0x2'));module['exports']=function(_0xcc3f27,_0x4183e5){var _0x431dc3={'method':_0x5703('0x3'),'uri':url[_0x5703('0x4')](_0x4183e5['ndauth_url'],_0x5703('0x5')),'form':{'grant_type':_0x5703('0x6'),'username':_0x4183e5['username'],'password':_0x4183e5[_0x5703('0x6')]},'json':!![]};return rp(_0x431dc3)[_0x5703('0x7')](function(_0x401d33){var _0x291988={'method':_0x5703('0x3'),'uri':url[_0x5703('0x4')](_0x4183e5['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x4183e5[_0x5703('0x8')]||'message','channelId':_0x5703('0x9'),'conversation':{'id':_0xcc3f27['uniqueid']},'from':{'id':_0xcc3f27['callerid'],'name':_0xcc3f27[_0x5703('0xa')]},'recipient':{'id':_0xcc3f27[_0x5703('0xb')],'name':_0xcc3f27[_0x5703('0xc')]},'text':_0x4183e5['text'],'channelData':{}},'headers':{'Authorization':_0x5703('0xd')+_0x401d33['access_token']},'json':!![]};if(_0x4183e5[_0x5703('0xe')]){_0x291988[_0x5703('0xf')][_0x5703('0x10')][_0x5703('0x11')]=_0x4183e5[_0x5703('0xe')];}if(_0x4183e5[_0x5703('0x12')]=='1'){_0x291988[_0x5703('0xf')][_0x5703('0x10')][_0x5703('0x13')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5703('0x14')};}if(_0x4183e5[_0x5703('0x15')]){_0x291988['body'][_0x5703('0x10')][_0x5703('0x16')]=_0x4183e5[_0x5703('0x15')];if(_0x4183e5[_0x5703('0x17')]){_0x291988[_0x5703('0xf')][_0x5703('0x10')][_0x5703('0x18')]=_0x4183e5[_0x5703('0x17')];}}logger[_0x5703('0x19')](JSON['stringify'](_0x291988));return rp(_0x291988);});}; \ 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 a0cec18..19e57de 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 _0xdfb0=['exports'];(function(_0x316ee6,_0x10840d){var _0x114208=function(_0x5da6c7){while(--_0x5da6c7){_0x316ee6['push'](_0x316ee6['shift']());}};_0x114208(++_0x10840d);}(_0xdfb0,0x148));var _0x0dfb=function(_0x21dbdb,_0x466aa5){_0x21dbdb=_0x21dbdb-0x0;var _0x2b3c6f=_0xdfb0[_0x21dbdb];return _0x2b3c6f;};'use strict';var asr=require('./lib/api');module[_0x0dfb('0x0')]=function(_0x2dd20f,_0x43f1f2,_0x4b7f45,_0x537048){return asr(_0x2dd20f,_0x43f1f2,_0x4b7f45,_0x537048);}; \ No newline at end of file +var _0x3285=['./lib/api','exports'];(function(_0x34e461,_0x5c1242){var _0x513dfb=function(_0x58f66b){while(--_0x58f66b){_0x34e461['push'](_0x34e461['shift']());}};_0x513dfb(++_0x5c1242);}(_0x3285,0x146));var _0x5328=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x3285[_0x432fca];return _0x3adba4;};'use strict';var asr=require(_0x5328('0x0'));module[_0x5328('0x1')]=function(_0x19be44,_0x27e55e,_0x52af20,_0x1d4570){return asr(_0x19be44,_0x27e55e,_0x52af20,_0x1d4570);}; \ 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 40ef5b1..8ed36e2 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 _0x8b31=['status','result','final','hypotheses','transcript','likelihood','terminate','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','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','update','digest','hex','send','stringify','data','close','error','Tilde\x20ASR\x20send\x20error'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x8b31,0xa2));var _0x18b3=function(_0x6e07b,_0x54a6a1){_0x6e07b=_0x6e07b-0x0;var _0x4488d4=_0x8b31[_0x6e07b];return _0x4488d4;};'use strict';var BPromise=require(_0x18b3('0x0'));var _=require(_0x18b3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x18b3('0x2'));var crypto=require('crypto');var logger=require(_0x18b3('0x3'))(_0x18b3('0x4'));module[_0x18b3('0x5')]=function(_0x21bd7b,_0x2a1f2c,_0x457fdc,_0x34187d){return new BPromise(function(_0x2153da,_0x5a7060){logger[_0x18b3('0x6')](_0x18b3('0x7'),_0x34187d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x46330b=new WebSocket(_0x34187d||_0x18b3('0x8'),{'perMessageDeflate':![]});var _0x747b7a='';var _0x31094f='0';var _0x345c17='1';var _0x1acfb2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xcd12c7(_0x53cd67){var _0x14e350=crypto['createHash']('sha1');_0x14e350[_0x18b3('0x9')](_0x53cd67);return _0x14e350[_0x18b3('0xa')](_0x18b3('0xb'));}function _0xefcebc(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x29076e=moment()['unix']();var _0x4a6b71=_0xcd12c7(_0x29076e+_0x2a1f2c+_0x457fdc);_0x46330b[_0x18b3('0xc')](JSON[_0x18b3('0xd')]({'appID':_0x2a1f2c,'timestamp':_0x29076e,'appKey':_0x4a6b71}));var _0xaddd98=fs['createReadStream'](_0x21bd7b);_0xaddd98['on'](_0x18b3('0xe'),function(_0x44e145){_0x46330b[_0x18b3('0xc')](_0x44e145);});_0xaddd98['on'](_0x18b3('0xf'),function(){_0x46330b[_0x18b3('0xc')]('EOS');});}catch(_0x2d931c){logger[_0x18b3('0x10')](_0x18b3('0x11'),JSON['stringify'](_0x2d931c));_0x46330b['terminate']();}}function _0x25fd7b(_0x494d8d){try{if(_0x494d8d){var _0x3671fa=JSON['parse'](_0x494d8d);switch(_0x3671fa[_0x18b3('0x12')]){case 0x0:if(_0x3671fa['result']){if(_0x3671fa[_0x18b3('0x13')][_0x18b3('0x14')]){logger[_0x18b3('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0x18b3('0xd')](_0x3671fa[_0x18b3('0x13')]['hypotheses']));_0x747b7a=_0x3671fa[_0x18b3('0x13')][_0x18b3('0x15')][0x0][_0x18b3('0x16')];_0x31094f=_0x3671fa[_0x18b3('0x13')][_0x18b3('0x15')][0x0][_0x18b3('0x17')];_0x345c17='0';_0x1acfb2='Success.';_0x46330b[_0x18b3('0x18')]();}}break;case 0x1:logger['info'](_0x18b3('0x19'));_0x345c17='1';_0x1acfb2=_0x18b3('0x19');break;case 0x2:logger[_0x18b3('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x345c17='2';_0x1acfb2=_0x18b3('0x1a');break;case 0x9:logger[_0x18b3('0x6')](_0x18b3('0x1b'));_0x345c17='9';_0x1acfb2=_0x18b3('0x1b');break;case 0xa:logger[_0x18b3('0x6')](_0x18b3('0x1c'));_0x345c17='10';_0x1acfb2='Authentication\x20failed.';break;case 0xb:logger['info'](_0x18b3('0x1d'));_0x345c17='11';_0x1acfb2=_0x18b3('0x1d');}}}catch(_0xe4a12f){logger[_0x18b3('0x10')](_0x18b3('0x1e'),JSON['stringify'](_0xe4a12f));_0x46330b[_0x18b3('0x18')]();}}function _0x6ebe4a(){logger['info'](_0x18b3('0x1f'));_0x2153da({'transcript':_0x747b7a,'confidence':_0x31094f,'status':_0x345c17,'status_message':_0x1acfb2});}function _0x366e0c(_0x417b08){logger[_0x18b3('0x10')](_0x18b3('0x20'));if(!_[_0x18b3('0x21')](_0x417b08)){logger[_0x18b3('0x10')](_[_0x18b3('0x22')](_0x417b08)?JSON[_0x18b3('0xd')](_0x417b08):_0x417b08);}}_0x46330b['on']('open',_0xefcebc);_0x46330b['on'](_0x18b3('0x23'),_0x25fd7b);_0x46330b['on'](_0x18b3('0xf'),_0x6ebe4a);_0x46330b['on'](_0x18b3('0x10'),_0x366e0c);});}; \ No newline at end of file +var _0x6f26=['info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','digest','hex','unix','send','stringify','close','EOS','error','terminate','parse','status','result','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','lodash','moment','crypto','../../../../../../config/logger','exports'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0x6f26,0xcd));var _0x66f2=function(_0x1a2ebe,_0x16326c){_0x1a2ebe=_0x1a2ebe-0x0;var _0x38831e=_0x6f26[_0x1a2ebe];return _0x38831e;};'use strict';var BPromise=require('bluebird');var _=require(_0x66f2('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x66f2('0x1'));var crypto=require(_0x66f2('0x2'));var logger=require(_0x66f2('0x3'))('agi');module[_0x66f2('0x4')]=function(_0x12979c,_0x4eb590,_0x42e307,_0x565eaa){return new BPromise(function(_0x396c10,_0x17422a){logger[_0x66f2('0x5')]('Tilde\x20URI',_0x565eaa||_0x66f2('0x6'));var _0x37b3c1=new WebSocket(_0x565eaa||_0x66f2('0x6'),{'perMessageDeflate':![]});var _0x5b92fc='';var _0x2b4433='0';var _0x1e0fd6='1';var _0x2e4f56=_0x66f2('0x7');function _0x334a7f(_0x3588ac){var _0x62c445=crypto['createHash'](_0x66f2('0x8'));_0x62c445['update'](_0x3588ac);return _0x62c445[_0x66f2('0x9')](_0x66f2('0xa'));}function _0x43da1e(){try{logger[_0x66f2('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x2218f3=moment()[_0x66f2('0xb')]();var _0x3df00d=_0x334a7f(_0x2218f3+_0x4eb590+_0x42e307);_0x37b3c1[_0x66f2('0xc')](JSON[_0x66f2('0xd')]({'appID':_0x4eb590,'timestamp':_0x2218f3,'appKey':_0x3df00d}));var _0x569403=fs['createReadStream'](_0x12979c);_0x569403['on']('data',function(_0x29e292){_0x37b3c1['send'](_0x29e292);});_0x569403['on'](_0x66f2('0xe'),function(){_0x37b3c1['send'](_0x66f2('0xf'));});}catch(_0x5e26d){logger[_0x66f2('0x10')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x5e26d));_0x37b3c1[_0x66f2('0x11')]();}}function _0x4c333b(_0x2b4aaa){try{if(_0x2b4aaa){var _0x890efa=JSON[_0x66f2('0x12')](_0x2b4aaa);switch(_0x890efa[_0x66f2('0x13')]){case 0x0:if(_0x890efa['result']){if(_0x890efa[_0x66f2('0x14')]['final']){logger[_0x66f2('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x66f2('0xd')](_0x890efa[_0x66f2('0x14')][_0x66f2('0x15')]));_0x5b92fc=_0x890efa[_0x66f2('0x14')][_0x66f2('0x15')][0x0][_0x66f2('0x16')];_0x2b4433=_0x890efa['result']['hypotheses'][0x0][_0x66f2('0x17')];_0x1e0fd6='0';_0x2e4f56=_0x66f2('0x18');_0x37b3c1[_0x66f2('0x11')]();}}break;case 0x1:logger[_0x66f2('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1e0fd6='1';_0x2e4f56=_0x66f2('0x7');break;case 0x2:logger[_0x66f2('0x5')](_0x66f2('0x19'));_0x1e0fd6='2';_0x2e4f56='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x66f2('0x5')](_0x66f2('0x1a'));_0x1e0fd6='9';_0x2e4f56=_0x66f2('0x1a');break;case 0xa:logger[_0x66f2('0x5')](_0x66f2('0x1b'));_0x1e0fd6='10';_0x2e4f56=_0x66f2('0x1b');break;case 0xb:logger[_0x66f2('0x5')](_0x66f2('0x1c'));_0x1e0fd6='11';_0x2e4f56=_0x66f2('0x1c');}}}catch(_0x270b76){logger[_0x66f2('0x10')](_0x66f2('0x1d'),JSON[_0x66f2('0xd')](_0x270b76));_0x37b3c1[_0x66f2('0x11')]();}}function _0x168aba(){logger[_0x66f2('0x5')](_0x66f2('0x1e'));_0x396c10({'transcript':_0x5b92fc,'confidence':_0x2b4433,'status':_0x1e0fd6,'status_message':_0x2e4f56});}function _0x5a7588(_0x39b1ab){logger['error'](_0x66f2('0x1f'));if(!_[_0x66f2('0x20')](_0x39b1ab)){logger['error'](_[_0x66f2('0x21')](_0x39b1ab)?JSON[_0x66f2('0xd')](_0x39b1ab):_0x39b1ab);}}_0x37b3c1['on']('open',_0x43da1e);_0x37b3c1['on'](_0x66f2('0x22'),_0x4c333b);_0x37b3c1['on'](_0x66f2('0xe'),_0x168aba);_0x37b3c1['on']('error',_0x5a7588);});}; \ 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 c06bd92..9c294f4 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 _0xc519=['exports','./asr'];(function(_0x25b306,_0x566ec4){var _0x3040fb=function(_0x5af21c){while(--_0x5af21c){_0x25b306['push'](_0x25b306['shift']());}};_0x3040fb(++_0x566ec4);}(_0xc519,0x157));var _0x9c51=function(_0x245c4f,_0x34b70f){_0x245c4f=_0x245c4f-0x0;var _0x3157a1=_0xc519[_0x245c4f];return _0x3157a1;};var asr=require(_0x9c51('0x0'));module[_0x9c51('0x1')]={'asr':asr}; \ No newline at end of file +var _0xb5e0=['exports'];(function(_0xad921d,_0x4e852b){var _0x50a737=function(_0x38a1f4){while(--_0x38a1f4){_0xad921d['push'](_0xad921d['shift']());}};_0x50a737(++_0x4e852b);}(_0xb5e0,0x1c0));var _0x0b5e=function(_0x481557,_0x3333cc){_0x481557=_0x481557-0x0;var _0x102fbf=_0xb5e0[_0x481557];return _0x102fbf;};var asr=require('./asr');module[_0x0b5e('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c238ef7..10348df 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0xe706,0xa3));var _0x6e70=function(_0x282f96,_0x2be4be){_0x282f96=_0x282f96-0x0;var _0x12d02b=_0xe706[_0x282f96];return _0x12d02b;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 6eef193..252dadb 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 _0x7d80=['LOCAL','exec','replace','googleCloudTTS','text','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','ispeechASR','isConfigured','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','extra','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','callback_priority','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20query\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','dial','no\x20user\x20selected','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','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','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','getVoiceQueue','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','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','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','rawBody','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getUser','getTrunk','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','callerid','extension','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n'];(function(_0x37a6b2,_0xf3ce53){var _0x404a38=function(_0x16d9fe){while(--_0x16d9fe){_0x37a6b2['push'](_0x37a6b2['shift']());}};_0x404a38(++_0xf3ce53);}(_0x7d80,0x17a));var _0x07d8=function(_0x2a16b8,_0x592efc){_0x2a16b8=_0x2a16b8-0x0;var _0x165c6c=_0x7d80[_0x2a16b8];return _0x165c6c;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x07d8('0x0'));var sh=require(_0x07d8('0x1'));var odbc=require(_0x07d8('0x2'))();var rs=require(_0x07d8('0x3'));var moment=require(_0x07d8('0x4'));var Mustache=require(_0x07d8('0x5'));var rp=require('request-promise');var logger=require(_0x07d8('0x6'))('agi');var config=require(_0x07d8('0x7'));var shared=require(_0x07d8('0x8'));var scripts=require(_0x07d8('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x07d8('0xa')];var verticesWithRetry=['menu','getdigits','getsecretdigits'];var AGIVertices=function(_0x15c945,_0x2fb4a1,_0x52a662){this[_0x07d8('0xb')]=_0x15c945;this[_0x07d8('0xc')]=_0x2fb4a1;this[_0x07d8('0xd')]=_0x52a662;};AGIVertices[_0x07d8('0xe')][_0x07d8('0xf')]=function(_0x1544c4,_0xebdb23){this['rpc'][_0x07d8('0x10')](_0x1544c4)[_0x07d8('0x11')](function(_0x4411ca){_0xebdb23(null,_0x4411ca?_0x4411ca[_0x07d8('0x12')]:![]);})[_0x07d8('0x13')](function(_0x14ee4c){_0xebdb23(_0x14ee4c);});};AGIVertices[_0x07d8('0xe')]['getVoiceQueue']=function(_0x9e409b,_0x6d311c){this[_0x07d8('0xc')][_0x07d8('0x14')](_0x9e409b)[_0x07d8('0x11')](function(_0x14e931){_0x6d311c(null,_0x14e931?_0x14e931['name']:![]);})[_0x07d8('0x13')](function(_0x1bd568){_0x6d311c(_0x1bd568);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x15')]=function(_0x33da80,_0x4ea297){this[_0x07d8('0xc')][_0x07d8('0x16')](_0x33da80)['then'](function(_0x7fa5f3){_0x4ea297(null,_0x7fa5f3?_0x7fa5f3[_0x07d8('0x12')]:![]);})[_0x07d8('0x13')](function(_0x1f5b69){_0x4ea297(_0x1f5b69);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x17')]=function(_0x1fe8b5,_0x41a4ba){this['rpc']['getSquareOdbcById'](_0x1fe8b5)[_0x07d8('0x11')](function(_0x4fcc4d){_0x41a4ba(null,_0x4fcc4d?_0x4fcc4d['dsn']:![]);})[_0x07d8('0x13')](function(_0x3f15a9){_0x41a4ba(_0x3f15a9);});};AGIVertices['prototype'][_0x07d8('0x18')]=function(_0x957b5,_0x40a095){this[_0x07d8('0xc')]['getUserById'](_0x957b5)[_0x07d8('0x11')](function(_0x14d8d7){_0x40a095(null,_0x14d8d7?_0x14d8d7['name']:![]);})[_0x07d8('0x13')](function(_0x208bad){_0x40a095(_0x208bad);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x19')]=function(_0x53f551,_0x5254bc){this[_0x07d8('0xc')]['getTrunkById'](_0x53f551)['then'](function(_0x184d8b){_0x5254bc(null,_0x184d8b?_0x184d8b[_0x07d8('0x12')]:![]);})[_0x07d8('0x13')](function(_0x10a4c9){_0x5254bc(_0x10a4c9);});};AGIVertices[_0x07d8('0xe')]['getSound']=function(_0x3993c8,_0x5325ee){var _0x448e9b=this;this['rpc']['getSoundById'](_0x3993c8)[_0x07d8('0x11')](function(_0x38fd1e){_0x5325ee(null,_0x38fd1e?_0x448e9b[_0x07d8('0x1a')](_0x38fd1e[_0x07d8('0x1b')]):![]);})[_0x07d8('0x13')](function(_0x4c1da2){_0x5325ee(_0x4c1da2);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x1c')]=function(_0x338639,_0x171f43){this[_0x07d8('0xc')][_0x07d8('0x1d')](_0x338639)[_0x07d8('0x11')](function(_0x1cd148){_0x171f43(null,_0x1cd148?_0x1cd148:![]);})[_0x07d8('0x13')](function(_0x2a4c17){_0x171f43(_0x2a4c17);});};AGIVertices['prototype'][_0x07d8('0x1e')]=function(_0x9b212,_0x236053,_0x2c9783){this['mailRpc']['sendMailMessage'](_0x9b212,_0x236053)[_0x07d8('0x11')](function(){_0x2c9783(null);})[_0x07d8('0x13')](function(_0x1e68d5){_0x2c9783(_0x1e68d5);});};AGIVertices[_0x07d8('0xe')]['getIntervals']=function(_0x3e4e94,_0x26028e){this[_0x07d8('0xc')][_0x07d8('0x1f')](_0x3e4e94)[_0x07d8('0x11')](function(_0x36feb1){if(_0x36feb1){if(_0x36feb1[_0x07d8('0x20')]){_0x26028e(null,[_0x36feb1[_0x07d8('0x21')]]);}else{_0x26028e(null,_[_0x07d8('0x22')](_0x36feb1[_0x07d8('0x23')],_0x07d8('0x21')));}}else{_0x26028e(null,![]);}})['catch'](function(_0x35e7b8){_0x26028e(_0x35e7b8);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x1a')]=function(_0x3baf05){return util[_0x07d8('0x24')](_0x07d8('0x25'),FILES_PATH,_0x3baf05);};AGIVertices[_0x07d8('0xe')][_0x07d8('0x26')]=function(_0x24b810,_0x5ca320,_0x22454a){odbc[_0x07d8('0x27')](_0x24b810,function(_0x33e2ab){if(_0x33e2ab){logger[_0x07d8('0x28')](_0x07d8('0x29'),_0x33e2ab);_0x22454a(_0x33e2ab);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x07d8('0x2a')](_0x5ca320,function(_0x360b0b,_0x4afcf3){if(_0x360b0b){logger[_0x07d8('0x2b')](_0x07d8('0x2c'),_0x5ca320);_0x22454a(_0x360b0b);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x5ca320);odbc['close'](function(_0x391d49){if(_0x391d49){logger[_0x07d8('0x28')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x391d49);}_0x22454a(null,_0x4afcf3);});}});}});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x2d')]=function(_0x75629a,_0x23246e){this['rpc']['getSmsAccountById'](_0x75629a)['then'](function(_0x3197bc){_0x23246e(null,_0x3197bc?_0x3197bc:![]);})[_0x07d8('0x13')](function(_0x3aaa90){_0x23246e(_0x3aaa90);});};AGIVertices['prototype'][_0x07d8('0x2e')]=function(_0x495091,_0x499a40){this[_0x07d8('0xc')][_0x07d8('0x2e')](_0x495091)['then'](function(_0x57e153){_0x499a40(null,_0x57e153);})['catch'](function(_0x5b7342){_0x499a40(_0x5b7342);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x2f')]=function(_0x2770d4,_0x18e44b,_0x1c76a0){this[_0x07d8('0xc')][_0x07d8('0x2f')]({'uniqueid':this[_0x07d8('0xb')][_0x07d8('0x30')],'node':_0x2770d4[_0x07d8('0x31')],'application':_0x2770d4['agicommand'],'data':_0x18e44b||null,'project_name':this[_0x07d8('0xb')]['arg_1'],'callerid':this[_0x07d8('0xb')]['callerid']})['then'](function(_0x586c1e){if(_0x1c76a0){_0x1c76a0(null,_0x586c1e);}})[_0x07d8('0x13')](function(_0x6a399c){if(_0x1c76a0){_0x1c76a0(_0x6a399c);}});};AGIVertices[_0x07d8('0xe')]['createSquareRecording']=function(_0x5ca907,_0x4b1825,_0x24b75e,_0x50a249){this[_0x07d8('0xc')]['createSquareRecording']({'uniqueid':this[_0x07d8('0xb')][_0x07d8('0x30')],'callerid':this['channel'][_0x07d8('0x32')],'calleridname':this[_0x07d8('0xb')]['calleridname'],'context':this[_0x07d8('0xb')]['context'],'extension':this['channel'][_0x07d8('0x33')],'priority':this['channel'][_0x07d8('0x34')],'accountcode':this[_0x07d8('0xb')][_0x07d8('0x35')],'dnid':this[_0x07d8('0xb')]['dnid'],'projectName':this[_0x07d8('0xb')][_0x07d8('0x36')],'saveName':_0x4b1825,'filename':_0x5ca907[_0x07d8('0x37')]||_0x4b1825,'savePath':_0x24b75e})[_0x07d8('0x11')](function(_0x355cc7){_0x50a249(null,_0x355cc7);})[_0x07d8('0x13')](function(_0x1b37de){_0x50a249(_0x1b37de);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x38')]=function(_0x59444f,_0x2780be,_0x43c8f2,_0xf4de6,_0x2df55d){this[_0x07d8('0xc')][_0x07d8('0x38')]({'uniqueid':this[_0x07d8('0xb')][_0x07d8('0x30')],'body':_0x59444f,'direction':_0x2780be,'providerName':_0x43c8f2,'providerResponse':_0xf4de6})[_0x07d8('0x11')](function(_0x4d0b0c){if(_0x2df55d){_0x2df55d(null,_0x4d0b0c);}})[_0x07d8('0x13')](function(_0x1b2402){if(_0x2df55d){_0x2df55d(_0x1b2402);}});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x39')]=function(_0x100f51,_0x37138d){this[_0x07d8('0xc')][_0x07d8('0x39')]({'firstName':_[_0x07d8('0x3a')](_0x100f51[_0x07d8('0x12')])||_[_0x07d8('0x3b')](_0x100f51[_0x07d8('0x12')])?'callback_'+Math[_0x07d8('0x3c')]():_0x100f51[_0x07d8('0x12')],'lastName':_[_0x07d8('0x3a')](_0x100f51[_0x07d8('0x3d')])||_[_0x07d8('0x3b')](_0x100f51['lastName'])?null:_0x100f51[_0x07d8('0x3d')],'phone':_0x100f51['phone'],'ListId':_0x100f51[_0x07d8('0x3e')],'scheduledat':_0x100f51[_0x07d8('0x3f')],'callbackUniqueid':this['channel'][_0x07d8('0x30')],'tags':_0x07d8('0x40'),'description':_0x07d8('0x41')+_0x100f51[_0x07d8('0x3f')][_0x07d8('0x42')](),'priority':_0x100f51['callback_priority']})[_0x07d8('0x11')](function(_0x4eba25){_0x37138d(null,_0x4eba25);})['catch'](function(_0x206aed){_0x37138d(_0x206aed);});};AGIVertices['prototype'][_0x07d8('0x43')]=function(_0x1074de,_0x2dad20){this[_0x07d8('0xc')]['getPauseById'](_0x1074de)[_0x07d8('0x11')](function(_0xd4b0ef){_0x2dad20(null,_0xd4b0ef?_0xd4b0ef[_0x07d8('0x12')]:![]);})[_0x07d8('0x13')](function(_0x242160){_0x2dad20(_0x242160);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x44')]=function(_0x59785c,_0xb68bcb,_0x23d90e){var _0x2f17f8={'role':_0x07d8('0x45')};_0x2f17f8[_0x59785c]=this[_0x07d8('0xb')]['callerid'];this[_0x07d8('0xc')]['agentPause'](_0x2f17f8,_0xb68bcb,this['channel'][_0x07d8('0x30')])[_0x07d8('0x11')](function(_0x3da293){_0x23d90e(null,_['isNil'](_0x3da293)?![]:!![]);})[_0x07d8('0x13')](function(_0x2a9f4c){logger[_0x07d8('0x28')](_0x2a9f4c);_0x23d90e(null,![]);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x46')]=function(_0x2f6f0d,_0x2ffa68){var _0x1da102={'role':_0x07d8('0x45')};_0x1da102[_0x2f6f0d]=this[_0x07d8('0xb')][_0x07d8('0x32')];this['rpc'][_0x07d8('0x46')](_0x1da102)['then'](function(_0x34cc34){_0x2ffa68(null,_[_0x07d8('0x3b')](_0x34cc34)?![]:!![]);})[_0x07d8('0x13')](function(_0x5ad4ae){logger['error'](_0x5ad4ae);_0x2ffa68(null,![]);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x47')]=function(_0x47501c,_0x2cb9a5){var _0x5d0a84={'role':_0x07d8('0x45')};_0x5d0a84[_0x47501c]=this['channel'][_0x07d8('0x32')];this[_0x07d8('0xc')]['agentLogout'](_0x5d0a84)[_0x07d8('0x11')](function(_0x523501){_0x2cb9a5(null,_['isNil'](_0x523501)?![]:!![]);})[_0x07d8('0x13')](function(_0x366931){logger[_0x07d8('0x28')](_0x366931);_0x2cb9a5(null,![]);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x48')]=function(_0x48fa28,_0x5bc23b){var _0x46a670={'role':_0x07d8('0x45')};_0x46a670[_0x48fa28]=this[_0x07d8('0xb')][_0x07d8('0x32')];var _0x40539a=_0x48fa28!='internal'?util[_0x07d8('0x24')](_0x07d8('0x49'),_0x07d8('0x4a'),this[_0x07d8('0xb')][_0x07d8('0x32')]):undefined;this[_0x07d8('0xc')]['agentLogin'](_0x46a670,_0x40539a)[_0x07d8('0x11')](function(_0x33df9a){_0x5bc23b(null,_[_0x07d8('0x3b')](_0x33df9a)?![]:!![]);})[_0x07d8('0x13')](function(_0x2bfb38){logger[_0x07d8('0x28')](_0x2bfb38);_0x5bc23b(null,![]);});};AGIVertices[_0x07d8('0xe')]['shellCommand']=function(_0x3a2083,_0x513d01){sh[_0x07d8('0x4b')](_['trim'](_0x3a2083),function(_0x1410b7,_0x3a53d8){var _0x2cd5f9=_0x3a53d8[_0x07d8('0x4c')](/(\r\n|\n|\r)/gm,'');_0x513d01(null,_0x2cd5f9);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x4d')]=function(_0x4f919b,_0x3b5262){scripts[_0x07d8('0x4d')](_0x4f919b['apiKey'],_0x4f919b['google_cloud_tts_text_type']||'text',_0x4f919b[_0x07d8('0x4e')],_0x4f919b['languageCode']||_0x07d8('0x4f'),_0x4f919b[_0x07d8('0x50')]||_0x07d8('0x51'),_0x4f919b[_0x07d8('0x52')]||'MP3')[_0x07d8('0x11')](function(_0x29e9e7){_0x3b5262(null,_0x29e9e7);})[_0x07d8('0x13')](function(_0x3e0cc4){_0x3b5262(_0x3e0cc4);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x53')]=function(_0x2a47dd,_0x270614){scripts['googleTTS'](_0x2a47dd[_0x07d8('0x4e')],_0x2a47dd[_0x07d8('0x54')]||'en',0x1)[_0x07d8('0x11')](function(_0xc782ce){_0x270614(null,_0xc782ce);})[_0x07d8('0x13')](function(_0x52e63a){_0x270614(_0x52e63a);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x55')]=function(_0x4c04b4,_0x496696){var _0x76ae36={'uri':_0x4c04b4[_0x07d8('0x56')],'method':_0x4c04b4[_0x07d8('0x57')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4c04b4[_0x07d8('0x58')])===_0x07d8('0x59')&&parseInt(_0x4c04b4[_0x07d8('0x58')])>=0x1?parseInt(_0x4c04b4['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x07d8('0x5a')](['POST',_0x07d8('0x5b')],_0x76ae36[_0x07d8('0x57')][_0x07d8('0x5c')]())){try{_0x76ae36[_0x07d8('0x5d')]=_0x4c04b4[_0x07d8('0xa')]?JSON[_0x07d8('0x5e')](_0x4c04b4[_0x07d8('0xa')]):{};}catch(_0x468ef5){logger[_0x07d8('0x28')](_0x07d8('0x5f'),_0x468ef5);}}try{_0x76ae36['headers']=_0x4c04b4['rawHeaders']?JSON[_0x07d8('0x5e')](_0x4c04b4['rawHeaders']):{};}catch(_0x4a99cb){logger[_0x07d8('0x28')](_0x07d8('0x60'),_0x4a99cb);}if(_0x4c04b4[_0x07d8('0x61')]){try{var _0x56cff9=require(_0x4c04b4[_0x07d8('0x61')])[_0x07d8('0x62')](this,_0x76ae36);_0x76ae36[_0x07d8('0x63')]=Mustache['render'](_0x4c04b4[_0x07d8('0x56')],_0x56cff9,{},['$$','$$']);if(_0x76ae36[_0x07d8('0x64')]){_0x76ae36[_0x07d8('0x64')]=JSON['parse'](Mustache[_0x07d8('0x65')](JSON[_0x07d8('0x66')](_0x76ae36[_0x07d8('0x64')]),_0x56cff9,{},['$$','$$']));}if(_0x76ae36[_0x07d8('0x5d')]){_0x76ae36[_0x07d8('0x5d')]=JSON[_0x07d8('0x5e')](Mustache['render'](JSON['stringify'](_0x76ae36[_0x07d8('0x5d')]),_0x56cff9,{},['$$','$$']));}}catch(_0x489d6f){logger[_0x07d8('0x28')](_0x07d8('0x67'),_0x489d6f);}}rp(_0x76ae36)['then'](function(_0x160fbd){var _0x1b9068={'statusCode':_0x160fbd[_0x07d8('0x68')]||0xc8,'statusMessage':_0x160fbd[_0x07d8('0x69')]||'OK','headers':_0x160fbd[_0x07d8('0x64')]||{},'body':_0x160fbd[_0x07d8('0x5d')]||{}};_0x496696(null,_0x1b9068);})[_0x07d8('0x13')](function(_0x2a0da0){var _0x520fb1={'statusCode':_0x2a0da0['statusCode']||0x1f4,'statusMessage':_0x2a0da0['message']||_0x07d8('0x6a'),'headers':_0x2a0da0[_0x07d8('0x6b')][_0x07d8('0x64')]||{},'body':_0x2a0da0[_0x07d8('0x6b')][_0x07d8('0x5d')]||{}};_0x496696(null,_0x520fb1);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x6c')]=function(_0x1a6691,_0x29d14b){scripts[_0x07d8('0x6c')](this[_0x07d8('0xb')][_0x07d8('0x30')],_0x1a6691[_0x07d8('0x6d')],_0x1a6691[_0x07d8('0x4e')],_0x1a6691[_0x07d8('0x6e')]||'en')['then'](function(_0x332c5e){_0x29d14b(null,_0x332c5e);})['catch'](function(_0x4def75){_0x29d14b(_0x4def75);});};AGIVertices[_0x07d8('0xe')]['googleDialogflowV2']=function(_0x4c1a10,_0x41794b){scripts['googleDialogflowV2'](this[_0x07d8('0xb')][_0x07d8('0x30')],_0x4c1a10['dialogflowV2_project_id'],_0x4c1a10['client_email'],_0x4c1a10[_0x07d8('0x6f')],_0x4c1a10[_0x07d8('0x4e')],_0x4c1a10[_0x07d8('0x70')]||'en')[_0x07d8('0x11')](function(_0x52b866){_0x41794b(null,_0x52b866);})[_0x07d8('0x13')](function(_0x3d0c78){_0x41794b(_0x3d0c78);});};AGIVertices[_0x07d8('0xe')]['sestekNDA']=function(_0x773ac4,_0x4c1ef0){scripts['sestekNDA'](this[_0x07d8('0xb')],_0x773ac4)[_0x07d8('0x11')](function(_0x4cbdec){_0x4c1ef0(null,_0x4cbdec);})[_0x07d8('0x13')](function(_0x51004f){_0x4c1ef0(_0x51004f);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x71')]=function(_0x3e2d1a,_0x4e5f32){scripts[_0x07d8('0x71')](_0x3e2d1a[_0x07d8('0x6d')],_0x3e2d1a[_0x07d8('0x4e')],_0x3e2d1a[_0x07d8('0x72')]||_0x07d8('0x4f'),_0x3e2d1a['speed'])[_0x07d8('0x11')](function(_0x4af84c){_0x4e5f32(null,_0x4af84c);})['catch'](function(_0x29803a){_0x4e5f32(_0x29803a);});};AGIVertices['prototype'][_0x07d8('0x73')]=function(_0x52f928,_0x4658f2,_0x196765){scripts[_0x07d8('0x73')](_0x4658f2,_0x52f928[_0x07d8('0x6d')],_0x52f928['ispeech_asr_language']||'en-US',this[_0x07d8('0x74')](_0x52f928['model'])?_0x52f928['model']:undefined)[_0x07d8('0x11')](function(_0x34a54e){_0x196765(null,_0x34a54e);})[_0x07d8('0x13')](function(_0x197345){_0x196765(_0x197345);});};AGIVertices['prototype'][_0x07d8('0x75')]=function(_0x285b05,_0x4cd177){scripts[_0x07d8('0x75')](_0x285b05[_0x07d8('0x76')],_0x285b05[_0x07d8('0x77')],_0x285b05[_0x07d8('0x78')],_0x285b05[_0x07d8('0x79')]||_0x07d8('0x7a'),_0x285b05[_0x07d8('0x4e')],_0x285b05[_0x07d8('0x7b')]||_0x07d8('0x4e'))[_0x07d8('0x11')](function(_0x2a1dc0){_0x4cd177(null,_0x2a1dc0);})[_0x07d8('0x13')](function(_0x187074){_0x4cd177(_0x187074);});};AGIVertices[_0x07d8('0xe')]['awsLex']=function(_0x137e14,_0xbc024b){scripts[_0x07d8('0x7c')](this['channel'][_0x07d8('0x30')],_0x137e14[_0x07d8('0x76')],_0x137e14['aws_secret_access_key'],_0x137e14[_0x07d8('0x7d')],_0x137e14[_0x07d8('0x4e')],_0x137e14[_0x07d8('0x7e')])[_0x07d8('0x11')](function(_0x3f8114){_0xbc024b(null,_0x3f8114);})[_0x07d8('0x13')](function(_0x3c0d86){_0xbc024b(_0x3c0d86);});};AGIVertices['prototype'][_0x07d8('0x7f')]=function(_0x117204,_0x46a8c3,_0x5bc07b){scripts[_0x07d8('0x7f')](_0x46a8c3,_0x117204[_0x07d8('0x6d')],_0x117204[_0x07d8('0x80')]||_0x07d8('0x4f'))[_0x07d8('0x11')](function(_0xf342ed){_0x5bc07b(null,_0xf342ed);})[_0x07d8('0x13')](function(_0x50ca44){_0x5bc07b(_0x50ca44);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x81')]=function(_0x44012c,_0x36e555,_0x47fe92){scripts[_0x07d8('0x81')](_0x36e555,_0x44012c[_0x07d8('0x82')],_0x44012c[_0x07d8('0x83')],_0x44012c[_0x07d8('0x63')])[_0x07d8('0x11')](function(_0x3083f5){_0x47fe92(null,_0x3083f5);})['catch'](function(_0x22682f){_0x47fe92(_0x22682f);});};AGIVertices[_0x07d8('0xe')][_0x07d8('0x84')]=function(_0x11f168){var _0x3eff41=_[_0x07d8('0x5a')](verticesWithRetry,_0x11f168[_0x07d8('0x85')])?_0x11f168:_[_0x07d8('0x86')](_0x11f168);for(var _0x34c3d2 in _0x3eff41){if(_0x3eff41[_0x07d8('0x87')](_0x34c3d2)){if(_0x3eff41[_0x34c3d2]&&_['isString'](_0x3eff41[_0x34c3d2])){if(_[_0x07d8('0x5a')](recursiveMapAttributes,_0x34c3d2)){_0x3eff41[_0x34c3d2]=this[_0x07d8('0x88')](_0x3eff41[_0x34c3d2]);}else{_0x3eff41[_0x34c3d2]=this[_0x07d8('0x89')](_0x3eff41[_0x34c3d2]);}}}}return _0x3eff41;};AGIVertices[_0x07d8('0xe')][_0x07d8('0x8a')]=function(_0xdf23e8){for(var _0x1c1f9f in _0xdf23e8){if(_0xdf23e8[_0x07d8('0x87')](_0x1c1f9f)){if(_[_0x07d8('0x8b')](_0xdf23e8[_0x1c1f9f])){this[_0x07d8('0x8a')](_0xdf23e8[_0x1c1f9f]);}else if(_[_0x07d8('0x8c')](_0xdf23e8[_0x1c1f9f])){for(var _0xeb1b11=0x0;_0xeb1b11<_0xdf23e8[_0x1c1f9f][_0x07d8('0x8d')];_0xeb1b11++){this['recursiveNodeIndex'](_0xdf23e8[_0x1c1f9f][_0xeb1b11]);}}else if(_[_0x07d8('0x8e')](_0xdf23e8[_0x1c1f9f])){_0xdf23e8[_0x1c1f9f]=this['replaceAllVariables'](_0xdf23e8[_0x1c1f9f]);}}}};AGIVertices[_0x07d8('0xe')][_0x07d8('0x8f')]=function(_0x221ddc,_0x5c05c9){for(var _0x28acc1 in _0x221ddc){if(_0x221ddc[_0x07d8('0x87')](_0x28acc1)){if(_[_0x07d8('0x8b')](_0x221ddc[_0x28acc1])){if(!_[_0x07d8('0x3a')](_0x221ddc[_0x28acc1])){this['saveRestApiResult'](_0x221ddc[_0x28acc1],util[_0x07d8('0x24')](_0x07d8('0x90'),_0x5c05c9,_0x28acc1));}}else if(_[_0x07d8('0x8c')](_0x221ddc[_0x28acc1])){for(var _0x5742d0=0x0;_0x5742d0<_0x221ddc[_0x28acc1][_0x07d8('0x8d')];_0x5742d0++){this['saveRestApiResult'](_0x221ddc[_0x28acc1][_0x5742d0],util[_0x07d8('0x24')](_0x07d8('0x90'),_0x5c05c9,_0x28acc1+'['+_0x5742d0+']'));}}else{if(!_[_0x07d8('0x3b')](_0x221ddc[_0x28acc1])){this['channel'][_0x07d8('0x91')](util[_0x07d8('0x24')]('%s.%s',_0x5c05c9,_0x28acc1),_0x221ddc[_0x28acc1]);}}}}};AGIVertices[_0x07d8('0xe')]['replaceObjectAllVariables']=function(_0x59c2b7){try{var _0x3b2ba4=JSON[_0x07d8('0x5e')](_0x59c2b7);this['recursiveNodeIndex'](_0x3b2ba4);return JSON[_0x07d8('0x66')](_0x3b2ba4);}catch(_0xb288cc){return this[_0x07d8('0x89')](_0x59c2b7);}};AGIVertices[_0x07d8('0xe')][_0x07d8('0x89')]=function(_0x114ec5){var _0x4a0c3d=_0x114ec5['split']('{');for(var _0x2e38b9=0x1;_0x2e38b9<_0x4a0c3d[_0x07d8('0x8d')];_0x2e38b9+=0x1){var _0x3972a8=_0x4a0c3d[_0x2e38b9][_0x07d8('0x92')]('}');if(_0x3972a8[_0x07d8('0x8d')]>0x1){_0x114ec5=_0x114ec5['replaceAll']('{'+_0x3972a8[0x0]+'}',this[_0x07d8('0xb')][_0x07d8('0xf')](_0x3972a8[0x0])[_0x07d8('0x93')]||_0x3972a8[0x0]);}}if(_0x4a0c3d[_0x07d8('0x8d')]===0x1){return _0x114ec5[_0x07d8('0x42')]();}return this[_0x07d8('0x89')](_0x114ec5);};AGIVertices[_0x07d8('0xe')]['getAndSetVariable']=function(_0xf83add,_0x339ae0){var _0x46ed91=this[_0x07d8('0xb')][_0x07d8('0xf')](_0xf83add);if(_0x46ed91['result']===-0x1){return _0x46ed91;}logger['info'](util[_0x07d8('0x24')](_0x07d8('0x94'),_0x339ae0,_0x46ed91[_0x07d8('0x93')]));return this[_0x07d8('0xb')][_0x07d8('0x91')](_0x339ae0,_0x46ed91[_0x07d8('0x93')]);};AGIVertices['prototype'][_0x07d8('0x74')]=function(_0x3d34b7){return _0x3d34b7&&_0x3d34b7!=='0'&&_0x3d34b7!=='-1'&&_0x3d34b7!=='';};AGIVertices['prototype'][_0x07d8('0x95')]=function(_0x1be3c1){this['createSquareDetailsReport'][_0x07d8('0x62')](this,_0x1be3c1,'-');_0x1be3c1['retry']=_0x1be3c1[_0x07d8('0x95')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x07d8('0xe')][_0x07d8('0x96')]=function(_0x2eb3ab){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x97'),_0x2eb3ab[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x2eb3ab[_0x07d8('0x4e')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x99'));}var _0x9ad35b='\x22'+_0x2eb3ab['text']+'\x22';if(this[_0x07d8('0x74')](_0x2eb3ab[_0x07d8('0x6b')])){_0x9ad35b+=','+_0x2eb3ab[_0x07d8('0x6b')];}var _0x42b5ae=this['channel'][_0x07d8('0x4b')](_0x07d8('0x9a'),_0x9ad35b);if(_0x42b5ae[_0x07d8('0x9b')]===-0x1){return _0x42b5ae;}return this['channel'][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x9c'),_0x9ad35b));};AGIVertices['prototype'][_0x07d8('0x9d')]=function(_0x194cc1){logger[_0x07d8('0x2b')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x194cc1['label']));if(!this[_0x07d8('0x74')](_0x194cc1[_0x07d8('0x9e')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x9f'));}var _0x4de825=_0x194cc1[_0x07d8('0x9e')];if(this['isConfigured'](_0x194cc1[_0x07d8('0x6b')])){_0x4de825+=','+_0x194cc1[_0x07d8('0x6b')];}var _0x3996d2=this['channel'][_0x07d8('0x4b')]('MRCPRecog',_0x4de825);if(_0x3996d2[_0x07d8('0x9b')]===-0x1){return _0x3996d2;}var _0x5a1ca4=this[_0x07d8('0xa0')]('RECOG_CONFIDENCE()',_0x07d8('0xa1'));if(_0x5a1ca4[_0x07d8('0x9b')]===-0x1){return _0x5a1ca4;}var _0x5311a0=this[_0x07d8('0xa0')](_0x07d8('0xa2'),_0x07d8('0xa3'));if(_0x5311a0[_0x07d8('0x9b')]===-0x1){return _0x5311a0;}var _0x4e4f03=this[_0x07d8('0xa0')](_0x07d8('0xa4'),_0x07d8('0xa5'));if(_0x4e4f03[_0x07d8('0x9b')]===-0x1){return _0x4e4f03;}return this['channel']['noop'](util[_0x07d8('0x24')](_0x07d8('0xa6'),_0x4de825));};AGIVertices['prototype'][_0x07d8('0xa7')]=function(_0x296a68){logger['info'](util[_0x07d8('0x24')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x296a68['label']));return this[_0x07d8('0xb')]['agi']([_0x296a68[_0x07d8('0xa8')],_0x296a68['args']]);};AGIVertices[_0x07d8('0xe')][_0x07d8('0xa9')]=function(_0x160d29){logger[_0x07d8('0x2b')](util['format'](_0x07d8('0xaa'),_0x160d29[_0x07d8('0x31')]));if(this['isConfigured'](_0x160d29[_0x07d8('0x58')])){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0xab'),_0x160d29['timeout']));var _0x1e81b5=this[_0x07d8('0xb')][_0x07d8('0xac')](_0x160d29[_0x07d8('0x58')]);if(_0x1e81b5['result']===-0x1){return _0x1e81b5;}}return this[_0x07d8('0xb')][_0x07d8('0xa9')]();};AGIVertices[_0x07d8('0xe')]['callback']=function(_0x1096f7){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0xad'),_0x1096f7[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x1096f7['list_id'])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x1096f7,'no\x20list\x20selected');}_0x1096f7['scheduledAt']=moment();if(this['isConfigured'](_0x1096f7[_0x07d8('0xae')])){_0x1096f7[_0x07d8('0x3f')]=moment()[_0x07d8('0xaf')](_0x1096f7[_0x07d8('0xae')],_0x07d8('0xb0'));}if(!this[_0x07d8('0x74')](_0x1096f7[_0x07d8('0xb1')])){_0x1096f7[_0x07d8('0xb1')]=0x2;}this['createCmContact']['sync'](this,_0x1096f7);return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1096f7[_0x07d8('0xb2')],_0x1096f7[_0x07d8('0x3e')],_0x1096f7[_0x07d8('0x3f')]));};AGIVertices[_0x07d8('0xe')][_0x07d8('0xb3')]=function(_0x57328f){logger['info'](util[_0x07d8('0x24')](_0x07d8('0xb4'),_0x57328f[_0x07d8('0x31')]));var _0x4fdd4a=this[_0x07d8('0xb')][_0x07d8('0x4b')](_0x57328f[_0x07d8('0xb5')],_0x57328f['options']);if(_0x4fdd4a[_0x07d8('0x9b')]===-0x1){return _0x4fdd4a;}return this[_0x07d8('0xb')]['noop'](util[_0x07d8('0x24')](_0x07d8('0xb6'),_0x57328f[_0x07d8('0xb5')],_0x57328f[_0x07d8('0x6b')]));};AGIVertices['prototype'][_0x07d8('0xb7')]=function(_0x4b89cc){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0xb8'),_0x4b89cc[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x4b89cc[_0x07d8('0x4e')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x99'));}var _0x5a2764='\x22'+_0x4b89cc[_0x07d8('0x4e')]+'\x22';if(this['isConfigured'](_0x4b89cc['options'])){_0x5a2764+=','+_0x4b89cc[_0x07d8('0x6b')];}var _0x1ebf1d=this[_0x07d8('0xb')]['exec']('MRCPSynth',_0x5a2764);if(_0x1ebf1d[_0x07d8('0x9b')]===-0x1){return _0x1ebf1d;}return this[_0x07d8('0xb')]['noop'](util[_0x07d8('0x24')](_0x07d8('0x9c'),_0x5a2764));};AGIVertices[_0x07d8('0xe')][_0x07d8('0xb9')]=function(_0x6c308a){logger[_0x07d8('0x2b')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x6c308a[_0x07d8('0x31')]));if(!this['isConfigured'](_0x6c308a[_0x07d8('0x4e')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x99'));}var _0x3f96f9='\x22'+_0x6c308a[_0x07d8('0x4e')]+'\x22';if(this['isConfigured'](_0x6c308a['options'])){_0x3f96f9+=','+_0x6c308a[_0x07d8('0x6b')];}var _0x192415=this['channel'][_0x07d8('0x4b')]('MRCPSynth',_0x3f96f9);if(_0x192415[_0x07d8('0x9b')]===-0x1){return _0x192415;}return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x9c'),_0x3f96f9));};AGIVertices['prototype']['lumenvoxasr']=function(_0x477463){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0xba'),_0x477463[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x477463[_0x07d8('0x9e')])){return this[_0x07d8('0xb')]['noop'](_0x07d8('0x9f'));}var _0x423107=_0x477463['grammar'];if(this[_0x07d8('0x74')](_0x477463[_0x07d8('0x6b')])){_0x423107+=','+_0x477463[_0x07d8('0x6b')];}var _0x108df6=this['channel']['exec'](_0x07d8('0xbb'),_0x423107);if(_0x108df6[_0x07d8('0x9b')]===-0x1){return _0x108df6;}var _0x3c2d62=this[_0x07d8('0xa0')](_0x07d8('0xbc'),_0x07d8('0xbd'));if(_0x3c2d62[_0x07d8('0x9b')]===-0x1){return _0x3c2d62;}var _0x2cd7d5=this[_0x07d8('0xa0')](_0x07d8('0xa2'),_0x07d8('0xbe'));if(_0x2cd7d5[_0x07d8('0x9b')]===-0x1){return _0x2cd7d5;}var _0x1ff071=this[_0x07d8('0xa0')](_0x07d8('0xa4'),_0x07d8('0xbf'));if(_0x1ff071[_0x07d8('0x9b')]===-0x1){return _0x1ff071;}return this[_0x07d8('0xb')]['noop'](util[_0x07d8('0x24')](_0x07d8('0xa6'),_0x423107));};AGIVertices[_0x07d8('0xe')][_0x07d8('0xc0')]=function(_0x6a34f5){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x6a34f5[_0x07d8('0x31')]));if(!this['isConfigured'](_0x6a34f5[_0x07d8('0x9e')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x9f'));}var _0x3b42d6=_0x6a34f5[_0x07d8('0x9e')];if(this[_0x07d8('0x74')](_0x6a34f5['options'])){_0x3b42d6+=','+_0x6a34f5[_0x07d8('0x6b')];}var _0x18ffab=this[_0x07d8('0xb')]['exec'](_0x07d8('0xbb'),_0x3b42d6);if(_0x18ffab[_0x07d8('0x9b')]===-0x1){return _0x18ffab;}var _0x159588=this[_0x07d8('0xa0')](_0x07d8('0xbc'),_0x07d8('0xc1'));if(_0x159588['result']===-0x1){return _0x159588;}var _0x542c04=this[_0x07d8('0xa0')](_0x07d8('0xa2'),_0x07d8('0xc2'));if(_0x542c04[_0x07d8('0x9b')]===-0x1){return _0x542c04;}var _0x24ddc3=this['getAndSetVariable']('RECOG_INSTANCE()',_0x07d8('0xc3'));if(_0x24ddc3['result']===-0x1){return _0x24ddc3;}return this['channel']['noop'](util[_0x07d8('0x24')](_0x07d8('0xa6'),_0x3b42d6));};AGIVertices[_0x07d8('0xe')]['database']=function(_0x5c6e5c){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0xc4'),_0x5c6e5c[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x5c6e5c['odbc_id'])){return this['channel'][_0x07d8('0x28')](_0x5c6e5c,'no\x20database\x20selected');}var _0x40c2d5=this[_0x07d8('0x17')][_0x07d8('0x62')](this,_0x5c6e5c[_0x07d8('0xc5')]);if(!_0x40c2d5){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x5c6e5c,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x5c6e5c[_0x07d8('0x2a')])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x5c6e5c,_0x07d8('0xc6'));}var _0x19b5df=_0x5c6e5c[_0x07d8('0x2a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format']('query:\x20%s',_0x19b5df));var _0x367948=this[_0x07d8('0x26')]['sync'](this,_0x40c2d5,_0x19b5df);this[_0x07d8('0x2f')][_0x07d8('0x62')](this,_0x5c6e5c,_0x19b5df);if(!this[_0x07d8('0x74')](_0x5c6e5c['variable_id'])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0xc7'));}var _0x118011=this['getVariable'][_0x07d8('0x62')](this,_0x5c6e5c[_0x07d8('0xc8')]);if(!_0x118011){return this['channel'][_0x07d8('0x28')](_0x5c6e5c,_0x07d8('0xc9'));}var _0xf198ce=this;_0x367948[_0x07d8('0xca')](function(_0x5d943d,_0x23ac40){Object['keys'](_0x5d943d)[_0x07d8('0xca')](function(_0x583527){_0xf198ce['channel'][_0x07d8('0x91')](util[_0x07d8('0x24')](_0x07d8('0xcb'),_0x118011,_0x23ac40,_0x583527),_0x5d943d[_0x583527]);});});this[_0x07d8('0xb')][_0x07d8('0x91')](util['format']('%s_ROWS_COUNT',_0x118011),_0x367948[_0x07d8('0x8d')]);return this['channel'][_0x07d8('0x98')](util['format']('variable\x20%s\x20set',_0x118011));};AGIVertices['prototype'][_0x07d8('0xcc')]=function(_0x347af5){logger['debug'](util[_0x07d8('0x24')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x347af5['label']));if(!this[_0x07d8('0x74')](_0x347af5['sip_id'])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x347af5,_0x07d8('0xcd'));}var _0xd55f38=this[_0x07d8('0x18')][_0x07d8('0x62')](this,_0x347af5['sip_id']);if(!_0xd55f38){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x347af5,_0x07d8('0xce'));}var _0x29fafa=this[_0x07d8('0xb')][_0x07d8('0x4b')]('DIAL',[util[_0x07d8('0x24')]('SIP/%s',_0xd55f38),_0x347af5['timeout'],_0x347af5[_0x07d8('0xcf')],_0x347af5['url']]);if(_0x29fafa[_0x07d8('0x9b')]===-0x1){return _0x29fafa;}return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0xd0'),_0x07d8('0xd1')));};AGIVertices[_0x07d8('0xe')][_0x07d8('0xd2')]=function(_0x28b157){logger['info'](util['format'](_0x07d8('0xd3'),_0x28b157[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x28b157['key'])){return this[_0x07d8('0xb')][_0x07d8('0x98')]('no\x20key\x20configured');}if(!this[_0x07d8('0x74')](_0x28b157[_0x07d8('0x4e')])){return this[_0x07d8('0xb')]['noop'](_0x07d8('0x99'));}this['channel']['bot']=!![];this[_0x07d8('0x2f')](_0x28b157);this['createSquareMessage'](_0x28b157[_0x07d8('0x4e')],'in','','');this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0xd4'),_0x28b157[_0x07d8('0x4e')]));var _0x35fa72=this[_0x07d8('0x6c')]['sync'](this,_0x28b157);if(_0x35fa72){for(var _0x33809a in _0x35fa72){if(_0x35fa72[_0x07d8('0x87')](_0x33809a)){this[_0x07d8('0xb')][_0x07d8('0x91')](util[_0x07d8('0x24')](_0x07d8('0xd5'),_0x33809a['toUpperCase']()),_0x35fa72[_0x33809a]);}}this[_0x07d8('0x38')](_0x35fa72['speech'],_0x07d8('0xd6'),_0x07d8('0xd2'),'');return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0xd7'),_0x35fa72[_0x07d8('0xd8')]));}return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x28b157,_0x07d8('0xd9'));};AGIVertices['prototype'][_0x07d8('0xda')]=function(_0x325306){logger[_0x07d8('0x2b')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x325306[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x325306[_0x07d8('0xdb')])){return this['channel'][_0x07d8('0x98')](_0x07d8('0xdc'));}if(!this['isConfigured'](_0x325306[_0x07d8('0xdd')])){return this['channel'][_0x07d8('0x98')](_0x07d8('0xde'));}if(!this[_0x07d8('0x74')](_0x325306['private_key'])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0xdf'));}if(!this[_0x07d8('0x74')](_0x325306[_0x07d8('0x70')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0xe0'));}if(!this[_0x07d8('0x74')](_0x325306[_0x07d8('0x4e')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x99'));}this['channel'][_0x07d8('0xe1')]=!![];this['createSquareDetailsReport'](_0x325306);this[_0x07d8('0x38')](_0x325306[_0x07d8('0x4e')],'in','','');this['channel'][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0xe2'),_0x325306[_0x07d8('0x4e')]));var _0x15ae3c=this[_0x07d8('0xe3')][_0x07d8('0x62')](this,_0x325306);if(_0x15ae3c){for(var _0x404dc7 in _0x15ae3c){if(_0x15ae3c[_0x07d8('0x87')](_0x404dc7)){if(_0x404dc7!==_0x07d8('0xe4')){this[_0x07d8('0xb')][_0x07d8('0x91')](util[_0x07d8('0x24')](_0x07d8('0xd5'),_0x404dc7[_0x07d8('0x5c')]()),_0x15ae3c[_0x404dc7]);}}}this[_0x07d8('0x38')](_0x15ae3c[_0x07d8('0xd8')],'out',_0x07d8('0xda'),_0x15ae3c[_0x07d8('0xe4')]);return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0xe5'),_0x15ae3c[_0x07d8('0xd8')]));}return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x325306,_0x07d8('0xe6'));};AGIVertices['prototype'][_0x07d8('0xe7')]=function(_0xf9d1e){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0xe8'),_0xf9d1e['label']));if(!this['isConfigured'](_0xf9d1e['ndauth_url'])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0xe9'));}if(!this[_0x07d8('0x74')](_0xf9d1e[_0x07d8('0xea')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0xeb'));}if(!this[_0x07d8('0x74')](_0xf9d1e['password'])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0xec'));}if(!this[_0x07d8('0x74')](_0xf9d1e[_0x07d8('0xed')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x99'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0xf9d1e);this['createSquareMessage'](_0xf9d1e[_0x07d8('0x4e')],'in','','');this['channel']['noop'](util[_0x07d8('0x24')](_0x07d8('0xee'),_0xf9d1e[_0x07d8('0x4e')]));var _0x3a50cb=this[_0x07d8('0xef')][_0x07d8('0x62')](this,_0xf9d1e);if(_0x3a50cb){for(var _0x31f3e5 in _0x3a50cb){if(_0x3a50cb['hasOwnProperty'](_0x31f3e5)){this['channel'][_0x07d8('0x91')](util[_0x07d8('0x24')](_0x07d8('0xf0'),_0x31f3e5['toUpperCase']()),_0x3a50cb[_0x31f3e5]);}}this[_0x07d8('0x38')](_0x3a50cb[_0x07d8('0xd8')],_0x07d8('0xd6'),_0x07d8('0xe7'),'');if(_0x3a50cb[_0x07d8('0xf1')]){this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0xf2'),_0x3a50cb[_0x07d8('0xf1')]));var _0x35624d=this[_0x07d8('0xb')][_0x07d8('0xf3')](_0x3a50cb[_0x07d8('0xf1')]);try{fs['unlink'](_0x3a50cb['audiofile']+_0x07d8('0xf4'));}catch(_0x4edc92){logger['error'](_0x4edc92);}return _0x35624d;}else{return this[_0x07d8('0xb')]['noop'](util[_0x07d8('0x24')]('SestekNDA\x20Result\x20%s',_0x3a50cb[_0x07d8('0xd8')]));}}return this['channel']['error'](_0xf9d1e,_0x07d8('0xf5'));};AGIVertices['prototype'][_0x07d8('0xf6')]=function(_0x2f2038){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0xf7'),_0x2f2038[_0x07d8('0x31')]));return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0xf6'));};AGIVertices['prototype'][_0x07d8('0xf8')]=function(_0x2615c0){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2615c0[_0x07d8('0x31')]));var _0x4da269='';if(_0x2615c0['trunk_id']){if(!this[_0x07d8('0x74')](_0x2615c0[_0x07d8('0xf9')])){return this['channel'][_0x07d8('0x28')](_0x2615c0,_0x07d8('0xfa'));}else{var _0x2f2779=parseInt(_0x2615c0[_0x07d8('0xf9')],0xa);if(isNaN(_0x2f2779)){_0x4da269=_0x2615c0['trunk_id'];}else{_0x4da269=this[_0x07d8('0x19')][_0x07d8('0x62')](this,_0x2615c0[_0x07d8('0xf9')]);if(!_0x4da269){return this[_0x07d8('0xb')]['error'](_0x2615c0,'no\x20trunk\x20found');}}}}else if(_0x2615c0['trunk_name']){_0x4da269=_0x2615c0[_0x07d8('0xfb')];}else{return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x2615c0,'no\x20trunk\x20selected');}var _0x59a667=this[_0x07d8('0xb')]['exec'](_0x07d8('0xd1'),[util['format'](_0x07d8('0xfc'),_0x4da269,_0x2615c0[_0x07d8('0xb2')]),_0x2615c0[_0x07d8('0x58')],_0x2615c0[_0x07d8('0xcf')],_0x2615c0['url']]);if(_0x59a667[_0x07d8('0x9b')]===-0x1){return _0x59a667;}return this['channel'][_0x07d8('0x98')](util[_0x07d8('0x24')]('Executed\x20command\x20%s',_0x07d8('0xd1')));};AGIVertices[_0x07d8('0xe')]['finally']=function(_0x58d00f){logger[_0x07d8('0x2b')](util['format'](_0x07d8('0xfd'),_0x58d00f[_0x07d8('0x31')]));return this[_0x07d8('0xb')]['noop'](_0x07d8('0xfe'));};AGIVertices[_0x07d8('0xe')][_0x07d8('0xff')]=function(_0x3e3a20){logger['info'](util[_0x07d8('0x24')](_0x07d8('0x100'),_0x3e3a20[_0x07d8('0x31')]));if(_0x3e3a20[_0x07d8('0x101')]===0x0){return this[_0x07d8('0x95')](_0x3e3a20);}_0x3e3a20[_0x07d8('0x101')]-=0x1;if(!this[_0x07d8('0x74')](_0x3e3a20[_0x07d8('0x102')])){return this[_0x07d8('0xb')]['error'](_0x3e3a20,_0x07d8('0x103'));}var _0x57813d=this[_0x07d8('0x104')][_0x07d8('0x62')](this,_0x3e3a20[_0x07d8('0x102')]);if(!_0x57813d){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x3e3a20,_0x07d8('0x105'));}if(!this[_0x07d8('0x74')](_0x3e3a20['variable_id'])){return this[_0x07d8('0xb')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5c1f75=this[_0x07d8('0xb')][_0x07d8('0x106')](_0x57813d,_0x3e3a20['response'],_0x3e3a20['maxdigit']);var _0x579f27=_0x5c1f75[_0x07d8('0x9b')]?_0x5c1f75['result']['toString']():'';logger['info'](_0x07d8('0x107'),JSON['stringify'](_0x5c1f75));if(_0x5c1f75[_0x07d8('0x9b')]===-0x1){this[_0x07d8('0x2f')][_0x07d8('0x62')](this,_0x3e3a20,_0x579f27);return _0x5c1f75;}else if(_0x5c1f75['extra']===_0x07d8('0x58')){_0x5c1f75['result']=_0x579f27[_0x07d8('0x8d')]>=parseInt(_0x3e3a20[_0x07d8('0x108')])?'x':'i';}else{_0x5c1f75[_0x07d8('0x9b')]=_0x579f27[_0x07d8('0x8d')]>=parseInt(_0x3e3a20[_0x07d8('0x108')])&&_0x579f27[_0x07d8('0x8d')]<=parseInt(_0x3e3a20[_0x07d8('0x109')])?'x':'i';}var _0x4b2616=this['getVariable'][_0x07d8('0x62')](this,_0x3e3a20[_0x07d8('0xc8')]);if(!_0x4b2616){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x3e3a20,_0x07d8('0xc9'));}this['channel'][_0x07d8('0x91')](_0x4b2616,_0x579f27);if(this[_0x07d8('0x74')](_0x3e3a20[_0x07d8('0x10a')])){var _0x461fa4=parseInt(_0x3e3a20['hiddendigitsnum'],0xa);var _0x58d958=rs[_0x07d8('0x10b')]({'charset':'*','length':_0x461fa4});var _0x5bc08a=_0x579f27[_0x07d8('0x8d')];if(_0x5bc08a>0x0){if(_0x5bc08a>_0x461fa4){this[_0x07d8('0x2f')]['sync'](this,_0x3e3a20,_0x3e3a20[_0x07d8('0x10c')]===_0x07d8('0x10d')?_0x58d958+_0x579f27['substr'](_0x461fa4):_0x579f27['substr'](0x0,_0x5bc08a-_0x461fa4)+_0x58d958);}else{this[_0x07d8('0x2f')]['sync'](this,_0x3e3a20,rs[_0x07d8('0x10b')]({'charset':'*','length':_0x5bc08a}));}}else{this[_0x07d8('0x2f')][_0x07d8('0x62')](this,_0x3e3a20,'');}}else{this[_0x07d8('0x2f')][_0x07d8('0x62')](this,_0x3e3a20,_0x579f27);}return _0x5c1f75;};AGIVertices[_0x07d8('0xe')][_0x07d8('0x10e')]=function(_0x2fd878){logger[_0x07d8('0x2b')](util['format'](_0x07d8('0x10f'),_0x2fd878['label']));return this[_0x07d8('0xff')](_0x2fd878);};AGIVertices['prototype'][_0x07d8('0x110')]=function(_0x113373){logger['info'](util[_0x07d8('0x24')](_0x07d8('0x111'),_0x113373[_0x07d8('0x31')]));this[_0x07d8('0x2f')][_0x07d8('0x62')](this,_0x113373,_0x113373[_0x07d8('0x112')]);return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x113'),_0x113373[_0x07d8('0x112')]));};AGIVertices[_0x07d8('0xe')][_0x07d8('0x114')]=function(_0x1973ba){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x1973ba[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x1973ba['aws_access_key_id'])||!this[_0x07d8('0x74')](_0x1973ba[_0x07d8('0x77')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x115'));}if(!this[_0x07d8('0x74')](_0x1973ba[_0x07d8('0x4e')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x99'));}this[_0x07d8('0xb')]['noop'](util[_0x07d8('0x24')](_0x07d8('0x116'),_0x1973ba[_0x07d8('0x4e')]));var _0x4e51d=this[_0x07d8('0x75')]['sync'](this,_0x1973ba);if(_0x4e51d){this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x117'),_0x4e51d));var _0x1ccbb7=this[_0x07d8('0xb')][_0x07d8('0xf3')](_0x4e51d);try{fs[_0x07d8('0x118')](_0x4e51d+_0x07d8('0xf4'));}catch(_0x2b6d51){logger[_0x07d8('0x28')](_0x2b6d51);}return _0x1ccbb7;}return this['channel'][_0x07d8('0x28')](_0x1973ba,_0x07d8('0x119'));};AGIVertices['prototype'][_0x07d8('0x11a')]=function(_0x378c5b){logger['info'](util[_0x07d8('0x24')](_0x07d8('0x11b'),_0x378c5b[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x378c5b[_0x07d8('0x76')])||!this[_0x07d8('0x74')](_0x378c5b[_0x07d8('0x77')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x115'));}if(!this[_0x07d8('0x74')](_0x378c5b[_0x07d8('0x7e')])){return this[_0x07d8('0xb')]['noop'](_0x07d8('0x11c'));}if(!this[_0x07d8('0x74')](_0x378c5b[_0x07d8('0x4e')])){return this[_0x07d8('0xb')]['noop'](_0x07d8('0x99'));}this[_0x07d8('0xb')]['bot']=!![];this[_0x07d8('0x2f')](_0x378c5b);this['createSquareMessage'](_0x378c5b['text'],'in','','');this[_0x07d8('0xb')][_0x07d8('0x98')](util['format'](_0x07d8('0x11d'),_0x378c5b['text']));var _0x2c2a45=this[_0x07d8('0x7c')][_0x07d8('0x62')](this,_0x378c5b);if(_0x2c2a45){for(var _0x35eb2e in _0x2c2a45){if(_0x2c2a45[_0x07d8('0x87')](_0x35eb2e)&&_['isString'](_0x2c2a45[_0x35eb2e])){this['channel'][_0x07d8('0x91')](util['format'](_0x07d8('0x11e'),_0x35eb2e[_0x07d8('0x5c')]()),_0x2c2a45[_0x35eb2e]);}}if(_[_0x07d8('0x3b')](_0x2c2a45[_0x07d8('0x11f')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x120'));}else{this[_0x07d8('0x38')](_0x2c2a45['message'],_0x07d8('0xd6'),_0x07d8('0x121'),'');return this[_0x07d8('0xb')]['noop'](util['format'](_0x07d8('0x122'),_0x2c2a45[_0x07d8('0x11f')]));}}return this['channel']['error'](_0x378c5b,_0x07d8('0x123'));};AGIVertices[_0x07d8('0xe')]['googleasr']=function(_0x39df07){logger['info'](util[_0x07d8('0x24')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x39df07[_0x07d8('0x31')],_0x39df07[_0x07d8('0x58')]));if(!this[_0x07d8('0x74')](_0x39df07[_0x07d8('0x6d')])){return this[_0x07d8('0xb')][_0x07d8('0x98')]('no\x20key\x20configured');}var _0x50dc7c=_0x07d8('0x124');var _0x4f7ef9=util[_0x07d8('0x24')](_0x07d8('0x125'),FILES_PATH,rs[_0x07d8('0x10b')](0x4));var _0x446640=util[_0x07d8('0x24')](_0x07d8('0x90'),_0x4f7ef9,_0x50dc7c);var _0x3069f9=!![];if(_0x39df07['beep']===_0x07d8('0x126')){_0x3069f9=![];}var _0x6b63bb=this['channel'][_0x07d8('0x127')](_0x4f7ef9,_0x50dc7c,_0x39df07['intKey'],_0x39df07['timeout'],undefined,_0x3069f9);if(_0x6b63bb['result']!==-0x1){this['channel'][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x128'),_0x446640));var _0x2dd2ba=this[_0x07d8('0x7f')][_0x07d8('0x62')](this,_0x39df07,_0x446640);if(_0x2dd2ba){for(var _0x1f64f9 in _0x2dd2ba){if(_0x2dd2ba[_0x07d8('0x87')](_0x1f64f9)){this[_0x07d8('0xb')][_0x07d8('0x91')](util[_0x07d8('0x24')](_0x07d8('0x129'),_0x1f64f9[_0x07d8('0x5c')]()),_0x2dd2ba[_0x1f64f9]);}}return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x12a'),JSON['stringify'](_0x2dd2ba)));}}return _0x6b63bb;};AGIVertices[_0x07d8('0xe')]['tildeasr']=function(_0x8e388f){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x8e388f[_0x07d8('0x31')]));if(!this['isConfigured'](_0x8e388f[_0x07d8('0x82')])){return this['channel'][_0x07d8('0x98')](_0x07d8('0x12b'));}if(!this[_0x07d8('0x74')](_0x8e388f[_0x07d8('0x83')])){return this[_0x07d8('0xb')]['noop'](_0x07d8('0x12c'));}var _0x1d256b=_0x07d8('0x124');var _0x1e93db=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x07d8('0x10b')](0x4));var _0x2a21f5=util[_0x07d8('0x24')](_0x07d8('0x90'),_0x1e93db,_0x1d256b);var _0x4d8e0b=!![];if(_0x8e388f[_0x07d8('0x12d')]===_0x07d8('0x126')){_0x4d8e0b=![];}var _0x5ab18a=this['channel']['recordFile'](_0x1e93db,_0x1d256b,_0x8e388f[_0x07d8('0x12e')],_0x8e388f[_0x07d8('0x58')],undefined,_0x4d8e0b);if(_0x5ab18a[_0x07d8('0x9b')]!==-0x1){this[_0x07d8('0xb')][_0x07d8('0x98')](util['format'](_0x07d8('0x12f'),_0x2a21f5));var _0x13a6df=this['tildeASR'][_0x07d8('0x62')](this,_0x8e388f,_0x2a21f5);if(_0x13a6df){for(var _0x4a65d3 in _0x13a6df){if(_0x13a6df[_0x07d8('0x87')](_0x4a65d3)){this[_0x07d8('0xb')][_0x07d8('0x91')](util[_0x07d8('0x24')](_0x07d8('0x130'),_0x4a65d3['toUpperCase']()),_0x13a6df[_0x4a65d3]);}}return this[_0x07d8('0xb')][_0x07d8('0x98')](util['format'](_0x07d8('0x131'),JSON['stringify'](_0x13a6df)));}}return _0x5ab18a;};AGIVertices[_0x07d8('0xe')][_0x07d8('0x132')]=function(_0x1bca7c){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x133'),_0x1bca7c[_0x07d8('0x31')]));return this[_0x07d8('0xb')][_0x07d8('0x134')](_0x1bca7c[_0x07d8('0x135')],_0x1bca7c['extension'],_0x1bca7c[_0x07d8('0x34')]);};AGIVertices[_0x07d8('0xe')][_0x07d8('0x136')]=function(_0x47530b){logger[_0x07d8('0x2b')](util['format'](_0x07d8('0x137'),_0x47530b[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x47530b[_0x07d8('0x138')])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x47530b,_0x07d8('0x139'));}try{var _0x443e4e=eval(_0x47530b[_0x07d8('0x138')])?_0x07d8('0x13a'):_0x07d8('0x13b');this['channel'][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x13c'),_0x47530b[_0x07d8('0x138')],_0x443e4e));return{'code':0xc8,'result':_0x443e4e};}catch(_0x19abb9){return{'code':0xc8,'result':_0x07d8('0x13b')};}};AGIVertices[_0x07d8('0xe')][_0x07d8('0x13d')]=function(_0x435db8){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x13e'),_0x435db8['label']));if(!this[_0x07d8('0x74')](_0x435db8[_0x07d8('0x13f')])){return this[_0x07d8('0xb')]['error'](_0x435db8,'no\x20interval\x20configured');}var _0x381a6b=this[_0x07d8('0x140')][_0x07d8('0x62')](this,_0x435db8[_0x07d8('0x13f')]);if(!_0x381a6b){return this[_0x07d8('0xb')]['error'](_0x435db8,_0x07d8('0x141'));}for(var _0x4b9236=0x0;_0x4b9236<_0x381a6b[_0x07d8('0x8d')];_0x4b9236+=0x1){var _0x2773e2=this[_0x07d8('0xb')][_0x07d8('0xf')](util[_0x07d8('0x24')](_0x07d8('0x142'),_0x381a6b[_0x4b9236]));if(_0x2773e2['result']===-0x1){return _0x2773e2;}logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x143'),_0x381a6b[_0x4b9236],_0x2773e2[_0x07d8('0x93')]));if(_0x2773e2[_0x07d8('0x93')]===_0x07d8('0x13a')){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x143'),_0x381a6b[_0x4b9236],_0x07d8('0x13a')));this['channel']['noop'](util[_0x07d8('0x24')](_0x07d8('0x143'),_0x381a6b[_0x4b9236],_0x07d8('0x13a')));return{'code':0xc8,'result':'true'};}else{logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x143'),_0x381a6b[_0x4b9236],_0x07d8('0x13b')));this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x143'),_0x381a6b[_0x4b9236],'false'));}}return{'code':0xc8,'result':_0x07d8('0x13b')};};AGIVertices[_0x07d8('0xe')][_0x07d8('0x144')]=function(_0x366f40){logger['info'](util[_0x07d8('0x24')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x366f40[_0x07d8('0x31')]));return this[_0x07d8('0xb')][_0x07d8('0x144')]();};AGIVertices['prototype'][_0x07d8('0x145')]=function(_0x58b4df){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x146'),_0x58b4df[_0x07d8('0x31')]));if(!this['isConfigured'](_0x58b4df[_0x07d8('0x6d')])){return this['channel']['noop'](_0x07d8('0x147'));}var _0x4b26d0=_0x07d8('0x124');var _0x27023f=util[_0x07d8('0x24')](_0x07d8('0x125'),FILES_PATH,rs['generate'](0x4));var _0x2c3de0=util[_0x07d8('0x24')](_0x07d8('0x90'),_0x27023f,_0x4b26d0);var _0xf15d0a=!![];if(_0x58b4df[_0x07d8('0x12d')]==='NOBEEP'){_0xf15d0a=![];}var _0x2752ce=this['channel'][_0x07d8('0x127')](_0x27023f,_0x4b26d0,_0x58b4df[_0x07d8('0x12e')],_0x58b4df[_0x07d8('0x58')],undefined,_0xf15d0a);if(_0x2752ce[_0x07d8('0x9b')]!==-0x1){this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x148'),_0x2c3de0));var _0x255b3d=this[_0x07d8('0x73')][_0x07d8('0x62')](this,_0x58b4df,_0x2c3de0);if(_0x255b3d){for(var _0x1ae85f in _0x255b3d){if(_0x255b3d[_0x07d8('0x87')](_0x1ae85f)){this['channel']['setVariable'](util[_0x07d8('0x24')](_0x07d8('0x149'),_0x1ae85f[_0x07d8('0x5c')]()),_0x255b3d[_0x1ae85f]);}}return this['channel']['noop'](util['format'](_0x07d8('0x14a'),JSON['stringify'](_0x255b3d)));}}return _0x2752ce;};AGIVertices['prototype']['ispeechtts']=function(_0x516c2b){logger[_0x07d8('0x2b')](util['format'](_0x07d8('0x14b'),_0x516c2b[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x516c2b[_0x07d8('0x6d')])){return this['channel'][_0x07d8('0x98')](_0x07d8('0x147'));}if(!this[_0x07d8('0x74')](_0x516c2b[_0x07d8('0x4e')])){return this['channel']['noop'](_0x07d8('0x99'));}this[_0x07d8('0xb')][_0x07d8('0x98')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x516c2b[_0x07d8('0x4e')]));var _0x4a77ca=this[_0x07d8('0x71')][_0x07d8('0x62')](this,_0x516c2b);if(_0x4a77ca){this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x148'),_0x4a77ca));var _0x173f65=this[_0x07d8('0xb')][_0x07d8('0xf3')](_0x4a77ca,_0x516c2b[_0x07d8('0x12e')]);try{fs[_0x07d8('0x118')](_0x4a77ca+'.wav');}catch(_0x5a76f9){logger['error'](_0x5a76f9);}return _0x173f65;}return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x516c2b,_0x07d8('0x14c'));};AGIVertices[_0x07d8('0xe')]['login']=function(_0x23c930){logger[_0x07d8('0x2b')](util['format'](_0x07d8('0x14d'),_0x23c930[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x23c930[_0x07d8('0x14e')])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x23c930,_0x07d8('0x14f'));}logger[_0x07d8('0x2b')](util['format'](_0x07d8('0x150'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x23c930[_0x07d8('0x14e')]));var _0x405686=this[_0x07d8('0x48')]['sync'](this,_0x23c930['findBy']);if(_0x405686){logger['info'](util[_0x07d8('0x24')](_0x07d8('0x151'),this[_0x07d8('0xb')]['callerid'],_0x23c930[_0x07d8('0x14e')]));this[_0x07d8('0xb')][_0x07d8('0x98')](util['format'](_0x07d8('0x151'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x23c930[_0x07d8('0x14e')]));return{'code':0xc8,'result':_0x07d8('0x152')};}else{logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x153'),this['channel'][_0x07d8('0x32')],_0x23c930[_0x07d8('0x14e')]));this['channel'][_0x07d8('0x98')](util['format'](_0x07d8('0x153'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x23c930[_0x07d8('0x14e')]));return{'code':0xc8,'result':_0x07d8('0x154')};}};AGIVertices[_0x07d8('0xe')][_0x07d8('0x155')]=function(_0x5a1448){logger[_0x07d8('0x2b')](util['format'](_0x07d8('0x156'),_0x5a1448[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x5a1448['findBy'])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x5a1448,_0x07d8('0x14f'));}logger['info'](util[_0x07d8('0x24')](_0x07d8('0x150'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x5a1448[_0x07d8('0x14e')]));var _0x590b34=this[_0x07d8('0x47')]['sync'](this,_0x5a1448[_0x07d8('0x14e')]);if(_0x590b34){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x151'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x5a1448[_0x07d8('0x14e')]));this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x07d8('0xb')][_0x07d8('0x32')],_0x5a1448[_0x07d8('0x14e')]));return{'code':0xc8,'result':_0x07d8('0x152')};}else{logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x153'),this['channel'][_0x07d8('0x32')],_0x5a1448[_0x07d8('0x14e')]));this['channel'][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x153'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x5a1448[_0x07d8('0x14e')]));return{'code':0xc8,'result':_0x07d8('0x154')};}};AGIVertices[_0x07d8('0xe')][_0x07d8('0x157')]=function(_0x2c7d5d){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x158'),_0x2c7d5d['label']));if(!this['isConfigured'](_0x2c7d5d[_0x07d8('0x159')])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x2c7d5d,_0x07d8('0x15a'));}this[_0x07d8('0xb')][_0x07d8('0x98')](util['format'](_0x07d8('0x15b'),_0x2c7d5d[_0x07d8('0x159')]));var _0x30dd2f=eval(_0x2c7d5d['operation']);if(!this[_0x07d8('0x74')](_0x2c7d5d[_0x07d8('0xc8')])){return this[_0x07d8('0xb')][_0x07d8('0x98')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x334345=this[_0x07d8('0xf')]['sync'](this,_0x2c7d5d[_0x07d8('0xc8')]);if(!_0x334345){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x2c7d5d,_0x07d8('0xc9'));}if(_[_0x07d8('0x8c')](_0x30dd2f)){var _0x56b848=this;_0x30dd2f[_0x07d8('0xca')](function(_0x17241a,_0xb0a494){_0x56b848[_0x07d8('0xb')][_0x07d8('0x91')](util[_0x07d8('0x24')](_0x07d8('0x15c'),_0x334345,_0xb0a494),_0x17241a);});return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')]('variable\x20%s[key]\x20set',_0x334345));}else{return this[_0x07d8('0xb')][_0x07d8('0x91')](_0x334345,_0x30dd2f);}};AGIVertices[_0x07d8('0xe')][_0x07d8('0x15d')]=function(_0x54bde8){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x15e'),_0x54bde8['label']));if(_0x54bde8[_0x07d8('0x101')]===0x0){return this[_0x07d8('0x95')](_0x54bde8);}_0x54bde8[_0x07d8('0x101')]-=0x1;if(!this[_0x07d8('0x74')](_0x54bde8['file_id'])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x54bde8,'no\x20file\x20audio\x20selected');}var _0x209cb0=this['getSound'][_0x07d8('0x62')](this,_0x54bde8[_0x07d8('0x102')]);if(!_0x209cb0){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x54bde8,_0x07d8('0x105'));}var _0x28cb58=this[_0x07d8('0xb')][_0x07d8('0x106')](_0x209cb0,_0x54bde8[_0x07d8('0x15f')],_0x54bde8['digit']);var _0x4aec7f=_0x28cb58['result'];if(_0x28cb58[_0x07d8('0x9b')]===-0x1){this[_0x07d8('0x2f')]['sync'](this,_0x54bde8,'-1');return _0x28cb58;}else if(_0x28cb58['extra']===_0x07d8('0x58')){_0x28cb58[_0x07d8('0x9b')]=_0x28cb58['result'][_0x07d8('0x8d')]>0x0?_0x28cb58[_0x07d8('0x9b')]:'t';}else if(_[_0x07d8('0x3a')](_0x28cb58[_0x07d8('0x9b')])){_0x28cb58[_0x07d8('0x9b')]='#';_0x4aec7f='#';}if(!this['isConfigured'](_0x54bde8['variable_id'])){this[_0x07d8('0xb')][_0x07d8('0x98')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x334c70=this[_0x07d8('0xf')][_0x07d8('0x62')](this,_0x54bde8['variable_id']);if(!_0x334c70){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x54bde8,_0x07d8('0xc9'));}this[_0x07d8('0xb')]['setVariable'](_0x334c70,_0x4aec7f);}this['createSquareDetailsReport'][_0x07d8('0x62')](this,_0x54bde8,_0x4aec7f);return _0x28cb58;};AGIVertices[_0x07d8('0xe')]['noop']=function(_0x2d42a6){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x160'),_0x2d42a6[_0x07d8('0x31')]));return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x2d42a6['output']||_0x2d42a6[_0x07d8('0x31')]);};AGIVertices[_0x07d8('0xe')][_0x07d8('0x161')]=function(_0x5386d7){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x5386d7['label']));if(!this[_0x07d8('0x74')](_0x5386d7[_0x07d8('0x14e')])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x5386d7,_0x07d8('0x14f'));}logger['info'](util[_0x07d8('0x24')](_0x07d8('0x150'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x5386d7['findBy']));var _0x5adc87=this['getPause']['sync'](this,_0x5386d7[_0x07d8('0x162')]);var _0xf2ac59=this[_0x07d8('0x44')][_0x07d8('0x62')](this,_0x5386d7['findBy'],_0x5adc87);if(_0xf2ac59){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x151'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x5386d7[_0x07d8('0x14e')]));this['channel']['noop'](util[_0x07d8('0x24')](_0x07d8('0x151'),this['channel'][_0x07d8('0x32')],_0x5386d7['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x153'),this[_0x07d8('0xb')]['callerid'],_0x5386d7[_0x07d8('0x14e')]));this[_0x07d8('0xb')][_0x07d8('0x98')](util['format'](_0x07d8('0x151'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x5386d7[_0x07d8('0x14e')]));return{'code':0xc8,'result':_0x07d8('0x154')};}};AGIVertices[_0x07d8('0xe')][_0x07d8('0x163')]=function(_0x21383b){logger['info'](util[_0x07d8('0x24')](_0x07d8('0x164'),_0x21383b['label']));if(!this[_0x07d8('0x74')](_0x21383b['file_id'])){return this['channel']['error'](_0x21383b,_0x07d8('0x103'));}var _0x3d9100=this['getSound'][_0x07d8('0x62')](this,_0x21383b[_0x07d8('0x102')]);if(!_0x3d9100){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x21383b,_0x07d8('0x105'));}var _0x3e567b=this[_0x07d8('0xb')][_0x07d8('0x4b')](_0x07d8('0x165'),[_0x3d9100,_0x21383b[_0x07d8('0xcf')]]);if(_0x3e567b[_0x07d8('0x9b')]===-0x1){return _0x3e567b;}return this[_0x07d8('0xb')][_0x07d8('0x98')](util['format'](_0x07d8('0xb6'),'PLAYBACK',_0x3d9100));};AGIVertices[_0x07d8('0xe')][_0x07d8('0x166')]=function(_0x38e570){logger['info'](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x38e570[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x38e570['queue_id'])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x38e570,'no\x20queue\x20selected');}var _0x58f02c='';var _0x1856ee=parseInt(_0x38e570[_0x07d8('0x167')],0xa);if(isNaN(_0x1856ee)){_0x58f02c=_0x38e570[_0x07d8('0x167')];}else{_0x58f02c=this[_0x07d8('0x168')][_0x07d8('0x62')](this,_0x38e570[_0x07d8('0x167')]);if(!_0x58f02c){return this['channel']['error'](_0x38e570,'no\x20queue\x20found');}}var _0x3d1796='';if(this[_0x07d8('0x74')](_0x38e570['file_id'])){var _0x74e978=this[_0x07d8('0x104')][_0x07d8('0x62')](this,_0x38e570['file_id']);if(_0x74e978){_0x3d1796=_0x74e978;}}this['createSquareDetailsReport'][_0x07d8('0x62')](this,_0x38e570,_0x58f02c);if(_0x38e570[_0x07d8('0xcf')][_0x07d8('0x169')]('x')<0x0){_0x38e570[_0x07d8('0xcf')]+='x';}if(_0x38e570[_0x07d8('0xcf')][_0x07d8('0x169')]('X')<0x0){_0x38e570[_0x07d8('0xcf')]+='X';}this['channel'][_0x07d8('0x91')](_0x07d8('0x16a'),_0x58f02c?_0x58f02c[_0x07d8('0x16b')]():'');var _0x1b07e4=this[_0x07d8('0xb')]['exec'](_0x07d8('0x16c'),[_0x58f02c,_0x38e570[_0x07d8('0xcf')],_0x38e570[_0x07d8('0x56')],_0x3d1796,_0x38e570[_0x07d8('0x58')],_0x38e570[_0x07d8('0xa7')],_0x38e570[_0x07d8('0x16d')],_0x38e570[_0x07d8('0x16e')],'',_0x38e570[_0x07d8('0x16f')]]);if(_0x1b07e4[_0x07d8('0x9b')]===-0x1){return _0x1b07e4;}return this['channel'][_0x07d8('0x98')](util['format']('Executed\x20command\x20%s\x20%s','QUEUE',_0x58f02c));};AGIVertices[_0x07d8('0xe')][_0x07d8('0x170')]=function(_0x4ae319){logger['info'](util[_0x07d8('0x24')](_0x07d8('0x171'),_0x4ae319[_0x07d8('0x31')]));var _0x2a9b1a=_0x4ae319[_0x07d8('0x172')]||_0x07d8('0x124');var _0x5ce58a=util[_0x07d8('0x24')](_0x07d8('0x173'),this[_0x07d8('0xb')][_0x07d8('0x30')],rs[_0x07d8('0x10b')](0x5));var _0x5ce209=util['format'](_0x07d8('0x174'),FILES_PATH,_0x5ce58a,_0x2a9b1a);var _0xc34413=util['format'](_0x07d8('0x125'),FILES_PATH,_0x5ce58a);this['createSquareRecording']['sync'](this,_0x4ae319,_0x5ce58a,_0x5ce209);this[_0x07d8('0xb')][_0x07d8('0x91')](_0x07d8('0x175'),_0x5ce58a);logger['info'](_0x07d8('0x176'),_0xc34413,_0x2a9b1a,_0x4ae319['escape_digits'],_0x4ae319[_0x07d8('0x58')]);return this[_0x07d8('0xb')]['recordFile'](_0xc34413,_0x2a9b1a,_0x4ae319[_0x07d8('0x177')],_0x4ae319[_0x07d8('0x58')],undefined,!![]);};AGIVertices['prototype'][_0x07d8('0x178')]=function(_0x254de7){logger['info'](util[_0x07d8('0x24')](_0x07d8('0x179'),_0x254de7[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x254de7[_0x07d8('0x56')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x17a'));}var _0x436461=this[_0x07d8('0x55')][_0x07d8('0x62')](this,_0x254de7);logger[_0x07d8('0x2b')](util[_0x07d8('0x24')]('Response:',util[_0x07d8('0x17b')](_0x436461,{'showHidden':![],'depth':null})));if(!this[_0x07d8('0x74')](_0x254de7[_0x07d8('0xc8')])){return this['channel'][_0x07d8('0x98')](_0x07d8('0x17c'));}var _0x13427f=this[_0x07d8('0xf')][_0x07d8('0x62')](this,_0x254de7['variable_id']);if(!_0x13427f){return this['channel'][_0x07d8('0x28')](_0x254de7,_0x07d8('0xc9'));}this[_0x07d8('0xb')][_0x07d8('0x91')](util[_0x07d8('0x24')](_0x07d8('0x17d'),_0x13427f),_0x436461[_0x07d8('0x68')]?_0x436461[_0x07d8('0x68')]:_0x07d8('0x17e'));this[_0x07d8('0xb')]['setVariable'](util[_0x07d8('0x24')](_0x07d8('0x17f'),_0x13427f),_0x436461[_0x07d8('0x69')]?_0x436461['statusMessage']:'OK');if(_0x436461['body']){try{this[_0x07d8('0x8f')](_0x436461[_0x07d8('0x5d')],_0x13427f);}catch(_0x2c57d1){logger[_0x07d8('0x28')](util['format'](_0x07d8('0x180'),_0x13427f));}}return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x181'),_0x13427f));};AGIVertices[_0x07d8('0xe')][_0x07d8('0x182')]=function(_0x10973f){logger[_0x07d8('0x2b')](util['format'](_0x07d8('0x183'),_0x10973f[_0x07d8('0x31')]));return this[_0x07d8('0xb')][_0x07d8('0x184')](_0x10973f[_0x07d8('0x185')][_0x07d8('0x4c')](/\s+/g,''),_0x10973f[_0x07d8('0x177')]);};AGIVertices[_0x07d8('0xe')][_0x07d8('0x186')]=function(_0x19bcf0){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x187'),_0x19bcf0[_0x07d8('0x31')]));return this[_0x07d8('0xb')]['sayNumber'](_0x19bcf0[_0x07d8('0x59')]['replace'](/\s+/g,''),_0x19bcf0[_0x07d8('0x177')]);};AGIVertices[_0x07d8('0xe')]['sayphonetic']=function(_0x361b18){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x361b18['label']));return this[_0x07d8('0xb')]['sayPhonetic'](_0x361b18['text'],_0x361b18[_0x07d8('0x177')]);};AGIVertices[_0x07d8('0xe')][_0x07d8('0x188')]=function(_0x453ff4){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x189'),_0x453ff4[_0x07d8('0x31')]));if(!this['isConfigured'](_0x453ff4[_0x07d8('0x18a')])){return this[_0x07d8('0xb')][_0x07d8('0x98')]('no\x20mail\x20account\x20configured');}var _0x4fce2a=this['getMailAccount'][_0x07d8('0x62')](this,_0x453ff4['account_id']);if(!_0x4fce2a||!_0x4fce2a['Smtp']){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x453ff4,_0x07d8('0x18b'));}var _0x2f3805={'from':util[_0x07d8('0x24')](_0x07d8('0x18c'),_0x4fce2a['name'],_0x4fce2a[_0x07d8('0x18d')]||_0x4fce2a[_0x07d8('0x18e')][_0x07d8('0x18f')]),'to':_0x453ff4['to']||'','cc':_0x453ff4['cc']||'','bcc':_0x453ff4[_0x07d8('0x190')]||'','subject':_0x453ff4[_0x07d8('0x191')],'html':_0x453ff4[_0x07d8('0x4e')],'text':_0x453ff4[_0x07d8('0x4e')]};if(this[_0x07d8('0x74')](_0x453ff4[_0x07d8('0x192')])){}logger[_0x07d8('0x193')](_0x07d8('0x194'),JSON[_0x07d8('0x66')](_0x2f3805));this[_0x07d8('0x2f')][_0x07d8('0x62')](this,_0x453ff4,_0x453ff4[_0x07d8('0x18a')]);this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x195'),_0x4fce2a[_0x07d8('0x12')]));this[_0x07d8('0x1e')][_0x07d8('0x62')](this,_0x4fce2a['smtpOptions'],_0x2f3805);return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x196'));};AGIVertices[_0x07d8('0xe')][_0x07d8('0x197')]=function(_0x1008a9){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x1008a9[_0x07d8('0x31')]));return this[_0x07d8('0xb')][_0x07d8('0x98')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x07d8('0xe')]['sendSMS']=function(_0x3315e4){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x198'),_0x3315e4[_0x07d8('0x31')]));if(!this['isConfigured'](_0x3315e4[_0x07d8('0x199')])){return this['channel']['noop']('no\x20sms\x20account\x20configured');}var _0x2d3eb9=this[_0x07d8('0x2d')][_0x07d8('0x62')](this,_0x3315e4[_0x07d8('0x199')]);if(!_0x2d3eb9){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x3315e4,'no\x20sms\x20account\x20found');}var _0x6f7e08={'body':_0x3315e4[_0x07d8('0x19a')],'phone':_0x3315e4['to']||'','SmsAccountId':_0x2d3eb9['id']};logger[_0x07d8('0x193')]('sendSMS\x20message',JSON[_0x07d8('0x66')](_0x6f7e08));this[_0x07d8('0x2f')][_0x07d8('0x62')](this,_0x3315e4,_0x3315e4[_0x07d8('0x199')]);this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x2d3eb9[_0x07d8('0x12')]));this[_0x07d8('0x2e')]['sync'](this,_0x6f7e08);return this['channel'][_0x07d8('0x98')](_0x07d8('0x19b'));};AGIVertices['prototype'][_0x07d8('0x19c')]=function(_0x1f6e7e){logger[_0x07d8('0x2b')](util['format'](_0x07d8('0x19d'),_0x1f6e7e[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x1f6e7e[_0x07d8('0xc8')])){return this[_0x07d8('0xb')]['error'](_0x1f6e7e,_0x07d8('0x19e'));}var _0x839fd0=this[_0x07d8('0xf')][_0x07d8('0x62')](this,_0x1f6e7e[_0x07d8('0xc8')]);if(!_0x839fd0){return this['channel'][_0x07d8('0x28')](_0x1f6e7e,_0x07d8('0xc9'));}return this[_0x07d8('0xb')][_0x07d8('0x91')](_0x839fd0,_0x1f6e7e['variable_value']);};AGIVertices[_0x07d8('0xe')][_0x07d8('0x19f')]=function(_0x41c3e9){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x1a0'),_0x41c3e9['label']));this['channel'][_0x07d8('0x98')](_0x07d8('0x1a1'));if(_0x41c3e9[_0x07d8('0xa9')]===_0x07d8('0x1a2')){this[_0x07d8('0xb')]['noop'](_0x07d8('0x1a3'));return this[_0x07d8('0xb')]['answer']();}return this[_0x07d8('0xb')]['noop']('Skipped\x20Answer');};AGIVertices['prototype']['subproject']=function(_0x383e19){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x1a4'),_0x383e19['label']));if(!this[_0x07d8('0x74')](_0x383e19['project_id'])){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x383e19,_0x07d8('0x1a5'));}var _0x3b2d73=this[_0x07d8('0x15')][_0x07d8('0x62')](this,_0x383e19[_0x07d8('0x1a6')]);if(!this[_0x07d8('0x74')](_0x3b2d73)){return this['channel'][_0x07d8('0x28')](_0x383e19,util[_0x07d8('0x24')](_0x07d8('0x1a7'),_0x383e19[_0x07d8('0x1a6')]));}if(_0x3b2d73===this['channel'][_0x07d8('0x36')]){return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x383e19,_0x07d8('0x1a8'));}this[_0x07d8('0x2f')][_0x07d8('0x62')](this,_0x383e19,_0x3b2d73);var _0x3baac1=this[_0x07d8('0xb')]['exec']('AGI',util[_0x07d8('0x24')](_0x07d8('0x1a9'),config[_0x07d8('0xa7')]['host']||'127.0.0.1',_0x3b2d73,this[_0x07d8('0xb')][_0x07d8('0x36')]));if(_0x3baac1[_0x07d8('0x9b')]===-0x1){return _0x3baac1;}return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0xb6'),_0x07d8('0x1aa'),_0x3b2d73));};AGIVertices[_0x07d8('0xe')][_0x07d8('0x1ab')]=function(_0x38e7d1){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x1ac'),_0x38e7d1[_0x07d8('0x31')]));var _0x22e7eb=this['shellCommand'][_0x07d8('0x62')](this,_0x38e7d1['command']);this[_0x07d8('0x2f')][_0x07d8('0x62')](this,_0x38e7d1,_0x38e7d1[_0x07d8('0xa8')]);if(this[_0x07d8('0x74')](_0x38e7d1[_0x07d8('0xc8')])){var _0x308e3a=this[_0x07d8('0xf')][_0x07d8('0x62')](this,_0x38e7d1['variable_id']);if(_0x308e3a){this[_0x07d8('0xb')]['setVariable'](_0x308e3a,_0x22e7eb);return this['channel'][_0x07d8('0x98')](util[_0x07d8('0x24')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x38e7d1[_0x07d8('0xa8')],_0x308e3a));}}return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x1ad'),_0x38e7d1[_0x07d8('0xa8')]));};AGIVertices[_0x07d8('0xe')][_0x07d8('0x1ae')]=function(_0x38e3d0){logger['info'](util['format'](_0x07d8('0x1af'),_0x38e3d0[_0x07d8('0x31')]));_0x38e3d0['text']=_0x38e3d0['text'][_0x07d8('0x4c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x38e3d0[_0x07d8('0x1b0')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x1b1'));}if(!this[_0x07d8('0x74')](_0x38e3d0[_0x07d8('0x4e')])){return this['channel']['noop'](_0x07d8('0x99'));}this['channel'][_0x07d8('0x98')](util['format'](_0x07d8('0x1b2'),_0x38e3d0['text']));var _0x17f7ed=this[_0x07d8('0x4d')][_0x07d8('0x62')](this,_0x38e3d0);if(_0x17f7ed){this[_0x07d8('0xb')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x17f7ed));var _0xe35c8e=this[_0x07d8('0xb')][_0x07d8('0xf3')](_0x17f7ed);try{fs[_0x07d8('0x118')](_0x17f7ed+_0x07d8('0xf4'));}catch(_0x2545a1){logger['error'](_0x2545a1);}return _0xe35c8e;}return this[_0x07d8('0xb')][_0x07d8('0x28')](_0x38e3d0,_0x07d8('0x1b3'));};AGIVertices[_0x07d8('0xe')][_0x07d8('0x1b4')]=function(_0x1c4db4){logger['info'](util[_0x07d8('0x24')](_0x07d8('0x1b5'),_0x1c4db4[_0x07d8('0x31')]));_0x1c4db4[_0x07d8('0x4e')]=_0x1c4db4[_0x07d8('0x4e')][_0x07d8('0x4c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x07d8('0x74')](_0x1c4db4[_0x07d8('0x4e')])){return this[_0x07d8('0xb')][_0x07d8('0x98')](_0x07d8('0x99'));}this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x1b6'),_0x1c4db4['text']));var _0x2453db=this[_0x07d8('0x53')][_0x07d8('0x62')](this,_0x1c4db4);if(_0x2453db){this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x1b7'),_0x2453db));var _0x139bff=this[_0x07d8('0xb')][_0x07d8('0xf3')](_0x2453db);try{fs[_0x07d8('0x118')](_0x2453db+'.wav');}catch(_0x35b6b4){logger[_0x07d8('0x28')](_0x35b6b4);}return _0x139bff;}return this['channel']['error'](_0x1c4db4,_0x07d8('0x1b8'));};AGIVertices[_0x07d8('0xe')][_0x07d8('0x1b9')]=function(_0x5dbcaa){logger[_0x07d8('0x2b')](util['format'](_0x07d8('0x1ba'),_0x5dbcaa[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x5dbcaa[_0x07d8('0x14e')])){return this['channel'][_0x07d8('0x28')](_0x5dbcaa,_0x07d8('0x14f'));}logger['info'](util[_0x07d8('0x24')](_0x07d8('0x150'),this['channel'][_0x07d8('0x32')],_0x5dbcaa[_0x07d8('0x14e')]));var _0x1ec46c=this['agentUnpause']['sync'](this,_0x5dbcaa[_0x07d8('0x14e')]);if(_0x1ec46c){logger[_0x07d8('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x07d8('0xb')][_0x07d8('0x32')],_0x5dbcaa[_0x07d8('0x14e')]));this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x151'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x5dbcaa[_0x07d8('0x14e')]));return{'code':0xc8,'result':_0x07d8('0x152')};}else{logger['info'](util[_0x07d8('0x24')](_0x07d8('0x153'),this['channel'][_0x07d8('0x32')],_0x5dbcaa['findBy']));this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0x153'),this[_0x07d8('0xb')][_0x07d8('0x32')],_0x5dbcaa['findBy']));return{'code':0xc8,'result':_0x07d8('0x154')};}};AGIVertices[_0x07d8('0xe')][_0x07d8('0x1bb')]=function(_0x4c9668){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x1bc'),_0x4c9668['label']));var _0x12e802=this[_0x07d8('0xb')]['exec'](_0x07d8('0x1bd'),[_0x4c9668[_0x07d8('0x1be')],_0x4c9668[_0x07d8('0x6b')]]);if(_0x12e802[_0x07d8('0x9b')]===-0x1){return _0x12e802;}return this[_0x07d8('0xb')][_0x07d8('0x98')](util[_0x07d8('0x24')](_0x07d8('0xb6'),_0x07d8('0x1bd'),_0x4c9668[_0x07d8('0x1be')]));};AGIVertices[_0x07d8('0xe')][_0x07d8('0x1bf')]=function(_0x36fcbe){logger[_0x07d8('0x2b')](util[_0x07d8('0x24')](_0x07d8('0x1c0'),_0x36fcbe[_0x07d8('0x31')]));if(!this[_0x07d8('0x74')](_0x36fcbe[_0x07d8('0xc8')])){return this['channel'][_0x07d8('0x28')](_0x36fcbe,_0x07d8('0x19e'));}var _0x49f19c=this[_0x07d8('0xf')][_0x07d8('0x62')](this,_0x36fcbe[_0x07d8('0xc8')]);if(!_0x49f19c){return this['channel'][_0x07d8('0x28')](_0x36fcbe,_0x07d8('0xc9'));}var _0x5832c5=this[_0x07d8('0xb')][_0x07d8('0xf')](_0x49f19c);return{'code':0xc8,'result':_0x5832c5[_0x07d8('0x93')]?_0x5832c5[_0x07d8('0x93')]:'-'};};String[_0x07d8('0xe')][_0x07d8('0x1c1')]=function(_0x2d68ee,_0x2835b6){return this['split'](_0x2d68ee)[_0x07d8('0x1c2')](_0x2835b6);};module[_0x07d8('0x1c3')]=AGIVertices; \ No newline at end of file +var _0x6ae2=['Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','no\x20variable\x20selected','replaceAll','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','parse','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','length','recursiveNodeIndex','saveRestApiResult','isEmpty','isArray','%s.%s','setVariable','split','getVariable','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','label','noop','MRCPSynth','mrcprecog','no\x20grammar\x20configured','grammar','exec','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Wait\x20%s\x20seconds\x20before\x20answer','answer','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','private_key','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','response','test','mindigit','maxdigit','hiddendigitsnum','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','wav','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','streamFile','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','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','sayDigits','digits','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','email','Smtp','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','start','yes','Answer','Skipped\x20Answer'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x6aee43,_0x33869f){_0x6aee43=_0x6aee43-0x0;var _0x4dbb66=_0x6ae2[_0x6aee43];return _0x4dbb66;};'use strict';var fs=require('fs');var util=require(_0x26ae('0x0'));var _=require(_0x26ae('0x1'));var sh=require(_0x26ae('0x2'));var odbc=require(_0x26ae('0x3'))();var rs=require(_0x26ae('0x4'));var moment=require(_0x26ae('0x5'));var Mustache=require(_0x26ae('0x6'));var rp=require(_0x26ae('0x7'));var logger=require(_0x26ae('0x8'))('agi');var config=require(_0x26ae('0x9'));var shared=require(_0x26ae('0xa'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x26ae('0xb'),_0x26ae('0xc')];var verticesWithRetry=[_0x26ae('0xd'),_0x26ae('0xe'),_0x26ae('0xf')];var AGIVertices=function(_0x13d7c8,_0x359d23,_0x4b3eca){this[_0x26ae('0x10')]=_0x13d7c8;this[_0x26ae('0x11')]=_0x359d23;this[_0x26ae('0x12')]=_0x4b3eca;};AGIVertices[_0x26ae('0x13')]['getVariable']=function(_0x41162e,_0x491072){this[_0x26ae('0x11')]['getVariableById'](_0x41162e)['then'](function(_0x410259){_0x491072(null,_0x410259?_0x410259[_0x26ae('0x14')]:![]);})[_0x26ae('0x15')](function(_0x17f9a6){_0x491072(_0x17f9a6);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x16')]=function(_0x21f745,_0x1c66b8){this[_0x26ae('0x11')][_0x26ae('0x17')](_0x21f745)[_0x26ae('0x18')](function(_0xe264da){_0x1c66b8(null,_0xe264da?_0xe264da['name']:![]);})[_0x26ae('0x15')](function(_0x32cd9e){_0x1c66b8(_0x32cd9e);});};AGIVertices['prototype'][_0x26ae('0x19')]=function(_0x3426d8,_0x4f71d8){this[_0x26ae('0x11')][_0x26ae('0x1a')](_0x3426d8)[_0x26ae('0x18')](function(_0x250dc0){_0x4f71d8(null,_0x250dc0?_0x250dc0[_0x26ae('0x14')]:![]);})[_0x26ae('0x15')](function(_0x46f436){_0x4f71d8(_0x46f436);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x1b')]=function(_0x38102c,_0x12d56e){this[_0x26ae('0x11')][_0x26ae('0x1c')](_0x38102c)[_0x26ae('0x18')](function(_0xdfcd69){_0x12d56e(null,_0xdfcd69?_0xdfcd69[_0x26ae('0x1d')]:![]);})[_0x26ae('0x15')](function(_0x334153){_0x12d56e(_0x334153);});};AGIVertices['prototype']['getUser']=function(_0x2a2ba5,_0x5d72dc){this[_0x26ae('0x11')]['getUserById'](_0x2a2ba5)[_0x26ae('0x18')](function(_0x2e34d1){_0x5d72dc(null,_0x2e34d1?_0x2e34d1[_0x26ae('0x14')]:![]);})['catch'](function(_0x4ab3f1){_0x5d72dc(_0x4ab3f1);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x1e')]=function(_0x29de9b,_0x49840f){this[_0x26ae('0x11')][_0x26ae('0x1f')](_0x29de9b)['then'](function(_0x1a0a32){_0x49840f(null,_0x1a0a32?_0x1a0a32[_0x26ae('0x14')]:![]);})[_0x26ae('0x15')](function(_0x4a0045){_0x49840f(_0x4a0045);});};AGIVertices[_0x26ae('0x13')]['getSound']=function(_0x28e5a4,_0x1ac4e6){var _0x76c2b3=this;this['rpc'][_0x26ae('0x20')](_0x28e5a4)['then'](function(_0x4cddc4){_0x1ac4e6(null,_0x4cddc4?_0x76c2b3[_0x26ae('0x21')](_0x4cddc4[_0x26ae('0x22')]):![]);})['catch'](function(_0x5308c){_0x1ac4e6(_0x5308c);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x23')]=function(_0x15a725,_0x2d8cac){this['rpc'][_0x26ae('0x24')](_0x15a725)[_0x26ae('0x18')](function(_0x29476f){_0x2d8cac(null,_0x29476f?_0x29476f:![]);})[_0x26ae('0x15')](function(_0x247219){_0x2d8cac(_0x247219);});};AGIVertices['prototype'][_0x26ae('0x25')]=function(_0x3c9267,_0x3423b9,_0x10b7a0){this[_0x26ae('0x12')][_0x26ae('0x25')](_0x3c9267,_0x3423b9)[_0x26ae('0x18')](function(){_0x10b7a0(null);})[_0x26ae('0x15')](function(_0x5f46bd){_0x10b7a0(_0x5f46bd);});};AGIVertices[_0x26ae('0x13')]['getIntervals']=function(_0x4c961d,_0x23c723){this[_0x26ae('0x11')][_0x26ae('0x26')](_0x4c961d)['then'](function(_0x46308a){if(_0x46308a){if(_0x46308a[_0x26ae('0x27')]){_0x23c723(null,[_0x46308a[_0x26ae('0x28')]]);}else{_0x23c723(null,_[_0x26ae('0x29')](_0x46308a[_0x26ae('0x2a')],_0x26ae('0x28')));}}else{_0x23c723(null,![]);}})[_0x26ae('0x15')](function(_0x1afa84){_0x23c723(_0x1afa84);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x21')]=function(_0x19de43){return util[_0x26ae('0x2b')](_0x26ae('0x2c'),FILES_PATH,_0x19de43);};AGIVertices[_0x26ae('0x13')]['getQueryOdbc']=function(_0x14d0ed,_0x3b9bb4,_0x2e5d70){odbc['open'](_0x14d0ed,function(_0x20c60a){if(_0x20c60a){logger[_0x26ae('0x2d')](_0x26ae('0x2e'),_0x20c60a);_0x2e5d70(_0x20c60a);}else{logger[_0x26ae('0x2f')](_0x26ae('0x30'));odbc['query'](_0x3b9bb4,function(_0x3d4e10,_0x255ec3){if(_0x3d4e10){logger[_0x26ae('0x2f')](_0x26ae('0x31'),_0x3b9bb4);_0x2e5d70(_0x3d4e10);}else{logger[_0x26ae('0x2f')](_0x26ae('0x32'),_0x3b9bb4);odbc['close'](function(_0x5d16de){if(_0x5d16de){logger['error'](_0x26ae('0x33'),_0x5d16de);}_0x2e5d70(null,_0x255ec3);});}});}});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x34')]=function(_0x1519a3,_0x30edd3){this['rpc'][_0x26ae('0x35')](_0x1519a3)[_0x26ae('0x18')](function(_0x3ebca4){_0x30edd3(null,_0x3ebca4?_0x3ebca4:![]);})[_0x26ae('0x15')](function(_0x21e4cf){_0x30edd3(_0x21e4cf);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x36')]=function(_0x4c4912,_0xcf2c63){this[_0x26ae('0x11')]['createSmsMessage'](_0x4c4912)[_0x26ae('0x18')](function(_0x4ed02a){_0xcf2c63(null,_0x4ed02a);})[_0x26ae('0x15')](function(_0x150bf1){_0xcf2c63(_0x150bf1);});};AGIVertices[_0x26ae('0x13')]['createSquareDetailsReport']=function(_0x2a0797,_0x1f1edc,_0x3141da){this[_0x26ae('0x11')][_0x26ae('0x37')]({'uniqueid':this[_0x26ae('0x10')]['uniqueid'],'node':_0x2a0797['label'],'application':_0x2a0797['agicommand'],'data':_0x1f1edc||null,'project_name':this[_0x26ae('0x10')][_0x26ae('0x38')],'callerid':this[_0x26ae('0x10')][_0x26ae('0x39')]})[_0x26ae('0x18')](function(_0x4e4f0b){if(_0x3141da){_0x3141da(null,_0x4e4f0b);}})['catch'](function(_0x1f2de3){if(_0x3141da){_0x3141da(_0x1f2de3);}});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x3a')]=function(_0x4d0093,_0x434396,_0x50317d,_0xcbc76e){this[_0x26ae('0x11')]['createSquareRecording']({'uniqueid':this['channel'][_0x26ae('0x3b')],'callerid':this['channel'][_0x26ae('0x39')],'calleridname':this[_0x26ae('0x10')][_0x26ae('0x3c')],'context':this[_0x26ae('0x10')][_0x26ae('0x3d')],'extension':this[_0x26ae('0x10')][_0x26ae('0x3e')],'priority':this[_0x26ae('0x10')][_0x26ae('0x3f')],'accountcode':this[_0x26ae('0x10')][_0x26ae('0x40')],'dnid':this['channel'][_0x26ae('0x41')],'projectName':this[_0x26ae('0x10')][_0x26ae('0x38')],'saveName':_0x434396,'filename':_0x4d0093[_0x26ae('0x42')]||_0x434396,'savePath':_0x50317d})[_0x26ae('0x18')](function(_0x34d5e7){_0xcbc76e(null,_0x34d5e7);})[_0x26ae('0x15')](function(_0x38c4c2){_0xcbc76e(_0x38c4c2);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x43')]=function(_0x157c8b,_0x1b4774,_0x2790de,_0x5c7245,_0x1b075d){this['rpc'][_0x26ae('0x43')]({'uniqueid':this[_0x26ae('0x10')][_0x26ae('0x3b')],'body':_0x157c8b,'direction':_0x1b4774,'providerName':_0x2790de,'providerResponse':_0x5c7245})[_0x26ae('0x18')](function(_0x448da8){if(_0x1b075d){_0x1b075d(null,_0x448da8);}})[_0x26ae('0x15')](function(_0x58bbc8){if(_0x1b075d){_0x1b075d(_0x58bbc8);}});};AGIVertices[_0x26ae('0x13')]['createCmContact']=function(_0x13925d,_0x5ee7be){this[_0x26ae('0x11')][_0x26ae('0x44')]({'firstName':_['isEmpty'](_0x13925d[_0x26ae('0x14')])||_[_0x26ae('0x45')](_0x13925d[_0x26ae('0x14')])?_0x26ae('0x46')+Math[_0x26ae('0x47')]():_0x13925d['name'],'lastName':_['isEmpty'](_0x13925d[_0x26ae('0x48')])||_[_0x26ae('0x45')](_0x13925d['lastName'])?null:_0x13925d[_0x26ae('0x48')],'phone':_0x13925d[_0x26ae('0x49')],'ListId':_0x13925d[_0x26ae('0x4a')],'scheduledat':_0x13925d['scheduledAt'],'callbackUniqueid':this[_0x26ae('0x10')][_0x26ae('0x3b')],'tags':_0x26ae('0x4b'),'description':_0x26ae('0x4c')+_0x13925d[_0x26ae('0x4d')][_0x26ae('0x4e')](),'priority':_0x13925d[_0x26ae('0x4f')]})[_0x26ae('0x18')](function(_0x3ca5a1){_0x5ee7be(null,_0x3ca5a1);})[_0x26ae('0x15')](function(_0x3e4506){_0x5ee7be(_0x3e4506);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x50')]=function(_0x43089b,_0x3eb777){this[_0x26ae('0x11')][_0x26ae('0x51')](_0x43089b)[_0x26ae('0x18')](function(_0x1a41ae){_0x3eb777(null,_0x1a41ae?_0x1a41ae[_0x26ae('0x14')]:![]);})['catch'](function(_0x49aa21){_0x3eb777(_0x49aa21);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x52')]=function(_0x286ac1,_0x593950,_0x181e2f){var _0x4acc7a={'role':_0x26ae('0x53')};_0x4acc7a[_0x286ac1]=this[_0x26ae('0x10')]['callerid'];this[_0x26ae('0x11')][_0x26ae('0x52')](_0x4acc7a,_0x593950,this[_0x26ae('0x10')][_0x26ae('0x3b')])[_0x26ae('0x18')](function(_0x3e47e2){_0x181e2f(null,_[_0x26ae('0x45')](_0x3e47e2)?![]:!![]);})[_0x26ae('0x15')](function(_0xfb8aba){logger[_0x26ae('0x2d')](_0xfb8aba);_0x181e2f(null,![]);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x54')]=function(_0x253579,_0x1a99a2){var _0x43943e={'role':'agent'};_0x43943e[_0x253579]=this[_0x26ae('0x10')]['callerid'];this[_0x26ae('0x11')]['agentUnpause'](_0x43943e)[_0x26ae('0x18')](function(_0x33702e){_0x1a99a2(null,_[_0x26ae('0x45')](_0x33702e)?![]:!![]);})[_0x26ae('0x15')](function(_0x1d11f6){logger['error'](_0x1d11f6);_0x1a99a2(null,![]);});};AGIVertices['prototype'][_0x26ae('0x55')]=function(_0x10c124,_0x10ce69){var _0x4c5674={'role':'agent'};_0x4c5674[_0x10c124]=this['channel']['callerid'];this['rpc'][_0x26ae('0x55')](_0x4c5674)['then'](function(_0x3651ac){_0x10ce69(null,_[_0x26ae('0x45')](_0x3651ac)?![]:!![]);})['catch'](function(_0x285db3){logger[_0x26ae('0x2d')](_0x285db3);_0x10ce69(null,![]);});};AGIVertices['prototype'][_0x26ae('0x56')]=function(_0x59b757,_0x3f071f){var _0x27e66f={'role':_0x26ae('0x53')};_0x27e66f[_0x59b757]=this[_0x26ae('0x10')][_0x26ae('0x39')];var _0x1d890c=_0x59b757!=_0x26ae('0x57')?util[_0x26ae('0x2b')](_0x26ae('0x58'),'LOCAL',this['channel'][_0x26ae('0x39')]):undefined;this[_0x26ae('0x11')][_0x26ae('0x56')](_0x27e66f,_0x1d890c)[_0x26ae('0x18')](function(_0x85f644){_0x3f071f(null,_[_0x26ae('0x45')](_0x85f644)?![]:!![]);})[_0x26ae('0x15')](function(_0x21ef6d){logger[_0x26ae('0x2d')](_0x21ef6d);_0x3f071f(null,![]);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x59')]=function(_0x4b8208,_0x5031e3){sh['exec'](_[_0x26ae('0x5a')](_0x4b8208),function(_0x21c9e7,_0x4bec54){var _0x5ab688=_0x4bec54['replace'](/(\r\n|\n|\r)/gm,'');_0x5031e3(null,_0x5ab688);});};AGIVertices['prototype'][_0x26ae('0x5b')]=function(_0x1e49ed,_0x5ae6b2){scripts['googleCloudTTS'](_0x1e49ed[_0x26ae('0x5c')],_0x1e49ed[_0x26ae('0x5d')]||_0x26ae('0x5e'),_0x1e49ed[_0x26ae('0x5e')],_0x1e49ed[_0x26ae('0x5f')]||_0x26ae('0x60'),_0x1e49ed[_0x26ae('0x61')]||'MALE',_0x1e49ed[_0x26ae('0x62')]||_0x26ae('0x63'))['then'](function(_0x39ccaf){_0x5ae6b2(null,_0x39ccaf);})[_0x26ae('0x15')](function(_0x4600f2){_0x5ae6b2(_0x4600f2);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x64')]=function(_0x56688c,_0x12749c){scripts[_0x26ae('0x64')](_0x56688c[_0x26ae('0x5e')],_0x56688c['google_tts_language']||'en',0x1)[_0x26ae('0x18')](function(_0x4fbf27){_0x12749c(null,_0x4fbf27);})[_0x26ae('0x15')](function(_0x2be899){_0x12749c(_0x2be899);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x65')]=function(_0x3575cf,_0x1a615c){var _0x37a250={'uri':_0x3575cf[_0x26ae('0x66')],'method':_0x3575cf[_0x26ae('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3575cf['timeout'])===_0x26ae('0x68')&&parseInt(_0x3575cf[_0x26ae('0x69')])>=0x1?parseInt(_0x3575cf[_0x26ae('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x26ae('0x6a')]([_0x26ae('0x6b'),_0x26ae('0x6c')],_0x37a250[_0x26ae('0x67')][_0x26ae('0x6d')]())){try{_0x37a250[_0x26ae('0x6e')]=_0x3575cf[_0x26ae('0xc')]?JSON['parse'](_0x3575cf[_0x26ae('0xc')]):{};}catch(_0x2480a3){logger['error'](_0x26ae('0x6f'),_0x2480a3);}}try{_0x37a250[_0x26ae('0x70')]=_0x3575cf['rawHeaders']?JSON['parse'](_0x3575cf[_0x26ae('0xb')]):{};}catch(_0x1298fa){logger['error'](_0x26ae('0x71'),_0x1298fa);}if(_0x3575cf['computedVariables']){try{var _0x1b9a58=require(_0x3575cf[_0x26ae('0x72')])[_0x26ae('0x73')](this,_0x37a250);_0x37a250[_0x26ae('0x74')]=Mustache['render'](_0x3575cf[_0x26ae('0x66')],_0x1b9a58,{},['$$','$$']);if(_0x37a250['headers']){_0x37a250['headers']=JSON[_0x26ae('0x75')](Mustache[_0x26ae('0x76')](JSON[_0x26ae('0x77')](_0x37a250[_0x26ae('0x70')]),_0x1b9a58,{},['$$','$$']));}if(_0x37a250[_0x26ae('0x6e')]){_0x37a250['body']=JSON[_0x26ae('0x75')](Mustache[_0x26ae('0x76')](JSON[_0x26ae('0x77')](_0x37a250[_0x26ae('0x6e')]),_0x1b9a58,{},['$$','$$']));}}catch(_0x2043b2){logger[_0x26ae('0x2d')](_0x26ae('0x78'),_0x2043b2);}}rp(_0x37a250)[_0x26ae('0x18')](function(_0x43b9b7){var _0x33f7b3={'statusCode':_0x43b9b7[_0x26ae('0x79')]||0xc8,'statusMessage':_0x43b9b7['statusMessage']||'OK','headers':_0x43b9b7[_0x26ae('0x70')]||{},'body':_0x43b9b7[_0x26ae('0x6e')]||{}};_0x1a615c(null,_0x33f7b3);})[_0x26ae('0x15')](function(_0x5e9a78){var _0x1fdbff={'statusCode':_0x5e9a78[_0x26ae('0x79')]||0x1f4,'statusMessage':_0x5e9a78[_0x26ae('0x7a')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x5e9a78[_0x26ae('0x7b')][_0x26ae('0x70')]||{},'body':_0x5e9a78[_0x26ae('0x7b')][_0x26ae('0x6e')]||{}};_0x1a615c(null,_0x1fdbff);});};AGIVertices['prototype'][_0x26ae('0x7c')]=function(_0x231c6c,_0x597d76){scripts[_0x26ae('0x7c')](this['channel']['uniqueid'],_0x231c6c['key'],_0x231c6c[_0x26ae('0x5e')],_0x231c6c[_0x26ae('0x7d')]||'en')[_0x26ae('0x18')](function(_0x4c7a93){_0x597d76(null,_0x4c7a93);})[_0x26ae('0x15')](function(_0x1e60e0){_0x597d76(_0x1e60e0);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x7e')]=function(_0xfa9af4,_0x136c5e){scripts['googleDialogflowV2'](this[_0x26ae('0x10')]['uniqueid'],_0xfa9af4[_0x26ae('0x7f')],_0xfa9af4[_0x26ae('0x80')],_0xfa9af4['private_key'],_0xfa9af4['text'],_0xfa9af4['dialogflowV2_language']||'en')[_0x26ae('0x18')](function(_0x5d13ce){_0x136c5e(null,_0x5d13ce);})['catch'](function(_0xc463fc){_0x136c5e(_0xc463fc);});};AGIVertices['prototype'][_0x26ae('0x81')]=function(_0x3f469e,_0x310b6c){scripts[_0x26ae('0x81')](this[_0x26ae('0x10')],_0x3f469e)['then'](function(_0x413eb2){_0x310b6c(null,_0x413eb2);})[_0x26ae('0x15')](function(_0x14d066){_0x310b6c(_0x14d066);});};AGIVertices['prototype']['ispeechTTS']=function(_0x43826c,_0x145f3a){scripts[_0x26ae('0x82')](_0x43826c[_0x26ae('0x83')],_0x43826c['text'],_0x43826c[_0x26ae('0x84')]||_0x26ae('0x60'),_0x43826c['speed'])['then'](function(_0x12d6b4){_0x145f3a(null,_0x12d6b4);})[_0x26ae('0x15')](function(_0x5ccf2f){_0x145f3a(_0x5ccf2f);});};AGIVertices['prototype'][_0x26ae('0x85')]=function(_0x2046a4,_0x4189aa,_0x271ca3){scripts[_0x26ae('0x85')](_0x4189aa,_0x2046a4[_0x26ae('0x83')],_0x2046a4[_0x26ae('0x86')]||_0x26ae('0x60'),this[_0x26ae('0x87')](_0x2046a4[_0x26ae('0x88')])?_0x2046a4['model']:undefined)['then'](function(_0x54de5f){_0x271ca3(null,_0x54de5f);})[_0x26ae('0x15')](function(_0x4e0a61){_0x271ca3(_0x4e0a61);});};AGIVertices['prototype'][_0x26ae('0x89')]=function(_0x35147d,_0x39a544){scripts[_0x26ae('0x89')](_0x35147d[_0x26ae('0x8a')],_0x35147d[_0x26ae('0x8b')],_0x35147d['aws_polly_region'],_0x35147d[_0x26ae('0x8c')]||_0x26ae('0x8d'),_0x35147d[_0x26ae('0x5e')],_0x35147d[_0x26ae('0x8e')]||_0x26ae('0x5e'))[_0x26ae('0x18')](function(_0x427941){_0x39a544(null,_0x427941);})[_0x26ae('0x15')](function(_0x3717fb){_0x39a544(_0x3717fb);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x8f')]=function(_0x3c7141,_0x23bb13){scripts[_0x26ae('0x8f')](this[_0x26ae('0x10')][_0x26ae('0x3b')],_0x3c7141[_0x26ae('0x8a')],_0x3c7141[_0x26ae('0x8b')],_0x3c7141[_0x26ae('0x90')],_0x3c7141[_0x26ae('0x5e')],_0x3c7141[_0x26ae('0x91')])['then'](function(_0xd95f95){_0x23bb13(null,_0xd95f95);})['catch'](function(_0x31206f){_0x23bb13(_0x31206f);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x92')]=function(_0x1e0b0b,_0x49c6e3,_0x3adf82){scripts[_0x26ae('0x92')](_0x49c6e3,_0x1e0b0b[_0x26ae('0x83')],_0x1e0b0b[_0x26ae('0x93')]||_0x26ae('0x60'))[_0x26ae('0x18')](function(_0x2d25a6){_0x3adf82(null,_0x2d25a6);})[_0x26ae('0x15')](function(_0x5bffdd){_0x3adf82(_0x5bffdd);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x94')]=function(_0x14f336,_0x31205d,_0x497578){scripts[_0x26ae('0x94')](_0x31205d,_0x14f336[_0x26ae('0x95')],_0x14f336[_0x26ae('0x96')],_0x14f336[_0x26ae('0x74')])[_0x26ae('0x18')](function(_0x216a1e){_0x497578(null,_0x216a1e);})['catch'](function(_0x14a49b){_0x497578(_0x14a49b);});};AGIVertices[_0x26ae('0x13')][_0x26ae('0x97')]=function(_0x1fc10e){var _0x4d1214=_[_0x26ae('0x6a')](verticesWithRetry,_0x1fc10e[_0x26ae('0x98')])?_0x1fc10e:_[_0x26ae('0x99')](_0x1fc10e);for(var _0x15b003 in _0x4d1214){if(_0x4d1214[_0x26ae('0x9a')](_0x15b003)){if(_0x4d1214[_0x15b003]&&_[_0x26ae('0x9b')](_0x4d1214[_0x15b003])){if(_[_0x26ae('0x6a')](recursiveMapAttributes,_0x15b003)){_0x4d1214[_0x15b003]=this[_0x26ae('0x9c')](_0x4d1214[_0x15b003]);}else{_0x4d1214[_0x15b003]=this[_0x26ae('0x9d')](_0x4d1214[_0x15b003]);}}}}return _0x4d1214;};AGIVertices[_0x26ae('0x13')]['recursiveNodeIndex']=function(_0x8c8692){for(var _0x53e24b in _0x8c8692){if(_0x8c8692['hasOwnProperty'](_0x53e24b)){if(_[_0x26ae('0x9e')](_0x8c8692[_0x53e24b])){this['recursiveNodeIndex'](_0x8c8692[_0x53e24b]);}else if(_['isArray'](_0x8c8692[_0x53e24b])){for(var _0x2de849=0x0;_0x2de849<_0x8c8692[_0x53e24b][_0x26ae('0x9f')];_0x2de849++){this[_0x26ae('0xa0')](_0x8c8692[_0x53e24b][_0x2de849]);}}else if(_[_0x26ae('0x9b')](_0x8c8692[_0x53e24b])){_0x8c8692[_0x53e24b]=this['replaceAllVariables'](_0x8c8692[_0x53e24b]);}}}};AGIVertices['prototype'][_0x26ae('0xa1')]=function(_0x49bfef,_0x5e1145){for(var _0xb58b8d in _0x49bfef){if(_0x49bfef['hasOwnProperty'](_0xb58b8d)){if(_['isPlainObject'](_0x49bfef[_0xb58b8d])){if(!_[_0x26ae('0xa2')](_0x49bfef[_0xb58b8d])){this[_0x26ae('0xa1')](_0x49bfef[_0xb58b8d],util['format']('%s.%s',_0x5e1145,_0xb58b8d));}}else if(_[_0x26ae('0xa3')](_0x49bfef[_0xb58b8d])){for(var _0x33df0f=0x0;_0x33df0f<_0x49bfef[_0xb58b8d][_0x26ae('0x9f')];_0x33df0f++){this[_0x26ae('0xa1')](_0x49bfef[_0xb58b8d][_0x33df0f],util[_0x26ae('0x2b')](_0x26ae('0xa4'),_0x5e1145,_0xb58b8d+'['+_0x33df0f+']'));}}else{if(!_['isNil'](_0x49bfef[_0xb58b8d])){this[_0x26ae('0x10')][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0xa4'),_0x5e1145,_0xb58b8d),_0x49bfef[_0xb58b8d]);}}}}};AGIVertices[_0x26ae('0x13')][_0x26ae('0x9c')]=function(_0x5dad3d){try{var _0x5ede6c=JSON['parse'](_0x5dad3d);this[_0x26ae('0xa0')](_0x5ede6c);return JSON[_0x26ae('0x77')](_0x5ede6c);}catch(_0x475084){return this[_0x26ae('0x9d')](_0x5dad3d);}};AGIVertices[_0x26ae('0x13')][_0x26ae('0x9d')]=function(_0x506423){var _0xa84184=_0x506423[_0x26ae('0xa6')]('{');for(var _0x279603=0x1;_0x279603<_0xa84184[_0x26ae('0x9f')];_0x279603+=0x1){var _0x1475a5=_0xa84184[_0x279603]['split']('}');if(_0x1475a5[_0x26ae('0x9f')]>0x1){_0x506423=_0x506423['replaceAll']('{'+_0x1475a5[0x0]+'}',this[_0x26ae('0x10')][_0x26ae('0xa7')](_0x1475a5[0x0])[_0x26ae('0xa8')]||_0x1475a5[0x0]);}}if(_0xa84184['length']===0x1){return _0x506423[_0x26ae('0x4e')]();}return this[_0x26ae('0x9d')](_0x506423);};AGIVertices[_0x26ae('0x13')]['getAndSetVariable']=function(_0x23abd8,_0x310e9d){var _0x2093db=this[_0x26ae('0x10')][_0x26ae('0xa7')](_0x23abd8);if(_0x2093db[_0x26ae('0xa9')]===-0x1){return _0x2093db;}logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0xaa'),_0x310e9d,_0x2093db[_0x26ae('0xa8')]));return this['channel']['setVariable'](_0x310e9d,_0x2093db[_0x26ae('0xa8')]);};AGIVertices['prototype'][_0x26ae('0x87')]=function(_0x159b3d){return _0x159b3d&&_0x159b3d!=='0'&&_0x159b3d!=='-1'&&_0x159b3d!=='';};AGIVertices[_0x26ae('0x13')][_0x26ae('0xab')]=function(_0x5188ba){this[_0x26ae('0x37')][_0x26ae('0x73')](this,_0x5188ba,'-');_0x5188ba[_0x26ae('0xac')]=_0x5188ba['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x26ae('0x13')]['mrcpsynth']=function(_0x3c8ca4){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x3c8ca4[_0x26ae('0xad')]));if(!this['isConfigured'](_0x3c8ca4['text'])){return this['channel'][_0x26ae('0xae')]('no\x20text\x20configured');}var _0x5da906='\x22'+_0x3c8ca4['text']+'\x22';if(this[_0x26ae('0x87')](_0x3c8ca4[_0x26ae('0x7b')])){_0x5da906+=','+_0x3c8ca4[_0x26ae('0x7b')];}var _0x315738=this['channel']['exec'](_0x26ae('0xaf'),_0x5da906);if(_0x315738[_0x26ae('0xa9')]===-0x1){return _0x315738;}return this[_0x26ae('0x10')]['noop'](util[_0x26ae('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5da906));};AGIVertices[_0x26ae('0x13')][_0x26ae('0xb0')]=function(_0x1a6800){logger[_0x26ae('0x2f')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x1a6800[_0x26ae('0xad')]));if(!this['isConfigured'](_0x1a6800['grammar'])){return this['channel'][_0x26ae('0xae')](_0x26ae('0xb1'));}var _0x7f2d7a=_0x1a6800[_0x26ae('0xb2')];if(this[_0x26ae('0x87')](_0x1a6800[_0x26ae('0x7b')])){_0x7f2d7a+=','+_0x1a6800['options'];}var _0x36d544=this['channel'][_0x26ae('0xb3')](_0x26ae('0xb4'),_0x7f2d7a);if(_0x36d544[_0x26ae('0xa9')]===-0x1){return _0x36d544;}var _0x55eeba=this[_0x26ae('0xb5')](_0x26ae('0xb6'),_0x26ae('0xb7'));if(_0x55eeba[_0x26ae('0xa9')]===-0x1){return _0x55eeba;}var _0x129beb=this[_0x26ae('0xb5')](_0x26ae('0xb8'),_0x26ae('0xb9'));if(_0x129beb[_0x26ae('0xa9')]===-0x1){return _0x129beb;}var _0x261422=this[_0x26ae('0xb5')](_0x26ae('0xba'),_0x26ae('0xbb'));if(_0x261422[_0x26ae('0xa9')]===-0x1){return _0x261422;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x7f2d7a));};AGIVertices['prototype'][_0x26ae('0xbc')]=function(_0x555160){logger['info'](util['format'](_0x26ae('0xbd'),_0x555160[_0x26ae('0xad')]));return this[_0x26ae('0x10')][_0x26ae('0xbc')]([_0x555160[_0x26ae('0xbe')],_0x555160[_0x26ae('0xbf')]]);};AGIVertices[_0x26ae('0x13')]['answer']=function(_0x230e6c){logger['info'](util[_0x26ae('0x2b')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x230e6c[_0x26ae('0xad')]));if(this[_0x26ae('0x87')](_0x230e6c[_0x26ae('0x69')])){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0xc0'),_0x230e6c['timeout']));var _0x9b6aa2=this[_0x26ae('0x10')]['wait'](_0x230e6c[_0x26ae('0x69')]);if(_0x9b6aa2['result']===-0x1){return _0x9b6aa2;}}return this['channel'][_0x26ae('0xc1')]();};AGIVertices[_0x26ae('0x13')][_0x26ae('0x4b')]=function(_0x418129){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x418129[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x418129[_0x26ae('0x4a')])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x418129,_0x26ae('0xc2'));}_0x418129[_0x26ae('0x4d')]=moment();if(this[_0x26ae('0x87')](_0x418129[_0x26ae('0xc3')])){_0x418129['scheduledAt']=moment()[_0x26ae('0xc4')](_0x418129[_0x26ae('0xc3')],_0x26ae('0xc5'));}if(!this[_0x26ae('0x87')](_0x418129[_0x26ae('0x4f')])){_0x418129[_0x26ae('0x4f')]=0x2;}this['createCmContact']['sync'](this,_0x418129);return this[_0x26ae('0x10')]['noop'](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x418129['phone'],_0x418129[_0x26ae('0x4a')],_0x418129[_0x26ae('0x4d')]));};AGIVertices['prototype'][_0x26ae('0xc6')]=function(_0x3294bf){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0xc7'),_0x3294bf[_0x26ae('0xad')]));var _0x576d85=this[_0x26ae('0x10')][_0x26ae('0xb3')](_0x3294bf[_0x26ae('0xc8')],_0x3294bf[_0x26ae('0x7b')]);if(_0x576d85[_0x26ae('0xa9')]===-0x1){return _0x576d85;}return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0xc9'),_0x3294bf[_0x26ae('0xc8')],_0x3294bf[_0x26ae('0x7b')]));};AGIVertices[_0x26ae('0x13')][_0x26ae('0xca')]=function(_0xc721de){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0xcb'),_0xc721de['label']));if(!this['isConfigured'](_0xc721de[_0x26ae('0x5e')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xcc'));}var _0x569f48='\x22'+_0xc721de['text']+'\x22';if(this['isConfigured'](_0xc721de['options'])){_0x569f48+=','+_0xc721de[_0x26ae('0x7b')];}var _0x23e5ba=this[_0x26ae('0x10')]['exec']('MRCPSynth',_0x569f48);if(_0x23e5ba['result']===-0x1){return _0x23e5ba;}return this[_0x26ae('0x10')]['noop'](util['format'](_0x26ae('0xcd'),_0x569f48));};AGIVertices[_0x26ae('0x13')][_0x26ae('0xce')]=function(_0x39f791){logger['info'](util[_0x26ae('0x2b')](_0x26ae('0xcf'),_0x39f791[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x39f791[_0x26ae('0x5e')])){return this['channel'][_0x26ae('0xae')](_0x26ae('0xcc'));}var _0x16667e='\x22'+_0x39f791[_0x26ae('0x5e')]+'\x22';if(this[_0x26ae('0x87')](_0x39f791[_0x26ae('0x7b')])){_0x16667e+=','+_0x39f791[_0x26ae('0x7b')];}var _0x51ca93=this[_0x26ae('0x10')]['exec']('MRCPSynth',_0x16667e);if(_0x51ca93[_0x26ae('0xa9')]===-0x1){return _0x51ca93;}return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0xcd'),_0x16667e));};AGIVertices[_0x26ae('0x13')]['lumenvoxasr']=function(_0x5cdf7a){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0xd0'),_0x5cdf7a[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x5cdf7a[_0x26ae('0xb2')])){return this[_0x26ae('0x10')]['noop']('no\x20grammar\x20configured');}var _0x574330=_0x5cdf7a[_0x26ae('0xb2')];if(this['isConfigured'](_0x5cdf7a[_0x26ae('0x7b')])){_0x574330+=','+_0x5cdf7a[_0x26ae('0x7b')];}var _0x3cc05f=this[_0x26ae('0x10')][_0x26ae('0xb3')](_0x26ae('0xb4'),_0x574330);if(_0x3cc05f[_0x26ae('0xa9')]===-0x1){return _0x3cc05f;}var _0x3f6b4c=this[_0x26ae('0xb5')](_0x26ae('0xb6'),_0x26ae('0xd1'));if(_0x3f6b4c[_0x26ae('0xa9')]===-0x1){return _0x3f6b4c;}var _0x4d5a1f=this[_0x26ae('0xb5')]('RECOG_INPUT()',_0x26ae('0xd2'));if(_0x4d5a1f[_0x26ae('0xa9')]===-0x1){return _0x4d5a1f;}var _0x1dce9c=this[_0x26ae('0xb5')](_0x26ae('0xba'),_0x26ae('0xd3'));if(_0x1dce9c[_0x26ae('0xa9')]===-0x1){return _0x1dce9c;}return this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0xd4'),_0x574330));};AGIVertices[_0x26ae('0x13')][_0x26ae('0xd5')]=function(_0x243d64){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x243d64['label']));if(!this['isConfigured'](_0x243d64[_0x26ae('0xb2')])){return this['channel'][_0x26ae('0xae')]('no\x20grammar\x20configured');}var _0x4f0f75=_0x243d64[_0x26ae('0xb2')];if(this[_0x26ae('0x87')](_0x243d64['options'])){_0x4f0f75+=','+_0x243d64[_0x26ae('0x7b')];}var _0x1b7837=this['channel'][_0x26ae('0xb3')](_0x26ae('0xb4'),_0x4f0f75);if(_0x1b7837[_0x26ae('0xa9')]===-0x1){return _0x1b7837;}var _0x257ff5=this[_0x26ae('0xb5')](_0x26ae('0xb6'),_0x26ae('0xd6'));if(_0x257ff5['result']===-0x1){return _0x257ff5;}var _0x1102ff=this[_0x26ae('0xb5')](_0x26ae('0xb8'),'SESTEK_ASR_TRANSCRIPT');if(_0x1102ff[_0x26ae('0xa9')]===-0x1){return _0x1102ff;}var _0x2655f9=this[_0x26ae('0xb5')](_0x26ae('0xba'),_0x26ae('0xd7'));if(_0x2655f9[_0x26ae('0xa9')]===-0x1){return _0x2655f9;}return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0xd4'),_0x4f0f75));};AGIVertices[_0x26ae('0x13')][_0x26ae('0xd8')]=function(_0x4cfbe9){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x4cfbe9['label']));if(!this[_0x26ae('0x87')](_0x4cfbe9[_0x26ae('0xd9')])){return this['channel'][_0x26ae('0x2d')](_0x4cfbe9,_0x26ae('0xda'));}var _0x3759bf=this[_0x26ae('0x1b')]['sync'](this,_0x4cfbe9['odbc_id']);if(!_0x3759bf){return this['channel'][_0x26ae('0x2d')](_0x4cfbe9,_0x26ae('0xdb'));}if(!this[_0x26ae('0x87')](_0x4cfbe9[_0x26ae('0xdc')])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x4cfbe9,_0x26ae('0xdd'));}var _0x3604f3=_0x4cfbe9['query'][_0x26ae('0xde')](/(\r\n|\n|\r)/gm,'\x20');this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0xdf'),_0x3604f3));var _0x1047f9=this['getQueryOdbc'][_0x26ae('0x73')](this,_0x3759bf,_0x3604f3);this[_0x26ae('0x37')]['sync'](this,_0x4cfbe9,_0x3604f3);if(!this[_0x26ae('0x87')](_0x4cfbe9[_0x26ae('0xe0')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xe1'));}var _0x1a4244=this[_0x26ae('0xa7')][_0x26ae('0x73')](this,_0x4cfbe9['variable_id']);if(!_0x1a4244){return this['channel'][_0x26ae('0x2d')](_0x4cfbe9,_0x26ae('0xe2'));}var _0x56139e=this;_0x1047f9[_0x26ae('0xe3')](function(_0xe60259,_0x5121ad){Object[_0x26ae('0xe4')](_0xe60259)['forEach'](function(_0x36f7b5){_0x56139e['channel'][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0xe5'),_0x1a4244,_0x5121ad,_0x36f7b5),_0xe60259[_0x36f7b5]);});});this['channel'][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0xe6'),_0x1a4244),_0x1047f9[_0x26ae('0x9f')]);return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')]('variable\x20%s\x20set',_0x1a4244));};AGIVertices[_0x26ae('0x13')][_0x26ae('0xe7')]=function(_0x2322ea){logger[_0x26ae('0xe8')](util['format'](_0x26ae('0xe9'),_0x2322ea[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x2322ea[_0x26ae('0xea')])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x2322ea,_0x26ae('0xeb'));}var _0x3a52cd=this[_0x26ae('0xec')]['sync'](this,_0x2322ea[_0x26ae('0xea')]);if(!_0x3a52cd){return this['channel'][_0x26ae('0x2d')](_0x2322ea,_0x26ae('0xed'));}var _0x3f953f=this[_0x26ae('0x10')]['exec'](_0x26ae('0xee'),[util[_0x26ae('0x2b')](_0x26ae('0xef'),_0x3a52cd),_0x2322ea[_0x26ae('0x69')],_0x2322ea[_0x26ae('0xf0')],_0x2322ea[_0x26ae('0x66')]]);if(_0x3f953f['result']===-0x1){return _0x3f953f;}return this[_0x26ae('0x10')]['noop'](util[_0x26ae('0x2b')](_0x26ae('0xf1'),_0x26ae('0xee')));};AGIVertices[_0x26ae('0x13')][_0x26ae('0xf2')]=function(_0x111bf5){logger['info'](util[_0x26ae('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x111bf5[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x111bf5[_0x26ae('0x83')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xf3'));}if(!this[_0x26ae('0x87')](_0x111bf5[_0x26ae('0x5e')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x26ae('0x10')][_0x26ae('0xf4')]=!![];this[_0x26ae('0x37')](_0x111bf5);this[_0x26ae('0x43')](_0x111bf5[_0x26ae('0x5e')],'in','','');this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0xf5'),_0x111bf5[_0x26ae('0x5e')]));var _0x25cb38=this[_0x26ae('0x7c')]['sync'](this,_0x111bf5);if(_0x25cb38){for(var _0x34ef3f in _0x25cb38){if(_0x25cb38[_0x26ae('0x9a')](_0x34ef3f)){this[_0x26ae('0x10')]['setVariable'](util[_0x26ae('0x2b')]('DIALOGFLOW_%s',_0x34ef3f[_0x26ae('0x6d')]()),_0x25cb38[_0x34ef3f]);}}this[_0x26ae('0x43')](_0x25cb38[_0x26ae('0xf6')],_0x26ae('0xf7'),_0x26ae('0xf2'),'');return this[_0x26ae('0x10')][_0x26ae('0xae')](util['format'](_0x26ae('0xf8'),_0x25cb38[_0x26ae('0xf6')]));}return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x111bf5,_0x26ae('0xf9'));};AGIVertices['prototype'][_0x26ae('0xfa')]=function(_0x3fd9ea){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0xfb'),_0x3fd9ea[_0x26ae('0xad')]));if(!this['isConfigured'](_0x3fd9ea['dialogflowV2_project_id'])){return this[_0x26ae('0x10')][_0x26ae('0xae')]('no\x20project_id\x20configured');}if(!this[_0x26ae('0x87')](_0x3fd9ea[_0x26ae('0x80')])){return this['channel'][_0x26ae('0xae')]('no\x20client_email\x20configured');}if(!this[_0x26ae('0x87')](_0x3fd9ea[_0x26ae('0xfc')])){return this['channel'][_0x26ae('0xae')](_0x26ae('0xfd'));}if(!this[_0x26ae('0x87')](_0x3fd9ea[_0x26ae('0xfe')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xff'));}if(!this[_0x26ae('0x87')](_0x3fd9ea[_0x26ae('0x5e')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xcc'));}this[_0x26ae('0x10')][_0x26ae('0xf4')]=!![];this[_0x26ae('0x37')](_0x3fd9ea);this[_0x26ae('0x43')](_0x3fd9ea[_0x26ae('0x5e')],'in','','');this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')]('Trying\x20DialogflowV2:\x20%s',_0x3fd9ea[_0x26ae('0x5e')]));var _0x2e69e7=this['googleDialogflowV2'][_0x26ae('0x73')](this,_0x3fd9ea);if(_0x2e69e7){for(var _0x3d5660 in _0x2e69e7){if(_0x2e69e7[_0x26ae('0x9a')](_0x3d5660)){if(_0x3d5660!==_0x26ae('0x100')){this[_0x26ae('0x10')]['setVariable'](util[_0x26ae('0x2b')](_0x26ae('0x101'),_0x3d5660[_0x26ae('0x6d')]()),_0x2e69e7[_0x3d5660]);}}}this[_0x26ae('0x43')](_0x2e69e7[_0x26ae('0xf6')],_0x26ae('0xf7'),_0x26ae('0xfa'),_0x2e69e7['providerResponse']);return this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x102'),_0x2e69e7['speech']));}return this[_0x26ae('0x10')]['error'](_0x3fd9ea,_0x26ae('0x103'));};AGIVertices[_0x26ae('0x13')]['sesteknda']=function(_0x5b256c){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x5b256c['label']));if(!this['isConfigured'](_0x5b256c[_0x26ae('0x104')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x105'));}if(!this['isConfigured'](_0x5b256c[_0x26ae('0x106')])){return this[_0x26ae('0x10')][_0x26ae('0xae')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x5b256c[_0x26ae('0x107')])){return this[_0x26ae('0x10')]['noop'](_0x26ae('0x108'));}if(!this[_0x26ae('0x87')](_0x5b256c[_0x26ae('0x109')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xcc'));}this[_0x26ae('0x10')][_0x26ae('0xf4')]=!![];this[_0x26ae('0x37')](_0x5b256c);this[_0x26ae('0x43')](_0x5b256c[_0x26ae('0x5e')],'in','','');this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x10a'),_0x5b256c[_0x26ae('0x5e')]));var _0x511af7=this[_0x26ae('0x81')][_0x26ae('0x73')](this,_0x5b256c);if(_0x511af7){for(var _0x1718d0 in _0x511af7){if(_0x511af7[_0x26ae('0x9a')](_0x1718d0)){this[_0x26ae('0x10')][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0x10b'),_0x1718d0['toUpperCase']()),_0x511af7[_0x1718d0]);}}this['createSquareMessage'](_0x511af7[_0x26ae('0xf6')],_0x26ae('0xf7'),_0x26ae('0x10c'),'');if(_0x511af7[_0x26ae('0x10d')]){this[_0x26ae('0x10')][_0x26ae('0xae')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x511af7['audiofile']));var _0x558173=this[_0x26ae('0x10')]['streamFile'](_0x511af7[_0x26ae('0x10d')]);try{fs[_0x26ae('0x10e')](_0x511af7[_0x26ae('0x10d')]+_0x26ae('0x10f'));}catch(_0x6219bc){logger[_0x26ae('0x2d')](_0x6219bc);}return _0x558173;}else{return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x110'),_0x511af7['speech']));}}return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x5b256c,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x26ae('0x13')]['end']=function(_0x209656){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x111'),_0x209656[_0x26ae('0xad')]));return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x112'));};AGIVertices[_0x26ae('0x13')][_0x26ae('0x113')]=function(_0x29e1fb){logger[_0x26ae('0x2f')](util['format'](_0x26ae('0x114'),_0x29e1fb[_0x26ae('0xad')]));var _0x52b970='';if(_0x29e1fb[_0x26ae('0x115')]){if(!this[_0x26ae('0x87')](_0x29e1fb['trunk_id'])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x29e1fb,'no\x20trunk\x20selected');}else{var _0x860557=parseInt(_0x29e1fb['trunk_id'],0xa);if(isNaN(_0x860557)){_0x52b970=_0x29e1fb[_0x26ae('0x115')];}else{_0x52b970=this[_0x26ae('0x1e')][_0x26ae('0x73')](this,_0x29e1fb[_0x26ae('0x115')]);if(!_0x52b970){return this[_0x26ae('0x10')]['error'](_0x29e1fb,'no\x20trunk\x20found');}}}}else if(_0x29e1fb['trunk_name']){_0x52b970=_0x29e1fb[_0x26ae('0x116')];}else{return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x29e1fb,_0x26ae('0x117'));}var _0xf3672=this[_0x26ae('0x10')][_0x26ae('0xb3')](_0x26ae('0xee'),[util[_0x26ae('0x2b')](_0x26ae('0x118'),_0x52b970,_0x29e1fb[_0x26ae('0x49')]),_0x29e1fb[_0x26ae('0x69')],_0x29e1fb[_0x26ae('0xf0')],_0x29e1fb[_0x26ae('0x66')]]);if(_0xf3672['result']===-0x1){return _0xf3672;}return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')]('Executed\x20command\x20%s',_0x26ae('0xee')));};AGIVertices['prototype'][_0x26ae('0x119')]=function(_0xb656b0){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x11a'),_0xb656b0[_0x26ae('0xad')]));return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x119'));};AGIVertices[_0x26ae('0x13')][_0x26ae('0xe')]=function(_0xfa43bf){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x11b'),_0xfa43bf[_0x26ae('0xad')]));if(_0xfa43bf[_0x26ae('0xac')]===0x0){return this[_0x26ae('0xab')](_0xfa43bf);}_0xfa43bf[_0x26ae('0xac')]-=0x1;if(!this[_0x26ae('0x87')](_0xfa43bf['file_id'])){return this['channel'][_0x26ae('0x2d')](_0xfa43bf,_0x26ae('0x11c'));}var _0x2910ff=this[_0x26ae('0x11d')][_0x26ae('0x73')](this,_0xfa43bf[_0x26ae('0x11e')]);if(!_0x2910ff){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0xfa43bf,_0x26ae('0x11f'));}if(!this[_0x26ae('0x87')](_0xfa43bf[_0x26ae('0xe0')])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x26ae('0xe1'));}var _0x18241f=this[_0x26ae('0x10')]['getData'](_0x2910ff,_0xfa43bf[_0x26ae('0x120')],_0xfa43bf['maxdigit']);var _0x26222d=_0x18241f['result']?_0x18241f[_0x26ae('0xa9')][_0x26ae('0x4e')]():'';logger[_0x26ae('0x2f')](_0x26ae('0x121'),JSON[_0x26ae('0x77')](_0x18241f));if(_0x18241f[_0x26ae('0xa9')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0xfa43bf,_0x26222d);return _0x18241f;}else if(_0x18241f[_0x26ae('0xa8')]===_0x26ae('0x69')){_0x18241f[_0x26ae('0xa9')]=_0x26222d['length']>=parseInt(_0xfa43bf['mindigit'])?'x':'i';}else{_0x18241f[_0x26ae('0xa9')]=_0x26222d[_0x26ae('0x9f')]>=parseInt(_0xfa43bf[_0x26ae('0x122')])&&_0x26222d[_0x26ae('0x9f')]<=parseInt(_0xfa43bf[_0x26ae('0x123')])?'x':'i';}var _0x5ac968=this[_0x26ae('0xa7')]['sync'](this,_0xfa43bf['variable_id']);if(!_0x5ac968){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0xfa43bf,'no\x20variable\x20found');}this['channel'][_0x26ae('0xa5')](_0x5ac968,_0x26222d);if(this[_0x26ae('0x87')](_0xfa43bf['hiddendigitsnum'])){var _0x1789cd=parseInt(_0xfa43bf[_0x26ae('0x124')],0xa);var _0x576a73=rs['generate']({'charset':'*','length':_0x1789cd});var _0x2b9098=_0x26222d[_0x26ae('0x9f')];if(_0x2b9098>0x0){if(_0x2b9098>_0x1789cd){this[_0x26ae('0x37')]['sync'](this,_0xfa43bf,_0xfa43bf['hiddendigitspos']==='first'?_0x576a73+_0x26222d[_0x26ae('0x125')](_0x1789cd):_0x26222d['substr'](0x0,_0x2b9098-_0x1789cd)+_0x576a73);}else{this[_0x26ae('0x37')][_0x26ae('0x73')](this,_0xfa43bf,rs[_0x26ae('0x126')]({'charset':'*','length':_0x2b9098}));}}else{this[_0x26ae('0x37')][_0x26ae('0x73')](this,_0xfa43bf,'');}}else{this['createSquareDetailsReport'][_0x26ae('0x73')](this,_0xfa43bf,_0x26222d);}return _0x18241f;};AGIVertices[_0x26ae('0x13')][_0x26ae('0xf')]=function(_0x173f52){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x127'),_0x173f52[_0x26ae('0xad')]));return this[_0x26ae('0xe')](_0x173f52);};AGIVertices[_0x26ae('0x13')]['goal']=function(_0x5c6421){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x128'),_0x5c6421['label']));this[_0x26ae('0x37')][_0x26ae('0x73')](this,_0x5c6421,_0x5c6421[_0x26ae('0x129')]);return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')]('GOAL\x20%s',_0x5c6421[_0x26ae('0x129')]));};AGIVertices['prototype'][_0x26ae('0x12a')]=function(_0x692c01){logger['info'](util['format'](_0x26ae('0x12b'),_0x692c01[_0x26ae('0xad')]));if(!this['isConfigured'](_0x692c01[_0x26ae('0x8a')])||!this['isConfigured'](_0x692c01[_0x26ae('0x8b')])){return this['channel'][_0x26ae('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x26ae('0x87')](_0x692c01[_0x26ae('0x5e')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xcc'));}this[_0x26ae('0x10')][_0x26ae('0xae')](util['format'](_0x26ae('0x12c'),_0x692c01[_0x26ae('0x5e')]));var _0x5a6eb6=this['awsPolly'][_0x26ae('0x73')](this,_0x692c01);if(_0x5a6eb6){this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x12d'),_0x5a6eb6));var _0x5e36a0=this[_0x26ae('0x10')]['streamFile'](_0x5a6eb6);try{fs[_0x26ae('0x10e')](_0x5a6eb6+'.wav');}catch(_0x2fa90f){logger['error'](_0x2fa90f);}return _0x5e36a0;}return this['channel'][_0x26ae('0x2d')](_0x692c01,_0x26ae('0x12e'));};AGIVertices['prototype']['awslex']=function(_0x520e13){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x12f'),_0x520e13[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x520e13[_0x26ae('0x8a')])||!this['isConfigured'](_0x520e13[_0x26ae('0x8b')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x130'));}if(!this[_0x26ae('0x87')](_0x520e13[_0x26ae('0x91')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x131'));}if(!this[_0x26ae('0x87')](_0x520e13[_0x26ae('0x5e')])){return this[_0x26ae('0x10')][_0x26ae('0xae')]('no\x20text\x20configured');}this[_0x26ae('0x10')]['bot']=!![];this[_0x26ae('0x37')](_0x520e13);this[_0x26ae('0x43')](_0x520e13['text'],'in','','');this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x132'),_0x520e13[_0x26ae('0x5e')]));var _0x255161=this['awsLex'][_0x26ae('0x73')](this,_0x520e13);if(_0x255161){for(var _0x4bfd4d in _0x255161){if(_0x255161[_0x26ae('0x9a')](_0x4bfd4d)&&_[_0x26ae('0x9b')](_0x255161[_0x4bfd4d])){this[_0x26ae('0x10')][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0x133'),_0x4bfd4d[_0x26ae('0x6d')]()),_0x255161[_0x4bfd4d]);}}if(_[_0x26ae('0x45')](_0x255161['message'])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x134'));}else{this[_0x26ae('0x43')](_0x255161[_0x26ae('0x7a')],_0x26ae('0xf7'),'amazonlex','');return this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x135'),_0x255161[_0x26ae('0x7a')]));}}return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x520e13,_0x26ae('0x136'));};AGIVertices[_0x26ae('0x13')][_0x26ae('0x137')]=function(_0x5d391f){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5d391f['label'],_0x5d391f[_0x26ae('0x69')]));if(!this['isConfigured'](_0x5d391f[_0x26ae('0x83')])){return this['channel'][_0x26ae('0xae')](_0x26ae('0xf3'));}var _0x36fa68='wav';var _0x5d5a17=util[_0x26ae('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x26ae('0x126')](0x4));var _0x596c36=util['format'](_0x26ae('0xa4'),_0x5d5a17,_0x36fa68);var _0x1f6d87=!![];if(_0x5d391f[_0x26ae('0x138')]===_0x26ae('0x139')){_0x1f6d87=![];}var _0x3034d3=this[_0x26ae('0x10')][_0x26ae('0x13a')](_0x5d5a17,_0x36fa68,_0x5d391f[_0x26ae('0x13b')],_0x5d391f[_0x26ae('0x69')],undefined,_0x1f6d87);if(_0x3034d3[_0x26ae('0xa9')]!==-0x1){this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x13c'),_0x596c36));var _0x390a0f=this['googleASR'][_0x26ae('0x73')](this,_0x5d391f,_0x596c36);if(_0x390a0f){for(var _0x5dfd13 in _0x390a0f){if(_0x390a0f['hasOwnProperty'](_0x5dfd13)){this['channel'][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0x13d'),_0x5dfd13[_0x26ae('0x6d')]()),_0x390a0f[_0x5dfd13]);}}return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x13e'),JSON[_0x26ae('0x77')](_0x390a0f)));}}return _0x3034d3;};AGIVertices[_0x26ae('0x13')][_0x26ae('0x13f')]=function(_0x2223b7){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x140'),_0x2223b7[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x2223b7[_0x26ae('0x95')])){return this[_0x26ae('0x10')]['noop']('no\x20appid\x20configured');}if(!this[_0x26ae('0x87')](_0x2223b7[_0x26ae('0x96')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x141'));}var _0x3b3a62=_0x26ae('0x142');var _0x4d844f=util[_0x26ae('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x26ae('0x126')](0x4));var _0x11463a=util[_0x26ae('0x2b')]('%s.%s',_0x4d844f,_0x3b3a62);var _0x1096d4=!![];if(_0x2223b7[_0x26ae('0x138')]===_0x26ae('0x139')){_0x1096d4=![];}var _0x161e98=this[_0x26ae('0x10')][_0x26ae('0x13a')](_0x4d844f,_0x3b3a62,_0x2223b7[_0x26ae('0x13b')],_0x2223b7[_0x26ae('0x69')],undefined,_0x1096d4);if(_0x161e98[_0x26ae('0xa9')]!==-0x1){this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')]('tilde\x20%s\x20file\x20created',_0x11463a));var _0x3174c1=this['tildeASR'][_0x26ae('0x73')](this,_0x2223b7,_0x11463a);if(_0x3174c1){for(var _0x489066 in _0x3174c1){if(_0x3174c1[_0x26ae('0x9a')](_0x489066)){this[_0x26ae('0x10')][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0x143'),_0x489066[_0x26ae('0x6d')]()),_0x3174c1[_0x489066]);}}return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x144'),JSON['stringify'](_0x3174c1)));}}return _0x161e98;};AGIVertices[_0x26ae('0x13')][_0x26ae('0x145')]=function(_0x39a356){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x39a356[_0x26ae('0xad')]));return this[_0x26ae('0x10')][_0x26ae('0x146')](_0x39a356[_0x26ae('0x3d')],_0x39a356[_0x26ae('0x3e')],_0x39a356[_0x26ae('0x3f')]);};AGIVertices[_0x26ae('0x13')][_0x26ae('0x147')]=function(_0x46909e){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x148'),_0x46909e['label']));if(!this['isConfigured'](_0x46909e[_0x26ae('0x149')])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x46909e,_0x26ae('0x14a'));}try{var _0x6f0f4=eval(_0x46909e[_0x26ae('0x149')])?_0x26ae('0x14b'):_0x26ae('0x14c');this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x14d'),_0x46909e[_0x26ae('0x149')],_0x6f0f4));return{'code':0xc8,'result':_0x6f0f4};}catch(_0x274279){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x26ae('0x13')][_0x26ae('0x14e')]=function(_0x4d572c){logger['info'](util['format'](_0x26ae('0x14f'),_0x4d572c[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x4d572c[_0x26ae('0x150')])){return this[_0x26ae('0x10')]['error'](_0x4d572c,'no\x20interval\x20configured');}var _0x4be8b9=this[_0x26ae('0x151')][_0x26ae('0x73')](this,_0x4d572c[_0x26ae('0x150')]);if(!_0x4be8b9){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x4d572c,_0x26ae('0x152'));}for(var _0x564ffe=0x0;_0x564ffe<_0x4be8b9[_0x26ae('0x9f')];_0x564ffe+=0x1){var _0x53e327=this[_0x26ae('0x10')][_0x26ae('0xa7')](util[_0x26ae('0x2b')](_0x26ae('0x153'),_0x4be8b9[_0x564ffe]));if(_0x53e327[_0x26ae('0xa9')]===-0x1){return _0x53e327;}logger['info'](util[_0x26ae('0x2b')](_0x26ae('0x154'),_0x4be8b9[_0x564ffe],_0x53e327[_0x26ae('0xa8')]));if(_0x53e327[_0x26ae('0xa8')]===_0x26ae('0x14b')){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x154'),_0x4be8b9[_0x564ffe],'true'));this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x154'),_0x4be8b9[_0x564ffe],_0x26ae('0x14b')));return{'code':0xc8,'result':_0x26ae('0x14b')};}else{logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x154'),_0x4be8b9[_0x564ffe],'false'));this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x154'),_0x4be8b9[_0x564ffe],_0x26ae('0x14c')));}}return{'code':0xc8,'result':_0x26ae('0x14c')};};AGIVertices['prototype'][_0x26ae('0x155')]=function(_0x2a5991){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2a5991[_0x26ae('0xad')]));return this[_0x26ae('0x10')][_0x26ae('0x155')]();};AGIVertices[_0x26ae('0x13')][_0x26ae('0x156')]=function(_0x360a48){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x157'),_0x360a48['label']));if(!this[_0x26ae('0x87')](_0x360a48['key'])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xf3'));}var _0x23b55a=_0x26ae('0x142');var _0x2efcc4=util['format'](_0x26ae('0x158'),FILES_PATH,rs[_0x26ae('0x126')](0x4));var _0x2f72ff=util['format']('%s.%s',_0x2efcc4,_0x23b55a);var _0x12fcbb=!![];if(_0x360a48['beep']===_0x26ae('0x139')){_0x12fcbb=![];}var _0xf539e6=this[_0x26ae('0x10')][_0x26ae('0x13a')](_0x2efcc4,_0x23b55a,_0x360a48[_0x26ae('0x13b')],_0x360a48[_0x26ae('0x69')],undefined,_0x12fcbb);if(_0xf539e6[_0x26ae('0xa9')]!==-0x1){this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x159'),_0x2f72ff));var _0x4eed96=this[_0x26ae('0x85')]['sync'](this,_0x360a48,_0x2f72ff);if(_0x4eed96){for(var _0x4c07d4 in _0x4eed96){if(_0x4eed96['hasOwnProperty'](_0x4c07d4)){this[_0x26ae('0x10')][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0x15a'),_0x4c07d4[_0x26ae('0x6d')]()),_0x4eed96[_0x4c07d4]);}}return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')]('IspeechASR\x20Result\x20%s',JSON[_0x26ae('0x77')](_0x4eed96)));}}return _0xf539e6;};AGIVertices[_0x26ae('0x13')][_0x26ae('0x15b')]=function(_0x20e485){logger['info'](util[_0x26ae('0x2b')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x20e485[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x20e485['key'])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xf3'));}if(!this[_0x26ae('0x87')](_0x20e485['text'])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xcc'));}this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x20e485[_0x26ae('0x5e')]));var _0x3500fc=this[_0x26ae('0x82')][_0x26ae('0x73')](this,_0x20e485);if(_0x3500fc){this[_0x26ae('0x10')]['noop'](util[_0x26ae('0x2b')](_0x26ae('0x159'),_0x3500fc));var _0x3eeaca=this[_0x26ae('0x10')][_0x26ae('0x15c')](_0x3500fc,_0x20e485[_0x26ae('0x13b')]);try{fs[_0x26ae('0x10e')](_0x3500fc+_0x26ae('0x10f'));}catch(_0xfac369){logger[_0x26ae('0x2d')](_0xfac369);}return _0x3eeaca;}return this['channel'][_0x26ae('0x2d')](_0x20e485,_0x26ae('0x15d'));};AGIVertices[_0x26ae('0x13')][_0x26ae('0x15e')]=function(_0x287f30){logger[_0x26ae('0x2f')](util['format'](_0x26ae('0x15f'),_0x287f30[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x287f30[_0x26ae('0x160')])){return this['channel'][_0x26ae('0x2d')](_0x287f30,_0x26ae('0x161'));}logger['info'](util['format'](_0x26ae('0x162'),this[_0x26ae('0x10')]['callerid'],_0x287f30[_0x26ae('0x160')]));var _0x26a106=this[_0x26ae('0x56')][_0x26ae('0x73')](this,_0x287f30['findBy']);if(_0x26a106){logger['info'](util[_0x26ae('0x2b')](_0x26ae('0x163'),this[_0x26ae('0x10')][_0x26ae('0x39')],_0x287f30['findBy']));this[_0x26ae('0x10')]['noop'](util[_0x26ae('0x2b')](_0x26ae('0x163'),this['channel']['callerid'],_0x287f30['findBy']));return{'code':0xc8,'result':_0x26ae('0x164')};}else{logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x165'),this[_0x26ae('0x10')][_0x26ae('0x39')],_0x287f30[_0x26ae('0x160')]));this[_0x26ae('0x10')]['noop'](util[_0x26ae('0x2b')](_0x26ae('0x165'),this[_0x26ae('0x10')]['callerid'],_0x287f30[_0x26ae('0x160')]));return{'code':0xc8,'result':_0x26ae('0x166')};}};AGIVertices[_0x26ae('0x13')][_0x26ae('0x167')]=function(_0x57d4c2){logger[_0x26ae('0x2f')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x57d4c2[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x57d4c2[_0x26ae('0x160')])){return this['channel'][_0x26ae('0x2d')](_0x57d4c2,_0x26ae('0x161'));}logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x162'),this[_0x26ae('0x10')][_0x26ae('0x39')],_0x57d4c2[_0x26ae('0x160')]));var _0x47f65a=this[_0x26ae('0x55')][_0x26ae('0x73')](this,_0x57d4c2[_0x26ae('0x160')]);if(_0x47f65a){logger[_0x26ae('0x2f')](util['format'](_0x26ae('0x163'),this['channel'][_0x26ae('0x39')],_0x57d4c2['findBy']));this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x163'),this[_0x26ae('0x10')][_0x26ae('0x39')],_0x57d4c2['findBy']));return{'code':0xc8,'result':_0x26ae('0x164')};}else{logger['info'](util['format'](_0x26ae('0x165'),this[_0x26ae('0x10')]['callerid'],_0x57d4c2[_0x26ae('0x160')]));this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x26ae('0x10')][_0x26ae('0x39')],_0x57d4c2[_0x26ae('0x160')]));return{'code':0xc8,'result':_0x26ae('0x166')};}};AGIVertices['prototype'][_0x26ae('0x168')]=function(_0x578f74){logger[_0x26ae('0x2f')](util['format'](_0x26ae('0x169'),_0x578f74[_0x26ae('0xad')]));if(!this['isConfigured'](_0x578f74[_0x26ae('0x16a')])){return this['channel'][_0x26ae('0x2d')](_0x578f74,_0x26ae('0x16b'));}this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')]('math\x20%s',_0x578f74['operation']));var _0x376b0c=eval(_0x578f74[_0x26ae('0x16a')]);if(!this[_0x26ae('0x87')](_0x578f74[_0x26ae('0xe0')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xe1'));}var _0x4e4de7=this[_0x26ae('0xa7')]['sync'](this,_0x578f74['variable_id']);if(!_0x4e4de7){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x578f74,_0x26ae('0xe2'));}if(_['isArray'](_0x376b0c)){var _0x553595=this;_0x376b0c['forEach'](function(_0x436721,_0x121df6){_0x553595['channel'][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0x16c'),_0x4e4de7,_0x121df6),_0x436721);});return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x16d'),_0x4e4de7));}else{return this[_0x26ae('0x10')]['setVariable'](_0x4e4de7,_0x376b0c);}};AGIVertices[_0x26ae('0x13')]['menu']=function(_0x1352c8){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x16e'),_0x1352c8[_0x26ae('0xad')]));if(_0x1352c8['retry']===0x0){return this[_0x26ae('0xab')](_0x1352c8);}_0x1352c8['retry']-=0x1;if(!this['isConfigured'](_0x1352c8[_0x26ae('0x11e')])){return this['channel']['error'](_0x1352c8,_0x26ae('0x11c'));}var _0x13c466=this[_0x26ae('0x11d')][_0x26ae('0x73')](this,_0x1352c8[_0x26ae('0x11e')]);if(!_0x13c466){return this['channel'][_0x26ae('0x2d')](_0x1352c8,_0x26ae('0x11f'));}var _0x3d6941=this[_0x26ae('0x10')][_0x26ae('0x16f')](_0x13c466,_0x1352c8[_0x26ae('0x120')],_0x1352c8[_0x26ae('0x170')]);var _0x463ecc=_0x3d6941['result'];if(_0x3d6941['result']===-0x1){this[_0x26ae('0x37')][_0x26ae('0x73')](this,_0x1352c8,'-1');return _0x3d6941;}else if(_0x3d6941['extra']==='timeout'){_0x3d6941[_0x26ae('0xa9')]=_0x3d6941[_0x26ae('0xa9')]['length']>0x0?_0x3d6941['result']:'t';}else if(_['isEmpty'](_0x3d6941[_0x26ae('0xa9')])){_0x3d6941[_0x26ae('0xa9')]='#';_0x463ecc='#';}if(!this[_0x26ae('0x87')](_0x1352c8[_0x26ae('0xe0')])){this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0xe1'));}else{var _0x4c2f97=this[_0x26ae('0xa7')][_0x26ae('0x73')](this,_0x1352c8[_0x26ae('0xe0')]);if(!_0x4c2f97){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x1352c8,_0x26ae('0xe2'));}this[_0x26ae('0x10')][_0x26ae('0xa5')](_0x4c2f97,_0x463ecc);}this[_0x26ae('0x37')][_0x26ae('0x73')](this,_0x1352c8,_0x463ecc);return _0x3d6941;};AGIVertices[_0x26ae('0x13')][_0x26ae('0xae')]=function(_0x568ee9){logger['info'](util[_0x26ae('0x2b')](_0x26ae('0x171'),_0x568ee9[_0x26ae('0xad')]));return this['channel']['noop'](_0x568ee9[_0x26ae('0x172')]||_0x568ee9[_0x26ae('0xad')]);};AGIVertices[_0x26ae('0x13')][_0x26ae('0x173')]=function(_0x54f2db){logger['info'](util[_0x26ae('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x54f2db['label']));if(!this['isConfigured'](_0x54f2db[_0x26ae('0x160')])){return this['channel'][_0x26ae('0x2d')](_0x54f2db,_0x26ae('0x161'));}logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x162'),this[_0x26ae('0x10')]['callerid'],_0x54f2db[_0x26ae('0x160')]));var _0x46e6b4=this['getPause']['sync'](this,_0x54f2db[_0x26ae('0x174')]);var _0xeb4bc5=this['agentPause'][_0x26ae('0x73')](this,_0x54f2db[_0x26ae('0x160')],_0x46e6b4);if(_0xeb4bc5){logger['info'](util[_0x26ae('0x2b')](_0x26ae('0x163'),this[_0x26ae('0x10')]['callerid'],_0x54f2db[_0x26ae('0x160')]));this[_0x26ae('0x10')][_0x26ae('0xae')](util['format'](_0x26ae('0x163'),this['channel'][_0x26ae('0x39')],_0x54f2db[_0x26ae('0x160')]));return{'code':0xc8,'result':_0x26ae('0x164')};}else{logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x165'),this[_0x26ae('0x10')][_0x26ae('0x39')],_0x54f2db[_0x26ae('0x160')]));this[_0x26ae('0x10')][_0x26ae('0xae')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x26ae('0x10')][_0x26ae('0x39')],_0x54f2db[_0x26ae('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x26ae('0x13')][_0x26ae('0x175')]=function(_0x170ad4){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x176'),_0x170ad4[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x170ad4[_0x26ae('0x11e')])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x170ad4,'no\x20file\x20audio\x20selected');}var _0x3aa388=this[_0x26ae('0x11d')][_0x26ae('0x73')](this,_0x170ad4[_0x26ae('0x11e')]);if(!_0x3aa388){return this[_0x26ae('0x10')]['error'](_0x170ad4,_0x26ae('0x11f'));}var _0x4a95f4=this[_0x26ae('0x10')][_0x26ae('0xb3')](_0x26ae('0x177'),[_0x3aa388,_0x170ad4[_0x26ae('0xf0')]]);if(_0x4a95f4[_0x26ae('0xa9')]===-0x1){return _0x4a95f4;}return this['channel']['noop'](util[_0x26ae('0x2b')](_0x26ae('0xc9'),'PLAYBACK',_0x3aa388));};AGIVertices[_0x26ae('0x13')][_0x26ae('0x178')]=function(_0x518f56){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x179'),_0x518f56[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x518f56['queue_id'])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x518f56,'no\x20queue\x20selected');}var _0x296871='';var _0x1a8c9d=parseInt(_0x518f56['queue_id'],0xa);if(isNaN(_0x1a8c9d)){_0x296871=_0x518f56[_0x26ae('0x17a')];}else{_0x296871=this[_0x26ae('0x16')]['sync'](this,_0x518f56[_0x26ae('0x17a')]);if(!_0x296871){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x518f56,_0x26ae('0x17b'));}}var _0x374658='';if(this[_0x26ae('0x87')](_0x518f56[_0x26ae('0x11e')])){var _0x8c467f=this[_0x26ae('0x11d')]['sync'](this,_0x518f56[_0x26ae('0x11e')]);if(_0x8c467f){_0x374658=_0x8c467f;}}this[_0x26ae('0x37')][_0x26ae('0x73')](this,_0x518f56,_0x296871);if(_0x518f56['opts'][_0x26ae('0x17c')]('x')<0x0){_0x518f56[_0x26ae('0xf0')]+='x';}if(_0x518f56[_0x26ae('0xf0')][_0x26ae('0x17c')]('X')<0x0){_0x518f56['opts']+='X';}this[_0x26ae('0x10')][_0x26ae('0xa5')](_0x26ae('0x17d'),_0x296871?_0x296871[_0x26ae('0x17e')]():'');var _0x22c04b=this[_0x26ae('0x10')]['exec'](_0x26ae('0x17f'),[_0x296871,_0x518f56[_0x26ae('0xf0')],_0x518f56[_0x26ae('0x66')],_0x374658,_0x518f56['timeout'],_0x518f56['agi'],_0x518f56[_0x26ae('0x180')],_0x518f56[_0x26ae('0x181')],'',_0x518f56[_0x26ae('0x182')]]);if(_0x22c04b[_0x26ae('0xa9')]===-0x1){return _0x22c04b;}return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')]('Executed\x20command\x20%s\x20%s',_0x26ae('0x17f'),_0x296871));};AGIVertices['prototype'][_0x26ae('0x183')]=function(_0xfc6b36){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x184'),_0xfc6b36[_0x26ae('0xad')]));var _0x171e3c=_0xfc6b36[_0x26ae('0x185')]||_0x26ae('0x142');var _0x131280=util[_0x26ae('0x2b')](_0x26ae('0x186'),this[_0x26ae('0x10')][_0x26ae('0x3b')],rs[_0x26ae('0x126')](0x5));var _0x35a970=util[_0x26ae('0x2b')](_0x26ae('0x187'),FILES_PATH,_0x131280,_0x171e3c);var _0x27e239=util[_0x26ae('0x2b')](_0x26ae('0x158'),FILES_PATH,_0x131280);this[_0x26ae('0x3a')][_0x26ae('0x73')](this,_0xfc6b36,_0x131280,_0x35a970);this['channel']['setVariable'](_0x26ae('0x188'),_0x131280);logger[_0x26ae('0x2f')](_0x26ae('0x189'),_0x27e239,_0x171e3c,_0xfc6b36[_0x26ae('0x18a')],_0xfc6b36['timeout']);return this['channel'][_0x26ae('0x13a')](_0x27e239,_0x171e3c,_0xfc6b36[_0x26ae('0x18a')],_0xfc6b36[_0x26ae('0x69')],undefined,!![]);};AGIVertices[_0x26ae('0x13')]['restapi']=function(_0x402c7a){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x18b'),_0x402c7a['label']));if(!this[_0x26ae('0x87')](_0x402c7a[_0x26ae('0x66')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x18c'));}var _0x29ead1=this['restAPI']['sync'](this,_0x402c7a);logger['info'](util['format'](_0x26ae('0x18d'),util[_0x26ae('0x18e')](_0x29ead1,{'showHidden':![],'depth':null})));if(!this[_0x26ae('0x87')](_0x402c7a[_0x26ae('0xe0')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x18f'));}var _0x591985=this[_0x26ae('0xa7')][_0x26ae('0x73')](this,_0x402c7a[_0x26ae('0xe0')]);if(!_0x591985){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x402c7a,_0x26ae('0xe2'));}this[_0x26ae('0x10')][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0x190'),_0x591985),_0x29ead1[_0x26ae('0x79')]?_0x29ead1[_0x26ae('0x79')]:_0x26ae('0x191'));this['channel'][_0x26ae('0xa5')](util[_0x26ae('0x2b')](_0x26ae('0x192'),_0x591985),_0x29ead1[_0x26ae('0x193')]?_0x29ead1[_0x26ae('0x193')]:'OK');if(_0x29ead1[_0x26ae('0x6e')]){try{this[_0x26ae('0xa1')](_0x29ead1['body'],_0x591985);}catch(_0x18af58){logger[_0x26ae('0x2d')](util[_0x26ae('0x2b')](_0x26ae('0x194'),_0x591985));}}return this[_0x26ae('0x10')]['noop'](util[_0x26ae('0x2b')](_0x26ae('0x195'),_0x591985));};AGIVertices[_0x26ae('0x13')]['saydigits']=function(_0x5d9961){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5d9961['label']));return this[_0x26ae('0x10')][_0x26ae('0x196')](_0x5d9961[_0x26ae('0x197')]['replace'](/\s+/g,''),_0x5d9961[_0x26ae('0x18a')]);};AGIVertices[_0x26ae('0x13')]['saynumber']=function(_0x11c2e2){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x11c2e2[_0x26ae('0xad')]));return this[_0x26ae('0x10')]['sayNumber'](_0x11c2e2['number'][_0x26ae('0xde')](/\s+/g,''),_0x11c2e2[_0x26ae('0x18a')]);};AGIVertices[_0x26ae('0x13')][_0x26ae('0x198')]=function(_0x307082){logger['info'](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x307082[_0x26ae('0xad')]));return this[_0x26ae('0x10')][_0x26ae('0x199')](_0x307082['text'],_0x307082[_0x26ae('0x18a')]);};AGIVertices[_0x26ae('0x13')][_0x26ae('0x19a')]=function(_0x127df2){logger[_0x26ae('0x2f')](util['format'](_0x26ae('0x19b'),_0x127df2[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x127df2['account_id'])){return this['channel'][_0x26ae('0xae')](_0x26ae('0x19c'));}var _0x25aaec=this['getMailAccount'][_0x26ae('0x73')](this,_0x127df2[_0x26ae('0x19d')]);if(!_0x25aaec||!_0x25aaec['Smtp']){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x127df2,_0x26ae('0x19e'));}var _0x2f9c81={'from':util[_0x26ae('0x2b')]('\x22%s\x22\x20<%s>',_0x25aaec['name'],_0x25aaec[_0x26ae('0x19f')]||_0x25aaec[_0x26ae('0x1a0')]['user']),'to':_0x127df2['to']||'','cc':_0x127df2['cc']||'','bcc':_0x127df2[_0x26ae('0x1a1')]||'','subject':_0x127df2['subject'],'html':_0x127df2[_0x26ae('0x5e')],'text':_0x127df2[_0x26ae('0x5e')]};if(this['isConfigured'](_0x127df2[_0x26ae('0x1a2')])){}logger[_0x26ae('0xe8')](_0x26ae('0x1a3'),JSON[_0x26ae('0x77')](_0x2f9c81));this[_0x26ae('0x37')]['sync'](this,_0x127df2,_0x127df2[_0x26ae('0x19d')]);this['channel']['noop'](util[_0x26ae('0x2b')](_0x26ae('0x1a4'),_0x25aaec[_0x26ae('0x14')]));this[_0x26ae('0x25')]['sync'](this,_0x25aaec[_0x26ae('0x1a5')],_0x2f9c81);return this[_0x26ae('0x10')]['noop'](_0x26ae('0x1a6'));};AGIVertices['prototype'][_0x26ae('0x1a7')]=function(_0x296716){logger[_0x26ae('0x2f')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x296716['label']));return this['channel'][_0x26ae('0xae')](_0x26ae('0x1a8'));};AGIVertices['prototype'][_0x26ae('0x1a9')]=function(_0x52ddc4){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x1aa'),_0x52ddc4[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x52ddc4[_0x26ae('0x1ab')])){return this[_0x26ae('0x10')][_0x26ae('0xae')]('no\x20sms\x20account\x20configured');}var _0x5b5e9c=this[_0x26ae('0x34')]['sync'](this,_0x52ddc4[_0x26ae('0x1ab')]);if(!_0x5b5e9c){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x52ddc4,_0x26ae('0x1ac'));}var _0x1bac43={'body':_0x52ddc4['sms_text'],'phone':_0x52ddc4['to']||'','SmsAccountId':_0x5b5e9c['id']};logger[_0x26ae('0xe8')]('sendSMS\x20message',JSON[_0x26ae('0x77')](_0x1bac43));this[_0x26ae('0x37')][_0x26ae('0x73')](this,_0x52ddc4,_0x52ddc4[_0x26ae('0x1ab')]);this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5b5e9c['name']));this['createSmsMessage'][_0x26ae('0x73')](this,_0x1bac43);return this['channel']['noop'](_0x26ae('0x1ad'));};AGIVertices['prototype']['set']=function(_0x9857c9){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x1ae'),_0x9857c9[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x9857c9[_0x26ae('0xe0')])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x9857c9,'no\x20variable\x20selected');}var _0x263d6f=this[_0x26ae('0xa7')][_0x26ae('0x73')](this,_0x9857c9[_0x26ae('0xe0')]);if(!_0x263d6f){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x9857c9,_0x26ae('0xe2'));}return this[_0x26ae('0x10')][_0x26ae('0xa5')](_0x263d6f,_0x9857c9['variable_value']);};AGIVertices['prototype'][_0x26ae('0x1af')]=function(_0x255b58){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20START\x20(%s)\x20block',_0x255b58[_0x26ae('0xad')]));this['channel'][_0x26ae('0xae')]('START\x20CALLY\x20SQUARE');if(_0x255b58['answer']===_0x26ae('0x1b0')){this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x1b1'));return this[_0x26ae('0x10')][_0x26ae('0xc1')]();}return this['channel'][_0x26ae('0xae')](_0x26ae('0x1b2'));};AGIVertices[_0x26ae('0x13')]['subproject']=function(_0x545baf){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x1b3'),_0x545baf[_0x26ae('0xad')]));if(!this[_0x26ae('0x87')](_0x545baf[_0x26ae('0x1b4')])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x545baf,'no\x20subproject\x20selected');}var _0x42ef09=this[_0x26ae('0x19')][_0x26ae('0x73')](this,_0x545baf[_0x26ae('0x1b4')]);if(!this['isConfigured'](_0x42ef09)){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x545baf,util[_0x26ae('0x2b')](_0x26ae('0x1b5'),_0x545baf[_0x26ae('0x1b4')]));}if(_0x42ef09===this[_0x26ae('0x10')][_0x26ae('0x38')]){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x545baf,_0x26ae('0x1b6'));}this[_0x26ae('0x37')]['sync'](this,_0x545baf,_0x42ef09);var _0x5be280=this[_0x26ae('0x10')]['exec']('AGI',util[_0x26ae('0x2b')](_0x26ae('0x1b7'),config['agi'][_0x26ae('0x1b8')]||_0x26ae('0x1b9'),_0x42ef09,this[_0x26ae('0x10')]['arg_1']));if(_0x5be280[_0x26ae('0xa9')]===-0x1){return _0x5be280;}return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0xc9'),_0x26ae('0x1ba'),_0x42ef09));};AGIVertices['prototype'][_0x26ae('0x1bb')]=function(_0x38b605){logger[_0x26ae('0x2f')](util['format'](_0x26ae('0x1bc'),_0x38b605['label']));var _0x3ceed2=this['shellCommand'][_0x26ae('0x73')](this,_0x38b605['command']);this['createSquareDetailsReport'][_0x26ae('0x73')](this,_0x38b605,_0x38b605['command']);if(this[_0x26ae('0x87')](_0x38b605['variable_id'])){var _0x21620f=this[_0x26ae('0xa7')][_0x26ae('0x73')](this,_0x38b605[_0x26ae('0xe0')]);if(_0x21620f){this[_0x26ae('0x10')][_0x26ae('0xa5')](_0x21620f,_0x3ceed2);return this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x1bd'),_0x38b605[_0x26ae('0xbe')],_0x21620f));}}return this[_0x26ae('0x10')][_0x26ae('0xae')](util['format'](_0x26ae('0x1be'),_0x38b605['command']));};AGIVertices[_0x26ae('0x13')]['google_cloud_tts']=function(_0x3fa3ab){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x1bf'),_0x3fa3ab[_0x26ae('0xad')]));_0x3fa3ab[_0x26ae('0x5e')]=_0x3fa3ab[_0x26ae('0x5e')][_0x26ae('0xde')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x26ae('0x87')](_0x3fa3ab[_0x26ae('0x5c')])){return this[_0x26ae('0x10')][_0x26ae('0xae')](_0x26ae('0x1c0'));}if(!this['isConfigured'](_0x3fa3ab['text'])){return this[_0x26ae('0x10')][_0x26ae('0xae')]('no\x20text\x20configured');}this['channel'][_0x26ae('0xae')](util['format'](_0x26ae('0x1c1'),_0x3fa3ab[_0x26ae('0x5e')]));var _0x23d3c1=this[_0x26ae('0x5b')][_0x26ae('0x73')](this,_0x3fa3ab);if(_0x23d3c1){this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x1c2'),_0x23d3c1));var _0x3e79c7=this[_0x26ae('0x10')][_0x26ae('0x15c')](_0x23d3c1);try{fs['unlink'](_0x23d3c1+_0x26ae('0x10f'));}catch(_0x4556a9){logger['error'](_0x4556a9);}return _0x3e79c7;}return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x3fa3ab,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x26ae('0x13')][_0x26ae('0x1c3')]=function(_0x3649ed){logger[_0x26ae('0x2f')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3649ed[_0x26ae('0xad')]));_0x3649ed[_0x26ae('0x5e')]=_0x3649ed['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x26ae('0x87')](_0x3649ed[_0x26ae('0x5e')])){return this[_0x26ae('0x10')][_0x26ae('0xae')]('no\x20text\x20configured');}this[_0x26ae('0x10')]['noop'](util['format'](_0x26ae('0x1c4'),_0x3649ed[_0x26ae('0x5e')]));var _0x240025=this[_0x26ae('0x64')][_0x26ae('0x73')](this,_0x3649ed);if(_0x240025){this[_0x26ae('0x10')]['noop'](util['format'](_0x26ae('0x1c5'),_0x240025));var _0x28c084=this['channel'][_0x26ae('0x15c')](_0x240025);try{fs[_0x26ae('0x10e')](_0x240025+_0x26ae('0x10f'));}catch(_0x431ff3){logger[_0x26ae('0x2d')](_0x431ff3);}return _0x28c084;}return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x3649ed,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x26ae('0x13')][_0x26ae('0x1c6')]=function(_0x58a53a){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x58a53a[_0x26ae('0xad')]));if(!this['isConfigured'](_0x58a53a[_0x26ae('0x160')])){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x58a53a,'no\x20find\x20by\x20configured');}logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x162'),this[_0x26ae('0x10')][_0x26ae('0x39')],_0x58a53a[_0x26ae('0x160')]));var _0x19f412=this['agentUnpause'][_0x26ae('0x73')](this,_0x58a53a[_0x26ae('0x160')]);if(_0x19f412){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x163'),this[_0x26ae('0x10')]['callerid'],_0x58a53a[_0x26ae('0x160')]));this['channel'][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x163'),this[_0x26ae('0x10')][_0x26ae('0x39')],_0x58a53a[_0x26ae('0x160')]));return{'code':0xc8,'result':_0x26ae('0x164')};}else{logger['info'](util[_0x26ae('0x2b')](_0x26ae('0x165'),this[_0x26ae('0x10')][_0x26ae('0x39')],_0x58a53a[_0x26ae('0x160')]));this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0x165'),this[_0x26ae('0x10')][_0x26ae('0x39')],_0x58a53a[_0x26ae('0x160')]));return{'code':0xc8,'result':_0x26ae('0x166')};}};AGIVertices['prototype'][_0x26ae('0x1c7')]=function(_0x2e385d){logger[_0x26ae('0x2f')](util[_0x26ae('0x2b')](_0x26ae('0x1c8'),_0x2e385d[_0x26ae('0xad')]));var _0x54dd76=this[_0x26ae('0x10')][_0x26ae('0xb3')]('VOICEMAIL',[_0x2e385d[_0x26ae('0x1c9')],_0x2e385d[_0x26ae('0x7b')]]);if(_0x54dd76[_0x26ae('0xa9')]===-0x1){return _0x54dd76;}return this[_0x26ae('0x10')][_0x26ae('0xae')](util[_0x26ae('0x2b')](_0x26ae('0xc9'),_0x26ae('0x1ca'),_0x2e385d[_0x26ae('0x1c9')]));};AGIVertices[_0x26ae('0x13')][_0x26ae('0x1cb')]=function(_0x5f1ab5){logger['info'](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x5f1ab5['label']));if(!this['isConfigured'](_0x5f1ab5[_0x26ae('0xe0')])){return this['channel'][_0x26ae('0x2d')](_0x5f1ab5,_0x26ae('0x1cc'));}var _0x2786b2=this[_0x26ae('0xa7')][_0x26ae('0x73')](this,_0x5f1ab5[_0x26ae('0xe0')]);if(!_0x2786b2){return this[_0x26ae('0x10')][_0x26ae('0x2d')](_0x5f1ab5,_0x26ae('0xe2'));}var _0x1f0d49=this[_0x26ae('0x10')][_0x26ae('0xa7')](_0x2786b2);return{'code':0xc8,'result':_0x1f0d49[_0x26ae('0xa8')]?_0x1f0d49[_0x26ae('0xa8')]:'-'};};String[_0x26ae('0x13')][_0x26ae('0x1cd')]=function(_0x2047eb,_0x8f525){return this['split'](_0x2047eb)[_0x26ae('0x1ce')](_0x8f525);};module[_0x26ae('0x1cf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index ecfc991..a4768e5 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 _0x59be=['[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','prototype','startAcw','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','interface','syncAgentConnectPreview','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x59be,0x1a6));var _0xe59b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x59be[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe59b('0x0'));var moment=require(_0xe59b('0x1'));var ami=require(_0xe59b('0x2'));var logger=require(_0xe59b('0x3'))('acw');var RpcUser=require(_0xe59b('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x59a83f){this[_0xe59b('0x5')]=_0x59a83f[_0xe59b('0x5')];this[_0xe59b('0x6')]=_0x59a83f[_0xe59b('0x6')];this[_0xe59b('0x7')]=_0x59a83f[_0xe59b('0x7')];this['channels']={};ami['on'](_0xe59b('0x8'),this[_0xe59b('0x9')][_0xe59b('0xa')](this));ami['on'](_0xe59b('0xb'),this[_0xe59b('0xc')][_0xe59b('0xa')](this));ami['on'](_0xe59b('0xd'),this[_0xe59b('0xe')][_0xe59b('0xa')](this));ami['on'](_0xe59b('0xf'),this[_0xe59b('0x10')][_0xe59b('0xa')](this));ami['on']('attendedtransfer',this[_0xe59b('0x11')][_0xe59b('0xa')](this));ami['on']('blindtransfer',this[_0xe59b('0x12')]['bind'](this));ami['on'](_0xe59b('0x13'),this['syncAgentConnectPreview'][_0xe59b('0xa')](this));}function getDiff(_0x1d8581){var _0xd2b51a=moment()['milliseconds'](0x0);var _0x404b87=moment(_0x1d8581)[_0xe59b('0x14')](0x0);return _0xd2b51a['diff'](_0x404b87,'seconds');}Acw[_0xe59b('0x15')][_0xe59b('0x16')]=function(_0x50e92b){try{var _0x44223b=this;var _0x455a4c=this[_0xe59b('0x17')][_0x50e92b]['interface'];var _0x58dc87=this[_0xe59b('0x17')][_0x50e92b][_0xe59b('0x18')];var _0x2b72b0=this[_0xe59b('0x5')][_0x58dc87];var _0x201165=![];var _0x1d25d6=_0xe59b('0x19');if(_0x2b72b0[_0xe59b('0x1a')]){if(_0x2b72b0[_0xe59b('0x1b')][_0xe59b('0x1c')]){_0x201165=!![];_0x1d25d6=_0x2b72b0[_0xe59b('0x1b')]['name'];}}return ami[_0xe59b('0x1d')]({'action':_0xe59b('0x1e'),'interface':_0x455a4c,'paused':!![],'reason':_0x1d25d6})['then'](function(){if(_0x44223b['agents'][_0x455a4c]){return RpcUser[_0xe59b('0x1f')](_0x44223b[_0xe59b('0x6')][_0x455a4c]['id'])[_0xe59b('0x20')](function(_0x4d15b0){if(_0x4d15b0&&!_0x4d15b0[_0xe59b('0x21')]){logger[_0xe59b('0x22')](_0xe59b('0x23'),_0x50e92b,_0x455a4c,_0x58dc87);var _0x2ff84f=_0x44223b['channels'][_0x50e92b]['attended']&&_0x44223b[_0xe59b('0x17')][_0x50e92b]['destlinkedid']?_0x44223b[_0xe59b('0x17')][_0x50e92b][_0xe59b('0x24')]:_0x50e92b;return RpcUser[_0xe59b('0x25')](_0x44223b[_0xe59b('0x6')][_0x455a4c],_0x1d25d6,_0x2ff84f)['then'](function(){if(!_0x201165){_0x44223b[_0xe59b('0x7')][_0x455a4c]={};logger[_0xe59b('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x50e92b,_0x44223b[_0xe59b('0x5')][_0x58dc87][_0xe59b('0x26')],_0x455a4c,_0x58dc87);_0x44223b[_0xe59b('0x7')][_0x455a4c][_0xe59b('0x27')]=setTimeout(_0x44223b[_0xe59b('0x28')][_0xe59b('0xa')](_0x44223b,_0x455a4c),_0x44223b[_0xe59b('0x5')][_0x58dc87][_0xe59b('0x26')]*0x3e8);_0x44223b[_0xe59b('0x7')][_0x455a4c][_0xe59b('0x29')]=moment()[_0xe59b('0x2a')](_0xe59b('0x2b'));_0x44223b[_0xe59b('0x7')][_0x455a4c][_0xe59b('0x2c')]=_0x50e92b;_0x44223b['timers'][_0x455a4c]['queue']=_0x58dc87;_0x44223b[_0xe59b('0x7')][_0x455a4c][_0xe59b('0x2d')]=function(){var _0x29fe0c=getDiff(_0x44223b[_0xe59b('0x7')][_0x455a4c][_0xe59b('0x29')]);clearTimeout(_0x44223b[_0xe59b('0x7')][_0x455a4c][_0xe59b('0x27')]);_0x44223b[_0xe59b('0x7')][_0x455a4c][_0xe59b('0x27')]=![];RpcVoiceAgentReport[_0xe59b('0x2e')]({'acwtime':_0x29fe0c},_0x44223b[_0xe59b('0x7')][_0x455a4c][_0xe59b('0x2c')],_0x455a4c)[_0xe59b('0x20')](function(_0x5b557a){logger[_0xe59b('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x50e92b,_0x29fe0c,_0x5b557a);})[_0xe59b('0x2f')](function(_0x11247a){logger['error'](_0xe59b('0x30'),_0x50e92b,_0x11247a);});delete _0x44223b[_0xe59b('0x7')][_0x455a4c];};}});}else{logger[_0xe59b('0x22')](_0xe59b('0x31'),_0x50e92b,_0x455a4c,_0x58dc87);}});}})[_0xe59b('0x2f')](function(){logger[_0xe59b('0x32')](_0xe59b('0x33'),_0x50e92b,_0x44223b[_0xe59b('0x5')][_0x58dc87][_0xe59b('0x26')],_0x455a4c,_0x58dc87);})[_0xe59b('0x34')](function(){delete _0x44223b['channels'][_0x50e92b];});}catch(_0x1dc6e0){logger[_0xe59b('0x32')](_0xe59b('0x35'),_0x1dc6e0[_0xe59b('0x36')]);}};Acw[_0xe59b('0x15')][_0xe59b('0x28')]=function(_0x2da9d9){try{var _0x25c5c6=this;if(_0x25c5c6[_0xe59b('0x7')][_0x2da9d9]){_0x25c5c6[_0xe59b('0x7')][_0x2da9d9][_0xe59b('0x27')]=![];var _0x255cb9=_0x25c5c6[_0xe59b('0x7')][_0x2da9d9]['uniqueid'];var _0x3ac3e9=_0x25c5c6[_0xe59b('0x7')][_0x2da9d9][_0xe59b('0x18')];var _0x5075b0=_0x25c5c6[_0xe59b('0x5')][_0x3ac3e9]['acwTimeout'];logger[_0xe59b('0x22')](_0xe59b('0x37'),_0x255cb9,_0x2da9d9);RpcUser[_0xe59b('0x38')](this[_0xe59b('0x6')][_0x2da9d9]);RpcVoiceAgentReport[_0xe59b('0x2e')]({'acwtime':_0x5075b0,'agentacw':!![]},_0x255cb9,_0x2da9d9)[_0xe59b('0x20')](function(_0x551e10){logger['info'](_0xe59b('0x39'),_0x255cb9,_0x5075b0,_0x551e10);})['catch'](function(_0x6e46c2){logger[_0xe59b('0x32')](_0xe59b('0x30'),_0x255cb9,_0x6e46c2);});}else{logger[_0xe59b('0x32')](_0xe59b('0x3a'),_0x2da9d9);if(_0x25c5c6[_0xe59b('0x7')]){logger['info']('[ACW][TIMERS]',JSON[_0xe59b('0x3b')](_0x25c5c6[_0xe59b('0x7')]));}}}catch(_0x27f501){logger[_0xe59b('0x32')](_0xe59b('0x3c'),_0x27f501[_0xe59b('0x36')]);}};Acw[_0xe59b('0x15')]['syncAgentConnect']=function(_0x2b9b7f){try{if(this['voiceQueues'][_0x2b9b7f['queue']]&&(this[_0xe59b('0x5')][_0x2b9b7f[_0xe59b('0x18')]][_0xe59b('0x3d')]||this[_0xe59b('0x5')][_0x2b9b7f[_0xe59b('0x18')]][_0xe59b('0x1a')])){if(this[_0xe59b('0x6')][_0x2b9b7f[_0xe59b('0x3e')]]){this['channels'][_0x2b9b7f['uniqueid']]={'queue':_0x2b9b7f[_0xe59b('0x18')],'interface':_0x2b9b7f[_0xe59b('0x3e')],'destlinkedid':_0x2b9b7f['destlinkedid']};}}}catch(_0x169283){logger[_0xe59b('0x32')]('[ACW][syncAgentConnect]\x20%s',_0x169283[_0xe59b('0x36')]);}};Acw[_0xe59b('0x15')][_0xe59b('0x3f')]=function(_0x5462f2){try{if(this[_0xe59b('0x5')][_0x5462f2[_0xe59b('0x18')]]&&(this[_0xe59b('0x5')][_0x5462f2[_0xe59b('0x18')]]['acw']||this[_0xe59b('0x5')][_0x5462f2['queue']][_0xe59b('0x1a')])){if(this['agents'][_0x5462f2[_0xe59b('0x3e')]]){this['channels'][_0x5462f2[_0xe59b('0x2c')]]={'queue':_0x5462f2[_0xe59b('0x18')],'interface':_0x5462f2[_0xe59b('0x3e')]};}}}catch(_0x249c3f){logger[_0xe59b('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x249c3f[_0xe59b('0x36')]);}};Acw[_0xe59b('0x15')]['syncHangupRequest']=function(_0x5f133b){try{if(this[_0xe59b('0x17')][_0x5f133b[_0xe59b('0x2c')]]&&_[_0xe59b('0x40')](this[_0xe59b('0x17')][_0x5f133b[_0xe59b('0x2c')]][_0xe59b('0x41')])){logger['info'](_0xe59b('0x42'),_0x5f133b[_0xe59b('0x2c')]);this['startAcw'](_0x5f133b['uniqueid']);}else if(this[_0xe59b('0x17')][_0x5f133b[_0xe59b('0x43')]]&&_['isUndefined'](this['channels'][_0x5f133b['linkedid']][_0xe59b('0x41')])){logger[_0xe59b('0x22')]('[%s][HANGUP:LINKEDID]',_0x5f133b[_0xe59b('0x43')]);this[_0xe59b('0x16')](_0x5f133b[_0xe59b('0x43')]);}}catch(_0xeaae03){logger[_0xe59b('0x32')](_0xe59b('0x44'),_0xeaae03[_0xe59b('0x36')]);}};Acw[_0xe59b('0x15')]['syncHangup']=function(_0x402c58){try{if(this[_0xe59b('0x17')][_0x402c58['uniqueid']]&&this['channels'][_0x402c58[_0xe59b('0x2c')]]['attended']){logger[_0xe59b('0x22')](_0xe59b('0x45'),_0x402c58[_0xe59b('0x2c')]);this[_0xe59b('0x16')](_0x402c58[_0xe59b('0x2c')]);}else if(this['channels'][_0x402c58[_0xe59b('0x43')]]&&this['channels'][_0x402c58[_0xe59b('0x43')]][_0xe59b('0x41')]){logger[_0xe59b('0x22')](_0xe59b('0x46'),_0x402c58[_0xe59b('0x43')]);this['startAcw'](_0x402c58[_0xe59b('0x43')]);}}catch(_0x384ab2){logger[_0xe59b('0x32')](_0xe59b('0x47'),_0x384ab2[_0xe59b('0x36')]);}};Acw[_0xe59b('0x15')]['syncAttendedTransfer']=function(_0x2c005f){try{if(!_['isNil'](this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x48')]])){this[_0xe59b('0x16')](_0x2c005f[_0xe59b('0x48')]);if(this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x49')]]){this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x49')]][_0xe59b('0x41')]=!![];this['channels'][_0x2c005f[_0xe59b('0x4a')]]=this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x49')]];delete this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x49')]];}}else if(!_['isNil'](this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x4a')]])){this[_0xe59b('0x16')](_0x2c005f[_0xe59b('0x4a')]);if(this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x4b')]]){this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x4b')]][_0xe59b('0x41')]=!![];this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x48')]]=this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x4b')]];delete this[_0xe59b('0x17')][_0x2c005f[_0xe59b('0x4b')]];}}}catch(_0x44fc41){logger[_0xe59b('0x32')](_0xe59b('0x4c'),_0x44fc41['message']);}};Acw[_0xe59b('0x15')][_0xe59b('0x12')]=function(_0x562030){try{if(this[_0xe59b('0x17')][_0x562030['transfereruniqueid']]){logger[_0xe59b('0x22')](_0xe59b('0x4d'),JSON['stringify'](_0x562030[_0xe59b('0x4e')]));this[_0xe59b('0x16')](_0x562030['transfereruniqueid']);}else if(this[_0xe59b('0x17')][_0x562030[_0xe59b('0x4f')]]){logger[_0xe59b('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xe59b('0x3b')](_0x562030[_0xe59b('0x4f')]));this['startAcw'](_0x562030[_0xe59b('0x4f')]);}}catch(_0x4582ed){logger[_0xe59b('0x32')](_0xe59b('0x50'),_0x4582ed[_0xe59b('0x36')]);}};Acw[_0xe59b('0x15')][_0xe59b('0x10')]=function(_0x411a0a){try{if(this[_0xe59b('0x5')][_0x411a0a[_0xe59b('0x18')]]&&this[_0xe59b('0x5')][_0x411a0a['queue']]['autopause']===_0xe59b('0x51')){if(this[_0xe59b('0x6')][_0x411a0a[_0xe59b('0x3e')]]){logger['info'](_0xe59b('0x52'),_0x411a0a[_0xe59b('0x2c')],_0x411a0a[_0xe59b('0x3e')],_0x411a0a['queue']);return RpcUser['savePause'](this[_0xe59b('0x6')][_0x411a0a[_0xe59b('0x3e')]],'Auto-Pause',_0x411a0a[_0xe59b('0x2c')]);}}}catch(_0x10a962){logger[_0xe59b('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x10a962[_0xe59b('0x36')]);}};module[_0xe59b('0x53')]=Acw; \ No newline at end of file +var _0xc006=['saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','syncAgentConnectPreview','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','queue','[%s][TIMER][STOP][AGENT:%s]'];(function(_0x9ca877,_0x621e5d){var _0xc94b26=function(_0xdcb4c5){while(--_0xdcb4c5){_0x9ca877['push'](_0x9ca877['shift']());}};_0xc94b26(++_0x621e5d);}(_0xc006,0xcd));var _0x6c00=function(_0x2c5009,_0x63505f){_0x2c5009=_0x2c5009-0x0;var _0x40b7f9=_0xc006[_0x2c5009];return _0x40b7f9;};'use strict';var _=require(_0x6c00('0x0'));var moment=require(_0x6c00('0x1'));var ami=require(_0x6c00('0x2'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x6c00('0x3'));var RpcVoiceAgentReport=require(_0x6c00('0x4'));function Acw(_0x7db77f){this['voiceQueues']=_0x7db77f[_0x6c00('0x5')];this[_0x6c00('0x6')]=_0x7db77f['agents'];this[_0x6c00('0x7')]=_0x7db77f[_0x6c00('0x7')];this[_0x6c00('0x8')]={};ami['on'](_0x6c00('0x9'),this[_0x6c00('0xa')][_0x6c00('0xb')](this));ami['on']('hanguprequest',this[_0x6c00('0xc')][_0x6c00('0xb')](this));ami['on'](_0x6c00('0xd'),this[_0x6c00('0xe')][_0x6c00('0xb')](this));ami['on'](_0x6c00('0xf'),this['syncAgentRingNoAnswer'][_0x6c00('0xb')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x6c00('0xb')](this));ami['on'](_0x6c00('0x10'),this[_0x6c00('0x11')][_0x6c00('0xb')](this));ami['on'](_0x6c00('0x12'),this['syncAgentConnectPreview'][_0x6c00('0xb')](this));}function getDiff(_0x3cfb65){var _0x41c3eb=moment()['milliseconds'](0x0);var _0x3b247e=moment(_0x3cfb65)[_0x6c00('0x13')](0x0);return _0x41c3eb[_0x6c00('0x14')](_0x3b247e,_0x6c00('0x15'));}Acw['prototype'][_0x6c00('0x16')]=function(_0x38df25){try{var _0x4b12be=this;var _0x13fe7a=this[_0x6c00('0x8')][_0x38df25]['interface'];var _0x450137=this[_0x6c00('0x8')][_0x38df25]['queue'];var _0x24dbcf=this['voiceQueues'][_0x450137];var _0x3cb46e=![];var _0x3797b5=_0x6c00('0x17');if(_0x24dbcf[_0x6c00('0x18')]){if(_0x24dbcf[_0x6c00('0x19')][_0x6c00('0x1a')]){_0x3cb46e=!![];_0x3797b5=_0x24dbcf[_0x6c00('0x19')][_0x6c00('0x1a')];}}return ami['Action']({'action':_0x6c00('0x1b'),'interface':_0x13fe7a,'paused':!![],'reason':_0x3797b5})[_0x6c00('0x1c')](function(){if(_0x4b12be['agents'][_0x13fe7a]){return RpcUser[_0x6c00('0x1d')](_0x4b12be[_0x6c00('0x6')][_0x13fe7a]['id'])[_0x6c00('0x1c')](function(_0x3fda8f){if(_0x3fda8f&&!_0x3fda8f[_0x6c00('0x1e')]){logger[_0x6c00('0x1f')](_0x6c00('0x20'),_0x38df25,_0x13fe7a,_0x450137);var _0xc87f7e=_0x4b12be[_0x6c00('0x8')][_0x38df25]['attended']&&_0x4b12be['channels'][_0x38df25][_0x6c00('0x21')]?_0x4b12be[_0x6c00('0x8')][_0x38df25][_0x6c00('0x21')]:_0x38df25;return RpcUser[_0x6c00('0x22')](_0x4b12be[_0x6c00('0x6')][_0x13fe7a],_0x3797b5,_0xc87f7e)[_0x6c00('0x1c')](function(){if(!_0x3cb46e){_0x4b12be[_0x6c00('0x7')][_0x13fe7a]={};logger[_0x6c00('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x38df25,_0x4b12be['voiceQueues'][_0x450137][_0x6c00('0x23')],_0x13fe7a,_0x450137);_0x4b12be[_0x6c00('0x7')][_0x13fe7a]['timer']=setTimeout(_0x4b12be[_0x6c00('0x24')][_0x6c00('0xb')](_0x4b12be,_0x13fe7a),_0x4b12be[_0x6c00('0x5')][_0x450137][_0x6c00('0x23')]*0x3e8);_0x4b12be[_0x6c00('0x7')][_0x13fe7a][_0x6c00('0x25')]=moment()[_0x6c00('0x26')](_0x6c00('0x27'));_0x4b12be[_0x6c00('0x7')][_0x13fe7a]['uniqueid']=_0x38df25;_0x4b12be[_0x6c00('0x7')][_0x13fe7a]['queue']=_0x450137;_0x4b12be[_0x6c00('0x7')][_0x13fe7a][_0x6c00('0x28')]=function(){var _0x54c47c=getDiff(_0x4b12be[_0x6c00('0x7')][_0x13fe7a]['lastPauseAt']);clearTimeout(_0x4b12be[_0x6c00('0x7')][_0x13fe7a][_0x6c00('0x29')]);_0x4b12be['timers'][_0x13fe7a][_0x6c00('0x29')]=![];RpcVoiceAgentReport[_0x6c00('0x2a')]({'acwtime':_0x54c47c},_0x4b12be[_0x6c00('0x7')][_0x13fe7a][_0x6c00('0x2b')],_0x13fe7a)[_0x6c00('0x1c')](function(_0x29204f){logger[_0x6c00('0x1f')](_0x6c00('0x2c'),_0x38df25,_0x54c47c,_0x29204f);})[_0x6c00('0x2d')](function(_0x59d1a7){logger[_0x6c00('0x2e')](_0x6c00('0x2f'),_0x38df25,_0x59d1a7);});delete _0x4b12be[_0x6c00('0x7')][_0x13fe7a];};}});}else{logger['info'](_0x6c00('0x30'),_0x38df25,_0x13fe7a,_0x450137);}});}})[_0x6c00('0x2d')](function(){logger[_0x6c00('0x2e')](_0x6c00('0x31'),_0x38df25,_0x4b12be[_0x6c00('0x5')][_0x450137][_0x6c00('0x23')],_0x13fe7a,_0x450137);})[_0x6c00('0x32')](function(){delete _0x4b12be['channels'][_0x38df25];});}catch(_0x9d9714){logger['error'](_0x6c00('0x33'),_0x9d9714[_0x6c00('0x34')]);}};Acw[_0x6c00('0x35')][_0x6c00('0x24')]=function(_0x1aa950){try{var _0x115eab=this;if(_0x115eab[_0x6c00('0x7')][_0x1aa950]){_0x115eab['timers'][_0x1aa950]['timer']=![];var _0x1726b1=_0x115eab[_0x6c00('0x7')][_0x1aa950][_0x6c00('0x2b')];var _0x3eed65=_0x115eab[_0x6c00('0x7')][_0x1aa950][_0x6c00('0x36')];var _0x3061f1=_0x115eab[_0x6c00('0x5')][_0x3eed65][_0x6c00('0x23')];logger[_0x6c00('0x1f')](_0x6c00('0x37'),_0x1726b1,_0x1aa950);RpcUser[_0x6c00('0x38')](this['agents'][_0x1aa950]);RpcVoiceAgentReport[_0x6c00('0x2a')]({'acwtime':_0x3061f1,'agentacw':!![]},_0x1726b1,_0x1aa950)[_0x6c00('0x1c')](function(_0x4fd0d9){logger[_0x6c00('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x1726b1,_0x3061f1,_0x4fd0d9);})[_0x6c00('0x2d')](function(_0x165e0d){logger[_0x6c00('0x2e')](_0x6c00('0x2f'),_0x1726b1,_0x165e0d);});}else{logger[_0x6c00('0x2e')](_0x6c00('0x39'),_0x1aa950);if(_0x115eab[_0x6c00('0x7')]){logger[_0x6c00('0x1f')](_0x6c00('0x3a'),JSON[_0x6c00('0x3b')](_0x115eab['timers']));}}}catch(_0x380b11){logger['error'](_0x6c00('0x3c'),_0x380b11[_0x6c00('0x34')]);}};Acw[_0x6c00('0x35')][_0x6c00('0xa')]=function(_0x205b5f){try{if(this['voiceQueues'][_0x205b5f[_0x6c00('0x36')]]&&(this[_0x6c00('0x5')][_0x205b5f[_0x6c00('0x36')]]['acw']||this[_0x6c00('0x5')][_0x205b5f['queue']]['mandatoryDisposition'])){if(this[_0x6c00('0x6')][_0x205b5f[_0x6c00('0x3d')]]){this[_0x6c00('0x8')][_0x205b5f[_0x6c00('0x2b')]]={'queue':_0x205b5f['queue'],'interface':_0x205b5f[_0x6c00('0x3d')],'destlinkedid':_0x205b5f[_0x6c00('0x21')]};}}}catch(_0x40cf8e){logger[_0x6c00('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x40cf8e['message']);}};Acw['prototype'][_0x6c00('0x3e')]=function(_0x43fb79){try{if(this[_0x6c00('0x5')][_0x43fb79[_0x6c00('0x36')]]&&(this[_0x6c00('0x5')][_0x43fb79[_0x6c00('0x36')]][_0x6c00('0x3f')]||this['voiceQueues'][_0x43fb79[_0x6c00('0x36')]][_0x6c00('0x18')])){if(this['agents'][_0x43fb79[_0x6c00('0x3d')]]){this['channels'][_0x43fb79[_0x6c00('0x2b')]]={'queue':_0x43fb79['queue'],'interface':_0x43fb79[_0x6c00('0x3d')]};}}}catch(_0x1c20eb){logger['error'](_0x6c00('0x40'),_0x1c20eb[_0x6c00('0x34')]);}};Acw[_0x6c00('0x35')][_0x6c00('0xc')]=function(_0x730eaf){try{if(this[_0x6c00('0x8')][_0x730eaf[_0x6c00('0x2b')]]&&_[_0x6c00('0x41')](this['channels'][_0x730eaf[_0x6c00('0x2b')]][_0x6c00('0x42')])){logger[_0x6c00('0x1f')](_0x6c00('0x43'),_0x730eaf[_0x6c00('0x2b')]);this[_0x6c00('0x16')](_0x730eaf[_0x6c00('0x2b')]);}else if(this[_0x6c00('0x8')][_0x730eaf[_0x6c00('0x44')]]&&_[_0x6c00('0x41')](this[_0x6c00('0x8')][_0x730eaf[_0x6c00('0x44')]]['attended'])){logger[_0x6c00('0x1f')]('[%s][HANGUP:LINKEDID]',_0x730eaf[_0x6c00('0x44')]);this[_0x6c00('0x16')](_0x730eaf['linkedid']);}}catch(_0x198508){logger[_0x6c00('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x198508[_0x6c00('0x34')]);}};Acw[_0x6c00('0x35')][_0x6c00('0xe')]=function(_0x2b12a9){try{if(this[_0x6c00('0x8')][_0x2b12a9[_0x6c00('0x2b')]]&&this[_0x6c00('0x8')][_0x2b12a9['uniqueid']][_0x6c00('0x42')]){logger[_0x6c00('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2b12a9['uniqueid']);this[_0x6c00('0x16')](_0x2b12a9[_0x6c00('0x2b')]);}else if(this[_0x6c00('0x8')][_0x2b12a9['linkedid']]&&this[_0x6c00('0x8')][_0x2b12a9['linkedid']][_0x6c00('0x42')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2b12a9[_0x6c00('0x44')]);this[_0x6c00('0x16')](_0x2b12a9[_0x6c00('0x44')]);}}catch(_0x50c7e6){logger[_0x6c00('0x2e')](_0x6c00('0x45'),_0x50c7e6[_0x6c00('0x34')]);}};Acw['prototype'][_0x6c00('0x46')]=function(_0x170112){try{if(!_[_0x6c00('0x47')](this[_0x6c00('0x8')][_0x170112['transfereeuniqueid']])){this[_0x6c00('0x16')](_0x170112[_0x6c00('0x48')]);if(this[_0x6c00('0x8')][_0x170112['secondtransfereruniqueid']]){this[_0x6c00('0x8')][_0x170112[_0x6c00('0x49')]][_0x6c00('0x42')]=!![];this[_0x6c00('0x8')][_0x170112[_0x6c00('0x4a')]]=this[_0x6c00('0x8')][_0x170112[_0x6c00('0x49')]];delete this[_0x6c00('0x8')][_0x170112[_0x6c00('0x49')]];}}else if(!_['isNil'](this['channels'][_0x170112[_0x6c00('0x4a')]])){this['startAcw'](_0x170112['transfertargetuniqueid']);if(this[_0x6c00('0x8')][_0x170112[_0x6c00('0x4b')]]){this[_0x6c00('0x8')][_0x170112[_0x6c00('0x4b')]][_0x6c00('0x42')]=!![];this['channels'][_0x170112[_0x6c00('0x48')]]=this['channels'][_0x170112[_0x6c00('0x4b')]];delete this[_0x6c00('0x8')][_0x170112[_0x6c00('0x4b')]];}}}catch(_0x1891d8){logger[_0x6c00('0x2e')](_0x6c00('0x4c'),_0x1891d8[_0x6c00('0x34')]);}};Acw[_0x6c00('0x35')]['syncBlindTransfer']=function(_0x385230){try{if(this[_0x6c00('0x8')][_0x385230['transfereruniqueid']]){logger['info'](_0x6c00('0x4d'),JSON[_0x6c00('0x3b')](_0x385230[_0x6c00('0x4e')]));this[_0x6c00('0x16')](_0x385230[_0x6c00('0x4e')]);}else if(this[_0x6c00('0x8')][_0x385230[_0x6c00('0x4f')]]){logger[_0x6c00('0x1f')](_0x6c00('0x50'),JSON[_0x6c00('0x3b')](_0x385230[_0x6c00('0x4f')]));this[_0x6c00('0x16')](_0x385230['transfererlinkedid']);}}catch(_0x29130b){logger[_0x6c00('0x2e')](_0x6c00('0x51'),_0x29130b[_0x6c00('0x34')]);}};Acw[_0x6c00('0x35')][_0x6c00('0x52')]=function(_0x3f2ce9){try{if(this['voiceQueues'][_0x3f2ce9[_0x6c00('0x36')]]&&this[_0x6c00('0x5')][_0x3f2ce9['queue']][_0x6c00('0x53')]==='all'){if(this[_0x6c00('0x6')][_0x3f2ce9[_0x6c00('0x3d')]]){logger[_0x6c00('0x1f')](_0x6c00('0x54'),_0x3f2ce9[_0x6c00('0x2b')],_0x3f2ce9[_0x6c00('0x3d')],_0x3f2ce9['queue']);return RpcUser[_0x6c00('0x22')](this[_0x6c00('0x6')][_0x3f2ce9[_0x6c00('0x3d')]],'Auto-Pause',_0x3f2ce9[_0x6c00('0x2b')]);}}}catch(_0x5eb1c6){logger['error'](_0x6c00('0x55'),_0x5eb1c6[_0x6c00('0x34')]);}};module[_0x6c00('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 7eac90c..adaa993 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 _0xefe4=['actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','close','asterisk-manager','bluebird','util','../../config/logger','ami','port','username','asterisk','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary'];(function(_0x579559,_0x5470eb){var _0x569cbb=function(_0x415612){while(--_0x415612){_0x579559['push'](_0x579559['shift']());}};_0x569cbb(++_0x5470eb);}(_0xefe4,0x1e2));var _0x4efe=function(_0x2cbcdc,_0x3d19a5){_0x2cbcdc=_0x2cbcdc-0x0;var _0x294e2e=_0xefe4[_0x2cbcdc];return _0x294e2e;};'use strict';var Manager=require(_0x4efe('0x0'));var BPromise=require(_0x4efe('0x1'));var util=require(_0x4efe('0x2'));var logger=require(_0x4efe('0x3'))(_0x4efe('0x4'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x4efe('0x5')],config['asterisk']['ip'],config['asterisk'][_0x4efe('0x6')],config[_0x4efe('0x7')][_0x4efe('0x8')],!![]);ami[_0x4efe('0x9')]();ami['Action']=BPromise[_0x4efe('0xa')](ami[_0x4efe('0xb')]);function error(_0x5aa5eb){logger[_0x4efe('0xc')](util[_0x4efe('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x4efe('0x7')][_0x4efe('0x6')],config['asterisk']['ip'],config[_0x4efe('0x7')][_0x4efe('0x5')],util['inspect'](_0x5aa5eb,![],null)));}function close(){logger['error'](util['format'](_0x4efe('0xe'),config[_0x4efe('0x7')][_0x4efe('0x6')],config[_0x4efe('0x7')]['ip'],config[_0x4efe('0x7')][_0x4efe('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x4efe('0xf')]({'action':_0x4efe('0x10')});};};ami[_0x4efe('0x11')]=function(){return function(){return ami[_0x4efe('0xf')]({'action':_0x4efe('0x12')});};};ami[_0x4efe('0x13')]=function(){return function(){return ami[_0x4efe('0xf')]({'action':_0x4efe('0x14')});};};ami[_0x4efe('0x15')]=function(){return function(){return ami[_0x4efe('0xf')]({'action':'queuesummary'});};};ami[_0x4efe('0x16')]=function(){return function(){return ami[_0x4efe('0xf')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x4efe('0xd')](_0x4efe('0x17'),config[_0x4efe('0x7')][_0x4efe('0x6')],config[_0x4efe('0x7')]['ip'],config['asterisk']['port']));ami[_0x4efe('0x18')]('error',error);ami[_0x4efe('0x18')]('close',close);}ami['on'](_0x4efe('0x19'),connect);ami['on']('shutdown',function(_0x47f6a2){logger['info'](util[_0x4efe('0xd')](_0x4efe('0x1a'),config[_0x4efe('0x7')][_0x4efe('0x6')],config['asterisk']['ip'],config[_0x4efe('0x7')]['port'],util[_0x4efe('0x1b')](_0x47f6a2,![],null)));});ami['on'](_0x4efe('0x1c'),function(){logger[_0x4efe('0x1d')](util[_0x4efe('0xd')](_0x4efe('0x1e'),config[_0x4efe('0x7')][_0x4efe('0x6')],config[_0x4efe('0x7')]['ip'],config['asterisk'][_0x4efe('0x5')]));return Promise[_0x4efe('0x1f')]()[_0x4efe('0x20')](ami['actionSipShowRegistry']())[_0x4efe('0x20')](ami[_0x4efe('0x11')]())['then'](ami[_0x4efe('0x13')]())['then'](ami['actionQueueSummary']())[_0x4efe('0x20')](ami[_0x4efe('0x16')]())[_0x4efe('0x21')](function(_0x1ff727){logger[_0x4efe('0xc')](_0x4efe('0x22'),util['inspect'](_0x1ff727,{'showHidden':![],'depth':null}));});});ami['once'](_0x4efe('0xc'),error);ami[_0x4efe('0x18')](_0x4efe('0x23'),close);module['exports']=ami; \ No newline at end of file +var _0x00aa=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect'];(function(_0x565a75,_0x21827c){var _0x588e8d=function(_0x31c16b){while(--_0x31c16b){_0x565a75['push'](_0x565a75['shift']());}};_0x588e8d(++_0x21827c);}(_0x00aa,0x181));var _0xa00a=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x00aa[_0x4b73a2];return _0x383c66;};'use strict';var Manager=require(_0xa00a('0x0'));var BPromise=require(_0xa00a('0x1'));var util=require(_0xa00a('0x2'));var logger=require(_0xa00a('0x3'))('ami');var config=require(_0xa00a('0x4'));var ami=new Manager(config[_0xa00a('0x5')]['port'],config[_0xa00a('0x5')]['ip'],config[_0xa00a('0x5')]['username'],config[_0xa00a('0x5')]['password'],!![]);ami[_0xa00a('0x6')]();ami[_0xa00a('0x7')]=BPromise[_0xa00a('0x8')](ami[_0xa00a('0x9')]);function error(_0x461043){logger[_0xa00a('0xa')](util[_0xa00a('0xb')](_0xa00a('0xc'),config['asterisk']['username'],config[_0xa00a('0x5')]['ip'],config[_0xa00a('0x5')][_0xa00a('0xd')],util[_0xa00a('0xe')](_0x461043,![],null)));}function close(){logger[_0xa00a('0xa')](util[_0xa00a('0xb')](_0xa00a('0xf'),config[_0xa00a('0x5')][_0xa00a('0x10')],config[_0xa00a('0x5')]['ip'],config[_0xa00a('0x5')]['port']));}ami[_0xa00a('0x11')]=function(){return function(){return ami['Action']({'action':_0xa00a('0x12')});};};ami[_0xa00a('0x13')]=function(){return function(){return ami[_0xa00a('0x7')]({'action':_0xa00a('0x14')});};};ami[_0xa00a('0x15')]=function(){return function(){return ami[_0xa00a('0x7')]({'action':_0xa00a('0x16')});};};ami[_0xa00a('0x17')]=function(){return function(){return ami[_0xa00a('0x7')]({'action':_0xa00a('0x18')});};};ami[_0xa00a('0x19')]=function(){return function(){return ami[_0xa00a('0x7')]({'action':_0xa00a('0x1a')});};};function connect(){logger[_0xa00a('0x1b')](util[_0xa00a('0xb')](_0xa00a('0x1c'),config[_0xa00a('0x5')][_0xa00a('0x10')],config['asterisk']['ip'],config[_0xa00a('0x5')][_0xa00a('0xd')]));ami[_0xa00a('0x1d')](_0xa00a('0xa'),error);ami[_0xa00a('0x1d')](_0xa00a('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0xa00a('0x1f'),function(_0x497c1c){logger[_0xa00a('0x1b')](util[_0xa00a('0xb')](_0xa00a('0x20'),config[_0xa00a('0x5')][_0xa00a('0x10')],config['asterisk']['ip'],config[_0xa00a('0x5')][_0xa00a('0xd')],util[_0xa00a('0xe')](_0x497c1c,![],null)));});ami['on'](_0xa00a('0x21'),function(){logger['info'](util[_0xa00a('0xb')](_0xa00a('0x22'),config[_0xa00a('0x5')][_0xa00a('0x10')],config[_0xa00a('0x5')]['ip'],config[_0xa00a('0x5')][_0xa00a('0xd')]));return Promise[_0xa00a('0x23')]()[_0xa00a('0x24')](ami['actionSipShowRegistry']())[_0xa00a('0x24')](ami['actionDeviceStateList']())[_0xa00a('0x24')](ami[_0xa00a('0x15')]())[_0xa00a('0x24')](ami[_0xa00a('0x17')]())[_0xa00a('0x24')](ami[_0xa00a('0x19')]())[_0xa00a('0x25')](function(_0x3b4b1f){logger[_0xa00a('0xa')](_0xa00a('0x26'),util[_0xa00a('0xe')](_0x3b4b1f,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0xa00a('0x1d')](_0xa00a('0x1e'),close);module[_0xa00a('0x27')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 17da5ca..4478b5b 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x493150,_0x107958){var _0x3fe8da=function(_0xce7a75){while(--_0xce7a75){_0x493150['push'](_0x493150['shift']());}};_0x3fe8da(++_0x107958);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x50f94b,_0x4655e3){var _0x460aa5=function(_0x1ec866){while(--_0x1ec866){_0x50f94b['push'](_0x50f94b['shift']());}};_0x460aa5(++_0x4655e3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 648b362..83dcd99 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 _0xcedb=['EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','ifTime','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','then','indexOf','true','catch','Action','content','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','Dialer::ifTime()','intervalIftime','silly','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','agiafterat','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','dropreason','CALLEREXIT','countabandonedretry','rescheduleContact','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','stateinterface','paused','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','HangupInAMD','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','reason19\x20machine....','dialMachineRetryFrequency','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','running','statusMessage','available','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','XMD-AMDINITIALSILENCE','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','extractCalleridName','variables','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','Error','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','loggedIn','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','milliseconds','recallme','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[getContactDialerPredictive]','--------\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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','exports','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/logger','booked','predictiveCalls','syncQueueSummary','defaults','redis','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','bind','originateresponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','Avg\x20Hold\x20Time\x20is\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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20'];(function(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0xcedb,0x186));var _0xbced=function(_0x4a8b39,_0xb46871){_0x4a8b39=_0x4a8b39-0x0;var _0x37a991=_0xcedb[_0x4a8b39];return _0x37a991;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0xbced('0x0'));var moment=require(_0xbced('0x1'));var rr=require('rr');var Redis=require(_0xbced('0x2'));var utils=require(_0xbced('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0xbced('0x4'));var config=require('../../../config/environment/');var logger=require(_0xbced('0x5'))('dialer');var loggerBooked=require('../../../config/logger')(_0xbced('0x6'));var loggerPredictive=require(_0xbced('0x5'))('predictive');var loggerPredictiveCalls=require(_0xbced('0x5'))(_0xbced('0x7'));var loggerSyncQueueSummary=require(_0xbced('0x5'))(_0xbced('0x8'));var ami=require('../ami');config['redis']=_[_0xbced('0x9')](config[_0xbced('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbced('0xa')]));var cmHopper=require(_0xbced('0xb'));var voiceQueueRt=require(_0xbced('0xc'));var RpcSetting=require(_0xbced('0xd'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0xbced('0xe'));var Final=require('./models/final');var AgentComplete=require(_0xbced('0xf'));var QueueCallerAbandon=require(_0xbced('0x10'));var Hangup=require(_0xbced('0x11'));var ipAgi=process[_0xbced('0x12')][_0xbced('0x13')]||_0xbced('0x14');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xbced('0x15')][_0xbced('0x16')]=function(_0x1f2221){this[_0xbced('0x17')]=this['tail']?this['tail'][_0xbced('0x18')](_0x1f2221):_0x1f2221();};function Dialer(_0x23c424,_0x1f4d5d){this[_0xbced('0x19')]=new Sequence();this[_0xbced('0x1a')]=_0x1f4d5d;this[_0xbced('0x1b')]=_0x23c424[_0xbced('0x1b')];this[_0xbced('0x1c')]=_0x23c424[_0xbced('0x1c')];this[_0xbced('0x1d')]=_0x23c424[_0xbced('0x1d')];this[_0xbced('0x1e')]=_0x23c424[_0xbced('0x1e')];this[_0xbced('0x1f')]=config[_0xbced('0x1f')]||0x2;this[_0xbced('0x20')]={};this[_0xbced('0x21')]={};this[_0xbced('0x22')]={};this[_0xbced('0x23')]={};this[_0xbced('0x24')]={};this[_0xbced('0x25')]={};this[_0xbced('0x26')]={};this[_0xbced('0x27')]={};this[_0xbced('0x28')]={};this['queueBookedRR']={};this[_0xbced('0x29')]={};ami['on'](_0xbced('0x2a'),this['syncAgentConnect'][_0xbced('0x2b')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0xbced('0x2b')](this));ami['on'](_0xbced('0x2c'),this['syncOriginateResponse'][_0xbced('0x2b')](this));ami['on'](_0xbced('0x2d'),this['syncAgentComplete'][_0xbced('0x2b')](this));ami['on'](_0xbced('0x2e'),this[_0xbced('0x8')]['bind'](this));ami['on'](_0xbced('0x2f'),this[_0xbced('0x30')][_0xbced('0x2b')](this));ami['on'](_0xbced('0x31'),this['syncHangup']['bind'](this));ami['on'](_0xbced('0x32'),this[_0xbced('0x33')]['bind'](this));ami['on'](_0xbced('0x34'),this[_0xbced('0x35')][_0xbced('0x2b')](this));ami['on']('queuemember',this[_0xbced('0x36')][_0xbced('0x2b')](this));ami['on'](_0xbced('0x37'),this[_0xbced('0x38')][_0xbced('0x2b')](this));this[_0xbced('0x39')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()['then'](function(_0x2836f2){previewRecallmeReminderInterval=_0x2836f2['previewRecallmeReminderInterval'];});}function isNotNull(_0x21ce9e){return _0x21ce9e!==null&&!_[_0xbced('0x3a')](_0x21ce9e);}function msgResponse(_0x4af097,_0x3a6482,_0x5bbdbd){return{'action':_0x4af097,'response':_0x3a6482,'message':_0x5bbdbd,'stack':_0x5bbdbd};}function emit(_0x234730,_0x183e46,_0x55a425){io['to'](_0x234730)[_0xbced('0x3b')](_0x183e46,_0x55a425);}function emitOutboundVoiceQueueSummary(_0xe0c4ba){if(_0xe0c4ba[_0xbced('0x3c')]===_0xbced('0x3d')){logger[_0xbced('0x3e')](_0xbced('0x3f'),util[_0xbced('0x40')](_0xe0c4ba,{'showHidden':![],'depth':null}));emit(util[_0xbced('0x41')]('voice:queue:%s',_0xe0c4ba[_0xbced('0x42')]),_0xbced('0x43'),_0xe0c4ba);}}function checkGetDataPredictive(_0x295d2a){if(isNotNull(_0x295d2a)&&!_[_0xbced('0x44')](_0x295d2a)){loggerPredictive[_0xbced('0x45')](_0xbced('0x46'));loggerPredictive[_0xbced('0x45')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x295d2a[_0xbced('0x47')]);loggerPredictive[_0xbced('0x45')](_0xbced('0x48'),_0x295d2a['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xbced('0x45')](_0xbced('0x49'),_0x295d2a[_0xbced('0x4a')]);loggerPredictive[_0xbced('0x45')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x295d2a[_0xbced('0x4b')]);loggerPredictive[_0xbced('0x45')](_0xbced('0x4c'),_0x295d2a['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xbced('0x4d'),_0x295d2a[_0xbced('0x4e')]);loggerPredictive[_0xbced('0x45')](_0xbced('0x4f'));if(_0x295d2a[_0xbced('0x47')]>0x0){if(!_[_0xbced('0x3a')](_0x295d2a[_0xbced('0x4e')])&&_0x295d2a[_0xbced('0x4e')]>0x0){return!![];}loggerPredictive['info'](_0xbced('0x50'));if(!_[_0xbced('0x3a')](_0x295d2a[_0xbced('0x51')])&&_0x295d2a[_0xbced('0x51')]>0x0){return!![];}loggerPredictive[_0xbced('0x45')](_0xbced('0x52'));}else{loggerPredictive[_0xbced('0x45')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xbced('0x45')](_0xbced('0x53'));}return![];}function mergeDataErlangB(_0x16b674){return function(_0x4296cb){loggerPredictive[_0xbced('0x45')](_0xbced('0x54'));loggerPredictive[_0xbced('0x45')](_0xbced('0x55'),_0x4296cb[_0xbced('0x56')]);loggerPredictive[_0xbced('0x45')](_0xbced('0x57'),_0x4296cb['erlangCallToSecond']);loggerPredictive[_0xbced('0x45')](_0xbced('0x58'),_0x4296cb['erlangAbandonmentRate']);loggerPredictive[_0xbced('0x45')](_0xbced('0x59'),_0x4296cb['erlangBusyFactor']);loggerPredictive[_0xbced('0x45')](_0xbced('0x58'),_0x4296cb[_0xbced('0x5a')]);loggerPredictive[_0xbced('0x45')](_0xbced('0x4f'));_[_0xbced('0x5b')](_0x16b674,_0x4296cb);};}function ifInterval(_0xf3794d,_0x2410a0){if(_[_0xbced('0x3a')](_0x2410a0)){return![];}return utils[_0xbced('0x5c')](undefined,_0x2410a0)<_0xf3794d*0x3c;}function clearPredictiveAttributes(_0x4ab3e9){if(_0x4ab3e9[_0xbced('0x26')]){_0x4ab3e9['startProgressive']=undefined;loggerPredictive[_0xbced('0x3e')](_0x4ab3e9[_0xbced('0x42')],_0xbced('0x5d'));}if(_0x4ab3e9[_0xbced('0x25')]){_0x4ab3e9[_0xbced('0x25')]=undefined;loggerPredictive[_0xbced('0x3e')](_0x4ab3e9[_0xbced('0x42')],_0xbced('0x5e'));}if(_0x4ab3e9['handlePredictive']){clearInterval(_0x4ab3e9[_0xbced('0x5f')]);_0x4ab3e9['handlePredictive']=undefined;loggerPredictive[_0xbced('0x3e')](_0x4ab3e9['name'],_0xbced('0x60'));}}function loggerCatchPredictive(_0x215559,_0x579d48){return function(_0x3213f8){loggerPredictive[_0xbced('0x61')](_0x579d48[_0xbced('0x42')],_0x215559);loggerPredictive['error'](_0x3213f8['stack']);clearPredictiveAttributes(_0x579d48);};}function loggerCatch(_0x31ba8d){return function(_0x15feed){logger[_0xbced('0x61')](_0x31ba8d,util[_0xbced('0x40')](_0x15feed,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x5550f6,_0x56b10a,_0x1662e0){return function(_0x5ba108){utils[_0xbced('0x62')](_0x56b10a,_0x1662e0,0x0);logger[_0xbced('0x61')](_0x5550f6,util[_0xbced('0x40')](_0x5ba108,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x21176b){return function(_0x12238e){if(isNotNull(_0x12238e)&&isNotNull(_0x12238e[0x0])){if(_0x12238e[0x0][_0xbced('0x63')]>0x0){_0x21176b[_0xbced('0x64')]=utils[_0xbced('0x65')][_0xbced('0x66')];logger[_0xbced('0x45')](_0xbced('0x67')+_0x21176b[_0xbced('0x42')],_0x12238e[0x0][_0xbced('0x63')],_0xbced('0x68'));}else{_0x21176b[_0xbced('0x64')]=utils[_0xbced('0x65')][_0xbced('0x69')];logger[_0xbced('0x45')](_0xbced('0x6a')+_0x21176b[_0xbced('0x42')]);}}};}function createObjHistory(_0x40103f,_0x3b1823,_0x321cef,_0x30bcd9,_0x362ed8){_0x40103f[_0xbced('0x64')]=_0x321cef;var _0x3e06ff=new Action(_0x40103f,_0x3b1823);var _0x2a9dcf=new History(_0x3e06ff);_0x2a9dcf[_0xbced('0x6b')]=_0x30bcd9;_0x2a9dcf[_0xbced('0x6c')]=_0x362ed8;_0x2a9dcf[_0xbced('0x6d')]=_0x3e06ff[_0xbced('0x6e')];return _0x2a9dcf;}function unlockQueueStatus(_0x3c935d,_0x11a6fe){setTimeout(function(){if(_[_0xbced('0x3a')](_0x3c935d['queueStatusComplete'])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x11a6fe);}_0x3c935d[_0xbced('0x6f')]=!![];loggerBooked[_0xbced('0x45')]('[booked][unlockQueueStatus]',_0x11a6fe,JSON[_0xbced('0x70')](_[_0xbced('0x71')](_0x3c935d,['name',_0xbced('0x6f')])));},0x1f3);}function checkInterval(_0x3d2d0d){return function(){if(!isNotNull(_0x3d2d0d[_0xbced('0x72')])){_0x3d2d0d[_0xbced('0x64')]=utils[_0xbced('0x65')][_0xbced('0x73')];throw _0x3d2d0d[_0xbced('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x3d2d0d[_0xbced('0x72')][_0xbced('0x74')])){_0x3d2d0d[_0xbced('0x64')]=utils[_0xbced('0x65')][_0xbced('0x73')];throw _0x3d2d0d['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xbced('0x44')](_0x3d2d0d['Interval'][_0xbced('0x74')]))){_0x3d2d0d[_0xbced('0x64')]=utils[_0xbced('0x65')]['NULL_INTERVAL'];throw _0x3d2d0d[_0xbced('0x42')]+_0xbced('0x75');}};}function checkIsIVRCampaignActive(_0x2caa20){return function(){if(!utils['isIVRCampaignActive'](_0x2caa20)){_0x2caa20[_0xbced('0x64')]=utils[_0xbced('0x65')]['INACTIVE'];throw _0x2caa20[_0xbced('0x42')]+_0xbced('0x76');}};}function emitCampaignSummary(_0x33a13e){if(utils[_0xbced('0x77')](_0x33a13e)){emit(util[_0xbced('0x41')](_0xbced('0x78'),_0x33a13e[_0xbced('0x42')]),_0xbced('0x79'),_0x33a13e);}}function loggerCatchQueueSummary(_0x498c32,_0x2d2225){return function(_0x536c1d){clearPredictiveAttributes(_0x2d2225);emitCampaignSummary(_0x2d2225);loggerSyncQueueSummary['debug'](_0x498c32,util[_0xbced('0x40')](_0x536c1d,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x152d61){if(_0x152d61['sendMessageOneNotActive']){if(_0x152d61[_0xbced('0x7a')]===0x0){_0x152d61[_0xbced('0x7b')]=![];_0x152d61[_0xbced('0x64')]=utils[_0xbced('0x65')][_0xbced('0x7c')];loggerSyncQueueSummary[_0xbced('0x3e')](_0xbced('0x7d'),_0x152d61[_0xbced('0x42')],'is\x20not\x20active');}else{_0x152d61[_0xbced('0x64')]=utils[_0xbced('0x65')][_0xbced('0x7e')];loggerSyncQueueSummary[_0xbced('0x3e')](_0xbced('0x7d'),_0x152d61[_0xbced('0x42')],_0xbced('0x7f'));}emitCampaignSummary(_0x152d61);}}function myreject(_0x12b6af){return function(_0x1aafc7){return _0x12b6af(msgResponse(_0xbced('0x80'),'Error',JSON['stringify'](_0x1aafc7)));};}Dialer[_0xbced('0x15')][_0xbced('0x81')]=function(_0x3d9e62){return!_[_0xbced('0x3a')](_0x3d9e62)&&_0x3d9e62&&!_['isUndefined'](_0x3d9e62[_0xbced('0x42')])&&!_[_0xbced('0x3a')](_0x3d9e62['active'])&&_0x3d9e62[_0xbced('0x82')]&&(this[_0xbced('0x1e')][util['format'](_0xbced('0x83'),_0x3d9e62[_0xbced('0x42')])][_0xbced('0x84')]==='reachable'||this['trunks'][util[_0xbced('0x41')](_0xbced('0x83'),_0x3d9e62[_0xbced('0x42')])][_0xbced('0x84')]===_0xbced('0x85'));};Dialer['prototype'][_0xbced('0x86')]=function(_0x578b9d){var _0x53d7f2=this;return function(){if(!_0x53d7f2[_0xbced('0x81')](_0x578b9d[_0xbced('0x87')])){if(!_0x53d7f2[_0xbced('0x81')](_0x578b9d[_0xbced('0x88')])){_0x578b9d['message']=utils[_0xbced('0x65')][_0xbced('0x89')];throw _0x578b9d[_0xbced('0x42')]+_0xbced('0x8a');}}};};Dialer[_0xbced('0x15')][_0xbced('0x8b')]=function(_0x38c4c4,_0x62babe,_0x4b7d69,_0x1b0650){var _0x5cb635=this;return function(){var _0x2ae377=!![];return _0x5cb635[_0xbced('0x8c')](_0x38c4c4,_0x62babe,_0x4b7d69,_0x1b0650,_0x2ae377);};};Dialer[_0xbced('0x15')]['checkIfTimeIntervals']=function(_0x33f798,_0x25d53f,_0xf43134,_0x5caf67){var _0x37c905=this;return function(){var _0x3a008a=![];return _0x37c905['ifTimeIvr'](_0x33f798[_0xbced('0x74')],_0x25d53f,_0xf43134,_0x5caf67,_0x3a008a);};};Dialer[_0xbced('0x15')][_0xbced('0x8c')]=function(_0x253b33,_0x2c88e9,_0x493620,_0x32dd37,_0xb50ecf){var _0x500ffc=[];return new Promise(function(_0x1113a6,_0x1a408e){if(!isNotNull(_0x253b33)){_0x32dd37[_0xbced('0x64')]=utils['CAMPAIGN_STATUS'][_0xbced('0x73')];return _0x1a408e(msgResponse('ifTime',_0xbced('0x8d'),_0x493620+_0xbced('0x8e')));}if(_[_0xbced('0x44')](_0x253b33)){_0x32dd37[_0xbced('0x64')]=utils[_0xbced('0x65')][_0xbced('0x8f')];return _0x1a408e(msgResponse('ifTime',_0xbced('0x8d'),_0x493620+_0xbced('0x90')));}if(_0x2c88e9&&_[_0xbced('0x3a')](config[_0xbced('0x91')][_0x2c88e9])){_0x32dd37[_0xbced('0x64')]=utils['CAMPAIGN_STATUS'][_0xbced('0x92')];return _0x1a408e(msgResponse(_0xbced('0x93'),'Failure',_0x493620+_0xbced('0x94')+_0x2c88e9));}if(_[_0xbced('0x95')](_0x253b33)){for(var _0x3d6dc2=0x0;_0x3d6dc2<_0x253b33[_0xbced('0x96')];_0x3d6dc2+=0x1){_0x500ffc[_0xbced('0x97')](ami['Action']({'action':_0xbced('0x98'),'command':util[_0xbced('0x41')](_0xbced('0x99'),_0x253b33[_0x3d6dc2]['interval'],!_[_0xbced('0x3a')](config[_0xbced('0x91')][_0x2c88e9])?_0x2c88e9:'')})[_0xbced('0x9a')](function(_0x33a325){return _0x33a325['content'][_0xbced('0x9b')](_0xbced('0x9c'))>=0x0;})[_0xbced('0x9d')](myreject(_0x1a408e)));}}else{_0x500ffc[_0xbced('0x97')](ami[_0xbced('0x9e')]({'action':'command','command':util[_0xbced('0x41')]('iftime\x20%s,%s',_0x253b33,!_[_0xbced('0x3a')](config[_0xbced('0x91')][_0x2c88e9])?_0x2c88e9:'')})[_0xbced('0x9a')](function(_0x2b2f17){return _0x2b2f17[_0xbced('0x9f')][_0xbced('0x9b')]('true')>=0x0;})[_0xbced('0x9d')](myreject(_0x1a408e)));}Promise[_0xbced('0xa0')](_0x500ffc)[_0xbced('0x9a')](function(_0xd7af5c){var _0x424637=_[_0xbced('0xa1')](_0xd7af5c);if(_0x424637){return _0x1113a6(_0x424637);}else{_0x32dd37[_0xbced('0x64')]=_0xb50ecf?utils['CAMPAIGN_STATUS'][_0xbced('0xa2')]:utils['CAMPAIGN_STATUS'][_0xbced('0xa3')];return _0x1a408e(msgResponse(_0xbced('0xa4'),_0xbced('0x8d'),_0xbced('0xa5')+_0xb50ecf+'\x20'+_0x493620+_0xbced('0xa6')+util[_0xbced('0x40')](_0x253b33,{'showHidden':![],'depth':null})+_0xbced('0xa7')+_0x2c88e9));}})['catch'](function(_0x22a726){return _0x1a408e(msgResponse('ifTime','Failure',JSON['stringify'](_0x22a726)));});});};Dialer[_0xbced('0x15')][_0xbced('0x39')]=function(){var _0x7836b3=this;return cmHopper[_0xbced('0xa8')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x7836b3[_0xbced('0xa9')]();},0x3e8);});};Dialer[_0xbced('0x15')]['syncCampaigns']=function(){var _0x3f78ce=this;var _0xb7fbf4;for(var _0x1a2951 in this[_0xbced('0x1c')]){if(typeof this['campaigns'][_0x1a2951]!==_0xbced('0xaa')){_0xb7fbf4=this[_0xbced('0x1c')][_0x1a2951];if(utils['isIVRCampaign'](_0xb7fbf4)&&utils[_0xbced('0xab')](_0xb7fbf4)){_0xb7fbf4[_0xbced('0x7b')]=!![];Promise[_0xbced('0xac')]()[_0xbced('0x9a')](checkIsIVRCampaignActive(_0xb7fbf4))[_0xbced('0x9a')](checkInterval(_0xb7fbf4))[_0xbced('0x9a')](_0x3f78ce['checkIsTrunkReachable'](_0xb7fbf4))['then'](_0x3f78ce[_0xbced('0x8b')](_0xb7fbf4[_0xbced('0xad')],_0xb7fbf4[_0xbced('0xae')],_0xb7fbf4[_0xbced('0x42')],_0xb7fbf4))[_0xbced('0x9a')](_0x3f78ce[_0xbced('0xaf')](_0xb7fbf4['Interval'],_0xb7fbf4[_0xbced('0xae')],_0xb7fbf4[_0xbced('0x42')],_0xb7fbf4))[_0xbced('0x9a')](_0x3f78ce[_0xbced('0xb0')](_0xb7fbf4))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0xb7fbf4));}else{notSendMessagesCampaign(_0xb7fbf4);}}}};Dialer[_0xbced('0x15')][_0xbced('0xb1')]=function(_0x26fd1e){if(_0x26fd1e[_0xbced('0xb2')]!==_0xbced('0xb3')){clearPredictiveAttributes(_0x26fd1e);}switch(_0x26fd1e[_0xbced('0xb2')]){case _0xbced('0xb4'):this[_0xbced('0xb5')](_0x26fd1e,0x1);break;case _0xbced('0xb6'):this['handlePower'](_0x26fd1e,_0x26fd1e[_0xbced('0xb7')]);break;case _0xbced('0xb3'):this[_0xbced('0xb3')](_0x26fd1e);break;case _0xbced('0x6'):this[_0xbced('0xb5')](_0x26fd1e,0x1);break;default:logger[_0xbced('0x61')](_0xbced('0xb8'),_0x26fd1e[_0xbced('0x42')],_0xbced('0xb9'));}};Dialer[_0xbced('0x15')][_0xbced('0x93')]=function(_0x56e2a1,_0x5bfa4a){var _0xd7225d=_0x56e2a1[_0xbced('0xae')];var _0x426141=_0x5bfa4a?_0x56e2a1[_0xbced('0xad')]:_0x56e2a1[_0xbced('0x72')]['Intervals'];logger['silly'](_0xbced('0xba'),_0x426141,_0xd7225d,_0x56e2a1['name'],util['format']('Voice\x20Queue\x20%s\x20$s',_0x56e2a1['name'],_0x56e2a1['id']));var _0xe9660a=null;return Interval[_0xbced('0xbb')](_0x426141,_0xd7225d)[_0xbced('0x9a')](function(_0x11ea8e){if(_0x11ea8e===!![]){return _0x11ea8e;}else{_0x56e2a1[_0xbced('0x64')]=_0x5bfa4a?utils[_0xbced('0x65')][_0xbced('0xa2')]:utils[_0xbced('0x65')]['OVERTIME_INTERVAL'];_0xe9660a=msgResponse(_0xbced('0xa4'),_0xbced('0x8d'),_0xbced('0xa5')+_0x5bfa4a+'\x20'+_0x56e2a1[_0xbced('0x42')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0xbced('0x40')](_0x426141,{'showHidden':![],'depth':null})+_0xbced('0xa7')+_0xd7225d);}if(_0xe9660a!==null){logger[_0xbced('0xbc')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0xe9660a);_0xe9660a['isGlobal']=_0x5bfa4a;throw _0xe9660a;}})[_0xbced('0x9d')](function(_0xaf694b){logger[_0xbced('0x61')](_0xbced('0xbd'),_0xaf694b);throw msgResponse(_0xbced('0x80'),'Error',util['inspect'](_0xaf694b,{'showHidden':![],'depth':null}));});};Dialer[_0xbced('0x15')]['syncAgentConnect']=function(_0x339f96){if(this[_0xbced('0x1b')][_0x339f96[_0xbced('0xbe')]]){if(this[_0xbced('0x23')][_0x339f96[_0xbced('0xbf')]]&&this[_0xbced('0x23')][_0x339f96[_0xbced('0xbf')]][_0xbced('0x3c')]!==_0xbced('0xc0')){this[_0xbced('0xc1')](this[_0xbced('0x1b')][_0x339f96['queue']]);this[_0xbced('0x23')][_0x339f96[_0xbced('0xbf')]][_0xbced('0xc2')]=moment()[_0xbced('0x41')](_0xbced('0xc3'));}}};Dialer['prototype'][_0xbced('0xc4')]=function(_0x8065a4){var _0x3a2d97=this[_0xbced('0x23')][_0x8065a4[_0xbced('0xbf')]];if(this['voiceQueues'][_0x8065a4[_0xbced('0xbe')]]){if(_0x3a2d97&&_0x3a2d97['type']!==_0xbced('0xc0')){delete this[_0xbced('0x23')][_0x8065a4[_0xbced('0xbf')]];this[_0xbced('0x1b')][_0x8065a4[_0xbced('0xbe')]][_0xbced('0xc5')]+=0x1;var _0x15e440=new AgentComplete(_0x3a2d97,_0x8065a4);if(_0x8065a4[_0xbced('0xc6')]===_0xbced('0xc7')){_0x15e440['agiafterat']=this[_0xbced('0x1b')][_0x8065a4[_0xbced('0xbe')]][_0xbced('0xc8')]&&this['voiceQueues'][_0x8065a4[_0xbced('0xbe')]][_0xbced('0xc9')]?moment()['format'](_0xbced('0xc3')):undefined;}hopperUtils[_0xbced('0xca')](_0x15e440)[_0xbced('0x9d')](loggerCatch(_0xbced('0xcb')));hopperUtils[_0xbced('0xcc')](_0x15e440)[_0xbced('0x9d')](loggerCatch(_0xbced('0xcd')));}}};Dialer[_0xbced('0x15')][_0xbced('0xce')]=function(_0x59920a){var _0x33a07b=this['uniqueId'][_0x59920a[_0xbced('0xbf')]];var _0x298a68=this;var _0x597c08=![];var _0x1d82a2;var _0x68bbe9;if(this['voiceQueues'][_0x59920a[_0xbced('0xbe')]]){if(_0x33a07b&&_0x33a07b[_0xbced('0x3c')]!==_0xbced('0xc0')){delete this[_0xbced('0x23')][_0x59920a[_0xbced('0xbf')]];this[_0xbced('0xc1')](this[_0xbced('0x1b')][_0x59920a[_0xbced('0xbe')]]);_0x33a07b['droptime']=moment()[_0xbced('0x41')](_0xbced('0xc3'));var _0x487b61=new QueueCallerAbandon(_0x33a07b,_0x59920a);if(utils[_0xbced('0x5c')](_0x33a07b[_0xbced('0xcf')],_0x33a07b[_0xbced('0xd0')])>=_0x33a07b[_0xbced('0xd1')]){this[_0xbced('0x1b')][_0x59920a[_0xbced('0xbe')]][_0xbced('0x4a')]+=0x1;this[_0xbced('0x1b')][_0x59920a[_0xbced('0xbe')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x59920a['queue']][_0xbced('0xd2')]+=0x1;_0x487b61[_0xbced('0x6b')]=0xa;_0x487b61['statedesc']=_0xbced('0xd3');_0x487b61['dropreason']='TIMEOUT';_0x487b61[_0xbced('0xd4')]=this[_0xbced('0x1b')][_0x59920a[_0xbced('0xbe')]][_0xbced('0xc8')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x487b61[_0xbced('0xd5')]+=0x1;_0x487b61[_0xbced('0xd6')]+=0x1;_0x1d82a2=this[_0xbced('0x1b')][_0x59920a[_0xbced('0xbe')]][_0xbced('0xd7')];_0x68bbe9=this['voiceQueues'][_0x59920a['queue']][_0xbced('0xd8')];hopperUtils[_0xbced('0xd9')](_0x487b61,_0x487b61[_0xbced('0x6b')],_0x33a07b['voiceQueue'])['then'](function(_0x4f7881){_0x597c08=_0x4f7881[_0xbced('0xda')]==0x1;if(_0x487b61['countdropretry']>=_0x298a68[_0xbced('0x1b')][_0x59920a[_0xbced('0xbe')]][_0xbced('0xdb')]){_0x298a68[_0xbced('0xdc')](_0x487b61,_0x4f7881[_0xbced('0xda')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x487b61[_0xbced('0xd5')],'scheduledat':moment()[_0xbced('0xdd')](_0x298a68[_0xbced('0x1b')][_0x59920a[_0xbced('0xbe')]][_0xbced('0xd7')],_0xbced('0xde'))[_0xbced('0x41')](_0xbced('0xc3')),'ContactId':_0x33a07b[_0xbced('0xdf')],'ListId':_0x33a07b[_0xbced('0xe0')],'VoiceQueueId':_0x33a07b[_0xbced('0xe1')]||undefined,'CampaignId':_0x33a07b[_0xbced('0xe2')]||undefined})['catch'](loggerCatch(_0xbced('0xe3')));var _0x4f7498=new History(_0x487b61);_0x4f7498[_0xbced('0x6b')]=0xa;_0x4f7498[_0xbced('0x6c')]='Drop';_0x4f7498[_0xbced('0x6e')]=moment()[_0xbced('0x41')](_0xbced('0xc3'));_0x4f7498['endtime']=_0x4f7498[_0xbced('0x6e')];_0x4f7498[_0xbced('0xe4')]=_0x487b61[_0xbced('0xe4')];_0x4f7498[_0xbced('0xe5')]=_0x487b61[_0xbced('0xe5')];hopperUtils[_0xbced('0xca')](_0x4f7498)[_0xbced('0x9d')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xbced('0x9a')](function(){if(_0x597c08)hopperUtils[_0xbced('0xe6')](_0x487b61,_0x1d82a2,_0x68bbe9)[_0xbced('0x9a')](function(){return 0x1;});});}else{this['voiceQueues'][_0x59920a[_0xbced('0xbe')]][_0xbced('0x4b')]+=0x1;this['voiceQueues'][_0x59920a[_0xbced('0xbe')]][_0xbced('0xe7')]+=0x1;_0x487b61['state']=0xb;_0x487b61[_0xbced('0x6c')]='Abandoned';_0x487b61[_0xbced('0xe8')]=_0xbced('0xe9');_0x487b61['countabandonedretry']+=0x1;_0x487b61['countglobal']+=0x1;_0x1d82a2=this[_0xbced('0x1b')][_0x59920a['queue']]['dialAbandonedRetryFrequency'];_0x68bbe9=this['voiceQueues'][_0x59920a[_0xbced('0xbe')]][_0xbced('0xd8')];hopperUtils['verifyAdditionalPhones'](_0x487b61,_0x487b61[_0xbced('0x6b')],_0x33a07b['voiceQueue'])[_0xbced('0x9a')](function(_0x52a1c5){if(_0x487b61[_0xbced('0xea')]>=_0x298a68['voiceQueues'][_0x59920a[_0xbced('0xbe')]]['dialAbandonedMaxRetry']){_0x298a68['queueCallerAbandonCreateState'](_0x487b61,_0x52a1c5[_0xbced('0xda')]);}else{hopperUtils[_0xbced('0xeb')]({'active':![],'countabandonedretry':_0x487b61[_0xbced('0xea')],'scheduledat':moment()[_0xbced('0xdd')](_0x298a68[_0xbced('0x1b')][_0x59920a[_0xbced('0xbe')]]['dialAbandonedRetryFrequency'],_0xbced('0xde'))[_0xbced('0x41')](_0xbced('0xc3')),'ContactId':_0x33a07b[_0xbced('0xdf')],'ListId':_0x33a07b['ListId'],'VoiceQueueId':_0x33a07b['VoiceQueueId']||undefined,'CampaignId':_0x33a07b[_0xbced('0xe2')]||undefined})['catch'](loggerCatch(_0xbced('0xec')));var _0xcdac23=new History(_0x487b61);_0xcdac23[_0xbced('0x6b')]=0xb;_0xcdac23[_0xbced('0x6c')]=_0xbced('0xed');_0xcdac23['starttime']=moment()[_0xbced('0x41')](_0xbced('0xc3'));_0xcdac23[_0xbced('0x6d')]=_0xcdac23['starttime'];_0xcdac23[_0xbced('0xe4')]=_0x487b61[_0xbced('0xe4')];_0xcdac23[_0xbced('0xe5')]=_0x487b61['calleridnum'];hopperUtils[_0xbced('0xca')](_0xcdac23)[_0xbced('0x9d')](loggerCatch(_0xbced('0xee')));}})['then'](function(){if(_0x597c08)hopperUtils[_0xbced('0xe6')](_0x487b61,_0x1d82a2,_0x68bbe9)[_0xbced('0x9a')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xbced('0x33')]=function(_0x4d327c){if(this[_0xbced('0x21')][_0x4d327c[_0xbced('0xbf')]]){this['actions'][_0x4d327c[_0xbced('0xbf')]][_0xbced('0xef')]=_0x4d327c[_0xbced('0xef')];}if(this[_0xbced('0x23')][_0x4d327c[_0xbced('0xbf')]]){this[_0xbced('0x23')][_0x4d327c[_0xbced('0xbf')]][_0xbced('0xef')]=_0x4d327c[_0xbced('0xef')];}};Dialer[_0xbced('0x15')][_0xbced('0x36')]=function(_0x1b9c58){if(!this['actions'][_0x1b9c58['actionid']]){return;}var _0x5135a2=this[_0xbced('0x1b')][this[_0xbced('0x21')][_0x1b9c58[_0xbced('0xf0')]]['queue']][_0xbced('0xf1')]||_0xbced('0xf2');if(_0x5135a2===_0xbced('0xf3')){if(this[_0xbced('0x21')][_0x1b9c58['actionid']]&&_[_0xbced('0xf4')](this[_0xbced('0x21')][_0x1b9c58[_0xbced('0xf0')]][_0xbced('0xf5')])&&_0x1b9c58[_0xbced('0x84')]==='1'&&_0x1b9c58['paused']==='0'){if(this[_0xbced('0x1d')][_0x1b9c58[_0xbced('0xf6')]]){if(!this[_0xbced('0x1d')][_0x1b9c58[_0xbced('0xf6')]][_0xbced('0xf5')]){this[_0xbced('0x1d')][_0x1b9c58[_0xbced('0xf6')]][_0xbced('0xf5')]=!![];this[_0xbced('0x21')][_0x1b9c58[_0xbced('0xf0')]][_0xbced('0xf5')]=!![];this[_0xbced('0x21')][_0x1b9c58[_0xbced('0xf0')]]['stateinterface']=_0x1b9c58['stateinterface'];}}}}else if(_0x5135a2==='rrmemory'){if(this['actions'][_0x1b9c58[_0xbced('0xf0')]]){if(this[_0xbced('0x1d')][_0x1b9c58[_0xbced('0xf6')]]){this[_0xbced('0x21')][_0x1b9c58[_0xbced('0xf0')]][_0xbced('0xf6')]=_0x1b9c58[_0xbced('0xf6')];if(_['isNil'](this[_0xbced('0x28')][this['actions'][_0x1b9c58[_0xbced('0xf0')]][_0xbced('0xbe')]])){this[_0xbced('0x28')][this[_0xbced('0x21')][_0x1b9c58['actionid']][_0xbced('0xbe')]]=[];}this[_0xbced('0x28')][this['actions'][_0x1b9c58[_0xbced('0xf0')]][_0xbced('0xbe')]][_0xbced('0x97')](_[_0xbced('0x5b')](_[_0xbced('0x71')](this[_0xbced('0x21')][_0x1b9c58[_0xbced('0xf0')]],['idHopper',_0xbced('0xf6')]),{'status':_0x1b9c58['status'],'paused':_0x1b9c58[_0xbced('0xf7')]}));}}}};Dialer[_0xbced('0x15')][_0xbced('0x38')]=function(_0x591220){if(!this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]]){return;}var _0x1497f0=this;var _0x3f0de5=this[_0xbced('0x1b')][this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]][_0xbced('0xbe')]];var _0x8d4631=_0x3f0de5[_0xbced('0xf1')]||_0xbced('0xf2');if(_0x8d4631===_0xbced('0xf3')){if(this['actions'][_0x591220['actionid']]&&this[_0xbced('0x21')][_0x591220['actionid']][_0xbced('0xf6')]){this[_0xbced('0x1a')][_0xbced('0xf8')](this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]][_0xbced('0xf9')],this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]]['stateinterface'])[_0xbced('0x9d')](function(_0x209515){logger[_0xbced('0x61')](_0xbced('0xfa'),util[_0xbced('0x40')](_0x209515,{'showHidden':![],'depth':null}));})['finally'](function(){_0x1497f0[_0xbced('0xc1')](_0x1497f0[_0xbced('0x1b')][_0x1497f0[_0xbced('0x21')][_0x591220['actionid']][_0xbced('0xbe')]]);_0x1497f0['agents'][_0x1497f0[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]][_0xbced('0xf6')]][_0xbced('0xf5')]=![];delete _0x1497f0[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]];unlockQueueStatus(_0x3f0de5);});}else{this[_0xbced('0xc1')](this['voiceQueues'][this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]][_0xbced('0xbe')]]);hopperUtils[_0xbced('0xeb')]({'active':![],'ContactId':this['actions'][_0x591220[_0xbced('0xf0')]][_0xbced('0xdf')],'ListId':this[_0xbced('0x21')][_0x591220['actionid']][_0xbced('0xe0')],'VoiceQueueId':this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]][_0xbced('0xe1')]||undefined,'CampaignId':this['actions'][_0x591220[_0xbced('0xf0')]][_0xbced('0xe2')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]];unlockQueueStatus(_0x3f0de5);}}else if(_0x8d4631===_0xbced('0xf2')){var _0x1793c8;if(this['actions'][_0x591220[_0xbced('0xf0')]]&&!_[_0xbced('0x44')](this[_0xbced('0x28')][this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]][_0xbced('0xbe')]])){if(this[_0xbced('0xfb')][_0x1497f0[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]][_0xbced('0xbe')]]){this['queueBookedRR'][_0x1497f0[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]]['queue']]=this['queueBookedRR'][this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]]['queue']]?this['queueBookedRR'][this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]][_0xbced('0xbe')]]:this[_0xbced('0x28')][this['actions'][_0x591220[_0xbced('0xf0')]][_0xbced('0xbe')]]?this[_0xbced('0x28')][this[_0xbced('0x21')][_0x591220[_0xbced('0xf0')]][_0xbced('0xbe')]][_0xbced('0xfc')]||0x0:0x0;}this[_0xbced('0x28')][this['actions'][_0x591220[_0xbced('0xf0')]][_0xbced('0xbe')]]['_rr']=this[_0xbced('0xfb')][this[_0xbced('0x21')][_0x591220['actionid']]['queue']];for(var _0x4a9433=0x0;_0x4a9433=_0xf891bf[_0xbced('0x122')]){_0xaa3f77[_0xbced('0x123')](_0x404615,_0x28dc0b,_0x3c31bd,'reason19\x20machine....');}else{if(_0x404615[_0xbced('0x11b')]>=_0xf891bf[_0xbced('0x124')]){_0xaa3f77[_0xbced('0x125')](_0x404615,_0x28dc0b,_0x3c31bd,_0xbced('0x126'));}else{hopperUtils[_0xbced('0xeb')]({'active':![],'countmachineretry':_0x404615[_0xbced('0x11b')],'scheduledat':moment()[_0xbced('0xdd')](_0xf891bf['dialMachineRetryFrequency'],_0xbced('0xde'))['format'](_0xbced('0xc3')),'ContactId':_0x404615['ContactId'],'ListId':_0x404615[_0xbced('0xe0')],'VoiceQueueId':_0x404615[_0xbced('0xe1')]||undefined,'CampaignId':_0x404615[_0xbced('0xe2')]||undefined})[_0xbced('0x9d')](loggerCatch(_0xbced('0x127')));_0x28dc0b({'reschedule':0x1});}}});}if(_0x46db69[_0xbced('0x3c')]===_0xbced('0xc0')&&this[_0xbced('0x1c')][_0x46db69[_0xbced('0xbe')]][_0xbced('0x10e')]&&_0x172361[_0xbced('0x118')]===_0xbced('0x10f')){delete this[_0xbced('0x23')][_0x172361['uniqueid']];this[_0xbced('0xc1')](this[_0xbced('0x1c')][_0x46db69['queue']]);_0x575650=new Hangup(_0x46db69,_0x172361);_0x575650[_0xbced('0x6b')]=0x12;_0x575650['statedesc']=_0xbced('0x128');_0x575650[_0xbced('0x111')]=_0xbced('0x112');ami[_0xbced('0x3b')]('custom:amd',ut[_0xbced('0x114')](_0x575650,_0xbced('0x115')));this[_0xbced('0x129')](_0x575650,_0xbced('0x12a'),_0xbced('0x12b'));}if(_0x46db69['type']===_0xbced('0xc0')&&this[_0xbced('0x1c')][_0x46db69[_0xbced('0xbe')]][_0xbced('0x10e')]&&_0x172361[_0xbced('0x118')]===_0xbced('0x119')){return new Promise(function(_0xf3f795,_0x384de7){delete _0xaa3f77[_0xbced('0x23')][_0x172361[_0xbced('0xbf')]];_0xaa3f77[_0xbced('0xc1')](_0xaa3f77[_0xbced('0x1c')][_0x46db69['queue']]);_0xaa3f77[_0xbced('0x1c')][_0x46db69['queue']]['outboundAnswerCallsDay']+=0x1;_0xaa3f77['campaigns'][_0x46db69[_0xbced('0xbe')]][_0xbced('0x110')]+=0x1;var _0xc68198=_0xaa3f77[_0xbced('0x1c')][_0x46db69[_0xbced('0xbe')]];var _0x259201=new Hangup(_0x46db69,_0x172361);_0x259201[_0xbced('0x6b')]=0x13;_0x259201['statedesc']='Machine';_0x259201['membername']=_0xbced('0x112');_0x259201[_0xbced('0x11b')]+=0x1;_0x259201['countglobal']+=0x1;_0x259201[_0xbced('0x115')]=!![];ami[_0xbced('0x3b')]('custom:amd',ut['buildObj'](_0x259201,_0xbced('0x115')));hopperUtils['createHistory'](_0x259201)[_0xbced('0x9d')](loggerCatch(_0xbced('0x11c')));if(_0x259201['countbusyretry']+_0x259201['countcongestionretry']+_0x259201['countnoanswerretry']+_0x259201['countnosuchnumberretry']+_0x259201['countdropretry']+_0x259201[_0xbced('0xea')]+_0x259201['countmachineretry']+_0x259201[_0xbced('0x121')]>=_0xc68198[_0xbced('0x122')]){_0xaa3f77[_0xbced('0x123')](_0x259201,_0xf3f795,_0x384de7,_0xbced('0x12c'));}else{if(_0x259201['countmachineretry']>=_0xc68198[_0xbced('0x124')]){_0xaa3f77[_0xbced('0x125')](_0x259201,_0xf3f795,_0x384de7,_0xbced('0x126'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x259201[_0xbced('0x11b')],'scheduledat':moment()['add'](_0xc68198[_0xbced('0x12d')],_0xbced('0xde'))[_0xbced('0x41')](_0xbced('0xc3')),'ContactId':_0x259201[_0xbced('0xdf')],'ListId':_0x259201[_0xbced('0xe0')],'VoiceQueueId':_0x259201[_0xbced('0xe1')]||undefined,'CampaignId':_0x259201[_0xbced('0xe2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0xf3f795({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xbced('0x12e')]=function(_0x159a2c){var _0xac4535=this[_0xbced('0x23')][_0x159a2c[_0xbced('0xbf')]];var _0x5bc38b;if(_0xac4535&&_0xac4535[_0xbced('0x3c')]===_0xbced('0xc0')){delete this[_0xbced('0x23')][_0x159a2c[_0xbced('0xbf')]];this[_0xbced('0xc1')](this[_0xbced('0x1c')][_0xac4535[_0xbced('0xbe')]]);this['campaigns'][_0xac4535[_0xbced('0xbe')]][_0xbced('0x12f')]+=0x1;_0x5bc38b=new Hangup(_0xac4535,_0x159a2c);hopperUtils[_0xbced('0xca')](_0x5bc38b)[_0xbced('0x9d')](loggerCatch(_0xbced('0x130')));hopperUtils[_0xbced('0xcc')](_0x5bc38b)[_0xbced('0x9d')](loggerCatch(_0xbced('0x131')));}if(_0xac4535&&_0xac4535[_0xbced('0x3c')]!==_0xbced('0xc0')&&isNotNull(this['voiceQueues'][_0xac4535['queue']]['dialQueueProject'])){delete this[_0xbced('0x23')][_0x159a2c[_0xbced('0xbf')]];this[_0xbced('0xc1')](this[_0xbced('0x1b')][_0xac4535[_0xbced('0xbe')]]);this[_0xbced('0x1b')][_0xac4535[_0xbced('0xbe')]]['outboundAnswerCallsDay']+=0x1;this[_0xbced('0x1b')][_0xac4535[_0xbced('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;_0x5bc38b=new Hangup(_0xac4535,_0x159a2c);_0x5bc38b[_0xbced('0x6b')]=0x10;_0x5bc38b[_0xbced('0x6c')]='AnswerAGI';_0x5bc38b['membername']='AGI';hopperUtils[_0xbced('0xca')](_0x5bc38b)[_0xbced('0x9d')](loggerCatch(_0xbced('0x130')));hopperUtils[_0xbced('0xcc')](_0x5bc38b)['catch'](loggerCatch(_0xbced('0x131')));}if(_0xac4535&&_0xac4535[_0xbced('0x3c')]!=='ivr'&&!isNotNull(this[_0xbced('0x1b')][_0xac4535[_0xbced('0xbe')]]['dialQueueProject'])){delete this[_0xbced('0x23')][_0x159a2c[_0xbced('0xbf')]];this[_0xbced('0xc1')](this[_0xbced('0x1b')][_0xac4535[_0xbced('0xbe')]]);this['voiceQueues'][_0xac4535[_0xbced('0xbe')]][_0xbced('0x132')]+=0x1;_0x5bc38b=new Hangup(_0xac4535,_0x159a2c);_0x5bc38b[_0xbced('0x6b')]=0xc;_0x5bc38b['statedesc']=_0x159a2c[_0xbced('0x133')];_0x5bc38b[_0xbced('0x111')]='Unknow';hopperUtils[_0xbced('0xca')](_0x5bc38b)[_0xbced('0x9d')](loggerCatch(_0xbced('0x130')));hopperUtils['moveContactManagedDialer'](_0x5bc38b)[_0xbced('0x9d')](loggerCatch(_0xbced('0x131')));}};Dialer['prototype']['syncQueueSummary']=function(_0x14e952){var _0x24a483=this;if(!_0x24a483[_0xbced('0x29')][_0x14e952['name']]){_0x24a483['queuesSummary'][_0x14e952['name']]={'running':![]};}else if(_0x24a483[_0xbced('0x29')][_0x14e952['name']][_0xbced('0x134')]===!![]){return;}else if(_0x24a483[_0xbced('0x29')][_0x14e952[_0xbced('0x42')]][_0xbced('0x134')]===![]){_0x24a483[_0xbced('0x29')][_0x14e952[_0xbced('0x42')]]['running']=!![];}var _0x2562b4=_0x24a483[_0xbced('0x1b')][_0x14e952[_0xbced('0x42')]];var _0x19d1f6=_0x2562b4[_0xbced('0x64')]!==utils[_0xbced('0x65')][_0xbced('0x7c')];var _0x3d3f42=utils['isPreviewCampaign'](_0x2562b4);_0x2562b4[_0xbced('0x135')]=utils['getQueueCampaignStatusMessage'](_0x2562b4,_0x24a483['trunks']);Promise['resolve']()[_0xbced('0x9a')](function(){if(_0x2562b4[_0xbced('0x135')]===utils[_0xbced('0x65')][_0xbced('0x7c')]){if(_0x19d1f6){clearPredictiveAttributes(_0x2562b4);_0x14e952[_0xbced('0x25')]=undefined;_0x14e952[_0xbced('0x26')]=undefined;}if(_0x2562b4['statusMessage']===utils[_0xbced('0x65')][_0xbced('0x7c')]){_0x14e952[_0xbced('0x136')]=0x0;_0x14e952[_0xbced('0xf7')]=0x0;_0x14e952['inUse']=0x0;_0x14e952[_0xbced('0x137')]=0x0;_0x14e952[_0xbced('0x138')]=0x0;}}else if(_0x2562b4[_0xbced('0x135')]===utils[_0xbced('0x65')][_0xbced('0x139')]&&!_0x3d3f42){return _0x24a483[_0xbced('0x93')](_0x2562b4,!![])['then'](function(){return _0x24a483[_0xbced('0x93')](_0x2562b4,![]);})[_0xbced('0x9a')](function(){return _0x24a483[_0xbced('0xb1')](_0x2562b4);})[_0xbced('0x9d')](function(_0x468990){loggerSyncQueueSummary[_0xbced('0x3e')](_0xbced('0x13a'),util[_0xbced('0x40')](_0x468990,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2562b4);});}else{clearPredictiveAttributes(_0x2562b4);}})[_0xbced('0x9a')](function(){var _0x1f51f9=_0x14e952[_0xbced('0x13b')](_0x2562b4);if(_0x1f51f9||_0x2562b4[_0xbced('0x13c')]){_0x2562b4['queueSummaryCountersUpdated']=![];_0x14e952[_0xbced('0x13d')](_0x2562b4);Object[_0xbced('0x13e')](_0x2562b4,_0x14e952);emitOutboundVoiceQueueSummary(_0x14e952);}_0x24a483[_0xbced('0x29')][_0x2562b4[_0xbced('0x42')]][_0xbced('0x134')]=![];})[_0xbced('0x9d')](function(_0x496e61){logger[_0xbced('0x61')](_0xbced('0x13a'),util[_0xbced('0x40')](_0x496e61,{'showHidden':![],'depth':null}));_0x24a483[_0xbced('0x29')][_0x2562b4['name']][_0xbced('0x134')]=![];});};Dialer[_0xbced('0x15')][_0xbced('0x30')]=_[_0xbced('0x13f')](function(){var _0x572155=_[_0xbced('0x140')](this[_0xbced('0x1b')],function(_0x117929){return _0x117929[_0xbced('0x141')];});var _0x446a0f=_['filter'](this['agents'],function(_0xc3c6ec){return _0xc3c6ec[_0xbced('0x142')]&&_0xc3c6ec['status']===_0xbced('0x143');});if(_0x572155['length']>0x0&&_0x446a0f[_0xbced('0x96')]>0x0){return Promise[_0xbced('0xac')]()[_0xbced('0x9a')](cmHopper[_0xbced('0x144')](_[_0xbced('0x145')](_0x572155,'id'),previewRecallmeReminderInterval,_[_0xbced('0x145')](_0x446a0f,'id')))[_0xbced('0x9a')](function(_0x4bf6bf){for(var _0x33812a=0x0;_0x33812a<_0x4bf6bf['length'];_0x33812a++){var _0x5b2fca=_0x4bf6bf[_0x33812a][_0xbced('0x146')][_0xbced('0x42')];if(_0x5b2fca)io['to'](util[_0xbced('0x41')](_0xbced('0x147'),_0x5b2fca))[_0xbced('0x3b')](_0xbced('0x148'),{'hopper':_0x4bf6bf[_0x33812a]});}})[_0xbced('0x9d')](function(_0x21fb9e){logger[_0xbced('0x61')](_0xbced('0x149'),_0x21fb9e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xbced('0x15')][_0xbced('0x14a')]=function(){var _0x516c09=this;setInterval(function(){_0x516c09[_0xbced('0x14b')](_0x516c09[_0xbced('0x23')],_0xbced('0x14c'));_0x516c09[_0xbced('0x14b')](_0x516c09['actions'],'[actions]');},0x32c8);};Dialer[_0xbced('0x15')][_0xbced('0x14b')]=function(_0x52e6b0,_0xd0b248){var _0x1496c7=this;for(var _0x3e03ac in _0x52e6b0){if(typeof _0x52e6b0[_0x3e03ac]!==_0xbced('0xaa')){this[_0xbced('0x19')][_0xbced('0x16')](function(){if(!_[_0xbced('0xf4')](_0x52e6b0[_0x3e03ac])){return ami['Action']({'action':'status','channel':_0x52e6b0[_0x3e03ac][_0xbced('0xef')]})[_0xbced('0x9d')](function(_0x12563d){if(_0x12563d[_0xbced('0x64')]===_0xbced('0x14d')){setTimeout(function(){if(_0x52e6b0[_0x3e03ac]&&_0x52e6b0[_0x3e03ac][_0xbced('0x3c')]!==_0xbced('0xc0')){_0x1496c7['updateOriginated'](_0x1496c7[_0xbced('0x1b')][_0x52e6b0[_0x3e03ac][_0xbced('0xbe')]]);logger[_0xbced('0x61')]('[Dialer][checkChannel]',_0xd0b248,_0x3e03ac,_0x52e6b0[_0x3e03ac][_0xbced('0xbe')]);delete _0x52e6b0[_0x3e03ac];}if(_0x52e6b0[_0x3e03ac]&&_0x52e6b0[_0x3e03ac][_0xbced('0x3c')]===_0xbced('0xc0')){_0x1496c7[_0xbced('0xc1')](_0x1496c7[_0xbced('0x1c')][_0x52e6b0[_0x3e03ac][_0xbced('0xbe')]]);logger[_0xbced('0x61')](_0xbced('0x14e'),_0xd0b248,_0x3e03ac,_0x52e6b0[_0x3e03ac][_0xbced('0xbe')]);delete _0x52e6b0[_0x3e03ac];}},0x2328);}});}});}}};Dialer[_0xbced('0x15')][_0xbced('0x14f')]=function(_0x319676){return Promise[_0xbced('0xac')]()[_0xbced('0x9a')](voiceQueueRt[_0xbced('0x14f')](_0x319676))[_0xbced('0x9d')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xbced('0x15')]['updateOriginated']=function(_0x11dc9c){if(!_[_0xbced('0x3a')](_0x11dc9c)&&_0x11dc9c!==null){if(typeof _0x11dc9c[_0xbced('0x7a')]!=='undefined'){if(_0x11dc9c[_0xbced('0x7a')]>0x0){_0x11dc9c['originated']-=0x1;}else{logger[_0xbced('0x61')](_0xbced('0x150'));}}}else{logger['error'](_0xbced('0x151'));}};Dialer[_0xbced('0x15')]['loggerHandler']=function(_0x45d7b1,_0x3f94ff){var _0x33ce1f=this;return function(_0x46484f){_0x33ce1f[_0xbced('0xc1')](_0x3f94ff);logger[_0xbced('0x61')](_0x45d7b1,util[_0xbced('0x40')](_0x46484f,{'showHidden':![],'depth':null}));};};Dialer[_0xbced('0x15')][_0xbced('0x152')]=function(_0x17531d,_0x42a90d,_0xf5fa5f){var _0x13616f={'state':0x19,'statedesc':_0xbced('0x153')};this[_0xbced('0xc1')](_0x42a90d);this[_0xbced('0x129')](_[_0xbced('0x5b')](_0x13616f,_[_0xbced('0x71')](_0xf5fa5f,[_0xbced('0xdf'),_0xbced('0xe0'),_0xbced('0x154'),_0xbced('0xe1'),'CampaignId'])),_0xbced('0x155'),_0xbced('0x156'));logger[_0xbced('0x61')](_0x17531d);};Dialer[_0xbced('0x15')][_0xbced('0x129')]=function(_0x434954,_0x5ecec5,_0x4e043c){hopperUtils[_0xbced('0xca')](_0x434954)[_0xbced('0x9d')](loggerCatch(_0x5ecec5));hopperUtils[_0xbced('0xcc')](_0x434954)[_0xbced('0x9d')](loggerCatch(_0x4e043c));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x185a30,_0x2f075e){hopperUtils[_0xbced('0xca')](_0x185a30)[_0xbced('0x9d')](loggerCatch(_0xbced('0xcb')));if(_0x2f075e==0x0){hopperUtils[_0xbced('0xcc')](_0x185a30)['catch'](loggerCatch(_0xbced('0x157')));}};Dialer[_0xbced('0x15')][_0xbced('0x149')]=function(_0x4640a1){return Promise[_0xbced('0xac')]()['then'](cmHopper[_0xbced('0x144')](_0x4640a1['id'],previewRecallmeReminderInterval))[_0xbced('0x9a')](function(_0x136f53){for(var _0x138710=0x0;_0x138710<_0x136f53['length'];_0x138710++){var _0x19a02b=_0x136f53[_0x138710][_0xbced('0x146')][_0xbced('0x42')];if(_0x19a02b)io['to'](util[_0xbced('0x41')](_0xbced('0x147'),_0x19a02b))['emit'](_0xbced('0x148'),{'hopper':_0x136f53[_0x138710]});}})[_0xbced('0x9d')](function(){});};Dialer[_0xbced('0x15')][_0xbced('0xb0')]=function(_0x5ad577){var _0x271e77=this;return function(){_0x271e77[_0xbced('0x158')](_0x5ad577);};};Dialer[_0xbced('0x15')][_0xbced('0x159')]=function(_0x27593a,_0x23eaf0){var _0x503efa=this;var _0x15b178=uuid['v4']();this['actions'][_0x15b178]=new Action(_0x27593a,_0x23eaf0,_0x15b178);return new Promise(function(_0x4100d5,_0x12ae49){if(_[_0xbced('0x3a')](_0x27593a)&&typeof _0x27593a!==_0xbced('0x15a')){return _0x12ae49(msgResponse(_0xbced('0x15b'),_0xbced('0x8d'),'voiceQueue\x20is\x20undefine'));}if(_[_0xbced('0x3a')](_0x23eaf0[_0xbced('0x15c')])||_0x23eaf0[_0xbced('0x15c')]===null){return _0x12ae49(msgResponse(_0xbced('0x15b'),_0xbced('0x8d'),_0xbced('0x15d')));}var _0x395928={'XMD-CALLERID':_0x503efa[_0xbced('0x21')][_0x15b178][_0xbced('0x15e')](),'XMD-AGI':_0x27593a[_0xbced('0x15f')]?util[_0xbced('0x41')](_0xbced('0x160'),ipAgi,_0x27593a[_0xbced('0x15f')]):_0xbced('0x161'),'XMD-AGIAFTER':_0x27593a[_0xbced('0xc8')]?util['format'](_0xbced('0x160'),ipAgi,_0x27593a[_0xbced('0xc8')]):'NONE','XMD-QUEUE':utils[_0xbced('0x162')](_0x27593a)?util[_0xbced('0x41')](_0xbced('0x163'),_0x27593a[_0xbced('0x42')],_0x27593a[_0xbced('0x164')]||'',_0x27593a[_0xbced('0xc9')]?'c':'',_0x27593a[_0xbced('0xd1')]||0x3):_0xbced('0x161'),'XMD-CONTACTID':_0x23eaf0[_0xbced('0xdf')],'XMD-CDRTYPE':_0xbced('0x165'),'CALLERID(all)':_0x503efa['actions'][_0x15b178][_0xbced('0x15e')](),'XMD-AMD':_0x27593a[_0xbced('0x10e')]?_0xbced('0x139'):_0xbced('0x161'),'XMD-DESTINATION':_0xbced('0x10d')};if(_0x27593a['dialAMDActive']){_0x395928[_0xbced('0x166')]=_0x27593a['dialAMDInitialSilence']||0x9c4;_0x395928['XMD-AMDGREETING']=_0x27593a['dialAMDGreeting']||0x5dc;_0x395928[_0xbced('0x167')]=_0x27593a[_0xbced('0x168')]||0x320;_0x395928[_0xbced('0x169')]=_0x27593a[_0xbced('0x16a')]||0x1388;_0x395928[_0xbced('0x16b')]=_0x27593a[_0xbced('0x16c')]||0x64;_0x395928['XMD-AMDBETWEENWORDSSILENCE']=_0x27593a[_0xbced('0x16d')]||0x32;_0x395928['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x27593a[_0xbced('0x16e')]||0x3;_0x395928[_0xbced('0x16f')]=_0x27593a[_0xbced('0x170')]||0x100;_0x395928['XMD-AMDMAXIMUMWORDLENGTH']=_0x27593a[_0xbced('0x171')]||0x1388;}if(utils['isOutboundQueue'](_0x27593a)){_0x395928[_0xbced('0x172')]=_0x23eaf0[_0xbced('0xe1')];}else{_0x395928[_0xbced('0x173')]=_0x23eaf0[_0xbced('0xe2')];}for(var _0x4ffc69 in _0x23eaf0[_0xbced('0x174')]){if(typeof _0x23eaf0[_0xbced('0x174')][_0x4ffc69]!==_0xbced('0xaa')){if(isNotNull(_0x23eaf0[_0xbced('0x174')][_0x4ffc69])&&_0x4ffc69!=='id'&&_0x4ffc69!=='tags'&&_0x4ffc69!==_0xbced('0x175')&&_0x4ffc69!==_0xbced('0x176')){_0x395928[util[_0xbced('0x41')](_0xbced('0x177'),_0xbced('0x178'),_[_0xbced('0x179')](_0x4ffc69))]=_0x23eaf0[_0xbced('0x174')][_0x4ffc69];}}}var _0xb2a37b=_0x503efa[_0xbced('0x81')](_0x27593a[_0xbced('0x87')])?utils[_0xbced('0x17a')](_0x27593a['Trunk'][_0xbced('0x17b')],_0x27593a['dialOriginateCallerIdName'],_0x27593a[_0xbced('0x17c')]>0x0?utils[_0xbced('0x17d')](_0x27593a[_0xbced('0x17e')],_0x27593a[_0xbced('0x17c')]):_0x27593a[_0xbced('0x17e')]):utils[_0xbced('0x17a')](_[_0xbced('0xf4')](_0x27593a[_0xbced('0x88')])?_0x27593a[_0xbced('0x87')][_0xbced('0x17b')]:_0x27593a[_0xbced('0x88')][_0xbced('0x17b')],_0x27593a[_0xbced('0x17f')],_0x27593a[_0xbced('0x17c')]>0x0?utils['getCallerIdRandom'](_0x27593a[_0xbced('0x17e')],_0x27593a['dialRandomLastDigitCallerIdNumber']):_0x27593a[_0xbced('0x17e')]);if(_0xb2a37b){_0x395928[_0xbced('0x180')]=_0x503efa['actions'][_0x15b178]['originatecalleridname']=utils[_0xbced('0x181')](_0xb2a37b);_0x395928['XMD-ORIGINATECALLERIDNUM']=_0x23eaf0[_0xbced('0x15c')];}_0x27593a[_0xbced('0x182')]=_0x395928;return ami[_0xbced('0x9e')]({'actionid':_0x15b178,'action':_0xbced('0x15b'),'channel':_0x503efa[_0xbced('0x81')](_0x27593a[_0xbced('0x87')])?util['format']('SIP/%s/%s%s',_0x27593a[_0xbced('0x87')][_0xbced('0x42')],isNotNull(_0x27593a[_0xbced('0x183')])?_0x27593a['dialPrefix'][_0xbced('0x184')]()||'':'',_0x27593a[_0xbced('0x185')]>0x0?_0x23eaf0[_0xbced('0x15c')]['substring'](_0x27593a[_0xbced('0x185')]):_0x23eaf0['phone']):util[_0xbced('0x41')](_0xbced('0x186'),_[_0xbced('0xf4')](_0x27593a[_0xbced('0x88')])?_0x27593a['Trunk'][_0xbced('0x42')]:_0x27593a[_0xbced('0x88')][_0xbced('0x42')],isNotNull(_0x27593a[_0xbced('0x183')])?_0x27593a[_0xbced('0x183')][_0xbced('0x184')]()||'':'',_0x27593a[_0xbced('0x185')]>0x0?_0x23eaf0[_0xbced('0x15c')][_0xbced('0x187')](_0x27593a[_0xbced('0x185')]):_0x23eaf0[_0xbced('0x15c')]),'callerid':_0xb2a37b,'Exten':_0xbced('0x10d'),'Context':_0xbced('0x188'),'Priority':'1','variable':_0x395928,'timeout':(_0x27593a[_0xbced('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x15b178})[_0xbced('0x9a')](function(_0x44d621){return _0x4100d5(_0x44d621);})['catch'](function(_0x22ab11){_0x27593a[_0xbced('0x18a')]+=0x1;var _0x1fadc9=new History(_0x503efa['actions'][_0x15b178]);logger[_0xbced('0x61')](util[_0xbced('0x41')]('[originateError]:\x20%s',JSON[_0xbced('0x70')](_0x22ab11)));_0x1fadc9[_0xbced('0x6b')]=0xe;_0x1fadc9[_0xbced('0x6c')]=_0xbced('0x18b');_0x1fadc9[_0xbced('0x6e')]=moment()['format'](_0xbced('0xc3'));_0x1fadc9[_0xbced('0x6d')]=_0x1fadc9[_0xbced('0x6e')];hopperUtils[_0xbced('0xca')](_0x1fadc9)[_0xbced('0x9d')](loggerCatch(_0xbced('0x18c')));_0x503efa[_0xbced('0xcc')](_0x1fadc9)[_0xbced('0x9d')](loggerCatch(_0xbced('0x18c')))[_0xbced('0x18')](function(){delete _0x503efa[_0xbced('0x21')][_0x15b178];return _0x12ae49(msgResponse(_0xbced('0x15b'),_0xbced('0x18d'),_0xbced('0x18e')));});});});};Dialer[_0xbced('0x15')][_0xbced('0x18f')]=function(_0x2863ed,_0x57502e,_0x33e7cb){var _0x118e3e=new History(_0x57502e);if(_0x118e3e['countbusyretry']+_0x118e3e[_0xbced('0x11e')]+_0x118e3e[_0xbced('0x11f')]+_0x118e3e['countnosuchnumberretry']+_0x118e3e[_0xbced('0xd5')]+_0x118e3e['countabandonedretry']+_0x118e3e[_0xbced('0x11b')]+_0x118e3e[_0xbced('0x121')]>=_0x33e7cb[_0xbced('0x122')]-0x1){return!![];}switch(_0x2863ed){case 0x3:if(_0x118e3e[_0xbced('0x11f')]>=_0x33e7cb[_0xbced('0x190')]-0x1){return!![];}hopperUtils[_0xbced('0xeb')]({'active':![],'countnoanswerretry':_0x118e3e[_0xbced('0x11f')]+=0x1,'scheduledat':moment()[_0xbced('0xdd')](_0x33e7cb[_0xbced('0x191')],_0xbced('0xde'))[_0xbced('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x118e3e[_0xbced('0xdf')],'ListId':_0x118e3e['ListId'],'VoiceQueueId':_0x118e3e[_0xbced('0xe1')]||undefined,'CampaignId':_0x118e3e[_0xbced('0xe2')]||undefined})[_0xbced('0x9d')](loggerCatch(_0xbced('0x192')));break;case 0x5:if(_0x118e3e[_0xbced('0x11d')]>=_0x33e7cb[_0xbced('0x193')]-0x1){return!![];}hopperUtils[_0xbced('0xeb')]({'active':![],'countbusyretry':_0x118e3e[_0xbced('0x11d')]+=0x1,'scheduledat':moment()[_0xbced('0xdd')](_0x33e7cb[_0xbced('0x194')],_0xbced('0xde'))['format'](_0xbced('0xc3')),'ContactId':_0x118e3e['ContactId'],'ListId':_0x118e3e[_0xbced('0xe0')],'VoiceQueueId':_0x118e3e[_0xbced('0xe1')]||undefined,'CampaignId':_0x118e3e['CampaignId']||undefined})[_0xbced('0x9d')](loggerCatch(_0xbced('0x195')));break;case 0x8:if(_0x118e3e[_0xbced('0x11e')]>=_0x33e7cb['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xbced('0xeb')]({'active':![],'countcongestionretry':_0x118e3e[_0xbced('0x11e')]+=0x1,'scheduledat':moment()[_0xbced('0xdd')](_0x33e7cb[_0xbced('0x196')],'minutes')[_0xbced('0x41')](_0xbced('0xc3')),'ContactId':_0x118e3e[_0xbced('0xdf')],'ListId':_0x118e3e[_0xbced('0xe0')],'VoiceQueueId':_0x118e3e[_0xbced('0xe1')]||undefined,'CampaignId':_0x118e3e[_0xbced('0xe2')]||undefined})['catch'](loggerCatch(_0xbced('0x197')));break;case 0x0:if(_0x118e3e[_0xbced('0x120')]>=_0x33e7cb[_0xbced('0x198')]-0x1){return!![];}else{hopperUtils[_0xbced('0xeb')]({'active':![],'countnosuchnumberretry':_0x118e3e['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xbced('0xdd')](_0x33e7cb['dialNoSuchNumberRetryFrequency'],_0xbced('0xde'))[_0xbced('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x118e3e[_0xbced('0xdf')],'ListId':_0x118e3e[_0xbced('0xe0')],'VoiceQueueId':_0x118e3e['VoiceQueueId']||undefined,'CampaignId':_0x118e3e[_0xbced('0xe2')]||undefined})[_0xbced('0x9d')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x118e3e[_0xbced('0xd5')]>=_0x33e7cb[_0xbced('0xdb')]-0x1){return!![];}hopperUtils[_0xbced('0xeb')]({'active':![],'countdropretry':_0x118e3e[_0xbced('0xd5')]+=0x1,'scheduledat':moment()[_0xbced('0xdd')](_0x33e7cb[_0xbced('0xd7')],_0xbced('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x118e3e[_0xbced('0xdf')],'ListId':_0x118e3e[_0xbced('0xe0')],'VoiceQueueId':_0x118e3e[_0xbced('0xe1')]||undefined,'CampaignId':_0x118e3e[_0xbced('0xe2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x118e3e[_0xbced('0xea')]>=_0x33e7cb[_0xbced('0x199')]-0x1){return!![];}hopperUtils[_0xbced('0xeb')]({'active':![],'countabandonedretry':_0x118e3e[_0xbced('0xea')]+=0x1,'scheduledat':moment()[_0xbced('0xdd')](_0x33e7cb[_0xbced('0x19a')],_0xbced('0xde'))[_0xbced('0x41')](_0xbced('0xc3')),'ContactId':_0x118e3e[_0xbced('0xdf')],'ListId':_0x118e3e[_0xbced('0xe0')],'VoiceQueueId':_0x118e3e[_0xbced('0xe1')]||undefined,'CampaignId':_0x118e3e[_0xbced('0xe2')]||undefined})['catch'](loggerCatch(_0xbced('0xec')));break;case 0x13:if(_0x118e3e[_0xbced('0x11b')]>=_0x33e7cb[_0xbced('0x124')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x118e3e[_0xbced('0x11b')]+=0x1,'scheduledat':moment()[_0xbced('0xdd')](_0x33e7cb['dialMachineRetryFrequency'],'minutes')[_0xbced('0x41')](_0xbced('0xc3')),'ContactId':_0x118e3e['ContactId'],'ListId':_0x118e3e[_0xbced('0xe0')],'VoiceQueueId':_0x118e3e[_0xbced('0xe1')]||undefined,'CampaignId':_0x118e3e[_0xbced('0xe2')]||undefined})[_0xbced('0x9d')](loggerCatch(_0xbced('0x127')));break;case 0x14:if(_0x118e3e['countagentrejectretry']>=_0x33e7cb['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xbced('0xeb')]({'active':![],'countagentrejectretry':_0x118e3e[_0xbced('0x121')]+=0x1,'scheduledat':moment()[_0xbced('0xdd')](_0x33e7cb[_0xbced('0x19b')],_0xbced('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x118e3e[_0xbced('0xdf')],'ListId':_0x118e3e[_0xbced('0xe0')],'VoiceQueueId':_0x118e3e[_0xbced('0xe1')]||undefined,'CampaignId':_0x118e3e[_0xbced('0xe2')]||undefined})[_0xbced('0x9d')](loggerCatch(_0xbced('0x19c')));break;default:return!![];}};Dialer[_0xbced('0x15')]['callProgressDetecting']=function(_0x24f9a6,_0xabbb16,_0x161e0c){var _0x6eacb3=this;var _0x5159fc=new History(_0x24f9a6);var _0x5206a4=![];var _0xbe2e22;var _0xdfabfd;return new Promise(function(_0x32b17d,_0x515145){if(_['isUndefined'](_0xabbb16)&&typeof _0xabbb16!==_0xbced('0x15a')){return _0x515145(msgResponse('[callProgressDetecting]',_0xbced('0x8d'),'entity\x20is\x20undefine'));}if(_[_0xbced('0x3a')](_0x161e0c)&&typeof _0x161e0c!==_0xbced('0x15a')){return _0x515145(msgResponse('[callProgressDetecting]',_0xbced('0x8d'),'evt\x20is\x20undefine'));}hopperUtils[_0xbced('0xd9')](_0x5159fc,_0x161e0c['reason'],_0xabbb16)[_0xbced('0x9a')](function(_0x3e4b91){if(_0x3e4b91['additional']==0x1)_0x5206a4=!![];switch(_0x161e0c[_0xbced('0xc6')]){case'0':_0xabbb16[_0xbced('0x19d')]+=0x1;_0x5159fc['state']=0x0;_0x5159fc[_0xbced('0x6c')]=_0xbced('0x19e');_0x5159fc[_0xbced('0x120')]+=0x1;_0x5159fc['countglobal']+=0x1;ami['emit'](_0xbced('0x19f'),ut[_0xbced('0x114')](_0x24f9a6,'nosuchnumber'));_0xbe2e22=_0xabbb16['dialNoSuchNumberRetryFrequency'];_0xdfabfd=_0xabbb16['callAdditionalPhoneAfterMin'];hopperUtils[_0xbced('0xca')](_0x5159fc)[_0xbced('0x9d')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x6eacb3[_0xbced('0x18f')](0x0,_0x24f9a6,_0xabbb16)&&!_0x5206a4){if(_0x5159fc[_0xbced('0x120')]>=_0xabbb16[_0xbced('0x198')]){_0x6eacb3[_0xbced('0x125')](_0x5159fc,_0x32b17d,_0x515145,_0xbced('0x1a0'));}else{_0x6eacb3[_0xbced('0x123')](_0x5159fc,_0x32b17d,_0x515145,_0xbced('0x1a0'));}}break;case'3':_0xabbb16['outboundNoAnswerCallsDay']+=0x1;_0x5159fc[_0xbced('0x6b')]=0x3;_0x5159fc[_0xbced('0x6c')]=_0xbced('0x1a1');_0x5159fc[_0xbced('0x11f')]+=0x1;_0x5159fc[_0xbced('0xd6')]+=0x1;var _0x341717=ut['buildNoAnswerEventPayload'](_0x24f9a6,_0xabbb16);ami[_0xbced('0x3b')](_0xbced('0x1a2'),_0x341717);_0xbe2e22=_0xabbb16[_0xbced('0x191')];_0xdfabfd=_0xabbb16[_0xbced('0xd8')];hopperUtils['createHistory'](_0x5159fc)[_0xbced('0x9d')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x6eacb3['checkRetriveMax'](0x3,_0x24f9a6,_0xabbb16)&&!_0x5206a4){if(_0x5159fc[_0xbced('0x11f')]>=_0xabbb16[_0xbced('0x190')]){_0x6eacb3['createStateFinal'](_0x5159fc,_0x32b17d,_0x515145,'reason\x203\x20ringing\x20no\x20answer');}else{_0x6eacb3[_0xbced('0x123')](_0x5159fc,_0x32b17d,_0x515145,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xabbb16[_0xbced('0x1a3')]+=0x1;_0x5159fc['state']=0x5;_0x5159fc[_0xbced('0x6c')]=_0xbced('0x1a4');_0x5159fc['countbusyretry']+=0x1;_0x5159fc['countglobal']+=0x1;ami['emit'](_0xbced('0x1a5'),ut[_0xbced('0x114')](_0x24f9a6,'busy'));_0xbe2e22=_0xabbb16[_0xbced('0x194')];_0xdfabfd=_0xabbb16[_0xbced('0xd8')];hopperUtils[_0xbced('0xca')](_0x5159fc)[_0xbced('0x9d')](loggerCatch(_0xbced('0x1a6')));if(_0x6eacb3[_0xbced('0x18f')](0x5,_0x24f9a6,_0xabbb16)&&!_0x5206a4){if(_0x5159fc[_0xbced('0x11d')]>=_0xabbb16['dialBusyMaxRetry']){_0x6eacb3[_0xbced('0x125')](_0x5159fc,_0x32b17d,_0x515145,_0xbced('0x1a7'));}else{_0x6eacb3[_0xbced('0x123')](_0x5159fc,_0x32b17d,_0x515145,'reason\x205\x20busy');}}break;case'8':_0xabbb16[_0xbced('0x1a8')]+=0x1;_0x5159fc[_0xbced('0x6b')]=0x8;_0x5159fc['statedesc']=_0xbced('0x1a9');_0x5159fc[_0xbced('0x11e')]+=0x1;_0x5159fc[_0xbced('0xd6')]+=0x1;_0xbe2e22=_0xabbb16[_0xbced('0x196')];_0xdfabfd=_0xabbb16[_0xbced('0xd8')];ami[_0xbced('0x3b')](_0xbced('0x1aa'),ut[_0xbced('0x114')](_0x24f9a6,_0xbced('0x1ab')));hopperUtils['createHistory'](_0x5159fc)[_0xbced('0x9d')](loggerCatch(_0xbced('0x1ac')));if(_0x6eacb3[_0xbced('0x18f')](0x8,_0x24f9a6,_0xabbb16)&&!_0x5206a4){if(_0x5159fc[_0xbced('0x11e')]>=_0xabbb16['dialCongestionMaxRetry']){_0x6eacb3[_0xbced('0x125')](_0x5159fc,_0x32b17d,_0x515145,_0xbced('0x1ad'));}else{_0x6eacb3[_0xbced('0x123')](_0x5159fc,_0x32b17d,_0x515145,_0xbced('0x1ad'));}}break;case'11':_0xabbb16[_0xbced('0x1ae')]+=0x1;_0x5159fc['state']=0xb;_0x5159fc[_0xbced('0x6c')]=_0xbced('0xed');_0x5159fc[_0xbced('0xea')]+=0x1;_0x5159fc[_0xbced('0xd6')]+=0x1;_0xbe2e22=_0xabbb16[_0xbced('0x19a')];_0xdfabfd=_0xabbb16[_0xbced('0xd8')];hopperUtils['createHistory'](_0x5159fc)[_0xbced('0x9d')](loggerCatch(_0xbced('0xee')));if(_0x6eacb3[_0xbced('0x18f')](0xb,_0x24f9a6,_0xabbb16)&&!_0x5206a4){if(_0x5159fc[_0xbced('0xea')]>=_0xabbb16[_0xbced('0x199')]){_0x6eacb3[_0xbced('0x125')](_0x5159fc,_0x32b17d,_0x515145,_0xbced('0x1af'));}else{_0x6eacb3['stateGlobal'](_0x5159fc,_0x32b17d,_0x515145,_0xbced('0x1af'));}}break;case'20':_0xabbb16[_0xbced('0x1b0')]+=0x1;_0x5159fc['state']=0x14;_0x5159fc[_0xbced('0x6c')]=_0xbced('0x1b1');_0x5159fc[_0xbced('0x121')]+=0x1;_0x5159fc['countglobal']+=0x1;_0xbe2e22=_0xabbb16['dialAgentRejectRetryFrequency'];_0xdfabfd=_0xabbb16[_0xbced('0xd8')];ami[_0xbced('0x3b')](_0xbced('0x1b2'),ut[_0xbced('0x114')](_0x24f9a6,_0xbced('0x1b3')));hopperUtils[_0xbced('0xca')](_0x5159fc)[_0xbced('0x9d')](loggerCatch(_0xbced('0x1b4')));if(_0x6eacb3[_0xbced('0x18f')](0x14,_0x24f9a6,_0xabbb16)&&!_0x5206a4){if(_0x5159fc['countagentrejectretry']>=_0xabbb16['dialAgentRejectMaxRetry']){_0x6eacb3[_0xbced('0x125')](_0x5159fc,_0x32b17d,_0x515145,_0xbced('0x1b5'));}else{_0x6eacb3[_0xbced('0x123')](_0x5159fc,_0x32b17d,_0x515145,_0xbced('0x1b5'));}}break;default:_0xabbb16[_0xbced('0x132')]+=0x1;_0x5159fc[_0xbced('0x6b')]=0xc;_0x5159fc[_0xbced('0x6c')]=_0x161e0c[_0xbced('0xc6')];_0xbe2e22=_0xabbb16[_0xbced('0x19b')];_0xdfabfd=_0xabbb16['callAdditionalPhoneAfterMin'];hopperUtils[_0xbced('0xca')](_0x5159fc)[_0xbced('0x9d')](loggerCatch(_0xbced('0x1b6')));if(_0x6eacb3['checkRetriveMax'](_0x161e0c[_0xbced('0xc6')],_0x24f9a6,_0xabbb16)&&!_0x5206a4){if(_0x5159fc[_0xbced('0x11d')]+_0x5159fc[_0xbced('0x11e')]+_0x5159fc[_0xbced('0x11f')]+_0x5159fc[_0xbced('0x120')]+_0x5159fc[_0xbced('0xd5')]+_0x5159fc[_0xbced('0xea')]+_0x5159fc[_0xbced('0x11b')]+_0x5159fc[_0xbced('0x121')]>=_0xabbb16[_0xbced('0x122')]){_0x6eacb3[_0xbced('0x123')](_0x5159fc,_0x32b17d,_0x515145,_0x161e0c[_0xbced('0xc6')]);}else{_0x6eacb3[_0xbced('0x125')](_0x5159fc,_0x32b17d,_0x515145,_0x161e0c[_0xbced('0xc6')]);}}}})[_0xbced('0x9a')](function(){if(_0x5206a4){hopperUtils[_0xbced('0xe6')](_0x5159fc,_0xbe2e22,_0xdfabfd)['then'](function(){return _0x32b17d(0x1);});}});});};Dialer[_0xbced('0x15')]['stateGlobal']=function(_0x55f921,_0x5e1354,_0x297c33,_0x340372){var _0x2961de=new Final(_0x55f921);_0x2961de['state']=0xf;_0x2961de['statedesc']=_0xbced('0x1b7');this['createStateFinal'](_0x2961de,_0x5e1354,_0x297c33,_0x340372);};Dialer[_0xbced('0x15')][_0xbced('0x125')]=function(_0x41db7d,_0x168d4c,_0x1919d6,_0x475e23){hopperUtils[_0xbced('0xcc')](_0x41db7d)[_0xbced('0x9a')](function(){return _0x168d4c(msgResponse('[callProgressDetecting]',_0xbced('0x107'),_0x475e23));})['catch'](function(){return _0x1919d6(msgResponse(_0xbced('0x1b8'),_0xbced('0x8d'),'contact\x20not\x20moved'));});};Dialer[_0xbced('0x15')][_0xbced('0xb3')]=function(_0x101f02){var _0x4a02c0=_0x101f02[_0xbced('0x1b9')]/0x64;var _0x1dcb97=_0x101f02[_0xbced('0x1ba')]/(_0x101f02[_0xbced('0x1ba')]+_0x101f02[_0xbced('0xc5')]);var _0x20c0ae=Math['round'](_0x101f02[_0xbced('0x1bb')]*(_0x101f02['predictiveIntervalMaxThreshold']/0x64));var _0x97fd0c=Math[_0xbced('0x1bc')](_0x101f02['predictiveIntervalAvailable']*(_0x101f02[_0xbced('0x1bd')]/0x64));var _0x57f4d4=_0x101f02[_0xbced('0x136')]+_0x101f02['talking'];var _0x1c3f13=Math[_0xbced('0x1be')](_0x101f02[_0xbced('0x56')]*_0x101f02[_0xbced('0x5a')]*_0x101f02[_0xbced('0x1bf')]*_0x101f02[_0xbced('0x1c0')]);if(_[_0xbced('0x3a')](_0x101f02[_0xbced('0x26')])){if(!_['isUndefined'](_0x101f02['startPredictive'])){_0x101f02['startPredictive']=undefined;loggerPredictive[_0xbced('0x61')]('[startMethodPredictive][StartProgressive]',_0xbced('0x1c1'));}if(!_['isUndefined'](_0x101f02['handlePredictive'])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xbced('0x1c2'));clearInterval(_0x101f02[_0xbced('0x5f')]);_0x101f02[_0xbced('0x5f')]=undefined;}_0x101f02['startProgressive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xbced('0x45')](_0x101f02[_0xbced('0x42')],'collection\x20data\x20in\x20progressive\x20at',_0x101f02[_0xbced('0x26')]);this[_0xbced('0xb5')](_0x101f02,0x1);}else if(ifInterval(_0x101f02[_0xbced('0x1c3')],_0x101f02[_0xbced('0x26')])){this[_0xbced('0xb5')](_0x101f02,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x101f02['startProgressive'],_0x101f02[_0xbced('0x42')]);_0x101f02[_0xbced('0x56')]=0x0;_0x101f02['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4a02c0<_0x1dcb97&&_0x101f02[_0xbced('0x1c4')]===_0xbced('0x1c5')){clearPredictiveAttributes(_0x101f02);loggerPredictive[_0xbced('0x45')](_0xbced('0x1c6'),'Dropped\x20calls\x20day',_0x1dcb97,_0xbced('0x26'),_0x101f02[_0xbced('0x42')]);}else if(_0x1c3f13<_0x101f02[_0xbced('0xd2')]&&_0x101f02[_0xbced('0x1c4')]===_0xbced('0x1c5')){clearPredictiveAttributes(_0x101f02);loggerPredictive['info'](_0xbced('0x1c7'),_0xbced('0x1c8'),_0x1c3f13,_0xbced('0x1c9'),_0x101f02[_0xbced('0xd2')],_0xbced('0x26'),_0x101f02['name']);}else if(!ifInterval(_0x101f02[_0xbced('0x1c3')],_0x101f02[_0xbced('0x26')])&&_['isUndefined'](_0x101f02[_0xbced('0x25')])&&!_['isUndefined'](_0x101f02[_0xbced('0x26')])){_0x101f02[_0xbced('0x25')]=moment()[_0xbced('0x41')](_0xbced('0xc3'));loggerPredictive[_0xbced('0x45')](_0x101f02[_0xbced('0x42')],_0xbced('0x1ca'),_0x101f02[_0xbced('0x25')]);hopperUtils['avgHandleTime'](_0x101f02[_0xbced('0x1c3')])['then'](this[_0xbced('0x1cb')](_0x101f02))[_0xbced('0x9a')](mergeDataErlangB(_0x101f02))[_0xbced('0x9a')](this[_0xbced('0x1cc')](_0x101f02))[_0xbced('0x9d')](loggerCatchPredictive(_0xbced('0x1cd'),_0x101f02));}else if(!ifInterval(_0x101f02[_0xbced('0x1c3')],_0x101f02['startPredictive'])){_0x101f02['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x101f02[_0xbced('0x25')]=moment()['format'](_0xbced('0xc3'));loggerPredictive['info'](_0x101f02['name'],'recalculate\x20predictive\x20at',_0x101f02['startPredictive']);clearInterval(_0x101f02['handlePredictive']);_0x101f02[_0xbced('0x5f')]=undefined;hopperUtils[_0xbced('0x1ce')](_0x101f02[_0xbced('0x1c3')])[_0xbced('0x9a')](this['getDataPredictive'](_0x101f02))[_0xbced('0x9a')](mergeDataErlangB(_0x101f02))[_0xbced('0x9a')](this[_0xbced('0x1cc')](_0x101f02))[_0xbced('0x9d')](loggerCatchPredictive(_0xbced('0x1cf'),_0x101f02));}else if(_0x101f02[_0xbced('0x1bb')]&&_0x57f4d4<_0x101f02[_0xbced('0x1bb')]-_0x97fd0c){clearPredictiveAttributes(_0x101f02);loggerPredictive['info'](_0x101f02[_0xbced('0x42')],_0xbced('0x1d0'),_0x57f4d4,_0xbced('0x1d1'),_0x101f02['predictiveIntervalAvailable'],'-',_0x97fd0c,'=',_0x101f02['predictiveIntervalAvailable']-_0x97fd0c,')');}else if(_0x101f02[_0xbced('0x1bb')]&&_0x57f4d4>_0x101f02['predictiveIntervalAvailable']+_0x20c0ae){clearPredictiveAttributes(_0x101f02);loggerPredictive[_0xbced('0x45')](_0x101f02[_0xbced('0x42')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x57f4d4,')\x20are\x20more\x20than\x20threshold\x20(',_0x101f02[_0xbced('0x1bb')],'+',_0x20c0ae,'=',_0x101f02[_0xbced('0x1bb')]+_0x20c0ae,')');}};Dialer[_0xbced('0x15')][_0xbced('0x1cb')]=function(_0x1ee338){var _0x5d9b06=this;return function(_0xce4523){return new Promise(function(_0x826470,_0x381e9f){_[_0xbced('0x5b')](_0x1ee338,_0xce4523[0x0]);if(checkGetDataPredictive(_0xce4523[0x0])){var _0x4a87a6=_0x1ee338[_0xbced('0x1bb')]=_0x1ee338[_0xbced('0x137')]+_0x1ee338[_0xbced('0x136')];var _0xa883=_0x1ee338[_0xbced('0x1c3')]*0x3c;var _0x34fdad=_0xce4523[0x0]['predictiveIntervalAvgTalktime']+_0xce4523[0x0][_0xbced('0x51')];var _0x40276c=(_0xce4523[0x0][_0xbced('0x1d2')]+_0xce4523[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xce4523[0x0][_0xbced('0x4b')])/_0xce4523[0x0]['predictiveIntervalTotalCalls'];_0x1ee338[_0xbced('0x1bf')]=_0x40276c>0x0?_0x40276c:0x1;switch(_0x1ee338[_0xbced('0x1c4')]){case _0xbced('0x1c5'):var _0x397fc5=_0x1ee338[_0xbced('0x1b9')]/0x64;return _0x5d9b06[_0xbced('0x1d3')](_0x4a87a6,_0xa883,_0x34fdad,_0x40276c,_0x397fc5)[_0xbced('0x9a')](function(_0x11f898){return _0x826470(_0x11f898);});case _0xbced('0x1d4'):var _0x384f27=_0x1ee338[_0xbced('0x1b9')]/0x64;return _0x5d9b06['busyFactor'](_0x4a87a6,_0xa883,_0x34fdad,_0x40276c,_0x384f27)[_0xbced('0x9a')](function(_0x11472a){return _0x826470(_0x11472a);});default:return _0x381e9f(msgResponse(_0xbced('0x1d5'),_0xbced('0x8d'),_0xbced('0x1d6')));}}else{return _0x381e9f(msgResponse(_0xbced('0x1d5'),_0xbced('0x8d'),_0xbced('0x1d7')));}});};};Dialer[_0xbced('0x15')][_0xbced('0x1d8')]=function(_0x2d1c31){var _0x3080c4=this;return function(_0x1c6bd8){return new Promise(function(_0x512cc6,_0xdce589){_[_0xbced('0x5b')](_0x2d1c31,_0x1c6bd8[0x0]);if(checkGetDataPredictive(_0x1c6bd8[0x0])){loggerPredictive[_0xbced('0x45')](JSON['stringify'](_0x1c6bd8[0x0]));if(_0x2d1c31['dialPredictiveOptimization']===_0xbced('0x1c5')){return _0x3080c4[_0xbced('0x14f')](_0x2d1c31['id'])['then'](function(_0xfe6174){var _0x47a89a=_0x2d1c31['loggedIn']-_0xfe6174[0x0][_0xbced('0x1d9')];var _0x26e07b=_0x2d1c31[_0xbced('0x1c3')]*0x3c;var _0x3aece0=_0x1c6bd8[0x0][_0xbced('0x4e')]+_0x1c6bd8[0x0][_0xbced('0x51')];var _0x15a2a5=(_0x1c6bd8[0x0][_0xbced('0x1d2')]+_0x1c6bd8[0x0][_0xbced('0x4a')]+_0x1c6bd8[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1c6bd8[0x0][_0xbced('0x47')];var _0x47bf3a=_0x2d1c31['dialPredictiveOptimizationPercentage']/0x64;_0x2d1c31['predictiveIntervalPauses']=_0xfe6174[0x0][_0xbced('0x1d9')]||0x0;_0x2d1c31['predictiveIntervalHitRate']=_0x15a2a5>0x0?_0x15a2a5:0x1;return _0x3080c4[_0xbced('0x1d3')](_0x47a89a,_0x26e07b,_0x3aece0,_0x15a2a5,_0x47bf3a);})[_0xbced('0x9a')](function(_0x418b8f){return _0x512cc6(_0x418b8f);})['catch'](function(_0x54332d){return _0xdce589(msgResponse('[CatchErlangB]',_0xbced('0x8d'),JSON['stringify'](_0x54332d)));});}if(_0x2d1c31[_0xbced('0x1c4')]===_0xbced('0x1d4')){return _0x3080c4[_0xbced('0x14f')](_0x2d1c31['id'])['then'](function(_0x2b6787){var _0x46b5a9=_0x2d1c31[_0xbced('0x1da')]-_0x2b6787[0x0][_0xbced('0x1d9')];var _0x3d834c=_0x2d1c31['dialPredictiveInterval']*0x3c;var _0x2bb81a=_0x1c6bd8[0x0][_0xbced('0x4e')]+_0x1c6bd8[0x0][_0xbced('0x51')];var _0xe6aed8=(_0x1c6bd8[0x0]['predictiveIntervalAnsweredCalls']+_0x1c6bd8[0x0][_0xbced('0x4a')]+_0x1c6bd8[0x0][_0xbced('0x4b')])/_0x1c6bd8[0x0][_0xbced('0x47')];var _0x5ed4eb=_0x2d1c31[_0xbced('0x1b9')]/0x64;_0x2d1c31['predictiveIntervalPauses']=_0x2b6787[0x0][_0xbced('0x1d9')]||0x0;_0x2d1c31[_0xbced('0x1bf')]=_0xe6aed8>0x0?_0xe6aed8:0x1;return _0x3080c4['busyFactor'](_0x46b5a9,_0x3d834c,_0x2bb81a,_0xe6aed8,_0x5ed4eb);})['then'](function(_0x1cf525){return _0x512cc6(_0x1cf525);})[_0xbced('0x9d')](function(_0x2740b8){return _0xdce589(msgResponse(_0xbced('0x1db'),'Failure',JSON[_0xbced('0x70')](_0x2740b8)));});}}else{return _0xdce589(msgResponse(_0xbced('0x1d5'),_0xbced('0x8d'),_0xbced('0x1d7')));}});};};Dialer[_0xbced('0x15')][_0xbced('0x1cc')]=function(_0x4fe254){var _0x4a25d7=this;return function(){var _0x4f6728=0x0;var _0x572e55=Math['floor'](_0x4fe254[_0xbced('0x1dc')]*0x3e8);if(_0x572e55>0x0){_0x572e55=_0x572e55<0x64?0x64:_0x572e55;loggerPredictive[_0xbced('0x45')](_0x4fe254[_0xbced('0x42')],_0xbced('0x1dd'),_0x572e55,_0xbced('0x1de'));_0x4fe254[_0xbced('0x5f')]=setInterval(function(){_0x4a25d7[_0xbced('0x5f')](_0x4fe254);loggerPredictiveCalls[_0xbced('0x45')]('[handlePredictive]',_0x4f6728+=0x1);},_0x572e55);}else{loggerPredictive[_0xbced('0x45')](_0x4fe254[_0xbced('0x42')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xbced('0x15')]['checkContactBlack']=function(_0x77dc0a,_0x498393){var _0x1c484f=this;return function(_0x5b0708){if(_[_0xbced('0x44')](_0x5b0708)){if(_[_0xbced('0xf4')](_0x498393[_0xbced('0x154')])||!_0x498393[_0xbced('0x1df')]){if(_0x77dc0a['dialMethod']===_0xbced('0x6')){_0x77dc0a['queueStatusComplete']=_[_0xbced('0x3a')](_0x77dc0a['queueStatusComplete'])?!![]:_0x77dc0a[_0xbced('0x6f')];var _0x44830f=uuid['v4']();_0x1c484f['actions'][_0x44830f]=new Action(_0x77dc0a,_0x498393,_0x44830f);loggerBooked[_0xbced('0x45')]('[booked][checkContactBlack]',_0x44830f,_0xbced('0x1e0'),JSON[_0xbced('0x70')](_0x77dc0a[_0xbced('0x6f')]),'Queue:\x20',_0x77dc0a[_0xbced('0x42')]);if(_0x77dc0a[_0xbced('0x6f')]){_0x77dc0a[_0xbced('0x6f')]=![];_0x1c484f[_0xbced('0x28')][_0x1c484f[_0xbced('0x21')][_0x44830f]['queue']]=[];ami[_0xbced('0x9e')]({'actionid':_0x44830f,'action':'queuestatus','queue':_0x77dc0a['name']})[_0xbced('0x9d')](function(){_0x1c484f['updateOriginated'](_0x77dc0a);hopperUtils[_0xbced('0xeb')]({'active':![],'ContactId':_0x1c484f[_0xbced('0x21')][_0x44830f][_0xbced('0xdf')],'ListId':_0x1c484f[_0xbced('0x21')][_0x44830f][_0xbced('0xe0')],'VoiceQueueId':_0x1c484f[_0xbced('0x21')][_0x44830f][_0xbced('0xe1')]||undefined,'CampaignId':_0x1c484f[_0xbced('0x21')][_0x44830f][_0xbced('0xe2')]||undefined})[_0xbced('0x9d')](loggerCatch(_0xbced('0x1e1')));delete _0x1c484f['actions'][_0x44830f];});}else{loggerBooked[_0xbced('0x45')](_0xbced('0x1e2'),JSON[_0xbced('0x70')](_0x77dc0a[_0xbced('0x6f')]),'Queue:\x20',_0x77dc0a[_0xbced('0x42')]);_0x1c484f[_0xbced('0xc1')](_0x77dc0a);hopperUtils[_0xbced('0xeb')]({'active':![],'ContactId':_0x1c484f['actions'][_0x44830f]['ContactId'],'ListId':_0x1c484f['actions'][_0x44830f][_0xbced('0xe0')],'VoiceQueueId':_0x1c484f[_0xbced('0x21')][_0x44830f][_0xbced('0xe1')]||undefined,'CampaignId':_0x1c484f[_0xbced('0x21')][_0x44830f]['CampaignId']||undefined})[_0xbced('0x9d')](loggerCatch(_0xbced('0x1e1')));delete _0x1c484f[_0xbced('0x21')][_0x44830f];}}else{return _0x1c484f[_0xbced('0x159')](_0x77dc0a,_0x498393);}}else{if(utils['getSeconds'](undefined,_0x498393['scheduledat'])<_0x77dc0a['dialRecallMeTimeout']*0x3c){if(_0x498393['Agent']&&!_0x498393[_0xbced('0x146')][_0xbced('0x1e3')]){_0x1c484f[_0xbced('0x1a')][_0xbced('0xf8')](_0x498393['id'])[_0xbced('0x18')](function(){_0x1c484f[_0xbced('0xc1')](_0x77dc0a);});}else{hopperUtils['unlockContact']({'active':![]},_0x498393['id'],0x1)[_0xbced('0x18')](function(){_0x1c484f[_0xbced('0xc1')](_0x77dc0a);});}}else{_0x77dc0a[_0xbced('0x1e4')]+=0x1;_0x1c484f[_0xbced('0xc1')](_0x77dc0a);if(_0x77dc0a[_0xbced('0x1e5')]){hopperUtils[_0xbced('0xeb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x498393[_0xbced('0xdf')],'ListId':_0x498393['ListId'],'VoiceQueueId':_0x498393['VoiceQueueId']||undefined,'CampaignId':_0x498393[_0xbced('0xe2')]||undefined})[_0xbced('0x9d')](loggerCatch(_0xbced('0x1e6')));hopperUtils[_0xbced('0xca')](createObjHistory(_0x77dc0a,_0x498393,utils[_0xbced('0x65')][_0xbced('0x1e7')],0x17,'RecallInQueue'))['catch'](loggerCatch(_0xbced('0x1e8')));}else{_0x1c484f[_0xbced('0x129')](createObjHistory(_0x77dc0a,_0x498393,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xbced('0x1e9'));}}}}else{_0x77dc0a[_0xbced('0x1ea')]+=0x1;_0x1c484f[_0xbced('0x129')](createObjHistory(_0x77dc0a,_0x498393,utils[_0xbced('0x65')]['BLACKLIST'],0xd,'Blacklist'),_0xbced('0x1eb'),_0xbced('0x1ec'));throw'inBlackList';}};};Dialer[_0xbced('0x15')]['handleIvr']=function(_0x24086f){var _0x2d5576=this;var _0xdc66d2=_0x24086f[_0xbced('0x1ed')]-_0x24086f['originated']-_0x24086f[_0xbced('0x1ee')];emitCampaignSummary(_0x24086f);if(_0xdc66d2>0x0){if(_0xdc66d2>this[_0xbced('0x1f')]){_0xdc66d2=this[_0xbced('0x1f')];}_0x24086f['temp']+=_0xdc66d2;hopperUtils[_0xbced('0x1ef')](_0x24086f,_0xdc66d2)[_0xbced('0x9a')](function(_0x4f2430){_0x24086f[_0xbced('0x1ee')]-=_0xdc66d2;_0x24086f['temp']=_0x24086f[_0xbced('0x1ee')]>0x0?_0x24086f[_0xbced('0x1ee')]:0x0;if(!utils[_0xbced('0x1f0')](_0x4f2430)){_0x24086f[_0xbced('0x64')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0xbced('0x45')]('[getContactCampaign2][Empty]'+_0x24086f[_0xbced('0x42')]);}else{_0x24086f[_0xbced('0x7a')]+=_0x4f2430[_0xbced('0x96')];_0x24086f[_0xbced('0x64')]=utils[_0xbced('0x65')][_0xbced('0x1f1')];for(var _0x49e201=0x0;_0x49e201<_0x4f2430['length'];_0x49e201+=0x1){_0x24086f[_0xbced('0x1f2')]+=0x1;if(_[_0xbced('0xf4')](_0x4f2430[_0x49e201])||_[_0xbced('0xf4')](_0x4f2430[_0x49e201][_0xbced('0x174')])||_['isNil'](_0x4f2430[_0x49e201][_0xbced('0x15c')])){_0x2d5576[_0xbced('0x152')](_0xbced('0x1f3'),_0x24086f,_0x4f2430[_0x49e201]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xbced('0x71')](_0x4f2430[_0x49e201],['CampaignId',_0xbced('0x15c')]))[_0xbced('0x9a')](_0x2d5576[_0xbced('0x1f4')](_0x24086f,_0x4f2430[_0x49e201]))['catch'](_0x2d5576['loggerHandler'](_0xbced('0x1f5'),_0x24086f));}}}})['catch'](loggerGetContactDialer(_0xbced('0x1f6'),_0x24086f,_0xdc66d2));}};Dialer[_0xbced('0x15')][_0xbced('0xb5')]=function(_0x304bd0,_0x3a121c){var _0xc84fd5=this;var _0x5a0a60=[];if(_0x3a121c<0x1||_0x304bd0[_0xbced('0xb2')]===_0xbced('0x6')){_0x3a121c=0x1;}var _0xd466ec=Math[_0xbced('0x1be')](_0x304bd0['available']*_0x3a121c)-_0x304bd0[_0xbced('0x7a')]-_0x304bd0[_0xbced('0x1ee')];if(_0x304bd0[_0xbced('0x1f7')]>0x0){var _0x2565af=_0x304bd0[_0xbced('0x1f7')]-_0x304bd0[_0xbced('0x7a')]-_0x304bd0[_0xbced('0x137')]-_0x304bd0[_0xbced('0x1ee')]-_0x304bd0[_0xbced('0x138')];if(_0xd466ec>_0x2565af){_0xd466ec=_0x2565af;}}if(_0xd466ec>0x0){if(_0x304bd0[_0xbced('0xb2')]===_0xbced('0x6')){_0xd466ec=0x1;}if(_0xd466ec>this['maxNumberOriginate']){_0xd466ec=this[_0xbced('0x1f')];}_0x304bd0['temp']+=_0xd466ec;for(var _0x39bb27 in this[_0xbced('0x1d')]){if(typeof this['agents'][_0x39bb27]!=='undefined'){if(this[_0xbced('0x1d')][_0x39bb27]['state']===_0xbced('0x1f8')&&this['agents'][_0x39bb27][_0xbced('0x84')]===_0xbced('0x143')){_0x5a0a60['push'](this['agents'][_0x39bb27]['id']);}}}hopperUtils[_0xbced('0x1f9')](_0x304bd0,_0x5a0a60,_0xd466ec)[_0xbced('0x9a')](function(_0x417f0a){_0x304bd0['temp']-=_0xd466ec;_0x304bd0[_0xbced('0x1ee')]=_0x304bd0[_0xbced('0x1ee')]>0x0?_0x304bd0[_0xbced('0x1ee')]:0x0;if(!utils[_0xbced('0x1f0')](_0x417f0a)){hopperUtils[_0xbced('0x1fa')](_0x304bd0)['then'](sendMessageReschedule(_0x304bd0))[_0xbced('0x9d')](loggerCatch(_0xbced('0x1fb')));}else{_0x304bd0[_0xbced('0x7a')]+=_0x417f0a[_0xbced('0x96')];_0x304bd0[_0xbced('0x64')]=_0x304bd0[_0xbced('0xb2')]==='booked'?utils['CAMPAIGN_STATUS'][_0xbced('0x139')]:utils[_0xbced('0x65')][_0xbced('0x1f1')];for(var _0x55ceae=0x0;_0x55ceae<_0x417f0a[_0xbced('0x96')];_0x55ceae+=0x1){if(_['isNil'](_0x417f0a[_0x55ceae])||_[_0xbced('0xf4')](_0x417f0a[_0x55ceae][_0xbced('0x174')])||_[_0xbced('0xf4')](_0x417f0a[_0x55ceae][_0xbced('0x15c')])){_0xc84fd5[_0xbced('0x152')](_0xbced('0x1f3'),_0x304bd0,_0x417f0a[_0x55ceae]);}else{hopperUtils[_0xbced('0x1fc')](_[_0xbced('0x71')](_0x417f0a[_0x55ceae],['VoiceQueueId',_0xbced('0x15c')]))[_0xbced('0x9a')](_0xc84fd5['checkContactBlack'](_0x304bd0,_0x417f0a[_0x55ceae]))[_0xbced('0x9d')](_0xc84fd5[_0xbced('0x1fd')](_0xbced('0x1f3'),_0x304bd0));}}}})[_0xbced('0x9d')](loggerGetContactDialer(_0xbced('0x1fe'),_0x304bd0,_0xd466ec));}};Dialer['prototype']['handlePredictive']=function(_0x4e0f52){if(_0x4e0f52[_0xbced('0x1f7')]>0x0){var _0x312c5a=_0x4e0f52[_0xbced('0x1f7')]-_0x4e0f52['originated']-_0x4e0f52['talking'];if(_0x312c5a>0x0){this[_0xbced('0x1ff')](_0x4e0f52);}else{loggerPredictiveCalls[_0xbced('0x45')](_0xbced('0x200'));}}else{this['tryOriginatePredictive'](_0x4e0f52);}};Dialer['prototype'][_0xbced('0x1ff')]=function(_0x28a04b){var _0x84422a=this;var _0x1cbf28=[];_0x28a04b[_0xbced('0x7a')]+=0x1;for(var _0x504be1 in this[_0xbced('0x1d')]){if(typeof this[_0xbced('0x1d')][_0x504be1]!==_0xbced('0xaa')){if(this['agents'][_0x504be1]['state']===_0xbced('0x1f8')&&this['agents'][_0x504be1][_0xbced('0x84')]==='reachable'){_0x1cbf28[_0xbced('0x97')](this[_0xbced('0x1d')][_0x504be1]['id']);}}}return this['getContactDialer'](_0x28a04b['id'],_0x1cbf28,0x1,_0x28a04b[_0xbced('0x201')],_0x28a04b)['then'](function(_0x4e92f8){if(!utils[_0xbced('0x1f0')](_0x4e92f8)){utils['checkContactLowerLimitOriginate'](_0x28a04b,0x1,0x0);return hopperUtils[_0xbced('0x1fa')](_0x28a04b)[_0xbced('0x9a')](sendMessageReschedule(_0x28a04b))[_0xbced('0x9d')](loggerCatch(_0xbced('0x1fb')));}else{_0x28a04b[_0xbced('0x64')]=utils[_0xbced('0x65')][_0xbced('0x1f1')];if(_[_0xbced('0xf4')](_0x4e92f8[0x0])||_['isNil'](_0x4e92f8[0x0][_0xbced('0x174')])||_[_0xbced('0xf4')](_0x4e92f8[0x0][_0xbced('0x15c')])){_0x84422a['emptyContact'](_0xbced('0x1f3'),_0x28a04b,_0x4e92f8[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x4e92f8[0x0],[_0xbced('0xe1'),'phone']))['then'](_0x84422a['checkContactBlack'](_0x28a04b,_0x4e92f8[0x0]))['catch'](_0x84422a['loggerHandler']('[actionOriginatePredictive]\x20',_0x28a04b));}}})['catch'](loggerGetContactDialer(_0xbced('0x202'),_0x28a04b,0x1));};Dialer[_0xbced('0x15')][_0xbced('0x1d3')]=function(_0x2446fb,_0x2ac36e,_0x1657fb,_0x48773f,_0x10edb9,_0x21ff01){loggerPredictive[_0xbced('0x45')](_0xbced('0x203'));loggerPredictive[_0xbced('0x45')]('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',_0x2446fb);loggerPredictive[_0xbced('0x45')](_0xbced('0x204'),_0x2ac36e);loggerPredictive['info'](_0xbced('0x205'),_0x1657fb);loggerPredictive[_0xbced('0x45')]('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',_0x48773f);loggerPredictive[_0xbced('0x45')](_0xbced('0x206'),_0x10edb9);loggerPredictive[_0xbced('0x45')](_0xbced('0x4f'));return new Promise(function(_0x6dbaff,_0x56d26b){if(_0x2446fb<=0x0||isNaN(_0x2446fb)){return _0x56d26b(msgResponse(_0xbced('0x207'),_0xbced('0x18d'),_0xbced('0x208')+_0x2446fb));}if(_0x1657fb<=0x0||isNaN(_0x1657fb)){return _0x56d26b(msgResponse(_0xbced('0x207'),'Error',_0xbced('0x209')+_0x1657fb));}if(_0x48773f<=0x0||isNaN(_0x48773f)){return _0x56d26b(msgResponse(_0xbced('0x207'),_0xbced('0x18d'),_0xbced('0x20a')+_0x48773f));}if(_0x2ac36e<=0x0||isNaN(_0x2ac36e)){return _0x56d26b(msgResponse('[abandonmentRate]','Error',_0xbced('0x20b')+_0x2ac36e));}if(_0x10edb9<=0x0||isNaN(_0x10edb9)){return _0x56d26b(msgResponse('[abandonmentRate]',_0xbced('0x18d'),_0xbced('0x20c')+_0x10edb9));}_0x21ff01=_0x21ff01||0x0;var _0x46a3bf=0x1/_0x1657fb;var _0x2afa5f=0x0;var _0x4f7b4c=0x0;var _0x18810b=0x0;var _0x26cd27=0x0;for(var _0x12ffe7=0x0;_0x18810b<_0x10edb9;_0x12ffe7+=0x1){_0x4f7b4c=_0x12ffe7/_0x2ac36e;_0x2afa5f=(_0x48773f*_0x4f7b4c+_0x21ff01)/_0x46a3bf;_0x18810b=utils[_0xbced('0x20d')](_0x2afa5f,_0x2446fb);_0x26cd27=_0x2afa5f/_0x2446fb*(0x1-utils['erlangb'](_0x2afa5f,_0x2446fb));}return _0x6dbaff({'erlangCalls':_0x12ffe7,'erlangCallToSecond':_0x2ac36e/_0x12ffe7,'erlangAbandonmentRate':_0x18810b,'erlangBusyFactor':_0x26cd27});});};Dialer[_0xbced('0x15')][_0xbced('0x20e')]=function(_0x106c73,_0x48af45,_0x37b6a8,_0x5de4ce,_0x4fc5de,_0x208eb4){loggerPredictive['info'](_0xbced('0x20f'));loggerPredictive['info'](_0xbced('0x210'),_0x106c73);loggerPredictive[_0xbced('0x45')](_0xbced('0x204'),_0x48af45);loggerPredictive['info']('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',_0x37b6a8);loggerPredictive['info'](_0xbced('0x211'),_0x5de4ce);loggerPredictive[_0xbced('0x45')](_0xbced('0x212'),_0x4fc5de);loggerPredictive['info'](_0xbced('0x4f'));return new Promise(function(_0x5ab104,_0x1fa6ca){if(_0x106c73<=0x0||isNaN(_0x106c73)){return _0x1fa6ca(msgResponse(_0xbced('0x213'),_0xbced('0x18d'),_0xbced('0x208')+_0x106c73));}if(_0x37b6a8<=0x0||isNaN(_0x37b6a8)){return _0x1fa6ca(msgResponse(_0xbced('0x213'),_0xbced('0x18d'),_0xbced('0x209')+_0x37b6a8));}if(_0x5de4ce<=0x0||isNaN(_0x5de4ce)){return _0x1fa6ca(msgResponse(_0xbced('0x213'),_0xbced('0x18d'),_0xbced('0x20a')+_0x5de4ce));}if(_0x48af45<=0x0||isNaN(_0x48af45)){return _0x1fa6ca(msgResponse(_0xbced('0x213'),'Error',_0xbced('0x20b')+_0x48af45));}if(_0x4fc5de<=0x0||isNaN(_0x4fc5de)){return _0x1fa6ca(msgResponse(_0xbced('0x213'),_0xbced('0x18d'),'Umin\x20=\x20'+_0x4fc5de));}_0x208eb4=_0x208eb4||0x0;var _0x3cc455=0x1/_0x37b6a8;var _0x347361=0x0;var _0xacfd8c=0x0;var _0x223b62=0x0;var _0x26d82c=0x0;for(var _0x29ccd3=0x0;_0x26d82c<_0x4fc5de;_0x29ccd3+=0x1){_0xacfd8c=_0x29ccd3/_0x48af45;_0x347361=(_0x5de4ce*_0xacfd8c+_0x208eb4)/_0x3cc455;_0x223b62=utils[_0xbced('0x20d')](_0x347361,_0x106c73);_0x26d82c=_0x347361/_0x106c73*(0x1-utils[_0xbced('0x20d')](_0x347361,_0x106c73));}return _0x5ab104({'erlangCalls':_0x29ccd3,'erlangCallToSecond':_0x48af45/_0x29ccd3,'erlangAbandonmentRate':_0x223b62,'erlangBusyFactor':_0x26d82c});});};module[_0xbced('0x214')]=Dialer; \ No newline at end of file +var _0x417b=['[rescheduleContact][Abandoned]','actions','channel','syncQueueMember','actionid','strategy','roundrobin','locked','stateinterface','rrmemory','isNil','queueBooked','merge','idHopper','paused','run','finally','updateOriginated','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','HANGUP','HangupInAMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','outboundAnswerAgiCallsDay','Machine','membername','AMD','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','value','[syncHangupInAMDIvr][createHistory]','countbusyretry','stateGlobal','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','syncQueueSummary','queuesSummary','running','statusMessage','available','inUse','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','sequence','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','user:dialPreviewRecallReminder','launchHandleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','%s%s','isTrunkReachable','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','round','predictiveIntervalAvailable','talking','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','predictiveIntervalHitRate','[CatchErlangB]','loggedIn','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','getContactDialer','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','lodash','uuid','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','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','erlangBusyFactor','erlangAbandonmentRate','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contactsRescheduled','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','message','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','Intervals','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','Action','iftime\x20%s,%s','content','indexOf','true','catch','push','command','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','stringify','resetActiveCalls','syncCampaigns','undefined','resolve','checkIfTime','dialGlobalInterval','checkIfTimeIntervals','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','queue','outboundAnswerCallsDay','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','dropreason','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','countabandonedretry','dialAbandonedMaxRetry','queueCallerAbandonCreateState','minutes'];(function(_0x4959ef,_0x488560){var _0x1a0a75=function(_0x35c591){while(--_0x35c591){_0x4959ef['push'](_0x4959ef['shift']());}};_0x1a0a75(++_0x488560);}(_0x417b,0x13d));var _0xb417=function(_0x5aa9df,_0x3b6e4a){_0x5aa9df=_0x5aa9df-0x0;var _0x5889cb=_0x417b[_0x5aa9df];return _0x5889cb;};'use strict';var util=require('util');var _=require(_0xb417('0x0'));var uuid=require(_0xb417('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0xb417('0x2'));var hopperUtils=require(_0xb417('0x3'));var ut=require(_0xb417('0x4'));var config=require(_0xb417('0x5'));var logger=require('../../../config/logger')(_0xb417('0x6'));var loggerBooked=require(_0xb417('0x7'))('booked');var loggerPredictive=require(_0xb417('0x7'))(_0xb417('0x8'));var loggerPredictiveCalls=require(_0xb417('0x7'))(_0xb417('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require('../ami');config[_0xb417('0xa')]=_[_0xb417('0xb')](config[_0xb417('0xa')],{'host':_0xb417('0xc'),'port':0x18eb});var io=require(_0xb417('0xd'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xb417('0xe'));var Interval=require(_0xb417('0xf'));var Action=require(_0xb417('0x10'));var History=require(_0xb417('0x11'));var Final=require(_0xb417('0x12'));var AgentComplete=require(_0xb417('0x13'));var QueueCallerAbandon=require(_0xb417('0x14'));var Hangup=require(_0xb417('0x15'));var ipAgi=process[_0xb417('0x16')][_0xb417('0x17')]||_0xb417('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xb417('0x19')][_0xb417('0x1a')]=function(_0x336b95){this[_0xb417('0x1b')]=this['tail']?this[_0xb417('0x1b')]['finally'](_0x336b95):_0x336b95();};function Dialer(_0x32ac52,_0x188646){this['sequence']=new Sequence();this[_0xb417('0x1c')]=_0x188646;this[_0xb417('0x1d')]=_0x32ac52[_0xb417('0x1d')];this[_0xb417('0x1e')]=_0x32ac52[_0xb417('0x1e')];this['agents']=_0x32ac52[_0xb417('0x1f')];this[_0xb417('0x20')]=_0x32ac52[_0xb417('0x20')];this[_0xb417('0x21')]=config[_0xb417('0x21')]||0x2;this[_0xb417('0x22')]={};this['actions']={};this[_0xb417('0x23')]={};this[_0xb417('0x24')]={};this['optionPredictive']={};this[_0xb417('0x25')]={};this[_0xb417('0x26')]={};this[_0xb417('0x27')]={};this['queueBooked']={};this['queueBookedRR']={};this['queuesSummary']={};ami['on']('agentconnect',this[_0xb417('0x28')][_0xb417('0x29')](this));ami['on'](_0xb417('0x2a'),this[_0xb417('0x2b')][_0xb417('0x29')](this));ami['on'](_0xb417('0x2c'),this[_0xb417('0x2d')][_0xb417('0x29')](this));ami['on'](_0xb417('0x2e'),this[_0xb417('0x2f')][_0xb417('0x29')](this));ami['on'](_0xb417('0x30'),this['syncQueueSummary'][_0xb417('0x29')](this));ami['on'](_0xb417('0x31'),this[_0xb417('0x32')][_0xb417('0x29')](this));ami['on'](_0xb417('0x33'),this[_0xb417('0x34')]['bind'](this));ami['on']('newexten',this[_0xb417('0x35')][_0xb417('0x29')](this));ami['on'](_0xb417('0x36'),this[_0xb417('0x37')]['bind'](this));ami['on'](_0xb417('0x38'),this['syncQueueMember'][_0xb417('0x29')](this));ami['on'](_0xb417('0x39'),this[_0xb417('0x3a')][_0xb417('0x29')](this));this[_0xb417('0x3b')]();this[_0xb417('0x3c')]();RpcSetting['getSettings']()[_0xb417('0x3d')](function(_0x30c0a1){previewRecallmeReminderInterval=_0x30c0a1[_0xb417('0x3e')];});}function isNotNull(_0x2ed226){return _0x2ed226!==null&&!_[_0xb417('0x3f')](_0x2ed226);}function msgResponse(_0xdf6da,_0x16e926,_0x5c5679){return{'action':_0xdf6da,'response':_0x16e926,'message':_0x5c5679,'stack':_0x5c5679};}function emit(_0x3b4322,_0x114d43,_0x19397a){io['to'](_0x3b4322)[_0xb417('0x40')](_0x114d43,_0x19397a);}function emitOutboundVoiceQueueSummary(_0x709563){if(_0x709563[_0xb417('0x41')]===_0xb417('0x42')){logger[_0xb417('0x43')](_0xb417('0x44'),util[_0xb417('0x45')](_0x709563,{'showHidden':![],'depth':null}));emit(util[_0xb417('0x46')](_0xb417('0x47'),_0x709563[_0xb417('0x48')]),_0xb417('0x49'),_0x709563);}}function checkGetDataPredictive(_0x5e3bd9){if(isNotNull(_0x5e3bd9)&&!_[_0xb417('0x4a')](_0x5e3bd9)){loggerPredictive['info'](_0xb417('0x4b'));loggerPredictive[_0xb417('0x4c')](_0xb417('0x4d'),_0x5e3bd9[_0xb417('0x4e')]);loggerPredictive['info'](_0xb417('0x4f'),_0x5e3bd9[_0xb417('0x50')]);loggerPredictive[_0xb417('0x4c')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e3bd9[_0xb417('0x51')]);loggerPredictive[_0xb417('0x4c')](_0xb417('0x52'),_0x5e3bd9['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xb417('0x4c')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e3bd9[_0xb417('0x53')]);loggerPredictive[_0xb417('0x4c')](_0xb417('0x54'),_0x5e3bd9[_0xb417('0x55')]);loggerPredictive[_0xb417('0x4c')](_0xb417('0x56'));if(_0x5e3bd9['predictiveIntervalTotalCalls']>0x0){if(!_[_0xb417('0x3f')](_0x5e3bd9['predictiveIntervalAvgTalktime'])&&_0x5e3bd9[_0xb417('0x55')]>0x0){return!![];}loggerPredictive[_0xb417('0x4c')](_0xb417('0x57'));if(!_[_0xb417('0x3f')](_0x5e3bd9['predictiveIntervalAvgHoldtime'])&&_0x5e3bd9['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xb417('0x4c')](_0xb417('0x58'));}else{loggerPredictive[_0xb417('0x4c')](_0xb417('0x59'));}}else{loggerPredictive[_0xb417('0x4c')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x40c46e){return function(_0x1cc245){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0xb417('0x5a'),_0x1cc245[_0xb417('0x5b')]);loggerPredictive[_0xb417('0x4c')](_0xb417('0x5c'),_0x1cc245[_0xb417('0x5d')]);loggerPredictive[_0xb417('0x4c')](_0xb417('0x5e'),_0x1cc245['erlangAbandonmentRate']);loggerPredictive[_0xb417('0x4c')](_0xb417('0x5f'),_0x1cc245[_0xb417('0x60')]);loggerPredictive[_0xb417('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cc245[_0xb417('0x61')]);loggerPredictive[_0xb417('0x4c')](_0xb417('0x56'));_['merge'](_0x40c46e,_0x1cc245);};}function ifInterval(_0x49a6ec,_0x34f661){if(_[_0xb417('0x3f')](_0x34f661)){return![];}return utils[_0xb417('0x62')](undefined,_0x34f661)<_0x49a6ec*0x3c;}function clearPredictiveAttributes(_0x4c8fad){if(_0x4c8fad[_0xb417('0x26')]){_0x4c8fad[_0xb417('0x26')]=undefined;loggerPredictive[_0xb417('0x43')](_0x4c8fad[_0xb417('0x48')],_0xb417('0x63'));}if(_0x4c8fad['startPredictive']){_0x4c8fad['startPredictive']=undefined;loggerPredictive['debug'](_0x4c8fad['name'],_0xb417('0x64'));}if(_0x4c8fad['handlePredictive']){clearInterval(_0x4c8fad[_0xb417('0x65')]);_0x4c8fad[_0xb417('0x65')]=undefined;loggerPredictive[_0xb417('0x43')](_0x4c8fad[_0xb417('0x48')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x579667,_0x50f3ba){return function(_0x500670){loggerPredictive[_0xb417('0x66')](_0x50f3ba[_0xb417('0x48')],_0x579667);loggerPredictive[_0xb417('0x66')](_0x500670[_0xb417('0x67')]);clearPredictiveAttributes(_0x50f3ba);};}function loggerCatch(_0x18618c){return function(_0x745286){logger[_0xb417('0x66')](_0x18618c,util[_0xb417('0x45')](_0x745286,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x54330f,_0x38cfc8,_0x381596){return function(_0x196e13){utils[_0xb417('0x68')](_0x38cfc8,_0x381596,0x0);logger[_0xb417('0x66')](_0x54330f,util[_0xb417('0x45')](_0x196e13,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x8af3e4){return function(_0x40f124){if(isNotNull(_0x40f124)&&isNotNull(_0x40f124[0x0])){if(_0x40f124[0x0]['contactsRescheduled']>0x0){_0x8af3e4['message']=utils[_0xb417('0x69')]['CONTACTS_RESCHEDULED'];logger['info'](_0xb417('0x6a')+_0x8af3e4[_0xb417('0x48')],_0x40f124[0x0][_0xb417('0x6b')],'contacts');}else{_0x8af3e4['message']=utils[_0xb417('0x69')][_0xb417('0x6c')];logger[_0xb417('0x4c')](_0xb417('0x6d')+_0x8af3e4[_0xb417('0x48')]);}}};}function createObjHistory(_0xe8a356,_0x365d8a,_0x1105cd,_0x514fb4,_0x6aed8f){_0xe8a356[_0xb417('0x6e')]=_0x1105cd;var _0x25a72d=new Action(_0xe8a356,_0x365d8a);var _0x501a29=new History(_0x25a72d);_0x501a29[_0xb417('0x6f')]=_0x514fb4;_0x501a29['statedesc']=_0x6aed8f;_0x501a29[_0xb417('0x70')]=_0x25a72d[_0xb417('0x71')];return _0x501a29;}function unlockQueueStatus(_0x4b0f8b,_0x580c42){setTimeout(function(){if(_[_0xb417('0x3f')](_0x4b0f8b[_0xb417('0x72')])){loggerBooked[_0xb417('0x66')](_0xb417('0x73'),_0x580c42);}_0x4b0f8b[_0xb417('0x72')]=!![];loggerBooked[_0xb417('0x4c')](_0xb417('0x74'),_0x580c42,JSON['stringify'](_[_0xb417('0x75')](_0x4b0f8b,[_0xb417('0x48'),_0xb417('0x72')])));},0x1f3);}function checkInterval(_0x7110d6){return function(){if(!isNotNull(_0x7110d6[_0xb417('0x76')])){_0x7110d6[_0xb417('0x6e')]=utils[_0xb417('0x69')]['NULL_INTERVAL'];throw _0x7110d6[_0xb417('0x48')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x7110d6[_0xb417('0x76')][_0xb417('0x77')])){_0x7110d6[_0xb417('0x6e')]=utils['CAMPAIGN_STATUS'][_0xb417('0x78')];throw _0x7110d6['name']+_0xb417('0x79');}if(!isNotNull(_[_0xb417('0x4a')](_0x7110d6['Interval'][_0xb417('0x77')]))){_0x7110d6[_0xb417('0x6e')]=utils[_0xb417('0x69')][_0xb417('0x78')];throw _0x7110d6[_0xb417('0x48')]+_0xb417('0x79');}};}function checkIsIVRCampaignActive(_0x3af0f1){return function(){if(!utils[_0xb417('0x7a')](_0x3af0f1)){_0x3af0f1[_0xb417('0x6e')]=utils[_0xb417('0x69')][_0xb417('0x7b')];throw _0x3af0f1['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x2784da){if(utils[_0xb417('0x7c')](_0x2784da)){emit(util[_0xb417('0x46')]('campaign:ivr:%s',_0x2784da['name']),_0xb417('0x7d'),_0x2784da);}}function loggerCatchQueueSummary(_0x3dd3d2,_0x2197f2){return function(_0x5cd470){clearPredictiveAttributes(_0x2197f2);emitCampaignSummary(_0x2197f2);loggerSyncQueueSummary[_0xb417('0x43')](_0x3dd3d2,util[_0xb417('0x45')](_0x5cd470,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x78d10a){if(_0x78d10a[_0xb417('0x7e')]){if(_0x78d10a[_0xb417('0x7f')]===0x0){_0x78d10a[_0xb417('0x7e')]=![];_0x78d10a['message']=utils[_0xb417('0x69')][_0xb417('0x7b')];loggerSyncQueueSummary[_0xb417('0x43')](_0xb417('0x80'),_0x78d10a[_0xb417('0x48')],_0xb417('0x81'));}else{_0x78d10a[_0xb417('0x6e')]=utils[_0xb417('0x69')]['DISACTIVED'];loggerSyncQueueSummary[_0xb417('0x43')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x78d10a[_0xb417('0x48')],_0xb417('0x82'));}emitCampaignSummary(_0x78d10a);}}function myreject(_0x3eb9e4){return function(_0x463d01){return _0x3eb9e4(msgResponse(_0xb417('0x83'),_0xb417('0x84'),JSON['stringify'](_0x463d01)));};}Dialer[_0xb417('0x19')]['isTrunkReachable']=function(_0x186982){return!_['isUndefined'](_0x186982)&&_0x186982&&!_[_0xb417('0x3f')](_0x186982['name'])&&!_[_0xb417('0x3f')](_0x186982[_0xb417('0x85')])&&_0x186982['active']&&(this[_0xb417('0x20')][util['format'](_0xb417('0x86'),_0x186982[_0xb417('0x48')])][_0xb417('0x87')]===_0xb417('0x88')||this[_0xb417('0x20')][util['format'](_0xb417('0x86'),_0x186982['name'])][_0xb417('0x87')]===_0xb417('0x89'));};Dialer[_0xb417('0x19')][_0xb417('0x8a')]=function(_0x13f04d){var _0xe61709=this;return function(){if(!_0xe61709['isTrunkReachable'](_0x13f04d[_0xb417('0x8b')])){if(!_0xe61709['isTrunkReachable'](_0x13f04d[_0xb417('0x8c')])){_0x13f04d['message']=utils[_0xb417('0x69')][_0xb417('0x8d')];throw _0x13f04d['name']+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype']['checkIfTime']=function(_0x261534,_0xe4496d,_0x27c2fd,_0x1355d5){var _0x9dfa5e=this;return function(){var _0x48bc64=!![];return _0x9dfa5e['ifTimeIvr'](_0x261534,_0xe4496d,_0x27c2fd,_0x1355d5,_0x48bc64);};};Dialer[_0xb417('0x19')]['checkIfTimeIntervals']=function(_0x2aa4a3,_0x43bba1,_0x4de27c,_0x33d157){var _0x4e56d9=this;return function(){var _0x3ba12c=![];return _0x4e56d9[_0xb417('0x8e')](_0x2aa4a3['Intervals'],_0x43bba1,_0x4de27c,_0x33d157,_0x3ba12c);};};Dialer[_0xb417('0x19')]['ifTimeIvr']=function(_0x43f795,_0x45259c,_0x28ab69,_0x5943a6,_0x1f5a19){var _0x401b35=[];return new Promise(function(_0x383ace,_0x34bd10){if(!isNotNull(_0x43f795)){_0x5943a6['message']=utils[_0xb417('0x69')][_0xb417('0x78')];return _0x34bd10(msgResponse(_0xb417('0x8f'),_0xb417('0x90'),_0x28ab69+_0xb417('0x91')));}if(_[_0xb417('0x4a')](_0x43f795)){_0x5943a6[_0xb417('0x6e')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x34bd10(msgResponse(_0xb417('0x8f'),_0xb417('0x90'),_0x28ab69+_0xb417('0x92')));}if(_0x45259c&&_[_0xb417('0x3f')](config[_0xb417('0x93')][_0x45259c])){_0x5943a6[_0xb417('0x6e')]=utils[_0xb417('0x69')][_0xb417('0x94')];return _0x34bd10(msgResponse(_0xb417('0x8f'),_0xb417('0x90'),_0x28ab69+_0xb417('0x95')+_0x45259c));}if(_['isArray'](_0x43f795)){for(var _0x30ecc5=0x0;_0x30ecc5<_0x43f795[_0xb417('0x96')];_0x30ecc5+=0x1){_0x401b35['push'](ami[_0xb417('0x97')]({'action':'command','command':util[_0xb417('0x46')](_0xb417('0x98'),_0x43f795[_0x30ecc5]['interval'],!_['isUndefined'](config[_0xb417('0x93')][_0x45259c])?_0x45259c:'')})[_0xb417('0x3d')](function(_0x39a916){return _0x39a916[_0xb417('0x99')][_0xb417('0x9a')](_0xb417('0x9b'))>=0x0;})[_0xb417('0x9c')](myreject(_0x34bd10)));}}else{_0x401b35[_0xb417('0x9d')](ami['Action']({'action':_0xb417('0x9e'),'command':util[_0xb417('0x46')](_0xb417('0x98'),_0x43f795,!_['isUndefined'](config[_0xb417('0x93')][_0x45259c])?_0x45259c:'')})[_0xb417('0x3d')](function(_0x126937){return _0x126937[_0xb417('0x99')][_0xb417('0x9a')]('true')>=0x0;})[_0xb417('0x9c')](myreject(_0x34bd10)));}Promise[_0xb417('0x9f')](_0x401b35)[_0xb417('0x3d')](function(_0x2ae1b9){var _0x4353b0=_[_0xb417('0xa0')](_0x2ae1b9);if(_0x4353b0){return _0x383ace(_0x4353b0);}else{_0x5943a6[_0xb417('0x6e')]=_0x1f5a19?utils['CAMPAIGN_STATUS'][_0xb417('0xa1')]:utils[_0xb417('0x69')][_0xb417('0xa2')];return _0x34bd10(msgResponse(_0xb417('0xa3'),'Failure',_0xb417('0xa4')+_0x1f5a19+'\x20'+_0x28ab69+_0xb417('0xa5')+util[_0xb417('0x45')](_0x43f795,{'showHidden':![],'depth':null})+_0xb417('0xa6')+_0x45259c));}})[_0xb417('0x9c')](function(_0x1d58e7){return _0x34bd10(msgResponse(_0xb417('0x8f'),'Failure',JSON[_0xb417('0xa7')](_0x1d58e7)));});});};Dialer[_0xb417('0x19')][_0xb417('0x3b')]=function(){var _0x2d56d3=this;return cmHopper[_0xb417('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0xb417('0x3d')](function(){setInterval(function(){_0x2d56d3[_0xb417('0xa9')]();},0x3e8);});};Dialer['prototype']['syncCampaigns']=function(){var _0x37fd52=this;var _0x132e5b;for(var _0x358f56 in this[_0xb417('0x1e')]){if(typeof this['campaigns'][_0x358f56]!==_0xb417('0xaa')){_0x132e5b=this[_0xb417('0x1e')][_0x358f56];if(utils[_0xb417('0x7c')](_0x132e5b)&&utils['isIVRCampaignActive'](_0x132e5b)){_0x132e5b['sendMessageOneNotActive']=!![];Promise[_0xb417('0xab')]()[_0xb417('0x3d')](checkIsIVRCampaignActive(_0x132e5b))[_0xb417('0x3d')](checkInterval(_0x132e5b))[_0xb417('0x3d')](_0x37fd52[_0xb417('0x8a')](_0x132e5b))[_0xb417('0x3d')](_0x37fd52[_0xb417('0xac')](_0x132e5b[_0xb417('0xad')],_0x132e5b['dialTimezone'],_0x132e5b['name'],_0x132e5b))['then'](_0x37fd52[_0xb417('0xae')](_0x132e5b[_0xb417('0x76')],_0x132e5b['dialTimezone'],_0x132e5b[_0xb417('0x48')],_0x132e5b))[_0xb417('0x3d')](_0x37fd52['launchHandleIvr'](_0x132e5b))[_0xb417('0x9c')](loggerCatchQueueSummary(_0xb417('0xaf'),_0x132e5b));}else{notSendMessagesCampaign(_0x132e5b);}}}};Dialer[_0xb417('0x19')][_0xb417('0xb0')]=function(_0x1dac7b){if(_0x1dac7b[_0xb417('0xb1')]!==_0xb417('0x8')){clearPredictiveAttributes(_0x1dac7b);}switch(_0x1dac7b['dialMethod']){case _0xb417('0xb2'):this['handlePower'](_0x1dac7b,0x1);break;case _0xb417('0xb3'):this[_0xb417('0xb4')](_0x1dac7b,_0x1dac7b[_0xb417('0xb5')]);break;case _0xb417('0x8'):this[_0xb417('0x8')](_0x1dac7b);break;case _0xb417('0xb6'):this[_0xb417('0xb4')](_0x1dac7b,0x1);break;default:logger['error'](_0xb417('0xb7'),_0x1dac7b[_0xb417('0x48')],_0xb417('0xb8'));}};Dialer[_0xb417('0x19')]['ifTime']=function(_0x4d9309,_0x17d5fc){var _0x40c3d4=_0x4d9309['dialTimezone'];var _0x2c31b6=_0x17d5fc?_0x4d9309[_0xb417('0xad')]:_0x4d9309[_0xb417('0x76')][_0xb417('0x77')];logger[_0xb417('0xb9')](_0xb417('0xba'),_0x2c31b6,_0x40c3d4,_0x4d9309[_0xb417('0x48')],util[_0xb417('0x46')]('Voice\x20Queue\x20%s\x20$s',_0x4d9309[_0xb417('0x48')],_0x4d9309['id']));var _0x1e12d3=null;return Interval[_0xb417('0xbb')](_0x2c31b6,_0x40c3d4)[_0xb417('0x3d')](function(_0x58308b){if(_0x58308b===!![]){return _0x58308b;}else{_0x4d9309[_0xb417('0x6e')]=_0x17d5fc?utils[_0xb417('0x69')][_0xb417('0xa1')]:utils[_0xb417('0x69')][_0xb417('0xa2')];_0x1e12d3=msgResponse(_0xb417('0xa3'),_0xb417('0x90'),_0xb417('0xa4')+_0x17d5fc+'\x20'+_0x4d9309[_0xb417('0x48')]+_0xb417('0xa5')+util[_0xb417('0x45')](_0x2c31b6,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x40c3d4);}if(_0x1e12d3!==null){logger[_0xb417('0xb9')](_0xb417('0xbc'),_0x1e12d3);_0x1e12d3['isGlobal']=_0x17d5fc;throw _0x1e12d3;}})['catch'](function(_0xdecdcb){logger[_0xb417('0x66')](_0xb417('0xbd'),_0xdecdcb);throw msgResponse(_0xb417('0x83'),_0xb417('0x84'),util[_0xb417('0x45')](_0xdecdcb,{'showHidden':![],'depth':null}));});};Dialer[_0xb417('0x19')][_0xb417('0x28')]=function(_0x48b6c3){if(this[_0xb417('0x1d')][_0x48b6c3['queue']]){if(this['uniqueId'][_0x48b6c3[_0xb417('0xbe')]]&&this[_0xb417('0x24')][_0x48b6c3[_0xb417('0xbe')]]['type']!==_0xb417('0xbf')){this['updateOriginated'](this[_0xb417('0x1d')][_0x48b6c3['queue']]);this['uniqueId'][_0x48b6c3[_0xb417('0xbe')]][_0xb417('0xc0')]=moment()['format'](_0xb417('0xc1'));}}};Dialer[_0xb417('0x19')][_0xb417('0x2f')]=function(_0x4e56cf){var _0x2eef04=this['uniqueId'][_0x4e56cf[_0xb417('0xbe')]];if(this[_0xb417('0x1d')][_0x4e56cf[_0xb417('0xc2')]]){if(_0x2eef04&&_0x2eef04[_0xb417('0x41')]!==_0xb417('0xbf')){delete this[_0xb417('0x24')][_0x4e56cf['uniqueid']];this['voiceQueues'][_0x4e56cf[_0xb417('0xc2')]][_0xb417('0xc3')]+=0x1;var _0x3a08c3=new AgentComplete(_0x2eef04,_0x4e56cf);if(_0x4e56cf[_0xb417('0xc4')]===_0xb417('0xc5')){_0x3a08c3[_0xb417('0xc6')]=this[_0xb417('0x1d')][_0x4e56cf['queue']]['dialQueueProject2']&&this['voiceQueues'][_0x4e56cf[_0xb417('0xc2')]][_0xb417('0xc7')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x3a08c3)['catch'](loggerCatch(_0xb417('0xc8')));hopperUtils[_0xb417('0xc9')](_0x3a08c3)['catch'](loggerCatch(_0xb417('0xca')));}}};Dialer[_0xb417('0x19')]['syncQueueCallerAbandon']=function(_0x1c6a93){var _0x328069=this['uniqueId'][_0x1c6a93[_0xb417('0xbe')]];var _0x1e2021=this;var _0x165981=![];var _0x36671b;var _0x4fff88;if(this[_0xb417('0x1d')][_0x1c6a93[_0xb417('0xc2')]]){if(_0x328069&&_0x328069[_0xb417('0x41')]!==_0xb417('0xbf')){delete this[_0xb417('0x24')][_0x1c6a93[_0xb417('0xbe')]];this['updateOriginated'](this['voiceQueues'][_0x1c6a93[_0xb417('0xc2')]]);_0x328069[_0xb417('0xcb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x30b0e4=new QueueCallerAbandon(_0x328069,_0x1c6a93);if(utils[_0xb417('0x62')](_0x328069['droptime'],_0x328069['responsetime'])>=_0x328069[_0xb417('0xcc')]){this[_0xb417('0x1d')][_0x1c6a93[_0xb417('0xc2')]][_0xb417('0x51')]+=0x1;this[_0xb417('0x1d')][_0x1c6a93[_0xb417('0xc2')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xb417('0x1d')][_0x1c6a93['queue']][_0xb417('0xcd')]+=0x1;_0x30b0e4[_0xb417('0x6f')]=0xa;_0x30b0e4[_0xb417('0xce')]='Drop';_0x30b0e4[_0xb417('0xcf')]='TIMEOUT';_0x30b0e4[_0xb417('0xc6')]=this[_0xb417('0x1d')][_0x1c6a93[_0xb417('0xc2')]][_0xb417('0xd0')]?moment()['format'](_0xb417('0xc1')):undefined;_0x30b0e4[_0xb417('0xd1')]+=0x1;_0x30b0e4[_0xb417('0xd2')]+=0x1;_0x36671b=this['voiceQueues'][_0x1c6a93[_0xb417('0xc2')]][_0xb417('0xd3')];_0x4fff88=this[_0xb417('0x1d')][_0x1c6a93[_0xb417('0xc2')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xb417('0xd4')](_0x30b0e4,_0x30b0e4[_0xb417('0x6f')],_0x328069[_0xb417('0xd5')])[_0xb417('0x3d')](function(_0x3ff0c5){_0x165981=_0x3ff0c5[_0xb417('0xd6')]==0x1;if(_0x30b0e4['countdropretry']>=_0x1e2021[_0xb417('0x1d')][_0x1c6a93[_0xb417('0xc2')]][_0xb417('0xd7')]){_0x1e2021['queueCallerAbandonCreateState'](_0x30b0e4,_0x3ff0c5[_0xb417('0xd6')]);}else{hopperUtils[_0xb417('0xd8')]({'active':![],'countdropretry':_0x30b0e4[_0xb417('0xd1')],'scheduledat':moment()['add'](_0x1e2021['voiceQueues'][_0x1c6a93[_0xb417('0xc2')]][_0xb417('0xd3')],'minutes')['format'](_0xb417('0xc1')),'ContactId':_0x328069[_0xb417('0xd9')],'ListId':_0x328069[_0xb417('0xda')],'VoiceQueueId':_0x328069[_0xb417('0xdb')]||undefined,'CampaignId':_0x328069[_0xb417('0xdc')]||undefined})[_0xb417('0x9c')](loggerCatch(_0xb417('0xdd')));var _0x1a45a9=new History(_0x30b0e4);_0x1a45a9[_0xb417('0x6f')]=0xa;_0x1a45a9[_0xb417('0xce')]='Drop';_0x1a45a9[_0xb417('0x71')]=moment()['format'](_0xb417('0xc1'));_0x1a45a9[_0xb417('0x70')]=_0x1a45a9[_0xb417('0x71')];_0x1a45a9['calleridname']=_0x30b0e4[_0xb417('0xde')];_0x1a45a9['calleridnum']=_0x30b0e4[_0xb417('0xdf')];hopperUtils[_0xb417('0xe0')](_0x1a45a9)[_0xb417('0x9c')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x165981)hopperUtils[_0xb417('0xe1')](_0x30b0e4,_0x36671b,_0x4fff88)[_0xb417('0x3d')](function(){return 0x1;});});}else{this[_0xb417('0x1d')][_0x1c6a93[_0xb417('0xc2')]][_0xb417('0xe2')]+=0x1;this[_0xb417('0x1d')][_0x1c6a93[_0xb417('0xc2')]][_0xb417('0xe3')]+=0x1;_0x30b0e4[_0xb417('0x6f')]=0xb;_0x30b0e4[_0xb417('0xce')]=_0xb417('0xe4');_0x30b0e4[_0xb417('0xcf')]=_0xb417('0xe5');_0x30b0e4['countabandonedretry']+=0x1;_0x30b0e4[_0xb417('0xd2')]+=0x1;_0x36671b=this['voiceQueues'][_0x1c6a93['queue']][_0xb417('0xe6')];_0x4fff88=this[_0xb417('0x1d')][_0x1c6a93[_0xb417('0xc2')]][_0xb417('0xe7')];hopperUtils[_0xb417('0xd4')](_0x30b0e4,_0x30b0e4[_0xb417('0x6f')],_0x328069['voiceQueue'])[_0xb417('0x3d')](function(_0x443061){if(_0x30b0e4[_0xb417('0xe8')]>=_0x1e2021['voiceQueues'][_0x1c6a93['queue']][_0xb417('0xe9')]){_0x1e2021[_0xb417('0xea')](_0x30b0e4,_0x443061[_0xb417('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x30b0e4['countabandonedretry'],'scheduledat':moment()['add'](_0x1e2021['voiceQueues'][_0x1c6a93[_0xb417('0xc2')]][_0xb417('0xe6')],_0xb417('0xeb'))['format'](_0xb417('0xc1')),'ContactId':_0x328069[_0xb417('0xd9')],'ListId':_0x328069[_0xb417('0xda')],'VoiceQueueId':_0x328069[_0xb417('0xdb')]||undefined,'CampaignId':_0x328069[_0xb417('0xdc')]||undefined})['catch'](loggerCatch(_0xb417('0xec')));var _0x55cad3=new History(_0x30b0e4);_0x55cad3['state']=0xb;_0x55cad3[_0xb417('0xce')]=_0xb417('0xe4');_0x55cad3[_0xb417('0x71')]=moment()[_0xb417('0x46')](_0xb417('0xc1'));_0x55cad3[_0xb417('0x70')]=_0x55cad3['starttime'];_0x55cad3[_0xb417('0xde')]=_0x30b0e4[_0xb417('0xde')];_0x55cad3['calleridnum']=_0x30b0e4['calleridnum'];hopperUtils[_0xb417('0xe0')](_0x55cad3)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xb417('0x3d')](function(){if(_0x165981)hopperUtils[_0xb417('0xe1')](_0x30b0e4,_0x36671b,_0x4fff88)['then'](function(){return 0x1;});});}}}};Dialer[_0xb417('0x19')][_0xb417('0x35')]=function(_0x2dd0b9){if(this['actions'][_0x2dd0b9['uniqueid']]){this[_0xb417('0xed')][_0x2dd0b9[_0xb417('0xbe')]]['channel']=_0x2dd0b9['channel'];}if(this[_0xb417('0x24')][_0x2dd0b9[_0xb417('0xbe')]]){this[_0xb417('0x24')][_0x2dd0b9[_0xb417('0xbe')]][_0xb417('0xee')]=_0x2dd0b9[_0xb417('0xee')];}};Dialer[_0xb417('0x19')][_0xb417('0xef')]=function(_0x6a6211){if(!this['actions'][_0x6a6211[_0xb417('0xf0')]]){return;}var _0x51c3ef=this[_0xb417('0x1d')][this[_0xb417('0xed')][_0x6a6211[_0xb417('0xf0')]][_0xb417('0xc2')]][_0xb417('0xf1')]||'rrmemory';if(_0x51c3ef===_0xb417('0xf2')){if(this[_0xb417('0xed')][_0x6a6211[_0xb417('0xf0')]]&&_['isNil'](this['actions'][_0x6a6211[_0xb417('0xf0')]][_0xb417('0xf3')])&&_0x6a6211[_0xb417('0x87')]==='1'&&_0x6a6211['paused']==='0'){if(this['agents'][_0x6a6211['stateinterface']]){if(!this[_0xb417('0x1f')][_0x6a6211[_0xb417('0xf4')]]['locked']){this[_0xb417('0x1f')][_0x6a6211['stateinterface']][_0xb417('0xf3')]=!![];this[_0xb417('0xed')][_0x6a6211[_0xb417('0xf0')]][_0xb417('0xf3')]=!![];this[_0xb417('0xed')][_0x6a6211[_0xb417('0xf0')]][_0xb417('0xf4')]=_0x6a6211[_0xb417('0xf4')];}}}}else if(_0x51c3ef===_0xb417('0xf5')){if(this[_0xb417('0xed')][_0x6a6211['actionid']]){if(this[_0xb417('0x1f')][_0x6a6211['stateinterface']]){this['actions'][_0x6a6211[_0xb417('0xf0')]][_0xb417('0xf4')]=_0x6a6211[_0xb417('0xf4')];if(_[_0xb417('0xf6')](this['queueBooked'][this[_0xb417('0xed')][_0x6a6211[_0xb417('0xf0')]]['queue']])){this[_0xb417('0xf7')][this[_0xb417('0xed')][_0x6a6211[_0xb417('0xf0')]][_0xb417('0xc2')]]=[];}this[_0xb417('0xf7')][this[_0xb417('0xed')][_0x6a6211[_0xb417('0xf0')]]['queue']][_0xb417('0x9d')](_[_0xb417('0xf8')](_[_0xb417('0x75')](this[_0xb417('0xed')][_0x6a6211['actionid']],[_0xb417('0xf9'),_0xb417('0xf4')]),{'status':_0x6a6211[_0xb417('0x87')],'paused':_0x6a6211[_0xb417('0xfa')]}));}}}};Dialer[_0xb417('0x19')]['syncQueueStatusComplete']=function(_0x4700f7){if(!this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]]){return;}var _0x2e43a6=this;var _0x59b505=this[_0xb417('0x1d')][this['actions'][_0x4700f7['actionid']][_0xb417('0xc2')]];var _0x592ad0=_0x59b505[_0xb417('0xf1')]||_0xb417('0xf5');if(_0x592ad0==='roundrobin'){if(this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]]&&this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xf4')]){this['preview'][_0xb417('0xfb')](this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xf9')],this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]]['stateinterface'])[_0xb417('0x9c')](function(_0x5b4043){logger[_0xb417('0x66')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xb417('0x45')](_0x5b4043,{'showHidden':![],'depth':null}));})[_0xb417('0xfc')](function(){_0x2e43a6[_0xb417('0xfd')](_0x2e43a6[_0xb417('0x1d')][_0x2e43a6[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xc2')]]);_0x2e43a6[_0xb417('0x1f')][_0x2e43a6[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xf4')]][_0xb417('0xf3')]=![];delete _0x2e43a6[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]];unlockQueueStatus(_0x59b505);});}else{this[_0xb417('0xfd')](this[_0xb417('0x1d')][this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xc2')]]);hopperUtils[_0xb417('0xd8')]({'active':![],'ContactId':this[_0xb417('0xed')][_0x4700f7['actionid']][_0xb417('0xd9')],'ListId':this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xda')],'VoiceQueueId':this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xdc')]||undefined})[_0xb417('0x9c')](loggerCatch(_0xb417('0xfe')));delete this[_0xb417('0xed')][_0x4700f7['actionid']];unlockQueueStatus(_0x59b505);}}else if(_0x592ad0==='rrmemory'){var _0x1ae7f4;if(this[_0xb417('0xed')][_0x4700f7['actionid']]&&!_[_0xb417('0x4a')](this[_0xb417('0xf7')][this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xc2')]])){if(this[_0xb417('0xff')][_0x2e43a6[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xc2')]]){this[_0xb417('0xff')][_0x2e43a6['actions'][_0x4700f7[_0xb417('0xf0')]]['queue']]=this[_0xb417('0xff')][this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xc2')]]?this[_0xb417('0xff')][this[_0xb417('0xed')][_0x4700f7['actionid']][_0xb417('0xc2')]]:this[_0xb417('0xf7')][this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xc2')]]?this[_0xb417('0xf7')][this[_0xb417('0xed')][_0x4700f7[_0xb417('0xf0')]][_0xb417('0xc2')]][_0xb417('0x100')]||0x0:0x0;}this[_0xb417('0xf7')][this[_0xb417('0xed')][_0x4700f7['actionid']][_0xb417('0xc2')]][_0xb417('0x100')]=this[_0xb417('0xff')][this[_0xb417('0xed')][_0x4700f7['actionid']]['queue']];for(var _0x2523bb=0x0;_0x2523bb=_0x15842e[_0xb417('0x127')]){_0x4a5f54['stateGlobal'](_0x5e8a09,_0x44c32b,_0x1804e0,_0xb417('0x128'));}else{if(_0x5e8a09['countmachineretry']>=_0x15842e[_0xb417('0x129')]){_0x4a5f54[_0xb417('0x12a')](_0x5e8a09,_0x44c32b,_0x1804e0,_0xb417('0x12b'));}else{hopperUtils[_0xb417('0xd8')]({'active':![],'countmachineretry':_0x5e8a09[_0xb417('0x120')],'scheduledat':moment()[_0xb417('0x12c')](_0x15842e[_0xb417('0x12d')],_0xb417('0xeb'))[_0xb417('0x46')](_0xb417('0xc1')),'ContactId':_0x5e8a09[_0xb417('0xd9')],'ListId':_0x5e8a09['ListId'],'VoiceQueueId':_0x5e8a09[_0xb417('0xdb')]||undefined,'CampaignId':_0x5e8a09[_0xb417('0xdc')]||undefined})[_0xb417('0x9c')](loggerCatch('[rescheduleContact][Machine]'));_0x44c32b({'reschedule':0x1});}}});}if(_0x460501[_0xb417('0x41')]===_0xb417('0xbf')&&this[_0xb417('0x1e')][_0x460501['queue']]['dialAMDActive']&&_0x10e0b6[_0xb417('0x12e')]===_0xb417('0x115')){delete this['uniqueId'][_0x10e0b6[_0xb417('0xbe')]];this[_0xb417('0xfd')](this[_0xb417('0x1e')][_0x460501[_0xb417('0xc2')]]);_0x2e85ea=new Hangup(_0x460501,_0x10e0b6);_0x2e85ea[_0xb417('0x6f')]=0x12;_0x2e85ea[_0xb417('0xce')]=_0xb417('0x116');_0x2e85ea[_0xb417('0x11e')]=_0xb417('0x11f');ami[_0xb417('0x40')](_0xb417('0x121'),ut[_0xb417('0x117')](_0x2e85ea,_0xb417('0x118')));this[_0xb417('0x119')](_0x2e85ea,_0xb417('0x12f'),'[syncHangupInAMDIvr]');}if(_0x460501[_0xb417('0x41')]===_0xb417('0xbf')&&this['campaigns'][_0x460501[_0xb417('0xc2')]][_0xb417('0x114')]&&_0x10e0b6[_0xb417('0x12e')]===_0xb417('0x11b')){return new Promise(function(_0x96a5fa,_0x44a529){delete _0x4a5f54[_0xb417('0x24')][_0x10e0b6[_0xb417('0xbe')]];_0x4a5f54[_0xb417('0xfd')](_0x4a5f54[_0xb417('0x1e')][_0x460501[_0xb417('0xc2')]]);_0x4a5f54[_0xb417('0x1e')][_0x460501[_0xb417('0xc2')]][_0xb417('0xc3')]+=0x1;_0x4a5f54[_0xb417('0x1e')][_0x460501[_0xb417('0xc2')]][_0xb417('0x11c')]+=0x1;var _0x2f79ea=_0x4a5f54[_0xb417('0x1e')][_0x460501[_0xb417('0xc2')]];var _0x1b8b59=new Hangup(_0x460501,_0x10e0b6);_0x1b8b59[_0xb417('0x6f')]=0x13;_0x1b8b59[_0xb417('0xce')]=_0xb417('0x11d');_0x1b8b59[_0xb417('0x11e')]=_0xb417('0x11f');_0x1b8b59[_0xb417('0x120')]+=0x1;_0x1b8b59[_0xb417('0xd2')]+=0x1;_0x1b8b59[_0xb417('0x118')]=!![];ami[_0xb417('0x40')]('custom:amd',ut[_0xb417('0x117')](_0x1b8b59,_0xb417('0x118')));hopperUtils[_0xb417('0xe0')](_0x1b8b59)[_0xb417('0x9c')](loggerCatch(_0xb417('0x122')));if(_0x1b8b59[_0xb417('0x130')]+_0x1b8b59[_0xb417('0x123')]+_0x1b8b59['countnoanswerretry']+_0x1b8b59['countnosuchnumberretry']+_0x1b8b59[_0xb417('0xd1')]+_0x1b8b59['countabandonedretry']+_0x1b8b59['countmachineretry']+_0x1b8b59[_0xb417('0x126')]>=_0x2f79ea[_0xb417('0x127')]){_0x4a5f54[_0xb417('0x131')](_0x1b8b59,_0x96a5fa,_0x44a529,_0xb417('0x128'));}else{if(_0x1b8b59['countmachineretry']>=_0x2f79ea[_0xb417('0x129')]){_0x4a5f54[_0xb417('0x12a')](_0x1b8b59,_0x96a5fa,_0x44a529,_0xb417('0x12b'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x1b8b59['countmachineretry'],'scheduledat':moment()[_0xb417('0x12c')](_0x2f79ea['dialMachineRetryFrequency'],'minutes')[_0xb417('0x46')](_0xb417('0xc1')),'ContactId':_0x1b8b59[_0xb417('0xd9')],'ListId':_0x1b8b59[_0xb417('0xda')],'VoiceQueueId':_0x1b8b59[_0xb417('0xdb')]||undefined,'CampaignId':_0x1b8b59['CampaignId']||undefined})['catch'](loggerCatch(_0xb417('0x132')));_0x96a5fa({'reschedule':0x1});}}});}}};Dialer[_0xb417('0x19')][_0xb417('0x34')]=function(_0x32b92a){var _0x27215d=this[_0xb417('0x24')][_0x32b92a[_0xb417('0xbe')]];var _0x12118c;if(_0x27215d&&_0x27215d[_0xb417('0x41')]===_0xb417('0xbf')){delete this[_0xb417('0x24')][_0x32b92a['uniqueid']];this['updateOriginated'](this['campaigns'][_0x27215d['queue']]);this['campaigns'][_0x27215d[_0xb417('0xc2')]][_0xb417('0x133')]+=0x1;_0x12118c=new Hangup(_0x27215d,_0x32b92a);hopperUtils['createHistory'](_0x12118c)[_0xb417('0x9c')](loggerCatch(_0xb417('0x134')));hopperUtils[_0xb417('0xc9')](_0x12118c)['catch'](loggerCatch(_0xb417('0x135')));}if(_0x27215d&&_0x27215d[_0xb417('0x41')]!==_0xb417('0xbf')&&isNotNull(this[_0xb417('0x1d')][_0x27215d[_0xb417('0xc2')]][_0xb417('0x136')])){delete this[_0xb417('0x24')][_0x32b92a[_0xb417('0xbe')]];this[_0xb417('0xfd')](this[_0xb417('0x1d')][_0x27215d['queue']]);this['voiceQueues'][_0x27215d[_0xb417('0xc2')]]['outboundAnswerCallsDay']+=0x1;this[_0xb417('0x1d')][_0x27215d[_0xb417('0xc2')]][_0xb417('0x11c')]+=0x1;_0x12118c=new Hangup(_0x27215d,_0x32b92a);_0x12118c[_0xb417('0x6f')]=0x10;_0x12118c[_0xb417('0xce')]=_0xb417('0x137');_0x12118c[_0xb417('0x11e')]=_0xb417('0x138');hopperUtils[_0xb417('0xe0')](_0x12118c)['catch'](loggerCatch(_0xb417('0x134')));hopperUtils[_0xb417('0xc9')](_0x12118c)['catch'](loggerCatch(_0xb417('0x135')));}if(_0x27215d&&_0x27215d[_0xb417('0x41')]!==_0xb417('0xbf')&&!isNotNull(this[_0xb417('0x1d')][_0x27215d['queue']][_0xb417('0x136')])){delete this['uniqueId'][_0x32b92a[_0xb417('0xbe')]];this[_0xb417('0xfd')](this['voiceQueues'][_0x27215d[_0xb417('0xc2')]]);this[_0xb417('0x1d')][_0x27215d[_0xb417('0xc2')]][_0xb417('0x139')]+=0x1;_0x12118c=new Hangup(_0x27215d,_0x32b92a);_0x12118c[_0xb417('0x6f')]=0xc;_0x12118c[_0xb417('0xce')]=_0x32b92a['cause-txt'];_0x12118c[_0xb417('0x11e')]=_0xb417('0x13a');hopperUtils[_0xb417('0xe0')](_0x12118c)[_0xb417('0x9c')](loggerCatch(_0xb417('0x134')));hopperUtils[_0xb417('0xc9')](_0x12118c)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xb417('0x19')][_0xb417('0x13b')]=function(_0x2cf22f){var _0x420f42=this;if(!_0x420f42[_0xb417('0x13c')][_0x2cf22f[_0xb417('0x48')]]){_0x420f42[_0xb417('0x13c')][_0x2cf22f['name']]={'running':![]};}else if(_0x420f42[_0xb417('0x13c')][_0x2cf22f['name']][_0xb417('0x13d')]===!![]){return;}else if(_0x420f42['queuesSummary'][_0x2cf22f['name']][_0xb417('0x13d')]===![]){_0x420f42[_0xb417('0x13c')][_0x2cf22f[_0xb417('0x48')]][_0xb417('0x13d')]=!![];}var _0x4d7ce9=_0x420f42[_0xb417('0x1d')][_0x2cf22f['name']];var _0x3a91ef=_0x4d7ce9[_0xb417('0x6e')]!==utils[_0xb417('0x69')][_0xb417('0x7b')];var _0x9a02bc=utils['isPreviewCampaign'](_0x4d7ce9);_0x4d7ce9[_0xb417('0x13e')]=utils['getQueueCampaignStatusMessage'](_0x4d7ce9,_0x420f42[_0xb417('0x20')]);Promise[_0xb417('0xab')]()[_0xb417('0x3d')](function(){if(_0x4d7ce9[_0xb417('0x13e')]===utils[_0xb417('0x69')]['INACTIVE']){if(_0x3a91ef){clearPredictiveAttributes(_0x4d7ce9);_0x2cf22f[_0xb417('0x25')]=undefined;_0x2cf22f[_0xb417('0x26')]=undefined;}if(_0x4d7ce9['statusMessage']===utils[_0xb417('0x69')][_0xb417('0x7b')]){_0x2cf22f[_0xb417('0x13f')]=0x0;_0x2cf22f['paused']=0x0;_0x2cf22f[_0xb417('0x140')]=0x0;_0x2cf22f['talking']=0x0;_0x2cf22f[_0xb417('0x141')]=0x0;}}else if(_0x4d7ce9['statusMessage']===utils[_0xb417('0x69')][_0xb417('0x142')]&&!_0x9a02bc){return _0x420f42[_0xb417('0x8f')](_0x4d7ce9,!![])[_0xb417('0x3d')](function(){return _0x420f42[_0xb417('0x8f')](_0x4d7ce9,![]);})[_0xb417('0x3d')](function(){return _0x420f42[_0xb417('0xb0')](_0x4d7ce9);})[_0xb417('0x9c')](function(_0x4fedc0){loggerSyncQueueSummary['debug'](_0xb417('0x143'),util[_0xb417('0x45')](_0x4fedc0,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4d7ce9);});}else{clearPredictiveAttributes(_0x4d7ce9);}})[_0xb417('0x3d')](function(){var _0x30c56d=_0x2cf22f[_0xb417('0x144')](_0x4d7ce9);if(_0x30c56d||_0x4d7ce9[_0xb417('0x145')]){_0x4d7ce9['queueSummaryCountersUpdated']=![];_0x2cf22f[_0xb417('0x146')](_0x4d7ce9);Object[_0xb417('0x147')](_0x4d7ce9,_0x2cf22f);emitOutboundVoiceQueueSummary(_0x2cf22f);}_0x420f42[_0xb417('0x13c')][_0x4d7ce9[_0xb417('0x48')]][_0xb417('0x13d')]=![];})[_0xb417('0x9c')](function(_0x3b9ad2){logger['error']('[syncQueueSummary]',util[_0xb417('0x45')](_0x3b9ad2,{'showHidden':![],'depth':null}));_0x420f42[_0xb417('0x13c')][_0x4d7ce9[_0xb417('0x48')]][_0xb417('0x13d')]=![];});};Dialer[_0xb417('0x19')][_0xb417('0x32')]=_[_0xb417('0x148')](function(){var _0x1c7813=_[_0xb417('0x149')](this['voiceQueues'],function(_0x3d42ee){return _0x3d42ee['dialPreviewRecallmeReminder'];});var _0x4361a8=_[_0xb417('0x149')](this[_0xb417('0x1f')],function(_0x370da1){return _0x370da1[_0xb417('0x14a')]&&_0x370da1[_0xb417('0x87')]==='reachable';});if(_0x1c7813[_0xb417('0x96')]>0x0&&_0x4361a8[_0xb417('0x96')]>0x0){return Promise[_0xb417('0xab')]()[_0xb417('0x3d')](cmHopper[_0xb417('0x14b')](_[_0xb417('0x14c')](_0x1c7813,'id'),previewRecallmeReminderInterval,_[_0xb417('0x14c')](_0x4361a8,'id')))[_0xb417('0x3d')](function(_0x5cea2e){for(var _0x10f424=0x0;_0x10f424<_0x5cea2e[_0xb417('0x96')];_0x10f424++){var _0x1dcd39=_0x5cea2e[_0x10f424][_0xb417('0x14d')][_0xb417('0x48')];if(_0x1dcd39)io['to'](util[_0xb417('0x46')](_0xb417('0x14e'),_0x1dcd39))[_0xb417('0x40')]('user:dialPreviewRecallReminder',{'hopper':_0x5cea2e[_0x10f424]});}})[_0xb417('0x9c')](function(_0x944837){logger[_0xb417('0x66')](_0xb417('0x14f'),_0x944837);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xb417('0x3c')]=function(){var _0x1fa4bf=this;setInterval(function(){_0x1fa4bf['clearZombieChannels'](_0x1fa4bf[_0xb417('0x24')],_0xb417('0x150'));_0x1fa4bf[_0xb417('0x151')](_0x1fa4bf[_0xb417('0xed')],'[actions]');},0x32c8);};Dialer[_0xb417('0x19')][_0xb417('0x151')]=function(_0x459e5a,_0x31a6f8){var _0x4ebbc4=this;for(var _0x18a64e in _0x459e5a){if(typeof _0x459e5a[_0x18a64e]!==_0xb417('0xaa')){this[_0xb417('0x152')][_0xb417('0x1a')](function(){if(!_[_0xb417('0xf6')](_0x459e5a[_0x18a64e])){return ami[_0xb417('0x97')]({'action':_0xb417('0x87'),'channel':_0x459e5a[_0x18a64e][_0xb417('0xee')]})['catch'](function(_0x495f37){if(_0x495f37['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x459e5a[_0x18a64e]&&_0x459e5a[_0x18a64e]['type']!==_0xb417('0xbf')){_0x4ebbc4[_0xb417('0xfd')](_0x4ebbc4[_0xb417('0x1d')][_0x459e5a[_0x18a64e]['queue']]);logger['error']('[Dialer][checkChannel]',_0x31a6f8,_0x18a64e,_0x459e5a[_0x18a64e]['queue']);delete _0x459e5a[_0x18a64e];}if(_0x459e5a[_0x18a64e]&&_0x459e5a[_0x18a64e][_0xb417('0x41')]===_0xb417('0xbf')){_0x4ebbc4['updateOriginated'](_0x4ebbc4[_0xb417('0x1e')][_0x459e5a[_0x18a64e]['queue']]);logger[_0xb417('0x66')](_0xb417('0x153'),_0x31a6f8,_0x18a64e,_0x459e5a[_0x18a64e][_0xb417('0xc2')]);delete _0x459e5a[_0x18a64e];}},0x2328);}});}});}}};Dialer['prototype'][_0xb417('0x154')]=function(_0x24c07b){return Promise[_0xb417('0xab')]()[_0xb417('0x3d')](voiceQueueRt[_0xb417('0x154')](_0x24c07b))[_0xb417('0x9c')](loggerCatch(_0xb417('0x155')));};Dialer[_0xb417('0x19')][_0xb417('0xfd')]=function(_0x3257b5){if(!_[_0xb417('0x3f')](_0x3257b5)&&_0x3257b5!==null){if(typeof _0x3257b5[_0xb417('0x7f')]!=='undefined'){if(_0x3257b5[_0xb417('0x7f')]>0x0){_0x3257b5[_0xb417('0x7f')]-=0x1;}else{logger[_0xb417('0x66')](_0xb417('0x156'));}}}else{logger[_0xb417('0x66')](_0xb417('0x157'));}};Dialer[_0xb417('0x19')]['loggerHandler']=function(_0xfba3b2,_0x3109cd){var _0x5ee117=this;return function(_0x3ee370){_0x5ee117[_0xb417('0xfd')](_0x3109cd);logger[_0xb417('0x66')](_0xfba3b2,util['inspect'](_0x3ee370,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xb417('0x158')]=function(_0x14baaf,_0x29677f,_0x39dd90){var _0x5eec01={'state':0x19,'statedesc':_0xb417('0x159')};this[_0xb417('0xfd')](_0x29677f);this[_0xb417('0x119')](_[_0xb417('0xf8')](_0x5eec01,_[_0xb417('0x75')](_0x39dd90,[_0xb417('0xd9'),_0xb417('0xda'),_0xb417('0x15a'),'VoiceQueueId',_0xb417('0xdc')])),_0xb417('0x15b'),'[emptyContact]');logger['error'](_0x14baaf);};Dialer['prototype'][_0xb417('0x119')]=function(_0x51434e,_0x7f7de0,_0xf1c82e){hopperUtils[_0xb417('0xe0')](_0x51434e)['catch'](loggerCatch(_0x7f7de0));hopperUtils[_0xb417('0xc9')](_0x51434e)[_0xb417('0x9c')](loggerCatch(_0xf1c82e));};Dialer[_0xb417('0x19')][_0xb417('0xea')]=function(_0x158a0c,_0x5420d4){hopperUtils['createHistory'](_0x158a0c)[_0xb417('0x9c')](loggerCatch(_0xb417('0xc8')));if(_0x5420d4==0x0){hopperUtils[_0xb417('0xc9')](_0x158a0c)[_0xb417('0x9c')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0xb417('0x14f')]=function(_0x4d0f11){return Promise[_0xb417('0xab')]()[_0xb417('0x3d')](cmHopper[_0xb417('0x14b')](_0x4d0f11['id'],previewRecallmeReminderInterval))[_0xb417('0x3d')](function(_0x1311b0){for(var _0x278cc2=0x0;_0x278cc2<_0x1311b0['length'];_0x278cc2++){var _0x37354a=_0x1311b0[_0x278cc2][_0xb417('0x14d')][_0xb417('0x48')];if(_0x37354a)io['to'](util[_0xb417('0x46')]('user:%s',_0x37354a))['emit'](_0xb417('0x15c'),{'hopper':_0x1311b0[_0x278cc2]});}})[_0xb417('0x9c')](function(){});};Dialer[_0xb417('0x19')][_0xb417('0x15d')]=function(_0x575601){var _0x262291=this;return function(){_0x262291['handleIvr'](_0x575601);};};Dialer[_0xb417('0x19')][_0xb417('0x15e')]=function(_0x50c6fe,_0xac8f0){var _0x2d3927=this;var _0x2ad57a=uuid['v4']();this[_0xb417('0xed')][_0x2ad57a]=new Action(_0x50c6fe,_0xac8f0,_0x2ad57a);return new Promise(function(_0x2a9406,_0x382e00){if(_[_0xb417('0x3f')](_0x50c6fe)&&typeof _0x50c6fe!==_0xb417('0x15f')){return _0x382e00(msgResponse(_0xb417('0x160'),_0xb417('0x90'),_0xb417('0x161')));}if(_[_0xb417('0x3f')](_0xac8f0['phone'])||_0xac8f0[_0xb417('0x162')]===null){return _0x382e00(msgResponse(_0xb417('0x160'),_0xb417('0x90'),'contact\x20is\x20undefine'));}var _0x28c50f={'XMD-CALLERID':_0x2d3927[_0xb417('0xed')][_0x2ad57a][_0xb417('0x163')](),'XMD-AGI':_0x50c6fe[_0xb417('0x136')]?util['format'](_0xb417('0x164'),ipAgi,_0x50c6fe[_0xb417('0x136')]):_0xb417('0x165'),'XMD-AGIAFTER':_0x50c6fe[_0xb417('0xd0')]?util[_0xb417('0x46')](_0xb417('0x164'),ipAgi,_0x50c6fe[_0xb417('0xd0')]):_0xb417('0x165'),'XMD-QUEUE':utils[_0xb417('0x166')](_0x50c6fe)?util['format'](_0xb417('0x167'),_0x50c6fe[_0xb417('0x48')],_0x50c6fe[_0xb417('0x168')]||'',_0x50c6fe[_0xb417('0xc7')]?'c':'',_0x50c6fe[_0xb417('0xcc')]||0x3):_0xb417('0x165'),'XMD-CONTACTID':_0xac8f0[_0xb417('0xd9')],'XMD-CDRTYPE':_0xb417('0x6'),'CALLERID(all)':_0x2d3927[_0xb417('0xed')][_0x2ad57a][_0xb417('0x163')](),'XMD-AMD':_0x50c6fe[_0xb417('0x114')]?_0xb417('0x142'):_0xb417('0x165'),'XMD-DESTINATION':_0xb417('0x169')};if(_0x50c6fe[_0xb417('0x114')]){_0x28c50f[_0xb417('0x16a')]=_0x50c6fe[_0xb417('0x16b')]||0x9c4;_0x28c50f[_0xb417('0x16c')]=_0x50c6fe[_0xb417('0x16d')]||0x5dc;_0x28c50f[_0xb417('0x16e')]=_0x50c6fe[_0xb417('0x16f')]||0x320;_0x28c50f[_0xb417('0x170')]=_0x50c6fe[_0xb417('0x171')]||0x1388;_0x28c50f[_0xb417('0x172')]=_0x50c6fe[_0xb417('0x173')]||0x64;_0x28c50f[_0xb417('0x174')]=_0x50c6fe[_0xb417('0x175')]||0x32;_0x28c50f[_0xb417('0x176')]=_0x50c6fe[_0xb417('0x177')]||0x3;_0x28c50f[_0xb417('0x178')]=_0x50c6fe[_0xb417('0x179')]||0x100;_0x28c50f[_0xb417('0x17a')]=_0x50c6fe[_0xb417('0x17b')]||0x1388;}if(utils[_0xb417('0x166')](_0x50c6fe)){_0x28c50f[_0xb417('0x17c')]=_0xac8f0[_0xb417('0xdb')];}else{_0x28c50f[_0xb417('0x17d')]=_0xac8f0[_0xb417('0xdc')];}for(var _0x59754a in _0xac8f0[_0xb417('0x17e')]){if(typeof _0xac8f0['Contact'][_0x59754a]!==_0xb417('0xaa')){if(isNotNull(_0xac8f0['Contact'][_0x59754a])&&_0x59754a!=='id'&&_0x59754a!==_0xb417('0x17f')&&_0x59754a!==_0xb417('0x180')&&_0x59754a!=='updatedAt'){_0x28c50f[util['format'](_0xb417('0x181'),'XMD-',_['toUpper'](_0x59754a))]=_0xac8f0[_0xb417('0x17e')][_0x59754a];}}}var _0x12a03c=_0x2d3927[_0xb417('0x182')](_0x50c6fe['Trunk'])?utils[_0xb417('0x183')](_0x50c6fe[_0xb417('0x8b')][_0xb417('0x184')],_0x50c6fe[_0xb417('0x185')],_0x50c6fe[_0xb417('0x186')]>0x0?utils[_0xb417('0x187')](_0x50c6fe['dialOriginateCallerIdNumber'],_0x50c6fe[_0xb417('0x186')]):_0x50c6fe['dialOriginateCallerIdNumber']):utils[_0xb417('0x183')](_[_0xb417('0xf6')](_0x50c6fe[_0xb417('0x8c')])?_0x50c6fe[_0xb417('0x8b')][_0xb417('0x184')]:_0x50c6fe[_0xb417('0x8c')]['callerid'],_0x50c6fe[_0xb417('0x185')],_0x50c6fe[_0xb417('0x186')]>0x0?utils[_0xb417('0x187')](_0x50c6fe[_0xb417('0x188')],_0x50c6fe[_0xb417('0x186')]):_0x50c6fe['dialOriginateCallerIdNumber']);if(_0x12a03c){_0x28c50f[_0xb417('0x189')]=_0x2d3927[_0xb417('0xed')][_0x2ad57a][_0xb417('0x18a')]=utils['extractCalleridName'](_0x12a03c);_0x28c50f[_0xb417('0x18b')]=_0xac8f0[_0xb417('0x162')];}_0x50c6fe[_0xb417('0x18c')]=_0x28c50f;return ami[_0xb417('0x97')]({'actionid':_0x2ad57a,'action':_0xb417('0x160'),'channel':_0x2d3927['isTrunkReachable'](_0x50c6fe[_0xb417('0x8b')])?util[_0xb417('0x46')](_0xb417('0x18d'),_0x50c6fe[_0xb417('0x8b')][_0xb417('0x48')],isNotNull(_0x50c6fe['dialPrefix'])?_0x50c6fe[_0xb417('0x18e')]['trim']()||'':'',_0x50c6fe['dialCutDigit']>0x0?_0xac8f0['phone'][_0xb417('0x18f')](_0x50c6fe[_0xb417('0x190')]):_0xac8f0['phone']):util[_0xb417('0x46')](_0xb417('0x18d'),_['isNil'](_0x50c6fe[_0xb417('0x8c')])?_0x50c6fe[_0xb417('0x8b')][_0xb417('0x48')]:_0x50c6fe['TrunkBackup'][_0xb417('0x48')],isNotNull(_0x50c6fe[_0xb417('0x18e')])?_0x50c6fe[_0xb417('0x18e')][_0xb417('0x191')]()||'':'',_0x50c6fe[_0xb417('0x190')]>0x0?_0xac8f0[_0xb417('0x162')][_0xb417('0x18f')](_0x50c6fe[_0xb417('0x190')]):_0xac8f0[_0xb417('0x162')]),'callerid':_0x12a03c,'Exten':_0xb417('0x169'),'Context':_0xb417('0x192'),'Priority':'1','variable':_0x28c50f,'timeout':(_0x50c6fe['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2ad57a})[_0xb417('0x3d')](function(_0x216ef9){return _0x2a9406(_0x216ef9);})[_0xb417('0x9c')](function(_0x3e7212){_0x50c6fe[_0xb417('0x193')]+=0x1;var _0x527e62=new History(_0x2d3927[_0xb417('0xed')][_0x2ad57a]);logger[_0xb417('0x66')](util[_0xb417('0x46')](_0xb417('0x194'),JSON[_0xb417('0xa7')](_0x3e7212)));_0x527e62[_0xb417('0x6f')]=0xe;_0x527e62[_0xb417('0xce')]='OriginateError';_0x527e62['starttime']=moment()[_0xb417('0x46')](_0xb417('0xc1'));_0x527e62[_0xb417('0x70')]=_0x527e62['starttime'];hopperUtils[_0xb417('0xe0')](_0x527e62)[_0xb417('0x9c')](loggerCatch(_0xb417('0x195')));_0x2d3927[_0xb417('0xc9')](_0x527e62)['catch'](loggerCatch(_0xb417('0x195')))['finally'](function(){delete _0x2d3927[_0xb417('0xed')][_0x2ad57a];return _0x382e00(msgResponse('originate','Error',_0xb417('0x196')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x4f2611,_0x23b30c,_0x2d4c57){var _0x4c00f9=new History(_0x23b30c);if(_0x4c00f9[_0xb417('0x130')]+_0x4c00f9[_0xb417('0x123')]+_0x4c00f9['countnoanswerretry']+_0x4c00f9[_0xb417('0x125')]+_0x4c00f9[_0xb417('0xd1')]+_0x4c00f9[_0xb417('0xe8')]+_0x4c00f9[_0xb417('0x120')]+_0x4c00f9[_0xb417('0x126')]>=_0x2d4c57[_0xb417('0x127')]-0x1){return!![];}switch(_0x4f2611){case 0x3:if(_0x4c00f9['countnoanswerretry']>=_0x2d4c57[_0xb417('0x197')]-0x1){return!![];}hopperUtils[_0xb417('0xd8')]({'active':![],'countnoanswerretry':_0x4c00f9[_0xb417('0x124')]+=0x1,'scheduledat':moment()[_0xb417('0x12c')](_0x2d4c57[_0xb417('0x198')],_0xb417('0xeb'))[_0xb417('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c00f9[_0xb417('0xd9')],'ListId':_0x4c00f9[_0xb417('0xda')],'VoiceQueueId':_0x4c00f9['VoiceQueueId']||undefined,'CampaignId':_0x4c00f9['CampaignId']||undefined})['catch'](loggerCatch(_0xb417('0x199')));break;case 0x5:if(_0x4c00f9[_0xb417('0x130')]>=_0x2d4c57['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xb417('0xd8')]({'active':![],'countbusyretry':_0x4c00f9['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x2d4c57[_0xb417('0x19a')],'minutes')[_0xb417('0x46')](_0xb417('0xc1')),'ContactId':_0x4c00f9[_0xb417('0xd9')],'ListId':_0x4c00f9[_0xb417('0xda')],'VoiceQueueId':_0x4c00f9['VoiceQueueId']||undefined,'CampaignId':_0x4c00f9['CampaignId']||undefined})[_0xb417('0x9c')](loggerCatch(_0xb417('0x19b')));break;case 0x8:if(_0x4c00f9[_0xb417('0x123')]>=_0x2d4c57[_0xb417('0x19c')]-0x1){return!![];}hopperUtils[_0xb417('0xd8')]({'active':![],'countcongestionretry':_0x4c00f9['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x2d4c57[_0xb417('0x19d')],_0xb417('0xeb'))['format'](_0xb417('0xc1')),'ContactId':_0x4c00f9[_0xb417('0xd9')],'ListId':_0x4c00f9[_0xb417('0xda')],'VoiceQueueId':_0x4c00f9[_0xb417('0xdb')]||undefined,'CampaignId':_0x4c00f9['CampaignId']||undefined})[_0xb417('0x9c')](loggerCatch(_0xb417('0x19e')));break;case 0x0:if(_0x4c00f9['countnosuchnumberretry']>=_0x2d4c57['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0xb417('0xd8')]({'active':![],'countnosuchnumberretry':_0x4c00f9[_0xb417('0x125')]+=0x1,'scheduledat':moment()['add'](_0x2d4c57[_0xb417('0x19f')],'minutes')['format'](_0xb417('0xc1')),'ContactId':_0x4c00f9['ContactId'],'ListId':_0x4c00f9[_0xb417('0xda')],'VoiceQueueId':_0x4c00f9[_0xb417('0xdb')]||undefined,'CampaignId':_0x4c00f9['CampaignId']||undefined})[_0xb417('0x9c')](loggerCatch(_0xb417('0x1a0')));}break;case 0xa:if(_0x4c00f9['countdropretry']>=_0x2d4c57[_0xb417('0xd7')]-0x1){return!![];}hopperUtils[_0xb417('0xd8')]({'active':![],'countdropretry':_0x4c00f9[_0xb417('0xd1')]+=0x1,'scheduledat':moment()[_0xb417('0x12c')](_0x2d4c57[_0xb417('0xd3')],'minutes')[_0xb417('0x46')](_0xb417('0xc1')),'ContactId':_0x4c00f9[_0xb417('0xd9')],'ListId':_0x4c00f9[_0xb417('0xda')],'VoiceQueueId':_0x4c00f9['VoiceQueueId']||undefined,'CampaignId':_0x4c00f9[_0xb417('0xdc')]||undefined})[_0xb417('0x9c')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4c00f9[_0xb417('0xe8')]>=_0x2d4c57[_0xb417('0xe9')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x4c00f9[_0xb417('0xe8')]+=0x1,'scheduledat':moment()[_0xb417('0x12c')](_0x2d4c57[_0xb417('0xe6')],_0xb417('0xeb'))[_0xb417('0x46')](_0xb417('0xc1')),'ContactId':_0x4c00f9['ContactId'],'ListId':_0x4c00f9['ListId'],'VoiceQueueId':_0x4c00f9[_0xb417('0xdb')]||undefined,'CampaignId':_0x4c00f9[_0xb417('0xdc')]||undefined})[_0xb417('0x9c')](loggerCatch(_0xb417('0xec')));break;case 0x13:if(_0x4c00f9[_0xb417('0x120')]>=_0x2d4c57['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xb417('0xd8')]({'active':![],'countmachineretry':_0x4c00f9[_0xb417('0x120')]+=0x1,'scheduledat':moment()[_0xb417('0x12c')](_0x2d4c57[_0xb417('0x12d')],_0xb417('0xeb'))['format'](_0xb417('0xc1')),'ContactId':_0x4c00f9['ContactId'],'ListId':_0x4c00f9[_0xb417('0xda')],'VoiceQueueId':_0x4c00f9[_0xb417('0xdb')]||undefined,'CampaignId':_0x4c00f9[_0xb417('0xdc')]||undefined})['catch'](loggerCatch(_0xb417('0x132')));break;case 0x14:if(_0x4c00f9[_0xb417('0x126')]>=_0x2d4c57[_0xb417('0x1a1')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x4c00f9[_0xb417('0x126')]+=0x1,'scheduledat':moment()[_0xb417('0x12c')](_0x2d4c57['dialAgentRejectRetryFrequency'],_0xb417('0xeb'))[_0xb417('0x46')](_0xb417('0xc1')),'ContactId':_0x4c00f9['ContactId'],'ListId':_0x4c00f9[_0xb417('0xda')],'VoiceQueueId':_0x4c00f9['VoiceQueueId']||undefined,'CampaignId':_0x4c00f9[_0xb417('0xdc')]||undefined})[_0xb417('0x9c')](loggerCatch(_0xb417('0x1a2')));break;default:return!![];}};Dialer[_0xb417('0x19')][_0xb417('0x10f')]=function(_0x430c6d,_0x61e30b,_0x343056){var _0x4b9ac0=this;var _0x3f34b8=new History(_0x430c6d);var _0x2a95a1=![];var _0x55506d;var _0x1471de;return new Promise(function(_0x119ff0,_0xb22b4){if(_[_0xb417('0x3f')](_0x61e30b)&&typeof _0x61e30b!==_0xb417('0x15f')){return _0xb22b4(msgResponse(_0xb417('0x1a3'),_0xb417('0x90'),_0xb417('0x1a4')));}if(_[_0xb417('0x3f')](_0x343056)&&typeof _0x343056!==_0xb417('0x15f')){return _0xb22b4(msgResponse(_0xb417('0x1a3'),_0xb417('0x90'),_0xb417('0x1a5')));}hopperUtils[_0xb417('0xd4')](_0x3f34b8,_0x343056['reason'],_0x61e30b)[_0xb417('0x3d')](function(_0x5124ec){if(_0x5124ec[_0xb417('0xd6')]==0x1)_0x2a95a1=!![];switch(_0x343056[_0xb417('0xc4')]){case'0':_0x61e30b[_0xb417('0x1a6')]+=0x1;_0x3f34b8['state']=0x0;_0x3f34b8['statedesc']=_0xb417('0x1a7');_0x3f34b8[_0xb417('0x125')]+=0x1;_0x3f34b8['countglobal']+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0xb417('0x117')](_0x430c6d,_0xb417('0x1a8')));_0x55506d=_0x61e30b['dialNoSuchNumberRetryFrequency'];_0x1471de=_0x61e30b[_0xb417('0xe7')];hopperUtils['createHistory'](_0x3f34b8)[_0xb417('0x9c')](loggerCatch(_0xb417('0x122')));if(_0x4b9ac0['checkRetriveMax'](0x0,_0x430c6d,_0x61e30b)&&!_0x2a95a1){if(_0x3f34b8[_0xb417('0x125')]>=_0x61e30b[_0xb417('0x1a9')]){_0x4b9ac0[_0xb417('0x12a')](_0x3f34b8,_0x119ff0,_0xb22b4,'reason\x200\x20no\x20such\x20number....');}else{_0x4b9ac0[_0xb417('0x131')](_0x3f34b8,_0x119ff0,_0xb22b4,_0xb417('0x1aa'));}}break;case'3':_0x61e30b[_0xb417('0x1ab')]+=0x1;_0x3f34b8['state']=0x3;_0x3f34b8[_0xb417('0xce')]=_0xb417('0x1ac');_0x3f34b8[_0xb417('0x124')]+=0x1;_0x3f34b8[_0xb417('0xd2')]+=0x1;var _0x1ccbc3=ut['buildNoAnswerEventPayload'](_0x430c6d,_0x61e30b);ami[_0xb417('0x40')](_0xb417('0x1ad'),_0x1ccbc3);_0x55506d=_0x61e30b[_0xb417('0x198')];_0x1471de=_0x61e30b[_0xb417('0xe7')];hopperUtils[_0xb417('0xe0')](_0x3f34b8)['catch'](loggerCatch(_0xb417('0x1ae')));if(_0x4b9ac0[_0xb417('0x1af')](0x3,_0x430c6d,_0x61e30b)&&!_0x2a95a1){if(_0x3f34b8[_0xb417('0x124')]>=_0x61e30b[_0xb417('0x197')]){_0x4b9ac0[_0xb417('0x12a')](_0x3f34b8,_0x119ff0,_0xb22b4,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4b9ac0[_0xb417('0x131')](_0x3f34b8,_0x119ff0,_0xb22b4,_0xb417('0x1b0'));}}break;case'5':_0x61e30b[_0xb417('0x1b1')]+=0x1;_0x3f34b8[_0xb417('0x6f')]=0x5;_0x3f34b8['statedesc']=_0xb417('0x1b2');_0x3f34b8[_0xb417('0x130')]+=0x1;_0x3f34b8[_0xb417('0xd2')]+=0x1;ami[_0xb417('0x40')](_0xb417('0x1b3'),ut[_0xb417('0x117')](_0x430c6d,_0xb417('0x1b4')));_0x55506d=_0x61e30b[_0xb417('0x19a')];_0x1471de=_0x61e30b['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x3f34b8)[_0xb417('0x9c')](loggerCatch(_0xb417('0x1b5')));if(_0x4b9ac0[_0xb417('0x1af')](0x5,_0x430c6d,_0x61e30b)&&!_0x2a95a1){if(_0x3f34b8['countbusyretry']>=_0x61e30b[_0xb417('0x1b6')]){_0x4b9ac0['createStateFinal'](_0x3f34b8,_0x119ff0,_0xb22b4,_0xb417('0x1b7'));}else{_0x4b9ac0['stateGlobal'](_0x3f34b8,_0x119ff0,_0xb22b4,_0xb417('0x1b7'));}}break;case'8':_0x61e30b[_0xb417('0x1b8')]+=0x1;_0x3f34b8[_0xb417('0x6f')]=0x8;_0x3f34b8[_0xb417('0xce')]=_0xb417('0x1b9');_0x3f34b8[_0xb417('0x123')]+=0x1;_0x3f34b8[_0xb417('0xd2')]+=0x1;_0x55506d=_0x61e30b[_0xb417('0x19d')];_0x1471de=_0x61e30b[_0xb417('0xe7')];ami[_0xb417('0x40')]('custom:agentcongestion',ut[_0xb417('0x117')](_0x430c6d,_0xb417('0x1ba')));hopperUtils['createHistory'](_0x3f34b8)[_0xb417('0x9c')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4b9ac0[_0xb417('0x1af')](0x8,_0x430c6d,_0x61e30b)&&!_0x2a95a1){if(_0x3f34b8['countcongestionretry']>=_0x61e30b[_0xb417('0x19c')]){_0x4b9ac0[_0xb417('0x12a')](_0x3f34b8,_0x119ff0,_0xb22b4,_0xb417('0x1bb'));}else{_0x4b9ac0[_0xb417('0x131')](_0x3f34b8,_0x119ff0,_0xb22b4,_0xb417('0x1bb'));}}break;case'11':_0x61e30b['outboundAbandonedCallsDay']+=0x1;_0x3f34b8[_0xb417('0x6f')]=0xb;_0x3f34b8['statedesc']=_0xb417('0xe4');_0x3f34b8[_0xb417('0xe8')]+=0x1;_0x3f34b8[_0xb417('0xd2')]+=0x1;_0x55506d=_0x61e30b['dialAbandonedRetryFrequency'];_0x1471de=_0x61e30b[_0xb417('0xe7')];hopperUtils['createHistory'](_0x3f34b8)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4b9ac0[_0xb417('0x1af')](0xb,_0x430c6d,_0x61e30b)&&!_0x2a95a1){if(_0x3f34b8['countabandonedretry']>=_0x61e30b[_0xb417('0xe9')]){_0x4b9ac0[_0xb417('0x12a')](_0x3f34b8,_0x119ff0,_0xb22b4,_0xb417('0x1bc'));}else{_0x4b9ac0[_0xb417('0x131')](_0x3f34b8,_0x119ff0,_0xb22b4,_0xb417('0x1bc'));}}break;case'20':_0x61e30b['outboundRejectCallsDay']+=0x1;_0x3f34b8[_0xb417('0x6f')]=0x14;_0x3f34b8[_0xb417('0xce')]=_0xb417('0x1bd');_0x3f34b8[_0xb417('0x126')]+=0x1;_0x3f34b8[_0xb417('0xd2')]+=0x1;_0x55506d=_0x61e30b[_0xb417('0x1be')];_0x1471de=_0x61e30b[_0xb417('0xe7')];ami[_0xb417('0x40')](_0xb417('0x1bf'),ut[_0xb417('0x117')](_0x430c6d,'agentreject'));hopperUtils[_0xb417('0xe0')](_0x3f34b8)['catch'](loggerCatch(_0xb417('0x1c0')));if(_0x4b9ac0['checkRetriveMax'](0x14,_0x430c6d,_0x61e30b)&&!_0x2a95a1){if(_0x3f34b8['countagentrejectretry']>=_0x61e30b[_0xb417('0x1a1')]){_0x4b9ac0[_0xb417('0x12a')](_0x3f34b8,_0x119ff0,_0xb22b4,_0xb417('0x1c1'));}else{_0x4b9ac0[_0xb417('0x131')](_0x3f34b8,_0x119ff0,_0xb22b4,_0xb417('0x1c1'));}}break;default:_0x61e30b['outboundUnknownCallsDay']+=0x1;_0x3f34b8[_0xb417('0x6f')]=0xc;_0x3f34b8[_0xb417('0xce')]=_0x343056['reason'];_0x55506d=_0x61e30b['dialAgentRejectRetryFrequency'];_0x1471de=_0x61e30b[_0xb417('0xe7')];hopperUtils[_0xb417('0xe0')](_0x3f34b8)[_0xb417('0x9c')](loggerCatch(_0xb417('0x1c2')));if(_0x4b9ac0['checkRetriveMax'](_0x343056[_0xb417('0xc4')],_0x430c6d,_0x61e30b)&&!_0x2a95a1){if(_0x3f34b8[_0xb417('0x130')]+_0x3f34b8['countcongestionretry']+_0x3f34b8['countnoanswerretry']+_0x3f34b8[_0xb417('0x125')]+_0x3f34b8[_0xb417('0xd1')]+_0x3f34b8[_0xb417('0xe8')]+_0x3f34b8['countmachineretry']+_0x3f34b8['countagentrejectretry']>=_0x61e30b[_0xb417('0x127')]){_0x4b9ac0[_0xb417('0x131')](_0x3f34b8,_0x119ff0,_0xb22b4,_0x343056[_0xb417('0xc4')]);}else{_0x4b9ac0['createStateFinal'](_0x3f34b8,_0x119ff0,_0xb22b4,_0x343056[_0xb417('0xc4')]);}}}})['then'](function(){if(_0x2a95a1){hopperUtils[_0xb417('0xe1')](_0x3f34b8,_0x55506d,_0x1471de)[_0xb417('0x3d')](function(){return _0x119ff0(0x1);});}});});};Dialer[_0xb417('0x19')][_0xb417('0x131')]=function(_0x2b1266,_0x442b81,_0x38c30f,_0x4dfb5d){var _0x52b508=new Final(_0x2b1266);_0x52b508[_0xb417('0x6f')]=0xf;_0x52b508[_0xb417('0xce')]=_0xb417('0x1c3');this[_0xb417('0x12a')](_0x52b508,_0x442b81,_0x38c30f,_0x4dfb5d);};Dialer[_0xb417('0x19')][_0xb417('0x12a')]=function(_0x4eb53f,_0x5dd831,_0x39f6ce,_0x4ff07f){hopperUtils[_0xb417('0xc9')](_0x4eb53f)['then'](function(){return _0x5dd831(msgResponse(_0xb417('0x1a3'),_0xb417('0x10e'),_0x4ff07f));})[_0xb417('0x9c')](function(){return _0x39f6ce(msgResponse('[moveContactManagedDialer][0]',_0xb417('0x90'),_0xb417('0x1c4')));});};Dialer[_0xb417('0x19')][_0xb417('0x8')]=function(_0x2587c6){var _0x551945=_0x2587c6['dialPredictiveOptimizationPercentage']/0x64;var _0x442968=_0x2587c6['outboundDropCallsDayTimeout']/(_0x2587c6['outboundDropCallsDayTimeout']+_0x2587c6['outboundAnswerCallsDay']);var _0x4e9a75=Math[_0xb417('0x1c5')](_0x2587c6[_0xb417('0x1c6')]*(_0x2587c6['predictiveIntervalMaxThreshold']/0x64));var _0x1a2a48=Math[_0xb417('0x1c5')](_0x2587c6['predictiveIntervalAvailable']*(_0x2587c6['predictiveIntervalMinThreshold']/0x64));var _0x54505e=_0x2587c6[_0xb417('0x13f')]+_0x2587c6[_0xb417('0x1c7')];var _0x266c63=Math[_0xb417('0x1c8')](_0x2587c6[_0xb417('0x5b')]*_0x2587c6[_0xb417('0x61')]*_0x2587c6['predictiveIntervalHitRate']*_0x2587c6[_0xb417('0x1c9')]);if(_[_0xb417('0x3f')](_0x2587c6['startProgressive'])){if(!_[_0xb417('0x3f')](_0x2587c6[_0xb417('0x25')])){_0x2587c6[_0xb417('0x25')]=undefined;loggerPredictive[_0xb417('0x66')](_0xb417('0x1ca'),_0xb417('0x1cb'));}if(!_[_0xb417('0x3f')](_0x2587c6['handlePredictive'])){loggerPredictive['error'](_0xb417('0x1ca'),_0xb417('0x1cc'));clearInterval(_0x2587c6[_0xb417('0x65')]);_0x2587c6[_0xb417('0x65')]=undefined;}_0x2587c6[_0xb417('0x26')]=moment()['format'](_0xb417('0xc1'));loggerPredictive[_0xb417('0x4c')](_0x2587c6['name'],'collection\x20data\x20in\x20progressive\x20at',_0x2587c6[_0xb417('0x26')]);this[_0xb417('0xb4')](_0x2587c6,0x1);}else if(ifInterval(_0x2587c6[_0xb417('0x1cd')],_0x2587c6['startProgressive'])){this[_0xb417('0xb4')](_0x2587c6,0x1);loggerPredictiveCalls[_0xb417('0x4c')]('[startMethodPredictive][StartProgressive][Loop]',_0x2587c6[_0xb417('0x26')],_0x2587c6[_0xb417('0x48')]);_0x2587c6[_0xb417('0x5b')]=0x0;_0x2587c6[_0xb417('0xcd')]=0x0;}else if(_0x551945<_0x442968&&_0x2587c6['dialPredictiveOptimization']===_0xb417('0x1ce')){clearPredictiveAttributes(_0x2587c6);loggerPredictive[_0xb417('0x4c')](_0xb417('0x1cf'),_0xb417('0x1d0'),_0x442968,_0xb417('0x26'),_0x2587c6[_0xb417('0x48')]);}else if(_0x266c63<_0x2587c6[_0xb417('0xcd')]&&_0x2587c6[_0xb417('0x1d1')]===_0xb417('0x1ce')){clearPredictiveAttributes(_0x2587c6);loggerPredictive[_0xb417('0x4c')](_0xb417('0x1d2'),_0xb417('0x1d3'),_0x266c63,_0xb417('0x1d4'),_0x2587c6['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x2587c6['name']);}else if(!ifInterval(_0x2587c6['dialPredictiveInterval'],_0x2587c6['startProgressive'])&&_[_0xb417('0x3f')](_0x2587c6[_0xb417('0x25')])&&!_[_0xb417('0x3f')](_0x2587c6[_0xb417('0x26')])){_0x2587c6[_0xb417('0x25')]=moment()[_0xb417('0x46')](_0xb417('0xc1'));loggerPredictive[_0xb417('0x4c')](_0x2587c6[_0xb417('0x48')],_0xb417('0x1d5'),_0x2587c6[_0xb417('0x25')]);hopperUtils[_0xb417('0x1d6')](_0x2587c6[_0xb417('0x1cd')])[_0xb417('0x3d')](this['getDataPredictive'](_0x2587c6))['then'](mergeDataErlangB(_0x2587c6))[_0xb417('0x3d')](this[_0xb417('0x1d7')](_0x2587c6))['catch'](loggerCatchPredictive(_0xb417('0x1d8'),_0x2587c6));}else if(!ifInterval(_0x2587c6['dialPredictiveInterval'],_0x2587c6[_0xb417('0x25')])){_0x2587c6[_0xb417('0xcd')]=0x0;_0x2587c6[_0xb417('0x25')]=moment()[_0xb417('0x46')](_0xb417('0xc1'));loggerPredictive['info'](_0x2587c6['name'],_0xb417('0x1d9'),_0x2587c6[_0xb417('0x25')]);clearInterval(_0x2587c6[_0xb417('0x65')]);_0x2587c6[_0xb417('0x65')]=undefined;hopperUtils[_0xb417('0x1d6')](_0x2587c6[_0xb417('0x1cd')])['then'](this['getDataPredictive'](_0x2587c6))[_0xb417('0x3d')](mergeDataErlangB(_0x2587c6))['then'](this[_0xb417('0x1d7')](_0x2587c6))[_0xb417('0x9c')](loggerCatchPredictive(_0xb417('0x1da'),_0x2587c6));}else if(_0x2587c6[_0xb417('0x1c6')]&&_0x54505e<_0x2587c6['predictiveIntervalAvailable']-_0x1a2a48){clearPredictiveAttributes(_0x2587c6);loggerPredictive[_0xb417('0x4c')](_0x2587c6[_0xb417('0x48')],_0xb417('0x1db'),_0x54505e,_0xb417('0x1dc'),_0x2587c6[_0xb417('0x1c6')],'-',_0x1a2a48,'=',_0x2587c6[_0xb417('0x1c6')]-_0x1a2a48,')');}else if(_0x2587c6[_0xb417('0x1c6')]&&_0x54505e>_0x2587c6[_0xb417('0x1c6')]+_0x4e9a75){clearPredictiveAttributes(_0x2587c6);loggerPredictive[_0xb417('0x4c')](_0x2587c6[_0xb417('0x48')],_0xb417('0x1db'),_0x54505e,_0xb417('0x1dd'),_0x2587c6['predictiveIntervalAvailable'],'+',_0x4e9a75,'=',_0x2587c6[_0xb417('0x1c6')]+_0x4e9a75,')');}};Dialer[_0xb417('0x19')][_0xb417('0x1de')]=function(_0x1fe9c5){var _0x4e55ec=this;return function(_0x2651d2){return new Promise(function(_0x393751,_0x4a1465){_[_0xb417('0xf8')](_0x1fe9c5,_0x2651d2[0x0]);if(checkGetDataPredictive(_0x2651d2[0x0])){var _0x4cbe6e=_0x1fe9c5[_0xb417('0x1c6')]=_0x1fe9c5[_0xb417('0x1c7')]+_0x1fe9c5[_0xb417('0x13f')];var _0x200966=_0x1fe9c5[_0xb417('0x1cd')]*0x3c;var _0x38694a=_0x2651d2[0x0]['predictiveIntervalAvgTalktime']+_0x2651d2[0x0][_0xb417('0x53')];var _0x45191c=(_0x2651d2[0x0][_0xb417('0x50')]+_0x2651d2[0x0][_0xb417('0x51')]+_0x2651d2[0x0][_0xb417('0xe2')])/_0x2651d2[0x0][_0xb417('0x4e')];_0x1fe9c5['predictiveIntervalHitRate']=_0x45191c>0x0?_0x45191c:0x1;switch(_0x1fe9c5[_0xb417('0x1d1')]){case'dropRate':var _0x4891c9=_0x1fe9c5['dialPredictiveOptimizationPercentage']/0x64;return _0x4e55ec[_0xb417('0x1df')](_0x4cbe6e,_0x200966,_0x38694a,_0x45191c,_0x4891c9)[_0xb417('0x3d')](function(_0x430578){return _0x393751(_0x430578);});case _0xb417('0x1e0'):var _0xcc1953=_0x1fe9c5[_0xb417('0x1e1')]/0x64;return _0x4e55ec[_0xb417('0x1e2')](_0x4cbe6e,_0x200966,_0x38694a,_0x45191c,_0xcc1953)[_0xb417('0x3d')](function(_0x3836ba){return _0x393751(_0x3836ba);});default:return _0x4a1465(msgResponse('[getDataPredictive]','Failure',_0xb417('0x1e3')));}}else{return _0x4a1465(msgResponse(_0xb417('0x1e4'),_0xb417('0x90'),_0xb417('0x1e5')));}});};};Dialer[_0xb417('0x19')][_0xb417('0x1e6')]=function(_0x23c60f){var _0x2662ff=this;return function(_0x99607d){return new Promise(function(_0x29b1f1,_0x4eb134){_[_0xb417('0xf8')](_0x23c60f,_0x99607d[0x0]);if(checkGetDataPredictive(_0x99607d[0x0])){loggerPredictive[_0xb417('0x4c')](JSON[_0xb417('0xa7')](_0x99607d[0x0]));if(_0x23c60f[_0xb417('0x1d1')]==='dropRate'){return _0x2662ff[_0xb417('0x154')](_0x23c60f['id'])[_0xb417('0x3d')](function(_0x1e70f6){var _0x253331=_0x23c60f['loggedIn']-_0x1e70f6[0x0][_0xb417('0x1e7')];var _0x46015b=_0x23c60f[_0xb417('0x1cd')]*0x3c;var _0x188e99=_0x99607d[0x0][_0xb417('0x55')]+_0x99607d[0x0][_0xb417('0x53')];var _0x59e1d4=(_0x99607d[0x0][_0xb417('0x50')]+_0x99607d[0x0][_0xb417('0x51')]+_0x99607d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x99607d[0x0]['predictiveIntervalTotalCalls'];var _0x1c3c52=_0x23c60f[_0xb417('0x1e1')]/0x64;_0x23c60f[_0xb417('0x1e8')]=_0x1e70f6[0x0][_0xb417('0x1e7')]||0x0;_0x23c60f[_0xb417('0x1e9')]=_0x59e1d4>0x0?_0x59e1d4:0x1;return _0x2662ff[_0xb417('0x1df')](_0x253331,_0x46015b,_0x188e99,_0x59e1d4,_0x1c3c52);})[_0xb417('0x3d')](function(_0x3ebcfa){return _0x29b1f1(_0x3ebcfa);})[_0xb417('0x9c')](function(_0x298f17){return _0x4eb134(msgResponse(_0xb417('0x1ea'),_0xb417('0x90'),JSON['stringify'](_0x298f17)));});}if(_0x23c60f[_0xb417('0x1d1')]===_0xb417('0x1e0')){return _0x2662ff[_0xb417('0x154')](_0x23c60f['id'])[_0xb417('0x3d')](function(_0x35b484){var _0x27a200=_0x23c60f[_0xb417('0x1eb')]-_0x35b484[0x0][_0xb417('0x1e7')];var _0x406cba=_0x23c60f[_0xb417('0x1cd')]*0x3c;var _0x4c716e=_0x99607d[0x0]['predictiveIntervalAvgTalktime']+_0x99607d[0x0][_0xb417('0x53')];var _0x231c73=(_0x99607d[0x0]['predictiveIntervalAnsweredCalls']+_0x99607d[0x0][_0xb417('0x51')]+_0x99607d[0x0][_0xb417('0xe2')])/_0x99607d[0x0][_0xb417('0x4e')];var _0x346b78=_0x23c60f[_0xb417('0x1e1')]/0x64;_0x23c60f[_0xb417('0x1e8')]=_0x35b484[0x0][_0xb417('0x1e7')]||0x0;_0x23c60f['predictiveIntervalHitRate']=_0x231c73>0x0?_0x231c73:0x1;return _0x2662ff[_0xb417('0x1e2')](_0x27a200,_0x406cba,_0x4c716e,_0x231c73,_0x346b78);})[_0xb417('0x3d')](function(_0xb55a2a){return _0x29b1f1(_0xb55a2a);})[_0xb417('0x9c')](function(_0xfe6ab5){return _0x4eb134(msgResponse(_0xb417('0x1ea'),_0xb417('0x90'),JSON['stringify'](_0xfe6ab5)));});}}else{return _0x4eb134(msgResponse(_0xb417('0x1e4'),_0xb417('0x90'),_0xb417('0x1e5')));}});};};Dialer[_0xb417('0x19')][_0xb417('0x1d7')]=function(_0xcc5233){var _0x12a982=this;return function(){var _0x34bf3a=0x0;var _0x34528b=Math[_0xb417('0x1c8')](_0xcc5233[_0xb417('0x5d')]*0x3e8);if(_0x34528b>0x0){_0x34528b=_0x34528b<0x64?0x64:_0x34528b;loggerPredictive[_0xb417('0x4c')](_0xcc5233[_0xb417('0x48')],_0xb417('0x1ec'),_0x34528b,_0xb417('0x1ed'));_0xcc5233[_0xb417('0x65')]=setInterval(function(){_0x12a982[_0xb417('0x65')](_0xcc5233);loggerPredictiveCalls['info'](_0xb417('0x1ee'),_0x34bf3a+=0x1);},_0x34528b);}else{loggerPredictive[_0xb417('0x4c')](_0xcc5233[_0xb417('0x48')],_0xb417('0x1ef'));}};};Dialer[_0xb417('0x19')]['checkContactBlack']=function(_0x4ff495,_0x2c0b4a){var _0x3d3c1f=this;return function(_0x4884bd){if(_[_0xb417('0x4a')](_0x4884bd)){if(_[_0xb417('0xf6')](_0x2c0b4a['UserId'])||!_0x2c0b4a[_0xb417('0x1f0')]){if(_0x4ff495[_0xb417('0xb1')]===_0xb417('0xb6')){_0x4ff495[_0xb417('0x72')]=_['isUndefined'](_0x4ff495['queueStatusComplete'])?!![]:_0x4ff495[_0xb417('0x72')];var _0x5d87b8=uuid['v4']();_0x3d3c1f[_0xb417('0xed')][_0x5d87b8]=new Action(_0x4ff495,_0x2c0b4a,_0x5d87b8);loggerBooked['info']('[booked][checkContactBlack]',_0x5d87b8,_0xb417('0x1f1'),JSON[_0xb417('0xa7')](_0x4ff495['queueStatusComplete']),_0xb417('0x1f2'),_0x4ff495[_0xb417('0x48')]);if(_0x4ff495[_0xb417('0x72')]){_0x4ff495[_0xb417('0x72')]=![];_0x3d3c1f[_0xb417('0xf7')][_0x3d3c1f[_0xb417('0xed')][_0x5d87b8][_0xb417('0xc2')]]=[];ami[_0xb417('0x97')]({'actionid':_0x5d87b8,'action':_0xb417('0x1f3'),'queue':_0x4ff495[_0xb417('0x48')]})['catch'](function(){_0x3d3c1f[_0xb417('0xfd')](_0x4ff495);hopperUtils[_0xb417('0xd8')]({'active':![],'ContactId':_0x3d3c1f[_0xb417('0xed')][_0x5d87b8]['ContactId'],'ListId':_0x3d3c1f['actions'][_0x5d87b8][_0xb417('0xda')],'VoiceQueueId':_0x3d3c1f[_0xb417('0xed')][_0x5d87b8]['VoiceQueueId']||undefined,'CampaignId':_0x3d3c1f[_0xb417('0xed')][_0x5d87b8][_0xb417('0xdc')]||undefined})[_0xb417('0x9c')](loggerCatch(_0xb417('0x1f4')));delete _0x3d3c1f['actions'][_0x5d87b8];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xb417('0xa7')](_0x4ff495['queueStatusComplete']),'Queue:\x20',_0x4ff495[_0xb417('0x48')]);_0x3d3c1f[_0xb417('0xfd')](_0x4ff495);hopperUtils[_0xb417('0xd8')]({'active':![],'ContactId':_0x3d3c1f['actions'][_0x5d87b8][_0xb417('0xd9')],'ListId':_0x3d3c1f[_0xb417('0xed')][_0x5d87b8]['ListId'],'VoiceQueueId':_0x3d3c1f[_0xb417('0xed')][_0x5d87b8]['VoiceQueueId']||undefined,'CampaignId':_0x3d3c1f['actions'][_0x5d87b8][_0xb417('0xdc')]||undefined})[_0xb417('0x9c')](loggerCatch(_0xb417('0x1f4')));delete _0x3d3c1f[_0xb417('0xed')][_0x5d87b8];}}else{return _0x3d3c1f['actionOriginate'](_0x4ff495,_0x2c0b4a);}}else{if(utils[_0xb417('0x62')](undefined,_0x2c0b4a['scheduledat'])<_0x4ff495[_0xb417('0x1f5')]*0x3c){if(_0x2c0b4a[_0xb417('0x14d')]&&!_0x2c0b4a[_0xb417('0x14d')][_0xb417('0x1f6')]){_0x3d3c1f[_0xb417('0x1c')][_0xb417('0xfb')](_0x2c0b4a['id'])[_0xb417('0xfc')](function(){_0x3d3c1f[_0xb417('0xfd')](_0x4ff495);});}else{hopperUtils[_0xb417('0x1f7')]({'active':![]},_0x2c0b4a['id'],0x1)[_0xb417('0xfc')](function(){_0x3d3c1f[_0xb417('0xfd')](_0x4ff495);});}}else{_0x4ff495['outboundReCallsDay']+=0x1;_0x3d3c1f[_0xb417('0xfd')](_0x4ff495);if(_0x4ff495[_0xb417('0x1f8')]){hopperUtils[_0xb417('0xd8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2c0b4a[_0xb417('0xd9')],'ListId':_0x2c0b4a['ListId'],'VoiceQueueId':_0x2c0b4a[_0xb417('0xdb')]||undefined,'CampaignId':_0x2c0b4a[_0xb417('0xdc')]||undefined})[_0xb417('0x9c')](loggerCatch(_0xb417('0x1f9')));hopperUtils[_0xb417('0xe0')](createObjHistory(_0x4ff495,_0x2c0b4a,utils[_0xb417('0x69')]['QUEUE_RECALL'],0x17,_0xb417('0x1fa')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x3d3c1f[_0xb417('0x119')](createObjHistory(_0x4ff495,_0x2c0b4a,utils[_0xb417('0x69')][_0xb417('0x1fb')],0x16,_0xb417('0x1fc')),_0xb417('0x1fd'),'[Originate][HistoryRecallClose]');}}}}else{_0x4ff495[_0xb417('0x1fe')]+=0x1;_0x3d3c1f['saveInDb'](createObjHistory(_0x4ff495,_0x2c0b4a,utils[_0xb417('0x69')]['BLACKLIST'],0xd,_0xb417('0x1ff')),'[Originate][historyBlacklist]',_0xb417('0x200'));throw _0xb417('0x201');}};};Dialer[_0xb417('0x19')]['handleIvr']=function(_0x58ede0){var _0xa03a9b=this;var _0x2b5ca9=_0x58ede0[_0xb417('0x202')]-_0x58ede0[_0xb417('0x7f')]-_0x58ede0[_0xb417('0x203')];emitCampaignSummary(_0x58ede0);if(_0x2b5ca9>0x0){if(_0x2b5ca9>this[_0xb417('0x21')]){_0x2b5ca9=this[_0xb417('0x21')];}_0x58ede0[_0xb417('0x203')]+=_0x2b5ca9;hopperUtils[_0xb417('0x204')](_0x58ede0,_0x2b5ca9)[_0xb417('0x3d')](function(_0xccb454){_0x58ede0[_0xb417('0x203')]-=_0x2b5ca9;_0x58ede0[_0xb417('0x203')]=_0x58ede0[_0xb417('0x203')]>0x0?_0x58ede0[_0xb417('0x203')]:0x0;if(!utils[_0xb417('0x205')](_0xccb454)){_0x58ede0[_0xb417('0x6e')]=utils[_0xb417('0x69')][_0xb417('0x6c')];logger[_0xb417('0x4c')](_0xb417('0x206')+_0x58ede0['name']);}else{_0x58ede0[_0xb417('0x7f')]+=_0xccb454[_0xb417('0x96')];_0x58ede0[_0xb417('0x6e')]=utils[_0xb417('0x69')]['RUNNING'];for(var _0x2ad4b9=0x0;_0x2ad4b9<_0xccb454[_0xb417('0x96')];_0x2ad4b9+=0x1){_0x58ede0[_0xb417('0x207')]+=0x1;if(_[_0xb417('0xf6')](_0xccb454[_0x2ad4b9])||_[_0xb417('0xf6')](_0xccb454[_0x2ad4b9][_0xb417('0x17e')])||_[_0xb417('0xf6')](_0xccb454[_0x2ad4b9][_0xb417('0x162')])){_0xa03a9b[_0xb417('0x158')](_0xb417('0x208'),_0x58ede0,_0xccb454[_0x2ad4b9]);}else{hopperUtils[_0xb417('0x209')](_['pick'](_0xccb454[_0x2ad4b9],['CampaignId',_0xb417('0x162')]))['then'](_0xa03a9b[_0xb417('0x20a')](_0x58ede0,_0xccb454[_0x2ad4b9]))[_0xb417('0x9c')](_0xa03a9b[_0xb417('0x20b')](_0xb417('0x20c'),_0x58ede0));}}}})[_0xb417('0x9c')](loggerGetContactDialer(_0xb417('0x20d'),_0x58ede0,_0x2b5ca9));}};Dialer[_0xb417('0x19')][_0xb417('0xb4')]=function(_0x11c795,_0x3c28b3){var _0x328e98=this;var _0x3999f5=[];if(_0x3c28b3<0x1||_0x11c795[_0xb417('0xb1')]===_0xb417('0xb6')){_0x3c28b3=0x1;}var _0x14614d=Math[_0xb417('0x1c8')](_0x11c795[_0xb417('0x13f')]*_0x3c28b3)-_0x11c795[_0xb417('0x7f')]-_0x11c795[_0xb417('0x203')];if(_0x11c795[_0xb417('0x20e')]>0x0){var _0x147005=_0x11c795[_0xb417('0x20e')]-_0x11c795['originated']-_0x11c795[_0xb417('0x1c7')]-_0x11c795['temp']-_0x11c795[_0xb417('0x141')];if(_0x14614d>_0x147005){_0x14614d=_0x147005;}}if(_0x14614d>0x0){if(_0x11c795[_0xb417('0xb1')]===_0xb417('0xb6')){_0x14614d=0x1;}if(_0x14614d>this[_0xb417('0x21')]){_0x14614d=this[_0xb417('0x21')];}_0x11c795['temp']+=_0x14614d;for(var _0x36e7c5 in this[_0xb417('0x1f')]){if(typeof this[_0xb417('0x1f')][_0x36e7c5]!=='undefined'){if(this['agents'][_0x36e7c5][_0xb417('0x6f')]==='not_inuse'&&this['agents'][_0x36e7c5]['status']===_0xb417('0x88')){_0x3999f5[_0xb417('0x9d')](this['agents'][_0x36e7c5]['id']);}}}hopperUtils[_0xb417('0x20f')](_0x11c795,_0x3999f5,_0x14614d)['then'](function(_0x5e3d31){_0x11c795[_0xb417('0x203')]-=_0x14614d;_0x11c795[_0xb417('0x203')]=_0x11c795[_0xb417('0x203')]>0x0?_0x11c795[_0xb417('0x203')]:0x0;if(!utils['checkContactEmpty'](_0x5e3d31)){hopperUtils[_0xb417('0x210')](_0x11c795)[_0xb417('0x3d')](sendMessageReschedule(_0x11c795))[_0xb417('0x9c')](loggerCatch(_0xb417('0x211')));}else{_0x11c795['originated']+=_0x5e3d31[_0xb417('0x96')];_0x11c795[_0xb417('0x6e')]=_0x11c795[_0xb417('0xb1')]===_0xb417('0xb6')?utils['CAMPAIGN_STATUS'][_0xb417('0x142')]:utils[_0xb417('0x69')][_0xb417('0x212')];for(var _0x1a582b=0x0;_0x1a582b<_0x5e3d31[_0xb417('0x96')];_0x1a582b+=0x1){if(_[_0xb417('0xf6')](_0x5e3d31[_0x1a582b])||_[_0xb417('0xf6')](_0x5e3d31[_0x1a582b][_0xb417('0x17e')])||_[_0xb417('0xf6')](_0x5e3d31[_0x1a582b][_0xb417('0x162')])){_0x328e98[_0xb417('0x158')](_0xb417('0x208'),_0x11c795,_0x5e3d31[_0x1a582b]);}else{hopperUtils[_0xb417('0x213')](_[_0xb417('0x75')](_0x5e3d31[_0x1a582b],[_0xb417('0xdb'),'phone']))[_0xb417('0x3d')](_0x328e98[_0xb417('0x20a')](_0x11c795,_0x5e3d31[_0x1a582b]))[_0xb417('0x9c')](_0x328e98[_0xb417('0x20b')](_0xb417('0x208'),_0x11c795));}}}})['catch'](loggerGetContactDialer(_0xb417('0x214'),_0x11c795,_0x14614d));}};Dialer['prototype']['handlePredictive']=function(_0x2a48cc){if(_0x2a48cc[_0xb417('0x20e')]>0x0){var _0x2b00a8=_0x2a48cc[_0xb417('0x20e')]-_0x2a48cc[_0xb417('0x7f')]-_0x2a48cc[_0xb417('0x1c7')];if(_0x2b00a8>0x0){this[_0xb417('0x215')](_0x2a48cc);}else{loggerPredictiveCalls[_0xb417('0x4c')](_0xb417('0x216'));}}else{this[_0xb417('0x215')](_0x2a48cc);}};Dialer[_0xb417('0x19')]['tryOriginatePredictive']=function(_0x13319c){var _0x2654e4=this;var _0x1d6df6=[];_0x13319c[_0xb417('0x7f')]+=0x1;for(var _0x56201b in this[_0xb417('0x1f')]){if(typeof this[_0xb417('0x1f')][_0x56201b]!==_0xb417('0xaa')){if(this[_0xb417('0x1f')][_0x56201b][_0xb417('0x6f')]===_0xb417('0x217')&&this[_0xb417('0x1f')][_0x56201b]['status']===_0xb417('0x88')){_0x1d6df6[_0xb417('0x9d')](this['agents'][_0x56201b]['id']);}}}return this[_0xb417('0x20f')](_0x13319c['id'],_0x1d6df6,0x1,_0x13319c[_0xb417('0x218')],_0x13319c)[_0xb417('0x3d')](function(_0xacb476){if(!utils[_0xb417('0x205')](_0xacb476)){utils[_0xb417('0x68')](_0x13319c,0x1,0x0);return hopperUtils[_0xb417('0x210')](_0x13319c)['then'](sendMessageReschedule(_0x13319c))['catch'](loggerCatch(_0xb417('0x211')));}else{_0x13319c['message']=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0xb417('0xf6')](_0xacb476[0x0])||_[_0xb417('0xf6')](_0xacb476[0x0][_0xb417('0x17e')])||_[_0xb417('0xf6')](_0xacb476[0x0]['phone'])){_0x2654e4[_0xb417('0x158')](_0xb417('0x208'),_0x13319c,_0xacb476[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xb417('0x75')](_0xacb476[0x0],[_0xb417('0xdb'),_0xb417('0x162')]))[_0xb417('0x3d')](_0x2654e4['checkContactBlack'](_0x13319c,_0xacb476[0x0]))['catch'](_0x2654e4[_0xb417('0x20b')](_0xb417('0x219'),_0x13319c));}}})[_0xb417('0x9c')](loggerGetContactDialer(_0xb417('0x21a'),_0x13319c,0x1));};Dialer[_0xb417('0x19')][_0xb417('0x1df')]=function(_0x12aa87,_0x559f7e,_0x896267,_0x447898,_0x36407b,_0xe96ffd){loggerPredictive[_0xb417('0x4c')](_0xb417('0x21b'));loggerPredictive[_0xb417('0x4c')](_0xb417('0x21c'),_0x12aa87);loggerPredictive[_0xb417('0x4c')](_0xb417('0x21d'),_0x559f7e);loggerPredictive[_0xb417('0x4c')](_0xb417('0x21e'),_0x896267);loggerPredictive['info'](_0xb417('0x21f'),_0x447898);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36407b);loggerPredictive[_0xb417('0x4c')](_0xb417('0x56'));return new Promise(function(_0x5f5c5f,_0x568d9c){if(_0x12aa87<=0x0||isNaN(_0x12aa87)){return _0x568d9c(msgResponse('[abandonmentRate]',_0xb417('0x84'),'m\x20=\x20'+_0x12aa87));}if(_0x896267<=0x0||isNaN(_0x896267)){return _0x568d9c(msgResponse(_0xb417('0x220'),'Error',_0xb417('0x221')+_0x896267));}if(_0x447898<=0x0||isNaN(_0x447898)){return _0x568d9c(msgResponse(_0xb417('0x220'),_0xb417('0x84'),_0xb417('0x222')+_0x447898));}if(_0x559f7e<=0x0||isNaN(_0x559f7e)){return _0x568d9c(msgResponse(_0xb417('0x220'),_0xb417('0x84'),_0xb417('0x223')+_0x559f7e));}if(_0x36407b<=0x0||isNaN(_0x36407b)){return _0x568d9c(msgResponse(_0xb417('0x220'),_0xb417('0x84'),'Amax\x20=\x20'+_0x36407b));}_0xe96ffd=_0xe96ffd||0x0;var _0x3323be=0x1/_0x896267;var _0x10a6ce=0x0;var _0x47fd2e=0x0;var _0x44a13c=0x0;var _0x3acc9c=0x0;for(var _0x1b85df=0x0;_0x44a13c<_0x36407b;_0x1b85df+=0x1){_0x47fd2e=_0x1b85df/_0x559f7e;_0x10a6ce=(_0x447898*_0x47fd2e+_0xe96ffd)/_0x3323be;_0x44a13c=utils[_0xb417('0x224')](_0x10a6ce,_0x12aa87);_0x3acc9c=_0x10a6ce/_0x12aa87*(0x1-utils[_0xb417('0x224')](_0x10a6ce,_0x12aa87));}return _0x5f5c5f({'erlangCalls':_0x1b85df,'erlangCallToSecond':_0x559f7e/_0x1b85df,'erlangAbandonmentRate':_0x44a13c,'erlangBusyFactor':_0x3acc9c});});};Dialer[_0xb417('0x19')][_0xb417('0x1e2')]=function(_0x194585,_0x360de5,_0x17629f,_0x1b141f,_0x38b22e,_0x19f8a2){loggerPredictive[_0xb417('0x4c')](_0xb417('0x225'));loggerPredictive[_0xb417('0x4c')](_0xb417('0x21c'),_0x194585);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x360de5);loggerPredictive['info']('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',_0x17629f);loggerPredictive[_0xb417('0x4c')](_0xb417('0x21f'),_0x1b141f);loggerPredictive[_0xb417('0x4c')](_0xb417('0x226'),_0x38b22e);loggerPredictive['info']('---------------------------');return new Promise(function(_0x1d30b1,_0x493eb2){if(_0x194585<=0x0||isNaN(_0x194585)){return _0x493eb2(msgResponse(_0xb417('0x227'),'Error','m\x20=\x20'+_0x194585));}if(_0x17629f<=0x0||isNaN(_0x17629f)){return _0x493eb2(msgResponse(_0xb417('0x227'),_0xb417('0x84'),_0xb417('0x221')+_0x17629f));}if(_0x1b141f<=0x0||isNaN(_0x1b141f)){return _0x493eb2(msgResponse('[busyFactor]',_0xb417('0x84'),_0xb417('0x222')+_0x1b141f));}if(_0x360de5<=0x0||isNaN(_0x360de5)){return _0x493eb2(msgResponse(_0xb417('0x227'),_0xb417('0x84'),_0xb417('0x223')+_0x360de5));}if(_0x38b22e<=0x0||isNaN(_0x38b22e)){return _0x493eb2(msgResponse(_0xb417('0x227'),_0xb417('0x84'),_0xb417('0x228')+_0x38b22e));}_0x19f8a2=_0x19f8a2||0x0;var _0x58ecd5=0x1/_0x17629f;var _0x192560=0x0;var _0x4ccffa=0x0;var _0x5d891c=0x0;var _0x2d86fc=0x0;for(var _0x2021cd=0x0;_0x2d86fc<_0x38b22e;_0x2021cd+=0x1){_0x4ccffa=_0x2021cd/_0x360de5;_0x192560=(_0x1b141f*_0x4ccffa+_0x19f8a2)/_0x58ecd5;_0x5d891c=utils[_0xb417('0x224')](_0x192560,_0x194585);_0x2d86fc=_0x192560/_0x194585*(0x1-utils[_0xb417('0x224')](_0x192560,_0x194585));}return _0x1d30b1({'erlangCalls':_0x2021cd,'erlangCallToSecond':_0x360de5/_0x2021cd,'erlangAbandonmentRate':_0x5d891c,'erlangBusyFactor':_0x2d86fc});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index d2ca42a..d23dead 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 _0x9531=['type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','dialCutDigit','number','queue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','active'];(function(_0x16228c,_0x14423b){var _0x5a326c=function(_0x432606){while(--_0x432606){_0x16228c['push'](_0x16228c['shift']());}};_0x5a326c(++_0x14423b);}(_0x9531,0x185));var _0x1953=function(_0x3e9ae2,_0x527270){_0x3e9ae2=_0x3e9ae2-0x0;var _0x49341f=_0x9531[_0x3e9ae2];return _0x49341f;};'use strict';var util=require('util');var _=require(_0x1953('0x0'));var moment=require(_0x1953('0x1'));function checkNameSurname(_0x332195,_0x19324f,_0x49cdcf){var _0x2a5fd2='';if(!_[_0x1953('0x2')](_0x19324f)&&_0x1953('0x3')===typeof _0x19324f){_0x2a5fd2+=_0x19324f;}if(!_[_0x1953('0x2')](_0x49cdcf)&&_0x1953('0x3')===typeof _0x49cdcf){_0x2a5fd2+='\x20'+_0x49cdcf;}if(_0x2a5fd2!==''){return _0x2a5fd2;}return _0x332195;}function Action(_0x3b4dd8,_0x4e73f7,_0x1839c6){this[_0x1953('0x4')]=_0x3b4dd8;this[_0x1953('0x5')]=_0x1839c6||undefined;this[_0x1953('0x6')]=checkNameSurname(_0x4e73f7[_0x1953('0x7')][_0x1953('0x8')],_0x4e73f7[_0x1953('0x7')]['firstName'],_0x4e73f7[_0x1953('0x7')][_0x1953('0x9')]);this['number']=_0x4e73f7[_0x1953('0x8')];this['queue']=_0x3b4dd8[_0x1953('0x6')];this[_0x1953('0xa')]=_0x4e73f7['active']||![];this['type']=_0x3b4dd8[_0x1953('0xb')];this[_0x1953('0xc')]=_0x3b4dd8['dialQueueTimeout']||0x3;this['scheduledat']=_0x4e73f7['scheduledat'];this[_0x1953('0xd')]=_0x4e73f7[_0x1953('0xd')];this['countcongestionretry']=_0x4e73f7[_0x1953('0xe')];this[_0x1953('0xf')]=_0x4e73f7[_0x1953('0xf')];this[_0x1953('0x10')]=_0x4e73f7[_0x1953('0x10')];this[_0x1953('0x11')]=_0x4e73f7[_0x1953('0x11')];this[_0x1953('0x12')]=_0x4e73f7[_0x1953('0x12')];this[_0x1953('0x13')]=_0x4e73f7[_0x1953('0x13')];this['countagentrejectretry']=_0x4e73f7['countagentrejectretry'];this[_0x1953('0x14')]=_0x4e73f7[_0x1953('0x14')];this[_0x1953('0x15')]=_0x4e73f7[_0x1953('0x15')];this[_0x1953('0x16')]=_0x4e73f7['UserId'];this[_0x1953('0x17')]=_0x4e73f7[_0x1953('0x17')];this['CampaignId']=_0x4e73f7['CampaignId'];this['idHopper']=_0x4e73f7['id'];this[_0x1953('0x18')]=_0x4e73f7[_0x1953('0x7')][_0x1953('0x19')]||'';this[_0x1953('0x1a')]=moment()[_0x1953('0x1b')](_0x1953('0x1c'));this[_0x1953('0x1d')]=_0x4e73f7[_0x1953('0x1d')];this['callbackuniqueid']=_0x4e73f7[_0x1953('0x1e')];this[_0x1953('0x1f')]=_0x4e73f7['callbackat'];this[_0x1953('0x20')]=_0x4e73f7[_0x1953('0x20')];this[_0x1953('0x21')]='';this[_0x1953('0x22')]='';}Action[_0x1953('0x23')]['getCaller']=function(){return util[_0x1953('0x1b')]('\x22%s\x22\x20<%s>',this[_0x1953('0x6')],this[_0x1953('0x4')][_0x1953('0x24')]>0x0?this[_0x1953('0x25')]['substring'](this[_0x1953('0x4')]['dialCutDigit']):this[_0x1953('0x25')]);};Action[_0x1953('0x23')]['getQueue']=function(){return this[_0x1953('0x26')];};module[_0x1953('0x27')]=Action; \ No newline at end of file +var _0xea34=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util','lodash','moment','isNil','string','voiceQueue','name','phone','firstName','Contact','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x97aa5a,_0x1db1d9){var _0x544dee=function(_0x37f07d){while(--_0x37f07d){_0x97aa5a['push'](_0x97aa5a['shift']());}};_0x544dee(++_0x1db1d9);}(_0xea34,0x142));var _0x4ea3=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xea34[_0x2be8c2];return _0x97f531;};'use strict';var util=require(_0x4ea3('0x0'));var _=require(_0x4ea3('0x1'));var moment=require(_0x4ea3('0x2'));function checkNameSurname(_0xb0a756,_0x1aad2e,_0x5042ad){var _0xc9968e='';if(!_[_0x4ea3('0x3')](_0x1aad2e)&&'string'===typeof _0x1aad2e){_0xc9968e+=_0x1aad2e;}if(!_['isNil'](_0x5042ad)&&_0x4ea3('0x4')===typeof _0x5042ad){_0xc9968e+='\x20'+_0x5042ad;}if(_0xc9968e!==''){return _0xc9968e;}return _0xb0a756;}function Action(_0x1cec15,_0x301745,_0x580e90){this[_0x4ea3('0x5')]=_0x1cec15;this['uniqueid']=_0x580e90||undefined;this[_0x4ea3('0x6')]=checkNameSurname(_0x301745['Contact'][_0x4ea3('0x7')],_0x301745['Contact'][_0x4ea3('0x8')],_0x301745[_0x4ea3('0x9')][_0x4ea3('0xa')]);this[_0x4ea3('0xb')]=_0x301745[_0x4ea3('0x7')];this['queue']=_0x1cec15[_0x4ea3('0x6')];this[_0x4ea3('0xc')]=_0x301745[_0x4ea3('0xc')]||![];this[_0x4ea3('0xd')]=_0x1cec15[_0x4ea3('0xd')];this['dialQueueTimeout']=_0x1cec15[_0x4ea3('0xe')]||0x3;this[_0x4ea3('0xf')]=_0x301745['scheduledat'];this['countbusyretry']=_0x301745[_0x4ea3('0x10')];this[_0x4ea3('0x11')]=_0x301745[_0x4ea3('0x11')];this['countnoanswerretry']=_0x301745['countnoanswerretry'];this[_0x4ea3('0x12')]=_0x301745[_0x4ea3('0x12')];this[_0x4ea3('0x13')]=_0x301745[_0x4ea3('0x13')];this[_0x4ea3('0x14')]=_0x301745[_0x4ea3('0x14')];this['countmachineretry']=_0x301745[_0x4ea3('0x15')];this[_0x4ea3('0x16')]=_0x301745[_0x4ea3('0x16')];this[_0x4ea3('0x17')]=_0x301745[_0x4ea3('0x17')];this[_0x4ea3('0x18')]=_0x301745[_0x4ea3('0x18')];this['UserId']=_0x301745[_0x4ea3('0x19')];this[_0x4ea3('0x1a')]=_0x301745[_0x4ea3('0x1a')];this[_0x4ea3('0x1b')]=_0x301745[_0x4ea3('0x1b')];this['idHopper']=_0x301745['id'];this[_0x4ea3('0x1c')]=_0x301745[_0x4ea3('0x9')]['firstName']||'';this['starttime']=moment()[_0x4ea3('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4ea3('0x1e')]=_0x301745['callback'];this['callbackuniqueid']=_0x301745['callbackuniqueid'];this[_0x4ea3('0x1f')]=_0x301745['callbackat'];this[_0x4ea3('0x20')]=_0x301745[_0x4ea3('0x20')];this[_0x4ea3('0x21')]='';this[_0x4ea3('0x22')]='';}Action[_0x4ea3('0x23')][_0x4ea3('0x24')]=function(){return util[_0x4ea3('0x1d')](_0x4ea3('0x25'),this[_0x4ea3('0x6')],this[_0x4ea3('0x5')][_0x4ea3('0x26')]>0x0?this[_0x4ea3('0xb')][_0x4ea3('0x27')](this[_0x4ea3('0x5')][_0x4ea3('0x26')]):this[_0x4ea3('0xb')]);};Action[_0x4ea3('0x23')][_0x4ea3('0x28')]=function(){return this[_0x4ea3('0x29')];};module[_0x4ea3('0x2a')]=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 a971358..8da5cda 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 _0xd339=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','getSeconds','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','Answer','scheduledat'];(function(_0x4d2ac6,_0x50a6f9){var _0x2072cd=function(_0x513dc9){while(--_0x513dc9){_0x4d2ac6['push'](_0x4d2ac6['shift']());}};_0x2072cd(++_0x50a6f9);}(_0xd339,0x1e0));var _0x9d33=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd339[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require('moment');var utils=require(_0x9d33('0x0'));function AgentComplete(_0x2a0628,_0x315f6a){this[_0x9d33('0x1')]=0x4;this['statedesc']=_0x9d33('0x2');this['scheduledat']=_0x2a0628[_0x9d33('0x3')];this['type']=_0x2a0628[_0x9d33('0x4')];this[_0x9d33('0x5')]=_0x2a0628[_0x9d33('0x4')]===_0x9d33('0x6')?_0x9d33('0x7'):_0x2a0628[_0x9d33('0x4')];this[_0x9d33('0x8')]=_0x2a0628[_0x9d33('0x8')];this['countcongestionretry']=_0x2a0628[_0x9d33('0x9')];this[_0x9d33('0xa')]=_0x2a0628[_0x9d33('0xa')];this[_0x9d33('0xb')]=_0x2a0628[_0x9d33('0x8')]+_0x2a0628[_0x9d33('0x9')]+_0x2a0628[_0x9d33('0xa')]+_0x2a0628[_0x9d33('0xc')]+_0x2a0628[_0x9d33('0xd')]+_0x2a0628[_0x9d33('0xe')]+_0x2a0628['countmachineretry']+_0x2a0628['countagentrejectretry'];this[_0x9d33('0xc')]=_0x2a0628[_0x9d33('0xc')];this['countdropretry']=_0x2a0628[_0x9d33('0xd')];this[_0x9d33('0xe')]=_0x2a0628[_0x9d33('0xe')];this['countmachineretry']=_0x2a0628[_0x9d33('0xf')];this[_0x9d33('0x10')]=_0x2a0628[_0x9d33('0x10')];this[_0x9d33('0x11')]=_0x315f6a[_0x9d33('0x11')];this[_0x9d33('0x12')]=_0x2a0628[_0x9d33('0x13')];this['calleridnum']=_0x2a0628[_0x9d33('0x14')];this[_0x9d33('0x15')]=_0x2a0628[_0x9d33('0x15')];this['responsetime']=_0x2a0628[_0x9d33('0x16')];this[_0x9d33('0x17')]=_0x2a0628[_0x9d33('0x17')];this['endtime']=moment()[_0x9d33('0x18')](_0x9d33('0x19'));this['ringtime']=utils['getSeconds'](_0x2a0628[_0x9d33('0x16')],_0x2a0628[_0x9d33('0x15')]);this[_0x9d33('0x1a')]=utils['getSeconds'](_0x2a0628[_0x9d33('0x17')],_0x2a0628[_0x9d33('0x16')]);this['talktime']=utils[_0x9d33('0x1b')](this[_0x9d33('0x1c')],_0x2a0628[_0x9d33('0x17')]);this['queue']=_0x315f6a[_0x9d33('0x7')];this[_0x9d33('0x1d')]=_0x315f6a[_0x9d33('0x1d')];this[_0x9d33('0x1e')]=_0x315f6a['reason'];this[_0x9d33('0x1f')]=_0x2a0628['callback'];this[_0x9d33('0x20')]=_0x2a0628['callbackuniqueid'];this[_0x9d33('0x21')]=_0x2a0628[_0x9d33('0x21')];this[_0x9d33('0x22')]=_0x2a0628['recallme'];this[_0x9d33('0x23')]=_0x2a0628[_0x9d33('0x23')];this[_0x9d33('0x24')]=_0x2a0628[_0x9d33('0x24')];this[_0x9d33('0x25')]=_0x2a0628[_0x9d33('0x25')];this[_0x9d33('0x26')]=_0x2a0628[_0x9d33('0x26')];this[_0x9d33('0x27')]=_0x2a0628['CampaignId'];this['originatecalleridnum']=_0x2a0628[_0x9d33('0x28')]||'';this['originatecalleridname']=_0x2a0628[_0x9d33('0x29')]||'';this[_0x9d33('0x2a')]=_0x2a0628[_0x9d33('0x2a')];}module[_0x9d33('0x2b')]=AgentComplete; \ No newline at end of file +var _0xe64b=['Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','responsetime','answertime','endtime','format','ringtime','getSeconds','starttime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc'];(function(_0x5950bd,_0x103e16){var _0x33e816=function(_0x439344){while(--_0x439344){_0x5950bd['push'](_0x5950bd['shift']());}};_0x33e816(++_0x103e16);}(_0xe64b,0x116));var _0xbe64=function(_0x55f589,_0x470548){_0x55f589=_0x55f589-0x0;var _0x4eeb70=_0xe64b[_0x55f589];return _0x4eeb70;};'use strict';var moment=require(_0xbe64('0x0'));var utils=require(_0xbe64('0x1'));function AgentComplete(_0x73f7bb,_0x86a40f){this[_0xbe64('0x2')]=0x4;this[_0xbe64('0x3')]=_0xbe64('0x4');this[_0xbe64('0x5')]=_0x73f7bb[_0xbe64('0x5')];this[_0xbe64('0x6')]=_0x73f7bb['type'];this[_0xbe64('0x7')]=_0x73f7bb['type']===_0xbe64('0x8')?_0xbe64('0x9'):_0x73f7bb['type'];this['countbusyretry']=_0x73f7bb['countbusyretry'];this[_0xbe64('0xa')]=_0x73f7bb['countcongestionretry'];this[_0xbe64('0xb')]=_0x73f7bb[_0xbe64('0xb')];this[_0xbe64('0xc')]=_0x73f7bb[_0xbe64('0xd')]+_0x73f7bb[_0xbe64('0xa')]+_0x73f7bb[_0xbe64('0xb')]+_0x73f7bb[_0xbe64('0xe')]+_0x73f7bb[_0xbe64('0xf')]+_0x73f7bb[_0xbe64('0x10')]+_0x73f7bb[_0xbe64('0x11')]+_0x73f7bb[_0xbe64('0x12')];this[_0xbe64('0xe')]=_0x73f7bb[_0xbe64('0xe')];this[_0xbe64('0xf')]=_0x73f7bb['countdropretry'];this[_0xbe64('0x10')]=_0x73f7bb['countabandonedretry'];this[_0xbe64('0x11')]=_0x73f7bb[_0xbe64('0x11')];this['countagentrejectretry']=_0x73f7bb[_0xbe64('0x12')];this[_0xbe64('0x13')]=_0x86a40f[_0xbe64('0x13')];this[_0xbe64('0x14')]=_0x73f7bb[_0xbe64('0x15')];this[_0xbe64('0x16')]=_0x73f7bb[_0xbe64('0x17')];this['starttime']=_0x73f7bb['starttime'];this[_0xbe64('0x18')]=_0x73f7bb[_0xbe64('0x18')];this[_0xbe64('0x19')]=_0x73f7bb['answertime'];this[_0xbe64('0x1a')]=moment()[_0xbe64('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbe64('0x1c')]=utils[_0xbe64('0x1d')](_0x73f7bb[_0xbe64('0x18')],_0x73f7bb[_0xbe64('0x1e')]);this['holdtime']=utils[_0xbe64('0x1d')](_0x73f7bb[_0xbe64('0x19')],_0x73f7bb[_0xbe64('0x18')]);this[_0xbe64('0x1f')]=utils[_0xbe64('0x1d')](this[_0xbe64('0x1a')],_0x73f7bb[_0xbe64('0x19')]);this[_0xbe64('0x9')]=_0x86a40f[_0xbe64('0x9')];this['membername']=_0x86a40f[_0xbe64('0x20')];this[_0xbe64('0x21')]=_0x86a40f[_0xbe64('0x21')];this[_0xbe64('0x22')]=_0x73f7bb['callback'];this['callbackuniqueid']=_0x73f7bb[_0xbe64('0x23')];this['callbackat']=_0x73f7bb[_0xbe64('0x24')];this[_0xbe64('0x25')]=_0x73f7bb[_0xbe64('0x25')];this['ContactId']=_0x73f7bb[_0xbe64('0x26')];this[_0xbe64('0x27')]=_0x73f7bb[_0xbe64('0x27')];this[_0xbe64('0x28')]=_0x73f7bb[_0xbe64('0x28')];this[_0xbe64('0x29')]=_0x73f7bb[_0xbe64('0x29')];this[_0xbe64('0x2a')]=_0x73f7bb[_0xbe64('0x2a')];this['originatecalleridnum']=_0x73f7bb[_0xbe64('0x2b')]||'';this[_0xbe64('0x2c')]=_0x73f7bb[_0xbe64('0x2c')]||'';this['agiafterat']=_0x73f7bb[_0xbe64('0x2d')];}module[_0xbe64('0x2e')]=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 6df0785..aa08e88 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 _0x391d=['countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','scheduledat','type','outbound','countbusyretry','countcongestionretry'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x391d,0xe9));var _0xd391=function(_0x34ece7,_0x197dce){_0x34ece7=_0x34ece7-0x0;var _0x2bb837=_0x391d[_0x34ece7];return _0x2bb837;};'use strict';function Final(_0x6e09a7){this['uniqueid']=_0x6e09a7['uniqueid'];this[_0xd391('0x0')]=_0x6e09a7['scheduledat'];this[_0xd391('0x1')]=_0x6e09a7[_0xd391('0x1')];this['campaigntype']=_0x6e09a7[_0xd391('0x1')]===_0xd391('0x2')?'queue':_0x6e09a7['type'];this['countbusyretry']=_0x6e09a7[_0xd391('0x3')];this[_0xd391('0x4')]=_0x6e09a7['countcongestionretry'];this[_0xd391('0x5')]=_0x6e09a7[_0xd391('0x5')];this[_0xd391('0x6')]=_0x6e09a7[_0xd391('0x3')]+_0x6e09a7[_0xd391('0x4')]+_0x6e09a7[_0xd391('0x5')]+_0x6e09a7['countnosuchnumberretry']+_0x6e09a7[_0xd391('0x7')]+_0x6e09a7[_0xd391('0x8')]+_0x6e09a7[_0xd391('0x9')]+_0x6e09a7[_0xd391('0xa')];this['countnosuchnumberretry']=_0x6e09a7[_0xd391('0xb')];this[_0xd391('0x7')]=_0x6e09a7[_0xd391('0x7')];this[_0xd391('0x8')]=_0x6e09a7[_0xd391('0x8')];this[_0xd391('0x9')]=_0x6e09a7['countmachineretry'];this[_0xd391('0xa')]=_0x6e09a7[_0xd391('0xa')];this[_0xd391('0xc')]=_0x6e09a7['queue'];this[_0xd391('0xd')]=_0x6e09a7[_0xd391('0xd')];this[_0xd391('0xe')]=_0x6e09a7[_0xd391('0xe')];this[_0xd391('0xf')]=_0x6e09a7[_0xd391('0xf')];this['responsetime']=_0x6e09a7[_0xd391('0x10')];this[_0xd391('0x11')]=_0x6e09a7['responsetime'];this[_0xd391('0x12')]=_0x6e09a7[_0xd391('0x12')]||0x0;this[_0xd391('0x13')]=_0x6e09a7[_0xd391('0x13')]||0x0;this['talktime']=_0x6e09a7[_0xd391('0x14')]||0x0;this[_0xd391('0x15')]=_0x6e09a7['callback'];this[_0xd391('0x16')]=_0x6e09a7[_0xd391('0x16')];this['callbackat']=_0x6e09a7[_0xd391('0x17')];this[_0xd391('0x18')]=_0x6e09a7[_0xd391('0x18')];this[_0xd391('0x19')]=_0x6e09a7['ContactId'];this['ListId']=_0x6e09a7[_0xd391('0x1a')];this[_0xd391('0x1b')]=_0x6e09a7[_0xd391('0x1b')];this[_0xd391('0x1c')]=_0x6e09a7['VoiceQueueId'];this[_0xd391('0x1d')]=_0x6e09a7[_0xd391('0x1d')];this['originatecalleridnum']=_0x6e09a7[_0xd391('0x1e')]||'';this[_0xd391('0x1f')]=_0x6e09a7[_0xd391('0x1f')]||'';this[_0xd391('0x20')]=_0x6e09a7[_0xd391('0x20')];this[_0xd391('0x21')]=_0x6e09a7['statedesc'];}module['exports']=Final; \ No newline at end of file +var _0xc44b=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xc44b,0x1e2));var _0xbc44=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xc44b[_0x1589dd];return _0x1bddd1;};'use strict';function Final(_0x10cff7){this[_0xbc44('0x0')]=_0x10cff7[_0xbc44('0x0')];this[_0xbc44('0x1')]=_0x10cff7[_0xbc44('0x1')];this[_0xbc44('0x2')]=_0x10cff7[_0xbc44('0x2')];this[_0xbc44('0x3')]=_0x10cff7[_0xbc44('0x2')]==='outbound'?'queue':_0x10cff7[_0xbc44('0x2')];this['countbusyretry']=_0x10cff7[_0xbc44('0x4')];this['countcongestionretry']=_0x10cff7[_0xbc44('0x5')];this[_0xbc44('0x6')]=_0x10cff7[_0xbc44('0x6')];this[_0xbc44('0x7')]=_0x10cff7['countbusyretry']+_0x10cff7[_0xbc44('0x5')]+_0x10cff7['countnoanswerretry']+_0x10cff7[_0xbc44('0x8')]+_0x10cff7[_0xbc44('0x9')]+_0x10cff7['countabandonedretry']+_0x10cff7[_0xbc44('0xa')]+_0x10cff7[_0xbc44('0xb')];this[_0xbc44('0x8')]=_0x10cff7[_0xbc44('0x8')];this[_0xbc44('0x9')]=_0x10cff7['countdropretry'];this[_0xbc44('0xc')]=_0x10cff7[_0xbc44('0xc')];this['countmachineretry']=_0x10cff7[_0xbc44('0xa')];this[_0xbc44('0xb')]=_0x10cff7[_0xbc44('0xb')];this[_0xbc44('0xd')]=_0x10cff7[_0xbc44('0xd')];this['calleridname']=_0x10cff7[_0xbc44('0xe')];this[_0xbc44('0xf')]=_0x10cff7[_0xbc44('0xf')];this['starttime']=_0x10cff7[_0xbc44('0x10')];this[_0xbc44('0x11')]=_0x10cff7[_0xbc44('0x11')];this[_0xbc44('0x12')]=_0x10cff7[_0xbc44('0x11')];this['ringtime']=_0x10cff7['ringtime']||0x0;this['holdtime']=_0x10cff7[_0xbc44('0x13')]||0x0;this[_0xbc44('0x14')]=_0x10cff7['talktime']||0x0;this[_0xbc44('0x15')]=_0x10cff7[_0xbc44('0x15')];this[_0xbc44('0x16')]=_0x10cff7['callbackuniqueid'];this[_0xbc44('0x17')]=_0x10cff7[_0xbc44('0x17')];this[_0xbc44('0x18')]=_0x10cff7[_0xbc44('0x18')];this[_0xbc44('0x19')]=_0x10cff7[_0xbc44('0x19')];this[_0xbc44('0x1a')]=_0x10cff7[_0xbc44('0x1a')];this[_0xbc44('0x1b')]=_0x10cff7[_0xbc44('0x1b')];this['VoiceQueueId']=_0x10cff7[_0xbc44('0x1c')];this[_0xbc44('0x1d')]=_0x10cff7[_0xbc44('0x1d')];this['originatecalleridnum']=_0x10cff7[_0xbc44('0x1e')]||'';this[_0xbc44('0x1f')]=_0x10cff7[_0xbc44('0x1f')]||'';this[_0xbc44('0x20')]=_0x10cff7[_0xbc44('0x20')];this[_0xbc44('0x21')]=_0x10cff7[_0xbc44('0x21')];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 97edba0..3014db9 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 _0xec6a=['membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xec6a,0x1c6));var _0xaec6=function(_0x348007,_0x8ecd4a){_0x348007=_0x348007-0x0;var _0x2082e3=_0xec6a[_0x348007];return _0x2082e3;};'use strict';var moment=require(_0xaec6('0x0'));var utils=require(_0xaec6('0x1'));function Hangup(_0x56695a,_0x197b1d){this[_0xaec6('0x2')]=0x4;this['statedesc']='Answer';this[_0xaec6('0x3')]=_0x56695a[_0xaec6('0x3')];this[_0xaec6('0x4')]=_0x56695a[_0xaec6('0x4')];this[_0xaec6('0x5')]=_0x56695a[_0xaec6('0x4')]===_0xaec6('0x6')?'queue':_0x56695a['type'];this[_0xaec6('0x7')]=_0x56695a[_0xaec6('0x7')]||![];this[_0xaec6('0x8')]=_0x56695a[_0xaec6('0x8')];this['countcongestionretry']=_0x56695a[_0xaec6('0x9')];this['countnoanswerretry']=_0x56695a[_0xaec6('0xa')];this['countglobal']=_0x56695a[_0xaec6('0x8')]+_0x56695a[_0xaec6('0x9')]+_0x56695a[_0xaec6('0xa')]+_0x56695a[_0xaec6('0xb')]+_0x56695a['countdropretry']+_0x56695a[_0xaec6('0xc')]+_0x56695a[_0xaec6('0xd')]+_0x56695a[_0xaec6('0xe')];this[_0xaec6('0xb')]=_0x56695a[_0xaec6('0xb')];this[_0xaec6('0xf')]=_0x56695a[_0xaec6('0xf')];this[_0xaec6('0xc')]=_0x56695a[_0xaec6('0xc')];this['countmachineretry']=_0x56695a[_0xaec6('0xd')];this[_0xaec6('0xe')]=_0x56695a[_0xaec6('0xe')];this[_0xaec6('0x10')]=_0x197b1d[_0xaec6('0x10')];this['calleridname']=_0x56695a[_0xaec6('0x11')];this[_0xaec6('0x12')]=_0x56695a[_0xaec6('0x13')];this[_0xaec6('0x14')]=_0x56695a[_0xaec6('0x14')];this[_0xaec6('0x15')]=_0x56695a['responsetime'];this[_0xaec6('0x16')]=moment()[_0xaec6('0x17')](_0xaec6('0x18'));this[_0xaec6('0x19')]=utils[_0xaec6('0x1a')](_0x56695a[_0xaec6('0x15')],_0x56695a[_0xaec6('0x14')]);this[_0xaec6('0x1b')]=0x0;this[_0xaec6('0x1c')]=utils[_0xaec6('0x1a')](this[_0xaec6('0x16')],_0x56695a[_0xaec6('0x15')]);this[_0xaec6('0x1d')]=_0x56695a[_0xaec6('0x1d')];this[_0xaec6('0x1e')]=_0xaec6('0x1f');this[_0xaec6('0x20')]=_0x197b1d[_0xaec6('0x21')];this[_0xaec6('0x22')]=_0x56695a[_0xaec6('0x22')];this['callbackuniqueid']=_0x56695a[_0xaec6('0x23')];this[_0xaec6('0x24')]=_0x56695a[_0xaec6('0x24')];this['recallme']=_0x56695a[_0xaec6('0x25')];this[_0xaec6('0x26')]=_0x56695a[_0xaec6('0x26')];this['ListId']=_0x56695a[_0xaec6('0x27')];this[_0xaec6('0x28')]=_0x56695a[_0xaec6('0x28')];this['VoiceQueueId']=_0x56695a[_0xaec6('0x29')];this[_0xaec6('0x2a')]=_0x56695a[_0xaec6('0x2a')];}module[_0xaec6('0x2b')]=Hangup; \ No newline at end of file +var _0x954d=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x397f34,_0x3ac328){var _0x272cda=function(_0x2c9756){while(--_0x2c9756){_0x397f34['push'](_0x397f34['shift']());}};_0x272cda(++_0x3ac328);}(_0x954d,0x110));var _0xd954=function(_0xb8acf0,_0x10998d){_0xb8acf0=_0xb8acf0-0x0;var _0xf96b2f=_0x954d[_0xb8acf0];return _0xf96b2f;};'use strict';var moment=require(_0xd954('0x0'));var utils=require('../utils');function Hangup(_0x522458,_0x45c94c){this[_0xd954('0x1')]=0x4;this[_0xd954('0x2')]='Answer';this['scheduledat']=_0x522458['scheduledat'];this[_0xd954('0x3')]=_0x522458['type'];this['campaigntype']=_0x522458[_0xd954('0x3')]==='outbound'?_0xd954('0x4'):_0x522458[_0xd954('0x3')];this[_0xd954('0x5')]=_0x522458[_0xd954('0x5')]||![];this[_0xd954('0x6')]=_0x522458[_0xd954('0x6')];this[_0xd954('0x7')]=_0x522458[_0xd954('0x7')];this[_0xd954('0x8')]=_0x522458[_0xd954('0x8')];this[_0xd954('0x9')]=_0x522458[_0xd954('0x6')]+_0x522458[_0xd954('0x7')]+_0x522458[_0xd954('0x8')]+_0x522458['countnosuchnumberretry']+_0x522458['countdropretry']+_0x522458['countabandonedretry']+_0x522458[_0xd954('0xa')]+_0x522458[_0xd954('0xb')];this['countnosuchnumberretry']=_0x522458[_0xd954('0xc')];this['countdropretry']=_0x522458['countdropretry'];this[_0xd954('0xd')]=_0x522458[_0xd954('0xd')];this['countmachineretry']=_0x522458[_0xd954('0xa')];this[_0xd954('0xb')]=_0x522458[_0xd954('0xb')];this[_0xd954('0xe')]=_0x45c94c[_0xd954('0xe')];this[_0xd954('0xf')]=_0x522458[_0xd954('0x10')];this[_0xd954('0x11')]=_0x522458[_0xd954('0x12')];this[_0xd954('0x13')]=_0x522458[_0xd954('0x13')];this[_0xd954('0x14')]=_0x522458[_0xd954('0x14')];this[_0xd954('0x15')]=moment()[_0xd954('0x16')](_0xd954('0x17'));this[_0xd954('0x18')]=utils[_0xd954('0x19')](_0x522458[_0xd954('0x14')],_0x522458['starttime']);this[_0xd954('0x1a')]=0x0;this[_0xd954('0x1b')]=utils[_0xd954('0x19')](this[_0xd954('0x15')],_0x522458[_0xd954('0x14')]);this[_0xd954('0x4')]=_0x522458[_0xd954('0x4')];this[_0xd954('0x1c')]=_0xd954('0x1d');this[_0xd954('0x1e')]=_0x45c94c[_0xd954('0x1f')];this[_0xd954('0x20')]=_0x522458[_0xd954('0x20')];this[_0xd954('0x21')]=_0x522458[_0xd954('0x21')];this[_0xd954('0x22')]=_0x522458[_0xd954('0x22')];this[_0xd954('0x23')]=_0x522458[_0xd954('0x23')];this[_0xd954('0x24')]=_0x522458[_0xd954('0x24')];this[_0xd954('0x25')]=_0x522458[_0xd954('0x25')];this['UserId']=_0x522458[_0xd954('0x26')];this[_0xd954('0x27')]=_0x522458[_0xd954('0x27')];this[_0xd954('0x28')]=_0x522458[_0xd954('0x28')];}module[_0xd954('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 20f4368..280da90 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 _0x97aa=['state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x1b7a43,_0x375ceb){var _0x501887=function(_0x25de4f){while(--_0x25de4f){_0x1b7a43['push'](_0x1b7a43['shift']());}};_0x501887(++_0x375ceb);}(_0x97aa,0x9b));var _0xa97a=function(_0x23592b,_0x5082e5){_0x23592b=_0x23592b-0x0;var _0x100e95=_0x97aa[_0x23592b];return _0x100e95;};'use strict';var utils=require(_0xa97a('0x0'));function History(_0x5313cf){this[_0xa97a('0x1')]=_0x5313cf[_0xa97a('0x1')];this[_0xa97a('0x2')]=_0x5313cf[_0xa97a('0x2')]||undefined;this[_0xa97a('0x3')]=_0x5313cf[_0xa97a('0x3')];this[_0xa97a('0x4')]=_0x5313cf[_0xa97a('0x3')]==='outbound'?'queue':_0x5313cf[_0xa97a('0x3')];this[_0xa97a('0x5')]=_0x5313cf[_0xa97a('0x5')];this[_0xa97a('0x6')]=_0x5313cf['countcongestionretry'];this[_0xa97a('0x7')]=_0x5313cf[_0xa97a('0x7')];this[_0xa97a('0x8')]=_0x5313cf[_0xa97a('0x5')]+_0x5313cf[_0xa97a('0x6')]+_0x5313cf['countnoanswerretry']+_0x5313cf[_0xa97a('0x9')]+_0x5313cf['countdropretry']+_0x5313cf[_0xa97a('0xa')]+_0x5313cf[_0xa97a('0xb')]+_0x5313cf[_0xa97a('0xc')];this[_0xa97a('0x9')]=_0x5313cf[_0xa97a('0x9')];this[_0xa97a('0xd')]=_0x5313cf[_0xa97a('0xd')];this[_0xa97a('0xa')]=_0x5313cf['countabandonedretry'];this[_0xa97a('0xb')]=_0x5313cf[_0xa97a('0xb')];this[_0xa97a('0xc')]=_0x5313cf[_0xa97a('0xc')];this['queue']=_0x5313cf[_0xa97a('0xe')];this[_0xa97a('0xf')]=_0x5313cf['name'];this[_0xa97a('0x10')]=_0x5313cf[_0xa97a('0x11')];this[_0xa97a('0x12')]=_0x5313cf[_0xa97a('0x12')];this[_0xa97a('0x13')]=_0x5313cf[_0xa97a('0x13')];this['endtime']=_0x5313cf[_0xa97a('0x13')];this[_0xa97a('0x14')]=utils[_0xa97a('0x15')](_0x5313cf[_0xa97a('0x13')],_0x5313cf[_0xa97a('0x12')]);this[_0xa97a('0x16')]=0x0;this[_0xa97a('0x17')]=0x0;this[_0xa97a('0x18')]=_0x5313cf[_0xa97a('0x18')];this[_0xa97a('0x19')]=_0x5313cf['callbackuniqueid'];this[_0xa97a('0x1a')]=_0x5313cf[_0xa97a('0x1a')];this[_0xa97a('0x1b')]=_0x5313cf['recallme'];this[_0xa97a('0x1c')]=_0x5313cf[_0xa97a('0x1c')];this[_0xa97a('0x1d')]=_0x5313cf[_0xa97a('0x1d')];this['UserId']=_0x5313cf[_0xa97a('0x1e')];this[_0xa97a('0x1f')]=_0x5313cf['VoiceQueueId'];this[_0xa97a('0x20')]=_0x5313cf[_0xa97a('0x20')];this[_0xa97a('0x21')]=_0x5313cf['originatecalleridnum']||'';this[_0xa97a('0x22')]=_0x5313cf['originatecalleridname']||'';this[_0xa97a('0x23')]=_0x5313cf[_0xa97a('0x23')];this[_0xa97a('0x24')]=_0x5313cf[_0xa97a('0x24')];}module[_0xa97a('0x25')]=History; \ No newline at end of file +var _0xc8b1=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xc8b1,0x10d));var _0x1c8b=function(_0xbfca16,_0xeb44ec){_0xbfca16=_0xbfca16-0x0;var _0x34fcd8=_0xc8b1[_0xbfca16];return _0x34fcd8;};'use strict';var utils=require(_0x1c8b('0x0'));function History(_0x52d4b8){this[_0x1c8b('0x1')]=_0x52d4b8[_0x1c8b('0x1')];this[_0x1c8b('0x2')]=_0x52d4b8[_0x1c8b('0x2')]||undefined;this[_0x1c8b('0x3')]=_0x52d4b8['type'];this[_0x1c8b('0x4')]=_0x52d4b8[_0x1c8b('0x3')]==='outbound'?_0x1c8b('0x5'):_0x52d4b8[_0x1c8b('0x3')];this[_0x1c8b('0x6')]=_0x52d4b8[_0x1c8b('0x6')];this['countcongestionretry']=_0x52d4b8[_0x1c8b('0x7')];this[_0x1c8b('0x8')]=_0x52d4b8['countnoanswerretry'];this[_0x1c8b('0x9')]=_0x52d4b8['countbusyretry']+_0x52d4b8[_0x1c8b('0x7')]+_0x52d4b8[_0x1c8b('0x8')]+_0x52d4b8[_0x1c8b('0xa')]+_0x52d4b8[_0x1c8b('0xb')]+_0x52d4b8['countabandonedretry']+_0x52d4b8[_0x1c8b('0xc')]+_0x52d4b8[_0x1c8b('0xd')];this[_0x1c8b('0xa')]=_0x52d4b8[_0x1c8b('0xa')];this[_0x1c8b('0xb')]=_0x52d4b8[_0x1c8b('0xb')];this[_0x1c8b('0xe')]=_0x52d4b8[_0x1c8b('0xe')];this['countmachineretry']=_0x52d4b8['countmachineretry'];this[_0x1c8b('0xd')]=_0x52d4b8[_0x1c8b('0xd')];this[_0x1c8b('0x5')]=_0x52d4b8[_0x1c8b('0x5')];this[_0x1c8b('0xf')]=_0x52d4b8['name'];this[_0x1c8b('0x10')]=_0x52d4b8[_0x1c8b('0x11')];this['starttime']=_0x52d4b8[_0x1c8b('0x12')];this[_0x1c8b('0x13')]=_0x52d4b8[_0x1c8b('0x13')];this[_0x1c8b('0x14')]=_0x52d4b8[_0x1c8b('0x13')];this['ringtime']=utils[_0x1c8b('0x15')](_0x52d4b8[_0x1c8b('0x13')],_0x52d4b8[_0x1c8b('0x12')]);this[_0x1c8b('0x16')]=0x0;this['talktime']=0x0;this[_0x1c8b('0x17')]=_0x52d4b8[_0x1c8b('0x17')];this['callbackuniqueid']=_0x52d4b8[_0x1c8b('0x18')];this[_0x1c8b('0x19')]=_0x52d4b8[_0x1c8b('0x19')];this[_0x1c8b('0x1a')]=_0x52d4b8[_0x1c8b('0x1a')];this[_0x1c8b('0x1b')]=_0x52d4b8[_0x1c8b('0x1b')];this[_0x1c8b('0x1c')]=_0x52d4b8[_0x1c8b('0x1c')];this['UserId']=_0x52d4b8[_0x1c8b('0x1d')];this[_0x1c8b('0x1e')]=_0x52d4b8[_0x1c8b('0x1e')];this['CampaignId']=_0x52d4b8[_0x1c8b('0x1f')];this[_0x1c8b('0x20')]=_0x52d4b8[_0x1c8b('0x20')]||'';this[_0x1c8b('0x21')]=_0x52d4b8[_0x1c8b('0x21')]||'';this['state']=_0x52d4b8[_0x1c8b('0x22')];this['statedesc']=_0x52d4b8[_0x1c8b('0x23')];}module[_0x1c8b('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 474ff12..4a2b8c9 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 _0x4976=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat'];(function(_0x3e27b4,_0x3b5f8d){var _0x4d5561=function(_0x347aae){while(--_0x347aae){_0x3e27b4['push'](_0x3e27b4['shift']());}};_0x4d5561(++_0x3b5f8d);}(_0x4976,0x132));var _0x6497=function(_0x2e799f,_0x4c1eff){_0x2e799f=_0x2e799f-0x0;var _0x415c56=_0x4976[_0x2e799f];return _0x415c56;};'use strict';var utils=require(_0x6497('0x0'));function QueueCallerAbandon(_0x2836f7,_0x495fef){this[_0x6497('0x1')]=_0x2836f7[_0x6497('0x1')];this[_0x6497('0x2')]=_0x2836f7[_0x6497('0x2')];this[_0x6497('0x3')]=_0x2836f7['type']===_0x6497('0x4')?_0x6497('0x5'):_0x2836f7[_0x6497('0x2')];this[_0x6497('0x6')]=_0x2836f7[_0x6497('0x6')];this[_0x6497('0x7')]=_0x2836f7[_0x6497('0x7')];this[_0x6497('0x8')]=_0x2836f7[_0x6497('0x8')];this[_0x6497('0x9')]=_0x2836f7[_0x6497('0x6')]+_0x2836f7[_0x6497('0x7')]+_0x2836f7[_0x6497('0x8')]+_0x2836f7['countnosuchnumberretry']+_0x2836f7['countdropretry']+_0x2836f7['countabandonedretry']+_0x2836f7[_0x6497('0xa')]+_0x2836f7[_0x6497('0xb')];this[_0x6497('0xc')]=_0x2836f7[_0x6497('0xc')];this[_0x6497('0xd')]=_0x2836f7[_0x6497('0xd')];this[_0x6497('0xe')]=_0x2836f7['countabandonedretry'];this[_0x6497('0xa')]=_0x2836f7[_0x6497('0xa')];this['countagentrejectretry']=_0x2836f7[_0x6497('0xb')];this[_0x6497('0xf')]=_0x495fef[_0x6497('0xf')];this[_0x6497('0x10')]=_0x2836f7[_0x6497('0x11')];this['calleridnum']=_0x2836f7[_0x6497('0x12')];this[_0x6497('0x13')]=_0x2836f7[_0x6497('0x13')];this[_0x6497('0x14')]=_0x2836f7[_0x6497('0x14')];this[_0x6497('0x15')]=_0x2836f7[_0x6497('0x15')];this[_0x6497('0x16')]=_0x2836f7['dropreason'];this[_0x6497('0x17')]=this[_0x6497('0x15')];this[_0x6497('0x18')]=utils[_0x6497('0x19')](_0x2836f7[_0x6497('0x14')],_0x2836f7[_0x6497('0x13')]);this[_0x6497('0x1a')]=utils[_0x6497('0x19')](this[_0x6497('0x15')],_0x2836f7[_0x6497('0x14')]);this['talktime']=0x0;this[_0x6497('0x5')]=_0x495fef['queue'];this[_0x6497('0x1b')]=_0x495fef[_0x6497('0x1c')];this[_0x6497('0x1d')]=_0x495fef[_0x6497('0x1d')];this['callback']=_0x2836f7['callback'];this['callbackuniqueid']=_0x2836f7[_0x6497('0x1e')];this[_0x6497('0x1f')]=_0x2836f7[_0x6497('0x1f')];this[_0x6497('0x20')]=_0x2836f7[_0x6497('0x20')];this[_0x6497('0x21')]=_0x2836f7[_0x6497('0x21')];this[_0x6497('0x22')]=_0x2836f7[_0x6497('0x22')];this['UserId']=_0x2836f7[_0x6497('0x23')];this[_0x6497('0x24')]=_0x2836f7[_0x6497('0x24')];this[_0x6497('0x25')]=_0x2836f7[_0x6497('0x25')];this[_0x6497('0x26')]=_0x2836f7['originatecalleridnum']||'';this[_0x6497('0x27')]=_0x2836f7[_0x6497('0x27')]||'';this[_0x6497('0x28')]=_0x2836f7[_0x6497('0x28')];this[_0x6497('0x29')]=_0x2836f7[_0x6497('0x29')];this['statedesc']=_0x2836f7[_0x6497('0x2a')];}module[_0x6497('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0x57ef=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x284bc3,_0x22dffe){var _0x41ac81=function(_0x47031f){while(--_0x47031f){_0x284bc3['push'](_0x284bc3['shift']());}};_0x41ac81(++_0x22dffe);}(_0x57ef,0x106));var _0xf57e=function(_0x24d2ba,_0x1e74ca){_0x24d2ba=_0x24d2ba-0x0;var _0x5b9085=_0x57ef[_0x24d2ba];return _0x5b9085;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x37144a,_0x330421){this[_0xf57e('0x0')]=_0x37144a[_0xf57e('0x0')];this[_0xf57e('0x1')]=_0x37144a[_0xf57e('0x1')];this[_0xf57e('0x2')]=_0x37144a[_0xf57e('0x1')]===_0xf57e('0x3')?_0xf57e('0x4'):_0x37144a[_0xf57e('0x1')];this[_0xf57e('0x5')]=_0x37144a[_0xf57e('0x5')];this['countcongestionretry']=_0x37144a[_0xf57e('0x6')];this[_0xf57e('0x7')]=_0x37144a[_0xf57e('0x7')];this['countglobal']=_0x37144a[_0xf57e('0x5')]+_0x37144a['countcongestionretry']+_0x37144a[_0xf57e('0x7')]+_0x37144a['countnosuchnumberretry']+_0x37144a['countdropretry']+_0x37144a['countabandonedretry']+_0x37144a['countmachineretry']+_0x37144a['countagentrejectretry'];this['countnosuchnumberretry']=_0x37144a[_0xf57e('0x8')];this[_0xf57e('0x9')]=_0x37144a['countdropretry'];this[_0xf57e('0xa')]=_0x37144a['countabandonedretry'];this[_0xf57e('0xb')]=_0x37144a['countmachineretry'];this['countagentrejectretry']=_0x37144a[_0xf57e('0xc')];this[_0xf57e('0xd')]=_0x330421[_0xf57e('0xd')];this['calleridname']=_0x37144a['name'];this[_0xf57e('0xe')]=_0x37144a[_0xf57e('0xf')];this['starttime']=_0x37144a[_0xf57e('0x10')];this[_0xf57e('0x11')]=_0x37144a[_0xf57e('0x11')];this[_0xf57e('0x12')]=_0x37144a[_0xf57e('0x12')];this[_0xf57e('0x13')]=_0x37144a[_0xf57e('0x13')];this[_0xf57e('0x14')]=this[_0xf57e('0x12')];this[_0xf57e('0x15')]=utils[_0xf57e('0x16')](_0x37144a[_0xf57e('0x11')],_0x37144a['starttime']);this['holdtime']=utils[_0xf57e('0x16')](this[_0xf57e('0x12')],_0x37144a[_0xf57e('0x11')]);this[_0xf57e('0x17')]=0x0;this[_0xf57e('0x4')]=_0x330421[_0xf57e('0x4')];this[_0xf57e('0x18')]=_0x330421[_0xf57e('0x19')];this[_0xf57e('0x1a')]=_0x330421[_0xf57e('0x1a')];this[_0xf57e('0x1b')]=_0x37144a['callback'];this[_0xf57e('0x1c')]=_0x37144a['callbackuniqueid'];this[_0xf57e('0x1d')]=_0x37144a['callbackat'];this['recallme']=_0x37144a[_0xf57e('0x1e')];this[_0xf57e('0x1f')]=_0x37144a[_0xf57e('0x1f')];this[_0xf57e('0x20')]=_0x37144a['ListId'];this[_0xf57e('0x21')]=_0x37144a[_0xf57e('0x21')];this[_0xf57e('0x22')]=_0x37144a['VoiceQueueId'];this['CampaignId']=_0x37144a[_0xf57e('0x23')];this[_0xf57e('0x24')]=_0x37144a[_0xf57e('0x24')]||'';this[_0xf57e('0x25')]=_0x37144a[_0xf57e('0x25')]||'';this[_0xf57e('0x26')]=_0x37144a['agiafterat'];this[_0xf57e('0x27')]=_0x37144a[_0xf57e('0x27')];this[_0xf57e('0x28')]=_0x37144a['statedesc'];}module[_0xf57e('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 498669a..1fe9158 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x2fe60d,_0x454080){var _0x1a5fe8=function(_0xeb3369){while(--_0xeb3369){_0x2fe60d['push'](_0x2fe60d['shift']());}};_0x1a5fe8(++_0x454080);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xa9e0=['catch','temp','getContactDialer','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','inspect','dialOrderByScheduledAt'];(function(_0x5e5c4a,_0x5ad85a){var _0x35d29a=function(_0x1aa9f2){while(--_0x1aa9f2){_0x5e5c4a['push'](_0x5e5c4a['shift']());}};_0x35d29a(++_0x5ad85a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0a9e('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x333808){return util[_0x0a9e('0x4')](_0x333808,{'showHidden':![],'depth':null});}function getContactDialer(_0x2ab90b,_0x991246,_0x981158){return cmHopper['getContactDialer'](_0x2ab90b['id'],_0x991246,_0x981158,_0x2ab90b[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x2cc193){_0x2ab90b['temp']-=_0x981158;if(_0x2ab90b['temp']<0x0){_0x2ab90b[_0x0a9e('0x7')]=0x0;}logger['error']('[getContactDialer]',inspectError(_0x2cc193));});}exports[_0x0a9e('0x8')]=getContactDialer;function getContactDialerIvr(_0xf81284,_0x307b3e){return cmHopper[_0x0a9e('0x9')](_0xf81284['id'],_0x307b3e,_0xf81284[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x4a4c56){_0xf81284['temp']-=_0x307b3e;if(_0xf81284['temp']<0x0){_0xf81284['temp']=0x0;}logger[_0x0a9e('0xa')](_0x0a9e('0xb'),inspectError(_0x4a4c56));});}exports[_0x0a9e('0x9')]=getContactDialerIvr;function countReScheduled(_0x26d672){return cmHopper[_0x0a9e('0xc')](_0x26d672)[_0x0a9e('0x6')](function(_0x5db4b0){logger[_0x0a9e('0xa')](_0x0a9e('0xd'),inspectError(_0x5db4b0));});}exports[_0x0a9e('0xc')]=countReScheduled;function rescheduleContact(_0x281129){return cmHopper[_0x0a9e('0xe')](_0x281129)[_0x0a9e('0x6')](function(_0x52a03d){logger[_0x0a9e('0xa')]('[rescheduleContact]',inspectError(_0x52a03d));});}exports[_0x0a9e('0xe')]=rescheduleContact;function unlockContact(_0x519dfd,_0x16033c,_0x12066b){return cmHopper['unlockContact'](_0x519dfd,_0x16033c,_0x12066b)[_0x0a9e('0x6')](function(_0x5a0a06){logger[_0x0a9e('0xa')](_0x0a9e('0xf'),inspectError(_0x5a0a06));});}exports[_0x0a9e('0x10')]=unlockContact;function moveContactManagedDialer(_0x205fd6){return cmHopper[_0x0a9e('0x11')](_0x205fd6)[_0x0a9e('0x6')](function(_0x530eb7){logger[_0x0a9e('0xa')](_0x0a9e('0x12'),inspectError(_0x530eb7));});}exports[_0x0a9e('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x1c696a){return cmHopperBlack[_0x0a9e('0x13')](_0x1c696a)['catch'](function(_0x2c3407){logger[_0x0a9e('0xa')]('[checkIsBlackList]',inspectError(_0x2c3407));});}exports[_0x0a9e('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x5a09ef){return cmHopperBlack['checkIsBlackListIvr'](_0x5a09ef)[_0x0a9e('0x6')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x14'),inspectError(_0x432e56));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return cmHopperAdditionalPhone[_0x0a9e('0x15')](_0xfb6e48,_0x2fb0e4,_0x3b45bc)[_0x0a9e('0x6')](function(_0x42ac8f){logger[_0x0a9e('0xa')]('[verifyAdditionalPhone]',inspectError(_0x42ac8f));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x197ec0,_0x3a8e58,_0x40c424){return cmHopperAdditionalPhone[_0x0a9e('0x16')](_0x197ec0,_0x3a8e58,_0x40c424)['catch'](function(_0x384319){logger['error'](_0x0a9e('0x17'),inspectError(_0x384319));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x1dc186){return cmHopperHistory[_0x0a9e('0x18')](_0x1dc186)[_0x0a9e('0x6')](function(_0x14433c){logger[_0x0a9e('0xa')](_0x0a9e('0x19'),inspectError(_0x14433c));});}exports[_0x0a9e('0x18')]=avgHandleTime;function createHistory(_0x14de77){return cmHopperHistory['createHistory'](_0x14de77)[_0x0a9e('0x6')](function(_0x468813){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),inspectError(_0x468813));});}exports['createHistory']=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 f4ee9ce..11d90b5 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 _0xe0ba=['RECALLINQUEUE','RECALLFAILEDTIMEOUT','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','reachable','unmonitored','includes','status','TrunkBackup','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','INACTIVE','match','string','isUndefined','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','erlangb','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME'];(function(_0x227d99,_0x48c20e){var _0x759e24=function(_0x3e9e0f){while(--_0x3e9e0f){_0x227d99['push'](_0x227d99['shift']());}};_0x759e24(++_0x48c20e);}(_0xe0ba,0x90));var _0xae0b=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xe0ba[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xae0b('0x0'));var moment=require(_0xae0b('0x1'));var util=require(_0xae0b('0x2'));var logger=require('../../../../config/logger')(_0xae0b('0x3'));var timezones=require(_0xae0b('0x4'))[_0xae0b('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xae0b('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xae0b('0x7'),'DEACTIVATED':_0xae0b('0x8'),'DISACTIVED':_0xae0b('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xae0b('0xa'),'NO_AVAILABLE_CONTACTS':_0xae0b('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xae0b('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xae0b('0xd'),'QUEUE_RECALL':_0xae0b('0xe'),'RECALL_TIMEOUT':_0xae0b('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xae0b('0x10')};exports[_0xae0b('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1d76fb){return _0x1d76fb[_0xae0b('0x12')]===_0xae0b('0x13');}exports[_0xae0b('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x407fa4){return _0x407fa4[_0xae0b('0x15')]===_0xae0b('0x16');}exports[_0xae0b('0x17')]=isIVRCampaign;function isOutboundQueue(_0x3bc1f8){return _0x3bc1f8[_0xae0b('0x15')]===_0xae0b('0x18');}exports[_0xae0b('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x346f35){return _0x346f35[_0xae0b('0x1a')];}exports[_0xae0b('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3c4016){return _0x3c4016[_0xae0b('0x1c')];}exports[_0xae0b('0x1d')]=isIVRCampaignActive;function getSeconds(_0x433bee,_0x3374e3){var _0x2d7701=moment(_0x433bee)[_0xae0b('0x1e')](0x0);var _0xac5e80=moment(_0x3374e3)['milliseconds'](0x0);return _0x2d7701['diff'](_0xac5e80,_0xae0b('0x1f'));}exports[_0xae0b('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x3cf864,_0xc53945){var _0x2212ed=![];var _0x4df00e=_0x3cf864[_0xae0b('0x12')]!==_0xc53945['dialMethod']||_0x3cf864['dialActive']!==_0xc53945[_0xae0b('0x1a')]||_0x3cf864[_0xae0b('0x21')]!==_0xc53945[_0xae0b('0x21')];var _0x4f0461=_0x3cf864['available']!==_0xc53945['available']||_0x3cf864[_0xae0b('0x22')]!==_0xc53945[_0xae0b('0x22')]||_0x3cf864[_0xae0b('0x23')]!==_0xc53945['loggedInDb']||_0x3cf864[_0xae0b('0x24')]!==_0xc53945[_0xae0b('0x24')]||_0x3cf864[_0xae0b('0x25')]!==_0xc53945['talking']||_0x3cf864[_0xae0b('0x26')]!==_0xc53945[_0xae0b('0x26')]||_0x3cf864[_0xae0b('0x27')]!==_0xc53945[_0xae0b('0x27')]||_0x3cf864[_0xae0b('0x28')]!==_0xc53945['inUse']||_0x3cf864[_0xae0b('0x29')]!==_0xc53945[_0xae0b('0x29')];if(_0x3cf864[_0xae0b('0x2a')]&&_0xc53945[_0xae0b('0x2a')]){_0x2212ed=_0x3cf864[_0xae0b('0x2a')][_0xae0b('0x2b')]!==_0xc53945[_0xae0b('0x2a')][_0xae0b('0x2b')]||_0x3cf864[_0xae0b('0x2a')][_0xae0b('0x1c')]!==_0xc53945[_0xae0b('0x2a')]['active'];}return _0x4df00e||_0x4f0461||_0x2212ed;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x58efc6){var _0x1db846=null;var _0x49c486=_0x58efc6[_0xae0b('0x2c')];if(_['isNil'](_0x58efc6[_0xae0b('0x2d')])||_[_0xae0b('0x2e')](_0x58efc6[_0xae0b('0x2f')])||_[_0xae0b('0x2e')](_0x58efc6[_0xae0b('0x2f')][_0xae0b('0x30')])){_0x1db846=CAMPAIGN_STATUS[_0xae0b('0x31')];}else if(_[_0xae0b('0x32')](_0x58efc6[_0xae0b('0x2d')])||_['isEmpty'](_0x58efc6[_0xae0b('0x2f')][_0xae0b('0x30')])){_0x1db846=CAMPAIGN_STATUS[_0xae0b('0x33')];}else if(_0x49c486&&!timezones[_0x49c486]){_0x1db846=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x1db846;}function checkAnyValidTrunk(_0x2eba21,_0x348b5c){var _0x4245a6=null;var _0x4b4a64='SIP/';var _0x14dd9a=[_0xae0b('0x34'),_0xae0b('0x35')];var _0x56afd7=!![];if(_0x2eba21['Trunk']&&_0x2eba21[_0xae0b('0x2a')]['active']){_0x4b4a64+=_0x2eba21[_0xae0b('0x2a')][_0xae0b('0x2b')];_0x4245a6=_0x348b5c[_0x4b4a64];_0x56afd7=_0x14dd9a[_0xae0b('0x36')](_0x4245a6[_0xae0b('0x37')]);}else if(_0x2eba21[_0xae0b('0x38')]&&_0x2eba21[_0xae0b('0x38')]['active']){_0x4b4a64+=_0x2eba21[_0xae0b('0x38')][_0xae0b('0x2b')];_0x4245a6=_0x348b5c[_0x4b4a64];_0x56afd7=_0x14dd9a['includes'](_0x4245a6[_0xae0b('0x37')]);}return _0x56afd7;}function getQueueCampaignStatusMessage(_0x68fd43,_0x260262){var _0x3a5717=CAMPAIGN_STATUS[_0xae0b('0x6')];var _0x150187=isPreviewCampaign(_0x68fd43);if(!isQueueCampaignActive(_0x68fd43)){if(_0x150187){_0x3a5717=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x68fd43[_0xae0b('0x29')]===0x0&&_0x68fd43[_0xae0b('0x25')]===0x0&&_0x68fd43['waiting']===0x0&&(_0x68fd43[_0xae0b('0x26')]||0x0)===0x0){_0x3a5717=CAMPAIGN_STATUS['INACTIVE'];}else{_0x3a5717=CAMPAIGN_STATUS[_0xae0b('0x39')];}}}else if(_0x68fd43[_0xae0b('0x22')]===0x0){_0x3a5717=CAMPAIGN_STATUS[_0xae0b('0x3a')];}else if(!checkAnyValidTrunk(_0x68fd43,_0x260262)){_0x3a5717=CAMPAIGN_STATUS[_0xae0b('0x3b')];}else if(!isPreviewCampaign(_0x68fd43)){var _0x1e1525=checkAnyValidQueueCampaignInterval(_0x68fd43);if(_0x1e1525){_0x3a5717=_0x1e1525;}}return _0x3a5717;}exports[_0xae0b('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xdc1907){var _0x1cd519=CAMPAIGN_STATUS['DISACTIVED'];if(_0xdc1907[_0xae0b('0x29')]===0x0&&_0xdc1907[_0xae0b('0x25')]===0x0&&_0xdc1907[_0xae0b('0x27')]===0x0&&(_0xdc1907['pTalking']||0x0)===0x0){_0x1cd519=CAMPAIGN_STATUS[_0xae0b('0x3d')];}return _0x1cd519;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x552341){var _0x5a1919=_0x552341[_0xae0b('0x3e')](/"(.*?)"/);return _0x5a1919?_0x5a1919[0x1]:_0x552341;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x5f5142,_0x25bec1,_0x17a489){if(!_['isUndefined'](_0x17a489)&&typeof _0x17a489===_0xae0b('0x3f')&&!_[_0xae0b('0x32')](_0x17a489)){if(!_[_0xae0b('0x40')](_0x25bec1)&&typeof _0x25bec1===_0xae0b('0x3f')&&!_[_0xae0b('0x32')](_0x25bec1)){return util['format'](_0xae0b('0x41'),_0x25bec1,_0x17a489);}return util[_0xae0b('0x42')](_0xae0b('0x41'),_0x17a489,_0x17a489);}if(!_[_0xae0b('0x40')](_0x5f5142)&&typeof _0x5f5142===_0xae0b('0x3f')&&!_[_0xae0b('0x32')](_0x5f5142)){return _0x5f5142;}return _0xae0b('0x43');}exports[_0xae0b('0x44')]=getCallerId;function getCallerIdRandom(_0x359fc1,_0x43d05c){var _0x49956d;var _0x29c5e6;var _0x93bc9a;if(_0x43d05c<=0x0){_0x43d05c=0x1;}_0x49956d=new RegExp(_0xae0b('0x45')+_0x43d05c+'}$');_0x29c5e6=Math[_0xae0b('0x46')](0xa,_0x43d05c-0x1);_0x93bc9a=Math[_0xae0b('0x46')](0xa,_0x43d05c)-0x1;return util[_0xae0b('0x42')]('%s',_[_0xae0b('0x47')](_0x359fc1,_0x49956d,_[_0xae0b('0x48')](_0x29c5e6,_0x93bc9a)[_0xae0b('0x49')]()));}exports[_0xae0b('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x339cc7){if(_0x339cc7[_0xae0b('0x29')]&&_0x339cc7[_0xae0b('0x29')]>0x0){_0x339cc7[_0xae0b('0x29')]-=0x1;}else{logger[_0xae0b('0x4b')](_0xae0b('0x4c'));}}exports[_0xae0b('0x4d')]=decrementOriginate;function checkContactEmpty(_0x1669f6){return _0x1669f6&&_0x1669f6['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x296949,_0x29f32a){if(_0x29f32a===0x0){return 0x0;}var _0x184f1c=0x1;for(var _0x4f9344=0x1;_0x4f9344<=_0x29f32a;_0x4f9344+=0x1){_0x184f1c=0x1+_0x184f1c*_0x4f9344/_0x296949;}return 0x1/_0x184f1c;}exports[_0xae0b('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x28227f,_0x3b20cf,_0x45824a){if(_0x3b20cf>_0x45824a){for(var _0x5d53ec=0x0;_0x5d53ec<_0x3b20cf-_0x45824a;_0x5d53ec+=0x1){decrementOriginate(_0x28227f);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x6d74=['checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','isPreviewCampaign','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','isEmpty','UNKNOWN_TIMEZONE','SIP/','status','TrunkBackup','includes','ACTIVE','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb'];(function(_0x43f04c,_0x55a068){var _0x51e7c6=function(_0x37c46e){while(--_0x37c46e){_0x43f04c['push'](_0x43f04c['shift']());}};_0x51e7c6(++_0x55a068);}(_0x6d74,0x97));var _0x46d7=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x6d74[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x46d7('0x0'));var moment=require(_0x46d7('0x1'));var util=require(_0x46d7('0x2'));var logger=require(_0x46d7('0x3'))(_0x46d7('0x4'));var timezones=require(_0x46d7('0x5'))[_0x46d7('0x6')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x46d7('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x46d7('0x8'),'EMPTY_INTERVAL':_0x46d7('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x46d7('0xa'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x46d7('0xb'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x46d7('0xc'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x46d7('0xd'),'UNKNOWN_TIMEZONE':_0x46d7('0xe'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x46d7('0xf')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x9eae31){return _0x9eae31['dialMethod']==='preview';}exports[_0x46d7('0x10')]=isPreviewCampaign;function isIVRCampaign(_0xf7b117){return _0xf7b117['type']==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x10281d){return _0x10281d[_0x46d7('0x11')]===_0x46d7('0x12');}exports[_0x46d7('0x13')]=isOutboundQueue;function isQueueCampaignActive(_0x455e45){return _0x455e45[_0x46d7('0x14')];}exports[_0x46d7('0x15')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4ce96a){return _0x4ce96a[_0x46d7('0x16')];}exports[_0x46d7('0x17')]=isIVRCampaignActive;function getSeconds(_0x382da6,_0x3399e4){var _0x133882=moment(_0x382da6)[_0x46d7('0x18')](0x0);var _0x2b7fe8=moment(_0x3399e4)[_0x46d7('0x18')](0x0);return _0x133882[_0x46d7('0x19')](_0x2b7fe8,_0x46d7('0x1a'));}exports[_0x46d7('0x1b')]=getSeconds;function hasQueueCampaignDataChanged(_0x1f9533,_0x20e2f6){var _0x5d9ab6=![];var _0x1b3106=_0x1f9533[_0x46d7('0x1c')]!==_0x20e2f6[_0x46d7('0x1c')]||_0x1f9533[_0x46d7('0x14')]!==_0x20e2f6[_0x46d7('0x14')]||_0x1f9533[_0x46d7('0x1d')]!==_0x20e2f6['message'];var _0x16f400=_0x1f9533['available']!==_0x20e2f6[_0x46d7('0x1e')]||_0x1f9533[_0x46d7('0x1f')]!==_0x20e2f6[_0x46d7('0x1f')]||_0x1f9533[_0x46d7('0x20')]!==_0x20e2f6[_0x46d7('0x20')]||_0x1f9533[_0x46d7('0x21')]!==_0x20e2f6[_0x46d7('0x21')]||_0x1f9533[_0x46d7('0x22')]!==_0x20e2f6[_0x46d7('0x22')]||_0x1f9533[_0x46d7('0x23')]!==_0x20e2f6[_0x46d7('0x23')]||_0x1f9533[_0x46d7('0x24')]!==_0x20e2f6['waiting']||_0x1f9533[_0x46d7('0x25')]!==_0x20e2f6['inUse']||_0x1f9533[_0x46d7('0x26')]!==_0x20e2f6['originated'];if(_0x1f9533[_0x46d7('0x27')]&&_0x20e2f6[_0x46d7('0x27')]){_0x5d9ab6=_0x1f9533[_0x46d7('0x27')][_0x46d7('0x28')]!==_0x20e2f6[_0x46d7('0x27')][_0x46d7('0x28')]||_0x1f9533[_0x46d7('0x27')]['active']!==_0x20e2f6[_0x46d7('0x27')][_0x46d7('0x16')];}return _0x1b3106||_0x16f400||_0x5d9ab6;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x305387){var _0x3e350b=null;var _0x4c6fb0=_0x305387[_0x46d7('0x29')];if(_['isNil'](_0x305387[_0x46d7('0x2a')])||_[_0x46d7('0x2b')](_0x305387[_0x46d7('0x2c')])||_[_0x46d7('0x2b')](_0x305387[_0x46d7('0x2c')][_0x46d7('0x2d')])){_0x3e350b=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x46d7('0x2e')](_0x305387[_0x46d7('0x2a')])||_[_0x46d7('0x2e')](_0x305387[_0x46d7('0x2c')][_0x46d7('0x2d')])){_0x3e350b=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x4c6fb0&&!timezones[_0x4c6fb0]){_0x3e350b=CAMPAIGN_STATUS[_0x46d7('0x2f')];}return _0x3e350b;}function checkAnyValidTrunk(_0x58afd5,_0x255a78){var _0x1324e8=null;var _0x5710ae=_0x46d7('0x30');var _0x39a48f=['reachable','unmonitored'];var _0xeba25a=!![];if(_0x58afd5[_0x46d7('0x27')]&&_0x58afd5[_0x46d7('0x27')]['active']){_0x5710ae+=_0x58afd5[_0x46d7('0x27')][_0x46d7('0x28')];_0x1324e8=_0x255a78[_0x5710ae];_0xeba25a=_0x39a48f['includes'](_0x1324e8[_0x46d7('0x31')]);}else if(_0x58afd5[_0x46d7('0x32')]&&_0x58afd5[_0x46d7('0x32')][_0x46d7('0x16')]){_0x5710ae+=_0x58afd5[_0x46d7('0x32')]['name'];_0x1324e8=_0x255a78[_0x5710ae];_0xeba25a=_0x39a48f[_0x46d7('0x33')](_0x1324e8[_0x46d7('0x31')]);}return _0xeba25a;}function getQueueCampaignStatusMessage(_0x504a19,_0x30d1d7){var _0x175bd6=CAMPAIGN_STATUS[_0x46d7('0x34')];var _0x226321=isPreviewCampaign(_0x504a19);if(!isQueueCampaignActive(_0x504a19)){if(_0x226321){_0x175bd6=CAMPAIGN_STATUS[_0x46d7('0x35')];}else{if(_0x504a19[_0x46d7('0x26')]===0x0&&_0x504a19[_0x46d7('0x22')]===0x0&&_0x504a19[_0x46d7('0x24')]===0x0&&(_0x504a19['pTalking']||0x0)===0x0){_0x175bd6=CAMPAIGN_STATUS[_0x46d7('0x35')];}else{_0x175bd6=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x504a19[_0x46d7('0x1f')]===0x0){_0x175bd6=CAMPAIGN_STATUS[_0x46d7('0x36')];}else if(!checkAnyValidTrunk(_0x504a19,_0x30d1d7)){_0x175bd6=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x504a19)){var _0x8b6b2e=checkAnyValidQueueCampaignInterval(_0x504a19);if(_0x8b6b2e){_0x175bd6=_0x8b6b2e;}}return _0x175bd6;}exports[_0x46d7('0x37')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4c4cc9){var _0x129d12=CAMPAIGN_STATUS[_0x46d7('0x38')];if(_0x4c4cc9['originated']===0x0&&_0x4c4cc9['talking']===0x0&&_0x4c4cc9[_0x46d7('0x24')]===0x0&&(_0x4c4cc9['pTalking']||0x0)===0x0){_0x129d12=CAMPAIGN_STATUS['INACTIVE'];}return _0x129d12;}exports[_0x46d7('0x39')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x167b0e){var _0x20f2b6=_0x167b0e[_0x46d7('0x3a')](/"(.*?)"/);return _0x20f2b6?_0x20f2b6[0x1]:_0x167b0e;}exports[_0x46d7('0x3b')]=extractCalleridName;function getCallerId(_0xfdd13a,_0x585558,_0xcfddf2){if(!_['isUndefined'](_0xcfddf2)&&typeof _0xcfddf2===_0x46d7('0x3c')&&!_['isEmpty'](_0xcfddf2)){if(!_[_0x46d7('0x3d')](_0x585558)&&typeof _0x585558==='string'&&!_[_0x46d7('0x2e')](_0x585558)){return util['format']('\x22%s\x22\x20<%s>',_0x585558,_0xcfddf2);}return util[_0x46d7('0x3e')](_0x46d7('0x3f'),_0xcfddf2,_0xcfddf2);}if(!_['isUndefined'](_0xfdd13a)&&typeof _0xfdd13a===_0x46d7('0x3c')&&!_[_0x46d7('0x2e')](_0xfdd13a)){return _0xfdd13a;}return'\x22\x22\x20<>';}exports[_0x46d7('0x40')]=getCallerId;function getCallerIdRandom(_0x5ef37e,_0x2f1ae1){var _0x1ffce9;var _0x205859;var _0xb9ba49;if(_0x2f1ae1<=0x0){_0x2f1ae1=0x1;}_0x1ffce9=new RegExp(_0x46d7('0x41')+_0x2f1ae1+'}$');_0x205859=Math[_0x46d7('0x42')](0xa,_0x2f1ae1-0x1);_0xb9ba49=Math[_0x46d7('0x42')](0xa,_0x2f1ae1)-0x1;return util[_0x46d7('0x3e')]('%s',_[_0x46d7('0x43')](_0x5ef37e,_0x1ffce9,_['random'](_0x205859,_0xb9ba49)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x5ed4e2){if(_0x5ed4e2[_0x46d7('0x26')]&&_0x5ed4e2[_0x46d7('0x26')]>0x0){_0x5ed4e2[_0x46d7('0x26')]-=0x1;}else{logger[_0x46d7('0x44')](_0x46d7('0x45'));}}exports[_0x46d7('0x46')]=decrementOriginate;function checkContactEmpty(_0x36bf55){return _0x36bf55&&_0x36bf55[_0x46d7('0x47')]>0x0;}exports[_0x46d7('0x48')]=checkContactEmpty;function erlangb(_0x1ab604,_0x5ce3b6){if(_0x5ce3b6===0x0){return 0x0;}var _0x2f5d7d=0x1;for(var _0x27bdd9=0x1;_0x27bdd9<=_0x5ce3b6;_0x27bdd9+=0x1){_0x2f5d7d=0x1+_0x2f5d7d*_0x27bdd9/_0x1ab604;}return 0x1/_0x2f5d7d;}exports[_0x46d7('0x49')]=erlangb;function checkContactLowerLimitOriginate(_0x5bd0c1,_0x4c1717,_0x3ef61e){if(_0x4c1717>_0x3ef61e){for(var _0x31c4c8=0x0;_0x31c4c8<_0x4c1717-_0x3ef61e;_0x31c4c8+=0x1){decrementOriginate(_0x5bd0c1);}}}exports[_0x46d7('0x4a')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index bfd9721..5b2b28c 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(_0x2d3127,_0x5c8089){var _0x470537=function(_0x347d16){while(--_0x347d16){_0x2d3127['push'](_0x2d3127['shift']());}};_0x470537(++_0x5c8089);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x31a463,_0x49ce74){var _0x5a21f7=function(_0x4806e1){while(--_0x4806e1){_0x31a463['push'](_0x31a463['shift']());}};_0x5a21f7(++_0x49ce74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 88c290c..e071360 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 _0xa795=['name','\x20syncNewchannel\x20','info','prototype','value','channelstate','channelstatedesc','variable','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','FaxAccountId','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','fax','./rpcDb','./channel','./util/util','./action','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','channel'];(function(_0xd62189,_0x4825a6){var _0x4fa395=function(_0x4c81a8){while(--_0x4c81a8){_0xd62189['push'](_0xd62189['shift']());}};_0x4fa395(++_0x4825a6);}(_0xa795,0xbd));var _0x5a79=function(_0xf6e364,_0x5e0b61){_0xf6e364=_0xf6e364-0x0;var _0x441fee=_0xa795[_0xf6e364];return _0x441fee;};'use strict';var util=require(_0x5a79('0x0'));var _=require(_0x5a79('0x1'));var BPromise=require(_0x5a79('0x2'));var uuid=require(_0x5a79('0x3'));var moment=require(_0x5a79('0x4'));var path=require(_0x5a79('0x5'));var tiff2pdf=require(_0x5a79('0x6'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x5a79('0x7'));var ami=require('../ami');var rpcDb=require(_0x5a79('0x8'));var Channel=require(_0x5a79('0x9'));var ut=require(_0x5a79('0xa'));var Action=require(_0x5a79('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x5a79('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x128974){this['channels']={};this[_0x5a79('0xd')]=_0x128974[_0x5a79('0xd')];this[_0x5a79('0xe')]=_0x128974[_0x5a79('0xe')];this[_0x5a79('0xf')]={};ami['on'](_0x5a79('0x10'),this[_0x5a79('0x11')]['bind'](this));ami['on'](_0x5a79('0x12'),this[_0x5a79('0x13')][_0x5a79('0x14')](this));ami['on'](_0x5a79('0x15'),this[_0x5a79('0x16')][_0x5a79('0x14')](this));ami['on'](_0x5a79('0x17'),this[_0x5a79('0x18')]['bind'](this));ami['on'](_0x5a79('0x19'),this[_0x5a79('0x1a')]['bind'](this));ami['on'](_0x5a79('0x1b'),this[_0x5a79('0x1c')][_0x5a79('0x14')](this));ami['on'](_0x5a79('0x1d'),this['syncHangup'][_0x5a79('0x14')](this));ami['on'](_0x5a79('0x1e'),this['syncOriginateResponse'][_0x5a79('0x14')](this));}Fax['prototype'][_0x5a79('0x11')]=function(_0x2f78bc){if(_0x2f78bc['context']===_0x5a79('0x1f')){for(var _0x4079dd in this['faxAccounts']){if(this[_0x5a79('0xd')][_0x5a79('0x20')](_0x4079dd)){if(_0x2f78bc[_0x5a79('0x21')]===this[_0x5a79('0xd')][_0x4079dd]['localstationid']){this[_0x5a79('0x22')][_0x2f78bc['uniqueid']]={};this[_0x5a79('0x22')][_0x2f78bc[_0x5a79('0x23')]][_0x5a79('0x24')]=_0x2f78bc[_0x5a79('0x24')];this[_0x5a79('0x22')][_0x2f78bc['uniqueid']]['id']=this[_0x5a79('0xd')][_0x4079dd]['id'];this['channels'][_0x2f78bc['uniqueid']]['name']=this['faxAccounts'][_0x4079dd][_0x5a79('0x25')];logger['info'](_0x2f78bc['uniqueid'],_0x5a79('0x26'));}}}}if(this[_0x5a79('0xf')][_0x2f78bc[_0x5a79('0x23')]]){this['channels'][_0x2f78bc[_0x5a79('0x23')]]={};this[_0x5a79('0x22')][_0x2f78bc[_0x5a79('0x23')]][_0x5a79('0x24')]=_0x2f78bc['channel'];logger[_0x5a79('0x27')](_0x2f78bc['uniqueid'],_0x5a79('0x26'));}};Fax[_0x5a79('0x28')][_0x5a79('0x13')]=function(_0x3e152b){if(this[_0x5a79('0x22')][_0x3e152b[_0x5a79('0x23')]]){for(var _0x569896 in _0x3e152b['variable']){if(_0x3e152b['variable']['hasOwnProperty'](_0x569896)){this[_0x5a79('0x22')][_0x3e152b[_0x5a79('0x23')]][_0x569896]=_0x3e152b[_0x5a79('0x29')];}}}};Fax['prototype'][_0x5a79('0x16')]=function(_0x1143ed){if(this['channels'][_0x1143ed['uniqueid']]){this['channels'][_0x1143ed[_0x5a79('0x23')]]['channelstate']=_0x1143ed[_0x5a79('0x2a')];this['channels'][_0x1143ed[_0x5a79('0x23')]][_0x5a79('0x2b')]=_0x1143ed[_0x5a79('0x2b')];}};Fax[_0x5a79('0x28')][_0x5a79('0x18')]=function(_0x47204f){if(this['channels'][_0x47204f[_0x5a79('0x23')]]){for(var _0x4babe4 in _0x47204f[_0x5a79('0x2c')]){if(_0x47204f[_0x5a79('0x2c')][_0x5a79('0x20')](_0x4babe4)){this[_0x5a79('0x22')][_0x47204f['uniqueid']][_0x4babe4]=_0x47204f[_0x5a79('0x29')];}}}};Fax[_0x5a79('0x28')]['syncFaxStatus']=function(_0x3b67b7){if(this[_0x5a79('0x22')][_0x3b67b7[_0x5a79('0x23')]]){this['channels'][_0x3b67b7[_0x5a79('0x23')]]['operation']=_0x3b67b7['operation'];this[_0x5a79('0x22')][_0x3b67b7[_0x5a79('0x23')]][_0x5a79('0x2d')]=_0x3b67b7[_0x5a79('0x2d')];this['channels'][_0x3b67b7['uniqueid']][_0x5a79('0x2e')]=_0x3b67b7[_0x5a79('0x2e')];this['channels'][_0x3b67b7[_0x5a79('0x23')]]['filename']=_0x3b67b7[_0x5a79('0x2f')];logger[_0x5a79('0x27')](_0x3b67b7[_0x5a79('0x23')],_0x5a79('0x30'));}};Fax[_0x5a79('0x28')]['syncReceiveFax']=function(_0x3d390a){var _0x3d0607=this;if(this[_0x5a79('0x22')][_0x3d390a['uniqueid']]){var _0x5ee743=this[_0x5a79('0x22')][_0x3d390a[_0x5a79('0x23')]]['id'];this[_0x5a79('0x22')][_0x3d390a[_0x5a79('0x23')]][_0x5a79('0x31')]=_0x3d390a[_0x5a79('0x31')];this[_0x5a79('0x22')][_0x3d390a[_0x5a79('0x23')]]['pagestransferred']=_0x3d390a[_0x5a79('0x32')];this[_0x5a79('0x22')][_0x3d390a[_0x5a79('0x23')]]['localstationid']=_0x3d390a['localstationid'];this['channels'][_0x3d390a[_0x5a79('0x23')]]['resolution']=_0x3d390a['resolution'];this['channels'][_0x3d390a[_0x5a79('0x23')]][_0x5a79('0x33')]=_0x3d390a[_0x5a79('0x33')];this['channels'][_0x3d390a[_0x5a79('0x23')]]['filename']=_0x3d390a['filename'];this[_0x5a79('0x22')][_0x3d390a[_0x5a79('0x23')]][_0x5a79('0x34')]=_0x3d390a[_0x5a79('0x34')];if(this[_0x5a79('0x22')][_0x3d390a[_0x5a79('0x23')]][_0x5a79('0x32')]>0x0){tiff2pdf(_0x3d390a[_0x5a79('0x2f')],_0x5a79('0x35'),function(_0x528aa9){logger[_0x5a79('0x27')](_0x3d390a[_0x5a79('0x23')],'\x20result\x20conversion\x20file\x20',_0x528aa9['message']);attachment[_0x5a79('0x36')]({'name':path[_0x5a79('0x37')](_0x3d390a[_0x5a79('0x2f')])[_0x5a79('0x25')],'basename':path[_0x5a79('0x37')](_0x3d390a['filename'])['name']+_0x5a79('0x38'),'type':_0x5a79('0x39')})[_0x5a79('0x3a')](function(_0x5129df){faxAccount[_0x5a79('0x3b')](_0x5ee743,{'from':_0x3d390a['calleridnum'],'mapKey':_0x5a79('0x7'),'body':path['parse'](_0x3d390a[_0x5a79('0x2f')])['name']+_0x5a79('0x38'),'AttachmentId':_0x5129df['id']})[_0x5a79('0x3c')](function(_0x5215a5){logger[_0x5a79('0x3d')](_0x3d390a[_0x5a79('0x23')],_0x5a79('0x3e'),JSON[_0x5a79('0x3f')](_0x5215a5));});})[_0x5a79('0x3c')](function(_0x2ba39d){logger[_0x5a79('0x3d')](_0x3d390a[_0x5a79('0x23')],_0x5a79('0x40'),JSON[_0x5a79('0x3f')](_0x2ba39d));});});}logger[_0x5a79('0x27')](_0x3d390a['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype'][_0x5a79('0x41')]=function(_0x100e02){if(this[_0x5a79('0xf')][_0x100e02[_0x5a79('0x23')]]){_[_0x5a79('0x42')](this[_0x5a79('0x22')][_0x100e02['uniqueid']],_[_0x5a79('0x43')](_0x100e02,['response',_0x5a79('0x44')]));}};function updateStatus(_0x50e73d){if(_0x50e73d[_0x5a79('0x45')]){faxMessage['update'](_0x50e73d['AttachmentId'],{'failMessage':_0x5a79('0x46')})[_0x5a79('0x3a')](function(_0x298b3a){ut[_0x5a79('0x47')](_0x5a79('0x48'),_0x298b3a);})['catch'](function(_0x517955){ut[_0x5a79('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x517955);});}else{ut[_0x5a79('0x47')](_0x5a79('0x49'));}}Fax[_0x5a79('0x28')][_0x5a79('0x4a')]=function(_0x10cd29,_0x315c2b,_0x2e9311){var _0x4cb366=this;var _0xbf4df9={};if(_0x315c2b){_0xbf4df9={'read':_0x315c2b};}else{_0xbf4df9={'failMessage':_0x2e9311};}if(this['actions'][_0x10cd29]['AttachmentId']){faxMessage[_0x5a79('0x4b')](this['actions'][_0x10cd29][_0x5a79('0x45')],_0xbf4df9)[_0x5a79('0x3a')](function(_0x586f9a){ut[_0x5a79('0x47')]('[Fax][Message][Updated]',_0x586f9a);})[_0x5a79('0x3c')](function(_0xe28272){ut[_0x5a79('0x47')](_0x5a79('0x4c'),_0xe28272);})[_0x5a79('0x4d')](function(){delete _0x4cb366[_0x5a79('0x22')][_0x10cd29];delete _0x4cb366[_0x5a79('0xf')][_0x10cd29];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x5a79('0x22')][_0x10cd29];delete this[_0x5a79('0xf')][_0x10cd29];}};Fax[_0x5a79('0x28')]['syncHangup']=function(_0x4320d4){var _0x16708e=this;if(this[_0x5a79('0x22')][_0x4320d4[_0x5a79('0x23')]]){if(this['actions'][_0x4320d4[_0x5a79('0x23')]]){this[_0x5a79('0x22')][_0x4320d4['uniqueid']]['id']=this['actions'][_0x4320d4[_0x5a79('0x23')]]['id'];this[_0x5a79('0x22')][_0x4320d4[_0x5a79('0x23')]][_0x5a79('0x25')]=this[_0x5a79('0xf')][_0x4320d4['uniqueid']]['name'];}logger[_0x5a79('0x27')](_0x4320d4['uniqueid'],this[_0x5a79('0xf')][_0x4320d4[_0x5a79('0x23')]]?_0x5a79('0x4e'):_0x5a79('0x4f'),JSON['stringify'](this[_0x5a79('0x22')][_0x4320d4[_0x5a79('0x23')]]));if(this[_0x5a79('0xf')][_0x4320d4[_0x5a79('0x23')]]){if(this['channels'][_0x4320d4[_0x5a79('0x23')]][_0x5a79('0x50')]>0x0&&this[_0x5a79('0x22')][_0x4320d4[_0x5a79('0x23')]][_0x5a79('0x19')]==='SUCCESS'){this[_0x5a79('0x4a')](_0x4320d4[_0x5a79('0x23')],!![]);}else{this['updateStatus'](_0x4320d4[_0x5a79('0x23')],![],this['channels'][_0x4320d4['uniqueid']][_0x5a79('0x51')]?_0x5a79('0x52')+this[_0x5a79('0x22')][_0x4320d4['uniqueid']][_0x5a79('0x51')]:_0x5a79('0x53'));}}}};Fax[_0x5a79('0x28')]['send']=function(_0x117983){var _0x34502a=this;return new BPromise(function(_0x4c0122,_0x3b4cbf){_0x34502a[_0x5a79('0x54')](_0x117983,_0x34502a[_0x5a79('0xd')][_0x117983['FaxAccountId']])['then'](function(_0x3f9cd3){ut[_0x5a79('0x47')](_0x5a79('0x55'),_0x3f9cd3);_0x4c0122(ut[_0x5a79('0x56')](_0x5a79('0x57')));})[_0x5a79('0x3c')](function(_0x903c48){ut[_0x5a79('0x47')]('[Fax][execOriginate][failure]',_0x903c48);updateStatus(_0x117983);_0x3b4cbf(ut[_0x5a79('0x56')](_0x5a79('0x58')));});});};Fax[_0x5a79('0x28')]['checkAfterSend']=function(_0x39a9a8){var _0x4ea878=this;return new BPromise(function(_0xe34dd4,_0xe12746){var _0xa11f9d=_0x4ea878['checkTrunk'](_0x4ea878[_0x5a79('0xd')][_0x39a9a8[_0x5a79('0x59')]][_0x5a79('0x5a')],_0x39a9a8);if(_0xa11f9d['isValid']){_0xe34dd4(ut[_0x5a79('0x56')](_0x5a79('0x5b')));}else{_0xe12746(ut[_0x5a79('0x56')](_0xa11f9d['message']));}});};function originate(_0x3a4a37,_0x73c81c,_0x182615){return new BPromise(function(_0x50a7b7,_0x31b68b){if(_0x182615){var _0xefdd3d=util[_0x5a79('0x5c')](_0x5a79('0x5d'),path[_0x5a79('0x37')](_0x3a4a37['path'])[_0x5a79('0x25')],_0x3a4a37[_0x5a79('0x5')]);gs['execute'](_0xefdd3d)[_0x5a79('0x3a')](function(){_0x3a4a37['path']=util[_0x5a79('0x5c')](_0x5a79('0x5e'),path[_0x5a79('0x37')](_0x3a4a37[_0x5a79('0x5')])[_0x5a79('0x5f')],path[_0x5a79('0x37')](_0x3a4a37['path'])[_0x5a79('0x25')]);_0x73c81c[_0x5a79('0x60')]=_0x3a4a37['path'];ut[_0x5a79('0x47')](_0x5a79('0x61'),'');ami[_0x5a79('0x62')](ut[_0x5a79('0x63')](_0x3a4a37,_0x73c81c))[_0x5a79('0x3a')](function(_0x2f75d3){_0x50a7b7(_0x2f75d3);})[_0x5a79('0x3c')](function(_0x48ca59){_0x31b68b(_0x48ca59);});})[_0x5a79('0x3c')](function(_0xfa0d2b){_0x31b68b(_0xfa0d2b);});}else{ami[_0x5a79('0x62')](ut['variablesAction'](_0x3a4a37,_0x73c81c))['then'](function(_0x1dbeb3){_0x50a7b7(_0x1dbeb3);})[_0x5a79('0x3c')](function(_0x1bed74){_0x31b68b(_0x1bed74);});}});}Fax['prototype'][_0x5a79('0x54')]=function(_0x10d1c8,_0x5a491c){var _0x4469c2=this;return new BPromise(function(_0x2e1b0c,_0x28e7c9){var _0x439e1e=uuid['v4']();var _0x23e495=ut[_0x5a79('0x64')](_0x10d1c8,_0x5a491c);_0x4469c2[_0x5a79('0xf')][_0x439e1e]=new Action(_0x439e1e,_0x5a491c,_0x10d1c8);var _0x5c4c1f=_0x4469c2[_0x5a79('0xf')][_0x439e1e];if(path[_0x5a79('0x37')](_0x10d1c8[_0x5a79('0x5')])[_0x5a79('0x65')]==='.pdf'){originate(_0x5c4c1f,_0x23e495,!![])[_0x5a79('0x3a')](function(_0x23d22e){_0x2e1b0c(_0x23d22e);})[_0x5a79('0x3c')](function(_0x1f8d4b){_0x28e7c9(_0x1f8d4b);});}else{originate(_0x5c4c1f,_0x23e495,![])[_0x5a79('0x3a')](function(_0x441b98){_0x2e1b0c(_0x441b98);})['catch'](function(_0x18a6a0){_0x28e7c9(_0x18a6a0);});}});};Fax[_0x5a79('0x28')][_0x5a79('0x66')]=function(_0x379a5a){return!_['isNil'](_0x379a5a)&&!_[_0x5a79('0x67')](_0x379a5a[_0x5a79('0x25')])&&!_[_0x5a79('0x67')](_0x379a5a[_0x5a79('0x68')])&&_0x379a5a['active']&&!_['isNil'](this[_0x5a79('0xe')][util[_0x5a79('0x5c')](_0x5a79('0x69'),_0x379a5a[_0x5a79('0x25')])])&&!_['isNil'](this[_0x5a79('0xe')][util[_0x5a79('0x5c')]('SIP/%s',_0x379a5a[_0x5a79('0x25')])][_0x5a79('0x2d')])&&(this[_0x5a79('0xe')][util['format']('SIP/%s',_0x379a5a[_0x5a79('0x25')])][_0x5a79('0x2d')]===_0x5a79('0x6a')||this['trunks'][util['format'](_0x5a79('0x69'),_0x379a5a['name'])][_0x5a79('0x2d')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x27a703,_0x1a798b){if(!this['isTrunkReachable'](_0x27a703)){ut[_0x5a79('0x47')](_0x5a79('0x6b'),_[_0x5a79('0x67')](_0x27a703)?'':_0x27a703[_0x5a79('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x5a79('0x67')](_0x1a798b['fax'])){ut[_0x5a79('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x5a79('0x3f')](_0x1a798b));return{'isValid':![],'message':_0x5a79('0x6c')};}if(_['isNil'](_0x1a798b[_0x5a79('0x5')])){ut[_0x5a79('0x47')](_0x5a79('0x6d'),JSON[_0x5a79('0x3f')](_0x1a798b));return{'isValid':![],'message':_0x5a79('0x6e')};}return{'isValid':!![],'message':_0x5a79('0x6f')};};module[_0x5a79('0x70')]=Fax; \ No newline at end of file +var _0xffc2=['../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','bind','varset','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncNewchannel','hasOwnProperty','localstationid','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','prototype','syncVarSet','variable','value','syncNewState','channelstate','channelstatedesc','syncNewExten','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','notify','fax','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','checkTrunk','Trunk\x20Reachable','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isNil','active','SIP/%s','status','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xffc2,0xde));var _0x2ffc=function(_0x1476fb,_0x467d01){_0x1476fb=_0x1476fb-0x0;var _0x44f57e=_0xffc2[_0x1476fb];return _0x44f57e;};'use strict';var util=require('util');var _=require(_0x2ffc('0x0'));var BPromise=require(_0x2ffc('0x1'));var uuid=require(_0x2ffc('0x2'));var moment=require(_0x2ffc('0x3'));var path=require(_0x2ffc('0x4'));var tiff2pdf=require(_0x2ffc('0x5'));var gs=require(_0x2ffc('0x6'));var logger=require(_0x2ffc('0x7'))('fax');var ami=require(_0x2ffc('0x8'));var rpcDb=require(_0x2ffc('0x9'));var Channel=require(_0x2ffc('0xa'));var ut=require(_0x2ffc('0xb'));var Action=require('./action');var faxAccount=require(_0x2ffc('0xc'));var attachment=require(_0x2ffc('0xd'));var faxMessage=require(_0x2ffc('0xe'));function Fax(_0x4e266c){this['channels']={};this['faxAccounts']=_0x4e266c[_0x2ffc('0xf')];this['trunks']=_0x4e266c[_0x2ffc('0x10')];this[_0x2ffc('0x11')]={};ami['on'](_0x2ffc('0x12'),this['syncNewchannel'][_0x2ffc('0x13')](this));ami['on'](_0x2ffc('0x14'),this['syncVarSet']['bind'](this));ami['on']('newstate',this['syncNewState'][_0x2ffc('0x13')](this));ami['on']('newexten',this['syncNewExten'][_0x2ffc('0x13')](this));ami['on']('faxstatus',this[_0x2ffc('0x15')][_0x2ffc('0x13')](this));ami['on']('receivefax',this[_0x2ffc('0x16')][_0x2ffc('0x13')](this));ami['on'](_0x2ffc('0x17'),this[_0x2ffc('0x18')][_0x2ffc('0x13')](this));ami['on'](_0x2ffc('0x19'),this['syncOriginateResponse'][_0x2ffc('0x13')](this));}Fax['prototype'][_0x2ffc('0x1a')]=function(_0x331a59){if(_0x331a59['context']==='from-voip-provider'){for(var _0x3e3460 in this[_0x2ffc('0xf')]){if(this['faxAccounts'][_0x2ffc('0x1b')](_0x3e3460)){if(_0x331a59['exten']===this[_0x2ffc('0xf')][_0x3e3460][_0x2ffc('0x1c')]){this['channels'][_0x331a59[_0x2ffc('0x1d')]]={};this[_0x2ffc('0x1e')][_0x331a59[_0x2ffc('0x1d')]][_0x2ffc('0x1f')]=_0x331a59['channel'];this['channels'][_0x331a59['uniqueid']]['id']=this[_0x2ffc('0xf')][_0x3e3460]['id'];this[_0x2ffc('0x1e')][_0x331a59[_0x2ffc('0x1d')]][_0x2ffc('0x20')]=this[_0x2ffc('0xf')][_0x3e3460][_0x2ffc('0x20')];logger[_0x2ffc('0x21')](_0x331a59[_0x2ffc('0x1d')],_0x2ffc('0x22'));}}}}if(this[_0x2ffc('0x11')][_0x331a59['uniqueid']]){this[_0x2ffc('0x1e')][_0x331a59[_0x2ffc('0x1d')]]={};this[_0x2ffc('0x1e')][_0x331a59[_0x2ffc('0x1d')]]['channel']=_0x331a59[_0x2ffc('0x1f')];logger[_0x2ffc('0x21')](_0x331a59[_0x2ffc('0x1d')],'\x20syncNewchannel\x20');}};Fax[_0x2ffc('0x23')][_0x2ffc('0x24')]=function(_0x1fc90e){if(this[_0x2ffc('0x1e')][_0x1fc90e['uniqueid']]){for(var _0x13413e in _0x1fc90e[_0x2ffc('0x25')]){if(_0x1fc90e[_0x2ffc('0x25')]['hasOwnProperty'](_0x13413e)){this[_0x2ffc('0x1e')][_0x1fc90e[_0x2ffc('0x1d')]][_0x13413e]=_0x1fc90e[_0x2ffc('0x26')];}}}};Fax[_0x2ffc('0x23')][_0x2ffc('0x27')]=function(_0x484f37){if(this[_0x2ffc('0x1e')][_0x484f37['uniqueid']]){this[_0x2ffc('0x1e')][_0x484f37[_0x2ffc('0x1d')]][_0x2ffc('0x28')]=_0x484f37[_0x2ffc('0x28')];this[_0x2ffc('0x1e')][_0x484f37['uniqueid']]['channelstatedesc']=_0x484f37[_0x2ffc('0x29')];}};Fax[_0x2ffc('0x23')][_0x2ffc('0x2a')]=function(_0xce878e){if(this['channels'][_0xce878e[_0x2ffc('0x1d')]]){for(var _0x5dd38f in _0xce878e[_0x2ffc('0x25')]){if(_0xce878e[_0x2ffc('0x25')]['hasOwnProperty'](_0x5dd38f)){this[_0x2ffc('0x1e')][_0xce878e[_0x2ffc('0x1d')]][_0x5dd38f]=_0xce878e['value'];}}}};Fax[_0x2ffc('0x23')]['syncFaxStatus']=function(_0xe0c714){if(this[_0x2ffc('0x1e')][_0xe0c714['uniqueid']]){this['channels'][_0xe0c714[_0x2ffc('0x1d')]][_0x2ffc('0x2b')]=_0xe0c714[_0x2ffc('0x2b')];this[_0x2ffc('0x1e')][_0xe0c714[_0x2ffc('0x1d')]]['status']=_0xe0c714['status'];this[_0x2ffc('0x1e')][_0xe0c714[_0x2ffc('0x1d')]]['localstationid']=_0xe0c714[_0x2ffc('0x1c')];this[_0x2ffc('0x1e')][_0xe0c714['uniqueid']][_0x2ffc('0x2c')]=_0xe0c714[_0x2ffc('0x2c')];logger[_0x2ffc('0x21')](_0xe0c714[_0x2ffc('0x1d')],_0x2ffc('0x2d'));}};Fax[_0x2ffc('0x23')][_0x2ffc('0x16')]=function(_0x51e7c2){var _0x11e0e0=this;if(this[_0x2ffc('0x1e')][_0x51e7c2['uniqueid']]){var _0x368c95=this['channels'][_0x51e7c2[_0x2ffc('0x1d')]]['id'];this[_0x2ffc('0x1e')][_0x51e7c2[_0x2ffc('0x1d')]][_0x2ffc('0x2e')]=_0x51e7c2[_0x2ffc('0x2e')];this[_0x2ffc('0x1e')][_0x51e7c2[_0x2ffc('0x1d')]][_0x2ffc('0x2f')]=_0x51e7c2[_0x2ffc('0x2f')];this[_0x2ffc('0x1e')][_0x51e7c2[_0x2ffc('0x1d')]]['localstationid']=_0x51e7c2[_0x2ffc('0x1c')];this[_0x2ffc('0x1e')][_0x51e7c2[_0x2ffc('0x1d')]][_0x2ffc('0x30')]=_0x51e7c2[_0x2ffc('0x30')];this[_0x2ffc('0x1e')][_0x51e7c2[_0x2ffc('0x1d')]]['transferrate']=_0x51e7c2[_0x2ffc('0x31')];this[_0x2ffc('0x1e')][_0x51e7c2[_0x2ffc('0x1d')]]['filename']=_0x51e7c2[_0x2ffc('0x2c')];this['channels'][_0x51e7c2[_0x2ffc('0x1d')]]['calleridnum']=_0x51e7c2[_0x2ffc('0x32')];if(this[_0x2ffc('0x1e')][_0x51e7c2[_0x2ffc('0x1d')]][_0x2ffc('0x2f')]>0x0){tiff2pdf(_0x51e7c2[_0x2ffc('0x2c')],_0x2ffc('0x33'),function(_0x5e26e6){logger[_0x2ffc('0x21')](_0x51e7c2['uniqueid'],_0x2ffc('0x34'),_0x5e26e6[_0x2ffc('0x35')]);attachment[_0x2ffc('0x36')]({'name':path[_0x2ffc('0x37')](_0x51e7c2[_0x2ffc('0x2c')])['name'],'basename':path['parse'](_0x51e7c2['filename'])[_0x2ffc('0x20')]+'.pdf','type':_0x2ffc('0x38')})['then'](function(_0x8f877a){faxAccount[_0x2ffc('0x39')](_0x368c95,{'from':_0x51e7c2[_0x2ffc('0x32')],'mapKey':_0x2ffc('0x3a'),'body':path[_0x2ffc('0x37')](_0x51e7c2[_0x2ffc('0x2c')])[_0x2ffc('0x20')]+_0x2ffc('0x3b'),'AttachmentId':_0x8f877a['id']})[_0x2ffc('0x3c')](function(_0x434e4a){logger[_0x2ffc('0x3d')](_0x51e7c2[_0x2ffc('0x1d')],_0x2ffc('0x3e'),JSON[_0x2ffc('0x3f')](_0x434e4a));});})[_0x2ffc('0x3c')](function(_0x745bba){logger['error'](_0x51e7c2[_0x2ffc('0x1d')],_0x2ffc('0x40'),JSON[_0x2ffc('0x3f')](_0x745bba));});});}logger[_0x2ffc('0x21')](_0x51e7c2['uniqueid'],_0x2ffc('0x40'));}};Fax[_0x2ffc('0x23')][_0x2ffc('0x41')]=function(_0x2c8ffb){if(this[_0x2ffc('0x11')][_0x2c8ffb[_0x2ffc('0x1d')]]){_[_0x2ffc('0x42')](this[_0x2ffc('0x1e')][_0x2c8ffb[_0x2ffc('0x1d')]],_[_0x2ffc('0x43')](_0x2c8ffb,['response',_0x2ffc('0x44')]));}};function updateStatus(_0x8f4cde){if(_0x8f4cde[_0x2ffc('0x45')]){faxMessage[_0x2ffc('0x46')](_0x8f4cde[_0x2ffc('0x45')],{'failMessage':_0x2ffc('0x47')})[_0x2ffc('0x48')](function(_0x31374e){ut[_0x2ffc('0x49')](_0x2ffc('0x4a'),_0x31374e);})[_0x2ffc('0x3c')](function(_0x30138d){ut[_0x2ffc('0x49')](_0x2ffc('0x4b'),_0x30138d);});}else{ut[_0x2ffc('0x49')](_0x2ffc('0x4c'));}}Fax[_0x2ffc('0x23')][_0x2ffc('0x4d')]=function(_0x58957a,_0x163a8b,_0x2ed789){var _0x222994=this;var _0xd4f469={};if(_0x163a8b){_0xd4f469={'read':_0x163a8b};}else{_0xd4f469={'failMessage':_0x2ed789};}if(this[_0x2ffc('0x11')][_0x58957a][_0x2ffc('0x45')]){faxMessage['update'](this[_0x2ffc('0x11')][_0x58957a][_0x2ffc('0x45')],_0xd4f469)['then'](function(_0x27410d){ut[_0x2ffc('0x49')](_0x2ffc('0x4e'),_0x27410d);})['catch'](function(_0x19bf2d){ut['logger'](_0x2ffc('0x4f'),_0x19bf2d);})[_0x2ffc('0x50')](function(){delete _0x222994[_0x2ffc('0x1e')][_0x58957a];delete _0x222994[_0x2ffc('0x11')][_0x58957a];});}else{ut[_0x2ffc('0x49')](_0x2ffc('0x51'));delete this[_0x2ffc('0x1e')][_0x58957a];delete this[_0x2ffc('0x11')][_0x58957a];}};Fax[_0x2ffc('0x23')]['syncHangup']=function(_0x512412){var _0x5e5e6f=this;if(this[_0x2ffc('0x1e')][_0x512412['uniqueid']]){if(this[_0x2ffc('0x11')][_0x512412[_0x2ffc('0x1d')]]){this['channels'][_0x512412[_0x2ffc('0x1d')]]['id']=this[_0x2ffc('0x11')][_0x512412[_0x2ffc('0x1d')]]['id'];this[_0x2ffc('0x1e')][_0x512412[_0x2ffc('0x1d')]][_0x2ffc('0x20')]=this[_0x2ffc('0x11')][_0x512412['uniqueid']][_0x2ffc('0x20')];}logger[_0x2ffc('0x21')](_0x512412['uniqueid'],this[_0x2ffc('0x11')][_0x512412[_0x2ffc('0x1d')]]?'\x20hangup\x20sendFile\x20':_0x2ffc('0x52'),JSON[_0x2ffc('0x3f')](this[_0x2ffc('0x1e')][_0x512412[_0x2ffc('0x1d')]]));if(this[_0x2ffc('0x11')][_0x512412['uniqueid']]){if(this[_0x2ffc('0x1e')][_0x512412[_0x2ffc('0x1d')]][_0x2ffc('0x53')]>0x0&&this[_0x2ffc('0x1e')][_0x512412[_0x2ffc('0x1d')]][_0x2ffc('0x54')]===_0x2ffc('0x55')){this[_0x2ffc('0x4d')](_0x512412[_0x2ffc('0x1d')],!![]);}else{this[_0x2ffc('0x4d')](_0x512412[_0x2ffc('0x1d')],![],this[_0x2ffc('0x1e')][_0x512412[_0x2ffc('0x1d')]][_0x2ffc('0x56')]?'SENDING\x20FAILED:\x20'+this[_0x2ffc('0x1e')][_0x512412['uniqueid']][_0x2ffc('0x56')]:_0x2ffc('0x57'));}}}};Fax[_0x2ffc('0x23')]['send']=function(_0x5a5c45){var _0x45ff1c=this;return new BPromise(function(_0x454fc5,_0x4c9ba9){_0x45ff1c[_0x2ffc('0x58')](_0x5a5c45,_0x45ff1c['faxAccounts'][_0x5a5c45[_0x2ffc('0x59')]])['then'](function(_0x1a05ae){ut[_0x2ffc('0x49')](_0x2ffc('0x5a'),_0x1a05ae);_0x454fc5(ut[_0x2ffc('0x35')](_0x2ffc('0x5b')));})[_0x2ffc('0x3c')](function(_0x5e9a77){ut['logger']('[Fax][execOriginate][failure]',_0x5e9a77);updateStatus(_0x5a5c45);_0x4c9ba9(ut[_0x2ffc('0x35')]('Fax\x20failed'));});});};Fax[_0x2ffc('0x23')][_0x2ffc('0x5c')]=function(_0x22a81c){var _0x18feae=this;return new BPromise(function(_0x185459,_0x5dcd95){var _0x3d000b=_0x18feae[_0x2ffc('0x5d')](_0x18feae['faxAccounts'][_0x22a81c['FaxAccountId']]['Trunk'],_0x22a81c);if(_0x3d000b['isValid']){_0x185459(ut[_0x2ffc('0x35')](_0x2ffc('0x5e')));}else{_0x5dcd95(ut[_0x2ffc('0x35')](_0x3d000b['message']));}});};function originate(_0xbae885,_0xb3c44d,_0x645514){return new BPromise(function(_0x2e2a3b,_0x8e9aff){if(_0x645514){var _0x19caa0=util['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[_0x2ffc('0x37')](_0xbae885[_0x2ffc('0x4')])[_0x2ffc('0x20')],_0xbae885[_0x2ffc('0x4')]);gs['execute'](_0x19caa0)['then'](function(){_0xbae885[_0x2ffc('0x4')]=util[_0x2ffc('0x5f')](_0x2ffc('0x60'),path[_0x2ffc('0x37')](_0xbae885[_0x2ffc('0x4')])[_0x2ffc('0x61')],path[_0x2ffc('0x37')](_0xbae885['path'])[_0x2ffc('0x20')]);_0xb3c44d[_0x2ffc('0x62')]=_0xbae885['path'];ut[_0x2ffc('0x49')](_0x2ffc('0x63'),'');ami[_0x2ffc('0x64')](ut[_0x2ffc('0x65')](_0xbae885,_0xb3c44d))[_0x2ffc('0x48')](function(_0x257219){_0x2e2a3b(_0x257219);})[_0x2ffc('0x3c')](function(_0x1bd9f8){_0x8e9aff(_0x1bd9f8);});})['catch'](function(_0x4811f0){_0x8e9aff(_0x4811f0);});}else{ami[_0x2ffc('0x64')](ut[_0x2ffc('0x65')](_0xbae885,_0xb3c44d))[_0x2ffc('0x48')](function(_0x28a771){_0x2e2a3b(_0x28a771);})[_0x2ffc('0x3c')](function(_0x46163f){_0x8e9aff(_0x46163f);});}});}Fax[_0x2ffc('0x23')][_0x2ffc('0x58')]=function(_0x23b248,_0x222880){var _0x3bc316=this;return new BPromise(function(_0x1eed3c,_0x1e00b2){var _0x2511a1=uuid['v4']();var _0x149ce3=ut['addVariables'](_0x23b248,_0x222880);_0x3bc316[_0x2ffc('0x11')][_0x2511a1]=new Action(_0x2511a1,_0x222880,_0x23b248);var _0x41f333=_0x3bc316['actions'][_0x2511a1];if(path['parse'](_0x23b248[_0x2ffc('0x4')])['ext']===_0x2ffc('0x3b')){originate(_0x41f333,_0x149ce3,!![])[_0x2ffc('0x48')](function(_0xf79243){_0x1eed3c(_0xf79243);})[_0x2ffc('0x3c')](function(_0x55726c){_0x1e00b2(_0x55726c);});}else{originate(_0x41f333,_0x149ce3,![])[_0x2ffc('0x48')](function(_0xacc286){_0x1eed3c(_0xacc286);})[_0x2ffc('0x3c')](function(_0x31b611){_0x1e00b2(_0x31b611);});}});};Fax[_0x2ffc('0x23')]['isTrunkReachable']=function(_0x3bb153){return!_[_0x2ffc('0x66')](_0x3bb153)&&!_['isNil'](_0x3bb153[_0x2ffc('0x20')])&&!_[_0x2ffc('0x66')](_0x3bb153['active'])&&_0x3bb153[_0x2ffc('0x67')]&&!_[_0x2ffc('0x66')](this[_0x2ffc('0x10')][util[_0x2ffc('0x5f')](_0x2ffc('0x68'),_0x3bb153['name'])])&&!_[_0x2ffc('0x66')](this['trunks'][util['format'](_0x2ffc('0x68'),_0x3bb153[_0x2ffc('0x20')])][_0x2ffc('0x69')])&&(this[_0x2ffc('0x10')][util[_0x2ffc('0x5f')](_0x2ffc('0x68'),_0x3bb153['name'])][_0x2ffc('0x69')]===_0x2ffc('0x6a')||this[_0x2ffc('0x10')][util[_0x2ffc('0x5f')]('SIP/%s',_0x3bb153[_0x2ffc('0x20')])]['status']===_0x2ffc('0x6b'));};Fax[_0x2ffc('0x23')][_0x2ffc('0x5d')]=function(_0x586e1a,_0x3fd511){if(!this[_0x2ffc('0x6c')](_0x586e1a)){ut['logger'](_0x2ffc('0x6d'),_[_0x2ffc('0x66')](_0x586e1a)?'':_0x586e1a['name']+_0x2ffc('0x6e'));return{'isValid':![],'message':_0x2ffc('0x6f')};}if(_['isNil'](_0x3fd511[_0x2ffc('0x3a')])){ut[_0x2ffc('0x49')](_0x2ffc('0x70'),JSON[_0x2ffc('0x3f')](_0x3fd511));return{'isValid':![],'message':_0x2ffc('0x71')};}if(_['isNil'](_0x3fd511['path'])){ut['logger'](_0x2ffc('0x72'),JSON[_0x2ffc('0x3f')](_0x3fd511));return{'isValid':![],'message':_0x2ffc('0x73')};}return{'isValid':!![],'message':_0x2ffc('0x74')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 46b1a4f..33d2f7c 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 _0x6cf7=['then','catch','[Notify]\x20','util','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0x25379e,_0x2ad247){var _0x166540=function(_0x212908){while(--_0x212908){_0x25379e['push'](_0x25379e['shift']());}};_0x166540(++_0x2ad247);}(_0x6cf7,0x1bb));var _0x76cf=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x6cf7[_0x5db657];return _0x2d6e70;};'use strict';var util=require(_0x76cf('0x0'));var BPromise=require('bluebird');var logger=require(_0x76cf('0x1'))('preview');var _=require(_0x76cf('0x2'));var faxAccount=require(_0x76cf('0x3'));function loggerCatch(_0x41e438){return function(_0x36228c){logger[_0x76cf('0x4')](_0x41e438,util[_0x76cf('0x5')](_0x36228c,{'showHidden':![],'depth':null}));};}exports[_0x76cf('0x6')]=function(_0x2c0b1c,_0xd64e2f){return BPromise[_0x76cf('0x7')]()[_0x76cf('0x8')](faxAccount[_0x76cf('0x6')](_0x2c0b1c,_0xd64e2f))[_0x76cf('0x9')](loggerCatch(_0x76cf('0xa')));}; \ No newline at end of file +var _0x12e1=['inspect','resolve','then','notify','catch','bluebird','../../../config/logger','lodash','../rpc/faxAccount'];(function(_0x170997,_0x554998){var _0x29dd6d=function(_0x468475){while(--_0x468475){_0x170997['push'](_0x170997['shift']());}};_0x29dd6d(++_0x554998);}(_0x12e1,0xc2));var _0x112e=function(_0xc82c84,_0x221d8e){_0xc82c84=_0xc82c84-0x0;var _0x3e576c=_0x12e1[_0xc82c84];return _0x3e576c;};'use strict';var util=require('util');var BPromise=require(_0x112e('0x0'));var logger=require(_0x112e('0x1'))('preview');var _=require(_0x112e('0x2'));var faxAccount=require(_0x112e('0x3'));function loggerCatch(_0x75ad8){return function(_0x10634d){logger['error'](_0x75ad8,util[_0x112e('0x4')](_0x10634d,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x1b0dad,_0x3b9b35){return BPromise[_0x112e('0x5')]()[_0x112e('0x6')](faxAccount[_0x112e('0x7')](_0x1b0dad,_0x3b9b35))[_0x112e('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 191a7f1..3c7d0b2 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 _0xc322=['../../../../config/logger','fax','child_process','exec','info','Exec\x20gs','inspect','util'];(function(_0x2f7023,_0x1aa399){var _0x2f5e4e=function(_0x1fa5d4){while(--_0x1fa5d4){_0x2f7023['push'](_0x2f7023['shift']());}};_0x2f5e4e(++_0x1aa399);}(_0xc322,0x15f));var _0x2c32=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xc322[_0x56740a];return _0x257144;};'use strict';var util=require(_0x2c32('0x0'));var logger=require(_0x2c32('0x1'))(_0x2c32('0x2'));var BPromise=require('bluebird');var exec=require(_0x2c32('0x3'))[_0x2c32('0x4')];exports['execute']=function(_0x4837d1){return new BPromise(function(_0x57da46,_0x3db9ab){exec(_0x4837d1,function(_0x505b47,_0x5236dc,_0x3b1156){logger[_0x2c32('0x5')]('Exec\x20gs',_0x5236dc);if(_0x505b47){logger[_0x2c32('0x5')](_0x2c32('0x6'),'\x20Error\x20:',util[_0x2c32('0x7')](_0x505b47,{'showHidden':![],'depth':null}),_0x5236dc,_0x3b1156);_0x3db9ab(_0x505b47);}_0x57da46(_0x5236dc);});});}; \ No newline at end of file +var _0x3a33=['exec','Exec\x20gs','\x20Error\x20:','../../../../config/logger','bluebird','child_process'];(function(_0x48aafb,_0xd2b58d){var _0x899036=function(_0x2aa1fb){while(--_0x2aa1fb){_0x48aafb['push'](_0x48aafb['shift']());}};_0x899036(++_0xd2b58d);}(_0x3a33,0x1bf));var _0x33a3=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x3a33[_0x411add];return _0x238242;};'use strict';var util=require('util');var logger=require(_0x33a3('0x0'))('fax');var BPromise=require(_0x33a3('0x1'));var exec=require(_0x33a3('0x2'))[_0x33a3('0x3')];exports['execute']=function(_0x39c26f){return new BPromise(function(_0x4629bf,_0xca9f5b){exec(_0x39c26f,function(_0x940975,_0x12b0eb,_0x3c28b8){logger['info'](_0x33a3('0x4'),_0x12b0eb);if(_0x940975){logger['info'](_0x33a3('0x4'),_0x33a3('0x5'),util['inspect'](_0x940975,{'showHidden':![],'depth':null}),_0x12b0eb,_0x3c28b8);_0xca9f5b(_0x940975);}_0x4629bf(_0x12b0eb);});});}; \ 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 d06331c..aa2ec1d 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 _0x172d=['\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','logger','info','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip'];(function(_0x209dc3,_0x1af1c1){var _0x12a83e=function(_0x196170){while(--_0x196170){_0x209dc3['push'](_0x209dc3['shift']());}};_0x12a83e(++_0x1af1c1);}(_0x172d,0x115));var _0xd172=function(_0x1f42f3,_0x4ef231){_0x1f42f3=_0x1f42f3-0x0;var _0x40bab4=_0x172d[_0x1f42f3];return _0x40bab4;};'use strict';var util=require(_0xd172('0x0'));var _=require(_0xd172('0x1'));var moment=require('moment');var logger=require(_0xd172('0x2'))(_0xd172('0x3'));exports['message']=function(_0x3fffe9){return{'message':_0x3fffe9};};exports[_0xd172('0x4')]=function(_0x304b64,_0x49eb31){logger[_0xd172('0x5')](_0x304b64,util['inspect'](_0x49eb31,{'showHidden':![],'depth':null}));};exports[_0xd172('0x6')]=function(_0x10e6f0,_0x3d5449){var _0xb7bac2={'XMF-ECM':_0x3d5449['ecm'],'XMF-HEADERINFO':_0x3d5449[_0xd172('0x7')],'XMF-MINRATE':_0x3d5449[_0xd172('0x8')],'XMF-MAXRATE':_0x3d5449[_0xd172('0x9')],'XMF-MODEM':util[_0xd172('0xa')](_0xd172('0xb'),_0x3d5449[_0xd172('0xc')]),'XMF-GATEWAY':_0x3d5449[_0xd172('0xd')],'XMF-FAXDETECT':_0x3d5449[_0xd172('0xe')],'XMF-T38TIMEOUT':_0x3d5449['t38timeout'],'XMF-LOCALSTATIONID':_0x3d5449[_0xd172('0xf')],'XMF-PATH':_0x10e6f0[_0xd172('0x10')]};return _0xb7bac2;};exports[_0xd172('0x11')]=function(_0x417ac6,_0xa37025){return{'actionid':_0x417ac6['uniqueid'],'action':_0xd172('0x12'),'channel':_0x417ac6[_0xd172('0x13')],'Exten':_0xd172('0x14'),'Context':_0xd172('0x15'),'Priority':'1','callerid':util[_0xd172('0xa')](_0xd172('0x16'),_0x417ac6['headerinfo']?_0x417ac6['headerinfo']:'',_0x417ac6['localstationid']),'variable':_0xa37025,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x417ac6['uniqueid']};}; \ No newline at end of file +var _0x4882=['xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','localstationid','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0x4882,0x118));var _0x2488=function(_0x2fce7a,_0x191fbf){_0x2fce7a=_0x2fce7a-0x0;var _0x2fa067=_0x4882[_0x2fce7a];return _0x2fa067;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x2488('0x0'));var logger=require(_0x2488('0x1'))(_0x2488('0x2'));exports[_0x2488('0x3')]=function(_0x409e56){return{'message':_0x409e56};};exports[_0x2488('0x4')]=function(_0x2c0da3,_0x17f4b4){logger[_0x2488('0x5')](_0x2c0da3,util[_0x2488('0x6')](_0x17f4b4,{'showHidden':![],'depth':null}));};exports[_0x2488('0x7')]=function(_0x51c97c,_0x4aa7cf){var _0x4f2574={'XMF-ECM':_0x4aa7cf[_0x2488('0x8')],'XMF-HEADERINFO':_0x4aa7cf[_0x2488('0x9')],'XMF-MINRATE':_0x4aa7cf[_0x2488('0xa')],'XMF-MAXRATE':_0x4aa7cf[_0x2488('0xb')],'XMF-MODEM':util['format'](_0x2488('0xc'),_0x4aa7cf['modem']),'XMF-GATEWAY':_0x4aa7cf[_0x2488('0xd')],'XMF-FAXDETECT':_0x4aa7cf[_0x2488('0xe')],'XMF-T38TIMEOUT':_0x4aa7cf[_0x2488('0xf')],'XMF-LOCALSTATIONID':_0x4aa7cf['localstationid'],'XMF-PATH':_0x51c97c[_0x2488('0x10')]};return _0x4f2574;};exports[_0x2488('0x11')]=function(_0x14de02,_0x1a28c4){return{'actionid':_0x14de02[_0x2488('0x12')],'action':_0x2488('0x13'),'channel':_0x14de02['channel'],'Exten':_0x2488('0x14'),'Context':_0x2488('0x15'),'Priority':'1','callerid':util[_0x2488('0x16')](_0x2488('0x17'),_0x14de02[_0x2488('0x9')]?_0x14de02['headerinfo']:'',_0x14de02[_0x2488('0x18')]),'variable':_0x1a28c4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x14de02[_0x2488('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 7d0daff..3357c22 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 _0x9daf=['getTelephones','initTelephones','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','[index.js][main]','inspect','util','./server','./realtime','./report','./acw','./dialer','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','then','initAgents'];(function(_0x517c31,_0x3da9ec){var _0x36d971=function(_0x2e77ef){while(--_0x2e77ef){_0x517c31['push'](_0x517c31['shift']());}};_0x36d971(++_0x3da9ec);}(_0x9daf,0x69));var _0xf9da=function(_0x426ab0,_0x13c67d){_0x426ab0=_0x426ab0-0x0;var _0x3bdb3d=_0x9daf[_0x426ab0];return _0x3bdb3d;};'use strict';var util=require(_0xf9da('0x0'));var moment=require('moment');var server=require(_0xf9da('0x1'));var Realtime=require(_0xf9da('0x2'));var Report=require(_0xf9da('0x3'));var Acw=require(_0xf9da('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xf9da('0x5'));var Preview=require('./preview');var Fax=require(_0xf9da('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0xf9da('0x7'));var voiceQueueReport=require(_0xf9da('0x8'));var voiceCallReport=require(_0xf9da('0x9'));var trunk=require(_0xf9da('0xa'));var trigger=require('./rpc/trigger');var template=require(_0xf9da('0xb'));var cmHopperHistory=require(_0xf9da('0xc'));var campaign=require(_0xf9da('0xd'));var voiceExtension=require(_0xf9da('0xe'));var faxAccount=require(_0xf9da('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xf9da('0x10'));var sugarcrm=require(_0xf9da('0x11'));var freshdesk=require(_0xf9da('0x12'));var desk=require(_0xf9da('0x13'));var zoho=require(_0xf9da('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xf9da('0x15'));var servicenow=require(_0xf9da('0x16'));var dynamics365=require(_0xf9da('0x17'));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(_0xf9da('0x18'))(_0xf9da('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xf9da('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf9da('0x1b')](_0xf9da('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xf9da('0x1c')]()['then'](user['getAgents']())[_0xf9da('0x1d')](realtime[_0xf9da('0x1e')]())[_0xf9da('0x1d')](user[_0xf9da('0x1f')]())[_0xf9da('0x1d')](realtime[_0xf9da('0x20')]())[_0xf9da('0x1d')](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0xf9da('0x1d')](voiceQueue['getVoiceQueues']())[_0xf9da('0x1d')](realtime[_0xf9da('0x21')]())[_0xf9da('0x1d')](trigger[_0xf9da('0x22')]())[_0xf9da('0x1d')](realtime[_0xf9da('0x23')]())[_0xf9da('0x1d')](template[_0xf9da('0x24')]())[_0xf9da('0x1d')](realtime['initTemplates']())[_0xf9da('0x1d')](zendesk[_0xf9da('0x25')]())[_0xf9da('0x1d')](realtime[_0xf9da('0x26')]())[_0xf9da('0x1d')](salesforce[_0xf9da('0x27')]())[_0xf9da('0x1d')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0xf9da('0x28')]())[_0xf9da('0x1d')](realtime['initSugarcrmAccounts']())[_0xf9da('0x1d')](freshdesk[_0xf9da('0x29')]())[_0xf9da('0x1d')](realtime[_0xf9da('0x2a')]())[_0xf9da('0x1d')](desk['getDeskAccounts']())[_0xf9da('0x1d')](realtime[_0xf9da('0x2b')]())['then'](zoho['getZohoAccounts']())[_0xf9da('0x1d')](realtime[_0xf9da('0x2c')]())[_0xf9da('0x1d')](vtiger[_0xf9da('0x2d')]())[_0xf9da('0x1d')](realtime[_0xf9da('0x2e')]())['then'](freshsales[_0xf9da('0x2f')]())[_0xf9da('0x1d')](realtime[_0xf9da('0x30')]())[_0xf9da('0x1d')](servicenow['getServicenowAccounts']())['then'](realtime[_0xf9da('0x31')]())['then'](dynamics365[_0xf9da('0x32')]())[_0xf9da('0x1d')](realtime[_0xf9da('0x33')]())[_0xf9da('0x1d')](campaign[_0xf9da('0x34')]())['then'](realtime['initCampaigns']())[_0xf9da('0x1d')](voiceExtension['getVoiceExtensions']())[_0xf9da('0x1d')](realtime[_0xf9da('0x35')]())[_0xf9da('0x1d')](faxAccount[_0xf9da('0x36')]())[_0xf9da('0x1d')](realtime[_0xf9da('0x37')]())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xf9da('0x1d')](voiceQueueReport[_0xf9da('0x38')]())[_0xf9da('0x1d')](realtime['initVoiceQueueReports']())[_0xf9da('0x1d')](cmHopperHistory[_0xf9da('0x39')]())[_0xf9da('0x1d')](realtime[_0xf9da('0x3a')]())[_0xf9da('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0xf9da('0x1d')](realtime[_0xf9da('0x3b')]())[_0xf9da('0x1d')](voiceCallReport[_0xf9da('0x3c')]())['then'](realtime[_0xf9da('0x3d')]())[_0xf9da('0x3e')](function(_0x4a0cb9){logger[_0xf9da('0x3f')](_0xf9da('0x40'),util['inspect'](_0x4a0cb9,{'showHidden':![],'depth':null}));});}function main(){return server[_0xf9da('0x41')](realtime,preview,fax)[_0xf9da('0x1d')](function(){return initRealtime();})[_0xf9da('0x1d')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xf9da('0x3e')](function(_0x38ccf6){logger[_0xf9da('0x3f')](_0xf9da('0x42'),util[_0xf9da('0x43')](_0x38ccf6,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xf00c=['[index.js][main]','util','moment','./server','./realtime','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect'];(function(_0x29d07c,_0x4e1eb8){var _0xf3375f=function(_0x35ca48){while(--_0x35ca48){_0x29d07c['push'](_0x29d07c['shift']());}};_0xf3375f(++_0x4e1eb8);}(_0xf00c,0x150));var _0xcf00=function(_0x1a4343,_0x5b6ca7){_0x1a4343=_0x1a4343-0x0;var _0x3acb85=_0xf00c[_0x1a4343];return _0x3acb85;};'use strict';var util=require(_0xcf00('0x0'));var moment=require(_0xcf00('0x1'));var server=require(_0xcf00('0x2'));var Realtime=require(_0xcf00('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xcf00('0x4'));var Dialer=require('./dialer');var Preview=require(_0xcf00('0x5'));var Fax=require('./fax');var user=require(_0xcf00('0x6'));var voiceQueue=require(_0xcf00('0x7'));var voiceQueueReport=require(_0xcf00('0x8'));var voiceCallReport=require(_0xcf00('0x9'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xcf00('0xa'));var cmHopperHistory=require(_0xcf00('0xb'));var campaign=require(_0xcf00('0xc'));var voiceExtension=require(_0xcf00('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xcf00('0xe'));var salesforce=require(_0xcf00('0xf'));var sugarcrm=require(_0xcf00('0x10'));var freshdesk=require(_0xcf00('0x11'));var desk=require(_0xcf00('0x12'));var zoho=require(_0xcf00('0x13'));var vtiger=require(_0xcf00('0x14'));var freshsales=require(_0xcf00('0x15'));var servicenow=require(_0xcf00('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xcf00('0x17'))(_0xcf00('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xcf00('0x19')](_0xcf00('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xcf00('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xcf00('0x1b')](user[_0xcf00('0x1c')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x1d')]())['then'](user[_0xcf00('0x1e')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x1f')]())[_0xcf00('0x1b')](trunk['getTrunks']())[_0xcf00('0x1b')](realtime[_0xcf00('0x20')]())[_0xcf00('0x1b')](voiceQueue[_0xcf00('0x21')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x22')]())[_0xcf00('0x1b')](trigger[_0xcf00('0x23')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x24')]())['then'](template[_0xcf00('0x25')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x26')]())['then'](zendesk[_0xcf00('0x27')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x28')]())[_0xcf00('0x1b')](salesforce[_0xcf00('0x29')]())[_0xcf00('0x1b')](realtime['initSalesforceAccounts']())[_0xcf00('0x1b')](sugarcrm['getSugarcrmAccounts']())[_0xcf00('0x1b')](realtime['initSugarcrmAccounts']())[_0xcf00('0x1b')](freshdesk['getFreshdeskAccounts']())[_0xcf00('0x1b')](realtime['initFreshdeskAccounts']())[_0xcf00('0x1b')](desk[_0xcf00('0x2a')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x2b')]())[_0xcf00('0x1b')](zoho[_0xcf00('0x2c')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x2d')]())[_0xcf00('0x1b')](vtiger['getVtigerAccounts']())[_0xcf00('0x1b')](realtime['initVtigerAccounts']())['then'](freshsales[_0xcf00('0x2e')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x2f')]())['then'](servicenow[_0xcf00('0x30')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x31')]())[_0xcf00('0x1b')](dynamics365[_0xcf00('0x32')]())[_0xcf00('0x1b')](realtime['initDynamics365Accounts']())[_0xcf00('0x1b')](campaign[_0xcf00('0x33')]())[_0xcf00('0x1b')](realtime['initCampaigns']())[_0xcf00('0x1b')](voiceExtension['getVoiceExtensions']())[_0xcf00('0x1b')](realtime['initVoiceExtensions']())[_0xcf00('0x1b')](faxAccount[_0xcf00('0x34')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x35')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0xcf00('0x36')]()['then'](voiceQueueReport[_0xcf00('0x37')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x38')]())[_0xcf00('0x1b')](cmHopperHistory[_0xcf00('0x39')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x3a')]())['then'](cmHopperHistory[_0xcf00('0x3b')]())[_0xcf00('0x1b')](realtime[_0xcf00('0x3c')]())[_0xcf00('0x1b')](voiceCallReport[_0xcf00('0x3d')]())['then'](realtime[_0xcf00('0x3e')]())[_0xcf00('0x3f')](function(_0xae2ce5){logger[_0xcf00('0x40')]('[index.js][initParams]',util[_0xcf00('0x41')](_0xae2ce5,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xcf00('0x1b')](function(){return initRealtime();})[_0xcf00('0x1b')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xcf00('0x3f')](function(_0x37dd7a){logger['error'](_0xcf00('0x42'),util[_0xcf00('0x41')](_0x37dd7a,{'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 5d8f791..4c4ce6b 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 _0x7e14=['updateStatusRealtime','toLowerCase','idle','inuse','talking','statePause','stringify','format','emit','user:save','user:presence','exports','lodash','util','moment','md5','ioredis','redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e14,0x174));var _0x47e1=function(_0x1eb443,_0x2d700c){_0x1eb443=_0x1eb443-0x0;var _0x70007f=_0x7e14[_0x1eb443];return _0x70007f;};'use strict';var _=require(_0x47e1('0x0'));var util=require(_0x47e1('0x1'));var moment=require(_0x47e1('0x2'));var md5=require(_0x47e1('0x3'));var Redis=require(_0x47e1('0x4'));var config=require('../../../config/environment');config[_0x47e1('0x5')]=_[_0x47e1('0x6')](config[_0x47e1('0x5')],{'host':_0x47e1('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x103bfd){this['id']=_0x103bfd['id']||0x0;this[_0x47e1('0x8')]=_0x103bfd[_0x47e1('0x8')]||'';this[_0x47e1('0x9')]=_0x103bfd[_0x47e1('0x9')]||'';this[_0x47e1('0xa')]=_0x103bfd[_0x47e1('0xa')]||'';this[_0x47e1('0xb')]=_0x103bfd[_0x47e1('0xb')]||'';this[_0x47e1('0xc')]=_0x47e1('0xd');this[_0x47e1('0xe')]=0x0;this[_0x47e1('0xf')]=_0x47e1('0xd');this[_0x47e1('0x10')]='';this[_0x47e1('0x11')]='';this[_0x47e1('0x12')]='';this[_0x47e1('0x13')]='';this[_0x47e1('0x14')]=_0x103bfd['online']||![];this[_0x47e1('0x15')]=_0x47e1('0xd');this[_0x47e1('0x16')]=0x0;this[_0x47e1('0x17')]='';this[_0x47e1('0x18')]='';this[_0x47e1('0x19')]=![];this[_0x47e1('0x1a')]=![];this['md5']='';}Agent[_0x47e1('0x1b')][_0x47e1('0x1c')]=function(_0x310be8){var _0x369a12;if(_0x310be8&&_0x310be8[_0x47e1('0xc')]){_0x369a12=_0x310be8[_0x47e1('0xc')][_0x47e1('0x1d')]();switch(_0x369a12){case'not_inuse':_0x369a12=_0x47e1('0x1e');break;case _0x47e1('0x1f'):_0x369a12=_0x47e1('0x20');break;}}if(_0x369a12&&this['voiceStatus']!==_0x369a12||_0x310be8[_0x47e1('0x21')]){this[_0x47e1('0x16')]=_['toNumber'](moment()['format']('x'));}if(_0x369a12){this[_0x47e1('0x15')]=_0x369a12;}var _0xe1441f={'id':this['id'],'name':this[_0x47e1('0x8')],'email':this['email'],'accountcode':this[_0x47e1('0xa')],'fullname':this[_0x47e1('0xb')],'state':this[_0x47e1('0xc')],'stateTime':this[_0x47e1('0xe')],'status':this[_0x47e1('0xf')],'address':this[_0x47e1('0x10')],'online':this[_0x47e1('0x14')],'voiceStatus':this[_0x47e1('0x15')],'voiceStatusTime':this[_0x47e1('0x16')],'voiceStatusCallerIdNumber':this[_0x47e1('0x17')],'voiceStatusQueue':this[_0x47e1('0x18')],'interface':this[_0x47e1('0x13')],'onhold':this['onhold']};var _0x5dd225=md5(JSON[_0x47e1('0x22')](_0xe1441f));if(this[_0x47e1('0x3')]!==_0x5dd225){this[_0x47e1('0x3')]=_0x5dd225;io['to'](util[_0x47e1('0x23')]('user:%s',_0xe1441f['name']))[_0x47e1('0x24')](_0x47e1('0x25'),_0xe1441f);io[_0x47e1('0x24')](_0x47e1('0x26'),_0xe1441f);}};module[_0x47e1('0x27')]=Agent; \ No newline at end of file +var _0xd2b0=['talking','statePause','format','status','online','user:%s','emit','user:save','user:presence','exports','lodash','moment','ioredis','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','interface','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse'];(function(_0x51b51a,_0x2f156c){var _0x40bcd6=function(_0x429572){while(--_0x429572){_0x51b51a['push'](_0x51b51a['shift']());}};_0x40bcd6(++_0x2f156c);}(_0xd2b0,0x13a));var _0x0d2b=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xd2b0[_0x37a79c];return _0x561d89;};'use strict';var _=require(_0x0d2b('0x0'));var util=require('util');var moment=require(_0x0d2b('0x1'));var md5=require('md5');var Redis=require(_0x0d2b('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x0d2b('0x3')],{'host':_0x0d2b('0x4'),'port':0x18eb});var io=require(_0x0d2b('0x5'))(new Redis(config[_0x0d2b('0x3')]));function Agent(_0xefacf5){this['id']=_0xefacf5['id']||0x0;this[_0x0d2b('0x6')]=_0xefacf5[_0x0d2b('0x6')]||'';this[_0x0d2b('0x7')]=_0xefacf5[_0x0d2b('0x7')]||'';this[_0x0d2b('0x8')]=_0xefacf5[_0x0d2b('0x8')]||'';this[_0x0d2b('0x9')]=_0xefacf5[_0x0d2b('0x9')]||'';this[_0x0d2b('0xa')]=_0x0d2b('0xb');this[_0x0d2b('0xc')]=0x0;this['status']=_0x0d2b('0xb');this[_0x0d2b('0xd')]='';this[_0x0d2b('0xe')]='';this['mobile']='';this[_0x0d2b('0xf')]='';this['online']=_0xefacf5['online']||![];this[_0x0d2b('0x10')]=_0x0d2b('0xb');this[_0x0d2b('0x11')]=0x0;this[_0x0d2b('0x12')]='';this[_0x0d2b('0x13')]='';this[_0x0d2b('0x14')]=![];this[_0x0d2b('0x15')]=![];this[_0x0d2b('0x16')]='';}Agent['prototype'][_0x0d2b('0x17')]=function(_0x423e91){var _0xeca51b;if(_0x423e91&&_0x423e91[_0x0d2b('0xa')]){_0xeca51b=_0x423e91[_0x0d2b('0xa')][_0x0d2b('0x18')]();switch(_0xeca51b){case _0x0d2b('0x19'):_0xeca51b=_0x0d2b('0x1a');break;case _0x0d2b('0x1b'):_0xeca51b=_0x0d2b('0x1c');break;}}if(_0xeca51b&&this[_0x0d2b('0x10')]!==_0xeca51b||_0x423e91[_0x0d2b('0x1d')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x0d2b('0x1e')]('x'));}if(_0xeca51b){this[_0x0d2b('0x10')]=_0xeca51b;}var _0x10a2ba={'id':this['id'],'name':this[_0x0d2b('0x6')],'email':this[_0x0d2b('0x7')],'accountcode':this[_0x0d2b('0x8')],'fullname':this[_0x0d2b('0x9')],'state':this['state'],'stateTime':this[_0x0d2b('0xc')],'status':this[_0x0d2b('0x1f')],'address':this[_0x0d2b('0xd')],'online':this[_0x0d2b('0x20')],'voiceStatus':this[_0x0d2b('0x10')],'voiceStatusTime':this[_0x0d2b('0x11')],'voiceStatusCallerIdNumber':this[_0x0d2b('0x12')],'voiceStatusQueue':this[_0x0d2b('0x13')],'interface':this['interface'],'onhold':this[_0x0d2b('0x14')]};var _0x39331c=md5(JSON['stringify'](_0x10a2ba));if(this[_0x0d2b('0x16')]!==_0x39331c){this['md5']=_0x39331c;io['to'](util[_0x0d2b('0x1e')](_0x0d2b('0x21'),_0x10a2ba['name']))[_0x0d2b('0x22')](_0x0d2b('0x23'),_0x10a2ba);io[_0x0d2b('0x22')](_0x0d2b('0x24'),_0x10a2ba);}};module[_0x0d2b('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 40c521b..385eac2 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 _0xfd85=['dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0xd1d2b0,_0x4b1eba){var _0x1546a3=function(_0x1e2342){while(--_0x1e2342){_0xd1d2b0['push'](_0xd1d2b0['shift']());}};_0x1546a3(++_0x4b1eba);}(_0xfd85,0xa9));var _0x5fd8=function(_0x25c7fb,_0x2e4e86){_0x25c7fb=_0x25c7fb-0x0;var _0x214b77=_0xfd85[_0x25c7fb];return _0x214b77;};'use strict';function Campaign(_0x5f5885){this['id']=_0x5f5885['id']||0x0;this[_0x5fd8('0x0')]=_0x5f5885[_0x5fd8('0x0')]||'';this[_0x5fd8('0x1')]=_0x5f5885[_0x5fd8('0x1')]||_0x5fd8('0x2');this[_0x5fd8('0x3')]=0x0;this[_0x5fd8('0x4')]=0x0;this[_0x5fd8('0x5')]=0x0;this[_0x5fd8('0x6')]=0x0;this[_0x5fd8('0x7')]='';this[_0x5fd8('0x8')]=!![];this[_0x5fd8('0x9')]=_0x5f5885[_0x5fd8('0x9')];this[_0x5fd8('0xa')]=_0x5f5885[_0x5fd8('0xa')];this[_0x5fd8('0xb')]=_0x5f5885[_0x5fd8('0xb')]||null;this['dialGlobalInterval']=_0x5f5885[_0x5fd8('0xc')]?_0x5f5885[_0x5fd8('0xc')]:null;this['dialOriginateCallerIdName']=_0x5f5885[_0x5fd8('0xd')];this['dialOriginateCallerIdNumber']=_0x5f5885['dialOriginateCallerIdNumber'];this[_0x5fd8('0xe')]=_0x5f5885[_0x5fd8('0xe')]||0x1e;this[_0x5fd8('0xf')]=_0x5f5885['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x5f5885[_0x5fd8('0x10')];this['dialBusyMaxRetry']=_0x5f5885['dialBusyMaxRetry'];this[_0x5fd8('0x11')]=_0x5f5885['dialBusyRetryFrequency'];this[_0x5fd8('0x12')]=_0x5f5885[_0x5fd8('0x12')];this[_0x5fd8('0x13')]=_0x5f5885[_0x5fd8('0x13')];this[_0x5fd8('0x14')]=_0x5f5885['dialGlobalMaxRetry'];this[_0x5fd8('0x15')]=_0x5f5885[_0x5fd8('0x15')]||0x3;this[_0x5fd8('0x16')]=_0x5f5885[_0x5fd8('0x16')]||0x96;this[_0x5fd8('0x17')]=_0x5f5885[_0x5fd8('0x17')]||0x3;this[_0x5fd8('0x18')]=_0x5f5885['dialDropRetryFrequency']||0x96;this[_0x5fd8('0x19')]=_0x5f5885[_0x5fd8('0x19')]||0x3;this[_0x5fd8('0x1a')]=_0x5f5885[_0x5fd8('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x5f5885['dialMachineMaxRetry']||0x3;this[_0x5fd8('0x1b')]=_0x5f5885[_0x5fd8('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x5f5885[_0x5fd8('0x1c')]||0x3;this[_0x5fd8('0x1d')]=_0x5f5885[_0x5fd8('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x5f5885['dialOrderByScheduledAt']||_0x5fd8('0x1e');this[_0x5fd8('0x1f')]=_0x5f5885['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x5f5885[_0x5fd8('0x20')]||undefined;this[_0x5fd8('0x21')]=_0x5f5885[_0x5fd8('0x21')]||undefined;this[_0x5fd8('0x22')]=_0x5f5885[_0x5fd8('0x22')]?_0x5f5885[_0x5fd8('0x22')]:undefined;this[_0x5fd8('0x23')]=_0x5f5885[_0x5fd8('0x23')]?_0x5f5885['Trunk']:undefined;this[_0x5fd8('0x24')]=_0x5f5885[_0x5fd8('0x24')]?_0x5f5885[_0x5fd8('0x24')]:undefined;this[_0x5fd8('0x25')]=_0x5f5885[_0x5fd8('0x25')]?_0x5f5885[_0x5fd8('0x25')]:undefined;this[_0x5fd8('0x26')]=_0x5f5885['SquareProject']?_0x5f5885['SquareProject']['name']:undefined;this['dialAMDActive']=_0x5f5885['dialAMDActive']||![];this[_0x5fd8('0x27')]=_0x5f5885[_0x5fd8('0x27')];this[_0x5fd8('0x28')]=_0x5f5885[_0x5fd8('0x28')];this[_0x5fd8('0x29')]=_0x5f5885['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x5f5885['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x5f5885[_0x5fd8('0x2a')];this[_0x5fd8('0x2b')]=_0x5f5885[_0x5fd8('0x2b')];this[_0x5fd8('0x2c')]=_0x5f5885[_0x5fd8('0x2c')];this['dialAMDSilenceThreshold']=_0x5f5885[_0x5fd8('0x2d')];this['dialAMDMaximumWordLength']=_0x5f5885[_0x5fd8('0x2e')];}module[_0x5fd8('0x2f')]=Campaign; \ No newline at end of file +var _0x551c=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x247046,_0x2448c7){var _0x147b69=function(_0x480745){while(--_0x480745){_0x247046['push'](_0x247046['shift']());}};_0x147b69(++_0x2448c7);}(_0x551c,0xdc));var _0xc551=function(_0xc4dd3a,_0x4b6c6e){_0xc4dd3a=_0xc4dd3a-0x0;var _0x4b07b5=_0x551c[_0xc4dd3a];return _0x4b07b5;};'use strict';function Campaign(_0x3426cf){this['id']=_0x3426cf['id']||0x0;this[_0xc551('0x0')]=_0x3426cf[_0xc551('0x0')]||'';this[_0xc551('0x1')]=_0x3426cf[_0xc551('0x1')]||'campaign';this['originated']=0x0;this['temp']=0x0;this[_0xc551('0x2')]=0x0;this[_0xc551('0x3')]=0x0;this['message']='';this[_0xc551('0x4')]=!![];this[_0xc551('0x5')]=_0x3426cf[_0xc551('0x5')];this[_0xc551('0x6')]=_0x3426cf[_0xc551('0x6')];this[_0xc551('0x7')]=_0x3426cf['dialTimezone']||null;this[_0xc551('0x8')]=_0x3426cf[_0xc551('0x8')]?_0x3426cf['dialGlobalInterval']:null;this[_0xc551('0x9')]=_0x3426cf[_0xc551('0x9')];this['dialOriginateCallerIdNumber']=_0x3426cf[_0xc551('0xa')];this[_0xc551('0xb')]=_0x3426cf[_0xc551('0xb')]||0x1e;this[_0xc551('0xc')]=_0x3426cf['dialCongestionMaxRetry'];this[_0xc551('0xd')]=_0x3426cf['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x3426cf[_0xc551('0xe')];this[_0xc551('0xf')]=_0x3426cf[_0xc551('0xf')];this[_0xc551('0x10')]=_0x3426cf['dialNoAnswerMaxRetry'];this[_0xc551('0x11')]=_0x3426cf[_0xc551('0x11')];this[_0xc551('0x12')]=_0x3426cf[_0xc551('0x12')];this[_0xc551('0x13')]=_0x3426cf[_0xc551('0x13')]||0x3;this[_0xc551('0x14')]=_0x3426cf[_0xc551('0x14')]||0x96;this[_0xc551('0x15')]=_0x3426cf['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x3426cf[_0xc551('0x16')]||0x96;this[_0xc551('0x17')]=_0x3426cf[_0xc551('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x3426cf[_0xc551('0x18')]||0x96;this['dialMachineMaxRetry']=_0x3426cf['dialMachineMaxRetry']||0x3;this[_0xc551('0x19')]=_0x3426cf['dialMachineRetryFrequency']||0x96;this[_0xc551('0x1a')]=_0x3426cf[_0xc551('0x1a')]||0x3;this[_0xc551('0x1b')]=_0x3426cf[_0xc551('0x1b')]||0x96;this[_0xc551('0x1c')]=_0x3426cf[_0xc551('0x1c')]||_0xc551('0x1d');this[_0xc551('0x1e')]=_0x3426cf[_0xc551('0x1e')]||undefined;this[_0xc551('0x1f')]=_0x3426cf[_0xc551('0x1f')]||undefined;this[_0xc551('0x20')]=_0x3426cf[_0xc551('0x20')]||undefined;this[_0xc551('0x21')]=_0x3426cf['TrunkBackup']?_0x3426cf[_0xc551('0x21')]:undefined;this[_0xc551('0x22')]=_0x3426cf[_0xc551('0x22')]?_0x3426cf[_0xc551('0x22')]:undefined;this[_0xc551('0x23')]=_0x3426cf[_0xc551('0x23')]?_0x3426cf[_0xc551('0x23')]:undefined;this[_0xc551('0x24')]=_0x3426cf[_0xc551('0x24')]?_0x3426cf[_0xc551('0x24')]:undefined;this['dialQueueProject']=_0x3426cf['SquareProject']?_0x3426cf[_0xc551('0x24')][_0xc551('0x0')]:undefined;this['dialAMDActive']=_0x3426cf[_0xc551('0x25')]||![];this['dialAMDInitialSilence']=_0x3426cf['dialAMDInitialSilence'];this[_0xc551('0x26')]=_0x3426cf[_0xc551('0x26')];this[_0xc551('0x27')]=_0x3426cf[_0xc551('0x27')];this[_0xc551('0x28')]=_0x3426cf[_0xc551('0x28')];this[_0xc551('0x29')]=_0x3426cf[_0xc551('0x29')];this[_0xc551('0x2a')]=_0x3426cf[_0xc551('0x2a')];this[_0xc551('0x2b')]=_0x3426cf[_0xc551('0x2b')];this[_0xc551('0x2c')]=_0x3426cf[_0xc551('0x2c')];this['dialAMDMaximumWordLength']=_0x3426cf[_0xc551('0x2d')];}module[_0xc551('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 921415e..89792a7 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 _0xe98f=['queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridname','connectedlinenum','context','linkedid','exten','answertime','unmanaged','abandoned','lastapplication','duration','billableseconds','type','tag','disposition','monitor','monitorFilename'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe98f,0xde));var _0xfe98=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe98f[_0x2641f9];return _0x585741;};'use strict';function Channel(){this[_0xfe98('0x0')]=null;this['channel']='';this[_0xfe98('0x1')]='';this['calleridnum']=0x0;this[_0xfe98('0x2')]='';this[_0xfe98('0x3')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0xfe98('0x4')]='';this['uniqueid']=0x0;this[_0xfe98('0x5')]=0x0;this[_0xfe98('0x6')]=0x0;this['answered']=![];this[_0xfe98('0x7')]=null;this['endtime']=null;this[_0xfe98('0x8')]=![];this[_0xfe98('0x9')]=![];this[_0xfe98('0xa')]='';this['lastdata']='';this[_0xfe98('0xb')]=0x0;this[_0xfe98('0xc')]=0x0;this['holdtime']=0x0;this[_0xfe98('0xd')]=null;this[_0xfe98('0xe')]=null;this[_0xfe98('0xf')]=null;this[_0xfe98('0x10')]=![];this[_0xfe98('0x11')]=null;this[_0xfe98('0x12')]=null;this['monitors']=[];this[_0xfe98('0x13')]=undefined;this[_0xfe98('0x14')]=undefined;this[_0xfe98('0x15')]=undefined;this[_0xfe98('0x16')]=0x0;}module[_0xfe98('0x17')]=Channel; \ No newline at end of file +var _0x0309=['transfercalleridnum','transferType','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','linkedid','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitorFilename','monitors'];(function(_0x3dd720,_0x2c40fa){var _0x2ebdc7=function(_0x4e81ae){while(--_0x4e81ae){_0x3dd720['push'](_0x3dd720['shift']());}};_0x2ebdc7(++_0x2c40fa);}(_0x0309,0x8d));var _0x9030=function(_0xe51de5,_0x2519f1){_0xe51de5=_0xe51de5-0x0;var _0x359bcb=_0x0309[_0xe51de5];return _0x359bcb;};'use strict';function Channel(){this[_0x9030('0x0')]=null;this[_0x9030('0x1')]='';this[_0x9030('0x2')]='';this[_0x9030('0x3')]=0x0;this[_0x9030('0x4')]='';this['connectedlinenum']=undefined;this[_0x9030('0x5')]=undefined;this[_0x9030('0x6')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x9030('0x7')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0x9030('0x8')]=null;this['unmanaged']=![];this[_0x9030('0x9')]=![];this[_0x9030('0xa')]='';this[_0x9030('0xb')]='';this[_0x9030('0xc')]=0x0;this[_0x9030('0xd')]=0x0;this[_0x9030('0xe')]=0x0;this[_0x9030('0xf')]=null;this[_0x9030('0x10')]=null;this[_0x9030('0x11')]=null;this['monitor']=![];this[_0x9030('0x12')]=null;this['queue']=null;this[_0x9030('0x13')]=[];this[_0x9030('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x9030('0x15')]=undefined;this['mohtime']=0x0;}module[_0x9030('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 248530a..b66c783 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 _0xdc61=['serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x476419,_0x565de7){var _0x37d8cf=function(_0x29ea8f){while(--_0x29ea8f){_0x476419['push'](_0x476419['shift']());}};_0x37d8cf(++_0x565de7);}(_0xdc61,0x7b));var _0x1dc6=function(_0x3f9336,_0x4471ec){_0x3f9336=_0x3f9336-0x0;var _0x1cbb82=_0xdc61[_0x3f9336];return _0x1cbb82;};'use strict';function DeskAccount(_0x1834b2){this['id']=_0x1834b2['id']||0x0;this['name']=_0x1834b2['name']||'';this['username']=_0x1834b2[_0x1dc6('0x0')]||'';this[_0x1dc6('0x1')]=_0x1834b2['remoteUri']||'';this[_0x1dc6('0x2')]=_0x1834b2['authType']||'';this[_0x1dc6('0x3')]=_0x1834b2[_0x1dc6('0x3')]||'';this[_0x1dc6('0x4')]=_0x1834b2['consumerKey']||'';this[_0x1dc6('0x5')]=_0x1834b2['consumerSecret']||'';this[_0x1dc6('0x6')]=_0x1834b2[_0x1dc6('0x6')]||'';this[_0x1dc6('0x7')]=_0x1834b2[_0x1dc6('0x7')]||'';this[_0x1dc6('0x8')]=_0x1834b2['type']||'';this[_0x1dc6('0x9')]=_0x1834b2[_0x1dc6('0x9')]||'';this[_0x1dc6('0xa')]=_0x1834b2['Configurations']||{};}module[_0x1dc6('0xb')]=DeskAccount; \ No newline at end of file +var _0x977e=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x4f6502,_0x3994cb){var _0x3909a8=function(_0x2c49fc){while(--_0x2c49fc){_0x4f6502['push'](_0x4f6502['shift']());}};_0x3909a8(++_0x3994cb);}(_0x977e,0x1b0));var _0xe977=function(_0x45f4cc,_0x28447d){_0x45f4cc=_0x45f4cc-0x0;var _0x20b7a1=_0x977e[_0x45f4cc];return _0x20b7a1;};'use strict';function DeskAccount(_0x43bf72){this['id']=_0x43bf72['id']||0x0;this[_0xe977('0x0')]=_0x43bf72['name']||'';this[_0xe977('0x1')]=_0x43bf72['username']||'';this['remoteUri']=_0x43bf72[_0xe977('0x2')]||'';this[_0xe977('0x3')]=_0x43bf72['authType']||'';this[_0xe977('0x4')]=_0x43bf72[_0xe977('0x4')]||'';this[_0xe977('0x5')]=_0x43bf72[_0xe977('0x5')]||'';this[_0xe977('0x6')]=_0x43bf72[_0xe977('0x6')]||'';this['token']=_0x43bf72[_0xe977('0x7')]||'';this[_0xe977('0x8')]=_0x43bf72[_0xe977('0x8')]||'';this[_0xe977('0x9')]=_0x43bf72[_0xe977('0x9')]||'';this[_0xe977('0xa')]=_0x43bf72['serverUrl']||'';this[_0xe977('0xb')]=_0x43bf72[_0xe977('0xb')]||{};}module[_0xe977('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 959b4c6..f1c315e 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 _0xbc36=['modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x13c89b,_0x5da6c4){var _0x57d603=function(_0x5d6081){while(--_0x5d6081){_0x13c89b['push'](_0x13c89b['shift']());}};_0x57d603(++_0x5da6c4);}(_0xbc36,0x1d1));var _0x6bc3=function(_0x11f88d,_0x444aa5){_0x11f88d=_0x11f88d-0x0;var _0x17db28=_0xbc36[_0x11f88d];return _0x17db28;};'use strict';function Dynamics365Account(_0x3888f2){this['id']=_0x3888f2['id']||0x0;this['name']=_0x3888f2[_0x6bc3('0x0')]||'';this[_0x6bc3('0x1')]=_0x3888f2[_0x6bc3('0x1')]||'';this['password']=_0x3888f2[_0x6bc3('0x2')]||'';this['remoteUri']=_0x3888f2[_0x6bc3('0x3')]||'';this[_0x6bc3('0x4')]=_0x3888f2[_0x6bc3('0x4')]||'';this[_0x6bc3('0x5')]=_0x3888f2[_0x6bc3('0x5')]||'';this[_0x6bc3('0x6')]=_0x3888f2[_0x6bc3('0x6')]||{};this[_0x6bc3('0x7')]=_0x3888f2[_0x6bc3('0x7')]||'';this['modernAuthentication']=_0x3888f2[_0x6bc3('0x8')]||![];this[_0x6bc3('0x9')]=_0x3888f2[_0x6bc3('0x9')]||{};this[_0x6bc3('0xa')]=_0x3888f2[_0x6bc3('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xcf2a=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x1afe95,_0x305ef6){var _0x3965df=function(_0x225bcd){while(--_0x225bcd){_0x1afe95['push'](_0x1afe95['shift']());}};_0x3965df(++_0x305ef6);}(_0xcf2a,0x19d));var _0xacf2=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xcf2a[_0x4c440b];return _0x2d48cf;};'use strict';function Dynamics365Account(_0x17e7be){this['id']=_0x17e7be['id']||0x0;this[_0xacf2('0x0')]=_0x17e7be[_0xacf2('0x0')]||'';this[_0xacf2('0x1')]=_0x17e7be[_0xacf2('0x1')]||'';this['password']=_0x17e7be[_0xacf2('0x2')]||'';this[_0xacf2('0x3')]=_0x17e7be[_0xacf2('0x3')]||'';this[_0xacf2('0x4')]=_0x17e7be[_0xacf2('0x4')]||'';this[_0xacf2('0x5')]=_0x17e7be['clientId']||'';this[_0xacf2('0x6')]=_0x17e7be[_0xacf2('0x6')]||{};this['serverUrl']=_0x17e7be[_0xacf2('0x7')]||'';this[_0xacf2('0x8')]=_0x17e7be['modernAuthentication']||![];this[_0xacf2('0x9')]=_0x17e7be[_0xacf2('0x9')]||{};this[_0xacf2('0xa')]=_0x17e7be['CloudProvider']||{};}module[_0xacf2('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 4dd9b07..dc52316 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 _0x49eb=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x49eb,0x12d));var _0xb49e=function(_0x38c1b7,_0x241a62){_0x38c1b7=_0x38c1b7-0x0;var _0x5c209=_0x49eb[_0x38c1b7];return _0x5c209;};'use strict';function FaxAccount(_0xc14a8){this['id']=_0xc14a8['id']||0x0;this[_0xb49e('0x0')]=_0xc14a8[_0xb49e('0x0')]||'';this['description']=_0xc14a8[_0xb49e('0x1')];this[_0xb49e('0x2')]=_0xc14a8[_0xb49e('0x2')];this[_0xb49e('0x3')]=_0xc14a8[_0xb49e('0x3')];this[_0xb49e('0x4')]=_0xc14a8[_0xb49e('0x4')];this[_0xb49e('0x5')]=_0xc14a8[_0xb49e('0x5')]||0x960;this[_0xb49e('0x6')]=_0xc14a8[_0xb49e('0x6')]||0x3840;this['modem']=_0xc14a8[_0xb49e('0x7')]||_0xb49e('0x8');this['gateway']=_0xc14a8['gateway']||'no';this['faxdetect']=_0xc14a8['faxdetect']||'no';this[_0xb49e('0x9')]=_0xc14a8[_0xb49e('0x9')]||0x1388;this['tech']=_0xc14a8[_0xb49e('0xa')]||_0xb49e('0xb');this[_0xb49e('0xc')]=_0xc14a8[_0xb49e('0xc')]?_0xc14a8['Trunk']:undefined;this['ListId']=_0xc14a8[_0xb49e('0xd')];this[_0xb49e('0xe')]=_0xc14a8[_0xb49e('0xe')];}module[_0xb49e('0xf')]=FaxAccount; \ No newline at end of file +var _0x42cd=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x257a0,_0x42d2b4){var _0x8a44ed=function(_0x51b193){while(--_0x51b193){_0x257a0['push'](_0x257a0['shift']());}};_0x8a44ed(++_0x42d2b4);}(_0x42cd,0x86));var _0xd42c=function(_0x5b2096,_0x213141){_0x5b2096=_0x5b2096-0x0;var _0x198357=_0x42cd[_0x5b2096];return _0x198357;};'use strict';function FaxAccount(_0x199dc2){this['id']=_0x199dc2['id']||0x0;this[_0xd42c('0x0')]=_0x199dc2[_0xd42c('0x0')]||'';this['description']=_0x199dc2[_0xd42c('0x1')];this[_0xd42c('0x2')]=_0x199dc2[_0xd42c('0x2')];this[_0xd42c('0x3')]=_0x199dc2[_0xd42c('0x3')];this[_0xd42c('0x4')]=_0x199dc2['localstationid'];this['minrate']=_0x199dc2[_0xd42c('0x5')]||0x960;this[_0xd42c('0x6')]=_0x199dc2['maxrate']||0x3840;this[_0xd42c('0x7')]=_0x199dc2[_0xd42c('0x7')]||_0xd42c('0x8');this[_0xd42c('0x9')]=_0x199dc2['gateway']||'no';this[_0xd42c('0xa')]=_0x199dc2[_0xd42c('0xa')]||'no';this[_0xd42c('0xb')]=_0x199dc2['t38timeout']||0x1388;this['tech']=_0x199dc2[_0xd42c('0xc')]||_0xd42c('0xd');this['Trunk']=_0x199dc2[_0xd42c('0xe')]?_0x199dc2[_0xd42c('0xe')]:undefined;this[_0xd42c('0xf')]=_0x199dc2[_0xd42c('0xf')];this[_0xd42c('0x10')]=_0x199dc2['key'];}module[_0xd42c('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d7c1eeb..32da6af 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 _0x1710=['exports','apiKey','token','remoteUri','serverUrl'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x1710,0x146));var _0x0171=function(_0x400d9c,_0xcd0934){_0x400d9c=_0x400d9c-0x0;var _0x266439=_0x1710[_0x400d9c];return _0x266439;};'use strict';function FreshdeskAccount(_0x53d918){this['id']=_0x53d918['id']||0x0;this['name']=_0x53d918['name']||'';this['username']=_0x53d918['username']||'';this[_0x0171('0x0')]=_0x53d918[_0x0171('0x1')]||'';this[_0x0171('0x2')]=_0x53d918[_0x0171('0x2')]||'';this[_0x0171('0x3')]=_0x53d918[_0x0171('0x3')]||'';this['Configurations']=_0x53d918['Configurations']||{};}module[_0x0171('0x4')]=FreshdeskAccount; \ No newline at end of file +var _0x521d=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x23f1bc,_0x113ebd){var _0x4b0969=function(_0x9d37a9){while(--_0x9d37a9){_0x23f1bc['push'](_0x23f1bc['shift']());}};_0x4b0969(++_0x113ebd);}(_0x521d,0x141));var _0xd521=function(_0x4c1c01,_0xbd86f3){_0x4c1c01=_0x4c1c01-0x0;var _0x3e85fb=_0x521d[_0x4c1c01];return _0x3e85fb;};'use strict';function FreshdeskAccount(_0x3589a2){this['id']=_0x3589a2['id']||0x0;this[_0xd521('0x0')]=_0x3589a2['name']||'';this[_0xd521('0x1')]=_0x3589a2['username']||'';this[_0xd521('0x2')]=_0x3589a2[_0xd521('0x3')]||'';this['remoteUri']=_0x3589a2[_0xd521('0x4')]||'';this[_0xd521('0x5')]=_0x3589a2['serverUrl']||'';this[_0xd521('0x6')]=_0x3589a2[_0xd521('0x6')]||{};}module[_0xd521('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 7ba18e5..2fba66c 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 _0xf8bb=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x45b605,_0x5cd461){var _0x558864=function(_0x340bd8){while(--_0x340bd8){_0x45b605['push'](_0x45b605['shift']());}};_0x558864(++_0x5cd461);}(_0xf8bb,0x111));var _0xbf8b=function(_0x2f2c4f,_0x44f7da){_0x2f2c4f=_0x2f2c4f-0x0;var _0xb08109=_0xf8bb[_0x2f2c4f];return _0xb08109;};'use strict';function FreshsalesAccount(_0x34c21e){this['id']=_0x34c21e['id']||0x0;this[_0xbf8b('0x0')]=_0x34c21e[_0xbf8b('0x0')]||'';this['username']=_0x34c21e[_0xbf8b('0x1')]||'';this[_0xbf8b('0x2')]=_0x34c21e[_0xbf8b('0x3')]||'';this[_0xbf8b('0x4')]=_0x34c21e[_0xbf8b('0x4')]||'';this[_0xbf8b('0x5')]=_0x34c21e[_0xbf8b('0x5')]||'';this[_0xbf8b('0x6')]=_0x34c21e[_0xbf8b('0x6')]||{};}module[_0xbf8b('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x81d4=['exports','name','username','apiKey','token','serverUrl','Configurations'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x81d4,0x197));var _0x481d=function(_0x53e936,_0x34ada1){_0x53e936=_0x53e936-0x0;var _0x1e9ccf=_0x81d4[_0x53e936];return _0x1e9ccf;};'use strict';function FreshsalesAccount(_0x34d57f){this['id']=_0x34d57f['id']||0x0;this[_0x481d('0x0')]=_0x34d57f[_0x481d('0x0')]||'';this['username']=_0x34d57f[_0x481d('0x1')]||'';this[_0x481d('0x2')]=_0x34d57f[_0x481d('0x3')]||'';this['remoteUri']=_0x34d57f['remoteUri']||'';this[_0x481d('0x4')]=_0x34d57f[_0x481d('0x4')]||'';this[_0x481d('0x5')]=_0x34d57f['Configurations']||{};}module[_0x481d('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 285b81b..a801922 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 _0x7c3a=['priority','holdtime','assigned','motionChannel','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','position','count','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','exten'];(function(_0x32dcd0,_0x364dde){var _0x24e15b=function(_0x49349f){while(--_0x49349f){_0x32dcd0['push'](_0x32dcd0['shift']());}};_0x24e15b(++_0x364dde);}(_0x7c3a,0x1d4));var _0xa7c3=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x7c3a[_0x36f47c];return _0x296c55;};'use strict';function QueueReport(){this[_0xa7c3('0x0')]=_0xa7c3('0x1');this[_0xa7c3('0x2')]='';this[_0xa7c3('0x3')]='';this[_0xa7c3('0x4')]='';this['queue']='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xa7c3('0x5')]=0x1;this[_0xa7c3('0x6')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0xa7c3('0x7')]=null;this[_0xa7c3('0x8')]=![];this[_0xa7c3('0x9')]=null;this[_0xa7c3('0xa')]=0x1;this[_0xa7c3('0xb')]='';this['connectedlinenum']='';this[_0xa7c3('0xc')]='';this[_0xa7c3('0xd')]='';this[_0xa7c3('0xe')]='';this[_0xa7c3('0xf')]='';this[_0xa7c3('0x10')]='';this[_0xa7c3('0x11')]=0x0;this[_0xa7c3('0x12')]=![];this['lastAssignedTo']='';this[_0xa7c3('0x13')]='voice';this['routealias']=null;this['mohtime']=0x0;this[_0xa7c3('0x14')]={};}module[_0xa7c3('0x15')]=QueueReport; \ No newline at end of file +var _0x8393=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','motionChannel','routealias','mohtime','variables','exports','type','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete'];(function(_0x5bd626,_0xdbf46d){var _0x2661ca=function(_0x421ff4){while(--_0x421ff4){_0x5bd626['push'](_0x5bd626['shift']());}};_0x2661ca(++_0xdbf46d);}(_0x8393,0x1eb));var _0x3839=function(_0x447207,_0x1ade17){_0x447207=_0x447207-0x0;var _0x12a4ff=_0x8393[_0x447207];return _0x12a4ff;};'use strict';function QueueReport(){this[_0x3839('0x0')]='inbound';this['uniqueid']='';this[_0x3839('0x1')]='';this[_0x3839('0x2')]='';this[_0x3839('0x3')]='';this['queuecallerjoinAt']=null;this[_0x3839('0x4')]=null;this[_0x3839('0x5')]=0x1;this[_0x3839('0x6')]=0x1;this[_0x3839('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x3839('0x8')]=![];this[_0x3839('0x9')]=null;this[_0x3839('0xa')]=![];this[_0x3839('0xb')]=null;this[_0x3839('0xc')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x3839('0xd')]='';this[_0x3839('0xe')]='';this[_0x3839('0xf')]='';this[_0x3839('0x10')]='';this[_0x3839('0x11')]='';this['holdtime']=0x0;this[_0x3839('0x12')]=![];this[_0x3839('0x13')]='';this[_0x3839('0x14')]='voice';this[_0x3839('0x15')]=null;this[_0x3839('0x16')]=0x0;this[_0x3839('0x17')]={};}module[_0x3839('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8eece40..57d4745 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 _0xdc73=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','type','serverUrl'];(function(_0xfb39cc,_0x5df50f){var _0x484077=function(_0x420ab4){while(--_0x420ab4){_0xfb39cc['push'](_0xfb39cc['shift']());}};_0x484077(++_0x5df50f);}(_0xdc73,0x19c));var _0x3dc7=function(_0x404be6,_0x427b86){_0x404be6=_0x404be6-0x0;var _0x5ed4ba=_0xdc73[_0x404be6];return _0x5ed4ba;};'use strict';function SalesforceAccount(_0x4d1100){this['id']=_0x4d1100['id']||0x0;this[_0x3dc7('0x0')]=_0x4d1100[_0x3dc7('0x0')]||'';this[_0x3dc7('0x1')]=_0x4d1100[_0x3dc7('0x1')]||'';this[_0x3dc7('0x2')]=_0x4d1100[_0x3dc7('0x2')]||'';this[_0x3dc7('0x3')]=_0x4d1100['password']||'';this[_0x3dc7('0x4')]=_0x4d1100['clientId']||'';this[_0x3dc7('0x5')]=_0x4d1100[_0x3dc7('0x5')]||'';this['securityToken']=_0x4d1100['securityToken']||'';this['type']=_0x4d1100[_0x3dc7('0x6')]||'integrationTab';this[_0x3dc7('0x7')]=_0x4d1100[_0x3dc7('0x7')]||'';this[_0x3dc7('0x8')]=_0x4d1100['Configurations']||{};}module[_0x3dc7('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x1b0e=['remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username'];(function(_0x5490d2,_0x3a67de){var _0x47302e=function(_0x1c8f46){while(--_0x1c8f46){_0x5490d2['push'](_0x5490d2['shift']());}};_0x47302e(++_0x3a67de);}(_0x1b0e,0x132));var _0xe1b0=function(_0x50dd48,_0x4f3011){_0x50dd48=_0x50dd48-0x0;var _0x33dfca=_0x1b0e[_0x50dd48];return _0x33dfca;};'use strict';function SalesforceAccount(_0x5dd1a3){this['id']=_0x5dd1a3['id']||0x0;this[_0xe1b0('0x0')]=_0x5dd1a3[_0xe1b0('0x0')]||'';this[_0xe1b0('0x1')]=_0x5dd1a3[_0xe1b0('0x1')]||'';this[_0xe1b0('0x2')]=_0x5dd1a3['remoteUri']||'';this['password']=_0x5dd1a3[_0xe1b0('0x3')]||'';this[_0xe1b0('0x4')]=_0x5dd1a3['clientId']||'';this[_0xe1b0('0x5')]=_0x5dd1a3[_0xe1b0('0x5')]||'';this[_0xe1b0('0x6')]=_0x5dd1a3['securityToken']||'';this[_0xe1b0('0x7')]=_0x5dd1a3[_0xe1b0('0x7')]||'integrationTab';this[_0xe1b0('0x8')]=_0x5dd1a3[_0xe1b0('0x8')]||'';this[_0xe1b0('0x9')]=_0x5dd1a3[_0xe1b0('0x9')]||{};}module[_0xe1b0('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 120dd20..7ad55f6 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 _0xfd50=['Configurations','exports','username','password','remoteUri'];(function(_0x36d485,_0xca0ab4){var _0x3735d3=function(_0x21bcfd){while(--_0x21bcfd){_0x36d485['push'](_0x36d485['shift']());}};_0x3735d3(++_0xca0ab4);}(_0xfd50,0xc0));var _0x0fd5=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0xfd50[_0x3ec1da];return _0x472358;};'use strict';function ServicenowAccount(_0x12cade){this['id']=_0x12cade['id']||0x0;this['name']=_0x12cade['name']||'';this['username']=_0x12cade[_0x0fd5('0x0')]||'';this['password']=_0x12cade[_0x0fd5('0x1')]||'';this[_0x0fd5('0x2')]=_0x12cade['remoteUri']||'';this['serverUrl']=_0x12cade['serverUrl']||'';this[_0x0fd5('0x3')]=_0x12cade[_0x0fd5('0x3')]||{};}module[_0x0fd5('0x4')]=ServicenowAccount; \ No newline at end of file +var _0xaa96=['serverUrl','Configurations','username','password','remoteUri'];(function(_0x339abf,_0x202c46){var _0x3122a2=function(_0x3913b3){while(--_0x3913b3){_0x339abf['push'](_0x339abf['shift']());}};_0x3122a2(++_0x202c46);}(_0xaa96,0xc0));var _0x6aa9=function(_0x2edd23,_0x6e1f74){_0x2edd23=_0x2edd23-0x0;var _0x3fcd66=_0xaa96[_0x2edd23];return _0x3fcd66;};'use strict';function ServicenowAccount(_0x32a4ba){this['id']=_0x32a4ba['id']||0x0;this['name']=_0x32a4ba['name']||'';this['username']=_0x32a4ba[_0x6aa9('0x0')]||'';this[_0x6aa9('0x1')]=_0x32a4ba[_0x6aa9('0x1')]||'';this['remoteUri']=_0x32a4ba[_0x6aa9('0x2')]||'';this[_0x6aa9('0x3')]=_0x32a4ba[_0x6aa9('0x3')]||'';this[_0x6aa9('0x4')]=_0x32a4ba[_0x6aa9('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 08cf101..4f5e590 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 _0x706e=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x506168,_0x384fe6){var _0x102156=function(_0xad6abc){while(--_0xad6abc){_0x506168['push'](_0x506168['shift']());}};_0x102156(++_0x384fe6);}(_0x706e,0x15f));var _0xe706=function(_0x56d763,_0x520fe8){_0x56d763=_0x56d763-0x0;var _0x120d83=_0x706e[_0x56d763];return _0x120d83;};'use strict';function SugarcrmAccount(_0x3172c4){this['id']=_0x3172c4['id']||0x0;this[_0xe706('0x0')]=_0x3172c4[_0xe706('0x0')]||'';this['username']=_0x3172c4[_0xe706('0x1')]||'';this[_0xe706('0x2')]=_0x3172c4[_0xe706('0x2')]||'';this['remoteUri']=_0x3172c4[_0xe706('0x3')]||'';this['serverUrl']=_0x3172c4[_0xe706('0x4')]||'';this[_0xe706('0x5')]=_0x3172c4['Configurations']||{};}module[_0xe706('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x2056=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2056,0x107));var _0x6205=function(_0x32f3d0,_0x18caa6){_0x32f3d0=_0x32f3d0-0x0;var _0x3cfb65=_0x2056[_0x32f3d0];return _0x3cfb65;};'use strict';function SugarcrmAccount(_0x2dcf14){this['id']=_0x2dcf14['id']||0x0;this['name']=_0x2dcf14[_0x6205('0x0')]||'';this[_0x6205('0x1')]=_0x2dcf14[_0x6205('0x1')]||'';this[_0x6205('0x2')]=_0x2dcf14[_0x6205('0x2')]||'';this[_0x6205('0x3')]=_0x2dcf14[_0x6205('0x3')]||'';this[_0x6205('0x4')]=_0x2dcf14[_0x6205('0x4')]||'';this['Configurations']=_0x2dcf14[_0x6205('0x5')]||{};}module[_0x6205('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 3323a2e..9d060cb 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 _0xc1aa=['stateTime','name','accountcode','unknown'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc1aa,0xa9));var _0xac1a=function(_0x2bc062,_0x2e55e1){_0x2bc062=_0x2bc062-0x0;var _0xc4faf=_0xc1aa[_0x2bc062];return _0xc4faf;};'use strict';function Telephone(_0x1f1c82){this['id']=_0x1f1c82['id']||0x0;this['name']=_0x1f1c82[_0xac1a('0x0')]||'';this[_0xac1a('0x1')]=_0x1f1c82[_0xac1a('0x1')]||'';this['state']=_0xac1a('0x2');this[_0xac1a('0x3')]=0x0;this['status']=_0xac1a('0x2');this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xe260=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xe260,0xb0));var _0x0e26=function(_0x2a779e,_0x48217f){_0x2a779e=_0x2a779e-0x0;var _0x385c5c=_0xe260[_0x2a779e];return _0x385c5c;};'use strict';function Telephone(_0x3fb835){this['id']=_0x3fb835['id']||0x0;this[_0x0e26('0x0')]=_0x3fb835[_0x0e26('0x0')]||'';this[_0x0e26('0x1')]=_0x3fb835['accountcode']||'';this[_0x0e26('0x2')]=_0x0e26('0x3');this[_0x0e26('0x4')]=0x0;this[_0x0e26('0x5')]=_0x0e26('0x3');this[_0x0e26('0x6')]='';}module[_0x0e26('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a4c0daa..85b234a 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x1263c4,_0x383274){var _0x4f2514=function(_0x376363){while(--_0x376363){_0x1263c4['push'](_0x1263c4['shift']());}};_0x4f2514(++_0x383274);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e7844,_0x30ce77){_0x4e7844=_0x4e7844-0x0;var _0x336119=_0xb10b[_0x4e7844];return _0x336119;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x42a0bc,_0x51c3f7){var _0x41b2a7=function(_0x76b480){while(--_0x76b480){_0x42a0bc['push'](_0x42a0bc['shift']());}};_0x41b2a7(++_0x51c3f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 e39c72d..a24bd24 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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0xa90b58,_0xe8508e){var _0x40913d=function(_0x2b0cdb){while(--_0x2b0cdb){_0xa90b58['push'](_0xa90b58['shift']());}};_0x40913d(++_0xe8508e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2e3a0c,_0x147a04){_0x2e3a0c=_0x2e3a0c-0x0;var _0x3749ca=_0x9ffd[_0x2e3a0c];return _0x3749ca;};'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 +var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x45fcbd,_0x5bd24e){var _0x5ec028=function(_0x27d132){while(--_0x27d132){_0x45fcbd['push'](_0x45fcbd['shift']());}};_0x5ec028(++_0x5bd24e);}(_0x4fc2,0x111));var _0x24fc=function(_0x48d99d,_0x1e297b){_0x48d99d=_0x48d99d-0x0;var _0x18b0a6=_0x4fc2[_0x48d99d];return _0x18b0a6;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index f917427..e2dc138 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 _0xa5e5=['unknown','stateTime','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name'];(function(_0x30a866,_0x52713e){var _0x38e926=function(_0x4059b2){while(--_0x4059b2){_0x30a866['push'](_0x30a866['shift']());}};_0x38e926(++_0x52713e);}(_0xa5e5,0x184));var _0x5a5e=function(_0x24f9d9,_0x6b4d81){_0x24f9d9=_0x24f9d9-0x0;var _0x392b6c=_0xa5e5[_0x24f9d9];return _0x392b6c;};'use strict';function Trunk(_0xae09fe){this['id']=_0xae09fe['id']||0x0;this[_0x5a5e('0x0')]=_0xae09fe[_0x5a5e('0x0')]||![];this[_0x5a5e('0x1')]=_0xae09fe['name']||'';this['state']=_0x5a5e('0x2');this[_0x5a5e('0x3')]=0x0;this['status']='unknown';this[_0x5a5e('0x4')]=_0xae09fe[_0x5a5e('0x4')]&&_0xae09fe[_0x5a5e('0x4')][_0x5a5e('0x5')](':')?_0xae09fe['registry'][_0x5a5e('0x6')](':')[0x0]:'';this['host']='';this[_0x5a5e('0x7')]='';this[_0x5a5e('0x8')]='';this[_0x5a5e('0x9')]='';this[_0x5a5e('0xa')]='';this[_0x5a5e('0xb')]=_0x5a5e('0x2');this[_0x5a5e('0xc')]='';this['address']='';this[_0x5a5e('0xd')]=_0xae09fe['defaultuser']||'';}module[_0x5a5e('0xe')]=Trunk; \ No newline at end of file +var _0x927c=['host','domain','refresh','registrationtime','address','defaultuser','exports','active','name','state','stateTime','status','unknown','registry','indexOf'];(function(_0x4144a0,_0x3c0614){var _0x3ab017=function(_0x5cd106){while(--_0x5cd106){_0x4144a0['push'](_0x4144a0['shift']());}};_0x3ab017(++_0x3c0614);}(_0x927c,0x115));var _0xc927=function(_0x2516a6,_0x13178d){_0x2516a6=_0x2516a6-0x0;var _0x1bccf6=_0x927c[_0x2516a6];return _0x1bccf6;};'use strict';function Trunk(_0x26bf6e){this['id']=_0x26bf6e['id']||0x0;this['active']=_0x26bf6e[_0xc927('0x0')]||![];this[_0xc927('0x1')]=_0x26bf6e[_0xc927('0x1')]||'';this[_0xc927('0x2')]='unknown';this[_0xc927('0x3')]=0x0;this[_0xc927('0x4')]=_0xc927('0x5');this['registry']=_0x26bf6e[_0xc927('0x6')]&&_0x26bf6e['registry'][_0xc927('0x7')](':')?_0x26bf6e[_0xc927('0x6')]['split'](':')[0x0]:'';this[_0xc927('0x8')]='';this['port']='';this[_0xc927('0x9')]='';this['domainport']='';this[_0xc927('0xa')]='';this['stateRegistry']=_0xc927('0x5');this[_0xc927('0xb')]='';this[_0xc927('0xc')]='';this[_0xc927('0xd')]=_0x26bf6e[_0xc927('0xd')]||'';}module[_0xc927('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index b128754..6401b1a 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 _0xa791=['mandatoryDisposition','exports','exten'];(function(_0x33e59c,_0x3dfc9d){var _0x41d5b4=function(_0x24e742){while(--_0x24e742){_0x33e59c['push'](_0x33e59c['shift']());}};_0x41d5b4(++_0x3dfc9d);}(_0xa791,0x1c7));var _0x1a79=function(_0x4bb351,_0x52d469){_0x4bb351=_0x4bb351-0x0;var _0x57c0ee=_0xa791[_0x4bb351];return _0x57c0ee;};'use strict';function voiceExtension(_0x39b03f){this['id']=_0x39b03f['id']||0x0;this[_0x1a79('0x0')]=_0x39b03f[_0x1a79('0x0')]||'';this['recordingFormat']=_0x39b03f['recordingFormat']||'none';this[_0x1a79('0x1')]=_0x39b03f['mandatoryDisposition']||![];}module[_0x1a79('0x2')]=voiceExtension; \ No newline at end of file +var _0x9005=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x31079b,_0x4b3786){var _0x3ab7aa=function(_0x238d5e){while(--_0x238d5e){_0x31079b['push'](_0x31079b['shift']());}};_0x3ab7aa(++_0x4b3786);}(_0x9005,0xf8));var _0x5900=function(_0xf47bc8,_0x26ff25){_0xf47bc8=_0xf47bc8-0x0;var _0x11a792=_0x9005[_0xf47bc8];return _0x11a792;};'use strict';function voiceExtension(_0x6b509b){this['id']=_0x6b509b['id']||0x0;this[_0x5900('0x0')]=_0x6b509b[_0x5900('0x0')]||'';this[_0x5900('0x1')]=_0x6b509b[_0x5900('0x1')]||_0x5900('0x2');this['mandatoryDisposition']=_0x6b509b[_0x5900('0x3')]||![];}module[_0x5900('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 1416d66..848b41e 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 _0x97f3=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','sumHoldTime','abandoned','available','notInUse','paused','ringing','ringInUse','unavailable','unknown','acw','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x97f3,0xb4));var _0x397f=function(_0x4ca75d,_0x3b69bd){_0x4ca75d=_0x4ca75d-0x0;var _0x150c1d=_0x97f3[_0x4ca75d];return _0x150c1d;};'use strict';var monitorFormat={'wav':_0x397f('0x0'),'wav49':_0x397f('0x1'),'gsm':_0x397f('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x397f('0x3'),'linear':_0x397f('0x4'),'random':_0x397f('0x5'),'ringall':_0x397f('0x6'),'rr':_0x397f('0x7'),'rrmemory':_0x397f('0x8'),'rrordered':_0x397f('0x9'),'wrandom':_0x397f('0xa')};function VoiceQueue(_0x5146e2){this['id']=_0x5146e2['id']||0x0;this[_0x397f('0xb')]=_0x5146e2['name']||'';this[_0x397f('0xc')]=_0x5146e2[_0x397f('0xc')]||'';this['type']=_0x5146e2[_0x397f('0xd')]||_0x397f('0xe');this[_0x397f('0xf')]=0x0;this['total']=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x397f('0x10')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x397f('0x11')]=0x0;this[_0x397f('0x12')]=0x0;this['busy']=0x0;this['inUse']=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this[_0x397f('0x13')]=0x0;this['onHold']=0x0;this[_0x397f('0x14')]=0x0;this[_0x397f('0x15')]=0x0;this[_0x397f('0x16')]=0x0;this['talking']=0x0;this[_0x397f('0x17')]=0x0;this[_0x397f('0x18')]=0x0;this[_0x397f('0x19')]=_0x5146e2[_0x397f('0x19')]||![];this['acwTimeout']=_0x5146e2['acwTimeout']||0xa;this[_0x397f('0x1a')]=_0x5146e2['autopause']||'no';this[_0x397f('0x1b')]=!![];this[_0x397f('0x1c')]='';this[_0x397f('0x1d')]='';this[_0x397f('0x1e')]=0x0;this[_0x397f('0x1f')]=0x0;this[_0x397f('0x20')]=_0x5146e2[_0x397f('0x20')]||null;this[_0x397f('0x21')]=_0x5146e2[_0x397f('0x21')]?_0x5146e2['dialGlobalInterval']:null;this[_0x397f('0x22')]=_0x5146e2['dialActive'];this[_0x397f('0x23')]=_0x5146e2[_0x397f('0x23')]||'progressive';this['dialLimitChannel']=_0x5146e2[_0x397f('0x24')]||0x0;this[_0x397f('0x25')]=_0x5146e2[_0x397f('0x25')]||0x0;this[_0x397f('0x26')]=_0x5146e2[_0x397f('0x26')]||0x1;this[_0x397f('0x27')]=_0x5146e2[_0x397f('0x27')]||'dropRate';this[_0x397f('0x28')]=_0x5146e2['dialPredictiveOptimizationPercentage']||0.03;this[_0x397f('0x29')]=_0x5146e2[_0x397f('0x29')]||0x258;this[_0x397f('0x2a')]=_0x5146e2[_0x397f('0x2a')]||_0x397f('0x2b');this[_0x397f('0x2c')]=_0x5146e2['dialOriginateCallerIdNumber']||_0x397f('0x2b');this[_0x397f('0x2d')]=_0x5146e2['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x5146e2[_0x397f('0x2e')]||_0x397f('0x2f');this[_0x397f('0x30')]=_0x5146e2[_0x397f('0x30')]||0x3;this['dialQueueProject']=_0x5146e2[_0x397f('0x31')]||undefined;this[_0x397f('0x32')]=_0x5146e2[_0x397f('0x32')]||0x3;this[_0x397f('0x33')]=_0x5146e2[_0x397f('0x33')]||0x96;this[_0x397f('0x34')]=_0x5146e2[_0x397f('0x34')]||0x3;this[_0x397f('0x35')]=_0x5146e2[_0x397f('0x35')]||0x96;this[_0x397f('0x36')]=_0x5146e2[_0x397f('0x36')]||0x3;this[_0x397f('0x37')]=_0x5146e2[_0x397f('0x37')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x5146e2[_0x397f('0x38')]||0x3;this[_0x397f('0x39')]=_0x5146e2[_0x397f('0x39')]||0x96;this[_0x397f('0x3a')]=_0x5146e2[_0x397f('0x3a')]||0x3;this[_0x397f('0x3b')]=_0x5146e2['dialDropRetryFrequency']||0x96;this[_0x397f('0x3c')]=_0x5146e2[_0x397f('0x3c')]||0x3;this[_0x397f('0x3d')]=_0x5146e2['dialAbandonedRetryFrequency']||0x96;this[_0x397f('0x3e')]=_0x5146e2[_0x397f('0x3e')]||0x3;this[_0x397f('0x3f')]=_0x5146e2[_0x397f('0x3f')]||0x96;this['dialAgentRejectMaxRetry']=_0x5146e2[_0x397f('0x40')]||0x3;this[_0x397f('0x41')]=_0x5146e2[_0x397f('0x41')]||0x96;this[_0x397f('0x42')]=_0x5146e2[_0x397f('0x42')]||0x3;this[_0x397f('0x43')]=_0x5146e2[_0x397f('0x43')]||0x4;this['Trunk']=_0x5146e2['Trunk']?_0x5146e2[_0x397f('0x44')]:undefined;this['TrunkBackup']=_0x5146e2['TrunkBackup']?_0x5146e2['TrunkBackup']:undefined;this[_0x397f('0x45')]=_0x5146e2['dialPrefix']||undefined;this[_0x397f('0x46')]=_0x5146e2['Interval']?_0x5146e2[_0x397f('0x46')]:undefined;this[_0x397f('0x47')]=_0x5146e2[_0x397f('0x47')]||'DESC';this[_0x397f('0x48')]=_0x5146e2[_0x397f('0x48')]||undefined;this[_0x397f('0x49')]=_0x5146e2[_0x397f('0x49')]||undefined;this['strategy']=strategy[_0x5146e2[_0x397f('0x4a')]];this[_0x397f('0x4b')]=!![];this[_0x397f('0x4c')]=_0x5146e2['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x5146e2[_0x397f('0x4d')];this['dialAMDGreeting']=_0x5146e2['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x5146e2[_0x397f('0x4e')];this[_0x397f('0x4f')]=_0x5146e2['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x5146e2['dialAMDMinWordLength'];this[_0x397f('0x50')]=_0x5146e2[_0x397f('0x50')];this[_0x397f('0x51')]=_0x5146e2[_0x397f('0x51')];this[_0x397f('0x52')]=_0x5146e2[_0x397f('0x52')];this[_0x397f('0x53')]=_0x5146e2[_0x397f('0x53')];this[_0x397f('0x54')]=0x0;this[_0x397f('0x55')]=0x0;this[_0x397f('0x56')]=_0x5146e2[_0x397f('0x56')];this[_0x397f('0x57')]=0x0;this[_0x397f('0x58')]=0x0;this[_0x397f('0x59')]=0x0;this[_0x397f('0x5a')]=0x0;this[_0x397f('0x5b')]=0x0;this[_0x397f('0x5c')]=0x0;this[_0x397f('0x5d')]=0x0;this[_0x397f('0x5e')]=0x0;this[_0x397f('0x5f')]=0x0;this[_0x397f('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x397f('0x61')]=0x0;this[_0x397f('0x62')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x397f('0x63')]=undefined;this[_0x397f('0x64')]=undefined;this[_0x397f('0x65')]=undefined;this[_0x397f('0x66')]=1.05;this[_0x397f('0x67')]=0x0;this[_0x397f('0x68')]=0x0;this[_0x397f('0x69')]=0x0;this[_0x397f('0x6a')]=0x0;this[_0x397f('0x6b')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x397f('0x6c')]=0x0;this[_0x397f('0x6d')]=0x0;this[_0x397f('0x6e')]=_0x5146e2[_0x397f('0x6f')]||0x14;this[_0x397f('0x70')]=_0x5146e2[_0x397f('0x6f')]||0xa;this[_0x397f('0x71')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x397f('0x72')]=0x1;this[_0x397f('0x73')]=0x0;this[_0x397f('0x74')]=0x0;this[_0x397f('0x75')]=0x0;this[_0x397f('0x76')]=0x0;this[_0x397f('0x77')]=_0x5146e2[_0x397f('0x77')]||0x1e;this[_0x397f('0x78')]=_0x5146e2[_0x397f('0x78')]||![];this[_0x397f('0x79')]=!!_0x5146e2[_0x397f('0x79')]||![];this[_0x397f('0x7a')]=!!_0x5146e2[_0x397f('0x7a')]||![];this[_0x397f('0x7b')]=_0x5146e2[_0x397f('0x7b')]||undefined;this[_0x397f('0x7c')]=_0x5146e2[_0x397f('0x7c')]||![];this[_0x397f('0x7d')]=_0x5146e2[_0x397f('0x7d')]||![];this['monitor_format']=monitorFormat[_0x5146e2[_0x397f('0xc')]]?monitorFormat[_0x5146e2['monitor_format']]:undefined;this[_0x397f('0x7e')]=_0x5146e2[_0x397f('0x7e')]||![];this['mandatoryDispositionPause']=_0x5146e2[_0x397f('0x7f')]?_0x5146e2[_0x397f('0x7f')]:undefined;this[_0x397f('0x80')]=![];}module[_0x397f('0x81')]=VoiceQueue; \ No newline at end of file +var _0x8c72=['dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','leastrecent','random','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','unmanaged','abandoned','available','busy','inUse','invalid','notInUse','onHold','paused','ringing','ringInUse','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialGlobalInterval','dialActive'];(function(_0x4c253b,_0x2ef014){var _0x582939=function(_0x4dae0d){while(--_0x4dae0d){_0x4c253b['push'](_0x4c253b['shift']());}};_0x582939(++_0x2ef014);}(_0x8c72,0x14f));var _0x28c7=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x8c72[_0x5a95fa];return _0x1a61b8;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x28c7('0x0'),'gsm':_0x28c7('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x28c7('0x2'),'linear':'linear','random':_0x28c7('0x3'),'ringall':'ringall','rr':'roundrobin','rrmemory':_0x28c7('0x4'),'rrordered':'rrordered','wrandom':_0x28c7('0x5')};function VoiceQueue(_0x4161ae){this['id']=_0x4161ae['id']||0x0;this[_0x28c7('0x6')]=_0x4161ae[_0x28c7('0x6')]||'';this[_0x28c7('0x7')]=_0x4161ae['monitor_format']||'';this[_0x28c7('0x8')]=_0x4161ae['type']||_0x28c7('0x9');this[_0x28c7('0xa')]=0x0;this[_0x28c7('0xb')]=0x0;this[_0x28c7('0xc')]=0x0;this[_0x28c7('0xd')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x28c7('0xe')]=0x0;this[_0x28c7('0xf')]=0x0;this[_0x28c7('0x10')]=0x0;this[_0x28c7('0x11')]=0x0;this[_0x28c7('0x12')]=0x0;this[_0x28c7('0x13')]=0x0;this['loggedIn']=0x0;this[_0x28c7('0x14')]=0x0;this[_0x28c7('0x15')]=0x0;this[_0x28c7('0x16')]=0x0;this[_0x28c7('0x17')]=0x0;this[_0x28c7('0x18')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this[_0x28c7('0x19')]=0x0;this[_0x28c7('0x1a')]=_0x4161ae[_0x28c7('0x1a')]||![];this['acwTimeout']=_0x4161ae[_0x28c7('0x1b')]||0xa;this[_0x28c7('0x1c')]=_0x4161ae[_0x28c7('0x1c')]||'no';this[_0x28c7('0x1d')]=!![];this[_0x28c7('0x1e')]='';this['statusMessage']='';this[_0x28c7('0x1f')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x4161ae['dialTimezone']||null;this[_0x28c7('0x20')]=_0x4161ae['dialGlobalInterval']?_0x4161ae[_0x28c7('0x20')]:null;this[_0x28c7('0x21')]=_0x4161ae[_0x28c7('0x21')];this[_0x28c7('0x22')]=_0x4161ae[_0x28c7('0x22')]||'progressive';this['dialLimitChannel']=_0x4161ae[_0x28c7('0x23')]||0x0;this['dialLimitQueue']=_0x4161ae['dialLimitQueue']||0x0;this[_0x28c7('0x24')]=_0x4161ae[_0x28c7('0x24')]||0x1;this[_0x28c7('0x25')]=_0x4161ae[_0x28c7('0x25')]||_0x28c7('0x26');this[_0x28c7('0x27')]=_0x4161ae[_0x28c7('0x27')]||0.03;this[_0x28c7('0x28')]=_0x4161ae[_0x28c7('0x28')]||0x258;this[_0x28c7('0x29')]=_0x4161ae['dialOriginateCallerIdName']||_0x28c7('0x2a');this['dialOriginateCallerIdNumber']=_0x4161ae[_0x28c7('0x2b')]||_0x28c7('0x2a');this[_0x28c7('0x2c')]=_0x4161ae['dialOriginateTimeout']||0x1e;this[_0x28c7('0x2d')]=_0x4161ae[_0x28c7('0x2d')]||_0x28c7('0x2e');this[_0x28c7('0x2f')]=_0x4161ae[_0x28c7('0x2f')]||0x3;this[_0x28c7('0x30')]=_0x4161ae[_0x28c7('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x4161ae[_0x28c7('0x31')]||0x3;this[_0x28c7('0x32')]=_0x4161ae[_0x28c7('0x32')]||0x96;this['dialBusyMaxRetry']=_0x4161ae[_0x28c7('0x33')]||0x3;this[_0x28c7('0x34')]=_0x4161ae[_0x28c7('0x34')]||0x96;this[_0x28c7('0x35')]=_0x4161ae[_0x28c7('0x35')]||0x3;this[_0x28c7('0x36')]=_0x4161ae[_0x28c7('0x36')]||0x96;this[_0x28c7('0x37')]=_0x4161ae['dialNoSuchNumberMaxRetry']||0x3;this[_0x28c7('0x38')]=_0x4161ae[_0x28c7('0x38')]||0x96;this[_0x28c7('0x39')]=_0x4161ae[_0x28c7('0x39')]||0x3;this[_0x28c7('0x3a')]=_0x4161ae['dialDropRetryFrequency']||0x96;this[_0x28c7('0x3b')]=_0x4161ae[_0x28c7('0x3b')]||0x3;this[_0x28c7('0x3c')]=_0x4161ae[_0x28c7('0x3c')]||0x96;this[_0x28c7('0x3d')]=_0x4161ae[_0x28c7('0x3d')]||0x3;this[_0x28c7('0x3e')]=_0x4161ae[_0x28c7('0x3e')]||0x96;this[_0x28c7('0x3f')]=_0x4161ae[_0x28c7('0x3f')]||0x3;this[_0x28c7('0x40')]=_0x4161ae['dialAgentRejectRetryFrequency']||0x96;this[_0x28c7('0x41')]=_0x4161ae[_0x28c7('0x41')]||0x3;this[_0x28c7('0x42')]=_0x4161ae[_0x28c7('0x42')]||0x4;this[_0x28c7('0x43')]=_0x4161ae[_0x28c7('0x43')]?_0x4161ae[_0x28c7('0x43')]:undefined;this[_0x28c7('0x44')]=_0x4161ae['TrunkBackup']?_0x4161ae['TrunkBackup']:undefined;this['dialPrefix']=_0x4161ae['dialPrefix']||undefined;this[_0x28c7('0x45')]=_0x4161ae[_0x28c7('0x45')]?_0x4161ae['Interval']:undefined;this['dialOrderByScheduledAt']=_0x4161ae[_0x28c7('0x46')]||_0x28c7('0x47');this[_0x28c7('0x48')]=_0x4161ae[_0x28c7('0x48')]||undefined;this['dialCutDigit']=_0x4161ae[_0x28c7('0x49')]||undefined;this[_0x28c7('0x4a')]=strategy[_0x4161ae[_0x28c7('0x4a')]];this['queueStatusComplete']=!![];this[_0x28c7('0x4b')]=_0x4161ae[_0x28c7('0x4b')]||![];this['dialAMDInitialSilence']=_0x4161ae[_0x28c7('0x4c')];this['dialAMDGreeting']=_0x4161ae['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x4161ae[_0x28c7('0x4d')];this[_0x28c7('0x4e')]=_0x4161ae['dialAMDTotalAnalysisTime'];this[_0x28c7('0x4f')]=_0x4161ae[_0x28c7('0x4f')];this['dialAMDBetweenWordsSilence']=_0x4161ae[_0x28c7('0x50')];this[_0x28c7('0x51')]=_0x4161ae['dialAMDMaximumNumberOfWords'];this[_0x28c7('0x52')]=_0x4161ae['dialAMDSilenceThreshold'];this[_0x28c7('0x53')]=_0x4161ae[_0x28c7('0x53')];this[_0x28c7('0x54')]=0x0;this[_0x28c7('0x55')]=0x0;this['timeout']=_0x4161ae['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x28c7('0x56')]=0x0;this[_0x28c7('0x57')]=0x0;this[_0x28c7('0x58')]=0x0;this[_0x28c7('0x59')]=0x0;this[_0x28c7('0x5a')]=0x0;this[_0x28c7('0x5b')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x28c7('0x5c')]=0x0;this[_0x28c7('0x5d')]=0x0;this[_0x28c7('0x5e')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x28c7('0x5f')]=undefined;this[_0x28c7('0x60')]=undefined;this['handlePredictive']=undefined;this[_0x28c7('0x61')]=1.05;this[_0x28c7('0x62')]=0x0;this[_0x28c7('0x63')]=0x0;this[_0x28c7('0x64')]=0x0;this[_0x28c7('0x65')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x28c7('0x66')]=0x0;this[_0x28c7('0x67')]=0x0;this[_0x28c7('0x68')]=0x0;this[_0x28c7('0x69')]=_0x4161ae['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x28c7('0x6a')]=_0x4161ae[_0x28c7('0x6b')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x28c7('0x6c')]=0x1;this[_0x28c7('0x6d')]=0x0;this[_0x28c7('0x6e')]=0x0;this[_0x28c7('0x6f')]=0x0;this['erlangBusyFactor']=0x0;this[_0x28c7('0x70')]=_0x4161ae[_0x28c7('0x70')]||0x1e;this[_0x28c7('0x71')]=_0x4161ae[_0x28c7('0x71')]||![];this[_0x28c7('0x72')]=!!_0x4161ae[_0x28c7('0x72')]||![];this[_0x28c7('0x73')]=!!_0x4161ae['dialPreviewRecallmeReminder']||![];this[_0x28c7('0x74')]=_0x4161ae[_0x28c7('0x74')]||undefined;this[_0x28c7('0x75')]=_0x4161ae['dialAgiAfterHangupClient']||![];this[_0x28c7('0x76')]=_0x4161ae['dialAgiAfterHangupAgent']||![];this[_0x28c7('0x7')]=monitorFormat[_0x4161ae[_0x28c7('0x7')]]?monitorFormat[_0x4161ae[_0x28c7('0x7')]]:undefined;this['mandatoryDisposition']=_0x4161ae[_0x28c7('0x77')]||![];this[_0x28c7('0x78')]=_0x4161ae[_0x28c7('0x78')]?_0x4161ae[_0x28c7('0x78')]:undefined;this[_0x28c7('0x79')]=![];}module[_0x28c7('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 3173d4a..ba5158d 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 _0xae53=['preview','exports','available','loggedInDb','paused','ringing','waiting','answered','inUse','loggedIn','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','talking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','unavailable','loggedin','callers','length','online','incall','includes','status','booked','keys','queue','dialer','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue'];(function(_0x542a4e,_0x23f7ef){var _0x11d75d=function(_0x12c1c7){while(--_0x12c1c7){_0x542a4e['push'](_0x542a4e['shift']());}};_0x11d75d(++_0x23f7ef);}(_0xae53,0x16e));var _0x3ae5=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xae53[_0x36ed48];return _0x51c63a;};'use strict';var INBOUND_COUNTERS=[_0x3ae5('0x0'),'loggedIn',_0x3ae5('0x1'),_0x3ae5('0x2'),_0x3ae5('0x3'),'talking',_0x3ae5('0x4')];var OUTBOUND_COUNTERS=[_0x3ae5('0x0'),_0x3ae5('0x5'),_0x3ae5('0x6'),_0x3ae5('0x7'),'loggedInDb',_0x3ae5('0x8'),'outboundAbandonedCallsDay',_0x3ae5('0x9'),_0x3ae5('0xa'),_0x3ae5('0xb'),_0x3ae5('0xc'),_0x3ae5('0xd'),_0x3ae5('0xe'),_0x3ae5('0xf'),_0x3ae5('0x10'),'outboundUnknownCallsDay',_0x3ae5('0x2'),'pTalking',_0x3ae5('0x11'),_0x3ae5('0x12'),_0x3ae5('0x13'),_0x3ae5('0x14'),_0x3ae5('0x4')];function VoiceQueueSummary(_0x531277){this['id']=_0x531277['id'];this[_0x3ae5('0x15')]=_0x531277[_0x3ae5('0x15')];this[_0x3ae5('0x16')]=_0x531277['strategy'];this['abandoned']=_0x531277[_0x3ae5('0x17')]||0x0;this['answered']=_0x531277[_0x3ae5('0x5')]||0x0;this[_0x3ae5('0x0')]=_0x531277[_0x3ae5('0x0')]||0x0;this[_0x3ae5('0x18')]=_0x531277[_0x3ae5('0x18')]||0x0;this['inUse']=_0x531277[_0x3ae5('0x6')]||0x0;this[_0x3ae5('0x19')]=_0x531277[_0x3ae5('0x19')]||0x0;this['loggedIn']=_0x531277['loggedIn']||0x0;this[_0x3ae5('0x1')]=_0x531277[_0x3ae5('0x1')]||0x0;this[_0x3ae5('0x1a')]=_0x531277[_0x3ae5('0x1a')]||0x0;this[_0x3ae5('0x1b')]=_0x531277[_0x3ae5('0x1b')]||0x0;this[_0x3ae5('0x2')]=_0x531277['paused']||0x0;this['ringing']=_0x531277['ringing']||0x0;this[_0x3ae5('0x1c')]=_0x531277[_0x3ae5('0x1c')];this[_0x3ae5('0x12')]=_0x531277[_0x3ae5('0x12')];this[_0x3ae5('0x13')]=_0x531277[_0x3ae5('0x13')];this[_0x3ae5('0x1d')]=_0x531277['sumHoldTime']||0x0;this[_0x3ae5('0x11')]=_0x531277[_0x3ae5('0x11')]||0x0;this[_0x3ae5('0x14')]=_0x531277[_0x3ae5('0x14')]||0x0;this[_0x3ae5('0x1e')]=_0x531277[_0x3ae5('0x1e')];this['unavailable']=_0x531277['unavailable']||0x0;this[_0x3ae5('0x1f')]=_0x531277[_0x3ae5('0x1f')]||0x0;this[_0x3ae5('0x20')]=_0x531277[_0x3ae5('0x20')]||0x0;this[_0x3ae5('0x4')]=_0x531277[_0x3ae5('0x4')]||0x0;if(_0x531277[_0x3ae5('0x1e')]===_0x3ae5('0x21')){this[_0x3ae5('0x22')]=_0x531277['pTalking']||0x0;this[_0x3ae5('0x23')]=_0x531277[_0x3ae5('0x23')];this[_0x3ae5('0x24')]=_0x531277['dialMethod'];this[_0x3ae5('0x25')]=_0x531277[_0x3ae5('0x25')];this[_0x3ae5('0x26')]=_0x531277[_0x3ae5('0x26')];this[_0x3ae5('0x27')]=_0x531277['dialOriginateTimeout'];this[_0x3ae5('0x28')]=_0x531277[_0x3ae5('0x28')];this[_0x3ae5('0x29')]=_0x531277[_0x3ae5('0x29')];this[_0x3ae5('0x2a')]=_0x531277[_0x3ae5('0x2a')];this[_0x3ae5('0x9')]=_0x531277['outboundAnswerCallsDay'];this[_0x3ae5('0xa')]=_0x531277[_0x3ae5('0xa')];this[_0x3ae5('0xb')]=_0x531277['outboundBusyCallsDay'];this[_0x3ae5('0xc')]=_0x531277[_0x3ae5('0xc')];this[_0x3ae5('0x2b')]=_0x531277[_0x3ae5('0x2b')];this[_0x3ae5('0x2c')]=_0x531277[_0x3ae5('0x2c')];this[_0x3ae5('0x2d')]=_0x531277[_0x3ae5('0x2d')];this['outboundNoAnswerCallsDay']=_0x531277[_0x3ae5('0xd')];this[_0x3ae5('0xe')]=_0x531277[_0x3ae5('0xe')];this['outboundOriginateFailureCallsDay']=_0x531277[_0x3ae5('0x2e')];this['outboundReCallsDay']=_0x531277['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x531277[_0x3ae5('0x10')];this[_0x3ae5('0x2f')]=_0x531277[_0x3ae5('0x2f')];this[_0x3ae5('0x30')]=_0x531277['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x531277[_0x3ae5('0x31')];this['predictiveIntervalAvgTalktime']=_0x531277[_0x3ae5('0x32')];this[_0x3ae5('0x33')]=_0x531277[_0x3ae5('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x531277[_0x3ae5('0x34')];this[_0x3ae5('0x35')]=_0x531277['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x531277[_0x3ae5('0x36')];this['predictiveIntervalHitRate']=_0x531277[_0x3ae5('0x37')];this[_0x3ae5('0x38')]=_0x531277[_0x3ae5('0x38')];this[_0x3ae5('0x39')]=_0x531277[_0x3ae5('0x39')];this[_0x3ae5('0x3a')]=_0x531277[_0x3ae5('0x3a')];this[_0x3ae5('0x3b')]=_0x531277['predictiveIntervalTotalCalls'];this[_0x3ae5('0x8')]=_0x531277['originated'];this[_0x3ae5('0x3c')]=_0x531277[_0x3ae5('0x3c')];this[_0x3ae5('0x3d')]=_0x531277[_0x3ae5('0x3d')];this[_0x3ae5('0x3e')]=_0x531277[_0x3ae5('0x3e')];this[_0x3ae5('0x3f')]=_0x531277['erlangBusyFactor'];this['startPredictive']=_0x531277[_0x3ae5('0x40')];this['startProgressive']=_0x531277[_0x3ae5('0x41')];this[_0x3ae5('0x42')]=_0x531277[_0x3ae5('0x42')];this[_0x3ae5('0x43')]=_0x531277['statusMessage'];}if(_0x531277[_0x3ae5('0x44')]){this[_0x3ae5('0x44')]={'id':_0x531277[_0x3ae5('0x44')]['id'],'name':_0x531277[_0x3ae5('0x44')][_0x3ae5('0x15')],'active':_0x531277[_0x3ae5('0x44')][_0x3ae5('0x45')],'callerid':_0x531277[_0x3ae5('0x44')][_0x3ae5('0x46')]};}}VoiceQueueSummary[_0x3ae5('0x47')][_0x3ae5('0x48')]=function(_0x47e103,_0x2e0bae,_0x234143,_0x1814fd){this[_0x3ae5('0x1')]=0x0;this[_0x3ae5('0x11')]=0x0;this[_0x3ae5('0x2')]=0x0;this['unknown']=0x0;this[_0x3ae5('0x1b')]=0x0;this[_0x3ae5('0x6')]=0x0;this['busy']=0x0;this[_0x3ae5('0x19')]=0x0;this[_0x3ae5('0x49')]=0x0;this['ringing']=0x0;this[_0x3ae5('0x1c')]=0x0;this[_0x3ae5('0x1a')]=0x0;if(_0x234143){if(_0x234143[_0x3ae5('0x0')]){this[_0x3ae5('0x0')]=Number(_0x234143[_0x3ae5('0x0')]);}if(_0x234143[_0x3ae5('0x4a')]){this['loggedIn']=Number(_0x234143['loggedin']);}if(_0x234143[_0x3ae5('0x4b')]){this[_0x3ae5('0x4')]=Number(_0x234143['callers']);}}for(var _0x134114=0x0;_0x134114<_0x47e103[_0x3ae5('0x4c')];_0x134114++){var _0x16ff7c=_0x2e0bae['SIP/'+_0x47e103[_0x134114][_0x3ae5('0x15')]];if(_0x16ff7c&&_0x16ff7c[_0x3ae5('0x4d')]){this[_0x3ae5('0x1')]+=0x1;}if(_0x47e103[_0x134114][_0x3ae5('0x4e')]==='1'){this['talking']+=0x1;}if(_0x47e103[_0x134114][_0x3ae5('0x2')]==='1'&&!['2','7','8'][_0x3ae5('0x4f')](_0x47e103[_0x134114][_0x3ae5('0x50')])){this[_0x3ae5('0x2')]+=0x1;}switch(_0x47e103[_0x134114]['status']){case'0':this[_0x3ae5('0x1f')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x3ae5('0x18')]+=0x1;break;case'4':this[_0x3ae5('0x19')]+=0x1;break;case'5':this[_0x3ae5('0x49')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x3ae5('0x1c')]+=0x1;break;case'8':this[_0x3ae5('0x1a')]+=0x1;break;}}if(this[_0x3ae5('0x24')]===_0x3ae5('0x51')){var _0x2b899c=Object[_0x3ae5('0x52')](_0x1814fd);for(var _0x304182=0x0;_0x304182<_0x2b899c[_0x3ae5('0x4c')];_0x304182++){var _0x223ba1=_0x2b899c[_0x304182];var _0x3bd073=_0x1814fd[_0x223ba1];if(_0x3bd073[_0x3ae5('0x53')]===this[_0x3ae5('0x15')]&&_0x3bd073[_0x3ae5('0x1e')]===_0x3ae5('0x54')&&_0x3bd073['exten']===_0x3ae5('0x55')){this[_0x3ae5('0x11')]+=0x1;}}if(this[_0x3ae5('0x11')]>this[_0x3ae5('0x6')]){this[_0x3ae5('0x11')]=this[_0x3ae5('0x6')];}this[_0x3ae5('0x22')]=0x0;}return this;};VoiceQueueSummary[_0x3ae5('0x47')][_0x3ae5('0x56')]=function(_0x4f054b){var _0x2d6bf4=![];if(_0x4f054b){_0x2d6bf4=INBOUND_COUNTERS[_0x3ae5('0x57')](function(_0x7ef748){return this[_0x7ef748]!==_0x4f054b[_0x7ef748];},this);}return _0x2d6bf4;};VoiceQueueSummary[_0x3ae5('0x47')]['compareToOutboundQueue']=function(_0x1b3826){var _0x38e748=![];var _0x286f98=![];var _0x4a7320=![];if(_0x1b3826){_0x38e748=this[_0x3ae5('0x24')]!==_0x1b3826[_0x3ae5('0x24')]||this['dialActive']!==_0x1b3826['dialActive']||this[_0x3ae5('0x42')]!==_0x1b3826[_0x3ae5('0x42')]||this[_0x3ae5('0x43')]!==_0x1b3826['statusMessage'];_0x286f98=OUTBOUND_COUNTERS[_0x3ae5('0x57')](function(_0x25a038){return this[_0x25a038]!==_0x1b3826[_0x25a038];},this);if(this[_0x3ae5('0x44')]&&_0x1b3826[_0x3ae5('0x44')]){_0x4a7320=this[_0x3ae5('0x44')][_0x3ae5('0x15')]!==_0x1b3826[_0x3ae5('0x44')][_0x3ae5('0x15')]||this[_0x3ae5('0x44')][_0x3ae5('0x45')]!==_0x1b3826[_0x3ae5('0x44')]['active'];}}return _0x38e748||_0x286f98||_0x4a7320;};VoiceQueueSummary[_0x3ae5('0x47')][_0x3ae5('0x58')]=function(_0x5b478b){this[_0x3ae5('0x5')]=_0x5b478b[_0x3ae5('0x5')];this['message']=_0x5b478b[_0x3ae5('0x42')];this['statusMessage']=_0x5b478b[_0x3ae5('0x43')];this['originated']=_0x5b478b['originated'];this['outboundAbandonedCallsDay']=_0x5b478b['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x5b478b['outboundAnswerCallsDay'];this[_0x3ae5('0xa')]=_0x5b478b[_0x3ae5('0xa')];this[_0x3ae5('0xb')]=_0x5b478b['outboundBusyCallsDay'];this[_0x3ae5('0xc')]=_0x5b478b[_0x3ae5('0xc')];this[_0x3ae5('0xd')]=_0x5b478b['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x5b478b['outboundNoSuchCallsDay'];this[_0x3ae5('0xf')]=_0x5b478b[_0x3ae5('0xf')];this[_0x3ae5('0x10')]=_0x5b478b['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x5b478b[_0x3ae5('0x2f')];this[_0x3ae5('0x12')]=_0x5b478b['sumBillable'];this[_0x3ae5('0x13')]=_0x5b478b['sumDuration'];this[_0x3ae5('0x14')]=_0x5b478b[_0x3ae5('0x14')];if(this[_0x3ae5('0x24')]===_0x3ae5('0x59')){this['pTalking']=_0x5b478b['pTalking'];}};module[_0x3ae5('0x5a')]=VoiceQueueSummary; \ No newline at end of file +var _0x37a7=['active','createReport','inUse','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','dialer','exten','xcally-motion-preview','prototype','some','compareToOutboundQueue','outboundReCallsDay','preview','exports','available','loggedIn','talking','waiting','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','paused','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk'];(function(_0x233dc0,_0x2866ad){var _0x1fc160=function(_0x51e38b){while(--_0x51e38b){_0x233dc0['push'](_0x233dc0['shift']());}};_0x1fc160(++_0x2866ad);}(_0x37a7,0x6f));var _0x737a=function(_0x112216,_0x124b35){_0x112216=_0x112216-0x0;var _0x3db2f5=_0x37a7[_0x112216];return _0x3db2f5;};'use strict';var INBOUND_COUNTERS=[_0x737a('0x0'),_0x737a('0x1'),'loggedInDb','paused','ringing',_0x737a('0x2'),_0x737a('0x3')];var OUTBOUND_COUNTERS=['available','answered','inUse',_0x737a('0x1'),_0x737a('0x4'),_0x737a('0x5'),_0x737a('0x6'),_0x737a('0x7'),'outboundBlacklistCallsDay',_0x737a('0x8'),_0x737a('0x9'),_0x737a('0xa'),_0x737a('0xb'),'outboundReCallsDay',_0x737a('0xc'),_0x737a('0xd'),'paused',_0x737a('0xe'),_0x737a('0x2'),_0x737a('0xf'),_0x737a('0x10'),_0x737a('0x11'),_0x737a('0x3')];function VoiceQueueSummary(_0x2b34f2){this['id']=_0x2b34f2['id'];this['name']=_0x2b34f2[_0x737a('0x12')];this[_0x737a('0x13')]=_0x2b34f2[_0x737a('0x13')];this[_0x737a('0x14')]=_0x2b34f2[_0x737a('0x14')]||0x0;this[_0x737a('0x15')]=_0x2b34f2[_0x737a('0x15')]||0x0;this[_0x737a('0x0')]=_0x2b34f2['available']||0x0;this[_0x737a('0x16')]=_0x2b34f2[_0x737a('0x16')]||0x0;this['inUse']=_0x2b34f2['inUse']||0x0;this[_0x737a('0x17')]=_0x2b34f2[_0x737a('0x17')]||0x0;this[_0x737a('0x1')]=_0x2b34f2[_0x737a('0x1')]||0x0;this[_0x737a('0x4')]=_0x2b34f2[_0x737a('0x4')]||0x0;this['onHold']=_0x2b34f2[_0x737a('0x18')]||0x0;this['notInUse']=_0x2b34f2[_0x737a('0x19')]||0x0;this[_0x737a('0x1a')]=_0x2b34f2['paused']||0x0;this[_0x737a('0x1b')]=_0x2b34f2['ringing']||0x0;this['ringInUse']=_0x2b34f2[_0x737a('0x1c')];this[_0x737a('0xf')]=_0x2b34f2['sumBillable'];this[_0x737a('0x10')]=_0x2b34f2[_0x737a('0x10')];this[_0x737a('0x1d')]=_0x2b34f2['sumHoldTime']||0x0;this[_0x737a('0x2')]=_0x2b34f2['talking']||0x0;this[_0x737a('0x11')]=_0x2b34f2['total']||0x0;this[_0x737a('0x1e')]=_0x2b34f2[_0x737a('0x1e')];this[_0x737a('0x1f')]=_0x2b34f2[_0x737a('0x1f')]||0x0;this[_0x737a('0x20')]=_0x2b34f2[_0x737a('0x20')]||0x0;this[_0x737a('0x21')]=_0x2b34f2[_0x737a('0x21')]||0x0;this['waiting']=_0x2b34f2['waiting']||0x0;if(_0x2b34f2[_0x737a('0x1e')]==='outbound'){this[_0x737a('0xe')]=_0x2b34f2['pTalking']||0x0;this[_0x737a('0x22')]=_0x2b34f2[_0x737a('0x22')];this[_0x737a('0x23')]=_0x2b34f2[_0x737a('0x23')];this[_0x737a('0x24')]=_0x2b34f2['dialOriginateCallerIdName'];this[_0x737a('0x25')]=_0x2b34f2[_0x737a('0x25')];this[_0x737a('0x26')]=_0x2b34f2[_0x737a('0x26')];this[_0x737a('0x27')]=_0x2b34f2[_0x737a('0x27')];this[_0x737a('0x28')]=_0x2b34f2['temp'];this[_0x737a('0x29')]=_0x2b34f2[_0x737a('0x29')];this[_0x737a('0x7')]=_0x2b34f2[_0x737a('0x7')];this[_0x737a('0x2a')]=_0x2b34f2['outboundBlacklistCallsDay'];this[_0x737a('0x8')]=_0x2b34f2[_0x737a('0x8')];this[_0x737a('0x9')]=_0x2b34f2[_0x737a('0x9')];this['outboundDropCallsDayACS']=_0x2b34f2[_0x737a('0x2b')];this[_0x737a('0x2c')]=_0x2b34f2[_0x737a('0x2c')];this[_0x737a('0x2d')]=_0x2b34f2[_0x737a('0x2d')];this[_0x737a('0xa')]=_0x2b34f2[_0x737a('0xa')];this[_0x737a('0xb')]=_0x2b34f2[_0x737a('0xb')];this[_0x737a('0x2e')]=_0x2b34f2['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x2b34f2['outboundReCallsDay'];this[_0x737a('0xc')]=_0x2b34f2['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x2b34f2['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x2b34f2['predictiveIntervalAnsweredCalls'];this[_0x737a('0x2f')]=_0x2b34f2['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x2b34f2[_0x737a('0x30')];this[_0x737a('0x31')]=_0x2b34f2[_0x737a('0x31')];this[_0x737a('0x32')]=_0x2b34f2[_0x737a('0x32')];this[_0x737a('0x33')]=_0x2b34f2[_0x737a('0x33')];this[_0x737a('0x34')]=_0x2b34f2[_0x737a('0x34')];this[_0x737a('0x35')]=_0x2b34f2[_0x737a('0x35')];this[_0x737a('0x36')]=_0x2b34f2[_0x737a('0x36')];this[_0x737a('0x37')]=_0x2b34f2[_0x737a('0x37')];this[_0x737a('0x38')]=_0x2b34f2['predictiveIntervalAvailable'];this[_0x737a('0x39')]=_0x2b34f2[_0x737a('0x39')];this[_0x737a('0x5')]=_0x2b34f2[_0x737a('0x5')];this[_0x737a('0x3a')]=_0x2b34f2['erlangCalls'];this[_0x737a('0x3b')]=_0x2b34f2[_0x737a('0x3b')];this[_0x737a('0x3c')]=_0x2b34f2['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x2b34f2[_0x737a('0x3d')];this[_0x737a('0x3e')]=_0x2b34f2['startPredictive'];this[_0x737a('0x3f')]=_0x2b34f2[_0x737a('0x3f')];this[_0x737a('0x40')]=_0x2b34f2[_0x737a('0x40')];this[_0x737a('0x41')]=_0x2b34f2['statusMessage'];}if(_0x2b34f2[_0x737a('0x42')]){this[_0x737a('0x42')]={'id':_0x2b34f2[_0x737a('0x42')]['id'],'name':_0x2b34f2[_0x737a('0x42')]['name'],'active':_0x2b34f2[_0x737a('0x42')][_0x737a('0x43')],'callerid':_0x2b34f2[_0x737a('0x42')]['callerid']};}}VoiceQueueSummary['prototype'][_0x737a('0x44')]=function(_0x43a939,_0x344131,_0x44ac55,_0x4aa61e){this[_0x737a('0x4')]=0x0;this[_0x737a('0x2')]=0x0;this[_0x737a('0x1a')]=0x0;this[_0x737a('0x20')]=0x0;this[_0x737a('0x19')]=0x0;this[_0x737a('0x45')]=0x0;this['busy']=0x0;this[_0x737a('0x17')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0x737a('0x1c')]=0x0;this[_0x737a('0x18')]=0x0;if(_0x44ac55){if(_0x44ac55[_0x737a('0x0')]){this[_0x737a('0x0')]=Number(_0x44ac55['available']);}if(_0x44ac55['loggedin']){this[_0x737a('0x1')]=Number(_0x44ac55[_0x737a('0x46')]);}if(_0x44ac55[_0x737a('0x47')]){this['waiting']=Number(_0x44ac55[_0x737a('0x47')]);}}for(var _0x467dc2=0x0;_0x467dc2<_0x43a939[_0x737a('0x48')];_0x467dc2++){var _0x1dc933=_0x344131[_0x737a('0x49')+_0x43a939[_0x467dc2][_0x737a('0x12')]];if(_0x1dc933&&_0x1dc933[_0x737a('0x4a')]){this[_0x737a('0x4')]+=0x1;}if(_0x43a939[_0x467dc2][_0x737a('0x4b')]==='1'){this[_0x737a('0x2')]+=0x1;}if(_0x43a939[_0x467dc2][_0x737a('0x1a')]==='1'&&!['2','7','8'][_0x737a('0x4c')](_0x43a939[_0x467dc2][_0x737a('0x4d')])){this[_0x737a('0x1a')]+=0x1;}switch(_0x43a939[_0x467dc2][_0x737a('0x4d')]){case'0':this[_0x737a('0x20')]+=0x1;break;case'1':this[_0x737a('0x19')]+=0x1;break;case'2':this[_0x737a('0x45')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x737a('0x17')]+=0x1;break;case'5':this[_0x737a('0x1f')]+=0x1;break;case'6':this[_0x737a('0x1b')]+=0x1;break;case'7':this[_0x737a('0x1c')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x737a('0x23')]===_0x737a('0x4e')){var _0x9a5e92=Object[_0x737a('0x4f')](_0x4aa61e);for(var _0x3f9b66=0x0;_0x3f9b66<_0x9a5e92[_0x737a('0x48')];_0x3f9b66++){var _0x456305=_0x9a5e92[_0x3f9b66];var _0x22b7b3=_0x4aa61e[_0x456305];if(_0x22b7b3['queue']===this[_0x737a('0x12')]&&_0x22b7b3[_0x737a('0x1e')]===_0x737a('0x50')&&_0x22b7b3[_0x737a('0x51')]===_0x737a('0x52')){this['talking']+=0x1;}}if(this[_0x737a('0x2')]>this[_0x737a('0x45')]){this[_0x737a('0x2')]=this[_0x737a('0x45')];}this[_0x737a('0xe')]=0x0;}return this;};VoiceQueueSummary[_0x737a('0x53')]['compareToInboundQueue']=function(_0x1c94ce){var _0x5b5f60=![];if(_0x1c94ce){_0x5b5f60=INBOUND_COUNTERS[_0x737a('0x54')](function(_0x3a0a08){return this[_0x3a0a08]!==_0x1c94ce[_0x3a0a08];},this);}return _0x5b5f60;};VoiceQueueSummary[_0x737a('0x53')][_0x737a('0x55')]=function(_0xd85fdc){var _0x598664=![];var _0x82bdb8=![];var _0x138ec7=![];if(_0xd85fdc){_0x598664=this['dialMethod']!==_0xd85fdc[_0x737a('0x23')]||this['dialActive']!==_0xd85fdc['dialActive']||this[_0x737a('0x40')]!==_0xd85fdc[_0x737a('0x40')]||this[_0x737a('0x41')]!==_0xd85fdc[_0x737a('0x41')];_0x82bdb8=OUTBOUND_COUNTERS['some'](function(_0x1aca85){return this[_0x1aca85]!==_0xd85fdc[_0x1aca85];},this);if(this['Trunk']&&_0xd85fdc[_0x737a('0x42')]){_0x138ec7=this[_0x737a('0x42')][_0x737a('0x12')]!==_0xd85fdc['Trunk'][_0x737a('0x12')]||this[_0x737a('0x42')][_0x737a('0x43')]!==_0xd85fdc[_0x737a('0x42')]['active'];}}return _0x598664||_0x82bdb8||_0x138ec7;};VoiceQueueSummary[_0x737a('0x53')]['updateReportFromOutboundQueue']=function(_0x403339){this[_0x737a('0x15')]=_0x403339[_0x737a('0x15')];this['message']=_0x403339[_0x737a('0x40')];this[_0x737a('0x41')]=_0x403339[_0x737a('0x41')];this[_0x737a('0x5')]=_0x403339[_0x737a('0x5')];this[_0x737a('0x6')]=_0x403339['outboundAbandonedCallsDay'];this[_0x737a('0x7')]=_0x403339[_0x737a('0x7')];this['outboundBlacklistCallsDay']=_0x403339[_0x737a('0x2a')];this[_0x737a('0x8')]=_0x403339['outboundBusyCallsDay'];this[_0x737a('0x9')]=_0x403339[_0x737a('0x9')];this[_0x737a('0xa')]=_0x403339[_0x737a('0xa')];this[_0x737a('0xb')]=_0x403339[_0x737a('0xb')];this['outboundReCallsDay']=_0x403339[_0x737a('0x56')];this[_0x737a('0xc')]=_0x403339[_0x737a('0xc')];this[_0x737a('0xd')]=_0x403339[_0x737a('0xd')];this[_0x737a('0xf')]=_0x403339['sumBillable'];this[_0x737a('0x10')]=_0x403339[_0x737a('0x10')];this['total']=_0x403339['total'];if(this[_0x737a('0x23')]===_0x737a('0x57')){this['pTalking']=_0x403339[_0x737a('0xe')];}};module[_0x737a('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 3120613..f8e7873 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 _0x2d16=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x50b53c,_0x47bdae){var _0x51b1a9=function(_0x8acc6e){while(--_0x8acc6e){_0x50b53c['push'](_0x50b53c['shift']());}};_0x51b1a9(++_0x47bdae);}(_0x2d16,0x1c9));var _0x62d1=function(_0x4846cb,_0x54f399){_0x4846cb=_0x4846cb-0x0;var _0x4f4e7b=_0x2d16[_0x4846cb];return _0x4f4e7b;};'use strict';function VtigerAccount(_0x5c98b1){this['id']=_0x5c98b1['id']||0x0;this[_0x62d1('0x0')]=_0x5c98b1[_0x62d1('0x0')]||'';this[_0x62d1('0x1')]=_0x5c98b1[_0x62d1('0x1')]||'';this[_0x62d1('0x2')]=_0x5c98b1['accessKey']||'';this[_0x62d1('0x3')]=_0x5c98b1[_0x62d1('0x3')]||'';this['serverUrl']=_0x5c98b1[_0x62d1('0x4')]||'';this['Configurations']=_0x5c98b1[_0x62d1('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x5df4=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x48e89c,_0x421d23){var _0x1e0224=function(_0x253c01){while(--_0x253c01){_0x48e89c['push'](_0x48e89c['shift']());}};_0x1e0224(++_0x421d23);}(_0x5df4,0x1e0));var _0x45df=function(_0x2dbff1,_0x4699b0){_0x2dbff1=_0x2dbff1-0x0;var _0x5445d9=_0x5df4[_0x2dbff1];return _0x5445d9;};'use strict';function VtigerAccount(_0x51d55e){this['id']=_0x51d55e['id']||0x0;this[_0x45df('0x0')]=_0x51d55e[_0x45df('0x0')]||'';this[_0x45df('0x1')]=_0x51d55e[_0x45df('0x1')]||'';this[_0x45df('0x2')]=_0x51d55e['accessKey']||'';this['remoteUri']=_0x51d55e[_0x45df('0x3')]||'';this[_0x45df('0x4')]=_0x51d55e[_0x45df('0x4')]||'';this[_0x45df('0x5')]=_0x51d55e[_0x45df('0x5')]||{};}module[_0x45df('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 509b039..1033c64 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 _0x8d61=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x2652ef,_0x234230){var _0x2db578=function(_0x56b137){while(--_0x56b137){_0x2652ef['push'](_0x2652ef['shift']());}};_0x2db578(++_0x234230);}(_0x8d61,0x78));var _0x18d6=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x8d61[_0x3c2b2e];return _0x27a338;};'use strict';function ZendeskAccount(_0x5bf477){this['id']=_0x5bf477['id']||0x0;this[_0x18d6('0x0')]=_0x5bf477[_0x18d6('0x0')]||'';this[_0x18d6('0x1')]=_0x5bf477['username']||'';this[_0x18d6('0x2')]=_0x5bf477[_0x18d6('0x2')]||'';this[_0x18d6('0x3')]=_0x5bf477[_0x18d6('0x3')]||'';this[_0x18d6('0x4')]=_0x5bf477['remoteUri']||'';this[_0x18d6('0x5')]=_0x5bf477[_0x18d6('0x5')]||'';this[_0x18d6('0x6')]=_0x5bf477[_0x18d6('0x6')]||_0x18d6('0x7');this['serverUrl']=_0x5bf477[_0x18d6('0x8')]||'';this['Configurations']=_0x5bf477[_0x18d6('0x9')]||{};}module[_0x18d6('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x370f=['name','username','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x4690b6,_0x4a1dab){var _0x3632e8=function(_0x589935){while(--_0x589935){_0x4690b6['push'](_0x4690b6['shift']());}};_0x3632e8(++_0x4a1dab);}(_0x370f,0x19a));var _0xf370=function(_0x4d6bfd,_0x8d79ff){_0x4d6bfd=_0x4d6bfd-0x0;var _0x243a46=_0x370f[_0x4d6bfd];return _0x243a46;};'use strict';function ZendeskAccount(_0x4c7194){this['id']=_0x4c7194['id']||0x0;this['name']=_0x4c7194[_0xf370('0x0')]||'';this[_0xf370('0x1')]=_0x4c7194[_0xf370('0x1')]||'';this['password']=_0x4c7194['password']||'';this[_0xf370('0x2')]=_0x4c7194[_0xf370('0x2')]||'';this[_0xf370('0x3')]=_0x4c7194['remoteUri']||'';this[_0xf370('0x4')]=_0x4c7194[_0xf370('0x4')]||'';this[_0xf370('0x5')]=_0x4c7194[_0xf370('0x5')]||_0xf370('0x6');this[_0xf370('0x7')]=_0x4c7194[_0xf370('0x7')]||'';this[_0xf370('0x8')]=_0x4c7194[_0xf370('0x8')]||{};}module[_0xf370('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 7b8c96c..1e876e9 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 _0x6465=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x3ac813,_0x3af833){var _0x528d5f=function(_0xeeb003){while(--_0xeeb003){_0x3ac813['push'](_0x3ac813['shift']());}};_0x528d5f(++_0x3af833);}(_0x6465,0x1e0));var _0x5646=function(_0x4f6c07,_0x26fd40){_0x4f6c07=_0x4f6c07-0x0;var _0x36f9ff=_0x6465[_0x4f6c07];return _0x36f9ff;};'use strict';function ZohoAccount(_0x431c34){this['id']=_0x431c34['id']||0x0;this['name']=_0x431c34[_0x5646('0x0')]||'';this[_0x5646('0x1')]=_0x431c34['description']||'';this[_0x5646('0x2')]=_0x431c34[_0x5646('0x2')]||'';this[_0x5646('0x3')]=_0x431c34[_0x5646('0x3')]||'';this[_0x5646('0x4')]=_0x431c34[_0x5646('0x4')]||'';this[_0x5646('0x5')]=_0x431c34[_0x5646('0x5')]||'';this[_0x5646('0x6')]=_0x431c34[_0x5646('0x6')]||'';this[_0x5646('0x7')]=_0x431c34['code']||'';this[_0x5646('0x8')]=_0x431c34[_0x5646('0x8')]||'';this[_0x5646('0x9')]=_0x431c34[_0x5646('0x9')]||{};}module[_0x5646('0xa')]=ZohoAccount; \ No newline at end of file +var _0xb342=['clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x167b2b,_0x5afa01){var _0x1048c6=function(_0x578b47){while(--_0x578b47){_0x167b2b['push'](_0x167b2b['shift']());}};_0x1048c6(++_0x5afa01);}(_0xb342,0x149));var _0x2b34=function(_0x260859,_0x3cfcff){_0x260859=_0x260859-0x0;var _0x4b77f8=_0xb342[_0x260859];return _0x4b77f8;};'use strict';function ZohoAccount(_0xbdd8fa){this['id']=_0xbdd8fa['id']||0x0;this['name']=_0xbdd8fa[_0x2b34('0x0')]||'';this[_0x2b34('0x1')]=_0xbdd8fa[_0x2b34('0x1')]||'';this[_0x2b34('0x2')]=_0xbdd8fa[_0x2b34('0x2')]||'';this[_0x2b34('0x3')]=_0xbdd8fa[_0x2b34('0x3')]||'';this['clientId']=_0xbdd8fa['clientId']||'';this['clientSecret']=_0xbdd8fa[_0x2b34('0x4')]||'';this[_0x2b34('0x5')]=_0xbdd8fa['serverUrl']||'';this[_0x2b34('0x6')]=_0xbdd8fa[_0x2b34('0x6')]||'';this[_0x2b34('0x7')]=_0xbdd8fa[_0x2b34('0x7')]||'';this['Configurations']=_0xbdd8fa[_0x2b34('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 40436c4..568b3d6 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 _0x6a95=['format','number','util','lodash','moment','isNil','string','queue','name','type','campaigntype','dialAnswer','membername','Agent','SIP/%s','calleridname','Contact','phone','firstName','lastName','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6a95,0x1db));var _0x56a9=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x6a95[_0x8de54f];return _0x14cba4;};'use strict';var util=require(_0x56a9('0x0'));var _=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));function checkNameSurname(_0xce37aa,_0x36f87a,_0x26e006){var _0x235917='';if(!_['isNil'](_0x36f87a)&&'string'===typeof _0x36f87a){_0x235917+=_0x36f87a;}if(!_[_0x56a9('0x3')](_0x26e006)&&_0x56a9('0x4')===typeof _0x26e006){_0x235917+='\x20'+_0x26e006;}if(_0x235917!==''){return _0x235917;}return _0xce37aa;}function Action(_0x1b42ac,_0x2eb132,_0x3c15b6,_0x365093,_0xd8aa7c){this['uniqueid']=_0x3c15b6||undefined;this['idContact']=_0x1b42ac['id'];this[_0x56a9('0x5')]=_0x2eb132[_0x56a9('0x6')];this['type']=_0x2eb132[_0x56a9('0x7')];this[_0x56a9('0x8')]=_0x56a9('0x5');this[_0x56a9('0x9')]=![];this[_0x56a9('0xa')]=_[_0x56a9('0x3')](_0x1b42ac[_0x56a9('0xb')])?undefined:_0x1b42ac[_0x56a9('0xb')][_0x56a9('0x6')];this['channelAgent']=this[_0x56a9('0xa')]?util['format'](_0x56a9('0xc'),this[_0x56a9('0xa')]):_0x365093||undefined;this[_0x56a9('0xd')]=checkNameSurname(_0x1b42ac[_0x56a9('0xe')][_0x56a9('0xf')],_0x1b42ac[_0x56a9('0xe')][_0x56a9('0x10')],_0x1b42ac[_0x56a9('0xe')][_0x56a9('0x11')]);this['active']=_0x1b42ac['active']||![];this[_0x56a9('0x12')]=_0x1b42ac[_0x56a9('0xf')];this[_0x56a9('0x13')]=_0x1b42ac[_0x56a9('0x13')];this['countbusyretry']=_0x1b42ac[_0x56a9('0x14')]||0x0;this['countcongestionretry']=_0x1b42ac['countcongestionretry']||0x0;this['countnoanswerretry']=_0x1b42ac[_0x56a9('0x15')]||0x0;this[_0x56a9('0x16')]=(_0x1b42ac[_0x56a9('0x14')]||0x0)+(_0x1b42ac[_0x56a9('0x17')]||0x0)+(_0x1b42ac[_0x56a9('0x15')]||0x0)+(_0x1b42ac[_0x56a9('0x18')]||0x0)+(_0x1b42ac[_0x56a9('0x19')]||0x0)+(_0x1b42ac[_0x56a9('0x1a')]||0x0)+(_0x1b42ac[_0x56a9('0x1b')]||0x0)+(_0x1b42ac[_0x56a9('0x1c')]||0x0);this[_0x56a9('0x18')]=_0x1b42ac[_0x56a9('0x18')]||0x0;this['countdropretry']=_0x1b42ac['countdropretry']||0x0;this[_0x56a9('0x1a')]=_0x1b42ac[_0x56a9('0x1a')]||0x0;this[_0x56a9('0x1b')]=_0x1b42ac[_0x56a9('0x1b')]||0x0;this['countagentrejectretry']=_0x1b42ac[_0x56a9('0x1c')]||0x0;this[_0x56a9('0x1d')]=_0x1b42ac[_0x56a9('0x1d')];this[_0x56a9('0x1e')]=_0x1b42ac['callbackuniqueid'];this[_0x56a9('0x1f')]=_0x1b42ac[_0x56a9('0x1f')];this[_0x56a9('0x20')]=_0x1b42ac[_0x56a9('0x20')];this[_0x56a9('0x21')]=_0x1b42ac['ContactId'];this[_0x56a9('0x22')]=_0x1b42ac[_0x56a9('0x22')];this[_0x56a9('0x23')]=_['isNil'](_0x1b42ac[_0x56a9('0xb')])?_0x1b42ac['UserId']:_0x1b42ac[_0x56a9('0xb')]['id'];this[_0x56a9('0x24')]=_0x1b42ac[_0x56a9('0x24')];this[_0x56a9('0x25')]='';this[_0x56a9('0x26')]='';}Action[_0x56a9('0x27')][_0x56a9('0x28')]=function(){return util[_0x56a9('0x29')]('\x22%s\x22\x20<%s>',this[_0x56a9('0xd')],this[_0x56a9('0x2a')]);};module['exports']=Action; \ No newline at end of file +var _0x57ca=['name','type','campaigntype','dialAnswer','Agent','membername','format','SIP/%s','calleridname','phone','firstName','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','lodash','moment','isNil','string','uniqueid','idContact'];(function(_0x49d23f,_0x5ad2b1){var _0xf3b3d2=function(_0x2320cd){while(--_0x2320cd){_0x49d23f['push'](_0x49d23f['shift']());}};_0xf3b3d2(++_0x5ad2b1);}(_0x57ca,0x108));var _0xa57c=function(_0x6497,_0x5acf8a){_0x6497=_0x6497-0x0;var _0x4397b8=_0x57ca[_0x6497];return _0x4397b8;};'use strict';var util=require('util');var _=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));function checkNameSurname(_0x4b1712,_0x3a7394,_0x396613){var _0x1d38e7='';if(!_[_0xa57c('0x2')](_0x3a7394)&&_0xa57c('0x3')===typeof _0x3a7394){_0x1d38e7+=_0x3a7394;}if(!_['isNil'](_0x396613)&&_0xa57c('0x3')===typeof _0x396613){_0x1d38e7+='\x20'+_0x396613;}if(_0x1d38e7!==''){return _0x1d38e7;}return _0x4b1712;}function Action(_0x1c3e31,_0x113dcf,_0x19473f,_0xbdfffb,_0x314574){this[_0xa57c('0x4')]=_0x19473f||undefined;this[_0xa57c('0x5')]=_0x1c3e31['id'];this['queue']=_0x113dcf[_0xa57c('0x6')];this['type']=_0x113dcf[_0xa57c('0x7')];this[_0xa57c('0x8')]='queue';this[_0xa57c('0x9')]=![];this['membername']=_[_0xa57c('0x2')](_0x1c3e31[_0xa57c('0xa')])?undefined:_0x1c3e31['Agent'][_0xa57c('0x6')];this['channelAgent']=this[_0xa57c('0xb')]?util[_0xa57c('0xc')](_0xa57c('0xd'),this[_0xa57c('0xb')]):_0xbdfffb||undefined;this[_0xa57c('0xe')]=checkNameSurname(_0x1c3e31['Contact'][_0xa57c('0xf')],_0x1c3e31['Contact'][_0xa57c('0x10')],_0x1c3e31[_0xa57c('0x11')][_0xa57c('0x12')]);this[_0xa57c('0x13')]=_0x1c3e31[_0xa57c('0x13')]||![];this[_0xa57c('0x14')]=_0x1c3e31[_0xa57c('0xf')];this['scheduledat']=_0x1c3e31[_0xa57c('0x15')];this[_0xa57c('0x16')]=_0x1c3e31[_0xa57c('0x16')]||0x0;this['countcongestionretry']=_0x1c3e31[_0xa57c('0x17')]||0x0;this['countnoanswerretry']=_0x1c3e31[_0xa57c('0x18')]||0x0;this[_0xa57c('0x19')]=(_0x1c3e31[_0xa57c('0x16')]||0x0)+(_0x1c3e31[_0xa57c('0x17')]||0x0)+(_0x1c3e31[_0xa57c('0x18')]||0x0)+(_0x1c3e31[_0xa57c('0x1a')]||0x0)+(_0x1c3e31[_0xa57c('0x1b')]||0x0)+(_0x1c3e31[_0xa57c('0x1c')]||0x0)+(_0x1c3e31['countmachineretry']||0x0)+(_0x1c3e31[_0xa57c('0x1d')]||0x0);this['countnosuchnumberretry']=_0x1c3e31['countnosuchnumberretry']||0x0;this[_0xa57c('0x1b')]=_0x1c3e31[_0xa57c('0x1b')]||0x0;this[_0xa57c('0x1c')]=_0x1c3e31[_0xa57c('0x1c')]||0x0;this['countmachineretry']=_0x1c3e31[_0xa57c('0x1e')]||0x0;this[_0xa57c('0x1d')]=_0x1c3e31[_0xa57c('0x1d')]||0x0;this[_0xa57c('0x1f')]=_0x1c3e31[_0xa57c('0x1f')];this[_0xa57c('0x20')]=_0x1c3e31[_0xa57c('0x20')];this[_0xa57c('0x21')]=_0x1c3e31[_0xa57c('0x21')];this[_0xa57c('0x22')]=_0x1c3e31[_0xa57c('0x22')];this[_0xa57c('0x23')]=_0x1c3e31[_0xa57c('0x23')];this[_0xa57c('0x24')]=_0x1c3e31[_0xa57c('0x24')];this['UserId']=_[_0xa57c('0x2')](_0x1c3e31[_0xa57c('0xa')])?_0x1c3e31[_0xa57c('0x25')]:_0x1c3e31[_0xa57c('0xa')]['id'];this[_0xa57c('0x26')]=_0x1c3e31[_0xa57c('0x26')];this[_0xa57c('0x27')]='';this[_0xa57c('0x28')]='';}Action[_0xa57c('0x29')][_0xa57c('0x2a')]=function(){return util['format'](_0xa57c('0x2b'),this['calleridname'],this['number']);};module[_0xa57c('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index a16efc5..a6dd0bc 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 _0x9c44=['Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','starttime','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','Answer','[syncHangup][talking]','cause','statedesc','channelstate','transfer','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','available','message','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','syncCampaigns','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','sequence','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pTalking','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','name','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','originated','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','isNil','Contact','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]'];(function(_0x283948,_0x504bca){var _0x934796=function(_0x10524d){while(--_0x10524d){_0x283948['push'](_0x283948['shift']());}};_0x934796(++_0x504bca);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x49c4('0x0'));var moment=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));var logger=require(_0x49c4('0x4'))(_0x49c4('0x5'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x49c4('0x6'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x49c4('0x7'));var Action=require(_0x49c4('0x8'));var ut=require(_0x49c4('0x9'));var utils=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitVoiceQueueChannelRemove(_0x46e475){logger[_0x49c4('0x24')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x46e475));emit(util['format'](_0x49c4('0x25'),_0x46e475['name']),'voice_queue_channel:remove',_0x46e475);io[_0x49c4('0x23')](_0x49c4('0x26'),_0x46e475);}function notSendMessagesQueue(_0x26c640){if(_0x26c640[_0x49c4('0x27')]){if(_0x26c640['originated']===0x0&&_0x26c640['pTalking']===0x0){_0x26c640[_0x49c4('0x27')]=![];_0x26c640[_0x49c4('0x28')]=0x0;_0x26c640['paused']=0x0;_0x26c640[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x2b')];ut[_0x49c4('0x2c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x26c640['name']+_0x49c4('0x2d'));}else{_0x26c640['message']=utils[_0x49c4('0x2a')][_0x49c4('0x2e')];ut[_0x49c4('0x2c')](_0x49c4('0x2f'),_0x26c640['name']+_0x49c4('0x30'));}}}Preview[_0x49c4('0x31')][_0x49c4('0x22')]=function(){var _0x4f28a2=this;setInterval(function(){_0x4f28a2[_0x49c4('0x32')]();},0x7cf);};Preview[_0x49c4('0x31')][_0x49c4('0x32')]=function(){var _0x427b26=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x46f7ea in _0x427b26){if(_0x427b26['hasOwnProperty'](_0x46f7ea)&&(_0x427b26[_0x46f7ea]['dialMethod']==='preview'||_0x427b26[_0x46f7ea][_0x49c4('0x33')]===_0x49c4('0x34'))&&_0x427b26[_0x46f7ea][_0x49c4('0x35')]===_0x49c4('0x36')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x37')]();}}if(_0x427b26[_0x49c4('0x38')](_0x46f7ea)&&_0x427b26[_0x46f7ea][_0x49c4('0x33')]===_0x49c4('0x5')&&_0x427b26[_0x46f7ea]['type']==='outbound'){if(_0x427b26[_0x46f7ea][_0x49c4('0x39')]){this[_0x49c4('0x3a')](_0x427b26[_0x46f7ea]);if(_0x427b26[_0x46f7ea][_0x49c4('0x3b')])this[_0x49c4('0x3c')](_0x427b26[_0x46f7ea]);}else{notSendMessagesQueue(_0x427b26[_0x46f7ea]);}}}};Preview[_0x49c4('0x31')]['clearZombieChannel']=function(_0x2aac35){var _0x84c621=this;this[_0x49c4('0x3d')]['enqueue'](function(){if(!_['isNil'](_0x84c621[_0x49c4('0x13')][_0x2aac35])){loggerAction[_0x49c4('0x24')](_0x49c4('0x3e'),_0x2aac35,_0x49c4('0x3f'),_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')],_0x49c4('0x41'),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x10')][_0x84c621['actions'][_0x2aac35][_0x49c4('0x40')]]['originated']),_0x49c4('0x43'),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x10')][_0x84c621[_0x49c4('0x13')][_0x2aac35]['queue']][_0x49c4('0x44')]),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x13')][_0x2aac35]['dialAnswer']),JSON[_0x49c4('0x42')](_[_0x49c4('0x45')](_0x84c621[_0x49c4('0x13')][_0x2aac35],[_0x49c4('0x46'),_0x49c4('0x47'),_0x49c4('0x48'),_0x49c4('0x49')])));return ami[_0x49c4('0x4a')]({'action':_0x49c4('0x4b'),'channel':_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x4c')]})['catch'](function(_0x2d2510){if(_0x2d2510[_0x49c4('0x29')]===_0x49c4('0x4d')){setTimeout(function(){if(_0x84c621[_0x49c4('0x13')][_0x2aac35]){ut[_0x49c4('0x4e')](_0x84c621[_0x49c4('0x10')][_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')]],_0x49c4('0x4f'));if(_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x50')]===!![]){ut[_0x49c4('0x51')](_0x84c621[_0x49c4('0x10')][_0x84c621['actions'][_0x2aac35][_0x49c4('0x40')]],'[clearZombieChannel]');ut[_0x49c4('0x52')](_0x49c4('0x53')+_0x2aac35,_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')]);}ut[_0x49c4('0x52')](_0x49c4('0x54')+_0x2aac35,_0x84c621['actions'][_0x2aac35]['queue']);delete _0x84c621[_0x49c4('0x13')][_0x2aac35];}},0x2328);}});}});};Preview[_0x49c4('0x31')][_0x49c4('0x37')]=function(){var _0x117151=this;loggerAction['info'](_0x49c4('0x55'),_[_0x49c4('0x56')](this[_0x49c4('0x13')]));for(var _0x444270 in this[_0x49c4('0x13')]){if(_0x117151[_0x49c4('0x13')][_0x49c4('0x38')](_0x444270)){_0x117151[_0x49c4('0x57')](_0x444270);}}};Preview[_0x49c4('0x31')]['recallMe']=function(_0x2ad771){var _0x4d27d0=this;rpcDb[_0x49c4('0x58')](_0x2ad771['id'],ut[_0x49c4('0x59')](this[_0x49c4('0x14')]))[_0x49c4('0x5a')](function(_0x2d93d8){if(!_['isNil'](_0x2d93d8)){for(var _0x592e8e=0x0;_0x592e8e<_0x2d93d8[_0x49c4('0x5b')];_0x592e8e+=0x1){if(ut[_0x49c4('0x5c')](_0x2d93d8[_0x592e8e][_0x49c4('0x5d')])<_0x2ad771[_0x49c4('0x5e')]*0x3c){if(_0x2d93d8[_0x592e8e][_0x49c4('0x5f')]&&!_0x2d93d8[_0x592e8e][_0x49c4('0x5f')]['voicePause']){_0x4d27d0[_0x49c4('0x60')](_0x2d93d8[_0x592e8e]['id'])['then'](ut[_0x49c4('0x61')](_0x49c4('0x62')))[_0x49c4('0x63')](ut[_0x49c4('0x61')](_0x49c4('0x62')));}else{rpcDb[_0x49c4('0x64')](_0x2d93d8[_0x592e8e]['id']);}}else{var _0x2c6be1=new Action(_0x2d93d8[_0x592e8e],_0x2ad771);_0x2c6be1['starttime']=moment()[_0x49c4('0x65')](_0x49c4('0x66'));_0x2ad771['outboundReCallsDay']+=0x1;ut[_0x49c4('0x67')](_0x2c6be1,0x17,_0x49c4('0x68'));if(_0x2ad771[_0x49c4('0x69')]){rpcDb[_0x49c4('0x6a')](ut['createBody'](_0x2d93d8[_0x592e8e]));rpcDb['createCustomerHistory'](_0x2c6be1,_0x49c4('0x6b'));}else{ut['logCustomer'](_0x2c6be1,0x16,_0x49c4('0x6c'));rpcDb[_0x49c4('0x6d')](_0x2c6be1,_0x49c4('0x6e'));rpcDb[_0x49c4('0x6f')](_0x2c6be1,_0x49c4('0x6e'));}}}}})[_0x49c4('0x63')](ut[_0x49c4('0x61')]('[getContactRecallMe]'));};Preview[_0x49c4('0x31')][_0x49c4('0x3a')]=function(_0x3936d3){_0x3936d3[_0x49c4('0x27')]=!![];if(ut[_0x49c4('0x70')](_0x3936d3[_0x49c4('0x71')])){_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x72')];}else if(!ut[_0x49c4('0x73')](_0x3936d3['dialActive'])){_0x3936d3['message']=utils[_0x49c4('0x2a')][_0x49c4('0x2b')];}else if(!this['isTrunkReachable'](_0x3936d3['Trunk'])){if(!this[_0x49c4('0x74')](_0x3936d3['TrunkBackup'])){_0x3936d3['message']=utils[_0x49c4('0x2a')][_0x49c4('0x75')];}else{_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x76')];}}else{_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')]['ACTIVE'];}};Preview[_0x49c4('0x31')][_0x49c4('0x77')]=function(_0x207572,_0x208208,_0x73840f){var _0xa431d=this;var _0x5d24f3=this['actions'][_0x208208];var _0x1ef0c1=this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]];var _0xf7a10f;var _0x23288e=![];var _0x6b2592=0x2;var _0xc2033f=0x3;if(_0x1ef0c1){switch(_0x73840f){case'1':_0x1ef0c1['outboundNoSuchCallsDay']+=0x1;_0x5d24f3[_0x49c4('0x78')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut['totalGlobal'](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x0,'NoSuchNumber');ami[_0x49c4('0x23')](_0x49c4('0x7a'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x7c')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0x7d'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'0',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x483770){_0x23288e=_0x483770[_0x49c4('0x7f')]==0x1;_0x6b2592=_0x1ef0c1[_0x49c4('0x80')];_0xc2033f=_0x1ef0c1['callAdditionalPhoneAfterMin'];if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x5d24f3['countnosuchnumberretry']>=_0x1ef0c1['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0x84'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0x78'),_0x1ef0c1['dialNoSuchNumberRetryFrequency']),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}delete this['actions'][_0x207572[_0x49c4('0x88')]];}else{_0x5d24f3[_0x49c4('0x78')]++;logger[_0x49c4('0x24')](_0x49c4('0x89'),_0x5d24f3['countnosuchnumberretry']);logger[_0x49c4('0x24')]('id',_0x5d24f3[_0x49c4('0x8a')]);_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnosuchnumberretry':_0x5d24f3['countnosuchnumberretry']}})[_0x49c4('0x5a')](function(){_0xa431d['swapAdditionalPhones'](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case'ANSWER':var _0x5d6de0=moment()[_0x49c4('0x65')](_0x49c4('0x66'));_0x5d24f3[_0x49c4('0x8c')]=_0x5d6de0;_0x5d24f3[_0x49c4('0x8d')]=_0x5d6de0;_0x5d24f3['dialAnswer']=!![];_0x1ef0c1['pTalking']+=0x1;logger[_0x49c4('0x24')](_0x49c4('0x8e'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],_0x49c4('0x43'),_0x1ef0c1[_0x49c4('0x44')]);ami[_0x49c4('0x23')]('custom:agentconnect',ut[_0x49c4('0x7b')](_0x5d24f3,'connect',this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]]));if(_0x1ef0c1[_0x49c4('0x92')]){ami[_0x49c4('0x23')](_0x49c4('0x93'),ut[_0x49c4('0x94')](_0x5d24f3));}break;case'16':ami[_0x49c4('0x23')](_0x49c4('0x95'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x96'),this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x96')));_0x1ef0c1[_0x49c4('0x97')]+=0x1;_0x1ef0c1[_0x49c4('0x98')]+=0x1;_0x1ef0c1[_0x49c4('0x99')]+=0x1;ut[_0x49c4('0x51')](_0x1ef0c1,'[16]');_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x4,'Answer');rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0x9a'));rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0x9b'));rpcDb['crateCustomerReportQueue'](_0x5d24f3);_0x1ef0c1['sumDuration']+=_0x5d24f3['talktime'];_0x1ef0c1[_0x49c4('0x9c')]+=_0x5d24f3[_0x49c4('0x9d')];logger[_0x49c4('0x24')](_0x49c4('0x9e'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],_0x49c4('0x43'),_0x1ef0c1[_0x49c4('0x44')]);delete this['actions'][_0x207572[_0x49c4('0x88')]];break;case _0x49c4('0x9f'):_0x1ef0c1[_0x49c4('0xa0')]+=0x1;_0x5d24f3['countbusyretry']+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x5,_0x49c4('0xa1'));_0x6b2592=_0x1ef0c1[_0x49c4('0xa2')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xa4'),ut['buildObj'](_0x5d24f3,_0x49c4('0xa5')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xa6'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'5',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x4a204d){_0x23288e=_0x4a204d['additional']==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,'Global');rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xa8'));}else{if(_0x5d24f3[_0x49c4('0xa9')]>=_0x1ef0c1[_0x49c4('0xaa')]){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xa6'));}else{rpcDb[_0x49c4('0xab')](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0xa9'),_0x1ef0c1[_0x49c4('0xa2')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3[_0x49c4('0xa9')]++;_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countbusyretry':_0x5d24f3['countbusyretry']}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case _0x49c4('0xad'):_0x1ef0c1['outboundNoAnswerCallsDay']+=0x1;_0x5d24f3[_0x49c4('0xae')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x3,_0x49c4('0xaf'));_0x6b2592=_0x1ef0c1['dialNoAnswerRetryFrequency'];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];var _0x2329b6=ut['buildNoAnswerEventPayload'](_0x5d24f3,_0x1ef0c1);ami[_0x49c4('0x23')](_0x49c4('0xb0'),_0x2329b6);rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xb1'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'3',_0x1ef0c1)['then'](function(_0x37fef1){_0x23288e=_0x37fef1[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5d24f3[_0x49c4('0xae')]>=_0x1ef0c1['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5d24f3,_0x49c4('0xae'),_0x1ef0c1[_0x49c4('0xb2')]),_0x5d24f3['unlockAgent'],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3['countnoanswerretry']++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3['idContact'],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'CONGESTION':_0x1ef0c1['outboundCongestionCallsDay']+=0x1;_0x5d24f3[_0x49c4('0xb3')]+=0x1;_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut['logCustomer'](_0x5d24f3,0x8,_0x49c4('0xb4'));_0x6b2592=_0x1ef0c1[_0x49c4('0xb5')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xb6'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xb7')));rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xb8'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'8',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x16864c){_0x23288e=_0x16864c[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut['totalGlobal'](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb['createCustomerFinal'](_0xf7a10f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5d24f3[_0x49c4('0xb3')]>=_0x1ef0c1[_0x49c4('0xb9')]){rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xb8'));}else{rpcDb[_0x49c4('0xab')](ut['scheduledAt'](_0x5d24f3,_0x49c4('0xb3'),_0x1ef0c1[_0x49c4('0xa2')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3['countcongestionretry']++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countcongestionretry':_0x5d24f3[_0x49c4('0xb3')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'CANCEL':_0x1ef0c1[_0x49c4('0xba')]+=0x1;_0x5d24f3[_0x49c4('0xbb')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x14,_0x49c4('0xbc'));_0x6b2592=_0x1ef0c1['dialAgentRejectRetryFrequency'];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xbd'),ut[_0x49c4('0x7b')](_0x5d24f3,'agentreject'));rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xbe'));_0xa431d['verifyAdditionalPhones'](_0x5d24f3,'20',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x532ba5){_0x23288e=_0x532ba5[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0xf7a10f,_0x49c4('0xbf'));}else{if(_0x5d24f3[_0x49c4('0xbb')]>=_0x1ef0c1[_0x49c4('0xc0')]){rpcDb['createCustomerFinal'](_0x5d24f3,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x49c4('0xab')](ut['scheduledAt'](_0x5d24f3,'countagentrejectretry',_0x1ef0c1[_0x49c4('0xc1')]),_0x5d24f3['unlockAgent'],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})['then'](function(){_0xa431d['swapAdditionalPhones'](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'ABANDONED':_0x1ef0c1[_0x49c4('0xc2')]+=0x1;_0x5d24f3[_0x49c4('0xc3')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0xb,_0x49c4('0xc4'));rpcDb[_0x49c4('0x6d')](_0x5d24f3,'[callProgressDetectingCustomer][logAbandoned]');_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'11',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x85418e){_0x23288e=_0x85418e[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,'Global');rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xc5'));}else{if(_0x5d24f3[_0x49c4('0xc6')]>=_0x1ef0c1[_0x49c4('0xc7')]){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xc5'));}else{rpcDb[_0x49c4('0xab')](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0xc3'),_0x1ef0c1[_0x49c4('0xc8')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3['activeContact']);}}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case'18':_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0xca')]+=0x1;_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x12,_0x207572['cause-txt']||_0x207572['dialstatus']);ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xcc')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xcd'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'18',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x2b6e61){_0x23288e=_0x2b6e61[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0x12,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xcd'));}else{rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xcd'));}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3['countnoanswerretry']}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});delete this[_0x49c4('0x13')][_0x207572['linkedid']];break;case'19':_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x13,_0x207572[_0x49c4('0xce')]||_0x207572['dialstatus']);ami['emit']('custom:amd',ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xcc')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xcf'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'18',_0x1ef0c1)['then'](function(_0x3ea304){_0x23288e=_0x3ea304[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xcf'));}else{rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xcf'));}}else{_0x5d24f3['countnoanswerretry']++;_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})['then'](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});delete this[_0x49c4('0x13')][_0x207572['linkedid']];break;default:if(_0x5d24f3[_0x49c4('0x50')]){ut['decrementTalkink'](_0x1ef0c1,'[default]');ut[_0x49c4('0x52')](_0x49c4('0xd0')+_0x1ef0c1['name'],_0x207572);}_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0xc,_0x207572[_0x49c4('0xce')]||_0x207572[_0x49c4('0xd1')]);_0x6b2592=_0x1ef0c1[_0x49c4('0xc1')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];rpcDb['createCustomerHistory'](_0x5d24f3,'[callProgressDetectingCustomer][logUnknown]');_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'20',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x42f2db){_0x23288e=_0x42f2db['additional']==0x1;if(!_0x23288e){if(ut['totalGlobal'](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xd2'));}else{rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xd2'));}delete this[_0x49c4('0x13')][_0x207572[_0x49c4('0x88')]];}else{_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});}});}if(!(_0x5d24f3[_0x49c4('0x50')]&&_0x73840f==='16')){ut[_0x49c4('0x4e')](_0x1ef0c1,_0x49c4('0xd3'));logger['info'](_0x49c4('0xd4'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],'originated:\x20',_0x1ef0c1['originated']);}if(_0x73840f!==_0x49c4('0xd5')){delete this['actions'][_0x207572[_0x49c4('0x88')]];delete this[_0x49c4('0x13')][_0x207572[_0x49c4('0xd6')]];}_0x1ef0c1[_0x49c4('0xd7')]=!![];}};Preview[_0x49c4('0x31')][_0x49c4('0xd8')]=function(_0x3238e7,_0xe9e187,_0x31ba95){if(_[_0x49c4('0xd9')](_0xe9e187)&&_0x49c4('0xda')!==typeof _0xe9e187){return;}if(_[_0x49c4('0xd9')](_0x31ba95)&&'object'!==typeof _0x31ba95){return;}switch(_0x31ba95[_0x49c4('0xdb')]){case'0':ut[_0x49c4('0xdc')](_0x3238e7,0x0,_0x49c4('0xdd'));rpcDb['createAgentHistory'](_0x3238e7,_0x49c4('0xde'));break;case'3':ut['logAgent'](_0x3238e7,0x3,_0x49c4('0xaf'));rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe0'));break;case'5':ut[_0x49c4('0xdc')](_0x3238e7,0x5,'Busy');rpcDb[_0x49c4('0xdf')](_0x3238e7,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3238e7,0x8,_0x49c4('0xb4'));rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe1'));break;case'22':ut['logAgent'](_0x3238e7,0x16,'AnswerAGI');rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe2'));break;default:ut[_0x49c4('0xdc')](_0x3238e7,0xc,_0x31ba95[_0x49c4('0xdb')]);rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe1'));}ut[_0x49c4('0x4e')](_0xe9e187,_0x49c4('0xe3'));logger[_0x49c4('0x24')]('[originated][decrement][callProgressDetectingAgent]',_0x3238e7[_0x49c4('0x8f')],_0x49c4('0x90'),_0xe9e187['name'],'originated:\x20',_0xe9e187[_0x49c4('0xe4')]);delete this['actions'][_0x3238e7[_0x49c4('0x8f')]];};Preview['prototype'][_0x49c4('0x7e')]=function(_0x4b83a6,_0x30781e,_0x1fb51e){return cmHopperAdditionalPhone[_0x49c4('0x7e')](_0x4b83a6,_0x30781e,_0x1fb51e)[_0x49c4('0x63')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0x49c4('0x31')][_0x49c4('0xac')]=function(_0x3ce256,_0x5737b4,_0x367d3d){return cmHopperAdditionalPhone[_0x49c4('0xac')](_0x3ce256,_0x5737b4,_0x367d3d)['catch'](logger['info'](_0x49c4('0xe5')));};Preview[_0x49c4('0x31')][_0x49c4('0x8b')]=function(_0x49dc8a){return Promise[_0x49c4('0xe6')]()[_0x49c4('0x5a')](cmHopperAdditionalPhone[_0x49c4('0x8b')](_0x49dc8a))[_0x49c4('0x63')](logger['info'](_0x49c4('0xe7')));};Preview['prototype']['checkInBlack']=function(_0xf5f718,_0x171530,_0x12fda9,_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new Promise(function(_0x947dd8,_0xa6f48){if(_[_0x49c4('0xe8')](_0x171530)||_['isNil'](_0x171530[_0x49c4('0xe9')])||_['isNil'](_0x171530['phone'])||_[_0x49c4('0xe8')](_0x171530[_0x49c4('0x48')])){_0xa6f48(ut[_0x49c4('0x29')]('Contact\x20is\x20undefined',_0x24ff20,_0x5adb90));return;}var _0x336853=uuid['v4']();var _0x4a874a=_0x32b6e4[_0x49c4('0x10')][_0x171530[_0x49c4('0x3f')][_0x49c4('0x91')]];var _0x3738d7=_0x12fda9?_0x32b6e4[_0x49c4('0x14')][_0x12fda9]['id']:undefined;_0x32b6e4[_0x49c4('0x13')][_0x336853]=new Action(_0x171530,_0x4a874a,_0x336853,_0x12fda9,_0x3738d7);var _0x2b31ac=_0x32b6e4['actions'][_0x336853];_0x2b31ac[_0x49c4('0x86')]=_0x24ff20;_0x2b31ac[_0x49c4('0x87')]=_0x5adb90;_0x2b31ac[_0x49c4('0xea')]=_0x12fda9;if(_[_0x49c4('0xeb')](_0xf5f718)){_0x32b6e4['execCall'](_0x2b31ac,_0x4a874a,_0x171530,_0x12fda9)['then'](function(_0x4c15ff){logger[_0x49c4('0x24')](_0x49c4('0xec'),_0x49c4('0xed')+_0x2b31ac[_0x49c4('0x40')]+_0x49c4('0xee')+_0x2b31ac[_0x49c4('0x8a')],JSON[_0x49c4('0x42')](_0x4c15ff));ami['emit'](_0x49c4('0xef'),ut[_0x49c4('0x7b')](_0x2b31ac,'called',_0x32b6e4['campaignsPreview'][_0x2b31ac['queue']]));_0x947dd8(ut[_0x49c4('0x29')](_0x49c4('0xf0')));})[_0x49c4('0x63')](function(_0x3d0013){ut[_0x49c4('0x2c')](_0x49c4('0xf1'),_0x3d0013);_0xa6f48(ut[_0x49c4('0x29')]('Call\x20failed',_0x24ff20,_0x5adb90));});}else{_0x4a874a[_0x49c4('0xf2')]+=0x1;ut[_0x49c4('0xf3')](_0x2b31ac);rpcDb[_0x49c4('0xf4')](_0x2b31ac,_0x49c4('0xf5'));delete _0x32b6e4['actions'][_0x336853];_0xa6f48(ut[_0x49c4('0x29')](_0x49c4('0xf6'),_0x24ff20,_0x5adb90));}});};Preview[_0x49c4('0x31')][_0x49c4('0x74')]=function(_0x12d707){return!_['isNil'](_0x12d707)&&!_[_0x49c4('0xe8')](_0x12d707['name'])&&!_['isNil'](_0x12d707[_0x49c4('0xf7')])&&_0x12d707[_0x49c4('0xf7')]&&!_[_0x49c4('0xe8')](this[_0x49c4('0x12')][util[_0x49c4('0x65')]('SIP/%s',_0x12d707[_0x49c4('0x91')])])&&!_[_0x49c4('0xe8')](this[_0x49c4('0x12')][util['format'](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])]['status'])&&(this[_0x49c4('0x12')][util[_0x49c4('0x65')](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])][_0x49c4('0x4b')]===_0x49c4('0xf9')||this[_0x49c4('0x12')][util['format'](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])][_0x49c4('0x4b')]===_0x49c4('0xfa'));};Preview[_0x49c4('0x31')]['run']=function(_0x34ce60,_0x39dc83){return this[_0x49c4('0xfb')](_0x34ce60,_0x39dc83)[_0x49c4('0x5a')](function(_0xa2c8cf){return _['pick'](_0xa2c8cf,[_0x49c4('0x29')]);})[_0x49c4('0x63')](function(_0x789121){if(_0x789121[_0x49c4('0xfc')]){rpcDb[_0x49c4('0xfd')](_0x34ce60);}if(_0x789121[_0x49c4('0xf7')]){rpcDb[_0x49c4('0x64')](_0x34ce60);}throw _[_0x49c4('0x45')](_0x789121,[_0x49c4('0x29')]);});};Preview[_0x49c4('0x31')]['execRun']=function(_0x2d3211,_0x1b6966){var _0x2c4d2a=this;var _0x1745f8,_0xe22808;return rpcDb['getContactPreview'](_0x2d3211)['then'](function(_0x13aab1){if(!_[_0x49c4('0xe8')](_0x13aab1[0x0])){_0xe22808=_0x13aab1[0x0][_0x49c4('0xfe')]?![]:!![];_0x1745f8=_0x13aab1[0x0][_0x49c4('0xfe')]?!![]:![];_0x1745f8=_0x1b6966?!![]:_0x1745f8;}var _0xd87f7e=_0x2c4d2a[_0x49c4('0xff')](_0x13aab1);if(_0xd87f7e['isValid']){rpcDb[_0x49c4('0x100')](_[_0x49c4('0x45')](_0x13aab1[0x0],['VoiceQueueId',_0x49c4('0x101')]))['then'](function(_0x30d99a){_0x2c4d2a[_0x49c4('0x102')](_0x30d99a,_0x13aab1[0x0],_0x1b6966,_0xe22808,_0x1745f8)[_0x49c4('0x5a')](function(_0x5db4a1){return _0x5db4a1;})[_0x49c4('0x63')](function(_0x4f431e){throw _0x4f431e;});})[_0x49c4('0x63')](function(_0x5025ee){ut['logger'](_0x49c4('0x103'),_0x5025ee);throw ut[_0x49c4('0x29')](_0x49c4('0x104'),_0xe22808,_0x1745f8);});}else{throw ut[_0x49c4('0x29')](_0xd87f7e[_0x49c4('0x29')],_0xe22808,_0x1745f8);}})[_0x49c4('0x63')](function(_0x5a06d7){ut['logger'](_0x49c4('0x105'),_0x5a06d7);throw ut[_0x49c4('0x29')](_0x49c4('0x104'),![],!![]);});};Preview[_0x49c4('0x31')][_0x49c4('0xff')]=function(_0x3d2dd0){if(_[_0x49c4('0xe8')](_0x3d2dd0)||_['isEmpty'](_0x3d2dd0)||!_['isNil'](_0x3d2dd0[0x0]['Agent'])&&_['isNil'](_0x3d2dd0[0x0][_0x49c4('0x5f')]['name'])){ut[_0x49c4('0x2c')](_0x49c4('0x106'),_0x3d2dd0);return{'isValid':![],'message':_0x49c4('0x107')};}var _0x53dd04=this['campaignsPreview'][_0x3d2dd0[0x0][_0x49c4('0x3f')][_0x49c4('0x91')]];_0x53dd04['message']=utils[_0x49c4('0x2a')][_0x49c4('0x76')];if(_[_0x49c4('0xe8')](_0x53dd04)){ut[_0x49c4('0x2c')](_0x49c4('0x108'),_0x53dd04);return{'isValid':![],'message':_0x49c4('0x109')};}if(!this['isTrunkReachable'](_0x53dd04[_0x49c4('0x10a')])){ut[_0x49c4('0x2c')](_0x49c4('0x10b'),'campaign\x20Name:\x20'+_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x10c'));if(!this[_0x49c4('0x74')](_0x53dd04[_0x49c4('0x10d')])){ut[_0x49c4('0x2c')](_0x49c4('0x10b'),_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x49c4('0x73')](_0x53dd04[_0x49c4('0x39')])){ut[_0x49c4('0x2c')](_0x49c4('0x10f'),_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x110')};}return{'isValid':!![],'message':_0x49c4('0x111')};};Preview[_0x49c4('0x31')][_0x49c4('0x112')]=function(_0x3a8fe1,_0x29c6fc,_0x1642fd,_0x4806ac){var _0xc641bc=this;return new Promise(function(_0xcec186,_0x1c8258){var _0x471e28=_0x3a8fe1[_0x49c4('0x8f')];var _0x5a471d=_0xc641bc['isTrunkReachable'](_0x29c6fc[_0x49c4('0x10a')])?util[_0x49c4('0x65')]('SIP/%s/%s%s',_0x29c6fc['Trunk'][_0x49c4('0x91')],_['isNil'](_0x29c6fc[_0x49c4('0x113')])?'':_0x29c6fc[_0x49c4('0x113')][_0x49c4('0x114')]()||'',_0x29c6fc[_0x49c4('0x115')]>0x0?_0x1642fd[_0x49c4('0x101')][_0x49c4('0x116')](_0x29c6fc[_0x49c4('0x115')]):_0x1642fd[_0x49c4('0x101')]):util['format'](_0x49c4('0x117'),_[_0x49c4('0xe8')](_0x29c6fc[_0x49c4('0x10d')])?_0x29c6fc[_0x49c4('0x10a')][_0x49c4('0x91')]:_0x29c6fc['TrunkBackup'][_0x49c4('0x91')],_[_0x49c4('0xe8')](_0x29c6fc['dialPrefix'])?'':_0x29c6fc[_0x49c4('0x113')][_0x49c4('0x114')]()||'',_0x29c6fc['dialCutDigit']>0x0?_0x1642fd[_0x49c4('0x101')][_0x49c4('0x116')](_0x29c6fc[_0x49c4('0x115')]):_0x1642fd['phone']);var _0x1ee36e=_0xc641bc[_0x49c4('0x74')](_0x29c6fc[_0x49c4('0x10a')])?ut[_0x49c4('0x118')](_0x29c6fc['Trunk'][_0x49c4('0x119')],_0x29c6fc['dialOriginateCallerIdName'],_0x29c6fc[_0x49c4('0x11a')]>0x0?ut[_0x49c4('0x11b')](_0x29c6fc[_0x49c4('0x11c')],_0x29c6fc[_0x49c4('0x11a')]):_0x29c6fc['dialOriginateCallerIdNumber']):ut[_0x49c4('0x118')](_[_0x49c4('0xe8')](_0x29c6fc[_0x49c4('0x10d')])?_0x29c6fc[_0x49c4('0x10a')][_0x49c4('0x119')]:_0x29c6fc[_0x49c4('0x10d')]['callerid'],_0x29c6fc['dialOriginateCallerIdName'],_0x29c6fc[_0x49c4('0x11a')]>0x0?ut[_0x49c4('0x11b')](_0x29c6fc[_0x49c4('0x11c')],_0x29c6fc[_0x49c4('0x11a')]):_0x29c6fc[_0x49c4('0x11c')]);if(_0x1ee36e){_0x3a8fe1[_0x49c4('0x11d')]=ut[_0x49c4('0x11e')](_0x1ee36e);_0x3a8fe1[_0x49c4('0x11f')]=ut[_0x49c4('0x120')](_0x1ee36e);}var _0x37dbbf=ut[_0x49c4('0x121')](_0x29c6fc,_0x1642fd,_0x5a471d,_0x1ee36e,_0x471e28,_0x3a8fe1);_[_0x49c4('0x122')](_0x3a8fe1,ut['toLowerVariables'](_0x37dbbf));_0x3a8fe1[_0x49c4('0x123')]=moment()[_0x49c4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x29c6fc[_0x49c4('0x124')]=_0x37dbbf;var _0x5adc01=ut[_0x49c4('0x125')](_0x3a8fe1,_0x29c6fc,_0x37dbbf,_0x3a8fe1[_0x49c4('0x87')],_0x4806ac);return ami['Action'](_0x5adc01)[_0x49c4('0x5a')](function(_0x245fae){_0x29c6fc[_0x49c4('0xe4')]+=0x1;logger[_0x49c4('0x24')](_0x49c4('0x126'),_0x471e28,'\x20Queue',_0x29c6fc[_0x49c4('0x91')],'originated:\x20',_0x29c6fc[_0x49c4('0xe4')]);_0xcec186(_0x245fae);})[_0x49c4('0x63')](function(_0x294b2c){ut['logAgent'](_0x3a8fe1,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xdf')](_0x3a8fe1,_0x49c4('0x128'));_0x1c8258(_0x294b2c);});});};Preview['prototype']['syncNewExten']=function(_0x256d6b){if(this[_0x49c4('0x13')][_0x256d6b[_0x49c4('0x88')]]){this[_0x49c4('0x13')][_0x256d6b[_0x49c4('0x88')]][_0x49c4('0x4c')]=_0x256d6b['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x2eae62){var _0x417cef=this;var _0x153450=this[_0x49c4('0x13')][_0x2eae62['actionid']];if(_0x153450){if(_0x153450[_0x49c4('0xea')]&&this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]]){ut[_0x49c4('0x129')](_0x153450,this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]][_0x49c4('0x91')],this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]]['id']);}var _0x39e6f5=_[_0x49c4('0x12a')](_0x153450);_0x39e6f5['responsetime']=moment()[_0x49c4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3308c4=_0x417cef[_0x49c4('0x10')][_0x153450[_0x49c4('0x40')]];if(ut[_0x49c4('0x12b')](_0x2eae62['response'])){if(_0x153450[_0x49c4('0x86')]){rpcDb['unlockContact'](_0x153450['idContact']);}if(_0x153450['activeContact']){rpcDb[_0x49c4('0x64')](_0x153450[_0x49c4('0x8a')]);}ami[_0x49c4('0x23')]('custom:agentringnoanswer',ut[_0x49c4('0x7b')](_0x153450,'rejected',this[_0x49c4('0x10')][_0x153450[_0x49c4('0x40')]]));this[_0x49c4('0xd8')](_0x39e6f5,_0x3308c4,_0x2eae62);}else{_0x153450['starttime']=moment()[_0x49c4('0x65')](_0x49c4('0x66'));ut[_0x49c4('0xdc')](_0x39e6f5,0x4,_0x49c4('0x12c'));rpcDb[_0x49c4('0xdf')](_0x39e6f5,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x49c4('0x31')][_0x49c4('0x1a')]=function(_0x15e35f){var _0x6b1554=this['actions'][_0x15e35f['linkedid']];var _0x238884;if(_0x6b1554){_0x238884=this[_0x49c4('0x10')][_0x6b1554['queue']];logger[_0x49c4('0x24')](_0x49c4('0x12d'),_0x15e35f[_0x49c4('0x88')],_0x49c4('0x90'),_0x238884['name'],_0x49c4('0x43'),_0x238884[_0x49c4('0x44')]);}if(this['actions'][_0x15e35f['linkedid']]&&_0x15e35f[_0x49c4('0x88')]!==_0x15e35f[_0x49c4('0x8f')]){if(_0x15e35f[_0x49c4('0x12e')]==='16'&&this[_0x49c4('0x13')][_0x15e35f[_0x49c4('0x88')]]['dialAnswer']){this[_0x49c4('0x77')](_0x15e35f,_0x15e35f['linkedid'],_0x15e35f[_0x49c4('0x12e')]);}else if(this[_0x49c4('0x13')][_0x15e35f[_0x49c4('0x88')]][_0x49c4('0x50')]){logger['info']('[syncHangup][talking][cause]',_0x15e35f['linkedid'],_0x15e35f[_0x49c4('0x12e')],_0x49c4('0x90'),_0x238884[_0x49c4('0x91')],_0x49c4('0x43'),_0x238884['pTalking']);this['callProgressDetectingCustomer'](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f['cause']);}}else if(_0x6b1554&&_[_0x49c4('0xe8')](_0x6b1554[_0x49c4('0x12f')])&&_0x238884['dialQueueProject']&&_0x15e35f[_0x49c4('0x88')]===_0x15e35f[_0x49c4('0x8f')]&&_[_0x49c4('0xe8')](_0x15e35f['reason'])&&_0x15e35f[_0x49c4('0x12e')]==='16'&&_0x15e35f[_0x49c4('0x130')]==='6'&&_[_0x49c4('0xd9')](_0x6b1554['transfer'])){if(_0x6b1554[_0x49c4('0x86')]){rpcDb[_0x49c4('0xfd')](_0x6b1554['idContact']);}if(_0x6b1554[_0x49c4('0x87')]){rpcDb[_0x49c4('0x64')](_0x6b1554['idContact']);}_0x15e35f[_0x49c4('0xdb')]='22';this[_0x49c4('0xd8')](_0x6b1554,_0x238884,_0x15e35f);}else if(_0x6b1554&&_0x6b1554[_0x49c4('0x131')]){if(_0x15e35f[_0x49c4('0x12e')]==='16'&&this[_0x49c4('0x13')][_0x15e35f['linkedid']][_0x49c4('0x50')]){logger[_0x49c4('0x24')]('[syncHangup][talking][transfer]',_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')],_0x49c4('0x90'),_0x238884['name'],_0x49c4('0x43'),_0x238884['pTalking']);this[_0x49c4('0x77')](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f['cause']);}else if(this[_0x49c4('0x13')][_0x15e35f['linkedid']][_0x49c4('0x50')]){logger[_0x49c4('0x24')]('[syncHangup][talking][cause]',_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')],'\x20Queue',_0x238884['name'],_0x49c4('0x43'),_0x238884[_0x49c4('0x44')]);this[_0x49c4('0x77')](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')]);}}};Preview['prototype'][_0x49c4('0x1d')]=function(_0x40afb8){if(this[_0x49c4('0x13')][_0x40afb8[_0x49c4('0xd6')]]&&_0x40afb8[_0x49c4('0xd6')]!==_0x40afb8['destuniqueid']){this[_0x49c4('0x77')](_0x40afb8,_0x40afb8[_0x49c4('0xd6')],_0x40afb8[_0x49c4('0xd1')]);}};Preview[_0x49c4('0x31')][_0x49c4('0x1b')]=function(_0x39abbf){if(this[_0x49c4('0x13')][_0x39abbf[_0x49c4('0x88')]]&&_0x39abbf['linkedid']!==_0x39abbf[_0x49c4('0x8f')]&&!this[_0x49c4('0x13')][_0x39abbf[_0x49c4('0x88')]]['dialAnswer']){if(_0x39abbf['cause']==='1'){this[_0x49c4('0x77')](_0x39abbf,_0x39abbf['linkedid'],_0x39abbf[_0x49c4('0x12e')]);}}};Preview[_0x49c4('0x31')][_0x49c4('0x132')]=function(_0x3f0e74,_0x55f423,_0x3ce0f9){if(this[_0x49c4('0x13')][_0x3f0e74]){if(_[_0x49c4('0xe8')](this[_0x49c4('0x13')][_0x3f0e74]['variables'])){this[_0x49c4('0x13')][_0x3f0e74][_0x49c4('0x124')]={};}this['actions'][_0x3f0e74][_0x49c4('0x124')][_0x55f423]=_0x3ce0f9;}};Preview[_0x49c4('0x31')][_0x49c4('0x133')]=function(_0x72eab6){try{if(!_[_0x49c4('0xe8')](_0x72eab6)){if(ut[_0x49c4('0x134')](_[_0x49c4('0x135')](_0x72eab6[_0x49c4('0x136')])[0x0])){this['addVariable'](_0x72eab6['uniqueid'],_['keys'](_0x72eab6[_0x49c4('0x136')])[0x0],_0x72eab6[_0x49c4('0x137')]);}}}catch(_0x418ead){logger[_0x49c4('0x138')](_0x49c4('0x139'),util['inspect'](_0x418ead,{'showHidden':![],'depth':null}));}};Preview[_0x49c4('0x31')][_0x49c4('0x20')]=function(_0x9786bf){if(_0x9786bf){if(this[_0x49c4('0x13')][_0x9786bf['transfertargetlinkedid']]){this['actions'][_0x9786bf[_0x49c4('0x13a')]][_0x49c4('0x131')]=!![];}}};Preview[_0x49c4('0x31')][_0x49c4('0x13b')]=function(_0x281151){if(_0x281151){if(this[_0x49c4('0x13')][_0x281151['transfererlinkedid']]){this['actions'][_0x281151[_0x49c4('0x13c')]][_0x49c4('0x131')]=!![];}}};module[_0x49c4('0x13d')]=Preview; \ No newline at end of file +var _0x6aa7=['\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','exports','util','uuid','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','hangup','bind','hanguprequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','syncCampaigns','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','setMessage','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','stringify','dialAnswer','pick','contactId','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','logger2','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','dialActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','logCustomer','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','complete','total','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','pTalking:\x20','linkedid','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','activeContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','verifyAdditionalPhones','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','loggerError','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','queueSummaryCountersUpdated','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','SIP/%s','reachable','unmonitored','execRun','unlockContact','active','getContactPreview','recallme','validateContact','checkIsBlackList','VoiceQueueId','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Campaign'];(function(_0x13bb74,_0x28fd9d){var _0x29b47c=function(_0x316126){while(--_0x316126){_0x13bb74['push'](_0x13bb74['shift']());}};_0x29b47c(++_0x28fd9d);}(_0x6aa7,0x178));var _0x76aa=function(_0x517dac,_0x3b9bb5){_0x517dac=_0x517dac-0x0;var _0x4de598=_0x6aa7[_0x517dac];return _0x4de598;};'use strict';var util=require(_0x76aa('0x0'));var _=require('lodash');var uuid=require(_0x76aa('0x1'));var moment=require(_0x76aa('0x2'));var Redis=require(_0x76aa('0x3'));var config=require(_0x76aa('0x4'));var logger=require('../../../config/logger')(_0x76aa('0x5'));var loggerAction=require(_0x76aa('0x6'))(_0x76aa('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x76aa('0x8'));var Action=require('./action');var ut=require(_0x76aa('0x9'));var utils=require(_0x76aa('0xa'));config[_0x76aa('0xb')]=_['defaults'](config[_0x76aa('0xb')],{'host':_0x76aa('0xc'),'port':0x18eb});var io=require(_0x76aa('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x76aa('0xe')][_0x76aa('0xf')]=function(_0x41643a){this[_0x76aa('0x10')]=this[_0x76aa('0x10')]?this[_0x76aa('0x10')][_0x76aa('0x11')](_0x41643a):_0x41643a();};function Preview(_0x8dc35c){this[_0x76aa('0x12')]=new Sequence();this[_0x76aa('0x13')]=_0x8dc35c['voiceQueues'];this[_0x76aa('0x14')]=_0x8dc35c['trunks'];this[_0x76aa('0x15')]={};this[_0x76aa('0x16')]=_0x8dc35c[_0x76aa('0x16')];this[_0x76aa('0x17')]=0x0;ami['on'](_0x76aa('0x18'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x76aa('0x19'),this['syncHangup'][_0x76aa('0x1a')](this));ami['on'](_0x76aa('0x1b'),this['syncHangupRequest'][_0x76aa('0x1a')](this));ami['on']('dialend',this[_0x76aa('0x1c')]['bind'](this));ami['on'](_0x76aa('0x1d'),this[_0x76aa('0x1e')][_0x76aa('0x1a')](this));ami['on'](_0x76aa('0x1f'),this[_0x76aa('0x20')][_0x76aa('0x1a')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x76aa('0x1a')](this));ami['on'](_0x76aa('0x21'),this[_0x76aa('0x22')][_0x76aa('0x1a')](this));this[_0x76aa('0x23')](this[_0x76aa('0x13')]);}function emit(_0x19af92,_0x2eaf48,_0x385157){io['to'](_0x19af92)['emit'](_0x2eaf48,_0x385157);}function emitVoiceQueueChannelRemove(_0x39ac5a){logger[_0x76aa('0x24')](_0x76aa('0x25'),JSON['stringify'](_0x39ac5a));emit(util[_0x76aa('0x26')](_0x76aa('0x27'),_0x39ac5a[_0x76aa('0x28')]),_0x76aa('0x29'),_0x39ac5a);io[_0x76aa('0x2a')](_0x76aa('0x2b'),_0x39ac5a);}function notSendMessagesQueue(_0x3cd039){if(_0x3cd039[_0x76aa('0x2c')]){if(_0x3cd039[_0x76aa('0x2d')]===0x0&&_0x3cd039[_0x76aa('0x2e')]===0x0){_0x3cd039[_0x76aa('0x2c')]=![];_0x3cd039[_0x76aa('0x2f')]=0x0;_0x3cd039[_0x76aa('0x30')]=0x0;_0x3cd039['message']=utils[_0x76aa('0x31')][_0x76aa('0x32')];ut[_0x76aa('0x33')](_0x76aa('0x34'),_0x3cd039[_0x76aa('0x28')]+_0x76aa('0x35'));}else{_0x3cd039[_0x76aa('0x36')]=utils[_0x76aa('0x31')][_0x76aa('0x37')];ut[_0x76aa('0x33')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3cd039[_0x76aa('0x28')]+'\x20is\x20deactivated');}}}Preview[_0x76aa('0xe')][_0x76aa('0x23')]=function(){var _0x2dec94=this;setInterval(function(){_0x2dec94[_0x76aa('0x38')]();},0x7cf);};Preview[_0x76aa('0xe')][_0x76aa('0x38')]=function(){var _0x2ee0f9=this[_0x76aa('0x13')];this[_0x76aa('0x17')]+=0x1;for(var _0x3ea05a in _0x2ee0f9){if(_0x2ee0f9['hasOwnProperty'](_0x3ea05a)&&(_0x2ee0f9[_0x3ea05a][_0x76aa('0x39')]===_0x76aa('0x5')||_0x2ee0f9[_0x3ea05a][_0x76aa('0x39')]===_0x76aa('0x3a'))&&_0x2ee0f9[_0x3ea05a][_0x76aa('0x3b')]===_0x76aa('0x3c')){if(this[_0x76aa('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x76aa('0x3d')]();}}if(_0x2ee0f9[_0x76aa('0x3e')](_0x3ea05a)&&_0x2ee0f9[_0x3ea05a]['dialMethod']===_0x76aa('0x5')&&_0x2ee0f9[_0x3ea05a]['type']===_0x76aa('0x3c')){if(_0x2ee0f9[_0x3ea05a]['dialActive']){this[_0x76aa('0x3f')](_0x2ee0f9[_0x3ea05a]);if(_0x2ee0f9[_0x3ea05a]['dialPreviewAutoRecallMe'])this['recallMe'](_0x2ee0f9[_0x3ea05a]);}else{notSendMessagesQueue(_0x2ee0f9[_0x3ea05a]);}}}};Preview[_0x76aa('0xe')][_0x76aa('0x40')]=function(_0x198fcb){var _0x37dfab=this;this['sequence']['enqueue'](function(){if(!_[_0x76aa('0x41')](_0x37dfab[_0x76aa('0x15')][_0x198fcb])){loggerAction[_0x76aa('0x24')](_0x76aa('0x42'),_0x198fcb,_0x76aa('0x43'),_0x37dfab['actions'][_0x198fcb][_0x76aa('0x44')],'originated:\x20',JSON['stringify'](_0x37dfab[_0x76aa('0x13')][_0x37dfab[_0x76aa('0x15')][_0x198fcb][_0x76aa('0x44')]][_0x76aa('0x2d')]),'pTalking:\x20',JSON[_0x76aa('0x45')](_0x37dfab[_0x76aa('0x13')][_0x37dfab[_0x76aa('0x15')][_0x198fcb]['queue']][_0x76aa('0x2e')]),JSON[_0x76aa('0x45')](_0x37dfab[_0x76aa('0x15')][_0x198fcb][_0x76aa('0x46')]),JSON[_0x76aa('0x45')](_[_0x76aa('0x47')](_0x37dfab[_0x76aa('0x15')][_0x198fcb],[_0x76aa('0x48'),_0x76aa('0x49'),'VoiceQueueId',_0x76aa('0x4a')])));return ami[_0x76aa('0x4b')]({'action':_0x76aa('0x4c'),'channel':_0x37dfab[_0x76aa('0x15')][_0x198fcb][_0x76aa('0x4d')]})[_0x76aa('0x4e')](function(_0x572fdb){if(_0x572fdb['message']===_0x76aa('0x4f')){setTimeout(function(){if(_0x37dfab[_0x76aa('0x15')][_0x198fcb]){ut[_0x76aa('0x50')](_0x37dfab[_0x76aa('0x13')][_0x37dfab['actions'][_0x198fcb][_0x76aa('0x44')]],_0x76aa('0x51'));if(_0x37dfab[_0x76aa('0x15')][_0x198fcb][_0x76aa('0x46')]===!![]){ut[_0x76aa('0x52')](_0x37dfab['campaignsPreview'][_0x37dfab[_0x76aa('0x15')][_0x198fcb]['queue']],_0x76aa('0x51'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x198fcb,_0x37dfab['actions'][_0x198fcb][_0x76aa('0x44')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x198fcb,_0x37dfab['actions'][_0x198fcb][_0x76aa('0x44')]);delete _0x37dfab[_0x76aa('0x15')][_0x198fcb];}},0x2328);}});}});};Preview[_0x76aa('0xe')][_0x76aa('0x3d')]=function(){var _0x27a52e=this;loggerAction['info'](_0x76aa('0x53'),_[_0x76aa('0x54')](this[_0x76aa('0x15')]));for(var _0x2d6b7f in this[_0x76aa('0x15')]){if(_0x27a52e['actions'][_0x76aa('0x3e')](_0x2d6b7f)){_0x27a52e[_0x76aa('0x40')](_0x2d6b7f);}}};Preview['prototype'][_0x76aa('0x55')]=function(_0x5a984e){var _0x3aa858=this;rpcDb[_0x76aa('0x56')](_0x5a984e['id'],ut[_0x76aa('0x57')](this[_0x76aa('0x16')]))[_0x76aa('0x58')](function(_0x3e0315){if(!_[_0x76aa('0x41')](_0x3e0315)){for(var _0x165858=0x0;_0x165858<_0x3e0315[_0x76aa('0x59')];_0x165858+=0x1){if(ut[_0x76aa('0x5a')](_0x3e0315[_0x165858]['scheduledat'])<_0x5a984e[_0x76aa('0x5b')]*0x3c){if(_0x3e0315[_0x165858]['Agent']&&!_0x3e0315[_0x165858][_0x76aa('0x5c')][_0x76aa('0x5d')]){_0x3aa858[_0x76aa('0x5e')](_0x3e0315[_0x165858]['id'])[_0x76aa('0x58')](ut['logger2']('[RecallMe]'))[_0x76aa('0x4e')](ut['logger2'](_0x76aa('0x5f')));}else{rpcDb[_0x76aa('0x60')](_0x3e0315[_0x165858]['id']);}}else{var _0x4315b3=new Action(_0x3e0315[_0x165858],_0x5a984e);_0x4315b3[_0x76aa('0x61')]=moment()[_0x76aa('0x26')](_0x76aa('0x62'));_0x5a984e['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x4315b3,0x17,_0x76aa('0x63'));if(_0x5a984e[_0x76aa('0x64')]){rpcDb[_0x76aa('0x65')](ut[_0x76aa('0x66')](_0x3e0315[_0x165858]));rpcDb[_0x76aa('0x67')](_0x4315b3,_0x76aa('0x68'));}else{ut['logCustomer'](_0x4315b3,0x16,_0x76aa('0x69'));rpcDb[_0x76aa('0x67')](_0x4315b3,_0x76aa('0x6a'));rpcDb['createCustomerFinal'](_0x4315b3,_0x76aa('0x6a'));}}}}})['catch'](ut[_0x76aa('0x6b')]('[getContactRecallMe]'));};Preview[_0x76aa('0xe')][_0x76aa('0x3f')]=function(_0x3c63e5){_0x3c63e5[_0x76aa('0x2c')]=!![];if(ut[_0x76aa('0x6c')](_0x3c63e5[_0x76aa('0x6d')])){_0x3c63e5[_0x76aa('0x36')]=utils['CAMPAIGN_STATUS'][_0x76aa('0x6e')];}else if(!ut['isActive'](_0x3c63e5[_0x76aa('0x6f')])){_0x3c63e5[_0x76aa('0x36')]=utils[_0x76aa('0x31')][_0x76aa('0x32')];}else if(!this[_0x76aa('0x70')](_0x3c63e5[_0x76aa('0x71')])){if(!this[_0x76aa('0x70')](_0x3c63e5['TrunkBackup'])){_0x3c63e5[_0x76aa('0x36')]=utils[_0x76aa('0x31')][_0x76aa('0x72')];}else{_0x3c63e5[_0x76aa('0x36')]=utils['CAMPAIGN_STATUS'][_0x76aa('0x73')];}}else{_0x3c63e5[_0x76aa('0x36')]=utils[_0x76aa('0x31')][_0x76aa('0x73')];}};Preview[_0x76aa('0xe')][_0x76aa('0x74')]=function(_0x4e6c09,_0x295b2c,_0xbf78c7){var _0x2886eb=this;var _0x3620d0=this[_0x76aa('0x15')][_0x295b2c];var _0x2fdc4f=this[_0x76aa('0x13')][_0x3620d0['queue']];var _0x4910fb;var _0x2c59a6=![];var _0x3b0d8a=0x2;var _0x5713e7=0x3;if(_0x2fdc4f){switch(_0xbf78c7){case'1':_0x2fdc4f[_0x76aa('0x75')]+=0x1;_0x3620d0[_0x76aa('0x76')]+=0x1;_0x3620d0['countglobal']=ut[_0x76aa('0x77')](_0x3620d0);ut[_0x76aa('0x78')](_0x3620d0,0x0,_0x76aa('0x79'));ami[_0x76aa('0x2a')](_0x76aa('0x7a'),ut[_0x76aa('0x7b')](_0x3620d0,_0x76aa('0x7c')));rpcDb[_0x76aa('0x67')](_0x3620d0,_0x76aa('0x7d'));_0x2886eb['verifyAdditionalPhones'](_0x3620d0,'0',_0x2fdc4f)[_0x76aa('0x58')](function(_0x49156c){_0x2c59a6=_0x49156c[_0x76aa('0x7e')]==0x1;_0x3b0d8a=_0x2fdc4f[_0x76aa('0x7f')];_0x5713e7=_0x2fdc4f[_0x76aa('0x80')];if(!_0x2c59a6){if(ut[_0x76aa('0x77')](_0x3620d0)>=_0x2fdc4f[_0x76aa('0x81')]){_0x4910fb=ut[_0x76aa('0x82')](_0x3620d0,0xf,_0x76aa('0x83'));rpcDb[_0x76aa('0x84')](_0x4910fb,_0x76aa('0x85'));}else{if(_0x3620d0['countnosuchnumberretry']>=_0x2fdc4f[_0x76aa('0x86')]){rpcDb[_0x76aa('0x84')](_0x3620d0,_0x76aa('0x85'));}else{rpcDb[_0x76aa('0x87')](ut[_0x76aa('0x88')](_0x3620d0,_0x76aa('0x76'),_0x2fdc4f[_0x76aa('0x7f')]),_0x3620d0[_0x76aa('0x89')],_0x3620d0['activeContact']);}}delete this[_0x76aa('0x15')][_0x4e6c09['linkedid']];}else{_0x3620d0[_0x76aa('0x76')]++;logger[_0x76aa('0x24')](_0x76aa('0x8a'),_0x3620d0[_0x76aa('0x76')]);logger[_0x76aa('0x24')]('id',_0x3620d0[_0x76aa('0x8b')]);_0x2886eb[_0x76aa('0x8c')]({'id':_0x3620d0['idContact'],'field':{'countnosuchnumberretry':_0x3620d0[_0x76aa('0x76')]}})[_0x76aa('0x58')](function(){_0x2886eb['swapAdditionalPhones'](_0x3620d0,_0x3b0d8a,_0x5713e7)['then'](function(){});});}});break;case _0x76aa('0x8d'):var _0x13389d=moment()['format'](_0x76aa('0x62'));_0x3620d0[_0x76aa('0x8e')]=_0x13389d;_0x3620d0[_0x76aa('0x8f')]=_0x13389d;_0x3620d0['dialAnswer']=!![];_0x2fdc4f[_0x76aa('0x2e')]+=0x1;logger['info'](_0x76aa('0x90'),_0x3620d0[_0x76aa('0x91')],_0x76aa('0x92'),_0x2fdc4f[_0x76aa('0x28')],'pTalking:\x20',_0x2fdc4f['pTalking']);ami[_0x76aa('0x2a')]('custom:agentconnect',ut[_0x76aa('0x7b')](_0x3620d0,_0x76aa('0x93'),this[_0x76aa('0x13')][_0x3620d0[_0x76aa('0x44')]]));if(_0x2fdc4f[_0x76aa('0x94')]){ami[_0x76aa('0x2a')](_0x76aa('0x95'),ut[_0x76aa('0x96')](_0x3620d0));}break;case'16':ami[_0x76aa('0x2a')]('custom:agentcomplete',ut[_0x76aa('0x7b')](_0x3620d0,_0x76aa('0x97'),this[_0x76aa('0x13')][_0x3620d0[_0x76aa('0x44')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x3620d0,'complete'));_0x2fdc4f['outboundAnswerCallsDay']+=0x1;_0x2fdc4f[_0x76aa('0x98')]+=0x1;_0x2fdc4f['answered']+=0x1;ut[_0x76aa('0x52')](_0x2fdc4f,_0x76aa('0x99'));_0x3620d0[_0x76aa('0x9a')]=ut[_0x76aa('0x77')](_0x3620d0);ut['logCustomer'](_0x3620d0,0x4,_0x76aa('0x9b'));rpcDb['createCustomerHistory'](_0x3620d0,_0x76aa('0x9c'));rpcDb[_0x76aa('0x84')](_0x3620d0,_0x76aa('0x9d'));rpcDb[_0x76aa('0x9e')](_0x3620d0);_0x2fdc4f[_0x76aa('0x9f')]+=_0x3620d0['talktime'];_0x2fdc4f[_0x76aa('0xa0')]+=_0x3620d0[_0x76aa('0xa1')];logger[_0x76aa('0x24')](_0x76aa('0xa2'),_0x3620d0[_0x76aa('0x91')],_0x76aa('0x92'),_0x2fdc4f[_0x76aa('0x28')],_0x76aa('0xa3'),_0x2fdc4f['pTalking']);delete this[_0x76aa('0x15')][_0x4e6c09[_0x76aa('0xa4')]];break;case'BUSY':_0x2fdc4f[_0x76aa('0xa5')]+=0x1;_0x3620d0[_0x76aa('0xa6')]+=0x1;_0x3620d0[_0x76aa('0x9a')]=ut[_0x76aa('0x77')](_0x3620d0);ut[_0x76aa('0x78')](_0x3620d0,0x5,_0x76aa('0xa7'));_0x3b0d8a=_0x2fdc4f[_0x76aa('0xa8')];_0x5713e7=_0x2fdc4f['callAdditionalPhoneAfterMin'];ami[_0x76aa('0x2a')]('custom:agentbusy',ut['buildObj'](_0x3620d0,_0x76aa('0xa9')));rpcDb[_0x76aa('0x67')](_0x3620d0,'[callProgressDetectingCustomer][logBusy]');_0x2886eb['verifyAdditionalPhones'](_0x3620d0,'5',_0x2fdc4f)[_0x76aa('0x58')](function(_0x14b5a2){_0x2c59a6=_0x14b5a2[_0x76aa('0x7e')]==0x1;if(!_0x2c59a6){if(ut['totalGlobal'](_0x3620d0)>=_0x2fdc4f['dialGlobalMaxRetry']){_0x4910fb=ut[_0x76aa('0x82')](_0x3620d0,0xf,_0x76aa('0x83'));rpcDb[_0x76aa('0x84')](_0x4910fb,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3620d0[_0x76aa('0xa6')]>=_0x2fdc4f['dialBusyMaxRetry']){rpcDb[_0x76aa('0x84')](_0x3620d0,_0x76aa('0xaa'));}else{rpcDb[_0x76aa('0x87')](ut[_0x76aa('0x88')](_0x3620d0,_0x76aa('0xa6'),_0x2fdc4f['dialBusyRetryFrequency']),_0x3620d0['unlockAgent'],_0x3620d0[_0x76aa('0xab')]);}}}else{_0x3620d0[_0x76aa('0xa6')]++;_0x2886eb[_0x76aa('0x8c')]({'id':_0x3620d0['idContact'],'field':{'countbusyretry':_0x3620d0[_0x76aa('0xa6')]}})[_0x76aa('0x58')](function(){_0x2886eb[_0x76aa('0xac')](_0x3620d0,_0x3b0d8a,_0x5713e7)[_0x76aa('0x58')](function(){});});}});break;case _0x76aa('0xad'):_0x2fdc4f['outboundNoAnswerCallsDay']+=0x1;_0x3620d0[_0x76aa('0xae')]+=0x1;_0x3620d0['countglobal']=ut[_0x76aa('0x77')](_0x3620d0);ut[_0x76aa('0x78')](_0x3620d0,0x3,_0x76aa('0xaf'));_0x3b0d8a=_0x2fdc4f[_0x76aa('0xb0')];_0x5713e7=_0x2fdc4f[_0x76aa('0x80')];var _0x238ecc=ut['buildNoAnswerEventPayload'](_0x3620d0,_0x2fdc4f);ami['emit']('custom:agentnoanswer',_0x238ecc);rpcDb['createCustomerHistory'](_0x3620d0,'[callProgressDetectingCustomer][logNoAnswer]');_0x2886eb[_0x76aa('0xb1')](_0x3620d0,'3',_0x2fdc4f)[_0x76aa('0x58')](function(_0x52c5be){_0x2c59a6=_0x52c5be['additional']==0x1;if(!_0x2c59a6){if(ut['totalGlobal'](_0x3620d0)>=_0x2fdc4f[_0x76aa('0x81')]){_0x4910fb=ut[_0x76aa('0x82')](_0x3620d0,0xf,_0x76aa('0x83'));rpcDb['createCustomerFinal'](_0x4910fb,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x3620d0[_0x76aa('0xae')]>=_0x2fdc4f[_0x76aa('0xb2')]){rpcDb[_0x76aa('0x84')](_0x3620d0,_0x76aa('0xb3'));}else{rpcDb[_0x76aa('0x87')](ut['scheduledAt'](_0x3620d0,'countnoanswerretry',_0x2fdc4f[_0x76aa('0xb0')]),_0x3620d0['unlockAgent'],_0x3620d0['activeContact']);}}}else{_0x3620d0['countnoanswerretry']++;_0x2886eb[_0x76aa('0x8c')]({'id':_0x3620d0[_0x76aa('0x8b')],'field':{'countnoanswerretry':_0x3620d0['countnoanswerretry']}})[_0x76aa('0x58')](function(){_0x2886eb[_0x76aa('0xac')](_0x3620d0,_0x3b0d8a,_0x5713e7)['then'](function(){});});}});break;case _0x76aa('0xb4'):_0x2fdc4f[_0x76aa('0xb5')]+=0x1;_0x3620d0[_0x76aa('0xb6')]+=0x1;_0x3620d0[_0x76aa('0x9a')]=ut[_0x76aa('0x77')](_0x3620d0);ut[_0x76aa('0x78')](_0x3620d0,0x8,_0x76aa('0xb7'));_0x3b0d8a=_0x2fdc4f[_0x76aa('0xb8')];_0x5713e7=_0x2fdc4f[_0x76aa('0x80')];ami['emit'](_0x76aa('0xb9'),ut[_0x76aa('0x7b')](_0x3620d0,'congestion'));rpcDb[_0x76aa('0x67')](_0x3620d0,_0x76aa('0xba'));_0x2886eb[_0x76aa('0xb1')](_0x3620d0,'8',_0x2fdc4f)['then'](function(_0x2276ac){_0x2c59a6=_0x2276ac[_0x76aa('0x7e')]==0x1;if(!_0x2c59a6){if(ut['totalGlobal'](_0x3620d0)>=_0x2fdc4f[_0x76aa('0x81')]){_0x4910fb=ut[_0x76aa('0x82')](_0x3620d0,0xf,_0x76aa('0x83'));rpcDb['createCustomerFinal'](_0x4910fb,_0x76aa('0xbb'));}else{if(_0x3620d0[_0x76aa('0xb6')]>=_0x2fdc4f['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x3620d0,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x76aa('0x87')](ut[_0x76aa('0x88')](_0x3620d0,_0x76aa('0xb6'),_0x2fdc4f[_0x76aa('0xa8')]),_0x3620d0['unlockAgent'],_0x3620d0['activeContact']);}}}else{_0x3620d0['countcongestionretry']++;_0x2886eb[_0x76aa('0x8c')]({'id':_0x3620d0['idContact'],'field':{'countcongestionretry':_0x3620d0[_0x76aa('0xb6')]}})[_0x76aa('0x58')](function(){_0x2886eb['swapAdditionalPhones'](_0x3620d0,_0x3b0d8a,_0x5713e7)[_0x76aa('0x58')](function(){});});}});break;case _0x76aa('0xbc'):_0x2fdc4f['outboundRejectCallsDay']+=0x1;_0x3620d0[_0x76aa('0xbd')]+=0x1;_0x3620d0[_0x76aa('0x9a')]=ut[_0x76aa('0x77')](_0x3620d0);ut[_0x76aa('0x78')](_0x3620d0,0x14,_0x76aa('0xbe'));_0x3b0d8a=_0x2fdc4f[_0x76aa('0xbf')];_0x5713e7=_0x2fdc4f['callAdditionalPhoneAfterMin'];ami[_0x76aa('0x2a')]('custom:agentreject',ut['buildObj'](_0x3620d0,'agentreject'));rpcDb['createCustomerHistory'](_0x3620d0,'[syncHangupRequest][logAgentReject]');_0x2886eb[_0x76aa('0xb1')](_0x3620d0,'20',_0x2fdc4f)[_0x76aa('0x58')](function(_0x432159){_0x2c59a6=_0x432159[_0x76aa('0x7e')]==0x1;if(!_0x2c59a6){if(ut['totalGlobal'](_0x3620d0)>=_0x2fdc4f[_0x76aa('0x81')]){_0x4910fb=ut[_0x76aa('0x82')](_0x3620d0,0x14,_0x76aa('0xbe'));rpcDb[_0x76aa('0x84')](_0x4910fb,_0x76aa('0xc0'));}else{if(_0x3620d0['countagentrejectretry']>=_0x2fdc4f[_0x76aa('0xc1')]){rpcDb[_0x76aa('0x84')](_0x3620d0,_0x76aa('0xc0'));}else{rpcDb[_0x76aa('0x87')](ut[_0x76aa('0x88')](_0x3620d0,_0x76aa('0xbd'),_0x2fdc4f[_0x76aa('0xbf')]),_0x3620d0['unlockAgent'],_0x3620d0[_0x76aa('0xab')]);}}}else{_0x3620d0[_0x76aa('0xae')]++;_0x2886eb['incrementPreviewCounters']({'id':_0x3620d0['idContact'],'field':{'countnoanswerretry':_0x3620d0[_0x76aa('0xae')]}})[_0x76aa('0x58')](function(){_0x2886eb['swapAdditionalPhones'](_0x3620d0,_0x3b0d8a,_0x5713e7)[_0x76aa('0x58')](function(){});});}});break;case'ABANDONED':_0x2fdc4f[_0x76aa('0xc2')]+=0x1;_0x3620d0['countabandonedretry']+=0x1;_0x3620d0[_0x76aa('0x9a')]=ut[_0x76aa('0x77')](_0x3620d0);ut[_0x76aa('0x78')](_0x3620d0,0xb,_0x76aa('0xc3'));rpcDb[_0x76aa('0x67')](_0x3620d0,'[callProgressDetectingCustomer][logAbandoned]');_0x2886eb[_0x76aa('0xb1')](_0x3620d0,'11',_0x2fdc4f)['then'](function(_0x1af32e){_0x2c59a6=_0x1af32e[_0x76aa('0x7e')]==0x1;if(!_0x2c59a6){if(ut['totalGlobal'](_0x3620d0)>=_0x2fdc4f['dialGlobalMaxRetry']){_0x4910fb=ut[_0x76aa('0x82')](_0x3620d0,0xf,_0x76aa('0x83'));rpcDb[_0x76aa('0x84')](_0x4910fb,_0x76aa('0xc4'));}else{if(_0x3620d0['countabandonedetry']>=_0x2fdc4f['dialAbandonedMaxRety']){rpcDb[_0x76aa('0x84')](_0x3620d0,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x76aa('0x87')](ut['scheduledAt'](_0x3620d0,_0x76aa('0xc5'),_0x2fdc4f[_0x76aa('0xc6')]),_0x3620d0['unlockAgent'],_0x3620d0[_0x76aa('0xab')]);}}}else{_0x3620d0['countnoanswerretry']++;_0x2886eb['incrementPreviewCounters']({'id':_0x3620d0[_0x76aa('0x8b')],'field':{'countnoanswerretry':_0x3620d0[_0x76aa('0xae')]}})['then'](function(){_0x2886eb[_0x76aa('0xac')](_0x3620d0,_0x3b0d8a,_0x5713e7)[_0x76aa('0x58')](function(){});});}});break;case'18':_0x2fdc4f[_0x76aa('0xc7')]+=0x1;_0x3620d0['countmachineretry']+=0x1;_0x3620d0[_0x76aa('0x9a')]=ut[_0x76aa('0x77')](_0x3620d0);ut[_0x76aa('0x78')](_0x3620d0,0x12,_0x4e6c09[_0x76aa('0xc8')]||_0x4e6c09[_0x76aa('0xc9')]);ami[_0x76aa('0x2a')](_0x76aa('0xca'),ut[_0x76aa('0x7b')](_0x3620d0,_0x76aa('0xcb')));rpcDb[_0x76aa('0x67')](_0x3620d0,_0x76aa('0xcc'));_0x2886eb[_0x76aa('0xb1')](_0x3620d0,'18',_0x2fdc4f)['then'](function(_0x4586fb){_0x2c59a6=_0x4586fb[_0x76aa('0x7e')]==0x1;if(!_0x2c59a6){if(ut['totalGlobal'](_0x3620d0)>=_0x2fdc4f[_0x76aa('0x81')]){_0x4910fb=ut[_0x76aa('0x82')](_0x3620d0,0x12,'Global');rpcDb['createCustomerFinal'](_0x4910fb,_0x76aa('0xcc'));}else{rpcDb[_0x76aa('0x84')](_0x3620d0,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x3620d0[_0x76aa('0xae')]++;_0x2886eb[_0x76aa('0x8c')]({'id':_0x3620d0[_0x76aa('0x8b')],'field':{'countnoanswerretry':_0x3620d0['countnoanswerretry']}})[_0x76aa('0x58')](function(){_0x2886eb[_0x76aa('0xac')](_0x3620d0,_0x3b0d8a,_0x5713e7)['then'](function(){});});}});delete this[_0x76aa('0x15')][_0x4e6c09[_0x76aa('0xa4')]];break;case'19':_0x2fdc4f[_0x76aa('0xc7')]+=0x1;_0x3620d0[_0x76aa('0x9a')]=ut[_0x76aa('0x77')](_0x3620d0);ut[_0x76aa('0x78')](_0x3620d0,0x13,_0x4e6c09['cause-txt']||_0x4e6c09[_0x76aa('0xc9')]);ami['emit'](_0x76aa('0xca'),ut[_0x76aa('0x7b')](_0x3620d0,_0x76aa('0xcb')));rpcDb['createCustomerHistory'](_0x3620d0,'[callProgressDetectingCustomer][machine]');_0x2886eb[_0x76aa('0xb1')](_0x3620d0,'18',_0x2fdc4f)[_0x76aa('0x58')](function(_0x19982e){_0x2c59a6=_0x19982e[_0x76aa('0x7e')]==0x1;if(!_0x2c59a6){if(ut[_0x76aa('0x77')](_0x3620d0)>=_0x2fdc4f[_0x76aa('0x81')]){_0x4910fb=ut['cloneAction'](_0x3620d0,0xf,'Global');rpcDb[_0x76aa('0x84')](_0x4910fb,_0x76aa('0xcd'));}else{rpcDb[_0x76aa('0x84')](_0x3620d0,_0x76aa('0xcd'));}}else{_0x3620d0['countnoanswerretry']++;_0x2886eb[_0x76aa('0x8c')]({'id':_0x3620d0['idContact'],'field':{'countnoanswerretry':_0x3620d0['countnoanswerretry']}})[_0x76aa('0x58')](function(){_0x2886eb[_0x76aa('0xac')](_0x3620d0,_0x3b0d8a,_0x5713e7)[_0x76aa('0x58')](function(){});});}});delete this['actions'][_0x4e6c09[_0x76aa('0xa4')]];break;default:if(_0x3620d0[_0x76aa('0x46')]){ut[_0x76aa('0x52')](_0x2fdc4f,_0x76aa('0xce'));ut[_0x76aa('0xcf')](_0x76aa('0xd0')+_0x2fdc4f[_0x76aa('0x28')],_0x4e6c09);}_0x2fdc4f['outboundUnknownCallsDay']+=0x1;_0x3620d0[_0x76aa('0x9a')]=ut[_0x76aa('0x77')](_0x3620d0);ut[_0x76aa('0x78')](_0x3620d0,0xc,_0x4e6c09[_0x76aa('0xc8')]||_0x4e6c09[_0x76aa('0xc9')]);_0x3b0d8a=_0x2fdc4f[_0x76aa('0xbf')];_0x5713e7=_0x2fdc4f['callAdditionalPhoneAfterMin'];rpcDb[_0x76aa('0x67')](_0x3620d0,_0x76aa('0xd1'));_0x2886eb[_0x76aa('0xb1')](_0x3620d0,'20',_0x2fdc4f)[_0x76aa('0x58')](function(_0x58f065){_0x2c59a6=_0x58f065[_0x76aa('0x7e')]==0x1;if(!_0x2c59a6){if(ut[_0x76aa('0x77')](_0x3620d0)>=_0x2fdc4f[_0x76aa('0x81')]){_0x4910fb=ut[_0x76aa('0x82')](_0x3620d0,0xf,_0x76aa('0x83'));rpcDb['createCustomerFinal'](_0x4910fb,_0x76aa('0xd2'));}else{rpcDb[_0x76aa('0x84')](_0x3620d0,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x4e6c09[_0x76aa('0xa4')]];}else{_0x2886eb[_0x76aa('0xac')](_0x3620d0,_0x3b0d8a,_0x5713e7)[_0x76aa('0x58')](function(){});}});}if(!(_0x3620d0[_0x76aa('0x46')]&&_0xbf78c7==='16')){ut[_0x76aa('0x50')](_0x2fdc4f,_0x76aa('0xd3'));logger['info'](_0x76aa('0xd4'),_0x3620d0[_0x76aa('0x91')],_0x76aa('0x92'),_0x2fdc4f[_0x76aa('0x28')],_0x76aa('0xd5'),_0x2fdc4f[_0x76aa('0x2d')]);}if(_0xbf78c7!=='ANSWER'){delete this[_0x76aa('0x15')][_0x4e6c09[_0x76aa('0xa4')]];delete this[_0x76aa('0x15')][_0x4e6c09[_0x76aa('0xd6')]];}_0x2fdc4f[_0x76aa('0xd7')]=!![];}};Preview[_0x76aa('0xe')]['callProgressDetectingAgent']=function(_0x3152d1,_0x4d0d76,_0x1482e5){if(_['isUndefined'](_0x4d0d76)&&_0x76aa('0xd8')!==typeof _0x4d0d76){return;}if(_[_0x76aa('0xd9')](_0x1482e5)&&'object'!==typeof _0x1482e5){return;}switch(_0x1482e5[_0x76aa('0xda')]){case'0':ut[_0x76aa('0xdb')](_0x3152d1,0x0,_0x76aa('0x79'));rpcDb['createAgentHistory'](_0x3152d1,_0x76aa('0xdc'));break;case'3':ut[_0x76aa('0xdb')](_0x3152d1,0x3,'NoAnswer');rpcDb[_0x76aa('0xdd')](_0x3152d1,_0x76aa('0xde'));break;case'5':ut[_0x76aa('0xdb')](_0x3152d1,0x5,_0x76aa('0xa7'));rpcDb[_0x76aa('0xdd')](_0x3152d1,_0x76aa('0xdf'));break;case'8':ut['logAgent'](_0x3152d1,0x8,_0x76aa('0xb7'));rpcDb[_0x76aa('0xdd')](_0x3152d1,_0x76aa('0xe0'));break;case'22':ut[_0x76aa('0xdb')](_0x3152d1,0x16,_0x76aa('0xe1'));rpcDb[_0x76aa('0xdd')](_0x3152d1,_0x76aa('0xe2'));break;default:ut[_0x76aa('0xdb')](_0x3152d1,0xc,_0x1482e5[_0x76aa('0xda')]);rpcDb[_0x76aa('0xdd')](_0x3152d1,_0x76aa('0xe0'));}ut['updateOriginated'](_0x4d0d76,_0x76aa('0xe3'));logger[_0x76aa('0x24')](_0x76aa('0xe4'),_0x3152d1[_0x76aa('0x91')],_0x76aa('0x92'),_0x4d0d76[_0x76aa('0x28')],_0x76aa('0xd5'),_0x4d0d76[_0x76aa('0x2d')]);delete this['actions'][_0x3152d1[_0x76aa('0x91')]];};Preview['prototype'][_0x76aa('0xb1')]=function(_0xae171,_0x2045a2,_0x5ce3ea){return cmHopperAdditionalPhone[_0x76aa('0xb1')](_0xae171,_0x2045a2,_0x5ce3ea)[_0x76aa('0x4e')](logger[_0x76aa('0x24')](_0x76aa('0xe5')));};Preview[_0x76aa('0xe')]['swapAdditionalPhones']=function(_0x2c6647,_0x4d8c38,_0x2e2f07){return cmHopperAdditionalPhone[_0x76aa('0xac')](_0x2c6647,_0x4d8c38,_0x2e2f07)['catch'](logger[_0x76aa('0x24')](_0x76aa('0xe6')));};Preview[_0x76aa('0xe')][_0x76aa('0x8c')]=function(_0x112046){return Promise[_0x76aa('0xe7')]()[_0x76aa('0x58')](cmHopperAdditionalPhone[_0x76aa('0x8c')](_0x112046))['catch'](logger[_0x76aa('0x24')](_0x76aa('0xe8')));};Preview[_0x76aa('0xe')][_0x76aa('0xe9')]=function(_0x3168e1,_0xd5e0e2,_0x41de8e,_0x260bca,_0x559940){var _0x37331b=this;return new Promise(function(_0x28a40a,_0x13d96a){if(_['isNil'](_0xd5e0e2)||_[_0x76aa('0x41')](_0xd5e0e2[_0x76aa('0xea')])||_[_0x76aa('0x41')](_0xd5e0e2[_0x76aa('0xeb')])||_[_0x76aa('0x41')](_0xd5e0e2['VoiceQueueId'])){_0x13d96a(ut[_0x76aa('0x36')]('Contact\x20is\x20undefined',_0x260bca,_0x559940));return;}var _0x35e12a=uuid['v4']();var _0x25df39=_0x37331b[_0x76aa('0x13')][_0xd5e0e2[_0x76aa('0x43')][_0x76aa('0x28')]];var _0x5e68bd=_0x41de8e?_0x37331b[_0x76aa('0x16')][_0x41de8e]['id']:undefined;_0x37331b['actions'][_0x35e12a]=new Action(_0xd5e0e2,_0x25df39,_0x35e12a,_0x41de8e,_0x5e68bd);var _0x577463=_0x37331b[_0x76aa('0x15')][_0x35e12a];_0x577463[_0x76aa('0x89')]=_0x260bca;_0x577463['activeContact']=_0x559940;_0x577463[_0x76aa('0xec')]=_0x41de8e;if(_['isEmpty'](_0x3168e1)){_0x37331b[_0x76aa('0xed')](_0x577463,_0x25df39,_0xd5e0e2,_0x41de8e)[_0x76aa('0x58')](function(_0x2e4046){logger[_0x76aa('0x24')](_0x76aa('0xee'),_0x76aa('0xef')+_0x577463['queue']+_0x76aa('0xf0')+_0x577463[_0x76aa('0x8b')],JSON[_0x76aa('0x45')](_0x2e4046));ami[_0x76aa('0x2a')](_0x76aa('0xf1'),ut[_0x76aa('0x7b')](_0x577463,_0x76aa('0xf2'),_0x37331b[_0x76aa('0x13')][_0x577463[_0x76aa('0x44')]]));_0x28a40a(ut[_0x76aa('0x36')](_0x76aa('0xf3')));})[_0x76aa('0x4e')](function(_0x17e02c){ut[_0x76aa('0x33')](_0x76aa('0xf4'),_0x17e02c);_0x13d96a(ut[_0x76aa('0x36')](_0x76aa('0xf5'),_0x260bca,_0x559940));});}else{_0x25df39[_0x76aa('0xf6')]+=0x1;ut['logBlacklist'](_0x577463);rpcDb[_0x76aa('0xf7')](_0x577463,'[Blacklist][error]');delete _0x37331b[_0x76aa('0x15')][_0x35e12a];_0x13d96a(ut[_0x76aa('0x36')]('Contact\x20in\x20black\x20List',_0x260bca,_0x559940));}});};Preview[_0x76aa('0xe')]['isTrunkReachable']=function(_0x272e84){return!_[_0x76aa('0x41')](_0x272e84)&&!_[_0x76aa('0x41')](_0x272e84['name'])&&!_[_0x76aa('0x41')](_0x272e84['active'])&&_0x272e84['active']&&!_[_0x76aa('0x41')](this['trunks'][util[_0x76aa('0x26')]('SIP/%s',_0x272e84['name'])])&&!_[_0x76aa('0x41')](this[_0x76aa('0x14')][util[_0x76aa('0x26')](_0x76aa('0xf8'),_0x272e84[_0x76aa('0x28')])][_0x76aa('0x4c')])&&(this[_0x76aa('0x14')][util[_0x76aa('0x26')](_0x76aa('0xf8'),_0x272e84[_0x76aa('0x28')])][_0x76aa('0x4c')]===_0x76aa('0xf9')||this[_0x76aa('0x14')][util[_0x76aa('0x26')]('SIP/%s',_0x272e84[_0x76aa('0x28')])][_0x76aa('0x4c')]===_0x76aa('0xfa'));};Preview[_0x76aa('0xe')]['run']=function(_0x120ad9,_0x50a349){return this[_0x76aa('0xfb')](_0x120ad9,_0x50a349)['then'](function(_0x455e90){return _['pick'](_0x455e90,[_0x76aa('0x36')]);})['catch'](function(_0x31b7a8){if(_0x31b7a8['unlock']){rpcDb[_0x76aa('0xfc')](_0x120ad9);}if(_0x31b7a8[_0x76aa('0xfd')]){rpcDb['disableContact'](_0x120ad9);}throw _[_0x76aa('0x47')](_0x31b7a8,['message']);});};Preview[_0x76aa('0xe')]['execRun']=function(_0x1974e1,_0x5648ab){var _0x5bf806=this;var _0x8577e7,_0x867c24;return rpcDb[_0x76aa('0xfe')](_0x1974e1)[_0x76aa('0x58')](function(_0x1f56f6){if(!_[_0x76aa('0x41')](_0x1f56f6[0x0])){_0x867c24=_0x1f56f6[0x0][_0x76aa('0xff')]?![]:!![];_0x8577e7=_0x1f56f6[0x0][_0x76aa('0xff')]?!![]:![];_0x8577e7=_0x5648ab?!![]:_0x8577e7;}var _0x2e95a1=_0x5bf806[_0x76aa('0x100')](_0x1f56f6);if(_0x2e95a1['isValid']){rpcDb[_0x76aa('0x101')](_[_0x76aa('0x47')](_0x1f56f6[0x0],[_0x76aa('0x102'),_0x76aa('0xeb')]))[_0x76aa('0x58')](function(_0x1aeeb5){_0x5bf806[_0x76aa('0xe9')](_0x1aeeb5,_0x1f56f6[0x0],_0x5648ab,_0x867c24,_0x8577e7)[_0x76aa('0x58')](function(_0x1cb8ad){return _0x1cb8ad;})[_0x76aa('0x4e')](function(_0x181303){throw _0x181303;});})[_0x76aa('0x4e')](function(_0x3274a9){ut[_0x76aa('0x33')]('[Preview][checkIsBlackList]',_0x3274a9);throw ut['message'](_0x76aa('0x103'),_0x867c24,_0x8577e7);});}else{throw ut[_0x76aa('0x36')](_0x2e95a1[_0x76aa('0x36')],_0x867c24,_0x8577e7);}})['catch'](function(_0x4db099){ut[_0x76aa('0x33')](_0x76aa('0x104'),_0x4db099);throw ut[_0x76aa('0x36')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x76aa('0xe')][_0x76aa('0x100')]=function(_0x4830c8){if(_['isNil'](_0x4830c8)||_['isEmpty'](_0x4830c8)||!_[_0x76aa('0x41')](_0x4830c8[0x0][_0x76aa('0x5c')])&&_[_0x76aa('0x41')](_0x4830c8[0x0]['Agent'][_0x76aa('0x28')])){ut[_0x76aa('0x33')]('[Preview][validateContact][Empty\x20Contact]',_0x4830c8);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x328d1a=this[_0x76aa('0x13')][_0x4830c8[0x0][_0x76aa('0x43')]['name']];_0x328d1a[_0x76aa('0x36')]=utils[_0x76aa('0x31')]['ACTIVE'];if(_[_0x76aa('0x41')](_0x328d1a)){ut[_0x76aa('0x33')]('[Preview][validateContact][Empty\x20Campaign]',_0x328d1a);return{'isValid':![],'message':_0x76aa('0x105')};}if(!this[_0x76aa('0x70')](_0x328d1a['Trunk'])){ut[_0x76aa('0x33')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x328d1a[_0x76aa('0x28')]+_0x76aa('0x106'));if(!this[_0x76aa('0x70')](_0x328d1a[_0x76aa('0x107')])){ut[_0x76aa('0x33')](_0x76aa('0x108'),_0x328d1a[_0x76aa('0x28')]+_0x76aa('0x109'));return{'isValid':![],'message':_0x76aa('0x10a')};}}if(!ut[_0x76aa('0x10b')](_0x328d1a['dialActive'])){ut['logger'](_0x76aa('0x10c'),_0x328d1a[_0x76aa('0x28')]+_0x76aa('0x10d'));return{'isValid':![],'message':_0x76aa('0x10e')+_0x328d1a[_0x76aa('0x28')]+_0x76aa('0x10d')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x76aa('0xe')][_0x76aa('0xed')]=function(_0x17f15e,_0x29fbf6,_0x38694d,_0xf0b932){var _0x1c8cf5=this;return new Promise(function(_0x5a8d0f,_0x5f513d){var _0x54e70c=_0x17f15e[_0x76aa('0x91')];var _0x2bd86e=_0x1c8cf5[_0x76aa('0x70')](_0x29fbf6[_0x76aa('0x71')])?util[_0x76aa('0x26')]('SIP/%s/%s%s',_0x29fbf6['Trunk'][_0x76aa('0x28')],_[_0x76aa('0x41')](_0x29fbf6[_0x76aa('0x10f')])?'':_0x29fbf6[_0x76aa('0x10f')][_0x76aa('0x110')]()||'',_0x29fbf6['dialCutDigit']>0x0?_0x38694d[_0x76aa('0xeb')]['substring'](_0x29fbf6[_0x76aa('0x111')]):_0x38694d['phone']):util['format'](_0x76aa('0x112'),_['isNil'](_0x29fbf6[_0x76aa('0x107')])?_0x29fbf6[_0x76aa('0x71')][_0x76aa('0x28')]:_0x29fbf6[_0x76aa('0x107')][_0x76aa('0x28')],_[_0x76aa('0x41')](_0x29fbf6[_0x76aa('0x10f')])?'':_0x29fbf6[_0x76aa('0x10f')]['trim']()||'',_0x29fbf6[_0x76aa('0x111')]>0x0?_0x38694d[_0x76aa('0xeb')][_0x76aa('0x113')](_0x29fbf6[_0x76aa('0x111')]):_0x38694d[_0x76aa('0xeb')]);var _0x4e9063=_0x1c8cf5[_0x76aa('0x70')](_0x29fbf6['Trunk'])?ut[_0x76aa('0x114')](_0x29fbf6['Trunk'][_0x76aa('0x115')],_0x29fbf6['dialOriginateCallerIdName'],_0x29fbf6[_0x76aa('0x116')]>0x0?ut['getCallerIdRandom'](_0x29fbf6[_0x76aa('0x117')],_0x29fbf6[_0x76aa('0x116')]):_0x29fbf6[_0x76aa('0x117')]):ut['getCallerId'](_['isNil'](_0x29fbf6[_0x76aa('0x107')])?_0x29fbf6['Trunk'][_0x76aa('0x115')]:_0x29fbf6[_0x76aa('0x107')][_0x76aa('0x115')],_0x29fbf6['dialOriginateCallerIdName'],_0x29fbf6['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x29fbf6['dialOriginateCallerIdNumber'],_0x29fbf6[_0x76aa('0x116')]):_0x29fbf6[_0x76aa('0x117')]);if(_0x4e9063){_0x17f15e[_0x76aa('0x118')]=ut[_0x76aa('0x119')](_0x4e9063);_0x17f15e[_0x76aa('0x11a')]=ut[_0x76aa('0x11b')](_0x4e9063);}var _0x450f64=ut[_0x76aa('0x11c')](_0x29fbf6,_0x38694d,_0x2bd86e,_0x4e9063,_0x54e70c,_0x17f15e);_[_0x76aa('0x11d')](_0x17f15e,ut[_0x76aa('0x11e')](_0x450f64));_0x17f15e[_0x76aa('0x61')]=moment()[_0x76aa('0x26')](_0x76aa('0x62'));_0x29fbf6['variables']=_0x450f64;var _0x2b12e9=ut['variablesAction'](_0x17f15e,_0x29fbf6,_0x450f64,_0x17f15e[_0x76aa('0xab')],_0xf0b932);return ami[_0x76aa('0x4b')](_0x2b12e9)[_0x76aa('0x58')](function(_0x3fb275){_0x29fbf6[_0x76aa('0x2d')]+=0x1;logger[_0x76aa('0x24')](_0x76aa('0x11f'),_0x54e70c,_0x76aa('0x92'),_0x29fbf6[_0x76aa('0x28')],_0x76aa('0xd5'),_0x29fbf6[_0x76aa('0x2d')]);_0x5a8d0f(_0x3fb275);})['catch'](function(_0x5cada7){ut[_0x76aa('0xdb')](_0x17f15e,0xe,_0x76aa('0x120'));rpcDb['createAgentHistory'](_0x17f15e,_0x76aa('0x121'));_0x5f513d(_0x5cada7);});});};Preview[_0x76aa('0xe')][_0x76aa('0x1e')]=function(_0x138f0b){if(this[_0x76aa('0x15')][_0x138f0b[_0x76aa('0xa4')]]){this[_0x76aa('0x15')][_0x138f0b['linkedid']][_0x76aa('0x4d')]=_0x138f0b[_0x76aa('0x4d')];}};Preview['prototype']['syncOriginateResponse']=function(_0x30a6e5){var _0x28ab3f=this;var _0x97833d=this[_0x76aa('0x15')][_0x30a6e5[_0x76aa('0x122')]];if(_0x97833d){if(_0x97833d[_0x76aa('0xec')]&&this[_0x76aa('0x16')][_0x97833d[_0x76aa('0xec')]]){ut[_0x76aa('0x123')](_0x97833d,this[_0x76aa('0x16')][_0x97833d[_0x76aa('0xec')]][_0x76aa('0x28')],this[_0x76aa('0x16')][_0x97833d['lookAgent']]['id']);}var _0x493a63=_[_0x76aa('0x124')](_0x97833d);_0x493a63[_0x76aa('0x8e')]=moment()[_0x76aa('0x26')](_0x76aa('0x62'));var _0x59a7d3=_0x28ab3f['campaignsPreview'][_0x97833d[_0x76aa('0x44')]];if(ut[_0x76aa('0x125')](_0x30a6e5[_0x76aa('0x126')])){if(_0x97833d['unlockAgent']){rpcDb['unlockContact'](_0x97833d['idContact']);}if(_0x97833d[_0x76aa('0xab')]){rpcDb['disableContact'](_0x97833d[_0x76aa('0x8b')]);}ami[_0x76aa('0x2a')](_0x76aa('0x127'),ut[_0x76aa('0x7b')](_0x97833d,_0x76aa('0x128'),this[_0x76aa('0x13')][_0x97833d[_0x76aa('0x44')]]));this[_0x76aa('0x129')](_0x493a63,_0x59a7d3,_0x30a6e5);}else{_0x97833d[_0x76aa('0x61')]=moment()[_0x76aa('0x26')](_0x76aa('0x62'));ut[_0x76aa('0xdb')](_0x493a63,0x4,_0x76aa('0x9b'));rpcDb[_0x76aa('0xdd')](_0x493a63,_0x76aa('0x12a'));}}};Preview[_0x76aa('0xe')]['syncHangup']=function(_0x275653){var _0x5e8cec=this[_0x76aa('0x15')][_0x275653['linkedid']];var _0x17bd1a;if(_0x5e8cec){_0x17bd1a=this['campaignsPreview'][_0x5e8cec[_0x76aa('0x44')]];logger['info']('[syncHangup][talking]',_0x275653[_0x76aa('0xa4')],_0x76aa('0x92'),_0x17bd1a[_0x76aa('0x28')],_0x76aa('0xa3'),_0x17bd1a[_0x76aa('0x2e')]);}if(this[_0x76aa('0x15')][_0x275653['linkedid']]&&_0x275653[_0x76aa('0xa4')]!==_0x275653[_0x76aa('0x91')]){if(_0x275653[_0x76aa('0x12b')]==='16'&&this[_0x76aa('0x15')][_0x275653['linkedid']][_0x76aa('0x46')]){this[_0x76aa('0x74')](_0x275653,_0x275653[_0x76aa('0xa4')],_0x275653[_0x76aa('0x12b')]);}else if(this[_0x76aa('0x15')][_0x275653[_0x76aa('0xa4')]][_0x76aa('0x46')]){logger[_0x76aa('0x24')](_0x76aa('0x12c'),_0x275653[_0x76aa('0xa4')],_0x275653[_0x76aa('0x12b')],_0x76aa('0x92'),_0x17bd1a['name'],'pTalking:\x20',_0x17bd1a[_0x76aa('0x2e')]);this[_0x76aa('0x74')](_0x275653,_0x275653[_0x76aa('0xa4')],_0x275653[_0x76aa('0x12b')]);}}else if(_0x5e8cec&&_[_0x76aa('0x41')](_0x5e8cec[_0x76aa('0x12d')])&&_0x17bd1a[_0x76aa('0x12e')]&&_0x275653[_0x76aa('0xa4')]===_0x275653[_0x76aa('0x91')]&&_[_0x76aa('0x41')](_0x275653[_0x76aa('0xda')])&&_0x275653['cause']==='16'&&_0x275653[_0x76aa('0x12f')]==='6'&&_['isUndefined'](_0x5e8cec[_0x76aa('0x130')])){if(_0x5e8cec[_0x76aa('0x89')]){rpcDb[_0x76aa('0xfc')](_0x5e8cec[_0x76aa('0x8b')]);}if(_0x5e8cec[_0x76aa('0xab')]){rpcDb['disableContact'](_0x5e8cec['idContact']);}_0x275653[_0x76aa('0xda')]='22';this['callProgressDetectingAgent'](_0x5e8cec,_0x17bd1a,_0x275653);}else if(_0x5e8cec&&_0x5e8cec[_0x76aa('0x130')]){if(_0x275653[_0x76aa('0x12b')]==='16'&&this[_0x76aa('0x15')][_0x275653[_0x76aa('0xa4')]][_0x76aa('0x46')]){logger['info']('[syncHangup][talking][transfer]',_0x275653[_0x76aa('0xa4')],_0x275653[_0x76aa('0x12b')],_0x76aa('0x92'),_0x17bd1a[_0x76aa('0x28')],_0x76aa('0xa3'),_0x17bd1a[_0x76aa('0x2e')]);this[_0x76aa('0x74')](_0x275653,_0x275653[_0x76aa('0xa4')],_0x275653[_0x76aa('0x12b')]);}else if(this[_0x76aa('0x15')][_0x275653['linkedid']][_0x76aa('0x46')]){logger[_0x76aa('0x24')]('[syncHangup][talking][cause]',_0x275653[_0x76aa('0xa4')],_0x275653[_0x76aa('0x12b')],_0x76aa('0x92'),_0x17bd1a[_0x76aa('0x28')],_0x76aa('0xa3'),_0x17bd1a[_0x76aa('0x2e')]);this[_0x76aa('0x74')](_0x275653,_0x275653['linkedid'],_0x275653[_0x76aa('0x12b')]);}}};Preview[_0x76aa('0xe')][_0x76aa('0x1c')]=function(_0x2f2a27){if(this['actions'][_0x2f2a27[_0x76aa('0xd6')]]&&_0x2f2a27[_0x76aa('0xd6')]!==_0x2f2a27[_0x76aa('0x131')]){this[_0x76aa('0x74')](_0x2f2a27,_0x2f2a27[_0x76aa('0xd6')],_0x2f2a27[_0x76aa('0xc9')]);}};Preview[_0x76aa('0xe')][_0x76aa('0x132')]=function(_0x1f7f1d){if(this[_0x76aa('0x15')][_0x1f7f1d[_0x76aa('0xa4')]]&&_0x1f7f1d[_0x76aa('0xa4')]!==_0x1f7f1d[_0x76aa('0x91')]&&!this[_0x76aa('0x15')][_0x1f7f1d['linkedid']]['dialAnswer']){if(_0x1f7f1d[_0x76aa('0x12b')]==='1'){this[_0x76aa('0x74')](_0x1f7f1d,_0x1f7f1d['linkedid'],_0x1f7f1d[_0x76aa('0x12b')]);}}};Preview['prototype'][_0x76aa('0x133')]=function(_0x2e9c1a,_0x1b4f9e,_0x4218e4){if(this[_0x76aa('0x15')][_0x2e9c1a]){if(_[_0x76aa('0x41')](this[_0x76aa('0x15')][_0x2e9c1a][_0x76aa('0x134')])){this['actions'][_0x2e9c1a][_0x76aa('0x134')]={};}this[_0x76aa('0x15')][_0x2e9c1a]['variables'][_0x1b4f9e]=_0x4218e4;}};Preview['prototype'][_0x76aa('0x20')]=function(_0xcd05b0){try{if(!_[_0x76aa('0x41')](_0xcd05b0)){if(ut[_0x76aa('0x135')](_[_0x76aa('0x136')](_0xcd05b0['variable'])[0x0])){this[_0x76aa('0x133')](_0xcd05b0['uniqueid'],_[_0x76aa('0x136')](_0xcd05b0[_0x76aa('0x137')])[0x0],_0xcd05b0[_0x76aa('0x138')]);}}}catch(_0x23c297){logger[_0x76aa('0x139')](_0x76aa('0x13a'),util[_0x76aa('0x13b')](_0x23c297,{'showHidden':![],'depth':null}));}};Preview[_0x76aa('0xe')][_0x76aa('0x13c')]=function(_0x29c147){if(_0x29c147){if(this[_0x76aa('0x15')][_0x29c147[_0x76aa('0x13d')]]){this[_0x76aa('0x15')][_0x29c147['transfertargetlinkedid']][_0x76aa('0x130')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x4ae6f1){if(_0x4ae6f1){if(this[_0x76aa('0x15')][_0x4ae6f1['transfererlinkedid']]){this['actions'][_0x4ae6f1['transfererlinkedid']]['transfer']=!![];}}};module[_0x76aa('0x13e')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 1e6e0af..a15fdcc 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 _0xda2e=['checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','exten','xcally-motion-preview','holdtime','assigned','COMPLETED','then','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','../rpc/cmHopper','error','inspect','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xda2e,0x1f0));var _0xeda2=function(_0xba37ef,_0x555be8){_0xba37ef=_0xba37ef-0x0;var _0x4440c2=_0xda2e[_0xba37ef];return _0x4440c2;};'use strict';var util=require(_0xeda2('0x0'));var BPromise=require('bluebird');var logger=require(_0xeda2('0x1'))('preview');var cmHopper=require(_0xeda2('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x55bd0d){return function(_0x871959){logger[_0xeda2('0x3')](_0x55bd0d,util[_0xeda2('0x4')](_0x871959,{'showHidden':![],'depth':null}));};}function create(_0x302ef1){return cmHopperHistory[_0xeda2('0x5')](_0x302ef1)[_0xeda2('0x6')](loggerCatch(_0xeda2('0x7')));}function createAgent(_0x5b0329){return BPromise[_0xeda2('0x8')]()['then'](agentReportPreview['createHistory'](_0x5b0329))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x54dd3f){return cmHopper[_0xeda2('0x9')](_0x54dd3f,!![])[_0xeda2('0x6')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xeda2('0xa')]=function(_0x106eb7){return cmHopperBlack[_0xeda2('0xa')](_0x106eb7)[_0xeda2('0x6')](loggerCatch(_0xeda2('0xb')));};exports[_0xeda2('0xc')]=function(_0x599902){return BPromise['resolve']()['then'](cmHopper[_0xeda2('0xc')](_0x599902))[_0xeda2('0x6')](loggerCatch(_0xeda2('0xd')));};exports[_0xeda2('0x5')]=function(_0x120239,_0x5b92c0){create(_0x120239)['catch'](loggerCatch(_0x5b92c0));moveContact(_0x120239)[_0xeda2('0x6')](loggerCatch(_0x5b92c0));};exports['createAgentHistory']=function(_0x16f3a5,_0x3897ec){createAgent(_0x16f3a5)['catch'](loggerCatch(_0x3897ec));};exports['createCustomerHistory']=function(_0x1a8828,_0x29fc4e){create(_0x1a8828)[_0xeda2('0x6')](loggerCatch(_0x29fc4e));};exports[_0xeda2('0xe')]=function(_0x5cb997,_0x4a7936){moveContact(_0x5cb997)['catch'](loggerCatch(_0x4a7936));};exports[_0xeda2('0xf')]=function(_0x5f0f0c,_0x32f4a3,_0x1bb5ef){if(_0x32f4a3){_0x5f0f0c[_0xeda2('0x10')]=null;}if(_0x1bb5ef){_0x5f0f0c['active']=![];}return cmHopper[_0xeda2('0xf')](_0x5f0f0c)[_0xeda2('0x6')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x8ae837){return cmHopper[_0xeda2('0x11')](_0x8ae837)[_0xeda2('0x6')](loggerCatch(_0xeda2('0x12')));};exports[_0xeda2('0x13')]=function(_0xb24027){return cmHopper[_0xeda2('0x13')]({'UserId':null},_0xb24027,0x1)[_0xeda2('0x6')](loggerCatch(_0xeda2('0x14')));};exports[_0xeda2('0x15')]=function(_0x33b8d7){return cmHopper[_0xeda2('0x13')]({'active':![]},_0x33b8d7,0x1)[_0xeda2('0x6')](loggerCatch('[activeContact]\x20'));};exports[_0xeda2('0x16')]=function(_0x42ab98){var _0x1d5a7e={};_0x1d5a7e['type']=_0x42ab98[_0xeda2('0x17')];_0x1d5a7e['uniqueid']=_0x42ab98['uniqueid'];_0x1d5a7e['calleridnum']=_0x42ab98[_0xeda2('0x18')];_0x1d5a7e[_0xeda2('0x19')]=_0x42ab98[_0xeda2('0x19')];_0x1d5a7e[_0xeda2('0x1a')]=_0x42ab98[_0xeda2('0x1a')];_0x1d5a7e[_0xeda2('0x1b')]=_0x42ab98[_0xeda2('0x1c')];_0x1d5a7e[_0xeda2('0x1d')]=_0x42ab98['answertime'];_0x1d5a7e[_0xeda2('0x1e')]=0x1;_0x1d5a7e[_0xeda2('0x1f')]=_0x42ab98[_0xeda2('0x20')];_0x1d5a7e['connectedlinename']=_0x42ab98[_0xeda2('0x21')];_0x1d5a7e['context']='from-sip';_0x1d5a7e[_0xeda2('0x22')]=_0xeda2('0x23');_0x1d5a7e[_0xeda2('0x24')]=0x0;_0x1d5a7e[_0xeda2('0x25')]=0x1;_0x1d5a7e['lastAssignedTo']=_0x42ab98[_0xeda2('0x21')];_0x1d5a7e['queuecallerexitreason']=_0xeda2('0x26');return BPromise['resolve']()[_0xeda2('0x27')](voiceQueueReport[_0xeda2('0x28')](_0x1d5a7e))['catch'](loggerCatch(_0xeda2('0x29')));};exports['getContactRecallMe']=function(_0x1438cd,_0x118161){return BPromise[_0xeda2('0x8')]()[_0xeda2('0x27')](cmHopper[_0xeda2('0x2a')](_0x1438cd,_0x118161))[_0xeda2('0x6')](loggerCatch(_0xeda2('0x2b')));};exports[_0xeda2('0x2c')]=function(_0x3d55d4){return cmHopper[_0xeda2('0xf')](_0x3d55d4,!![],!![])[_0xeda2('0x6')](loggerCatch(_0xeda2('0x2d')));}; \ No newline at end of file +var _0x0729=['queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','then','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','catch','resolve','createHistory','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete'];(function(_0x40a5b7,_0x2b26d6){var _0x1317d5=function(_0x1bd41e){while(--_0x1bd41e){_0x40a5b7['push'](_0x40a5b7['shift']());}};_0x1317d5(++_0x2b26d6);}(_0x0729,0x183));var _0x9072=function(_0x1626b5,_0x3539bf){_0x1626b5=_0x1626b5-0x0;var _0x565650=_0x0729[_0x1626b5];return _0x565650;};'use strict';var util=require(_0x9072('0x0'));var BPromise=require(_0x9072('0x1'));var logger=require(_0x9072('0x2'))(_0x9072('0x3'));var cmHopper=require(_0x9072('0x4'));var cmHopperHistory=require(_0x9072('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x9072('0x6'));var voiceQueueReport=require(_0x9072('0x7'));function loggerCatch(_0x177906){return function(_0x336b2a){logger['error'](_0x177906,util['inspect'](_0x336b2a,{'showHidden':![],'depth':null}));};}function create(_0x5e877e){return cmHopperHistory['createHistory'](_0x5e877e)[_0x9072('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x35649a){return BPromise[_0x9072('0x9')]()['then'](agentReportPreview[_0x9072('0xa')](_0x35649a))[_0x9072('0x8')](loggerCatch(_0x9072('0xb')));}function moveContact(_0x1ace9b){return cmHopper[_0x9072('0xc')](_0x1ace9b,!![])[_0x9072('0x8')](loggerCatch(_0x9072('0xd')));}exports[_0x9072('0xe')]=function(_0x1e6392){return cmHopperBlack['checkIsBlackList'](_0x1e6392)[_0x9072('0x8')](loggerCatch(_0x9072('0xf')));};exports[_0x9072('0x10')]=function(_0x38f756){return BPromise[_0x9072('0x9')]()['then'](cmHopper[_0x9072('0x10')](_0x38f756))['catch'](loggerCatch(_0x9072('0x11')));};exports['createHistory']=function(_0x362ce5,_0x35e1ef){create(_0x362ce5)['catch'](loggerCatch(_0x35e1ef));moveContact(_0x362ce5)['catch'](loggerCatch(_0x35e1ef));};exports[_0x9072('0x12')]=function(_0x14e9fd,_0x24096e){createAgent(_0x14e9fd)[_0x9072('0x8')](loggerCatch(_0x24096e));};exports['createCustomerHistory']=function(_0x476d4d,_0x37698f){create(_0x476d4d)[_0x9072('0x8')](loggerCatch(_0x37698f));};exports['createCustomerFinal']=function(_0x9b940,_0x4f95be){moveContact(_0x9b940)[_0x9072('0x8')](loggerCatch(_0x4f95be));};exports[_0x9072('0x13')]=function(_0x55099f,_0x10ecfc,_0x17db71){if(_0x10ecfc){_0x55099f[_0x9072('0x14')]=null;}if(_0x17db71){_0x55099f[_0x9072('0x15')]=![];}return cmHopper[_0x9072('0x13')](_0x55099f)[_0x9072('0x8')](loggerCatch(_0x9072('0x16')));};exports[_0x9072('0x17')]=function(_0x261659){return cmHopper['countReScheduled'](_0x261659)[_0x9072('0x8')](loggerCatch('[countReScheduled]\x20'));};exports[_0x9072('0x18')]=function(_0x59f510){return cmHopper[_0x9072('0x18')]({'UserId':null},_0x59f510,0x1)[_0x9072('0x8')](loggerCatch('[unlockContact]\x20'));};exports[_0x9072('0x19')]=function(_0x49a029){return cmHopper[_0x9072('0x18')]({'active':![]},_0x49a029,0x1)[_0x9072('0x8')](loggerCatch(_0x9072('0x1a')));};exports[_0x9072('0x1b')]=function(_0x2974bd){var _0x547d78={};_0x547d78[_0x9072('0x1c')]=_0x2974bd[_0x9072('0x1c')];_0x547d78[_0x9072('0x1d')]=_0x2974bd[_0x9072('0x1d')];_0x547d78[_0x9072('0x1e')]=_0x2974bd[_0x9072('0x1e')];_0x547d78[_0x9072('0x1f')]=_0x2974bd[_0x9072('0x1f')];_0x547d78[_0x9072('0x20')]=_0x2974bd[_0x9072('0x20')];_0x547d78[_0x9072('0x21')]=_0x2974bd[_0x9072('0x22')];_0x547d78[_0x9072('0x23')]=_0x2974bd['answertime'];_0x547d78[_0x9072('0x24')]=0x1;_0x547d78[_0x9072('0x25')]=_0x2974bd[_0x9072('0x26')];_0x547d78[_0x9072('0x27')]=_0x2974bd[_0x9072('0x28')];_0x547d78[_0x9072('0x29')]=_0x9072('0x2a');_0x547d78[_0x9072('0x2b')]='xcally-motion-preview';_0x547d78[_0x9072('0x2c')]=0x0;_0x547d78['assigned']=0x1;_0x547d78[_0x9072('0x2d')]=_0x2974bd[_0x9072('0x28')];_0x547d78[_0x9072('0x2e')]=_0x9072('0x2f');return BPromise[_0x9072('0x9')]()[_0x9072('0x30')](voiceQueueReport['create'](_0x547d78))[_0x9072('0x8')](loggerCatch(_0x9072('0x31')));};exports[_0x9072('0x32')]=function(_0x2d050d,_0x3d4a21){return BPromise['resolve']()[_0x9072('0x30')](cmHopper[_0x9072('0x32')](_0x2d050d,_0x3d4a21))[_0x9072('0x8')](loggerCatch(_0x9072('0x33')));};exports['rescheduleContactInQueue']=function(_0x4c97fb){return cmHopper[_0x9072('0x13')](_0x4c97fb,!![],!![])[_0x9072('0x8')](loggerCatch(_0x9072('0x34')));}; \ 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 9f06498..c3993b5 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 _0x8a42=['[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','queue','agentReadyId','not_inuse','push','milliseconds','diff','seconds','filterKey','campaigntype','active','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','loggerError','logger2','info','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','endtime','logAgent','responsetime','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','Failure','variablesAction','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking'];(function(_0x3f2d35,_0x36db80){var _0x572caa=function(_0x47ff73){while(--_0x47ff73){_0x3f2d35['push'](_0x3f2d35['shift']());}};_0x572caa(++_0x36db80);}(_0x8a42,0x161));var _0x28a4=function(_0x5a8318,_0x3d95d5){_0x5a8318=_0x5a8318-0x0;var _0x40ee51=_0x8a42[_0x5a8318];return _0x40ee51;};'use strict';var util=require(_0x28a4('0x0'));var _=require(_0x28a4('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x28a4('0x2'));var ipAgi=process[_0x28a4('0x3')][_0x28a4('0x4')]||_0x28a4('0x5');var utils=require(_0x28a4('0x6'));exports[_0x28a4('0x7')]=function(_0x5ac0d3){return function(_0x4e444c){logger[_0x28a4('0x8')](_0x5ac0d3,util[_0x28a4('0x9')](_0x4e444c,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1ab9b6,_0x27363e){logger['info'](_0x1ab9b6,util[_0x28a4('0x9')](_0x27363e,{'showHidden':![],'depth':null}));};exports[_0x28a4('0xa')]=function(_0x2a6477,_0x5dc7dc){logger[_0x28a4('0x8')](_0x2a6477,util['inspect'](_0x5dc7dc,{'showHidden':![],'depth':null}));};exports[_0x28a4('0xb')]=function(_0x3fbe5f){return function(_0x3301c3){logger[_0x28a4('0xc')](_0x3fbe5f,util['inspect'](_0x3301c3,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5e8605,_0x2e5758,_0x4aa59b){return{'message':_0x5e8605,'unlock':_0x2e5758,'active':_0x4aa59b};};exports[_0x28a4('0xd')]=function(_0x96041b,_0x10fdc2,_0x50ff84){if(!_[_0x28a4('0xe')](_0x50ff84)&&_0x28a4('0xf')===typeof _0x50ff84&&!_[_0x28a4('0x10')](_0x50ff84)){if(!_[_0x28a4('0xe')](_0x10fdc2)&&_0x28a4('0xf')===typeof _0x10fdc2&&!_[_0x28a4('0x10')](_0x10fdc2)){return util['format']('\x22%s\x22\x20<%s>',_0x10fdc2,_0x50ff84);}return util[_0x28a4('0x11')](_0x28a4('0x12'),_0x50ff84,_0x50ff84);}if(!_[_0x28a4('0xe')](_0x96041b)&&'string'===typeof _0x96041b&&!_['isEmpty'](_0x96041b)){return _0x96041b;}return _0x28a4('0x13');};exports['isActive']=function(_0x32df16){if(_[_0x28a4('0x14')](_0x32df16)){return![];}return _0x32df16;};exports[_0x28a4('0x15')]=function(_0x37e0cb,_0x5ef299,_0x52d0cf,_0x2d3b5b,_0x1fb004,_0x30ccf4){var _0x2b649f={'XMD-QUEUE':_0x5ef299['Queue']?_0x5ef299[_0x28a4('0x16')][_0x28a4('0x17')]:'','XMD-CALLERID':_0x2d3b5b,'XMD-CALLERID-PREVIEW':_0x30ccf4?util[_0x28a4('0x11')](_0x28a4('0x12'),_0x30ccf4[_0x28a4('0x18')],_0x30ccf4[_0x28a4('0x19')]):_0x2d3b5b,'XMD-DIALID':_0x1fb004,'XMD-CONTACTID':_0x5ef299[_0x28a4('0x1a')],'XMD-CDRTYPE':_0x28a4('0x1b'),'CALLERID(all)':_0x2d3b5b,'XMD-VOICEQUEUEID':_0x5ef299[_0x28a4('0x1c')],'XMD-DIALCHANNEL':_0x52d0cf,'XMD-DIALTIMEOUT':_0x37e0cb['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x28a4('0x11')](_0x28a4('0x1d'),_0x37e0cb['dialQueueProject2']?'g':'',_[_0x28a4('0x10')](_0x37e0cb[_0x28a4('0x1e')])?'':_0x28a4('0x1f')),'XMD-DIALURL':_0x37e0cb[_0x28a4('0x20')]||'','XMD-AGI':_0x37e0cb[_0x28a4('0x21')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x37e0cb['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x37e0cb['dialQueueProject2']?util[_0x28a4('0x11')](_0x28a4('0x22'),ipAgi,_0x37e0cb[_0x28a4('0x23')]):_0x28a4('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x30ccf4?_0x30ccf4['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x30ccf4?_0x30ccf4[_0x28a4('0x25')]:'','XMD-DESTINATION':_0x28a4('0x26'),'SIPADDHEADER':_0x28a4('0x27')};if(!_[_0x28a4('0x10')](_0x37e0cb[_0x28a4('0x1e')])){_0x2b649f[util[_0x28a4('0x11')]('%s',_0x28a4('0x28'))]=_0x37e0cb[_0x28a4('0x1e')];_0x2b649f[util[_0x28a4('0x11')]('%s',_0x28a4('0x29'))]=_0x1fb004;}if(_0x5ef299&&_0x5ef299['Contact']){for(var _0x2d8f5c in _0x5ef299['Contact']){if(_0x5ef299[_0x28a4('0x2a')][_0x28a4('0x2b')](_0x2d8f5c)){if(!_[_0x28a4('0x14')](_0x5ef299['Contact'][_0x2d8f5c])&&_0x2d8f5c!=='id'&&_0x2d8f5c!==_0x28a4('0x2c')&&_0x2d8f5c!=='createdAt'&&_0x2d8f5c!==_0x28a4('0x2d')){_0x2b649f[util[_0x28a4('0x11')](_0x28a4('0x2e'),_0x28a4('0x2f'),_[_0x28a4('0x30')](_0x2d8f5c))]=_0x5ef299[_0x28a4('0x2a')][_0x2d8f5c];}}}}return _0x2b649f;};exports[_0x28a4('0x31')]=function(_0x2f6b4f){var _0x6bf8fa={};for(var _0x3795a0 in _0x2f6b4f){if(_0x2f6b4f['hasOwnProperty'](_0x3795a0)){_0x6bf8fa[util[_0x28a4('0x11')]('%s',_[_0x28a4('0x32')](_0x3795a0))]=_0x2f6b4f[_0x3795a0];}}return{'variables':_0x6bf8fa};};exports[_0x28a4('0x33')]=function(_0x15835c,_0x1327de){if(!_['isNil'](_0x15835c)){if(_0x15835c[_0x28a4('0x2b')](_0x28a4('0x34'))){if(_0x15835c['originated']>0x0){_0x15835c[_0x28a4('0x34')]-=0x1;}else{logger[_0x28a4('0x8')](_0x28a4('0x35'),_0x1327de);}}}else{logger[_0x28a4('0x8')](_0x28a4('0x36'),_0x1327de);}};exports[_0x28a4('0x37')]=function(_0x362f0d){var _0x3a36af=moment()[_0x28a4('0x11')](_0x28a4('0x38'));_0x362f0d[_0x28a4('0x39')]=0xd;_0x362f0d[_0x28a4('0x3a')]='Blacklist';_0x362f0d['starttime']=_0x3a36af;_0x362f0d['responsetime']=_0x3a36af;_0x362f0d[_0x28a4('0x3b')]=_0x3a36af;};exports[_0x28a4('0x3c')]=function(_0x3a9ccd,_0x3648b6,_0x4db654){var _0x53716d=moment()[_0x28a4('0x11')](_0x28a4('0x38'));_0x3a9ccd[_0x28a4('0x39')]=_0x3648b6;_0x3a9ccd[_0x28a4('0x3a')]=_0x4db654;_0x3a9ccd[_0x28a4('0x3d')]=_0x53716d;_0x3a9ccd['ringtime']=utils[_0x28a4('0x3e')](_0x3a9ccd[_0x28a4('0x3d')],_0x3a9ccd[_0x28a4('0x3f')]);};exports[_0x28a4('0x40')]=function(_0x50c043,_0x537462,_0x5d2e74){_0x50c043[_0x28a4('0x41')]=_0x537462;_0x50c043[_0x28a4('0x42')]=_0x5d2e74;};exports[_0x28a4('0x43')]=function(_0x4fc107,_0x3772cc,_0x835367){var _0x5c6201=moment()[_0x28a4('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4fc107[_0x28a4('0x39')]=_0x3772cc;_0x4fc107[_0x28a4('0x3a')]=_0x835367;_0x4fc107[_0x28a4('0x3d')]=_0x4fc107[_0x28a4('0x3d')]?_0x4fc107[_0x28a4('0x3d')]:_0x5c6201;_0x4fc107[_0x28a4('0x3b')]=_0x4fc107[_0x28a4('0x3b')]?_0x4fc107[_0x28a4('0x3b')]:_0x5c6201;_0x4fc107[_0x28a4('0x44')]=utils['getSeconds'](_0x4fc107['responsetime']||0x0,_0x4fc107[_0x28a4('0x3f')]||0x0);_0x4fc107[_0x28a4('0x45')]=_0x4fc107[_0x28a4('0x46')]?utils[_0x28a4('0x3e')](_0x4fc107[_0x28a4('0x3b')],_0x4fc107[_0x28a4('0x46')]):0x0;};exports['isFailure']=function(_0x4303be){return _0x4303be===_0x28a4('0x47');};exports[_0x28a4('0x48')]=function(_0xca6bb3,_0x4b6319,_0x22841f,_0x22cf9b,_0x179477){var _0x525d32=_0x22cf9b?'RECALL':_0xca6bb3[_0x28a4('0x18')];_0x525d32=_0x179477?'BOOKED':_0x525d32;return{'actionid':_0xca6bb3[_0x28a4('0x49')],'action':_0x28a4('0x4a'),'channel':_0xca6bb3[_0x28a4('0x4b')],'callerid':util['format'](_0x28a4('0x12'),_0x525d32,_0xca6bb3[_0x28a4('0x19')]),'Exten':_0x28a4('0x26'),'Context':'from-sip','Priority':'1','variable':_0x22841f,'timeout':(_0x4b6319[_0x28a4('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0xca6bb3['uniqueid']};};exports[_0x28a4('0x4d')]=function(_0x1e3725){return _0x1e3725[_0x28a4('0x4e')]+_0x1e3725[_0x28a4('0x4f')]+_0x1e3725['countnoanswerretry']+_0x1e3725[_0x28a4('0x50')]+_0x1e3725[_0x28a4('0x51')];};exports[_0x28a4('0x52')]=function(_0x42ceb2){var _0x5a0a89=_['clone'](_0x42ceb2);_0x5a0a89[_0x28a4('0x39')]=0xf;_0x5a0a89[_0x28a4('0x3a')]=_0x28a4('0x53');return _0x5a0a89;};exports[_0x28a4('0x54')]=function(_0x26ec69,_0xa97d64,_0x1c68de){var _0x543260={};_0x543260[_0xa97d64]=_0x26ec69[_0xa97d64];_0x543260['active']=![];_0x543260[_0x28a4('0x55')]=moment()[_0x28a4('0x56')](_0x1c68de,_0x28a4('0x57'))[_0x28a4('0x11')](_0x28a4('0x38'));_0x543260['ContactId']=_0x26ec69['ContactId'];_0x543260[_0x28a4('0x58')]=_0x26ec69['ListId'];_0x543260[_0x28a4('0x1c')]=_0x26ec69[_0x28a4('0x1c')]||undefined;return _0x543260;};exports[_0x28a4('0x59')]=function(_0x5ebff3,_0x2a328d){if(!_[_0x28a4('0x14')](_0x5ebff3)){if(_0x5ebff3['pTalking']>0x0){_0x5ebff3[_0x28a4('0x5a')]-=0x1;}else{logger[_0x28a4('0x8')](_0x2a328d,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x28a4('0x8')](_0x2a328d,_0x28a4('0x5b'));}};exports[_0x28a4('0x5c')]=function(_0x442f5f){if(_0x442f5f<=0x0){return!![];}return![];};function buildObj(_0x584d37,_0x54f7d0,_0x22e848){_0x584d37[_0x28a4('0x5d')]=_0x54f7d0;_0x584d37['name']=_0x584d37['queue'];_0x584d37[_0x28a4('0x5e')]=_0x584d37[_0x28a4('0x4b')];_0x584d37[_0x28a4('0x5f')]='voice';if(_0x22e848){_0x584d37[_0x28a4('0x60')]=_0x22e848[_0x28a4('0x60')];}return _0x584d37;}exports[_0x28a4('0x61')]=buildObj;exports[_0x28a4('0x62')]=function(_0x2b6170){var _0x5ba23d={};_0x5ba23d[_0x28a4('0x63')]=_0x2b6170['queue'];_0x5ba23d[_0x28a4('0x5e')]=_0x2b6170[_0x28a4('0x4b')];_0x5ba23d[_0x28a4('0x49')]=_0x2b6170[_0x28a4('0x49')];return _0x5ba23d;};exports[_0x28a4('0x64')]=function(_0x440719){var _0x2b258d=[];for(var _0x2eccc7 in _0x440719){if(_0x440719['hasOwnProperty'](_0x2eccc7)){if(!_[_0x28a4('0x14')](_0x440719[_0x2eccc7])&&_0x440719[_0x2eccc7]['state']===_0x28a4('0x65')&&_0x440719[_0x2eccc7]['status']==='reachable'){_0x2b258d[_0x28a4('0x66')](_0x440719[_0x2eccc7]['id']);}}}return _0x2b258d;};exports['getDiff']=function(_0x177c16){var _0x5485a1=moment()[_0x28a4('0x67')](0x0);var _0x16b0c0=moment(_0x177c16)[_0x28a4('0x67')](0x0);return _0x5485a1[_0x28a4('0x68')](_0x16b0c0,_0x28a4('0x69'));};exports['createBody']=function(_0x40a2ca){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x40a2ca['ContactId'],'ListId':_0x40a2ca[_0x28a4('0x58')],'VoiceQueueId':_0x40a2ca['VoiceQueueId']||undefined,'CampaignId':_0x40a2ca['CampaignId']||undefined};};exports[_0x28a4('0x6a')]=function(_0x26609b){if(_0x26609b==='uniqueid'||_0x26609b==='idContact'||_0x26609b===_0x28a4('0x63')||_0x26609b==='type'||_0x26609b===_0x28a4('0x6b')||_0x26609b==='dialAnswer'||_0x26609b===_0x28a4('0x41')||_0x26609b===_0x28a4('0x4b')||_0x26609b===_0x28a4('0x18')||_0x26609b===_0x28a4('0x6c')||_0x26609b==='calleridnum'||_0x26609b===_0x28a4('0x55')||_0x26609b===_0x28a4('0x4e')||_0x26609b===_0x28a4('0x4f')||_0x26609b===_0x28a4('0x6d')||_0x26609b===_0x28a4('0x6e')||_0x26609b===_0x28a4('0x6f')||_0x26609b===_0x28a4('0x70')||_0x26609b===_0x28a4('0x71')||_0x26609b===_0x28a4('0x72')||_0x26609b===_0x28a4('0x1a')||_0x26609b===_0x28a4('0x58')||_0x26609b===_0x28a4('0x42')||_0x26609b===_0x28a4('0x1c')||_0x26609b==='sipcallid'||_0x26609b===_0x28a4('0x73')||_0x26609b===_0x28a4('0x74')||_0x26609b===_0x28a4('0x75')||_0x26609b===_0x28a4('0x76')||_0x26609b===_0x28a4('0x77')||_0x26609b===_0x28a4('0x78')||_0x26609b===_0x28a4('0x79')||_0x26609b===_0x28a4('0x7a')||_0x26609b===_0x28a4('0x7b')||_0x26609b===_0x28a4('0x7c')||_0x26609b==='xmd-cdrtype'||_0x26609b==='xmd-callerid'||_0x26609b===_0x28a4('0x7d')||_0x26609b==='xmd-agi'||_0x26609b===_0x28a4('0x7e')||_0x26609b===_0x28a4('0x7f')||_0x26609b===_0x28a4('0x80')||_0x26609b===_0x28a4('0x81')||_0x26609b===_0x28a4('0x82')||_0x26609b===_0x28a4('0x83')||_0x26609b===_0x28a4('0x84')||_0x26609b===_0x28a4('0x85')||_0x26609b==='rtpaudioqos'||_0x26609b===_0x28a4('0x7f')||_0x26609b==='rtpaudioqosjitter'||_0x26609b===_0x28a4('0x81')||_0x26609b==='rtpaudioqosloss'||_0x26609b===_0x28a4('0x83')||_0x26609b===_0x28a4('0x84')||_0x26609b===_0x28a4('0x85')||_0x26609b==='bridgepeer'||_0x26609b===_0x28a4('0x86')||_0x26609b===_0x28a4('0x39')||_0x26609b===_0x28a4('0x3a')){return![];}return!![];};exports[_0x28a4('0x87')]=function(_0x449f6a,_0x47957f){var _0x4cb9b0,_0x367dba,_0x4dbd24;if(_0x47957f<=0x0){_0x47957f=0x1;}_0x4cb9b0=new RegExp('\x5cw{0,'+_0x47957f+'}$');_0x367dba=Math[_0x28a4('0x88')](0xa,_0x47957f-0x1);_0x4dbd24=Math[_0x28a4('0x88')](0xa,_0x47957f)-0x1;return util[_0x28a4('0x11')]('%s',_[_0x28a4('0x89')](_0x449f6a,_0x4cb9b0,_[_0x28a4('0x8a')](_0x367dba,_0x4dbd24)));};exports[_0x28a4('0x8b')]=function(_0x2d43df){var _0x880dc1=_0x2d43df['match'](/"(.*?)"/);return _0x880dc1?_0x880dc1[0x1]:_0x2d43df;};exports[_0x28a4('0x8c')]=function(_0x42b4d8){var _0xef1f86=_0x42b4d8[_0x28a4('0x8d')](/<(.*?)>/);return _0xef1f86?_0xef1f86[0x1]:_0x42b4d8;};function buildNoAnswerEventPayload(_0x46ec2f,_0x16471f){var _0x275347=buildObj(_0x46ec2f,_0x28a4('0x8e'));if(!_[_0x28a4('0x10')](_0x16471f[_0x28a4('0x8f')])){Object[_0x28a4('0x90')](_0x16471f[_0x28a4('0x8f')])[_0x28a4('0x91')](function(_0x18a3c6){_0x275347[_0x18a3c6[_0x28a4('0x92')]()]=_0x16471f['variables'][_0x18a3c6];});}return _0x275347;}exports[_0x28a4('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x29b2=['Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','filterKey','type','campaigntype','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','info','loggerError','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname'];(function(_0x827c63,_0x53eb61){var _0x551ab0=function(_0x45d9ef){while(--_0x45d9ef){_0x827c63['push'](_0x827c63['shift']());}};_0x551ab0(++_0x53eb61);}(_0x29b2,0x1a2));var _0x229b=function(_0x444cb0,_0x1c5a69){_0x444cb0=_0x444cb0-0x0;var _0x38741b=_0x29b2[_0x444cb0];return _0x38741b;};'use strict';var util=require(_0x229b('0x0'));var _=require(_0x229b('0x1'));var moment=require(_0x229b('0x2'));var logger=require(_0x229b('0x3'))(_0x229b('0x4'));var ipAgi=process[_0x229b('0x5')][_0x229b('0x6')]||'127.0.0.1';var utils=require(_0x229b('0x7'));exports[_0x229b('0x8')]=function(_0x16f33f){return function(_0x32df78){logger[_0x229b('0x9')](_0x16f33f,util[_0x229b('0xa')](_0x32df78,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2bc91c,_0x3ed323){logger[_0x229b('0xb')](_0x2bc91c,util['inspect'](_0x3ed323,{'showHidden':![],'depth':null}));};exports[_0x229b('0xc')]=function(_0x3c7e47,_0x5108d0){logger[_0x229b('0x9')](_0x3c7e47,util[_0x229b('0xa')](_0x5108d0,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x157c29){return function(_0x47d8d4){logger[_0x229b('0xb')](_0x157c29,util['inspect'](_0x47d8d4,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x37eb78,_0x5b6e9f,_0x51c938){return{'message':_0x37eb78,'unlock':_0x5b6e9f,'active':_0x51c938};};exports[_0x229b('0xd')]=function(_0x2da552,_0x4286eb,_0xd60501){if(!_[_0x229b('0xe')](_0xd60501)&&_0x229b('0xf')===typeof _0xd60501&&!_[_0x229b('0x10')](_0xd60501)){if(!_['isUndefined'](_0x4286eb)&&_0x229b('0xf')===typeof _0x4286eb&&!_[_0x229b('0x10')](_0x4286eb)){return util[_0x229b('0x11')](_0x229b('0x12'),_0x4286eb,_0xd60501);}return util[_0x229b('0x11')](_0x229b('0x12'),_0xd60501,_0xd60501);}if(!_['isUndefined'](_0x2da552)&&_0x229b('0xf')===typeof _0x2da552&&!_[_0x229b('0x10')](_0x2da552)){return _0x2da552;}return _0x229b('0x13');};exports['isActive']=function(_0x3449f6){if(_[_0x229b('0x14')](_0x3449f6)){return![];}return _0x3449f6;};exports[_0x229b('0x15')]=function(_0x3457bc,_0x4ca38f,_0x41e3b4,_0x1a4a9c,_0x52644b,_0x32c794){var _0x522d8b={'XMD-QUEUE':_0x4ca38f[_0x229b('0x16')]?_0x4ca38f[_0x229b('0x16')]['name']:'','XMD-CALLERID':_0x1a4a9c,'XMD-CALLERID-PREVIEW':_0x32c794?util[_0x229b('0x11')](_0x229b('0x12'),_0x32c794[_0x229b('0x17')],_0x32c794[_0x229b('0x18')]):_0x1a4a9c,'XMD-DIALID':_0x52644b,'XMD-CONTACTID':_0x4ca38f[_0x229b('0x19')],'XMD-CDRTYPE':_0x229b('0x1a'),'CALLERID(all)':_0x1a4a9c,'XMD-VOICEQUEUEID':_0x4ca38f[_0x229b('0x1b')],'XMD-DIALCHANNEL':_0x41e3b4,'XMD-DIALTIMEOUT':_0x3457bc[_0x229b('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x229b('0x11')](_0x229b('0x1d'),_0x3457bc[_0x229b('0x1e')]?'g':'',_[_0x229b('0x10')](_0x3457bc[_0x229b('0x1f')])?'':_0x229b('0x20')),'XMD-DIALURL':_0x3457bc['dialPreviewUrl']||'','XMD-AGI':_0x3457bc[_0x229b('0x21')]?util[_0x229b('0x11')](_0x229b('0x22'),ipAgi,_0x3457bc[_0x229b('0x21')]):_0x229b('0x23'),'XMD-AGIAFTER':_0x3457bc[_0x229b('0x1e')]?util[_0x229b('0x11')](_0x229b('0x22'),ipAgi,_0x3457bc[_0x229b('0x1e')]):_0x229b('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x32c794?_0x32c794[_0x229b('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x32c794?_0x32c794[_0x229b('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x229b('0x26')};if(!_[_0x229b('0x10')](_0x3457bc[_0x229b('0x1f')])){_0x522d8b[util[_0x229b('0x11')]('%s',_0x229b('0x27'))]=_0x3457bc[_0x229b('0x1f')];_0x522d8b[util[_0x229b('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x52644b;}if(_0x4ca38f&&_0x4ca38f['Contact']){for(var _0x33bfd4 in _0x4ca38f[_0x229b('0x28')]){if(_0x4ca38f[_0x229b('0x28')][_0x229b('0x29')](_0x33bfd4)){if(!_[_0x229b('0x14')](_0x4ca38f[_0x229b('0x28')][_0x33bfd4])&&_0x33bfd4!=='id'&&_0x33bfd4!==_0x229b('0x2a')&&_0x33bfd4!==_0x229b('0x2b')&&_0x33bfd4!==_0x229b('0x2c')){_0x522d8b[util[_0x229b('0x11')](_0x229b('0x2d'),_0x229b('0x2e'),_[_0x229b('0x2f')](_0x33bfd4))]=_0x4ca38f[_0x229b('0x28')][_0x33bfd4];}}}}return _0x522d8b;};exports[_0x229b('0x30')]=function(_0xffcdf6){var _0x4f9e87={};for(var _0x16628a in _0xffcdf6){if(_0xffcdf6['hasOwnProperty'](_0x16628a)){_0x4f9e87[util[_0x229b('0x11')]('%s',_[_0x229b('0x31')](_0x16628a))]=_0xffcdf6[_0x16628a];}}return{'variables':_0x4f9e87};};exports[_0x229b('0x32')]=function(_0x44bd79,_0x4d4a00){if(!_[_0x229b('0x14')](_0x44bd79)){if(_0x44bd79[_0x229b('0x29')](_0x229b('0x33'))){if(_0x44bd79[_0x229b('0x33')]>0x0){_0x44bd79[_0x229b('0x33')]-=0x1;}else{logger[_0x229b('0x9')](_0x229b('0x34'),_0x4d4a00);}}}else{logger['error'](_0x229b('0x35'),_0x4d4a00);}};exports[_0x229b('0x36')]=function(_0x2f63fa){var _0x5414b0=moment()[_0x229b('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f63fa[_0x229b('0x37')]=0xd;_0x2f63fa[_0x229b('0x38')]=_0x229b('0x39');_0x2f63fa['starttime']=_0x5414b0;_0x2f63fa['responsetime']=_0x5414b0;_0x2f63fa[_0x229b('0x3a')]=_0x5414b0;};exports[_0x229b('0x3b')]=function(_0x10e462,_0x19dcaa,_0x39f6dc){var _0x5070cc=moment()['format'](_0x229b('0x3c'));_0x10e462[_0x229b('0x37')]=_0x19dcaa;_0x10e462[_0x229b('0x38')]=_0x39f6dc;_0x10e462[_0x229b('0x3d')]=_0x5070cc;_0x10e462[_0x229b('0x3e')]=utils[_0x229b('0x3f')](_0x10e462[_0x229b('0x3d')],_0x10e462[_0x229b('0x40')]);};exports[_0x229b('0x41')]=function(_0x46bb8b,_0x1663e1,_0x8efc85){_0x46bb8b[_0x229b('0x42')]=_0x1663e1;_0x46bb8b[_0x229b('0x43')]=_0x8efc85;};exports[_0x229b('0x44')]=function(_0x4311dc,_0x915453,_0x4c582d){var _0x50dba5=moment()[_0x229b('0x11')](_0x229b('0x3c'));_0x4311dc[_0x229b('0x37')]=_0x915453;_0x4311dc['statedesc']=_0x4c582d;_0x4311dc[_0x229b('0x3d')]=_0x4311dc['responsetime']?_0x4311dc[_0x229b('0x3d')]:_0x50dba5;_0x4311dc[_0x229b('0x3a')]=_0x4311dc['endtime']?_0x4311dc[_0x229b('0x3a')]:_0x50dba5;_0x4311dc[_0x229b('0x3e')]=utils['getSeconds'](_0x4311dc[_0x229b('0x3d')]||0x0,_0x4311dc['starttime']||0x0);_0x4311dc[_0x229b('0x45')]=_0x4311dc['answertime']?utils[_0x229b('0x3f')](_0x4311dc[_0x229b('0x3a')],_0x4311dc[_0x229b('0x46')]):0x0;};exports['isFailure']=function(_0x2d6160){return _0x2d6160===_0x229b('0x47');};exports[_0x229b('0x48')]=function(_0x593171,_0x1b1421,_0x649c23,_0x3d05c7,_0x27ecac){var _0x534acd=_0x3d05c7?_0x229b('0x49'):_0x593171['calleridname'];_0x534acd=_0x27ecac?_0x229b('0x4a'):_0x534acd;return{'actionid':_0x593171[_0x229b('0x4b')],'action':_0x229b('0x4c'),'channel':_0x593171[_0x229b('0x4d')],'callerid':util[_0x229b('0x11')](_0x229b('0x12'),_0x534acd,_0x593171[_0x229b('0x18')]),'Exten':_0x229b('0x4e'),'Context':_0x229b('0x4f'),'Priority':'1','variable':_0x649c23,'timeout':(_0x1b1421[_0x229b('0x50')]||0x1e)*0x3e8,'async':!![],'channelid':_0x593171[_0x229b('0x4b')]};};exports[_0x229b('0x51')]=function(_0xb8812d){return _0xb8812d[_0x229b('0x52')]+_0xb8812d[_0x229b('0x53')]+_0xb8812d['countnoanswerretry']+_0xb8812d[_0x229b('0x54')]+_0xb8812d[_0x229b('0x55')];};exports['cloneAction']=function(_0xfeffb0){var _0x3e9b68=_[_0x229b('0x56')](_0xfeffb0);_0x3e9b68[_0x229b('0x37')]=0xf;_0x3e9b68[_0x229b('0x38')]=_0x229b('0x57');return _0x3e9b68;};exports['scheduledAt']=function(_0x51ec31,_0x5577e7,_0x321dee){var _0x1261e5={};_0x1261e5[_0x5577e7]=_0x51ec31[_0x5577e7];_0x1261e5[_0x229b('0x58')]=![];_0x1261e5[_0x229b('0x59')]=moment()[_0x229b('0x5a')](_0x321dee,_0x229b('0x5b'))['format'](_0x229b('0x3c'));_0x1261e5[_0x229b('0x19')]=_0x51ec31[_0x229b('0x19')];_0x1261e5[_0x229b('0x5c')]=_0x51ec31[_0x229b('0x5c')];_0x1261e5[_0x229b('0x1b')]=_0x51ec31[_0x229b('0x1b')]||undefined;return _0x1261e5;};exports[_0x229b('0x5d')]=function(_0x2c57c5,_0x17d34e){if(!_[_0x229b('0x14')](_0x2c57c5)){if(_0x2c57c5['pTalking']>0x0){_0x2c57c5['pTalking']-=0x1;}else{logger[_0x229b('0x9')](_0x17d34e,_0x229b('0x5e'));}}else{logger[_0x229b('0x9')](_0x17d34e,_0x229b('0x5f'));}};exports['IsNotLoggedIn']=function(_0x409277){if(_0x409277<=0x0){return!![];}return![];};function buildObj(_0x17c9ee,_0x5d8703,_0x239359){_0x17c9ee[_0x229b('0x60')]=_0x5d8703;_0x17c9ee[_0x229b('0x61')]=_0x17c9ee[_0x229b('0x62')];_0x17c9ee[_0x229b('0x63')]=_0x17c9ee[_0x229b('0x4d')];_0x17c9ee[_0x229b('0x64')]='voice';if(_0x239359){_0x17c9ee[_0x229b('0x65')]=_0x239359['mandatoryDisposition'];}return _0x17c9ee;}exports[_0x229b('0x66')]=buildObj;exports[_0x229b('0x67')]=function(_0x571070){var _0x2b2333={};_0x2b2333[_0x229b('0x62')]=_0x571070['queue'];_0x2b2333[_0x229b('0x63')]=_0x571070[_0x229b('0x4d')];_0x2b2333['uniqueid']=_0x571070[_0x229b('0x4b')];return _0x2b2333;};exports[_0x229b('0x68')]=function(_0x53a5ae){var _0x17d4ec=[];for(var _0x5c0942 in _0x53a5ae){if(_0x53a5ae[_0x229b('0x29')](_0x5c0942)){if(!_[_0x229b('0x14')](_0x53a5ae[_0x5c0942])&&_0x53a5ae[_0x5c0942][_0x229b('0x37')]===_0x229b('0x69')&&_0x53a5ae[_0x5c0942][_0x229b('0x6a')]===_0x229b('0x6b')){_0x17d4ec[_0x229b('0x6c')](_0x53a5ae[_0x5c0942]['id']);}}}return _0x17d4ec;};exports[_0x229b('0x6d')]=function(_0x34863f){var _0x2b0266=moment()[_0x229b('0x6e')](0x0);var _0x3d27da=moment(_0x34863f)[_0x229b('0x6e')](0x0);return _0x2b0266[_0x229b('0x6f')](_0x3d27da,_0x229b('0x70'));};exports[_0x229b('0x71')]=function(_0x3340e7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3340e7[_0x229b('0x19')],'ListId':_0x3340e7['ListId'],'VoiceQueueId':_0x3340e7['VoiceQueueId']||undefined,'CampaignId':_0x3340e7['CampaignId']||undefined};};exports[_0x229b('0x72')]=function(_0x296f96){if(_0x296f96===_0x229b('0x4b')||_0x296f96==='idContact'||_0x296f96===_0x229b('0x62')||_0x296f96===_0x229b('0x73')||_0x296f96===_0x229b('0x74')||_0x296f96==='dialAnswer'||_0x296f96===_0x229b('0x42')||_0x296f96===_0x229b('0x4d')||_0x296f96===_0x229b('0x17')||_0x296f96===_0x229b('0x58')||_0x296f96==='calleridnum'||_0x296f96===_0x229b('0x59')||_0x296f96===_0x229b('0x52')||_0x296f96===_0x229b('0x53')||_0x296f96===_0x229b('0x75')||_0x296f96===_0x229b('0x76')||_0x296f96===_0x229b('0x77')||_0x296f96===_0x229b('0x78')||_0x296f96===_0x229b('0x79')||_0x296f96===_0x229b('0x7a')||_0x296f96===_0x229b('0x19')||_0x296f96===_0x229b('0x5c')||_0x296f96===_0x229b('0x43')||_0x296f96===_0x229b('0x1b')||_0x296f96===_0x229b('0x7b')||_0x296f96===_0x229b('0x7c')||_0x296f96===_0x229b('0x7d')||_0x296f96==='xmd-phone'||_0x296f96==='xmd-listid'||_0x296f96===_0x229b('0x7e')||_0x296f96===_0x229b('0x7f')||_0x296f96==='xmd-dialoptions'||_0x296f96==='xmd-dialid'||_0x296f96==='xmd-dialchannel'||_0x296f96===_0x229b('0x80')||_0x296f96===_0x229b('0x81')||_0x296f96===_0x229b('0x82')||_0x296f96===_0x229b('0x83')||_0x296f96===_0x229b('0x84')||_0x296f96===_0x229b('0x85')||_0x296f96==='rtpaudioqosbridged'||_0x296f96===_0x229b('0x86')||_0x296f96===_0x229b('0x87')||_0x296f96===_0x229b('0x88')||_0x296f96===_0x229b('0x89')||_0x296f96===_0x229b('0x8a')||_0x296f96==='rtpaudioqosrttbridged'||_0x296f96===_0x229b('0x85')||_0x296f96==='rtpaudioqosbridged'||_0x296f96===_0x229b('0x86')||_0x296f96===_0x229b('0x87')||_0x296f96===_0x229b('0x88')||_0x296f96===_0x229b('0x89')||_0x296f96===_0x229b('0x8a')||_0x296f96===_0x229b('0x8b')||_0x296f96==='bridgepeer'||_0x296f96==='bridgepvtcallid'||_0x296f96===_0x229b('0x37')||_0x296f96===_0x229b('0x38')){return![];}return!![];};exports[_0x229b('0x8c')]=function(_0xf2ec9e,_0x25cfbd){var _0x3428ee,_0x29624b,_0x374cbc;if(_0x25cfbd<=0x0){_0x25cfbd=0x1;}_0x3428ee=new RegExp(_0x229b('0x8d')+_0x25cfbd+'}$');_0x29624b=Math[_0x229b('0x8e')](0xa,_0x25cfbd-0x1);_0x374cbc=Math[_0x229b('0x8e')](0xa,_0x25cfbd)-0x1;return util[_0x229b('0x11')]('%s',_['replace'](_0xf2ec9e,_0x3428ee,_['random'](_0x29624b,_0x374cbc)));};exports[_0x229b('0x8f')]=function(_0x15d66e){var _0x373f63=_0x15d66e[_0x229b('0x90')](/"(.*?)"/);return _0x373f63?_0x373f63[0x1]:_0x15d66e;};exports[_0x229b('0x91')]=function(_0x272d61){var _0xc14f25=_0x272d61[_0x229b('0x90')](/<(.*?)>/);return _0xc14f25?_0xc14f25[0x1]:_0x272d61;};function buildNoAnswerEventPayload(_0x2b872b,_0x4f28e2){var _0x5dfa15=buildObj(_0x2b872b,_0x229b('0x92'));if(!_[_0x229b('0x10')](_0x4f28e2['variables'])){Object[_0x229b('0x93')](_0x4f28e2[_0x229b('0x94')])[_0x229b('0x95')](function(_0x1e651d){_0x5dfa15[_0x1e651d[_0x229b('0x96')]()]=_0x4f28e2[_0x229b('0x94')][_0x1e651d];});}return _0x5dfa15;}exports[_0x229b('0x97')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 78a8ba1..48e696c 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 _0x6a02=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','voicequeuechannel','voicechannel'];(function(_0x10fd02,_0x5ccde8){var _0x341552=function(_0x23f2e0){while(--_0x23f2e0){_0x10fd02['push'](_0x10fd02['shift']());}};_0x341552(++_0x5ccde8);}(_0x6a02,0x6e));var _0x26a0=function(_0xa42d12,_0x1bcd85){_0xa42d12=_0xa42d12-0x0;var _0x5c441e=_0x6a02[_0xa42d12];return _0x5c441e;};'use strict';exports[_0x26a0('0x0')]={'queue':{'type':_0x26a0('0x1'),'required':!![]},'interface':{'type':_0x26a0('0x1'),'required':!![]},'membername':{'type':_0x26a0('0x1'),'required':!![]},'penalty':{'type':_0x26a0('0x2'),'required':![]},'paused':{'type':_0x26a0('0x3'),'required':![]}};exports[_0x26a0('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x26a0('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x26a0('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x26a0('0x1'),'required':![]}};exports[_0x26a0('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x26a0('0x6')]={'uniqueid':{'type':_0x26a0('0x1'),'required':!![]},'filename':{'type':_0x26a0('0x1')},'format':{'type':_0x26a0('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x26a0('0x7')]={'uniqueid':{'type':_0x26a0('0x1'),'required':!![]}};exports[_0x26a0('0x8')]={'uniqueid':{'type':_0x26a0('0x1'),'required':!![]},'exten':{'type':_0x26a0('0x1'),'required':!![]},'context':{'type':_0x26a0('0x1')}}; \ No newline at end of file +var _0xaa32=['voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x504a7e,_0x28912e){var _0x1da154=function(_0x3597ef){while(--_0x3597ef){_0x504a7e['push'](_0x504a7e['shift']());}};_0x1da154(++_0x28912e);}(_0xaa32,0x78));var _0x2aa3=function(_0x57787e,_0x120aea){_0x57787e=_0x57787e-0x0;var _0x518830=_0xaa32[_0x57787e];return _0x518830;};'use strict';exports[_0x2aa3('0x0')]={'queue':{'type':_0x2aa3('0x1'),'required':!![]},'interface':{'type':_0x2aa3('0x1'),'required':!![]},'membername':{'type':_0x2aa3('0x1'),'required':!![]},'penalty':{'type':_0x2aa3('0x2'),'required':![]},'paused':{'type':_0x2aa3('0x3'),'required':![]}};exports[_0x2aa3('0x4')]={'queue':{'type':_0x2aa3('0x1'),'required':!![]},'interface':{'type':_0x2aa3('0x1'),'required':!![]}};exports[_0x2aa3('0x5')]={'interface':{'type':_0x2aa3('0x1'),'required':!![]},'paused':{'type':_0x2aa3('0x3')},'reason':{'type':_0x2aa3('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x2aa3('0x6')]={'uniqueid':{'type':_0x2aa3('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x2aa3('0x1'),'required':!![]},'filename':{'type':_0x2aa3('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x2aa3('0x1')}};exports[_0x2aa3('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x2aa3('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x2aa3('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 61c4e68..6fa595d 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x3845f8,_0x1b3ba5){var _0x31f591=function(_0xc2ca){while(--_0xc2ca){_0x3845f8['push'](_0x3845f8['shift']());}};_0x31f591(++_0x1b3ba5);}(_0xb10b,0x12a));var _0xbb10=function(_0x22d72b,_0x112e6d){_0x22d72b=_0x22d72b-0x0;var _0x35f65f=_0xb10b[_0x22d72b];return _0x35f65f;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _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(_0x5886ac,_0x533256){var _0x4a2954=function(_0x526c2f){while(--_0x526c2f){_0x5886ac['push'](_0x5886ac['shift']());}};_0x4a2954(++_0x533256);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36fe10,_0x539789){_0x36fe10=_0x36fe10-0x0;var _0x24a049=_0x5f2f[_0x36fe10];return _0x24a049;};'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 11d837b..daf18ad 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 _0x3975=['hasOwnProperty','assign'];(function(_0x27500e,_0x452848){var _0x25f3bf=function(_0x32ae8e){while(--_0x32ae8e){_0x27500e['push'](_0x27500e['shift']());}};_0x25f3bf(++_0x452848);}(_0x3975,0xad));var _0x5397=function(_0x4a8b41,_0x3a6f41){_0x4a8b41=_0x4a8b41-0x0;var _0x4df231=_0x3975[_0x4a8b41];return _0x4df231;};'use strict';function mergeDBDataToRealtime(_0x1f7d0e,_0x38e6da){var _0x53befb=Object[_0x5397('0x0')]({},_0x1f7d0e);for(var _0x757f9b in _0x38e6da){if(_0x53befb[_0x5397('0x1')](_0x757f9b)){_0x53befb[_0x757f9b]=_0x38e6da[_0x757f9b];}}return _0x53befb;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x2a47=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0xb17247,_0x4b94b5){var _0x3473ff=function(_0x4629e4){while(--_0x4629e4){_0xb17247['push'](_0xb17247['shift']());}};_0x3473ff(++_0x4b94b5);}(_0x2a47,0x1bd));var _0x72a4=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x2a47[_0x725b8e];return _0x43ac45;};'use strict';function mergeDBDataToRealtime(_0x3054c8,_0x462708){var _0x196ed0=Object[_0x72a4('0x0')]({},_0x3054c8);for(var _0x557768 in _0x462708){if(_0x196ed0[_0x72a4('0x1')](_0x557768)){_0x196ed0[_0x557768]=_0x462708[_0x557768];}}return _0x196ed0;}exports[_0x72a4('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 bd464f3..d008863 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 _0x5c05=['voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','agents','accountcode','name','isNil','interface','SIP/%s','findAgent','connectedlinenum','assigned','queuecallercomplete','queuecallercompleteAt','format','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','length','channel','split','calleridnum','outbound','internal','voiceCallReport','destination','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','getCallType','UserId','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x5c05,0x1d1));var _0x55c0=function(_0x3db39b,_0x44dc1f){_0x3db39b=_0x3db39b-0x0;var _0x441ad3=_0x5c05[_0x3db39b];return _0x441ad3;};'use strict';var _=require(_0x55c0('0x0'));var moment=require(_0x55c0('0x1'));var util=require(_0x55c0('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x55c0('0x3'));var RpcVoiceCallReport=require(_0x55c0('0x4'));var RpcVoiceDialReport=require(_0x55c0('0x5'));var RpcMemberReport=require(_0x55c0('0x6'));var RpcVoiceQueueReport=require(_0x55c0('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x55c0('0x8'));var VoiceCallReport=require(_0x55c0('0x9'));var VoiceAgentReport=require(_0x55c0('0xa'));var VoiceDialReport=require(_0x55c0('0xb'));var UserReport=require(_0x55c0('0xc'));function Report(_0x5d8049){this[_0x55c0('0xd')]=_0x5d8049;this['agents']=_0x5d8049['agents'];this['telephones']=_0x5d8049[_0x55c0('0xe')];}Report[_0x55c0('0xf')]['sync']=function(_0x65d699){var _0x565a70=new VoiceQueueReport(this[_0x55c0('0xd')]);var _0x1b32fc=new VoiceAgentReport(this['realtime']);var _0xe52c98=new VoiceDialReport(this[_0x55c0('0xd')]);var _0x36eedf=new VoiceCallReport(this[_0x55c0('0xd')]);var _0x198a55=new UserReport(this[_0x55c0('0xd')]);if(config[_0x55c0('0x10')]&&config[_0x55c0('0x10')][_0x55c0('0x11')]){ami['on'](_0x55c0('0x12'),this[_0x55c0('0x13')][_0x55c0('0x14')](this));ami['on'](_0x55c0('0x15'),this['voiceCallReport']['bind'](this));ami['on'](_0x55c0('0x16'),this[_0x55c0('0x17')]['bind'](this));ami['on'](_0x55c0('0x18'),this[_0x55c0('0x19')][_0x55c0('0x14')](this));ami['on'](_0x55c0('0x1a'),this['blindTransfer'][_0x55c0('0x14')](this));ami['on'](_0x55c0('0x1b'),this[_0x55c0('0x1c')][_0x55c0('0x14')](this));}};Report[_0x55c0('0xf')]['findAgent']=function(_0x36ec0a){var _0x178a3f;_0x178a3f=_[_0x55c0('0x1d')](this[_0x55c0('0x1e')],function(_0x2541f2){return _0x2541f2[_0x55c0('0x1f')]==_0x36ec0a||_0x2541f2[_0x55c0('0x20')]==_0x36ec0a;});if(_[_0x55c0('0x21')](_0x178a3f)){var _0x46d9c7=_[_0x55c0('0x1d')](this['telephones'],function(_0x24f7d3){return _0x24f7d3[_0x55c0('0x1f')]==_0x36ec0a||_0x24f7d3[_0x55c0('0x20')]==_0x36ec0a;});if(_0x46d9c7){_0x178a3f=_[_0x55c0('0x1d')](this[_0x55c0('0x1e')],function(_0x3d6047){return _0x3d6047[_0x55c0('0x22')]==util['format'](_0x55c0('0x23'),_0x46d9c7['name']);});}}return _0x178a3f;};Report[_0x55c0('0xf')][_0x55c0('0x13')]=function(_0x8dc97c){for(var _0x50599a=0x0;_0x50599a<_0x8dc97c['length'];_0x50599a+=0x1){var _0x3f0381=this[_0x55c0('0x24')](_0x8dc97c[_0x50599a][_0x55c0('0x25')]);if(_0x3f0381){_0x8dc97c[_0x50599a][_0x55c0('0x1f')]=_0x3f0381[_0x55c0('0x1f')];_0x8dc97c[_0x50599a][_0x55c0('0x26')]=!![];_0x8dc97c[_0x50599a]['lastAssignedTo']=_0x3f0381[_0x55c0('0x20')];_0x8dc97c[_0x50599a][_0x55c0('0x22')]=_[_0x55c0('0x21')](_0x3f0381[_0x55c0('0x22')])?util['format'](_0x55c0('0x23'),_0x3f0381['name']):_0x3f0381[_0x55c0('0x22')];if(_0x8dc97c[_0x50599a][_0x55c0('0x27')]){_0x8dc97c[_0x50599a][_0x55c0('0x28')]=moment()[_0x55c0('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x8dc97c[_0x50599a][_0x55c0('0x2a')]){_0x8dc97c[_0x50599a][_0x55c0('0x2b')]=moment()[_0x55c0('0x29')](_0x55c0('0x2c'));}RpcMemberReport['voiceQueueReport'](_0x8dc97c[_0x50599a]);}RpcVoiceQueueReport[_0x55c0('0x2d')](_0x8dc97c[_0x50599a]);}};function extractCalleridNumber(_0x353f34){var _0x518409=_0x353f34[_0x55c0('0x2e')](/<(.*?)>/);return _0x518409?_0x518409[0x1]:_0x353f34;}Report[_0x55c0('0xf')][_0x55c0('0x2f')]=function(_0x23ea70){for(var _0x167288=0x0;_0x167288/);return _0x4b5625?_0x4b5625[0x1]:_0x5a574f;}Report['prototype']['getAgentByInternal']=function(_0x30558d){for(var _0x478d8d=0x0;_0x478d8d',_0x117aac[_0x04c1('0x3e')],_0x117aac['calleridnum']);}if(RpcVoiceTransferReport[_0x04c1('0x3f')][_0x117aac[_0x04c1('0x40')]]){var _0x226571=RpcVoiceTransferReport[_0x04c1('0x3f')][_0x117aac[_0x04c1('0x40')]];_0x226571[_0x04c1('0x41')]=_0x117aac['uniqueid'];RpcVoiceTransferReport['blindTransfer'](_0x226571);delete RpcVoiceTransferReport[_0x04c1('0x3f')][_0x117aac[_0x04c1('0x40')]];}if(_[_0x04c1('0x1f')](_0x117aac[_0x04c1('0x32')])){_0x117aac['type']=this['getCallType'](_0x117aac);}if(_[_0x04c1('0x1f')](_0x117aac[_0x04c1('0x42')])){var _0x5862ae=_0x117aac['channel'][_0x04c1('0x2d')]('-')[0x0];var _0x57852a=this[_0x04c1('0xb')][_0x5862ae];if(!_0x57852a)_0x57852a=this[_0x04c1('0x43')](_0x117aac[_0x04c1('0x1d')]);if(_0x57852a){_0x117aac[_0x04c1('0x42')]=_0x57852a['id'];_0x117aac[_0x04c1('0x44')]=_0x57852a[_0x04c1('0x1e')];}}RpcVoiceCallReport['create'](_0x117aac);if(_0x117aac['monitor']){for(var _0x4dc1f4=0x0;_0x4dc1f4<_0x117aac[_0x04c1('0x45')]['length'];_0x4dc1f4+=0x1){_0x117aac[_0x04c1('0x46')]=_0x117aac['monitors'][_0x4dc1f4][_0x04c1('0x47')];_0x117aac[_0x04c1('0x48')]=_0x117aac['monitors'][_0x4dc1f4][_0x04c1('0x48')];if(_0x117aac['exten']==_0x04c1('0x38')){_0x117aac[_0x04c1('0x2e')]=_0x117aac[_0x04c1('0x24')];_0x117aac['calleridname']=_0x117aac[_0x04c1('0x49')];_0x117aac[_0x04c1('0x24')]=_0x117aac[_0x04c1('0x1d')];_0x117aac[_0x04c1('0x49')]=_0x117aac['membername'];_0x117aac[_0x04c1('0x31')]=_0x117aac[_0x04c1('0x3a')];}else if(_0x117aac[_0x04c1('0x31')]=='xcally-motion-dialer'){_0x117aac[_0x04c1('0x2e')]=_0x117aac['destination'];_0x117aac[_0x04c1('0x31')]=_0x117aac['originatecalleridnum'];}RpcVoiceRecording[_0x04c1('0x2a')](_0x117aac);}}};Report['prototype']['voiceAgentReport']=function(_0x2e33b7){if(_[_0x04c1('0x4a')](_0x2e33b7)){_0x2e33b7['forEach'](function(_0x131cfe){RpcVoiceAgentReport[_0x04c1('0x2a')](_0x131cfe);});}else{RpcVoiceAgentReport[_0x04c1('0x2a')](_0x2e33b7);}};Report[_0x04c1('0xd')][_0x04c1('0x16')]=function(_0x47e9de){RpcVoiceDialReport[_0x04c1('0x2a')](_0x47e9de);var _0x2b5dd2;var _0x3c0bc7;var _0x3b0acf=_0x47e9de[_0x04c1('0x2c')];if(_[_0x04c1('0x4b')](_0x3b0acf,_0x04c1('0x4c'))){_0x3c0bc7=_0x3b0acf[_0x04c1('0x4d')](_0x3b0acf[_0x04c1('0x4e')]('/')+0x1,_0x3b0acf[_0x04c1('0x4e')]('@'));_0x2b5dd2=_[_0x04c1('0x1c')](this[_0x04c1('0xb')],function(_0x4363da){return _0x4363da[_0x04c1('0x4f')]==_0x3c0bc7||_0x4363da[_0x04c1('0x50')]==_0x3c0bc7||_0x4363da['accountcode']==_0x3c0bc7;});}else{_0x3c0bc7=_0x3b0acf[_0x04c1('0x4d')](_0x3b0acf['indexOf']('/')+0x1,_0x3b0acf[_0x04c1('0x51')]('-'));_0x2b5dd2=this[_0x04c1('0x1b')](_0x3c0bc7);}if(_0x2b5dd2){_0x47e9de[_0x04c1('0x20')]=_[_0x04c1('0x1f')](_0x2b5dd2[_0x04c1('0x20')])?util[_0x04c1('0x21')](_0x04c1('0x22'),_0x2b5dd2[_0x04c1('0x1e')]):_0x2b5dd2[_0x04c1('0x20')];_0x47e9de[_0x04c1('0x44')]=_0x2b5dd2[_0x04c1('0x1e')];_0x47e9de[_0x04c1('0x1d')]=_0x2b5dd2[_0x04c1('0x1d')];RpcMemberReport['voiceDialReport'](_0x47e9de);}};Report['prototype'][_0x04c1('0x18')]=function(_0x1f03fe){RpcVoiceTransferReport['transfers'][_0x1f03fe[_0x04c1('0x52')]]=_0x1f03fe;};Report['prototype'][_0x04c1('0x1a')]=function(_0x1cb02e){RpcVoiceTransferReport['attendedTransfer'](_0x1cb02e);};module[_0x04c1('0x53')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index a107741..3008abb 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x894a=['accountcode','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','[userReport][sipshowregistry]','actionDeviceStateList','catch','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','inspect','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','state','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','local','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','Local','indexOf','mobile'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0x894a,0xe1));var _0xa894=function(_0x1cd6b4,_0x1b1a18){_0x1cd6b4=_0x1cd6b4-0x0;var _0x5012fa=_0x894a[_0x1cd6b4];return _0x5012fa;};'use strict';var _=require(_0xa894('0x0'));var moment=require(_0xa894('0x1'));var util=require('util');var Redis=require('ioredis');var BPromise=require(_0xa894('0x2'));var config=require(_0xa894('0x3'));var logger=require(_0xa894('0x4'))(_0xa894('0x5'));var ami=require(_0xa894('0x6'));config[_0xa894('0x7')]=_[_0xa894('0x8')](config[_0xa894('0x7')],{'host':_0xa894('0x9'),'port':0x18eb});var io=require(_0xa894('0xa'))(new Redis(config[_0xa894('0x7')]));function UserReport(_0x116dec){this[_0xa894('0xb')]=_0x116dec[_0xa894('0xb')];this[_0xa894('0xc')]=_0x116dec[_0xa894('0xc')];this['telephones']=_0x116dec[_0xa894('0xd')];ami['on'](_0xa894('0xe'),this[_0xa894('0xf')][_0xa894('0x10')](this));ami['on']('registry',this[_0xa894('0xf')][_0xa894('0x10')](this));ami['on'](_0xa894('0x11'),this['syncDeviceState'][_0xa894('0x10')](this));ami['on'](_0xa894('0x12'),this[_0xa894('0x13')][_0xa894('0x10')](this));return this[_0xa894('0x14')]();}function showSipRegistrations(){Promise[_0xa894('0x15')]()[_0xa894('0x16')](ami['actionSipShowRegistry']())['catch'](function(_0x238403){logger['error'](_0xa894('0x17'),util['inspect'](_0x238403,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0xa894('0x18')]())[_0xa894('0x19')](function(_0x554145){logger[_0xa894('0x1a')](_0xa894('0x1b'),util['inspect'](_0x554145,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xa894('0x15')]()[_0xa894('0x16')](ami[_0xa894('0x1c')]())[_0xa894('0x19')](function(_0x4fd1e2){logger['error'](_0xa894('0x1d'),util[_0xa894('0x1e')](_0x4fd1e2,{'showHidden':![],'depth':null}));});}UserReport[_0xa894('0x1f')][_0xa894('0x14')]=function(){setInterval(function(){BPromise[_0xa894('0x15')]()[_0xa894('0x16')](showSipRegistrations())['then'](listDeviceStates())[_0xa894('0x16')](showPeersStatus());},0x32c8);};UserReport[_0xa894('0x1f')][_0xa894('0x20')]=function(_0x38515d){return _0x38515d!==null&&!_[_0xa894('0x21')](_0x38515d);};UserReport['prototype'][_0xa894('0x22')]=function(_0x2290b3,_0x3a07df,_0x23e028){io['to'](_0x2290b3)[_0xa894('0x22')](_0x3a07df,_0x23e028);};UserReport[_0xa894('0x1f')][_0xa894('0xf')]=function(_0x2f79be){try{if(this[_0xa894('0x20')](_0x2f79be)){logger[_0xa894('0x23')](_0xa894('0x24'),_0x2f79be[_0xa894('0x25')],_0x2f79be['state']);logger[_0xa894('0x26')](_0xa894('0x27'),util[_0xa894('0x1e')](_0x2f79be,{'showHidden':![],'depth':null}));var _0x2e8809=_['find'](this[_0xa894('0xb')],{'defaultuser':_0x2f79be[_0xa894('0x25')]});if(_0x2e8809){_0x2f79be['stateRegistry']=_0x2f79be[_0xa894('0x28')];_[_0xa894('0x29')](_0x2e8809,_[_0xa894('0x2a')](_0x2f79be,[_0xa894('0x2b'),_0xa894('0x2c'),'username',_0xa894('0x28')]));logger[_0xa894('0x26')](_0xa894('0x2d'),util[_0xa894('0x1e')](_0x2e8809,{'showHidden':![],'depth':null}));this['emit'](util[_0xa894('0x2e')](_0xa894('0x2f'),_0x2e8809[_0xa894('0x30')]),_0xa894('0x31'),_0x2e8809);}}}catch(_0x4d1b49){logger[_0xa894('0x1a')](_0xa894('0x27'),util[_0xa894('0x1e')](_0x4d1b49,{'showHidden':![],'depth':null}));}};UserReport[_0xa894('0x1f')][_0xa894('0x32')]=function(_0x4f2cfc){try{if(this[_0xa894('0x20')](_0x4f2cfc)){logger[_0xa894('0x23')](_0xa894('0x33'),_0x4f2cfc[_0xa894('0x34')],_0x4f2cfc[_0xa894('0x28')]);logger[_0xa894('0x26')](_0xa894('0x35'),util['inspect'](_0x4f2cfc,{'showHidden':![],'depth':null}));if(this[_0xa894('0xc')][_0x4f2cfc['device']]){if(!this[_0xa894('0xc')][_0x4f2cfc[_0xa894('0x34')]]['local']||_0x4f2cfc[_0xa894('0x28')][_0xa894('0x36')]()=='inuse'){this[_0xa894('0xc')][_0x4f2cfc['device']][_0xa894('0x37')]=![];if(this[_0xa894('0xc')][_0x4f2cfc[_0xa894('0x34')]][_0xa894('0x28')]!==_0x4f2cfc[_0xa894('0x28')][_0xa894('0x36')]()){this['agents'][_0x4f2cfc[_0xa894('0x34')]]['stateTime']=_[_0xa894('0x38')](moment()['format']('x'));}this['agents'][_0x4f2cfc[_0xa894('0x34')]][_0xa894('0x28')]=_0x4f2cfc[_0xa894('0x28')][_0xa894('0x36')]();this['agents'][_0x4f2cfc[_0xa894('0x34')]][_0xa894('0x39')](_0x4f2cfc);}}else if(this[_0xa894('0xd')][_0x4f2cfc[_0xa894('0x34')]]){if(this[_0xa894('0xd')][_0x4f2cfc[_0xa894('0x34')]][_0xa894('0x28')]!==_0x4f2cfc['state'][_0xa894('0x36')]()){this[_0xa894('0xd')][_0x4f2cfc[_0xa894('0x34')]]['stateTime']=_[_0xa894('0x38')](moment()[_0xa894('0x2e')]('x'));}this['telephones'][_0x4f2cfc[_0xa894('0x34')]][_0xa894('0x28')]=_0x4f2cfc[_0xa894('0x28')][_0xa894('0x36')]();logger[_0xa894('0x26')](_0xa894('0x3a'),util[_0xa894('0x1e')](this[_0xa894('0xd')][_0x4f2cfc['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0xa894('0x2e')](_0xa894('0x3b'),this[_0xa894('0xd')][_0x4f2cfc[_0xa894('0x34')]][_0xa894('0x30')]),'telephone:save',this[_0xa894('0xd')][_0x4f2cfc[_0xa894('0x34')]]);}else if(this[_0xa894('0xb')][_0x4f2cfc[_0xa894('0x34')]]){if(this[_0xa894('0xb')][_0x4f2cfc[_0xa894('0x34')]]['state']!==_0x4f2cfc[_0xa894('0x28')][_0xa894('0x36')]()){this[_0xa894('0xb')][_0x4f2cfc[_0xa894('0x34')]]['stateTime']=_[_0xa894('0x38')](moment()[_0xa894('0x2e')]('x'));}this['trunks'][_0x4f2cfc['device']][_0xa894('0x28')]=_0x4f2cfc[_0xa894('0x28')][_0xa894('0x36')]();logger[_0xa894('0x26')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xa894('0x1e')](this[_0xa894('0xb')][_0x4f2cfc[_0xa894('0x34')]],{'showHidden':![],'depth':null}));this[_0xa894('0x22')](util[_0xa894('0x2e')](_0xa894('0x2f'),this[_0xa894('0xb')][_0x4f2cfc[_0xa894('0x34')]][_0xa894('0x30')]),_0xa894('0x31'),this[_0xa894('0xb')][_0x4f2cfc[_0xa894('0x34')]]);}else if(_['startsWith'](_0x4f2cfc[_0xa894('0x34')],_0xa894('0x3c'))){var _0x1a4a44=_0x4f2cfc[_0xa894('0x34')];var _0x398f76=_0x1a4a44['substring'](_0x1a4a44[_0xa894('0x3d')]('/')+0x1,_0x1a4a44['indexOf']('@'));var _0x314d11=_['find'](this[_0xa894('0xc')],function(_0x1e7965){return _0x1e7965[_0xa894('0x3e')]==_0x398f76||_0x1e7965['phone']==_0x398f76||_0x1e7965[_0xa894('0x3f')]==_0x398f76;});if(_0x314d11){if(_0x314d11[_0xa894('0x28')]!==_0x4f2cfc[_0xa894('0x28')]['toLowerCase']()){_0x314d11['stateTime']=_[_0xa894('0x38')](moment()['format']('x'));}_0x314d11[_0xa894('0x28')]=_0x4f2cfc[_0xa894('0x28')][_0xa894('0x36')]();_0x314d11[_0xa894('0x37')]=!![];_0x314d11['updateStatusRealtime'](_0x4f2cfc);}}}}catch(_0x50ea9f){logger[_0xa894('0x1a')](_0xa894('0x35'),util['inspect'](_0x50ea9f,{'showHidden':![],'depth':null}));}};UserReport[_0xa894('0x1f')][_0xa894('0x13')]=function(_0x74304f){try{if(this[_0xa894('0x20')](_0x74304f)&&this[_0xa894('0x20')](_0x74304f['peerstatus'])){logger[_0xa894('0x23')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x74304f[_0xa894('0x40')],_0x74304f['address'],_0x74304f[_0xa894('0x12')]);logger[_0xa894('0x26')](_0xa894('0x41'),util[_0xa894('0x1e')](_0x74304f,{'showHidden':![],'depth':null}));if(this[_0xa894('0xc')][_0x74304f[_0xa894('0x40')]]){if(!this['agents'][_0x74304f[_0xa894('0x40')]][_0xa894('0x37')]||_0x74304f['peerstatus'][_0xa894('0x36')]()==_0xa894('0x42')){this[_0xa894('0xc')][_0x74304f[_0xa894('0x40')]][_0xa894('0x37')]=![];this[_0xa894('0xc')][_0x74304f[_0xa894('0x40')]][_0xa894('0x43')]=_0x74304f['peerstatus'][_0xa894('0x36')]();this['agents'][_0x74304f[_0xa894('0x40')]][_0xa894('0x44')]=_0x74304f['address'];this[_0xa894('0xc')][_0x74304f['peer']]['updateStatusRealtime'](_0x74304f);}}else if(this[_0xa894('0xd')][_0x74304f[_0xa894('0x40')]]){this[_0xa894('0xd')][_0x74304f['peer']][_0xa894('0x43')]=_0x74304f['peerstatus'][_0xa894('0x36')]();this[_0xa894('0xd')][_0x74304f[_0xa894('0x40')]]['address']=_0x74304f[_0xa894('0x44')];logger['debug'](_0xa894('0x45'),util[_0xa894('0x1e')](this[_0xa894('0xd')][_0x74304f['peer']],{'showHidden':![],'depth':null}));this[_0xa894('0x22')](util[_0xa894('0x2e')](_0xa894('0x3b'),this['telephones'][_0x74304f['peer']][_0xa894('0x30')]),_0xa894('0x46'),this[_0xa894('0xd')][_0x74304f[_0xa894('0x40')]]);}else if(this[_0xa894('0xb')][_0x74304f['peer']]){this[_0xa894('0xb')][_0x74304f['peer']][_0xa894('0x43')]=_0x74304f[_0xa894('0x12')][_0xa894('0x36')]();this[_0xa894('0xb')][_0x74304f[_0xa894('0x40')]][_0xa894('0x44')]=_0x74304f[_0xa894('0x44')];logger[_0xa894('0x26')](_0xa894('0x47'),util['inspect'](this[_0xa894('0xb')][_0x74304f[_0xa894('0x40')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xa894('0x2e')]('trunk:%s',this['trunks'][_0x74304f['peer']][_0xa894('0x30')]),_0xa894('0x31'),this[_0xa894('0xb')][_0x74304f['peer']]);}}}catch(_0x16f5e1){logger['error'](_0xa894('0x41'),util[_0xa894('0x1e')](_0x16f5e1,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xaf13=['[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','ioredis','bluebird','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','catch','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','syncRealtimeShow','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','stateRegistry','merge','actionid','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','toLowerCase','inuse','local','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','find','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','telephone:save'];(function(_0x206719,_0x43e3bd){var _0x13df0f=function(_0x3d253b){while(--_0x3d253b){_0x206719['push'](_0x206719['shift']());}};_0x13df0f(++_0x43e3bd);}(_0xaf13,0x1b2));var _0x3af1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaf13[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x3af1('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x3af1('0x1'));var BPromise=require(_0x3af1('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0x3af1('0x3')]=_['defaults'](config['redis'],{'host':_0x3af1('0x4'),'port':0x18eb});var io=require(_0x3af1('0x5'))(new Redis(config[_0x3af1('0x3')]));function UserReport(_0x43f541){this[_0x3af1('0x6')]=_0x43f541[_0x3af1('0x6')];this[_0x3af1('0x7')]=_0x43f541['agents'];this[_0x3af1('0x8')]=_0x43f541[_0x3af1('0x8')];ami['on'](_0x3af1('0x9'),this[_0x3af1('0xa')][_0x3af1('0xb')](this));ami['on'](_0x3af1('0xc'),this[_0x3af1('0xa')][_0x3af1('0xb')](this));ami['on'](_0x3af1('0xd'),this[_0x3af1('0xe')][_0x3af1('0xb')](this));ami['on'](_0x3af1('0xf'),this[_0x3af1('0x10')][_0x3af1('0xb')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0x3af1('0x11')](ami[_0x3af1('0x12')]())['catch'](function(_0x42a3f2){logger[_0x3af1('0x13')](_0x3af1('0x14'),util[_0x3af1('0x15')](_0x42a3f2,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x3af1('0x16')]()['then'](ami[_0x3af1('0x17')]())[_0x3af1('0x18')](function(_0x532d19){logger['error'](_0x3af1('0x19'),util['inspect'](_0x532d19,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3af1('0x16')]()[_0x3af1('0x11')](ami[_0x3af1('0x1a')]())[_0x3af1('0x18')](function(_0x3f3f40){logger[_0x3af1('0x13')](_0x3af1('0x1b'),util[_0x3af1('0x15')](_0x3f3f40,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x3af1('0x1c')]=function(){setInterval(function(){BPromise[_0x3af1('0x16')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x3af1('0x11')](showPeersStatus());},0x32c8);};UserReport[_0x3af1('0x1d')][_0x3af1('0x1e')]=function(_0x65e61f){return _0x65e61f!==null&&!_[_0x3af1('0x1f')](_0x65e61f);};UserReport[_0x3af1('0x1d')][_0x3af1('0x20')]=function(_0x67beac,_0x1e59cc,_0x589c44){io['to'](_0x67beac)[_0x3af1('0x20')](_0x1e59cc,_0x589c44);};UserReport['prototype']['syncRegistry']=function(_0x12f182){try{if(this[_0x3af1('0x1e')](_0x12f182)){logger[_0x3af1('0x21')](_0x3af1('0x22'),_0x12f182[_0x3af1('0x23')],_0x12f182[_0x3af1('0x24')]);logger[_0x3af1('0x25')](_0x3af1('0x26'),util[_0x3af1('0x15')](_0x12f182,{'showHidden':![],'depth':null}));var _0x342192=_['find'](this[_0x3af1('0x6')],{'defaultuser':_0x12f182[_0x3af1('0x23')]});if(_0x342192){_0x12f182[_0x3af1('0x27')]=_0x12f182['state'];_[_0x3af1('0x28')](_0x342192,_['omit'](_0x12f182,['event',_0x3af1('0x29'),_0x3af1('0x23'),_0x3af1('0x24')]));logger[_0x3af1('0x25')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x3af1('0x15')](_0x342192,{'showHidden':![],'depth':null}));this['emit'](util[_0x3af1('0x2a')](_0x3af1('0x2b'),_0x342192[_0x3af1('0x2c')]),_0x3af1('0x2d'),_0x342192);}}}catch(_0x8e43de){logger[_0x3af1('0x13')]('[userReport][registry]',util[_0x3af1('0x15')](_0x8e43de,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x3d2b3a){try{if(this[_0x3af1('0x1e')](_0x3d2b3a)){logger[_0x3af1('0x21')](_0x3af1('0x2e'),_0x3d2b3a['device'],_0x3d2b3a[_0x3af1('0x24')]);logger[_0x3af1('0x25')](_0x3af1('0x2f'),util[_0x3af1('0x15')](_0x3d2b3a,{'showHidden':![],'depth':null}));if(this[_0x3af1('0x7')][_0x3d2b3a[_0x3af1('0x30')]]){if(!this[_0x3af1('0x7')][_0x3d2b3a[_0x3af1('0x30')]]['local']||_0x3d2b3a[_0x3af1('0x24')][_0x3af1('0x31')]()==_0x3af1('0x32')){this[_0x3af1('0x7')][_0x3d2b3a[_0x3af1('0x30')]][_0x3af1('0x33')]=![];if(this[_0x3af1('0x7')][_0x3d2b3a[_0x3af1('0x30')]][_0x3af1('0x24')]!==_0x3d2b3a[_0x3af1('0x24')][_0x3af1('0x31')]()){this[_0x3af1('0x7')][_0x3d2b3a[_0x3af1('0x30')]][_0x3af1('0x34')]=_[_0x3af1('0x35')](moment()[_0x3af1('0x2a')]('x'));}this[_0x3af1('0x7')][_0x3d2b3a['device']]['state']=_0x3d2b3a['state']['toLowerCase']();this[_0x3af1('0x7')][_0x3d2b3a['device']]['updateStatusRealtime'](_0x3d2b3a);}}else if(this['telephones'][_0x3d2b3a['device']]){if(this['telephones'][_0x3d2b3a['device']][_0x3af1('0x24')]!==_0x3d2b3a[_0x3af1('0x24')][_0x3af1('0x31')]()){this[_0x3af1('0x8')][_0x3d2b3a[_0x3af1('0x30')]][_0x3af1('0x34')]=_[_0x3af1('0x35')](moment()['format']('x'));}this[_0x3af1('0x8')][_0x3d2b3a[_0x3af1('0x30')]][_0x3af1('0x24')]=_0x3d2b3a[_0x3af1('0x24')][_0x3af1('0x31')]();logger[_0x3af1('0x25')](_0x3af1('0x36'),util['inspect'](this[_0x3af1('0x8')][_0x3d2b3a[_0x3af1('0x30')]],{'showHidden':![],'depth':null}));this[_0x3af1('0x20')](util[_0x3af1('0x2a')](_0x3af1('0x37'),this[_0x3af1('0x8')][_0x3d2b3a[_0x3af1('0x30')]]['name']),'telephone:save',this[_0x3af1('0x8')][_0x3d2b3a[_0x3af1('0x30')]]);}else if(this['trunks'][_0x3d2b3a[_0x3af1('0x30')]]){if(this[_0x3af1('0x6')][_0x3d2b3a[_0x3af1('0x30')]]['state']!==_0x3d2b3a[_0x3af1('0x24')][_0x3af1('0x31')]()){this['trunks'][_0x3d2b3a[_0x3af1('0x30')]][_0x3af1('0x34')]=_[_0x3af1('0x35')](moment()[_0x3af1('0x2a')]('x'));}this[_0x3af1('0x6')][_0x3d2b3a[_0x3af1('0x30')]][_0x3af1('0x24')]=_0x3d2b3a['state']['toLowerCase']();logger[_0x3af1('0x25')](_0x3af1('0x38'),util[_0x3af1('0x15')](this[_0x3af1('0x6')][_0x3d2b3a[_0x3af1('0x30')]],{'showHidden':![],'depth':null}));this[_0x3af1('0x20')](util[_0x3af1('0x2a')](_0x3af1('0x2b'),this[_0x3af1('0x6')][_0x3d2b3a['device']][_0x3af1('0x2c')]),'trunk:save',this[_0x3af1('0x6')][_0x3d2b3a[_0x3af1('0x30')]]);}else if(_['startsWith'](_0x3d2b3a[_0x3af1('0x30')],_0x3af1('0x39'))){var _0x411e3c=_0x3d2b3a['device'];var _0x35b1df=_0x411e3c[_0x3af1('0x3a')](_0x411e3c[_0x3af1('0x3b')]('/')+0x1,_0x411e3c[_0x3af1('0x3b')]('@'));var _0x381ed5=_[_0x3af1('0x3c')](this[_0x3af1('0x7')],function(_0x39448c){return _0x39448c['mobile']==_0x35b1df||_0x39448c['phone']==_0x35b1df||_0x39448c[_0x3af1('0x3d')]==_0x35b1df;});if(_0x381ed5){if(_0x381ed5[_0x3af1('0x24')]!==_0x3d2b3a[_0x3af1('0x24')]['toLowerCase']()){_0x381ed5[_0x3af1('0x34')]=_['toNumber'](moment()[_0x3af1('0x2a')]('x'));}_0x381ed5[_0x3af1('0x24')]=_0x3d2b3a[_0x3af1('0x24')][_0x3af1('0x31')]();_0x381ed5[_0x3af1('0x33')]=!![];_0x381ed5[_0x3af1('0x3e')](_0x3d2b3a);}}}}catch(_0x238660){logger[_0x3af1('0x13')](_0x3af1('0x2f'),util['inspect'](_0x238660,{'showHidden':![],'depth':null}));}};UserReport[_0x3af1('0x1d')][_0x3af1('0x10')]=function(_0x5915e0){try{if(this[_0x3af1('0x1e')](_0x5915e0)&&this['isNotNull'](_0x5915e0[_0x3af1('0xf')])){logger[_0x3af1('0x21')](_0x3af1('0x3f'),_0x5915e0['peer'],_0x5915e0[_0x3af1('0x40')],_0x5915e0[_0x3af1('0xf')]);logger[_0x3af1('0x25')](_0x3af1('0x41'),util['inspect'](_0x5915e0,{'showHidden':![],'depth':null}));if(this[_0x3af1('0x7')][_0x5915e0[_0x3af1('0x42')]]){if(!this[_0x3af1('0x7')][_0x5915e0['peer']]['local']||_0x5915e0[_0x3af1('0xf')][_0x3af1('0x31')]()==_0x3af1('0x43')){this['agents'][_0x5915e0[_0x3af1('0x42')]]['local']=![];this['agents'][_0x5915e0[_0x3af1('0x42')]]['status']=_0x5915e0[_0x3af1('0xf')][_0x3af1('0x31')]();this[_0x3af1('0x7')][_0x5915e0[_0x3af1('0x42')]][_0x3af1('0x40')]=_0x5915e0[_0x3af1('0x40')];this['agents'][_0x5915e0['peer']]['updateStatusRealtime'](_0x5915e0);}}else if(this[_0x3af1('0x8')][_0x5915e0[_0x3af1('0x42')]]){this[_0x3af1('0x8')][_0x5915e0[_0x3af1('0x42')]][_0x3af1('0x44')]=_0x5915e0['peerstatus'][_0x3af1('0x31')]();this['telephones'][_0x5915e0[_0x3af1('0x42')]][_0x3af1('0x40')]=_0x5915e0[_0x3af1('0x40')];logger[_0x3af1('0x25')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x3af1('0x15')](this[_0x3af1('0x8')][_0x5915e0[_0x3af1('0x42')]],{'showHidden':![],'depth':null}));this[_0x3af1('0x20')](util[_0x3af1('0x2a')]('telephone:%s',this[_0x3af1('0x8')][_0x5915e0['peer']][_0x3af1('0x2c')]),_0x3af1('0x45'),this[_0x3af1('0x8')][_0x5915e0[_0x3af1('0x42')]]);}else if(this[_0x3af1('0x6')][_0x5915e0[_0x3af1('0x42')]]){this['trunks'][_0x5915e0[_0x3af1('0x42')]][_0x3af1('0x44')]=_0x5915e0[_0x3af1('0xf')][_0x3af1('0x31')]();this[_0x3af1('0x6')][_0x5915e0[_0x3af1('0x42')]]['address']=_0x5915e0['address'];logger['debug'](_0x3af1('0x46'),util['inspect'](this[_0x3af1('0x6')][_0x5915e0[_0x3af1('0x42')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x3af1('0x2a')]('trunk:%s',this[_0x3af1('0x6')][_0x5915e0['peer']][_0x3af1('0x2c')]),_0x3af1('0x2d'),this[_0x3af1('0x6')][_0x5915e0[_0x3af1('0x42')]]);}}}catch(_0x4ff8af){logger[_0x3af1('0x13')](_0x3af1('0x41'),util[_0x3af1('0x15')](_0x4ff8af,{'showHidden':![],'depth':null}));}};module[_0x3af1('0x47')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 3bed701..8c24037 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae3f=['custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','variables','agentcalled','syncAgentCalled','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','agents','interface','format','called','type','inbound','voice','merge','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','error','hasOwnProperty','membername','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','pick','queue','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:%s','agentringnoanswerAt','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acwtime','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values'];(function(_0x378783,_0x417662){var _0x26d109=function(_0x436e0a){while(--_0x436e0a){_0x378783['push'](_0x378783['shift']());}};_0x26d109(++_0x417662);}(_0xae3f,0xac));var _0xfae3=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xae3f[_0x2db12b];return _0x20990b;};'use strict';var _=require(_0xfae3('0x0'));var moment=require(_0xfae3('0x1'));var util=require(_0xfae3('0x2'));var Redis=require('ioredis');var config=require(_0xfae3('0x3'));var logger=require(_0xfae3('0x4'))(_0xfae3('0x5'));var ami=require(_0xfae3('0x6'));config[_0xfae3('0x7')]=_[_0xfae3('0x8')](config[_0xfae3('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xfae3('0x9'))(new Redis(config[_0xfae3('0x7')]));function VoiceAgentReport(_0x280582){this['channels']={};this['voiceChannels']=_0x280582[_0xfae3('0xa')];this[_0xfae3('0xb')]=_0x280582[_0xfae3('0xb')];this['agents']=_0x280582['agents'];this[_0xfae3('0xc')]={};ami['on'](_0xfae3('0xd'),this[_0xfae3('0xe')]['bind'](this));ami['on']('agentconnect',this[_0xfae3('0xf')][_0xfae3('0x10')](this));ami['on'](_0xfae3('0x11'),this[_0xfae3('0x12')][_0xfae3('0x10')](this));ami['on'](_0xfae3('0x13'),this[_0xfae3('0x14')][_0xfae3('0x10')](this));ami['on'](_0xfae3('0x15'),this['syncAgentComplete'][_0xfae3('0x10')](this));ami['on'](_0xfae3('0x16'),this[_0xfae3('0x17')]['bind'](this));ami['on']('hangup',this[_0xfae3('0x18')]['bind'](this));ami['on'](_0xfae3('0x19'),this[_0xfae3('0x1a')]['bind'](this));ami['on'](_0xfae3('0x1b'),this[_0xfae3('0x1c')][_0xfae3('0x10')](this));ami['on'](_0xfae3('0x1d'),this[_0xfae3('0x1e')][_0xfae3('0x10')](this));ami['on'](_0xfae3('0x1f'),this[_0xfae3('0x20')][_0xfae3('0x10')](this));}VoiceAgentReport[_0xfae3('0x21')][_0xfae3('0x22')]=function(_0x326c9e,_0x4bc9b2,_0x593ff0){io['to'](_0x326c9e)[_0xfae3('0x22')](_0x4bc9b2,_0x593ff0);};VoiceAgentReport['prototype'][_0xfae3('0x23')]=function(_0x12cae3){return _0x12cae3!==null&&!_[_0xfae3('0x24')](_0x12cae3);};VoiceAgentReport['prototype'][_0xfae3('0xe')]=function(_0x513017){try{if(this[_0xfae3('0x23')](_0x513017)){logger[_0xfae3('0x25')](_0xfae3('0x26'),_0x513017[_0xfae3('0x27')],_0x513017['membername'],_0x513017[_0xfae3('0x28')]);logger[_0xfae3('0x29')](_0xfae3('0x2a'),_0x513017[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x513017,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xfae3('0xa')][_0x513017[_0xfae3('0x27')]])){this['channels'][_0x513017[_0xfae3('0x27')]]={};}var _0x47d1cd=this[_0xfae3('0x2c')][_0x513017[_0xfae3('0x2d')]];var _0x292e72=this['channels'][_0x513017['uniqueid']][_0x513017['destuniqueid']];var _0x199b64=this[_0xfae3('0xb')][_0x513017['queue']];var _0xd389ff=this[_0xfae3('0xc')][_0x513017[_0xfae3('0x27')]];if(_[_0xfae3('0x24')](_0x292e72)){_0x292e72={'agentcalledAt':moment()[_0xfae3('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xfae3('0x2f'),'mandatoryDisposition':_0x199b64&&_0x199b64['mandatoryDisposition']?_0x199b64['mandatoryDisposition']:![],'type':_0x199b64&&_0x199b64[_0xfae3('0x30')]?_0x199b64['type']:_0xfae3('0x31'),'variables':_0xd389ff,'motionChannel':_0xfae3('0x32')};}_[_0xfae3('0x33')](_0x292e72,_['omit'](_0x513017,[_0xfae3('0x34'),_0xfae3('0x35')]));this[_0xfae3('0xa')][_0x513017[_0xfae3('0x27')]][_0x513017[_0xfae3('0x28')]]=_0x292e72;logger[_0xfae3('0x29')](_0xfae3('0x36'),_0x513017[_0xfae3('0x27')],util['inspect'](_0x292e72,{'showHidden':![],'depth':null}));ami[_0xfae3('0x22')](_0xfae3('0x37'),_0x292e72);var _0x557b31={'id':_0x47d1cd['id'],'calleridnum':_0x292e72[_0xfae3('0x38')],'queue':_0x292e72['queue'],'variables':_0x292e72[_0xfae3('0xc')],'uniqueid':_0x513017[_0xfae3('0x27')]};logger[_0xfae3('0x29')](_0xfae3('0x39'),_0x513017[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x557b31,{'showHidden':![],'depth':null}));this[_0xfae3('0x22')](util[_0xfae3('0x2e')]('user:%s',_0x513017['membername']),_0xfae3('0x3a'),_0x557b31);}}catch(_0x51afb9){logger[_0xfae3('0x3b')]('[%s][voiceAgentReport][agentcalled]',_0x513017[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x51afb9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfae3('0x21')][_0xfae3('0xf')]=function(_0x225455){try{if(this[_0xfae3('0x23')](_0x225455)){if(this[_0xfae3('0xa')][_0x225455['uniqueid']]){for(var _0x473bdb in this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]]){if(this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0xfae3('0x3c')](_0x473bdb)){if(_0x225455['destuniqueid']===_0x473bdb){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x225455[_0xfae3('0x27')],_0x225455[_0xfae3('0x3d')],_0x225455[_0xfae3('0x28')]);this[_0xfae3('0xa')][_0x225455['uniqueid']][_0x473bdb][_0xfae3('0x3e')]=moment()['format'](_0xfae3('0x3f'));this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x40')]=_0x225455[_0xfae3('0x40')];this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x41')]=_0x225455['connectedlinenum'];this['channels'][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x42')]=_0x225455[_0xfae3('0x42')];this['channels'][_0x225455['uniqueid']][_0x473bdb][_0xfae3('0x43')]=_0x225455[_0xfae3('0x43')];this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x44')]=_0x225455[_0xfae3('0x44')];this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x45')]='connect';if(this[_0xfae3('0x46')][this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x27')]]){var _0x23f620=this[_0xfae3('0x46')][this['channels'][_0x225455['uniqueid']][_0x473bdb][_0xfae3('0x27')]]['routealias'];this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x47')]=_0x23f620;_0x225455[_0xfae3('0x47')]=_0x23f620;}_[_0xfae3('0x33')](this[_0xfae3('0x2c')][_0x225455['interface']],_[_0xfae3('0x48')](_0x225455,[_0xfae3('0x49'),_0xfae3('0x4a'),_0xfae3('0x47')]));var _0x5aaee6=this['agents'][_0x225455[_0xfae3('0x2d')]];var _0x181302={'id':_0x5aaee6['id'],'name':_0x5aaee6[_0xfae3('0x4b')],'agentconnected':!![],'destaccountcode':_0x5aaee6[_0xfae3('0x4c')],'destconnectedlinenum':this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x225455[_0xfae3('0x28')]][_0xfae3('0x4d')],'queue':this['channels'][_0x225455['uniqueid']][_0x225455[_0xfae3('0x28')]][_0xfae3('0x49')],'routealias':this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x225455[_0xfae3('0x28')]][_0xfae3('0x47')],'uniqueid':this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x225455[_0xfae3('0x28')]][_0xfae3('0x27')]};ami['emit'](_0xfae3('0x4e'),this['channels'][_0x225455['uniqueid']][_0x225455[_0xfae3('0x28')]]);this['emit'](util['format'](_0xfae3('0x4f'),_0x225455[_0xfae3('0x3d')]),'user:agentconnect',_0x181302);}else if(!this['channels'][_0x225455['uniqueid']][_0x473bdb][_0xfae3('0x11')]&&!this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x15')]){logger[_0xfae3('0x25')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x225455['uniqueid'],this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x3d')],_0x473bdb);this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x11')]=!![];this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x50')]=moment()['format'](_0xfae3('0x3f'));this['channels'][_0x225455['uniqueid']][_0x473bdb]['answeredelsewheredestinationuniqueid']=_0x225455[_0xfae3('0x28')];this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb][_0xfae3('0x51')]=_0x225455[_0xfae3('0x3d')];this[_0xfae3('0xa')][_0x225455[_0xfae3('0x27')]][_0x473bdb]['lastevent']='answered_elsewhere';this['channels'][_0x225455['uniqueid']][_0x473bdb][_0xfae3('0x52')]=_0xfae3('0x53');logger[_0xfae3('0x29')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x225455[_0xfae3('0x27')],util['inspect'](this['channels'][_0x225455[_0xfae3('0x27')]][_0x473bdb],{'showHidden':![],'depth':null}));ami['emit']('custom:agentansweredelsewhere',this[_0xfae3('0xa')][_0x225455['uniqueid']][_0x473bdb]);}else{logger['debug'](_0xfae3('0x54'),_0x225455[_0xfae3('0x27')]);}}}}}}catch(_0x198827){logger[_0xfae3('0x3b')]('[%s][voiceAgentReport][agentconnect]',_0x225455[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x198827,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfae3('0x21')][_0xfae3('0x12')]=function(_0xc7df40){try{if(this[_0xfae3('0x23')](_0xc7df40)){logger[_0xfae3('0x29')](_0xfae3('0x55'),_0xc7df40[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0xc7df40,{'showHidden':![],'depth':null}));if(this[_0xfae3('0xa')][_0xc7df40[_0xfae3('0x27')]]&&this[_0xfae3('0xa')][_0xc7df40[_0xfae3('0x27')]][_0xc7df40[_0xfae3('0x28')]]){logger[_0xfae3('0x25')](_0xfae3('0x56'),_0xc7df40[_0xfae3('0x27')],_0xc7df40[_0xfae3('0x3d')],_0xc7df40['destuniqueid']);var _0x48f693=this[_0xfae3('0x2c')][_0xc7df40[_0xfae3('0x2d')]];var _0x5eb994=this[_0xfae3('0xa')][_0xc7df40['uniqueid']][_0xc7df40[_0xfae3('0x28')]];_0x5eb994[_0xfae3('0x11')]=!![];_0x5eb994['agentringnoanswerAt']=moment()[_0xfae3('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x5eb994[_0xfae3('0x45')]='rejected';_0x5eb994[_0xfae3('0x52')]=_0xfae3('0x57');var _0x157c72={'id':_0x48f693['id'],'name':_0x48f693[_0xfae3('0x4b')],'queue':_0x5eb994[_0xfae3('0x49')],'uniqueid':_0x5eb994[_0xfae3('0x27')]};logger[_0xfae3('0x29')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xc7df40['uniqueid'],util[_0xfae3('0x2b')](_0x157c72,{'showHidden':![],'depth':null}));this[_0xfae3('0x22')](util[_0xfae3('0x2e')](_0xfae3('0x4f'),_0x48f693[_0xfae3('0x4b')]),_0xfae3('0x58'),_0x157c72);ami[_0xfae3('0x22')](_0xfae3('0x59'),_0x5eb994);}}}catch(_0x50cc73){logger[_0xfae3('0x3b')]('[%s][voiceAgentReport][agentringnoanswer]',_0xc7df40[_0xfae3('0x27')],util['inspect'](_0x50cc73,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfae3('0x14')]=function(_0x4cc1ec){try{if(this[_0xfae3('0x23')](_0x4cc1ec)){logger[_0xfae3('0x29')](_0xfae3('0x5a'),_0x4cc1ec['uniqueid'],util[_0xfae3('0x2b')](_0x4cc1ec,{'showHidden':![],'depth':null}));if(this[_0xfae3('0xa')][_0x4cc1ec['uniqueid']]){for(var _0x1561db in this[_0xfae3('0xa')][_0x4cc1ec[_0xfae3('0x27')]]){if(this[_0xfae3('0xa')][_0x4cc1ec[_0xfae3('0x27')]]['hasOwnProperty'](_0x1561db)&&!this[_0xfae3('0xa')][_0x4cc1ec['uniqueid']][_0x1561db]['agentringnoanswer']&&!this[_0xfae3('0xa')][_0x4cc1ec[_0xfae3('0x27')]][_0x1561db]['agentcomplete']){logger[_0xfae3('0x25')](_0xfae3('0x5b'),_0x4cc1ec[_0xfae3('0x27')],this[_0xfae3('0xa')][_0x4cc1ec[_0xfae3('0x27')]][_0x1561db]['membername'],_0x1561db);this['channels'][_0x4cc1ec[_0xfae3('0x27')]][_0x1561db]['agentringnoanswer']=!![];this[_0xfae3('0xa')][_0x4cc1ec[_0xfae3('0x27')]][_0x1561db][_0xfae3('0x50')]=moment()[_0xfae3('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfae3('0xa')][_0x4cc1ec[_0xfae3('0x27')]][_0x1561db][_0xfae3('0x45')]='abandoned';this[_0xfae3('0xa')][_0x4cc1ec['uniqueid']][_0x1561db][_0xfae3('0x52')]=_0xfae3('0x5c');logger[_0xfae3('0x29')](_0xfae3('0x5d'),_0x4cc1ec[_0xfae3('0x27')],util[_0xfae3('0x2b')](this[_0xfae3('0xa')][_0x4cc1ec['uniqueid']][_0x1561db],{'showHidden':![],'depth':null}));ami[_0xfae3('0x22')]('custom:agentqueuecallerabandon',this[_0xfae3('0xa')][_0x4cc1ec[_0xfae3('0x27')]][_0x1561db]);}}}}}catch(_0x121cd6){logger[_0xfae3('0x3b')]('[%s][voiceAgentReport][queuecallerabandon]',_0x4cc1ec['uniqueid'],util[_0xfae3('0x2b')](_0x121cd6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x3d3285){try{if(this['isNotNull'](_0x3d3285)){logger[_0xfae3('0x29')](_0xfae3('0x5e'),_0x3d3285[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x3d3285,{'showHidden':![],'depth':null}));if(this[_0xfae3('0xa')][_0x3d3285['uniqueid']]){for(var _0x360f46 in this[_0xfae3('0xa')][_0x3d3285[_0xfae3('0x27')]]){if(this[_0xfae3('0xa')][_0x3d3285[_0xfae3('0x27')]][_0xfae3('0x3c')](_0x360f46)){if(this['channels'][_0x3d3285['uniqueid']][_0x360f46][_0xfae3('0x3e')]&&!this['channels'][_0x3d3285[_0xfae3('0x27')]][_0x360f46][_0xfae3('0x15')]){logger[_0xfae3('0x25')](_0xfae3('0x5f'),_0x3d3285[_0xfae3('0x27')],this[_0xfae3('0xa')][_0x3d3285['uniqueid']][_0x360f46][_0xfae3('0x3d')],_0x360f46);this[_0xfae3('0xa')][_0x3d3285[_0xfae3('0x27')]][_0x360f46][_0xfae3('0x15')]=!![];this[_0xfae3('0xa')][_0x3d3285[_0xfae3('0x27')]][_0x360f46][_0xfae3('0x60')]=moment()[_0xfae3('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3d3285[_0xfae3('0x27')]][_0x360f46][_0xfae3('0x45')]=_0xfae3('0x61');this[_0xfae3('0xa')][_0x3d3285[_0xfae3('0x27')]][_0x360f46]['reason']=_0x3d3285['reason']==_0xfae3('0x62')?_0xfae3('0x63'):_0x3d3285[_0xfae3('0x52')];this[_0xfae3('0xa')][_0x3d3285[_0xfae3('0x27')]][_0x360f46]['talktime']=_0x3d3285[_0xfae3('0x64')];if(this[_0xfae3('0xb')][_0x3d3285[_0xfae3('0x49')]]&&this[_0xfae3('0xb')][_0x3d3285['queue']]['acw']){this[_0xfae3('0xa')][_0x3d3285['uniqueid']][_0x360f46][_0xfae3('0x65')]=this['voiceQueues'][_0x3d3285['queue']]['acwTimeout'];this['channels'][_0x3d3285[_0xfae3('0x27')]][_0x360f46]['agentacw']=!![];}this[_0xfae3('0x2c')][_0x3d3285[_0xfae3('0x2d')]]=_[_0xfae3('0x66')](this[_0xfae3('0x2c')][_0x3d3285[_0xfae3('0x2d')]],[_0xfae3('0x49'),_0xfae3('0x4a')]);logger[_0xfae3('0x29')](_0xfae3('0x67'),_0x3d3285['uniqueid'],util[_0xfae3('0x2b')](this[_0xfae3('0xa')][_0x3d3285[_0xfae3('0x27')]][_0x360f46],{'showHidden':![],'depth':null}));ami[_0xfae3('0x22')](_0xfae3('0x68'),this['channels'][_0x3d3285[_0xfae3('0x27')]][_0x360f46]);logger[_0xfae3('0x29')](_0xfae3('0x69'),_0x3d3285[_0xfae3('0x27')],util[_0xfae3('0x2b')]({'id':this[_0xfae3('0x2c')][_0x3d3285[_0xfae3('0x2d')]]['id'],'destaccountcode':_0x3d3285[_0xfae3('0x6a')]},{'showHidden':![],'depth':null}));this[_0xfae3('0x22')](util[_0xfae3('0x2e')](_0xfae3('0x4f'),_0x3d3285['membername']),_0xfae3('0x6b'),{'id':this[_0xfae3('0x2c')][_0x3d3285[_0xfae3('0x2d')]]['id'],'destaccountcode':Number(_0x3d3285[_0xfae3('0x6a')])});}}}}}}catch(_0x1b1278){logger[_0xfae3('0x3b')]('[%s][voiceAgentReport][agentcomplete]',_0x3d3285[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x1b1278,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfae3('0x17')]=function(_0x18a160){try{if(this[_0xfae3('0x23')](_0x18a160)){logger[_0xfae3('0x29')](_0xfae3('0x6c'),_0x18a160[_0xfae3('0x27')],util['inspect'](_0x18a160,{'showHidden':![],'depth':null}));this['addVariable'](_0x18a160['uniqueid'],_[_0xfae3('0x6d')](_0x18a160[_0xfae3('0x6e')])[0x0],_0x18a160[_0xfae3('0x6f')]);if(this[_0xfae3('0xa')][_0x18a160[_0xfae3('0x27')]]){for(var _0x49e670 in this['channels'][_0x18a160[_0xfae3('0x27')]]){if(this[_0xfae3('0xa')][_0x18a160[_0xfae3('0x27')]][_0xfae3('0x3c')](_0x49e670)){logger[_0xfae3('0x25')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x18a160[_0xfae3('0x27')],_0x49e670,_[_0xfae3('0x6d')](_0x18a160['variable'])[0x0],_0x18a160[_0xfae3('0x6f')]);if(_[_0xfae3('0x24')](this[_0xfae3('0xa')][_0x18a160[_0xfae3('0x27')]][_0x49e670]['variables'])){this['channels'][_0x18a160['uniqueid']][_0x49e670][_0xfae3('0xc')]={};}this[_0xfae3('0xa')][_0x18a160[_0xfae3('0x27')]][_0x49e670]['variables']=this[_0xfae3('0xc')][_0x18a160[_0xfae3('0x27')]];}}}}}catch(_0x39f2d0){logger['error']('[%s][voiceAgentReport][varset]',_0x18a160[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x39f2d0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfae3('0x21')]['addVariable']=function(_0x27acd5,_0x1f3601,_0x2f395a){var _0x281637=[_0xfae3('0x70'),_0xfae3('0x71'),'rtpaudioqosjitter',_0xfae3('0x72'),_0xfae3('0x73'),_0xfae3('0x74'),'rtpaudioqosrtt',_0xfae3('0x75'),_0xfae3('0x76'),_0xfae3('0x77'),_0xfae3('0x78'),'bridgepvtcallid',_0xfae3('0x79'),_0xfae3('0x7a'),_0xfae3('0x7b'),_0xfae3('0x7c'),_0xfae3('0x3d'),_0xfae3('0x7d'),_0xfae3('0x7e')];if(!_[_0xfae3('0x7f')](_0x1f3601)&&!_[_0xfae3('0x80')](_0x281637,_0x1f3601)){if(_['isUndefined'](this[_0xfae3('0xc')][_0x27acd5])){this[_0xfae3('0xc')][_0x27acd5]={};}this[_0xfae3('0xc')][_0x27acd5][_0x1f3601]=_0x2f395a;}};VoiceAgentReport[_0xfae3('0x21')][_0xfae3('0x18')]=function(_0x440985){try{if(this[_0xfae3('0x23')](_0x440985)){logger[_0xfae3('0x29')](_0xfae3('0x81'),_0x440985['uniqueid'],util[_0xfae3('0x2b')](_0x440985,{'showHidden':![],'depth':null}));if(this['channels'][_0x440985['uniqueid']]){for(var _0x404243 in this[_0xfae3('0xa')][_0x440985[_0xfae3('0x27')]]){if(this['channels'][_0x440985[_0xfae3('0x27')]][_0xfae3('0x3c')](_0x404243)){if(this[_0xfae3('0xa')][_0x440985[_0xfae3('0x27')]][_0x404243][_0xfae3('0x52')]=='transfer'&&this['channels'][_0x440985[_0xfae3('0x27')]][_0x404243][_0xfae3('0x15')]){logger[_0xfae3('0x25')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x440985[_0xfae3('0x27')],_0x404243);this[_0xfae3('0xa')][_0x440985[_0xfae3('0x27')]][_0x404243][_0xfae3('0x60')]=moment()['format'](_0xfae3('0x3f'));}}}logger[_0xfae3('0x29')](_0xfae3('0x82'),_0x440985['uniqueid'],util[_0xfae3('0x2b')](_[_0xfae3('0x83')](this[_0xfae3('0xa')][_0x440985['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xfae3('0x22')](_0xfae3('0x84'),_['values'](this[_0xfae3('0xa')][_0x440985[_0xfae3('0x27')]]));delete this[_0xfae3('0xa')][_0x440985[_0xfae3('0x27')]];}if(this[_0xfae3('0xc')][_0x440985['uniqueid']]){delete this[_0xfae3('0xc')][_0x440985[_0xfae3('0x27')]];}}}catch(_0x2c0107){logger[_0xfae3('0x3b')](_0xfae3('0x85'),_0x440985[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x2c0107,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfae3('0x1e')]=function(_0x146bf0){try{if(this[_0xfae3('0x23')](_0x146bf0)){logger[_0xfae3('0x29')](_0xfae3('0x86'),_0x146bf0[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x146bf0,{'showHidden':![],'depth':null}));if(this[_0xfae3('0xa')][_0x146bf0[_0xfae3('0x87')]]){for(var _0x10718a in this[_0xfae3('0xa')][_0x146bf0['transfereeuniqueid']]){if(this['channels'][_0x146bf0[_0xfae3('0x87')]][_0xfae3('0x3c')](_0x10718a)){if(_0x146bf0[_0xfae3('0x88')]===_0x10718a){logger[_0xfae3('0x25')](_0xfae3('0x89'),_0x146bf0[_0xfae3('0x27')],this[_0xfae3('0xa')][_0x146bf0['transfereeuniqueid']][_0x10718a][_0xfae3('0x3d')],_0x10718a);var _0x8f0344=moment();this[_0xfae3('0xa')][_0x146bf0[_0xfae3('0x87')]][_0x10718a][_0xfae3('0x15')]=!![];this[_0xfae3('0xa')][_0x146bf0['transfereeuniqueid']][_0x10718a][_0xfae3('0x60')]=moment()['format'](_0xfae3('0x3f'));this[_0xfae3('0xa')][_0x146bf0[_0xfae3('0x87')]][_0x10718a][_0xfae3('0x45')]=_0xfae3('0x61');this[_0xfae3('0xa')][_0x146bf0['transfereeuniqueid']][_0x10718a][_0xfae3('0x52')]=_0xfae3('0x62');this[_0xfae3('0xa')][_0x146bf0['transfereeuniqueid']][_0x10718a][_0xfae3('0x64')]=_0x8f0344[_0xfae3('0x8a')](this[_0xfae3('0xa')][_0x146bf0['transfereeuniqueid']][_0x10718a]['agentconnectAt'],_0xfae3('0x8b'));}}}}if(this[_0xfae3('0xa')][_0x146bf0[_0xfae3('0x8c')]]){var _0x4901b8=this[_0xfae3('0xa')][_0x146bf0['secondtransfereruniqueid']];this[_0xfae3('0xa')][_0x146bf0[_0xfae3('0x8c')]]=this[_0xfae3('0xa')][_0x146bf0[_0xfae3('0x87')]];this[_0xfae3('0xa')][_0x146bf0[_0xfae3('0x87')]]=_0x4901b8;}}}catch(_0x25eb79){logger[_0xfae3('0x3b')]('[%s][voiceAgentReport][attendedtransfer]',_0x146bf0[_0xfae3('0x27')],util['inspect'](_0x25eb79,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfae3('0x21')][_0xfae3('0x20')]=function(_0xa9046f){try{if(this[_0xfae3('0x23')](_0xa9046f)){logger[_0xfae3('0x29')](_0xfae3('0x8d'),_0xa9046f[_0xfae3('0x27')],util['inspect'](_0xa9046f,{'showHidden':![],'depth':null}));if(this[_0xfae3('0xa')][_0xa9046f['transfereeuniqueid']]){for(var _0x2d0b3c in this[_0xfae3('0xa')][_0xa9046f[_0xfae3('0x87')]]){if(this[_0xfae3('0xa')][_0xa9046f[_0xfae3('0x87')]][_0xfae3('0x3c')](_0x2d0b3c)){if(_0xa9046f[_0xfae3('0x8e')]===_0x2d0b3c){logger[_0xfae3('0x25')](_0xfae3('0x8f'),_0xa9046f[_0xfae3('0x27')],this['channels'][_0xa9046f['transfereeuniqueid']][_0x2d0b3c][_0xfae3('0x3d')],_0x2d0b3c);var _0x22227b=moment();this[_0xfae3('0xa')][_0xa9046f[_0xfae3('0x87')]][_0x2d0b3c][_0xfae3('0x15')]=!![];this['channels'][_0xa9046f['transfereeuniqueid']][_0x2d0b3c][_0xfae3('0x60')]=_0x22227b;this['channels'][_0xa9046f[_0xfae3('0x87')]][_0x2d0b3c]['lastevent']=_0xfae3('0x61');this[_0xfae3('0xa')][_0xa9046f[_0xfae3('0x87')]][_0x2d0b3c][_0xfae3('0x52')]=_0xfae3('0x62');this['channels'][_0xa9046f[_0xfae3('0x87')]][_0x2d0b3c][_0xfae3('0x64')]=_0x22227b['diff'](this[_0xfae3('0xa')][_0xa9046f[_0xfae3('0x87')]][_0x2d0b3c][_0xfae3('0x3e')],_0xfae3('0x8b'));}}}}}}catch(_0x3d5245){logger[_0xfae3('0x3b')]('[%s][voiceAgentReport][blindtransfer]',_0xa9046f[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x3d5245,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfae3('0x1a')]=function(_0x48a6a1){var _0x139540='';try{if(this['isNotNull'](_0x48a6a1)){logger[_0xfae3('0x29')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x48a6a1[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x48a6a1,{'showHidden':![],'depth':null}));if(_0x48a6a1[_0xfae3('0x90')]){_0x139540=_0x48a6a1[_0xfae3('0x90')][_0xfae3('0x91')](0x0,_0x48a6a1[_0xfae3('0x90')][_0xfae3('0x92')]('-'));if(this[_0xfae3('0x2c')][_0x139540]){logger[_0xfae3('0x25')](_0xfae3('0x93'),_0x48a6a1[_0xfae3('0x27')],_0x139540);this[_0xfae3('0x2c')][_0x139540]['onhold']=!![];}}}}catch(_0x550141){logger[_0xfae3('0x3b')]('[%s][voiceAgentReport][musiconholdstart]',_0x48a6a1[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x550141,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfae3('0x21')][_0xfae3('0x1c')]=function(_0x4da5be){var _0x3229ca='';try{if(this[_0xfae3('0x23')](_0x4da5be)){logger[_0xfae3('0x29')](_0xfae3('0x94'),_0x4da5be[_0xfae3('0x27')],util[_0xfae3('0x2b')](_0x4da5be,{'showHidden':![],'depth':null}));if(_0x4da5be[_0xfae3('0x90')]){_0x3229ca=_0x4da5be[_0xfae3('0x90')]['substring'](0x0,_0x4da5be[_0xfae3('0x90')][_0xfae3('0x92')]('-'));if(this[_0xfae3('0x2c')][_0x3229ca]){logger[_0xfae3('0x25')](_0xfae3('0x95'),_0x4da5be[_0xfae3('0x27')],_0x3229ca);this['agents'][_0x3229ca][_0xfae3('0x96')]=![];}}}}catch(_0x1950fb){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x4da5be['uniqueid'],util[_0xfae3('0x2b')](_0x1950fb,{'showHidden':![],'depth':null}));}};module[_0xfae3('0x97')]=VoiceAgentReport; \ No newline at end of file +var _0xc1d8=['[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../ami','redis','defaults','localhost','socket.io-emitter','voiceChannels','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','queue','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','voice','merge','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','connect','routealias','destconnectedlinenum','interface','name','accountcode','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwTimeout','agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc1d8,0x14b));var _0x8c1d=function(_0x141087,_0x507083){_0x141087=_0x141087-0x0;var _0x3617c4=_0xc1d8[_0x141087];return _0x3617c4;};'use strict';var _=require(_0x8c1d('0x0'));var moment=require(_0x8c1d('0x1'));var util=require(_0x8c1d('0x2'));var Redis=require(_0x8c1d('0x3'));var config=require(_0x8c1d('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0x8c1d('0x5'));config[_0x8c1d('0x6')]=_[_0x8c1d('0x7')](config[_0x8c1d('0x6')],{'host':_0x8c1d('0x8'),'port':0x18eb});var io=require(_0x8c1d('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x52cb4c){this['channels']={};this[_0x8c1d('0xa')]=_0x52cb4c[_0x8c1d('0xb')];this[_0x8c1d('0xc')]=_0x52cb4c[_0x8c1d('0xc')];this[_0x8c1d('0xd')]=_0x52cb4c[_0x8c1d('0xd')];this[_0x8c1d('0xe')]={};ami['on'](_0x8c1d('0xf'),this[_0x8c1d('0x10')][_0x8c1d('0x11')](this));ami['on'](_0x8c1d('0x12'),this[_0x8c1d('0x13')][_0x8c1d('0x11')](this));ami['on'](_0x8c1d('0x14'),this[_0x8c1d('0x15')][_0x8c1d('0x11')](this));ami['on']('queuecallerabandon',this[_0x8c1d('0x16')][_0x8c1d('0x11')](this));ami['on'](_0x8c1d('0x17'),this[_0x8c1d('0x18')][_0x8c1d('0x11')](this));ami['on'](_0x8c1d('0x19'),this[_0x8c1d('0x1a')]['bind'](this));ami['on'](_0x8c1d('0x1b'),this[_0x8c1d('0x1c')][_0x8c1d('0x11')](this));ami['on']('musiconholdstart',this[_0x8c1d('0x1d')][_0x8c1d('0x11')](this));ami['on'](_0x8c1d('0x1e'),this['syncMusicOnHoldStop'][_0x8c1d('0x11')](this));ami['on'](_0x8c1d('0x1f'),this['syncAttendedTransfer'][_0x8c1d('0x11')](this));ami['on']('blindtransfer',this[_0x8c1d('0x20')][_0x8c1d('0x11')](this));}VoiceAgentReport['prototype'][_0x8c1d('0x21')]=function(_0x38f8bf,_0x7cf2b3,_0x1405f4){io['to'](_0x38f8bf)[_0x8c1d('0x21')](_0x7cf2b3,_0x1405f4);};VoiceAgentReport[_0x8c1d('0x22')][_0x8c1d('0x23')]=function(_0x403eee){return _0x403eee!==null&&!_[_0x8c1d('0x24')](_0x403eee);};VoiceAgentReport[_0x8c1d('0x22')][_0x8c1d('0x10')]=function(_0x2c1024){try{if(this['isNotNull'](_0x2c1024)){logger[_0x8c1d('0x25')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2c1024[_0x8c1d('0x26')],_0x2c1024[_0x8c1d('0x27')],_0x2c1024[_0x8c1d('0x28')]);logger['debug'](_0x8c1d('0x29'),_0x2c1024[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_0x2c1024,{'showHidden':![],'depth':null}));if(_[_0x8c1d('0x24')](this[_0x8c1d('0xb')][_0x2c1024['uniqueid']])){this[_0x8c1d('0xb')][_0x2c1024[_0x8c1d('0x26')]]={};}var _0x480990=this[_0x8c1d('0xd')][_0x2c1024['interface']];var _0x32ae93=this[_0x8c1d('0xb')][_0x2c1024[_0x8c1d('0x26')]][_0x2c1024['destuniqueid']];var _0x1f2777=this[_0x8c1d('0xc')][_0x2c1024[_0x8c1d('0x2b')]];var _0x5d4feb=this['variables'][_0x2c1024[_0x8c1d('0x26')]];if(_['isUndefined'](_0x32ae93)){_0x32ae93={'agentcalledAt':moment()['format'](_0x8c1d('0x2c')),'lastevent':'called','mandatoryDisposition':_0x1f2777&&_0x1f2777[_0x8c1d('0x2d')]?_0x1f2777['mandatoryDisposition']:![],'type':_0x1f2777&&_0x1f2777[_0x8c1d('0x2e')]?_0x1f2777['type']:_0x8c1d('0x2f'),'variables':_0x5d4feb,'motionChannel':_0x8c1d('0x30')};}_[_0x8c1d('0x31')](_0x32ae93,_['omit'](_0x2c1024,[_0x8c1d('0x32'),_0x8c1d('0x33')]));this[_0x8c1d('0xb')][_0x2c1024['uniqueid']][_0x2c1024[_0x8c1d('0x28')]]=_0x32ae93;logger[_0x8c1d('0x34')](_0x8c1d('0x35'),_0x2c1024[_0x8c1d('0x26')],util['inspect'](_0x32ae93,{'showHidden':![],'depth':null}));ami[_0x8c1d('0x21')](_0x8c1d('0x36'),_0x32ae93);var _0x5cd2ec={'id':_0x480990['id'],'calleridnum':_0x32ae93[_0x8c1d('0x37')],'queue':_0x32ae93[_0x8c1d('0x2b')],'variables':_0x32ae93[_0x8c1d('0xe')],'uniqueid':_0x2c1024[_0x8c1d('0x26')]};logger[_0x8c1d('0x34')](_0x8c1d('0x38'),_0x2c1024[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_0x5cd2ec,{'showHidden':![],'depth':null}));this[_0x8c1d('0x21')](util[_0x8c1d('0x39')](_0x8c1d('0x3a'),_0x2c1024[_0x8c1d('0x27')]),'user:called',_0x5cd2ec);}}catch(_0x76df81){logger[_0x8c1d('0x3b')](_0x8c1d('0x3c'),_0x2c1024['uniqueid'],util[_0x8c1d('0x2a')](_0x76df81,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c1d('0x22')][_0x8c1d('0x13')]=function(_0x5304d1){try{if(this[_0x8c1d('0x23')](_0x5304d1)){if(this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]]){for(var _0x102852 in this['channels'][_0x5304d1[_0x8c1d('0x26')]]){if(this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x8c1d('0x3d')](_0x102852)){if(_0x5304d1[_0x8c1d('0x28')]===_0x102852){logger[_0x8c1d('0x25')](_0x8c1d('0x3e'),_0x5304d1[_0x8c1d('0x26')],_0x5304d1['membername'],_0x5304d1[_0x8c1d('0x28')]);this['channels'][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x3f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852]['connectedlinename']=_0x5304d1[_0x8c1d('0x40')];this['channels'][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x41')]=_0x5304d1[_0x8c1d('0x41')];this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x42')]=_0x5304d1['destchannelstate'];this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852]['destchannelstatedesc']=_0x5304d1[_0x8c1d('0x43')];this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852]['holdtime']=_0x5304d1['holdtime'];this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852]['lastevent']=_0x8c1d('0x44');if(this['voiceChannels'][this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x26')]]){var _0x37554c=this['voiceChannels'][this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x26')]][_0x8c1d('0x45')];this[_0x8c1d('0xb')][_0x5304d1['uniqueid']][_0x102852][_0x8c1d('0x45')]=_0x37554c;_0x5304d1['routealias']=_0x37554c;}_[_0x8c1d('0x31')](this['agents'][_0x5304d1['interface']],_['pick'](_0x5304d1,['queue',_0x8c1d('0x46'),_0x8c1d('0x45')]));var _0x388f2e=this['agents'][_0x5304d1[_0x8c1d('0x47')]];var _0x291f4c={'id':_0x388f2e['id'],'name':_0x388f2e[_0x8c1d('0x48')],'agentconnected':!![],'destaccountcode':_0x388f2e[_0x8c1d('0x49')],'destconnectedlinenum':this['channels'][_0x5304d1['uniqueid']][_0x5304d1['destuniqueid']]['exten'],'queue':this['channels'][_0x5304d1['uniqueid']][_0x5304d1[_0x8c1d('0x28')]][_0x8c1d('0x2b')],'routealias':this['channels'][_0x5304d1['uniqueid']][_0x5304d1[_0x8c1d('0x28')]][_0x8c1d('0x45')],'uniqueid':this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x5304d1['destuniqueid']][_0x8c1d('0x26')]};ami[_0x8c1d('0x21')]('custom:agentconnect',this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x5304d1[_0x8c1d('0x28')]]);this[_0x8c1d('0x21')](util[_0x8c1d('0x39')]('user:%s',_0x5304d1[_0x8c1d('0x27')]),'user:agentconnect',_0x291f4c);}else if(!this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x14')]&&!this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852]['agentcomplete']){logger[_0x8c1d('0x25')](_0x8c1d('0x4a'),_0x5304d1[_0x8c1d('0x26')],this['channels'][_0x5304d1['uniqueid']][_0x102852][_0x8c1d('0x27')],_0x102852);this[_0x8c1d('0xb')][_0x5304d1['uniqueid']][_0x102852][_0x8c1d('0x14')]=!![];this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x4b')]=moment()[_0x8c1d('0x39')](_0x8c1d('0x2c'));this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x4c')]=_0x5304d1[_0x8c1d('0x28')];this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x4d')]=_0x5304d1[_0x8c1d('0x27')];this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x4e')]=_0x8c1d('0x4f');this['channels'][_0x5304d1[_0x8c1d('0x26')]][_0x102852][_0x8c1d('0x50')]=_0x8c1d('0x4f');logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x5304d1[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](this[_0x8c1d('0xb')][_0x5304d1[_0x8c1d('0x26')]][_0x102852],{'showHidden':![],'depth':null}));ami[_0x8c1d('0x21')](_0x8c1d('0x51'),this['channels'][_0x5304d1[_0x8c1d('0x26')]][_0x102852]);}else{logger[_0x8c1d('0x34')](_0x8c1d('0x52'),_0x5304d1[_0x8c1d('0x26')]);}}}}}}catch(_0x881e20){logger['error'](_0x8c1d('0x53'),_0x5304d1[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_0x881e20,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c1d('0x22')][_0x8c1d('0x15')]=function(_0x59bf82){try{if(this['isNotNull'](_0x59bf82)){logger['debug'](_0x8c1d('0x54'),_0x59bf82[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_0x59bf82,{'showHidden':![],'depth':null}));if(this['channels'][_0x59bf82['uniqueid']]&&this[_0x8c1d('0xb')][_0x59bf82[_0x8c1d('0x26')]][_0x59bf82[_0x8c1d('0x28')]]){logger['info'](_0x8c1d('0x55'),_0x59bf82[_0x8c1d('0x26')],_0x59bf82[_0x8c1d('0x27')],_0x59bf82[_0x8c1d('0x28')]);var _0x33026a=this[_0x8c1d('0xd')][_0x59bf82[_0x8c1d('0x47')]];var _0xf080c6=this['channels'][_0x59bf82[_0x8c1d('0x26')]][_0x59bf82['destuniqueid']];_0xf080c6[_0x8c1d('0x14')]=!![];_0xf080c6['agentringnoanswerAt']=moment()[_0x8c1d('0x39')](_0x8c1d('0x2c'));_0xf080c6[_0x8c1d('0x4e')]=_0x8c1d('0x56');_0xf080c6['reason']=_0x8c1d('0x56');var _0x38167d={'id':_0x33026a['id'],'name':_0x33026a[_0x8c1d('0x48')],'queue':_0xf080c6[_0x8c1d('0x2b')],'uniqueid':_0xf080c6[_0x8c1d('0x26')]};logger[_0x8c1d('0x34')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x59bf82['uniqueid'],util[_0x8c1d('0x2a')](_0x38167d,{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x33026a['name']),'user:agentringnoanswer',_0x38167d);ami[_0x8c1d('0x21')](_0x8c1d('0x57'),_0xf080c6);}}}catch(_0x17aa5c){logger[_0x8c1d('0x3b')](_0x8c1d('0x58'),_0x59bf82['uniqueid'],util[_0x8c1d('0x2a')](_0x17aa5c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c1d('0x22')][_0x8c1d('0x16')]=function(_0x3a6a65){try{if(this[_0x8c1d('0x23')](_0x3a6a65)){logger[_0x8c1d('0x34')](_0x8c1d('0x59'),_0x3a6a65[_0x8c1d('0x26')],util['inspect'](_0x3a6a65,{'showHidden':![],'depth':null}));if(this[_0x8c1d('0xb')][_0x3a6a65[_0x8c1d('0x26')]]){for(var _0x20457f in this[_0x8c1d('0xb')][_0x3a6a65[_0x8c1d('0x26')]]){if(this[_0x8c1d('0xb')][_0x3a6a65[_0x8c1d('0x26')]][_0x8c1d('0x3d')](_0x20457f)&&!this[_0x8c1d('0xb')][_0x3a6a65[_0x8c1d('0x26')]][_0x20457f][_0x8c1d('0x14')]&&!this[_0x8c1d('0xb')][_0x3a6a65[_0x8c1d('0x26')]][_0x20457f][_0x8c1d('0x17')]){logger['info'](_0x8c1d('0x5a'),_0x3a6a65[_0x8c1d('0x26')],this[_0x8c1d('0xb')][_0x3a6a65[_0x8c1d('0x26')]][_0x20457f][_0x8c1d('0x27')],_0x20457f);this[_0x8c1d('0xb')][_0x3a6a65[_0x8c1d('0x26')]][_0x20457f][_0x8c1d('0x14')]=!![];this[_0x8c1d('0xb')][_0x3a6a65['uniqueid']][_0x20457f][_0x8c1d('0x4b')]=moment()[_0x8c1d('0x39')](_0x8c1d('0x2c'));this[_0x8c1d('0xb')][_0x3a6a65[_0x8c1d('0x26')]][_0x20457f]['lastevent']=_0x8c1d('0x5b');this[_0x8c1d('0xb')][_0x3a6a65[_0x8c1d('0x26')]][_0x20457f][_0x8c1d('0x50')]=_0x8c1d('0x5b');logger[_0x8c1d('0x34')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x3a6a65[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](this[_0x8c1d('0xb')][_0x3a6a65['uniqueid']][_0x20457f],{'showHidden':![],'depth':null}));ami[_0x8c1d('0x21')](_0x8c1d('0x5c'),this[_0x8c1d('0xb')][_0x3a6a65[_0x8c1d('0x26')]][_0x20457f]);}}}}}catch(_0x423dc2){logger[_0x8c1d('0x3b')](_0x8c1d('0x5d'),_0x3a6a65[_0x8c1d('0x26')],util['inspect'](_0x423dc2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8c1d('0x18')]=function(_0x85ce54){try{if(this[_0x8c1d('0x23')](_0x85ce54)){logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x85ce54[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_0x85ce54,{'showHidden':![],'depth':null}));if(this[_0x8c1d('0xb')][_0x85ce54['uniqueid']]){for(var _0x369d8e in this[_0x8c1d('0xb')][_0x85ce54['uniqueid']]){if(this[_0x8c1d('0xb')][_0x85ce54[_0x8c1d('0x26')]][_0x8c1d('0x3d')](_0x369d8e)){if(this[_0x8c1d('0xb')][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e][_0x8c1d('0x3f')]&&!this['channels'][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e]['agentcomplete']){logger[_0x8c1d('0x25')](_0x8c1d('0x5e'),_0x85ce54[_0x8c1d('0x26')],this[_0x8c1d('0xb')][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e]['membername'],_0x369d8e);this[_0x8c1d('0xb')][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e][_0x8c1d('0x17')]=!![];this[_0x8c1d('0xb')][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e][_0x8c1d('0x5f')]=moment()['format'](_0x8c1d('0x2c'));this['channels'][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e][_0x8c1d('0x4e')]=_0x8c1d('0x60');this[_0x8c1d('0xb')][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e][_0x8c1d('0x50')]=_0x85ce54[_0x8c1d('0x50')]==_0x8c1d('0x61')?_0x8c1d('0x62'):_0x85ce54[_0x8c1d('0x50')];this[_0x8c1d('0xb')][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e][_0x8c1d('0x63')]=_0x85ce54[_0x8c1d('0x63')];if(this[_0x8c1d('0xc')][_0x85ce54[_0x8c1d('0x2b')]]&&this['voiceQueues'][_0x85ce54[_0x8c1d('0x2b')]][_0x8c1d('0x64')]){this[_0x8c1d('0xb')][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e]['acwtime']=this[_0x8c1d('0xc')][_0x85ce54[_0x8c1d('0x2b')]][_0x8c1d('0x65')];this[_0x8c1d('0xb')][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e][_0x8c1d('0x66')]=!![];}this[_0x8c1d('0xd')][_0x85ce54['interface']]=_[_0x8c1d('0x67')](this['agents'][_0x85ce54['interface']],[_0x8c1d('0x2b'),_0x8c1d('0x46')]);logger[_0x8c1d('0x34')](_0x8c1d('0x68'),_0x85ce54[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](this['channels'][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e],{'showHidden':![],'depth':null}));ami[_0x8c1d('0x21')](_0x8c1d('0x69'),this['channels'][_0x85ce54[_0x8c1d('0x26')]][_0x369d8e]);logger[_0x8c1d('0x34')](_0x8c1d('0x6a'),_0x85ce54['uniqueid'],util[_0x8c1d('0x2a')]({'id':this[_0x8c1d('0xd')][_0x85ce54[_0x8c1d('0x47')]]['id'],'destaccountcode':_0x85ce54[_0x8c1d('0x6b')]},{'showHidden':![],'depth':null}));this[_0x8c1d('0x21')](util[_0x8c1d('0x39')](_0x8c1d('0x3a'),_0x85ce54[_0x8c1d('0x27')]),_0x8c1d('0x6c'),{'id':this[_0x8c1d('0xd')][_0x85ce54[_0x8c1d('0x47')]]['id'],'destaccountcode':Number(_0x85ce54['destaccountcode'])});}}}}}}catch(_0x244507){logger[_0x8c1d('0x3b')](_0x8c1d('0x6d'),_0x85ce54[_0x8c1d('0x26')],util['inspect'](_0x244507,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c1d('0x22')]['syncVarSet']=function(_0x33fc0b){try{if(this[_0x8c1d('0x23')](_0x33fc0b)){logger[_0x8c1d('0x34')](_0x8c1d('0x6e'),_0x33fc0b[_0x8c1d('0x26')],util['inspect'](_0x33fc0b,{'showHidden':![],'depth':null}));this['addVariable'](_0x33fc0b[_0x8c1d('0x26')],_[_0x8c1d('0x6f')](_0x33fc0b[_0x8c1d('0x70')])[0x0],_0x33fc0b[_0x8c1d('0x71')]);if(this[_0x8c1d('0xb')][_0x33fc0b[_0x8c1d('0x26')]]){for(var _0x25bbc8 in this[_0x8c1d('0xb')][_0x33fc0b[_0x8c1d('0x26')]]){if(this[_0x8c1d('0xb')][_0x33fc0b['uniqueid']][_0x8c1d('0x3d')](_0x25bbc8)){logger[_0x8c1d('0x25')](_0x8c1d('0x72'),_0x33fc0b[_0x8c1d('0x26')],_0x25bbc8,_[_0x8c1d('0x6f')](_0x33fc0b[_0x8c1d('0x70')])[0x0],_0x33fc0b[_0x8c1d('0x71')]);if(_[_0x8c1d('0x24')](this[_0x8c1d('0xb')][_0x33fc0b[_0x8c1d('0x26')]][_0x25bbc8][_0x8c1d('0xe')])){this[_0x8c1d('0xb')][_0x33fc0b[_0x8c1d('0x26')]][_0x25bbc8][_0x8c1d('0xe')]={};}this[_0x8c1d('0xb')][_0x33fc0b['uniqueid']][_0x25bbc8][_0x8c1d('0xe')]=this['variables'][_0x33fc0b[_0x8c1d('0x26')]];}}}}}catch(_0x28a6d9){logger[_0x8c1d('0x3b')]('[%s][voiceAgentReport][varset]',_0x33fc0b[_0x8c1d('0x26')],util['inspect'](_0x28a6d9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8c1d('0x73')]=function(_0x12bfdf,_0x43261a,_0x482102){var _0x3fb3ac=[_0x8c1d('0x74'),_0x8c1d('0x75'),_0x8c1d('0x76'),_0x8c1d('0x77'),_0x8c1d('0x78'),_0x8c1d('0x79'),_0x8c1d('0x7a'),_0x8c1d('0x7b'),_0x8c1d('0x7c'),'sipuri',_0x8c1d('0x7d'),_0x8c1d('0x7e'),'membercalls','memberdynamic',_0x8c1d('0x7f'),'memberlastcall','membername',_0x8c1d('0x80'),_0x8c1d('0x81')];if(!_[_0x8c1d('0x82')](_0x43261a)&&!_[_0x8c1d('0x83')](_0x3fb3ac,_0x43261a)){if(_[_0x8c1d('0x24')](this[_0x8c1d('0xe')][_0x12bfdf])){this[_0x8c1d('0xe')][_0x12bfdf]={};}this['variables'][_0x12bfdf][_0x43261a]=_0x482102;}};VoiceAgentReport[_0x8c1d('0x22')][_0x8c1d('0x1c')]=function(_0x2b8d3d){try{if(this[_0x8c1d('0x23')](_0x2b8d3d)){logger[_0x8c1d('0x34')]('[%s][voiceAgentReport][hangup]\x20event:',_0x2b8d3d['uniqueid'],util[_0x8c1d('0x2a')](_0x2b8d3d,{'showHidden':![],'depth':null}));if(this['channels'][_0x2b8d3d[_0x8c1d('0x26')]]){for(var _0x92df8e in this[_0x8c1d('0xb')][_0x2b8d3d[_0x8c1d('0x26')]]){if(this[_0x8c1d('0xb')][_0x2b8d3d[_0x8c1d('0x26')]][_0x8c1d('0x3d')](_0x92df8e)){if(this[_0x8c1d('0xb')][_0x2b8d3d[_0x8c1d('0x26')]][_0x92df8e][_0x8c1d('0x50')]==_0x8c1d('0x61')&&this[_0x8c1d('0xb')][_0x2b8d3d[_0x8c1d('0x26')]][_0x92df8e][_0x8c1d('0x17')]){logger[_0x8c1d('0x25')](_0x8c1d('0x84'),_0x2b8d3d['uniqueid'],_0x92df8e);this['channels'][_0x2b8d3d['uniqueid']][_0x92df8e][_0x8c1d('0x5f')]=moment()['format'](_0x8c1d('0x2c'));}}}logger[_0x8c1d('0x34')](_0x8c1d('0x85'),_0x2b8d3d[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_[_0x8c1d('0x86')](this[_0x8c1d('0xb')][_0x2b8d3d['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x8c1d('0x21')]('custom:voiceAgentReport',_[_0x8c1d('0x86')](this[_0x8c1d('0xb')][_0x2b8d3d[_0x8c1d('0x26')]]));delete this[_0x8c1d('0xb')][_0x2b8d3d[_0x8c1d('0x26')]];}if(this[_0x8c1d('0xe')][_0x2b8d3d[_0x8c1d('0x26')]]){delete this['variables'][_0x2b8d3d[_0x8c1d('0x26')]];}}}catch(_0x5434c5){logger[_0x8c1d('0x3b')](_0x8c1d('0x87'),_0x2b8d3d[_0x8c1d('0x26')],util['inspect'](_0x5434c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8c1d('0x88')]=function(_0x235d08){try{if(this[_0x8c1d('0x23')](_0x235d08)){logger[_0x8c1d('0x34')](_0x8c1d('0x89'),_0x235d08['uniqueid'],util[_0x8c1d('0x2a')](_0x235d08,{'showHidden':![],'depth':null}));if(this[_0x8c1d('0xb')][_0x235d08[_0x8c1d('0x8a')]]){for(var _0x24a601 in this['channels'][_0x235d08[_0x8c1d('0x8a')]]){if(this['channels'][_0x235d08[_0x8c1d('0x8a')]][_0x8c1d('0x3d')](_0x24a601)){if(_0x235d08[_0x8c1d('0x8b')]===_0x24a601){logger[_0x8c1d('0x25')](_0x8c1d('0x8c'),_0x235d08[_0x8c1d('0x26')],this[_0x8c1d('0xb')][_0x235d08[_0x8c1d('0x8a')]][_0x24a601]['membername'],_0x24a601);var _0x14c97b=moment();this[_0x8c1d('0xb')][_0x235d08[_0x8c1d('0x8a')]][_0x24a601][_0x8c1d('0x17')]=!![];this[_0x8c1d('0xb')][_0x235d08['transfereeuniqueid']][_0x24a601][_0x8c1d('0x5f')]=moment()[_0x8c1d('0x39')](_0x8c1d('0x2c'));this['channels'][_0x235d08[_0x8c1d('0x8a')]][_0x24a601]['lastevent']=_0x8c1d('0x60');this[_0x8c1d('0xb')][_0x235d08['transfereeuniqueid']][_0x24a601]['reason']=_0x8c1d('0x61');this[_0x8c1d('0xb')][_0x235d08[_0x8c1d('0x8a')]][_0x24a601][_0x8c1d('0x63')]=_0x14c97b[_0x8c1d('0x8d')](this[_0x8c1d('0xb')][_0x235d08[_0x8c1d('0x8a')]][_0x24a601]['agentconnectAt'],_0x8c1d('0x8e'));}}}}if(this[_0x8c1d('0xb')][_0x235d08['secondtransfereruniqueid']]){var _0x51546e=this[_0x8c1d('0xb')][_0x235d08[_0x8c1d('0x8f')]];this['channels'][_0x235d08[_0x8c1d('0x8f')]]=this[_0x8c1d('0xb')][_0x235d08['transfereeuniqueid']];this[_0x8c1d('0xb')][_0x235d08[_0x8c1d('0x8a')]]=_0x51546e;}}}catch(_0x1c52f2){logger['error'](_0x8c1d('0x90'),_0x235d08[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_0x1c52f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c1d('0x22')][_0x8c1d('0x20')]=function(_0x5bbd1b){try{if(this[_0x8c1d('0x23')](_0x5bbd1b)){logger['debug'](_0x8c1d('0x91'),_0x5bbd1b[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_0x5bbd1b,{'showHidden':![],'depth':null}));if(this[_0x8c1d('0xb')][_0x5bbd1b[_0x8c1d('0x8a')]]){for(var _0x55deae in this[_0x8c1d('0xb')][_0x5bbd1b[_0x8c1d('0x8a')]]){if(this[_0x8c1d('0xb')][_0x5bbd1b['transfereeuniqueid']][_0x8c1d('0x3d')](_0x55deae)){if(_0x5bbd1b[_0x8c1d('0x92')]===_0x55deae){logger[_0x8c1d('0x25')](_0x8c1d('0x93'),_0x5bbd1b[_0x8c1d('0x26')],this[_0x8c1d('0xb')][_0x5bbd1b[_0x8c1d('0x8a')]][_0x55deae][_0x8c1d('0x27')],_0x55deae);var _0x4601d1=moment();this[_0x8c1d('0xb')][_0x5bbd1b[_0x8c1d('0x8a')]][_0x55deae]['agentcomplete']=!![];this['channels'][_0x5bbd1b[_0x8c1d('0x8a')]][_0x55deae][_0x8c1d('0x5f')]=_0x4601d1;this[_0x8c1d('0xb')][_0x5bbd1b[_0x8c1d('0x8a')]][_0x55deae]['lastevent']=_0x8c1d('0x60');this[_0x8c1d('0xb')][_0x5bbd1b[_0x8c1d('0x8a')]][_0x55deae][_0x8c1d('0x50')]=_0x8c1d('0x61');this['channels'][_0x5bbd1b['transfereeuniqueid']][_0x55deae]['talktime']=_0x4601d1[_0x8c1d('0x8d')](this[_0x8c1d('0xb')][_0x5bbd1b[_0x8c1d('0x8a')]][_0x55deae]['agentconnectAt'],_0x8c1d('0x8e'));}}}}}}catch(_0x2eda37){logger[_0x8c1d('0x3b')](_0x8c1d('0x94'),_0x5bbd1b['uniqueid'],util[_0x8c1d('0x2a')](_0x2eda37,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c1d('0x22')][_0x8c1d('0x1d')]=function(_0x8c7c16){var _0x52ca51='';try{if(this[_0x8c1d('0x23')](_0x8c7c16)){logger['debug'](_0x8c1d('0x95'),_0x8c7c16['uniqueid'],util[_0x8c1d('0x2a')](_0x8c7c16,{'showHidden':![],'depth':null}));if(_0x8c7c16[_0x8c1d('0x96')]){_0x52ca51=_0x8c7c16[_0x8c1d('0x96')][_0x8c1d('0x97')](0x0,_0x8c7c16['channel'][_0x8c1d('0x98')]('-'));if(this['agents'][_0x52ca51]){logger[_0x8c1d('0x25')](_0x8c1d('0x99'),_0x8c7c16[_0x8c1d('0x26')],_0x52ca51);this[_0x8c1d('0xd')][_0x52ca51][_0x8c1d('0x9a')]=!![];}}}}catch(_0x4694b4){logger[_0x8c1d('0x3b')](_0x8c1d('0x9b'),_0x8c7c16[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_0x4694b4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8c1d('0x22')][_0x8c1d('0x9c')]=function(_0x433282){var _0x14293c='';try{if(this[_0x8c1d('0x23')](_0x433282)){logger[_0x8c1d('0x34')](_0x8c1d('0x9d'),_0x433282[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_0x433282,{'showHidden':![],'depth':null}));if(_0x433282[_0x8c1d('0x96')]){_0x14293c=_0x433282[_0x8c1d('0x96')]['substring'](0x0,_0x433282[_0x8c1d('0x96')]['lastIndexOf']('-'));if(this[_0x8c1d('0xd')][_0x14293c]){logger['info']('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x433282[_0x8c1d('0x26')],_0x14293c);this[_0x8c1d('0xd')][_0x14293c][_0x8c1d('0x9a')]=![];}}}}catch(_0x2c9791){logger[_0x8c1d('0x3b')](_0x8c1d('0x9e'),_0x433282[_0x8c1d('0x26')],util[_0x8c1d('0x2a')](_0x2c9791,{'showHidden':![],'depth':null}));}};module[_0x8c1d('0x9f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 2ec9bb6..fd48b92 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb8=['[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','syncNewCallerId','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','keys','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','format','user:%s','user:agentconnect','connectedlinenum','[%s][voiceCallReport][newcallerid]','syncNewChannel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','disposition','channelstate','pick','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newchannel]','application','applicationdata','appdata','CDR(routeAlias)','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','lastapplication','lastdata','set','startsWith','cdr(','match','type','isNil','syncNewState','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','connectedlinename','calleridname','toNumber','UserId','membername','name','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','answertime','destinationchannel','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','../model/channel','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','newstate','varset','syncVarSet','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error'];(function(_0x271d2a,_0x1c4884){var _0x1a3891=function(_0xcd7f31){while(--_0xcd7f31){_0x271d2a['push'](_0x271d2a['shift']());}};_0x1a3891(++_0x1c4884);}(_0x0bb8,0x163));var _0x80bb=function(_0x439b98,_0x572c8a){_0x439b98=_0x439b98-0x0;var _0x3a0ff9=_0x0bb8[_0x439b98];return _0x3a0ff9;};'use strict';var _=require(_0x80bb('0x0'));var moment=require(_0x80bb('0x1'));var util=require(_0x80bb('0x2'));var path=require('path');var Redis=require(_0x80bb('0x3'));var config=require(_0x80bb('0x4'));var logger=require('../../../config/logger')(_0x80bb('0x5'));var ami=require(_0x80bb('0x6'));var Channel=require(_0x80bb('0x7'));var RpcSetting=require('../rpc/setting');var applications=['set',_0x80bb('0x8'),_0x80bb('0x9'),_0x80bb('0xa'),_0x80bb('0xb'),_0x80bb('0xc')];var dispositions=['NO\x20ANSWER',_0x80bb('0xd'),_0x80bb('0xd'),_0x80bb('0xe'),_0x80bb('0xe'),_0x80bb('0xe'),'ANSWERED',_0x80bb('0xf'),_0x80bb('0xd'),_0x80bb('0xd'),_0x80bb('0xd')];config[_0x80bb('0x10')]=_['defaults'](config[_0x80bb('0x10')],{'host':_0x80bb('0x11'),'port':0x18eb});var io=require(_0x80bb('0x12'))(new Redis(config['redis']));function VoiceCallReport(_0x1aebd3){this[_0x80bb('0x13')]=_0x1aebd3[_0x80bb('0x13')];this[_0x80bb('0x14')]=_0x1aebd3[_0x80bb('0x14')];this[_0x80bb('0x15')]={};ami['on']('coreshowchannel',this[_0x80bb('0x16')][_0x80bb('0x17')](this));ami['on'](_0x80bb('0x18'),this['syncNewExten']['bind'](this));ami['on'](_0x80bb('0x19'),this['syncNewChannel'][_0x80bb('0x17')](this));ami['on'](_0x80bb('0x1a'),this['syncNewState'][_0x80bb('0x17')](this));ami['on'](_0x80bb('0x1b'),this[_0x80bb('0x1c')][_0x80bb('0x17')](this));ami['on']('hangup',this[_0x80bb('0x1d')][_0x80bb('0x17')](this));ami['on'](_0x80bb('0x1e'),this['syncNewCallerId']['bind'](this));ami['on'](_0x80bb('0x1f'),this[_0x80bb('0x20')]['bind'](this));ami['on'](_0x80bb('0x21'),this[_0x80bb('0x22')][_0x80bb('0x17')](this));ami['on'](_0x80bb('0x23'),this['syncMusicOnHoldStart'][_0x80bb('0x17')](this));ami['on'](_0x80bb('0x24'),this[_0x80bb('0x25')][_0x80bb('0x17')](this));try{logger['info'](_0x80bb('0x26'));ami[_0x80bb('0x27')]();}catch(_0x828b60){logger[_0x80bb('0x28')](_0x80bb('0x29'),util[_0x80bb('0x2a')](_0x828b60,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x80bb('0x2b')][_0x80bb('0x2c')]=function(_0x2d4965){return _0x2d4965!==null&&!_[_0x80bb('0x2d')](_0x2d4965);};VoiceCallReport['prototype'][_0x80bb('0x2e')]=function(_0x1feaf8,_0x4afb29,_0x1f6028){io['to'](_0x1feaf8)['emit'](_0x4afb29,_0x1f6028);};VoiceCallReport[_0x80bb('0x2b')][_0x80bb('0x2f')]=function(_0x11fcf1){try{if(this['isNotNull'](_0x11fcf1)){logger[_0x80bb('0x30')](_0x80bb('0x31'),_0x11fcf1['uniqueid'],_0x11fcf1['calleridname'],_0x11fcf1[_0x80bb('0x32')]);logger[_0x80bb('0x33')](_0x80bb('0x34'),_0x11fcf1[_0x80bb('0x35')],util[_0x80bb('0x2a')](_0x11fcf1,{'showHidden':![],'depth':null}));if(_0x11fcf1[_0x80bb('0x35')]===_0x11fcf1[_0x80bb('0x36')]){if(!_[_0x80bb('0x2d')](this[_0x80bb('0x13')][_0x11fcf1[_0x80bb('0x35')]])){_[_0x80bb('0x37')](this[_0x80bb('0x13')][_0x11fcf1[_0x80bb('0x35')]],_['pick'](_0x11fcf1,_[_0x80bb('0x38')](this[_0x80bb('0x13')][_0x11fcf1[_0x80bb('0x35')]])));}}if(_0x11fcf1['context']===_0x80bb('0x39')){if(this[_0x80bb('0x14')][_0x11fcf1[_0x80bb('0x3a')][_0x80bb('0x3b')]('-')[0x0]]){if(_0x11fcf1[_0x80bb('0x3c')]==_0x80bb('0x3d')){this[_0x80bb('0x14')][_0x11fcf1[_0x80bb('0x3a')][_0x80bb('0x3b')]('-')[0x0]][_0x80bb('0x3e')]=_0x11fcf1['connectedlinenum'];this[_0x80bb('0x2e')](util[_0x80bb('0x3f')](_0x80bb('0x40'),this[_0x80bb('0x14')][_0x11fcf1['channel'][_0x80bb('0x3b')]('-')[0x0]]['name']),_0x80bb('0x41'),{'destaccountcode':this['agents'][_0x11fcf1[_0x80bb('0x3a')][_0x80bb('0x3b')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x11fcf1[_0x80bb('0x42')]});}}}}}catch(_0x5bfc2d){logger[_0x80bb('0x28')](_0x80bb('0x43'),_0x11fcf1[_0x80bb('0x35')],util['inspect'](_0x5bfc2d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x80bb('0x44')]=function(_0x4d2ac6){try{if(this[_0x80bb('0x2c')](_0x4d2ac6)){logger[_0x80bb('0x33')]('[%s][voiceCallReport][newchannel]\x20event:',_0x4d2ac6[_0x80bb('0x35')],util[_0x80bb('0x2a')](_0x4d2ac6,{'showHidden':![],'depth':null}));if(this[_0x80bb('0x13')][_0x4d2ac6['uniqueid']]){return;}if(_0x4d2ac6[_0x80bb('0x3a')]===_0x80bb('0x45')){return;}if(_0x4d2ac6['uniqueid']!==_0x4d2ac6[_0x80bb('0x36')]&&!this['blindTransfers'][_0x4d2ac6[_0x80bb('0x36')]]){return;}logger['info'](_0x80bb('0x46'),_0x4d2ac6[_0x80bb('0x35')],_0x4d2ac6[_0x80bb('0x47')],_0x4d2ac6[_0x80bb('0x3c')]);this[_0x80bb('0x13')][_0x4d2ac6[_0x80bb('0x35')]]=new Channel();this['channels'][_0x4d2ac6[_0x80bb('0x35')]][_0x80bb('0x48')]=moment()[_0x80bb('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x80bb('0x13')][_0x4d2ac6[_0x80bb('0x35')]][_0x80bb('0x49')]=dispositions[_['toNumber'](_0x4d2ac6[_0x80bb('0x4a')])];_['merge'](this['channels'][_0x4d2ac6[_0x80bb('0x35')]],_[_0x80bb('0x4b')](_0x4d2ac6,_[_0x80bb('0x38')](this[_0x80bb('0x13')][_0x4d2ac6[_0x80bb('0x35')]])));if(_0x4d2ac6[_0x80bb('0x47')]==='from-sip'){var _0x359921=this[_0x80bb('0x14')][_0x4d2ac6[_0x80bb('0x3a')][_0x80bb('0x3b')]('-')[0x0]];if(_0x359921&&typeof _0x359921[_0x80bb('0x3e')]===_0x80bb('0x4c')){_0x359921['destconnectedlinenum']=_0x4d2ac6[_0x80bb('0x3c')];logger['debug'](_0x80bb('0x4d'),_0x4d2ac6[_0x80bb('0x35')],util[_0x80bb('0x2a')]({'id':_0x359921['id'],'destaccountcode':_0x359921[_0x80bb('0x4e')],'destconnectedlinenum':_0x4d2ac6['exten']},{'showHidden':![],'depth':null}));this[_0x80bb('0x2e')](util['format'](_0x80bb('0x40'),_0x359921['name']),_0x80bb('0x41'),{'id':_0x359921['id'],'destaccountcode':_0x359921['accountcode'],'destconnectedlinenum':_0x4d2ac6['exten']});}}}}catch(_0x5f00ee){logger[_0x80bb('0x28')](_0x80bb('0x4f'),_0x4d2ac6[_0x80bb('0x35')],util[_0x80bb('0x2a')](_0x5f00ee,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x80bb('0x16')]=function(_0x1168b5){try{if(this[_0x80bb('0x2c')](_0x1168b5)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x1168b5[_0x80bb('0x35')],util[_0x80bb('0x2a')](_0x1168b5,{'showHidden':![],'depth':null}));if(_0x1168b5[_0x80bb('0x3a')]===_0x80bb('0x45')||_0x1168b5['exten']==='h')return;if(_0x1168b5[_0x80bb('0x35')]===_0x1168b5[_0x80bb('0x36')]||this[_0x80bb('0x15')][_0x1168b5[_0x80bb('0x36')]]){_0x1168b5['application']=_0x1168b5[_0x80bb('0x50')]?_0x1168b5[_0x80bb('0x50')]['toLowerCase']():undefined;_0x1168b5[_0x80bb('0x51')]=_0x1168b5[_0x80bb('0x52')]||_0x1168b5['applicationdata'];if(_0x1168b5[_0x80bb('0x52')]&&!_0x1168b5['appdata']['startsWith'](_0x80bb('0x53'))&&_0x1168b5[_0x80bb('0x50')]!==_0x80bb('0x8')){_0x1168b5[_0x80bb('0x51')]=_0x1168b5[_0x80bb('0x51')][_0x80bb('0x54')]();}logger[_0x80bb('0x30')](_0x80bb('0x55'),_0x1168b5[_0x80bb('0x35')],_0x1168b5['application'],_0x1168b5[_0x80bb('0x51')]);if(_[_0x80bb('0x2d')](this['channels'][_0x1168b5[_0x80bb('0x35')]])){this[_0x80bb('0x13')][_0x1168b5[_0x80bb('0x35')]]=new Channel();this['channels'][_0x1168b5['uniqueid']][_0x80bb('0x48')]=_0x1168b5[_0x80bb('0x56')]?moment()['subtract'](moment[_0x80bb('0x56')](_0x1168b5['duration'])[_0x80bb('0x57')](),_0x80bb('0x57'))[_0x80bb('0x3f')](_0x80bb('0x58')):moment()[_0x80bb('0x3f')](_0x80bb('0x58'));this[_0x80bb('0x13')][_0x1168b5['uniqueid']][_0x80bb('0x49')]=_0x80bb('0xe');}_[_0x80bb('0x37')](this[_0x80bb('0x13')][_0x1168b5[_0x80bb('0x35')]],_['pick'](_0x1168b5,_[_0x80bb('0x38')](this[_0x80bb('0x13')][_0x1168b5['uniqueid']])));if(_['includes'](applications,_0x1168b5[_0x80bb('0x50')])){this[_0x80bb('0x13')][_0x1168b5['uniqueid']][_0x80bb('0x59')]=_0x1168b5[_0x80bb('0x50')];this['channels'][_0x1168b5[_0x80bb('0x35')]][_0x80bb('0x5a')]=_0x1168b5[_0x80bb('0x51')];if(_0x1168b5[_0x80bb('0x50')]===_0x80bb('0x5b')&&_[_0x80bb('0x5c')](_0x1168b5[_0x80bb('0x51')][_0x80bb('0x54')](),_0x80bb('0x5d'))){var _0x39d923=_0x1168b5[_0x80bb('0x51')][_0x80bb('0x3b')]('=');var _0x3010b9=_0x39d923[0x0]['toLowerCase']()[_0x80bb('0x5e')](/cdr\((.*)\)/);if(_0x3010b9){if(_0x3010b9[0x1]===_0x80bb('0x5f')&&!_[_0x80bb('0x60')](this['channels'][_0x1168b5[_0x80bb('0x35')]][_0x3010b9[0x1]]))return;this[_0x80bb('0x13')][_0x1168b5[_0x80bb('0x35')]][_0x3010b9[0x1]]=_0x39d923[0x1];}}else if(_0x1168b5['application']===_0x80bb('0x8')){this[_0x80bb('0x13')][_0x1168b5[_0x80bb('0x35')]]['queue']=_0x1168b5['applicationdata'][_0x80bb('0x3b')](',')[0x0];}}}}}catch(_0x19576a){logger[_0x80bb('0x28')]('[%s][voiceCallReport][newexten]',_0x1168b5[_0x80bb('0x35')],util['inspect'](_0x19576a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80bb('0x2b')][_0x80bb('0x61')]=function(_0xe86f0e){try{if(this[_0x80bb('0x2c')](_0xe86f0e)){logger[_0x80bb('0x30')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0xe86f0e[_0x80bb('0x35')],_0xe86f0e['linkedid'],_0xe86f0e['calleridname'],_0xe86f0e[_0x80bb('0x32')]);logger[_0x80bb('0x33')](_0x80bb('0x62'),_0xe86f0e['uniqueid'],util[_0x80bb('0x2a')](_0xe86f0e,{'showHidden':![],'depth':null}));if(_0xe86f0e[_0x80bb('0x4a')]!=='6')return;var _0x347f6f=this[_0x80bb('0x14')][_0xe86f0e['channel']['split']('-')[0x0]];if(_0xe86f0e['uniqueid']!==_0xe86f0e[_0x80bb('0x36')]){var _0x28898e=moment();if(this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x36')]]){if(!this[_0x80bb('0x13')][_0xe86f0e['linkedid']][_0x80bb('0x63')]){this[_0x80bb('0x13')][_0xe86f0e['linkedid']][_0x80bb('0x63')]=!![];this['channels'][_0xe86f0e[_0x80bb('0x36')]]['answertime']=_0x28898e[_0x80bb('0x3f')](_0x80bb('0x58'));if(this[_0x80bb('0x13')][_0xe86f0e['linkedid']][_0x80bb('0x48')]){this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x36')]][_0x80bb('0x64')]=_0x28898e[_0x80bb('0x65')](this[_0x80bb('0x13')][_0xe86f0e['linkedid']]['starttime'],'seconds');}}this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x36')]][_0x80bb('0x36')]=_0xe86f0e[_0x80bb('0x35')];if(_0xe86f0e['calleridnum']!=='xcally-motion-preview'){this[_0x80bb('0x13')][_0xe86f0e['linkedid']][_0x80bb('0x42')]=_0xe86f0e[_0x80bb('0x32')];}this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x36')]][_0x80bb('0x66')]=_0xe86f0e[_0x80bb('0x67')];this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x36')]]['destinationchannel']=_0xe86f0e['channel'];this['channels'][_0xe86f0e[_0x80bb('0x36')]][_0x80bb('0x49')]=dispositions[_[_0x80bb('0x68')](_0xe86f0e[_0x80bb('0x4a')])];if(_0x347f6f){this['channels'][_0xe86f0e[_0x80bb('0x36')]][_0x80bb('0x69')]=_0x347f6f['id'];this[_0x80bb('0x13')][_0xe86f0e['linkedid']][_0x80bb('0x6a')]=_0x347f6f[_0x80bb('0x6b')];}}if(this['channels'][_0xe86f0e[_0x80bb('0x35')]]){if(!this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x35')]][_0x80bb('0x63')]){this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x35')]][_0x80bb('0x63')]=!![];this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x35')]]['answertime']=_0x28898e[_0x80bb('0x3f')](_0x80bb('0x58'));if(this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x35')]][_0x80bb('0x48')]){this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x35')]]['holdtime']=_0x28898e[_0x80bb('0x65')](this['channels'][_0xe86f0e[_0x80bb('0x35')]][_0x80bb('0x48')],'seconds');}}if(_0xe86f0e[_0x80bb('0x32')]!==_0x80bb('0x3d')){this['channels'][_0xe86f0e['uniqueid']]['connectedlinenum']=_0xe86f0e['calleridnum'];}this['channels'][_0xe86f0e[_0x80bb('0x35')]]['connectedlinename']=_0xe86f0e[_0x80bb('0x67')];this[_0x80bb('0x13')][_0xe86f0e['uniqueid']]['destinationchannel']=_0xe86f0e['channel'];this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x35')]][_0x80bb('0x49')]=dispositions[_['toNumber'](_0xe86f0e[_0x80bb('0x4a')])];}}else{if(this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x35')]]){if(_0x347f6f){this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x35')]]['UserId']=_0x347f6f['id'];this['channels'][_0xe86f0e[_0x80bb('0x35')]][_0x80bb('0x6a')]=_0x347f6f[_0x80bb('0x6b')];}}}if(_0xe86f0e[_0x80bb('0x47')]===_0x80bb('0x39')){if(_0x347f6f){_0x347f6f[_0x80bb('0x3e')]=_0xe86f0e[_0x80bb('0x3c')];var _0x55be26,_0x5e3c83;if(this[_0x80bb('0x13')][_0xe86f0e['uniqueid']]){_0x55be26=this[_0x80bb('0x13')][_0xe86f0e['uniqueid']][_0x80bb('0x6c')];_0x5e3c83=this['channels'][_0xe86f0e[_0x80bb('0x35')]][_0x80bb('0x8')];}else if(this[_0x80bb('0x13')][_0xe86f0e[_0x80bb('0x36')]]){_0x55be26=this[_0x80bb('0x13')][_0xe86f0e['linkedid']][_0x80bb('0x6c')];_0x5e3c83=this[_0x80bb('0x13')][_0xe86f0e['linkedid']][_0x80bb('0x8')];}_0x347f6f[_0x80bb('0x8')]=_0x5e3c83;_0x347f6f['routealias']=_0x55be26;var _0x45193c={'id':_0x347f6f['id'],'name':_0x347f6f[_0x80bb('0x6b')],'agentconnected':!![],'destaccountcode':_0x347f6f[_0x80bb('0x4e')],'destconnectedlinenum':_0xe86f0e['exten'],'queue':_0x5e3c83||undefined,'routealias':_0x55be26,'uniqueid':_0xe86f0e['linkedid']};logger[_0x80bb('0x33')](_0x80bb('0x6d'),_0xe86f0e[_0x80bb('0x35')],util['inspect'](_0x45193c,{'showHidden':![],'depth':null}));this[_0x80bb('0x2e')](util[_0x80bb('0x3f')](_0x80bb('0x40'),_0x347f6f[_0x80bb('0x6b')]),_0x80bb('0x41'),_0x45193c);}}}}catch(_0x47fbcd){logger[_0x80bb('0x28')](_0x80bb('0x6e'),_0xe86f0e[_0x80bb('0x35')],util['inspect'](_0x47fbcd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80bb('0x2b')][_0x80bb('0x6f')]=function(_0xac586a,_0x1dd06e){try{if(this[_0x80bb('0x13')][_0xac586a]){logger[_0x80bb('0x30')](_0x80bb('0x70'),_0xac586a,_0x1dd06e);this[_0x80bb('0x13')][_0xac586a][_0x80bb('0x71')]=!![];if(_[_0x80bb('0x72')](_0x1dd06e,_0x80bb('0x73'))){_0x1dd06e=_0x1dd06e[_0x80bb('0x74')]('.wav49',_0x80bb('0x75'));}this[_0x80bb('0x13')][_0xac586a][_0x80bb('0x76')]=_0x1dd06e;var _0x44f57f=_[_0x80bb('0x77')](this[_0x80bb('0x13')][_0xac586a][_0x80bb('0x78')],{'filename':_0x1dd06e});if(_[_0x80bb('0x60')](_0x44f57f)){this['channels'][_0xac586a][_0x80bb('0x78')][_0x80bb('0x79')]({'filename':_0x1dd06e,'createdAt':moment()[_0x80bb('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x80bb('0x7a')});}}}catch(_0xef90a5){logger[_0x80bb('0x28')]('[%s][voiceCallReport][mixMonitorFilename]',_0xac586a,util[_0x80bb('0x2a')](_0xef90a5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80bb('0x2b')][_0x80bb('0x1c')]=function(_0x55bb6d){try{if(this[_0x80bb('0x2c')](_0x55bb6d)){logger[_0x80bb('0x33')](_0x80bb('0x7b'),_0x55bb6d[_0x80bb('0x35')],util[_0x80bb('0x2a')](_0x55bb6d,{'showHidden':![],'depth':null}));if(this[_0x80bb('0x13')][_0x55bb6d['uniqueid']]&&_0x55bb6d['channel']!=_0x80bb('0x45')){if(this['isNotNull'](_0x55bb6d[_0x80bb('0x7c')])){if(this[_0x80bb('0x2c')](_0x55bb6d['variable'][_0x80bb('0x7d')])){logger[_0x80bb('0x30')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x55bb6d['uniqueid'],_0x55bb6d[_0x80bb('0x7e')]);this[_0x80bb('0x6f')](_0x55bb6d[_0x80bb('0x35')],_0x55bb6d['value']);}else if(this['isNotNull'](_0x55bb6d[_0x80bb('0x7c')][_0x80bb('0x7f')])){logger[_0x80bb('0x30')](_0x80bb('0x80'),_0x55bb6d[_0x80bb('0x35')],_0x55bb6d[_0x80bb('0x7e')]);this[_0x80bb('0x13')][_0x55bb6d['uniqueid']][_0x80bb('0x32')]=_0x55bb6d[_0x80bb('0x7e')];}else if(this['isNotNull'](_0x55bb6d[_0x80bb('0x7c')][_0x80bb('0x81')])){logger[_0x80bb('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x55bb6d[_0x80bb('0x35')],_0x55bb6d['value']);this[_0x80bb('0x13')][_0x55bb6d[_0x80bb('0x35')]][_0x80bb('0x82')]=_0x55bb6d[_0x80bb('0x7e')];}else if(this[_0x80bb('0x2c')](_0x55bb6d[_0x80bb('0x7c')][_0x80bb('0x83')])){logger[_0x80bb('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x55bb6d[_0x80bb('0x35')],_0x55bb6d['value']);this[_0x80bb('0x13')][_0x55bb6d[_0x80bb('0x35')]]['type']=_0x55bb6d[_0x80bb('0x7e')];}else if(this['isNotNull'](_0x55bb6d[_0x80bb('0x7c')][_0x80bb('0x84')])){logger[_0x80bb('0x30')](_0x80bb('0x85'),_0x55bb6d[_0x80bb('0x35')],_0x55bb6d['value'][_0x80bb('0x3b')](',')[0x0]);this[_0x80bb('0x13')][_0x55bb6d[_0x80bb('0x35')]]['queue']=_0x55bb6d[_0x80bb('0x7e')][_0x80bb('0x3b')](',')[0x0];}else if(this[_0x80bb('0x2c')](_0x55bb6d['variable'][_0x80bb('0x86')])){logger[_0x80bb('0x30')](_0x80bb('0x87'),_0x55bb6d[_0x80bb('0x35')],_0x55bb6d[_0x80bb('0x7e')]);this[_0x80bb('0x13')][_0x55bb6d[_0x80bb('0x35')]][_0x80bb('0x88')]=_0x55bb6d[_0x80bb('0x7e')];}else if(this['isNotNull'](_0x55bb6d[_0x80bb('0x7c')]['xmd-destination'])){logger[_0x80bb('0x30')](_0x80bb('0x89'),_0x55bb6d['uniqueid'],_0x55bb6d[_0x80bb('0x7e')]);this['channels'][_0x55bb6d['uniqueid']]['destination']=_0x55bb6d['value'];}else if(this['isNotNull'](_0x55bb6d[_0x80bb('0x7c')]['xmd-callerid-preview'])){logger[_0x80bb('0x30')](_0x80bb('0x8a'),_0x55bb6d[_0x80bb('0x35')],_0x55bb6d[_0x80bb('0x7e')]);this[_0x80bb('0x13')][_0x55bb6d[_0x80bb('0x35')]][_0x80bb('0x8b')]=_0x55bb6d['value'];}else if(this[_0x80bb('0x2c')](_0x55bb6d[_0x80bb('0x7c')][_0x80bb('0x8c')])){logger[_0x80bb('0x30')](_0x80bb('0x8d'),_0x55bb6d[_0x80bb('0x35')],_0x55bb6d[_0x80bb('0x7e')]);this['channels'][_0x55bb6d[_0x80bb('0x35')]][_0x80bb('0x8')]=_0x55bb6d[_0x80bb('0x7e')];}else if(this['isNotNull'](_0x55bb6d[_0x80bb('0x7c')][_0x80bb('0x8e')])){logger[_0x80bb('0x30')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x55bb6d[_0x80bb('0x35')],_0x55bb6d['value']);this[_0x80bb('0x13')][_0x55bb6d[_0x80bb('0x35')]]['sipcalluniqueid']=_0x55bb6d[_0x80bb('0x7e')];}}}else if(this[_0x80bb('0x2c')](_0x55bb6d[_0x80bb('0x7c')]['mixmonitor_filename'])){if(_0x55bb6d['value']){var _0x37e8ad=path[_0x80bb('0x8f')](_0x55bb6d['value'])[_0x80bb('0x6b')];logger['info'](_0x80bb('0x90'),_0x37e8ad,_0x55bb6d['value']);this[_0x80bb('0x6f')](_0x37e8ad,_0x55bb6d['value']);}}else if(this['channels'][_0x55bb6d['linkedid']]){if(this[_0x80bb('0x2c')](_0x55bb6d[_0x80bb('0x7c')])){if(this['isNotNull'](_0x55bb6d['variable']['sipcallid'])){logger['info'](_0x80bb('0x91'),_0x55bb6d[_0x80bb('0x36')],_0x55bb6d[_0x80bb('0x7e')]);this[_0x80bb('0x13')][_0x55bb6d[_0x80bb('0x36')]][_0x80bb('0x92')]=_0x55bb6d[_0x80bb('0x7e')];}}}}}catch(_0x1edf72){logger[_0x80bb('0x28')](_0x80bb('0x93'),_0x55bb6d[_0x80bb('0x35')],util[_0x80bb('0x2a')](_0x1edf72,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x80bb('0x2b')][_0x80bb('0x1d')]=function(_0x27b4e7){try{if(this[_0x80bb('0x2c')](_0x27b4e7)){logger[_0x80bb('0x33')](_0x80bb('0x94'),_0x27b4e7[_0x80bb('0x35')],util[_0x80bb('0x2a')](_0x27b4e7,{'showHidden':![],'depth':null}));if(this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]]){if(this['channels'][this['blindTransfers'][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x36')]]){this[_0x80bb('0x13')][this['blindTransfers'][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x36')]][_0x80bb('0x35')]=_0x27b4e7['uniqueid'];this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]]['linkedid']][_0x80bb('0x63')]=this[_0x80bb('0x13')][_0x27b4e7['uniqueid']]['answered'];this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x36')]]['answertime']=this['channels'][_0x27b4e7[_0x80bb('0x35')]][_0x80bb('0x95')];this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]]['linkedid']][_0x80bb('0x96')]=this[_0x80bb('0x13')][this['blindTransfers'][_0x27b4e7['linkedid']][_0x80bb('0x36')]]['channel'];this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x36')]][_0x80bb('0x49')]=this[_0x80bb('0x13')][_0x27b4e7['uniqueid']]['disposition'];this[_0x80bb('0x13')][_0x27b4e7[_0x80bb('0x35')]]=this['channels'][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x36')]];delete this[_0x80bb('0x13')][this['blindTransfers'][_0x27b4e7[_0x80bb('0x36')]]['linkedid']];}else if(this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x35')]]){this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x35')]][_0x80bb('0x35')]=[this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7['linkedid']]['uniqueid']][_0x80bb('0x36')],this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x35')]][_0x80bb('0x36')]=this['channels'][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x35')]][_0x80bb('0x35')]][0x0];this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x35')]]['answered']=this[_0x80bb('0x13')][_0x27b4e7[_0x80bb('0x35')]][_0x80bb('0x63')];this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x35')]][_0x80bb('0x95')]=this[_0x80bb('0x13')][_0x27b4e7[_0x80bb('0x35')]]['answertime'];this[_0x80bb('0x13')][this['blindTransfers'][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x35')]]['destinationchannel']=this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x35')]]['channel'];this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7['linkedid']][_0x80bb('0x35')]][_0x80bb('0x49')]=this[_0x80bb('0x13')][_0x27b4e7[_0x80bb('0x35')]]['disposition'];this['channels'][_0x27b4e7[_0x80bb('0x35')]]=this[_0x80bb('0x13')][this[_0x80bb('0x15')][_0x27b4e7['linkedid']]['uniqueid']];delete this['channels'][this[_0x80bb('0x15')][_0x27b4e7[_0x80bb('0x36')]][_0x80bb('0x35')]];}}if(this[_0x80bb('0x13')][_0x27b4e7[_0x80bb('0x35')]]){logger[_0x80bb('0x30')](_0x80bb('0x97'),_0x27b4e7[_0x80bb('0x35')],_0x27b4e7[_0x80bb('0x98')]);var _0x2ab94f=moment();this[_0x80bb('0x13')][_0x27b4e7[_0x80bb('0x35')]][_0x80bb('0x99')]=_0x2ab94f['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x27b4e7[_0x80bb('0x35')]][_0x80bb('0x56')]=_0x2ab94f[_0x80bb('0x65')](this[_0x80bb('0x13')][_0x27b4e7[_0x80bb('0x35')]][_0x80bb('0x48')],_0x80bb('0x57'));if(this[_0x80bb('0x13')][_0x27b4e7[_0x80bb('0x35')]][_0x80bb('0x63')]){this['channels'][_0x27b4e7['uniqueid']][_0x80bb('0x9a')]=_0x2ab94f[_0x80bb('0x65')](this['channels'][_0x27b4e7['uniqueid']][_0x80bb('0x95')],_0x80bb('0x57'));this[_0x80bb('0x13')][_0x27b4e7['uniqueid']][_0x80bb('0x64')]=this[_0x80bb('0x13')][_0x27b4e7[_0x80bb('0x35')]][_0x80bb('0x56')]-this['channels'][_0x27b4e7['uniqueid']]['billableseconds'];}if(_0x27b4e7['context']==='from-sip'){if(this[_0x80bb('0x14')][_0x27b4e7[_0x80bb('0x3a')][_0x80bb('0x3b')]('-')[0x0]]){this[_0x80bb('0x14')][_0x27b4e7[_0x80bb('0x3a')][_0x80bb('0x3b')]('-')[0x0]]=_[_0x80bb('0x9b')](this[_0x80bb('0x14')][_0x27b4e7['channel'][_0x80bb('0x3b')]('-')[0x0]],['destconnectedlinenum']);logger[_0x80bb('0x33')](_0x80bb('0x9c'),_0x27b4e7[_0x80bb('0x35')],util['inspect']({'id':this['agents'][_0x27b4e7[_0x80bb('0x3a')][_0x80bb('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x80bb('0x14')][_0x27b4e7[_0x80bb('0x3a')][_0x80bb('0x3b')]('-')[0x0]][_0x80bb('0x4e')]},{'showHidden':![],'depth':null}));this[_0x80bb('0x2e')](util[_0x80bb('0x3f')]('user:%s',this[_0x80bb('0x14')][_0x27b4e7[_0x80bb('0x3a')]['split']('-')[0x0]][_0x80bb('0x6b')]),_0x80bb('0x9d'),{'id':this[_0x80bb('0x14')][_0x27b4e7['channel'][_0x80bb('0x3b')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x27b4e7[_0x80bb('0x3a')]['split']('-')[0x0]][_0x80bb('0x4e')]});for(var _0x42c05b=0x0;_0x42c05b0x0?!![]:![];if(!_0x2458ac){return this[_0x7c1b('0x19')](this[_0x7c1b('0x15')][_0x7c1b('0x67')]);}};VoiceQueueReport[_0x7c1b('0x37')][_0x7c1b('0x68')]=function(_0x472626){var _0x10bb9a=this['summary']['id'];if(this[_0x7c1b('0x15')][_0x7c1b('0x64')][_0x10bb9a]&&this[_0x7c1b('0x15')][_0x7c1b('0x64')][_0x10bb9a][_0x472626[_0x7c1b('0x5e')]]){this[_0x7c1b('0x15')]['queuestatus'][_0x10bb9a][_0x472626[_0x7c1b('0x5e')]]['agents'][_0x7c1b('0x69')](_0x472626);}};VoiceQueueReport['prototype'][_0x7c1b('0x17')]=function(_0x479868){var _0x8ad53b=this;try{if(this[_0x7c1b('0x5a')](_0x479868)&&this[_0x7c1b('0x5a')](_0x479868[_0x7c1b('0x53')])){logger[_0x7c1b('0x47')](_0x7c1b('0x6a'),util['inspect'](_0x479868,{'showHidden':![],'depth':null}));var _0x1332cf=this[_0x7c1b('0x13')][_0x479868['queue']];if(_0x1332cf){logger[_0x7c1b('0x6b')](_0x7c1b('0x6c'),_0x1332cf[_0x7c1b('0x58')]);this[_0x7c1b('0x15')][_0x7c1b('0x60')][_0x1332cf['name']]={'summaryEvent':_0x479868};this[_0x7c1b('0x15')][_0x7c1b('0x66')]+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x1332cf['name']})[_0x7c1b('0x5d')](function(_0x5c2c53){if(!_0x8ad53b[_0x7c1b('0x15')][_0x7c1b('0x64')][_0x479868[_0x7c1b('0x5e')]]){_0x8ad53b['summary'][_0x7c1b('0x64')][_0x479868[_0x7c1b('0x5e')]]={};}_0x8ad53b[_0x7c1b('0x15')][_0x7c1b('0x64')][_0x479868[_0x7c1b('0x5e')]][_0x5c2c53[_0x7c1b('0x5e')]]={'queue':_0x1332cf['name'],'agents':[]};})['catch'](function(_0x1b5326){throw _0x1b5326;});}}}catch(_0x5b8a6f){logger[_0x7c1b('0x3f')](_0x7c1b('0x6d'),util[_0x7c1b('0x49')](_0x5b8a6f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c1b('0x37')][_0x7c1b('0x19')]=function(_0x15a860){if(this[_0x7c1b('0x15')][_0x7c1b('0x66')]>0x0){this[_0x7c1b('0x15')][_0x7c1b('0x67')]=_0x15a860;return;}logger[_0x7c1b('0x47')](_0x7c1b('0x6e'),util[_0x7c1b('0x49')](_0x15a860,{'showHidden':![],'depth':null}));this[_0x7c1b('0x15')]=initializeSummary();ami[_0x7c1b('0x45')](_0x7c1b('0x6f'),{});};VoiceQueueReport[_0x7c1b('0x37')][_0x7c1b('0x1e')]=function(_0x493aa3){try{if(this[_0x7c1b('0x5a')](_0x493aa3)){logger[_0x7c1b('0x47')](_0x7c1b('0x70'),_0x493aa3['uniqueid'],util[_0x7c1b('0x49')](_0x493aa3,{'showHidden':![],'depth':null}));if(_[_0x7c1b('0x5b')](this[_0x7c1b('0xe')][_0x493aa3['uniqueid']])){this[_0x7c1b('0xe')][_0x493aa3[_0x7c1b('0x4f')]]=[];}if(_['isUndefined'](this[_0x7c1b('0x11')][_0x493aa3[_0x7c1b('0x4f')]])){this[_0x7c1b('0x11')][_0x493aa3[_0x7c1b('0x4f')]]={};}var _0x4694bc=new QueueReport();_0x4694bc[_0x7c1b('0x53')]=_0x493aa3[_0x7c1b('0x53')];_0x4694bc[_0x7c1b('0x71')]=this[_0x7c1b('0x13')][_0x4694bc[_0x7c1b('0x53')]]&&this[_0x7c1b('0x13')][_0x4694bc['queue']][_0x7c1b('0x71')]?this['voiceQueues'][_0x4694bc[_0x7c1b('0x53')]][_0x7c1b('0x71')]||_0x7c1b('0x56'):_0x7c1b('0x56');_0x4694bc['queuecallerjoinAt']=moment()[_0x7c1b('0x52')](_0x7c1b('0x72'));_0x4694bc[_0x7c1b('0x73')]=_0x493aa3[_0x7c1b('0x73')];_0x4694bc['count']=_0x493aa3['count'];_0x4694bc[_0x7c1b('0x4f')]=_0x493aa3[_0x7c1b('0x4f')];_0x4694bc[_0x7c1b('0x74')]=this['channels'][_0x493aa3[_0x7c1b('0x4f')]][_0x7c1b('0x74')];logger['info'](_0x7c1b('0x75'),_0x4694bc['queue'],_0x4694bc[_0x7c1b('0x71')]);_[_0x7c1b('0x76')](_0x4694bc,_[_0x7c1b('0x77')](_0x493aa3,_[_0x7c1b('0x78')](_0x4694bc)));this[_0x7c1b('0xe')][_0x493aa3['uniqueid']][_0x7c1b('0x69')](_0x4694bc);this[_0x7c1b('0x11')][_0x493aa3[_0x7c1b('0x4f')]]=_0x4694bc;this[_0x7c1b('0x46')](_0x4694bc,_0x7c1b('0x79'));}}catch(_0x5c4e64){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x493aa3[_0x7c1b('0x4f')],util[_0x7c1b('0x49')](_0x5c4e64,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c1b('0x37')][_0x7c1b('0x1f')]=function(_0x29915e){try{if(this[_0x7c1b('0x5a')](_0x29915e)){logger['debug'](_0x7c1b('0x7a'),_0x29915e['uniqueid'],util[_0x7c1b('0x49')](_0x29915e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x29915e[_0x7c1b('0x4f')]]){var _0x226a2f=_[_0x7c1b('0x7b')](this[_0x7c1b('0xe')][_0x29915e[_0x7c1b('0x4f')]]);_0x226a2f[_0x7c1b('0x7c')]=![];_0x226a2f[_0x7c1b('0x7d')]=null;_0x226a2f[_0x7c1b('0x7e')]=_0x29915e['holdtime'];_0x226a2f[_0x7c1b('0x7f')]=_0x29915e['originalposition'];_0x226a2f[_0x7c1b('0x80')]=!![];_0x226a2f[_0x7c1b('0x81')]=moment()[_0x7c1b('0x52')](_0x7c1b('0x72'));_0x226a2f[_0x7c1b('0x50')]=_0x7c1b('0x82');_0x226a2f['lastAssignedTo']=null;logger[_0x7c1b('0x6b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x226a2f['queue'],_0x226a2f['type']);this[_0x7c1b('0x11')][_0x29915e[_0x7c1b('0x4f')]]=_0x226a2f;this[_0x7c1b('0x43')](_0x226a2f,'queuecallerabandon');}}}catch(_0x194ecd){logger[_0x7c1b('0x3f')](_0x7c1b('0x7a'),_0x29915e[_0x7c1b('0x4f')],util['inspect'](_0x194ecd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c1b('0x37')][_0x7c1b('0x21')]=function(_0x1e1e9a){try{if(this['isNotNull'](_0x1e1e9a)){logger[_0x7c1b('0x47')](_0x7c1b('0x83'),_0x1e1e9a[_0x7c1b('0x4f')],util[_0x7c1b('0x49')](_0x1e1e9a,{'showHidden':![],'depth':null}));if(this[_0x7c1b('0xe')][_0x1e1e9a[_0x7c1b('0x4f')]]){var _0x183d1e=_['last'](this['queueReports'][_0x1e1e9a[_0x7c1b('0x4f')]]);_0x183d1e[_0x7c1b('0x84')]=moment()[_0x7c1b('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x183d1e['connectedlinenum']=_0x1e1e9a['connectedlinenum'];_0x183d1e['connectedlinename']=_0x1e1e9a[_0x7c1b('0x85')];logger[_0x7c1b('0x6b')](_0x7c1b('0x86'),_0x183d1e[_0x7c1b('0x53')],_0x183d1e[_0x7c1b('0x71')],_0x1e1e9a[_0x7c1b('0x87')],_0x1e1e9a[_0x7c1b('0x85')]);this[_0x7c1b('0x11')][_0x1e1e9a[_0x7c1b('0x4f')]]=_0x183d1e;this[_0x7c1b('0x46')](_0x183d1e,_0x7c1b('0x20'));}}}catch(_0x49f2a3){logger[_0x7c1b('0x3f')]('[%s][voiceQueueReport][queuecallerleave]',_0x1e1e9a[_0x7c1b('0x4f')],util[_0x7c1b('0x49')](_0x49f2a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c1b('0x37')][_0x7c1b('0x25')]=function(_0x400139){try{if(this[_0x7c1b('0x5a')](_0x400139)){logger[_0x7c1b('0x47')](_0x7c1b('0x88'),_0x400139[_0x7c1b('0x4f')],util[_0x7c1b('0x49')](_0x400139,{'showHidden':![],'depth':null}));if(this[_0x7c1b('0xe')][_0x400139['uniqueid']]){var _0x3bf00d=_[_0x7c1b('0x7b')](this[_0x7c1b('0xe')][_0x400139[_0x7c1b('0x4f')]]);_0x3bf00d[_0x7c1b('0x7c')]=!![];_0x3bf00d[_0x7c1b('0x50')]=_0x7c1b('0x89');logger[_0x7c1b('0x6b')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3bf00d[_0x7c1b('0x53')],_0x3bf00d[_0x7c1b('0x71')]);}}}catch(_0x109eab){logger['error'](_0x7c1b('0x88'),_0x400139[_0x7c1b('0x4f')],util['inspect'](_0x109eab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c1b('0x37')]['syncAgentComplete']=function(_0x342121){try{if(this[_0x7c1b('0x5a')](_0x342121)){logger[_0x7c1b('0x47')](_0x7c1b('0x8a'),_0x342121[_0x7c1b('0x4f')],util[_0x7c1b('0x49')](_0x342121,{'showHidden':![],'depth':null}));if(this[_0x7c1b('0xe')][_0x342121[_0x7c1b('0x4f')]]){var _0x3cee73=_[_0x7c1b('0x7b')](this[_0x7c1b('0xe')][_0x342121[_0x7c1b('0x4f')]]);_0x3cee73['queuecallerabandon']=![];_0x3cee73[_0x7c1b('0x81')]=null;_0x3cee73[_0x7c1b('0x8b')]=!![];_0x3cee73[_0x7c1b('0x8c')]=_0x342121[_0x7c1b('0x8d')];_0x3cee73[_0x7c1b('0x7e')]=_0x342121[_0x7c1b('0x7e')];_0x3cee73[_0x7c1b('0x7c')]=!![];_0x3cee73['queuecallerexit']=![];_0x3cee73[_0x7c1b('0x8e')]=null;if(!_0x3cee73[_0x7c1b('0x8f')]){if(_0x342121['reason']==_0x7c1b('0x8f')){_0x3cee73['queuecallerexitreason']=_0x7c1b('0x90');logger[_0x7c1b('0x6b')](_0x7c1b('0x91'),_0x3cee73[_0x7c1b('0x53')],_0x3cee73['type']);}else{if(_[_0x7c1b('0x92')](_0x342121[_0x7c1b('0x3c')][_0x7c1b('0x93')](),_0x7c1b('0x94'))){if(this['queueReports'][_0x342121[_0x7c1b('0x95')]]){var _0x7f1ae0=_[_0x7c1b('0x7b')](this[_0x7c1b('0xe')][_0x342121[_0x7c1b('0x95')]]);_0x7f1ae0[_0x7c1b('0x7c')]=![];_0x7f1ae0['queuecallerexit']=!![];_0x7f1ae0['queuecallerexitAt']=moment(_0x3cee73[_0x7c1b('0x96')])[_0x7c1b('0x97')](_0x342121[_0x7c1b('0x7e')],_0x7c1b('0x98'))[_0x7c1b('0x52')](_0x7c1b('0x72'));_0x7f1ae0[_0x7c1b('0x50')]=_0x7c1b('0x99');_0x7f1ae0['transfer']=!![];_0x7f1ae0['transfertype']=_0x7c1b('0x9a');_0x7f1ae0[_0x7c1b('0x9b')]=_0x342121['destexten'];_0x7f1ae0[_0x7c1b('0x9c')]=_0x342121['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x7f1ae0[_0x7c1b('0x53')],_0x7f1ae0[_0x7c1b('0x71')]);var _0x5a5f6b=this[_0x7c1b('0xe')][_0x342121[_0x7c1b('0x95')]];this['queueReports'][_0x342121[_0x7c1b('0x95')]]=this['queueReports'][_0x342121[_0x7c1b('0x4f')]];this[_0x7c1b('0xe')][_0x342121['uniqueid']]=_0x5a5f6b;}}else{_0x3cee73[_0x7c1b('0x50')]=_0x7c1b('0x9d')+_0x342121[_0x7c1b('0x9e')][_0x7c1b('0x9f')]();logger['info'](_0x7c1b('0xa0'),_0x3cee73['queue'],_0x3cee73[_0x7c1b('0x71')],_0x3cee73[_0x7c1b('0x50')]);}}}this[_0x7c1b('0x11')][_0x342121['uniqueid']]=_0x3cee73;}}}catch(_0x43c68c){logger[_0x7c1b('0x3f')](_0x7c1b('0x8a'),_0x342121['uniqueid'],util[_0x7c1b('0x49')](_0x43c68c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7c1b('0xa1')]=function(_0x219f6e){try{if(this[_0x7c1b('0x5a')](_0x219f6e)){logger[_0x7c1b('0x47')](_0x7c1b('0xa2'),_0x219f6e[_0x7c1b('0x4f')],util[_0x7c1b('0x49')](_0x219f6e,{'showHidden':![],'depth':null}));this[_0x7c1b('0xa3')](_0x219f6e[_0x7c1b('0x4f')],_[_0x7c1b('0x78')](_0x219f6e['variable'])[0x0],_0x219f6e['value']);if(this[_0x7c1b('0xe')][_0x219f6e[_0x7c1b('0x4f')]]){var _0x2a6d8a=_[_0x7c1b('0x7b')](this[_0x7c1b('0xe')][_0x219f6e[_0x7c1b('0x4f')]]);if(_0x2a6d8a){if(this['isNotNull'](_0x219f6e[_0x7c1b('0xa4')])&&this[_0x7c1b('0x5a')](_0x219f6e[_0x7c1b('0xa4')][_0x7c1b('0x64')])){switch(_0x219f6e[_0x7c1b('0xa5')]){case _0x7c1b('0xa6'):_0x2a6d8a['queuecallerexit']=![];_0x2a6d8a[_0x7c1b('0x8e')]=null;break;case _0x7c1b('0xa7'):_0x2a6d8a[_0x7c1b('0xa8')]=_0x7c1b('0xa9');_0x2a6d8a[_0x7c1b('0xaa')]=!![];_0x2a6d8a['queuecallerexitAt']=moment()[_0x7c1b('0x52')](_0x7c1b('0x72'));_0x2a6d8a[_0x7c1b('0x84')]=moment()[_0x7c1b('0x52')](_0x7c1b('0x72'));logger[_0x7c1b('0x47')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x219f6e[_0x7c1b('0x4f')],util['inspect'](_0x2a6d8a,{'showHidden':![],'depth':null}));ami['emit'](_0x7c1b('0xab'),_0x2a6d8a);break;default:_0x2a6d8a[_0x7c1b('0xaa')]=!![];_0x2a6d8a[_0x7c1b('0x8e')]=moment()[_0x7c1b('0x52')](_0x7c1b('0x72'));_0x2a6d8a[_0x7c1b('0x84')]=moment()['format'](_0x7c1b('0x72'));}_0x2a6d8a[_0x7c1b('0x80')]=![];_0x2a6d8a[_0x7c1b('0x81')]=null;_0x2a6d8a[_0x7c1b('0x50')]=_0x219f6e[_0x7c1b('0xa5')];this[_0x7c1b('0x11')][_0x219f6e[_0x7c1b('0x4f')]]=_0x2a6d8a;this[_0x7c1b('0x43')](_0x2a6d8a,_0x7c1b('0x26'));}else if(this[_0x7c1b('0x5a')](_0x219f6e['variable'])&&this[_0x7c1b('0x5a')](_0x219f6e[_0x7c1b('0xa4')][_0x7c1b('0xac')])){if(!_0x2a6d8a['queuecallerabandon']){_0x2a6d8a[_0x7c1b('0xaa')]=!![];_0x2a6d8a[_0x7c1b('0x8e')]=moment()['format'](_0x7c1b('0x72'));_0x2a6d8a['queuecallerexitreason']=_0x7c1b('0xad');_0x2a6d8a[_0x7c1b('0x84')]=moment()[_0x7c1b('0x52')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7c1b('0x11')][_0x219f6e[_0x7c1b('0x4f')]]=_0x2a6d8a;}}logger[_0x7c1b('0x6b')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x219f6e[_0x7c1b('0x4f')],_0x2a6d8a[_0x7c1b('0x53')],_0x2a6d8a[_0x7c1b('0x71')],_[_0x7c1b('0x78')](_0x219f6e['variable'])[0x0],_0x219f6e[_0x7c1b('0xa5')]);_0x2a6d8a[_0x7c1b('0x16')]=this[_0x7c1b('0x16')][_0x219f6e[_0x7c1b('0x4f')]];}}}}catch(_0x89af7b){logger['error']('[%s][voiceQueueReport][varset]',_0x219f6e[_0x7c1b('0x4f')],util[_0x7c1b('0x49')](_0x89af7b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7c1b('0xa3')]=function(_0x1abf62,_0x4e9e54,_0x3c5882){var _0x2b1855=[_0x7c1b('0xae'),'rtpaudioqosbridged',_0x7c1b('0xaf'),_0x7c1b('0xb0'),_0x7c1b('0xb1'),_0x7c1b('0xb2'),_0x7c1b('0xb3'),_0x7c1b('0xb4'),_0x7c1b('0xb5'),'sipuri','bridgepeer',_0x7c1b('0xb6'),_0x7c1b('0xb7'),_0x7c1b('0xb8'),'memberinterface',_0x7c1b('0xb9'),_0x7c1b('0x8d'),_0x7c1b('0xba'),_0x7c1b('0xbb')];if(!_[_0x7c1b('0xbc')](_0x4e9e54)&&!_['includes'](_0x2b1855,_0x4e9e54)){if(_['isUndefined'](this[_0x7c1b('0x16')][_0x1abf62])){this[_0x7c1b('0x16')][_0x1abf62]={};}this[_0x7c1b('0x16')][_0x1abf62][_0x4e9e54]=_0x3c5882;}};VoiceQueueReport[_0x7c1b('0x37')][_0x7c1b('0xbd')]=function(_0x1ef0c5,_0x3fe49d,_0xb09102){var _0x3c9f19={};for(var _0x5e1273=0x0;_0x5e12730x0?!![]:![];if(!_0x4e4af2){return this[_0x29e7('0x1b')](this[_0x29e7('0x17')][_0x29e7('0x6a')]);}};VoiceQueueReport['prototype'][_0x29e7('0x1c')]=function(_0x58b668){var _0x1d3236=this[_0x29e7('0x17')]['id'];if(this[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1d3236]&&this[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1d3236][_0x58b668['actionid']]){this['summary'][_0x29e7('0x5d')][_0x1d3236][_0x58b668[_0x29e7('0x5c')]][_0x29e7('0x12')]['push'](_0x58b668);}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x18')]=function(_0x1cb8de){var _0x4b19aa=this;try{if(this[_0x29e7('0x6b')](_0x1cb8de)&&this[_0x29e7('0x6b')](_0x1cb8de[_0x29e7('0x50')])){logger[_0x29e7('0x47')](_0x29e7('0x6c'),util['inspect'](_0x1cb8de,{'showHidden':![],'depth':null}));var _0x51c424=this['voiceQueues'][_0x1cb8de[_0x29e7('0x50')]];if(_0x51c424){logger[_0x29e7('0x6d')](_0x29e7('0x6e'),_0x51c424[_0x29e7('0x60')]);this[_0x29e7('0x17')]['queues'][_0x51c424['name']]={'summaryEvent':_0x1cb8de};this[_0x29e7('0x17')][_0x29e7('0x69')]+=0x1;return ami[_0x29e7('0x3a')]({'action':'queuestatus','queue':_0x51c424[_0x29e7('0x60')]})[_0x29e7('0x5b')](function(_0x46a8d8){if(!_0x4b19aa[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1cb8de[_0x29e7('0x5c')]]){_0x4b19aa[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1cb8de[_0x29e7('0x5c')]]={};}_0x4b19aa[_0x29e7('0x17')][_0x29e7('0x5d')][_0x1cb8de['actionid']][_0x46a8d8['actionid']]={'queue':_0x51c424[_0x29e7('0x60')],'agents':[]};})[_0x29e7('0x3c')](function(_0x3cb6a7){throw _0x3cb6a7;});}}}catch(_0xb23ea){logger[_0x29e7('0x3f')](_0x29e7('0x5e'),util[_0x29e7('0x40')](_0xb23ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x1b')]=function(_0x52f5e){if(this['summary']['statusRequests']>0x0){this[_0x29e7('0x17')][_0x29e7('0x6a')]=_0x52f5e;return;}logger[_0x29e7('0x47')](_0x29e7('0x6f'),util['inspect'](_0x52f5e,{'showHidden':![],'depth':null}));this[_0x29e7('0x17')]=initializeSummary();ami[_0x29e7('0x4a')](_0x29e7('0x70'),{});};VoiceQueueReport[_0x29e7('0xb')]['syncQueueCallerJoin']=function(_0x401108){try{if(this[_0x29e7('0x6b')](_0x401108)){logger[_0x29e7('0x47')](_0x29e7('0x71'),_0x401108['uniqueid'],util[_0x29e7('0x40')](_0x401108,{'showHidden':![],'depth':null}));if(_[_0x29e7('0x56')](this[_0x29e7('0x10')][_0x401108[_0x29e7('0x49')]])){this['queueReports'][_0x401108[_0x29e7('0x49')]]=[];}if(_[_0x29e7('0x56')](this['channels'][_0x401108[_0x29e7('0x49')]])){this[_0x29e7('0x13')][_0x401108[_0x29e7('0x49')]]={};}var _0x267c73=new QueueReport();_0x267c73['queue']=_0x401108[_0x29e7('0x50')];_0x267c73[_0x29e7('0x64')]=this[_0x29e7('0x15')][_0x267c73[_0x29e7('0x50')]]&&this[_0x29e7('0x15')][_0x267c73[_0x29e7('0x50')]][_0x29e7('0x64')]?this[_0x29e7('0x15')][_0x267c73[_0x29e7('0x50')]][_0x29e7('0x64')]||'inbound':_0x29e7('0x65');_0x267c73[_0x29e7('0x72')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x267c73[_0x29e7('0x73')]=_0x401108[_0x29e7('0x73')];_0x267c73[_0x29e7('0x74')]=_0x401108[_0x29e7('0x74')];_0x267c73[_0x29e7('0x49')]=_0x401108[_0x29e7('0x49')];_0x267c73[_0x29e7('0x75')]=this[_0x29e7('0x13')][_0x401108[_0x29e7('0x49')]][_0x29e7('0x75')];logger['info'](_0x29e7('0x76'),_0x267c73['queue'],_0x267c73[_0x29e7('0x64')]);_[_0x29e7('0x77')](_0x267c73,_[_0x29e7('0x78')](_0x401108,_[_0x29e7('0x79')](_0x267c73)));this[_0x29e7('0x10')][_0x401108[_0x29e7('0x49')]][_0x29e7('0x7a')](_0x267c73);this['channels'][_0x401108[_0x29e7('0x49')]]=_0x267c73;this['emitVoiceQueueChannelSave'](_0x267c73,_0x29e7('0x1f'));}}catch(_0x311239){logger[_0x29e7('0x3f')](_0x29e7('0x71'),_0x401108['uniqueid'],util[_0x29e7('0x40')](_0x311239,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x22')]=function(_0x9e7c4b){try{if(this['isNotNull'](_0x9e7c4b)){logger[_0x29e7('0x47')](_0x29e7('0x7b'),_0x9e7c4b[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x9e7c4b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x9e7c4b[_0x29e7('0x49')]]){var _0x42147b=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x9e7c4b[_0x29e7('0x49')]]);_0x42147b['queuecallercomplete']=![];_0x42147b[_0x29e7('0x7d')]=null;_0x42147b[_0x29e7('0x7e')]=_0x9e7c4b[_0x29e7('0x7e')];_0x42147b['originalposition']=_0x9e7c4b[_0x29e7('0x7f')];_0x42147b[_0x29e7('0x21')]=!![];_0x42147b[_0x29e7('0x80')]=moment()[_0x29e7('0x4b')](_0x29e7('0x81'));_0x42147b[_0x29e7('0x4f')]='ABANDONED';_0x42147b['lastAssignedTo']=null;logger[_0x29e7('0x6d')](_0x29e7('0x82'),_0x42147b[_0x29e7('0x50')],_0x42147b['type']);this[_0x29e7('0x13')][_0x9e7c4b['uniqueid']]=_0x42147b;this[_0x29e7('0x46')](_0x42147b,_0x29e7('0x21'));}}}catch(_0x4cf9d7){logger[_0x29e7('0x3f')](_0x29e7('0x7b'),_0x9e7c4b[_0x29e7('0x49')],util['inspect'](_0x4cf9d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x23')]=function(_0x18297c){try{if(this[_0x29e7('0x6b')](_0x18297c)){logger[_0x29e7('0x47')](_0x29e7('0x83'),_0x18297c[_0x29e7('0x49')],util['inspect'](_0x18297c,{'showHidden':![],'depth':null}));if(this[_0x29e7('0x10')][_0x18297c[_0x29e7('0x49')]]){var _0x257efa=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x18297c[_0x29e7('0x49')]]);_0x257efa[_0x29e7('0x84')]=moment()[_0x29e7('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x257efa['connectedlinenum']=_0x18297c[_0x29e7('0x85')];_0x257efa[_0x29e7('0x86')]=_0x18297c[_0x29e7('0x86')];logger[_0x29e7('0x6d')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x257efa[_0x29e7('0x50')],_0x257efa[_0x29e7('0x64')],_0x18297c[_0x29e7('0x85')],_0x18297c['connectedlinename']);this[_0x29e7('0x13')][_0x18297c['uniqueid']]=_0x257efa;this['emitVoiceQueueChannelSave'](_0x257efa,_0x29e7('0x87'));}}}catch(_0x3994e7){logger['error'](_0x29e7('0x83'),_0x18297c[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x3994e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x25')]=function(_0x3b01f8){try{if(this[_0x29e7('0x6b')](_0x3b01f8)){logger[_0x29e7('0x47')](_0x29e7('0x88'),_0x3b01f8['uniqueid'],util['inspect'](_0x3b01f8,{'showHidden':![],'depth':null}));if(this[_0x29e7('0x10')][_0x3b01f8[_0x29e7('0x49')]]){var _0x12c857=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x3b01f8[_0x29e7('0x49')]]);_0x12c857['queuecallercomplete']=!![];_0x12c857[_0x29e7('0x4f')]='COMPLETEDBYAGENT';logger[_0x29e7('0x6d')](_0x29e7('0x89'),_0x12c857['queue'],_0x12c857[_0x29e7('0x64')]);}}}catch(_0x36a8a1){logger[_0x29e7('0x3f')]('[%s][voiceQueueReport][agentconnect]',_0x3b01f8[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x36a8a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x24')]=function(_0x3c409e){try{if(this['isNotNull'](_0x3c409e)){logger[_0x29e7('0x47')](_0x29e7('0x8a'),_0x3c409e[_0x29e7('0x49')],util[_0x29e7('0x40')](_0x3c409e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3c409e[_0x29e7('0x49')]]){var _0x3d34c2=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x3c409e[_0x29e7('0x49')]]);_0x3d34c2[_0x29e7('0x21')]=![];_0x3d34c2['queuecallerabandonAt']=null;_0x3d34c2['assigned']=!![];_0x3d34c2[_0x29e7('0x8b')]=_0x3c409e[_0x29e7('0x8c')];_0x3d34c2[_0x29e7('0x7e')]=_0x3c409e[_0x29e7('0x7e')];_0x3d34c2['queuecallercomplete']=!![];_0x3d34c2[_0x29e7('0x8d')]=![];_0x3d34c2[_0x29e7('0x8e')]=null;if(!_0x3d34c2[_0x29e7('0x8f')]){if(_0x3c409e[_0x29e7('0x90')]=='transfer'){_0x3d34c2[_0x29e7('0x4f')]=_0x29e7('0x91');logger[_0x29e7('0x6d')](_0x29e7('0x92'),_0x3d34c2[_0x29e7('0x50')],_0x3d34c2[_0x29e7('0x64')]);}else{if(_[_0x29e7('0x93')](_0x3c409e[_0x29e7('0x94')][_0x29e7('0x95')](),_0x29e7('0x96'))){if(this[_0x29e7('0x10')][_0x3c409e['linkedid']]){var _0x40c451=_['last'](this[_0x29e7('0x10')][_0x3c409e[_0x29e7('0x97')]]);_0x40c451[_0x29e7('0x98')]=![];_0x40c451['queuecallerexit']=!![];_0x40c451[_0x29e7('0x8e')]=moment(_0x3d34c2[_0x29e7('0x72')])[_0x29e7('0x99')](_0x3c409e[_0x29e7('0x7e')],_0x29e7('0x9a'))[_0x29e7('0x4b')](_0x29e7('0x81'));_0x40c451[_0x29e7('0x4f')]=_0x29e7('0x9b');_0x40c451['transfer']=!![];_0x40c451[_0x29e7('0x9c')]=_0x29e7('0x9d');_0x40c451['transferexten']=_0x3c409e[_0x29e7('0x9e')];_0x40c451[_0x29e7('0x9f')]=_0x3c409e[_0x29e7('0x49')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x40c451['queue'],_0x40c451[_0x29e7('0x64')]);var _0x3f7c45=this[_0x29e7('0x10')][_0x3c409e[_0x29e7('0x97')]];this[_0x29e7('0x10')][_0x3c409e[_0x29e7('0x97')]]=this['queueReports'][_0x3c409e['uniqueid']];this[_0x29e7('0x10')][_0x3c409e[_0x29e7('0x49')]]=_0x3f7c45;}}else{_0x3d34c2[_0x29e7('0x4f')]=_0x29e7('0xa0')+_0x3c409e[_0x29e7('0x90')]['toUpperCase']();logger[_0x29e7('0x6d')](_0x29e7('0xa1'),_0x3d34c2[_0x29e7('0x50')],_0x3d34c2['type'],_0x3d34c2[_0x29e7('0x4f')]);}}}this['channels'][_0x3c409e[_0x29e7('0x49')]]=_0x3d34c2;}}}catch(_0x1fb60f){logger[_0x29e7('0x3f')]('[%s][voiceQueueReport][agentcomplete]',_0x3c409e['uniqueid'],util['inspect'](_0x1fb60f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0x27')]=function(_0x526dd9){try{if(this[_0x29e7('0x6b')](_0x526dd9)){logger[_0x29e7('0x47')]('[%s][voiceQueueReport][varset]',_0x526dd9[_0x29e7('0x49')],util['inspect'](_0x526dd9,{'showHidden':![],'depth':null}));this[_0x29e7('0xa2')](_0x526dd9['uniqueid'],_['keys'](_0x526dd9['variable'])[0x0],_0x526dd9[_0x29e7('0xa3')]);if(this[_0x29e7('0x10')][_0x526dd9[_0x29e7('0x49')]]){var _0x4718cd=_[_0x29e7('0x7c')](this[_0x29e7('0x10')][_0x526dd9[_0x29e7('0x49')]]);if(_0x4718cd){if(this[_0x29e7('0x6b')](_0x526dd9[_0x29e7('0xa4')])&&this[_0x29e7('0x6b')](_0x526dd9['variable']['queuestatus'])){switch(_0x526dd9[_0x29e7('0xa3')]){case _0x29e7('0xa5'):_0x4718cd[_0x29e7('0x8d')]=![];_0x4718cd['queuecallerexitAt']=null;break;case _0x29e7('0xa6'):_0x4718cd[_0x29e7('0xa7')]='timeout';_0x4718cd[_0x29e7('0x8d')]=!![];_0x4718cd[_0x29e7('0x8e')]=moment()[_0x29e7('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4718cd[_0x29e7('0x84')]=moment()['format'](_0x29e7('0x81'));logger[_0x29e7('0x47')](_0x29e7('0xa8'),_0x526dd9[_0x29e7('0x49')],util['inspect'](_0x4718cd,{'showHidden':![],'depth':null}));ami[_0x29e7('0x4a')](_0x29e7('0xa9'),_0x4718cd);break;default:_0x4718cd[_0x29e7('0x8d')]=!![];_0x4718cd['queuecallerexitAt']=moment()['format'](_0x29e7('0x81'));_0x4718cd[_0x29e7('0x84')]=moment()['format'](_0x29e7('0x81'));}_0x4718cd['queuecallerabandon']=![];_0x4718cd['queuecallerabandonAt']=null;_0x4718cd[_0x29e7('0x4f')]=_0x526dd9[_0x29e7('0xa3')];this[_0x29e7('0x13')][_0x526dd9[_0x29e7('0x49')]]=_0x4718cd;this[_0x29e7('0x46')](_0x4718cd,_0x29e7('0x26'));}else if(this[_0x29e7('0x6b')](_0x526dd9['variable'])&&this[_0x29e7('0x6b')](_0x526dd9[_0x29e7('0xa4')]['queueposition'])){if(!_0x4718cd['queuecallerabandon']){_0x4718cd[_0x29e7('0x8d')]=!![];_0x4718cd[_0x29e7('0x8e')]=moment()[_0x29e7('0x4b')](_0x29e7('0x81'));_0x4718cd[_0x29e7('0x4f')]='EXITWITHKEY';_0x4718cd['queuecallerleaveAt']=moment()[_0x29e7('0x4b')](_0x29e7('0x81'));this['channels'][_0x526dd9['uniqueid']]=_0x4718cd;}}logger[_0x29e7('0x6d')](_0x29e7('0xaa'),_0x526dd9[_0x29e7('0x49')],_0x4718cd[_0x29e7('0x50')],_0x4718cd[_0x29e7('0x64')],_[_0x29e7('0x79')](_0x526dd9[_0x29e7('0xa4')])[0x0],_0x526dd9[_0x29e7('0xa3')]);_0x4718cd[_0x29e7('0x42')]=this[_0x29e7('0x42')][_0x526dd9['uniqueid']];}}}}catch(_0x400ea8){logger[_0x29e7('0x3f')](_0x29e7('0xab'),_0x526dd9['uniqueid'],util[_0x29e7('0x40')](_0x400ea8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x29e7('0xa2')]=function(_0x4d7d30,_0x3e19eb,_0x34900b){var _0x305d58=['rtpaudioqos',_0x29e7('0xac'),_0x29e7('0xad'),_0x29e7('0xae'),_0x29e7('0xaf'),_0x29e7('0xb0'),_0x29e7('0xb1'),_0x29e7('0xb2'),_0x29e7('0xb3'),_0x29e7('0xb4'),'bridgepeer','bridgepvtcallid',_0x29e7('0xb5'),'memberdynamic',_0x29e7('0xb6'),_0x29e7('0xb7'),_0x29e7('0x8c'),_0x29e7('0xb8'),_0x29e7('0xb9')];if(!_['isNil'](_0x3e19eb)&&!_[_0x29e7('0xba')](_0x305d58,_0x3e19eb)){if(_[_0x29e7('0x56')](this[_0x29e7('0x42')][_0x4d7d30])){this[_0x29e7('0x42')][_0x4d7d30]={};}this[_0x29e7('0x42')][_0x4d7d30][_0x3e19eb]=_0x34900b;}};VoiceQueueReport[_0x29e7('0xb')][_0x29e7('0xbb')]=function(_0x3e3a3b,_0xadfc05,_0x1a8c7e){var _0x42fd1a={};for(var _0x1e904b=0x0;_0x1e904b=0x0?moment(_0xa1cd0[_0x53ed('0x17')])['diff'](_0xa1cd0[_0x53ed('0x16')],_0x53ed('0xc')):null,'data1':_0x53ed('0x18'),'data2':_0xa1cd0[_0x53ed('0x11')],'data3':_0xa1cd0[_0x53ed('0xf')],'data4':_0xa1cd0[_0x53ed('0x19')]||null,'role':_0x53ed('0x1a'),'internal':_0xa1cd0['accountcode']?_['toNumber'](_0xa1cd0[_0x53ed('0x11')]):undefined,'uniqueid':_0xa1cd0[_0x53ed('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x234f=['seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','starttime','endtime','outbound','dialstring','moment','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff'];(function(_0x200082,_0x5db061){var _0x1a9035=function(_0x2f6a54){while(--_0x2f6a54){_0x200082['push'](_0x200082['shift']());}};_0x1a9035(++_0x5db061);}(_0x234f,0xed));var _0xf234=function(_0x44bf1a,_0x7956){_0x44bf1a=_0x44bf1a-0x0;var _0xe43640=_0x234f[_0x44bf1a];return _0xe43640;};'use strict';var moment=require(_0xf234('0x0'));var _=require('lodash');var util=require('util');var client=require(_0xf234('0x1'));exports[_0xf234('0x2')]=function(_0x1a504d){var _0x8fe48=_0x1a504d[_0xf234('0x3')]||_0x1a504d[_0xf234('0x4')];return client[_0xf234('0x5')](_0xf234('0x6'),{'body':{'channel':'voice','membername':_0x1a504d[_0xf234('0x7')],'interface':_[_0xf234('0x8')](_0x1a504d[_0xf234('0x9')])?util[_0xf234('0xa')](_0xf234('0xb'),_0x1a504d['lastAssignedTo']):_0x1a504d[_0xf234('0x9')],'type':_0xf234('0xc'),'enterAt':_0x1a504d[_0xf234('0xd')],'exitAt':_0x8fe48,'duration':moment(_0x8fe48)[_0xf234('0xe')](_0x1a504d[_0xf234('0xd')],_0xf234('0xf')),'data1':_0xf234('0x10'),'data2':_0x1a504d[_0xf234('0x11')],'data3':_0x1a504d[_0xf234('0x12')],'data4':null,'data5':_0x1a504d[_0xf234('0x13')],'role':_0xf234('0x14'),'internal':_0x1a504d[_0xf234('0x15')]?_[_0xf234('0x16')](_0x1a504d[_0xf234('0x15')]):undefined,'uniqueid':_0x1a504d[_0xf234('0x17')]},'log':_0xf234('0x6')});};exports['voiceDialReport']=function(_0x430a54){return client['Request'](_0xf234('0x6'),{'body':{'channel':'voice','membername':_0x430a54['membername'],'interface':_0x430a54[_0xf234('0x9')],'type':'TALKING','enterAt':_0x430a54[_0xf234('0x18')],'exitAt':_0x430a54[_0xf234('0x19')],'duration':moment(_0x430a54[_0xf234('0x19')])[_0xf234('0xe')](_0x430a54['starttime'],'seconds')>=0x0?moment(_0x430a54[_0xf234('0x19')])['diff'](_0x430a54[_0xf234('0x18')],_0xf234('0xf')):null,'data1':_0xf234('0x1a'),'data2':_0x430a54[_0xf234('0x15')],'data3':_0x430a54['exten'],'data4':_0x430a54[_0xf234('0x1b')]||null,'role':_0xf234('0x14'),'internal':_0x430a54[_0xf234('0x15')]?_[_0xf234('0x16')](_0x430a54['accountcode']):undefined,'uniqueid':_0x430a54[_0xf234('0x17')]},'log':_0xf234('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 2836302..6758dc4 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 _0x530f=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings'];(function(_0x257eb6,_0x10c7e4){var _0x29924c=function(_0x1e474f){while(--_0x1e474f){_0x257eb6['push'](_0x257eb6['shift']());}};_0x29924c(++_0x10c7e4);}(_0x530f,0x167));var _0xf530=function(_0x1a15cd,_0x1b95c6){_0x1a15cd=_0x1a15cd-0x0;var _0x33f1eb=_0x530f[_0x1a15cd];return _0x33f1eb;};'use strict';var client=require('../client');exports[_0xf530('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf530('0x1'),_0xf530('0x2')]},'log':_0xf530('0x3')});}; \ No newline at end of file +var _0xc692=['GetSettings','../client','getSettings','Request','previewRecallmeReminderInterval'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0xc692,0x15f));var _0x2c69=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xc692[_0xdea41a];return _0x15d0d8;};'use strict';var client=require(_0x2c69('0x0'));exports[_0x2c69('0x1')]=function(){return client[_0x2c69('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x2c69('0x3')]},'log':_0x2c69('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 1368d61..57046b6 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 _0x8813=['Request','GetTemplate','html','../client'];(function(_0x21477a,_0x4697dd){var _0x3675b1=function(_0x2a0aa0){while(--_0x2a0aa0){_0x21477a['push'](_0x21477a['shift']());}};_0x3675b1(++_0x4697dd);}(_0x8813,0xd3));var _0x3881=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8813[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3881('0x0'));exports['getTemplates']=function(_0x55b3a4){return function(_0xbd776d){return client[_0x3881('0x1')](_0x3881('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x3881('0x3')]},'log':_0x3881('0x2')});};}; \ No newline at end of file +var _0x3270=['GetTemplate','html','../client','getTemplates','Request'];(function(_0x504dd8,_0x1396f2){var _0x54db75=function(_0x29e990){while(--_0x29e990){_0x504dd8['push'](_0x504dd8['shift']());}};_0x54db75(++_0x1396f2);}(_0x3270,0x192));var _0x0327=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x3270[_0xa2c0a3];return _0x52c618;};'use strict';var client=require(_0x0327('0x0'));exports[_0x0327('0x1')]=function(_0x1010ee){return function(_0x30202c){return client[_0x0327('0x2')](_0x0327('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x0327('0x4')]},'log':_0x0327('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index f77e181..13efe51 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 _0x1498=['AllConditions','field','operator','value','AnyConditions','Action','action','data1','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','channel','Condition'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x1498,0x163));var _0x8149=function(_0x4e8919,_0x32a87d){_0x4e8919=_0x4e8919-0x0;var _0x538d63=_0x1498[_0x4e8919];return _0x538d63;};'use strict';var client=require(_0x8149('0x0'));exports[_0x8149('0x1')]=function(_0x2f2a22){return function(_0x1b2f54){return client['Request'](_0x8149('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x8149('0x3'),'status'],'include':[{'model':_0x8149('0x4'),'as':_0x8149('0x5'),'attributes':['id',_0x8149('0x6'),_0x8149('0x7'),_0x8149('0x8')]},{'model':'Condition','as':_0x8149('0x9'),'attributes':['id',_0x8149('0x6'),_0x8149('0x7'),_0x8149('0x8')]},{'model':_0x8149('0xa'),'as':'Actions','attributes':['id',_0x8149('0xb'),_0x8149('0xc'),'data2',_0x8149('0xd'),_0x8149('0xe'),_0x8149('0xf'),_0x8149('0x10'),_0x8149('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x7bc8=['data6','GetTrigger','../client','getTriggers','name','status','Condition','value','field','Action','action','data4'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x7bc8,0x1ca));var _0x87bc=function(_0x14f150,_0x29c949){_0x14f150=_0x14f150-0x0;var _0x3f7036=_0x7bc8[_0x14f150];return _0x3f7036;};'use strict';var client=require(_0x87bc('0x0'));exports[_0x87bc('0x1')]=function(_0x1f35ba){return function(_0x619dfc){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x87bc('0x2'),'channel',_0x87bc('0x3')],'include':[{'model':_0x87bc('0x4'),'as':'AllConditions','attributes':['id','field','operator',_0x87bc('0x5')]},{'model':_0x87bc('0x4'),'as':'AnyConditions','attributes':['id',_0x87bc('0x6'),'operator','value']},{'model':_0x87bc('0x7'),'as':'Actions','attributes':['id',_0x87bc('0x8'),'data1','data2','data3',_0x87bc('0x9'),'data5',_0x87bc('0xa'),'data7']}]},'log':_0x87bc('0xb')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index d613435..9b0e19f 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 _0x3273=['getTrunks','GetTrunk','name','registry','defaultuser'];(function(_0x3d68cd,_0x466ce4){var _0x4ee014=function(_0xd07499){while(--_0xd07499){_0x3d68cd['push'](_0x3d68cd['shift']());}};_0x4ee014(++_0x466ce4);}(_0x3273,0x1d1));var _0x3327=function(_0x295ea9,_0x19d658){_0x295ea9=_0x295ea9-0x0;var _0x59a3fe=_0x3273[_0x295ea9];return _0x59a3fe;};'use strict';var client=require('../client');exports[_0x3327('0x0')]=function(_0x596352){return function(_0xcc3055){return client['Request'](_0x3327('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3327('0x2'),_0x3327('0x3'),_0x3327('0x4')]},'log':_0x3327('0x1')});};}; \ No newline at end of file +var _0xd493=['defaultuser','../client','GetTrunk'];(function(_0x452139,_0x4bdd9e){var _0x13abcb=function(_0x31a75c){while(--_0x31a75c){_0x452139['push'](_0x452139['shift']());}};_0x13abcb(++_0x4bdd9e);}(_0xd493,0x1bd));var _0x3d49=function(_0x182d52,_0x5c4bc9){_0x182d52=_0x182d52-0x0;var _0x178a6f=_0xd493[_0x182d52];return _0x178a6f;};'use strict';var client=require(_0x3d49('0x0'));exports['getTrunks']=function(_0x1391ea){return function(_0x14193e){return client['Request'](_0x3d49('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x3d49('0x2')]},'log':_0x3d49('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 6e52402..53da59d 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x54f8b0,_0x3cff2a){var _0x7d587f=function(_0xa09cd4){while(--_0xa09cd4){_0x54f8b0['push'](_0x54f8b0['shift']());}};_0x7d587f(++_0x3cff2a);}(_0xedd9,0xfc));var _0x9edd=function(_0x2eab24,_0x20dc22){_0x2eab24=_0x2eab24-0x0;var _0x54b4e9=_0xedd9[_0x2eab24];return _0x54b4e9;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x19d9e5,_0x1367a8){var _0x4742c9=function(_0x50418d){while(--_0x50418d){_0x19d9e5['push'](_0x19d9e5['shift']());}};_0x4742c9(++_0x1367a8);}(_0x70e0,0x17b));var _0x070e=function(_0x1a1c1e,_0x2c9bed){_0x1a1c1e=_0x1a1c1e-0x0;var _0x10999d=_0x70e0[_0x1a1c1e];return _0x10999d;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 0bec538..e78d553 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 _0x4e41=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x4e41,0x95));var _0x14e4=function(_0x5ad276,_0x233e81){_0x5ad276=_0x5ad276-0x0;var _0x16035c=_0x4e41[_0x5ad276];return _0x16035c;};'use strict';var client=require(_0x14e4('0x0'));exports[_0x14e4('0x1')]=function(_0x3b2958){return client[_0x14e4('0x2')](_0x14e4('0x3'),{'body':_0x3b2958,'log':_0x14e4('0x3')});};exports[_0x14e4('0x4')]=function(_0x379803,_0x27f6ba,_0x53af29){return client[_0x14e4('0x2')]('UpdateVoiceAgentReport',{'body':_0x379803,'options':{'where':{'uniqueid':_0x27f6ba,'interface':_0x53af29,'agentcomplete':!![]}},'log':_0x14e4('0x5')});}; \ No newline at end of file +var _0x6a9a=['UpdateVoiceAgentReport','create','CreateVoiceAgentReport','update','Request'];(function(_0x18efbf,_0xbe0214){var _0x22a8ad=function(_0x2ed306){while(--_0x2ed306){_0x18efbf['push'](_0x18efbf['shift']());}};_0x22a8ad(++_0xbe0214);}(_0x6a9a,0x6a));var _0xa6a9=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0x6a9a[_0x5805d7];return _0x170fe4;};'use strict';var client=require('../client');exports[_0xa6a9('0x0')]=function(_0x2fb4cc){return client['Request'](_0xa6a9('0x1'),{'body':_0x2fb4cc,'log':_0xa6a9('0x1')});};exports[_0xa6a9('0x2')]=function(_0x14ef7e,_0x2c8c16,_0x365482){return client[_0xa6a9('0x3')]('UpdateVoiceAgentReport',{'body':_0x14ef7e,'options':{'where':{'uniqueid':_0x2c8c16,'interface':_0x365482,'agentcomplete':!![]}},'log':_0xa6a9('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index adcea7e..1d9c207 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 _0xdc67=['merge','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','CreateVoiceCallReport'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xdc67,0xd7));var _0x7dc6=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0xdc67[_0x1fd675];return _0x16b554;};'use strict';var moment=require(_0x7dc6('0x0'));var util=require('util');var _=require(_0x7dc6('0x1'));var client=require(_0x7dc6('0x2'));exports[_0x7dc6('0x3')]=function(_0x23098a){return client['Request'](_0x7dc6('0x4'),{'body':_[_0x7dc6('0x5')](_0x23098a,{'source':_0x23098a['calleridnum'],'destinationcontext':_0x23098a[_0x7dc6('0x6')],'callerid':_0x23098a[_0x7dc6('0x7')],'amaflags':_0x7dc6('0x8')}),'log':_0x7dc6('0x4')});};exports[_0x7dc6('0x9')]=function(){return function(){return client[_0x7dc6('0xa')](_0x7dc6('0xb'),{'options':{'where':{'type':[_0x7dc6('0xc')],'createdAt':{'$between':[moment()[_0x7dc6('0xd')](_0x7dc6('0xe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x7dc6('0xe'))[_0x7dc6('0xf')](_0x7dc6('0x10'))]}},'attributes':['type','disposition',_0x7dc6('0x11'),_0x7dc6('0x12')]},'log':_0x7dc6('0x13')});};}; \ No newline at end of file +var _0x0bf0=['type','util','../client','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x0bf0,0xde));var _0x00bf=function(_0x523301,_0x44187d){_0x523301=_0x523301-0x0;var _0x24b9ed=_0x0bf0[_0x523301];return _0x24b9ed;};'use strict';var moment=require('moment');var util=require(_0x00bf('0x0'));var _=require('lodash');var client=require(_0x00bf('0x1'));exports['create']=function(_0x37020c){return client[_0x00bf('0x2')]('CreateVoiceCallReport',{'body':_[_0x00bf('0x3')](_0x37020c,{'source':_0x37020c[_0x00bf('0x4')],'destinationcontext':_0x37020c[_0x00bf('0x5')],'callerid':_0x37020c[_0x00bf('0x6')],'amaflags':_0x00bf('0x7')}),'log':_0x00bf('0x8')});};exports[_0x00bf('0x9')]=function(){return function(){return client[_0x00bf('0x2')](_0x00bf('0xa'),{'options':{'where':{'type':[_0x00bf('0xb')],'createdAt':{'$between':[moment()[_0x00bf('0xc')](_0x00bf('0xd'))[_0x00bf('0xe')](_0x00bf('0xf')),moment()['endOf'](_0x00bf('0xd'))[_0x00bf('0xe')](_0x00bf('0xf'))]}},'attributes':[_0x00bf('0x10'),'disposition','duration','billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 7b51cf2..cb8b947 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 _0x5cd7=['CreateVoiceDialReport','Request'];(function(_0x5ee448,_0x2321b9){var _0x1fed5d=function(_0x3d67bb){while(--_0x3d67bb){_0x5ee448['push'](_0x5ee448['shift']());}};_0x1fed5d(++_0x2321b9);}(_0x5cd7,0x67));var _0x75cd=function(_0x3df93e,_0x5af13a){_0x3df93e=_0x3df93e-0x0;var _0x2d4f2a=_0x5cd7[_0x3df93e];return _0x2d4f2a;};'use strict';var client=require('../client');exports['create']=function(_0x381470){return client[_0x75cd('0x0')](_0x75cd('0x1'),{'body':_0x381470,'log':_0x75cd('0x1')});}; \ No newline at end of file +var _0x4668=['CreateVoiceDialReport','../client','create','Request'];(function(_0x481901,_0x1feba0){var _0xe78f85=function(_0x48050c){while(--_0x48050c){_0x481901['push'](_0x481901['shift']());}};_0xe78f85(++_0x1feba0);}(_0x4668,0x12d));var _0x8466=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4668[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x8466('0x0'));exports[_0x8466('0x1')]=function(_0xc586d7){return client[_0x8466('0x2')](_0x8466('0x3'),{'body':_0xc586d7,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ab31adf..1b4a091 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 _0x9354=['exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x589fb1,_0x5d8fb5){var _0x12195c=function(_0x2f9a9c){while(--_0x2f9a9c){_0x589fb1['push'](_0x589fb1['shift']());}};_0x12195c(++_0x5d8fb5);}(_0x9354,0x96));var _0x4935=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0x9354[_0xb7a459];return _0x104ab5;};'use strict';var client=require('../client');exports[_0x4935('0x0')]=function(){return function(){return client[_0x4935('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x4935('0x2'),_0x4935('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x4935('0x0')});};}; \ No newline at end of file +var _0xc112=['recordingFormat','../client','getVoiceExtensions','Request','exten'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xc112,0xec));var _0x2c11=function(_0x42ba02,_0x19178f){_0x42ba02=_0x42ba02-0x0;var _0x42255b=_0xc112[_0x42ba02];return _0x42255b;};'use strict';var client=require(_0x2c11('0x0'));exports[_0x2c11('0x1')]=function(){return function(){return client[_0x2c11('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x2c11('0x3'),_0x2c11('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x2c11('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 92caf1a..e797dc1 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 _0x3fb8=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x539d03,_0x4b316c){var _0xe8112=function(_0x27db3b){while(--_0x27db3b){_0x539d03['push'](_0x539d03['shift']());}};_0xe8112(++_0x4b316c);}(_0x3fb8,0x11e));var _0x83fb=function(_0x4819e3,_0x5dcdb1){_0x4819e3=_0x4819e3-0x0;var _0x3255c8=_0x3fb8[_0x4819e3];return _0x3255c8;};'use strict';var client=require('../client');exports[_0x83fb('0x0')]=function(){return function(){return client[_0x83fb('0x1')](_0x83fb('0x2'),{'options':{'raw':![],'attributes':['id',_0x83fb('0x3'),_0x83fb('0x4'),_0x83fb('0x5'),_0x83fb('0x6'),_0x83fb('0x7'),_0x83fb('0x8'),_0x83fb('0x9'),_0x83fb('0xa'),_0x83fb('0xb'),'dialLimitQueue',_0x83fb('0xc'),_0x83fb('0xd'),'dialPredictiveOptimizationPercentage',_0x83fb('0xe'),_0x83fb('0xf'),_0x83fb('0x10'),_0x83fb('0x11'),'dialQueueOptions',_0x83fb('0x12'),_0x83fb('0x13'),'dialCongestionMaxRetry',_0x83fb('0x14'),_0x83fb('0x15'),_0x83fb('0x16'),'dialNoAnswerMaxRetry',_0x83fb('0x17'),_0x83fb('0x18'),_0x83fb('0x19'),_0x83fb('0x1a'),_0x83fb('0x1b'),'dialCheckDuplicateType',_0x83fb('0x1c'),_0x83fb('0x1d'),_0x83fb('0x1e'),_0x83fb('0x1f'),'dialAMDTotalAnalysisTime',_0x83fb('0x20'),_0x83fb('0x21'),_0x83fb('0x22'),_0x83fb('0x23'),_0x83fb('0x24'),'timeout',_0x83fb('0x25'),_0x83fb('0x26'),'dialOrderByScheduledAt',_0x83fb('0x27'),_0x83fb('0x28'),_0x83fb('0x29'),_0x83fb('0x7'),_0x83fb('0x2a'),_0x83fb('0x2b'),'dialCutDigit',_0x83fb('0x2c'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x83fb('0x2d'),_0x83fb('0x2e'),_0x83fb('0x2f'),_0x83fb('0x30'),_0x83fb('0x31'),_0x83fb('0x32'),_0x83fb('0x33'),_0x83fb('0x34'),_0x83fb('0x35'),_0x83fb('0x36'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x83fb('0x37'),'as':_0x83fb('0x37'),'attributes':['id',_0x83fb('0x3'),_0x83fb('0x38'),_0x83fb('0x39')]},{'model':_0x83fb('0x3a'),'as':_0x83fb('0x3b'),'attributes':['id',_0x83fb('0x3')]},{'model':_0x83fb('0x37'),'as':_0x83fb('0x3c'),'attributes':['id',_0x83fb('0x3'),_0x83fb('0x38'),_0x83fb('0x39')]},{'model':_0x83fb('0x3d'),'as':_0x83fb('0x3d'),'attributes':['id',_0x83fb('0x3')],'include':[{'model':_0x83fb('0x3d'),'as':_0x83fb('0x3e'),'attributes':['id','name',_0x83fb('0x3f')]}]}]},'log':_0x83fb('0x0')});};}; \ No newline at end of file +var _0x3841=['GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request'];(function(_0x2e0446,_0x4e44e7){var _0x568aae=function(_0x50f9b3){while(--_0x50f9b3){_0x2e0446['push'](_0x2e0446['shift']());}};_0x568aae(++_0x4e44e7);}(_0x3841,0xae));var _0x1384=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0x3841[_0x26721d];return _0x1035c5;};'use strict';var client=require(_0x1384('0x0'));exports[_0x1384('0x1')]=function(){return function(){return client[_0x1384('0x2')](_0x1384('0x3'),{'options':{'raw':![],'attributes':['id',_0x1384('0x4'),_0x1384('0x5'),_0x1384('0x6'),_0x1384('0x7'),_0x1384('0x8'),_0x1384('0x9'),_0x1384('0xa'),'dialMethod',_0x1384('0xb'),_0x1384('0xc'),_0x1384('0xd'),_0x1384('0xe'),'dialPredictiveOptimizationPercentage',_0x1384('0xf'),_0x1384('0x10'),_0x1384('0x11'),'dialOriginateTimeout',_0x1384('0x12'),'dialQueueTimeout',_0x1384('0x13'),_0x1384('0x14'),'dialCongestionRetryFrequency',_0x1384('0x15'),_0x1384('0x16'),_0x1384('0x17'),_0x1384('0x18'),_0x1384('0x19'),_0x1384('0x1a'),_0x1384('0x1b'),_0x1384('0x1c'),'dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence',_0x1384('0x1d'),'dialAMDAfterGreetingSilence',_0x1384('0x1e'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x1384('0x1f'),_0x1384('0x20'),_0x1384('0x21'),'timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt',_0x1384('0x22'),'dialAgiAfterHangupClient',_0x1384('0x23'),_0x1384('0x8'),_0x1384('0x24'),_0x1384('0x25'),_0x1384('0x26'),_0x1384('0x27'),_0x1384('0x28'),_0x1384('0x29'),'dialDropRetryFrequency',_0x1384('0x2a'),_0x1384('0x2b'),_0x1384('0x2c'),'dialMachineRetryFrequency',_0x1384('0x2d'),_0x1384('0x2e'),_0x1384('0x2f'),_0x1384('0x30'),_0x1384('0x31'),'dialPreviewAutoRecallMe',_0x1384('0x32')],'include':[{'model':_0x1384('0x33'),'as':_0x1384('0x33'),'attributes':['id',_0x1384('0x4'),_0x1384('0x34'),_0x1384('0x35')]},{'model':_0x1384('0x36'),'as':'mandatoryDispositionPause','attributes':['id',_0x1384('0x4')]},{'model':_0x1384('0x33'),'as':_0x1384('0x37'),'attributes':['id',_0x1384('0x4'),_0x1384('0x34'),_0x1384('0x35')]},{'model':_0x1384('0x38'),'as':_0x1384('0x38'),'attributes':['id',_0x1384('0x4')],'include':[{'model':_0x1384('0x38'),'as':_0x1384('0x39'),'attributes':['id',_0x1384('0x4'),_0x1384('0x3a')]}]}]},'log':_0x1384('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d905190..426cd82 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(_0x291a0a,_0x4b3c78){var _0x593251=function(_0x1a3d38){while(--_0x1a3d38){_0x291a0a['push'](_0x291a0a['shift']());}};_0x593251(++_0x4b3c78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x1fa569,_0x3f0440){var _0x5c9730=function(_0x3504be){while(--_0x3504be){_0x1fa569['push'](_0x1fa569['shift']());}};_0x5c9730(++_0x3f0440);}(_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 0db57e8..8448d8d 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 _0x5e87=['getVoiceQueueRtPauses','Request','../client'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5e87,0x1df));var _0x75e8=function(_0x61a827,_0x18f437){_0x61a827=_0x61a827-0x0;var _0x18a0d3=_0x5e87[_0x61a827];return _0x18a0d3;};'use strict';var client=require(_0x75e8('0x0'));exports[_0x75e8('0x1')]=function(_0x3510f5){return function(){return client[_0x75e8('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x3510f5,'paused':!![]},'raw':!![]},'log':_0x75e8('0x1')});};}; \ No newline at end of file +var _0xc245=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc245,0x1e8));var _0x5c24=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc245[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x5c24('0x0'));exports[_0x5c24('0x1')]=function(_0xd6939f){return function(){return client[_0x5c24('0x2')](_0x5c24('0x3'),{'options':{'where':{'VoiceQueueId':_0xd6939f,'paused':!![]},'raw':!![]},'log':_0x5c24('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 38b9bfa..5350046 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(_0x2c6ae1,_0x4d27b0){var _0xee7d5b=function(_0x22c6e8){while(--_0x22c6e8){_0x2c6ae1['push'](_0x2c6ae1['shift']());}};_0xee7d5b(++_0x4d27b0);}(_0x7a54,0x106));var _0x47a5=function(_0x3f5303,_0x1e1090){_0x3f5303=_0x3f5303-0x0;var _0x28030e=_0x7a54[_0x3f5303];return _0x28030e;};'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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5500b7,_0x38eed6){var _0x47971a=function(_0x41a997){while(--_0x41a997){_0x5500b7['push'](_0x5500b7['shift']());}};_0x47971a(++_0x38eed6);}(_0x7a54,0x106));var _0x47a5=function(_0x89feef,_0xb77975){_0x89feef=_0x89feef-0x0;var _0x3772f3=_0x7a54[_0x89feef];return _0x3772f3;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index b93e1b0..87652b8 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 _0x4804=['transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','origtransferercalleridnum','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel'];(function(_0x34b245,_0xfe65b4){var _0x3a8984=function(_0x12c6a8){while(--_0x12c6a8){_0x34b245['push'](_0x34b245['shift']());}};_0x3a8984(++_0xfe65b4);}(_0x4804,0x135));var _0x4480=function(_0x105652,_0x3884ce){_0x105652=_0x105652-0x0;var _0x2d2667=_0x4804[_0x105652];return _0x2d2667;};'use strict';var client=require(_0x4480('0x0'));exports['transfers']={};exports[_0x4480('0x1')]=function(_0x15e0ab){return client['Request'](_0x4480('0x2'),{'body':{'result':_0x15e0ab[_0x4480('0x3')],'transfererchannel':_0x15e0ab[_0x4480('0x4')],'transferercalleridnum':_0x15e0ab[_0x4480('0x5')],'transferercalleridname':_0x15e0ab['transferercalleridname'],'transfererconnectedlinenum':_0x15e0ab['transfererconnectedlinenum'],'transfererconnectedlinename':_0x15e0ab[_0x4480('0x6')],'transfereraccountcode':_0x15e0ab[_0x4480('0x7')],'transferercontext':_0x15e0ab[_0x4480('0x8')],'transfererexten':_0x15e0ab['transfererexten'],'transfererlinkedid':_0x15e0ab[_0x4480('0x9')],'transfereechannel':_0x15e0ab[_0x4480('0xa')],'transfereecalleridnum':_0x15e0ab['transfereecalleridnum'],'transfereecalleridname':_0x15e0ab[_0x4480('0xb')],'transfereeconnectedlinenum':_0x15e0ab[_0x4480('0xc')],'transfereeconnectedlinename':_0x15e0ab[_0x4480('0xd')],'transfereeaccountcode':_0x15e0ab[_0x4480('0xe')],'transfereecontext':_0x15e0ab['transfereecontext'],'transfereeexten':_0x15e0ab['transfereeexten'],'transfereelinkedid':_0x15e0ab[_0x4480('0xf')],'isexternal':_0x15e0ab[_0x4480('0x10')],'context':_0x15e0ab[_0x4480('0x11')],'extension':_0x15e0ab[_0x4480('0x12')],'type':_0x4480('0x13')},'log':_0x4480('0x2')});};exports['attendedTransfer']=function(_0x48e614){return client['Request'](_0x4480('0x2'),{'body':{'result':_0x48e614[_0x4480('0x3')],'transfererchannel':_0x48e614['origtransfererchannel'],'transferercalleridnum':_0x48e614[_0x4480('0x14')],'transferercalleridname':_0x48e614['origtransferercalleridname'],'transfererconnectedlinenum':_0x48e614['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x48e614['secondtransfererconnectedlinename'],'transfereraccountcode':_0x48e614['origtransfereraccountcode'],'transferercontext':_0x48e614[_0x4480('0x15')],'transfererexten':_0x48e614[_0x4480('0x16')],'transfererlinkedid':_0x48e614['origtransfererlinkedid'],'transfereechannel':_0x48e614[_0x4480('0x17')],'transfereecalleridnum':_0x48e614[_0x4480('0x18')],'transfereecalleridname':_0x48e614[_0x4480('0x19')],'transfereeconnectedlinenum':_0x48e614['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x48e614['transfertargetconnectedlinename'],'transfereeaccountcode':_0x48e614[_0x4480('0x1a')],'transfereecontext':_0x48e614[_0x4480('0x1b')],'transfereeexten':_0x48e614['transfertargetexten'],'transfereelinkedid':_0x48e614[_0x4480('0x1c')],'isexternal':_0x48e614['isexternal'],'context':_0x48e614[_0x4480('0x1d')],'extension':_0x48e614[_0x4480('0x1e')],'type':_0x4480('0x1f')},'log':_0x4480('0x2')});}; \ No newline at end of file +var _0x31d1=['transfereeaccountcode','transfereeexten','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename'];(function(_0x52a9c5,_0x4f1309){var _0x174fdb=function(_0x2d013f){while(--_0x2d013f){_0x52a9c5['push'](_0x52a9c5['shift']());}};_0x174fdb(++_0x4f1309);}(_0x31d1,0xd9));var _0x131d=function(_0x32ebc9,_0x292d34){_0x32ebc9=_0x32ebc9-0x0;var _0x31524f=_0x31d1[_0x32ebc9];return _0x31524f;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x131d('0x0')]=function(_0x1b725b){return client[_0x131d('0x1')](_0x131d('0x2'),{'body':{'result':_0x1b725b[_0x131d('0x3')],'transfererchannel':_0x1b725b[_0x131d('0x4')],'transferercalleridnum':_0x1b725b['transferercalleridnum'],'transferercalleridname':_0x1b725b['transferercalleridname'],'transfererconnectedlinenum':_0x1b725b[_0x131d('0x5')],'transfererconnectedlinename':_0x1b725b[_0x131d('0x6')],'transfereraccountcode':_0x1b725b[_0x131d('0x7')],'transferercontext':_0x1b725b[_0x131d('0x8')],'transfererexten':_0x1b725b['transfererexten'],'transfererlinkedid':_0x1b725b['transfererlinkedid'],'transfereechannel':_0x1b725b[_0x131d('0x9')],'transfereecalleridnum':_0x1b725b[_0x131d('0xa')],'transfereecalleridname':_0x1b725b[_0x131d('0xb')],'transfereeconnectedlinenum':_0x1b725b[_0x131d('0xc')],'transfereeconnectedlinename':_0x1b725b[_0x131d('0xd')],'transfereeaccountcode':_0x1b725b[_0x131d('0xe')],'transfereecontext':_0x1b725b['transfereecontext'],'transfereeexten':_0x1b725b[_0x131d('0xf')],'transfereelinkedid':_0x1b725b['transfereelinkedid'],'isexternal':_0x1b725b[_0x131d('0x10')],'context':_0x1b725b[_0x131d('0x11')],'extension':_0x1b725b[_0x131d('0x12')],'type':'blind'},'log':_0x131d('0x2')});};exports[_0x131d('0x13')]=function(_0x2b5dc1){return client[_0x131d('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x2b5dc1['result'],'transfererchannel':_0x2b5dc1[_0x131d('0x14')],'transferercalleridnum':_0x2b5dc1['origtransferercalleridnum'],'transferercalleridname':_0x2b5dc1[_0x131d('0x15')],'transfererconnectedlinenum':_0x2b5dc1[_0x131d('0x16')],'transfererconnectedlinename':_0x2b5dc1['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2b5dc1['origtransfereraccountcode'],'transferercontext':_0x2b5dc1[_0x131d('0x17')],'transfererexten':_0x2b5dc1['secondtransfererexten'],'transfererlinkedid':_0x2b5dc1['origtransfererlinkedid'],'transfereechannel':_0x2b5dc1[_0x131d('0x18')],'transfereecalleridnum':_0x2b5dc1[_0x131d('0x19')],'transfereecalleridname':_0x2b5dc1[_0x131d('0x1a')],'transfereeconnectedlinenum':_0x2b5dc1[_0x131d('0x1b')],'transfereeconnectedlinename':_0x2b5dc1[_0x131d('0x1c')],'transfereeaccountcode':_0x2b5dc1[_0x131d('0x1d')],'transfereecontext':_0x2b5dc1[_0x131d('0x1e')],'transfereeexten':_0x2b5dc1[_0x131d('0x1f')],'transfereelinkedid':_0x2b5dc1[_0x131d('0x20')],'isexternal':_0x2b5dc1[_0x131d('0x10')],'context':_0x2b5dc1['origtransferercontext'],'extension':_0x2b5dc1['origtransfererexten'],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 3894ef9..ff38498 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 _0x277c=['username','ami\x20disconnected','pick','command','Command','Action','then','content','catch','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','isConnected','voicechannel','map','channels','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','resolve','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','outbound','type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','queueChannels','voicequeuechannelhangup','Hangup','Channel\x20doesn\x27t\x20exist','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','pause','error','asterisk','join','keys','module','action','Reload','message'];(function(_0x10f5c9,_0x59ef5e){var _0x3f792b=function(_0x3823b8){while(--_0x3823b8){_0x10f5c9['push'](_0x10f5c9['shift']());}};_0x3f792b(++_0x59ef5e);}(_0x277c,0x153));var _0xc277=function(_0x2b6855,_0x57808a){_0x2b6855=_0x2b6855-0x0;var _0x5a7dee=_0x277c[_0x2b6855];return _0x5a7dee;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var jayson=require(_0xc277('0x1'));var schema=require(_0xc277('0x2'));var moment=require(_0xc277('0x3'));var config=require(_0xc277('0x4'));var properties=require(_0xc277('0x5'));var ami=require(_0xc277('0x6'));var VoiceQueueSummary=require(_0xc277('0x7'));exports[_0xc277('0x8')]=function(_0x4f78ab,_0x4bfaeb,_0x1a6582){return new Promise(function(_0x5a4f03,_0x77e168){var _0x54d634={'QueuePause':function(_0x378158){return new Promise(function(_0x17a2fe){var _0x55be1f=util[_0xc277('0x9')](_0xc277('0xa'),_0xc277('0xb'),_0x378158[_0xc277('0xc')]);if(_0x4f78ab[_0xc277('0xd')]&&_0x4f78ab[_0xc277('0xd')][_0x55be1f]&&_0x4f78ab['timers'][_0x55be1f]['timer']){_0x4f78ab[_0xc277('0xd')][_0x55be1f][_0xc277('0xe')]();}if(_0x4f78ab[_0xc277('0xf')][_0x55be1f]){_0x4f78ab[_0xc277('0xf')][_0x55be1f]['updateStatusRealtime']({'statePause':_0x378158[_0xc277('0x10')]?!![]:![]});}_0x17a2fe({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0xb6b933){var _0x2bba87=this;return new Promise(function(_0x1850eb,_0x30ecc3){if(ami['isConnected']()==![]){return _0x30ecc3(_0x2bba87[_0xc277('0x11')](0x1f4,[config[_0xc277('0x12')]['ip'],config[_0xc277('0x12')]['username'],'ami\x20disconnected'][_0xc277('0x13')]('\x20')));}_0xb6b933=_['pick'](_0xb6b933,_[_0xc277('0x14')](properties['reload'][_0xc277('0x15')]));_0xb6b933[_0xc277('0x16')]=_0xc277('0x17');return ami['Action'](_0xb6b933)['then'](function(_0x44e243){_0x1850eb({'code':0xc8,'message':_0x44e243['message']});})['catch'](function(_0x1e1a9b){_0x30ecc3(_0x2bba87[_0xc277('0x11')](0x1f5,_0x1e1a9b[_0xc277('0x18')]));});});},'Command':function(_0x176dfb){var _0xe2b7c1=this;return new Promise(function(_0x355eee,_0x391cc3){if(ami['isConnected']()==![]){return _0x391cc3(_0xe2b7c1['error'](0x1f4,[config[_0xc277('0x12')]['ip'],config[_0xc277('0x12')][_0xc277('0x19')],_0xc277('0x1a')][_0xc277('0x13')]('\x20')));}_0x176dfb=_[_0xc277('0x1b')](_0x176dfb,_0xc277('0x1c'));_0x176dfb[_0xc277('0x16')]=_0xc277('0x1d');return ami[_0xc277('0x1e')](_0x176dfb)[_0xc277('0x1f')](function(_0x57a198){_0x355eee({'code':0xc8,'message':_0x57a198[_0xc277('0x20')]});})[_0xc277('0x21')](function(_0x54b2e1){_0x391cc3(_0xe2b7c1[_0xc277('0x11')](0x1f5,_0x54b2e1['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x48124d){var _0x3292ab=[];for(var _0x57b03 in _0x4f78ab[_0xc277('0x22')]){if(_0x4f78ab[_0xc277('0x22')][_0xc277('0x23')](_0x57b03)){var _0x3aa598=_0x4f78ab[_0xc277('0x22')][_0x57b03];var _0x9ad1c5=new VoiceQueueSummary(_0x3aa598);_0x3292ab[_0xc277('0x24')](_0x9ad1c5);}}_0x48124d({'count':_0x3292ab[_0xc277('0x25')],'rows':_0x3292ab});});},'UpdateVoiceQueue':function(_0x40d17a){return new Promise(function(_0x5e480e,_0x5f3933){var _0x31b6d4=_[_0xc277('0x26')](_0x4f78ab['voiceQueues'],{'id':parseInt(_0x40d17a['id'])});var _0x4efc1e=_[_0xc277('0x27')](_0x40d17a,['id']);if(_0x31b6d4){for(var _0x3bc773 in _0x4efc1e){if(typeof _0x4efc1e[_0x3bc773]!==_0xc277('0x28')&&typeof _0x31b6d4[_0x3bc773]!==_0xc277('0x28')){_0x31b6d4[_0x3bc773]=_0x4efc1e[_0x3bc773];}}_0x5e480e(_0x31b6d4);}else{_0x5f3933();}});},'VoiceChannels':function(){return new Promise(function(_0x3fc62f){var _0x484993=_[_0xc277('0x29')](_0x4f78ab['channels']);_0x3fc62f({'count':_0x484993[_0xc277('0x25')],'rows':_0x484993});});},'VoiceChannelMixMonitor':function(_0x74ff17){var _0x4348d9=this;return new Promise(function(_0x881e70,_0x5e9f22){if(ami[_0xc277('0x2a')]()==![]){return _0x5e9f22(_0x4348d9['error'](0x1f4,[config[_0xc277('0x12')]['ip'],config[_0xc277('0x12')][_0xc277('0x19')],_0xc277('0x1a')]['join']('\x20')));}var _0x278e56=schema(properties[_0xc277('0x2b')])['validate'](_0x74ff17);if(_0x278e56[_0xc277('0x25')]>0x0){return _0x5e9f22(_0x4348d9['error'](0x1f4,_[_0xc277('0x2c')](_0x278e56,_0xc277('0x18'))[_0xc277('0x13')](',\x20')));}var _0x2cc802=_[_0xc277('0x26')](_0x4f78ab[_0xc277('0x2d')],{'uniqueid':_0x74ff17[_0xc277('0x2e')]});if(_0x2cc802&&_0x2cc802[_0xc277('0x2f')]){var _0x39830d=util[_0xc277('0x9')](_0xc277('0x30'),_0x74ff17['filename']||_0x74ff17[_0xc277('0x2e')],_0x74ff17[_0xc277('0x9')]||_0xc277('0x31'));return ami['Action']({'action':_0xc277('0x32'),'channel':_0x2cc802[_0xc277('0x2f')],'file':_0x39830d,'options':_0xc277('0x33')})[_0xc277('0x1f')](function(_0x3522ee){var _0x5cfba7=_['find'](_0x2cc802[_0xc277('0x34')],{'filename':'/var/spool/asterisk/monitor/'+_0x39830d[_0xc277('0x35')]()});if(_[_0xc277('0x36')](_0x5cfba7)){_0x2cc802[_0xc277('0x34')][_0xc277('0x24')]({'filename':_0xc277('0x37')+_0x39830d[_0xc277('0x35')](),'createdAt':moment()[_0xc277('0x9')](_0xc277('0x38')),'mixmonitorid':_0x3522ee[_0xc277('0x39')],'status':_0xc277('0x3a')});}else{_0x5cfba7[_0xc277('0x39')]=_0x3522ee['mixmonitorid'];_0x5cfba7[_0xc277('0x3b')]=_0xc277('0x3a');}_0x881e70({'code':0xc8,'message':[_0x74ff17[_0xc277('0x2e')],'MixMonitor\x20Success',_0x3522ee[_0xc277('0x39')]][_0xc277('0x13')]('\x20'),'mixmonitorid':_0x3522ee['mixmonitorid']});})['catch'](function(_0x2d2e5f){_0x5e9f22(_0x4348d9[_0xc277('0x11')](0x1f5,[_0x74ff17[_0xc277('0x2e')],_0x2d2e5f[_0xc277('0x18')][_0xc277('0x35')]()][_0xc277('0x13')]('\x20')));});}else{return _0x5e9f22(_0x4348d9[_0xc277('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2561dd){var _0x450842=this;return new Promise(function(_0x142ca6,_0x5f4487){if(ami['isConnected']()==![]){return _0x5f4487(_0x450842['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xc277('0x19')],'ami\x20disconnected'][_0xc277('0x13')]('\x20')));}var _0x102ca3=schema(properties[_0xc277('0x2b')])['validate'](_0x2561dd);if(_0x102ca3[_0xc277('0x25')]>0x0){return _0x5f4487(_0x450842[_0xc277('0x11')](0x1f4,_[_0xc277('0x2c')](_0x102ca3,_0xc277('0x18'))['join'](',\x20')));}var _0x284630=_[_0xc277('0x26')](_0x4f78ab['channels'],{'uniqueid':_0x2561dd[_0xc277('0x2e')]});if(_0x284630){return Promise[_0xc277('0x3c')]()[_0xc277('0x1f')](function(){if(_0x284630[_0xc277('0x2f')]){return ami[_0xc277('0x1e')]({'action':_0xc277('0x3d'),'channel':_0x284630[_0xc277('0x2f')],'mixmonitorid':_0x2561dd[_0xc277('0x39')]})[_0xc277('0x21')](function(){});}})[_0xc277('0x1f')](function(){if(_0x284630[_0xc277('0x3e')]){return ami['Action']({'action':_0xc277('0x3d'),'channel':_0x284630[_0xc277('0x3e')],'mixmonitorid':_0x2561dd[_0xc277('0x39')]})[_0xc277('0x21')](function(){});}})['then'](function(){var _0x401684=_['find'](_0x284630[_0xc277('0x34')],{'mixmonitorid':_0x2561dd[_0xc277('0x39')]});if(_0x401684){_0x401684[_0xc277('0x3b')]=_0xc277('0x3f');}})[_0xc277('0x1f')](function(){var _0x57c759=util[_0xc277('0x9')](_0xc277('0x30'),_0x2561dd[_0xc277('0x40')]||_0x2561dd[_0xc277('0x2e')],_0x2561dd['format']||_0xc277('0x31'));var _0x9c910a=_[_0xc277('0x26')](_0x284630['monitors'],{'filename':_0xc277('0x37')+_0x57c759['toLowerCase']()});if(_0x9c910a){_0x9c910a[_0xc277('0x3b')]=_0xc277('0x3f');}})[_0xc277('0x1f')](function(){_0x142ca6({'code':0xc8,'message':[_0x2561dd[_0xc277('0x2e')],_0xc277('0x41')][_0xc277('0x13')]('\x20')});})[_0xc277('0x21')](function(_0x46c133){_0x5f4487(_0x450842[_0xc277('0x11')](0x1f5,[_0x2561dd[_0xc277('0x2e')],_0x46c133[_0xc277('0x18')][_0xc277('0x35')]()]['join']('\x20')));});}else{return _0x5f4487(_0x450842[_0xc277('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x42d16f){var _0x3cd5a1=this;return new Promise(function(_0x1900ca){var _0x33b032=_[_0xc277('0x29')](_0x4f78ab['queueChannels']);var _0x23726a={'count':_0x33b032[_0xc277('0x25')],'rows':_0x33b032};if(_0x42d16f&&_0x42d16f['type']){if(!['inbound',_0xc277('0x42')]['includes'](_0x42d16f[_0xc277('0x43')])){return _0x77e168(_0x3cd5a1[_0xc277('0x11')](0x190,_0xc277('0x44')));}var _0x3bcb7b=_[_0xc277('0x45')](_0x33b032,function(_0x4c7fe3){return _0x4c7fe3['type']===_0x42d16f[_0xc277('0x43')];});_0x23726a[_0xc277('0x46')]=_0x3bcb7b[_0xc277('0x25')];_0x23726a['rows']=_0x3bcb7b;}_0x1900ca(_0x23726a);});},'VoiceQueuesChannel':function(_0x1ec89b){var _0x5db8f6=this;return new Promise(function(_0x1709b7,_0x443fa4){var _0x364957=schema(properties['voicequeuechannel'])['validate'](_0x1ec89b);if(_0x364957['length']>0x0){return _0x443fa4(_0x5db8f6[_0xc277('0x11')](0x1f4,_[_0xc277('0x2c')](_0x364957,'message')['join'](',\x20')));}var _0x14b47c=_[_0xc277('0x26')](_0x4f78ab[_0xc277('0x47')],{'uniqueid':_0x1ec89b[_0xc277('0x2e')]});if(_0x14b47c){_0x1709b7(_0x14b47c);}else{return _0x443fa4(_0x5db8f6['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x531e15){var _0x1da618=this;return new Promise(function(_0x2cd384,_0x55b178){if(ami[_0xc277('0x2a')]()==![]){return _0x55b178(_0x1da618[_0xc277('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xc277('0x19')],_0xc277('0x1a')][_0xc277('0x13')]('\x20')));}var _0x10942d=schema(properties[_0xc277('0x48')])[_0xc277('0x2')](_0x531e15);if(_0x10942d[_0xc277('0x25')]>0x0){return _0x55b178(_0x1da618[_0xc277('0x11')](0x1f4,_['map'](_0x10942d,_0xc277('0x18'))['join'](',\x20')));}var _0x2c97f3=_[_0xc277('0x26')](_0x4f78ab['queueChannels'],{'uniqueid':_0x531e15['uniqueid']});if(_0x2c97f3&&_0x2c97f3[_0xc277('0x2f')]){return ami[_0xc277('0x1e')]({'action':_0xc277('0x49'),'channel':_0x2c97f3['channel']})['then'](function(_0xb406bf){_0x2cd384({'code':0xc8,'message':[_0x531e15[_0xc277('0x2e')],_0xb406bf[_0xc277('0x18')][_0xc277('0x35')]()][_0xc277('0x13')]('\x20')});})[_0xc277('0x21')](function(_0x5176af){_0x55b178(_0x1da618[_0xc277('0x11')](0x1f5,[_0x531e15[_0xc277('0x2e')],_0x5176af[_0xc277('0x18')][_0xc277('0x35')]()][_0xc277('0x13')]('\x20')));});}else{return _0x55b178(_0x1da618[_0xc277('0x11')](0x1f5,_0xc277('0x4a')));}});},'VoiceQueuesChannelRedirect':function(_0x15f81a){var _0x173cd2=this;return new Promise(function(_0x152032,_0x24d9ab){if(ami['isConnected']()==![]){return _0x24d9ab(_0x173cd2[_0xc277('0x11')](0x1f4,[config[_0xc277('0x12')]['ip'],config[_0xc277('0x12')][_0xc277('0x19')],'ami\x20disconnected'][_0xc277('0x13')]('\x20')));}var _0x2231e6=schema(properties[_0xc277('0x4b')])[_0xc277('0x2')](_0x15f81a);if(_0x2231e6[_0xc277('0x25')]>0x0){return _0x24d9ab(_0x173cd2[_0xc277('0x11')](0x1f4,_['map'](_0x2231e6,_0xc277('0x18'))['join'](',\x20')));}var _0xf11a35=_[_0xc277('0x26')](_0x4f78ab['queueChannels'],{'uniqueid':_0x15f81a['uniqueid']});if(_0xf11a35&&_0xf11a35[_0xc277('0x2f')]){return ami[_0xc277('0x1e')]({'action':'Redirect','channel':_0xf11a35[_0xc277('0x2f')],'exten':_0x15f81a[_0xc277('0x4c')],'context':_0x15f81a[_0xc277('0x4d')]||_0xf11a35[_0xc277('0x4d')],'priority':0x1})[_0xc277('0x1f')](function(_0x29ca6f){_0x152032({'code':0xc8,'message':[_0x15f81a[_0xc277('0x2e')],_0x29ca6f[_0xc277('0x18')][_0xc277('0x35')]()][_0xc277('0x13')]('\x20')});})['catch'](function(_0x57f570){_0x24d9ab(_0x173cd2[_0xc277('0x11')](0x1f5,[_0x15f81a[_0xc277('0x2e')],_0x57f570['message'][_0xc277('0x35')]()][_0xc277('0x13')]('\x20')));});}else{return _0x24d9ab(_0x173cd2[_0xc277('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2192ac){return new Promise(function(_0x137889){var _0x2abd4d=_[_0xc277('0x29')](_0x4f78ab['agents']);if(_0x2192ac&&_0x2192ac['id']){var _0x71d028=_[_0xc277('0x26')](_0x2abd4d,function(_0x1b2364){return _0x1b2364['id']===_0x2192ac['id'];});_0x137889(_0x71d028);}else{_0x137889({'count':_0x2abd4d['length'],'rows':_0x2abd4d});}});},'Telephones':function(){return new Promise(function(_0xa446e5){var _0x415039=_[_0xc277('0x29')](_0x4f78ab[_0xc277('0x4e')]);_0xa446e5({'count':_0x415039[_0xc277('0x25')],'rows':_0x415039});});},'Trunks':function(){return new Promise(function(_0x4f5041){var _0x2a81e7=_[_0xc277('0x29')](_0x4f78ab[_0xc277('0x4f')]);_0x4f5041({'count':_0x2a81e7[_0xc277('0x25')],'rows':_0x2a81e7});});},'OutboundChannels':function(){return new Promise(function(_0x43f6c4){var _0x172faa=_[_0xc277('0x29')](_0x4f78ab[_0xc277('0x50')]);_0x43f6c4({'count':_0x172faa[_0xc277('0x25')],'rows':_0x172faa});});},'Outbound':function(){return new Promise(function(_0x9d3918){_0x9d3918(_0x4f78ab[_0xc277('0x42')]);});},'Campaigns':function(){return new Promise(function(_0x1a5961){var _0x18e31b=_[_0xc277('0x29')](_0x4f78ab[_0xc277('0x51')]);_0x1a5961({'count':_0x18e31b['length'],'rows':_0x18e31b});});},'VoiceQueuesPreview':function(_0x14d520){var _0x53ce7d=this;return new Promise(function(_0x4c2a2a,_0x2ed76b){_0x4bfaeb['run'](_0x14d520['id'])[_0xc277('0x1f')](function(_0x5e2574){_0x4c2a2a({'code':0xc8,'message':_0x5e2574[_0xc277('0x18')]});})['catch'](function(_0x2fbb41){_0x2ed76b(_0x53ce7d[_0xc277('0x11')](0x1f4,_0x2fbb41[_0xc277('0x18')]));});});},'EventManager':function(_0x3ae5f4){var _0x40ce9b=this;return new Promise(function(_0xb359f2,_0x229d2b){if(!_0x3ae5f4[_0xc277('0x52')]){return _0x229d2b(_0x40ce9b[_0xc277('0x11')](0x1f4,_0xc277('0x53')));}ami[_0xc277('0x54')](_0xc277('0x55')+_0x3ae5f4[_0xc277('0x52')],_0x3ae5f4['message']);_0xb359f2({'code':0xc8,'message':_0x3ae5f4});});},'FaxAccounts':function(){return new Promise(function(_0x3e726b){var _0x3e0e3c=_['values'](_0x4f78ab[_0xc277('0x56')]);_0x3e726b({'count':_0x3e0e3c[_0xc277('0x25')],'rows':_0x3e0e3c});});},'SendFax':function(_0x30db50){var _0x401d40=this;return new Promise(function(_0x423959,_0x5e958d){_0x1a6582['send'](_0x30db50)[_0xc277('0x1f')](function(_0x4b51b6){_0x423959({'code':0xc8,'message':_0x4b51b6[_0xc277('0x18')]});})[_0xc277('0x21')](function(_0x581758){_0x5e958d(_0x401d40['error'](0x1f4,_0x581758[_0xc277('0x18')]));});});},'CheckAfterSend':function(_0x4098f3){var _0x4399a6=this;return new Promise(function(_0x3ebb38,_0x239111){_0x1a6582['checkAfterSend'](_0x4098f3)['then'](function(_0x5217dd){_0x3ebb38({'code':0xc8,'message':_0x5217dd['message']});})[_0xc277('0x21')](function(_0xe41415){_0x239111(_0x4399a6[_0xc277('0x11')](0x1f4,_0xe41415[_0xc277('0x18')]));});});}};var _0x4bbba1=jayson['server'](_0x54d634)[_0xc277('0x57')]();_0x4bbba1['on'](_0xc277('0x11'),function(_0x3c196a){return _0x77e168(_0x3c196a);});_0x4bbba1['listen'](0x232a,_0xc277('0x58'),function(){console[_0xc277('0x59')](_0xc277('0x5a'),0x232a);return _0x5a4f03('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xf2ca=['module','action','Reload','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','voicechannel','validate','map','uniqueid','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','Action','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','event','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','lodash','util','jayson/promise','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','SIP','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','reload'];(function(_0x48168a,_0xf9dfe5){var _0x346d98=function(_0x22e41f){while(--_0x22e41f){_0x48168a['push'](_0x48168a['shift']());}};_0x346d98(++_0xf9dfe5);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0xf2ca[_0x20845e];return _0x28cf2b;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var jayson=require(_0xaf2c('0x2'));var schema=require('validate');var moment=require(_0xaf2c('0x3'));var config=require(_0xaf2c('0x4'));var properties=require(_0xaf2c('0x5'));var ami=require(_0xaf2c('0x6'));var VoiceQueueSummary=require(_0xaf2c('0x7'));exports[_0xaf2c('0x8')]=function(_0x5b8c81,_0x1fd101,_0x100d17){return new Promise(function(_0x297740,_0x1f9531){var _0x58351f={'QueuePause':function(_0x37fedd){return new Promise(function(_0x3c0421){var _0x4a7397=util[_0xaf2c('0x9')]('%s/%s',_0xaf2c('0xa'),_0x37fedd['name']);if(_0x5b8c81[_0xaf2c('0xb')]&&_0x5b8c81[_0xaf2c('0xb')][_0x4a7397]&&_0x5b8c81[_0xaf2c('0xb')][_0x4a7397][_0xaf2c('0xc')]){_0x5b8c81['timers'][_0x4a7397]['updateAcw']();}if(_0x5b8c81[_0xaf2c('0xd')][_0x4a7397]){_0x5b8c81[_0xaf2c('0xd')][_0x4a7397][_0xaf2c('0xe')]({'statePause':_0x37fedd[_0xaf2c('0xf')]?!![]:![]});}_0x3c0421({'code':0xc8,'message':_0xaf2c('0x10')});});},'Reload':function(_0x59a59b){var _0x590126=this;return new Promise(function(_0x15ccb4,_0x8eaf9b){if(ami[_0xaf2c('0x11')]()==![]){return _0x8eaf9b(_0x590126[_0xaf2c('0x12')](0x1f4,[config[_0xaf2c('0x13')]['ip'],config[_0xaf2c('0x13')][_0xaf2c('0x14')],_0xaf2c('0x15')][_0xaf2c('0x16')]('\x20')));}_0x59a59b=_[_0xaf2c('0x17')](_0x59a59b,_[_0xaf2c('0x18')](properties[_0xaf2c('0x19')][_0xaf2c('0x1a')]));_0x59a59b[_0xaf2c('0x1b')]=_0xaf2c('0x1c');return ami['Action'](_0x59a59b)[_0xaf2c('0x1d')](function(_0x553163){_0x15ccb4({'code':0xc8,'message':_0x553163[_0xaf2c('0x1e')]});})[_0xaf2c('0x1f')](function(_0x1d544a){_0x8eaf9b(_0x590126['error'](0x1f5,_0x1d544a[_0xaf2c('0x1e')]));});});},'Command':function(_0x297bcd){var _0x1fec4c=this;return new Promise(function(_0x20000b,_0x3f977c){if(ami[_0xaf2c('0x11')]()==![]){return _0x3f977c(_0x1fec4c['error'](0x1f4,[config[_0xaf2c('0x13')]['ip'],config[_0xaf2c('0x13')][_0xaf2c('0x14')],_0xaf2c('0x15')][_0xaf2c('0x16')]('\x20')));}_0x297bcd=_['pick'](_0x297bcd,_0xaf2c('0x20'));_0x297bcd[_0xaf2c('0x1b')]=_0xaf2c('0x21');return ami['Action'](_0x297bcd)['then'](function(_0x29cbdf){_0x20000b({'code':0xc8,'message':_0x29cbdf[_0xaf2c('0x22')]});})[_0xaf2c('0x1f')](function(_0x99f78d){_0x3f977c(_0x1fec4c['error'](0x1f5,_0x99f78d[_0xaf2c('0x1e')]));});});},'VoiceQueues':function(){return new Promise(function(_0xf1a7cf){var _0x3a0145=[];for(var _0x3c1ae6 in _0x5b8c81[_0xaf2c('0x23')]){if(_0x5b8c81[_0xaf2c('0x23')][_0xaf2c('0x24')](_0x3c1ae6)){var _0x4a8dd8=_0x5b8c81[_0xaf2c('0x23')][_0x3c1ae6];var _0x2051be=new VoiceQueueSummary(_0x4a8dd8);_0x3a0145[_0xaf2c('0x25')](_0x2051be);}}_0xf1a7cf({'count':_0x3a0145[_0xaf2c('0x26')],'rows':_0x3a0145});});},'UpdateVoiceQueue':function(_0x4b7cf2){return new Promise(function(_0x3fb190,_0x589d47){var _0x38db1b=_[_0xaf2c('0x27')](_0x5b8c81[_0xaf2c('0x23')],{'id':parseInt(_0x4b7cf2['id'])});var _0x5d685a=_[_0xaf2c('0x28')](_0x4b7cf2,['id']);if(_0x38db1b){for(var _0x2ea490 in _0x5d685a){if(typeof _0x5d685a[_0x2ea490]!==_0xaf2c('0x29')&&typeof _0x38db1b[_0x2ea490]!=='undefined'){_0x38db1b[_0x2ea490]=_0x5d685a[_0x2ea490];}}_0x3fb190(_0x38db1b);}else{_0x589d47();}});},'VoiceChannels':function(){return new Promise(function(_0xe18ba7){var _0x32d95c=_[_0xaf2c('0x2a')](_0x5b8c81[_0xaf2c('0x2b')]);_0xe18ba7({'count':_0x32d95c['length'],'rows':_0x32d95c});});},'VoiceChannelMixMonitor':function(_0x3da072){var _0x4072ff=this;return new Promise(function(_0x1be1ef,_0x51a49c){if(ami['isConnected']()==![]){return _0x51a49c(_0x4072ff[_0xaf2c('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xaf2c('0x13')]['username'],_0xaf2c('0x15')][_0xaf2c('0x16')]('\x20')));}var _0x4ffbb9=schema(properties[_0xaf2c('0x2c')])[_0xaf2c('0x2d')](_0x3da072);if(_0x4ffbb9['length']>0x0){return _0x51a49c(_0x4072ff[_0xaf2c('0x12')](0x1f4,_[_0xaf2c('0x2e')](_0x4ffbb9,_0xaf2c('0x1e'))[_0xaf2c('0x16')](',\x20')));}var _0x2d6ed7=_[_0xaf2c('0x27')](_0x5b8c81['channels'],{'uniqueid':_0x3da072[_0xaf2c('0x2f')]});if(_0x2d6ed7&&_0x2d6ed7['channel']){var _0x321f7c=util['format'](_0xaf2c('0x30'),_0x3da072['filename']||_0x3da072[_0xaf2c('0x2f')],_0x3da072['format']||_0xaf2c('0x31'));return ami['Action']({'action':_0xaf2c('0x32'),'channel':_0x2d6ed7[_0xaf2c('0x33')],'file':_0x321f7c,'options':_0xaf2c('0x34')})[_0xaf2c('0x1d')](function(_0x470aff){var _0x598adb=_['find'](_0x2d6ed7[_0xaf2c('0x35')],{'filename':_0xaf2c('0x36')+_0x321f7c[_0xaf2c('0x37')]()});if(_[_0xaf2c('0x38')](_0x598adb)){_0x2d6ed7[_0xaf2c('0x35')][_0xaf2c('0x25')]({'filename':'/var/spool/asterisk/monitor/'+_0x321f7c[_0xaf2c('0x37')](),'createdAt':moment()[_0xaf2c('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x470aff[_0xaf2c('0x39')],'status':_0xaf2c('0x3a')});}else{_0x598adb[_0xaf2c('0x39')]=_0x470aff[_0xaf2c('0x39')];_0x598adb[_0xaf2c('0x3b')]=_0xaf2c('0x3a');}_0x1be1ef({'code':0xc8,'message':[_0x3da072[_0xaf2c('0x2f')],_0xaf2c('0x3c'),_0x470aff[_0xaf2c('0x39')]][_0xaf2c('0x16')]('\x20'),'mixmonitorid':_0x470aff[_0xaf2c('0x39')]});})[_0xaf2c('0x1f')](function(_0xaba85d){_0x51a49c(_0x4072ff['error'](0x1f5,[_0x3da072['uniqueid'],_0xaba85d['message'][_0xaf2c('0x37')]()][_0xaf2c('0x16')]('\x20')));});}else{return _0x51a49c(_0x4072ff[_0xaf2c('0x12')](0x1f5,_0xaf2c('0x3d')));}});},'VoiceChannelStopMixMonitor':function(_0x715f39){var _0x29460c=this;return new Promise(function(_0x51c441,_0x1d58bd){if(ami[_0xaf2c('0x11')]()==![]){return _0x1d58bd(_0x29460c[_0xaf2c('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xaf2c('0x14')],'ami\x20disconnected'][_0xaf2c('0x16')]('\x20')));}var _0x25ba26=schema(properties[_0xaf2c('0x2c')])[_0xaf2c('0x2d')](_0x715f39);if(_0x25ba26['length']>0x0){return _0x1d58bd(_0x29460c[_0xaf2c('0x12')](0x1f4,_['map'](_0x25ba26,_0xaf2c('0x1e'))[_0xaf2c('0x16')](',\x20')));}var _0x58bd9b=_[_0xaf2c('0x27')](_0x5b8c81['channels'],{'uniqueid':_0x715f39[_0xaf2c('0x2f')]});if(_0x58bd9b){return Promise[_0xaf2c('0x3e')]()[_0xaf2c('0x1d')](function(){if(_0x58bd9b[_0xaf2c('0x33')]){return ami[_0xaf2c('0x3f')]({'action':_0xaf2c('0x40'),'channel':_0x58bd9b[_0xaf2c('0x33')],'mixmonitorid':_0x715f39[_0xaf2c('0x39')]})[_0xaf2c('0x1f')](function(){});}})['then'](function(){if(_0x58bd9b['destinationchannel']){return ami[_0xaf2c('0x3f')]({'action':'StopMixMonitor','channel':_0x58bd9b['destinationchannel'],'mixmonitorid':_0x715f39['mixmonitorid']})[_0xaf2c('0x1f')](function(){});}})[_0xaf2c('0x1d')](function(){var _0x3cabd4=_[_0xaf2c('0x27')](_0x58bd9b['monitors'],{'mixmonitorid':_0x715f39[_0xaf2c('0x39')]});if(_0x3cabd4){_0x3cabd4['status']=_0xaf2c('0x41');}})['then'](function(){var _0x166c26=util[_0xaf2c('0x9')](_0xaf2c('0x30'),_0x715f39[_0xaf2c('0x42')]||_0x715f39[_0xaf2c('0x2f')],_0x715f39['format']||_0xaf2c('0x31'));var _0x26afee=_['find'](_0x58bd9b['monitors'],{'filename':_0xaf2c('0x36')+_0x166c26['toLowerCase']()});if(_0x26afee){_0x26afee[_0xaf2c('0x3b')]=_0xaf2c('0x41');}})[_0xaf2c('0x1d')](function(){_0x51c441({'code':0xc8,'message':[_0x715f39[_0xaf2c('0x2f')],_0xaf2c('0x43')][_0xaf2c('0x16')]('\x20')});})[_0xaf2c('0x1f')](function(_0x4473c9){_0x1d58bd(_0x29460c[_0xaf2c('0x12')](0x1f5,[_0x715f39[_0xaf2c('0x2f')],_0x4473c9[_0xaf2c('0x1e')]['toLowerCase']()][_0xaf2c('0x16')]('\x20')));});}else{return _0x1d58bd(_0x29460c[_0xaf2c('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5175f8){var _0x56d7ce=this;return new Promise(function(_0x7ddca0){var _0x1f6907=_['values'](_0x5b8c81[_0xaf2c('0x44')]);var _0x2893c4={'count':_0x1f6907[_0xaf2c('0x26')],'rows':_0x1f6907};if(_0x5175f8&&_0x5175f8[_0xaf2c('0x45')]){if(![_0xaf2c('0x46'),_0xaf2c('0x47')][_0xaf2c('0x48')](_0x5175f8['type'])){return _0x1f9531(_0x56d7ce[_0xaf2c('0x12')](0x190,_0xaf2c('0x49')));}var _0x5771e5=_[_0xaf2c('0x4a')](_0x1f6907,function(_0x61442d){return _0x61442d[_0xaf2c('0x45')]===_0x5175f8[_0xaf2c('0x45')];});_0x2893c4[_0xaf2c('0x4b')]=_0x5771e5[_0xaf2c('0x26')];_0x2893c4[_0xaf2c('0x4c')]=_0x5771e5;}_0x7ddca0(_0x2893c4);});},'VoiceQueuesChannel':function(_0x15a335){var _0x19b82d=this;return new Promise(function(_0x300254,_0x133678){var _0x10a270=schema(properties[_0xaf2c('0x4d')])[_0xaf2c('0x2d')](_0x15a335);if(_0x10a270[_0xaf2c('0x26')]>0x0){return _0x133678(_0x19b82d[_0xaf2c('0x12')](0x1f4,_[_0xaf2c('0x2e')](_0x10a270,_0xaf2c('0x1e'))[_0xaf2c('0x16')](',\x20')));}var _0x23bf95=_['find'](_0x5b8c81[_0xaf2c('0x44')],{'uniqueid':_0x15a335[_0xaf2c('0x2f')]});if(_0x23bf95){_0x300254(_0x23bf95);}else{return _0x133678(_0x19b82d[_0xaf2c('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x22af48){var _0x5ed624=this;return new Promise(function(_0xc46f29,_0x2bce19){if(ami[_0xaf2c('0x11')]()==![]){return _0x2bce19(_0x5ed624[_0xaf2c('0x12')](0x1f4,[config[_0xaf2c('0x13')]['ip'],config[_0xaf2c('0x13')][_0xaf2c('0x14')],_0xaf2c('0x15')][_0xaf2c('0x16')]('\x20')));}var _0x580c2d=schema(properties[_0xaf2c('0x4e')])[_0xaf2c('0x2d')](_0x22af48);if(_0x580c2d[_0xaf2c('0x26')]>0x0){return _0x2bce19(_0x5ed624[_0xaf2c('0x12')](0x1f4,_[_0xaf2c('0x2e')](_0x580c2d,'message')[_0xaf2c('0x16')](',\x20')));}var _0x30dfeb=_['find'](_0x5b8c81[_0xaf2c('0x44')],{'uniqueid':_0x22af48[_0xaf2c('0x2f')]});if(_0x30dfeb&&_0x30dfeb['channel']){return ami['Action']({'action':_0xaf2c('0x4f'),'channel':_0x30dfeb[_0xaf2c('0x33')]})[_0xaf2c('0x1d')](function(_0x39c5d2){_0xc46f29({'code':0xc8,'message':[_0x22af48['uniqueid'],_0x39c5d2[_0xaf2c('0x1e')][_0xaf2c('0x37')]()]['join']('\x20')});})[_0xaf2c('0x1f')](function(_0x486b5a){_0x2bce19(_0x5ed624[_0xaf2c('0x12')](0x1f5,[_0x22af48[_0xaf2c('0x2f')],_0x486b5a[_0xaf2c('0x1e')][_0xaf2c('0x37')]()][_0xaf2c('0x16')]('\x20')));});}else{return _0x2bce19(_0x5ed624[_0xaf2c('0x12')](0x1f5,_0xaf2c('0x3d')));}});},'VoiceQueuesChannelRedirect':function(_0x25bdaa){var _0x1520ec=this;return new Promise(function(_0xc27601,_0x53ba41){if(ami[_0xaf2c('0x11')]()==![]){return _0x53ba41(_0x1520ec[_0xaf2c('0x12')](0x1f4,[config[_0xaf2c('0x13')]['ip'],config[_0xaf2c('0x13')][_0xaf2c('0x14')],'ami\x20disconnected'][_0xaf2c('0x16')]('\x20')));}var _0x28b09f=schema(properties[_0xaf2c('0x50')])[_0xaf2c('0x2d')](_0x25bdaa);if(_0x28b09f[_0xaf2c('0x26')]>0x0){return _0x53ba41(_0x1520ec['error'](0x1f4,_['map'](_0x28b09f,_0xaf2c('0x1e'))[_0xaf2c('0x16')](',\x20')));}var _0x5849f8=_[_0xaf2c('0x27')](_0x5b8c81[_0xaf2c('0x44')],{'uniqueid':_0x25bdaa[_0xaf2c('0x2f')]});if(_0x5849f8&&_0x5849f8['channel']){return ami[_0xaf2c('0x3f')]({'action':_0xaf2c('0x51'),'channel':_0x5849f8[_0xaf2c('0x33')],'exten':_0x25bdaa[_0xaf2c('0x52')],'context':_0x25bdaa['context']||_0x5849f8[_0xaf2c('0x53')],'priority':0x1})[_0xaf2c('0x1d')](function(_0x296c6b){_0xc27601({'code':0xc8,'message':[_0x25bdaa[_0xaf2c('0x2f')],_0x296c6b[_0xaf2c('0x1e')][_0xaf2c('0x37')]()][_0xaf2c('0x16')]('\x20')});})[_0xaf2c('0x1f')](function(_0x349dbb){_0x53ba41(_0x1520ec[_0xaf2c('0x12')](0x1f5,[_0x25bdaa[_0xaf2c('0x2f')],_0x349dbb['message'][_0xaf2c('0x37')]()]['join']('\x20')));});}else{return _0x53ba41(_0x1520ec[_0xaf2c('0x12')](0x1f5,_0xaf2c('0x3d')));}});},'Agents':function(_0x4e227a){return new Promise(function(_0x1b377c){var _0x5a95ac=_['values'](_0x5b8c81[_0xaf2c('0xd')]);if(_0x4e227a&&_0x4e227a['id']){var _0x1d73ef=_[_0xaf2c('0x27')](_0x5a95ac,function(_0x47c464){return _0x47c464['id']===_0x4e227a['id'];});_0x1b377c(_0x1d73ef);}else{_0x1b377c({'count':_0x5a95ac['length'],'rows':_0x5a95ac});}});},'Telephones':function(){return new Promise(function(_0x5a4716){var _0x103393=_[_0xaf2c('0x2a')](_0x5b8c81['telephones']);_0x5a4716({'count':_0x103393[_0xaf2c('0x26')],'rows':_0x103393});});},'Trunks':function(){return new Promise(function(_0x14931a){var _0x3700b8=_[_0xaf2c('0x2a')](_0x5b8c81[_0xaf2c('0x54')]);_0x14931a({'count':_0x3700b8[_0xaf2c('0x26')],'rows':_0x3700b8});});},'OutboundChannels':function(){return new Promise(function(_0x4be47b){var _0x4779a2=_[_0xaf2c('0x2a')](_0x5b8c81[_0xaf2c('0x55')]);_0x4be47b({'count':_0x4779a2['length'],'rows':_0x4779a2});});},'Outbound':function(){return new Promise(function(_0xc9dd21){_0xc9dd21(_0x5b8c81[_0xaf2c('0x47')]);});},'Campaigns':function(){return new Promise(function(_0x37ee02){var _0x577eaa=_[_0xaf2c('0x2a')](_0x5b8c81[_0xaf2c('0x56')]);_0x37ee02({'count':_0x577eaa[_0xaf2c('0x26')],'rows':_0x577eaa});});},'VoiceQueuesPreview':function(_0x5f705){var _0x491160=this;return new Promise(function(_0x286a40,_0x309532){_0x1fd101[_0xaf2c('0x57')](_0x5f705['id'])['then'](function(_0x5d0de0){_0x286a40({'code':0xc8,'message':_0x5d0de0[_0xaf2c('0x1e')]});})[_0xaf2c('0x1f')](function(_0x5571eb){_0x309532(_0x491160[_0xaf2c('0x12')](0x1f4,_0x5571eb[_0xaf2c('0x1e')]));});});},'EventManager':function(_0x5365fa){var _0x41e739=this;return new Promise(function(_0x31cf3e,_0x36e6a2){if(!_0x5365fa[_0xaf2c('0x58')]){return _0x36e6a2(_0x41e739[_0xaf2c('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0xaf2c('0x59')+_0x5365fa[_0xaf2c('0x58')],_0x5365fa[_0xaf2c('0x1e')]);_0x31cf3e({'code':0xc8,'message':_0x5365fa});});},'FaxAccounts':function(){return new Promise(function(_0x4f378e){var _0xca027d=_[_0xaf2c('0x2a')](_0x5b8c81[_0xaf2c('0x5a')]);_0x4f378e({'count':_0xca027d[_0xaf2c('0x26')],'rows':_0xca027d});});},'SendFax':function(_0x39ddec){var _0x4b9fdc=this;return new Promise(function(_0x2da0ce,_0x21e494){_0x100d17[_0xaf2c('0x5b')](_0x39ddec)[_0xaf2c('0x1d')](function(_0x346060){_0x2da0ce({'code':0xc8,'message':_0x346060[_0xaf2c('0x1e')]});})['catch'](function(_0xd26d9a){_0x21e494(_0x4b9fdc[_0xaf2c('0x12')](0x1f4,_0xd26d9a['message']));});});},'CheckAfterSend':function(_0x5beb89){var _0x493e84=this;return new Promise(function(_0x2c4a8f,_0x1044ca){_0x100d17[_0xaf2c('0x5c')](_0x5beb89)[_0xaf2c('0x1d')](function(_0x499bbe){_0x2c4a8f({'code':0xc8,'message':_0x499bbe[_0xaf2c('0x1e')]});})[_0xaf2c('0x1f')](function(_0x2b57d2){_0x1044ca(_0x493e84[_0xaf2c('0x12')](0x1f4,_0x2b57d2['message']));});});}};var _0x1e8fc0=jayson[_0xaf2c('0x5d')](_0x58351f)[_0xaf2c('0x5e')]();_0x1e8fc0['on'](_0xaf2c('0x12'),function(_0x1c7e15){return _0x1f9531(_0x1c7e15);});_0x1e8fc0['listen'](0x232a,_0xaf2c('0x5f'),function(){console[_0xaf2c('0x60')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x297740('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 2d9b1d9..b58df28 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 _0x230f=['toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','updatedAt','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','routeId','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','','format','user:%s','name','trigger:%s'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x230f,0x68));var _0xf230=function(_0x50439d,_0x3aed4c){_0x50439d=_0x50439d-0x0;var _0x5dc279=_0x230f[_0x50439d];return _0x5dc279;};'use strict';var _=require(_0xf230('0x0'));var BPromise=require(_0xf230('0x1'));var Redis=require(_0xf230('0x2'));var util=require(_0xf230('0x3'));var config=require('../../../../config/environment');var logger=require(_0xf230('0x4'))(_0xf230('0x5'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0xf230('0x6')](config[_0xf230('0x7')],{'host':_0xf230('0x8'),'port':0x18eb});var io=require(_0xf230('0x9'))(new Redis(config[_0xf230('0x7')]));function emit(_0x188727,_0x3c5801,_0x1bcca4,_0x1ff7c4,_0x13c282){logger[_0xf230('0xa')](_0xf230('0xb'),_0x188727,_0x3c5801['id'],_0x1bcca4,_0x1ff7c4,JSON['stringify'](_0x13c282));io['to'](_0x1bcca4)[_0xf230('0xc')](_0x1ff7c4,_0x13c282);}exports['exec']=function(_0x4fea8c,_0x133505,_0x5c0a61,_0x469b9c){var _0x3a0481,_0x4aba0c;var _0xc6ff7d={};var _0x527de5;var _0x33963c=Number(_0x5c0a61['data1']);var _0x545918=_0x5c0a61[_0xf230('0xd')]?Boolean(Number(_0x5c0a61['data2'])):![];var _0x2f9811;var _0x125989=![];if(!_[_0xf230('0xe')](_0x5c0a61['data5'])){if(_0x5c0a61[_0xf230('0xf')]=='1')_0x125989=!![];}if(!_0x125989){if(_0x469b9c['xmd-contactid']){_0xc6ff7d['id']=_0x469b9c[_0xf230('0x10')];}}if(!_0xc6ff7d['id']){_0xc6ff7d[_0xf230('0x11')]=_0x33963c;_0x2f9811=_0x5c0a61[_0xf230('0x12')]&&_0x5c0a61[_0xf230('0x12')]!=='0'?_0x5c0a61[_0xf230('0x12')][_0xf230('0x13')](','):[_0xf230('0x14')];_0xc6ff7d[_0xf230('0x15')]=_[_0xf230('0x16')](_0x2f9811,function(_0x114d53){var _0x54d700={};_0x54d700[_0x114d53]=_0x469b9c['routeId']?_0x469b9c[_0xf230('0x17')]:_0x469b9c[_0xf230('0x18')];return _0x54d700;});_0x527de5=_0x469b9c['routeId']?_0x469b9c[_0xf230('0x17')]:_0x469b9c[_0xf230('0x18')];}var _0x3e21eb=['id',_0xf230('0x19'),_0xf230('0x1a'),_0xf230('0x14'),'mobile','fax',_0xf230('0x11'),'createdAt','scheduledAt',_0xf230('0x1b')];var _0x538325=_['union'](_0x3e21eb,_0x2f9811);BPromise[_0xf230('0x1c')]()[_0xf230('0x1d')](cmContactRpc[_0xf230('0x1e')]({'attributes':_0x538325,'where':_0xc6ff7d,'phone':_0x527de5}))[_0xf230('0x1d')](function(_0x15f5f6){_0x4aba0c=_0x15f5f6;if(!_['isEmpty'](_0x4aba0c)){if(_0x4aba0c[_0xf230('0x1f')]===0x1){_0x3a0481=_0x4aba0c[0x0];logger[_0xf230('0xa')](_0xf230('0x20'),_0x469b9c[_0xf230('0x21')],_0x133505['id'],_0x3a0481['id']);}else{logger[_0xf230('0xa')](_0xf230('0x22'),_0x469b9c[_0xf230('0x21')],_0x133505['id'],_[_0xf230('0x16')](_0x4aba0c,'id')[_0xf230('0x23')](','));}return;}else{logger[_0xf230('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x469b9c[_0xf230('0x21')],_0x133505['id']);var _0x494f4b={'ListId':_0x33963c};var _0x1f832c=_0x5c0a61['data4']&&_0x5c0a61[_0xf230('0x24')]!=='0'?_0x5c0a61['data4']:_0xf230('0x14');if(_0x545918){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x469b9c[_0xf230('0x21')],_0x133505['id']);_0x494f4b[_0x1f832c]=_[_0xf230('0xe')](_0x469b9c[_0xf230('0x25')])?_0x469b9c[_0xf230('0x18')]:_0x469b9c[_0xf230('0x17')];if(_[_0xf230('0xe')](_0x469b9c[_0xf230('0x25')])){_0x494f4b[_0xf230('0x19')]=_0x469b9c[_0xf230('0x26')]&&_0x469b9c[_0xf230('0x26')]!==''?_0x469b9c[_0xf230('0x26')]:_0xf230('0x27');}else{_0x494f4b[_0xf230('0x19')]=_0x469b9c[_0xf230('0x28')]&&_0x469b9c[_0xf230('0x28')]!==''?_0x469b9c[_0xf230('0x28')]:'Unknown';}return BPromise['resolve']()[_0xf230('0x1d')](cmContactRpc[_0xf230('0x29')](_0x494f4b))[_0xf230('0x1d')](function(_0x35ff05){_0x3a0481=_0x35ff05;_0x4aba0c[_0xf230('0x2a')](_0x35ff05);if(_0x3a0481){logger[_0xf230('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x469b9c[_0xf230('0x21')],_0x133505['id'],_0x3a0481['id']);}return;});}else{logger[_0xf230('0xa')](_0xf230('0x2b'),_0x469b9c[_0xf230('0x21')],_0x133505['id']);_0x494f4b[_0x1f832c]=_[_0xf230('0xe')](_0x469b9c[_0xf230('0x25')])?_0x469b9c['calleridnum']:_0x469b9c[_0xf230('0x17')];if(_[_0xf230('0xe')](_0x469b9c[_0xf230('0x25')])){_0x494f4b[_0xf230('0x19')]=_0x469b9c[_0xf230('0x26')]&&_0x469b9c['calleridname']!==_0xf230('0x2c')?_0x469b9c[_0xf230('0x26')]:'Unknown';}else{_0x494f4b['firstName']=_0x469b9c[_0xf230('0x28')]&&_0x469b9c[_0xf230('0x28')]!==_0xf230('0x2c')?_0x469b9c[_0xf230('0x28')]:_0xf230('0x27');}_0x3a0481=_0x494f4b;_0x4aba0c[_0xf230('0x2a')](_0x494f4b);return;}}})[_0xf230('0x1d')](function(){if(_0x4fea8c){emit(_0x469b9c['uniqueid'],_0x133505,util[_0xf230('0x2d')](_0xf230('0x2e'),_0x4fea8c[_0xf230('0x2f')]),util[_0xf230('0x2d')](_0xf230('0x30'),_0x5c0a61['action'][_0xf230('0x31')]()),{'evt':_[_0xf230('0x32')](_0x469b9c,{'autoCreate':_0x545918}),'contact':_0x3a0481===undefined?{}:_0x3a0481,'contacts':_0x4aba0c[_0xf230('0x1f')]===0x0?undefined:_0x4aba0c});}});}; \ No newline at end of file +var _0x0d94=['merge','bluebird','ioredis','../../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','calleridnum','routeId','destcalleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','destcalleridname','Unknown','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','action','toLowerCase'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x0d94,0x11e));var _0x40d9=function(_0xa94a3e,_0x55e44e){_0xa94a3e=_0xa94a3e-0x0;var _0x5ba01e=_0x0d94[_0xa94a3e];return _0x5ba01e;};'use strict';var _=require('lodash');var BPromise=require(_0x40d9('0x0'));var Redis=require(_0x40d9('0x1'));var util=require('util');var config=require(_0x40d9('0x2'));var logger=require('../../../../config/logger')(_0x40d9('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0x40d9('0x4')]=_[_0x40d9('0x5')](config['redis'],{'host':_0x40d9('0x6'),'port':0x18eb});var io=require(_0x40d9('0x7'))(new Redis(config[_0x40d9('0x4')]));function emit(_0x2d01be,_0x5728ad,_0x3b270a,_0x2081a8,_0x4fc2ff){logger[_0x40d9('0x8')](_0x40d9('0x9'),_0x2d01be,_0x5728ad['id'],_0x3b270a,_0x2081a8,JSON[_0x40d9('0xa')](_0x4fc2ff));io['to'](_0x3b270a)[_0x40d9('0xb')](_0x2081a8,_0x4fc2ff);}exports['exec']=function(_0x5cb49f,_0x45acda,_0x5eb060,_0x41c28c){var _0x4186e4,_0x39438c;var _0x5d450e={};var _0xfdcdbe;var _0x29a7bf=Number(_0x5eb060[_0x40d9('0xc')]);var _0x1f203f=_0x5eb060['data2']?Boolean(Number(_0x5eb060[_0x40d9('0xd')])):![];var _0x9618c4;var _0x28f3db=![];if(!_[_0x40d9('0xe')](_0x5eb060[_0x40d9('0xf')])){if(_0x5eb060[_0x40d9('0xf')]=='1')_0x28f3db=!![];}if(!_0x28f3db){if(_0x41c28c[_0x40d9('0x10')]){_0x5d450e['id']=_0x41c28c[_0x40d9('0x10')];}}if(!_0x5d450e['id']){_0x5d450e[_0x40d9('0x11')]=_0x29a7bf;_0x9618c4=_0x5eb060['data3']&&_0x5eb060[_0x40d9('0x12')]!=='0'?_0x5eb060[_0x40d9('0x12')][_0x40d9('0x13')](','):[_0x40d9('0x14')];_0x5d450e[_0x40d9('0x15')]=_[_0x40d9('0x16')](_0x9618c4,function(_0x1eca6f){var _0x5a4abd={};_0x5a4abd[_0x1eca6f]=_0x41c28c['routeId']?_0x41c28c['destcalleridnum']:_0x41c28c[_0x40d9('0x17')];return _0x5a4abd;});_0xfdcdbe=_0x41c28c[_0x40d9('0x18')]?_0x41c28c[_0x40d9('0x19')]:_0x41c28c['calleridnum'];}var _0x55e762=['id','firstName',_0x40d9('0x1a'),'phone',_0x40d9('0x1b'),_0x40d9('0x1c'),_0x40d9('0x11'),_0x40d9('0x1d'),_0x40d9('0x1e'),_0x40d9('0x1f')];var _0x270c4d=_['union'](_0x55e762,_0x9618c4);BPromise[_0x40d9('0x20')]()[_0x40d9('0x21')](cmContactRpc['getContacts']({'attributes':_0x270c4d,'where':_0x5d450e,'phone':_0xfdcdbe}))[_0x40d9('0x21')](function(_0x5a34c7){_0x39438c=_0x5a34c7;if(!_[_0x40d9('0x22')](_0x39438c)){if(_0x39438c[_0x40d9('0x23')]===0x1){_0x4186e4=_0x39438c[0x0];logger[_0x40d9('0x8')](_0x40d9('0x24'),_0x41c28c[_0x40d9('0x25')],_0x45acda['id'],_0x4186e4['id']);}else{logger[_0x40d9('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x41c28c['uniqueid'],_0x45acda['id'],_[_0x40d9('0x16')](_0x39438c,'id')['join'](','));}return;}else{logger['info'](_0x40d9('0x26'),_0x41c28c[_0x40d9('0x25')],_0x45acda['id']);var _0x159c8f={'ListId':_0x29a7bf};var _0x509d15=_0x5eb060[_0x40d9('0x27')]&&_0x5eb060[_0x40d9('0x27')]!=='0'?_0x5eb060['data4']:_0x40d9('0x14');if(_0x1f203f){logger[_0x40d9('0x8')](_0x40d9('0x28'),_0x41c28c[_0x40d9('0x25')],_0x45acda['id']);_0x159c8f[_0x509d15]=_[_0x40d9('0xe')](_0x41c28c[_0x40d9('0x18')])?_0x41c28c[_0x40d9('0x17')]:_0x41c28c[_0x40d9('0x19')];if(_[_0x40d9('0xe')](_0x41c28c[_0x40d9('0x18')])){_0x159c8f[_0x40d9('0x29')]=_0x41c28c[_0x40d9('0x2a')]&&_0x41c28c[_0x40d9('0x2a')]!==_0x40d9('0x2b')?_0x41c28c[_0x40d9('0x2a')]:'Unknown';}else{_0x159c8f[_0x40d9('0x29')]=_0x41c28c[_0x40d9('0x2c')]&&_0x41c28c[_0x40d9('0x2c')]!==''?_0x41c28c['destcalleridname']:_0x40d9('0x2d');}return BPromise[_0x40d9('0x20')]()[_0x40d9('0x21')](cmContactRpc[_0x40d9('0x2e')](_0x159c8f))['then'](function(_0x1e04cb){_0x4186e4=_0x1e04cb;_0x39438c['push'](_0x1e04cb);if(_0x4186e4){logger['info'](_0x40d9('0x2f'),_0x41c28c[_0x40d9('0x25')],_0x45acda['id'],_0x4186e4['id']);}return;});}else{logger[_0x40d9('0x8')](_0x40d9('0x30'),_0x41c28c[_0x40d9('0x25')],_0x45acda['id']);_0x159c8f[_0x509d15]=_[_0x40d9('0xe')](_0x41c28c[_0x40d9('0x18')])?_0x41c28c[_0x40d9('0x17')]:_0x41c28c[_0x40d9('0x19')];if(_[_0x40d9('0xe')](_0x41c28c[_0x40d9('0x18')])){_0x159c8f[_0x40d9('0x29')]=_0x41c28c[_0x40d9('0x2a')]&&_0x41c28c[_0x40d9('0x2a')]!==''?_0x41c28c['calleridname']:_0x40d9('0x2d');}else{_0x159c8f[_0x40d9('0x29')]=_0x41c28c[_0x40d9('0x2c')]&&_0x41c28c[_0x40d9('0x2c')]!==_0x40d9('0x2b')?_0x41c28c[_0x40d9('0x2c')]:_0x40d9('0x2d');}_0x4186e4=_0x159c8f;_0x39438c[_0x40d9('0x31')](_0x159c8f);return;}}})[_0x40d9('0x21')](function(){if(_0x5cb49f){emit(_0x41c28c['uniqueid'],_0x45acda,util[_0x40d9('0x32')](_0x40d9('0x33'),_0x5cb49f[_0x40d9('0x34')]),util[_0x40d9('0x32')](_0x40d9('0x35'),_0x5eb060[_0x40d9('0x36')][_0x40d9('0x37')]()),{'evt':_[_0x40d9('0x38')](_0x41c28c,{'autoCreate':_0x1f203f}),'contact':_0x4186e4===undefined?{}:_0x4186e4,'contacts':_0x39438c['length']===0x0?undefined:_0x39438c});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 4da710d..2db968d 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 _0xfa75=['freshsalesAccounts','accounts','zohoAccounts','servicenowAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','info','emit','clone','motionChannel','voice','debug','inspect','interface','checkTriggers','hasOwnProperty','status','checkTrigger','merge','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','600','data6','winapp','winApplication','winArguments','format','user:%s','trigger:%s:%s','jscripty','trigger:%s','name','integration','exec','queue','routeId','urlforward','script','buildUri','parse','replace','AllConditions','every','checkConditions','channel','AnyConditions','some','checkTrigger:\x20trigger','evt','field','chat','ChatWebsiteId','operator','upperFirst','AccountId','message','event','value','membername','lastevent','mailSubstatus','null','substatus','undefined','created','equals','exports','util','lodash','url','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','socket.io-emitter','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts'];(function(_0x7c569e,_0x959ff3){var _0x5d9e57=function(_0x48c64e){while(--_0x48c64e){_0x7c569e['push'](_0x7c569e['shift']());}};_0x5d9e57(++_0x959ff3);}(_0xfa75,0x1ef));var _0x5fa7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfa75[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x5fa7('0x0'));var _=require(_0x5fa7('0x1'));var url=require(_0x5fa7('0x2'));var Mustache=require('mustache');var Redis=require(_0x5fa7('0x3'));var urlforward=require(_0x5fa7('0x4'));var integration=require(_0x5fa7('0x5'));var cmContact=require(_0x5fa7('0x6'));var script=require('./script');var config=require(_0x5fa7('0x7'));var logger=require(_0x5fa7('0x8'))(_0x5fa7('0x9'));var ami=require(_0x5fa7('0xa'));config[_0x5fa7('0xb')]=_['defaults'](config[_0x5fa7('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x5fa7('0xc'))(new Redis(config[_0x5fa7('0xb')]));var operators={'equals':function(_0x2d5024,_0x27492d){return _0x2d5024==_0x27492d;},'not_equals':function(_0x29b8d0,_0x513d5f){return _0x29b8d0!=_0x513d5f;}};var barAndWebActions=['popup',_0x5fa7('0x2'),'winapp'];function Trigger(_0x2bdb27){this['triggers']=_0x2bdb27[_0x5fa7('0xd')];this['agents']=_0x2bdb27[_0x5fa7('0xe')];this[_0x5fa7('0xf')]=_0x2bdb27['voiceQueues'];this[_0x5fa7('0x10')]=_0x2bdb27[_0x5fa7('0x10')];this[_0x5fa7('0x11')]=_0x2bdb27[_0x5fa7('0x11')];this[_0x5fa7('0x12')]=_0x2bdb27[_0x5fa7('0x12')];this[_0x5fa7('0x13')]=_0x2bdb27[_0x5fa7('0x13')];this[_0x5fa7('0x14')]=_0x2bdb27[_0x5fa7('0x14')];this[_0x5fa7('0x15')]=_0x2bdb27[_0x5fa7('0x15')];this['zohoAccounts']=_0x2bdb27['zohoAccounts'];this[_0x5fa7('0x16')]=_0x2bdb27[_0x5fa7('0x16')];this[_0x5fa7('0x17')]=_0x2bdb27[_0x5fa7('0x17')];this['servicenowAccounts']=_0x2bdb27['servicenowAccounts'];this[_0x5fa7('0x18')]=_0x2bdb27[_0x5fa7('0x18')];this[_0x5fa7('0x19')]=_0x2bdb27['freshsalesAccounts'];this[_0x5fa7('0x1a')]={'zendesk':this[_0x5fa7('0x12')],'salesforce':this[_0x5fa7('0x14')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x5fa7('0x15')],'zoho':this[_0x5fa7('0x1b')],'desk':this[_0x5fa7('0x16')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x5fa7('0x19')],'servicenow':this[_0x5fa7('0x1c')]};ami['on'](_0x5fa7('0x1d'),this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x20'),this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x21'),this['syncCustomEvent']['bind'](this));ami['on'](_0x5fa7('0x22'),this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on']('custom:agentnoanswer',this[_0x5fa7('0x1e')]['bind'](this));ami['on'](_0x5fa7('0x23'),this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on']('custom:agentcongestion',this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x24'),this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on']('custom:amd',this[_0x5fa7('0x1e')]['bind'](this));ami['on'](_0x5fa7('0x25'),this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x26'),this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x27'),this[_0x5fa7('0x28')][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x29'),this[_0x5fa7('0x28')][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x2a'),this['syncAgentDial'][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x2b'),this['syncCustomEvent'][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x2c'),this['syncCustomEvent'][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x2d'),this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x2e'),this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on'](_0x5fa7('0x2f'),this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x5fa7('0x30'),this['syncCustomEvent']['bind'](this));ami['on']('custom:offlineMessage',this[_0x5fa7('0x1e')][_0x5fa7('0x1f')](this));}Trigger[_0x5fa7('0x31')]['emit']=function(_0x2ebbf8,_0x3aec54,_0x4381c8){logger[_0x5fa7('0x32')](_0x2ebbf8,_0x3aec54,JSON['stringify'](_0x4381c8));io['to'](_0x2ebbf8)[_0x5fa7('0x33')](_0x3aec54,_0x4381c8);};Trigger[_0x5fa7('0x31')][_0x5fa7('0x1e')]=function(_0x4c034b){var _0x1d2689=_[_0x5fa7('0x34')](_0x4c034b);if(typeof _0x1d2689[_0x5fa7('0x35')]==='undefined'){_0x1d2689[_0x5fa7('0x35')]=_0x5fa7('0x36');}logger[_0x5fa7('0x37')](_0x5fa7('0x1e'),util[_0x5fa7('0x38')](_0x1d2689,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x1d2689);};Trigger[_0x5fa7('0x31')][_0x5fa7('0x28')]=function(_0x8134c){if(this[_0x5fa7('0xe')][_0x8134c[_0x5fa7('0x39')]]){this['syncCustomEvent'](_0x8134c);}};Trigger[_0x5fa7('0x31')][_0x5fa7('0x3a')]=function(_0x31763d){var _0x27df39;for(var _0x50cb70 in this[_0x5fa7('0xd')]){if(this[_0x5fa7('0xd')][_0x5fa7('0x3b')](_0x50cb70)){if(this[_0x5fa7('0xd')][_0x50cb70][_0x5fa7('0x3c')]){_0x27df39=this[_0x5fa7('0x3d')](this[_0x5fa7('0xd')][_0x50cb70],_0x31763d);if(_0x27df39){_[_0x5fa7('0x3e')](_0x31763d,_0x31763d['variables']);for(var _0x4c5e67=0x0,_0x18e074,_0x6f7157,_0x2ff7ba;_0x4c5e670x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0x5fc3[_0x1c9c24];return _0x349c69;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 68ce258..cdaa22e 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 _0x3796=['queue','phonecalls','headers','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','error','toUpperCase','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','userEmail','email','length','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','userId','catch','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','Bearer\x20','body','lastIndexOf','enduserId','telephone1','contacts?$select=','replace','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','customField','indexOf','substring','ticketType','incident','incidents','assign','Descriptions','/contacts(','Fields','callDirection'];(function(_0x4b51d5,_0x2e0dd6){var _0x323a92=function(_0x51b23e){while(--_0x51b23e){_0x4b51d5['push'](_0x4b51d5['shift']());}};_0x323a92(++_0x2e0dd6);}(_0x3796,0x152));var _0x6379=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x3796[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var rp=require('request-promise');var util=require(_0x6379('0x0'));var intUtil=require(_0x6379('0x1'));var md5=require(_0x6379('0x2'));var Redis=require(_0x6379('0x3'));var logger=require('../../../../config/logger')(_0x6379('0x4'));var config=require(_0x6379('0x5'));config[_0x6379('0x6')]=_[_0x6379('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6379('0x6')]));function getAuthToken(_0x41bb5c,_0x9f2c0a,_0x1f8383){if(_0x41bb5c[_0x6379('0x8')]){_0x41bb5c[_0x6379('0x9')]=_0x41bb5c[_0x6379('0xa')][_0x6379('0xb')];_0x41bb5c[_0x6379('0xc')]=_0x41bb5c['CloudProvider']['data2'];return Promise[_0x6379('0xd')](_0x41bb5c[_0x6379('0xa')][_0x6379('0xe')]);}var _0x3a365a={'method':_0x6379('0xf'),'uri':_0x9f2c0a,'form':{'client_id':_0x41bb5c[_0x6379('0x10')],'resource':_0x41bb5c[_0x6379('0x9')],'username':_0x41bb5c[_0x6379('0x11')],'password':_0x41bb5c[_0x6379('0x12')],'grant_type':_0x6379('0x12'),'client_secret':_0x41bb5c[_0x6379('0x13')]},'json':!![]};return rp(_0x3a365a)[_0x6379('0x14')](function(_0x4831b7){return _0x4831b7[_0x6379('0x15')];})['catch'](function(_0x503f53){logger[_0x6379('0x16')]('['+[_0x1f8383[_0x6379('0x17')]()]+']\x20Wrong\x20credentials!');return _0x503f53[_0x6379('0x18')];});}function getUser(_0x3654ef,_0x4511f3,_0x5531f7,_0x355b78,_0x7e82ed,_0x41a798){return new Promise(function(_0x5832c2,_0x121173){return getAuthToken(_0x4511f3,_0x355b78,_0x41a798)[_0x6379('0x14')](function(_0x500890){var _0x55521e={'method':'GET','uri':_0x7e82ed+_0x6379('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x500890,'OData-Version':_0x6379('0x1a')},'json':!![]};return rp(_0x55521e);})['then'](function(_0x2e0dc9){var _0x5642e8=_0x2e0dc9[_0x6379('0x1b')];var _0x133393=![];var _0x177f30=null;if(!_[_0x6379('0x1c')](_0x5531f7)){if(intUtil[_0x6379('0x1d')](_0x5531f7['email'])){_0x3654ef[_0x6379('0x1e')]=_0x5531f7[_0x6379('0x1f')];for(_0x177f30=0x0;_0x177f30<_0x5642e8[_0x6379('0x20')];_0x177f30++){if(_0x5642e8[_0x177f30]['internalemailaddress']===_0x5531f7[_0x6379('0x1f')]&&!_0x5642e8[_0x177f30]['isdisabled']){_0x133393=!![];logger[_0x6379('0x21')]('['+[_0x41a798[_0x6379('0x17')]()]+_0x6379('0x22')+_0x5642e8[_0x177f30][_0x6379('0x23')]+'!');_0x3654ef['userId']=_0x5642e8[_0x177f30][_0x6379('0x23')];}}}}if(!_0x133393){logger['info']('['+[_0x41a798[_0x6379('0x17')]()]+_0x6379('0x24'));_0x3654ef[_0x6379('0x1e')]=_0x4511f3[_0x6379('0x11')];for(_0x177f30=0x0;_0x177f30<_0x5642e8['length'];_0x177f30++){if(_0x5642e8[_0x177f30][_0x6379('0x25')]===_0x4511f3[_0x6379('0x11')]){_0x3654ef[_0x6379('0x26')]=_0x5642e8[_0x177f30][_0x6379('0x23')];}}}_0x5832c2(_0x3654ef);})[_0x6379('0x27')](function(_0x5ae0d0){_0x121173(_0x5ae0d0[_0x6379('0x18')]);});});}function createEndUser(_0x317579,_0x4e0e60,_0x4e2eb0,_0x37d2da,_0x1d3584,_0x3757d9,_0x5e3303){return new Promise(function(_0x341e28,_0x38cd53){return getAuthToken(_0x4e0e60,_0x4e2eb0,_0x3757d9)[_0x6379('0x14')](function(_0x3e4ada){var _0x3b40d7=_0x3757d9[_0x6379('0x28')]()===_0x6379('0x29')?_0x1d3584[_0x6379('0x2a')]:_0x1d3584[_0x6379('0x2b')];var _0x2d34b0={'method':_0x6379('0xf'),'uri':_0x37d2da+'contacts','body':{'fullname':_0x3b40d7,'firstname':_0x3b40d7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6379('0x2c')+_0x317579['userId']+')'},'headers':{'Authorization':_0x6379('0x2d')+_0x3e4ada,'OData-Version':_0x6379('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x2d34b0[_0x6379('0x2e')][_0x5e3303]=_0x3b40d7;return rp(_0x2d34b0);})[_0x6379('0x14')](function(_0x5d998b){var _0x237218=_0x5d998b['headers']['odata-entityid'];var _0x21e16b=_0x237218['substring'](_0x237218['lastIndexOf']('(')+0x1,_0x237218[_0x6379('0x2f')](')'));_0x317579[_0x6379('0x30')]=_0x21e16b;_0x341e28(_0x317579);})[_0x6379('0x27')](function(_0xdbbd11){_0x38cd53(_0xdbbd11[_0x6379('0x18')]);});});}function getEndUser(_0x15d854,_0x439ece,_0x2e2bea,_0x1e2446,_0x2a9546,_0xa8d62e,_0x3d5991,_0x30d009){var _0x28bb9b=_0xa8d62e[_0x6379('0x28')]()===_0x6379('0x29')?_0x2a9546[_0x6379('0x2a')]:_0x2a9546['calleridnum'];return getAuthToken(_0x439ece,_0x2e2bea,_0xa8d62e)[_0x6379('0x14')](function(_0x29db9b){_0x30d009=_0x30d009?_0x30d009:_0x6379('0x31');var _0x274944={'method':'GET','uri':_0x1e2446+_0x6379('0x32')+_0x30d009+'&$filter='+_0x30d009+'\x20eq\x20\x27'+_0x28bb9b[_0x6379('0x33')]('+','%2b')+'\x27','headers':{'Authorization':_0x6379('0x2d')+_0x29db9b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x274944);})[_0x6379('0x14')](function(_0xae7217){var _0x13389d=![];if(!_0xae7217)return _0x13389d;var _0x4c4939=_0xae7217[_0x6379('0x1b')];for(var _0x41a2df=0x0;_0x41a2df<_0x4c4939[_0x6379('0x20')];_0x41a2df++){if(_0x4c4939[_0x41a2df][_0x30d009]===_0x28bb9b){_0x13389d=!![];_0x15d854[_0x6379('0x30')]=_0x4c4939[_0x41a2df][_0x6379('0x34')];}}return _0x13389d;})[_0x6379('0x14')](function(_0x4e8d46){if(_0x4e8d46)return _0x15d854;if(_0x3d5991==='nothing'){logger[_0x6379('0x21')]('['+[_0xa8d62e[_0x6379('0x17')]()]+_0x6379('0x35'));return _0x15d854;}return createEndUser(_0x15d854,_0x439ece,_0x2e2bea,_0x1e2446,_0x2a9546,_0xa8d62e,_0x30d009)[_0x6379('0x14')](function(_0xa0b98b){logger[_0x6379('0x21')]('['+[_0xa8d62e[_0x6379('0x17')]()]+']\x20Enduser\x20created!',_0xa0b98b[_0x6379('0x30')]);return _0xa0b98b;});});}function getCustomFields(_0x5a43d6,_0x131860,_0x46c37f){var _0x241997={};if(_0x5a43d6[_0x6379('0x20')]>0x0){_[_0x6379('0x36')](_0x5a43d6,function(_0x117c8e){if(_[_0x6379('0x37')]([_0x6379('0x38'),_0x6379('0x39')],_0x117c8e[_0x6379('0x3a')])&&_0x117c8e['nameField']&&!_0x117c8e[_0x6379('0x3b')]){var _0x2d66c2=_0x117c8e['idField'][_0x6379('0x28')]();var _0x53d68e=_0x2d66c2['substring'](0x0,_0x2d66c2[_0x6379('0x3c')]('_'));var _0x20889a=_0x2d66c2[_0x6379('0x3d')](_0x2d66c2[_0x6379('0x3c')]('_')+0x1);if(_0x53d68e===_0x46c37f){_0x241997[_0x20889a]=_0x117c8e['content'];}}});}return _0x241997;}function getTicket(_0x3bc9de,_0x1899fb,_0x3fef8c,_0x86ae2a,_0x41d654,_0x4d40f7,_0x158b0c){return new Promise(function(_0x5b556d,_0x391d8b){var _0x543276;return getAuthToken(_0x1899fb,_0x3fef8c,_0x158b0c)[_0x6379('0x14')](function(_0x31c525){if(_0x4d40f7[_0x6379('0x3e')]===_0x6379('0x3f')){_0x543276={'method':_0x6379('0xf'),'uri':_0x86ae2a+_0x6379('0x40'),'body':Object[_0x6379('0x41')]({},{'title':intUtil['getString'](_0x4d40f7['Subjects'],_0x41d654,'\x20'),'description':intUtil['getString'](_0x4d40f7[_0x6379('0x42')],_0x41d654,'\x0a'),'customerid_contact@odata.bind':_0x3bc9de['enduserId']?_0x6379('0x43')+_0x3bc9de[_0x6379('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3bc9de['userId']+')','caseorigincode':'1'},getCustomFields(_0x4d40f7[_0x6379('0x44')],_0x41d654,_0x4d40f7[_0x6379('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x31c525,'OData-Version':_0x6379('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4d40f7[_0x6379('0x3e')]==='phonecall'){var _0x537795=_0x3bc9de[_0x6379('0x30')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3bc9de[_0x6379('0x26')]+')','participationtypemask':_0x3bc9de[_0x6379('0x45')]===_0x6379('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x6379('0x43')+_0x3bc9de[_0x6379('0x30')]+')','participationtypemask':_0x3bc9de[_0x6379('0x45')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x6379('0x2c')+_0x3bc9de['userId']+')','participationtypemask':_0x3bc9de[_0x6379('0x45')]===_0x6379('0x46')?0x2:0x1}];_0x543276={'method':'POST','uri':_0x86ae2a+_0x6379('0x47'),'body':Object[_0x6379('0x41')]({},{'subject':intUtil['getString'](_0x4d40f7['Subjects'],_0x41d654,'\x20'),'phonenumber':String(_0x41d654[_0x6379('0x2b')]),'description':intUtil['getString'](_0x4d40f7['Descriptions'],_0x41d654,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3bc9de['enduserId']?_0x6379('0x43')+_0x3bc9de['enduserId']+')':undefined,'ownerid@odata.bind':_0x6379('0x2c')+_0x3bc9de['userId']+')','directioncode':_0x3bc9de[_0x6379('0x45')]==='queue'?![]:!![],'phonecall_activity_parties':_0x537795},getCustomFields(_0x4d40f7[_0x6379('0x44')],_0x41d654,_0x4d40f7[_0x6379('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x31c525,'OData-Version':_0x6379('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x543276);})[_0x6379('0x14')](function(_0x45c2fe){var _0xc598e0=_0x45c2fe[_0x6379('0x48')][_0x6379('0x49')];var _0x4e7515=_0xc598e0[_0x6379('0x3d')](_0xc598e0[_0x6379('0x2f')]('(')+0x1,_0xc598e0[_0x6379('0x2f')](')'));_0x3bc9de[_0x6379('0x4a')]=_0x4e7515;_0x5b556d(_0x3bc9de);})[_0x6379('0x27')](function(_0x1b7fd6){_0x391d8b(_0x1b7fd6['message']);});});}function emit(_0x2db553,_0x437eff,_0x42d58f,_0x3e8b0e){var _0x38c697={'uri':util[_0x6379('0x4b')](_0x6379('0x4c'),_0x2db553,_0x42d58f,_0x3e8b0e)};io['to'](util[_0x6379('0x4b')]('user:%s',_0x437eff))[_0x6379('0x4d')](_0x6379('0x4e'),_0x38c697);}exports['cs']=function(_0x3802b7,_0x20ce90,_0x450df9,_0x4be086,_0x195717,_0x40ff88,_0x1cfa9b,_0x4c7f83){var _0x4215e6={};_0x40ff88[_0x6379('0x9')]=_0x40ff88[_0x6379('0x8')]?intUtil[_0x6379('0x4f')](_0x40ff88[_0x6379('0xa')][_0x6379('0xb')]):intUtil['stripTrailingSlash'](_0x40ff88[_0x6379('0x9')]);_0x40ff88[_0x6379('0x50')]=intUtil['stripTrailingSlash'](_0x40ff88[_0x6379('0x50')]);_0x4215e6[_0x6379('0x45')]=_0x4c7f83===_0x6379('0x46')||_0x4c7f83===_0x6379('0x51')?_0x6379('0x46'):_0x6379('0x29');var _0x43ddf8=_0x40ff88[_0x6379('0x8')]?util[_0x6379('0x4b')](_0x6379('0x52'),_0x40ff88[_0x6379('0xa')][_0x6379('0xb')]):util['format']('%s/api/data/v9.0/',_0x40ff88[_0x6379('0x9')]);var _0x56321c=util['format'](_0x6379('0x53'),_0x40ff88[_0x6379('0xc')]);var _0x592ca5=util['format'](_0x6379('0x54'),_0x40ff88['serverUrl'],_0x20ce90['uniqueid'],md5(_0x20ce90[_0x6379('0x55')]));if(_0x195717&&_0x195717[_0x6379('0x56')]){logger[_0x6379('0x21')](_0x6379('0x57'),_0x6379('0x58'));_0x20ce90[_0x6379('0x59')]=_0x592ca5;}else if(_0x1cfa9b&&_0x1cfa9b[_0x6379('0x5a')]&&_0x1cfa9b['recordingFormat']!==_0x6379('0x5b')){logger['info'](_0x6379('0x5c'),_0x6379('0x58'));_0x20ce90[_0x6379('0x59')]=_0x592ca5;}else{_0x20ce90[_0x6379('0x59')]='';}return getUser(_0x4215e6,_0x40ff88,_0x4be086,_0x56321c,_0x43ddf8,_0x4c7f83)[_0x6379('0x14')](function(_0x54c2f6){logger['info']('['+_0x4c7f83[_0x6379('0x17')]()+']\x20The\x20User\x20ID\x20is:',_0x54c2f6['userId']);logger[_0x6379('0x21')]('['+_0x4c7f83['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x54c2f6[_0x6379('0x1e')]);return getEndUser(_0x54c2f6,_0x40ff88,_0x56321c,_0x43ddf8,_0x20ce90,_0x4c7f83,_0x450df9[_0x6379('0x5d')],_0x450df9[_0x6379('0x5e')]);})[_0x6379('0x14')](function(_0x53773a){logger[_0x6379('0x21')]('['+_0x4c7f83[_0x6379('0x17')]()+_0x6379('0x5f'),_0x53773a[_0x6379('0x30')]);logger[_0x6379('0x21')]('['+_0x4c7f83[_0x6379('0x17')]()+_0x6379('0x60'),_0x20ce90[_0x6379('0x2b')]);return getTicket(_0x53773a,_0x40ff88,_0x56321c,_0x43ddf8,_0x20ce90,_0x450df9,_0x4c7f83);})[_0x6379('0x14')](function(_0x2b5133){logger['info'](util[_0x6379('0x4b')]('['+_0x4c7f83[_0x6379('0x17')]()+_0x6379('0x61'),_0x450df9[_0x6379('0x3e')],_0x2b5133[_0x6379('0x4a')]));logger['info'](util[_0x6379('0x4b')]('['+_0x4c7f83[_0x6379('0x17')]()+_0x6379('0x62'),_0x4c7f83));if(_0x4c7f83!==_0x6379('0x51')&&_0x450df9['openNewTab']){logger[_0x6379('0x21')]('['+_0x4c7f83[_0x6379('0x17')]()+']',_0x6379('0x63'));emit(_0x40ff88[_0x6379('0x9')],_0x4be086[_0x6379('0x64')],_0x450df9['ticketType'],_0x2b5133['ticketId']);}})[_0x6379('0x27')](function(_0x418d11){logger['error']('['+_0x4c7f83[_0x6379('0x17')]()+_0x6379('0x65'),_0x418d11[_0x6379('0x18')]);console[_0x6379('0x16')]('Error\x20running\x20Dynamics365\x20integration',_0x418d11);});}; \ No newline at end of file +var _0xecaf=['isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','telephone1','\x20eq\x20\x27','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','customField','idField','indexOf','content','assign','Subjects','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','odata-entityid','format','user:%s','trigger:browser:url','data7','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','tenantId','data2','resolve','CloudProvider','data5','POST','clientId','remoteUri','username','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value'];(function(_0x51b10b,_0x311567){var _0x45b2cf=function(_0xa17759){while(--_0xa17759){_0x51b10b['push'](_0x51b10b['shift']());}};_0x45b2cf(++_0x311567);}(_0xecaf,0x1dc));var _0xfeca=function(_0x474bb2,_0x535f8c){_0x474bb2=_0x474bb2-0x0;var _0x43f609=_0xecaf[_0x474bb2];return _0x43f609;};'use strict';var _=require('lodash');var rp=require(_0xfeca('0x0'));var util=require(_0xfeca('0x1'));var intUtil=require(_0xfeca('0x2'));var md5=require(_0xfeca('0x3'));var Redis=require('ioredis');var logger=require(_0xfeca('0x4'))(_0xfeca('0x5'));var config=require(_0xfeca('0x6'));config[_0xfeca('0x7')]=_[_0xfeca('0x8')](config[_0xfeca('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xfeca('0x9'))(new Redis(config[_0xfeca('0x7')]));function getAuthToken(_0x29b54d,_0x64c253,_0x594fee){if(_0x29b54d[_0xfeca('0xa')]){_0x29b54d['remoteUri']=_0x29b54d['CloudProvider']['data7'];_0x29b54d[_0xfeca('0xb')]=_0x29b54d['CloudProvider'][_0xfeca('0xc')];return Promise[_0xfeca('0xd')](_0x29b54d[_0xfeca('0xe')][_0xfeca('0xf')]);}var _0x41e322={'method':_0xfeca('0x10'),'uri':_0x64c253,'form':{'client_id':_0x29b54d[_0xfeca('0x11')],'resource':_0x29b54d[_0xfeca('0x12')],'username':_0x29b54d[_0xfeca('0x13')],'password':_0x29b54d[_0xfeca('0x14')],'grant_type':_0xfeca('0x14'),'client_secret':_0x29b54d[_0xfeca('0x15')]},'json':!![]};return rp(_0x41e322)['then'](function(_0x541182){return _0x541182[_0xfeca('0x16')];})[_0xfeca('0x17')](function(_0x1107a7){logger[_0xfeca('0x18')]('['+[_0x594fee[_0xfeca('0x19')]()]+_0xfeca('0x1a'));return _0x1107a7[_0xfeca('0x1b')];});}function getUser(_0x5a05a8,_0xb4f2fb,_0x459bcf,_0x230589,_0x5256c7,_0x56e109){return new Promise(function(_0x1b8caf,_0x535659){return getAuthToken(_0xb4f2fb,_0x230589,_0x56e109)[_0xfeca('0x1c')](function(_0x53815f){var _0x2f18c0={'method':_0xfeca('0x1d'),'uri':_0x5256c7+_0xfeca('0x1e'),'headers':{'Authorization':_0xfeca('0x1f')+_0x53815f,'OData-Version':_0xfeca('0x20')},'json':!![]};return rp(_0x2f18c0);})['then'](function(_0x311f1b){var _0x58fd69=_0x311f1b[_0xfeca('0x21')];var _0x4d541d=![];var _0x13b02b=null;if(!_[_0xfeca('0x22')](_0x459bcf)){if(intUtil[_0xfeca('0x23')](_0x459bcf[_0xfeca('0x24')])){_0x5a05a8[_0xfeca('0x25')]=_0x459bcf[_0xfeca('0x24')];for(_0x13b02b=0x0;_0x13b02b<_0x58fd69[_0xfeca('0x26')];_0x13b02b++){if(_0x58fd69[_0x13b02b][_0xfeca('0x27')]===_0x459bcf['email']&&!_0x58fd69[_0x13b02b][_0xfeca('0x28')]){_0x4d541d=!![];logger[_0xfeca('0x29')]('['+[_0x56e109['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x58fd69[_0x13b02b][_0xfeca('0x2a')]+'!');_0x5a05a8[_0xfeca('0x2b')]=_0x58fd69[_0x13b02b][_0xfeca('0x2a')];}}}}if(!_0x4d541d){logger[_0xfeca('0x29')]('['+[_0x56e109[_0xfeca('0x19')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x5a05a8[_0xfeca('0x25')]=_0xb4f2fb[_0xfeca('0x13')];for(_0x13b02b=0x0;_0x13b02b<_0x58fd69['length'];_0x13b02b++){if(_0x58fd69[_0x13b02b][_0xfeca('0x27')]===_0xb4f2fb[_0xfeca('0x13')]){_0x5a05a8[_0xfeca('0x2b')]=_0x58fd69[_0x13b02b]['systemuserid'];}}}_0x1b8caf(_0x5a05a8);})[_0xfeca('0x17')](function(_0x61c7ac){_0x535659(_0x61c7ac['message']);});});}function createEndUser(_0x421e7f,_0x1751d2,_0x2fa4b0,_0x359c10,_0xf43afb,_0x57a80c,_0x1b5ceb){return new Promise(function(_0x55555c,_0x450273){return getAuthToken(_0x1751d2,_0x2fa4b0,_0x57a80c)[_0xfeca('0x1c')](function(_0x2cb17a){var _0x6d8237=_0x57a80c[_0xfeca('0x2c')]()===_0xfeca('0x2d')?_0xf43afb[_0xfeca('0x2e')]:_0xf43afb[_0xfeca('0x2f')];var _0x243e35={'method':_0xfeca('0x10'),'uri':_0x359c10+_0xfeca('0x30'),'body':{'fullname':_0x6d8237,'firstname':_0x6d8237,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xfeca('0x31')+_0x421e7f['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x2cb17a,'OData-Version':_0xfeca('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x243e35['body'][_0x1b5ceb]=_0x6d8237;return rp(_0x243e35);})[_0xfeca('0x1c')](function(_0x38e049){var _0x142c16=_0x38e049[_0xfeca('0x32')]['odata-entityid'];var _0xaa91a=_0x142c16[_0xfeca('0x33')](_0x142c16[_0xfeca('0x34')]('(')+0x1,_0x142c16[_0xfeca('0x34')](')'));_0x421e7f['enduserId']=_0xaa91a;_0x55555c(_0x421e7f);})[_0xfeca('0x17')](function(_0x52b55e){_0x450273(_0x52b55e[_0xfeca('0x1b')]);});});}function getEndUser(_0x57982f,_0xc45931,_0x3870f4,_0x4fecfd,_0x4937cd,_0x5cfcd7,_0x3e4d78,_0x2d152d){var _0x359fa0=_0x5cfcd7[_0xfeca('0x2c')]()===_0xfeca('0x2d')?_0x4937cd['destcalleridnum']:_0x4937cd[_0xfeca('0x2f')];return getAuthToken(_0xc45931,_0x3870f4,_0x5cfcd7)[_0xfeca('0x1c')](function(_0x56f89d){_0x2d152d=_0x2d152d?_0x2d152d:_0xfeca('0x35');var _0xcbf10b={'method':_0xfeca('0x1d'),'uri':_0x4fecfd+'contacts?$select='+_0x2d152d+'&$filter='+_0x2d152d+_0xfeca('0x36')+_0x359fa0['replace']('+',_0xfeca('0x37'))+'\x27','headers':{'Authorization':_0xfeca('0x1f')+_0x56f89d,'If-None-Match':null,'OData-Version':_0xfeca('0x20')},'json':!![]};return rp(_0xcbf10b);})[_0xfeca('0x1c')](function(_0x1403b2){var _0x508988=![];if(!_0x1403b2)return _0x508988;var _0x25fa08=_0x1403b2[_0xfeca('0x21')];for(var _0x563d7d=0x0;_0x563d7d<_0x25fa08[_0xfeca('0x26')];_0x563d7d++){if(_0x25fa08[_0x563d7d][_0x2d152d]===_0x359fa0){_0x508988=!![];_0x57982f[_0xfeca('0x38')]=_0x25fa08[_0x563d7d][_0xfeca('0x39')];}}return _0x508988;})[_0xfeca('0x1c')](function(_0x2789ed){if(_0x2789ed)return _0x57982f;if(_0x3e4d78===_0xfeca('0x3a')){logger[_0xfeca('0x29')]('['+[_0x5cfcd7[_0xfeca('0x19')]()]+_0xfeca('0x3b'));return _0x57982f;}return createEndUser(_0x57982f,_0xc45931,_0x3870f4,_0x4fecfd,_0x4937cd,_0x5cfcd7,_0x2d152d)[_0xfeca('0x1c')](function(_0x136cbd){logger[_0xfeca('0x29')]('['+[_0x5cfcd7[_0xfeca('0x19')]()]+']\x20Enduser\x20created!',_0x136cbd['enduserId']);return _0x136cbd;});});}function getCustomFields(_0x1a2fc9,_0x274a5d,_0x887fdc){var _0x319c21={};if(_0x1a2fc9[_0xfeca('0x26')]>0x0){_[_0xfeca('0x3c')](_0x1a2fc9,function(_0x11fa9c){if(_[_0xfeca('0x3d')]([_0xfeca('0x3e'),_0xfeca('0x3f')],_0x11fa9c[_0xfeca('0x40')])&&_0x11fa9c['nameField']&&!_0x11fa9c[_0xfeca('0x41')]){var _0x3e7c51=_0x11fa9c[_0xfeca('0x42')][_0xfeca('0x2c')]();var _0x5a01f6=_0x3e7c51[_0xfeca('0x33')](0x0,_0x3e7c51[_0xfeca('0x43')]('_'));var _0x499f04=_0x3e7c51[_0xfeca('0x33')](_0x3e7c51[_0xfeca('0x43')]('_')+0x1);if(_0x5a01f6===_0x887fdc){_0x319c21[_0x499f04]=_0x11fa9c[_0xfeca('0x44')];}}});}return _0x319c21;}function getTicket(_0x22b6d9,_0x11effe,_0x212cc3,_0x4ade70,_0x42fa9d,_0xd45f30,_0x1a96c2){return new Promise(function(_0x4e6214,_0x4a7833){var _0x227369;return getAuthToken(_0x11effe,_0x212cc3,_0x1a96c2)[_0xfeca('0x1c')](function(_0x42cf7e){if(_0xd45f30['ticketType']==='incident'){_0x227369={'method':_0xfeca('0x10'),'uri':_0x4ade70+'incidents','body':Object[_0xfeca('0x45')]({},{'title':intUtil['getString'](_0xd45f30[_0xfeca('0x46')],_0x42fa9d,'\x20'),'description':intUtil[_0xfeca('0x47')](_0xd45f30[_0xfeca('0x48')],_0x42fa9d,'\x0a'),'customerid_contact@odata.bind':_0x22b6d9[_0xfeca('0x38')]?_0xfeca('0x49')+_0x22b6d9['enduserId']+')':undefined,'ownerid@odata.bind':_0xfeca('0x31')+_0x22b6d9['userId']+')','caseorigincode':'1'},getCustomFields(_0xd45f30[_0xfeca('0x4a')],_0x42fa9d,_0xd45f30[_0xfeca('0x4b')])),'headers':{'Authorization':_0xfeca('0x1f')+_0x42cf7e,'OData-Version':_0xfeca('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xd45f30[_0xfeca('0x4b')]===_0xfeca('0x4c')){var _0x132b86=_0x22b6d9[_0xfeca('0x38')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x22b6d9[_0xfeca('0x2b')]+')','participationtypemask':_0x22b6d9[_0xfeca('0x4d')]===_0xfeca('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0xfeca('0x49')+_0x22b6d9['enduserId']+')','participationtypemask':_0x22b6d9[_0xfeca('0x4d')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xfeca('0x31')+_0x22b6d9[_0xfeca('0x2b')]+')','participationtypemask':_0x22b6d9[_0xfeca('0x4d')]===_0xfeca('0x4e')?0x2:0x1}];_0x227369={'method':_0xfeca('0x10'),'uri':_0x4ade70+'phonecalls','body':Object[_0xfeca('0x45')]({},{'subject':intUtil[_0xfeca('0x47')](_0xd45f30[_0xfeca('0x46')],_0x42fa9d,'\x20'),'phonenumber':String(_0x42fa9d[_0xfeca('0x2f')]),'description':intUtil[_0xfeca('0x47')](_0xd45f30[_0xfeca('0x48')],_0x42fa9d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x22b6d9['enduserId']?_0xfeca('0x49')+_0x22b6d9[_0xfeca('0x38')]+')':undefined,'ownerid@odata.bind':_0xfeca('0x31')+_0x22b6d9[_0xfeca('0x2b')]+')','directioncode':_0x22b6d9[_0xfeca('0x4d')]===_0xfeca('0x4e')?![]:!![],'phonecall_activity_parties':_0x132b86},getCustomFields(_0xd45f30[_0xfeca('0x4a')],_0x42fa9d,_0xd45f30[_0xfeca('0x4b')])),'headers':{'Authorization':_0xfeca('0x1f')+_0x42cf7e,'OData-Version':_0xfeca('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x227369);})['then'](function(_0x5777ee){var _0x15faf9=_0x5777ee[_0xfeca('0x32')][_0xfeca('0x4f')];var _0x14b9ae=_0x15faf9[_0xfeca('0x33')](_0x15faf9['lastIndexOf']('(')+0x1,_0x15faf9[_0xfeca('0x34')](')'));_0x22b6d9['ticketId']=_0x14b9ae;_0x4e6214(_0x22b6d9);})[_0xfeca('0x17')](function(_0x15dde9){_0x4a7833(_0x15dde9[_0xfeca('0x1b')]);});});}function emit(_0x4e7f99,_0x421929,_0x410d77,_0x1a89b5){var _0x4eab93={'uri':util[_0xfeca('0x50')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4e7f99,_0x410d77,_0x1a89b5)};io['to'](util['format'](_0xfeca('0x51'),_0x421929))['emit'](_0xfeca('0x52'),_0x4eab93);}exports['cs']=function(_0x15775d,_0xeaf7bd,_0x1f551c,_0x5e427e,_0x56d77f,_0x36996a,_0x1653b7,_0x50f1d6){var _0x590aee={};_0x36996a[_0xfeca('0x12')]=_0x36996a[_0xfeca('0xa')]?intUtil['stripTrailingSlash'](_0x36996a[_0xfeca('0xe')][_0xfeca('0x53')]):intUtil[_0xfeca('0x54')](_0x36996a[_0xfeca('0x12')]);_0x36996a[_0xfeca('0x55')]=intUtil[_0xfeca('0x54')](_0x36996a[_0xfeca('0x55')]);_0x590aee[_0xfeca('0x4d')]=_0x50f1d6===_0xfeca('0x4e')||_0x50f1d6===_0xfeca('0x56')?_0xfeca('0x4e'):_0xfeca('0x2d');var _0x5de039=_0x36996a[_0xfeca('0xa')]?util[_0xfeca('0x50')](_0xfeca('0x57'),_0x36996a[_0xfeca('0xe')][_0xfeca('0x53')]):util[_0xfeca('0x50')](_0xfeca('0x57'),_0x36996a[_0xfeca('0x12')]);var _0x5ed87e=util[_0xfeca('0x50')]('https://login.microsoftonline.com/%s/oauth2/token',_0x36996a[_0xfeca('0xb')]);var _0x58f0ee=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36996a[_0xfeca('0x55')],_0xeaf7bd[_0xfeca('0x58')],md5(_0xeaf7bd[_0xfeca('0x58')]));if(_0x56d77f&&_0x56d77f['monitor_format']){logger[_0xfeca('0x29')](_0xfeca('0x59'),_0xfeca('0x5a'));_0xeaf7bd[_0xfeca('0x5b')]=_0x58f0ee;}else if(_0x1653b7&&_0x1653b7['recordingFormat']&&_0x1653b7['recordingFormat']!==_0xfeca('0x5c')){logger[_0xfeca('0x29')](_0xfeca('0x5d'),_0xfeca('0x5a'));_0xeaf7bd[_0xfeca('0x5b')]=_0x58f0ee;}else{_0xeaf7bd[_0xfeca('0x5b')]='';}return getUser(_0x590aee,_0x36996a,_0x5e427e,_0x5ed87e,_0x5de039,_0x50f1d6)['then'](function(_0x3b392d){logger[_0xfeca('0x29')]('['+_0x50f1d6[_0xfeca('0x19')]()+_0xfeca('0x5e'),_0x3b392d[_0xfeca('0x2b')]);logger[_0xfeca('0x29')]('['+_0x50f1d6[_0xfeca('0x19')]()+_0xfeca('0x5f'),_0x3b392d[_0xfeca('0x25')]);return getEndUser(_0x3b392d,_0x36996a,_0x5ed87e,_0x5de039,_0xeaf7bd,_0x50f1d6,_0x1f551c[_0xfeca('0x60')],_0x1f551c['additionalSearchContact']);})[_0xfeca('0x1c')](function(_0x10d754){logger[_0xfeca('0x29')]('['+_0x50f1d6['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x10d754['enduserId']);logger[_0xfeca('0x29')]('['+_0x50f1d6[_0xfeca('0x19')]()+']\x20The\x20Enduser\x20phone\x20is:',_0xeaf7bd[_0xfeca('0x2f')]);return getTicket(_0x10d754,_0x36996a,_0x5ed87e,_0x5de039,_0xeaf7bd,_0x1f551c,_0x50f1d6);})[_0xfeca('0x1c')](function(_0x38cc6d){logger[_0xfeca('0x29')](util['format']('['+_0x50f1d6[_0xfeca('0x19')]()+_0xfeca('0x61'),_0x1f551c[_0xfeca('0x4b')],_0x38cc6d[_0xfeca('0x62')]));logger[_0xfeca('0x29')](util['format']('['+_0x50f1d6['toUpperCase']()+_0xfeca('0x63'),_0x50f1d6));if(_0x50f1d6!==_0xfeca('0x56')&&_0x1f551c['openNewTab']){logger[_0xfeca('0x29')]('['+_0x50f1d6['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x36996a[_0xfeca('0x12')],_0x5e427e['name'],_0x1f551c[_0xfeca('0x4b')],_0x38cc6d[_0xfeca('0x62')]);}})[_0xfeca('0x17')](function(_0x476b5e){logger['error']('['+_0x50f1d6[_0xfeca('0x19')]()+_0xfeca('0x64'),_0x476b5e[_0xfeca('0x1b')]);console[_0xfeca('0x18')](_0xfeca('0x65'),_0x476b5e);});}; \ 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 44a59a5..62b362c 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 _0xa4f2=['toString','[HTTP]','defaults','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','push','idField','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','error','stringify','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','getString','Subjects','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0xa4f2,0x19d));var _0x2a4f=function(_0x3be82b,_0x3ef4fb){_0x3be82b=_0x3be82b-0x0;var _0x293c0e=_0xa4f2[_0x3be82b];return _0x293c0e;};'use strict';var _=require(_0x2a4f('0x0'));var rp=require(_0x2a4f('0x1'));var md5=require(_0x2a4f('0x2'));var util=require('util');var Redis=require(_0x2a4f('0x3'));var intUtil=require(_0x2a4f('0x4'));var config=require(_0x2a4f('0x5'));var logger=require(_0x2a4f('0x6'))(_0x2a4f('0x7'));config[_0x2a4f('0x8')]=_['defaults'](config[_0x2a4f('0x8')],{'host':_0x2a4f('0x9'),'port':0x18eb});var io=require(_0x2a4f('0xa'))(new Redis(config[_0x2a4f('0x8')]));var headers={'Content-Type':_0x2a4f('0xb'),'Accept':_0x2a4f('0xb')};function emit(_0x2bc56f,_0x49f090,_0x3e9a7f){io['to'](_0x2bc56f)[_0x2a4f('0xc')](_0x49f090,_0x3e9a7f);}function getTicket(_0x275013,_0x27ea59,_0x11c05e,_0x1b74bc,_0x4fd05a){logger[_0x2a4f('0xd')](_0x2a4f('0xe'));var _0x11e246=_[_0x2a4f('0xf')]({'responder_id':_0x27ea59['id'],'requester_id':_0x11c05e['id'],'name':util['format'](_0x2a4f('0x10'),_0x4fd05a[_0x2a4f('0x11')]),'phone':_0x4fd05a['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2a4f('0x12')](_0x1b74bc[_0x2a4f('0x13')],_0x4fd05a,'\x20'),'description':intUtil[_0x2a4f('0x12')](_0x1b74bc['Descriptions'],_0x4fd05a,_0x2a4f('0x14')),'tags':getTags(_0x1b74bc[_0x2a4f('0x15')],_0x2a4f('0x16'))},getCustomFields(_0x1b74bc[_0x2a4f('0x17')],_0x4fd05a));_0x11e246[_0x2a4f('0x18')]=_['mapValues'](_[_0x2a4f('0x19')](_0x11e246[_0x2a4f('0x18')],'id'),_0x2a4f('0x1a'));return request({'uri':util['format'](_0x2a4f('0x1b'),_0x275013[_0x2a4f('0x1c')]),'method':_0x2a4f('0x1d'),'body':_0x11e246})[_0x2a4f('0x1e')](function(_0x177877){logger['info'](_0x2a4f('0x1f'));return _0x177877;});}function getUser(_0x29d2f0,_0x3dfbf8){if(intUtil[_0x2a4f('0x20')](_0x3dfbf8)){return request({'uri':util[_0x2a4f('0x21')](_0x2a4f('0x22'),_0x29d2f0[_0x2a4f('0x1c')]),'qs':{'email':_0x3dfbf8}})[_0x2a4f('0x1e')](function(_0x18c0d9){if(_0x18c0d9[_0x2a4f('0x23')]){logger[_0x2a4f('0xd')]('Agent\x20found!');return _[_0x2a4f('0x24')](_0x18c0d9,function(_0x1c8530){return _0x1c8530[_0x2a4f('0x25')][_0x2a4f('0x26')]===_0x3dfbf8;});}else{logger[_0x2a4f('0xd')](_0x2a4f('0x27'));return request({'uri':util['format'](_0x2a4f('0x28'),_0x29d2f0['remoteUri'])})[_0x2a4f('0x1e')](function(_0x543ca5){logger['info']('Admin\x20account\x20selected.');return _0x543ca5;});}});}else{logger[_0x2a4f('0xd')](_0x2a4f('0x29'));return request({'uri':util[_0x2a4f('0x21')](_0x2a4f('0x28'),_0x29d2f0[_0x2a4f('0x1c')])})[_0x2a4f('0x1e')](function(_0x353c43){logger[_0x2a4f('0xd')](_0x2a4f('0x2a'));return _0x353c43;});}}function getEndUser(_0x1afa4d,_0x218634,_0x3ee99d){logger['info'](_0x2a4f('0x2b'),_0x3ee99d);return request({'uri':util['format']('%s/api/v2/contacts',_0x1afa4d['remoteUri']),'qs':{'phone':_0x3ee99d}})[_0x2a4f('0x1e')](function(_0x20c309){if(_0x20c309[_0x2a4f('0x23')]){logger[_0x2a4f('0xd')](_0x2a4f('0x2c'));return _[_0x2a4f('0x24')](_0x20c309,{'phone':_0x3ee99d});}else{logger['info'](_0x2a4f('0x2d'));return request({'uri':util[_0x2a4f('0x21')]('%s/api/v2/contacts',_0x1afa4d[_0x2a4f('0x1c')]),'method':_0x2a4f('0x1d'),'body':{'name':_0x218634,'phone':_0x3ee99d}})[_0x2a4f('0x1e')](function(_0x5d996c){logger[_0x2a4f('0xd')](_0x2a4f('0x2e'));return _0x5d996c;});}});}function getAuth(_0x18408e){return util[_0x2a4f('0x21')]('Basic\x20%s',new Buffer(_0x18408e['apiKey']+':X')[_0x2a4f('0x2f')]('base64'));}function request(_0xfac2b){logger['debug'](_0x2a4f('0x30'),JSON['stringify'](_0xfac2b));return rp(_[_0x2a4f('0x31')](_0xfac2b,{'method':_0x2a4f('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x22c3df,_0x2a5e8c){var _0x2922f8=[];if(_0x22c3df&&_0x22c3df[_0x2a4f('0x23')]>0x0){_0x2922f8=_[_0x2a4f('0x33')](_0x22c3df,_0x2a5e8c);}return _0x2922f8;}function getCustomFields(_0x307f5d,_0x462cdb){var _0x51394c=[];var _0x3323ad={'custom_fields':[]};if(_0x307f5d[_0x2a4f('0x23')]>0x0){_[_0x2a4f('0x34')](_0x307f5d,function(_0x499b7d){if(_['includes']([_0x2a4f('0x35'),_0x2a4f('0x36')],_0x499b7d[_0x2a4f('0x37')])&&_0x499b7d[_0x2a4f('0x38')]&&!_0x499b7d[_0x2a4f('0x39')]){_0x3323ad[_0x499b7d['nameField'][_0x2a4f('0x3a')]()]=_0x499b7d[_0x2a4f('0x3b')]['toString']();}else if(_['includes']([_0x2a4f('0x35'),_0x2a4f('0x36')],_0x499b7d[_0x2a4f('0x37')])&&_0x499b7d['idField']&&_0x499b7d[_0x2a4f('0x39')]){_0x3323ad['custom_fields'][_0x2a4f('0x3c')]({'id':_0x499b7d[_0x2a4f('0x3d')],'value':_0x499b7d['content'][_0x2a4f('0x2f')]()});}else if(_0x499b7d['type']==='variable'&&_0x499b7d[_0x2a4f('0x3e')]&&_0x499b7d[_0x2a4f('0x3d')]&&_0x499b7d['customField']){_0x462cdb[_0x499b7d[_0x2a4f('0x3e')]]&&_0x3323ad['custom_fields'][_0x2a4f('0x3c')]({'id':_0x499b7d[_0x2a4f('0x3d')],'value':_0x462cdb[_0x499b7d['variableName']]['toString']()});}else if(_0x499b7d[_0x2a4f('0x37')]===_0x2a4f('0x3f')&&_0x499b7d[_0x2a4f('0x40')]&&_0x499b7d[_0x2a4f('0x40')]['name']&&_0x499b7d['idField']&&_0x499b7d[_0x2a4f('0x39')]){_0x462cdb[_0x499b7d['Variable'][_0x2a4f('0x16')][_0x2a4f('0x3a')]()]&&_0x3323ad[_0x2a4f('0x18')][_0x2a4f('0x3c')]({'id':_0x499b7d['idField'],'value':_0x462cdb[_0x499b7d[_0x2a4f('0x40')][_0x2a4f('0x16')][_0x2a4f('0x3a')]()][_0x2a4f('0x2f')]()});}});}return _0x3323ad;}exports[_0x2a4f('0x41')]=function(_0x3b0160,_0x3a7065,_0x430a1e,_0x504d67,_0x1f6501,_0x3cbfd0){var _0x2bab1c,_0x59d831;_0x3cbfd0[_0x2a4f('0x1c')]=intUtil[_0x2a4f('0x42')](_0x3cbfd0[_0x2a4f('0x1c')]);_0x3cbfd0['serverUrl']=intUtil['stripTrailingSlash'](_0x3cbfd0[_0x2a4f('0x43')]);if(_0x1f6501&&_0x1f6501[_0x2a4f('0x44')]){logger['info']('[QUEUE]',_0x2a4f('0x45'));_0x3a7065[_0x2a4f('0x46')]=util['format'](_0x2a4f('0x47'),_0x3cbfd0[_0x2a4f('0x43')],_0x3a7065['uniqueid'],md5(_0x3a7065[_0x2a4f('0x48')]));}else{_0x3a7065['recordingURL']='';}headers[_0x2a4f('0x49')]=getAuth(_0x3cbfd0);return getUser(_0x3cbfd0,_0x504d67[_0x2a4f('0x26')])[_0x2a4f('0x1e')](function(_0x583c32){_0x2bab1c=_0x583c32;logger['info']('The\x20User\x20ID\x20is:',_0x2bab1c['id']);return getEndUser(_0x3cbfd0,_0x3a7065['calleridname'],_0x3a7065['calleridnum']);})[_0x2a4f('0x1e')](function(_0xc9ec0c){_0x59d831=_0xc9ec0c;logger['info'](_0x2a4f('0x4a'),_0x59d831['id']);return getTicket(_0x3cbfd0,_0x2bab1c,_0x59d831,_0x430a1e,_0x3a7065);})[_0x2a4f('0x1e')](function(_0x175076){if(_0x175076&&_0x175076['id']){logger[_0x2a4f('0xd')](_0x2a4f('0x1f'));logger[_0x2a4f('0xd')](_0x2a4f('0x4b'),_0x175076['id']);logger['info'](_0x2a4f('0x4c'),_0x2a4f('0x4d'));emit(util[_0x2a4f('0x21')](_0x2a4f('0x4e'),_0x504d67[_0x2a4f('0x16')]),_0x2a4f('0x4f'),{'uri':util[_0x2a4f('0x21')](_0x2a4f('0x50'),_0x3cbfd0['remoteUri'],_0x175076['id'])});}})[_0x2a4f('0x51')](function(_0x118ca3){logger['error'](_0x2a4f('0x4c'),JSON['stringify'](_0x118ca3));});};exports[_0x2a4f('0x52')]=function(_0x4c7d0a,_0x1aa981,_0x17b2e4,_0x194346,_0x4514d7,_0x1533c3,_0x1308d2){var _0x4a0bed,_0x3378b9;_0x1533c3[_0x2a4f('0x1c')]=intUtil['stripTrailingSlash'](_0x1533c3[_0x2a4f('0x1c')]);_0x1533c3[_0x2a4f('0x43')]=intUtil['stripTrailingSlash'](_0x1533c3[_0x2a4f('0x43')]);if(_0x1308d2&&_0x1308d2['recordingFormat']&&_0x1308d2[_0x2a4f('0x53')]!==_0x2a4f('0x54')){logger[_0x2a4f('0xd')](_0x2a4f('0x55'),_0x2a4f('0x45'));_0x1aa981['recordingURL']=util[_0x2a4f('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1533c3['serverUrl'],_0x1aa981[_0x2a4f('0x48')],md5(_0x1aa981['uniqueid']));}headers['Authorization']=getAuth(_0x1533c3);return getUser(_0x1533c3,_0x194346[_0x2a4f('0x26')])[_0x2a4f('0x1e')](function(_0x5a9ad6){_0x4a0bed=_0x5a9ad6;logger[_0x2a4f('0xd')](_0x2a4f('0x56'),_0x4a0bed['id']);return getEndUser(_0x1533c3,_0x1aa981[_0x2a4f('0x57')],_0x1aa981['destcalleridnum']);})[_0x2a4f('0x1e')](function(_0x2eaf1c){_0x3378b9=_0x2eaf1c;logger[_0x2a4f('0xd')](_0x2a4f('0x4a'),_0x3378b9['id']);return getTicket(_0x1533c3,_0x4a0bed,_0x3378b9,_0x17b2e4,_0x1aa981);})[_0x2a4f('0x1e')](function(_0x2581ab){if(_0x2581ab&&_0x2581ab['id']){logger[_0x2a4f('0xd')](_0x2a4f('0x1f'));logger[_0x2a4f('0xd')](_0x2a4f('0x4b'),_0x2581ab['id']);logger[_0x2a4f('0xd')](_0x2a4f('0x55'),_0x2a4f('0x4d'));emit(util['format'](_0x2a4f('0x4e'),_0x194346['name']),'trigger:browser:url',{'uri':util[_0x2a4f('0x21')](_0x2a4f('0x50'),_0x1533c3[_0x2a4f('0x1c')],_0x2581ab['id'])});}})[_0x2a4f('0x51')](function(_0x36df0d){logger[_0x2a4f('0x58')]('[OUTBOUND]',JSON[_0x2a4f('0x59')](_0x36df0d));});};exports['unmanaged']=function(_0x17fc48,_0x246093,_0x374615,_0x2409fe,_0x3862da,_0x2df84b){var _0x32ef3e,_0x4bbab5;_0x2df84b[_0x2a4f('0x1c')]=intUtil['stripTrailingSlash'](_0x2df84b[_0x2a4f('0x1c')]);_0x2df84b[_0x2a4f('0x43')]=intUtil[_0x2a4f('0x42')](_0x2df84b[_0x2a4f('0x43')]);if(_0x3862da&&_0x3862da[_0x2a4f('0x44')]){logger[_0x2a4f('0xd')]('['+_0x246093[_0x2a4f('0x5a')]['toUpperCase']()+']',_0x2a4f('0x45'));_0x246093[_0x2a4f('0x46')]=util[_0x2a4f('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2df84b[_0x2a4f('0x43')],_0x246093[_0x2a4f('0x48')],md5(_0x246093[_0x2a4f('0x48')]));}else{_0x246093[_0x2a4f('0x46')]='';}headers[_0x2a4f('0x49')]=getAuth(_0x2df84b);return getUser(_0x2df84b,'')[_0x2a4f('0x1e')](function(_0x16df9a){_0x32ef3e=_0x16df9a;logger[_0x2a4f('0xd')](_0x2a4f('0x56'),_0x32ef3e['id']);return getEndUser(_0x2df84b,_0x246093[_0x2a4f('0x11')],_0x246093['calleridnum']);})[_0x2a4f('0x1e')](function(_0x5a6398){_0x4bbab5=_0x5a6398;logger[_0x2a4f('0xd')](_0x2a4f('0x4a'),_0x4bbab5['id']);return getTicket(_0x2df84b,_0x32ef3e,_0x4bbab5,_0x374615,_0x246093);})['then'](function(_0x462e7e){if(_0x462e7e){logger[_0x2a4f('0xd')](_0x2a4f('0x1f'));logger[_0x2a4f('0xd')](_0x2a4f('0x4b'),_0x462e7e['id']);}})[_0x2a4f('0x51')](function(_0x11c7d2){logger[_0x2a4f('0x58')]('['+_0x246093[_0x2a4f('0x5a')][_0x2a4f('0x5b')]()+']',JSON[_0x2a4f('0x59')](_0x11c7d2));});}; \ No newline at end of file +var _0xb73e=['name','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','push','idField','variableName','customVariable','Variable'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xb73e,0x182));var _0xeb73=function(_0x19f0b2,_0x29eab4){_0x19f0b2=_0x19f0b2-0x0;var _0x16b56f=_0xb73e[_0x19f0b2];return _0x16b56f;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xeb73('0x0'));var util=require(_0xeb73('0x1'));var Redis=require(_0xeb73('0x2'));var intUtil=require(_0xeb73('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xeb73('0x4'));config[_0xeb73('0x5')]=_[_0xeb73('0x6')](config[_0xeb73('0x5')],{'host':_0xeb73('0x7'),'port':0x18eb});var io=require(_0xeb73('0x8'))(new Redis(config[_0xeb73('0x5')]));var headers={'Content-Type':_0xeb73('0x9'),'Accept':_0xeb73('0x9')};function emit(_0x39a92a,_0x1cae16,_0x521a9b){io['to'](_0x39a92a)['emit'](_0x1cae16,_0x521a9b);}function getTicket(_0x10a8a5,_0x3954fb,_0x3a03a6,_0x4b2bc8,_0x57dc18){logger['info'](_0xeb73('0xa'));var _0x9fe9f6=_[_0xeb73('0xb')]({'responder_id':_0x3954fb['id'],'requester_id':_0x3a03a6['id'],'name':util[_0xeb73('0xc')](_0xeb73('0xd'),_0x57dc18[_0xeb73('0xe')]),'phone':_0x57dc18[_0xeb73('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xeb73('0x10')](_0x4b2bc8['Subjects'],_0x57dc18,'\x20'),'description':intUtil[_0xeb73('0x10')](_0x4b2bc8['Descriptions'],_0x57dc18,_0xeb73('0x11')),'tags':getTags(_0x4b2bc8['Tags'],'name')},getCustomFields(_0x4b2bc8[_0xeb73('0x12')],_0x57dc18));_0x9fe9f6[_0xeb73('0x13')]=_['mapValues'](_[_0xeb73('0x14')](_0x9fe9f6[_0xeb73('0x13')],'id'),_0xeb73('0x15'));return request({'uri':util[_0xeb73('0xc')](_0xeb73('0x16'),_0x10a8a5[_0xeb73('0x17')]),'method':_0xeb73('0x18'),'body':_0x9fe9f6})[_0xeb73('0x19')](function(_0x500ed9){logger[_0xeb73('0x1a')](_0xeb73('0x1b'));return _0x500ed9;});}function getUser(_0x1acd67,_0x1d648f){if(intUtil[_0xeb73('0x1c')](_0x1d648f)){return request({'uri':util[_0xeb73('0xc')](_0xeb73('0x1d'),_0x1acd67['remoteUri']),'qs':{'email':_0x1d648f}})[_0xeb73('0x19')](function(_0x1d8669){if(_0x1d8669['length']){logger['info']('Agent\x20found!');return _[_0xeb73('0x1e')](_0x1d8669,function(_0x3c0042){return _0x3c0042[_0xeb73('0x1f')][_0xeb73('0x20')]===_0x1d648f;});}else{logger[_0xeb73('0x1a')](_0xeb73('0x21'));return request({'uri':util[_0xeb73('0xc')](_0xeb73('0x22'),_0x1acd67['remoteUri'])})[_0xeb73('0x19')](function(_0x4a29cd){logger[_0xeb73('0x1a')](_0xeb73('0x23'));return _0x4a29cd;});}});}else{logger['info'](_0xeb73('0x24'));return request({'uri':util[_0xeb73('0xc')](_0xeb73('0x22'),_0x1acd67[_0xeb73('0x17')])})['then'](function(_0x59b82c){logger[_0xeb73('0x1a')](_0xeb73('0x23'));return _0x59b82c;});}}function getEndUser(_0x39eda0,_0x1a9c19,_0x12c2d5){logger['info']('Searching\x20enduser\x20with\x20phone',_0x12c2d5);return request({'uri':util[_0xeb73('0xc')](_0xeb73('0x25'),_0x39eda0[_0xeb73('0x17')]),'qs':{'phone':_0x12c2d5}})['then'](function(_0x3465ca){if(_0x3465ca[_0xeb73('0x26')]){logger['info'](_0xeb73('0x27'));return _[_0xeb73('0x1e')](_0x3465ca,{'phone':_0x12c2d5});}else{logger['info'](_0xeb73('0x28'));return request({'uri':util[_0xeb73('0xc')](_0xeb73('0x25'),_0x39eda0['remoteUri']),'method':'POST','body':{'name':_0x1a9c19,'phone':_0x12c2d5}})[_0xeb73('0x19')](function(_0x124c18){logger[_0xeb73('0x1a')](_0xeb73('0x29'));return _0x124c18;});}});}function getAuth(_0x3ead77){return util['format']('Basic\x20%s',new Buffer(_0x3ead77[_0xeb73('0x2a')]+':X')[_0xeb73('0x2b')](_0xeb73('0x2c')));}function request(_0x2e57ac){logger[_0xeb73('0x2d')](_0xeb73('0x2e'),JSON[_0xeb73('0x2f')](_0x2e57ac));return rp(_['defaults'](_0x2e57ac,{'method':_0xeb73('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x15e069,_0x4653c2){var _0x5b1928=[];if(_0x15e069&&_0x15e069['length']>0x0){_0x5b1928=_[_0xeb73('0x31')](_0x15e069,_0x4653c2);}return _0x5b1928;}function getCustomFields(_0x1c2b89,_0x3b7be6){var _0x44f869=[];var _0x3ea56e={'custom_fields':[]};if(_0x1c2b89[_0xeb73('0x26')]>0x0){_[_0xeb73('0x32')](_0x1c2b89,function(_0x4a0c9b){if(_[_0xeb73('0x33')]([_0xeb73('0x34'),_0xeb73('0x35')],_0x4a0c9b[_0xeb73('0x36')])&&_0x4a0c9b[_0xeb73('0x37')]&&!_0x4a0c9b[_0xeb73('0x38')]){_0x3ea56e[_0x4a0c9b[_0xeb73('0x37')][_0xeb73('0x39')]()]=_0x4a0c9b[_0xeb73('0x3a')][_0xeb73('0x2b')]();}else if(_[_0xeb73('0x33')]([_0xeb73('0x34'),_0xeb73('0x35')],_0x4a0c9b['type'])&&_0x4a0c9b['idField']&&_0x4a0c9b[_0xeb73('0x38')]){_0x3ea56e[_0xeb73('0x13')][_0xeb73('0x3b')]({'id':_0x4a0c9b[_0xeb73('0x3c')],'value':_0x4a0c9b[_0xeb73('0x3a')][_0xeb73('0x2b')]()});}else if(_0x4a0c9b['type']==='variable'&&_0x4a0c9b[_0xeb73('0x3d')]&&_0x4a0c9b[_0xeb73('0x3c')]&&_0x4a0c9b[_0xeb73('0x38')]){_0x3b7be6[_0x4a0c9b[_0xeb73('0x3d')]]&&_0x3ea56e[_0xeb73('0x13')][_0xeb73('0x3b')]({'id':_0x4a0c9b[_0xeb73('0x3c')],'value':_0x3b7be6[_0x4a0c9b[_0xeb73('0x3d')]][_0xeb73('0x2b')]()});}else if(_0x4a0c9b['type']===_0xeb73('0x3e')&&_0x4a0c9b[_0xeb73('0x3f')]&&_0x4a0c9b['Variable']['name']&&_0x4a0c9b['idField']&&_0x4a0c9b[_0xeb73('0x38')]){_0x3b7be6[_0x4a0c9b['Variable'][_0xeb73('0x40')][_0xeb73('0x39')]()]&&_0x3ea56e['custom_fields'][_0xeb73('0x3b')]({'id':_0x4a0c9b[_0xeb73('0x3c')],'value':_0x3b7be6[_0x4a0c9b[_0xeb73('0x3f')][_0xeb73('0x40')][_0xeb73('0x39')]()][_0xeb73('0x2b')]()});}});}return _0x3ea56e;}exports['queue']=function(_0x506bcb,_0x44fc27,_0x1b95c4,_0x11a09a,_0x185ccf,_0x5846dd){var _0x17f0b3,_0x16f665;_0x5846dd[_0xeb73('0x17')]=intUtil[_0xeb73('0x41')](_0x5846dd[_0xeb73('0x17')]);_0x5846dd[_0xeb73('0x42')]=intUtil[_0xeb73('0x41')](_0x5846dd['serverUrl']);if(_0x185ccf&&_0x185ccf['monitor_format']){logger[_0xeb73('0x1a')](_0xeb73('0x43'),'Recording\x20is\x20enabled!');_0x44fc27[_0xeb73('0x44')]=util[_0xeb73('0xc')](_0xeb73('0x45'),_0x5846dd['serverUrl'],_0x44fc27[_0xeb73('0x46')],md5(_0x44fc27[_0xeb73('0x46')]));}else{_0x44fc27[_0xeb73('0x44')]='';}headers[_0xeb73('0x47')]=getAuth(_0x5846dd);return getUser(_0x5846dd,_0x11a09a[_0xeb73('0x20')])[_0xeb73('0x19')](function(_0xc95102){_0x17f0b3=_0xc95102;logger['info'](_0xeb73('0x48'),_0x17f0b3['id']);return getEndUser(_0x5846dd,_0x44fc27[_0xeb73('0xe')],_0x44fc27[_0xeb73('0xf')]);})[_0xeb73('0x19')](function(_0x17c6d2){_0x16f665=_0x17c6d2;logger[_0xeb73('0x1a')](_0xeb73('0x49'),_0x16f665['id']);return getTicket(_0x5846dd,_0x17f0b3,_0x16f665,_0x1b95c4,_0x44fc27);})['then'](function(_0x478f5a){if(_0x478f5a&&_0x478f5a['id']){logger[_0xeb73('0x1a')]('Ticket\x20created!');logger[_0xeb73('0x1a')](_0xeb73('0x4a'),_0x478f5a['id']);logger['info'](_0xeb73('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x11a09a[_0xeb73('0x40')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x5846dd[_0xeb73('0x17')],_0x478f5a['id'])});}})[_0xeb73('0x4b')](function(_0x171f67){logger[_0xeb73('0x4c')](_0xeb73('0x43'),JSON[_0xeb73('0x2f')](_0x171f67));});};exports[_0xeb73('0x4d')]=function(_0x129ce2,_0x5268ca,_0x162923,_0x1b4870,_0x4f5e44,_0xfbb342,_0x415bc3){var _0x585065,_0x272bdd;_0xfbb342[_0xeb73('0x17')]=intUtil[_0xeb73('0x41')](_0xfbb342[_0xeb73('0x17')]);_0xfbb342[_0xeb73('0x42')]=intUtil[_0xeb73('0x41')](_0xfbb342['serverUrl']);if(_0x415bc3&&_0x415bc3[_0xeb73('0x4e')]&&_0x415bc3[_0xeb73('0x4e')]!==_0xeb73('0x4f')){logger['info'](_0xeb73('0x50'),'Recording\x20is\x20enabled!');_0x5268ca[_0xeb73('0x44')]=util[_0xeb73('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfbb342['serverUrl'],_0x5268ca['uniqueid'],md5(_0x5268ca[_0xeb73('0x46')]));}headers[_0xeb73('0x47')]=getAuth(_0xfbb342);return getUser(_0xfbb342,_0x1b4870[_0xeb73('0x20')])[_0xeb73('0x19')](function(_0x2dbb04){_0x585065=_0x2dbb04;logger[_0xeb73('0x1a')]('The\x20User\x20ID\x20is:',_0x585065['id']);return getEndUser(_0xfbb342,_0x5268ca['destcalleridname'],_0x5268ca[_0xeb73('0x51')]);})['then'](function(_0x46d711){_0x272bdd=_0x46d711;logger[_0xeb73('0x1a')](_0xeb73('0x49'),_0x272bdd['id']);return getTicket(_0xfbb342,_0x585065,_0x272bdd,_0x162923,_0x5268ca);})[_0xeb73('0x19')](function(_0x5412fe){if(_0x5412fe&&_0x5412fe['id']){logger['info'](_0xeb73('0x1b'));logger[_0xeb73('0x1a')](_0xeb73('0x4a'),_0x5412fe['id']);logger['info']('[OUTBOUND]',_0xeb73('0x52'));emit(util[_0xeb73('0xc')]('user:%s',_0x1b4870[_0xeb73('0x40')]),_0xeb73('0x53'),{'uri':util[_0xeb73('0xc')](_0xeb73('0x54'),_0xfbb342[_0xeb73('0x17')],_0x5412fe['id'])});}})[_0xeb73('0x4b')](function(_0xc0b94a){logger[_0xeb73('0x4c')](_0xeb73('0x50'),JSON['stringify'](_0xc0b94a));});};exports[_0xeb73('0x55')]=function(_0x46f520,_0x5068a4,_0x10895b,_0x282e9a,_0x5d1cb7,_0x208c45){var _0xaf9ef2,_0x94858f;_0x208c45[_0xeb73('0x17')]=intUtil[_0xeb73('0x41')](_0x208c45['remoteUri']);_0x208c45[_0xeb73('0x42')]=intUtil[_0xeb73('0x41')](_0x208c45[_0xeb73('0x42')]);if(_0x5d1cb7&&_0x5d1cb7[_0xeb73('0x56')]){logger[_0xeb73('0x1a')]('['+_0x5068a4[_0xeb73('0x57')][_0xeb73('0x58')]()+']',_0xeb73('0x59'));_0x5068a4[_0xeb73('0x44')]=util['format'](_0xeb73('0x45'),_0x208c45[_0xeb73('0x42')],_0x5068a4[_0xeb73('0x46')],md5(_0x5068a4[_0xeb73('0x46')]));}else{_0x5068a4[_0xeb73('0x44')]='';}headers[_0xeb73('0x47')]=getAuth(_0x208c45);return getUser(_0x208c45,'')[_0xeb73('0x19')](function(_0x331332){_0xaf9ef2=_0x331332;logger[_0xeb73('0x1a')](_0xeb73('0x48'),_0xaf9ef2['id']);return getEndUser(_0x208c45,_0x5068a4[_0xeb73('0xe')],_0x5068a4[_0xeb73('0xf')]);})[_0xeb73('0x19')](function(_0x331137){_0x94858f=_0x331137;logger[_0xeb73('0x1a')](_0xeb73('0x49'),_0x94858f['id']);return getTicket(_0x208c45,_0xaf9ef2,_0x94858f,_0x10895b,_0x5068a4);})[_0xeb73('0x19')](function(_0x231dbb){if(_0x231dbb){logger[_0xeb73('0x1a')](_0xeb73('0x1b'));logger['info'](_0xeb73('0x4a'),_0x231dbb['id']);}})['catch'](function(_0x9ee7c9){logger[_0xeb73('0x4c')]('['+_0x5068a4[_0xeb73('0x57')][_0xeb73('0x58')]()+']',JSON['stringify'](_0x9ee7c9));});}; \ 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 0169f7c..0676012 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 _0xeefe=['util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET','headers','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','catch','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','ticketId','task','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','md5'];(function(_0x5d07fc,_0x5dbd72){var _0x32a519=function(_0x55c421){while(--_0x55c421){_0x5d07fc['push'](_0x5d07fc['shift']());}};_0x32a519(++_0x5dbd72);}(_0xeefe,0xab));var _0xeeef=function(_0x12edf4,_0x27b6af){_0x12edf4=_0x12edf4-0x0;var _0x3ed39d=_0xeefe[_0x12edf4];return _0x3ed39d;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xeeef('0x0'));var util=require(_0xeeef('0x1'));var moment=require(_0xeeef('0x2'));var Promise=require(_0xeeef('0x3'));var Redis=require('ioredis');var intUtil=require(_0xeeef('0x4'));var config=require(_0xeeef('0x5'));var logger=require(_0xeeef('0x6'))('freshsales');config[_0xeeef('0x7')]=_[_0xeeef('0x8')](config[_0xeeef('0x7')],{'host':_0xeeef('0x9'),'port':0x18eb});var io=require(_0xeeef('0xa'))(new Redis(config[_0xeeef('0x7')]));function getAdminId(_0x4673b7,_0xa28b41,_0x27ed49,_0x3129a9){return new Promise(function(_0x114571,_0x42a186){var _0x28e6fc=![];var _0x57b263={'method':'GET','uri':_0x3129a9+_0xeeef('0xb'),'json':!![]};_0x57b263['headers']=_0x27ed49;logger[_0xeeef('0xc')](_0xeeef('0xd'));return rp(_0x57b263)[_0xeeef('0xe')](function(_0x1ad0fb){if(_0x1ad0fb){var _0x3d0baf=_0x1ad0fb[_0xeeef('0xf')];var _0xbb5d37=null;for(_0xbb5d37=0x0;_0xbb5d37<_0x3d0baf[_0xeeef('0x10')];_0xbb5d37++){if(_0x3d0baf[_0xbb5d37][_0xeeef('0x11')]===_0x4673b7[_0xeeef('0x12')]){_0x4673b7[_0xeeef('0x13')]=_0x3d0baf[_0xbb5d37]['id'];_0x28e6fc=!![];}}if(_0x28e6fc){logger['info'](_0xeeef('0x14'),_0x4673b7['adminId']);_0x114571(_0x4673b7);}else{_0x42a186({'statusCode':0x194,'message':_0xeeef('0x15')});}}else{_0x42a186({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x4d0f88){logger[_0xeeef('0x16')]('['+[_0xa28b41[_0xeeef('0x17')]()]+']',_0x4d0f88[_0xeeef('0x18')]);_0x42a186(_0x4d0f88);});});}function getUser(_0x55d5ca,_0x4df490,_0x284cc7){return function(_0x349226){return new Promise(function(_0x3a7c21,_0x3ac426){var _0x117925={'method':_0xeeef('0x19'),'uri':_0x284cc7+_0xeeef('0xb'),'json':!![]};_0x117925[_0xeeef('0x1a')]=_0x4df490;logger['info']('Getting\x20user\x20list');return rp(_0x117925)[_0xeeef('0xe')](function(_0x4e430d){if(_0x4e430d){var _0x1edb3e=_0x4e430d[_0xeeef('0xf')];var _0x4ac682=![];var _0xaaff1c=null;if(_0x349226[_0xeeef('0x1b')]!==null){logger['info'](_0xeeef('0x1c'),_0x349226['agentEmail']);_0x349226['userEmail']=_0x349226['agentEmail'];for(_0xaaff1c=0x0;_0xaaff1c<_0x1edb3e[_0xeeef('0x10')];_0xaaff1c++){if(_0x1edb3e[_0xaaff1c][_0xeeef('0x11')]===_0x349226[_0xeeef('0x1b')]){_0x4ac682=!![];_0x349226[_0xeeef('0x1d')]=_0x1edb3e[_0xaaff1c]['id'];logger['info'](_0xeeef('0x1e'),_0x349226[_0xeeef('0x1d')]);}}}if(!_0x4ac682){logger[_0xeeef('0xc')](_0xeeef('0x1f'));_0x349226[_0xeeef('0x20')]=_0x349226[_0xeeef('0x12')];_0x349226[_0xeeef('0x1d')]=_0x349226[_0xeeef('0x13')];_0x4ac682=!![];}if(_0x4ac682){_0x3a7c21(_0x349226);}else{_0x3ac426({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3ac426({'statusCode':0x194,'message':_0xeeef('0x15')});}})[_0xeeef('0x21')](function(_0x2af7fa){logger[_0xeeef('0x16')]('['+[_0x55d5ca[_0xeeef('0x17')]()]+']',_0x2af7fa[_0xeeef('0x18')]);_0x3ac426(_0x2af7fa);});});};}function searchContact(_0x2ba883,_0x2c177a,_0x30664d,_0x3a274d){return new Promise(function(_0x19f88a,_0x751c61){var _0x52aa17={'method':_0xeeef('0x19'),'headers':_0x2c177a,'uri':_0x2ba883+_0xeeef('0x22')+_0x3a274d+'&f='+_0x30664d+_0xeeef('0x23'),'json':!![]};rp(_0x52aa17)[_0xeeef('0xe')](function(_0x48dafc){var _0x469d86=_[_0xeeef('0x24')](_0x48dafc['contacts'][_0xeeef('0x25')],[_0x30664d,_0x3a274d]);_0x19f88a(_0x469d86);})[_0xeeef('0x21')](function(_0x5929e8){_0x751c61(_0x5929e8);});});}function getEndUser(_0x5d4ea0,_0x541025,_0x5149f9){return function(_0x1481cd){return new Promise(function(_0x28142b,_0x1e4b1c){logger[_0xeeef('0xc')](util[_0xeeef('0x26')](_0xeeef('0x27'),_0x1481cd[_0xeeef('0x28')]));searchContact(_0x5149f9,_0x541025,_0xeeef('0x29'),_0x1481cd['contactNumber'])[_0xeeef('0xe')](function(_0x36bc69){if(_0x36bc69){_0x1481cd[_0xeeef('0x2a')]=_0x36bc69['id'];logger[_0xeeef('0xc')](_0xeeef('0x2b'),_0x1481cd[_0xeeef('0x2a')]);return _0x28142b(_0x1481cd);}searchContact(_0x5149f9,_0x541025,_0xeeef('0x2c'),_0x1481cd['contactNumber'])[_0xeeef('0xe')](function(_0x62050e){if(_0x62050e){_0x1481cd[_0xeeef('0x2a')]=_0x62050e['id'];logger['info'](_0xeeef('0x2d'),_0x1481cd[_0xeeef('0x2a')]);return _0x28142b(_0x1481cd);}createEndUser(_0x1481cd,_0x5d4ea0,_0x541025,_0x5149f9)[_0xeeef('0xe')](function(_0x492cfd){logger[_0xeeef('0xc')](_0xeeef('0x2e'),_0x492cfd['endUserId']);return _0x28142b(_0x492cfd);});});})[_0xeeef('0x21')](function(_0x4d9e8f){_0x1e4b1c(_0x4d9e8f);});});};}function createEndUser(_0xace7a1,_0x32ed35,_0x1f4f7b,_0x188176){return new Promise(function(_0x2928e4,_0x4b25c8){var _0x128ef0=moment();var _0x57fb2a={'method':_0xeeef('0x2f'),'uri':_0x188176+'/api/contacts','body':{'contact':{'last_name':_0xace7a1[_0xeeef('0x28')],'work_number':_0xace7a1[_0xeeef('0x28')],'mobile_number':_0xace7a1[_0xeeef('0x28')],'owner_id':_0xace7a1[_0xeeef('0x1d')],'created_at':_0x128ef0[_0xeeef('0x26')](_0xeeef('0x30'))}},'json':!![]};_0x57fb2a[_0xeeef('0x1a')]=_0x1f4f7b;logger[_0xeeef('0xc')](_0xeeef('0x31'));return rp(_0x57fb2a)['then'](function(_0x5c63e4){_0xace7a1[_0xeeef('0x2a')]=_0x5c63e4[_0xeeef('0x32')]['id'];_0x2928e4(_0xace7a1);})[_0xeeef('0x21')](function(_0x58e61c){logger[_0xeeef('0x16')]('['+[_0x32ed35[_0xeeef('0x17')]()]+']',_0x58e61c['message']);_0x4b25c8(_0x58e61c['message']);});});}function getTicket(_0x419645,_0x1e7424,_0x3e4edb,_0x401df3,_0x18a556){return function(_0x3745e8){logger['info'](_0xeeef('0x33'));return new Promise(function(_0x4f0c30,_0x51aedc){var _0x12cf85=moment();var _0x48cc12={'method':_0xeeef('0x2f'),'uri':_0x3e4edb+_0xeeef('0x34'),'body':{'title':intUtil[_0xeeef('0x35')](_0x401df3[_0xeeef('0x36')],_0x18a556,'\x20'),'description':intUtil['getString'](_0x401df3[_0xeeef('0x37')],_0x18a556,'\x0a'),'owner_id':_0x3745e8[_0xeeef('0x1d')],'creater_id':_0x3745e8[_0xeeef('0x13')],'targetable_id':_0x3745e8[_0xeeef('0x2a')],'targetable_type':'Contact','created_at':_0x12cf85[_0xeeef('0x26')](_0xeeef('0x30')),'due_date':_0x12cf85['add'](0x1e,'m')[_0xeeef('0x26')](_0xeeef('0x30'))},'json':!![]};_0x48cc12['headers']=_0x1e7424;return rp(_0x48cc12)[_0xeeef('0xe')](function(_0x15f158){_0x3745e8[_0xeeef('0x38')]=_0x15f158[_0xeeef('0x39')]['id'];logger[_0xeeef('0xc')]('Task\x20created:',_0x3745e8['ticketId']);_0x4f0c30(_0x3745e8);})[_0xeeef('0x21')](function(_0x1812dc){logger[_0xeeef('0x16')]('['+[_0x419645[_0xeeef('0x17')]()]+']',_0x1812dc[_0xeeef('0x18')]);_0x51aedc(_0x1812dc[_0xeeef('0x18')]);});});};}function emit(_0x43ebde,_0x509257,_0x2cc049){var _0x5f33f5={'uri':_0x43ebde+_0xeeef('0x3a')+_0x2cc049};io['to'](util[_0xeeef('0x26')](_0xeeef('0x3b'),_0x509257))['emit'](_0xeeef('0x3c'),_0x5f33f5);}exports['cs']=function(_0x1a35d3,_0x3e9844,_0x40a406,_0x2e23fa,_0x2ab277,_0x3a5134,_0x476e92,_0x84fd1f){var _0x2c271c={};var _0x45fd0f={'Authorization':_0xeeef('0x3d')+_0x3a5134[_0xeeef('0x3e')]};_0x3a5134[_0xeeef('0x3f')]=intUtil[_0xeeef('0x40')](_0x3a5134[_0xeeef('0x3f')]);_0x3a5134[_0xeeef('0x41')]=intUtil[_0xeeef('0x40')](_0x3a5134['serverUrl']);var _0x35f043=_0x3a5134[_0xeeef('0x3f')];_0x2c271c[_0xeeef('0x12')]=_0x3a5134['username'];_0x2c271c[_0xeeef('0x28')]=_0x84fd1f[_0xeeef('0x42')]()===_0xeeef('0x43')?_0x3e9844[_0xeeef('0x44')]:_0x3e9844[_0xeeef('0x45')];_0x2c271c[_0xeeef('0x46')]=_0x84fd1f===_0xeeef('0x47')||_0x84fd1f===_0xeeef('0x48')?'queue':_0xeeef('0x43');if(_0x2e23fa){_0x2c271c['agentEmail']=_0x2e23fa[_0xeeef('0x11')];}var _0x2fb575=util[_0xeeef('0x26')](_0xeeef('0x49'),_0x3a5134[_0xeeef('0x41')],_0x3e9844[_0xeeef('0x4a')],md5(_0x3e9844[_0xeeef('0x4a')]));if(_0x2ab277&&_0x2ab277[_0xeeef('0x4b')]){logger[_0xeeef('0xc')](_0xeeef('0x4c'),_0xeeef('0x4d'));_0x3e9844[_0xeeef('0x4e')]=_0x2fb575;}else if(_0x476e92&&_0x476e92[_0xeeef('0x4f')]&&_0x476e92[_0xeeef('0x4f')]!==_0xeeef('0x50')){logger[_0xeeef('0xc')](_0xeeef('0x51'),'Recording\x20is\x20enabled!');_0x3e9844['recordingURL']=_0x2fb575;}else{_0x3e9844[_0xeeef('0x4e')]='';}return getAdminId(_0x2c271c,_0x84fd1f,_0x45fd0f,_0x35f043)[_0xeeef('0xe')](getUser(_0x84fd1f,_0x45fd0f,_0x35f043))[_0xeeef('0xe')](getEndUser(_0x84fd1f,_0x45fd0f,_0x35f043))[_0xeeef('0xe')](getTicket(_0x84fd1f,_0x45fd0f,_0x35f043,_0x40a406,_0x3e9844))[_0xeeef('0xe')](function(_0x2c0546){logger[_0xeeef('0xc')](util['format'](_0xeeef('0x52'),_0x2c0546['ticketId']));if(_0x84fd1f!==_0xeeef('0x48')){logger[_0xeeef('0xc')]('['+[_0x84fd1f[_0xeeef('0x17')]()]+']',_0xeeef('0x53'));emit(_0x35f043,_0x2e23fa[_0xeeef('0x54')],_0x2c0546[_0xeeef('0x2a')]);}})[_0xeeef('0x21')](function(_0x3049a7){logger[_0xeeef('0x16')]('['+[_0x84fd1f[_0xeeef('0x17')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xeeef('0x55')](_0x3049a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7888=['email','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','error','GET','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Contact','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','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','moment','bluebird','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length'];(function(_0xb0d406,_0x303526){var _0x206cb3=function(_0x3d4299){while(--_0x3d4299){_0xb0d406['push'](_0xb0d406['shift']());}};_0x206cb3(++_0x303526);}(_0x7888,0x1e7));var _0x8788=function(_0x1ef64f,_0x26a0ca){_0x1ef64f=_0x1ef64f-0x0;var _0x2598bc=_0x7888[_0x1ef64f];return _0x2598bc;};'use strict';var _=require(_0x8788('0x0'));var rp=require(_0x8788('0x1'));var md5=require(_0x8788('0x2'));var util=require('util');var moment=require(_0x8788('0x3'));var Promise=require(_0x8788('0x4'));var Redis=require('ioredis');var intUtil=require(_0x8788('0x5'));var config=require(_0x8788('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0x8788('0x7')]=_[_0x8788('0x8')](config['redis'],{'host':_0x8788('0x9'),'port':0x18eb});var io=require(_0x8788('0xa'))(new Redis(config[_0x8788('0x7')]));function getAdminId(_0x459f65,_0x278533,_0x533797,_0x37afbc){return new Promise(function(_0x3ed2a5,_0x499bcc){var _0x9b698a=![];var _0x33905e={'method':'GET','uri':_0x37afbc+_0x8788('0xb'),'json':!![]};_0x33905e[_0x8788('0xc')]=_0x533797;logger['info'](_0x8788('0xd'));return rp(_0x33905e)[_0x8788('0xe')](function(_0x3f07d7){if(_0x3f07d7){var _0xbc1826=_0x3f07d7[_0x8788('0xf')];var _0xa397f6=null;for(_0xa397f6=0x0;_0xa397f6<_0xbc1826[_0x8788('0x10')];_0xa397f6++){if(_0xbc1826[_0xa397f6][_0x8788('0x11')]===_0x459f65[_0x8788('0x12')]){_0x459f65[_0x8788('0x13')]=_0xbc1826[_0xa397f6]['id'];_0x9b698a=!![];}}if(_0x9b698a){logger[_0x8788('0x14')]('Admin\x20found:',_0x459f65['adminId']);_0x3ed2a5(_0x459f65);}else{_0x499bcc({'statusCode':0x194,'message':_0x8788('0x15')});}}else{_0x499bcc({'statusCode':0x194,'message':_0x8788('0x15')});}})[_0x8788('0x16')](function(_0x54e87b){logger['error']('['+[_0x278533[_0x8788('0x17')]()]+']',_0x54e87b[_0x8788('0x18')]);_0x499bcc(_0x54e87b);});});}function getUser(_0x42fb0e,_0x1ca35e,_0x4f2535){return function(_0x1b4e54){return new Promise(function(_0x360a13,_0x2a6e1a){var _0x30b45e={'method':'GET','uri':_0x4f2535+_0x8788('0xb'),'json':!![]};_0x30b45e[_0x8788('0xc')]=_0x1ca35e;logger[_0x8788('0x14')]('Getting\x20user\x20list');return rp(_0x30b45e)[_0x8788('0xe')](function(_0x830f3f){if(_0x830f3f){var _0x4f2547=_0x830f3f[_0x8788('0xf')];var _0x182927=![];var _0xd53a7=null;if(_0x1b4e54['agentEmail']!==null){logger[_0x8788('0x14')]('Getting\x20user\x20with\x20email',_0x1b4e54[_0x8788('0x19')]);_0x1b4e54[_0x8788('0x1a')]=_0x1b4e54['agentEmail'];for(_0xd53a7=0x0;_0xd53a7<_0x4f2547[_0x8788('0x10')];_0xd53a7++){if(_0x4f2547[_0xd53a7][_0x8788('0x11')]===_0x1b4e54[_0x8788('0x19')]){_0x182927=!![];_0x1b4e54[_0x8788('0x1b')]=_0x4f2547[_0xd53a7]['id'];logger[_0x8788('0x14')](_0x8788('0x1c'),_0x1b4e54['userId']);}}}if(!_0x182927){logger['info'](_0x8788('0x1d'));_0x1b4e54[_0x8788('0x1a')]=_0x1b4e54[_0x8788('0x12')];_0x1b4e54['userId']=_0x1b4e54['adminId'];_0x182927=!![];}if(_0x182927){_0x360a13(_0x1b4e54);}else{_0x2a6e1a({'statusCode':0x194,'message':_0x8788('0x15')});}}else{_0x2a6e1a({'statusCode':0x194,'message':_0x8788('0x15')});}})[_0x8788('0x16')](function(_0x1b899b){logger[_0x8788('0x1e')]('['+[_0x42fb0e[_0x8788('0x17')]()]+']',_0x1b899b[_0x8788('0x18')]);_0x2a6e1a(_0x1b899b);});});};}function searchContact(_0xa348a7,_0x7abac,_0x480d50,_0x1146f2){return new Promise(function(_0x4106f5,_0x473413){var _0x21d61c={'method':_0x8788('0x1f'),'headers':_0x7abac,'uri':_0xa348a7+_0x8788('0x20')+_0x1146f2+_0x8788('0x21')+_0x480d50+_0x8788('0x22'),'json':!![]};rp(_0x21d61c)[_0x8788('0xe')](function(_0x1a81d0){var _0x2869e3=_[_0x8788('0x23')](_0x1a81d0[_0x8788('0x24')][_0x8788('0x24')],[_0x480d50,_0x1146f2]);_0x4106f5(_0x2869e3);})[_0x8788('0x16')](function(_0x11296e){_0x473413(_0x11296e);});});}function getEndUser(_0x37c6ba,_0x438708,_0x5ec659){return function(_0xf331e3){return new Promise(function(_0x148ad1,_0x26ad9b){logger[_0x8788('0x14')](util[_0x8788('0x25')](_0x8788('0x26'),_0xf331e3[_0x8788('0x27')]));searchContact(_0x5ec659,_0x438708,'mobile_number',_0xf331e3['contactNumber'])[_0x8788('0xe')](function(_0x27aeca){if(_0x27aeca){_0xf331e3[_0x8788('0x28')]=_0x27aeca['id'];logger[_0x8788('0x14')](_0x8788('0x29'),_0xf331e3['endUserId']);return _0x148ad1(_0xf331e3);}searchContact(_0x5ec659,_0x438708,'work_number',_0xf331e3[_0x8788('0x27')])['then'](function(_0x3d74f6){if(_0x3d74f6){_0xf331e3[_0x8788('0x28')]=_0x3d74f6['id'];logger['info'](_0x8788('0x2a'),_0xf331e3[_0x8788('0x28')]);return _0x148ad1(_0xf331e3);}createEndUser(_0xf331e3,_0x37c6ba,_0x438708,_0x5ec659)[_0x8788('0xe')](function(_0x17cee1){logger[_0x8788('0x14')]('Contact\x20created:',_0x17cee1['endUserId']);return _0x148ad1(_0x17cee1);});});})['catch'](function(_0x1536f5){_0x26ad9b(_0x1536f5);});});};}function createEndUser(_0x320377,_0x541fc0,_0x57cfff,_0x30ec25){return new Promise(function(_0x407674,_0xa209ae){var _0x5a94c5=moment();var _0x1b14ba={'method':'POST','uri':_0x30ec25+_0x8788('0x2b'),'body':{'contact':{'last_name':_0x320377[_0x8788('0x27')],'work_number':_0x320377[_0x8788('0x27')],'mobile_number':_0x320377[_0x8788('0x27')],'owner_id':_0x320377['userId'],'created_at':_0x5a94c5['format'](_0x8788('0x2c'))}},'json':!![]};_0x1b14ba[_0x8788('0xc')]=_0x57cfff;logger['info'](_0x8788('0x2d'));return rp(_0x1b14ba)[_0x8788('0xe')](function(_0x21051d){_0x320377[_0x8788('0x28')]=_0x21051d[_0x8788('0x2e')]['id'];_0x407674(_0x320377);})[_0x8788('0x16')](function(_0x382a3f){logger[_0x8788('0x1e')]('['+[_0x541fc0[_0x8788('0x17')]()]+']',_0x382a3f[_0x8788('0x18')]);_0xa209ae(_0x382a3f[_0x8788('0x18')]);});});}function getTicket(_0x3ba4c3,_0x21a204,_0x549c7c,_0xa745c4,_0x394938){return function(_0x3308f2){logger['info'](_0x8788('0x2f'));return new Promise(function(_0x4b5751,_0x17e9cf){var _0x5ca5a9=moment();var _0x5ada7f={'method':_0x8788('0x30'),'uri':_0x549c7c+_0x8788('0x31'),'body':{'title':intUtil[_0x8788('0x32')](_0xa745c4[_0x8788('0x33')],_0x394938,'\x20'),'description':intUtil[_0x8788('0x32')](_0xa745c4['Descriptions'],_0x394938,'\x0a'),'owner_id':_0x3308f2[_0x8788('0x1b')],'creater_id':_0x3308f2[_0x8788('0x13')],'targetable_id':_0x3308f2[_0x8788('0x28')],'targetable_type':_0x8788('0x34'),'created_at':_0x5ca5a9[_0x8788('0x25')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x5ca5a9['add'](0x1e,'m')[_0x8788('0x25')](_0x8788('0x2c'))},'json':!![]};_0x5ada7f[_0x8788('0xc')]=_0x21a204;return rp(_0x5ada7f)['then'](function(_0x321c9b){_0x3308f2[_0x8788('0x35')]=_0x321c9b[_0x8788('0x36')]['id'];logger['info']('Task\x20created:',_0x3308f2[_0x8788('0x35')]);_0x4b5751(_0x3308f2);})[_0x8788('0x16')](function(_0x28817b){logger['error']('['+[_0x3ba4c3['toUpperCase']()]+']',_0x28817b[_0x8788('0x18')]);_0x17e9cf(_0x28817b['message']);});});};}function emit(_0x4c9454,_0x4fc6d4,_0x201050){var _0x1c1ba9={'uri':_0x4c9454+_0x8788('0x37')+_0x201050};io['to'](util[_0x8788('0x25')](_0x8788('0x38'),_0x4fc6d4))[_0x8788('0x39')](_0x8788('0x3a'),_0x1c1ba9);}exports['cs']=function(_0x2c3fb7,_0x2b2fe8,_0x1667e7,_0x5cc2fb,_0x581655,_0x5cf14c,_0x37dca0,_0x300ab9){var _0x511b2e={};var _0x5d41d5={'Authorization':_0x8788('0x3b')+_0x5cf14c[_0x8788('0x3c')]};_0x5cf14c[_0x8788('0x3d')]=intUtil[_0x8788('0x3e')](_0x5cf14c[_0x8788('0x3d')]);_0x5cf14c['serverUrl']=intUtil[_0x8788('0x3e')](_0x5cf14c['serverUrl']);var _0x32c9c1=_0x5cf14c[_0x8788('0x3d')];_0x511b2e[_0x8788('0x12')]=_0x5cf14c['username'];_0x511b2e['contactNumber']=_0x300ab9[_0x8788('0x3f')]()===_0x8788('0x40')?_0x2b2fe8[_0x8788('0x41')]:_0x2b2fe8[_0x8788('0x42')];_0x511b2e[_0x8788('0x43')]=_0x300ab9===_0x8788('0x44')||_0x300ab9===_0x8788('0x45')?_0x8788('0x44'):_0x8788('0x40');if(_0x5cc2fb){_0x511b2e['agentEmail']=_0x5cc2fb[_0x8788('0x11')];}var _0x374aee=util['format'](_0x8788('0x46'),_0x5cf14c[_0x8788('0x47')],_0x2b2fe8[_0x8788('0x48')],md5(_0x2b2fe8[_0x8788('0x48')]));if(_0x581655&&_0x581655[_0x8788('0x49')]){logger[_0x8788('0x14')](_0x8788('0x4a'),'Recording\x20is\x20enabled!');_0x2b2fe8[_0x8788('0x4b')]=_0x374aee;}else if(_0x37dca0&&_0x37dca0[_0x8788('0x4c')]&&_0x37dca0[_0x8788('0x4c')]!==_0x8788('0x4d')){logger[_0x8788('0x14')](_0x8788('0x4e'),'Recording\x20is\x20enabled!');_0x2b2fe8['recordingURL']=_0x374aee;}else{_0x2b2fe8[_0x8788('0x4b')]='';}return getAdminId(_0x511b2e,_0x300ab9,_0x5d41d5,_0x32c9c1)[_0x8788('0xe')](getUser(_0x300ab9,_0x5d41d5,_0x32c9c1))['then'](getEndUser(_0x300ab9,_0x5d41d5,_0x32c9c1))[_0x8788('0xe')](getTicket(_0x300ab9,_0x5d41d5,_0x32c9c1,_0x1667e7,_0x2b2fe8))[_0x8788('0xe')](function(_0x432010){logger['info'](util[_0x8788('0x25')](_0x8788('0x4f'),_0x432010[_0x8788('0x35')]));if(_0x300ab9!==_0x8788('0x45')){logger[_0x8788('0x14')]('['+[_0x300ab9[_0x8788('0x17')]()]+']',_0x8788('0x50'));emit(_0x32c9c1,_0x5cc2fb[_0x8788('0x51')],_0x432010[_0x8788('0x28')]);}})[_0x8788('0x16')](function(_0x271ed1){logger['error']('['+[_0x300ab9['toUpperCase']()]+_0x8788('0x52'),util[_0x8788('0x53')](_0x271ed1,{'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 e3b2ae4..b98bf47 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 _0x02dd=['unmanaged','salesforce','freshdesk','desk','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','sugarcrm','zoho','vtiger','dynamics365','servicenow','exec','data1','toLowerCase','data2','find','Configurations','outbound','log'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0x02dd,0x195));var _0xd02d=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x02dd[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xd02d('0x0'));var util=require(_0xd02d('0x1'));var zendesk=require(_0xd02d('0x2'));var salesforce=require(_0xd02d('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xd02d('0x4'));var zoho=require(_0xd02d('0x5'));var desk=require(_0xd02d('0x6'));var vtiger=require(_0xd02d('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0xd02d('0x8'));var freshsales=require(_0xd02d('0x9'));var integrations=[_0xd02d('0xa'),'salesforce',_0xd02d('0xb'),'freshdesk',_0xd02d('0xc'),'desk',_0xd02d('0xd'),_0xd02d('0xe'),'freshsales',_0xd02d('0xf')];exports[_0xd02d('0x10')]=function(_0x140602,_0x2c9798,_0x5401cf,_0x2bf15f,_0x8cc46,_0x5cc8f){if(_0x5401cf){if(_['includes'](integrations,_0x140602[_0xd02d('0x11')]['toLowerCase']())){try{var _0x4608d3=null;var _0x3ba50d='';var _0x5eab6f=_0x5401cf[_0x140602[_0xd02d('0x11')][_0xd02d('0x12')]()];if(_0x5eab6f){var _0x5ddfed=_0x5eab6f[_0x140602[_0xd02d('0x13')]];if(_0x5ddfed){var _0x1b3e0b=_[_0xd02d('0x14')](_0x5ddfed[_0xd02d('0x15')],{'id':parseInt(_0x140602['data3'],0xa)});if(_0x1b3e0b){if(_0x2bf15f){if(_0x8cc46&&_0x2c9798['queue']){_0x3ba50d='queue';}else if(_0x2c9798['routeId']){_0x3ba50d=_0xd02d('0x16');}else{console[_0xd02d('0x17')]('EVENT\x20UNKNOWN',_0x2c9798);}}else{_0x3ba50d=_0xd02d('0x18');}switch(_0x140602[_0xd02d('0x11')]['toLowerCase']()){case _0xd02d('0xa'):zendesk[_0x3ba50d](_0x140602,_0x2c9798,_0x1b3e0b,_0x2bf15f,_0x8cc46,_0x5ddfed,_0x5cc8f);break;case _0xd02d('0x19'):salesforce[_0x3ba50d](_0x140602,_0x2c9798,_0x1b3e0b,_0x2bf15f,_0x8cc46,_0x5ddfed,_0x5cc8f);break;case _0xd02d('0xb'):sugarcrm[_0x3ba50d](_0x140602,_0x2c9798,_0x1b3e0b,_0x2bf15f,_0x8cc46,_0x5ddfed,_0x5cc8f);break;case _0xd02d('0x1a'):freshdesk[_0x3ba50d](_0x140602,_0x2c9798,_0x1b3e0b,_0x2bf15f,_0x8cc46,_0x5ddfed,_0x5cc8f);break;case _0xd02d('0xc'):zoho[_0x3ba50d](_0x140602,_0x2c9798,_0x1b3e0b,_0x2bf15f,_0x8cc46,_0x5ddfed,_0x5cc8f);break;case _0xd02d('0x1b'):desk[_0x3ba50d](_0x140602,_0x2c9798,_0x1b3e0b,_0x2bf15f,_0x8cc46,_0x5ddfed,_0x5cc8f);break;case'vtiger':vtiger[_0x3ba50d](_0x140602,_0x2c9798,_0x1b3e0b,_0x2bf15f,_0x8cc46,_0x5ddfed,_0x5cc8f);break;case'freshsales':freshsales['cs'](_0x140602,_0x2c9798,_0x1b3e0b,_0x2bf15f,_0x8cc46,_0x5ddfed,_0x5cc8f,_0x3ba50d);break;case'servicenow':servicenow['cs'](_0x140602,_0x2c9798,_0x1b3e0b,_0x2bf15f,_0x8cc46,_0x5ddfed,_0x5cc8f,_0x3ba50d);break;case _0xd02d('0xe'):dynamics365['cs'](_0x140602,_0x2c9798,_0x1b3e0b,_0x2bf15f,_0x8cc46,_0x5ddfed,_0x5cc8f,_0x3ba50d);break;default:console[_0xd02d('0x17')]('unknown\x20integration');}}else{_0x4608d3=require(_0xd02d('0x1c'))(_0x140602['data1'][_0xd02d('0x12')]());_0x4608d3[_0xd02d('0x1d')](_0xd02d('0x1e'),util[_0xd02d('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x140602[_0xd02d('0x11')][_0xd02d('0x12')](),_0x140602['data3']));}}else{_0x4608d3=require(_0xd02d('0x1c'))(_0x140602['data1']['toLowerCase']());_0x4608d3[_0xd02d('0x1d')](_0xd02d('0x1e'),util[_0xd02d('0x1f')](_0xd02d('0x20'),_0x140602[_0xd02d('0x11')][_0xd02d('0x12')](),_0x140602[_0xd02d('0x13')]));}}else{}}catch(_0x340b2e){console['error'](_0x340b2e);}}}}; \ No newline at end of file +var _0xd005=['%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./zoho','./desk','./servicenow','./dynamics365','zendesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','unknown\x20integration','../../../../config/logger','error','format','[EXEC]'];(function(_0x2ec37e,_0x93586a){var _0x3c5980=function(_0x555fb8){while(--_0x555fb8){_0x2ec37e['push'](_0x2ec37e['shift']());}};_0x3c5980(++_0x93586a);}(_0xd005,0x8d));var _0x5d00=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd005[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5d00('0x0'));var util=require('util');var zendesk=require(_0x5d00('0x1'));var salesforce=require(_0x5d00('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x5d00('0x3'));var desk=require(_0x5d00('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0x5d00('0x5'));var dynamics365=require(_0x5d00('0x6'));var freshsales=require('./freshsales');var integrations=[_0x5d00('0x7'),'salesforce','sugarcrm','freshdesk',_0x5d00('0x8'),_0x5d00('0x9'),_0x5d00('0xa'),_0x5d00('0xb'),_0x5d00('0xc'),_0x5d00('0xd')];exports[_0x5d00('0xe')]=function(_0x528be5,_0x440e65,_0x4b12a1,_0x46cd1,_0x5707de,_0xd5b841){if(_0x4b12a1){if(_[_0x5d00('0xf')](integrations,_0x528be5[_0x5d00('0x10')]['toLowerCase']())){try{var _0x157a91=null;var _0x24921b='';var _0x26eca3=_0x4b12a1[_0x528be5['data1'][_0x5d00('0x11')]()];if(_0x26eca3){var _0x11781e=_0x26eca3[_0x528be5[_0x5d00('0x12')]];if(_0x11781e){var _0x2f3add=_[_0x5d00('0x13')](_0x11781e[_0x5d00('0x14')],{'id':parseInt(_0x528be5[_0x5d00('0x15')],0xa)});if(_0x2f3add){if(_0x46cd1){if(_0x5707de&&_0x440e65[_0x5d00('0x16')]){_0x24921b=_0x5d00('0x16');}else if(_0x440e65[_0x5d00('0x17')]){_0x24921b=_0x5d00('0x18');}else{console[_0x5d00('0x19')](_0x5d00('0x1a'),_0x440e65);}}else{_0x24921b=_0x5d00('0x1b');}switch(_0x528be5[_0x5d00('0x10')][_0x5d00('0x11')]()){case _0x5d00('0x7'):zendesk[_0x24921b](_0x528be5,_0x440e65,_0x2f3add,_0x46cd1,_0x5707de,_0x11781e,_0xd5b841);break;case'salesforce':salesforce[_0x24921b](_0x528be5,_0x440e65,_0x2f3add,_0x46cd1,_0x5707de,_0x11781e,_0xd5b841);break;case _0x5d00('0x1c'):sugarcrm[_0x24921b](_0x528be5,_0x440e65,_0x2f3add,_0x46cd1,_0x5707de,_0x11781e,_0xd5b841);break;case'freshdesk':freshdesk[_0x24921b](_0x528be5,_0x440e65,_0x2f3add,_0x46cd1,_0x5707de,_0x11781e,_0xd5b841);break;case'zoho':zoho[_0x24921b](_0x528be5,_0x440e65,_0x2f3add,_0x46cd1,_0x5707de,_0x11781e,_0xd5b841);break;case _0x5d00('0x9'):desk[_0x24921b](_0x528be5,_0x440e65,_0x2f3add,_0x46cd1,_0x5707de,_0x11781e,_0xd5b841);break;case'vtiger':vtiger[_0x24921b](_0x528be5,_0x440e65,_0x2f3add,_0x46cd1,_0x5707de,_0x11781e,_0xd5b841);break;case _0x5d00('0xc'):freshsales['cs'](_0x528be5,_0x440e65,_0x2f3add,_0x46cd1,_0x5707de,_0x11781e,_0xd5b841,_0x24921b);break;case _0x5d00('0xd'):servicenow['cs'](_0x528be5,_0x440e65,_0x2f3add,_0x46cd1,_0x5707de,_0x11781e,_0xd5b841,_0x24921b);break;case _0x5d00('0xb'):dynamics365['cs'](_0x528be5,_0x440e65,_0x2f3add,_0x46cd1,_0x5707de,_0x11781e,_0xd5b841,_0x24921b);break;default:console[_0x5d00('0x19')](_0x5d00('0x1d'));}}else{_0x157a91=require(_0x5d00('0x1e'))(_0x528be5[_0x5d00('0x10')][_0x5d00('0x11')]());_0x157a91[_0x5d00('0x1f')]('[EXEC]',util[_0x5d00('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0x528be5[_0x5d00('0x10')][_0x5d00('0x11')](),_0x528be5['data3']));}}else{_0x157a91=require(_0x5d00('0x1e'))(_0x528be5[_0x5d00('0x10')][_0x5d00('0x11')]());_0x157a91['error'](_0x5d00('0x21'),util['format'](_0x5d00('0x22'),_0x528be5['data1'][_0x5d00('0x11')](),_0x528be5[_0x5d00('0x12')]));}}else{}}catch(_0x20f3f6){console['error'](_0x20f3f6);}}}}; \ 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 97e41f9..b3beef3 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 _0x3eb7=['[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','recordingFormat','none','[OUTBOUND]','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','error','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','catch','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','info','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','first','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','concat','securityToken','remoteUri','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0x3eb7,0x93));var _0x73eb=function(_0x40b6a5,_0x30b7ff){_0x40b6a5=_0x40b6a5-0x0;var _0x2d9d33=_0x3eb7[_0x40b6a5];return _0x2d9d33;};'use strict';var _=require('lodash');var rp=require(_0x73eb('0x0'));var moment=require(_0x73eb('0x1'));var BPromise=require(_0x73eb('0x2'));var md5=require(_0x73eb('0x3'));var jsforce=require(_0x73eb('0x4'));var util=require(_0x73eb('0x5'));var Redis=require(_0x73eb('0x6'));var intUtil=require(_0x73eb('0x7'));var config=require(_0x73eb('0x8'));var logger=require('../../../../config/logger')(_0x73eb('0x9'));config[_0x73eb('0xa')]=_[_0x73eb('0xb')](config['redis'],{'host':_0x73eb('0xc'),'port':0x18eb});var io=require(_0x73eb('0xd'))(new Redis(config[_0x73eb('0xa')]));function emit(_0x511ddd,_0x97dd69,_0x3616a1){io['to'](_0x511ddd)[_0x73eb('0xe')](_0x97dd69,_0x3616a1);}function getTicket(_0x30eb43,_0x41324d,_0x3e305d,_0x2d0855,_0x208e50,_0x4424d8,_0x550d3e,_0x1ceaf1){var _0x5aa68f=Object[_0x73eb('0xf')]({},{'OwnerId':_0x41324d['id'],'Subject':intUtil[_0x73eb('0x10')](_0x2d0855[_0x73eb('0x11')],_0x208e50,'\x20'),'Description':intUtil[_0x73eb('0x10')](_0x2d0855['Descriptions'],_0x208e50,'\x0a')},getCustomFields(_0x4424d8,_0x208e50));if(_0x3e305d){if(_0x2d0855[_0x73eb('0x12')]===_0x73eb('0x13')){_0x5aa68f[_0x73eb('0x14')]=moment['utc']();_0x5aa68f[_0x73eb('0x15')]=![];_0x5aa68f[_0x73eb('0x16')]=![];if(_0x3e305d[_0x73eb('0x17')]===_0x73eb('0x18')||_0x3e305d[_0x73eb('0x17')]===_0x73eb('0x19')){_0x5aa68f[_0x73eb('0x1a')]=_0x3e305d['id'];}else if(_0x3e305d[_0x73eb('0x17')]===_0x73eb('0x1b')){_0x5aa68f[_0x73eb('0x1c')]=_0x3e305d['id'];}}else if(_0x2d0855[_0x73eb('0x12')]===_0x73eb('0x1d')){if(_0x3e305d[_0x73eb('0x17')]===_0x73eb('0x18')){_0x5aa68f[_0x73eb('0x1e')]=_0x3e305d['id'];}else if(_0x3e305d[_0x73eb('0x17')]===_0x73eb('0x1b')){_0x5aa68f['AccountId']=_0x3e305d['id'];}else if(_0x3e305d[_0x73eb('0x17')]===_0x73eb('0x19')&&_0x2d0855[_0x73eb('0x1f')]){_0x5aa68f[_0x2d0855[_0x73eb('0x1f')]]=_0x3e305d['id'];}else{logger['info'](_0x73eb('0x20'));}}}return _0x550d3e[_0x73eb('0x21')](_0x2d0855[_0x73eb('0x12')])[_0x73eb('0x22')](_0x5aa68f);}function getUser(_0x960b5,_0x5587fb,_0x176264){if(!_[_0x73eb('0x23')](_0x5587fb)&&intUtil[_0x73eb('0x24')](_0x5587fb)){var _0x5c4961={'Email':_0x5587fb};var _0x1e6888={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x176264['sobject'](_0x73eb('0x25'))[_0x73eb('0x26')](_0x5c4961,_0x1e6888)[_0x73eb('0x27')]()[_0x73eb('0x28')](function(_0xdd4b40){if(_0xdd4b40[_0x73eb('0x29')]){var _0xec8ba1=_[_0x73eb('0x26')](_0xdd4b40,function(_0x58d66a){return _0x58d66a['Email']===_0x5587fb;});if(_0xec8ba1){logger[_0x73eb('0x2a')](_0x73eb('0x2b'),_0x5587fb);return BPromise[_0x73eb('0x2c')]({'id':_0xec8ba1['Id'],'name':_0xec8ba1[_0x73eb('0x2d')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5587fb);return _0x176264[_0x73eb('0x2e')]()['then'](function(_0x252b4f){return BPromise[_0x73eb('0x2c')]({'id':_0x252b4f[_0x73eb('0x2f')],'name':_0x252b4f[_0x73eb('0x30')]});});}});}else{logger[_0x73eb('0x2a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5587fb);return _0x176264[_0x73eb('0x2e')]()['then'](function(_0x3f3dee){return BPromise['resolve']({'id':_0x3f3dee[_0x73eb('0x2f')],'name':_0x3f3dee['display_name']});});}}function getEndUser(_0x39f149,_0x1303e2,_0x501b51,_0x2175dd,_0x50cd4c){var _0x266de6={'$or':{'Phone':_0x2175dd}};var _0x1743f7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x73eb('0x28')](function(){logger['info'](_0x73eb('0x31'),_0x2175dd,_0x1303e2[_0x73eb('0x32')]);switch(_0x1303e2[_0x73eb('0x32')]){case _0x73eb('0x33'):var _0x1088c6=_[_0x73eb('0x34')](_0x266de6);if(_0x1303e2['additionalSearchContact']){var _0x413cb6={};_0x413cb6[_0x1303e2[_0x73eb('0x35')]]=_0x2175dd;_[_0x73eb('0x36')](_0x1088c6['$or'],_0x413cb6);}return _0x50cd4c[_0x73eb('0x21')](_0x73eb('0x37'))['find'](_0x1088c6,_0x1743f7)[_0x73eb('0x27')]()[_0x73eb('0x28')](function(_0x3e2abf){if(_0x3e2abf&&_0x3e2abf[_0x73eb('0x29')]){return _0x3e2abf;}else{var _0x2d4752=_['cloneDeep'](_0x266de6);if(_0x1303e2[_0x73eb('0x38')]){var _0xf08c7c={};_0xf08c7c[_0x1303e2[_0x73eb('0x38')]]=_0x2175dd;_[_0x73eb('0x36')](_0x2d4752['$or'],_0xf08c7c);}return _0x50cd4c[_0x73eb('0x21')](_0x73eb('0x39'))['find'](_0x2d4752,_0x1743f7);}});case _0x73eb('0x3a'):var _0x266876=_['cloneDeep'](_0x266de6);if(_0x1303e2[_0x73eb('0x3b')]){var _0x413cb6={};_0x413cb6[_0x1303e2[_0x73eb('0x3b')]]=_0x2175dd;_[_0x73eb('0x36')](_0x266876[_0x73eb('0x3c')],_0x413cb6);}return _0x50cd4c[_0x73eb('0x21')](_0x73eb('0x3d'))[_0x73eb('0x26')](_0x266876,_0x1743f7)[_0x73eb('0x27')]()['then'](function(_0x7de061){if(_0x7de061&&_0x7de061['length']){return _0x7de061;}else{var _0x4fd02f=_[_0x73eb('0x34')](_0x266de6);if(_0x1303e2[_0x73eb('0x35')]){var _0xd9913a={};_0xd9913a[_0x1303e2[_0x73eb('0x35')]]=_0x2175dd;_[_0x73eb('0x36')](_0x4fd02f[_0x73eb('0x3c')],_0xd9913a);}return _0x50cd4c[_0x73eb('0x21')](_0x73eb('0x37'))[_0x73eb('0x26')](_0x4fd02f,_0x1743f7)[_0x73eb('0x28')](function(_0x5c3f0e){if(_0x5c3f0e&&_0x5c3f0e[_0x73eb('0x29')]){return _0x5c3f0e;}else{var _0xc8e9c2=_[_0x73eb('0x34')](_0x266de6);if(_0x1303e2[_0x73eb('0x38')]){var _0x59ec92={};_0x59ec92[_0x1303e2['additionalSearchLead']]=_0x2175dd;_[_0x73eb('0x36')](_0xc8e9c2[_0x73eb('0x3c')],_0x59ec92);}return _0x50cd4c[_0x73eb('0x21')]('Lead')[_0x73eb('0x26')](_0xc8e9c2,_0x1743f7);}});}});case _0x73eb('0x18'):var _0x1088c6=_[_0x73eb('0x34')](_0x266de6);if(_0x1303e2[_0x73eb('0x35')]){var _0x413cb6={};_0x413cb6[_0x1303e2[_0x73eb('0x35')]]=_0x2175dd;_[_0x73eb('0x36')](_0x1088c6['$or'],_0x413cb6);}return _0x50cd4c['sobject'](_0x73eb('0x37'))[_0x73eb('0x26')](_0x1088c6,_0x1743f7)['execute']();case'lead':var _0x1e578e=_['cloneDeep'](_0x266de6);if(_0x1303e2[_0x73eb('0x38')]){var _0x413cb6={};_0x413cb6[_0x1303e2['additionalSearchLead']]=_0x2175dd;_[_0x73eb('0x36')](_0x1e578e['$or'],_0x413cb6);}return _0x50cd4c[_0x73eb('0x21')](_0x73eb('0x39'))[_0x73eb('0x26')](_0x1e578e,_0x1743f7);case _0x73eb('0x1b'):var _0x266876=_[_0x73eb('0x34')](_0x266de6);if(_0x1303e2[_0x73eb('0x3b')]){var _0x413cb6={};_0x413cb6[_0x1303e2[_0x73eb('0x3b')]]=_0x2175dd;_[_0x73eb('0x36')](_0x266876[_0x73eb('0x3c')],_0x413cb6);}return _0x50cd4c[_0x73eb('0x21')](_0x73eb('0x3d'))['find'](_0x266876,_0x1743f7);default:return null;}})[_0x73eb('0x28')](function(_0x58e0c7){if(_0x58e0c7&&_0x58e0c7['length']){var _0x2c0524=_[_0x73eb('0x3e')](_0x58e0c7);if(_0x2c0524){return BPromise[_0x73eb('0x2c')]({'id':_0x2c0524['Id'],'name':_0x2c0524[_0x73eb('0x2d')],'phone':_0x2c0524['Phone'],'endUserType':_0x2c0524[_0x73eb('0x3f')]['type'][_0x73eb('0x40')]()});}}})[_0x73eb('0x28')](function(_0x71ca41){if(_0x71ca41){logger[_0x73eb('0x2a')](_0x73eb('0x41'),_0x71ca41[_0x73eb('0x17')],_0x2175dd);return BPromise[_0x73eb('0x2c')](_0x71ca41);}else{logger[_0x73eb('0x2a')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x2175dd);var _0x790855={'Phone':_0x2175dd};if(_0x1303e2[_0x73eb('0x42')]){if(_0x1303e2[_0x73eb('0x42')]==='contact'){logger['info'](_0x73eb('0x43'),_0x2175dd,_0x1303e2[_0x73eb('0x42')]);_0x790855[_0x73eb('0x44')]=_0x501b51!==_0x73eb('0x45')?_0x501b51:util[_0x73eb('0x46')](_0x73eb('0x47'),_0x2175dd);}else if(_0x1303e2['moduleCreate']==='lead'){logger[_0x73eb('0x2a')](_0x73eb('0x43'),_0x2175dd,_0x1303e2[_0x73eb('0x42')]);_0x790855[_0x73eb('0x44')]=_0x501b51!==_0x73eb('0x45')?_0x501b51:util[_0x73eb('0x46')](_0x73eb('0x47'),_0x2175dd);_0x790855[_0x73eb('0x48')]=_0x73eb('0x49');}else if(_0x1303e2[_0x73eb('0x42')]===_0x73eb('0x1b')){logger[_0x73eb('0x2a')](_0x73eb('0x43'),_0x2175dd,_0x1303e2[_0x73eb('0x42')]);_0x790855[_0x73eb('0x2d')]=_0x501b51!==_0x73eb('0x45')?_0x501b51:util[_0x73eb('0x46')](_0x73eb('0x47'),_0x2175dd);}else{return null;}}return _0x50cd4c[_0x73eb('0x21')](_['upperFirst'](_0x1303e2['moduleCreate']))[_0x73eb('0x22')](_0x790855)['then'](function(_0x2ce281){return BPromise['resolve']({'id':_0x2ce281['id'],'endUserType':_0x1303e2[_0x73eb('0x42')]});});}});}function getCustomFields(_0x36fb55,_0x720da8){var _0x555618={};if(_0x36fb55[_0x73eb('0x29')]>0x0){_[_0x73eb('0x4a')](_0x36fb55,function(_0xb62de3){if(_[_0x73eb('0x4b')]([_0x73eb('0x4c'),_0x73eb('0x4d')],_0xb62de3[_0x73eb('0x4e')])&&_0xb62de3[_0x73eb('0x4f')]){_0x555618[_0xb62de3[_0x73eb('0x4f')]]=_0xb62de3[_0x73eb('0x50')][_0x73eb('0x51')]();}else if(_0xb62de3[_0x73eb('0x4e')]==='variable'&&_0xb62de3[_0x73eb('0x52')]&&_0xb62de3[_0x73eb('0x4f')]){_0x720da8[_0xb62de3['variableName']]&&(_0x555618[_0xb62de3['idField']]=_0x720da8[_0xb62de3['variableName']][_0x73eb('0x51')]());}else if(_0xb62de3[_0x73eb('0x4e')]===_0x73eb('0x53')&&_0xb62de3['Variable']&&_0xb62de3[_0x73eb('0x54')][_0x73eb('0x55')]&&_0xb62de3[_0x73eb('0x4f')]){_0x720da8[_0xb62de3[_0x73eb('0x54')][_0x73eb('0x55')][_0x73eb('0x40')]()]&&(_0x555618[_0xb62de3[_0x73eb('0x4f')]]=_0x720da8[_0xb62de3[_0x73eb('0x54')][_0x73eb('0x55')]['toLowerCase']()][_0x73eb('0x51')]());}});}return _0x555618;}function getConnection(_0x484ab1){var _0xc6904b=_0x484ab1['password'][_0x73eb('0x56')](_0x484ab1[_0x73eb('0x57')]);var _0x4eda6c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x484ab1[_0x73eb('0x58')]||'https://login.salesforce.com','clientId':_0x484ab1[_0x73eb('0x59')],'clientSecret':_0x484ab1[_0x73eb('0x5a')]}});return _0x4eda6c['login'](_0x484ab1[_0x73eb('0x5b')],_0xc6904b)[_0x73eb('0x28')](function(){logger[_0x73eb('0x2a')](_0x73eb('0x5c'));return _0x4eda6c;});}exports['queue']=function(_0x5668fe,_0x1081b9,_0x3aa5d8,_0x5bb4c2,_0x31f744,_0x59bf7a){var _0x135990,_0x1da71a,_0xbb4e80,_0xf76572;_0x59bf7a[_0x73eb('0x5d')]=intUtil[_0x73eb('0x5e')](_0x59bf7a[_0x73eb('0x5d')]);_0x59bf7a[_0x73eb('0x58')]=intUtil[_0x73eb('0x5e')](_0x59bf7a[_0x73eb('0x58')]);if(_0x31f744&&_0x31f744[_0x73eb('0x5f')]){logger[_0x73eb('0x2a')]('[QUEUE]',_0x73eb('0x60'));_0x1081b9[_0x73eb('0x61')]=util[_0x73eb('0x46')](_0x73eb('0x62'),_0x59bf7a[_0x73eb('0x5d')],_0x1081b9[_0x73eb('0x63')],md5(_0x1081b9[_0x73eb('0x63')]));}else{_0x1081b9[_0x73eb('0x61')]='';}return getConnection(_0x59bf7a)[_0x73eb('0x28')](function(_0x290cb0){_0xf76572=_0x290cb0;return getUser(_0x59bf7a,_0x5bb4c2[_0x73eb('0x64')],_0xf76572);})['then'](function(_0x328933){_0x135990=_0x328933;return getEndUser(_0x59bf7a,_0x3aa5d8,_0x1081b9['calleridname'],_0x1081b9[_0x73eb('0x65')],_0xf76572);})['then'](function(_0x14ccfd){_0x1da71a=_0x14ccfd;return getTicket(_0x59bf7a,_0x135990,_0x1da71a,_0x3aa5d8,_0x1081b9,_0x3aa5d8[_0x73eb('0x66')],_0xf76572,_0x73eb('0x67'));})[_0x73eb('0x28')](function(_0x13694a){_0xbb4e80=_0x13694a;logger[_0x73eb('0x2a')](_0x73eb('0x68'),_0xbb4e80['id']);logger[_0x73eb('0x2a')](_0x73eb('0x69'),_0xbb4e80['id'],_0x5bb4c2[_0x73eb('0x55')],_0x59bf7a['type']);switch(_0x59bf7a[_0x73eb('0x4e')]){case _0x73eb('0x6a'):emit(util['format'](_0x73eb('0x6b'),_0x5bb4c2[_0x73eb('0x55')]),'trigger:salesforce:display',{'recordId':_0xbb4e80['id']});break;case'newTab':emit(util[_0x73eb('0x46')](_0x73eb('0x6b'),_0x5bb4c2[_0x73eb('0x55')]),_0x73eb('0x6c'),{'uri':util['format'](_0x73eb('0x6d'),_0xf76572[_0x73eb('0x6e')],_0xbb4e80['id'])});break;default:logger['error'](_0x73eb('0x6f'));}})['catch'](function(_0x36e4c3){logger['error'](_0x73eb('0x70'),_0x36e4c3);});};exports['outbound']=function(_0x324790,_0x57979e,_0x2ed212,_0x361e7a,_0x539546,_0x117787,_0x3ceb9d){var _0x214b91,_0x33dda8,_0x40dc98,_0x4a02e1;_0x117787[_0x73eb('0x5d')]=intUtil[_0x73eb('0x5e')](_0x117787[_0x73eb('0x5d')]);_0x117787[_0x73eb('0x58')]=intUtil[_0x73eb('0x5e')](_0x117787[_0x73eb('0x58')]);if(_0x3ceb9d&&_0x3ceb9d[_0x73eb('0x71')]&&_0x3ceb9d[_0x73eb('0x71')]!==_0x73eb('0x72')){logger[_0x73eb('0x2a')](_0x73eb('0x73'),_0x73eb('0x60'));_0x57979e[_0x73eb('0x61')]=util[_0x73eb('0x46')](_0x73eb('0x62'),_0x117787[_0x73eb('0x5d')],_0x57979e[_0x73eb('0x63')],md5(_0x57979e[_0x73eb('0x63')]));}return getConnection(_0x117787)[_0x73eb('0x28')](function(_0x5ebde3){_0x4a02e1=_0x5ebde3;return getUser(_0x117787,_0x361e7a[_0x73eb('0x64')],_0x4a02e1);})['then'](function(_0x4d2ee8){_0x214b91=_0x4d2ee8;return getEndUser(_0x117787,_0x2ed212,_0x57979e[_0x73eb('0x74')],_0x57979e['destcalleridnum'],_0x4a02e1);})[_0x73eb('0x28')](function(_0x19d5c6){_0x33dda8=_0x19d5c6;return getTicket(_0x117787,_0x214b91,_0x33dda8,_0x2ed212,_0x57979e,_0x2ed212['Fields'],_0x4a02e1,_0x73eb('0x75'));})[_0x73eb('0x28')](function(_0x2e6db0){_0x40dc98=_0x2e6db0;logger['info'](_0x73eb('0x76'),_0x40dc98['id']);logger['info'](_0x73eb('0x77'),_0x40dc98['id'],_0x361e7a[_0x73eb('0x55')],_0x117787['type']);switch(_0x117787[_0x73eb('0x4e')]){case _0x73eb('0x6a'):emit(util[_0x73eb('0x46')](_0x73eb('0x6b'),_0x361e7a[_0x73eb('0x55')]),_0x73eb('0x78'),{'recordId':_0x40dc98['id']});break;case _0x73eb('0x79'):emit(util[_0x73eb('0x46')]('user:%s',_0x361e7a['name']),_0x73eb('0x6c'),{'uri':util[_0x73eb('0x46')](_0x73eb('0x6d'),_0x4a02e1[_0x73eb('0x6e')],_0x40dc98['id'])});break;default:logger[_0x73eb('0x7a')](_0x73eb('0x73'),_0x73eb('0x7b'));}})['catch'](function(_0xfe0bac){logger['error']('[OUTBOUND]',_0xfe0bac);});};exports[_0x73eb('0x7c')]=function(_0x370f40,_0x3ba673,_0x8cc474,_0x230d85,_0x1f3e61,_0x21bc63){var _0x410c88,_0x22de33,_0x59af1c,_0x1abd72;_0x21bc63[_0x73eb('0x5d')]=intUtil[_0x73eb('0x5e')](_0x21bc63[_0x73eb('0x5d')]);_0x21bc63[_0x73eb('0x58')]=intUtil[_0x73eb('0x5e')](_0x21bc63['remoteUri']);if(_0x1f3e61&&_0x1f3e61['monitor_format']){logger[_0x73eb('0x2a')]('['+_0x3ba673['lastevent'][_0x73eb('0x7d')]()+']','Recording\x20is\x20enabled!');_0x3ba673[_0x73eb('0x61')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21bc63[_0x73eb('0x5d')],_0x3ba673['uniqueid'],md5(_0x3ba673['uniqueid']));}else{_0x3ba673[_0x73eb('0x61')]='';}return getConnection(_0x21bc63)[_0x73eb('0x28')](function(_0x1274a9){_0x1abd72=_0x1274a9;if(!_['isNil'](_0x230d85)){return getUser(_0x21bc63,_0x230d85[_0x73eb('0x55')],_0x1abd72);}else{return getUser(_0x21bc63,null,_0x1abd72);}})[_0x73eb('0x28')](function(_0x288dea){_0x410c88=_0x288dea;return getEndUser(_0x21bc63,_0x8cc474,_0x3ba673['calleridname'],_0x3ba673['calleridnum'],_0x1abd72);})['then'](function(_0x10a1d7){_0x22de33=_0x10a1d7;return getTicket(_0x21bc63,_0x410c88,_0x22de33,_0x8cc474,_0x3ba673,_0x8cc474[_0x73eb('0x66')],_0x1abd72);})[_0x73eb('0x28')](function(_0x3d287c){_0x59af1c=_0x3d287c;logger[_0x73eb('0x2a')]('['+_0x3ba673['lastevent'][_0x73eb('0x7d')]()+']\x20Ticket\x20%s\x20created.',_0x59af1c['id']);logger[_0x73eb('0x2a')]('['+_0x3ba673[_0x73eb('0x7e')][_0x73eb('0x7d')]()+_0x73eb('0x7f'),_0x21bc63[_0x73eb('0x4e')]);})[_0x73eb('0x80')](function(_0x34c59c){logger[_0x73eb('0x7a')]('['+_0x3ba673[_0x73eb('0x7e')]['toUpperCase']()+']',_0x34c59c);});}; \ No newline at end of file +var _0x097d=['Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','cloneDeep','additionalSearchContact','Contact','additionalSearchLead','merge','$or','account_contact_lead','additionalSearchAccount','Account','contact','Lead','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','LastName','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','upperFirst','includes','string','picklist','content','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','WhoId','endUserType','account','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x097d,0x1d4));var _0xd097=function(_0xd89cec,_0x4e3c06){_0xd89cec=_0xd89cec-0x0;var _0x2d5bb3=_0x097d[_0xd89cec];return _0x2d5bb3;};'use strict';var _=require(_0xd097('0x0'));var rp=require(_0xd097('0x1'));var moment=require('moment');var BPromise=require(_0xd097('0x2'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xd097('0x3'));var Redis=require(_0xd097('0x4'));var intUtil=require(_0xd097('0x5'));var config=require('../../../../config/environment');var logger=require(_0xd097('0x6'))('salesforce');config[_0xd097('0x7')]=_[_0xd097('0x8')](config['redis'],{'host':_0xd097('0x9'),'port':0x18eb});var io=require(_0xd097('0xa'))(new Redis(config[_0xd097('0x7')]));function emit(_0x4c2bbc,_0x3c396a,_0x1de04d){io['to'](_0x4c2bbc)[_0xd097('0xb')](_0x3c396a,_0x1de04d);}function getTicket(_0x2a4c97,_0x30560a,_0x207994,_0x211090,_0x54d654,_0x461e07,_0x51fffe,_0x13584a){var _0x130a2d=Object['assign']({},{'OwnerId':_0x30560a['id'],'Subject':intUtil[_0xd097('0xc')](_0x211090[_0xd097('0xd')],_0x54d654,'\x20'),'Description':intUtil[_0xd097('0xc')](_0x211090[_0xd097('0xe')],_0x54d654,'\x0a')},getCustomFields(_0x461e07,_0x54d654));if(_0x207994){if(_0x211090[_0xd097('0xf')]===_0xd097('0x10')){_0x130a2d[_0xd097('0x11')]=moment['utc']();_0x130a2d[_0xd097('0x12')]=![];_0x130a2d['IsRecurrence']=![];if(_0x207994['endUserType']==='contact'||_0x207994['endUserType']==='lead'){_0x130a2d[_0xd097('0x13')]=_0x207994['id'];}else if(_0x207994[_0xd097('0x14')]===_0xd097('0x15')){_0x130a2d['WhatId']=_0x207994['id'];}}else if(_0x211090[_0xd097('0xf')]===_0xd097('0x16')){if(_0x207994['endUserType']==='contact'){_0x130a2d[_0xd097('0x17')]=_0x207994['id'];}else if(_0x207994[_0xd097('0x14')]===_0xd097('0x15')){_0x130a2d[_0xd097('0x18')]=_0x207994['id'];}else if(_0x207994[_0xd097('0x14')]===_0xd097('0x19')&&_0x211090[_0xd097('0x1a')]){_0x130a2d[_0x211090[_0xd097('0x1a')]]=_0x207994['id'];}else{logger[_0xd097('0x1b')](_0xd097('0x1c'));}}}return _0x51fffe['sobject'](_0x211090['ticketType'])[_0xd097('0x1d')](_0x130a2d);}function getUser(_0x224d7f,_0x459323,_0x422364){if(!_[_0xd097('0x1e')](_0x459323)&&intUtil[_0xd097('0x1f')](_0x459323)){var _0x5c44ef={'Email':_0x459323};var _0x433a2f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x422364[_0xd097('0x20')](_0xd097('0x21'))[_0xd097('0x22')](_0x5c44ef,_0x433a2f)[_0xd097('0x23')]()[_0xd097('0x24')](function(_0x4b41a5){if(_0x4b41a5[_0xd097('0x25')]){var _0x2df332=_['find'](_0x4b41a5,function(_0x1620d5){return _0x1620d5['Email']===_0x459323;});if(_0x2df332){logger[_0xd097('0x1b')](_0xd097('0x26'),_0x459323);return BPromise[_0xd097('0x27')]({'id':_0x2df332['Id'],'name':_0x2df332[_0xd097('0x28')]});}}else{logger[_0xd097('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x459323);return _0x422364[_0xd097('0x29')]()['then'](function(_0x3ca370){return BPromise[_0xd097('0x27')]({'id':_0x3ca370[_0xd097('0x2a')],'name':_0x3ca370[_0xd097('0x2b')]});});}});}else{logger[_0xd097('0x1b')](_0xd097('0x2c'),_0x459323);return _0x422364[_0xd097('0x29')]()[_0xd097('0x24')](function(_0x88363d){return BPromise[_0xd097('0x27')]({'id':_0x88363d[_0xd097('0x2a')],'name':_0x88363d['display_name']});});}}function getEndUser(_0x425863,_0x107a4b,_0x53442a,_0xf1bece,_0x2fb020){var _0x1f163a={'$or':{'Phone':_0xf1bece}};var _0x31a7ad={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd097('0x27')]()[_0xd097('0x24')](function(){logger[_0xd097('0x1b')](_0xd097('0x2d'),_0xf1bece,_0x107a4b['moduleSearch']);switch(_0x107a4b['moduleSearch']){case _0xd097('0x2e'):var _0x6ad8ef=_[_0xd097('0x2f')](_0x1f163a);if(_0x107a4b[_0xd097('0x30')]){var _0x347ac5={};_0x347ac5[_0x107a4b[_0xd097('0x30')]]=_0xf1bece;_['merge'](_0x6ad8ef['$or'],_0x347ac5);}return _0x2fb020[_0xd097('0x20')](_0xd097('0x31'))['find'](_0x6ad8ef,_0x31a7ad)[_0xd097('0x23')]()[_0xd097('0x24')](function(_0x56d93b){if(_0x56d93b&&_0x56d93b[_0xd097('0x25')]){return _0x56d93b;}else{var _0x44307d=_['cloneDeep'](_0x1f163a);if(_0x107a4b[_0xd097('0x32')]){var _0x4e7e5d={};_0x4e7e5d[_0x107a4b['additionalSearchLead']]=_0xf1bece;_[_0xd097('0x33')](_0x44307d[_0xd097('0x34')],_0x4e7e5d);}return _0x2fb020[_0xd097('0x20')]('Lead')['find'](_0x44307d,_0x31a7ad);}});case _0xd097('0x35'):var _0x28b15b=_[_0xd097('0x2f')](_0x1f163a);if(_0x107a4b[_0xd097('0x36')]){var _0x347ac5={};_0x347ac5[_0x107a4b[_0xd097('0x36')]]=_0xf1bece;_[_0xd097('0x33')](_0x28b15b['$or'],_0x347ac5);}return _0x2fb020[_0xd097('0x20')](_0xd097('0x37'))[_0xd097('0x22')](_0x28b15b,_0x31a7ad)[_0xd097('0x23')]()[_0xd097('0x24')](function(_0xb80b0f){if(_0xb80b0f&&_0xb80b0f[_0xd097('0x25')]){return _0xb80b0f;}else{var _0x526ea0=_[_0xd097('0x2f')](_0x1f163a);if(_0x107a4b[_0xd097('0x30')]){var _0x57a081={};_0x57a081[_0x107a4b[_0xd097('0x30')]]=_0xf1bece;_[_0xd097('0x33')](_0x526ea0[_0xd097('0x34')],_0x57a081);}return _0x2fb020[_0xd097('0x20')](_0xd097('0x31'))['find'](_0x526ea0,_0x31a7ad)[_0xd097('0x24')](function(_0x16ba0c){if(_0x16ba0c&&_0x16ba0c[_0xd097('0x25')]){return _0x16ba0c;}else{var _0x5e0ee8=_['cloneDeep'](_0x1f163a);if(_0x107a4b['additionalSearchLead']){var _0x1bc42d={};_0x1bc42d[_0x107a4b[_0xd097('0x32')]]=_0xf1bece;_[_0xd097('0x33')](_0x5e0ee8[_0xd097('0x34')],_0x1bc42d);}return _0x2fb020[_0xd097('0x20')]('Lead')['find'](_0x5e0ee8,_0x31a7ad);}});}});case _0xd097('0x38'):var _0x6ad8ef=_['cloneDeep'](_0x1f163a);if(_0x107a4b[_0xd097('0x30')]){var _0x347ac5={};_0x347ac5[_0x107a4b[_0xd097('0x30')]]=_0xf1bece;_[_0xd097('0x33')](_0x6ad8ef[_0xd097('0x34')],_0x347ac5);}return _0x2fb020[_0xd097('0x20')]('Contact')['find'](_0x6ad8ef,_0x31a7ad)[_0xd097('0x23')]();case _0xd097('0x19'):var _0x1e1bf8=_[_0xd097('0x2f')](_0x1f163a);if(_0x107a4b[_0xd097('0x32')]){var _0x347ac5={};_0x347ac5[_0x107a4b['additionalSearchLead']]=_0xf1bece;_[_0xd097('0x33')](_0x1e1bf8[_0xd097('0x34')],_0x347ac5);}return _0x2fb020[_0xd097('0x20')](_0xd097('0x39'))[_0xd097('0x22')](_0x1e1bf8,_0x31a7ad);case'account':var _0x28b15b=_[_0xd097('0x2f')](_0x1f163a);if(_0x107a4b[_0xd097('0x36')]){var _0x347ac5={};_0x347ac5[_0x107a4b[_0xd097('0x36')]]=_0xf1bece;_['merge'](_0x28b15b[_0xd097('0x34')],_0x347ac5);}return _0x2fb020['sobject']('Account')['find'](_0x28b15b,_0x31a7ad);default:return null;}})[_0xd097('0x24')](function(_0x395684){if(_0x395684&&_0x395684['length']){var _0x32c010=_[_0xd097('0x3a')](_0x395684);if(_0x32c010){return BPromise['resolve']({'id':_0x32c010['Id'],'name':_0x32c010[_0xd097('0x28')],'phone':_0x32c010[_0xd097('0x3b')],'endUserType':_0x32c010[_0xd097('0x3c')][_0xd097('0x3d')]['toLowerCase']()});}}})['then'](function(_0x3dde84){if(_0x3dde84){logger[_0xd097('0x1b')](_0xd097('0x3e'),_0x3dde84[_0xd097('0x14')],_0xf1bece);return BPromise[_0xd097('0x27')](_0x3dde84);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0xf1bece);var _0x263994={'Phone':_0xf1bece};if(_0x107a4b[_0xd097('0x3f')]){if(_0x107a4b[_0xd097('0x3f')]===_0xd097('0x38')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xf1bece,_0x107a4b[_0xd097('0x3f')]);_0x263994[_0xd097('0x40')]=_0x53442a!==_0xd097('0x41')?_0x53442a:util[_0xd097('0x42')]('Caller\x20-\x20%s',_0xf1bece);}else if(_0x107a4b['moduleCreate']===_0xd097('0x19')){logger[_0xd097('0x1b')](_0xd097('0x43'),_0xf1bece,_0x107a4b[_0xd097('0x3f')]);_0x263994[_0xd097('0x40')]=_0x53442a!==_0xd097('0x41')?_0x53442a:util['format'](_0xd097('0x44'),_0xf1bece);_0x263994['Company']='No\x20Company';}else if(_0x107a4b[_0xd097('0x3f')]===_0xd097('0x15')){logger[_0xd097('0x1b')](_0xd097('0x43'),_0xf1bece,_0x107a4b[_0xd097('0x3f')]);_0x263994[_0xd097('0x28')]=_0x53442a!==_0xd097('0x41')?_0x53442a:util[_0xd097('0x42')](_0xd097('0x44'),_0xf1bece);}else{return null;}}return _0x2fb020[_0xd097('0x20')](_[_0xd097('0x45')](_0x107a4b[_0xd097('0x3f')]))[_0xd097('0x1d')](_0x263994)[_0xd097('0x24')](function(_0x50957c){return BPromise[_0xd097('0x27')]({'id':_0x50957c['id'],'endUserType':_0x107a4b[_0xd097('0x3f')]});});}});}function getCustomFields(_0x28300e,_0x1b376a){var _0x233da0={};if(_0x28300e[_0xd097('0x25')]>0x0){_['forEach'](_0x28300e,function(_0x2a851a){if(_[_0xd097('0x46')]([_0xd097('0x47'),_0xd097('0x48')],_0x2a851a[_0xd097('0x3d')])&&_0x2a851a['idField']){_0x233da0[_0x2a851a['idField']]=_0x2a851a[_0xd097('0x49')][_0xd097('0x4a')]();}else if(_0x2a851a['type']===_0xd097('0x4b')&&_0x2a851a[_0xd097('0x4c')]&&_0x2a851a['idField']){_0x1b376a[_0x2a851a['variableName']]&&(_0x233da0[_0x2a851a[_0xd097('0x4d')]]=_0x1b376a[_0x2a851a['variableName']]['toString']());}else if(_0x2a851a['type']===_0xd097('0x4e')&&_0x2a851a['Variable']&&_0x2a851a[_0xd097('0x4f')][_0xd097('0x50')]&&_0x2a851a[_0xd097('0x4d')]){_0x1b376a[_0x2a851a['Variable']['name'][_0xd097('0x51')]()]&&(_0x233da0[_0x2a851a[_0xd097('0x4d')]]=_0x1b376a[_0x2a851a[_0xd097('0x4f')][_0xd097('0x50')][_0xd097('0x51')]()][_0xd097('0x4a')]());}});}return _0x233da0;}function getConnection(_0x1c4c05){var _0x50f123=_0x1c4c05[_0xd097('0x52')][_0xd097('0x53')](_0x1c4c05[_0xd097('0x54')]);var _0x39fe23=new jsforce[(_0xd097('0x55'))]({'oauth2':{'loginUrl':_0x1c4c05['remoteUri']||_0xd097('0x56'),'clientId':_0x1c4c05[_0xd097('0x57')],'clientSecret':_0x1c4c05[_0xd097('0x58')]}});return _0x39fe23['login'](_0x1c4c05[_0xd097('0x59')],_0x50f123)[_0xd097('0x24')](function(){logger[_0xd097('0x1b')](_0xd097('0x5a'));return _0x39fe23;});}exports[_0xd097('0x5b')]=function(_0x5e198c,_0x38620c,_0x17b14a,_0x4e04b3,_0x566c35,_0x3ed7ac){var _0x4540b8,_0x523bd3,_0x3f368f,_0x250485;_0x3ed7ac[_0xd097('0x5c')]=intUtil[_0xd097('0x5d')](_0x3ed7ac[_0xd097('0x5c')]);_0x3ed7ac[_0xd097('0x5e')]=intUtil['stripTrailingSlash'](_0x3ed7ac[_0xd097('0x5e')]);if(_0x566c35&&_0x566c35[_0xd097('0x5f')]){logger[_0xd097('0x1b')](_0xd097('0x60'),'Recording\x20is\x20enabled!');_0x38620c[_0xd097('0x61')]=util[_0xd097('0x42')](_0xd097('0x62'),_0x3ed7ac[_0xd097('0x5c')],_0x38620c[_0xd097('0x63')],md5(_0x38620c[_0xd097('0x63')]));}else{_0x38620c[_0xd097('0x61')]='';}return getConnection(_0x3ed7ac)['then'](function(_0x1737d3){_0x250485=_0x1737d3;return getUser(_0x3ed7ac,_0x4e04b3['email'],_0x250485);})[_0xd097('0x24')](function(_0x4a0d43){_0x4540b8=_0x4a0d43;return getEndUser(_0x3ed7ac,_0x17b14a,_0x38620c[_0xd097('0x64')],_0x38620c['calleridnum'],_0x250485);})[_0xd097('0x24')](function(_0x4d5ce9){_0x523bd3=_0x4d5ce9;return getTicket(_0x3ed7ac,_0x4540b8,_0x523bd3,_0x17b14a,_0x38620c,_0x17b14a[_0xd097('0x65')],_0x250485,_0xd097('0x5b'));})[_0xd097('0x24')](function(_0x4d143c){_0x3f368f=_0x4d143c;logger[_0xd097('0x1b')](_0xd097('0x66'),_0x3f368f['id']);logger[_0xd097('0x1b')](_0xd097('0x67'),_0x3f368f['id'],_0x4e04b3[_0xd097('0x50')],_0x3ed7ac[_0xd097('0x3d')]);switch(_0x3ed7ac['type']){case _0xd097('0x68'):emit(util[_0xd097('0x42')]('user:%s',_0x4e04b3[_0xd097('0x50')]),'trigger:salesforce:display',{'recordId':_0x3f368f['id']});break;case _0xd097('0x69'):emit(util['format'](_0xd097('0x6a'),_0x4e04b3[_0xd097('0x50')]),_0xd097('0x6b'),{'uri':util[_0xd097('0x42')](_0xd097('0x6c'),_0x250485[_0xd097('0x6d')],_0x3f368f['id'])});break;default:logger[_0xd097('0x6e')](_0xd097('0x6f'));}})[_0xd097('0x70')](function(_0x1969f0){logger[_0xd097('0x6e')](_0xd097('0x60'),_0x1969f0);});};exports[_0xd097('0x71')]=function(_0x3b301a,_0x13d0bb,_0x44a765,_0x23e47d,_0x59f21e,_0x2f12ac,_0x240135){var _0x20b0de,_0xa3d9f0,_0xa5ca1c,_0x5604f6;_0x2f12ac[_0xd097('0x5c')]=intUtil[_0xd097('0x5d')](_0x2f12ac[_0xd097('0x5c')]);_0x2f12ac[_0xd097('0x5e')]=intUtil[_0xd097('0x5d')](_0x2f12ac[_0xd097('0x5e')]);if(_0x240135&&_0x240135[_0xd097('0x72')]&&_0x240135[_0xd097('0x72')]!==_0xd097('0x73')){logger[_0xd097('0x1b')]('[OUTBOUND]',_0xd097('0x74'));_0x13d0bb[_0xd097('0x61')]=util[_0xd097('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f12ac[_0xd097('0x5c')],_0x13d0bb['uniqueid'],md5(_0x13d0bb[_0xd097('0x63')]));}return getConnection(_0x2f12ac)[_0xd097('0x24')](function(_0x2a6f5e){_0x5604f6=_0x2a6f5e;return getUser(_0x2f12ac,_0x23e47d[_0xd097('0x75')],_0x5604f6);})[_0xd097('0x24')](function(_0x251872){_0x20b0de=_0x251872;return getEndUser(_0x2f12ac,_0x44a765,_0x13d0bb[_0xd097('0x76')],_0x13d0bb[_0xd097('0x77')],_0x5604f6);})[_0xd097('0x24')](function(_0x4cd808){_0xa3d9f0=_0x4cd808;return getTicket(_0x2f12ac,_0x20b0de,_0xa3d9f0,_0x44a765,_0x13d0bb,_0x44a765[_0xd097('0x65')],_0x5604f6,'outbound');})[_0xd097('0x24')](function(_0x301048){_0xa5ca1c=_0x301048;logger[_0xd097('0x1b')](_0xd097('0x78'),_0xa5ca1c['id']);logger[_0xd097('0x1b')](_0xd097('0x79'),_0xa5ca1c['id'],_0x23e47d[_0xd097('0x50')],_0x2f12ac[_0xd097('0x3d')]);switch(_0x2f12ac[_0xd097('0x3d')]){case'integrationTab':emit(util[_0xd097('0x42')](_0xd097('0x6a'),_0x23e47d['name']),'trigger:salesforce:display',{'recordId':_0xa5ca1c['id']});break;case'newTab':emit(util[_0xd097('0x42')](_0xd097('0x6a'),_0x23e47d['name']),'trigger:browser:url',{'uri':util[_0xd097('0x42')]('%s/%s/e',_0x5604f6[_0xd097('0x6d')],_0xa5ca1c['id'])});break;default:logger['error'](_0xd097('0x7a'),_0xd097('0x7b'));}})[_0xd097('0x70')](function(_0x3f1488){logger[_0xd097('0x6e')](_0xd097('0x7a'),_0x3f1488);});};exports[_0xd097('0x7c')]=function(_0x5b9074,_0x56134a,_0x4400da,_0x443848,_0x27148f,_0x10326e){var _0x4da4b9,_0x2c2d47,_0x5df8e4,_0x23fc96;_0x10326e['serverUrl']=intUtil[_0xd097('0x5d')](_0x10326e['serverUrl']);_0x10326e[_0xd097('0x5e')]=intUtil['stripTrailingSlash'](_0x10326e[_0xd097('0x5e')]);if(_0x27148f&&_0x27148f[_0xd097('0x5f')]){logger[_0xd097('0x1b')]('['+_0x56134a[_0xd097('0x7d')][_0xd097('0x7e')]()+']',_0xd097('0x74'));_0x56134a[_0xd097('0x61')]=util[_0xd097('0x42')](_0xd097('0x62'),_0x10326e[_0xd097('0x5c')],_0x56134a[_0xd097('0x63')],md5(_0x56134a[_0xd097('0x63')]));}else{_0x56134a[_0xd097('0x61')]='';}return getConnection(_0x10326e)[_0xd097('0x24')](function(_0x1a92f9){_0x23fc96=_0x1a92f9;if(!_[_0xd097('0x1e')](_0x443848)){return getUser(_0x10326e,_0x443848[_0xd097('0x50')],_0x23fc96);}else{return getUser(_0x10326e,null,_0x23fc96);}})[_0xd097('0x24')](function(_0x51c79c){_0x4da4b9=_0x51c79c;return getEndUser(_0x10326e,_0x4400da,_0x56134a[_0xd097('0x64')],_0x56134a['calleridnum'],_0x23fc96);})[_0xd097('0x24')](function(_0x1eedf4){_0x2c2d47=_0x1eedf4;return getTicket(_0x10326e,_0x4da4b9,_0x2c2d47,_0x4400da,_0x56134a,_0x4400da[_0xd097('0x65')],_0x23fc96);})[_0xd097('0x24')](function(_0x1b2dae){_0x5df8e4=_0x1b2dae;logger[_0xd097('0x1b')]('['+_0x56134a[_0xd097('0x7d')][_0xd097('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x5df8e4['id']);logger[_0xd097('0x1b')]('['+_0x56134a['lastevent'][_0xd097('0x7e')]()+_0xd097('0x7f'),_0x10326e['type']);})[_0xd097('0x70')](function(_0x56ff9e){logger[_0xd097('0x6e')]('['+_0x56134a[_0xd097('0x7d')][_0xd097('0x7e')]()+']',_0x56ff9e);});}; \ 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 8d5e55b..47b6e4c 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 _0xa425=['password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','servicenow','redis','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toString','toLowerCase','content','variable','variableName','idField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username'];(function(_0x253b44,_0x4258bb){var _0x548c50=function(_0x13155a){while(--_0x13155a){_0x253b44['push'](_0x253b44['shift']());}};_0x548c50(++_0x4258bb);}(_0xa425,0x161));var _0x5a42=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xa425[_0x34021d];return _0x16597b;};'use strict';var _=require(_0x5a42('0x0'));var Promise=require(_0x5a42('0x1'));var rp=require(_0x5a42('0x2'));var util=require('util');var md5=require(_0x5a42('0x3'));var Redis=require(_0x5a42('0x4'));var intUtil=require(_0x5a42('0x5'));var config=require(_0x5a42('0x6'));var logger=require('../../../../config/logger')(_0x5a42('0x7'));config[_0x5a42('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5a42('0x9'))(new Redis(config[_0x5a42('0x8')]));function getAdminUser(_0x2b9c4f,_0x4f3b82,_0x267f8b,_0x583302,_0x1c50d7,_0x28b81a){return new Promise(function(_0x523eba,_0x599989){var _0x45ad08={'method':'GET','uri':_0x583302+_0x5a42('0xa')+'&'+_0x1c50d7+'&'+_0x28b81a,'auth':_0x4f3b82,'json':!![]};return rp(_0x45ad08)['then'](function(_0x6ae437){if(_0x6ae437[_0x5a42('0xb')][_0x5a42('0xc')]>0x0){_0x267f8b[_0x5a42('0xd')]=_0x6ae437['result'][0x0][_0x5a42('0xe')];}logger[_0x5a42('0xf')]('['+[_0x2b9c4f[_0x5a42('0x10')]()]+_0x5a42('0x11'),_0x267f8b);_0x523eba(_0x267f8b);})[_0x5a42('0x12')](function(_0x1c8375){logger[_0x5a42('0x13')]('['+[_0x2b9c4f['toUpperCase']()]+']',_0x1c8375[_0x5a42('0x14')]);_0x599989(_0x1c8375[_0x5a42('0x14')]);});});}function getUser(_0x2f3c9a,_0x183f0c,_0x2c60d0,_0x169251,_0x36f536){return function(_0x36d947){logger['info']('['+[_0x2f3c9a[_0x5a42('0x10')]()]+_0x5a42('0x15'),_0x36d947);return new Promise(function(_0xd81c19,_0x40d9c6){if(intUtil[_0x5a42('0x16')](_0x36d947[_0x5a42('0x17')])){var _0x6d1997={'method':_0x5a42('0x18'),'uri':_0x2c60d0+'sys_user?sysparm_query=email%3D'+_0x36d947[_0x5a42('0x17')]+'&'+_0x169251+'&'+_0x36f536,'auth':_0x183f0c,'json':!![]};logger[_0x5a42('0xf')]('['+[_0x2f3c9a[_0x5a42('0x10')]()]+_0x5a42('0x19'),_0x6d1997);return rp(_0x6d1997)[_0x5a42('0x1a')](function(_0x4d68e7){logger['info']('['+[_0x2f3c9a['toUpperCase']()]+_0x5a42('0x1b'),_0x4d68e7);if(_0x4d68e7['result']['length']>0x0&&String(_0x4d68e7['result'][0x0]['active'])===_0x5a42('0x1c')){_0x36d947[_0x5a42('0x1d')]=_0x4d68e7[_0x5a42('0xb')][0x0][_0x5a42('0xe')];}else{_0x36d947[_0x5a42('0x1d')]=_0x36d947[_0x5a42('0xd')];_0x36d947[_0x5a42('0x17')]=_0x36d947[_0x5a42('0x1e')];}logger[_0x5a42('0xf')]('['+[_0x2f3c9a[_0x5a42('0x10')]()]+'],\x20getUser\x20crm',_0x36d947);_0xd81c19(_0x36d947);})[_0x5a42('0x12')](function(_0x554c97){logger['error']('['+[_0x2f3c9a[_0x5a42('0x10')]()]+']',_0x554c97['message']);_0x40d9c6(_0x554c97[_0x5a42('0x14')]);});}else{logger[_0x5a42('0xf')]('['+[_0x2f3c9a['toUpperCase']()]+_0x5a42('0x1f'));_0x36d947[_0x5a42('0x1d')]=_0x36d947['adminId'];_0x36d947[_0x5a42('0x17')]=_0x36d947[_0x5a42('0x1e')];_0xd81c19(_0x36d947);}});};}function createEndUser(_0x3405a5,_0x11f338,_0x233cbf,_0x2207c7,_0x2f9756){logger[_0x5a42('0xf')]('['+[_0x3405a5[_0x5a42('0x10')]()]+_0x5a42('0x20'),_0x233cbf);return new Promise(function(_0x26a467,_0x5c6e3c){var _0x46dd7a={'method':_0x5a42('0x21'),'uri':_0x2207c7+_0x5a42('0x22')+_0x2f9756,'body':{'user_name':_0x233cbf[_0x5a42('0x23')],'roles':'user','first_name':_0x233cbf[_0x5a42('0x23')],'active':_0x5a42('0x1c'),'date_format':_0x5a42('0x24'),'phone':_0x233cbf[_0x5a42('0x23')]},'auth':_0x11f338,'json':!![]};return rp(_0x46dd7a)[_0x5a42('0x1a')](function(_0x52b050){logger[_0x5a42('0xf')]('['+[_0x3405a5[_0x5a42('0x10')]()]+_0x5a42('0x25'),_0x52b050[_0x5a42('0xb')]);_0x233cbf[_0x5a42('0x26')]=_0x52b050[_0x5a42('0xb')][_0x5a42('0xe')];_0x26a467(_0x233cbf);})[_0x5a42('0x12')](function(_0x3ce7c2){logger[_0x5a42('0x13')]('['+[_0x3405a5[_0x5a42('0x10')]()]+']',_0x3ce7c2[_0x5a42('0x14')]);_0x5c6e3c(_0x3ce7c2['message']);});});}function getEndUser(_0x2a3cc8,_0x738bf9,_0x237d43,_0x3aae82,_0x245063){return function(_0x13a7fe){logger[_0x5a42('0xf')]('['+[_0x2a3cc8[_0x5a42('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x13a7fe);return new Promise(function(_0x2f3033,_0x3520d0){var _0xbc9459={'method':_0x5a42('0x18'),'uri':_0x237d43+_0x5a42('0x27')+_0x13a7fe['endUserNumber']+'&'+_0x3aae82+'&'+_0x245063,'auth':_0x738bf9,'json':!![]};return rp(_0xbc9459)[_0x5a42('0x1a')](function(_0x1f3ad1){if(_0x1f3ad1[_0x5a42('0xb')]['length']>0x0){_0x13a7fe[_0x5a42('0x26')]=_0x1f3ad1[_0x5a42('0xb')][0x0][_0x5a42('0xe')];logger[_0x5a42('0xf')]('['+[_0x2a3cc8['toUpperCase']()]+_0x5a42('0x28'),_0x13a7fe);_0x2f3033(_0x13a7fe);}else{return createEndUser(_0x2a3cc8,_0x738bf9,_0x13a7fe,_0x237d43,_0x3aae82)[_0x5a42('0x1a')](function(_0x59ec4e){logger[_0x5a42('0xf')]('['+[_0x2a3cc8['toUpperCase']()]+_0x5a42('0x29'),_0x59ec4e);_0x2f3033(_0x59ec4e);});}})[_0x5a42('0x12')](function(_0x59cf1b){logger[_0x5a42('0x13')]('['+[_0x2a3cc8['toUpperCase']()]+']',_0x59cf1b[_0x5a42('0x14')]);_0x3520d0(_0x59cf1b['message']);});});};}function getCustomFields(_0x554a58,_0x1bbbaf){var _0x55922b={};if(_0x554a58[_0x5a42('0xc')]>0x0){_[_0x5a42('0x2a')](_0x554a58,function(_0x56b090){if(_[_0x5a42('0x2b')]([_0x5a42('0x2c'),_0x5a42('0x2d')],_0x56b090[_0x5a42('0x2e')])&&_0x56b090[_0x5a42('0x2f')]&&!_0x56b090[_0x5a42('0x30')]){_0x55922b[_0x56b090[_0x5a42('0x2f')]['toLowerCase']()]=_0x56b090['content'][_0x5a42('0x31')]();}else if(_[_0x5a42('0x2b')]([_0x5a42('0x2c'),_0x5a42('0x2d')],_0x56b090[_0x5a42('0x2e')])&&_0x56b090['idField']&&_0x56b090['customField']){_0x55922b[_0x56b090['idField'][_0x5a42('0x32')]()]=_0x56b090[_0x5a42('0x33')][_0x5a42('0x31')]();}else if(_0x56b090[_0x5a42('0x2e')]===_0x5a42('0x34')&&_0x56b090[_0x5a42('0x35')]&&_0x56b090[_0x5a42('0x36')]&&_0x56b090['customField']){_0x55922b[_0x56b090[_0x5a42('0x36')][_0x5a42('0x32')]()]=_0x1bbbaf[_0x56b090[_0x5a42('0x35')]][_0x5a42('0x31')]();}else if(_0x56b090[_0x5a42('0x2e')]===_0x5a42('0x37')&&_0x56b090[_0x5a42('0x38')]&&_0x56b090['Variable'][_0x5a42('0x39')]&&_0x56b090[_0x5a42('0x36')]&&_0x56b090[_0x5a42('0x30')]){_0x55922b[_0x56b090[_0x5a42('0x36')][_0x5a42('0x32')]()]=_0x1bbbaf[_0x56b090[_0x5a42('0x38')][_0x5a42('0x39')]['toLowerCase']()]['toString']();}});}return _0x55922b;}function getTicket(_0x24d74c,_0x1a5472,_0x3c48c9,_0x3a640e,_0x40d205,_0x393777){return function(_0xefd999){logger['info']('['+[_0x24d74c['toUpperCase']()]+_0x5a42('0x3a'),_0xefd999);return new Promise(function(_0x500e75,_0x591e24){var _0x8abcc3=_0x24d74c['toLowerCase']()===_0x5a42('0x3b')?_0xefd999[_0x5a42('0x1d')]:_0xefd999['endUserId'];var _0x6411d1={'method':'POST','uri':_0x3c48c9+_0x5a42('0x3c')+'?'+_0x393777,'body':Object[_0x5a42('0x3d')]({},{'active':'true','caller_id':_0x8abcc3,'assigned_to':_0xefd999[_0x5a42('0x1d')],'short_description':intUtil[_0x5a42('0x3e')](_0x3a640e[_0x5a42('0x3f')],_0x40d205,'\x20'),'description':intUtil[_0x5a42('0x3e')](_0x3a640e[_0x5a42('0x40')],_0x40d205,'\x0a')},getCustomFields(_0x3a640e[_0x5a42('0x41')],_0x40d205)),'auth':_0x1a5472,'json':!![]};return rp(_0x6411d1)[_0x5a42('0x1a')](function(_0x33eabf){logger[_0x5a42('0xf')]('['+[_0x24d74c['toUpperCase']()]+_0x5a42('0x42'),_0x33eabf[_0x5a42('0xb')]);_0xefd999[_0x5a42('0x43')]=_0x33eabf[_0x5a42('0xb')][_0x5a42('0xe')];_0xefd999[_0x5a42('0x44')]=_0x33eabf[_0x5a42('0xb')][_0x5a42('0x45')];logger[_0x5a42('0xf')]('['+[_0x24d74c[_0x5a42('0x10')]()]+']\x20getTicket\x20crm',_0xefd999);_0x500e75(_0xefd999);})[_0x5a42('0x12')](function(_0x26f2ed){logger[_0x5a42('0x13')]('['+[_0x24d74c[_0x5a42('0x10')]()]+']',_0x26f2ed[_0x5a42('0x14')]);_0x591e24(_0x26f2ed['message']);});});};}function createRemoteTag(_0x369ac9,_0x522fee,_0x347bed,_0x4ef5d9){return new Promise(function(_0x58c490,_0x23c777){var _0x515f2f={'method':_0x5a42('0x21'),'uri':_0x347bed+'label'+'?'+_0x4ef5d9,'body':{'short_description':_0x369ac9,'global':!![],'active':!![],'name':_0x369ac9},'auth':_0x522fee,'json':!![]};return rp(_0x515f2f)['then'](function(_0x4e0099){var _0x1cb2d1=_0x4e0099[_0x5a42('0xb')]['sys_id'];_0x58c490(_0x1cb2d1);});});}function getRemoteTag(_0x4f703f,_0x20a42f,_0x132161,_0x26d1b3,_0x2ce00b){return new Promise(function(_0x477527,_0xc13d62){var _0x590bcd={'method':_0x5a42('0x18'),'uri':_0x132161+_0x5a42('0x46')+_0x5a42('0x47')+_0x4f703f+'&'+_0x26d1b3,'auth':_0x20a42f,'json':!![]};return rp(_0x590bcd)[_0x5a42('0x1a')](function(_0x33e22c){if(_0x33e22c[_0x5a42('0xb')]['length']>0x0){var _0xc02866=_0x33e22c[_0x5a42('0xb')][0x0][_0x5a42('0xe')];_0x477527(_0xc02866);}else{return createRemoteTag(_0x4f703f,_0x20a42f,_0x132161,_0x26d1b3)['then'](function(_0x555a0c){_0x477527(_0x555a0c);});}});});}function assignTagToIncident(_0x298cd3,_0xda173,_0x5b8efe,_0x523c63,_0x38073c){return new Promise(function(_0x13bb5a,_0x1b67d5){var _0x57cf02={'method':_0x5a42('0x21'),'uri':_0x5b8efe+'label_entry'+'?'+_0x38073c,'body':{'label':_0x298cd3,'table':_0x5a42('0x3c'),'id_type':_0x5a42('0x48'),'table_key':_0x523c63[_0x5a42('0x43')],'title':_0x5a42('0x49')+_0x523c63[_0x5a42('0x44')],'id_display':_0x523c63['ticketNumber']},'auth':_0xda173,'json':!![]};return rp(_0x57cf02)['then'](function(_0x13b838){_0x13bb5a();})[_0x5a42('0x12')](function(){_0x13bb5a();});});}function manageTags(_0x2ea868,_0x7bb11f,_0x14e52d,_0x3fb98f,_0xd563c1,_0x201e10,_0x27bf39){return new Promise(function(_0x4866c9,_0x451cc7){var _0x1d272f=[];_0x7bb11f[_0x5a42('0x2a')](function(_0x21dc7c){_0x1d272f[_0x5a42('0x4a')](getRemoteTag(_0x21dc7c,_0x14e52d,_0x3fb98f,_0x201e10,_0x27bf39));});return Promise[_0x5a42('0x4b')](_0x1d272f)[_0x5a42('0x1a')](function(_0xda3765){if(_0xda3765['length']){logger[_0x5a42('0xf')]('['+[_0x2ea868['toUpperCase']()]+_0x5a42('0x4c'),_0xda3765);var _0x1022a0=[];_0xda3765[_0x5a42('0x2a')](function(_0x54841d){_0x1022a0[_0x5a42('0x4a')](assignTagToIncident(_0x54841d,_0x14e52d,_0x3fb98f,_0xd563c1,_0x201e10));});return Promise[_0x5a42('0x4b')](_0x1022a0)['then'](function(){_0x4866c9();})[_0x5a42('0x12')](function(){_0x4866c9();});}else{_0x4866c9();}});});}function getTags(_0x26975c,_0xeeb43,_0x4d62a5,_0x2a97ff,_0x48d8a8,_0x28f24c){return function(_0xc21ee5){return new Promise(function(_0x4234da,_0x43e175){var _0x40b51d=[];var _0x1b33a8=_0x2a97ff[_0x5a42('0x4d')];if(_0x1b33a8&&_0x1b33a8[_0x5a42('0xc')]>0x0){_0x40b51d=_[_0x5a42('0x4e')](_0x1b33a8,'name');}if(_0x40b51d[_0x5a42('0xc')]>0x0){return manageTags(_0x26975c,_0x40b51d,_0xeeb43,_0x4d62a5,_0xc21ee5,_0x48d8a8,_0x28f24c)[_0x5a42('0x1a')](function(){_0x4234da(_0xc21ee5);});}else{_0x4234da(_0xc21ee5);}});};}function emit(_0x6e5536,_0x11c583,_0x29be47){var _0x4b7d9f=_0x5a42('0x4f')+_0x5a42('0x50')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x5a42('0x51');var _0x1f11df={'uri':_0x6e5536+_0x5a42('0x52')+_0x29be47+_0x4b7d9f};io['to'](util[_0x5a42('0x53')](_0x5a42('0x54'),_0x11c583))[_0x5a42('0x55')]('trigger:browser:url',_0x1f11df);}exports['cs']=function(_0x12b9b5,_0x5effb0,_0x38544a,_0x8a048b,_0x421cd9,_0x146dc4,_0x1b4d9c,_0x50049f){var _0x179ed4={};var _0x2c79b2={'user':_0x146dc4[_0x5a42('0x56')],'pass':_0x146dc4[_0x5a42('0x57')]};var _0x4a89e5=_0x5a42('0x58');var _0x173e65=_0x5a42('0x59');_0x146dc4[_0x5a42('0x5a')]=intUtil['stripTrailingSlash'](_0x146dc4[_0x5a42('0x5a')]);_0x146dc4['serverUrl']=intUtil[_0x5a42('0x5b')](_0x146dc4[_0x5a42('0x5c')]);var _0x2665ed=util[_0x5a42('0x53')]('%s/api/now/table/',_0x146dc4[_0x5a42('0x5a')]);_0x179ed4[_0x5a42('0x17')]=!_[_0x5a42('0x5d')](_0x8a048b)?_0x8a048b['email']:null;_0x179ed4[_0x5a42('0x1e')]=_0x146dc4[_0x5a42('0x5e')];_0x179ed4[_0x5a42('0x23')]=_0x50049f[_0x5a42('0x32')]()===_0x5a42('0x3b')?_0x5effb0[_0x5a42('0x5f')]:_0x5effb0[_0x5a42('0x60')];_0x179ed4[_0x5a42('0x61')]=_0x50049f===_0x5a42('0x62')||_0x50049f===_0x5a42('0x63')?'queue':_0x5a42('0x3b');var _0x48c1b9=util[_0x5a42('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x146dc4[_0x5a42('0x5c')],_0x5effb0[_0x5a42('0x64')],md5(_0x5effb0[_0x5a42('0x64')]));if(_0x421cd9&&_0x421cd9[_0x5a42('0x65')]){logger[_0x5a42('0xf')](_0x5a42('0x66'),_0x5a42('0x67'));_0x5effb0[_0x5a42('0x68')]=_0x48c1b9;}else if(_0x1b4d9c&&_0x1b4d9c[_0x5a42('0x69')]&&_0x1b4d9c['recordingFormat']!==_0x5a42('0x6a')){logger['info']('[OUTBOUND]',_0x5a42('0x67'));_0x5effb0[_0x5a42('0x68')]=_0x48c1b9;}else{_0x5effb0[_0x5a42('0x68')]='';}return getAdminUser(_0x50049f,_0x2c79b2,_0x179ed4,_0x2665ed,_0x173e65,_0x4a89e5)[_0x5a42('0x1a')](getUser(_0x50049f,_0x2c79b2,_0x2665ed,_0x173e65,_0x4a89e5))[_0x5a42('0x1a')](getEndUser(_0x50049f,_0x2c79b2,_0x2665ed,_0x173e65,_0x4a89e5))['then'](getTicket(_0x50049f,_0x2c79b2,_0x2665ed,_0x38544a,_0x5effb0,_0x173e65))[_0x5a42('0x1a')](function(_0x329162){logger[_0x5a42('0xf')](util[_0x5a42('0x53')](_0x5a42('0x6b'),_0x329162[_0x5a42('0x43')]));logger[_0x5a42('0xf')](util[_0x5a42('0x53')](_0x5a42('0x6c'),_0x50049f));if(_0x50049f!=='unmanaged'){logger['info']('['+[_0x50049f[_0x5a42('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x146dc4[_0x5a42('0x5a')],_0x8a048b['name'],_0x329162[_0x5a42('0x43')]);}})[_0x5a42('0x12')](function(_0x58b77e){logger[_0x5a42('0x13')]('['+[_0x50049f['toUpperCase']()]+_0x5a42('0x6d'),util['inspect'](_0x58b77e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2982=['unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','ioredis','../../../../config/environment','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','toString','idField','content','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','format','%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','call\x20direction:\x20%s'];(function(_0x411a2d,_0x4ced44){var _0x4865d1=function(_0x283737){while(--_0x283737){_0x411a2d['push'](_0x411a2d['shift']());}};_0x4865d1(++_0x4ced44);}(_0x2982,0x13e));var _0x2298=function(_0x574fe9,_0x1864c9){_0x574fe9=_0x574fe9-0x0;var _0x360a50=_0x2982[_0x574fe9];return _0x360a50;};'use strict';var _=require('lodash');var Promise=require(_0x2298('0x0'));var rp=require('request-promise');var util=require(_0x2298('0x1'));var md5=require(_0x2298('0x2'));var Redis=require(_0x2298('0x3'));var intUtil=require('./util');var config=require(_0x2298('0x4'));var logger=require('../../../../config/logger')(_0x2298('0x5'));config[_0x2298('0x6')]=_[_0x2298('0x7')](config[_0x2298('0x6')],{'host':_0x2298('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x28dd84,_0x2dfbc3,_0xfe9527,_0x2d4b08,_0x58681c,_0x35f12c){return new Promise(function(_0x362f9f,_0x562885){var _0xb07e2={'method':_0x2298('0x9'),'uri':_0x2d4b08+_0x2298('0xa')+'&'+_0x58681c+'&'+_0x35f12c,'auth':_0x2dfbc3,'json':!![]};return rp(_0xb07e2)[_0x2298('0xb')](function(_0x115c40){if(_0x115c40[_0x2298('0xc')][_0x2298('0xd')]>0x0){_0xfe9527[_0x2298('0xe')]=_0x115c40[_0x2298('0xc')][0x0][_0x2298('0xf')];}logger[_0x2298('0x10')]('['+[_0x28dd84[_0x2298('0x11')]()]+'],\x20getAdminUser\x20crm',_0xfe9527);_0x362f9f(_0xfe9527);})[_0x2298('0x12')](function(_0x45651a){logger['error']('['+[_0x28dd84[_0x2298('0x11')]()]+']',_0x45651a[_0x2298('0x13')]);_0x562885(_0x45651a[_0x2298('0x13')]);});});}function getUser(_0xa44f4e,_0x535fb2,_0x203e1f,_0x36fb69,_0x156eb9){return function(_0x4b14ad){logger['info']('['+[_0xa44f4e['toUpperCase']()]+_0x2298('0x14'),_0x4b14ad);return new Promise(function(_0x2c770e,_0x55f917){if(intUtil['validateEmail'](_0x4b14ad[_0x2298('0x15')])){var _0x520dbd={'method':'GET','uri':_0x203e1f+_0x2298('0x16')+_0x4b14ad[_0x2298('0x15')]+'&'+_0x36fb69+'&'+_0x156eb9,'auth':_0x535fb2,'json':!![]};logger[_0x2298('0x10')]('['+[_0xa44f4e[_0x2298('0x11')]()]+_0x2298('0x17'),_0x520dbd);return rp(_0x520dbd)[_0x2298('0xb')](function(_0xb3a267){logger[_0x2298('0x10')]('['+[_0xa44f4e[_0x2298('0x11')]()]+'],\x20getUser\x20entity',_0xb3a267);if(_0xb3a267[_0x2298('0xc')][_0x2298('0xd')]>0x0&&String(_0xb3a267[_0x2298('0xc')][0x0][_0x2298('0x18')])===_0x2298('0x19')){_0x4b14ad['userId']=_0xb3a267[_0x2298('0xc')][0x0]['sys_id'];}else{_0x4b14ad[_0x2298('0x1a')]=_0x4b14ad[_0x2298('0xe')];_0x4b14ad[_0x2298('0x15')]=_0x4b14ad[_0x2298('0x1b')];}logger[_0x2298('0x10')]('['+[_0xa44f4e['toUpperCase']()]+_0x2298('0x1c'),_0x4b14ad);_0x2c770e(_0x4b14ad);})[_0x2298('0x12')](function(_0x4edca4){logger[_0x2298('0x1d')]('['+[_0xa44f4e[_0x2298('0x11')]()]+']',_0x4edca4[_0x2298('0x13')]);_0x55f917(_0x4edca4[_0x2298('0x13')]);});}else{logger[_0x2298('0x10')]('['+[_0xa44f4e['toUpperCase']()]+_0x2298('0x1e'));_0x4b14ad['userId']=_0x4b14ad[_0x2298('0xe')];_0x4b14ad[_0x2298('0x15')]=_0x4b14ad[_0x2298('0x1b')];_0x2c770e(_0x4b14ad);}});};}function createEndUser(_0x51e5eb,_0x216fc6,_0x2526e0,_0x346389,_0x31cbf2){logger[_0x2298('0x10')]('['+[_0x51e5eb[_0x2298('0x11')]()]+_0x2298('0x1f'),_0x2526e0);return new Promise(function(_0x1dadc0,_0xd4c3f8){var _0x5bbf58={'method':'POST','uri':_0x346389+_0x2298('0x20')+_0x31cbf2,'body':{'user_name':_0x2526e0[_0x2298('0x21')],'roles':_0x2298('0x22'),'first_name':_0x2526e0[_0x2298('0x21')],'active':_0x2298('0x19'),'date_format':_0x2298('0x23'),'phone':_0x2526e0['endUserNumber']},'auth':_0x216fc6,'json':!![]};return rp(_0x5bbf58)['then'](function(_0x53548f){logger[_0x2298('0x10')]('['+[_0x51e5eb[_0x2298('0x11')]()]+_0x2298('0x24'),_0x53548f[_0x2298('0xc')]);_0x2526e0['endUserId']=_0x53548f[_0x2298('0xc')]['sys_id'];_0x1dadc0(_0x2526e0);})[_0x2298('0x12')](function(_0x229f59){logger[_0x2298('0x1d')]('['+[_0x51e5eb['toUpperCase']()]+']',_0x229f59['message']);_0xd4c3f8(_0x229f59[_0x2298('0x13')]);});});}function getEndUser(_0x3943ea,_0x26e45f,_0x1ffaa4,_0x3cd76b,_0x57e2c6){return function(_0x1a4656){logger['info']('['+[_0x3943ea[_0x2298('0x11')]()]+_0x2298('0x25'),_0x1a4656);return new Promise(function(_0x12c155,_0x591714){var _0x4971a9={'method':'GET','uri':_0x1ffaa4+_0x2298('0x26')+_0x1a4656[_0x2298('0x21')]+'&'+_0x3cd76b+'&'+_0x57e2c6,'auth':_0x26e45f,'json':!![]};return rp(_0x4971a9)[_0x2298('0xb')](function(_0x2ec610){if(_0x2ec610[_0x2298('0xc')][_0x2298('0xd')]>0x0){_0x1a4656[_0x2298('0x27')]=_0x2ec610['result'][0x0][_0x2298('0xf')];logger[_0x2298('0x10')]('['+[_0x3943ea['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x1a4656);_0x12c155(_0x1a4656);}else{return createEndUser(_0x3943ea,_0x26e45f,_0x1a4656,_0x1ffaa4,_0x3cd76b)['then'](function(_0x56cadf){logger[_0x2298('0x10')]('['+[_0x3943ea['toUpperCase']()]+_0x2298('0x28'),_0x56cadf);_0x12c155(_0x56cadf);});}})['catch'](function(_0x3513ee){logger[_0x2298('0x1d')]('['+[_0x3943ea['toUpperCase']()]+']',_0x3513ee[_0x2298('0x13')]);_0x591714(_0x3513ee[_0x2298('0x13')]);});});};}function getCustomFields(_0x13955c,_0x245e18){var _0x3b2fe2={};if(_0x13955c[_0x2298('0xd')]>0x0){_[_0x2298('0x29')](_0x13955c,function(_0x426d8f){if(_[_0x2298('0x2a')]([_0x2298('0x2b'),_0x2298('0x2c')],_0x426d8f[_0x2298('0x2d')])&&_0x426d8f[_0x2298('0x2e')]&&!_0x426d8f[_0x2298('0x2f')]){_0x3b2fe2[_0x426d8f[_0x2298('0x2e')][_0x2298('0x30')]()]=_0x426d8f['content'][_0x2298('0x31')]();}else if(_['includes']([_0x2298('0x2b'),_0x2298('0x2c')],_0x426d8f[_0x2298('0x2d')])&&_0x426d8f[_0x2298('0x32')]&&_0x426d8f[_0x2298('0x2f')]){_0x3b2fe2[_0x426d8f[_0x2298('0x32')]['toLowerCase']()]=_0x426d8f[_0x2298('0x33')][_0x2298('0x31')]();}else if(_0x426d8f[_0x2298('0x2d')]==='variable'&&_0x426d8f[_0x2298('0x34')]&&_0x426d8f[_0x2298('0x32')]&&_0x426d8f[_0x2298('0x2f')]){_0x3b2fe2[_0x426d8f[_0x2298('0x32')][_0x2298('0x30')]()]=_0x245e18[_0x426d8f['variableName']][_0x2298('0x31')]();}else if(_0x426d8f[_0x2298('0x2d')]===_0x2298('0x35')&&_0x426d8f[_0x2298('0x36')]&&_0x426d8f[_0x2298('0x36')][_0x2298('0x37')]&&_0x426d8f[_0x2298('0x32')]&&_0x426d8f[_0x2298('0x2f')]){_0x3b2fe2[_0x426d8f[_0x2298('0x32')][_0x2298('0x30')]()]=_0x245e18[_0x426d8f['Variable'][_0x2298('0x37')][_0x2298('0x30')]()][_0x2298('0x31')]();}});}return _0x3b2fe2;}function getTicket(_0x1381f8,_0x311501,_0x5dbd58,_0x419ad7,_0x353ddb,_0x402ebb){return function(_0x48cfd6){logger[_0x2298('0x10')]('['+[_0x1381f8['toUpperCase']()]+_0x2298('0x38'),_0x48cfd6);return new Promise(function(_0x39f655,_0x4eb4df){var _0x4ebc1c=_0x1381f8[_0x2298('0x30')]()===_0x2298('0x39')?_0x48cfd6[_0x2298('0x1a')]:_0x48cfd6[_0x2298('0x27')];var _0x5e5dad={'method':_0x2298('0x3a'),'uri':_0x5dbd58+'incident'+'?'+_0x402ebb,'body':Object[_0x2298('0x3b')]({},{'active':'true','caller_id':_0x4ebc1c,'assigned_to':_0x48cfd6['userId'],'short_description':intUtil[_0x2298('0x3c')](_0x419ad7['Subjects'],_0x353ddb,'\x20'),'description':intUtil['getString'](_0x419ad7['Descriptions'],_0x353ddb,'\x0a')},getCustomFields(_0x419ad7[_0x2298('0x3d')],_0x353ddb)),'auth':_0x311501,'json':!![]};return rp(_0x5e5dad)[_0x2298('0xb')](function(_0x4fad83){logger[_0x2298('0x10')]('['+[_0x1381f8[_0x2298('0x11')]()]+_0x2298('0x3e'),_0x4fad83[_0x2298('0xc')]);_0x48cfd6[_0x2298('0x3f')]=_0x4fad83[_0x2298('0xc')]['sys_id'];_0x48cfd6['ticketNumber']=_0x4fad83[_0x2298('0xc')][_0x2298('0x40')];logger[_0x2298('0x10')]('['+[_0x1381f8[_0x2298('0x11')]()]+_0x2298('0x41'),_0x48cfd6);_0x39f655(_0x48cfd6);})['catch'](function(_0x46bc97){logger['error']('['+[_0x1381f8[_0x2298('0x11')]()]+']',_0x46bc97[_0x2298('0x13')]);_0x4eb4df(_0x46bc97[_0x2298('0x13')]);});});};}function createRemoteTag(_0xcc3fb9,_0x37d23b,_0x2c0bb2,_0x1a0987){return new Promise(function(_0x322606,_0x4e2f80){var _0x448742={'method':'POST','uri':_0x2c0bb2+_0x2298('0x42')+'?'+_0x1a0987,'body':{'short_description':_0xcc3fb9,'global':!![],'active':!![],'name':_0xcc3fb9},'auth':_0x37d23b,'json':!![]};return rp(_0x448742)[_0x2298('0xb')](function(_0x429e36){var _0xa98b79=_0x429e36[_0x2298('0xc')]['sys_id'];_0x322606(_0xa98b79);});});}function getRemoteTag(_0x320cf7,_0x257dc7,_0x146d73,_0x19181c,_0x157e78){return new Promise(function(_0x1ed025,_0x116d45){var _0x197c67={'method':_0x2298('0x9'),'uri':_0x146d73+_0x2298('0x42')+'?sysparm_query=name%3D'+_0x320cf7+'&'+_0x19181c,'auth':_0x257dc7,'json':!![]};return rp(_0x197c67)[_0x2298('0xb')](function(_0x1f7f78){if(_0x1f7f78[_0x2298('0xc')]['length']>0x0){var _0x21d52b=_0x1f7f78[_0x2298('0xc')][0x0][_0x2298('0xf')];_0x1ed025(_0x21d52b);}else{return createRemoteTag(_0x320cf7,_0x257dc7,_0x146d73,_0x19181c)['then'](function(_0xc408f0){_0x1ed025(_0xc408f0);});}});});}function assignTagToIncident(_0xbdb423,_0x289261,_0x204ebe,_0x5a7b96,_0x1d5e37){return new Promise(function(_0x20a05e,_0x4605fb){var _0x13a159={'method':_0x2298('0x3a'),'uri':_0x204ebe+_0x2298('0x43')+'?'+_0x1d5e37,'body':{'label':_0xbdb423,'table':'incident','id_type':_0x2298('0x44'),'table_key':_0x5a7b96[_0x2298('0x3f')],'title':_0x2298('0x45')+_0x5a7b96[_0x2298('0x46')],'id_display':_0x5a7b96['ticketNumber']},'auth':_0x289261,'json':!![]};return rp(_0x13a159)[_0x2298('0xb')](function(_0x1bd52b){_0x20a05e();})['catch'](function(){_0x20a05e();});});}function manageTags(_0x3d7aae,_0x5bab4d,_0x4b9173,_0x2e27d3,_0x211b77,_0x2f04ad,_0x24f8a8){return new Promise(function(_0x1a255e,_0x3308e0){var _0x464398=[];_0x5bab4d[_0x2298('0x29')](function(_0x17565f){_0x464398['push'](getRemoteTag(_0x17565f,_0x4b9173,_0x2e27d3,_0x2f04ad,_0x24f8a8));});return Promise[_0x2298('0x47')](_0x464398)[_0x2298('0xb')](function(_0x17a001){if(_0x17a001[_0x2298('0xd')]){logger[_0x2298('0x10')]('['+[_0x3d7aae[_0x2298('0x11')]()]+_0x2298('0x48'),_0x17a001);var _0x3f8a1b=[];_0x17a001[_0x2298('0x29')](function(_0xde3ce9){_0x3f8a1b['push'](assignTagToIncident(_0xde3ce9,_0x4b9173,_0x2e27d3,_0x211b77,_0x2f04ad));});return Promise['all'](_0x3f8a1b)[_0x2298('0xb')](function(){_0x1a255e();})[_0x2298('0x12')](function(){_0x1a255e();});}else{_0x1a255e();}});});}function getTags(_0x33b7bf,_0x53a5ea,_0x5bab58,_0x248cab,_0x58dd19,_0x292d6f){return function(_0x45ecdf){return new Promise(function(_0x16158f,_0x6aa2a3){var _0x31818f=[];var _0x235efa=_0x248cab['Tags'];if(_0x235efa&&_0x235efa[_0x2298('0xd')]>0x0){_0x31818f=_[_0x2298('0x49')](_0x235efa,'name');}if(_0x31818f[_0x2298('0xd')]>0x0){return manageTags(_0x33b7bf,_0x31818f,_0x53a5ea,_0x5bab58,_0x45ecdf,_0x58dd19,_0x292d6f)['then'](function(){_0x16158f(_0x45ecdf);});}else{_0x16158f(_0x45ecdf);}});};}function emit(_0x54b4bc,_0x58af03,_0x5c1416){var _0x71b2ea=_0x2298('0x4a')+_0x2298('0x4b')+_0x2298('0x4c')+_0x2298('0x4d');var _0xa6ce7f={'uri':_0x54b4bc+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5c1416+_0x71b2ea};io['to'](util['format'](_0x2298('0x4e'),_0x58af03))[_0x2298('0x4f')]('trigger:browser:url',_0xa6ce7f);}exports['cs']=function(_0x329dd7,_0x3d3d0d,_0x199bce,_0x5d8f67,_0x3eec3b,_0x292cbb,_0x2b8b8f,_0x7ed1f6){var _0x3d3284={};var _0x1339d4={'user':_0x292cbb[_0x2298('0x50')],'pass':_0x292cbb['password']};var _0x11c66f=_0x2298('0x51');var _0x53277b=_0x2298('0x52');_0x292cbb['remoteUri']=intUtil[_0x2298('0x53')](_0x292cbb[_0x2298('0x54')]);_0x292cbb['serverUrl']=intUtil[_0x2298('0x53')](_0x292cbb[_0x2298('0x55')]);var _0x50918b=util['format']('%s/api/now/table/',_0x292cbb[_0x2298('0x54')]);_0x3d3284[_0x2298('0x15')]=!_[_0x2298('0x56')](_0x5d8f67)?_0x5d8f67['email']:null;_0x3d3284[_0x2298('0x1b')]=_0x292cbb[_0x2298('0x57')];_0x3d3284[_0x2298('0x21')]=_0x7ed1f6['toLowerCase']()===_0x2298('0x39')?_0x3d3d0d[_0x2298('0x58')]:_0x3d3d0d[_0x2298('0x59')];_0x3d3284[_0x2298('0x5a')]=_0x7ed1f6==='queue'||_0x7ed1f6==='unmanaged'?'queue':_0x2298('0x39');var _0x38d99a=util[_0x2298('0x5b')](_0x2298('0x5c'),_0x292cbb['serverUrl'],_0x3d3d0d[_0x2298('0x5d')],md5(_0x3d3d0d[_0x2298('0x5d')]));if(_0x3eec3b&&_0x3eec3b[_0x2298('0x5e')]){logger[_0x2298('0x10')]('[QUEUE]',_0x2298('0x5f'));_0x3d3d0d[_0x2298('0x60')]=_0x38d99a;}else if(_0x2b8b8f&&_0x2b8b8f[_0x2298('0x61')]&&_0x2b8b8f[_0x2298('0x61')]!==_0x2298('0x62')){logger[_0x2298('0x10')](_0x2298('0x63'),_0x2298('0x5f'));_0x3d3d0d[_0x2298('0x60')]=_0x38d99a;}else{_0x3d3d0d['recordingURL']='';}return getAdminUser(_0x7ed1f6,_0x1339d4,_0x3d3284,_0x50918b,_0x53277b,_0x11c66f)[_0x2298('0xb')](getUser(_0x7ed1f6,_0x1339d4,_0x50918b,_0x53277b,_0x11c66f))[_0x2298('0xb')](getEndUser(_0x7ed1f6,_0x1339d4,_0x50918b,_0x53277b,_0x11c66f))[_0x2298('0xb')](getTicket(_0x7ed1f6,_0x1339d4,_0x50918b,_0x199bce,_0x3d3d0d,_0x53277b))[_0x2298('0xb')](function(_0x23b485){logger[_0x2298('0x10')](util['format'](_0x2298('0x64'),_0x23b485['ticketId']));logger['info'](util['format'](_0x2298('0x65'),_0x7ed1f6));if(_0x7ed1f6!==_0x2298('0x66')){logger['info']('['+[_0x7ed1f6['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x292cbb[_0x2298('0x54')],_0x5d8f67[_0x2298('0x37')],_0x23b485[_0x2298('0x3f')]);}})[_0x2298('0x12')](function(_0x879cec){logger[_0x2298('0x1d')]('['+[_0x7ed1f6[_0x2298('0x11')]()]+_0x2298('0x67'),util[_0x2298('0x68')](_0x879cec,{'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 08b0fb1..91f0f4e 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 _0x8f05=['set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','uri','monitor_format','lastevent','toUpperCase','isNil','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','parent_id','parent_type','Contacts','direction','length','forEach','idField','variableName','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','phone_home','[HTTP]','merge','string','customField','custom_fields','content','push','type','customVariable','Variable','toLowerCase','login','username','password','PLAIN','Account\x20%d\x20is\x20not\x20valid'];(function(_0x511232,_0x1badcb){var _0x3b081e=function(_0x1f3a9a){while(--_0x1f3a9a){_0x511232['push'](_0x511232['shift']());}};_0x3b081e(++_0x1badcb);}(_0x8f05,0x18e));var _0x58f0=function(_0x1337ed,_0x3c321d){_0x1337ed=_0x1337ed-0x0;var _0x3677cb=_0x8f05[_0x1337ed];return _0x3677cb;};'use strict';var _=require('lodash');var rp=require(_0x58f0('0x0'));var BPromise=require(_0x58f0('0x1'));var md5=require(_0x58f0('0x2'));var util=require(_0x58f0('0x3'));var Redis=require('ioredis');var intUtil=require(_0x58f0('0x4'));var config=require(_0x58f0('0x5'));var logger=require(_0x58f0('0x6'))('sugarcrm');config[_0x58f0('0x7')]=_[_0x58f0('0x8')](config[_0x58f0('0x7')],{'host':_0x58f0('0x9'),'port':0x18eb});var io=require(_0x58f0('0xa'))(new Redis(config[_0x58f0('0x7')]));var def={'method':_0x58f0('0xb'),'json':!![]};function emit(_0x56b5cf,_0xfefc7a,_0x22d23f){io['to'](_0x56b5cf)[_0x58f0('0xc')](_0xfefc7a,_0x22d23f);}function getTicket(_0x34606b,_0x29dbd2,_0xb85a2f,_0x53760a,_0xc6d725,_0x4398e2,_0x53ac6e,_0x178738){logger[_0x58f0('0xd')]('Creating\x20new\x20ticket...');var _0x2e79af=new Date();var _0x52bf05=[{'name':_0x58f0('0xe'),'value':intUtil[_0x58f0('0xf')](_0x53760a[_0x58f0('0x10')],_0xc6d725,'\x20')},{'name':_0x58f0('0x11'),'value':_0x29dbd2['id']},{'name':_0x58f0('0x12'),'value':_0x29dbd2['id']},{'name':_0x58f0('0x13'),'value':intUtil[_0x58f0('0xf')](_0x53760a[_0x58f0('0x14')],_0xc6d725,'\x0a')},{'name':_0x58f0('0x15'),'value':_0x2e79af['toISOString']()[_0x58f0('0x16')](0x0,0x13)[_0x58f0('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x58f0('0x18'),'value':_0xb85a2f['id']},{'name':_0x58f0('0x19'),'value':_0x58f0('0x1a')},{'name':'parent_name','value':_0xb85a2f['name']},{'name':_0x58f0('0x1b'),'value':_0x178738}];if(_0x4398e2[_0x58f0('0x1c')]){_[_0x58f0('0x1d')](_0x4398e2,function(_0x1d1ae1){if(_0xc6d725[_0x1d1ae1['variableName']]){_0x52bf05['push']({'name':_0x1d1ae1[_0x58f0('0x1e')],'value':_0xc6d725[_0x1d1ae1[_0x58f0('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x58f0('0x20'),'response_type':_0x58f0('0x20'),'rest_data':JSON[_0x58f0('0x21')]({'session':_0x53ac6e['id'],'module_name':_0x58f0('0x22'),'name_value_list':_0x52bf05})}});}function getAuth(_0x35c435){return util[_0x58f0('0x23')](_0x58f0('0x24'),new Buffer(_0x35c435['apiKey']+':X')[_0x58f0('0x25')](_0x58f0('0x26')));}function getServerInfo(_0x479a52){return request({'form':{'method':_0x58f0('0x27'),'input_type':_0x58f0('0x20'),'response_type':_0x58f0('0x20'),'rest_data':JSON[_0x58f0('0x21')]({'session':_0x479a52['id']})}});}function getUser(_0x59c902,_0x239473,_0x4cd2f6){if(!_['isNil'](_0x239473)){logger[_0x58f0('0xd')](_0x58f0('0x28'),_0x239473);return request({'form':{'method':'get_entry_list','input_type':_0x58f0('0x20'),'response_type':_0x58f0('0x20'),'rest_data':JSON[_0x58f0('0x21')]({'session':_0x4cd2f6['id'],'module_name':'Employees','query':util[_0x58f0('0x23')](_0x58f0('0x29'),_0x239473),'order_by':'','offset':'0','select_fields':['id',_0x58f0('0xe'),_0x58f0('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x58f0('0x2b')](function(_0x2772ce){if(_0x2772ce[_0x58f0('0x2c')]['length']){var _0x4c6311=_[_0x58f0('0x2d')](_0x2772ce[_0x58f0('0x2c')],function(_0x2fe513){return _0x2fe513[_0x58f0('0x2e')][_0x58f0('0x2a')][_0x58f0('0x2f')]===_0x239473;});if(_0x4c6311){logger[_0x58f0('0xd')](_0x58f0('0x30'));return BPromise[_0x58f0('0x31')]({'id':_0x4c6311['name_value_list']['id'][_0x58f0('0x2f')],'name':_0x4c6311[_0x58f0('0x2e')][_0x58f0('0xe')][_0x58f0('0x2f')]});}}logger[_0x58f0('0xd')](_0x58f0('0x32'));return BPromise[_0x58f0('0x31')]({'id':_0x4cd2f6[_0x58f0('0x2e')][_0x58f0('0x33')]['value'],'name':_0x4cd2f6['name_value_list']['user_name']['value']});});}else{logger[_0x58f0('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x58f0('0x31')]({'id':_0x4cd2f6['name_value_list'][_0x58f0('0x33')][_0x58f0('0x2f')],'name':_0x4cd2f6[_0x58f0('0x2e')][_0x58f0('0x2a')][_0x58f0('0x2f')]});}}function getEndUser(_0x322d6e,_0x54a064,_0x1fe6ba,_0x557731){logger[_0x58f0('0xd')](_0x58f0('0x34'),_0x1fe6ba);return request({'form':{'method':_0x58f0('0x35'),'input_type':_0x58f0('0x20'),'response_type':_0x58f0('0x20'),'rest_data':JSON[_0x58f0('0x21')]({'session':_0x557731['id'],'module_name':'Contacts','query':util[_0x58f0('0x23')](_0x58f0('0x36'),_0x1fe6ba),'order_by':'','offset':'0','select_fields':['id',_0x58f0('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x58f0('0x2b')](function(_0x51c80e){if(_0x51c80e['entry_list'][_0x58f0('0x1c')]){var _0x486be6=_[_0x58f0('0x2d')](_0x51c80e['entry_list'],function(_0x131641){return _0x131641['name_value_list']['phone_home'][_0x58f0('0x2f')]===_0x1fe6ba;});if(_0x486be6){logger['info']('Enduser\x20found!');return BPromise[_0x58f0('0x31')]({'id':_0x486be6[_0x58f0('0x2e')]['id'][_0x58f0('0x2f')],'name':_0x486be6[_0x58f0('0x2e')][_0x58f0('0xe')][_0x58f0('0x2f')],'phone':_0x486be6[_0x58f0('0x2e')]['phone_home'][_0x58f0('0x2f')]});}}else{logger[_0x58f0('0xd')](_0x58f0('0x37'));return request({'form':{'method':_0x58f0('0x38'),'input_type':_0x58f0('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x557731['id'],'module_name':_0x58f0('0x1a'),'name_value_list':[{'name':_0x58f0('0x39'),'value':_0x54a064!==_0x58f0('0x3a')?_0x54a064:util[_0x58f0('0x23')](_0x58f0('0x3b'),_0x1fe6ba)},{'name':'phone_home','value':_0x1fe6ba}]})}})['then'](function(_0x58006b){logger['info'](_0x58f0('0x3c'));return BPromise[_0x58f0('0x31')]({'id':_0x58006b['id'],'name':_0x58006b[_0x58f0('0x2c')]['first_name'][_0x58f0('0x2f')],'phone':_0x58006b['entry_list'][_0x58f0('0x3d')][_0x58f0('0x2f')]});});}});}function request(_0xcaa696){logger['debug'](_0x58f0('0x3e'),JSON['stringify'](_0xcaa696));return rp(_[_0x58f0('0x3f')](def,_0xcaa696));}function getTags(_0x26f590,_0x132d8f){var _0x5e6479=[];if(_0x26f590&&_0x26f590[_0x58f0('0x1c')]>0x0){_0x5e6479=_['map'](_0x26f590,_0x132d8f);}return _0x5e6479;}function getCustomFields(_0x2558d9,_0x1f57cc){var _0x479e83=[];var _0xb8bcc6={'custom_fields':[]};if(_0x2558d9[_0x58f0('0x1c')]>0x0){_['forEach'](_0x2558d9,function(_0x2f64e7){if(_0x2f64e7['type']===_0x58f0('0x40')&&_0x2f64e7['nameField']&&!_0x2f64e7['customField']){_0xb8bcc6[_0x2f64e7['nameField']['toLowerCase']()]=_0x2f64e7['content'][_0x58f0('0x25')]();}else if(_0x2f64e7['type']===_0x58f0('0x40')&&_0x2f64e7[_0x58f0('0x1e')]&&_0x2f64e7[_0x58f0('0x41')]){_0xb8bcc6[_0x58f0('0x42')]['push']({'id':_0x2f64e7[_0x58f0('0x1e')],'value':_0x2f64e7[_0x58f0('0x43')]['toString']()});}else if(_0x2f64e7['type']==='variable'&&_0x2f64e7[_0x58f0('0x1f')]&&_0x2f64e7[_0x58f0('0x1e')]&&_0x2f64e7['customField']){_0x1f57cc[_0x2f64e7[_0x58f0('0x1f')]]&&_0xb8bcc6['custom_fields'][_0x58f0('0x44')]({'id':_0x2f64e7['idField'],'value':_0x1f57cc[_0x2f64e7[_0x58f0('0x1f')]][_0x58f0('0x25')]()});}else if(_0x2f64e7[_0x58f0('0x45')]===_0x58f0('0x46')&&_0x2f64e7[_0x58f0('0x47')]&&_0x2f64e7[_0x58f0('0x47')][_0x58f0('0xe')]&&_0x2f64e7[_0x58f0('0x1e')]&&_0x2f64e7[_0x58f0('0x41')]){_0x1f57cc[_0x2f64e7[_0x58f0('0x47')][_0x58f0('0xe')][_0x58f0('0x48')]()]&&_0xb8bcc6[_0x58f0('0x42')][_0x58f0('0x44')]({'id':_0x2f64e7[_0x58f0('0x1e')],'value':_0x1f57cc[_0x2f64e7[_0x58f0('0x47')][_0x58f0('0xe')][_0x58f0('0x48')]()][_0x58f0('0x25')]()});}});}return _0xb8bcc6;}function getConnection(_0x4becf2){return request({'method':'POST','form':{'method':_0x58f0('0x49'),'input_type':_0x58f0('0x20'),'response_type':_0x58f0('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4becf2[_0x58f0('0x4a')],'password':_0x4becf2[_0x58f0('0x4b')],'encryption':_0x58f0('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x58f0('0x2b')](function(_0x306f0d){var _0x1bf4d3=_0x306f0d;if(_0x1bf4d3['id']){def['sessionID']=_0x1bf4d3['id'];return BPromise[_0x58f0('0x31')](_0x1bf4d3);}else{throw new Error(util['format'](_0x58f0('0x4d'),_0x4becf2['id']));}});}function setRelationship(_0x3546aa,_0x2384a4,_0x47436b,_0x1b9727){return request({'form':{'method':_0x58f0('0x4e'),'input_type':_0x58f0('0x20'),'response_type':'JSON','rest_data':JSON[_0x58f0('0x21')]({'session':_0x3546aa['id'],'module_name':_0x58f0('0x22'),'module_id':_0x47436b['id'],'link_field_name':_0x1b9727,'related_ids':[_0x2384a4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x58f0('0x4f')]=function(_0x1e8d0c,_0x283cee,_0x58269c,_0x3f9776,_0x476770,_0x2d3b13){var _0x4334f5,_0x37338f,_0x3aaed5,_0x2c49cb;_0x2d3b13[_0x58f0('0x50')]=intUtil[_0x58f0('0x51')](_0x2d3b13[_0x58f0('0x50')]);_0x2d3b13[_0x58f0('0x52')]=intUtil['stripTrailingSlash'](_0x2d3b13[_0x58f0('0x52')]);def['uri']=util[_0x58f0('0x23')]('%s/service/v4_1/rest.php',_0x2d3b13[_0x58f0('0x50')]);if(_0x476770&&_0x476770['monitor_format']){logger[_0x58f0('0xd')](_0x58f0('0x53'),_0x58f0('0x54'));_0x283cee['recordingURL']=util[_0x58f0('0x23')](_0x58f0('0x55'),_0x2d3b13[_0x58f0('0x52')],_0x283cee[_0x58f0('0x56')],md5(_0x283cee[_0x58f0('0x56')]));}else{_0x283cee[_0x58f0('0x57')]='';}return getConnection(_0x2d3b13)[_0x58f0('0x2b')](function(_0x13c460){_0x2c49cb=_0x13c460;return getUser(_0x2d3b13,_0x3f9776[_0x58f0('0xe')],_0x2c49cb);})['then'](function(_0xac7b4d){_0x4334f5=_0xac7b4d;logger[_0x58f0('0xd')](_0x58f0('0x58'),_0x4334f5['id']);return getEndUser(_0x2d3b13,_0x283cee[_0x58f0('0x59')],_0x283cee[_0x58f0('0x5a')],_0x2c49cb);})[_0x58f0('0x2b')](function(_0x5403b5){_0x37338f=_0x5403b5;logger[_0x58f0('0xd')](_0x58f0('0x5b'),_0x37338f['id']);return getTicket(_0x2d3b13,_0x4334f5,_0x37338f,_0x58269c,_0x283cee,_0x58269c[_0x58f0('0x5c')],_0x2c49cb,_0x58f0('0x5d'));})[_0x58f0('0x2b')](function(_0xa03c03){_0x3aaed5=_0xa03c03;logger['info'](_0x58f0('0x5e'));logger[_0x58f0('0xd')](_0x58f0('0x5f'),_0x3aaed5['id']);return setRelationship(_0x2c49cb,_0x4334f5,_0x3aaed5,_0x58f0('0x60'));})[_0x58f0('0x2b')](function(){return setRelationship(_0x2c49cb,_0x37338f,_0x3aaed5,_0x58f0('0x61'));})[_0x58f0('0x2b')](function(){return getServerInfo(_0x2c49cb);})[_0x58f0('0x2b')](function(_0x82084){var _0x102846=parseInt(_0x82084[_0x58f0('0x62')]['charAt'](0x0));var _0x268553=util[_0x58f0('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2d3b13[_0x58f0('0x50')],_0x3aaed5['id']);if(_0x102846>0x6){_0x268553=util[_0x58f0('0x23')](_0x58f0('0x63'),_0x2d3b13[_0x58f0('0x50')],_0x3aaed5['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x58f0('0x23')](_0x58f0('0x64'),_0x3f9776[_0x58f0('0xe')]),_0x58f0('0x65'),{'uri':_0x268553});})[_0x58f0('0x66')](function(_0x5bce2a){logger[_0x58f0('0x67')](_0x58f0('0x53'),JSON[_0x58f0('0x21')](_0x5bce2a));});};exports[_0x58f0('0x68')]=function(_0x5d2f4c,_0x3b6573,_0xfb19c6,_0x40a29c,_0x145020,_0x11c3b6,_0x379b98){var _0x449974,_0x560656,_0x332bd9,_0x301f22;_0x11c3b6['remoteUri']=intUtil[_0x58f0('0x51')](_0x11c3b6[_0x58f0('0x50')]);_0x11c3b6['serverUrl']=intUtil[_0x58f0('0x51')](_0x11c3b6[_0x58f0('0x52')]);def['uri']=util[_0x58f0('0x23')](_0x58f0('0x69'),_0x11c3b6[_0x58f0('0x50')]);if(_0x379b98&&_0x379b98['recordingFormat']&&_0x379b98[_0x58f0('0x6a')]!==_0x58f0('0x6b')){logger[_0x58f0('0xd')](_0x58f0('0x6c'),_0x58f0('0x54'));_0x3b6573[_0x58f0('0x57')]=util[_0x58f0('0x23')](_0x58f0('0x55'),_0x11c3b6[_0x58f0('0x52')],_0x3b6573['uniqueid'],md5(_0x3b6573[_0x58f0('0x56')]));}return getConnection(_0x11c3b6)[_0x58f0('0x2b')](function(_0x3cab01){_0x301f22=_0x3cab01;return getUser(_0x11c3b6,_0x40a29c[_0x58f0('0xe')],_0x301f22);})[_0x58f0('0x2b')](function(_0x58c303){_0x449974=_0x58c303;logger[_0x58f0('0xd')](_0x58f0('0x58'),_0x449974['id']);return getEndUser(_0x11c3b6,_0x3b6573[_0x58f0('0x6d')],_0x3b6573[_0x58f0('0x6e')],_0x301f22);})[_0x58f0('0x2b')](function(_0x133401){_0x560656=_0x133401;logger[_0x58f0('0xd')](_0x58f0('0x5b'),_0x560656['id']);return getTicket(_0x11c3b6,_0x449974,_0x560656,_0xfb19c6,_0x3b6573,_0xfb19c6[_0x58f0('0x5c')],_0x301f22,'Outbound');})[_0x58f0('0x2b')](function(_0x13736d){_0x332bd9=_0x13736d;logger[_0x58f0('0xd')](_0x58f0('0x5e'));logger[_0x58f0('0xd')](_0x58f0('0x5f'),_0x332bd9['id']);return setRelationship(_0x301f22,_0x449974,_0x332bd9,_0x58f0('0x60'));})[_0x58f0('0x2b')](function(){return setRelationship(_0x301f22,_0x560656,_0x332bd9,_0x58f0('0x61'));})['then'](function(){return getServerInfo(_0x301f22);})[_0x58f0('0x2b')](function(_0x28e4ec){var _0x2ef84d=parseInt(_0x28e4ec['version']['charAt'](0x0));var _0x23dc8e=util[_0x58f0('0x23')](_0x58f0('0x6f'),_0x11c3b6['remoteUri'],_0x332bd9['id']);if(_0x2ef84d>0x6){_0x23dc8e=util[_0x58f0('0x23')](_0x58f0('0x63'),_0x11c3b6['remoteUri'],_0x332bd9['id']);}logger[_0x58f0('0xd')](_0x58f0('0x6c'),_0x58f0('0x70'));emit(util[_0x58f0('0x23')](_0x58f0('0x64'),_0x40a29c[_0x58f0('0xe')]),_0x58f0('0x65'),{'uri':_0x23dc8e});})['catch'](function(_0x40ecd0){logger[_0x58f0('0x67')](_0x58f0('0x6c'),JSON[_0x58f0('0x21')](_0x40ecd0));});};exports[_0x58f0('0x71')]=function(_0x4dc730,_0xd9454e,_0x1d335d,_0x350aa1,_0x1cf7d2,_0xea3b47){var _0x259523,_0x11f897,_0x3f3d61,_0xe37b54;_0xea3b47[_0x58f0('0x50')]=intUtil[_0x58f0('0x51')](_0xea3b47[_0x58f0('0x50')]);_0xea3b47[_0x58f0('0x52')]=intUtil['stripTrailingSlash'](_0xea3b47[_0x58f0('0x52')]);def[_0x58f0('0x72')]=util[_0x58f0('0x23')](_0x58f0('0x69'),_0xea3b47[_0x58f0('0x50')]);if(_0x1cf7d2&&_0x1cf7d2[_0x58f0('0x73')]){logger[_0x58f0('0xd')]('['+_0xd9454e[_0x58f0('0x74')][_0x58f0('0x75')]()+']','Recording\x20is\x20enabled!');_0xd9454e[_0x58f0('0x57')]=util[_0x58f0('0x23')](_0x58f0('0x55'),_0xea3b47[_0x58f0('0x52')],_0xd9454e['uniqueid'],md5(_0xd9454e[_0x58f0('0x56')]));}else{_0xd9454e[_0x58f0('0x57')]='';}return getConnection(_0xea3b47)[_0x58f0('0x2b')](function(_0x527ce7){_0xe37b54=_0x527ce7;if(!_[_0x58f0('0x76')](_0x350aa1)){return getUser(_0xea3b47,_0x350aa1[_0x58f0('0xe')],_0xe37b54);}else{return getUser(_0xea3b47,null,_0xe37b54);}})[_0x58f0('0x2b')](function(_0x832d62){_0x259523=_0x832d62;logger[_0x58f0('0xd')](_0x58f0('0x58'),_0x259523['id']);return getEndUser(_0xea3b47,_0xd9454e[_0x58f0('0x59')],_0xd9454e['calleridnum'],_0xe37b54);})[_0x58f0('0x2b')](function(_0x2daf4a){_0x11f897=_0x2daf4a;logger['info'](_0x58f0('0x5b'),_0x11f897['id']);return getTicket(_0xea3b47,_0x259523,_0x11f897,_0x1d335d,_0xd9454e,_0x1d335d[_0x58f0('0x5c')],_0xe37b54,_0x58f0('0x5d'));})[_0x58f0('0x2b')](function(_0x26b49c){_0x3f3d61=_0x26b49c;logger[_0x58f0('0xd')](_0x58f0('0x5e'));logger[_0x58f0('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3f3d61['id']);return setRelationship(_0xe37b54,_0x259523,_0x3f3d61,_0x58f0('0x60'));})[_0x58f0('0x2b')](function(){return setRelationship(_0xe37b54,_0x11f897,_0x3f3d61,_0x58f0('0x61'));})[_0x58f0('0x2b')](function(){return getServerInfo(_0xe37b54);})['catch'](function(_0x50a9e5){logger[_0x58f0('0x67')]('['+_0xd9454e[_0x58f0('0x74')]['toUpperCase']()+']',JSON[_0x58f0('0x21')](_0x50a9e5));});}; \ No newline at end of file +var _0x1724=['[OUTBOUND]','catch','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','sugarcrm','redis','socket.io-emitter','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_type','Contacts','direction','length','forEach','variableName','idField','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','info','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','variable','customVariable','Variable','POST','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','version','%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'];(function(_0x2e34aa,_0x376684){var _0x295c9d=function(_0x1e454b){while(--_0x1e454b){_0x2e34aa['push'](_0x2e34aa['shift']());}};_0x295c9d(++_0x376684);}(_0x1724,0xff));var _0x4172=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x1724[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x4172('0x0'));var rp=require(_0x4172('0x1'));var BPromise=require(_0x4172('0x2'));var md5=require(_0x4172('0x3'));var util=require(_0x4172('0x4'));var Redis=require('ioredis');var intUtil=require(_0x4172('0x5'));var config=require('../../../../config/environment');var logger=require(_0x4172('0x6'))(_0x4172('0x7'));config[_0x4172('0x8')]=_['defaults'](config[_0x4172('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x4172('0x9'))(new Redis(config[_0x4172('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x5b40d7,_0x176527,_0x2332b0){io['to'](_0x5b40d7)['emit'](_0x176527,_0x2332b0);}function getTicket(_0x2bda4a,_0x188eef,_0x5e085b,_0x1623bc,_0x24b1b2,_0x52f264,_0x360e89,_0x239bcb){logger['info'](_0x4172('0xa'));var _0x1c4320=new Date();var _0x511417=[{'name':_0x4172('0xb'),'value':intUtil[_0x4172('0xc')](_0x1623bc[_0x4172('0xd')],_0x24b1b2,'\x20')},{'name':_0x4172('0xe'),'value':_0x188eef['id']},{'name':_0x4172('0xf'),'value':_0x188eef['id']},{'name':_0x4172('0x10'),'value':intUtil[_0x4172('0xc')](_0x1623bc[_0x4172('0x11')],_0x24b1b2,'\x0a')},{'name':_0x4172('0x12'),'value':_0x1c4320[_0x4172('0x13')]()['slice'](0x0,0x13)[_0x4172('0x14')]('T','\x20')},{'name':_0x4172('0x15'),'value':'0'},{'name':_0x4172('0x16'),'value':'15'},{'name':'parent_id','value':_0x5e085b['id']},{'name':_0x4172('0x17'),'value':_0x4172('0x18')},{'name':'parent_name','value':_0x5e085b[_0x4172('0xb')]},{'name':_0x4172('0x19'),'value':_0x239bcb}];if(_0x52f264[_0x4172('0x1a')]){_[_0x4172('0x1b')](_0x52f264,function(_0x1c31c6){if(_0x24b1b2[_0x1c31c6[_0x4172('0x1c')]]){_0x511417['push']({'name':_0x1c31c6[_0x4172('0x1d')],'value':_0x24b1b2[_0x1c31c6['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x4172('0x1e'),'response_type':_0x4172('0x1e'),'rest_data':JSON[_0x4172('0x1f')]({'session':_0x360e89['id'],'module_name':_0x4172('0x20'),'name_value_list':_0x511417})}});}function getAuth(_0x1ad114){return util[_0x4172('0x21')]('Basic\x20%s',new Buffer(_0x1ad114[_0x4172('0x22')]+':X')[_0x4172('0x23')](_0x4172('0x24')));}function getServerInfo(_0x31ea96){return request({'form':{'method':_0x4172('0x25'),'input_type':_0x4172('0x1e'),'response_type':_0x4172('0x1e'),'rest_data':JSON[_0x4172('0x1f')]({'session':_0x31ea96['id']})}});}function getUser(_0x48f397,_0x386c9d,_0x4bc3fc){if(!_[_0x4172('0x26')](_0x386c9d)){logger['info']('Getting\x20agent\x20with\x20name',_0x386c9d);return request({'form':{'method':_0x4172('0x27'),'input_type':_0x4172('0x1e'),'response_type':_0x4172('0x1e'),'rest_data':JSON['stringify']({'session':_0x4bc3fc['id'],'module_name':_0x4172('0x28'),'query':util['format'](_0x4172('0x29'),_0x386c9d),'order_by':'','offset':'0','select_fields':['id','name',_0x4172('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4172('0x2b')](function(_0xde23ce){if(_0xde23ce[_0x4172('0x2c')]['length']){var _0xc0523c=_[_0x4172('0x2d')](_0xde23ce['entry_list'],function(_0x5a0582){return _0x5a0582['name_value_list'][_0x4172('0x2a')][_0x4172('0x2e')]===_0x386c9d;});if(_0xc0523c){logger[_0x4172('0x2f')](_0x4172('0x30'));return BPromise['resolve']({'id':_0xc0523c[_0x4172('0x31')]['id'][_0x4172('0x2e')],'name':_0xc0523c[_0x4172('0x31')][_0x4172('0xb')][_0x4172('0x2e')]});}}logger['info'](_0x4172('0x32'));return BPromise['resolve']({'id':_0x4bc3fc[_0x4172('0x31')]['user_id'][_0x4172('0x2e')],'name':_0x4bc3fc[_0x4172('0x31')]['user_name'][_0x4172('0x2e')]});});}else{logger['info'](_0x4172('0x33'));return BPromise[_0x4172('0x34')]({'id':_0x4bc3fc[_0x4172('0x31')][_0x4172('0x35')][_0x4172('0x2e')],'name':_0x4bc3fc[_0x4172('0x31')][_0x4172('0x2a')][_0x4172('0x2e')]});}}function getEndUser(_0x462dcb,_0x23bf7d,_0x12f55f,_0x57273c){logger['info'](_0x4172('0x36'),_0x12f55f);return request({'form':{'method':'get_entry_list','input_type':_0x4172('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x57273c['id'],'module_name':_0x4172('0x18'),'query':util[_0x4172('0x21')](_0x4172('0x37'),_0x12f55f),'order_by':'','offset':'0','select_fields':['id','name',_0x4172('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4ee8c4){if(_0x4ee8c4[_0x4172('0x2c')][_0x4172('0x1a')]){var _0x3a68e0=_['find'](_0x4ee8c4[_0x4172('0x2c')],function(_0x274f02){return _0x274f02[_0x4172('0x31')][_0x4172('0x38')][_0x4172('0x2e')]===_0x12f55f;});if(_0x3a68e0){logger[_0x4172('0x2f')](_0x4172('0x39'));return BPromise[_0x4172('0x34')]({'id':_0x3a68e0[_0x4172('0x31')]['id'][_0x4172('0x2e')],'name':_0x3a68e0['name_value_list']['name'][_0x4172('0x2e')],'phone':_0x3a68e0['name_value_list'][_0x4172('0x38')][_0x4172('0x2e')]});}}else{logger[_0x4172('0x2f')](_0x4172('0x3a'));return request({'form':{'method':_0x4172('0x3b'),'input_type':'JSON','response_type':_0x4172('0x1e'),'rest_data':JSON[_0x4172('0x1f')]({'session':_0x57273c['id'],'module_name':'Contacts','name_value_list':[{'name':_0x4172('0x3c'),'value':_0x23bf7d!==''?_0x23bf7d:util['format'](_0x4172('0x3d'),_0x12f55f)},{'name':_0x4172('0x38'),'value':_0x12f55f}]})}})[_0x4172('0x2b')](function(_0x486600){logger[_0x4172('0x2f')](_0x4172('0x3e'));return BPromise['resolve']({'id':_0x486600['id'],'name':_0x486600[_0x4172('0x2c')][_0x4172('0x3c')][_0x4172('0x2e')],'phone':_0x486600['entry_list']['phone_home'][_0x4172('0x2e')]});});}});}function request(_0xad4d20){logger[_0x4172('0x3f')](_0x4172('0x40'),JSON[_0x4172('0x1f')](_0xad4d20));return rp(_[_0x4172('0x41')](def,_0xad4d20));}function getTags(_0x257f03,_0xc3bf75){var _0x5c999b=[];if(_0x257f03&&_0x257f03[_0x4172('0x1a')]>0x0){_0x5c999b=_[_0x4172('0x42')](_0x257f03,_0xc3bf75);}return _0x5c999b;}function getCustomFields(_0x1851ec,_0x47bf4f){var _0x2543d7=[];var _0x1fd222={'custom_fields':[]};if(_0x1851ec['length']>0x0){_[_0x4172('0x1b')](_0x1851ec,function(_0x2d2dbf){if(_0x2d2dbf[_0x4172('0x43')]===_0x4172('0x44')&&_0x2d2dbf[_0x4172('0x45')]&&!_0x2d2dbf[_0x4172('0x46')]){_0x1fd222[_0x2d2dbf[_0x4172('0x45')][_0x4172('0x47')]()]=_0x2d2dbf[_0x4172('0x48')][_0x4172('0x23')]();}else if(_0x2d2dbf[_0x4172('0x43')]===_0x4172('0x44')&&_0x2d2dbf['idField']&&_0x2d2dbf[_0x4172('0x46')]){_0x1fd222[_0x4172('0x49')][_0x4172('0x4a')]({'id':_0x2d2dbf[_0x4172('0x1d')],'value':_0x2d2dbf['content'][_0x4172('0x23')]()});}else if(_0x2d2dbf[_0x4172('0x43')]===_0x4172('0x4b')&&_0x2d2dbf[_0x4172('0x1c')]&&_0x2d2dbf['idField']&&_0x2d2dbf[_0x4172('0x46')]){_0x47bf4f[_0x2d2dbf[_0x4172('0x1c')]]&&_0x1fd222[_0x4172('0x49')][_0x4172('0x4a')]({'id':_0x2d2dbf[_0x4172('0x1d')],'value':_0x47bf4f[_0x2d2dbf['variableName']][_0x4172('0x23')]()});}else if(_0x2d2dbf[_0x4172('0x43')]===_0x4172('0x4c')&&_0x2d2dbf['Variable']&&_0x2d2dbf[_0x4172('0x4d')]['name']&&_0x2d2dbf[_0x4172('0x1d')]&&_0x2d2dbf[_0x4172('0x46')]){_0x47bf4f[_0x2d2dbf[_0x4172('0x4d')][_0x4172('0xb')]['toLowerCase']()]&&_0x1fd222[_0x4172('0x49')]['push']({'id':_0x2d2dbf[_0x4172('0x1d')],'value':_0x47bf4f[_0x2d2dbf[_0x4172('0x4d')]['name']['toLowerCase']()]['toString']()});}});}return _0x1fd222;}function getConnection(_0x4a040f){return request({'method':_0x4172('0x4e'),'form':{'method':_0x4172('0x4f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4172('0x1f')]({'user_auth':{'user_name':_0x4a040f[_0x4172('0x50')],'password':_0x4a040f['password'],'encryption':_0x4172('0x51')},'application':_0x4172('0x52')})}})[_0x4172('0x2b')](function(_0x1756a2){var _0x4a1de4=_0x1756a2;if(_0x4a1de4['id']){def[_0x4172('0x53')]=_0x4a1de4['id'];return BPromise['resolve'](_0x4a1de4);}else{throw new Error(util[_0x4172('0x21')](_0x4172('0x54'),_0x4a040f['id']));}});}function setRelationship(_0x3ed34a,_0x466155,_0x5c2412,_0x3e3ce9){return request({'form':{'method':_0x4172('0x55'),'input_type':_0x4172('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3ed34a['id'],'module_name':_0x4172('0x20'),'module_id':_0x5c2412['id'],'link_field_name':_0x3e3ce9,'related_ids':[_0x466155['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4172('0x56')]=function(_0x4f637c,_0x1b00c5,_0x511df3,_0x268176,_0x2fad01,_0x1f6a37){var _0x55c852,_0x2031ff,_0x3af08c,_0x5d652c;_0x1f6a37[_0x4172('0x57')]=intUtil[_0x4172('0x58')](_0x1f6a37['remoteUri']);_0x1f6a37['serverUrl']=intUtil['stripTrailingSlash'](_0x1f6a37[_0x4172('0x59')]);def[_0x4172('0x5a')]=util['format'](_0x4172('0x5b'),_0x1f6a37[_0x4172('0x57')]);if(_0x2fad01&&_0x2fad01[_0x4172('0x5c')]){logger[_0x4172('0x2f')](_0x4172('0x5d'),_0x4172('0x5e'));_0x1b00c5[_0x4172('0x5f')]=util[_0x4172('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f6a37[_0x4172('0x59')],_0x1b00c5['uniqueid'],md5(_0x1b00c5[_0x4172('0x60')]));}else{_0x1b00c5[_0x4172('0x5f')]='';}return getConnection(_0x1f6a37)[_0x4172('0x2b')](function(_0x2ad503){_0x5d652c=_0x2ad503;return getUser(_0x1f6a37,_0x268176[_0x4172('0xb')],_0x5d652c);})[_0x4172('0x2b')](function(_0x4cf9c7){_0x55c852=_0x4cf9c7;logger[_0x4172('0x2f')](_0x4172('0x61'),_0x55c852['id']);return getEndUser(_0x1f6a37,_0x1b00c5[_0x4172('0x62')],_0x1b00c5[_0x4172('0x63')],_0x5d652c);})['then'](function(_0x4b80d4){_0x2031ff=_0x4b80d4;logger['info'](_0x4172('0x64'),_0x2031ff['id']);return getTicket(_0x1f6a37,_0x55c852,_0x2031ff,_0x511df3,_0x1b00c5,_0x511df3[_0x4172('0x65')],_0x5d652c,_0x4172('0x66'));})[_0x4172('0x2b')](function(_0x5bd1e2){_0x3af08c=_0x5bd1e2;logger[_0x4172('0x2f')](_0x4172('0x67'));logger[_0x4172('0x2f')](_0x4172('0x68'),_0x3af08c['id']);return setRelationship(_0x5d652c,_0x55c852,_0x3af08c,_0x4172('0x69'));})['then'](function(){return setRelationship(_0x5d652c,_0x2031ff,_0x3af08c,_0x4172('0x6a'));})['then'](function(){return getServerInfo(_0x5d652c);})[_0x4172('0x2b')](function(_0xfeca7e){var _0x5637cd=parseInt(_0xfeca7e['version'][_0x4172('0x6b')](0x0));var _0x732818=util[_0x4172('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1f6a37['remoteUri'],_0x3af08c['id']);if(_0x5637cd>0x6){_0x732818=util[_0x4172('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1f6a37[_0x4172('0x57')],_0x3af08c['id']);}logger[_0x4172('0x2f')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x4172('0x6c'),_0x268176[_0x4172('0xb')]),_0x4172('0x6d'),{'uri':_0x732818});})['catch'](function(_0x18205a){logger[_0x4172('0x6e')](_0x4172('0x5d'),JSON['stringify'](_0x18205a));});};exports[_0x4172('0x6f')]=function(_0x55d459,_0x1400f0,_0x37dead,_0x58379b,_0x20c490,_0x4405fb,_0x17295e){var _0x13a40d,_0x138485,_0x69f72b,_0x3a4ae8;_0x4405fb['remoteUri']=intUtil['stripTrailingSlash'](_0x4405fb[_0x4172('0x57')]);_0x4405fb[_0x4172('0x59')]=intUtil[_0x4172('0x58')](_0x4405fb[_0x4172('0x59')]);def[_0x4172('0x5a')]=util['format'](_0x4172('0x5b'),_0x4405fb[_0x4172('0x57')]);if(_0x17295e&&_0x17295e['recordingFormat']&&_0x17295e[_0x4172('0x70')]!==_0x4172('0x71')){logger[_0x4172('0x2f')]('[OUTBOUND]',_0x4172('0x5e'));_0x1400f0[_0x4172('0x5f')]=util[_0x4172('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4405fb['serverUrl'],_0x1400f0[_0x4172('0x60')],md5(_0x1400f0[_0x4172('0x60')]));}return getConnection(_0x4405fb)[_0x4172('0x2b')](function(_0x2f86e1){_0x3a4ae8=_0x2f86e1;return getUser(_0x4405fb,_0x58379b['name'],_0x3a4ae8);})[_0x4172('0x2b')](function(_0x48622){_0x13a40d=_0x48622;logger[_0x4172('0x2f')](_0x4172('0x61'),_0x13a40d['id']);return getEndUser(_0x4405fb,_0x1400f0[_0x4172('0x72')],_0x1400f0[_0x4172('0x73')],_0x3a4ae8);})[_0x4172('0x2b')](function(_0x19d67f){_0x138485=_0x19d67f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x138485['id']);return getTicket(_0x4405fb,_0x13a40d,_0x138485,_0x37dead,_0x1400f0,_0x37dead['Fields'],_0x3a4ae8,_0x4172('0x74'));})[_0x4172('0x2b')](function(_0x496f13){_0x69f72b=_0x496f13;logger[_0x4172('0x2f')](_0x4172('0x67'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x69f72b['id']);return setRelationship(_0x3a4ae8,_0x13a40d,_0x69f72b,'users');})[_0x4172('0x2b')](function(){return setRelationship(_0x3a4ae8,_0x138485,_0x69f72b,_0x4172('0x6a'));})['then'](function(){return getServerInfo(_0x3a4ae8);})[_0x4172('0x2b')](function(_0x476ea){var _0x43847c=parseInt(_0x476ea[_0x4172('0x75')][_0x4172('0x6b')](0x0));var _0x58d1da=util[_0x4172('0x21')](_0x4172('0x76'),_0x4405fb[_0x4172('0x57')],_0x69f72b['id']);if(_0x43847c>0x6){_0x58d1da=util['format'](_0x4172('0x77'),_0x4405fb['remoteUri'],_0x69f72b['id']);}logger[_0x4172('0x2f')](_0x4172('0x78'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x4172('0x6c'),_0x58379b['name']),_0x4172('0x6d'),{'uri':_0x58d1da});})[_0x4172('0x79')](function(_0x775848){logger[_0x4172('0x6e')](_0x4172('0x78'),JSON['stringify'](_0x775848));});};exports['unmanaged']=function(_0x4cd58c,_0x3d6d91,_0x44933a,_0x5119cc,_0x3a6538,_0x3b38c1){var _0x225f47,_0xd81214,_0x2ac738,_0x366747;_0x3b38c1[_0x4172('0x57')]=intUtil['stripTrailingSlash'](_0x3b38c1['remoteUri']);_0x3b38c1[_0x4172('0x59')]=intUtil['stripTrailingSlash'](_0x3b38c1[_0x4172('0x59')]);def['uri']=util[_0x4172('0x21')](_0x4172('0x5b'),_0x3b38c1[_0x4172('0x57')]);if(_0x3a6538&&_0x3a6538[_0x4172('0x5c')]){logger[_0x4172('0x2f')]('['+_0x3d6d91['lastevent'][_0x4172('0x7a')]()+']','Recording\x20is\x20enabled!');_0x3d6d91['recordingURL']=util[_0x4172('0x21')](_0x4172('0x7b'),_0x3b38c1[_0x4172('0x59')],_0x3d6d91[_0x4172('0x60')],md5(_0x3d6d91['uniqueid']));}else{_0x3d6d91[_0x4172('0x5f')]='';}return getConnection(_0x3b38c1)[_0x4172('0x2b')](function(_0x164c71){_0x366747=_0x164c71;if(!_[_0x4172('0x26')](_0x5119cc)){return getUser(_0x3b38c1,_0x5119cc[_0x4172('0xb')],_0x366747);}else{return getUser(_0x3b38c1,null,_0x366747);}})[_0x4172('0x2b')](function(_0x69f69b){_0x225f47=_0x69f69b;logger[_0x4172('0x2f')]('The\x20User\x20ID\x20is:',_0x225f47['id']);return getEndUser(_0x3b38c1,_0x3d6d91[_0x4172('0x62')],_0x3d6d91[_0x4172('0x63')],_0x366747);})[_0x4172('0x2b')](function(_0x11d448){_0xd81214=_0x11d448;logger[_0x4172('0x2f')](_0x4172('0x64'),_0xd81214['id']);return getTicket(_0x3b38c1,_0x225f47,_0xd81214,_0x44933a,_0x3d6d91,_0x44933a[_0x4172('0x65')],_0x366747,_0x4172('0x66'));})['then'](function(_0xe87c4c){_0x2ac738=_0xe87c4c;logger[_0x4172('0x2f')](_0x4172('0x67'));logger['info'](_0x4172('0x68'),_0x2ac738['id']);return setRelationship(_0x366747,_0x225f47,_0x2ac738,_0x4172('0x69'));})[_0x4172('0x2b')](function(){return setRelationship(_0x366747,_0xd81214,_0x2ac738,'contacts');})[_0x4172('0x2b')](function(){return getServerInfo(_0x366747);})[_0x4172('0x79')](function(_0x4895ca){logger[_0x4172('0x6e')]('['+_0x3d6d91[_0x4172('0x7c')][_0x4172('0x7a')]()+']',JSON[_0x4172('0x1f')](_0x4895ca));});}; \ 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 9be8ba5..36abb73 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 _0x7ef8=['Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','format','customVariable','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','getString','sortBy','length','type','string','variable','variableName','push','toString'];(function(_0x493985,_0xabbee5){var _0x532b94=function(_0x150fbc){while(--_0x150fbc){_0x493985['push'](_0x493985['shift']());}};_0x532b94(++_0xabbee5);}(_0x7ef8,0x10d));var _0x87ef=function(_0x19f670,_0x36d23f){_0x19f670=_0x19f670-0x0;var _0x3ffd49=_0x7ef8[_0x19f670];return _0x3ffd49;};'use strict';var _=require(_0x87ef('0x0'));var util=require(_0x87ef('0x1'));exports[_0x87ef('0x2')]=function(_0x1175b2,_0x11e364,_0x389916){var _0x11e9c1=[];if(_0x1175b2['length']>0x0){var _0x58cd4a=_[_0x87ef('0x3')](_0x1175b2,['id']);for(var _0x2d9493=0x0;_0x2d9493<_0x58cd4a[_0x87ef('0x4')];_0x2d9493++){var _0x3ac0a3=_0x58cd4a[_0x2d9493];if(_0x3ac0a3[_0x87ef('0x5')]===_0x87ef('0x6')){_0x11e9c1['push'](_0x3ac0a3['content']);}else if(_0x3ac0a3[_0x87ef('0x5')]===_0x87ef('0x7')&&_0x3ac0a3[_0x87ef('0x8')]){_0x11e364[_0x3ac0a3[_0x87ef('0x8')]]&&_0x11e9c1[_0x87ef('0x9')](_0x11e364[_0x3ac0a3['variableName']][_0x87ef('0xa')]());}else if(_0x3ac0a3['type']==='customVariable'&&_0x3ac0a3[_0x87ef('0xb')]&&_0x3ac0a3[_0x87ef('0xb')][_0x87ef('0xc')]){_0x11e364[_0x3ac0a3[_0x87ef('0xb')][_0x87ef('0xc')][_0x87ef('0xd')]()]&&_0x11e9c1[_0x87ef('0x9')](_0x11e364[_0x3ac0a3['Variable'][_0x87ef('0xc')][_0x87ef('0xd')]()]['toString']());}else if(_0x3ac0a3[_0x87ef('0x5')]===_0x87ef('0xe')){if(_0x3ac0a3[_0x87ef('0xf')]===_0x87ef('0x6')&&_0x3ac0a3[_0x87ef('0x10')]){_0x11e9c1[_0x87ef('0x9')](util['format'](_0x87ef('0x11'),_0x3ac0a3[_0x87ef('0x10')],_0x3ac0a3[_0x87ef('0x12')]));}else if(_0x3ac0a3[_0x87ef('0xf')]===_0x87ef('0x7')&&_0x3ac0a3[_0x87ef('0x8')]&&_0x3ac0a3[_0x87ef('0x10')]){_0x11e364[_0x3ac0a3[_0x87ef('0x8')]]&&_0x11e9c1[_0x87ef('0x9')](util[_0x87ef('0x13')](_0x87ef('0x11'),_0x3ac0a3[_0x87ef('0x10')],_0x11e364[_0x3ac0a3[_0x87ef('0x8')]]));}else if(_0x3ac0a3[_0x87ef('0xf')]===_0x87ef('0x14')&&_0x3ac0a3[_0x87ef('0xb')]&&_0x3ac0a3[_0x87ef('0xb')]['name']&&_0x3ac0a3[_0x87ef('0x10')]){_0x11e364[_0x3ac0a3[_0x87ef('0xb')]['name'][_0x87ef('0xd')]()]&&_0x11e9c1[_0x87ef('0x9')](util['format'](_0x87ef('0x11'),_0x3ac0a3[_0x87ef('0x10')],_0x11e364[_0x3ac0a3['Variable'][_0x87ef('0xc')][_0x87ef('0xd')]()]));}}}}return _0x11e9c1[_0x87ef('0x15')](_0x389916);};exports[_0x87ef('0x16')]=function(_0x232247){var _0x10360b=_0x232247[_0x87ef('0x17')](-0x1);if(_0x10360b==='/'){_0x232247=_0x232247[_0x87ef('0x18')](0x0,_0x232247['lastIndexOf'](_0x10360b));}return _0x232247;};exports[_0x87ef('0x19')]=function(_0xb6cf53){if(!_[_0x87ef('0x1a')](_0xb6cf53)&&_0xb6cf53!==''){var _0x3a2381=/^(([^<>()\[\]\\.,;:\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 _0x3a2381[_0x87ef('0x1b')](String(_0xb6cf53)[_0x87ef('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x5f09=['isNil','test','lodash','getString','length','sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail'];(function(_0x2d9fdc,_0x5d18cd){var _0x39d84b=function(_0x1e0951){while(--_0x1e0951){_0x2d9fdc['push'](_0x2d9fdc['shift']());}};_0x39d84b(++_0x5d18cd);}(_0x5f09,0xf5));var _0x95f0=function(_0x3fc9f3,_0x3457c3){_0x3fc9f3=_0x3fc9f3-0x0;var _0x13eb31=_0x5f09[_0x3fc9f3];return _0x13eb31;};'use strict';var _=require(_0x95f0('0x0'));var util=require('util');exports[_0x95f0('0x1')]=function(_0x4adbb4,_0x396631,_0x59e61c){var _0x2718e3=[];if(_0x4adbb4[_0x95f0('0x2')]>0x0){var _0x40e743=_[_0x95f0('0x3')](_0x4adbb4,['id']);for(var _0x1fe803=0x0;_0x1fe803<_0x40e743[_0x95f0('0x2')];_0x1fe803++){var _0x5def1f=_0x40e743[_0x1fe803];if(_0x5def1f[_0x95f0('0x4')]===_0x95f0('0x5')){_0x2718e3[_0x95f0('0x6')](_0x5def1f[_0x95f0('0x7')]);}else if(_0x5def1f[_0x95f0('0x4')]===_0x95f0('0x8')&&_0x5def1f[_0x95f0('0x9')]){_0x396631[_0x5def1f['variableName']]&&_0x2718e3[_0x95f0('0x6')](_0x396631[_0x5def1f['variableName']]['toString']());}else if(_0x5def1f[_0x95f0('0x4')]===_0x95f0('0xa')&&_0x5def1f['Variable']&&_0x5def1f['Variable']['name']){_0x396631[_0x5def1f[_0x95f0('0xb')][_0x95f0('0xc')]['toLowerCase']()]&&_0x2718e3['push'](_0x396631[_0x5def1f[_0x95f0('0xb')][_0x95f0('0xc')][_0x95f0('0xd')]()]['toString']());}else if(_0x5def1f[_0x95f0('0x4')]===_0x95f0('0xe')){if(_0x5def1f[_0x95f0('0xf')]==='string'&&_0x5def1f[_0x95f0('0x10')]){_0x2718e3[_0x95f0('0x6')](util[_0x95f0('0x11')](_0x95f0('0x12'),_0x5def1f[_0x95f0('0x10')],_0x5def1f[_0x95f0('0x13')]));}else if(_0x5def1f[_0x95f0('0xf')]===_0x95f0('0x8')&&_0x5def1f[_0x95f0('0x9')]&&_0x5def1f[_0x95f0('0x10')]){_0x396631[_0x5def1f[_0x95f0('0x9')]]&&_0x2718e3[_0x95f0('0x6')](util[_0x95f0('0x11')](_0x95f0('0x12'),_0x5def1f[_0x95f0('0x10')],_0x396631[_0x5def1f['variableName']]));}else if(_0x5def1f[_0x95f0('0xf')]===_0x95f0('0xa')&&_0x5def1f[_0x95f0('0xb')]&&_0x5def1f['Variable'][_0x95f0('0xc')]&&_0x5def1f['key']){_0x396631[_0x5def1f[_0x95f0('0xb')][_0x95f0('0xc')][_0x95f0('0xd')]()]&&_0x2718e3[_0x95f0('0x6')](util[_0x95f0('0x11')](_0x95f0('0x12'),_0x5def1f['key'],_0x396631[_0x5def1f[_0x95f0('0xb')]['name']['toLowerCase']()]));}}}}return _0x2718e3['join'](_0x59e61c);};exports[_0x95f0('0x14')]=function(_0x5b4d40){var _0x4f48b2=_0x5b4d40[_0x95f0('0x15')](-0x1);if(_0x4f48b2==='/'){_0x5b4d40=_0x5b4d40[_0x95f0('0x16')](0x0,_0x5b4d40[_0x95f0('0x17')](_0x4f48b2));}return _0x5b4d40;};exports[_0x95f0('0x18')]=function(_0x6040cf){if(!_[_0x95f0('0x19')](_0x6040cf)&&_0x6040cf!==''){var _0x1b8a75=/^(([^<>()\[\]\\.,;:\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 _0x1b8a75[_0x95f0('0x1a')](String(_0x6040cf)['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 4053f55..f551199 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x4498e6,_0x1cd692){var _0x5b9f98=function(_0x319e6){while(--_0x319e6){_0x4498e6['push'](_0x4498e6['shift']());}};_0x5b9f98(++_0x1cd692);}(_0x34e8,0x12c));var _0x834e=function(_0x39b558,_0x5ed0d0){_0x39b558=_0x39b558-0x0;var _0x258776=_0x34e8[_0x39b558];return _0x258776;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 5082573..9a1d37f 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 _0x1b58=['picklist','type','nameField','customField','toLowerCase','idField','push','content','variableName','custom_fields','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','%s/agent/tickets/%s','replace','toUpperCase','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','filter','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','GET','map','forEach','includes','string'];(function(_0x3216ed,_0x1b78ae){var _0x1f7305=function(_0x5b4522){while(--_0x5b4522){_0x3216ed['push'](_0x3216ed['shift']());}};_0x1f7305(++_0x1b78ae);}(_0x1b58,0x9f));var _0x81b5=function(_0x5750fa,_0x57c0df){_0x5750fa=_0x5750fa-0x0;var _0x2aeb4e=_0x1b58[_0x5750fa];return _0x2aeb4e;};'use strict';var _=require('lodash');var rp=require(_0x81b5('0x0'));var md5=require(_0x81b5('0x1'));var util=require('util');var Redis=require(_0x81b5('0x2'));var intUtil=require('./util');var config=require(_0x81b5('0x3'));var logger=require('../../../../config/logger')('zendesk');config[_0x81b5('0x4')]=_[_0x81b5('0x5')](config[_0x81b5('0x4')],{'host':_0x81b5('0x6'),'port':0x18eb});var io=require(_0x81b5('0x7'))(new Redis(config[_0x81b5('0x4')]));function emit(_0x4edfc5,_0xfc6eb4,_0x4ce18a){io['to'](_0x4edfc5)['emit'](_0xfc6eb4,_0x4ce18a);}var headers={'Content-Type':'application/json','Accept':_0x81b5('0x8')};function getTicket(_0x5c8c9a,_0x10df74,_0x40bc65,_0x5769dd,_0x377d7c){logger[_0x81b5('0x9')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x81b5('0xa')](_0x81b5('0xb'),_0x5c8c9a[_0x81b5('0xc')]),'method':_0x81b5('0xd'),'body':{'ticket':_[_0x81b5('0xe')]({'requester_id':_0x40bc65['id'],'submitter_id':_0x10df74?_0x10df74['id']:undefined,'assignee_id':_0x10df74?_0x10df74['id']:undefined,'tags':getTags(_0x5769dd[_0x81b5('0xf')],'name'),'subject':intUtil[_0x81b5('0x10')](_0x5769dd[_0x81b5('0x11')],_0x377d7c,'\x20'),'description':intUtil[_0x81b5('0x10')](_0x5769dd[_0x81b5('0x12')],_0x377d7c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x81b5('0x10')](_0x5769dd[_0x81b5('0x12')],_0x377d7c,'\x0a')}},getCustomFields(_0x5769dd[_0x81b5('0x13')],_0x377d7c))}})[_0x81b5('0x14')](function(_0x5a6277){logger[_0x81b5('0x9')](_0x81b5('0x15'));return _0x5a6277[_0x81b5('0x16')];});}function getUser(_0x1385c7,_0x3de0c9){if(intUtil[_0x81b5('0x17')](_0x3de0c9)){logger[_0x81b5('0x9')](_0x81b5('0x18'),_0x3de0c9);return request({'uri':util[_0x81b5('0xa')](_0x81b5('0x19'),_0x1385c7[_0x81b5('0xc')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x3de0c9)}})[_0x81b5('0x14')](function(_0x5982df){if(_0x5982df[_0x81b5('0x1a')]){logger['info'](_0x81b5('0x1b'));return _[_0x81b5('0x1c')](_0x5982df['results'],{'email':_0x3de0c9,'role':_0x81b5('0x1d')});}else{logger[_0x81b5('0x9')](_0x81b5('0x1e'));return request({'uri':util[_0x81b5('0xa')](_0x81b5('0x1f'),_0x1385c7[_0x81b5('0xc')])})[_0x81b5('0x14')](function(_0x3e1867){logger[_0x81b5('0x9')](_0x81b5('0x20'));return _0x3e1867[_0x81b5('0x21')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x81b5('0xa')](_0x81b5('0x1f'),_0x1385c7[_0x81b5('0xc')])})[_0x81b5('0x14')](function(_0x2c4c7e){logger[_0x81b5('0x9')](_0x81b5('0x20'));return _0x2c4c7e[_0x81b5('0x21')];});}}function getEndUser(_0x5e2542,_0x37b63a,_0x504fa8){logger['info'](_0x81b5('0x22'),_0x504fa8);return request({'uri':util[_0x81b5('0xa')]('%s/search.json',_0x5e2542[_0x81b5('0xc')]),'qs':{'query':util[_0x81b5('0xa')]('type:user\x20role:end-user\x20phone:%s',_0x504fa8)}})[_0x81b5('0x14')](function(_0x556516){var _0x3cf47;if(_0x556516[_0x81b5('0x23')]['length']){_0x556516[_0x81b5('0x23')]=_[_0x81b5('0x24')](_0x556516['results'],{'suspended':![],'role':_0x81b5('0x25')});if(_0x556516[_0x81b5('0x23')][_0x81b5('0x26')]){_0x3cf47=_[_0x81b5('0x27')](_0x556516[_0x81b5('0x23')]);}}if(_0x3cf47){logger[_0x81b5('0x9')]('Enduser\x20found!');return _0x3cf47;}else{logger[_0x81b5('0x9')](_0x81b5('0x28'));return request({'uri':util['format'](_0x81b5('0x29'),_0x5e2542[_0x81b5('0xc')]),'method':'POST','body':{'user':{'role':_0x81b5('0x25'),'name':util['format'](_0x81b5('0x2a'),_0x37b63a||_0x504fa8),'phone':_0x504fa8}}})[_0x81b5('0x14')](function(_0x2ab31d){logger[_0x81b5('0x9')](_0x81b5('0x2b'));return _0x2ab31d['user'];});}});}function getAuth(_0x1813f6){var _0x36bf90;if(_0x1813f6['authType']==='password'){_0x36bf90=util['format'](_0x81b5('0x2c'),_0x1813f6[_0x81b5('0x2d')],_0x1813f6[_0x81b5('0x2e')]);}else if(_0x1813f6['authType']===_0x81b5('0x2f')){_0x36bf90=util[_0x81b5('0xa')](_0x81b5('0x30'),_0x1813f6[_0x81b5('0x2d')],_0x1813f6[_0x81b5('0x2f')]);}return util['format'](_0x81b5('0x31'),new Buffer(_0x36bf90)[_0x81b5('0x32')](_0x81b5('0x33')));}function request(_0xf651f8){logger[_0x81b5('0x34')]('[HTTP]',JSON[_0x81b5('0x35')](_0xf651f8));return rp(_[_0x81b5('0x5')](_0xf651f8,{'method':_0x81b5('0x36'),'headers':headers,'json':!![]}));}function getTags(_0xca8f87,_0x28777a){var _0x4d83e4=[];if(_0xca8f87&&_0xca8f87[_0x81b5('0x26')]>0x0){_0x4d83e4=_[_0x81b5('0x37')](_0xca8f87,_0x28777a);}return _0x4d83e4;}function getCustomFields(_0x216cc9,_0x2db378){var _0xa7cbc2=[];var _0x24bb89={'custom_fields':[]};if(_0x216cc9[_0x81b5('0x26')]>0x0){_[_0x81b5('0x38')](_0x216cc9,function(_0x41f17d){if(_[_0x81b5('0x39')]([_0x81b5('0x3a'),_0x81b5('0x3b')],_0x41f17d[_0x81b5('0x3c')])&&_0x41f17d[_0x81b5('0x3d')]&&!_0x41f17d[_0x81b5('0x3e')]){_0x24bb89[_0x41f17d[_0x81b5('0x3d')][_0x81b5('0x3f')]()]=_0x41f17d['content'][_0x81b5('0x32')]();}else if(_[_0x81b5('0x39')](['string',_0x81b5('0x3b')],_0x41f17d['type'])&&_0x41f17d[_0x81b5('0x40')]&&_0x41f17d[_0x81b5('0x3e')]){_0x24bb89['custom_fields'][_0x81b5('0x41')]({'id':_0x41f17d['idField'],'value':_0x41f17d[_0x81b5('0x42')][_0x81b5('0x32')]()});}else if(_0x41f17d[_0x81b5('0x3c')]==='variable'&&_0x41f17d['variableName']&&_0x41f17d[_0x81b5('0x40')]&&_0x41f17d['customField']){_0x2db378[_0x41f17d[_0x81b5('0x43')]]&&_0x24bb89[_0x81b5('0x44')][_0x81b5('0x41')]({'id':_0x41f17d[_0x81b5('0x40')],'value':_0x2db378[_0x41f17d[_0x81b5('0x43')]][_0x81b5('0x32')]()});}else if(_0x41f17d[_0x81b5('0x3c')]===_0x81b5('0x45')&&_0x41f17d[_0x81b5('0x46')]&&_0x41f17d[_0x81b5('0x46')]['name']&&_0x41f17d['idField']&&_0x41f17d[_0x81b5('0x3e')]){_0x2db378[_0x41f17d[_0x81b5('0x46')][_0x81b5('0x47')][_0x81b5('0x3f')]()]&&_0x24bb89[_0x81b5('0x44')][_0x81b5('0x41')]({'id':_0x41f17d[_0x81b5('0x40')],'value':_0x2db378[_0x41f17d[_0x81b5('0x46')][_0x81b5('0x47')][_0x81b5('0x3f')]()][_0x81b5('0x32')]()});}});}return _0x24bb89;}exports[_0x81b5('0x48')]=function(_0x27dbd2,_0x2795c9,_0x3f4c34,_0x237525,_0x2ed138,_0x491ec0){var _0x4f46c2,_0x139de2;_0x491ec0['remoteUri']=intUtil[_0x81b5('0x49')](_0x491ec0['remoteUri']);_0x491ec0[_0x81b5('0x4a')]=intUtil[_0x81b5('0x49')](_0x491ec0[_0x81b5('0x4a')]);if(_0x2ed138&&_0x2ed138[_0x81b5('0x4b')]){logger[_0x81b5('0x9')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2795c9[_0x81b5('0x4c')]=util[_0x81b5('0xa')](_0x81b5('0x4d'),_0x491ec0['serverUrl'],_0x2795c9[_0x81b5('0x4e')],md5(_0x2795c9[_0x81b5('0x4e')]));}else{_0x2795c9[_0x81b5('0x4c')]='';}headers[_0x81b5('0x4f')]=getAuth(_0x491ec0);return getUser(_0x491ec0,_0x237525[_0x81b5('0x50')])['then'](function(_0x2da034){_0x4f46c2=_0x2da034;logger[_0x81b5('0x9')](_0x81b5('0x51'),_0x4f46c2['id']);return getEndUser(_0x491ec0,_0x2795c9[_0x81b5('0x52')],_0x2795c9['calleridnum']);})['then'](function(_0x5b5331){_0x139de2=_0x5b5331;logger[_0x81b5('0x9')](_0x81b5('0x53'),_0x139de2['id']);return getTicket(_0x491ec0,_0x4f46c2,_0x139de2,_0x3f4c34,_0x2795c9);})[_0x81b5('0x14')](function(_0x321c1b){if(_0x321c1b){logger['info']('The\x20Ticket\x20ID\x20is:',_0x321c1b['id']);switch(_0x491ec0['type']){case _0x81b5('0x54'):logger[_0x81b5('0x9')](_0x81b5('0x55'),_0x81b5('0x56'));return request({'uri':util[_0x81b5('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x491ec0['remoteUri'],_0x4f46c2['id'],_0x321c1b['id']),'method':'POST'});case _0x81b5('0x57'):logger['info']('[QUEUE]',_0x81b5('0x58'));emit(util['format']('user:%s',_0x237525['name']),_0x81b5('0x59'),{'uri':util[_0x81b5('0xa')]('%s/agent/tickets/%s',_0x491ec0[_0x81b5('0xc')]['replace'](_0x81b5('0x5a'),''),_0x321c1b['id'])});break;default:logger[_0x81b5('0x5b')](_0x81b5('0x55'),_0x81b5('0x5c'));}}})[_0x81b5('0x5d')](function(_0x3d2c8f){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x81b5('0x5e')](_0x3d2c8f,{'showHidden':!![],'depth':null}));});};exports[_0x81b5('0x5f')]=function(_0x53f175,_0x451df7,_0x5725ab,_0x46ca91,_0x330000,_0x3b09d4,_0x5ef622){var _0xada1cb,_0x517325;_0x3b09d4[_0x81b5('0xc')]=intUtil[_0x81b5('0x49')](_0x3b09d4[_0x81b5('0xc')]);_0x3b09d4[_0x81b5('0x4a')]=intUtil[_0x81b5('0x49')](_0x3b09d4['serverUrl']);if(_0x5ef622&&_0x5ef622['recordingFormat']&&_0x5ef622[_0x81b5('0x60')]!=='none'){logger[_0x81b5('0x9')]('[OUTBOUND]',_0x81b5('0x61'));_0x451df7[_0x81b5('0x4c')]=util[_0x81b5('0xa')](_0x81b5('0x4d'),_0x3b09d4['serverUrl'],_0x451df7['uniqueid'],md5(_0x451df7[_0x81b5('0x4e')]));}headers[_0x81b5('0x4f')]=getAuth(_0x3b09d4);return getUser(_0x3b09d4,_0x46ca91[_0x81b5('0x50')])[_0x81b5('0x14')](function(_0x5a9586){_0xada1cb=_0x5a9586;logger['info'](_0x81b5('0x51'),_0xada1cb['id']);return getEndUser(_0x3b09d4,_0x451df7[_0x81b5('0x62')],_0x451df7[_0x81b5('0x63')]);})[_0x81b5('0x14')](function(_0xbd87ae){_0x517325=_0xbd87ae;logger[_0x81b5('0x9')](_0x81b5('0x53'),_0x517325['id']);return getTicket(_0x3b09d4,_0xada1cb,_0x517325,_0x5725ab,_0x451df7);})['then'](function(_0x3c2285){if(_0x3c2285){logger[_0x81b5('0x9')](_0x81b5('0x64'),_0x3c2285['id']);switch(_0x3b09d4[_0x81b5('0x3c')]){case _0x81b5('0x54'):logger[_0x81b5('0x9')](_0x81b5('0x65'),_0x81b5('0x56'));return request({'uri':util['format'](_0x81b5('0x66'),_0x3b09d4[_0x81b5('0xc')],_0xada1cb['id'],_0x3c2285['id']),'method':_0x81b5('0xd')});case _0x81b5('0x57'):logger[_0x81b5('0x9')](_0x81b5('0x65'),_0x81b5('0x58'));emit(util['format']('user:%s',_0x46ca91[_0x81b5('0x47')]),_0x81b5('0x59'),{'uri':util[_0x81b5('0xa')](_0x81b5('0x67'),_0x3b09d4[_0x81b5('0xc')][_0x81b5('0x68')]('/api/v2',''),_0x3c2285['id'])});break;default:logger[_0x81b5('0x5b')](_0x81b5('0x65'),_0x81b5('0x5c'));}}})[_0x81b5('0x5d')](function(_0x3909c8){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x81b5('0x5e')](_0x3909c8,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x57d61c,_0x5c364e,_0x1a9a9c,_0x53de0b,_0x5e0454,_0x34b51d){var _0xf0db4d,_0x1cb002;_0x34b51d[_0x81b5('0xc')]=intUtil[_0x81b5('0x49')](_0x34b51d['remoteUri']);_0x34b51d[_0x81b5('0x4a')]=intUtil['stripTrailingSlash'](_0x34b51d[_0x81b5('0x4a')]);if(_0x5e0454&&_0x5e0454[_0x81b5('0x4b')]){logger[_0x81b5('0x9')]('['+_0x5c364e['lastevent'][_0x81b5('0x69')]()+']',_0x81b5('0x61'));_0x5c364e['recordingURL']=util[_0x81b5('0xa')](_0x81b5('0x4d'),_0x34b51d[_0x81b5('0x4a')],_0x5c364e[_0x81b5('0x4e')],md5(_0x5c364e['uniqueid']));}else{_0x5c364e['recordingURL']='';}headers['Authorization']=getAuth(_0x34b51d);return getUser(_0x34b51d)[_0x81b5('0x14')](function(_0x3b662c){_0xf0db4d=_0x3b662c;logger[_0x81b5('0x9')](_0x81b5('0x51'),_0xf0db4d['id']);return getEndUser(_0x34b51d,_0x5c364e['calleridname'],_0x5c364e[_0x81b5('0x6a')]);})[_0x81b5('0x14')](function(_0x3e25d6){_0x1cb002=_0x3e25d6;logger[_0x81b5('0x9')]('The\x20Enduser\x20ID\x20is:',_0x1cb002['id']);return getTicket(_0x34b51d,_0xf0db4d,_0x1cb002,_0x1a9a9c,_0x5c364e);})['then'](function(_0x23a746){if(_0x23a746){logger[_0x81b5('0x9')]('The\x20Ticket\x20ID\x20is:',_0x23a746['id']);}})[_0x81b5('0x5d')](function(_0x106880){logger['error']('['+_0x5c364e[_0x81b5('0x6b')][_0x81b5('0x69')]()+']'+_0x81b5('0x6c'),util[_0x81b5('0x5e')](_0x106880,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x19fb=['[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','integrationTab','replace','unmanaged','lastevent','toUpperCase','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','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','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','authType','%s:%s','username','password','token','Basic\x20%s','toString','[HTTP]','stringify','map','forEach','string','type','nameField','customField','toLowerCase','picklist','custom_fields','push','idField','variableName','customVariable','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x19fb,0xde));var _0xb19f=function(_0x4a0293,_0x542f5b){_0x4a0293=_0x4a0293-0x0;var _0x360d8f=_0x19fb[_0x4a0293];return _0x360d8f;};'use strict';var _=require(_0xb19f('0x0'));var rp=require('request-promise');var md5=require(_0xb19f('0x1'));var util=require(_0xb19f('0x2'));var Redis=require('ioredis');var intUtil=require(_0xb19f('0x3'));var config=require(_0xb19f('0x4'));var logger=require(_0xb19f('0x5'))(_0xb19f('0x6'));config[_0xb19f('0x7')]=_[_0xb19f('0x8')](config[_0xb19f('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb19f('0x7')]));function emit(_0x524d8a,_0x55f4a5,_0xd4b774){io['to'](_0x524d8a)[_0xb19f('0x9')](_0x55f4a5,_0xd4b774);}var headers={'Content-Type':_0xb19f('0xa'),'Accept':_0xb19f('0xa')};function getTicket(_0x851512,_0x51dbfa,_0x14a665,_0x5db500,_0x2ab146){logger[_0xb19f('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xb19f('0xc')](_0xb19f('0xd'),_0x851512[_0xb19f('0xe')]),'method':_0xb19f('0xf'),'body':{'ticket':_[_0xb19f('0x10')]({'requester_id':_0x14a665['id'],'submitter_id':_0x51dbfa?_0x51dbfa['id']:undefined,'assignee_id':_0x51dbfa?_0x51dbfa['id']:undefined,'tags':getTags(_0x5db500[_0xb19f('0x11')],_0xb19f('0x12')),'subject':intUtil[_0xb19f('0x13')](_0x5db500[_0xb19f('0x14')],_0x2ab146,'\x20'),'description':intUtil[_0xb19f('0x13')](_0x5db500[_0xb19f('0x15')],_0x2ab146,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb19f('0x13')](_0x5db500['Descriptions'],_0x2ab146,'\x0a')}},getCustomFields(_0x5db500[_0xb19f('0x16')],_0x2ab146))}})[_0xb19f('0x17')](function(_0x52bebb){logger['info'](_0xb19f('0x18'));return _0x52bebb[_0xb19f('0x19')];});}function getUser(_0x10b365,_0x51d5d3){if(intUtil['validateEmail'](_0x51d5d3)){logger[_0xb19f('0xb')](_0xb19f('0x1a'),_0x51d5d3);return request({'uri':util[_0xb19f('0xc')](_0xb19f('0x1b'),_0x10b365[_0xb19f('0xe')]),'qs':{'query':util[_0xb19f('0xc')](_0xb19f('0x1c'),_0x51d5d3)}})['then'](function(_0x84b5f0){if(_0x84b5f0[_0xb19f('0x1d')]){logger[_0xb19f('0xb')]('Agent\x20found!');return _[_0xb19f('0x1e')](_0x84b5f0[_0xb19f('0x1f')],{'email':_0x51d5d3,'role':_0xb19f('0x20')});}else{logger[_0xb19f('0xb')](_0xb19f('0x21'));return request({'uri':util[_0xb19f('0xc')](_0xb19f('0x22'),_0x10b365[_0xb19f('0xe')])})['then'](function(_0x2c8e24){logger[_0xb19f('0xb')](_0xb19f('0x23'));return _0x2c8e24[_0xb19f('0x24')];});}});}else{logger[_0xb19f('0xb')](_0xb19f('0x21'));return request({'uri':util[_0xb19f('0xc')]('%s/users/me.json',_0x10b365[_0xb19f('0xe')])})[_0xb19f('0x17')](function(_0x15d588){logger[_0xb19f('0xb')](_0xb19f('0x23'));return _0x15d588[_0xb19f('0x24')];});}}function getEndUser(_0x42dfc9,_0x5c985a,_0x3d97a5){logger[_0xb19f('0xb')](_0xb19f('0x25'),_0x3d97a5);return request({'uri':util[_0xb19f('0xc')](_0xb19f('0x1b'),_0x42dfc9['remoteUri']),'qs':{'query':util[_0xb19f('0xc')](_0xb19f('0x26'),_0x3d97a5)}})[_0xb19f('0x17')](function(_0x2759e0){var _0x355c6d;if(_0x2759e0[_0xb19f('0x1f')][_0xb19f('0x27')]){_0x2759e0[_0xb19f('0x1f')]=_[_0xb19f('0x28')](_0x2759e0[_0xb19f('0x1f')],{'suspended':![],'role':'end-user'});if(_0x2759e0[_0xb19f('0x1f')]['length']){_0x355c6d=_[_0xb19f('0x29')](_0x2759e0['results']);}}if(_0x355c6d){logger['info'](_0xb19f('0x2a'));return _0x355c6d;}else{logger[_0xb19f('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xb19f('0xc')](_0xb19f('0x2b'),_0x42dfc9[_0xb19f('0xe')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xb19f('0xc')](_0xb19f('0x2c'),_0x5c985a||_0x3d97a5),'phone':_0x3d97a5}}})[_0xb19f('0x17')](function(_0x5c6440){logger[_0xb19f('0xb')]('Enduser\x20created.');return _0x5c6440[_0xb19f('0x24')];});}});}function getAuth(_0x4e0385){var _0x2d3e37;if(_0x4e0385[_0xb19f('0x2d')]==='password'){_0x2d3e37=util[_0xb19f('0xc')](_0xb19f('0x2e'),_0x4e0385[_0xb19f('0x2f')],_0x4e0385[_0xb19f('0x30')]);}else if(_0x4e0385[_0xb19f('0x2d')]===_0xb19f('0x31')){_0x2d3e37=util[_0xb19f('0xc')]('%s/token:%s',_0x4e0385[_0xb19f('0x2f')],_0x4e0385[_0xb19f('0x31')]);}return util[_0xb19f('0xc')](_0xb19f('0x32'),new Buffer(_0x2d3e37)[_0xb19f('0x33')]('base64'));}function request(_0x17c196){logger['debug'](_0xb19f('0x34'),JSON[_0xb19f('0x35')](_0x17c196));return rp(_[_0xb19f('0x8')](_0x17c196,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4a7ac5,_0x54fd8d){var _0x138681=[];if(_0x4a7ac5&&_0x4a7ac5[_0xb19f('0x27')]>0x0){_0x138681=_[_0xb19f('0x36')](_0x4a7ac5,_0x54fd8d);}return _0x138681;}function getCustomFields(_0x3d4b82,_0x307468){var _0x5354bc=[];var _0x1406b1={'custom_fields':[]};if(_0x3d4b82['length']>0x0){_[_0xb19f('0x37')](_0x3d4b82,function(_0x2f631d){if(_['includes']([_0xb19f('0x38'),'picklist'],_0x2f631d[_0xb19f('0x39')])&&_0x2f631d[_0xb19f('0x3a')]&&!_0x2f631d[_0xb19f('0x3b')]){_0x1406b1[_0x2f631d[_0xb19f('0x3a')][_0xb19f('0x3c')]()]=_0x2f631d['content']['toString']();}else if(_['includes']([_0xb19f('0x38'),_0xb19f('0x3d')],_0x2f631d['type'])&&_0x2f631d['idField']&&_0x2f631d[_0xb19f('0x3b')]){_0x1406b1[_0xb19f('0x3e')][_0xb19f('0x3f')]({'id':_0x2f631d[_0xb19f('0x40')],'value':_0x2f631d['content'][_0xb19f('0x33')]()});}else if(_0x2f631d[_0xb19f('0x39')]==='variable'&&_0x2f631d['variableName']&&_0x2f631d[_0xb19f('0x40')]&&_0x2f631d[_0xb19f('0x3b')]){_0x307468[_0x2f631d[_0xb19f('0x41')]]&&_0x1406b1[_0xb19f('0x3e')][_0xb19f('0x3f')]({'id':_0x2f631d['idField'],'value':_0x307468[_0x2f631d[_0xb19f('0x41')]][_0xb19f('0x33')]()});}else if(_0x2f631d[_0xb19f('0x39')]===_0xb19f('0x42')&&_0x2f631d['Variable']&&_0x2f631d['Variable'][_0xb19f('0x12')]&&_0x2f631d[_0xb19f('0x40')]&&_0x2f631d['customField']){_0x307468[_0x2f631d['Variable'][_0xb19f('0x12')]['toLowerCase']()]&&_0x1406b1[_0xb19f('0x3e')]['push']({'id':_0x2f631d[_0xb19f('0x40')],'value':_0x307468[_0x2f631d['Variable'][_0xb19f('0x12')]['toLowerCase']()][_0xb19f('0x33')]()});}});}return _0x1406b1;}exports[_0xb19f('0x43')]=function(_0x220e4e,_0x237f20,_0x3e2b68,_0x7ca6b5,_0x1b5bcd,_0xdf0544){var _0x1881d5,_0x52b855;_0xdf0544[_0xb19f('0xe')]=intUtil[_0xb19f('0x44')](_0xdf0544['remoteUri']);_0xdf0544['serverUrl']=intUtil['stripTrailingSlash'](_0xdf0544['serverUrl']);if(_0x1b5bcd&&_0x1b5bcd[_0xb19f('0x45')]){logger[_0xb19f('0xb')](_0xb19f('0x46'),_0xb19f('0x47'));_0x237f20[_0xb19f('0x48')]=util[_0xb19f('0xc')](_0xb19f('0x49'),_0xdf0544[_0xb19f('0x4a')],_0x237f20[_0xb19f('0x4b')],md5(_0x237f20[_0xb19f('0x4b')]));}else{_0x237f20[_0xb19f('0x48')]='';}headers[_0xb19f('0x4c')]=getAuth(_0xdf0544);return getUser(_0xdf0544,_0x7ca6b5[_0xb19f('0x4d')])[_0xb19f('0x17')](function(_0x1c7c57){_0x1881d5=_0x1c7c57;logger['info'](_0xb19f('0x4e'),_0x1881d5['id']);return getEndUser(_0xdf0544,_0x237f20[_0xb19f('0x4f')],_0x237f20[_0xb19f('0x50')]);})[_0xb19f('0x17')](function(_0x11ab5e){_0x52b855=_0x11ab5e;logger['info'](_0xb19f('0x51'),_0x52b855['id']);return getTicket(_0xdf0544,_0x1881d5,_0x52b855,_0x3e2b68,_0x237f20);})[_0xb19f('0x17')](function(_0x190927){if(_0x190927){logger[_0xb19f('0xb')](_0xb19f('0x52'),_0x190927['id']);switch(_0xdf0544['type']){case'integrationTab':logger[_0xb19f('0xb')](_0xb19f('0x46'),_0xb19f('0x53'));return request({'uri':util[_0xb19f('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xdf0544[_0xb19f('0xe')],_0x1881d5['id'],_0x190927['id']),'method':_0xb19f('0xf')});case _0xb19f('0x54'):logger['info'](_0xb19f('0x46'),_0xb19f('0x55'));emit(util['format'](_0xb19f('0x56'),_0x7ca6b5[_0xb19f('0x12')]),_0xb19f('0x57'),{'uri':util[_0xb19f('0xc')](_0xb19f('0x58'),_0xdf0544[_0xb19f('0xe')]['replace'](_0xb19f('0x59'),''),_0x190927['id'])});break;default:logger[_0xb19f('0x5a')](_0xb19f('0x46'),_0xb19f('0x5b'));}}})[_0xb19f('0x5c')](function(_0x420d5b){logger['error'](_0xb19f('0x5d'),util[_0xb19f('0x5e')](_0x420d5b,{'showHidden':!![],'depth':null}));});};exports[_0xb19f('0x5f')]=function(_0x4b1201,_0x4fda55,_0x37a36b,_0x303906,_0xc5b4d3,_0x42a8d3,_0x177724){var _0x1a16f6,_0x9886f0;_0x42a8d3['remoteUri']=intUtil['stripTrailingSlash'](_0x42a8d3[_0xb19f('0xe')]);_0x42a8d3[_0xb19f('0x4a')]=intUtil[_0xb19f('0x44')](_0x42a8d3[_0xb19f('0x4a')]);if(_0x177724&&_0x177724[_0xb19f('0x60')]&&_0x177724[_0xb19f('0x60')]!==_0xb19f('0x61')){logger['info'](_0xb19f('0x62'),'Recording\x20is\x20enabled!');_0x4fda55[_0xb19f('0x48')]=util[_0xb19f('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42a8d3['serverUrl'],_0x4fda55[_0xb19f('0x4b')],md5(_0x4fda55['uniqueid']));}headers[_0xb19f('0x4c')]=getAuth(_0x42a8d3);return getUser(_0x42a8d3,_0x303906[_0xb19f('0x4d')])['then'](function(_0x1c2919){_0x1a16f6=_0x1c2919;logger[_0xb19f('0xb')](_0xb19f('0x4e'),_0x1a16f6['id']);return getEndUser(_0x42a8d3,_0x4fda55[_0xb19f('0x63')],_0x4fda55['destcalleridnum']);})[_0xb19f('0x17')](function(_0x2e6fd0){_0x9886f0=_0x2e6fd0;logger[_0xb19f('0xb')](_0xb19f('0x51'),_0x9886f0['id']);return getTicket(_0x42a8d3,_0x1a16f6,_0x9886f0,_0x37a36b,_0x4fda55);})[_0xb19f('0x17')](function(_0x4c1fe9){if(_0x4c1fe9){logger[_0xb19f('0xb')](_0xb19f('0x52'),_0x4c1fe9['id']);switch(_0x42a8d3[_0xb19f('0x39')]){case _0xb19f('0x64'):logger[_0xb19f('0xb')](_0xb19f('0x62'),_0xb19f('0x53'));return request({'uri':util[_0xb19f('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x42a8d3[_0xb19f('0xe')],_0x1a16f6['id'],_0x4c1fe9['id']),'method':'POST'});case'newTab':logger[_0xb19f('0xb')]('[OUTBOUND]',_0xb19f('0x55'));emit(util[_0xb19f('0xc')](_0xb19f('0x56'),_0x303906[_0xb19f('0x12')]),_0xb19f('0x57'),{'uri':util[_0xb19f('0xc')](_0xb19f('0x58'),_0x42a8d3[_0xb19f('0xe')][_0xb19f('0x65')](_0xb19f('0x59'),''),_0x4c1fe9['id'])});break;default:logger[_0xb19f('0x5a')](_0xb19f('0x62'),_0xb19f('0x5b'));}}})[_0xb19f('0x5c')](function(_0x12088c){logger[_0xb19f('0x5a')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb19f('0x5e')](_0x12088c,{'showHidden':!![],'depth':null}));});};exports[_0xb19f('0x66')]=function(_0x1ba0ad,_0x359cc1,_0x1512d5,_0x462961,_0x95024b,_0x51dc67){var _0x304f0d,_0x370819;_0x51dc67['remoteUri']=intUtil[_0xb19f('0x44')](_0x51dc67[_0xb19f('0xe')]);_0x51dc67[_0xb19f('0x4a')]=intUtil['stripTrailingSlash'](_0x51dc67[_0xb19f('0x4a')]);if(_0x95024b&&_0x95024b[_0xb19f('0x45')]){logger[_0xb19f('0xb')]('['+_0x359cc1[_0xb19f('0x67')][_0xb19f('0x68')]()+']',_0xb19f('0x47'));_0x359cc1[_0xb19f('0x48')]=util[_0xb19f('0xc')](_0xb19f('0x49'),_0x51dc67[_0xb19f('0x4a')],_0x359cc1[_0xb19f('0x4b')],md5(_0x359cc1[_0xb19f('0x4b')]));}else{_0x359cc1[_0xb19f('0x48')]='';}headers['Authorization']=getAuth(_0x51dc67);return getUser(_0x51dc67)[_0xb19f('0x17')](function(_0x42f4ad){_0x304f0d=_0x42f4ad;logger['info']('The\x20User\x20ID\x20is:',_0x304f0d['id']);return getEndUser(_0x51dc67,_0x359cc1[_0xb19f('0x4f')],_0x359cc1['calleridnum']);})[_0xb19f('0x17')](function(_0x4a59db){_0x370819=_0x4a59db;logger['info'](_0xb19f('0x51'),_0x370819['id']);return getTicket(_0x51dc67,_0x304f0d,_0x370819,_0x1512d5,_0x359cc1);})[_0xb19f('0x17')](function(_0x3fa937){if(_0x3fa937){logger[_0xb19f('0xb')]('The\x20Ticket\x20ID\x20is:',_0x3fa937['id']);}})['catch'](function(_0x1ce173){logger[_0xb19f('0x5a')]('['+_0x359cc1[_0xb19f('0x67')][_0xb19f('0x68')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x1ce173,{'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 a1a1478..aaffd58 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 _0x125f=['forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','refresh_token','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','email','Agent\x20found!','findIndex','Administrator','profile','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','Fields','err','stack','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','unmanaged','toUpperCase','calleridname','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/logger','redis','defaults','localhost','emit','[HTTP]','stringify','length'];(function(_0x241d65,_0x2db9c5){var _0x491980=function(_0x535e45){while(--_0x535e45){_0x241d65['push'](_0x241d65['shift']());}};_0x491980(++_0x2db9c5);}(_0x125f,0x1b6));var _0xf125=function(_0x245ce0,_0x2623f6){_0x245ce0=_0x245ce0-0x0;var _0x5d7084=_0x125f[_0x245ce0];return _0x5d7084;};'use strict';var _=require(_0xf125('0x0'));var rp=require(_0xf125('0x1'));var md5=require(_0xf125('0x2'));var util=require(_0xf125('0x3'));var intUtil=require('./util');var moment=require(_0xf125('0x4'));var Redis=require(_0xf125('0x5'));var BPromise=require(_0xf125('0x6'));var config=require('../../../../config/environment');var logger=require(_0xf125('0x7'))('zoho');config[_0xf125('0x8')]=_[_0xf125('0x9')](config['redis'],{'host':_0xf125('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf125('0x8')]));function emit(_0x52834,_0x281bc5,_0x4a7d8f){io['to'](_0x52834)[_0xf125('0xb')](_0x281bc5,_0x4a7d8f);}function request(_0x23b803){logger['debug'](_0xf125('0xc'),JSON[_0xf125('0xd')](_0x23b803));return rp(_0x23b803);}function getCustomFields(_0x1b7132,_0x3cc8bd){var _0x290526={};if(_0x1b7132[_0xf125('0xe')]>0x0){_[_0xf125('0xf')](_0x1b7132,function(_0x1843ec){if(_[_0xf125('0x10')]([_0xf125('0x11'),'picklist'],_0x1843ec[_0xf125('0x12')])&&_0x1843ec[_0xf125('0x13')]){_0x290526[_0x1843ec['idField']]=_0x1843ec[_0xf125('0x14')][_0xf125('0x15')]();}else if(_0x1843ec[_0xf125('0x12')]===_0xf125('0x16')&&_0x1843ec[_0xf125('0x17')]&&_0x1843ec[_0xf125('0x13')]&&_0x3cc8bd[_0x1843ec['variableName']]){_0x290526[_0x1843ec[_0xf125('0x13')]]=_0x3cc8bd[_0x1843ec[_0xf125('0x17')]]['toString']();}else if(_0x1843ec['type']===_0xf125('0x18')&&_0x1843ec['Variable']&&_0x1843ec['Variable'][_0xf125('0x19')]&&_0x1843ec['idField']&&_0x3cc8bd[_0x1843ec[_0xf125('0x1a')][_0xf125('0x19')][_0xf125('0x1b')]()]){_0x290526[_0x1843ec[_0xf125('0x13')]]=_0x3cc8bd[_0x1843ec[_0xf125('0x1a')]['name'][_0xf125('0x1b')]()]['toString']();}});}return _0x290526;}function getName(_0x3ef88a){if(_0x3ef88a['indexOf']('\x20')>0x0){var _0x9184bb=_0x3ef88a[_0xf125('0x1c')](/ (.+)/);if(_0x9184bb[0x1]){return _0x9184bb;}}return[_0x3ef88a,_0x3ef88a];}var accountsTokens={};function getAccessToken(_0x56bf3f){return new Promise(function(_0x4d1b67,_0x4220c4){if(!_[_0xf125('0x1d')](accountsTokens[_0x56bf3f['id']])&&!_['isNil'](accountsTokens[_0x56bf3f['id']][_0xf125('0x1e')])){if(moment()[_0xf125('0x1f')](accountsTokens[_0x56bf3f['id']][_0xf125('0x20')])){_0x4d1b67(accountsTokens[_0x56bf3f['id']][_0xf125('0x1e')]);}}var _0x68a5e2;switch(_0x56bf3f[_0xf125('0x21')]){case'US':_0x68a5e2=_0xf125('0x22');break;case'AU':_0x68a5e2='https://accounts.zoho.com.au';break;case'EU':_0x68a5e2=_0xf125('0x23');break;case'IN':_0x68a5e2=_0xf125('0x24');break;case'CN':_0x68a5e2=_0xf125('0x25');break;default:_0x68a5e2=_0xf125('0x23');break;}var _0x53df23={'method':'POST','uri':_0x68a5e2+_0xf125('0x26'),'qs':{'refresh_token':_0x56bf3f[_0xf125('0x27')],'client_id':_0x56bf3f['clientId'],'client_secret':_0x56bf3f['clientSecret'],'grant_type':_0xf125('0x28')},'json':!![]};return rp(_0x53df23)['then'](function(_0x387c6d){accountsTokens[_0x56bf3f['id']]={'access_token':_0x387c6d[_0xf125('0x1e')],'expires_in':moment()['add'](_0x387c6d[_0xf125('0x20')],'seconds')};_0x4d1b67(_0x387c6d[_0xf125('0x1e')]);})[_0xf125('0x29')](function(_0x448525){logger[_0xf125('0x2a')](_0xf125('0x2b'),_0x448525['stack']);_0x4220c4(_0x448525);});});}function getUser(_0x366aa9,_0x219c2c,_0x4f6120,_0xe12891){logger[_0xf125('0x2c')](_0xf125('0x2d'));return request({'method':_0xf125('0x2e'),'uri':util[_0xf125('0x2f')](_0xf125('0x30'),_0x219c2c),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xf125('0x31')+_0x366aa9},'json':!![]})[_0xf125('0x32')](function(_0x1e6514){if(_0x1e6514[_0xf125('0x33')]){var _0x46a59b=-0x1;if(_['isArrayLikeObject'](_0x1e6514[_0xf125('0x33')])){if(!_[_0xf125('0x1d')](_0xe12891)){_0x46a59b=_['findIndex'](_0x1e6514[_0xf125('0x33')],function(_0x1535ad){return _0x1535ad[_0xf125('0x34')]===_0xe12891;});}if(_0x46a59b>=0x0){logger[_0xf125('0x2c')](_0xf125('0x35'));}else{logger[_0xf125('0x2c')]('Using\x20the\x20admin\x20account!');_0x46a59b=_[_0xf125('0x36')](_0x1e6514['users'],function(_0x47d518){return _0x47d518['profile'][_0xf125('0x19')]===_0xf125('0x37');});}return _0x1e6514['users'][_0x46a59b];}else{if(_0x1e6514['user'][_0xf125('0x38')][_0xf125('0x19')]==='Administrator'){logger[_0xf125('0x2c')](_0xf125('0x39'));user=_0x1e6514[_0xf125('0x3a')];return user;}else{logger['error'](_0xf125('0x3b'),JSON[_0xf125('0xd')](_0x1e6514));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf125('0xd')](_0x1e6514));}}}else{logger[_0xf125('0x2a')]('The\x20failing\x20result\x20is',JSON[_0xf125('0xd')](_0x1e6514));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf125('0xd')](_0x1e6514));}})[_0xf125('0x29')](function(_0x10e4d5){console['error'](_0x10e4d5);});}function getZohoUser(_0x5d2d93,_0xbd4c3c){return new BPromise(function(_0x504d28,_0x3a9d67){request(_0x5d2d93)[_0xf125('0x32')](function(_0x4d9d38){var _0x5bfc17=null;if(_0x4d9d38){_0x5bfc17=_0x4d9d38[_0xf125('0x3c')][0x0];_0x5bfc17['enduserType']=_0xbd4c3c;}_0x504d28(_0x5bfc17);})[_0xf125('0x29')](function(_0x53c63b){_0x3a9d67(_0x53c63b);});});}function createEndUser(_0x4810d4,_0x1a4fa6,_0x4a44ba,_0x22c86d,_0xef7311,_0x5cc2c2){var _0x4a44ba=getName(_0x4a44ba);return request({'method':_0xf125('0x3d'),'uri':_0xf125('0x3e')+_0x1a4fa6+_0xf125('0x3f')+_[_0xf125('0x40')](_0x5cc2c2[_0xf125('0x41')])+'s','body':{'data':[{'Last_Name':_0x4a44ba[0x1],'First_Name':_0x4a44ba[0x0],'Phone':_0x22c86d,'Owner':{'name':!_['isNil'](_0xef7311[_0xf125('0x42')][_0xf125('0x19')])?_0xef7311[_0xf125('0x42')][_0xf125('0x19')]:!_[_0xf125('0x1d')](_0xef7311[_0xf125('0x43')])?_0xef7311[_0xf125('0x43')]+'\x20'+_0xef7311['last_name']:_0xef7311[_0xf125('0x44')],'id':_0xef7311['id']}}]},'headers':{'Authorization':_0xf125('0x31')+_0x4810d4},'json':!![]})['then'](function(_0x1a223f){if(_0x1a223f&&_0x1a223f['data'][0x0][_0xf125('0x45')]===_0xf125('0x46')){var _0x4074d7=_0x1a223f['data'][0x0][_0xf125('0x47')];_0x4074d7[_0xf125('0x48')]=_[_0xf125('0x40')](_0x5cc2c2['moduleCreate'])+'s';return _0x4074d7;}logger['error'](_0xf125('0x3b'),JSON[_0xf125('0xd')](data));throw new Error(_0xf125('0x49')+JSON[_0xf125('0xd')](data));})[_0xf125('0x29')](function(_0x84cdc0){console[_0xf125('0x4a')]('CREATE\x20ERROR',_0x84cdc0);});}function getEndUser(_0x2037d2,_0x28d97d,_0x564448,_0x2a9472,_0x55f3a6,_0x448b79,_0x4b0788){var _0x433206={'method':_0xf125('0x2e'),'uri':'','headers':{'Authorization':_0xf125('0x31')+_0x2037d2},'json':!![]};switch(_0x4b0788[_0xf125('0x4b')]){case _0xf125('0x4c'):_0x433206[_0xf125('0x4d')]='https://www.zohoapis.'+_0x28d97d+_0xf125('0x4e')+_0x55f3a6+'))';return getZohoUser(_0x433206,_0xf125('0x4f'))['then'](function(_0x143ce4){if(_0x143ce4)return _0x143ce4;_0x433206['uri']='https://www.zohoapis.'+_0x28d97d+_0xf125('0x50')+_0x55f3a6+'))';return getZohoUser(_0x433206,_0xf125('0x51'))[_0xf125('0x32')](function(_0x447862){if(_0x447862)return _0x447862;if(_0x4b0788[_0xf125('0x41')]!=_0xf125('0x52')){return createEndUser(_0x2037d2,_0x28d97d,_0x2a9472,_0x55f3a6,_0x448b79,_0x4b0788);}else{return{};}});});break;case _0xf125('0x53'):_0x433206[_0xf125('0x4d')]=_0xf125('0x3e')+_0x28d97d+_0xf125('0x4e')+_0x55f3a6+'))';return getZohoUser(_0x433206,'Contacts')[_0xf125('0x32')](function(_0x3778a4){if(_0x3778a4)return _0x3778a4;if(_0x4b0788[_0xf125('0x41')]!='nothing'){return createEndUser(_0x2037d2,_0x28d97d,_0x2a9472,_0x55f3a6,_0x448b79,_0x4b0788);}else{return{};}});break;case'lead':_0x433206[_0xf125('0x4d')]=_0xf125('0x3e')+_0x28d97d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x55f3a6+'))';return getZohoUser(_0x433206,_0xf125('0x51'))[_0xf125('0x32')](function(_0x5e4d05){if(_0x5e4d05)return _0x5e4d05;if(_0x4b0788['moduleCreate']!=_0xf125('0x52')){return createEndUser(_0x2037d2,_0x28d97d,_0x2a9472,_0x55f3a6,_0x448b79,_0x4b0788);}else{return{};}});break;}}function getCall(_0x9e6faa,_0x23e321,_0x3c80a2,_0x6dbcbf,_0x18d616,_0xe5ede9,_0x481c33,_0x23964a){logger[_0xf125('0x2c')](_0xf125('0x54'));var _0x2b9018={};_0x2b9018[_0xf125('0x55')]={'name':!_[_0xf125('0x1d')](_0x6dbcbf[_0xf125('0x42')][_0xf125('0x19')])&&!_[_0xf125('0x1d')](_0x6dbcbf[_0xf125('0x38')]['name'])&&_0x6dbcbf['profile']['name']===_0xf125('0x56')?_0x6dbcbf[_0xf125('0x42')][_0xf125('0x19')]:!_['isNil'](_0x6dbcbf[_0xf125('0x43')])?_0x6dbcbf['first_name']+'\x20'+_0x6dbcbf[_0xf125('0x44')]:_0x6dbcbf[_0xf125('0x44')],'id':_0x6dbcbf['id']};_0x2b9018[_0xf125('0x57')]=intUtil['getString'](_0xe5ede9[_0xf125('0x58')],_0x481c33,'\x20');_0x2b9018[_0xf125('0x59')]=intUtil[_0xf125('0x5a')](_0xe5ede9[_0xf125('0x5b')],_0x481c33,'\x0a');if(_0x18d616[_0xf125('0x48')]===_0xf125('0x4f')){_0x2b9018['Who_Id']={'name':!_[_0xf125('0x1d')](_0x18d616[_0xf125('0x5c')])?_0x18d616[_0xf125('0x5c')]:!_[_0xf125('0x1d')](_0x18d616[_0xf125('0x5d')])?_0x18d616[_0xf125('0x5d')]+'\x20'+_0x18d616[_0xf125('0x5e')]:_0x18d616[_0xf125('0x5e')],'id':_0x18d616['id']};}if(_0x18d616[_0xf125('0x48')]===_0xf125('0x51')){_0x2b9018[_0xf125('0x5f')]={'name':!_[_0xf125('0x1d')](_0x18d616[_0xf125('0x5c')])?_0x18d616[_0xf125('0x5c')]:!_[_0xf125('0x1d')](_0x18d616[_0xf125('0x5d')])?_0x18d616[_0xf125('0x5d')]+'\x20'+_0x18d616[_0xf125('0x5e')]:_0x18d616[_0xf125('0x5e')],'id':_0x18d616['id']};_0x2b9018[_0xf125('0x60')]=_['startCase'](_0x18d616['enduserType']);}if(_0x481c33['talktime']){_0x2b9018[_0xf125('0x61')]=moment[_0xf125('0x62')](parseInt(_0x481c33[_0xf125('0x63')])*0x3e8)[_0xf125('0x2f')](_0xf125('0x64'));}else if(_0x481c33[_0xf125('0x65')]&&_0x481c33[_0xf125('0x66')]){_0x2b9018[_0xf125('0x61')]=moment[_0xf125('0x62')](moment(_0x481c33[_0xf125('0x66')],_0xf125('0x67'))['diff'](moment(_0x481c33[_0xf125('0x68')],_0xf125('0x67'))))[_0xf125('0x2f')](_0xf125('0x64'));}switch(_0x481c33[_0xf125('0x69')]){case _0xf125('0x6a'):_0x2b9018[_0xf125('0x6b')]=_0xf125('0x6c');break;case _0xf125('0x6d'):case _0xf125('0x6e'):_0x2b9018[_0xf125('0x6b')]=_0xf125('0x6f');break;case _0xf125('0x70'):_0x2b9018[_0xf125('0x6b')]=_0xf125('0x71');break;case'abandoned':_0x2b9018[_0xf125('0x6b')]='Abandoned';break;case _0xf125('0x72'):_0x2b9018['Call_Result']=_0xf125('0x73');default:}_0x2b9018['Call_Start_Time']=(_0x23964a===_0xf125('0x74')?moment(_0x481c33[_0xf125('0x68')])[_0xf125('0x2f')](_0xf125('0x67')):moment(_0x481c33[_0xf125('0x75')])[_0xf125('0x2f')](_0xf125('0x67')))||moment()['format'](_0xf125('0x67'));_0x2b9018['Call_Type']=_0x23964a||_0xf125('0x76');_0x2b9018=_[_0xf125('0x77')](_0x2b9018,getCustomFields(_0xe5ede9[_0xf125('0x78')],_0x481c33));return request({'method':_0xf125('0x3d'),'uri':'https://www.zohoapis.'+_0x23e321+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x9e6faa},'body':{'data':[_0x2b9018]},'json':!![]})[_0xf125('0x32')](function(_0x19c9b8){if(_0x19c9b8&&_0x19c9b8['data'][0x0][_0xf125('0x45')]==='SUCCESS'){logger[_0xf125('0x2c')]('Call\x20created!');return{'id':_0x19c9b8['data'][0x0]['details']['id']};}})[_0xf125('0x29')](function(_0xaf582){logger[_0xf125('0x2c')](_0xf125('0x79'),_0xaf582[_0xf125('0x7a')]);console['log'](_0xf125('0x79'),_0xaf582);});}exports[_0xf125('0x7b')]=function(_0x56712e,_0x33a25b,_0x1c0506,_0x22aee0,_0x106148,_0x24cc9d){var _0x266855,_0x2ce2c1,_0x3c68fc;_0x24cc9d[_0xf125('0x7c')]=intUtil['stripTrailingSlash'](_0x24cc9d[_0xf125('0x7c')]);_0x24cc9d[_0xf125('0x7d')]=intUtil[_0xf125('0x7e')](_0x24cc9d['serverUrl']);if(_0x106148&&_0x106148[_0xf125('0x7f')]){logger[_0xf125('0x2c')](_0xf125('0x80'),_0xf125('0x81'));_0x33a25b[_0xf125('0x82')]=_0x24cc9d['serverUrl']+_0xf125('0x83')+_0x33a25b[_0xf125('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x33a25b[_0xf125('0x84')]);}else{_0x33a25b[_0xf125('0x82')]='';}var _0x4d3767=_0x24cc9d['host']===_0xf125('0x85')?'eu':'com';return getAccessToken(_0x24cc9d)[_0xf125('0x32')](function(_0x46aaab){_0x3c68fc=_0x46aaab;return getUser(_0x3c68fc,_0x4d3767,_0x24cc9d,_0x22aee0[_0xf125('0x34')]);})[_0xf125('0x32')](function(_0x30a291){_0x266855=_0x30a291;logger[_0xf125('0x2c')](_0xf125('0x86'),_0x266855['id']);return getEndUser(_0x3c68fc,_0x4d3767,_0x24cc9d,_0x33a25b['calleridname'],_0x33a25b[_0xf125('0x87')],_0x266855,_0x1c0506);})[_0xf125('0x32')](function(_0x255b51){_0x2ce2c1=_0x255b51;return getCall(_0x3c68fc,_0x4d3767,_0x24cc9d,_0x266855,_0x2ce2c1,_0x1c0506,_0x33a25b,_0xf125('0x76'));})[_0xf125('0x32')](function(_0x12ed08){if(_0x12ed08){logger[_0xf125('0x2c')](_0xf125('0x88'),_0x12ed08['id']);logger[_0xf125('0x2c')]('[QUEUE]',_0xf125('0x89'));emit(util[_0xf125('0x2f')](_0xf125('0x8a'),_0x22aee0[_0xf125('0x19')]),_0xf125('0x8b'),{'uri':_0xf125('0x8c')+_0x24cc9d[_0xf125('0x7c')]+_0xf125('0x8d')+_0x12ed08['id']});}})[_0xf125('0x29')](function(_0x1fa4ab){logger[_0xf125('0x2a')](_0xf125('0x80'),JSON['stringify'](_0x1fa4ab));});};exports[_0xf125('0x74')]=function(_0x3536e7,_0x3d276f,_0x13c382,_0x169e1c,_0x460af1,_0x220dd7,_0x21af61){var _0x333ffc,_0x119622,_0x1dfb52;_0x220dd7[_0xf125('0x7c')]=intUtil[_0xf125('0x7e')](_0x220dd7['host']);_0x220dd7[_0xf125('0x7d')]=intUtil[_0xf125('0x7e')](_0x220dd7[_0xf125('0x7d')]);if(_0x21af61&&_0x21af61[_0xf125('0x8e')]&&_0x21af61[_0xf125('0x8e')]!==_0xf125('0x8f')){logger[_0xf125('0x2c')](_0xf125('0x90'),_0xf125('0x81'));_0x3d276f[_0xf125('0x82')]=_0x220dd7['serverUrl']+_0xf125('0x83')+_0x3d276f['uniqueid']+_0xf125('0x91')+md5(_0x3d276f[_0xf125('0x84')]);}var _0x492a0e=_0x220dd7[_0xf125('0x7c')]===_0xf125('0x85')?'eu':'com';return getAccessToken(_0x220dd7)[_0xf125('0x32')](function(_0x3480ba){_0x1dfb52=_0x3480ba;return getUser(_0x1dfb52,_0x492a0e,_0x220dd7,_0x169e1c['email']);})[_0xf125('0x32')](function(_0x59acf9){_0x333ffc=_0x59acf9;logger[_0xf125('0x2c')](_0xf125('0x86'),_0x333ffc['id']);return getEndUser(_0x1dfb52,_0x492a0e,_0x220dd7,_0x3d276f[_0xf125('0x92')],_0x3d276f[_0xf125('0x93')],_0x333ffc,_0x13c382);})['then'](function(_0x5de69b){_0x119622=_0x5de69b;return getCall(_0x1dfb52,_0x492a0e,_0x220dd7,_0x333ffc,_0x119622,_0x13c382,_0x3d276f,'Outbound');})['then'](function(_0x2846f6){if(_0x2846f6){logger[_0xf125('0x2c')](_0xf125('0x88'),_0x2846f6['id']);logger['info'](_0xf125('0x90'),_0xf125('0x89'));emit(util[_0xf125('0x2f')](_0xf125('0x8a'),_0x169e1c[_0xf125('0x19')]),_0xf125('0x8b'),{'uri':_0xf125('0x8c')+_0x220dd7[_0xf125('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2846f6['id']});}})[_0xf125('0x29')](function(_0x7182e3){logger['error'](_0xf125('0x90'),JSON[_0xf125('0xd')](_0x7182e3));});};exports[_0xf125('0x94')]=function(_0xacc159,_0x216ca4,_0x32c15d,_0x445499,_0x4f25bb,_0x559852){var _0x476738,_0x111a14,_0x1af9e4;_0x559852['host']=intUtil[_0xf125('0x7e')](_0x559852[_0xf125('0x7c')]);_0x559852['serverUrl']=intUtil[_0xf125('0x7e')](_0x559852['serverUrl']);if(_0x4f25bb&&_0x4f25bb['monitor_format']){logger[_0xf125('0x2c')]('['+_0x216ca4[_0xf125('0x69')][_0xf125('0x95')]()+']',_0xf125('0x81'));_0x216ca4['recordingURL']=_0x559852[_0xf125('0x7d')]+_0xf125('0x83')+_0x216ca4[_0xf125('0x84')]+_0xf125('0x91')+md5(_0x216ca4[_0xf125('0x84')]);}else{_0x216ca4[_0xf125('0x82')]='';}var _0x438727=_0x559852['host']===_0xf125('0x85')?'eu':'com';return getAccessToken(_0x559852)[_0xf125('0x32')](function(_0x5c1813){_0x1af9e4=_0x5c1813;return getUser(_0x1af9e4,_0x438727,_0x559852);})[_0xf125('0x32')](function(_0x15a90a){_0x476738=_0x15a90a;logger[_0xf125('0x2c')](_0xf125('0x86'),_0x476738['id']);return getEndUser(_0x1af9e4,_0x438727,_0x559852,_0x216ca4[_0xf125('0x96')],_0x216ca4['calleridnum'],_0x476738,_0x32c15d);})[_0xf125('0x32')](function(_0x423890){_0x111a14=_0x423890;return getCall(_0x1af9e4,_0x438727,_0x559852,_0x476738,_0x111a14,_0x32c15d,_0x216ca4,'Inbound');})[_0xf125('0x32')](function(_0x51d271){if(_0x51d271){logger['info'](_0xf125('0x88'),_0x51d271['id']);}})[_0xf125('0x29')](function(_0x5157ae){logger['error']('['+_0x216ca4[_0xf125('0x69')][_0xf125('0x95')]()+']',JSON['stringify'](_0x5157ae));});}; \ No newline at end of file +var _0xdf1f=['queue','host','stripTrailingSlash','[QUEUE]','recordingURL','serverUrl','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','monitor_format','toUpperCase','calleridname','lodash','util','./util','moment','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','stringify','length','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','catch','Failing\x20creating\x20the\x20access_token','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','findIndex','email','info','Agent\x20found!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','enduserType','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','uri','Contacts','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','format','mm:ss','answertime','endtime','utc','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','complete','connect','Call_Result','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','details','err','stack'];(function(_0x20ec00,_0x549738){var _0x506105=function(_0x9dab42){while(--_0x9dab42){_0x20ec00['push'](_0x20ec00['shift']());}};_0x506105(++_0x549738);}(_0xdf1f,0x1ec));var _0xfdf1=function(_0x4054e2,_0x31572a){_0x4054e2=_0x4054e2-0x0;var _0x54ebdf=_0xdf1f[_0x4054e2];return _0x54ebdf;};'use strict';var _=require(_0xfdf1('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xfdf1('0x1'));var intUtil=require(_0xfdf1('0x2'));var moment=require(_0xfdf1('0x3'));var Redis=require('ioredis');var BPromise=require(_0xfdf1('0x4'));var config=require('../../../../config/environment');var logger=require(_0xfdf1('0x5'))(_0xfdf1('0x6'));config[_0xfdf1('0x7')]=_[_0xfdf1('0x8')](config[_0xfdf1('0x7')],{'host':_0xfdf1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x265bc2,_0x836d35,_0x1ebd61){io['to'](_0x265bc2)[_0xfdf1('0xa')](_0x836d35,_0x1ebd61);}function request(_0x49b6b4){logger[_0xfdf1('0xb')]('[HTTP]',JSON[_0xfdf1('0xc')](_0x49b6b4));return rp(_0x49b6b4);}function getCustomFields(_0x3d8f1a,_0x10e23f){var _0x2812fd={};if(_0x3d8f1a[_0xfdf1('0xd')]>0x0){_['forEach'](_0x3d8f1a,function(_0x343682){if(_[_0xfdf1('0xe')]([_0xfdf1('0xf'),'picklist'],_0x343682['type'])&&_0x343682[_0xfdf1('0x10')]){_0x2812fd[_0x343682[_0xfdf1('0x10')]]=_0x343682[_0xfdf1('0x11')][_0xfdf1('0x12')]();}else if(_0x343682[_0xfdf1('0x13')]===_0xfdf1('0x14')&&_0x343682[_0xfdf1('0x15')]&&_0x343682[_0xfdf1('0x10')]&&_0x10e23f[_0x343682[_0xfdf1('0x15')]]){_0x2812fd[_0x343682[_0xfdf1('0x10')]]=_0x10e23f[_0x343682[_0xfdf1('0x15')]][_0xfdf1('0x12')]();}else if(_0x343682[_0xfdf1('0x13')]==='customVariable'&&_0x343682[_0xfdf1('0x16')]&&_0x343682['Variable']['name']&&_0x343682['idField']&&_0x10e23f[_0x343682[_0xfdf1('0x16')]['name']['toLowerCase']()]){_0x2812fd[_0x343682[_0xfdf1('0x10')]]=_0x10e23f[_0x343682['Variable'][_0xfdf1('0x17')][_0xfdf1('0x18')]()]['toString']();}});}return _0x2812fd;}function getName(_0xf5eda9){if(_0xf5eda9[_0xfdf1('0x19')]('\x20')>0x0){var _0xa3ae95=_0xf5eda9['split'](/ (.+)/);if(_0xa3ae95[0x1]){return _0xa3ae95;}}return[_0xf5eda9,_0xf5eda9];}var accountsTokens={};function getAccessToken(_0x167434){return new Promise(function(_0x266a4e,_0xabbb94){if(!_[_0xfdf1('0x1a')](accountsTokens[_0x167434['id']])&&!_[_0xfdf1('0x1a')](accountsTokens[_0x167434['id']][_0xfdf1('0x1b')])){if(moment()[_0xfdf1('0x1c')](accountsTokens[_0x167434['id']][_0xfdf1('0x1d')])){_0x266a4e(accountsTokens[_0x167434['id']]['access_token']);}}var _0x37d539;switch(_0x167434['zone']){case'US':_0x37d539=_0xfdf1('0x1e');break;case'AU':_0x37d539=_0xfdf1('0x1f');break;case'EU':_0x37d539=_0xfdf1('0x20');break;case'IN':_0x37d539=_0xfdf1('0x21');break;case'CN':_0x37d539='https://accounts.zoho.com.cn';break;default:_0x37d539=_0xfdf1('0x20');break;}var _0x546392={'method':_0xfdf1('0x22'),'uri':_0x37d539+_0xfdf1('0x23'),'qs':{'refresh_token':_0x167434[_0xfdf1('0x24')],'client_id':_0x167434[_0xfdf1('0x25')],'client_secret':_0x167434[_0xfdf1('0x26')],'grant_type':_0xfdf1('0x27')},'json':!![]};return rp(_0x546392)['then'](function(_0x3944e6){accountsTokens[_0x167434['id']]={'access_token':_0x3944e6[_0xfdf1('0x1b')],'expires_in':moment()[_0xfdf1('0x28')](_0x3944e6[_0xfdf1('0x1d')],_0xfdf1('0x29'))};_0x266a4e(_0x3944e6[_0xfdf1('0x1b')]);})[_0xfdf1('0x2a')](function(_0x38e14d){logger['error'](_0xfdf1('0x2b'),_0x38e14d['stack']);_0xabbb94(_0x38e14d);});});}function getUser(_0x2431c1,_0x54c5b2,_0x28f1eb,_0x20a941){logger['info'](_0xfdf1('0x2c'));return request({'method':_0xfdf1('0x2d'),'uri':util['format'](_0xfdf1('0x2e'),_0x54c5b2),'qs':{'type':_0xfdf1('0x2f')},'headers':{'Authorization':_0xfdf1('0x30')+_0x2431c1},'json':!![]})[_0xfdf1('0x31')](function(_0x578e5a){if(_0x578e5a[_0xfdf1('0x32')]){var _0x176c64=-0x1;if(_['isArrayLikeObject'](_0x578e5a[_0xfdf1('0x32')])){if(!_[_0xfdf1('0x1a')](_0x20a941)){_0x176c64=_[_0xfdf1('0x33')](_0x578e5a[_0xfdf1('0x32')],function(_0x31780c){return _0x31780c[_0xfdf1('0x34')]===_0x20a941;});}if(_0x176c64>=0x0){logger[_0xfdf1('0x35')](_0xfdf1('0x36'));}else{logger[_0xfdf1('0x35')]('Using\x20the\x20admin\x20account!');_0x176c64=_['findIndex'](_0x578e5a['users'],function(_0x3fd653){return _0x3fd653[_0xfdf1('0x37')][_0xfdf1('0x17')]===_0xfdf1('0x38');});}return _0x578e5a['users'][_0x176c64];}else{if(_0x578e5a[_0xfdf1('0x39')][_0xfdf1('0x37')][_0xfdf1('0x17')]===_0xfdf1('0x38')){logger[_0xfdf1('0x35')]('Using\x20the\x20admin\x20account!');user=_0x578e5a[_0xfdf1('0x39')];return user;}else{logger[_0xfdf1('0x3a')](_0xfdf1('0x3b'),JSON[_0xfdf1('0xc')](_0x578e5a));throw new Error(_0xfdf1('0x3c')+JSON[_0xfdf1('0xc')](_0x578e5a));}}}else{logger[_0xfdf1('0x3a')](_0xfdf1('0x3b'),JSON['stringify'](_0x578e5a));throw new Error(_0xfdf1('0x3c')+JSON[_0xfdf1('0xc')](_0x578e5a));}})[_0xfdf1('0x2a')](function(_0x39a7ad){console[_0xfdf1('0x3a')](_0x39a7ad);});}function getZohoUser(_0x416053,_0x1f9f15){return new BPromise(function(_0x4bed4c,_0x9ee85f){request(_0x416053)[_0xfdf1('0x31')](function(_0x422820){var _0x9f3c8e=null;if(_0x422820){_0x9f3c8e=_0x422820[_0xfdf1('0x3d')][0x0];_0x9f3c8e['enduserType']=_0x1f9f15;}_0x4bed4c(_0x9f3c8e);})[_0xfdf1('0x2a')](function(_0x44a81c){_0x9ee85f(_0x44a81c);});});}function createEndUser(_0x3a590e,_0x1ac0ff,_0x444133,_0x1a9f10,_0x84f537,_0x25b952){var _0x444133=getName(_0x444133);return request({'method':'POST','uri':_0xfdf1('0x3e')+_0x1ac0ff+_0xfdf1('0x3f')+_[_0xfdf1('0x40')](_0x25b952[_0xfdf1('0x41')])+'s','body':{'data':[{'Last_Name':_0x444133[0x1],'First_Name':_0x444133[0x0],'Phone':_0x1a9f10,'Owner':{'name':!_[_0xfdf1('0x1a')](_0x84f537['role'][_0xfdf1('0x17')])?_0x84f537[_0xfdf1('0x42')]['name']:!_['isNil'](_0x84f537['first_name'])?_0x84f537[_0xfdf1('0x43')]+'\x20'+_0x84f537['last_name']:_0x84f537[_0xfdf1('0x44')],'id':_0x84f537['id']}}]},'headers':{'Authorization':_0xfdf1('0x30')+_0x3a590e},'json':!![]})[_0xfdf1('0x31')](function(_0x8f8ca0){if(_0x8f8ca0&&_0x8f8ca0['data'][0x0][_0xfdf1('0x45')]===_0xfdf1('0x46')){var _0x41bbd9=_0x8f8ca0[_0xfdf1('0x3d')][0x0]['details'];_0x41bbd9[_0xfdf1('0x47')]=_['startCase'](_0x25b952[_0xfdf1('0x41')])+'s';return _0x41bbd9;}logger[_0xfdf1('0x3a')](_0xfdf1('0x3b'),JSON['stringify'](data));throw new Error(_0xfdf1('0x48')+JSON[_0xfdf1('0xc')](data));})[_0xfdf1('0x2a')](function(_0x95c1){console[_0xfdf1('0x49')](_0xfdf1('0x4a'),_0x95c1);});}function getEndUser(_0x19b1a3,_0x54c428,_0x3b7d62,_0x46bdd9,_0x33fb27,_0xfa1cb1,_0x3596e6){var _0x525fcb={'method':_0xfdf1('0x2d'),'uri':'','headers':{'Authorization':_0xfdf1('0x30')+_0x19b1a3},'json':!![]};switch(_0x3596e6[_0xfdf1('0x4b')]){case _0xfdf1('0x4c'):_0x525fcb['uri']=_0xfdf1('0x3e')+_0x54c428+_0xfdf1('0x4d')+_0x33fb27+'))';return getZohoUser(_0x525fcb,'Contacts')[_0xfdf1('0x31')](function(_0x143571){if(_0x143571)return _0x143571;_0x525fcb['uri']=_0xfdf1('0x3e')+_0x54c428+_0xfdf1('0x4e')+_0x33fb27+'))';return getZohoUser(_0x525fcb,'Leads')[_0xfdf1('0x31')](function(_0x212c1e){if(_0x212c1e)return _0x212c1e;if(_0x3596e6[_0xfdf1('0x41')]!=_0xfdf1('0x4f')){return createEndUser(_0x19b1a3,_0x54c428,_0x46bdd9,_0x33fb27,_0xfa1cb1,_0x3596e6);}else{return{};}});});break;case _0xfdf1('0x50'):_0x525fcb[_0xfdf1('0x51')]=_0xfdf1('0x3e')+_0x54c428+_0xfdf1('0x4d')+_0x33fb27+'))';return getZohoUser(_0x525fcb,_0xfdf1('0x52'))[_0xfdf1('0x31')](function(_0xb27b29){if(_0xb27b29)return _0xb27b29;if(_0x3596e6['moduleCreate']!=_0xfdf1('0x4f')){return createEndUser(_0x19b1a3,_0x54c428,_0x46bdd9,_0x33fb27,_0xfa1cb1,_0x3596e6);}else{return{};}});break;case _0xfdf1('0x53'):_0x525fcb[_0xfdf1('0x51')]=_0xfdf1('0x3e')+_0x54c428+_0xfdf1('0x4e')+_0x33fb27+'))';return getZohoUser(_0x525fcb,_0xfdf1('0x54'))[_0xfdf1('0x31')](function(_0x54256d){if(_0x54256d)return _0x54256d;if(_0x3596e6['moduleCreate']!=_0xfdf1('0x4f')){return createEndUser(_0x19b1a3,_0x54c428,_0x46bdd9,_0x33fb27,_0xfa1cb1,_0x3596e6);}else{return{};}});break;}}function getCall(_0x266fc5,_0x594e65,_0x5d1b8b,_0x43ed2c,_0x5ef39a,_0x301a39,_0x2300fb,_0xbd99b5){logger['info'](_0xfdf1('0x55'));var _0x161cbc={};_0x161cbc[_0xfdf1('0x56')]={'name':!_[_0xfdf1('0x1a')](_0x43ed2c[_0xfdf1('0x42')]['name'])&&!_[_0xfdf1('0x1a')](_0x43ed2c['profile'][_0xfdf1('0x17')])&&_0x43ed2c[_0xfdf1('0x37')][_0xfdf1('0x17')]===_0xfdf1('0x57')?_0x43ed2c[_0xfdf1('0x42')][_0xfdf1('0x17')]:!_[_0xfdf1('0x1a')](_0x43ed2c['first_name'])?_0x43ed2c[_0xfdf1('0x43')]+'\x20'+_0x43ed2c[_0xfdf1('0x44')]:_0x43ed2c[_0xfdf1('0x44')],'id':_0x43ed2c['id']};_0x161cbc[_0xfdf1('0x58')]=intUtil[_0xfdf1('0x59')](_0x301a39['Subjects'],_0x2300fb,'\x20');_0x161cbc[_0xfdf1('0x5a')]=intUtil[_0xfdf1('0x59')](_0x301a39[_0xfdf1('0x5b')],_0x2300fb,'\x0a');if(_0x5ef39a['enduserType']===_0xfdf1('0x52')){_0x161cbc[_0xfdf1('0x5c')]={'name':!_[_0xfdf1('0x1a')](_0x5ef39a['Full_Name'])?_0x5ef39a[_0xfdf1('0x5d')]:!_[_0xfdf1('0x1a')](_0x5ef39a['First_Name'])?_0x5ef39a[_0xfdf1('0x5e')]+'\x20'+_0x5ef39a[_0xfdf1('0x5f')]:_0x5ef39a[_0xfdf1('0x5f')],'id':_0x5ef39a['id']};}if(_0x5ef39a['enduserType']===_0xfdf1('0x54')){_0x161cbc[_0xfdf1('0x60')]={'name':!_[_0xfdf1('0x1a')](_0x5ef39a['Full_Name'])?_0x5ef39a[_0xfdf1('0x5d')]:!_['isNil'](_0x5ef39a[_0xfdf1('0x5e')])?_0x5ef39a[_0xfdf1('0x5e')]+'\x20'+_0x5ef39a['Last_Name']:_0x5ef39a[_0xfdf1('0x5f')],'id':_0x5ef39a['id']};_0x161cbc[_0xfdf1('0x61')]=_[_0xfdf1('0x40')](_0x5ef39a['enduserType']);}if(_0x2300fb[_0xfdf1('0x62')]){_0x161cbc[_0xfdf1('0x63')]=moment['utc'](parseInt(_0x2300fb[_0xfdf1('0x62')])*0x3e8)[_0xfdf1('0x64')](_0xfdf1('0x65'));}else if(_0x2300fb[_0xfdf1('0x66')]&&_0x2300fb[_0xfdf1('0x67')]){_0x161cbc[_0xfdf1('0x63')]=moment[_0xfdf1('0x68')](moment(_0x2300fb[_0xfdf1('0x67')],'YYYY-MM-DDTHH:mm:ss')[_0xfdf1('0x69')](moment(_0x2300fb[_0xfdf1('0x6a')],_0xfdf1('0x6b'))))['format'](_0xfdf1('0x65'));}switch(_0x2300fb[_0xfdf1('0x6c')]){case _0xfdf1('0x6d'):_0x161cbc['Call_Result']='Called';break;case _0xfdf1('0x6e'):case _0xfdf1('0x6f'):_0x161cbc[_0xfdf1('0x70')]='Answered';break;case _0xfdf1('0x71'):_0x161cbc[_0xfdf1('0x70')]=_0xfdf1('0x72');break;case _0xfdf1('0x73'):_0x161cbc[_0xfdf1('0x70')]=_0xfdf1('0x74');break;case _0xfdf1('0x75'):_0x161cbc[_0xfdf1('0x70')]=_0xfdf1('0x76');default:}_0x161cbc['Call_Start_Time']=(_0xbd99b5===_0xfdf1('0x77')?moment(_0x2300fb['starttime'])[_0xfdf1('0x64')](_0xfdf1('0x6b')):moment(_0x2300fb['agentcalledAt'])[_0xfdf1('0x64')](_0xfdf1('0x6b')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x161cbc[_0xfdf1('0x78')]=_0xbd99b5||_0xfdf1('0x79');_0x161cbc=_['merge'](_0x161cbc,getCustomFields(_0x301a39[_0xfdf1('0x7a')],_0x2300fb));return request({'method':_0xfdf1('0x22'),'uri':'https://www.zohoapis.'+_0x594e65+_0xfdf1('0x7b'),'headers':{'Authorization':_0xfdf1('0x30')+_0x266fc5},'body':{'data':[_0x161cbc]},'json':!![]})[_0xfdf1('0x31')](function(_0x326cb2){if(_0x326cb2&&_0x326cb2[_0xfdf1('0x3d')][0x0]['code']==='SUCCESS'){logger[_0xfdf1('0x35')](_0xfdf1('0x7c'));return{'id':_0x326cb2['data'][0x0][_0xfdf1('0x7d')]['id']};}})[_0xfdf1('0x2a')](function(_0xcf1b8b){logger[_0xfdf1('0x35')](_0xfdf1('0x7e'),_0xcf1b8b[_0xfdf1('0x7f')]);console['log'](_0xfdf1('0x7e'),_0xcf1b8b);});}exports[_0xfdf1('0x80')]=function(_0x371527,_0x599d8c,_0x4833bd,_0x1de430,_0x363054,_0x1acaa6){var _0x4b9ad1,_0x27cd50,_0x622b82;_0x1acaa6[_0xfdf1('0x81')]=intUtil[_0xfdf1('0x82')](_0x1acaa6[_0xfdf1('0x81')]);_0x1acaa6['serverUrl']=intUtil[_0xfdf1('0x82')](_0x1acaa6['serverUrl']);if(_0x363054&&_0x363054['monitor_format']){logger[_0xfdf1('0x35')](_0xfdf1('0x83'),'Recording\x20is\x20enabled!');_0x599d8c[_0xfdf1('0x84')]=_0x1acaa6[_0xfdf1('0x85')]+_0xfdf1('0x86')+_0x599d8c[_0xfdf1('0x87')]+_0xfdf1('0x88')+md5(_0x599d8c[_0xfdf1('0x87')]);}else{_0x599d8c['recordingURL']='';}var _0x53e27a=_0x1acaa6[_0xfdf1('0x81')]===_0xfdf1('0x89')?'eu':_0xfdf1('0x8a');return getAccessToken(_0x1acaa6)[_0xfdf1('0x31')](function(_0x55b529){_0x622b82=_0x55b529;return getUser(_0x622b82,_0x53e27a,_0x1acaa6,_0x1de430[_0xfdf1('0x34')]);})[_0xfdf1('0x31')](function(_0x5af5de){_0x4b9ad1=_0x5af5de;logger[_0xfdf1('0x35')](_0xfdf1('0x8b'),_0x4b9ad1['id']);return getEndUser(_0x622b82,_0x53e27a,_0x1acaa6,_0x599d8c['calleridname'],_0x599d8c[_0xfdf1('0x8c')],_0x4b9ad1,_0x4833bd);})[_0xfdf1('0x31')](function(_0x6e255d){_0x27cd50=_0x6e255d;return getCall(_0x622b82,_0x53e27a,_0x1acaa6,_0x4b9ad1,_0x27cd50,_0x4833bd,_0x599d8c,_0xfdf1('0x79'));})[_0xfdf1('0x31')](function(_0x1c16e8){if(_0x1c16e8){logger[_0xfdf1('0x35')](_0xfdf1('0x8d'),_0x1c16e8['id']);logger['info'](_0xfdf1('0x83'),_0xfdf1('0x8e'));emit(util[_0xfdf1('0x64')](_0xfdf1('0x8f'),_0x1de430['name']),_0xfdf1('0x90'),{'uri':'https://crm.'+_0x1acaa6[_0xfdf1('0x81')]+_0xfdf1('0x91')+_0x1c16e8['id']});}})['catch'](function(_0x288283){logger[_0xfdf1('0x3a')]('[QUEUE]',JSON[_0xfdf1('0xc')](_0x288283));});};exports[_0xfdf1('0x77')]=function(_0x3264c7,_0x594363,_0x47d2c9,_0x2b6733,_0x23abdf,_0x16e724,_0x59291b){var _0x3d7f74,_0x185a9e,_0x17cc4e;_0x16e724[_0xfdf1('0x81')]=intUtil[_0xfdf1('0x82')](_0x16e724['host']);_0x16e724['serverUrl']=intUtil[_0xfdf1('0x82')](_0x16e724['serverUrl']);if(_0x59291b&&_0x59291b[_0xfdf1('0x92')]&&_0x59291b[_0xfdf1('0x92')]!=='none'){logger[_0xfdf1('0x35')]('[OUTBOUND]',_0xfdf1('0x93'));_0x594363[_0xfdf1('0x84')]=_0x16e724[_0xfdf1('0x85')]+_0xfdf1('0x86')+_0x594363['uniqueid']+_0xfdf1('0x88')+md5(_0x594363[_0xfdf1('0x87')]);}var _0x7a64be=_0x16e724['host']===_0xfdf1('0x89')?'eu':_0xfdf1('0x8a');return getAccessToken(_0x16e724)[_0xfdf1('0x31')](function(_0x355c6d){_0x17cc4e=_0x355c6d;return getUser(_0x17cc4e,_0x7a64be,_0x16e724,_0x2b6733['email']);})['then'](function(_0x405283){_0x3d7f74=_0x405283;logger[_0xfdf1('0x35')]('The\x20User\x20ID\x20is:',_0x3d7f74['id']);return getEndUser(_0x17cc4e,_0x7a64be,_0x16e724,_0x594363[_0xfdf1('0x94')],_0x594363[_0xfdf1('0x95')],_0x3d7f74,_0x47d2c9);})['then'](function(_0x35ef39){_0x185a9e=_0x35ef39;return getCall(_0x17cc4e,_0x7a64be,_0x16e724,_0x3d7f74,_0x185a9e,_0x47d2c9,_0x594363,_0xfdf1('0x96'));})['then'](function(_0x66946e){if(_0x66946e){logger[_0xfdf1('0x35')](_0xfdf1('0x8d'),_0x66946e['id']);logger[_0xfdf1('0x35')](_0xfdf1('0x97'),_0xfdf1('0x8e'));emit(util[_0xfdf1('0x64')](_0xfdf1('0x8f'),_0x2b6733[_0xfdf1('0x17')]),_0xfdf1('0x90'),{'uri':'https://crm.'+_0x16e724[_0xfdf1('0x81')]+_0xfdf1('0x91')+_0x66946e['id']});}})['catch'](function(_0x2cbd9d){logger[_0xfdf1('0x3a')](_0xfdf1('0x97'),JSON[_0xfdf1('0xc')](_0x2cbd9d));});};exports['unmanaged']=function(_0x27bde8,_0x38d771,_0x3a6c6c,_0x5b9ad3,_0x3bdef6,_0x4f8fe9){var _0x2f72ba,_0x730a2f,_0x76a350;_0x4f8fe9[_0xfdf1('0x81')]=intUtil['stripTrailingSlash'](_0x4f8fe9[_0xfdf1('0x81')]);_0x4f8fe9[_0xfdf1('0x85')]=intUtil[_0xfdf1('0x82')](_0x4f8fe9[_0xfdf1('0x85')]);if(_0x3bdef6&&_0x3bdef6[_0xfdf1('0x98')]){logger['info']('['+_0x38d771[_0xfdf1('0x6c')][_0xfdf1('0x99')]()+']',_0xfdf1('0x93'));_0x38d771[_0xfdf1('0x84')]=_0x4f8fe9['serverUrl']+_0xfdf1('0x86')+_0x38d771[_0xfdf1('0x87')]+_0xfdf1('0x88')+md5(_0x38d771[_0xfdf1('0x87')]);}else{_0x38d771[_0xfdf1('0x84')]='';}var _0x18d1b7=_0x4f8fe9['host']===_0xfdf1('0x89')?'eu':_0xfdf1('0x8a');return getAccessToken(_0x4f8fe9)[_0xfdf1('0x31')](function(_0x256376){_0x76a350=_0x256376;return getUser(_0x76a350,_0x18d1b7,_0x4f8fe9);})[_0xfdf1('0x31')](function(_0x5d0375){_0x2f72ba=_0x5d0375;logger[_0xfdf1('0x35')](_0xfdf1('0x8b'),_0x2f72ba['id']);return getEndUser(_0x76a350,_0x18d1b7,_0x4f8fe9,_0x38d771[_0xfdf1('0x9a')],_0x38d771[_0xfdf1('0x8c')],_0x2f72ba,_0x3a6c6c);})['then'](function(_0x359bd8){_0x730a2f=_0x359bd8;return getCall(_0x76a350,_0x18d1b7,_0x4f8fe9,_0x2f72ba,_0x730a2f,_0x3a6c6c,_0x38d771,_0xfdf1('0x79'));})[_0xfdf1('0x31')](function(_0x1351c8){if(_0x1351c8){logger[_0xfdf1('0x35')](_0xfdf1('0x8d'),_0x1351c8['id']);}})[_0xfdf1('0x2a')](function(_0x4941a0){logger[_0xfdf1('0x3a')]('['+_0x38d771['lastevent'][_0xfdf1('0x99')]()+']',JSON['stringify'](_0x4941a0));});}; \ 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 14804de..d9cfa04 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 _0xc0df=['exec','data2','Script','data3','error','%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'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc0df,0x1a1));var _0xfc0d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc0df[_0x4b369d];return _0x571a98;};'use strict';var util=require('util');var sh=require(_0xfc0d('0x0'));var Mustache=require(_0xfc0d('0x1'));var logger=require(_0xfc0d('0x2'))('trigger');exports[_0xfc0d('0x3')]=function(_0x5ecd22,_0x23eaa4){var _0x252844=_0x5ecd22['data2']?_0x5ecd22[_0xfc0d('0x4')]:_0xfc0d('0x5');var _0x94c576=_0x5ecd22[_0xfc0d('0x6')]?Mustache['render'](_0x5ecd22[_0xfc0d('0x6')],_0x23eaa4):_0x23eaa4;sh['exec'](_0x94c576,function(_0x4204d2,_0x1bddf5,_0x5b7248){if(_0x4204d2!==0x0){logger[_0xfc0d('0x7')](util['format'](_0xfc0d('0x8'),_0x252844,_0x94c576,_0x4204d2,_0x5b7248));}else{logger[_0xfc0d('0x9')](util[_0xfc0d('0xa')](_0xfc0d('0xb'),_0x252844,_0x94c576,_0x1bddf5));}});}; \ No newline at end of file +var _0xf0a1=['data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger'];(function(_0x7c0646,_0x45d16b){var _0x32416d=function(_0x22abdd){while(--_0x22abdd){_0x7c0646['push'](_0x7c0646['shift']());}};_0x32416d(++_0x45d16b);}(_0xf0a1,0xe6));var _0x1f0a=function(_0x1f1c62,_0x859e8a){_0x1f1c62=_0x1f1c62-0x0;var _0x503f0a=_0xf0a1[_0x1f1c62];return _0x503f0a;};'use strict';var util=require(_0x1f0a('0x0'));var sh=require(_0x1f0a('0x1'));var Mustache=require(_0x1f0a('0x2'));var logger=require('../../../../config/logger')(_0x1f0a('0x3'));exports['exec']=function(_0x422774,_0x5d9eb9){var _0x4ad032=_0x422774[_0x1f0a('0x4')]?_0x422774[_0x1f0a('0x4')]:_0x1f0a('0x5');var _0x145955=_0x422774[_0x1f0a('0x6')]?Mustache[_0x1f0a('0x7')](_0x422774[_0x1f0a('0x6')],_0x5d9eb9):_0x5d9eb9;sh['exec'](_0x145955,function(_0x3e204d,_0x3931cb,_0x17605a){if(_0x3e204d!==0x0){logger[_0x1f0a('0x8')](util[_0x1f0a('0x9')](_0x1f0a('0xa'),_0x4ad032,_0x145955,_0x3e204d,_0x17605a));}else{logger[_0x1f0a('0xb')](util[_0x1f0a('0x9')](_0x1f0a('0xc'),_0x4ad032,_0x145955,_0x3931cb));}});}; \ 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 31bd569..716b8d7 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 _0xb386=['mustache','trigger','exec','data1','toUpperCase','render','data5','number','headers','parse','data6','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','data2','stringify','then','isNil',',\x20request\x20body:\x20','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','util','lodash'];(function(_0x118330,_0x507391){var _0x142964=function(_0x401e3c){while(--_0x401e3c){_0x118330['push'](_0x118330['shift']());}};_0x142964(++_0x507391);}(_0xb386,0x1ee));var _0x6b38=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xb386[_0x456fb1];return _0x4083d6;};'use strict';var rp=require('request-promise');var util=require(_0x6b38('0x0'));var _=require(_0x6b38('0x1'));var Mustache=require(_0x6b38('0x2'));var logger=require('../../../../config/logger')(_0x6b38('0x3'));exports[_0x6b38('0x4')]=function(_0x43d33f,_0x2bea62){var _0x26381c,_0x5bf94e;var _0xd6e4c6={'method':_0x43d33f[_0x6b38('0x5')][_0x6b38('0x6')](),'uri':Mustache[_0x6b38('0x7')](_0x43d33f['data2'],_0x2bea62),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x43d33f[_0x6b38('0x8')])===_0x6b38('0x9')&&parseInt(_0x43d33f['data5'])>=0x1&&parseInt(_0x43d33f[_0x6b38('0x8')])<=0xa?parseInt(_0x43d33f['data5'])*0x3e8:0x5*0x3e8};try{_0xd6e4c6[_0x6b38('0xa')]=_0x43d33f['data6']?JSON[_0x6b38('0xb')](Mustache['render'](_0x43d33f[_0x6b38('0xc')],_0x2bea62)):{};}catch(_0x5c95ef){logger['error'](_0x5c95ef[_0x6b38('0xd')]);}switch(_0x43d33f[_0x6b38('0x5')][_0x6b38('0x6')]()){case _0x6b38('0xe'):case _0x6b38('0xf'):_0x26381c=null;_0xd6e4c6['qs']=_0x2bea62;break;case _0x6b38('0x10'):case _0x6b38('0x11'):if(_0x43d33f[_0x6b38('0x12')]){try{_0x26381c=JSON[_0x6b38('0xb')](Mustache[_0x6b38('0x7')](_0x43d33f[_0x6b38('0x12')],_0x2bea62));_0xd6e4c6[_0x6b38('0x13')]=_0x26381c;}catch(_0x4113f3){logger[_0x6b38('0x14')](_0x4113f3['stack']);logger[_0x6b38('0x14')](_0x6b38('0x15'));}}else{_0x26381c=_0x2bea62;_0xd6e4c6['body']=_0x26381c;}break;}logger[_0x6b38('0x16')](util[_0x6b38('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x43d33f[_0x6b38('0x5')],_0x43d33f[_0x6b38('0x18')],JSON[_0x6b38('0x19')](_0xd6e4c6)));rp(_0xd6e4c6)[_0x6b38('0x1a')](function(_0x320094){_0x26381c=!_[_0x6b38('0x1b')](_0x26381c)?_0x6b38('0x1c')+_0x26381c:'';_0x5bf94e=typeof _0x320094[_0x6b38('0x13')]==='object'?JSON[_0x6b38('0x19')](_0x320094[_0x6b38('0x13')]):_0x320094['body'];logger[_0x6b38('0x16')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x43d33f[_0x6b38('0x5')],_0x43d33f['data2'],_0x320094[_0x6b38('0x1d')],_0x5bf94e));})['catch'](function(_0x2f1d4d){logger[_0x6b38('0x14')](util[_0x6b38('0x17')](_0x6b38('0x1e'),_0x43d33f[_0x6b38('0x5')],_0x43d33f[_0x6b38('0x18')],_0x2f1d4d['statusCode'],_0x2f1d4d['name'],_0x2f1d4d['message']));});}; \ No newline at end of file +var _0x0729=['info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','message','request-promise','util','lodash','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','stack','GET','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format'];(function(_0x5572b7,_0x244036){var _0x1bc232=function(_0x338cc0){while(--_0x338cc0){_0x5572b7['push'](_0x5572b7['shift']());}};_0x1bc232(++_0x244036);}(_0x0729,0xc5));var _0x9072=function(_0x3db058,_0x59ea56){_0x3db058=_0x3db058-0x0;var _0x46a261=_0x0729[_0x3db058];return _0x46a261;};'use strict';var rp=require(_0x9072('0x0'));var util=require(_0x9072('0x1'));var _=require(_0x9072('0x2'));var Mustache=require('mustache');var logger=require(_0x9072('0x3'))(_0x9072('0x4'));exports[_0x9072('0x5')]=function(_0x48554d,_0x45c8c4){var _0x4f164e,_0x823b26;var _0x1f7222={'method':_0x48554d[_0x9072('0x6')][_0x9072('0x7')](),'uri':Mustache[_0x9072('0x8')](_0x48554d[_0x9072('0x9')],_0x45c8c4),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x48554d[_0x9072('0xa')])===_0x9072('0xb')&&parseInt(_0x48554d['data5'])>=0x1&&parseInt(_0x48554d['data5'])<=0xa?parseInt(_0x48554d[_0x9072('0xa')])*0x3e8:0x5*0x3e8};try{_0x1f7222[_0x9072('0xc')]=_0x48554d[_0x9072('0xd')]?JSON['parse'](Mustache[_0x9072('0x8')](_0x48554d[_0x9072('0xd')],_0x45c8c4)):{};}catch(_0x272b76){logger['error'](_0x272b76[_0x9072('0xe')]);}switch(_0x48554d[_0x9072('0x6')][_0x9072('0x7')]()){case _0x9072('0xf'):case'DELETE':_0x4f164e=null;_0x1f7222['qs']=_0x45c8c4;break;case'POST':case'PUT':if(_0x48554d[_0x9072('0x10')]){try{_0x4f164e=JSON['parse'](Mustache[_0x9072('0x8')](_0x48554d[_0x9072('0x10')],_0x45c8c4));_0x1f7222[_0x9072('0x11')]=_0x4f164e;}catch(_0x25457a){logger[_0x9072('0x12')](_0x25457a[_0x9072('0xe')]);logger['error'](_0x9072('0x13'));}}else{_0x4f164e=_0x45c8c4;_0x1f7222[_0x9072('0x11')]=_0x4f164e;}break;}logger[_0x9072('0x14')](util[_0x9072('0x15')](_0x9072('0x16'),_0x48554d['data1'],_0x48554d[_0x9072('0x9')],JSON['stringify'](_0x1f7222)));rp(_0x1f7222)[_0x9072('0x17')](function(_0x54323b){_0x4f164e=!_['isNil'](_0x4f164e)?_0x9072('0x18')+_0x4f164e:'';_0x823b26=typeof _0x54323b[_0x9072('0x11')]===_0x9072('0x19')?JSON[_0x9072('0x1a')](_0x54323b['body']):_0x54323b[_0x9072('0x11')];logger[_0x9072('0x14')](util[_0x9072('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x48554d[_0x9072('0x6')],_0x48554d[_0x9072('0x9')],_0x54323b['statusCode'],_0x823b26));})[_0x9072('0x1b')](function(_0x58281a){logger['error'](util['format'](_0x9072('0x1c'),_0x48554d[_0x9072('0x6')],_0x48554d['data2'],_0x58281a[_0x9072('0x1d')],_0x58281a['name'],_0x58281a[_0x9072('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b082706..c9996a9 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 _0x3cfa=['client','http','Request','debug','error','rpc','message','catch','exports','jayson/promise','bluebird','routing'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x3cfa,0x129));var _0xa3cf=function(_0x599347,_0x35a224){_0x599347=_0x599347-0x0;var _0x524fe9=_0x3cfa[_0x599347];return _0x524fe9;};'use strict';var jayson=require(_0xa3cf('0x0'));var BPromise=require(_0xa3cf('0x1'));var logger=require('../../config/logger')(_0xa3cf('0x2'));var client=jayson[_0xa3cf('0x3')][_0xa3cf('0x4')]({'port':0x2329});client[_0xa3cf('0x5')]=function(_0x52e0c2,_0x5d965c){return new BPromise(function(_0x87c188,_0x189212){return client['request'](_0x52e0c2,_0x5d965c)['then'](function(_0x1fc5a5){logger[_0xa3cf('0x6')]('rpc',_0xa3cf('0x2'),_0x52e0c2,_0x5d965c,_0x1fc5a5);if(_0x1fc5a5['error']){logger[_0xa3cf('0x7')](_0xa3cf('0x8'),'routing',_0x52e0c2,_0x1fc5a5['error'][_0xa3cf('0x9')],_0x5d965c);return _0x189212(_0x1fc5a5[_0xa3cf('0x7')][_0xa3cf('0x9')]);}else{return _0x87c188(_0x1fc5a5['result']);}})[_0xa3cf('0xa')](function(_0x4e6f72){logger[_0xa3cf('0x7')](_0xa3cf('0x8'),'routing',_0x52e0c2,_0x4e6f72,_0x5d965c);return _0x189212(_0x4e6f72);});});};module[_0xa3cf('0xb')]=client; \ No newline at end of file +var _0x83b8=['message','result','catch','rpc','exports','jayson/promise','bluebird','../../config/logger','routing','client','Request','request','then','debug','error'];(function(_0x3f156d,_0x3e82f4){var _0xec96ed=function(_0x456d63){while(--_0x456d63){_0x3f156d['push'](_0x3f156d['shift']());}};_0xec96ed(++_0x3e82f4);}(_0x83b8,0xaa));var _0x883b=function(_0x589671,_0x5090e8){_0x589671=_0x589671-0x0;var _0x4ba4b8=_0x83b8[_0x589671];return _0x4ba4b8;};'use strict';var jayson=require(_0x883b('0x0'));var BPromise=require(_0x883b('0x1'));var logger=require(_0x883b('0x2'))(_0x883b('0x3'));var client=jayson[_0x883b('0x4')]['http']({'port':0x2329});client[_0x883b('0x5')]=function(_0x573f8f,_0x516f70){return new BPromise(function(_0x565bfb,_0x356638){return client[_0x883b('0x6')](_0x573f8f,_0x516f70)[_0x883b('0x7')](function(_0x1d5287){logger[_0x883b('0x8')]('rpc',_0x883b('0x3'),_0x573f8f,_0x516f70,_0x1d5287);if(_0x1d5287['error']){logger[_0x883b('0x9')]('rpc',_0x883b('0x3'),_0x573f8f,_0x1d5287['error'][_0x883b('0xa')],_0x516f70);return _0x356638(_0x1d5287[_0x883b('0x9')]['message']);}else{return _0x565bfb(_0x1d5287[_0x883b('0xb')]);}})[_0x883b('0xc')](function(_0x4c0add){logger[_0x883b('0x9')](_0x883b('0xd'),'routing',_0x573f8f,_0x4c0add,_0x516f70);return _0x356638(_0x4c0add);});});};module[_0x883b('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 0d762e7..cbb8050 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 _0x354e=['./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','error'];(function(_0x145d11,_0x2ec40c){var _0x14f6b8=function(_0x34eee3){while(--_0x34eee3){_0x145d11['push'](_0x145d11['shift']());}};_0x14f6b8(++_0x2ec40c);}(_0x354e,0x1b0));var _0xe354=function(_0x2e1528,_0x40a103){_0x2e1528=_0x2e1528-0x0;var _0x594446=_0x354e[_0x2e1528];return _0x594446;};'use strict';var server=require(_0xe354('0x0'));var Realtime=require(_0xe354('0x1'));var EmailChannel=require(_0xe354('0x2'));var mailAccount=require(_0xe354('0x3'));var setting=require(_0xe354('0x4'));var logger=require(_0xe354('0x5'))(_0xe354('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe354('0x7')]()[_0xe354('0x8')](mailAccount['getMailAccounts']())['then'](realtime[_0xe354('0x9')]())[_0xe354('0x8')](function(){email[_0xe354('0xa')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xe354('0xb')](realtime,email)[_0xe354('0x8')](function(){return initRealtime();})[_0xe354('0x8')](function(){return setting[_0xe354('0xc')]();})[_0xe354('0x8')](function(_0xf33275){return setInterval(initRealtime,_0xf33275[_0xe354('0xd')]*0x3e8);})[_0xe354('0xe')](function(_0x4cd198){logger[_0xe354('0xf')]('Email\x20service\x20initialization',_0x4cd198);});}main(); \ No newline at end of file +var _0xe6d8=['getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./lib/email','../../config/logger','resolve','getMailAccounts','then','refresh','mailAccounts','listen'];(function(_0x2292d7,_0x587c17){var _0x6f9c5a=function(_0x568d34){while(--_0x568d34){_0x2292d7['push'](_0x2292d7['shift']());}};_0x6f9c5a(++_0x587c17);}(_0xe6d8,0x1a9));var _0x8e6d=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0xe6d8[_0x58da8a];return _0x5294b9;};'use strict';var server=require(_0x8e6d('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x8e6d('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0x8e6d('0x2'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x8e6d('0x3')]()['then'](mailAccount[_0x8e6d('0x4')]())['then'](realtime['initMailAccounts']())[_0x8e6d('0x5')](function(){email[_0x8e6d('0x6')](realtime[_0x8e6d('0x7')]);return realtime;});}function main(){return server[_0x8e6d('0x8')](realtime,email)['then'](function(){return initRealtime();})[_0x8e6d('0x5')](function(){return setting[_0x8e6d('0x9')]();})[_0x8e6d('0x5')](function(_0x131311){return setInterval(initRealtime,_0x131311[_0x8e6d('0xa')]*0x3e8);})[_0x8e6d('0xb')](function(_0x1ead72){logger[_0x8e6d('0xc')](_0x8e6d('0xd'),_0x1ead72);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c445856..2903dd9 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 _0xc2be=['total','isNil','stringify','mailAccount:update','prototype','hasOwnProperty','active','service','custom','provider','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','messageStatus','status','messages','firstName','lastName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','emit','name','Imap'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2be,0xd8));var _0xec2b=function(_0x15c068,_0x441624){_0x15c068=_0x15c068-0x0;var _0x369daf=_0xc2be[_0x15c068];return _0x369daf;};'use strict';var _=require(_0xec2b('0x0'));var moment=require(_0xec2b('0x1'));var BPromise=require(_0xec2b('0x2'));var md5=require(_0xec2b('0x3'));var Redis=require(_0xec2b('0x4'));var config=require(_0xec2b('0x5'));var logger=require(_0xec2b('0x6'))('email');config['redis']=_[_0xec2b('0x7')](config[_0xec2b('0x8')],{'host':_0xec2b('0x9'),'port':0x18eb});var io=require(_0xec2b('0xa'))(new Redis(config[_0xec2b('0x8')]));var EmailImap=require(_0xec2b('0xb'));var EmailSmtp=require(_0xec2b('0xc'));var mailAccount=require(_0xec2b('0xd'));var md5Accounts={};function EmailChannel(_0x3c5a77){logger['info']('start\x20email\x20channel');this[_0xec2b('0xe')]=_0x3c5a77[_0xec2b('0xe')];this[_0xec2b('0xf')]={};this[_0xec2b('0x10')]=new EmailSmtp();}EmailChannel['prototype'][_0xec2b('0x11')]=function(_0x87f81c){var _0x23cdea=this[_0xec2b('0xe')][_0x87f81c];var _0x718aa2={'id':_0x23cdea['id'],'name':_0x23cdea[_0xec2b('0x12')],'key':_0x23cdea['key'],'active':_0x23cdea['active'],'Imap':{'status':_0x23cdea['Imap']['status'],'messageStatus':_0x23cdea['Imap']['messageStatus'],'total':_0x23cdea[_0xec2b('0x13')][_0xec2b('0x14')]}};if(_[_0xec2b('0x15')](md5Accounts[_0x87f81c])){md5Accounts[_0x87f81c]={};}var _0x5495e0=md5(JSON[_0xec2b('0x16')](_0x718aa2));if(md5Accounts[_0x87f81c][_0xec2b('0x3')]!==_0x5495e0){md5Accounts[_0x87f81c][_0xec2b('0x3')]=_0x5495e0;io['emit'](_0xec2b('0x17'),_0x718aa2);}};EmailChannel[_0xec2b('0x18')]['refresh']=function(_0x544121){for(var _0x14c098 in _0x544121){if(_0x544121[_0xec2b('0x19')](_0x14c098)){if(_0x544121[_0x14c098]['Imap']&&_0x544121[_0x14c098][_0xec2b('0x1a')]){var _0x3057ee=_0x544121[_0x14c098][_0xec2b('0x13')];if(!_0x3057ee[_0xec2b('0x1b')]&&_0x544121[_0x14c098]['provider']!==_0xec2b('0x1c'))_0x3057ee[_0xec2b('0x1b')]=_0x544121[_0x14c098][_0xec2b('0x1d')];if(!this[_0xec2b('0xf')][_0xec2b('0x19')](_0x3057ee['id'])){this['imapAccounts'][_0x3057ee['id']]=new EmailImap(_0x3057ee,_0x544121[_0x14c098][_0xec2b('0x1e')]);this[_0xec2b('0xf')][_0x3057ee['id']]['on'](_0xec2b('0x1f'),this[_0xec2b('0x20')][_0xec2b('0x21')](this,_0x14c098));this[_0xec2b('0xf')][_0x3057ee['id']]['on'](_0xec2b('0x1e'),this[_0xec2b('0x22')]['bind'](this,_0x14c098));this[_0xec2b('0xf')][_0x3057ee['id']]['on'](_0xec2b('0x23'),this[_0xec2b('0x24')][_0xec2b('0x21')](this,_0x14c098));this['imapAccounts'][_0x3057ee['id']]['on'](_0xec2b('0x25'),this[_0xec2b('0x26')][_0xec2b('0x21')](this,_0x14c098));}}else{if(_['isNil'](this[_0xec2b('0xe')][_0x14c098]['Imap'])){this[_0xec2b('0xe')][_0x14c098][_0xec2b('0x13')]={};}this['mailAccounts'][_0x14c098][_0xec2b('0x13')]['status']=_0xec2b('0x27');this[_0xec2b('0xe')][_0x14c098][_0xec2b('0x13')][_0xec2b('0x28')]='';this[_0xec2b('0x11')](_0x14c098);}}}};EmailChannel[_0xec2b('0x18')][_0xec2b('0x20')]=function(_0xd51cb9,_0x21d9de){if(this[_0xec2b('0xe')][_0xd51cb9]){this[_0xec2b('0xe')][_0xd51cb9]['Imap'][_0xec2b('0x29')]='connected';this[_0xec2b('0xe')][_0xd51cb9][_0xec2b('0x13')][_0xec2b('0x28')]=_0x21d9de[_0xec2b('0x12')];if(_0x21d9de[_0xec2b('0x2a')]){this[_0xec2b('0xe')][_0xd51cb9][_0xec2b('0x13')][_0xec2b('0x14')]=_0x21d9de[_0xec2b('0x2a')][_0xec2b('0x14')];}return this[_0xec2b('0x11')](_0xd51cb9);}};EmailChannel[_0xec2b('0x18')]['handleImapEmail']=function(_0x81d6fb,_0x3e9376){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3e9376[_0xec2b('0x2b')],_0x3e9376[_0xec2b('0x2c')],_0x3e9376[_0xec2b('0x2d')],_0x81d6fb);if(this[_0xec2b('0xe')][_0x81d6fb]){return mailAccount[_0xec2b('0x2e')](_0x81d6fb,_0x3e9376)[_0xec2b('0x2f')](function(_0x26ee77){if(_0x26ee77){logger[_0xec2b('0x30')](_0xec2b('0x31'));}})[_0xec2b('0x32')](function(_0x5a88d7){logger[_0xec2b('0x25')](_0xec2b('0x33'),JSON['stringify'](_0x5a88d7));});}};EmailChannel[_0xec2b('0x18')]['handleImapEnd']=function(_0x2655c7){if(this['mailAccounts'][_0x2655c7]&&this[_0xec2b('0xe')][_0x2655c7][_0xec2b('0x13')]){if(this[_0xec2b('0xf')][this[_0xec2b('0xe')][_0x2655c7][_0xec2b('0x13')]['id']]){delete this[_0xec2b('0xf')][this['mailAccounts'][_0x2655c7][_0xec2b('0x13')]['id']];}this[_0xec2b('0xe')][_0x2655c7][_0xec2b('0x13')]['lastSync']=moment();this[_0xec2b('0x11')](_0x2655c7);}};EmailChannel[_0xec2b('0x18')]['handleImapError']=function(_0x3033bc,_0xafb83c){if(this[_0xec2b('0xe')][_0x3033bc]){this['mailAccounts'][_0x3033bc]['Imap'][_0xec2b('0x29')]=_0xec2b('0x25');this[_0xec2b('0xe')][_0x3033bc]['Imap'][_0xec2b('0x28')]=_0xafb83c;return this[_0xec2b('0x11')](_0x3033bc);}};EmailChannel[_0xec2b('0x18')][_0xec2b('0x34')]=function(_0x1ab178,_0x2820ff){return this[_0xec2b('0x10')][_0xec2b('0x35')](_0x1ab178,_0x2820ff);};EmailChannel['prototype'][_0xec2b('0x36')]=function(_0x5c661b){var _0x4b9fc1=this;if(this[_0xec2b('0xe')][_0x5c661b['id']]){if(_[_0xec2b('0x15')](this[_0xec2b('0xe')][_0x5c661b['id']][_0xec2b('0x37')])){this[_0xec2b('0xe')][_0x5c661b['id']][_0xec2b('0x37')]={};}this[_0xec2b('0xe')][_0x5c661b['id']][_0xec2b('0x37')][_0xec2b('0x38')]=moment();return new BPromise(function(_0x58367a,_0x73fabd){return _0x4b9fc1[_0xec2b('0x10')][_0xec2b('0x39')](_0x5c661b)[_0xec2b('0x2f')](function(_0x41a28c){_0x4b9fc1[_0xec2b('0xe')][_0x5c661b['id']]['Smtp']['status']='verified';_0x4b9fc1[_0xec2b('0xe')][_0x5c661b['id']]['Smtp']['messageStatus']='';_0x4b9fc1[_0xec2b('0x11')](_0x5c661b['id']);_0x58367a(_0x41a28c);})[_0xec2b('0x32')](function(_0x38405d){_0x4b9fc1[_0xec2b('0xe')][_0x5c661b['id']]['Smtp'][_0xec2b('0x29')]='error';_0x4b9fc1['mailAccounts'][_0x5c661b['id']][_0xec2b('0x37')][_0xec2b('0x28')]=_0x38405d;_0x4b9fc1[_0xec2b('0x11')](_0x5c661b['id']);_0x73fabd(_0x38405d);});});}return this[_0xec2b('0x10')][_0xec2b('0x39')](_0x5c661b);};module[_0xec2b('0x3a')]=EmailChannel; \ No newline at end of file +var _0x522a=['disabled','messageStatus','prototype','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','send','verifySmtp','then','Smtp','verified','verify','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','emit','name','key','Imap','status','total','isNil','stringify','refresh','hasOwnProperty','active','service','provider','handleImapEmail','end','bind','error','handleImapError'];(function(_0x3c71ef,_0x395521){var _0x56c788=function(_0x43a116){while(--_0x43a116){_0x3c71ef['push'](_0x3c71ef['shift']());}};_0x56c788(++_0x395521);}(_0x522a,0x1ac));var _0xa522=function(_0x53fc13,_0x5e225d){_0x53fc13=_0x53fc13-0x0;var _0x5e5a5e=_0x522a[_0x53fc13];return _0x5e5a5e;};'use strict';var _=require(_0xa522('0x0'));var moment=require(_0xa522('0x1'));var BPromise=require(_0xa522('0x2'));var md5=require(_0xa522('0x3'));var Redis=require(_0xa522('0x4'));var config=require(_0xa522('0x5'));var logger=require(_0xa522('0x6'))(_0xa522('0x7'));config[_0xa522('0x8')]=_[_0xa522('0x9')](config['redis'],{'host':_0xa522('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xa522('0xb'));var EmailSmtp=require(_0xa522('0xc'));var mailAccount=require(_0xa522('0xd'));var md5Accounts={};function EmailChannel(_0x4565ba){logger[_0xa522('0xe')]('start\x20email\x20channel');this[_0xa522('0xf')]=_0x4565ba[_0xa522('0xf')];this[_0xa522('0x10')]={};this[_0xa522('0x11')]=new EmailSmtp();}EmailChannel['prototype'][_0xa522('0x12')]=function(_0x29bbb2){var _0x3a81ca=this[_0xa522('0xf')][_0x29bbb2];var _0x406630={'id':_0x3a81ca['id'],'name':_0x3a81ca[_0xa522('0x13')],'key':_0x3a81ca[_0xa522('0x14')],'active':_0x3a81ca['active'],'Imap':{'status':_0x3a81ca[_0xa522('0x15')][_0xa522('0x16')],'messageStatus':_0x3a81ca[_0xa522('0x15')]['messageStatus'],'total':_0x3a81ca[_0xa522('0x15')][_0xa522('0x17')]}};if(_[_0xa522('0x18')](md5Accounts[_0x29bbb2])){md5Accounts[_0x29bbb2]={};}var _0x545307=md5(JSON[_0xa522('0x19')](_0x406630));if(md5Accounts[_0x29bbb2][_0xa522('0x3')]!==_0x545307){md5Accounts[_0x29bbb2]['md5']=_0x545307;io[_0xa522('0x12')]('mailAccount:update',_0x406630);}};EmailChannel['prototype'][_0xa522('0x1a')]=function(_0x125c71){for(var _0x55038d in _0x125c71){if(_0x125c71[_0xa522('0x1b')](_0x55038d)){if(_0x125c71[_0x55038d][_0xa522('0x15')]&&_0x125c71[_0x55038d][_0xa522('0x1c')]){var _0x5d252b=_0x125c71[_0x55038d][_0xa522('0x15')];if(!_0x5d252b[_0xa522('0x1d')]&&_0x125c71[_0x55038d][_0xa522('0x1e')]!=='custom')_0x5d252b[_0xa522('0x1d')]=_0x125c71[_0x55038d][_0xa522('0x1e')];if(!this[_0xa522('0x10')][_0xa522('0x1b')](_0x5d252b['id'])){this[_0xa522('0x10')][_0x5d252b['id']]=new EmailImap(_0x5d252b,_0x125c71[_0x55038d]['email']);this[_0xa522('0x10')][_0x5d252b['id']]['on']('box',this['handleImapBox']['bind'](this,_0x55038d));this[_0xa522('0x10')][_0x5d252b['id']]['on'](_0xa522('0x7'),this[_0xa522('0x1f')]['bind'](this,_0x55038d));this[_0xa522('0x10')][_0x5d252b['id']]['on'](_0xa522('0x20'),this['handleImapEnd'][_0xa522('0x21')](this,_0x55038d));this[_0xa522('0x10')][_0x5d252b['id']]['on'](_0xa522('0x22'),this[_0xa522('0x23')]['bind'](this,_0x55038d));}}else{if(_[_0xa522('0x18')](this[_0xa522('0xf')][_0x55038d][_0xa522('0x15')])){this[_0xa522('0xf')][_0x55038d][_0xa522('0x15')]={};}this[_0xa522('0xf')][_0x55038d]['Imap']['status']=_0xa522('0x24');this[_0xa522('0xf')][_0x55038d][_0xa522('0x15')][_0xa522('0x25')]='';this['emit'](_0x55038d);}}}};EmailChannel[_0xa522('0x26')][_0xa522('0x27')]=function(_0x6ad310,_0x4e298a){if(this[_0xa522('0xf')][_0x6ad310]){this[_0xa522('0xf')][_0x6ad310][_0xa522('0x15')][_0xa522('0x16')]=_0xa522('0x28');this['mailAccounts'][_0x6ad310][_0xa522('0x15')][_0xa522('0x25')]=_0x4e298a[_0xa522('0x13')];if(_0x4e298a['messages']){this[_0xa522('0xf')][_0x6ad310]['Imap']['total']=_0x4e298a[_0xa522('0x29')][_0xa522('0x17')];}return this[_0xa522('0x12')](_0x6ad310);}};EmailChannel['prototype'][_0xa522('0x1f')]=function(_0x2b5dfc,_0x1a83e6){logger[_0xa522('0xe')](_0xa522('0x2a'),_0x1a83e6[_0xa522('0x2b')],_0x1a83e6[_0xa522('0x2c')],_0x1a83e6[_0xa522('0x2d')],_0x2b5dfc);if(this[_0xa522('0xf')][_0x2b5dfc]){return mailAccount[_0xa522('0x2e')](_0x2b5dfc,_0x1a83e6)['then'](function(_0x62879){if(_0x62879){logger[_0xa522('0xe')](_0xa522('0x2f'));}})[_0xa522('0x30')](function(_0x1c1711){logger['error'](_0xa522('0x31'),JSON[_0xa522('0x19')](_0x1c1711));});}};EmailChannel['prototype'][_0xa522('0x32')]=function(_0x211e18){if(this[_0xa522('0xf')][_0x211e18]&&this[_0xa522('0xf')][_0x211e18][_0xa522('0x15')]){if(this[_0xa522('0x10')][this[_0xa522('0xf')][_0x211e18]['Imap']['id']]){delete this[_0xa522('0x10')][this[_0xa522('0xf')][_0x211e18][_0xa522('0x15')]['id']];}this[_0xa522('0xf')][_0x211e18][_0xa522('0x15')][_0xa522('0x33')]=moment();this[_0xa522('0x12')](_0x211e18);}};EmailChannel['prototype']['handleImapError']=function(_0x3643bf,_0x36a5a9){if(this['mailAccounts'][_0x3643bf]){this[_0xa522('0xf')][_0x3643bf][_0xa522('0x15')][_0xa522('0x16')]='error';this['mailAccounts'][_0x3643bf][_0xa522('0x15')][_0xa522('0x25')]=_0x36a5a9;return this[_0xa522('0x12')](_0x3643bf);}};EmailChannel[_0xa522('0x26')]['sendMail']=function(_0x1e3e9b,_0x502fda){return this['smtp'][_0xa522('0x34')](_0x1e3e9b,_0x502fda);};EmailChannel[_0xa522('0x26')][_0xa522('0x35')]=function(_0x4c8705){var _0x289d9b=this;if(this[_0xa522('0xf')][_0x4c8705['id']]){if(_['isNil'](this[_0xa522('0xf')][_0x4c8705['id']]['Smtp'])){this[_0xa522('0xf')][_0x4c8705['id']]['Smtp']={};}this[_0xa522('0xf')][_0x4c8705['id']]['Smtp'][_0xa522('0x33')]=moment();return new BPromise(function(_0x15b74c,_0x5e7122){return _0x289d9b[_0xa522('0x11')]['verify'](_0x4c8705)[_0xa522('0x36')](function(_0xfffba1){_0x289d9b[_0xa522('0xf')][_0x4c8705['id']][_0xa522('0x37')][_0xa522('0x16')]=_0xa522('0x38');_0x289d9b[_0xa522('0xf')][_0x4c8705['id']][_0xa522('0x37')]['messageStatus']='';_0x289d9b[_0xa522('0x12')](_0x4c8705['id']);_0x15b74c(_0xfffba1);})[_0xa522('0x30')](function(_0x3f01aa){_0x289d9b[_0xa522('0xf')][_0x4c8705['id']]['Smtp']['status']='error';_0x289d9b[_0xa522('0xf')][_0x4c8705['id']][_0xa522('0x37')]['messageStatus']=_0x3f01aa;_0x289d9b[_0xa522('0x12')](_0x4c8705['id']);_0x5e7122(_0x3f01aa);});});}return this[_0xa522('0x11')][_0xa522('0x39')](_0x4c8705);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 38e50bd..542c79b 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 _0x4cf2=['handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','stringify','textCode','upperFirst','lodash','util','imap','mailparser','Iconv','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','handleOpenBox','emit','box','search','UNSEEN','handleReadUnseen','length','fetch'];(function(_0x41e870,_0x521db1){var _0x1b4096=function(_0x24f189){while(--_0x24f189){_0x41e870['push'](_0x41e870['shift']());}};_0x1b4096(++_0x521db1);}(_0x4cf2,0xae));var _0x24cf=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x4cf2[_0x38537f];return _0x141e23;};'use strict';var _=require(_0x24cf('0x0'));var util=require(_0x24cf('0x1'));var Imap=require(_0x24cf('0x2'));var simpleParser=require(_0x24cf('0x3'))['simpleParser'];var Iconv=require('iconv')[_0x24cf('0x4')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x24cf('0x5'));var logger=require(_0x24cf('0x6'))(_0x24cf('0x7'));function EmailImap(_0x46c82b,_0x54250f){this[_0x24cf('0x8')]=_0x46c82b[_0x24cf('0x8')];this[_0x24cf('0x9')]=this[_0x24cf('0xa')](_0x46c82b,_0x54250f);this[_0x24cf('0x2')]=new Imap(this['account']);this[_0x24cf('0x2')][_0x24cf('0xb')](_0x24cf('0xc'),this[_0x24cf('0xd')][_0x24cf('0xe')](this));this[_0x24cf('0x2')][_0x24cf('0xb')](_0x24cf('0xf'),this[_0x24cf('0x10')][_0x24cf('0xe')](this));this['imap']['on'](_0x24cf('0x11'),this[_0x24cf('0x12')]['bind'](this));this[_0x24cf('0x2')][_0x24cf('0x13')]();}util[_0x24cf('0x14')](EmailImap,EventEmitter);EmailImap[_0x24cf('0x15')][_0x24cf('0xa')]=function(_0x38bc7a,_0x4d7c13){var _0x1d2709={'connTimeout':_0x38bc7a[_0x24cf('0x16')]?_0x38bc7a[_0x24cf('0x16')]*0x3e8:0x2710,'authTimeout':_0x38bc7a[_0x24cf('0x17')]?_0x38bc7a[_0x24cf('0x17')]*0x3e8:0x1388};if(_0x38bc7a['service']){_0x1d2709[_0x24cf('0x18')]=_0x38bc7a['user'];if(_0x38bc7a[_0x24cf('0x19')]){_0x1d2709['xoauth2']=utils['generateXOAuth2Token'](_0x38bc7a[_0x24cf('0x1a')][_0x24cf('0x1b')],_0x38bc7a[_0x24cf('0x18')]);}else{_0x1d2709[_0x24cf('0x1c')]=_0x38bc7a[_0x24cf('0x1c')];}}else{if(_0x38bc7a[_0x24cf('0x1d')]){_0x1d2709[_0x24cf('0x18')]=_0x38bc7a[_0x24cf('0x18')];_0x1d2709[_0x24cf('0x1c')]=_0x38bc7a[_0x24cf('0x1c')];}}_0x1d2709['email']=_0x4d7c13||_0x38bc7a[_0x24cf('0x18')]||_0x24cf('0x1e');_0x1d2709[_0x24cf('0x1f')]=_0x38bc7a[_0x24cf('0x1f')];_0x1d2709[_0x24cf('0x20')]=_0x38bc7a[_0x24cf('0x20')]||0x3e1;if(_0x38bc7a[_0x24cf('0x21')]){_0x1d2709[_0x24cf('0x21')]=!![];}else{_0x1d2709[_0x24cf('0x21')]=![];_0x1d2709['autotls']='required';}return _0x1d2709;};EmailImap[_0x24cf('0x15')][_0x24cf('0xd')]=function(){this[_0x24cf('0x2')]['openBox'](this['mailbox'],![],this[_0x24cf('0x22')][_0x24cf('0xe')](this));};EmailImap[_0x24cf('0x15')][_0x24cf('0x22')]=function(_0x2af6a9,_0x4b8449){if(_0x2af6a9){this[_0x24cf('0x12')](_0x2af6a9,!![]);}else{this[_0x24cf('0x23')](_0x24cf('0x24'),_0x4b8449);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x569a74){if(_0x569a74){this['handleError'](_0x569a74,!![]);}else{this[_0x24cf('0x2')]['end']();}};EmailImap[_0x24cf('0x15')]['readUnseen']=function(){this[_0x24cf('0x2')][_0x24cf('0x25')]([_0x24cf('0x26')],this[_0x24cf('0x27')][_0x24cf('0xe')](this));};EmailImap[_0x24cf('0x15')][_0x24cf('0x27')]=function(_0x20edb2,_0x4cceb6){if(_0x20edb2){this[_0x24cf('0x12')](_0x20edb2,!![]);}else{if(_0x4cceb6[_0x24cf('0x28')]){try{var _0x1fb44a=this[_0x24cf('0x2')][_0x24cf('0x29')](_0x4cceb6,{'bodies':'','markSeen':!![]});_0x1fb44a['on']('message',this[_0x24cf('0x2a')][_0x24cf('0xe')](this));_0x1fb44a[_0x24cf('0xb')](_0x24cf('0x11'),this[_0x24cf('0x2b')][_0x24cf('0xe')](this));_0x1fb44a['once'](_0x24cf('0xf'),this[_0x24cf('0x2c')][_0x24cf('0xe')](this));}catch(_0x299a36){logger['error'](_0x299a36);}}else{this[_0x24cf('0x2')][_0x24cf('0x2d')](!![],this[_0x24cf('0x2e')][_0x24cf('0xe')](this));}}};EmailImap['prototype'][_0x24cf('0x2a')]=function(_0x33a7e8){_0x33a7e8['on']('body',this[_0x24cf('0x2f')][_0x24cf('0xe')](this));_0x33a7e8[_0x24cf('0xb')](_0x24cf('0x30'),this[_0x24cf('0x31')]['bind'](this));_0x33a7e8[_0x24cf('0xb')](_0x24cf('0xf'),this[_0x24cf('0x32')][_0x24cf('0xe')](this));};EmailImap[_0x24cf('0x15')][_0x24cf('0x2f')]=function(_0x505422){simpleParser(_0x505422,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x24cf('0x15')][_0x24cf('0x31')]=function(){};EmailImap[_0x24cf('0x15')][_0x24cf('0x32')]=function(){};EmailImap[_0x24cf('0x15')]['handleSimpleParser']=function(_0x5871fa,_0x4fbb5d){if(_0x5871fa){logger[_0x24cf('0x11')](_0x5871fa);}else{var _0x137227=this;utils['parser'](this['account'],_0x4fbb5d,function(_0x4350ca){_0x137227[_0x24cf('0x23')](_0x24cf('0x7'),_0x4350ca);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap'][_0x24cf('0x2d')](!![],this['handleCloseBox'][_0x24cf('0xe')](this));};EmailImap['prototype'][_0x24cf('0x2b')]=function(_0x27f6be){this[_0x24cf('0x12')](_0x27f6be);this[_0x24cf('0x2')][_0x24cf('0x2d')](!![],this[_0x24cf('0x2e')]['bind'](this));};EmailImap[_0x24cf('0x15')][_0x24cf('0x10')]=function(){this[_0x24cf('0x23')](_0x24cf('0xf'));};EmailImap[_0x24cf('0x15')][_0x24cf('0x12')]=function(_0x38b5fd,_0x27c3b8){logger['error'](_0x24cf('0x12'),this[_0x24cf('0x9')][_0x24cf('0x7')],JSON[_0x24cf('0x33')](_0x38b5fd));var _0x6e0097='';if(_0x38b5fd){if(_0x38b5fd[_0x24cf('0x34')]){_0x6e0097=_0x38b5fd[_0x24cf('0x34')];}else{for(var _0x124622 in _0x38b5fd){if(_0x38b5fd['hasOwnProperty'](_0x124622)){_0x6e0097+=_[_0x24cf('0x35')](_0x124622)+':\x20'+_0x38b5fd[_0x124622]+'\x0a';}}}}if(_0x27c3b8){this[_0x24cf('0x2')][_0x24cf('0xf')]();}else{this[_0x24cf('0x23')](_0x24cf('0x11'),_0x6e0097);this[_0x24cf('0x23')](_0x24cf('0xf'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x3d7c=['port','tls','autotls','required','openBox','handleOpenBox','handleError','emit','box','end','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','once','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','handleFetchEnd','handleCloseBox','stringify','textCode','hasOwnProperty','upperFirst','lodash','imap','mailparser','simpleParser','iconv','Iconv','events','email','mailbox','getAccount','account','ready','handleReady','bind','handleEnd','error','connect','prototype','authTimeout','service','user','modernAuthentication','xoauth2','CloudProvider','password','authentication','anonymous@xcally.com','host'];(function(_0x974da,_0x5e7e0a){var _0x55af62=function(_0x5b743d){while(--_0x5b743d){_0x974da['push'](_0x974da['shift']());}};_0x55af62(++_0x5e7e0a);}(_0x3d7c,0x181));var _0xc3d7=function(_0x43ff4b,_0x27b7ec){_0x43ff4b=_0x43ff4b-0x0;var _0x1c17dc=_0x3d7c[_0x43ff4b];return _0x1c17dc;};'use strict';var _=require(_0xc3d7('0x0'));var util=require('util');var Imap=require(_0xc3d7('0x1'));var simpleParser=require(_0xc3d7('0x2'))[_0xc3d7('0x3')];var Iconv=require(_0xc3d7('0x4'))[_0xc3d7('0x5')];var EventEmitter=require(_0xc3d7('0x6'))['EventEmitter'];var utils=require('./utils');var logger=require('../../../config/logger')(_0xc3d7('0x7'));function EmailImap(_0x1f241a,_0x482765){this['mailbox']=_0x1f241a[_0xc3d7('0x8')];this['account']=this[_0xc3d7('0x9')](_0x1f241a,_0x482765);this[_0xc3d7('0x1')]=new Imap(this[_0xc3d7('0xa')]);this['imap']['once'](_0xc3d7('0xb'),this[_0xc3d7('0xc')][_0xc3d7('0xd')](this));this[_0xc3d7('0x1')]['once']('end',this[_0xc3d7('0xe')][_0xc3d7('0xd')](this));this[_0xc3d7('0x1')]['on'](_0xc3d7('0xf'),this['handleError'][_0xc3d7('0xd')](this));this['imap'][_0xc3d7('0x10')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xc3d7('0x11')]['getAccount']=function(_0x3a6521,_0x291b4c){var _0x536909={'connTimeout':_0x3a6521['connTimeout']?_0x3a6521['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3a6521[_0xc3d7('0x12')]?_0x3a6521[_0xc3d7('0x12')]*0x3e8:0x1388};if(_0x3a6521[_0xc3d7('0x13')]){_0x536909[_0xc3d7('0x14')]=_0x3a6521[_0xc3d7('0x14')];if(_0x3a6521[_0xc3d7('0x15')]){_0x536909[_0xc3d7('0x16')]=utils['generateXOAuth2Token'](_0x3a6521[_0xc3d7('0x17')]['data5'],_0x3a6521['user']);}else{_0x536909['password']=_0x3a6521[_0xc3d7('0x18')];}}else{if(_0x3a6521[_0xc3d7('0x19')]){_0x536909[_0xc3d7('0x14')]=_0x3a6521[_0xc3d7('0x14')];_0x536909[_0xc3d7('0x18')]=_0x3a6521[_0xc3d7('0x18')];}}_0x536909['email']=_0x291b4c||_0x3a6521[_0xc3d7('0x14')]||_0xc3d7('0x1a');_0x536909[_0xc3d7('0x1b')]=_0x3a6521[_0xc3d7('0x1b')];_0x536909['port']=_0x3a6521[_0xc3d7('0x1c')]||0x3e1;if(_0x3a6521[_0xc3d7('0x1d')]){_0x536909[_0xc3d7('0x1d')]=!![];}else{_0x536909[_0xc3d7('0x1d')]=![];_0x536909[_0xc3d7('0x1e')]=_0xc3d7('0x1f');}return _0x536909;};EmailImap['prototype'][_0xc3d7('0xc')]=function(){this[_0xc3d7('0x1')][_0xc3d7('0x20')](this[_0xc3d7('0x8')],![],this[_0xc3d7('0x21')][_0xc3d7('0xd')](this));};EmailImap[_0xc3d7('0x11')][_0xc3d7('0x21')]=function(_0x383d82,_0x429a84){if(_0x383d82){this[_0xc3d7('0x22')](_0x383d82,!![]);}else{this[_0xc3d7('0x23')](_0xc3d7('0x24'),_0x429a84);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x4a3343){if(_0x4a3343){this[_0xc3d7('0x22')](_0x4a3343,!![]);}else{this[_0xc3d7('0x1')][_0xc3d7('0x25')]();}};EmailImap[_0xc3d7('0x11')]['readUnseen']=function(){this[_0xc3d7('0x1')]['search']([_0xc3d7('0x26')],this[_0xc3d7('0x27')][_0xc3d7('0xd')](this));};EmailImap[_0xc3d7('0x11')]['handleReadUnseen']=function(_0x24f96e,_0x55f297){if(_0x24f96e){this[_0xc3d7('0x22')](_0x24f96e,!![]);}else{if(_0x55f297[_0xc3d7('0x28')]){try{var _0x57d395=this[_0xc3d7('0x1')][_0xc3d7('0x29')](_0x55f297,{'bodies':'','markSeen':!![]});_0x57d395['on'](_0xc3d7('0x2a'),this[_0xc3d7('0x2b')]['bind'](this));_0x57d395[_0xc3d7('0x2c')](_0xc3d7('0xf'),this[_0xc3d7('0x2d')][_0xc3d7('0xd')](this));_0x57d395[_0xc3d7('0x2c')](_0xc3d7('0x25'),this['handleFetchEnd'][_0xc3d7('0xd')](this));}catch(_0x38e20f){logger['error'](_0x38e20f);}}else{this[_0xc3d7('0x1')][_0xc3d7('0x2e')](!![],this['handleCloseBox'][_0xc3d7('0xd')](this));}}};EmailImap[_0xc3d7('0x11')][_0xc3d7('0x2b')]=function(_0xbc4a0d){_0xbc4a0d['on'](_0xc3d7('0x2f'),this[_0xc3d7('0x30')]['bind'](this));_0xbc4a0d['once'](_0xc3d7('0x31'),this['handleMessageAttributes'][_0xc3d7('0xd')](this));_0xbc4a0d['once'](_0xc3d7('0x25'),this[_0xc3d7('0x32')][_0xc3d7('0xd')](this));};EmailImap[_0xc3d7('0x11')][_0xc3d7('0x30')]=function(_0x19462e){simpleParser(_0x19462e,{'Iconv':Iconv},this[_0xc3d7('0x33')][_0xc3d7('0xd')](this));};EmailImap['prototype'][_0xc3d7('0x34')]=function(){};EmailImap[_0xc3d7('0x11')][_0xc3d7('0x32')]=function(){};EmailImap[_0xc3d7('0x11')][_0xc3d7('0x33')]=function(_0x3f6fec,_0x31d8c4){if(_0x3f6fec){logger[_0xc3d7('0xf')](_0x3f6fec);}else{var _0x563384=this;utils['parser'](this[_0xc3d7('0xa')],_0x31d8c4,function(_0x11dcc7){_0x563384[_0xc3d7('0x23')](_0xc3d7('0x7'),_0x11dcc7);});}};EmailImap[_0xc3d7('0x11')][_0xc3d7('0x35')]=function(){this['imap'][_0xc3d7('0x2e')](!![],this[_0xc3d7('0x36')]['bind'](this));};EmailImap[_0xc3d7('0x11')][_0xc3d7('0x2d')]=function(_0x193a1d){this['handleError'](_0x193a1d);this[_0xc3d7('0x1')][_0xc3d7('0x2e')](!![],this[_0xc3d7('0x36')][_0xc3d7('0xd')](this));};EmailImap[_0xc3d7('0x11')][_0xc3d7('0xe')]=function(){this[_0xc3d7('0x23')](_0xc3d7('0x25'));};EmailImap[_0xc3d7('0x11')][_0xc3d7('0x22')]=function(_0x57a6fd,_0x378950){logger[_0xc3d7('0xf')](_0xc3d7('0x22'),this[_0xc3d7('0xa')]['email'],JSON[_0xc3d7('0x37')](_0x57a6fd));var _0x276ed2='';if(_0x57a6fd){if(_0x57a6fd['textCode']){_0x276ed2=_0x57a6fd[_0xc3d7('0x38')];}else{for(var _0x42fde7 in _0x57a6fd){if(_0x57a6fd[_0xc3d7('0x39')](_0x42fde7)){_0x276ed2+=_[_0xc3d7('0x3a')](_0x42fde7)+':\x20'+_0x57a6fd[_0x42fde7]+'\x0a';}}}}if(_0x378950){this[_0xc3d7('0x1')][_0xc3d7('0x25')]();}else{this[_0xc3d7('0x23')](_0xc3d7('0xf'),_0x276ed2);this[_0xc3d7('0x23')](_0xc3d7('0x25'));}};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 42d1c42..ac007dc 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 _0xf7e5=['nodemailer-plugin-inline-base64','send','createTransport','toString','prototype','verify','Not\x20verifired','exports'];(function(_0x2a162e,_0x2ab800){var _0x47b0e0=function(_0xd6f211){while(--_0xd6f211){_0x2a162e['push'](_0x2a162e['shift']());}};_0x47b0e0(++_0x2ab800);}(_0xf7e5,0xd8));var _0x5f7e=function(_0x2bf1df,_0x280bc1){_0x2bf1df=_0x2bf1df-0x0;var _0x507f7d=_0xf7e5[_0x2bf1df];return _0x507f7d;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x5f7e('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0x5f7e('0x1')]=function(_0x2d91b2,_0x2a7fad){return new Promise(function(_0x4061ea,_0x87ce17){var _0x43dc57=nodemailer[_0x5f7e('0x2')](_0x2d91b2);_0x43dc57['use']('compile',inlineBase64());_0x43dc57['sendMail'](_0x2a7fad,function(_0x2ce6bc,_0x422ce4){if(_0x2ce6bc){_0x87ce17(_0x2ce6bc[_0x5f7e('0x3')]());}else{_0x4061ea(_0x422ce4);}});});};EmailSmtp[_0x5f7e('0x4')][_0x5f7e('0x5')]=function(_0x117ba8){return new Promise(function(_0x3bf61e,_0x4043d0){var _0x45bd2f=nodemailer[_0x5f7e('0x2')](_0x117ba8);_0x45bd2f[_0x5f7e('0x5')](function(_0x5e8fc1,_0x6262ac){if(_0x5e8fc1){_0x4043d0(_0x5e8fc1[_0x5f7e('0x3')]());}else{if(_0x6262ac){_0x3bf61e(_0x6262ac);}else{_0x4043d0(_0x5f7e('0x6'));}}});});};module[_0x5f7e('0x7')]=EmailSmtp; \ No newline at end of file +var _0x69f3=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','compile','sendMail','toString','verify','Not\x20verifired'];(function(_0x5a59e9,_0x2da104){var _0x1242f4=function(_0x5b1f00){while(--_0x5b1f00){_0x5a59e9['push'](_0x5a59e9['shift']());}};_0x1242f4(++_0x2da104);}(_0x69f3,0x119));var _0x369f=function(_0x23073a,_0x3144ae){_0x23073a=_0x23073a-0x0;var _0x672fdd=_0x69f3[_0x23073a];return _0x672fdd;};'use strict';var nodemailer=require(_0x369f('0x0'));var inlineBase64=require(_0x369f('0x1'));function EmailSmtp(){}EmailSmtp[_0x369f('0x2')]['send']=function(_0x87d232,_0x358c78){return new Promise(function(_0x541e30,_0x4f4353){var _0x2769fa=nodemailer[_0x369f('0x3')](_0x87d232);_0x2769fa['use'](_0x369f('0x4'),inlineBase64());_0x2769fa[_0x369f('0x5')](_0x358c78,function(_0x9d7965,_0x4ac8d3){if(_0x9d7965){_0x4f4353(_0x9d7965[_0x369f('0x6')]());}else{_0x541e30(_0x4ac8d3);}});});};EmailSmtp['prototype']['verify']=function(_0x1e590f){return new Promise(function(_0x1bfc7a,_0x4289b2){var _0x508800=nodemailer[_0x369f('0x3')](_0x1e590f);_0x508800[_0x369f('0x7')](function(_0x39278d,_0x4c089f){if(_0x39278d){_0x4289b2(_0x39278d[_0x369f('0x6')]());}else{if(_0x4c089f){_0x1bfc7a(_0x4c089f);}else{_0x4289b2(_0x369f('0x8'));}}});});};module[_0x369f('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 730de29..33c05fb 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 _0xfe28=['\x20[Attachment:\x20','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','@xcally.com','head','name','substring','indexOf','split','length','Anonymous','pop','isEmpty','html','test','includes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfe28,0xfc));var _0x8fe2=function(_0x3c0a03,_0xbcecb1){_0x3c0a03=_0x3c0a03-0x0;var _0x5c4469=_0xfe28[_0x3c0a03];return _0x5c4469;};'use strict';var _=require(_0x8fe2('0x0'));var moment=require(_0x8fe2('0x1'));var random=require(_0x8fe2('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x8fe2('0x3'));var tnef=require(_0x8fe2('0x4'));var logger=require(_0x8fe2('0x5'))(_0x8fe2('0x6'));var config=require(_0x8fe2('0x7'));function getAddress(_0x173fca){var _0x5de7fd=_['head'](_0x173fca[_0x8fe2('0x8')]);return _0x5de7fd&&_0x5de7fd[_0x8fe2('0x9')]?_0x5de7fd[_0x8fe2('0x9')]:_0x8fe2('0xa')+random['generate'](0x6)+_0x8fe2('0xb');}function getFirstName(_0x3945fa){var _0x411741=_[_0x8fe2('0xc')](_0x3945fa[_0x8fe2('0x8')]);if(_0x411741&&_0x411741[_0x8fe2('0xd')]){if(_0x411741['name']==_0x411741[_0x8fe2('0x9')]){return _0x411741[_0x8fe2('0xd')][_0x8fe2('0xe')](0x0,_0x411741['name'][_0x8fe2('0xf')]('@'));}var _0x5bbca1=_0x411741[_0x8fe2('0xd')][_0x8fe2('0x10')](/\s+/);return _0x5bbca1[_0x8fe2('0x11')]>0x1?_0x5bbca1['slice'](0x0,-0x1)['join']('\x20'):_0x411741[_0x8fe2('0xd')];}return _0x8fe2('0x12');}function getLastName(_0x4a5958){var _0x1255db=_[_0x8fe2('0xc')](_0x4a5958[_0x8fe2('0x8')]);if(_0x1255db&&_0x1255db[_0x8fe2('0xd')]){var _0x45b4f7=_0x1255db[_0x8fe2('0xd')][_0x8fe2('0x10')](/\s+/);return _0x45b4f7['length']>0x1?_0x45b4f7[_0x8fe2('0x13')]():'';}return'';}function getMails(_0x788988,_0x4edb4d){var _0x2edc7a='';for(var _0x49cb9c=0x0;_0x49cb9c<_0x4edb4d[_0x8fe2('0x8')][_0x8fe2('0x11')];_0x49cb9c+=0x1){if(_0x4edb4d['value'][_0x49cb9c][_0x8fe2('0x9')]!==_0x788988){if(!_[_0x8fe2('0x14')](_0x2edc7a)){_0x2edc7a+=',';}_0x2edc7a+=_0x4edb4d[_0x8fe2('0x8')][_0x49cb9c]['name']||_0x4edb4d['value'][_0x49cb9c]['address']||'';_0x2edc7a+='\x20<';_0x2edc7a+=_0x4edb4d['value'][_0x49cb9c]['address']?_0x4edb4d[_0x8fe2('0x8')][_0x49cb9c][_0x8fe2('0x9')]:_0x8fe2('0xa')+random['generate'](0x6)+'@xcally.com';_0x2edc7a+='>';}}return _0x2edc7a;}function parseEmail(_0x12ef40,_0x798d98,_0x32224c){if(_0x798d98[_0x8fe2('0x15')]){var _0x2beb27=/)<[^<]*)*<\/script>/gi;while(_0x2beb27[_0x8fe2('0x16')](_0x798d98[_0x8fe2('0x15')])){_0x798d98[_0x8fe2('0x15')]=_0x798d98[_0x8fe2('0x15')]['replace'](_0x2beb27,'');}if(_0x798d98[_0x8fe2('0x15')][_0x8fe2('0x17')](_0x8fe2('0x18'))){var _0x2cee24=[];_0x798d98[_0x8fe2('0x19')]['forEach'](_0x28435c=>{_0x2cee24[_0x8fe2('0x1a')](_0x28435c['filename']);});var _0xbe593e=/]+>/g;var _0x5dbb46=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x421599=_0x798d98[_0x8fe2('0x15')][_0x8fe2('0x1b')](_0x5dbb46,'_SRC');var _0x65e43b=_0x421599[_0x8fe2('0x1b')](_0xbe593e,_0x8fe2('0x1c'));for(let _0x263fc4=0x0;_0x263fc4<_0x2cee24[_0x8fe2('0x11')];_0x263fc4++){var _0x1fbe93=_0x65e43b[_0x8fe2('0x1b')]('_IMG',_0x8fe2('0x1d')+_0x2cee24[_0x263fc4]+'\x20]');_0x65e43b=_0x1fbe93;}_0x798d98[_0x8fe2('0x15')]=_0x65e43b;}_0x32224c[_0x8fe2('0x1e')]=_0x798d98[_0x8fe2('0x15')];}else{_0x32224c[_0x8fe2('0x1e')]=_0x798d98['textAsHtml'];}if(_0x32224c[_0x8fe2('0x1e')]){_0x32224c[_0x8fe2('0x1e')]=_0x32224c[_0x8fe2('0x1e')]['replace'](/0x0){var _0x5173f9=[_0x8fe2('0x2c'),_0x8fe2('0x2d'),_0x8fe2('0x2e')];for(var _0x32b1d2=0x0;_0x32b1d2<_0x798d98[_0x8fe2('0x2f')][_0x8fe2('0x11')];_0x32b1d2++){var _0x5df24f=_['indexOf'](_0x5173f9,_0x798d98[_0x8fe2('0x2f')][_0x32b1d2][_0x8fe2('0x30')]);if(_0x5df24f>=0x0){_0x32224c['isAutoreply']=!![];}}}return _0x32224c;}exports['parser']=function(_0x2c8414,_0x5d64e6,_0x4e27e5){var _0x17bbbe={'from':getAddress(_0x5d64e6[_0x8fe2('0x31')]),'firstName':getFirstName(_0x5d64e6['from']),'lastName':getLastName(_0x5d64e6[_0x8fe2('0x31')]),'mapKey':_0x8fe2('0x6'),'message':{'from':getMails(_0x2c8414['email'],_0x5d64e6['from']),'to':_0x2c8414[_0x8fe2('0x6')],'cc':'','subject':_0x5d64e6[_0x8fe2('0x32')]||'','messageId':_0x5d64e6[_0x8fe2('0x33')],'inReplyTo':_0x5d64e6[_0x8fe2('0x34')],'sentAt':moment(_0x5d64e6['date'])['format'](_0x8fe2('0x35')),'attach':![],'attachments':[]}};if(!_0x5d64e6[_0x8fe2('0x15')]&&!_0x5d64e6[_0x8fe2('0x36')]){var _0x5289dc=_['filter'](_0x5d64e6[_0x8fe2('0x19')],{'contentType':'application/ms-tnef'});if(_0x5289dc[_0x8fe2('0x11')]){logger[_0x8fe2('0x37')](util[_0x8fe2('0x38')](_0x8fe2('0x39'),_0x5d64e6[_0x8fe2('0x33')]));tnef[_0x8fe2('0x3a')](_['first'](_0x5289dc)[_0x8fe2('0x2a')],function(_0x236168,_0x5212c1){if(_0x5212c1){_0x5d64e6[_0x8fe2('0x15')]=_0x5212c1['BodyHTML']||_0x8fe2('0x3b');if(_0x5212c1[_0x8fe2('0x3c')]){for(var _0x184664=0x0;_0x184664<_0x5212c1[_0x8fe2('0x3c')][_0x8fe2('0x11')];_0x184664++){var _0x4a3de0=_0x5212c1[_0x8fe2('0x3c')][_0x184664];_0x17bbbe[_0x8fe2('0x20')][_0x8fe2('0x19')]['push']({'filename':_0x4a3de0[_0x8fe2('0x3d')],'content':Buffer['from'](_0x4a3de0[_0x8fe2('0x3e')])});}}}_0x4e27e5(parseEmail(_0x2c8414,_0x5d64e6,_0x17bbbe));});}else{_0x5d64e6[_0x8fe2('0x15')]=_0x8fe2('0x3b');_0x4e27e5(parseEmail(_0x2c8414,_0x5d64e6,_0x17bbbe));}}else{_0x4e27e5(parseEmail(_0x2c8414,_0x5d64e6,_0x17bbbe));}};exports[_0x8fe2('0x3f')]=function(_0x40763f,_0x2a5ae7){var _0x41dba2=[_0x8fe2('0x40')+(_0x2a5ae7||''),_0x8fe2('0x41')+_0x40763f,'',''];return Buffer[_0x8fe2('0x31')](_0x41dba2[_0x8fe2('0x27')](''),_0x8fe2('0x42'))[_0x8fe2('0x43')](_0x8fe2('0x44'));}; \ No newline at end of file +var _0xe444=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','info','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','util','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','slice','join','Anonymous','isEmpty','test','html','includes','\x20[Attachment:\x20','body','message','originTo','originCc','bcc','attach','type','attachment','format','%s-%s','now','root','server/files/attachments/','writeFileSync','headerLines'];(function(_0x44e114,_0x352753){var _0x1e5012=function(_0x3a59b8){while(--_0x3a59b8){_0x44e114['push'](_0x44e114['shift']());}};_0x1e5012(++_0x352753);}(_0xe444,0x12f));var _0x4e44=function(_0x3a588d,_0x3fa5ab){_0x3a588d=_0x3a588d-0x0;var _0x222952=_0xe444[_0x3a588d];return _0x222952;};'use strict';var _=require(_0x4e44('0x0'));var moment=require(_0x4e44('0x1'));var random=require(_0x4e44('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x4e44('0x3'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0x4e44('0x4'));var config=require(_0x4e44('0x5'));function getAddress(_0x14e8d5){var _0x2a64cd=_[_0x4e44('0x6')](_0x14e8d5[_0x4e44('0x7')]);return _0x2a64cd&&_0x2a64cd[_0x4e44('0x8')]?_0x2a64cd['address']:_0x4e44('0x9')+random[_0x4e44('0xa')](0x6)+_0x4e44('0xb');}function getFirstName(_0x159bc3){var _0x1ba535=_[_0x4e44('0x6')](_0x159bc3[_0x4e44('0x7')]);if(_0x1ba535&&_0x1ba535[_0x4e44('0xc')]){if(_0x1ba535['name']==_0x1ba535[_0x4e44('0x8')]){return _0x1ba535[_0x4e44('0xc')][_0x4e44('0xd')](0x0,_0x1ba535[_0x4e44('0xc')][_0x4e44('0xe')]('@'));}var _0x22168d=_0x1ba535[_0x4e44('0xc')]['split'](/\s+/);return _0x22168d[_0x4e44('0xf')]>0x1?_0x22168d[_0x4e44('0x10')](0x0,-0x1)[_0x4e44('0x11')]('\x20'):_0x1ba535[_0x4e44('0xc')];}return _0x4e44('0x12');}function getLastName(_0xca2498){var _0x23e0b6=_['head'](_0xca2498[_0x4e44('0x7')]);if(_0x23e0b6&&_0x23e0b6['name']){var _0x4c3671=_0x23e0b6['name']['split'](/\s+/);return _0x4c3671[_0x4e44('0xf')]>0x1?_0x4c3671['pop']():'';}return'';}function getMails(_0x5db737,_0x41559a){var _0x2c9458='';for(var _0x1e4f22=0x0;_0x1e4f22<_0x41559a[_0x4e44('0x7')][_0x4e44('0xf')];_0x1e4f22+=0x1){if(_0x41559a[_0x4e44('0x7')][_0x1e4f22][_0x4e44('0x8')]!==_0x5db737){if(!_[_0x4e44('0x13')](_0x2c9458)){_0x2c9458+=',';}_0x2c9458+=_0x41559a['value'][_0x1e4f22][_0x4e44('0xc')]||_0x41559a[_0x4e44('0x7')][_0x1e4f22][_0x4e44('0x8')]||'';_0x2c9458+='\x20<';_0x2c9458+=_0x41559a[_0x4e44('0x7')][_0x1e4f22]['address']?_0x41559a[_0x4e44('0x7')][_0x1e4f22]['address']:_0x4e44('0x9')+random[_0x4e44('0xa')](0x6)+_0x4e44('0xb');_0x2c9458+='>';}}return _0x2c9458;}function parseEmail(_0x35bc47,_0x4a3e89,_0xc39e14){if(_0x4a3e89['html']){var _0x4f711c=/)<[^<]*)*<\/script>/gi;while(_0x4f711c[_0x4e44('0x14')](_0x4a3e89['html'])){_0x4a3e89['html']=_0x4a3e89[_0x4e44('0x15')]['replace'](_0x4f711c,'');}if(_0x4a3e89[_0x4e44('0x15')][_0x4e44('0x16')](_0x4e44('0x17'))){var _0x418038=[];_0x4a3e89[_0x4e44('0x18')][_0x4e44('0x19')](_0x592c51=>{_0x418038[_0x4e44('0x1a')](_0x592c51[_0x4e44('0x1b')]);});var _0x1325bb=/]+>/g;var _0x3da1a6=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4125f9=_0x4a3e89[_0x4e44('0x15')][_0x4e44('0x1c')](_0x3da1a6,_0x4e44('0x1d'));var _0x1455d6=_0x4125f9['replace'](_0x1325bb,_0x4e44('0x1e'));for(let _0x342200=0x0;_0x342200<_0x418038[_0x4e44('0xf')];_0x342200++){var _0x36bc97=_0x1455d6[_0x4e44('0x1c')](_0x4e44('0x1e'),_0x4e44('0x1f')+_0x418038[_0x342200]+'\x20]');_0x1455d6=_0x36bc97;}_0x4a3e89[_0x4e44('0x15')]=_0x1455d6;}_0xc39e14[_0x4e44('0x20')]=_0x4a3e89[_0x4e44('0x15')];}else{_0xc39e14[_0x4e44('0x20')]=_0x4a3e89['textAsHtml'];}if(_0xc39e14[_0x4e44('0x20')]){_0xc39e14[_0x4e44('0x20')]=_0xc39e14[_0x4e44('0x20')][_0x4e44('0x1c')](/0x0){var _0x216c00=[_0x4e44('0x2f'),_0x4e44('0x30'),'Precedence:\x20auto_reply'];for(var _0x2e2548=0x0;_0x2e2548<_0x4a3e89[_0x4e44('0x2e')]['length'];_0x2e2548++){var _0xcfe957=_[_0x4e44('0xe')](_0x216c00,_0x4a3e89[_0x4e44('0x2e')][_0x2e2548][_0x4e44('0x31')]);if(_0xcfe957>=0x0){_0xc39e14['isAutoreply']=!![];}}}return _0xc39e14;}exports[_0x4e44('0x32')]=function(_0x1b916b,_0x42be79,_0x3d0e75){var _0x4ec389={'from':getAddress(_0x42be79[_0x4e44('0x33')]),'firstName':getFirstName(_0x42be79[_0x4e44('0x33')]),'lastName':getLastName(_0x42be79[_0x4e44('0x33')]),'mapKey':_0x4e44('0x4'),'message':{'from':getMails(_0x1b916b[_0x4e44('0x4')],_0x42be79['from']),'to':_0x1b916b[_0x4e44('0x4')],'cc':'','subject':_0x42be79[_0x4e44('0x34')]||'','messageId':_0x42be79[_0x4e44('0x35')],'inReplyTo':_0x42be79[_0x4e44('0x36')],'sentAt':moment(_0x42be79[_0x4e44('0x37')])[_0x4e44('0x28')](_0x4e44('0x38')),'attach':![],'attachments':[]}};if(!_0x42be79[_0x4e44('0x15')]&&!_0x42be79[_0x4e44('0x39')]){var _0x347917=_[_0x4e44('0x3a')](_0x42be79[_0x4e44('0x18')],{'contentType':'application/ms-tnef'});if(_0x347917[_0x4e44('0xf')]){logger[_0x4e44('0x3b')](util[_0x4e44('0x28')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x42be79[_0x4e44('0x35')]));tnef['parseBuffer'](_['first'](_0x347917)[_0x4e44('0x3c')],function(_0x1ed701,_0x51b7b3){if(_0x51b7b3){_0x42be79[_0x4e44('0x15')]=_0x51b7b3[_0x4e44('0x3d')]||_0x4e44('0x3e');if(_0x51b7b3[_0x4e44('0x3f')]){for(var _0x3411bd=0x0;_0x3411bd<_0x51b7b3[_0x4e44('0x3f')][_0x4e44('0xf')];_0x3411bd++){var _0x35d9c3=_0x51b7b3[_0x4e44('0x3f')][_0x3411bd];_0x4ec389[_0x4e44('0x21')]['attachments'][_0x4e44('0x1a')]({'filename':_0x35d9c3[_0x4e44('0x40')],'content':Buffer[_0x4e44('0x33')](_0x35d9c3[_0x4e44('0x41')])});}}}_0x3d0e75(parseEmail(_0x1b916b,_0x42be79,_0x4ec389));});}else{_0x42be79[_0x4e44('0x15')]=_0x4e44('0x3e');_0x3d0e75(parseEmail(_0x1b916b,_0x42be79,_0x4ec389));}}else{_0x3d0e75(parseEmail(_0x1b916b,_0x42be79,_0x4ec389));}};exports['generateXOAuth2Token']=function(_0x590776,_0x587681){var _0x469669=[_0x4e44('0x42')+(_0x587681||''),_0x4e44('0x43')+_0x590776,'',''];return Buffer[_0x4e44('0x33')](_0x469669[_0x4e44('0x11')](''),_0x4e44('0x44'))[_0x4e44('0x45')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 037bad4..6a103e9 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 _0x10fa=['Smtp','exports','lodash','name','Service','key','SERV','active'];(function(_0x117821,_0xaa1933){var _0x4ae9ff=function(_0x253662){while(--_0x253662){_0x117821['push'](_0x117821['shift']());}};_0x4ae9ff(++_0xaa1933);}(_0x10fa,0x1f2));var _0xa10f=function(_0x7c472c,_0x1596d4){_0x7c472c=_0x7c472c-0x0;var _0x1f8fb2=_0x10fa[_0x7c472c];return _0x1f8fb2;};'use strict';var _=require(_0xa10f('0x0'));function MailAccount(_0x41975b){this['id']=_0x41975b['id']||0x0;this[_0xa10f('0x1')]=_0x41975b[_0xa10f('0x1')]||_0xa10f('0x2');this[_0xa10f('0x3')]=_0x41975b[_0xa10f('0x3')]||_0xa10f('0x4');this[_0xa10f('0x5')]=_0x41975b[_0xa10f('0x5')]||![];this['Imap']=_0x41975b['Imap']||[];this[_0xa10f('0x6')]=_0x41975b[_0xa10f('0x6')]||[];}module[_0xa10f('0x7')]=MailAccount; \ No newline at end of file +var _0xacf6=['Imap','Smtp','lodash','name','Service','key','SERV','active'];(function(_0x5b84bc,_0x34322c){var _0xe28125=function(_0x261ad4){while(--_0x261ad4){_0x5b84bc['push'](_0x5b84bc['shift']());}};_0xe28125(++_0x34322c);}(_0xacf6,0x1e2));var _0x6acf=function(_0x37f2ef,_0x4d7385){_0x37f2ef=_0x37f2ef-0x0;var _0x5bd19c=_0xacf6[_0x37f2ef];return _0x5bd19c;};'use strict';var _=require(_0x6acf('0x0'));function MailAccount(_0x41d490){this['id']=_0x41d490['id']||0x0;this[_0x6acf('0x1')]=_0x41d490[_0x6acf('0x1')]||_0x6acf('0x2');this[_0x6acf('0x3')]=_0x41d490[_0x6acf('0x3')]||_0x6acf('0x4');this[_0x6acf('0x5')]=_0x41d490['active']||![];this[_0x6acf('0x6')]=_0x41d490[_0x6acf('0x6')]||[];this[_0x6acf('0x7')]=_0x41d490[_0x6acf('0x7')]||[];}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 60869e2..8cb4c1b 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 _0x4fcb=['hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','mailAccounts'];(function(_0x95efe,_0x396e41){var _0x39cbea=function(_0x43a6d8){while(--_0x43a6d8){_0x95efe['push'](_0x95efe['shift']());}};_0x39cbea(++_0x396e41);}(_0x4fcb,0x17a));var _0xb4fc=function(_0xf7eaf9,_0x3d383d){_0xf7eaf9=_0xf7eaf9-0x0;var _0x8e5c1b=_0x4fcb[_0xf7eaf9];return _0x8e5c1b;};'use strict';var _=require(_0xb4fc('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xb4fc('0x1')]={};};function freeIsNotKey(_0x99417,_0x591fc4,_0x5e5265){var _0x3c6f8d=_['mapKeys'](_0x99417,function(_0x1ea925,_0x9be2b1){return _0x1ea925[_0x5e5265];});for(var _0x19306c in _0x591fc4){if(_0x591fc4[_0xb4fc('0x2')](_0x19306c)){if(!_0x3c6f8d[_0x19306c]){delete _0x591fc4[_0x19306c];}}}}Realtime['prototype'][_0xb4fc('0x3')]=function(_0x5d296c,_0x559d5b){for(var _0x12b61b in _0x559d5b){if(_0x5d296c[_0xb4fc('0x2')](_0x12b61b)){_0x5d296c[_0x12b61b]=_0x559d5b[_0x12b61b];}}};Realtime[_0xb4fc('0x4')][_0xb4fc('0x5')]=function(){var _0x80400c=this;return function(_0x16fd2d){if(_0x16fd2d){freeIsNotKey(_0x16fd2d,_0x80400c[_0xb4fc('0x1')],'id');for(var _0x21d322=0x0,_0xbe9e7={},_0x2dca80={};_0x21d322<_0x16fd2d[_0xb4fc('0x6')];_0x21d322+=0x1){_0xbe9e7=_0x16fd2d[_0x21d322];if(_[_0xb4fc('0x7')](_0x80400c[_0xb4fc('0x1')][_0xbe9e7['id']])){_0x80400c['mailAccounts'][_0xbe9e7['id']]=new MailAccount(_0xbe9e7);}else{_[_0xb4fc('0x8')](_0x80400c[_0xb4fc('0x1')][_0xbe9e7['id']],_0xbe9e7);}}}return _0x80400c['mailAccounts'];};};module[_0xb4fc('0x9')]=Realtime; \ No newline at end of file +var _0xcc1e=['merge','exports','lodash','../model/mailAccount','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','mailAccounts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcc1e,0x1b2));var _0xecc1=function(_0x450cba,_0x749b5c){_0x450cba=_0x450cba-0x0;var _0x524129=_0xcc1e[_0x450cba];return _0x524129;};'use strict';var _=require(_0xecc1('0x0'));var MailAccount=require(_0xecc1('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x12e2f5,_0x373925,_0x2d3310){var _0x4a3ce6=_['mapKeys'](_0x12e2f5,function(_0x589069,_0x57db22){return _0x589069[_0x2d3310];});for(var _0x4c1730 in _0x373925){if(_0x373925['hasOwnProperty'](_0x4c1730)){if(!_0x4a3ce6[_0x4c1730]){delete _0x373925[_0x4c1730];}}}}Realtime[_0xecc1('0x2')][_0xecc1('0x3')]=function(_0x3fec86,_0x4d9cf7){for(var _0x4d8594 in _0x4d9cf7){if(_0x3fec86[_0xecc1('0x4')](_0x4d8594)){_0x3fec86[_0x4d8594]=_0x4d9cf7[_0x4d8594];}}};Realtime[_0xecc1('0x2')][_0xecc1('0x5')]=function(){var _0x2452b8=this;return function(_0x2c453e){if(_0x2c453e){freeIsNotKey(_0x2c453e,_0x2452b8[_0xecc1('0x6')],'id');for(var _0x55bc13=0x0,_0x2e97f8={},_0x378a18={};_0x55bc13<_0x2c453e['length'];_0x55bc13+=0x1){_0x2e97f8=_0x2c453e[_0x55bc13];if(_['isUndefined'](_0x2452b8['mailAccounts'][_0x2e97f8['id']])){_0x2452b8['mailAccounts'][_0x2e97f8['id']]=new MailAccount(_0x2e97f8);}else{_[_0xecc1('0x7')](_0x2452b8[_0xecc1('0x6')][_0x2e97f8['id']],_0x2e97f8);}}}return _0x2452b8['mailAccounts'];};};module[_0xecc1('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 39d86f2..7033321 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 _0x347a=['GetMailAccount','name','provider','service','email','active','key','ListId','CloudProvider','type','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x164565,_0x132287){var _0x2d9e47=function(_0x5925dc){while(--_0x5925dc){_0x164565['push'](_0x164565['shift']());}};_0x2d9e47(++_0x132287);}(_0x347a,0x12f));var _0xa347=function(_0x344adc,_0x183c37){_0x344adc=_0x344adc-0x0;var _0x4014b2=_0x347a[_0x344adc];return _0x4014b2;};'use strict';var client=require(_0xa347('0x0'));exports[_0xa347('0x1')]=function(){return function(){return client[_0xa347('0x2')](_0xa347('0x3'),{'options':{'attributes':['id',_0xa347('0x4'),_0xa347('0x5'),_0xa347('0x6'),_0xa347('0x7'),_0xa347('0x8'),_0xa347('0x9'),_0xa347('0xa'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0xa347('0xb'),'attributes':['id','name',_0xa347('0x6'),_0xa347('0xc'),_0xa347('0xd')],'as':_0xa347('0xb')}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','attributes':['id','name',_0xa347('0x6'),_0xa347('0xc'),'data5'],'as':'CloudProvider'}]}]},'log':_0xa347('0xe')});};};exports[_0xa347('0xf')]=function(_0x451c8a,_0x311fb8){return client[_0xa347('0x2')](_0xa347('0x10'),{'account':{'id':_0x451c8a},'body':_0x311fb8,'log':_0xa347('0x10')});}; \ No newline at end of file +var _0xb6c9=['Request','NotifyMailAccount','../client','GetMailAccount','provider','service','email','ListId','TemplateId','MailServerIn','Imap','CloudProvider','Smtp','name','data5','notify'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb6c9,0x152));var _0x9b6c=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xb6c9[_0x37e845];return _0x59e55b;};'use strict';var client=require(_0x9b6c('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0x9b6c('0x1'),{'options':{'attributes':['id','name',_0x9b6c('0x2'),_0x9b6c('0x3'),_0x9b6c('0x4'),'active','key',_0x9b6c('0x5'),_0x9b6c('0x6')],'raw':![],'include':[{'model':_0x9b6c('0x7'),'as':_0x9b6c('0x8'),'include':[{'model':'CloudProvider','attributes':['id','name','service','type','data5'],'as':_0x9b6c('0x9')}]},{'model':'MailServerOut','as':_0x9b6c('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0x9b6c('0xb'),_0x9b6c('0x3'),'type',_0x9b6c('0xc')],'as':_0x9b6c('0x9')}]}]},'log':'getMailAccount'});};};exports[_0x9b6c('0xd')]=function(_0x30736a,_0x38f7ae){return client[_0x9b6c('0xe')](_0x9b6c('0xf'),{'account':{'id':_0x30736a},'body':_0x38f7ae,'log':_0x9b6c('0xf')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 403c77b..f8fa60d 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 _0xc1fb=['../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x18ecae,_0x2bf366){var _0x2fe95b=function(_0x5143a5){while(--_0x5143a5){_0x18ecae['push'](_0x18ecae['shift']());}};_0x2fe95b(++_0x2bf366);}(_0xc1fb,0xbe));var _0xbc1f=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xc1fb[_0x48d6a3];return _0x38bfa0;};'use strict';var client=require(_0xbc1f('0x0'));exports[_0xbc1f('0x1')]=function(){return client[_0xbc1f('0x2')](_0xbc1f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbc1f('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xbeba=['GetSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xbeba,0xf9));var _0xabeb=function(_0x48d1f6,_0x21ba26){_0x48d1f6=_0x48d1f6-0x0;var _0x5e0ee6=_0xbeba[_0x48d1f6];return _0x5e0ee6;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xabeb('0x0')](_0xabeb('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xabeb('0x2')]},'log':_0xabeb('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index e39e54d..1da3b28 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 cb36c3d..8d40e45 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 _0x51c9=['exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x253659,_0x464c9){var _0x2e6105=function(_0x1462ab){while(--_0x1462ab){_0x253659['push'](_0x253659['shift']());}};_0x2e6105(++_0x464c9);}(_0x51c9,0x143));var _0x951c=function(_0xab2622,_0x582313){_0xab2622=_0xab2622-0x0;var _0x3ab544=_0x51c9[_0xab2622];return _0x3ab544;};'use strict';var _=require(_0x951c('0x0'));var http=require(_0x951c('0x1'));var express=require('express');var sticky=require(_0x951c('0x2'));var Redis=require(_0x951c('0x3'));var config=require(_0x951c('0x4'));var app=express();var server=http[_0x951c('0x5')](app);server[_0x951c('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x951c('0x7')])){var socketio=require(_0x951c('0x8'))(server,{'transports':['websocket',_0x951c('0x9')]});config[_0x951c('0xa')]=_[_0x951c('0xb')](config[_0x951c('0xa')],{'host':_0x951c('0xc'),'port':0x18eb});socketio['adapter'](require(_0x951c('0xd'))({'pubClient':new Redis(config[_0x951c('0xa')]),'subClient':new Redis(config[_0x951c('0xa')])}));require(_0x951c('0xe'))[_0x951c('0xf')]();require(_0x951c('0x10'))[_0x951c('0xf')](socketio);require(_0x951c('0x11'))[_0x951c('0xf')](app);require(_0x951c('0x12'))[_0x951c('0xf')](app);}else{server[_0x951c('0x13')]('listening',function(){console[_0x951c('0x14')](_0x951c('0x15'),config['port']);});}exports=module[_0x951c('0x16')]=app; \ No newline at end of file +var _0x5b93=['Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','listen','socket.io','websocket','polling','redis','localhost','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','listening','log'];(function(_0x1b1050,_0x574151){var _0x2a7d29=function(_0x43ceab){while(--_0x43ceab){_0x1b1050['push'](_0x1b1050['shift']());}};_0x2a7d29(++_0x574151);}(_0x5b93,0x1a1));var _0x35b9=function(_0x2cd3f2,_0x58a45b){_0x2cd3f2=_0x2cd3f2-0x0;var _0x138421=_0x5b93[_0x2cd3f2];return _0x138421;};'use strict';var _=require(_0x35b9('0x0'));var http=require(_0x35b9('0x1'));var express=require(_0x35b9('0x2'));var sticky=require(_0x35b9('0x3'));var Redis=require(_0x35b9('0x4'));var config=require(_0x35b9('0x5'));var app=express();var server=http[_0x35b9('0x6')](app);server['timeout']=0xdbba0;if(sticky[_0x35b9('0x7')](server,config['port'])){var socketio=require(_0x35b9('0x8'))(server,{'transports':[_0x35b9('0x9'),_0x35b9('0xa')]});config[_0x35b9('0xb')]=_['defaults'](config[_0x35b9('0xb')],{'host':_0x35b9('0xc'),'port':0x18eb});socketio['adapter'](require(_0x35b9('0xd'))({'pubClient':new Redis(config[_0x35b9('0xb')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x35b9('0xe')]();require(_0x35b9('0xf'))[_0x35b9('0xe')](socketio);require(_0x35b9('0x10'))[_0x35b9('0xe')](app);require(_0x35b9('0x11'))[_0x35b9('0xe')](app);}else{server['once'](_0x35b9('0x12'),function(){console[_0x35b9('0x13')](_0x35b9('0x14'),config[_0x35b9('0x15')]);});}exports=module[_0x35b9('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e9b1175..93354ca 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 _0xfeda=['Request','request','debug','rpc','error','message','catch','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x355454,_0x300b56){var _0x575584=function(_0x31166d){while(--_0x31166d){_0x355454['push'](_0x355454['shift']());}};_0x575584(++_0x300b56);}(_0xfeda,0xca));var _0xafed=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xfeda[_0x4709c0];return _0x13348b;};'use strict';var jayson=require(_0xafed('0x0'));var BPromise=require(_0xafed('0x1'));var logger=require(_0xafed('0x2'))(_0xafed('0x3'));var client=jayson[_0xafed('0x4')][_0xafed('0x5')]({'port':0x2329});client[_0xafed('0x6')]=function(_0x5a58f9,_0x132e65){return new BPromise(function(_0xcf56f9,_0x284dc2){return client[_0xafed('0x7')](_0x5a58f9,_0x132e65)['then'](function(_0x2ad5e6){logger[_0xafed('0x8')](_0xafed('0x9'),'routing',_0x5a58f9,_0x132e65,_0x2ad5e6);if(_0x2ad5e6[_0xafed('0xa')]){logger['error'](_0xafed('0x9'),'routing',_0x5a58f9,_0x2ad5e6['error'][_0xafed('0xb')],_0x132e65);return _0x284dc2(_0x2ad5e6['error'][_0xafed('0xb')]);}else{return _0xcf56f9(_0x2ad5e6['result']);}})[_0xafed('0xc')](function(_0xed1b92){logger['error'](_0xafed('0x9'),_0xafed('0x3'),_0x5a58f9,_0xed1b92,_0x132e65);return _0x284dc2(_0xed1b92);});});};module['exports']=client; \ No newline at end of file +var _0x3760=['bluebird','routing','http','Request','request','debug','rpc','error','message','catch','exports','jayson/promise'];(function(_0x7876de,_0xbfcaec){var _0x36e156=function(_0x6b91ae){while(--_0x6b91ae){_0x7876de['push'](_0x7876de['shift']());}};_0x36e156(++_0xbfcaec);}(_0x3760,0x173));var _0x0376=function(_0x381372,_0xf0a5a){_0x381372=_0x381372-0x0;var _0x4e959a=_0x3760[_0x381372];return _0x4e959a;};'use strict';var jayson=require(_0x0376('0x0'));var BPromise=require(_0x0376('0x1'));var logger=require('../../config/logger')(_0x0376('0x2'));var client=jayson['client'][_0x0376('0x3')]({'port':0x2329});client[_0x0376('0x4')]=function(_0x242cf3,_0x45bd7f){return new BPromise(function(_0x56cbe3,_0x56b704){return client[_0x0376('0x5')](_0x242cf3,_0x45bd7f)['then'](function(_0x17aa88){logger[_0x0376('0x6')](_0x0376('0x7'),_0x0376('0x2'),_0x242cf3,_0x45bd7f,_0x17aa88);if(_0x17aa88['error']){logger[_0x0376('0x8')]('rpc',_0x0376('0x2'),_0x242cf3,_0x17aa88['error'][_0x0376('0x9')],_0x45bd7f);return _0x56b704(_0x17aa88[_0x0376('0x8')][_0x0376('0x9')]);}else{return _0x56cbe3(_0x17aa88['result']);}})[_0x0376('0xa')](function(_0x1eb04e){logger[_0x0376('0x8')](_0x0376('0x7'),_0x0376('0x2'),_0x242cf3,_0x1eb04e,_0x45bd7f);return _0x56b704(_0x1eb04e);});});};module[_0x0376('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index c700513..21faf73 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 _0x9393=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./rpc/user'];(function(_0x50c7d1,_0x5b0dd4){var _0x324341=function(_0x35ca55){while(--_0x35ca55){_0x50c7d1['push'](_0x50c7d1['shift']());}};_0x324341(++_0x5b0dd4);}(_0x9393,0x185));var _0x3939=function(_0x25d6cc,_0x28228d){_0x25d6cc=_0x25d6cc-0x0;var _0x2e8731=_0x9393[_0x25d6cc];return _0x2e8731;};'use strict';var BPromise=require(_0x3939('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x3939('0x1'));var interval=require(_0x3939('0x2'));var openchannelQueue=require(_0x3939('0x3'));var chatQueue=require(_0x3939('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x3939('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x3939('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3939('0x7')]()[_0x3939('0x8')](user['getAgents']())[_0x3939('0x8')](realtime[_0x3939('0x9')]())['then'](interval[_0x3939('0xa')]())[_0x3939('0x8')](realtime[_0x3939('0xb')]())[_0x3939('0x8')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x3939('0xc')]())[_0x3939('0x8')](chatQueue[_0x3939('0xd')]())[_0x3939('0x8')](realtime[_0x3939('0xe')]())[_0x3939('0x8')](smsQueue['getSmsQueues']())['then'](realtime[_0x3939('0xf')]())[_0x3939('0x8')](mailQueue[_0x3939('0x10')]())[_0x3939('0x8')](realtime['initMailQueues']())[_0x3939('0x8')](faxQueue[_0x3939('0x11')]())[_0x3939('0x8')](realtime[_0x3939('0x12')]())[_0x3939('0x8')](whatsappQueue[_0x3939('0x13')]())['then'](realtime[_0x3939('0x14')]())[_0x3939('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x3939('0x8')](function(_0x341fae){return initRealtime();})['then'](function(_0x1f19bf){return setInterval(initRealtime,0x1388);})[_0x3939('0x15')](function(_0x2514f1){console[_0x3939('0x16')](_0x2514f1);});}main(); \ No newline at end of file +var _0x5290=['getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x58e582,_0x41b688){var _0x27f1cd=function(_0x530c74){while(--_0x530c74){_0x58e582['push'](_0x58e582['shift']());}};_0x27f1cd(++_0x41b688);}(_0x5290,0x179));var _0x0529=function(_0x1d9fa7,_0x3b0162){_0x1d9fa7=_0x1d9fa7-0x0;var _0x56cd77=_0x5290[_0x1d9fa7];return _0x56cd77;};'use strict';var BPromise=require(_0x0529('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x0529('0x1'));var interval=require(_0x0529('0x2'));var openchannelQueue=require(_0x0529('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x0529('0x4'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x0529('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0529('0x6')]()[_0x0529('0x7')](user[_0x0529('0x8')]())[_0x0529('0x7')](realtime[_0x0529('0x9')]())[_0x0529('0x7')](interval[_0x0529('0xa')]())[_0x0529('0x7')](realtime['initIntervals']())[_0x0529('0x7')](openchannelQueue[_0x0529('0xb')]())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x0529('0xc')]())[_0x0529('0x7')](realtime[_0x0529('0xd')]())[_0x0529('0x7')](smsQueue[_0x0529('0xe')]())['then'](realtime['initSmsQueues']())['then'](mailQueue[_0x0529('0xf')]())[_0x0529('0x7')](realtime[_0x0529('0x10')]())[_0x0529('0x7')](faxQueue[_0x0529('0x11')]())[_0x0529('0x7')](realtime[_0x0529('0x12')]())[_0x0529('0x7')](whatsappQueue['getWhatsappQueues']())[_0x0529('0x7')](realtime[_0x0529('0x13')]())[_0x0529('0x7')](function(){return realtime;});}function main(){return server[_0x0529('0x14')](realtime)[_0x0529('0x7')](function(_0x145278){return initRealtime();})[_0x0529('0x7')](function(_0x3cd67){return setInterval(initRealtime,0x1388);})[_0x0529('0x15')](function(_0x52d546){console[_0x0529('0x16')](_0x52d546);});}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 9204755..d6ff526 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x89f6c3,_0xc161b2){var _0x23b861=function(_0x89095d){while(--_0x89095d){_0x89f6c3['push'](_0x89f6c3['shift']());}};_0x23b861(++_0xc161b2);}(_0xe14b,0x93));var _0xbe14=function(_0x2ecc4a,_0x4763e5){_0x2ecc4a=_0x2ecc4a-0x0;var _0x25cda8=_0xe14b[_0x2ecc4a];return _0x25cda8;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x3afbdf,_0x9e463b){_0x3afbdf=_0x3afbdf-0x0;var _0x5b6861=_0x1261[_0x3afbdf];return _0x5b6861;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 35fb375..dc29a69 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 _0xdb67=['bluebird','jayson/promise','client','then','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0xdb67,0x1cc));var _0x7db6=function(_0x187c3f,_0x5b53c8){_0x187c3f=_0x187c3f-0x0;var _0x29f436=_0xdb67[_0x187c3f];return _0x29f436;};'use strict';var BPromise=require(_0x7db6('0x0'));var jayson=require(_0x7db6('0x1'));var client=jayson[_0x7db6('0x2')]['http']({'port':0x232b});function request(_0x25dbd6,_0x1dab30){return new BPromise(function(_0x309952,_0x192730){return client['request'](_0x25dbd6,_0x1dab30)[_0x7db6('0x3')](function(_0x1141e3){if(_0x1141e3['error']){return _0x192730(_0x1141e3[_0x7db6('0x4')][_0x7db6('0x5')]);}else{return _0x309952(_0x1141e3[_0x7db6('0x6')]);}})[_0x7db6('0x7')](function(_0x1af72a){return _0x192730(_0x1af72a);});});}exports[_0x7db6('0x8')]=function(_0x5ebcd4,_0x1414bf){return request(_0x7db6('0x9'),{'account':_0x5ebcd4,'message':_0x1414bf});}; \ No newline at end of file +var _0xb44d=['result','catch','sendMailMessage','jayson/promise','request','then','error','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb44d,0x1b3));var _0xdb44=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb44d[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xdb44('0x0'));var client=jayson['client']['http']({'port':0x232b});function request(_0x11766b,_0x5a8a7d){return new BPromise(function(_0x3fb241,_0xa939de){return client[_0xdb44('0x1')](_0x11766b,_0x5a8a7d)[_0xdb44('0x2')](function(_0xa36643){if(_0xa36643[_0xdb44('0x3')]){return _0xa939de(_0xa36643[_0xdb44('0x3')][_0xdb44('0x4')]);}else{return _0x3fb241(_0xa36643[_0xdb44('0x5')]);}})[_0xdb44('0x6')](function(_0x3f4035){return _0xa939de(_0x3f4035);});});}exports[_0xdb44('0x7')]=function(_0x4e17e2,_0x3998f5){return request('SendMail',{'account':_0x4e17e2,'message':_0x3998f5});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index a1b3f1d..81b15eb 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 _0xc93a=['working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailStatus','mailStatusTime','openchannelCurrentCapacity','chatWaitingInteractions','smsWaitingInteractions','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity'];(function(_0x31061a,_0x5ab647){var _0x48d92a=function(_0x421130){while(--_0x421130){_0x31061a['push'](_0x31061a['shift']());}};_0x48d92a(++_0x5ab647);}(_0xc93a,0x9c));var _0xac93=function(_0x4e337d,_0x2a0669){_0x4e337d=_0x4e337d-0x0;var _0x2c1a53=_0xc93a[_0x4e337d];return _0x2c1a53;};'use strict';var _=require('lodash');var moment=require(_0xac93('0x0'));var md5=require(_0xac93('0x1'));var Redis=require(_0xac93('0x2'));var config=require(_0xac93('0x3'));config['redis']=_[_0xac93('0x4')](config[_0xac93('0x5')],{'host':_0xac93('0x6'),'port':0x18eb});var io=require(_0xac93('0x7'))(new Redis(config['redis']));function Agent(_0x312f42){this['id']=_0x312f42['id']||0x0;this['name']=_0x312f42[_0xac93('0x8')]||'';this[_0xac93('0x9')]=_0x312f42[_0xac93('0x9')]||!![];this[_0xac93('0xa')]=_0x312f42[_0xac93('0xa')]||![];this[_0xac93('0xb')]=_0x312f42[_0xac93('0xb')]||![];this[_0xac93('0xc')]=_0x312f42[_0xac93('0xc')]||![];this[_0xac93('0xd')]=_0x312f42['faxPause']||![];this[_0xac93('0xe')]=_0x312f42[_0xac93('0xe')]||![];this[_0xac93('0xf')]=_0x312f42[_0xac93('0xf')]||![];this[_0xac93('0x10')]=_0xac93('0x11');this['chatStatusTime']=0x0;this[_0xac93('0x12')]=_0x312f42[_0xac93('0x12')]||0x0;this[_0xac93('0x13')]=0x0;this['mailStatus']=_0xac93('0x11');this['mailStatusTime']=0x0;this[_0xac93('0x14')]=_0x312f42['mailCapacity']||0x0;this[_0xac93('0x15')]=0x0;this[_0xac93('0x16')]='unknown';this[_0xac93('0x17')]=0x0;this[_0xac93('0x18')]=_0x312f42[_0xac93('0x18')]||0x0;this[_0xac93('0x19')]=0x0;this[_0xac93('0x1a')]='unknown';this[_0xac93('0x1b')]=0x0;this[_0xac93('0x1c')]=_0x312f42[_0xac93('0x1c')]||0x0;this[_0xac93('0x1d')]=0x0;this[_0xac93('0x1e')]=_0xac93('0x11');this[_0xac93('0x1f')]=0x0;this[_0xac93('0x20')]=_0x312f42[_0xac93('0x20')]||0x0;this[_0xac93('0x21')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x312f42['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xac93('0x22')]=![];this[_0xac93('0x23')]=undefined;this[_0xac93('0x1')]='';this['chatWaitingInteractions']={};this[_0xac93('0x24')]={};this[_0xac93('0x25')]={};this[_0xac93('0x26')]={};this['smsWaitingInteractions']={};this[_0xac93('0x27')]={};this[_0xac93('0x28')]();}Agent[_0xac93('0x29')][_0xac93('0x2a')]=function(_0x3718fa){if(this[_0x3718fa+_0xac93('0x2b')]>0x0){if(this[_0x3718fa+_0xac93('0x2c')]>0x0&&this[_0x3718fa+_0xac93('0x2b')]>=this[_0x3718fa+_0xac93('0x2c')]){return'maxcapacity';}else{return _0xac93('0x2d');}}else{return _0xac93('0x2e');}};Agent[_0xac93('0x29')][_0xac93('0x28')]=function(){var _0x3ff5e6=[_0xac93('0x2f'),_0xac93('0x30'),_0xac93('0x31'),_0xac93('0x32'),_0xac93('0x33'),_0xac93('0x34')];for(var _0x12217e=0x0;_0x12217e<_0x3ff5e6[_0xac93('0x35')];_0x12217e+=0x1){var _0x101ca7=this[_0xac93('0x2a')](_0x3ff5e6[_0x12217e]);if(this[_0x3ff5e6[_0x12217e]+_0xac93('0x36')]!==_0x101ca7){this[_0x3ff5e6[_0x12217e]+_0xac93('0x37')]=_[_0xac93('0x38')](moment()[_0xac93('0x39')]('x'));}this[_0x3ff5e6[_0x12217e]+_0xac93('0x36')]=_0x101ca7;}var _0x25e51f={'id':this['id'],'name':this['name'],'online':this[_0xac93('0x9')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xac93('0xc')],'smsPause':this[_0xac93('0xe')],'faxPause':this[_0xac93('0xd')],'openchannelPause':this[_0xac93('0xf')],'chatStatus':this[_0xac93('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xac93('0x12')],'chatCurrentCapacity':this[_0xac93('0x13')],'mailStatus':this[_0xac93('0x3a')],'mailStatusTime':this[_0xac93('0x3b')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xac93('0x17')],'faxCapacity':this[_0xac93('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xac93('0x1a')],'smsStatusTime':this[_0xac93('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xac93('0x1d')],'whatsappStatus':this[_0xac93('0x1e')],'whatsappStatusTime':this[_0xac93('0x1f')],'whatsappCapacity':this[_0xac93('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xac93('0x3c')],'busy':this[_0xac93('0x22')],'busyQueue':this[_0xac93('0x23')],'chatWaitingInteractions':this[_0xac93('0x3d')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xac93('0x25')],'openchannelWaitingInteractions':this[_0xac93('0x26')],'smsWaitingInteractions':this[_0xac93('0x3e')],'whatsappWaitingInteractions':this[_0xac93('0x27')]};var _0x1f838c=md5(JSON[_0xac93('0x3f')](_0x25e51f));if(this[_0xac93('0x1')]!==_0x1f838c){this[_0xac93('0x1')]=_0x1f838c;io[_0xac93('0x40')](_0xac93('0x41'),_0x25e51f);}};module[_0xac93('0x42')]=Agent; \ No newline at end of file +var _0x8440=['whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','chat','fax','whatsapp','getChannelStatus','Status','StatusTime','format','name','mailPause','mailStatusTime','whatsappStatusTime','openchannelStatusTime','stringify','md5','emit','lodash','moment','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity'];(function(_0x347f41,_0x2cbc52){var _0x2637c2=function(_0x27f641){while(--_0x27f641){_0x347f41['push'](_0x347f41['shift']());}};_0x2637c2(++_0x2cbc52);}(_0x8440,0x9d));var _0x0844=function(_0x26482a,_0x9b689e){_0x26482a=_0x26482a-0x0;var _0x1c5528=_0x8440[_0x26482a];return _0x1c5528;};'use strict';var _=require(_0x0844('0x0'));var moment=require(_0x0844('0x1'));var md5=require('md5');var Redis=require(_0x0844('0x2'));var config=require(_0x0844('0x3'));config['redis']=_['defaults'](config[_0x0844('0x4')],{'host':_0x0844('0x5'),'port':0x18eb});var io=require(_0x0844('0x6'))(new Redis(config['redis']));function Agent(_0x5ea794){this['id']=_0x5ea794['id']||0x0;this['name']=_0x5ea794['name']||'';this[_0x0844('0x7')]=_0x5ea794[_0x0844('0x7')]||!![];this[_0x0844('0x8')]=_0x5ea794[_0x0844('0x8')]||![];this[_0x0844('0x9')]=_0x5ea794[_0x0844('0x9')]||![];this['mailPause']=_0x5ea794['mailPause']||![];this[_0x0844('0xa')]=_0x5ea794[_0x0844('0xa')]||![];this['smsPause']=_0x5ea794[_0x0844('0xb')]||![];this[_0x0844('0xc')]=_0x5ea794[_0x0844('0xc')]||![];this[_0x0844('0xd')]=_0x0844('0xe');this[_0x0844('0xf')]=0x0;this['chatCapacity']=_0x5ea794[_0x0844('0x10')]||0x0;this[_0x0844('0x11')]=0x0;this[_0x0844('0x12')]='unknown';this['mailStatusTime']=0x0;this[_0x0844('0x13')]=_0x5ea794[_0x0844('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x0844('0x14')]='unknown';this[_0x0844('0x15')]=0x0;this[_0x0844('0x16')]=_0x5ea794[_0x0844('0x16')]||0x0;this[_0x0844('0x17')]=0x0;this[_0x0844('0x18')]=_0x0844('0xe');this[_0x0844('0x19')]=0x0;this[_0x0844('0x1a')]=_0x5ea794['smsCapacity']||0x0;this[_0x0844('0x1b')]=0x0;this['whatsappStatus']=_0x0844('0xe');this['whatsappStatusTime']=0x0;this[_0x0844('0x1c')]=_0x5ea794[_0x0844('0x1c')]||0x0;this[_0x0844('0x1d')]=0x0;this['openchannelStatus']=_0x0844('0xe');this['openchannelStatusTime']=0x0;this[_0x0844('0x1e')]=_0x5ea794[_0x0844('0x1e')]||0x0;this[_0x0844('0x1f')]=0x0;this[_0x0844('0x20')]=![];this[_0x0844('0x21')]=undefined;this['md5']='';this[_0x0844('0x22')]={};this[_0x0844('0x23')]={};this[_0x0844('0x24')]={};this[_0x0844('0x25')]={};this[_0x0844('0x26')]={};this[_0x0844('0x27')]={};this['updateRealtime']();}Agent[_0x0844('0x28')]['getChannelStatus']=function(_0x6c45d7){if(this[_0x6c45d7+_0x0844('0x29')]>0x0){if(this[_0x6c45d7+_0x0844('0x2a')]>0x0&&this[_0x6c45d7+_0x0844('0x29')]>=this[_0x6c45d7+_0x0844('0x2a')]){return _0x0844('0x2b');}else{return _0x0844('0x2c');}}else{return _0x0844('0x2d');}};Agent[_0x0844('0x28')][_0x0844('0x2e')]=function(){var _0x1a4ac4=['mail',_0x0844('0x2f'),'openchannel',_0x0844('0x30'),'sms',_0x0844('0x31')];for(var _0x2fca5e=0x0;_0x2fca5e<_0x1a4ac4['length'];_0x2fca5e+=0x1){var _0x5bd19b=this[_0x0844('0x32')](_0x1a4ac4[_0x2fca5e]);if(this[_0x1a4ac4[_0x2fca5e]+_0x0844('0x33')]!==_0x5bd19b){this[_0x1a4ac4[_0x2fca5e]+_0x0844('0x34')]=_['toNumber'](moment()[_0x0844('0x35')]('x'));}this[_0x1a4ac4[_0x2fca5e]+_0x0844('0x33')]=_0x5bd19b;}var _0x3f6810={'id':this['id'],'name':this[_0x0844('0x36')],'online':this[_0x0844('0x7')],'voicePause':this[_0x0844('0x8')],'chatPause':this[_0x0844('0x9')],'mailPause':this[_0x0844('0x37')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x0844('0xc')],'chatStatus':this[_0x0844('0xd')],'chatStatusTime':this[_0x0844('0xf')],'chatCapacity':this[_0x0844('0x10')],'chatCurrentCapacity':this[_0x0844('0x11')],'mailStatus':this[_0x0844('0x12')],'mailStatusTime':this[_0x0844('0x38')],'mailCapacity':this[_0x0844('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x0844('0x14')],'faxStatusTime':this[_0x0844('0x15')],'faxCapacity':this[_0x0844('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x0844('0x18')],'smsStatusTime':this[_0x0844('0x19')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x0844('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x0844('0x39')],'whatsappCapacity':this[_0x0844('0x1c')],'whatsappCurrentCapacity':this[_0x0844('0x1d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x0844('0x3a')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x0844('0x1f')],'busy':this[_0x0844('0x20')],'busyQueue':this[_0x0844('0x21')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x0844('0x23')],'mailWaitingInteractions':this[_0x0844('0x24')],'openchannelWaitingInteractions':this[_0x0844('0x25')],'smsWaitingInteractions':this[_0x0844('0x26')],'whatsappWaitingInteractions':this[_0x0844('0x27')]};var _0x508675=md5(JSON[_0x0844('0x3b')](_0x3f6810));if(this[_0x0844('0x3c')]!==_0x508675){this['md5']=_0x508675;io[_0x0844('0x3d')]('user:save',_0x3f6810);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ea3ac1b..d681b4d 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 _0x818c=['name','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','available','waiting','stringify','chat_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','socket.io-emitter'];(function(_0xa4b0ec,_0x1f82f3){var _0x1f8a0e=function(_0x28ef32){while(--_0x28ef32){_0xa4b0ec['push'](_0xa4b0ec['shift']());}};_0x1f8a0e(++_0x1f82f3);}(_0x818c,0x1a3));var _0xc818=function(_0x4ec5b0,_0x15ddc7){_0x4ec5b0=_0x4ec5b0-0x0;var _0x3e9b64=_0x818c[_0x4ec5b0];return _0x3e9b64;};'use strict';var _=require(_0xc818('0x0'));var md5=require('md5');var util=require(_0xc818('0x1'));var Redis=require('ioredis');var config=require(_0xc818('0x2'));config[_0xc818('0x3')]=_[_0xc818('0x4')](config[_0xc818('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xc818('0x5'))(new Redis(config[_0xc818('0x3')]));function ChatQueue(_0x153cf1){this['id']=_0x153cf1['id']||0x0;this[_0xc818('0x6')]=_0x153cf1[_0xc818('0x6')]||'';this['timeout']=_0x153cf1['timeout']||0xa;this[_0xc818('0x7')]=_0x153cf1[_0xc818('0x7')]||_0xc818('0x8');this[_0xc818('0x9')]=_0x153cf1['Agents'];this[_0xc818('0xa')]={};this['waiting']=0x0;this[_0xc818('0xb')]='';this[_0xc818('0xc')]();this[_0xc818('0xd')]();}ChatQueue[_0xc818('0xe')][_0xc818('0xc')]=function(){var _0x4ec0ca=this[_0xc818('0xa')][_0xc818('0xf')];this['mapAgentsId']=_[_0xc818('0x10')](this[_0xc818('0x9')],'id');this[_0xc818('0xa')][_0xc818('0xf')]=_0x4ec0ca;};ChatQueue[_0xc818('0xe')][_0xc818('0xd')]=function(){this[_0xc818('0x11')]=0x0;this[_0xc818('0x12')]=0x0;for(var _0x2031a4=0x0;_0x2031a4=0x0?this['available']:0x0;var _0x4aff3e={'id':this['id'],'available':this[_0xc818('0x14')],'loggedIn':this[_0xc818('0x11')],'name':this[_0xc818('0x6')],'paused':this[_0xc818('0x12')],'waiting':this[_0xc818('0x15')]};var _0x3ce9f3=md5(JSON[_0xc818('0x16')](_0x4aff3e));if(this[_0xc818('0xb')]!==_0x3ce9f3){this[_0xc818('0xb')]=_0x3ce9f3;io['to'](util['format']('chat:queue:%s',_0x4aff3e[_0xc818('0x6')]))['emit'](_0xc818('0x17'),_0x4aff3e);}};module[_0xc818('0x18')]=ChatQueue; \ No newline at end of file +var _0x4c13=['chatPause','available','paused','stringify','md5','format','chat:queue:%s','emit','chat_queue:save','lodash','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','loggedIn','length','online'];(function(_0x1a8565,_0xc941eb){var _0x593764=function(_0xed13df){while(--_0xed13df){_0x1a8565['push'](_0x1a8565['shift']());}};_0x593764(++_0xc941eb);}(_0x4c13,0x9a));var _0x34c1=function(_0x4e2570,_0xca2204){_0x4e2570=_0x4e2570-0x0;var _0x3cfbfd=_0x4c13[_0x4e2570];return _0x3cfbfd;};'use strict';var _=require(_0x34c1('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x34c1('0x1'));config[_0x34c1('0x2')]=_[_0x34c1('0x3')](config[_0x34c1('0x2')],{'host':_0x34c1('0x4'),'port':0x18eb});var io=require(_0x34c1('0x5'))(new Redis(config[_0x34c1('0x2')]));function ChatQueue(_0x313ae5){this['id']=_0x313ae5['id']||0x0;this[_0x34c1('0x6')]=_0x313ae5[_0x34c1('0x6')]||'';this['timeout']=_0x313ae5[_0x34c1('0x7')]||0xa;this[_0x34c1('0x8')]=_0x313ae5[_0x34c1('0x8')]||_0x34c1('0x9');this[_0x34c1('0xa')]=_0x313ae5[_0x34c1('0xa')];this[_0x34c1('0xb')]={};this[_0x34c1('0xc')]=0x0;this['md5']='';this[_0x34c1('0xd')]();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0x5d7c28=this[_0x34c1('0xb')][_0x34c1('0xe')];this[_0x34c1('0xb')]=_[_0x34c1('0xf')](this[_0x34c1('0xa')],'id');this[_0x34c1('0xb')][_0x34c1('0xe')]=_0x5d7c28;};ChatQueue[_0x34c1('0x10')]['updateRealtime']=function(){this[_0x34c1('0x11')]=0x0;this['paused']=0x0;for(var _0x30efba=0x0;_0x30efba=0x0?this['available']:0x0;var _0x12c51f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x34c1('0x11')],'name':this['name'],'paused':this[_0x34c1('0x16')],'waiting':this[_0x34c1('0xc')]};var _0x1c67ad=md5(JSON[_0x34c1('0x17')](_0x12c51f));if(this[_0x34c1('0x18')]!==_0x1c67ad){this[_0x34c1('0x18')]=_0x1c67ad;io['to'](util[_0x34c1('0x19')](_0x34c1('0x1a'),_0x12c51f[_0x34c1('0x6')]))[_0x34c1('0x1b')](_0x34c1('0x1c'),_0x12c51f);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index b1768ad..0669ed2 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 _0xeeef=['util','redis','defaults','localhost','name','timeout','beepall','Agents','waiting','updateRouting','prototype','_rr','mapAgentsId','map','updateRealtime','loggedIn','length','online','faxPause','paused','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5'];(function(_0x555fc8,_0x53f3f5){var _0x440810=function(_0x102ee3){while(--_0x102ee3){_0x555fc8['push'](_0x555fc8['shift']());}};_0x440810(++_0x53f3f5);}(_0xeeef,0xa6));var _0xfeee=function(_0x5ef263,_0x16e828){_0x5ef263=_0x5ef263-0x0;var _0x14919f=_0xeeef[_0x5ef263];return _0x14919f;};'use strict';var _=require(_0xfeee('0x0'));var md5=require(_0xfeee('0x1'));var util=require(_0xfeee('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xfeee('0x3')]=_[_0xfeee('0x4')](config['redis'],{'host':_0xfeee('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x4bddcf){this['id']=_0x4bddcf['id']||0x0;this[_0xfeee('0x6')]=_0x4bddcf[_0xfeee('0x6')]||'';this[_0xfeee('0x7')]=_0x4bddcf['timeout']||0xa;this['strategy']=_0x4bddcf['strategy']||_0xfeee('0x8');this[_0xfeee('0x9')]=_0x4bddcf[_0xfeee('0x9')];this['mapAgentsId']={};this[_0xfeee('0xa')]=0x0;this[_0xfeee('0x1')]='';this[_0xfeee('0xb')]();this['updateRealtime']();}FaxQueue[_0xfeee('0xc')]['updateRouting']=function(){var _0x48cf0b=this['mapAgentsId'][_0xfeee('0xd')];this[_0xfeee('0xe')]=_[_0xfeee('0xf')](this[_0xfeee('0x9')],'id');this['mapAgentsId']['_rr']=_0x48cf0b;};FaxQueue[_0xfeee('0xc')][_0xfeee('0x10')]=function(){this[_0xfeee('0x11')]=0x0;this['paused']=0x0;for(var _0x42f5e=0x0;_0x42f5e=0x0?this[_0xfeee('0x16')]:0x0;var _0x274fb5={'id':this['id'],'available':this[_0xfeee('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xfeee('0x6')],'paused':this[_0xfeee('0x15')],'waiting':this['waiting']};var _0x61253b=md5(JSON[_0xfeee('0x17')](_0x274fb5));if(this[_0xfeee('0x1')]!==_0x61253b){this['md5']=_0x61253b;io['to'](util[_0xfeee('0x18')](_0xfeee('0x19'),_0x274fb5[_0xfeee('0x6')]))[_0xfeee('0x1a')](_0xfeee('0x1b'),_0x274fb5);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x4e74=['redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','_rr','mapAgentsId','loggedIn','paused','online','faxPause','available','waiting','format','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x4e74,0xcb));var _0x44e7=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x4e74[_0x27e811];return _0x1627fa;};'use strict';var _=require(_0x44e7('0x0'));var md5=require(_0x44e7('0x1'));var util=require(_0x44e7('0x2'));var Redis=require(_0x44e7('0x3'));var config=require(_0x44e7('0x4'));config[_0x44e7('0x5')]=_[_0x44e7('0x6')](config[_0x44e7('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x44e7('0x7'))(new Redis(config[_0x44e7('0x5')]));function FaxQueue(_0x112ee5){this['id']=_0x112ee5['id']||0x0;this[_0x44e7('0x8')]=_0x112ee5['name']||'';this[_0x44e7('0x9')]=_0x112ee5['timeout']||0xa;this[_0x44e7('0xa')]=_0x112ee5['strategy']||_0x44e7('0xb');this[_0x44e7('0xc')]=_0x112ee5[_0x44e7('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x44e7('0x1')]='';this['updateRouting']();this[_0x44e7('0xd')]();}FaxQueue[_0x44e7('0xe')]['updateRouting']=function(){var _0x161422=this['mapAgentsId'][_0x44e7('0xf')];this['mapAgentsId']=_['map'](this[_0x44e7('0xc')],'id');this[_0x44e7('0x10')][_0x44e7('0xf')]=_0x161422;};FaxQueue[_0x44e7('0xe')][_0x44e7('0xd')]=function(){this[_0x44e7('0x11')]=0x0;this[_0x44e7('0x12')]=0x0;for(var _0x4c274e=0x0;_0x4c274e=0x0?this[_0x44e7('0x15')]:0x0;var _0x3bc0f7={'id':this['id'],'available':this[_0x44e7('0x15')],'loggedIn':this[_0x44e7('0x11')],'name':this['name'],'paused':this[_0x44e7('0x12')],'waiting':this[_0x44e7('0x16')]};var _0x54aef1=md5(JSON['stringify'](_0x3bc0f7));if(this[_0x44e7('0x1')]!==_0x54aef1){this[_0x44e7('0x1')]=_0x54aef1;io['to'](util[_0x44e7('0x17')]('fax:queue:%s',_0x3bc0f7['name']))['emit'](_0x44e7('0x18'),_0x3bc0f7);}};module[_0x44e7('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 8f8917f..50646cb 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 _0xba88=['Intervals','name'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xba88,0xc5));var _0x8ba8=function(_0x108261,_0x76b9dd){_0x108261=_0x108261-0x0;var _0x37612f=_0xba88[_0x108261];return _0x37612f;};'use strict';function Interval(_0x2021a1){this['id']=_0x2021a1['id']||0x0;this[_0x8ba8('0x0')]=_0x2021a1[_0x8ba8('0x0')]||'';this[_0x8ba8('0x1')]=_0x2021a1[_0x8ba8('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x9d7c=['Intervals','exports','name'];(function(_0x1f63de,_0x501537){var _0x5a182d=function(_0x315162){while(--_0x315162){_0x1f63de['push'](_0x1f63de['shift']());}};_0x5a182d(++_0x501537);}(_0x9d7c,0x125));var _0xc9d7=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x9d7c[_0x2f87cd];return _0x5d7eda;};'use strict';function Interval(_0x1d4298){this['id']=_0x1d4298['id']||0x0;this[_0xc9d7('0x0')]=_0x1d4298['name']||'';this[_0xc9d7('0x1')]=_0x1d4298['Intervals']||{};}module[_0xc9d7('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 995293a..22c6478 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 _0x2487=['md5','util','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','_rr','prototype','length','online','mailPause','available','paused','loggedIn','stringify','format','exports','lodash'];(function(_0x525384,_0x33fc6e){var _0x314d7a=function(_0x43d45f){while(--_0x43d45f){_0x525384['push'](_0x525384['shift']());}};_0x314d7a(++_0x33fc6e);}(_0x2487,0x19f));var _0x7248=function(_0x2b8d75,_0x413842){_0x2b8d75=_0x2b8d75-0x0;var _0x853dca=_0x2487[_0x2b8d75];return _0x853dca;};'use strict';var _=require(_0x7248('0x0'));var md5=require(_0x7248('0x1'));var util=require(_0x7248('0x2'));var Redis=require('ioredis');var config=require(_0x7248('0x3'));config['redis']=_[_0x7248('0x4')](config[_0x7248('0x5')],{'host':_0x7248('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7248('0x5')]));function MailQueue(_0x419999){this['id']=_0x419999['id']||0x0;this['name']=_0x419999[_0x7248('0x7')]||'';this[_0x7248('0x8')]=_0x419999[_0x7248('0x8')]||0xa;this[_0x7248('0x9')]=_0x419999[_0x7248('0x9')]||_0x7248('0xa');this[_0x7248('0xb')]=_0x419999[_0x7248('0xb')];this[_0x7248('0xc')]={};this[_0x7248('0xd')]=0x0;this[_0x7248('0x1')]='';this['updateRouting']();this[_0x7248('0xe')]();}MailQueue['prototype']['updateRouting']=function(){var _0x54e8e3=this[_0x7248('0xc')][_0x7248('0xf')];this[_0x7248('0xc')]=_['map'](this[_0x7248('0xb')],'id');this[_0x7248('0xc')][_0x7248('0xf')]=_0x54e8e3;};MailQueue[_0x7248('0x10')][_0x7248('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x28dc24=0x0;_0x28dc24=0x0?this[_0x7248('0x14')]:0x0;var _0x1aeff8={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7248('0x16')],'name':this[_0x7248('0x7')],'paused':this[_0x7248('0x15')],'waiting':this[_0x7248('0xd')]};var _0x1926a9=md5(JSON[_0x7248('0x17')](_0x1aeff8));if(this[_0x7248('0x1')]!==_0x1926a9){this[_0x7248('0x1')]=_0x1926a9;io['to'](util[_0x7248('0x18')]('mail:queue:%s',_0x1aeff8[_0x7248('0x7')]))['emit']('mail_queue:save',_0x1aeff8);}};module[_0x7248('0x19')]=MailQueue; \ No newline at end of file +var _0x2a09=['exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','format','emit'];(function(_0x37a755,_0x5ac333){var _0x4b4019=function(_0x471a46){while(--_0x471a46){_0x37a755['push'](_0x37a755['shift']());}};_0x4b4019(++_0x5ac333);}(_0x2a09,0xa3));var _0x92a0=function(_0x17eeb3,_0x5cb626){_0x17eeb3=_0x17eeb3-0x0;var _0x39f58c=_0x2a09[_0x17eeb3];return _0x39f58c;};'use strict';var _=require(_0x92a0('0x0'));var md5=require(_0x92a0('0x1'));var util=require(_0x92a0('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x92a0('0x3')]=_['defaults'](config[_0x92a0('0x3')],{'host':_0x92a0('0x4'),'port':0x18eb});var io=require(_0x92a0('0x5'))(new Redis(config[_0x92a0('0x3')]));function MailQueue(_0x38a26a){this['id']=_0x38a26a['id']||0x0;this[_0x92a0('0x6')]=_0x38a26a[_0x92a0('0x6')]||'';this[_0x92a0('0x7')]=_0x38a26a['timeout']||0xa;this['strategy']=_0x38a26a['strategy']||_0x92a0('0x8');this['Agents']=_0x38a26a[_0x92a0('0x9')];this[_0x92a0('0xa')]={};this[_0x92a0('0xb')]=0x0;this[_0x92a0('0x1')]='';this[_0x92a0('0xc')]();this[_0x92a0('0xd')]();}MailQueue[_0x92a0('0xe')][_0x92a0('0xc')]=function(){var _0x5d328b=this[_0x92a0('0xa')][_0x92a0('0xf')];this[_0x92a0('0xa')]=_[_0x92a0('0x10')](this['Agents'],'id');this[_0x92a0('0xa')][_0x92a0('0xf')]=_0x5d328b;};MailQueue['prototype'][_0x92a0('0xd')]=function(){this[_0x92a0('0x11')]=0x0;this[_0x92a0('0x12')]=0x0;for(var _0x41865f=0x0;_0x41865f=0x0?this[_0x92a0('0x16')]:0x0;var _0x21e8a2={'id':this['id'],'available':this[_0x92a0('0x16')],'loggedIn':this[_0x92a0('0x11')],'name':this[_0x92a0('0x6')],'paused':this[_0x92a0('0x12')],'waiting':this[_0x92a0('0xb')]};var _0x1fda73=md5(JSON[_0x92a0('0x17')](_0x21e8a2));if(this['md5']!==_0x1fda73){this[_0x92a0('0x1')]=_0x1fda73;io['to'](util[_0x92a0('0x18')]('mail:queue:%s',_0x21e8a2['name']))[_0x92a0('0x19')]('mail_queue:save',_0x21e8a2);}};module[_0x92a0('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ea7f55b..ea285f1 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(_0x41cb15,_0x4c3f0c){var _0x1472c8=function(_0x4105fd){while(--_0x4105fd){_0x41cb15['push'](_0x41cb15['shift']());}};_0x1472c8(++_0x4c3f0c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x5fc3[_0x46a3e8];return _0xf1442e;};'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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x326f,0xd1));var _0xf326=function(_0x561b69,_0x51f736){_0x561b69=_0x561b69-0x0;var _0x5c923f=_0x326f[_0x561b69];return _0x5c923f;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('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 74bb061..1c3f006 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 _0x55e0=['waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','paused','length','loggedIn','smsPause','available','name','format','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents'];(function(_0x35574e,_0x98e27e){var _0x315a66=function(_0x5025a8){while(--_0x5025a8){_0x35574e['push'](_0x35574e['shift']());}};_0x315a66(++_0x98e27e);}(_0x55e0,0xdc));var _0x055e=function(_0x152b1d,_0x32d2e9){_0x152b1d=_0x152b1d-0x0;var _0x3d008a=_0x55e0[_0x152b1d];return _0x3d008a;};'use strict';var _=require(_0x055e('0x0'));var md5=require(_0x055e('0x1'));var util=require(_0x055e('0x2'));var Redis=require(_0x055e('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x055e('0x4')](config[_0x055e('0x5')],{'host':_0x055e('0x6'),'port':0x18eb});var io=require(_0x055e('0x7'))(new Redis(config[_0x055e('0x5')]));function SmsQueue(_0x196394){this['id']=_0x196394['id']||0x0;this['name']=_0x196394['name']||'';this[_0x055e('0x8')]=_0x196394['timeout']||0xa;this[_0x055e('0x9')]=_0x196394[_0x055e('0x9')]||_0x055e('0xa');this[_0x055e('0xb')]=_0x196394[_0x055e('0xb')];this['mapAgentsId']={};this[_0x055e('0xc')]=0x0;this[_0x055e('0x1')]='';this[_0x055e('0xd')]();this[_0x055e('0xe')]();}SmsQueue[_0x055e('0xf')]['updateRouting']=function(){var _0x56c78a=this[_0x055e('0x10')]['_rr'];this[_0x055e('0x10')]=_[_0x055e('0x11')](this[_0x055e('0xb')],'id');this[_0x055e('0x10')][_0x055e('0x12')]=_0x56c78a;};SmsQueue[_0x055e('0xf')][_0x055e('0xe')]=function(){this['loggedIn']=0x0;this[_0x055e('0x13')]=0x0;for(var _0xb80d83=0x0;_0xb80d83=0x0?this['available']:0x0;var _0x36ef10={'id':this['id'],'available':this[_0x055e('0x17')],'loggedIn':this[_0x055e('0x15')],'name':this[_0x055e('0x18')],'paused':this['paused'],'waiting':this[_0x055e('0xc')]};var _0x3cdd68=md5(JSON['stringify'](_0x36ef10));if(this[_0x055e('0x1')]!==_0x3cdd68){this[_0x055e('0x1')]=_0x3cdd68;io['to'](util[_0x055e('0x19')](_0x055e('0x1a'),_0x36ef10[_0x055e('0x18')]))[_0x055e('0x1b')]('sms_queue:save',_0x36ef10);}};module[_0x055e('0x1c')]=SmsQueue; \ No newline at end of file +var _0x6921=['defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','smsPause','available','sms:queue:%s','emit','exports','md5','ioredis','redis'];(function(_0x1fd14b,_0x2e4514){var _0x736d10=function(_0x4af8a6){while(--_0x4af8a6){_0x1fd14b['push'](_0x1fd14b['shift']());}};_0x736d10(++_0x2e4514);}(_0x6921,0x1d1));var _0x1692=function(_0x408928,_0x429d4d){_0x408928=_0x408928-0x0;var _0x2bbac9=_0x6921[_0x408928];return _0x2bbac9;};'use strict';var _=require('lodash');var md5=require(_0x1692('0x0'));var util=require('util');var Redis=require(_0x1692('0x1'));var config=require('../../../config/environment');config[_0x1692('0x2')]=_[_0x1692('0x3')](config['redis'],{'host':_0x1692('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1692('0x2')]));function SmsQueue(_0x39cc05){this['id']=_0x39cc05['id']||0x0;this[_0x1692('0x5')]=_0x39cc05[_0x1692('0x5')]||'';this[_0x1692('0x6')]=_0x39cc05[_0x1692('0x6')]||0xa;this[_0x1692('0x7')]=_0x39cc05[_0x1692('0x7')]||_0x1692('0x8');this[_0x1692('0x9')]=_0x39cc05[_0x1692('0x9')];this['mapAgentsId']={};this[_0x1692('0xa')]=0x0;this['md5']='';this[_0x1692('0xb')]();this[_0x1692('0xc')]();}SmsQueue[_0x1692('0xd')][_0x1692('0xb')]=function(){var _0x19a6cd=this[_0x1692('0xe')]['_rr'];this[_0x1692('0xe')]=_[_0x1692('0xf')](this[_0x1692('0x9')],'id');this[_0x1692('0xe')][_0x1692('0x10')]=_0x19a6cd;};SmsQueue[_0x1692('0xd')]['updateRealtime']=function(){this[_0x1692('0x11')]=0x0;this[_0x1692('0x12')]=0x0;for(var _0xddfb0c=0x0;_0xddfb0c=0x0?this['available']:0x0;var _0x598a2f={'id':this['id'],'available':this[_0x1692('0x16')],'loggedIn':this[_0x1692('0x11')],'name':this['name'],'paused':this[_0x1692('0x12')],'waiting':this['waiting']};var _0x2b1795=md5(JSON['stringify'](_0x598a2f));if(this['md5']!==_0x2b1795){this[_0x1692('0x0')]=_0x2b1795;io['to'](util['format'](_0x1692('0x17'),_0x598a2f[_0x1692('0x5')]))[_0x1692('0x18')]('sms_queue:save',_0x598a2f);}};module[_0x1692('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b77a93b..0c33248 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 _0x938e=['available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime','prototype','updateRouting','mapAgentsId','map','_rr','loggedIn','paused','length','whatsappPause'];(function(_0x308106,_0xeb7142){var _0x11f093=function(_0x3e3d65){while(--_0x3e3d65){_0x308106['push'](_0x308106['shift']());}};_0x11f093(++_0xeb7142);}(_0x938e,0x9c));var _0xe938=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0x938e[_0x179c4a];return _0x5d1879;};'use strict';var _=require(_0xe938('0x0'));var md5=require('md5');var util=require(_0xe938('0x1'));var Redis=require(_0xe938('0x2'));var config=require(_0xe938('0x3'));config[_0xe938('0x4')]=_[_0xe938('0x5')](config[_0xe938('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe938('0x6'))(new Redis(config[_0xe938('0x4')]));function WhatsappQueue(_0x40e8f9){this['id']=_0x40e8f9['id']||0x0;this['name']=_0x40e8f9[_0xe938('0x7')]||'';this[_0xe938('0x8')]=_0x40e8f9['timeout']||0xa;this[_0xe938('0x9')]=_0x40e8f9['strategy']||_0xe938('0xa');this[_0xe938('0xb')]=_0x40e8f9[_0xe938('0xb')];this['mapAgentsId']={};this[_0xe938('0xc')]=0x0;this[_0xe938('0xd')]='';this['updateRouting']();this[_0xe938('0xe')]();}WhatsappQueue[_0xe938('0xf')][_0xe938('0x10')]=function(){var _0x45b448=this['mapAgentsId']['_rr'];this[_0xe938('0x11')]=_[_0xe938('0x12')](this['Agents'],'id');this[_0xe938('0x11')][_0xe938('0x13')]=_0x45b448;};WhatsappQueue[_0xe938('0xf')][_0xe938('0xe')]=function(){this[_0xe938('0x14')]=0x0;this[_0xe938('0x15')]=0x0;for(var _0x3410f3=0x0;_0x3410f3=0x0?this[_0xe938('0x18')]:0x0;var _0x4bcf9f={'id':this['id'],'available':this[_0xe938('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xe938('0x7')],'paused':this[_0xe938('0x15')],'waiting':this['waiting']};var _0x3da2fd=md5(JSON[_0xe938('0x19')](_0x4bcf9f));if(this[_0xe938('0xd')]!==_0x3da2fd){this[_0xe938('0xd')]=_0x3da2fd;io['to'](util[_0xe938('0x1a')](_0xe938('0x1b'),_0x4bcf9f[_0xe938('0x7')]))['emit'](_0xe938('0x1c'),_0x4bcf9f);}};module[_0xe938('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x8073=['Agents','mapAgentsId','waiting','md5','updateRealtime','updateRouting','map','_rr','prototype','loggedIn','length','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8073,0x1e6));var _0x3807=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x8073[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x3807('0x0'));var md5=require('md5');var util=require(_0x3807('0x1'));var Redis=require(_0x3807('0x2'));var config=require(_0x3807('0x3'));config[_0x3807('0x4')]=_[_0x3807('0x5')](config[_0x3807('0x4')],{'host':_0x3807('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3807('0x4')]));function WhatsappQueue(_0x4a8e3f){this['id']=_0x4a8e3f['id']||0x0;this[_0x3807('0x7')]=_0x4a8e3f[_0x3807('0x7')]||'';this['timeout']=_0x4a8e3f['timeout']||0xa;this[_0x3807('0x8')]=_0x4a8e3f[_0x3807('0x8')]||_0x3807('0x9');this[_0x3807('0xa')]=_0x4a8e3f[_0x3807('0xa')];this[_0x3807('0xb')]={};this[_0x3807('0xc')]=0x0;this[_0x3807('0xd')]='';this['updateRouting']();this[_0x3807('0xe')]();}WhatsappQueue['prototype'][_0x3807('0xf')]=function(){var _0x1d5284=this[_0x3807('0xb')]['_rr'];this[_0x3807('0xb')]=_[_0x3807('0x10')](this[_0x3807('0xa')],'id');this[_0x3807('0xb')][_0x3807('0x11')]=_0x1d5284;};WhatsappQueue[_0x3807('0x12')][_0x3807('0xe')]=function(){this[_0x3807('0x13')]=0x0;this['paused']=0x0;for(var _0x3ad764=0x0;_0x3ad764=0x0?this[_0x3807('0x18')]:0x0;var _0x4d60fd={'id':this['id'],'available':this[_0x3807('0x18')],'loggedIn':this[_0x3807('0x13')],'name':this[_0x3807('0x7')],'paused':this[_0x3807('0x17')],'waiting':this[_0x3807('0xc')]};var _0x11b702=md5(JSON[_0x3807('0x19')](_0x4d60fd));if(this['md5']!==_0x11b702){this[_0x3807('0xd')]=_0x11b702;io['to'](util[_0x3807('0x1a')](_0x3807('0x1b'),_0x4d60fd[_0x3807('0x7')]))[_0x3807('0x1c')](_0x3807('0x1d'),_0x4d60fd);}};module[_0x3807('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index db29b3a..bc0485c 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x180565,_0x3e620a){var _0x1aac2e=function(_0x1cf3f0){while(--_0x1cf3f0){_0x180565['push'](_0x180565['shift']());}};_0x1aac2e(++_0x3e620a);}(_0xb10b,0x12a));var _0xbb10=function(_0x2dc098,_0x48eb28){_0x2dc098=_0x2dc098-0x0;var _0x391d8d=_0xb10b[_0x2dc098];return _0x391d8d;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 c6ef2ac..1f0d5e9 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 _0x12f5=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction'];(function(_0x5c5031,_0x4233ee){var _0x1bd58d=function(_0x16a54b){while(--_0x16a54b){_0x5c5031['push'](_0x5c5031['shift']());}};_0x1bd58d(++_0x4233ee);}(_0x12f5,0x10d));var _0x512f=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x12f5[_0x255d5b];return _0x3e141a;};'use strict';var client=require(_0x512f('0x0'));exports[_0x512f('0x1')]=function(_0x35e690,_0x559a7e){return client['Request'](_0x512f('0x2'),{'body':_0x559a7e,'options':{'where':{'id':_0x35e690}},'log':_0x512f('0x3')});};exports[_0x512f('0x4')]=function(_0xc88927,_0x1ece4f){return client['Request'](_0x512f('0x5'),{'body':_0x1ece4f,'options':{'where':{'id':_0xc88927}},'log':_0x512f('0x6')});}; \ No newline at end of file +var _0x8f48=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client','update','Request'];(function(_0x1cb129,_0x5eb70a){var _0x58d6fd=function(_0x2e7bfa){while(--_0x2e7bfa){_0x1cb129['push'](_0x1cb129['shift']());}};_0x58d6fd(++_0x5eb70a);}(_0x8f48,0xa5));var _0x88f4=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0x8f48[_0x26a906];return _0x495575;};'use strict';var client=require(_0x88f4('0x0'));exports[_0x88f4('0x1')]=function(_0x1e17da,_0x2752ec){return client[_0x88f4('0x2')](_0x88f4('0x3'),{'body':_0x2752ec,'options':{'where':{'id':_0x1e17da}},'log':_0x88f4('0x4')});};exports[_0x88f4('0x5')]=function(_0x4ba1a5,_0x3dcdca){return client[_0x88f4('0x2')](_0x88f4('0x6'),{'body':_0x3dcdca,'options':{'where':{'id':_0x4ba1a5}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7f05f99..013642a 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 _0x7a4e=['Request','CreateChatMessage','createChatMessage','../client'];(function(_0x53d053,_0x114c0b){var _0x44e177=function(_0x5587ed){while(--_0x5587ed){_0x53d053['push'](_0x53d053['shift']());}};_0x44e177(++_0x114c0b);}(_0x7a4e,0x77));var _0xe7a4=function(_0x3cadbd,_0x12bc43){_0x3cadbd=_0x3cadbd-0x0;var _0x296da9=_0x7a4e[_0x3cadbd];return _0x296da9;};'use strict';var client=require(_0xe7a4('0x0'));exports['create']=function(_0x101ca5){return client[_0xe7a4('0x1')](_0xe7a4('0x2'),{'body':_0x101ca5,'log':_0xe7a4('0x3')});}; \ No newline at end of file +var _0xebb5=['../client','create','createChatMessage'];(function(_0x2ccf43,_0x309149){var _0x4c9b88=function(_0x135b17){while(--_0x135b17){_0x2ccf43['push'](_0x2ccf43['shift']());}};_0x4c9b88(++_0x309149);}(_0xebb5,0xcf));var _0x5ebb=function(_0x521826,_0x18cced){_0x521826=_0x521826-0x0;var _0x1faa01=_0xebb5[_0x521826];return _0x1faa01;};'use strict';var client=require(_0x5ebb('0x0'));exports[_0x5ebb('0x1')]=function(_0x29a0a2){return client['Request']('CreateChatMessage',{'body':_0x29a0a2,'log':_0x5ebb('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 821fc6a..8214957 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 _0x9ca0=['name','timeout','User','Agents','online','../client','getChatQueues','Request'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x9ca0,0x65));var _0x09ca=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x9ca0[_0x2d9c6a];return _0xf3c918;};'use strict';var client=require(_0x09ca('0x0'));exports[_0x09ca('0x1')]=function(){return function(){return client[_0x09ca('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x09ca('0x3'),_0x09ca('0x4'),'strategy'],'include':[{'model':_0x09ca('0x5'),'as':_0x09ca('0x6'),'attributes':['id','name',_0x09ca('0x7'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x0f4d=['online','chatPause','getChatQueues','GetChatQueue','timeout','strategy','User','Agents','name'];(function(_0x5b45fb,_0x4a8523){var _0x43c96e=function(_0x3a63ae){while(--_0x3a63ae){_0x5b45fb['push'](_0x5b45fb['shift']());}};_0x43c96e(++_0x4a8523);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x3515fe,_0x483232){_0x3515fe=_0x3515fe-0x0;var _0x333488=_0x0f4d[_0x3515fe];return _0x333488;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request'](_0xd0f4('0x0'),{'options':{'raw':![],'attributes':['id','name',_0xd0f4('0x1'),_0xd0f4('0x2')],'include':[{'model':_0xd0f4('0x3'),'as':_0xd0f4('0x4'),'attributes':['id',_0xd0f4('0x5'),_0xd0f4('0x6'),_0xd0f4('0x7')]}]},'log':_0xd0f4('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 30e7281..18d8509 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 _0xfa2f=['UpdateChatQueueReport','DESC','CreateChatQueueReport','update','Request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfa2f,0xe8));var _0xffa2=function(_0x17d97b,_0x31c38c){_0x17d97b=_0x17d97b-0x0;var _0x3b4859=_0xfa2f[_0x17d97b];return _0x3b4859;};'use strict';var client=require('../client');exports['create']=function(_0x3a81ad){return client['Request'](_0xffa2('0x0'),{'body':_0x3a81ad,'log':_0xffa2('0x0')});};exports[_0xffa2('0x1')]=function(_0x54d423,_0x3fcced){return client[_0xffa2('0x2')](_0xffa2('0x3'),{'body':_0x3fcced,'options':{'where':{'uniqueid':_0x54d423},'order':[['id',_0xffa2('0x4')]],'limit':0x1},'log':_0xffa2('0x3')});}; \ No newline at end of file +var _0xfa2f=['UpdateChatQueueReport','DESC','CreateChatQueueReport','update','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfa2f,0xe8));var _0xffa2=function(_0x48580f,_0x450095){_0x48580f=_0x48580f-0x0;var _0x26b0d2=_0xfa2f[_0x48580f];return _0x26b0d2;};'use strict';var client=require('../client');exports['create']=function(_0x3a81ad){return client['Request'](_0xffa2('0x0'),{'body':_0x3a81ad,'log':_0xffa2('0x0')});};exports[_0xffa2('0x1')]=function(_0x54d423,_0x3fcced){return client[_0xffa2('0x2')](_0xffa2('0x3'),{'body':_0x3fcced,'options':{'where':{'uniqueid':_0x54d423},'order':[['id',_0xffa2('0x4')]],'limit':0x1},'log':_0xffa2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9004637..c9575da 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(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0x7a54,0x106));var _0x47a5=function(_0x136a57,_0x2c626b){_0x136a57=_0x136a57-0x0;var _0x247ec7=_0x7a54[_0x136a57];return _0x247ec7;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5159af,_0x32898b){var _0x324b8e=function(_0x2661cd){while(--_0x2661cd){_0x5159af['push'](_0x5159af['shift']());}};_0x324b8e(++_0x32898b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 445a17a..f4e4c1e 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 _0xfead=['create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x5f00f1,_0x37bd25){var _0x1a34ca=function(_0x46905b){while(--_0x46905b){_0x5f00f1['push'](_0x5f00f1['shift']());}};_0x1a34ca(++_0x37bd25);}(_0xfead,0x8c));var _0xdfea=function(_0x230dec,_0x4ef8ea){_0x230dec=_0x230dec-0x0;var _0x5ad73e=_0xfead[_0x230dec];return _0x5ad73e;};'use strict';var client=require('../client');exports[_0xdfea('0x0')]=function(_0x5a7418){return client[_0xdfea('0x1')](_0xdfea('0x2'),{'body':_0x5a7418,'log':_0xdfea('0x3')});}; \ No newline at end of file +var _0x3776=['createFaxMessage','../client','create'];(function(_0x1dfc97,_0x36334e){var _0x5e10dd=function(_0x55a8c0){while(--_0x55a8c0){_0x1dfc97['push'](_0x1dfc97['shift']());}};_0x5e10dd(++_0x36334e);}(_0x3776,0x160));var _0x6377=function(_0x4618da,_0x27c024){_0x4618da=_0x4618da-0x0;var _0xede04a=_0x3776[_0x4618da];return _0xede04a;};'use strict';var client=require(_0x6377('0x0'));exports[_0x6377('0x1')]=function(_0x558431){return client['Request']('CreateFaxMessage',{'body':_0x558431,'log':_0x6377('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 83c6b92..bf6aefd 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 _0x986f=['GetFaxQueue','name','timeout','strategy','Agents','online','getFaxQueues','../client'];(function(_0x2e3dd8,_0x5cb6ba){var _0x30a523=function(_0x124b14){while(--_0x124b14){_0x2e3dd8['push'](_0x2e3dd8['shift']());}};_0x30a523(++_0x5cb6ba);}(_0x986f,0x6f));var _0xf986=function(_0x3ac768,_0x272286){_0x3ac768=_0x3ac768-0x0;var _0x304be3=_0x986f[_0x3ac768];return _0x304be3;};'use strict';var client=require(_0xf986('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0xf986('0x1'),{'options':{'raw':![],'attributes':['id',_0xf986('0x2'),_0xf986('0x3'),_0xf986('0x4')],'include':[{'model':'User','as':_0xf986('0x5'),'attributes':['id','name',_0xf986('0x6'),'faxPause']}]},'log':_0xf986('0x7')});};}; \ No newline at end of file +var _0x2e67=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause'];(function(_0xe3da0e,_0x55847f){var _0x535928=function(_0x406470){while(--_0x406470){_0xe3da0e['push'](_0xe3da0e['shift']());}};_0x535928(++_0x55847f);}(_0x2e67,0xb0));var _0x72e6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2e67[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x72e6('0x0'));exports[_0x72e6('0x1')]=function(){return function(){return client[_0x72e6('0x2')](_0x72e6('0x3'),{'options':{'raw':![],'attributes':['id',_0x72e6('0x4'),_0x72e6('0x5'),_0x72e6('0x6')],'include':[{'model':_0x72e6('0x7'),'as':_0x72e6('0x8'),'attributes':['id',_0x72e6('0x4'),_0x72e6('0x9'),_0x72e6('0xa')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index bbee3a8..2ec20ea 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 _0x4262=['DESC','../client','create','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport'];(function(_0x5d6e05,_0x27bba3){var _0x1ac655=function(_0x16dc82){while(--_0x16dc82){_0x5d6e05['push'](_0x5d6e05['shift']());}};_0x1ac655(++_0x27bba3);}(_0x4262,0x15f));var _0x2426=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4262[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0x2426('0x0'));exports[_0x2426('0x1')]=function(_0x36b1f8){return client['Request'](_0x2426('0x2'),{'body':_0x36b1f8,'log':'CreateFaxQueueReport'});};exports[_0x2426('0x3')]=function(_0x58f98f,_0x4b6f7c){return client[_0x2426('0x4')](_0x2426('0x5'),{'body':_0x4b6f7c,'options':{'where':{'uniqueid':_0x58f98f},'order':[['id',_0x2426('0x6')]],'limit':0x1},'log':_0x2426('0x5')});}; \ No newline at end of file +var _0xd4ce=['CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','Request'];(function(_0x292075,_0x1438bc){var _0x3a8791=function(_0x8e3814){while(--_0x8e3814){_0x292075['push'](_0x292075['shift']());}};_0x3a8791(++_0x1438bc);}(_0xd4ce,0xb3));var _0xed4c=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xd4ce[_0x5447fd];return _0x15b28a;};'use strict';var client=require('../client');exports['create']=function(_0x434173){return client[_0xed4c('0x0')]('CreateFaxQueueReport',{'body':_0x434173,'log':_0xed4c('0x1')});};exports[_0xed4c('0x2')]=function(_0x23adb9,_0xba911b){return client[_0xed4c('0x0')]('UpdateFaxQueueReport',{'body':_0xba911b,'options':{'where':{'uniqueid':_0x23adb9},'order':[['id',_0xed4c('0x3')]],'limit':0x1},'log':_0xed4c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 61743ef..293b10b 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 _0x4917=['name','Interval','interval','../client','getIntervals','Request','GetInterval'];(function(_0x5c3e84,_0x43996c){var _0x1eda4d=function(_0x5600b5){while(--_0x5600b5){_0x5c3e84['push'](_0x5c3e84['shift']());}};_0x1eda4d(++_0x43996c);}(_0x4917,0x129));var _0x7491=function(_0x3397c0,_0xd3a82e){_0x3397c0=_0x3397c0-0x0;var _0x399945=_0x4917[_0x3397c0];return _0x399945;};'use strict';var client=require(_0x7491('0x0'));exports[_0x7491('0x1')]=function(){return function(){return client[_0x7491('0x2')](_0x7491('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7491('0x4')],'include':[{'model':_0x7491('0x5'),'as':'Intervals','attributes':['id','name',_0x7491('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xcfa7=['name','Interval','Intervals','interval','Request'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0xcfa7,0x117));var _0x7cfa=function(_0x23106c,_0x165317){_0x23106c=_0x23106c-0x0;var _0x2442b3=_0xcfa7[_0x23106c];return _0x2442b3;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0x7cfa('0x0')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7cfa('0x1')],'include':[{'model':_0x7cfa('0x2'),'as':_0x7cfa('0x3'),'attributes':['id',_0x7cfa('0x1'),_0x7cfa('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 276cb45..2330124 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 _0x056b=['addTags','AddTagsToMailInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x4d7aaf,_0xb955da){var _0x33fb7b=function(_0x59ce86){while(--_0x59ce86){_0x4d7aaf['push'](_0x4d7aaf['shift']());}};_0x33fb7b(++_0xb955da);}(_0x056b,0xb6));var _0xb056=function(_0x36fe46,_0x40010c){_0x36fe46=_0x36fe46-0x0;var _0x4d2e9c=_0x056b[_0x36fe46];return _0x4d2e9c;};'use strict';var client=require('../client');exports[_0xb056('0x0')]=function(_0x556e84,_0xed6810){return client[_0xb056('0x1')](_0xb056('0x2'),{'body':_0xed6810,'options':{'where':{'id':_0x556e84}},'log':_0xb056('0x3')});};exports[_0xb056('0x4')]=function(_0x4157e0,_0x343d88){return client[_0xb056('0x1')](_0xb056('0x5'),{'body':_0x343d88,'options':{'where':{'id':_0x4157e0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x33af=['addTags','AddTagsToMailInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x33af,0xec));var _0xf33a=function(_0x8c0bf5,_0x2456ab){_0x8c0bf5=_0x8c0bf5-0x0;var _0x447387=_0x33af[_0x8c0bf5];return _0x447387;};'use strict';var client=require('../client');exports[_0xf33a('0x0')]=function(_0x54b114,_0x2137be){return client[_0xf33a('0x1')](_0xf33a('0x2'),{'body':_0x2137be,'options':{'where':{'id':_0x54b114}},'log':_0xf33a('0x3')});};exports[_0xf33a('0x4')]=function(_0x25f156,_0x4c734e){return client[_0xf33a('0x1')](_0xf33a('0x5'),{'body':_0x4c734e,'options':{'where':{'id':_0x25f156}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 0fdae5e..d2917f0 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 _0xb816=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x53d0d4,_0x431273){var _0x4301cc=function(_0x5ca7d6){while(--_0x5ca7d6){_0x53d0d4['push'](_0x53d0d4['shift']());}};_0x4301cc(++_0x431273);}(_0xb816,0x121));var _0x6b81=function(_0x87abd9,_0x6e74fd){_0x87abd9=_0x87abd9-0x0;var _0x55c2a9=_0xb816[_0x87abd9];return _0x55c2a9;};'use strict';var client=require(_0x6b81('0x0'));exports[_0x6b81('0x1')]=function(_0x38275a){return client[_0x6b81('0x2')](_0x6b81('0x3'),{'body':_0x38275a,'log':_0x6b81('0x4')});}; \ No newline at end of file +var _0x40e8=['../client','Request','createMailMessage'];(function(_0x20ebb5,_0x237d88){var _0x487182=function(_0xaa5491){while(--_0xaa5491){_0x20ebb5['push'](_0x20ebb5['shift']());}};_0x487182(++_0x237d88);}(_0x40e8,0x1ec));var _0x840e=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x40e8[_0x3070dc];return _0x431489;};'use strict';var client=require(_0x840e('0x0'));exports['create']=function(_0x1104ab){return client[_0x840e('0x1')]('CreateMailMessage',{'body':_0x1104ab,'log':_0x840e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c1b01f2..c9529e7 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 _0xb9ba=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x3b60ad,_0x5ecfcc){var _0x3e50f1=function(_0x583814){while(--_0x583814){_0x3b60ad['push'](_0x3b60ad['shift']());}};_0x3e50f1(++_0x5ecfcc);}(_0xb9ba,0x136));var _0xab9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb9ba[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xab9b('0x0'));exports[_0xab9b('0x1')]=function(){return function(){return client[_0xab9b('0x2')](_0xab9b('0x3'),{'options':{'raw':![],'attributes':['id',_0xab9b('0x4'),_0xab9b('0x5'),_0xab9b('0x6')],'include':[{'model':_0xab9b('0x7'),'as':_0xab9b('0x8'),'attributes':['id','name',_0xab9b('0x9'),_0xab9b('0xa')]}]},'log':_0xab9b('0x1')});};}; \ No newline at end of file +var _0xe2d6=['Request','name','timeout','User','Agents','mailPause','getMailQueues','../client'];(function(_0x292ed7,_0x4fe68e){var _0xcfb8a0=function(_0x4d133e){while(--_0x4d133e){_0x292ed7['push'](_0x292ed7['shift']());}};_0xcfb8a0(++_0x4fe68e);}(_0xe2d6,0xe7));var _0x6e2d=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xe2d6[_0x28aea5];return _0x6a55f9;};'use strict';var client=require(_0x6e2d('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x6e2d('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x6e2d('0x2'),_0x6e2d('0x3'),'strategy'],'include':[{'model':_0x6e2d('0x4'),'as':_0x6e2d('0x5'),'attributes':['id',_0x6e2d('0x2'),'online',_0x6e2d('0x6')]}]},'log':_0x6e2d('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index bee68fe..526cb53 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 _0x315a=['UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport','update','Request'];(function(_0x5207d8,_0x3fadf1){var _0x5d39e3=function(_0x7f1b20){while(--_0x7f1b20){_0x5207d8['push'](_0x5207d8['shift']());}};_0x5d39e3(++_0x3fadf1);}(_0x315a,0x10c));var _0xa315=function(_0x13cf5e,_0x216f0b){_0x13cf5e=_0x13cf5e-0x0;var _0xb26f15=_0x315a[_0x13cf5e];return _0xb26f15;};'use strict';var client=require(_0xa315('0x0'));exports[_0xa315('0x1')]=function(_0x2ad2f6){return client['Request'](_0xa315('0x2'),{'body':_0x2ad2f6,'log':'CreateMailQueueReport'});};exports[_0xa315('0x3')]=function(_0x43acf8,_0x82943){return client[_0xa315('0x4')](_0xa315('0x5'),{'body':_0x82943,'options':{'where':{'uniqueid':_0x43acf8},'order':[['id',_0xa315('0x6')]],'limit':0x1},'log':_0xa315('0x5')});}; \ No newline at end of file +var _0xb219=['update','UpdateMailQueueReport','create','Request','CreateMailQueueReport'];(function(_0x5b8b06,_0x53852e){var _0x436386=function(_0x1e17c0){while(--_0x1e17c0){_0x5b8b06['push'](_0x5b8b06['shift']());}};_0x436386(++_0x53852e);}(_0xb219,0xc0));var _0x9b21=function(_0x58f7a0,_0x5187da){_0x58f7a0=_0x58f7a0-0x0;var _0x3e92ef=_0xb219[_0x58f7a0];return _0x3e92ef;};'use strict';var client=require('../client');exports[_0x9b21('0x0')]=function(_0x157f49){return client[_0x9b21('0x1')]('CreateMailQueueReport',{'body':_0x157f49,'log':_0x9b21('0x2')});};exports[_0x9b21('0x3')]=function(_0x414abc,_0x11fe5c){return client[_0x9b21('0x1')](_0x9b21('0x4'),{'body':_0x11fe5c,'options':{'where':{'uniqueid':_0x414abc},'order':[['id','DESC']],'limit':0x1},'log':_0x9b21('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7a499f8..a44201c 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 _0xb2f4=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x41d9f6,_0x4ee4b8){var _0x205d2c=function(_0x474d21){while(--_0x474d21){_0x41d9f6['push'](_0x41d9f6['shift']());}};_0x205d2c(++_0x4ee4b8);}(_0xb2f4,0xc1));var _0x4b2f=function(_0x5eb456,_0x11789b){_0x5eb456=_0x5eb456-0x0;var _0x435279=_0xb2f4[_0x5eb456];return _0x435279;};'use strict';var client=require(_0x4b2f('0x0'));exports[_0x4b2f('0x1')]=function(_0x5173dc,_0x255ffd){return client[_0x4b2f('0x2')](_0x4b2f('0x3'),{'body':_0x255ffd,'options':{'where':{'id':_0x5173dc}},'log':_0x4b2f('0x4')});};exports[_0x4b2f('0x5')]=function(_0x477a31,_0xe2e980){return client['Request'](_0x4b2f('0x6'),{'body':_0xe2e980,'options':{'where':{'id':_0x477a31}},'log':_0x4b2f('0x7')});}; \ No newline at end of file +var _0xd378=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','addTagsToChatInteraction','../client','update'];(function(_0x3a80de,_0x2f7a9d){var _0x34e3d5=function(_0xef38c){while(--_0xef38c){_0x3a80de['push'](_0x3a80de['shift']());}};_0x34e3d5(++_0x2f7a9d);}(_0xd378,0xc2));var _0x8d37=function(_0x495dec,_0x5b1d82){_0x495dec=_0x495dec-0x0;var _0x21a1db=_0xd378[_0x495dec];return _0x21a1db;};'use strict';var client=require(_0x8d37('0x0'));exports[_0x8d37('0x1')]=function(_0x4fca04,_0xeac383){return client['Request'](_0x8d37('0x2'),{'body':_0xeac383,'options':{'where':{'id':_0x4fca04}},'log':_0x8d37('0x3')});};exports[_0x8d37('0x4')]=function(_0x1c1e83,_0x7dd30d){return client[_0x8d37('0x5')]('AddTagsToOpenchannelInteraction',{'body':_0x7dd30d,'options':{'where':{'id':_0x1c1e83}},'log':_0x8d37('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 4c2b78b..21f8190 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 _0xcbeb=['create','createOpenchannelMessage'];(function(_0x38b2d9,_0x19fd42){var _0x23a3e1=function(_0xd8192f){while(--_0xd8192f){_0x38b2d9['push'](_0x38b2d9['shift']());}};_0x23a3e1(++_0x19fd42);}(_0xcbeb,0x180));var _0xbcbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbeb[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xbcbe('0x0')]=function(_0x503a6d){return client['Request']('CreateOpenchannelMessage',{'body':_0x503a6d,'log':_0xbcbe('0x1')});}; \ No newline at end of file +var _0x821d=['createOpenchannelMessage','create','Request'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x821d,0x178));var _0xd821=function(_0x5f3b2e,_0x1de647){_0x5f3b2e=_0x5f3b2e-0x0;var _0xce272d=_0x821d[_0x5f3b2e];return _0xce272d;};'use strict';var client=require('../client');exports[_0xd821('0x0')]=function(_0x520b93){return client[_0xd821('0x1')]('CreateOpenchannelMessage',{'body':_0x520b93,'log':_0xd821('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 238d3d7..b89be66 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 _0x5db8=['strategy','online','openchannelPause','../client','getOpenchannelQueues','Request','name','timeout'];(function(_0x48f1d9,_0x5c3dba){var _0x287b84=function(_0x37c8c){while(--_0x37c8c){_0x48f1d9['push'](_0x48f1d9['shift']());}};_0x287b84(++_0x5c3dba);}(_0x5db8,0xbb));var _0x85db=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0x5db8[_0x3f1710];return _0x528458;};'use strict';var client=require(_0x85db('0x0'));exports[_0x85db('0x1')]=function(){return function(){return client[_0x85db('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x85db('0x3'),_0x85db('0x4'),_0x85db('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x85db('0x3'),_0x85db('0x6'),_0x85db('0x7')]}]},'log':_0x85db('0x1')});};}; \ No newline at end of file +var _0x8260=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','strategy','User','Agents','name'];(function(_0x25d804,_0x5fac0f){var _0x2391d0=function(_0x38fa0b){while(--_0x38fa0b){_0x25d804['push'](_0x25d804['shift']());}};_0x2391d0(++_0x5fac0f);}(_0x8260,0x1c4));var _0x0826=function(_0x1dd997,_0x578bf5){_0x1dd997=_0x1dd997-0x0;var _0x440e4b=_0x8260[_0x1dd997];return _0x440e4b;};'use strict';var client=require(_0x0826('0x0'));exports[_0x0826('0x1')]=function(){return function(){return client[_0x0826('0x2')](_0x0826('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x0826('0x4')],'include':[{'model':_0x0826('0x5'),'as':_0x0826('0x6'),'attributes':['id',_0x0826('0x7'),_0x0826('0x8'),_0x0826('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 6a3a771..0603cba 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 _0xb1d9=['CreateOpenchannelQueueReport','update','DESC','../client','create','Request'];(function(_0x493552,_0x2cd527){var _0x243ea8=function(_0x531f6e){while(--_0x531f6e){_0x493552['push'](_0x493552['shift']());}};_0x243ea8(++_0x2cd527);}(_0xb1d9,0x147));var _0x9b1d=function(_0x1b1eb1,_0x5a57ab){_0x1b1eb1=_0x1b1eb1-0x0;var _0x44911b=_0xb1d9[_0x1b1eb1];return _0x44911b;};'use strict';var client=require(_0x9b1d('0x0'));exports[_0x9b1d('0x1')]=function(_0x3411e7){return client[_0x9b1d('0x2')](_0x9b1d('0x3'),{'body':_0x3411e7,'log':_0x9b1d('0x3')});};exports[_0x9b1d('0x4')]=function(_0x34a962,_0x231500){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x231500,'options':{'where':{'uniqueid':_0x34a962},'order':[['id',_0x9b1d('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x390d=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','Request'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x390d,0xdc));var _0xd390=function(_0x28c059,_0x25f5f2){_0x28c059=_0x28c059-0x0;var _0x12d8dd=_0x390d[_0x28c059];return _0x12d8dd;};'use strict';var client=require(_0xd390('0x0'));exports['create']=function(_0x4f6969){return client[_0xd390('0x1')](_0xd390('0x2'),{'body':_0x4f6969,'log':'CreateOpenchannelQueueReport'});};exports[_0xd390('0x3')]=function(_0x5d837f,_0x108dda){return client[_0xd390('0x1')](_0xd390('0x4'),{'body':_0x108dda,'options':{'where':{'uniqueid':_0x5d837f},'order':[['id',_0xd390('0x5')]],'limit':0x1},'log':_0xd390('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 73e624e..dc74b2b 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 _0x39a9=['addTags','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x4fd218,_0x1bbfa1){var _0x565d20=function(_0x50b1a0){while(--_0x50b1a0){_0x4fd218['push'](_0x4fd218['shift']());}};_0x565d20(++_0x1bbfa1);}(_0x39a9,0x1d0));var _0x939a=function(_0x489c95,_0x53159c){_0x489c95=_0x489c95-0x0;var _0x10e7a7=_0x39a9[_0x489c95];return _0x10e7a7;};'use strict';var client=require(_0x939a('0x0'));exports[_0x939a('0x1')]=function(_0xb72a0,_0x119223){return client[_0x939a('0x2')](_0x939a('0x3'),{'body':_0x119223,'options':{'where':{'id':_0xb72a0}},'log':_0x939a('0x4')});};exports[_0x939a('0x5')]=function(_0x450b95,_0x1030c6){return client[_0x939a('0x2')]('AddTagsToSmsInteraction',{'body':_0x1030c6,'options':{'where':{'id':_0x450b95}},'log':_0x939a('0x6')});}; \ No newline at end of file +var _0xa8eb=['updateSmsInteraction','AddTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8eb,0x179));var _0xba8e=function(_0x2c69a1,_0x201903){_0x2c69a1=_0x2c69a1-0x0;var _0x24bb91=_0xa8eb[_0x2c69a1];return _0x24bb91;};'use strict';var client=require(_0xba8e('0x0'));exports['update']=function(_0x26595f,_0x5757ad){return client[_0xba8e('0x1')](_0xba8e('0x2'),{'body':_0x5757ad,'options':{'where':{'id':_0x26595f}},'log':_0xba8e('0x3')});};exports['addTags']=function(_0x353df2,_0x368ce6){return client['Request'](_0xba8e('0x4'),{'body':_0x368ce6,'options':{'where':{'id':_0x353df2}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 42cf353..08e17e9 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 _0xba0c=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x116ef8,_0x90ff75){var _0x24e0af=function(_0x8e24fa){while(--_0x8e24fa){_0x116ef8['push'](_0x116ef8['shift']());}};_0x24e0af(++_0x90ff75);}(_0xba0c,0x1c1));var _0xcba0=function(_0x5a0603,_0x406003){_0x5a0603=_0x5a0603-0x0;var _0x54127f=_0xba0c[_0x5a0603];return _0x54127f;};'use strict';var client=require(_0xcba0('0x0'));exports['create']=function(_0x11bae3){return client[_0xcba0('0x1')](_0xcba0('0x2'),{'body':_0x11bae3,'log':_0xcba0('0x3')});}; \ No newline at end of file +var _0x503c=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x598892,_0x53eb04){var _0x10b457=function(_0x17deea){while(--_0x17deea){_0x598892['push'](_0x598892['shift']());}};_0x10b457(++_0x53eb04);}(_0x503c,0x1ca));var _0xc503=function(_0x27c1ab,_0x3734be){_0x27c1ab=_0x27c1ab-0x0;var _0x5087a3=_0x503c[_0x27c1ab];return _0x5087a3;};'use strict';var client=require(_0xc503('0x0'));exports[_0xc503('0x1')]=function(_0x5870fe){return client[_0xc503('0x2')](_0xc503('0x3'),{'body':_0x5870fe,'log':_0xc503('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 0e78cc9..983b82b 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x17158c,_0x58cb92){var _0x734f31=function(_0x2a7a84){while(--_0x2a7a84){_0x17158c['push'](_0x17158c['shift']());}};_0x734f31(++_0x58cb92);}(_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 +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x3fe9f5,_0x2c302b){var _0x5acbb4=function(_0x1fee42){while(--_0x1fee42){_0x3fe9f5['push'](_0x3fe9f5['shift']());}};_0x5acbb4(++_0x2c302b);}(_0x70e0,0x17b));var _0x070e=function(_0x433558,_0x4b8726){_0x433558=_0x433558-0x0;var _0x5b59e1=_0x70e0[_0x433558];return _0x5b59e1;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1a4c9ac..3ef4c84 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x3fe9a1,_0x51a9f3){var _0xbcb41=function(_0x5c7b3b){while(--_0x5c7b3b){_0x3fe9a1['push'](_0x3fe9a1['shift']());}};_0xbcb41(++_0x51a9f3);}(_0x3e74,0x175));var _0x43e7=function(_0x2c90a9,_0x5020ed){_0x2c90a9=_0x2c90a9-0x0;var _0x39be24=_0x3e74[_0x2c90a9];return _0x39be24;};'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 +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x48c998,_0x37d255){var _0x59c2a2=function(_0x40eaa2){while(--_0x40eaa2){_0x48c998['push'](_0x48c998['shift']());}};_0x59c2a2(++_0x37d255);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index c7ad545..378dffd 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(_0x3be949,_0x1a4fe6){var _0x5723d4=function(_0x2fd494){while(--_0x2fd494){_0x3be949['push'](_0x3be949['shift']());}};_0x5723d4(++_0x1a4fe6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x2b6599,_0x4b5e81){var _0x18431d=function(_0x51619d){while(--_0x51619d){_0x2b6599['push'](_0x2b6599['shift']());}};_0x18431d(++_0x4b5e81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 aa484e9..f8759d5 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 _0x2a07=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x2a07,0x74));var _0x72a0=function(_0x1331b2,_0x3df22b){_0x1331b2=_0x1331b2-0x0;var _0x10f741=_0x2a07[_0x1331b2];return _0x10f741;};'use strict';var client=require(_0x72a0('0x0'));exports[_0x72a0('0x1')]=function(_0x3ed8a9,_0x437db4){return client[_0x72a0('0x2')]('UpdateWhatsappInteraction',{'body':_0x437db4,'options':{'where':{'id':_0x3ed8a9}},'log':_0x72a0('0x3')});};exports[_0x72a0('0x4')]=function(_0x135982,_0x45b155){return client[_0x72a0('0x2')](_0x72a0('0x5'),{'body':_0x45b155,'options':{'where':{'id':_0x135982}},'log':_0x72a0('0x6')});}; \ No newline at end of file +var _0x39e6=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction','Request'];(function(_0x5ee4f3,_0x4b1dcc){var _0x5934b8=function(_0x1f50d1){while(--_0x1f50d1){_0x5ee4f3['push'](_0x5ee4f3['shift']());}};_0x5934b8(++_0x4b1dcc);}(_0x39e6,0x9e));var _0x639e=function(_0x332f01,_0x34ec04){_0x332f01=_0x332f01-0x0;var _0x236141=_0x39e6[_0x332f01];return _0x236141;};'use strict';var client=require(_0x639e('0x0'));exports['update']=function(_0x2b265a,_0x5719fc){return client['Request'](_0x639e('0x1'),{'body':_0x5719fc,'options':{'where':{'id':_0x2b265a}},'log':_0x639e('0x2')});};exports['addTags']=function(_0x467229,_0x207d6a){return client[_0x639e('0x3')](_0x639e('0x4'),{'body':_0x207d6a,'options':{'where':{'id':_0x467229}},'log':_0x639e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index c6d4763..35b6b48 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 _0x372d=['create','Request','CreateWhatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x372d,0xae));var _0xd372=function(_0x4c7eec,_0x4188d8){_0x4c7eec=_0x4c7eec-0x0;var _0xf6066c=_0x372d[_0x4c7eec];return _0xf6066c;};'use strict';var client=require('../client');exports[_0xd372('0x0')]=function(_0x429d88){return client[_0xd372('0x1')](_0xd372('0x2'),{'body':_0x429d88,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x6076=['Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x2344f8,_0x535448){var _0x142d66=function(_0x4f9f51){while(--_0x4f9f51){_0x2344f8['push'](_0x2344f8['shift']());}};_0x142d66(++_0x535448);}(_0x6076,0x11b));var _0x6607=function(_0x3df717,_0x182a24){_0x3df717=_0x3df717-0x0;var _0x4bf20b=_0x6076[_0x3df717];return _0x4bf20b;};'use strict';var client=require(_0x6607('0x0'));exports['create']=function(_0x7a844f){return client[_0x6607('0x1')](_0x6607('0x2'),{'body':_0x7a844f,'log':_0x6607('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3db2e94..ebbfac3 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 _0xf415=['strategy','User','Agents','name','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','timeout'];(function(_0x5b73bd,_0x3f352c){var _0x10048e=function(_0x1f206b){while(--_0x1f206b){_0x5b73bd['push'](_0x5b73bd['shift']());}};_0x10048e(++_0x3f352c);}(_0xf415,0x97));var _0x5f41=function(_0x7cc810,_0x1e192d){_0x7cc810=_0x7cc810-0x0;var _0x4ff9f6=_0xf415[_0x7cc810];return _0x4ff9f6;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x5f41('0x0'),{'options':{'raw':![],'attributes':['id','name',_0x5f41('0x1'),_0x5f41('0x2')],'include':[{'model':_0x5f41('0x3'),'as':_0x5f41('0x4'),'attributes':['id',_0x5f41('0x5'),_0x5f41('0x6'),_0x5f41('0x7')]}]},'log':_0x5f41('0x8')});};}; \ No newline at end of file +var _0xb02f=['strategy','User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0xc18afe,_0x2e94a0){var _0x1b6c13=function(_0x7d87b5){while(--_0x7d87b5){_0xc18afe['push'](_0xc18afe['shift']());}};_0x1b6c13(++_0x2e94a0);}(_0xb02f,0x1d0));var _0xfb02=function(_0x24c516,_0x6344c5){_0x24c516=_0x24c516-0x0;var _0x4b1a72=_0xb02f[_0x24c516];return _0x4b1a72;};'use strict';var client=require(_0xfb02('0x0'));exports[_0xfb02('0x1')]=function(){return function(){return client[_0xfb02('0x2')](_0xfb02('0x3'),{'options':{'raw':![],'attributes':['id',_0xfb02('0x4'),_0xfb02('0x5'),_0xfb02('0x6')],'include':[{'model':_0xfb02('0x7'),'as':_0xfb02('0x8'),'attributes':['id','name',_0xfb02('0x9'),'whatsappPause']}]},'log':_0xfb02('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index b98cc14..bc19846 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 _0xd221=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0xd221,0x1e8));var _0x1d22=function(_0x472277,_0x466470){_0x472277=_0x472277-0x0;var _0x239e64=_0xd221[_0x472277];return _0x239e64;};'use strict';var client=require(_0x1d22('0x0'));exports[_0x1d22('0x1')]=function(_0x478107){return client[_0x1d22('0x2')](_0x1d22('0x3'),{'body':_0x478107,'log':_0x1d22('0x3')});};exports[_0x1d22('0x4')]=function(_0x592b5d,_0x4182d9){return client[_0x1d22('0x2')](_0x1d22('0x5'),{'body':_0x4182d9,'options':{'where':{'uniqueid':_0x592b5d},'order':[['id',_0x1d22('0x6')]],'limit':0x1},'log':_0x1d22('0x5')});}; \ No newline at end of file +var _0x8a70=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x2df72b,_0x1e3cfe){var _0x37cdd3=function(_0x37e012){while(--_0x37e012){_0x2df72b['push'](_0x2df72b['shift']());}};_0x37cdd3(++_0x1e3cfe);}(_0x8a70,0xae));var _0x08a7=function(_0x48dfc7,_0x28410f){_0x48dfc7=_0x48dfc7-0x0;var _0x553cbf=_0x8a70[_0x48dfc7];return _0x553cbf;};'use strict';var client=require(_0x08a7('0x0'));exports[_0x08a7('0x1')]=function(_0x5933da){return client[_0x08a7('0x2')](_0x08a7('0x3'),{'body':_0x5933da,'log':'CreateWhatsappQueueReport'});};exports[_0x08a7('0x4')]=function(_0x4f934d,_0x1e5ccd){return client['Request'](_0x08a7('0x5'),{'body':_0x1e5ccd,'options':{'where':{'uniqueid':_0x4f934d},'order':[['id',_0x08a7('0x6')]],'limit':0x1},'log':_0x08a7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 00376c6..4724f91 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 _0x8646=['name','toLowerCase','error','[%s][AGENT]\x20%s','join','stop','agents','timeout','atimeout','channel','rules','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]'];(function(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_0x8646,0x65));var _0x6864=function(_0x4538a4,_0x394e7d){_0x4538a4=_0x4538a4-0x0;var _0x3e6a90=_0x8646[_0x4538a4];return _0x3e6a90;};'use strict';var schema=require(_0x6864('0x0'));var _=require(_0x6864('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x6864('0x2'))(_0x6864('0x3'));var strategy=require(_0x6864('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x6864('0x5')},'timeout':{'type':_0x6864('0x6'),'message':_0x6864('0x7')}});function writeLog(_0x4821bf,_0x1b9aa1,_0x5334bf){return logger[_0x6864('0x8')](util[_0x6864('0x9')](_0x6864('0xa'),_0x4821bf,_0x1b9aa1[_0x6864('0xb')],_0x5334bf));}function handleFindAgent(_0x5bfacc){return function(_0x23ee59){return _0x23ee59['name']['toLowerCase']()===_0x5bfacc[_0x6864('0xc')]();};}exports['consequence']=function(_0x50c097,_0x4df0a7,_0x467bbe,_0x289227){return function(_0x287129){try{var _0x1f1dcf={'name':_0x4df0a7[0x0],'timeout':_0x4df0a7[0x1]};var _0x3319c0=queue[_0x6864('0x0')](_0x1f1dcf,{'typecast':!![]});if(_0x3319c0['length']){logger[_0x6864('0xd')](_0x6864('0xe'),_0x50c097,_['map'](_0x3319c0,'message')[_0x6864('0xf')](',\x20'));_0x287129[_0x6864('0x10')]();}else{var _0x45f3ee=_['find'](_0x467bbe[_0x6864('0x11')],handleFindAgent(_0x1f1dcf[_0x6864('0xb')]));if(_0x45f3ee){var _0x591deb=(_0x1f1dcf[_0x6864('0x12')]||0xa)*0x3e8;var _0x29172e,_0x3f555e;var _0x806280=seqqueue['createQueue'](_0x591deb);_0x806280['id']=_0x50c097;_0x806280[_0x6864('0x13')]=_0x591deb;_0x806280[_0x6864('0x14')]=_0x289227[_0x6864('0x14')];writeLog(_0x50c097,_0x45f3ee,util[_0x6864('0x9')]('START:%s',_0x591deb));_0x467bbe[_0x6864('0x15')][_0x50c097]['on']('end',function(){logger[_0x6864('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x50c097);clearTimeout(_0x3f555e);_0x3f555e=undefined;_0x806280[_0x6864('0x16')]();if(_0x467bbe[_0x6864('0x15')][_0x50c097]){delete _0x467bbe['rules'][_0x50c097];}_0x287129[_0x6864('0x10')]();});_0x467bbe['rules'][_0x50c097]['on']('complete',function(){if(_0x467bbe[_0x6864('0x15')][_0x50c097]){delete _0x467bbe[_0x6864('0x15')][_0x50c097];}});_0x3f555e=setTimeout(function(){logger[_0x6864('0x8')](_0x6864('0x17'),_0x50c097);clearTimeout(_0x3f555e);_0x806280[_0x6864('0x16')]();_0x287129[_0x6864('0x18')]();},_0x591deb);strategy[_0x6864('0x19')](_0x806280,_0x45f3ee,_0x467bbe,_0x289227);}else{logger['error'](_0x6864('0x1a'),_0x50c097,_0x1f1dcf['name']);_0x287129['stop']();}}}catch(_0x4c94b9){console['log'](_0x4c94b9);logger[_0x6864('0xd')](_0x6864('0x1b'),_0x50c097,_0x4c94b9['stack']);_0x287129[_0x6864('0x10')]();}};}; \ No newline at end of file +var _0x95d6=['complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','lodash','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','join','stop','timeout','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x3c8f2c,_0x413734){var _0x537650=function(_0x2dcbfe){while(--_0x2dcbfe){_0x3c8f2c['push'](_0x3c8f2c['shift']());}};_0x537650(++_0x413734);}(_0x95d6,0xdf));var _0x695d=function(_0x1321a8,_0x125409){_0x1321a8=_0x1321a8-0x0;var _0x3fd7de=_0x95d6[_0x1321a8];return _0x3fd7de;};'use strict';var schema=require('validate');var _=require(_0x695d('0x0'));var util=require('util');var seqqueue=require(_0x695d('0x1'));var logger=require(_0x695d('0x2'))('routing');var strategy=require(_0x695d('0x3'));var queue=schema({'name':{'type':_0x695d('0x4'),'required':!![],'message':_0x695d('0x5')},'timeout':{'type':_0x695d('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x433991,_0x23b8c2,_0x52a9fa){return logger['info'](util[_0x695d('0x7')](_0x695d('0x8'),_0x433991,_0x23b8c2[_0x695d('0x9')],_0x52a9fa));}function handleFindAgent(_0x51faa5){return function(_0x2497bb){return _0x2497bb[_0x695d('0x9')][_0x695d('0xa')]()===_0x51faa5[_0x695d('0xa')]();};}exports[_0x695d('0xb')]=function(_0x13b351,_0x541f56,_0x5227ae,_0x5e1167){return function(_0x5878e6){try{var _0x521e2f={'name':_0x541f56[0x0],'timeout':_0x541f56[0x1]};var _0x490fd3=queue[_0x695d('0xc')](_0x521e2f,{'typecast':!![]});if(_0x490fd3[_0x695d('0xd')]){logger[_0x695d('0xe')](_0x695d('0xf'),_0x13b351,_['map'](_0x490fd3,_0x695d('0x10'))[_0x695d('0x11')](',\x20'));_0x5878e6[_0x695d('0x12')]();}else{var _0x3626e0=_['find'](_0x5227ae['agents'],handleFindAgent(_0x521e2f['name']));if(_0x3626e0){var _0x12ae35=(_0x521e2f[_0x695d('0x13')]||0xa)*0x3e8;var _0x58eebf,_0xb2a809;var _0x2e66c4=seqqueue[_0x695d('0x14')](_0x12ae35);_0x2e66c4['id']=_0x13b351;_0x2e66c4[_0x695d('0x15')]=_0x12ae35;_0x2e66c4['channel']=_0x5e1167[_0x695d('0x16')];writeLog(_0x13b351,_0x3626e0,util[_0x695d('0x7')](_0x695d('0x17'),_0x12ae35));_0x5227ae[_0x695d('0x18')][_0x13b351]['on'](_0x695d('0x19'),function(){logger[_0x695d('0x1a')](_0x695d('0x1b'),_0x13b351);clearTimeout(_0xb2a809);_0xb2a809=undefined;_0x2e66c4[_0x695d('0x1c')]();if(_0x5227ae[_0x695d('0x18')][_0x13b351]){delete _0x5227ae[_0x695d('0x18')][_0x13b351];}_0x5878e6[_0x695d('0x12')]();});_0x5227ae['rules'][_0x13b351]['on'](_0x695d('0x1d'),function(){if(_0x5227ae[_0x695d('0x18')][_0x13b351]){delete _0x5227ae[_0x695d('0x18')][_0x13b351];}});_0xb2a809=setTimeout(function(){logger['info'](_0x695d('0x1e'),_0x13b351);clearTimeout(_0xb2a809);_0x2e66c4[_0x695d('0x1c')]();_0x5878e6[_0x695d('0x1f')]();},_0x12ae35);strategy[_0x695d('0x20')](_0x2e66c4,_0x3626e0,_0x5227ae,_0x5e1167);}else{logger['error'](_0x695d('0x21'),_0x13b351,_0x521e2f['name']);_0x5878e6[_0x695d('0x12')]();}}}catch(_0x39d52a){console[_0x695d('0x22')](_0x39d52a);logger[_0x695d('0xe')](_0x695d('0x23'),_0x13b351,_0x39d52a['stack']);_0x5878e6[_0x695d('0x12')]();}};}; \ 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 9eadc59..0388d01 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 _0xa5a3=['error','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','account','upperFirst','InteractionId','created','body','getMustacheRender','Message','create','then','catch','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa5a3,0x12c));var _0x3a5a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa5a3[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3a5a('0x0'));var moment=require(_0x3a5a('0x1'));var AWS=require('aws-sdk');var utils=require(_0x3a5a('0x2'));var logger=require(_0x3a5a('0x3'))(_0x3a5a('0x4'));var rpc={'chatMessage':require(_0x3a5a('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3a5a('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3a5a('0x7')),'whatsappMessage':require(_0x3a5a('0x8'))};exports[_0x3a5a('0x9')]=function(_0x5daeb1,_0x187a1f){return function(_0x742d0d){try{if(!_[_0x3a5a('0xa')](this[_0x3a5a('0xb')][_0x3a5a('0xc')])){logger[_0x3a5a('0xd')](_0x3a5a('0xe'),_0x5daeb1,_0x3a5a('0xf'));return _0x742d0d[_0x3a5a('0x10')]();}var _0x2f5b8d={'ContactId':this[_0x3a5a('0x11')]['id'],'sentAt':moment()[_0x3a5a('0x12')](_0x3a5a('0x13')),'direction':'out'};if(this[_0x3a5a('0x14')]===_0x3a5a('0x15')||this[_0x3a5a('0x14')]===_0x3a5a('0x16')){_0x2f5b8d[_0x3a5a('0x17')]=this[_0x3a5a('0xb')]['phone'];}var _0x4da416=this[_0x3a5a('0x14')];if(_0x4da416===_0x3a5a('0x18')){_0x2f5b8d['ChatWebsiteId']=this[_0x3a5a('0x19')]['id'];}else{_0x2f5b8d[_[_0x3a5a('0x1a')](_0x4da416)+'AccountId']=this[_0x3a5a('0x19')]['id'];}_0x2f5b8d[_[_0x3a5a('0x1a')](_0x4da416)+_0x3a5a('0x1b')]=this[_0x3a5a('0xb')]['id'];if(this['interaction'][_0x3a5a('0x1c')]){var _0x22d9b0=_0x187a1f[0x4];if(!_['isEmpty'](_0x22d9b0)){_0x2f5b8d[_0x3a5a('0x1d')]=utils[_0x3a5a('0x1e')](_0x22d9b0,this);return rpc[_0x4da416+_0x3a5a('0x1f')][_0x3a5a('0x20')](_0x2f5b8d)[_0x3a5a('0x21')](function(_0x54a636){logger[_0x3a5a('0xd')](_0x3a5a('0xe'),_0x5daeb1,_0x2f5b8d[_0x3a5a('0x1d')]);})[_0x3a5a('0x22')](function(_0x30e824){logger['error'](_0x3a5a('0xe'),_0x5daeb1,JSON[_0x3a5a('0x23')](_0x30e824));})[_0x3a5a('0x24')](function(){logger[_0x3a5a('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5daeb1);_0x742d0d[_0x3a5a('0x25')]();});}else{logger['info'](_0x3a5a('0x26'),_0x5daeb1);_0x742d0d[_0x3a5a('0x25')]();}}else{var _0x1a42a7=this;var _0x4ecdf5=new AWS[(_0x3a5a('0x27'))]({'accessKeyId':_0x187a1f[0x0],'secretAccessKey':_0x187a1f[0x1],'region':_0x187a1f[0x2]});var _0x1b6891={'botAlias':_0x3a5a('0x28'),'botName':_0x187a1f[0x3],'inputText':this[_0x3a5a('0x29')][_0x3a5a('0x1d')],'userId':this[_0x3a5a('0x14')]+':'+this[_0x3a5a('0xb')]['id']['toString']()};_0x4ecdf5[_0x3a5a('0x2a')](_0x1b6891,function(_0x5a6173,_0x9c3468){if(_0x5a6173){logger[_0x3a5a('0x2b')](_0x3a5a('0xe'),_0x5daeb1,_0x5a6173[_0x3a5a('0x29')]);_0x742d0d[_0x3a5a('0x10')]();}else if(_0x9c3468&&_0x9c3468['message']){_0x1a42a7[_0x3a5a('0x1d')][_0x3a5a('0x2c')]=_0x9c3468;_0x2f5b8d[_0x3a5a('0x1d')]=_0x9c3468['message'];_0x2f5b8d[_0x3a5a('0x2d')]=_0x3a5a('0x2c');_0x2f5b8d[_0x3a5a('0x2e')]=JSON[_0x3a5a('0x23')](_0x9c3468);return rpc[_0x4da416+_0x3a5a('0x1f')][_0x3a5a('0x20')](_0x2f5b8d)[_0x3a5a('0x21')](function(_0x398c6e){logger[_0x3a5a('0xd')](_0x3a5a('0xe'),_0x5daeb1,_0x2f5b8d['body']);if(_0x9c3468[_0x3a5a('0x2f')]==_0x3a5a('0x30')){_0x742d0d['next']();}else{_0x742d0d[_0x3a5a('0x25')]();}})[_0x3a5a('0x22')](function(_0x53f60a){logger[_0x3a5a('0x2b')](_0x3a5a('0xe'),_0x5daeb1,JSON[_0x3a5a('0x23')](_0x53f60a));_0x742d0d['next']();});}else{_0x742d0d[_0x3a5a('0x10')]();}});}}catch(_0x56f46b){logger[_0x3a5a('0x2b')](_0x3a5a('0xe'),_0x5daeb1,JSON[_0x3a5a('0x23')](_0x56f46b));_0x742d0d['stop']();}};}; \ No newline at end of file +var _0xa563=['Message','create','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','error','amazonlex','providerName','providerResponse','then','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender'];(function(_0x3216f5,_0xe32e8a){var _0x17035a=function(_0x5f28cd){while(--_0x5f28cd){_0x3216f5['push'](_0x3216f5['shift']());}};_0x17035a(++_0xe32e8a);}(_0xa563,0xae));var _0x3a56=function(_0x50cb49,_0x398672){_0x50cb49=_0x50cb49-0x0;var _0xc00bdb=_0xa563[_0x50cb49];return _0xc00bdb;};'use strict';var _=require(_0x3a56('0x0'));var moment=require(_0x3a56('0x1'));var AWS=require(_0x3a56('0x2'));var utils=require('./utils');var logger=require(_0x3a56('0x3'))(_0x3a56('0x4'));var rpc={'chatMessage':require(_0x3a56('0x5')),'openchannelMessage':require(_0x3a56('0x6')),'mailMessage':require(_0x3a56('0x7')),'smsMessage':require(_0x3a56('0x8')),'faxMessage':require(_0x3a56('0x9')),'whatsappMessage':require(_0x3a56('0xa'))};exports[_0x3a56('0xb')]=function(_0xefd21,_0x181666){return function(_0x2900a6){try{if(!_[_0x3a56('0xc')](this[_0x3a56('0xd')][_0x3a56('0xe')])){logger[_0x3a56('0xf')](_0x3a56('0x10'),_0xefd21,_0x3a56('0x11'));return _0x2900a6[_0x3a56('0x12')]();}var _0x97fceb={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3a56('0x13')](_0x3a56('0x14')),'direction':_0x3a56('0x15')};if(this[_0x3a56('0x16')]==='sms'||this[_0x3a56('0x16')]==='whatsapp'){_0x97fceb['phone']=this[_0x3a56('0xd')][_0x3a56('0x17')];}var _0x662e04=this[_0x3a56('0x16')];if(_0x662e04===_0x3a56('0x18')){_0x97fceb[_0x3a56('0x19')]=this[_0x3a56('0x1a')]['id'];}else{_0x97fceb[_[_0x3a56('0x1b')](_0x662e04)+_0x3a56('0x1c')]=this['account']['id'];}_0x97fceb[_[_0x3a56('0x1b')](_0x662e04)+_0x3a56('0x1d')]=this[_0x3a56('0xd')]['id'];if(this['interaction'][_0x3a56('0x1e')]){var _0x4efc2b=_0x181666[0x4];if(!_[_0x3a56('0x1f')](_0x4efc2b)){_0x97fceb[_0x3a56('0x20')]=utils[_0x3a56('0x21')](_0x4efc2b,this);return rpc[_0x662e04+_0x3a56('0x22')][_0x3a56('0x23')](_0x97fceb)['then'](function(_0x1115fe){logger[_0x3a56('0xf')]('[%s][AMAZONLEX]\x20%s',_0xefd21,_0x97fceb[_0x3a56('0x20')]);})[_0x3a56('0x24')](function(_0x3ef5a3){logger['error']('[%s][AMAZONLEX]\x20%s',_0xefd21,JSON[_0x3a56('0x25')](_0x3ef5a3));})[_0x3a56('0x26')](function(){logger[_0x3a56('0xf')](_0x3a56('0x27'),_0xefd21);_0x2900a6[_0x3a56('0x28')]();});}else{logger[_0x3a56('0xf')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xefd21);_0x2900a6[_0x3a56('0x28')]();}}else{var _0x4c6147=this;var _0x540ed3=new AWS[(_0x3a56('0x29'))]({'accessKeyId':_0x181666[0x0],'secretAccessKey':_0x181666[0x1],'region':_0x181666[0x2]});var _0x529374={'botAlias':_0x3a56('0x2a'),'botName':_0x181666[0x3],'inputText':this[_0x3a56('0x2b')]['body'],'userId':this[_0x3a56('0x16')]+':'+this[_0x3a56('0xd')]['id'][_0x3a56('0x2c')]()};_0x540ed3['postText'](_0x529374,function(_0x54f280,_0x1a96ad){if(_0x54f280){logger[_0x3a56('0x2d')]('[%s][AMAZONLEX]\x20%s',_0xefd21,_0x54f280[_0x3a56('0x2b')]);_0x2900a6['next']();}else if(_0x1a96ad&&_0x1a96ad[_0x3a56('0x2b')]){_0x4c6147[_0x3a56('0x20')][_0x3a56('0x2e')]=_0x1a96ad;_0x97fceb[_0x3a56('0x20')]=_0x1a96ad[_0x3a56('0x2b')];_0x97fceb[_0x3a56('0x2f')]='amazonlex';_0x97fceb[_0x3a56('0x30')]=JSON[_0x3a56('0x25')](_0x1a96ad);return rpc[_0x662e04+_0x3a56('0x22')][_0x3a56('0x23')](_0x97fceb)[_0x3a56('0x31')](function(_0x29013c){logger['info'](_0x3a56('0x10'),_0xefd21,_0x97fceb['body']);if(_0x1a96ad[_0x3a56('0x32')]==_0x3a56('0x33')){_0x2900a6[_0x3a56('0x12')]();}else{_0x2900a6[_0x3a56('0x28')]();}})[_0x3a56('0x24')](function(_0x412d73){logger[_0x3a56('0x2d')](_0x3a56('0x10'),_0xefd21,JSON[_0x3a56('0x25')](_0x412d73));_0x2900a6[_0x3a56('0x12')]();});}else{_0x2900a6[_0x3a56('0x12')]();}});}}catch(_0x3b1ef5){logger[_0x3a56('0x2d')](_0x3a56('0x10'),_0xefd21,JSON[_0x3a56('0x25')](_0x3b1ef5));_0x2900a6[_0x3a56('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 3536536..977245a 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 _0x4d5a=['consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','inReplyTo','messageId','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','Message','create','stringify','error','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0xae312f,_0x312c5d){var _0xdba92=function(_0x1d83bb){while(--_0x1d83bb){_0xae312f['push'](_0xae312f['shift']());}};_0xdba92(++_0x312c5d);}(_0x4d5a,0x146));var _0xa4d5=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x4d5a[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xa4d5('0x0'));var moment=require('moment');var utils=require(_0xa4d5('0x1'));var logger=require(_0xa4d5('0x2'))(_0xa4d5('0x3'));var rpc={'chatMessage':require(_0xa4d5('0x4')),'openchannelMessage':require(_0xa4d5('0x5')),'mailMessage':require(_0xa4d5('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa4d5('0x7')),'whatsappMessage':require(_0xa4d5('0x8')),'chatInteraction':require(_0xa4d5('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xa4d5('0xa')),'smsInteraction':require(_0xa4d5('0xb')),'faxInteraction':require(_0xa4d5('0xc')),'whatsappInteraction':require(_0xa4d5('0xd'))};var mailRpc=require('../../mailRpc');exports[_0xa4d5('0xe')]=function(_0x27b633,_0x46b282,_0x1dd885,_0xb75969){return function(_0x136b6d){try{var _0x25a971=this[_0xa4d5('0xf')];if(_0x25a971===_0xa4d5('0x10')&&_0xb75969[_0xa4d5('0x11')][_0xa4d5('0x12')]){logger[_0xa4d5('0x13')](_0xa4d5('0x14'),_0x27b633,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x136b6d[_0xa4d5('0x15')]();}if(_0x46b282[0x0]==='1'&&(_[_0xa4d5('0x16')](this[_0xa4d5('0x17')][_0xa4d5('0x18')])||!this[_0xa4d5('0x17')]['created'])){logger[_0xa4d5('0x13')](_0xa4d5('0x14'),_0x27b633,_0xa4d5('0x19'));return _0x136b6d[_0xa4d5('0x15')]();}if(_0x46b282[0x0]==='2'&&this[_0xa4d5('0x17')][_0xa4d5('0x1a')]){logger[_0xa4d5('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x27b633,'One\x20Time\x20already\x20sent');return _0x136b6d[_0xa4d5('0x15')]();}var _0x514adb={'ContactId':this[_0xa4d5('0x1b')]['id'],'sentAt':moment()['format'](_0xa4d5('0x1c')),'direction':_0xa4d5('0x1d')};if(this[_0xa4d5('0xf')]===_0xa4d5('0x10')){_0x514adb[_0xa4d5('0x11')]=utils['getMustacheRender'](_0x46b282[0x2],this);}else{_0x514adb[_0xa4d5('0x11')]=utils[_0xa4d5('0x1e')](_0x46b282[0x1],this);}if(this[_0xa4d5('0x1f')]){_0x514adb['to']=this[_0xa4d5('0x1f')]['from']||'';if(this[_0xa4d5('0xf')]===_0xa4d5('0x10')&&_0x46b282[0x1]==='1'){_0x514adb['cc']=this[_0xa4d5('0x1f')]['cc']||'';}_0x514adb[_0xa4d5('0x20')]=this[_0xa4d5('0x1f')]['to']||'';_0x514adb['phone']=this[_0xa4d5('0x1f')][_0xa4d5('0x21')]||'';_0x514adb[_0xa4d5('0x22')]=!![];if(this['message']['subject']){_0x514adb[_0xa4d5('0x23')]='';_0x514adb['subject']+=_['startsWith'](this[_0xa4d5('0x1f')][_0xa4d5('0x23')],'Re:')?'':_0xa4d5('0x24');_0x514adb['subject']+=this[_0xa4d5('0x1f')][_0xa4d5('0x23')];}}if(this[_0xa4d5('0xf')]===_0xa4d5('0x25')){_0x514adb[_0xa4d5('0x26')]=this[_0xa4d5('0x27')]['id'];}else{_0x514adb[_[_0xa4d5('0x28')](this[_0xa4d5('0xf')])+_0xa4d5('0x29')]=this[_0xa4d5('0x27')]['id'];}_0x514adb[_[_0xa4d5('0x28')](this[_0xa4d5('0xf')])+_0xa4d5('0x2a')]=this[_0xa4d5('0x17')]['id'];var _0x2b971b=this[_0xa4d5('0x17')];if(rpc[this['channel']+'Message']){if(this[_0xa4d5('0xf')]==='mail'){_0x514adb[_0xa4d5('0x2b')]=this['message'][_0xa4d5('0x2c')];_0x514adb['html']=_0xa4d5('0x2d')+_[_0xa4d5('0x2e')](_0x514adb['body'],_0xa4d5('0x2f'),_0xa4d5('0x30'))+_0xa4d5('0x31');_0x514adb[_0xa4d5('0x32')]={'Auto-Submitted':_0xa4d5('0x33'),'X-Auto-Response-Suppress':_0xa4d5('0x34'),'Precedence':_0xa4d5('0x35')};return mailRpc[_0xa4d5('0x36')](this[_0xa4d5('0x27')][_0xa4d5('0x37')],_0x514adb)[_0xa4d5('0x38')](function(_0x50ddf6){logger[_0xa4d5('0x13')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x27b633);_0x514adb[_0xa4d5('0x2c')]=_0x50ddf6['message'][_0xa4d5('0x2c')];return rpc[_0x25a971+_0xa4d5('0x39')][_0xa4d5('0x3a')](_0x514adb);})[_0xa4d5('0x38')](function(_0x12f207){logger['info'](_0xa4d5('0x14'),_0x27b633,JSON[_0xa4d5('0x3b')](_0x12f207));})['catch'](function(_0x21ab5f){logger[_0xa4d5('0x3c')]('[RPC][%s][AUTOREPLY]\x20%s',_0x27b633,JSON[_0xa4d5('0x3b')](_0x21ab5f));})[_0xa4d5('0x3d')](function(){Promise[_0xa4d5('0x3e')]()[_0xa4d5('0x38')](function(){if(_0x46b282[0x0]!=='2'||_0x2b971b[_0xa4d5('0x1a')])return;return rpc[_0x25a971+_0xa4d5('0x3f')][_0xa4d5('0x40')](_0x2b971b['id'],{'autoreplyExecuted':!![]})[_0xa4d5('0x38')](function(_0x42d200){logger['info'](_0xa4d5('0x41'),_0x27b633,JSON['stringify'](_0x42d200));})[_0xa4d5('0x42')](function(_0x57ff3b){logger[_0xa4d5('0x3c')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x27b633,JSON[_0xa4d5('0x3b')](_0x57ff3b));});})[_0xa4d5('0x38')](function(){_0x136b6d[_0xa4d5('0x15')]();});});}else{return rpc[this['channel']+_0xa4d5('0x39')][_0xa4d5('0x3a')](_0x514adb)['then'](function(){logger[_0xa4d5('0x13')](_0xa4d5('0x14'),_0x27b633,_0x514adb[_0xa4d5('0x11')]);})[_0xa4d5('0x42')](function(_0x289334){logger[_0xa4d5('0x3c')](_0xa4d5('0x14'),_0x27b633,JSON[_0xa4d5('0x3b')](_0x289334));})[_0xa4d5('0x3d')](function(){Promise[_0xa4d5('0x3e')]()[_0xa4d5('0x38')](function(){if(_0x46b282[0x0]!=='2'||_0x2b971b[_0xa4d5('0x1a')])return;return rpc[_0x25a971+_0xa4d5('0x3f')][_0xa4d5('0x40')](_0x2b971b['id'],{'autoreplyExecuted':!![]})[_0xa4d5('0x38')](function(_0x54f580){logger[_0xa4d5('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x27b633,JSON['stringify'](_0x54f580));})[_0xa4d5('0x42')](function(_0x376a89){logger[_0xa4d5('0x3c')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x27b633,JSON[_0xa4d5('0x3b')](_0x376a89));});})[_0xa4d5('0x38')](function(){_0x136b6d[_0xa4d5('0x15')]();});});}}}catch(_0xe434ca){logger['error']('[%s][AUTOREPLY]\x20%s',_0x27b633,JSON['stringify'](_0xe434ca));_0x136b6d[_0xa4d5('0x43')]();}};}; \ No newline at end of file +var _0x0f3f=['isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','account','upperFirst','AccountId','Message','inReplyTo','html','','replace','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','error','finally','resolve','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','channel','mail','body'];(function(_0x33a967,_0x15fe41){var _0x4aeb18=function(_0x42a371){while(--_0x42a371){_0x33a967['push'](_0x33a967['shift']());}};_0x4aeb18(++_0x15fe41);}(_0x0f3f,0xb0));var _0xf0f3=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x0f3f[_0x5ba549];return _0x36e3a1;};'use strict';var _=require('lodash');var moment=require(_0xf0f3('0x0'));var utils=require(_0xf0f3('0x1'));var logger=require(_0xf0f3('0x2'))('routing');var rpc={'chatMessage':require(_0xf0f3('0x3')),'openchannelMessage':require(_0xf0f3('0x4')),'mailMessage':require(_0xf0f3('0x5')),'smsMessage':require(_0xf0f3('0x6')),'faxMessage':require(_0xf0f3('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xf0f3('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xf0f3('0x9')),'smsInteraction':require(_0xf0f3('0xa')),'faxInteraction':require(_0xf0f3('0xb')),'whatsappInteraction':require(_0xf0f3('0xc'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x26debd,_0x4e6113,_0x5eb9ab,_0x4c4aa1){return function(_0x372810){try{var _0x561204=this[_0xf0f3('0xd')];if(_0x561204===_0xf0f3('0xe')&&_0x4c4aa1[_0xf0f3('0xf')][_0xf0f3('0x10')]){logger[_0xf0f3('0x11')]('[%s][AUTOREPLY]\x20%s',_0x26debd,_0xf0f3('0x12'));return _0x372810[_0xf0f3('0x13')]();}if(_0x4e6113[0x0]==='1'&&(_['isNil'](this[_0xf0f3('0x14')][_0xf0f3('0x15')])||!this[_0xf0f3('0x14')]['created'])){logger[_0xf0f3('0x11')](_0xf0f3('0x16'),_0x26debd,_0xf0f3('0x17'));return _0x372810[_0xf0f3('0x13')]();}if(_0x4e6113[0x0]==='2'&&this[_0xf0f3('0x14')][_0xf0f3('0x18')]){logger[_0xf0f3('0x11')](_0xf0f3('0x19'),_0x26debd,_0xf0f3('0x1a'));return _0x372810['next']();}var _0x14a9ea={'ContactId':this[_0xf0f3('0x1b')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf0f3('0x1c')};if(this['channel']===_0xf0f3('0xe')){_0x14a9ea[_0xf0f3('0xf')]=utils['getMustacheRender'](_0x4e6113[0x2],this);}else{_0x14a9ea['body']=utils[_0xf0f3('0x1d')](_0x4e6113[0x1],this);}if(this[_0xf0f3('0x1e')]){_0x14a9ea['to']=this['message'][_0xf0f3('0x1f')]||'';if(this['channel']==='mail'&&_0x4e6113[0x1]==='1'){_0x14a9ea['cc']=this[_0xf0f3('0x1e')]['cc']||'';}_0x14a9ea[_0xf0f3('0x1f')]=this[_0xf0f3('0x1e')]['to']||'';_0x14a9ea[_0xf0f3('0x20')]=this[_0xf0f3('0x1e')][_0xf0f3('0x20')]||'';_0x14a9ea[_0xf0f3('0x21')]=!![];if(this['message'][_0xf0f3('0x22')]){_0x14a9ea['subject']='';_0x14a9ea[_0xf0f3('0x22')]+=_[_0xf0f3('0x23')](this[_0xf0f3('0x1e')][_0xf0f3('0x22')],_0xf0f3('0x24'))?'':'Re:\x20';_0x14a9ea[_0xf0f3('0x22')]+=this[_0xf0f3('0x1e')][_0xf0f3('0x22')];}}if(this[_0xf0f3('0xd')]===_0xf0f3('0x25')){_0x14a9ea['ChatWebsiteId']=this[_0xf0f3('0x26')]['id'];}else{_0x14a9ea[_[_0xf0f3('0x27')](this['channel'])+_0xf0f3('0x28')]=this[_0xf0f3('0x26')]['id'];}_0x14a9ea[_[_0xf0f3('0x27')](this['channel'])+'InteractionId']=this[_0xf0f3('0x14')]['id'];var _0x425a86=this[_0xf0f3('0x14')];if(rpc[this[_0xf0f3('0xd')]+_0xf0f3('0x29')]){if(this[_0xf0f3('0xd')]==='mail'){_0x14a9ea[_0xf0f3('0x2a')]=this[_0xf0f3('0x1e')]['messageId'];_0x14a9ea[_0xf0f3('0x2b')]=_0xf0f3('0x2c')+_[_0xf0f3('0x2d')](_0x14a9ea[_0xf0f3('0xf')],'';_0x14a9ea[_0xf0f3('0x2e')]={'Auto-Submitted':_0xf0f3('0x2f'),'X-Auto-Response-Suppress':_0xf0f3('0x30'),'Precedence':_0xf0f3('0x31')};return mailRpc[_0xf0f3('0x32')](this['account']['smtpOptions'],_0x14a9ea)[_0xf0f3('0x33')](function(_0x58bf93){logger[_0xf0f3('0x11')](_0xf0f3('0x34'),_0x26debd);_0x14a9ea[_0xf0f3('0x35')]=_0x58bf93['message'][_0xf0f3('0x35')];return rpc[_0x561204+_0xf0f3('0x29')][_0xf0f3('0x36')](_0x14a9ea);})[_0xf0f3('0x33')](function(_0x5d9487){logger['info']('[%s][AUTOREPLY]\x20%s',_0x26debd,JSON[_0xf0f3('0x37')](_0x5d9487));})['catch'](function(_0x6ab448){logger[_0xf0f3('0x38')]('[RPC][%s][AUTOREPLY]\x20%s',_0x26debd,JSON['stringify'](_0x6ab448));})[_0xf0f3('0x39')](function(){Promise[_0xf0f3('0x3a')]()[_0xf0f3('0x33')](function(){if(_0x4e6113[0x0]!=='2'||_0x425a86[_0xf0f3('0x18')])return;return rpc[_0x561204+_0xf0f3('0x3b')][_0xf0f3('0x3c')](_0x425a86['id'],{'autoreplyExecuted':!![]})[_0xf0f3('0x33')](function(_0x8fbc4a){logger[_0xf0f3('0x11')](_0xf0f3('0x19'),_0x26debd,JSON[_0xf0f3('0x37')](_0x8fbc4a));})[_0xf0f3('0x3d')](function(_0x41832e){logger[_0xf0f3('0x38')](_0xf0f3('0x3e'),_0x26debd,JSON[_0xf0f3('0x37')](_0x41832e));});})[_0xf0f3('0x33')](function(){_0x372810[_0xf0f3('0x13')]();});});}else{return rpc[this[_0xf0f3('0xd')]+'Message'][_0xf0f3('0x36')](_0x14a9ea)['then'](function(){logger[_0xf0f3('0x11')](_0xf0f3('0x16'),_0x26debd,_0x14a9ea['body']);})['catch'](function(_0x18c797){logger[_0xf0f3('0x38')](_0xf0f3('0x16'),_0x26debd,JSON[_0xf0f3('0x37')](_0x18c797));})[_0xf0f3('0x39')](function(){Promise[_0xf0f3('0x3a')]()[_0xf0f3('0x33')](function(){if(_0x4e6113[0x0]!=='2'||_0x425a86[_0xf0f3('0x18')])return;return rpc[_0x561204+_0xf0f3('0x3b')][_0xf0f3('0x3c')](_0x425a86['id'],{'autoreplyExecuted':!![]})[_0xf0f3('0x33')](function(_0x45b615){logger[_0xf0f3('0x11')](_0xf0f3('0x19'),_0x26debd,JSON[_0xf0f3('0x37')](_0x45b615));})[_0xf0f3('0x3d')](function(_0x455790){logger[_0xf0f3('0x38')](_0xf0f3('0x3e'),_0x26debd,JSON[_0xf0f3('0x37')](_0x455790));});})['then'](function(){_0x372810[_0xf0f3('0x13')]();});});}}}catch(_0x41b433){logger[_0xf0f3('0x38')](_0xf0f3('0x16'),_0x26debd,JSON[_0xf0f3('0x37')](_0x41b433));_0x372810[_0xf0f3('0x3f')]();}};}; \ 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 0e1d2f3..665949d 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 _0xb4cb=['[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0xb4cb,0x174));var _0xbb4c=function(_0x1d244d,_0xd816e0){_0x1d244d=_0x1d244d-0x0;var _0x31d301=_0xb4cb[_0x1d244d];return _0x31d301;};'use strict';var moment=require(_0xbb4c('0x0'));var logger=require(_0xbb4c('0x1'))(_0xbb4c('0x2'));var rpc={'chatInteraction':require(_0xbb4c('0x3')),'openchannelInteraction':require(_0xbb4c('0x4')),'smsInteraction':require(_0xbb4c('0x5')),'mailInteraction':require(_0xbb4c('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xbb4c('0x7'))};exports[_0xbb4c('0x8')]=function(_0x286812,_0x5911fd,_0x625220,_0x461779){return function(_0x530ea6){try{logger['info'](_0xbb4c('0x9'),_0x286812,_0x5911fd[0x0]);var _0x264296={'closed':0x1,'closedAt':moment()[_0xbb4c('0xa')](_0xbb4c('0xb')),'closeReason':'system','disposition':_0x5911fd[0x0]};if(rpc[_0x461779[_0xbb4c('0xc')]+_0xbb4c('0xd')]){rpc[_0x461779['channel']+_0xbb4c('0xd')][_0xbb4c('0xe')](_0x461779['interaction']['id'],_0x264296)[_0xbb4c('0xf')](function(_0x18ce2e){logger['info'](_0xbb4c('0x10'),_0x286812,_0x461779['interaction']['id']);})[_0xbb4c('0x11')](function(_0x3f29d6){logger[_0xbb4c('0x12')](_0xbb4c('0x13'),_0x286812,JSON['stringify'](_0x3f29d6));})[_0xbb4c('0x14')](function(){_0x530ea6[_0xbb4c('0x15')]();});}}catch(_0x20701a){logger[_0xbb4c('0x12')](_0xbb4c('0x13'),_0x286812,JSON[_0xbb4c('0x16')](_0x20701a));_0x530ea6[_0xbb4c('0x15')]();}};}; \ No newline at end of file +var _0x4b52=['stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0xd7e7b3,_0x3b3b7b){var _0x3e166b=function(_0x5caecf){while(--_0x5caecf){_0xd7e7b3['push'](_0xd7e7b3['shift']());}};_0x3e166b(++_0x3b3b7b);}(_0x4b52,0x8b));var _0x24b5=function(_0x14895b,_0x45351f){_0x14895b=_0x14895b-0x0;var _0x10fd2e=_0x4b52[_0x14895b];return _0x10fd2e;};'use strict';var moment=require('moment');var logger=require(_0x24b5('0x0'))(_0x24b5('0x1'));var rpc={'chatInteraction':require(_0x24b5('0x2')),'openchannelInteraction':require(_0x24b5('0x3')),'smsInteraction':require(_0x24b5('0x4')),'mailInteraction':require(_0x24b5('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x24b5('0x6'))};exports[_0x24b5('0x7')]=function(_0x4d2681,_0x27a1bb,_0x284d2c,_0x4e24d6){return function(_0x58740e){try{logger[_0x24b5('0x8')](_0x24b5('0x9'),_0x4d2681,_0x27a1bb[0x0]);var _0x40e1fd={'closed':0x1,'closedAt':moment()[_0x24b5('0xa')](_0x24b5('0xb')),'closeReason':_0x24b5('0xc'),'disposition':_0x27a1bb[0x0]};if(rpc[_0x4e24d6['channel']+_0x24b5('0xd')]){rpc[_0x4e24d6[_0x24b5('0xe')]+_0x24b5('0xd')]['update'](_0x4e24d6[_0x24b5('0xf')]['id'],_0x40e1fd)['then'](function(_0x2d9637){logger[_0x24b5('0x8')](_0x24b5('0x10'),_0x4d2681,_0x4e24d6['interaction']['id']);})[_0x24b5('0x11')](function(_0x3d952e){logger[_0x24b5('0x12')](_0x24b5('0x13'),_0x4d2681,JSON[_0x24b5('0x14')](_0x3d952e));})[_0x24b5('0x15')](function(){_0x58740e[_0x24b5('0x16')]();});}}catch(_0x495a65){logger[_0x24b5('0x12')]('[%s][CLOSE]\x20%s',_0x4d2681,JSON[_0x24b5('0x14')](_0x495a65));_0x58740e[_0x24b5('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 9aab3ef..a1e509d 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 _0x88b0=['UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','Message','create','then','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','result','fulfillment','speech','providerName','providerResponse','next','message','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction'];(function(_0x140c6b,_0x2a1230){var _0x4d9439=function(_0x49f20c){while(--_0x49f20c){_0x140c6b['push'](_0x140c6b['shift']());}};_0x4d9439(++_0x2a1230);}(_0x88b0,0x1cb));var _0x088b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x88b0[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x088b('0x0'));var moment=require(_0x088b('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x088b('0x2'));var logger=require(_0x088b('0x3'))(_0x088b('0x4'));var rpc={'chatMessage':require(_0x088b('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x088b('0x6')),'smsMessage':require(_0x088b('0x7')),'faxMessage':require(_0x088b('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0xfd98a3,_0xa5a81f){return function(_0x18fa42){try{if(!_[_0x088b('0x9')](this[_0x088b('0xa')][_0x088b('0xb')])){logger[_0x088b('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,_0x088b('0xd'));return _0x18fa42['next']();}var _0x2502df={'ContactId':this['contact']['id'],'sentAt':moment()[_0x088b('0xe')](_0x088b('0xf')),'direction':'out'};if(this['channel']===_0x088b('0x10')||this[_0x088b('0x11')]===_0x088b('0x12')){_0x2502df['phone']=this[_0x088b('0xa')][_0x088b('0x13')];}var _0x1ea6d7=this['channel'];if(_0x1ea6d7===_0x088b('0x14')){_0x2502df[_0x088b('0x15')]=this[_0x088b('0x16')]['id'];}else{_0x2502df[_[_0x088b('0x17')](_0x1ea6d7)+_0x088b('0x18')]=this[_0x088b('0x16')]['id'];}_0x2502df[_[_0x088b('0x17')](_0x1ea6d7)+'InteractionId']=this[_0x088b('0xa')]['id'];if(this[_0x088b('0xa')][_0x088b('0x19')]){var _0xdee68a=_0xa5a81f[0x2];if(!_[_0x088b('0x1a')](_0xdee68a)){_0x2502df[_0x088b('0x1b')]=utils['getMustacheRender'](_0xdee68a,this);return rpc[_0x1ea6d7+_0x088b('0x1c')][_0x088b('0x1d')](_0x2502df)[_0x088b('0x1e')](function(_0x31d121){logger[_0x088b('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,_0x2502df['body']);})[_0x088b('0x1f')](function(_0x3b3eb6){logger[_0x088b('0x20')](_0x088b('0x21'),_0xfd98a3,JSON[_0x088b('0x22')](_0x3b3eb6));})[_0x088b('0x23')](function(){logger['info'](_0x088b('0x24'),_0xfd98a3);_0x18fa42[_0x088b('0x25')]();});}else{logger[_0x088b('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xfd98a3);_0x18fa42['stop']();}}else{var _0x464949=this;var _0x1db300=apiai(_0xa5a81f[0x0],{'language':_0xa5a81f[0x1]||'en'});return _0x1db300[_0x088b('0x26')](this['message'][_0x088b('0x1b')],{'sessionId':md5(this[_0x088b('0xa')]['id'])})['then'](function(_0x4b4d3f){_0x464949['body'][_0x088b('0x27')]=_0x4b4d3f;_0x2502df['body']=_0x4b4d3f[_0x088b('0x28')][_0x088b('0x29')][_0x088b('0x2a')];_0x2502df[_0x088b('0x2b')]=_0x088b('0x27');_0x2502df[_0x088b('0x2c')]=JSON['stringify'](_0x4b4d3f);return rpc[_0x1ea6d7+_0x088b('0x1c')][_0x088b('0x1d')](_0x2502df)[_0x088b('0x1e')](function(_0x5f20de){logger[_0x088b('0xc')](_0x088b('0x21'),_0xfd98a3,_0x2502df[_0x088b('0x1b')]);if(_0x4b4d3f[_0x088b('0x28')]['metadata']['endConversation']){_0x18fa42[_0x088b('0x2d')]();}else{_0x18fa42[_0x088b('0x25')]();}})[_0x088b('0x1f')](function(_0x193a00){logger[_0x088b('0x20')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,JSON[_0x088b('0x22')](_0x193a00));_0x18fa42[_0x088b('0x2d')]();});})[_0x088b('0x1f')](function(_0x6535be){logger[_0x088b('0x20')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,_0x6535be[_0x088b('0x2e')]);_0x18fa42[_0x088b('0x2d')]();});}}catch(_0x213cbe){logger[_0x088b('0x20')](_0x088b('0x21'),_0xfd98a3,JSON[_0x088b('0x22')](_0x213cbe));_0x18fa42[_0x088b('0x25')]();}};}; \ No newline at end of file +var _0x1224=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','providerName','dialogflow','providerResponse','result','metadata','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','body','getMustacheRender','Message','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0xb3b3a0,_0x32567d){var _0x4e3707=function(_0x3f4e84){while(--_0x3f4e84){_0xb3b3a0['push'](_0xb3b3a0['shift']());}};_0x4e3707(++_0x32567d);}(_0x1224,0x10d));var _0x4122=function(_0x20acdb,_0x210c8e){_0x20acdb=_0x20acdb-0x0;var _0x383b0d=_0x1224[_0x20acdb];return _0x383b0d;};'use strict';var _=require(_0x4122('0x0'));var moment=require(_0x4122('0x1'));var apiai=require(_0x4122('0x2'));var md5=require(_0x4122('0x3'));var utils=require(_0x4122('0x4'));var logger=require(_0x4122('0x5'))('routing');var rpc={'chatMessage':require(_0x4122('0x6')),'openchannelMessage':require(_0x4122('0x7')),'mailMessage':require(_0x4122('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4122('0x9')),'whatsappMessage':require(_0x4122('0xa'))};exports[_0x4122('0xb')]=function(_0x40b5e4,_0x2a952c){return function(_0x431470){try{if(!_[_0x4122('0xc')](this[_0x4122('0xd')][_0x4122('0xe')])){logger[_0x4122('0xf')](_0x4122('0x10'),_0x40b5e4,_0x4122('0x11'));return _0x431470[_0x4122('0x12')]();}var _0x35160c={'ContactId':this[_0x4122('0x13')]['id'],'sentAt':moment()[_0x4122('0x14')](_0x4122('0x15')),'direction':_0x4122('0x16')};if(this[_0x4122('0x17')]===_0x4122('0x18')||this[_0x4122('0x17')]===_0x4122('0x19')){_0x35160c[_0x4122('0x1a')]=this[_0x4122('0xd')][_0x4122('0x1a')];}var _0x292932=this[_0x4122('0x17')];if(_0x292932===_0x4122('0x1b')){_0x35160c[_0x4122('0x1c')]=this[_0x4122('0x1d')]['id'];}else{_0x35160c[_[_0x4122('0x1e')](_0x292932)+'AccountId']=this[_0x4122('0x1d')]['id'];}_0x35160c[_[_0x4122('0x1e')](_0x292932)+_0x4122('0x1f')]=this[_0x4122('0xd')]['id'];if(this['interaction'][_0x4122('0x20')]){var _0x19684e=_0x2a952c[0x2];if(!_['isEmpty'](_0x19684e)){_0x35160c[_0x4122('0x21')]=utils[_0x4122('0x22')](_0x19684e,this);return rpc[_0x292932+_0x4122('0x23')][_0x4122('0x24')](_0x35160c)[_0x4122('0x25')](function(_0x42374d){logger[_0x4122('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x40b5e4,_0x35160c['body']);})['catch'](function(_0x43ebe7){logger[_0x4122('0x26')](_0x4122('0x10'),_0x40b5e4,JSON[_0x4122('0x27')](_0x43ebe7));})[_0x4122('0x28')](function(){logger[_0x4122('0xf')](_0x4122('0x29'),_0x40b5e4);_0x431470[_0x4122('0x2a')]();});}else{logger['info'](_0x4122('0x2b'),_0x40b5e4);_0x431470['stop']();}}else{var _0x4f949a=this;var _0x508cd7=apiai(_0x2a952c[0x0],{'language':_0x2a952c[0x1]||'en'});return _0x508cd7[_0x4122('0x2c')](this[_0x4122('0x2d')][_0x4122('0x21')],{'sessionId':md5(this['interaction']['id'])})[_0x4122('0x25')](function(_0x386cdc){_0x4f949a['body']['dialogflow']=_0x386cdc;_0x35160c[_0x4122('0x21')]=_0x386cdc['result']['fulfillment']['speech'];_0x35160c[_0x4122('0x2e')]=_0x4122('0x2f');_0x35160c[_0x4122('0x30')]=JSON[_0x4122('0x27')](_0x386cdc);return rpc[_0x292932+_0x4122('0x23')][_0x4122('0x24')](_0x35160c)[_0x4122('0x25')](function(_0x7fe50d){logger[_0x4122('0xf')](_0x4122('0x10'),_0x40b5e4,_0x35160c[_0x4122('0x21')]);if(_0x386cdc[_0x4122('0x31')][_0x4122('0x32')]['endConversation']){_0x431470[_0x4122('0x12')]();}else{_0x431470[_0x4122('0x2a')]();}})[_0x4122('0x33')](function(_0x31f141){logger['error'](_0x4122('0x10'),_0x40b5e4,JSON['stringify'](_0x31f141));_0x431470[_0x4122('0x12')]();});})[_0x4122('0x33')](function(_0x3a9633){logger[_0x4122('0x26')](_0x4122('0x10'),_0x40b5e4,_0x3a9633[_0x4122('0x2d')]);_0x431470[_0x4122('0x12')]();});}}catch(_0x427e8a){logger['error'](_0x4122('0x10'),_0x40b5e4,JSON[_0x4122('0x27')](_0x427e8a));_0x431470['stop']();}};}; \ 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 c9e4935..83c55c5 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 _0xfe13=['getMustacheRender','then','finally','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','stack','lodash','dialogflow','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','upperFirst','created','isEmpty'];(function(_0x28111f,_0x254934){var _0x5203e6=function(_0x2c639a){while(--_0x2c639a){_0x28111f['push'](_0x28111f['shift']());}};_0x5203e6(++_0x254934);}(_0xfe13,0x1e5));var _0x3fe1=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xfe13[_0x402c8f];return _0x11e809;};'use strict';var _=require(_0x3fe1('0x0'));var dialogflow=require(_0x3fe1('0x1'));var md5=require('md5');var moment=require(_0x3fe1('0x2'));var Promise=require(_0x3fe1('0x3'));var logger=require(_0x3fe1('0x4'))(_0x3fe1('0x5'));var utils=require(_0x3fe1('0x6'));var rpc={'chatMessage':require(_0x3fe1('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3fe1('0x8')),'smsMessage':require(_0x3fe1('0x9')),'faxMessage':require(_0x3fe1('0xa')),'whatsappMessage':require(_0x3fe1('0xb'))};function createMessage(_0x376771,_0x56998e,_0x5cc0f5,_0x5557fe){return new Promise(function(_0x355b1b,_0x435880){var _0x59c5b3=_[_0x3fe1('0xc')](_0x5cc0f5);_0x59c5b3['body']=_0x5557fe;return rpc[_0x56998e+_0x3fe1('0xd')][_0x3fe1('0xe')](_0x59c5b3)['then'](function(){logger['info'](_0x3fe1('0xf'),_0x376771,_0x59c5b3[_0x3fe1('0x10')]);_0x355b1b();})[_0x3fe1('0x11')](function(_0x334fe3){logger[_0x3fe1('0x12')](_0x3fe1('0xf'),_0x376771,JSON[_0x3fe1('0x13')](_0x334fe3));_0x435880(_0x334fe3);});});}exports[_0x3fe1('0x14')]=function(_0x59d17d,_0x15b66f){return function(_0x320ff7){try{if(!_[_0x3fe1('0x15')](this[_0x3fe1('0x16')]['UserId'])){logger[_0x3fe1('0x17')](_0x3fe1('0xf'),_0x59d17d,_0x3fe1('0x18'));return _0x320ff7[_0x3fe1('0x19')]();}var _0x5b21f9={'ContactId':this[_0x3fe1('0x1a')]['id'],'sentAt':moment()[_0x3fe1('0x1b')](_0x3fe1('0x1c')),'direction':_0x3fe1('0x1d')};if(this[_0x3fe1('0x1e')]===_0x3fe1('0x1f')||this['channel']===_0x3fe1('0x20')){_0x5b21f9[_0x3fe1('0x21')]=this[_0x3fe1('0x16')][_0x3fe1('0x21')];}var _0x1bb2ad=this['channel'];if(_0x1bb2ad===_0x3fe1('0x22')){_0x5b21f9[_0x3fe1('0x23')]=this['account']['id'];}else{_0x5b21f9[_['upperFirst'](_0x1bb2ad)+_0x3fe1('0x24')]=this['account']['id'];}_0x5b21f9[_[_0x3fe1('0x25')](_0x1bb2ad)+'InteractionId']=this[_0x3fe1('0x16')]['id'];if(this['interaction'][_0x3fe1('0x26')]){var _0x47d813=_0x15b66f[0x4];if(!_[_0x3fe1('0x27')](_0x47d813)){_0x5b21f9[_0x3fe1('0x10')]=utils[_0x3fe1('0x28')](_0x47d813,this);return rpc[_0x1bb2ad+'Message'][_0x3fe1('0xe')](_0x5b21f9)[_0x3fe1('0x29')](function(_0x585353){logger[_0x3fe1('0x17')](_0x3fe1('0xf'),_0x59d17d,_0x5b21f9[_0x3fe1('0x10')]);})['catch'](function(_0x9cd168){logger[_0x3fe1('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x59d17d,JSON[_0x3fe1('0x13')](_0x9cd168));})[_0x3fe1('0x2a')](function(){logger[_0x3fe1('0x17')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x59d17d);_0x320ff7[_0x3fe1('0x2b')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x59d17d);_0x320ff7['stop']();}}else{var _0x3eb485=this;var _0xbf0743=_0x15b66f[0x2][_0x3fe1('0x2c')](/\\n/g,'\x0a');var _0x425a7f={'credentials':{'private_key':_0xbf0743,'client_email':_0x15b66f[0x1]}};var _0x3c47a1=new dialogflow[(_0x3fe1('0x2d'))](_0x425a7f);var _0x17cfcc=_0x3c47a1[_0x3fe1('0x2e')](_0x15b66f[0x0],md5(_0x3eb485[_0x3fe1('0x16')]['id']));var _0x5b4e85={'session':_0x17cfcc,'queryInput':{'text':{'text':_0x3eb485[_0x3fe1('0x2f')][_0x3fe1('0x10')],'languageCode':_0x15b66f[0x3]||'en'}}};return _0x3c47a1[_0x3fe1('0x30')](_0x5b4e85)[_0x3fe1('0x29')](function(_0x3492ec){if(_0x3492ec&&_0x3492ec[_0x3fe1('0x31')]){_0x3eb485[_0x3fe1('0x10')][_0x3fe1('0x32')]=_0x3492ec;var _0x18675e=_0x3492ec[0x0];var _0x536394=_0x18675e[_0x3fe1('0x33')]['diagnosticInfo']&&_0x18675e[_0x3fe1('0x33')][_0x3fe1('0x34')][_0x3fe1('0x35')]?_0x18675e[_0x3fe1('0x33')][_0x3fe1('0x34')][_0x3fe1('0x35')][_0x3fe1('0x36')]['boolValue']:![];_0x3eb485['body'][_0x3fe1('0x37')]=_0x18675e[_0x3fe1('0x33')][_0x3fe1('0x38')];_0x3eb485[_0x3fe1('0x10')][_0x3fe1('0x39')]=_0x18675e[_0x3fe1('0x33')][_0x3fe1('0x3a')];_0x3eb485[_0x3fe1('0x10')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x18675e[_0x3fe1('0x33')]['diagnosticInfo']&&_0x18675e[_0x3fe1('0x33')]['diagnosticInfo'][_0x3fe1('0x35')]?_0x18675e[_0x3fe1('0x33')][_0x3fe1('0x34')][_0x3fe1('0x35')][_0x3fe1('0x36')][_0x3fe1('0x3b')]:![];_0x3eb485[_0x3fe1('0x10')][_0x3fe1('0x3c')]=_0x18675e[_0x3fe1('0x33')][_0x3fe1('0x3d')][_0x3fe1('0x3e')];_0x3eb485['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x18675e[_0x3fe1('0x33')][_0x3fe1('0x3d')][_0x3fe1('0x3f')];_0x3eb485[_0x3fe1('0x10')][_0x3fe1('0x40')]=_0x18675e[_0x3fe1('0x33')][_0x3fe1('0x3d')]['isFallback'];_0x3eb485['body'][_0x3fe1('0x41')]=_0x18675e[_0x3fe1('0x33')][_0x3fe1('0x42')];_0x3eb485['body'][_0x3fe1('0x43')]=_0x18675e[_0x3fe1('0x33')]['queryText'];_0x3eb485[_0x3fe1('0x10')][_0x3fe1('0x44')]=_0x18675e[_0x3fe1('0x33')][_0x3fe1('0x45')];_0x5b21f9[_0x3fe1('0x46')]=_0x3fe1('0x32');_0x5b21f9[_0x3fe1('0x47')]=JSON[_0x3fe1('0x13')](_0x3492ec);var _0x358fb1=[];for(var _0x165fd1=0x0;_0x165fd1<_0x3492ec[_0x3fe1('0x31')];_0x165fd1++){var _0x37ddfc=_0x3492ec[_0x165fd1];if(_0x37ddfc&&_0x37ddfc[_0x3fe1('0x33')]&&_0x37ddfc[_0x3fe1('0x33')][_0x3fe1('0x48')]){_0x358fb1['push'](createMessage(_0x59d17d,_0x1bb2ad,_0x5b21f9,_0x37ddfc[_0x3fe1('0x33')][_0x3fe1('0x48')]));}}return Promise[_0x3fe1('0x49')](_0x358fb1)['then'](function(){if(_0x536394){_0x320ff7[_0x3fe1('0x19')]();}else{_0x320ff7[_0x3fe1('0x2b')]();}})[_0x3fe1('0x11')](function(_0x358f88){logger[_0x3fe1('0x12')](_0x3fe1('0xf'),_0x59d17d,JSON[_0x3fe1('0x13')](_0x358f88));_0x320ff7[_0x3fe1('0x19')]();});}})['catch'](function(_0x5764c1){logger['error'](_0x3fe1('0xf'),_0x59d17d,_0x5764c1[_0x3fe1('0x2f')],_0x5764c1[_0x3fe1('0x4a')]);_0x320ff7[_0x3fe1('0x19')]();});}}catch(_0x26f531){logger[_0x3fe1('0x12')](_0x3fe1('0xf'),_0x59d17d,JSON[_0x3fe1('0x13')](_0x26f531));_0x320ff7[_0x3fe1('0x2b')]();}};}; \ No newline at end of file +var _0x42dd=['format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','info','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','message','detectIntent','length','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_INTENTNAME','intent','name','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','push','fulfillmentText','next','error','catch','stack','lodash','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','then','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId'];(function(_0x376ffe,_0x2a7ec7){var _0x327b9f=function(_0x2ff0eb){while(--_0x2ff0eb){_0x376ffe['push'](_0x376ffe['shift']());}};_0x327b9f(++_0x2a7ec7);}(_0x42dd,0x73));var _0xd42d=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x42dd[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xd42d('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0xd42d('0x1'));var Promise=require(_0xd42d('0x2'));var logger=require(_0xd42d('0x3'))(_0xd42d('0x4'));var utils=require(_0xd42d('0x5'));var rpc={'chatMessage':require(_0xd42d('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd42d('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd42d('0x8')),'whatsappMessage':require(_0xd42d('0x9'))};function createMessage(_0x10f72b,_0x1ceabd,_0x521474,_0x2f8cf6){return new Promise(function(_0x589300,_0x255dd2){var _0x5d94e1=_['clone'](_0x521474);_0x5d94e1[_0xd42d('0xa')]=_0x2f8cf6;return rpc[_0x1ceabd+_0xd42d('0xb')]['create'](_0x5d94e1)[_0xd42d('0xc')](function(){logger['info'](_0xd42d('0xd'),_0x10f72b,_0x5d94e1['body']);_0x589300();})['catch'](function(_0x23241c){logger['error'](_0xd42d('0xd'),_0x10f72b,JSON[_0xd42d('0xe')](_0x23241c));_0x255dd2(_0x23241c);});});}exports[_0xd42d('0xf')]=function(_0x3c9514,_0x41f59c){return function(_0x470127){try{if(!_[_0xd42d('0x10')](this[_0xd42d('0x11')][_0xd42d('0x12')])){logger['info'](_0xd42d('0xd'),_0x3c9514,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x470127['next']();}var _0x4aa5c8={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd42d('0x13')](_0xd42d('0x14')),'direction':_0xd42d('0x15')};if(this[_0xd42d('0x16')]==='sms'||this['channel']===_0xd42d('0x17')){_0x4aa5c8[_0xd42d('0x18')]=this[_0xd42d('0x11')][_0xd42d('0x18')];}var _0x3038d6=this[_0xd42d('0x16')];if(_0x3038d6==='chat'){_0x4aa5c8[_0xd42d('0x19')]=this[_0xd42d('0x1a')]['id'];}else{_0x4aa5c8[_[_0xd42d('0x1b')](_0x3038d6)+_0xd42d('0x1c')]=this['account']['id'];}_0x4aa5c8[_[_0xd42d('0x1b')](_0x3038d6)+_0xd42d('0x1d')]=this[_0xd42d('0x11')]['id'];if(this[_0xd42d('0x11')][_0xd42d('0x1e')]){var _0x548c9e=_0x41f59c[0x4];if(!_[_0xd42d('0x1f')](_0x548c9e)){_0x4aa5c8['body']=utils[_0xd42d('0x20')](_0x548c9e,this);return rpc[_0x3038d6+_0xd42d('0xb')][_0xd42d('0x21')](_0x4aa5c8)['then'](function(_0x1e6dba){logger[_0xd42d('0x22')](_0xd42d('0xd'),_0x3c9514,_0x4aa5c8[_0xd42d('0xa')]);})['catch'](function(_0x5e96a2){logger['error'](_0xd42d('0xd'),_0x3c9514,JSON[_0xd42d('0xe')](_0x5e96a2));})[_0xd42d('0x23')](function(){logger['info'](_0xd42d('0x24'),_0x3c9514);_0x470127[_0xd42d('0x25')]();});}else{logger[_0xd42d('0x22')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3c9514);_0x470127[_0xd42d('0x25')]();}}else{var _0x5089d6=this;var _0x2cd835=_0x41f59c[0x2][_0xd42d('0x26')](/\\n/g,'\x0a');var _0x46e4f0={'credentials':{'private_key':_0x2cd835,'client_email':_0x41f59c[0x1]}};var _0x468753=new dialogflow[(_0xd42d('0x27'))](_0x46e4f0);var _0x4f608c=_0x468753['sessionPath'](_0x41f59c[0x0],md5(_0x5089d6[_0xd42d('0x11')]['id']));var _0x3d15ad={'session':_0x4f608c,'queryInput':{'text':{'text':_0x5089d6[_0xd42d('0x28')][_0xd42d('0xa')],'languageCode':_0x41f59c[0x3]||'en'}}};return _0x468753[_0xd42d('0x29')](_0x3d15ad)[_0xd42d('0xc')](function(_0x5ec31f){if(_0x5ec31f&&_0x5ec31f[_0xd42d('0x2a')]){_0x5089d6[_0xd42d('0xa')]['dialogflowV2']=_0x5ec31f;var _0x5c1e1d=_0x5ec31f[0x0];var _0x631772=_0x5c1e1d['queryResult'][_0xd42d('0x2b')]&&_0x5c1e1d[_0xd42d('0x2c')][_0xd42d('0x2b')][_0xd42d('0x2d')]?_0x5c1e1d[_0xd42d('0x2c')][_0xd42d('0x2b')][_0xd42d('0x2d')][_0xd42d('0x2e')][_0xd42d('0x2f')]:![];_0x5089d6[_0xd42d('0xa')][_0xd42d('0x30')]=_0x5c1e1d['queryResult'][_0xd42d('0x31')];_0x5089d6['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x5c1e1d[_0xd42d('0x2c')]['allRequiredParamsPresent'];_0x5089d6['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x5c1e1d[_0xd42d('0x2c')][_0xd42d('0x2b')]&&_0x5c1e1d[_0xd42d('0x2c')][_0xd42d('0x2b')][_0xd42d('0x2d')]?_0x5c1e1d[_0xd42d('0x2c')][_0xd42d('0x2b')][_0xd42d('0x2d')][_0xd42d('0x2e')][_0xd42d('0x2f')]:![];_0x5089d6[_0xd42d('0xa')][_0xd42d('0x32')]=_0x5c1e1d[_0xd42d('0x2c')][_0xd42d('0x33')][_0xd42d('0x34')];_0x5089d6[_0xd42d('0xa')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x5c1e1d['queryResult']['intent']['displayName'];_0x5089d6[_0xd42d('0xa')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x5c1e1d[_0xd42d('0x2c')]['intent'][_0xd42d('0x35')];_0x5089d6[_0xd42d('0xa')][_0xd42d('0x36')]=_0x5c1e1d['queryResult']['languageCode'];_0x5089d6[_0xd42d('0xa')][_0xd42d('0x37')]=_0x5c1e1d[_0xd42d('0x2c')][_0xd42d('0x38')];_0x5089d6['body'][_0xd42d('0x39')]=_0x5c1e1d[_0xd42d('0x2c')][_0xd42d('0x3a')];_0x4aa5c8[_0xd42d('0x3b')]=_0xd42d('0x3c');_0x4aa5c8['providerResponse']=JSON[_0xd42d('0xe')](_0x5ec31f);var _0x2b6e11=[];for(var _0x36ec9b=0x0;_0x36ec9b<_0x5ec31f[_0xd42d('0x2a')];_0x36ec9b++){var _0x8fd8f5=_0x5ec31f[_0x36ec9b];if(_0x8fd8f5&&_0x8fd8f5['queryResult']&&_0x8fd8f5['queryResult']['fulfillmentText']){_0x2b6e11[_0xd42d('0x3d')](createMessage(_0x3c9514,_0x3038d6,_0x4aa5c8,_0x8fd8f5[_0xd42d('0x2c')][_0xd42d('0x3e')]));}}return Promise['all'](_0x2b6e11)[_0xd42d('0xc')](function(){if(_0x631772){_0x470127[_0xd42d('0x3f')]();}else{_0x470127['stop']();}})['catch'](function(_0xd7c49a){logger[_0xd42d('0x40')](_0xd42d('0xd'),_0x3c9514,JSON['stringify'](_0xd7c49a));_0x470127['next']();});}})[_0xd42d('0x41')](function(_0x331bfa){logger[_0xd42d('0x40')](_0xd42d('0xd'),_0x3c9514,_0x331bfa[_0xd42d('0x28')],_0x331bfa[_0xd42d('0x42')]);_0x470127[_0xd42d('0x3f')]();});}}catch(_0x240d66){logger[_0xd42d('0x40')](_0xd42d('0xd'),_0x3c9514,JSON['stringify'](_0x240d66));_0x470127[_0xd42d('0x25')]();}};}; \ 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 3ee21d0..3832932 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 _0x21c8=['priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition'];(function(_0x2c714a,_0x18a92f){var _0x227672=function(_0xa34bf9){while(--_0xa34bf9){_0x2c714a['push'](_0x2c714a['shift']());}};_0x227672(++_0x18a92f);}(_0x21c8,0x165));var _0x821c=function(_0x21e6f1,_0x4d5eb5){_0x21e6f1=_0x21e6f1-0x0;var _0x44a394=_0x21c8[_0x21e6f1];return _0x44a394;};'use strict';var schema=require(_0x821c('0x0'));var _=require(_0x821c('0x1'));var htmlToText=require(_0x821c('0x2'));var utils=require(_0x821c('0x3'));var logger=require(_0x821c('0x4'))(_0x821c('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x821c('0x6')},'priorityTrue':{'type':_0x821c('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':_0x821c('0x8')}});exports[_0x821c('0x9')]=function(_0x2a3265,_0x579397){return function(_0x5289c9){try{var _0xbeb5fc={'condition':htmlToText['fromString'](utils[_0x821c('0xa')](_0x579397[0x0],this),{'wordwrap':![]})[_0x821c('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x579397[0x1],'priorityFalse':_0x579397[0x2]};var _0x82cc09=gotoif['validate'](_0xbeb5fc,{'typecast':!![]});if(_0x82cc09[_0x821c('0xc')]){logger[_0x821c('0xd')](_0x821c('0xe'),_0x2a3265,_[_0x821c('0xf')](_0x82cc09,_0x821c('0x10'))[_0x821c('0x11')](',\x20'));_0x5289c9[_0x821c('0x12')]();}else{try{var _0x3e350b=eval('('+_0xbeb5fc[_0x821c('0x13')]+')');var _0x30abe5=_0x3e350b?_0xbeb5fc[_0x821c('0x14')]:_0xbeb5fc[_0x821c('0x15')];logger[_0x821c('0x16')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2a3265,_0xbeb5fc[_0x821c('0x13')],_0x3e350b,_0x30abe5||_0x821c('0x17'));if(_0x30abe5){var _0x29958a=_[_0x821c('0x18')](_0x5289c9[_0x821c('0x19')](),{'p':_0x30abe5});if(_0x29958a>=0x0){logger['info'](_0x821c('0x1a'),_0x2a3265,_0x30abe5||_0x821c('0x17'),_0x29958a);_0x5289c9[_0x821c('0x17')](_0x29958a);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x2a3265,_0x30abe5||_0x821c('0x17'));_0x5289c9[_0x821c('0x12')]();}}else{_0x5289c9[_0x821c('0x17')]();}}catch(_0xb6543b){logger[_0x821c('0xd')](_0x821c('0x1b'),_0x2a3265,_0xb6543b[_0x821c('0x10')]);_0x5289c9[_0x821c('0x12')]();}}}catch(_0x5e3ce2){logger[_0x821c('0xd')](_0x821c('0xe'),_0x2a3265,JSON[_0x821c('0x1c')](_0x5e3ce2));_0x5289c9[_0x821c('0x12')]();}};}; \ No newline at end of file +var _0x92a0=['string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','error','[%s][GOTOIF]\x20%s','join','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','stop','stringify','validate','html-to-text','./utils','../../../../config/logger','routing'];(function(_0x35bf58,_0x320ba4){var _0x27e848=function(_0x1e07c1){while(--_0x1e07c1){_0x35bf58['push'](_0x35bf58['shift']());}};_0x27e848(++_0x320ba4);}(_0x92a0,0x13f));var _0x092a=function(_0x548483,_0x5e53ab){_0x548483=_0x548483-0x0;var _0x53afbd=_0x92a0[_0x548483];return _0x53afbd;};'use strict';var schema=require(_0x092a('0x0'));var _=require('lodash');var htmlToText=require(_0x092a('0x1'));var utils=require(_0x092a('0x2'));var logger=require(_0x092a('0x3'))(_0x092a('0x4'));var gotoif=schema({'condition':{'type':_0x092a('0x5'),'required':!![],'message':_0x092a('0x6')},'priorityTrue':{'type':_0x092a('0x7'),'message':_0x092a('0x8')},'priorityFalse':{'type':'number','message':_0x092a('0x9')}});exports[_0x092a('0xa')]=function(_0x446ff5,_0x29182f){return function(_0x4f36b2){try{var _0x2a0c6c={'condition':htmlToText[_0x092a('0xb')](utils['getMustacheRender'](_0x29182f[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x29182f[0x1],'priorityFalse':_0x29182f[0x2]};var _0x2ead2b=gotoif['validate'](_0x2a0c6c,{'typecast':!![]});if(_0x2ead2b['length']){logger[_0x092a('0xc')](_0x092a('0xd'),_0x446ff5,_['map'](_0x2ead2b,'message')[_0x092a('0xe')](',\x20'));_0x4f36b2['stop']();}else{try{var _0x398d8a=eval('('+_0x2a0c6c[_0x092a('0xf')]+')');var _0x46b557=_0x398d8a?_0x2a0c6c[_0x092a('0x10')]:_0x2a0c6c[_0x092a('0x11')];logger['info'](_0x092a('0x12'),_0x446ff5,_0x2a0c6c[_0x092a('0xf')],_0x398d8a,_0x46b557||_0x092a('0x13'));if(_0x46b557){var _0x1ee3aa=_['findIndex'](_0x4f36b2[_0x092a('0x14')](),{'p':_0x46b557});if(_0x1ee3aa>=0x0){logger[_0x092a('0x15')](_0x092a('0x16'),_0x446ff5,_0x46b557||_0x092a('0x13'),_0x1ee3aa);_0x4f36b2[_0x092a('0x13')](_0x1ee3aa);}else{logger[_0x092a('0x15')](_0x092a('0x17'),_0x446ff5,_0x46b557||_0x092a('0x13'));_0x4f36b2['stop']();}}else{_0x4f36b2[_0x092a('0x13')]();}}catch(_0x1c1713){logger[_0x092a('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x446ff5,_0x1c1713[_0x092a('0x18')]);_0x4f36b2[_0x092a('0x19')]();}}}catch(_0x28efd8){logger['error'](_0x092a('0xd'),_0x446ff5,JSON[_0x092a('0x1a')](_0x28efd8));_0x4f36b2['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index abcf275..c59b70c 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 _0x6ca2=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s','map','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x6ca2,0xff));var _0x26ca=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6ca2[_0xa464c9];return _0x3d73c4;};'use strict';var schema=require(_0x26ca('0x0'));var _=require(_0x26ca('0x1'));var logger=require(_0x26ca('0x2'))(_0x26ca('0x3'));var gotop=schema({'priority':{'type':_0x26ca('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x26ca('0x5')]=function(_0x4ce249,_0x47c296){return function(_0xb00f3c){try{var _0x3c8cc8={'priority':_0x47c296[0x0]};var _0x4b9800=gotop[_0x26ca('0x0')](_0x3c8cc8,{'typecast':!![]});if(_0x4b9800[_0x26ca('0x6')]){logger[_0x26ca('0x7')](_0x26ca('0x8'),_0x4ce249,_[_0x26ca('0x9')](_0x4b9800,'message')[_0x26ca('0xa')](',\x20'));_0xb00f3c['stop']();}else{logger[_0x26ca('0xb')](_0x26ca('0xc'),_0x4ce249,_0x3c8cc8[_0x26ca('0xd')]);if(_0x3c8cc8[_0x26ca('0xd')]){var _0x10db18=_[_0x26ca('0xe')](_0xb00f3c[_0x26ca('0xf')](),{'p':_0x3c8cc8['priority']});if(_0x10db18>=0x0){logger[_0x26ca('0xb')](_0x26ca('0x10'),_0x4ce249,_0x3c8cc8[_0x26ca('0xd')]||_0x26ca('0x11'),_0x10db18);_0xb00f3c[_0x26ca('0x11')](_0x10db18);}else{logger[_0x26ca('0xb')](_0x26ca('0x12'),_0x4ce249,_0x3c8cc8[_0x26ca('0xd')]||_0x26ca('0x11'));_0xb00f3c[_0x26ca('0x13')]();}}else{_0xb00f3c[_0x26ca('0x11')]();}}}catch(_0x1078ec){logger[_0x26ca('0x7')](_0x26ca('0x8'),_0x4ce249,JSON[_0x26ca('0x14')](_0x1078ec));_0xb00f3c[_0x26ca('0x13')]();}};}; \ No newline at end of file +var _0xd371=['lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify'];(function(_0x4053bc,_0x1c5588){var _0x1d7f70=function(_0x3b6f66){while(--_0x3b6f66){_0x4053bc['push'](_0x4053bc['shift']());}};_0x1d7f70(++_0x1c5588);}(_0xd371,0x64));var _0x1d37=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0xd371[_0x41382c];return _0x4da35b;};'use strict';var schema=require('validate');var _=require(_0x1d37('0x0'));var logger=require(_0x1d37('0x1'))(_0x1d37('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x1d37('0x3')}});exports[_0x1d37('0x4')]=function(_0x359413,_0x13f63e){return function(_0x1513f4){try{var _0x1e189e={'priority':_0x13f63e[0x0]};var _0x5939db=gotop[_0x1d37('0x5')](_0x1e189e,{'typecast':!![]});if(_0x5939db[_0x1d37('0x6')]){logger[_0x1d37('0x7')]('[%s][GOTOP]\x20%s',_0x359413,_['map'](_0x5939db,'message')[_0x1d37('0x8')](',\x20'));_0x1513f4[_0x1d37('0x9')]();}else{logger[_0x1d37('0xa')](_0x1d37('0xb'),_0x359413,_0x1e189e[_0x1d37('0xc')]);if(_0x1e189e['priority']){var _0x13bc80=_[_0x1d37('0xd')](_0x1513f4[_0x1d37('0xe')](),{'p':_0x1e189e[_0x1d37('0xc')]});if(_0x13bc80>=0x0){logger[_0x1d37('0xa')](_0x1d37('0xf'),_0x359413,_0x1e189e[_0x1d37('0xc')]||_0x1d37('0x10'),_0x13bc80);_0x1513f4[_0x1d37('0x10')](_0x13bc80);}else{logger[_0x1d37('0xa')](_0x1d37('0x11'),_0x359413,_0x1e189e[_0x1d37('0xc')]||_0x1d37('0x10'));_0x1513f4[_0x1d37('0x9')]();}}else{_0x1513f4[_0x1d37('0x10')]();}}}catch(_0x4100c7){logger[_0x1d37('0x7')](_0x1d37('0x12'),_0x359413,JSON[_0x1d37('0x13')](_0x4100c7));_0x1513f4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 7b51e78..a5141a5 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 _0x87a2=['next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','account','upperFirst','channel','InteractionId','interaction','Message','create','[%s][MESSAGE]\x20%s','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x87a2,0x14a));var _0x287a=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0x87a2[_0x350258];return _0x3714b3;};'use strict';var _=require(_0x287a('0x0'));var utils=require(_0x287a('0x1'));var logger=require(_0x287a('0x2'))('routing');var rpc={'chatMessage':require(_0x287a('0x3')),'openchannelMessage':require(_0x287a('0x4')),'mailMessage':require(_0x287a('0x5')),'smsMessage':require(_0x287a('0x6')),'faxMessage':require(_0x287a('0x7')),'whatsappMessage':require(_0x287a('0x8'))};exports['consequence']=function(_0x5b8020,_0x48ccb7){return function(_0x3a5ea4){try{var _0x24d941={'body':utils[_0x287a('0x9')](_0x48ccb7[0x0],this),'ContactId':this[_0x287a('0xa')]['id']};if(this['channel']==='chat'){_0x24d941['ChatWebsiteId']=this[_0x287a('0xb')]['id'];}else{_0x24d941[_[_0x287a('0xc')](this[_0x287a('0xd')])+'AccountId']=this[_0x287a('0xb')]['id'];}_0x24d941[_[_0x287a('0xc')](this['channel'])+_0x287a('0xe')]=this[_0x287a('0xf')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x287a('0xd')]+_0x287a('0x10')][_0x287a('0x11')](_0x24d941)['then'](function(_0x4e3106){logger['info'](_0x287a('0x12'),_0x5b8020,_0x24d941[_0x287a('0x13')]);_0x3a5ea4[_0x287a('0x14')]();})[_0x287a('0x15')](function(_0x5dd341){logger[_0x287a('0x16')](_0x287a('0x12'),_0x5b8020,JSON[_0x287a('0x17')](_0x5dd341));_0x3a5ea4[_0x287a('0x18')]();});}}catch(_0x190ae8){logger[_0x287a('0x16')]('[%s][MESSAGE]\x20%s',_0x5b8020,JSON[_0x287a('0x17')](_0x190ae8));_0x3a5ea4[_0x287a('0x18')]();}};}; \ No newline at end of file +var _0x1527=['getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','body','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0x1527,0xc1));var _0x7152=function(_0x2bcddb,_0x3eaf37){_0x2bcddb=_0x2bcddb-0x0;var _0x12a9e8=_0x1527[_0x2bcddb];return _0x12a9e8;};'use strict';var _=require('lodash');var utils=require(_0x7152('0x0'));var logger=require(_0x7152('0x1'))(_0x7152('0x2'));var rpc={'chatMessage':require(_0x7152('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7152('0x4')),'faxMessage':require(_0x7152('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x7152('0x6')]=function(_0x44226e,_0x524660){return function(_0x46595a){try{var _0x59b4c8={'body':utils[_0x7152('0x7')](_0x524660[0x0],this),'ContactId':this['contact']['id']};if(this[_0x7152('0x8')]===_0x7152('0x9')){_0x59b4c8[_0x7152('0xa')]=this[_0x7152('0xb')]['id'];}else{_0x59b4c8[_[_0x7152('0xc')](this[_0x7152('0x8')])+'AccountId']=this[_0x7152('0xb')]['id'];}_0x59b4c8[_[_0x7152('0xc')](this[_0x7152('0x8')])+_0x7152('0xd')]=this[_0x7152('0xe')]['id'];if(rpc[this['channel']+_0x7152('0xf')]){return rpc[this[_0x7152('0x8')]+'Message'][_0x7152('0x10')](_0x59b4c8)[_0x7152('0x11')](function(_0x4b03a8){logger['info']('[%s][MESSAGE]\x20%s',_0x44226e,_0x59b4c8[_0x7152('0x12')]);_0x46595a[_0x7152('0x13')]();})[_0x7152('0x14')](function(_0x49d976){logger['error'](_0x7152('0x15'),_0x44226e,JSON[_0x7152('0x16')](_0x49d976));_0x46595a[_0x7152('0x17')]();});}}catch(_0x53315e){logger[_0x7152('0x18')](_0x7152('0x15'),_0x44226e,JSON['stringify'](_0x53315e));_0x46595a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index f676704..c58c519 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 _0x57e5=['next','stop','../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x11c350,_0x18f1a5){var _0x27cd0c=function(_0x325800){while(--_0x325800){_0x11c350['push'](_0x11c350['shift']());}};_0x27cd0c(++_0x18f1a5);}(_0x57e5,0x8e));var _0x557e=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x57e5[_0x525c7b];return _0x27b33e;};'use strict';var utils=require('./utils');var logger=require(_0x557e('0x0'))(_0x557e('0x1'));exports['consequence']=function(_0x2b1aa7,_0x488259){return function(_0x588ae1){try{logger[_0x557e('0x2')](_0x557e('0x3'),_0x2b1aa7,utils[_0x557e('0x4')](_0x488259[0x0],this));_0x588ae1[_0x557e('0x5')]();}catch(_0x4aad03){logger['error'](_0x557e('0x3'),_0x2b1aa7,JSON['stringify'](_0x4aad03));_0x588ae1[_0x557e('0x6')]();}};}; \ No newline at end of file +var _0xd18a=['../../../../config/logger','routing','consequence','getMustacheRender','stringify','./utils'];(function(_0x49aa62,_0x213c48){var _0xfffecb=function(_0x56f73d){while(--_0x56f73d){_0x49aa62['push'](_0x49aa62['shift']());}};_0xfffecb(++_0x213c48);}(_0xd18a,0xbf));var _0xad18=function(_0x2efc12,_0x144d91){_0x2efc12=_0x2efc12-0x0;var _0xf7ff6f=_0xd18a[_0x2efc12];return _0xf7ff6f;};'use strict';var utils=require(_0xad18('0x0'));var logger=require(_0xad18('0x1'))(_0xad18('0x2'));exports[_0xad18('0x3')]=function(_0x4f1d11,_0x1d427d){return function(_0x396720){try{logger['info']('[%s][NOOP]\x20%s',_0x4f1d11,utils[_0xad18('0x4')](_0x1d427d[0x0],this));_0x396720['next']();}catch(_0x2bc62a){logger['error']('[%s][NOOP]\x20%s',_0x4f1d11,JSON[_0xad18('0x5')](_0x2bc62a));_0x396720['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index f3193bf..564bb28 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 _0x522e=['account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','socket.io-emitter','queue','joinAt','emit','queue_id'];(function(_0x1302a8,_0x42874f){var _0x23f5d5=function(_0x3cb340){while(--_0x3cb340){_0x1302a8['push'](_0x1302a8['shift']());}};_0x23f5d5(++_0x42874f);}(_0x522e,0x173));var _0xe522=function(_0x4a64e8,_0x329c29){_0x4a64e8=_0x4a64e8-0x0;var _0x458e66=_0x522e[_0x4a64e8];return _0x458e66;};'use strict';var schema=require('validate');var _=require(_0xe522('0x0'));var util=require('util');var seqqueue=require(_0xe522('0x1'));var moment=require(_0xe522('0x2'));var Redis=require(_0xe522('0x3'));var config=require(_0xe522('0x4'));var logger=require(_0xe522('0x5'))('routing');var strategy=require(_0xe522('0x6'));config[_0xe522('0x7')]=_[_0xe522('0x8')](config[_0xe522('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe522('0x9'))(new Redis(config['redis']));var attributes=['id','queue_id','account',_0xe522('0xa'),'from',_0xe522('0xb')];function emit(_0x17d377,_0x5de4fe,_0x2dc4f7){io['to'](_0x17d377)[_0xe522('0xc')](_0x5de4fe,_0x2dc4f7);}function emitChannelQueueInteraction(_0x2aa3aa,_0x6a75aa,_0x4c9109,_0x5ad3cb,_0x316f0c,_0x21b237,_0x41b33c,_0x9b3163){var _0x2e4eef=_['clone'](_0x4c9109);_0x2e4eef[_0xe522('0xd')]=_0x9b3163;_0x2e4eef['queue']=_0x6a75aa;_0x2e4eef[_0xe522('0xe')]=_0x5ad3cb;_0x2e4eef['id']=_0x316f0c;if(_0x21b237){attributes[_0xe522('0xf')](_[_0xe522('0x10')](_0x2aa3aa)+_0xe522('0x11'));_0x41b33c[util[_0xe522('0x12')](_0xe522('0x13'),_0x2aa3aa)][_0x316f0c]=_['pick'](_0x2e4eef,attributes);}else{delete _0x41b33c[util['format'](_0xe522('0x13'),_0x2aa3aa)][_0x316f0c];}emit(util['format']('%s:queue:%s',_0x2aa3aa,_0x6a75aa),util[_0xe522('0x12')]('%s_queue_waiting_interaction:%s',_0x2aa3aa,_0x21b237?_0xe522('0x14'):_0xe522('0x15')),_[_0xe522('0x16')](_0x2e4eef,attributes));}var rpc={'openchannelQueueReport':require(_0xe522('0x17')),'mailQueueReport':require(_0xe522('0x18')),'chatQueueReport':require(_0xe522('0x19')),'smsQueueReport':require(_0xe522('0x1a')),'faxQueueReport':require(_0xe522('0x1b')),'whatsappQueueReport':require(_0xe522('0x1c'))};var queue=schema({'name':{'type':_0xe522('0x1d'),'required':!![],'message':_0xe522('0x1e')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0xea3ca6,_0x4738ec,_0x4219c0,_0x31a4b7){if(_0xea3ca6&&_0x4738ec&&_0x4219c0){_0x4738ec[_0xe522('0x1f')]+=0x1;var _0x296cdf={'uniqueid':_0xea3ca6,'from':_0x4219c0[_0xe522('0x20')]?_0x4219c0[_0xe522('0x20')][_0xe522('0x21')]:'','joinAt':moment()[_0xe522('0x12')](_0xe522('0x22')),'ContactId':_0x4219c0[_0xe522('0x23')]?_0x4219c0[_0xe522('0x23')]['id']:null,'ListId':_0x4219c0[_0xe522('0x24')]?_0x4219c0[_0xe522('0x24')]['id']:null};_0x296cdf[_[_0xe522('0x25')](_0x4219c0[_0xe522('0x26')])+_0xe522('0x27')]=_0x4738ec['id']||null;_0x296cdf[_['upperFirst'](_0x4219c0['channel'])+'InteractionId']=_0x4219c0[_0xe522('0x28')]?_0x4219c0['interaction']['id']:null;_0x296cdf[_[_0xe522('0x25')](_0x4219c0[_0xe522('0x26')])+_0xe522('0x29')]=_0x4219c0[_0xe522('0x2a')]?_0x4219c0[_0xe522('0x2a')]['id']:null;_0x296cdf[_['upperFirst'](_0x4219c0[_0xe522('0x26')])+(_0x4219c0[_0xe522('0x26')]!==_0xe522('0x2b')?'AccountId':_0xe522('0x2c'))]=_0x4219c0[_0xe522('0xe')]?_0x4219c0[_0xe522('0xe')]['id']:null;logger[_0xe522('0x2d')](util[_0xe522('0x12')]('[%s][START:QUEUE][NAME:%s]',_0xea3ca6,_0x4738ec['name']));emitChannelQueueInteraction(_0x4219c0[_0xe522('0x26')],_0x4738ec[_0xe522('0x2e')],_0x296cdf,_0x4219c0[_0xe522('0xe')][_0xe522('0x2e')],_0x4219c0[_0xe522('0x2a')]['id'],!![],_0x31a4b7,_0x4738ec['id']);if(rpc[_0x4219c0[_0xe522('0x26')]+_0xe522('0x2f')]){return rpc[_0x4219c0['channel']+_0xe522('0x2f')]['create'](_0x296cdf)[_0xe522('0x30')](function(_0x555446){logger[_0xe522('0x31')](_0xe522('0x32'));});}}}function stopRouting(_0x19f294,_0x3bb3b6,_0x358ee4,_0x365cb0){if(_0x19f294&&_0x3bb3b6){_0x3bb3b6['waiting']-=0x1;var _0x218a2d={'leaveAt':moment()['format'](_0xe522('0x22')),'acceptAt':moment()[_0xe522('0x12')](_0xe522('0x22')),'reason':'accepted'};logger['info'](util[_0xe522('0x12')](_0xe522('0x33'),_0x19f294,_0x3bb3b6[_0xe522('0x2e')]));emitChannelQueueInteraction(_0x358ee4['channel'],_0x3bb3b6[_0xe522('0x2e')],_0x358ee4[_0xe522('0x20')],_0x358ee4[_0xe522('0xe')][_0xe522('0x2e')],_0x358ee4[_0xe522('0x2a')]['id'],![],_0x365cb0,_0x3bb3b6['id']);if(rpc[_0x358ee4[_0xe522('0x26')]+_0xe522('0x2f')]){return rpc[_0x358ee4[_0xe522('0x26')]+_0xe522('0x2f')][_0xe522('0x34')](_0x19f294,_0x218a2d)[_0xe522('0x30')](function(_0x4243c0){logger[_0xe522('0x31')](_0xe522('0x35'));});}}}function endRouting(_0x2da5a5,_0x1d75e0,_0x154d96,_0x692aef){if(_0x2da5a5&&_0x1d75e0){_0x1d75e0[_0xe522('0x1f')]-=0x1;var _0x573889={'leaveAt':moment()[_0xe522('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xe522('0x36')};logger['info'](util[_0xe522('0x12')](_0xe522('0x37'),_0x2da5a5,_0x1d75e0[_0xe522('0x2e')]));emitChannelQueueInteraction(_0x154d96[_0xe522('0x26')],_0x1d75e0['name'],_0x154d96['body'],_0x154d96[_0xe522('0xe')][_0xe522('0x2e')],_0x154d96[_0xe522('0x2a')]['id'],![],_0x692aef);if(rpc[_0x154d96[_0xe522('0x26')]+'QueueReport']){return rpc[_0x154d96['channel']+_0xe522('0x2f')]['update'](_0x2da5a5,_0x573889)[_0xe522('0x30')](function(_0x8a4b88){logger[_0xe522('0x31')](_0xe522('0x35'));});}}}function handleFindQueue(_0x41e6aa){return function(_0x202b67){return _0x202b67['name'][_0xe522('0x38')]()===_0x41e6aa[_0xe522('0x38')]();};}exports[_0xe522('0x39')]=function(_0x49b6ad,_0x7f2669,_0x3ce224,_0x295f50){return function(_0x4da463){try{var _0xa855f3={'name':_0x7f2669[0x0],'timeout':_0x7f2669[0x1]};var _0x449667=queue['validate'](_0xa855f3,{'typecast':!![]});if(_0x449667[_0xe522('0x3a')]){logger['error'](_0xe522('0x3b'),_0x49b6ad,_[_0xe522('0x3c')](_0x449667,_0xe522('0x2a'))['join'](',\x20'));_0x4da463[_0xe522('0x3d')]();}else{var _0x36f0e6=_[_0xe522('0x3e')](_0x3ce224[_0x295f50[_0xe522('0x26')]+_0xe522('0x3f')],handleFindQueue(_0xa855f3[_0xe522('0x2e')]));if(_0x36f0e6){startRouting(_0x49b6ad,_0x36f0e6,_0x295f50,_0x3ce224);var _0x50e258=(_0x36f0e6[_0xe522('0x36')]||0xa)*0x3e8;var _0x17babd=(_0xa855f3[_0xe522('0x36')]||0x14)*0x3e8;var _0x5ed787;if(_0x50e258>_0x17babd){_0x17babd=_0x50e258;}var _0x227cbc=seqqueue['createQueue'](_0x50e258);_0x227cbc['id']=_0x49b6ad;_0x227cbc[_0xe522('0x40')]=_0x50e258;_0x227cbc['qtimeout']=_0x17babd;_0x227cbc[_0xe522('0x26')]=_0x295f50[_0xe522('0x26')];_0x3ce224[_0xe522('0x41')][_0x49b6ad]['on'](_0xe522('0x42'),function(){logger[_0xe522('0x2d')](_0xe522('0x43'),_0x49b6ad);stopRouting(_0x49b6ad,_0x36f0e6,_0x295f50,_0x3ce224);clearTimeout(_0x5ed787);_0x5ed787=undefined;_0x227cbc[_0xe522('0x44')](!![]);if(_0x3ce224[_0xe522('0x41')][_0x49b6ad]){delete _0x3ce224[_0xe522('0x41')][_0x49b6ad];}_0x4da463[_0xe522('0x3d')]();});_0x3ce224[_0xe522('0x41')][_0x49b6ad]['on'](_0xe522('0x45'),function(){if(_0x3ce224['rules'][_0x49b6ad]){delete _0x3ce224['rules'][_0x49b6ad];}});_0x5ed787=setTimeout(function(){logger[_0xe522('0x2d')](_0xe522('0x46'),_0x49b6ad);endRouting(_0x49b6ad,_0x36f0e6,_0x295f50,_0x3ce224);clearTimeout(_0x5ed787);_0x227cbc['close'](!![]);_0x4da463['next']();},_0x17babd);switch(_0x36f0e6[_0xe522('0x47')]){case'rrmemory':strategy[_0xe522('0x48')](_0x227cbc,_0x36f0e6,_0x3ce224,_0x295f50);break;default:strategy[_0xe522('0x49')](_0x227cbc,_0x36f0e6,_0x3ce224,_0x295f50);}}else{logger[_0xe522('0x31')](_0xe522('0x4a'),_0x49b6ad,_0xa855f3[_0xe522('0x2e')]);_0x4da463['stop']();}}}catch(_0xcdec2f){console[_0xe522('0x4b')](_0xcdec2f);logger[_0xe522('0x31')](_0xe522('0x3b'),_0x49b6ad,_0xcdec2f[_0xe522('0x4c')]);_0x4da463[_0xe522('0x3d')]();}};}; \ No newline at end of file +var _0x2a05=['emit','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','from','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','stop','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','log','lodash','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','joinAt'];(function(_0x37ea21,_0xa5926){var _0xe8e1d3=function(_0x4102ef){while(--_0x4102ef){_0x37ea21['push'](_0x37ea21['shift']());}};_0xe8e1d3(++_0xa5926);}(_0x2a05,0x181));var _0x52a0=function(_0x27cbd6,_0x547cd1){_0x27cbd6=_0x27cbd6-0x0;var _0xb0c928=_0x2a05[_0x27cbd6];return _0xb0c928;};'use strict';var schema=require('validate');var _=require(_0x52a0('0x0'));var util=require('util');var seqqueue=require(_0x52a0('0x1'));var moment=require(_0x52a0('0x2'));var Redis=require('ioredis');var config=require(_0x52a0('0x3'));var logger=require(_0x52a0('0x4'))(_0x52a0('0x5'));var strategy=require(_0x52a0('0x6'));config['redis']=_[_0x52a0('0x7')](config[_0x52a0('0x8')],{'host':_0x52a0('0x9'),'port':0x18eb});var io=require(_0x52a0('0xa'))(new Redis(config[_0x52a0('0x8')]));var attributes=['id',_0x52a0('0xb'),_0x52a0('0xc'),_0x52a0('0xd'),'from',_0x52a0('0xe')];function emit(_0x94915b,_0x46e0fc,_0x2e7dc3){io['to'](_0x94915b)[_0x52a0('0xf')](_0x46e0fc,_0x2e7dc3);}function emitChannelQueueInteraction(_0x4e87ce,_0x49b12c,_0x16b4a2,_0x2f6ab6,_0x48d8da,_0x5b1fbf,_0x4b170d,_0x3c9642){var _0x32db12=_[_0x52a0('0x10')](_0x16b4a2);_0x32db12[_0x52a0('0xb')]=_0x3c9642;_0x32db12['queue']=_0x49b12c;_0x32db12[_0x52a0('0xc')]=_0x2f6ab6;_0x32db12['id']=_0x48d8da;if(_0x5b1fbf){attributes[_0x52a0('0x11')](_[_0x52a0('0x12')](_0x4e87ce)+_0x52a0('0x13'));_0x4b170d[util[_0x52a0('0x14')](_0x52a0('0x15'),_0x4e87ce)][_0x48d8da]=_['pick'](_0x32db12,attributes);}else{delete _0x4b170d[util[_0x52a0('0x14')]('%sQueuesWaitingInteractions',_0x4e87ce)][_0x48d8da];}emit(util[_0x52a0('0x14')](_0x52a0('0x16'),_0x4e87ce,_0x49b12c),util[_0x52a0('0x14')]('%s_queue_waiting_interaction:%s',_0x4e87ce,_0x5b1fbf?_0x52a0('0x17'):_0x52a0('0x18')),_[_0x52a0('0x19')](_0x32db12,attributes));}var rpc={'openchannelQueueReport':require(_0x52a0('0x1a')),'mailQueueReport':require(_0x52a0('0x1b')),'chatQueueReport':require(_0x52a0('0x1c')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x52a0('0x1d')),'whatsappQueueReport':require(_0x52a0('0x1e'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x52a0('0x1f'),'message':_0x52a0('0x20')}});function startRouting(_0x14507a,_0x496e11,_0x4bfe4a,_0x5262e4){if(_0x14507a&&_0x496e11&&_0x4bfe4a){_0x496e11[_0x52a0('0x21')]+=0x1;var _0x20d53c={'uniqueid':_0x14507a,'from':_0x4bfe4a[_0x52a0('0x22')]?_0x4bfe4a['body'][_0x52a0('0x23')]:'','joinAt':moment()[_0x52a0('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4bfe4a['contact']?_0x4bfe4a[_0x52a0('0x24')]['id']:null,'ListId':_0x4bfe4a[_0x52a0('0x25')]?_0x4bfe4a[_0x52a0('0x25')]['id']:null};_0x20d53c[_[_0x52a0('0x26')](_0x4bfe4a['channel'])+_0x52a0('0x27')]=_0x496e11['id']||null;_0x20d53c[_[_0x52a0('0x26')](_0x4bfe4a['channel'])+'InteractionId']=_0x4bfe4a[_0x52a0('0x28')]?_0x4bfe4a[_0x52a0('0x28')]['id']:null;_0x20d53c[_[_0x52a0('0x26')](_0x4bfe4a[_0x52a0('0x29')])+_0x52a0('0x2a')]=_0x4bfe4a[_0x52a0('0x2b')]?_0x4bfe4a[_0x52a0('0x2b')]['id']:null;_0x20d53c[_[_0x52a0('0x26')](_0x4bfe4a[_0x52a0('0x29')])+(_0x4bfe4a[_0x52a0('0x29')]!==_0x52a0('0x2c')?'AccountId':_0x52a0('0x2d'))]=_0x4bfe4a[_0x52a0('0xc')]?_0x4bfe4a[_0x52a0('0xc')]['id']:null;logger['info'](util[_0x52a0('0x14')](_0x52a0('0x2e'),_0x14507a,_0x496e11[_0x52a0('0x2f')]));emitChannelQueueInteraction(_0x4bfe4a['channel'],_0x496e11['name'],_0x20d53c,_0x4bfe4a[_0x52a0('0xc')]['name'],_0x4bfe4a[_0x52a0('0x2b')]['id'],!![],_0x5262e4,_0x496e11['id']);if(rpc[_0x4bfe4a[_0x52a0('0x29')]+_0x52a0('0x30')]){return rpc[_0x4bfe4a['channel']+_0x52a0('0x30')][_0x52a0('0x31')](_0x20d53c)[_0x52a0('0x32')](function(_0xff65c){logger[_0x52a0('0x33')](_0x52a0('0x34'));});}}}function stopRouting(_0x169f83,_0x3dfeb8,_0x67bba1,_0x190ff8){if(_0x169f83&&_0x3dfeb8){_0x3dfeb8['waiting']-=0x1;var _0x2471b3={'leaveAt':moment()[_0x52a0('0x14')](_0x52a0('0x35')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x52a0('0x36')};logger[_0x52a0('0x37')](util[_0x52a0('0x14')](_0x52a0('0x38'),_0x169f83,_0x3dfeb8[_0x52a0('0x2f')]));emitChannelQueueInteraction(_0x67bba1[_0x52a0('0x29')],_0x3dfeb8['name'],_0x67bba1[_0x52a0('0x22')],_0x67bba1['account'][_0x52a0('0x2f')],_0x67bba1[_0x52a0('0x2b')]['id'],![],_0x190ff8,_0x3dfeb8['id']);if(rpc[_0x67bba1[_0x52a0('0x29')]+'QueueReport']){return rpc[_0x67bba1[_0x52a0('0x29')]+'QueueReport']['update'](_0x169f83,_0x2471b3)['catch'](function(_0x35b42f){logger['error'](_0x52a0('0x39'));});}}}function endRouting(_0x2c13e2,_0x1c13bf,_0xabfad5,_0x54cff9){if(_0x2c13e2&&_0x1c13bf){_0x1c13bf[_0x52a0('0x21')]-=0x1;var _0x38d55d={'leaveAt':moment()[_0x52a0('0x14')](_0x52a0('0x35')),'exitAt':moment()[_0x52a0('0x14')](_0x52a0('0x35')),'reason':'timeout'};logger['info'](util[_0x52a0('0x14')](_0x52a0('0x3a'),_0x2c13e2,_0x1c13bf[_0x52a0('0x2f')]));emitChannelQueueInteraction(_0xabfad5[_0x52a0('0x29')],_0x1c13bf[_0x52a0('0x2f')],_0xabfad5[_0x52a0('0x22')],_0xabfad5[_0x52a0('0xc')][_0x52a0('0x2f')],_0xabfad5[_0x52a0('0x2b')]['id'],![],_0x54cff9);if(rpc[_0xabfad5[_0x52a0('0x29')]+_0x52a0('0x30')]){return rpc[_0xabfad5[_0x52a0('0x29')]+_0x52a0('0x30')]['update'](_0x2c13e2,_0x38d55d)[_0x52a0('0x32')](function(_0xead41e){logger[_0x52a0('0x33')](_0x52a0('0x39'));});}}}function handleFindQueue(_0x5b72ee){return function(_0x111982){return _0x111982[_0x52a0('0x2f')][_0x52a0('0x3b')]()===_0x5b72ee[_0x52a0('0x3b')]();};}exports[_0x52a0('0x3c')]=function(_0x11107c,_0x2dc886,_0xc988f8,_0x244f0d){return function(_0x16a235){try{var _0x3ab86a={'name':_0x2dc886[0x0],'timeout':_0x2dc886[0x1]};var _0x26acae=queue[_0x52a0('0x3d')](_0x3ab86a,{'typecast':!![]});if(_0x26acae[_0x52a0('0x3e')]){logger[_0x52a0('0x33')](_0x52a0('0x3f'),_0x11107c,_[_0x52a0('0x40')](_0x26acae,'message')['join'](',\x20'));_0x16a235[_0x52a0('0x41')]();}else{var _0x4e6cd9=_['find'](_0xc988f8[_0x244f0d[_0x52a0('0x29')]+_0x52a0('0x42')],handleFindQueue(_0x3ab86a[_0x52a0('0x2f')]));if(_0x4e6cd9){startRouting(_0x11107c,_0x4e6cd9,_0x244f0d,_0xc988f8);var _0x429a3b=(_0x4e6cd9['timeout']||0xa)*0x3e8;var _0x369412=(_0x3ab86a[_0x52a0('0x43')]||0x14)*0x3e8;var _0x38b8ce;if(_0x429a3b>_0x369412){_0x369412=_0x429a3b;}var _0xaf3e63=seqqueue[_0x52a0('0x44')](_0x429a3b);_0xaf3e63['id']=_0x11107c;_0xaf3e63[_0x52a0('0x45')]=_0x429a3b;_0xaf3e63[_0x52a0('0x46')]=_0x369412;_0xaf3e63[_0x52a0('0x29')]=_0x244f0d[_0x52a0('0x29')];_0xc988f8[_0x52a0('0x47')][_0x11107c]['on'](_0x52a0('0x48'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x11107c);stopRouting(_0x11107c,_0x4e6cd9,_0x244f0d,_0xc988f8);clearTimeout(_0x38b8ce);_0x38b8ce=undefined;_0xaf3e63[_0x52a0('0x49')](!![]);if(_0xc988f8[_0x52a0('0x47')][_0x11107c]){delete _0xc988f8['rules'][_0x11107c];}_0x16a235[_0x52a0('0x41')]();});_0xc988f8['rules'][_0x11107c]['on'](_0x52a0('0x4a'),function(){if(_0xc988f8[_0x52a0('0x47')][_0x11107c]){delete _0xc988f8['rules'][_0x11107c];}});_0x38b8ce=setTimeout(function(){logger[_0x52a0('0x37')](_0x52a0('0x4b'),_0x11107c);endRouting(_0x11107c,_0x4e6cd9,_0x244f0d,_0xc988f8);clearTimeout(_0x38b8ce);_0xaf3e63['close'](!![]);_0x16a235['next']();},_0x369412);switch(_0x4e6cd9[_0x52a0('0x4c')]){case'rrmemory':strategy[_0x52a0('0x4d')](_0xaf3e63,_0x4e6cd9,_0xc988f8,_0x244f0d);break;default:strategy[_0x52a0('0x4e')](_0xaf3e63,_0x4e6cd9,_0xc988f8,_0x244f0d);}}else{logger[_0x52a0('0x33')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x11107c,_0x3ab86a[_0x52a0('0x2f')]);_0x16a235[_0x52a0('0x41')]();}}}catch(_0x285ee6){console[_0x52a0('0x4f')](_0x285ee6);logger[_0x52a0('0x33')](_0x52a0('0x3f'),_0x11107c,_0x285ee6['stack']);_0x16a235[_0x52a0('0x41')]();}};}; \ 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 d63695f..698cb7c 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 _0x34e5=['saveWaitingNotification','channel','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT','uuid','../../../../../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','forcedOwnership','busy','busyQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e5,0x172));var _0x534e=function(_0x46d18e,_0x8c01a0){_0x46d18e=_0x46d18e-0x0;var _0x57029a=_0x34e5[_0x46d18e];return _0x57029a;};'use strict';var _=require('lodash');var uuid=require(_0x534e('0x0'));var util=require('./util');var logger=require(_0x534e('0x1'))(_0x534e('0x2'));var Agent=function(_0x425ae8,_0x246650,_0x83eb2d,_0x50b790){this[_0x534e('0x3')]=uuid['v4']();this[_0x534e('0x4')]=_0x425ae8;this[_0x534e('0x5')]=_0x246650;this[_0x534e('0x6')]=_0x83eb2d;this[_0x534e('0x2')]=_0x50b790;this[_0x534e('0x4')][_0x534e('0x7')](this['handleRun'][_0x534e('0x8')](this),this[_0x534e('0x9')][_0x534e('0x8')](this));this['squeue']['on']('timeout',this[_0x534e('0x9')]['bind'](this));this[_0x534e('0x4')]['on']('drained',this[_0x534e('0xa')][_0x534e('0x8')](this));};Agent[_0x534e('0xb')]['push']=function(){this[_0x534e('0x4')][_0x534e('0x7')](this[_0x534e('0xc')][_0x534e('0x8')](this),this[_0x534e('0x9')]['bind'](this));};Agent[_0x534e('0xb')][_0x534e('0xa')]=function(){this[_0x534e('0x9')](!![]);};Agent[_0x534e('0xb')][_0x534e('0xc')]=function(){logger[_0x534e('0xd')](_0x534e('0xe'),this[_0x534e('0x4')]['id'],this[_0x534e('0x5')]['id']);if(_['isNil'](this[_0x534e('0x6')][_0x534e('0xf')][this['agent']['id']])){logger['debug'](_0x534e('0x10'),this[_0x534e('0x4')]['id'],this[_0x534e('0x5')]['id']);setTimeout(this[_0x534e('0x7')][_0x534e('0x8')](this),0x3e8);}else{if(this[_0x534e('0x2')][_0x534e('0x11')]||util['isAgentAvailable'](this[_0x534e('0x4')]['id'],this[_0x534e('0x6')][_0x534e('0xf')][this[_0x534e('0x5')]['id']],this[_0x534e('0x4')]['channel'],![])){this[_0x534e('0x6')][_0x534e('0xf')][this[_0x534e('0x5')]['id']][_0x534e('0x12')]=!![];this[_0x534e('0x6')][_0x534e('0xf')][this[_0x534e('0x5')]['id']][_0x534e('0x13')]=undefined;util[_0x534e('0x14')](this['realtime'],this[_0x534e('0x2')],this[_0x534e('0x5')],this[_0x534e('0x4')][_0x534e('0x15')]);util[_0x534e('0x16')](this[_0x534e('0x3')],this[_0x534e('0x4')]['id'],this[_0x534e('0x6')]['agents'][this[_0x534e('0x5')]['id']],null,this['routing']);util[_0x534e('0x17')](this[_0x534e('0x4')]['id'],this[_0x534e('0x6')][_0x534e('0xf')][this[_0x534e('0x5')]['id']],'RINGING'+(this[_0x534e('0x2')][_0x534e('0x11')]?':FORCED':''));}else{logger['debug'](_0x534e('0x18'),this['squeue']['id'],this[_0x534e('0x5')]['id']);setTimeout(this[_0x534e('0x7')][_0x534e('0x8')](this),0x3e8);}}};Agent[_0x534e('0xb')][_0x534e('0x9')]=function(_0x42119b){if(_[_0x534e('0x19')](this['realtime']['agents'][this[_0x534e('0x5')]['id']])){return logger[_0x534e('0xd')](_0x534e('0x10'),this[_0x534e('0x4')]['id'],this[_0x534e('0x5')]['id']);}else{logger[_0x534e('0xd')](_0x534e('0x1a'),this[_0x534e('0x4')]['id'],this[_0x534e('0x5')]['id']);util[_0x534e('0x1b')](this[_0x534e('0x3')],this[_0x534e('0x4')]['id'],this['realtime'][_0x534e('0xf')][this[_0x534e('0x5')]['id']],null,this['routing']);this[_0x534e('0x6')]['agents'][this[_0x534e('0x5')]['id']][_0x534e('0x12')]=![];this[_0x534e('0x6')][_0x534e('0xf')][this['agent']['id']][_0x534e('0x13')]=undefined;util[_0x534e('0x1c')](this['realtime'],this['routing'],this[_0x534e('0x5')],this[_0x534e('0x4')][_0x534e('0x15')]);util[_0x534e('0x17')](this['squeue']['id'],this[_0x534e('0x6')]['agents'][this[_0x534e('0x5')]['id']],_0x42119b?'STOP':_0x534e('0x1d'));}if(!_0x42119b){setTimeout(this[_0x534e('0x7')]['bind'](this),0x3e8);}};function agent(_0x2f5cd1,_0x5c34a7,_0x593fb0,_0x519b40){return new Agent(_0x2f5cd1,_0x5c34a7,_0x593fb0,_0x519b40);}module['exports']=agent; \ No newline at end of file +var _0x4c4e=['isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','squeue','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','debug','agent'];(function(_0xdf40c5,_0x2f127d){var _0x7e0b0e=function(_0x3cf57a){while(--_0x3cf57a){_0xdf40c5['push'](_0xdf40c5['shift']());}};_0x7e0b0e(++_0x2f127d);}(_0x4c4e,0x152));var _0xe4c4=function(_0x156a71,_0x1be7d2){_0x156a71=_0x156a71-0x0;var _0x2648e2=_0x4c4e[_0x156a71];return _0x2648e2;};'use strict';var _=require(_0xe4c4('0x0'));var uuid=require('uuid');var util=require(_0xe4c4('0x1'));var logger=require(_0xe4c4('0x2'))(_0xe4c4('0x3'));var Agent=function(_0x58c8f6,_0x1b6c91,_0x7d7655,_0x1a4483){this['notificationId']=uuid['v4']();this[_0xe4c4('0x4')]=_0x58c8f6;this['agent']=_0x1b6c91;this[_0xe4c4('0x5')]=_0x7d7655;this[_0xe4c4('0x3')]=_0x1a4483;this[_0xe4c4('0x4')][_0xe4c4('0x6')](this[_0xe4c4('0x7')][_0xe4c4('0x8')](this),this[_0xe4c4('0x9')][_0xe4c4('0x8')](this));this['squeue']['on']('timeout',this[_0xe4c4('0x9')][_0xe4c4('0x8')](this));this[_0xe4c4('0x4')]['on'](_0xe4c4('0xa'),this[_0xe4c4('0xb')][_0xe4c4('0x8')](this));};Agent['prototype'][_0xe4c4('0x6')]=function(){this[_0xe4c4('0x4')][_0xe4c4('0x6')](this[_0xe4c4('0x7')]['bind'](this),this[_0xe4c4('0x9')][_0xe4c4('0x8')](this));};Agent['prototype'][_0xe4c4('0xb')]=function(){this[_0xe4c4('0x9')](!![]);};Agent['prototype'][_0xe4c4('0x7')]=function(){logger[_0xe4c4('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xe4c4('0x4')]['id'],this[_0xe4c4('0xd')]['id']);if(_[_0xe4c4('0xe')](this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']])){logger[_0xe4c4('0xc')](_0xe4c4('0x10'),this[_0xe4c4('0x4')]['id'],this[_0xe4c4('0xd')]['id']);setTimeout(this[_0xe4c4('0x6')][_0xe4c4('0x8')](this),0x3e8);}else{if(this[_0xe4c4('0x3')][_0xe4c4('0x11')]||util[_0xe4c4('0x12')](this['squeue']['id'],this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']],this[_0xe4c4('0x4')]['channel'],![])){this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']][_0xe4c4('0x13')]=!![];this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']][_0xe4c4('0x14')]=undefined;util[_0xe4c4('0x15')](this[_0xe4c4('0x5')],this[_0xe4c4('0x3')],this[_0xe4c4('0xd')],this[_0xe4c4('0x4')][_0xe4c4('0x16')]);util[_0xe4c4('0x17')](this['notificationId'],this['squeue']['id'],this[_0xe4c4('0x5')]['agents'][this[_0xe4c4('0xd')]['id']],null,this['routing']);util[_0xe4c4('0x18')](this['squeue']['id'],this[_0xe4c4('0x5')]['agents'][this[_0xe4c4('0xd')]['id']],'RINGING'+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger[_0xe4c4('0xc')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0xe4c4('0xd')]['id']);setTimeout(this[_0xe4c4('0x6')]['bind'](this),0x3e8);}}};Agent['prototype'][_0xe4c4('0x9')]=function(_0x33de43){if(_['isNil'](this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xe4c4('0x4')]['id'],this[_0xe4c4('0xd')]['id']);}else{logger[_0xe4c4('0xc')](_0xe4c4('0x19'),this['squeue']['id'],this['agent']['id']);util[_0xe4c4('0x1a')](this[_0xe4c4('0x1b')],this['squeue']['id'],this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']],null,this['routing']);this[_0xe4c4('0x5')]['agents'][this[_0xe4c4('0xd')]['id']][_0xe4c4('0x13')]=![];this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']][_0xe4c4('0x14')]=undefined;util[_0xe4c4('0x1c')](this[_0xe4c4('0x5')],this[_0xe4c4('0x3')],this[_0xe4c4('0xd')],this[_0xe4c4('0x4')][_0xe4c4('0x16')]);util['writeLog'](this[_0xe4c4('0x4')]['id'],this[_0xe4c4('0x5')][_0xe4c4('0xf')][this['agent']['id']],_0x33de43?_0xe4c4('0x1d'):_0xe4c4('0x1e'));}if(!_0x33de43){setTimeout(this[_0xe4c4('0x6')]['bind'](this),0x3e8);}};function agent(_0x4622cc,_0xa2e734,_0x4a3644,_0x1de955){return new Agent(_0x4622cc,_0xa2e734,_0x4a3644,_0x1de955);}module[_0xe4c4('0x1f')]=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 78e9ba9..ca5941c 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 _0x57e1=['notificationId','squeue','queue','realtime','bind','handleTimeout','drained','handleDrained','prototype','push','handleRun','isNil','Agents','length','agents','isAgentAvailable','writeLog','busy','name','saveWaitingNotification','showNotification','debug','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','busyQueue','removeWaitingNotification','exports','uuid','./util','../../../../../config/logger','routing'];(function(_0x48ec2f,_0x38d621){var _0x54c899=function(_0x5a99ff){while(--_0x5a99ff){_0x48ec2f['push'](_0x48ec2f['shift']());}};_0x54c899(++_0x38d621);}(_0x57e1,0x167));var _0x157e=function(_0x3dc85,_0x4f2d39){_0x3dc85=_0x3dc85-0x0;var _0x3e938e=_0x57e1[_0x3dc85];return _0x3e938e;};'use strict';var _=require('lodash');var uuid=require(_0x157e('0x0'));var util=require(_0x157e('0x1'));var logger=require(_0x157e('0x2'))(_0x157e('0x3'));var Beepall=function(_0x5eef3a,_0x35fdff,_0x34c5d5,_0x3345ca){this[_0x157e('0x4')]=uuid['v4']();this[_0x157e('0x5')]=_0x5eef3a;this[_0x157e('0x6')]=_0x35fdff;this[_0x157e('0x7')]=_0x34c5d5;this[_0x157e('0x3')]=_0x3345ca;this[_0x157e('0x5')]['push'](this['handleRun'][_0x157e('0x8')](this),this[_0x157e('0x9')][_0x157e('0x8')](this));this[_0x157e('0x5')]['on']('timeout',this['handleTimeout'][_0x157e('0x8')](this));this[_0x157e('0x5')]['on'](_0x157e('0xa'),this[_0x157e('0xb')][_0x157e('0x8')](this));};Beepall[_0x157e('0xc')]['push']=function(){this[_0x157e('0x5')][_0x157e('0xd')](this[_0x157e('0xe')][_0x157e('0x8')](this),this[_0x157e('0x9')][_0x157e('0x8')](this));};Beepall[_0x157e('0xc')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall['prototype'][_0x157e('0xe')]=function(){var _0xa34097=!![];if(!_[_0x157e('0xf')](this['queue'])&&!_[_0x157e('0xf')](this['queue']['Agents'])&&this[_0x157e('0x6')][_0x157e('0x10')]['length']>0x0){for(var _0x260ee3=0x0,_0x48ccc0;_0x260ee30x0){for(var _0x34b137=0x0,_0x189248;_0x34b1370x0&&_0x126749[_0x3a32f5+_0xf588('0x26')]>=_0x126749[_0x3a32f5+_0xf588('0x24')]){writeLog(_0xc3fc9f,_0x126749,_0x3a32f5['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xf588('0x27')]=function(_0x137ca0,_0x571a65,_0xdcca9d,_0x1fdcff,_0x4920a7){return sendNotification(!![],_0x137ca0,_0x571a65,_0xdcca9d,_0x1fdcff,_0x4920a7);};exports['hideNotification']=function(_0x399a0b,_0x1c864f,_0x3eb7cc,_0x1001ee,_0x556fca){return sendNotification(![],_0x399a0b,_0x1c864f,_0x3eb7cc,_0x1001ee,_0x556fca);};exports[_0xf588('0x28')]=function(_0xa2dd14,_0x507a0e,_0x1f4b31){var _0x4fe450=_0x507a0e['interaction'][_0xf588('0x29')];if(!_0x4fe450&&_0x1f4b31){_0x4fe450=_0x1f4b31['id'];}var _0x41f388=_[_0xf588('0x2a')](_0xa2dd14[_0x507a0e['channel']+'QueuesWaitingInteractions'],function(_0x436022){var _0x2827bf=_['capitalize'](_0x507a0e['channel'])+_0xf588('0x2b');return _0x436022[_0x2827bf]===_0x507a0e['interaction']['id'];});if(!_0x41f388&&_0x4fe450){_0x41f388=_[_0xf588('0x2a')](_0xa2dd14[_0xf588('0x2c')][_0x4fe450][_0x507a0e[_0xf588('0x2d')]+'WaitingInteractions'],function(_0x4c78fc){return _0x4c78fc['id']===_0x507a0e['interaction']['id'];});}return _0x41f388;};exports[_0xf588('0x2e')]=function(_0x4cabc3,_0x4ed118,_0x87f963,_0xa676cf){_0x4cabc3['agents'][_0x87f963['id']][_0xa676cf+_0xf588('0x2f')][_0x4ed118[_0xf588('0x1a')]['id']]={'id':_0x4ed118[_0xf588('0x30')]['id']};};exports[_0xf588('0x31')]=function(_0x11c1c6,_0x540502,_0x37d4da,_0x4e1233){delete _0x11c1c6[_0xf588('0x2c')][_0x37d4da['id']][_0x4e1233+_0xf588('0x2f')][_0x540502[_0xf588('0x1a')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file +var _0x0af1=['account','notificationSound','notificationShake','body','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','showNotification','checkWaitingNotifications','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','writeLog','lodash','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','user:save','split','\x20interaction'];(function(_0x15c12c,_0x1db663){var _0x4aaeb8=function(_0x2c9436){while(--_0x2c9436){_0x15c12c['push'](_0x15c12c['shift']());}};_0x4aaeb8(++_0x1db663);}(_0x0af1,0x8a));var _0x10af=function(_0x344cf7,_0x4a26ba){_0x344cf7=_0x344cf7-0x0;var _0x3d4c27=_0x0af1[_0x344cf7];return _0x3d4c27;};'use strict';var _=require(_0x10af('0x0'));var util=require('util');var utils=require(_0x10af('0x1'));var Redis=require(_0x10af('0x2'));var config=require('../../../../../config/environment');var logger=require(_0x10af('0x3'))(_0x10af('0x4'));config[_0x10af('0x5')]=_[_0x10af('0x6')](config['redis'],{'host':_0x10af('0x7'),'port':0x18eb});var io=require(_0x10af('0x8'))(new Redis(config[_0x10af('0x5')]));function sendNotification(_0x3776d5,_0x30b893,_0x523f11,_0x3b9b9c,_0x4e3907,_0x23f54c){io['to'](util[_0x10af('0x9')](_0x10af('0xa'),_0x3b9b9c[_0x10af('0xb')]))['emit'](_0x10af('0xc'),_0x3b9b9c);var _0x3a9de3=_0x23f54c||{};var _0x4f29ed=_0x523f11[_0x10af('0xd')]('.');var _0x251fc5={'uniqueid':_0x30b893,'channel':_0x4f29ed[0x0],'id':_0x4f29ed[0x1],'title':_0x4f29ed[0x0]+_0x10af('0xe'),'interactionId':_0x4f29ed[0x2],'queue':_0x4e3907?_0x4e3907[_0x10af('0xb')]:null,'sound':_0x3a9de3[_0x10af('0xf')][_0x10af('0x10')],'shake':_0x3a9de3['account'][_0x10af('0x11')]};try{if(!_0x3a9de3[_0x10af('0x12')]){_0x3a9de3[_0x10af('0x12')]={};}if(_0x4e3907){_0x3a9de3[_0x10af('0x12')]['queue']=_0x4e3907;}else if(_0x3a9de3[_0x10af('0x12')]['queue']){delete _0x3a9de3[_0x10af('0x12')]['queue'];}_0x251fc5['msg']=utils['getMustacheRender'](_0x3a9de3[_0x10af('0xf')]['notificationTemplate'],_0x3a9de3);}catch(_0x3a6d49){_0x251fc5[_0x10af('0x13')]=_0x10af('0x14');logger[_0x10af('0x15')](util['format'](_0x10af('0x16'),_0x30b893,_0x3a6d49[_0x10af('0x17')]));}io['to'](util[_0x10af('0x9')](_0x10af('0xa'),_0x3b9b9c[_0x10af('0xb')]))['emit'](util[_0x10af('0x9')](_0x10af('0x18'),_0x3776d5?_0x10af('0x19'):'remove'),_0x251fc5);}function writeLog(_0x26ae70,_0x531987,_0x4d8ce6){return logger[_0x10af('0x1a')](util[_0x10af('0x9')](_0x10af('0x1b'),_0x26ae70,_0x531987[_0x10af('0xb')],_0x4d8ce6));}exports[_0x10af('0x1c')]=function(_0xe3e8b9,_0x9b2507,_0x2db479,_0x1afed9){if(_0x9b2507[_0x10af('0x1d')]){writeLog(_0xe3e8b9,_0x9b2507,_0x10af('0x1e'));return![];}if(!_0x9b2507[_0x10af('0x1f')]){writeLog(_0xe3e8b9,_0x9b2507,_0x10af('0x20'));return![];}if(_0x9b2507[_0x2db479+_0x10af('0x21')]){writeLog(_0xe3e8b9,_0x9b2507,_0x10af('0x22'));return![];}if(_0x1afed9&&_0x9b2507['hasOwnProperty'](_0x2db479+_0x10af('0x23'))&&_0x9b2507[_0x10af('0x24')](_0x2db479+_0x10af('0x25'))){if(_0x9b2507[_0x2db479+_0x10af('0x23')]>0x0&&_0x9b2507[_0x2db479+_0x10af('0x25')]>=_0x9b2507[_0x2db479+_0x10af('0x23')]){writeLog(_0xe3e8b9,_0x9b2507,_0x2db479[_0x10af('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x10af('0x27')]=function(_0x26fb28,_0x55a9a5,_0x435ecb,_0x8c466c,_0xf89cfd){return sendNotification(!![],_0x26fb28,_0x55a9a5,_0x435ecb,_0x8c466c,_0xf89cfd);};exports['hideNotification']=function(_0xb51f7d,_0x34b56e,_0x32b2a1,_0x58e5bb,_0xd1e05f){return sendNotification(![],_0xb51f7d,_0x34b56e,_0x32b2a1,_0x58e5bb,_0xd1e05f);};exports[_0x10af('0x28')]=function(_0x5769cd,_0x5c138f,_0x311014){var _0x6d72a8=_0x5c138f[_0x10af('0x29')][_0x10af('0x2a')];if(!_0x6d72a8&&_0x311014){_0x6d72a8=_0x311014['id'];}var _0x27ffa7=_[_0x10af('0x2b')](_0x5769cd[_0x5c138f[_0x10af('0x2c')]+_0x10af('0x2d')],function(_0x2f6442){var _0xc6af57=_[_0x10af('0x2e')](_0x5c138f[_0x10af('0x2c')])+_0x10af('0x2f');return _0x2f6442[_0xc6af57]===_0x5c138f['interaction']['id'];});if(!_0x27ffa7&&_0x6d72a8){_0x27ffa7=_['some'](_0x5769cd[_0x10af('0x30')][_0x6d72a8][_0x5c138f['channel']+_0x10af('0x31')],function(_0x378970){return _0x378970['id']===_0x5c138f[_0x10af('0x29')]['id'];});}return _0x27ffa7;};exports['saveWaitingNotification']=function(_0x5970ad,_0x55d272,_0xca5013,_0x4d4a44){_0x5970ad[_0x10af('0x30')][_0xca5013['id']][_0x4d4a44+_0x10af('0x31')][_0x55d272[_0x10af('0x17')]['id']]={'id':_0x55d272[_0x10af('0x29')]['id']};};exports['removeWaitingNotification']=function(_0x2fbc9b,_0x39cdf6,_0x3d4bb8,_0x329652){delete _0x2fbc9b[_0x10af('0x30')][_0x3d4bb8['id']][_0x329652+_0x10af('0x31')][_0x39cdf6[_0x10af('0x17')]['id']];};exports[_0x10af('0x32')]=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 f1c5332..1de4242 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 _0x5de0=['../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','map','message','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','error','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','./utils'];(function(_0x44de48,_0x510bf7){var _0x5296bc=function(_0x4e418f){while(--_0x4e418f){_0x44de48['push'](_0x44de48['shift']());}};_0x5296bc(++_0x510bf7);}(_0x5de0,0xb7));var _0x05de=function(_0x1fd161,_0xfd6bdc){_0x1fd161=_0x1fd161-0x0;var _0x5940f3=_0x5de0[_0x1fd161];return _0x5940f3;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require('lodash');var utils=require(_0x05de('0x0'));var logger=require(_0x05de('0x1'))(_0x05de('0x2'));var system=schema({'command':{'type':_0x05de('0x3'),'required':!![],'message':_0x05de('0x4')}});exports[_0x05de('0x5')]=function(_0x346a20,_0x2ed73a){return function(_0x53d6c2){try{var _0x3c8dfc={'command':_0x2ed73a[0x0]};var _0x5d8b18=system[_0x05de('0x6')](_0x3c8dfc,{'typecast':!![]});if(_0x5d8b18[_0x05de('0x7')]){logger['error']('[%s][SYSTEM]\x20%s',_0x346a20,_[_0x05de('0x8')](_0x5d8b18,_0x05de('0x9'))[_0x05de('0xa')](',\x20'));logger[_0x05de('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x346a20);_0x53d6c2[_0x05de('0xc')]();}else{var _0x14e2cf=this;var _0x3d2944=utils['getMustacheRender'](_0x2ed73a[0x0],this);logger[_0x05de('0xb')](_0x05de('0xd'),_0x346a20,_0x3d2944);sh['exec'](_[_0x05de('0xe')](_0x3d2944),function(_0x18b7c7,_0x1ea45c){logger[_0x05de('0xb')](_0x05de('0xf'),_0x346a20,_0x18b7c7);if(_0x18b7c7==0x0){var _0x4392e1=_0x1ea45c[_0x05de('0x10')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x2ed73a[0x1])||_[_0x05de('0x11')](_0x2ed73a[0x1])){logger[_0x05de('0xb')](_0x05de('0x12'),_0x346a20);_0x14e2cf[_0x05de('0x13')][_0x2ed73a[0x1]]=_0x4392e1;}else{logger[_0x05de('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x346a20,_0x2ed73a[0x1],_0x4392e1);_0x14e2cf[_0x05de('0x13')][_0x2ed73a[0x1]]=_0x4392e1;}}_0x53d6c2['next']();});}}catch(_0x4fe93e){logger[_0x05de('0x14')]('[%s][SYSTEM]\x20%s',_0x346a20,_[_0x05de('0x15')](_0x4fe93e)?JSON['stringify'](_0x4fe93e):_0x4fe93e);logger[_0x05de('0xb')](_0x05de('0x16'),_0x346a20);_0x53d6c2[_0x05de('0xc')]();}};}; \ No newline at end of file +var _0x5eff=['length','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','stringify','validate','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x3f73b2,_0x57c771){var _0x202dd8=function(_0x57e329){while(--_0x57e329){_0x3f73b2['push'](_0x3f73b2['shift']());}};_0x202dd8(++_0x57c771);}(_0x5eff,0x76));var _0xf5ef=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x5eff[_0x5d2803];return _0xdcad2c;};'use strict';var schema=require(_0xf5ef('0x0'));var sh=require(_0xf5ef('0x1'));var _=require(_0xf5ef('0x2'));var utils=require('./utils');var logger=require(_0xf5ef('0x3'))(_0xf5ef('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xf5ef('0x5')}});exports[_0xf5ef('0x6')]=function(_0x490a6e,_0x55f3c6){return function(_0x38e14a){try{var _0x1fdbc9={'command':_0x55f3c6[0x0]};var _0x5def2a=system[_0xf5ef('0x0')](_0x1fdbc9,{'typecast':!![]});if(_0x5def2a[_0xf5ef('0x7')]){logger['error'](_0xf5ef('0x8'),_0x490a6e,_['map'](_0x5def2a,_0xf5ef('0x9'))['join'](',\x20'));logger[_0xf5ef('0xa')](_0xf5ef('0xb'),_0x490a6e);_0x38e14a[_0xf5ef('0xc')]();}else{var _0x171e66=this;var _0x263a40=utils[_0xf5ef('0xd')](_0x55f3c6[0x0],this);logger[_0xf5ef('0xa')](_0xf5ef('0xe'),_0x490a6e,_0x263a40);sh[_0xf5ef('0xf')](_['trim'](_0x263a40),function(_0x59dd07,_0x5ce9d1){logger['info'](_0xf5ef('0x10'),_0x490a6e,_0x59dd07);if(_0x59dd07==0x0){var _0x1a7f04=_0x5ce9d1[_0xf5ef('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xf5ef('0x12')](_0x55f3c6[0x1])||_[_0xf5ef('0x13')](_0x55f3c6[0x1])){logger['info'](_0xf5ef('0x14'),_0x490a6e);_0x171e66[_0xf5ef('0x15')][_0x55f3c6[0x1]]=_0x1a7f04;}else{logger[_0xf5ef('0xa')](_0xf5ef('0x16'),_0x490a6e,_0x55f3c6[0x1],_0x1a7f04);_0x171e66[_0xf5ef('0x15')][_0x55f3c6[0x1]]=_0x1a7f04;}}_0x38e14a[_0xf5ef('0xc')]();});}}catch(_0x1161e6){logger[_0xf5ef('0x17')]('[%s][SYSTEM]\x20%s',_0x490a6e,_['isObject'](_0x1161e6)?JSON[_0xf5ef('0x18')](_0x1161e6):_0x1161e6);logger[_0xf5ef('0xa')](_0xf5ef('0xb'),_0x490a6e);_0x38e14a[_0xf5ef('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 e43d324..b23c646 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 _0x9aa9=['validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','consequence','error','[%s][TAG]\x20%s','message','join','info','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','next','isObject'];(function(_0x23da4d,_0x63498c){var _0x4ae55=function(_0x323d75){while(--_0x323d75){_0x23da4d['push'](_0x23da4d['shift']());}};_0x4ae55(++_0x63498c);}(_0x9aa9,0x11e));var _0x99aa=function(_0x5b51d7,_0x5717ce){_0x5b51d7=_0x5b51d7-0x0;var _0x482749=_0x9aa9[_0x5b51d7];return _0x482749;};'use strict';var schema=require(_0x99aa('0x0'));var _=require(_0x99aa('0x1'));var rpc={'chatInteraction':require(_0x99aa('0x2')),'openchannelInteraction':require(_0x99aa('0x3')),'smsInteraction':require(_0x99aa('0x4')),'mailInteraction':require(_0x99aa('0x5')),'faxInteraction':require(_0x99aa('0x6')),'whatsappInteraction':require(_0x99aa('0x7'))};var logger=require('../../../../config/logger')(_0x99aa('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x99aa('0x9')]=function(_0x8245d,_0x2e7eda,_0x5b10f2,_0x3170b1){return function(_0x1eb492){try{var _0x4c47bd={'tag':_0x2e7eda[0x0]};var _0x2316b8=tag[_0x99aa('0x0')](_0x4c47bd,{'typecast':!![]});if(_0x2316b8['length']){logger[_0x99aa('0xa')](_0x99aa('0xb'),_0x8245d,_['map'](_0x2316b8,_0x99aa('0xc'))[_0x99aa('0xd')](',\x20'));logger[_0x99aa('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x8245d);_0x1eb492['next']();}else{var _0x26c798={'ids':[_0x2e7eda[0x0]]};if(rpc[_0x3170b1[_0x99aa('0xf')]+_0x99aa('0x10')]){rpc[_0x3170b1[_0x99aa('0xf')]+'Interaction'][_0x99aa('0x11')](_0x3170b1[_0x99aa('0x12')]['id'],_0x26c798)[_0x99aa('0x13')](function(_0x14a784){logger[_0x99aa('0xe')](_0x99aa('0x14'),_0x8245d,_0x2e7eda[0x1],_0x3170b1[_0x99aa('0xf')],_0x3170b1['interaction']['id']);})[_0x99aa('0x15')](function(_0x443a15){logger[_0x99aa('0xa')](_0x99aa('0xb'),_0x8245d,JSON['stringify'](_0x443a15));logger[_0x99aa('0xe')](_0x99aa('0x16'),_0x8245d);})[_0x99aa('0x17')](function(){_0x1eb492[_0x99aa('0x18')]();});}}}catch(_0x489d5e){logger[_0x99aa('0xa')](_0x99aa('0xb'),_0x8245d,_[_0x99aa('0x19')](_0x489d5e)?JSON['stringify'](_0x489d5e):_0x489d5e);logger[_0x99aa('0xe')](_0x99aa('0x16'),_0x8245d);_0x1eb492['next']();}};}; \ No newline at end of file +var _0xa141=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','consequence','length','error','message','join'];(function(_0x242f15,_0x10c8c7){var _0x1e4650=function(_0x38f5a9){while(--_0x38f5a9){_0x242f15['push'](_0x242f15['shift']());}};_0x1e4650(++_0x10c8c7);}(_0xa141,0x12b));var _0x1a14=function(_0x4e6cc5,_0x17e15b){_0x4e6cc5=_0x4e6cc5-0x0;var _0x3e20b7=_0xa141[_0x4e6cc5];return _0x3e20b7;};'use strict';var schema=require(_0x1a14('0x0'));var _=require(_0x1a14('0x1'));var rpc={'chatInteraction':require(_0x1a14('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x1a14('0x3')),'faxInteraction':require(_0x1a14('0x4')),'whatsappInteraction':require(_0x1a14('0x5'))};var logger=require('../../../../config/logger')(_0x1a14('0x6'));var tag=schema({'tag':{'type':_0x1a14('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1a14('0x8')]=function(_0x1deb46,_0x1b201e,_0x11634a,_0x316891){return function(_0x25eacc){try{var _0x1cd9c8={'tag':_0x1b201e[0x0]};var _0x18bfcd=tag[_0x1a14('0x0')](_0x1cd9c8,{'typecast':!![]});if(_0x18bfcd[_0x1a14('0x9')]){logger[_0x1a14('0xa')]('[%s][TAG]\x20%s',_0x1deb46,_['map'](_0x18bfcd,_0x1a14('0xb'))[_0x1a14('0xc')](',\x20'));logger[_0x1a14('0xd')](_0x1a14('0xe'),_0x1deb46);_0x25eacc['next']();}else{var _0xdf3f27={'ids':[_0x1b201e[0x0]]};if(rpc[_0x316891[_0x1a14('0xf')]+_0x1a14('0x10')]){rpc[_0x316891[_0x1a14('0xf')]+_0x1a14('0x10')][_0x1a14('0x11')](_0x316891['interaction']['id'],_0xdf3f27)['then'](function(_0x27fa78){logger['info'](_0x1a14('0x12'),_0x1deb46,_0x1b201e[0x1],_0x316891[_0x1a14('0xf')],_0x316891[_0x1a14('0x13')]['id']);})[_0x1a14('0x14')](function(_0x559915){logger[_0x1a14('0xa')](_0x1a14('0x15'),_0x1deb46,JSON[_0x1a14('0x16')](_0x559915));logger[_0x1a14('0xd')](_0x1a14('0xe'),_0x1deb46);})[_0x1a14('0x17')](function(){_0x25eacc[_0x1a14('0x18')]();});}}}catch(_0x1e8671){logger[_0x1a14('0xa')](_0x1a14('0x15'),_0x1deb46,_[_0x1a14('0x19')](_0x1e8671)?JSON['stringify'](_0x1e8671):_0x1e8671);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1deb46);_0x25eacc[_0x1a14('0x18')]();}};}; \ 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 782d8bf..8e49bb4 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 _0x3417=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','jsonrpc','2.0','method','login','push','params','stringify','POST','application/json-rpc','parse'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3417,0x92));var _0x7341=function(_0x10a3a1,_0x463463){_0x10a3a1=_0x10a3a1-0x0;var _0x328a81=_0x3417[_0x10a3a1];return _0x328a81;};'use strict';var rp=require(_0x7341('0x0'));var logger=require(_0x7341('0x1'))(_0x7341('0x2'));var _=require('lodash');var arr=[];exports[_0x7341('0x3')]=function(_0xb5d296,_0x4a7408){return function(_0xe3a08d){var _0x2b2801=_0x4a7408[0xa];var _0x243e98=_0x4a7408[0xb];var _0x47c766=_0x4a7408[0xc];var _0x3f6f8c=_0x4a7408[0xd];var _0x1636f5=_0x4a7408[0xe];var _0x5c05bc=_0x4a7408[0xf][_0x7341('0x4')](/\n/g,_0x7341('0x5'));var _0x12b74b=_0x4a7408[0x10][_0x7341('0x4')](/\n/g,'\x20');if(!arr[_0x7341('0x6')](_0x243e98)){arr['push'](_0x243e98);var _0x40f48a=_0x4a7408[0x3];var _0x61d555=_0x4a7408[0x4];var _0x1cba00=_0x4a7408[0x1];var _0x38b86a=_0x4a7408[0x0];var _0x17d817={};_0x17d817[_0x7341('0x7')]=_0x4a7408[0x8]+_0x7341('0x8')+_0x47c766+'|'+_0x2b2801+'|'+_0x3f6f8c+'|'+_0x243e98+'|'+_0x1636f5;_0x17d817['urlOnRing']=_0x4a7408[0x7]+_0x7341('0x8')+_0x47c766+'|'+_0x2b2801+'|'+_0x3f6f8c+'|'+_0x243e98+'|'+_0x1636f5+'|'+_0x5c05bc+'|'+_0x12b74b;_0x17d817['title']=_0x4a7408[0x9];var _0x5f287a={};_0x5f287a[_0x7341('0x9')]=_0x7341('0xa');_0x5f287a[_0x7341('0xb')]=_0x7341('0xc');var _0x2751d7=[];_0x2751d7[_0x7341('0xd')](_0x4a7408[0x2]);_0x2751d7['push'](_0x4a7408[0x5]);_0x2751d7['push'](_0x4a7408[0x6]);_0x5f287a[_0x7341('0xe')]=_0x2751d7;_0x5f287a['id']=0x1;var _0x10cb77=JSON[_0x7341('0xf')](_0x5f287a);var _0x329215={'encoding':'utf8','method':_0x7341('0x10'),'timeout':0x2710,'url':_0x40f48a,'headers':{'Content-Type':_0x7341('0x11')},'body':_0x10cb77};return rp(_0x329215)['then'](function(_0x4feae8){const _0x535153=JSON[_0x7341('0x12')](_0x4feae8);if(!_0x535153['result'][_0x7341('0x13')]){throw new Error(_0x7341('0x14'));}var _0x3089a3=_0x243e98;var _0x4c739c=_0x7341('0x15')+_0x1cba00+_0x7341('0x16')+_0x38b86a+_0x7341('0x17')+_0x3089a3+_0x7341('0x18')+JSON[_0x7341('0xf')](_0x17d817);var _0x17a4f6=_0x61d555+'?'+_0x4c739c;return rp(_0x17a4f6);})[_0x7341('0x19')](function(_0x4eaee3){logger[_0x7341('0x1a')](_0x7341('0x1b'),_0xb5d296,_0x4eaee3);_0xe3a08d[_0x7341('0x1c')]();})['catch'](function(_0x485e8d){logger[_0x7341('0x1d')](_0x7341('0x1e'),_0xb5d296,_[_0x7341('0x1f')](_0x485e8d)?JSON[_0x7341('0xf')](_0x485e8d):_0x485e8d);_0xe3a08d[_0x7341('0x1c')]();});}else{logger[_0x7341('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0xb5d296);_0xe3a08d[_0x7341('0x20')]();}};}; \ No newline at end of file +var _0x9b33=['\x20-\x20','includes','push','?params=','urlOnRing','jsonrpc','2.0','login','stringify','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','next','request-promise','lodash','consequence','replace'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x9b33,0x1e2));var _0x39b3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x9b33[_0x36eaaa];return _0x461349;};'use strict';var rp=require(_0x39b3('0x0'));var logger=require('../../../../config/logger')('routing');var _=require(_0x39b3('0x1'));var arr=[];exports[_0x39b3('0x2')]=function(_0x544c30,_0x32ba83){return function(_0x1d17fb){var _0x405208=_0x32ba83[0xa];var _0x1bd698=_0x32ba83[0xb];var _0x44ec41=_0x32ba83[0xc];var _0x123a34=_0x32ba83[0xd];var _0x27e4a7=_0x32ba83[0xe];var _0x301629=_0x32ba83[0xf][_0x39b3('0x3')](/\n/g,_0x39b3('0x4'));var _0x158325=_0x32ba83[0x10][_0x39b3('0x3')](/\n/g,'\x20');if(!arr[_0x39b3('0x5')](_0x1bd698)){arr[_0x39b3('0x6')](_0x1bd698);var _0x2c5830=_0x32ba83[0x3];var _0x5435c8=_0x32ba83[0x4];var _0xe18296=_0x32ba83[0x1];var _0x47aa9d=_0x32ba83[0x0];var _0x12d13b={};_0x12d13b['urlOnAnswer']=_0x32ba83[0x8]+_0x39b3('0x7')+_0x44ec41+'|'+_0x405208+'|'+_0x123a34+'|'+_0x1bd698+'|'+_0x27e4a7;_0x12d13b[_0x39b3('0x8')]=_0x32ba83[0x7]+_0x39b3('0x7')+_0x44ec41+'|'+_0x405208+'|'+_0x123a34+'|'+_0x1bd698+'|'+_0x27e4a7+'|'+_0x301629+'|'+_0x158325;_0x12d13b['title']=_0x32ba83[0x9];var _0x3c6779={};_0x3c6779[_0x39b3('0x9')]=_0x39b3('0xa');_0x3c6779['method']=_0x39b3('0xb');var _0x19d247=[];_0x19d247['push'](_0x32ba83[0x2]);_0x19d247[_0x39b3('0x6')](_0x32ba83[0x5]);_0x19d247[_0x39b3('0x6')](_0x32ba83[0x6]);_0x3c6779['params']=_0x19d247;_0x3c6779['id']=0x1;var _0x4bf852=JSON[_0x39b3('0xc')](_0x3c6779);var _0x4d1994={'encoding':'utf8','method':_0x39b3('0xd'),'timeout':0x2710,'url':_0x2c5830,'headers':{'Content-Type':_0x39b3('0xe')},'body':_0x4bf852};return rp(_0x4d1994)[_0x39b3('0xf')](function(_0x54e78f){const _0x5e9c2d=JSON[_0x39b3('0x10')](_0x54e78f);if(!_0x5e9c2d[_0x39b3('0x11')][_0x39b3('0x12')]){throw new Error(_0x39b3('0x13'));}var _0x2571cd=_0x1bd698;var _0x1cdd3d='channelId='+_0xe18296+'&serviceId='+_0x47aa9d+'&sessionId='+_0x2571cd+_0x39b3('0x14')+JSON[_0x39b3('0xc')](_0x12d13b);var _0x17d040=_0x5435c8+'?'+_0x1cdd3d;return rp(_0x17d040);})[_0x39b3('0xf')](function(_0x418bfe){logger[_0x39b3('0x15')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x544c30,_0x418bfe);_0x1d17fb[_0x39b3('0x16')]();})[_0x39b3('0x17')](function(_0x848722){logger[_0x39b3('0x18')](_0x39b3('0x19'),_0x544c30,_['isObject'](_0x848722)?JSON[_0x39b3('0xc')](_0x848722):_0x848722);_0x1d17fb['stop']();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x544c30);_0x1d17fb[_0x39b3('0x1a')]();}};}; \ 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 3a458a8..6eaec4e 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4ffd26,_0x2225a6){var _0x1b9f5e=function(_0x435d82){while(--_0x435d82){_0x4ffd26['push'](_0x4ffd26['shift']());}};_0x1b9f5e(++_0x2225a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x555cee,_0x2cf1f3){var _0x3d30b9=function(_0x5a328e){while(--_0x5a328e){_0x555cee['push'](_0x555cee['shift']());}};_0x3d30b9(++_0x2cf1f3);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 77e1598..3b9ea0c 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 _0xe700=['values','find','chatQueues','available','name','paused','mailQueues','openchannelQueues','loggedIn','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','IntervalId','Intervals','interval','isNil','listen','rules','message','interaction','checkWaitingNotifications','applications','isArray','length','join','app','.js','toLowerCase','appdata','channel','mail','push','slice','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','tvox','notificationTemplate','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','busy','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','updateRealtime'];(function(_0x3d15d6,_0x5022c7){var _0x9a3e33=function(_0x19212a){while(--_0x19212a){_0x3d15d6['push'](_0x3d15d6['shift']());}};_0x9a3e33(++_0x5022c7);}(_0xe700,0xd0));var _0x0e70=function(_0x35fbef,_0x1054bb){_0x35fbef=_0x35fbef-0x0;var _0x23793d=_0xe700[_0x35fbef];return _0x23793d;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var path=require(_0x0e70('0x2'));var fs=require('fs');var jayson=require(_0x0e70('0x3'));var BPromise=require(_0x0e70('0x4'));var utils=require(_0x0e70('0x5'));var sUtils=require(_0x0e70('0x6'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x0e70('0x7')),'mailQueueReport':require(_0x0e70('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x0e70('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1ae523,_0xbdf137,_0x2202f9){return util[_0x0e70('0xa')](_0x0e70('0xb'),_0x1ae523,_0xbdf137||0x0,_0x2202f9||0x0);}function getIntervals(_0x339c67,_0x32d63c){var _0x9361a9=[];if(!_['isNil'](_0x32d63c[_0x0e70('0xc')])&&!_['isNil'](_0x339c67[_0x32d63c['IntervalId']])&&!_['isNil'](_0x339c67[_0x32d63c['IntervalId']][_0x0e70('0xd')])){_0x9361a9=_['map'](_0x339c67[_0x32d63c['IntervalId']]['Intervals'],_0x0e70('0xe'));}else if(!_[_0x0e70('0xf')](_0x32d63c[_0x0e70('0xe')])){_0x9361a9=[_0x32d63c[_0x0e70('0xe')]];}return _0x9361a9;}exports[_0x0e70('0x10')]=function(_0x19c215){_0x19c215[_0x0e70('0x11')]={};return new BPromise(function(_0x177cda,_0x29e3ed){var _0x246507={'Start':function(_0x32c377){var _0x2e795c=this;return new Promise(function(_0x45bbbe,_0x131767){if(_0x32c377){try{var _0x5a81aa=[];var _0x20b2ec=getId(_0x32c377['channel'],_0x32c377[_0x0e70('0x12')]?_0x32c377[_0x0e70('0x12')]['id']:0x0,_0x32c377[_0x0e70('0x13')]?_0x32c377['interaction']['id']:0x0);var _0x9399bb=sUtils[_0x0e70('0x14')](_0x19c215,_0x32c377);if(!_0x9399bb&&_0x32c377[_0x0e70('0x15')]&&_[_0x0e70('0x16')](_0x32c377['applications'])&&_0x32c377[_0x0e70('0x15')]['length']){for(var _0xe775aa=0x0;_0xe775aa<_0x32c377['applications'][_0x0e70('0x17')];_0xe775aa+=0x1){var _0xe5af27=_0x32c377['applications'][_0xe775aa];if(fs['existsSync'](path[_0x0e70('0x18')](__dirname,_0x0e70('0x15'),_0xe5af27[_0x0e70('0x19')]+_0x0e70('0x1a')))){var _0x48684d=[];switch(_0xe5af27[_0x0e70('0x19')][_0x0e70('0x1b')]()){case'autoreply':var _0x383c60=_0xe5af27[_0x0e70('0x1c')]['split'](',');if(_0x32c377[_0x0e70('0x1d')]===_0x0e70('0x1e')){_0x48684d[_0x0e70('0x1f')](_0x383c60[0x0]);_0x48684d['push'](_0x383c60[0x1]);_0x48684d[_0x0e70('0x1f')](_0x383c60[_0x0e70('0x20')](0x2,_0x383c60[_0x0e70('0x17')])[_0x0e70('0x18')](','));}else{_0x48684d[_0x0e70('0x1f')](_0x383c60[0x0]);_0x48684d['push'](_0x383c60[_0x0e70('0x20')](0x1,_0x383c60[_0x0e70('0x17')])['join'](','));}break;case _0x0e70('0x21'):var _0x3e814b=_0xe5af27[_0x0e70('0x1c')][_0x0e70('0x22')](',');_0x48684d[_0x0e70('0x1f')](_0x3e814b[0x0]);_0x48684d[_0x0e70('0x1f')](_0x3e814b[0x1]);_0x48684d['push'](_0x3e814b['slice'](0x2,_0x3e814b[_0x0e70('0x17')])[_0x0e70('0x18')](','));break;case _0x0e70('0x23'):var _0x40fec3=_0xe5af27[_0x0e70('0x1c')][_0x0e70('0x22')](',');_0x48684d[_0x0e70('0x1f')](_0x40fec3[0x0]);_0x48684d[_0x0e70('0x1f')](_0x40fec3[0x1]);_0x48684d[_0x0e70('0x1f')](_0x40fec3[0x2]);_0x48684d[_0x0e70('0x1f')](_0x40fec3[0x3]);_0x48684d[_0x0e70('0x1f')](_0x40fec3['slice'](0x4,_0x40fec3[_0x0e70('0x17')])[_0x0e70('0x18')](','));break;case _0x0e70('0x24'):var _0x133115=_0xe5af27[_0x0e70('0x1c')][_0x0e70('0x22')](',');_0x48684d[_0x0e70('0x1f')](_0x133115[0x0]);_0x48684d[_0x0e70('0x1f')](_0x133115[0x1]);_0x48684d[_0x0e70('0x1f')](_0x133115[0x2]);_0x48684d[_0x0e70('0x1f')](_0x133115[0x3]);_0x48684d[_0x0e70('0x1f')](_0x133115['slice'](0x4,_0x133115[_0x0e70('0x17')])[_0x0e70('0x18')](','));break;case _0x0e70('0x12'):_0x48684d[_0x0e70('0x1f')](_0xe5af27['appdata']);break;case _0x0e70('0x25'):_0x48684d['push'](_0xe5af27[_0x0e70('0x26')]);_0x48684d[_0x0e70('0x1f')](_0xe5af27[_0x0e70('0x1c')]);break;case _0x0e70('0x27'):var _0x4243f5=utils['getMustacheRender'](_0x32c377['account'][_0x0e70('0x28')],_0x32c377);var _0x2f02ef=_0xe5af27[_0x0e70('0x1c')][_0x0e70('0x22')](',');_0x48684d[_0x0e70('0x1f')](_0x2f02ef[0x0]);_0x48684d['push'](_0x2f02ef[0x1]);_0x48684d[_0x0e70('0x1f')](_0x2f02ef[0x2]);_0x48684d[_0x0e70('0x1f')](_0x2f02ef[0x3]);_0x48684d[_0x0e70('0x1f')](_0x2f02ef[0x4]);_0x48684d[_0x0e70('0x1f')](_0x2f02ef[0x5]);_0x48684d[_0x0e70('0x1f')](_0x2f02ef[0x6]);_0x48684d[_0x0e70('0x1f')](_0x2f02ef[0x7]);_0x48684d[_0x0e70('0x1f')](_0x2f02ef[0x8]);_0x48684d[_0x0e70('0x1f')](_0x2f02ef[0x9]);_0x48684d[_0x0e70('0x1f')](_0x2f02ef[0xa]);_0x48684d['push'](_0x32c377['interaction']['id']);_0x48684d['push'](_0x32c377['message']['id']);_0x48684d[_0x0e70('0x1f')](_0xe5af27['ChatWebsiteId']);_0x48684d[_0x0e70('0x1f')](_0x32c377[_0x0e70('0x13')]['ContactId']);_0x48684d['push'](_0x32c377[_0x0e70('0x29')][_0x0e70('0x29')]);_0x48684d[_0x0e70('0x1f')](_0x4243f5);break;default:_0x48684d=_['isNil'](_0xe5af27[_0x0e70('0x1c')])?[]:_0xe5af27[_0x0e70('0x1c')][_0x0e70('0x22')](',');}var _0x1cb6f3={'id':util[_0x0e70('0xa')](_0x0e70('0x2a'),_0x20b2ec,_0xe5af27['id'],_0xe5af27['app']),'condition':require(_0x0e70('0x2b'))[_0x0e70('0x2c')](_0x20b2ec,getIntervals(_0x19c215[_0x0e70('0x2d')],_0xe5af27),_0x19c215),'consequence':require(_0x0e70('0x2e')+_0xe5af27['app'])[_0x0e70('0x2f')](_0x20b2ec,_0x48684d,_0x19c215,_0x32c377),'p':_0xe5af27[_0x0e70('0x30')]||0x0};logger[_0x0e70('0x31')]('Push\x20new\x20rule',_0x1cb6f3['id'],_0x0e70('0x32'),getIntervals(_0x19c215[_0x0e70('0x2d')],_0xe5af27)[_0x0e70('0x18')](_0x0e70('0x33')));_0x5a81aa['push'](_0x1cb6f3);}else{logger[_0x0e70('0x34')](_0x0e70('0x35'),path['join'](__dirname,_0x0e70('0x15'),_0xe5af27[_0x0e70('0x19')]+_0x0e70('0x1a')));}}_0x19c215[_0x0e70('0x11')][_0x20b2ec]=new RuleEngine(_0x5a81aa);_0x19c215[_0x0e70('0x11')][_0x20b2ec][_0x0e70('0x36')](_0x32c377,function(_0x5d705e){logger['info']('Applications\x20executed',JSON[_0x0e70('0x37')](_0x5d705e['matchPath']));if(_0x19c215[_0x0e70('0x11')][_0x20b2ec]){_0x19c215['rules'][_0x20b2ec][_0x0e70('0x38')](_0x0e70('0x39'));}});return _0x45bbbe({'code':0xc8,'message':_0x32c377});}else{if(_0x9399bb){logger[_0x0e70('0x31')](util[_0x0e70('0xa')](_0x0e70('0x3a'),_0x20b2ec));}else{logger[_0x0e70('0x31')](_0x0e70('0x3b'));}return _0x45bbbe({'code':0xc8,'message':_0x32c377});}}catch(_0x5a9033){logger[_0x0e70('0x34')](_0x5a9033[_0x0e70('0x3c')]);return _0x131767(_0x2e795c['error'](0x1f4,_0x5a9033));}}return _0x131767('routing\x20is\x20empty');});},'AcceptMessage':function(_0x158e5d){var _0x4a97ce=this;return new Promise(function(_0x290660,_0x31f8f5){if(_0x158e5d[_0x0e70('0x3d')]&&_0x158e5d['agent']['id']){if(_0x19c215[_0x0e70('0x3e')][_0x158e5d[_0x0e70('0x3d')]['id']]){_0x19c215[_0x0e70('0x3e')][_0x158e5d['agent']['id']][_0x0e70('0x3f')]=![];_0x19c215['agents'][_0x158e5d[_0x0e70('0x3d')]['id']]['busyQueue']=undefined;}}if(_0x158e5d[_0x0e70('0x12')]&&_0x158e5d[_0x0e70('0x12')]['id']){try{var _0x4963c4=getId(_0x158e5d['channel'],_0x158e5d[_0x0e70('0x12')]?_0x158e5d['message']['id']:0x0,_0x158e5d[_0x0e70('0x13')]?_0x158e5d[_0x0e70('0x13')]['id']:0x0);if(_0x19c215['rules'][_0x4963c4]){_0x19c215[_0x0e70('0x11')][_0x4963c4][_0x0e70('0x38')](_0x0e70('0x40'));if(rpc[_0x158e5d['channel']+'QueueReport']){rpc[_0x158e5d[_0x0e70('0x1d')]+_0x0e70('0x41')][_0x0e70('0x42')](_0x4963c4,{'UserId':_0x158e5d['message']['UserId']})[_0x0e70('0x43')](function(){logger[_0x0e70('0x34')](_0x0e70('0x44'));});}}return _0x290660({'code':0xc8,'message':_0x158e5d});}catch(_0x3464f2){logger[_0x0e70('0x34')](_0x3464f2[_0x0e70('0x3c')]);return _0x31f8f5(_0x4a97ce[_0x0e70('0x34')](0x1f4,_0x3464f2));}}logger[_0x0e70('0x34')](_0x0e70('0x45'));return _0x31f8f5(_0x4a97ce[_0x0e70('0x34')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2ce285){var _0x210d80=this;return new Promise(function(_0x593018,_0x26788c){if(_0x2ce285[_0x0e70('0x3d')]&&_0x2ce285[_0x0e70('0x3d')]['id']){try{if(_0x19c215[_0x0e70('0x3e')][_0x2ce285[_0x0e70('0x3d')]['id']]){_0x19c215[_0x0e70('0x3e')][_0x2ce285[_0x0e70('0x3d')]['id']][_0x0e70('0x3f')]=![];_0x19c215[_0x0e70('0x3e')][_0x2ce285[_0x0e70('0x3d')]['id']][_0x0e70('0x46')]=undefined;}return _0x593018({'code':0xc8,'message':_0x2ce285});}catch(_0x112ce8){logger['error'](_0x112ce8['stack']);return _0x26788c(_0x210d80[_0x0e70('0x34')](0x1f4,_0x112ce8));}}logger[_0x0e70('0x34')](_0x0e70('0x45'));return _0x26788c(_0x210d80[_0x0e70('0x34')](0x1f4,_0x0e70('0x45')));});},'AbandonInteraction':function(_0x938ea){var _0x5d5026=this;return new Promise(function(_0x3e441c,_0x327723){if(_0x938ea['channel']&&_0x938ea[_0x0e70('0x13')]&&_0x938ea[_0x0e70('0x13')]['id']){try{var _0x5fd0ff=getId(_0x938ea[_0x0e70('0x1d')],_0x938ea[_0x0e70('0x12')]?_0x938ea['message']['id']:0x0,_0x938ea[_0x0e70('0x13')]?_0x938ea['interaction']['id']:0x0);if(_0x19c215[_0x0e70('0x11')][_0x5fd0ff]){_0x19c215[_0x0e70('0x11')][_0x5fd0ff][_0x0e70('0x38')](_0x0e70('0x40'));}return _0x3e441c({'code':0xc8,'message':_0x938ea});}catch(_0x44364d){logger[_0x0e70('0x34')](_0x44364d[_0x0e70('0x3c')]);return _0x327723(_0x5d5026['error'](0x1f4,_0x44364d));}}logger[_0x0e70('0x34')](_0x0e70('0x45'));return _0x327723(_0x5d5026[_0x0e70('0x34')](0x1f4,_0x0e70('0x45')));});},'AgentCapacity':function(_0x40be8f){var _0xb0341c=this;return new Promise(function(_0x25bb3e,_0x4e4846){if(_0x19c215[_0x0e70('0x3e')][_0x0e70('0x47')](_0x40be8f['id'])){for(var _0x58e63e in _0x40be8f[_0x0e70('0x48')]){if(_0x40be8f['capacity'][_0x0e70('0x47')](_0x58e63e)){if(_0x19c215[_0x0e70('0x3e')][_0x40be8f['id']][_0x0e70('0x47')](_0x58e63e+'CurrentCapacity')){_0x19c215['agents'][_0x40be8f['id']][_0x58e63e+'CurrentCapacity']=parseInt(_0x40be8f[_0x0e70('0x48')][_0x58e63e],0xa);}}}_0x19c215[_0x0e70('0x3e')][_0x40be8f['id']][_0x0e70('0x49')]();return _0x25bb3e({'code':0xc8,'message':_0x19c215[_0x0e70('0x3e')][_0x40be8f['id']]});}else{return _0x4e4846(_0xb0341c[_0x0e70('0x34')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x595e4c){return new Promise(function(_0x3230cd){var _0x4f1017=_[_0x0e70('0x4a')](_0x19c215[_0x0e70('0x3e')]);if(_0x595e4c&&_0x595e4c['id']){var _0x1f243a=_[_0x0e70('0x4b')](_0x4f1017,function(_0xadcb1a){return _0xadcb1a['id']===_0x595e4c['id'];});_0x3230cd(_0x1f243a);}else{_0x3230cd({'count':_0x4f1017['length'],'rows':_0x4f1017});}});},'ChatQueues':function(){return new Promise(function(_0x377733){var _0x4af8c4=[];for(var _0x5d0515 in _0x19c215['chatQueues']){if(_0x19c215[_0x0e70('0x4c')][_0x0e70('0x47')](_0x5d0515)){var _0x488525=_0x19c215[_0x0e70('0x4c')][_0x5d0515];var _0x5ee629={'id':_0x488525['id'],'available':_0x488525[_0x0e70('0x4d')],'loggedIn':_0x488525['loggedIn'],'name':_0x488525[_0x0e70('0x4e')],'paused':_0x488525[_0x0e70('0x4f')],'waiting':_0x488525['waiting']};_0x4af8c4[_0x0e70('0x1f')](_0x5ee629);}}_0x377733({'count':_0x4af8c4['length'],'rows':_0x4af8c4});});},'MailQueues':function(){return new Promise(function(_0x313a54){var _0x5e90d6=[];for(var _0x3c99bc in _0x19c215[_0x0e70('0x50')]){if(_0x19c215[_0x0e70('0x50')]['hasOwnProperty'](_0x3c99bc)){var _0x1f4ec7=_0x19c215[_0x0e70('0x50')][_0x3c99bc];var _0x3131fc={'id':_0x1f4ec7['id'],'available':_0x1f4ec7[_0x0e70('0x4d')],'loggedIn':_0x1f4ec7['loggedIn'],'name':_0x1f4ec7[_0x0e70('0x4e')],'paused':_0x1f4ec7[_0x0e70('0x4f')],'waiting':_0x1f4ec7['waiting']};_0x5e90d6[_0x0e70('0x1f')](_0x3131fc);}}_0x313a54({'count':_0x5e90d6[_0x0e70('0x17')],'rows':_0x5e90d6});});},'OpenchannelQueues':function(){return new Promise(function(_0x56a98b){var _0x49c9fa=[];for(var _0x40a34f in _0x19c215['openchannelQueues']){if(_0x19c215[_0x0e70('0x51')][_0x0e70('0x47')](_0x40a34f)){var _0x4a75bd=_0x19c215[_0x0e70('0x51')][_0x40a34f];var _0x39fb96={'id':_0x4a75bd['id'],'available':_0x4a75bd[_0x0e70('0x4d')],'loggedIn':_0x4a75bd[_0x0e70('0x52')],'name':_0x4a75bd[_0x0e70('0x4e')],'paused':_0x4a75bd[_0x0e70('0x4f')],'waiting':_0x4a75bd[_0x0e70('0x53')]};_0x49c9fa[_0x0e70('0x1f')](_0x39fb96);}}_0x56a98b({'count':_0x49c9fa[_0x0e70('0x17')],'rows':_0x49c9fa});});},'SmsQueues':function(){return new Promise(function(_0x497392){var _0x34b9c2=[];for(var _0x5e34b2 in _0x19c215[_0x0e70('0x54')]){if(_0x19c215[_0x0e70('0x54')][_0x0e70('0x47')](_0x5e34b2)){var _0x35d129=_0x19c215[_0x0e70('0x54')][_0x5e34b2];var _0x423e3d={'id':_0x35d129['id'],'available':_0x35d129[_0x0e70('0x4d')],'loggedIn':_0x35d129[_0x0e70('0x52')],'name':_0x35d129[_0x0e70('0x4e')],'paused':_0x35d129[_0x0e70('0x4f')],'waiting':_0x35d129[_0x0e70('0x53')]};_0x34b9c2[_0x0e70('0x1f')](_0x423e3d);}}_0x497392({'count':_0x34b9c2[_0x0e70('0x17')],'rows':_0x34b9c2});});},'FaxQueues':function(){return new Promise(function(_0x5f7cf9){var _0x3f99a6=[];for(var _0x3a2bd0 in _0x19c215['faxQueues']){if(_0x19c215['faxQueues'][_0x0e70('0x47')](_0x3a2bd0)){var _0x56d432=_0x19c215[_0x0e70('0x55')][_0x3a2bd0];var _0xf64031={'id':_0x56d432['id'],'available':_0x56d432[_0x0e70('0x4d')],'loggedIn':_0x56d432[_0x0e70('0x52')],'name':_0x56d432[_0x0e70('0x4e')],'paused':_0x56d432[_0x0e70('0x4f')],'waiting':_0x56d432['waiting']};_0x3f99a6['push'](_0xf64031);}}_0x5f7cf9({'count':_0x3f99a6[_0x0e70('0x17')],'rows':_0x3f99a6});});},'WhatsappQueues':function(){return new Promise(function(_0x1104e8){var _0x56d97f=[];for(var _0xb23f4 in _0x19c215[_0x0e70('0x56')]){if(_0x19c215[_0x0e70('0x56')]['hasOwnProperty'](_0xb23f4)){var _0x173847=_0x19c215[_0x0e70('0x56')][_0xb23f4];var _0x218f22={'id':_0x173847['id'],'available':_0x173847[_0x0e70('0x4d')],'loggedIn':_0x173847['loggedIn'],'name':_0x173847['name'],'paused':_0x173847[_0x0e70('0x4f')],'waiting':_0x173847[_0x0e70('0x53')]};_0x56d97f[_0x0e70('0x1f')](_0x218f22);}}_0x1104e8({'count':_0x56d97f['length'],'rows':_0x56d97f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x433fa9){var _0x34ed06=_['values'](_0x19c215[_0x0e70('0x57')]);_0x433fa9({'count':_0x34ed06[_0x0e70('0x17')],'rows':_0x34ed06});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x23e524){var _0x2ad726=_[_0x0e70('0x4a')](_0x19c215['mailQueuesWaitingInteractions']);_0x23e524({'count':_0x2ad726[_0x0e70('0x17')],'rows':_0x2ad726});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x223d8e){var _0x4099c3=_[_0x0e70('0x4a')](_0x19c215[_0x0e70('0x58')]);_0x223d8e({'count':_0x4099c3['length'],'rows':_0x4099c3});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xc4f9d2){var _0x373827=_[_0x0e70('0x4a')](_0x19c215['smsQueuesWaitingInteractions']);_0xc4f9d2({'count':_0x373827['length'],'rows':_0x373827});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4db532){var _0x4222d0=_[_0x0e70('0x4a')](_0x19c215[_0x0e70('0x59')]);_0x4db532({'count':_0x4222d0[_0x0e70('0x17')],'rows':_0x4222d0});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x491a6e){var _0x1744a3=_['values'](_0x19c215['whatsappQueuesWaitingInteractions']);_0x491a6e({'count':_0x1744a3[_0x0e70('0x17')],'rows':_0x1744a3});});}};var _0x16c068=jayson['server'](_0x246507)[_0x0e70('0x5a')]();_0x16c068['on'](_0x0e70('0x34'),function(_0x482b3f){logger['error'](JSON[_0x0e70('0x37')](_0x482b3f));return _0x29e3ed(_0x482b3f);});_0x16c068[_0x0e70('0x10')](0x232c,'127.0.0.1',function(){console[_0x0e70('0x5b')](_0x0e70('0x5c'),0x232c);return _0x177cda(_0x0e70('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x326e=['ContactId','body','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','.js','execute','Applications\x20executed','matchPath','emit','complete','format','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','appdata','split','channel','push','slice','amazonlex','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId'];(function(_0xf3e4a0,_0x16a172){var _0x43f1cc=function(_0x3abdf5){while(--_0x3abdf5){_0xf3e4a0['push'](_0xf3e4a0['shift']());}};_0x43f1cc(++_0x16a172);}(_0x326e,0x15d));var _0xe326=function(_0x184ae5,_0x43d9a6){_0x184ae5=_0x184ae5-0x0;var _0x57357b=_0x326e[_0x184ae5];return _0x57357b;};'use strict';var _=require(_0xe326('0x0'));var util=require(_0xe326('0x1'));var path=require(_0xe326('0x2'));var fs=require('fs');var jayson=require(_0xe326('0x3'));var BPromise=require(_0xe326('0x4'));var utils=require('./applications/utils');var sUtils=require(_0xe326('0x5'));var logger=require(_0xe326('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0xe326('0x7')),'mailQueueReport':require(_0xe326('0x8')),'chatQueueReport':require(_0xe326('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xe326('0xa'));function getId(_0x406304,_0x21d9bc,_0x5204cd){return util['format']('%s.%s.%s',_0x406304,_0x21d9bc||0x0,_0x5204cd||0x0);}function getIntervals(_0x3f4226,_0x113e86){var _0x5bdb6b=[];if(!_[_0xe326('0xb')](_0x113e86[_0xe326('0xc')])&&!_[_0xe326('0xb')](_0x3f4226[_0x113e86[_0xe326('0xc')]])&&!_[_0xe326('0xb')](_0x3f4226[_0x113e86[_0xe326('0xc')]][_0xe326('0xd')])){_0x5bdb6b=_[_0xe326('0xe')](_0x3f4226[_0x113e86[_0xe326('0xc')]][_0xe326('0xd')],_0xe326('0xf'));}else if(!_[_0xe326('0xb')](_0x113e86['interval'])){_0x5bdb6b=[_0x113e86[_0xe326('0xf')]];}return _0x5bdb6b;}exports[_0xe326('0x10')]=function(_0x9e6a95){_0x9e6a95[_0xe326('0x11')]={};return new BPromise(function(_0x420a30,_0x7b59c5){var _0x28a843={'Start':function(_0x53562d){var _0x3b7cd5=this;return new Promise(function(_0x47a2fd,_0x4ef3f9){if(_0x53562d){try{var _0x5d120d=[];var _0x43c52c=getId(_0x53562d['channel'],_0x53562d[_0xe326('0x12')]?_0x53562d['message']['id']:0x0,_0x53562d[_0xe326('0x13')]?_0x53562d[_0xe326('0x13')]['id']:0x0);var _0xe7489=sUtils[_0xe326('0x14')](_0x9e6a95,_0x53562d);if(!_0xe7489&&_0x53562d[_0xe326('0x15')]&&_[_0xe326('0x16')](_0x53562d[_0xe326('0x15')])&&_0x53562d[_0xe326('0x15')][_0xe326('0x17')]){for(var _0x22cb15=0x0;_0x22cb15<_0x53562d['applications']['length'];_0x22cb15+=0x1){var _0x2e31ac=_0x53562d[_0xe326('0x15')][_0x22cb15];if(fs[_0xe326('0x18')](path[_0xe326('0x19')](__dirname,_0xe326('0x15'),_0x2e31ac['app']+'.js'))){var _0x3b6e67=[];switch(_0x2e31ac[_0xe326('0x1a')]['toLowerCase']()){case'autoreply':var _0x3007c0=_0x2e31ac[_0xe326('0x1b')][_0xe326('0x1c')](',');if(_0x53562d[_0xe326('0x1d')]==='mail'){_0x3b6e67['push'](_0x3007c0[0x0]);_0x3b6e67['push'](_0x3007c0[0x1]);_0x3b6e67[_0xe326('0x1e')](_0x3007c0[_0xe326('0x1f')](0x2,_0x3007c0['length'])[_0xe326('0x19')](','));}else{_0x3b6e67[_0xe326('0x1e')](_0x3007c0[0x0]);_0x3b6e67['push'](_0x3007c0[_0xe326('0x1f')](0x1,_0x3007c0[_0xe326('0x17')])['join'](','));}break;case'dialogflow':var _0x19a1ee=_0x2e31ac[_0xe326('0x1b')][_0xe326('0x1c')](',');_0x3b6e67['push'](_0x19a1ee[0x0]);_0x3b6e67['push'](_0x19a1ee[0x1]);_0x3b6e67[_0xe326('0x1e')](_0x19a1ee[_0xe326('0x1f')](0x2,_0x19a1ee['length'])[_0xe326('0x19')](','));break;case'dialogflowv2':var _0x2385b4=_0x2e31ac[_0xe326('0x1b')]['split'](',');_0x3b6e67[_0xe326('0x1e')](_0x2385b4[0x0]);_0x3b6e67[_0xe326('0x1e')](_0x2385b4[0x1]);_0x3b6e67[_0xe326('0x1e')](_0x2385b4[0x2]);_0x3b6e67[_0xe326('0x1e')](_0x2385b4[0x3]);_0x3b6e67[_0xe326('0x1e')](_0x2385b4[_0xe326('0x1f')](0x4,_0x2385b4[_0xe326('0x17')])['join'](','));break;case _0xe326('0x20'):var _0x436532=_0x2e31ac[_0xe326('0x1b')][_0xe326('0x1c')](',');_0x3b6e67[_0xe326('0x1e')](_0x436532[0x0]);_0x3b6e67[_0xe326('0x1e')](_0x436532[0x1]);_0x3b6e67[_0xe326('0x1e')](_0x436532[0x2]);_0x3b6e67[_0xe326('0x1e')](_0x436532[0x3]);_0x3b6e67[_0xe326('0x1e')](_0x436532[_0xe326('0x1f')](0x4,_0x436532[_0xe326('0x17')])[_0xe326('0x19')](','));break;case _0xe326('0x12'):_0x3b6e67[_0xe326('0x1e')](_0x2e31ac[_0xe326('0x1b')]);break;case _0xe326('0x21'):_0x3b6e67['push'](_0x2e31ac[_0xe326('0x22')]);_0x3b6e67[_0xe326('0x1e')](_0x2e31ac['appdata']);break;case _0xe326('0x23'):var _0x1ad89e=utils[_0xe326('0x24')](_0x53562d[_0xe326('0x25')]['notificationTemplate'],_0x53562d);var _0x346c47=_0x2e31ac['appdata']['split'](',');_0x3b6e67[_0xe326('0x1e')](_0x346c47[0x0]);_0x3b6e67['push'](_0x346c47[0x1]);_0x3b6e67['push'](_0x346c47[0x2]);_0x3b6e67['push'](_0x346c47[0x3]);_0x3b6e67['push'](_0x346c47[0x4]);_0x3b6e67['push'](_0x346c47[0x5]);_0x3b6e67[_0xe326('0x1e')](_0x346c47[0x6]);_0x3b6e67['push'](_0x346c47[0x7]);_0x3b6e67[_0xe326('0x1e')](_0x346c47[0x8]);_0x3b6e67['push'](_0x346c47[0x9]);_0x3b6e67[_0xe326('0x1e')](_0x346c47[0xa]);_0x3b6e67[_0xe326('0x1e')](_0x53562d['interaction']['id']);_0x3b6e67[_0xe326('0x1e')](_0x53562d[_0xe326('0x12')]['id']);_0x3b6e67[_0xe326('0x1e')](_0x2e31ac[_0xe326('0x26')]);_0x3b6e67[_0xe326('0x1e')](_0x53562d[_0xe326('0x13')][_0xe326('0x27')]);_0x3b6e67[_0xe326('0x1e')](_0x53562d['body'][_0xe326('0x28')]);_0x3b6e67['push'](_0x1ad89e);break;default:_0x3b6e67=_[_0xe326('0xb')](_0x2e31ac[_0xe326('0x1b')])?[]:_0x2e31ac['appdata'][_0xe326('0x1c')](',');}var _0x2d1725={'id':util['format'](_0xe326('0x29'),_0x43c52c,_0x2e31ac['id'],_0x2e31ac[_0xe326('0x1a')]),'condition':require('./interval')[_0xe326('0x2a')](_0x43c52c,getIntervals(_0x9e6a95[_0xe326('0x2b')],_0x2e31ac),_0x9e6a95),'consequence':require(_0xe326('0x2c')+_0x2e31ac['app'])[_0xe326('0x2d')](_0x43c52c,_0x3b6e67,_0x9e6a95,_0x53562d),'p':_0x2e31ac[_0xe326('0x2e')]||0x0};logger[_0xe326('0x2f')](_0xe326('0x30'),_0x2d1725['id'],'on\x20interval',getIntervals(_0x9e6a95[_0xe326('0x2b')],_0x2e31ac)[_0xe326('0x19')](_0xe326('0x31')));_0x5d120d['push'](_0x2d1725);}else{logger[_0xe326('0x32')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x2e31ac[_0xe326('0x1a')]+_0xe326('0x33')));}}_0x9e6a95['rules'][_0x43c52c]=new RuleEngine(_0x5d120d);_0x9e6a95[_0xe326('0x11')][_0x43c52c][_0xe326('0x34')](_0x53562d,function(_0x3db693){logger[_0xe326('0x2f')](_0xe326('0x35'),JSON['stringify'](_0x3db693[_0xe326('0x36')]));if(_0x9e6a95[_0xe326('0x11')][_0x43c52c]){_0x9e6a95[_0xe326('0x11')][_0x43c52c][_0xe326('0x37')](_0xe326('0x38'));}});return _0x47a2fd({'code':0xc8,'message':_0x53562d});}else{if(_0xe7489){logger[_0xe326('0x2f')](util[_0xe326('0x39')](_0xe326('0x3a'),_0x43c52c));}else{logger[_0xe326('0x2f')](_0xe326('0x3b'));}return _0x47a2fd({'code':0xc8,'message':_0x53562d});}}catch(_0x33f700){logger[_0xe326('0x32')](_0x33f700[_0xe326('0x3c')]);return _0x4ef3f9(_0x3b7cd5[_0xe326('0x32')](0x1f4,_0x33f700));}}return _0x4ef3f9(_0xe326('0x3d'));});},'AcceptMessage':function(_0x83740f){var _0x58fb97=this;return new Promise(function(_0x322243,_0x40df7e){if(_0x83740f[_0xe326('0x3e')]&&_0x83740f['agent']['id']){if(_0x9e6a95[_0xe326('0x3f')][_0x83740f[_0xe326('0x3e')]['id']]){_0x9e6a95[_0xe326('0x3f')][_0x83740f['agent']['id']][_0xe326('0x40')]=![];_0x9e6a95[_0xe326('0x3f')][_0x83740f[_0xe326('0x3e')]['id']]['busyQueue']=undefined;}}if(_0x83740f[_0xe326('0x12')]&&_0x83740f['message']['id']){try{var _0x1a8d18=getId(_0x83740f[_0xe326('0x1d')],_0x83740f[_0xe326('0x12')]?_0x83740f[_0xe326('0x12')]['id']:0x0,_0x83740f[_0xe326('0x13')]?_0x83740f[_0xe326('0x13')]['id']:0x0);if(_0x9e6a95[_0xe326('0x11')][_0x1a8d18]){_0x9e6a95[_0xe326('0x11')][_0x1a8d18]['emit'](_0xe326('0x41'));if(rpc[_0x83740f[_0xe326('0x1d')]+_0xe326('0x42')]){rpc[_0x83740f[_0xe326('0x1d')]+_0xe326('0x42')][_0xe326('0x43')](_0x1a8d18,{'UserId':_0x83740f[_0xe326('0x12')][_0xe326('0x44')]})[_0xe326('0x45')](function(){logger[_0xe326('0x32')]('error\x20update\x20queue\x20report');});}}return _0x322243({'code':0xc8,'message':_0x83740f});}catch(_0x26505d){logger[_0xe326('0x32')](_0x26505d[_0xe326('0x3c')]);return _0x40df7e(_0x58fb97[_0xe326('0x32')](0x1f4,_0x26505d));}}logger[_0xe326('0x32')](_0xe326('0x46'));return _0x40df7e(_0x58fb97[_0xe326('0x32')](0x1f4,_0xe326('0x46')));});},'RejectMessage':function(_0x4a1a8e){var _0x1d1c76=this;return new Promise(function(_0x34d890,_0x3c9468){if(_0x4a1a8e[_0xe326('0x3e')]&&_0x4a1a8e[_0xe326('0x3e')]['id']){try{if(_0x9e6a95[_0xe326('0x3f')][_0x4a1a8e['agent']['id']]){_0x9e6a95[_0xe326('0x3f')][_0x4a1a8e[_0xe326('0x3e')]['id']][_0xe326('0x40')]=![];_0x9e6a95[_0xe326('0x3f')][_0x4a1a8e[_0xe326('0x3e')]['id']]['busyQueue']=undefined;}return _0x34d890({'code':0xc8,'message':_0x4a1a8e});}catch(_0x21c400){logger['error'](_0x21c400[_0xe326('0x3c')]);return _0x3c9468(_0x1d1c76[_0xe326('0x32')](0x1f4,_0x21c400));}}logger[_0xe326('0x32')](_0xe326('0x46'));return _0x3c9468(_0x1d1c76['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x11bcc7){var _0x36578b=this;return new Promise(function(_0x493424,_0x21ea50){if(_0x11bcc7[_0xe326('0x1d')]&&_0x11bcc7[_0xe326('0x13')]&&_0x11bcc7[_0xe326('0x13')]['id']){try{var _0x2c90e5=getId(_0x11bcc7[_0xe326('0x1d')],_0x11bcc7['message']?_0x11bcc7['message']['id']:0x0,_0x11bcc7[_0xe326('0x13')]?_0x11bcc7['interaction']['id']:0x0);if(_0x9e6a95[_0xe326('0x11')][_0x2c90e5]){_0x9e6a95[_0xe326('0x11')][_0x2c90e5][_0xe326('0x37')](_0xe326('0x41'));}return _0x493424({'code':0xc8,'message':_0x11bcc7});}catch(_0x38658d){logger['error'](_0x38658d[_0xe326('0x3c')]);return _0x21ea50(_0x36578b[_0xe326('0x32')](0x1f4,_0x38658d));}}logger[_0xe326('0x32')](_0xe326('0x46'));return _0x21ea50(_0x36578b[_0xe326('0x32')](0x1f4,_0xe326('0x46')));});},'AgentCapacity':function(_0x284ad3){var _0xfdcec2=this;return new Promise(function(_0x47f08d,_0x2ab8d7){if(_0x9e6a95[_0xe326('0x3f')][_0xe326('0x47')](_0x284ad3['id'])){for(var _0x349dbb in _0x284ad3[_0xe326('0x48')]){if(_0x284ad3[_0xe326('0x48')][_0xe326('0x47')](_0x349dbb)){if(_0x9e6a95[_0xe326('0x3f')][_0x284ad3['id']][_0xe326('0x47')](_0x349dbb+'CurrentCapacity')){_0x9e6a95[_0xe326('0x3f')][_0x284ad3['id']][_0x349dbb+_0xe326('0x49')]=parseInt(_0x284ad3['capacity'][_0x349dbb],0xa);}}}_0x9e6a95[_0xe326('0x3f')][_0x284ad3['id']]['updateRealtime']();return _0x47f08d({'code':0xc8,'message':_0x9e6a95['agents'][_0x284ad3['id']]});}else{return _0x2ab8d7(_0xfdcec2[_0xe326('0x32')](0x1f4,_0xe326('0x4a')));}});},'Agents':function(_0x3c44c9){return new Promise(function(_0x59f7b6){var _0x44dbc6=_['values'](_0x9e6a95[_0xe326('0x3f')]);if(_0x3c44c9&&_0x3c44c9['id']){var _0x2372da=_[_0xe326('0x4b')](_0x44dbc6,function(_0x4751d8){return _0x4751d8['id']===_0x3c44c9['id'];});_0x59f7b6(_0x2372da);}else{_0x59f7b6({'count':_0x44dbc6[_0xe326('0x17')],'rows':_0x44dbc6});}});},'ChatQueues':function(){return new Promise(function(_0x480df5){var _0x4ca8fa=[];for(var _0x3ab0b5 in _0x9e6a95[_0xe326('0x4c')]){if(_0x9e6a95[_0xe326('0x4c')][_0xe326('0x47')](_0x3ab0b5)){var _0x188f03=_0x9e6a95['chatQueues'][_0x3ab0b5];var _0xaf0ae={'id':_0x188f03['id'],'available':_0x188f03[_0xe326('0x4d')],'loggedIn':_0x188f03[_0xe326('0x4e')],'name':_0x188f03[_0xe326('0x4f')],'paused':_0x188f03['paused'],'waiting':_0x188f03[_0xe326('0x50')]};_0x4ca8fa[_0xe326('0x1e')](_0xaf0ae);}}_0x480df5({'count':_0x4ca8fa[_0xe326('0x17')],'rows':_0x4ca8fa});});},'MailQueues':function(){return new Promise(function(_0x7efc0b){var _0x47e31e=[];for(var _0xd5070f in _0x9e6a95[_0xe326('0x51')]){if(_0x9e6a95['mailQueues'][_0xe326('0x47')](_0xd5070f)){var _0x4be98a=_0x9e6a95['mailQueues'][_0xd5070f];var _0x796375={'id':_0x4be98a['id'],'available':_0x4be98a['available'],'loggedIn':_0x4be98a[_0xe326('0x4e')],'name':_0x4be98a['name'],'paused':_0x4be98a[_0xe326('0x52')],'waiting':_0x4be98a[_0xe326('0x50')]};_0x47e31e[_0xe326('0x1e')](_0x796375);}}_0x7efc0b({'count':_0x47e31e[_0xe326('0x17')],'rows':_0x47e31e});});},'OpenchannelQueues':function(){return new Promise(function(_0x15ee4f){var _0xe93396=[];for(var _0x34b655 in _0x9e6a95[_0xe326('0x53')]){if(_0x9e6a95[_0xe326('0x53')][_0xe326('0x47')](_0x34b655)){var _0x4ba9a6=_0x9e6a95[_0xe326('0x53')][_0x34b655];var _0x38b095={'id':_0x4ba9a6['id'],'available':_0x4ba9a6[_0xe326('0x4d')],'loggedIn':_0x4ba9a6[_0xe326('0x4e')],'name':_0x4ba9a6[_0xe326('0x4f')],'paused':_0x4ba9a6['paused'],'waiting':_0x4ba9a6[_0xe326('0x50')]};_0xe93396[_0xe326('0x1e')](_0x38b095);}}_0x15ee4f({'count':_0xe93396[_0xe326('0x17')],'rows':_0xe93396});});},'SmsQueues':function(){return new Promise(function(_0x1a48ac){var _0x4931f5=[];for(var _0xb9930c in _0x9e6a95['smsQueues']){if(_0x9e6a95['smsQueues']['hasOwnProperty'](_0xb9930c)){var _0x9c75c9=_0x9e6a95['smsQueues'][_0xb9930c];var _0x114e4e={'id':_0x9c75c9['id'],'available':_0x9c75c9[_0xe326('0x4d')],'loggedIn':_0x9c75c9[_0xe326('0x4e')],'name':_0x9c75c9[_0xe326('0x4f')],'paused':_0x9c75c9['paused'],'waiting':_0x9c75c9['waiting']};_0x4931f5['push'](_0x114e4e);}}_0x1a48ac({'count':_0x4931f5['length'],'rows':_0x4931f5});});},'FaxQueues':function(){return new Promise(function(_0x2aa3c7){var _0x27f6e6=[];for(var _0x340b8a in _0x9e6a95[_0xe326('0x54')]){if(_0x9e6a95[_0xe326('0x54')][_0xe326('0x47')](_0x340b8a)){var _0x713cf4=_0x9e6a95[_0xe326('0x54')][_0x340b8a];var _0x3af79d={'id':_0x713cf4['id'],'available':_0x713cf4[_0xe326('0x4d')],'loggedIn':_0x713cf4[_0xe326('0x4e')],'name':_0x713cf4[_0xe326('0x4f')],'paused':_0x713cf4[_0xe326('0x52')],'waiting':_0x713cf4[_0xe326('0x50')]};_0x27f6e6['push'](_0x3af79d);}}_0x2aa3c7({'count':_0x27f6e6[_0xe326('0x17')],'rows':_0x27f6e6});});},'WhatsappQueues':function(){return new Promise(function(_0x1f2023){var _0x42ddfd=[];for(var _0x5a8845 in _0x9e6a95[_0xe326('0x55')]){if(_0x9e6a95[_0xe326('0x55')]['hasOwnProperty'](_0x5a8845)){var _0x68008c=_0x9e6a95[_0xe326('0x55')][_0x5a8845];var _0x47cb23={'id':_0x68008c['id'],'available':_0x68008c['available'],'loggedIn':_0x68008c['loggedIn'],'name':_0x68008c[_0xe326('0x4f')],'paused':_0x68008c[_0xe326('0x52')],'waiting':_0x68008c[_0xe326('0x50')]};_0x42ddfd['push'](_0x47cb23);}}_0x1f2023({'count':_0x42ddfd[_0xe326('0x17')],'rows':_0x42ddfd});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x7a5dce){var _0x15fdb1=_[_0xe326('0x56')](_0x9e6a95['chatQueuesWaitingInteractions']);_0x7a5dce({'count':_0x15fdb1[_0xe326('0x17')],'rows':_0x15fdb1});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1465eb){var _0x4ae066=_['values'](_0x9e6a95[_0xe326('0x57')]);_0x1465eb({'count':_0x4ae066['length'],'rows':_0x4ae066});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1c1fc8){var _0x236d37=_[_0xe326('0x56')](_0x9e6a95[_0xe326('0x58')]);_0x1c1fc8({'count':_0x236d37['length'],'rows':_0x236d37});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x28c700){var _0x2dbaf8=_[_0xe326('0x56')](_0x9e6a95[_0xe326('0x59')]);_0x28c700({'count':_0x2dbaf8[_0xe326('0x17')],'rows':_0x2dbaf8});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x33da0d){var _0x232dd9=_['values'](_0x9e6a95[_0xe326('0x5a')]);_0x33da0d({'count':_0x232dd9[_0xe326('0x17')],'rows':_0x232dd9});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2261d7){var _0x14b251=_[_0xe326('0x56')](_0x9e6a95[_0xe326('0x5b')]);_0x2261d7({'count':_0x14b251[_0xe326('0x17')],'rows':_0x14b251});});}};var _0x16e543=jayson[_0xe326('0x5c')](_0x28a843)[_0xe326('0x5d')]();_0x16e543['on'](_0xe326('0x32'),function(_0x4064fa){logger[_0xe326('0x32')](JSON[_0xe326('0x5e')](_0x4064fa));return _0x7b59c5(_0x4064fa);});_0x16e543[_0xe326('0x10')](0x232c,'127.0.0.1',function(){console[_0xe326('0x5f')](_0xe326('0x60'),0x232c);return _0x420a30('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 426392a..34c779a 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 _0xe001=['stack','util','bluebird','lodash','../../../config/logger','routing','client','http','request','error','message','result','catch','condition','rules','info','stop','length','Command','format','iftime\x20%s','then','indexOf','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20'];(function(_0x437c4d,_0xbc8b6d){var _0x3a6a7f=function(_0x156172){while(--_0x156172){_0x437c4d['push'](_0x437c4d['shift']());}};_0x3a6a7f(++_0xbc8b6d);}(_0xe001,0xcc));var _0x1e00=function(_0x3250b3,_0x447895){_0x3250b3=_0x3250b3-0x0;var _0x8e57fb=_0xe001[_0x3250b3];return _0x8e57fb;};'use strict';var util=require(_0x1e00('0x0'));var BPromise=require(_0x1e00('0x1'));var jayson=require('jayson/promise');var _=require(_0x1e00('0x2'));var logger=require(_0x1e00('0x3'))(_0x1e00('0x4'));var client=jayson[_0x1e00('0x5')][_0x1e00('0x6')]({'port':0x232a});function request(_0x1ae2e6,_0x3d9414){return new BPromise(function(_0x355d19,_0x2ac1e1){return client[_0x1e00('0x7')](_0x1ae2e6,_0x3d9414)['then'](function(_0x3dff50){if(_0x3dff50[_0x1e00('0x8')]){return _0x2ac1e1(_0x3dff50[_0x1e00('0x8')][_0x1e00('0x9')]);}else{return _0x355d19(_0x3dff50[_0x1e00('0xa')]);}})[_0x1e00('0xb')](function(_0x3ece58){return _0x2ac1e1(_0x3ece58);});});}exports[_0x1e00('0xc')]=function(_0x1ace01,_0x12ffb1,_0x2bb95a){return function(_0x179bfc){if(_0x2bb95a[_0x1e00('0xd')]&&!_0x2bb95a[_0x1e00('0xd')][_0x1ace01]){logger[_0x1e00('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1ace01);return _0x179bfc[_0x1e00('0xf')]();}var _0x2d0b72=[];for(var _0x50066d=0x0;_0x50066d<_0x12ffb1[_0x1e00('0x10')];_0x50066d+=0x1){_0x2d0b72['push'](request(_0x1e00('0x11'),{'command':util[_0x1e00('0x12')](_0x1e00('0x13'),_0x12ffb1[_0x50066d])})[_0x1e00('0x14')](function(_0x47d89c){return _0x47d89c&&_0x47d89c[_0x1e00('0x9')]&&_0x47d89c[_0x1e00('0x9')][_0x1e00('0x15')]('true')>=0x0?!![]:![];})['catch'](function(_0x503e08){logger['error'](_0x1e00('0x16'),_0x1ace01,_0x12ffb1[_0x50066d]);}));}BPromise['all'](_0x2d0b72)[_0x1e00('0x14')](function(_0x3ca6a1){var _0x3a6a84=_[_0x1e00('0x17')](_0x3ca6a1);logger['info'](_0x1e00('0x18'),_0x1ace01,_0x12ffb1[_0x1e00('0x19')]('\x20|\x20'),_0x3a6a84);_0x179bfc['when'](_0x3a6a84);})[_0x1e00('0xb')](function(_0xa7a8c5){console[_0x1e00('0x1a')](_0xa7a8c5);logger[_0x1e00('0x8')](_0x1e00('0x18'),_0x1ace01,_0x12ffb1[_0x1e00('0x19')](_0x1e00('0x1b')),_0xa7a8c5[_0x1e00('0x1c')]);_0x179bfc[_0x1e00('0xf')]();});};}; \ No newline at end of file +var _0x783c=['some','[%s][INTERVAL]\x20%s\x20%s','when','catch','log','join','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','client','request','then','message','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','true','error','[%s][INTERVAL]\x20%s'];(function(_0x4fc164,_0x493021){var _0x4f100f=function(_0xf8980d){while(--_0xf8980d){_0x4fc164['push'](_0x4fc164['shift']());}};_0x4f100f(++_0x493021);}(_0x783c,0x94));var _0xc783=function(_0x128e8c,_0x52337f){_0x128e8c=_0x128e8c-0x0;var _0x214afb=_0x783c[_0x128e8c];return _0x214afb;};'use strict';var util=require(_0xc783('0x0'));var BPromise=require(_0xc783('0x1'));var jayson=require(_0xc783('0x2'));var _=require(_0xc783('0x3'));var logger=require('../../../config/logger')('routing');var client=jayson[_0xc783('0x4')]['http']({'port':0x232a});function request(_0x2f1331,_0x39dfc9){return new BPromise(function(_0xe7c2d5,_0x5ea40d){return client[_0xc783('0x5')](_0x2f1331,_0x39dfc9)[_0xc783('0x6')](function(_0x101408){if(_0x101408['error']){return _0x5ea40d(_0x101408['error'][_0xc783('0x7')]);}else{return _0xe7c2d5(_0x101408['result']);}})['catch'](function(_0x1039b5){return _0x5ea40d(_0x1039b5);});});}exports[_0xc783('0x8')]=function(_0x1373cf,_0x11c7dd,_0x1f7247){return function(_0x3e619a){if(_0x1f7247[_0xc783('0x9')]&&!_0x1f7247[_0xc783('0x9')][_0x1373cf]){logger[_0xc783('0xa')](_0xc783('0xb'),_0x1373cf);return _0x3e619a['stop']();}var _0x4d2118=[];for(var _0x516d44=0x0;_0x516d44<_0x11c7dd[_0xc783('0xc')];_0x516d44+=0x1){_0x4d2118[_0xc783('0xd')](request(_0xc783('0xe'),{'command':util[_0xc783('0xf')](_0xc783('0x10'),_0x11c7dd[_0x516d44])})[_0xc783('0x6')](function(_0x931d3c){return _0x931d3c&&_0x931d3c['message']&&_0x931d3c['message']['indexOf'](_0xc783('0x11'))>=0x0?!![]:![];})['catch'](function(_0x3da57e){logger[_0xc783('0x12')](_0xc783('0x13'),_0x1373cf,_0x11c7dd[_0x516d44]);}));}BPromise['all'](_0x4d2118)[_0xc783('0x6')](function(_0x33eaae){var _0x2f3783=_[_0xc783('0x14')](_0x33eaae);logger['info'](_0xc783('0x15'),_0x1373cf,_0x11c7dd['join']('\x20|\x20'),_0x2f3783);_0x3e619a[_0xc783('0x16')](_0x2f3783);})[_0xc783('0x17')](function(_0x159709){console[_0xc783('0x18')](_0x159709);logger[_0xc783('0x12')](_0xc783('0x15'),_0x1373cf,_0x11c7dd[_0xc783('0x19')](_0xc783('0x1a')),_0x159709[_0xc783('0x1b')]);_0x3e619a['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 1ac1f57..fb5cc59 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 _0xb62e=['[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','debug','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect'];(function(_0x43b42d,_0x55422a){var _0x1aa978=function(_0x247f8f){while(--_0x247f8f){_0x43b42d['push'](_0x43b42d['shift']());}};_0x1aa978(++_0x55422a);}(_0xb62e,0x1de));var _0xeb62=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb62e[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var utils=require(_0xeb62('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x386f22,_0x57a5ba){utils[_0xeb62('0x3')](util[_0xeb62('0x4')](_0xeb62('0x5'),_0x386f22[_0xeb62('0x6')],_0x386f22[_0xeb62('0x7')],_0x386f22[_0xeb62('0x8')],_0x386f22['membername'],_0x386f22[_0xeb62('0x9')],_0x386f22[_0xeb62('0xa')],_0x386f22[_0xeb62('0xb')],_0x386f22['lastevent']));if(_0x386f22[_0xeb62('0x8')]){utils[_0xeb62('0xc')](_0x386f22[_0xeb62('0x8')])[_0xeb62('0xd')](function(_0x4967c0){if(_0x4967c0){_0x386f22['type']=_0x4967c0[_0xeb62('0xe')];_0x386f22[_0xeb62('0xf')]=_0x386f22[_0xeb62('0x10')]?_0x4967c0[_0xeb62('0x11')]:![];_0x386f22[_0xeb62('0x12')]=_0x386f22[_0xeb62('0xf')]?_0x4967c0[_0xeb62('0x13')]:0x0;}utils[_0xeb62('0x14')](_0xeb62('0x15'),_0x386f22);});}else{utils[_0xeb62('0x14')]('CreateVoiceAgentReport',_0x386f22);}if(_0x57a5ba){delete transfers[_0x386f22[_0xeb62('0x6')]];}else{delete agents[_0x386f22[_0xeb62('0x16')]];}}exports[_0xeb62('0x17')]=function(_0x6822bc){try{utils['debug'](util[_0xeb62('0x4')](_0xeb62('0x18'),_0x6822bc[_0xeb62('0x6')]),_0x6822bc);agents[_0x6822bc['destuniqueid']]=_0x6822bc;agents[_0x6822bc[_0xeb62('0x16')]][_0xeb62('0x19')]=utils[_0xeb62('0x1a')]();agents[_0x6822bc['destuniqueid']][_0xeb62('0x1b')]=_0xeb62('0x1c');agents[_0x6822bc[_0xeb62('0x16')]][_0xeb62('0xb')]=null;agents[_0x6822bc[_0xeb62('0x16')]][_0xeb62('0x1d')]=null;utils[_0xeb62('0x3')](util[_0xeb62('0x4')](_0xeb62('0x1e'),_0x6822bc[_0xeb62('0x6')],agents[_0x6822bc[_0xeb62('0x16')]][_0xeb62('0x1f')],_0x6822bc[_0xeb62('0x16')]));}catch(_0x5a07bb){utils[_0xeb62('0x20')](util[_0xeb62('0x4')](_0xeb62('0x18'),_0x6822bc[_0xeb62('0x6')]),_0x5a07bb);}};exports[_0xeb62('0x21')]=function(_0x24cbf3){try{if(!_[_0xeb62('0x22')](agents[_0x24cbf3['destuniqueid']])){utils['debug'](util[_0xeb62('0x4')](_0xeb62('0x23'),_0x24cbf3[_0xeb62('0x6')]),_0x24cbf3);utils[_0xeb62('0x3')](util[_0xeb62('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x24cbf3['uniqueid'],agents[_0x24cbf3[_0xeb62('0x16')]][_0xeb62('0x1f')],_0x24cbf3[_0xeb62('0x16')]));agents[_0x24cbf3[_0xeb62('0x16')]]['agentringnoanswer']=!![];agents[_0x24cbf3['destuniqueid']][_0xeb62('0x24')]=utils['now']();agents[_0x24cbf3[_0xeb62('0x16')]]['lastevent']=_0xeb62('0x25');agents[_0x24cbf3['destuniqueid']][_0xeb62('0x26')]=_0xeb62('0x25');agents[_0x24cbf3[_0xeb62('0x16')]]['holdtime']=_0x24cbf3[_0xeb62('0x27')]?parseInt(_0x24cbf3[_0xeb62('0x27')])/0x3e8:0x0;agents[_0x24cbf3[_0xeb62('0x16')]][_0xeb62('0x28')]=0x0;unanswered[_0xeb62('0x29')](_0x24cbf3[_0xeb62('0x16')]);}}catch(_0x511202){utils[_0xeb62('0x20')](util[_0xeb62('0x4')]('[%s][agents][agentringnoanswer]',_0x24cbf3[_0xeb62('0x6')]),_0x511202);}};exports[_0xeb62('0x2a')]=function(_0x2c967c){try{_[_0xeb62('0x2b')](agents,function(_0x235448,_0x5195bf){if(_0x235448['uniqueid']==_0x2c967c[_0xeb62('0x6')]&&!_[_0xeb62('0x2c')](unanswered,_0x235448[_0xeb62('0x16')])){utils[_0xeb62('0x2d')](util[_0xeb62('0x4')](_0xeb62('0x2e'),_0x2c967c[_0xeb62('0x6')]),_0x2c967c);utils['info'](util[_0xeb62('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2c967c['uniqueid'],_0x235448[_0xeb62('0x1f')],_0x235448[_0xeb62('0x16')]));_0x235448['agentringnoanswer']=!![];_0x235448[_0xeb62('0x24')]=utils['now']();_0x235448[_0xeb62('0x1b')]=_0xeb62('0x2f');_0x235448['reason']=_0xeb62('0x2f');_0x235448[_0xeb62('0x30')]=_0x2c967c['holdtime'];_0x235448[_0xeb62('0x28')]=0x0;writeDB(_0x235448);}});}catch(_0x2a8087){utils[_0xeb62('0x20')](util[_0xeb62('0x4')]('[%s][agents][queuecallerabandon]',_0x2c967c[_0xeb62('0x6')]),_0x2a8087);}};exports[_0xeb62('0x31')]=function(_0x4cf6b0){try{if(agents[_0x4cf6b0['destuniqueid']]){utils[_0xeb62('0x2d')](util[_0xeb62('0x4')]('[%s][agents][agentconnect]',_0x4cf6b0[_0xeb62('0x6')]),_0x4cf6b0);utils[_0xeb62('0x3')](util[_0xeb62('0x4')](_0xeb62('0x32'),_0x4cf6b0[_0xeb62('0x6')],agents[_0x4cf6b0[_0xeb62('0x16')]][_0xeb62('0x1f')],_0x4cf6b0['destuniqueid']));agents[_0x4cf6b0['destuniqueid']][_0xeb62('0x33')]=utils[_0xeb62('0x1a')]();agents[_0x4cf6b0[_0xeb62('0x16')]][_0xeb62('0xb')]=_0x4cf6b0['connectedlinenum'];agents[_0x4cf6b0[_0xeb62('0x16')]]['connectedlinename']=_0x4cf6b0[_0xeb62('0x1d')];agents[_0x4cf6b0[_0xeb62('0x16')]][_0xeb62('0x30')]=_0x4cf6b0[_0xeb62('0x27')];agents[_0x4cf6b0[_0xeb62('0x16')]][_0xeb62('0x1b')]=_0xeb62('0x34');_[_0xeb62('0x2b')](agents,function(_0x5e8ef8,_0x38f91b){if(_0x5e8ef8[_0xeb62('0x16')]!=_0x4cf6b0[_0xeb62('0x16')]&&_0x5e8ef8[_0xeb62('0x6')]==_0x4cf6b0['uniqueid']){_0x5e8ef8['talktime']=0x0;_0x5e8ef8[_0xeb62('0x30')]=_0x4cf6b0[_0xeb62('0x27')];_0x5e8ef8['agentringnoanswer']=!![];_0x5e8ef8[_0xeb62('0x24')]=utils[_0xeb62('0x1a')]();_0x5e8ef8['lastevent']=_0xeb62('0x35');_0x5e8ef8['reason']=_0xeb62('0x35');_0x5e8ef8['answeredelsewheredestinationuniqueid']=_0x4cf6b0[_0xeb62('0x16')];_0x5e8ef8['answeredelsewheremembername']=_0x4cf6b0[_0xeb62('0x1f')];writeDB(_0x5e8ef8);}});}}catch(_0x609b2d){utils[_0xeb62('0x20')](util['format']('[%s][agents][agentconnect]',_0x4cf6b0[_0xeb62('0x6')]),_0x609b2d);}};exports[_0xeb62('0x10')]=function(_0xb1c958){try{if(!_[_0xeb62('0x22')](agents[_0xb1c958[_0xeb62('0x16')]])){utils['debug'](util[_0xeb62('0x4')]('[%s][agents][agentcomplete]',_0xb1c958[_0xeb62('0x6')]),_0xb1c958);utils['info'](util[_0xeb62('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xb1c958[_0xeb62('0x6')],agents[_0xb1c958['destuniqueid']][_0xeb62('0x1f')],_0xb1c958[_0xeb62('0x16')]));agents[_0xb1c958[_0xeb62('0x16')]][_0xeb62('0x10')]=!![];agents[_0xb1c958[_0xeb62('0x16')]][_0xeb62('0x36')]=utils['now']();agents[_0xb1c958[_0xeb62('0x16')]][_0xeb62('0x28')]=utils['diffTime'](agents[_0xb1c958['destuniqueid']]['agentcompleteAt'],agents[_0xb1c958['destuniqueid']][_0xeb62('0x33')]);agents[_0xb1c958[_0xeb62('0x16')]]['reason']=_0xb1c958[_0xeb62('0x26')];agents[_0xb1c958[_0xeb62('0x16')]][_0xeb62('0x1b')]=_0xeb62('0x37');writeDB(agents[_0xb1c958[_0xeb62('0x16')]]);}}catch(_0x555812){utils[_0xeb62('0x20')](util['format'](_0xeb62('0x38'),_0xb1c958[_0xeb62('0x6')]),_0x555812);}};exports[_0xeb62('0x39')]=function(_0x18c40d){try{if(!_[_0xeb62('0x22')](agents[_0x18c40d[_0xeb62('0x3a')]])){utils[_0xeb62('0x2d')](util[_0xeb62('0x4')](_0xeb62('0x3b'),_0x18c40d[_0xeb62('0x6')]),_0x18c40d);utils[_0xeb62('0x3')](util[_0xeb62('0x4')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x18c40d[_0xeb62('0x6')],agents[_0x18c40d['transfereruniqueid']]['membername'],agents[_0x18c40d[_0xeb62('0x3a')]][_0xeb62('0x6')]));agents[_0x18c40d['transfereruniqueid']][_0xeb62('0x3c')]=!![];agents[_0x18c40d[_0xeb62('0x3a')]]['transfertype']=_0xeb62('0x3d');agents[_0x18c40d[_0xeb62('0x3a')]][_0xeb62('0x3e')]=_0x18c40d[_0xeb62('0x3f')];agents[_0x18c40d[_0xeb62('0x3a')]][_0xeb62('0x40')]=agents[_0x18c40d[_0xeb62('0x3a')]][_0xeb62('0x6')];}}catch(_0x497714){utils[_0xeb62('0x20')](util['format'](_0xeb62('0x3b'),_0x18c40d[_0xeb62('0x6')]),_0x497714);}};exports[_0xeb62('0x41')]=function(_0x289af0){try{utils[_0xeb62('0x2d')](util[_0xeb62('0x4')](_0xeb62('0x42'),_0x289af0[_0xeb62('0x43')]),_0x289af0);if(_0x289af0['origtransfereruniqueid']==_0x289af0['origtransfererlinkedid']){if(!_['isNil'](agents[_0x289af0['secondtransfereruniqueid']])){utils[_0xeb62('0x3')](util['format'](_0xeb62('0x44'),_0x289af0['origtransfereruniqueid'],agents[_0x289af0[_0xeb62('0x45')]][_0xeb62('0x1f')]));agents[_0x289af0[_0xeb62('0x45')]]['transfer']=!![];agents[_0x289af0[_0xeb62('0x45')]][_0xeb62('0x46')]='ATTENDED';agents[_0x289af0[_0xeb62('0x45')]][_0xeb62('0x3e')]=_0x289af0[_0xeb62('0x47')];agents[_0x289af0[_0xeb62('0x45')]]['transferuniqueid']=_0x289af0[_0xeb62('0x43')];}if(_0x289af0[_0xeb62('0x48')]&&agents[_0x289af0['transfereeuniqueid']]){agents[_0x289af0[_0xeb62('0x48')]][_0xeb62('0x49')]=0x1;transfers[_0x289af0[_0xeb62('0x48')]]=_[_0xeb62('0x4a')](agents[_0x289af0[_0xeb62('0x48')]]);transfers[_0x289af0[_0xeb62('0x48')]][_0xeb62('0xa')]=agents[_0x289af0[_0xeb62('0x45')]][_0xeb62('0xa')];transfers[_0x289af0[_0xeb62('0x48')]][_0xeb62('0x4b')]=agents[_0x289af0[_0xeb62('0x45')]][_0xeb62('0x4b')];transfers[_0x289af0[_0xeb62('0x48')]][_0xeb62('0x19')]=utils[_0xeb62('0x1a')]();transfers[_0x289af0['transfereeuniqueid']]['agentconnectAt']=utils['now']();transfers[_0x289af0['transfereeuniqueid']][_0xeb62('0x30')]=0x0;transfers[_0x289af0['transfereeuniqueid']][_0xeb62('0x49')]=0x2;}}else if(_0x289af0[_0xeb62('0x45')]==_0x289af0[_0xeb62('0x4c')]){if(!_[_0xeb62('0x22')](agents[_0x289af0[_0xeb62('0x43')]])){utils[_0xeb62('0x3')](util[_0xeb62('0x4')](_0xeb62('0x44'),_0x289af0[_0xeb62('0x43')],agents[_0x289af0[_0xeb62('0x43')]]['membername']));agents[_0x289af0[_0xeb62('0x43')]][_0xeb62('0x3c')]=!![];agents[_0x289af0[_0xeb62('0x43')]][_0xeb62('0x46')]='ATTENDED';agents[_0x289af0[_0xeb62('0x43')]][_0xeb62('0x3e')]=_0x289af0[_0xeb62('0x4d')];agents[_0x289af0[_0xeb62('0x43')]][_0xeb62('0x40')]=_0x289af0[_0xeb62('0x45')];}if(_0x289af0[_0xeb62('0x4e')]&&agents[_0x289af0[_0xeb62('0x4e')]]){agents[_0x289af0[_0xeb62('0x4e')]][_0xeb62('0x49')]=0x1;transfers[_0x289af0[_0xeb62('0x4e')]]=_['clone'](agents[_0x289af0[_0xeb62('0x4e')]]);transfers[_0x289af0[_0xeb62('0x4e')]][_0xeb62('0xa')]=agents[_0x289af0[_0xeb62('0x43')]][_0xeb62('0xa')];transfers[_0x289af0[_0xeb62('0x4e')]][_0xeb62('0x4b')]=agents[_0x289af0[_0xeb62('0x43')]][_0xeb62('0x4b')];transfers[_0x289af0[_0xeb62('0x4e')]]['agentcalledAt']=utils[_0xeb62('0x1a')]();transfers[_0x289af0[_0xeb62('0x4e')]][_0xeb62('0x33')]=utils[_0xeb62('0x1a')]();transfers[_0x289af0['transfertargetuniqueid']][_0xeb62('0x30')]=0x0;transfers[_0x289af0[_0xeb62('0x4e')]][_0xeb62('0x49')]=0x2;}}}catch(_0xdde337){utils[_0xeb62('0x20')](util[_0xeb62('0x4')]('[%s][agents][attendedtransfer]',_0x289af0[_0xeb62('0x43')]),_0xdde337);}};exports[_0xeb62('0x4f')]=function(_0x347c55){try{utils[_0xeb62('0x2d')](util[_0xeb62('0x4')](_0xeb62('0x50'),_0x347c55[_0xeb62('0x6')]),_0x347c55);if(agents[_0x347c55[_0xeb62('0x6')]]&&agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x26')]===_0xeb62('0x25')){if(_0x347c55[_0xeb62('0x51')]==='21'){agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x26')]=_0xeb62('0x52');agents[_0x347c55[_0xeb62('0x6')]]['lastevent']=_0xeb62('0x52');}utils['info'](util[_0xeb62('0x4')](_0xeb62('0x53'),_0x347c55['uniqueid'],agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x1f')],agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x26')],agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x1b')]));writeDB(agents[_0x347c55[_0xeb62('0x6')]]);var _0x449582=unanswered[_0xeb62('0x54')](_0x347c55[_0xeb62('0x6')]);if(_0x449582>-0x1){unanswered[_0xeb62('0x55')](_0x449582,0x1);}}if(transfers[_0x347c55[_0xeb62('0x6')]]){transfers[_0x347c55[_0xeb62('0x6')]]['agentcomplete']=!![];transfers[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x36')]=utils['now']();transfers[_0x347c55[_0xeb62('0x6')]]['talktime']=utils[_0xeb62('0x56')](transfers[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x36')],transfers[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x33')]);transfers[_0x347c55[_0xeb62('0x6')]]['reason']=_0xeb62('0x57');transfers[_0x347c55['uniqueid']][_0xeb62('0x1b')]=_0xeb62('0x37');utils[_0xeb62('0x3')](util[_0xeb62('0x4')](_0xeb62('0x53'),_0x347c55['uniqueid'],transfers[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x1f')],transfers[_0x347c55[_0xeb62('0x6')]]['reason'],transfers[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x1b')]));writeDB(transfers[_0x347c55[_0xeb62('0x6')]],!![]);}if(agents[_0x347c55[_0xeb62('0x6')]]&&agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x33')]){agents[_0x347c55['uniqueid']]['agentcomplete']=!![];agents[_0x347c55['uniqueid']]['agentcompleteAt']=utils['now']();agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x28')]=utils[_0xeb62('0x56')](agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x36')],agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x33')]);agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x26')]=agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x3c')]?_0xeb62('0x3c'):'agent';agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x1b')]=_0xeb62('0x37');utils[_0xeb62('0x3')](util[_0xeb62('0x4')](_0xeb62('0x53'),_0x347c55[_0xeb62('0x6')],agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x1f')],agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x26')],agents[_0x347c55[_0xeb62('0x6')]][_0xeb62('0x1b')]));writeDB(agents[_0x347c55[_0xeb62('0x6')]]);}}catch(_0xfff29b){utils[_0xeb62('0x20')](util[_0xeb62('0x4')](_0xeb62('0x50'),_0x347c55['uniqueid']),_0xfff29b);}}; \ No newline at end of file +var _0xb49a=['[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','push','reason','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agentcomplete','agent','lodash','util','./utils','format'];(function(_0x2103a0,_0x4609aa){var _0x4d646d=function(_0x25fcfb){while(--_0x25fcfb){_0x2103a0['push'](_0x2103a0['shift']());}};_0x4d646d(++_0x4609aa);}(_0xb49a,0xfb));var _0xab49=function(_0x1f4ddf,_0x4ef2f8){_0x1f4ddf=_0x1f4ddf-0x0;var _0x169fea=_0xb49a[_0x1f4ddf];return _0x169fea;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var utils=require(_0xab49('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d512a,_0x8db649){utils['info'](util[_0xab49('0x3')](_0xab49('0x4'),_0x1d512a['uniqueid'],_0x1d512a['channel'],_0x1d512a[_0xab49('0x5')],_0x1d512a[_0xab49('0x6')],_0x1d512a[_0xab49('0x7')],_0x1d512a[_0xab49('0x8')],_0x1d512a[_0xab49('0x9')],_0x1d512a[_0xab49('0xa')]));if(_0x1d512a[_0xab49('0x5')]){utils['getVoiceQueueByName'](_0x1d512a[_0xab49('0x5')])[_0xab49('0xb')](function(_0xf12653){if(_0xf12653){_0x1d512a[_0xab49('0xc')]=_0xf12653[_0xab49('0xc')];_0x1d512a['agentacw']=_0x1d512a['agentcomplete']?_0xf12653[_0xab49('0xd')]:![];_0x1d512a[_0xab49('0xe')]=_0x1d512a[_0xab49('0xf')]?_0xf12653[_0xab49('0x10')]:0x0;}utils[_0xab49('0x11')]('CreateVoiceAgentReport',_0x1d512a);});}else{utils[_0xab49('0x11')](_0xab49('0x12'),_0x1d512a);}if(_0x8db649){delete transfers[_0x1d512a[_0xab49('0x13')]];}else{delete agents[_0x1d512a[_0xab49('0x14')]];}}exports[_0xab49('0x15')]=function(_0x36091a){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x17'),_0x36091a[_0xab49('0x13')]),_0x36091a);agents[_0x36091a[_0xab49('0x14')]]=_0x36091a;agents[_0x36091a['destuniqueid']][_0xab49('0x18')]=utils[_0xab49('0x19')]();agents[_0x36091a[_0xab49('0x14')]][_0xab49('0xa')]=_0xab49('0x1a');agents[_0x36091a['destuniqueid']][_0xab49('0x9')]=null;agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x1b')]=null;utils[_0xab49('0x1c')](util[_0xab49('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x36091a[_0xab49('0x13')],agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x6')],_0x36091a['destuniqueid']));}catch(_0x4c22cd){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][agentcalled]',_0x36091a[_0xab49('0x13')]),_0x4c22cd);}};exports[_0xab49('0x1e')]=function(_0x49b716){try{if(!_[_0xab49('0x1f')](agents[_0x49b716['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716['uniqueid']),_0x49b716);utils[_0xab49('0x1c')](util['format'](_0xab49('0x20'),_0x49b716['uniqueid'],agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x6')],_0x49b716[_0xab49('0x14')]));agents[_0x49b716['destuniqueid']][_0xab49('0x1e')]=!![];agents[_0x49b716['destuniqueid']][_0xab49('0x21')]=utils[_0xab49('0x19')]();agents[_0x49b716['destuniqueid']][_0xab49('0xa')]=_0xab49('0x22');agents[_0x49b716['destuniqueid']]['reason']=_0xab49('0x22');agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x23')]=_0x49b716['ringtime']?parseInt(_0x49b716[_0xab49('0x24')])/0x3e8:0x0;agents[_0x49b716[_0xab49('0x14')]]['talktime']=0x0;unanswered[_0xab49('0x25')](_0x49b716[_0xab49('0x14')]);}}catch(_0x342fdf){utils['error'](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716[_0xab49('0x13')]),_0x342fdf);}};exports['queuecallerabandon']=function(_0x19f094){try{_['forIn'](agents,function(_0x134a03,_0x24bd0f){if(_0x134a03[_0xab49('0x13')]==_0x19f094[_0xab49('0x13')]&&!_['includes'](unanswered,_0x134a03[_0xab49('0x14')])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094[_0xab49('0x13')]),_0x19f094);utils['info'](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x19f094['uniqueid'],_0x134a03['membername'],_0x134a03[_0xab49('0x14')]));_0x134a03['agentringnoanswer']=!![];_0x134a03[_0xab49('0x21')]=utils[_0xab49('0x19')]();_0x134a03[_0xab49('0xa')]='abandoned';_0x134a03[_0xab49('0x26')]=_0xab49('0x27');_0x134a03[_0xab49('0x23')]=_0x19f094[_0xab49('0x23')];_0x134a03[_0xab49('0x28')]=0x0;writeDB(_0x134a03);}});}catch(_0x56b768){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094['uniqueid']),_0x56b768);}};exports[_0xab49('0x29')]=function(_0x29c6cf){try{if(agents[_0x29c6cf[_0xab49('0x14')]]){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x29c6cf);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x2b'),_0x29c6cf[_0xab49('0x13')],agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x6')],_0x29c6cf['destuniqueid']));agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x9')]=_0x29c6cf['connectedlinenum'];agents[_0x29c6cf[_0xab49('0x14')]]['connectedlinename']=_0x29c6cf['connectedlinename'];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0xa')]='connect';_[_0xab49('0x2d')](agents,function(_0x2cdcbf,_0x2016a9){if(_0x2cdcbf[_0xab49('0x14')]!=_0x29c6cf[_0xab49('0x14')]&&_0x2cdcbf['uniqueid']==_0x29c6cf['uniqueid']){_0x2cdcbf[_0xab49('0x28')]=0x0;_0x2cdcbf[_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];_0x2cdcbf['agentringnoanswer']=!![];_0x2cdcbf[_0xab49('0x21')]=utils['now']();_0x2cdcbf['lastevent']='answered_elsewhere';_0x2cdcbf['reason']=_0xab49('0x2e');_0x2cdcbf[_0xab49('0x2f')]=_0x29c6cf[_0xab49('0x14')];_0x2cdcbf[_0xab49('0x30')]=_0x29c6cf[_0xab49('0x6')];writeDB(_0x2cdcbf);}});}}catch(_0x3f3776){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x3f3776);}};exports['agentcomplete']=function(_0x158042){try{if(!_[_0xab49('0x1f')](agents[_0x158042['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0x158042);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x32'),_0x158042[_0xab49('0x13')],agents[_0x158042['destuniqueid']][_0xab49('0x6')],_0x158042[_0xab49('0x14')]));agents[_0x158042[_0xab49('0x14')]]['agentcomplete']=!![];agents[_0x158042[_0xab49('0x14')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x158042[_0xab49('0x14')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x158042['destuniqueid']][_0xab49('0x33')],agents[_0x158042[_0xab49('0x14')]][_0xab49('0x2c')]);agents[_0x158042[_0xab49('0x14')]][_0xab49('0x26')]=_0x158042[_0xab49('0x26')];agents[_0x158042['destuniqueid']][_0xab49('0xa')]=_0xab49('0x35');writeDB(agents[_0x158042[_0xab49('0x14')]]);}}catch(_0xca56ce){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0xca56ce);}};exports[_0xab49('0x36')]=function(_0xfb7d69){try{if(!_[_0xab49('0x1f')](agents[_0xfb7d69[_0xab49('0x37')]])){utils['debug'](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0xfb7d69);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x39'),_0xfb7d69[_0xab49('0x13')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x6')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x13')]));agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x3a')]=!![];agents[_0xfb7d69[_0xab49('0x37')]]['transfertype']=_0xab49('0x3b');agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3c')]=_0xfb7d69[_0xab49('0x3d')];agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3e')]=agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x13')];}}catch(_0x37cf42){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0x37cf42);}};exports[_0xab49('0x3f')]=function(_0x235ba8){try{utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][attendedtransfer]',_0x235ba8[_0xab49('0x40')]),_0x235ba8);if(_0x235ba8[_0xab49('0x40')]==_0x235ba8[_0xab49('0x41')]){if(!_[_0xab49('0x1f')](agents[_0x235ba8[_0xab49('0x42')]])){utils['info'](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x42')]]['transfer']=!![];agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x44')]=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x42')]]['transferexten']=_0x235ba8['origtransfererexten'];agents[_0x235ba8[_0xab49('0x42')]]['transferuniqueid']=_0x235ba8[_0xab49('0x40')];}if(_0x235ba8[_0xab49('0x46')]&&agents[_0x235ba8[_0xab49('0x46')]]){agents[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x1;transfers[_0x235ba8[_0xab49('0x46')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x46')]]);transfers[_0x235ba8['transfereeuniqueid']][_0xab49('0x8')]=agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x49')]=agents[_0x235ba8['secondtransfereruniqueid']][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x18')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x2;}}else if(_0x235ba8[_0xab49('0x42')]==_0x235ba8[_0xab49('0x4a')]){if(!_['isNil'](agents[_0x235ba8[_0xab49('0x40')]])){utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3a')]=!![];agents[_0x235ba8[_0xab49('0x40')]]['transfertype']=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x40')]]['transferexten']=_0x235ba8[_0xab49('0x4b')];agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3e')]=_0x235ba8['secondtransfereruniqueid'];}if(_0x235ba8[_0xab49('0x4c')]&&agents[_0x235ba8[_0xab49('0x4c')]]){agents[_0x235ba8['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x235ba8[_0xab49('0x4c')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x4c')]]);transfers[_0x235ba8['transfertargetuniqueid']]['calleridnum']=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x49')]=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x18')]=utils['now']();transfers[_0x235ba8['transfertargetuniqueid']][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x47')]=0x2;}}}catch(_0x108755){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x4d'),_0x235ba8['origtransfereruniqueid']),_0x108755);}};exports[_0xab49('0x4e')]=function(_0x24fb84){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x4f'),_0x24fb84[_0xab49('0x13')]),_0x24fb84);if(agents[_0x24fb84[_0xab49('0x13')]]&&agents[_0x24fb84[_0xab49('0x13')]]['reason']===_0xab49('0x22')){if(_0x24fb84['cause']==='21'){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x50');agents[_0x24fb84['uniqueid']][_0xab49('0xa')]=_0xab49('0x50');}utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);var _0x366a3c=unanswered[_0xab49('0x52')](_0x24fb84[_0xab49('0x13')]);if(_0x366a3c>-0x1){unanswered['splice'](_0x366a3c,0x1);}}if(transfers[_0x24fb84[_0xab49('0x13')]]){transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];transfers[_0x24fb84['uniqueid']][_0xab49('0x33')]=utils[_0xab49('0x19')]();transfers[_0x24fb84['uniqueid']][_0xab49('0x28')]=utils[_0xab49('0x34')](transfers[_0x24fb84['uniqueid']][_0xab49('0x33')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x54');transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]='complete';utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],transfers[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(transfers[_0x24fb84[_0xab49('0x13')]],!![]);}if(agents[_0x24fb84['uniqueid']]&&agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=agents[_0x24fb84['uniqueid']]['transfer']?_0xab49('0x3a'):_0xab49('0x54');agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]=_0xab49('0x35');utils[_0xab49('0x1c')](util['format'](_0xab49('0x51'),_0x24fb84['uniqueid'],agents[_0x24fb84['uniqueid']][_0xab49('0x6')],agents[_0x24fb84['uniqueid']][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);}}catch(_0x271ee4){utils[_0xab49('0x1d')](util['format']('[%s][agents][hangup]',_0x24fb84[_0xab49('0x13')]),_0x271ee4);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 28ff85c..a467ecf 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 _0xf811=['lastIndexOf','includes','noop','execif','toLowerCase','lastapplication','lodash','util','./utils','./transfers.controller','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','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','DOCUMENTATION','error','[%s][calls][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','toNumber','hangup','debug','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','billableseconds','attendedtransfer','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','Queue','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','newexten','[%s][calls][newexten]','appdata','application','set','startsWith','cdr','split','substring'];(function(_0x1623d6,_0x44aecd){var _0x253d7d=function(_0x1b4439){while(--_0x1b4439){_0x1623d6['push'](_0x1623d6['shift']());}};_0x253d7d(++_0x44aecd);}(_0xf811,0x6f));var _0x1f81=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xf811[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var utils=require(_0x1f81('0x2'));var transfers=require(_0x1f81('0x3'));var dispositions=[_0x1f81('0x4'),_0x1f81('0x5'),_0x1f81('0x5'),_0x1f81('0x4'),_0x1f81('0x4'),_0x1f81('0x4'),_0x1f81('0x6'),_0x1f81('0x7'),_0x1f81('0x5'),_0x1f81('0x5'),'FAILED'];var channels={};function writeDB(_0x2238b2){var _0x42b31b;if(transfers[_0x1f81('0x8')][_0x2238b2['uniqueid']]){_0x42b31b=_0x2238b2[_0x1f81('0x9')];_0x2238b2[_0x1f81('0x9')]=transfers['blinds'][_0x2238b2[_0x1f81('0x9')]]['transfereeuniqueid'];}utils[_0x1f81('0xa')](util[_0x1f81('0xb')](_0x1f81('0xc'),_0x2238b2[_0x1f81('0x9')],_0x2238b2[_0x1f81('0xd')],_0x2238b2[_0x1f81('0xe')],_0x2238b2[_0x1f81('0xf')],_0x2238b2[_0x1f81('0x10')],_0x2238b2[_0x1f81('0x11')],_0x2238b2[_0x1f81('0x12')],_0x2238b2[_0x1f81('0x13')]));if(_0x2238b2[_0x1f81('0x14')]){utils[_0x1f81('0x15')](_0x2238b2[_0x1f81('0x14')])[_0x1f81('0x16')](function(_0x247b10){if(_0x247b10){_0x2238b2['UserId']=_0x247b10['id'];}utils[_0x1f81('0x17')](_0x1f81('0x18'),_0x2238b2);});}else{utils['request']('CreateVoiceCallReport',_0x2238b2);}if(channels[_0x2238b2[_0x1f81('0x9')]]){delete channels[_0x2238b2[_0x1f81('0x9')]];}else if(_0x42b31b&&channels[_0x42b31b]){if(!transfers['blinds'][_0x42b31b][_0x1f81('0x19')])delete transfers[_0x1f81('0x8')][_0x42b31b];delete channels[_0x42b31b];}}exports[_0x1f81('0x1a')]=function(_0x95a32d){try{utils['debug'](util['format'](_0x1f81('0x1b'),_0x95a32d[_0x1f81('0x9')]),_0x95a32d);if(_0x95a32d['uniqueid']==_0x95a32d[_0x1f81('0x1c')]&&_0x95a32d['channel']!=_0x1f81('0x1d')){utils[_0x1f81('0xa')](util[_0x1f81('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x95a32d[_0x1f81('0x9')],_0x95a32d[_0x1f81('0x1e')],_0x95a32d[_0x1f81('0x1f')]));channels[_0x95a32d[_0x1f81('0x9')]]={'uniqueid':_0x95a32d[_0x1f81('0x9')],'accountcode':_0x95a32d[_0x1f81('0x14')],'source':_0x95a32d['calleridnum'],'destination':_0x95a32d[_0x1f81('0x1f')],'destinationcontext':_0x95a32d[_0x1f81('0x1e')],'channel':_0x95a32d[_0x1f81('0xd')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x1f81('0x20')};}}catch(_0x4aaf6e){utils[_0x1f81('0x21')](util['format']('[%s][calls][newchannel]',_0x95a32d[_0x1f81('0x9')]),_0x4aaf6e);}};exports['newstate']=function(_0x3d97a3){try{utils['debug'](util[_0x1f81('0xb')](_0x1f81('0x22'),_0x3d97a3[_0x1f81('0x9')]),_0x3d97a3);if(!_[_0x1f81('0x23')](channels[_0x3d97a3[_0x1f81('0x9')]])&&_0x3d97a3[_0x1f81('0x24')]==0x6){utils[_0x1f81('0xa')](util[_0x1f81('0xb')](_0x1f81('0x25'),_0x3d97a3[_0x1f81('0x9')],_0x3d97a3['context'],_0x3d97a3[_0x1f81('0xd')]));if(_['isNil'](channels[_0x3d97a3[_0x1f81('0x9')]][_0x1f81('0x26')])){channels[_0x3d97a3['uniqueid']][_0x1f81('0x26')]=utils[_0x1f81('0x27')]();}}else if(!_[_0x1f81('0x23')](channels[_0x3d97a3[_0x1f81('0x1c')]])&&_0x3d97a3[_0x1f81('0x24')]==0x6&&_0x3d97a3[_0x1f81('0x1e')]!=_0x1f81('0x28')){utils[_0x1f81('0xa')](util['format'](_0x1f81('0x29'),_0x3d97a3[_0x1f81('0x9')],_0x3d97a3[_0x1f81('0x1c')],_0x3d97a3[_0x1f81('0x1e')],_0x3d97a3[_0x1f81('0xd')]));channels[_0x3d97a3[_0x1f81('0x1c')]][_0x1f81('0x14')]=_0x3d97a3[_0x1f81('0x14')];channels[_0x3d97a3[_0x1f81('0x1c')]][_0x1f81('0x2a')]=_0x3d97a3[_0x1f81('0xd')];if(_['isNil'](channels[_0x3d97a3[_0x1f81('0x1c')]][_0x1f81('0x2b')])){channels[_0x3d97a3[_0x1f81('0x1c')]][_0x1f81('0x2b')]=utils['now']();}channels[_0x3d97a3[_0x1f81('0x1c')]][_0x1f81('0x2c')]=dispositions[_[_0x1f81('0x2d')](_0x3d97a3['channelstate'])]||'ANSWERED';}}catch(_0xb1969e){utils['error'](util[_0x1f81('0xb')]('[%s][calls][newstate]',_0x3d97a3[_0x1f81('0x9')]),_0xb1969e);}};exports[_0x1f81('0x2e')]=function(_0x276e90){try{if(!_[_0x1f81('0x23')](channels[_0x276e90[_0x1f81('0x9')]])){utils[_0x1f81('0x2f')](util[_0x1f81('0xb')]('[%s][calls][hangup]',_0x276e90[_0x1f81('0x9')]),_0x276e90);if(_['isNil'](channels[_0x276e90[_0x1f81('0x9')]][_0x1f81('0x30')])){channels[_0x276e90['uniqueid']][_0x1f81('0x30')]=_0x276e90[_0x1f81('0x31')]+'\x20<'+_0x276e90[_0x1f81('0x11')]+'>';}utils['info'](util[_0x1f81('0xb')](_0x1f81('0x32'),_0x276e90[_0x1f81('0x9')],channels[_0x276e90[_0x1f81('0x9')]][_0x1f81('0x30')],_0x276e90['cause-txt']));channels[_0x276e90[_0x1f81('0x9')]][_0x1f81('0x33')]=utils['now']();channels[_0x276e90['uniqueid']]['duration']=utils[_0x1f81('0x34')](channels[_0x276e90[_0x1f81('0x9')]]['endtime'],channels[_0x276e90['uniqueid']]['starttime']);channels[_0x276e90[_0x1f81('0x9')]][_0x1f81('0x35')]=channels[_0x276e90['uniqueid']][_0x1f81('0x2b')]?utils[_0x1f81('0x34')](channels[_0x276e90[_0x1f81('0x9')]]['endtime'],channels[_0x276e90[_0x1f81('0x9')]][_0x1f81('0x2b')]):0x0;writeDB(channels[_0x276e90[_0x1f81('0x9')]]);}}catch(_0x2133b5){utils[_0x1f81('0x21')](util[_0x1f81('0xb')]('[%s][calls][hangup]',_0x276e90[_0x1f81('0x9')]),_0x2133b5);}};exports[_0x1f81('0x36')]=function(_0x4714db){try{if(!_[_0x1f81('0x23')](channels[_0x4714db['localtwolinkedid']])){utils[_0x1f81('0x2f')](util[_0x1f81('0xb')]('[%s][calls][attendedtransfer]',_0x4714db[_0x1f81('0x37')]),_0x4714db);if(channels[_0x4714db['localtwolinkedid']][_0x1f81('0xd')]==_0x4714db['transfereechannel']){utils[_0x1f81('0xa')](util['format'](_0x1f81('0x38'),_0x4714db[_0x1f81('0x37')],_0x4714db[_0x1f81('0x39')],_0x4714db['secondtransfererchannel']));channels[_0x4714db[_0x1f81('0x39')]][_0x1f81('0x2a')]=_0x4714db['secondtransfererchannel'];channels[_0x4714db[_0x1f81('0x39')]][_0x1f81('0x3a')]=_0x1f81('0x3b');}else if(channels[_0x4714db[_0x1f81('0x39')]][_0x1f81('0xd')]=_0x4714db[_0x1f81('0x3c')]){utils[_0x1f81('0xa')](util['format'](_0x1f81('0x38'),_0x4714db[_0x1f81('0x37')],_0x4714db['localtwolinkedid'],_0x4714db[_0x1f81('0x3d')]));channels[_0x4714db[_0x1f81('0x39')]][_0x1f81('0x2a')]=_0x4714db['origtransfererchannel'];channels[_0x4714db[_0x1f81('0x39')]][_0x1f81('0x3a')]='_attended';}}}catch(_0x38df8c){utils['error'](util['format'](_0x1f81('0x3e'),_0x4714db[_0x1f81('0x37')]),_0x38df8c);}};exports[_0x1f81('0x3f')]=function(_0x4fc5f6){try{if(!_['isNil'](channels[_0x4fc5f6[_0x1f81('0x9')]])){utils['debug'](util[_0x1f81('0xb')](_0x1f81('0x40'),_0x4fc5f6[_0x1f81('0x9')]),_0x4fc5f6);channels[_0x4fc5f6[_0x1f81('0x9')]][_0x1f81('0x41')]=utils['now']();utils[_0x1f81('0xa')](util[_0x1f81('0xb')](_0x1f81('0x42'),_0x4fc5f6[_0x1f81('0x9')],channels[_0x4fc5f6['uniqueid']]['musiconholdstartAt']));}}catch(_0x1611ff){utils[_0x1f81('0x21')](util['format'](_0x1f81('0x40'),_0x4fc5f6['uniqueid']),_0x1611ff);}};exports[_0x1f81('0x43')]=function(_0x539c3f){try{if(!_[_0x1f81('0x23')](channels[_0x539c3f['uniqueid']])){utils[_0x1f81('0x2f')](util['format'](_0x1f81('0x44'),_0x539c3f[_0x1f81('0x9')]),_0x539c3f);if(!_[_0x1f81('0x23')](channels[_0x539c3f['uniqueid']][_0x1f81('0x41')])){channels[_0x539c3f[_0x1f81('0x9')]][_0x1f81('0x45')]+=utils[_0x1f81('0x34')](utils['now'](),channels[_0x539c3f['uniqueid']][_0x1f81('0x41')]);utils[_0x1f81('0xa')](util[_0x1f81('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x539c3f[_0x1f81('0x9')],channels[_0x539c3f['uniqueid']][_0x1f81('0x45')]));delete channels[_0x539c3f['uniqueid']][_0x1f81('0x41')];}}}catch(_0x44cef5){utils[_0x1f81('0x21')](util[_0x1f81('0xb')](_0x1f81('0x44'),_0x539c3f[_0x1f81('0x9')]),_0x44cef5);}};exports[_0x1f81('0x46')]=function(_0x4c7ff0){try{if(!_['isNil'](channels[_0x4c7ff0[_0x1f81('0x9')]])){utils['debug'](util[_0x1f81('0xb')](_0x1f81('0x47'),_0x4c7ff0['uniqueid']),_0x4c7ff0);if(!_['isNil'](_0x4c7ff0['variable']['xmd-originatecalleridnum'])){utils['info'](util['format'](_0x1f81('0x48'),_0x4c7ff0['uniqueid'],_0x4c7ff0[_0x1f81('0x49')]));channels[_0x4c7ff0['uniqueid']][_0x1f81('0x4a')]=_0x4c7ff0[_0x1f81('0x49')];}if(!_[_0x1f81('0x23')](_0x4c7ff0[_0x1f81('0x4b')][_0x1f81('0x4c')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4c7ff0[_0x1f81('0x9')],_0x4c7ff0['value']));channels[_0x4c7ff0[_0x1f81('0x9')]]['destination']=_0x4c7ff0['value'];channels[_0x4c7ff0['uniqueid']]['callerid']='\x22'+_0x4c7ff0[_0x1f81('0x49')]+'\x22\x20<'+_0x4c7ff0[_0x1f81('0x49')]+'>';}if(!_[_0x1f81('0x23')](_0x4c7ff0[_0x1f81('0x4b')]['xmd-callerid-preview'])||!_[_0x1f81('0x23')](_0x4c7ff0[_0x1f81('0x4b')][_0x1f81('0x4d')])){utils[_0x1f81('0xa')](util['format'](_0x1f81('0x4e'),_0x4c7ff0[_0x1f81('0x9')],!_[_0x1f81('0x23')](_0x4c7ff0[_0x1f81('0x4b')][_0x1f81('0x4f')])?_0x1f81('0x4f'):'xmd-callerid',_0x4c7ff0[_0x1f81('0x49')]));channels[_0x4c7ff0[_0x1f81('0x9')]][_0x1f81('0x30')]=_0x4c7ff0[_0x1f81('0x49')];}if(!_['isNil'](_0x4c7ff0[_0x1f81('0x4b')]['xmd-queue'])||!_[_0x1f81('0x23')](_0x4c7ff0[_0x1f81('0x4b')][_0x1f81('0x50')])){utils[_0x1f81('0xa')](util['format'](_0x1f81('0x4e'),_0x4c7ff0[_0x1f81('0x9')],!_[_0x1f81('0x23')](_0x4c7ff0[_0x1f81('0x4b')][_0x1f81('0x51')])?'xmd-queue':_0x1f81('0x50'),_0x4c7ff0[_0x1f81('0x49')]));channels[_0x4c7ff0[_0x1f81('0x9')]]['lastapplication']=_0x1f81('0x52');channels[_0x4c7ff0[_0x1f81('0x9')]][_0x1f81('0x53')]=_0x4c7ff0[_0x1f81('0x49')];channels[_0x4c7ff0['uniqueid']][_0x1f81('0xe')]=!![];}if(!_['isNil'](_0x4c7ff0['variable']['xmd-contactid'])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4c7ff0['uniqueid'],_0x4c7ff0['value']));channels[_0x4c7ff0[_0x1f81('0x9')]][_0x1f81('0x54')]=_0x4c7ff0[_0x1f81('0x49')];}if(!_[_0x1f81('0x23')](_0x4c7ff0[_0x1f81('0x4b')][_0x1f81('0x55')])){utils[_0x1f81('0xa')](util[_0x1f81('0xb')](_0x1f81('0x56'),_0x4c7ff0[_0x1f81('0x9')],_0x4c7ff0['value']));channels[_0x4c7ff0[_0x1f81('0x9')]]['type']=_0x4c7ff0[_0x1f81('0x49')];}if(!_[_0x1f81('0x23')](_0x4c7ff0['variable'][_0x1f81('0x57')])){utils[_0x1f81('0xa')](util[_0x1f81('0xb')](_0x1f81('0x58'),_0x4c7ff0['uniqueid'],_0x4c7ff0[_0x1f81('0x49')]));channels[_0x4c7ff0['uniqueid']][_0x1f81('0x59')]=_0x4c7ff0[_0x1f81('0x49')];}if(!_['isNil'](_0x4c7ff0['variable']['sipcallid'])){utils[_0x1f81('0xa')](util[_0x1f81('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x4c7ff0[_0x1f81('0x9')],_0x4c7ff0[_0x1f81('0x49')]));channels[_0x4c7ff0[_0x1f81('0x9')]]['sipcallid']=_0x4c7ff0[_0x1f81('0x49')];}}}catch(_0x2973d0){utils['error'](util[_0x1f81('0xb')](_0x1f81('0x47'),_0x4c7ff0[_0x1f81('0x9')]),_0x2973d0);}};exports[_0x1f81('0x5a')]=function(_0x2125d9){try{if(!_[_0x1f81('0x23')](channels[_0x2125d9['uniqueid']])){utils[_0x1f81('0x2f')](util[_0x1f81('0xb')](_0x1f81('0x5b'),_0x2125d9[_0x1f81('0x9')]),_0x2125d9);utils['info'](util[_0x1f81('0xb')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2125d9['uniqueid'],_0x2125d9['application'],_0x2125d9[_0x1f81('0x5c')]));if(_0x2125d9[_0x1f81('0x5d')]['toLowerCase']()==_0x1f81('0x5e')&&_[_0x1f81('0x5f')](_0x2125d9[_0x1f81('0x5c')]['toLowerCase'](),_0x1f81('0x60'))){var _0x8ed2b2=_0x2125d9[_0x1f81('0x5c')][_0x1f81('0x61')]('=');var _0x534472=_0x8ed2b2[0x0][_0x1f81('0x62')](_0x8ed2b2[0x0][_0x1f81('0x63')]('(')+0x1,_0x8ed2b2[0x0]['lastIndexOf'](')'));var _0x40f989=_0x8ed2b2[0x1];channels[_0x2125d9[_0x1f81('0x9')]][_0x534472]=_0x40f989;}if(!_[_0x1f81('0x64')]([_0x1f81('0x2e'),_0x1f81('0x65'),_0x1f81('0x66'),_0x1f81('0x5e'),'gotoif'],_0x2125d9['application'][_0x1f81('0x67')]())){channels[_0x2125d9[_0x1f81('0x9')]][_0x1f81('0x68')]=_0x2125d9[_0x1f81('0x5d')];channels[_0x2125d9['uniqueid']][_0x1f81('0x53')]=_0x2125d9[_0x1f81('0x5c')];}}}catch(_0xfb3571){utils['error'](util['format'](_0x1f81('0x5b'),_0x2125d9[_0x1f81('0x9')]),_0xfb3571);}}; \ No newline at end of file +var _0xd0bd=['recording','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','format','exten','context','now','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0bd,0x191));var _0xdd0b=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xd0bd[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0xdd0b('0x0'));var util=require(_0xdd0b('0x1'));var utils=require(_0xdd0b('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER','FAILED',_0xdd0b('0x3'),_0xdd0b('0x4'),_0xdd0b('0x4'),_0xdd0b('0x4'),_0xdd0b('0x5'),_0xdd0b('0x6'),_0xdd0b('0x3'),_0xdd0b('0x3'),_0xdd0b('0x3')];var channels={};function writeDB(_0x3a9068){var _0x48adf5;if(transfers['blinds'][_0x3a9068[_0xdd0b('0x7')]]){_0x48adf5=_0x3a9068[_0xdd0b('0x7')];_0x3a9068['uniqueid']=transfers[_0xdd0b('0x8')][_0x3a9068[_0xdd0b('0x7')]][_0xdd0b('0x9')];}utils['info'](util['format'](_0xdd0b('0xa'),_0x3a9068[_0xdd0b('0x7')],_0x3a9068[_0xdd0b('0xb')],_0x3a9068[_0xdd0b('0xc')],_0x3a9068[_0xdd0b('0xd')],_0x3a9068[_0xdd0b('0xe')],_0x3a9068[_0xdd0b('0xf')],_0x3a9068[_0xdd0b('0x10')],_0x3a9068[_0xdd0b('0x11')]));if(_0x3a9068[_0xdd0b('0x12')]){utils[_0xdd0b('0x13')](_0x3a9068[_0xdd0b('0x12')])[_0xdd0b('0x14')](function(_0x396d2f){if(_0x396d2f){_0x3a9068['UserId']=_0x396d2f['id'];}utils[_0xdd0b('0x15')](_0xdd0b('0x16'),_0x3a9068);});}else{utils['request'](_0xdd0b('0x16'),_0x3a9068);}if(channels[_0x3a9068[_0xdd0b('0x7')]]){delete channels[_0x3a9068[_0xdd0b('0x7')]];}else if(_0x48adf5&&channels[_0x48adf5]){if(!transfers[_0xdd0b('0x8')][_0x48adf5][_0xdd0b('0x17')])delete transfers['blinds'][_0x48adf5];delete channels[_0x48adf5];}}exports['newchannel']=function(_0x42dbb9){try{utils['debug'](util['format'](_0xdd0b('0x18'),_0x42dbb9[_0xdd0b('0x7')]),_0x42dbb9);if(_0x42dbb9[_0xdd0b('0x7')]==_0x42dbb9[_0xdd0b('0x19')]&&_0x42dbb9[_0xdd0b('0xb')]!=_0xdd0b('0x1a')){utils['info'](util[_0xdd0b('0x1b')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x42dbb9[_0xdd0b('0x7')],_0x42dbb9['context'],_0x42dbb9[_0xdd0b('0x1c')]));channels[_0x42dbb9[_0xdd0b('0x7')]]={'uniqueid':_0x42dbb9['uniqueid'],'accountcode':_0x42dbb9[_0xdd0b('0x12')],'source':_0x42dbb9['calleridnum'],'destination':_0x42dbb9[_0xdd0b('0x1c')],'destinationcontext':_0x42dbb9[_0xdd0b('0x1d')],'channel':_0x42dbb9[_0xdd0b('0xb')],'starttime':utils[_0xdd0b('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xdd0b('0x4'),'amaflags':_0xdd0b('0x1f')};}}catch(_0x348c51){utils[_0xdd0b('0x20')](util[_0xdd0b('0x1b')](_0xdd0b('0x18'),_0x42dbb9[_0xdd0b('0x7')]),_0x348c51);}};exports[_0xdd0b('0x21')]=function(_0xf970fa){try{utils[_0xdd0b('0x22')](util[_0xdd0b('0x1b')](_0xdd0b('0x23'),_0xf970fa['uniqueid']),_0xf970fa);if(!_['isNil'](channels[_0xf970fa[_0xdd0b('0x7')]])&&_0xf970fa[_0xdd0b('0x24')]==0x6){utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')](_0xdd0b('0x26'),_0xf970fa['uniqueid'],_0xf970fa[_0xdd0b('0x1d')],_0xf970fa['channel']));if(_[_0xdd0b('0x27')](channels[_0xf970fa[_0xdd0b('0x7')]]['systemanswertime'])){channels[_0xf970fa['uniqueid']][_0xdd0b('0x28')]=utils[_0xdd0b('0x1e')]();}}else if(!_['isNil'](channels[_0xf970fa['linkedid']])&&_0xf970fa[_0xdd0b('0x24')]==0x6&&_0xf970fa['context']!='transfer'){utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')](_0xdd0b('0x29'),_0xf970fa['uniqueid'],_0xf970fa[_0xdd0b('0x19')],_0xf970fa['context'],_0xf970fa[_0xdd0b('0xb')]));channels[_0xf970fa['linkedid']][_0xdd0b('0x12')]=_0xf970fa[_0xdd0b('0x12')];channels[_0xf970fa[_0xdd0b('0x19')]][_0xdd0b('0x2a')]=_0xf970fa[_0xdd0b('0xb')];if(_[_0xdd0b('0x27')](channels[_0xf970fa['linkedid']][_0xdd0b('0x2b')])){channels[_0xf970fa[_0xdd0b('0x19')]][_0xdd0b('0x2b')]=utils['now']();}channels[_0xf970fa[_0xdd0b('0x19')]][_0xdd0b('0x2c')]=dispositions[_['toNumber'](_0xf970fa['channelstate'])]||_0xdd0b('0x5');}}catch(_0x5d9ecd){utils[_0xdd0b('0x20')](util[_0xdd0b('0x1b')]('[%s][calls][newstate]',_0xf970fa[_0xdd0b('0x7')]),_0x5d9ecd);}};exports[_0xdd0b('0x2d')]=function(_0x402266){try{if(!_['isNil'](channels[_0x402266[_0xdd0b('0x7')]])){utils['debug'](util['format'](_0xdd0b('0x2e'),_0x402266[_0xdd0b('0x7')]),_0x402266);if(_[_0xdd0b('0x27')](channels[_0x402266['uniqueid']]['callerid'])){channels[_0x402266['uniqueid']][_0xdd0b('0x2f')]=_0x402266[_0xdd0b('0x30')]+'\x20<'+_0x402266[_0xdd0b('0xf')]+'>';}utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')](_0xdd0b('0x31'),_0x402266[_0xdd0b('0x7')],channels[_0x402266[_0xdd0b('0x7')]][_0xdd0b('0x2f')],_0x402266[_0xdd0b('0x32')]));channels[_0x402266['uniqueid']][_0xdd0b('0x33')]=utils[_0xdd0b('0x1e')]();channels[_0x402266[_0xdd0b('0x7')]]['duration']=utils['diffTime'](channels[_0x402266[_0xdd0b('0x7')]]['endtime'],channels[_0x402266[_0xdd0b('0x7')]][_0xdd0b('0x34')]);channels[_0x402266['uniqueid']][_0xdd0b('0x35')]=channels[_0x402266[_0xdd0b('0x7')]][_0xdd0b('0x2b')]?utils['diffTime'](channels[_0x402266[_0xdd0b('0x7')]]['endtime'],channels[_0x402266[_0xdd0b('0x7')]][_0xdd0b('0x2b')]):0x0;writeDB(channels[_0x402266['uniqueid']]);}}catch(_0x51341){utils[_0xdd0b('0x20')](util[_0xdd0b('0x1b')]('[%s][calls][hangup]',_0x402266[_0xdd0b('0x7')]),_0x51341);}};exports[_0xdd0b('0x36')]=function(_0x4924f0){try{if(!_['isNil'](channels[_0x4924f0[_0xdd0b('0x37')]])){utils[_0xdd0b('0x22')](util[_0xdd0b('0x1b')](_0xdd0b('0x38'),_0x4924f0[_0xdd0b('0x39')]),_0x4924f0);if(channels[_0x4924f0['localtwolinkedid']][_0xdd0b('0xb')]==_0x4924f0['transfereechannel']){utils[_0xdd0b('0x25')](util['format'](_0xdd0b('0x3a'),_0x4924f0['origtransfereruniqueid'],_0x4924f0[_0xdd0b('0x37')],_0x4924f0[_0xdd0b('0x3b')]));channels[_0x4924f0['localtwolinkedid']][_0xdd0b('0x2a')]=_0x4924f0[_0xdd0b('0x3b')];channels[_0x4924f0[_0xdd0b('0x37')]][_0xdd0b('0x3c')]=_0xdd0b('0x3d');}else if(channels[_0x4924f0[_0xdd0b('0x37')]][_0xdd0b('0xb')]=_0x4924f0[_0xdd0b('0x3e')]){utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4924f0['origtransfereruniqueid'],_0x4924f0[_0xdd0b('0x37')],_0x4924f0['origtransfererchannel']));channels[_0x4924f0[_0xdd0b('0x37')]][_0xdd0b('0x2a')]=_0x4924f0[_0xdd0b('0x3f')];channels[_0x4924f0[_0xdd0b('0x37')]][_0xdd0b('0x3c')]=_0xdd0b('0x3d');}}}catch(_0x4fa682){utils[_0xdd0b('0x20')](util[_0xdd0b('0x1b')](_0xdd0b('0x38'),_0x4924f0['origtransfereruniqueid']),_0x4fa682);}};exports[_0xdd0b('0x40')]=function(_0x45ecdd){try{if(!_[_0xdd0b('0x27')](channels[_0x45ecdd[_0xdd0b('0x7')]])){utils[_0xdd0b('0x22')](util[_0xdd0b('0x1b')](_0xdd0b('0x41'),_0x45ecdd[_0xdd0b('0x7')]),_0x45ecdd);channels[_0x45ecdd[_0xdd0b('0x7')]][_0xdd0b('0x42')]=utils['now']();utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')](_0xdd0b('0x43'),_0x45ecdd[_0xdd0b('0x7')],channels[_0x45ecdd[_0xdd0b('0x7')]]['musiconholdstartAt']));}}catch(_0x256ffe){utils[_0xdd0b('0x20')](util[_0xdd0b('0x1b')](_0xdd0b('0x41'),_0x45ecdd[_0xdd0b('0x7')]),_0x256ffe);}};exports['musiconholdstop']=function(_0x4ed666){try{if(!_[_0xdd0b('0x27')](channels[_0x4ed666[_0xdd0b('0x7')]])){utils[_0xdd0b('0x22')](util['format'](_0xdd0b('0x44'),_0x4ed666[_0xdd0b('0x7')]),_0x4ed666);if(!_['isNil'](channels[_0x4ed666[_0xdd0b('0x7')]][_0xdd0b('0x42')])){channels[_0x4ed666[_0xdd0b('0x7')]]['mohtime']+=utils['diffTime'](utils[_0xdd0b('0x1e')](),channels[_0x4ed666[_0xdd0b('0x7')]][_0xdd0b('0x42')]);utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4ed666[_0xdd0b('0x7')],channels[_0x4ed666[_0xdd0b('0x7')]]['mohtime']));delete channels[_0x4ed666[_0xdd0b('0x7')]][_0xdd0b('0x42')];}}}catch(_0x510be5){utils[_0xdd0b('0x20')](util['format'](_0xdd0b('0x44'),_0x4ed666[_0xdd0b('0x7')]),_0x510be5);}};exports[_0xdd0b('0x45')]=function(_0x43c441){try{if(!_['isNil'](channels[_0x43c441['uniqueid']])){utils[_0xdd0b('0x22')](util[_0xdd0b('0x1b')]('[%s][calls][varset]',_0x43c441[_0xdd0b('0x7')]),_0x43c441);if(!_[_0xdd0b('0x27')](_0x43c441[_0xdd0b('0x46')][_0xdd0b('0x47')])){utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')](_0xdd0b('0x48'),_0x43c441[_0xdd0b('0x7')],_0x43c441[_0xdd0b('0x49')]));channels[_0x43c441['uniqueid']][_0xdd0b('0x4a')]=_0x43c441[_0xdd0b('0x49')];}if(!_[_0xdd0b('0x27')](_0x43c441[_0xdd0b('0x46')][_0xdd0b('0x4b')])){utils[_0xdd0b('0x25')](util['format'](_0xdd0b('0x4c'),_0x43c441[_0xdd0b('0x7')],_0x43c441['value']));channels[_0x43c441[_0xdd0b('0x7')]]['destination']=_0x43c441[_0xdd0b('0x49')];channels[_0x43c441['uniqueid']][_0xdd0b('0x2f')]='\x22'+_0x43c441[_0xdd0b('0x49')]+_0xdd0b('0x4d')+_0x43c441['value']+'>';}if(!_[_0xdd0b('0x27')](_0x43c441[_0xdd0b('0x46')][_0xdd0b('0x4e')])||!_['isNil'](_0x43c441[_0xdd0b('0x46')]['xmd-callerid'])){utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')](_0xdd0b('0x4f'),_0x43c441[_0xdd0b('0x7')],!_[_0xdd0b('0x27')](_0x43c441['variable'][_0xdd0b('0x4e')])?_0xdd0b('0x4e'):_0xdd0b('0x50'),_0x43c441['value']));channels[_0x43c441[_0xdd0b('0x7')]][_0xdd0b('0x2f')]=_0x43c441['value'];}if(!_[_0xdd0b('0x27')](_0x43c441['variable'][_0xdd0b('0x51')])||!_[_0xdd0b('0x27')](_0x43c441[_0xdd0b('0x46')]['xmcs-queue'])){utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')](_0xdd0b('0x4f'),_0x43c441[_0xdd0b('0x7')],!_[_0xdd0b('0x27')](_0x43c441[_0xdd0b('0x46')]['xmd-queue'])?'xmd-queue':_0xdd0b('0x52'),_0x43c441[_0xdd0b('0x49')]));channels[_0x43c441[_0xdd0b('0x7')]]['lastapplication']=_0xdd0b('0x53');channels[_0x43c441['uniqueid']][_0xdd0b('0x54')]=_0x43c441[_0xdd0b('0x49')];channels[_0x43c441[_0xdd0b('0x7')]][_0xdd0b('0xc')]=!![];}if(!_[_0xdd0b('0x27')](_0x43c441['variable'][_0xdd0b('0x55')])){utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x43c441[_0xdd0b('0x7')],_0x43c441[_0xdd0b('0x49')]));channels[_0x43c441[_0xdd0b('0x7')]]['ContactId']=_0x43c441[_0xdd0b('0x49')];}if(!_[_0xdd0b('0x27')](_0x43c441['variable']['xmd-cdrtype'])){utils['info'](util[_0xdd0b('0x1b')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x43c441[_0xdd0b('0x7')],_0x43c441[_0xdd0b('0x49')]));channels[_0x43c441[_0xdd0b('0x7')]][_0xdd0b('0x56')]=_0x43c441[_0xdd0b('0x49')];}if(!_[_0xdd0b('0x27')](_0x43c441[_0xdd0b('0x46')]['outboundrouteid'])){utils[_0xdd0b('0x25')](util['format'](_0xdd0b('0x57'),_0x43c441['uniqueid'],_0x43c441[_0xdd0b('0x49')]));channels[_0x43c441[_0xdd0b('0x7')]][_0xdd0b('0x58')]=_0x43c441[_0xdd0b('0x49')];}if(!_[_0xdd0b('0x27')](_0x43c441[_0xdd0b('0x46')][_0xdd0b('0x59')])){utils[_0xdd0b('0x25')](util[_0xdd0b('0x1b')](_0xdd0b('0x5a'),_0x43c441['uniqueid'],_0x43c441[_0xdd0b('0x49')]));channels[_0x43c441[_0xdd0b('0x7')]][_0xdd0b('0x59')]=_0x43c441[_0xdd0b('0x49')];}}}catch(_0x46d187){utils[_0xdd0b('0x20')](util[_0xdd0b('0x1b')](_0xdd0b('0x5b'),_0x43c441[_0xdd0b('0x7')]),_0x46d187);}};exports[_0xdd0b('0x5c')]=function(_0x105a7f){try{if(!_[_0xdd0b('0x27')](channels[_0x105a7f[_0xdd0b('0x7')]])){utils[_0xdd0b('0x22')](util[_0xdd0b('0x1b')](_0xdd0b('0x5d'),_0x105a7f['uniqueid']),_0x105a7f);utils[_0xdd0b('0x25')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x105a7f[_0xdd0b('0x7')],_0x105a7f[_0xdd0b('0x5e')],_0x105a7f[_0xdd0b('0x5f')]));if(_0x105a7f[_0xdd0b('0x5e')][_0xdd0b('0x60')]()==_0xdd0b('0x61')&&_[_0xdd0b('0x62')](_0x105a7f['appdata'][_0xdd0b('0x60')](),_0xdd0b('0x63'))){var _0x5865aa=_0x105a7f[_0xdd0b('0x5f')][_0xdd0b('0x64')]('=');var _0x3069ef=_0x5865aa[0x0][_0xdd0b('0x65')](_0x5865aa[0x0][_0xdd0b('0x66')]('(')+0x1,_0x5865aa[0x0][_0xdd0b('0x66')](')'));var _0x17fa8b=_0x5865aa[0x1];channels[_0x105a7f['uniqueid']][_0x3069ef]=_0x17fa8b;}if(!_[_0xdd0b('0x67')](['hangup',_0xdd0b('0x68'),'execif',_0xdd0b('0x61'),_0xdd0b('0x69')],_0x105a7f[_0xdd0b('0x5e')]['toLowerCase']())){channels[_0x105a7f[_0xdd0b('0x7')]]['lastapplication']=_0x105a7f[_0xdd0b('0x5e')];channels[_0x105a7f[_0xdd0b('0x7')]]['lastdata']=_0x105a7f['appdata'];}}}catch(_0x3eda8d){utils[_0xdd0b('0x20')](util[_0xdd0b('0x1b')](_0xdd0b('0x5d'),_0x105a7f['uniqueid']),_0x3eda8d);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 88d2e12..4b20e0c 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 _0xbbe0=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','close','[core]\x20close','./utils','connect','info'];(function(_0x8e9235,_0x552ac0){var _0x385465=function(_0x478174){while(--_0x478174){_0x8e9235['push'](_0x8e9235['shift']());}};_0x385465(++_0x552ac0);}(_0xbbe0,0x75));var _0x0bbe=function(_0x553e46,_0x2206cc){_0x553e46=_0x553e46-0x0;var _0x3c82b5=_0xbbe0[_0x553e46];return _0x3c82b5;};'use strict';var utils=require(_0x0bbe('0x0'));exports[_0x0bbe('0x1')]=function(){utils[_0x0bbe('0x2')](_0x0bbe('0x3'));};exports[_0x0bbe('0x4')]=function(){utils[_0x0bbe('0x2')](_0x0bbe('0x5'));};exports[_0x0bbe('0x6')]=function(){utils[_0x0bbe('0x2')]('[core]\x20fullybooted');};exports[_0x0bbe('0x7')]=function(_0x46d329){utils['error']('[core]\x20error',_0x46d329);};exports[_0x0bbe('0x8')]=function(){utils[_0x0bbe('0x2')](_0x0bbe('0x9'));};exports['managerevent']=function(_0x14c2af){}; \ No newline at end of file +var _0x6462=['[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','./utils','connect','info'];(function(_0x27b7a1,_0x54c927){var _0xdc662b=function(_0x5cd1bc){while(--_0x5cd1bc){_0x27b7a1['push'](_0x27b7a1['shift']());}};_0xdc662b(++_0x54c927);}(_0x6462,0x11f));var _0x2646=function(_0x4ce259,_0xfbda9b){_0x4ce259=_0x4ce259-0x0;var _0x5b3426=_0x6462[_0x4ce259];return _0x5b3426;};'use strict';var utils=require(_0x2646('0x0'));exports[_0x2646('0x1')]=function(){utils[_0x2646('0x2')](_0x2646('0x3'));};exports['shutdown']=function(){utils[_0x2646('0x2')](_0x2646('0x4'));};exports[_0x2646('0x5')]=function(){utils[_0x2646('0x2')](_0x2646('0x6'));};exports[_0x2646('0x7')]=function(_0x301b01){utils['error']('[core]\x20error',_0x301b01);};exports[_0x2646('0x8')]=function(){utils[_0x2646('0x2')](_0x2646('0x9'));};exports['managerevent']=function(_0x22796c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ca9fe2f..5c57479 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 _0x23a6=['[%s][dials][dialbegin]','assign','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','holdtime','diffTime','endtime','billableseconds','util','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','debug','application','appdata','toLowerCase','set','startsWith','split','error','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin'];(function(_0x5dd45b,_0xf6ea6c){var _0x2b5434=function(_0x452f00){while(--_0x452f00){_0x5dd45b['push'](_0x5dd45b['shift']());}};_0x2b5434(++_0xf6ea6c);}(_0x23a6,0x190));var _0x623a=function(_0x1fe15e,_0x30fb51){_0x1fe15e=_0x1fe15e-0x0;var _0x3d726c=_0x23a6[_0x1fe15e];return _0x3d726c;};'use strict';var _=require('lodash');var util=require(_0x623a('0x0'));var utils=require(_0x623a('0x1'));var dials={};function writeDB(_0x26e00f){utils[_0x623a('0x2')](util[_0x623a('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x26e00f[_0x623a('0x4')],_0x26e00f[_0x623a('0x5')],_0x26e00f[_0x623a('0x6')],_0x26e00f[_0x623a('0x7')],_0x26e00f[_0x623a('0x8')],_0x26e00f[_0x623a('0x9')]));utils['request']('CreateVoiceDialReport',_0x26e00f);delete dials[_0x26e00f[_0x623a('0x4')]];}exports['newexten']=function(_0x1e1078){try{utils[_0x623a('0xa')](util[_0x623a('0x3')]('[%s][dials][newexten]',_0x1e1078[_0x623a('0x4')]),_0x1e1078);utils[_0x623a('0x2')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1e1078[_0x623a('0x4')],_0x1e1078[_0x623a('0xb')],_0x1e1078[_0x623a('0xc')]));if(_0x1e1078[_0x623a('0xb')][_0x623a('0xd')]()==_0x623a('0xe')&&_[_0x623a('0xf')](_0x1e1078[_0x623a('0xc')]['toLowerCase'](),'cdr(routeid)')){var _0x334a9f=_0x1e1078[_0x623a('0xc')][_0x623a('0x10')]('=');dials[_0x1e1078[_0x623a('0x4')]]={'routeId':_0x334a9f[0x1]};}}catch(_0x49b0a1){utils[_0x623a('0x11')](util[_0x623a('0x3')]('[%s][dials][newexten]',_0x1e1078[_0x623a('0x4')]),_0x49b0a1);}};exports['varset']=function(_0x413b9f){try{utils[_0x623a('0xa')](util[_0x623a('0x3')](_0x623a('0x12'),_0x413b9f[_0x623a('0x4')]),_0x413b9f);if(!_[_0x623a('0x13')](_0x413b9f['variable'][_0x623a('0x14')])){utils[_0x623a('0x2')](util[_0x623a('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x413b9f[_0x623a('0x4')],_0x413b9f['value']));dials[_0x413b9f[_0x623a('0x4')]]={'routeId':_0x413b9f[_0x623a('0x15')]};}}catch(_0x14ec32){utils['error'](util[_0x623a('0x3')](_0x623a('0x12'),_0x413b9f[_0x623a('0x4')]),_0x14ec32);}};exports[_0x623a('0x16')]=function(_0x1c99d9){try{if(!_['isNil'](dials[_0x1c99d9['uniqueid']])){utils[_0x623a('0xa')](util[_0x623a('0x3')](_0x623a('0x17'),_0x1c99d9[_0x623a('0x4')]),_0x1c99d9);dials[_0x1c99d9[_0x623a('0x4')]]=_[_0x623a('0x18')](dials[_0x1c99d9['uniqueid']],_0x1c99d9);dials[_0x1c99d9[_0x623a('0x4')]]['starttime']=utils[_0x623a('0x19')]();dials[_0x1c99d9['uniqueid']]['lastevent']=_0x623a('0x1a');utils[_0x623a('0x2')](util[_0x623a('0x3')](_0x623a('0x1b'),_0x1c99d9[_0x623a('0x4')],dials[_0x1c99d9[_0x623a('0x4')]][_0x623a('0x1c')]));}}catch(_0x4c2a63){utils[_0x623a('0x11')](util[_0x623a('0x3')](_0x623a('0x17'),_0x1c99d9[_0x623a('0x4')]),_0x4c2a63);}};exports[_0x623a('0x1d')]=function(_0x5be400){try{if(!_[_0x623a('0x13')](dials[_0x5be400['uniqueid']])){utils[_0x623a('0xa')](util['format'](_0x623a('0x1e'),_0x5be400[_0x623a('0x4')]),_0x5be400);dials[_0x5be400[_0x623a('0x4')]][_0x623a('0x9')]=_0x5be400[_0x623a('0x9')];if(_0x5be400['dialstatus']==_0x623a('0x1f')){dials[_0x5be400[_0x623a('0x4')]]=_[_0x623a('0x18')](dials[_0x5be400[_0x623a('0x4')]],_0x5be400);dials[_0x5be400[_0x623a('0x4')]][_0x623a('0x20')]=utils['now']();dials[_0x5be400[_0x623a('0x4')]][_0x623a('0x21')]=_0x623a('0x22');utils['info'](util[_0x623a('0x3')](_0x623a('0x23'),_0x5be400[_0x623a('0x4')],_0x5be400[_0x623a('0x9')],dials[_0x5be400[_0x623a('0x4')]]['answertime']));}else{utils[_0x623a('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x5be400[_0x623a('0x4')],_0x5be400[_0x623a('0x9')]));}}}catch(_0x2273da){utils[_0x623a('0x11')](util[_0x623a('0x3')](_0x623a('0x1e'),_0x5be400[_0x623a('0x4')]),_0x2273da);}};exports[_0x623a('0x24')]=function(_0x571895){try{if(!_[_0x623a('0x13')](dials[_0x571895[_0x623a('0x4')]])){utils[_0x623a('0xa')](util[_0x623a('0x3')](_0x623a('0x25'),_0x571895[_0x623a('0x4')]),_0x571895);utils[_0x623a('0x2')](util['format'](_0x623a('0x26'),_0x571895[_0x623a('0x4')],_0x571895[_0x623a('0x7')],_0x571895[_0x623a('0x27')],_0x571895[_0x623a('0x28')]));dials[_0x571895['uniqueid']]=_[_0x623a('0x18')](dials[_0x571895[_0x623a('0x4')]],{'endtime':utils[_0x623a('0x19')](),'lastevent':_0x623a('0x29')});dials[_0x571895[_0x623a('0x4')]][_0x623a('0x2a')]=utils['diffTime'](dials[_0x571895[_0x623a('0x4')]]['endtime'],dials[_0x571895[_0x623a('0x4')]][_0x623a('0x1c')]);dials[_0x571895[_0x623a('0x4')]][_0x623a('0x2b')]=utils[_0x623a('0x2c')](dials[_0x571895['uniqueid']][_0x623a('0x20')]||dials[_0x571895[_0x623a('0x4')]][_0x623a('0x2d')],dials[_0x571895[_0x623a('0x4')]]['starttime']);dials[_0x571895[_0x623a('0x4')]][_0x623a('0x2e')]=dials[_0x571895[_0x623a('0x4')]][_0x623a('0x20')]?utils[_0x623a('0x2c')](dials[_0x571895[_0x623a('0x4')]]['endtime'],dials[_0x571895[_0x623a('0x4')]]['answertime']):0x0;writeDB(dials[_0x571895[_0x623a('0x4')]]);}}catch(_0x1ed8ec){utils[_0x623a('0x11')](util[_0x623a('0x3')]('[%s][dials][hangup]',_0x571895[_0x623a('0x4')]),_0x1ed8ec);}}; \ No newline at end of file +var _0x834e=['toLowerCase','startsWith','cdr(routeid)','error','varset','debug','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','appdata','application'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x834e,0x162));var _0xe834=function(_0x38428c,_0x5575c1){_0x38428c=_0x38428c-0x0;var _0x4466e0=_0x834e[_0x38428c];return _0x4466e0;};'use strict';var _=require(_0xe834('0x0'));var util=require(_0xe834('0x1'));var utils=require(_0xe834('0x2'));var dials={};function writeDB(_0x2c49f4){utils[_0xe834('0x3')](util[_0xe834('0x4')](_0xe834('0x5'),_0x2c49f4[_0xe834('0x6')],_0x2c49f4[_0xe834('0x7')],_0x2c49f4[_0xe834('0x8')],_0x2c49f4[_0xe834('0x9')],_0x2c49f4[_0xe834('0xa')],_0x2c49f4['dialstatus']));utils[_0xe834('0xb')](_0xe834('0xc'),_0x2c49f4);delete dials[_0x2c49f4[_0xe834('0x6')]];}exports[_0xe834('0xd')]=function(_0x529415){try{utils['debug'](util[_0xe834('0x4')](_0xe834('0xe'),_0x529415[_0xe834('0x6')]),_0x529415);utils[_0xe834('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x529415[_0xe834('0x6')],_0x529415['application'],_0x529415[_0xe834('0xf')]));if(_0x529415[_0xe834('0x10')][_0xe834('0x11')]()=='set'&&_[_0xe834('0x12')](_0x529415['appdata'][_0xe834('0x11')](),_0xe834('0x13'))){var _0x4d283e=_0x529415['appdata']['split']('=');dials[_0x529415[_0xe834('0x6')]]={'routeId':_0x4d283e[0x1]};}}catch(_0x366c79){utils[_0xe834('0x14')](util[_0xe834('0x4')](_0xe834('0xe'),_0x529415[_0xe834('0x6')]),_0x366c79);}};exports[_0xe834('0x15')]=function(_0x5aa5ea){try{utils[_0xe834('0x16')](util[_0xe834('0x4')](_0xe834('0x17'),_0x5aa5ea[_0xe834('0x6')]),_0x5aa5ea);if(!_['isNil'](_0x5aa5ea[_0xe834('0x18')][_0xe834('0x19')])){utils['info'](util[_0xe834('0x4')](_0xe834('0x1a'),_0x5aa5ea[_0xe834('0x6')],_0x5aa5ea[_0xe834('0x1b')]));dials[_0x5aa5ea[_0xe834('0x6')]]={'routeId':_0x5aa5ea[_0xe834('0x1b')]};}}catch(_0x7b3d62){utils['error'](util['format'](_0xe834('0x17'),_0x5aa5ea[_0xe834('0x6')]),_0x7b3d62);}};exports['dialbegin']=function(_0x3a5951){try{if(!_[_0xe834('0x1c')](dials[_0x3a5951[_0xe834('0x6')]])){utils[_0xe834('0x16')](util[_0xe834('0x4')]('[%s][dials][dialbegin]',_0x3a5951[_0xe834('0x6')]),_0x3a5951);dials[_0x3a5951[_0xe834('0x6')]]=_[_0xe834('0x1d')](dials[_0x3a5951['uniqueid']],_0x3a5951);dials[_0x3a5951[_0xe834('0x6')]][_0xe834('0x1e')]=utils[_0xe834('0x1f')]();dials[_0x3a5951[_0xe834('0x6')]][_0xe834('0x20')]=_0xe834('0x21');utils[_0xe834('0x3')](util[_0xe834('0x4')](_0xe834('0x22'),_0x3a5951[_0xe834('0x6')],dials[_0x3a5951['uniqueid']]['starttime']));}}catch(_0x2cac85){utils['error'](util[_0xe834('0x4')](_0xe834('0x23'),_0x3a5951[_0xe834('0x6')]),_0x2cac85);}};exports[_0xe834('0x24')]=function(_0x51fbf7){try{if(!_[_0xe834('0x1c')](dials[_0x51fbf7[_0xe834('0x6')]])){utils[_0xe834('0x16')](util[_0xe834('0x4')](_0xe834('0x25'),_0x51fbf7['uniqueid']),_0x51fbf7);dials[_0x51fbf7[_0xe834('0x6')]]['dialstatus']=_0x51fbf7['dialstatus'];if(_0x51fbf7[_0xe834('0x26')]==_0xe834('0x27')){dials[_0x51fbf7[_0xe834('0x6')]]=_[_0xe834('0x1d')](dials[_0x51fbf7[_0xe834('0x6')]],_0x51fbf7);dials[_0x51fbf7['uniqueid']][_0xe834('0x28')]=utils[_0xe834('0x1f')]();dials[_0x51fbf7[_0xe834('0x6')]][_0xe834('0x20')]=_0xe834('0x29');utils['info'](util[_0xe834('0x4')](_0xe834('0x2a'),_0x51fbf7[_0xe834('0x6')],_0x51fbf7[_0xe834('0x26')],dials[_0x51fbf7[_0xe834('0x6')]][_0xe834('0x28')]));}else{utils['info'](util[_0xe834('0x4')](_0xe834('0x2b'),_0x51fbf7[_0xe834('0x6')],_0x51fbf7[_0xe834('0x26')]));}}}catch(_0x4b169c){utils[_0xe834('0x14')](util[_0xe834('0x4')]('[%s][dials][dialend]',_0x51fbf7[_0xe834('0x6')]),_0x4b169c);}};exports[_0xe834('0x2c')]=function(_0x470c34){try{if(!_[_0xe834('0x1c')](dials[_0x470c34[_0xe834('0x6')]])){utils['debug'](util['format'](_0xe834('0x2d'),_0x470c34[_0xe834('0x6')]),_0x470c34);utils[_0xe834('0x3')](util[_0xe834('0x4')](_0xe834('0x2e'),_0x470c34['uniqueid'],_0x470c34[_0xe834('0x9')],_0x470c34[_0xe834('0x2f')],_0x470c34['cause-txt']));dials[_0x470c34['uniqueid']]=_['assign'](dials[_0x470c34['uniqueid']],{'endtime':utils[_0xe834('0x1f')](),'lastevent':_0xe834('0x30')});dials[_0x470c34[_0xe834('0x6')]]['duration']=utils[_0xe834('0x31')](dials[_0x470c34[_0xe834('0x6')]][_0xe834('0x32')],dials[_0x470c34['uniqueid']][_0xe834('0x1e')]);dials[_0x470c34[_0xe834('0x6')]][_0xe834('0x33')]=utils['diffTime'](dials[_0x470c34[_0xe834('0x6')]][_0xe834('0x28')]||dials[_0x470c34['uniqueid']][_0xe834('0x32')],dials[_0x470c34[_0xe834('0x6')]][_0xe834('0x1e')]);dials[_0x470c34[_0xe834('0x6')]][_0xe834('0x34')]=dials[_0x470c34[_0xe834('0x6')]]['answertime']?utils['diffTime'](dials[_0x470c34[_0xe834('0x6')]]['endtime'],dials[_0x470c34['uniqueid']]['answertime']):0x0;writeDB(dials[_0x470c34[_0xe834('0x6')]]);}}catch(_0xda6d59){utils['error'](util[_0xe834('0x4')]('[%s][dials][hangup]',_0x470c34[_0xe834('0x6')]),_0xda6d59);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 07be590..f849afc 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 _0x3736=['attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','xdr','disabled','production','local','port','asterisk','username','password','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','agentcalled','debug','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]'];(function(_0xd6efac,_0xef3d8b){var _0xad098=function(_0x3978fb){while(--_0x3978fb){_0xd6efac['push'](_0xd6efac['shift']());}};_0xad098(++_0xef3d8b);}(_0x3736,0x8f));var _0x6373=function(_0x30248d,_0x133131){_0x30248d=_0x30248d-0x0;var _0x5f5c11=_0x3736[_0x30248d];return _0x5f5c11;};var AsteriskManager=require('asterisk-manager');var config=require(_0x6373('0x0'));var utils=require('./utils');var util=require('util');var isXDREnabled=config[_0x6373('0x1')]&&config[_0x6373('0x1')][_0x6373('0x2')]?!config[_0x6373('0x1')][_0x6373('0x2')]:!![];var isProduction=config['env']===_0x6373('0x3')||![];var isLocalAsterisk=config[_0x6373('0x1')]&&config['xdr'][_0x6373('0x4')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x6373('0x5')],config[_0x6373('0x6')]['ip'],config[_0x6373('0x6')][_0x6373('0x7')],config[_0x6373('0x6')][_0x6373('0x8')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x6373('0x9')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x6373('0xa'));var calls=require(_0x6373('0xb'));var queues=require(_0x6373('0xc'));var recordings=require(_0x6373('0xd'));var members=require('./members.controller');var dials=require(_0x6373('0xe'));var transfers=require(_0x6373('0xf'));var core=require(_0x6373('0x10'));ami['on']('connect',core['connect']);ami['on'](_0x6373('0x11'),core[_0x6373('0x11')]);ami['on'](_0x6373('0x12'),core['fullybooted']);ami['on']('error',core[_0x6373('0x13')]);ami['on']('close',core[_0x6373('0x14')]);ami['on'](_0x6373('0x15'),core[_0x6373('0x15')]);ami['on'](_0x6373('0x16'),function(_0x527813){try{utils['debug'](util[_0x6373('0x17')]('[%s][index][devicestatechange]',_0x527813['device']),_0x527813);members[_0x6373('0x16')](_0x527813);}catch(_0x53114a){utils[_0x6373('0x13')](util[_0x6373('0x17')]('[%s][index][devicestatechange]',_0x527813[_0x6373('0x18')]),_0x53114a);}});ami['on'](_0x6373('0x19'),function(_0x5459d9){try{utils[_0x6373('0x1a')](util['format']('[%s][index][agentcalled]',_0x5459d9[_0x6373('0x1b')]),_0x5459d9);agents['agentcalled'](_0x5459d9);}catch(_0x74006f){utils[_0x6373('0x13')](util[_0x6373('0x17')](_0x6373('0x1c'),_0x5459d9[_0x6373('0x1b')]),_0x74006f);}});ami['on'](_0x6373('0x1d'),function(_0x40667b){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')](_0x6373('0x1e'),_0x40667b['uniqueid']),_0x40667b);agents[_0x6373('0x1d')](_0x40667b);}catch(_0x412bf2){utils['error'](util[_0x6373('0x17')](_0x6373('0x1e'),_0x40667b[_0x6373('0x1b')]),_0x412bf2);}});ami['on'](_0x6373('0x1f'),function(_0x415e49){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')]('[%s][index][agentconnect]',_0x415e49[_0x6373('0x1b')]),_0x415e49);agents[_0x6373('0x1f')](_0x415e49);queues[_0x6373('0x1f')](_0x415e49);}catch(_0x558d06){utils[_0x6373('0x13')](util[_0x6373('0x17')](_0x6373('0x20'),_0x415e49['uniqueid']),_0x558d06);}});ami['on'](_0x6373('0x21'),function(_0x375eba){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')]('[%s][index][agentcomplete]',_0x375eba[_0x6373('0x1b')]),_0x375eba);agents[_0x6373('0x21')](_0x375eba);queues[_0x6373('0x21')](_0x375eba);members['agentcomplete'](_0x375eba);}catch(_0x21eb74){utils['error'](util['format'](_0x6373('0x22'),_0x375eba['uniqueid']),_0x21eb74);}});ami['on']('queuecallerabandon',function(_0x51a41f){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')](_0x6373('0x23'),_0x51a41f[_0x6373('0x1b')]),_0x51a41f);agents['queuecallerabandon'](_0x51a41f);queues['queuecallerabandon'](_0x51a41f);}catch(_0x2e82ec){utils[_0x6373('0x13')](util[_0x6373('0x17')](_0x6373('0x23'),_0x51a41f['uniqueid']),_0x2e82ec);}});ami['on']('queuecallerjoin',function(_0x5b3153){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')](_0x6373('0x24'),_0x5b3153['uniqueid']),_0x5b3153);queues[_0x6373('0x25')](_0x5b3153);recordings[_0x6373('0x25')](_0x5b3153);}catch(_0xcfdbd){utils['error'](util['format'](_0x6373('0x24'),_0x5b3153[_0x6373('0x1b')]),_0xcfdbd);}});ami['on'](_0x6373('0x26'),function(_0x4df3bc){try{utils[_0x6373('0x1a')](util['format']('[%s][index][queuecallerleave]',_0x4df3bc[_0x6373('0x1b')]),_0x4df3bc);queues[_0x6373('0x26')](_0x4df3bc);}catch(_0x13757b){utils[_0x6373('0x13')](util['format'](_0x6373('0x27'),_0x4df3bc[_0x6373('0x1b')]),_0x13757b);}});ami['on'](_0x6373('0x28'),function(_0x4b604d){try{utils['debug'](util[_0x6373('0x17')](_0x6373('0x29'),_0x4b604d[_0x6373('0x1b')]),_0x4b604d);queues[_0x6373('0x28')](_0x4b604d);calls[_0x6373('0x28')](_0x4b604d);}catch(_0x3e1ec3){utils[_0x6373('0x13')](util[_0x6373('0x17')](_0x6373('0x29'),_0x4b604d['uniqueid']),_0x3e1ec3);}});ami['on']('musiconholdstop',function(_0x1884f6){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')]('[%s][index][musiconholdstop]',_0x1884f6[_0x6373('0x1b')]),_0x1884f6);queues[_0x6373('0x2a')](_0x1884f6);calls[_0x6373('0x2a')](_0x1884f6);}catch(_0x3e6747){utils[_0x6373('0x13')](util[_0x6373('0x17')](_0x6373('0x2b'),_0x1884f6[_0x6373('0x1b')]),_0x3e6747);}});ami['on'](_0x6373('0x2c'),function(_0x59b122){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')](_0x6373('0x2d'),_0x59b122[_0x6373('0x1b')]),_0x59b122);calls['newstate'](_0x59b122);recordings[_0x6373('0x2c')](_0x59b122);}catch(_0xfb56aa){utils['error'](util['format'](_0x6373('0x2d'),_0x59b122['uniqueid']),_0xfb56aa);}});ami['on'](_0x6373('0x2e'),function(_0x390256){try{utils['debug'](util[_0x6373('0x17')](_0x6373('0x2f'),_0x390256[_0x6373('0x1b')]),_0x390256);calls[_0x6373('0x2e')](_0x390256);recordings[_0x6373('0x2e')](_0x390256);dials[_0x6373('0x2e')](_0x390256);agents['hangup'](_0x390256);queues[_0x6373('0x2e')](_0x390256);}catch(_0x53b8f5){utils[_0x6373('0x13')](util['format'](_0x6373('0x2f'),_0x390256[_0x6373('0x1b')]),_0x53b8f5);}});ami['on'](_0x6373('0x30'),function(_0x4e3c5d){try{utils[_0x6373('0x1a')](util['format']('[%s][index][cdr]',_0x4e3c5d[_0x6373('0x1b')]),_0x4e3c5d);members[_0x6373('0x30')](_0x4e3c5d);}catch(_0x40b7ee){utils[_0x6373('0x13')](util[_0x6373('0x17')](_0x6373('0x31'),_0x4e3c5d[_0x6373('0x1b')]),_0x40b7ee);}});ami['on'](_0x6373('0x32'),function(_0xd1e4ba){try{utils[_0x6373('0x1a')](util['format'](_0x6373('0x33'),_0xd1e4ba[_0x6373('0x1b')]),_0xd1e4ba);queues[_0x6373('0x32')](_0xd1e4ba);agents[_0x6373('0x32')](_0xd1e4ba);transfers['blindtransfer'](_0xd1e4ba);recordings[_0x6373('0x32')](_0xd1e4ba);}catch(_0x3e8a6c){utils['error'](util[_0x6373('0x17')](_0x6373('0x33'),_0xd1e4ba[_0x6373('0x1b')]),_0x3e8a6c);}});ami['on'](_0x6373('0x34'),function(_0x3d4548){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')](_0x6373('0x35'),_0x3d4548[_0x6373('0x36')]),_0x3d4548);queues['attendedtransfer'](_0x3d4548);transfers[_0x6373('0x34')](_0x3d4548);agents[_0x6373('0x34')](_0x3d4548);calls['attendedtransfer'](_0x3d4548);}catch(_0x3c843b){utils[_0x6373('0x13')](util['format'](_0x6373('0x35'),_0x3d4548['origtransfereruniqueid']),_0x3c843b);}});ami['on'](_0x6373('0x37'),function(_0x4f98b5){try{utils['debug'](util[_0x6373('0x17')](_0x6373('0x38'),_0x4f98b5[_0x6373('0x1b')]),_0x4f98b5);queues[_0x6373('0x37')](_0x4f98b5);recordings[_0x6373('0x37')](_0x4f98b5);calls['varset'](_0x4f98b5);dials['varset'](_0x4f98b5);}catch(_0x315bfb){utils['error'](util[_0x6373('0x17')](_0x6373('0x38'),_0x4f98b5[_0x6373('0x1b')]),_0x315bfb);}});ami['on'](_0x6373('0x39'),function(_0x95ee89){try{utils[_0x6373('0x1a')](util['format'](_0x6373('0x3a'),_0x95ee89[_0x6373('0x1b')]),_0x95ee89);calls['newexten'](_0x95ee89);recordings[_0x6373('0x39')](_0x95ee89);dials['newexten'](_0x95ee89);}catch(_0x1334b5){utils['error'](util[_0x6373('0x17')](_0x6373('0x3a'),_0x95ee89[_0x6373('0x1b')]),_0x1334b5);}});ami['on'](_0x6373('0x3b'),function(_0x9d2752){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')]('[%s][index][newchannel]',_0x9d2752[_0x6373('0x1b')]),_0x9d2752);calls['newchannel'](_0x9d2752);recordings[_0x6373('0x3b')](_0x9d2752);}catch(_0x3feb47){utils[_0x6373('0x13')](util[_0x6373('0x17')](_0x6373('0x3c'),_0x9d2752['uniqueid']),_0x3feb47);}});ami['on']('dialbegin',function(_0x46b447){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')]('[%s][index][dialbegin]',_0x46b447[_0x6373('0x1b')]),_0x46b447);dials[_0x6373('0x3d')](_0x46b447);}catch(_0x5cab9a){utils[_0x6373('0x13')](util[_0x6373('0x17')](_0x6373('0x3e'),_0x46b447[_0x6373('0x1b')]),_0x5cab9a);}});ami['on'](_0x6373('0x3f'),function(_0x162f2a){try{utils[_0x6373('0x1a')](util[_0x6373('0x17')](_0x6373('0x40'),_0x162f2a[_0x6373('0x1b')]),_0x162f2a);dials[_0x6373('0x3f')](_0x162f2a);}catch(_0x45f4fd){utils[_0x6373('0x13')](util['format'](_0x6373('0x40'),_0x162f2a[_0x6373('0x1b')]),_0x45f4fd);}});} \ No newline at end of file +var _0x6dfb=['queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','[%s][index][devicestatechange]','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]'];(function(_0x1ac47f,_0x3b7aaf){var _0x43276f=function(_0x46906c){while(--_0x46906c){_0x1ac47f['push'](_0x1ac47f['shift']());}};_0x43276f(++_0x3b7aaf);}(_0x6dfb,0x6a));var _0xb6df=function(_0x16d95b,_0x34d081){_0x16d95b=_0x16d95b-0x0;var _0x11b271=_0x6dfb[_0x16d95b];return _0x11b271;};var AsteriskManager=require(_0xb6df('0x0'));var config=require(_0xb6df('0x1'));var utils=require(_0xb6df('0x2'));var util=require(_0xb6df('0x3'));var isXDREnabled=config[_0xb6df('0x4')]&&config['xdr'][_0xb6df('0x5')]?!config[_0xb6df('0x4')][_0xb6df('0x5')]:!![];var isProduction=config['env']===_0xb6df('0x6')||![];var isLocalAsterisk=config[_0xb6df('0x4')]&&config[_0xb6df('0x4')][_0xb6df('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xb6df('0x8')][_0xb6df('0x9')],config[_0xb6df('0x8')]['ip'],config[_0xb6df('0x8')][_0xb6df('0xa')],config[_0xb6df('0x8')]['password'],!![]);ami[_0xb6df('0xb')]();if(!isXDREnabled){utils[_0xb6df('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xb6df('0xc')](_0xb6df('0xd'));}else{var agents=require(_0xb6df('0xe'));var calls=require(_0xb6df('0xf'));var queues=require(_0xb6df('0x10'));var recordings=require(_0xb6df('0x11'));var members=require(_0xb6df('0x12'));var dials=require(_0xb6df('0x13'));var transfers=require(_0xb6df('0x14'));var core=require(_0xb6df('0x15'));ami['on'](_0xb6df('0x16'),core[_0xb6df('0x16')]);ami['on'](_0xb6df('0x17'),core['shutdown']);ami['on']('fullybooted',core[_0xb6df('0x18')]);ami['on'](_0xb6df('0x19'),core[_0xb6df('0x19')]);ami['on']('close',core[_0xb6df('0x1a')]);ami['on']('managerevent',core[_0xb6df('0x1b')]);ami['on'](_0xb6df('0x1c'),function(_0x1335ef){try{utils['debug'](util[_0xb6df('0x1d')]('[%s][index][devicestatechange]',_0x1335ef[_0xb6df('0x1e')]),_0x1335ef);members['devicestatechange'](_0x1335ef);}catch(_0x1dd7c0){utils['error'](util[_0xb6df('0x1d')](_0xb6df('0x1f'),_0x1335ef[_0xb6df('0x1e')]),_0x1dd7c0);}});ami['on'](_0xb6df('0x20'),function(_0xc31f22){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x22'),_0xc31f22[_0xb6df('0x23')]),_0xc31f22);agents[_0xb6df('0x20')](_0xc31f22);}catch(_0x563d61){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x22'),_0xc31f22[_0xb6df('0x23')]),_0x563d61);}});ami['on'](_0xb6df('0x24'),function(_0x589192){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x25'),_0x589192[_0xb6df('0x23')]),_0x589192);agents[_0xb6df('0x24')](_0x589192);}catch(_0x1253cc){utils['error'](util[_0xb6df('0x1d')](_0xb6df('0x25'),_0x589192['uniqueid']),_0x1253cc);}});ami['on'](_0xb6df('0x26'),function(_0x1f5978){try{utils['debug'](util[_0xb6df('0x1d')](_0xb6df('0x27'),_0x1f5978[_0xb6df('0x23')]),_0x1f5978);agents['agentconnect'](_0x1f5978);queues[_0xb6df('0x26')](_0x1f5978);}catch(_0x57d7d0){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x27'),_0x1f5978[_0xb6df('0x23')]),_0x57d7d0);}});ami['on'](_0xb6df('0x28'),function(_0x45a9e5){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x29'),_0x45a9e5[_0xb6df('0x23')]),_0x45a9e5);agents[_0xb6df('0x28')](_0x45a9e5);queues[_0xb6df('0x28')](_0x45a9e5);members['agentcomplete'](_0x45a9e5);}catch(_0x46e275){utils['error'](util[_0xb6df('0x1d')](_0xb6df('0x29'),_0x45a9e5['uniqueid']),_0x46e275);}});ami['on'](_0xb6df('0x2a'),function(_0x559d1d){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x2b'),_0x559d1d[_0xb6df('0x23')]),_0x559d1d);agents[_0xb6df('0x2a')](_0x559d1d);queues[_0xb6df('0x2a')](_0x559d1d);}catch(_0x4b6795){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x2b'),_0x559d1d[_0xb6df('0x23')]),_0x4b6795);}});ami['on']('queuecallerjoin',function(_0x2c932d){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x2c'),_0x2c932d['uniqueid']),_0x2c932d);queues[_0xb6df('0x2d')](_0x2c932d);recordings['queuecallerjoin'](_0x2c932d);}catch(_0x542941){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x2c'),_0x2c932d[_0xb6df('0x23')]),_0x542941);}});ami['on'](_0xb6df('0x2e'),function(_0x47793d){try{utils['debug'](util[_0xb6df('0x1d')](_0xb6df('0x2f'),_0x47793d[_0xb6df('0x23')]),_0x47793d);queues['queuecallerleave'](_0x47793d);}catch(_0x31a12f){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')]('[%s][index][queuecallerleave]',_0x47793d[_0xb6df('0x23')]),_0x31a12f);}});ami['on']('musiconholdstart',function(_0x4dbef6){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x30'),_0x4dbef6[_0xb6df('0x23')]),_0x4dbef6);queues[_0xb6df('0x31')](_0x4dbef6);calls[_0xb6df('0x31')](_0x4dbef6);}catch(_0x4abf78){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x30'),_0x4dbef6[_0xb6df('0x23')]),_0x4abf78);}});ami['on'](_0xb6df('0x32'),function(_0x2b0e4e){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x33'),_0x2b0e4e['uniqueid']),_0x2b0e4e);queues['musiconholdstop'](_0x2b0e4e);calls[_0xb6df('0x32')](_0x2b0e4e);}catch(_0x1c288a){utils[_0xb6df('0x19')](util['format']('[%s][index][musiconholdstop]',_0x2b0e4e[_0xb6df('0x23')]),_0x1c288a);}});ami['on'](_0xb6df('0x34'),function(_0x114312){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x35'),_0x114312[_0xb6df('0x23')]),_0x114312);calls[_0xb6df('0x34')](_0x114312);recordings[_0xb6df('0x34')](_0x114312);}catch(_0x4f468c){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x35'),_0x114312[_0xb6df('0x23')]),_0x4f468c);}});ami['on'](_0xb6df('0x36'),function(_0x1be99f){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')]('[%s][index][hangup]',_0x1be99f['uniqueid']),_0x1be99f);calls[_0xb6df('0x36')](_0x1be99f);recordings['hangup'](_0x1be99f);dials['hangup'](_0x1be99f);agents[_0xb6df('0x36')](_0x1be99f);queues[_0xb6df('0x36')](_0x1be99f);}catch(_0x377ce7){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x37'),_0x1be99f[_0xb6df('0x23')]),_0x377ce7);}});ami['on'](_0xb6df('0x38'),function(_0x5e0852){try{utils['debug'](util['format'](_0xb6df('0x39'),_0x5e0852[_0xb6df('0x23')]),_0x5e0852);members['cdr'](_0x5e0852);}catch(_0x2d31e0){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x39'),_0x5e0852[_0xb6df('0x23')]),_0x2d31e0);}});ami['on']('blindtransfer',function(_0x4a445b){try{utils['debug'](util[_0xb6df('0x1d')](_0xb6df('0x3a'),_0x4a445b[_0xb6df('0x23')]),_0x4a445b);queues[_0xb6df('0x3b')](_0x4a445b);agents[_0xb6df('0x3b')](_0x4a445b);transfers[_0xb6df('0x3b')](_0x4a445b);recordings['blindtransfer'](_0x4a445b);}catch(_0xf2c66f){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x3a'),_0x4a445b[_0xb6df('0x23')]),_0xf2c66f);}});ami['on'](_0xb6df('0x3c'),function(_0x5b4b01){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x3d'),_0x5b4b01[_0xb6df('0x3e')]),_0x5b4b01);queues[_0xb6df('0x3c')](_0x5b4b01);transfers[_0xb6df('0x3c')](_0x5b4b01);agents[_0xb6df('0x3c')](_0x5b4b01);calls[_0xb6df('0x3c')](_0x5b4b01);}catch(_0x3cbdc0){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x3d'),_0x5b4b01[_0xb6df('0x3e')]),_0x3cbdc0);}});ami['on'](_0xb6df('0x3f'),function(_0x2c6a79){try{utils['debug'](util['format'](_0xb6df('0x40'),_0x2c6a79[_0xb6df('0x23')]),_0x2c6a79);queues['varset'](_0x2c6a79);recordings['varset'](_0x2c6a79);calls[_0xb6df('0x3f')](_0x2c6a79);dials[_0xb6df('0x3f')](_0x2c6a79);}catch(_0x5594a9){utils['error'](util[_0xb6df('0x1d')](_0xb6df('0x40'),_0x2c6a79[_0xb6df('0x23')]),_0x5594a9);}});ami['on'](_0xb6df('0x41'),function(_0x125fb3){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x42'),_0x125fb3[_0xb6df('0x23')]),_0x125fb3);calls[_0xb6df('0x41')](_0x125fb3);recordings[_0xb6df('0x41')](_0x125fb3);dials[_0xb6df('0x41')](_0x125fb3);}catch(_0x3391cc){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x42'),_0x125fb3[_0xb6df('0x23')]),_0x3391cc);}});ami['on']('newchannel',function(_0x9194c4){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x43'),_0x9194c4['uniqueid']),_0x9194c4);calls[_0xb6df('0x44')](_0x9194c4);recordings[_0xb6df('0x44')](_0x9194c4);}catch(_0x3e19d8){utils[_0xb6df('0x19')](util[_0xb6df('0x1d')](_0xb6df('0x43'),_0x9194c4[_0xb6df('0x23')]),_0x3e19d8);}});ami['on'](_0xb6df('0x45'),function(_0x10a2d2){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x46'),_0x10a2d2[_0xb6df('0x23')]),_0x10a2d2);dials[_0xb6df('0x45')](_0x10a2d2);}catch(_0x1dc86c){utils['error'](util['format'](_0xb6df('0x47'),_0x10a2d2[_0xb6df('0x23')]),_0x1dc86c);}});ami['on'](_0xb6df('0x48'),function(_0x41ff0c){try{utils[_0xb6df('0x21')](util[_0xb6df('0x1d')](_0xb6df('0x49'),_0x41ff0c[_0xb6df('0x23')]),_0x41ff0c);dials[_0xb6df('0x48')](_0x41ff0c);}catch(_0x12905d){utils['error'](util[_0xb6df('0x1d')]('[%s][index][dialend]',_0x41ff0c[_0xb6df('0x23')]),_0x12905d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index f0594f8..d02283d 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 _0x46cc=['info','format','interface','channel','data2','membername','type','getUserByInterface','internal','request','CreateMemberReport','getUserByName','split','then','name','catch','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','now','agent','isNil','exitAt','diffTime','enterAt','error','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','data3','destinationchannel','destination','util','./utils','Queue:'];(function(_0x47d601,_0x59a5fe){var _0xff661d=function(_0x43ac5d){while(--_0x43ac5d){_0x47d601['push'](_0x47d601['shift']());}};_0xff661d(++_0x59a5fe);}(_0x46cc,0xc1));var _0xc46c=function(_0x22b64b,_0x5de02f){_0x22b64b=_0x22b64b-0x0;var _0x2b24de=_0x46cc[_0x22b64b];return _0x2b24de;};'use strict';var _=require('lodash');var util=require(_0xc46c('0x0'));var utils=require(_0xc46c('0x1'));var members={};var exclude=['Local/_attended@transfer',_0xc46c('0x2')];function writeDB(_0x36840f){utils[_0xc46c('0x3')](util[_0xc46c('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x36840f['uniqueid'],_0x36840f[_0xc46c('0x5')],_0x36840f[_0xc46c('0x6')],_0x36840f[_0xc46c('0x7')],_0x36840f[_0xc46c('0x8')],_0x36840f[_0xc46c('0x9')]));if(_0x36840f[_0xc46c('0x5')]){utils[_0xc46c('0xa')](_0x36840f[_0xc46c('0x5')])['then'](function(_0x1af0de){if(_0x1af0de){_0x36840f[_0xc46c('0x8')]=_0x1af0de['name'];_0x36840f[_0xc46c('0xb')]=_0x1af0de[_0xc46c('0xb')];utils[_0xc46c('0xc')](_0xc46c('0xd'),_0x36840f);}else{utils[_0xc46c('0xe')](_0x36840f[_0xc46c('0x5')][_0xc46c('0xf')]('/')[0x1])[_0xc46c('0x10')](function(_0x2e49a9){if(_0x2e49a9){_0x36840f[_0xc46c('0x8')]=_0x2e49a9[_0xc46c('0x11')];_0x36840f[_0xc46c('0xb')]=_0x2e49a9[_0xc46c('0xb')];utils[_0xc46c('0xc')](_0xc46c('0xd'),_0x36840f);}});}})[_0xc46c('0x12')](function(_0x2c9766){utils['error'](util[_0xc46c('0x4')](_0xc46c('0x13'),_0x36840f[_0xc46c('0x14')]),_0x2c9766);});}delete members[_0x36840f['interface']];}function startsWith(_0x50190d,_0x26e968){return _[_0xc46c('0x15')](_0x50190d,function(_0x9d913a){return _[_0xc46c('0x16')](_0x26e968,_0x9d913a);});}exports[_0xc46c('0x17')]=function(_0x2df1c4){try{utils['debug'](util[_0xc46c('0x4')](_0xc46c('0x18'),members[_0x2df1c4[_0xc46c('0x19')]]?members[_0x2df1c4[_0xc46c('0x19')]][_0xc46c('0x14')]:_0x2df1c4[_0xc46c('0x19')]),_0x2df1c4);utils[_0xc46c('0x3')](util['format'](_0xc46c('0x1a'),members[_0x2df1c4[_0xc46c('0x19')]]?members[_0x2df1c4['device']][_0xc46c('0x14')]:_0x2df1c4['device'],_0x2df1c4[_0xc46c('0x1b')],_0x2df1c4['device']));switch(_0x2df1c4['state']){case'INUSE':case _0xc46c('0x1c'):if(!startsWith(exclude,_0x2df1c4[_0xc46c('0x19')])){members[_0x2df1c4[_0xc46c('0x19')]]={'channel':_0xc46c('0x1d'),'interface':_0x2df1c4['device'],'type':'TALKING','enterAt':utils[_0xc46c('0x1e')](),'role':_0xc46c('0x1f')};}break;case'NOT_INUSE':if(!_[_0xc46c('0x20')](members[_0x2df1c4['device']])){members[_0x2df1c4['device']][_0xc46c('0x21')]=utils[_0xc46c('0x1e')]();members[_0x2df1c4[_0xc46c('0x19')]]['duration']=utils[_0xc46c('0x22')](members[_0x2df1c4[_0xc46c('0x19')]][_0xc46c('0x21')],members[_0x2df1c4[_0xc46c('0x19')]][_0xc46c('0x23')]);if(members[_0x2df1c4[_0xc46c('0x19')]][_0xc46c('0x14')]){writeDB(members[_0x2df1c4[_0xc46c('0x19')]]);}}break;default:break;}}catch(_0x379a8e){utils[_0xc46c('0x24')](util['format'](_0xc46c('0x18'),members[_0x2df1c4['device']]?members[_0x2df1c4[_0xc46c('0x19')]][_0xc46c('0x14')]:_0x2df1c4[_0xc46c('0x19')]),_0x379a8e);}};exports[_0xc46c('0x25')]=function(_0x539e1c){try{if(!_[_0xc46c('0x20')](members[_0x539e1c[_0xc46c('0x5')]])){utils[_0xc46c('0x26')](util[_0xc46c('0x4')]('[%s][members][agentcomplete]',_0x539e1c[_0xc46c('0x14')]),_0x539e1c);utils[_0xc46c('0x3')](util['format'](_0xc46c('0x27'),_0x539e1c[_0xc46c('0x14')],_0x539e1c[_0xc46c('0x5')],_0x539e1c['queue']));members[_0x539e1c[_0xc46c('0x5')]]=_[_0xc46c('0x28')](members[_0x539e1c[_0xc46c('0x5')]],{'data4':_0x539e1c[_0xc46c('0x29')],'uniqueid':_0x539e1c[_0xc46c('0x14')]});}}catch(_0x499856){utils[_0xc46c('0x24')](util['format'](_0xc46c('0x2a'),_0x539e1c[_0xc46c('0x14')]),_0x499856);}};exports[_0xc46c('0x2b')]=function(_0x4cdfa7){try{utils[_0xc46c('0x26')](util[_0xc46c('0x4')](_0xc46c('0x2c'),_0x4cdfa7[_0xc46c('0x14')]),_0x4cdfa7);if(_0x4cdfa7[_0xc46c('0x6')]){var _0x24e107=_0x4cdfa7[_0xc46c('0x6')][_0xc46c('0xf')]('-')[0x0];if(!_[_0xc46c('0x20')](members[_0x24e107])){members[_0x24e107]=_[_0xc46c('0x28')](members[_0x24e107],{'data1':members[_0x24e107][_0xc46c('0x2d')]||_0x4cdfa7[_0xc46c('0x9')],'data2':members[_0x24e107][_0xc46c('0x7')]||_0x4cdfa7['source'],'data3':members[_0x24e107]['data3']||_0x4cdfa7['destination'],'uniqueid':members[_0x24e107]['uniqueid']||_0x4cdfa7[_0xc46c('0x14')]});utils[_0xc46c('0x3')](util[_0xc46c('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4cdfa7[_0xc46c('0x14')],members[_0x24e107][_0xc46c('0x2d')],members[_0x24e107][_0xc46c('0x7')],members[_0x24e107][_0xc46c('0x2e')]));if(members[_0x24e107][_0xc46c('0x21')]){writeDB(members[_0x24e107]);}}}if(_0x4cdfa7['destinationchannel']){var _0x4348ab=_0x4cdfa7[_0xc46c('0x2f')]['split']('-')[0x0];if(!_[_0xc46c('0x20')](members[_0x4348ab])){members[_0x4348ab]=_[_0xc46c('0x28')](members[_0x4348ab],{'data1':members[_0x4348ab][_0xc46c('0x2d')]||_0x4cdfa7[_0xc46c('0x9')],'data2':members[_0x4348ab]['data2']||_0x4cdfa7['source'],'data3':members[_0x4348ab]['data3']||_0x4cdfa7[_0xc46c('0x30')],'uniqueid':members[_0x4348ab][_0xc46c('0x14')]||_0x4cdfa7[_0xc46c('0x14')]});utils[_0xc46c('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4cdfa7[_0xc46c('0x14')],members[_0x4348ab][_0xc46c('0x2d')],members[_0x4348ab][_0xc46c('0x7')],members[_0x4348ab][_0xc46c('0x2e')]));if(members[_0x4348ab][_0xc46c('0x21')]){writeDB(members[_0x4348ab]);}}}}catch(_0x1afa3a){utils[_0xc46c('0x24')](util[_0xc46c('0x4')](_0xc46c('0x2c'),_0x4cdfa7['uniqueid']),_0x1afa3a);}}; \ No newline at end of file +var _0x6a1d=['agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','data2','source','data3','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Queue:','info','format','uniqueid','interface','channel','membername','type','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','[%s][members][writeDB]','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now'];(function(_0x36982d,_0x1edb6a){var _0x32c21b=function(_0x3d4a17){while(--_0x3d4a17){_0x36982d['push'](_0x36982d['shift']());}};_0x32c21b(++_0x1edb6a);}(_0x6a1d,0xe1));var _0xd6a1=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x6a1d[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xd6a1('0x0'));var util=require(_0xd6a1('0x1'));var utils=require(_0xd6a1('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xd6a1('0x3')];function writeDB(_0x132122){utils[_0xd6a1('0x4')](util[_0xd6a1('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x132122[_0xd6a1('0x6')],_0x132122[_0xd6a1('0x7')],_0x132122[_0xd6a1('0x8')],_0x132122['data2'],_0x132122[_0xd6a1('0x9')],_0x132122[_0xd6a1('0xa')]));if(_0x132122[_0xd6a1('0x7')]){utils['getUserByInterface'](_0x132122[_0xd6a1('0x7')])[_0xd6a1('0xb')](function(_0x5f3469){if(_0x5f3469){_0x132122[_0xd6a1('0x9')]=_0x5f3469[_0xd6a1('0xc')];_0x132122[_0xd6a1('0xd')]=_0x5f3469[_0xd6a1('0xd')];utils[_0xd6a1('0xe')]('CreateMemberReport',_0x132122);}else{utils[_0xd6a1('0xf')](_0x132122['interface'][_0xd6a1('0x10')]('/')[0x1])[_0xd6a1('0xb')](function(_0x4dae43){if(_0x4dae43){_0x132122[_0xd6a1('0x9')]=_0x4dae43[_0xd6a1('0xc')];_0x132122[_0xd6a1('0xd')]=_0x4dae43['internal'];utils[_0xd6a1('0xe')](_0xd6a1('0x11'),_0x132122);}});}})[_0xd6a1('0x12')](function(_0x17f944){utils['error'](util[_0xd6a1('0x5')](_0xd6a1('0x13'),_0x132122['uniqueid']),_0x17f944);});}delete members[_0x132122['interface']];}function startsWith(_0x2f7fac,_0x53c86c){return _['some'](_0x2f7fac,function(_0x2f3e8c){return _[_0xd6a1('0x14')](_0x53c86c,_0x2f3e8c);});}exports['devicestatechange']=function(_0x459f44){try{utils[_0xd6a1('0x15')](util[_0xd6a1('0x5')](_0xd6a1('0x16'),members[_0x459f44['device']]?members[_0x459f44[_0xd6a1('0x17')]][_0xd6a1('0x6')]:_0x459f44[_0xd6a1('0x17')]),_0x459f44);utils['info'](util[_0xd6a1('0x5')](_0xd6a1('0x18'),members[_0x459f44['device']]?members[_0x459f44[_0xd6a1('0x17')]][_0xd6a1('0x6')]:_0x459f44[_0xd6a1('0x17')],_0x459f44[_0xd6a1('0x19')],_0x459f44['device']));switch(_0x459f44[_0xd6a1('0x19')]){case _0xd6a1('0x1a'):case _0xd6a1('0x1b'):if(!startsWith(exclude,_0x459f44[_0xd6a1('0x17')])){members[_0x459f44[_0xd6a1('0x17')]]={'channel':_0xd6a1('0x1c'),'interface':_0x459f44[_0xd6a1('0x17')],'type':'TALKING','enterAt':utils[_0xd6a1('0x1d')](),'role':_0xd6a1('0x1e')};}break;case _0xd6a1('0x1f'):if(!_[_0xd6a1('0x20')](members[_0x459f44[_0xd6a1('0x17')]])){members[_0x459f44['device']][_0xd6a1('0x21')]=utils['now']();members[_0x459f44['device']]['duration']=utils[_0xd6a1('0x22')](members[_0x459f44['device']][_0xd6a1('0x21')],members[_0x459f44[_0xd6a1('0x17')]][_0xd6a1('0x23')]);if(members[_0x459f44[_0xd6a1('0x17')]][_0xd6a1('0x6')]){writeDB(members[_0x459f44[_0xd6a1('0x17')]]);}}break;default:break;}}catch(_0x17b165){utils[_0xd6a1('0x24')](util[_0xd6a1('0x5')]('[%s][members][devicestatechange]',members[_0x459f44[_0xd6a1('0x17')]]?members[_0x459f44['device']][_0xd6a1('0x6')]:_0x459f44['device']),_0x17b165);}};exports[_0xd6a1('0x25')]=function(_0xaafa1c){try{if(!_['isNil'](members[_0xaafa1c[_0xd6a1('0x7')]])){utils[_0xd6a1('0x15')](util[_0xd6a1('0x5')]('[%s][members][agentcomplete]',_0xaafa1c[_0xd6a1('0x6')]),_0xaafa1c);utils['info'](util[_0xd6a1('0x5')](_0xd6a1('0x26'),_0xaafa1c['uniqueid'],_0xaafa1c[_0xd6a1('0x7')],_0xaafa1c['queue']));members[_0xaafa1c[_0xd6a1('0x7')]]=_[_0xd6a1('0x27')](members[_0xaafa1c['interface']],{'data4':_0xaafa1c[_0xd6a1('0x28')],'uniqueid':_0xaafa1c[_0xd6a1('0x6')]});}}catch(_0xe862a5){utils[_0xd6a1('0x24')](util[_0xd6a1('0x5')](_0xd6a1('0x29'),_0xaafa1c[_0xd6a1('0x6')]),_0xe862a5);}};exports[_0xd6a1('0x2a')]=function(_0x3cb2a1){try{utils[_0xd6a1('0x15')](util['format'](_0xd6a1('0x2b'),_0x3cb2a1[_0xd6a1('0x6')]),_0x3cb2a1);if(_0x3cb2a1[_0xd6a1('0x8')]){var _0x52afcd=_0x3cb2a1[_0xd6a1('0x8')]['split']('-')[0x0];if(!_[_0xd6a1('0x20')](members[_0x52afcd])){members[_0x52afcd]=_[_0xd6a1('0x27')](members[_0x52afcd],{'data1':members[_0x52afcd][_0xd6a1('0x2c')]||_0x3cb2a1['type'],'data2':members[_0x52afcd][_0xd6a1('0x2d')]||_0x3cb2a1[_0xd6a1('0x2e')],'data3':members[_0x52afcd][_0xd6a1('0x2f')]||_0x3cb2a1['destination'],'uniqueid':members[_0x52afcd][_0xd6a1('0x6')]||_0x3cb2a1['uniqueid']});utils['info'](util[_0xd6a1('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3cb2a1[_0xd6a1('0x6')],members[_0x52afcd][_0xd6a1('0x2c')],members[_0x52afcd][_0xd6a1('0x2d')],members[_0x52afcd][_0xd6a1('0x2f')]));if(members[_0x52afcd][_0xd6a1('0x21')]){writeDB(members[_0x52afcd]);}}}if(_0x3cb2a1[_0xd6a1('0x30')]){var _0x4dc275=_0x3cb2a1[_0xd6a1('0x30')]['split']('-')[0x0];if(!_[_0xd6a1('0x20')](members[_0x4dc275])){members[_0x4dc275]=_[_0xd6a1('0x27')](members[_0x4dc275],{'data1':members[_0x4dc275][_0xd6a1('0x2c')]||_0x3cb2a1[_0xd6a1('0xa')],'data2':members[_0x4dc275]['data2']||_0x3cb2a1['source'],'data3':members[_0x4dc275]['data3']||_0x3cb2a1[_0xd6a1('0x31')],'uniqueid':members[_0x4dc275][_0xd6a1('0x6')]||_0x3cb2a1[_0xd6a1('0x6')]});utils[_0xd6a1('0x4')](util[_0xd6a1('0x5')](_0xd6a1('0x32'),_0x3cb2a1['uniqueid'],members[_0x4dc275][_0xd6a1('0x2c')],members[_0x4dc275]['data2'],members[_0x4dc275][_0xd6a1('0x2f')]));if(members[_0x4dc275]['exitAt']){writeDB(members[_0x4dc275]);}}}}catch(_0x267600){utils['error'](util['format'](_0xd6a1('0x2b'),_0x3cb2a1[_0xd6a1('0x6')]),_0x267600);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 49b27e5..182b30e 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 _0xd41a=['transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerexit','queuecallerexitAt','[%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]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER'];(function(_0x46e847,_0xb167c3){var _0x2030ff=function(_0x2479af){while(--_0x2479af){_0x46e847['push'](_0x46e847['shift']());}};_0x2030ff(++_0xb167c3);}(_0xd41a,0x152));var _0xad41=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0xd41a[_0x2f6541];return _0x4d76d8;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xad41('0x0'));var queues={};function writeDB(_0x46e801){utils['info'](util[_0xad41('0x1')](_0xad41('0x2'),_0x46e801[_0xad41('0x3')],_0x46e801[_0xad41('0x4')],_0x46e801[_0xad41('0x5')],_0x46e801[_0xad41('0x6')],_0x46e801[_0xad41('0x7')],_0x46e801[_0xad41('0x8')],_0x46e801[_0xad41('0x9')]));if(_0x46e801[_0xad41('0x5')]){utils[_0xad41('0xa')](_0x46e801[_0xad41('0x5')])[_0xad41('0xb')](function(_0xb62fc5){if(_0xb62fc5){_0x46e801[_0xad41('0xc')]=_0xb62fc5[_0xad41('0xc')];}utils[_0xad41('0xd')]('CreateVoiceQueueReport',_0x46e801);});}else{utils[_0xad41('0xd')](_0xad41('0xe'),_0x46e801);}if(_0x46e801['transfereduniqueid']){delete queues[_0x46e801['transfereduniqueid']];}else{delete queues[_0x46e801[_0xad41('0x3')]];}}exports[_0xad41('0xf')]=function(_0xcc5fcc){try{utils[_0xad41('0x10')](util[_0xad41('0x1')](_0xad41('0x11'),_0xcc5fcc[_0xad41('0x3')]),_0xcc5fcc);utils[_0xad41('0x12')](util[_0xad41('0x1')](_0xad41('0x13'),_0xcc5fcc[_0xad41('0x3')],_0xcc5fcc[_0xad41('0x5')],_0xcc5fcc[_0xad41('0x14')]));queues[_0xcc5fcc[_0xad41('0x3')]]=_[_0xad41('0x15')](_0xcc5fcc,{'originalposition':_0xcc5fcc[_0xad41('0x14')],'queuecallerjoinAt':utils[_0xad41('0x16')](),'mohtime':0x0});}catch(_0x5bfbe3){utils[_0xad41('0x17')](util[_0xad41('0x1')](_0xad41('0x11'),_0xcc5fcc[_0xad41('0x3')]),_0x5bfbe3);}};exports['hangup']=function(_0x15bcca){try{if(!_[_0xad41('0x18')](queues[_0x15bcca['uniqueid']])){utils['debug'](util[_0xad41('0x1')](_0xad41('0x19'),_0x15bcca[_0xad41('0x3')]),_0x15bcca);if(queues[_0x15bcca[_0xad41('0x3')]][_0xad41('0x1a')]){if(!queues[_0x15bcca[_0xad41('0x3')]][_0xad41('0x1b')]&&!queues[_0x15bcca[_0xad41('0x3')]]['queuecallerexit']){queues[_0x15bcca[_0xad41('0x3')]]['queuecallercomplete']=!![];queues[_0x15bcca['uniqueid']][_0xad41('0x1c')]=utils[_0xad41('0x16')]();queues[_0x15bcca[_0xad41('0x3')]][_0xad41('0x9')]=_0xad41('0x1d');}utils['info'](util['format'](_0xad41('0x1e'),_0x15bcca[_0xad41('0x3')],queues[_0x15bcca[_0xad41('0x3')]]['name'],queues[_0x15bcca['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x15bcca[_0xad41('0x3')]]);}else if(queues[_0x15bcca[_0xad41('0x3')]]['transfereduniqueid']){utils[_0xad41('0x12')](util[_0xad41('0x1')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x15bcca[_0xad41('0x3')],queues[_0x15bcca[_0xad41('0x3')]][_0xad41('0x1f')],queues[_0x15bcca['uniqueid']]['transfereduniqueid']));queues[queues[_0x15bcca[_0xad41('0x3')]][_0xad41('0x20')]]=queues[_0x15bcca[_0xad41('0x3')]];queues[queues[_0x15bcca[_0xad41('0x3')]][_0xad41('0x20')]][_0xad41('0x21')]=0x2;delete queues[_0x15bcca[_0xad41('0x3')]];}}}catch(_0x7581b2){utils[_0xad41('0x17')](util[_0xad41('0x1')](_0xad41('0x19'),_0x15bcca[_0xad41('0x3')]),_0x7581b2);}};exports[_0xad41('0x22')]=function(_0xf639c7){try{utils[_0xad41('0x10')](util[_0xad41('0x1')](_0xad41('0x23'),_0xf639c7[_0xad41('0x3')]),_0xf639c7);if(!_[_0xad41('0x18')](_0xf639c7['variable'][_0xad41('0x24')])&&_0xf639c7[_0xad41('0x25')][_0xad41('0x26')]()!==_0xad41('0x27')){if(!_['isNil'](queues[_0xf639c7[_0xad41('0x3')]])){queues[_0xf639c7[_0xad41('0x3')]]['queuecallerabandon']=![];queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x28')]=null;queues[_0xf639c7[_0xad41('0x3')]]['queuecallerexit']=!![];queues[_0xf639c7[_0xad41('0x3')]]['queuecallerexitAt']=utils[_0xad41('0x16')]();queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x9')]=_0xf639c7[_0xad41('0x25')][_0xad41('0x26')]();utils[_0xad41('0x12')](util[_0xad41('0x1')](_0xad41('0x29'),_0xf639c7[_0xad41('0x3')],queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x1f')],_0xf639c7[_0xad41('0x25')],queues[_0xf639c7[_0xad41('0x3')]]['queuecallerexitreason']));writeDB(queues[_0xf639c7['uniqueid']]);}}else if(!_[_0xad41('0x18')](_0xf639c7[_0xad41('0x2a')][_0xad41('0x2b')])){if(!_['isNil'](queues[_0xf639c7[_0xad41('0x3')]])&&!queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x1b')]){queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x1b')]=![];queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x28')]=null;queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x2c')]=!![];queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x2d')]=utils[_0xad41('0x16')]();queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x9')]='EXITWITHKEY';utils[_0xad41('0x12')](util['format'](_0xad41('0x2e'),_0xf639c7[_0xad41('0x3')],queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x1f')],_0xf639c7[_0xad41('0x25')],queues[_0xf639c7[_0xad41('0x3')]][_0xad41('0x9')]));}}}catch(_0xd2b0c2){utils[_0xad41('0x17')](util[_0xad41('0x1')]('[%s][queues][varset]',_0xf639c7[_0xad41('0x3')]),_0xd2b0c2);}};exports[_0xad41('0x1b')]=function(_0x4b6ea7){try{if(!_['isNil'](queues[_0x4b6ea7[_0xad41('0x3')]])){utils[_0xad41('0x10')](util['format'](_0xad41('0x2f'),_0x4b6ea7[_0xad41('0x3')]),_0x4b6ea7);queues[_0x4b6ea7[_0xad41('0x3')]][_0xad41('0x2c')]=![];queues[_0x4b6ea7['uniqueid']][_0xad41('0x2d')]=null;queues[_0x4b6ea7[_0xad41('0x3')]][_0xad41('0x1b')]=!![];queues[_0x4b6ea7[_0xad41('0x3')]]['queuecallerabandonAt']=utils[_0xad41('0x16')]();queues[_0x4b6ea7['uniqueid']][_0xad41('0x9')]=_0xad41('0x30');utils[_0xad41('0x12')](util[_0xad41('0x1')](_0xad41('0x31'),_0x4b6ea7[_0xad41('0x3')],queues[_0x4b6ea7[_0xad41('0x3')]][_0xad41('0x1f')],queues[_0x4b6ea7[_0xad41('0x3')]][_0xad41('0x9')]));}}catch(_0x1be8d2){utils[_0xad41('0x17')](util[_0xad41('0x1')](_0xad41('0x2f'),_0x4b6ea7[_0xad41('0x3')]),_0x1be8d2);}};exports[_0xad41('0x32')]=function(_0x4b535d){try{if(!_['isNil'](queues[_0x4b535d[_0xad41('0x3')]])){utils[_0xad41('0x10')](util[_0xad41('0x1')]('[%s][queues][queuecallerleave]',_0x4b535d[_0xad41('0x3')]),_0x4b535d);utils[_0xad41('0x12')](util[_0xad41('0x1')](_0xad41('0x33'),_0x4b535d[_0xad41('0x3')],queues[_0x4b535d[_0xad41('0x3')]][_0xad41('0x1f')],_0x4b535d[_0xad41('0x34')],_0x4b535d[_0xad41('0x35')]));queues[_0x4b535d[_0xad41('0x3')]][_0xad41('0x32')]=!![];queues[_0x4b535d[_0xad41('0x3')]]['queuecallerleaveAt']=utils[_0xad41('0x16')]();queues[_0x4b535d['uniqueid']]['holdtime']=utils['diffTime'](queues[_0x4b535d[_0xad41('0x3')]][_0xad41('0x1a')],queues[_0x4b535d[_0xad41('0x3')]][_0xad41('0x36')]);queues[_0x4b535d[_0xad41('0x3')]][_0xad41('0x14')]=_0x4b535d[_0xad41('0x14')];queues[_0x4b535d[_0xad41('0x3')]][_0xad41('0x37')]=_0x4b535d['count'];queues[_0x4b535d[_0xad41('0x3')]]['connectedlinenum']=_0x4b535d['connectedlinenum'];queues[_0x4b535d[_0xad41('0x3')]][_0xad41('0x35')]=_0x4b535d['connectedlinename'];}}catch(_0xdfd043){utils[_0xad41('0x17')](util[_0xad41('0x1')](_0xad41('0x38'),_0x4b535d['uniqueid']),_0xdfd043);}};exports[_0xad41('0x39')]=function(_0x12b061){try{if(!_[_0xad41('0x18')](queues[_0x12b061['uniqueid']])){utils[_0xad41('0x10')](util[_0xad41('0x1')]('[%s][queues][agentconnect]',_0x12b061[_0xad41('0x3')]),_0x12b061);utils[_0xad41('0x12')](util['format'](_0xad41('0x3a'),_0x12b061[_0xad41('0x3')],queues[_0x12b061[_0xad41('0x3')]][_0xad41('0x1f')],_0x12b061[_0xad41('0x3b')],_0x12b061[_0xad41('0x3c')]));queues[_0x12b061[_0xad41('0x3')]][_0xad41('0x1b')]=![];queues[_0x12b061[_0xad41('0x3')]][_0xad41('0x1b')]=![];queues[_0x12b061[_0xad41('0x3')]][_0xad41('0x28')]=null;queues[_0x12b061[_0xad41('0x3')]][_0xad41('0x2c')]=![];queues[_0x12b061[_0xad41('0x3')]][_0xad41('0x9')]=null;queues[_0x12b061[_0xad41('0x3')]][_0xad41('0x2d')]=null;queues[_0x12b061['uniqueid']][_0xad41('0x3d')]=!![];queues[_0x12b061[_0xad41('0x3')]][_0xad41('0x8')]=_0x12b061[_0xad41('0x3c')];queues[_0x12b061[_0xad41('0x3')]][_0xad41('0x6')]=_0x12b061['membername'];}}catch(_0x2bf56e){utils[_0xad41('0x17')](util['format'](_0xad41('0x3e'),_0x12b061[_0xad41('0x3')]),_0x2bf56e);}};exports[_0xad41('0x3f')]=function(_0x445609){try{if(!_['isNil'](queues[_0x445609['uniqueid']])){if(queues[_0x445609[_0xad41('0x3')]][_0xad41('0x1a')]){utils[_0xad41('0x10')](util[_0xad41('0x1')]('[%s][queues][agentcomplete]',_0x445609[_0xad41('0x3')]),_0x445609);queues[_0x445609[_0xad41('0x3')]][_0xad41('0x1b')]=![];queues[_0x445609['uniqueid']][_0xad41('0x1b')]=![];queues[_0x445609[_0xad41('0x3')]][_0xad41('0x28')]=null;queues[_0x445609[_0xad41('0x3')]]['queuecallerexit']=![];queues[_0x445609[_0xad41('0x3')]][_0xad41('0x2d')]=null;queues[_0x445609[_0xad41('0x3')]][_0xad41('0x3d')]=!![];queues[_0x445609[_0xad41('0x3')]][_0xad41('0x6')]=_0x445609['membername'];queues[_0x445609['uniqueid']][_0xad41('0x40')]=!![];queues[_0x445609[_0xad41('0x3')]][_0xad41('0x1c')]=utils[_0xad41('0x16')]();if(_0x445609[_0xad41('0x41')]==_0xad41('0x42')){if(!queues[_0x445609[_0xad41('0x3')]][_0xad41('0x42')]){queues[_0x445609[_0xad41('0x3')]][_0xad41('0x9')]=_0xad41('0x43');}}else{queues[_0x445609[_0xad41('0x3')]][_0xad41('0x9')]='COMPLETEDBY'+_0x445609[_0xad41('0x41')]['toUpperCase']();}utils[_0xad41('0x12')](util[_0xad41('0x1')](_0xad41('0x44'),_0x445609[_0xad41('0x3')],queues[_0x445609[_0xad41('0x3')]][_0xad41('0x1f')],_0x445609[_0xad41('0x3b')],queues[_0x445609[_0xad41('0x3')]][_0xad41('0x9')]));writeDB(queues[_0x445609[_0xad41('0x3')]]);}}}catch(_0x7abcf1){utils[_0xad41('0x17')](util[_0xad41('0x1')](_0xad41('0x45'),_0x445609[_0xad41('0x3')]),_0x7abcf1);}};exports['blindtransfer']=function(_0x4cb5f8){try{if(!_[_0xad41('0x18')](queues[_0x4cb5f8[_0xad41('0x46')]])){utils[_0xad41('0x10')](util[_0xad41('0x1')](_0xad41('0x47'),_0x4cb5f8['uniqueid']),_0x4cb5f8);queues[_0x4cb5f8[_0xad41('0x46')]]['transfer']=!![];queues[_0x4cb5f8[_0xad41('0x46')]][_0xad41('0x48')]='BLIND';queues[_0x4cb5f8['transfereeuniqueid']]['transferexten']=_0x4cb5f8[_0xad41('0x49')];queues[_0x4cb5f8[_0xad41('0x46')]][_0xad41('0x4a')]=_0x4cb5f8[_0xad41('0x46')];queues[_0x4cb5f8['transfereeuniqueid']][_0xad41('0x9')]=_0xad41('0x4b');utils[_0xad41('0x12')](util[_0xad41('0x1')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x4cb5f8[_0xad41('0x3')],queues[_0x4cb5f8['transfereeuniqueid']]['name'],_0x4cb5f8[_0xad41('0x46')],_0x4cb5f8['extension']));}}catch(_0x8c8dc1){utils[_0xad41('0x17')](util['format']('[%s][queues][blindtransfer]',_0x4cb5f8[_0xad41('0x3')]),_0x8c8dc1);}};exports[_0xad41('0x4c')]=function(_0x31f655){try{utils[_0xad41('0x10')](util[_0xad41('0x1')](_0xad41('0x4d'),_0x31f655[_0xad41('0x4e')]),_0x31f655);if(_0x31f655[_0xad41('0x4e')]==_0x31f655[_0xad41('0x4f')]){if(!_[_0xad41('0x18')](queues[_0x31f655[_0xad41('0x50')]])){utils[_0xad41('0x12')](util[_0xad41('0x1')](_0xad41('0x51'),_0x31f655['origtransfereruniqueid'],queues[_0x31f655[_0xad41('0x50')]][_0xad41('0x1f')],_0x31f655['origtransfererexten']));queues[_0x31f655[_0xad41('0x50')]][_0xad41('0x42')]=!![];queues[_0x31f655[_0xad41('0x50')]]['transfertype']=_0xad41('0x52');queues[_0x31f655['secondtransfererlinkedid']][_0xad41('0x53')]=_0x31f655[_0xad41('0x54')];queues[_0x31f655[_0xad41('0x50')]][_0xad41('0x4a')]=_0x31f655[_0xad41('0x4e')];queues[_0x31f655['secondtransfererlinkedid']][_0xad41('0x9')]=_0xad41('0x55');}if(!_[_0xad41('0x18')](queues[_0x31f655['origtransfererlinkedid']])){if(_0x31f655[_0xad41('0x56')]&&queues[_0x31f655['transfereelinkedid']]){queues[_0x31f655[_0xad41('0x56')]][_0xad41('0x21')]=0x1;queues[_0x31f655[_0xad41('0x46')]]=_[_0xad41('0x57')](queues[_0x31f655[_0xad41('0x56')]]);queues[_0x31f655[_0xad41('0x46')]][_0xad41('0x20')]=_0x31f655[_0xad41('0x58')];queues[_0x31f655[_0xad41('0x46')]][_0xad41('0x21')]=0x2;queues[_0x31f655['transfereeuniqueid']][_0xad41('0x7')]=queues[_0x31f655[_0xad41('0x50')]][_0xad41('0x7')];queues[_0x31f655[_0xad41('0x46')]][_0xad41('0x59')]=queues[_0x31f655[_0xad41('0x50')]][_0xad41('0x59')];queues[_0x31f655[_0xad41('0x46')]][_0xad41('0x36')]=utils['now']();queues[_0x31f655[_0xad41('0x46')]][_0xad41('0x1a')]=utils[_0xad41('0x16')]();queues[_0x31f655[_0xad41('0x46')]][_0xad41('0x5a')]=0x0;queues[_0x31f655[_0xad41('0x46')]][_0xad41('0x5b')]=0x0;utils['info'](util[_0xad41('0x1')](_0xad41('0x5c'),_0x31f655[_0xad41('0x4e')],queues[_0x31f655['transfereeuniqueid']]['name'],queues[_0x31f655['transfereeuniqueid']][_0xad41('0x7')],queues[_0x31f655[_0xad41('0x46')]][_0xad41('0x59')]));}else{utils[_0xad41('0x12')](util[_0xad41('0x1')](_0xad41('0x5d'),_0x31f655[_0xad41('0x4e')],queues[_0x31f655[_0xad41('0x4f')]][_0xad41('0x1f')],_0x31f655[_0xad41('0x50')]));queues[_0x31f655[_0xad41('0x4f')]]['transfereduniqueid']=_0x31f655[_0xad41('0x50')];}}}else if(_0x31f655['secondtransfereruniqueid']==_0x31f655[_0xad41('0x50')]){if(!_[_0xad41('0x18')](queues[_0x31f655[_0xad41('0x4f')]])){utils[_0xad41('0x12')](util[_0xad41('0x1')](_0xad41('0x5e'),_0x31f655[_0xad41('0x4e')],queues[_0x31f655[_0xad41('0x4f')]][_0xad41('0x1f')],_0x31f655[_0xad41('0x5f')],_0x31f655[_0xad41('0x60')]));queues[_0x31f655[_0xad41('0x4f')]][_0xad41('0x42')]=!![];queues[_0x31f655['origtransfererlinkedid']][_0xad41('0x48')]=_0xad41('0x52');queues[_0x31f655[_0xad41('0x4f')]][_0xad41('0x53')]=_0x31f655[_0xad41('0x60')];queues[_0x31f655['origtransfererlinkedid']][_0xad41('0x4a')]=_0x31f655['secondtransfereruniqueid'];queues[_0x31f655['origtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xad41('0x18')](queues[_0x31f655[_0xad41('0x50')]])){if(_0x31f655[_0xad41('0x61')]&&queues[_0x31f655[_0xad41('0x61')]]){queues[_0x31f655[_0xad41('0x61')]][_0xad41('0x21')]=0x1;queues[_0x31f655[_0xad41('0x58')]]=_[_0xad41('0x57')](queues[_0x31f655[_0xad41('0x61')]]);queues[_0x31f655['transfertargetuniqueid']][_0xad41('0x20')]=_0x31f655[_0xad41('0x58')];queues[_0x31f655[_0xad41('0x58')]][_0xad41('0x21')]=0x2;queues[_0x31f655['transfertargetuniqueid']]['calleridnum']=queues[_0x31f655[_0xad41('0x4f')]][_0xad41('0x7')];queues[_0x31f655['transfertargetuniqueid']][_0xad41('0x59')]=queues[_0x31f655[_0xad41('0x4f')]][_0xad41('0x59')];queues[_0x31f655[_0xad41('0x58')]]['queuecallerjoinAt']=utils[_0xad41('0x16')]();queues[_0x31f655[_0xad41('0x58')]][_0xad41('0x1a')]=utils[_0xad41('0x16')]();queues[_0x31f655[_0xad41('0x58')]][_0xad41('0x5a')]=0x0;queues[_0x31f655[_0xad41('0x58')]][_0xad41('0x5b')]=0x0;utils[_0xad41('0x12')](util['format'](_0xad41('0x62'),_0x31f655['origtransfereruniqueid'],queues[_0x31f655[_0xad41('0x58')]]['name'],queues[_0x31f655[_0xad41('0x58')]]['transfereduniqueid'],queues[_0x31f655[_0xad41('0x58')]][_0xad41('0x7')],queues[_0x31f655[_0xad41('0x58')]][_0xad41('0x59')]));}else{utils[_0xad41('0x12')](util['format'](_0xad41('0x5d'),_0x31f655['origtransfereruniqueid'],queues[_0x31f655[_0xad41('0x50')]][_0xad41('0x1f')],_0x31f655[_0xad41('0x4f')]));queues[_0x31f655['secondtransfererlinkedid']][_0xad41('0x20')]=_0x31f655[_0xad41('0x4f')];}}}}catch(_0x3c4ed9){utils[_0xad41('0x17')](util[_0xad41('0x1')](_0xad41('0x4d'),_0x31f655[_0xad41('0x4e')]),_0x3c4ed9);}};exports[_0xad41('0x63')]=function(_0x1e1469){try{if(!_[_0xad41('0x18')](queues[_0x1e1469['uniqueid']])){utils[_0xad41('0x10')](util[_0xad41('0x1')](_0xad41('0x64'),_0x1e1469[_0xad41('0x3')]),_0x1e1469);queues[_0x1e1469[_0xad41('0x3')]][_0xad41('0x65')]=utils['now']();utils[_0xad41('0x12')](util[_0xad41('0x1')](_0xad41('0x66'),_0x1e1469['uniqueid'],queues[_0x1e1469[_0xad41('0x3')]][_0xad41('0x1f')],queues[_0x1e1469[_0xad41('0x3')]][_0xad41('0x65')]));}}catch(_0x1796c0){utils[_0xad41('0x17')](util[_0xad41('0x1')](_0xad41('0x64'),_0x1e1469[_0xad41('0x3')]),_0x1796c0);}};exports['musiconholdstop']=function(_0x2e385f){try{if(!_['isNil'](queues[_0x2e385f['uniqueid']])){if(!_[_0xad41('0x18')](queues[_0x2e385f['uniqueid']][_0xad41('0x65')])){utils[_0xad41('0x10')](util[_0xad41('0x1')]('[%s][queues][musiconholdstop]',_0x2e385f[_0xad41('0x3')]),_0x2e385f);queues[_0x2e385f['uniqueid']][_0xad41('0x5b')]+=utils[_0xad41('0x67')](utils['now'](),queues[_0x2e385f[_0xad41('0x3')]][_0xad41('0x65')]);utils[_0xad41('0x12')](util['format'](_0xad41('0x68'),_0x2e385f['uniqueid'],queues[_0x2e385f[_0xad41('0x3')]]['name'],queues[_0x2e385f['uniqueid']][_0xad41('0x5b')]));delete queues[_0x2e385f[_0xad41('0x3')]][_0xad41('0x65')];}}}catch(_0x128656){utils['error'](util[_0xad41('0x1')](_0xad41('0x69'),_0x2e385f[_0xad41('0x3')]),_0x128656);}}; \ No newline at end of file +var _0x49b8=['calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','debug','[%s][queues][varset]','variable','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','assigned','destaccountcode','[%s][queues][agentcomplete]','membername','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfereelinkedid','clone','calleridname','secondtransfereruniqueid','secondtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','queue','lastAssignedTo'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x49b8,0xc5));var _0x849b=function(_0x5176a0,_0x485b58){_0x5176a0=_0x5176a0-0x0;var _0xdf49c8=_0x49b8[_0x5176a0];return _0xdf49c8;};'use strict';var _=require(_0x849b('0x0'));var util=require(_0x849b('0x1'));var utils=require(_0x849b('0x2'));var queues={};function writeDB(_0x598667){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x598667['uniqueid'],_0x598667['channel'],_0x598667[_0x849b('0x3')],_0x598667[_0x849b('0x4')],_0x598667[_0x849b('0x5')],_0x598667[_0x849b('0x6')],_0x598667[_0x849b('0x7')]));if(_0x598667[_0x849b('0x3')]){utils[_0x849b('0x8')](_0x598667[_0x849b('0x3')])[_0x849b('0x9')](function(_0x3a953a){if(_0x3a953a){_0x598667[_0x849b('0xa')]=_0x3a953a['type'];}utils[_0x849b('0xb')](_0x849b('0xc'),_0x598667);});}else{utils['request'](_0x849b('0xc'),_0x598667);}if(_0x598667[_0x849b('0xd')]){delete queues[_0x598667[_0x849b('0xd')]];}else{delete queues[_0x598667[_0x849b('0xe')]];}}exports['queuecallerjoin']=function(_0x4a38af){try{utils['debug'](util[_0x849b('0xf')](_0x849b('0x10'),_0x4a38af['uniqueid']),_0x4a38af);utils['info'](util[_0x849b('0xf')](_0x849b('0x11'),_0x4a38af[_0x849b('0xe')],_0x4a38af[_0x849b('0x3')],_0x4a38af[_0x849b('0x12')]));queues[_0x4a38af[_0x849b('0xe')]]=_[_0x849b('0x13')](_0x4a38af,{'originalposition':_0x4a38af['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4b5d7a){utils[_0x849b('0x14')](util[_0x849b('0xf')](_0x849b('0x10'),_0x4a38af[_0x849b('0xe')]),_0x4b5d7a);}};exports[_0x849b('0x15')]=function(_0x173aca){try{if(!_[_0x849b('0x16')](queues[_0x173aca['uniqueid']])){utils['debug'](util['format'](_0x849b('0x17'),_0x173aca[_0x849b('0xe')]),_0x173aca);if(queues[_0x173aca[_0x849b('0xe')]]['queuecallerleaveAt']){if(!queues[_0x173aca[_0x849b('0xe')]][_0x849b('0x18')]&&!queues[_0x173aca[_0x849b('0xe')]][_0x849b('0x19')]){queues[_0x173aca['uniqueid']]['queuecallercomplete']=!![];queues[_0x173aca[_0x849b('0xe')]][_0x849b('0x1a')]=utils[_0x849b('0x1b')]();queues[_0x173aca[_0x849b('0xe')]]['queuecallerexitreason']=_0x849b('0x1c');}utils[_0x849b('0x1d')](util['format'](_0x849b('0x1e'),_0x173aca[_0x849b('0xe')],queues[_0x173aca['uniqueid']][_0x849b('0x1f')],queues[_0x173aca[_0x849b('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x173aca[_0x849b('0xe')]]);}else if(queues[_0x173aca['uniqueid']][_0x849b('0xd')]){utils[_0x849b('0x1d')](util[_0x849b('0xf')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x173aca[_0x849b('0xe')],queues[_0x173aca[_0x849b('0xe')]][_0x849b('0x1f')],queues[_0x173aca[_0x849b('0xe')]]['transfereduniqueid']));queues[queues[_0x173aca['uniqueid']][_0x849b('0xd')]]=queues[_0x173aca['uniqueid']];queues[queues[_0x173aca[_0x849b('0xe')]]['transfereduniqueid']][_0x849b('0x20')]=0x2;delete queues[_0x173aca['uniqueid']];}}}catch(_0x7946b1){utils['error'](util[_0x849b('0xf')](_0x849b('0x17'),_0x173aca[_0x849b('0xe')]),_0x7946b1);}};exports['varset']=function(_0x23bb72){try{utils[_0x849b('0x21')](util['format'](_0x849b('0x22'),_0x23bb72[_0x849b('0xe')]),_0x23bb72);if(!_[_0x849b('0x16')](_0x23bb72[_0x849b('0x23')][_0x849b('0x24')])&&_0x23bb72['value']['toUpperCase']()!==_0x849b('0x25')){if(!_['isNil'](queues[_0x23bb72[_0x849b('0xe')]])){queues[_0x23bb72['uniqueid']]['queuecallerabandon']=![];queues[_0x23bb72['uniqueid']][_0x849b('0x26')]=null;queues[_0x23bb72[_0x849b('0xe')]][_0x849b('0x19')]=!![];queues[_0x23bb72['uniqueid']][_0x849b('0x27')]=utils['now']();queues[_0x23bb72[_0x849b('0xe')]][_0x849b('0x7')]=_0x23bb72['value']['toUpperCase']();utils[_0x849b('0x1d')](util['format'](_0x849b('0x28'),_0x23bb72['uniqueid'],queues[_0x23bb72[_0x849b('0xe')]][_0x849b('0x1f')],_0x23bb72[_0x849b('0x29')],queues[_0x23bb72[_0x849b('0xe')]][_0x849b('0x7')]));writeDB(queues[_0x23bb72[_0x849b('0xe')]]);}}else if(!_['isNil'](_0x23bb72[_0x849b('0x23')][_0x849b('0x2a')])){if(!_[_0x849b('0x16')](queues[_0x23bb72[_0x849b('0xe')]])&&!queues[_0x23bb72[_0x849b('0xe')]][_0x849b('0x18')]){queues[_0x23bb72[_0x849b('0xe')]][_0x849b('0x18')]=![];queues[_0x23bb72[_0x849b('0xe')]]['queuecallerabandonAt']=null;queues[_0x23bb72['uniqueid']][_0x849b('0x19')]=!![];queues[_0x23bb72[_0x849b('0xe')]][_0x849b('0x27')]=utils[_0x849b('0x1b')]();queues[_0x23bb72[_0x849b('0xe')]][_0x849b('0x7')]=_0x849b('0x2b');utils[_0x849b('0x1d')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x23bb72[_0x849b('0xe')],queues[_0x23bb72[_0x849b('0xe')]][_0x849b('0x1f')],_0x23bb72[_0x849b('0x29')],queues[_0x23bb72['uniqueid']]['queuecallerexitreason']));}}}catch(_0x2791f2){utils[_0x849b('0x14')](util[_0x849b('0xf')](_0x849b('0x22'),_0x23bb72[_0x849b('0xe')]),_0x2791f2);}};exports[_0x849b('0x18')]=function(_0x4f4a0b){try{if(!_[_0x849b('0x16')](queues[_0x4f4a0b['uniqueid']])){utils[_0x849b('0x21')](util[_0x849b('0xf')](_0x849b('0x2c'),_0x4f4a0b['uniqueid']),_0x4f4a0b);queues[_0x4f4a0b[_0x849b('0xe')]]['queuecallerexit']=![];queues[_0x4f4a0b['uniqueid']][_0x849b('0x27')]=null;queues[_0x4f4a0b[_0x849b('0xe')]][_0x849b('0x18')]=!![];queues[_0x4f4a0b['uniqueid']][_0x849b('0x26')]=utils[_0x849b('0x1b')]();queues[_0x4f4a0b[_0x849b('0xe')]][_0x849b('0x7')]=_0x849b('0x2d');utils[_0x849b('0x1d')](util['format'](_0x849b('0x2e'),_0x4f4a0b['uniqueid'],queues[_0x4f4a0b[_0x849b('0xe')]]['name'],queues[_0x4f4a0b[_0x849b('0xe')]][_0x849b('0x7')]));}}catch(_0x16fb73){utils[_0x849b('0x14')](util[_0x849b('0xf')](_0x849b('0x2c'),_0x4f4a0b['uniqueid']),_0x16fb73);}};exports['queuecallerleave']=function(_0x2f3940){try{if(!_[_0x849b('0x16')](queues[_0x2f3940[_0x849b('0xe')]])){utils[_0x849b('0x21')](util[_0x849b('0xf')](_0x849b('0x2f'),_0x2f3940[_0x849b('0xe')]),_0x2f3940);utils[_0x849b('0x1d')](util[_0x849b('0xf')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2f3940[_0x849b('0xe')],queues[_0x2f3940[_0x849b('0xe')]]['name'],_0x2f3940[_0x849b('0x30')],_0x2f3940[_0x849b('0x31')]));queues[_0x2f3940['uniqueid']]['queuecallerleave']=!![];queues[_0x2f3940[_0x849b('0xe')]]['queuecallerleaveAt']=utils[_0x849b('0x1b')]();queues[_0x2f3940['uniqueid']][_0x849b('0x32')]=utils[_0x849b('0x33')](queues[_0x2f3940['uniqueid']][_0x849b('0x34')],queues[_0x2f3940[_0x849b('0xe')]][_0x849b('0x35')]);queues[_0x2f3940[_0x849b('0xe')]][_0x849b('0x12')]=_0x2f3940[_0x849b('0x12')];queues[_0x2f3940[_0x849b('0xe')]][_0x849b('0x36')]=_0x2f3940['count'];queues[_0x2f3940[_0x849b('0xe')]][_0x849b('0x30')]=_0x2f3940['connectedlinenum'];queues[_0x2f3940[_0x849b('0xe')]]['connectedlinename']=_0x2f3940[_0x849b('0x31')];}}catch(_0x1d5f93){utils['error'](util['format'](_0x849b('0x2f'),_0x2f3940[_0x849b('0xe')]),_0x1d5f93);}};exports[_0x849b('0x37')]=function(_0x437166){try{if(!_['isNil'](queues[_0x437166[_0x849b('0xe')]])){utils['debug'](util['format'](_0x849b('0x38'),_0x437166[_0x849b('0xe')]),_0x437166);utils[_0x849b('0x1d')](util[_0x849b('0xf')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x437166[_0x849b('0xe')],queues[_0x437166[_0x849b('0xe')]]['name'],_0x437166['membername'],_0x437166['destaccountcode']));queues[_0x437166[_0x849b('0xe')]]['queuecallerabandon']=![];queues[_0x437166[_0x849b('0xe')]][_0x849b('0x18')]=![];queues[_0x437166[_0x849b('0xe')]]['queuecallerabandonAt']=null;queues[_0x437166['uniqueid']][_0x849b('0x19')]=![];queues[_0x437166[_0x849b('0xe')]][_0x849b('0x7')]=null;queues[_0x437166[_0x849b('0xe')]][_0x849b('0x27')]=null;queues[_0x437166['uniqueid']][_0x849b('0x39')]=!![];queues[_0x437166[_0x849b('0xe')]][_0x849b('0x6')]=_0x437166[_0x849b('0x3a')];queues[_0x437166['uniqueid']][_0x849b('0x4')]=_0x437166['membername'];}}catch(_0x270366){utils['error'](util['format'](_0x849b('0x38'),_0x437166[_0x849b('0xe')]),_0x270366);}};exports['agentcomplete']=function(_0x50ad8a){try{if(!_[_0x849b('0x16')](queues[_0x50ad8a[_0x849b('0xe')]])){if(queues[_0x50ad8a[_0x849b('0xe')]]['queuecallerleaveAt']){utils[_0x849b('0x21')](util[_0x849b('0xf')](_0x849b('0x3b'),_0x50ad8a[_0x849b('0xe')]),_0x50ad8a);queues[_0x50ad8a['uniqueid']][_0x849b('0x18')]=![];queues[_0x50ad8a['uniqueid']]['queuecallerabandon']=![];queues[_0x50ad8a[_0x849b('0xe')]][_0x849b('0x26')]=null;queues[_0x50ad8a['uniqueid']]['queuecallerexit']=![];queues[_0x50ad8a[_0x849b('0xe')]][_0x849b('0x27')]=null;queues[_0x50ad8a[_0x849b('0xe')]]['assigned']=!![];queues[_0x50ad8a['uniqueid']][_0x849b('0x4')]=_0x50ad8a[_0x849b('0x3c')];queues[_0x50ad8a[_0x849b('0xe')]][_0x849b('0x3d')]=!![];queues[_0x50ad8a[_0x849b('0xe')]][_0x849b('0x1a')]=utils[_0x849b('0x1b')]();if(_0x50ad8a[_0x849b('0x3e')]=='transfer'){if(!queues[_0x50ad8a[_0x849b('0xe')]][_0x849b('0x3f')]){queues[_0x50ad8a[_0x849b('0xe')]]['queuecallerexitreason']=_0x849b('0x40');}}else{queues[_0x50ad8a[_0x849b('0xe')]][_0x849b('0x7')]=_0x849b('0x41')+_0x50ad8a['reason'][_0x849b('0x42')]();}utils[_0x849b('0x1d')](util[_0x849b('0xf')](_0x849b('0x43'),_0x50ad8a[_0x849b('0xe')],queues[_0x50ad8a[_0x849b('0xe')]][_0x849b('0x1f')],_0x50ad8a['membername'],queues[_0x50ad8a[_0x849b('0xe')]][_0x849b('0x7')]));writeDB(queues[_0x50ad8a[_0x849b('0xe')]]);}}}catch(_0x38dd4d){utils[_0x849b('0x14')](util['format']('[%s][queues][agentcomplete]',_0x50ad8a[_0x849b('0xe')]),_0x38dd4d);}};exports['blindtransfer']=function(_0x56980e){try{if(!_[_0x849b('0x16')](queues[_0x56980e['transfereeuniqueid']])){utils[_0x849b('0x21')](util[_0x849b('0xf')](_0x849b('0x44'),_0x56980e[_0x849b('0xe')]),_0x56980e);queues[_0x56980e[_0x849b('0x45')]][_0x849b('0x3f')]=!![];queues[_0x56980e[_0x849b('0x45')]][_0x849b('0x46')]=_0x849b('0x47');queues[_0x56980e[_0x849b('0x45')]][_0x849b('0x48')]=_0x56980e[_0x849b('0x49')];queues[_0x56980e[_0x849b('0x45')]][_0x849b('0x4a')]=_0x56980e['transfereeuniqueid'];queues[_0x56980e[_0x849b('0x45')]]['queuecallerexitreason']=_0x849b('0x4b');utils[_0x849b('0x1d')](util[_0x849b('0xf')](_0x849b('0x4c'),_0x56980e[_0x849b('0xe')],queues[_0x56980e[_0x849b('0x45')]][_0x849b('0x1f')],_0x56980e[_0x849b('0x45')],_0x56980e[_0x849b('0x49')]));}}catch(_0x54fabe){utils[_0x849b('0x14')](util[_0x849b('0xf')](_0x849b('0x44'),_0x56980e[_0x849b('0xe')]),_0x54fabe);}};exports[_0x849b('0x4d')]=function(_0x419212){try{utils['debug'](util[_0x849b('0xf')](_0x849b('0x4e'),_0x419212[_0x849b('0x4f')]),_0x419212);if(_0x419212[_0x849b('0x4f')]==_0x419212[_0x849b('0x50')]){if(!_['isNil'](queues[_0x419212[_0x849b('0x51')]])){utils[_0x849b('0x1d')](util[_0x849b('0xf')](_0x849b('0x52'),_0x419212[_0x849b('0x4f')],queues[_0x419212[_0x849b('0x51')]][_0x849b('0x1f')],_0x419212[_0x849b('0x53')]));queues[_0x419212['secondtransfererlinkedid']][_0x849b('0x3f')]=!![];queues[_0x419212['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x419212[_0x849b('0x51')]]['transferexten']=_0x419212[_0x849b('0x53')];queues[_0x419212['secondtransfererlinkedid']]['transferuniqueid']=_0x419212['origtransfereruniqueid'];queues[_0x419212['secondtransfererlinkedid']][_0x849b('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x849b('0x16')](queues[_0x419212[_0x849b('0x50')]])){if(_0x419212[_0x849b('0x54')]&&queues[_0x419212[_0x849b('0x54')]]){queues[_0x419212['transfereelinkedid']][_0x849b('0x20')]=0x1;queues[_0x419212[_0x849b('0x45')]]=_[_0x849b('0x55')](queues[_0x419212[_0x849b('0x54')]]);queues[_0x419212['transfereeuniqueid']][_0x849b('0xd')]=_0x419212['transfertargetuniqueid'];queues[_0x419212['transfereeuniqueid']][_0x849b('0x20')]=0x2;queues[_0x419212[_0x849b('0x45')]]['calleridnum']=queues[_0x419212['secondtransfererlinkedid']]['calleridnum'];queues[_0x419212[_0x849b('0x45')]][_0x849b('0x56')]=queues[_0x419212[_0x849b('0x51')]][_0x849b('0x56')];queues[_0x419212[_0x849b('0x45')]][_0x849b('0x35')]=utils[_0x849b('0x1b')]();queues[_0x419212['transfereeuniqueid']][_0x849b('0x34')]=utils[_0x849b('0x1b')]();queues[_0x419212['transfereeuniqueid']][_0x849b('0x32')]=0x0;queues[_0x419212[_0x849b('0x45')]]['mohtime']=0x0;utils['info'](util[_0x849b('0xf')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x419212[_0x849b('0x4f')],queues[_0x419212[_0x849b('0x45')]][_0x849b('0x1f')],queues[_0x419212[_0x849b('0x45')]][_0x849b('0x5')],queues[_0x419212[_0x849b('0x45')]][_0x849b('0x56')]));}else{utils['info'](util[_0x849b('0xf')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x419212['origtransfereruniqueid'],queues[_0x419212[_0x849b('0x50')]][_0x849b('0x1f')],_0x419212[_0x849b('0x51')]));queues[_0x419212[_0x849b('0x50')]]['transfereduniqueid']=_0x419212['secondtransfererlinkedid'];}}}else if(_0x419212['secondtransfereruniqueid']==_0x419212[_0x849b('0x51')]){if(!_[_0x849b('0x16')](queues[_0x419212['origtransfererlinkedid']])){utils[_0x849b('0x1d')](util[_0x849b('0xf')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x419212[_0x849b('0x4f')],queues[_0x419212[_0x849b('0x50')]][_0x849b('0x1f')],_0x419212[_0x849b('0x57')],_0x419212[_0x849b('0x58')]));queues[_0x419212['origtransfererlinkedid']]['transfer']=!![];queues[_0x419212['origtransfererlinkedid']]['transfertype']=_0x849b('0x59');queues[_0x419212[_0x849b('0x50')]][_0x849b('0x48')]=_0x419212[_0x849b('0x58')];queues[_0x419212[_0x849b('0x50')]][_0x849b('0x4a')]=_0x419212[_0x849b('0x57')];queues[_0x419212[_0x849b('0x50')]]['queuecallerexitreason']=_0x849b('0x5a');}if(!_[_0x849b('0x16')](queues[_0x419212[_0x849b('0x51')]])){if(_0x419212[_0x849b('0x5b')]&&queues[_0x419212[_0x849b('0x5b')]]){queues[_0x419212[_0x849b('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x419212[_0x849b('0x5c')]]=_[_0x849b('0x55')](queues[_0x419212[_0x849b('0x5b')]]);queues[_0x419212[_0x849b('0x5c')]][_0x849b('0xd')]=_0x419212[_0x849b('0x5c')];queues[_0x419212[_0x849b('0x5c')]][_0x849b('0x20')]=0x2;queues[_0x419212[_0x849b('0x5c')]][_0x849b('0x5')]=queues[_0x419212[_0x849b('0x50')]][_0x849b('0x5')];queues[_0x419212[_0x849b('0x5c')]][_0x849b('0x56')]=queues[_0x419212['origtransfererlinkedid']][_0x849b('0x56')];queues[_0x419212[_0x849b('0x5c')]][_0x849b('0x35')]=utils[_0x849b('0x1b')]();queues[_0x419212[_0x849b('0x5c')]][_0x849b('0x34')]=utils['now']();queues[_0x419212[_0x849b('0x5c')]][_0x849b('0x32')]=0x0;queues[_0x419212[_0x849b('0x5c')]][_0x849b('0x5d')]=0x0;utils[_0x849b('0x1d')](util['format'](_0x849b('0x5e'),_0x419212['origtransfereruniqueid'],queues[_0x419212[_0x849b('0x5c')]][_0x849b('0x1f')],queues[_0x419212['transfertargetuniqueid']][_0x849b('0xd')],queues[_0x419212[_0x849b('0x5c')]]['calleridnum'],queues[_0x419212[_0x849b('0x5c')]][_0x849b('0x56')]));}else{utils[_0x849b('0x1d')](util['format'](_0x849b('0x5f'),_0x419212[_0x849b('0x4f')],queues[_0x419212[_0x849b('0x51')]][_0x849b('0x1f')],_0x419212[_0x849b('0x50')]));queues[_0x419212[_0x849b('0x51')]][_0x849b('0xd')]=_0x419212['origtransfererlinkedid'];}}}}catch(_0x437afa){utils[_0x849b('0x14')](util['format'](_0x849b('0x4e'),_0x419212['origtransfereruniqueid']),_0x437afa);}};exports['musiconholdstart']=function(_0x2c6cae){try{if(!_['isNil'](queues[_0x2c6cae[_0x849b('0xe')]])){utils['debug'](util[_0x849b('0xf')]('[%s][queues][musiconholdstart]',_0x2c6cae[_0x849b('0xe')]),_0x2c6cae);queues[_0x2c6cae[_0x849b('0xe')]][_0x849b('0x60')]=utils[_0x849b('0x1b')]();utils['info'](util[_0x849b('0xf')](_0x849b('0x61'),_0x2c6cae[_0x849b('0xe')],queues[_0x2c6cae[_0x849b('0xe')]][_0x849b('0x1f')],queues[_0x2c6cae[_0x849b('0xe')]]['musiconholdstartAt']));}}catch(_0x41adbb){utils[_0x849b('0x14')](util[_0x849b('0xf')](_0x849b('0x62'),_0x2c6cae[_0x849b('0xe')]),_0x41adbb);}};exports['musiconholdstop']=function(_0x4e109d){try{if(!_[_0x849b('0x16')](queues[_0x4e109d[_0x849b('0xe')]])){if(!_[_0x849b('0x16')](queues[_0x4e109d[_0x849b('0xe')]]['musiconholdstartAt'])){utils[_0x849b('0x21')](util[_0x849b('0xf')](_0x849b('0x63'),_0x4e109d[_0x849b('0xe')]),_0x4e109d);queues[_0x4e109d[_0x849b('0xe')]][_0x849b('0x5d')]+=utils[_0x849b('0x33')](utils[_0x849b('0x1b')](),queues[_0x4e109d[_0x849b('0xe')]][_0x849b('0x60')]);utils['info'](util['format'](_0x849b('0x64'),_0x4e109d['uniqueid'],queues[_0x4e109d[_0x849b('0xe')]][_0x849b('0x1f')],queues[_0x4e109d['uniqueid']]['mohtime']));delete queues[_0x4e109d['uniqueid']][_0x849b('0x60')];}}}catch(_0x2127b7){utils[_0x849b('0x14')](util['format'](_0x849b('0x63'),_0x4e109d['uniqueid']),_0x2127b7);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 9f83111..9ffb3a7 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 _0xb111=['split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr'];(function(_0x146fc4,_0x522846){var _0x6f2d3c=function(_0x45a07a){while(--_0x45a07a){_0x146fc4['push'](_0x146fc4['shift']());}};_0x6f2d3c(++_0x522846);}(_0xb111,0x9c));var _0x1b11=function(_0x879876,_0x7112a7){_0x879876=_0x879876-0x0;var _0x422e9d=_0xb111[_0x879876];return _0x422e9d;};'use strict';var _=require(_0x1b11('0x0'));var util=require(_0x1b11('0x1'));var utils=require(_0x1b11('0x2'));var transfers=require(_0x1b11('0x3'));var recordings={};function writeDB(_0x6dc09b){var _0x268449;utils[_0x1b11('0x4')](util['format'](_0x1b11('0x5'),_0x6dc09b['uniqueid']));if(transfers[_0x1b11('0x6')][_0x6dc09b[_0x1b11('0x7')]]){_0x268449=_0x6dc09b[_0x1b11('0x7')];_0x6dc09b[_0x1b11('0x7')]=transfers[_0x1b11('0x6')][_0x6dc09b['uniqueid']][_0x1b11('0x8')];}if(_0x6dc09b[_0x1b11('0x9')]){utils[_0x1b11('0xa')](_0x6dc09b[_0x1b11('0x9')])[_0x1b11('0xb')](function(_0x541cbf){if(_0x541cbf){_0x6dc09b[_0x1b11('0xc')]=_0x541cbf['name'];_0x6dc09b[_0x1b11('0xd')]=_0x541cbf['id'];}utils[_0x1b11('0xe')](_0x1b11('0xf'),_0x6dc09b);});}else{utils['request']('CreateVoiceRecording',_0x6dc09b);}if(_0x268449)delete transfers['blinds'][_0x268449];}exports[_0x1b11('0x10')]=function(_0x2240f3){try{utils[_0x1b11('0x11')](util[_0x1b11('0x12')](_0x1b11('0x13'),_0x2240f3[_0x1b11('0x7')]),_0x2240f3);if(_0x2240f3['uniqueid']==_0x2240f3[_0x1b11('0x14')]){utils['info'](util['format'](_0x1b11('0x15'),_0x2240f3[_0x1b11('0x7')],_0x2240f3[_0x1b11('0x16')],_0x2240f3[_0x1b11('0x17')]));recordings[_0x2240f3[_0x1b11('0x7')]]={'uniqueid':_0x2240f3[_0x1b11('0x7')],'accountcode':_0x2240f3[_0x1b11('0x9')],'exten':_0x2240f3[_0x1b11('0x17')],'context':_0x2240f3[_0x1b11('0x16')],'channel':_0x2240f3['channel'],'monitors':[]};}}catch(_0xf19b8f){utils[_0x1b11('0x18')](util['format']('[%s][recordings][newchannel]',_0x2240f3[_0x1b11('0x7')]),_0xf19b8f);}};exports[_0x1b11('0x19')]=function(_0x397d49){try{utils[_0x1b11('0x11')](util['format']('[%s][recordings][newstate]',_0x397d49[_0x1b11('0x7')]),_0x397d49);if(!_[_0x1b11('0x1a')](recordings[_0x397d49['uniqueid']])&&_0x397d49[_0x1b11('0x1b')]==0x6){utils['info'](util[_0x1b11('0x12')](_0x1b11('0x1c'),_0x397d49['uniqueid'],_0x397d49[_0x1b11('0x16')],_0x397d49[_0x1b11('0x1d')]));}else if(!_['isNil'](recordings[_0x397d49[_0x1b11('0x14')]])&&_0x397d49[_0x1b11('0x1b')]==0x6&&_0x397d49['context']!=_0x1b11('0x1e')){utils[_0x1b11('0x4')](util[_0x1b11('0x12')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x397d49['uniqueid'],_0x397d49[_0x1b11('0x14')],_0x397d49[_0x1b11('0x16')],_0x397d49['channel']));recordings[_0x397d49[_0x1b11('0x14')]][_0x1b11('0x9')]=_0x397d49[_0x1b11('0x9')];}}catch(_0x10f0bd){utils[_0x1b11('0x18')](util[_0x1b11('0x12')](_0x1b11('0x1f'),_0x397d49[_0x1b11('0x7')]),_0x10f0bd);}};exports[_0x1b11('0x20')]=function(_0x42c84e){try{if(!_[_0x1b11('0x1a')](_0x42c84e[_0x1b11('0x21')])&&!_[_0x1b11('0x1a')](_0x42c84e['variable'][_0x1b11('0x22')])){utils[_0x1b11('0x11')](util[_0x1b11('0x12')](_0x1b11('0x23'),_0x42c84e[_0x1b11('0x7')]),_0x42c84e);utils[_0x1b11('0x4')](util['format'](_0x1b11('0x24'),_0x42c84e[_0x1b11('0x7')],_0x42c84e[_0x1b11('0x21')],_0x42c84e[_0x1b11('0x25')]));if(_[_0x1b11('0x26')](_0x42c84e[_0x1b11('0x25')],_0x1b11('0x27'))){_0x42c84e[_0x1b11('0x25')]=_0x42c84e[_0x1b11('0x25')][_0x1b11('0x28')]('.wav49',_0x1b11('0x29'));}if(recordings[_0x42c84e[_0x1b11('0x14')]]){var _0x370a89=_[_0x1b11('0x2a')](recordings[_0x42c84e[_0x1b11('0x14')]]['monitors'],{'value':_0x42c84e['value']});if(_['isNil'](_0x370a89)){recordings[_0x42c84e[_0x1b11('0x14')]][_0x1b11('0x2b')][_0x1b11('0x2c')]({'value':_0x42c84e[_0x1b11('0x25')]});}}}}catch(_0x17baef){utils['error'](util[_0x1b11('0x12')](_0x1b11('0x23'),_0x42c84e[_0x1b11('0x7')]),_0x17baef);}};exports['hangup']=function(_0x363f43){try{if(!_[_0x1b11('0x1a')](recordings[_0x363f43[_0x1b11('0x7')]])){utils[_0x1b11('0x11')](util['format']('[%s][recordings][hangup]',_0x363f43[_0x1b11('0x7')]),_0x363f43);utils[_0x1b11('0x4')](util[_0x1b11('0x12')](_0x1b11('0x2d'),_0x363f43[_0x1b11('0x7')],_0x363f43['calleridnum'],_0x363f43[_0x1b11('0x2e')],_0x363f43[_0x1b11('0x2f')]));recordings[_0x363f43[_0x1b11('0x7')]]['calleridnum']=_0x363f43['calleridnum'];recordings[_0x363f43[_0x1b11('0x7')]][_0x1b11('0x2e')]=_0x363f43[_0x1b11('0x2e')];recordings[_0x363f43[_0x1b11('0x7')]]['connectedlinenum']=_0x363f43[_0x1b11('0x30')];recordings[_0x363f43[_0x1b11('0x7')]]['connectedlinename']=_0x363f43[_0x1b11('0x31')];if(recordings[_0x363f43['uniqueid']][_0x1b11('0x32')]==_0x1b11('0x33')&&recordings[_0x363f43[_0x1b11('0x7')]]['accountcode']){recordings[_0x363f43[_0x1b11('0x7')]][_0x1b11('0x30')]=recordings[_0x363f43[_0x1b11('0x7')]][_0x1b11('0x9')];recordings[_0x363f43[_0x1b11('0x7')]][_0x1b11('0x31')]='';}recordings[_0x363f43['uniqueid']]['monitors'][_0x1b11('0x34')](function(_0x5ccfd6){var _0x7aaecb=_[_0x1b11('0x35')](recordings[_0x363f43[_0x1b11('0x7')]]);_0x7aaecb[_0x1b11('0x25')]=_0x5ccfd6[_0x1b11('0x25')];writeDB(_0x7aaecb);});delete recordings[_0x363f43[_0x1b11('0x7')]];}}catch(_0x22f4be){utils[_0x1b11('0x18')](util[_0x1b11('0x12')](_0x1b11('0x36'),_0x363f43[_0x1b11('0x7')]),_0x22f4be);}};exports['newexten']=function(_0x27467c){try{if(!_['isNil'](recordings[_0x27467c[_0x1b11('0x7')]])){utils[_0x1b11('0x11')](util[_0x1b11('0x12')](_0x1b11('0x37'),_0x27467c[_0x1b11('0x7')]),_0x27467c);utils[_0x1b11('0x4')](util['format'](_0x1b11('0x38'),_0x27467c[_0x1b11('0x7')],_0x27467c[_0x1b11('0x39')],_0x27467c[_0x1b11('0x3a')]));if(_0x27467c[_0x1b11('0x39')][_0x1b11('0x3b')]()==_0x1b11('0x3c')&&_[_0x1b11('0x3d')](_0x27467c['appdata'][_0x1b11('0x3b')](),_0x1b11('0x3e'))){var _0x357796=_0x27467c[_0x1b11('0x3a')][_0x1b11('0x3f')]('=');var _0x1b778a=_0x357796[0x0][_0x1b11('0x40')](_0x357796[0x0][_0x1b11('0x41')]('(')+0x1,_0x357796[0x0][_0x1b11('0x41')](')'));var _0x33ac21=_0x357796[0x1];recordings[_0x27467c[_0x1b11('0x7')]][_0x1b778a]=_0x33ac21;}}}catch(_0x55fdbf){utils[_0x1b11('0x18')](util[_0x1b11('0x12')](_0x1b11('0x37'),_0x27467c[_0x1b11('0x7')]),_0x55fdbf);}};exports['queuecallerjoin']=function(_0x3ef9e6){try{if(!_[_0x1b11('0x1a')](recordings[_0x3ef9e6['uniqueid']])){utils[_0x1b11('0x11')](util[_0x1b11('0x12')](_0x1b11('0x42'),_0x3ef9e6['uniqueid']),_0x3ef9e6);utils[_0x1b11('0x4')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x3ef9e6[_0x1b11('0x7')],_0x3ef9e6[_0x1b11('0x43')]));recordings[_0x3ef9e6['uniqueid']]['queue']=_0x3ef9e6[_0x1b11('0x43')];}}catch(_0x18577c){utils[_0x1b11('0x18')](util['format'](_0x1b11('0x42'),_0x3ef9e6[_0x1b11('0x7')]),_0x18577c);}};exports['blindtransfer']=function(_0x1b0019){try{utils[_0x1b11('0x11')](util['format']('[%s][recordings][blindtransfer]',_0x1b0019[_0x1b11('0x7')]),_0x1b0019);utils[_0x1b11('0x4')](util[_0x1b11('0x12')](_0x1b11('0x44'),_0x1b0019[_0x1b11('0x7')],_0x1b0019['transferercalleridnum'],_0x1b0019[_0x1b11('0x45')],_0x1b0019['transfereecalleridnum'],_0x1b0019[_0x1b11('0x46')]));if(recordings[_0x1b0019[_0x1b11('0x47')]]&&transfers[_0x1b11('0x6')][_0x1b0019[_0x1b11('0x47')]]){transfers[_0x1b11('0x6')][_0x1b0019[_0x1b11('0x47')]][_0x1b11('0x48')]=!![];}}catch(_0x1abcb2){utils[_0x1b11('0x18')](util['format']('[%s][recordings][blindtransfer]',_0x1b0019[_0x1b11('0x7')]),_0x1abcb2);}}; \ No newline at end of file +var _0xabf9=['[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','monitors','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','getUserByInternal','accountcode','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','channelstate','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xabf9,0xf3));var _0x9abf=function(_0x39d4b1,_0x134bd6){_0x39d4b1=_0x39d4b1-0x0;var _0x1eab3d=_0xabf9[_0x39d4b1];return _0x1eab3d;};'use strict';var _=require(_0x9abf('0x0'));var util=require(_0x9abf('0x1'));var utils=require('./utils');var transfers=require(_0x9abf('0x2'));var recordings={};function writeDB(_0x322829){var _0x454cb2;utils[_0x9abf('0x3')](util[_0x9abf('0x4')](_0x9abf('0x5'),_0x322829[_0x9abf('0x6')]));if(transfers[_0x9abf('0x7')][_0x322829[_0x9abf('0x6')]]){_0x454cb2=_0x322829['uniqueid'];_0x322829[_0x9abf('0x6')]=transfers[_0x9abf('0x7')][_0x322829[_0x9abf('0x6')]]['transfereeuniqueid'];}if(_0x322829['accountcode']){utils[_0x9abf('0x8')](_0x322829[_0x9abf('0x9')])[_0x9abf('0xa')](function(_0x440909){if(_0x440909){_0x322829[_0x9abf('0xb')]=_0x440909[_0x9abf('0xc')];_0x322829[_0x9abf('0xd')]=_0x440909['id'];}utils['request'](_0x9abf('0xe'),_0x322829);});}else{utils[_0x9abf('0xf')]('CreateVoiceRecording',_0x322829);}if(_0x454cb2)delete transfers['blinds'][_0x454cb2];}exports[_0x9abf('0x10')]=function(_0x58e44f){try{utils[_0x9abf('0x11')](util['format'](_0x9abf('0x12'),_0x58e44f[_0x9abf('0x6')]),_0x58e44f);if(_0x58e44f[_0x9abf('0x6')]==_0x58e44f[_0x9abf('0x13')]){utils[_0x9abf('0x3')](util[_0x9abf('0x4')](_0x9abf('0x14'),_0x58e44f['uniqueid'],_0x58e44f[_0x9abf('0x15')],_0x58e44f[_0x9abf('0x16')]));recordings[_0x58e44f[_0x9abf('0x6')]]={'uniqueid':_0x58e44f['uniqueid'],'accountcode':_0x58e44f[_0x9abf('0x9')],'exten':_0x58e44f[_0x9abf('0x16')],'context':_0x58e44f[_0x9abf('0x15')],'channel':_0x58e44f[_0x9abf('0x17')],'monitors':[]};}}catch(_0x5b9dab){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x12'),_0x58e44f[_0x9abf('0x6')]),_0x5b9dab);}};exports['newstate']=function(_0x5a9463){try{utils['debug'](util[_0x9abf('0x4')](_0x9abf('0x19'),_0x5a9463[_0x9abf('0x6')]),_0x5a9463);if(!_[_0x9abf('0x1a')](recordings[_0x5a9463[_0x9abf('0x6')]])&&_0x5a9463[_0x9abf('0x1b')]==0x6){utils['info'](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x5a9463['uniqueid'],_0x5a9463[_0x9abf('0x15')],_0x5a9463[_0x9abf('0x17')]));}else if(!_[_0x9abf('0x1a')](recordings[_0x5a9463[_0x9abf('0x13')]])&&_0x5a9463['channelstate']==0x6&&_0x5a9463[_0x9abf('0x15')]!=_0x9abf('0x1c')){utils[_0x9abf('0x3')](util[_0x9abf('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5a9463[_0x9abf('0x6')],_0x5a9463['linkedid'],_0x5a9463[_0x9abf('0x15')],_0x5a9463[_0x9abf('0x17')]));recordings[_0x5a9463['linkedid']]['accountcode']=_0x5a9463[_0x9abf('0x9')];}}catch(_0x37b3a1){utils['error'](util[_0x9abf('0x4')]('[%s][recordings][newstate]',_0x5a9463[_0x9abf('0x6')]),_0x37b3a1);}};exports[_0x9abf('0x1d')]=function(_0x5a76a7){try{if(!_[_0x9abf('0x1a')](_0x5a76a7[_0x9abf('0x1e')])&&!_['isNil'](_0x5a76a7[_0x9abf('0x1e')][_0x9abf('0x1f')])){utils[_0x9abf('0x11')](util['format'](_0x9abf('0x20'),_0x5a76a7[_0x9abf('0x6')]),_0x5a76a7);utils[_0x9abf('0x3')](util[_0x9abf('0x4')](_0x9abf('0x21'),_0x5a76a7[_0x9abf('0x6')],_0x5a76a7['variable'],_0x5a76a7[_0x9abf('0x22')]));if(_[_0x9abf('0x23')](_0x5a76a7['value'],'.wav49')){_0x5a76a7[_0x9abf('0x22')]=_0x5a76a7[_0x9abf('0x22')][_0x9abf('0x24')](_0x9abf('0x25'),_0x9abf('0x26'));}if(recordings[_0x5a76a7['linkedid']]){var _0x47e3d1=_['find'](recordings[_0x5a76a7[_0x9abf('0x13')]][_0x9abf('0x27')],{'value':_0x5a76a7[_0x9abf('0x22')]});if(_[_0x9abf('0x1a')](_0x47e3d1)){recordings[_0x5a76a7[_0x9abf('0x13')]]['monitors']['push']({'value':_0x5a76a7[_0x9abf('0x22')]});}}}}catch(_0x352e67){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x20'),_0x5a76a7['uniqueid']),_0x352e67);}};exports[_0x9abf('0x28')]=function(_0x513a78){try{if(!_[_0x9abf('0x1a')](recordings[_0x513a78[_0x9abf('0x6')]])){utils[_0x9abf('0x11')](util['format']('[%s][recordings][hangup]',_0x513a78['uniqueid']),_0x513a78);utils[_0x9abf('0x3')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x513a78[_0x9abf('0x6')],_0x513a78[_0x9abf('0x29')],_0x513a78[_0x9abf('0x2a')],_0x513a78['cause-txt']));recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x29')]=_0x513a78['calleridnum'];recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x2a')]=_0x513a78[_0x9abf('0x2a')];recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x2b')]=_0x513a78[_0x9abf('0x2b')];recordings[_0x513a78[_0x9abf('0x6')]]['connectedlinename']=_0x513a78[_0x9abf('0x2c')];if(recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x2d')]==_0x9abf('0x2e')&&recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x9')]){recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x2b')]=recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x9')];recordings[_0x513a78['uniqueid']][_0x9abf('0x2c')]='';}recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x27')][_0x9abf('0x2f')](function(_0x385119){var _0x23fd49=_['clone'](recordings[_0x513a78[_0x9abf('0x6')]]);_0x23fd49['value']=_0x385119[_0x9abf('0x22')];writeDB(_0x23fd49);});delete recordings[_0x513a78[_0x9abf('0x6')]];}}catch(_0x42df8a){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x30'),_0x513a78[_0x9abf('0x6')]),_0x42df8a);}};exports['newexten']=function(_0x4c7496){try{if(!_[_0x9abf('0x1a')](recordings[_0x4c7496['uniqueid']])){utils[_0x9abf('0x11')](util['format'](_0x9abf('0x31'),_0x4c7496[_0x9abf('0x6')]),_0x4c7496);utils[_0x9abf('0x3')](util[_0x9abf('0x4')](_0x9abf('0x32'),_0x4c7496['uniqueid'],_0x4c7496[_0x9abf('0x33')],_0x4c7496['appdata']));if(_0x4c7496[_0x9abf('0x33')][_0x9abf('0x34')]()=='set'&&_[_0x9abf('0x35')](_0x4c7496[_0x9abf('0x36')][_0x9abf('0x34')](),_0x9abf('0x37'))){var _0x4a6c4c=_0x4c7496[_0x9abf('0x36')][_0x9abf('0x38')]('=');var _0x40e51e=_0x4a6c4c[0x0]['substring'](_0x4a6c4c[0x0]['lastIndexOf']('(')+0x1,_0x4a6c4c[0x0][_0x9abf('0x39')](')'));var _0x107f10=_0x4a6c4c[0x1];recordings[_0x4c7496[_0x9abf('0x6')]][_0x40e51e]=_0x107f10;}}}catch(_0x5f29b8){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x31'),_0x4c7496[_0x9abf('0x6')]),_0x5f29b8);}};exports[_0x9abf('0x3a')]=function(_0x2fd028){try{if(!_[_0x9abf('0x1a')](recordings[_0x2fd028[_0x9abf('0x6')]])){utils[_0x9abf('0x11')](util[_0x9abf('0x4')](_0x9abf('0x3b'),_0x2fd028[_0x9abf('0x6')]),_0x2fd028);utils[_0x9abf('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x2fd028[_0x9abf('0x6')],_0x2fd028['queue']));recordings[_0x2fd028['uniqueid']][_0x9abf('0x3c')]=_0x2fd028[_0x9abf('0x3c')];}}catch(_0xb565f4){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x3b'),_0x2fd028[_0x9abf('0x6')]),_0xb565f4);}};exports[_0x9abf('0x3d')]=function(_0x23f685){try{utils['debug'](util[_0x9abf('0x4')](_0x9abf('0x3e'),_0x23f685[_0x9abf('0x6')]),_0x23f685);utils[_0x9abf('0x3')](util[_0x9abf('0x4')](_0x9abf('0x3f'),_0x23f685[_0x9abf('0x6')],_0x23f685[_0x9abf('0x40')],_0x23f685[_0x9abf('0x41')],_0x23f685['transfereecalleridnum'],_0x23f685[_0x9abf('0x42')]));if(recordings[_0x23f685['transfereruniqueid']]&&transfers[_0x9abf('0x7')][_0x23f685['transfereruniqueid']]){transfers[_0x9abf('0x7')][_0x23f685[_0x9abf('0x43')]][_0x9abf('0x44')]=!![];}}catch(_0x5e1b7a){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x3e'),_0x23f685[_0x9abf('0x6')]),_0x5e1b7a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a0f134b..50bfad1 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 _0x5930=['transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blinds','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum'];(function(_0x3a996d,_0x5e73a5){var _0xafd490=function(_0x58e9d7){while(--_0x58e9d7){_0x3a996d['push'](_0x3a996d['shift']());}};_0xafd490(++_0x5e73a5);}(_0x5930,0x93));var _0x0593=function(_0x199123,_0x385e87){_0x199123=_0x199123-0x0;var _0x1103cc=_0x5930[_0x199123];return _0x1103cc;};'use strict';var _=require('lodash');var util=require(_0x0593('0x0'));var utils=require(_0x0593('0x1'));function writeDB(_0x33b244){utils[_0x0593('0x2')](util[_0x0593('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x33b244[_0x0593('0x4')]===_0x0593('0x5')?_0x33b244[_0x0593('0x6')]:_0x33b244[_0x0593('0x7')],_0x33b244[_0x0593('0x4')]));utils[_0x0593('0x8')](_0x0593('0x9'),_0x33b244);}exports['blinds']={};exports[_0x0593('0xa')]=function(_0x16adf5){try{utils[_0x0593('0xb')](util['format']('[%s][transfers][blindtransfer]',_0x16adf5['uniqueid']),_0x16adf5);utils[_0x0593('0x2')](util[_0x0593('0x3')](_0x0593('0xc'),_0x16adf5[_0x0593('0x7')],_0x16adf5[_0x0593('0xd')],_0x16adf5[_0x0593('0xe')],_0x16adf5[_0x0593('0xf')],_0x16adf5[_0x0593('0x10')]));_0x16adf5[_0x0593('0x4')]='blind';exports[_0x0593('0x11')][_0x16adf5[_0x0593('0x12')]]=_0x16adf5;writeDB(_0x16adf5);}catch(_0x6f7aa9){utils[_0x0593('0x13')](util[_0x0593('0x3')]('[%s][transfers][blindtransfer]',_0x16adf5['uniqueid']),_0x6f7aa9);}};exports[_0x0593('0x14')]=function(_0x23fd59){try{utils[_0x0593('0xb')](util[_0x0593('0x3')](_0x0593('0x15'),_0x23fd59['origtransfereruniqueid']),_0x23fd59);utils[_0x0593('0x2')](util[_0x0593('0x3')](_0x0593('0x16'),_0x23fd59[_0x0593('0x6')],_0x23fd59[_0x0593('0x17')],_0x23fd59['origtransferercalleridname'],_0x23fd59[_0x0593('0x18')],_0x23fd59[_0x0593('0x19')]));_0x23fd59=_[_0x0593('0x1a')](_0x23fd59,{'transfererchannel':_0x23fd59[_0x0593('0x1b')],'transferercalleridnum':_0x23fd59['origtransferercalleridnum'],'transferercalleridname':_0x23fd59[_0x0593('0x1c')],'transfererconnectedlinenum':_0x23fd59[_0x0593('0x1d')],'transfererconnectedlinename':_0x23fd59[_0x0593('0x1e')],'transfereraccountcode':_0x23fd59[_0x0593('0x1f')],'transferercontext':_0x23fd59['secondtransferercontext'],'transfererexten':_0x23fd59[_0x0593('0x20')],'transfererlinkedid':_0x23fd59[_0x0593('0x21')],'context':_0x23fd59[_0x0593('0x22')],'extension':_0x23fd59[_0x0593('0x23')],'type':_0x0593('0x5')});if(_['isNil'](_0x23fd59[_0x0593('0x24')])){_0x23fd59=_[_0x0593('0x1a')](_0x23fd59,{'transfereechannel':_0x23fd59[_0x0593('0x25')],'transfereecalleridnum':_0x23fd59['transfertargetcalleridnum'],'transfereecalleridname':_0x23fd59['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x23fd59[_0x0593('0x26')],'transfereeconnectedlinename':_0x23fd59[_0x0593('0x27')],'transfereeaccountcode':_0x23fd59['transfertargetaccountcode'],'transfereecontext':_0x23fd59[_0x0593('0x28')],'transfereeexten':_0x23fd59[_0x0593('0x29')],'transfereelinkedid':_0x23fd59[_0x0593('0x2a')]});}writeDB(_0x23fd59);}catch(_0x213819){utils[_0x0593('0x13')](util[_0x0593('0x3')]('[%s][transfers][attendedtransfer]',_0x23fd59[_0x0593('0x6')]),_0x213819);}}; \ No newline at end of file +var _0xca1f=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','info','format','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransfererchannel'];(function(_0x44b5bb,_0x2c620e){var _0x214394=function(_0x5c7ded){while(--_0x5c7ded){_0x44b5bb['push'](_0x44b5bb['shift']());}};_0x214394(++_0x2c620e);}(_0xca1f,0x108));var _0xfca1=function(_0x1215af,_0x43716d){_0x1215af=_0x1215af-0x0;var _0x3e8a30=_0xca1f[_0x1215af];return _0x3e8a30;};'use strict';var _=require(_0xfca1('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x56c45d){utils[_0xfca1('0x1')](util[_0xfca1('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x56c45d[_0xfca1('0x3')]===_0xfca1('0x4')?_0x56c45d[_0xfca1('0x5')]:_0x56c45d[_0xfca1('0x6')],_0x56c45d[_0xfca1('0x3')]));utils['request'](_0xfca1('0x7'),_0x56c45d);}exports[_0xfca1('0x8')]={};exports[_0xfca1('0x9')]=function(_0x89f5a4){try{utils[_0xfca1('0xa')](util[_0xfca1('0x2')]('[%s][transfers][blindtransfer]',_0x89f5a4[_0xfca1('0x6')]),_0x89f5a4);utils[_0xfca1('0x1')](util[_0xfca1('0x2')](_0xfca1('0xb'),_0x89f5a4[_0xfca1('0x6')],_0x89f5a4['transferercalleridnum'],_0x89f5a4[_0xfca1('0xc')],_0x89f5a4['transfereecalleridnum'],_0x89f5a4[_0xfca1('0xd')]));_0x89f5a4['type']=_0xfca1('0xe');exports[_0xfca1('0x8')][_0x89f5a4[_0xfca1('0xf')]]=_0x89f5a4;writeDB(_0x89f5a4);}catch(_0x3be166){utils['error'](util[_0xfca1('0x2')](_0xfca1('0x10'),_0x89f5a4[_0xfca1('0x6')]),_0x3be166);}};exports['attendedtransfer']=function(_0x4329cf){try{utils[_0xfca1('0xa')](util['format'](_0xfca1('0x11'),_0x4329cf[_0xfca1('0x5')]),_0x4329cf);utils['info'](util[_0xfca1('0x2')](_0xfca1('0x12'),_0x4329cf[_0xfca1('0x5')],_0x4329cf[_0xfca1('0x13')],_0x4329cf['origtransferercalleridname'],_0x4329cf[_0xfca1('0x14')],_0x4329cf['transfertargetcalleridname']));_0x4329cf=_[_0xfca1('0x15')](_0x4329cf,{'transfererchannel':_0x4329cf[_0xfca1('0x16')],'transferercalleridnum':_0x4329cf[_0xfca1('0x13')],'transferercalleridname':_0x4329cf[_0xfca1('0x17')],'transfererconnectedlinenum':_0x4329cf[_0xfca1('0x18')],'transfererconnectedlinename':_0x4329cf[_0xfca1('0x19')],'transfereraccountcode':_0x4329cf[_0xfca1('0x1a')],'transferercontext':_0x4329cf[_0xfca1('0x1b')],'transfererexten':_0x4329cf[_0xfca1('0x1c')],'transfererlinkedid':_0x4329cf[_0xfca1('0x1d')],'context':_0x4329cf[_0xfca1('0x1e')],'extension':_0x4329cf[_0xfca1('0x1f')],'type':_0xfca1('0x4')});if(_['isNil'](_0x4329cf[_0xfca1('0x20')])){_0x4329cf=_[_0xfca1('0x15')](_0x4329cf,{'transfereechannel':_0x4329cf[_0xfca1('0x21')],'transfereecalleridnum':_0x4329cf['transfertargetcalleridnum'],'transfereecalleridname':_0x4329cf[_0xfca1('0x22')],'transfereeconnectedlinenum':_0x4329cf[_0xfca1('0x23')],'transfereeconnectedlinename':_0x4329cf[_0xfca1('0x24')],'transfereeaccountcode':_0x4329cf['transfertargetaccountcode'],'transfereecontext':_0x4329cf[_0xfca1('0x25')],'transfereeexten':_0x4329cf[_0xfca1('0x26')],'transfereelinkedid':_0x4329cf[_0xfca1('0x27')]});}writeDB(_0x4329cf);}catch(_0x521bb4){utils[_0xfca1('0x28')](util['format'](_0xfca1('0x11'),_0x4329cf[_0xfca1('0x5')]),_0x521bb4);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c98c502..1f3ecdf 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 _0xb27f=['isBefore','bluebird','jayson/promise','moment','util','client','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0xb27f,0x67));var _0xfb27=function(_0x3f3adc,_0x12f0f1){_0x3f3adc=_0x3f3adc-0x0;var _0x414332=_0xb27f[_0x3f3adc];return _0x414332;};'use strict';var BPromise=require(_0xfb27('0x0'));var jayson=require(_0xfb27('0x1'));var moment=require(_0xfb27('0x2'));var util=require(_0xfb27('0x3'));var client=jayson[_0xfb27('0x4')][_0xfb27('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0xfb27('0x6'));exports[_0xfb27('0x7')]=function(_0x56051f,_0x3c2b6d){logger[_0xfb27('0x7')](_0x56051f,_0x3c2b6d?util[_0xfb27('0x8')](_0x3c2b6d,{'showHidden':![],'depth':null}):'');};exports[_0xfb27('0x9')]=function(_0x106cb1,_0x178a5a){logger['debug'](_0x106cb1,_0x178a5a?util[_0xfb27('0x8')](_0x178a5a,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x5a8986,_0x391709){logger[_0xfb27('0xa')](_0x5a8986,_0x391709?util['inspect'](_0x391709,{'showHidden':![],'depth':null}):'');};exports[_0xfb27('0xb')]=function(_0x17eadf,_0x5771e8){return client[_0xfb27('0xb')](_0x17eadf,{'body':_0x5771e8})[_0xfb27('0xc')](function(_0x178995){logger[_0xfb27('0x9')](_0xfb27('0xd'),_0x17eadf,_0x178995?util[_0xfb27('0x8')](_0x178995,{'showHidden':![],'depth':null}):'');})[_0xfb27('0xe')](function(_0x1b2058){logger['error']('[utils][request]\x20name:%s',_0x17eadf,_0x1b2058?util[_0xfb27('0x8')](_0x1b2058,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5d7603){return client[_0xfb27('0xb')](_0xfb27('0xf'),{'options':{'raw':!![],'attributes':['id',_0xfb27('0x10'),'name',_0xfb27('0x11')],'where':_0x5d7603,'limit':0x1}})[_0xfb27('0xc')](function(_0x1dd78a){logger[_0xfb27('0x9')](_0xfb27('0x12'),JSON[_0xfb27('0x13')](_0x5d7603),_0x1dd78a?util['inspect'](_0x1dd78a,{'showHidden':![],'depth':null}):'');return _0x1dd78a['result'][_0xfb27('0x14')]?_0x1dd78a[_0xfb27('0x15')][0x0]:null;});}exports[_0xfb27('0x16')]=function(_0x50336d){return new BPromise(function(_0x31fe39,_0x5b93d8){if(_0x50336d){return getUser({'internal':_0x50336d})[_0xfb27('0xc')](function(_0xdcabac){logger[_0xfb27('0x7')](_0xfb27('0x17'),_0x50336d,_0xdcabac?_0xfb27('0x18'):_0xfb27('0x19'));return _0x31fe39(_0xdcabac);})[_0xfb27('0xe')](function(_0x430500){logger[_0xfb27('0xa')](_0xfb27('0x1a'),_0x430500?util[_0xfb27('0x8')](_0x430500,{'showHidden':![],'depth':null}):'');return _0x31fe39(null);});}return _0x31fe39(null);});};exports[_0xfb27('0x1b')]=function(_0x30ba88){return new BPromise(function(_0x5487e3,_0x31c6cf){if(_0x30ba88){return getUser({'interface':_0x30ba88})[_0xfb27('0xc')](function(_0x4d40e1){logger['info'](_0xfb27('0x1c'),_0x30ba88,_0x4d40e1?_0xfb27('0x18'):_0xfb27('0x19'));return _0x5487e3(_0x4d40e1);})[_0xfb27('0xe')](function(_0xac56a){logger[_0xfb27('0xa')]('[utils][getUserByInterface]',_0xac56a?util[_0xfb27('0x8')](_0xac56a,{'showHidden':![],'depth':null}):'');return _0x5487e3(null);});}return _0x5487e3(null);});};exports[_0xfb27('0x1d')]=function(_0x444e32){return new BPromise(function(_0x5b732c,_0x5a4fa2){if(_0x444e32){return getUser({'name':_0x444e32})[_0xfb27('0xc')](function(_0x26180e){logger[_0xfb27('0x7')](_0xfb27('0x1e'),_0x444e32,_0x26180e?_0xfb27('0x18'):'notfound');return _0x5b732c(_0x26180e);})[_0xfb27('0xe')](function(_0x45a338){logger[_0xfb27('0xa')](_0xfb27('0x1f'),_0x45a338?util['inspect'](_0x45a338,{'showHidden':![],'depth':null}):'');return _0x5b732c(null);});}return _0x5b732c(null);});};exports[_0xfb27('0x20')]=function(_0x356c73){return new BPromise(function(_0x3677ce,_0xd01cde){if(_0x356c73){return client['request'](_0xfb27('0x21'),{'options':{'raw':!![],'attributes':['id',_0xfb27('0x22'),_0xfb27('0x23'),'acw','acwTimeout'],'where':{'name':_0x356c73},'limit':0x1}})[_0xfb27('0xc')](function(_0x5d930f){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x356c73,_0x5d930f?util['inspect'](_0x5d930f,{'showHidden':![],'depth':null}):'');logger[_0xfb27('0x7')](_0xfb27('0x24'),_0x356c73,_0x5d930f?'found':_0xfb27('0x19'));return _0x3677ce(_0x5d930f[_0xfb27('0x15')][_0xfb27('0x14')]?_0x5d930f[_0xfb27('0x15')][0x0]:null);})[_0xfb27('0xe')](function(_0x1b5326){logger['error'](_0xfb27('0x25'),_0x1b5326?util[_0xfb27('0x8')](_0x1b5326,{'showHidden':![],'depth':null}):'');return _0x3677ce(null);});}return _0x3677ce(null);});};exports[_0xfb27('0x26')]=function(_0x443be3,_0x38c022){return moment(_0x443be3)[_0xfb27('0x27')](_0x38c022,_0xfb27('0x28'))[_0xfb27('0x29')](_0xfb27('0x2a'));};exports[_0xfb27('0x2b')]=function(_0x3924ef,_0x22b34f){return moment(_0x3924ef)[_0xfb27('0x2c')](_0x22b34f,_0xfb27('0x28'))[_0xfb27('0x29')](_0xfb27('0x2a'));};exports[_0xfb27('0x2d')]=function(_0x12fcdb,_0x288777){return moment(_0x12fcdb)[_0xfb27('0x2e')](moment(_0x288777),_0xfb27('0x28'));};exports[_0xfb27('0x2f')]=function(_0x2b1e1f,_0x1ddf78){return parseInt(_0x2b1e1f,0xa)+parseInt(_0x1ddf78,0xa);};exports[_0xfb27('0x30')]=function(){return moment()['format'](_0xfb27('0x2a'));};exports[_0xfb27('0x31')]=function(_0x534864,_0x4237f9){if(_0x4237f9){return moment(_0x534864)['isAfter'](_0x4237f9);}return!![];};exports[_0xfb27('0x32')]=function(_0x4f87b5,_0x25e98b){if(_0x25e98b){return moment(_0x4f87b5)[_0xfb27('0x32')](_0x25e98b);}else if(_0x4f87b5){return!![];}return![];}; \ No newline at end of file +var _0x6b52=['request','then','[utils][request]\x20name:%s','internal','name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','found','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error'];(function(_0x41b147,_0x52afc9){var _0x5b8d0e=function(_0x2e620d){while(--_0x2e620d){_0x41b147['push'](_0x41b147['shift']());}};_0x5b8d0e(++_0x52afc9);}(_0x6b52,0xdf));var _0x26b5=function(_0x50357d,_0x55b4eb){_0x50357d=_0x50357d-0x0;var _0x12b140=_0x6b52[_0x50357d];return _0x12b140;};'use strict';var BPromise=require(_0x26b5('0x0'));var jayson=require(_0x26b5('0x1'));var moment=require(_0x26b5('0x2'));var util=require(_0x26b5('0x3'));var client=jayson[_0x26b5('0x4')][_0x26b5('0x5')]({'port':0x2329});var logger=require(_0x26b5('0x6'))(_0x26b5('0x7'));exports[_0x26b5('0x8')]=function(_0x1a284c,_0x4bd37b){logger[_0x26b5('0x8')](_0x1a284c,_0x4bd37b?util[_0x26b5('0x9')](_0x4bd37b,{'showHidden':![],'depth':null}):'');};exports[_0x26b5('0xa')]=function(_0x20a9a4,_0x50d289){logger[_0x26b5('0xa')](_0x20a9a4,_0x50d289?util[_0x26b5('0x9')](_0x50d289,{'showHidden':![],'depth':null}):'');};exports[_0x26b5('0xb')]=function(_0x4975a4,_0x343da4){logger[_0x26b5('0xb')](_0x4975a4,_0x343da4?util[_0x26b5('0x9')](_0x343da4,{'showHidden':![],'depth':null}):'');};exports[_0x26b5('0xc')]=function(_0xc1e020,_0x119e9f){return client[_0x26b5('0xc')](_0xc1e020,{'body':_0x119e9f})[_0x26b5('0xd')](function(_0x448692){logger[_0x26b5('0xa')](_0x26b5('0xe'),_0xc1e020,_0x448692?util[_0x26b5('0x9')](_0x448692,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x172e0f){logger['error'](_0x26b5('0xe'),_0xc1e020,_0x172e0f?util[_0x26b5('0x9')](_0x172e0f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x51cc26){return client[_0x26b5('0xc')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x26b5('0xf'),_0x26b5('0x10'),_0x26b5('0x11')],'where':_0x51cc26,'limit':0x1}})[_0x26b5('0xd')](function(_0x42b21d){logger[_0x26b5('0xa')](_0x26b5('0x12'),JSON['stringify'](_0x51cc26),_0x42b21d?util[_0x26b5('0x9')](_0x42b21d,{'showHidden':![],'depth':null}):'');return _0x42b21d[_0x26b5('0x13')][_0x26b5('0x14')]?_0x42b21d[_0x26b5('0x13')][0x0]:null;});}exports[_0x26b5('0x15')]=function(_0x316e56){return new BPromise(function(_0x143e24,_0x3872b6){if(_0x316e56){return getUser({'internal':_0x316e56})[_0x26b5('0xd')](function(_0x2ae701){logger[_0x26b5('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x316e56,_0x2ae701?_0x26b5('0x16'):'notfound');return _0x143e24(_0x2ae701);})['catch'](function(_0x52668a){logger[_0x26b5('0xb')]('[utils][getUserByInternal]',_0x52668a?util[_0x26b5('0x9')](_0x52668a,{'showHidden':![],'depth':null}):'');return _0x143e24(null);});}return _0x143e24(null);});};exports['getUserByInterface']=function(_0x38eb85){return new BPromise(function(_0x170e56,_0x17b554){if(_0x38eb85){return getUser({'interface':_0x38eb85})[_0x26b5('0xd')](function(_0x3f6cd0){logger['info'](_0x26b5('0x17'),_0x38eb85,_0x3f6cd0?'found':_0x26b5('0x18'));return _0x170e56(_0x3f6cd0);})[_0x26b5('0x19')](function(_0x325f92){logger[_0x26b5('0xb')](_0x26b5('0x1a'),_0x325f92?util[_0x26b5('0x9')](_0x325f92,{'showHidden':![],'depth':null}):'');return _0x170e56(null);});}return _0x170e56(null);});};exports[_0x26b5('0x1b')]=function(_0xd1ac83){return new BPromise(function(_0x33cdef,_0x5a046f){if(_0xd1ac83){return getUser({'name':_0xd1ac83})[_0x26b5('0xd')](function(_0x1856e2){logger[_0x26b5('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0xd1ac83,_0x1856e2?'found':_0x26b5('0x18'));return _0x33cdef(_0x1856e2);})['catch'](function(_0x3c6e7d){logger['error'](_0x26b5('0x1c'),_0x3c6e7d?util[_0x26b5('0x9')](_0x3c6e7d,{'showHidden':![],'depth':null}):'');return _0x33cdef(null);});}return _0x33cdef(null);});};exports[_0x26b5('0x1d')]=function(_0x44ba86){return new BPromise(function(_0x29374d,_0x307514){if(_0x44ba86){return client['request'](_0x26b5('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x26b5('0x10'),_0x26b5('0x1f'),_0x26b5('0x20'),'acwTimeout'],'where':{'name':_0x44ba86},'limit':0x1}})[_0x26b5('0xd')](function(_0x5ba185){logger[_0x26b5('0xa')](_0x26b5('0x21'),_0x44ba86,_0x5ba185?util[_0x26b5('0x9')](_0x5ba185,{'showHidden':![],'depth':null}):'');logger[_0x26b5('0x8')](_0x26b5('0x22'),_0x44ba86,_0x5ba185?'found':_0x26b5('0x18'));return _0x29374d(_0x5ba185[_0x26b5('0x13')][_0x26b5('0x14')]?_0x5ba185['result'][0x0]:null);})[_0x26b5('0x19')](function(_0x452a86){logger[_0x26b5('0xb')]('[utils][getVoiceQueueByName]',_0x452a86?util[_0x26b5('0x9')](_0x452a86,{'showHidden':![],'depth':null}):'');return _0x29374d(null);});}return _0x29374d(null);});};exports['addTime']=function(_0x53e6ac,_0x486c1a){return moment(_0x53e6ac)[_0x26b5('0x23')](_0x486c1a,_0x26b5('0x24'))['format'](_0x26b5('0x25'));};exports[_0x26b5('0x26')]=function(_0x40986f,_0x2d923d){return moment(_0x40986f)[_0x26b5('0x27')](_0x2d923d,_0x26b5('0x24'))[_0x26b5('0x28')](_0x26b5('0x25'));};exports[_0x26b5('0x29')]=function(_0x38460a,_0x3fea73){return moment(_0x38460a)[_0x26b5('0x2a')](moment(_0x3fea73),_0x26b5('0x24'));};exports[_0x26b5('0x2b')]=function(_0x48a14d,_0x49f377){return parseInt(_0x48a14d,0xa)+parseInt(_0x49f377,0xa);};exports[_0x26b5('0x2c')]=function(){return moment()['format'](_0x26b5('0x25'));};exports[_0x26b5('0x2d')]=function(_0x118429,_0x42ab6d){if(_0x42ab6d){return moment(_0x118429)[_0x26b5('0x2d')](_0x42ab6d);}return!![];};exports[_0x26b5('0x2e')]=function(_0x56b664,_0x2fac9a){if(_0x2fac9a){return moment(_0x56b664)[_0x26b5('0x2e')](_0x2fac9a);}else if(_0x56b664){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 9458494..a49f308 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 _0x6b66=['inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','x-forwarded-for','name','device','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','catch','user','then','data','api','auth','set','client-side-logger','isEmpty','body','format','method','headers','connection','remoteAddress','statusCode','responseTime','role'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x6b66,0x16c));var _0x66b6=function(_0x118835,_0x5002cf){_0x118835=_0x118835-0x0;var _0x4f1c6a=_0x6b66[_0x118835];return _0x4f1c6a;};var fs=require(_0x66b6('0x0'));var _=require(_0x66b6('0x1'));var ewinston=require(_0x66b6('0x2'));var path=require(_0x66b6('0x3'));var util=require('util');var fileLogger=require(_0x66b6('0x4'))[_0x66b6('0x5')];var safeTemplate=require('./safe-template')[_0x66b6('0x6')];var maskSensitiveData=require(_0x66b6('0x7'))[_0x66b6('0x8')];function ClientSideLogger(){function _0x2cb5b5(_0xee85bb){var _0x45ddda=path[_0x66b6('0x9')](_0x66b6('0xa'),_0x66b6('0xb'),_0x66b6('0xc'));var _0x41e9fc=path[_0x66b6('0x9')](_0x66b6('0xd'),_0xee85bb['role']+'-'+_0xee85bb['name']);return fs['ensureDir'](path[_0x66b6('0x9')](_0x45ddda,_0x41e9fc))['then'](function(){var _0x95de60=fileLogger(_0x66b6('0xd'),path[_0x66b6('0x9')](_0x45ddda,_0x41e9fc));return _0x95de60;})[_0x66b6('0xe')](function(_0x588472){throw _0x588472;});}this[_0x66b6('0xb')]=function(_0x719834,_0x27e9eb,_0x51bcf3,_0x15bdfa){return _0x2cb5b5(_0x719834[_0x66b6('0xf')])['then'](function(_0x35a880){var _0x50443e=_0x35a880[_0x27e9eb];return _0x50443e;})[_0x66b6('0x10')](function(_0x2bfac7){var _0x315b8f=_0x719834[_0x66b6('0xf')]?_0x719834[_0x66b6('0xf')]['id']:'no-user';var _0x1b89f1=_0x15bdfa[_0x66b6('0x11')];var _0x2fc69e=_0x15bdfa['timestamp'];var _0x517d1a=new Date(Number(_0x2fc69e));return _0x2bfac7(_0x315b8f,_0x517d1a,_0x51bcf3,_0x1b89f1);})['catch'](function(_0x3750b0){fileLogger(_0x66b6('0xd'))['error'](_0x3750b0);});};}function setupLoggers(_0x908716){return new Promise(function(_0x2aaf8f){var _0x2bad6a=new ClientSideLogger();var _0x4268b7=fileLogger(_0x66b6('0x12'));var _0x4c60fb=fileLogger(_0x66b6('0x13'));_0x908716[_0x66b6('0x14')](_0x66b6('0x15'),_0x2bad6a);_0x908716['use'](ewinston['logger']({'winstonInstance':_0x4268b7,'meta':![],'statusLevels':!![],'msg':function(_0x3bf93d,_0x4ff5cc){var _0x5592='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x66b6('0x16')](_0x3bf93d[_0x66b6('0x17')])){_0x5592+='\x20body=%s';var _0x56ae71=_0x3bf93d[_0x66b6('0x17')];maskSensitiveData(_0x56ae71);}return safeTemplate(util[_0x66b6('0x18')](_0x5592,_0x3bf93d[_0x66b6('0x19')],_0x3bf93d['headers']['x-forwarded-for']?_0x3bf93d[_0x66b6('0x1a')]['x-forwarded-for']:_0x3bf93d[_0x66b6('0x1b')][_0x66b6('0x1c')]||_0x3bf93d['ip'],_0x3bf93d['url'],_0x4ff5cc[_0x66b6('0x1d')],_0x4ff5cc[_0x66b6('0x1e')],_0x3bf93d[_0x66b6('0xf')]?_0x3bf93d[_0x66b6('0xf')]['id']:null,_0x3bf93d[_0x66b6('0xf')]?_0x3bf93d[_0x66b6('0xf')]['name']:null,_0x3bf93d['user']?_0x3bf93d['user'][_0x66b6('0x1f')]:null,_0x56ae71?util[_0x66b6('0x20')](_0x56ae71,![],null):''));}}));_0x908716[_0x66b6('0x21')](ewinston['logger']({'winstonInstance':_0x4c60fb,'meta':![],'statusLevels':!![],'msg':function(_0x2af2c4,_0x167300){var _0x70126d=_0x66b6('0x22');if(_0x2af2c4[_0x66b6('0x17')]&&_0x2af2c4[_0x66b6('0x17')]['device']&&_0x2af2c4[_0x66b6('0x17')][_0x66b6('0x23')]){_0x70126d=_0x66b6('0x24');}return util[_0x66b6('0x18')](_0x70126d,_0x2af2c4['method'],_0x2af2c4[_0x66b6('0x1a')]['x-forwarded-for']?_0x2af2c4[_0x66b6('0x1a')][_0x66b6('0x25')]:_0x2af2c4['connection']['remoteAddress']||_0x2af2c4['ip'],_0x2af2c4['url'],_0x167300[_0x66b6('0x1d')],_0x167300[_0x66b6('0x1e')],_0x2af2c4[_0x66b6('0xf')]?_0x2af2c4['user']['id']:null,_0x2af2c4[_0x66b6('0xf')]?_0x2af2c4[_0x66b6('0xf')][_0x66b6('0x26')]:null,_0x2af2c4[_0x66b6('0xf')]?_0x2af2c4[_0x66b6('0xf')][_0x66b6('0x1f')]:null,_0x2af2c4[_0x66b6('0x17')]&&_0x2af2c4['body'][_0x66b6('0x27')]?_0x2af2c4[_0x66b6('0x17')][_0x66b6('0x27')]:_0x66b6('0x28'),_0x2af2c4[_0x66b6('0x17')]&&_0x2af2c4[_0x66b6('0x17')][_0x66b6('0x23')]?_0x2af2c4[_0x66b6('0x17')][_0x66b6('0x23')]:'',_0x2af2c4[_0x66b6('0x17')]&&_0x2af2c4[_0x66b6('0x17')][_0x66b6('0x29')]?_0x2af2c4[_0x66b6('0x17')][_0x66b6('0x29')]:'');},'ignoreRoute':function(_0x80cd66){var _0x2501c9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2501c9[_0x66b6('0x2a')](_0x80cd66['url']);}}));return _0x2aaf8f();});}exports[_0x66b6('0x2b')]=setupLoggers; \ No newline at end of file +var _0x6492=['./loggers','fileLogger','maskSensitiveData','join','/var','xcally','client','role','name','ensureDir','then','log','user','data','timestamp','catch','api','auth','set','client-side-logger','use','logger','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','test','setupLoggers','lodash','express-winston','path','util'];(function(_0x39a12f,_0x1f6cfe){var _0x1f8856=function(_0x3772cd){while(--_0x3772cd){_0x39a12f['push'](_0x39a12f['shift']());}};_0x1f8856(++_0x1f6cfe);}(_0x6492,0x1b4));var _0x2649=function(_0x4d5d16,_0x51e3b3){_0x4d5d16=_0x4d5d16-0x0;var _0x1a8ebc=_0x6492[_0x4d5d16];return _0x1a8ebc;};var fs=require('fs-extra');var _=require(_0x2649('0x0'));var ewinston=require(_0x2649('0x1'));var path=require(_0x2649('0x2'));var util=require(_0x2649('0x3'));var fileLogger=require(_0x2649('0x4'))[_0x2649('0x5')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x2649('0x6')];function ClientSideLogger(){function _0x419d92(_0x519776){var _0x221fc6=path[_0x2649('0x7')](_0x2649('0x8'),'log',_0x2649('0x9'));var _0x17590b=path[_0x2649('0x7')](_0x2649('0xa'),_0x519776[_0x2649('0xb')]+'-'+_0x519776[_0x2649('0xc')]);return fs[_0x2649('0xd')](path[_0x2649('0x7')](_0x221fc6,_0x17590b))[_0x2649('0xe')](function(){var _0x114c72=fileLogger(_0x2649('0xa'),path[_0x2649('0x7')](_0x221fc6,_0x17590b));return _0x114c72;})['catch'](function(_0x30fdd){throw _0x30fdd;});}this[_0x2649('0xf')]=function(_0x219ca1,_0x242e6b,_0x275155,_0x5b4408){return _0x419d92(_0x219ca1[_0x2649('0x10')])['then'](function(_0x1f7074){var _0x1c5e65=_0x1f7074[_0x242e6b];return _0x1c5e65;})[_0x2649('0xe')](function(_0x59f6ad){var _0x315a96=_0x219ca1['user']?_0x219ca1['user']['id']:'no-user';var _0x2c2692=_0x5b4408[_0x2649('0x11')];var _0x584a2c=_0x5b4408[_0x2649('0x12')];var _0x336fbe=new Date(Number(_0x584a2c));return _0x59f6ad(_0x315a96,_0x336fbe,_0x275155,_0x2c2692);})[_0x2649('0x13')](function(_0x4a8db1){fileLogger(_0x2649('0xa'))['error'](_0x4a8db1);});};}function setupLoggers(_0x2dd404){return new Promise(function(_0x4ba41a){var _0x1136aa=new ClientSideLogger();var _0x3e8c34=fileLogger(_0x2649('0x14'));var _0x4a1162=fileLogger(_0x2649('0x15'));_0x2dd404[_0x2649('0x16')](_0x2649('0x17'),_0x1136aa);_0x2dd404[_0x2649('0x18')](ewinston[_0x2649('0x19')]({'winstonInstance':_0x3e8c34,'meta':![],'statusLevels':!![],'msg':function(_0x23bef0,_0x521337){var _0xee35b3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x23bef0[_0x2649('0x1a')])){_0xee35b3+=_0x2649('0x1b');var _0x260fcf=_0x23bef0[_0x2649('0x1a')];maskSensitiveData(_0x260fcf);}return safeTemplate(util[_0x2649('0x1c')](_0xee35b3,_0x23bef0[_0x2649('0x1d')],_0x23bef0[_0x2649('0x1e')][_0x2649('0x1f')]?_0x23bef0['headers'][_0x2649('0x1f')]:_0x23bef0[_0x2649('0x20')][_0x2649('0x21')]||_0x23bef0['ip'],_0x23bef0[_0x2649('0x22')],_0x521337[_0x2649('0x23')],_0x521337[_0x2649('0x24')],_0x23bef0[_0x2649('0x10')]?_0x23bef0[_0x2649('0x10')]['id']:null,_0x23bef0[_0x2649('0x10')]?_0x23bef0[_0x2649('0x10')][_0x2649('0xc')]:null,_0x23bef0[_0x2649('0x10')]?_0x23bef0[_0x2649('0x10')][_0x2649('0xb')]:null,_0x260fcf?util[_0x2649('0x25')](_0x260fcf,![],null):''));}}));_0x2dd404[_0x2649('0x18')](ewinston[_0x2649('0x19')]({'winstonInstance':_0x4a1162,'meta':![],'statusLevels':!![],'msg':function(_0x37cb1f,_0x3374ed){var _0xc56440='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x37cb1f['body']&&_0x37cb1f[_0x2649('0x1a')][_0x2649('0x26')]&&_0x37cb1f[_0x2649('0x1a')][_0x2649('0x27')]){_0xc56440=_0x2649('0x28');}return util[_0x2649('0x1c')](_0xc56440,_0x37cb1f[_0x2649('0x1d')],_0x37cb1f[_0x2649('0x1e')][_0x2649('0x1f')]?_0x37cb1f[_0x2649('0x1e')][_0x2649('0x1f')]:_0x37cb1f[_0x2649('0x20')][_0x2649('0x21')]||_0x37cb1f['ip'],_0x37cb1f['url'],_0x3374ed[_0x2649('0x23')],_0x3374ed[_0x2649('0x24')],_0x37cb1f[_0x2649('0x10')]?_0x37cb1f[_0x2649('0x10')]['id']:null,_0x37cb1f[_0x2649('0x10')]?_0x37cb1f[_0x2649('0x10')][_0x2649('0xc')]:null,_0x37cb1f['user']?_0x37cb1f[_0x2649('0x10')][_0x2649('0xb')]:null,_0x37cb1f['body']&&_0x37cb1f[_0x2649('0x1a')][_0x2649('0x26')]?_0x37cb1f[_0x2649('0x1a')][_0x2649('0x26')]:'other',_0x37cb1f[_0x2649('0x1a')]&&_0x37cb1f[_0x2649('0x1a')][_0x2649('0x27')]?_0x37cb1f[_0x2649('0x1a')][_0x2649('0x27')]:'',_0x37cb1f['body']&&_0x37cb1f['body'][_0x2649('0x29')]?_0x37cb1f[_0x2649('0x1a')][_0x2649('0x29')]:'');},'ignoreRoute':function(_0x36158d){var _0x26c7e1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x26c7e1[_0x2649('0x2a')](_0x36158d['url']);}}));return _0x4ba41a();});}exports[_0x2649('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index f4a7022..4efe3ff 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10a3=['weekdaysShort','toLowerCase','locale','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','dowCompare','date','max','min','domCompare','MMM','includes','monthCompare','guess','isMoment','split','length','iftime','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','map'];(function(_0x2e37d7,_0x57ef82){var _0x1c6384=function(_0x3559dc){while(--_0x3559dc){_0x2e37d7['push'](_0x2e37d7['shift']());}};_0x1c6384(++_0x57ef82);}(_0x10a3,0x95));var _0x310a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x10a3[_0x2641f9];return _0x585741;};var _=require('lodash');var moment=require(_0x310a('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x9f7e02){return _0x9f7e02[_0x310a('0x1')];})[_0x310a('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x310a('0x3');var EINVALID_DATE=_0x310a('0x4');function throwIfDateNotValid(_0x3ce4c8){if(!_0x3ce4c8[_0x310a('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x9f1abe){var _0xeb606e=_0x9f1abe['split'](':')[_0x310a('0x6')](function(_0x2f616f){return parseInt(_0x2f616f,0xa);});var _0x2bab70=_0xeb606e[0x0];var _0x489421=_0xeb606e[0x1];if(_0x2bab70<0x0||_0x2bab70>0x17||_0x489421<0x0||_0x489421>0x3b){throw new Error(EINVALID_DATE);}return[_0x2bab70,_0x489421];}function circularDoWInterval(_0x335beb,_0x12663e){if(_0x335beb===_0x12663e){return[_0x335beb];}else{var _0x638e0f=moment['locale']();moment['locale']('en');var _0x173cbc=moment[_0x310a('0x7')]()[_0x310a('0x6')](function(_0xf09a0f){return _0xf09a0f[_0x310a('0x8')]();});moment[_0x310a('0x9')](_0x638e0f);var _0x4d8073=_0x173cbc[_0x310a('0xa')](_0x335beb);var _0x25e679=_0x173cbc[_0x310a('0xa')](_0x12663e);if(_0x25e679>_0x4d8073){return _0x173cbc['slice'](_0x4d8073,_0x25e679+0x1);}else{var _0x3c9536=_0x173cbc[_0x310a('0xb')](0x0,_0x25e679+0x1);var _0x3b5214=_0x173cbc[_0x310a('0xb')](_0x4d8073);return _0x3b5214[_0x310a('0xc')](_0x3c9536);}}}module[_0x310a('0xd')][_0x310a('0xe')]=circularDoWInterval;function circularMonthInterval(_0x23e0f1,_0x3fe485){if(_0x23e0f1===_0x3fe485){return[_0x23e0f1];}else{var _0x3d7472=moment['locale']();moment['locale']('en');var _0x58c4c4=moment['monthsShort']()[_0x310a('0x6')](function(_0x3cf69d){return _0x3cf69d[_0x310a('0x8')]();});moment[_0x310a('0x9')](_0x3d7472);var _0xfab627=_0x58c4c4[_0x310a('0xa')](_0x23e0f1);var _0x19aba3=_0x58c4c4[_0x310a('0xa')](_0x3fe485);if(_0x19aba3>_0xfab627){return _0x58c4c4['slice'](_0xfab627,_0x19aba3+0x1);}else{var _0x4e5ba3=_0x58c4c4[_0x310a('0xb')](0x0,_0x19aba3+0x1);var _0x3f6d32=_0x58c4c4[_0x310a('0xb')](_0xfab627);return _0x3f6d32[_0x310a('0xc')](_0x4e5ba3);}}}module['exports'][_0x310a('0xf')]=circularMonthInterval;function parseDom(_0x144b41){var _0x2b5351=parseInt(_0x144b41,0xa);if(_0x2b5351<0x1||_0x2b5351>0x1f){throw new Error(EINVALID_DATE);}return _0x2b5351;}function timeCompare(_0x1fee62,_0x18730c,_0x48e969){var _0x430496=_0x1fee62['clone']();var _0x1852e6=extractTime(_0x18730c);var _0x157a23=_0x1852e6[0x0];var _0x21e935=_0x1852e6[0x1];var _0x329080=_0x1fee62[_0x310a('0x10')]()[_0x310a('0x11')](_0x157a23)[_0x310a('0x12')](_0x21e935);throwIfDateNotValid(_0x329080);var _0x34f1a4=extractTime(_0x48e969);var _0x1cc90f=_0x34f1a4[0x0];var _0x5348c5=_0x34f1a4[0x1];var _0x29542b=_0x1fee62['clone']()[_0x310a('0x11')](_0x1cc90f)[_0x310a('0x12')](_0x5348c5);throwIfDateNotValid(_0x29542b);if(_0x29542b[_0x310a('0x13')](_0x329080)){var _0x29712f=_0x430496[_0x310a('0x10')]()[_0x310a('0x14')](_0x310a('0x15'));var _0x43ae5d=_0x430496[_0x310a('0x10')]()['endOf']('day');return _0x430496[_0x310a('0x16')](_0x329080,_0x43ae5d,undefined,'[]')||_0x430496['isBetween'](_0x29712f,_0x29542b,undefined,'[]');}else{return _0x430496[_0x310a('0x16')](_0x329080,_0x29542b,undefined,'[]');}}module[_0x310a('0xd')][_0x310a('0x17')]=timeCompare;function dowCompare(_0x1a8140,_0x8f8646,_0x24a4a0){var _0x38b618=_0x1a8140['locale']('en')[_0x310a('0x18')](_0x310a('0x19'))[_0x310a('0x8')]();return circularDoWInterval(_0x8f8646,_0x24a4a0)['includes'](_0x38b618);}module[_0x310a('0xd')][_0x310a('0x1a')]=dowCompare;function domCompare(_0x5b7902,_0x44f65a,_0x17f37c){var _0x1a198c=_0x5b7902[_0x310a('0x1b')]();if(_0x44f65a===_0x17f37c){return _0x1a198c===_0x44f65a;}else{var _0x578e13=_0x5b7902['daysInMonth']();var _0x59996f=_0x44f65a<_0x17f37c;let _0x10b90b=![];var _0x1732ef=0x0;var _0x1a187e=0x0;if(_0x59996f){_0x1732ef=Math[_0x310a('0x1c')](0x1,_0x44f65a);_0x1a187e=Math[_0x310a('0x1d')](_0x17f37c,_0x578e13);_0x10b90b=_0x1a198c>=_0x1732ef&&_0x1a198c<=_0x1a187e;}else{_0x1732ef=Math[_0x310a('0x1d')](_0x44f65a,_0x578e13);_0x1a187e=Math[_0x310a('0x1c')](0x1,_0x17f37c);_0x10b90b=_0x1a198c>=_0x1732ef||_0x1a198c<=_0x1a187e;}return _0x10b90b;}}module['exports'][_0x310a('0x1e')]=domCompare;function monthCompare(_0x582cf2,_0x503100,_0x6599b9){var _0x3d3b07=_0x582cf2['locale']('en')[_0x310a('0x18')](_0x310a('0x1f'))[_0x310a('0x8')]();return circularMonthInterval(_0x503100,_0x6599b9)[_0x310a('0x20')](_0x3d3b07);}module[_0x310a('0xd')][_0x310a('0x21')]=monthCompare;function iftime(_0x375223,_0x5f4740=moment['tz'][_0x310a('0x22')](),_0x181f62=moment()){if(!validateRx['test'](_0x375223)){throw new Error(EINVALID_STRING);}else{var _0x52ab34=(moment[_0x310a('0x23')](_0x181f62)?_0x181f62[_0x310a('0x10')]():moment(_0x181f62))['tz'](_0x5f4740)[_0x310a('0x9')]('en');throwIfDateNotValid(_0x52ab34);var _0x250f51=_0x375223[_0x310a('0x24')](',');var _0x423069=_0x250f51[0x0];var _0x50cdd3=_0x250f51[0x1];var _0x5c5aa5=_0x250f51[0x2];var _0x39a9ad=_0x250f51[0x3];let _0x589764=!![];if(_0x423069!=='*'){var _0x29b551=_0x423069['split']('-');var _0x9ec8eb=_['padStart'](_0x29b551[0x0],0x5,'0');var _0x2e2723=_0x29b551['length']===0x2?_['padStart'](_0x29b551[0x1],0x5,'0'):_0x9ec8eb;_0x589764=timeCompare(_0x52ab34,_0x9ec8eb,_0x2e2723);}let _0x5d4315=!![];if(_0x50cdd3!=='*'){var _0x2e4aae=_0x50cdd3[_0x310a('0x24')]('-');var _0x3a8592=_0x2e4aae[0x0];var _0x28e92a=_0x2e4aae['length']===0x2?_0x2e4aae[0x1]:_0x3a8592;_0x5d4315=dowCompare(_0x52ab34,_0x3a8592,_0x28e92a);}let _0x3b41a5=!![];if(_0x5c5aa5!=='*'){var _0x391b00=_0x5c5aa5[_0x310a('0x24')]('-');var _0x3fdc73=parseDom(_0x391b00[0x0]);var _0x12de71=_0x391b00[_0x310a('0x25')]===0x2?parseDom(_0x391b00[0x1]):_0x3fdc73;_0x3b41a5=domCompare(_0x52ab34,_0x3fdc73,_0x12de71);}let _0x1dd07f=!![];if(_0x39a9ad!=='*'){var _0x28022d=_0x39a9ad[_0x310a('0x24')]('-');var _0x48a697=_0x28022d[0x0];var _0x5c0165=_0x28022d[_0x310a('0x25')]===0x2?_0x28022d[0x1]:_0x28022d[0x0];_0x1dd07f=monthCompare(_0x52ab34,_0x48a697,_0x5c0165);}return _0x589764&&_0x5d4315&&_0x3b41a5&&_0x1dd07f;}}module['exports'][_0x310a('0x26')]=iftime; \ No newline at end of file +var _0xc2bd=['indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','lodash','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','toLowerCase'];(function(_0x58220b,_0x502089){var _0x2125a6=function(_0x41ab7d){while(--_0x41ab7d){_0x58220b['push'](_0x58220b['shift']());}};_0x2125a6(++_0x502089);}(_0xc2bd,0x13e));var _0xdc2b=function(_0xf6c032,_0x3515ad){_0xf6c032=_0xf6c032-0x0;var _0x5da177=_0xc2bd[_0xf6c032];return _0x5da177;};var _=require(_0xdc2b('0x0'));var moment=require(_0xdc2b('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][_0xdc2b('0x2')](function(_0x491c7f){return _0x491c7f[_0xdc2b('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xdc2b('0x4');var EINVALID_DATE=_0xdc2b('0x5');function throwIfDateNotValid(_0x4f6795){if(!_0x4f6795['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5cc7b5){var _0x2f8d7c=_0x5cc7b5[_0xdc2b('0x6')](':')[_0xdc2b('0x2')](function(_0x3042de){return parseInt(_0x3042de,0xa);});var _0x3cc44f=_0x2f8d7c[0x0];var _0x5e66f1=_0x2f8d7c[0x1];if(_0x3cc44f<0x0||_0x3cc44f>0x17||_0x5e66f1<0x0||_0x5e66f1>0x3b){throw new Error(EINVALID_DATE);}return[_0x3cc44f,_0x5e66f1];}function circularDoWInterval(_0x8b140,_0x21fa32){if(_0x8b140===_0x21fa32){return[_0x8b140];}else{var _0x7f2876=moment[_0xdc2b('0x7')]();moment[_0xdc2b('0x7')]('en');var _0x59aafc=moment[_0xdc2b('0x8')]()['map'](function(_0x42b8fd){return _0x42b8fd[_0xdc2b('0x9')]();});moment[_0xdc2b('0x7')](_0x7f2876);var _0x3e53a1=_0x59aafc['indexOf'](_0x8b140);var _0x1739b2=_0x59aafc[_0xdc2b('0xa')](_0x21fa32);if(_0x1739b2>_0x3e53a1){return _0x59aafc['slice'](_0x3e53a1,_0x1739b2+0x1);}else{var _0x52fcdf=_0x59aafc[_0xdc2b('0xb')](0x0,_0x1739b2+0x1);var _0x31ee7f=_0x59aafc[_0xdc2b('0xb')](_0x3e53a1);return _0x31ee7f[_0xdc2b('0xc')](_0x52fcdf);}}}module[_0xdc2b('0xd')][_0xdc2b('0xe')]=circularDoWInterval;function circularMonthInterval(_0x431fb1,_0x2bf8dc){if(_0x431fb1===_0x2bf8dc){return[_0x431fb1];}else{var _0x44ac59=moment[_0xdc2b('0x7')]();moment[_0xdc2b('0x7')]('en');var _0x4d76b9=moment[_0xdc2b('0xf')]()[_0xdc2b('0x2')](function(_0x18b566){return _0x18b566['toLowerCase']();});moment[_0xdc2b('0x7')](_0x44ac59);var _0x181e8b=_0x4d76b9[_0xdc2b('0xa')](_0x431fb1);var _0x29d1b0=_0x4d76b9[_0xdc2b('0xa')](_0x2bf8dc);if(_0x29d1b0>_0x181e8b){return _0x4d76b9[_0xdc2b('0xb')](_0x181e8b,_0x29d1b0+0x1);}else{var _0xc102f0=_0x4d76b9['slice'](0x0,_0x29d1b0+0x1);var _0x26bd9b=_0x4d76b9[_0xdc2b('0xb')](_0x181e8b);return _0x26bd9b[_0xdc2b('0xc')](_0xc102f0);}}}module[_0xdc2b('0xd')][_0xdc2b('0x10')]=circularMonthInterval;function parseDom(_0x487036){var _0x67b6f=parseInt(_0x487036,0xa);if(_0x67b6f<0x1||_0x67b6f>0x1f){throw new Error(EINVALID_DATE);}return _0x67b6f;}function timeCompare(_0x5e5f8a,_0x2d7ac0,_0xf2b8ad){var _0x11c4da=_0x5e5f8a[_0xdc2b('0x11')]();var _0x2d0374=extractTime(_0x2d7ac0);var _0x189396=_0x2d0374[0x0];var _0x226786=_0x2d0374[0x1];var _0x137069=_0x5e5f8a[_0xdc2b('0x11')]()[_0xdc2b('0x12')](_0x189396)[_0xdc2b('0x13')](_0x226786);throwIfDateNotValid(_0x137069);var _0x55c1f4=extractTime(_0xf2b8ad);var _0x457ace=_0x55c1f4[0x0];var _0x38d4ef=_0x55c1f4[0x1];var _0x337ec0=_0x5e5f8a['clone']()[_0xdc2b('0x12')](_0x457ace)['minutes'](_0x38d4ef);throwIfDateNotValid(_0x337ec0);if(_0x337ec0[_0xdc2b('0x14')](_0x137069)){var _0x1922be=_0x11c4da[_0xdc2b('0x11')]()[_0xdc2b('0x15')]('day');var _0x1b6fb8=_0x11c4da[_0xdc2b('0x11')]()['endOf'](_0xdc2b('0x16'));return _0x11c4da[_0xdc2b('0x17')](_0x137069,_0x1b6fb8,undefined,'[]')||_0x11c4da[_0xdc2b('0x17')](_0x1922be,_0x337ec0,undefined,'[]');}else{return _0x11c4da[_0xdc2b('0x17')](_0x137069,_0x337ec0,undefined,'[]');}}module[_0xdc2b('0xd')][_0xdc2b('0x18')]=timeCompare;function dowCompare(_0x4d08e6,_0x3646d9,_0x31a8c0){var _0xc7a89d=_0x4d08e6[_0xdc2b('0x7')]('en')[_0xdc2b('0x19')](_0xdc2b('0x1a'))[_0xdc2b('0x9')]();return circularDoWInterval(_0x3646d9,_0x31a8c0)[_0xdc2b('0x1b')](_0xc7a89d);}module['exports'][_0xdc2b('0x1c')]=dowCompare;function domCompare(_0x336a70,_0x1f5403,_0x547340){var _0x448a97=_0x336a70[_0xdc2b('0x1d')]();if(_0x1f5403===_0x547340){return _0x448a97===_0x1f5403;}else{var _0x45771d=_0x336a70[_0xdc2b('0x1e')]();var _0x160314=_0x1f5403<_0x547340;let _0x37767d=![];var _0x4eae6b=0x0;var _0xbdf53a=0x0;if(_0x160314){_0x4eae6b=Math[_0xdc2b('0x1f')](0x1,_0x1f5403);_0xbdf53a=Math[_0xdc2b('0x20')](_0x547340,_0x45771d);_0x37767d=_0x448a97>=_0x4eae6b&&_0x448a97<=_0xbdf53a;}else{_0x4eae6b=Math[_0xdc2b('0x20')](_0x1f5403,_0x45771d);_0xbdf53a=Math['max'](0x1,_0x547340);_0x37767d=_0x448a97>=_0x4eae6b||_0x448a97<=_0xbdf53a;}return _0x37767d;}}module[_0xdc2b('0xd')][_0xdc2b('0x21')]=domCompare;function monthCompare(_0x19b3c5,_0x5ea14f,_0x454bb2){var _0x5379a8=_0x19b3c5['locale']('en')[_0xdc2b('0x19')](_0xdc2b('0x22'))[_0xdc2b('0x9')]();return circularMonthInterval(_0x5ea14f,_0x454bb2)['includes'](_0x5379a8);}module[_0xdc2b('0xd')][_0xdc2b('0x23')]=monthCompare;function iftime(_0x438695,_0x356ca7=moment['tz'][_0xdc2b('0x24')](),_0x54b7d0=moment()){if(!validateRx[_0xdc2b('0x25')](_0x438695)){throw new Error(EINVALID_STRING);}else{var _0x13eafe=(moment[_0xdc2b('0x26')](_0x54b7d0)?_0x54b7d0['clone']():moment(_0x54b7d0))['tz'](_0x356ca7)[_0xdc2b('0x7')]('en');throwIfDateNotValid(_0x13eafe);var _0x32e639=_0x438695[_0xdc2b('0x6')](',');var _0x1a3d09=_0x32e639[0x0];var _0x43f713=_0x32e639[0x1];var _0x25d81c=_0x32e639[0x2];var _0x12800a=_0x32e639[0x3];let _0x3e21ea=!![];if(_0x1a3d09!=='*'){var _0x54a6de=_0x1a3d09[_0xdc2b('0x6')]('-');var _0x48be1=_[_0xdc2b('0x27')](_0x54a6de[0x0],0x5,'0');var _0x39e602=_0x54a6de[_0xdc2b('0x28')]===0x2?_['padStart'](_0x54a6de[0x1],0x5,'0'):_0x48be1;_0x3e21ea=timeCompare(_0x13eafe,_0x48be1,_0x39e602);}let _0x48cfa9=!![];if(_0x43f713!=='*'){var _0x261b57=_0x43f713[_0xdc2b('0x6')]('-');var _0x53a977=_0x261b57[0x0];var _0x2ca6ab=_0x261b57[_0xdc2b('0x28')]===0x2?_0x261b57[0x1]:_0x53a977;_0x48cfa9=dowCompare(_0x13eafe,_0x53a977,_0x2ca6ab);}let _0x49e50a=!![];if(_0x25d81c!=='*'){var _0x48fb2a=_0x25d81c[_0xdc2b('0x6')]('-');var _0x16438a=parseDom(_0x48fb2a[0x0]);var _0x49cd32=_0x48fb2a[_0xdc2b('0x28')]===0x2?parseDom(_0x48fb2a[0x1]):_0x16438a;_0x49e50a=domCompare(_0x13eafe,_0x16438a,_0x49cd32);}let _0x3546d1=!![];if(_0x12800a!=='*'){var _0x20c949=_0x12800a['split']('-');var _0x35ef0d=_0x20c949[0x0];var _0x3de325=_0x20c949[_0xdc2b('0x28')]===0x2?_0x20c949[0x1]:_0x20c949[0x0];_0x3546d1=monthCompare(_0x13eafe,_0x35ef0d,_0x3de325);}return _0x3e21ea&&_0x48cfa9&&_0x49e50a&&_0x3546d1;}}module['exports']['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 2082e04..a91da9f 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d8c=['replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','level','Logger','transports','warn','File','%s-%s','error','Console','fileLogger','util','winston','debugLevel','toLowerCase','info','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message'];(function(_0x11a81d,_0x1a066e){var _0x59f115=function(_0x357d2e){while(--_0x357d2e){_0x11a81d['push'](_0x11a81d['shift']());}};_0x59f115(++_0x1a066e);}(_0x9d8c,0x116));var _0xc9d8=function(_0x5b975a,_0x41af11){_0x5b975a=_0x5b975a-0x0;var _0x1859fc=_0x9d8c[_0x5b975a];return _0x1859fc;};'use strict';var path=require('path');var util=require(_0xc9d8('0x0'));var moment=require('moment');var winston=require(_0xc9d8('0x1'));var config=require('../config/environment');var debugLevel=config[_0xc9d8('0x2')]?config[_0xc9d8('0x2')][_0xc9d8('0x3')]():_0xc9d8('0x4');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':_0xc9d8('0x5'),'warn':_0xc9d8('0x6'),'info':'white','print':_0xc9d8('0x7'),'success':_0xc9d8('0x8'),'http':_0xc9d8('0x9'),'verbose':_0xc9d8('0xa'),'debug':_0xc9d8('0xb'),'silly':_0xc9d8('0xc')};winston[_0xc9d8('0xd')](XC_LOG_COLORS);function getLogFileName(_0x324f70,_0x5135f7,_0x557039){var _0x14d83e=_0x324f70||_0xc9d8('0xe');return path[_0xc9d8('0xf')](_0x14d83e,util['format'](_0xc9d8('0x10'),_0x5135f7,_0x557039));}function formatter(_0x1b7377,_0x46ee7e){_0x46ee7e[_0xc9d8('0x11')]=_0x46ee7e[_0xc9d8('0x11')][_0xc9d8('0x12')](/@@{/g,_0xc9d8('0x13'))[_0xc9d8('0x12')](/}@@/g,_0xc9d8('0x14'))[_0xc9d8('0x12')](/@{/g,'{{')[_0xc9d8('0x12')](/}@/g,'}}');return util[_0xc9d8('0x15')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xc9d8('0x15')](_0xc9d8('0x16')),_0x46ee7e['level'][_0xc9d8('0x17')](),_0x1b7377,_0x46ee7e['message']);}function fileFormat(_0xb51cf2,_0x46471a){_0x46471a[_0xc9d8('0x11')]=_0x46471a[_0xc9d8('0x11')]['replace'](/@@{/g,_0xc9d8('0x13'))[_0xc9d8('0x12')](/}@@/g,_0xc9d8('0x14'))['replace'](/@{/g,'{{')[_0xc9d8('0x12')](/}@/g,'}}');var _0x544986=_0x46471a[_0xc9d8('0x18')]&&Object[_0xc9d8('0x19')](_0x46471a['meta'])[_0xc9d8('0x1a')]?'\x0a\x09'+JSON[_0xc9d8('0x1b')](_0x46471a[_0xc9d8('0x18')]):'';return util[_0xc9d8('0x15')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xc9d8('0x15')](_0xc9d8('0x16')),_0x46471a[_0xc9d8('0x1c')][_0xc9d8('0x17')](),_0xb51cf2,_0x46471a[_0xc9d8('0x11')],_0x544986);}function consoleLogger(){var _0x30301c=new winston[(_0xc9d8('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc9d8('0x1e'))]['Console']({'level':_0xc9d8('0x1f'),'json':![],'formatter':function(_0x10e2a4){return formatter('',_0x10e2a4);}})]});return _0x30301c;}function fileLogger(_0x1b28aa,_0x2254e1){var _0x203679=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc9d8('0x1e'))][(_0xc9d8('0x20'))]({'name':util[_0xc9d8('0x15')](_0xc9d8('0x21'),_0x1b28aa,_0xc9d8('0x22')),'filename':getLogFileName(_0x2254e1,_0x1b28aa,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5bb3d4){return fileFormat(_0x1b28aa,_0x5bb3d4);}}),new winston[(_0xc9d8('0x1e'))][(_0xc9d8('0x20'))]({'name':util['format'](_0xc9d8('0x21'),_0x1b28aa,debugLevel),'filename':getLogFileName(_0x2254e1,_0x1b28aa,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x8720ad){return fileFormat(_0x1b28aa,_0x8720ad);}}),new winston[(_0xc9d8('0x1e'))][(_0xc9d8('0x23'))]({'level':'warn','json':![],'formatter':function(_0x1d2c5d){return fileFormat(_0x1b28aa,_0x1d2c5d);}})]});return _0x203679;}exports['consoleLogger']=consoleLogger;exports[_0xc9d8('0x24')]=fileLogger; \ No newline at end of file +var _0xbb8d=['addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','warn','transports','File','%s-%s','error','Console','fileLogger','path','util','moment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan'];(function(_0x3e3e70,_0x281ac2){var _0xb363c9=function(_0x56ce17){while(--_0x56ce17){_0x3e3e70['push'](_0x3e3e70['shift']());}};_0xb363c9(++_0x281ac2);}(_0xbb8d,0x109));var _0xdbb8=function(_0x46bcfa,_0x201ae5){_0x46bcfa=_0x46bcfa-0x0;var _0x2d15e4=_0xbb8d[_0x46bcfa];return _0x2d15e4;};'use strict';var path=require(_0xdbb8('0x0'));var util=require(_0xdbb8('0x1'));var moment=require(_0xdbb8('0x2'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0xdbb8('0x3')][_0xdbb8('0x4')]():_0xdbb8('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xdbb8('0x6'),'error':_0xdbb8('0x7'),'warn':_0xdbb8('0x8'),'info':_0xdbb8('0x9'),'print':_0xdbb8('0xa'),'success':_0xdbb8('0xb'),'http':_0xdbb8('0xc'),'verbose':_0xdbb8('0xd'),'debug':'bold\x20blue','silly':_0xdbb8('0xe')};winston[_0xdbb8('0xf')](XC_LOG_COLORS);function getLogFileName(_0x6f732a,_0x1d8d5d,_0x263486){var _0x47fb9a=_0x6f732a||_0xdbb8('0x10');return path[_0xdbb8('0x11')](_0x47fb9a,util[_0xdbb8('0x12')](_0xdbb8('0x13'),_0x1d8d5d,_0x263486));}function formatter(_0x30da5a,_0x2cc2ed){_0x2cc2ed[_0xdbb8('0x14')]=_0x2cc2ed[_0xdbb8('0x14')][_0xdbb8('0x15')](/@@{/g,'{{{')[_0xdbb8('0x15')](/}@@/g,_0xdbb8('0x16'))[_0xdbb8('0x15')](/@{/g,'{{')[_0xdbb8('0x15')](/}@/g,'}}');return util['format'](_0xdbb8('0x17'),moment()[_0xdbb8('0x12')](_0xdbb8('0x18')),_0x2cc2ed[_0xdbb8('0x19')][_0xdbb8('0x1a')](),_0x30da5a,_0x2cc2ed['message']);}function fileFormat(_0x11b7b5,_0xf0eda9){_0xf0eda9[_0xdbb8('0x14')]=_0xf0eda9[_0xdbb8('0x14')][_0xdbb8('0x15')](/@@{/g,_0xdbb8('0x1b'))[_0xdbb8('0x15')](/}@@/g,_0xdbb8('0x16'))[_0xdbb8('0x15')](/@{/g,'{{')[_0xdbb8('0x15')](/}@/g,'}}');var _0x419ab9=_0xf0eda9[_0xdbb8('0x1c')]&&Object[_0xdbb8('0x1d')](_0xf0eda9[_0xdbb8('0x1c')])[_0xdbb8('0x1e')]?'\x0a\x09'+JSON['stringify'](_0xf0eda9[_0xdbb8('0x1c')]):'';return util[_0xdbb8('0x12')](_0xdbb8('0x1f'),moment()[_0xdbb8('0x12')](_0xdbb8('0x18')),_0xf0eda9['level']['toUpperCase'](),_0x11b7b5,_0xf0eda9[_0xdbb8('0x14')],_0x419ab9);}function consoleLogger(){var _0x185843=new winston[(_0xdbb8('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0xdbb8('0x21'),'json':![],'formatter':function(_0x45606d){return formatter('',_0x45606d);}})]});return _0x185843;}function fileLogger(_0x127de5,_0x181f35){var _0x12ad08=new winston[(_0xdbb8('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xdbb8('0x22'))][(_0xdbb8('0x23'))]({'name':util[_0xdbb8('0x12')](_0xdbb8('0x24'),_0x127de5,'error'),'filename':getLogFileName(_0x181f35,_0x127de5,_0xdbb8('0x25')),'level':_0xdbb8('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48552a){return fileFormat(_0x127de5,_0x48552a);}}),new winston['transports']['File']({'name':util[_0xdbb8('0x12')](_0xdbb8('0x24'),_0x127de5,debugLevel),'filename':getLogFileName(_0x181f35,_0x127de5,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1b66cb){return fileFormat(_0x127de5,_0x1b66cb);}}),new winston[(_0xdbb8('0x22'))][(_0xdbb8('0x26'))]({'level':_0xdbb8('0x21'),'json':![],'formatter':function(_0x298745){return fileFormat(_0x127de5,_0x298745);}})]});return _0x12ad08;}exports['consoleLogger']=consoleLogger;exports[_0xdbb8('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index fe39c8d..8e09460 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 _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(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x1967,0x173));var _0x7196=function(_0x43049d,_0x33bfe5){_0x43049d=_0x43049d-0x0;var _0x2bf677=_0x1967[_0x43049d];return _0x2bf677;};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 +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x0295,0x1f0));var _0x5029=function(_0x21ba39,_0x413046){_0x21ba39=_0x21ba39-0x0;var _0x7a1e4f=_0x0295[_0x21ba39];return _0x7a1e4f;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index f643936..a78d7b5 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 _0xb62e=['map','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x514df5,_0x3d07c3){var _0x5a63f2=function(_0x4cc1a5){while(--_0x4cc1a5){_0x514df5['push'](_0x514df5['shift']());}};_0x5a63f2(++_0x3d07c3);}(_0xb62e,0x1de));var _0xeb62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb62e[_0x2dafbe];return _0x58a45a;};var _=require(_0xeb62('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x46335b){return _0x46335b==='{{'?_0xeb62('0x1'):_0xeb62('0x2');}function safeTemplate(_0x57a5ba){var _0x3dfdef=_0x57a5ba;if(typeof _0x57a5ba===_0xeb62('0x3')){_0x3dfdef=_0x57a5ba[_0xeb62('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xeb62('0x5')](_0x57a5ba)){_0x3dfdef=_0x57a5ba[_0xeb62('0x6')](function(_0x1ebdbb){return safeTemplate(_0x1ebdbb);});}else if(_['isPlainObject'](_0x57a5ba)){_0x3dfdef=Object[_0xeb62('0x7')](_0x57a5ba)[_0xeb62('0x8')](function(_0x31f5ea,_0x5e0dc4){_0x31f5ea[_0x5e0dc4]=safeTemplate(_0x57a5ba[_0x5e0dc4]);return _0x31f5ea;},{});}return _0x3dfdef;}module[_0xeb62('0x9')][_0xeb62('0xa')]=safeTemplate; \ No newline at end of file +var _0xb03e=['safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','exports'];(function(_0x2a5467,_0x352009){var _0x38243b=function(_0x4f4e8d){while(--_0x4f4e8d){_0x2a5467['push'](_0x2a5467['shift']());}};_0x38243b(++_0x352009);}(_0xb03e,0x1eb));var _0xeb03=function(_0x50abb6,_0x3a1130){_0x50abb6=_0x50abb6-0x0;var _0x456af6=_0xb03e[_0x50abb6];return _0x456af6;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x36351b){return _0x36351b==='{{'?_0xeb03('0x0'):_0xeb03('0x1');}function safeTemplate(_0x3c5e68){var _0x1c58b5=_0x3c5e68;if(typeof _0x3c5e68===_0xeb03('0x2')){_0x1c58b5=_0x3c5e68[_0xeb03('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xeb03('0x4')](_0x3c5e68)){_0x1c58b5=_0x3c5e68[_0xeb03('0x5')](function(_0x3ba4b0){return safeTemplate(_0x3ba4b0);});}else if(_[_0xeb03('0x6')](_0x3c5e68)){_0x1c58b5=Object[_0xeb03('0x7')](_0x3c5e68)['reduce'](function(_0x3b58a2,_0x3d3322){_0x3b58a2[_0x3d3322]=safeTemplate(_0x3c5e68[_0x3d3322]);return _0x3b58a2;},{});}return _0x1c58b5;}module[_0xeb03('0x8')][_0xeb03('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 11f8257..3f0c57a 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 _0xb473=['motion2','env','string','NODE_PATH','pathExists','readJSON','then','updated','exports','fs-extra','path','../config/environment','root','resolve','legacy-libs','isArray','apps','name'];(function(_0x209722,_0x3ecfbc){var _0x1293e0=function(_0x30a297){while(--_0x30a297){_0x209722['push'](_0x209722['shift']());}};_0x1293e0(++_0x3ecfbc);}(_0xb473,0x1b9));var _0x3b47=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xb473[_0x1e4360];return _0x31e6b4;};var fs=require(_0x3b47('0x0'));var path=require(_0x3b47('0x1'));var config=require(_0x3b47('0x2'));var root=config[_0x3b47('0x3')];var APP_JSON_PATH=path[_0x3b47('0x4')](root,'server/app.json');var NODEPATH=path[_0x3b47('0x4')](root,_0x3b47('0x5'));function setLegacyLibsNodeEnvPath(_0x36ca9e){let _0x2a5285=![];if(Array[_0x3b47('0x6')](_0x36ca9e['apps'])){var _0x1231c8=_0x36ca9e[_0x3b47('0x7')]['findIndex'](function(_0x34ad4d){return _0x34ad4d[_0x3b47('0x8')]===_0x3b47('0x9');});if(_0x1231c8>-0x1){var _0x2d1ba4=_0x36ca9e[_0x3b47('0x7')][_0x1231c8];if(typeof _0x2d1ba4[_0x3b47('0xa')]['NODE_PATH']!==_0x3b47('0xb')){_0x2d1ba4[_0x3b47('0xa')][_0x3b47('0xc')]=NODEPATH;_0x2a5285=!![];}}return{'appConfig':_0x36ca9e,'updated':_0x2a5285};}}function updateAppConfig(_0x2fa525){return fs[_0x3b47('0xd')](APP_JSON_PATH)['then'](function(_0x24f98d){if(_0x24f98d){return fs[_0x3b47('0xe')](APP_JSON_PATH)[_0x3b47('0xf')](function(_0x6f6b5b){var _0xa55261=setLegacyLibsNodeEnvPath(_0x6f6b5b);if(_0xa55261[_0x3b47('0x10')]){_0x2fa525['info']('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x6f6b5b,{'spaces':0x2});}else{return Promise[_0x3b47('0x4')]();}});}else{return Promise['resolve']();}});}module[_0x3b47('0x11')]=updateAppConfig; \ No newline at end of file +var _0x393e=['findIndex','name','motion2','env','NODE_PATH','string','readJSON','then','updated','info','Updating\x20app.json','exports','fs-extra','path','root','server/app.json','resolve','legacy-libs','apps'];(function(_0x5f582e,_0x4112b7){var _0x437430=function(_0x393a6b){while(--_0x393a6b){_0x5f582e['push'](_0x5f582e['shift']());}};_0x437430(++_0x4112b7);}(_0x393e,0x175));var _0xe393=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x393e[_0x3070dc];return _0x431489;};var fs=require(_0xe393('0x0'));var path=require(_0xe393('0x1'));var config=require('../config/environment');var root=config[_0xe393('0x2')];var APP_JSON_PATH=path['resolve'](root,_0xe393('0x3'));var NODEPATH=path[_0xe393('0x4')](root,_0xe393('0x5'));function setLegacyLibsNodeEnvPath(_0x6ad2da){let _0x3038db=![];if(Array['isArray'](_0x6ad2da['apps'])){var _0xb937ab=_0x6ad2da[_0xe393('0x6')][_0xe393('0x7')](function(_0x28be30){return _0x28be30[_0xe393('0x8')]===_0xe393('0x9');});if(_0xb937ab>-0x1){var _0x399f8e=_0x6ad2da[_0xe393('0x6')][_0xb937ab];if(typeof _0x399f8e[_0xe393('0xa')][_0xe393('0xb')]!==_0xe393('0xc')){_0x399f8e['env']['NODE_PATH']=NODEPATH;_0x3038db=!![];}}return{'appConfig':_0x6ad2da,'updated':_0x3038db};}}function updateAppConfig(_0x57c094){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x5c640c){if(_0x5c640c){return fs[_0xe393('0xd')](APP_JSON_PATH)[_0xe393('0xe')](function(_0x1d9eea){var _0x1cfc94=setLegacyLibsNodeEnvPath(_0x1d9eea);if(_0x1cfc94[_0xe393('0xf')]){_0x57c094[_0xe393('0x10')](_0xe393('0x11'));return fs['writeJSON'](APP_JSON_PATH,_0x1d9eea,{'spaces':0x2});}else{return Promise[_0xe393('0x4')]();}});}else{return Promise[_0xe393('0x4')]();}});}module[_0xe393('0x12')]=updateAppConfig; \ No newline at end of file